From: support Date: Mon, 27 Mar 2023 16:01:23 +0000 (+0000) Subject: Built motion from commit a8c4dd89.|2.6.33 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=3d532920379767b510d2b61bc83c97d9b1f6d2b5;p=motion2.git Built motion from commit a8c4dd89.|2.6.33 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 9ca8756..71a49a3 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1,6 +1,6 @@ define({ "name": "xCALLY Motion API", - "version": "2.6.31", + "version": "2.6.33", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-27T07:22:02.593Z", + "time": "2023-03-27T15:51:14.173Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 467234a..9896e72 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1,6 +1,6 @@ { "name": "xCALLY Motion API", - "version": "2.6.31", + "version": "2.6.33", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-27T07:22:02.593Z", + "time": "2023-03-27T15:51:14.173Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index b5730ae..22e1ad1 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.31", + "version": "2.6.33", "dependencies": { "@babel/code-frame": { "version": "7.18.6", diff --git a/package.json b/package.json index 5e87c80..b4c0db1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.31", + "version": "2.6.33", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "main": "server/app.js", "engines": { diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index b8b3b5d..a9e22a9 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 _0xa004=['urlForward[body]','VIRTUAL','getDataValue','action','integration','motionbar','jscripty','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','STRING','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[headers],\x20browser[wsindowHeight]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa004,0x13c));var _0x4a00=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa004[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4a00('0x0')],'get':function(_0x1650f8){return this[_0x4a00('0x1')](_0x4a00('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x4a00('0x3'),_0x4a00('0x4'),_0x4a00('0x5'),_0x4a00('0x6'),_0x4a00('0x7'),_0x4a00('0x8'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x4a00('0x9')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x4a00('0xa')},'data2':{'type':Sequelize[_0x4a00('0xb')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x4a00('0xb')](0x1000),'comment':_0x4a00('0xc')},'data4':{'type':Sequelize[_0x4a00('0xb')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x4a00('0xb')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x4a00('0xb')],'comments':_0x4a00('0xd')},'data7':{'type':Sequelize['TEXT'],'comments':_0x4a00('0xe')}}; \ No newline at end of file +var _0x6877=['browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'];(function(_0x758e7f,_0x128061){var _0x1ad1e6=function(_0x1c1e6d){while(--_0x1c1e6d){_0x758e7f['push'](_0x758e7f['shift']());}};_0x1ad1e6(++_0x128061);}(_0x6877,0xb5));var _0x7687=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x6877[_0x2642cb];return _0xe6e41;};'use strict';var Sequelize=require(_0x7687('0x0'));module[_0x7687('0x1')]={'name':{'type':Sequelize[_0x7687('0x2')],'get':function(_0x3e8c55){return this[_0x7687('0x3')](_0x7687('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x7687('0x5'),_0x7687('0x6'),_0x7687('0x7'),_0x7687('0x8'),_0x7687('0x9'),_0x7687('0xa'),_0x7687('0xb'),_0x7687('0xc')]],'msg':_0x7687('0xd')}},'comment':_0x7687('0xd')},'data1':{'type':Sequelize[_0x7687('0xe')](0x1000),'comment':_0x7687('0xf')},'data2':{'type':Sequelize[_0x7687('0xe')](0x1000),'comment':_0x7687('0x10')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x7687('0x11')},'data5':{'type':Sequelize[_0x7687('0xe')](0x1000),'comments':_0x7687('0x12')},'data6':{'type':Sequelize['STRING'],'comments':_0x7687('0x13')},'data7':{'type':Sequelize[_0x7687('0x14')],'comments':_0x7687('0x15')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 2252a92..811263a 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 _0xb8be=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','body','find','params','catch','Action','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3d6bab,_0x3242db){var _0x348415=function(_0x324f3b){while(--_0x324f3b){_0x3d6bab['push'](_0x3d6bab['shift']());}};_0x348415(++_0x3242db);}(_0xb8be,0x112));var _0xeb8b=function(_0xb83ec2,_0x18e73b){_0xb83ec2=_0xb83ec2-0x0;var _0x4d2fbf=_0xb8be[_0xb83ec2];return _0x4d2fbf;};'use strict';var emlformat=require(_0xeb8b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeb8b('0x1'));var jsonpatch=require(_0xeb8b('0x2'));var rp=require(_0xeb8b('0x3'));var moment=require(_0xeb8b('0x4'));var BPromise=require(_0xeb8b('0x5'));var Mustache=require(_0xeb8b('0x6'));var util=require(_0xeb8b('0x7'));var path=require(_0xeb8b('0x8'));var sox=require(_0xeb8b('0x9'));var csv=require(_0xeb8b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb8b('0xb'));var _=require(_0xeb8b('0xc'));var squel=require('squel');var crypto=require(_0xeb8b('0xd'));var jsforce=require(_0xeb8b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xeb8b('0xa'));var querystring=require(_0xeb8b('0xf'));var Papa=require(_0xeb8b('0x10'));var Redis=require(_0xeb8b('0x11'));var authService=require(_0xeb8b('0x12'));var qs=require(_0xeb8b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb8b('0x14'));var logger=require(_0xeb8b('0x15'))(_0xeb8b('0x16'));var utils=require(_0xeb8b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xeb8b('0x18'));var db=require(_0xeb8b('0x19'))['db'];function respondWithStatusCode(_0x14b315,_0x53fc8a){_0x53fc8a=_0x53fc8a||0xcc;return function(_0x2fa880){if(_0x2fa880){return _0x14b315[_0xeb8b('0x1a')](_0x53fc8a);}return _0x14b315[_0xeb8b('0x1b')](_0x53fc8a)[_0xeb8b('0x1c')]();};}function respondWithResult(_0x2cc08c,_0x923f68){_0x923f68=_0x923f68||0xc8;return function(_0x4a99f0){if(_0x4a99f0){return _0x2cc08c[_0xeb8b('0x1b')](_0x923f68)[_0xeb8b('0x1d')](_0x4a99f0);}};}function respondWithFilteredResult(_0xa6a6d3,_0x2f5e86){return function(_0x174f35){if(_0x174f35){var _0x5e944e=typeof _0x2f5e86[_0xeb8b('0x1e')]===_0xeb8b('0x1f')&&typeof _0x2f5e86[_0xeb8b('0x20')]===_0xeb8b('0x1f');var _0x4d242b=_0x174f35[_0xeb8b('0x21')];var _0x5cc01b=_0x5e944e?0x0:_0x2f5e86[_0xeb8b('0x1e')];var _0x4dbb3a=_0x5e944e?_0x174f35[_0xeb8b('0x21')]:_0x2f5e86['offset']+_0x2f5e86['limit'];var _0x358a60;if(_0x4dbb3a>=_0x4d242b){_0x4dbb3a=_0x4d242b;_0x358a60=0xc8;}else{_0x358a60=0xce;}_0xa6a6d3[_0xeb8b('0x1b')](_0x358a60);return _0xa6a6d3['set'](_0xeb8b('0x22'),_0x5cc01b+'-'+_0x4dbb3a+'/'+_0x4d242b)['json'](_0x174f35);}return null;};}function patchUpdates(_0x5180c4){return function(_0x531642){try{jsonpatch[_0xeb8b('0x23')](_0x531642,_0x5180c4,!![]);}catch(_0x5796ed){return BPromise[_0xeb8b('0x24')](_0x5796ed);}return _0x531642['save']();};}function saveUpdates(_0x10aae0,_0x52140b){return function(_0x2c1692){if(_0x2c1692){return _0x2c1692[_0xeb8b('0x25')](_0x10aae0)[_0xeb8b('0x26')](function(_0x5f428f){return _0x5f428f;});}return null;};}function removeEntity(_0x5bf474,_0x399e5b){return function(_0x2e81a4){if(_0x2e81a4){return _0x2e81a4[_0xeb8b('0x27')]()[_0xeb8b('0x26')](function(){_0x5bf474['status'](0xcc)[_0xeb8b('0x1c')]();});}};}function handleEntityNotFound(_0x7249e9,_0xef8c2){return function(_0x16ef5f){if(!_0x16ef5f){_0x7249e9[_0xeb8b('0x1a')](0x194);}return _0x16ef5f;};}function handleError(_0x686637,_0x4a5342){_0x4a5342=_0x4a5342||0x1f4;return function(_0xd29ff1){logger[_0xeb8b('0x28')](_0xd29ff1[_0xeb8b('0x29')]);if(_0xd29ff1[_0xeb8b('0x2a')]){delete _0xd29ff1[_0xeb8b('0x2a')];}_0x686637['status'](_0x4a5342)[_0xeb8b('0x2b')](_0xd29ff1);};}exports[_0xeb8b('0x25')]=function(_0x1f57cf,_0xd8b4e2){if(_0x1f57cf[_0xeb8b('0x2c')]['id']){delete _0x1f57cf[_0xeb8b('0x2c')]['id'];}return db['Action'][_0xeb8b('0x2d')]({'where':{'id':_0x1f57cf[_0xeb8b('0x2e')]['id']}})[_0xeb8b('0x26')](handleEntityNotFound(_0xd8b4e2,null))[_0xeb8b('0x26')](saveUpdates(_0x1f57cf[_0xeb8b('0x2c')],null))['then'](respondWithResult(_0xd8b4e2,null))[_0xeb8b('0x2f')](handleError(_0xd8b4e2,null));};exports[_0xeb8b('0x27')]=function(_0x4dc512,_0x53ccc4){return db[_0xeb8b('0x30')][_0xeb8b('0x2d')]({'where':{'id':_0x4dc512[_0xeb8b('0x2e')]['id']}})['then'](handleEntityNotFound(_0x53ccc4,null))[_0xeb8b('0x26')](removeEntity(_0x53ccc4,null))[_0xeb8b('0x2f')](handleError(_0x53ccc4,null));}; \ No newline at end of file +var _0x9322=['limit','undefined','count','set','Content-Range','reject','then','destroy','end','error','stack','name','send','body','Action','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x1098bf,_0x1adfc5){var _0x1e130a=function(_0x55e577){while(--_0x55e577){_0x1098bf['push'](_0x1098bf['shift']());}};_0x1e130a(++_0x1adfc5);}(_0x9322,0x1c0));var _0x2932=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9322[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x2932('0x0'));var rimraf=require(_0x2932('0x1'));var zipdir=require(_0x2932('0x2'));var jsonpatch=require(_0x2932('0x3'));var rp=require(_0x2932('0x4'));var moment=require(_0x2932('0x5'));var BPromise=require(_0x2932('0x6'));var Mustache=require(_0x2932('0x7'));var util=require('util');var path=require(_0x2932('0x8'));var sox=require(_0x2932('0x9'));var csv=require('to-csv');var ejs=require(_0x2932('0xa'));var fs=require('fs');var fs_extra=require(_0x2932('0xb'));var _=require('lodash');var squel=require(_0x2932('0xc'));var crypto=require('crypto');var jsforce=require(_0x2932('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2932('0xe'));var querystring=require(_0x2932('0xf'));var Papa=require(_0x2932('0x10'));var Redis=require(_0x2932('0x11'));var authService=require(_0x2932('0x12'));var qs=require(_0x2932('0x13'));var as=require(_0x2932('0x14'));var hardwareService=require(_0x2932('0x15'));var logger=require(_0x2932('0x16'))(_0x2932('0x17'));var utils=require(_0x2932('0x18'));var config=require(_0x2932('0x19'));var licenseUtil=require(_0x2932('0x1a'));var db=require(_0x2932('0x1b'))['db'];function respondWithStatusCode(_0x4dda2a,_0x4b233c){_0x4b233c=_0x4b233c||0xcc;return function(_0x407dde){if(_0x407dde){return _0x4dda2a[_0x2932('0x1c')](_0x4b233c);}return _0x4dda2a[_0x2932('0x1d')](_0x4b233c)['end']();};}function respondWithResult(_0x465df5,_0x299b97){_0x299b97=_0x299b97||0xc8;return function(_0x13b5b9){if(_0x13b5b9){return _0x465df5[_0x2932('0x1d')](_0x299b97)[_0x2932('0x1e')](_0x13b5b9);}};}function respondWithFilteredResult(_0xf9cc74,_0xcfc2a1){return function(_0x238a76){if(_0x238a76){var _0x4a1d21=typeof _0xcfc2a1[_0x2932('0x1f')]==='undefined'&&typeof _0xcfc2a1[_0x2932('0x20')]===_0x2932('0x21');var _0x5c89e7=_0x238a76[_0x2932('0x22')];var _0x3f8387=_0x4a1d21?0x0:_0xcfc2a1[_0x2932('0x1f')];var _0x4eb3ee=_0x4a1d21?_0x238a76[_0x2932('0x22')]:_0xcfc2a1['offset']+_0xcfc2a1[_0x2932('0x20')];var _0x2147ee;if(_0x4eb3ee>=_0x5c89e7){_0x4eb3ee=_0x5c89e7;_0x2147ee=0xc8;}else{_0x2147ee=0xce;}_0xf9cc74['status'](_0x2147ee);return _0xf9cc74[_0x2932('0x23')](_0x2932('0x24'),_0x3f8387+'-'+_0x4eb3ee+'/'+_0x5c89e7)[_0x2932('0x1e')](_0x238a76);}return null;};}function patchUpdates(_0x181126){return function(_0x326012){try{jsonpatch['apply'](_0x326012,_0x181126,!![]);}catch(_0x8018a7){return BPromise[_0x2932('0x25')](_0x8018a7);}return _0x326012['save']();};}function saveUpdates(_0x587598,_0x5cf397){return function(_0x3765ea){if(_0x3765ea){return _0x3765ea['update'](_0x587598)[_0x2932('0x26')](function(_0x5df732){return _0x5df732;});}return null;};}function removeEntity(_0x289d68,_0x3deb36){return function(_0x57b872){if(_0x57b872){return _0x57b872[_0x2932('0x27')]()[_0x2932('0x26')](function(){_0x289d68['status'](0xcc)[_0x2932('0x28')]();});}};}function handleEntityNotFound(_0x2e5b52,_0x2d971c){return function(_0x329c7c){if(!_0x329c7c){_0x2e5b52[_0x2932('0x1c')](0x194);}return _0x329c7c;};}function handleError(_0x4e9951,_0x1c4711){_0x1c4711=_0x1c4711||0x1f4;return function(_0x1047b2){logger[_0x2932('0x29')](_0x1047b2[_0x2932('0x2a')]);if(_0x1047b2[_0x2932('0x2b')]){delete _0x1047b2['name'];}_0x4e9951[_0x2932('0x1d')](_0x1c4711)[_0x2932('0x2c')](_0x1047b2);};}exports['update']=function(_0x4efe19,_0x3a1070){if(_0x4efe19[_0x2932('0x2d')]['id']){delete _0x4efe19[_0x2932('0x2d')]['id'];}return db[_0x2932('0x2e')]['find']({'where':{'id':_0x4efe19[_0x2932('0x2f')]['id']}})[_0x2932('0x26')](handleEntityNotFound(_0x3a1070,null))[_0x2932('0x26')](saveUpdates(_0x4efe19[_0x2932('0x2d')],null))[_0x2932('0x26')](respondWithResult(_0x3a1070,null))['catch'](handleError(_0x3a1070,null));};exports[_0x2932('0x27')]=function(_0x4f2767,_0xf50b6f){return db[_0x2932('0x2e')]['find']({'where':{'id':_0x4f2767[_0x2932('0x2f')]['id']}})[_0x2932('0x26')](handleEntityNotFound(_0xf50b6f,null))['then'](removeEntity(_0xf50b6f,null))['catch'](handleError(_0xf50b6f,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index d12d693..dad8473 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 _0x1572=['./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5845db,_0x562571){var _0x79f401=function(_0x39eee1){while(--_0x39eee1){_0x5845db['push'](_0x5845db['shift']());}};_0x79f401(++_0x562571);}(_0x1572,0xf5));var _0x2157=function(_0x3967e3,_0x173410){_0x3967e3=_0x3967e3-0x0;var _0x572629=_0x1572[_0x3967e3];return _0x572629;};'use strict';var _=require(_0x2157('0x0'));var util=require(_0x2157('0x1'));var logger=require(_0x2157('0x2'))(_0x2157('0x3'));var moment=require(_0x2157('0x4'));var BPromise=require(_0x2157('0x5'));var rp=require(_0x2157('0x6'));var fs=require('fs');var path=require(_0x2157('0x7'));var rimraf=require(_0x2157('0x8'));var config=require(_0x2157('0x9'));var attributes=require(_0x2157('0xa'));module[_0x2157('0xb')]=function(_0x2f13ab,_0x9e1c46){return _0x2f13ab[_0x2157('0xc')](_0x2157('0xd'),attributes,{'tableName':_0x2157('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6208=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','define','Action','tools_actions','util'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0x6208,0x192));var _0x8620=function(_0x44c768,_0x552a5e){_0x44c768=_0x44c768-0x0;var _0x55daf5=_0x6208[_0x44c768];return _0x55daf5;};'use strict';var _=require('lodash');var util=require(_0x8620('0x0'));var logger=require(_0x8620('0x1'))(_0x8620('0x2'));var moment=require(_0x8620('0x3'));var BPromise=require(_0x8620('0x4'));var rp=require(_0x8620('0x5'));var fs=require('fs');var path=require(_0x8620('0x6'));var rimraf=require(_0x8620('0x7'));var config=require(_0x8620('0x8'));var attributes=require(_0x8620('0x9'));module['exports']=function(_0x1069e7,_0x431cfc){return _0x1069e7[_0x8620('0xa')](_0x8620('0xb'),attributes,{'tableName':_0x8620('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 61e6511..b11187b 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 _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x1aa10b,_0x1fdaeb){var _0x2ec705=function(_0x34fde7){while(--_0x34fde7){_0x1aa10b['push'](_0x1aa10b['shift']());}};_0x2ec705(++_0x1fdaeb);}(_0xabce,0x103));var _0xeabc=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xabce[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x65a7d8,_0x481040){var _0x3207bf=function(_0x199b26){while(--_0x199b26){_0x65a7d8['push'](_0x65a7d8['shift']());}};_0x3207bf(++_0x481040);}(_0xe14b,0x93));var _0xbe14=function(_0x492bf9,_0x3494c9){_0x492bf9=_0x492bf9-0x0;var _0x2df282=_0xe14b[_0x492bf9];return _0x2df282;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 040a294..b9a6156 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 _0xad0f=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','put','/:id','isAuthenticated','update','delete','destroy','multer','util'];(function(_0x267fa6,_0x12d275){var _0xd93bde=function(_0xe8a28d){while(--_0xe8a28d){_0x267fa6['push'](_0x267fa6['shift']());}};_0xd93bde(++_0x12d275);}(_0xad0f,0x1b8));var _0xfad0=function(_0x427217,_0x4039b1){_0x427217=_0x427217-0x0;var _0x5b28fb=_0xad0f[_0x427217];return _0x5b28fb;};'use strict';var multer=require(_0xfad0('0x0'));var util=require(_0xfad0('0x1'));var path=require('path');var timeout=require(_0xfad0('0x2'));var express=require('express');var router=express[_0xfad0('0x3')]();var fs_extra=require(_0xfad0('0x4'));var auth=require(_0xfad0('0x5'));var interaction=require(_0xfad0('0x6'));var config=require('../../config/environment');var controller=require('./action.controller');router[_0xfad0('0x7')](_0xfad0('0x8'),auth[_0xfad0('0x9')](),controller[_0xfad0('0xa')]);router[_0xfad0('0xb')](_0xfad0('0x8'),auth[_0xfad0('0x9')](),controller[_0xfad0('0xc')]);module['exports']=router; \ No newline at end of file +var _0xad91=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x4c538c,_0x46c4dc){var _0x236796=function(_0x10c34f){while(--_0x10c34f){_0x4c538c['push'](_0x4c538c['shift']());}};_0x236796(++_0x46c4dc);}(_0xad91,0x91));var _0x1ad9=function(_0x593b33,_0x1ea034){_0x593b33=_0x593b33-0x0;var _0x2f17a2=_0xad91[_0x593b33];return _0x2f17a2;};'use strict';var multer=require('multer');var util=require(_0x1ad9('0x0'));var path=require(_0x1ad9('0x1'));var timeout=require(_0x1ad9('0x2'));var express=require(_0x1ad9('0x3'));var router=express[_0x1ad9('0x4')]();var fs_extra=require(_0x1ad9('0x5'));var auth=require(_0x1ad9('0x6'));var interaction=require(_0x1ad9('0x7'));var config=require(_0x1ad9('0x8'));var controller=require(_0x1ad9('0x9'));router[_0x1ad9('0xa')](_0x1ad9('0xb'),auth[_0x1ad9('0xc')](),controller['update']);router['delete'](_0x1ad9('0xb'),auth[_0x1ad9('0xc')](),controller[_0x1ad9('0xd')]);module[_0x1ad9('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 c4854eb..c6166d1 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 _0x3eea=['STRING','TEXT','sequelize'];(function(_0x408acc,_0x33c9ae){var _0x4208c5=function(_0xa1ffbe){while(--_0xa1ffbe){_0x408acc['push'](_0x408acc['shift']());}};_0x4208c5(++_0x33c9ae);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x3b38fc,_0x381fac){_0x3b38fc=_0x3b38fc-0x0;var _0x5b7b96=_0x3eea[_0x3b38fc];return _0x5b7b96;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3ee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3ee('0x1')]},'parent':{'type':Sequelize[_0xa3ee('0x1')]},'table':{'type':Sequelize[_0xa3ee('0x1')]},'conditions':{'type':Sequelize[_0xa3ee('0x2')]},'joins':{'type':Sequelize[_0xa3ee('0x2')]}}; \ No newline at end of file +var _0x7dfd=['STRING','TEXT','sequelize','exports'];(function(_0x340d49,_0x4ee2b4){var _0x2cf1ec=function(_0x12f166){while(--_0x12f166){_0x340d49['push'](_0x340d49['shift']());}};_0x2cf1ec(++_0x4ee2b4);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'name':{'type':Sequelize[_0xd7df('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd7df('0x2')]},'parent':{'type':Sequelize[_0xd7df('0x2')]},'table':{'type':Sequelize[_0xd7df('0x2')]},'conditions':{'type':Sequelize[_0xd7df('0x3')]},'joins':{'type':Sequelize[_0xd7df('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 622b57f..762a761 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 _0x8967=['../../mysqldb','dbH','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','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)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20EMPTY','rules','group','field','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','table','MetricId','metric','replace','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','SELECT','COUNT(DISTINCT\x20%s)','IS\x20NULL','IS\x20EMPTY','operator','condition','value','web','fullPath','%s-%s.%s','randomstring','generate','output','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','sequelize','QueryTypes','runReport','IS\x20NOT\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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'];(function(_0x4304b0,_0x2a83af){var _0x3e303a=function(_0x2df888){while(--_0x2df888){_0x4304b0['push'](_0x4304b0['shift']());}};_0x3e303a(++_0x2a83af);}(_0x8967,0x13b));var _0x7896=function(_0x39772f,_0x5605cb){_0x39772f=_0x39772f-0x0;var _0xc9edbf=_0x8967[_0x39772f];return _0xc9edbf;};'use strict';var emlformat=require(_0x7896('0x0'));var rimraf=require(_0x7896('0x1'));var zipdir=require(_0x7896('0x2'));var jsonpatch=require(_0x7896('0x3'));var rp=require(_0x7896('0x4'));var moment=require(_0x7896('0x5'));var BPromise=require(_0x7896('0x6'));var Mustache=require(_0x7896('0x7'));var util=require(_0x7896('0x8'));var path=require(_0x7896('0x9'));var sox=require(_0x7896('0xa'));var csv=require(_0x7896('0xb'));var ejs=require(_0x7896('0xc'));var fs=require('fs');var fs_extra=require(_0x7896('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7896('0xe'));var deskjs=require(_0x7896('0xf'));var toCsv=require(_0x7896('0xb'));var querystring=require(_0x7896('0x10'));var Papa=require('papaparse');var Redis=require(_0x7896('0x11'));var authService=require(_0x7896('0x12'));var qs=require(_0x7896('0x13'));var as=require(_0x7896('0x14'));var hardwareService=require(_0x7896('0x15'));var logger=require(_0x7896('0x16'))(_0x7896('0x17'));var utils=require(_0x7896('0x18'));var config=require(_0x7896('0x19'));var licenseUtil=require(_0x7896('0x1a'));var db=require(_0x7896('0x1b'))['db'];var dbH=require(_0x7896('0x1b'))[_0x7896('0x1c')];function respondWithStatusCode(_0x3c84fc,_0x1942c6){_0x1942c6=_0x1942c6||0xcc;return function(_0x26215d){if(_0x26215d){return _0x3c84fc[_0x7896('0x1d')](_0x1942c6);}return _0x3c84fc[_0x7896('0x1e')](_0x1942c6)[_0x7896('0x1f')]();};}function respondWithResult(_0x4c8213,_0x36c2d6){_0x36c2d6=_0x36c2d6||0xc8;return function(_0x54b6ae){if(_0x54b6ae){return _0x4c8213[_0x7896('0x1e')](_0x36c2d6)['json'](_0x54b6ae);}};}function respondWithFilteredResult(_0x5bb3f0,_0x5db57c){return function(_0x308263){if(_0x308263){var _0x90348f=typeof _0x5db57c[_0x7896('0x20')]==='undefined'&&typeof _0x5db57c['limit']===_0x7896('0x21');var _0x3a1821=_0x308263[_0x7896('0x22')];var _0x14375c=_0x90348f?0x0:_0x5db57c[_0x7896('0x20')];var _0x2af1d3=_0x90348f?_0x308263[_0x7896('0x22')]:_0x5db57c['offset']+_0x5db57c[_0x7896('0x23')];var _0x348295;if(_0x2af1d3>=_0x3a1821){_0x2af1d3=_0x3a1821;_0x348295=0xc8;}else{_0x348295=0xce;}_0x5bb3f0[_0x7896('0x1e')](_0x348295);return _0x5bb3f0[_0x7896('0x24')](_0x7896('0x25'),_0x14375c+'-'+_0x2af1d3+'/'+_0x3a1821)[_0x7896('0x26')](_0x308263);}return null;};}function patchUpdates(_0x1fc8a1){return function(_0x46d94a){try{jsonpatch[_0x7896('0x27')](_0x46d94a,_0x1fc8a1,!![]);}catch(_0x439029){return BPromise[_0x7896('0x28')](_0x439029);}return _0x46d94a[_0x7896('0x29')]();};}function saveUpdates(_0x1d9086,_0x510315){return function(_0x287cd6){if(_0x287cd6){return _0x287cd6[_0x7896('0x2a')](_0x1d9086)[_0x7896('0x2b')](function(_0x34c89c){return _0x34c89c;});}return null;};}function removeEntity(_0x283b12,_0x1c1018){return function(_0x2a652a){if(_0x2a652a){return _0x2a652a[_0x7896('0x2c')]()[_0x7896('0x2b')](function(){var _0x4c90e5=_0x2a652a[_0x7896('0x2d')]({'plain':!![]});var _0xbb87b0=_0x7896('0x2e');return db[_0x7896('0x2f')][_0x7896('0x2c')]({'where':{'type':_0xbb87b0,'resourceId':_0x4c90e5['id']}})[_0x7896('0x2b')](function(){return _0x2a652a;});})['then'](function(){_0x283b12[_0x7896('0x1e')](0xcc)[_0x7896('0x1f')]();});}};}function handleEntityNotFound(_0xa14a44,_0x5261dc){return function(_0x3697bf){if(!_0x3697bf){_0xa14a44[_0x7896('0x1d')](0x194);}return _0x3697bf;};}function handleError(_0xdfa8b0,_0x187f29){_0x187f29=_0x187f29||0x1f4;return function(_0x32deb9){logger[_0x7896('0x30')](_0x32deb9[_0x7896('0x31')]);if(_0x32deb9['name']){delete _0x32deb9[_0x7896('0x32')];}_0xdfa8b0['status'](_0x187f29)[_0x7896('0x33')](_0x32deb9);};}exports[_0x7896('0x34')]=function(_0x11844e,_0x48c992){var _0x5d4edf={},_0xc69d54={},_0x470f1f={'count':0x0,'rows':[]};var _0x3f3599=_[_0x7896('0x35')](db[_0x7896('0x36')][_0x7896('0x37')],function(_0xd08776){return{'name':_0xd08776[_0x7896('0x38')],'type':_0xd08776[_0x7896('0x39')]['key']};});_0xc69d54[_0x7896('0x3a')]=_['map'](_0x3f3599,_0x7896('0x32'));_0xc69d54[_0x7896('0x3b')]=_[_0x7896('0x3c')](_0x11844e['query']);_0xc69d54['filters']=_[_0x7896('0x3d')](_0xc69d54[_0x7896('0x3a')],_0xc69d54[_0x7896('0x3b')]);_0x5d4edf[_0x7896('0x3e')]=_[_0x7896('0x3d')](_0xc69d54[_0x7896('0x3a')],qs[_0x7896('0x3f')](_0x11844e[_0x7896('0x3b')][_0x7896('0x3f')]));_0x5d4edf['attributes']=_0x5d4edf[_0x7896('0x3e')][_0x7896('0x40')]?_0x5d4edf[_0x7896('0x3e')]:_0xc69d54[_0x7896('0x3a')];if(!_0x11844e[_0x7896('0x3b')][_0x7896('0x41')](_0x7896('0x42'))){_0x5d4edf[_0x7896('0x23')]=qs[_0x7896('0x23')](_0x11844e[_0x7896('0x3b')][_0x7896('0x23')]);_0x5d4edf['offset']=qs[_0x7896('0x20')](_0x11844e[_0x7896('0x3b')][_0x7896('0x20')]);}_0x5d4edf[_0x7896('0x43')]=qs[_0x7896('0x44')](_0x11844e[_0x7896('0x3b')]['sort']);_0x5d4edf[_0x7896('0x45')]=qs[_0x7896('0x46')](_[_0x7896('0x47')](_0x11844e[_0x7896('0x3b')],_0xc69d54['filters']),_0x3f3599);if(_0x11844e[_0x7896('0x3b')]['filter']){_0x5d4edf[_0x7896('0x45')]=_[_0x7896('0x48')](_0x5d4edf['where'],{'$or':_['map'](_0x3f3599,function(_0x36c029){if(_0x36c029['type']!==_0x7896('0x49')){var _0xdbdeef={};_0xdbdeef[_0x36c029['name']]={'$like':'%'+_0x11844e[_0x7896('0x3b')]['filter']+'%'};return _0xdbdeef;}})});}_0x5d4edf=_['merge']({},_0x5d4edf,_0x11844e[_0x7896('0x4a')]);var _0x478071={'where':_0x5d4edf[_0x7896('0x45')]};return db[_0x7896('0x36')]['count'](_0x478071)[_0x7896('0x2b')](function(_0x1b59db){_0x470f1f[_0x7896('0x22')]=_0x1b59db;if(_0x11844e[_0x7896('0x3b')][_0x7896('0x4b')]){_0x5d4edf[_0x7896('0x4c')]=[{'all':!![]}];}return db[_0x7896('0x36')]['findAll'](_0x5d4edf);})[_0x7896('0x2b')](function(_0x24fdc6){_0x470f1f[_0x7896('0x4d')]=_0x24fdc6;return _0x470f1f;})[_0x7896('0x2b')](respondWithFilteredResult(_0x48c992,_0x5d4edf))['catch'](handleError(_0x48c992,null));};exports[_0x7896('0x4e')]=function(_0x29f21b,_0x1d9db5){var _0x4ef3de={'raw':![],'where':{'id':_0x29f21b[_0x7896('0x4f')]['id']}},_0xed06b={};_0xed06b['model']=_[_0x7896('0x3c')](db[_0x7896('0x36')]['rawAttributes']);_0xed06b[_0x7896('0x3b')]=_[_0x7896('0x3c')](_0x29f21b[_0x7896('0x3b')]);_0xed06b['filters']=_[_0x7896('0x3d')](_0xed06b['model'],_0xed06b[_0x7896('0x3b')]);_0x4ef3de[_0x7896('0x3e')]=_['intersection'](_0xed06b[_0x7896('0x3a')],qs[_0x7896('0x3f')](_0x29f21b[_0x7896('0x3b')][_0x7896('0x3f')]));_0x4ef3de[_0x7896('0x3e')]=_0x4ef3de[_0x7896('0x3e')]['length']?_0x4ef3de['attributes']:_0xed06b['model'];if(_0x29f21b[_0x7896('0x3b')][_0x7896('0x4b')]){_0x4ef3de[_0x7896('0x4c')]=[{'all':!![]}];}_0x4ef3de=_[_0x7896('0x48')]({},_0x4ef3de,_0x29f21b[_0x7896('0x4a')]);return db[_0x7896('0x36')][_0x7896('0x50')](_0x4ef3de)[_0x7896('0x2b')](handleEntityNotFound(_0x1d9db5,null))[_0x7896('0x2b')](respondWithResult(_0x1d9db5,null))[_0x7896('0x51')](handleError(_0x1d9db5,null));};exports[_0x7896('0x52')]=function(_0x422d29,_0x4265a1){return db['AnalyticCustomReport'][_0x7896('0x52')](_0x422d29[_0x7896('0x53')],{})[_0x7896('0x2b')](function(_0x142361){var _0x2991bf=_0x422d29[_0x7896('0x54')][_0x7896('0x2d')]({'plain':!![]});if(!_0x2991bf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2991bf['role']==='user'){var _0x54f9e9=_0x142361['get']({'plain':!![]});var _0x50b3d5='Reports';return db[_0x7896('0x55')][_0x7896('0x50')]({'where':{'name':_0x50b3d5,'userProfileId':_0x2991bf['userProfileId']},'raw':!![]})[_0x7896('0x2b')](function(_0x24431e){if(_0x24431e&&_0x24431e[_0x7896('0x56')]===0x0){return db[_0x7896('0x2f')][_0x7896('0x52')]({'name':_0x54f9e9['name'],'resourceId':_0x54f9e9['id'],'type':_0x7896('0x2e'),'sectionId':_0x24431e['id']},{})[_0x7896('0x2b')](function(){return _0x142361;});}else{return _0x142361;}})['catch'](function(_0x3dfe78){logger[_0x7896('0x30')](_0x7896('0x57'),_0x3dfe78);throw _0x3dfe78;});}return _0x142361;})['then'](respondWithResult(_0x4265a1,0xc9))[_0x7896('0x51')](handleError(_0x4265a1,null));};exports[_0x7896('0x2a')]=function(_0xc97ebd,_0x5d9a45){if(_0xc97ebd[_0x7896('0x53')]['id']){delete _0xc97ebd['body']['id'];}return db[_0x7896('0x36')]['find']({'where':{'id':_0xc97ebd[_0x7896('0x4f')]['id']}})[_0x7896('0x2b')](handleEntityNotFound(_0x5d9a45,null))[_0x7896('0x2b')](saveUpdates(_0xc97ebd[_0x7896('0x53')],null))['then'](respondWithResult(_0x5d9a45,null))[_0x7896('0x51')](handleError(_0x5d9a45,null));};exports[_0x7896('0x2c')]=function(_0x582734,_0x5eb072){return db[_0x7896('0x36')][_0x7896('0x50')]({'where':{'id':_0x582734[_0x7896('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5eb072,null))[_0x7896('0x2b')](removeEntity(_0x5eb072,null))[_0x7896('0x51')](handleError(_0x5eb072,null));};exports['preview']=function(_0x37a2bb,_0x24336c){var _0x353d10=0xa;var _0x207fe4=[_0x7896('0x58'),_0x7896('0x59'),_0x7896('0x5a'),_0x7896('0x5b')];var _0x4cd9cb={'SUM':_0x7896('0x5c'),'COUNT':_0x7896('0x5d'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7896('0x5e'),'MIN':_0x7896('0x5f'),'AVG':_0x7896('0x60'),'GROUP_CONCAT':_0x7896('0x61'),'GROUP_CONCAT ASC':_0x7896('0x62'),'GROUP_CONCAT DESC':_0x7896('0x63')};var _0x312795={'SEC_TO_TIME':_0x7896('0x64'),'DATE':_0x7896('0x65'),'HOUR':_0x7896('0x66'),'ROUND':_0x7896('0x67'),'UNIX_TIMESTAMP':_0x7896('0x68')};var _0x3f3d2a=function(_0x443747){return!_[_0x7896('0x69')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x7896('0x6a')],_0x443747);};var _0x4ad86b=function(_0x3b95d0){if(!_0x3b95d0||!_0x3b95d0[_0x7896('0x6b')][_0x7896('0x40')]){return'';}for(var _0x17c0c5='(',_0x1e4a50=0x0;_0x1e4a50<_0x3b95d0[_0x7896('0x6b')][_0x7896('0x40')];_0x1e4a50+=0x1){_0x1e4a50>0x0&&(_0x17c0c5+='\x20'+_0x3b95d0['operator']+'\x20');_0x17c0c5+=_0x3b95d0[_0x7896('0x6b')][_0x1e4a50][_0x7896('0x6c')]?_0x4ad86b(_0x3b95d0[_0x7896('0x6b')][_0x1e4a50]['group']):_0x3b95d0[_0x7896('0x6b')][_0x1e4a50][_0x7896('0x6d')]+'\x20'+_0x3b95d0[_0x7896('0x6b')][_0x1e4a50]['condition']+(_0x3f3d2a(_0x3b95d0['rules'][_0x1e4a50]['condition'])?'\x20'+_0x3b95d0[_0x7896('0x6b')][_0x1e4a50]['value']:'');}return _0x17c0c5+')';};var _0x28fb43={'where':{'id':_0x37a2bb['params']['id']}},_0x16c8fa,_0xf7ca4,_0x23fa4b,_0x5a1bf0,_0x4b368a;_0x28fb43=_['merge']({},_0x28fb43,_0x37a2bb['options']);return db[_0x7896('0x36')]['find'](_0x28fb43)['then'](function(_0x335f39){if(_0x335f39){_0x16c8fa=_0x335f39;return _0x335f39[_0x7896('0x6e')]();}return null;})['then'](function(_0x121ca9){if(_0x121ca9){if(!_0x121ca9['length']){throw new db[(_0x7896('0x6f'))][(_0x7896('0x70'))](_0x7896('0x71'),0x193);}_0xf7ca4=_0x121ca9;return db[_0x7896('0x72')][_0x7896('0x73')]({'raw':!![]});}return null;})[_0x7896('0x2b')](function(_0x2f89f1){if(_0x2f89f1){_0x23fa4b=_[_0x7896('0x74')](_0x2f89f1,'id');var _0x2959bd;var _0x2c4b8b=squel[_0x7896('0x75')]();_0x2c4b8b['from'](_0x16c8fa[_0x7896('0x76')]);for(var _0x169444=0x0;_0x169444<_0xf7ca4[_0x7896('0x40')];_0x169444+=0x1){_0x2959bd=_0xf7ca4[_0x169444][_0x7896('0x77')]?_0x23fa4b[_0xf7ca4[_0x169444]['MetricId']][_0x7896('0x78')]:_0xf7ca4[_0x169444][_0x7896('0x6d')];_0x2959bd=_0xf7ca4[_0x169444]['function']?_[_0x7896('0x79')](_0x4cd9cb[_0xf7ca4[_0x169444][_0x7896('0x7a')]],'%s',_0x2959bd):_0x2959bd;_0x2959bd=_0xf7ca4[_0x169444][_0x7896('0x7b')]?_[_0x7896('0x79')](_0x312795[_0xf7ca4[_0x169444][_0x7896('0x7b')]],'%s',_0x2959bd):_0x2959bd;if(_0xf7ca4[_0x169444][_0x7896('0x7c')]){_0x2c4b8b[_0x7896('0x6c')](_0x2959bd);}_0xf7ca4[_0x169444][_0x7896('0x7d')]&&_0x2c4b8b[_0x7896('0x43')](_0x2959bd,_0xf7ca4[_0x169444][_0x7896('0x7d')]===_0x7896('0x7e')?![]:!![]);_0x2c4b8b[_0x7896('0x6d')](_0x2959bd,_0xf7ca4[_0x169444][_0x7896('0x7f')]||_0x2959bd);}if(_0x16c8fa[_0x7896('0x80')]){_0x16c8fa['joins']=JSON[_0x7896('0x81')](_0x16c8fa[_0x7896('0x80')]);for(var _0x54d0b=0x0;_0x54d0b<_0x16c8fa[_0x7896('0x80')]['length'];_0x54d0b+=0x1){if(_0x16c8fa[_0x7896('0x80')][_0x54d0b][_0x7896('0x39')]&&_[_0x7896('0x69')](_0x207fe4,_0x16c8fa[_0x7896('0x80')][_0x54d0b][_0x7896('0x39')])&&_0x16c8fa[_0x7896('0x80')][_0x54d0b][_0x7896('0x82')]&&_0x16c8fa['joins'][_0x54d0b][_0x7896('0x83')]&&_0x16c8fa[_0x7896('0x80')][_0x54d0b]['foreignKey']){_0x2c4b8b[_0x16c8fa[_0x7896('0x80')][_0x54d0b]['type']](_0x16c8fa[_0x7896('0x80')][_0x54d0b][_0x7896('0x83')],null,util[_0x7896('0x7b')](_0x7896('0x84'),_0x16c8fa[_0x7896('0x76')],_0x16c8fa['joins'][_0x54d0b][_0x7896('0x82')],_0x16c8fa[_0x7896('0x80')][_0x54d0b][_0x7896('0x83')],_0x16c8fa[_0x7896('0x80')][_0x54d0b][_0x7896('0x85')]));}}}if(_0x16c8fa[_0x7896('0x86')]){_0x16c8fa[_0x7896('0x86')]=JSON['parse'](_0x16c8fa['conditions']);_0x2c4b8b['where'](_0x4ad86b(_0x16c8fa[_0x7896('0x86')][_0x7896('0x6c')]));}_0x4b368a=_0x2c4b8b[_0x7896('0x87')]();_0x2c4b8b[_0x7896('0x23')](_0x353d10);_0x2c4b8b['offset'](0x0);logger[_0x7896('0x88')](_0x7896('0x89'),_0x2c4b8b[_0x7896('0x8a')]());return dbH['sequelize']['query'](_0x2c4b8b['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x7896('0x8b')]});}})[_0x7896('0x2b')](respondWithResult(_0x24336c,null))['catch'](handleError(_0x24336c,null));};function runReport(_0x21ec8c,_0x363c93,_0x565049){var _0x57721d=_0x363c93[_0x7896('0x32')];var _0x29e3dc=0xa;var _0x462a3f=[_0x7896('0x58'),_0x7896('0x59'),_0x7896('0x5a'),'cross_join'];var _0x28807b={'SUM':'SUM(%s)','COUNT':_0x7896('0x5d'),'COUNT DISTINCT':_0x7896('0x8c'),'MAX':_0x7896('0x5e'),'MIN':_0x7896('0x5f'),'AVG':_0x7896('0x60'),'GROUP_CONCAT':_0x7896('0x61'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7896('0x63')};var _0x122285={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x7896('0x66'),'ROUND':_0x7896('0x67'),'UNIX_TIMESTAMP':_0x7896('0x68')};var _0x4b2209=function(_0x3a781a){return!_[_0x7896('0x69')]([_0x7896('0x8d'),'IS\x20NOT\x20NULL',_0x7896('0x8e'),_0x7896('0x6a')],_0x3a781a);};var _0x223de2=function(_0x27218e){if(!_0x27218e||!_0x27218e['rules']['length']){return'';}for(var _0x36021a='(',_0x3097b3=0x0;_0x3097b3<_0x27218e[_0x7896('0x6b')][_0x7896('0x40')];_0x3097b3+=0x1){_0x3097b3>0x0&&(_0x36021a+='\x20'+_0x27218e[_0x7896('0x8f')]+'\x20');_0x36021a+=_0x27218e[_0x7896('0x6b')][_0x3097b3][_0x7896('0x6c')]?_0x223de2(_0x27218e[_0x7896('0x6b')][_0x3097b3]['group']):_0x27218e['rules'][_0x3097b3]['field']+'\x20'+_0x27218e['rules'][_0x3097b3][_0x7896('0x90')]+(_0x4b2209(_0x27218e[_0x7896('0x6b')][_0x3097b3]['condition'])?'\x20'+_0x27218e[_0x7896('0x6b')][_0x3097b3][_0x7896('0x91')]:'');}return _0x36021a+')';};var _0x53a6e9={'where':{'id':_0x21ec8c['id']}},_0x359189,_0xe24a8e,_0x36bb60,_0x177502,_0x126095;_0x53a6e9=_['merge']({},_0x53a6e9,_0x565049);return db[_0x7896('0x36')][_0x7896('0x50')](_0x53a6e9)[_0x7896('0x2b')](function(_0x313d64){if(_0x313d64){_0x359189=_0x313d64;return _0x313d64[_0x7896('0x6e')]();}return null;})[_0x7896('0x2b')](function(_0x273ca6){if(_0x273ca6){if(!_0x273ca6[_0x7896('0x40')]){throw new db[(_0x7896('0x6f'))]['ValidationErrorItem'](_0x7896('0x71'),0x193);}_0xe24a8e=_0x273ca6;return db[_0x7896('0x72')][_0x7896('0x73')]({'raw':!![]});}return null;})['then'](function(_0x1d5618){if(_0x1d5618){_0x36bb60=_[_0x7896('0x74')](_0x1d5618,'id');var _0x5995ad;var _0x28f5f2=squel[_0x7896('0x75')]();_0x28f5f2['from'](_0x359189[_0x7896('0x76')]);for(var _0x183ef8=0x0;_0x183ef8<_0xe24a8e[_0x7896('0x40')];_0x183ef8+=0x1){_0x5995ad=_0xe24a8e[_0x183ef8][_0x7896('0x77')]?_0x36bb60[_0xe24a8e[_0x183ef8]['MetricId']][_0x7896('0x78')]:_0xe24a8e[_0x183ef8][_0x7896('0x6d')];_0x5995ad=_0xe24a8e[_0x183ef8][_0x7896('0x7a')]?_[_0x7896('0x79')](_0x28807b[_0xe24a8e[_0x183ef8][_0x7896('0x7a')]],'%s',_0x5995ad):_0x5995ad;_0x5995ad=_0xe24a8e[_0x183ef8][_0x7896('0x7b')]?_[_0x7896('0x79')](_0x122285[_0xe24a8e[_0x183ef8]['format']],'%s',_0x5995ad):_0x5995ad;if(_0xe24a8e[_0x183ef8][_0x7896('0x7c')]){_0x28f5f2[_0x7896('0x6c')](_0x5995ad);}_0xe24a8e[_0x183ef8][_0x7896('0x7d')]&&_0x28f5f2['order'](_0x5995ad,_0xe24a8e[_0x183ef8]['orderBy']===_0x7896('0x7e')?![]:!![]);_0x28f5f2[_0x7896('0x6d')](_0x5995ad,_0xe24a8e[_0x183ef8][_0x7896('0x7f')]||_0x5995ad);}if(_0x359189[_0x7896('0x80')]){_0x359189[_0x7896('0x80')]=JSON[_0x7896('0x81')](_0x359189[_0x7896('0x80')]);for(var _0x3620e4=0x0;_0x3620e4<_0x359189[_0x7896('0x80')]['length'];_0x3620e4+=0x1){if(_0x359189[_0x7896('0x80')][_0x3620e4][_0x7896('0x39')]&&_[_0x7896('0x69')](_0x462a3f,_0x359189['joins'][_0x3620e4][_0x7896('0x39')])&&_0x359189[_0x7896('0x80')][_0x3620e4][_0x7896('0x82')]&&_0x359189['joins'][_0x3620e4][_0x7896('0x83')]&&_0x359189[_0x7896('0x80')][_0x3620e4][_0x7896('0x85')]){_0x28f5f2[_0x359189[_0x7896('0x80')][_0x3620e4][_0x7896('0x39')]](_0x359189[_0x7896('0x80')][_0x3620e4][_0x7896('0x83')],null,util[_0x7896('0x7b')](_0x7896('0x84'),_0x359189[_0x7896('0x76')],_0x359189[_0x7896('0x80')][_0x3620e4][_0x7896('0x82')],_0x359189[_0x7896('0x80')][_0x3620e4][_0x7896('0x83')],_0x359189[_0x7896('0x80')][_0x3620e4][_0x7896('0x85')]));}}}if(_0x359189[_0x7896('0x86')]){_0x359189[_0x7896('0x86')]=JSON[_0x7896('0x81')](_0x359189[_0x7896('0x86')]);_0x28f5f2['where'](_0x223de2(_0x359189[_0x7896('0x86')][_0x7896('0x6c')]));}_0x126095=_0x28f5f2[_0x7896('0x87')]();_0x28f5f2['limit'](_0x29e3dc);_0x28f5f2[_0x7896('0x20')](0x0);return;}})[_0x7896('0x2b')](function(){if(_0x363c93['output']===_0x7896('0x92')){return null;}var _0x3fb03a=_[_0x7896('0x48')](_0x363c93,{'name':_0x363c93[_0x7896('0x93')]||_0x363c93['name']||_0x359189[_0x7896('0x32')],'basename':_0x57721d,'savename':util[_0x7896('0x7b')](_0x7896('0x94'),_0x363c93['name']||_0x359189[_0x7896('0x32')],require(_0x7896('0x95'))[_0x7896('0x96')](0x4),_0x363c93[_0x7896('0x97')]||_0x7896('0x98')),'reportId':_0x359189['id'],'reportType':_0x7896('0x99')});return db[_0x7896('0x9a')][_0x7896('0x52')](_0x3fb03a,{'raw':!![]});})['then'](function(_0x1e990c){if(_0x359189[_0x7896('0x76')]===_0x7896('0x9b')){_0x126095[_0x7896('0x45')](_0x359189[_0x7896('0x76')]+_0x7896('0x9c'),_0x363c93[_0x7896('0x9d')],_0x363c93['endDate']);}else{_0x126095[_0x7896('0x45')](_0x359189[_0x7896('0x76')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x363c93[_0x7896('0x9d')],_0x363c93[_0x7896('0x9e')]);}if(_0x1e990c){logger['info'](_0x7896('0x9f'),_0x126095[_0x7896('0x8a')]());require(_0x7896('0xa0'))[_0x7896('0xa1')](path[_0x7896('0x58')](__dirname,_0x7896('0xa2'),_0x1e990c[_0x7896('0x97')]),[_0x1e990c['id'],_0x126095['toString'](),path[_0x7896('0x58')](__dirname,_0x7896('0xa3'),_0x1e990c[_0x7896('0xa4')]),_0x57721d]);return _0x1e990c;}else{var _0x5b59fb=squel[_0x7896('0x75')]();_0x5b59fb['from']('('+_0x126095[_0x7896('0x8a')]()+')',_0x7896('0xa5'));_0x5b59fb[_0x7896('0x6d')](_0x7896('0xa6'),_0x7896('0x22'));_0x126095['limit'](_0x363c93[_0x7896('0x23')]||_0x29e3dc);_0x126095[_0x7896('0x20')](_0x363c93[_0x7896('0x20')]||0x0);return dbH[_0x7896('0xa7')][_0x7896('0x3b')](_0x5b59fb['toString'](),{'type':dbH[_0x7896('0xa7')][_0x7896('0xa8')][_0x7896('0x8b')]})['then'](function(_0x6f979e){if(!_0x6f979e[_0x7896('0x40')]){_0x177502=0x0;}else{_0x177502=_0x6f979e[0x0][_0x7896('0x22')]||0x0;}return dbH[_0x7896('0xa7')][_0x7896('0x3b')](_0x126095[_0x7896('0x8a')](),{'type':dbH[_0x7896('0xa7')][_0x7896('0xa8')][_0x7896('0x8b')]});})[_0x7896('0x2b')](function(_0x27131c){return{'rows':_0x27131c||[],'count':_0x177502};});}});}exports['run']=function(_0x5d4872,_0x2d1e58){return runReport(_0x5d4872[_0x7896('0x4f')],_0x5d4872[_0x7896('0x3b')],_0x5d4872['options'])[_0x7896('0x2b')](respondWithResult(_0x2d1e58,null))['catch'](handleError(_0x2d1e58,null));};exports[_0x7896('0xa9')]=runReport;exports[_0x7896('0x3b')]=function(_0xcfea26,_0x4ff5a4){var _0x407c3a=0xa;var _0x5ed7bf=[_0x7896('0x58'),_0x7896('0x59'),_0x7896('0x5a'),_0x7896('0x5b')];var _0x354c43={'SUM':_0x7896('0x5c'),'COUNT':_0x7896('0x5d'),'COUNT DISTINCT':_0x7896('0x8c'),'MAX':_0x7896('0x5e'),'MIN':_0x7896('0x5f'),'AVG':_0x7896('0x60'),'GROUP_CONCAT':_0x7896('0x61'),'GROUP_CONCAT ASC':_0x7896('0x62'),'GROUP_CONCAT DESC':_0x7896('0x63')};var _0x1c2d5b={'SEC_TO_TIME':_0x7896('0x64'),'DATE':_0x7896('0x65'),'HOUR':_0x7896('0x66'),'ROUND':_0x7896('0x67'),'UNIX_TIMESTAMP':_0x7896('0x68')};var _0xadcacb=function(_0x4451e4){return!_[_0x7896('0x69')](['IS\x20NULL',_0x7896('0xaa'),'IS\x20EMPTY',_0x7896('0x6a')],_0x4451e4);};var _0x2edb26=function(_0x3a5288){if(!_0x3a5288||!_0x3a5288[_0x7896('0x6b')][_0x7896('0x40')]){return'';}for(var _0x5da00a='(',_0x56dc37=0x0;_0x56dc37<_0x3a5288[_0x7896('0x6b')]['length'];_0x56dc37+=0x1){_0x56dc37>0x0&&(_0x5da00a+='\x20'+_0x3a5288[_0x7896('0x8f')]+'\x20');_0x5da00a+=_0x3a5288[_0x7896('0x6b')][_0x56dc37][_0x7896('0x6c')]?_0x2edb26(_0x3a5288[_0x7896('0x6b')][_0x56dc37][_0x7896('0x6c')]):_0x3a5288['rules'][_0x56dc37][_0x7896('0x6d')]+'\x20'+_0x3a5288['rules'][_0x56dc37][_0x7896('0x90')]+(_0xadcacb(_0x3a5288[_0x7896('0x6b')][_0x56dc37][_0x7896('0x90')])?'\x20'+_0x3a5288['rules'][_0x56dc37][_0x7896('0x91')]:'');}return _0x5da00a+')';};var _0x1f4619={'where':{'id':_0xcfea26['params']['id']}},_0x301374,_0x556e2b,_0x26372f,_0x1056c0,_0x48570d;_0x1f4619=_[_0x7896('0x48')]({},_0x1f4619,_0xcfea26[_0x7896('0x4a')]);return db[_0x7896('0x36')]['find'](_0x1f4619)[_0x7896('0x2b')](function(_0x4a5c24){if(_0x4a5c24){_0x301374=_0x4a5c24;return _0x4a5c24[_0x7896('0x6e')]();}return null;})[_0x7896('0x2b')](function(_0x43c6a0){if(_0x43c6a0){if(!_0x43c6a0[_0x7896('0x40')]){throw new db[(_0x7896('0x6f'))]['ValidationErrorItem'](_0x7896('0x71'),0x193);}_0x556e2b=_0x43c6a0;return db['AnalyticMetric'][_0x7896('0x73')]({'raw':!![]});}return null;})[_0x7896('0x2b')](function(_0x53742d){if(_0x53742d){_0x26372f=_[_0x7896('0x74')](_0x53742d,'id');var _0x4d7b3a;var _0x4b1f07=squel[_0x7896('0x75')]();_0x4b1f07['from'](_0x301374[_0x7896('0x76')]);for(var _0x1c9262=0x0;_0x1c9262<_0x556e2b[_0x7896('0x40')];_0x1c9262+=0x1){_0x4d7b3a=_0x556e2b[_0x1c9262][_0x7896('0x77')]?_0x26372f[_0x556e2b[_0x1c9262]['MetricId']][_0x7896('0x78')]:_0x556e2b[_0x1c9262][_0x7896('0x6d')];_0x4d7b3a=_0x556e2b[_0x1c9262][_0x7896('0x7a')]?_[_0x7896('0x79')](_0x354c43[_0x556e2b[_0x1c9262][_0x7896('0x7a')]],'%s',_0x4d7b3a):_0x4d7b3a;_0x4d7b3a=_0x556e2b[_0x1c9262][_0x7896('0x7b')]?_[_0x7896('0x79')](_0x1c2d5b[_0x556e2b[_0x1c9262]['format']],'%s',_0x4d7b3a):_0x4d7b3a;if(_0x556e2b[_0x1c9262]['groupBy']){_0x4b1f07[_0x7896('0x6c')](_0x4d7b3a);}_0x556e2b[_0x1c9262][_0x7896('0x7d')]&&_0x4b1f07['order'](_0x4d7b3a,_0x556e2b[_0x1c9262][_0x7896('0x7d')]===_0x7896('0x7e')?![]:!![]);_0x4b1f07[_0x7896('0x6d')](_0x4d7b3a,_0x556e2b[_0x1c9262][_0x7896('0x7f')]||_0x4d7b3a);}if(_0x301374['joins']){_0x301374[_0x7896('0x80')]=JSON[_0x7896('0x81')](_0x301374[_0x7896('0x80')]);for(var _0x4de4af=0x0;_0x4de4af<_0x301374[_0x7896('0x80')]['length'];_0x4de4af+=0x1){if(_0x301374[_0x7896('0x80')][_0x4de4af][_0x7896('0x39')]&&_[_0x7896('0x69')](_0x5ed7bf,_0x301374[_0x7896('0x80')][_0x4de4af]['type'])&&_0x301374[_0x7896('0x80')][_0x4de4af][_0x7896('0x82')]&&_0x301374[_0x7896('0x80')][_0x4de4af][_0x7896('0x83')]&&_0x301374[_0x7896('0x80')][_0x4de4af][_0x7896('0x85')]){_0x4b1f07[_0x301374[_0x7896('0x80')][_0x4de4af][_0x7896('0x39')]](_0x301374[_0x7896('0x80')][_0x4de4af][_0x7896('0x83')],null,util[_0x7896('0x7b')](_0x7896('0x84'),_0x301374[_0x7896('0x76')],_0x301374[_0x7896('0x80')][_0x4de4af]['parentKey'],_0x301374[_0x7896('0x80')][_0x4de4af][_0x7896('0x83')],_0x301374['joins'][_0x4de4af][_0x7896('0x85')]));}}}if(_0x301374[_0x7896('0x86')]){_0x301374[_0x7896('0x86')]=JSON['parse'](_0x301374[_0x7896('0x86')]);_0x4b1f07[_0x7896('0x45')](_0x2edb26(_0x301374[_0x7896('0x86')][_0x7896('0x6c')]));}_0x48570d=_0x4b1f07[_0x7896('0x87')]();_0x4b1f07[_0x7896('0x23')](_0x407c3a);_0x4b1f07[_0x7896('0x20')](0x0);logger['debug'](_0x7896('0x89'),_0x4b1f07['toString']());return dbH['sequelize'][_0x7896('0x3b')](_0x4b1f07[_0x7896('0x8a')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});}})['then'](function(){return{'sql':_0x48570d[_0x7896('0x8a')]()};})[_0x7896('0x2b')](respondWithResult(_0x4ff5a4,null))[_0x7896('0x51')](handleError(_0x4ff5a4,null));}; \ No newline at end of file +var _0xb39f=['where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','rawAttributes','length','includeAll','find','create','body','user','Reports','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','function','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','select','replace','DESC','web','fullPath','%s-%s.%s','randomstring','output','csv','AnalyticExtractedReport','cdr','endDate','startDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','clone','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticCustomReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','order','sort'];(function(_0x212f52,_0x8241e8){var _0x3c912f=function(_0x51d5ef){while(--_0x51d5ef){_0x212f52['push'](_0x212f52['shift']());}};_0x3c912f(++_0x8241e8);}(_0xb39f,0x66));var _0xfb39=function(_0xda8baa,_0x52664d){_0xda8baa=_0xda8baa-0x0;var _0x339249=_0xb39f[_0xda8baa];return _0x339249;};'use strict';var emlformat=require(_0xfb39('0x0'));var rimraf=require(_0xfb39('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfb39('0x2'));var moment=require(_0xfb39('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfb39('0x4'));var util=require(_0xfb39('0x5'));var path=require(_0xfb39('0x6'));var sox=require(_0xfb39('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb39('0x8'));var squel=require('squel');var crypto=require(_0xfb39('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xfb39('0xa'));var toCsv=require(_0xfb39('0xb'));var querystring=require(_0xfb39('0xc'));var Papa=require(_0xfb39('0xd'));var Redis=require(_0xfb39('0xe'));var authService=require(_0xfb39('0xf'));var qs=require(_0xfb39('0x10'));var as=require(_0xfb39('0x11'));var hardwareService=require(_0xfb39('0x12'));var logger=require(_0xfb39('0x13'))(_0xfb39('0x14'));var utils=require(_0xfb39('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfb39('0x16'));var db=require(_0xfb39('0x17'))['db'];var dbH=require(_0xfb39('0x17'))[_0xfb39('0x18')];function respondWithStatusCode(_0x16b436,_0x588e7e){_0x588e7e=_0x588e7e||0xcc;return function(_0x14dfdd){if(_0x14dfdd){return _0x16b436['sendStatus'](_0x588e7e);}return _0x16b436[_0xfb39('0x19')](_0x588e7e)[_0xfb39('0x1a')]();};}function respondWithResult(_0x18d7ce,_0x464b35){_0x464b35=_0x464b35||0xc8;return function(_0x29c4fb){if(_0x29c4fb){return _0x18d7ce['status'](_0x464b35)[_0xfb39('0x1b')](_0x29c4fb);}};}function respondWithFilteredResult(_0x58fece,_0xfcc91f){return function(_0x2b08bb){if(_0x2b08bb){var _0x133edf=typeof _0xfcc91f[_0xfb39('0x1c')]===_0xfb39('0x1d')&&typeof _0xfcc91f[_0xfb39('0x1e')]===_0xfb39('0x1d');var _0x57edbc=_0x2b08bb[_0xfb39('0x1f')];var _0x8c28b=_0x133edf?0x0:_0xfcc91f[_0xfb39('0x1c')];var _0x12465b=_0x133edf?_0x2b08bb[_0xfb39('0x1f')]:_0xfcc91f['offset']+_0xfcc91f['limit'];var _0xfc03ea;if(_0x12465b>=_0x57edbc){_0x12465b=_0x57edbc;_0xfc03ea=0xc8;}else{_0xfc03ea=0xce;}_0x58fece[_0xfb39('0x19')](_0xfc03ea);return _0x58fece[_0xfb39('0x20')](_0xfb39('0x21'),_0x8c28b+'-'+_0x12465b+'/'+_0x57edbc)['json'](_0x2b08bb);}return null;};}function patchUpdates(_0x7e837e){return function(_0x99239b){try{jsonpatch[_0xfb39('0x22')](_0x99239b,_0x7e837e,!![]);}catch(_0x1bac02){return BPromise['reject'](_0x1bac02);}return _0x99239b['save']();};}function saveUpdates(_0x3d59a2,_0x4451f5){return function(_0x29f1ea){if(_0x29f1ea){return _0x29f1ea[_0xfb39('0x23')](_0x3d59a2)[_0xfb39('0x24')](function(_0x2a276e){return _0x2a276e;});}return null;};}function removeEntity(_0x1e1d7f,_0x235449){return function(_0x6551af){if(_0x6551af){return _0x6551af[_0xfb39('0x25')]()[_0xfb39('0x24')](function(){var _0x44e515=_0x6551af[_0xfb39('0x26')]({'plain':!![]});var _0x8bce2d='CustomReports';return db[_0xfb39('0x27')][_0xfb39('0x25')]({'where':{'type':_0x8bce2d,'resourceId':_0x44e515['id']}})[_0xfb39('0x24')](function(){return _0x6551af;});})[_0xfb39('0x24')](function(){_0x1e1d7f[_0xfb39('0x19')](0xcc)[_0xfb39('0x1a')]();});}};}function handleEntityNotFound(_0x460e00,_0x2f6879){return function(_0x549911){if(!_0x549911){_0x460e00[_0xfb39('0x28')](0x194);}return _0x549911;};}function handleError(_0x1b95d3,_0x42d220){_0x42d220=_0x42d220||0x1f4;return function(_0x520ebf){logger[_0xfb39('0x29')](_0x520ebf[_0xfb39('0x2a')]);if(_0x520ebf[_0xfb39('0x2b')]){delete _0x520ebf[_0xfb39('0x2b')];}_0x1b95d3['status'](_0x42d220)[_0xfb39('0x2c')](_0x520ebf);};}exports[_0xfb39('0x2d')]=function(_0x3804a6,_0x1eb1b3){var _0x1fd532={},_0x51a9f4={},_0x811993={'count':0x0,'rows':[]};var _0x1fd560=_[_0xfb39('0x2e')](db[_0xfb39('0x2f')]['rawAttributes'],function(_0x4c2ab5){return{'name':_0x4c2ab5[_0xfb39('0x30')],'type':_0x4c2ab5[_0xfb39('0x31')][_0xfb39('0x32')]};});_0x51a9f4[_0xfb39('0x33')]=_[_0xfb39('0x2e')](_0x1fd560,_0xfb39('0x2b'));_0x51a9f4['query']=_[_0xfb39('0x34')](_0x3804a6[_0xfb39('0x35')]);_0x51a9f4[_0xfb39('0x36')]=_[_0xfb39('0x37')](_0x51a9f4['model'],_0x51a9f4[_0xfb39('0x35')]);_0x1fd532[_0xfb39('0x38')]=_[_0xfb39('0x37')](_0x51a9f4[_0xfb39('0x33')],qs[_0xfb39('0x39')](_0x3804a6[_0xfb39('0x35')][_0xfb39('0x39')]));_0x1fd532[_0xfb39('0x38')]=_0x1fd532[_0xfb39('0x38')]['length']?_0x1fd532[_0xfb39('0x38')]:_0x51a9f4[_0xfb39('0x33')];if(!_0x3804a6['query']['hasOwnProperty']('nolimit')){_0x1fd532[_0xfb39('0x1e')]=qs[_0xfb39('0x1e')](_0x3804a6[_0xfb39('0x35')][_0xfb39('0x1e')]);_0x1fd532[_0xfb39('0x1c')]=qs[_0xfb39('0x1c')](_0x3804a6[_0xfb39('0x35')][_0xfb39('0x1c')]);}_0x1fd532[_0xfb39('0x3a')]=qs[_0xfb39('0x3b')](_0x3804a6[_0xfb39('0x35')][_0xfb39('0x3b')]);_0x1fd532[_0xfb39('0x3c')]=qs[_0xfb39('0x36')](_[_0xfb39('0x3d')](_0x3804a6['query'],_0x51a9f4['filters']),_0x1fd560);if(_0x3804a6[_0xfb39('0x35')][_0xfb39('0x3e')]){_0x1fd532[_0xfb39('0x3c')]=_['merge'](_0x1fd532[_0xfb39('0x3c')],{'$or':_[_0xfb39('0x2e')](_0x1fd560,function(_0x5bebf0){if(_0x5bebf0[_0xfb39('0x31')]!==_0xfb39('0x3f')){var _0x449525={};_0x449525[_0x5bebf0[_0xfb39('0x2b')]]={'$like':'%'+_0x3804a6['query'][_0xfb39('0x3e')]+'%'};return _0x449525;}})});}_0x1fd532=_[_0xfb39('0x40')]({},_0x1fd532,_0x3804a6[_0xfb39('0x41')]);var _0x5abc5a={'where':_0x1fd532[_0xfb39('0x3c')]};return db[_0xfb39('0x2f')][_0xfb39('0x1f')](_0x5abc5a)[_0xfb39('0x24')](function(_0x428bfc){_0x811993['count']=_0x428bfc;if(_0x3804a6[_0xfb39('0x35')]['includeAll']){_0x1fd532[_0xfb39('0x42')]=[{'all':!![]}];}return db[_0xfb39('0x2f')][_0xfb39('0x43')](_0x1fd532);})['then'](function(_0x369964){_0x811993[_0xfb39('0x44')]=_0x369964;return _0x811993;})[_0xfb39('0x24')](respondWithFilteredResult(_0x1eb1b3,_0x1fd532))['catch'](handleError(_0x1eb1b3,null));};exports[_0xfb39('0x45')]=function(_0x48d612,_0x1a1271){var _0x5f56ea={'raw':![],'where':{'id':_0x48d612[_0xfb39('0x46')]['id']}},_0x54125e={};_0x54125e['model']=_[_0xfb39('0x34')](db[_0xfb39('0x2f')][_0xfb39('0x47')]);_0x54125e[_0xfb39('0x35')]=_[_0xfb39('0x34')](_0x48d612[_0xfb39('0x35')]);_0x54125e[_0xfb39('0x36')]=_[_0xfb39('0x37')](_0x54125e['model'],_0x54125e['query']);_0x5f56ea[_0xfb39('0x38')]=_[_0xfb39('0x37')](_0x54125e[_0xfb39('0x33')],qs[_0xfb39('0x39')](_0x48d612[_0xfb39('0x35')][_0xfb39('0x39')]));_0x5f56ea[_0xfb39('0x38')]=_0x5f56ea[_0xfb39('0x38')][_0xfb39('0x48')]?_0x5f56ea[_0xfb39('0x38')]:_0x54125e[_0xfb39('0x33')];if(_0x48d612[_0xfb39('0x35')][_0xfb39('0x49')]){_0x5f56ea[_0xfb39('0x42')]=[{'all':!![]}];}_0x5f56ea=_[_0xfb39('0x40')]({},_0x5f56ea,_0x48d612[_0xfb39('0x41')]);return db[_0xfb39('0x2f')][_0xfb39('0x4a')](_0x5f56ea)['then'](handleEntityNotFound(_0x1a1271,null))['then'](respondWithResult(_0x1a1271,null))['catch'](handleError(_0x1a1271,null));};exports[_0xfb39('0x4b')]=function(_0x91671f,_0x32e869){return db[_0xfb39('0x2f')][_0xfb39('0x4b')](_0x91671f[_0xfb39('0x4c')],{})[_0xfb39('0x24')](function(_0x11ca18){var _0x373c3e=_0x91671f[_0xfb39('0x4d')]['get']({'plain':!![]});if(!_0x373c3e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x373c3e['role']===_0xfb39('0x4d')){var _0x17cf88=_0x11ca18[_0xfb39('0x26')]({'plain':!![]});var _0xd6d6e7=_0xfb39('0x4e');return db[_0xfb39('0x4f')][_0xfb39('0x4a')]({'where':{'name':_0xd6d6e7,'userProfileId':_0x373c3e[_0xfb39('0x50')]},'raw':!![]})[_0xfb39('0x24')](function(_0xab2cf2){if(_0xab2cf2&&_0xab2cf2[_0xfb39('0x51')]===0x0){return db[_0xfb39('0x27')][_0xfb39('0x4b')]({'name':_0x17cf88[_0xfb39('0x2b')],'resourceId':_0x17cf88['id'],'type':'CustomReports','sectionId':_0xab2cf2['id']},{})[_0xfb39('0x24')](function(){return _0x11ca18;});}else{return _0x11ca18;}})[_0xfb39('0x52')](function(_0x37fb70){logger[_0xfb39('0x29')](_0xfb39('0x53'),_0x37fb70);throw _0x37fb70;});}return _0x11ca18;})[_0xfb39('0x24')](respondWithResult(_0x32e869,0xc9))['catch'](handleError(_0x32e869,null));};exports[_0xfb39('0x23')]=function(_0x1bd26f,_0x308f6e){if(_0x1bd26f[_0xfb39('0x4c')]['id']){delete _0x1bd26f[_0xfb39('0x4c')]['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x1bd26f[_0xfb39('0x46')]['id']}})[_0xfb39('0x24')](handleEntityNotFound(_0x308f6e,null))[_0xfb39('0x24')](saveUpdates(_0x1bd26f['body'],null))['then'](respondWithResult(_0x308f6e,null))[_0xfb39('0x52')](handleError(_0x308f6e,null));};exports['destroy']=function(_0x31bb04,_0x1f0123){return db['AnalyticCustomReport'][_0xfb39('0x4a')]({'where':{'id':_0x31bb04['params']['id']}})['then'](handleEntityNotFound(_0x1f0123,null))[_0xfb39('0x24')](removeEntity(_0x1f0123,null))[_0xfb39('0x52')](handleError(_0x1f0123,null));};exports['preview']=function(_0x54292e,_0x307517){var _0x34ef1a=0xa;var _0xfc6653=[_0xfb39('0x54'),_0xfb39('0x55'),_0xfb39('0x56'),_0xfb39('0x57')];var _0x2dfb1c={'SUM':_0xfb39('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xfb39('0x59'),'MAX':_0xfb39('0x5a'),'MIN':_0xfb39('0x5b'),'AVG':_0xfb39('0x5c'),'GROUP_CONCAT':_0xfb39('0x5d'),'GROUP_CONCAT ASC':_0xfb39('0x5e'),'GROUP_CONCAT DESC':_0xfb39('0x5f')};var _0x2c57cd={'SEC_TO_TIME':_0xfb39('0x60'),'DATE':_0xfb39('0x61'),'HOUR':'HOUR(%s)','ROUND':_0xfb39('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3ba86a=function(_0x48fcad){return!_[_0xfb39('0x63')](['IS\x20NULL',_0xfb39('0x64'),_0xfb39('0x65'),_0xfb39('0x66')],_0x48fcad);};var _0xb97dbd=function(_0x5b12ae){if(!_0x5b12ae||!_0x5b12ae[_0xfb39('0x67')][_0xfb39('0x48')]){return'';}for(var _0x4297a7='(',_0x28eadd=0x0;_0x28eadd<_0x5b12ae[_0xfb39('0x67')]['length'];_0x28eadd+=0x1){_0x28eadd>0x0&&(_0x4297a7+='\x20'+_0x5b12ae[_0xfb39('0x68')]+'\x20');_0x4297a7+=_0x5b12ae['rules'][_0x28eadd][_0xfb39('0x69')]?_0xb97dbd(_0x5b12ae[_0xfb39('0x67')][_0x28eadd][_0xfb39('0x69')]):_0x5b12ae[_0xfb39('0x67')][_0x28eadd][_0xfb39('0x6a')]+'\x20'+_0x5b12ae[_0xfb39('0x67')][_0x28eadd]['condition']+(_0x3ba86a(_0x5b12ae['rules'][_0x28eadd][_0xfb39('0x6b')])?'\x20'+_0x5b12ae[_0xfb39('0x67')][_0x28eadd][_0xfb39('0x6c')]:'');}return _0x4297a7+')';};var _0xf1f612={'where':{'id':_0x54292e[_0xfb39('0x46')]['id']}},_0x529851,_0x534b80,_0x4ff81e,_0x3d4539,_0x6fec66;_0xf1f612=_['merge']({},_0xf1f612,_0x54292e[_0xfb39('0x41')]);return db[_0xfb39('0x2f')]['find'](_0xf1f612)[_0xfb39('0x24')](function(_0x400c54){if(_0x400c54){_0x529851=_0x400c54;return _0x400c54[_0xfb39('0x6d')]();}return null;})[_0xfb39('0x24')](function(_0x226193){if(_0x226193){if(!_0x226193['length']){throw new db['Sequelize'][(_0xfb39('0x6e'))](_0xfb39('0x6f'),0x193);}_0x534b80=_0x226193;return db[_0xfb39('0x70')][_0xfb39('0x43')]({'raw':!![]});}return null;})['then'](function(_0x5eee12){if(_0x5eee12){_0x4ff81e=_[_0xfb39('0x71')](_0x5eee12,'id');var _0x1c2296;var _0x584065=squel['select']();_0x584065[_0xfb39('0x72')](_0x529851[_0xfb39('0x73')]);for(var _0x56a9f8=0x0;_0x56a9f8<_0x534b80[_0xfb39('0x48')];_0x56a9f8+=0x1){_0x1c2296=_0x534b80[_0x56a9f8][_0xfb39('0x74')]?_0x4ff81e[_0x534b80[_0x56a9f8][_0xfb39('0x74')]][_0xfb39('0x75')]:_0x534b80[_0x56a9f8][_0xfb39('0x6a')];_0x1c2296=_0x534b80[_0x56a9f8][_0xfb39('0x76')]?_['replace'](_0x2dfb1c[_0x534b80[_0x56a9f8]['function']],'%s',_0x1c2296):_0x1c2296;_0x1c2296=_0x534b80[_0x56a9f8]['format']?_['replace'](_0x2c57cd[_0x534b80[_0x56a9f8][_0xfb39('0x77')]],'%s',_0x1c2296):_0x1c2296;if(_0x534b80[_0x56a9f8][_0xfb39('0x78')]){_0x584065['group'](_0x1c2296);}_0x534b80[_0x56a9f8][_0xfb39('0x79')]&&_0x584065['order'](_0x1c2296,_0x534b80[_0x56a9f8][_0xfb39('0x79')]==='DESC'?![]:!![]);_0x584065[_0xfb39('0x6a')](_0x1c2296,_0x534b80[_0x56a9f8][_0xfb39('0x7a')]||_0x1c2296);}if(_0x529851[_0xfb39('0x7b')]){_0x529851[_0xfb39('0x7b')]=JSON[_0xfb39('0x7c')](_0x529851[_0xfb39('0x7b')]);for(var _0x55f2dc=0x0;_0x55f2dc<_0x529851[_0xfb39('0x7b')][_0xfb39('0x48')];_0x55f2dc+=0x1){if(_0x529851[_0xfb39('0x7b')][_0x55f2dc][_0xfb39('0x31')]&&_[_0xfb39('0x63')](_0xfc6653,_0x529851[_0xfb39('0x7b')][_0x55f2dc][_0xfb39('0x31')])&&_0x529851[_0xfb39('0x7b')][_0x55f2dc][_0xfb39('0x7d')]&&_0x529851[_0xfb39('0x7b')][_0x55f2dc][_0xfb39('0x7e')]&&_0x529851[_0xfb39('0x7b')][_0x55f2dc][_0xfb39('0x7f')]){_0x584065[_0x529851[_0xfb39('0x7b')][_0x55f2dc][_0xfb39('0x31')]](_0x529851[_0xfb39('0x7b')][_0x55f2dc][_0xfb39('0x7e')],null,util[_0xfb39('0x77')]('%s.%s\x20=\x20%s.%s',_0x529851['table'],_0x529851[_0xfb39('0x7b')][_0x55f2dc][_0xfb39('0x7d')],_0x529851[_0xfb39('0x7b')][_0x55f2dc][_0xfb39('0x7e')],_0x529851[_0xfb39('0x7b')][_0x55f2dc][_0xfb39('0x7f')]));}}}if(_0x529851[_0xfb39('0x80')]){_0x529851[_0xfb39('0x80')]=JSON['parse'](_0x529851[_0xfb39('0x80')]);_0x584065[_0xfb39('0x3c')](_0xb97dbd(_0x529851[_0xfb39('0x80')][_0xfb39('0x69')]));}_0x6fec66=_0x584065['clone']();_0x584065[_0xfb39('0x1e')](_0x34ef1a);_0x584065[_0xfb39('0x1c')](0x0);logger[_0xfb39('0x81')](_0xfb39('0x82'),_0x584065[_0xfb39('0x83')]());return dbH[_0xfb39('0x84')][_0xfb39('0x35')](_0x584065[_0xfb39('0x83')](),{'type':dbH[_0xfb39('0x84')][_0xfb39('0x85')][_0xfb39('0x86')]});}})[_0xfb39('0x24')](respondWithResult(_0x307517,null))[_0xfb39('0x52')](handleError(_0x307517,null));};function runReport(_0x221165,_0x315f88,_0x1750ad){var _0x359995=_0x315f88[_0xfb39('0x2b')];var _0x3c08ea=0xa;var _0x1e0837=[_0xfb39('0x54'),_0xfb39('0x55'),_0xfb39('0x56'),_0xfb39('0x57')];var _0x3753c6={'SUM':_0xfb39('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xfb39('0x5a'),'MIN':'MIN(%s)','AVG':_0xfb39('0x5c'),'GROUP_CONCAT':_0xfb39('0x5d'),'GROUP_CONCAT ASC':_0xfb39('0x5e'),'GROUP_CONCAT DESC':_0xfb39('0x5f')};var _0x3b0251={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xfb39('0x61'),'HOUR':_0xfb39('0x87'),'ROUND':_0xfb39('0x62'),'UNIX_TIMESTAMP':_0xfb39('0x88')};var _0x2b9c0d=function(_0x339177){return!_[_0xfb39('0x63')]([_0xfb39('0x89'),'IS\x20NOT\x20NULL',_0xfb39('0x65'),_0xfb39('0x66')],_0x339177);};var _0xf26627=function(_0x590718){if(!_0x590718||!_0x590718['rules'][_0xfb39('0x48')]){return'';}for(var _0x1d6cf7='(',_0x31006d=0x0;_0x31006d<_0x590718['rules'][_0xfb39('0x48')];_0x31006d+=0x1){_0x31006d>0x0&&(_0x1d6cf7+='\x20'+_0x590718[_0xfb39('0x68')]+'\x20');_0x1d6cf7+=_0x590718[_0xfb39('0x67')][_0x31006d]['group']?_0xf26627(_0x590718[_0xfb39('0x67')][_0x31006d][_0xfb39('0x69')]):_0x590718[_0xfb39('0x67')][_0x31006d][_0xfb39('0x6a')]+'\x20'+_0x590718[_0xfb39('0x67')][_0x31006d]['condition']+(_0x2b9c0d(_0x590718[_0xfb39('0x67')][_0x31006d][_0xfb39('0x6b')])?'\x20'+_0x590718['rules'][_0x31006d]['value']:'');}return _0x1d6cf7+')';};var _0x11f252={'where':{'id':_0x221165['id']}},_0x2e01c7,_0x2198f4,_0x57e81d,_0x451418,_0xce83ac;_0x11f252=_[_0xfb39('0x40')]({},_0x11f252,_0x1750ad);return db[_0xfb39('0x2f')][_0xfb39('0x4a')](_0x11f252)['then'](function(_0x26f1da){if(_0x26f1da){_0x2e01c7=_0x26f1da;return _0x26f1da[_0xfb39('0x6d')]();}return null;})[_0xfb39('0x24')](function(_0x345bc5){if(_0x345bc5){if(!_0x345bc5[_0xfb39('0x48')]){throw new db['Sequelize'][(_0xfb39('0x6e'))](_0xfb39('0x6f'),0x193);}_0x2198f4=_0x345bc5;return db[_0xfb39('0x70')][_0xfb39('0x43')]({'raw':!![]});}return null;})[_0xfb39('0x24')](function(_0x3e2d5e){if(_0x3e2d5e){_0x57e81d=_['keyBy'](_0x3e2d5e,'id');var _0x19ce10;var _0x337cac=squel[_0xfb39('0x8a')]();_0x337cac[_0xfb39('0x72')](_0x2e01c7[_0xfb39('0x73')]);for(var _0x53a218=0x0;_0x53a218<_0x2198f4[_0xfb39('0x48')];_0x53a218+=0x1){_0x19ce10=_0x2198f4[_0x53a218][_0xfb39('0x74')]?_0x57e81d[_0x2198f4[_0x53a218]['MetricId']][_0xfb39('0x75')]:_0x2198f4[_0x53a218][_0xfb39('0x6a')];_0x19ce10=_0x2198f4[_0x53a218][_0xfb39('0x76')]?_[_0xfb39('0x8b')](_0x3753c6[_0x2198f4[_0x53a218]['function']],'%s',_0x19ce10):_0x19ce10;_0x19ce10=_0x2198f4[_0x53a218][_0xfb39('0x77')]?_[_0xfb39('0x8b')](_0x3b0251[_0x2198f4[_0x53a218][_0xfb39('0x77')]],'%s',_0x19ce10):_0x19ce10;if(_0x2198f4[_0x53a218][_0xfb39('0x78')]){_0x337cac[_0xfb39('0x69')](_0x19ce10);}_0x2198f4[_0x53a218][_0xfb39('0x79')]&&_0x337cac['order'](_0x19ce10,_0x2198f4[_0x53a218][_0xfb39('0x79')]===_0xfb39('0x8c')?![]:!![]);_0x337cac[_0xfb39('0x6a')](_0x19ce10,_0x2198f4[_0x53a218]['alias']||_0x19ce10);}if(_0x2e01c7[_0xfb39('0x7b')]){_0x2e01c7[_0xfb39('0x7b')]=JSON[_0xfb39('0x7c')](_0x2e01c7[_0xfb39('0x7b')]);for(var _0xa4dbd2=0x0;_0xa4dbd2<_0x2e01c7[_0xfb39('0x7b')][_0xfb39('0x48')];_0xa4dbd2+=0x1){if(_0x2e01c7['joins'][_0xa4dbd2][_0xfb39('0x31')]&&_[_0xfb39('0x63')](_0x1e0837,_0x2e01c7[_0xfb39('0x7b')][_0xa4dbd2][_0xfb39('0x31')])&&_0x2e01c7[_0xfb39('0x7b')][_0xa4dbd2][_0xfb39('0x7d')]&&_0x2e01c7[_0xfb39('0x7b')][_0xa4dbd2][_0xfb39('0x7e')]&&_0x2e01c7['joins'][_0xa4dbd2][_0xfb39('0x7f')]){_0x337cac[_0x2e01c7['joins'][_0xa4dbd2][_0xfb39('0x31')]](_0x2e01c7[_0xfb39('0x7b')][_0xa4dbd2][_0xfb39('0x7e')],null,util[_0xfb39('0x77')]('%s.%s\x20=\x20%s.%s',_0x2e01c7['table'],_0x2e01c7[_0xfb39('0x7b')][_0xa4dbd2][_0xfb39('0x7d')],_0x2e01c7['joins'][_0xa4dbd2][_0xfb39('0x7e')],_0x2e01c7[_0xfb39('0x7b')][_0xa4dbd2][_0xfb39('0x7f')]));}}}if(_0x2e01c7['conditions']){_0x2e01c7[_0xfb39('0x80')]=JSON[_0xfb39('0x7c')](_0x2e01c7[_0xfb39('0x80')]);_0x337cac['where'](_0xf26627(_0x2e01c7['conditions'][_0xfb39('0x69')]));}_0xce83ac=_0x337cac['clone']();_0x337cac[_0xfb39('0x1e')](_0x3c08ea);_0x337cac['offset'](0x0);return;}})['then'](function(){if(_0x315f88['output']===_0xfb39('0x8d')){return null;}var _0x533c82=_['merge'](_0x315f88,{'name':_0x315f88[_0xfb39('0x8e')]||_0x315f88['name']||_0x2e01c7[_0xfb39('0x2b')],'basename':_0x359995,'savename':util[_0xfb39('0x77')](_0xfb39('0x8f'),_0x315f88[_0xfb39('0x2b')]||_0x2e01c7[_0xfb39('0x2b')],require(_0xfb39('0x90'))['generate'](0x4),_0x315f88[_0xfb39('0x91')]||_0xfb39('0x92')),'reportId':_0x2e01c7['id'],'reportType':'custom'});return db[_0xfb39('0x93')][_0xfb39('0x4b')](_0x533c82,{'raw':!![]});})[_0xfb39('0x24')](function(_0x12e8d1){if(_0x2e01c7[_0xfb39('0x73')]===_0xfb39('0x94')){_0xce83ac[_0xfb39('0x3c')](_0x2e01c7['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x315f88['startDate'],_0x315f88[_0xfb39('0x95')]);}else{_0xce83ac['where'](_0x2e01c7[_0xfb39('0x73')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x315f88[_0xfb39('0x96')],_0x315f88['endDate']);}if(_0x12e8d1){logger[_0xfb39('0x97')](_0xfb39('0x98'),_0xce83ac[_0xfb39('0x83')]());require(_0xfb39('0x99'))['fork'](path[_0xfb39('0x54')](__dirname,_0xfb39('0x9a'),_0x12e8d1[_0xfb39('0x91')]),[_0x12e8d1['id'],_0xce83ac[_0xfb39('0x83')](),path[_0xfb39('0x54')](__dirname,_0xfb39('0x9b'),_0x12e8d1[_0xfb39('0x9c')]),_0x359995]);return _0x12e8d1;}else{var _0x5403e6=squel[_0xfb39('0x8a')]();_0x5403e6[_0xfb39('0x72')]('('+_0xce83ac[_0xfb39('0x83')]()+')',_0xfb39('0x9d'));_0x5403e6[_0xfb39('0x6a')](_0xfb39('0x9e'),_0xfb39('0x1f'));_0xce83ac[_0xfb39('0x1e')](_0x315f88[_0xfb39('0x1e')]||_0x3c08ea);_0xce83ac[_0xfb39('0x1c')](_0x315f88[_0xfb39('0x1c')]||0x0);return dbH['sequelize'][_0xfb39('0x35')](_0x5403e6['toString'](),{'type':dbH[_0xfb39('0x84')][_0xfb39('0x85')][_0xfb39('0x86')]})[_0xfb39('0x24')](function(_0x41972c){if(!_0x41972c[_0xfb39('0x48')]){_0x451418=0x0;}else{_0x451418=_0x41972c[0x0]['count']||0x0;}return dbH[_0xfb39('0x84')]['query'](_0xce83ac[_0xfb39('0x83')](),{'type':dbH[_0xfb39('0x84')]['QueryTypes'][_0xfb39('0x86')]});})[_0xfb39('0x24')](function(_0x283d9d){return{'rows':_0x283d9d||[],'count':_0x451418};});}});}exports[_0xfb39('0x9f')]=function(_0x920abf,_0x15c5f0){return runReport(_0x920abf[_0xfb39('0x46')],_0x920abf[_0xfb39('0x35')],_0x920abf['options'])[_0xfb39('0x24')](respondWithResult(_0x15c5f0,null))[_0xfb39('0x52')](handleError(_0x15c5f0,null));};exports[_0xfb39('0xa0')]=runReport;exports['query']=function(_0xbab3d1,_0x5b8750){var _0x2b7e42=0xa;var _0x18f47a=[_0xfb39('0x54'),_0xfb39('0x55'),_0xfb39('0x56'),'cross_join'];var _0x3c8928={'SUM':_0xfb39('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xfb39('0x5a'),'MIN':_0xfb39('0x5b'),'AVG':_0xfb39('0x5c'),'GROUP_CONCAT':_0xfb39('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1d2280={'SEC_TO_TIME':_0xfb39('0x60'),'DATE':'DATE(%s)','HOUR':_0xfb39('0x87'),'ROUND':_0xfb39('0x62'),'UNIX_TIMESTAMP':_0xfb39('0x88')};var _0x3c825c=function(_0x15375d){return!_[_0xfb39('0x63')]([_0xfb39('0x89'),_0xfb39('0x64'),_0xfb39('0x65'),_0xfb39('0x66')],_0x15375d);};var _0x2830e6=function(_0x386641){if(!_0x386641||!_0x386641[_0xfb39('0x67')]['length']){return'';}for(var _0x78c6e1='(',_0x241528=0x0;_0x241528<_0x386641[_0xfb39('0x67')][_0xfb39('0x48')];_0x241528+=0x1){_0x241528>0x0&&(_0x78c6e1+='\x20'+_0x386641[_0xfb39('0x68')]+'\x20');_0x78c6e1+=_0x386641[_0xfb39('0x67')][_0x241528][_0xfb39('0x69')]?_0x2830e6(_0x386641[_0xfb39('0x67')][_0x241528][_0xfb39('0x69')]):_0x386641[_0xfb39('0x67')][_0x241528]['field']+'\x20'+_0x386641[_0xfb39('0x67')][_0x241528][_0xfb39('0x6b')]+(_0x3c825c(_0x386641[_0xfb39('0x67')][_0x241528][_0xfb39('0x6b')])?'\x20'+_0x386641[_0xfb39('0x67')][_0x241528][_0xfb39('0x6c')]:'');}return _0x78c6e1+')';};var _0x2dc8ab={'where':{'id':_0xbab3d1[_0xfb39('0x46')]['id']}},_0x33f556,_0x2f11ef,_0x2a78fd,_0x339bfc,_0x5e8e6b;_0x2dc8ab=_[_0xfb39('0x40')]({},_0x2dc8ab,_0xbab3d1[_0xfb39('0x41')]);return db['AnalyticCustomReport'][_0xfb39('0x4a')](_0x2dc8ab)[_0xfb39('0x24')](function(_0x8bc759){if(_0x8bc759){_0x33f556=_0x8bc759;return _0x8bc759[_0xfb39('0x6d')]();}return null;})['then'](function(_0x342298){if(_0x342298){if(!_0x342298['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xfb39('0x6f'),0x193);}_0x2f11ef=_0x342298;return db[_0xfb39('0x70')][_0xfb39('0x43')]({'raw':!![]});}return null;})[_0xfb39('0x24')](function(_0x474f9b){if(_0x474f9b){_0x2a78fd=_['keyBy'](_0x474f9b,'id');var _0x188a0f;var _0x3efef9=squel['select']();_0x3efef9['from'](_0x33f556[_0xfb39('0x73')]);for(var _0x5e4b33=0x0;_0x5e4b33<_0x2f11ef[_0xfb39('0x48')];_0x5e4b33+=0x1){_0x188a0f=_0x2f11ef[_0x5e4b33][_0xfb39('0x74')]?_0x2a78fd[_0x2f11ef[_0x5e4b33][_0xfb39('0x74')]][_0xfb39('0x75')]:_0x2f11ef[_0x5e4b33][_0xfb39('0x6a')];_0x188a0f=_0x2f11ef[_0x5e4b33][_0xfb39('0x76')]?_[_0xfb39('0x8b')](_0x3c8928[_0x2f11ef[_0x5e4b33][_0xfb39('0x76')]],'%s',_0x188a0f):_0x188a0f;_0x188a0f=_0x2f11ef[_0x5e4b33][_0xfb39('0x77')]?_[_0xfb39('0x8b')](_0x1d2280[_0x2f11ef[_0x5e4b33]['format']],'%s',_0x188a0f):_0x188a0f;if(_0x2f11ef[_0x5e4b33][_0xfb39('0x78')]){_0x3efef9['group'](_0x188a0f);}_0x2f11ef[_0x5e4b33][_0xfb39('0x79')]&&_0x3efef9['order'](_0x188a0f,_0x2f11ef[_0x5e4b33][_0xfb39('0x79')]===_0xfb39('0x8c')?![]:!![]);_0x3efef9[_0xfb39('0x6a')](_0x188a0f,_0x2f11ef[_0x5e4b33][_0xfb39('0x7a')]||_0x188a0f);}if(_0x33f556[_0xfb39('0x7b')]){_0x33f556['joins']=JSON[_0xfb39('0x7c')](_0x33f556[_0xfb39('0x7b')]);for(var _0x51eee5=0x0;_0x51eee5<_0x33f556[_0xfb39('0x7b')][_0xfb39('0x48')];_0x51eee5+=0x1){if(_0x33f556[_0xfb39('0x7b')][_0x51eee5]['type']&&_[_0xfb39('0x63')](_0x18f47a,_0x33f556[_0xfb39('0x7b')][_0x51eee5][_0xfb39('0x31')])&&_0x33f556[_0xfb39('0x7b')][_0x51eee5][_0xfb39('0x7d')]&&_0x33f556[_0xfb39('0x7b')][_0x51eee5][_0xfb39('0x7e')]&&_0x33f556['joins'][_0x51eee5]['foreignKey']){_0x3efef9[_0x33f556['joins'][_0x51eee5][_0xfb39('0x31')]](_0x33f556[_0xfb39('0x7b')][_0x51eee5]['foreignTable'],null,util[_0xfb39('0x77')]('%s.%s\x20=\x20%s.%s',_0x33f556[_0xfb39('0x73')],_0x33f556[_0xfb39('0x7b')][_0x51eee5][_0xfb39('0x7d')],_0x33f556[_0xfb39('0x7b')][_0x51eee5][_0xfb39('0x7e')],_0x33f556[_0xfb39('0x7b')][_0x51eee5][_0xfb39('0x7f')]));}}}if(_0x33f556['conditions']){_0x33f556['conditions']=JSON[_0xfb39('0x7c')](_0x33f556[_0xfb39('0x80')]);_0x3efef9[_0xfb39('0x3c')](_0x2830e6(_0x33f556[_0xfb39('0x80')]['group']));}_0x5e8e6b=_0x3efef9[_0xfb39('0xa1')]();_0x3efef9[_0xfb39('0x1e')](_0x2b7e42);_0x3efef9[_0xfb39('0x1c')](0x0);logger[_0xfb39('0x81')](_0xfb39('0x82'),_0x3efef9[_0xfb39('0x83')]());return dbH[_0xfb39('0x84')]['query'](_0x3efef9[_0xfb39('0x83')](),{'type':dbH[_0xfb39('0x84')][_0xfb39('0x85')]['SELECT']});}})[_0xfb39('0x24')](function(){return{'sql':_0x5e8e6b['toString']()};})['then'](respondWithResult(_0x5b8750,null))['catch'](handleError(_0x5b8750,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index d9af2ff..94b0705 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 _0xe037=['path','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','moment','bluebird','request-promise'];(function(_0x524171,_0x355841){var _0x14529b=function(_0x2e8261){while(--_0x2e8261){_0x524171['push'](_0x524171['shift']());}};_0x14529b(++_0x355841);}(_0xe037,0x146));var _0x7e03=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0xe037[_0x54defc];return _0x1955d3;};'use strict';var _=require(_0x7e03('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7e03('0x1'));var BPromise=require(_0x7e03('0x2'));var rp=require(_0x7e03('0x3'));var fs=require('fs');var path=require(_0x7e03('0x4'));var rimraf=require(_0x7e03('0x5'));var config=require('../../config/environment');var attributes=require(_0x7e03('0x6'));module[_0x7e03('0x7')]=function(_0x5f0f52,_0x43ef69){return _0x5f0f52[_0x7e03('0x8')](_0x7e03('0x9'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcaf=['exports','define','analytics_custom_reports','lodash','util','moment','bluebird'];(function(_0x434d68,_0xcbdfed){var _0x56f3ce=function(_0x3553ab){while(--_0x3553ab){_0x434d68['push'](_0x434d68['shift']());}};_0x56f3ce(++_0xcbdfed);}(_0xdcaf,0x88));var _0xfdca=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xdcaf[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xfdca('0x0'));var util=require(_0xfdca('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfdca('0x2'));var BPromise=require(_0xfdca('0x3'));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('./analyticCustomReport.attributes');module[_0xfdca('0x4')]=function(_0x31558c,_0x3b54bc){return _0x31558c[_0xfdca('0x5')]('AnalyticCustomReport',attributes,{'tableName':_0xfdca('0x6'),'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 2f93ec3..272b455 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 _0xf044=['http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf044,0xf4));var _0x4f04=function(_0x50dba7,_0x3f5da9){_0x50dba7=_0x50dba7-0x0;var _0x12974b=_0xf044[_0x50dba7];return _0x12974b;};'use strict';var _=require(_0x4f04('0x0'));var util=require('util');var moment=require(_0x4f04('0x1'));var BPromise=require(_0x4f04('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f04('0x3'))['db'];var utils=require(_0x4f04('0x4'));var logger=require('../../config/logger')(_0x4f04('0x5'));var config=require(_0x4f04('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4f04('0x7')][_0x4f04('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5aa989,_0x755985,_0x1cff1f){return new BPromise(function(_0x50e079,_0x469e42){return client[_0x4f04('0x9')](_0x5aa989,_0x1cff1f)[_0x4f04('0xa')](function(_0x55cc23){logger[_0x4f04('0xb')](_0x4f04('0xc'),_0x755985,_0x4f04('0xd'));logger['debug'](_0x4f04('0xe'),_0x755985,_0x4f04('0xd'),JSON[_0x4f04('0xf')](_0x55cc23));if(_0x55cc23['error']){if(_0x55cc23['error'][_0x4f04('0x10')]===0x1f4){logger[_0x4f04('0x11')](_0x4f04('0xc'),_0x755985,_0x55cc23[_0x4f04('0x11')]['message']);return _0x469e42(_0x55cc23[_0x4f04('0x11')][_0x4f04('0x12')]);}logger[_0x4f04('0x11')](_0x4f04('0xc'),_0x755985,_0x55cc23[_0x4f04('0x11')][_0x4f04('0x12')]);return _0x50e079(_0x55cc23[_0x4f04('0x11')][_0x4f04('0x12')]);}else{logger[_0x4f04('0xb')](_0x4f04('0xc'),_0x755985,'request\x20sent');_0x50e079(_0x55cc23[_0x4f04('0x13')][_0x4f04('0x12')]);}})[_0x4f04('0x14')](function(_0x1f04a5){logger[_0x4f04('0x11')](_0x4f04('0xc'),_0x755985,_0x1f04a5);_0x469e42(_0x1f04a5);});});} \ No newline at end of file +var _0x74db=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','info','lodash','bluebird','randomstring','ioredis'];(function(_0x2f3ecd,_0x57976b){var _0xffdc44=function(_0xf21bc6){while(--_0xf21bc6){_0x2f3ecd['push'](_0x2f3ecd['shift']());}};_0xffdc44(++_0x57976b);}(_0x74db,0x165));var _0xb74d=function(_0x2fdf82,_0x322e7c){_0x2fdf82=_0x2fdf82-0x0;var _0x2382f5=_0x74db[_0x2fdf82];return _0x2382f5;};'use strict';var _=require(_0xb74d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb74d('0x1'));var rs=require(_0xb74d('0x2'));var fs=require('fs');var Redis=require(_0xb74d('0x3'));var db=require(_0xb74d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb74d('0x5'))(_0xb74d('0x6'));var config=require(_0xb74d('0x7'));var jayson=require(_0xb74d('0x8'));var client=jayson['client'][_0xb74d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19ba6f,_0x401180,_0x2b5728){return new BPromise(function(_0x1a1d4a,_0x2d6c4f){return client[_0xb74d('0xa')](_0x19ba6f,_0x2b5728)['then'](function(_0x3e7a76){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x401180,_0xb74d('0xb'));logger['debug'](_0xb74d('0xc'),_0x401180,'request\x20sent',JSON[_0xb74d('0xd')](_0x3e7a76));if(_0x3e7a76[_0xb74d('0xe')]){if(_0x3e7a76['error'][_0xb74d('0xf')]===0x1f4){logger[_0xb74d('0xe')](_0xb74d('0x10'),_0x401180,_0x3e7a76[_0xb74d('0xe')][_0xb74d('0x11')]);return _0x2d6c4f(_0x3e7a76[_0xb74d('0xe')][_0xb74d('0x11')]);}logger[_0xb74d('0xe')](_0xb74d('0x10'),_0x401180,_0x3e7a76[_0xb74d('0xe')][_0xb74d('0x11')]);return _0x1a1d4a(_0x3e7a76[_0xb74d('0xe')][_0xb74d('0x11')]);}else{logger[_0xb74d('0x12')](_0xb74d('0x10'),_0x401180,'request\x20sent');_0x1a1d4a(_0x3e7a76['result']['message']);}})['catch'](function(_0x2d545f){logger[_0xb74d('0xe')](_0xb74d('0x10'),_0x401180,_0x2d545f);_0x2d6c4f(_0x2d545f);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 191e41f..4abc718 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 _0x9a40=['show','/:id/preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id'];(function(_0x4d6049,_0x6fa762){var _0x1d4f4c=function(_0x3280c3){while(--_0x3280c3){_0x4d6049['push'](_0x4d6049['shift']());}};_0x1d4f4c(++_0x6fa762);}(_0x9a40,0x138));var _0x09a4=function(_0x588fb7,_0x16c606){_0x588fb7=_0x588fb7-0x0;var _0x538362=_0x9a40[_0x588fb7];return _0x538362;};'use strict';var multer=require(_0x09a4('0x0'));var util=require(_0x09a4('0x1'));var path=require(_0x09a4('0x2'));var timeout=require('connect-timeout');var express=require(_0x09a4('0x3'));var router=express[_0x09a4('0x4')]();var fs_extra=require(_0x09a4('0x5'));var auth=require(_0x09a4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x09a4('0x7'));var controller=require(_0x09a4('0x8'));router['get']('/',auth[_0x09a4('0x9')](),controller[_0x09a4('0xa')]);router[_0x09a4('0xb')](_0x09a4('0xc'),auth[_0x09a4('0x9')](),controller[_0x09a4('0xd')]);router[_0x09a4('0xb')](_0x09a4('0xe'),auth[_0x09a4('0x9')](),controller['preview']);router['get'](_0x09a4('0xf'),auth[_0x09a4('0x9')](),controller[_0x09a4('0x10')]);router[_0x09a4('0xb')](_0x09a4('0x11'),auth['isAuthenticated'](),controller[_0x09a4('0x12')]);router[_0x09a4('0x13')]('/',auth[_0x09a4('0x9')](),controller[_0x09a4('0x14')]);router[_0x09a4('0x15')](_0x09a4('0xc'),auth[_0x09a4('0x9')](),controller[_0x09a4('0x16')]);router[_0x09a4('0x17')]('/:id',auth[_0x09a4('0x9')](),controller['destroy']);module[_0x09a4('0x18')]=router; \ No newline at end of file +var _0x2bce=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id/preview','/:id/run','run','query','post','create','put','update','/:id'];(function(_0x37d1e4,_0x2eeb58){var _0x13155a=function(_0x435f88){while(--_0x435f88){_0x37d1e4['push'](_0x37d1e4['shift']());}};_0x13155a(++_0x2eeb58);}(_0x2bce,0x199));var _0xe2bc=function(_0x150667,_0x3bbe53){_0x150667=_0x150667-0x0;var _0x36f17e=_0x2bce[_0x150667];return _0x36f17e;};'use strict';var multer=require(_0xe2bc('0x0'));var util=require(_0xe2bc('0x1'));var path=require(_0xe2bc('0x2'));var timeout=require(_0xe2bc('0x3'));var express=require(_0xe2bc('0x4'));var router=express[_0xe2bc('0x5')]();var fs_extra=require(_0xe2bc('0x6'));var auth=require(_0xe2bc('0x7'));var interaction=require(_0xe2bc('0x8'));var config=require(_0xe2bc('0x9'));var controller=require(_0xe2bc('0xa'));router[_0xe2bc('0xb')]('/',auth[_0xe2bc('0xc')](),controller[_0xe2bc('0xd')]);router[_0xe2bc('0xb')]('/:id',auth[_0xe2bc('0xc')](),controller['show']);router[_0xe2bc('0xb')](_0xe2bc('0xe'),auth['isAuthenticated'](),controller['preview']);router[_0xe2bc('0xb')](_0xe2bc('0xf'),auth[_0xe2bc('0xc')](),controller[_0xe2bc('0x10')]);router[_0xe2bc('0xb')]('/:id/query',auth[_0xe2bc('0xc')](),controller[_0xe2bc('0x11')]);router[_0xe2bc('0x12')]('/',auth['isAuthenticated'](),controller[_0xe2bc('0x13')]);router[_0xe2bc('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xe2bc('0x15')]);router['delete'](_0xe2bc('0x16'),auth[_0xe2bc('0xc')](),controller[_0xe2bc('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 6669f06..e3b3f17 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 _0xeec6=['STRING','TEXT','sequelize','exports'];(function(_0x26e726,_0x47c779){var _0xa6f34=function(_0x1a3368){while(--_0x1a3368){_0x26e726['push'](_0x26e726['shift']());}};_0xa6f34(++_0x47c779);}(_0xeec6,0x1c2));var _0x6eec=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xeec6[_0x3635ce];return _0x97ecd0;};'use strict';var Sequelize=require(_0x6eec('0x0'));module[_0x6eec('0x1')]={'name':{'type':Sequelize[_0x6eec('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6eec('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x6eec('0x2')]},'conditions':{'type':Sequelize[_0x6eec('0x3')]},'joins':{'type':Sequelize[_0x6eec('0x3')]}}; \ No newline at end of file +var _0xfdbd=['sequelize','exports','STRING','TEXT'];(function(_0x3cbe1c,_0x4bcabd){var _0x5ee08b=function(_0x5c53e6){while(--_0x5c53e6){_0x3cbe1c['push'](_0x3cbe1c['shift']());}};_0x5ee08b(++_0x4bcabd);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x2a390b,_0xf49f9b){_0x2a390b=_0x2a390b-0x0;var _0x5df10a=_0xfdbd[_0x2a390b];return _0x5df10a;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdfdb('0x2')]},'parent':{'type':Sequelize[_0xdfdb('0x2')]},'table':{'type':Sequelize[_0xdfdb('0x2')]},'conditions':{'type':Sequelize[_0xdfdb('0x3')]},'joins':{'type':Sequelize[_0xdfdb('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index ac4a67c..57ae404 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 _0x0295=['default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','fork','../../files/reports','COUNT(*)','SELECT','run','runReport','MAX(%s)','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','UserProfileResource','destroy','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','group','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20EMPTY','operator','getFields','findAll','select','replace','output','web','%s-%s.%s','randomstring','generate','csv'];(function(_0x3c0a30,_0x1ca8e6){var _0x5f582b=function(_0x438b4d){while(--_0x438b4d){_0x3c0a30['push'](_0x3c0a30['shift']());}};_0x5f582b(++_0x1ca8e6);}(_0x0295,0x1f0));var _0x5029=function(_0x2b3087,_0x5bad3a){_0x2b3087=_0x2b3087-0x0;var _0x39bb6a=_0x0295[_0x2b3087];return _0x39bb6a;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];var dbH=require(_0x5029('0x14'))['dbH'];function respondWithStatusCode(_0x4fa22d,_0x49f836){_0x49f836=_0x49f836||0xcc;return function(_0x4aebb6){if(_0x4aebb6){return _0x4fa22d[_0x5029('0x15')](_0x49f836);}return _0x4fa22d[_0x5029('0x16')](_0x49f836)[_0x5029('0x17')]();};}function respondWithResult(_0x434630,_0x2c0b33){_0x2c0b33=_0x2c0b33||0xc8;return function(_0x11c24b){if(_0x11c24b){return _0x434630[_0x5029('0x16')](_0x2c0b33)[_0x5029('0x18')](_0x11c24b);}};}function respondWithFilteredResult(_0x10bf55,_0x326923){return function(_0x457c73){if(_0x457c73){var _0x353cba=typeof _0x326923[_0x5029('0x19')]===_0x5029('0x1a')&&typeof _0x326923[_0x5029('0x1b')]==='undefined';var _0x1ed567=_0x457c73[_0x5029('0x1c')];var _0x35de81=_0x353cba?0x0:_0x326923[_0x5029('0x19')];var _0x8cea01=_0x353cba?_0x457c73[_0x5029('0x1c')]:_0x326923[_0x5029('0x19')]+_0x326923['limit'];var _0x226a5c;if(_0x8cea01>=_0x1ed567){_0x8cea01=_0x1ed567;_0x226a5c=0xc8;}else{_0x226a5c=0xce;}_0x10bf55['status'](_0x226a5c);return _0x10bf55[_0x5029('0x1d')](_0x5029('0x1e'),_0x35de81+'-'+_0x8cea01+'/'+_0x1ed567)[_0x5029('0x18')](_0x457c73);}return null;};}function patchUpdates(_0x3cf0fb){return function(_0x4b5854){try{jsonpatch['apply'](_0x4b5854,_0x3cf0fb,!![]);}catch(_0x4c9184){return BPromise['reject'](_0x4c9184);}return _0x4b5854[_0x5029('0x1f')]();};}function saveUpdates(_0x853a34,_0x1eb228){return function(_0x2bbbcb){if(_0x2bbbcb){return _0x2bbbcb[_0x5029('0x20')](_0x853a34)[_0x5029('0x21')](function(_0x125c26){return _0x125c26;});}return null;};}function removeEntity(_0x356dac,_0x3e857d){return function(_0x4ceaae){if(_0x4ceaae){return _0x4ceaae['destroy']()['then'](function(){var _0x588d90=_0x4ceaae[_0x5029('0x22')]({'plain':!![]});var _0x51093c='DefaultReports';return db[_0x5029('0x23')][_0x5029('0x24')]({'where':{'type':_0x51093c,'resourceId':_0x588d90['id']}})[_0x5029('0x21')](function(){return _0x4ceaae;});})['then'](function(){_0x356dac[_0x5029('0x16')](0xcc)[_0x5029('0x17')]();});}};}function handleEntityNotFound(_0x5e45c4,_0x2b6d99){return function(_0x31f0a0){if(!_0x31f0a0){_0x5e45c4[_0x5029('0x15')](0x194);}return _0x31f0a0;};}function handleError(_0x4a24b9,_0x32da06){_0x32da06=_0x32da06||0x1f4;return function(_0x251f99){logger[_0x5029('0x25')](_0x251f99['stack']);if(_0x251f99[_0x5029('0x26')]){delete _0x251f99[_0x5029('0x26')];}_0x4a24b9['status'](_0x32da06)[_0x5029('0x27')](_0x251f99);};}exports[_0x5029('0x28')]=function(_0x4434ff,_0x1c3dd9){var _0x196830={},_0x2a1ed6={},_0x44255a={'count':0x0,'rows':[]};var _0x465153=_[_0x5029('0x29')](db[_0x5029('0x2a')][_0x5029('0x2b')],function(_0x4519c8){return{'name':_0x4519c8['fieldName'],'type':_0x4519c8[_0x5029('0x2c')]['key']};});_0x2a1ed6[_0x5029('0x2d')]=_['map'](_0x465153,'name');_0x2a1ed6[_0x5029('0x2e')]=_[_0x5029('0x2f')](_0x4434ff[_0x5029('0x2e')]);_0x2a1ed6['filters']=_[_0x5029('0x30')](_0x2a1ed6[_0x5029('0x2d')],_0x2a1ed6[_0x5029('0x2e')]);_0x196830[_0x5029('0x31')]=_[_0x5029('0x30')](_0x2a1ed6[_0x5029('0x2d')],qs[_0x5029('0x32')](_0x4434ff[_0x5029('0x2e')][_0x5029('0x32')]));_0x196830['attributes']=_0x196830[_0x5029('0x31')][_0x5029('0x33')]?_0x196830[_0x5029('0x31')]:_0x2a1ed6[_0x5029('0x2d')];if(!_0x4434ff['query'][_0x5029('0x34')](_0x5029('0x35'))){_0x196830[_0x5029('0x1b')]=qs['limit'](_0x4434ff['query'][_0x5029('0x1b')]);_0x196830[_0x5029('0x19')]=qs['offset'](_0x4434ff['query'][_0x5029('0x19')]);}_0x196830[_0x5029('0x36')]=qs[_0x5029('0x37')](_0x4434ff[_0x5029('0x2e')][_0x5029('0x37')]);_0x196830[_0x5029('0x38')]=qs[_0x5029('0x39')](_[_0x5029('0x3a')](_0x4434ff[_0x5029('0x2e')],_0x2a1ed6[_0x5029('0x39')]),_0x465153);if(_0x4434ff[_0x5029('0x2e')][_0x5029('0x3b')]){_0x196830[_0x5029('0x38')]=_[_0x5029('0x3c')](_0x196830['where'],{'$or':_['map'](_0x465153,function(_0x73797c){if(_0x73797c[_0x5029('0x2c')]!==_0x5029('0x3d')){var _0x48c9eb={};_0x48c9eb[_0x73797c[_0x5029('0x26')]]={'$like':'%'+_0x4434ff[_0x5029('0x2e')]['filter']+'%'};return _0x48c9eb;}})});}_0x196830=_[_0x5029('0x3c')]({},_0x196830,_0x4434ff['options']);var _0x506f0d={'where':_0x196830['where']};return db[_0x5029('0x2a')][_0x5029('0x1c')](_0x506f0d)[_0x5029('0x21')](function(_0x78768){_0x44255a[_0x5029('0x1c')]=_0x78768;if(_0x4434ff[_0x5029('0x2e')][_0x5029('0x3e')]){_0x196830[_0x5029('0x3f')]=[{'all':!![]}];}return db[_0x5029('0x2a')]['findAll'](_0x196830);})[_0x5029('0x21')](function(_0x236455){_0x44255a[_0x5029('0x40')]=_0x236455;return _0x44255a;})[_0x5029('0x21')](respondWithFilteredResult(_0x1c3dd9,_0x196830))[_0x5029('0x41')](handleError(_0x1c3dd9,null));};exports[_0x5029('0x42')]=function(_0x5658a7,_0x259db8){var _0xa1580a={'raw':!![],'where':{'id':_0x5658a7[_0x5029('0x43')]['id']}},_0x9434ed={};_0x9434ed[_0x5029('0x2d')]=_['keys'](db[_0x5029('0x2a')][_0x5029('0x2b')]);_0x9434ed[_0x5029('0x2e')]=_[_0x5029('0x2f')](_0x5658a7[_0x5029('0x2e')]);_0x9434ed[_0x5029('0x39')]=_[_0x5029('0x30')](_0x9434ed[_0x5029('0x2d')],_0x9434ed[_0x5029('0x2e')]);_0xa1580a['attributes']=_[_0x5029('0x30')](_0x9434ed[_0x5029('0x2d')],qs[_0x5029('0x32')](_0x5658a7[_0x5029('0x2e')]['fields']));_0xa1580a['attributes']=_0xa1580a[_0x5029('0x31')][_0x5029('0x33')]?_0xa1580a[_0x5029('0x31')]:_0x9434ed[_0x5029('0x2d')];if(_0x5658a7[_0x5029('0x2e')][_0x5029('0x3e')]){_0xa1580a[_0x5029('0x3f')]=[{'all':!![]}];}_0xa1580a=_[_0x5029('0x3c')]({},_0xa1580a,_0x5658a7[_0x5029('0x44')]);return db[_0x5029('0x2a')][_0x5029('0x45')](_0xa1580a)[_0x5029('0x21')](handleEntityNotFound(_0x259db8,null))[_0x5029('0x21')](respondWithResult(_0x259db8,null))[_0x5029('0x41')](handleError(_0x259db8,null));};exports[_0x5029('0x46')]=function(_0x175cc0,_0x10fc07){return db[_0x5029('0x2a')][_0x5029('0x46')](_0x175cc0[_0x5029('0x47')],{})[_0x5029('0x21')](function(_0x489457){var _0x1069c4=_0x175cc0['user'][_0x5029('0x22')]({'plain':!![]});if(!_0x1069c4)throw new Error(_0x5029('0x48'));if(_0x1069c4['role']==='user'){var _0x319bff=_0x489457['get']({'plain':!![]});var _0x4aaa43=_0x5029('0x49');return db[_0x5029('0x4a')][_0x5029('0x45')]({'where':{'name':_0x4aaa43,'userProfileId':_0x1069c4['userProfileId']},'raw':!![]})['then'](function(_0x1510bb){if(_0x1510bb&&_0x1510bb[_0x5029('0x4b')]===0x0){return db['UserProfileResource'][_0x5029('0x46')]({'name':_0x319bff['name'],'resourceId':_0x319bff['id'],'type':_0x5029('0x4c'),'sectionId':_0x1510bb['id']},{})['then'](function(){return _0x489457;});}else{return _0x489457;}})[_0x5029('0x41')](function(_0x27e1c0){logger[_0x5029('0x25')](_0x5029('0x4d'),_0x27e1c0);throw _0x27e1c0;});}return _0x489457;})[_0x5029('0x21')](respondWithResult(_0x10fc07,0xc9))[_0x5029('0x41')](handleError(_0x10fc07,null));};exports[_0x5029('0x20')]=function(_0xa25013,_0x586936){if(_0xa25013[_0x5029('0x47')]['id']){delete _0xa25013['body']['id'];}return db[_0x5029('0x2a')][_0x5029('0x45')]({'where':{'id':_0xa25013['params']['id']}})[_0x5029('0x21')](handleEntityNotFound(_0x586936,null))['then'](saveUpdates(_0xa25013['body'],null))['then'](respondWithResult(_0x586936,null))[_0x5029('0x41')](handleError(_0x586936,null));};exports['destroy']=function(_0x49d1db,_0x353ae4){return db[_0x5029('0x2a')]['find']({'where':{'id':_0x49d1db[_0x5029('0x43')]['id']}})['then'](handleEntityNotFound(_0x353ae4,null))['then'](removeEntity(_0x353ae4,null))[_0x5029('0x41')](handleError(_0x353ae4,null));};exports[_0x5029('0x4e')]=function(_0x81e39c,_0x448273){var _0x164179=0xa;var _0x4e8d9f=[_0x5029('0x4f'),_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x4dca54={'SUM':_0x5029('0x53'),'COUNT':_0x5029('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':_0x5029('0x57'),'GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4208ab={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':_0x5029('0x5c'),'UNIX_TIMESTAMP':_0x5029('0x5d')};var _0x59a718=function(_0x560324){return!_[_0x5029('0x5e')]([_0x5029('0x5f'),_0x5029('0x60'),'IS\x20EMPTY',_0x5029('0x61')],_0x560324);};var _0x2d439a=function(_0x105638){if(!_0x105638||!_0x105638[_0x5029('0x62')][_0x5029('0x33')]){return'';}for(var _0x5264c6='(',_0x2ec5d0=0x0;_0x2ec5d0<_0x105638[_0x5029('0x62')][_0x5029('0x33')];_0x2ec5d0+=0x1){_0x2ec5d0>0x0&&(_0x5264c6+='\x20'+_0x105638['operator']+'\x20');_0x5264c6+=_0x105638[_0x5029('0x62')][_0x2ec5d0]['group']?_0x2d439a(_0x105638[_0x5029('0x62')][_0x2ec5d0]['group']):_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x63')]+'\x20'+_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x64')]+(_0x59a718(_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x64')])?'\x20'+_0x105638['rules'][_0x2ec5d0][_0x5029('0x65')]:'');}return _0x5264c6+')';};var _0x19220d={'where':{'id':_0x81e39c['params']['id']}},_0x1ff8df,_0x151562,_0x389700,_0x506f74,_0x13ca47;_0x19220d=_[_0x5029('0x3c')]({},_0x19220d,_0x81e39c['options']);return db[_0x5029('0x2a')]['find'](_0x19220d)[_0x5029('0x21')](function(_0x54daf9){if(_0x54daf9){_0x1ff8df=_0x54daf9;return _0x54daf9['getFields']();}return null;})[_0x5029('0x21')](function(_0x575f09){if(_0x575f09){if(!_0x575f09[_0x5029('0x33')]){throw new db[(_0x5029('0x66'))][(_0x5029('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x151562=_0x575f09;return db[_0x5029('0x68')]['findAll']({'raw':!![]});}return null;})[_0x5029('0x21')](function(_0x255dfb){if(_0x255dfb){_0x389700=_[_0x5029('0x69')](_0x255dfb,'id');var _0x1cca02;var _0x1deed7=squel['select']();_0x1deed7[_0x5029('0x6a')](_0x1ff8df[_0x5029('0x6b')]);for(var _0x5890ac=0x0;_0x5890ac<_0x151562[_0x5029('0x33')];_0x5890ac+=0x1){_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6c')]?_0x389700[_0x151562[_0x5890ac][_0x5029('0x6c')]][_0x5029('0x6d')]:_0x151562[_0x5890ac][_0x5029('0x63')];_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6e')]?_['replace'](_0x4dca54[_0x151562[_0x5890ac]['function']],'%s',_0x1cca02):_0x1cca02;_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6f')]?_['replace'](_0x4208ab[_0x151562[_0x5890ac][_0x5029('0x6f')]],'%s',_0x1cca02):_0x1cca02;if(_0x151562[_0x5890ac][_0x5029('0x70')]){_0x1deed7['group'](_0x1cca02);}_0x151562[_0x5890ac][_0x5029('0x71')]&&_0x1deed7['order'](_0x1cca02,_0x151562[_0x5890ac]['orderBy']===_0x5029('0x72')?![]:!![]);_0x1deed7[_0x5029('0x63')](_0x1cca02,_0x151562[_0x5890ac][_0x5029('0x73')]||_0x1cca02);}if(_0x1ff8df[_0x5029('0x74')]){_0x1ff8df['joins']=JSON[_0x5029('0x75')](_0x1ff8df[_0x5029('0x74')]);for(var _0x4a2ce8=0x0;_0x4a2ce8<_0x1ff8df[_0x5029('0x74')][_0x5029('0x33')];_0x4a2ce8+=0x1){if(_0x1ff8df['joins'][_0x4a2ce8]['type']&&_['includes'](_0x4e8d9f,_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x2c')])&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x76')]&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x77')]&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x78')]){_0x1deed7[_0x1ff8df[_0x5029('0x74')][_0x4a2ce8]['type']](_0x1ff8df['joins'][_0x4a2ce8][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x1ff8df[_0x5029('0x6b')],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x76')],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8]['foreignTable'],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x78')]));}}}if(_0x1ff8df[_0x5029('0x7a')]){_0x1ff8df['conditions']=JSON[_0x5029('0x75')](_0x1ff8df[_0x5029('0x7a')]);_0x1deed7[_0x5029('0x38')](_0x2d439a(_0x1ff8df['conditions'][_0x5029('0x7b')]));}_0x13ca47=_0x1deed7[_0x5029('0x7c')]();_0x1deed7[_0x5029('0x1b')](_0x164179);_0x1deed7['offset'](0x0);logger[_0x5029('0x7d')](_0x5029('0x7e'),_0x1deed7['toString']());return dbH[_0x5029('0x7f')][_0x5029('0x2e')](_0x1deed7[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')][_0x5029('0x81')]['SELECT']});}})[_0x5029('0x21')](respondWithResult(_0x448273,null))[_0x5029('0x41')](handleError(_0x448273,null));};function runReport(_0x426d70,_0xe6ac28,_0x153cdc){var _0x5e7f50=_0xe6ac28[_0x5029('0x26')];var _0x202c51=0xa;var _0x344203=['join',_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x3e47bd={'SUM':_0x5029('0x53'),'COUNT':_0x5029('0x54'),'COUNT DISTINCT':_0x5029('0x82'),'MAX':'MAX(%s)','MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':_0x5029('0x57'),'GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':_0x5029('0x83')};var _0x4c40d1={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5029('0x5d')};var _0x41e2d8=function(_0x51098a){return!_['includes'](['IS\x20NULL',_0x5029('0x60'),_0x5029('0x84'),_0x5029('0x61')],_0x51098a);};var _0x4007c8=function(_0x3dc05a){if(!_0x3dc05a||!_0x3dc05a['rules'][_0x5029('0x33')]){return'';}for(var _0x2e4782='(',_0x2c0540=0x0;_0x2c0540<_0x3dc05a['rules']['length'];_0x2c0540+=0x1){_0x2c0540>0x0&&(_0x2e4782+='\x20'+_0x3dc05a[_0x5029('0x85')]+'\x20');_0x2e4782+=_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x7b')]?_0x4007c8(_0x3dc05a[_0x5029('0x62')][_0x2c0540]['group']):_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x63')]+'\x20'+_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x64')]+(_0x41e2d8(_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x64')])?'\x20'+_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x65')]:'');}return _0x2e4782+')';};var _0x5aecc2={'where':{'id':_0x426d70['id']}},_0x159450,_0x556c7a,_0x48bbe2,_0x3e3150,_0x533ee2;_0x5aecc2=_[_0x5029('0x3c')]({},_0x5aecc2,_0x153cdc);return db[_0x5029('0x2a')][_0x5029('0x45')](_0x5aecc2)[_0x5029('0x21')](function(_0x1b6f4c){if(_0x1b6f4c){_0x159450=_0x1b6f4c;return _0x1b6f4c[_0x5029('0x86')]();}return null;})[_0x5029('0x21')](function(_0x1d6092){if(_0x1d6092){if(!_0x1d6092['length']){throw new db['Sequelize'][(_0x5029('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x556c7a=_0x1d6092;return db['AnalyticMetric'][_0x5029('0x87')]({'raw':!![]});}return null;})['then'](function(_0x4b25ed){if(_0x4b25ed){_0x48bbe2=_[_0x5029('0x69')](_0x4b25ed,'id');var _0xb8da0b;var _0x13e07e=squel[_0x5029('0x88')]();_0x13e07e[_0x5029('0x6a')](_0x159450['table']);for(var _0x38c02a=0x0;_0x38c02a<_0x556c7a[_0x5029('0x33')];_0x38c02a+=0x1){_0xb8da0b=_0x556c7a[_0x38c02a][_0x5029('0x6c')]?_0x48bbe2[_0x556c7a[_0x38c02a]['MetricId']][_0x5029('0x6d')]:_0x556c7a[_0x38c02a][_0x5029('0x63')];_0xb8da0b=_0x556c7a[_0x38c02a][_0x5029('0x6e')]?_[_0x5029('0x89')](_0x3e47bd[_0x556c7a[_0x38c02a][_0x5029('0x6e')]],'%s',_0xb8da0b):_0xb8da0b;_0xb8da0b=_0x556c7a[_0x38c02a]['format']?_['replace'](_0x4c40d1[_0x556c7a[_0x38c02a][_0x5029('0x6f')]],'%s',_0xb8da0b):_0xb8da0b;if(_0x556c7a[_0x38c02a][_0x5029('0x70')]){_0x13e07e['group'](_0xb8da0b);}_0x556c7a[_0x38c02a][_0x5029('0x71')]&&_0x13e07e[_0x5029('0x36')](_0xb8da0b,_0x556c7a[_0x38c02a][_0x5029('0x71')]===_0x5029('0x72')?![]:!![]);_0x13e07e[_0x5029('0x63')](_0xb8da0b,_0x556c7a[_0x38c02a][_0x5029('0x73')]||_0xb8da0b);}if(_0x159450[_0x5029('0x74')]){_0x159450[_0x5029('0x74')]=JSON['parse'](_0x159450['joins']);for(var _0x4243c3=0x0;_0x4243c3<_0x159450['joins'][_0x5029('0x33')];_0x4243c3+=0x1){if(_0x159450['joins'][_0x4243c3][_0x5029('0x2c')]&&_[_0x5029('0x5e')](_0x344203,_0x159450[_0x5029('0x74')][_0x4243c3]['type'])&&_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x76')]&&_0x159450[_0x5029('0x74')][_0x4243c3]['foreignTable']&&_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x78')]){_0x13e07e[_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x2c')]](_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x159450[_0x5029('0x6b')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x76')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x77')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x78')]));}}}if(_0x159450[_0x5029('0x7a')]){_0x159450[_0x5029('0x7a')]=JSON[_0x5029('0x75')](_0x159450['conditions']);_0x13e07e[_0x5029('0x38')](_0x4007c8(_0x159450[_0x5029('0x7a')][_0x5029('0x7b')]));}_0x533ee2=_0x13e07e[_0x5029('0x7c')]();_0x13e07e[_0x5029('0x1b')](_0x202c51);_0x13e07e['offset'](0x0);return;}})[_0x5029('0x21')](function(){if(_0xe6ac28[_0x5029('0x8a')]===_0x5029('0x8b')){return null;}var _0xf7729c=_[_0x5029('0x3c')](_0xe6ac28,{'name':_0xe6ac28['fullPath']||_0xe6ac28[_0x5029('0x26')]||_0x159450[_0x5029('0x26')],'basename':_0x5e7f50,'savename':util[_0x5029('0x6f')](_0x5029('0x8c'),_0xe6ac28[_0x5029('0x26')]||_0x159450['name'],require(_0x5029('0x8d'))[_0x5029('0x8e')](0x4),_0xe6ac28[_0x5029('0x8a')]||_0x5029('0x8f')),'reportId':_0x159450['id'],'reportType':_0x5029('0x90')});return db[_0x5029('0x91')][_0x5029('0x46')](_0xf7729c,{'raw':!![]});})[_0x5029('0x21')](function(_0x4a7535){if(_0x159450['table']===_0x5029('0x92')){_0x533ee2[_0x5029('0x38')](_0x159450[_0x5029('0x6b')]+_0x5029('0x93'),_0xe6ac28[_0x5029('0x94')],_0xe6ac28['endDate']);}else{_0x533ee2[_0x5029('0x38')](_0x159450['table']+_0x5029('0x95'),_0xe6ac28[_0x5029('0x94')],_0xe6ac28[_0x5029('0x96')]);}if(_0x4a7535){logger[_0x5029('0x97')](_0x5029('0x98'),_0x533ee2[_0x5029('0x80')]());require('child_process')[_0x5029('0x99')](path[_0x5029('0x4f')](__dirname,'../../components/export/',_0x4a7535[_0x5029('0x8a')]),[_0x4a7535['id'],_0x533ee2[_0x5029('0x80')](),path['join'](__dirname,_0x5029('0x9a'),_0x4a7535['savename']),_0x5e7f50]);return _0x4a7535;}else{var _0x54c0f3=squel['select']();_0x54c0f3['from']('('+_0x533ee2[_0x5029('0x80')]()+')','countTable');_0x54c0f3[_0x5029('0x63')](_0x5029('0x9b'),'count');_0x533ee2[_0x5029('0x1b')](_0xe6ac28[_0x5029('0x1b')]||_0x202c51);_0x533ee2['offset'](_0xe6ac28[_0x5029('0x19')]||0x0);return dbH[_0x5029('0x7f')]['query'](_0x54c0f3[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')]['QueryTypes'][_0x5029('0x9c')]})[_0x5029('0x21')](function(_0x17c755){if(!_0x17c755[_0x5029('0x33')]){_0x3e3150=0x0;}else{_0x3e3150=_0x17c755[0x0][_0x5029('0x1c')]||0x0;}return dbH[_0x5029('0x7f')]['query'](_0x533ee2[_0x5029('0x80')](),{'type':dbH['sequelize'][_0x5029('0x81')][_0x5029('0x9c')]});})[_0x5029('0x21')](function(_0x3ebe00){return{'rows':_0x3ebe00||[],'count':_0x3e3150};});}});}exports[_0x5029('0x9d')]=function(_0x2138cc,_0x331af8){return runReport(_0x2138cc[_0x5029('0x43')],_0x2138cc[_0x5029('0x2e')],_0x2138cc[_0x5029('0x44')])[_0x5029('0x21')](respondWithResult(_0x331af8,null))[_0x5029('0x41')](handleError(_0x331af8,null));};exports[_0x5029('0x9e')]=runReport;exports[_0x5029('0x2e')]=function(_0x9de076,_0x2ac88e){var _0x55ee4f=0xa;var _0x1fa9eb=[_0x5029('0x4f'),_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x405d47={'SUM':'SUM(%s)','COUNT':_0x5029('0x54'),'COUNT DISTINCT':_0x5029('0x82'),'MAX':_0x5029('0x9f'),'MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':_0x5029('0x83')};var _0x29c3a2={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':_0x5029('0x5c'),'UNIX_TIMESTAMP':_0x5029('0x5d')};var _0xb39e9d=function(_0x124c5e){return!_['includes']([_0x5029('0x5f'),'IS\x20NOT\x20NULL',_0x5029('0x84'),_0x5029('0x61')],_0x124c5e);};var _0x120acc=function(_0x21bb22){if(!_0x21bb22||!_0x21bb22['rules'][_0x5029('0x33')]){return'';}for(var _0x339112='(',_0x5d7c1a=0x0;_0x5d7c1a<_0x21bb22[_0x5029('0x62')][_0x5029('0x33')];_0x5d7c1a+=0x1){_0x5d7c1a>0x0&&(_0x339112+='\x20'+_0x21bb22['operator']+'\x20');_0x339112+=_0x21bb22[_0x5029('0x62')][_0x5d7c1a][_0x5029('0x7b')]?_0x120acc(_0x21bb22['rules'][_0x5d7c1a]['group']):_0x21bb22[_0x5029('0x62')][_0x5d7c1a]['field']+'\x20'+_0x21bb22['rules'][_0x5d7c1a][_0x5029('0x64')]+(_0xb39e9d(_0x21bb22['rules'][_0x5d7c1a][_0x5029('0x64')])?'\x20'+_0x21bb22[_0x5029('0x62')][_0x5d7c1a]['value']:'');}return _0x339112+')';};var _0x327299={'where':{'id':_0x9de076['params']['id']}},_0x3463cc,_0x590cc2,_0x3ac39a,_0x37c47b,_0x62e4af;_0x327299=_[_0x5029('0x3c')]({},_0x327299,_0x9de076['options']);return db[_0x5029('0x2a')][_0x5029('0x45')](_0x327299)[_0x5029('0x21')](function(_0x5e7ec8){if(_0x5e7ec8){_0x3463cc=_0x5e7ec8;return _0x5e7ec8[_0x5029('0x86')]();}return null;})[_0x5029('0x21')](function(_0x5aa480){if(_0x5aa480){if(!_0x5aa480[_0x5029('0x33')]){throw new db[(_0x5029('0x66'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x590cc2=_0x5aa480;return db[_0x5029('0x68')][_0x5029('0x87')]({'raw':!![]});}return null;})['then'](function(_0x5842a5){if(_0x5842a5){_0x3ac39a=_['keyBy'](_0x5842a5,'id');var _0x313bdb;var _0x1d38e0=squel[_0x5029('0x88')]();_0x1d38e0['from'](_0x3463cc[_0x5029('0x6b')]);for(var _0x581237=0x0;_0x581237<_0x590cc2[_0x5029('0x33')];_0x581237+=0x1){_0x313bdb=_0x590cc2[_0x581237]['MetricId']?_0x3ac39a[_0x590cc2[_0x581237]['MetricId']]['metric']:_0x590cc2[_0x581237]['field'];_0x313bdb=_0x590cc2[_0x581237][_0x5029('0x6e')]?_[_0x5029('0x89')](_0x405d47[_0x590cc2[_0x581237][_0x5029('0x6e')]],'%s',_0x313bdb):_0x313bdb;_0x313bdb=_0x590cc2[_0x581237][_0x5029('0x6f')]?_[_0x5029('0x89')](_0x29c3a2[_0x590cc2[_0x581237]['format']],'%s',_0x313bdb):_0x313bdb;if(_0x590cc2[_0x581237][_0x5029('0x70')]){_0x1d38e0[_0x5029('0x7b')](_0x313bdb);}_0x590cc2[_0x581237][_0x5029('0x71')]&&_0x1d38e0[_0x5029('0x36')](_0x313bdb,_0x590cc2[_0x581237][_0x5029('0x71')]===_0x5029('0x72')?![]:!![]);_0x1d38e0['field'](_0x313bdb,_0x590cc2[_0x581237][_0x5029('0x73')]||_0x313bdb);}if(_0x3463cc[_0x5029('0x74')]){_0x3463cc[_0x5029('0x74')]=JSON['parse'](_0x3463cc['joins']);for(var _0xd05bc9=0x0;_0xd05bc9<_0x3463cc[_0x5029('0x74')][_0x5029('0x33')];_0xd05bc9+=0x1){if(_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x2c')]&&_[_0x5029('0x5e')](_0x1fa9eb,_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x2c')])&&_0x3463cc['joins'][_0xd05bc9][_0x5029('0x76')]&&_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x77')]&&_0x3463cc['joins'][_0xd05bc9][_0x5029('0x78')]){_0x1d38e0[_0x3463cc['joins'][_0xd05bc9][_0x5029('0x2c')]](_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x3463cc[_0x5029('0x6b')],_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x76')],_0x3463cc['joins'][_0xd05bc9]['foreignTable'],_0x3463cc['joins'][_0xd05bc9][_0x5029('0x78')]));}}}if(_0x3463cc[_0x5029('0x7a')]){_0x3463cc[_0x5029('0x7a')]=JSON[_0x5029('0x75')](_0x3463cc[_0x5029('0x7a')]);_0x1d38e0['where'](_0x120acc(_0x3463cc[_0x5029('0x7a')][_0x5029('0x7b')]));}_0x62e4af=_0x1d38e0[_0x5029('0x7c')]();_0x1d38e0[_0x5029('0x1b')](_0x55ee4f);_0x1d38e0[_0x5029('0x19')](0x0);logger['debug'](_0x5029('0x7e'),_0x1d38e0[_0x5029('0x80')]());return dbH[_0x5029('0x7f')][_0x5029('0x2e')](_0x1d38e0[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')][_0x5029('0x81')][_0x5029('0x9c')]});}})[_0x5029('0x21')](function(){return{'sql':_0x62e4af[_0x5029('0x80')]()};})[_0x5029('0x21')](respondWithResult(_0x2ac88e,null))[_0x5029('0x41')](handleError(_0x2ac88e,null));}; \ No newline at end of file +var _0xc6ac=['keyBy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','DefaultReports','UserProfileResource','stack','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','name','query','keys','filters','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','intersection','length','options','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','preview','left_join','right_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','field','condition','value','Sequelize','AnalyticMetric','select','from','table','MetricId','replace','format','group','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','COUNT(%s)','COUNT(DISTINCT\x20%s)','IS\x20NOT\x20EMPTY','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','metric','function','groupBy','orderBy','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','getFields'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x220909,_0x4fa78a){_0x220909=_0x220909-0x0;var _0x1119ae=_0xc6ac[_0x220909];return _0x1119ae;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xcc6a('0x1b')];function respondWithStatusCode(_0x211444,_0x4300c0){_0x4300c0=_0x4300c0||0xcc;return function(_0x559a0a){if(_0x559a0a){return _0x211444['sendStatus'](_0x4300c0);}return _0x211444[_0xcc6a('0x1c')](_0x4300c0)[_0xcc6a('0x1d')]();};}function respondWithResult(_0x43710d,_0x348af7){_0x348af7=_0x348af7||0xc8;return function(_0x96f9de){if(_0x96f9de){return _0x43710d[_0xcc6a('0x1c')](_0x348af7)[_0xcc6a('0x1e')](_0x96f9de);}};}function respondWithFilteredResult(_0x403b18,_0x56ffb0){return function(_0x4e628f){if(_0x4e628f){var _0x4d021a=typeof _0x56ffb0[_0xcc6a('0x1f')]===_0xcc6a('0x20')&&typeof _0x56ffb0[_0xcc6a('0x21')]===_0xcc6a('0x20');var _0x33079c=_0x4e628f[_0xcc6a('0x22')];var _0x2d9585=_0x4d021a?0x0:_0x56ffb0[_0xcc6a('0x1f')];var _0x374e51=_0x4d021a?_0x4e628f[_0xcc6a('0x22')]:_0x56ffb0[_0xcc6a('0x1f')]+_0x56ffb0['limit'];var _0xfec60f;if(_0x374e51>=_0x33079c){_0x374e51=_0x33079c;_0xfec60f=0xc8;}else{_0xfec60f=0xce;}_0x403b18[_0xcc6a('0x1c')](_0xfec60f);return _0x403b18[_0xcc6a('0x23')](_0xcc6a('0x24'),_0x2d9585+'-'+_0x374e51+'/'+_0x33079c)[_0xcc6a('0x1e')](_0x4e628f);}return null;};}function patchUpdates(_0x30b8ed){return function(_0x36c80f){try{jsonpatch[_0xcc6a('0x25')](_0x36c80f,_0x30b8ed,!![]);}catch(_0x2254a8){return BPromise[_0xcc6a('0x26')](_0x2254a8);}return _0x36c80f[_0xcc6a('0x27')]();};}function saveUpdates(_0x845088,_0x51be9a){return function(_0x41c4c8){if(_0x41c4c8){return _0x41c4c8[_0xcc6a('0x28')](_0x845088)[_0xcc6a('0x29')](function(_0x581aae){return _0x581aae;});}return null;};}function removeEntity(_0x10016a,_0x294486){return function(_0x3a00e5){if(_0x3a00e5){return _0x3a00e5[_0xcc6a('0x2a')]()[_0xcc6a('0x29')](function(){var _0x5fc697=_0x3a00e5['get']({'plain':!![]});var _0x26def8=_0xcc6a('0x2b');return db[_0xcc6a('0x2c')]['destroy']({'where':{'type':_0x26def8,'resourceId':_0x5fc697['id']}})[_0xcc6a('0x29')](function(){return _0x3a00e5;});})[_0xcc6a('0x29')](function(){_0x10016a['status'](0xcc)[_0xcc6a('0x1d')]();});}};}function handleEntityNotFound(_0x8b1b2b,_0x3233d1){return function(_0x473f88){if(!_0x473f88){_0x8b1b2b['sendStatus'](0x194);}return _0x473f88;};}function handleError(_0x194aab,_0x3cf14c){_0x3cf14c=_0x3cf14c||0x1f4;return function(_0x2c6d88){logger['error'](_0x2c6d88[_0xcc6a('0x2d')]);if(_0x2c6d88['name']){delete _0x2c6d88['name'];}_0x194aab[_0xcc6a('0x1c')](_0x3cf14c)[_0xcc6a('0x2e')](_0x2c6d88);};}exports[_0xcc6a('0x2f')]=function(_0x11b481,_0x2b575d){var _0x131138={},_0x4e2de4={},_0x7b2b54={'count':0x0,'rows':[]};var _0x28e3c3=_[_0xcc6a('0x30')](db[_0xcc6a('0x31')][_0xcc6a('0x32')],function(_0x152ebd){return{'name':_0x152ebd[_0xcc6a('0x33')],'type':_0x152ebd[_0xcc6a('0x34')]['key']};});_0x4e2de4[_0xcc6a('0x35')]=_[_0xcc6a('0x30')](_0x28e3c3,_0xcc6a('0x36'));_0x4e2de4[_0xcc6a('0x37')]=_[_0xcc6a('0x38')](_0x11b481[_0xcc6a('0x37')]);_0x4e2de4[_0xcc6a('0x39')]=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],_0x4e2de4['query']);_0x131138['attributes']=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3a')]));_0x131138[_0xcc6a('0x3b')]=_0x131138['attributes']['length']?_0x131138[_0xcc6a('0x3b')]:_0x4e2de4[_0xcc6a('0x35')];if(!_0x11b481[_0xcc6a('0x37')]['hasOwnProperty'](_0xcc6a('0x3c'))){_0x131138[_0xcc6a('0x21')]=qs[_0xcc6a('0x21')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x21')]);_0x131138[_0xcc6a('0x1f')]=qs[_0xcc6a('0x1f')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x1f')]);}_0x131138[_0xcc6a('0x3d')]=qs[_0xcc6a('0x3e')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3e')]);_0x131138[_0xcc6a('0x3f')]=qs[_0xcc6a('0x39')](_[_0xcc6a('0x40')](_0x11b481[_0xcc6a('0x37')],_0x4e2de4[_0xcc6a('0x39')]),_0x28e3c3);if(_0x11b481['query']['filter']){_0x131138[_0xcc6a('0x3f')]=_[_0xcc6a('0x41')](_0x131138[_0xcc6a('0x3f')],{'$or':_[_0xcc6a('0x30')](_0x28e3c3,function(_0x1e628b){if(_0x1e628b[_0xcc6a('0x34')]!==_0xcc6a('0x42')){var _0x1199f1={};_0x1199f1[_0x1e628b['name']]={'$like':'%'+_0x11b481['query'][_0xcc6a('0x43')]+'%'};return _0x1199f1;}})});}_0x131138=_['merge']({},_0x131138,_0x11b481['options']);var _0x5cf1ba={'where':_0x131138[_0xcc6a('0x3f')]};return db[_0xcc6a('0x31')][_0xcc6a('0x22')](_0x5cf1ba)[_0xcc6a('0x29')](function(_0xe8056f){_0x7b2b54['count']=_0xe8056f;if(_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x44')]){_0x131138[_0xcc6a('0x45')]=[{'all':!![]}];}return db[_0xcc6a('0x31')][_0xcc6a('0x46')](_0x131138);})[_0xcc6a('0x29')](function(_0x54f862){_0x7b2b54[_0xcc6a('0x47')]=_0x54f862;return _0x7b2b54;})[_0xcc6a('0x29')](respondWithFilteredResult(_0x2b575d,_0x131138))[_0xcc6a('0x48')](handleError(_0x2b575d,null));};exports[_0xcc6a('0x49')]=function(_0x494904,_0x1fe723){var _0x4a9cea={'raw':!![],'where':{'id':_0x494904[_0xcc6a('0x4a')]['id']}},_0x351529={};_0x351529[_0xcc6a('0x35')]=_['keys'](db[_0xcc6a('0x31')][_0xcc6a('0x32')]);_0x351529[_0xcc6a('0x37')]=_['keys'](_0x494904['query']);_0x351529[_0xcc6a('0x39')]=_[_0xcc6a('0x4b')](_0x351529[_0xcc6a('0x35')],_0x351529[_0xcc6a('0x37')]);_0x4a9cea[_0xcc6a('0x3b')]=_['intersection'](_0x351529[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x494904['query'][_0xcc6a('0x3a')]));_0x4a9cea[_0xcc6a('0x3b')]=_0x4a9cea[_0xcc6a('0x3b')][_0xcc6a('0x4c')]?_0x4a9cea[_0xcc6a('0x3b')]:_0x351529[_0xcc6a('0x35')];if(_0x494904['query']['includeAll']){_0x4a9cea['include']=[{'all':!![]}];}_0x4a9cea=_[_0xcc6a('0x41')]({},_0x4a9cea,_0x494904[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4a9cea)['then'](handleEntityNotFound(_0x1fe723,null))[_0xcc6a('0x29')](respondWithResult(_0x1fe723,null))['catch'](handleError(_0x1fe723,null));};exports[_0xcc6a('0x4f')]=function(_0x4299ca,_0xcfc540){return db[_0xcc6a('0x31')][_0xcc6a('0x4f')](_0x4299ca[_0xcc6a('0x50')],{})['then'](function(_0x1a3b82){var _0x7288b2=_0x4299ca[_0xcc6a('0x51')][_0xcc6a('0x52')]({'plain':!![]});if(!_0x7288b2)throw new Error(_0xcc6a('0x53'));if(_0x7288b2[_0xcc6a('0x54')]===_0xcc6a('0x51')){var _0x392805=_0x1a3b82[_0xcc6a('0x52')]({'plain':!![]});var _0x30d0ef='Reports';return db[_0xcc6a('0x55')][_0xcc6a('0x4e')]({'where':{'name':_0x30d0ef,'userProfileId':_0x7288b2[_0xcc6a('0x56')]},'raw':!![]})[_0xcc6a('0x29')](function(_0x14f5e5){if(_0x14f5e5&&_0x14f5e5[_0xcc6a('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x392805[_0xcc6a('0x36')],'resourceId':_0x392805['id'],'type':'DefaultReports','sectionId':_0x14f5e5['id']},{})[_0xcc6a('0x29')](function(){return _0x1a3b82;});}else{return _0x1a3b82;}})[_0xcc6a('0x48')](function(_0x2b5782){logger[_0xcc6a('0x58')](_0xcc6a('0x59'),_0x2b5782);throw _0x2b5782;});}return _0x1a3b82;})[_0xcc6a('0x29')](respondWithResult(_0xcfc540,0xc9))[_0xcc6a('0x48')](handleError(_0xcfc540,null));};exports[_0xcc6a('0x28')]=function(_0x68b823,_0x27b074){if(_0x68b823[_0xcc6a('0x50')]['id']){delete _0x68b823['body']['id'];}return db[_0xcc6a('0x31')]['find']({'where':{'id':_0x68b823[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x27b074,null))[_0xcc6a('0x29')](saveUpdates(_0x68b823['body'],null))[_0xcc6a('0x29')](respondWithResult(_0x27b074,null))['catch'](handleError(_0x27b074,null));};exports[_0xcc6a('0x2a')]=function(_0x5db3b5,_0x3c0b1c){return db[_0xcc6a('0x31')][_0xcc6a('0x4e')]({'where':{'id':_0x5db3b5[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x3c0b1c,null))[_0xcc6a('0x29')](removeEntity(_0x3c0b1c,null))[_0xcc6a('0x48')](handleError(_0x3c0b1c,null));};exports[_0xcc6a('0x5a')]=function(_0x506311,_0x14d3ff){var _0x56d512=0xa;var _0x3a6b7e=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x586789={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x389e5f={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2cc561=function(_0x483aa4){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x483aa4);};var _0x46d93b=function(_0x4ed702){if(!_0x4ed702||!_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x20a16b='(',_0x19a578=0x0;_0x19a578<_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')];_0x19a578+=0x1){_0x19a578>0x0&&(_0x20a16b+='\x20'+_0x4ed702[_0xcc6a('0x6f')]+'\x20');_0x20a16b+=_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['group']?_0x46d93b(_0x4ed702['rules'][_0x19a578]['group']):_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x70')]+'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['condition']+(_0x2cc561(_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x71')])?'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x72')]:'');}return _0x20a16b+')';};var _0x5e1c69={'where':{'id':_0x506311['params']['id']}},_0x481d25,_0xaec5e8,_0x41527b,_0x4403d3,_0x386a74;_0x5e1c69=_[_0xcc6a('0x41')]({},_0x5e1c69,_0x506311[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x5e1c69)[_0xcc6a('0x29')](function(_0x55d129){if(_0x55d129){_0x481d25=_0x55d129;return _0x55d129['getFields']();}return null;})[_0xcc6a('0x29')](function(_0xd1a27b){if(_0xd1a27b){if(!_0xd1a27b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xaec5e8=_0xd1a27b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x421d0b){if(_0x421d0b){_0x41527b=_['keyBy'](_0x421d0b,'id');var _0x4a8863;var _0x58e6b4=squel[_0xcc6a('0x75')]();_0x58e6b4[_0xcc6a('0x76')](_0x481d25[_0xcc6a('0x77')]);for(var _0x729b2=0x0;_0x729b2<_0xaec5e8['length'];_0x729b2+=0x1){_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x78')]?_0x41527b[_0xaec5e8[_0x729b2][_0xcc6a('0x78')]]['metric']:_0xaec5e8[_0x729b2][_0xcc6a('0x70')];_0x4a8863=_0xaec5e8[_0x729b2]['function']?_[_0xcc6a('0x79')](_0x586789[_0xaec5e8[_0x729b2]['function']],'%s',_0x4a8863):_0x4a8863;_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x389e5f[_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]],'%s',_0x4a8863):_0x4a8863;if(_0xaec5e8[_0x729b2]['groupBy']){_0x58e6b4[_0xcc6a('0x7b')](_0x4a8863);}_0xaec5e8[_0x729b2]['orderBy']&&_0x58e6b4[_0xcc6a('0x3d')](_0x4a8863,_0xaec5e8[_0x729b2]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x58e6b4[_0xcc6a('0x70')](_0x4a8863,_0xaec5e8[_0x729b2][_0xcc6a('0x7d')]||_0x4a8863);}if(_0x481d25[_0xcc6a('0x7e')]){_0x481d25[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x481d25['joins']);for(var _0x18f5dc=0x0;_0x18f5dc<_0x481d25[_0xcc6a('0x7e')][_0xcc6a('0x4c')];_0x18f5dc+=0x1){if(_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]&&_['includes'](_0x3a6b7e,_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')])&&_0x481d25['joins'][_0x18f5dc]['parentKey']&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x80')]&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]){_0x58e6b4[_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]](_0x481d25['joins'][_0x18f5dc][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x481d25[_0xcc6a('0x77')],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x83')],_0x481d25['joins'][_0x18f5dc]['foreignTable'],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]));}}}if(_0x481d25[_0xcc6a('0x84')]){_0x481d25[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x481d25[_0xcc6a('0x84')]);_0x58e6b4[_0xcc6a('0x3f')](_0x46d93b(_0x481d25['conditions'][_0xcc6a('0x7b')]));}_0x386a74=_0x58e6b4[_0xcc6a('0x85')]();_0x58e6b4[_0xcc6a('0x21')](_0x56d512);_0x58e6b4[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x58e6b4['toString']());return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x58e6b4[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')][_0xcc6a('0x8b')]});}})[_0xcc6a('0x29')](respondWithResult(_0x14d3ff,null))[_0xcc6a('0x48')](handleError(_0x14d3ff,null));};function runReport(_0x2a25df,_0x1f1ff7,_0x565bcd){var _0x45c45f=_0x1f1ff7[_0xcc6a('0x36')];var _0x58cd56=0xa;var _0x1848dd=[_0xcc6a('0x8c'),_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x5abd5c={'SUM':_0xcc6a('0x5e'),'COUNT':_0xcc6a('0x8d'),'COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x5be65b={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2b5c15=function(_0x3207b2){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),_0xcc6a('0x8f')],_0x3207b2);};var _0x58fdb3=function(_0xb4b2b4){if(!_0xb4b2b4||!_0xb4b2b4[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x275e15='(',_0x53b419=0x0;_0x53b419<_0xb4b2b4[_0xcc6a('0x6e')]['length'];_0x53b419+=0x1){_0x53b419>0x0&&(_0x275e15+='\x20'+_0xb4b2b4[_0xcc6a('0x6f')]+'\x20');_0x275e15+=_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]?_0x58fdb3(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]):_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x70')]+'\x20'+_0xb4b2b4['rules'][_0x53b419][_0xcc6a('0x71')]+(_0x2b5c15(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x71')])?'\x20'+_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x72')]:'');}return _0x275e15+')';};var _0x4473ab={'where':{'id':_0x2a25df['id']}},_0x558e2f,_0x14a957,_0x350766,_0x589bff,_0x5661b5;_0x4473ab=_[_0xcc6a('0x41')]({},_0x4473ab,_0x565bcd);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4473ab)[_0xcc6a('0x29')](function(_0x2f0b79){if(_0x2f0b79){_0x558e2f=_0x2f0b79;return _0x2f0b79['getFields']();}return null;})[_0xcc6a('0x29')](function(_0x4a268b){if(_0x4a268b){if(!_0x4a268b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x14a957=_0x4a268b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x1f4c4e){if(_0x1f4c4e){_0x350766=_['keyBy'](_0x1f4c4e,'id');var _0x312431;var _0x2a850c=squel[_0xcc6a('0x75')]();_0x2a850c['from'](_0x558e2f[_0xcc6a('0x77')]);for(var _0xd5b9f3=0x0;_0xd5b9f3<_0x14a957[_0xcc6a('0x4c')];_0xd5b9f3+=0x1){_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]?_0x350766[_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x14a957[_0xd5b9f3][_0xcc6a('0x70')];_0x312431=_0x14a957[_0xd5b9f3]['function']?_[_0xcc6a('0x79')](_0x5abd5c[_0x14a957[_0xd5b9f3][_0xcc6a('0x93')]],'%s',_0x312431):_0x312431;_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x5be65b[_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]],'%s',_0x312431):_0x312431;if(_0x14a957[_0xd5b9f3][_0xcc6a('0x94')]){_0x2a850c[_0xcc6a('0x7b')](_0x312431);}_0x14a957[_0xd5b9f3][_0xcc6a('0x95')]&&_0x2a850c['order'](_0x312431,_0x14a957[_0xd5b9f3]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x2a850c['field'](_0x312431,_0x14a957[_0xd5b9f3][_0xcc6a('0x7d')]||_0x312431);}if(_0x558e2f[_0xcc6a('0x7e')]){_0x558e2f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x7e')]);for(var _0x1f7ee5=0x0;_0x1f7ee5<_0x558e2f[_0xcc6a('0x7e')]['length'];_0x1f7ee5+=0x1){if(_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type']&&_['includes'](_0x1848dd,_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type'])&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')]&&_0x558e2f['joins'][_0x1f7ee5]['foreignTable']&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['foreignKey']){_0x2a850c[_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x34')]](_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x558e2f['table'],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],_0x558e2f['joins'][_0x1f7ee5][_0xcc6a('0x81')]));}}}if(_0x558e2f[_0xcc6a('0x84')]){_0x558e2f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x84')]);_0x2a850c[_0xcc6a('0x3f')](_0x58fdb3(_0x558e2f[_0xcc6a('0x84')]['group']));}_0x5661b5=_0x2a850c[_0xcc6a('0x85')]();_0x2a850c[_0xcc6a('0x21')](_0x58cd56);_0x2a850c['offset'](0x0);return;}})[_0xcc6a('0x29')](function(){if(_0x1f1ff7[_0xcc6a('0x96')]===_0xcc6a('0x97')){return null;}var _0x2297ea=_[_0xcc6a('0x41')](_0x1f1ff7,{'name':_0x1f1ff7[_0xcc6a('0x98')]||_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],'basename':_0x45c45f,'savename':util[_0xcc6a('0x7a')](_0xcc6a('0x99'),_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],require(_0xcc6a('0x9a'))[_0xcc6a('0x9b')](0x4),_0x1f1ff7['output']||'csv'),'reportId':_0x558e2f['id'],'reportType':_0xcc6a('0x9c')});return db[_0xcc6a('0x9d')]['create'](_0x2297ea,{'raw':!![]});})[_0xcc6a('0x29')](function(_0x1e74a4){if(_0x558e2f[_0xcc6a('0x77')]==='cdr'){_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0x9e'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7['endDate']);}else{_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0xa0'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7[_0xcc6a('0xa1')]);}if(_0x1e74a4){logger[_0xcc6a('0xa2')](_0xcc6a('0xa3'),_0x5661b5[_0xcc6a('0x89')]());require('child_process')['fork'](path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa4'),_0x1e74a4[_0xcc6a('0x96')]),[_0x1e74a4['id'],_0x5661b5['toString'](),path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa5'),_0x1e74a4[_0xcc6a('0xa6')]),_0x45c45f]);return _0x1e74a4;}else{var _0x3b7b43=squel['select']();_0x3b7b43[_0xcc6a('0x76')]('('+_0x5661b5[_0xcc6a('0x89')]()+')',_0xcc6a('0xa7'));_0x3b7b43['field'](_0xcc6a('0xa8'),'count');_0x5661b5[_0xcc6a('0x21')](_0x1f1ff7[_0xcc6a('0x21')]||_0x58cd56);_0x5661b5['offset'](_0x1f1ff7[_0xcc6a('0x1f')]||0x0);return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x3b7b43[_0xcc6a('0x89')](),{'type':dbH[_0xcc6a('0x88')][_0xcc6a('0x8a')][_0xcc6a('0x8b')]})[_0xcc6a('0x29')](function(_0x25ba57){if(!_0x25ba57[_0xcc6a('0x4c')]){_0x589bff=0x0;}else{_0x589bff=_0x25ba57[0x0][_0xcc6a('0x22')]||0x0;}return dbH['sequelize']['query'](_0x5661b5[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});})['then'](function(_0x32ced0){return{'rows':_0x32ced0||[],'count':_0x589bff};});}});}exports[_0xcc6a('0xa9')]=function(_0xc638ae,_0x3367e8){return runReport(_0xc638ae['params'],_0xc638ae[_0xcc6a('0x37')],_0xc638ae['options'])['then'](respondWithResult(_0x3367e8,null))[_0xcc6a('0x48')](handleError(_0x3367e8,null));};exports[_0xcc6a('0xaa')]=runReport;exports[_0xcc6a('0x37')]=function(_0x38d805,_0x3f5f97){var _0x399eb6=0xa;var _0x2ae391=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x50b948={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x1d2ae0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x41d17b=function(_0x1827e6){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),'IS\x20NOT\x20NULL',_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x1827e6);};var _0xa70fa=function(_0x33ec76){if(!_0x33ec76||!_0x33ec76[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x30162c='(',_0x48746a=0x0;_0x48746a<_0x33ec76['rules'][_0xcc6a('0x4c')];_0x48746a+=0x1){_0x48746a>0x0&&(_0x30162c+='\x20'+_0x33ec76[_0xcc6a('0x6f')]+'\x20');_0x30162c+=_0x33ec76['rules'][_0x48746a][_0xcc6a('0x7b')]?_0xa70fa(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x7b')]):_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x70')]+'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['condition']+(_0x41d17b(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x71')])?'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['value']:'');}return _0x30162c+')';};var _0x54f0e4={'where':{'id':_0x38d805[_0xcc6a('0x4a')]['id']}},_0x559f4f,_0x545b15,_0x17a4e1,_0x5a7da7,_0x434c8b;_0x54f0e4=_['merge']({},_0x54f0e4,_0x38d805[_0xcc6a('0x4d')]);return db['AnalyticDefaultReport'][_0xcc6a('0x4e')](_0x54f0e4)[_0xcc6a('0x29')](function(_0xe9231f){if(_0xe9231f){_0x559f4f=_0xe9231f;return _0xe9231f[_0xcc6a('0xab')]();}return null;})[_0xcc6a('0x29')](function(_0x197961){if(_0x197961){if(!_0x197961[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x545b15=_0x197961;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x171a2a){if(_0x171a2a){_0x17a4e1=_[_0xcc6a('0xac')](_0x171a2a,'id');var _0x13860b;var _0x3b52f7=squel[_0xcc6a('0x75')]();_0x3b52f7[_0xcc6a('0x76')](_0x559f4f[_0xcc6a('0x77')]);for(var _0x319f4a=0x0;_0x319f4a<_0x545b15[_0xcc6a('0x4c')];_0x319f4a+=0x1){_0x13860b=_0x545b15[_0x319f4a]['MetricId']?_0x17a4e1[_0x545b15[_0x319f4a][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x545b15[_0x319f4a][_0xcc6a('0x70')];_0x13860b=_0x545b15[_0x319f4a]['function']?_[_0xcc6a('0x79')](_0x50b948[_0x545b15[_0x319f4a][_0xcc6a('0x93')]],'%s',_0x13860b):_0x13860b;_0x13860b=_0x545b15[_0x319f4a]['format']?_[_0xcc6a('0x79')](_0x1d2ae0[_0x545b15[_0x319f4a][_0xcc6a('0x7a')]],'%s',_0x13860b):_0x13860b;if(_0x545b15[_0x319f4a]['groupBy']){_0x3b52f7[_0xcc6a('0x7b')](_0x13860b);}_0x545b15[_0x319f4a][_0xcc6a('0x95')]&&_0x3b52f7[_0xcc6a('0x3d')](_0x13860b,_0x545b15[_0x319f4a][_0xcc6a('0x95')]===_0xcc6a('0x7c')?![]:!![]);_0x3b52f7[_0xcc6a('0x70')](_0x13860b,_0x545b15[_0x319f4a]['alias']||_0x13860b);}if(_0x559f4f['joins']){_0x559f4f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x559f4f['joins']);for(var _0x154885=0x0;_0x154885<_0x559f4f['joins'][_0xcc6a('0x4c')];_0x154885+=0x1){if(_0x559f4f['joins'][_0x154885][_0xcc6a('0x34')]&&_[_0xcc6a('0x6a')](_0x2ae391,_0x559f4f[_0xcc6a('0x7e')][_0x154885]['type'])&&_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')]&&_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignTable']&&_0x559f4f['joins'][_0x154885]['foreignKey']){_0x3b52f7[_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x34')]](_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x559f4f[_0xcc6a('0x77')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignKey']));}}}if(_0x559f4f[_0xcc6a('0x84')]){_0x559f4f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x559f4f['conditions']);_0x3b52f7[_0xcc6a('0x3f')](_0xa70fa(_0x559f4f[_0xcc6a('0x84')][_0xcc6a('0x7b')]));}_0x434c8b=_0x3b52f7['clone']();_0x3b52f7[_0xcc6a('0x21')](_0x399eb6);_0x3b52f7[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x3b52f7['toString']());return dbH[_0xcc6a('0x88')]['query'](_0x3b52f7['toString'](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});}})['then'](function(){return{'sql':_0x434c8b[_0xcc6a('0x89')]()};})[_0xcc6a('0x29')](respondWithResult(_0x3f5f97,null))[_0xcc6a('0x48')](handleError(_0x3f5f97,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index cb29de5..b76627b 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 _0xc7e8=['AnalyticDefaultReport','analytics_default_reports','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define'];(function(_0x1cd3e3,_0xbeb106){var _0x4a3336=function(_0x2a385d){while(--_0x2a385d){_0x1cd3e3['push'](_0x1cd3e3['shift']());}};_0x4a3336(++_0xbeb106);}(_0xc7e8,0x11a));var _0x8c7e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc7e8[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x8c7e('0x0'));var util=require(_0x8c7e('0x1'));var logger=require('../../config/logger')(_0x8c7e('0x2'));var moment=require(_0x8c7e('0x3'));var BPromise=require(_0x8c7e('0x4'));var rp=require(_0x8c7e('0x5'));var fs=require('fs');var path=require(_0x8c7e('0x6'));var rimraf=require(_0x8c7e('0x7'));var config=require(_0x8c7e('0x8'));var attributes=require(_0x8c7e('0x9'));module[_0x8c7e('0xa')]=function(_0x7596d0,_0x3d90f8){return _0x7596d0[_0x8c7e('0xb')](_0x8c7e('0xc'),attributes,{'tableName':_0x8c7e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30d6=['rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','util','../../config/logger','api','moment','request-promise','path'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x30d6,0x192));var _0x630d=function(_0x8e7772,_0x9d77b0){_0x8e7772=_0x8e7772-0x0;var _0x408200=_0x30d6[_0x8e7772];return _0x408200;};'use strict';var _=require('lodash');var util=require(_0x630d('0x0'));var logger=require(_0x630d('0x1'))(_0x630d('0x2'));var moment=require(_0x630d('0x3'));var BPromise=require('bluebird');var rp=require(_0x630d('0x4'));var fs=require('fs');var path=require(_0x630d('0x5'));var rimraf=require(_0x630d('0x6'));var config=require(_0x630d('0x7'));var attributes=require(_0x630d('0x8'));module[_0x630d('0x9')]=function(_0x1bb227,_0x40b96b){return _0x1bb227[_0x630d('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0x630d('0xb'),'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 c2f10db..90dbb89 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 _0x1980=['request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x17cbae,_0x75ebc8){var _0x325ef8=function(_0x3eef6b){while(--_0x3eef6b){_0x17cbae['push'](_0x17cbae['shift']());}};_0x325ef8(++_0x75ebc8);}(_0x1980,0xe4));var _0x0198=function(_0x14ca5e,_0x42d3da){_0x14ca5e=_0x14ca5e-0x0;var _0x3c5337=_0x1980[_0x14ca5e];return _0x3c5337;};'use strict';var _=require(_0x0198('0x0'));var util=require(_0x0198('0x1'));var moment=require(_0x0198('0x2'));var BPromise=require('bluebird');var rs=require(_0x0198('0x3'));var fs=require('fs');var Redis=require(_0x0198('0x4'));var db=require(_0x0198('0x5'))['db'];var utils=require(_0x0198('0x6'));var logger=require(_0x0198('0x7'))('rpc');var config=require(_0x0198('0x8'));var jayson=require(_0x0198('0x9'));var client=jayson['client'][_0x0198('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17b3b5,_0x162696,_0x373a9a){return new BPromise(function(_0x384f6a,_0x2255f7){return client[_0x0198('0xb')](_0x17b3b5,_0x373a9a)[_0x0198('0xc')](function(_0x3235cf){logger['info'](_0x0198('0xd'),_0x162696,_0x0198('0xe'));logger['debug'](_0x0198('0xf'),_0x162696,_0x0198('0xe'),JSON['stringify'](_0x3235cf));if(_0x3235cf[_0x0198('0x10')]){if(_0x3235cf[_0x0198('0x10')][_0x0198('0x11')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x162696,_0x3235cf[_0x0198('0x10')][_0x0198('0x12')]);return _0x2255f7(_0x3235cf[_0x0198('0x10')][_0x0198('0x12')]);}logger[_0x0198('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x162696,_0x3235cf['error'][_0x0198('0x12')]);return _0x384f6a(_0x3235cf['error']['message']);}else{logger[_0x0198('0x13')](_0x0198('0xd'),_0x162696,_0x0198('0xe'));_0x384f6a(_0x3235cf[_0x0198('0x14')]['message']);}})[_0x0198('0x15')](function(_0x24fb7b){logger[_0x0198('0x10')](_0x0198('0xd'),_0x162696,_0x24fb7b);_0x2255f7(_0x24fb7b);});});} \ No newline at end of file +var _0x8db8=['request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticDefaultReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','then','info'];(function(_0x162def,_0x4fdb79){var _0x2e19f1=function(_0x446f98){while(--_0x446f98){_0x162def['push'](_0x162def['shift']());}};_0x2e19f1(++_0x4fdb79);}(_0x8db8,0xb1));var _0x88db=function(_0x4501fe,_0x5727e9){_0x4501fe=_0x4501fe-0x0;var _0x170487=_0x8db8[_0x4501fe];return _0x170487;};'use strict';var _=require(_0x88db('0x0'));var util=require(_0x88db('0x1'));var moment=require(_0x88db('0x2'));var BPromise=require(_0x88db('0x3'));var rs=require(_0x88db('0x4'));var fs=require('fs');var Redis=require(_0x88db('0x5'));var db=require(_0x88db('0x6'))['db'];var utils=require(_0x88db('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x88db('0x8'));var client=jayson['client'][_0x88db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a7794,_0x2d31a6,_0x23388b){return new BPromise(function(_0x2eafe0,_0x318d5b){return client['request'](_0x3a7794,_0x23388b)[_0x88db('0xa')](function(_0x3175c8){logger[_0x88db('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2d31a6,_0x88db('0xc'));logger['debug'](_0x88db('0xd'),_0x2d31a6,_0x88db('0xc'),JSON[_0x88db('0xe')](_0x3175c8));if(_0x3175c8[_0x88db('0xf')]){if(_0x3175c8['error'][_0x88db('0x10')]===0x1f4){logger[_0x88db('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2d31a6,_0x3175c8[_0x88db('0xf')][_0x88db('0x11')]);return _0x318d5b(_0x3175c8[_0x88db('0xf')][_0x88db('0x11')]);}logger[_0x88db('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2d31a6,_0x3175c8[_0x88db('0xf')][_0x88db('0x11')]);return _0x2eafe0(_0x3175c8[_0x88db('0xf')][_0x88db('0x11')]);}else{logger[_0x88db('0xb')](_0x88db('0x12'),_0x2d31a6,_0x88db('0xc'));_0x2eafe0(_0x3175c8[_0x88db('0x13')][_0x88db('0x11')]);}})[_0x88db('0x14')](function(_0x127e20){logger[_0x88db('0xf')](_0x88db('0x12'),_0x2d31a6,_0x127e20);_0x318d5b(_0x127e20);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index d7b0164..deffc97 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 _0x287e=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','/:id/preview','isAuthenticated','preview','/:id/run','run','/:id/query','query','put','delete','/:id','destroy','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x287e,0x1e3));var _0xe287=function(_0x868831,_0x1ae29a){_0x868831=_0x868831-0x0;var _0x11e1fa=_0x287e[_0x868831];return _0x11e1fa;};'use strict';var multer=require(_0xe287('0x0'));var util=require(_0xe287('0x1'));var path=require(_0xe287('0x2'));var timeout=require(_0xe287('0x3'));var express=require(_0xe287('0x4'));var router=express[_0xe287('0x5')]();var fs_extra=require(_0xe287('0x6'));var auth=require(_0xe287('0x7'));var interaction=require(_0xe287('0x8'));var config=require('../../config/environment');var controller=require(_0xe287('0x9'));router[_0xe287('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe287('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe287('0xa')](_0xe287('0xb'),auth[_0xe287('0xc')](),controller[_0xe287('0xd')]);router[_0xe287('0xa')](_0xe287('0xe'),auth[_0xe287('0xc')](),controller[_0xe287('0xf')]);router[_0xe287('0xa')](_0xe287('0x10'),auth[_0xe287('0xc')](),controller[_0xe287('0x11')]);router['post']('/',auth[_0xe287('0xc')](),controller['create']);router[_0xe287('0x12')]('/:id',auth[_0xe287('0xc')](),controller['update']);router[_0xe287('0x13')](_0xe287('0x14'),auth[_0xe287('0xc')](),controller[_0xe287('0x15')]);module[_0xe287('0x16')]=router; \ No newline at end of file +var _0xe321=['preview','run','/:id/query','query','post','put','destroy','exports','util','path','connect-timeout','fs-extra','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id'];(function(_0x4a6702,_0x405e77){var _0x3c5e45=function(_0x2e841f){while(--_0x2e841f){_0x4a6702['push'](_0x4a6702['shift']());}};_0x3c5e45(++_0x405e77);}(_0xe321,0x194));var _0x1e32=function(_0x2e67a4,_0x281041){_0x2e67a4=_0x2e67a4-0x0;var _0x4cb738=_0xe321[_0x2e67a4];return _0x4cb738;};'use strict';var multer=require('multer');var util=require(_0x1e32('0x0'));var path=require(_0x1e32('0x1'));var timeout=require(_0x1e32('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1e32('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1e32('0x4'));var controller=require(_0x1e32('0x5'));router[_0x1e32('0x6')]('/',auth[_0x1e32('0x7')](),controller[_0x1e32('0x8')]);router[_0x1e32('0x6')](_0x1e32('0x9'),auth[_0x1e32('0x7')](),controller['show']);router[_0x1e32('0x6')]('/:id/preview',auth[_0x1e32('0x7')](),controller[_0x1e32('0xa')]);router['get']('/:id/run',auth[_0x1e32('0x7')](),controller[_0x1e32('0xb')]);router['get'](_0x1e32('0xc'),auth[_0x1e32('0x7')](),controller[_0x1e32('0xd')]);router[_0x1e32('0xe')]('/',auth[_0x1e32('0x7')](),controller['create']);router[_0x1e32('0xf')]('/:id',auth[_0x1e32('0x7')](),controller['update']);router['delete'](_0x1e32('0x9'),auth[_0x1e32('0x7')](),controller[_0x1e32('0x10')]);module[_0x1e32('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index b60d23b..ad197ae 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 _0xa442=['moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','scheduled','manual','UNSIGNED'];(function(_0x593211,_0x271794){var _0x65c6b3=function(_0x1a318b){while(--_0x1a318b){_0x593211['push'](_0x593211['shift']());}};_0x65c6b3(++_0x271794);}(_0xa442,0x114));var _0x2a44=function(_0x2aac51,_0x2dbc51){_0x2aac51=_0x2aac51-0x0;var _0x4ba79b=_0xa442[_0x2aac51];return _0x4ba79b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2a44('0x0'));module[_0x2a44('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x2a44('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x2a44('0x3')](_0x2a44('0x4'),_0x2a44('0x5'),_0x2a44('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x2a44('0x7')]},'endDate':{'type':Sequelize[_0x2a44('0x7')]},'status':{'type':Sequelize[_0x2a44('0x2')],'defaultValue':_0x2a44('0x8')},'type':{'type':Sequelize[_0x2a44('0x3')]('manual',_0x2a44('0x9')),'allowNull':![],'defaultValue':_0x2a44('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x2a44('0xb')]},'reportType':{'type':Sequelize[_0x2a44('0x2')]}}; \ No newline at end of file +var _0x04d1=['Loading','scheduled','manual','INTEGER','UNSIGNED','sequelize','exports','STRING','ENUM','csv','pdf','xlsx','DATE'];(function(_0x631a3c,_0x1b61b6){var _0x2bdfa3=function(_0x21711b){while(--_0x21711b){_0x631a3c['push'](_0x631a3c['shift']());}};_0x2bdfa3(++_0x1b61b6);}(_0x04d1,0x1d9));var _0x104d=function(_0x33fb6c,_0xdf875b){_0x33fb6c=_0x33fb6c-0x0;var _0x291370=_0x04d1[_0x33fb6c];return _0x291370;};'use strict';var Sequelize=require(_0x104d('0x0'));var moment=require('moment');module[_0x104d('0x1')]={'name':{'type':Sequelize[_0x104d('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x104d('0x3')](_0x104d('0x4'),_0x104d('0x5'),_0x104d('0x6')),'allowNull':![],'defaultValue':_0x104d('0x4')},'savename':{'type':Sequelize[_0x104d('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x104d('0x7')]},'status':{'type':Sequelize[_0x104d('0x2')],'defaultValue':_0x104d('0x8')},'type':{'type':Sequelize[_0x104d('0x3')]('manual',_0x104d('0x9')),'allowNull':![],'defaultValue':_0x104d('0xa')},'reportId':{'type':Sequelize[_0x104d('0xb')](0xb)[_0x104d('0xc')]},'reportType':{'type':Sequelize[_0x104d('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index dddd545..fdbfc6e 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 _0x6589=['squel','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','AnalyticExtractedReport','includeAll','include','rows','show','params','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','update','download','savename','output','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','join','format','%s.%s','toLowerCase','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0xefdc1c,_0x10f40b){var _0x48581c=function(_0x5cad7f){while(--_0x5cad7f){_0xefdc1c['push'](_0xefdc1c['shift']());}};_0x48581c(++_0x10f40b);}(_0x6589,0x166));var _0x9658=function(_0x5c7a85,_0x41dd19){_0x5c7a85=_0x5c7a85-0x0;var _0x35290f=_0x6589[_0x5c7a85];return _0x35290f;};'use strict';var emlformat=require(_0x9658('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9658('0x1'));var jsonpatch=require(_0x9658('0x2'));var rp=require(_0x9658('0x3'));var moment=require(_0x9658('0x4'));var BPromise=require(_0x9658('0x5'));var Mustache=require(_0x9658('0x6'));var util=require(_0x9658('0x7'));var path=require(_0x9658('0x8'));var sox=require(_0x9658('0x9'));var csv=require(_0x9658('0xa'));var ejs=require(_0x9658('0xb'));var fs=require('fs');var fs_extra=require(_0x9658('0xc'));var _=require(_0x9658('0xd'));var squel=require(_0x9658('0xe'));var crypto=require('crypto');var jsforce=require(_0x9658('0xf'));var deskjs=require(_0x9658('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9658('0x11'));var authService=require(_0x9658('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9658('0x13'));var logger=require(_0x9658('0x14'))(_0x9658('0x15'));var utils=require(_0x9658('0x16'));var config=require(_0x9658('0x17'));var licenseUtil=require(_0x9658('0x18'));var db=require(_0x9658('0x19'))['db'];function respondWithStatusCode(_0x228bc3,_0x49e6a8){_0x49e6a8=_0x49e6a8||0xcc;return function(_0x709ea){if(_0x709ea){return _0x228bc3[_0x9658('0x1a')](_0x49e6a8);}return _0x228bc3[_0x9658('0x1b')](_0x49e6a8)[_0x9658('0x1c')]();};}function respondWithResult(_0x208301,_0x4a324c){_0x4a324c=_0x4a324c||0xc8;return function(_0x2deeb8){if(_0x2deeb8){return _0x208301[_0x9658('0x1b')](_0x4a324c)['json'](_0x2deeb8);}};}function respondWithFilteredResult(_0x2edc0e,_0x36afe2){return function(_0x199dfe){if(_0x199dfe){var _0x207235=typeof _0x36afe2[_0x9658('0x1d')]===_0x9658('0x1e')&&typeof _0x36afe2[_0x9658('0x1f')]==='undefined';var _0x57d7cf=_0x199dfe[_0x9658('0x20')];var _0x6487d6=_0x207235?0x0:_0x36afe2[_0x9658('0x1d')];var _0x169ce4=_0x207235?_0x199dfe[_0x9658('0x20')]:_0x36afe2[_0x9658('0x1d')]+_0x36afe2[_0x9658('0x1f')];var _0x301e2c;if(_0x169ce4>=_0x57d7cf){_0x169ce4=_0x57d7cf;_0x301e2c=0xc8;}else{_0x301e2c=0xce;}_0x2edc0e[_0x9658('0x1b')](_0x301e2c);return _0x2edc0e[_0x9658('0x21')](_0x9658('0x22'),_0x6487d6+'-'+_0x169ce4+'/'+_0x57d7cf)['json'](_0x199dfe);}return null;};}function patchUpdates(_0x49b170){return function(_0x15faaa){try{jsonpatch[_0x9658('0x23')](_0x15faaa,_0x49b170,!![]);}catch(_0x301d77){return BPromise[_0x9658('0x24')](_0x301d77);}return _0x15faaa[_0x9658('0x25')]();};}function saveUpdates(_0x589626,_0xe37801){return function(_0x4945ae){if(_0x4945ae){return _0x4945ae['update'](_0x589626)[_0x9658('0x26')](function(_0x34d4ce){return _0x34d4ce;});}return null;};}function removeEntity(_0x4e6a1e,_0x4b82d7){return function(_0x36ba4a){if(_0x36ba4a){return _0x36ba4a[_0x9658('0x27')]()[_0x9658('0x26')](function(){var _0x2b3b46=_0x36ba4a[_0x9658('0x28')]({'plain':!![]});var _0x32f8e5=_0x9658('0x29');return db[_0x9658('0x2a')][_0x9658('0x27')]({'where':{'type':_0x32f8e5,'resourceId':_0x2b3b46['id']}})['then'](function(){return _0x36ba4a;});})[_0x9658('0x26')](function(){_0x4e6a1e[_0x9658('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28ea86,_0x5c33dd){return function(_0x4ce39f){if(!_0x4ce39f){_0x28ea86['sendStatus'](0x194);}return _0x4ce39f;};}function handleError(_0x4ecae9,_0x5dcb03){_0x5dcb03=_0x5dcb03||0x1f4;return function(_0x17e1cc){logger[_0x9658('0x2b')](_0x17e1cc[_0x9658('0x2c')]);if(_0x17e1cc[_0x9658('0x2d')]){delete _0x17e1cc['name'];}_0x4ecae9[_0x9658('0x1b')](_0x5dcb03)['send'](_0x17e1cc);};}exports[_0x9658('0x2e')]=function(_0xff80f3,_0x5eac48){var _0x39464a={},_0x55afea={},_0x2f8aef={'count':0x0,'rows':[]};var _0xb3c34a=_[_0x9658('0x2f')](db['AnalyticExtractedReport'][_0x9658('0x30')],function(_0x5622cc){return{'name':_0x5622cc[_0x9658('0x31')],'type':_0x5622cc['type']['key']};});_0x55afea['model']=_[_0x9658('0x2f')](_0xb3c34a,_0x9658('0x2d'));_0x55afea[_0x9658('0x32')]=_['keys'](_0xff80f3['query']);_0x55afea['filters']=_[_0x9658('0x33')](_0x55afea[_0x9658('0x34')],_0x55afea['query']);_0x39464a[_0x9658('0x35')]=_[_0x9658('0x33')](_0x55afea['model'],qs[_0x9658('0x36')](_0xff80f3['query'][_0x9658('0x36')]));_0x39464a[_0x9658('0x35')]=_0x39464a[_0x9658('0x35')][_0x9658('0x37')]?_0x39464a['attributes']:_0x55afea[_0x9658('0x34')];if(!_0xff80f3[_0x9658('0x32')][_0x9658('0x38')]('nolimit')){_0x39464a[_0x9658('0x1f')]=qs['limit'](_0xff80f3[_0x9658('0x32')][_0x9658('0x1f')]);_0x39464a[_0x9658('0x1d')]=qs[_0x9658('0x1d')](_0xff80f3['query'][_0x9658('0x1d')]);}_0x39464a[_0x9658('0x39')]=qs[_0x9658('0x3a')](_0xff80f3['query']['sort']);_0x39464a[_0x9658('0x3b')]=qs[_0x9658('0x3c')](_[_0x9658('0x3d')](_0xff80f3[_0x9658('0x32')],_0x55afea[_0x9658('0x3c')]),_0xb3c34a);if(_0xff80f3[_0x9658('0x32')][_0x9658('0x3e')]){_0x39464a[_0x9658('0x3b')]=_[_0x9658('0x3f')](_0x39464a[_0x9658('0x3b')],{'$or':_[_0x9658('0x2f')](_0xb3c34a,function(_0x3d8efc){if(_0x3d8efc['type']!==_0x9658('0x40')){var _0x5ef8dd={};_0x5ef8dd[_0x3d8efc[_0x9658('0x2d')]]={'$like':'%'+_0xff80f3[_0x9658('0x32')]['filter']+'%'};return _0x5ef8dd;}})});}_0x39464a=_[_0x9658('0x3f')]({},_0x39464a,_0xff80f3[_0x9658('0x41')]);var _0x56fe62={'where':_0x39464a[_0x9658('0x3b')]};return db[_0x9658('0x42')][_0x9658('0x20')](_0x56fe62)[_0x9658('0x26')](function(_0x19981c){_0x2f8aef[_0x9658('0x20')]=_0x19981c;if(_0xff80f3[_0x9658('0x32')][_0x9658('0x43')]){_0x39464a[_0x9658('0x44')]=[{'all':!![]}];}return db[_0x9658('0x42')]['findAll'](_0x39464a);})[_0x9658('0x26')](function(_0x5cbd68){_0x2f8aef[_0x9658('0x45')]=_0x5cbd68;return _0x2f8aef;})['then'](respondWithFilteredResult(_0x5eac48,_0x39464a))['catch'](handleError(_0x5eac48,null));};exports[_0x9658('0x46')]=function(_0x8115e5,_0x207a4d){var _0x560ce0={'raw':!![],'where':{'id':_0x8115e5[_0x9658('0x47')]['id']}},_0x44c065={};_0x44c065[_0x9658('0x34')]=_[_0x9658('0x48')](db[_0x9658('0x42')][_0x9658('0x30')]);_0x44c065[_0x9658('0x32')]=_[_0x9658('0x48')](_0x8115e5['query']);_0x44c065[_0x9658('0x3c')]=_[_0x9658('0x33')](_0x44c065[_0x9658('0x34')],_0x44c065[_0x9658('0x32')]);_0x560ce0['attributes']=_[_0x9658('0x33')](_0x44c065[_0x9658('0x34')],qs[_0x9658('0x36')](_0x8115e5[_0x9658('0x32')]['fields']));_0x560ce0[_0x9658('0x35')]=_0x560ce0[_0x9658('0x35')][_0x9658('0x37')]?_0x560ce0[_0x9658('0x35')]:_0x44c065['model'];if(_0x8115e5[_0x9658('0x32')][_0x9658('0x43')]){_0x560ce0['include']=[{'all':!![]}];}_0x560ce0=_[_0x9658('0x3f')]({},_0x560ce0,_0x8115e5['options']);return db[_0x9658('0x42')][_0x9658('0x49')](_0x560ce0)[_0x9658('0x26')](handleEntityNotFound(_0x207a4d,null))[_0x9658('0x26')](respondWithResult(_0x207a4d,null))[_0x9658('0x4a')](handleError(_0x207a4d,null));};exports[_0x9658('0x4b')]=function(_0x2141c4,_0x149486){return db['AnalyticExtractedReport'][_0x9658('0x4b')](_0x2141c4[_0x9658('0x4c')],{})[_0x9658('0x26')](function(_0x3758c8){var _0x1e3456=_0x2141c4[_0x9658('0x4d')][_0x9658('0x28')]({'plain':!![]});if(!_0x1e3456)throw new Error(_0x9658('0x4e'));if(_0x1e3456['role']===_0x9658('0x4d')){var _0x39c590=_0x3758c8[_0x9658('0x28')]({'plain':!![]});var _0x3a88f1='ExtractedReports';return db['UserProfileSection'][_0x9658('0x49')]({'where':{'name':_0x3a88f1,'userProfileId':_0x1e3456[_0x9658('0x4f')]},'raw':!![]})[_0x9658('0x26')](function(_0x46ab5b){if(_0x46ab5b&&_0x46ab5b[_0x9658('0x50')]===0x0){return db[_0x9658('0x2a')][_0x9658('0x4b')]({'name':_0x39c590[_0x9658('0x2d')],'resourceId':_0x39c590['id'],'type':_0x46ab5b[_0x9658('0x2d')],'sectionId':_0x46ab5b['id']},{})['then'](function(){return _0x3758c8;});}else{return _0x3758c8;}})[_0x9658('0x4a')](function(_0x18131c){logger[_0x9658('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18131c);throw _0x18131c;});}return _0x3758c8;})[_0x9658('0x26')](respondWithResult(_0x149486,0xc9))[_0x9658('0x4a')](handleError(_0x149486,null));};exports[_0x9658('0x51')]=function(_0x5a385d,_0x5d6e93){if(_0x5a385d[_0x9658('0x4c')]['id']){delete _0x5a385d[_0x9658('0x4c')]['id'];}return db['AnalyticExtractedReport'][_0x9658('0x49')]({'where':{'id':_0x5a385d[_0x9658('0x47')]['id']}})['then'](handleEntityNotFound(_0x5d6e93,null))['then'](saveUpdates(_0x5a385d['body'],null))[_0x9658('0x26')](respondWithResult(_0x5d6e93,null))['catch'](handleError(_0x5d6e93,null));};exports[_0x9658('0x27')]=function(_0x5eb748,_0x344a09){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x5eb748[_0x9658('0x47')]['id']}})[_0x9658('0x26')](handleEntityNotFound(_0x344a09,null))[_0x9658('0x26')](removeEntity(_0x344a09,null))[_0x9658('0x4a')](handleError(_0x344a09,null));};exports[_0x9658('0x52')]=function(_0x5403f7,_0xcd00f,_0x13eee0){return db['AnalyticExtractedReport'][_0x9658('0x49')]({'where':{'id':_0x5403f7[_0x9658('0x47')]['id']},'attributes':[_0x9658('0x2d'),'basename',_0x9658('0x53'),_0x9658('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0xcd00f,null))[_0x9658('0x26')](function(_0x34d883){if(_0x34d883){if(!fs['existsSync'](path['join'](config[_0x9658('0x55')],_0x9658('0x56'),_0x34d883[_0x9658('0x53')]))){throw new db['Sequelize'][(_0x9658('0x57'))](_0x9658('0x58'));}if(_0x5403f7[_0x9658('0x32')]['exists']){return _0xcd00f[_0x9658('0x1a')](0xc8);}return _0xcd00f[_0x9658('0x52')](path[_0x9658('0x59')](config[_0x9658('0x55')],_0x9658('0x56'),_0x34d883[_0x9658('0x53')]),util[_0x9658('0x5a')](_0x9658('0x5b'),_0x34d883['basename']||_0x34d883['name'],_0x34d883[_0x9658('0x54')][_0x9658('0x5c')]()));}})['catch'](handleError(_0xcd00f,null));}; \ No newline at end of file +var _0xbc07=['status','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','get','ExtractedReports','UserProfileResource','sendStatus','error','name','send','AnalyticExtractedReport','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','keys','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','savename','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','end'];(function(_0x11cd67,_0x5402e2){var _0x4f1f3b=function(_0x308392){while(--_0x308392){_0x11cd67['push'](_0x11cd67['shift']());}};_0x4f1f3b(++_0x5402e2);}(_0xbc07,0xf3));var _0x7bc0=function(_0x17f12e,_0x3621e6){_0x17f12e=_0x17f12e-0x0;var _0x286ca2=_0xbc07[_0x17f12e];return _0x286ca2;};'use strict';var emlformat=require(_0x7bc0('0x0'));var rimraf=require(_0x7bc0('0x1'));var zipdir=require(_0x7bc0('0x2'));var jsonpatch=require(_0x7bc0('0x3'));var rp=require(_0x7bc0('0x4'));var moment=require(_0x7bc0('0x5'));var BPromise=require(_0x7bc0('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7bc0('0x7'));var csv=require(_0x7bc0('0x8'));var ejs=require(_0x7bc0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7bc0('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bc0('0xb'));var deskjs=require(_0x7bc0('0xc'));var toCsv=require(_0x7bc0('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7bc0('0xd'));var authService=require(_0x7bc0('0xe'));var qs=require(_0x7bc0('0xf'));var as=require(_0x7bc0('0x10'));var hardwareService=require(_0x7bc0('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x7bc0('0x12'));var config=require(_0x7bc0('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48cd37,_0x170a84){_0x170a84=_0x170a84||0xcc;return function(_0x34ce1e){if(_0x34ce1e){return _0x48cd37['sendStatus'](_0x170a84);}return _0x48cd37['status'](_0x170a84)[_0x7bc0('0x14')]();};}function respondWithResult(_0x554189,_0x1bba64){_0x1bba64=_0x1bba64||0xc8;return function(_0x30d2f3){if(_0x30d2f3){return _0x554189[_0x7bc0('0x15')](_0x1bba64)['json'](_0x30d2f3);}};}function respondWithFilteredResult(_0x24e610,_0x4107f1){return function(_0xcddba7){if(_0xcddba7){var _0x1c512e=typeof _0x4107f1[_0x7bc0('0x16')]===_0x7bc0('0x17')&&typeof _0x4107f1[_0x7bc0('0x18')]===_0x7bc0('0x17');var _0x2c6752=_0xcddba7[_0x7bc0('0x19')];var _0x150245=_0x1c512e?0x0:_0x4107f1[_0x7bc0('0x16')];var _0x9271c4=_0x1c512e?_0xcddba7[_0x7bc0('0x19')]:_0x4107f1['offset']+_0x4107f1['limit'];var _0x5275d8;if(_0x9271c4>=_0x2c6752){_0x9271c4=_0x2c6752;_0x5275d8=0xc8;}else{_0x5275d8=0xce;}_0x24e610[_0x7bc0('0x15')](_0x5275d8);return _0x24e610[_0x7bc0('0x1a')]('Content-Range',_0x150245+'-'+_0x9271c4+'/'+_0x2c6752)[_0x7bc0('0x1b')](_0xcddba7);}return null;};}function patchUpdates(_0x3179a8){return function(_0x1ba038){try{jsonpatch[_0x7bc0('0x1c')](_0x1ba038,_0x3179a8,!![]);}catch(_0x5d2100){return BPromise['reject'](_0x5d2100);}return _0x1ba038[_0x7bc0('0x1d')]();};}function saveUpdates(_0x48c9a8,_0x16c784){return function(_0x3d54a9){if(_0x3d54a9){return _0x3d54a9[_0x7bc0('0x1e')](_0x48c9a8)[_0x7bc0('0x1f')](function(_0x3a47ba){return _0x3a47ba;});}return null;};}function removeEntity(_0x45a66e,_0x2f3f62){return function(_0x110094){if(_0x110094){return _0x110094[_0x7bc0('0x20')]()[_0x7bc0('0x1f')](function(){var _0x1bc121=_0x110094[_0x7bc0('0x21')]({'plain':!![]});var _0x1ab057=_0x7bc0('0x22');return db[_0x7bc0('0x23')][_0x7bc0('0x20')]({'where':{'type':_0x1ab057,'resourceId':_0x1bc121['id']}})[_0x7bc0('0x1f')](function(){return _0x110094;});})[_0x7bc0('0x1f')](function(){_0x45a66e['status'](0xcc)[_0x7bc0('0x14')]();});}};}function handleEntityNotFound(_0x475b52,_0x1e884c){return function(_0x4216cc){if(!_0x4216cc){_0x475b52[_0x7bc0('0x24')](0x194);}return _0x4216cc;};}function handleError(_0x307895,_0x5d090c){_0x5d090c=_0x5d090c||0x1f4;return function(_0x46b941){logger[_0x7bc0('0x25')](_0x46b941['stack']);if(_0x46b941[_0x7bc0('0x26')]){delete _0x46b941['name'];}_0x307895[_0x7bc0('0x15')](_0x5d090c)[_0x7bc0('0x27')](_0x46b941);};}exports['index']=function(_0x1ba845,_0x3ba533){var _0x2f841f={},_0x63acc3={},_0x1b3bd2={'count':0x0,'rows':[]};var _0x4c9817=_['map'](db[_0x7bc0('0x28')]['rawAttributes'],function(_0x393cc6){return{'name':_0x393cc6['fieldName'],'type':_0x393cc6[_0x7bc0('0x29')][_0x7bc0('0x2a')]};});_0x63acc3[_0x7bc0('0x2b')]=_['map'](_0x4c9817,_0x7bc0('0x26'));_0x63acc3[_0x7bc0('0x2c')]=_['keys'](_0x1ba845[_0x7bc0('0x2c')]);_0x63acc3[_0x7bc0('0x2d')]=_[_0x7bc0('0x2e')](_0x63acc3[_0x7bc0('0x2b')],_0x63acc3[_0x7bc0('0x2c')]);_0x2f841f['attributes']=_['intersection'](_0x63acc3['model'],qs[_0x7bc0('0x2f')](_0x1ba845[_0x7bc0('0x2c')][_0x7bc0('0x2f')]));_0x2f841f['attributes']=_0x2f841f[_0x7bc0('0x30')][_0x7bc0('0x31')]?_0x2f841f['attributes']:_0x63acc3[_0x7bc0('0x2b')];if(!_0x1ba845[_0x7bc0('0x2c')]['hasOwnProperty'](_0x7bc0('0x32'))){_0x2f841f[_0x7bc0('0x18')]=qs[_0x7bc0('0x18')](_0x1ba845[_0x7bc0('0x2c')][_0x7bc0('0x18')]);_0x2f841f[_0x7bc0('0x16')]=qs[_0x7bc0('0x16')](_0x1ba845[_0x7bc0('0x2c')][_0x7bc0('0x16')]);}_0x2f841f[_0x7bc0('0x33')]=qs[_0x7bc0('0x34')](_0x1ba845[_0x7bc0('0x2c')][_0x7bc0('0x34')]);_0x2f841f[_0x7bc0('0x35')]=qs[_0x7bc0('0x2d')](_[_0x7bc0('0x36')](_0x1ba845[_0x7bc0('0x2c')],_0x63acc3[_0x7bc0('0x2d')]),_0x4c9817);if(_0x1ba845[_0x7bc0('0x2c')][_0x7bc0('0x37')]){_0x2f841f[_0x7bc0('0x35')]=_[_0x7bc0('0x38')](_0x2f841f[_0x7bc0('0x35')],{'$or':_[_0x7bc0('0x39')](_0x4c9817,function(_0x549973){if(_0x549973['type']!==_0x7bc0('0x3a')){var _0x3ded29={};_0x3ded29[_0x549973[_0x7bc0('0x26')]]={'$like':'%'+_0x1ba845[_0x7bc0('0x2c')][_0x7bc0('0x37')]+'%'};return _0x3ded29;}})});}_0x2f841f=_['merge']({},_0x2f841f,_0x1ba845[_0x7bc0('0x3b')]);var _0x34ad15={'where':_0x2f841f[_0x7bc0('0x35')]};return db[_0x7bc0('0x28')][_0x7bc0('0x19')](_0x34ad15)[_0x7bc0('0x1f')](function(_0x497dd7){_0x1b3bd2[_0x7bc0('0x19')]=_0x497dd7;if(_0x1ba845['query'][_0x7bc0('0x3c')]){_0x2f841f[_0x7bc0('0x3d')]=[{'all':!![]}];}return db[_0x7bc0('0x28')]['findAll'](_0x2f841f);})[_0x7bc0('0x1f')](function(_0x5ebd5e){_0x1b3bd2[_0x7bc0('0x3e')]=_0x5ebd5e;return _0x1b3bd2;})['then'](respondWithFilteredResult(_0x3ba533,_0x2f841f))['catch'](handleError(_0x3ba533,null));};exports['show']=function(_0x12ba49,_0x572ae9){var _0x2ce726={'raw':!![],'where':{'id':_0x12ba49['params']['id']}},_0x643185={};_0x643185['model']=_[_0x7bc0('0x3f')](db[_0x7bc0('0x28')][_0x7bc0('0x40')]);_0x643185[_0x7bc0('0x2c')]=_[_0x7bc0('0x3f')](_0x12ba49['query']);_0x643185[_0x7bc0('0x2d')]=_[_0x7bc0('0x2e')](_0x643185[_0x7bc0('0x2b')],_0x643185[_0x7bc0('0x2c')]);_0x2ce726[_0x7bc0('0x30')]=_['intersection'](_0x643185[_0x7bc0('0x2b')],qs[_0x7bc0('0x2f')](_0x12ba49[_0x7bc0('0x2c')][_0x7bc0('0x2f')]));_0x2ce726[_0x7bc0('0x30')]=_0x2ce726[_0x7bc0('0x30')][_0x7bc0('0x31')]?_0x2ce726[_0x7bc0('0x30')]:_0x643185[_0x7bc0('0x2b')];if(_0x12ba49[_0x7bc0('0x2c')][_0x7bc0('0x3c')]){_0x2ce726['include']=[{'all':!![]}];}_0x2ce726=_[_0x7bc0('0x38')]({},_0x2ce726,_0x12ba49[_0x7bc0('0x3b')]);return db[_0x7bc0('0x28')][_0x7bc0('0x41')](_0x2ce726)[_0x7bc0('0x1f')](handleEntityNotFound(_0x572ae9,null))[_0x7bc0('0x1f')](respondWithResult(_0x572ae9,null))[_0x7bc0('0x42')](handleError(_0x572ae9,null));};exports[_0x7bc0('0x43')]=function(_0x551174,_0x4d20e2){return db[_0x7bc0('0x28')][_0x7bc0('0x43')](_0x551174[_0x7bc0('0x44')],{})['then'](function(_0x4e563e){var _0x4b8f90=_0x551174[_0x7bc0('0x45')][_0x7bc0('0x21')]({'plain':!![]});if(!_0x4b8f90)throw new Error(_0x7bc0('0x46'));if(_0x4b8f90['role']===_0x7bc0('0x45')){var _0x281cc8=_0x4e563e['get']({'plain':!![]});var _0x18137e=_0x7bc0('0x22');return db[_0x7bc0('0x47')]['find']({'where':{'name':_0x18137e,'userProfileId':_0x4b8f90[_0x7bc0('0x48')]},'raw':!![]})[_0x7bc0('0x1f')](function(_0xfa168f){if(_0xfa168f&&_0xfa168f[_0x7bc0('0x49')]===0x0){return db[_0x7bc0('0x23')][_0x7bc0('0x43')]({'name':_0x281cc8['name'],'resourceId':_0x281cc8['id'],'type':_0xfa168f[_0x7bc0('0x26')],'sectionId':_0xfa168f['id']},{})[_0x7bc0('0x1f')](function(){return _0x4e563e;});}else{return _0x4e563e;}})[_0x7bc0('0x42')](function(_0x5cddc8){logger[_0x7bc0('0x25')](_0x7bc0('0x4a'),_0x5cddc8);throw _0x5cddc8;});}return _0x4e563e;})[_0x7bc0('0x1f')](respondWithResult(_0x4d20e2,0xc9))[_0x7bc0('0x42')](handleError(_0x4d20e2,null));};exports[_0x7bc0('0x1e')]=function(_0xe78c1e,_0x5e9042){if(_0xe78c1e[_0x7bc0('0x44')]['id']){delete _0xe78c1e[_0x7bc0('0x44')]['id'];}return db[_0x7bc0('0x28')][_0x7bc0('0x41')]({'where':{'id':_0xe78c1e[_0x7bc0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5e9042,null))[_0x7bc0('0x1f')](saveUpdates(_0xe78c1e[_0x7bc0('0x44')],null))['then'](respondWithResult(_0x5e9042,null))[_0x7bc0('0x42')](handleError(_0x5e9042,null));};exports[_0x7bc0('0x20')]=function(_0x315774,_0x3bbda3){return db[_0x7bc0('0x28')][_0x7bc0('0x41')]({'where':{'id':_0x315774[_0x7bc0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3bbda3,null))['then'](removeEntity(_0x3bbda3,null))['catch'](handleError(_0x3bbda3,null));};exports[_0x7bc0('0x4c')]=function(_0x551481,_0x4fb3da,_0x33b42e){return db[_0x7bc0('0x28')][_0x7bc0('0x41')]({'where':{'id':_0x551481['params']['id']},'attributes':['name',_0x7bc0('0x4d'),'savename','output'],'raw':!![]})['then'](handleEntityNotFound(_0x4fb3da,null))[_0x7bc0('0x1f')](function(_0x1db9fa){if(_0x1db9fa){if(!fs[_0x7bc0('0x4e')](path[_0x7bc0('0x4f')](config[_0x7bc0('0x50')],_0x7bc0('0x51'),_0x1db9fa['savename']))){throw new db[(_0x7bc0('0x52'))][(_0x7bc0('0x53'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x551481[_0x7bc0('0x2c')][_0x7bc0('0x54')]){return _0x4fb3da[_0x7bc0('0x24')](0xc8);}return _0x4fb3da[_0x7bc0('0x4c')](path[_0x7bc0('0x4f')](config['root'],'server/files/reports',_0x1db9fa[_0x7bc0('0x55')]),util['format'](_0x7bc0('0x56'),_0x1db9fa[_0x7bc0('0x4d')]||_0x1db9fa[_0x7bc0('0x26')],_0x1db9fa['output'][_0x7bc0('0x57')]()));}})[_0x7bc0('0x42')](handleError(_0x4fb3da,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index fd534d9..ce74c02 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 _0x5fd1=['lodash','moment','bluebird','request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0x4d0da9,_0x5cee7d){var _0x5055e0=function(_0xcc8555){while(--_0xcc8555){_0x4d0da9['push'](_0x4d0da9['shift']());}};_0x5055e0(++_0x5cee7d);}(_0x5fd1,0x15e));var _0x15fd=function(_0x2784f4,_0x30c425){_0x2784f4=_0x2784f4-0x0;var _0x7214a2=_0x5fd1[_0x2784f4];return _0x7214a2;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x15fd('0x1'));var BPromise=require(_0x15fd('0x2'));var rp=require(_0x15fd('0x3'));var fs=require('fs');var path=require(_0x15fd('0x4'));var rimraf=require('rimraf');var config=require(_0x15fd('0x5'));var attributes=require(_0x15fd('0x6'));module[_0x15fd('0x7')]=function(_0x13d48e,_0x3ea089){return _0x13d48e['define'](_0x15fd('0x8'),attributes,{'tableName':_0x15fd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1955=['define','AnalyticExtractedReport','lodash','util','../../config/logger','api','bluebird','rimraf','./analyticExtractedReport.attributes','exports'];(function(_0x277d73,_0x3f7311){var _0x5b0a43=function(_0x54b1b1){while(--_0x54b1b1){_0x277d73['push'](_0x277d73['shift']());}};_0x5b0a43(++_0x3f7311);}(_0x1955,0xca));var _0x5195=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x1955[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x5195('0x0'));var util=require(_0x5195('0x1'));var logger=require(_0x5195('0x2'))(_0x5195('0x3'));var moment=require('moment');var BPromise=require(_0x5195('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5195('0x5'));var config=require('../../config/environment');var attributes=require(_0x5195('0x6'));module[_0x5195('0x7')]=function(_0x2ec9b8,_0x1a7ab9){return _0x2ec9b8[_0x5195('0x8')](_0x5195('0x9'),attributes,{'tableName':'analytics_extracted_reports','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 1214cb7..9d718a4 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 _0xba94=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0xba94,0xe3));var _0x4ba9=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xba94[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x4ba9('0x0'));var util=require(_0x4ba9('0x1'));var moment=require(_0x4ba9('0x2'));var BPromise=require(_0x4ba9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ba9('0x4'));var db=require(_0x4ba9('0x5'))['db'];var utils=require(_0x4ba9('0x6'));var logger=require(_0x4ba9('0x7'))('rpc');var config=require(_0x4ba9('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4458e7,_0x4b9cc1,_0x5f426d){return new BPromise(function(_0x380439,_0x4f1a3a){return client[_0x4ba9('0x9')](_0x4458e7,_0x5f426d)[_0x4ba9('0xa')](function(_0x5e58f0){logger[_0x4ba9('0xb')](_0x4ba9('0xc'),_0x4b9cc1,_0x4ba9('0xd'));logger[_0x4ba9('0xe')](_0x4ba9('0xf'),_0x4b9cc1,_0x4ba9('0xd'),JSON[_0x4ba9('0x10')](_0x5e58f0));if(_0x5e58f0[_0x4ba9('0x11')]){if(_0x5e58f0[_0x4ba9('0x11')][_0x4ba9('0x12')]===0x1f4){logger[_0x4ba9('0x11')](_0x4ba9('0xc'),_0x4b9cc1,_0x5e58f0[_0x4ba9('0x11')][_0x4ba9('0x13')]);return _0x4f1a3a(_0x5e58f0[_0x4ba9('0x11')][_0x4ba9('0x13')]);}logger[_0x4ba9('0x11')](_0x4ba9('0xc'),_0x4b9cc1,_0x5e58f0[_0x4ba9('0x11')]['message']);return _0x380439(_0x5e58f0[_0x4ba9('0x11')][_0x4ba9('0x13')]);}else{logger[_0x4ba9('0xb')](_0x4ba9('0xc'),_0x4b9cc1,_0x4ba9('0xd'));_0x380439(_0x5e58f0[_0x4ba9('0x14')]['message']);}})['catch'](function(_0x31510e){logger[_0x4ba9('0x11')](_0x4ba9('0xc'),_0x4b9cc1,_0x31510e);_0x4f1a3a(_0x31510e);});});} \ No newline at end of file +var _0x4189=['../../config/utils','rpc','../../config/environment','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1fb2e9,_0x240de2){var _0x327c7c=function(_0x361e94){while(--_0x361e94){_0x1fb2e9['push'](_0x1fb2e9['shift']());}};_0x327c7c(++_0x240de2);}(_0x4189,0x160));var _0x9418=function(_0x2a22b8,_0x228cdf){_0x2a22b8=_0x2a22b8-0x0;var _0x2715fd=_0x4189[_0x2a22b8];return _0x2715fd;};'use strict';var _=require(_0x9418('0x0'));var util=require('util');var moment=require(_0x9418('0x1'));var BPromise=require(_0x9418('0x2'));var rs=require(_0x9418('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9418('0x4'))['db'];var utils=require(_0x9418('0x5'));var logger=require('../../config/logger')(_0x9418('0x6'));var config=require(_0x9418('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9418('0x8')][_0x9418('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c3134,_0x215e21,_0x7cd70d){return new BPromise(function(_0x2ac01b,_0x1e902e){return client[_0x9418('0xa')](_0x4c3134,_0x7cd70d)[_0x9418('0xb')](function(_0x3d59dd){logger[_0x9418('0xc')](_0x9418('0xd'),_0x215e21,_0x9418('0xe'));logger['debug'](_0x9418('0xf'),_0x215e21,'request\x20sent',JSON[_0x9418('0x10')](_0x3d59dd));if(_0x3d59dd[_0x9418('0x11')]){if(_0x3d59dd[_0x9418('0x11')]['code']===0x1f4){logger[_0x9418('0x11')](_0x9418('0xd'),_0x215e21,_0x3d59dd[_0x9418('0x11')][_0x9418('0x12')]);return _0x1e902e(_0x3d59dd[_0x9418('0x11')][_0x9418('0x12')]);}logger[_0x9418('0x11')](_0x9418('0xd'),_0x215e21,_0x3d59dd[_0x9418('0x11')]['message']);return _0x2ac01b(_0x3d59dd[_0x9418('0x11')]['message']);}else{logger[_0x9418('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x215e21,'request\x20sent');_0x2ac01b(_0x3d59dd[_0x9418('0x13')][_0x9418('0x12')]);}})[_0x9418('0x14')](function(_0x1fdbfa){logger[_0x9418('0x11')](_0x9418('0xd'),_0x215e21,_0x1fdbfa);_0x1e902e(_0x1fdbfa);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index dd95dd0..0b28e22 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 _0x0a70=['/:id','show','/:id/download','download','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','./analyticExtractedReport.controller','get','isAuthenticated'];(function(_0x276b4a,_0x31eba0){var _0x5a7949=function(_0x3b1925){while(--_0x3b1925){_0x276b4a['push'](_0x276b4a['shift']());}};_0x5a7949(++_0x31eba0);}(_0x0a70,0x7e));var _0x00a7=function(_0x6b4261,_0x379297){_0x6b4261=_0x6b4261-0x0;var _0x5a8a67=_0x0a70[_0x6b4261];return _0x5a8a67;};'use strict';var multer=require(_0x00a7('0x0'));var util=require(_0x00a7('0x1'));var path=require(_0x00a7('0x2'));var timeout=require('connect-timeout');var express=require(_0x00a7('0x3'));var router=express[_0x00a7('0x4')]();var fs_extra=require(_0x00a7('0x5'));var auth=require(_0x00a7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x00a7('0x7'));router[_0x00a7('0x8')]('/',auth[_0x00a7('0x9')](),controller['index']);router[_0x00a7('0x8')](_0x00a7('0xa'),auth[_0x00a7('0x9')](),controller[_0x00a7('0xb')]);router['get'](_0x00a7('0xc'),auth[_0x00a7('0x9')](),controller[_0x00a7('0xd')]);router['post']('/',auth[_0x00a7('0x9')](),controller['create']);router['put'](_0x00a7('0xa'),auth[_0x00a7('0x9')](),controller[_0x00a7('0xe')]);router[_0x00a7('0xf')](_0x00a7('0xa'),auth[_0x00a7('0x9')](),controller[_0x00a7('0x10')]);module['exports']=router; \ No newline at end of file +var _0x1c09=['get','isAuthenticated','index','/:id','show','/:id/download','post','create','update','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xbaf5c4,_0x162678){var _0x531a72=function(_0x1705e0){while(--_0x1705e0){_0xbaf5c4['push'](_0xbaf5c4['shift']());}};_0x531a72(++_0x162678);}(_0x1c09,0xf3));var _0x91c0=function(_0x3f8ab6,_0x428986){_0x3f8ab6=_0x3f8ab6-0x0;var _0x4a977c=_0x1c09[_0x3f8ab6];return _0x4a977c;};'use strict';var multer=require(_0x91c0('0x0'));var util=require(_0x91c0('0x1'));var path=require(_0x91c0('0x2'));var timeout=require(_0x91c0('0x3'));var express=require('express');var router=express[_0x91c0('0x4')]();var fs_extra=require(_0x91c0('0x5'));var auth=require(_0x91c0('0x6'));var interaction=require(_0x91c0('0x7'));var config=require(_0x91c0('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0x91c0('0x9')]('/',auth[_0x91c0('0xa')](),controller[_0x91c0('0xb')]);router[_0x91c0('0x9')](_0x91c0('0xc'),auth['isAuthenticated'](),controller[_0x91c0('0xd')]);router[_0x91c0('0x9')](_0x91c0('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x91c0('0xf')]('/',auth[_0x91c0('0xa')](),controller[_0x91c0('0x10')]);router['put']('/:id',auth[_0x91c0('0xa')](),controller[_0x91c0('0x11')]);router['delete'](_0x91c0('0xc'),auth[_0x91c0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 091e787..9f027bd 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 _0xe212=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x46f700,_0x2b36d8){var _0x22f3ed=function(_0x113de9){while(--_0x113de9){_0x46f700['push'](_0x46f700['shift']());}};_0x22f3ed(++_0x2b36d8);}(_0xe212,0x178));var _0x2e21=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xe212[_0x3070dc];return _0x431489;};'use strict';var Sequelize=require(_0x2e21('0x0'));module[_0x2e21('0x1')]={'field':{'type':Sequelize[_0x2e21('0x2')]},'alias':{'type':Sequelize[_0x2e21('0x3')]},'function':{'type':Sequelize[_0x2e21('0x3')]},'format':{'type':Sequelize[_0x2e21('0x3')]},'groupBy':{'type':Sequelize[_0x2e21('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x2e21('0x3')]},'custom':{'type':Sequelize[_0x2e21('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xf766=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x14feb2,_0x59bdae){var _0x4a7e1c=function(_0x45a51e){while(--_0x45a51e){_0x14feb2['push'](_0x14feb2['shift']());}};_0x4a7e1c(++_0x59bdae);}(_0xf766,0x1b0));var _0x6f76=function(_0xbbfe59,_0x46067f){_0xbbfe59=_0xbbfe59-0x0;var _0x28a2a4=_0xf766[_0xbbfe59];return _0x28a2a4;};'use strict';var Sequelize=require(_0x6f76('0x0'));module[_0x6f76('0x1')]={'field':{'type':Sequelize[_0x6f76('0x2')]},'alias':{'type':Sequelize[_0x6f76('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x6f76('0x3')]},'groupBy':{'type':Sequelize[_0x6f76('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 079369e..60fbb8a 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 _0xc7a3=['fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','AnalyticFieldReport','includeAll','include','findAll','catch','show','params','options','find','create','bulkCreate','body','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','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','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','stack','send','index','map','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes'];(function(_0x26c4e1,_0xc419c2){var _0xf8943d=function(_0xb1d621){while(--_0xb1d621){_0x26c4e1['push'](_0x26c4e1['shift']());}};_0xf8943d(++_0xc419c2);}(_0xc7a3,0xc4));var _0x3c7a=function(_0x351fe2,_0x1afed8){_0x351fe2=_0x351fe2-0x0;var _0x19d900=_0xc7a3[_0x351fe2];return _0x19d900;};'use strict';var emlformat=require(_0x3c7a('0x0'));var rimraf=require(_0x3c7a('0x1'));var zipdir=require(_0x3c7a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3c7a('0x3'));var Mustache=require(_0x3c7a('0x4'));var util=require(_0x3c7a('0x5'));var path=require(_0x3c7a('0x6'));var sox=require(_0x3c7a('0x7'));var csv=require('to-csv');var ejs=require(_0x3c7a('0x8'));var fs=require('fs');var fs_extra=require(_0x3c7a('0x9'));var _=require(_0x3c7a('0xa'));var squel=require('squel');var crypto=require(_0x3c7a('0xb'));var jsforce=require(_0x3c7a('0xc'));var deskjs=require(_0x3c7a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3c7a('0xe'));var Papa=require(_0x3c7a('0xf'));var Redis=require(_0x3c7a('0x10'));var authService=require(_0x3c7a('0x11'));var qs=require(_0x3c7a('0x12'));var as=require(_0x3c7a('0x13'));var hardwareService=require(_0x3c7a('0x14'));var logger=require(_0x3c7a('0x15'))(_0x3c7a('0x16'));var utils=require('../../config/utils');var config=require(_0x3c7a('0x17'));var licenseUtil=require(_0x3c7a('0x18'));var db=require(_0x3c7a('0x19'))['db'];function respondWithStatusCode(_0xefa929,_0x1c825a){_0x1c825a=_0x1c825a||0xcc;return function(_0x33442e){if(_0x33442e){return _0xefa929['sendStatus'](_0x1c825a);}return _0xefa929[_0x3c7a('0x1a')](_0x1c825a)[_0x3c7a('0x1b')]();};}function respondWithResult(_0x18e2b4,_0x3192a5){_0x3192a5=_0x3192a5||0xc8;return function(_0x45ca40){if(_0x45ca40){return _0x18e2b4['status'](_0x3192a5)['json'](_0x45ca40);}};}function respondWithFilteredResult(_0x32dfe2,_0x360309){return function(_0x1ee8b2){if(_0x1ee8b2){var _0xf20236=typeof _0x360309[_0x3c7a('0x1c')]===_0x3c7a('0x1d')&&typeof _0x360309[_0x3c7a('0x1e')]===_0x3c7a('0x1d');var _0x1074c4=_0x1ee8b2['count'];var _0x3d1e94=_0xf20236?0x0:_0x360309[_0x3c7a('0x1c')];var _0x3554bb=_0xf20236?_0x1ee8b2[_0x3c7a('0x1f')]:_0x360309[_0x3c7a('0x1c')]+_0x360309['limit'];var _0x58b9a2;if(_0x3554bb>=_0x1074c4){_0x3554bb=_0x1074c4;_0x58b9a2=0xc8;}else{_0x58b9a2=0xce;}_0x32dfe2[_0x3c7a('0x1a')](_0x58b9a2);return _0x32dfe2[_0x3c7a('0x20')](_0x3c7a('0x21'),_0x3d1e94+'-'+_0x3554bb+'/'+_0x1074c4)[_0x3c7a('0x22')](_0x1ee8b2);}return null;};}function patchUpdates(_0x5c5a65){return function(_0x3c6ec6){try{jsonpatch[_0x3c7a('0x23')](_0x3c6ec6,_0x5c5a65,!![]);}catch(_0x451973){return BPromise[_0x3c7a('0x24')](_0x451973);}return _0x3c6ec6['save']();};}function saveUpdates(_0x107613,_0x3c840f){return function(_0x370d6c){if(_0x370d6c){return _0x370d6c[_0x3c7a('0x25')](_0x107613)[_0x3c7a('0x26')](function(_0x348c17){return _0x348c17;});}return null;};}function removeEntity(_0x2a834b,_0x4b0bf3){return function(_0x2af400){if(_0x2af400){return _0x2af400[_0x3c7a('0x27')]()['then'](function(){_0x2a834b[_0x3c7a('0x1a')](0xcc)[_0x3c7a('0x1b')]();});}};}function handleEntityNotFound(_0x635433,_0x7de046){return function(_0x470ab6){if(!_0x470ab6){_0x635433[_0x3c7a('0x28')](0x194);}return _0x470ab6;};}function handleError(_0x54347e,_0x4d9123){_0x4d9123=_0x4d9123||0x1f4;return function(_0x58a073){logger[_0x3c7a('0x29')](_0x58a073[_0x3c7a('0x2a')]);if(_0x58a073['name']){delete _0x58a073['name'];}_0x54347e[_0x3c7a('0x1a')](_0x4d9123)[_0x3c7a('0x2b')](_0x58a073);};}exports[_0x3c7a('0x2c')]=function(_0x4fca70,_0x96161e){var _0x28d01f={},_0x49ef68={},_0x494d03={'count':0x0,'rows':[]};var _0x4be5a4=_[_0x3c7a('0x2d')](db['AnalyticFieldReport'][_0x3c7a('0x2e')],function(_0x287bc6){return{'name':_0x287bc6['fieldName'],'type':_0x287bc6[_0x3c7a('0x2f')][_0x3c7a('0x30')]};});_0x49ef68[_0x3c7a('0x31')]=_[_0x3c7a('0x2d')](_0x4be5a4,_0x3c7a('0x32'));_0x49ef68[_0x3c7a('0x33')]=_[_0x3c7a('0x34')](_0x4fca70[_0x3c7a('0x33')]);_0x49ef68[_0x3c7a('0x35')]=_[_0x3c7a('0x36')](_0x49ef68[_0x3c7a('0x31')],_0x49ef68['query']);_0x28d01f[_0x3c7a('0x37')]=_[_0x3c7a('0x36')](_0x49ef68[_0x3c7a('0x31')],qs['fields'](_0x4fca70[_0x3c7a('0x33')][_0x3c7a('0x38')]));_0x28d01f[_0x3c7a('0x37')]=_0x28d01f['attributes'][_0x3c7a('0x39')]?_0x28d01f[_0x3c7a('0x37')]:_0x49ef68['model'];if(!_0x4fca70[_0x3c7a('0x33')][_0x3c7a('0x3a')](_0x3c7a('0x3b'))){_0x28d01f[_0x3c7a('0x1e')]=qs[_0x3c7a('0x1e')](_0x4fca70[_0x3c7a('0x33')]['limit']);_0x28d01f[_0x3c7a('0x1c')]=qs[_0x3c7a('0x1c')](_0x4fca70[_0x3c7a('0x33')]['offset']);}_0x28d01f[_0x3c7a('0x3c')]=qs[_0x3c7a('0x3d')](_0x4fca70[_0x3c7a('0x33')][_0x3c7a('0x3d')]);_0x28d01f[_0x3c7a('0x3e')]=qs['filters'](_['pick'](_0x4fca70[_0x3c7a('0x33')],_0x49ef68['filters']),_0x4be5a4);if(_0x4fca70[_0x3c7a('0x33')]['filter']){_0x28d01f['where']=_[_0x3c7a('0x3f')](_0x28d01f[_0x3c7a('0x3e')],{'$or':_['map'](_0x4be5a4,function(_0x400b30){if(_0x400b30[_0x3c7a('0x2f')]!==_0x3c7a('0x40')){var _0x350abd={};_0x350abd[_0x400b30[_0x3c7a('0x32')]]={'$like':'%'+_0x4fca70[_0x3c7a('0x33')]['filter']+'%'};return _0x350abd;}})});}_0x28d01f=_[_0x3c7a('0x3f')]({},_0x28d01f,_0x4fca70['options']);var _0x455872={'where':_0x28d01f[_0x3c7a('0x3e')]};return db[_0x3c7a('0x41')][_0x3c7a('0x1f')](_0x455872)[_0x3c7a('0x26')](function(_0x256302){_0x494d03['count']=_0x256302;if(_0x4fca70[_0x3c7a('0x33')][_0x3c7a('0x42')]){_0x28d01f[_0x3c7a('0x43')]=[{'all':!![]}];}return db[_0x3c7a('0x41')][_0x3c7a('0x44')](_0x28d01f);})[_0x3c7a('0x26')](function(_0x35259c){_0x494d03['rows']=_0x35259c;return _0x494d03;})[_0x3c7a('0x26')](respondWithFilteredResult(_0x96161e,_0x28d01f))[_0x3c7a('0x45')](handleError(_0x96161e,null));};exports[_0x3c7a('0x46')]=function(_0x3fda40,_0x24af9d){var _0x39eb90={'raw':![],'where':{'id':_0x3fda40[_0x3c7a('0x47')]['id']}},_0x585841={};_0x585841['model']=_['keys'](db['AnalyticFieldReport'][_0x3c7a('0x2e')]);_0x585841[_0x3c7a('0x33')]=_['keys'](_0x3fda40[_0x3c7a('0x33')]);_0x585841[_0x3c7a('0x35')]=_['intersection'](_0x585841[_0x3c7a('0x31')],_0x585841[_0x3c7a('0x33')]);_0x39eb90['attributes']=_['intersection'](_0x585841[_0x3c7a('0x31')],qs['fields'](_0x3fda40[_0x3c7a('0x33')]['fields']));_0x39eb90[_0x3c7a('0x37')]=_0x39eb90['attributes'][_0x3c7a('0x39')]?_0x39eb90['attributes']:_0x585841[_0x3c7a('0x31')];if(_0x3fda40[_0x3c7a('0x33')][_0x3c7a('0x42')]){_0x39eb90[_0x3c7a('0x43')]=[{'all':!![]}];}_0x39eb90=_[_0x3c7a('0x3f')]({},_0x39eb90,_0x3fda40[_0x3c7a('0x48')]);return db[_0x3c7a('0x41')][_0x3c7a('0x49')](_0x39eb90)[_0x3c7a('0x26')](handleEntityNotFound(_0x24af9d,null))[_0x3c7a('0x26')](respondWithResult(_0x24af9d,null))[_0x3c7a('0x45')](handleError(_0x24af9d,null));};exports[_0x3c7a('0x4a')]=function(_0xb16c31,_0x3899cf){return db[_0x3c7a('0x41')][_0x3c7a('0x4a')](_0xb16c31['body'],{})[_0x3c7a('0x26')](respondWithResult(_0x3899cf,0xc9))['catch'](handleError(_0x3899cf,null));};exports[_0x3c7a('0x4b')]=function(_0x207d1e,_0x2df36d){return db[_0x3c7a('0x41')][_0x3c7a('0x4b')](_0x207d1e['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2df36d,0xc9))[_0x3c7a('0x45')](handleError(_0x2df36d,null));};exports[_0x3c7a('0x25')]=function(_0x4ad13f,_0x43fcf1){if(_0x4ad13f[_0x3c7a('0x4c')]['id']){delete _0x4ad13f['body']['id'];}return db['AnalyticFieldReport'][_0x3c7a('0x49')]({'where':{'id':_0x4ad13f[_0x3c7a('0x47')]['id']}})[_0x3c7a('0x26')](handleEntityNotFound(_0x43fcf1,null))[_0x3c7a('0x26')](saveUpdates(_0x4ad13f[_0x3c7a('0x4c')],null))[_0x3c7a('0x26')](respondWithResult(_0x43fcf1,null))[_0x3c7a('0x45')](handleError(_0x43fcf1,null));};exports['destroy']=function(_0x37d603,_0x7a50b5){return db[_0x3c7a('0x41')][_0x3c7a('0x49')]({'where':{'id':_0x37d603[_0x3c7a('0x47')]['id']}})[_0x3c7a('0x26')](handleEntityNotFound(_0x7a50b5,null))['then'](removeEntity(_0x7a50b5,null))[_0x3c7a('0x45')](handleError(_0x7a50b5,null));};exports[_0x3c7a('0x4d')]=function(_0x475bec,_0x4881df){return db[_0x3c7a('0x41')][_0x3c7a('0x27')]({'where':{'id':_0x475bec['query'][_0x3c7a('0x4e')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4881df,0xcc))[_0x3c7a('0x45')](handleError(_0x4881df,null));};exports[_0x3c7a('0x4f')]=function(_0x97381b,_0x367edc,_0x14d421){return db[_0x3c7a('0x50')][_0x3c7a('0x51')]({'where':{'id':_0x97381b[_0x3c7a('0x47')]['id']}})['then'](handleEntityNotFound(_0x367edc,null))[_0x3c7a('0x26')](function(_0x53f19f){if(_0x53f19f){return db[_0x3c7a('0x52')]['transaction'](function(_0x3592db){return db['AnalyticFieldReport'][_0x3c7a('0x27')]({'where':{'CustomReportId':_0x97381b[_0x3c7a('0x47')]['id']},'transaction':_0x3592db})[_0x3c7a('0x26')](function(_0x3108e3){var _0x1a19f7=_[_0x3c7a('0x2d')](_0x97381b[_0x3c7a('0x4c')],function(_0x5d89fe){delete _0x5d89fe['id'];_0x5d89fe[_0x3c7a('0x53')]=_0x97381b['params']['id'];return _0x5d89fe;});return db[_0x3c7a('0x41')][_0x3c7a('0x4b')](_0x1a19f7,{'transaction':_0x3592db});});})[_0x3c7a('0x26')](function(){return db[_0x3c7a('0x41')][_0x3c7a('0x44')]({'where':{'CustomReportId':_0x97381b['params']['id']}});});}})['then'](respondWithResult(_0x367edc,null))[_0x3c7a('0x45')](handleError(_0x367edc,null));}; \ No newline at end of file +var _0xb92a=['keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','AnalyticFieldReport','include','findAll','rows','show','rawAttributes','includeAll','options','find','catch','create','body','bulkCreate','update','params','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','fieldName','type','key','map','query'];(function(_0x187839,_0x2fe76b){var _0x2cdebd=function(_0x28de5e){while(--_0x28de5e){_0x187839['push'](_0x187839['shift']());}};_0x2cdebd(++_0x2fe76b);}(_0xb92a,0x76));var _0xab92=function(_0x50ac6d,_0x1c15b){_0x50ac6d=_0x50ac6d-0x0;var _0x1c39a2=_0xb92a[_0x50ac6d];return _0x1c39a2;};'use strict';var emlformat=require(_0xab92('0x0'));var rimraf=require(_0xab92('0x1'));var zipdir=require(_0xab92('0x2'));var jsonpatch=require(_0xab92('0x3'));var rp=require('request-promise');var moment=require(_0xab92('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xab92('0x5'));var util=require(_0xab92('0x6'));var path=require(_0xab92('0x7'));var sox=require('sox');var csv=require(_0xab92('0x8'));var ejs=require(_0xab92('0x9'));var fs=require('fs');var fs_extra=require(_0xab92('0xa'));var _=require('lodash');var squel=require(_0xab92('0xb'));var crypto=require(_0xab92('0xc'));var jsforce=require(_0xab92('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xab92('0xe'));var Papa=require('papaparse');var Redis=require(_0xab92('0xf'));var authService=require(_0xab92('0x10'));var qs=require(_0xab92('0x11'));var as=require(_0xab92('0x12'));var hardwareService=require(_0xab92('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xab92('0x14'));var config=require(_0xab92('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xab92('0x16'))['db'];function respondWithStatusCode(_0x1fc5aa,_0x1cb1d3){_0x1cb1d3=_0x1cb1d3||0xcc;return function(_0x25fffa){if(_0x25fffa){return _0x1fc5aa[_0xab92('0x17')](_0x1cb1d3);}return _0x1fc5aa[_0xab92('0x18')](_0x1cb1d3)[_0xab92('0x19')]();};}function respondWithResult(_0x5b8743,_0x1d8e17){_0x1d8e17=_0x1d8e17||0xc8;return function(_0x245f42){if(_0x245f42){return _0x5b8743[_0xab92('0x18')](_0x1d8e17)['json'](_0x245f42);}};}function respondWithFilteredResult(_0x4fc4a4,_0x477acf){return function(_0x33c095){if(_0x33c095){var _0x15654f=typeof _0x477acf[_0xab92('0x1a')]===_0xab92('0x1b')&&typeof _0x477acf[_0xab92('0x1c')]===_0xab92('0x1b');var _0x202fa7=_0x33c095['count'];var _0x4cdec9=_0x15654f?0x0:_0x477acf['offset'];var _0x2ae7c8=_0x15654f?_0x33c095[_0xab92('0x1d')]:_0x477acf['offset']+_0x477acf[_0xab92('0x1c')];var _0xe6a211;if(_0x2ae7c8>=_0x202fa7){_0x2ae7c8=_0x202fa7;_0xe6a211=0xc8;}else{_0xe6a211=0xce;}_0x4fc4a4[_0xab92('0x18')](_0xe6a211);return _0x4fc4a4[_0xab92('0x1e')](_0xab92('0x1f'),_0x4cdec9+'-'+_0x2ae7c8+'/'+_0x202fa7)['json'](_0x33c095);}return null;};}function patchUpdates(_0x156d68){return function(_0x2e6872){try{jsonpatch[_0xab92('0x20')](_0x2e6872,_0x156d68,!![]);}catch(_0x58bb41){return BPromise[_0xab92('0x21')](_0x58bb41);}return _0x2e6872[_0xab92('0x22')]();};}function saveUpdates(_0x3a2d4e,_0x25f6cb){return function(_0x3a287d){if(_0x3a287d){return _0x3a287d['update'](_0x3a2d4e)['then'](function(_0x8cc438){return _0x8cc438;});}return null;};}function removeEntity(_0x51731e,_0x114f0c){return function(_0x666a55){if(_0x666a55){return _0x666a55[_0xab92('0x23')]()[_0xab92('0x24')](function(){_0x51731e['status'](0xcc)[_0xab92('0x19')]();});}};}function handleEntityNotFound(_0x1f4326,_0x36c5f8){return function(_0x48a662){if(!_0x48a662){_0x1f4326[_0xab92('0x17')](0x194);}return _0x48a662;};}function handleError(_0x3bfd66,_0x45e871){_0x45e871=_0x45e871||0x1f4;return function(_0xb386e4){logger['error'](_0xb386e4[_0xab92('0x25')]);if(_0xb386e4[_0xab92('0x26')]){delete _0xb386e4[_0xab92('0x26')];}_0x3bfd66[_0xab92('0x18')](_0x45e871)[_0xab92('0x27')](_0xb386e4);};}exports[_0xab92('0x28')]=function(_0x21b0ca,_0x2fc461){var _0x537038={},_0x29f060={},_0x2217cb={'count':0x0,'rows':[]};var _0x46b2c5=_['map'](db['AnalyticFieldReport']['rawAttributes'],function(_0x3fb0b7){return{'name':_0x3fb0b7[_0xab92('0x29')],'type':_0x3fb0b7[_0xab92('0x2a')][_0xab92('0x2b')]};});_0x29f060['model']=_[_0xab92('0x2c')](_0x46b2c5,_0xab92('0x26'));_0x29f060[_0xab92('0x2d')]=_[_0xab92('0x2e')](_0x21b0ca['query']);_0x29f060[_0xab92('0x2f')]=_[_0xab92('0x30')](_0x29f060[_0xab92('0x31')],_0x29f060[_0xab92('0x2d')]);_0x537038[_0xab92('0x32')]=_[_0xab92('0x30')](_0x29f060[_0xab92('0x31')],qs[_0xab92('0x33')](_0x21b0ca[_0xab92('0x2d')][_0xab92('0x33')]));_0x537038['attributes']=_0x537038[_0xab92('0x32')][_0xab92('0x34')]?_0x537038['attributes']:_0x29f060[_0xab92('0x31')];if(!_0x21b0ca[_0xab92('0x2d')][_0xab92('0x35')](_0xab92('0x36'))){_0x537038[_0xab92('0x1c')]=qs[_0xab92('0x1c')](_0x21b0ca['query'][_0xab92('0x1c')]);_0x537038[_0xab92('0x1a')]=qs['offset'](_0x21b0ca[_0xab92('0x2d')][_0xab92('0x1a')]);}_0x537038['order']=qs[_0xab92('0x37')](_0x21b0ca[_0xab92('0x2d')][_0xab92('0x37')]);_0x537038[_0xab92('0x38')]=qs[_0xab92('0x2f')](_[_0xab92('0x39')](_0x21b0ca['query'],_0x29f060[_0xab92('0x2f')]),_0x46b2c5);if(_0x21b0ca[_0xab92('0x2d')][_0xab92('0x3a')]){_0x537038['where']=_[_0xab92('0x3b')](_0x537038[_0xab92('0x38')],{'$or':_[_0xab92('0x2c')](_0x46b2c5,function(_0x3b2d19){if(_0x3b2d19[_0xab92('0x2a')]!==_0xab92('0x3c')){var _0x397288={};_0x397288[_0x3b2d19[_0xab92('0x26')]]={'$like':'%'+_0x21b0ca[_0xab92('0x2d')][_0xab92('0x3a')]+'%'};return _0x397288;}})});}_0x537038=_[_0xab92('0x3b')]({},_0x537038,_0x21b0ca['options']);var _0x3dc8c7={'where':_0x537038[_0xab92('0x38')]};return db[_0xab92('0x3d')][_0xab92('0x1d')](_0x3dc8c7)[_0xab92('0x24')](function(_0x544410){_0x2217cb['count']=_0x544410;if(_0x21b0ca[_0xab92('0x2d')]['includeAll']){_0x537038[_0xab92('0x3e')]=[{'all':!![]}];}return db[_0xab92('0x3d')][_0xab92('0x3f')](_0x537038);})[_0xab92('0x24')](function(_0x5cfbd6){_0x2217cb[_0xab92('0x40')]=_0x5cfbd6;return _0x2217cb;})[_0xab92('0x24')](respondWithFilteredResult(_0x2fc461,_0x537038))['catch'](handleError(_0x2fc461,null));};exports[_0xab92('0x41')]=function(_0x2f2a4d,_0x190012){var _0x238dfc={'raw':![],'where':{'id':_0x2f2a4d['params']['id']}},_0x2ee560={};_0x2ee560[_0xab92('0x31')]=_['keys'](db[_0xab92('0x3d')][_0xab92('0x42')]);_0x2ee560[_0xab92('0x2d')]=_['keys'](_0x2f2a4d[_0xab92('0x2d')]);_0x2ee560[_0xab92('0x2f')]=_[_0xab92('0x30')](_0x2ee560[_0xab92('0x31')],_0x2ee560[_0xab92('0x2d')]);_0x238dfc[_0xab92('0x32')]=_[_0xab92('0x30')](_0x2ee560[_0xab92('0x31')],qs[_0xab92('0x33')](_0x2f2a4d[_0xab92('0x2d')][_0xab92('0x33')]));_0x238dfc['attributes']=_0x238dfc[_0xab92('0x32')]['length']?_0x238dfc[_0xab92('0x32')]:_0x2ee560[_0xab92('0x31')];if(_0x2f2a4d['query'][_0xab92('0x43')]){_0x238dfc[_0xab92('0x3e')]=[{'all':!![]}];}_0x238dfc=_['merge']({},_0x238dfc,_0x2f2a4d[_0xab92('0x44')]);return db[_0xab92('0x3d')][_0xab92('0x45')](_0x238dfc)[_0xab92('0x24')](handleEntityNotFound(_0x190012,null))[_0xab92('0x24')](respondWithResult(_0x190012,null))[_0xab92('0x46')](handleError(_0x190012,null));};exports['create']=function(_0x121d24,_0x4d3c41){return db['AnalyticFieldReport'][_0xab92('0x47')](_0x121d24[_0xab92('0x48')],{})[_0xab92('0x24')](respondWithResult(_0x4d3c41,0xc9))['catch'](handleError(_0x4d3c41,null));};exports['bulkCreate']=function(_0x324f6b,_0xf1f1f9){return db[_0xab92('0x3d')][_0xab92('0x49')](_0x324f6b[_0xab92('0x48')],{'raw':![],'individualHooks':!![]})[_0xab92('0x24')](respondWithResult(_0xf1f1f9,0xc9))[_0xab92('0x46')](handleError(_0xf1f1f9,null));};exports[_0xab92('0x4a')]=function(_0x40258b,_0x40e84d){if(_0x40258b[_0xab92('0x48')]['id']){delete _0x40258b[_0xab92('0x48')]['id'];}return db['AnalyticFieldReport'][_0xab92('0x45')]({'where':{'id':_0x40258b[_0xab92('0x4b')]['id']}})[_0xab92('0x24')](handleEntityNotFound(_0x40e84d,null))[_0xab92('0x24')](saveUpdates(_0x40258b['body'],null))[_0xab92('0x24')](respondWithResult(_0x40e84d,null))[_0xab92('0x46')](handleError(_0x40e84d,null));};exports[_0xab92('0x23')]=function(_0x3ee5bd,_0x475c99){return db[_0xab92('0x3d')][_0xab92('0x45')]({'where':{'id':_0x3ee5bd[_0xab92('0x4b')]['id']}})['then'](handleEntityNotFound(_0x475c99,null))[_0xab92('0x24')](removeEntity(_0x475c99,null))[_0xab92('0x46')](handleError(_0x475c99,null));};exports[_0xab92('0x4c')]=function(_0x14956a,_0x558265){return db[_0xab92('0x3d')][_0xab92('0x23')]({'where':{'id':_0x14956a[_0xab92('0x2d')][_0xab92('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0xab92('0x24')](respondWithResult(_0x558265,0xcc))[_0xab92('0x46')](handleError(_0x558265,null));};exports[_0xab92('0x4e')]=function(_0xf0fd98,_0x45ad47,_0x4af58b){return db[_0xab92('0x4f')]['findOne']({'where':{'id':_0xf0fd98[_0xab92('0x4b')]['id']}})[_0xab92('0x24')](handleEntityNotFound(_0x45ad47,null))[_0xab92('0x24')](function(_0x43dfaf){if(_0x43dfaf){return db[_0xab92('0x50')]['transaction'](function(_0x3b6d46){return db[_0xab92('0x3d')][_0xab92('0x23')]({'where':{'CustomReportId':_0xf0fd98[_0xab92('0x4b')]['id']},'transaction':_0x3b6d46})['then'](function(_0x3af75c){var _0x3c5ea0=_[_0xab92('0x2c')](_0xf0fd98[_0xab92('0x48')],function(_0x3e818c){delete _0x3e818c['id'];_0x3e818c[_0xab92('0x51')]=_0xf0fd98[_0xab92('0x4b')]['id'];return _0x3e818c;});return db[_0xab92('0x3d')][_0xab92('0x49')](_0x3c5ea0,{'transaction':_0x3b6d46});});})['then'](function(){return db[_0xab92('0x3d')][_0xab92('0x3f')]({'where':{'CustomReportId':_0xf0fd98['params']['id']}});});}})['then'](respondWithResult(_0x45ad47,null))[_0xab92('0x46')](handleError(_0x45ad47,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 98ba3aa..e359645 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 _0x1179=['rimraf','exports','define','AnalyticFieldReport','analytics_report_fields','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x1179,0x89));var _0x9117=function(_0x5190e3,_0x5aa3f6){_0x5190e3=_0x5190e3-0x0;var _0x12d24c=_0x1179[_0x5190e3];return _0x12d24c;};'use strict';var _=require('lodash');var util=require(_0x9117('0x0'));var logger=require(_0x9117('0x1'))(_0x9117('0x2'));var moment=require(_0x9117('0x3'));var BPromise=require(_0x9117('0x4'));var rp=require(_0x9117('0x5'));var fs=require('fs');var path=require(_0x9117('0x6'));var rimraf=require(_0x9117('0x7'));var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module[_0x9117('0x8')]=function(_0x1bb4f9,_0x3f62ab){return _0x1bb4f9[_0x9117('0x9')](_0x9117('0xa'),attributes,{'tableName':_0x9117('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cc0=['define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./analyticFieldReport.attributes','exports'];(function(_0x450b91,_0x2589a9){var _0x42a2d0=function(_0x41b9a4){while(--_0x41b9a4){_0x450b91['push'](_0x450b91['shift']());}};_0x42a2d0(++_0x2589a9);}(_0x1cc0,0x15f));var _0x01cc=function(_0x14e892,_0x3a9e8a){_0x14e892=_0x14e892-0x0;var _0x3593b4=_0x1cc0[_0x14e892];return _0x3593b4;};'use strict';var _=require(_0x01cc('0x0'));var util=require(_0x01cc('0x1'));var logger=require(_0x01cc('0x2'))(_0x01cc('0x3'));var moment=require(_0x01cc('0x4'));var BPromise=require('bluebird');var rp=require(_0x01cc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x01cc('0x6'));var attributes=require(_0x01cc('0x7'));module[_0x01cc('0x8')]=function(_0xc9f9c0,_0x134466){return _0xc9f9c0[_0x01cc('0x9')](_0x01cc('0xa'),attributes,{'tableName':_0x01cc('0xb'),'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 5afbce2..641fd67 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 _0x41d9=['client','http','request','then','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticFieldReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x41d9,0x85));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x941d('0x0'));var util=require(_0x941d('0x1'));var moment=require(_0x941d('0x2'));var BPromise=require(_0x941d('0x3'));var rs=require(_0x941d('0x4'));var fs=require('fs');var Redis=require(_0x941d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x941d('0x6'));var logger=require(_0x941d('0x7'))(_0x941d('0x8'));var config=require(_0x941d('0x9'));var jayson=require(_0x941d('0xa'));var client=jayson[_0x941d('0xb')][_0x941d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1c844e,_0xcf6226,_0x287bf0){return new BPromise(function(_0x5a5fdc,_0xf114d1){return client[_0x941d('0xd')](_0x1c844e,_0x287bf0)[_0x941d('0xe')](function(_0x501aa1){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0xcf6226,_0x941d('0xf'));logger[_0x941d('0x10')](_0x941d('0x11'),_0xcf6226,_0x941d('0xf'),JSON[_0x941d('0x12')](_0x501aa1));if(_0x501aa1[_0x941d('0x13')]){if(_0x501aa1[_0x941d('0x13')]['code']===0x1f4){logger['error'](_0x941d('0x14'),_0xcf6226,_0x501aa1[_0x941d('0x13')]['message']);return _0xf114d1(_0x501aa1[_0x941d('0x13')][_0x941d('0x15')]);}logger[_0x941d('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0xcf6226,_0x501aa1['error'][_0x941d('0x15')]);return _0x5a5fdc(_0x501aa1[_0x941d('0x13')][_0x941d('0x15')]);}else{logger[_0x941d('0x16')](_0x941d('0x14'),_0xcf6226,_0x941d('0xf'));_0x5a5fdc(_0x501aa1['result'][_0x941d('0x15')]);}})[_0x941d('0x17')](function(_0x171415){logger[_0x941d('0x13')](_0x941d('0x14'),_0xcf6226,_0x171415);_0xf114d1(_0x171415);});});} \ No newline at end of file +var _0x2077=['code','message','info','result','lodash','util','moment','bluebird','randomstring','../../config/environment','jayson/promise','client','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x287ab7,_0x5f2d08){var _0x13c959=function(_0x44a45c){while(--_0x44a45c){_0x287ab7['push'](_0x287ab7['shift']());}};_0x13c959(++_0x5f2d08);}(_0x2077,0x180));var _0x7207=function(_0x93aa47,_0xaeb5f9){_0x93aa47=_0x93aa47-0x0;var _0x26d122=_0x2077[_0x93aa47];return _0x26d122;};'use strict';var _=require(_0x7207('0x0'));var util=require(_0x7207('0x1'));var moment=require(_0x7207('0x2'));var BPromise=require(_0x7207('0x3'));var rs=require(_0x7207('0x4'));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(_0x7207('0x5'));var jayson=require(_0x7207('0x6'));var client=jayson[_0x7207('0x7')][_0x7207('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a0d08,_0x5de24,_0x6ef448){return new BPromise(function(_0x358ce8,_0x4cb3d5){return client[_0x7207('0x9')](_0x4a0d08,_0x6ef448)[_0x7207('0xa')](function(_0x1d1615){logger['info'](_0x7207('0xb'),_0x5de24,'request\x20sent');logger[_0x7207('0xc')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x5de24,_0x7207('0xd'),JSON[_0x7207('0xe')](_0x1d1615));if(_0x1d1615[_0x7207('0xf')]){if(_0x1d1615[_0x7207('0xf')][_0x7207('0x10')]===0x1f4){logger[_0x7207('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5de24,_0x1d1615[_0x7207('0xf')][_0x7207('0x11')]);return _0x4cb3d5(_0x1d1615[_0x7207('0xf')][_0x7207('0x11')]);}logger[_0x7207('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5de24,_0x1d1615[_0x7207('0xf')][_0x7207('0x11')]);return _0x358ce8(_0x1d1615['error'][_0x7207('0x11')]);}else{logger[_0x7207('0x12')](_0x7207('0xb'),_0x5de24,_0x7207('0xd'));_0x358ce8(_0x1d1615[_0x7207('0x13')]['message']);}})['catch'](function(_0x5a39ec){logger[_0x7207('0xf')](_0x7207('0xb'),_0x5de24,_0x5a39ec);_0x4cb3d5(_0x5a39ec);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 4de0794..bc8e460 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x58da2e,_0x2534bc){var _0x8f64a4=function(_0x1507b9){while(--_0x1507b9){_0x58da2e['push'](_0x58da2e['shift']());}};_0x8f64a4(++_0x2534bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file +var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x5bbabd,_0x987538){var _0x103712=function(_0x35b6){while(--_0x35b6){_0x5bbabd['push'](_0x5bbabd['shift']());}};_0x103712(++_0x987538);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index f8f38e0..5b63997 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 _0x115a=['name','sequelize','exports','STRING'];(function(_0x2d2fd5,_0x22aa04){var _0x5cf67e=function(_0xc76975){while(--_0xc76975){_0x2d2fd5['push'](_0x2d2fd5['shift']());}};_0x5cf67e(++_0x22aa04);}(_0x115a,0x91));var _0xa115=function(_0x35e471,_0x3a9b8c){_0x35e471=_0x35e471-0x0;var _0x173c2c=_0x115a[_0x35e471];return _0x173c2c;};'use strict';var Sequelize=require(_0xa115('0x0'));module[_0xa115('0x1')]={'name':{'type':Sequelize[_0xa115('0x2')],'allowNull':![],'unique':_0xa115('0x3')},'table':{'type':Sequelize[_0xa115('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xa115('0x2')]}}; \ No newline at end of file +var _0x7b37=['STRING','sequelize','exports','name'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x7b37,0xd9));var _0x77b3=function(_0x4250b4,_0x3fd543){_0x4250b4=_0x4250b4-0x0;var _0x8a4807=_0x7b37[_0x4250b4];return _0x8a4807;};'use strict';var Sequelize=require(_0x77b3('0x0'));module[_0x77b3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x77b3('0x2')},'table':{'type':Sequelize[_0x77b3('0x3')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x77b3('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 616bb0c..62dc01a 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 _0x425d=['VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','where','merge'];(function(_0x450f77,_0x527146){var _0x366bc1=function(_0x1f2a68){while(--_0x1f2a68){_0x450f77['push'](_0x450f77['shift']());}};_0x366bc1(++_0x527146);}(_0x425d,0x1e0));var _0xd425=function(_0x236ce3,_0xb8d03f){_0x236ce3=_0x236ce3-0x0;var _0x4a3f88=_0x425d[_0x236ce3];return _0x4a3f88;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];function respondWithStatusCode(_0x9bb611,_0x3cacf7){_0x3cacf7=_0x3cacf7||0xcc;return function(_0x3b5de8){if(_0x3b5de8){return _0x9bb611[_0xd425('0x1d')](_0x3cacf7);}return _0x9bb611['status'](_0x3cacf7)[_0xd425('0x1e')]();};}function respondWithResult(_0x17a498,_0x336dc3){_0x336dc3=_0x336dc3||0xc8;return function(_0x5d3d60){if(_0x5d3d60){return _0x17a498[_0xd425('0x1f')](_0x336dc3)[_0xd425('0x20')](_0x5d3d60);}};}function respondWithFilteredResult(_0x643fd2,_0x41f34d){return function(_0x1fc822){if(_0x1fc822){var _0x538a0a=typeof _0x41f34d[_0xd425('0x21')]===_0xd425('0x22')&&typeof _0x41f34d[_0xd425('0x23')]===_0xd425('0x22');var _0x5d6585=_0x1fc822[_0xd425('0x24')];var _0x434d97=_0x538a0a?0x0:_0x41f34d[_0xd425('0x21')];var _0x1155bc=_0x538a0a?_0x1fc822['count']:_0x41f34d['offset']+_0x41f34d['limit'];var _0x4b293a;if(_0x1155bc>=_0x5d6585){_0x1155bc=_0x5d6585;_0x4b293a=0xc8;}else{_0x4b293a=0xce;}_0x643fd2[_0xd425('0x1f')](_0x4b293a);return _0x643fd2[_0xd425('0x25')](_0xd425('0x26'),_0x434d97+'-'+_0x1155bc+'/'+_0x5d6585)['json'](_0x1fc822);}return null;};}function patchUpdates(_0x355af0){return function(_0x7e982e){try{jsonpatch['apply'](_0x7e982e,_0x355af0,!![]);}catch(_0x2e1ec4){return BPromise[_0xd425('0x27')](_0x2e1ec4);}return _0x7e982e[_0xd425('0x28')]();};}function saveUpdates(_0x1d3fc0,_0x3e93db){return function(_0xb240c4){if(_0xb240c4){return _0xb240c4[_0xd425('0x29')](_0x1d3fc0)[_0xd425('0x2a')](function(_0x314201){return _0x314201;});}return null;};}function removeEntity(_0x2b030b,_0x151ad9){return function(_0x40e84b){if(_0x40e84b){return _0x40e84b['destroy']()[_0xd425('0x2a')](function(){var _0x264b0e=_0x40e84b[_0xd425('0x2b')]({'plain':!![]});var _0x1908a5=_0xd425('0x2c');return db[_0xd425('0x2d')][_0xd425('0x2e')]({'where':{'type':_0x1908a5,'resourceId':_0x264b0e['id']}})['then'](function(){return _0x40e84b;});})[_0xd425('0x2a')](function(){_0x2b030b[_0xd425('0x1f')](0xcc)[_0xd425('0x1e')]();});}};}function handleEntityNotFound(_0x57c950,_0x27ef8a){return function(_0x3ad9bd){if(!_0x3ad9bd){_0x57c950[_0xd425('0x1d')](0x194);}return _0x3ad9bd;};}function handleError(_0x999fb9,_0x27d29a){_0x27d29a=_0x27d29a||0x1f4;return function(_0x185d7e){logger[_0xd425('0x2f')](_0x185d7e[_0xd425('0x30')]);if(_0x185d7e[_0xd425('0x31')]){delete _0x185d7e[_0xd425('0x31')];}_0x999fb9['status'](_0x27d29a)[_0xd425('0x32')](_0x185d7e);};}exports[_0xd425('0x33')]=function(_0x298602,_0x3695dd){var _0x3275b1={},_0x1abf33={},_0x47405f={'count':0x0,'rows':[]};var _0x40c392=_[_0xd425('0x34')](db[_0xd425('0x35')][_0xd425('0x36')],function(_0x5f3dab){return{'name':_0x5f3dab[_0xd425('0x37')],'type':_0x5f3dab[_0xd425('0x38')][_0xd425('0x39')]};});_0x1abf33[_0xd425('0x3a')]=_[_0xd425('0x34')](_0x40c392,'name');_0x1abf33[_0xd425('0x3b')]=_[_0xd425('0x3c')](_0x298602['query']);_0x1abf33['filters']=_['intersection'](_0x1abf33[_0xd425('0x3a')],_0x1abf33[_0xd425('0x3b')]);_0x3275b1[_0xd425('0x3d')]=_[_0xd425('0x3e')](_0x1abf33['model'],qs[_0xd425('0x3f')](_0x298602[_0xd425('0x3b')][_0xd425('0x3f')]));_0x3275b1[_0xd425('0x3d')]=_0x3275b1[_0xd425('0x3d')][_0xd425('0x40')]?_0x3275b1[_0xd425('0x3d')]:_0x1abf33['model'];if(!_0x298602[_0xd425('0x3b')]['hasOwnProperty'](_0xd425('0x41'))){_0x3275b1[_0xd425('0x23')]=qs[_0xd425('0x23')](_0x298602['query'][_0xd425('0x23')]);_0x3275b1[_0xd425('0x21')]=qs[_0xd425('0x21')](_0x298602[_0xd425('0x3b')]['offset']);}_0x3275b1[_0xd425('0x42')]=qs[_0xd425('0x43')](_0x298602['query']['sort']);_0x3275b1['where']=qs[_0xd425('0x44')](_[_0xd425('0x45')](_0x298602[_0xd425('0x3b')],_0x1abf33['filters']),_0x40c392);if(_0x298602['query']['filter']){_0x3275b1[_0xd425('0x46')]=_[_0xd425('0x47')](_0x3275b1[_0xd425('0x46')],{'$or':_[_0xd425('0x34')](_0x40c392,function(_0xa9fd7c){if(_0xa9fd7c[_0xd425('0x38')]!==_0xd425('0x48')){var _0x4b922f={};_0x4b922f[_0xa9fd7c[_0xd425('0x31')]]={'$like':'%'+_0x298602[_0xd425('0x3b')][_0xd425('0x49')]+'%'};return _0x4b922f;}})});}_0x3275b1=_['merge']({},_0x3275b1,_0x298602[_0xd425('0x4a')]);var _0x2dffc7={'where':_0x3275b1[_0xd425('0x46')]};return db['AnalyticMetric'][_0xd425('0x24')](_0x2dffc7)[_0xd425('0x2a')](function(_0x1c5ba6){_0x47405f[_0xd425('0x24')]=_0x1c5ba6;if(_0x298602['query'][_0xd425('0x4b')]){_0x3275b1[_0xd425('0x4c')]=[{'all':!![]}];}return db[_0xd425('0x35')][_0xd425('0x4d')](_0x3275b1);})[_0xd425('0x2a')](function(_0x2f6bf7){_0x47405f[_0xd425('0x4e')]=_0x2f6bf7;return _0x47405f;})['then'](respondWithFilteredResult(_0x3695dd,_0x3275b1))[_0xd425('0x4f')](handleError(_0x3695dd,null));};exports[_0xd425('0x50')]=function(_0x5b65fe,_0x1a44a8){var _0x491c51={'raw':!![],'where':{'id':_0x5b65fe[_0xd425('0x51')]['id']}},_0x5e12bf={};_0x5e12bf['model']=_[_0xd425('0x3c')](db['AnalyticMetric'][_0xd425('0x36')]);_0x5e12bf[_0xd425('0x3b')]=_[_0xd425('0x3c')](_0x5b65fe[_0xd425('0x3b')]);_0x5e12bf[_0xd425('0x44')]=_['intersection'](_0x5e12bf[_0xd425('0x3a')],_0x5e12bf['query']);_0x491c51[_0xd425('0x3d')]=_['intersection'](_0x5e12bf[_0xd425('0x3a')],qs[_0xd425('0x3f')](_0x5b65fe[_0xd425('0x3b')][_0xd425('0x3f')]));_0x491c51[_0xd425('0x3d')]=_0x491c51['attributes'][_0xd425('0x40')]?_0x491c51[_0xd425('0x3d')]:_0x5e12bf[_0xd425('0x3a')];if(_0x5b65fe[_0xd425('0x3b')][_0xd425('0x4b')]){_0x491c51['include']=[{'all':!![]}];}_0x491c51=_[_0xd425('0x47')]({},_0x491c51,_0x5b65fe[_0xd425('0x4a')]);return db[_0xd425('0x35')][_0xd425('0x52')](_0x491c51)[_0xd425('0x2a')](handleEntityNotFound(_0x1a44a8,null))[_0xd425('0x2a')](respondWithResult(_0x1a44a8,null))['catch'](handleError(_0x1a44a8,null));};exports[_0xd425('0x53')]=function(_0x128cb3,_0x5bfac6){return db[_0xd425('0x35')][_0xd425('0x53')](_0x128cb3[_0xd425('0x54')],{})[_0xd425('0x2a')](function(_0x5c0219){var _0x54f1d=_0x128cb3[_0xd425('0x55')][_0xd425('0x2b')]({'plain':!![]});if(!_0x54f1d)throw new Error(_0xd425('0x56'));if(_0x54f1d[_0xd425('0x57')]==='user'){var _0x4be6fa=_0x5c0219[_0xd425('0x2b')]({'plain':!![]});var _0x5496d8=_0xd425('0x2c');return db[_0xd425('0x58')]['find']({'where':{'name':_0x5496d8,'userProfileId':_0x54f1d[_0xd425('0x59')]},'raw':!![]})['then'](function(_0x48d5b8){if(_0x48d5b8&&_0x48d5b8[_0xd425('0x5a')]===0x0){return db[_0xd425('0x2d')][_0xd425('0x53')]({'name':_0x4be6fa[_0xd425('0x31')],'resourceId':_0x4be6fa['id'],'type':_0x48d5b8[_0xd425('0x31')],'sectionId':_0x48d5b8['id']},{})[_0xd425('0x2a')](function(){return _0x5c0219;});}else{return _0x5c0219;}})[_0xd425('0x4f')](function(_0x4118fe){logger['error'](_0xd425('0x5b'),_0x4118fe);throw _0x4118fe;});}return _0x5c0219;})[_0xd425('0x2a')](respondWithResult(_0x5bfac6,0xc9))[_0xd425('0x4f')](handleError(_0x5bfac6,null));};exports[_0xd425('0x29')]=function(_0x7b1080,_0x1c80c2){if(_0x7b1080[_0xd425('0x54')]['id']){delete _0x7b1080[_0xd425('0x54')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0x7b1080['params']['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x1c80c2,null))[_0xd425('0x2a')](saveUpdates(_0x7b1080[_0xd425('0x54')],null))[_0xd425('0x2a')](respondWithResult(_0x1c80c2,null))['catch'](handleError(_0x1c80c2,null));};exports['destroy']=function(_0x499a60,_0x5e1294){return db[_0xd425('0x35')][_0xd425('0x52')]({'where':{'id':_0x499a60['params']['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x5e1294,null))[_0xd425('0x2a')](removeEntity(_0x5e1294,null))[_0xd425('0x4f')](handleError(_0x5e1294,null));}; \ No newline at end of file +var _0x00bb=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','json','undefined','limit','offset','apply','reject','update','destroy','get','Metrics','then','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','find'];(function(_0x250a85,_0x49f110){var _0x216492=function(_0x5866c6){while(--_0x5866c6){_0x250a85['push'](_0x250a85['shift']());}};_0x216492(++_0x49f110);}(_0x00bb,0x1d8));var _0xb00b=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x00bb[_0x491a7f];return _0x3d8f44;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){var _0x44efe5=_0x3ab3cc[_0xb00b('0x1f')]({'plain':!![]});var _0x3c9500=_0xb00b('0x20');return db['UserProfileResource']['destroy']({'where':{'type':_0x3c9500,'resourceId':_0x44efe5['id']}})[_0xb00b('0x21')](function(){return _0x3ab3cc;});})['then'](function(){_0x2896d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ac55,_0x73b6b0){return function(_0x2592cf){if(!_0x2592cf){_0x16ac55[_0xb00b('0x15')](0x194);}return _0x2592cf;};}function handleError(_0x1f14fa,_0x197379){_0x197379=_0x197379||0x1f4;return function(_0x15d3b9){logger['error'](_0x15d3b9[_0xb00b('0x22')]);if(_0x15d3b9['name']){delete _0x15d3b9[_0xb00b('0x23')];}_0x1f14fa[_0xb00b('0x16')](_0x197379)[_0xb00b('0x24')](_0x15d3b9);};}exports['index']=function(_0x2fc11a,_0x280ed3){var _0x16fbd5={},_0x183233={},_0x303625={'count':0x0,'rows':[]};var _0x2b9824=_[_0xb00b('0x25')](db[_0xb00b('0x26')][_0xb00b('0x27')],function(_0x54e247){return{'name':_0x54e247[_0xb00b('0x28')],'type':_0x54e247[_0xb00b('0x29')]['key']};});_0x183233[_0xb00b('0x2a')]=_[_0xb00b('0x25')](_0x2b9824,'name');_0x183233[_0xb00b('0x2b')]=_['keys'](_0x2fc11a[_0xb00b('0x2b')]);_0x183233[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x183233[_0xb00b('0x2a')],_0x183233[_0xb00b('0x2b')]);_0x16fbd5[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x183233['model'],qs['fields'](_0x2fc11a['query'][_0xb00b('0x2f')]));_0x16fbd5[_0xb00b('0x2e')]=_0x16fbd5[_0xb00b('0x2e')][_0xb00b('0x30')]?_0x16fbd5['attributes']:_0x183233[_0xb00b('0x2a')];if(!_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x16fbd5[_0xb00b('0x19')]=qs[_0xb00b('0x19')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x16fbd5['offset']=qs['offset'](_0x2fc11a[_0xb00b('0x2b')]['offset']);}_0x16fbd5[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x34')]);_0x16fbd5[_0xb00b('0x35')]=qs[_0xb00b('0x2c')](_[_0xb00b('0x36')](_0x2fc11a['query'],_0x183233[_0xb00b('0x2c')]),_0x2b9824);if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x16fbd5[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x16fbd5[_0xb00b('0x35')],{'$or':_['map'](_0x2b9824,function(_0x36980a){if(_0x36980a[_0xb00b('0x29')]!=='VIRTUAL'){var _0x17ff34={};_0x17ff34[_0x36980a[_0xb00b('0x23')]]={'$like':'%'+_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]+'%'};return _0x17ff34;}})});}_0x16fbd5=_[_0xb00b('0x38')]({},_0x16fbd5,_0x2fc11a['options']);var _0x14ff6a={'where':_0x16fbd5[_0xb00b('0x35')]};return db[_0xb00b('0x26')][_0xb00b('0x39')](_0x14ff6a)['then'](function(_0x4867fe){_0x303625[_0xb00b('0x39')]=_0x4867fe;if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x16fbd5[_0xb00b('0x3b')]=[{'all':!![]}];}return db[_0xb00b('0x26')][_0xb00b('0x3c')](_0x16fbd5);})[_0xb00b('0x21')](function(_0x493841){_0x303625[_0xb00b('0x3d')]=_0x493841;return _0x303625;})[_0xb00b('0x21')](respondWithFilteredResult(_0x280ed3,_0x16fbd5))[_0xb00b('0x3e')](handleError(_0x280ed3,null));};exports[_0xb00b('0x3f')]=function(_0x302ded,_0x1dc4c5){var _0x2e3d83={'raw':!![],'where':{'id':_0x302ded[_0xb00b('0x40')]['id']}},_0x974a29={};_0x974a29[_0xb00b('0x2a')]=_[_0xb00b('0x41')](db[_0xb00b('0x26')]['rawAttributes']);_0x974a29[_0xb00b('0x2b')]=_[_0xb00b('0x41')](_0x302ded[_0xb00b('0x2b')]);_0x974a29[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],_0x974a29[_0xb00b('0x2b')]);_0x2e3d83[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],qs[_0xb00b('0x2f')](_0x302ded[_0xb00b('0x2b')]['fields']));_0x2e3d83['attributes']=_0x2e3d83['attributes'][_0xb00b('0x30')]?_0x2e3d83[_0xb00b('0x2e')]:_0x974a29['model'];if(_0x302ded[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x2e3d83[_0xb00b('0x3b')]=[{'all':!![]}];}_0x2e3d83=_[_0xb00b('0x38')]({},_0x2e3d83,_0x302ded['options']);return db['AnalyticMetric'][_0xb00b('0x42')](_0x2e3d83)[_0xb00b('0x21')](handleEntityNotFound(_0x1dc4c5,null))['then'](respondWithResult(_0x1dc4c5,null))['catch'](handleError(_0x1dc4c5,null));};exports[_0xb00b('0x43')]=function(_0x3a205d,_0x4e0be4){return db[_0xb00b('0x26')]['create'](_0x3a205d['body'],{})['then'](function(_0x465d90){var _0x481515=_0x3a205d[_0xb00b('0x44')][_0xb00b('0x1f')]({'plain':!![]});if(!_0x481515)throw new Error(_0xb00b('0x45'));if(_0x481515[_0xb00b('0x46')]===_0xb00b('0x44')){var _0xda60ca=_0x465d90['get']({'plain':!![]});var _0x5bd40c=_0xb00b('0x20');return db[_0xb00b('0x47')]['find']({'where':{'name':_0x5bd40c,'userProfileId':_0x481515[_0xb00b('0x48')]},'raw':!![]})[_0xb00b('0x21')](function(_0x57f6ab){if(_0x57f6ab&&_0x57f6ab[_0xb00b('0x49')]===0x0){return db[_0xb00b('0x4a')][_0xb00b('0x43')]({'name':_0xda60ca['name'],'resourceId':_0xda60ca['id'],'type':_0x57f6ab['name'],'sectionId':_0x57f6ab['id']},{})[_0xb00b('0x21')](function(){return _0x465d90;});}else{return _0x465d90;}})[_0xb00b('0x3e')](function(_0x12737d){logger[_0xb00b('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12737d);throw _0x12737d;});}return _0x465d90;})[_0xb00b('0x21')](respondWithResult(_0x4e0be4,0xc9))[_0xb00b('0x3e')](handleError(_0x4e0be4,null));};exports['update']=function(_0x4cd9fd,_0x160965){if(_0x4cd9fd['body']['id']){delete _0x4cd9fd[_0xb00b('0x4c')]['id'];}return db[_0xb00b('0x26')][_0xb00b('0x42')]({'where':{'id':_0x4cd9fd[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x160965,null))[_0xb00b('0x21')](saveUpdates(_0x4cd9fd['body'],null))[_0xb00b('0x21')](respondWithResult(_0x160965,null))['catch'](handleError(_0x160965,null));};exports[_0xb00b('0x1e')]=function(_0x98caa9,_0x4129ba){return db['AnalyticMetric'][_0xb00b('0x42')]({'where':{'id':_0x98caa9[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x4129ba,null))['then'](removeEntity(_0x4129ba,null))[_0xb00b('0x3e')](handleError(_0x4129ba,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index e80af64..c2f0728 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 _0x7da7=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','analytics_metrics','lodash'];(function(_0x2629e5,_0x43a306){var _0x2e38c9=function(_0x4abd93){while(--_0x4abd93){_0x2629e5['push'](_0x2629e5['shift']());}};_0x2e38c9(++_0x43a306);}(_0x7da7,0x10d));var _0x77da=function(_0x2c5340,_0x5c86e5){_0x2c5340=_0x2c5340-0x0;var _0x3c505e=_0x7da7[_0x2c5340];return _0x3c505e;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var logger=require(_0x77da('0x2'))('api');var moment=require('moment');var BPromise=require(_0x77da('0x3'));var rp=require(_0x77da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var attributes=require('./analyticMetric.attributes');module[_0x77da('0x7')]=function(_0xc54a12,_0x47da81){return _0xc54a12[_0x77da('0x8')]('AnalyticMetric',attributes,{'tableName':_0x77da('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5bd7=['analytics_metrics','util','../../config/logger','api','bluebird','path','rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0xf9b115,_0x499f75){var _0x2f3525=function(_0x6cec4a){while(--_0x6cec4a){_0xf9b115['push'](_0xf9b115['shift']());}};_0x2f3525(++_0x499f75);}(_0x5bd7,0x12a));var _0x75bd=function(_0x134019,_0x3a1963){_0x134019=_0x134019-0x0;var _0x1807e7=_0x5bd7[_0x134019];return _0x1807e7;};'use strict';var _=require('lodash');var util=require(_0x75bd('0x0'));var logger=require(_0x75bd('0x1'))(_0x75bd('0x2'));var moment=require('moment');var BPromise=require(_0x75bd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75bd('0x4'));var rimraf=require(_0x75bd('0x5'));var config=require('../../config/environment');var attributes=require(_0x75bd('0x6'));module[_0x75bd('0x7')]=function(_0x2aaa6a,_0x47c9c7){return _0x2aaa6a[_0x75bd('0x8')](_0x75bd('0x9'),attributes,{'tableName':_0x75bd('0xa'),'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 e42949e..7fce14d 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 _0x6de2=['error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xfbae8f,_0x1784a3){var _0x1348d3=function(_0x31d673){while(--_0x31d673){_0xfbae8f['push'](_0xfbae8f['shift']());}};_0x1348d3(++_0x1784a3);}(_0x6de2,0x154));var _0x26de=function(_0x4646f6,_0x5983d8){_0x4646f6=_0x4646f6-0x0;var _0x44c181=_0x6de2[_0x4646f6];return _0x44c181;};'use strict';var _=require(_0x26de('0x0'));var util=require(_0x26de('0x1'));var moment=require(_0x26de('0x2'));var BPromise=require('bluebird');var rs=require(_0x26de('0x3'));var fs=require('fs');var Redis=require(_0x26de('0x4'));var db=require(_0x26de('0x5'))['db'];var utils=require(_0x26de('0x6'));var logger=require(_0x26de('0x7'))(_0x26de('0x8'));var config=require('../../config/environment');var jayson=require(_0x26de('0x9'));var client=jayson['client'][_0x26de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d75cd,_0x2356ae,_0x2b99fb){return new BPromise(function(_0x1c788c,_0x404384){return client['request'](_0x1d75cd,_0x2b99fb)['then'](function(_0x308f64){logger[_0x26de('0xb')](_0x26de('0xc'),_0x2356ae,_0x26de('0xd'));logger[_0x26de('0xe')](_0x26de('0xf'),_0x2356ae,_0x26de('0xd'),JSON[_0x26de('0x10')](_0x308f64));if(_0x308f64[_0x26de('0x11')]){if(_0x308f64['error']['code']===0x1f4){logger[_0x26de('0x11')](_0x26de('0xc'),_0x2356ae,_0x308f64[_0x26de('0x11')][_0x26de('0x12')]);return _0x404384(_0x308f64[_0x26de('0x11')][_0x26de('0x12')]);}logger[_0x26de('0x11')](_0x26de('0xc'),_0x2356ae,_0x308f64['error'][_0x26de('0x12')]);return _0x1c788c(_0x308f64[_0x26de('0x11')]['message']);}else{logger[_0x26de('0xb')](_0x26de('0xc'),_0x2356ae,_0x26de('0xd'));_0x1c788c(_0x308f64[_0x26de('0x13')][_0x26de('0x12')]);}})[_0x26de('0x14')](function(_0x4e8787){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x2356ae,_0x4e8787);_0x404384(_0x4e8787);});});} \ No newline at end of file +var _0x33b3=['AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x555164,_0x13e97c){var _0x541861=function(_0x55d3c3){while(--_0x55d3c3){_0x555164['push'](_0x555164['shift']());}};_0x541861(++_0x13e97c);}(_0x33b3,0x154));var _0x333b=function(_0x5388e4,_0x5eb0ad){_0x5388e4=_0x5388e4-0x0;var _0x208b64=_0x33b3[_0x5388e4];return _0x208b64;};'use strict';var _=require(_0x333b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x333b('0x1'));var rs=require(_0x333b('0x2'));var fs=require('fs');var Redis=require(_0x333b('0x3'));var db=require(_0x333b('0x4'))['db'];var utils=require(_0x333b('0x5'));var logger=require(_0x333b('0x6'))(_0x333b('0x7'));var config=require(_0x333b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x333b('0x9')][_0x333b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x438890,_0x435a4b,_0x29efdb){return new BPromise(function(_0x48373b,_0x4c38c6){return client[_0x333b('0xb')](_0x438890,_0x29efdb)[_0x333b('0xc')](function(_0x3ff2e7){logger[_0x333b('0xd')](_0x333b('0xe'),_0x435a4b,_0x333b('0xf'));logger[_0x333b('0x10')](_0x333b('0x11'),_0x435a4b,_0x333b('0xf'),JSON['stringify'](_0x3ff2e7));if(_0x3ff2e7[_0x333b('0x12')]){if(_0x3ff2e7[_0x333b('0x12')][_0x333b('0x13')]===0x1f4){logger[_0x333b('0x12')](_0x333b('0xe'),_0x435a4b,_0x3ff2e7['error'][_0x333b('0x14')]);return _0x4c38c6(_0x3ff2e7[_0x333b('0x12')]['message']);}logger['error'](_0x333b('0xe'),_0x435a4b,_0x3ff2e7[_0x333b('0x12')][_0x333b('0x14')]);return _0x48373b(_0x3ff2e7['error'][_0x333b('0x14')]);}else{logger['info'](_0x333b('0xe'),_0x435a4b,_0x333b('0xf'));_0x48373b(_0x3ff2e7['result'][_0x333b('0x14')]);}})['catch'](function(_0x3af1ea){logger[_0x333b('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x435a4b,_0x3af1ea);_0x4c38c6(_0x3af1ea);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 905b8cd..cfe2c6b 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 _0x49fe=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x49fe,0x100));var _0xe49f=function(_0xbc245,_0xedee3){_0xbc245=_0xbc245-0x0;var _0x371e80=_0x49fe[_0xbc245];return _0x371e80;};'use strict';var multer=require(_0xe49f('0x0'));var util=require(_0xe49f('0x1'));var path=require(_0xe49f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe49f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe49f('0x4'));var interaction=require(_0xe49f('0x5'));var config=require(_0xe49f('0x6'));var controller=require(_0xe49f('0x7'));router['get']('/',auth[_0xe49f('0x8')](),controller[_0xe49f('0x9')]);router[_0xe49f('0xa')](_0xe49f('0xb'),auth['isAuthenticated'](),controller[_0xe49f('0xc')]);router[_0xe49f('0xd')]('/',auth[_0xe49f('0x8')](),controller[_0xe49f('0xe')]);router[_0xe49f('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe49f('0x10')]);router[_0xe49f('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xe49f('0x12')]);module[_0xe49f('0x13')]=router; \ No newline at end of file +var _0xfa45=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x111283,_0x58ddcb){var _0x1e5f06=function(_0x2b30a4){while(--_0x2b30a4){_0x111283['push'](_0x111283['shift']());}};_0x1e5f06(++_0x58ddcb);}(_0xfa45,0x11b));var _0x5fa4=function(_0x2ff24c,_0x92e17f){_0x2ff24c=_0x2ff24c-0x0;var _0x373ecd=_0xfa45[_0x2ff24c];return _0x373ecd;};'use strict';var multer=require(_0x5fa4('0x0'));var util=require(_0x5fa4('0x1'));var path=require(_0x5fa4('0x2'));var timeout=require(_0x5fa4('0x3'));var express=require(_0x5fa4('0x4'));var router=express[_0x5fa4('0x5')]();var fs_extra=require(_0x5fa4('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5fa4('0x7'));var config=require('../../config/environment');var controller=require(_0x5fa4('0x8'));router[_0x5fa4('0x9')]('/',auth[_0x5fa4('0xa')](),controller[_0x5fa4('0xb')]);router[_0x5fa4('0x9')](_0x5fa4('0xc'),auth[_0x5fa4('0xa')](),controller[_0x5fa4('0xd')]);router[_0x5fa4('0xe')]('/',auth[_0x5fa4('0xa')](),controller['create']);router[_0x5fa4('0xf')]('/:id',auth[_0x5fa4('0xa')](),controller[_0x5fa4('0x10')]);router[_0x5fa4('0x11')](_0x5fa4('0xc'),auth[_0x5fa4('0xa')](),controller[_0x5fa4('0x12')]);module[_0x5fa4('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index a86bbc4..a112de7 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 _0x510c=['sequelize','exports','TEXT'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x510c,0x117));var _0xc510=function(_0x50f83e,_0x55b44e){_0x50f83e=_0x50f83e-0x0;var _0x5b22a9=_0x510c[_0x50f83e];return _0x5b22a9;};'use strict';var Sequelize=require(_0xc510('0x0'));module[_0xc510('0x1')]={'tree':{'type':Sequelize[_0xc510('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xed55=['exports','TEXT','sequelize'];(function(_0x3e2e1c,_0x182117){var _0x4c9c90=function(_0x54221c){while(--_0x54221c){_0x3e2e1c['push'](_0x3e2e1c['shift']());}};_0x4c9c90(++_0x182117);}(_0xed55,0x161));var _0x5ed5=function(_0x3cb152,_0x57eb54){_0x3cb152=_0x3cb152-0x0;var _0x4f54c3=_0xed55[_0x3cb152];return _0x4f54c3;};'use strict';var Sequelize=require(_0x5ed5('0x0'));module[_0x5ed5('0x1')]={'tree':{'type':Sequelize[_0x5ed5('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 8752867..66de523 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 _0x644e=['index','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','keys','includeAll','AnalyticTreeReport','find','create','body','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send'];(function(_0x247992,_0x54ee9b){var _0x2cc17e=function(_0x5afe6b){while(--_0x5afe6b){_0x247992['push'](_0x247992['shift']());}};_0x2cc17e(++_0x54ee9b);}(_0x644e,0x109));var _0xe644=function(_0x2f3974,_0x3a6102){_0x2f3974=_0x2f3974-0x0;var _0x15edb7=_0x644e[_0x2f3974];return _0x15edb7;};'use strict';var emlformat=require(_0xe644('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe644('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe644('0x2'));var moment=require('moment');var BPromise=require(_0xe644('0x3'));var Mustache=require(_0xe644('0x4'));var util=require(_0xe644('0x5'));var path=require(_0xe644('0x6'));var sox=require(_0xe644('0x7'));var csv=require(_0xe644('0x8'));var ejs=require(_0xe644('0x9'));var fs=require('fs');var fs_extra=require(_0xe644('0xa'));var _=require(_0xe644('0xb'));var squel=require(_0xe644('0xc'));var crypto=require(_0xe644('0xd'));var jsforce=require(_0xe644('0xe'));var deskjs=require(_0xe644('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe644('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe644('0x11'));var hardwareService=require(_0xe644('0x12'));var logger=require(_0xe644('0x13'))(_0xe644('0x14'));var utils=require('../../config/utils');var config=require(_0xe644('0x15'));var licenseUtil=require(_0xe644('0x16'));var db=require(_0xe644('0x17'))['db'];function respondWithStatusCode(_0x18811c,_0x1cecf8){_0x1cecf8=_0x1cecf8||0xcc;return function(_0x3b3564){if(_0x3b3564){return _0x18811c[_0xe644('0x18')](_0x1cecf8);}return _0x18811c['status'](_0x1cecf8)[_0xe644('0x19')]();};}function respondWithResult(_0x568e23,_0xf23b29){_0xf23b29=_0xf23b29||0xc8;return function(_0x4dfb53){if(_0x4dfb53){return _0x568e23[_0xe644('0x1a')](_0xf23b29)['json'](_0x4dfb53);}};}function respondWithFilteredResult(_0x42e406,_0x5a7ab3){return function(_0x253aab){if(_0x253aab){var _0x557e80=typeof _0x5a7ab3[_0xe644('0x1b')]===_0xe644('0x1c')&&typeof _0x5a7ab3[_0xe644('0x1d')]===_0xe644('0x1c');var _0x4e3409=_0x253aab['count'];var _0x147059=_0x557e80?0x0:_0x5a7ab3['offset'];var _0x2ddc2b=_0x557e80?_0x253aab[_0xe644('0x1e')]:_0x5a7ab3[_0xe644('0x1b')]+_0x5a7ab3[_0xe644('0x1d')];var _0x29dd4b;if(_0x2ddc2b>=_0x4e3409){_0x2ddc2b=_0x4e3409;_0x29dd4b=0xc8;}else{_0x29dd4b=0xce;}_0x42e406[_0xe644('0x1a')](_0x29dd4b);return _0x42e406[_0xe644('0x1f')](_0xe644('0x20'),_0x147059+'-'+_0x2ddc2b+'/'+_0x4e3409)[_0xe644('0x21')](_0x253aab);}return null;};}function patchUpdates(_0x435474){return function(_0x10b6f6){try{jsonpatch[_0xe644('0x22')](_0x10b6f6,_0x435474,!![]);}catch(_0x4db352){return BPromise[_0xe644('0x23')](_0x4db352);}return _0x10b6f6[_0xe644('0x24')]();};}function saveUpdates(_0x3a138c,_0x17af34){return function(_0x37c28e){if(_0x37c28e){return _0x37c28e['update'](_0x3a138c)[_0xe644('0x25')](function(_0x4556b6){return _0x4556b6;});}return null;};}function removeEntity(_0x1ff48b,_0x5574dd){return function(_0x5d7124){if(_0x5d7124){return _0x5d7124[_0xe644('0x26')]()[_0xe644('0x25')](function(){_0x1ff48b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18427f,_0xc58464){return function(_0x2e6f16){if(!_0x2e6f16){_0x18427f[_0xe644('0x18')](0x194);}return _0x2e6f16;};}function handleError(_0x2a22af,_0x456e8a){_0x456e8a=_0x456e8a||0x1f4;return function(_0x3e745c){logger[_0xe644('0x27')](_0x3e745c[_0xe644('0x28')]);if(_0x3e745c[_0xe644('0x29')]){delete _0x3e745c[_0xe644('0x29')];}_0x2a22af[_0xe644('0x1a')](_0x456e8a)[_0xe644('0x2a')](_0x3e745c);};}exports[_0xe644('0x2b')]=function(_0x5ebeab,_0x110d3e){var _0x5ccd9f={},_0x4f358e={},_0x14f7d4={'count':0x0,'rows':[]};var _0x4b6ba6=_['map'](db['AnalyticTreeReport'][_0xe644('0x2c')],function(_0x10f81d){return{'name':_0x10f81d[_0xe644('0x2d')],'type':_0x10f81d[_0xe644('0x2e')][_0xe644('0x2f')]};});_0x4f358e['model']=_[_0xe644('0x30')](_0x4b6ba6,_0xe644('0x29'));_0x4f358e['query']=_['keys'](_0x5ebeab[_0xe644('0x31')]);_0x4f358e[_0xe644('0x32')]=_[_0xe644('0x33')](_0x4f358e['model'],_0x4f358e['query']);_0x5ccd9f[_0xe644('0x34')]=_[_0xe644('0x33')](_0x4f358e[_0xe644('0x35')],qs[_0xe644('0x36')](_0x5ebeab[_0xe644('0x31')][_0xe644('0x36')]));_0x5ccd9f['attributes']=_0x5ccd9f[_0xe644('0x34')][_0xe644('0x37')]?_0x5ccd9f[_0xe644('0x34')]:_0x4f358e[_0xe644('0x35')];if(!_0x5ebeab[_0xe644('0x31')][_0xe644('0x38')](_0xe644('0x39'))){_0x5ccd9f[_0xe644('0x1d')]=qs[_0xe644('0x1d')](_0x5ebeab['query'][_0xe644('0x1d')]);_0x5ccd9f[_0xe644('0x1b')]=qs[_0xe644('0x1b')](_0x5ebeab[_0xe644('0x31')][_0xe644('0x1b')]);}_0x5ccd9f[_0xe644('0x3a')]=qs[_0xe644('0x3b')](_0x5ebeab[_0xe644('0x31')]['sort']);_0x5ccd9f[_0xe644('0x3c')]=qs[_0xe644('0x32')](_[_0xe644('0x3d')](_0x5ebeab[_0xe644('0x31')],_0x4f358e[_0xe644('0x32')]),_0x4b6ba6);if(_0x5ebeab['query'][_0xe644('0x3e')]){_0x5ccd9f[_0xe644('0x3c')]=_[_0xe644('0x3f')](_0x5ccd9f['where'],{'$or':_[_0xe644('0x30')](_0x4b6ba6,function(_0x88d90e){if(_0x88d90e[_0xe644('0x2e')]!=='VIRTUAL'){var _0xa90d79={};_0xa90d79[_0x88d90e[_0xe644('0x29')]]={'$like':'%'+_0x5ebeab[_0xe644('0x31')][_0xe644('0x3e')]+'%'};return _0xa90d79;}})});}_0x5ccd9f=_[_0xe644('0x3f')]({},_0x5ccd9f,_0x5ebeab[_0xe644('0x40')]);var _0x26e71b={'where':_0x5ccd9f[_0xe644('0x3c')]};return db['AnalyticTreeReport'][_0xe644('0x1e')](_0x26e71b)[_0xe644('0x25')](function(_0x289423){_0x14f7d4['count']=_0x289423;if(_0x5ebeab[_0xe644('0x31')]['includeAll']){_0x5ccd9f[_0xe644('0x41')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xe644('0x42')](_0x5ccd9f);})[_0xe644('0x25')](function(_0x1c2755){_0x14f7d4[_0xe644('0x43')]=_0x1c2755;return _0x14f7d4;})[_0xe644('0x25')](respondWithFilteredResult(_0x110d3e,_0x5ccd9f))[_0xe644('0x44')](handleError(_0x110d3e,null));};exports[_0xe644('0x45')]=function(_0x1fe074,_0xd8a350){var _0x9ae7fb={'raw':!![],'where':{'id':_0x1fe074[_0xe644('0x46')]['id']}},_0x48f124={};_0x48f124[_0xe644('0x35')]=_['keys'](db['AnalyticTreeReport'][_0xe644('0x2c')]);_0x48f124[_0xe644('0x31')]=_[_0xe644('0x47')](_0x1fe074[_0xe644('0x31')]);_0x48f124[_0xe644('0x32')]=_[_0xe644('0x33')](_0x48f124[_0xe644('0x35')],_0x48f124[_0xe644('0x31')]);_0x9ae7fb['attributes']=_[_0xe644('0x33')](_0x48f124[_0xe644('0x35')],qs['fields'](_0x1fe074['query']['fields']));_0x9ae7fb['attributes']=_0x9ae7fb[_0xe644('0x34')]['length']?_0x9ae7fb[_0xe644('0x34')]:_0x48f124['model'];if(_0x1fe074[_0xe644('0x31')][_0xe644('0x48')]){_0x9ae7fb[_0xe644('0x41')]=[{'all':!![]}];}_0x9ae7fb=_[_0xe644('0x3f')]({},_0x9ae7fb,_0x1fe074[_0xe644('0x40')]);return db[_0xe644('0x49')][_0xe644('0x4a')](_0x9ae7fb)['then'](handleEntityNotFound(_0xd8a350,null))['then'](respondWithResult(_0xd8a350,null))[_0xe644('0x44')](handleError(_0xd8a350,null));};exports['create']=function(_0x4410f2,_0x1d5206){return db[_0xe644('0x49')][_0xe644('0x4b')](_0x4410f2['body'],{})[_0xe644('0x25')](respondWithResult(_0x1d5206,0xc9))['catch'](handleError(_0x1d5206,null));};exports['update']=function(_0x5e3f98,_0x1bf52c){if(_0x5e3f98['body']['id']){delete _0x5e3f98[_0xe644('0x4c')]['id'];}return db['AnalyticTreeReport'][_0xe644('0x4a')]({'where':{'id':_0x5e3f98[_0xe644('0x46')]['id']}})['then'](handleEntityNotFound(_0x1bf52c,null))[_0xe644('0x25')](saveUpdates(_0x5e3f98['body'],null))[_0xe644('0x25')](respondWithResult(_0x1bf52c,null))[_0xe644('0x44')](handleError(_0x1bf52c,null));};exports[_0xe644('0x26')]=function(_0x2a5946,_0x33b54b){return db[_0xe644('0x49')][_0xe644('0x4a')]({'where':{'id':_0x2a5946['params']['id']}})[_0xe644('0x25')](handleEntityNotFound(_0x33b54b,null))[_0xe644('0x25')](removeEntity(_0x33b54b,null))[_0xe644('0x44')](handleError(_0x33b54b,null));}; \ No newline at end of file +var _0x71f6=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','end','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','find','create','body','params','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x39dd10,_0x134622){var _0x35bd8a=function(_0x156710){while(--_0x156710){_0x39dd10['push'](_0x39dd10['shift']());}};_0x35bd8a(++_0x134622);}(_0x71f6,0x1c9));var _0x671f=function(_0xfb09e6,_0x4f3696){_0xfb09e6=_0xfb09e6-0x0;var _0x3fe899=_0x71f6[_0xfb09e6];return _0x3fe899;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x671f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x671f('0x1'));var rp=require(_0x671f('0x2'));var moment=require(_0x671f('0x3'));var BPromise=require(_0x671f('0x4'));var Mustache=require('mustache');var util=require(_0x671f('0x5'));var path=require(_0x671f('0x6'));var sox=require(_0x671f('0x7'));var csv=require(_0x671f('0x8'));var ejs=require(_0x671f('0x9'));var fs=require('fs');var fs_extra=require(_0x671f('0xa'));var _=require(_0x671f('0xb'));var squel=require(_0x671f('0xc'));var crypto=require(_0x671f('0xd'));var jsforce=require(_0x671f('0xe'));var deskjs=require(_0x671f('0xf'));var toCsv=require(_0x671f('0x8'));var querystring=require(_0x671f('0x10'));var Papa=require(_0x671f('0x11'));var Redis=require('ioredis');var authService=require(_0x671f('0x12'));var qs=require(_0x671f('0x13'));var as=require(_0x671f('0x14'));var hardwareService=require(_0x671f('0x15'));var logger=require(_0x671f('0x16'))(_0x671f('0x17'));var utils=require('../../config/utils');var config=require(_0x671f('0x18'));var licenseUtil=require(_0x671f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55fab9,_0x2cda75){_0x2cda75=_0x2cda75||0xcc;return function(_0x26e290){if(_0x26e290){return _0x55fab9[_0x671f('0x1a')](_0x2cda75);}return _0x55fab9[_0x671f('0x1b')](_0x2cda75)['end']();};}function respondWithResult(_0x3819a2,_0x84fd65){_0x84fd65=_0x84fd65||0xc8;return function(_0x12237c){if(_0x12237c){return _0x3819a2[_0x671f('0x1b')](_0x84fd65)['json'](_0x12237c);}};}function respondWithFilteredResult(_0x3f281b,_0x27792b){return function(_0x257bc6){if(_0x257bc6){var _0x5dd12b=typeof _0x27792b[_0x671f('0x1c')]===_0x671f('0x1d')&&typeof _0x27792b[_0x671f('0x1e')]===_0x671f('0x1d');var _0x4d4840=_0x257bc6[_0x671f('0x1f')];var _0x82caa3=_0x5dd12b?0x0:_0x27792b[_0x671f('0x1c')];var _0x3263ee=_0x5dd12b?_0x257bc6[_0x671f('0x1f')]:_0x27792b['offset']+_0x27792b[_0x671f('0x1e')];var _0x5d5c74;if(_0x3263ee>=_0x4d4840){_0x3263ee=_0x4d4840;_0x5d5c74=0xc8;}else{_0x5d5c74=0xce;}_0x3f281b['status'](_0x5d5c74);return _0x3f281b[_0x671f('0x20')](_0x671f('0x21'),_0x82caa3+'-'+_0x3263ee+'/'+_0x4d4840)[_0x671f('0x22')](_0x257bc6);}return null;};}function patchUpdates(_0x2054e5){return function(_0x4b1d6d){try{jsonpatch['apply'](_0x4b1d6d,_0x2054e5,!![]);}catch(_0x3a0e83){return BPromise[_0x671f('0x23')](_0x3a0e83);}return _0x4b1d6d[_0x671f('0x24')]();};}function saveUpdates(_0x11b3fe,_0x7e276d){return function(_0x2b5850){if(_0x2b5850){return _0x2b5850[_0x671f('0x25')](_0x11b3fe)['then'](function(_0x2892e4){return _0x2892e4;});}return null;};}function removeEntity(_0x25fa98,_0x40be48){return function(_0x4a0c48){if(_0x4a0c48){return _0x4a0c48[_0x671f('0x26')]()[_0x671f('0x27')](function(){_0x25fa98[_0x671f('0x1b')](0xcc)[_0x671f('0x28')]();});}};}function handleEntityNotFound(_0x9d968f,_0x4f0130){return function(_0x15960b){if(!_0x15960b){_0x9d968f[_0x671f('0x1a')](0x194);}return _0x15960b;};}function handleError(_0xdc83dc,_0x5d7a8d){_0x5d7a8d=_0x5d7a8d||0x1f4;return function(_0x2a41ba){logger[_0x671f('0x29')](_0x2a41ba[_0x671f('0x2a')]);if(_0x2a41ba[_0x671f('0x2b')]){delete _0x2a41ba[_0x671f('0x2b')];}_0xdc83dc['status'](_0x5d7a8d)[_0x671f('0x2c')](_0x2a41ba);};}exports[_0x671f('0x2d')]=function(_0x15d1cf,_0x113bbb){var _0x9d21a6={},_0x13110c={},_0x5e9b63={'count':0x0,'rows':[]};var _0x19158e=_[_0x671f('0x2e')](db[_0x671f('0x2f')][_0x671f('0x30')],function(_0x397e70){return{'name':_0x397e70[_0x671f('0x31')],'type':_0x397e70[_0x671f('0x32')]['key']};});_0x13110c[_0x671f('0x33')]=_[_0x671f('0x2e')](_0x19158e,'name');_0x13110c[_0x671f('0x34')]=_[_0x671f('0x35')](_0x15d1cf['query']);_0x13110c[_0x671f('0x36')]=_[_0x671f('0x37')](_0x13110c[_0x671f('0x33')],_0x13110c[_0x671f('0x34')]);_0x9d21a6[_0x671f('0x38')]=_[_0x671f('0x37')](_0x13110c[_0x671f('0x33')],qs[_0x671f('0x39')](_0x15d1cf['query']['fields']));_0x9d21a6[_0x671f('0x38')]=_0x9d21a6[_0x671f('0x38')][_0x671f('0x3a')]?_0x9d21a6[_0x671f('0x38')]:_0x13110c[_0x671f('0x33')];if(!_0x15d1cf[_0x671f('0x34')][_0x671f('0x3b')](_0x671f('0x3c'))){_0x9d21a6['limit']=qs[_0x671f('0x1e')](_0x15d1cf[_0x671f('0x34')][_0x671f('0x1e')]);_0x9d21a6[_0x671f('0x1c')]=qs[_0x671f('0x1c')](_0x15d1cf[_0x671f('0x34')][_0x671f('0x1c')]);}_0x9d21a6[_0x671f('0x3d')]=qs[_0x671f('0x3e')](_0x15d1cf['query'][_0x671f('0x3e')]);_0x9d21a6[_0x671f('0x3f')]=qs[_0x671f('0x36')](_[_0x671f('0x40')](_0x15d1cf[_0x671f('0x34')],_0x13110c[_0x671f('0x36')]),_0x19158e);if(_0x15d1cf[_0x671f('0x34')][_0x671f('0x41')]){_0x9d21a6['where']=_['merge'](_0x9d21a6[_0x671f('0x3f')],{'$or':_['map'](_0x19158e,function(_0x30e5e8){if(_0x30e5e8[_0x671f('0x32')]!==_0x671f('0x42')){var _0x3e3a54={};_0x3e3a54[_0x30e5e8[_0x671f('0x2b')]]={'$like':'%'+_0x15d1cf['query'][_0x671f('0x41')]+'%'};return _0x3e3a54;}})});}_0x9d21a6=_[_0x671f('0x43')]({},_0x9d21a6,_0x15d1cf[_0x671f('0x44')]);var _0x1ae61e={'where':_0x9d21a6[_0x671f('0x3f')]};return db[_0x671f('0x2f')][_0x671f('0x1f')](_0x1ae61e)['then'](function(_0x224c78){_0x5e9b63[_0x671f('0x1f')]=_0x224c78;if(_0x15d1cf['query'][_0x671f('0x45')]){_0x9d21a6[_0x671f('0x46')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x671f('0x47')](_0x9d21a6);})['then'](function(_0x2f8c8b){_0x5e9b63[_0x671f('0x48')]=_0x2f8c8b;return _0x5e9b63;})[_0x671f('0x27')](respondWithFilteredResult(_0x113bbb,_0x9d21a6))[_0x671f('0x49')](handleError(_0x113bbb,null));};exports['show']=function(_0x1676b4,_0x1e9c27){var _0x287332={'raw':!![],'where':{'id':_0x1676b4['params']['id']}},_0x501aa5={};_0x501aa5[_0x671f('0x33')]=_['keys'](db[_0x671f('0x2f')]['rawAttributes']);_0x501aa5[_0x671f('0x34')]=_['keys'](_0x1676b4[_0x671f('0x34')]);_0x501aa5[_0x671f('0x36')]=_[_0x671f('0x37')](_0x501aa5[_0x671f('0x33')],_0x501aa5[_0x671f('0x34')]);_0x287332[_0x671f('0x38')]=_[_0x671f('0x37')](_0x501aa5[_0x671f('0x33')],qs[_0x671f('0x39')](_0x1676b4[_0x671f('0x34')][_0x671f('0x39')]));_0x287332[_0x671f('0x38')]=_0x287332[_0x671f('0x38')]['length']?_0x287332[_0x671f('0x38')]:_0x501aa5[_0x671f('0x33')];if(_0x1676b4[_0x671f('0x34')][_0x671f('0x45')]){_0x287332['include']=[{'all':!![]}];}_0x287332=_[_0x671f('0x43')]({},_0x287332,_0x1676b4[_0x671f('0x44')]);return db[_0x671f('0x2f')][_0x671f('0x4a')](_0x287332)[_0x671f('0x27')](handleEntityNotFound(_0x1e9c27,null))[_0x671f('0x27')](respondWithResult(_0x1e9c27,null))[_0x671f('0x49')](handleError(_0x1e9c27,null));};exports['create']=function(_0x465db5,_0x55c0fb){return db[_0x671f('0x2f')][_0x671f('0x4b')](_0x465db5[_0x671f('0x4c')],{})[_0x671f('0x27')](respondWithResult(_0x55c0fb,0xc9))[_0x671f('0x49')](handleError(_0x55c0fb,null));};exports['update']=function(_0x4925d5,_0x5e718a){if(_0x4925d5['body']['id']){delete _0x4925d5[_0x671f('0x4c')]['id'];}return db[_0x671f('0x2f')][_0x671f('0x4a')]({'where':{'id':_0x4925d5[_0x671f('0x4d')]['id']}})[_0x671f('0x27')](handleEntityNotFound(_0x5e718a,null))['then'](saveUpdates(_0x4925d5[_0x671f('0x4c')],null))[_0x671f('0x27')](respondWithResult(_0x5e718a,null))['catch'](handleError(_0x5e718a,null));};exports[_0x671f('0x26')]=function(_0x5eb327,_0x31f3ef){return db[_0x671f('0x2f')][_0x671f('0x4a')]({'where':{'id':_0x5eb327[_0x671f('0x4d')]['id']}})[_0x671f('0x27')](handleEntityNotFound(_0x31f3ef,null))[_0x671f('0x27')](removeEntity(_0x31f3ef,null))[_0x671f('0x49')](handleError(_0x31f3ef,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 014fee9..4ad8786 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 _0xa3dc=['../../config/environment','define','analytics_report_trees','lodash','util','api','moment','request-promise','path'];(function(_0x115b95,_0xa1f8b9){var _0x460b3d=function(_0x510c02){while(--_0x510c02){_0x115b95['push'](_0x115b95['shift']());}};_0x460b3d(++_0xa1f8b9);}(_0xa3dc,0x1c5));var _0xca3d=function(_0xf76ac7,_0x2cc42f){_0xf76ac7=_0xf76ac7-0x0;var _0x479a15=_0xa3dc[_0xf76ac7];return _0x479a15;};'use strict';var _=require(_0xca3d('0x0'));var util=require(_0xca3d('0x1'));var logger=require('../../config/logger')(_0xca3d('0x2'));var moment=require(_0xca3d('0x3'));var BPromise=require('bluebird');var rp=require(_0xca3d('0x4'));var fs=require('fs');var path=require(_0xca3d('0x5'));var rimraf=require('rimraf');var config=require(_0xca3d('0x6'));var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x417da2,_0x4438e8){return _0x417da2[_0xca3d('0x7')]('AnalyticTreeReport',attributes,{'tableName':_0xca3d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84a6=['../../config/environment','./analyticTreeReport.attributes','exports','analytics_report_trees','../../config/logger','api','moment','path'];(function(_0x173488,_0x4b1b33){var _0x994dac=function(_0x53dfce){while(--_0x53dfce){_0x173488['push'](_0x173488['shift']());}};_0x994dac(++_0x4b1b33);}(_0x84a6,0x1ac));var _0x684a=function(_0x264755,_0x44b561){_0x264755=_0x264755-0x0;var _0x38db02=_0x84a6[_0x264755];return _0x38db02;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x684a('0x0'))(_0x684a('0x1'));var moment=require(_0x684a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x684a('0x3'));var rimraf=require('rimraf');var config=require(_0x684a('0x4'));var attributes=require(_0x684a('0x5'));module[_0x684a('0x6')]=function(_0x57b592,_0x22981f){return _0x57b592['define']('AnalyticTreeReport',attributes,{'tableName':_0x684a('0x7'),'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 cb4ffa0..5fd46de 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4acd65,_0x193e16){var _0x1e7c1d=function(_0x49ee80){while(--_0x49ee80){_0x4acd65['push'](_0x4acd65['shift']());}};_0x1e7c1d(++_0x193e16);}(_0xadb5,0xad));var _0x5adb=function(_0x3b38b8,_0x1c0d37){_0x3b38b8=_0x3b38b8-0x0;var _0x237892=_0xadb5[_0x3b38b8];return _0x237892;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x59ddfe,_0x486a4a){var _0x230651=function(_0x578125){while(--_0x578125){_0x59ddfe['push'](_0x59ddfe['shift']());}};_0x230651(++_0x486a4a);}(_0x1261,0x144));var _0x1126=function(_0x55d7b0,_0x2a82dc){_0x55d7b0=_0x55d7b0-0x0;var _0x2a376c=_0x1261[_0x55d7b0];return _0x2a376c;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 43c3d3d..9e787a0 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 _0x942a=['delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','create','update'];(function(_0x39e4ec,_0x22f473){var _0x17434f=function(_0x5dd15a){while(--_0x5dd15a){_0x39e4ec['push'](_0x39e4ec['shift']());}};_0x17434f(++_0x22f473);}(_0x942a,0x93));var _0xa942=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x942a[_0xdc37a1];return _0x99b4fe;};'use strict';var multer=require('multer');var util=require(_0xa942('0x0'));var path=require(_0xa942('0x1'));var timeout=require('connect-timeout');var express=require(_0xa942('0x2'));var router=express[_0xa942('0x3')]();var fs_extra=require(_0xa942('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa942('0x5'));var config=require(_0xa942('0x6'));var controller=require(_0xa942('0x7'));router[_0xa942('0x8')]('/',auth[_0xa942('0x9')](),controller['index']);router[_0xa942('0x8')](_0xa942('0xa'),auth[_0xa942('0x9')](),controller['show']);router['post']('/',auth[_0xa942('0x9')](),controller[_0xa942('0xb')]);router['put']('/:id',auth[_0xa942('0x9')](),controller[_0xa942('0xc')]);router[_0xa942('0xd')]('/:id',auth[_0xa942('0x9')](),controller[_0xa942('0xe')]);module[_0xa942('0xf')]=router; \ No newline at end of file +var _0x9ecd=['../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x47d707,_0x2a0a8d){var _0x5f1b64=function(_0x5718d9){while(--_0x5718d9){_0x47d707['push'](_0x47d707['shift']());}};_0x5f1b64(++_0x2a0a8d);}(_0x9ecd,0xe9));var _0xd9ec=function(_0x59f9ba,_0x52aed5){_0x59f9ba=_0x59f9ba-0x0;var _0x4909bc=_0x9ecd[_0x59f9ba];return _0x4909bc;};'use strict';var multer=require('multer');var util=require(_0xd9ec('0x0'));var path=require('path');var timeout=require(_0xd9ec('0x1'));var express=require(_0xd9ec('0x2'));var router=express[_0xd9ec('0x3')]();var fs_extra=require(_0xd9ec('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd9ec('0x5'));var controller=require(_0xd9ec('0x6'));router[_0xd9ec('0x7')]('/',auth[_0xd9ec('0x8')](),controller['index']);router[_0xd9ec('0x7')](_0xd9ec('0x9'),auth['isAuthenticated'](),controller[_0xd9ec('0xa')]);router[_0xd9ec('0xb')]('/',auth[_0xd9ec('0x8')](),controller[_0xd9ec('0xc')]);router[_0xd9ec('0xd')](_0xd9ec('0x9'),auth[_0xd9ec('0x8')](),controller[_0xd9ec('0xe')]);router[_0xd9ec('0xf')]('/:id',auth[_0xd9ec('0x8')](),controller['destroy']);module[_0xd9ec('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 622662a..e411f2a 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 _0xb18e=['STRING'];(function(_0x2caaef,_0x3c19ed){var _0xd011f8=function(_0x318656){while(--_0x318656){_0x2caaef['push'](_0x2caaef['shift']());}};_0xd011f8(++_0x3c19ed);}(_0xb18e,0x181));var _0xeb18=function(_0x216428,_0x5d20ea){_0x216428=_0x216428-0x0;var _0x313dd4=_0xb18e[_0x216428];return _0x313dd4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xeb18('0x0')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xeb18('0x0')]}}; \ No newline at end of file +var _0xb8ca=['exports','STRING','sequelize'];(function(_0x44686d,_0x5f0e88){var _0xb85e98=function(_0x2aa27d){while(--_0x2aa27d){_0x44686d['push'](_0x44686d['shift']());}};_0xb85e98(++_0x5f0e88);}(_0xb8ca,0x89));var _0xab8c=function(_0x37b3ee,_0x41d16d){_0x37b3ee=_0x37b3ee-0x0;var _0x40f96d=_0xb8ca[_0x37b3ee];return _0x40f96d;};'use strict';var Sequelize=require(_0xab8c('0x0'));module[_0xab8c('0x1')]={'name':{'type':Sequelize[_0xab8c('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xab8c('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 9d1b06b..ec2ec30 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 _0xc5aa=['fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','Attachment','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','omit','createdAt','body','updatedAt','create','catch','file','basename','filename','mimetype','download','findOne','join','root','server/files/attachments/','offline-chat/','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs'];(function(_0x2e7d4f,_0x49c0d3){var _0x40a232=function(_0x2f5d58){while(--_0x2f5d58){_0x2e7d4f['push'](_0x2e7d4f['shift']());}};_0x40a232(++_0x49c0d3);}(_0xc5aa,0x99));var _0xac5a=function(_0xa52048,_0x1a3dd6){_0xa52048=_0xa52048-0x0;var _0x19d95c=_0xc5aa[_0xa52048];return _0x19d95c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xac5a('0x0'));var jsonpatch=require(_0xac5a('0x1'));var rp=require(_0xac5a('0x2'));var moment=require('moment');var BPromise=require(_0xac5a('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xac5a('0x4'));var sox=require('sox');var csv=require(_0xac5a('0x5'));var ejs=require(_0xac5a('0x6'));var fs=require('fs');var fs_extra=require(_0xac5a('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xac5a('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xac5a('0x9'));var toCsv=require(_0xac5a('0x5'));var querystring=require(_0xac5a('0xa'));var Papa=require(_0xac5a('0xb'));var Redis=require(_0xac5a('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xac5a('0xd'));var as=require(_0xac5a('0xe'));var hardwareService=require(_0xac5a('0xf'));var logger=require(_0xac5a('0x10'))(_0xac5a('0x11'));var utils=require('../../config/utils');var config=require(_0xac5a('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bb17b,_0x2e708a){_0x2e708a=_0x2e708a||0xcc;return function(_0x1545bb){if(_0x1545bb){return _0x5bb17b[_0xac5a('0x13')](_0x2e708a);}return _0x5bb17b[_0xac5a('0x14')](_0x2e708a)[_0xac5a('0x15')]();};}function respondWithResult(_0x30bd00,_0x4ec6ee){_0x4ec6ee=_0x4ec6ee||0xc8;return function(_0x2e2b44){if(_0x2e2b44){return _0x30bd00[_0xac5a('0x14')](_0x4ec6ee)['json'](_0x2e2b44);}};}function respondWithFilteredResult(_0x5bbc3d,_0xc44db0){return function(_0x58dd00){if(_0x58dd00){var _0x36f1b6=typeof _0xc44db0[_0xac5a('0x16')]===_0xac5a('0x17')&&typeof _0xc44db0[_0xac5a('0x18')]===_0xac5a('0x17');var _0x402bd2=_0x58dd00[_0xac5a('0x19')];var _0x34b6d0=_0x36f1b6?0x0:_0xc44db0['offset'];var _0x25cf12=_0x36f1b6?_0x58dd00['count']:_0xc44db0[_0xac5a('0x16')]+_0xc44db0[_0xac5a('0x18')];var _0x1df6f4;if(_0x25cf12>=_0x402bd2){_0x25cf12=_0x402bd2;_0x1df6f4=0xc8;}else{_0x1df6f4=0xce;}_0x5bbc3d[_0xac5a('0x14')](_0x1df6f4);return _0x5bbc3d[_0xac5a('0x1a')](_0xac5a('0x1b'),_0x34b6d0+'-'+_0x25cf12+'/'+_0x402bd2)[_0xac5a('0x1c')](_0x58dd00);}return null;};}function patchUpdates(_0xf47965){return function(_0x14dc7e){try{jsonpatch[_0xac5a('0x1d')](_0x14dc7e,_0xf47965,!![]);}catch(_0x32962f){return BPromise[_0xac5a('0x1e')](_0x32962f);}return _0x14dc7e['save']();};}function saveUpdates(_0x4a98b2,_0x18b7a3){return function(_0x1ae317){if(_0x1ae317){return _0x1ae317[_0xac5a('0x1f')](_0x4a98b2)[_0xac5a('0x20')](function(_0x2035ad){return _0x2035ad;});}return null;};}function removeEntity(_0x2f38f2,_0x450dda){return function(_0xcae38a){if(_0xcae38a){return _0xcae38a[_0xac5a('0x21')]()['then'](function(){_0x2f38f2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20df06,_0x9dc886){return function(_0x1739aa){if(!_0x1739aa){_0x20df06[_0xac5a('0x13')](0x194);}return _0x1739aa;};}function handleError(_0x4dc9bf,_0x3554a8){_0x3554a8=_0x3554a8||0x1f4;return function(_0x4c77f4){logger['error'](_0x4c77f4[_0xac5a('0x22')]);if(_0x4c77f4['name']){delete _0x4c77f4[_0xac5a('0x23')];}_0x4dc9bf[_0xac5a('0x14')](_0x3554a8)[_0xac5a('0x24')](_0x4c77f4);};}exports['index']=function(_0x4e4792,_0x5a5470){var _0x45fda9={},_0x491415={},_0x2ee677={'count':0x0,'rows':[]};var _0x42075a=_['map'](db[_0xac5a('0x25')]['rawAttributes'],function(_0x11415d){return{'name':_0x11415d['fieldName'],'type':_0x11415d[_0xac5a('0x26')]['key']};});_0x491415[_0xac5a('0x27')]=_['map'](_0x42075a,_0xac5a('0x23'));_0x491415[_0xac5a('0x28')]=_[_0xac5a('0x29')](_0x4e4792['query']);_0x491415['filters']=_[_0xac5a('0x2a')](_0x491415[_0xac5a('0x27')],_0x491415[_0xac5a('0x28')]);_0x45fda9['attributes']=_[_0xac5a('0x2a')](_0x491415[_0xac5a('0x27')],qs[_0xac5a('0x2b')](_0x4e4792[_0xac5a('0x28')][_0xac5a('0x2b')]));_0x45fda9[_0xac5a('0x2c')]=_0x45fda9['attributes'][_0xac5a('0x2d')]?_0x45fda9[_0xac5a('0x2c')]:_0x491415[_0xac5a('0x27')];if(!_0x4e4792['query'][_0xac5a('0x2e')](_0xac5a('0x2f'))){_0x45fda9[_0xac5a('0x18')]=qs[_0xac5a('0x18')](_0x4e4792['query'][_0xac5a('0x18')]);_0x45fda9['offset']=qs[_0xac5a('0x16')](_0x4e4792[_0xac5a('0x28')][_0xac5a('0x16')]);}_0x45fda9[_0xac5a('0x30')]=qs[_0xac5a('0x31')](_0x4e4792['query'][_0xac5a('0x31')]);_0x45fda9[_0xac5a('0x32')]=qs[_0xac5a('0x33')](_[_0xac5a('0x34')](_0x4e4792['query'],_0x491415[_0xac5a('0x33')]),_0x42075a);if(_0x4e4792[_0xac5a('0x28')][_0xac5a('0x35')]){_0x45fda9[_0xac5a('0x32')]=_['merge'](_0x45fda9['where'],{'$or':_[_0xac5a('0x36')](_0x42075a,function(_0x493427){if(_0x493427[_0xac5a('0x26')]!==_0xac5a('0x37')){var _0x3ec8c9={};_0x3ec8c9[_0x493427['name']]={'$like':'%'+_0x4e4792[_0xac5a('0x28')]['filter']+'%'};return _0x3ec8c9;}})});}_0x45fda9=_[_0xac5a('0x38')]({},_0x45fda9,_0x4e4792[_0xac5a('0x39')]);var _0x16107d={'where':_0x45fda9['where']};return db[_0xac5a('0x25')][_0xac5a('0x19')](_0x16107d)[_0xac5a('0x20')](function(_0x4ab9f3){_0x2ee677[_0xac5a('0x19')]=_0x4ab9f3;if(_0x4e4792[_0xac5a('0x28')][_0xac5a('0x3a')]){_0x45fda9[_0xac5a('0x3b')]=[{'all':!![]}];}return db['Attachment'][_0xac5a('0x3c')](_0x45fda9);})[_0xac5a('0x20')](function(_0xa9e08b){_0x2ee677['rows']=_0xa9e08b;return _0x2ee677;})['then'](respondWithFilteredResult(_0x5a5470,_0x45fda9))['catch'](handleError(_0x5a5470,null));};exports[_0xac5a('0x3d')]=function(_0x3e78c7,_0x50c079){var _0x31e333={'raw':!![],'where':{'id':_0x3e78c7[_0xac5a('0x3e')]['id']}},_0x4f32bf={};_0x4f32bf['model']=_[_0xac5a('0x29')](db['Attachment']['rawAttributes']);_0x4f32bf[_0xac5a('0x28')]=_[_0xac5a('0x29')](_0x3e78c7[_0xac5a('0x28')]);_0x4f32bf['filters']=_[_0xac5a('0x2a')](_0x4f32bf[_0xac5a('0x27')],_0x4f32bf[_0xac5a('0x28')]);_0x31e333[_0xac5a('0x2c')]=_[_0xac5a('0x2a')](_0x4f32bf[_0xac5a('0x27')],qs[_0xac5a('0x2b')](_0x3e78c7[_0xac5a('0x28')][_0xac5a('0x2b')]));_0x31e333[_0xac5a('0x2c')]=_0x31e333['attributes'][_0xac5a('0x2d')]?_0x31e333[_0xac5a('0x2c')]:_0x4f32bf[_0xac5a('0x27')];if(_0x3e78c7['query'][_0xac5a('0x3a')]){_0x31e333[_0xac5a('0x3b')]=[{'all':!![]}];}_0x31e333=_[_0xac5a('0x38')]({},_0x31e333,_0x3e78c7['options']);return db[_0xac5a('0x25')][_0xac5a('0x3f')](_0x31e333)[_0xac5a('0x20')](handleEntityNotFound(_0x50c079,null))['then'](respondWithResult(_0x50c079,null))['catch'](handleError(_0x50c079,null));};exports['clone']=function(_0x70b4cc,_0x18524){var _0x318228={'where':{'id':_0x70b4cc['params']['id']}},_0x4c8399={};_0x4c8399[_0xac5a('0x27')]=_[_0xac5a('0x29')](db[_0xac5a('0x25')]['rawAttributes']);_0x318228['attributes']=_['intersection'](_0x4c8399[_0xac5a('0x27')],qs[_0xac5a('0x2b')](_0x70b4cc[_0xac5a('0x28')][_0xac5a('0x2b')]));_0x318228[_0xac5a('0x2c')]=_0x318228['attributes'][_0xac5a('0x2d')]?_0x318228['attributes']:_0x4c8399[_0xac5a('0x27')];if(_0x70b4cc[_0xac5a('0x28')][_0xac5a('0x3a')]){_0x318228[_0xac5a('0x3b')]=[{'all':!![]}];}_0x318228=_[_0xac5a('0x38')]({},_0x318228,_0x70b4cc['options']);return db[_0xac5a('0x25')][_0xac5a('0x3f')](_0x318228)[_0xac5a('0x20')](handleEntityNotFound(_0x18524,null))['then'](function(_0x15ae01){if(_0x15ae01){var _0x9b0e30=_0x15ae01['get']({'plain':!![]});_0x9b0e30=qs[_0xac5a('0x40')](_0x9b0e30,['id',_0xac5a('0x41'),'updatedAt']);_0x70b4cc[_0xac5a('0x42')]=_[_0xac5a('0x40')](_0x70b4cc[_0xac5a('0x42')],['id','createdAt',_0xac5a('0x43')]);return db[_0xac5a('0x25')][_0xac5a('0x44')](_['merge'](_0x9b0e30,_0x70b4cc[_0xac5a('0x42')]),{'include':_0x70b4cc[_0xac5a('0x28')][_0xac5a('0x3a')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x18524,0xc9))[_0xac5a('0x45')](handleError(_0x18524,null));};exports[_0xac5a('0x1f')]=function(_0x13f165,_0x254c95){if(_0x13f165[_0xac5a('0x42')]['id']){delete _0x13f165[_0xac5a('0x42')]['id'];}return db[_0xac5a('0x25')]['find']({'where':{'id':_0x13f165['params']['id']}})[_0xac5a('0x20')](handleEntityNotFound(_0x254c95,null))[_0xac5a('0x20')](saveUpdates(_0x13f165[_0xac5a('0x42')],null))['then'](respondWithResult(_0x254c95,null))['catch'](handleError(_0x254c95,null));};exports[_0xac5a('0x21')]=function(_0x2ad068,_0x489175){return db[_0xac5a('0x25')][_0xac5a('0x3f')]({'where':{'id':_0x2ad068[_0xac5a('0x3e')]['id']}})[_0xac5a('0x20')](handleEntityNotFound(_0x489175,null))[_0xac5a('0x20')](removeEntity(_0x489175,null))[_0xac5a('0x45')](handleError(_0x489175,null));};exports['create']=function(_0x860bf1,_0x554d6f,_0x518b11){_0x860bf1[_0xac5a('0x42')][_0xac5a('0x23')]=_0x860bf1[_0xac5a('0x46')]['originalname'];_0x860bf1['body'][_0xac5a('0x47')]=_0x860bf1[_0xac5a('0x46')][_0xac5a('0x48')];_0x860bf1[_0xac5a('0x42')][_0xac5a('0x26')]=_0x860bf1[_0xac5a('0x46')][_0xac5a('0x49')];return db[_0xac5a('0x25')]['create'](_0x860bf1[_0xac5a('0x42')])[_0xac5a('0x20')](respondWithResult(_0x554d6f,0xc9))[_0xac5a('0x45')](handleError(_0x554d6f,null));};exports[_0xac5a('0x4a')]=function(_0x517064,_0x1d119b,_0x8c6d09){return db[_0xac5a('0x25')][_0xac5a('0x4b')]({'where':{'id':_0x517064[_0xac5a('0x3e')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1d119b,null))[_0xac5a('0x20')](function(_0x63609a){if(_0x63609a){var _0x38b330=_0x63609a['ChatOfflineMessageId']!==null;var _0x39001b=path[_0xac5a('0x4c')](config[_0xac5a('0x4d')],_0xac5a('0x4e'));if(_0x38b330){_0x39001b=path[_0xac5a('0x4c')](_0x39001b,_0xac5a('0x4f'));}var _0x1c0dfb=path[_0xac5a('0x4c')](_0x39001b,_0x63609a[_0xac5a('0x47')]);return _0x1d119b[_0xac5a('0x4a')](_0x1c0dfb);}})[_0xac5a('0x45')](handleError(_0x1d119b,null));}; \ No newline at end of file +var _0x4cf1=['body','file','originalname','filename','mimetype','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','destroy','then','error','stack','name','send','index','map','Attachment','rawAttributes','model','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','get','omit','createdAt','updatedAt','create'];(function(_0x235c2d,_0x116b14){var _0x343c42=function(_0x46a52b){while(--_0x46a52b){_0x235c2d['push'](_0x235c2d['shift']());}};_0x343c42(++_0x116b14);}(_0x4cf1,0xbe));var _0x14cf=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0x4cf1[_0x5d1044];return _0x3cd90e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x14cf('0x0'));var jsonpatch=require(_0x14cf('0x1'));var rp=require(_0x14cf('0x2'));var moment=require(_0x14cf('0x3'));var BPromise=require(_0x14cf('0x4'));var Mustache=require(_0x14cf('0x5'));var util=require(_0x14cf('0x6'));var path=require(_0x14cf('0x7'));var sox=require(_0x14cf('0x8'));var csv=require(_0x14cf('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x14cf('0xa'));var _=require(_0x14cf('0xb'));var squel=require(_0x14cf('0xc'));var crypto=require(_0x14cf('0xd'));var jsforce=require(_0x14cf('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x14cf('0xf'));var Papa=require(_0x14cf('0x10'));var Redis=require(_0x14cf('0x11'));var authService=require(_0x14cf('0x12'));var qs=require(_0x14cf('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x14cf('0x14'));var logger=require(_0x14cf('0x15'))(_0x14cf('0x16'));var utils=require('../../config/utils');var config=require(_0x14cf('0x17'));var licenseUtil=require(_0x14cf('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28364a,_0x3d39b9){_0x3d39b9=_0x3d39b9||0xcc;return function(_0xdc2f6a){if(_0xdc2f6a){return _0x28364a[_0x14cf('0x19')](_0x3d39b9);}return _0x28364a[_0x14cf('0x1a')](_0x3d39b9)[_0x14cf('0x1b')]();};}function respondWithResult(_0x520fc1,_0x2d5037){_0x2d5037=_0x2d5037||0xc8;return function(_0x953241){if(_0x953241){return _0x520fc1[_0x14cf('0x1a')](_0x2d5037)['json'](_0x953241);}};}function respondWithFilteredResult(_0x232187,_0x55d6d0){return function(_0x398090){if(_0x398090){var _0x2b3612=typeof _0x55d6d0[_0x14cf('0x1c')]===_0x14cf('0x1d')&&typeof _0x55d6d0['limit']===_0x14cf('0x1d');var _0xa6a523=_0x398090[_0x14cf('0x1e')];var _0x7ca15=_0x2b3612?0x0:_0x55d6d0[_0x14cf('0x1c')];var _0x243bc4=_0x2b3612?_0x398090[_0x14cf('0x1e')]:_0x55d6d0[_0x14cf('0x1c')]+_0x55d6d0[_0x14cf('0x1f')];var _0x3be873;if(_0x243bc4>=_0xa6a523){_0x243bc4=_0xa6a523;_0x3be873=0xc8;}else{_0x3be873=0xce;}_0x232187[_0x14cf('0x1a')](_0x3be873);return _0x232187[_0x14cf('0x20')](_0x14cf('0x21'),_0x7ca15+'-'+_0x243bc4+'/'+_0xa6a523)[_0x14cf('0x22')](_0x398090);}return null;};}function patchUpdates(_0x59f44a){return function(_0x512b12){try{jsonpatch[_0x14cf('0x23')](_0x512b12,_0x59f44a,!![]);}catch(_0x4c519e){return BPromise['reject'](_0x4c519e);}return _0x512b12[_0x14cf('0x24')]();};}function saveUpdates(_0x5ec1aa,_0x111959){return function(_0x64d1b5){if(_0x64d1b5){return _0x64d1b5['update'](_0x5ec1aa)['then'](function(_0x258a07){return _0x258a07;});}return null;};}function removeEntity(_0x16871f,_0x4338c3){return function(_0x56aa57){if(_0x56aa57){return _0x56aa57[_0x14cf('0x25')]()[_0x14cf('0x26')](function(){_0x16871f[_0x14cf('0x1a')](0xcc)[_0x14cf('0x1b')]();});}};}function handleEntityNotFound(_0x5c870d,_0x1bc9ed){return function(_0x1d371b){if(!_0x1d371b){_0x5c870d[_0x14cf('0x19')](0x194);}return _0x1d371b;};}function handleError(_0x1ffcac,_0x3e730a){_0x3e730a=_0x3e730a||0x1f4;return function(_0x1c6708){logger[_0x14cf('0x27')](_0x1c6708[_0x14cf('0x28')]);if(_0x1c6708[_0x14cf('0x29')]){delete _0x1c6708[_0x14cf('0x29')];}_0x1ffcac['status'](_0x3e730a)[_0x14cf('0x2a')](_0x1c6708);};}exports[_0x14cf('0x2b')]=function(_0x2174aa,_0x4290b5){var _0x139a2d={},_0x5251e4={},_0x47fa7d={'count':0x0,'rows':[]};var _0x5e1513=_[_0x14cf('0x2c')](db[_0x14cf('0x2d')][_0x14cf('0x2e')],function(_0x19ec8b){return{'name':_0x19ec8b['fieldName'],'type':_0x19ec8b['type']['key']};});_0x5251e4[_0x14cf('0x2f')]=_['map'](_0x5e1513,_0x14cf('0x29'));_0x5251e4[_0x14cf('0x30')]=_['keys'](_0x2174aa[_0x14cf('0x30')]);_0x5251e4[_0x14cf('0x31')]=_[_0x14cf('0x32')](_0x5251e4[_0x14cf('0x2f')],_0x5251e4[_0x14cf('0x30')]);_0x139a2d[_0x14cf('0x33')]=_[_0x14cf('0x32')](_0x5251e4[_0x14cf('0x2f')],qs['fields'](_0x2174aa['query'][_0x14cf('0x34')]));_0x139a2d['attributes']=_0x139a2d[_0x14cf('0x33')][_0x14cf('0x35')]?_0x139a2d[_0x14cf('0x33')]:_0x5251e4[_0x14cf('0x2f')];if(!_0x2174aa[_0x14cf('0x30')]['hasOwnProperty'](_0x14cf('0x36'))){_0x139a2d[_0x14cf('0x1f')]=qs['limit'](_0x2174aa[_0x14cf('0x30')][_0x14cf('0x1f')]);_0x139a2d[_0x14cf('0x1c')]=qs[_0x14cf('0x1c')](_0x2174aa[_0x14cf('0x30')][_0x14cf('0x1c')]);}_0x139a2d['order']=qs[_0x14cf('0x37')](_0x2174aa[_0x14cf('0x30')][_0x14cf('0x37')]);_0x139a2d['where']=qs[_0x14cf('0x31')](_[_0x14cf('0x38')](_0x2174aa[_0x14cf('0x30')],_0x5251e4[_0x14cf('0x31')]),_0x5e1513);if(_0x2174aa[_0x14cf('0x30')][_0x14cf('0x39')]){_0x139a2d[_0x14cf('0x3a')]=_['merge'](_0x139a2d[_0x14cf('0x3a')],{'$or':_[_0x14cf('0x2c')](_0x5e1513,function(_0x17d6c6){if(_0x17d6c6[_0x14cf('0x3b')]!==_0x14cf('0x3c')){var _0x17cbb3={};_0x17cbb3[_0x17d6c6[_0x14cf('0x29')]]={'$like':'%'+_0x2174aa[_0x14cf('0x30')]['filter']+'%'};return _0x17cbb3;}})});}_0x139a2d=_[_0x14cf('0x3d')]({},_0x139a2d,_0x2174aa[_0x14cf('0x3e')]);var _0x36f511={'where':_0x139a2d['where']};return db[_0x14cf('0x2d')]['count'](_0x36f511)[_0x14cf('0x26')](function(_0x2077cb){_0x47fa7d['count']=_0x2077cb;if(_0x2174aa[_0x14cf('0x30')][_0x14cf('0x3f')]){_0x139a2d[_0x14cf('0x40')]=[{'all':!![]}];}return db[_0x14cf('0x2d')][_0x14cf('0x41')](_0x139a2d);})['then'](function(_0x3eb917){_0x47fa7d[_0x14cf('0x42')]=_0x3eb917;return _0x47fa7d;})[_0x14cf('0x26')](respondWithFilteredResult(_0x4290b5,_0x139a2d))[_0x14cf('0x43')](handleError(_0x4290b5,null));};exports[_0x14cf('0x44')]=function(_0x4d61a8,_0x1cc476){var _0x2064a0={'raw':!![],'where':{'id':_0x4d61a8[_0x14cf('0x45')]['id']}},_0x589588={};_0x589588[_0x14cf('0x2f')]=_[_0x14cf('0x46')](db[_0x14cf('0x2d')][_0x14cf('0x2e')]);_0x589588[_0x14cf('0x30')]=_[_0x14cf('0x46')](_0x4d61a8[_0x14cf('0x30')]);_0x589588['filters']=_['intersection'](_0x589588[_0x14cf('0x2f')],_0x589588[_0x14cf('0x30')]);_0x2064a0[_0x14cf('0x33')]=_[_0x14cf('0x32')](_0x589588[_0x14cf('0x2f')],qs[_0x14cf('0x34')](_0x4d61a8[_0x14cf('0x30')][_0x14cf('0x34')]));_0x2064a0['attributes']=_0x2064a0[_0x14cf('0x33')]['length']?_0x2064a0[_0x14cf('0x33')]:_0x589588[_0x14cf('0x2f')];if(_0x4d61a8['query'][_0x14cf('0x3f')]){_0x2064a0[_0x14cf('0x40')]=[{'all':!![]}];}_0x2064a0=_[_0x14cf('0x3d')]({},_0x2064a0,_0x4d61a8['options']);return db[_0x14cf('0x2d')][_0x14cf('0x47')](_0x2064a0)[_0x14cf('0x26')](handleEntityNotFound(_0x1cc476,null))['then'](respondWithResult(_0x1cc476,null))[_0x14cf('0x43')](handleError(_0x1cc476,null));};exports['clone']=function(_0x2de760,_0x3beeea){var _0x11f703={'where':{'id':_0x2de760[_0x14cf('0x45')]['id']}},_0x3e44ee={};_0x3e44ee[_0x14cf('0x2f')]=_['keys'](db[_0x14cf('0x2d')][_0x14cf('0x2e')]);_0x11f703['attributes']=_[_0x14cf('0x32')](_0x3e44ee[_0x14cf('0x2f')],qs['fields'](_0x2de760[_0x14cf('0x30')][_0x14cf('0x34')]));_0x11f703[_0x14cf('0x33')]=_0x11f703[_0x14cf('0x33')][_0x14cf('0x35')]?_0x11f703[_0x14cf('0x33')]:_0x3e44ee[_0x14cf('0x2f')];if(_0x2de760['query']['includeAll']){_0x11f703['include']=[{'all':!![]}];}_0x11f703=_[_0x14cf('0x3d')]({},_0x11f703,_0x2de760[_0x14cf('0x3e')]);return db['Attachment'][_0x14cf('0x47')](_0x11f703)[_0x14cf('0x26')](handleEntityNotFound(_0x3beeea,null))[_0x14cf('0x26')](function(_0x1caa55){if(_0x1caa55){var _0x195f69=_0x1caa55[_0x14cf('0x48')]({'plain':!![]});_0x195f69=qs[_0x14cf('0x49')](_0x195f69,['id',_0x14cf('0x4a'),'updatedAt']);_0x2de760['body']=_['omit'](_0x2de760['body'],['id',_0x14cf('0x4a'),_0x14cf('0x4b')]);return db['Attachment'][_0x14cf('0x4c')](_['merge'](_0x195f69,_0x2de760['body']),{'include':_0x2de760[_0x14cf('0x30')][_0x14cf('0x3f')]?[{'all':!![]}]:undefined});}})[_0x14cf('0x26')](respondWithResult(_0x3beeea,0xc9))[_0x14cf('0x43')](handleError(_0x3beeea,null));};exports['update']=function(_0x3fae93,_0x3d982d){if(_0x3fae93[_0x14cf('0x4d')]['id']){delete _0x3fae93[_0x14cf('0x4d')]['id'];}return db[_0x14cf('0x2d')]['find']({'where':{'id':_0x3fae93[_0x14cf('0x45')]['id']}})[_0x14cf('0x26')](handleEntityNotFound(_0x3d982d,null))['then'](saveUpdates(_0x3fae93['body'],null))['then'](respondWithResult(_0x3d982d,null))[_0x14cf('0x43')](handleError(_0x3d982d,null));};exports[_0x14cf('0x25')]=function(_0x4f56f6,_0x28dc97){return db[_0x14cf('0x2d')][_0x14cf('0x47')]({'where':{'id':_0x4f56f6[_0x14cf('0x45')]['id']}})[_0x14cf('0x26')](handleEntityNotFound(_0x28dc97,null))[_0x14cf('0x26')](removeEntity(_0x28dc97,null))[_0x14cf('0x43')](handleError(_0x28dc97,null));};exports[_0x14cf('0x4c')]=function(_0x589de8,_0x4b80c5,_0x27e44f){_0x589de8['body'][_0x14cf('0x29')]=_0x589de8[_0x14cf('0x4e')][_0x14cf('0x4f')];_0x589de8[_0x14cf('0x4d')]['basename']=_0x589de8[_0x14cf('0x4e')][_0x14cf('0x50')];_0x589de8[_0x14cf('0x4d')]['type']=_0x589de8[_0x14cf('0x4e')][_0x14cf('0x51')];return db['Attachment'][_0x14cf('0x4c')](_0x589de8['body'])[_0x14cf('0x26')](respondWithResult(_0x4b80c5,0xc9))[_0x14cf('0x43')](handleError(_0x4b80c5,null));};exports['download']=function(_0x2942ea,_0x19c89d,_0x485cce){return db[_0x14cf('0x2d')][_0x14cf('0x52')]({'where':{'id':_0x2942ea[_0x14cf('0x45')]['id']},'raw':!![]})[_0x14cf('0x26')](handleEntityNotFound(_0x19c89d,null))[_0x14cf('0x26')](function(_0x20426d){if(_0x20426d){var _0x3deb91=_0x20426d[_0x14cf('0x53')]!==null;var _0x12fc27=path[_0x14cf('0x54')](config[_0x14cf('0x55')],_0x14cf('0x56'));if(_0x3deb91){_0x12fc27=path[_0x14cf('0x54')](_0x12fc27,_0x14cf('0x57'));}var _0x4955f0=path[_0x14cf('0x54')](_0x12fc27,_0x20426d['basename']);return _0x19c89d[_0x14cf('0x58')](_0x4955f0);}})[_0x14cf('0x43')](handleError(_0x19c89d,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 63850e4..f3317a5 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 _0xef65=['attachments','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','define'];(function(_0x24f673,_0x56b7cf){var _0xd18242=function(_0x275794){while(--_0x275794){_0x24f673['push'](_0x24f673['shift']());}};_0xd18242(++_0x56b7cf);}(_0xef65,0x85));var _0x5ef6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xef65[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5ef6('0x0'));var util=require(_0x5ef6('0x1'));var logger=require(_0x5ef6('0x2'))('api');var moment=require(_0x5ef6('0x3'));var BPromise=require(_0x5ef6('0x4'));var rp=require(_0x5ef6('0x5'));var fs=require('fs');var path=require(_0x5ef6('0x6'));var rimraf=require(_0x5ef6('0x7'));var config=require(_0x5ef6('0x8'));var attributes=require(_0x5ef6('0x9'));module['exports']=function(_0x562a70,_0x2e4c13){return _0x562a70[_0x5ef6('0xa')]('Attachment',attributes,{'tableName':_0x5ef6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82f0=['Attachment','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define'];(function(_0x1d8e83,_0x3a44be){var _0x30d861=function(_0xc4fd25){while(--_0xc4fd25){_0x1d8e83['push'](_0x1d8e83['shift']());}};_0x30d861(++_0x3a44be);}(_0x82f0,0x10b));var _0x082f=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x82f0[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x082f('0x0'));var util=require(_0x082f('0x1'));var logger=require(_0x082f('0x2'))(_0x082f('0x3'));var moment=require(_0x082f('0x4'));var BPromise=require(_0x082f('0x5'));var rp=require(_0x082f('0x6'));var fs=require('fs');var path=require(_0x082f('0x7'));var rimraf=require(_0x082f('0x8'));var config=require(_0x082f('0x9'));var attributes=require(_0x082f('0xa'));module[_0x082f('0xb')]=function(_0x424804,_0x190fc4){return _0x424804[_0x082f('0xc')](_0x082f('0xd'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 5cba154..c7e682c 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 _0x402f=['../../config/utils','rpc','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','message','error','CreateAttachment','Attachment','create','options','raw','catch','lodash','moment','ioredis','../../mysqldb'];(function(_0x2bd9d7,_0x1362b8){var _0x58e769=function(_0x17344f){while(--_0x17344f){_0x2bd9d7['push'](_0x2bd9d7['shift']());}};_0x58e769(++_0x1362b8);}(_0x402f,0x6f));var _0xf402=function(_0x183298,_0x4c8a3e){_0x183298=_0x183298-0x0;var _0xe6459d=_0x402f[_0x183298];return _0xe6459d;};'use strict';var _=require(_0xf402('0x0'));var util=require('util');var moment=require(_0xf402('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf402('0x2'));var db=require(_0xf402('0x3'))['db'];var utils=require(_0xf402('0x4'));var logger=require('../../config/logger')(_0xf402('0x5'));var config=require('../../config/environment');var jayson=require(_0xf402('0x6'));var client=jayson[_0xf402('0x7')][_0xf402('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a8774,_0xa1b27d,_0x55c515){return new BPromise(function(_0x4d1771,_0x2f0ffe){return client[_0xf402('0x9')](_0x2a8774,_0x55c515)[_0xf402('0xa')](function(_0xdc18e0){logger[_0xf402('0xb')](_0xf402('0xc'),_0xa1b27d,_0xf402('0xd'));logger[_0xf402('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0xa1b27d,_0xf402('0xd'),JSON['stringify'](_0xdc18e0));if(_0xdc18e0['error']){if(_0xdc18e0['error']['code']===0x1f4){logger['error'](_0xf402('0xc'),_0xa1b27d,_0xdc18e0['error']['message']);return _0x2f0ffe(_0xdc18e0['error'][_0xf402('0xf')]);}logger['error'](_0xf402('0xc'),_0xa1b27d,_0xdc18e0[_0xf402('0x10')][_0xf402('0xf')]);return _0x4d1771(_0xdc18e0[_0xf402('0x10')]['message']);}else{logger[_0xf402('0xb')]('Attachment,\x20%s,\x20%s',_0xa1b27d,_0xf402('0xd'));_0x4d1771(_0xdc18e0['result']['message']);}})['catch'](function(_0xb45d00){logger[_0xf402('0x10')](_0xf402('0xc'),_0xa1b27d,_0xb45d00);_0x2f0ffe(_0xb45d00);});});}exports[_0xf402('0x11')]=function(_0x2fbe36){var _0x5d7236=this;return new Promise(function(_0x3ed3eb,_0x151166){return db[_0xf402('0x12')][_0xf402('0x13')](_0x2fbe36['body'],{'raw':_0x2fbe36[_0xf402('0x14')]?_0x2fbe36[_0xf402('0x14')][_0xf402('0x15')]===undefined?!![]:![]:!![]})[_0xf402('0xa')](function(_0x3d3ed4){logger[_0xf402('0xb')](_0xf402('0x11'),_0x2fbe36);logger[_0xf402('0xe')](_0xf402('0x11'),_0x2fbe36,JSON['stringify'](_0x3d3ed4));_0x3ed3eb(_0x3d3ed4);})[_0xf402('0x16')](function(_0x4ffe46){logger[_0xf402('0x10')](_0xf402('0x11'),_0x4ffe46[_0xf402('0xf')],_0x2fbe36);_0x151166(_0x5d7236[_0xf402('0x10')](0x1f4,_0x4ffe46[_0xf402('0xf')]));});});}; \ No newline at end of file +var _0xf874=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','Attachment','create','body','options','raw','CreateAttachment','moment','bluebird','randomstring'];(function(_0x11273e,_0x3821a6){var _0x1e8616=function(_0x439d86){while(--_0x439d86){_0x11273e['push'](_0x11273e['shift']());}};_0x1e8616(++_0x3821a6);}(_0xf874,0xed));var _0x4f87=function(_0x5bdd43,_0x1ba582){_0x5bdd43=_0x5bdd43-0x0;var _0x2df923=_0xf874[_0x5bdd43];return _0x2df923;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4f87('0x0'));var BPromise=require(_0x4f87('0x1'));var rs=require(_0x4f87('0x2'));var fs=require('fs');var Redis=require(_0x4f87('0x3'));var db=require(_0x4f87('0x4'))['db'];var utils=require(_0x4f87('0x5'));var logger=require('../../config/logger')(_0x4f87('0x6'));var config=require(_0x4f87('0x7'));var jayson=require(_0x4f87('0x8'));var client=jayson[_0x4f87('0x9')][_0x4f87('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44fea6,_0x4a0662,_0x3a89e3){return new BPromise(function(_0x194853,_0x592008){return client[_0x4f87('0xb')](_0x44fea6,_0x3a89e3)[_0x4f87('0xc')](function(_0x4d8354){logger[_0x4f87('0xd')](_0x4f87('0xe'),_0x4a0662,_0x4f87('0xf'));logger[_0x4f87('0x10')](_0x4f87('0x11'),_0x4a0662,_0x4f87('0xf'),JSON[_0x4f87('0x12')](_0x4d8354));if(_0x4d8354['error']){if(_0x4d8354['error'][_0x4f87('0x13')]===0x1f4){logger[_0x4f87('0x14')](_0x4f87('0xe'),_0x4a0662,_0x4d8354['error']['message']);return _0x592008(_0x4d8354[_0x4f87('0x14')][_0x4f87('0x15')]);}logger[_0x4f87('0x14')]('Attachment,\x20%s,\x20%s',_0x4a0662,_0x4d8354[_0x4f87('0x14')]['message']);return _0x194853(_0x4d8354[_0x4f87('0x14')][_0x4f87('0x15')]);}else{logger['info'](_0x4f87('0xe'),_0x4a0662,_0x4f87('0xf'));_0x194853(_0x4d8354[_0x4f87('0x16')][_0x4f87('0x15')]);}})[_0x4f87('0x17')](function(_0x3bd90f){logger['error'](_0x4f87('0xe'),_0x4a0662,_0x3bd90f);_0x592008(_0x3bd90f);});});}exports['CreateAttachment']=function(_0x10551e){var _0x6a3017=this;return new Promise(function(_0x46492d,_0x42c399){return db[_0x4f87('0x18')][_0x4f87('0x19')](_0x10551e[_0x4f87('0x1a')],{'raw':_0x10551e[_0x4f87('0x1b')]?_0x10551e[_0x4f87('0x1b')][_0x4f87('0x1c')]===undefined?!![]:![]:!![]})[_0x4f87('0xc')](function(_0x2c13a0){logger[_0x4f87('0xd')]('CreateAttachment',_0x10551e);logger['debug'](_0x4f87('0x1d'),_0x10551e,JSON[_0x4f87('0x12')](_0x2c13a0));_0x46492d(_0x2c13a0);})['catch'](function(_0x592edd){logger[_0x4f87('0x14')]('CreateAttachment',_0x592edd['message'],_0x10551e);_0x42c399(_0x6a3017[_0x4f87('0x14')](0x1f4,_0x592edd[_0x4f87('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 8739dc8..b288c5e 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 _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0x0b0e[_0x243217];return _0x478029;};'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')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x4569f4,_0x30d93f){var _0x1421e5=function(_0x515aaa){while(--_0x515aaa){_0x4569f4['push'](_0x4569f4['shift']());}};_0x1421e5(++_0x30d93f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x584eed,_0x5ab3e8){_0x584eed=_0x584eed-0x0;var _0x112b46=_0x5f2f[_0x584eed];return _0x112b46;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index fb42d93..72257f8 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bcf=['activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory','undefined','url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','role','disabled','blocked','online','admin','agent','domain','blockedAt','getLicense','catch','send','message','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','ad-login','User','passport','passport-local','Strategy','moment'];(function(_0x4e8f87,_0x1542b2){var _0x224194=function(_0xb0c6c8){while(--_0xb0c6c8){_0x4e8f87['push'](_0x4e8f87['shift']());}};_0x224194(++_0x1542b2);}(_0x3bcf,0xdd));var _0xf3bc=function(_0x2ad5b0,_0x6db245){_0x2ad5b0=_0x2ad5b0-0x0;var _0x235edb=_0x3bcf[_0x2ad5b0];return _0x235edb;};'use strict';var passport=require(_0xf3bc('0x0'));var LocalStrategy=require(_0xf3bc('0x1'))[_0xf3bc('0x2')];var moment=require(_0xf3bc('0x3'));var ActiveDirectory=require(_0xf3bc('0x4'));var BPromise=require(_0xf3bc('0x5'));var util=require('util');var db=require(_0xf3bc('0x6'))['db'];var authService=require(_0xf3bc('0x7'));var utils=require(_0xf3bc('0x8'));var config=require(_0xf3bc('0x9'));var logger=require('../../config/logger')(_0xf3bc('0xa'));function isActiveDirectoryConfigured(_0x3456d0){var _0x37bae7=![];if(typeof _0x3456d0[_0xf3bc('0xb')]!==_0xf3bc('0xc')){_0x37bae7=_0x3456d0[_0xf3bc('0xb')]['baseDN']&&_0x3456d0[_0xf3bc('0xb')][_0xf3bc('0xd')]&&_0x3456d0[_0xf3bc('0xb')]['domain'];}return _0x37bae7;}function adAuthenticate(_0x2849f6,_0x180001,_0x33235d){return new BPromise(function(_0x4d74ec,_0x41b436){try{var _0x2a9c12=new ActiveDirectory(_0x2849f6);_0x2a9c12[_0xf3bc('0xe')](_0x180001,_0x33235d,function(_0x2c063f,_0x2916d5){if(_0x2c063f){logger[_0xf3bc('0xf')](_0xf3bc('0x10'),_0x180001,util['inspect'](_0x2c063f,{'showHidden':![],'depth':null}));_0x41b436(_0xf3bc('0x11'));}else if(!_0x2916d5){logger['error']('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x180001);_0x41b436(_0xf3bc('0x11'));}else{_0x4d74ec(_0x2916d5);}});}catch(_0x198604){_0x41b436(_0x198604);}});}function ActiveDirectoryAuthenticate(_0x4cb138,_0x424063,_0x33b2ac,_0x378eed){var _0x4cb6a0,_0x2cc991;if(!isActiveDirectoryConfigured(config)){logger[_0xf3bc('0xf')](_0xf3bc('0x12'),_0x424063);return _0x378eed(null,![],{'message':_0xf3bc('0x11')});}return db[_0xf3bc('0x13')][_0xf3bc('0x14')]({'where':{'id':0x1},'attributes':[_0xf3bc('0x15'),_0xf3bc('0x16')],'raw':!![]})[_0xf3bc('0x17')](function(_0x54e1f0){_0x4cb6a0=_0x54e1f0;if(!_0x4cb6a0[_0xf3bc('0x15')]){logger[_0xf3bc('0xf')](_0xf3bc('0x18'),_0x424063);throw new Error(_0xf3bc('0x11'));}return _0x4cb138[_0xf3bc('0x14')]({'attributes':['id',_0xf3bc('0x19'),'password',_0xf3bc('0x1a'),_0xf3bc('0x1b'),_0xf3bc('0x1c'),_0xf3bc('0x1d'),'blockedAt',_0xf3bc('0x1e')],'where':{'name':_0x424063,'role':{'$or':[_0xf3bc('0x1f'),'user',_0xf3bc('0x20')]},'adSsoEnabled':!![]}});})[_0xf3bc('0x17')](function(_0x30e210){if(!_0x30e210||_0x30e210&&_0x30e210['name']!==_0x424063){throw new Error(_0xf3bc('0x11'));}_0x2cc991=_0x30e210;var _0x1ab9c5=_0x2cc991['name']+'@'+config['activedirectory'][_0xf3bc('0x21')];return adAuthenticate(config[_0xf3bc('0xb')],_0x1ab9c5,_0x33b2ac);})[_0xf3bc('0x17')](function(_0x42ad8e){if(_0x2cc991['disabled']){throw new Error(_0xf3bc('0x11'));}if(_0x4cb6a0[_0xf3bc('0x16')]>0x0){if(_0x2cc991[_0xf3bc('0x1d')]){if(moment(_0x2cc991[_0xf3bc('0x22')])['add'](_0x4cb6a0[_0xf3bc('0x16')],'minutes')>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0x2cc991,0x0,![],null)[_0xf3bc('0x17')](function(){return utils['getLicense'](_0x2cc991);})[_0xf3bc('0x17')](function(){return _0x378eed(null,_0x2cc991);});}else{return utils[_0xf3bc('0x23')](_0x2cc991)[_0xf3bc('0x17')](function(){return _0x378eed(null,_0x2cc991);});}}else{return utils['getLicense'](_0x2cc991)[_0xf3bc('0x17')](function(){return _0x378eed(null,_0x2cc991);});}})[_0xf3bc('0x24')](function(_0x15559f){return _0x378eed(null,![],_0x15559f);});}function handleError(_0x2f3916,_0x4cf46d,_0x333f87){return _0x2f3916['status'](_0x4cf46d||0x1f4)[_0xf3bc('0x25')]({'message':_0x333f87?_0x333f87[_0xf3bc('0x26')]||_0x333f87:''});}exports['login']=function(_0x4f6476,_0x1e0007,_0x5ca363){passport['authenticate']('ad-login',function(_0x5220e3,_0x558f82,_0x3f3d5a){var _0x2e31a4=_0x5220e3||_0x3f3d5a;if(_0x2e31a4){return handleError(_0x1e0007,0x191,_0x2e31a4);}if(!_0x558f82){return handleError(_0x1e0007,0x194,{'message':_0xf3bc('0x27')});}else{var _0x288f18={'payload':{'id':_0x558f82['id'],'role':_0x558f82[_0xf3bc('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0xf3bc('0x28')](_0x288f18)[_0xf3bc('0x17')](function(_0x6c1033){_0x1e0007[_0xf3bc('0x29')]({'id':_0x558f82['id'],'token':_0x6c1033,'statusCall':'','isAlreadyLogged':_0x558f82['online']});});}})(_0x4f6476,_0x1e0007,_0x5ca363);};passport[_0xf3bc('0x2a')](_0xf3bc('0x2b'),new LocalStrategy({'usernameField':_0xf3bc('0x19'),'passwordField':'password'},function(_0x1a7738,_0x572a9b,_0x1811a4){return ActiveDirectoryAuthenticate(db[_0xf3bc('0x2c')],_0x1a7738,_0x572a9b,_0x1811a4);})); \ No newline at end of file +var _0x0bae=['undefined','activedirectory','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','role','disabled','blockedAt','agent','then','blockDuration','blocked','add','clearBlockUser','getLicense','catch','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','use','ad-login','User','passport','passport-local','Strategy','moment','activedirectory2','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api'];(function(_0x28e74e,_0x53fdf1){var _0xb45ac1=function(_0x311a7a){while(--_0x311a7a){_0x28e74e['push'](_0x28e74e['shift']());}};_0xb45ac1(++_0x53fdf1);}(_0x0bae,0x146));var _0xe0ba=function(_0x18e1bf,_0x2fbc81){_0x18e1bf=_0x18e1bf-0x0;var _0x4bd981=_0x0bae[_0x18e1bf];return _0x4bd981;};'use strict';var passport=require(_0xe0ba('0x0'));var LocalStrategy=require(_0xe0ba('0x1'))[_0xe0ba('0x2')];var moment=require(_0xe0ba('0x3'));var ActiveDirectory=require(_0xe0ba('0x4'));var BPromise=require('bluebird');var util=require('util');var db=require('../../mysqldb')['db'];var authService=require(_0xe0ba('0x5'));var utils=require(_0xe0ba('0x6'));var config=require(_0xe0ba('0x7'));var logger=require(_0xe0ba('0x8'))(_0xe0ba('0x9'));function isActiveDirectoryConfigured(_0x21ff6f){var _0x27e0d8=![];if(typeof _0x21ff6f['activedirectory']!==_0xe0ba('0xa')){_0x27e0d8=_0x21ff6f[_0xe0ba('0xb')][_0xe0ba('0xc')]&&_0x21ff6f[_0xe0ba('0xb')][_0xe0ba('0xd')]&&_0x21ff6f['activedirectory'][_0xe0ba('0xe')];}return _0x27e0d8;}function adAuthenticate(_0x2c9d7a,_0x48fb8e,_0x4538fd){return new BPromise(function(_0x8b5354,_0x3d8504){try{var _0x2d801b=new ActiveDirectory(_0x2c9d7a);_0x2d801b[_0xe0ba('0xf')](_0x48fb8e,_0x4538fd,function(_0x303911,_0x29167c){if(_0x303911){logger[_0xe0ba('0x10')](_0xe0ba('0x11'),_0x48fb8e,util['inspect'](_0x303911,{'showHidden':![],'depth':null}));_0x3d8504(_0xe0ba('0x12'));}else if(!_0x29167c){logger['error'](_0xe0ba('0x13'),_0x48fb8e);_0x3d8504(_0xe0ba('0x12'));}else{_0x8b5354(_0x29167c);}});}catch(_0x5c73fc){_0x3d8504(_0x5c73fc);}});}function ActiveDirectoryAuthenticate(_0x42a03c,_0x4f9f91,_0x1e2bf0,_0x1c4fef){var _0x54f21e,_0x3b019a;if(!isActiveDirectoryConfigured(config)){logger[_0xe0ba('0x10')](_0xe0ba('0x14'),_0x4f9f91);return _0x1c4fef(null,![],{'message':_0xe0ba('0x12')});}return db[_0xe0ba('0x15')][_0xe0ba('0x16')]({'where':{'id':0x1},'attributes':[_0xe0ba('0x17'),'blockDuration'],'raw':!![]})['then'](function(_0x26f5c3){_0x54f21e=_0x26f5c3;if(!_0x54f21e[_0xe0ba('0x17')]){logger[_0xe0ba('0x10')](_0xe0ba('0x18'),_0x4f9f91);throw new Error(_0xe0ba('0x12'));}return _0x42a03c[_0xe0ba('0x16')]({'attributes':['id',_0xe0ba('0x19'),_0xe0ba('0x1a'),'salt',_0xe0ba('0x1b'),_0xe0ba('0x1c'),'blocked',_0xe0ba('0x1d'),'online'],'where':{'name':_0x4f9f91,'role':{'$or':['admin','user',_0xe0ba('0x1e')]},'adSsoEnabled':!![]}});})['then'](function(_0x23efac){if(!_0x23efac||_0x23efac&&_0x23efac['name']!==_0x4f9f91){throw new Error(_0xe0ba('0x12'));}_0x3b019a=_0x23efac;var _0x1fe832=_0x3b019a[_0xe0ba('0x19')]+'@'+config[_0xe0ba('0xb')][_0xe0ba('0xe')];return adAuthenticate(config[_0xe0ba('0xb')],_0x1fe832,_0x1e2bf0);})[_0xe0ba('0x1f')](function(_0x152d6c){if(_0x3b019a[_0xe0ba('0x1c')]){throw new Error(_0xe0ba('0x12'));}if(_0x54f21e[_0xe0ba('0x20')]>0x0){if(_0x3b019a[_0xe0ba('0x21')]){if(moment(_0x3b019a[_0xe0ba('0x1d')])[_0xe0ba('0x22')](_0x54f21e['blockDuration'],'minutes')>moment()){throw new Error(_0xe0ba('0x12'));}return utils[_0xe0ba('0x23')](_0x3b019a,0x0,![],null)[_0xe0ba('0x1f')](function(){return utils[_0xe0ba('0x24')](_0x3b019a);})[_0xe0ba('0x1f')](function(){return _0x1c4fef(null,_0x3b019a);});}else{return utils[_0xe0ba('0x24')](_0x3b019a)[_0xe0ba('0x1f')](function(){return _0x1c4fef(null,_0x3b019a);});}}else{return utils[_0xe0ba('0x24')](_0x3b019a)[_0xe0ba('0x1f')](function(){return _0x1c4fef(null,_0x3b019a);});}})[_0xe0ba('0x25')](function(_0x53954f){return _0x1c4fef(null,![],_0x53954f);});}function handleError(_0x6d286a,_0x59fead,_0x5a2d2e){return _0x6d286a[_0xe0ba('0x26')](_0x59fead||0x1f4)[_0xe0ba('0x27')]({'message':_0x5a2d2e?_0x5a2d2e['message']||_0x5a2d2e:''});}exports[_0xe0ba('0x28')]=function(_0x507d57,_0x37d6ba,_0x3d5e62){passport[_0xe0ba('0xf')]('ad-login',function(_0x298fcd,_0x47576a,_0x2a9180){var _0x32cc58=_0x298fcd||_0x2a9180;if(_0x32cc58){return handleError(_0x37d6ba,0x191,_0x32cc58);}if(!_0x47576a){return handleError(_0x37d6ba,0x194,{'message':_0xe0ba('0x29')});}else{var _0x5cf830={'payload':{'id':_0x47576a['id'],'role':_0x47576a[_0xe0ba('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0xe0ba('0x2a')](_0x5cf830)[_0xe0ba('0x1f')](function(_0x1fb069){_0x37d6ba[_0xe0ba('0x2b')]({'id':_0x47576a['id'],'token':_0x1fb069,'statusCall':'','isAlreadyLogged':_0x47576a[_0xe0ba('0x2c')]});});}})(_0x507d57,_0x37d6ba,_0x3d5e62);};passport[_0xe0ba('0x2d')](_0xe0ba('0x2e'),new LocalStrategy({'usernameField':_0xe0ba('0x19'),'passwordField':_0xe0ba('0x1a')},function(_0x392837,_0x1ee0b1,_0x4ee26d){return ActiveDirectoryAuthenticate(db[_0xe0ba('0x2f')],_0x392837,_0x1ee0b1,_0x4ee26d);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index e6400d0..469c386 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9613=['express','Router','post'];(function(_0x4c6d3d,_0x39c470){var _0x578c1a=function(_0x235079){while(--_0x235079){_0x4c6d3d['push'](_0x4c6d3d['shift']());}};_0x578c1a(++_0x39c470);}(_0x9613,0x17d));var _0x3961=function(_0x3e62b4,_0xfc4b03){_0x3e62b4=_0x3e62b4-0x0;var _0x176711=_0x9613[_0x3e62b4];return _0x176711;};'use strict';var express=require(_0x3961('0x0'));var router=express[_0x3961('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0x3961('0x2')]('/',controller['login']);module['exports']=router; \ No newline at end of file +var _0x6c48=['Router','./authActiveDirectory.controller','exports','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c48,0x193));var _0x86c4=function(_0xce9f7b,_0x4e38f5){_0xce9f7b=_0xce9f7b-0x0;var _0x2379fd=_0x6c48[_0xce9f7b];return _0x2379fd;};'use strict';var express=require(_0x86c4('0x0'));var router=express[_0x86c4('0x1')]();var controller=require(_0x86c4('0x2'));router['post']('/',controller['login']);module[_0x86c4('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 56b469d..b8440fe 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 _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x7a54,0x106));var _0x47a5=function(_0x172095,_0x34ee25){_0x172095=_0x172095-0x0;var _0x2fb1aa=_0x7a54[_0x172095];return _0x2fb1aa;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x7a54,0x106));var _0x47a5=function(_0x4a5b3a,_0x3a1d9d){_0x4a5b3a=_0x4a5b3a-0x0;var _0x483e5c=_0x7a54[_0x4a5b3a];return _0x483e5c;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 5c4046d..5d6ee1a 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 _0x1f10=['/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','./authGoogle.controller','../user/user.controller.js','login'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x1f10,0x69));var _0x01f1=function(_0x1cfb84,_0x17ceb4){_0x1cfb84=_0x1cfb84-0x0;var _0xdee636=_0x1f10[_0x1cfb84];return _0xdee636;};'use strict';var express=require(_0x01f1('0x0'));var passport=require(_0x01f1('0x1'));var router=express['Router']();var controller=require(_0x01f1('0x2'));var userController=require(_0x01f1('0x3'));var authService=require('../../components/auth/service');router['get']('/',controller[_0x01f1('0x4')]);router['get'](_0x01f1('0x5'),controller[_0x01f1('0x6')],authService[_0x01f1('0x7')],userController['login'],authService[_0x01f1('0x8')]);module[_0x01f1('0x9')]=router; \ No newline at end of file +var _0xf78b=['isMiddleware','login','setTokenCookie','express','Router','./authGoogle.controller','get','/callback','callback'];(function(_0x4884bc,_0x315521){var _0xff9945=function(_0x59af0){while(--_0x59af0){_0x4884bc['push'](_0x4884bc['shift']());}};_0xff9945(++_0x315521);}(_0xf78b,0x78));var _0xbf78=function(_0x54edab,_0x49b7ad){_0x54edab=_0x54edab-0x0;var _0x35c7c9=_0xf78b[_0x54edab];return _0x35c7c9;};'use strict';var express=require(_0xbf78('0x0'));var passport=require('passport');var router=express[_0xbf78('0x1')]();var controller=require(_0xbf78('0x2'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0xbf78('0x3')]('/',controller['login']);router[_0xbf78('0x3')](_0xbf78('0x4'),controller[_0xbf78('0x5')],authService[_0xbf78('0x6')],userController[_0xbf78('0x7')],authService[_0xbf78('0x8')]);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 a523108..966835f 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 _0xb000=['Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','params','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','use','User','passport-local','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blockedAt','loginAttempts','admin','authenticate','blocked','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','SendMail','error','message','stringify','status','login','local-login'];(function(_0x38e024,_0x3615aa){var _0x1e0118=function(_0x172e68){while(--_0x172e68){_0x38e024['push'](_0x38e024['shift']());}};_0x1e0118(++_0x3615aa);}(_0xb000,0xbd));var _0x0b00=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0xb000[_0x5ac84c];return _0x3c53d2;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require(_0x0b00('0x0'))[_0x0b00('0x1')];var jayson=require(_0x0b00('0x2'));var _=require('lodash');var rs=require(_0x0b00('0x3'));var moment=require(_0x0b00('0x4'));var db=require(_0x0b00('0x5'))['db'];var authService=require(_0x0b00('0x6'));var utils=require(_0x0b00('0x7'));var client=jayson[_0x0b00('0x8')][_0x0b00('0x9')]({'port':0x232b});function localAuthenticate(_0x3d6de7,_0x3a9380,_0x33254b,_0x58472e){var _0x111e42,_0x4a4d4c;return db[_0x0b00('0xa')][_0x0b00('0xb')]({'where':{'id':0x1},'attributes':[_0x0b00('0xc'),_0x0b00('0xd')],'raw':!![]})[_0x0b00('0xe')](function(_0x5e1b6b){_0x111e42=_0x5e1b6b;return _0x3d6de7[_0x0b00('0xb')]({'attributes':['id',_0x0b00('0xf'),_0x0b00('0x10'),_0x0b00('0x11'),_0x0b00('0x12'),_0x0b00('0x13'),'blocked',_0x0b00('0x14'),_0x0b00('0x15')],'where':{'name':_0x3a9380,'role':{'$or':[_0x0b00('0x16'),'user','agent']}}});})[_0x0b00('0xe')](function(_0x2e56b8){if(!_0x2e56b8||_0x2e56b8&&_0x2e56b8['name']!==_0x3a9380){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x4a4d4c=_0x2e56b8;return _0x4a4d4c;}})[_0x0b00('0xe')](function(){_0x4a4d4c[_0x0b00('0x17')](_0x33254b,function(_0x397bd2,_0x54aaa1){var _0x16da93=_0x4a4d4c[_0x0b00('0x15')]+0x1;if(_0x397bd2){return _0x58472e(_0x397bd2);}else if(!_0x54aaa1){if(_0x4a4d4c['disabled']){return _0x58472e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x111e42['allowedLoginAttempts']>0x0){if(_0x4a4d4c[_0x0b00('0x18')]){if(_0x111e42[_0x0b00('0xd')]>0x0){if(moment(_0x4a4d4c[_0x0b00('0x14')])[_0x0b00('0x19')](_0x111e42[_0x0b00('0xd')],_0x0b00('0x1a'))>moment()){return _0x58472e(null,![],{'message':_0x0b00('0x1b')});}else{return utils[_0x0b00('0x1c')](_0x4a4d4c,_0x16da93,![],null)[_0x0b00('0xe')](function(){return _0x58472e(null,![],{'message':_0x0b00('0x1b')});});}}else{return _0x58472e(null,![],{'message':_0x0b00('0x1b')});}}else{if(_0x16da93>=_0x111e42[_0x0b00('0xc')]){return utils['clearBlockUser'](_0x4a4d4c,0x0,!![],moment())[_0x0b00('0xe')](function(){return _0x58472e(null,![],{'message':_0x0b00('0x1b')});});}else{return utils[_0x0b00('0x1c')](_0x4a4d4c,_0x16da93,![],null)[_0x0b00('0xe')](function(){return _0x58472e(null,![],{'message':_0x0b00('0x1b')});});}}}else{return _0x58472e(null,![],{'message':_0x0b00('0x1b')});}}else{if(_0x4a4d4c[_0x0b00('0x13')]){return _0x58472e(null,![],{'message':_0x0b00('0x1b')});}else if(_0x111e42[_0x0b00('0xc')]>0x0){if(_0x4a4d4c[_0x0b00('0x18')]){if(_0x111e42[_0x0b00('0xd')]>0x0){if(moment(_0x4a4d4c[_0x0b00('0x14')])['add'](_0x111e42[_0x0b00('0xd')],'minutes')>moment()){return _0x58472e(null,![],{'message':_0x0b00('0x1b')});}else{return utils['clearBlockUser'](_0x4a4d4c,0x0,![],null)[_0x0b00('0xe')](function(){return utils[_0x0b00('0x1d')](_0x4a4d4c);})[_0x0b00('0xe')](function(){return _0x58472e(null,_0x4a4d4c);});}}else{return _0x58472e(null,![],{'message':_0x0b00('0x1b')});}}else{return utils['clearBlockUser'](_0x4a4d4c,0x0,![],null)[_0x0b00('0xe')](function(){return utils[_0x0b00('0x1d')](_0x4a4d4c);})[_0x0b00('0xe')](function(){return _0x58472e(null,_0x4a4d4c);})[_0x0b00('0x1e')](function(_0x37e626){return _0x58472e(null,![],_0x37e626);});}}else{if(_0x4a4d4c['blocked']){return _0x58472e(null,![],{'message':_0x0b00('0x1b')});}else{return utils['getLicense'](_0x4a4d4c)['then'](function(){return _0x58472e(null,_0x4a4d4c);});}}}});})[_0x0b00('0x1e')](function(_0x3e9166){return _0x58472e(null,![],_0x3e9166);});}function sendServiceMail(_0x335bf2){return db[_0x0b00('0x1f')][_0x0b00('0x20')]({'where':{'service':!![]},'attributes':['id',_0x0b00('0xf'),_0x0b00('0x21')],'include':[{'model':db[_0x0b00('0x22')],'as':_0x0b00('0x23'),'include':[{'model':db[_0x0b00('0x24')],'as':_0x0b00('0x24')}]}]})[_0x0b00('0xe')](function(_0x59f702){if(!_0x59f702){throw new Error(_0x0b00('0x25'));}var _0xcd148b=_0x59f702['getSmtpOptions']();var _0x1beca7={'account':_0xcd148b,'message':_[_0x0b00('0x26')]({'from':util[_0x0b00('0x27')](_0x0b00('0x28'),_0x59f702[_0x0b00('0xf')],_0x59f702[_0x0b00('0x21')]||_0x59f702[_0x0b00('0x23')]['user'])},_0x335bf2)};return client['request'](_0x0b00('0x29'),_0x1beca7);})[_0x0b00('0xe')](function(_0x15cf61){if(_0x15cf61[_0x0b00('0x2a')]){throw new Error(util[_0x0b00('0x27')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x15cf61[_0x0b00('0x2a')][_0x0b00('0x2b')]||JSON[_0x0b00('0x2c')](_0x15cf61[_0x0b00('0x2a')])));}return!![];});}function handleError(_0x1b0863,_0x56351d,_0x1acdd1){return _0x1b0863[_0x0b00('0x2d')](_0x56351d||0x1f4)['send']({'message':_0x1acdd1?_0x1acdd1[_0x0b00('0x2b')]||_0x1acdd1:''});}exports[_0x0b00('0x2e')]=function(_0x57eca7,_0x4d4fe5,_0x564991){passport['authenticate'](_0x0b00('0x2f'),function(_0x136a57,_0x486552,_0x265e7a){var _0x27c997=_0x136a57||_0x265e7a;if(_0x27c997){return handleError(_0x4d4fe5,0x191,_0x27c997);}if(!_0x486552){return handleError(_0x4d4fe5,0x194,{'message':_0x0b00('0x30')});}else{var _0x451b03={'payload':{'id':_0x486552['id'],'role':_0x486552[_0x0b00('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0x0b00('0x31')](_0x451b03)[_0x0b00('0xe')](function(_0x23334d){_0x4d4fe5[_0x0b00('0x32')]({'id':_0x486552['id'],'token':_0x23334d,'statusCall':'','isAlreadyLogged':_0x486552[_0x0b00('0x33')]});});}})(_0x57eca7,_0x4d4fe5,_0x564991);};exports[_0x0b00('0x34')]=function(_0x32a107,_0x5966d6){if(!_0x32a107[_0x0b00('0x35')][_0x0b00('0x21')]){return handleError(_0x5966d6,0x1f4,{'message':_0x0b00('0x36')});}var _0xccf004=rs[_0x0b00('0x37')]();_0x32a107['body']['email']=_0x32a107[_0x0b00('0x35')][_0x0b00('0x21')][_0x0b00('0x38')]()[_0x0b00('0x39')]();var _0x4d4e7d;return db[_0x0b00('0xa')][_0x0b00('0xb')]({'where':{'id':0x1},'attributes':[_0x0b00('0xc'),_0x0b00('0xd')],'raw':!![]})[_0x0b00('0xe')](function(_0x396845){_0x4d4e7d=_0x396845;return db['User'][_0x0b00('0x20')]({'where':{'email':_0x32a107['body'][_0x0b00('0x21')]}});})['then'](function(_0x2aede6){if(!_0x2aede6){throw new Error(_0x0b00('0x3a'));}if(_0x2aede6[_0x0b00('0x13')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x2aede6[_0x0b00('0x18')]){if(moment(_0x2aede6['blockedAt'])[_0x0b00('0x19')](_0x4d4e7d['blockDuration'],_0x0b00('0x1a'))>moment()){throw new Error(_0x0b00('0x3b'));}else{_0x2aede6[_0x0b00('0x18')]=![];_0x2aede6['blockedAt']=null;}}_0x2aede6[_0x0b00('0x3c')]=_0xccf004;_0x2aede6[_0x0b00('0x3d')]=Date[_0x0b00('0x3e')]()+0x36ee80;return _0x2aede6[_0x0b00('0x3f')]();})[_0x0b00('0xe')](function(){return sendServiceMail({'to':_0x32a107[_0x0b00('0x35')][_0x0b00('0x21')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'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'+_0x0b00('0x40')+_0x32a107[_0x0b00('0x41')]['host']+_0x0b00('0x42')+_0xccf004+'\x0a\x0a'+_0x0b00('0x43')});})[_0x0b00('0xe')](function(){_0x5966d6[_0x0b00('0x2d')](0xc8)[_0x0b00('0x44')]({'message':'Reset\x20Email\x20sent!'});})[_0x0b00('0x1e')](function(_0x326f5f){return handleError(_0x5966d6,0x1f4,_0x326f5f);});};exports['reset']=function(_0x2251c6,_0x549ed6){return db['User']['find']({'where':{'resetPasswordToken':_0x2251c6[_0x0b00('0x45')][_0x0b00('0x46')],'resetPasswordExpires':{'$gt':Date[_0x0b00('0x3e')]()}}})[_0x0b00('0xe')](function(_0x2b3a94){if(!_0x2b3a94){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x0b00('0xa')][_0x0b00('0xb')]({'attributes':['id',_0x0b00('0x47'),_0x0b00('0x48'),_0x0b00('0x49')]})[_0x0b00('0xe')](function(_0x19e0a4){if(_0x19e0a4[_0x0b00('0x47')])authService[_0x0b00('0x4a')](_0x2251c6[_0x0b00('0x35')][_0x0b00('0x10')]);if(!_0x19e0a4[_0x0b00('0x48')]||!_0x2b3a94[_0x0b00('0x4b')])return _0x2b3a94;authService[_0x0b00('0x4c')](_0x2251c6[_0x0b00('0x35')][_0x0b00('0x10')],_0x2b3a94['previousPasswords'],_0x19e0a4['passwordHistoryLimit']);return _0x2b3a94;})[_0x0b00('0xe')](function(){_0x2b3a94[_0x0b00('0x10')]=_0x2251c6[_0x0b00('0x35')]['password'];_0x2b3a94[_0x0b00('0x3c')]=null;_0x2b3a94['resetPasswordExpires']=null;return _0x2b3a94['save']();});})[_0x0b00('0xe')](function(){_0x549ed6[_0x0b00('0x2d')](0xc8)['send']({'message':'Password\x20reset!'});})[_0x0b00('0x1e')](function(_0x15ea94){return handleError(_0x549ed6,0x1f4,_0x15ea94);});};passport[_0x0b00('0x4d')](_0x0b00('0x2f'),new LocalStrategy({'usernameField':_0x0b00('0xf'),'passwordField':_0x0b00('0x10')},function(_0x279bc7,_0x157bc2,_0x331b53){return localAuthenticate(db[_0x0b00('0x4e')],_0x279bc7,_0x157bc2,_0x331b53);})); \ No newline at end of file +var _0x9795=['MailAccount','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','user','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','login','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','toLowerCase','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','minutes','resetPasswordToken','resetPasswordExpires','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','now','securePassword','enforcePasswordHistory','passwordHistoryLimit','use','local-login','util','passport','passport-local','Strategy','jayson/promise','randomstring','../../components/auth/service','client','Setting','findOne','blockDuration','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','authenticate','allowedLoginAttempts','add','clearBlockUser','catch'];(function(_0x2331f4,_0xe518c3){var _0x224d15=function(_0xa917c5){while(--_0xa917c5){_0x2331f4['push'](_0x2331f4['shift']());}};_0x224d15(++_0xe518c3);}(_0x9795,0x157));var _0x5979=function(_0x46344e,_0x516028){_0x46344e=_0x46344e-0x0;var _0x42a4f5=_0x9795[_0x46344e];return _0x42a4f5;};'use strict';var util=require(_0x5979('0x0'));var passport=require(_0x5979('0x1'));var LocalStrategy=require(_0x5979('0x2'))[_0x5979('0x3')];var jayson=require(_0x5979('0x4'));var _=require('lodash');var rs=require(_0x5979('0x5'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x5979('0x6'));var utils=require('../../config/utils');var client=jayson[_0x5979('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x2d74c9,_0xabd45a,_0x505829,_0x33b227){var _0x2bb3cd,_0x341f98;return db[_0x5979('0x8')][_0x5979('0x9')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x5979('0xa')],'raw':!![]})['then'](function(_0x5d389e){_0x2bb3cd=_0x5d389e;return _0x2d74c9['findOne']({'attributes':['id',_0x5979('0xb'),_0x5979('0xc'),_0x5979('0xd'),_0x5979('0xe'),_0x5979('0xf'),_0x5979('0x10'),_0x5979('0x11'),_0x5979('0x12')],'where':{'name':_0xabd45a,'role':{'$or':['admin','user',_0x5979('0x13')]}}});})['then'](function(_0x15497e){if(!_0x15497e||_0x15497e&&_0x15497e['name']!==_0xabd45a){throw new Error(_0x5979('0x14'));}else{_0x341f98=_0x15497e;return _0x341f98;}})[_0x5979('0x15')](function(){_0x341f98[_0x5979('0x16')](_0x505829,function(_0x466f73,_0x6243ed){var _0x41275b=_0x341f98[_0x5979('0x12')]+0x1;if(_0x466f73){return _0x33b227(_0x466f73);}else if(!_0x6243ed){if(_0x341f98[_0x5979('0xf')]){return _0x33b227(null,![],{'message':_0x5979('0x14')});}else if(_0x2bb3cd['allowedLoginAttempts']>0x0){if(_0x341f98[_0x5979('0x10')]){if(_0x2bb3cd[_0x5979('0xa')]>0x0){if(moment(_0x341f98[_0x5979('0x11')])['add'](_0x2bb3cd[_0x5979('0xa')],'minutes')>moment()){return _0x33b227(null,![],{'message':_0x5979('0x14')});}else{return utils['clearBlockUser'](_0x341f98,_0x41275b,![],null)[_0x5979('0x15')](function(){return _0x33b227(null,![],{'message':_0x5979('0x14')});});}}else{return _0x33b227(null,![],{'message':_0x5979('0x14')});}}else{if(_0x41275b>=_0x2bb3cd[_0x5979('0x17')]){return utils['clearBlockUser'](_0x341f98,0x0,!![],moment())[_0x5979('0x15')](function(){return _0x33b227(null,![],{'message':_0x5979('0x14')});});}else{return utils['clearBlockUser'](_0x341f98,_0x41275b,![],null)[_0x5979('0x15')](function(){return _0x33b227(null,![],{'message':_0x5979('0x14')});});}}}else{return _0x33b227(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x341f98['disabled']){return _0x33b227(null,![],{'message':_0x5979('0x14')});}else if(_0x2bb3cd[_0x5979('0x17')]>0x0){if(_0x341f98['blocked']){if(_0x2bb3cd[_0x5979('0xa')]>0x0){if(moment(_0x341f98[_0x5979('0x11')])[_0x5979('0x18')](_0x2bb3cd['blockDuration'],'minutes')>moment()){return _0x33b227(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x5979('0x19')](_0x341f98,0x0,![],null)['then'](function(){return utils['getLicense'](_0x341f98);})[_0x5979('0x15')](function(){return _0x33b227(null,_0x341f98);});}}else{return _0x33b227(null,![],{'message':_0x5979('0x14')});}}else{return utils[_0x5979('0x19')](_0x341f98,0x0,![],null)[_0x5979('0x15')](function(){return utils['getLicense'](_0x341f98);})[_0x5979('0x15')](function(){return _0x33b227(null,_0x341f98);})[_0x5979('0x1a')](function(_0x514b51){return _0x33b227(null,![],_0x514b51);});}}else{if(_0x341f98[_0x5979('0x10')]){return _0x33b227(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x341f98)[_0x5979('0x15')](function(){return _0x33b227(null,_0x341f98);});}}}});})['catch'](function(_0x1478b7){return _0x33b227(null,![],_0x1478b7);});}function sendServiceMail(_0x5c0d5f){return db[_0x5979('0x1b')]['find']({'where':{'service':!![]},'attributes':['id',_0x5979('0xb'),_0x5979('0x1c')],'include':[{'model':db[_0x5979('0x1d')],'as':_0x5979('0x1e'),'include':[{'model':db[_0x5979('0x1f')],'as':_0x5979('0x1f')}]}]})[_0x5979('0x15')](function(_0x9b3932){if(!_0x9b3932){throw new Error(_0x5979('0x20'));}var _0x1adf1a=_0x9b3932[_0x5979('0x21')]();var _0x30421e={'account':_0x1adf1a,'message':_['merge']({'from':util[_0x5979('0x22')](_0x5979('0x23'),_0x9b3932[_0x5979('0xb')],_0x9b3932[_0x5979('0x1c')]||_0x9b3932[_0x5979('0x1e')][_0x5979('0x24')])},_0x5c0d5f)};return client[_0x5979('0x25')](_0x5979('0x26'),_0x30421e);})['then'](function(_0x3e06c0){if(_0x3e06c0[_0x5979('0x27')]){throw new Error(util[_0x5979('0x22')](_0x5979('0x28'),_0x3e06c0[_0x5979('0x27')]['message']||JSON[_0x5979('0x29')](_0x3e06c0[_0x5979('0x27')])));}return!![];});}function handleError(_0x4539b7,_0x449259,_0x3b9958){return _0x4539b7[_0x5979('0x2a')](_0x449259||0x1f4)[_0x5979('0x2b')]({'message':_0x3b9958?_0x3b9958[_0x5979('0x2c')]||_0x3b9958:''});}exports[_0x5979('0x2d')]=function(_0x539525,_0x42b317,_0x560fa3){passport[_0x5979('0x16')]('local-login',function(_0x452ba7,_0x1a9497,_0x24f00b){var _0x5c7203=_0x452ba7||_0x24f00b;if(_0x5c7203){return handleError(_0x42b317,0x191,_0x5c7203);}if(!_0x1a9497){return handleError(_0x42b317,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x4443ac={'payload':{'id':_0x1a9497['id'],'role':_0x1a9497[_0x5979('0xe')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4443ac)[_0x5979('0x15')](function(_0x2935b6){_0x42b317[_0x5979('0x2e')]({'id':_0x1a9497['id'],'token':_0x2935b6,'statusCall':'','isAlreadyLogged':_0x1a9497[_0x5979('0x2f')]});});}})(_0x539525,_0x42b317,_0x560fa3);};exports[_0x5979('0x30')]=function(_0x36d130,_0x23e1d0){if(!_0x36d130['body']['email']){return handleError(_0x23e1d0,0x1f4,{'message':_0x5979('0x31')});}var _0xc72589=rs[_0x5979('0x32')]();_0x36d130['body']['email']=_0x36d130[_0x5979('0x33')][_0x5979('0x1c')]['trim']()[_0x5979('0x34')]();var _0x1eb186;return db[_0x5979('0x8')][_0x5979('0x9')]({'where':{'id':0x1},'attributes':[_0x5979('0x17'),_0x5979('0xa')],'raw':!![]})[_0x5979('0x15')](function(_0x8838b1){_0x1eb186=_0x8838b1;return db[_0x5979('0x35')][_0x5979('0x36')]({'where':{'email':_0x36d130[_0x5979('0x33')][_0x5979('0x1c')]}});})['then'](function(_0x54106f){if(!_0x54106f){throw new Error(_0x5979('0x37'));}if(_0x54106f[_0x5979('0xf')]){throw new Error(_0x5979('0x38'));}if(_0x54106f[_0x5979('0x10')]){if(moment(_0x54106f['blockedAt'])[_0x5979('0x18')](_0x1eb186['blockDuration'],_0x5979('0x39'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x54106f['blocked']=![];_0x54106f['blockedAt']=null;}}_0x54106f[_0x5979('0x3a')]=_0xc72589;_0x54106f[_0x5979('0x3b')]=Date['now']()+0x36ee80;return _0x54106f[_0x5979('0x3c')]();})[_0x5979('0x15')](function(){return sendServiceMail({'to':_0x36d130[_0x5979('0x33')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x5979('0x3d')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x36d130[_0x5979('0x3e')]['host']+_0x5979('0x3f')+_0xc72589+'\x0a\x0a'+_0x5979('0x40')});})[_0x5979('0x15')](function(){_0x23e1d0['status'](0xc8)[_0x5979('0x2b')]({'message':'Reset\x20Email\x20sent!'});})[_0x5979('0x1a')](function(_0x314691){return handleError(_0x23e1d0,0x1f4,_0x314691);});};exports[_0x5979('0x41')]=function(_0x46a5be,_0x532883){return db[_0x5979('0x35')][_0x5979('0x36')]({'where':{'resetPasswordToken':_0x46a5be[_0x5979('0x42')][_0x5979('0x43')],'resetPasswordExpires':{'$gt':Date[_0x5979('0x44')]()}}})[_0x5979('0x15')](function(_0x27ea76){if(!_0x27ea76){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0x5979('0x9')]({'attributes':['id',_0x5979('0x45'),_0x5979('0x46'),_0x5979('0x47')]})['then'](function(_0x571d44){if(_0x571d44[_0x5979('0x45')])authService['validatePasswordPattern'](_0x46a5be[_0x5979('0x33')][_0x5979('0xc')]);if(!_0x571d44['enforcePasswordHistory']||!_0x27ea76['previousPasswords'])return _0x27ea76;authService['validatePasswordHistory'](_0x46a5be[_0x5979('0x33')][_0x5979('0xc')],_0x27ea76['previousPasswords'],_0x571d44[_0x5979('0x47')]);return _0x27ea76;})[_0x5979('0x15')](function(){_0x27ea76[_0x5979('0xc')]=_0x46a5be[_0x5979('0x33')]['password'];_0x27ea76[_0x5979('0x3a')]=null;_0x27ea76[_0x5979('0x3b')]=null;return _0x27ea76[_0x5979('0x3c')]();});})[_0x5979('0x15')](function(){_0x532883[_0x5979('0x2a')](0xc8)[_0x5979('0x2b')]({'message':'Password\x20reset!'});})[_0x5979('0x1a')](function(_0x5ef745){return handleError(_0x532883,0x1f4,_0x5ef745);});};passport[_0x5979('0x48')](_0x5979('0x49'),new LocalStrategy({'usernameField':_0x5979('0xb'),'passwordField':_0x5979('0xc')},function(_0x324610,_0x8649c4,_0x4edec4){return localAuthenticate(db[_0x5979('0x35')],_0x324610,_0x8649c4,_0x4edec4);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index fbb54cd..9825d85 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 _0x77d8=['/forgot','/reset/:token','exports','express','post','login'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0x77d8,0x135));var _0x877d=function(_0x2c7f80,_0x5da68e){_0x2c7f80=_0x2c7f80-0x0;var _0x413d06=_0x77d8[_0x2c7f80];return _0x413d06;};'use strict';var express=require(_0x877d('0x0'));var router=express['Router']();var controller=require('./authLocal.controller');router[_0x877d('0x1')]('/',controller[_0x877d('0x2')]);router[_0x877d('0x1')](_0x877d('0x3'),controller['forgot']);router[_0x877d('0x1')](_0x877d('0x4'),controller['reset']);module[_0x877d('0x5')]=router; \ No newline at end of file +var _0xc115=['post','/forgot','forgot','/reset/:token','reset','express','Router','./authLocal.controller'];(function(_0x13e77a,_0xadf480){var _0x499845=function(_0x55cd3c){while(--_0x55cd3c){_0x13e77a['push'](_0x13e77a['shift']());}};_0x499845(++_0xadf480);}(_0xc115,0x145));var _0x5c11=function(_0x57a60f,_0x410a3a){_0x57a60f=_0x57a60f-0x0;var _0x19cfe3=_0xc115[_0x57a60f];return _0x19cfe3;};'use strict';var express=require(_0x5c11('0x0'));var router=express[_0x5c11('0x1')]();var controller=require(_0x5c11('0x2'));router[_0x5c11('0x3')]('/',controller['login']);router['post'](_0x5c11('0x4'),controller[_0x5c11('0x5')]);router[_0x5c11('0x3')](_0x5c11('0x6'),controller[_0x5c11('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 062ef8c..36c63d6 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 _0x3f3f=['INTEGER','exports','STRING'];(function(_0x9ac163,_0x29590d){var _0x3e550d=function(_0x2d938a){while(--_0x2d938a){_0x9ac163['push'](_0x9ac163['shift']());}};_0x3e550d(++_0x29590d);}(_0x3f3f,0xd9));var _0xf3f3=function(_0x549ffa,_0x4011d9){_0x549ffa=_0x549ffa-0x0;var _0x378324=_0x3f3f[_0x549ffa];return _0x378324;};'use strict';var Sequelize=require('sequelize');module[_0xf3f3('0x0')]={'name':{'type':Sequelize[_0xf3f3('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xf3f3('0x1')]},'description':{'type':Sequelize[_0xf3f3('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xf3f3('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0xa2b8=['INTEGER','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa2b8,0x177));var _0x8a2b=function(_0x5338dc,_0x529f8f){_0x5338dc=_0x5338dc-0x0;var _0x3b1f77=_0xa2b8[_0x5338dc];return _0x3b1f77;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8a2b('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0x8a2b('0x0')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8a2b('0x1')],'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 e817495..13af6ab 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 _0x1b7a=['apply','reject','save','update','then','error','stack','name','send','index','map','Automation','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','addConditions','Condition','omit','ids','getConditions','findOne','addActions','Action','getActions','order','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','count','offset','Content-Range','json'];(function(_0x183481,_0x26400f){var _0x421f0a=function(_0xa1ded3){while(--_0xa1ded3){_0x183481['push'](_0x183481['shift']());}};_0x421f0a(++_0x26400f);}(_0x1b7a,0x88));var _0xa1b7=function(_0xadd0ce,_0x1d8ca4){_0xadd0ce=_0xadd0ce-0x0;var _0x5b5ff4=_0x1b7a[_0xadd0ce];return _0x5b5ff4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa1b7('0x0'));var zipdir=require(_0xa1b7('0x1'));var jsonpatch=require(_0xa1b7('0x2'));var rp=require('request-promise');var moment=require(_0xa1b7('0x3'));var BPromise=require(_0xa1b7('0x4'));var Mustache=require(_0xa1b7('0x5'));var util=require(_0xa1b7('0x6'));var path=require(_0xa1b7('0x7'));var sox=require(_0xa1b7('0x8'));var csv=require(_0xa1b7('0x9'));var ejs=require(_0xa1b7('0xa'));var fs=require('fs');var fs_extra=require(_0xa1b7('0xb'));var _=require(_0xa1b7('0xc'));var squel=require(_0xa1b7('0xd'));var crypto=require('crypto');var jsforce=require(_0xa1b7('0xe'));var deskjs=require(_0xa1b7('0xf'));var toCsv=require(_0xa1b7('0x9'));var querystring=require('querystring');var Papa=require(_0xa1b7('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa1b7('0x11'));var as=require(_0xa1b7('0x12'));var hardwareService=require(_0xa1b7('0x13'));var logger=require(_0xa1b7('0x14'))(_0xa1b7('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa1b7('0x16'));var db=require(_0xa1b7('0x17'))['db'];function respondWithStatusCode(_0xbb4851,_0x365c61){_0x365c61=_0x365c61||0xcc;return function(_0x59bb84){if(_0x59bb84){return _0xbb4851[_0xa1b7('0x18')](_0x365c61);}return _0xbb4851[_0xa1b7('0x19')](_0x365c61)[_0xa1b7('0x1a')]();};}function respondWithResult(_0x6f7613,_0x2f5c7f){_0x2f5c7f=_0x2f5c7f||0xc8;return function(_0xdaaef7){if(_0xdaaef7){return _0x6f7613[_0xa1b7('0x19')](_0x2f5c7f)['json'](_0xdaaef7);}};}function respondWithFilteredResult(_0x47b547,_0x2a40fd){return function(_0x1ff511){if(_0x1ff511){var _0x4042dd=typeof _0x2a40fd['offset']==='undefined'&&typeof _0x2a40fd[_0xa1b7('0x1b')]==='undefined';var _0xfd8cf5=_0x1ff511[_0xa1b7('0x1c')];var _0x5c0486=_0x4042dd?0x0:_0x2a40fd[_0xa1b7('0x1d')];var _0x43b5f4=_0x4042dd?_0x1ff511[_0xa1b7('0x1c')]:_0x2a40fd[_0xa1b7('0x1d')]+_0x2a40fd[_0xa1b7('0x1b')];var _0x1e0017;if(_0x43b5f4>=_0xfd8cf5){_0x43b5f4=_0xfd8cf5;_0x1e0017=0xc8;}else{_0x1e0017=0xce;}_0x47b547['status'](_0x1e0017);return _0x47b547['set'](_0xa1b7('0x1e'),_0x5c0486+'-'+_0x43b5f4+'/'+_0xfd8cf5)[_0xa1b7('0x1f')](_0x1ff511);}return null;};}function patchUpdates(_0x538db4){return function(_0x1a0c8f){try{jsonpatch[_0xa1b7('0x20')](_0x1a0c8f,_0x538db4,!![]);}catch(_0x525646){return BPromise[_0xa1b7('0x21')](_0x525646);}return _0x1a0c8f[_0xa1b7('0x22')]();};}function saveUpdates(_0x371098,_0x8e9215){return function(_0x355fc8){if(_0x355fc8){return _0x355fc8[_0xa1b7('0x23')](_0x371098)[_0xa1b7('0x24')](function(_0x5b260e){return _0x5b260e;});}return null;};}function removeEntity(_0x415ad6,_0xefb96d){return function(_0x2adcd7){if(_0x2adcd7){return _0x2adcd7['destroy']()['then'](function(){_0x415ad6[_0xa1b7('0x19')](0xcc)[_0xa1b7('0x1a')]();});}};}function handleEntityNotFound(_0x3a510e,_0x1cb0a5){return function(_0x1739bf){if(!_0x1739bf){_0x3a510e[_0xa1b7('0x18')](0x194);}return _0x1739bf;};}function handleError(_0x441b6f,_0x30b34d){_0x30b34d=_0x30b34d||0x1f4;return function(_0x55d2e4){logger[_0xa1b7('0x25')](_0x55d2e4[_0xa1b7('0x26')]);if(_0x55d2e4[_0xa1b7('0x27')]){delete _0x55d2e4[_0xa1b7('0x27')];}_0x441b6f[_0xa1b7('0x19')](_0x30b34d)[_0xa1b7('0x28')](_0x55d2e4);};}exports[_0xa1b7('0x29')]=function(_0x157523,_0x47ce3a){var _0x20ac8b={},_0xc2486c={},_0x160593={'count':0x0,'rows':[]};var _0x595da9=_[_0xa1b7('0x2a')](db[_0xa1b7('0x2b')]['rawAttributes'],function(_0x1d3dbc){return{'name':_0x1d3dbc['fieldName'],'type':_0x1d3dbc['type'][_0xa1b7('0x2c')]};});_0xc2486c['model']=_[_0xa1b7('0x2a')](_0x595da9,_0xa1b7('0x27'));_0xc2486c[_0xa1b7('0x2d')]=_['keys'](_0x157523[_0xa1b7('0x2d')]);_0xc2486c[_0xa1b7('0x2e')]=_[_0xa1b7('0x2f')](_0xc2486c[_0xa1b7('0x30')],_0xc2486c['query']);_0x20ac8b[_0xa1b7('0x31')]=_[_0xa1b7('0x2f')](_0xc2486c['model'],qs[_0xa1b7('0x32')](_0x157523[_0xa1b7('0x2d')][_0xa1b7('0x32')]));_0x20ac8b[_0xa1b7('0x31')]=_0x20ac8b[_0xa1b7('0x31')][_0xa1b7('0x33')]?_0x20ac8b[_0xa1b7('0x31')]:_0xc2486c[_0xa1b7('0x30')];if(!_0x157523[_0xa1b7('0x2d')][_0xa1b7('0x34')](_0xa1b7('0x35'))){_0x20ac8b[_0xa1b7('0x1b')]=qs[_0xa1b7('0x1b')](_0x157523['query'][_0xa1b7('0x1b')]);_0x20ac8b[_0xa1b7('0x1d')]=qs[_0xa1b7('0x1d')](_0x157523['query'][_0xa1b7('0x1d')]);}_0x20ac8b['order']=qs[_0xa1b7('0x36')](_0x157523[_0xa1b7('0x2d')][_0xa1b7('0x36')]);_0x20ac8b['where']=qs['filters'](_[_0xa1b7('0x37')](_0x157523[_0xa1b7('0x2d')],_0xc2486c[_0xa1b7('0x2e')]),_0x595da9);if(_0x157523['query'][_0xa1b7('0x38')]){_0x20ac8b[_0xa1b7('0x39')]=_[_0xa1b7('0x3a')](_0x20ac8b['where'],{'$or':_[_0xa1b7('0x2a')](_0x595da9,function(_0x3ac558){if(_0x3ac558[_0xa1b7('0x3b')]!==_0xa1b7('0x3c')){var _0x5c9c15={};_0x5c9c15[_0x3ac558[_0xa1b7('0x27')]]={'$like':'%'+_0x157523[_0xa1b7('0x2d')][_0xa1b7('0x38')]+'%'};return _0x5c9c15;}})});}_0x20ac8b=_[_0xa1b7('0x3a')]({},_0x20ac8b,_0x157523['options']);var _0x5abe9a={'where':_0x20ac8b[_0xa1b7('0x39')]};return db[_0xa1b7('0x2b')]['count'](_0x5abe9a)[_0xa1b7('0x24')](function(_0x33c9cb){_0x160593[_0xa1b7('0x1c')]=_0x33c9cb;if(_0x157523[_0xa1b7('0x2d')][_0xa1b7('0x3d')]){_0x20ac8b[_0xa1b7('0x3e')]=[{'all':!![]}];}return db[_0xa1b7('0x2b')][_0xa1b7('0x3f')](_0x20ac8b);})['then'](function(_0xd20c24){_0x160593[_0xa1b7('0x40')]=_0xd20c24;return _0x160593;})[_0xa1b7('0x24')](respondWithFilteredResult(_0x47ce3a,_0x20ac8b))[_0xa1b7('0x41')](handleError(_0x47ce3a,null));};exports[_0xa1b7('0x42')]=function(_0x326b5f,_0x53ecdf){var _0x266dbc={'raw':![],'where':{'id':_0x326b5f[_0xa1b7('0x43')]['id']}},_0x58d31d={};_0x58d31d[_0xa1b7('0x30')]=_[_0xa1b7('0x44')](db[_0xa1b7('0x2b')][_0xa1b7('0x45')]);_0x58d31d['query']=_['keys'](_0x326b5f['query']);_0x58d31d[_0xa1b7('0x2e')]=_[_0xa1b7('0x2f')](_0x58d31d['model'],_0x58d31d['query']);_0x266dbc['attributes']=_[_0xa1b7('0x2f')](_0x58d31d[_0xa1b7('0x30')],qs[_0xa1b7('0x32')](_0x326b5f['query'][_0xa1b7('0x32')]));_0x266dbc[_0xa1b7('0x31')]=_0x266dbc[_0xa1b7('0x31')][_0xa1b7('0x33')]?_0x266dbc[_0xa1b7('0x31')]:_0x58d31d[_0xa1b7('0x30')];if(_0x326b5f[_0xa1b7('0x2d')]['includeAll']){_0x266dbc[_0xa1b7('0x3e')]=[{'all':!![]}];}_0x266dbc=_[_0xa1b7('0x3a')]({},_0x266dbc,_0x326b5f[_0xa1b7('0x46')]);return db[_0xa1b7('0x2b')][_0xa1b7('0x47')](_0x266dbc)[_0xa1b7('0x24')](handleEntityNotFound(_0x53ecdf,null))[_0xa1b7('0x24')](respondWithResult(_0x53ecdf,null))[_0xa1b7('0x41')](handleError(_0x53ecdf,null));};exports[_0xa1b7('0x48')]=function(_0x44fab6,_0x43e8c0){return db[_0xa1b7('0x2b')][_0xa1b7('0x48')](_0x44fab6[_0xa1b7('0x49')],{})[_0xa1b7('0x24')](respondWithResult(_0x43e8c0,0xc9))[_0xa1b7('0x41')](handleError(_0x43e8c0,null));};exports['update']=function(_0x2abf5b,_0x26183f){if(_0x2abf5b[_0xa1b7('0x49')]['id']){delete _0x2abf5b[_0xa1b7('0x49')]['id'];}return db[_0xa1b7('0x2b')]['find']({'where':{'id':_0x2abf5b[_0xa1b7('0x43')]['id']}})[_0xa1b7('0x24')](handleEntityNotFound(_0x26183f,null))[_0xa1b7('0x24')](saveUpdates(_0x2abf5b['body'],null))[_0xa1b7('0x24')](respondWithResult(_0x26183f,null))['catch'](handleError(_0x26183f,null));};exports['destroy']=function(_0x569631,_0x172302){return db['Automation'][_0xa1b7('0x47')]({'where':{'id':_0x569631[_0xa1b7('0x43')]['id']}})[_0xa1b7('0x24')](handleEntityNotFound(_0x172302,null))[_0xa1b7('0x24')](removeEntity(_0x172302,null))['catch'](handleError(_0x172302,null));};exports[_0xa1b7('0x4a')]=function(_0x29a6e1,_0x508d5e,_0xf06a3d){return db[_0xa1b7('0x4b')][_0xa1b7('0x47')]({'where':{'id':_0x29a6e1[_0xa1b7('0x43')]['id']}})[_0xa1b7('0x24')](handleEntityNotFound(_0x508d5e,null))['then'](function(_0x47cbd6){if(_0x47cbd6){return _0x47cbd6[_0xa1b7('0x4a')](_0x29a6e1[_0xa1b7('0x49')]['ids'],_[_0xa1b7('0x4c')](_0x29a6e1[_0xa1b7('0x49')],[_0xa1b7('0x4d'),'id'])||{});}})[_0xa1b7('0x24')](respondWithResult(_0x508d5e,null))[_0xa1b7('0x41')](handleError(_0x508d5e,null));};exports[_0xa1b7('0x4e')]=function(_0x47f28e,_0x225dc7,_0x1512c2){var _0x15d9e9={};var _0x424105={};var _0x58cf75;var _0x1ec2ce;return db[_0xa1b7('0x2b')][_0xa1b7('0x4f')]({'where':{'id':_0x47f28e[_0xa1b7('0x43')]['id']}})[_0xa1b7('0x24')](handleEntityNotFound(_0x225dc7,null))[_0xa1b7('0x24')](function(_0x1f8e08){if(_0x1f8e08){_0x58cf75=_0x1f8e08;_0x424105[_0xa1b7('0x30')]=_[_0xa1b7('0x44')](db[_0xa1b7('0x4b')][_0xa1b7('0x45')]);_0x424105[_0xa1b7('0x2d')]=_['keys'](_0x47f28e['query']);_0x424105['filters']=_[_0xa1b7('0x2f')](_0x424105[_0xa1b7('0x30')],_0x424105[_0xa1b7('0x2d')]);_0x15d9e9[_0xa1b7('0x31')]=_[_0xa1b7('0x2f')](_0x424105[_0xa1b7('0x30')],qs['fields'](_0x47f28e[_0xa1b7('0x2d')][_0xa1b7('0x32')]));_0x15d9e9[_0xa1b7('0x31')]=_0x15d9e9[_0xa1b7('0x31')]['length']?_0x15d9e9[_0xa1b7('0x31')]:_0x424105[_0xa1b7('0x30')];_0x15d9e9['order']=qs[_0xa1b7('0x36')](_0x47f28e[_0xa1b7('0x2d')]['sort']);_0x15d9e9[_0xa1b7('0x39')]=qs[_0xa1b7('0x2e')](_[_0xa1b7('0x37')](_0x47f28e[_0xa1b7('0x2d')],_0x424105['filters']));if(_0x47f28e[_0xa1b7('0x2d')]['filter']){_0x15d9e9[_0xa1b7('0x39')]=_[_0xa1b7('0x3a')](_0x15d9e9[_0xa1b7('0x39')],{'$or':_['map'](_0x15d9e9[_0xa1b7('0x31')],function(_0xc2eb68){var _0x250777={};_0x250777[_0xc2eb68]={'$like':'%'+_0x47f28e[_0xa1b7('0x2d')]['filter']+'%'};return _0x250777;})});}_0x15d9e9=_[_0xa1b7('0x3a')]({},_0x15d9e9,_0x47f28e[_0xa1b7('0x46')]);return _0x58cf75[_0xa1b7('0x4e')](_0x15d9e9);}})[_0xa1b7('0x24')](function(_0x4d32d4){if(_0x4d32d4){_0x1ec2ce=_0x4d32d4[_0xa1b7('0x33')];if(!_0x47f28e[_0xa1b7('0x2d')]['hasOwnProperty']('nolimit')){_0x15d9e9[_0xa1b7('0x1b')]=qs[_0xa1b7('0x1b')](_0x47f28e[_0xa1b7('0x2d')][_0xa1b7('0x1b')]);_0x15d9e9['offset']=qs[_0xa1b7('0x1d')](_0x47f28e[_0xa1b7('0x2d')][_0xa1b7('0x1d')]);}return _0x58cf75[_0xa1b7('0x4e')](_0x15d9e9);}})[_0xa1b7('0x24')](function(_0x381118){if(_0x381118){return _0x381118?{'count':_0x1ec2ce,'rows':_0x381118}:null;}})[_0xa1b7('0x24')](respondWithResult(_0x225dc7,null))[_0xa1b7('0x41')](handleError(_0x225dc7,null));};exports[_0xa1b7('0x50')]=function(_0xeffb45,_0x153d11,_0x465475){return db[_0xa1b7('0x51')][_0xa1b7('0x47')]({'where':{'id':_0xeffb45[_0xa1b7('0x43')]['id']}})['then'](handleEntityNotFound(_0x153d11,null))[_0xa1b7('0x24')](function(_0x53d57d){if(_0x53d57d){return _0x53d57d[_0xa1b7('0x50')](_0xeffb45[_0xa1b7('0x49')]['ids'],_[_0xa1b7('0x4c')](_0xeffb45[_0xa1b7('0x49')],[_0xa1b7('0x4d'),'id'])||{});}})[_0xa1b7('0x24')](respondWithResult(_0x153d11,null))[_0xa1b7('0x41')](handleError(_0x153d11,null));};exports[_0xa1b7('0x52')]=function(_0x11d71b,_0x2869ac,_0x5c5b3e){var _0x131910={};var _0x1d399f={};var _0xeaa5e9;var _0x4d07bc;return db['Automation'][_0xa1b7('0x4f')]({'where':{'id':_0x11d71b[_0xa1b7('0x43')]['id']}})[_0xa1b7('0x24')](handleEntityNotFound(_0x2869ac,null))['then'](function(_0x29454d){if(_0x29454d){_0xeaa5e9=_0x29454d;_0x1d399f[_0xa1b7('0x30')]=_[_0xa1b7('0x44')](db['Action'][_0xa1b7('0x45')]);_0x1d399f[_0xa1b7('0x2d')]=_[_0xa1b7('0x44')](_0x11d71b['query']);_0x1d399f[_0xa1b7('0x2e')]=_[_0xa1b7('0x2f')](_0x1d399f['model'],_0x1d399f[_0xa1b7('0x2d')]);_0x131910[_0xa1b7('0x31')]=_[_0xa1b7('0x2f')](_0x1d399f['model'],qs['fields'](_0x11d71b[_0xa1b7('0x2d')][_0xa1b7('0x32')]));_0x131910['attributes']=_0x131910[_0xa1b7('0x31')][_0xa1b7('0x33')]?_0x131910[_0xa1b7('0x31')]:_0x1d399f[_0xa1b7('0x30')];_0x131910[_0xa1b7('0x53')]=qs['sort'](_0x11d71b['query'][_0xa1b7('0x36')]);_0x131910[_0xa1b7('0x39')]=qs[_0xa1b7('0x2e')](_['pick'](_0x11d71b['query'],_0x1d399f['filters']));if(_0x11d71b[_0xa1b7('0x2d')][_0xa1b7('0x38')]){_0x131910[_0xa1b7('0x39')]=_[_0xa1b7('0x3a')](_0x131910[_0xa1b7('0x39')],{'$or':_['map'](_0x131910[_0xa1b7('0x31')],function(_0x48a8c2){var _0x52e4ca={};_0x52e4ca[_0x48a8c2]={'$like':'%'+_0x11d71b[_0xa1b7('0x2d')][_0xa1b7('0x38')]+'%'};return _0x52e4ca;})});}_0x131910=_[_0xa1b7('0x3a')]({},_0x131910,_0x11d71b[_0xa1b7('0x46')]);return _0xeaa5e9['getActions'](_0x131910);}})[_0xa1b7('0x24')](function(_0x3fea57){if(_0x3fea57){_0x4d07bc=_0x3fea57[_0xa1b7('0x33')];if(!_0x11d71b['query']['hasOwnProperty'](_0xa1b7('0x35'))){_0x131910[_0xa1b7('0x1b')]=qs['limit'](_0x11d71b[_0xa1b7('0x2d')][_0xa1b7('0x1b')]);_0x131910[_0xa1b7('0x1d')]=qs[_0xa1b7('0x1d')](_0x11d71b['query'][_0xa1b7('0x1d')]);}return _0xeaa5e9[_0xa1b7('0x52')](_0x131910);}})[_0xa1b7('0x24')](function(_0xb35e67){if(_0xb35e67){return _0xb35e67?{'count':_0x4d07bc,'rows':_0xb35e67}:null;}})[_0xa1b7('0x24')](respondWithResult(_0x2869ac,null))[_0xa1b7('0x41')](handleError(_0x2869ac,null));}; \ No newline at end of file +var _0x44bd=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','apply','reject','save','update','then','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','count','findAll','rows','catch','params','includeAll','include','find','create','body','destroy','addConditions','Condition','omit','ids','getConditions','findOne','pick','addActions','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44bd,0x143));var _0xd44b=function(_0x4ae83e,_0x518979){_0x4ae83e=_0x4ae83e-0x0;var _0x5add5e=_0x44bd[_0x4ae83e];return _0x5add5e;};'use strict';var emlformat=require(_0xd44b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd44b('0x1'));var jsonpatch=require(_0xd44b('0x2'));var rp=require(_0xd44b('0x3'));var moment=require(_0xd44b('0x4'));var BPromise=require(_0xd44b('0x5'));var Mustache=require(_0xd44b('0x6'));var util=require('util');var path=require(_0xd44b('0x7'));var sox=require(_0xd44b('0x8'));var csv=require(_0xd44b('0x9'));var ejs=require(_0xd44b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd44b('0xb'));var squel=require(_0xd44b('0xc'));var crypto=require('crypto');var jsforce=require(_0xd44b('0xd'));var deskjs=require(_0xd44b('0xe'));var toCsv=require(_0xd44b('0x9'));var querystring=require(_0xd44b('0xf'));var Papa=require(_0xd44b('0x10'));var Redis=require(_0xd44b('0x11'));var authService=require(_0xd44b('0x12'));var qs=require(_0xd44b('0x13'));var as=require(_0xd44b('0x14'));var hardwareService=require(_0xd44b('0x15'));var logger=require(_0xd44b('0x16'))(_0xd44b('0x17'));var utils=require('../../config/utils');var config=require(_0xd44b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd44b('0x19'))['db'];function respondWithStatusCode(_0x4176dd,_0x43a0b9){_0x43a0b9=_0x43a0b9||0xcc;return function(_0x2980c9){if(_0x2980c9){return _0x4176dd[_0xd44b('0x1a')](_0x43a0b9);}return _0x4176dd['status'](_0x43a0b9)['end']();};}function respondWithResult(_0x37e371,_0x49645e){_0x49645e=_0x49645e||0xc8;return function(_0x41a7dc){if(_0x41a7dc){return _0x37e371[_0xd44b('0x1b')](_0x49645e)[_0xd44b('0x1c')](_0x41a7dc);}};}function respondWithFilteredResult(_0x3e1044,_0x2e2a67){return function(_0x5d7ff3){if(_0x5d7ff3){var _0x5e6d8b=typeof _0x2e2a67[_0xd44b('0x1d')]==='undefined'&&typeof _0x2e2a67[_0xd44b('0x1e')]===_0xd44b('0x1f');var _0x51402e=_0x5d7ff3['count'];var _0x12c86c=_0x5e6d8b?0x0:_0x2e2a67[_0xd44b('0x1d')];var _0x9fd116=_0x5e6d8b?_0x5d7ff3['count']:_0x2e2a67[_0xd44b('0x1d')]+_0x2e2a67[_0xd44b('0x1e')];var _0x48422d;if(_0x9fd116>=_0x51402e){_0x9fd116=_0x51402e;_0x48422d=0xc8;}else{_0x48422d=0xce;}_0x3e1044[_0xd44b('0x1b')](_0x48422d);return _0x3e1044['set']('Content-Range',_0x12c86c+'-'+_0x9fd116+'/'+_0x51402e)['json'](_0x5d7ff3);}return null;};}function patchUpdates(_0x41e8ef){return function(_0x1dc02b){try{jsonpatch[_0xd44b('0x20')](_0x1dc02b,_0x41e8ef,!![]);}catch(_0x166521){return BPromise[_0xd44b('0x21')](_0x166521);}return _0x1dc02b[_0xd44b('0x22')]();};}function saveUpdates(_0x2ea0cc,_0x2c8633){return function(_0x24bd4f){if(_0x24bd4f){return _0x24bd4f[_0xd44b('0x23')](_0x2ea0cc)[_0xd44b('0x24')](function(_0x3223d8){return _0x3223d8;});}return null;};}function removeEntity(_0x226aff,_0x46c108){return function(_0x3d2be9){if(_0x3d2be9){return _0x3d2be9['destroy']()[_0xd44b('0x24')](function(){_0x226aff[_0xd44b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10f825,_0x2b213a){return function(_0x14f23e){if(!_0x14f23e){_0x10f825['sendStatus'](0x194);}return _0x14f23e;};}function handleError(_0x219c4d,_0x4c343e){_0x4c343e=_0x4c343e||0x1f4;return function(_0x516356){logger[_0xd44b('0x25')](_0x516356[_0xd44b('0x26')]);if(_0x516356[_0xd44b('0x27')]){delete _0x516356[_0xd44b('0x27')];}_0x219c4d[_0xd44b('0x1b')](_0x4c343e)[_0xd44b('0x28')](_0x516356);};}exports[_0xd44b('0x29')]=function(_0x457b5d,_0x2b90c){var _0x21e3b5={},_0x293a98={},_0x5ec3d2={'count':0x0,'rows':[]};var _0x513484=_[_0xd44b('0x2a')](db[_0xd44b('0x2b')][_0xd44b('0x2c')],function(_0x1215db){return{'name':_0x1215db[_0xd44b('0x2d')],'type':_0x1215db[_0xd44b('0x2e')][_0xd44b('0x2f')]};});_0x293a98['model']=_[_0xd44b('0x2a')](_0x513484,'name');_0x293a98[_0xd44b('0x30')]=_[_0xd44b('0x31')](_0x457b5d[_0xd44b('0x30')]);_0x293a98['filters']=_[_0xd44b('0x32')](_0x293a98[_0xd44b('0x33')],_0x293a98['query']);_0x21e3b5['attributes']=_['intersection'](_0x293a98[_0xd44b('0x33')],qs['fields'](_0x457b5d['query'][_0xd44b('0x34')]));_0x21e3b5[_0xd44b('0x35')]=_0x21e3b5[_0xd44b('0x35')][_0xd44b('0x36')]?_0x21e3b5['attributes']:_0x293a98[_0xd44b('0x33')];if(!_0x457b5d[_0xd44b('0x30')][_0xd44b('0x37')](_0xd44b('0x38'))){_0x21e3b5['limit']=qs[_0xd44b('0x1e')](_0x457b5d['query'][_0xd44b('0x1e')]);_0x21e3b5[_0xd44b('0x1d')]=qs[_0xd44b('0x1d')](_0x457b5d[_0xd44b('0x30')]['offset']);}_0x21e3b5[_0xd44b('0x39')]=qs[_0xd44b('0x3a')](_0x457b5d[_0xd44b('0x30')][_0xd44b('0x3a')]);_0x21e3b5[_0xd44b('0x3b')]=qs['filters'](_['pick'](_0x457b5d[_0xd44b('0x30')],_0x293a98[_0xd44b('0x3c')]),_0x513484);if(_0x457b5d['query'][_0xd44b('0x3d')]){_0x21e3b5['where']=_['merge'](_0x21e3b5[_0xd44b('0x3b')],{'$or':_[_0xd44b('0x2a')](_0x513484,function(_0x273ccf){if(_0x273ccf[_0xd44b('0x2e')]!=='VIRTUAL'){var _0x34762c={};_0x34762c[_0x273ccf['name']]={'$like':'%'+_0x457b5d[_0xd44b('0x30')][_0xd44b('0x3d')]+'%'};return _0x34762c;}})});}_0x21e3b5=_[_0xd44b('0x3e')]({},_0x21e3b5,_0x457b5d[_0xd44b('0x3f')]);var _0x289739={'where':_0x21e3b5['where']};return db[_0xd44b('0x2b')][_0xd44b('0x40')](_0x289739)[_0xd44b('0x24')](function(_0x17618f){_0x5ec3d2['count']=_0x17618f;if(_0x457b5d['query']['includeAll']){_0x21e3b5['include']=[{'all':!![]}];}return db['Automation'][_0xd44b('0x41')](_0x21e3b5);})[_0xd44b('0x24')](function(_0x295068){_0x5ec3d2[_0xd44b('0x42')]=_0x295068;return _0x5ec3d2;})[_0xd44b('0x24')](respondWithFilteredResult(_0x2b90c,_0x21e3b5))[_0xd44b('0x43')](handleError(_0x2b90c,null));};exports['show']=function(_0x2be128,_0x3073db){var _0x3f5903={'raw':![],'where':{'id':_0x2be128[_0xd44b('0x44')]['id']}},_0x2519ea={};_0x2519ea[_0xd44b('0x33')]=_['keys'](db[_0xd44b('0x2b')]['rawAttributes']);_0x2519ea['query']=_[_0xd44b('0x31')](_0x2be128[_0xd44b('0x30')]);_0x2519ea['filters']=_['intersection'](_0x2519ea['model'],_0x2519ea[_0xd44b('0x30')]);_0x3f5903[_0xd44b('0x35')]=_[_0xd44b('0x32')](_0x2519ea[_0xd44b('0x33')],qs[_0xd44b('0x34')](_0x2be128[_0xd44b('0x30')][_0xd44b('0x34')]));_0x3f5903[_0xd44b('0x35')]=_0x3f5903[_0xd44b('0x35')][_0xd44b('0x36')]?_0x3f5903['attributes']:_0x2519ea['model'];if(_0x2be128['query'][_0xd44b('0x45')]){_0x3f5903[_0xd44b('0x46')]=[{'all':!![]}];}_0x3f5903=_[_0xd44b('0x3e')]({},_0x3f5903,_0x2be128[_0xd44b('0x3f')]);return db['Automation'][_0xd44b('0x47')](_0x3f5903)[_0xd44b('0x24')](handleEntityNotFound(_0x3073db,null))[_0xd44b('0x24')](respondWithResult(_0x3073db,null))[_0xd44b('0x43')](handleError(_0x3073db,null));};exports[_0xd44b('0x48')]=function(_0x274833,_0x2d17be){return db[_0xd44b('0x2b')]['create'](_0x274833[_0xd44b('0x49')],{})[_0xd44b('0x24')](respondWithResult(_0x2d17be,0xc9))[_0xd44b('0x43')](handleError(_0x2d17be,null));};exports[_0xd44b('0x23')]=function(_0x5d04a2,_0x27c800){if(_0x5d04a2[_0xd44b('0x49')]['id']){delete _0x5d04a2[_0xd44b('0x49')]['id'];}return db[_0xd44b('0x2b')][_0xd44b('0x47')]({'where':{'id':_0x5d04a2[_0xd44b('0x44')]['id']}})['then'](handleEntityNotFound(_0x27c800,null))[_0xd44b('0x24')](saveUpdates(_0x5d04a2[_0xd44b('0x49')],null))['then'](respondWithResult(_0x27c800,null))[_0xd44b('0x43')](handleError(_0x27c800,null));};exports[_0xd44b('0x4a')]=function(_0x2ce26a,_0x4b5dd2){return db[_0xd44b('0x2b')][_0xd44b('0x47')]({'where':{'id':_0x2ce26a[_0xd44b('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b5dd2,null))[_0xd44b('0x24')](removeEntity(_0x4b5dd2,null))[_0xd44b('0x43')](handleError(_0x4b5dd2,null));};exports[_0xd44b('0x4b')]=function(_0xae08,_0x4ef50b,_0x133649){return db[_0xd44b('0x4c')]['find']({'where':{'id':_0xae08['params']['id']}})['then'](handleEntityNotFound(_0x4ef50b,null))[_0xd44b('0x24')](function(_0x55d5ce){if(_0x55d5ce){return _0x55d5ce[_0xd44b('0x4b')](_0xae08[_0xd44b('0x49')]['ids'],_[_0xd44b('0x4d')](_0xae08[_0xd44b('0x49')],[_0xd44b('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x4ef50b,null))['catch'](handleError(_0x4ef50b,null));};exports[_0xd44b('0x4f')]=function(_0x3ac6f4,_0x55fdc6,_0x5f3b52){var _0x481523={};var _0x25af26={};var _0xb2b393;var _0x2f5c5c;return db['Automation'][_0xd44b('0x50')]({'where':{'id':_0x3ac6f4['params']['id']}})[_0xd44b('0x24')](handleEntityNotFound(_0x55fdc6,null))[_0xd44b('0x24')](function(_0x426f7e){if(_0x426f7e){_0xb2b393=_0x426f7e;_0x25af26[_0xd44b('0x33')]=_[_0xd44b('0x31')](db[_0xd44b('0x4c')][_0xd44b('0x2c')]);_0x25af26['query']=_[_0xd44b('0x31')](_0x3ac6f4[_0xd44b('0x30')]);_0x25af26[_0xd44b('0x3c')]=_['intersection'](_0x25af26[_0xd44b('0x33')],_0x25af26[_0xd44b('0x30')]);_0x481523[_0xd44b('0x35')]=_[_0xd44b('0x32')](_0x25af26[_0xd44b('0x33')],qs[_0xd44b('0x34')](_0x3ac6f4['query'][_0xd44b('0x34')]));_0x481523['attributes']=_0x481523['attributes'][_0xd44b('0x36')]?_0x481523[_0xd44b('0x35')]:_0x25af26[_0xd44b('0x33')];_0x481523[_0xd44b('0x39')]=qs[_0xd44b('0x3a')](_0x3ac6f4[_0xd44b('0x30')]['sort']);_0x481523[_0xd44b('0x3b')]=qs['filters'](_[_0xd44b('0x51')](_0x3ac6f4[_0xd44b('0x30')],_0x25af26['filters']));if(_0x3ac6f4[_0xd44b('0x30')]['filter']){_0x481523['where']=_[_0xd44b('0x3e')](_0x481523[_0xd44b('0x3b')],{'$or':_[_0xd44b('0x2a')](_0x481523[_0xd44b('0x35')],function(_0x2e274b){var _0x41c0a9={};_0x41c0a9[_0x2e274b]={'$like':'%'+_0x3ac6f4[_0xd44b('0x30')][_0xd44b('0x3d')]+'%'};return _0x41c0a9;})});}_0x481523=_['merge']({},_0x481523,_0x3ac6f4[_0xd44b('0x3f')]);return _0xb2b393['getConditions'](_0x481523);}})[_0xd44b('0x24')](function(_0x2438fe){if(_0x2438fe){_0x2f5c5c=_0x2438fe['length'];if(!_0x3ac6f4[_0xd44b('0x30')]['hasOwnProperty']('nolimit')){_0x481523[_0xd44b('0x1e')]=qs[_0xd44b('0x1e')](_0x3ac6f4['query']['limit']);_0x481523['offset']=qs[_0xd44b('0x1d')](_0x3ac6f4[_0xd44b('0x30')][_0xd44b('0x1d')]);}return _0xb2b393[_0xd44b('0x4f')](_0x481523);}})[_0xd44b('0x24')](function(_0x6e8ede){if(_0x6e8ede){return _0x6e8ede?{'count':_0x2f5c5c,'rows':_0x6e8ede}:null;}})[_0xd44b('0x24')](respondWithResult(_0x55fdc6,null))[_0xd44b('0x43')](handleError(_0x55fdc6,null));};exports[_0xd44b('0x52')]=function(_0x5f4f66,_0x1d55b1,_0x3beaff){return db[_0xd44b('0x53')][_0xd44b('0x47')]({'where':{'id':_0x5f4f66['params']['id']}})[_0xd44b('0x24')](handleEntityNotFound(_0x1d55b1,null))['then'](function(_0x2b2036){if(_0x2b2036){return _0x2b2036[_0xd44b('0x52')](_0x5f4f66[_0xd44b('0x49')]['ids'],_[_0xd44b('0x4d')](_0x5f4f66['body'],['ids','id'])||{});}})[_0xd44b('0x24')](respondWithResult(_0x1d55b1,null))[_0xd44b('0x43')](handleError(_0x1d55b1,null));};exports[_0xd44b('0x54')]=function(_0x886cf8,_0x22ca85,_0xd9bb1c){var _0x29d234={};var _0x2db881={};var _0xef1de9;var _0x42df86;return db[_0xd44b('0x2b')]['findOne']({'where':{'id':_0x886cf8[_0xd44b('0x44')]['id']}})[_0xd44b('0x24')](handleEntityNotFound(_0x22ca85,null))[_0xd44b('0x24')](function(_0x434915){if(_0x434915){_0xef1de9=_0x434915;_0x2db881[_0xd44b('0x33')]=_['keys'](db[_0xd44b('0x53')][_0xd44b('0x2c')]);_0x2db881[_0xd44b('0x30')]=_[_0xd44b('0x31')](_0x886cf8[_0xd44b('0x30')]);_0x2db881[_0xd44b('0x3c')]=_[_0xd44b('0x32')](_0x2db881[_0xd44b('0x33')],_0x2db881['query']);_0x29d234['attributes']=_[_0xd44b('0x32')](_0x2db881['model'],qs[_0xd44b('0x34')](_0x886cf8['query'][_0xd44b('0x34')]));_0x29d234[_0xd44b('0x35')]=_0x29d234[_0xd44b('0x35')]['length']?_0x29d234['attributes']:_0x2db881[_0xd44b('0x33')];_0x29d234[_0xd44b('0x39')]=qs[_0xd44b('0x3a')](_0x886cf8[_0xd44b('0x30')][_0xd44b('0x3a')]);_0x29d234['where']=qs[_0xd44b('0x3c')](_[_0xd44b('0x51')](_0x886cf8[_0xd44b('0x30')],_0x2db881[_0xd44b('0x3c')]));if(_0x886cf8[_0xd44b('0x30')][_0xd44b('0x3d')]){_0x29d234[_0xd44b('0x3b')]=_[_0xd44b('0x3e')](_0x29d234['where'],{'$or':_['map'](_0x29d234[_0xd44b('0x35')],function(_0x204111){var _0x283e66={};_0x283e66[_0x204111]={'$like':'%'+_0x886cf8[_0xd44b('0x30')][_0xd44b('0x3d')]+'%'};return _0x283e66;})});}_0x29d234=_['merge']({},_0x29d234,_0x886cf8['options']);return _0xef1de9['getActions'](_0x29d234);}})[_0xd44b('0x24')](function(_0x3a86fe){if(_0x3a86fe){_0x42df86=_0x3a86fe[_0xd44b('0x36')];if(!_0x886cf8['query'][_0xd44b('0x37')](_0xd44b('0x38'))){_0x29d234['limit']=qs[_0xd44b('0x1e')](_0x886cf8[_0xd44b('0x30')][_0xd44b('0x1e')]);_0x29d234['offset']=qs[_0xd44b('0x1d')](_0x886cf8[_0xd44b('0x30')]['offset']);}return _0xef1de9[_0xd44b('0x54')](_0x29d234);}})['then'](function(_0x3f4377){if(_0x3f4377){return _0x3f4377?{'count':_0x42df86,'rows':_0x3f4377}:null;}})[_0xd44b('0x24')](respondWithResult(_0x22ca85,null))[_0xd44b('0x43')](handleError(_0x22ca85,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index eb5b591..72399be 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 _0x433a=['define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./automation.attributes','exports'];(function(_0x1e0f8b,_0x5658d6){var _0xc27c9=function(_0x54f9b8){while(--_0x54f9b8){_0x1e0f8b['push'](_0x1e0f8b['shift']());}};_0xc27c9(++_0x5658d6);}(_0x433a,0x19b));var _0xa433=function(_0xda751d,_0x314084){_0xda751d=_0xda751d-0x0;var _0x6e2ff8=_0x433a[_0xda751d];return _0x6e2ff8;};'use strict';var _=require(_0xa433('0x0'));var util=require(_0xa433('0x1'));var logger=require(_0xa433('0x2'))(_0xa433('0x3'));var moment=require(_0xa433('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa433('0x5'));var config=require(_0xa433('0x6'));var attributes=require(_0xa433('0x7'));module[_0xa433('0x8')]=function(_0x403307,_0x38adc4){return _0x403307[_0xa433('0x9')](_0xa433('0xa'),attributes,{'tableName':_0xa433('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa59c=['Automation','tools_automations','lodash','util','request-promise','path','../../config/environment','./automation.attributes','define'];(function(_0x3aa88e,_0x4f2dc8){var _0x3bbdee=function(_0x459c2d){while(--_0x459c2d){_0x3aa88e['push'](_0x3aa88e['shift']());}};_0x3bbdee(++_0x4f2dc8);}(_0xa59c,0x14f));var _0xca59=function(_0x2c2616,_0x14ec49){_0x2c2616=_0x2c2616-0x0;var _0x327d21=_0xa59c[_0x2c2616];return _0x327d21;};'use strict';var _=require(_0xca59('0x0'));var util=require(_0xca59('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xca59('0x2'));var fs=require('fs');var path=require(_0xca59('0x3'));var rimraf=require('rimraf');var config=require(_0xca59('0x4'));var attributes=require(_0xca59('0x5'));module['exports']=function(_0x4cdeaa,_0x161d65){return _0x4cdeaa[_0xca59('0x6')](_0xca59('0x7'),attributes,{'tableName':_0xca59('0x8'),'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 b00469a..5150ce8 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 _0xb1fa=['code','error','message','catch','moment','randomstring','../../config/environment','request','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x19b4ce,_0x187040){var _0x180b52=function(_0x44c611){while(--_0x44c611){_0x19b4ce['push'](_0x19b4ce['shift']());}};_0x180b52(++_0x187040);}(_0xb1fa,0x9e));var _0xab1f=function(_0x650fad,_0x94912f){_0x650fad=_0x650fad-0x0;var _0x1b569e=_0xb1fa[_0x650fad];return _0x1b569e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xab1f('0x0'));var BPromise=require('bluebird');var rs=require(_0xab1f('0x1'));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(_0xab1f('0x2'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x463442,_0x54c5b0,_0x17e178){return new BPromise(function(_0x2fbc7e,_0x5213a4){return client[_0xab1f('0x3')](_0x463442,_0x17e178)['then'](function(_0x578cf7){logger[_0xab1f('0x4')](_0xab1f('0x5'),_0x54c5b0,_0xab1f('0x6'));logger[_0xab1f('0x7')](_0xab1f('0x8'),_0x54c5b0,'request\x20sent',JSON[_0xab1f('0x9')](_0x578cf7));if(_0x578cf7['error']){if(_0x578cf7['error'][_0xab1f('0xa')]===0x1f4){logger[_0xab1f('0xb')]('Automation,\x20%s,\x20%s',_0x54c5b0,_0x578cf7['error'][_0xab1f('0xc')]);return _0x5213a4(_0x578cf7['error'][_0xab1f('0xc')]);}logger[_0xab1f('0xb')](_0xab1f('0x5'),_0x54c5b0,_0x578cf7['error'][_0xab1f('0xc')]);return _0x2fbc7e(_0x578cf7[_0xab1f('0xb')][_0xab1f('0xc')]);}else{logger[_0xab1f('0x4')]('Automation,\x20%s,\x20%s',_0x54c5b0,_0xab1f('0x6'));_0x2fbc7e(_0x578cf7['result'][_0xab1f('0xc')]);}})[_0xab1f('0xd')](function(_0xcdba98){logger['error'](_0xab1f('0x5'),_0x54c5b0,_0xcdba98);_0x5213a4(_0xcdba98);});});} \ No newline at end of file +var _0x958a=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x2713e1,_0xfd4305){var _0x4bd714=function(_0x359529){while(--_0x359529){_0x2713e1['push'](_0x2713e1['shift']());}};_0x4bd714(++_0xfd4305);}(_0x958a,0x128));var _0xa958=function(_0x3aaa0b,_0xe53b50){_0x3aaa0b=_0x3aaa0b-0x0;var _0x29e865=_0x958a[_0x3aaa0b];return _0x29e865;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var moment=require('moment');var BPromise=require(_0xa958('0x2'));var rs=require(_0xa958('0x3'));var fs=require('fs');var Redis=require(_0xa958('0x4'));var db=require(_0xa958('0x5'))['db'];var utils=require(_0xa958('0x6'));var logger=require('../../config/logger')(_0xa958('0x7'));var config=require('../../config/environment');var jayson=require(_0xa958('0x8'));var client=jayson[_0xa958('0x9')][_0xa958('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ddaa9,_0x3ca01f,_0x3b2693){return new BPromise(function(_0x1895da,_0x54c0e0){return client['request'](_0x3ddaa9,_0x3b2693)[_0xa958('0xb')](function(_0x249764){logger[_0xa958('0xc')](_0xa958('0xd'),_0x3ca01f,_0xa958('0xe'));logger[_0xa958('0xf')](_0xa958('0x10'),_0x3ca01f,_0xa958('0xe'),JSON[_0xa958('0x11')](_0x249764));if(_0x249764[_0xa958('0x12')]){if(_0x249764[_0xa958('0x12')][_0xa958('0x13')]===0x1f4){logger[_0xa958('0x12')]('Automation,\x20%s,\x20%s',_0x3ca01f,_0x249764['error']['message']);return _0x54c0e0(_0x249764[_0xa958('0x12')][_0xa958('0x14')]);}logger[_0xa958('0x12')]('Automation,\x20%s,\x20%s',_0x3ca01f,_0x249764[_0xa958('0x12')]['message']);return _0x1895da(_0x249764['error']['message']);}else{logger[_0xa958('0xc')](_0xa958('0xd'),_0x3ca01f,_0xa958('0xe'));_0x1895da(_0x249764[_0xa958('0x15')][_0xa958('0x14')]);}})[_0xa958('0x16')](function(_0x23736f){logger[_0xa958('0x12')]('Automation,\x20%s,\x20%s',_0x3ca01f,_0x23736f);_0x54c0e0(_0x23736f);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 4476df8..8a2f13e 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 _0x3937=['delete','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','getConditions','post','/:id/conditions','/:id/actions','addActions','put','update'];(function(_0x35c1db,_0xd75c15){var _0x4173ff=function(_0x5d6901){while(--_0x5d6901){_0x35c1db['push'](_0x35c1db['shift']());}};_0x4173ff(++_0xd75c15);}(_0x3937,0xbf));var _0x7393=function(_0x4afc56,_0x5c8d69){_0x4afc56=_0x4afc56-0x0;var _0xbb0c35=_0x3937[_0x4afc56];return _0xbb0c35;};'use strict';var multer=require(_0x7393('0x0'));var util=require('util');var path=require(_0x7393('0x1'));var timeout=require(_0x7393('0x2'));var express=require('express');var router=express[_0x7393('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7393('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7393('0x5'));var controller=require(_0x7393('0x6'));router[_0x7393('0x7')]('/',auth[_0x7393('0x8')](),controller[_0x7393('0x9')]);router[_0x7393('0x7')](_0x7393('0xa'),auth[_0x7393('0x8')](),controller[_0x7393('0xb')]);router['get']('/:id/conditions',auth[_0x7393('0x8')](),controller[_0x7393('0xc')]);router[_0x7393('0x7')]('/:id/actions',auth[_0x7393('0x8')](),controller['getActions']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7393('0xd')](_0x7393('0xe'),auth[_0x7393('0x8')](),controller['addConditions']);router[_0x7393('0xd')](_0x7393('0xf'),auth[_0x7393('0x8')](),controller[_0x7393('0x10')]);router[_0x7393('0x11')](_0x7393('0xa'),auth[_0x7393('0x8')](),controller[_0x7393('0x12')]);router[_0x7393('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7393('0x14')]);module['exports']=router; \ No newline at end of file +var _0x074a=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','destroy'];(function(_0x3c6125,_0x3b2a9c){var _0x2f47b8=function(_0x214650){while(--_0x214650){_0x3c6125['push'](_0x3c6125['shift']());}};_0x2f47b8(++_0x3b2a9c);}(_0x074a,0x97));var _0xa074=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x074a[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xa074('0x0'));var util=require(_0xa074('0x1'));var path=require(_0xa074('0x2'));var timeout=require(_0xa074('0x3'));var express=require('express');var router=express[_0xa074('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa074('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa074('0x6'));router[_0xa074('0x7')]('/',auth[_0xa074('0x8')](),controller[_0xa074('0x9')]);router[_0xa074('0x7')](_0xa074('0xa'),auth[_0xa074('0x8')](),controller[_0xa074('0xb')]);router[_0xa074('0x7')](_0xa074('0xc'),auth[_0xa074('0x8')](),controller[_0xa074('0xd')]);router[_0xa074('0x7')](_0xa074('0xe'),auth[_0xa074('0x8')](),controller[_0xa074('0xf')]);router[_0xa074('0x10')]('/',auth[_0xa074('0x8')](),controller[_0xa074('0x11')]);router[_0xa074('0x10')](_0xa074('0xc'),auth[_0xa074('0x8')](),controller[_0xa074('0x12')]);router[_0xa074('0x10')](_0xa074('0xe'),auth[_0xa074('0x8')](),controller[_0xa074('0x13')]);router[_0xa074('0x14')](_0xa074('0xa'),auth[_0xa074('0x8')](),controller[_0xa074('0x15')]);router[_0xa074('0x16')]('/:id',auth[_0xa074('0x8')](),controller[_0xa074('0x17')]);module[_0xa074('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 5af21f9..475a2b3 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 _0x96cf=['Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','ivr','STRING','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ENUM','DESC','ASC'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x96cf,0x143));var _0xf96c=function(_0x411c7a,_0x449230){_0x411c7a=_0x411c7a-0x0;var _0x38479b=_0x96cf[_0x411c7a];return _0x38479b;};'use strict';var Sequelize=require(_0xf96c('0x0'));module[_0xf96c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xf96c('0x2')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xf96c('0x3')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xf96c('0x4')},'limitCalls':{'type':Sequelize[_0xf96c('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xf96c('0x6')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xf96c('0x3')]},'dialOriginateTimeout':{'type':Sequelize[_0xf96c('0x5')](0x3)[_0xf96c('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf96c('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xf96c('0x5')](0x3)[_0xf96c('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf96c('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf96c('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf96c('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xf96c('0x5')](0x3)[_0xf96c('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf96c('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xf96c('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf96c('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf96c('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf96c('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xf96c('0x5')](0x3)[_0xf96c('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xf96c('0xd')},'dialTimezone':{'type':Sequelize[_0xf96c('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xf96c('0xe'),_0xf96c('0xf'),_0xf96c('0x10')),'defaultValue':_0xf96c('0xe')},'dialAMDActive':{'type':Sequelize[_0xf96c('0x11')],'defaultValue':0x0,'comment':_0xf96c('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xf96c('0x5')](0x9)[_0xf96c('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xf96c('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xf96c('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xf96c('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xf96c('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf96c('0x5')](0x9)[_0xf96c('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xf96c('0x5')](0x9)[_0xf96c('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xf96c('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xf96c('0x5')](0x9)[_0xf96c('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xf96c('0x5')](0x9)[_0xf96c('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xf96c('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf96c('0x5')](0x5)[_0xf96c('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xf96c('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xf96c('0x5')](0x9)[_0xf96c('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf96c('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0xf96c('0x19')](_0xf96c('0x1a'),_0xf96c('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xf96c('0x3')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf96c('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf96c('0x1c')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xf96c('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf96c('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf96c('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf96c('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf96c('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf96c('0x1f')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf96c('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf96c('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf96c('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf96c('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xf96c('0x5')](0x3)[_0xf96c('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf96c('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf96c('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0xf96c('0x5')](0x3)[_0xf96c('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf96c('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0xf96c('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf96c('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf96c('0x5')](0x3)[_0xf96c('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf96c('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf96c('0x26')}}; \ No newline at end of file +var _0x42a1=['#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#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','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','STRING','BOOLEAN','INTEGER','UNSIGNED','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)'];(function(_0x115fdb,_0x338195){var _0x36edb7=function(_0xefbbe0){while(--_0xefbbe0){_0x115fdb['push'](_0x115fdb['shift']());}};_0x36edb7(++_0x338195);}(_0x42a1,0x123));var _0x142a=function(_0x4a5494,_0x3ad336){_0x4a5494=_0x4a5494-0x0;var _0x57cbb5=_0x42a1[_0x4a5494];return _0x57cbb5;};'use strict';var Sequelize=require(_0x142a('0x0'));module[_0x142a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x142a('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x142a('0x3')](_0x142a('0x4')),'allowNull':![],'defaultValue':_0x142a('0x4')},'description':{'type':Sequelize[_0x142a('0x5')]},'active':{'type':Sequelize[_0x142a('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x142a('0x7')](0x4)[_0x142a('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x142a('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0x142a('0x7')](0x3)[_0x142a('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x142a('0x7')](0x3)[_0x142a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x142a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x142a('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x142a('0x7')](0x3)[_0x142a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x142a('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x142a('0x7')](0x5)[_0x142a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x142a('0x7')](0x3)[_0x142a('0x8')],'defaultValue':0x3,'comment':_0x142a('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x142a('0x7')](0x5)[_0x142a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x142a('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x142a('0x7')](0x3)[_0x142a('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x142a('0xd')},'dialTimezone':{'type':Sequelize[_0x142a('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x142a('0x5')],'defaultValue':_0x142a('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x142a('0x3')](_0x142a('0xf'),_0x142a('0x10'),_0x142a('0x11')),'defaultValue':_0x142a('0xf')},'dialAMDActive':{'type':Sequelize[_0x142a('0x6')],'defaultValue':0x0,'comment':_0x142a('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x142a('0x7')](0x9)[_0x142a('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x142a('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x142a('0x7')](0x9)[_0x142a('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x142a('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x142a('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x142a('0x7')](0x9)[_0x142a('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x142a('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x142a('0x7')](0x9)[_0x142a('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x142a('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x142a('0x7')](0x9)[_0x142a('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x142a('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x142a('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x142a('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x142a('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x142a('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x142a('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x142a('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x142a('0x3')](_0x142a('0x1b'),_0x142a('0x1c')),'defaultValue':_0x142a('0x1b')},'dialPrefix':{'type':Sequelize[_0x142a('0x5')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x142a('0x7')](0x3)[_0x142a('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x142a('0x1d')},'dialCutDigit':{'type':Sequelize[_0x142a('0x7')](0x3)[_0x142a('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x142a('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x142a('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x142a('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x142a('0x7')](0x5)[_0x142a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x142a('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x142a('0x7')](0x3)[_0x142a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x142a('0x7')](0x5)[_0x142a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x142a('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x142a('0x7')](0x3)[_0x142a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x142a('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x142a('0x7')](0x5)[_0x142a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x142a('0x7')](0x3)[_0x142a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x142a('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x142a('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x142a('0x7')](0x3)[_0x142a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x142a('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x142a('0x7')](0x5)[_0x142a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x142a('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 3cfd36b..4ddcb25 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 _0x58a7=['get','UserProfileResource','error','stack','name','map','Campaign','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','fields','length','model','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','find','autoAssociation','clone','omit','createdAt','updatedAt','userProfileId','getHoppers','params','CmHopper','hasOwnProperty','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','findOne','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','insert','into','fromQuery','phone','scheduledAt','ContactId','select','field','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','ListId','NOW()','cmHopperId','ci.item','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then'];(function(_0x1792c6,_0x5e5f01){var _0x250b50=function(_0x54429b){while(--_0x54429b){_0x1792c6['push'](_0x1792c6['shift']());}};_0x250b50(++_0x5e5f01);}(_0x58a7,0xf7));var _0x758a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x58a7[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x758a('0x0'));var rimraf=require(_0x758a('0x1'));var zipdir=require(_0x758a('0x2'));var jsonpatch=require(_0x758a('0x3'));var rp=require(_0x758a('0x4'));var moment=require(_0x758a('0x5'));var BPromise=require(_0x758a('0x6'));var Mustache=require(_0x758a('0x7'));var util=require('util');var path=require(_0x758a('0x8'));var sox=require(_0x758a('0x9'));var csv=require(_0x758a('0xa'));var ejs=require(_0x758a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x758a('0xc'));var crypto=require('crypto');var jsforce=require(_0x758a('0xd'));var deskjs=require(_0x758a('0xe'));var toCsv=require(_0x758a('0xa'));var querystring=require(_0x758a('0xf'));var Papa=require(_0x758a('0x10'));var Redis=require(_0x758a('0x11'));var authService=require(_0x758a('0x12'));var qs=require(_0x758a('0x13'));var as=require(_0x758a('0x14'));var hardwareService=require(_0x758a('0x15'));var logger=require(_0x758a('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x758a('0x17'));var licenseUtil=require(_0x758a('0x18'));var db=require(_0x758a('0x19'))['db'];function respondWithStatusCode(_0x4c2dfc,_0x3e1ee0){_0x3e1ee0=_0x3e1ee0||0xcc;return function(_0x2cc841){if(_0x2cc841){return _0x4c2dfc[_0x758a('0x1a')](_0x3e1ee0);}return _0x4c2dfc[_0x758a('0x1b')](_0x3e1ee0)[_0x758a('0x1c')]();};}function respondWithResult(_0x541d85,_0x4b0b39){_0x4b0b39=_0x4b0b39||0xc8;return function(_0x4581df){if(_0x4581df){return _0x541d85[_0x758a('0x1b')](_0x4b0b39)[_0x758a('0x1d')](_0x4581df);}};}function respondWithFilteredResult(_0x54dec5,_0x4e4aee){return function(_0x5a9512){if(_0x5a9512){var _0x5bdbfb=typeof _0x4e4aee[_0x758a('0x1e')]===_0x758a('0x1f')&&typeof _0x4e4aee['limit']===_0x758a('0x1f');var _0x2f28f3=_0x5a9512[_0x758a('0x20')];var _0x12dc48=_0x5bdbfb?0x0:_0x4e4aee[_0x758a('0x1e')];var _0x23a1c2=_0x5bdbfb?_0x5a9512[_0x758a('0x20')]:_0x4e4aee[_0x758a('0x1e')]+_0x4e4aee[_0x758a('0x21')];var _0x15653b;if(_0x23a1c2>=_0x2f28f3){_0x23a1c2=_0x2f28f3;_0x15653b=0xc8;}else{_0x15653b=0xce;}_0x54dec5[_0x758a('0x1b')](_0x15653b);return _0x54dec5[_0x758a('0x22')](_0x758a('0x23'),_0x12dc48+'-'+_0x23a1c2+'/'+_0x2f28f3)[_0x758a('0x1d')](_0x5a9512);}return null;};}function patchUpdates(_0x1f7a34){return function(_0x1effec){try{jsonpatch['apply'](_0x1effec,_0x1f7a34,!![]);}catch(_0xc3f455){return BPromise[_0x758a('0x24')](_0xc3f455);}return _0x1effec[_0x758a('0x25')]();};}function saveUpdates(_0x3ba95e,_0x239fd9){return function(_0x26acb8){if(_0x26acb8){return _0x26acb8[_0x758a('0x26')](_0x3ba95e)['then'](function(_0x1bc4e2){return _0x1bc4e2;});}return null;};}function removeEntity(_0x24d5cf,_0x56a99a){return function(_0x4b1e08){if(_0x4b1e08){return _0x4b1e08[_0x758a('0x27')]()[_0x758a('0x28')](function(){var _0x1a73d5=_0x4b1e08[_0x758a('0x29')]({'plain':!![]});var _0x3c1292='IvrCampaigns';return db[_0x758a('0x2a')]['destroy']({'where':{'type':_0x3c1292,'resourceId':_0x1a73d5['id']}})['then'](function(){return _0x4b1e08;});})[_0x758a('0x28')](function(){_0x24d5cf[_0x758a('0x1b')](0xcc)[_0x758a('0x1c')]();});}};}function handleEntityNotFound(_0x48eee8,_0x14600a){return function(_0x327082){if(!_0x327082){_0x48eee8[_0x758a('0x1a')](0x194);}return _0x327082;};}function handleError(_0x26e8b2,_0x46122e){_0x46122e=_0x46122e||0x1f4;return function(_0xcd4549){logger[_0x758a('0x2b')](_0xcd4549[_0x758a('0x2c')]);if(_0xcd4549[_0x758a('0x2d')]){delete _0xcd4549[_0x758a('0x2d')];}_0x26e8b2[_0x758a('0x1b')](_0x46122e)['send'](_0xcd4549);};}exports['index']=function(_0x10850b,_0x1cd222){var _0x150ce5={},_0x426d5e={},_0x26d18d={'count':0x0,'rows':[]};var _0x301508=_[_0x758a('0x2e')](db[_0x758a('0x2f')][_0x758a('0x30')],function(_0x316a67){return{'name':_0x316a67[_0x758a('0x31')],'type':_0x316a67[_0x758a('0x32')][_0x758a('0x33')]};});_0x426d5e['model']=_[_0x758a('0x2e')](_0x301508,_0x758a('0x2d'));_0x426d5e['query']=_[_0x758a('0x34')](_0x10850b[_0x758a('0x35')]);_0x426d5e[_0x758a('0x36')]=_[_0x758a('0x37')](_0x426d5e['model'],_0x426d5e['query']);_0x150ce5[_0x758a('0x38')]=_[_0x758a('0x37')](_0x426d5e['model'],qs['fields'](_0x10850b[_0x758a('0x35')][_0x758a('0x39')]));_0x150ce5[_0x758a('0x38')]=_0x150ce5[_0x758a('0x38')][_0x758a('0x3a')]?_0x150ce5['attributes']:_0x426d5e[_0x758a('0x3b')];if(!_0x10850b['query']['hasOwnProperty'](_0x758a('0x3c'))){_0x150ce5[_0x758a('0x21')]=qs[_0x758a('0x21')](_0x10850b[_0x758a('0x35')][_0x758a('0x21')]);_0x150ce5['offset']=qs[_0x758a('0x1e')](_0x10850b[_0x758a('0x35')][_0x758a('0x1e')]);}_0x150ce5[_0x758a('0x3d')]=qs[_0x758a('0x3e')](_0x10850b[_0x758a('0x35')][_0x758a('0x3e')]);_0x150ce5['where']=qs[_0x758a('0x36')](_[_0x758a('0x3f')](_0x10850b[_0x758a('0x35')],_0x426d5e[_0x758a('0x36')]),_0x301508);if(_0x10850b[_0x758a('0x35')]['filter']){_0x150ce5[_0x758a('0x40')]=_[_0x758a('0x41')](_0x150ce5[_0x758a('0x40')],{'$or':_['map'](_0x301508,function(_0xde498e){if(_0xde498e['type']!==_0x758a('0x42')){var _0x16eed5={};_0x16eed5[_0xde498e['name']]={'$like':'%'+_0x10850b[_0x758a('0x35')][_0x758a('0x43')]+'%'};return _0x16eed5;}})});}_0x150ce5=_[_0x758a('0x41')]({},_0x150ce5,_0x10850b[_0x758a('0x44')]);var _0x1fb698={'where':_0x150ce5[_0x758a('0x40')]};return db[_0x758a('0x2f')][_0x758a('0x20')](_0x1fb698)[_0x758a('0x28')](function(_0x18afc8){_0x26d18d[_0x758a('0x20')]=_0x18afc8;if(_0x10850b[_0x758a('0x35')][_0x758a('0x45')]){_0x150ce5[_0x758a('0x46')]=[{'all':!![]}];}return db[_0x758a('0x2f')][_0x758a('0x47')](_0x150ce5);})[_0x758a('0x28')](function(_0x3a7bca){_0x26d18d[_0x758a('0x48')]=_0x3a7bca;return _0x26d18d;})['then'](respondWithFilteredResult(_0x1cd222,_0x150ce5))[_0x758a('0x49')](handleError(_0x1cd222,null));};exports[_0x758a('0x4a')]=function(_0x558a2d,_0x5a347e){var _0x1a58f0={'raw':![],'where':{'id':_0x558a2d['params']['id']}},_0x5441ad={};_0x5441ad[_0x758a('0x3b')]=_[_0x758a('0x34')](db['Campaign'][_0x758a('0x30')]);_0x5441ad[_0x758a('0x35')]=_[_0x758a('0x34')](_0x558a2d[_0x758a('0x35')]);_0x5441ad[_0x758a('0x36')]=_[_0x758a('0x37')](_0x5441ad[_0x758a('0x3b')],_0x5441ad[_0x758a('0x35')]);_0x1a58f0['attributes']=_['intersection'](_0x5441ad[_0x758a('0x3b')],qs[_0x758a('0x39')](_0x558a2d[_0x758a('0x35')][_0x758a('0x39')]));_0x1a58f0[_0x758a('0x38')]=_0x1a58f0[_0x758a('0x38')][_0x758a('0x3a')]?_0x1a58f0[_0x758a('0x38')]:_0x5441ad[_0x758a('0x3b')];if(_0x558a2d['query'][_0x758a('0x45')]){_0x1a58f0['include']=[{'all':!![]}];}_0x1a58f0=_['merge']({},_0x1a58f0,_0x558a2d[_0x758a('0x44')]);return db[_0x758a('0x2f')]['find'](_0x1a58f0)[_0x758a('0x28')](handleEntityNotFound(_0x5a347e,null))[_0x758a('0x28')](respondWithResult(_0x5a347e,null))[_0x758a('0x49')](handleError(_0x5a347e,null));};exports[_0x758a('0x4b')]=function(_0xad36ac,_0x5c4645){return db[_0x758a('0x2f')][_0x758a('0x4b')](_0xad36ac[_0x758a('0x4c')],{})[_0x758a('0x28')](function(_0x7328f6){var _0x5df989=_0xad36ac[_0x758a('0x4d')]['get']({'plain':!![]});if(!_0x5df989)throw new Error(_0x758a('0x4e'));if(_0x5df989[_0x758a('0x4f')]===_0x758a('0x4d')){var _0x2537d5=_0x7328f6[_0x758a('0x29')]({'plain':!![]});var _0x130abf=_0x758a('0x50');return db[_0x758a('0x51')][_0x758a('0x52')]({'where':{'name':_0x130abf,'userProfileId':_0x5df989['userProfileId']},'raw':!![]})[_0x758a('0x28')](function(_0x406ca1){if(_0x406ca1&&_0x406ca1[_0x758a('0x53')]===0x0){return db[_0x758a('0x2a')]['create']({'name':_0x2537d5[_0x758a('0x2d')],'resourceId':_0x2537d5['id'],'type':_0x406ca1[_0x758a('0x2d')],'sectionId':_0x406ca1['id']},{})[_0x758a('0x28')](function(){return _0x7328f6;});}else{return _0x7328f6;}})[_0x758a('0x49')](function(_0x33c70a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33c70a);throw _0x33c70a;});}return _0x7328f6;})['then'](respondWithResult(_0x5c4645,0xc9))[_0x758a('0x49')](handleError(_0x5c4645,null));};exports[_0x758a('0x54')]=function(_0x80e8ef,_0x5134f1){var _0x5f3c5d={'where':{'id':_0x80e8ef['params']['id']}},_0x53f3b0={};_0x53f3b0[_0x758a('0x3b')]=_[_0x758a('0x34')](db[_0x758a('0x2f')][_0x758a('0x30')]);_0x5f3c5d[_0x758a('0x38')]=_[_0x758a('0x37')](_0x53f3b0[_0x758a('0x3b')],qs[_0x758a('0x39')](_0x80e8ef[_0x758a('0x35')][_0x758a('0x39')]));_0x5f3c5d[_0x758a('0x38')]=_0x5f3c5d[_0x758a('0x38')]['length']?_0x5f3c5d['attributes']:_0x53f3b0[_0x758a('0x3b')];if(_0x80e8ef[_0x758a('0x35')][_0x758a('0x45')]){_0x5f3c5d[_0x758a('0x46')]=[{'all':!![]}];}_0x5f3c5d=_['merge']({},_0x5f3c5d,_0x80e8ef[_0x758a('0x44')]);return db[_0x758a('0x2f')][_0x758a('0x52')](_0x5f3c5d)[_0x758a('0x28')](handleEntityNotFound(_0x5134f1,null))[_0x758a('0x28')](function(_0x3ab575){if(_0x3ab575){var _0x1275fb=_0x3ab575['get']({'plain':!![]});_0x1275fb=qs[_0x758a('0x55')](_0x1275fb,['id',_0x758a('0x56'),_0x758a('0x57')]);_0x80e8ef['body']=_[_0x758a('0x55')](_0x80e8ef[_0x758a('0x4c')],['id',_0x758a('0x56'),_0x758a('0x57')]);return db[_0x758a('0x2f')][_0x758a('0x4b')](_[_0x758a('0x41')](_0x1275fb,_0x80e8ef[_0x758a('0x4c')]),{'include':_0x80e8ef[_0x758a('0x35')][_0x758a('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x13ebf8){var _0x583e22=_0x80e8ef[_0x758a('0x4d')][_0x758a('0x29')]({'plain':!![]});if(!_0x583e22)throw new Error(_0x758a('0x4e'));if(_0x583e22[_0x758a('0x4f')]==='user'){var _0x20809a=_0x13ebf8[_0x758a('0x29')]({'plain':!![]});var _0x3543d0=_0x758a('0x50');return db[_0x758a('0x51')][_0x758a('0x52')]({'where':{'name':_0x3543d0,'userProfileId':_0x583e22[_0x758a('0x58')]},'raw':!![]})[_0x758a('0x28')](function(_0x25b99c){if(_0x25b99c&&_0x25b99c[_0x758a('0x53')]===0x0){return db[_0x758a('0x2a')]['create']({'name':_0x20809a[_0x758a('0x2d')],'resourceId':_0x20809a['id'],'type':_0x25b99c[_0x758a('0x2d')],'sectionId':_0x25b99c['id']},{})[_0x758a('0x28')](function(){return _0x13ebf8;});}else{return _0x13ebf8;}})[_0x758a('0x49')](function(_0x2ac8ec){logger[_0x758a('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ac8ec);throw _0x2ac8ec;});}return _0x13ebf8;});}})[_0x758a('0x28')](respondWithResult(_0x5134f1,0xc9))[_0x758a('0x49')](handleError(_0x5134f1,null));};exports['update']=function(_0x71073f,_0xe9c69e){if(_0x71073f[_0x758a('0x4c')]['id']){delete _0x71073f['body']['id'];}return db[_0x758a('0x2f')][_0x758a('0x52')]({'where':{'id':_0x71073f['params']['id']}})['then'](handleEntityNotFound(_0xe9c69e,null))[_0x758a('0x28')](saveUpdates(_0x71073f[_0x758a('0x4c')],null))['then'](respondWithResult(_0xe9c69e,null))[_0x758a('0x49')](handleError(_0xe9c69e,null));};exports['destroy']=function(_0x486167,_0x595451){return db['Campaign'][_0x758a('0x52')]({'where':{'id':_0x486167['params']['id']}})['then'](handleEntityNotFound(_0x595451,null))[_0x758a('0x28')](removeEntity(_0x595451,null))[_0x758a('0x49')](handleError(_0x595451,null));};exports[_0x758a('0x59')]=function(_0x4e5619,_0x3f734a,_0x4cc342){var _0x3036aa={'raw':!![],'where':{}};var _0x5b059c={};var _0x36a651={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x4e5619[_0x758a('0x5a')]['id']}})[_0x758a('0x28')](handleEntityNotFound(_0x3f734a,null))['then'](function(_0x8460df){if(_0x8460df){_0x5b059c['model']=_['keys'](db[_0x758a('0x5b')][_0x758a('0x30')]);_0x5b059c[_0x758a('0x35')]=_['keys'](_0x4e5619[_0x758a('0x35')]);_0x5b059c[_0x758a('0x36')]=_[_0x758a('0x37')](_0x5b059c[_0x758a('0x3b')],_0x5b059c[_0x758a('0x35')]);_0x3036aa['attributes']=_['intersection'](_0x5b059c[_0x758a('0x3b')],qs[_0x758a('0x39')](_0x4e5619['query']['fields']));_0x3036aa[_0x758a('0x38')]=_0x3036aa[_0x758a('0x38')][_0x758a('0x3a')]?_0x3036aa[_0x758a('0x38')]:_0x5b059c['model'];if(!_0x4e5619[_0x758a('0x35')][_0x758a('0x5c')](_0x758a('0x3c'))){_0x3036aa['limit']=qs[_0x758a('0x21')](_0x4e5619[_0x758a('0x35')][_0x758a('0x21')]);_0x3036aa[_0x758a('0x1e')]=qs[_0x758a('0x1e')](_0x4e5619['query']['offset']);}_0x3036aa[_0x758a('0x3d')]=qs[_0x758a('0x3e')](_0x4e5619[_0x758a('0x35')]['sort']);_0x3036aa[_0x758a('0x40')]=qs[_0x758a('0x36')](_[_0x758a('0x3f')](_0x4e5619['query'],_0x5b059c[_0x758a('0x36')]));_0x3036aa[_0x758a('0x40')][_0x758a('0x5d')]=_0x8460df['id'];if(_0x4e5619[_0x758a('0x35')][_0x758a('0x43')]){_0x3036aa['where']=_[_0x758a('0x41')](_0x3036aa[_0x758a('0x40')],{'$or':_['map'](_0x3036aa[_0x758a('0x38')],function(_0x428667){var _0x47d105={};_0x47d105[_0x428667]={'$like':'%'+_0x4e5619[_0x758a('0x35')][_0x758a('0x43')]+'%'};return _0x47d105;})});}_0x3036aa=_['merge']({},_0x3036aa,_0x4e5619[_0x758a('0x44')]);return db[_0x758a('0x5b')]['count']({'where':_0x3036aa[_0x758a('0x40')]})['then'](function(_0x37f86b){_0x36a651[_0x758a('0x20')]=_0x37f86b;if(_0x4e5619[_0x758a('0x35')][_0x758a('0x45')]){_0x3036aa[_0x758a('0x46')]=[{'all':!![]}];}return db[_0x758a('0x5b')]['findAll'](_0x3036aa);})[_0x758a('0x28')](function(_0x1ef073){_0x36a651[_0x758a('0x48')]=_0x1ef073;return _0x36a651;});}})[_0x758a('0x28')](respondWithFilteredResult(_0x3f734a,_0x3036aa))[_0x758a('0x49')](handleError(_0x3f734a,null));};exports[_0x758a('0x5e')]=function(_0x430334,_0x350d15,_0x50f304){var _0x404560={'raw':!![],'where':{}};var _0x596857={};var _0x5e9953={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x430334[_0x758a('0x5a')]['id']}})[_0x758a('0x28')](handleEntityNotFound(_0x350d15,null))[_0x758a('0x28')](function(_0x4812aa){if(_0x4812aa){_0x596857[_0x758a('0x3b')]=_['keys'](db[_0x758a('0x5f')][_0x758a('0x30')]);_0x596857[_0x758a('0x35')]=_[_0x758a('0x34')](_0x430334[_0x758a('0x35')]);_0x596857[_0x758a('0x36')]=_[_0x758a('0x37')](_0x596857['model'],_0x596857[_0x758a('0x35')]);_0x404560[_0x758a('0x38')]=_['intersection'](_0x596857[_0x758a('0x3b')],qs[_0x758a('0x39')](_0x430334[_0x758a('0x35')][_0x758a('0x39')]));_0x404560[_0x758a('0x38')]=_0x404560[_0x758a('0x38')][_0x758a('0x3a')]?_0x404560[_0x758a('0x38')]:_0x596857['model'];if(!_0x430334[_0x758a('0x35')][_0x758a('0x5c')](_0x758a('0x3c'))){_0x404560[_0x758a('0x21')]=qs[_0x758a('0x21')](_0x430334[_0x758a('0x35')][_0x758a('0x21')]);_0x404560['offset']=qs[_0x758a('0x1e')](_0x430334[_0x758a('0x35')][_0x758a('0x1e')]);}_0x404560[_0x758a('0x3d')]=qs['sort'](_0x430334[_0x758a('0x35')][_0x758a('0x3e')]);_0x404560[_0x758a('0x40')]=qs[_0x758a('0x36')](_['pick'](_0x430334[_0x758a('0x35')],_0x596857[_0x758a('0x36')]));_0x404560[_0x758a('0x40')][_0x758a('0x5d')]=_0x4812aa['id'];if(_0x430334['query']['filter']){_0x404560[_0x758a('0x40')]=_[_0x758a('0x41')](_0x404560['where'],{'$or':_[_0x758a('0x2e')](_0x404560[_0x758a('0x38')],function(_0x320649){var _0x3115c6={};_0x3115c6[_0x320649]={'$like':'%'+_0x430334[_0x758a('0x35')][_0x758a('0x43')]+'%'};return _0x3115c6;})});}_0x404560=_[_0x758a('0x41')]({},_0x404560,_0x430334[_0x758a('0x44')]);return db[_0x758a('0x5f')][_0x758a('0x20')]({'where':_0x404560[_0x758a('0x40')]})['then'](function(_0x276abe){_0x5e9953[_0x758a('0x20')]=_0x276abe;if(_0x430334[_0x758a('0x35')][_0x758a('0x45')]){_0x404560[_0x758a('0x46')]=[{'all':!![]}];}return db[_0x758a('0x5f')][_0x758a('0x47')](_0x404560);})['then'](function(_0xb959fe){_0x5e9953[_0x758a('0x48')]=_0xb959fe;return _0x5e9953;});}})['then'](respondWithFilteredResult(_0x350d15,_0x404560))[_0x758a('0x49')](handleError(_0x350d15,null));};exports[_0x758a('0x60')]=function(_0x239791,_0x2abc65,_0x4003a5){var _0x533fe5={'raw':!![],'where':{}};var _0x25fddf={};var _0x466471={'count':0x0,'rows':[]};return db[_0x758a('0x2f')][_0x758a('0x61')]({'where':{'id':_0x239791['params']['id']}})[_0x758a('0x28')](handleEntityNotFound(_0x2abc65,null))['then'](function(_0x5b9b7a){if(_0x5b9b7a){_0x25fddf['model']=_[_0x758a('0x34')](db[_0x758a('0x62')][_0x758a('0x30')]);_0x25fddf[_0x758a('0x35')]=_[_0x758a('0x34')](_0x239791[_0x758a('0x35')]);_0x25fddf[_0x758a('0x36')]=_[_0x758a('0x37')](_0x25fddf[_0x758a('0x3b')],_0x25fddf[_0x758a('0x35')]);_0x533fe5['attributes']=_['intersection'](_0x25fddf['model'],qs[_0x758a('0x39')](_0x239791[_0x758a('0x35')]['fields']));_0x533fe5[_0x758a('0x38')]=_0x533fe5[_0x758a('0x38')][_0x758a('0x3a')]?_0x533fe5['attributes']:_0x25fddf[_0x758a('0x3b')];if(!_0x239791[_0x758a('0x35')][_0x758a('0x5c')](_0x758a('0x3c'))){_0x533fe5[_0x758a('0x21')]=qs[_0x758a('0x21')](_0x239791[_0x758a('0x35')]['limit']);_0x533fe5[_0x758a('0x1e')]=qs['offset'](_0x239791[_0x758a('0x35')][_0x758a('0x1e')]);}_0x533fe5[_0x758a('0x3d')]=qs[_0x758a('0x3e')](_0x239791['query'][_0x758a('0x3e')]);_0x533fe5[_0x758a('0x40')]=qs[_0x758a('0x36')](_[_0x758a('0x3f')](_0x239791[_0x758a('0x35')],_0x25fddf[_0x758a('0x36')]));_0x533fe5[_0x758a('0x40')][_0x758a('0x5d')]=_0x5b9b7a['id'];if(_0x239791[_0x758a('0x35')][_0x758a('0x43')]){_0x533fe5[_0x758a('0x40')]=_[_0x758a('0x41')](_0x533fe5['where'],{'$or':_[_0x758a('0x2e')](_0x533fe5['attributes'],function(_0x309edb){var _0x5d506e={};_0x5d506e[_0x309edb]={'$like':'%'+_0x239791[_0x758a('0x35')][_0x758a('0x43')]+'%'};return _0x5d506e;})});}_0x533fe5=_[_0x758a('0x41')]({},_0x533fe5,_0x239791[_0x758a('0x44')]);return db[_0x758a('0x62')][_0x758a('0x20')]({'where':_0x533fe5[_0x758a('0x40')]})[_0x758a('0x28')](function(_0x584eaa){_0x466471['count']=_0x584eaa;if(_0x239791['query'][_0x758a('0x45')]){_0x533fe5[_0x758a('0x46')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x758a('0x47')](_0x533fe5);})[_0x758a('0x28')](function(_0x3ceba4){_0x466471[_0x758a('0x48')]=_0x3ceba4;return _0x466471;});}})[_0x758a('0x28')](respondWithFilteredResult(_0x2abc65,_0x533fe5))[_0x758a('0x49')](handleError(_0x2abc65,null));};exports['getHopperBlacks']=function(_0xeff6fc,_0x502c70,_0x300e5e){var _0x13339a={'raw':!![],'where':{}};var _0x53e6c2={};var _0x25a8af={'count':0x0,'rows':[]};return db['Campaign'][_0x758a('0x61')]({'where':{'id':_0xeff6fc[_0x758a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x502c70,null))['then'](function(_0x5577f6){if(_0x5577f6){_0x53e6c2[_0x758a('0x3b')]=_[_0x758a('0x34')](db[_0x758a('0x63')][_0x758a('0x30')]);_0x53e6c2[_0x758a('0x35')]=_[_0x758a('0x34')](_0xeff6fc['query']);_0x53e6c2[_0x758a('0x36')]=_[_0x758a('0x37')](_0x53e6c2[_0x758a('0x3b')],_0x53e6c2[_0x758a('0x35')]);_0x13339a[_0x758a('0x38')]=_[_0x758a('0x37')](_0x53e6c2[_0x758a('0x3b')],qs['fields'](_0xeff6fc[_0x758a('0x35')][_0x758a('0x39')]));_0x13339a[_0x758a('0x38')]=_0x13339a[_0x758a('0x38')][_0x758a('0x3a')]?_0x13339a[_0x758a('0x38')]:_0x53e6c2[_0x758a('0x3b')];if(!_0xeff6fc[_0x758a('0x35')][_0x758a('0x5c')](_0x758a('0x3c'))){_0x13339a[_0x758a('0x21')]=qs[_0x758a('0x21')](_0xeff6fc[_0x758a('0x35')][_0x758a('0x21')]);_0x13339a[_0x758a('0x1e')]=qs[_0x758a('0x1e')](_0xeff6fc[_0x758a('0x35')]['offset']);}_0x13339a[_0x758a('0x3d')]=qs[_0x758a('0x3e')](_0xeff6fc[_0x758a('0x35')][_0x758a('0x3e')]);_0x13339a[_0x758a('0x40')]=qs[_0x758a('0x36')](_[_0x758a('0x3f')](_0xeff6fc[_0x758a('0x35')],_0x53e6c2[_0x758a('0x36')]));_0x13339a['where'][_0x758a('0x5d')]=_0x5577f6['id'];if(_0xeff6fc[_0x758a('0x35')][_0x758a('0x43')]){_0x13339a[_0x758a('0x40')]=_[_0x758a('0x41')](_0x13339a[_0x758a('0x40')],{'$or':_[_0x758a('0x2e')](_0x13339a['attributes'],function(_0x43fa59){var _0x5459a8={};_0x5459a8[_0x43fa59]={'$like':'%'+_0xeff6fc[_0x758a('0x35')]['filter']+'%'};return _0x5459a8;})});}_0x13339a=_[_0x758a('0x41')]({},_0x13339a,_0xeff6fc[_0x758a('0x44')]);return db[_0x758a('0x63')][_0x758a('0x20')]({'where':_0x13339a[_0x758a('0x40')]})[_0x758a('0x28')](function(_0x2c3178){_0x25a8af['count']=_0x2c3178;if(_0xeff6fc['query'][_0x758a('0x45')]){_0x13339a[_0x758a('0x46')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x13339a);})['then'](function(_0x21d7a9){_0x25a8af['rows']=_0x21d7a9;return _0x25a8af;});}})[_0x758a('0x28')](respondWithFilteredResult(_0x502c70,_0x13339a))['catch'](handleError(_0x502c70,null));};exports[_0x758a('0x64')]=function(_0xbe5954,_0x37250c,_0x5887eb){var _0x428a2e={};var _0x8dde1b={};var _0x404175;var _0x32d266;return db['Campaign'][_0x758a('0x61')]({'where':{'id':_0xbe5954[_0x758a('0x5a')]['id']}})[_0x758a('0x28')](handleEntityNotFound(_0x37250c,null))['then'](function(_0x2a952e){if(_0x2a952e){_0x404175=_0x2a952e;_0x8dde1b[_0x758a('0x3b')]=_['keys'](db[_0x758a('0x65')][_0x758a('0x30')]);_0x8dde1b[_0x758a('0x35')]=_[_0x758a('0x34')](_0xbe5954['query']);_0x8dde1b['filters']=_[_0x758a('0x37')](_0x8dde1b['model'],_0x8dde1b[_0x758a('0x35')]);_0x428a2e[_0x758a('0x38')]=_['intersection'](_0x8dde1b['model'],qs[_0x758a('0x39')](_0xbe5954['query'][_0x758a('0x39')]));_0x428a2e[_0x758a('0x38')]=_0x428a2e[_0x758a('0x38')][_0x758a('0x3a')]?_0x428a2e[_0x758a('0x38')]:_0x8dde1b[_0x758a('0x3b')];_0x428a2e[_0x758a('0x3d')]=qs[_0x758a('0x3e')](_0xbe5954['query']['sort']);_0x428a2e['where']=qs[_0x758a('0x36')](_[_0x758a('0x3f')](_0xbe5954[_0x758a('0x35')],_0x8dde1b[_0x758a('0x36')]));if(_0xbe5954[_0x758a('0x35')][_0x758a('0x43')]){_0x428a2e[_0x758a('0x40')]=_['merge'](_0x428a2e['where'],{'$or':_['map'](_0x428a2e[_0x758a('0x38')],function(_0x4bbea1){var _0x4456e8={};_0x4456e8[_0x4bbea1]={'$like':'%'+_0xbe5954[_0x758a('0x35')][_0x758a('0x43')]+'%'};return _0x4456e8;})});}_0x428a2e=_[_0x758a('0x41')]({},_0x428a2e,_0xbe5954['options']);return _0x404175[_0x758a('0x64')](_0x428a2e);}})['then'](function(_0x4e4c4f){if(_0x4e4c4f){_0x32d266=_0x4e4c4f[_0x758a('0x3a')];if(!_0xbe5954[_0x758a('0x35')][_0x758a('0x5c')](_0x758a('0x3c'))){_0x428a2e[_0x758a('0x21')]=qs['limit'](_0xbe5954[_0x758a('0x35')][_0x758a('0x21')]);_0x428a2e[_0x758a('0x1e')]=qs[_0x758a('0x1e')](_0xbe5954[_0x758a('0x35')][_0x758a('0x1e')]);}return _0x404175[_0x758a('0x64')](_0x428a2e);}})[_0x758a('0x28')](function(_0x4b126e){if(_0x4b126e){return _0x4b126e?{'count':_0x32d266,'rows':_0x4b126e}:null;}})[_0x758a('0x28')](respondWithResult(_0x37250c,null))[_0x758a('0x49')](handleError(_0x37250c,null));};exports[_0x758a('0x66')]=function(_0x417580,_0x6da7cf,_0x419ec1){var _0xf89ed6,_0x5da3e1;var _0x38bab9=[];var _0x1fc5a1=moment()[_0x758a('0x67')](_0x758a('0x68'));return db[_0x758a('0x2f')][_0x758a('0x52')]({'where':{'id':_0x417580[_0x758a('0x5a')]['id']}})[_0x758a('0x28')](handleEntityNotFound(_0x6da7cf,null))['then'](function(_0xf7ff3c){if(_0xf7ff3c){_0x5da3e1=_0xf7ff3c;return _0xf7ff3c[_0x758a('0x66')](_0x417580['body'][_0x758a('0x69')],_[_0x758a('0x55')](_0x417580['body'],[_0x758a('0x69'),'id'])||{});}return null;})['spread'](function(_0x3b9901){var _0x1ef5be;var _0x39a442;_0xf89ed6=_0x3b9901||[];var _0x17a14e=[];if(_0x3b9901){for(var _0x4061bf=0x0;_0x4061bf<_0x3b9901[_0x758a('0x3a')];_0x4061bf+=0x1){var _0x5f3ea6=_0x3b9901[_0x4061bf]['get']({'plain':!![]});_0x5da3e1[_0x758a('0x6a')]=_0x417580[_0x758a('0x4c')]['dialCheckDuplicateType']?_0x417580[_0x758a('0x4c')][_0x758a('0x6a')]:_0x5da3e1[_0x758a('0x6a')];switch(_0x5da3e1[_0x758a('0x6a')]){case'always':_0x1ef5be=squel[_0x758a('0x6b')]()[_0x758a('0x6c')]('cm_hopper')[_0x758a('0x6d')]([_0x758a('0x6e'),_0x758a('0x6f'),_0x758a('0x70'),'ListId',_0x758a('0x5d'),_0x758a('0x56'),_0x758a('0x57')],squel[_0x758a('0x71')]()[_0x758a('0x72')](_0x758a('0x6e'),'phone')[_0x758a('0x72')]('NOW()',_0x758a('0x6f'))[_0x758a('0x72')]('id',_0x758a('0x70'))['field'](_0x5f3ea6[_0x758a('0x73')][_0x758a('0x74')](),'ListId')[_0x758a('0x72')](_0x417580['params']['id'][_0x758a('0x74')](),_0x758a('0x5d'))[_0x758a('0x72')]('\x27'+_0x1fc5a1+'\x27','createdAt')[_0x758a('0x72')]('\x27'+_0x1fc5a1+'\x27',_0x758a('0x57'))['from'](_0x758a('0x75'))[_0x758a('0x40')](_0x758a('0x76'))[_0x758a('0x40')](_0x758a('0x77'),_0x5f3ea6[_0x758a('0x73')][_0x758a('0x74')]())[_0x758a('0x40')](_0x758a('0x78'))[_0x758a('0x40')](_0x758a('0x79'),squel['select']()[_0x758a('0x72')]('COALESCE(calleridnum,\x27\x27)')[_0x758a('0x7a')](_0x758a('0x7b'))[_0x758a('0x40')](_0x758a('0x7c'),_0x417580[_0x758a('0x5a')]['id']['toString']()))[_0x758a('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x758a('0x71')]()['field'](_0x758a('0x7d'))[_0x758a('0x7a')](_0x758a('0x7e'))[_0x758a('0x40')](_0x758a('0x7c'),_0x417580[_0x758a('0x5a')]['id'][_0x758a('0x74')]())))[_0x758a('0x74')]();break;case _0x758a('0x7f'):_0x1ef5be=squel['insert']()[_0x758a('0x6c')](_0x758a('0x7e'))[_0x758a('0x6d')]([_0x758a('0x6e'),_0x758a('0x6f'),'ContactId','ListId','CampaignId',_0x758a('0x56'),_0x758a('0x57')],squel['select']()[_0x758a('0x72')]('phone','phone')[_0x758a('0x72')]('NOW()',_0x758a('0x6f'))[_0x758a('0x72')]('id','ContactId')[_0x758a('0x72')](_0x5f3ea6[_0x758a('0x73')]['toString'](),'ListId')[_0x758a('0x72')](_0x417580['params']['id']['toString'](),'CampaignId')[_0x758a('0x72')]('\x27'+_0x1fc5a1+'\x27','createdAt')[_0x758a('0x72')]('\x27'+_0x1fc5a1+'\x27','updatedAt')[_0x758a('0x7a')](_0x758a('0x75'))[_0x758a('0x40')](_0x758a('0x76'))['where']('ListId\x20=\x20?',_0x5f3ea6[_0x758a('0x73')][_0x758a('0x74')]())[_0x758a('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x758a('0x40')](_0x758a('0x79'),squel[_0x758a('0x71')]()[_0x758a('0x72')](_0x758a('0x7d'))[_0x758a('0x7a')]('cm_hopper')[_0x758a('0x40')](_0x758a('0x7c'),_0x417580[_0x758a('0x5a')]['id'][_0x758a('0x74')]())))[_0x758a('0x74')]();break;default:_0x1ef5be=squel[_0x758a('0x6b')]()[_0x758a('0x6c')](_0x758a('0x7e'))['fromQuery']([_0x758a('0x6e'),_0x758a('0x6f'),_0x758a('0x70'),_0x758a('0x80'),_0x758a('0x5d'),'createdAt','updatedAt'],squel[_0x758a('0x71')]()[_0x758a('0x72')](_0x758a('0x6e'),_0x758a('0x6e'))[_0x758a('0x72')](_0x758a('0x81'),_0x758a('0x6f'))[_0x758a('0x72')]('id',_0x758a('0x70'))[_0x758a('0x72')](_0x5f3ea6[_0x758a('0x73')][_0x758a('0x74')](),_0x758a('0x80'))[_0x758a('0x72')](_0x417580[_0x758a('0x5a')]['id']['toString'](),_0x758a('0x5d'))[_0x758a('0x72')]('\x27'+_0x1fc5a1+'\x27',_0x758a('0x56'))['field']('\x27'+_0x1fc5a1+'\x27',_0x758a('0x57'))['from'](_0x758a('0x75'))[_0x758a('0x40')](_0x758a('0x76'))[_0x758a('0x40')](_0x758a('0x77'),_0x5f3ea6[_0x758a('0x73')][_0x758a('0x74')]())['where'](_0x758a('0x78')))['toString']();}_0x39a442=squel['insert']()[_0x758a('0x6c')]('cm_hopper_additional_phones')[_0x758a('0x6d')]([_0x758a('0x82'),_0x758a('0x6f'),'phone','OrderBy','createdAt',_0x758a('0x57')],squel[_0x758a('0x71')]()[_0x758a('0x72')]('h.id','id')[_0x758a('0x72')](_0x758a('0x81'),_0x758a('0x6f'))[_0x758a('0x72')](_0x758a('0x83'),_0x758a('0x6e'))['field']('ci.OrderBY',_0x758a('0x84'))['field']('\x27'+_0x1fc5a1+'\x27',_0x758a('0x56'))[_0x758a('0x72')]('\x27'+_0x1fc5a1+'\x27','updatedAt')['from'](_0x758a('0x85'),'ci')[_0x758a('0x86')](_0x758a('0x7e'),'h',_0x758a('0x87'))[_0x758a('0x40')]('h.ListId\x20=\x20?',_0x5f3ea6[_0x758a('0x73')][_0x758a('0x74')]())['where'](_0x758a('0x88'),_0x417580[_0x758a('0x5a')]['id'][_0x758a('0x74')]())[_0x758a('0x40')]('h.createdAt\x20=\x20?',_0x1fc5a1))[_0x758a('0x74')]();_0x17a14e[_0x758a('0x89')](db[_0x758a('0x8a')]['query'](_0x1ef5be));_0x38bab9[_0x758a('0x89')](db[_0x758a('0x8a')]['query'](_0x39a442));}return BPromise[_0x758a('0x8b')](_0x17a14e);}})[_0x758a('0x28')](function(){return BPromise[_0x758a('0x8b')](_0x38bab9);})[_0x758a('0x28')](function(){return _0xf89ed6;})[_0x758a('0x28')](respondWithResult(_0x6da7cf,null))[_0x758a('0x49')](handleError(_0x6da7cf,null));};exports[_0x758a('0x8c')]=function(_0x56e4bf,_0x596a3a,_0x1942e7){return db['Campaign']['find']({'where':{'id':_0x56e4bf[_0x758a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x596a3a,null))['then'](function(_0x3e9380){if(_0x3e9380){return _0x3e9380[_0x758a('0x8c')](_0x56e4bf[_0x758a('0x35')][_0x758a('0x69')]);}})[_0x758a('0x28')](function(_0x4f05c7){if(_0x4f05c7){return db[_0x758a('0x5b')]['destroy']({'where':{'ListId':_0x56e4bf[_0x758a('0x35')][_0x758a('0x69')],'CampaignId':_0x56e4bf['params']['id']}})[_0x758a('0x28')](function(){return _0x4f05c7;});}})[_0x758a('0x28')](respondWithStatusCode(_0x596a3a,null))[_0x758a('0x49')](handleError(_0x596a3a,null));};exports[_0x758a('0x8d')]=function(_0x51fe05,_0x50824e,_0x25018f){var _0xe19fe9={};var _0x580100={};var _0x2e99db;var _0x15931f;return db[_0x758a('0x2f')][_0x758a('0x61')]({'where':{'id':_0x51fe05[_0x758a('0x5a')]['id']}})[_0x758a('0x28')](handleEntityNotFound(_0x50824e,null))[_0x758a('0x28')](function(_0x2f960e){if(_0x2f960e){_0x2e99db=_0x2f960e;_0x580100['model']=_[_0x758a('0x34')](db[_0x758a('0x65')][_0x758a('0x30')]);_0x580100[_0x758a('0x35')]=_['keys'](_0x51fe05[_0x758a('0x35')]);_0x580100[_0x758a('0x36')]=_[_0x758a('0x37')](_0x580100['model'],_0x580100[_0x758a('0x35')]);_0xe19fe9[_0x758a('0x38')]=_[_0x758a('0x37')](_0x580100['model'],qs[_0x758a('0x39')](_0x51fe05['query'][_0x758a('0x39')]));_0xe19fe9[_0x758a('0x38')]=_0xe19fe9[_0x758a('0x38')][_0x758a('0x3a')]?_0xe19fe9[_0x758a('0x38')]:_0x580100[_0x758a('0x3b')];_0xe19fe9[_0x758a('0x3d')]=qs[_0x758a('0x3e')](_0x51fe05[_0x758a('0x35')]['sort']);_0xe19fe9[_0x758a('0x40')]=qs[_0x758a('0x36')](_[_0x758a('0x3f')](_0x51fe05[_0x758a('0x35')],_0x580100[_0x758a('0x36')]));if(_0x51fe05[_0x758a('0x35')][_0x758a('0x43')]){_0xe19fe9[_0x758a('0x40')]=_['merge'](_0xe19fe9[_0x758a('0x40')],{'$or':_[_0x758a('0x2e')](_0xe19fe9[_0x758a('0x38')],function(_0x3cc36d){var _0x1b29ae={};_0x1b29ae[_0x3cc36d]={'$like':'%'+_0x51fe05[_0x758a('0x35')][_0x758a('0x43')]+'%'};return _0x1b29ae;})});}_0xe19fe9=_[_0x758a('0x41')]({},_0xe19fe9,_0x51fe05[_0x758a('0x44')]);return _0x2e99db['getBlackLists'](_0xe19fe9);}})[_0x758a('0x28')](function(_0x508df7){if(_0x508df7){_0x15931f=_0x508df7[_0x758a('0x3a')];if(!_0x51fe05[_0x758a('0x35')][_0x758a('0x5c')](_0x758a('0x3c'))){_0xe19fe9[_0x758a('0x21')]=qs['limit'](_0x51fe05[_0x758a('0x35')]['limit']);_0xe19fe9[_0x758a('0x1e')]=qs['offset'](_0x51fe05[_0x758a('0x35')]['offset']);}return _0x2e99db[_0x758a('0x8d')](_0xe19fe9);}})['then'](function(_0x195067){if(_0x195067){return _0x195067?{'count':_0x15931f,'rows':_0x195067}:null;}})[_0x758a('0x28')](respondWithResult(_0x50824e,null))[_0x758a('0x49')](handleError(_0x50824e,null));};exports[_0x758a('0x8e')]=function(_0x57467d,_0x28e721,_0x14112a){var _0x4a337e,_0xbea609;var _0x459616=[];var _0x1a1382=moment()[_0x758a('0x67')](_0x758a('0x68'));return db[_0x758a('0x2f')][_0x758a('0x52')]({'where':{'id':_0x57467d[_0x758a('0x5a')]['id']}})[_0x758a('0x28')](handleEntityNotFound(_0x28e721,null))[_0x758a('0x28')](function(_0x193625){if(_0x193625){_0xbea609=_0x193625;return _0x193625['addBlackLists'](_0x57467d[_0x758a('0x4c')][_0x758a('0x69')],_[_0x758a('0x55')](_0x57467d[_0x758a('0x4c')],[_0x758a('0x69'),'id'])||{});}return null;})['spread'](function(_0x5aa63a){var _0x43155e;var _0x2d73d8;_0x4a337e=_0x5aa63a||[];var _0x1c54c8=[];if(_0x5aa63a){for(var _0x12efc8=0x0;_0x12efc8<_0x5aa63a['length'];_0x12efc8+=0x1){var _0x5460f1=_0x5aa63a[_0x12efc8][_0x758a('0x29')]({'plain':!![]});_0x43155e=squel[_0x758a('0x6b')]()[_0x758a('0x6c')](_0x758a('0x8f'))[_0x758a('0x6d')](['phone','ContactId','ListId','CampaignId',_0x758a('0x56'),_0x758a('0x57')],squel[_0x758a('0x71')]()[_0x758a('0x72')](_0x758a('0x6e'),_0x758a('0x6e'))[_0x758a('0x72')]('id',_0x758a('0x70'))[_0x758a('0x72')](_0x5460f1[_0x758a('0x73')]['toString'](),_0x758a('0x80'))[_0x758a('0x72')](_0x57467d['params']['id'][_0x758a('0x74')](),'CampaignId')[_0x758a('0x72')](_0x758a('0x81'),_0x758a('0x56'))[_0x758a('0x72')](_0x758a('0x81'),_0x758a('0x57'))[_0x758a('0x7a')](_0x758a('0x75'))[_0x758a('0x40')]('deletedAt\x20IS\x20NULL')[_0x758a('0x40')](_0x758a('0x77'),_0x5460f1[_0x758a('0x73')][_0x758a('0x74')]())[_0x758a('0x40')]('phone\x20IS\x20NOT\x20NULL'))[_0x758a('0x74')]();_0x1c54c8[_0x758a('0x89')](db[_0x758a('0x8a')][_0x758a('0x35')](_0x43155e));}return BPromise[_0x758a('0x8b')](_0x1c54c8);}})[_0x758a('0x28')](function(){return _0x4a337e;})['then'](respondWithResult(_0x28e721,null))[_0x758a('0x49')](handleError(_0x28e721,null));};exports['removeBlackLists']=function(_0x3b10ea,_0x1122e2,_0x5d59e6){return db['Campaign'][_0x758a('0x52')]({'where':{'id':_0x3b10ea[_0x758a('0x5a')]['id']}})[_0x758a('0x28')](handleEntityNotFound(_0x1122e2,null))['then'](function(_0x16ad4c){if(_0x16ad4c){return _0x16ad4c['removeBlackLists'](_0x3b10ea[_0x758a('0x35')]['ids']);}})[_0x758a('0x28')](function(_0x5770eb){if(_0x5770eb){return db[_0x758a('0x63')][_0x758a('0x27')]({'where':{'ListId':_0x3b10ea['query'][_0x758a('0x69')],'CampaignId':_0x3b10ea['params']['id']}})['then'](function(){return _0x5770eb;});}})['then'](respondWithStatusCode(_0x1122e2,null))[_0x758a('0x49')](handleError(_0x1122e2,null));}; \ No newline at end of file +var _0x8307=['getHopperHistories','CampaignId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','ContactId','ListId','select','field','scheduledAt','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','from','onlyIfOpen','fromQuery','NOW()','cm_contacts','COALESCE(phone,\x27\x27)','cmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','join','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../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','then','get','IvrCampaigns','UserProfileResource','destroy','error','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','rows'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x8307,0xc4));var _0x7830=function(_0x2969f0,_0x11b411){_0x2969f0=_0x2969f0-0x0;var _0x2ca8c0=_0x8307[_0x2969f0];return _0x2ca8c0;};'use strict';var emlformat=require(_0x7830('0x0'));var rimraf=require(_0x7830('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7830('0x2'));var rp=require(_0x7830('0x3'));var moment=require(_0x7830('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7830('0x5'));var util=require(_0x7830('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x7830('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7830('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7830('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7830('0xa'));var toCsv=require(_0x7830('0x7'));var querystring=require('querystring');var Papa=require(_0x7830('0xb'));var Redis=require(_0x7830('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x7830('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7830('0xe'))(_0x7830('0xf'));var utils=require(_0x7830('0x10'));var config=require(_0x7830('0x11'));var licenseUtil=require(_0x7830('0x12'));var db=require(_0x7830('0x13'))['db'];function respondWithStatusCode(_0x36e303,_0x39450e){_0x39450e=_0x39450e||0xcc;return function(_0x4fdb60){if(_0x4fdb60){return _0x36e303[_0x7830('0x14')](_0x39450e);}return _0x36e303[_0x7830('0x15')](_0x39450e)[_0x7830('0x16')]();};}function respondWithResult(_0x5db865,_0x4dd3e0){_0x4dd3e0=_0x4dd3e0||0xc8;return function(_0x5818f6){if(_0x5818f6){return _0x5db865[_0x7830('0x15')](_0x4dd3e0)['json'](_0x5818f6);}};}function respondWithFilteredResult(_0x27d88a,_0x16b7e7){return function(_0x29a4bd){if(_0x29a4bd){var _0x38906b=typeof _0x16b7e7[_0x7830('0x17')]===_0x7830('0x18')&&typeof _0x16b7e7[_0x7830('0x19')]===_0x7830('0x18');var _0x355c4e=_0x29a4bd[_0x7830('0x1a')];var _0x3bc49a=_0x38906b?0x0:_0x16b7e7[_0x7830('0x17')];var _0xf5cda=_0x38906b?_0x29a4bd[_0x7830('0x1a')]:_0x16b7e7[_0x7830('0x17')]+_0x16b7e7['limit'];var _0x40674b;if(_0xf5cda>=_0x355c4e){_0xf5cda=_0x355c4e;_0x40674b=0xc8;}else{_0x40674b=0xce;}_0x27d88a[_0x7830('0x15')](_0x40674b);return _0x27d88a[_0x7830('0x1b')](_0x7830('0x1c'),_0x3bc49a+'-'+_0xf5cda+'/'+_0x355c4e)[_0x7830('0x1d')](_0x29a4bd);}return null;};}function patchUpdates(_0x3966bd){return function(_0x1eaf27){try{jsonpatch[_0x7830('0x1e')](_0x1eaf27,_0x3966bd,!![]);}catch(_0x492be9){return BPromise[_0x7830('0x1f')](_0x492be9);}return _0x1eaf27[_0x7830('0x20')]();};}function saveUpdates(_0x8d90af,_0x152213){return function(_0x3ab7d6){if(_0x3ab7d6){return _0x3ab7d6['update'](_0x8d90af)[_0x7830('0x21')](function(_0x168546){return _0x168546;});}return null;};}function removeEntity(_0x3da993,_0x56efc3){return function(_0x2f69d3){if(_0x2f69d3){return _0x2f69d3['destroy']()['then'](function(){var _0x11668a=_0x2f69d3[_0x7830('0x22')]({'plain':!![]});var _0x449d4b=_0x7830('0x23');return db[_0x7830('0x24')][_0x7830('0x25')]({'where':{'type':_0x449d4b,'resourceId':_0x11668a['id']}})[_0x7830('0x21')](function(){return _0x2f69d3;});})[_0x7830('0x21')](function(){_0x3da993[_0x7830('0x15')](0xcc)[_0x7830('0x16')]();});}};}function handleEntityNotFound(_0xc6ca8e,_0x17b1c6){return function(_0x5cbfc2){if(!_0x5cbfc2){_0xc6ca8e[_0x7830('0x14')](0x194);}return _0x5cbfc2;};}function handleError(_0x214f4b,_0x555eab){_0x555eab=_0x555eab||0x1f4;return function(_0x2a6018){logger[_0x7830('0x26')](_0x2a6018['stack']);if(_0x2a6018[_0x7830('0x27')]){delete _0x2a6018[_0x7830('0x27')];}_0x214f4b['status'](_0x555eab)[_0x7830('0x28')](_0x2a6018);};}exports[_0x7830('0x29')]=function(_0x14a345,_0x12debf){var _0x461fe={},_0x172bb7={},_0x4f798d={'count':0x0,'rows':[]};var _0x116fdd=_[_0x7830('0x2a')](db[_0x7830('0x2b')][_0x7830('0x2c')],function(_0x10baa5){return{'name':_0x10baa5[_0x7830('0x2d')],'type':_0x10baa5[_0x7830('0x2e')][_0x7830('0x2f')]};});_0x172bb7[_0x7830('0x30')]=_[_0x7830('0x2a')](_0x116fdd,_0x7830('0x27'));_0x172bb7[_0x7830('0x31')]=_[_0x7830('0x32')](_0x14a345[_0x7830('0x31')]);_0x172bb7[_0x7830('0x33')]=_['intersection'](_0x172bb7[_0x7830('0x30')],_0x172bb7[_0x7830('0x31')]);_0x461fe['attributes']=_[_0x7830('0x34')](_0x172bb7['model'],qs['fields'](_0x14a345[_0x7830('0x31')][_0x7830('0x35')]));_0x461fe[_0x7830('0x36')]=_0x461fe[_0x7830('0x36')][_0x7830('0x37')]?_0x461fe[_0x7830('0x36')]:_0x172bb7[_0x7830('0x30')];if(!_0x14a345['query'][_0x7830('0x38')](_0x7830('0x39'))){_0x461fe[_0x7830('0x19')]=qs[_0x7830('0x19')](_0x14a345[_0x7830('0x31')][_0x7830('0x19')]);_0x461fe['offset']=qs['offset'](_0x14a345[_0x7830('0x31')][_0x7830('0x17')]);}_0x461fe[_0x7830('0x3a')]=qs[_0x7830('0x3b')](_0x14a345[_0x7830('0x31')][_0x7830('0x3b')]);_0x461fe[_0x7830('0x3c')]=qs[_0x7830('0x33')](_[_0x7830('0x3d')](_0x14a345[_0x7830('0x31')],_0x172bb7[_0x7830('0x33')]),_0x116fdd);if(_0x14a345[_0x7830('0x31')][_0x7830('0x3e')]){_0x461fe[_0x7830('0x3c')]=_[_0x7830('0x3f')](_0x461fe[_0x7830('0x3c')],{'$or':_['map'](_0x116fdd,function(_0x4cf61c){if(_0x4cf61c[_0x7830('0x2e')]!==_0x7830('0x40')){var _0x5487cf={};_0x5487cf[_0x4cf61c[_0x7830('0x27')]]={'$like':'%'+_0x14a345[_0x7830('0x31')]['filter']+'%'};return _0x5487cf;}})});}_0x461fe=_[_0x7830('0x3f')]({},_0x461fe,_0x14a345['options']);var _0x50579b={'where':_0x461fe[_0x7830('0x3c')]};return db['Campaign']['count'](_0x50579b)[_0x7830('0x21')](function(_0x623843){_0x4f798d[_0x7830('0x1a')]=_0x623843;if(_0x14a345['query'][_0x7830('0x41')]){_0x461fe[_0x7830('0x42')]=[{'all':!![]}];}return db['Campaign'][_0x7830('0x43')](_0x461fe);})[_0x7830('0x21')](function(_0xfb5857){_0x4f798d['rows']=_0xfb5857;return _0x4f798d;})[_0x7830('0x21')](respondWithFilteredResult(_0x12debf,_0x461fe))[_0x7830('0x44')](handleError(_0x12debf,null));};exports[_0x7830('0x45')]=function(_0x25b00d,_0x3bfaab){var _0x525fcc={'raw':![],'where':{'id':_0x25b00d[_0x7830('0x46')]['id']}},_0x3f2a4a={};_0x3f2a4a[_0x7830('0x30')]=_[_0x7830('0x32')](db['Campaign']['rawAttributes']);_0x3f2a4a[_0x7830('0x31')]=_[_0x7830('0x32')](_0x25b00d[_0x7830('0x31')]);_0x3f2a4a[_0x7830('0x33')]=_[_0x7830('0x34')](_0x3f2a4a[_0x7830('0x30')],_0x3f2a4a[_0x7830('0x31')]);_0x525fcc['attributes']=_[_0x7830('0x34')](_0x3f2a4a[_0x7830('0x30')],qs[_0x7830('0x35')](_0x25b00d[_0x7830('0x31')][_0x7830('0x35')]));_0x525fcc[_0x7830('0x36')]=_0x525fcc[_0x7830('0x36')]['length']?_0x525fcc[_0x7830('0x36')]:_0x3f2a4a[_0x7830('0x30')];if(_0x25b00d[_0x7830('0x31')][_0x7830('0x41')]){_0x525fcc[_0x7830('0x42')]=[{'all':!![]}];}_0x525fcc=_[_0x7830('0x3f')]({},_0x525fcc,_0x25b00d[_0x7830('0x47')]);return db['Campaign'][_0x7830('0x48')](_0x525fcc)[_0x7830('0x21')](handleEntityNotFound(_0x3bfaab,null))['then'](respondWithResult(_0x3bfaab,null))[_0x7830('0x44')](handleError(_0x3bfaab,null));};exports[_0x7830('0x49')]=function(_0x28c373,_0x1e74e0){return db[_0x7830('0x2b')][_0x7830('0x49')](_0x28c373[_0x7830('0x4a')],{})[_0x7830('0x21')](function(_0x3b03bb){var _0x357300=_0x28c373[_0x7830('0x4b')]['get']({'plain':!![]});if(!_0x357300)throw new Error(_0x7830('0x4c'));if(_0x357300[_0x7830('0x4d')]===_0x7830('0x4b')){var _0x3d789b=_0x3b03bb['get']({'plain':!![]});var _0x42ebde=_0x7830('0x23');return db[_0x7830('0x4e')][_0x7830('0x48')]({'where':{'name':_0x42ebde,'userProfileId':_0x357300[_0x7830('0x4f')]},'raw':!![]})[_0x7830('0x21')](function(_0x32e7bf){if(_0x32e7bf&&_0x32e7bf[_0x7830('0x50')]===0x0){return db['UserProfileResource'][_0x7830('0x49')]({'name':_0x3d789b[_0x7830('0x27')],'resourceId':_0x3d789b['id'],'type':_0x32e7bf[_0x7830('0x27')],'sectionId':_0x32e7bf['id']},{})[_0x7830('0x21')](function(){return _0x3b03bb;});}else{return _0x3b03bb;}})[_0x7830('0x44')](function(_0x341ca9){logger[_0x7830('0x26')](_0x7830('0x51'),_0x341ca9);throw _0x341ca9;});}return _0x3b03bb;})[_0x7830('0x21')](respondWithResult(_0x1e74e0,0xc9))[_0x7830('0x44')](handleError(_0x1e74e0,null));};exports[_0x7830('0x52')]=function(_0xc09d5a,_0x35f188){var _0x7985bb={'where':{'id':_0xc09d5a[_0x7830('0x46')]['id']}},_0x5a7b5c={};_0x5a7b5c[_0x7830('0x30')]=_['keys'](db[_0x7830('0x2b')]['rawAttributes']);_0x7985bb[_0x7830('0x36')]=_[_0x7830('0x34')](_0x5a7b5c['model'],qs[_0x7830('0x35')](_0xc09d5a['query']['fields']));_0x7985bb[_0x7830('0x36')]=_0x7985bb[_0x7830('0x36')][_0x7830('0x37')]?_0x7985bb[_0x7830('0x36')]:_0x5a7b5c[_0x7830('0x30')];if(_0xc09d5a[_0x7830('0x31')][_0x7830('0x41')]){_0x7985bb['include']=[{'all':!![]}];}_0x7985bb=_[_0x7830('0x3f')]({},_0x7985bb,_0xc09d5a[_0x7830('0x47')]);return db[_0x7830('0x2b')][_0x7830('0x48')](_0x7985bb)[_0x7830('0x21')](handleEntityNotFound(_0x35f188,null))[_0x7830('0x21')](function(_0x3e6d34){if(_0x3e6d34){var _0x139608=_0x3e6d34[_0x7830('0x22')]({'plain':!![]});_0x139608=qs[_0x7830('0x53')](_0x139608,['id',_0x7830('0x54'),_0x7830('0x55')]);_0xc09d5a[_0x7830('0x4a')]=_[_0x7830('0x53')](_0xc09d5a['body'],['id',_0x7830('0x54'),_0x7830('0x55')]);return db['Campaign'][_0x7830('0x49')](_['merge'](_0x139608,_0xc09d5a[_0x7830('0x4a')]),{'include':_0xc09d5a[_0x7830('0x31')][_0x7830('0x41')]?[{'all':!![]}]:undefined})['then'](function(_0x315df4){var _0x598f98=_0xc09d5a[_0x7830('0x4b')][_0x7830('0x22')]({'plain':!![]});if(!_0x598f98)throw new Error(_0x7830('0x4c'));if(_0x598f98[_0x7830('0x4d')]===_0x7830('0x4b')){var _0x4edc54=_0x315df4[_0x7830('0x22')]({'plain':!![]});var _0xced78a=_0x7830('0x23');return db[_0x7830('0x4e')][_0x7830('0x48')]({'where':{'name':_0xced78a,'userProfileId':_0x598f98[_0x7830('0x4f')]},'raw':!![]})['then'](function(_0x2f683e){if(_0x2f683e&&_0x2f683e['autoAssociation']===0x0){return db[_0x7830('0x24')][_0x7830('0x49')]({'name':_0x4edc54['name'],'resourceId':_0x4edc54['id'],'type':_0x2f683e[_0x7830('0x27')],'sectionId':_0x2f683e['id']},{})['then'](function(){return _0x315df4;});}else{return _0x315df4;}})[_0x7830('0x44')](function(_0x184883){logger[_0x7830('0x26')](_0x7830('0x51'),_0x184883);throw _0x184883;});}return _0x315df4;});}})[_0x7830('0x21')](respondWithResult(_0x35f188,0xc9))[_0x7830('0x44')](handleError(_0x35f188,null));};exports['update']=function(_0x407be0,_0x189009){if(_0x407be0[_0x7830('0x4a')]['id']){delete _0x407be0['body']['id'];}return db[_0x7830('0x2b')][_0x7830('0x48')]({'where':{'id':_0x407be0[_0x7830('0x46')]['id']}})[_0x7830('0x21')](handleEntityNotFound(_0x189009,null))[_0x7830('0x21')](saveUpdates(_0x407be0[_0x7830('0x4a')],null))[_0x7830('0x21')](respondWithResult(_0x189009,null))[_0x7830('0x44')](handleError(_0x189009,null));};exports[_0x7830('0x25')]=function(_0xda6837,_0x4b1162){return db[_0x7830('0x2b')][_0x7830('0x48')]({'where':{'id':_0xda6837[_0x7830('0x46')]['id']}})[_0x7830('0x21')](handleEntityNotFound(_0x4b1162,null))['then'](removeEntity(_0x4b1162,null))[_0x7830('0x44')](handleError(_0x4b1162,null));};exports[_0x7830('0x56')]=function(_0x384da4,_0x590f92,_0x3c05ab){var _0xda1b4f={'raw':!![],'where':{}};var _0xde637c={};var _0x3a0b0b={'count':0x0,'rows':[]};return db['Campaign'][_0x7830('0x57')]({'where':{'id':_0x384da4[_0x7830('0x46')]['id']}})[_0x7830('0x21')](handleEntityNotFound(_0x590f92,null))[_0x7830('0x21')](function(_0x8ed649){if(_0x8ed649){_0xde637c[_0x7830('0x30')]=_['keys'](db[_0x7830('0x58')][_0x7830('0x2c')]);_0xde637c[_0x7830('0x31')]=_[_0x7830('0x32')](_0x384da4[_0x7830('0x31')]);_0xde637c['filters']=_['intersection'](_0xde637c[_0x7830('0x30')],_0xde637c[_0x7830('0x31')]);_0xda1b4f[_0x7830('0x36')]=_['intersection'](_0xde637c[_0x7830('0x30')],qs['fields'](_0x384da4[_0x7830('0x31')][_0x7830('0x35')]));_0xda1b4f[_0x7830('0x36')]=_0xda1b4f[_0x7830('0x36')]['length']?_0xda1b4f[_0x7830('0x36')]:_0xde637c['model'];if(!_0x384da4[_0x7830('0x31')][_0x7830('0x38')](_0x7830('0x39'))){_0xda1b4f['limit']=qs[_0x7830('0x19')](_0x384da4[_0x7830('0x31')]['limit']);_0xda1b4f[_0x7830('0x17')]=qs['offset'](_0x384da4[_0x7830('0x31')][_0x7830('0x17')]);}_0xda1b4f[_0x7830('0x3a')]=qs[_0x7830('0x3b')](_0x384da4[_0x7830('0x31')][_0x7830('0x3b')]);_0xda1b4f[_0x7830('0x3c')]=qs[_0x7830('0x33')](_[_0x7830('0x3d')](_0x384da4['query'],_0xde637c[_0x7830('0x33')]));_0xda1b4f[_0x7830('0x3c')]['CampaignId']=_0x8ed649['id'];if(_0x384da4['query']['filter']){_0xda1b4f[_0x7830('0x3c')]=_[_0x7830('0x3f')](_0xda1b4f[_0x7830('0x3c')],{'$or':_[_0x7830('0x2a')](_0xda1b4f[_0x7830('0x36')],function(_0x262c2c){var _0xf39aed={};_0xf39aed[_0x262c2c]={'$like':'%'+_0x384da4['query'][_0x7830('0x3e')]+'%'};return _0xf39aed;})});}_0xda1b4f=_['merge']({},_0xda1b4f,_0x384da4[_0x7830('0x47')]);return db['CmHopper'][_0x7830('0x1a')]({'where':_0xda1b4f[_0x7830('0x3c')]})[_0x7830('0x21')](function(_0x4787){_0x3a0b0b['count']=_0x4787;if(_0x384da4[_0x7830('0x31')][_0x7830('0x41')]){_0xda1b4f[_0x7830('0x42')]=[{'all':!![]}];}return db[_0x7830('0x58')][_0x7830('0x43')](_0xda1b4f);})['then'](function(_0x4d3b6f){_0x3a0b0b[_0x7830('0x59')]=_0x4d3b6f;return _0x3a0b0b;});}})['then'](respondWithFilteredResult(_0x590f92,_0xda1b4f))['catch'](handleError(_0x590f92,null));};exports[_0x7830('0x5a')]=function(_0x5a7400,_0x21e6be,_0x41843e){var _0x59ead9={'raw':!![],'where':{}};var _0x2f2289={};var _0x4b0559={'count':0x0,'rows':[]};return db[_0x7830('0x2b')]['findOne']({'where':{'id':_0x5a7400[_0x7830('0x46')]['id']}})[_0x7830('0x21')](handleEntityNotFound(_0x21e6be,null))[_0x7830('0x21')](function(_0x4c8fea){if(_0x4c8fea){_0x2f2289[_0x7830('0x30')]=_[_0x7830('0x32')](db['CmHopperHistory'][_0x7830('0x2c')]);_0x2f2289['query']=_[_0x7830('0x32')](_0x5a7400[_0x7830('0x31')]);_0x2f2289[_0x7830('0x33')]=_['intersection'](_0x2f2289[_0x7830('0x30')],_0x2f2289[_0x7830('0x31')]);_0x59ead9[_0x7830('0x36')]=_[_0x7830('0x34')](_0x2f2289['model'],qs['fields'](_0x5a7400[_0x7830('0x31')][_0x7830('0x35')]));_0x59ead9[_0x7830('0x36')]=_0x59ead9['attributes'][_0x7830('0x37')]?_0x59ead9[_0x7830('0x36')]:_0x2f2289[_0x7830('0x30')];if(!_0x5a7400['query']['hasOwnProperty'](_0x7830('0x39'))){_0x59ead9[_0x7830('0x19')]=qs['limit'](_0x5a7400[_0x7830('0x31')]['limit']);_0x59ead9['offset']=qs[_0x7830('0x17')](_0x5a7400['query'][_0x7830('0x17')]);}_0x59ead9['order']=qs['sort'](_0x5a7400[_0x7830('0x31')][_0x7830('0x3b')]);_0x59ead9['where']=qs['filters'](_['pick'](_0x5a7400['query'],_0x2f2289[_0x7830('0x33')]));_0x59ead9[_0x7830('0x3c')][_0x7830('0x5b')]=_0x4c8fea['id'];if(_0x5a7400[_0x7830('0x31')]['filter']){_0x59ead9[_0x7830('0x3c')]=_[_0x7830('0x3f')](_0x59ead9[_0x7830('0x3c')],{'$or':_[_0x7830('0x2a')](_0x59ead9[_0x7830('0x36')],function(_0x3fedc0){var _0xecdac8={};_0xecdac8[_0x3fedc0]={'$like':'%'+_0x5a7400[_0x7830('0x31')][_0x7830('0x3e')]+'%'};return _0xecdac8;})});}_0x59ead9=_['merge']({},_0x59ead9,_0x5a7400[_0x7830('0x47')]);return db[_0x7830('0x5c')][_0x7830('0x1a')]({'where':_0x59ead9[_0x7830('0x3c')]})[_0x7830('0x21')](function(_0x3ecf35){_0x4b0559[_0x7830('0x1a')]=_0x3ecf35;if(_0x5a7400[_0x7830('0x31')][_0x7830('0x41')]){_0x59ead9['include']=[{'all':!![]}];}return db[_0x7830('0x5c')][_0x7830('0x43')](_0x59ead9);})[_0x7830('0x21')](function(_0x2ec5d7){_0x4b0559[_0x7830('0x59')]=_0x2ec5d7;return _0x4b0559;});}})['then'](respondWithFilteredResult(_0x21e6be,_0x59ead9))[_0x7830('0x44')](handleError(_0x21e6be,null));};exports['getHopperFinals']=function(_0x2751ee,_0x31a950,_0x59008f){var _0x225aa3={'raw':!![],'where':{}};var _0xadfa94={};var _0x367f64={'count':0x0,'rows':[]};return db[_0x7830('0x2b')][_0x7830('0x57')]({'where':{'id':_0x2751ee[_0x7830('0x46')]['id']}})['then'](handleEntityNotFound(_0x31a950,null))[_0x7830('0x21')](function(_0x13c2fd){if(_0x13c2fd){_0xadfa94[_0x7830('0x30')]=_[_0x7830('0x32')](db[_0x7830('0x5d')]['rawAttributes']);_0xadfa94[_0x7830('0x31')]=_['keys'](_0x2751ee[_0x7830('0x31')]);_0xadfa94[_0x7830('0x33')]=_['intersection'](_0xadfa94['model'],_0xadfa94[_0x7830('0x31')]);_0x225aa3[_0x7830('0x36')]=_[_0x7830('0x34')](_0xadfa94[_0x7830('0x30')],qs[_0x7830('0x35')](_0x2751ee[_0x7830('0x31')][_0x7830('0x35')]));_0x225aa3[_0x7830('0x36')]=_0x225aa3[_0x7830('0x36')][_0x7830('0x37')]?_0x225aa3[_0x7830('0x36')]:_0xadfa94[_0x7830('0x30')];if(!_0x2751ee[_0x7830('0x31')][_0x7830('0x38')](_0x7830('0x39'))){_0x225aa3['limit']=qs[_0x7830('0x19')](_0x2751ee[_0x7830('0x31')][_0x7830('0x19')]);_0x225aa3[_0x7830('0x17')]=qs[_0x7830('0x17')](_0x2751ee[_0x7830('0x31')][_0x7830('0x17')]);}_0x225aa3[_0x7830('0x3a')]=qs[_0x7830('0x3b')](_0x2751ee['query'][_0x7830('0x3b')]);_0x225aa3['where']=qs[_0x7830('0x33')](_['pick'](_0x2751ee[_0x7830('0x31')],_0xadfa94['filters']));_0x225aa3[_0x7830('0x3c')][_0x7830('0x5b')]=_0x13c2fd['id'];if(_0x2751ee[_0x7830('0x31')]['filter']){_0x225aa3[_0x7830('0x3c')]=_[_0x7830('0x3f')](_0x225aa3[_0x7830('0x3c')],{'$or':_[_0x7830('0x2a')](_0x225aa3[_0x7830('0x36')],function(_0xf28c68){var _0x27815d={};_0x27815d[_0xf28c68]={'$like':'%'+_0x2751ee[_0x7830('0x31')][_0x7830('0x3e')]+'%'};return _0x27815d;})});}_0x225aa3=_[_0x7830('0x3f')]({},_0x225aa3,_0x2751ee[_0x7830('0x47')]);return db[_0x7830('0x5d')][_0x7830('0x1a')]({'where':_0x225aa3[_0x7830('0x3c')]})[_0x7830('0x21')](function(_0x1c568a){_0x367f64[_0x7830('0x1a')]=_0x1c568a;if(_0x2751ee[_0x7830('0x31')]['includeAll']){_0x225aa3[_0x7830('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x225aa3);})[_0x7830('0x21')](function(_0x325b60){_0x367f64[_0x7830('0x59')]=_0x325b60;return _0x367f64;});}})['then'](respondWithFilteredResult(_0x31a950,_0x225aa3))[_0x7830('0x44')](handleError(_0x31a950,null));};exports[_0x7830('0x5e')]=function(_0x424175,_0x1a019d,_0x53b465){var _0x266888={'raw':!![],'where':{}};var _0x54bf0c={};var _0x386c1f={'count':0x0,'rows':[]};return db[_0x7830('0x2b')][_0x7830('0x57')]({'where':{'id':_0x424175[_0x7830('0x46')]['id']}})[_0x7830('0x21')](handleEntityNotFound(_0x1a019d,null))[_0x7830('0x21')](function(_0xb1473b){if(_0xb1473b){_0x54bf0c[_0x7830('0x30')]=_[_0x7830('0x32')](db[_0x7830('0x5f')][_0x7830('0x2c')]);_0x54bf0c[_0x7830('0x31')]=_['keys'](_0x424175[_0x7830('0x31')]);_0x54bf0c[_0x7830('0x33')]=_[_0x7830('0x34')](_0x54bf0c[_0x7830('0x30')],_0x54bf0c[_0x7830('0x31')]);_0x266888[_0x7830('0x36')]=_['intersection'](_0x54bf0c[_0x7830('0x30')],qs[_0x7830('0x35')](_0x424175[_0x7830('0x31')][_0x7830('0x35')]));_0x266888['attributes']=_0x266888[_0x7830('0x36')][_0x7830('0x37')]?_0x266888[_0x7830('0x36')]:_0x54bf0c[_0x7830('0x30')];if(!_0x424175[_0x7830('0x31')][_0x7830('0x38')](_0x7830('0x39'))){_0x266888[_0x7830('0x19')]=qs[_0x7830('0x19')](_0x424175[_0x7830('0x31')][_0x7830('0x19')]);_0x266888[_0x7830('0x17')]=qs['offset'](_0x424175[_0x7830('0x31')][_0x7830('0x17')]);}_0x266888[_0x7830('0x3a')]=qs[_0x7830('0x3b')](_0x424175[_0x7830('0x31')][_0x7830('0x3b')]);_0x266888[_0x7830('0x3c')]=qs[_0x7830('0x33')](_[_0x7830('0x3d')](_0x424175[_0x7830('0x31')],_0x54bf0c[_0x7830('0x33')]));_0x266888[_0x7830('0x3c')]['CampaignId']=_0xb1473b['id'];if(_0x424175[_0x7830('0x31')][_0x7830('0x3e')]){_0x266888[_0x7830('0x3c')]=_[_0x7830('0x3f')](_0x266888[_0x7830('0x3c')],{'$or':_[_0x7830('0x2a')](_0x266888[_0x7830('0x36')],function(_0x2e731b){var _0x45bdb0={};_0x45bdb0[_0x2e731b]={'$like':'%'+_0x424175[_0x7830('0x31')][_0x7830('0x3e')]+'%'};return _0x45bdb0;})});}_0x266888=_['merge']({},_0x266888,_0x424175[_0x7830('0x47')]);return db['CmHopperBlack']['count']({'where':_0x266888['where']})[_0x7830('0x21')](function(_0x5a6d81){_0x386c1f[_0x7830('0x1a')]=_0x5a6d81;if(_0x424175[_0x7830('0x31')][_0x7830('0x41')]){_0x266888['include']=[{'all':!![]}];}return db[_0x7830('0x5f')]['findAll'](_0x266888);})[_0x7830('0x21')](function(_0x59f8dd){_0x386c1f[_0x7830('0x59')]=_0x59f8dd;return _0x386c1f;});}})['then'](respondWithFilteredResult(_0x1a019d,_0x266888))['catch'](handleError(_0x1a019d,null));};exports['getLists']=function(_0x424bab,_0x51b20e,_0x366e0f){var _0x244a2d={};var _0x334a9e={};var _0x2b8074;var _0x51682a;return db['Campaign']['findOne']({'where':{'id':_0x424bab['params']['id']}})[_0x7830('0x21')](handleEntityNotFound(_0x51b20e,null))[_0x7830('0x21')](function(_0x40332d){if(_0x40332d){_0x2b8074=_0x40332d;_0x334a9e[_0x7830('0x30')]=_[_0x7830('0x32')](db[_0x7830('0x60')][_0x7830('0x2c')]);_0x334a9e[_0x7830('0x31')]=_[_0x7830('0x32')](_0x424bab['query']);_0x334a9e[_0x7830('0x33')]=_[_0x7830('0x34')](_0x334a9e[_0x7830('0x30')],_0x334a9e[_0x7830('0x31')]);_0x244a2d['attributes']=_[_0x7830('0x34')](_0x334a9e[_0x7830('0x30')],qs[_0x7830('0x35')](_0x424bab[_0x7830('0x31')][_0x7830('0x35')]));_0x244a2d[_0x7830('0x36')]=_0x244a2d[_0x7830('0x36')][_0x7830('0x37')]?_0x244a2d[_0x7830('0x36')]:_0x334a9e[_0x7830('0x30')];_0x244a2d[_0x7830('0x3a')]=qs['sort'](_0x424bab[_0x7830('0x31')]['sort']);_0x244a2d[_0x7830('0x3c')]=qs[_0x7830('0x33')](_[_0x7830('0x3d')](_0x424bab[_0x7830('0x31')],_0x334a9e[_0x7830('0x33')]));if(_0x424bab[_0x7830('0x31')][_0x7830('0x3e')]){_0x244a2d['where']=_[_0x7830('0x3f')](_0x244a2d[_0x7830('0x3c')],{'$or':_[_0x7830('0x2a')](_0x244a2d['attributes'],function(_0x59ccff){var _0x13f0b2={};_0x13f0b2[_0x59ccff]={'$like':'%'+_0x424bab[_0x7830('0x31')][_0x7830('0x3e')]+'%'};return _0x13f0b2;})});}_0x244a2d=_[_0x7830('0x3f')]({},_0x244a2d,_0x424bab[_0x7830('0x47')]);return _0x2b8074[_0x7830('0x61')](_0x244a2d);}})['then'](function(_0x4e40a3){if(_0x4e40a3){_0x51682a=_0x4e40a3[_0x7830('0x37')];if(!_0x424bab[_0x7830('0x31')]['hasOwnProperty'](_0x7830('0x39'))){_0x244a2d['limit']=qs[_0x7830('0x19')](_0x424bab[_0x7830('0x31')][_0x7830('0x19')]);_0x244a2d[_0x7830('0x17')]=qs[_0x7830('0x17')](_0x424bab['query']['offset']);}return _0x2b8074[_0x7830('0x61')](_0x244a2d);}})[_0x7830('0x21')](function(_0x2235c7){if(_0x2235c7){return _0x2235c7?{'count':_0x51682a,'rows':_0x2235c7}:null;}})[_0x7830('0x21')](respondWithResult(_0x51b20e,null))['catch'](handleError(_0x51b20e,null));};exports[_0x7830('0x62')]=function(_0x1ac28f,_0x3a4614,_0x2477d4){var _0x242559,_0x5237df;var _0x25383b=[];var _0x192d31=moment()['format'](_0x7830('0x63'));return db[_0x7830('0x2b')][_0x7830('0x48')]({'where':{'id':_0x1ac28f[_0x7830('0x46')]['id']}})[_0x7830('0x21')](handleEntityNotFound(_0x3a4614,null))[_0x7830('0x21')](function(_0x13e144){if(_0x13e144){_0x5237df=_0x13e144;return _0x13e144[_0x7830('0x62')](_0x1ac28f[_0x7830('0x4a')][_0x7830('0x64')],_['omit'](_0x1ac28f[_0x7830('0x4a')],[_0x7830('0x64'),'id'])||{});}return null;})['spread'](function(_0x765635){var _0xe9c1b5;var _0x4d404e;_0x242559=_0x765635||[];var _0x2d44a5=[];if(_0x765635){for(var _0x3ebfe6=0x0;_0x3ebfe6<_0x765635[_0x7830('0x37')];_0x3ebfe6+=0x1){var _0x5c67dd=_0x765635[_0x3ebfe6][_0x7830('0x22')]({'plain':!![]});_0x5237df[_0x7830('0x65')]=_0x1ac28f[_0x7830('0x4a')]['dialCheckDuplicateType']?_0x1ac28f['body'][_0x7830('0x65')]:_0x5237df[_0x7830('0x65')];switch(_0x5237df[_0x7830('0x65')]){case _0x7830('0x66'):_0xe9c1b5=squel[_0x7830('0x67')]()[_0x7830('0x68')](_0x7830('0x69'))['fromQuery']([_0x7830('0x6a'),'scheduledAt',_0x7830('0x6b'),_0x7830('0x6c'),_0x7830('0x5b'),_0x7830('0x54'),_0x7830('0x55')],squel[_0x7830('0x6d')]()[_0x7830('0x6e')](_0x7830('0x6a'),_0x7830('0x6a'))[_0x7830('0x6e')]('NOW()',_0x7830('0x6f'))[_0x7830('0x6e')]('id',_0x7830('0x6b'))[_0x7830('0x6e')](_0x5c67dd['CmListId'][_0x7830('0x70')](),_0x7830('0x6c'))['field'](_0x1ac28f[_0x7830('0x46')]['id'][_0x7830('0x70')](),_0x7830('0x5b'))['field']('\x27'+_0x192d31+'\x27',_0x7830('0x54'))[_0x7830('0x6e')]('\x27'+_0x192d31+'\x27',_0x7830('0x55'))['from']('cm_contacts')[_0x7830('0x3c')](_0x7830('0x71'))['where'](_0x7830('0x72'),_0x5c67dd[_0x7830('0x73')][_0x7830('0x70')]())[_0x7830('0x3c')](_0x7830('0x74'))[_0x7830('0x3c')](_0x7830('0x75'),squel[_0x7830('0x6d')]()[_0x7830('0x6e')](_0x7830('0x76'))['from'](_0x7830('0x77'))[_0x7830('0x3c')](_0x7830('0x78'),_0x1ac28f['params']['id']['toString']()))[_0x7830('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7830('0x6d')]()[_0x7830('0x6e')]('COALESCE(phone,\x27\x27)')[_0x7830('0x79')](_0x7830('0x69'))[_0x7830('0x3c')](_0x7830('0x78'),_0x1ac28f[_0x7830('0x46')]['id'][_0x7830('0x70')]())))[_0x7830('0x70')]();break;case _0x7830('0x7a'):_0xe9c1b5=squel['insert']()[_0x7830('0x68')](_0x7830('0x69'))[_0x7830('0x7b')](['phone',_0x7830('0x6f'),_0x7830('0x6b'),_0x7830('0x6c'),_0x7830('0x5b'),'createdAt',_0x7830('0x55')],squel[_0x7830('0x6d')]()['field'](_0x7830('0x6a'),_0x7830('0x6a'))[_0x7830('0x6e')](_0x7830('0x7c'),'scheduledAt')[_0x7830('0x6e')]('id',_0x7830('0x6b'))[_0x7830('0x6e')](_0x5c67dd[_0x7830('0x73')][_0x7830('0x70')](),_0x7830('0x6c'))['field'](_0x1ac28f[_0x7830('0x46')]['id'][_0x7830('0x70')](),_0x7830('0x5b'))['field']('\x27'+_0x192d31+'\x27',_0x7830('0x54'))[_0x7830('0x6e')]('\x27'+_0x192d31+'\x27',_0x7830('0x55'))[_0x7830('0x79')](_0x7830('0x7d'))[_0x7830('0x3c')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x5c67dd[_0x7830('0x73')][_0x7830('0x70')]())[_0x7830('0x3c')](_0x7830('0x74'))[_0x7830('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7830('0x6d')]()['field'](_0x7830('0x7e'))[_0x7830('0x79')](_0x7830('0x69'))[_0x7830('0x3c')]('CampaignId\x20=\x20?',_0x1ac28f[_0x7830('0x46')]['id'][_0x7830('0x70')]())))[_0x7830('0x70')]();break;default:_0xe9c1b5=squel[_0x7830('0x67')]()[_0x7830('0x68')](_0x7830('0x69'))['fromQuery'](['phone','scheduledAt','ContactId',_0x7830('0x6c'),_0x7830('0x5b'),_0x7830('0x54'),_0x7830('0x55')],squel[_0x7830('0x6d')]()['field'](_0x7830('0x6a'),_0x7830('0x6a'))[_0x7830('0x6e')](_0x7830('0x7c'),_0x7830('0x6f'))['field']('id',_0x7830('0x6b'))['field'](_0x5c67dd[_0x7830('0x73')]['toString'](),'ListId')[_0x7830('0x6e')](_0x1ac28f['params']['id'][_0x7830('0x70')](),_0x7830('0x5b'))[_0x7830('0x6e')]('\x27'+_0x192d31+'\x27',_0x7830('0x54'))[_0x7830('0x6e')]('\x27'+_0x192d31+'\x27','updatedAt')[_0x7830('0x79')](_0x7830('0x7d'))[_0x7830('0x3c')](_0x7830('0x71'))[_0x7830('0x3c')]('ListId\x20=\x20?',_0x5c67dd[_0x7830('0x73')][_0x7830('0x70')]())[_0x7830('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0x7830('0x70')]();}_0x4d404e=squel[_0x7830('0x67')]()['into']('cm_hopper_additional_phones')['fromQuery']([_0x7830('0x7f'),_0x7830('0x6f'),'phone',_0x7830('0x80'),'createdAt',_0x7830('0x55')],squel[_0x7830('0x6d')]()[_0x7830('0x6e')](_0x7830('0x81'),'id')[_0x7830('0x6e')]('NOW()',_0x7830('0x6f'))['field'](_0x7830('0x82'),_0x7830('0x6a'))[_0x7830('0x6e')]('ci.OrderBY','OrderBy')[_0x7830('0x6e')]('\x27'+_0x192d31+'\x27',_0x7830('0x54'))[_0x7830('0x6e')]('\x27'+_0x192d31+'\x27',_0x7830('0x55'))['from'](_0x7830('0x83'),'ci')[_0x7830('0x84')](_0x7830('0x69'),'h','h.ContactId\x20=\x20ci.CmContactId')['where'](_0x7830('0x85'),_0x5c67dd['CmListId'][_0x7830('0x70')]())['where']('h.CampaignId=?',_0x1ac28f[_0x7830('0x46')]['id'][_0x7830('0x70')]())['where'](_0x7830('0x86'),_0x192d31))[_0x7830('0x70')]();_0x2d44a5[_0x7830('0x87')](db[_0x7830('0x88')][_0x7830('0x31')](_0xe9c1b5));_0x25383b[_0x7830('0x87')](db['sequelize'][_0x7830('0x31')](_0x4d404e));}return BPromise[_0x7830('0x89')](_0x2d44a5);}})['then'](function(){return BPromise[_0x7830('0x89')](_0x25383b);})['then'](function(){return _0x242559;})[_0x7830('0x21')](respondWithResult(_0x3a4614,null))[_0x7830('0x44')](handleError(_0x3a4614,null));};exports[_0x7830('0x8a')]=function(_0x23d9b3,_0xdb7cd6,_0x29bdbc){return db[_0x7830('0x2b')][_0x7830('0x48')]({'where':{'id':_0x23d9b3['params']['id']}})[_0x7830('0x21')](handleEntityNotFound(_0xdb7cd6,null))[_0x7830('0x21')](function(_0x3204f0){if(_0x3204f0){return _0x3204f0[_0x7830('0x8a')](_0x23d9b3[_0x7830('0x31')][_0x7830('0x64')]);}})[_0x7830('0x21')](function(_0xe0245e){if(_0xe0245e){return db['CmHopper'][_0x7830('0x25')]({'where':{'ListId':_0x23d9b3[_0x7830('0x31')][_0x7830('0x64')],'CampaignId':_0x23d9b3[_0x7830('0x46')]['id']}})[_0x7830('0x21')](function(){return _0xe0245e;});}})['then'](respondWithStatusCode(_0xdb7cd6,null))[_0x7830('0x44')](handleError(_0xdb7cd6,null));};exports[_0x7830('0x8b')]=function(_0x24318a,_0x3f82b3,_0x302aa4){var _0x3915e0={};var _0x11ddcd={};var _0x187a73;var _0x200870;return db['Campaign'][_0x7830('0x57')]({'where':{'id':_0x24318a['params']['id']}})[_0x7830('0x21')](handleEntityNotFound(_0x3f82b3,null))['then'](function(_0x1534da){if(_0x1534da){_0x187a73=_0x1534da;_0x11ddcd[_0x7830('0x30')]=_[_0x7830('0x32')](db['CmList'][_0x7830('0x2c')]);_0x11ddcd[_0x7830('0x31')]=_[_0x7830('0x32')](_0x24318a[_0x7830('0x31')]);_0x11ddcd[_0x7830('0x33')]=_[_0x7830('0x34')](_0x11ddcd['model'],_0x11ddcd[_0x7830('0x31')]);_0x3915e0['attributes']=_[_0x7830('0x34')](_0x11ddcd[_0x7830('0x30')],qs[_0x7830('0x35')](_0x24318a[_0x7830('0x31')][_0x7830('0x35')]));_0x3915e0[_0x7830('0x36')]=_0x3915e0[_0x7830('0x36')][_0x7830('0x37')]?_0x3915e0[_0x7830('0x36')]:_0x11ddcd[_0x7830('0x30')];_0x3915e0[_0x7830('0x3a')]=qs['sort'](_0x24318a['query']['sort']);_0x3915e0[_0x7830('0x3c')]=qs[_0x7830('0x33')](_[_0x7830('0x3d')](_0x24318a['query'],_0x11ddcd[_0x7830('0x33')]));if(_0x24318a['query']['filter']){_0x3915e0[_0x7830('0x3c')]=_[_0x7830('0x3f')](_0x3915e0[_0x7830('0x3c')],{'$or':_[_0x7830('0x2a')](_0x3915e0['attributes'],function(_0x49da77){var _0x41e095={};_0x41e095[_0x49da77]={'$like':'%'+_0x24318a[_0x7830('0x31')][_0x7830('0x3e')]+'%'};return _0x41e095;})});}_0x3915e0=_[_0x7830('0x3f')]({},_0x3915e0,_0x24318a['options']);return _0x187a73[_0x7830('0x8b')](_0x3915e0);}})[_0x7830('0x21')](function(_0xf1ec90){if(_0xf1ec90){_0x200870=_0xf1ec90[_0x7830('0x37')];if(!_0x24318a[_0x7830('0x31')][_0x7830('0x38')](_0x7830('0x39'))){_0x3915e0[_0x7830('0x19')]=qs[_0x7830('0x19')](_0x24318a[_0x7830('0x31')][_0x7830('0x19')]);_0x3915e0['offset']=qs[_0x7830('0x17')](_0x24318a[_0x7830('0x31')]['offset']);}return _0x187a73[_0x7830('0x8b')](_0x3915e0);}})[_0x7830('0x21')](function(_0xf9532f){if(_0xf9532f){return _0xf9532f?{'count':_0x200870,'rows':_0xf9532f}:null;}})[_0x7830('0x21')](respondWithResult(_0x3f82b3,null))[_0x7830('0x44')](handleError(_0x3f82b3,null));};exports[_0x7830('0x8c')]=function(_0x16329c,_0x38e751,_0x4713af){var _0x599903,_0x59f7d1;var _0x3514df=[];var _0x164ccd=moment()[_0x7830('0x8d')](_0x7830('0x63'));return db[_0x7830('0x2b')][_0x7830('0x48')]({'where':{'id':_0x16329c[_0x7830('0x46')]['id']}})['then'](handleEntityNotFound(_0x38e751,null))[_0x7830('0x21')](function(_0xce6fbb){if(_0xce6fbb){_0x59f7d1=_0xce6fbb;return _0xce6fbb[_0x7830('0x8c')](_0x16329c[_0x7830('0x4a')][_0x7830('0x64')],_[_0x7830('0x53')](_0x16329c[_0x7830('0x4a')],['ids','id'])||{});}return null;})['spread'](function(_0xf9e8b){var _0x382886;var _0x48a5cf;_0x599903=_0xf9e8b||[];var _0x429a54=[];if(_0xf9e8b){for(var _0x417741=0x0;_0x417741<_0xf9e8b[_0x7830('0x37')];_0x417741+=0x1){var _0xa11841=_0xf9e8b[_0x417741][_0x7830('0x22')]({'plain':!![]});_0x382886=squel[_0x7830('0x67')]()['into']('cm_hopper_black')[_0x7830('0x7b')]([_0x7830('0x6a'),_0x7830('0x6b'),_0x7830('0x6c'),_0x7830('0x5b'),_0x7830('0x54'),_0x7830('0x55')],squel[_0x7830('0x6d')]()['field']('phone',_0x7830('0x6a'))[_0x7830('0x6e')]('id',_0x7830('0x6b'))[_0x7830('0x6e')](_0xa11841[_0x7830('0x73')][_0x7830('0x70')](),_0x7830('0x6c'))['field'](_0x16329c['params']['id']['toString'](),_0x7830('0x5b'))[_0x7830('0x6e')]('NOW()',_0x7830('0x54'))[_0x7830('0x6e')](_0x7830('0x7c'),_0x7830('0x55'))[_0x7830('0x79')](_0x7830('0x7d'))[_0x7830('0x3c')](_0x7830('0x71'))[_0x7830('0x3c')]('ListId\x20=\x20?',_0xa11841[_0x7830('0x73')][_0x7830('0x70')]())[_0x7830('0x3c')](_0x7830('0x74')))[_0x7830('0x70')]();_0x429a54[_0x7830('0x87')](db[_0x7830('0x88')]['query'](_0x382886));}return BPromise[_0x7830('0x89')](_0x429a54);}})[_0x7830('0x21')](function(){return _0x599903;})[_0x7830('0x21')](respondWithResult(_0x38e751,null))[_0x7830('0x44')](handleError(_0x38e751,null));};exports[_0x7830('0x8e')]=function(_0x31cc6a,_0x4f81cb,_0x4aad4d){return db['Campaign'][_0x7830('0x48')]({'where':{'id':_0x31cc6a[_0x7830('0x46')]['id']}})[_0x7830('0x21')](handleEntityNotFound(_0x4f81cb,null))[_0x7830('0x21')](function(_0x27213d){if(_0x27213d){return _0x27213d['removeBlackLists'](_0x31cc6a[_0x7830('0x31')][_0x7830('0x64')]);}})[_0x7830('0x21')](function(_0x2c5ce6){if(_0x2c5ce6){return db['CmHopperBlack'][_0x7830('0x25')]({'where':{'ListId':_0x31cc6a[_0x7830('0x31')]['ids'],'CampaignId':_0x31cc6a[_0x7830('0x46')]['id']}})[_0x7830('0x21')](function(){return _0x2c5ce6;});}})[_0x7830('0x21')](respondWithStatusCode(_0x4f81cb,null))[_0x7830('0x44')](handleError(_0x4f81cb,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index f503d92..b8f080b 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 5bb76af..9a66789 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 _0x9ff4=['options','raw','where','attributes','limit','include','model','map','then','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetCampaign','Campaign','findAll'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9ff4,0x196));var _0x49ff=function(_0x46c809,_0x401fab){_0x46c809=_0x46c809-0x0;var _0x343f17=_0x9ff4[_0x46c809];return _0x343f17;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x49ff('0x0'));var rs=require(_0x49ff('0x1'));var fs=require('fs');var Redis=require(_0x49ff('0x2'));var db=require(_0x49ff('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x49ff('0x4'))(_0x49ff('0x5'));var config=require(_0x49ff('0x6'));var jayson=require(_0x49ff('0x7'));var client=jayson[_0x49ff('0x8')][_0x49ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe967d3,_0xd87903,_0x50f784){return new BPromise(function(_0x5478a6,_0x304f83){return client[_0x49ff('0xa')](_0xe967d3,_0x50f784)['then'](function(_0x4e845a){logger[_0x49ff('0xb')](_0x49ff('0xc'),_0xd87903,_0x49ff('0xd'));logger[_0x49ff('0xe')](_0x49ff('0xf'),_0xd87903,_0x49ff('0xd'),JSON[_0x49ff('0x10')](_0x4e845a));if(_0x4e845a[_0x49ff('0x11')]){if(_0x4e845a['error']['code']===0x1f4){logger['error'](_0x49ff('0xc'),_0xd87903,_0x4e845a[_0x49ff('0x11')]['message']);return _0x304f83(_0x4e845a[_0x49ff('0x11')]['message']);}logger['error'](_0x49ff('0xc'),_0xd87903,_0x4e845a['error'][_0x49ff('0x12')]);return _0x5478a6(_0x4e845a[_0x49ff('0x11')][_0x49ff('0x12')]);}else{logger[_0x49ff('0xb')](_0x49ff('0xc'),_0xd87903,_0x49ff('0xd'));_0x5478a6(_0x4e845a[_0x49ff('0x13')][_0x49ff('0x12')]);}})['catch'](function(_0x29fb22){logger['error'](_0x49ff('0xc'),_0xd87903,_0x29fb22);_0x304f83(_0x29fb22);});});}exports[_0x49ff('0x14')]=function(_0x1a0f17){var _0x29c5d9=this;return new Promise(function(_0x255229,_0x90480f){return db[_0x49ff('0x15')][_0x49ff('0x16')]({'raw':_0x1a0f17[_0x49ff('0x17')]?_0x1a0f17['options'][_0x49ff('0x18')]===undefined?!![]:![]:!![],'where':_0x1a0f17['options']?_0x1a0f17[_0x49ff('0x17')][_0x49ff('0x19')]||null:null,'attributes':_0x1a0f17['options']?_0x1a0f17[_0x49ff('0x17')][_0x49ff('0x1a')]||null:null,'limit':_0x1a0f17['options']?_0x1a0f17['options'][_0x49ff('0x1b')]||null:null,'include':_0x1a0f17[_0x49ff('0x17')]?_0x1a0f17['options'][_0x49ff('0x1c')]?_['map'](_0x1a0f17[_0x49ff('0x17')][_0x49ff('0x1c')],function(_0xb1088){return{'model':db[_0xb1088[_0x49ff('0x1d')]],'as':_0xb1088['as'],'attributes':_0xb1088[_0x49ff('0x1a')],'include':_0xb1088[_0x49ff('0x1c')]?_[_0x49ff('0x1e')](_0xb1088[_0x49ff('0x1c')],function(_0x3c214b){return{'model':db[_0x3c214b[_0x49ff('0x1d')]],'as':_0x3c214b['as'],'attributes':_0x3c214b[_0x49ff('0x1a')],'include':_0x3c214b[_0x49ff('0x1c')]?_[_0x49ff('0x1e')](_0x3c214b['include'],function(_0x203853){return{'model':db[_0x203853[_0x49ff('0x1d')]],'as':_0x203853['as'],'attributes':_0x203853['attributes']};}):[]};}):[]};}):[]:[]})[_0x49ff('0x1f')](function(_0x1f651a){logger[_0x49ff('0xb')]('GetCampaign',_0x1a0f17);logger[_0x49ff('0xe')](_0x49ff('0x14'),_0x1a0f17,JSON[_0x49ff('0x10')](_0x1f651a));_0x255229(_0x1f651a);})[_0x49ff('0x20')](function(_0xf380ba){logger[_0x49ff('0x11')](_0x49ff('0x14'),_0xf380ba[_0x49ff('0x12')],_0x1a0f17);_0x90480f(_0x29c5d9[_0x49ff('0x11')](0x1f4,_0xf380ba[_0x49ff('0x12')]));});});}; \ No newline at end of file +var _0x70e0=['findAll','options','raw','attributes','include','map','model','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','Campaign'];(function(_0x760968,_0x2c607c){var _0x1c707b=function(_0x4cfd81){while(--_0x4cfd81){_0x760968['push'](_0x760968['shift']());}};_0x1c707b(++_0x2c607c);}(_0x70e0,0x17b));var _0x070e=function(_0x4a8e60,_0x59d8ec){_0x4a8e60=_0x4a8e60-0x0;var _0x5902f9=_0x70e0[_0x4a8e60];return _0x5902f9;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('Campaign,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('Campaign,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});}exports[_0x070e('0x16')]=function(_0x38f6e6){var _0x2060cc=this;return new Promise(function(_0x364b3f,_0x5037eb){return db[_0x070e('0x17')][_0x070e('0x18')]({'raw':_0x38f6e6[_0x070e('0x19')]?_0x38f6e6[_0x070e('0x19')][_0x070e('0x1a')]===undefined?!![]:![]:!![],'where':_0x38f6e6['options']?_0x38f6e6['options']['where']||null:null,'attributes':_0x38f6e6[_0x070e('0x19')]?_0x38f6e6[_0x070e('0x19')][_0x070e('0x1b')]||null:null,'limit':_0x38f6e6['options']?_0x38f6e6[_0x070e('0x19')]['limit']||null:null,'include':_0x38f6e6[_0x070e('0x19')]?_0x38f6e6[_0x070e('0x19')][_0x070e('0x1c')]?_[_0x070e('0x1d')](_0x38f6e6[_0x070e('0x19')][_0x070e('0x1c')],function(_0xe405e){return{'model':db[_0xe405e[_0x070e('0x1e')]],'as':_0xe405e['as'],'attributes':_0xe405e['attributes'],'include':_0xe405e[_0x070e('0x1c')]?_[_0x070e('0x1d')](_0xe405e[_0x070e('0x1c')],function(_0x503f4d){return{'model':db[_0x503f4d[_0x070e('0x1e')]],'as':_0x503f4d['as'],'attributes':_0x503f4d['attributes'],'include':_0x503f4d['include']?_[_0x070e('0x1d')](_0x503f4d[_0x070e('0x1c')],function(_0x41deb1){return{'model':db[_0x41deb1[_0x070e('0x1e')]],'as':_0x41deb1['as'],'attributes':_0x41deb1[_0x070e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x374c54){logger[_0x070e('0xb')](_0x070e('0x16'),_0x38f6e6);logger[_0x070e('0xc')](_0x070e('0x16'),_0x38f6e6,JSON[_0x070e('0xf')](_0x374c54));_0x364b3f(_0x374c54);})[_0x070e('0x15')](function(_0x26373b){logger['error'](_0x070e('0x16'),_0x26373b[_0x070e('0x13')],_0x38f6e6);_0x5037eb(_0x2060cc[_0x070e('0x10')](0x1f4,_0x26373b['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 8ee8d76..b19d9f2 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 _0x1dbd=['removeLists','removeBlackLists','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone','addLists','addBlackLists','put','update','delete','destroy'];(function(_0x35a101,_0x3859e1){var _0x18e3b4=function(_0x27c92d){while(--_0x27c92d){_0x35a101['push'](_0x35a101['shift']());}};_0x18e3b4(++_0x3859e1);}(_0x1dbd,0x1d7));var _0xd1db=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dbd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xd1db('0x0'));var path=require('path');var timeout=require(_0xd1db('0x1'));var express=require(_0xd1db('0x2'));var router=express[_0xd1db('0x3')]();var fs_extra=require(_0xd1db('0x4'));var auth=require(_0xd1db('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd1db('0x6'));var controller=require(_0xd1db('0x7'));router[_0xd1db('0x8')]('/',auth[_0xd1db('0x9')](),controller[_0xd1db('0xa')]);router[_0xd1db('0x8')](_0xd1db('0xb'),auth[_0xd1db('0x9')](),controller[_0xd1db('0xc')]);router[_0xd1db('0x8')](_0xd1db('0xd'),auth['isAuthenticated'](),controller[_0xd1db('0xe')]);router[_0xd1db('0x8')](_0xd1db('0xf'),auth['isAuthenticated'](),controller[_0xd1db('0x10')]);router[_0xd1db('0x8')](_0xd1db('0x11'),auth[_0xd1db('0x9')](),controller[_0xd1db('0x12')]);router['get']('/:id/hopper_black',auth[_0xd1db('0x9')](),controller[_0xd1db('0x13')]);router[_0xd1db('0x8')](_0xd1db('0x14'),auth[_0xd1db('0x9')](),controller[_0xd1db('0x15')]);router[_0xd1db('0x8')](_0xd1db('0x16'),auth[_0xd1db('0x9')](),controller['getBlackLists']);router[_0xd1db('0x17')]('/',auth[_0xd1db('0x9')](),controller[_0xd1db('0x18')]);router[_0xd1db('0x17')](_0xd1db('0x19'),auth[_0xd1db('0x9')](),controller[_0xd1db('0x1a')]);router['post'](_0xd1db('0x14'),auth['isAuthenticated'](),controller[_0xd1db('0x1b')]);router['post']('/:id/blacklists',auth['isAuthenticated'](),controller[_0xd1db('0x1c')]);router[_0xd1db('0x1d')](_0xd1db('0xb'),auth[_0xd1db('0x9')](),controller[_0xd1db('0x1e')]);router[_0xd1db('0x1f')](_0xd1db('0xb'),auth[_0xd1db('0x9')](),controller[_0xd1db('0x20')]);router[_0xd1db('0x1f')]('/:id/lists',auth[_0xd1db('0x9')](),controller[_0xd1db('0x21')]);router['delete'](_0xd1db('0x16'),auth[_0xd1db('0x9')](),controller[_0xd1db('0x22')]);module[_0xd1db('0x23')]=router; \ No newline at end of file +var _0xff94=['addLists','put','update','destroy','delete','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','/:id/hoppers','getHoppers','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone'];(function(_0x3e16c0,_0x4fcb17){var _0x2abad6=function(_0x50c82d){while(--_0x50c82d){_0x3e16c0['push'](_0x3e16c0['shift']());}};_0x2abad6(++_0x4fcb17);}(_0xff94,0x130));var _0x4ff9=function(_0xf1e5da,_0x3ecd47){_0xf1e5da=_0xf1e5da-0x0;var _0x331120=_0xff94[_0xf1e5da];return _0x331120;};'use strict';var multer=require(_0x4ff9('0x0'));var util=require(_0x4ff9('0x1'));var path=require(_0x4ff9('0x2'));var timeout=require(_0x4ff9('0x3'));var express=require(_0x4ff9('0x4'));var router=express[_0x4ff9('0x5')]();var fs_extra=require(_0x4ff9('0x6'));var auth=require(_0x4ff9('0x7'));var interaction=require(_0x4ff9('0x8'));var config=require(_0x4ff9('0x9'));var controller=require(_0x4ff9('0xa'));router[_0x4ff9('0xb')]('/',auth[_0x4ff9('0xc')](),controller['index']);router[_0x4ff9('0xb')](_0x4ff9('0xd'),auth[_0x4ff9('0xc')](),controller['show']);router[_0x4ff9('0xb')](_0x4ff9('0xe'),auth[_0x4ff9('0xc')](),controller[_0x4ff9('0xf')]);router[_0x4ff9('0xb')]('/:id/hopper_histories',auth[_0x4ff9('0xc')](),controller['getHopperHistories']);router[_0x4ff9('0xb')]('/:id/hopper_finals',auth[_0x4ff9('0xc')](),controller[_0x4ff9('0x10')]);router[_0x4ff9('0xb')](_0x4ff9('0x11'),auth[_0x4ff9('0xc')](),controller[_0x4ff9('0x12')]);router['get'](_0x4ff9('0x13'),auth[_0x4ff9('0xc')](),controller[_0x4ff9('0x14')]);router[_0x4ff9('0xb')](_0x4ff9('0x15'),auth[_0x4ff9('0xc')](),controller[_0x4ff9('0x16')]);router[_0x4ff9('0x17')]('/',auth[_0x4ff9('0xc')](),controller[_0x4ff9('0x18')]);router['post'](_0x4ff9('0x19'),auth[_0x4ff9('0xc')](),controller['clone']);router[_0x4ff9('0x17')](_0x4ff9('0x13'),auth[_0x4ff9('0xc')](),controller[_0x4ff9('0x1a')]);router['post'](_0x4ff9('0x15'),auth[_0x4ff9('0xc')](),controller['addBlackLists']);router[_0x4ff9('0x1b')](_0x4ff9('0xd'),auth[_0x4ff9('0xc')](),controller[_0x4ff9('0x1c')]);router['delete'](_0x4ff9('0xd'),auth[_0x4ff9('0xc')](),controller[_0x4ff9('0x1d')]);router[_0x4ff9('0x1e')](_0x4ff9('0x13'),auth[_0x4ff9('0xc')](),controller['removeLists']);router[_0x4ff9('0x1e')](_0x4ff9('0x15'),auth[_0x4ff9('0xc')](),controller[_0x4ff9('0x1f')]);module[_0x4ff9('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 9ec46aa..ddeac35 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 _0xa3d9=['VIRTUAL','key','TEXT'];(function(_0x182db3,_0x1d3698){var _0x271ec9=function(_0x5d89b0){while(--_0x5d89b0){_0x182db3['push'](_0x182db3['shift']());}};_0x271ec9(++_0x1d3698);}(_0xa3d9,0x7a));var _0x9a3d=function(_0x20a83b,_0xc6e626){_0x20a83b=_0x20a83b-0x0;var _0x4815e7=_0xa3d9[_0x20a83b];return _0x4815e7;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x9a3d('0x0')],'length':'medium','allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x9a3d('0x1')],'get':function(){return this['getDataValue'](_0x9a3d('0x2'));}}}; \ No newline at end of file +var _0x6f06=['sequelize','STRING'];(function(_0x5e32f3,_0x3386c1){var _0x4d4e03=function(_0xe86f5){while(--_0xe86f5){_0x5e32f3['push'](_0x5e32f3['shift']());}};_0x4d4e03(++_0x3386c1);}(_0x6f06,0x1b2));var _0x66f0=function(_0x7342e,_0x1c3fe7){_0x7342e=_0x7342e-0x0;var _0x524ece=_0x6f06[_0x7342e];return _0x524ece;};'use strict';var Sequelize=require(_0x66f0('0x0'));module['exports']={'key':{'type':Sequelize[_0x66f0('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0x66f0('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 6b979ac..849e275 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 _0xb0d4=['findAll','catch','show','params','includeAll','include','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','ejs','fs-extra','lodash','squel','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','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','update','then','destroy','get','CannedAnswers','UserProfileResource','sendStatus','error','name','index','CannedAnswer','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options'];(function(_0x36da2a,_0x139b77){var _0x457b21=function(_0x36eba8){while(--_0x36eba8){_0x36da2a['push'](_0x36da2a['shift']());}};_0x457b21(++_0x139b77);}(_0xb0d4,0x6b));var _0x4b0d=function(_0x43478c,_0x434288){_0x43478c=_0x43478c-0x0;var _0xc4e333=_0xb0d4[_0x43478c];return _0xc4e333;};'use strict';var emlformat=require(_0x4b0d('0x0'));var rimraf=require(_0x4b0d('0x1'));var zipdir=require(_0x4b0d('0x2'));var jsonpatch=require(_0x4b0d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4b0d('0x4'));var Mustache=require('mustache');var util=require(_0x4b0d('0x5'));var path=require(_0x4b0d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4b0d('0x7'));var fs=require('fs');var fs_extra=require(_0x4b0d('0x8'));var _=require(_0x4b0d('0x9'));var squel=require(_0x4b0d('0xa'));var crypto=require('crypto');var jsforce=require(_0x4b0d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4b0d('0xc'));var querystring=require(_0x4b0d('0xd'));var Papa=require(_0x4b0d('0xe'));var Redis=require(_0x4b0d('0xf'));var authService=require(_0x4b0d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4b0d('0x11'));var hardwareService=require(_0x4b0d('0x12'));var logger=require(_0x4b0d('0x13'))(_0x4b0d('0x14'));var utils=require(_0x4b0d('0x15'));var config=require(_0x4b0d('0x16'));var licenseUtil=require(_0x4b0d('0x17'));var db=require(_0x4b0d('0x18'))['db'];function respondWithStatusCode(_0x2ddbd0,_0x42b6a9){_0x42b6a9=_0x42b6a9||0xcc;return function(_0x2d115e){if(_0x2d115e){return _0x2ddbd0['sendStatus'](_0x42b6a9);}return _0x2ddbd0[_0x4b0d('0x19')](_0x42b6a9)[_0x4b0d('0x1a')]();};}function respondWithResult(_0x30ebe0,_0x2a1176){_0x2a1176=_0x2a1176||0xc8;return function(_0x5f3d66){if(_0x5f3d66){return _0x30ebe0[_0x4b0d('0x19')](_0x2a1176)[_0x4b0d('0x1b')](_0x5f3d66);}};}function respondWithFilteredResult(_0x16e233,_0x588f3c){return function(_0x533958){if(_0x533958){var _0x9705e7=typeof _0x588f3c['offset']===_0x4b0d('0x1c')&&typeof _0x588f3c[_0x4b0d('0x1d')]===_0x4b0d('0x1c');var _0x3ceaa1=_0x533958['count'];var _0x1d62ec=_0x9705e7?0x0:_0x588f3c[_0x4b0d('0x1e')];var _0x58962f=_0x9705e7?_0x533958[_0x4b0d('0x1f')]:_0x588f3c[_0x4b0d('0x1e')]+_0x588f3c['limit'];var _0x3a8e74;if(_0x58962f>=_0x3ceaa1){_0x58962f=_0x3ceaa1;_0x3a8e74=0xc8;}else{_0x3a8e74=0xce;}_0x16e233[_0x4b0d('0x19')](_0x3a8e74);return _0x16e233[_0x4b0d('0x20')](_0x4b0d('0x21'),_0x1d62ec+'-'+_0x58962f+'/'+_0x3ceaa1)['json'](_0x533958);}return null;};}function patchUpdates(_0x137aca){return function(_0x181d00){try{jsonpatch[_0x4b0d('0x22')](_0x181d00,_0x137aca,!![]);}catch(_0x3f18bb){return BPromise['reject'](_0x3f18bb);}return _0x181d00['save']();};}function saveUpdates(_0xc28ed4,_0x396f8d){return function(_0x1dd897){if(_0x1dd897){return _0x1dd897[_0x4b0d('0x23')](_0xc28ed4)[_0x4b0d('0x24')](function(_0x3265b0){return _0x3265b0;});}return null;};}function removeEntity(_0x29d44e,_0x17257e){return function(_0x2ffa5f){if(_0x2ffa5f){return _0x2ffa5f[_0x4b0d('0x25')]()[_0x4b0d('0x24')](function(){var _0x9ca288=_0x2ffa5f[_0x4b0d('0x26')]({'plain':!![]});var _0x260324=_0x4b0d('0x27');return db[_0x4b0d('0x28')][_0x4b0d('0x25')]({'where':{'type':_0x260324,'resourceId':_0x9ca288['id']}})[_0x4b0d('0x24')](function(){return _0x2ffa5f;});})[_0x4b0d('0x24')](function(){_0x29d44e[_0x4b0d('0x19')](0xcc)[_0x4b0d('0x1a')]();});}};}function handleEntityNotFound(_0xa63daa,_0x4ae6bb){return function(_0x5886cb){if(!_0x5886cb){_0xa63daa[_0x4b0d('0x29')](0x194);}return _0x5886cb;};}function handleError(_0x49001c,_0x6ae2f4){_0x6ae2f4=_0x6ae2f4||0x1f4;return function(_0x3fde6b){logger[_0x4b0d('0x2a')](_0x3fde6b['stack']);if(_0x3fde6b[_0x4b0d('0x2b')]){delete _0x3fde6b[_0x4b0d('0x2b')];}_0x49001c['status'](_0x6ae2f4)['send'](_0x3fde6b);};}exports[_0x4b0d('0x2c')]=function(_0x288b21,_0x144da8){var _0x53973b={},_0x43aaa8={},_0x2bcf41={'count':0x0,'rows':[]};var _0x490d0c=_['map'](db[_0x4b0d('0x2d')][_0x4b0d('0x2e')],function(_0x12a7bc){return{'name':_0x12a7bc[_0x4b0d('0x2f')],'type':_0x12a7bc[_0x4b0d('0x30')][_0x4b0d('0x31')]};});_0x43aaa8[_0x4b0d('0x32')]=_[_0x4b0d('0x33')](_0x490d0c,_0x4b0d('0x2b'));_0x43aaa8[_0x4b0d('0x34')]=_[_0x4b0d('0x35')](_0x288b21[_0x4b0d('0x34')]);_0x43aaa8['filters']=_[_0x4b0d('0x36')](_0x43aaa8[_0x4b0d('0x32')],_0x43aaa8[_0x4b0d('0x34')]);_0x53973b[_0x4b0d('0x37')]=_['intersection'](_0x43aaa8[_0x4b0d('0x32')],qs['fields'](_0x288b21['query'][_0x4b0d('0x38')]));_0x53973b['attributes']=_0x53973b['attributes'][_0x4b0d('0x39')]?_0x53973b[_0x4b0d('0x37')]:_0x43aaa8[_0x4b0d('0x32')];if(!_0x288b21[_0x4b0d('0x34')][_0x4b0d('0x3a')](_0x4b0d('0x3b'))){_0x53973b[_0x4b0d('0x1d')]=qs[_0x4b0d('0x1d')](_0x288b21['query'][_0x4b0d('0x1d')]);_0x53973b[_0x4b0d('0x1e')]=qs['offset'](_0x288b21['query'][_0x4b0d('0x1e')]);}_0x53973b[_0x4b0d('0x3c')]=qs[_0x4b0d('0x3d')](_0x288b21[_0x4b0d('0x34')][_0x4b0d('0x3d')]);_0x53973b[_0x4b0d('0x3e')]=qs[_0x4b0d('0x3f')](_['pick'](_0x288b21['query'],_0x43aaa8[_0x4b0d('0x3f')]),_0x490d0c);if(_0x288b21[_0x4b0d('0x34')][_0x4b0d('0x40')]){_0x53973b['where']=_[_0x4b0d('0x41')](_0x53973b['where'],{'$or':[{'key':{'$like':'%'+_0x288b21[_0x4b0d('0x34')][_0x4b0d('0x40')]+'%'}},{'value':{'$like':'%'+_0x288b21[_0x4b0d('0x34')][_0x4b0d('0x40')]+'%'}}]});}_0x53973b=_[_0x4b0d('0x41')]({},_0x53973b,_0x288b21[_0x4b0d('0x42')]);var _0xf8ab6d={'where':_0x53973b[_0x4b0d('0x3e')]};return db['CannedAnswer']['count'](_0xf8ab6d)[_0x4b0d('0x24')](function(_0x19edba){_0x2bcf41[_0x4b0d('0x1f')]=_0x19edba;if(_0x288b21[_0x4b0d('0x34')]['includeAll']){_0x53973b['include']=[{'all':!![]}];}return db[_0x4b0d('0x2d')][_0x4b0d('0x43')](_0x53973b);})[_0x4b0d('0x24')](function(_0x555139){_0x2bcf41['rows']=_0x555139;return _0x2bcf41;})['then'](respondWithFilteredResult(_0x144da8,_0x53973b))[_0x4b0d('0x44')](handleError(_0x144da8,null));};exports[_0x4b0d('0x45')]=function(_0x398db3,_0x324f62){var _0x4777b4={'raw':!![],'where':{'id':_0x398db3[_0x4b0d('0x46')]['id']}},_0x135d91={};_0x135d91[_0x4b0d('0x32')]=_[_0x4b0d('0x35')](db[_0x4b0d('0x2d')][_0x4b0d('0x2e')]);_0x135d91[_0x4b0d('0x34')]=_['keys'](_0x398db3['query']);_0x135d91[_0x4b0d('0x3f')]=_['intersection'](_0x135d91[_0x4b0d('0x32')],_0x135d91['query']);_0x4777b4[_0x4b0d('0x37')]=_[_0x4b0d('0x36')](_0x135d91[_0x4b0d('0x32')],qs[_0x4b0d('0x38')](_0x398db3[_0x4b0d('0x34')][_0x4b0d('0x38')]));_0x4777b4[_0x4b0d('0x37')]=_0x4777b4[_0x4b0d('0x37')][_0x4b0d('0x39')]?_0x4777b4['attributes']:_0x135d91[_0x4b0d('0x32')];if(_0x398db3[_0x4b0d('0x34')][_0x4b0d('0x47')]){_0x4777b4[_0x4b0d('0x48')]=[{'all':!![]}];}_0x4777b4=_[_0x4b0d('0x41')]({},_0x4777b4,_0x398db3[_0x4b0d('0x42')]);return db[_0x4b0d('0x2d')][_0x4b0d('0x49')](_0x4777b4)['then'](handleEntityNotFound(_0x324f62,null))[_0x4b0d('0x24')](respondWithResult(_0x324f62,null))['catch'](handleError(_0x324f62,null));};exports[_0x4b0d('0x23')]=function(_0x4a6d5f,_0x233b8a){if(_0x4a6d5f[_0x4b0d('0x4a')]['id']){delete _0x4a6d5f['body']['id'];}return db[_0x4b0d('0x2d')]['find']({'where':{'id':_0x4a6d5f[_0x4b0d('0x46')]['id']}})[_0x4b0d('0x24')](handleEntityNotFound(_0x233b8a,null))['then'](saveUpdates(_0x4a6d5f[_0x4b0d('0x4a')],null))['then'](respondWithResult(_0x233b8a,null))['catch'](handleError(_0x233b8a,null));};exports[_0x4b0d('0x25')]=function(_0x4e0e63,_0x4c753e){return db[_0x4b0d('0x2d')]['find']({'where':{'id':_0x4e0e63[_0x4b0d('0x46')]['id']}})[_0x4b0d('0x24')](handleEntityNotFound(_0x4c753e,null))['then'](removeEntity(_0x4c753e,null))[_0x4b0d('0x44')](handleError(_0x4c753e,null));};exports[_0x4b0d('0x4b')]=function(_0x21b94b,_0x11ece5){var _0x3f2d5b={'key':_0x21b94b[_0x4b0d('0x4a')]['key']};if(_0x21b94b['body'][_0x4b0d('0x4c')]){_0x3f2d5b['MailAccountId']=_0x21b94b[_0x4b0d('0x4a')][_0x4b0d('0x4c')];}else if(_0x21b94b[_0x4b0d('0x4a')][_0x4b0d('0x4d')]){_0x3f2d5b[_0x4b0d('0x4d')]=_0x21b94b[_0x4b0d('0x4a')]['SmsAccountId'];}else if(_0x21b94b['body'][_0x4b0d('0x4e')]){_0x3f2d5b[_0x4b0d('0x4e')]=_0x21b94b[_0x4b0d('0x4a')]['OpenchannelAccountId'];}else if(_0x21b94b[_0x4b0d('0x4a')][_0x4b0d('0x4f')]){_0x3f2d5b[_0x4b0d('0x4f')]=_0x21b94b[_0x4b0d('0x4a')]['ChatWebsiteId'];}return db['CannedAnswer'][_0x4b0d('0x49')]({'where':_0x3f2d5b})[_0x4b0d('0x24')](function(_0x54cba3){if(_0x54cba3){throw new db[(_0x4b0d('0x50'))][(_0x4b0d('0x51'))](_0x4b0d('0x52'));}return db[_0x4b0d('0x2d')][_0x4b0d('0x4b')](_0x21b94b[_0x4b0d('0x4a')]);})[_0x4b0d('0x24')](function(_0x1ef938){var _0x5add18=_0x21b94b[_0x4b0d('0x53')][_0x4b0d('0x26')]({'plain':!![]});if(!_0x5add18)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5add18['role']===_0x4b0d('0x53')){var _0x592674=_0x1ef938[_0x4b0d('0x26')]({'plain':!![]});return db[_0x4b0d('0x54')][_0x4b0d('0x49')]({'where':{'name':_0x4b0d('0x27'),'userProfileId':_0x5add18[_0x4b0d('0x55')]},'raw':!![]})[_0x4b0d('0x24')](function(_0x3681d8){if(_0x3681d8&&_0x3681d8[_0x4b0d('0x56')]===0x0){return db[_0x4b0d('0x28')][_0x4b0d('0x4b')]({'name':_0x592674[_0x4b0d('0x2b')],'resourceId':_0x592674['id'],'type':_0x3681d8[_0x4b0d('0x2b')],'sectionId':_0x3681d8['id']},{})[_0x4b0d('0x24')](function(){return _0x1ef938;});}else{return _0x1ef938;}})[_0x4b0d('0x44')](function(_0x79ab38){logger[_0x4b0d('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x79ab38);throw _0x79ab38;});}return _0x1ef938;})['then'](respondWithResult(_0x11ece5,0xc9))[_0x4b0d('0x44')](handleError(_0x11ece5,null));}; \ No newline at end of file +var _0x69f7=['eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','apply','update','destroy','then','get','CannedAnswers','UserProfileResource','stack','name','send','index','map','CannedAnswer','rawAttributes','type','key','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error'];(function(_0x5272e0,_0x169ce5){var _0xa4fc96=function(_0x4f359a){while(--_0x4f359a){_0x5272e0['push'](_0x5272e0['shift']());}};_0xa4fc96(++_0x169ce5);}(_0x69f7,0x10b));var _0x769f=function(_0x2b5520,_0x2d77b4){_0x2b5520=_0x2b5520-0x0;var _0x5873db=_0x69f7[_0x2b5520];return _0x5873db;};'use strict';var emlformat=require(_0x769f('0x0'));var rimraf=require(_0x769f('0x1'));var zipdir=require(_0x769f('0x2'));var jsonpatch=require(_0x769f('0x3'));var rp=require('request-promise');var moment=require(_0x769f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x769f('0x5'));var util=require(_0x769f('0x6'));var path=require(_0x769f('0x7'));var sox=require(_0x769f('0x8'));var csv=require('to-csv');var ejs=require(_0x769f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x769f('0xa'));var crypto=require(_0x769f('0xb'));var jsforce=require(_0x769f('0xc'));var deskjs=require(_0x769f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x769f('0xe'));var Papa=require(_0x769f('0xf'));var Redis=require(_0x769f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x769f('0x11'));var as=require(_0x769f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x769f('0x13'))(_0x769f('0x14'));var utils=require(_0x769f('0x15'));var config=require(_0x769f('0x16'));var licenseUtil=require(_0x769f('0x17'));var db=require(_0x769f('0x18'))['db'];function respondWithStatusCode(_0x31e7b8,_0x41c336){_0x41c336=_0x41c336||0xcc;return function(_0x4145cd){if(_0x4145cd){return _0x31e7b8[_0x769f('0x19')](_0x41c336);}return _0x31e7b8['status'](_0x41c336)[_0x769f('0x1a')]();};}function respondWithResult(_0x4a4f09,_0x5e4857){_0x5e4857=_0x5e4857||0xc8;return function(_0x12aa50){if(_0x12aa50){return _0x4a4f09[_0x769f('0x1b')](_0x5e4857)['json'](_0x12aa50);}};}function respondWithFilteredResult(_0x3d3279,_0x26ea7c){return function(_0x40074c){if(_0x40074c){var _0x45ba69=typeof _0x26ea7c['offset']===_0x769f('0x1c')&&typeof _0x26ea7c[_0x769f('0x1d')]==='undefined';var _0x2fc324=_0x40074c[_0x769f('0x1e')];var _0x49dacb=_0x45ba69?0x0:_0x26ea7c['offset'];var _0x47d7fd=_0x45ba69?_0x40074c[_0x769f('0x1e')]:_0x26ea7c[_0x769f('0x1f')]+_0x26ea7c[_0x769f('0x1d')];var _0x4a1b81;if(_0x47d7fd>=_0x2fc324){_0x47d7fd=_0x2fc324;_0x4a1b81=0xc8;}else{_0x4a1b81=0xce;}_0x3d3279['status'](_0x4a1b81);return _0x3d3279[_0x769f('0x20')](_0x769f('0x21'),_0x49dacb+'-'+_0x47d7fd+'/'+_0x2fc324)['json'](_0x40074c);}return null;};}function patchUpdates(_0x47e6a6){return function(_0x9ebcdd){try{jsonpatch[_0x769f('0x22')](_0x9ebcdd,_0x47e6a6,!![]);}catch(_0x74a59f){return BPromise['reject'](_0x74a59f);}return _0x9ebcdd['save']();};}function saveUpdates(_0x372dc7,_0x1d30eb){return function(_0x5f2197){if(_0x5f2197){return _0x5f2197[_0x769f('0x23')](_0x372dc7)['then'](function(_0x2bae5e){return _0x2bae5e;});}return null;};}function removeEntity(_0x427d26,_0x37592a){return function(_0x47774e){if(_0x47774e){return _0x47774e[_0x769f('0x24')]()[_0x769f('0x25')](function(){var _0x35a90d=_0x47774e[_0x769f('0x26')]({'plain':!![]});var _0x323f6c=_0x769f('0x27');return db[_0x769f('0x28')][_0x769f('0x24')]({'where':{'type':_0x323f6c,'resourceId':_0x35a90d['id']}})[_0x769f('0x25')](function(){return _0x47774e;});})[_0x769f('0x25')](function(){_0x427d26[_0x769f('0x1b')](0xcc)[_0x769f('0x1a')]();});}};}function handleEntityNotFound(_0x5c7b46,_0x3f056){return function(_0x33bb7c){if(!_0x33bb7c){_0x5c7b46[_0x769f('0x19')](0x194);}return _0x33bb7c;};}function handleError(_0x1610fa,_0x36ee61){_0x36ee61=_0x36ee61||0x1f4;return function(_0x35040a){logger['error'](_0x35040a[_0x769f('0x29')]);if(_0x35040a[_0x769f('0x2a')]){delete _0x35040a[_0x769f('0x2a')];}_0x1610fa[_0x769f('0x1b')](_0x36ee61)[_0x769f('0x2b')](_0x35040a);};}exports[_0x769f('0x2c')]=function(_0x5107d3,_0x5d831c){var _0x46fded={},_0x10dbaa={},_0x5c677b={'count':0x0,'rows':[]};var _0x3c1384=_[_0x769f('0x2d')](db[_0x769f('0x2e')][_0x769f('0x2f')],function(_0x35d7fb){return{'name':_0x35d7fb['fieldName'],'type':_0x35d7fb[_0x769f('0x30')][_0x769f('0x31')]};});_0x10dbaa['model']=_[_0x769f('0x2d')](_0x3c1384,_0x769f('0x2a'));_0x10dbaa['query']=_[_0x769f('0x32')](_0x5107d3[_0x769f('0x33')]);_0x10dbaa['filters']=_['intersection'](_0x10dbaa[_0x769f('0x34')],_0x10dbaa[_0x769f('0x33')]);_0x46fded[_0x769f('0x35')]=_[_0x769f('0x36')](_0x10dbaa[_0x769f('0x34')],qs[_0x769f('0x37')](_0x5107d3['query']['fields']));_0x46fded[_0x769f('0x35')]=_0x46fded['attributes'][_0x769f('0x38')]?_0x46fded[_0x769f('0x35')]:_0x10dbaa[_0x769f('0x34')];if(!_0x5107d3['query'][_0x769f('0x39')]('nolimit')){_0x46fded[_0x769f('0x1d')]=qs['limit'](_0x5107d3[_0x769f('0x33')][_0x769f('0x1d')]);_0x46fded['offset']=qs[_0x769f('0x1f')](_0x5107d3[_0x769f('0x33')][_0x769f('0x1f')]);}_0x46fded[_0x769f('0x3a')]=qs['sort'](_0x5107d3[_0x769f('0x33')][_0x769f('0x3b')]);_0x46fded[_0x769f('0x3c')]=qs[_0x769f('0x3d')](_['pick'](_0x5107d3[_0x769f('0x33')],_0x10dbaa[_0x769f('0x3d')]),_0x3c1384);if(_0x5107d3[_0x769f('0x33')][_0x769f('0x3e')]){_0x46fded[_0x769f('0x3c')]=_[_0x769f('0x3f')](_0x46fded['where'],{'$or':[{'key':{'$like':'%'+_0x5107d3[_0x769f('0x33')][_0x769f('0x3e')]+'%'}},{'value':{'$like':'%'+_0x5107d3[_0x769f('0x33')]['filter']+'%'}}]});}_0x46fded=_[_0x769f('0x3f')]({},_0x46fded,_0x5107d3['options']);var _0x5f6251={'where':_0x46fded[_0x769f('0x3c')]};return db[_0x769f('0x2e')]['count'](_0x5f6251)[_0x769f('0x25')](function(_0x3792ec){_0x5c677b[_0x769f('0x1e')]=_0x3792ec;if(_0x5107d3[_0x769f('0x33')][_0x769f('0x40')]){_0x46fded[_0x769f('0x41')]=[{'all':!![]}];}return db[_0x769f('0x2e')][_0x769f('0x42')](_0x46fded);})['then'](function(_0x4f8a5b){_0x5c677b[_0x769f('0x43')]=_0x4f8a5b;return _0x5c677b;})[_0x769f('0x25')](respondWithFilteredResult(_0x5d831c,_0x46fded))[_0x769f('0x44')](handleError(_0x5d831c,null));};exports[_0x769f('0x45')]=function(_0x593712,_0x5a7822){var _0x43af02={'raw':!![],'where':{'id':_0x593712[_0x769f('0x46')]['id']}},_0x57d17e={};_0x57d17e[_0x769f('0x34')]=_['keys'](db[_0x769f('0x2e')][_0x769f('0x2f')]);_0x57d17e['query']=_[_0x769f('0x32')](_0x593712['query']);_0x57d17e[_0x769f('0x3d')]=_[_0x769f('0x36')](_0x57d17e[_0x769f('0x34')],_0x57d17e[_0x769f('0x33')]);_0x43af02[_0x769f('0x35')]=_[_0x769f('0x36')](_0x57d17e[_0x769f('0x34')],qs[_0x769f('0x37')](_0x593712[_0x769f('0x33')][_0x769f('0x37')]));_0x43af02['attributes']=_0x43af02['attributes']['length']?_0x43af02[_0x769f('0x35')]:_0x57d17e[_0x769f('0x34')];if(_0x593712[_0x769f('0x33')][_0x769f('0x40')]){_0x43af02[_0x769f('0x41')]=[{'all':!![]}];}_0x43af02=_[_0x769f('0x3f')]({},_0x43af02,_0x593712[_0x769f('0x47')]);return db[_0x769f('0x2e')][_0x769f('0x48')](_0x43af02)[_0x769f('0x25')](handleEntityNotFound(_0x5a7822,null))['then'](respondWithResult(_0x5a7822,null))['catch'](handleError(_0x5a7822,null));};exports[_0x769f('0x23')]=function(_0x5e35f9,_0x4b3fe6){if(_0x5e35f9[_0x769f('0x49')]['id']){delete _0x5e35f9[_0x769f('0x49')]['id'];}return db[_0x769f('0x2e')][_0x769f('0x48')]({'where':{'id':_0x5e35f9[_0x769f('0x46')]['id']}})[_0x769f('0x25')](handleEntityNotFound(_0x4b3fe6,null))[_0x769f('0x25')](saveUpdates(_0x5e35f9[_0x769f('0x49')],null))[_0x769f('0x25')](respondWithResult(_0x4b3fe6,null))[_0x769f('0x44')](handleError(_0x4b3fe6,null));};exports[_0x769f('0x24')]=function(_0x171240,_0xf411f0){return db[_0x769f('0x2e')][_0x769f('0x48')]({'where':{'id':_0x171240[_0x769f('0x46')]['id']}})[_0x769f('0x25')](handleEntityNotFound(_0xf411f0,null))[_0x769f('0x25')](removeEntity(_0xf411f0,null))[_0x769f('0x44')](handleError(_0xf411f0,null));};exports[_0x769f('0x4a')]=function(_0x36cb80,_0xf80bba){var _0x53ab9a={'key':_0x36cb80[_0x769f('0x49')][_0x769f('0x31')]};if(_0x36cb80[_0x769f('0x49')][_0x769f('0x4b')]){_0x53ab9a['MailAccountId']=_0x36cb80[_0x769f('0x49')][_0x769f('0x4b')];}else if(_0x36cb80[_0x769f('0x49')][_0x769f('0x4c')]){_0x53ab9a[_0x769f('0x4c')]=_0x36cb80[_0x769f('0x49')][_0x769f('0x4c')];}else if(_0x36cb80[_0x769f('0x49')][_0x769f('0x4d')]){_0x53ab9a['OpenchannelAccountId']=_0x36cb80[_0x769f('0x49')]['OpenchannelAccountId'];}else if(_0x36cb80[_0x769f('0x49')]['ChatWebsiteId']){_0x53ab9a[_0x769f('0x4e')]=_0x36cb80[_0x769f('0x49')]['ChatWebsiteId'];}return db[_0x769f('0x2e')][_0x769f('0x48')]({'where':_0x53ab9a})[_0x769f('0x25')](function(_0x377176){if(_0x377176){throw new db[(_0x769f('0x4f'))][(_0x769f('0x50'))](_0x769f('0x51'));}return db[_0x769f('0x2e')][_0x769f('0x4a')](_0x36cb80[_0x769f('0x49')]);})[_0x769f('0x25')](function(_0x1b1023){var _0x476a96=_0x36cb80['user'][_0x769f('0x26')]({'plain':!![]});if(!_0x476a96)throw new Error(_0x769f('0x52'));if(_0x476a96[_0x769f('0x53')]===_0x769f('0x54')){var _0x5f2487=_0x1b1023['get']({'plain':!![]});return db[_0x769f('0x55')][_0x769f('0x48')]({'where':{'name':'CannedAnswers','userProfileId':_0x476a96[_0x769f('0x56')]},'raw':!![]})[_0x769f('0x25')](function(_0x6c3807){if(_0x6c3807&&_0x6c3807[_0x769f('0x57')]===0x0){return db[_0x769f('0x28')][_0x769f('0x4a')]({'name':_0x5f2487[_0x769f('0x2a')],'resourceId':_0x5f2487['id'],'type':_0x6c3807['name'],'sectionId':_0x6c3807['id']},{})[_0x769f('0x25')](function(){return _0x1b1023;});}else{return _0x1b1023;}})[_0x769f('0x44')](function(_0x36455c){logger[_0x769f('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36455c);throw _0x36455c;});}return _0x1b1023;})['then'](respondWithResult(_0xf80bba,0xc9))[_0x769f('0x44')](handleError(_0xf80bba,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 3c66f81..d6e4200 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 _0xbe54=['path','rimraf','../../config/environment','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x21444f,_0x15f33f){var _0x5f43c3=function(_0x500ce8){while(--_0x500ce8){_0x21444f['push'](_0x21444f['shift']());}};_0x5f43c3(++_0x15f33f);}(_0xbe54,0xe8));var _0x4be5=function(_0x323adc,_0x2688c6){_0x323adc=_0x323adc-0x0;var _0x5ae824=_0xbe54[_0x323adc];return _0x5ae824;};'use strict';var _=require(_0x4be5('0x0'));var util=require(_0x4be5('0x1'));var logger=require(_0x4be5('0x2'))(_0x4be5('0x3'));var moment=require('moment');var BPromise=require(_0x4be5('0x4'));var rp=require(_0x4be5('0x5'));var fs=require('fs');var path=require(_0x4be5('0x6'));var rimraf=require(_0x4be5('0x7'));var config=require(_0x4be5('0x8'));var attributes=require('./cannedAnswer.attributes');module[_0x4be5('0x9')]=function(_0x4f8c72,_0x12b64c){return _0x4f8c72['define'](_0x4be5('0xa'),attributes,{'tableName':_0x4be5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4be5('0xc'),'collate':_0x4be5('0xd')});}; \ No newline at end of file +var _0x5e32=['CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','moment','request-promise','path','rimraf','exports','define'];(function(_0x3a0228,_0x2725a6){var _0x5dc524=function(_0xc656fb){while(--_0xc656fb){_0x3a0228['push'](_0x3a0228['shift']());}};_0x5dc524(++_0x2725a6);}(_0x5e32,0x17f));var _0x25e3=function(_0xc0e2c4,_0xa4c81e){_0xc0e2c4=_0xc0e2c4-0x0;var _0x3e378c=_0x5e32[_0xc0e2c4];return _0x3e378c;};'use strict';var _=require(_0x25e3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x25e3('0x1'));var BPromise=require('bluebird');var rp=require(_0x25e3('0x2'));var fs=require('fs');var path=require(_0x25e3('0x3'));var rimraf=require(_0x25e3('0x4'));var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module[_0x25e3('0x5')]=function(_0x874d86,_0x4bc3e0){return _0x874d86[_0x25e3('0x6')](_0x25e3('0x7'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x25e3('0x8'),'collate':_0x25e3('0x9')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index f0dfba2..834b904 100644 --- a/server/api/cannedAnswer/cannedAnswer.rpc.js +++ b/server/api/cannedAnswer/cannedAnswer.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4c203a,_0x11ed5c){var _0x3db15f=function(_0x1a7e0f){while(--_0x1a7e0f){_0x4c203a['push'](_0x4c203a['shift']());}};_0x3db15f(++_0x11ed5c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4ca0fe,_0x15679a){var _0x55fd76=function(_0x4ffb61){while(--_0x4ffb61){_0x4ca0fe['push'](_0x4ca0fe['shift']());}};_0x55fd76(++_0x15679a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index d16f922..c2451b6 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 _0xc155=['post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2cd077,_0x442246){var _0x483c19=function(_0x50a3bd){while(--_0x50a3bd){_0x2cd077['push'](_0x2cd077['shift']());}};_0x483c19(++_0x442246);}(_0xc155,0x196));var _0x5c15=function(_0x55cbb1,_0x3a5e3c){_0x55cbb1=_0x55cbb1-0x0;var _0x38b5e0=_0xc155[_0x55cbb1];return _0x38b5e0;};'use strict';var multer=require(_0x5c15('0x0'));var util=require(_0x5c15('0x1'));var path=require('path');var timeout=require(_0x5c15('0x2'));var express=require('express');var router=express[_0x5c15('0x3')]();var fs_extra=require(_0x5c15('0x4'));var auth=require(_0x5c15('0x5'));var interaction=require(_0x5c15('0x6'));var config=require(_0x5c15('0x7'));var controller=require(_0x5c15('0x8'));router[_0x5c15('0x9')]('/',auth[_0x5c15('0xa')](),controller[_0x5c15('0xb')]);router[_0x5c15('0x9')](_0x5c15('0xc'),auth[_0x5c15('0xa')](),controller[_0x5c15('0xd')]);router[_0x5c15('0xe')]('/',auth[_0x5c15('0xa')](),controller[_0x5c15('0xf')]);router[_0x5c15('0x10')](_0x5c15('0xc'),auth[_0x5c15('0xa')](),controller['update']);router[_0x5c15('0x11')]('/:id',auth[_0x5c15('0xa')](),controller[_0x5c15('0x12')]);module[_0x5c15('0x13')]=router; \ No newline at end of file +var _0x392b=['./cannedAnswer.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x86c6cb,_0x30bb53){var _0x1b1592=function(_0x19e1c9){while(--_0x19e1c9){_0x86c6cb['push'](_0x86c6cb['shift']());}};_0x1b1592(++_0x30bb53);}(_0x392b,0xdc));var _0xb392=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x392b[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xb392('0x0'));var util=require('util');var path=require(_0xb392('0x1'));var timeout=require(_0xb392('0x2'));var express=require(_0xb392('0x3'));var router=express[_0xb392('0x4')]();var fs_extra=require(_0xb392('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb392('0x6'));var config=require(_0xb392('0x7'));var controller=require(_0xb392('0x8'));router[_0xb392('0x9')]('/',auth[_0xb392('0xa')](),controller['index']);router['get'](_0xb392('0xb'),auth['isAuthenticated'](),controller[_0xb392('0xc')]);router[_0xb392('0xd')]('/',auth[_0xb392('0xa')](),controller[_0xb392('0xe')]);router['put'](_0xb392('0xb'),auth[_0xb392('0xa')](),controller[_0xb392('0xf')]);router[_0xb392('0x10')](_0xb392('0xb'),auth[_0xb392('0xa')](),controller[_0xb392('0x11')]);module[_0xb392('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index ed2b080..84993b1 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 _0x1667=['DATE','STRING','INTEGER','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1667,0xfd));var _0x7166=function(_0x11f5ff,_0xa0ef18){_0x11f5ff=_0x11f5ff-0x0;var _0x46eefb=_0x1667[_0x11f5ff];return _0x46eefb;};'use strict';var Sequelize=require(_0x7166('0x0'));module[_0x7166('0x1')]={'calldate':{'type':Sequelize[_0x7166('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x7166('0x3')]},'dst':{'type':Sequelize[_0x7166('0x3')]},'dcontext':{'type':Sequelize[_0x7166('0x3')]},'channel':{'type':Sequelize[_0x7166('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x7166('0x3')]},'lastdata':{'type':Sequelize[_0x7166('0x3')]},'duration':{'type':Sequelize[_0x7166('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7166('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x7166('0x3')]},'userfield':{'type':Sequelize[_0x7166('0x3')]},'uniqueid':{'type':Sequelize[_0x7166('0x3')]},'linkedid':{'type':Sequelize[_0x7166('0x3')]},'sequence':{'type':Sequelize[_0x7166('0x3')]},'peeraccount':{'type':Sequelize[_0x7166('0x3')]},'type':{'type':Sequelize[_0x7166('0x3')]},'tag':{'type':Sequelize[_0x7166('0x3')]}}; \ No newline at end of file +var _0xde71=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xde71,0x1c1));var _0x1de7=function(_0x2ef8c1,_0x2f72f4){_0x2ef8c1=_0x2ef8c1-0x0;var _0x288305=_0xde71[_0x2ef8c1];return _0x288305;};'use strict';var Sequelize=require(_0x1de7('0x0'));module[_0x1de7('0x1')]={'calldate':{'type':Sequelize[_0x1de7('0x2')],'allowNull':![],'defaultValue':_0x1de7('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x1de7('0x4')]},'dst':{'type':Sequelize[_0x1de7('0x4')]},'dcontext':{'type':Sequelize[_0x1de7('0x4')]},'channel':{'type':Sequelize[_0x1de7('0x4')]},'dstchannel':{'type':Sequelize[_0x1de7('0x4')]},'lastapp':{'type':Sequelize[_0x1de7('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x1de7('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x1de7('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1de7('0x4')]},'amaflags':{'type':Sequelize[_0x1de7('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x1de7('0x4')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x1de7('0x4')]},'sequence':{'type':Sequelize[_0x1de7('0x4')]},'peeraccount':{'type':Sequelize[_0x1de7('0x4')]},'type':{'type':Sequelize[_0x1de7('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index dd63e46..1a6838f 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 _0x56e6=['keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','count','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','index','Cdr','rawAttributes','fieldName','model','map','name'];(function(_0x4f9522,_0x399e9f){var _0x5a89a7=function(_0x853a9a){while(--_0x853a9a){_0x4f9522['push'](_0x4f9522['shift']());}};_0x5a89a7(++_0x399e9f);}(_0x56e6,0x6b));var _0x656e=function(_0x379eb3,_0x42926e){_0x379eb3=_0x379eb3-0x0;var _0x5ce3cb=_0x56e6[_0x379eb3];return _0x5ce3cb;};'use strict';var emlformat=require(_0x656e('0x0'));var rimraf=require(_0x656e('0x1'));var zipdir=require(_0x656e('0x2'));var jsonpatch=require(_0x656e('0x3'));var rp=require(_0x656e('0x4'));var moment=require(_0x656e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x656e('0x6'));var util=require(_0x656e('0x7'));var path=require(_0x656e('0x8'));var sox=require(_0x656e('0x9'));var csv=require(_0x656e('0xa'));var ejs=require(_0x656e('0xb'));var fs=require('fs');var fs_extra=require(_0x656e('0xc'));var _=require('lodash');var squel=require(_0x656e('0xd'));var crypto=require(_0x656e('0xe'));var jsforce=require(_0x656e('0xf'));var deskjs=require(_0x656e('0x10'));var toCsv=require(_0x656e('0xa'));var querystring=require(_0x656e('0x11'));var Papa=require(_0x656e('0x12'));var Redis=require(_0x656e('0x13'));var authService=require(_0x656e('0x14'));var qs=require(_0x656e('0x15'));var as=require(_0x656e('0x16'));var hardwareService=require(_0x656e('0x17'));var logger=require(_0x656e('0x18'))(_0x656e('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x656e('0x1a'));var db=require(_0x656e('0x1b'))['db'];function respondWithStatusCode(_0x3cb3c8,_0x460aad){_0x460aad=_0x460aad||0xcc;return function(_0x581525){if(_0x581525){return _0x3cb3c8['sendStatus'](_0x460aad);}return _0x3cb3c8[_0x656e('0x1c')](_0x460aad)[_0x656e('0x1d')]();};}function respondWithResult(_0x53699e,_0x230249){_0x230249=_0x230249||0xc8;return function(_0x5059d9){if(_0x5059d9){return _0x53699e[_0x656e('0x1c')](_0x230249)[_0x656e('0x1e')](_0x5059d9);}};}function respondWithFilteredResult(_0x2a52f7,_0x1f839f){return function(_0x5a1fc3){if(_0x5a1fc3){var _0x3ab51b=typeof _0x1f839f[_0x656e('0x1f')]===_0x656e('0x20')&&typeof _0x1f839f[_0x656e('0x21')]===_0x656e('0x20');var _0x4fd12e=_0x5a1fc3['count'];var _0x526b83=_0x3ab51b?0x0:_0x1f839f[_0x656e('0x1f')];var _0x1b0fdd=_0x3ab51b?_0x5a1fc3['count']:_0x1f839f[_0x656e('0x1f')]+_0x1f839f['limit'];var _0x495f60;if(_0x1b0fdd>=_0x4fd12e){_0x1b0fdd=_0x4fd12e;_0x495f60=0xc8;}else{_0x495f60=0xce;}_0x2a52f7['status'](_0x495f60);return _0x2a52f7[_0x656e('0x22')](_0x656e('0x23'),_0x526b83+'-'+_0x1b0fdd+'/'+_0x4fd12e)[_0x656e('0x1e')](_0x5a1fc3);}return null;};}function patchUpdates(_0x141587){return function(_0x5532ee){try{jsonpatch[_0x656e('0x24')](_0x5532ee,_0x141587,!![]);}catch(_0x543338){return BPromise[_0x656e('0x25')](_0x543338);}return _0x5532ee['save']();};}function saveUpdates(_0x159e42,_0x1acca5){return function(_0x19ab77){if(_0x19ab77){return _0x19ab77[_0x656e('0x26')](_0x159e42)[_0x656e('0x27')](function(_0x38ea02){return _0x38ea02;});}return null;};}function removeEntity(_0x382a5f,_0x57ac6c){return function(_0x44551b){if(_0x44551b){return _0x44551b[_0x656e('0x28')]()['then'](function(){_0x382a5f['status'](0xcc)[_0x656e('0x1d')]();});}};}function handleEntityNotFound(_0x517021,_0x33fb09){return function(_0x5b492e){if(!_0x5b492e){_0x517021['sendStatus'](0x194);}return _0x5b492e;};}function handleError(_0xa834a5,_0x4e2a80){_0x4e2a80=_0x4e2a80||0x1f4;return function(_0x26870d){logger[_0x656e('0x29')](_0x26870d[_0x656e('0x2a')]);if(_0x26870d['name']){delete _0x26870d['name'];}_0xa834a5[_0x656e('0x1c')](_0x4e2a80)[_0x656e('0x2b')](_0x26870d);};}exports[_0x656e('0x2c')]=function(_0x469acf,_0xc2a01){var _0x264e88={},_0xfece84={},_0x58181e={'count':0x0,'rows':[]};var _0x84d034=_['map'](db[_0x656e('0x2d')][_0x656e('0x2e')],function(_0x58cf11){return{'name':_0x58cf11[_0x656e('0x2f')],'type':_0x58cf11['type']['key']};});_0xfece84[_0x656e('0x30')]=_[_0x656e('0x31')](_0x84d034,_0x656e('0x32'));_0xfece84['query']=_[_0x656e('0x33')](_0x469acf['query']);_0xfece84[_0x656e('0x34')]=_[_0x656e('0x35')](_0xfece84['model'],_0xfece84[_0x656e('0x36')]);_0x264e88['attributes']=_['intersection'](_0xfece84[_0x656e('0x30')],qs['fields'](_0x469acf[_0x656e('0x36')][_0x656e('0x37')]));_0x264e88[_0x656e('0x38')]=_0x264e88[_0x656e('0x38')]['length']?_0x264e88['attributes']:_0xfece84[_0x656e('0x30')];if(!_0x469acf['query'][_0x656e('0x39')](_0x656e('0x3a'))){_0x264e88[_0x656e('0x21')]=qs[_0x656e('0x21')](_0x469acf[_0x656e('0x36')][_0x656e('0x21')]);_0x264e88['offset']=qs['offset'](_0x469acf['query']['offset']);}_0x264e88['order']=qs[_0x656e('0x3b')](_0x469acf['query']['sort']);_0x264e88[_0x656e('0x3c')]=qs[_0x656e('0x34')](_[_0x656e('0x3d')](_0x469acf[_0x656e('0x36')],_0xfece84[_0x656e('0x34')]),_0x84d034);if(_0x469acf[_0x656e('0x36')][_0x656e('0x3e')]){_0x264e88[_0x656e('0x3c')]=_[_0x656e('0x3f')](_0x264e88[_0x656e('0x3c')],{'$or':_[_0x656e('0x31')](_0x84d034,function(_0x46306a){if(_0x46306a[_0x656e('0x40')]!=='VIRTUAL'){var _0x3c1a70={};_0x3c1a70[_0x46306a['name']]={'$like':'%'+_0x469acf['query'][_0x656e('0x3e')]+'%'};return _0x3c1a70;}})});}_0x264e88=_[_0x656e('0x3f')]({},_0x264e88,_0x469acf[_0x656e('0x41')]);var _0x5cd5e9={'where':_0x264e88['where']};return db['Cdr'][_0x656e('0x42')](_0x5cd5e9)[_0x656e('0x27')](function(_0x3e6266){_0x58181e[_0x656e('0x42')]=_0x3e6266;if(_0x469acf[_0x656e('0x36')][_0x656e('0x43')]){_0x264e88[_0x656e('0x44')]=[{'all':!![]}];}return db[_0x656e('0x2d')][_0x656e('0x45')](_0x264e88);})[_0x656e('0x27')](function(_0x3f81fa){_0x58181e[_0x656e('0x46')]=_0x3f81fa;return _0x58181e;})[_0x656e('0x27')](respondWithFilteredResult(_0xc2a01,_0x264e88))['catch'](handleError(_0xc2a01,null));};exports[_0x656e('0x47')]=function(_0x562482,_0x21af67){var _0x3f3d5e={'raw':!![],'where':{'id':_0x562482[_0x656e('0x48')]['id']}},_0x4045c4={};_0x4045c4[_0x656e('0x30')]=_[_0x656e('0x33')](db[_0x656e('0x2d')][_0x656e('0x2e')]);_0x4045c4[_0x656e('0x36')]=_[_0x656e('0x33')](_0x562482['query']);_0x4045c4[_0x656e('0x34')]=_[_0x656e('0x35')](_0x4045c4[_0x656e('0x30')],_0x4045c4['query']);_0x3f3d5e['attributes']=_[_0x656e('0x35')](_0x4045c4[_0x656e('0x30')],qs[_0x656e('0x37')](_0x562482[_0x656e('0x36')]['fields']));_0x3f3d5e[_0x656e('0x38')]=_0x3f3d5e[_0x656e('0x38')][_0x656e('0x49')]?_0x3f3d5e[_0x656e('0x38')]:_0x4045c4[_0x656e('0x30')];if(_0x562482['query'][_0x656e('0x43')]){_0x3f3d5e[_0x656e('0x44')]=[{'all':!![]}];}_0x3f3d5e=_[_0x656e('0x3f')]({},_0x3f3d5e,_0x562482[_0x656e('0x41')]);return db[_0x656e('0x2d')][_0x656e('0x4a')](_0x3f3d5e)['then'](handleEntityNotFound(_0x21af67,null))[_0x656e('0x27')](respondWithResult(_0x21af67,null))[_0x656e('0x4b')](handleError(_0x21af67,null));};exports[_0x656e('0x4c')]=function(_0x904b8a,_0x5dbcfb){return db['Cdr'][_0x656e('0x4c')](_0x904b8a['body'],{})['then'](respondWithResult(_0x5dbcfb,0xc9))['catch'](handleError(_0x5dbcfb,null));};exports[_0x656e('0x26')]=function(_0x2c648e,_0x59cb0f){if(_0x2c648e['body']['id']){delete _0x2c648e['body']['id'];}return db['Cdr'][_0x656e('0x4a')]({'where':{'id':_0x2c648e[_0x656e('0x48')]['id']}})['then'](handleEntityNotFound(_0x59cb0f,null))[_0x656e('0x27')](saveUpdates(_0x2c648e[_0x656e('0x4d')],null))[_0x656e('0x27')](respondWithResult(_0x59cb0f,null))[_0x656e('0x4b')](handleError(_0x59cb0f,null));};exports[_0x656e('0x28')]=function(_0x3e8d90,_0x2dac52){return db[_0x656e('0x2d')][_0x656e('0x4a')]({'where':{'id':_0x3e8d90[_0x656e('0x48')]['id']}})[_0x656e('0x27')](handleEntityNotFound(_0x2dac52,null))['then'](removeEntity(_0x2dac52,null))['catch'](handleError(_0x2dac52,null));};exports['describe']=function(_0x47e622,_0x464881){return db[_0x656e('0x2d')][_0x656e('0x4e')]()['then'](respondWithResult(_0x464881,null))['catch'](handleError(_0x464881,null));}; \ No newline at end of file +var _0x0bde=['findAll','rows','create','body','catch','update','find','params','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x0bde,0xe7));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe0bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0bd('0x1'));var rp=require(_0xe0bd('0x2'));var moment=require(_0xe0bd('0x3'));var BPromise=require(_0xe0bd('0x4'));var Mustache=require(_0xe0bd('0x5'));var util=require('util');var path=require(_0xe0bd('0x6'));var sox=require(_0xe0bd('0x7'));var csv=require(_0xe0bd('0x8'));var ejs=require(_0xe0bd('0x9'));var fs=require('fs');var fs_extra=require(_0xe0bd('0xa'));var _=require(_0xe0bd('0xb'));var squel=require(_0xe0bd('0xc'));var crypto=require('crypto');var jsforce=require(_0xe0bd('0xd'));var deskjs=require(_0xe0bd('0xe'));var toCsv=require(_0xe0bd('0x8'));var querystring=require(_0xe0bd('0xf'));var Papa=require(_0xe0bd('0x10'));var Redis=require(_0xe0bd('0x11'));var authService=require(_0xe0bd('0x12'));var qs=require(_0xe0bd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe0bd('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe0bd('0x15'));var db=require(_0xe0bd('0x16'))['db'];function respondWithStatusCode(_0x54d40e,_0xc492b4){_0xc492b4=_0xc492b4||0xcc;return function(_0x5272ca){if(_0x5272ca){return _0x54d40e[_0xe0bd('0x17')](_0xc492b4);}return _0x54d40e[_0xe0bd('0x18')](_0xc492b4)[_0xe0bd('0x19')]();};}function respondWithResult(_0x20ab47,_0x47664e){_0x47664e=_0x47664e||0xc8;return function(_0x335f17){if(_0x335f17){return _0x20ab47[_0xe0bd('0x18')](_0x47664e)[_0xe0bd('0x1a')](_0x335f17);}};}function respondWithFilteredResult(_0x4f63fa,_0x50891d){return function(_0x4fb006){if(_0x4fb006){var _0x2ff887=typeof _0x50891d[_0xe0bd('0x1b')]===_0xe0bd('0x1c')&&typeof _0x50891d[_0xe0bd('0x1d')]===_0xe0bd('0x1c');var _0x55f304=_0x4fb006['count'];var _0x1becc8=_0x2ff887?0x0:_0x50891d['offset'];var _0x4f36f7=_0x2ff887?_0x4fb006[_0xe0bd('0x1e')]:_0x50891d[_0xe0bd('0x1b')]+_0x50891d[_0xe0bd('0x1d')];var _0x5f22e2;if(_0x4f36f7>=_0x55f304){_0x4f36f7=_0x55f304;_0x5f22e2=0xc8;}else{_0x5f22e2=0xce;}_0x4f63fa[_0xe0bd('0x18')](_0x5f22e2);return _0x4f63fa[_0xe0bd('0x1f')](_0xe0bd('0x20'),_0x1becc8+'-'+_0x4f36f7+'/'+_0x55f304)['json'](_0x4fb006);}return null;};}function patchUpdates(_0x1bf742){return function(_0x25f595){try{jsonpatch[_0xe0bd('0x21')](_0x25f595,_0x1bf742,!![]);}catch(_0x532584){return BPromise[_0xe0bd('0x22')](_0x532584);}return _0x25f595[_0xe0bd('0x23')]();};}function saveUpdates(_0x2b4f7d,_0x5378d2){return function(_0x1d6a19){if(_0x1d6a19){return _0x1d6a19['update'](_0x2b4f7d)[_0xe0bd('0x24')](function(_0x2bcfcc){return _0x2bcfcc;});}return null;};}function removeEntity(_0x4bcd48,_0xa4a4e9){return function(_0xf6d956){if(_0xf6d956){return _0xf6d956[_0xe0bd('0x25')]()[_0xe0bd('0x24')](function(){_0x4bcd48[_0xe0bd('0x18')](0xcc)[_0xe0bd('0x19')]();});}};}function handleEntityNotFound(_0x2096a2,_0x162356){return function(_0x537708){if(!_0x537708){_0x2096a2['sendStatus'](0x194);}return _0x537708;};}function handleError(_0x275f14,_0x39c98e){_0x39c98e=_0x39c98e||0x1f4;return function(_0x47d171){logger['error'](_0x47d171[_0xe0bd('0x26')]);if(_0x47d171[_0xe0bd('0x27')]){delete _0x47d171[_0xe0bd('0x27')];}_0x275f14[_0xe0bd('0x18')](_0x39c98e)['send'](_0x47d171);};}exports[_0xe0bd('0x28')]=function(_0x4ef39b,_0x9146fe){var _0x170874={},_0x42bea7={},_0x1b857c={'count':0x0,'rows':[]};var _0x1e2020=_[_0xe0bd('0x29')](db[_0xe0bd('0x2a')][_0xe0bd('0x2b')],function(_0x25d515){return{'name':_0x25d515[_0xe0bd('0x2c')],'type':_0x25d515[_0xe0bd('0x2d')][_0xe0bd('0x2e')]};});_0x42bea7[_0xe0bd('0x2f')]=_['map'](_0x1e2020,_0xe0bd('0x27'));_0x42bea7[_0xe0bd('0x30')]=_[_0xe0bd('0x31')](_0x4ef39b[_0xe0bd('0x30')]);_0x42bea7[_0xe0bd('0x32')]=_[_0xe0bd('0x33')](_0x42bea7['model'],_0x42bea7['query']);_0x170874[_0xe0bd('0x34')]=_[_0xe0bd('0x33')](_0x42bea7[_0xe0bd('0x2f')],qs[_0xe0bd('0x35')](_0x4ef39b[_0xe0bd('0x30')][_0xe0bd('0x35')]));_0x170874[_0xe0bd('0x34')]=_0x170874['attributes'][_0xe0bd('0x36')]?_0x170874[_0xe0bd('0x34')]:_0x42bea7[_0xe0bd('0x2f')];if(!_0x4ef39b[_0xe0bd('0x30')][_0xe0bd('0x37')](_0xe0bd('0x38'))){_0x170874['limit']=qs[_0xe0bd('0x1d')](_0x4ef39b[_0xe0bd('0x30')][_0xe0bd('0x1d')]);_0x170874[_0xe0bd('0x1b')]=qs[_0xe0bd('0x1b')](_0x4ef39b['query']['offset']);}_0x170874[_0xe0bd('0x39')]=qs[_0xe0bd('0x3a')](_0x4ef39b[_0xe0bd('0x30')]['sort']);_0x170874[_0xe0bd('0x3b')]=qs['filters'](_['pick'](_0x4ef39b[_0xe0bd('0x30')],_0x42bea7[_0xe0bd('0x32')]),_0x1e2020);if(_0x4ef39b['query']['filter']){_0x170874['where']=_[_0xe0bd('0x3c')](_0x170874[_0xe0bd('0x3b')],{'$or':_[_0xe0bd('0x29')](_0x1e2020,function(_0x5d2aff){if(_0x5d2aff[_0xe0bd('0x2d')]!==_0xe0bd('0x3d')){var _0x1e6823={};_0x1e6823[_0x5d2aff['name']]={'$like':'%'+_0x4ef39b['query'][_0xe0bd('0x3e')]+'%'};return _0x1e6823;}})});}_0x170874=_['merge']({},_0x170874,_0x4ef39b[_0xe0bd('0x3f')]);var _0x195f0f={'where':_0x170874['where']};return db[_0xe0bd('0x2a')][_0xe0bd('0x1e')](_0x195f0f)[_0xe0bd('0x24')](function(_0xb65059){_0x1b857c[_0xe0bd('0x1e')]=_0xb65059;if(_0x4ef39b[_0xe0bd('0x30')][_0xe0bd('0x40')]){_0x170874['include']=[{'all':!![]}];}return db[_0xe0bd('0x2a')][_0xe0bd('0x41')](_0x170874);})[_0xe0bd('0x24')](function(_0x3c138e){_0x1b857c[_0xe0bd('0x42')]=_0x3c138e;return _0x1b857c;})['then'](respondWithFilteredResult(_0x9146fe,_0x170874))['catch'](handleError(_0x9146fe,null));};exports['show']=function(_0x2b27b1,_0x1a121f){var _0x15de49={'raw':!![],'where':{'id':_0x2b27b1['params']['id']}},_0x32ed4f={};_0x32ed4f['model']=_[_0xe0bd('0x31')](db[_0xe0bd('0x2a')][_0xe0bd('0x2b')]);_0x32ed4f[_0xe0bd('0x30')]=_[_0xe0bd('0x31')](_0x2b27b1[_0xe0bd('0x30')]);_0x32ed4f[_0xe0bd('0x32')]=_['intersection'](_0x32ed4f[_0xe0bd('0x2f')],_0x32ed4f['query']);_0x15de49[_0xe0bd('0x34')]=_[_0xe0bd('0x33')](_0x32ed4f['model'],qs['fields'](_0x2b27b1[_0xe0bd('0x30')][_0xe0bd('0x35')]));_0x15de49[_0xe0bd('0x34')]=_0x15de49[_0xe0bd('0x34')][_0xe0bd('0x36')]?_0x15de49[_0xe0bd('0x34')]:_0x32ed4f[_0xe0bd('0x2f')];if(_0x2b27b1[_0xe0bd('0x30')][_0xe0bd('0x40')]){_0x15de49['include']=[{'all':!![]}];}_0x15de49=_[_0xe0bd('0x3c')]({},_0x15de49,_0x2b27b1[_0xe0bd('0x3f')]);return db[_0xe0bd('0x2a')]['find'](_0x15de49)[_0xe0bd('0x24')](handleEntityNotFound(_0x1a121f,null))[_0xe0bd('0x24')](respondWithResult(_0x1a121f,null))['catch'](handleError(_0x1a121f,null));};exports[_0xe0bd('0x43')]=function(_0x136ac6,_0x578792){return db[_0xe0bd('0x2a')][_0xe0bd('0x43')](_0x136ac6[_0xe0bd('0x44')],{})['then'](respondWithResult(_0x578792,0xc9))[_0xe0bd('0x45')](handleError(_0x578792,null));};exports[_0xe0bd('0x46')]=function(_0x147438,_0x21ae20){if(_0x147438[_0xe0bd('0x44')]['id']){delete _0x147438[_0xe0bd('0x44')]['id'];}return db[_0xe0bd('0x2a')][_0xe0bd('0x47')]({'where':{'id':_0x147438[_0xe0bd('0x48')]['id']}})['then'](handleEntityNotFound(_0x21ae20,null))['then'](saveUpdates(_0x147438['body'],null))[_0xe0bd('0x24')](respondWithResult(_0x21ae20,null))[_0xe0bd('0x45')](handleError(_0x21ae20,null));};exports['destroy']=function(_0xacd120,_0x284ea3){return db[_0xe0bd('0x2a')][_0xe0bd('0x47')]({'where':{'id':_0xacd120[_0xe0bd('0x48')]['id']}})[_0xe0bd('0x24')](handleEntityNotFound(_0x284ea3,null))[_0xe0bd('0x24')](removeEntity(_0x284ea3,null))[_0xe0bd('0x45')](handleError(_0x284ea3,null));};exports[_0xe0bd('0x49')]=function(_0x2631f5,_0x503939){return db[_0xe0bd('0x2a')][_0xe0bd('0x49')]()[_0xe0bd('0x24')](respondWithResult(_0x503939,null))['catch'](handleError(_0x503939,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index b67ed01..9a848d3 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x47dc31,_0x1b909c){var _0x1a43d0=function(_0x382e23){while(--_0x382e23){_0x47dc31['push'](_0x47dc31['shift']());}};_0x1a43d0(++_0x1b909c);}(_0x7a54,0x106));var _0x47a5=function(_0x5f1eda,_0x31127f){_0x5f1eda=_0x5f1eda-0x0;var _0x13e399=_0x7a54[_0x5f1eda];return _0x13e399;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0xc1385f,_0x9c0bea){var _0x2d1bee=function(_0x4b5d8d){while(--_0x4b5d8d){_0xc1385f['push'](_0xc1385f['shift']());}};_0x2d1bee(++_0x9c0bea);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 48b731c..bdde1a6 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 _0xe248=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','code','error','Cdr,\x20%s,\x20%s','message','catch','lodash','moment'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xe248,0x1e1));var _0x8e24=function(_0x30aeb6,_0x1832ed){_0x30aeb6=_0x30aeb6-0x0;var _0x1ca9fa=_0xe248[_0x30aeb6];return _0x1ca9fa;};'use strict';var _=require(_0x8e24('0x0'));var util=require('util');var moment=require(_0x8e24('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e24('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e24('0x3'));var logger=require(_0x8e24('0x4'))(_0x8e24('0x5'));var config=require(_0x8e24('0x6'));var jayson=require(_0x8e24('0x7'));var client=jayson[_0x8e24('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a61cf,_0x4ae089,_0x4b36bd){return new BPromise(function(_0x4be706,_0xabb84c){return client[_0x8e24('0x9')](_0x4a61cf,_0x4b36bd)[_0x8e24('0xa')](function(_0x25068e){logger[_0x8e24('0xb')]('Cdr,\x20%s,\x20%s',_0x4ae089,_0x8e24('0xc'));logger[_0x8e24('0xd')](_0x8e24('0xe'),_0x4ae089,_0x8e24('0xc'),JSON[_0x8e24('0xf')](_0x25068e));if(_0x25068e['error']){if(_0x25068e['error'][_0x8e24('0x10')]===0x1f4){logger[_0x8e24('0x11')](_0x8e24('0x12'),_0x4ae089,_0x25068e[_0x8e24('0x11')][_0x8e24('0x13')]);return _0xabb84c(_0x25068e['error']['message']);}logger[_0x8e24('0x11')](_0x8e24('0x12'),_0x4ae089,_0x25068e[_0x8e24('0x11')][_0x8e24('0x13')]);return _0x4be706(_0x25068e[_0x8e24('0x11')][_0x8e24('0x13')]);}else{logger[_0x8e24('0xb')]('Cdr,\x20%s,\x20%s',_0x4ae089,_0x8e24('0xc'));_0x4be706(_0x25068e['result'][_0x8e24('0x13')]);}})[_0x8e24('0x14')](function(_0x267fb6){logger[_0x8e24('0x11')](_0x8e24('0x12'),_0x4ae089,_0x267fb6);_0xabb84c(_0x267fb6);});});} \ No newline at end of file +var _0x88d7=['Cdr,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5bc1fe,_0x458299){var _0x482b91=function(_0xeb37d0){while(--_0xeb37d0){_0x5bc1fe['push'](_0x5bc1fe['shift']());}};_0x482b91(++_0x458299);}(_0x88d7,0x107));var _0x788d=function(_0xd9d17d,_0x3f089b){_0xd9d17d=_0xd9d17d-0x0;var _0x487156=_0x88d7[_0xd9d17d];return _0x487156;};'use strict';var _=require(_0x788d('0x0'));var util=require(_0x788d('0x1'));var moment=require('moment');var BPromise=require(_0x788d('0x2'));var rs=require(_0x788d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x788d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x788d('0x5'))(_0x788d('0x6'));var config=require(_0x788d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x788d('0x8')][_0x788d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2679d0,_0x3497b6,_0x4babe1){return new BPromise(function(_0x100dc7,_0x50dbfa){return client['request'](_0x2679d0,_0x4babe1)[_0x788d('0xa')](function(_0x4af167){logger[_0x788d('0xb')]('Cdr,\x20%s,\x20%s',_0x3497b6,'request\x20sent');logger['debug'](_0x788d('0xc'),_0x3497b6,_0x788d('0xd'),JSON[_0x788d('0xe')](_0x4af167));if(_0x4af167[_0x788d('0xf')]){if(_0x4af167[_0x788d('0xf')][_0x788d('0x10')]===0x1f4){logger[_0x788d('0xf')](_0x788d('0x11'),_0x3497b6,_0x4af167['error'][_0x788d('0x12')]);return _0x50dbfa(_0x4af167['error']['message']);}logger[_0x788d('0xf')](_0x788d('0x11'),_0x3497b6,_0x4af167['error'][_0x788d('0x12')]);return _0x100dc7(_0x4af167[_0x788d('0xf')][_0x788d('0x12')]);}else{logger[_0x788d('0xb')]('Cdr,\x20%s,\x20%s',_0x3497b6,_0x788d('0xd'));_0x100dc7(_0x4af167['result']['message']);}})[_0x788d('0x13')](function(_0x113d90){logger[_0x788d('0xf')]('Cdr,\x20%s,\x20%s',_0x3497b6,_0x113d90);_0x50dbfa(_0x113d90);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index a51063e..9e01cdf 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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','./cdr.controller','get','index','/describe','show','post'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 1b61683..49d83e5 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 _0x1722=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1722,0x85));var _0x2172=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x1722[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x2172('0x0'));module[_0x2172('0x1')]={'priority':{'type':Sequelize[_0x2172('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2172('0x3')],'allowNull':![],'defaultValue':_0x2172('0x4')},'appdata':{'type':Sequelize[_0x2172('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2172('0x6')}}; \ No newline at end of file +var _0xd56d=['STRING','noop','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xd56d,0x15a));var _0xdd56=function(_0x4b9dc9,_0x14b3a2){_0x4b9dc9=_0x4b9dc9-0x0;var _0x57b302=_0xd56d[_0x4b9dc9];return _0x57b302;};'use strict';var Sequelize=require(_0xdd56('0x0'));module['exports']={'priority':{'type':Sequelize[_0xdd56('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xdd56('0x2')],'allowNull':![],'defaultValue':_0xdd56('0x3')},'appdata':{'type':Sequelize[_0xdd56('0x4')]()},'description':{'type':Sequelize[_0xdd56('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xdd56('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index f2f82cb..46eafdf 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 _0x5d86=['find','body','params','catch','eml-format','rimraf','request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../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','then','destroy','error','stack','name','show','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options'];(function(_0x4d0662,_0x145963){var _0x6eea6d=function(_0x2def06){while(--_0x2def06){_0x4d0662['push'](_0x4d0662['shift']());}};_0x6eea6d(++_0x145963);}(_0x5d86,0x76));var _0x65d8=function(_0x2e8889,_0xcd72f9){_0x2e8889=_0x2e8889-0x0;var _0x19dae6=_0x5d86[_0x2e8889];return _0x19dae6;};'use strict';var emlformat=require(_0x65d8('0x0'));var rimraf=require(_0x65d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x65d8('0x2'));var moment=require('moment');var BPromise=require(_0x65d8('0x3'));var Mustache=require(_0x65d8('0x4'));var util=require('util');var path=require(_0x65d8('0x5'));var sox=require('sox');var csv=require(_0x65d8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x65d8('0x7'));var _=require(_0x65d8('0x8'));var squel=require('squel');var crypto=require(_0x65d8('0x9'));var jsforce=require(_0x65d8('0xa'));var deskjs=require(_0x65d8('0xb'));var toCsv=require(_0x65d8('0x6'));var querystring=require(_0x65d8('0xc'));var Papa=require(_0x65d8('0xd'));var Redis=require(_0x65d8('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x65d8('0xf'));var logger=require(_0x65d8('0x10'))(_0x65d8('0x11'));var utils=require(_0x65d8('0x12'));var config=require(_0x65d8('0x13'));var licenseUtil=require(_0x65d8('0x14'));var db=require(_0x65d8('0x15'))['db'];function respondWithStatusCode(_0x32c2ee,_0x5430c9){_0x5430c9=_0x5430c9||0xcc;return function(_0x2a7c1c){if(_0x2a7c1c){return _0x32c2ee[_0x65d8('0x16')](_0x5430c9);}return _0x32c2ee[_0x65d8('0x17')](_0x5430c9)[_0x65d8('0x18')]();};}function respondWithResult(_0x50997d,_0x26bc7d){_0x26bc7d=_0x26bc7d||0xc8;return function(_0xc02e5c){if(_0xc02e5c){return _0x50997d[_0x65d8('0x17')](_0x26bc7d)[_0x65d8('0x19')](_0xc02e5c);}};}function respondWithFilteredResult(_0x27fd83,_0x41a4e0){return function(_0x459676){if(_0x459676){var _0x374e10=typeof _0x41a4e0['offset']===_0x65d8('0x1a')&&typeof _0x41a4e0[_0x65d8('0x1b')]===_0x65d8('0x1a');var _0x1138df=_0x459676[_0x65d8('0x1c')];var _0x509036=_0x374e10?0x0:_0x41a4e0[_0x65d8('0x1d')];var _0xa15a5b=_0x374e10?_0x459676[_0x65d8('0x1c')]:_0x41a4e0[_0x65d8('0x1d')]+_0x41a4e0[_0x65d8('0x1b')];var _0x3782b8;if(_0xa15a5b>=_0x1138df){_0xa15a5b=_0x1138df;_0x3782b8=0xc8;}else{_0x3782b8=0xce;}_0x27fd83[_0x65d8('0x17')](_0x3782b8);return _0x27fd83['set'](_0x65d8('0x1e'),_0x509036+'-'+_0xa15a5b+'/'+_0x1138df)['json'](_0x459676);}return null;};}function patchUpdates(_0x3f88fc){return function(_0x565123){try{jsonpatch[_0x65d8('0x1f')](_0x565123,_0x3f88fc,!![]);}catch(_0x41d9b0){return BPromise[_0x65d8('0x20')](_0x41d9b0);}return _0x565123[_0x65d8('0x21')]();};}function saveUpdates(_0x4dbe5e,_0x559649){return function(_0x24861b){if(_0x24861b){return _0x24861b[_0x65d8('0x22')](_0x4dbe5e)[_0x65d8('0x23')](function(_0x1e56ed){return _0x1e56ed;});}return null;};}function removeEntity(_0x5c8282,_0x506e46){return function(_0x23c6e2){if(_0x23c6e2){return _0x23c6e2[_0x65d8('0x24')]()['then'](function(){_0x5c8282[_0x65d8('0x17')](0xcc)[_0x65d8('0x18')]();});}};}function handleEntityNotFound(_0x5daeb6,_0x2da44c){return function(_0x12493a){if(!_0x12493a){_0x5daeb6[_0x65d8('0x16')](0x194);}return _0x12493a;};}function handleError(_0x4e7958,_0x7779ad){_0x7779ad=_0x7779ad||0x1f4;return function(_0x5b5fe3){logger[_0x65d8('0x25')](_0x5b5fe3[_0x65d8('0x26')]);if(_0x5b5fe3[_0x65d8('0x27')]){delete _0x5b5fe3['name'];}_0x4e7958['status'](_0x7779ad)['send'](_0x5b5fe3);};}exports[_0x65d8('0x28')]=function(_0x29bafd,_0x1581a2){var _0x2d5ef2={'raw':!![],'where':{'id':_0x29bafd['params']['id']}},_0x128956={};_0x128956[_0x65d8('0x29')]=_[_0x65d8('0x2a')](db[_0x65d8('0x2b')][_0x65d8('0x2c')]);_0x128956[_0x65d8('0x2d')]=_[_0x65d8('0x2a')](_0x29bafd[_0x65d8('0x2d')]);_0x128956[_0x65d8('0x2e')]=_[_0x65d8('0x2f')](_0x128956[_0x65d8('0x29')],_0x128956['query']);_0x2d5ef2[_0x65d8('0x30')]=_[_0x65d8('0x2f')](_0x128956[_0x65d8('0x29')],qs['fields'](_0x29bafd[_0x65d8('0x2d')][_0x65d8('0x31')]));_0x2d5ef2['attributes']=_0x2d5ef2[_0x65d8('0x30')][_0x65d8('0x32')]?_0x2d5ef2[_0x65d8('0x30')]:_0x128956[_0x65d8('0x29')];if(_0x29bafd['query']['includeAll']){_0x2d5ef2['include']=[{'all':!![]}];}_0x2d5ef2=_[_0x65d8('0x33')]({},_0x2d5ef2,_0x29bafd[_0x65d8('0x34')]);return db['ChatApplication'][_0x65d8('0x35')](_0x2d5ef2)[_0x65d8('0x23')](handleEntityNotFound(_0x1581a2,null))[_0x65d8('0x23')](respondWithResult(_0x1581a2,null))['catch'](handleError(_0x1581a2,null));};exports[_0x65d8('0x22')]=function(_0x42a778,_0x11383f){if(_0x42a778[_0x65d8('0x36')]['id']){delete _0x42a778[_0x65d8('0x36')]['id'];}return db['ChatApplication'][_0x65d8('0x35')]({'where':{'id':_0x42a778[_0x65d8('0x37')]['id']}})['then'](handleEntityNotFound(_0x11383f,null))[_0x65d8('0x23')](saveUpdates(_0x42a778[_0x65d8('0x36')],null))[_0x65d8('0x23')](respondWithResult(_0x11383f,null))['catch'](handleError(_0x11383f,null));};exports[_0x65d8('0x24')]=function(_0x574908,_0x5ee9be){return db[_0x65d8('0x2b')][_0x65d8('0x35')]({'where':{'id':_0x574908[_0x65d8('0x37')]['id']}})['then'](handleEntityNotFound(_0x5ee9be,null))[_0x65d8('0x23')](removeEntity(_0x5ee9be,null))[_0x65d8('0x38')](handleError(_0x5ee9be,null));}; \ No newline at end of file +var _0x6427=['fast-json-patch','request-promise','moment','bluebird','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','status','stack','name','send','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','body','params','catch','rimraf','zip-dir'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x6427,0xbe));var _0x7642=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x6427[_0x4baae2];return _0x1a2285;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7642('0x0'));var zipdir=require(_0x7642('0x1'));var jsonpatch=require(_0x7642('0x2'));var rp=require(_0x7642('0x3'));var moment=require(_0x7642('0x4'));var BPromise=require(_0x7642('0x5'));var Mustache=require('mustache');var util=require(_0x7642('0x6'));var path=require(_0x7642('0x7'));var sox=require(_0x7642('0x8'));var csv=require(_0x7642('0x9'));var ejs=require(_0x7642('0xa'));var fs=require('fs');var fs_extra=require(_0x7642('0xb'));var _=require(_0x7642('0xc'));var squel=require(_0x7642('0xd'));var crypto=require(_0x7642('0xe'));var jsforce=require(_0x7642('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7642('0x10'));var Papa=require(_0x7642('0x11'));var Redis=require(_0x7642('0x12'));var authService=require(_0x7642('0x13'));var qs=require(_0x7642('0x14'));var as=require(_0x7642('0x15'));var hardwareService=require(_0x7642('0x16'));var logger=require(_0x7642('0x17'))(_0x7642('0x18'));var utils=require(_0x7642('0x19'));var config=require(_0x7642('0x1a'));var licenseUtil=require(_0x7642('0x1b'));var db=require(_0x7642('0x1c'))['db'];function respondWithStatusCode(_0x3e5f50,_0x3c1291){_0x3c1291=_0x3c1291||0xcc;return function(_0x32e5c9){if(_0x32e5c9){return _0x3e5f50[_0x7642('0x1d')](_0x3c1291);}return _0x3e5f50['status'](_0x3c1291)[_0x7642('0x1e')]();};}function respondWithResult(_0x3adb30,_0x4930f4){_0x4930f4=_0x4930f4||0xc8;return function(_0x146ef9){if(_0x146ef9){return _0x3adb30['status'](_0x4930f4)[_0x7642('0x1f')](_0x146ef9);}};}function respondWithFilteredResult(_0x506c94,_0x1aa890){return function(_0x37964a){if(_0x37964a){var _0x3b87aa=typeof _0x1aa890[_0x7642('0x20')]===_0x7642('0x21')&&typeof _0x1aa890[_0x7642('0x22')]===_0x7642('0x21');var _0x4b04a7=_0x37964a[_0x7642('0x23')];var _0x392686=_0x3b87aa?0x0:_0x1aa890[_0x7642('0x20')];var _0x96bc79=_0x3b87aa?_0x37964a['count']:_0x1aa890['offset']+_0x1aa890[_0x7642('0x22')];var _0x42db03;if(_0x96bc79>=_0x4b04a7){_0x96bc79=_0x4b04a7;_0x42db03=0xc8;}else{_0x42db03=0xce;}_0x506c94['status'](_0x42db03);return _0x506c94[_0x7642('0x24')](_0x7642('0x25'),_0x392686+'-'+_0x96bc79+'/'+_0x4b04a7)['json'](_0x37964a);}return null;};}function patchUpdates(_0x503c13){return function(_0xb6b0c4){try{jsonpatch[_0x7642('0x26')](_0xb6b0c4,_0x503c13,!![]);}catch(_0x580573){return BPromise['reject'](_0x580573);}return _0xb6b0c4[_0x7642('0x27')]();};}function saveUpdates(_0xc23c3,_0x37de2b){return function(_0x4f55d4){if(_0x4f55d4){return _0x4f55d4[_0x7642('0x28')](_0xc23c3)[_0x7642('0x29')](function(_0x508265){return _0x508265;});}return null;};}function removeEntity(_0x606a05,_0x812f9){return function(_0xf31489){if(_0xf31489){return _0xf31489[_0x7642('0x2a')]()['then'](function(){_0x606a05[_0x7642('0x2b')](0xcc)[_0x7642('0x1e')]();});}};}function handleEntityNotFound(_0x1b8eac,_0x15148a){return function(_0x5b74c3){if(!_0x5b74c3){_0x1b8eac[_0x7642('0x1d')](0x194);}return _0x5b74c3;};}function handleError(_0x5c2750,_0x1993e3){_0x1993e3=_0x1993e3||0x1f4;return function(_0x2083f6){logger['error'](_0x2083f6[_0x7642('0x2c')]);if(_0x2083f6[_0x7642('0x2d')]){delete _0x2083f6[_0x7642('0x2d')];}_0x5c2750['status'](_0x1993e3)[_0x7642('0x2e')](_0x2083f6);};}exports['show']=function(_0x3f4764,_0x6e04c5){var _0x4a4fee={'raw':!![],'where':{'id':_0x3f4764['params']['id']}},_0x788aa9={};_0x788aa9[_0x7642('0x2f')]=_[_0x7642('0x30')](db[_0x7642('0x31')][_0x7642('0x32')]);_0x788aa9[_0x7642('0x33')]=_[_0x7642('0x30')](_0x3f4764[_0x7642('0x33')]);_0x788aa9[_0x7642('0x34')]=_[_0x7642('0x35')](_0x788aa9[_0x7642('0x2f')],_0x788aa9[_0x7642('0x33')]);_0x4a4fee[_0x7642('0x36')]=_['intersection'](_0x788aa9['model'],qs[_0x7642('0x37')](_0x3f4764[_0x7642('0x33')][_0x7642('0x37')]));_0x4a4fee['attributes']=_0x4a4fee[_0x7642('0x36')][_0x7642('0x38')]?_0x4a4fee['attributes']:_0x788aa9[_0x7642('0x2f')];if(_0x3f4764['query'][_0x7642('0x39')]){_0x4a4fee[_0x7642('0x3a')]=[{'all':!![]}];}_0x4a4fee=_[_0x7642('0x3b')]({},_0x4a4fee,_0x3f4764['options']);return db['ChatApplication'][_0x7642('0x3c')](_0x4a4fee)['then'](handleEntityNotFound(_0x6e04c5,null))['then'](respondWithResult(_0x6e04c5,null))['catch'](handleError(_0x6e04c5,null));};exports['update']=function(_0x3dd01f,_0x160c10){if(_0x3dd01f[_0x7642('0x3d')]['id']){delete _0x3dd01f[_0x7642('0x3d')]['id'];}return db[_0x7642('0x31')][_0x7642('0x3c')]({'where':{'id':_0x3dd01f[_0x7642('0x3e')]['id']}})[_0x7642('0x29')](handleEntityNotFound(_0x160c10,null))[_0x7642('0x29')](saveUpdates(_0x3dd01f[_0x7642('0x3d')],null))['then'](respondWithResult(_0x160c10,null))['catch'](handleError(_0x160c10,null));};exports['destroy']=function(_0xc5edf3,_0x22ed74){return db[_0x7642('0x31')][_0x7642('0x3c')]({'where':{'id':_0xc5edf3[_0x7642('0x3e')]['id']}})[_0x7642('0x29')](handleEntityNotFound(_0x22ed74,null))[_0x7642('0x29')](removeEntity(_0x22ed74,null))[_0x7642('0x3f')](handleError(_0x22ed74,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 7b36aa7..e571437 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 _0x1a8f=['request-promise','exports','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5497b9,_0x4217fd){var _0x1ec0cc=function(_0xd0cc8d){while(--_0xd0cc8d){_0x5497b9['push'](_0x5497b9['shift']());}};_0x1ec0cc(++_0x4217fd);}(_0x1a8f,0x87));var _0xf1a8=function(_0x17a9a4,_0x103238){_0x17a9a4=_0x17a9a4-0x0;var _0x148d98=_0x1a8f[_0x17a9a4];return _0x148d98;};'use strict';var _=require(_0xf1a8('0x0'));var util=require('util');var logger=require(_0xf1a8('0x1'))(_0xf1a8('0x2'));var moment=require(_0xf1a8('0x3'));var BPromise=require(_0xf1a8('0x4'));var rp=require(_0xf1a8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0xf1a8('0x6')]=function(_0x515ff3,_0x29dc33){return _0x515ff3['define'](_0xf1a8('0x7'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf1a8('0x8'),'collate':_0xf1a8('0x9')});}; \ No newline at end of file +var _0x4971=['bluebird','request-promise','path','rimraf','../../config/environment','define','chat_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x27b095,_0x2ead9b){var _0x282066=function(_0x3ace01){while(--_0x3ace01){_0x27b095['push'](_0x27b095['shift']());}};_0x282066(++_0x2ead9b);}(_0x4971,0xa4));var _0x1497=function(_0x3120e6,_0x324456){_0x3120e6=_0x3120e6-0x0;var _0x5b739f=_0x4971[_0x3120e6];return _0x5b739f;};'use strict';var _=require(_0x1497('0x0'));var util=require('util');var logger=require(_0x1497('0x1'))(_0x1497('0x2'));var moment=require(_0x1497('0x3'));var BPromise=require(_0x1497('0x4'));var rp=require(_0x1497('0x5'));var fs=require('fs');var path=require(_0x1497('0x6'));var rimraf=require(_0x1497('0x7'));var config=require(_0x1497('0x8'));var attributes=require('./chatApplication.attributes');module['exports']=function(_0x57b934,_0x53edf1){return _0x57b934[_0x1497('0x9')]('ChatApplication',attributes,{'tableName':_0x1497('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1497('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index db768a2..305d974 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 _0xab18=['jayson/promise','client','http','request','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x2b53b8,_0x10b2ef){var _0x4938ca=function(_0x29f100){while(--_0x29f100){_0x2b53b8['push'](_0x2b53b8['shift']());}};_0x4938ca(++_0x10b2ef);}(_0xab18,0x184));var _0x8ab1=function(_0x2dd312,_0x449783){_0x2dd312=_0x2dd312-0x0;var _0x2d9528=_0xab18[_0x2dd312];return _0x2d9528;};'use strict';var _=require(_0x8ab1('0x0'));var util=require(_0x8ab1('0x1'));var moment=require(_0x8ab1('0x2'));var BPromise=require(_0x8ab1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ab1('0x4'));var db=require(_0x8ab1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8ab1('0x6'))(_0x8ab1('0x7'));var config=require('../../config/environment');var jayson=require(_0x8ab1('0x8'));var client=jayson[_0x8ab1('0x9')][_0x8ab1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c0736,_0xbfdab2,_0x4c24cd){return new BPromise(function(_0x392cbf,_0x36e64e){return client[_0x8ab1('0xb')](_0x3c0736,_0x4c24cd)['then'](function(_0x38c6fc){logger['info'](_0x8ab1('0xc'),_0xbfdab2,_0x8ab1('0xd'));logger[_0x8ab1('0xe')](_0x8ab1('0xf'),_0xbfdab2,_0x8ab1('0xd'),JSON[_0x8ab1('0x10')](_0x38c6fc));if(_0x38c6fc[_0x8ab1('0x11')]){if(_0x38c6fc[_0x8ab1('0x11')]['code']===0x1f4){logger[_0x8ab1('0x11')](_0x8ab1('0xc'),_0xbfdab2,_0x38c6fc[_0x8ab1('0x11')][_0x8ab1('0x12')]);return _0x36e64e(_0x38c6fc[_0x8ab1('0x11')][_0x8ab1('0x12')]);}logger[_0x8ab1('0x11')](_0x8ab1('0xc'),_0xbfdab2,_0x38c6fc['error'][_0x8ab1('0x12')]);return _0x392cbf(_0x38c6fc[_0x8ab1('0x11')][_0x8ab1('0x12')]);}else{logger[_0x8ab1('0x13')](_0x8ab1('0xc'),_0xbfdab2,_0x8ab1('0xd'));_0x392cbf(_0x38c6fc[_0x8ab1('0x14')]['message']);}})[_0x8ab1('0x15')](function(_0x3eecea){logger[_0x8ab1('0x11')](_0x8ab1('0xc'),_0xbfdab2,_0x3eecea);_0x36e64e(_0x3eecea);});});} \ No newline at end of file +var _0x7bc8=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x23dabd,_0x577de7){var _0x3580a1=function(_0x39204e){while(--_0x39204e){_0x23dabd['push'](_0x23dabd['shift']());}};_0x3580a1(++_0x577de7);}(_0x7bc8,0x16a));var _0x87bc=function(_0x3a832f,_0x1de647){_0x3a832f=_0x3a832f-0x0;var _0x13f6c2=_0x7bc8[_0x3a832f];return _0x13f6c2;};'use strict';var _=require(_0x87bc('0x0'));var util=require(_0x87bc('0x1'));var moment=require('moment');var BPromise=require(_0x87bc('0x2'));var rs=require(_0x87bc('0x3'));var fs=require('fs');var Redis=require(_0x87bc('0x4'));var db=require(_0x87bc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x87bc('0x6'))('rpc');var config=require(_0x87bc('0x7'));var jayson=require(_0x87bc('0x8'));var client=jayson[_0x87bc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12a2fa,_0x1329fe,_0xc2b90b){return new BPromise(function(_0x582fbb,_0x5038af){return client[_0x87bc('0xa')](_0x12a2fa,_0xc2b90b)[_0x87bc('0xb')](function(_0x211610){logger[_0x87bc('0xc')](_0x87bc('0xd'),_0x1329fe,_0x87bc('0xe'));logger[_0x87bc('0xf')](_0x87bc('0x10'),_0x1329fe,_0x87bc('0xe'),JSON[_0x87bc('0x11')](_0x211610));if(_0x211610[_0x87bc('0x12')]){if(_0x211610[_0x87bc('0x12')][_0x87bc('0x13')]===0x1f4){logger[_0x87bc('0x12')](_0x87bc('0xd'),_0x1329fe,_0x211610[_0x87bc('0x12')][_0x87bc('0x14')]);return _0x5038af(_0x211610['error']['message']);}logger[_0x87bc('0x12')](_0x87bc('0xd'),_0x1329fe,_0x211610[_0x87bc('0x12')]['message']);return _0x582fbb(_0x211610[_0x87bc('0x12')][_0x87bc('0x14')]);}else{logger[_0x87bc('0xc')](_0x87bc('0xd'),_0x1329fe,'request\x20sent');_0x582fbb(_0x211610[_0x87bc('0x15')][_0x87bc('0x14')]);}})[_0x87bc('0x16')](function(_0x22a6c4){logger[_0x87bc('0x12')](_0x87bc('0xd'),_0x1329fe,_0x22a6c4);_0x5038af(_0x22a6c4);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index b3fb076..8c272e4 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 _0x3dc5=['../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','show','put','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x58d247,_0x7b28a8){var _0x5c159e=function(_0x4768a6){while(--_0x4768a6){_0x58d247['push'](_0x58d247['shift']());}};_0x5c159e(++_0x7b28a8);}(_0x3dc5,0x19b));var _0x53dc=function(_0x4d4339,_0x3fe4cf){_0x4d4339=_0x4d4339-0x0;var _0x5a8d97=_0x3dc5[_0x4d4339];return _0x5a8d97;};'use strict';var multer=require(_0x53dc('0x0'));var util=require('util');var path=require(_0x53dc('0x1'));var timeout=require(_0x53dc('0x2'));var express=require(_0x53dc('0x3'));var router=express[_0x53dc('0x4')]();var fs_extra=require(_0x53dc('0x5'));var auth=require(_0x53dc('0x6'));var interaction=require(_0x53dc('0x7'));var config=require(_0x53dc('0x8'));var controller=require(_0x53dc('0x9'));router[_0x53dc('0xa')](_0x53dc('0xb'),auth['isAuthenticated'](),controller[_0x53dc('0xc')]);router[_0x53dc('0xd')]('/:id',auth[_0x53dc('0xe')](),controller[_0x53dc('0xf')]);router[_0x53dc('0x10')](_0x53dc('0xb'),auth[_0x53dc('0xe')](),controller[_0x53dc('0x11')]);module[_0x53dc('0x12')]=router; \ No newline at end of file +var _0x9001=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','/:id','put','isAuthenticated'];(function(_0x2074a3,_0x45500a){var _0x5562a2=function(_0x46323b){while(--_0x46323b){_0x2074a3['push'](_0x2074a3['shift']());}};_0x5562a2(++_0x45500a);}(_0x9001,0x154));var _0x1900=function(_0x1fda64,_0x440db3){_0x1fda64=_0x1fda64-0x0;var _0x377bfc=_0x9001[_0x1fda64];return _0x377bfc;};'use strict';var multer=require(_0x1900('0x0'));var util=require(_0x1900('0x1'));var path=require(_0x1900('0x2'));var timeout=require(_0x1900('0x3'));var express=require(_0x1900('0x4'));var router=express[_0x1900('0x5')]();var fs_extra=require(_0x1900('0x6'));var auth=require(_0x1900('0x7'));var interaction=require(_0x1900('0x8'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router['get'](_0x1900('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x1900('0xa')]('/:id',auth[_0x1900('0xb')](),controller[_0x1900('0xc')]);router[_0x1900('0xd')]('/:id',auth[_0x1900('0xb')](),controller[_0x1900('0xe')]);module[_0x1900('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index f3eb16d..37bdd1b 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 _0x089d=['STRING','BOOLEAN','exports'];(function(_0x277d5a,_0x5a5fbb){var _0x501348=function(_0x401179){while(--_0x401179){_0x277d5a['push'](_0x277d5a['shift']());}};_0x501348(++_0x5a5fbb);}(_0x089d,0x137));var _0xd089=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x089d[_0xaa1b3e];return _0x454d7d;};'use strict';var Sequelize=require('sequelize');module[_0xd089('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd089('0x1')]},'write':{'type':Sequelize[_0xd089('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1f2e=['STRING','BOOLEAN'];(function(_0xb976c9,_0x5eb949){var _0x95a87e=function(_0x5d6e0c){while(--_0x5d6e0c){_0xb976c9['push'](_0xb976c9['shift']());}};_0x95a87e(++_0x5eb949);}(_0x1f2e,0x82));var _0xe1f2=function(_0x52cd03,_0x49f262){_0x52cd03=_0x52cd03-0x0;var _0x4ccba2=_0x1f2e[_0x52cd03];return _0x4ccba2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe1f2('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xe1f2('0x0')]},'write':{'type':Sequelize[_0xe1f2('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index e037a6e..abceea9 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 _0x5452=['show','params','rawAttributes','keys','fields','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','findOne','User','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','order','$gte','split','format','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','limit','sort','pick','filter','where','merge','type','VIRTUAL','options','ChatGroup','includeAll','include','findAll','rows','catch'];(function(_0x22b04a,_0x1e4009){var _0x2ba83d=function(_0x4bcc50){while(--_0x4bcc50){_0x22b04a['push'](_0x22b04a['shift']());}};_0x2ba83d(++_0x1e4009);}(_0x5452,0x1b7));var _0x2545=function(_0x3d5d06,_0x3b44f2){_0x3d5d06=_0x3d5d06-0x0;var _0x19844a=_0x5452[_0x3d5d06];return _0x19844a;};'use strict';var emlformat=require(_0x2545('0x0'));var rimraf=require(_0x2545('0x1'));var zipdir=require(_0x2545('0x2'));var jsonpatch=require(_0x2545('0x3'));var rp=require('request-promise');var moment=require(_0x2545('0x4'));var BPromise=require(_0x2545('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2545('0x6'));var sox=require(_0x2545('0x7'));var csv=require('to-csv');var ejs=require(_0x2545('0x8'));var fs=require('fs');var fs_extra=require(_0x2545('0x9'));var _=require('lodash');var squel=require(_0x2545('0xa'));var crypto=require('crypto');var jsforce=require(_0x2545('0xb'));var deskjs=require(_0x2545('0xc'));var toCsv=require(_0x2545('0xd'));var querystring=require(_0x2545('0xe'));var Papa=require(_0x2545('0xf'));var Redis=require(_0x2545('0x10'));var authService=require(_0x2545('0x11'));var qs=require(_0x2545('0x12'));var as=require(_0x2545('0x13'));var hardwareService=require(_0x2545('0x14'));var logger=require(_0x2545('0x15'))(_0x2545('0x16'));var utils=require(_0x2545('0x17'));var config=require(_0x2545('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2545('0x19'))['db'];config[_0x2545('0x1a')]=_[_0x2545('0x1b')](config['redis'],{'host':_0x2545('0x1c'),'port':0x18eb});var socket=require(_0x2545('0x1d'))(new Redis(config[_0x2545('0x1a')]));require(_0x2545('0x1e'))['register'](socket);function respondWithStatusCode(_0x1518ab,_0x3da30b){_0x3da30b=_0x3da30b||0xcc;return function(_0x1520e8){if(_0x1520e8){return _0x1518ab[_0x2545('0x1f')](_0x3da30b);}return _0x1518ab[_0x2545('0x20')](_0x3da30b)['end']();};}function respondWithResult(_0x49afa3,_0x544e55){_0x544e55=_0x544e55||0xc8;return function(_0x19d2fa){if(_0x19d2fa){return _0x49afa3[_0x2545('0x20')](_0x544e55)[_0x2545('0x21')](_0x19d2fa);}};}function respondWithFilteredResult(_0x2fc15f,_0x13fca2){return function(_0x1c9fb3){if(_0x1c9fb3){var _0x567744=typeof _0x13fca2['offset']==='undefined'&&typeof _0x13fca2['limit']===_0x2545('0x22');var _0x5438f4=_0x1c9fb3[_0x2545('0x23')];var _0x148c8f=_0x567744?0x0:_0x13fca2[_0x2545('0x24')];var _0x4387c1=_0x567744?_0x1c9fb3['count']:_0x13fca2[_0x2545('0x24')]+_0x13fca2['limit'];var _0x487a07;if(_0x4387c1>=_0x5438f4){_0x4387c1=_0x5438f4;_0x487a07=0xc8;}else{_0x487a07=0xce;}_0x2fc15f[_0x2545('0x20')](_0x487a07);return _0x2fc15f[_0x2545('0x25')](_0x2545('0x26'),_0x148c8f+'-'+_0x4387c1+'/'+_0x5438f4)[_0x2545('0x21')](_0x1c9fb3);}return null;};}function patchUpdates(_0x1c1264){return function(_0x4fd63e){try{jsonpatch[_0x2545('0x27')](_0x4fd63e,_0x1c1264,!![]);}catch(_0xf4b00d){return BPromise[_0x2545('0x28')](_0xf4b00d);}return _0x4fd63e[_0x2545('0x29')]();};}function saveUpdates(_0x236976,_0x233852){return function(_0x1ba6a5){if(_0x1ba6a5){return _0x1ba6a5[_0x2545('0x2a')](_0x236976)['then'](function(_0x1ae931){return _0x1ae931;});}return null;};}function removeEntity(_0x58e8d0,_0x5f4030){return function(_0x103855){if(_0x103855){return _0x103855[_0x2545('0x2b')]()[_0x2545('0x2c')](function(){_0x58e8d0[_0x2545('0x20')](0xcc)[_0x2545('0x2d')]();});}};}function handleEntityNotFound(_0x5a000b,_0x1c1885){return function(_0x3e1d94){if(!_0x3e1d94){_0x5a000b[_0x2545('0x1f')](0x194);}return _0x3e1d94;};}function handleError(_0x3ca6e8,_0x1cab52){_0x1cab52=_0x1cab52||0x1f4;return function(_0xa9ce8b){logger[_0x2545('0x2e')](_0xa9ce8b[_0x2545('0x2f')]);if(_0xa9ce8b[_0x2545('0x30')]){delete _0xa9ce8b[_0x2545('0x30')];}_0x3ca6e8['status'](_0x1cab52)[_0x2545('0x31')](_0xa9ce8b);};}exports[_0x2545('0x32')]=function(_0x52d999,_0x122502){var _0x28ddaf={},_0x11dde1={},_0x532466={'count':0x0,'rows':[]};var _0x137d8d=_[_0x2545('0x33')](db['ChatGroup']['rawAttributes'],function(_0x563ebd){return{'name':_0x563ebd[_0x2545('0x34')],'type':_0x563ebd['type'][_0x2545('0x35')]};});_0x11dde1[_0x2545('0x36')]=_['map'](_0x137d8d,_0x2545('0x30'));_0x11dde1['query']=_['keys'](_0x52d999[_0x2545('0x37')]);_0x11dde1[_0x2545('0x38')]=_[_0x2545('0x39')](_0x11dde1[_0x2545('0x36')],_0x11dde1[_0x2545('0x37')]);_0x28ddaf[_0x2545('0x3a')]=_[_0x2545('0x39')](_0x11dde1[_0x2545('0x36')],qs['fields'](_0x52d999[_0x2545('0x37')]['fields']));_0x28ddaf[_0x2545('0x3a')]=_0x28ddaf[_0x2545('0x3a')][_0x2545('0x3b')]?_0x28ddaf['attributes']:_0x11dde1[_0x2545('0x36')];if(!_0x52d999[_0x2545('0x37')][_0x2545('0x3c')]('nolimit')){_0x28ddaf[_0x2545('0x3d')]=qs['limit'](_0x52d999[_0x2545('0x37')][_0x2545('0x3d')]);_0x28ddaf[_0x2545('0x24')]=qs[_0x2545('0x24')](_0x52d999[_0x2545('0x37')][_0x2545('0x24')]);}_0x28ddaf['order']=qs[_0x2545('0x3e')](_0x52d999[_0x2545('0x37')][_0x2545('0x3e')]);_0x28ddaf['where']=qs['filters'](_[_0x2545('0x3f')](_0x52d999[_0x2545('0x37')],_0x11dde1[_0x2545('0x38')]),_0x137d8d);if(_0x52d999['query'][_0x2545('0x40')]){_0x28ddaf[_0x2545('0x41')]=_[_0x2545('0x42')](_0x28ddaf[_0x2545('0x41')],{'$or':_[_0x2545('0x33')](_0x137d8d,function(_0xd9a6df){if(_0xd9a6df[_0x2545('0x43')]!==_0x2545('0x44')){var _0x3023fe={};_0x3023fe[_0xd9a6df[_0x2545('0x30')]]={'$like':'%'+_0x52d999[_0x2545('0x37')][_0x2545('0x40')]+'%'};return _0x3023fe;}})});}_0x28ddaf=_[_0x2545('0x42')]({},_0x28ddaf,_0x52d999[_0x2545('0x45')]);var _0x5959e0={'where':_0x28ddaf[_0x2545('0x41')]};return db[_0x2545('0x46')][_0x2545('0x23')](_0x5959e0)[_0x2545('0x2c')](function(_0x4d2447){_0x532466[_0x2545('0x23')]=_0x4d2447;if(_0x52d999['query'][_0x2545('0x47')]){_0x28ddaf[_0x2545('0x48')]=[{'all':!![]}];}return db[_0x2545('0x46')][_0x2545('0x49')](_0x28ddaf);})[_0x2545('0x2c')](function(_0x4c54a3){_0x532466[_0x2545('0x4a')]=_0x4c54a3;return _0x532466;})[_0x2545('0x2c')](respondWithFilteredResult(_0x122502,_0x28ddaf))[_0x2545('0x4b')](handleError(_0x122502,null));};exports[_0x2545('0x4c')]=function(_0x57a2b0,_0x6734af){var _0x4a1440={'raw':!![],'where':{'id':_0x57a2b0[_0x2545('0x4d')]['id']}},_0x27ba49={};_0x27ba49[_0x2545('0x36')]=_['keys'](db[_0x2545('0x46')][_0x2545('0x4e')]);_0x27ba49[_0x2545('0x37')]=_[_0x2545('0x4f')](_0x57a2b0['query']);_0x27ba49['filters']=_[_0x2545('0x39')](_0x27ba49[_0x2545('0x36')],_0x27ba49['query']);_0x4a1440[_0x2545('0x3a')]=_[_0x2545('0x39')](_0x27ba49[_0x2545('0x36')],qs['fields'](_0x57a2b0[_0x2545('0x37')][_0x2545('0x50')]));_0x4a1440[_0x2545('0x3a')]=_0x4a1440[_0x2545('0x3a')][_0x2545('0x3b')]?_0x4a1440[_0x2545('0x3a')]:_0x27ba49[_0x2545('0x36')];if(_0x57a2b0[_0x2545('0x37')]['includeAll']){_0x4a1440[_0x2545('0x48')]=[{'all':!![]}];}_0x4a1440=_[_0x2545('0x42')]({},_0x4a1440,_0x57a2b0[_0x2545('0x45')]);return db[_0x2545('0x46')][_0x2545('0x51')](_0x4a1440)[_0x2545('0x2c')](handleEntityNotFound(_0x6734af,null))[_0x2545('0x2c')](respondWithResult(_0x6734af,null))[_0x2545('0x4b')](handleError(_0x6734af,null));};exports[_0x2545('0x52')]=function(_0x4c04f0,_0x1a3a0e){return db[_0x2545('0x46')][_0x2545('0x52')](_0x4c04f0[_0x2545('0x53')],{})['then'](respondWithResult(_0x1a3a0e,0xc9))[_0x2545('0x4b')](handleError(_0x1a3a0e,null));};exports[_0x2545('0x2a')]=function(_0x1c4fe2,_0x189370){if(_0x1c4fe2[_0x2545('0x53')]['id']){delete _0x1c4fe2['body']['id'];}return db[_0x2545('0x46')][_0x2545('0x51')]({'where':{'id':_0x1c4fe2[_0x2545('0x4d')]['id']}})['then'](handleEntityNotFound(_0x189370,null))[_0x2545('0x2c')](saveUpdates(_0x1c4fe2[_0x2545('0x53')],null))['then'](respondWithResult(_0x189370,null))[_0x2545('0x4b')](handleError(_0x189370,null));};exports[_0x2545('0x2b')]=function(_0x34257d,_0x4d29cf){return db['ChatGroup'][_0x2545('0x51')]({'where':{'id':_0x34257d[_0x2545('0x4d')]['id']}})[_0x2545('0x2c')](handleEntityNotFound(_0x4d29cf,null))['then'](removeEntity(_0x4d29cf,null))[_0x2545('0x4b')](handleError(_0x4d29cf,null));};exports[_0x2545('0x54')]=function(_0x1904f3,_0x968f88){return db[_0x2545('0x46')][_0x2545('0x54')]()['then'](respondWithResult(_0x968f88,null))[_0x2545('0x4b')](handleError(_0x968f88,null));};exports[_0x2545('0x55')]=function(_0x5f467f,_0x53d2ef,_0x12f8fb){return db[_0x2545('0x56')][_0x2545('0x23')]({'where':{'ChatGroupId':_0x5f467f[_0x2545('0x4d')]['id'],'ToId':_0x5f467f[_0x2545('0x57')]['id'],'read':![]}})[_0x2545('0x2c')](function(_0x3cc11d){return{'id':_[_0x2545('0x58')](_0x5f467f[_0x2545('0x4d')]['id']),'count':_0x3cc11d};})['then'](respondWithResult(_0x53d2ef,null))['catch'](handleError(_0x53d2ef,null));};exports['addMembers']=function(_0x377de2,_0x74210e,_0x3dc518){return db[_0x2545('0x46')][_0x2545('0x51')]({'where':{'id':_0x377de2['params']['id']}})['then'](handleEntityNotFound(_0x74210e,null))['then'](function(_0x58c0e4){if(_0x58c0e4){return _0x58c0e4[_0x2545('0x59')](_0x377de2['body'][_0x2545('0x5a')],_['omit'](_0x377de2['body'],['ids','id'])||{});}})[_0x2545('0x2c')](respondWithResult(_0x74210e,null))[_0x2545('0x4b')](handleError(_0x74210e,null));};exports[_0x2545('0x5b')]=function(_0x341641,_0x4f2842,_0x1f32e7){var _0x1e258d={};var _0x491b75={};var _0x43a93b;var _0x364b38;return db[_0x2545('0x46')][_0x2545('0x5c')]({'where':{'id':_0x341641[_0x2545('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4f2842,null))['then'](function(_0x4e4f85){if(_0x4e4f85){_0x43a93b=_0x4e4f85;_0x491b75[_0x2545('0x36')]=_[_0x2545('0x4f')](db[_0x2545('0x5d')][_0x2545('0x4e')]);_0x491b75[_0x2545('0x37')]=_[_0x2545('0x4f')](_0x341641[_0x2545('0x37')]);_0x491b75['filters']=_[_0x2545('0x39')](_0x491b75[_0x2545('0x36')],_0x491b75[_0x2545('0x37')]);_0x1e258d[_0x2545('0x3a')]=_[_0x2545('0x39')](_0x491b75[_0x2545('0x36')],qs['fields'](_0x341641[_0x2545('0x37')][_0x2545('0x50')]));_0x1e258d['attributes']=_0x1e258d['attributes']['length']?_0x1e258d[_0x2545('0x3a')]:_0x491b75[_0x2545('0x36')];_0x1e258d['order']=qs[_0x2545('0x3e')](_0x341641['query']['sort']);_0x1e258d[_0x2545('0x41')]=qs['filters'](_[_0x2545('0x3f')](_0x341641[_0x2545('0x37')],_0x491b75['filters']));if(_0x341641[_0x2545('0x37')][_0x2545('0x40')]){_0x1e258d[_0x2545('0x41')]=_[_0x2545('0x42')](_0x1e258d[_0x2545('0x41')],{'$or':_['map'](_0x1e258d[_0x2545('0x3a')],function(_0x3ffa17){var _0x1f9f62={};_0x1f9f62[_0x3ffa17]={'$like':'%'+_0x341641['query'][_0x2545('0x40')]+'%'};return _0x1f9f62;})});}_0x1e258d=_['merge']({},_0x1e258d,_0x341641[_0x2545('0x45')]);return _0x43a93b[_0x2545('0x5b')](_0x1e258d);}})['then'](function(_0xcc4f78){if(_0xcc4f78){_0x364b38=_0xcc4f78[_0x2545('0x3b')];if(!_0x341641['query'][_0x2545('0x3c')](_0x2545('0x5e'))){_0x1e258d[_0x2545('0x3d')]=qs[_0x2545('0x3d')](_0x341641[_0x2545('0x37')]['limit']);_0x1e258d['offset']=qs[_0x2545('0x24')](_0x341641[_0x2545('0x37')][_0x2545('0x24')]);}return _0x43a93b[_0x2545('0x5b')](_0x1e258d);}})[_0x2545('0x2c')](function(_0x2b0e31){if(_0x2b0e31){return _0x2b0e31?{'count':_0x364b38,'rows':_0x2b0e31}:null;}})[_0x2545('0x2c')](respondWithResult(_0x4f2842,null))[_0x2545('0x4b')](handleError(_0x4f2842,null));};exports[_0x2545('0x5f')]=function(_0x59c9d8,_0x3ab828,_0x3ab9b1){return db['ChatGroup']['find']({'where':{'id':_0x59c9d8[_0x2545('0x4d')]['id']}})[_0x2545('0x2c')](handleEntityNotFound(_0x3ab828,null))[_0x2545('0x2c')](function(_0x96e7b4){if(_0x96e7b4){return _0x96e7b4[_0x2545('0x5f')](_0x59c9d8['query'][_0x2545('0x5a')]);}})[_0x2545('0x2c')](respondWithStatusCode(_0x3ab828,null))[_0x2545('0x4b')](handleError(_0x3ab828,null));};exports[_0x2545('0x60')]=function(_0x68d996,_0x4281e6,_0x4a129f){if(_0x68d996[_0x2545('0x53')]['id']){delete _0x68d996[_0x2545('0x53')]['id'];}return db['ChatGroup'][_0x2545('0x51')]({'where':{'id':_0x68d996[_0x2545('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4281e6,null))[_0x2545('0x2c')](function(_0x172a16){if(_0x172a16){_0x68d996['body'][_0x2545('0x61')]=_0x172a16['id'];return db[_0x2545('0x56')][_0x2545('0x52')](_0x68d996[_0x2545('0x53')]);}})[_0x2545('0x2c')](respondWithResult(_0x4281e6,null))[_0x2545('0x4b')](handleError(_0x4281e6,null));};exports[_0x2545('0x62')]=function(_0x45cf9f,_0x213219,_0x50795a){var _0x14f6f8={};var _0x54a260={};var _0x1575b6;var _0x4d723f;return db[_0x2545('0x46')][_0x2545('0x5c')]({'where':{'id':_0x45cf9f[_0x2545('0x4d')]['id']}})[_0x2545('0x2c')](handleEntityNotFound(_0x213219,null))['then'](function(_0x3c8389){if(_0x3c8389){_0x1575b6=_0x3c8389;_0x54a260['model']=_['keys'](db[_0x2545('0x56')][_0x2545('0x4e')]);_0x54a260['query']=_[_0x2545('0x4f')](_0x45cf9f[_0x2545('0x37')]);_0x54a260['filters']=_[_0x2545('0x39')](_0x54a260[_0x2545('0x36')],_0x54a260['query']);_0x14f6f8[_0x2545('0x3a')]=_[_0x2545('0x39')](_0x54a260[_0x2545('0x36')],qs[_0x2545('0x50')](_0x45cf9f['query'][_0x2545('0x50')]));_0x14f6f8[_0x2545('0x3a')]=_0x14f6f8[_0x2545('0x3a')]['length']?_0x14f6f8['attributes']:_0x54a260[_0x2545('0x36')];_0x14f6f8[_0x2545('0x63')]=qs[_0x2545('0x3e')](_0x45cf9f[_0x2545('0x37')][_0x2545('0x3e')]);_0x14f6f8['where']=qs[_0x2545('0x38')](_['pick'](_0x45cf9f[_0x2545('0x37')],_0x54a260[_0x2545('0x38')]));if(_0x45cf9f[_0x2545('0x37')]['filter']){_0x14f6f8[_0x2545('0x41')]=_[_0x2545('0x42')](_0x14f6f8[_0x2545('0x41')],{'$or':_[_0x2545('0x33')](_0x14f6f8[_0x2545('0x3a')],function(_0x4cfcbc){var _0x4febb8={};_0x4febb8[_0x4cfcbc]={'$like':'%'+_0x45cf9f[_0x2545('0x37')][_0x2545('0x40')]+'%'};return _0x4febb8;})});}if(_0x45cf9f[_0x2545('0x37')]['$gte']){var _0x24c3b5=_0x45cf9f['query'][_0x2545('0x64')][_0x2545('0x65')](',');var _0x5e5f11={};_0x5e5f11[_0x24c3b5[0x0]]={'$gte':moment(_0x24c3b5[0x1])[_0x2545('0x66')]('YYYY-MM-DD\x20HH:mm:ss')};_0x14f6f8[_0x2545('0x41')]=_[_0x2545('0x42')](_0x14f6f8['where'],_0x5e5f11);}_0x14f6f8=_[_0x2545('0x42')]({},_0x14f6f8,_0x45cf9f['options']);return _0x1575b6['getMessages'](_0x14f6f8);}})[_0x2545('0x2c')](function(_0x225869){if(_0x225869){_0x4d723f=_0x225869[_0x2545('0x3b')];if(!_0x45cf9f[_0x2545('0x37')][_0x2545('0x3c')](_0x2545('0x5e'))){_0x14f6f8[_0x2545('0x3d')]=qs[_0x2545('0x3d')](_0x45cf9f['query'][_0x2545('0x3d')]);_0x14f6f8[_0x2545('0x24')]=qs[_0x2545('0x24')](_0x45cf9f[_0x2545('0x37')][_0x2545('0x24')]);}return _0x1575b6[_0x2545('0x62')](_0x14f6f8);}})[_0x2545('0x2c')](function(_0x53fc5d){if(_0x53fc5d){return _0x53fc5d?{'count':_0x4d723f,'rows':_0x53fc5d}:null;}})['then'](respondWithResult(_0x213219,null))[_0x2545('0x4b')](handleError(_0x213219,null));}; \ No newline at end of file +var _0xc956=['includeAll','include','options','find','create','body','destroy','describe','getUnread','ChatInternalMessage','toInteger','ids','omit','getMembers','findOne','User','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','status','json','undefined','limit','count','offset','set','apply','save','update','then','sendStatus','error','name','send','index','map','ChatGroup','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','catch','show','params'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xc956,0x7a));var _0x6c95=function(_0x5d3569,_0x2753b7){_0x5d3569=_0x5d3569-0x0;var _0x233fbb=_0xc956[_0x5d3569];return _0x233fbb;};'use strict';var emlformat=require(_0x6c95('0x0'));var rimraf=require(_0x6c95('0x1'));var zipdir=require(_0x6c95('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c95('0x3'));var moment=require(_0x6c95('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6c95('0x5'));var util=require('util');var path=require(_0x6c95('0x6'));var sox=require(_0x6c95('0x7'));var csv=require(_0x6c95('0x8'));var ejs=require(_0x6c95('0x9'));var fs=require('fs');var fs_extra=require(_0x6c95('0xa'));var _=require(_0x6c95('0xb'));var squel=require(_0x6c95('0xc'));var crypto=require(_0x6c95('0xd'));var jsforce=require(_0x6c95('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6c95('0x8'));var querystring=require(_0x6c95('0xf'));var Papa=require(_0x6c95('0x10'));var Redis=require(_0x6c95('0x11'));var authService=require(_0x6c95('0x12'));var qs=require(_0x6c95('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c95('0x14'));var logger=require('../../config/logger')(_0x6c95('0x15'));var utils=require(_0x6c95('0x16'));var config=require(_0x6c95('0x17'));var licenseUtil=require(_0x6c95('0x18'));var db=require(_0x6c95('0x19'))['db'];config[_0x6c95('0x1a')]=_[_0x6c95('0x1b')](config[_0x6c95('0x1a')],{'host':_0x6c95('0x1c'),'port':0x18eb});var socket=require(_0x6c95('0x1d'))(new Redis(config[_0x6c95('0x1a')]));require(_0x6c95('0x1e'))[_0x6c95('0x1f')](socket);function respondWithStatusCode(_0xb027a2,_0x524a15){_0x524a15=_0x524a15||0xcc;return function(_0x17c2c7){if(_0x17c2c7){return _0xb027a2['sendStatus'](_0x524a15);}return _0xb027a2[_0x6c95('0x20')](_0x524a15)['end']();};}function respondWithResult(_0x57469e,_0x2ce12c){_0x2ce12c=_0x2ce12c||0xc8;return function(_0x5e0ac4){if(_0x5e0ac4){return _0x57469e[_0x6c95('0x20')](_0x2ce12c)[_0x6c95('0x21')](_0x5e0ac4);}};}function respondWithFilteredResult(_0x59344a,_0x5394a1){return function(_0x48482f){if(_0x48482f){var _0x51fc8a=typeof _0x5394a1['offset']===_0x6c95('0x22')&&typeof _0x5394a1[_0x6c95('0x23')]===_0x6c95('0x22');var _0x51b2d6=_0x48482f[_0x6c95('0x24')];var _0x578b19=_0x51fc8a?0x0:_0x5394a1[_0x6c95('0x25')];var _0x48ede1=_0x51fc8a?_0x48482f[_0x6c95('0x24')]:_0x5394a1[_0x6c95('0x25')]+_0x5394a1[_0x6c95('0x23')];var _0x17df05;if(_0x48ede1>=_0x51b2d6){_0x48ede1=_0x51b2d6;_0x17df05=0xc8;}else{_0x17df05=0xce;}_0x59344a['status'](_0x17df05);return _0x59344a[_0x6c95('0x26')]('Content-Range',_0x578b19+'-'+_0x48ede1+'/'+_0x51b2d6)['json'](_0x48482f);}return null;};}function patchUpdates(_0x499fd3){return function(_0x2b3744){try{jsonpatch[_0x6c95('0x27')](_0x2b3744,_0x499fd3,!![]);}catch(_0x3c8c1c){return BPromise['reject'](_0x3c8c1c);}return _0x2b3744[_0x6c95('0x28')]();};}function saveUpdates(_0x421dca,_0x536c16){return function(_0x7b1c30){if(_0x7b1c30){return _0x7b1c30[_0x6c95('0x29')](_0x421dca)[_0x6c95('0x2a')](function(_0x2285aa){return _0x2285aa;});}return null;};}function removeEntity(_0xf55bdd,_0xc7a7e8){return function(_0x5c7475){if(_0x5c7475){return _0x5c7475['destroy']()['then'](function(){_0xf55bdd[_0x6c95('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a68e9,_0x162303){return function(_0x2a14a0){if(!_0x2a14a0){_0x3a68e9[_0x6c95('0x2b')](0x194);}return _0x2a14a0;};}function handleError(_0x1935af,_0x2af40a){_0x2af40a=_0x2af40a||0x1f4;return function(_0x38b615){logger[_0x6c95('0x2c')](_0x38b615['stack']);if(_0x38b615[_0x6c95('0x2d')]){delete _0x38b615[_0x6c95('0x2d')];}_0x1935af[_0x6c95('0x20')](_0x2af40a)[_0x6c95('0x2e')](_0x38b615);};}exports[_0x6c95('0x2f')]=function(_0x2c90cd,_0x43250f){var _0x1f244e={},_0x21ae40={},_0x2af7ba={'count':0x0,'rows':[]};var _0x4525c7=_[_0x6c95('0x30')](db[_0x6c95('0x31')][_0x6c95('0x32')],function(_0x6fa692){return{'name':_0x6fa692['fieldName'],'type':_0x6fa692['type'][_0x6c95('0x33')]};});_0x21ae40[_0x6c95('0x34')]=_[_0x6c95('0x30')](_0x4525c7,_0x6c95('0x2d'));_0x21ae40[_0x6c95('0x35')]=_[_0x6c95('0x36')](_0x2c90cd[_0x6c95('0x35')]);_0x21ae40[_0x6c95('0x37')]=_[_0x6c95('0x38')](_0x21ae40[_0x6c95('0x34')],_0x21ae40['query']);_0x1f244e['attributes']=_[_0x6c95('0x38')](_0x21ae40['model'],qs[_0x6c95('0x39')](_0x2c90cd[_0x6c95('0x35')][_0x6c95('0x39')]));_0x1f244e[_0x6c95('0x3a')]=_0x1f244e[_0x6c95('0x3a')][_0x6c95('0x3b')]?_0x1f244e[_0x6c95('0x3a')]:_0x21ae40[_0x6c95('0x34')];if(!_0x2c90cd[_0x6c95('0x35')]['hasOwnProperty'](_0x6c95('0x3c'))){_0x1f244e[_0x6c95('0x23')]=qs[_0x6c95('0x23')](_0x2c90cd[_0x6c95('0x35')][_0x6c95('0x23')]);_0x1f244e[_0x6c95('0x25')]=qs['offset'](_0x2c90cd[_0x6c95('0x35')]['offset']);}_0x1f244e[_0x6c95('0x3d')]=qs[_0x6c95('0x3e')](_0x2c90cd[_0x6c95('0x35')]['sort']);_0x1f244e['where']=qs[_0x6c95('0x37')](_[_0x6c95('0x3f')](_0x2c90cd[_0x6c95('0x35')],_0x21ae40[_0x6c95('0x37')]),_0x4525c7);if(_0x2c90cd[_0x6c95('0x35')][_0x6c95('0x40')]){_0x1f244e[_0x6c95('0x41')]=_[_0x6c95('0x42')](_0x1f244e[_0x6c95('0x41')],{'$or':_[_0x6c95('0x30')](_0x4525c7,function(_0x121f16){if(_0x121f16[_0x6c95('0x43')]!==_0x6c95('0x44')){var _0x3ca387={};_0x3ca387[_0x121f16[_0x6c95('0x2d')]]={'$like':'%'+_0x2c90cd['query'][_0x6c95('0x40')]+'%'};return _0x3ca387;}})});}_0x1f244e=_['merge']({},_0x1f244e,_0x2c90cd['options']);var _0x5ad004={'where':_0x1f244e[_0x6c95('0x41')]};return db['ChatGroup']['count'](_0x5ad004)[_0x6c95('0x2a')](function(_0xb8159e){_0x2af7ba[_0x6c95('0x24')]=_0xb8159e;if(_0x2c90cd[_0x6c95('0x35')]['includeAll']){_0x1f244e['include']=[{'all':!![]}];}return db[_0x6c95('0x31')]['findAll'](_0x1f244e);})[_0x6c95('0x2a')](function(_0x54a5fc){_0x2af7ba['rows']=_0x54a5fc;return _0x2af7ba;})[_0x6c95('0x2a')](respondWithFilteredResult(_0x43250f,_0x1f244e))[_0x6c95('0x45')](handleError(_0x43250f,null));};exports[_0x6c95('0x46')]=function(_0x254f95,_0x3daa2a){var _0x246417={'raw':!![],'where':{'id':_0x254f95[_0x6c95('0x47')]['id']}},_0x1dd579={};_0x1dd579[_0x6c95('0x34')]=_[_0x6c95('0x36')](db[_0x6c95('0x31')][_0x6c95('0x32')]);_0x1dd579[_0x6c95('0x35')]=_[_0x6c95('0x36')](_0x254f95[_0x6c95('0x35')]);_0x1dd579['filters']=_[_0x6c95('0x38')](_0x1dd579[_0x6c95('0x34')],_0x1dd579[_0x6c95('0x35')]);_0x246417['attributes']=_['intersection'](_0x1dd579[_0x6c95('0x34')],qs[_0x6c95('0x39')](_0x254f95[_0x6c95('0x35')][_0x6c95('0x39')]));_0x246417[_0x6c95('0x3a')]=_0x246417['attributes'][_0x6c95('0x3b')]?_0x246417[_0x6c95('0x3a')]:_0x1dd579[_0x6c95('0x34')];if(_0x254f95[_0x6c95('0x35')][_0x6c95('0x48')]){_0x246417[_0x6c95('0x49')]=[{'all':!![]}];}_0x246417=_['merge']({},_0x246417,_0x254f95[_0x6c95('0x4a')]);return db[_0x6c95('0x31')][_0x6c95('0x4b')](_0x246417)['then'](handleEntityNotFound(_0x3daa2a,null))[_0x6c95('0x2a')](respondWithResult(_0x3daa2a,null))[_0x6c95('0x45')](handleError(_0x3daa2a,null));};exports[_0x6c95('0x4c')]=function(_0x15c4e4,_0x18e802){return db[_0x6c95('0x31')][_0x6c95('0x4c')](_0x15c4e4[_0x6c95('0x4d')],{})[_0x6c95('0x2a')](respondWithResult(_0x18e802,0xc9))[_0x6c95('0x45')](handleError(_0x18e802,null));};exports[_0x6c95('0x29')]=function(_0x1a7ec1,_0x1ea200){if(_0x1a7ec1['body']['id']){delete _0x1a7ec1[_0x6c95('0x4d')]['id'];}return db['ChatGroup'][_0x6c95('0x4b')]({'where':{'id':_0x1a7ec1['params']['id']}})[_0x6c95('0x2a')](handleEntityNotFound(_0x1ea200,null))[_0x6c95('0x2a')](saveUpdates(_0x1a7ec1[_0x6c95('0x4d')],null))['then'](respondWithResult(_0x1ea200,null))[_0x6c95('0x45')](handleError(_0x1ea200,null));};exports[_0x6c95('0x4e')]=function(_0x867fcf,_0x43b4bc){return db[_0x6c95('0x31')][_0x6c95('0x4b')]({'where':{'id':_0x867fcf[_0x6c95('0x47')]['id']}})[_0x6c95('0x2a')](handleEntityNotFound(_0x43b4bc,null))[_0x6c95('0x2a')](removeEntity(_0x43b4bc,null))['catch'](handleError(_0x43b4bc,null));};exports[_0x6c95('0x4f')]=function(_0x18af3e,_0x57f37e){return db[_0x6c95('0x31')][_0x6c95('0x4f')]()[_0x6c95('0x2a')](respondWithResult(_0x57f37e,null))['catch'](handleError(_0x57f37e,null));};exports[_0x6c95('0x50')]=function(_0x360102,_0x5b6187,_0x5d5985){return db[_0x6c95('0x51')][_0x6c95('0x24')]({'where':{'ChatGroupId':_0x360102[_0x6c95('0x47')]['id'],'ToId':_0x360102['user']['id'],'read':![]}})[_0x6c95('0x2a')](function(_0x402010){return{'id':_[_0x6c95('0x52')](_0x360102[_0x6c95('0x47')]['id']),'count':_0x402010};})[_0x6c95('0x2a')](respondWithResult(_0x5b6187,null))[_0x6c95('0x45')](handleError(_0x5b6187,null));};exports['addMembers']=function(_0x5dbd4b,_0x2ca4f9,_0x4adc88){return db[_0x6c95('0x31')][_0x6c95('0x4b')]({'where':{'id':_0x5dbd4b[_0x6c95('0x47')]['id']}})[_0x6c95('0x2a')](handleEntityNotFound(_0x2ca4f9,null))[_0x6c95('0x2a')](function(_0x2d0d2b){if(_0x2d0d2b){return _0x2d0d2b['addMembers'](_0x5dbd4b[_0x6c95('0x4d')][_0x6c95('0x53')],_[_0x6c95('0x54')](_0x5dbd4b['body'],[_0x6c95('0x53'),'id'])||{});}})['then'](respondWithResult(_0x2ca4f9,null))[_0x6c95('0x45')](handleError(_0x2ca4f9,null));};exports[_0x6c95('0x55')]=function(_0x390300,_0x461316,_0x4d30c3){var _0x775e37={};var _0x34b443={};var _0x196192;var _0x5b13ae;return db[_0x6c95('0x31')][_0x6c95('0x56')]({'where':{'id':_0x390300[_0x6c95('0x47')]['id']}})[_0x6c95('0x2a')](handleEntityNotFound(_0x461316,null))[_0x6c95('0x2a')](function(_0x3e3ab8){if(_0x3e3ab8){_0x196192=_0x3e3ab8;_0x34b443[_0x6c95('0x34')]=_[_0x6c95('0x36')](db[_0x6c95('0x57')][_0x6c95('0x32')]);_0x34b443[_0x6c95('0x35')]=_[_0x6c95('0x36')](_0x390300[_0x6c95('0x35')]);_0x34b443[_0x6c95('0x37')]=_[_0x6c95('0x38')](_0x34b443['model'],_0x34b443['query']);_0x775e37[_0x6c95('0x3a')]=_[_0x6c95('0x38')](_0x34b443[_0x6c95('0x34')],qs[_0x6c95('0x39')](_0x390300[_0x6c95('0x35')][_0x6c95('0x39')]));_0x775e37['attributes']=_0x775e37[_0x6c95('0x3a')][_0x6c95('0x3b')]?_0x775e37[_0x6c95('0x3a')]:_0x34b443['model'];_0x775e37[_0x6c95('0x3d')]=qs['sort'](_0x390300[_0x6c95('0x35')][_0x6c95('0x3e')]);_0x775e37[_0x6c95('0x41')]=qs[_0x6c95('0x37')](_[_0x6c95('0x3f')](_0x390300[_0x6c95('0x35')],_0x34b443[_0x6c95('0x37')]));if(_0x390300[_0x6c95('0x35')][_0x6c95('0x40')]){_0x775e37['where']=_[_0x6c95('0x42')](_0x775e37['where'],{'$or':_[_0x6c95('0x30')](_0x775e37[_0x6c95('0x3a')],function(_0x415acc){var _0x2f668f={};_0x2f668f[_0x415acc]={'$like':'%'+_0x390300[_0x6c95('0x35')]['filter']+'%'};return _0x2f668f;})});}_0x775e37=_[_0x6c95('0x42')]({},_0x775e37,_0x390300[_0x6c95('0x4a')]);return _0x196192[_0x6c95('0x55')](_0x775e37);}})[_0x6c95('0x2a')](function(_0x5a89ad){if(_0x5a89ad){_0x5b13ae=_0x5a89ad[_0x6c95('0x3b')];if(!_0x390300[_0x6c95('0x35')][_0x6c95('0x58')](_0x6c95('0x3c'))){_0x775e37[_0x6c95('0x23')]=qs[_0x6c95('0x23')](_0x390300[_0x6c95('0x35')][_0x6c95('0x23')]);_0x775e37[_0x6c95('0x25')]=qs[_0x6c95('0x25')](_0x390300['query'][_0x6c95('0x25')]);}return _0x196192['getMembers'](_0x775e37);}})[_0x6c95('0x2a')](function(_0x29a10a){if(_0x29a10a){return _0x29a10a?{'count':_0x5b13ae,'rows':_0x29a10a}:null;}})[_0x6c95('0x2a')](respondWithResult(_0x461316,null))[_0x6c95('0x45')](handleError(_0x461316,null));};exports['removeMembers']=function(_0x42a487,_0x515855,_0x3ae3f5){return db[_0x6c95('0x31')]['find']({'where':{'id':_0x42a487[_0x6c95('0x47')]['id']}})[_0x6c95('0x2a')](handleEntityNotFound(_0x515855,null))[_0x6c95('0x2a')](function(_0x42d001){if(_0x42d001){return _0x42d001[_0x6c95('0x59')](_0x42a487['query'][_0x6c95('0x53')]);}})[_0x6c95('0x2a')](respondWithStatusCode(_0x515855,null))[_0x6c95('0x45')](handleError(_0x515855,null));};exports[_0x6c95('0x5a')]=function(_0x21d4b4,_0x267649,_0x333e1e){if(_0x21d4b4[_0x6c95('0x4d')]['id']){delete _0x21d4b4[_0x6c95('0x4d')]['id'];}return db[_0x6c95('0x31')]['find']({'where':{'id':_0x21d4b4[_0x6c95('0x47')]['id']}})['then'](handleEntityNotFound(_0x267649,null))[_0x6c95('0x2a')](function(_0x5d4e37){if(_0x5d4e37){_0x21d4b4[_0x6c95('0x4d')][_0x6c95('0x5b')]=_0x5d4e37['id'];return db['ChatInternalMessage'][_0x6c95('0x4c')](_0x21d4b4[_0x6c95('0x4d')]);}})['then'](respondWithResult(_0x267649,null))[_0x6c95('0x45')](handleError(_0x267649,null));};exports[_0x6c95('0x5c')]=function(_0x38f735,_0x4f851a,_0x37bf36){var _0x4b942b={};var _0x505190={};var _0x4a1b6e;var _0x5ae177;return db['ChatGroup'][_0x6c95('0x56')]({'where':{'id':_0x38f735['params']['id']}})['then'](handleEntityNotFound(_0x4f851a,null))[_0x6c95('0x2a')](function(_0x317cb8){if(_0x317cb8){_0x4a1b6e=_0x317cb8;_0x505190[_0x6c95('0x34')]=_[_0x6c95('0x36')](db[_0x6c95('0x51')][_0x6c95('0x32')]);_0x505190[_0x6c95('0x35')]=_[_0x6c95('0x36')](_0x38f735[_0x6c95('0x35')]);_0x505190['filters']=_['intersection'](_0x505190[_0x6c95('0x34')],_0x505190[_0x6c95('0x35')]);_0x4b942b[_0x6c95('0x3a')]=_['intersection'](_0x505190[_0x6c95('0x34')],qs['fields'](_0x38f735['query'][_0x6c95('0x39')]));_0x4b942b[_0x6c95('0x3a')]=_0x4b942b[_0x6c95('0x3a')][_0x6c95('0x3b')]?_0x4b942b[_0x6c95('0x3a')]:_0x505190[_0x6c95('0x34')];_0x4b942b[_0x6c95('0x3d')]=qs[_0x6c95('0x3e')](_0x38f735[_0x6c95('0x35')][_0x6c95('0x3e')]);_0x4b942b[_0x6c95('0x41')]=qs[_0x6c95('0x37')](_['pick'](_0x38f735[_0x6c95('0x35')],_0x505190[_0x6c95('0x37')]));if(_0x38f735[_0x6c95('0x35')][_0x6c95('0x40')]){_0x4b942b[_0x6c95('0x41')]=_['merge'](_0x4b942b[_0x6c95('0x41')],{'$or':_[_0x6c95('0x30')](_0x4b942b['attributes'],function(_0x31c756){var _0x3294a8={};_0x3294a8[_0x31c756]={'$like':'%'+_0x38f735[_0x6c95('0x35')][_0x6c95('0x40')]+'%'};return _0x3294a8;})});}if(_0x38f735['query'][_0x6c95('0x5d')]){var _0x3e7803=_0x38f735[_0x6c95('0x35')][_0x6c95('0x5d')][_0x6c95('0x5e')](',');var _0x45b1d7={};_0x45b1d7[_0x3e7803[0x0]]={'$gte':moment(_0x3e7803[0x1])[_0x6c95('0x5f')](_0x6c95('0x60'))};_0x4b942b[_0x6c95('0x41')]=_[_0x6c95('0x42')](_0x4b942b[_0x6c95('0x41')],_0x45b1d7);}_0x4b942b=_[_0x6c95('0x42')]({},_0x4b942b,_0x38f735['options']);return _0x4a1b6e[_0x6c95('0x5c')](_0x4b942b);}})[_0x6c95('0x2a')](function(_0x2634e1){if(_0x2634e1){_0x5ae177=_0x2634e1[_0x6c95('0x3b')];if(!_0x38f735[_0x6c95('0x35')][_0x6c95('0x58')](_0x6c95('0x3c'))){_0x4b942b[_0x6c95('0x23')]=qs['limit'](_0x38f735[_0x6c95('0x35')][_0x6c95('0x23')]);_0x4b942b[_0x6c95('0x25')]=qs[_0x6c95('0x25')](_0x38f735[_0x6c95('0x35')][_0x6c95('0x25')]);}return _0x4a1b6e[_0x6c95('0x5c')](_0x4b942b);}})[_0x6c95('0x2a')](function(_0x4b53ae){if(_0x4b53ae){return _0x4b53ae?{'count':_0x5ae177,'rows':_0x4b53ae}:null;}})[_0x6c95('0x2a')](respondWithResult(_0x4f851a,null))['catch'](handleError(_0x4f851a,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 50090e9..76040da 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 _0x03ff=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x58e324,_0x16c4eb){var _0x5326da=function(_0x5c3216){while(--_0x5c3216){_0x58e324['push'](_0x58e324['shift']());}};_0x5326da(++_0x16c4eb);}(_0x03ff,0x1a8));var _0xf03f=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x03ff[_0x30ae5e];return _0x1f2e93;};'use strict';var EventEmitter=require(_0xf03f('0x0'));var ChatGroup=require(_0xf03f('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf03f('0x2')](0x0);var events={'afterCreate':_0xf03f('0x3'),'afterUpdate':_0xf03f('0x4'),'afterDestroy':_0xf03f('0x5')};function emitEvent(_0x12487b){return function(_0x222897,_0x2b4673,_0x1bac62){ChatGroupEvents['emit'](_0x12487b+':'+_0x222897['id'],_0x222897);ChatGroupEvents[_0xf03f('0x6')](_0x12487b,_0x222897);_0x1bac62(null);};}for(var e in events){if(events[_0xf03f('0x7')](e)){var event=events[e];ChatGroup[_0xf03f('0x8')](e,emitEvent(event));}}module[_0xf03f('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0x9b25=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatGroup','save'];(function(_0x55a8a0,_0x313c62){var _0x581017=function(_0x5cf328){while(--_0x5cf328){_0x55a8a0['push'](_0x55a8a0['shift']());}};_0x581017(++_0x313c62);}(_0x9b25,0x1be));var _0x59b2=function(_0x394d5a,_0x23c990){_0x394d5a=_0x394d5a-0x0;var _0x281461=_0x9b25[_0x394d5a];return _0x281461;};'use strict';var EventEmitter=require(_0x59b2('0x0'));var ChatGroup=require(_0x59b2('0x1'))['db'][_0x59b2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x59b2('0x3'),'afterUpdate':_0x59b2('0x4'),'afterDestroy':_0x59b2('0x5')};function emitEvent(_0x459769){return function(_0x72ea4a,_0x48e4ca,_0x4dd11d){ChatGroupEvents[_0x59b2('0x6')](_0x459769+':'+_0x72ea4a['id'],_0x72ea4a);ChatGroupEvents[_0x59b2('0x6')](_0x459769,_0x72ea4a);_0x4dd11d(null);};}for(var e in events){if(events[_0x59b2('0x7')](e)){var event=events[e];ChatGroup[_0x59b2('0x8')](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 98b4e94..17919f2 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 _0xdd79=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','util'];(function(_0x4eb3d2,_0x9b19d){var _0xa16302=function(_0x3cdc43){while(--_0x3cdc43){_0x4eb3d2['push'](_0x4eb3d2['shift']());}};_0xa16302(++_0x9b19d);}(_0xdd79,0x1af));var _0x9dd7=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xdd79[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x9dd7('0x0'));var logger=require('../../config/logger')(_0x9dd7('0x1'));var moment=require(_0x9dd7('0x2'));var BPromise=require(_0x9dd7('0x3'));var rp=require(_0x9dd7('0x4'));var fs=require('fs');var path=require(_0x9dd7('0x5'));var rimraf=require(_0x9dd7('0x6'));var config=require(_0x9dd7('0x7'));var attributes=require(_0x9dd7('0x8'));module['exports']=function(_0x2c2a03,_0x3c48db){return _0x2c2a03[_0x9dd7('0x9')](_0x9dd7('0xa'),attributes,{'tableName':_0x9dd7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0044=['ChatGroup','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define'];(function(_0x5f2c4f,_0x413414){var _0x498c51=function(_0x3fb596){while(--_0x3fb596){_0x5f2c4f['push'](_0x5f2c4f['shift']());}};_0x498c51(++_0x413414);}(_0x0044,0x12a));var _0x4004=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x0044[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x4004('0x0'));var util=require(_0x4004('0x1'));var logger=require(_0x4004('0x2'))(_0x4004('0x3'));var moment=require(_0x4004('0x4'));var BPromise=require(_0x4004('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4004('0x6'));var rimraf=require('rimraf');var config=require(_0x4004('0x7'));var attributes=require('./chatGroup.attributes');module[_0x4004('0x8')]=function(_0x3d6186,_0x1d85a7){return _0x3d6186[_0x4004('0x9')](_0x4004('0xa'),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 8344a19..3c2e399 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 _0x2123=['info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatGroup.socket','register','request','then'];(function(_0x5802a6,_0x47c09e){var _0x31e9ff=function(_0x29ed57){while(--_0x29ed57){_0x5802a6['push'](_0x5802a6['shift']());}};_0x31e9ff(++_0x47c09e);}(_0x2123,0x190));var _0x3212=function(_0x28cb92,_0x5117bd){_0x28cb92=_0x28cb92-0x0;var _0x3f1f75=_0x2123[_0x28cb92];return _0x3f1f75;};'use strict';var _=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var moment=require(_0x3212('0x2'));var BPromise=require(_0x3212('0x3'));var rs=require(_0x3212('0x4'));var fs=require('fs');var Redis=require(_0x3212('0x5'));var db=require(_0x3212('0x6'))['db'];var utils=require(_0x3212('0x7'));var logger=require(_0x3212('0x8'))(_0x3212('0x9'));var config=require(_0x3212('0xa'));var jayson=require(_0x3212('0xb'));var client=jayson['client'][_0x3212('0xc')]({'port':0x232a});config[_0x3212('0xd')]=_[_0x3212('0xe')](config['redis'],{'host':_0x3212('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3212('0xd')]));require(_0x3212('0x10'))[_0x3212('0x11')](socket);function respondWithRpcPromise(_0x1db498,_0x54f331,_0x4a46c2){return new BPromise(function(_0x3a1f28,_0xf166c2){return client[_0x3212('0x12')](_0x1db498,_0x4a46c2)[_0x3212('0x13')](function(_0x9c01c3){logger[_0x3212('0x14')](_0x3212('0x15'),_0x54f331,_0x3212('0x16'));logger[_0x3212('0x17')](_0x3212('0x18'),_0x54f331,_0x3212('0x16'),JSON[_0x3212('0x19')](_0x9c01c3));if(_0x9c01c3[_0x3212('0x1a')]){if(_0x9c01c3[_0x3212('0x1a')][_0x3212('0x1b')]===0x1f4){logger[_0x3212('0x1a')](_0x3212('0x15'),_0x54f331,_0x9c01c3[_0x3212('0x1a')][_0x3212('0x1c')]);return _0xf166c2(_0x9c01c3[_0x3212('0x1a')][_0x3212('0x1c')]);}logger[_0x3212('0x1a')]('ChatGroup,\x20%s,\x20%s',_0x54f331,_0x9c01c3[_0x3212('0x1a')][_0x3212('0x1c')]);return _0x3a1f28(_0x9c01c3[_0x3212('0x1a')][_0x3212('0x1c')]);}else{logger[_0x3212('0x14')](_0x3212('0x15'),_0x54f331,_0x3212('0x16'));_0x3a1f28(_0x9c01c3['result']['message']);}})[_0x3212('0x1d')](function(_0x49f5c2){logger[_0x3212('0x1a')](_0x3212('0x15'),_0x54f331,_0x49f5c2);_0xf166c2(_0x49f5c2);});});} \ No newline at end of file +var _0xacc8=['request\x20sent','debug','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s'];(function(_0x182093,_0x19eca5){var _0x180469=function(_0x3ec641){while(--_0x3ec641){_0x182093['push'](_0x182093['shift']());}};_0x180469(++_0x19eca5);}(_0xacc8,0xc5));var _0x8acc=function(_0x5c8440,_0x262351){_0x5c8440=_0x5c8440-0x0;var _0x301008=_0xacc8[_0x5c8440];return _0x301008;};'use strict';var _=require(_0x8acc('0x0'));var util=require('util');var moment=require(_0x8acc('0x1'));var BPromise=require(_0x8acc('0x2'));var rs=require(_0x8acc('0x3'));var fs=require('fs');var Redis=require(_0x8acc('0x4'));var db=require(_0x8acc('0x5'))['db'];var utils=require(_0x8acc('0x6'));var logger=require('../../config/logger')(_0x8acc('0x7'));var config=require(_0x8acc('0x8'));var jayson=require(_0x8acc('0x9'));var client=jayson['client'][_0x8acc('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x8acc('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8acc('0xc'))(new Redis(config['redis']));require(_0x8acc('0xd'))[_0x8acc('0xe')](socket);function respondWithRpcPromise(_0x5a7185,_0x3fd766,_0x1c0d87){return new BPromise(function(_0x3669fb,_0x2bf3ad){return client[_0x8acc('0xf')](_0x5a7185,_0x1c0d87)[_0x8acc('0x10')](function(_0x390080){logger[_0x8acc('0x11')](_0x8acc('0x12'),_0x3fd766,_0x8acc('0x13'));logger[_0x8acc('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x3fd766,_0x8acc('0x13'),JSON['stringify'](_0x390080));if(_0x390080[_0x8acc('0x15')]){if(_0x390080[_0x8acc('0x15')]['code']===0x1f4){logger[_0x8acc('0x15')]('ChatGroup,\x20%s,\x20%s',_0x3fd766,_0x390080[_0x8acc('0x15')][_0x8acc('0x16')]);return _0x2bf3ad(_0x390080['error'][_0x8acc('0x16')]);}logger[_0x8acc('0x15')](_0x8acc('0x12'),_0x3fd766,_0x390080['error'][_0x8acc('0x16')]);return _0x3669fb(_0x390080[_0x8acc('0x15')][_0x8acc('0x16')]);}else{logger[_0x8acc('0x11')]('ChatGroup,\x20%s,\x20%s',_0x3fd766,_0x8acc('0x13'));_0x3669fb(_0x390080['result']['message']);}})[_0x8acc('0x17')](function(_0x5c9f47){logger['error'](_0x8acc('0x12'),_0x3fd766,_0x5c9f47);_0x2bf3ad(_0x5c9f47);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 22eb2f9..0ff4292 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 _0xe5a7=['update','emit','removeListener','register','length','chatGroup:','./chatGroup.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe5a7,0x7b));var _0x7e5a=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xe5a7[_0x491a7f];return _0x3d8f44;};'use strict';var ChatGroupEvents=require(_0x7e5a('0x0'));var events=[_0x7e5a('0x1'),_0x7e5a('0x2'),_0x7e5a('0x3')];function createListener(_0x204192,_0x49d282){return function(_0x3e8a66){_0x49d282[_0x7e5a('0x4')](_0x204192,_0x3e8a66);};}function removeListener(_0x200097,_0x4e09cc){return function(){ChatGroupEvents[_0x7e5a('0x5')](_0x200097,_0x4e09cc);};}exports[_0x7e5a('0x6')]=function(_0xcc4118){for(var _0x5e5055=0x0,_0x3abde2=events[_0x7e5a('0x7')];_0x5e5055<_0x3abde2;_0x5e5055++){var _0x261af2=events[_0x5e5055];var _0x1f2985=createListener(_0x7e5a('0x8')+_0x261af2,_0xcc4118);ChatGroupEvents['on'](_0x261af2,_0x1f2985);}}; \ No newline at end of file +var _0xe240=['emit','removeListener','length','chatGroup:','./chatGroup.events'];(function(_0x2d731f,_0x1a7db6){var _0x3bc2bf=function(_0x510010){while(--_0x510010){_0x2d731f['push'](_0x2d731f['shift']());}};_0x3bc2bf(++_0x1a7db6);}(_0xe240,0x135));var _0x0e24=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xe240[_0x5c2e3e];return _0x53f64a;};'use strict';var ChatGroupEvents=require(_0x0e24('0x0'));var events=['save','remove','update'];function createListener(_0x4c5346,_0x1d68ea){return function(_0x2d3140){_0x1d68ea[_0x0e24('0x1')](_0x4c5346,_0x2d3140);};}function removeListener(_0x1f2955,_0x1e75ac){return function(){ChatGroupEvents[_0x0e24('0x2')](_0x1f2955,_0x1e75ac);};}exports['register']=function(_0x45ff05){for(var _0x464d74=0x0,_0x4a6690=events[_0x0e24('0x3')];_0x464d74<_0x4a6690;_0x464d74++){var _0x45f727=events[_0x464d74];var _0x106bee=createListener(_0x0e24('0x4')+_0x45f727,_0x45ff05);ChatGroupEvents['on'](_0x45f727,_0x106bee);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 349da70..afa761e 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 _0x92f8=['update','delete','destroy','removeMembers','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','describe','/:id','show','/:id/unread','getMembers','/:id/messages','getMessages','post','/:id/members','addMessage'];(function(_0x4ad82b,_0x4a209b){var _0x5ee22d=function(_0x389c20){while(--_0x389c20){_0x4ad82b['push'](_0x4ad82b['shift']());}};_0x5ee22d(++_0x4a209b);}(_0x92f8,0x1e1));var _0x892f=function(_0x2f432e,_0x4945ed){_0x2f432e=_0x2f432e-0x0;var _0x198fe7=_0x92f8[_0x2f432e];return _0x198fe7;};'use strict';var multer=require('multer');var util=require(_0x892f('0x0'));var path=require(_0x892f('0x1'));var timeout=require(_0x892f('0x2'));var express=require(_0x892f('0x3'));var router=express[_0x892f('0x4')]();var fs_extra=require(_0x892f('0x5'));var auth=require(_0x892f('0x6'));var interaction=require(_0x892f('0x7'));var config=require(_0x892f('0x8'));var controller=require(_0x892f('0x9'));router['get']('/',auth[_0x892f('0xa')](),controller[_0x892f('0xb')]);router[_0x892f('0xc')]('/describe',auth[_0x892f('0xa')](),controller[_0x892f('0xd')]);router[_0x892f('0xc')](_0x892f('0xe'),auth[_0x892f('0xa')](),controller[_0x892f('0xf')]);router[_0x892f('0xc')](_0x892f('0x10'),auth['isAuthenticated'](),controller['getUnread']);router[_0x892f('0xc')]('/:id/members',auth[_0x892f('0xa')](),controller[_0x892f('0x11')]);router[_0x892f('0xc')](_0x892f('0x12'),auth[_0x892f('0xa')](),controller[_0x892f('0x13')]);router[_0x892f('0x14')]('/',auth[_0x892f('0xa')](),controller['create']);router['post'](_0x892f('0x15'),auth[_0x892f('0xa')](),controller['addMembers']);router[_0x892f('0x14')]('/:id/messages',auth[_0x892f('0xa')](),controller[_0x892f('0x16')]);router['put'](_0x892f('0xe'),auth[_0x892f('0xa')](),controller[_0x892f('0x17')]);router[_0x892f('0x18')](_0x892f('0xe'),auth[_0x892f('0xa')](),controller[_0x892f('0x19')]);router[_0x892f('0x18')](_0x892f('0x15'),auth['isAuthenticated'](),controller[_0x892f('0x1a')]);module[_0x892f('0x1b')]=router; \ No newline at end of file +var _0xd1b8=['/:id/members','getMembers','/:id/messages','post','create','put','update','delete','destroy','removeMembers','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/:id','show','/:id/unread','getUnread'];(function(_0xa4098e,_0x4c9e5c){var _0xeeffcb=function(_0x42b2ac){while(--_0x42b2ac){_0xa4098e['push'](_0xa4098e['shift']());}};_0xeeffcb(++_0x4c9e5c);}(_0xd1b8,0x1a8));var _0x8d1b=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0xd1b8[_0x4de586];return _0x46baf5;};'use strict';var multer=require(_0x8d1b('0x0'));var util=require(_0x8d1b('0x1'));var path=require('path');var timeout=require(_0x8d1b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8d1b('0x3'));var interaction=require(_0x8d1b('0x4'));var config=require(_0x8d1b('0x5'));var controller=require(_0x8d1b('0x6'));router[_0x8d1b('0x7')]('/',auth[_0x8d1b('0x8')](),controller['index']);router[_0x8d1b('0x7')]('/describe',auth[_0x8d1b('0x8')](),controller['describe']);router[_0x8d1b('0x7')](_0x8d1b('0x9'),auth[_0x8d1b('0x8')](),controller[_0x8d1b('0xa')]);router[_0x8d1b('0x7')](_0x8d1b('0xb'),auth[_0x8d1b('0x8')](),controller[_0x8d1b('0xc')]);router[_0x8d1b('0x7')](_0x8d1b('0xd'),auth['isAuthenticated'](),controller[_0x8d1b('0xe')]);router['get'](_0x8d1b('0xf'),auth[_0x8d1b('0x8')](),controller['getMessages']);router[_0x8d1b('0x10')]('/',auth['isAuthenticated'](),controller[_0x8d1b('0x11')]);router[_0x8d1b('0x10')](_0x8d1b('0xd'),auth['isAuthenticated'](),controller['addMembers']);router['post'](_0x8d1b('0xf'),auth['isAuthenticated'](),controller['addMessage']);router[_0x8d1b('0x12')](_0x8d1b('0x9'),auth[_0x8d1b('0x8')](),controller[_0x8d1b('0x13')]);router[_0x8d1b('0x14')](_0x8d1b('0x9'),auth[_0x8d1b('0x8')](),controller[_0x8d1b('0x15')]);router[_0x8d1b('0x14')](_0x8d1b('0xd'),auth[_0x8d1b('0x8')](),controller[_0x8d1b('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index bf3cfa7..ffb5e13 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 _0x15f5=['star','thumb','TEXT','STRING','DATE','BOOLEAN','sequelize','exports','INTEGER','ENUM'];(function(_0x4685fa,_0x5b616e){var _0xbff5d2=function(_0x4a006b){while(--_0x4a006b){_0x4685fa['push'](_0x4685fa['shift']());}};_0xbff5d2(++_0x5b616e);}(_0x15f5,0x6a));var _0x515f=function(_0x242581,_0x3149b3){_0x242581=_0x242581-0x0;var _0x4d63e5=_0x15f5[_0x242581];return _0x4d63e5;};'use strict';var Sequelize=require(_0x515f('0x0'));module[_0x515f('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x515f('0x2')]},'ratingType':{'type':Sequelize[_0x515f('0x3')](_0x515f('0x4'),_0x515f('0x5')),'defaultValue':_0x515f('0x4')},'ratingMessage':{'type':Sequelize[_0x515f('0x6')]},'pathTranscript':{'type':Sequelize[_0x515f('0x6')]},'mailTranscript':{'type':Sequelize[_0x515f('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x515f('0x8')]},'disposition':{'type':Sequelize[_0x515f('0x7')]},'secondDisposition':{'type':Sequelize[_0x515f('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x515f('0x7')]},'browserName':{'type':Sequelize[_0x515f('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x515f('0x7')]},'osVersion':{'type':Sequelize[_0x515f('0x7')]},'deviceModel':{'type':Sequelize[_0x515f('0x7')]},'deviceVendor':{'type':Sequelize[_0x515f('0x7')]},'deviceType':{'type':Sequelize[_0x515f('0x7')]},'referer':{'type':Sequelize[_0x515f('0x6')]},'customerIp':{'type':Sequelize[_0x515f('0x7')]},'formData':{'type':Sequelize[_0x515f('0x6')]('long')},'read1stAt':{'type':Sequelize[_0x515f('0x8')]},'lastMsgAt':{'type':Sequelize[_0x515f('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x515f('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x515f('0x7')]},'customerPort':{'type':Sequelize[_0x515f('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x515f('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x515f('0x9')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x515f('0x2')]}}; \ No newline at end of file +var _0x8fe4=['out','INTEGER','sequelize','exports','BOOLEAN','star','TEXT','STRING','DATE','long','ENUM'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x8fe4,0x14c));var _0x48fe=function(_0x35cd06,_0x577a99){_0x35cd06=_0x35cd06-0x0;var _0x5c4f34=_0x8fe4[_0x35cd06];return _0x5c4f34;};'use strict';var Sequelize=require(_0x48fe('0x0'));module[_0x48fe('0x1')]={'closed':{'type':Sequelize[_0x48fe('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0x48fe('0x3'),'thumb'),'defaultValue':_0x48fe('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x48fe('0x4')]},'mailTranscript':{'type':Sequelize[_0x48fe('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x48fe('0x6')]},'disposition':{'type':Sequelize[_0x48fe('0x5')]},'secondDisposition':{'type':Sequelize[_0x48fe('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x48fe('0x5')]},'browserName':{'type':Sequelize[_0x48fe('0x5')]},'browserVersion':{'type':Sequelize[_0x48fe('0x5')]},'osName':{'type':Sequelize[_0x48fe('0x5')]},'osVersion':{'type':Sequelize[_0x48fe('0x5')]},'deviceModel':{'type':Sequelize[_0x48fe('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x48fe('0x5')]},'referer':{'type':Sequelize[_0x48fe('0x4')]},'customerIp':{'type':Sequelize[_0x48fe('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x48fe('0x7'))},'read1stAt':{'type':Sequelize[_0x48fe('0x6')]},'lastMsgAt':{'type':Sequelize[_0x48fe('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x48fe('0x8')]('in',_0x48fe('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x48fe('0x5')]},'customerPort':{'type':Sequelize[_0x48fe('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x48fe('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x48fe('0xa')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index a5bdcd0..e06125d 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 _0x0c0c=['Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','file','filename','mimetype','Attachment','closed','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','root','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','User','CmContact','ContactId','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailServerOut','Smtp','CloudProvider','mailTranscript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','include','getMyMessages','includeAgent','push','rows','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','unix','toString','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','read','Account','Owner','get','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','browserName','osName','referer','customerPort','tail','existsSync','pipe','createWriteStream','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','err','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ioredis','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','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','json','offset','undefined','count','limit','set','Content-Range','update','destroy','end','stack','name','send','render','merge','body','contact','agent','interaction','account','index','map','ChatInteraction','fieldName','type','key','getOptions','findAll','chat','query','show','params','keys','rawAttributes','filters','intersection','model','attributes','fields','length','includeAll','options','find','create','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x0c0c,0x68));var _0xc0c0=function(_0x362851,_0x56bd04){_0x362851=_0x362851-0x0;var _0xadb39=_0x0c0c[_0x362851];return _0xadb39;};'use strict';var rimraf=require(_0xc0c0('0x0'));var zipdir=require(_0xc0c0('0x1'));var rp=require(_0xc0c0('0x2'));var moment=require(_0xc0c0('0x3'));var BPromise=require(_0xc0c0('0x4'));var Mustache=require(_0xc0c0('0x5'));var util=require(_0xc0c0('0x6'));var path=require(_0xc0c0('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0xc0c0('0x8'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0xc0c0('0x9'));var logger=require(_0xc0c0('0xa'))('api');var config=require(_0xc0c0('0xb'));var db=require(_0xc0c0('0xc'))['db'];config[_0xc0c0('0xd')]=_[_0xc0c0('0xe')](config['redis'],{'host':_0xc0c0('0xf'),'port':0x18eb});var socket=require(_0xc0c0('0x10'))(new Redis(config[_0xc0c0('0xd')]));require(_0xc0c0('0x11'))[_0xc0c0('0x12')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc0c0('0x13')][_0xc0c0('0x14')]({'port':0x232b});var client9004=jayson['client'][_0xc0c0('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x207a48,_0x13b07f,_0x2cdb5b,_0x4bcc00){return new BPromise(function(_0x3e6a5c,_0x358544){var _0x31c38e=_0x4bcc00||client;return _0x31c38e[_0xc0c0('0x15')](_0x207a48,_0x2cdb5b)[_0xc0c0('0x16')](function(_0x329217){logger['info'](_0xc0c0('0x17'),_0x13b07f,_0xc0c0('0x18'));logger[_0xc0c0('0x19')](_0xc0c0('0x1a'),_0x13b07f,'request\x20sent',JSON[_0xc0c0('0x1b')](_0x329217));if(_0x329217[_0xc0c0('0x1c')]){if(_0x329217[_0xc0c0('0x1c')][_0xc0c0('0x1d')]===0x1f4){logger[_0xc0c0('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x13b07f,_0x329217[_0xc0c0('0x1c')][_0xc0c0('0x1e')]);return _0x358544(_0x329217[_0xc0c0('0x1c')][_0xc0c0('0x1e')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x13b07f,_0x329217[_0xc0c0('0x1c')][_0xc0c0('0x1e')]);return _0x3e6a5c(_0x329217['error'][_0xc0c0('0x1e')]);}else{logger[_0xc0c0('0x1f')]('ChatInteraction,\x20%s,\x20%s',_0x13b07f,_0xc0c0('0x18'));_0x3e6a5c(_0x329217[_0xc0c0('0x20')][_0xc0c0('0x1e')]);}})[_0xc0c0('0x21')](function(_0x41daf6){logger[_0xc0c0('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x13b07f,_0x41daf6);_0x358544(_0x41daf6);});});}function respondWithStatusCode(_0x2f4cff,_0x1966df){_0x1966df=_0x1966df||0xcc;return function(_0x206f28){if(_0x206f28){return _0x2f4cff[_0xc0c0('0x22')](_0x1966df);}return _0x2f4cff[_0xc0c0('0x23')](_0x1966df)['end']();};}function respondWithResult(_0x5591be,_0x1f44b0){_0x1f44b0=_0x1f44b0||0xc8;return function(_0x25944a){if(_0x25944a){return _0x5591be['status'](_0x1f44b0)[_0xc0c0('0x24')](_0x25944a);}};}function respondWithFilteredResult(_0x241a7d,_0x57be68){return function(_0x51e99a){if(_0x51e99a){var _0x3a46e5=typeof _0x57be68[_0xc0c0('0x25')]===_0xc0c0('0x26')&&typeof _0x57be68['limit']==='undefined';var _0x56199b=_0x51e99a[_0xc0c0('0x27')];var _0x16fa0d=_0x3a46e5?0x0:_0x57be68[_0xc0c0('0x25')];var _0x587bf6=_0x3a46e5?_0x51e99a[_0xc0c0('0x27')]:_0x57be68[_0xc0c0('0x25')]+_0x57be68[_0xc0c0('0x28')];var _0x2c1f0f;if(_0x587bf6>=_0x56199b){_0x587bf6=_0x56199b;_0x2c1f0f=0xc8;}else{_0x2c1f0f=0xce;}_0x241a7d[_0xc0c0('0x23')](_0x2c1f0f);return _0x241a7d[_0xc0c0('0x29')](_0xc0c0('0x2a'),_0x16fa0d+'-'+_0x587bf6+'/'+_0x56199b)['json'](_0x51e99a);}return null;};}function saveUpdates(_0x183423){return function(_0x3d3aca){if(_0x3d3aca){return _0x3d3aca[_0xc0c0('0x2b')](_0x183423)[_0xc0c0('0x16')](function(_0x357f4c){return _0x357f4c;});}return null;};}function removeEntity(_0x272acf){return function(_0xe11880){if(_0xe11880){return _0xe11880[_0xc0c0('0x2c')]()[_0xc0c0('0x16')](function(){_0x272acf[_0xc0c0('0x23')](0xcc)[_0xc0c0('0x2d')]();});}};}function handleEntityNotFound(_0x2f596c){return function(_0x4ec545){if(!_0x4ec545){_0x2f596c[_0xc0c0('0x22')](0x194);}return _0x4ec545;};}function handleError(_0x12eff2,_0x2320a1){_0x2320a1=_0x2320a1||0x1f4;return function(_0x45ef75){logger['error'](_0x45ef75[_0xc0c0('0x2e')]);if(_0x45ef75['name']){delete _0x45ef75[_0xc0c0('0x2f')];}_0x12eff2[_0xc0c0('0x23')](_0x2320a1)[_0xc0c0('0x30')](_0x45ef75);};}function getMustacheRender(_0x1f7424,_0x15acff){return Mustache[_0xc0c0('0x31')](_0x1f7424,_[_0xc0c0('0x32')](_0x15acff[_0xc0c0('0x33')],{'contact':_0x15acff[_0xc0c0('0x34')],'message':_0x15acff['message'],'agent':_0x15acff[_0xc0c0('0x35')],'interaction':_0x15acff[_0xc0c0('0x36')],'account':_0x15acff[_0xc0c0('0x37')]}))||'';}exports[_0xc0c0('0x38')]=function(_0x4198ca,_0x317fa0){var _0x5b2a7a={};var _0xb8df0b=_[_0xc0c0('0x39')](db[_0xc0c0('0x3a')]['rawAttributes'],function(_0x2df8d6){return{'name':_0x2df8d6[_0xc0c0('0x3b')],'type':_0x2df8d6[_0xc0c0('0x3c')][_0xc0c0('0x3d')]};});_0x5b2a7a=qs[_0xc0c0('0x3e')](_0xb8df0b,_0x4198ca);return interaction[_0xc0c0('0x3f')](_0xc0c0('0x40'),_0x4198ca[_0xc0c0('0x41')],_0x4198ca['user'],_0x5b2a7a,_0xb8df0b)['then'](respondWithFilteredResult(_0x317fa0,_0x5b2a7a))['catch'](handleError(_0x317fa0,null));};exports[_0xc0c0('0x42')]=function(_0x3a9763,_0xbb92b6){var _0x3b2ad1={'raw':![],'where':{'id':_0x3a9763[_0xc0c0('0x43')]['id']}},_0x3d74f1={};_0x3d74f1['model']=_[_0xc0c0('0x44')](db[_0xc0c0('0x3a')][_0xc0c0('0x45')]);_0x3d74f1[_0xc0c0('0x41')]=_[_0xc0c0('0x44')](_0x3a9763[_0xc0c0('0x41')]);_0x3d74f1[_0xc0c0('0x46')]=_[_0xc0c0('0x47')](_0x3d74f1[_0xc0c0('0x48')],_0x3d74f1[_0xc0c0('0x41')]);_0x3b2ad1[_0xc0c0('0x49')]=_[_0xc0c0('0x47')](_0x3d74f1[_0xc0c0('0x48')],qs[_0xc0c0('0x4a')](_0x3a9763[_0xc0c0('0x41')]['fields']));_0x3b2ad1[_0xc0c0('0x49')]=_0x3b2ad1[_0xc0c0('0x49')][_0xc0c0('0x4b')]?_0x3b2ad1[_0xc0c0('0x49')]:_0x3d74f1[_0xc0c0('0x48')];if(_0x3a9763[_0xc0c0('0x41')][_0xc0c0('0x4c')]){_0x3b2ad1['include']=[{'all':!![]}];}_0x3b2ad1=_['merge']({},_0x3b2ad1,_0x3a9763[_0xc0c0('0x4d')]);return db[_0xc0c0('0x3a')][_0xc0c0('0x4e')](_0x3b2ad1)[_0xc0c0('0x16')](handleEntityNotFound(_0xbb92b6,null))[_0xc0c0('0x16')](respondWithResult(_0xbb92b6,null))['catch'](handleError(_0xbb92b6,null));};exports[_0xc0c0('0x4f')]=function(_0x258f61,_0x363a1b){return db['ChatInteraction'][_0xc0c0('0x4f')](_0x258f61[_0xc0c0('0x33')],{})['then'](respondWithResult(_0x363a1b,0xc9))[_0xc0c0('0x21')](handleError(_0x363a1b,null));};exports[_0xc0c0('0x2b')]=function(_0x2e9e68,_0x3751c4){if(_0x2e9e68[_0xc0c0('0x33')]['id']){delete _0x2e9e68[_0xc0c0('0x33')]['id'];}return db[_0xc0c0('0x3a')][_0xc0c0('0x4e')]({'where':{'id':_0x2e9e68[_0xc0c0('0x43')]['id']}})[_0xc0c0('0x16')](handleEntityNotFound(_0x3751c4,null))['then'](saveUpdates(_0x2e9e68[_0xc0c0('0x33')],null))[_0xc0c0('0x16')](respondWithResult(_0x3751c4,null))[_0xc0c0('0x21')](handleError(_0x3751c4,null));};exports[_0xc0c0('0x2c')]=function(_0x121f4f,_0x5beadc){return db['ChatInteraction'][_0xc0c0('0x4e')]({'where':{'id':_0x121f4f['params']['id']}})[_0xc0c0('0x16')](handleEntityNotFound(_0x5beadc,null))[_0xc0c0('0x16')](removeEntity(_0x5beadc,null))[_0xc0c0('0x21')](handleError(_0x5beadc,null));};exports['describe']=function(_0x2fd017,_0x2ad330){return db[_0xc0c0('0x3a')][_0xc0c0('0x50')]()[_0xc0c0('0x16')](respondWithResult(_0x2ad330,null))['catch'](handleError(_0x2ad330,null));};exports[_0xc0c0('0x51')]=function(_0x2bb6b2,_0x1cde6){var _0x4db9db=_0x2bb6b2[_0xc0c0('0x43')]['id'];var _0x42b8a1;var _0x1a7eb5;var _0x1c842e;return db[_0xc0c0('0x3a')][_0xc0c0('0x52')]({'where':{'id':_0x4db9db}})[_0xc0c0('0x16')](function(_0x2ba506){_0x42b8a1=_0x2ba506;return db[_0xc0c0('0x53')][_0xc0c0('0x52')]({'where':{'id':_0x2ba506[_0xc0c0('0x54')]},'attributes':['id',_0xc0c0('0x55'),'vidaooEscalation',_0xc0c0('0x56'),_0xc0c0('0x57'),_0xc0c0('0x58')],'raw':!![]});})[_0xc0c0('0x16')](function(_0x5ba11b){if(_0x5ba11b&&_0x5ba11b['vidaooApiKey']&&_0x5ba11b['vidaooEscalation']){_0x1a7eb5=_0x5ba11b;var _0x300f1a={'interaction':{'id':_0x4db9db},'agent':{'id':_0x2bb6b2[_0xc0c0('0x59')]['id'],'name':_0x2bb6b2[_0xc0c0('0x59')][_0xc0c0('0x2f')],'fullname':_0x2bb6b2[_0xc0c0('0x59')][_0xc0c0('0x5a')],'email':_0x2bb6b2[_0xc0c0('0x59')]['email']},'contact':_0x2bb6b2[_0xc0c0('0x33')][_0xc0c0('0x34')],'account':_0x2bb6b2[_0xc0c0('0x33')][_0xc0c0('0x37')]};var _0x22b7b0={'rejectUnauthorized':![],'method':'POST','url':_0xc0c0('0x5b'),'headers':{'X-APIKEY':_0x5ba11b[_0xc0c0('0x55')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2bb6b2[_0xc0c0('0x59')][_0xc0c0('0x5c')]],'buttons':null,'topic':_0x1a7eb5['vidaooTopic'],'note':_[_0xc0c0('0x5d')](_0x1a7eb5['vidaooNote'])?null:getMustacheRender(_0x1a7eb5['vidaooNote'],_0x300f1a),'metadata':null},'redirect':_0xc0c0('0x5e'),'json':!![]};try{if(!_[_0xc0c0('0x5d')](_0x1a7eb5[_0xc0c0('0x58')])){var _0x2a2ac0=getMustacheRender(_0x1a7eb5['vidaooMetadata'],_0x300f1a);var _0x45049d=JSON[_0xc0c0('0x5f')](_0x2a2ac0);_0x22b7b0[_0xc0c0('0x33')][_0xc0c0('0x60')]=_0x45049d;}}catch(_0x446c7f){throw new db[(_0xc0c0('0x61'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x22b7b0);}else{throw new db['Sequelize'][(_0xc0c0('0x62'))](_0xc0c0('0x63'));}})[_0xc0c0('0x16')](function(_0x455f73){_0x1c842e=_0x455f73;if(_0x1c842e['id']){var _0x14fe27={'body':_0x1c842e['join_url'],'ChatWebsiteId':_0x1a7eb5['id'],'ChatInteractionId':_0x42b8a1['id'],'direction':_0xc0c0('0x64'),'UserId':_0x2bb6b2[_0xc0c0('0x59')]['id']};return db[_0xc0c0('0x65')][_0xc0c0('0x4f')](_0x14fe27,{});}else{throw new db[(_0xc0c0('0x61'))][(_0xc0c0('0x62'))](_0xc0c0('0x66'));}})[_0xc0c0('0x16')](function(){return _0x42b8a1[_0xc0c0('0x67')]({'vidaooSessionId':_0x1c842e['id']});})['then'](respondWithResult(_0x1cde6,null))[_0xc0c0('0x21')](handleError(_0x1cde6,null));};exports[_0xc0c0('0x68')]=function(_0x36109d,_0x37ad8e){if(_0x36109d[_0xc0c0('0x33')]['id']){delete _0x36109d['body']['id'];}return db['ChatInteraction'][_0xc0c0('0x4e')]({'where':{'id':_0x36109d['params']['id']},'include':[{'model':db['CmContact'],'as':_0xc0c0('0x69')}]})[_0xc0c0('0x16')](handleEntityNotFound(_0x37ad8e,null))['then'](saveUpdates(_0x36109d[_0xc0c0('0x33')],null))[_0xc0c0('0x16')](respondWithResult(_0x37ad8e,null))[_0xc0c0('0x21')](handleError(_0x37ad8e,null));};exports[_0xc0c0('0x6a')]=function(_0x2545f6,_0x2ba54e){if(_0x2545f6[_0xc0c0('0x33')]['id']){delete _0x2545f6[_0xc0c0('0x33')]['id'];}return db['ChatInteraction'][_0xc0c0('0x4e')]({'where':{'id':_0x2545f6[_0xc0c0('0x43')]['id']}})['then'](function(_0x2021ef){if(!_0x2021ef){logger[_0xc0c0('0x1c')](_0xc0c0('0x6b'),_0xc0c0('0x6a'),0x194,_0xc0c0('0x6c'));_0x2ba54e[_0xc0c0('0x22')](0x194);}else{if(_0x2021ef[_0xc0c0('0x6d')]){throw new db[(_0xc0c0('0x61'))][(_0xc0c0('0x62'))](_0xc0c0('0x6e'));}}return _0x2021ef;})[_0xc0c0('0x16')](function(_0x270a0b){if(_0x270a0b){return _0x270a0b[_0xc0c0('0x2b')]({'closed':_0x2545f6['body']['closed'],'disposition':_0x2545f6[_0xc0c0('0x33')][_0xc0c0('0x6f')]})['then'](function(_0x3b4534){return _0x3b4534;});}})[_0xc0c0('0x16')](function(){return respondWithRpcPromise(_0xc0c0('0x70'),'abandon',_0x2545f6[_0xc0c0('0x33')],client9004);})[_0xc0c0('0x16')](respondWithResult(_0x2ba54e,null))[_0xc0c0('0x21')](handleError(_0x2ba54e,null));};exports[_0xc0c0('0x71')]=function(_0x3554ca,_0x3d9ef6){_0x3554ca[_0xc0c0('0x33')][_0xc0c0('0x2f')]=_0x3554ca[_0xc0c0('0x72')]['originalname'];_0x3554ca[_0xc0c0('0x33')]['basename']=_0x3554ca[_0xc0c0('0x72')][_0xc0c0('0x73')];_0x3554ca[_0xc0c0('0x33')][_0xc0c0('0x3c')]=_0x3554ca['file'][_0xc0c0('0x74')];return db[_0xc0c0('0x75')][_0xc0c0('0x4f')](_0x3554ca[_0xc0c0('0x33')])[_0xc0c0('0x16')](respondWithResult(_0x3d9ef6,0xc9))['catch'](handleError(_0x3d9ef6,null));};exports['attachmentDownload']=function(_0x2389f1,_0xd84189){return db['ChatInteraction'][_0xc0c0('0x52')]({'where':{'id':_0x2389f1[_0xc0c0('0x43')]['id']},'raw':!![]})[_0xc0c0('0x16')](handleEntityNotFound(_0xd84189,null))[_0xc0c0('0x16')](function(_0x47314e){if(_0x47314e){if(_0x47314e[_0xc0c0('0x76')]){return _0xd84189[_0xc0c0('0x23')](0x193)['json']({'status':0x193,'message':_0xc0c0('0x77')});}return db[_0xc0c0('0x75')][_0xc0c0('0x52')]({'where':{'id':_0x2389f1[_0xc0c0('0x41')][_0xc0c0('0x78')]},'raw':!![]})[_0xc0c0('0x16')](handleEntityNotFound(_0xd84189,null));}})[_0xc0c0('0x16')](function(_0x2934c0){if(_0x2934c0){var _0x39318d=_0x2934c0[_0xc0c0('0x79')]!==null;var _0x246996=path[_0xc0c0('0x7a')](config['root'],_0xc0c0('0x7b'));if(_0x39318d){_0x246996=path[_0xc0c0('0x7a')](_0x246996,_0xc0c0('0x7c'));}var _0x1e176f=path['join'](_0x246996,_0x2934c0[_0xc0c0('0x7d')]);return _0xd84189['download'](_0x1e176f);}})[_0xc0c0('0x21')](handleError(_0xd84189,null));};exports['close']=function(_0xc9c1c4,_0x7ed150){var _0x227e34=null;var _0x1aea7a=null;var _0x50b795=null;if(_0xc9c1c4['body']['id']){delete _0xc9c1c4['body']['id'];}if(_0xc9c1c4[_0xc0c0('0x33')]['mailTranscript']){_0x50b795=path[_0xc0c0('0x7a')](config[_0xc0c0('0x7e')],_0xc0c0('0x7f'),util[_0xc0c0('0x80')](_0xc0c0('0x81'),Date[_0xc0c0('0x82')]()));_0xc9c1c4[_0xc0c0('0x33')][_0xc0c0('0x83')]=_0x50b795;}return db[_0xc0c0('0x3a')][_0xc0c0('0x4e')]({'where':{'id':_0xc9c1c4[_0xc0c0('0x43')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0xc0c0('0x84')],'as':_0xc0c0('0x84')}]}]})[_0xc0c0('0x16')](handleEntityNotFound(_0x7ed150,null))[_0xc0c0('0x16')](saveUpdates(_0xc9c1c4[_0xc0c0('0x33')],null))[_0xc0c0('0x16')](function(_0x1a823d){if(_0x1a823d){_0x227e34=_0x1a823d;return db['ChatWebsite'][_0xc0c0('0x4e')]({'where':{'id':_0x227e34[_0xc0c0('0x54')]}});}})['then'](function(_0x30656b){if(_0x30656b){_0x1aea7a=_0x30656b;return db[_0xc0c0('0x85')][_0xc0c0('0x4e')]({'where':{'id':_0x227e34[_0xc0c0('0x86')]}});}})[_0xc0c0('0x16')](function(_0x10c25f){if(_0x10c25f){if(_0x50b795){var _0x2c0324=null;for(var _0x4a218a=0x1;_0x4a218a<_0x227e34[_0xc0c0('0x87')][_0xc0c0('0x4b')];++_0x4a218a){_0x2c0324=_0x227e34[_0xc0c0('0x87')][_0x4a218a];var _0x5aac04=_0x2c0324['UserId']?util[_0xc0c0('0x80')](_0xc0c0('0x88'),_0x1aea7a[_0xc0c0('0x89')],_0x2c0324['UserId']):_0xc0c0('0x8a');var _0x258ea6=_0xc9c1c4[_0xc0c0('0x33')][_0xc0c0('0x8b')]||util[_0xc0c0('0x80')](_0xc0c0('0x88'),_0xc0c0('0x8c'),_0x2c0324[_0xc0c0('0x86')]);switch(_0x1aea7a[_0xc0c0('0x8d')]){case _0xc0c0('0x8e'):_0x5aac04=_0x2c0324[_0xc0c0('0x6d')]?util[_0xc0c0('0x80')](_0xc0c0('0x88'),_0x1aea7a[_0xc0c0('0x89')],_0x2c0324[_0xc0c0('0x6d')]):_0xc0c0('0x8a');break;case'agent_alias':_0x5aac04=_0x2c0324[_0xc0c0('0x6d')]?_0x2c0324[_0xc0c0('0x84')][_0xc0c0('0x8f')]||_0x2c0324['User'][_0xc0c0('0x5a')]:_0xc0c0('0x8a');break;case _0xc0c0('0x90'):_0x5aac04=_0x2c0324[_0xc0c0('0x6d')]?_0x2c0324[_0xc0c0('0x84')][_0xc0c0('0x5a')]:'System';break;default:_0x5aac04=_0x2c0324[_0xc0c0('0x6d')]?util[_0xc0c0('0x80')](_0xc0c0('0x88'),_0x1aea7a[_0xc0c0('0x89')],_0x2c0324[_0xc0c0('0x6d')]):'System';}var _0xb7bf39=util[_0xc0c0('0x80')](_0xc0c0('0x91'),moment(_0x2c0324[_0xc0c0('0x92')])[_0xc0c0('0x80')](_0xc0c0('0x93')),_0x2c0324[_0xc0c0('0x94')]==='in'?_0x258ea6:_0x5aac04,_0x2c0324[_0xc0c0('0x33')]);if(!_0x2c0324[_0xc0c0('0x95')]){fs[_0xc0c0('0x96')](_0x50b795,_0xb7bf39);}}return db['MailAccount'][_0xc0c0('0x52')]({'where':{'service':!![]},'include':[{'model':db[_0xc0c0('0x97')],'as':_0xc0c0('0x98'),'raw':!![],'include':[{'model':db[_0xc0c0('0x99')],'as':_0xc0c0('0x99'),'raw':!![]}]}]});}}})[_0xc0c0('0x16')](function(_0x3d3e9f){if(!_0x3d3e9f||!_0x3d3e9f[_0xc0c0('0x98')]||!_0xc9c1c4[_0xc0c0('0x33')])return _0x227e34;var _0xc62010=_0x3d3e9f['getSmtpOptions']();return respondWithRpcPromise('SendMail','sendMail',{'account':_0xc62010,'message':{'from':util[_0xc0c0('0x80')]('\x22%s\x22\x20<%s>',_0x3d3e9f[_0xc0c0('0x2f')],_0x3d3e9f[_0xc0c0('0x5c')]||_0x3d3e9f[_0xc0c0('0x98')]['user']),'to':_0xc9c1c4[_0xc0c0('0x33')][_0xc0c0('0x9a')],'subject':'Mail\x20Transcript','text':util[_0xc0c0('0x80')](_0xc0c0('0x9b'),_0xc9c1c4[_0xc0c0('0x33')][_0xc0c0('0x9a')]),'attachments':[{'path':_0x50b795}]}})[_0xc0c0('0x16')](function(){return _0x227e34;})['catch'](function(_0x11be3f){logger[_0xc0c0('0x1c')](_0x11be3f);});})['then'](respondWithStatusCode(_0x7ed150,0xc8))[_0xc0c0('0x21')](handleError(_0x7ed150,null));};exports[_0xc0c0('0x9c')]=function(_0x512e09,_0x1693a5){return db[_0xc0c0('0x65')]['find']({'where':{'id':_0x512e09[_0xc0c0('0x43')]['id']}})['then'](handleEntityNotFound(_0x1693a5,null))[_0xc0c0('0x16')](function(_0x2797f9){if(_0x2797f9){return _0x2797f9[_0xc0c0('0x9c')](_0x512e09[_0xc0c0('0x33')][_0xc0c0('0x9d')],_[_0xc0c0('0x9e')](_0x512e09[_0xc0c0('0x33')],[_0xc0c0('0x9d'),'id'])||{});}})[_0xc0c0('0x16')](respondWithResult(_0x1693a5,null))[_0xc0c0('0x21')](handleError(_0x1693a5,null));};exports[_0xc0c0('0x9f')]=function(_0x5f1eb2,_0x532a77){var _0x3ab0bd={'raw':![],'where':{}};var _0xec6ac6={};var _0x273c30={'count':0x0,'rows':[]};return db[_0xc0c0('0x3a')][_0xc0c0('0x52')]({'where':{'id':_0x5f1eb2[_0xc0c0('0x43')]['id']}})[_0xc0c0('0x16')](handleEntityNotFound(_0x532a77,null))[_0xc0c0('0x16')](function(_0x42d9d4){if(_0x42d9d4){_0xec6ac6[_0xc0c0('0x48')]=_['keys'](db[_0xc0c0('0x65')]['rawAttributes']);_0xec6ac6[_0xc0c0('0x41')]=_[_0xc0c0('0x44')](_0x5f1eb2[_0xc0c0('0x41')]);_0xec6ac6[_0xc0c0('0x46')]=_[_0xc0c0('0x47')](_0xec6ac6['model'],_0xec6ac6[_0xc0c0('0x41')]);_0x3ab0bd[_0xc0c0('0x49')]=_[_0xc0c0('0x47')](_0xec6ac6[_0xc0c0('0x48')],qs['fields'](_0x5f1eb2[_0xc0c0('0x41')][_0xc0c0('0x4a')]));_0x3ab0bd['attributes']=_0x3ab0bd[_0xc0c0('0x49')][_0xc0c0('0x4b')]?_0x3ab0bd[_0xc0c0('0x49')]:_0xec6ac6[_0xc0c0('0x48')];if(!_0x5f1eb2[_0xc0c0('0x41')][_0xc0c0('0xa0')](_0xc0c0('0xa1'))){_0x3ab0bd[_0xc0c0('0x28')]=qs['limit'](_0x5f1eb2[_0xc0c0('0x41')][_0xc0c0('0x28')]);_0x3ab0bd[_0xc0c0('0x25')]=qs[_0xc0c0('0x25')](_0x5f1eb2[_0xc0c0('0x41')][_0xc0c0('0x25')]);}_0x3ab0bd[_0xc0c0('0xa2')]=qs[_0xc0c0('0xa3')](_0x5f1eb2[_0xc0c0('0x41')][_0xc0c0('0xa3')]);_0x3ab0bd[_0xc0c0('0xa4')]=qs[_0xc0c0('0x46')](_[_0xc0c0('0xa5')](_0x5f1eb2[_0xc0c0('0x41')],_0xec6ac6[_0xc0c0('0x46')]));_0x3ab0bd[_0xc0c0('0xa4')][_0xc0c0('0xa6')]=_0x42d9d4['id'];if(_0x5f1eb2['query'][_0xc0c0('0xa7')]){_0x3ab0bd['where']=_[_0xc0c0('0x32')](_0x3ab0bd[_0xc0c0('0xa4')],{'$or':_[_0xc0c0('0x39')](_0x3ab0bd[_0xc0c0('0x49')],function(_0x567366){var _0x3fb79a={};_0x3fb79a[_0x567366]={'$like':'%'+_0x5f1eb2[_0xc0c0('0x41')]['filter']+'%'};return _0x3fb79a;})});}if(_0x5f1eb2[_0xc0c0('0x41')][_0xc0c0('0xa8')]){var _0x4f547a=_0x5f1eb2['query'][_0xc0c0('0xa8')][_0xc0c0('0xa9')](',');var _0x7dc3bb={};_0x7dc3bb[_0x4f547a[0x0]]={'$gte':moment(_0x4f547a[0x1])[_0xc0c0('0x80')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3ab0bd['where']=_[_0xc0c0('0x32')](_0x3ab0bd[_0xc0c0('0xa4')],_0x7dc3bb);}_0x3ab0bd=_[_0xc0c0('0x32')]({},_0x3ab0bd,_0x5f1eb2[_0xc0c0('0x4d')]);return db[_0xc0c0('0x65')]['count']({'where':_0x3ab0bd['where']})[_0xc0c0('0x16')](function(_0x34f59e){_0x273c30['count']=_0x34f59e;if(_0x5f1eb2[_0xc0c0('0x41')][_0xc0c0('0x4c')]){_0x3ab0bd[_0xc0c0('0xaa')]=[{'all':!![]}];}return db[_0xc0c0('0x65')][_0xc0c0('0x3f')](_0x3ab0bd);})[_0xc0c0('0x16')](function(_0x3116f2){_0x273c30['rows']=_0x3116f2;return _0x273c30;});}})['then'](respondWithFilteredResult(_0x532a77,_0x3ab0bd))[_0xc0c0('0x21')](handleError(_0x532a77,null));};exports[_0xc0c0('0xab')]=function(_0x2ffc42,_0x3e48a2){var _0x1b92ad={'where':{}},_0x234b4a={},_0x1b1777={'count':0x0,'rows':[]};return db[_0xc0c0('0x3a')][_0xc0c0('0x52')]({'where':{'id':_0x2ffc42['params']['id']}})[_0xc0c0('0x16')](handleEntityNotFound(_0x3e48a2,null))[_0xc0c0('0x16')](function(_0xe13baf){if(_0xe13baf){_0x234b4a[_0xc0c0('0x48')]=_[_0xc0c0('0x44')](db['ChatMessage'][_0xc0c0('0x45')]);_0x234b4a[_0xc0c0('0x41')]=_['keys'](_0x2ffc42[_0xc0c0('0x41')]);_0x234b4a[_0xc0c0('0x46')]=_['intersection'](_0x234b4a[_0xc0c0('0x48')],_0x234b4a[_0xc0c0('0x41')]);_0x1b92ad[_0xc0c0('0x49')]=_[_0xc0c0('0x47')](_0x234b4a[_0xc0c0('0x48')],qs['fields'](_0x2ffc42[_0xc0c0('0x41')][_0xc0c0('0x4a')]));_0x1b92ad[_0xc0c0('0x49')]=_0x1b92ad[_0xc0c0('0x49')][_0xc0c0('0x4b')]?_0x1b92ad[_0xc0c0('0x49')]:_0x234b4a[_0xc0c0('0x48')];if(!_0x2ffc42[_0xc0c0('0x41')][_0xc0c0('0xa0')](_0xc0c0('0xa1'))){_0x1b92ad['limit']=qs[_0xc0c0('0x28')](_0x2ffc42[_0xc0c0('0x41')][_0xc0c0('0x28')]);_0x1b92ad[_0xc0c0('0x25')]=qs[_0xc0c0('0x25')](_0x2ffc42[_0xc0c0('0x41')][_0xc0c0('0x25')]);}_0x1b92ad[_0xc0c0('0xa2')]=qs[_0xc0c0('0xa3')](_0x2ffc42[_0xc0c0('0x41')][_0xc0c0('0xa3')]);_0x1b92ad[_0xc0c0('0xa4')]=qs[_0xc0c0('0x46')](_[_0xc0c0('0xa5')](_0x2ffc42[_0xc0c0('0x41')],_0x234b4a['filters']));_0x1b92ad[_0xc0c0('0xa4')][_0xc0c0('0xa6')]=_0xe13baf['id'];if(_0x2ffc42['query'][_0xc0c0('0xa7')]){_0x1b92ad[_0xc0c0('0xa4')]=_[_0xc0c0('0x32')](_0x1b92ad['where'],{'$or':_[_0xc0c0('0x39')](_0x1b92ad[_0xc0c0('0x49')],function(_0x29f704){var _0x5b8aae={};_0x5b8aae[_0x29f704]={'$like':'%'+_0x2ffc42[_0xc0c0('0x41')][_0xc0c0('0xa7')]+'%'};return _0x5b8aae;})});}_0x1b92ad[_0xc0c0('0xa4')][_0xc0c0('0x95')]=![];if(_0x2ffc42['query']['id']){_0x1b92ad[_0xc0c0('0xa4')]['id']={'$gt':_0x2ffc42[_0xc0c0('0x41')]['id']};}_0x1b92ad=_[_0xc0c0('0x32')]({},_0x1b92ad,_0x2ffc42[_0xc0c0('0x4d')]);return db['ChatMessage']['count']({'where':_0x1b92ad[_0xc0c0('0xa4')]})[_0xc0c0('0x16')](function(_0x4570d4){_0x1b1777['count']=_0x4570d4;_0x1b92ad[_0xc0c0('0xaa')]=[];if(_0x2ffc42['query'][_0xc0c0('0xac')]){_0x1b92ad[_0xc0c0('0xaa')][_0xc0c0('0xad')]({'model':db[_0xc0c0('0x84')],'as':_0xc0c0('0x84'),'attributes':['id',_0xc0c0('0x5a'),_0xc0c0('0x8f')]});}if(_0x2ffc42['query']['includeAll']){_0x1b92ad['include']=[{'all':!![]}];}return db[_0xc0c0('0x65')]['findAll'](_0x1b92ad);})[_0xc0c0('0x16')](function(_0x577d2e){_0x1b1777[_0xc0c0('0xae')]=_0x577d2e;return _0x1b1777;});}})['then'](respondWithFilteredResult(_0x3e48a2,_0x1b92ad))[_0xc0c0('0x21')](handleError(_0x3e48a2,null));};exports[_0xc0c0('0xaf')]=function(_0x3137c6,_0x15d406){return db[_0xc0c0('0x3a')][_0xc0c0('0x4e')]({'where':{'id':_0x3137c6[_0xc0c0('0x43')]['id']}})['then'](handleEntityNotFound(_0x15d406,null))['then'](function(_0x2ec9bd){if(_0x2ec9bd){return _0x2ec9bd[_0xc0c0('0xb0')](_0x3137c6[_0xc0c0('0x33')]['ids'],_['omit'](_0x3137c6[_0xc0c0('0x33')],[_0xc0c0('0x9d'),'id'])||{})[_0xc0c0('0xb1')](function(){return db[_0xc0c0('0xb2')][_0xc0c0('0x3f')]({'attributes':['id',_0xc0c0('0x2f'),_0xc0c0('0xb3')],'where':{'id':_0x3137c6[_0xc0c0('0x33')][_0xc0c0('0x9d')]}});})['then'](function(_0xa92f03){socket[_0xc0c0('0xb4')](_0xc0c0('0xb5'),{'id':Number(_0x3137c6[_0xc0c0('0x43')]['id']),'tags':_0xa92f03||[]});return{'id':Number(_0x3137c6[_0xc0c0('0x43')]['id']),'tags':_0xa92f03||[]};});}})[_0xc0c0('0x16')](respondWithResult(_0x15d406,null))['catch'](handleError(_0x15d406,null));};exports['removeTags']=function(_0x185734,_0x317030){return db[_0xc0c0('0x3a')][_0xc0c0('0x4e')]({'where':{'id':_0x185734[_0xc0c0('0x43')]['id']}})[_0xc0c0('0x16')](handleEntityNotFound(_0x317030,null))['then'](function(_0x33b47c){if(_0x33b47c){return _0x33b47c['removeTags'](_0x185734['query'][_0xc0c0('0x9d')]);}})['then'](respondWithStatusCode(_0x317030,null))[_0xc0c0('0x21')](handleError(_0x317030,null));};exports['download']=function(_0x20282e,_0x58fc99){var _0x468e08=moment()[_0xc0c0('0xb6')]()[_0xc0c0('0xb7')]();var _0x12ee65=path[_0xc0c0('0x7a')](config['root'],_0xc0c0('0xb8'),_0xc0c0('0xb9'),'tmp');var _0x1c8956=path[_0xc0c0('0x7a')](config[_0xc0c0('0x7e')],'server','files',_0xc0c0('0xba'));var _0x3ea58c=path[_0xc0c0('0x7a')](_0x12ee65,_0x468e08);var _0x34df16=util[_0xc0c0('0x80')](_0xc0c0('0xbb'),_0x20282e[_0xc0c0('0x43')]['id'],_0x468e08);var _0x43eda4=path[_0xc0c0('0x7a')](_0x12ee65,_0x34df16);var _0x2275fd=[];_0x2275fd[_0xc0c0('0xad')]({'model':db['User'],'as':_0xc0c0('0x84'),'attributes':['id','fullname'],'raw':!![]});_0x2275fd[_0xc0c0('0xad')]({'model':db[_0xc0c0('0x85')],'as':_0xc0c0('0x69'),'attributes':['id',_0xc0c0('0xbc'),_0xc0c0('0xbd')],'raw':!![]});if(_0x20282e[_0xc0c0('0x41')]['attachments']){_0x2275fd[_0xc0c0('0xad')]({'model':db[_0xc0c0('0x75')],'as':_0xc0c0('0x75'),'raw':!![]});}var _0x4264e3=[{'model':db[_0xc0c0('0x65')],'as':_0xc0c0('0x87'),'attributes':['id',_0xc0c0('0x33'),_0xc0c0('0x92'),_0xc0c0('0x94'),'secret',_0xc0c0('0xbe')],'include':_0x2275fd}];_0x4264e3[_0xc0c0('0xad')]({'model':db[_0xc0c0('0x53')],'as':_0xc0c0('0xbf'),'attributes':['id','name']});_0x4264e3[_0xc0c0('0xad')]({'model':db[_0xc0c0('0x84')],'as':_0xc0c0('0xc0'),'attributes':['id',_0xc0c0('0x5a')]});return db[_0xc0c0('0x3a')][_0xc0c0('0x4e')]({'where':{'id':_0x20282e[_0xc0c0('0x43')]['id']},'include':_0x4264e3})[_0xc0c0('0x16')](handleEntityNotFound(_0x58fc99,null))[_0xc0c0('0x16')](function(_0x51e4e6){if(_0x51e4e6){var _0x2a0f23=_0x51e4e6[_0xc0c0('0xc1')]({'plain':!![]});fs[_0xc0c0('0xc2')](_0x3ea58c);var _0x3ce4ad={'channel':_0xc0c0('0xc3'),'account':_0x2a0f23[_0xc0c0('0xbf')][_0xc0c0('0x2f')],'agent':_0x2a0f23['Owner']?_0x2a0f23['Owner'][_0xc0c0('0x5a')]:_0xc0c0('0xc4'),'createdAt':moment(_0x2a0f23[_0xc0c0('0x92')])[_0xc0c0('0x80')](_0xc0c0('0xc5'))['toString'](),'closedAt':_0x2a0f23[_0xc0c0('0x76')]?moment(_0x2a0f23['closedAt'])['format'](_0xc0c0('0xc5'))['toString']():'','disposition':_0x2a0f23[_0xc0c0('0x6f')],'chatInfo':{'browser':_0x2a0f23[_0xc0c0('0xc6')],'os':_0x2a0f23[_0xc0c0('0xc7')],'referer':_0x2a0f23[_0xc0c0('0xc8')],'customerIp':_0x2a0f23['customerIp'],'customerPort':_0x2a0f23[_0xc0c0('0xc9')]?_0x2a0f23[_0xc0c0('0xc9')]:_0xc0c0('0xc4')},'messages':_(_0x2a0f23[_0xc0c0('0x87')])[_0xc0c0('0xca')]()[_0xc0c0('0xa7')]({'secret':![]})[_0xc0c0('0x39')](function(_0x42a75b){if(_0x42a75b[_0xc0c0('0x75')]){var _0x38e6d0=path[_0xc0c0('0x7a')](_0x1c8956,_0x42a75b[_0xc0c0('0x75')]['basename']);if(fs[_0xc0c0('0xcb')](_0x38e6d0)){fs['createReadStream'](_0x38e6d0)[_0xc0c0('0xcc')](fs[_0xc0c0('0xcd')](path['join'](_0x3ea58c,_0x42a75b[_0xc0c0('0x75')][_0xc0c0('0x7d')])));}}return{'date':moment(_0x42a75b[_0xc0c0('0x92')])[_0xc0c0('0x80')](_0xc0c0('0xc5'))[_0xc0c0('0xb7')](),'sender':_0x42a75b[_0xc0c0('0x94')]===_0xc0c0('0x64')?_0x42a75b[_0xc0c0('0x84')]?_0x42a75b[_0xc0c0('0x84')]['fullname']:'System':_0x42a75b[_0xc0c0('0x69')][_0xc0c0('0xbc')]+(_0x42a75b['Contact'][_0xc0c0('0xbd')]?'\x20'+_0x42a75b['Contact'][_0xc0c0('0xbd')]:''),'body':_0x42a75b['Attachment']?_0x42a75b[_0xc0c0('0x75')][_0xc0c0('0x7d')]:_0x42a75b['body'],'direction':_0x42a75b[_0xc0c0('0x94')]===_0xc0c0('0x64')?'A':'C','secret':_0x42a75b[_0xc0c0('0x95')],'read':_0x42a75b[_0xc0c0('0xbe')],'attachment':_0x42a75b['Attachment']};})[_0xc0c0('0xce')]()};return ejs[_0xc0c0('0xcf')](path['join'](config['root'],_0xc0c0('0xb8'),'views',_0xc0c0('0xd0')),{'interaction':_0x3ce4ad})['then'](function(_0xd2c50){var _0x2c466e=path['join'](_0x3ea58c,_0xc0c0('0xd1')+_0x2a0f23['id']+'-'+_0x468e08+_0xc0c0('0xd2'));var _0x46b112={'path':_0x2c466e,'channel':'Chat','interactionId':_0x2a0f23['id']};return pdf[_0xc0c0('0xd3')](_0xd2c50,_0x46b112);})[_0xc0c0('0x16')](function(){return new Promise(function(_0x293aa1,_0x5f1765){zipdir(_0x3ea58c,{'saveTo':_0x43eda4},function(_0x4cf9f4,_0x3446a8){if(_0x4cf9f4)return _0x5f1765(_0x4cf9f4);return _0x293aa1(_0x3446a8);});})[_0xc0c0('0x16')](function(){return new BPromise(function(_0x452f1d,_0x52e87f){rimraf(_0x3ea58c,function(_0x28e5ba){if(_0x28e5ba)_0x52e87f(_0x28e5ba);return _0x452f1d();});});})[_0xc0c0('0x16')](function(){return _0x58fc99[_0xc0c0('0xd4')](_0x43eda4,_0x34df16,function(_0x10fe25){if(_0x10fe25){logger[_0xc0c0('0x1c')](_0xc0c0('0xd5'),_0x10fe25);}else{fs['unlinkSync'](_0x43eda4);}});});});}else{return _0x58fc99[_0xc0c0('0x22')](0xc8);}})['catch'](handleError(_0x58fc99,null));}; \ No newline at end of file +var _0xa802=['mimetype','Attachment','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','format','transcript-%s.txt','pathTranscript','Messages','User','ChatWebsite','ContactId','UserId','%s%d','agentAlias','System','customer','agentIdentifier','website_alias','agent_alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','appendFileSync','MailAccount','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','omit','ids','order','sort','where','ChatInteractionId','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','getMyMessages','hasOwnProperty','secret','includeAgent','alias','findAll','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','toString','tmp','server','files','attachments','transcript-%d-%s.zip','push','direction','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','disposition','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','Contact','firstName','lastName','read','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','rimraf','bluebird','mustache','util','path','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','end','stack','name','render','body','contact','agent','interaction','account','index','map','ChatInteraction','type','key','getOptions','query','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','find','create','params','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','out','ChatMessage','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','closed','attachmentUpload','file','originalname','basename'];(function(_0x342ebe,_0x459563){var _0x2898af=function(_0x4bf08d){while(--_0x4bf08d){_0x342ebe['push'](_0x342ebe['shift']());}};_0x2898af(++_0x459563);}(_0xa802,0x67));var _0x2a80=function(_0x18dfcf,_0x4709ca){_0x18dfcf=_0x18dfcf-0x0;var _0x422850=_0xa802[_0x18dfcf];return _0x422850;};'use strict';var rimraf=require(_0x2a80('0x0'));var zipdir=require('zip-dir');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2a80('0x1'));var Mustache=require(_0x2a80('0x2'));var util=require(_0x2a80('0x3'));var path=require(_0x2a80('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2a80('0x5'));var Redis=require(_0x2a80('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x2a80('0x7'));var pdf=require(_0x2a80('0x8'));var logger=require(_0x2a80('0x9'))('api');var config=require(_0x2a80('0xa'));var db=require(_0x2a80('0xb'))['db'];config[_0x2a80('0xc')]=_[_0x2a80('0xd')](config['redis'],{'host':_0x2a80('0xe'),'port':0x18eb});var socket=require(_0x2a80('0xf'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0x2a80('0x10')](socket);var jayson=require(_0x2a80('0x11'));var client=jayson[_0x2a80('0x12')][_0x2a80('0x13')]({'port':0x232b});var client9004=jayson[_0x2a80('0x12')][_0x2a80('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x5819de,_0x3ade2c,_0x15b660,_0x56e43f){return new BPromise(function(_0xc17ce7,_0x449713){var _0x5d8f21=_0x56e43f||client;return _0x5d8f21[_0x2a80('0x14')](_0x5819de,_0x15b660)['then'](function(_0x1de562){logger[_0x2a80('0x15')](_0x2a80('0x16'),_0x3ade2c,'request\x20sent');logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x3ade2c,'request\x20sent',JSON[_0x2a80('0x17')](_0x1de562));if(_0x1de562['error']){if(_0x1de562[_0x2a80('0x18')][_0x2a80('0x19')]===0x1f4){logger[_0x2a80('0x18')](_0x2a80('0x16'),_0x3ade2c,_0x1de562['error'][_0x2a80('0x1a')]);return _0x449713(_0x1de562[_0x2a80('0x18')][_0x2a80('0x1a')]);}logger['error'](_0x2a80('0x16'),_0x3ade2c,_0x1de562['error']['message']);return _0xc17ce7(_0x1de562[_0x2a80('0x18')][_0x2a80('0x1a')]);}else{logger[_0x2a80('0x15')](_0x2a80('0x16'),_0x3ade2c,_0x2a80('0x1b'));_0xc17ce7(_0x1de562['result'][_0x2a80('0x1a')]);}})[_0x2a80('0x1c')](function(_0x20424b){logger[_0x2a80('0x18')](_0x2a80('0x16'),_0x3ade2c,_0x20424b);_0x449713(_0x20424b);});});}function respondWithStatusCode(_0x4f9185,_0x3a2d0e){_0x3a2d0e=_0x3a2d0e||0xcc;return function(_0x49c2c6){if(_0x49c2c6){return _0x4f9185[_0x2a80('0x1d')](_0x3a2d0e);}return _0x4f9185['status'](_0x3a2d0e)['end']();};}function respondWithResult(_0x16e922,_0x483f92){_0x483f92=_0x483f92||0xc8;return function(_0x39f2de){if(_0x39f2de){return _0x16e922[_0x2a80('0x1e')](_0x483f92)[_0x2a80('0x1f')](_0x39f2de);}};}function respondWithFilteredResult(_0x47bfb2,_0x2803e5){return function(_0xb4fdfa){if(_0xb4fdfa){var _0x15059d=typeof _0x2803e5[_0x2a80('0x20')]===_0x2a80('0x21')&&typeof _0x2803e5[_0x2a80('0x22')]==='undefined';var _0x2ef3b7=_0xb4fdfa['count'];var _0x5bfe69=_0x15059d?0x0:_0x2803e5[_0x2a80('0x20')];var _0x23c8a5=_0x15059d?_0xb4fdfa[_0x2a80('0x23')]:_0x2803e5[_0x2a80('0x20')]+_0x2803e5[_0x2a80('0x22')];var _0x1a4903;if(_0x23c8a5>=_0x2ef3b7){_0x23c8a5=_0x2ef3b7;_0x1a4903=0xc8;}else{_0x1a4903=0xce;}_0x47bfb2[_0x2a80('0x1e')](_0x1a4903);return _0x47bfb2[_0x2a80('0x24')](_0x2a80('0x25'),_0x5bfe69+'-'+_0x23c8a5+'/'+_0x2ef3b7)['json'](_0xb4fdfa);}return null;};}function saveUpdates(_0x58d46f){return function(_0x3ad276){if(_0x3ad276){return _0x3ad276[_0x2a80('0x26')](_0x58d46f)['then'](function(_0x1078c3){return _0x1078c3;});}return null;};}function removeEntity(_0x46c4b6){return function(_0xbde15a){if(_0xbde15a){return _0xbde15a[_0x2a80('0x27')]()[_0x2a80('0x28')](function(){_0x46c4b6[_0x2a80('0x1e')](0xcc)[_0x2a80('0x29')]();});}};}function handleEntityNotFound(_0x5afffb){return function(_0xf3b647){if(!_0xf3b647){_0x5afffb['sendStatus'](0x194);}return _0xf3b647;};}function handleError(_0x134638,_0x4ef250){_0x4ef250=_0x4ef250||0x1f4;return function(_0x136d71){logger['error'](_0x136d71[_0x2a80('0x2a')]);if(_0x136d71[_0x2a80('0x2b')]){delete _0x136d71[_0x2a80('0x2b')];}_0x134638[_0x2a80('0x1e')](_0x4ef250)['send'](_0x136d71);};}function getMustacheRender(_0xca47ac,_0x341d12){return Mustache[_0x2a80('0x2c')](_0xca47ac,_['merge'](_0x341d12[_0x2a80('0x2d')],{'contact':_0x341d12[_0x2a80('0x2e')],'message':_0x341d12[_0x2a80('0x1a')],'agent':_0x341d12[_0x2a80('0x2f')],'interaction':_0x341d12[_0x2a80('0x30')],'account':_0x341d12[_0x2a80('0x31')]}))||'';}exports[_0x2a80('0x32')]=function(_0x3ce1e6,_0x33115a){var _0x9edccb={};var _0x2f9a99=_[_0x2a80('0x33')](db[_0x2a80('0x34')]['rawAttributes'],function(_0x810e4a){return{'name':_0x810e4a['fieldName'],'type':_0x810e4a[_0x2a80('0x35')][_0x2a80('0x36')]};});_0x9edccb=qs[_0x2a80('0x37')](_0x2f9a99,_0x3ce1e6);return interaction['findAll']('chat',_0x3ce1e6[_0x2a80('0x38')],_0x3ce1e6['user'],_0x9edccb,_0x2f9a99)[_0x2a80('0x28')](respondWithFilteredResult(_0x33115a,_0x9edccb))[_0x2a80('0x1c')](handleError(_0x33115a,null));};exports[_0x2a80('0x39')]=function(_0x405982,_0xdb004f){var _0x18c957={'raw':![],'where':{'id':_0x405982['params']['id']}},_0x5e934b={};_0x5e934b[_0x2a80('0x3a')]=_[_0x2a80('0x3b')](db[_0x2a80('0x34')][_0x2a80('0x3c')]);_0x5e934b[_0x2a80('0x38')]=_[_0x2a80('0x3b')](_0x405982[_0x2a80('0x38')]);_0x5e934b[_0x2a80('0x3d')]=_[_0x2a80('0x3e')](_0x5e934b[_0x2a80('0x3a')],_0x5e934b[_0x2a80('0x38')]);_0x18c957[_0x2a80('0x3f')]=_[_0x2a80('0x3e')](_0x5e934b[_0x2a80('0x3a')],qs['fields'](_0x405982[_0x2a80('0x38')][_0x2a80('0x40')]));_0x18c957[_0x2a80('0x3f')]=_0x18c957[_0x2a80('0x3f')][_0x2a80('0x41')]?_0x18c957[_0x2a80('0x3f')]:_0x5e934b[_0x2a80('0x3a')];if(_0x405982[_0x2a80('0x38')][_0x2a80('0x42')]){_0x18c957['include']=[{'all':!![]}];}_0x18c957=_['merge']({},_0x18c957,_0x405982['options']);return db[_0x2a80('0x34')][_0x2a80('0x43')](_0x18c957)[_0x2a80('0x28')](handleEntityNotFound(_0xdb004f,null))['then'](respondWithResult(_0xdb004f,null))[_0x2a80('0x1c')](handleError(_0xdb004f,null));};exports[_0x2a80('0x44')]=function(_0x596960,_0x4a29a2){return db[_0x2a80('0x34')][_0x2a80('0x44')](_0x596960[_0x2a80('0x2d')],{})[_0x2a80('0x28')](respondWithResult(_0x4a29a2,0xc9))[_0x2a80('0x1c')](handleError(_0x4a29a2,null));};exports[_0x2a80('0x26')]=function(_0x1f4735,_0x166e60){if(_0x1f4735[_0x2a80('0x2d')]['id']){delete _0x1f4735['body']['id'];}return db['ChatInteraction'][_0x2a80('0x43')]({'where':{'id':_0x1f4735[_0x2a80('0x45')]['id']}})[_0x2a80('0x28')](handleEntityNotFound(_0x166e60,null))[_0x2a80('0x28')](saveUpdates(_0x1f4735[_0x2a80('0x2d')],null))[_0x2a80('0x28')](respondWithResult(_0x166e60,null))[_0x2a80('0x1c')](handleError(_0x166e60,null));};exports[_0x2a80('0x27')]=function(_0x399513,_0x2380fe){return db[_0x2a80('0x34')]['find']({'where':{'id':_0x399513[_0x2a80('0x45')]['id']}})[_0x2a80('0x28')](handleEntityNotFound(_0x2380fe,null))['then'](removeEntity(_0x2380fe,null))[_0x2a80('0x1c')](handleError(_0x2380fe,null));};exports[_0x2a80('0x46')]=function(_0x596ad7,_0x478d02){return db[_0x2a80('0x34')][_0x2a80('0x46')]()['then'](respondWithResult(_0x478d02,null))['catch'](handleError(_0x478d02,null));};exports[_0x2a80('0x47')]=function(_0x4653a1,_0x5eb007){var _0x35ec34=_0x4653a1[_0x2a80('0x45')]['id'];var _0x1e6ae8;var _0x5732b9;var _0x2410ae;return db[_0x2a80('0x34')][_0x2a80('0x48')]({'where':{'id':_0x35ec34}})['then'](function(_0x37a375){_0x1e6ae8=_0x37a375;return db['ChatWebsite'][_0x2a80('0x48')]({'where':{'id':_0x37a375[_0x2a80('0x49')]},'attributes':['id',_0x2a80('0x4a'),_0x2a80('0x4b'),_0x2a80('0x4c'),_0x2a80('0x4d'),_0x2a80('0x4e')],'raw':!![]});})[_0x2a80('0x28')](function(_0x285df3){if(_0x285df3&&_0x285df3[_0x2a80('0x4a')]&&_0x285df3[_0x2a80('0x4b')]){_0x5732b9=_0x285df3;var _0x5e354d={'interaction':{'id':_0x35ec34},'agent':{'id':_0x4653a1['user']['id'],'name':_0x4653a1[_0x2a80('0x4f')]['name'],'fullname':_0x4653a1[_0x2a80('0x4f')][_0x2a80('0x50')],'email':_0x4653a1[_0x2a80('0x4f')][_0x2a80('0x51')]},'contact':_0x4653a1[_0x2a80('0x2d')]['contact'],'account':_0x4653a1['body']['account']};var _0x49cbeb={'rejectUnauthorized':![],'method':_0x2a80('0x52'),'url':_0x2a80('0x53'),'headers':{'X-APIKEY':_0x285df3[_0x2a80('0x4a')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4653a1[_0x2a80('0x4f')][_0x2a80('0x51')]],'buttons':null,'topic':_0x5732b9[_0x2a80('0x4c')],'note':_[_0x2a80('0x54')](_0x5732b9[_0x2a80('0x4d')])?null:getMustacheRender(_0x5732b9[_0x2a80('0x4d')],_0x5e354d),'metadata':null},'redirect':_0x2a80('0x55'),'json':!![]};try{if(!_['isNull'](_0x5732b9['vidaooMetadata'])){var _0x4bf632=getMustacheRender(_0x5732b9['vidaooMetadata'],_0x5e354d);var _0x269fc2=JSON[_0x2a80('0x56')](_0x4bf632);_0x49cbeb[_0x2a80('0x2d')][_0x2a80('0x57')]=_0x269fc2;}}catch(_0x4a938f){throw new db[(_0x2a80('0x58'))][(_0x2a80('0x59'))](_0x2a80('0x5a'));}return rp(_0x49cbeb);}else{throw new db[(_0x2a80('0x58'))][(_0x2a80('0x59'))]('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x15db2c){_0x2410ae=_0x15db2c;if(_0x2410ae['id']){var _0x4811da={'body':_0x2410ae['join_url'],'ChatWebsiteId':_0x5732b9['id'],'ChatInteractionId':_0x1e6ae8['id'],'direction':_0x2a80('0x5b'),'UserId':_0x4653a1[_0x2a80('0x4f')]['id']};return db[_0x2a80('0x5c')]['create'](_0x4811da,{});}else{throw new db[(_0x2a80('0x58'))][(_0x2a80('0x59'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x1e6ae8['updateAttributes']({'vidaooSessionId':_0x2410ae['id']});})['then'](respondWithResult(_0x5eb007,null))['catch'](handleError(_0x5eb007,null));};exports[_0x2a80('0x5d')]=function(_0x313fb1,_0x3022a1){if(_0x313fb1[_0x2a80('0x2d')]['id']){delete _0x313fb1['body']['id'];}return db[_0x2a80('0x34')][_0x2a80('0x43')]({'where':{'id':_0x313fb1[_0x2a80('0x45')]['id']},'include':[{'model':db[_0x2a80('0x5e')],'as':'Contact'}]})[_0x2a80('0x28')](handleEntityNotFound(_0x3022a1,null))[_0x2a80('0x28')](saveUpdates(_0x313fb1[_0x2a80('0x2d')],null))[_0x2a80('0x28')](respondWithResult(_0x3022a1,null))['catch'](handleError(_0x3022a1,null));};exports[_0x2a80('0x5f')]=function(_0x3fdd1c,_0x432284){if(_0x3fdd1c['body']['id']){delete _0x3fdd1c['body']['id'];}return db[_0x2a80('0x34')][_0x2a80('0x43')]({'where':{'id':_0x3fdd1c[_0x2a80('0x45')]['id']}})[_0x2a80('0x28')](function(_0x79a41c){if(!_0x79a41c){logger[_0x2a80('0x18')](_0x2a80('0x60'),_0x2a80('0x5f'),0x194,'entity\x20not\x20found');_0x432284['sendStatus'](0x194);}else{if(_0x79a41c['UserId']){throw new db[(_0x2a80('0x58'))][(_0x2a80('0x59'))]('Interaction\x20already\x20assigned');}}return _0x79a41c;})[_0x2a80('0x28')](function(_0xd37d00){if(_0xd37d00){return _0xd37d00[_0x2a80('0x26')]({'closed':_0x3fdd1c[_0x2a80('0x2d')][_0x2a80('0x61')],'disposition':_0x3fdd1c[_0x2a80('0x2d')]['disposition']})[_0x2a80('0x28')](function(_0x747ebe){return _0x747ebe;});}})[_0x2a80('0x28')](function(){return respondWithRpcPromise('AbandonInteraction',_0x2a80('0x5f'),_0x3fdd1c[_0x2a80('0x2d')],client9004);})[_0x2a80('0x28')](respondWithResult(_0x432284,null))['catch'](handleError(_0x432284,null));};exports[_0x2a80('0x62')]=function(_0x55a432,_0x1e9f02){_0x55a432[_0x2a80('0x2d')][_0x2a80('0x2b')]=_0x55a432[_0x2a80('0x63')][_0x2a80('0x64')];_0x55a432['body'][_0x2a80('0x65')]=_0x55a432['file']['filename'];_0x55a432[_0x2a80('0x2d')][_0x2a80('0x35')]=_0x55a432[_0x2a80('0x63')][_0x2a80('0x66')];return db[_0x2a80('0x67')][_0x2a80('0x44')](_0x55a432[_0x2a80('0x2d')])[_0x2a80('0x28')](respondWithResult(_0x1e9f02,0xc9))['catch'](handleError(_0x1e9f02,null));};exports['attachmentDownload']=function(_0x2b9c7e,_0x55b52a){return db[_0x2a80('0x34')]['findOne']({'where':{'id':_0x2b9c7e[_0x2a80('0x45')]['id']},'raw':!![]})[_0x2a80('0x28')](handleEntityNotFound(_0x55b52a,null))[_0x2a80('0x28')](function(_0x56968c){if(_0x56968c){if(_0x56968c[_0x2a80('0x61')]){return _0x55b52a['status'](0x193)[_0x2a80('0x1f')]({'status':0x193,'message':_0x2a80('0x68')});}return db['Attachment'][_0x2a80('0x48')]({'where':{'id':_0x2b9c7e[_0x2a80('0x38')][_0x2a80('0x69')]},'raw':!![]})['then'](handleEntityNotFound(_0x55b52a,null));}})['then'](function(_0x1363dd){if(_0x1363dd){var _0x28771d=_0x1363dd[_0x2a80('0x6a')]!==null;var _0x2dd35f=path[_0x2a80('0x6b')](config[_0x2a80('0x6c')],_0x2a80('0x6d'));if(_0x28771d){_0x2dd35f=path[_0x2a80('0x6b')](_0x2dd35f,_0x2a80('0x6e'));}var _0x170736=path['join'](_0x2dd35f,_0x1363dd['basename']);return _0x55b52a[_0x2a80('0x6f')](_0x170736);}})['catch'](handleError(_0x55b52a,null));};exports[_0x2a80('0x70')]=function(_0x2c843a,_0x4cdd96){var _0x5cb57b=null;var _0x24bd89=null;var _0x5d6511=null;if(_0x2c843a['body']['id']){delete _0x2c843a[_0x2a80('0x2d')]['id'];}if(_0x2c843a['body'][_0x2a80('0x71')]){_0x5d6511=path['join'](config['root'],'server/files/chat/upload/',util[_0x2a80('0x72')](_0x2a80('0x73'),Date['now']()));_0x2c843a[_0x2a80('0x2d')][_0x2a80('0x74')]=_0x5d6511;}return db['ChatInteraction'][_0x2a80('0x43')]({'where':{'id':_0x2c843a[_0x2a80('0x45')]['id']},'include':[{'model':db[_0x2a80('0x5c')],'as':_0x2a80('0x75'),'include':[{'model':db[_0x2a80('0x76')],'as':'User'}]}]})[_0x2a80('0x28')](handleEntityNotFound(_0x4cdd96,null))[_0x2a80('0x28')](saveUpdates(_0x2c843a[_0x2a80('0x2d')],null))[_0x2a80('0x28')](function(_0x3542fb){if(_0x3542fb){_0x5cb57b=_0x3542fb;return db[_0x2a80('0x77')][_0x2a80('0x43')]({'where':{'id':_0x5cb57b[_0x2a80('0x49')]}});}})[_0x2a80('0x28')](function(_0x499360){if(_0x499360){_0x24bd89=_0x499360;return db[_0x2a80('0x5e')][_0x2a80('0x43')]({'where':{'id':_0x5cb57b[_0x2a80('0x78')]}});}})[_0x2a80('0x28')](function(_0x2bdc5f){if(_0x2bdc5f){if(_0x5d6511){var _0x420c5a=null;for(var _0x327b83=0x1;_0x327b83<_0x5cb57b['Messages'][_0x2a80('0x41')];++_0x327b83){_0x420c5a=_0x5cb57b[_0x2a80('0x75')][_0x327b83];var _0x4e8382=_0x420c5a[_0x2a80('0x79')]?util['format'](_0x2a80('0x7a'),_0x24bd89[_0x2a80('0x7b')],_0x420c5a['UserId']):_0x2a80('0x7c');var _0x27f868=_0x2c843a[_0x2a80('0x2d')][_0x2a80('0x7d')]||util[_0x2a80('0x72')](_0x2a80('0x7a'),'Visitor',_0x420c5a[_0x2a80('0x78')]);switch(_0x24bd89[_0x2a80('0x7e')]){case _0x2a80('0x7f'):_0x4e8382=_0x420c5a[_0x2a80('0x79')]?util[_0x2a80('0x72')]('%s%d',_0x24bd89['agentAlias'],_0x420c5a[_0x2a80('0x79')]):_0x2a80('0x7c');break;case _0x2a80('0x80'):_0x4e8382=_0x420c5a[_0x2a80('0x79')]?_0x420c5a[_0x2a80('0x76')]['alias']||_0x420c5a[_0x2a80('0x76')]['fullname']:_0x2a80('0x7c');break;case'agent_fullname':_0x4e8382=_0x420c5a[_0x2a80('0x79')]?_0x420c5a[_0x2a80('0x76')]['fullname']:_0x2a80('0x7c');break;default:_0x4e8382=_0x420c5a[_0x2a80('0x79')]?util['format'](_0x2a80('0x7a'),_0x24bd89[_0x2a80('0x7b')],_0x420c5a[_0x2a80('0x79')]):_0x2a80('0x7c');}var _0x511070=util[_0x2a80('0x72')](_0x2a80('0x81'),moment(_0x420c5a[_0x2a80('0x82')])[_0x2a80('0x72')](_0x2a80('0x83')),_0x420c5a['direction']==='in'?_0x27f868:_0x4e8382,_0x420c5a[_0x2a80('0x2d')]);if(!_0x420c5a['secret']){fs[_0x2a80('0x84')](_0x5d6511,_0x511070);}}return db[_0x2a80('0x85')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x2a80('0x86'),'raw':!![],'include':[{'model':db[_0x2a80('0x87')],'as':'CloudProvider','raw':!![]}]}]});}}})['then'](function(_0x41370e){if(!_0x41370e||!_0x41370e[_0x2a80('0x86')]||!_0x2c843a[_0x2a80('0x2d')])return _0x5cb57b;var _0x10d27d=_0x41370e[_0x2a80('0x88')]();return respondWithRpcPromise(_0x2a80('0x89'),_0x2a80('0x8a'),{'account':_0x10d27d,'message':{'from':util[_0x2a80('0x72')](_0x2a80('0x8b'),_0x41370e[_0x2a80('0x2b')],_0x41370e[_0x2a80('0x51')]||_0x41370e[_0x2a80('0x86')][_0x2a80('0x4f')]),'to':_0x2c843a[_0x2a80('0x2d')]['mailTranscript'],'subject':_0x2a80('0x8c'),'text':util[_0x2a80('0x72')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x2c843a['body'][_0x2a80('0x71')]),'attachments':[{'path':_0x5d6511}]}})[_0x2a80('0x28')](function(){return _0x5cb57b;})[_0x2a80('0x1c')](function(_0x265256){logger['error'](_0x265256);});})['then'](respondWithStatusCode(_0x4cdd96,0xc8))[_0x2a80('0x1c')](handleError(_0x4cdd96,null));};exports[_0x2a80('0x8d')]=function(_0x569a43,_0x1d5f6f){return db[_0x2a80('0x5c')][_0x2a80('0x43')]({'where':{'id':_0x569a43['params']['id']}})[_0x2a80('0x28')](handleEntityNotFound(_0x1d5f6f,null))[_0x2a80('0x28')](function(_0x840be0){if(_0x840be0){return _0x840be0['addMessage'](_0x569a43['body']['ids'],_[_0x2a80('0x8e')](_0x569a43[_0x2a80('0x2d')],[_0x2a80('0x8f'),'id'])||{});}})['then'](respondWithResult(_0x1d5f6f,null))['catch'](handleError(_0x1d5f6f,null));};exports['getMessages']=function(_0x2f851c,_0x52e202){var _0x2633bd={'raw':![],'where':{}};var _0x36bc88={};var _0x54b6a5={'count':0x0,'rows':[]};return db[_0x2a80('0x34')]['findOne']({'where':{'id':_0x2f851c[_0x2a80('0x45')]['id']}})[_0x2a80('0x28')](handleEntityNotFound(_0x52e202,null))[_0x2a80('0x28')](function(_0x17dae5){if(_0x17dae5){_0x36bc88[_0x2a80('0x3a')]=_[_0x2a80('0x3b')](db['ChatMessage']['rawAttributes']);_0x36bc88[_0x2a80('0x38')]=_[_0x2a80('0x3b')](_0x2f851c['query']);_0x36bc88[_0x2a80('0x3d')]=_[_0x2a80('0x3e')](_0x36bc88[_0x2a80('0x3a')],_0x36bc88[_0x2a80('0x38')]);_0x2633bd[_0x2a80('0x3f')]=_[_0x2a80('0x3e')](_0x36bc88['model'],qs[_0x2a80('0x40')](_0x2f851c['query'][_0x2a80('0x40')]));_0x2633bd['attributes']=_0x2633bd[_0x2a80('0x3f')][_0x2a80('0x41')]?_0x2633bd[_0x2a80('0x3f')]:_0x36bc88[_0x2a80('0x3a')];if(!_0x2f851c[_0x2a80('0x38')]['hasOwnProperty']('nolimit')){_0x2633bd[_0x2a80('0x22')]=qs[_0x2a80('0x22')](_0x2f851c[_0x2a80('0x38')][_0x2a80('0x22')]);_0x2633bd[_0x2a80('0x20')]=qs[_0x2a80('0x20')](_0x2f851c[_0x2a80('0x38')][_0x2a80('0x20')]);}_0x2633bd[_0x2a80('0x90')]=qs[_0x2a80('0x91')](_0x2f851c[_0x2a80('0x38')][_0x2a80('0x91')]);_0x2633bd['where']=qs[_0x2a80('0x3d')](_['pick'](_0x2f851c['query'],_0x36bc88['filters']));_0x2633bd[_0x2a80('0x92')][_0x2a80('0x93')]=_0x17dae5['id'];if(_0x2f851c['query'][_0x2a80('0x94')]){_0x2633bd[_0x2a80('0x92')]=_[_0x2a80('0x95')](_0x2633bd[_0x2a80('0x92')],{'$or':_['map'](_0x2633bd[_0x2a80('0x3f')],function(_0x2aae8c){var _0x7d2b18={};_0x7d2b18[_0x2aae8c]={'$like':'%'+_0x2f851c[_0x2a80('0x38')][_0x2a80('0x94')]+'%'};return _0x7d2b18;})});}if(_0x2f851c[_0x2a80('0x38')]['$gte']){var _0x33d5d=_0x2f851c['query'][_0x2a80('0x96')][_0x2a80('0x97')](',');var _0x5e007f={};_0x5e007f[_0x33d5d[0x0]]={'$gte':moment(_0x33d5d[0x1])[_0x2a80('0x72')](_0x2a80('0x98'))};_0x2633bd[_0x2a80('0x92')]=_[_0x2a80('0x95')](_0x2633bd['where'],_0x5e007f);}_0x2633bd=_[_0x2a80('0x95')]({},_0x2633bd,_0x2f851c[_0x2a80('0x99')]);return db[_0x2a80('0x5c')][_0x2a80('0x23')]({'where':_0x2633bd[_0x2a80('0x92')]})[_0x2a80('0x28')](function(_0x342a29){_0x54b6a5[_0x2a80('0x23')]=_0x342a29;if(_0x2f851c[_0x2a80('0x38')][_0x2a80('0x42')]){_0x2633bd[_0x2a80('0x9a')]=[{'all':!![]}];}return db[_0x2a80('0x5c')]['findAll'](_0x2633bd);})[_0x2a80('0x28')](function(_0x19ccee){_0x54b6a5[_0x2a80('0x9b')]=_0x19ccee;return _0x54b6a5;});}})[_0x2a80('0x28')](respondWithFilteredResult(_0x52e202,_0x2633bd))[_0x2a80('0x1c')](handleError(_0x52e202,null));};exports[_0x2a80('0x9c')]=function(_0x5a218c,_0x4be3ec){var _0x58da3a={'where':{}},_0x2abf5c={},_0x2b40cc={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x2a80('0x48')]({'where':{'id':_0x5a218c[_0x2a80('0x45')]['id']}})[_0x2a80('0x28')](handleEntityNotFound(_0x4be3ec,null))[_0x2a80('0x28')](function(_0x34ee72){if(_0x34ee72){_0x2abf5c['model']=_[_0x2a80('0x3b')](db[_0x2a80('0x5c')]['rawAttributes']);_0x2abf5c['query']=_[_0x2a80('0x3b')](_0x5a218c[_0x2a80('0x38')]);_0x2abf5c[_0x2a80('0x3d')]=_['intersection'](_0x2abf5c[_0x2a80('0x3a')],_0x2abf5c['query']);_0x58da3a[_0x2a80('0x3f')]=_[_0x2a80('0x3e')](_0x2abf5c[_0x2a80('0x3a')],qs['fields'](_0x5a218c[_0x2a80('0x38')][_0x2a80('0x40')]));_0x58da3a['attributes']=_0x58da3a['attributes'][_0x2a80('0x41')]?_0x58da3a[_0x2a80('0x3f')]:_0x2abf5c[_0x2a80('0x3a')];if(!_0x5a218c['query'][_0x2a80('0x9d')]('nolimit')){_0x58da3a[_0x2a80('0x22')]=qs[_0x2a80('0x22')](_0x5a218c[_0x2a80('0x38')][_0x2a80('0x22')]);_0x58da3a[_0x2a80('0x20')]=qs['offset'](_0x5a218c['query']['offset']);}_0x58da3a[_0x2a80('0x90')]=qs['sort'](_0x5a218c[_0x2a80('0x38')]['sort']);_0x58da3a[_0x2a80('0x92')]=qs[_0x2a80('0x3d')](_['pick'](_0x5a218c[_0x2a80('0x38')],_0x2abf5c['filters']));_0x58da3a['where'][_0x2a80('0x93')]=_0x34ee72['id'];if(_0x5a218c[_0x2a80('0x38')][_0x2a80('0x94')]){_0x58da3a[_0x2a80('0x92')]=_['merge'](_0x58da3a[_0x2a80('0x92')],{'$or':_[_0x2a80('0x33')](_0x58da3a[_0x2a80('0x3f')],function(_0x3a4a2c){var _0xe73cf3={};_0xe73cf3[_0x3a4a2c]={'$like':'%'+_0x5a218c['query']['filter']+'%'};return _0xe73cf3;})});}_0x58da3a[_0x2a80('0x92')][_0x2a80('0x9e')]=![];if(_0x5a218c[_0x2a80('0x38')]['id']){_0x58da3a['where']['id']={'$gt':_0x5a218c[_0x2a80('0x38')]['id']};}_0x58da3a=_[_0x2a80('0x95')]({},_0x58da3a,_0x5a218c[_0x2a80('0x99')]);return db[_0x2a80('0x5c')][_0x2a80('0x23')]({'where':_0x58da3a[_0x2a80('0x92')]})[_0x2a80('0x28')](function(_0x21a697){_0x2b40cc[_0x2a80('0x23')]=_0x21a697;_0x58da3a[_0x2a80('0x9a')]=[];if(_0x5a218c[_0x2a80('0x38')][_0x2a80('0x9f')]){_0x58da3a[_0x2a80('0x9a')]['push']({'model':db['User'],'as':_0x2a80('0x76'),'attributes':['id',_0x2a80('0x50'),_0x2a80('0xa0')]});}if(_0x5a218c[_0x2a80('0x38')][_0x2a80('0x42')]){_0x58da3a['include']=[{'all':!![]}];}return db[_0x2a80('0x5c')][_0x2a80('0xa1')](_0x58da3a);})[_0x2a80('0x28')](function(_0x5afebe){_0x2b40cc[_0x2a80('0x9b')]=_0x5afebe;return _0x2b40cc;});}})[_0x2a80('0x28')](respondWithFilteredResult(_0x4be3ec,_0x58da3a))['catch'](handleError(_0x4be3ec,null));};exports[_0x2a80('0xa2')]=function(_0x69bc1d,_0xdbac0d){return db[_0x2a80('0x34')][_0x2a80('0x43')]({'where':{'id':_0x69bc1d['params']['id']}})['then'](handleEntityNotFound(_0xdbac0d,null))[_0x2a80('0x28')](function(_0x3e0595){if(_0x3e0595){return _0x3e0595[_0x2a80('0xa3')](_0x69bc1d[_0x2a80('0x2d')]['ids'],_[_0x2a80('0x8e')](_0x69bc1d[_0x2a80('0x2d')],[_0x2a80('0x8f'),'id'])||{})[_0x2a80('0xa4')](function(){return db[_0x2a80('0xa5')][_0x2a80('0xa1')]({'attributes':['id',_0x2a80('0x2b'),_0x2a80('0xa6')],'where':{'id':_0x69bc1d[_0x2a80('0x2d')]['ids']}});})[_0x2a80('0x28')](function(_0x513eec){socket[_0x2a80('0xa7')](_0x2a80('0xa8'),{'id':Number(_0x69bc1d[_0x2a80('0x45')]['id']),'tags':_0x513eec||[]});return{'id':Number(_0x69bc1d['params']['id']),'tags':_0x513eec||[]};});}})[_0x2a80('0x28')](respondWithResult(_0xdbac0d,null))[_0x2a80('0x1c')](handleError(_0xdbac0d,null));};exports[_0x2a80('0xa9')]=function(_0x52a402,_0x4da365){return db['ChatInteraction'][_0x2a80('0x43')]({'where':{'id':_0x52a402[_0x2a80('0x45')]['id']}})[_0x2a80('0x28')](handleEntityNotFound(_0x4da365,null))[_0x2a80('0x28')](function(_0x412093){if(_0x412093){return _0x412093[_0x2a80('0xa9')](_0x52a402[_0x2a80('0x38')]['ids']);}})[_0x2a80('0x28')](respondWithStatusCode(_0x4da365,null))[_0x2a80('0x1c')](handleError(_0x4da365,null));};exports[_0x2a80('0x6f')]=function(_0x59db0d,_0x2afa41){var _0x503f3d=moment()[_0x2a80('0xaa')]()[_0x2a80('0xab')]();var _0x69ffab=path[_0x2a80('0x6b')](config[_0x2a80('0x6c')],'server','files',_0x2a80('0xac'));var _0x111dfe=path[_0x2a80('0x6b')](config[_0x2a80('0x6c')],_0x2a80('0xad'),_0x2a80('0xae'),_0x2a80('0xaf'));var _0x988ee3=path['join'](_0x69ffab,_0x503f3d);var _0xa7224b=util[_0x2a80('0x72')](_0x2a80('0xb0'),_0x59db0d[_0x2a80('0x45')]['id'],_0x503f3d);var _0x46d2e2=path[_0x2a80('0x6b')](_0x69ffab,_0xa7224b);var _0x28002a=[];_0x28002a['push']({'model':db[_0x2a80('0x76')],'as':_0x2a80('0x76'),'attributes':['id','fullname'],'raw':!![]});_0x28002a[_0x2a80('0xb1')]({'model':db[_0x2a80('0x5e')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x59db0d['query'][_0x2a80('0xaf')]){_0x28002a[_0x2a80('0xb1')]({'model':db[_0x2a80('0x67')],'as':_0x2a80('0x67'),'raw':!![]});}var _0x3bc1fd=[{'model':db[_0x2a80('0x5c')],'as':_0x2a80('0x75'),'attributes':['id',_0x2a80('0x2d'),_0x2a80('0x82'),_0x2a80('0xb2'),'secret','read'],'include':_0x28002a}];_0x3bc1fd[_0x2a80('0xb1')]({'model':db[_0x2a80('0x77')],'as':_0x2a80('0xb3'),'attributes':['id',_0x2a80('0x2b')]});_0x3bc1fd[_0x2a80('0xb1')]({'model':db[_0x2a80('0x76')],'as':_0x2a80('0xb4'),'attributes':['id',_0x2a80('0x50')]});return db[_0x2a80('0x34')][_0x2a80('0x43')]({'where':{'id':_0x59db0d[_0x2a80('0x45')]['id']},'include':_0x3bc1fd})[_0x2a80('0x28')](handleEntityNotFound(_0x2afa41,null))[_0x2a80('0x28')](function(_0x5ddf5c){if(_0x5ddf5c){var _0x4cc4ec=_0x5ddf5c[_0x2a80('0xb5')]({'plain':!![]});fs[_0x2a80('0xb6')](_0x988ee3);var _0x5d6ff2={'channel':_0x2a80('0xb7'),'account':_0x4cc4ec[_0x2a80('0xb3')][_0x2a80('0x2b')],'agent':_0x4cc4ec[_0x2a80('0xb4')]?_0x4cc4ec[_0x2a80('0xb4')][_0x2a80('0x50')]:_0x2a80('0xb8'),'createdAt':moment(_0x4cc4ec[_0x2a80('0x82')])[_0x2a80('0x72')](_0x2a80('0x98'))['toString'](),'closedAt':_0x4cc4ec[_0x2a80('0x61')]?moment(_0x4cc4ec[_0x2a80('0xb9')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x4cc4ec[_0x2a80('0xba')],'chatInfo':{'browser':_0x4cc4ec['browserName'],'os':_0x4cc4ec['osName'],'referer':_0x4cc4ec['referer'],'customerIp':_0x4cc4ec[_0x2a80('0xbb')],'customerPort':_0x4cc4ec[_0x2a80('0xbc')]?_0x4cc4ec[_0x2a80('0xbc')]:'N.A.'},'messages':_(_0x4cc4ec[_0x2a80('0x75')])[_0x2a80('0xbd')]()['filter']({'secret':![]})[_0x2a80('0x33')](function(_0x3ec931){if(_0x3ec931[_0x2a80('0x67')]){var _0x1c5251=path[_0x2a80('0x6b')](_0x111dfe,_0x3ec931[_0x2a80('0x67')][_0x2a80('0x65')]);if(fs[_0x2a80('0xbe')](_0x1c5251)){fs[_0x2a80('0xbf')](_0x1c5251)[_0x2a80('0xc0')](fs[_0x2a80('0xc1')](path[_0x2a80('0x6b')](_0x988ee3,_0x3ec931['Attachment']['basename'])));}}return{'date':moment(_0x3ec931[_0x2a80('0x82')])[_0x2a80('0x72')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x3ec931['direction']===_0x2a80('0x5b')?_0x3ec931[_0x2a80('0x76')]?_0x3ec931[_0x2a80('0x76')][_0x2a80('0x50')]:_0x2a80('0x7c'):_0x3ec931[_0x2a80('0xc2')][_0x2a80('0xc3')]+(_0x3ec931[_0x2a80('0xc2')][_0x2a80('0xc4')]?'\x20'+_0x3ec931[_0x2a80('0xc2')]['lastName']:''),'body':_0x3ec931[_0x2a80('0x67')]?_0x3ec931[_0x2a80('0x67')][_0x2a80('0x65')]:_0x3ec931[_0x2a80('0x2d')],'direction':_0x3ec931[_0x2a80('0xb2')]===_0x2a80('0x5b')?'A':'C','secret':_0x3ec931['secret'],'read':_0x3ec931[_0x2a80('0xc5')],'attachment':_0x3ec931[_0x2a80('0x67')]};})[_0x2a80('0xc6')]()};return ejs['renderFile'](path[_0x2a80('0x6b')](config[_0x2a80('0x6c')],_0x2a80('0xad'),_0x2a80('0xc7'),_0x2a80('0xc8')),{'interaction':_0x5d6ff2})[_0x2a80('0x28')](function(_0x442201){var _0x5374e9=path[_0x2a80('0x6b')](_0x988ee3,_0x2a80('0xc9')+_0x4cc4ec['id']+'-'+_0x503f3d+_0x2a80('0xca'));var _0x15dc02={'path':_0x5374e9,'channel':_0x2a80('0xb7'),'interactionId':_0x4cc4ec['id']};return pdf[_0x2a80('0xcb')](_0x442201,_0x15dc02);})[_0x2a80('0x28')](function(){return new Promise(function(_0x1f9bf8,_0x3bd597){zipdir(_0x988ee3,{'saveTo':_0x46d2e2},function(_0x51ecb2,_0x4e524c){if(_0x51ecb2)return _0x3bd597(_0x51ecb2);return _0x1f9bf8(_0x4e524c);});})[_0x2a80('0x28')](function(){return new BPromise(function(_0x13a087,_0x1f77e2){rimraf(_0x988ee3,function(_0x3569d3){if(_0x3569d3)_0x1f77e2(_0x3569d3);return _0x13a087();});});})[_0x2a80('0x28')](function(){return _0x2afa41[_0x2a80('0x6f')](_0x46d2e2,_0xa7224b,function(_0x586217){if(_0x586217){logger[_0x2a80('0x18')](_0x2a80('0xcc'),_0x586217);}else{fs['unlinkSync'](_0x46d2e2);}});});});}else{return _0x2afa41[_0x2a80('0x1d')](0xc8);}})[_0x2a80('0x1c')](handleError(_0x2afa41,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index eee7c3c..daee97d 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 _0xc266=['save','update','remove','then','setDataValue','unreadMessages','emit','hasOwnProperty','hook','exports','events','ChatInteraction','ChatMessage','setMaxListeners'];(function(_0xf9ca80,_0x2f344e){var _0x18b397=function(_0x4e5d5a){while(--_0x4e5d5a){_0xf9ca80['push'](_0xf9ca80['shift']());}};_0x18b397(++_0x2f344e);}(_0xc266,0xce));var _0x6c26=function(_0x36de9b,_0x5b9e9c){_0x36de9b=_0x36de9b-0x0;var _0x4baf2f=_0xc266[_0x36de9b];return _0x4baf2f;};'use strict';var EventEmitter=require(_0x6c26('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x6c26('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0x6c26('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x6c26('0x3')](0x0);var events={'afterCreate':_0x6c26('0x4'),'afterUpdate':_0x6c26('0x5'),'afterDestroy':_0x6c26('0x6')};function emitEvent(_0x1bbcbd){return function(_0x430ad5,_0x5409a9,_0x2a1c36){_0x430ad5['getUsers']({'attributes':['id'],'raw':!![]})[_0x6c26('0x7')](function(_0x491745){_0x430ad5[_0x6c26('0x8')]('Users',_0x491745['map'](function(_0x23f2f6){return{'id':_0x23f2f6['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x430ad5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x589d92){_0x430ad5[_0x6c26('0x8')](_0x6c26('0x9'),_0x589d92['length']);ChatInteractionEvents[_0x6c26('0xa')](_0x1bbcbd+':'+_0x430ad5['id'],_0x430ad5);ChatInteractionEvents[_0x6c26('0xa')](_0x1bbcbd,_0x430ad5);_0x2a1c36(null);})['catch'](_0x2a1c36(null));};}for(var e in events){if(events[_0x6c26('0xb')](e)){var event=events[e];ChatInteraction[_0x6c26('0xc')](e,emitEvent(event));}}module[_0x6c26('0xd')]=ChatInteractionEvents; \ No newline at end of file +var _0x8b9b=['emit','hook','../../mysqldb','ChatInteraction','ChatMessage','save','update','then','setDataValue','map','findAll','unreadMessages','length'];(function(_0x14b72e,_0x3420ef){var _0x38fc95=function(_0x3a9c49){while(--_0x3a9c49){_0x14b72e['push'](_0x14b72e['shift']());}};_0x38fc95(++_0x3420ef);}(_0x8b9b,0x13a));var _0xb8b9=function(_0x31edbe,_0x34d231){_0x31edbe=_0x31edbe-0x0;var _0x37fcee=_0x8b9b[_0x31edbe];return _0x37fcee;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xb8b9('0x0'))['db'][_0xb8b9('0x1')];var ChatMessage=require(_0xb8b9('0x0'))['db'][_0xb8b9('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb8b9('0x3'),'afterUpdate':_0xb8b9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2fae47){return function(_0x294d8a,_0x581e0a,_0x365739){_0x294d8a['getUsers']({'attributes':['id'],'raw':!![]})[_0xb8b9('0x5')](function(_0x281aca){_0x294d8a[_0xb8b9('0x6')]('Users',_0x281aca[_0xb8b9('0x7')](function(_0x3cae41){return{'id':_0x3cae41['id']};}));return ChatMessage[_0xb8b9('0x8')]({'where':{'ChatInteractionId':_0x294d8a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb8b9('0x5')](function(_0x3c5383){_0x294d8a['setDataValue'](_0xb8b9('0x9'),_0x3c5383[_0xb8b9('0xa')]);ChatInteractionEvents[_0xb8b9('0xb')](_0x2fae47+':'+_0x294d8a['id'],_0x294d8a);ChatInteractionEvents[_0xb8b9('0xb')](_0x2fae47,_0x294d8a);_0x365739(null);})['catch'](_0x365739(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xb8b9('0xc')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index b32d101..e6023e9 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 _0xdc5b=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction'];(function(_0x5e44b2,_0x6e4873){var _0x268aa2=function(_0x55b3b0){while(--_0x55b3b0){_0x5e44b2['push'](_0x5e44b2['shift']());}};_0x268aa2(++_0x6e4873);}(_0xdc5b,0x14a));var _0xbdc5=function(_0x177515,_0x36b8bb){_0x177515=_0x177515-0x0;var _0xffbab4=_0xdc5b[_0x177515];return _0xffbab4;};'use strict';var _=require(_0xbdc5('0x0'));var util=require(_0xbdc5('0x1'));var logger=require(_0xbdc5('0x2'))(_0xbdc5('0x3'));var moment=require(_0xbdc5('0x4'));var BPromise=require(_0xbdc5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbdc5('0x6'));var rimraf=require('rimraf');var config=require(_0xbdc5('0x7'));var attributes=require(_0xbdc5('0x8'));module[_0xbdc5('0x9')]=function(_0x147327,_0x122fdb){return _0x147327[_0xbdc5('0xa')](_0xbdc5('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3a3d23,_0x51404c,_0x3ca856){if(_0x3a3d23[_0xbdc5('0xc')](_0xbdc5('0xd'))){_0x3a3d23[_0xbdc5('0xe')]=moment()['format'](_0xbdc5('0xf'));}_0x3ca856(null,_0x3a3d23);}},'charset':_0xbdc5('0x10'),'collate':_0xbdc5('0x11')});}; \ No newline at end of file +var _0x7ce9=['define','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','api','path','rimraf','../../config/environment','./chatInteraction.attributes','exports'];(function(_0x1155d7,_0x1cc6dd){var _0x5c2d4f=function(_0x437cac){while(--_0x437cac){_0x1155d7['push'](_0x1155d7['shift']());}};_0x5c2d4f(++_0x1cc6dd);}(_0x7ce9,0xd8));var _0x97ce=function(_0x21bad5,_0x23a39d){_0x21bad5=_0x21bad5-0x0;var _0x235106=_0x7ce9[_0x21bad5];return _0x235106;};'use strict';var _=require(_0x97ce('0x0'));var util=require(_0x97ce('0x1'));var logger=require('../../config/logger')(_0x97ce('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x97ce('0x3'));var rimraf=require(_0x97ce('0x4'));var config=require(_0x97ce('0x5'));var attributes=require(_0x97ce('0x6'));module[_0x97ce('0x7')]=function(_0x3f37b9,_0x1894ec){return _0x3f37b9[_0x97ce('0x8')](_0x97ce('0x9'),attributes,{'tableName':_0x97ce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x24f548,_0xfa20e0,_0x344fc7){if(_0x24f548[_0x97ce('0xb')](_0x97ce('0xc'))){_0x24f548['closedAt']=moment()[_0x97ce('0xd')](_0x97ce('0xe'));}_0x344fc7(null,_0x24f548);}},'charset':'utf8mb4','collate':_0x97ce('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 38e40f2..90889b8 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 _0x0ec9=['ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToChatInteraction','find','addTags','ids','omit','AddTags','catch','lodash','util','moment'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x0ec9,0x78));var _0x90ec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0ec9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x90ec('0x0'));var util=require(_0x90ec('0x1'));var moment=require(_0x90ec('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x90ec('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x90ec('0x4'));var config=require(_0x90ec('0x5'));var jayson=require(_0x90ec('0x6'));var client=jayson[_0x90ec('0x7')][_0x90ec('0x8')]({'port':0x232a});config[_0x90ec('0x9')]=_['defaults'](config[_0x90ec('0x9')],{'host':_0x90ec('0xa'),'port':0x18eb});var socket=require(_0x90ec('0xb'))(new Redis(config['redis']));require(_0x90ec('0xc'))[_0x90ec('0xd')](socket);function respondWithRpcPromise(_0x468339,_0x12f68f,_0x58d570){return new BPromise(function(_0x292b97,_0x1fa513){return client[_0x90ec('0xe')](_0x468339,_0x58d570)[_0x90ec('0xf')](function(_0x55c815){logger[_0x90ec('0x10')](_0x90ec('0x11'),_0x12f68f,_0x90ec('0x12'));logger[_0x90ec('0x13')](_0x90ec('0x14'),_0x12f68f,_0x90ec('0x12'),JSON['stringify'](_0x55c815));if(_0x55c815[_0x90ec('0x15')]){if(_0x55c815['error']['code']===0x1f4){logger[_0x90ec('0x15')](_0x90ec('0x11'),_0x12f68f,_0x55c815['error'][_0x90ec('0x16')]);return _0x1fa513(_0x55c815[_0x90ec('0x15')][_0x90ec('0x16')]);}logger[_0x90ec('0x15')](_0x90ec('0x11'),_0x12f68f,_0x55c815['error'][_0x90ec('0x16')]);return _0x292b97(_0x55c815[_0x90ec('0x15')][_0x90ec('0x16')]);}else{logger[_0x90ec('0x10')](_0x90ec('0x11'),_0x12f68f,'request\x20sent');_0x292b97(_0x55c815[_0x90ec('0x17')][_0x90ec('0x16')]);}})['catch'](function(_0x29e2da){logger[_0x90ec('0x15')](_0x90ec('0x11'),_0x12f68f,_0x29e2da);_0x1fa513(_0x29e2da);});});}exports[_0x90ec('0x18')]=function(_0xe57b9a){var _0x295d55=this;return new Promise(function(_0x5eb9b1,_0x3c8ef4){return db[_0x90ec('0x19')][_0x90ec('0x1a')](_0xe57b9a[_0x90ec('0x1b')],{'raw':_0xe57b9a['options']?_0xe57b9a[_0x90ec('0x1c')][_0x90ec('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe57b9a[_0x90ec('0x1c')]?_0xe57b9a[_0x90ec('0x1c')][_0x90ec('0x1e')]||null:null,'attributes':_0xe57b9a[_0x90ec('0x1c')]?_0xe57b9a[_0x90ec('0x1c')][_0x90ec('0x1f')]||null:null,'limit':_0xe57b9a[_0x90ec('0x1c')]?_0xe57b9a['options'][_0x90ec('0x20')]||null:null})[_0x90ec('0xf')](function(_0x3a91b1){logger['info'](_0x90ec('0x18'),_0xe57b9a);logger[_0x90ec('0x13')](_0x90ec('0x18'),_0xe57b9a,JSON[_0x90ec('0x21')](_0x3a91b1));_0x5eb9b1(_0x3a91b1);})['catch'](function(_0x16dd31){logger[_0x90ec('0x15')](_0x90ec('0x18'),_0x16dd31[_0x90ec('0x16')],_0xe57b9a);_0x3c8ef4(_0x295d55[_0x90ec('0x15')](0x1f4,_0x16dd31[_0x90ec('0x16')]));});});};exports[_0x90ec('0x22')]=function(_0x5ce21d){return new Promise(function(_0x21e09b,_0x2dc0d7){return db['ChatInteraction'][_0x90ec('0x23')]({'where':_0x5ce21d[_0x90ec('0x1c')]?_0x5ce21d[_0x90ec('0x1c')][_0x90ec('0x1e')]||null:null})['then'](function(_0x2f7e67){if(_0x2f7e67){return _0x2f7e67[_0x90ec('0x24')](_0x5ce21d[_0x90ec('0x1b')][_0x90ec('0x25')],_[_0x90ec('0x26')](_0x5ce21d[_0x90ec('0x1b')],[_0x90ec('0x25'),'id'])||{});}})['spread'](function(_0x2638fd){logger['info']('AddTags',_0x5ce21d);logger[_0x90ec('0x13')](_0x90ec('0x27'),_0x5ce21d,JSON[_0x90ec('0x21')](_0x2638fd));_0x21e09b(_0x2638fd);})[_0x90ec('0x28')](function(_0x3a9eb3){logger[_0x90ec('0x15')](_0x90ec('0x27'),_0x3a9eb3['message'],_0x5ce21d);_0x2dc0d7(_this['error'](0x1f4,_0x3a9eb3[_0x90ec('0x16')]));});});}; \ No newline at end of file +var _0x0b76=['spread','AddTags','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','ChatInteraction','update','raw','where','attributes','options','UpdateChatInteraction','stringify','catch','AddTagsToChatInteraction','find','omit','body','ids'];(function(_0x33d22b,_0x30364b){var _0x2abcd5=function(_0x5d14da){while(--_0x5d14da){_0x33d22b['push'](_0x33d22b['shift']());}};_0x2abcd5(++_0x30364b);}(_0x0b76,0x1d6));var _0x60b7=function(_0x14682b,_0x32aa32){_0x14682b=_0x14682b-0x0;var _0x1fa061=_0x0b76[_0x14682b];return _0x1fa061;};'use strict';var _=require(_0x60b7('0x0'));var util=require(_0x60b7('0x1'));var moment=require(_0x60b7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x60b7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x60b7('0x4'));var logger=require(_0x60b7('0x5'))('rpc');var config=require(_0x60b7('0x6'));var jayson=require(_0x60b7('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x60b7('0x8')]=_[_0x60b7('0x9')](config[_0x60b7('0x8')],{'host':_0x60b7('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x60b7('0x8')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x227b65,_0x2298a7,_0x2b9e56){return new BPromise(function(_0xff0a07,_0xc371e8){return client[_0x60b7('0xb')](_0x227b65,_0x2b9e56)[_0x60b7('0xc')](function(_0x56ab71){logger['info'](_0x60b7('0xd'),_0x2298a7,_0x60b7('0xe'));logger[_0x60b7('0xf')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2298a7,'request\x20sent',JSON['stringify'](_0x56ab71));if(_0x56ab71['error']){if(_0x56ab71[_0x60b7('0x10')][_0x60b7('0x11')]===0x1f4){logger[_0x60b7('0x10')](_0x60b7('0xd'),_0x2298a7,_0x56ab71[_0x60b7('0x10')][_0x60b7('0x12')]);return _0xc371e8(_0x56ab71[_0x60b7('0x10')]['message']);}logger[_0x60b7('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x2298a7,_0x56ab71[_0x60b7('0x10')][_0x60b7('0x12')]);return _0xff0a07(_0x56ab71[_0x60b7('0x10')][_0x60b7('0x12')]);}else{logger['info'](_0x60b7('0xd'),_0x2298a7,_0x60b7('0xe'));_0xff0a07(_0x56ab71[_0x60b7('0x13')][_0x60b7('0x12')]);}})['catch'](function(_0x3414f3){logger[_0x60b7('0x10')](_0x60b7('0xd'),_0x2298a7,_0x3414f3);_0xc371e8(_0x3414f3);});});}exports['UpdateChatInteraction']=function(_0xc0f31){var _0x46a176=this;return new Promise(function(_0x1b59e7,_0x537605){return db[_0x60b7('0x14')][_0x60b7('0x15')](_0xc0f31['body'],{'raw':_0xc0f31['options']?_0xc0f31['options'][_0x60b7('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc0f31['options']?_0xc0f31['options'][_0x60b7('0x17')]||null:null,'attributes':_0xc0f31['options']?_0xc0f31['options'][_0x60b7('0x18')]||null:null,'limit':_0xc0f31[_0x60b7('0x19')]?_0xc0f31[_0x60b7('0x19')]['limit']||null:null})[_0x60b7('0xc')](function(_0x1bdd64){logger['info'](_0x60b7('0x1a'),_0xc0f31);logger[_0x60b7('0xf')](_0x60b7('0x1a'),_0xc0f31,JSON[_0x60b7('0x1b')](_0x1bdd64));_0x1b59e7(_0x1bdd64);})[_0x60b7('0x1c')](function(_0x41a00b){logger[_0x60b7('0x10')](_0x60b7('0x1a'),_0x41a00b[_0x60b7('0x12')],_0xc0f31);_0x537605(_0x46a176[_0x60b7('0x10')](0x1f4,_0x41a00b[_0x60b7('0x12')]));});});};exports[_0x60b7('0x1d')]=function(_0x4aa7b4){return new Promise(function(_0x54a446,_0x522963){return db[_0x60b7('0x14')][_0x60b7('0x1e')]({'where':_0x4aa7b4[_0x60b7('0x19')]?_0x4aa7b4[_0x60b7('0x19')]['where']||null:null})[_0x60b7('0xc')](function(_0xce1570){if(_0xce1570){return _0xce1570['addTags'](_0x4aa7b4['body']['ids'],_[_0x60b7('0x1f')](_0x4aa7b4[_0x60b7('0x20')],[_0x60b7('0x21'),'id'])||{});}})[_0x60b7('0x22')](function(_0x1cb9bf){logger['info']('AddTags',_0x4aa7b4);logger[_0x60b7('0xf')](_0x60b7('0x23'),_0x4aa7b4,JSON['stringify'](_0x1cb9bf));_0x54a446(_0x1cb9bf);})['catch'](function(_0x2a5af0){logger['error']('AddTags',_0x2a5af0[_0x60b7('0x12')],_0x4aa7b4);_0x522963(_this[_0x60b7('0x10')](0x1f4,_0x2a5af0['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 87519c4..864cce1 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 _0x06fb=['save','remove','update','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x44d0ae,_0x5448c1){var _0x1eb8ef=function(_0x5a31de){while(--_0x5a31de){_0x44d0ae['push'](_0x44d0ae['shift']());}};_0x1eb8ef(++_0x5448c1);}(_0x06fb,0xe9));var _0xb06f=function(_0x14bd32,_0x3ef7af){_0x14bd32=_0x14bd32-0x0;var _0x2dd6cb=_0x06fb[_0x14bd32];return _0x2dd6cb;};'use strict';var ChatInteractionEvents=require(_0xb06f('0x0'));var events=[_0xb06f('0x1'),_0xb06f('0x2'),_0xb06f('0x3')];function createListener(_0x5f6db4,_0x4d94c4){return function(_0x5646cf){_0x4d94c4[_0xb06f('0x4')](_0x5f6db4,_0x5646cf);};}function removeListener(_0x831385,_0x4fc6a5){return function(){ChatInteractionEvents[_0xb06f('0x5')](_0x831385,_0x4fc6a5);};}exports[_0xb06f('0x6')]=function(_0x4cf56d){for(var _0x25f1a3=0x0,_0x123fdd=events[_0xb06f('0x7')];_0x25f1a3<_0x123fdd;_0x25f1a3++){var _0x5910e8=events[_0x25f1a3];var _0x47a4b4=createListener(_0xb06f('0x8')+_0x5910e8,_0x4cf56d);ChatInteractionEvents['on'](_0x5910e8,_0x47a4b4);}}; \ No newline at end of file +var _0x07ef=['save','remove','update','emit','removeListener','length','chatInteraction:'];(function(_0x1aa825,_0x3c8504){var _0x18c654=function(_0x3aa5dc){while(--_0x3aa5dc){_0x1aa825['push'](_0x1aa825['shift']());}};_0x18c654(++_0x3c8504);}(_0x07ef,0x12d));var _0xf07e=function(_0x55c3d9,_0x3bf75c){_0x55c3d9=_0x55c3d9-0x0;var _0x19fd97=_0x07ef[_0x55c3d9];return _0x19fd97;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xf07e('0x0'),_0xf07e('0x1'),_0xf07e('0x2')];function createListener(_0x52d43b,_0x39aa77){return function(_0x245689){_0x39aa77[_0xf07e('0x3')](_0x52d43b,_0x245689);};}function removeListener(_0x1b282e,_0x1f8b13){return function(){ChatInteractionEvents[_0xf07e('0x4')](_0x1b282e,_0x1f8b13);};}exports['register']=function(_0x1cabd8){for(var _0x3f685a=0x0,_0x151a67=events[_0xf07e('0x5')];_0x3f685a<_0x151a67;_0x3f685a++){var _0x34c899=events[_0x3f685a];var _0x471e1d=createListener(_0xf07e('0x6')+_0x34c899,_0x1cabd8);ChatInteractionEvents['on'](_0x34c899,_0x471e1d);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 16b76be..943d114 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 _0x5796=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','diskStorage','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/tags','chatinteraction:addtags','put','tracked','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x2bfd4f,_0x1bbf2c){var _0x341849=function(_0x4c246e){while(--_0x4c246e){_0x2bfd4f['push'](_0x2bfd4f['shift']());}};_0x341849(++_0x1bbf2c);}(_0x5796,0x13a));var _0x6579=function(_0x22eefc,_0x138cff){_0x22eefc=_0x22eefc-0x0;var _0x10597e=_0x5796[_0x22eefc];return _0x10597e;};'use strict';var multer=require('multer');var util=require(_0x6579('0x0'));var path=require('path');var timeout=require(_0x6579('0x1'));var express=require(_0x6579('0x2'));var router=express[_0x6579('0x3')]();var fs_extra=require(_0x6579('0x4'));var auth=require(_0x6579('0x5'));var interaction=require(_0x6579('0x6'));var config=require(_0x6579('0x7'));var controller=require('./chatInteraction.controller');router['get']('/',auth[_0x6579('0x8')](),controller[_0x6579('0x9')]);router[_0x6579('0xa')](_0x6579('0xb'),auth[_0x6579('0x8')](),controller[_0x6579('0xc')]);router[_0x6579('0xa')](_0x6579('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x6579('0xe')]);router[_0x6579('0xa')]('/:id/attachment_download',auth[_0x6579('0xf')](),controller[_0x6579('0x10')]);router[_0x6579('0xa')](_0x6579('0x11'),auth[_0x6579('0x8')](),controller[_0x6579('0x12')]);router[_0x6579('0xa')](_0x6579('0x13'),auth['isChatInteractionAuthorized'](),controller[_0x6579('0x14')]);router['get'](_0x6579('0x15'),auth[_0x6579('0x8')](),controller[_0x6579('0x16')]);router[_0x6579('0x17')]('/',auth[_0x6579('0x8')](),controller['create']);router[_0x6579('0x17')](_0x6579('0x18'),auth[_0x6579('0x8')](),controller[_0x6579('0x19')]);var upload=multer({'storage':multer[_0x6579('0x1a')]({'destination':function(_0x395e85,_0x5d0ff0,_0xb0a5c7){_0xb0a5c7(null,path['join'](config['root'],_0x6579('0x1b')));},'filename':function(_0x140665,_0x69688d,_0x22ae45){_0x22ae45(null,util[_0x6579('0x1c')](_0x6579('0x1d'),Date[_0x6579('0x1e')](),_0x69688d[_0x6579('0x1f')][_0x6579('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x6579('0x17')](_0x6579('0x21'),upload[_0x6579('0x22')](_0x6579('0x23')),controller[_0x6579('0x24')]);router['post'](_0x6579('0x11'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0x6579('0x17')](_0x6579('0x25'),auth[_0x6579('0x8')](),interaction['tracked']('chat',_0x6579('0x26')),controller['addTags']);router[_0x6579('0x27')]('/:id',auth[_0x6579('0x8')](),interaction[_0x6579('0x28')](_0x6579('0x29'),_0x6579('0x2a')),controller[_0x6579('0x2b')]);router[_0x6579('0x27')](_0x6579('0x2c'),controller[_0x6579('0x2d')]);router['put'](_0x6579('0x2e'),auth[_0x6579('0xf')](),controller[_0x6579('0x2f')]);router['put'](_0x6579('0x30'),controller[_0x6579('0x31')]);router[_0x6579('0x32')](_0x6579('0xd'),auth[_0x6579('0x8')](),interaction[_0x6579('0x28')]('chat','chatinteraction:destroy'),controller[_0x6579('0x33')]);router['delete']('/:id/tags',auth[_0x6579('0x8')](),controller['removeTags']);module[_0x6579('0x34')]=router; \ No newline at end of file +var _0xc03d=['path','express','Router','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','/describe','describe','isChatInteractionAuthorized','/:id/attachment_download','/:id/messages','getMessages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','put','/:id','chat','chatinteraction:update','update','customUpdate','abandon','delete','chatinteraction:destroy','destroy','removeTags','exports','util'];(function(_0x53be66,_0x9ec3be){var _0x9e5520=function(_0x5c4742){while(--_0x5c4742){_0x53be66['push'](_0x53be66['shift']());}};_0x9e5520(++_0x9ec3be);}(_0xc03d,0xf4));var _0xdc03=function(_0x38ef05,_0x39b256){_0x38ef05=_0x38ef05-0x0;var _0x4352a4=_0xc03d[_0x38ef05];return _0x4352a4;};'use strict';var multer=require('multer');var util=require(_0xdc03('0x0'));var path=require(_0xdc03('0x1'));var timeout=require('connect-timeout');var express=require(_0xdc03('0x2'));var router=express[_0xdc03('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdc03('0x4'));var interaction=require(_0xdc03('0x5'));var config=require('../../config/environment');var controller=require(_0xdc03('0x6'));router[_0xdc03('0x7')]('/',auth[_0xdc03('0x8')](),controller['index']);router[_0xdc03('0x7')](_0xdc03('0x9'),auth['isAuthenticated'](),controller[_0xdc03('0xa')]);router[_0xdc03('0x7')]('/:id',auth[_0xdc03('0xb')](),controller['show']);router[_0xdc03('0x7')](_0xdc03('0xc'),auth[_0xdc03('0xb')](),controller['attachmentDownload']);router['get'](_0xdc03('0xd'),auth[_0xdc03('0x8')](),controller[_0xdc03('0xe')]);router[_0xdc03('0x7')]('/:id/my_messages',auth[_0xdc03('0xb')](),controller[_0xdc03('0xf')]);router[_0xdc03('0x7')](_0xdc03('0x10'),auth['isAuthenticated'](),controller[_0xdc03('0x11')]);router[_0xdc03('0x12')]('/',auth[_0xdc03('0x8')](),controller[_0xdc03('0x13')]);router[_0xdc03('0x12')](_0xdc03('0x14'),auth[_0xdc03('0x8')](),controller[_0xdc03('0x15')]);var upload=multer({'storage':multer[_0xdc03('0x16')]({'destination':function(_0x560650,_0x18035f,_0xa6b666){_0xa6b666(null,path[_0xdc03('0x17')](config[_0xdc03('0x18')],_0xdc03('0x19')));},'filename':function(_0x1b738b,_0x3c1899,_0x78c27b){_0x78c27b(null,util[_0xdc03('0x1a')](_0xdc03('0x1b'),Date[_0xdc03('0x1c')](),_0x3c1899['originalname'][_0xdc03('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xdc03('0x12')](_0xdc03('0x1e'),upload[_0xdc03('0x1f')]('file'),controller[_0xdc03('0x20')]);router[_0xdc03('0x12')](_0xdc03('0xd'),auth[_0xdc03('0xb')](),controller[_0xdc03('0x21')]);router[_0xdc03('0x12')](_0xdc03('0x22'),auth['isAuthenticated'](),interaction[_0xdc03('0x23')]('chat',_0xdc03('0x24')),controller['addTags']);router[_0xdc03('0x25')](_0xdc03('0x26'),auth[_0xdc03('0x8')](),interaction[_0xdc03('0x23')](_0xdc03('0x27'),_0xdc03('0x28')),controller[_0xdc03('0x29')]);router['put']('/:id/custom_update',controller[_0xdc03('0x2a')]);router[_0xdc03('0x25')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0xdc03('0x2b')]);router[_0xdc03('0x25')]('/:id/close',controller['close']);router[_0xdc03('0x2c')](_0xdc03('0x26'),auth[_0xdc03('0x8')](),interaction['tracked'](_0xdc03('0x27'),_0xdc03('0x2d')),controller[_0xdc03('0x2e')]);router[_0xdc03('0x2c')](_0xdc03('0x22'),auth[_0xdc03('0x8')](),controller[_0xdc03('0x2f')]);module[_0xdc03('0x30')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 521b2da..31c8b44 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 _0x8471=['BOOLEAN','INTEGER','exports','medium'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x8471,0x17a));var _0x1847=function(_0x2eabe6,_0x487ef6){_0x2eabe6=_0x2eabe6-0x0;var _0x3a5d65=_0x8471[_0x2eabe6];return _0x3a5d65;};'use strict';var Sequelize=require('sequelize');module[_0x1847('0x0')]={'body':{'type':Sequelize['TEXT'](_0x1847('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x1847('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x1847('0x3')]}}; \ No newline at end of file +var _0x8dc7=['exports','TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x2b1d63,_0x143c51){var _0x56dec0=function(_0x5dad38){while(--_0x5dad38){_0x2b1d63['push'](_0x2b1d63['shift']());}};_0x56dec0(++_0x143c51);}(_0x8dc7,0x1b5));var _0x78dc=function(_0x1da56b,_0x356602){_0x1da56b=_0x1da56b-0x0;var _0x51e2ba=_0x8dc7[_0x1da56b];return _0x51e2ba;};'use strict';var Sequelize=require(_0x78dc('0x0'));module[_0x78dc('0x1')]={'body':{'type':Sequelize[_0x78dc('0x2')](_0x78dc('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x78dc('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x78dc('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 5df6179..046bd8e 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 _0xbaa0=['online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','role','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','find','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','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','./chatInternalMessage.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','ChatInternalMessage','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','keys','rawAttributes','includeAll','create','body','update','params','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','user','fullname','userpic','internal'];(function(_0x2f32c4,_0x531dc6){var _0x3f3018=function(_0x406998){while(--_0x406998){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x3f3018(++_0x531dc6);}(_0xbaa0,0x179));var _0x0baa=function(_0x35df91,_0x32a05a){_0x35df91=_0x35df91-0x0;var _0x17154a=_0xbaa0[_0x35df91];return _0x17154a;};'use strict';var emlformat=require(_0x0baa('0x0'));var rimraf=require(_0x0baa('0x1'));var zipdir=require(_0x0baa('0x2'));var jsonpatch=require(_0x0baa('0x3'));var rp=require(_0x0baa('0x4'));var moment=require(_0x0baa('0x5'));var BPromise=require(_0x0baa('0x6'));var Mustache=require(_0x0baa('0x7'));var util=require(_0x0baa('0x8'));var path=require(_0x0baa('0x9'));var sox=require(_0x0baa('0xa'));var csv=require(_0x0baa('0xb'));var ejs=require(_0x0baa('0xc'));var fs=require('fs');var fs_extra=require(_0x0baa('0xd'));var _=require(_0x0baa('0xe'));var squel=require('squel');var crypto=require(_0x0baa('0xf'));var jsforce=require(_0x0baa('0x10'));var deskjs=require(_0x0baa('0x11'));var toCsv=require(_0x0baa('0xb'));var querystring=require(_0x0baa('0x12'));var Papa=require('papaparse');var Redis=require(_0x0baa('0x13'));var authService=require(_0x0baa('0x14'));var qs=require(_0x0baa('0x15'));var as=require(_0x0baa('0x16'));var hardwareService=require(_0x0baa('0x17'));var logger=require(_0x0baa('0x18'))(_0x0baa('0x19'));var utils=require(_0x0baa('0x1a'));var config=require(_0x0baa('0x1b'));var licenseUtil=require(_0x0baa('0x1c'));var db=require('../../mysqldb')['db'];config[_0x0baa('0x1d')]=_[_0x0baa('0x1e')](config[_0x0baa('0x1d')],{'host':_0x0baa('0x1f'),'port':0x18eb});var socket=require(_0x0baa('0x20'))(new Redis(config[_0x0baa('0x1d')]));require(_0x0baa('0x21'))[_0x0baa('0x22')](socket);function respondWithStatusCode(_0x2513b1,_0x126193){_0x126193=_0x126193||0xcc;return function(_0x32f2f0){if(_0x32f2f0){return _0x2513b1[_0x0baa('0x23')](_0x126193);}return _0x2513b1['status'](_0x126193)[_0x0baa('0x24')]();};}function respondWithResult(_0x5bd72f,_0x125dd5){_0x125dd5=_0x125dd5||0xc8;return function(_0xfa0782){if(_0xfa0782){return _0x5bd72f['status'](_0x125dd5)[_0x0baa('0x25')](_0xfa0782);}};}function respondWithFilteredResult(_0x413403,_0x5efef8){return function(_0x4d637d){if(_0x4d637d){var _0x3ce01b=typeof _0x5efef8[_0x0baa('0x26')]===_0x0baa('0x27')&&typeof _0x5efef8[_0x0baa('0x28')]===_0x0baa('0x27');var _0x53b92a=_0x4d637d[_0x0baa('0x29')];var _0x50a4ad=_0x3ce01b?0x0:_0x5efef8[_0x0baa('0x26')];var _0x5b38ea=_0x3ce01b?_0x4d637d[_0x0baa('0x29')]:_0x5efef8[_0x0baa('0x26')]+_0x5efef8['limit'];var _0x3cf7c6;if(_0x5b38ea>=_0x53b92a){_0x5b38ea=_0x53b92a;_0x3cf7c6=0xc8;}else{_0x3cf7c6=0xce;}_0x413403[_0x0baa('0x2a')](_0x3cf7c6);return _0x413403[_0x0baa('0x2b')](_0x0baa('0x2c'),_0x50a4ad+'-'+_0x5b38ea+'/'+_0x53b92a)[_0x0baa('0x25')](_0x4d637d);}return null;};}function patchUpdates(_0x2257a1){return function(_0x1eee0c){try{jsonpatch[_0x0baa('0x2d')](_0x1eee0c,_0x2257a1,!![]);}catch(_0x29b305){return BPromise[_0x0baa('0x2e')](_0x29b305);}return _0x1eee0c[_0x0baa('0x2f')]();};}function saveUpdates(_0x9b0f7e,_0x1d29c2){return function(_0x1b6144){if(_0x1b6144){return _0x1b6144['update'](_0x9b0f7e)[_0x0baa('0x30')](function(_0x47b785){return _0x47b785;});}return null;};}function removeEntity(_0x5e0e68,_0x2f41d1){return function(_0x3695f4){if(_0x3695f4){return _0x3695f4[_0x0baa('0x31')]()[_0x0baa('0x30')](function(){_0x5e0e68[_0x0baa('0x2a')](0xcc)[_0x0baa('0x24')]();});}};}function handleEntityNotFound(_0xd0996f,_0x536470){return function(_0x16bed1){if(!_0x16bed1){_0xd0996f[_0x0baa('0x23')](0x194);}return _0x16bed1;};}function handleError(_0x285671,_0x1e197f){_0x1e197f=_0x1e197f||0x1f4;return function(_0x4daa86){logger['error'](_0x4daa86[_0x0baa('0x32')]);if(_0x4daa86[_0x0baa('0x33')]){delete _0x4daa86['name'];}_0x285671['status'](_0x1e197f)[_0x0baa('0x34')](_0x4daa86);};}exports['index']=function(_0x52df32,_0x538d7b){var _0x41e3fd={},_0xab4cff={},_0x359c87={'count':0x0,'rows':[]};var _0x3e5f16=_['map'](db[_0x0baa('0x35')]['rawAttributes'],function(_0xd62d31){return{'name':_0xd62d31['fieldName'],'type':_0xd62d31[_0x0baa('0x36')][_0x0baa('0x37')]};});_0xab4cff[_0x0baa('0x38')]=_[_0x0baa('0x39')](_0x3e5f16,_0x0baa('0x33'));_0xab4cff[_0x0baa('0x3a')]=_['keys'](_0x52df32[_0x0baa('0x3a')]);_0xab4cff[_0x0baa('0x3b')]=_['intersection'](_0xab4cff['model'],_0xab4cff[_0x0baa('0x3a')]);_0x41e3fd[_0x0baa('0x3c')]=_[_0x0baa('0x3d')](_0xab4cff['model'],qs[_0x0baa('0x3e')](_0x52df32[_0x0baa('0x3a')][_0x0baa('0x3e')]));_0x41e3fd[_0x0baa('0x3c')]=_0x41e3fd[_0x0baa('0x3c')][_0x0baa('0x3f')]?_0x41e3fd[_0x0baa('0x3c')]:_0xab4cff[_0x0baa('0x38')];if(!_0x52df32['query'][_0x0baa('0x40')](_0x0baa('0x41'))){_0x41e3fd['limit']=qs[_0x0baa('0x28')](_0x52df32[_0x0baa('0x3a')]['limit']);_0x41e3fd[_0x0baa('0x26')]=qs[_0x0baa('0x26')](_0x52df32[_0x0baa('0x3a')][_0x0baa('0x26')]);}_0x41e3fd[_0x0baa('0x42')]=qs[_0x0baa('0x43')](_0x52df32['query'][_0x0baa('0x43')]);_0x41e3fd[_0x0baa('0x44')]=qs[_0x0baa('0x3b')](_[_0x0baa('0x45')](_0x52df32[_0x0baa('0x3a')],_0xab4cff[_0x0baa('0x3b')]),_0x3e5f16);if(_0x52df32[_0x0baa('0x3a')][_0x0baa('0x46')]){_0x41e3fd['where']=_[_0x0baa('0x47')](_0x41e3fd[_0x0baa('0x44')],{'$or':_[_0x0baa('0x39')](_0x3e5f16,function(_0x12a1cd){if(_0x12a1cd[_0x0baa('0x36')]!=='VIRTUAL'){var _0x35911f={};_0x35911f[_0x12a1cd[_0x0baa('0x33')]]={'$like':'%'+_0x52df32[_0x0baa('0x3a')][_0x0baa('0x46')]+'%'};return _0x35911f;}})});}_0x41e3fd=_[_0x0baa('0x47')]({},_0x41e3fd,_0x52df32[_0x0baa('0x48')]);var _0x4c8953={'where':_0x41e3fd[_0x0baa('0x44')]};return db['ChatInternalMessage']['count'](_0x4c8953)[_0x0baa('0x30')](function(_0x99389f){_0x359c87[_0x0baa('0x29')]=_0x99389f;if(_0x52df32[_0x0baa('0x3a')]['includeAll']){_0x41e3fd[_0x0baa('0x49')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x0baa('0x4a')](_0x41e3fd);})[_0x0baa('0x30')](function(_0x403527){_0x359c87[_0x0baa('0x4b')]=_0x403527;return _0x359c87;})[_0x0baa('0x30')](respondWithFilteredResult(_0x538d7b,_0x41e3fd))[_0x0baa('0x4c')](handleError(_0x538d7b,null));};exports['show']=function(_0xf6a497,_0x2606d4){var _0x2e6e5e={'raw':!![],'where':{'id':_0xf6a497['params']['id']}},_0x195fcf={};_0x195fcf['model']=_[_0x0baa('0x4d')](db[_0x0baa('0x35')][_0x0baa('0x4e')]);_0x195fcf[_0x0baa('0x3a')]=_[_0x0baa('0x4d')](_0xf6a497[_0x0baa('0x3a')]);_0x195fcf[_0x0baa('0x3b')]=_[_0x0baa('0x3d')](_0x195fcf[_0x0baa('0x38')],_0x195fcf['query']);_0x2e6e5e[_0x0baa('0x3c')]=_[_0x0baa('0x3d')](_0x195fcf[_0x0baa('0x38')],qs[_0x0baa('0x3e')](_0xf6a497[_0x0baa('0x3a')][_0x0baa('0x3e')]));_0x2e6e5e[_0x0baa('0x3c')]=_0x2e6e5e[_0x0baa('0x3c')][_0x0baa('0x3f')]?_0x2e6e5e['attributes']:_0x195fcf[_0x0baa('0x38')];if(_0xf6a497[_0x0baa('0x3a')][_0x0baa('0x4f')]){_0x2e6e5e[_0x0baa('0x49')]=[{'all':!![]}];}_0x2e6e5e=_[_0x0baa('0x47')]({},_0x2e6e5e,_0xf6a497[_0x0baa('0x48')]);return db[_0x0baa('0x35')]['find'](_0x2e6e5e)[_0x0baa('0x30')](handleEntityNotFound(_0x2606d4,null))[_0x0baa('0x30')](respondWithResult(_0x2606d4,null))[_0x0baa('0x4c')](handleError(_0x2606d4,null));};exports['create']=function(_0xe2f007,_0x372f21){return db[_0x0baa('0x35')][_0x0baa('0x50')](_0xe2f007[_0x0baa('0x51')],{})['then'](respondWithResult(_0x372f21,0xc9))[_0x0baa('0x4c')](handleError(_0x372f21,null));};exports[_0x0baa('0x52')]=function(_0x4c1625,_0xd172d7){if(_0x4c1625['body']['id']){delete _0x4c1625[_0x0baa('0x51')]['id'];}return db[_0x0baa('0x35')]['find']({'where':{'id':_0x4c1625[_0x0baa('0x53')]['id']}})[_0x0baa('0x30')](handleEntityNotFound(_0xd172d7,null))['then'](saveUpdates(_0x4c1625[_0x0baa('0x51')],null))['then'](respondWithResult(_0xd172d7,null))['catch'](handleError(_0xd172d7,null));};exports['destroy']=function(_0x1770fc,_0x534c22){return db['ChatInternalMessage']['find']({'where':{'id':_0x1770fc[_0x0baa('0x53')]['id']}})[_0x0baa('0x30')](handleEntityNotFound(_0x534c22,null))[_0x0baa('0x30')](removeEntity(_0x534c22,null))[_0x0baa('0x4c')](handleError(_0x534c22,null));};exports[_0x0baa('0x54')]=function(_0x10b14a,_0x1a9bd2){return db['ChatInternalMessage'][_0x0baa('0x54')]()['then'](respondWithResult(_0x1a9bd2,null))[_0x0baa('0x4c')](handleError(_0x1a9bd2,null));};function wrapUser(_0x17918c){return function(_0x41656f){var _0x225dff=_0x17918c[_0x0baa('0x55')]({'plain':!![]});_0x225dff[_0x0baa('0x56')]=[];if(_0x41656f){_0x225dff[_0x0baa('0x57')]=_0x41656f[_0x0baa('0x58')];_0x225dff[_0x0baa('0x59')]=_0x41656f;}else{_0x225dff[_0x0baa('0x57')]=moment(0x0)[_0x0baa('0x5a')](_0x0baa('0x5b'));_0x225dff[_0x0baa('0x59')]={};}return _0x225dff;};}exports[_0x0baa('0x5c')]=function(_0x475e11,_0x45aa68,_0x2521ed){var _0x5bb59b=[];return db[_0x0baa('0x5d')]['findAll']({'where':{'role':[_0x0baa('0x5e'),'admin',_0x0baa('0x5f')]},'attributes':['id',_0x0baa('0x60'),'name','role',_0x0baa('0x61'),_0x0baa('0x62'),_0x0baa('0x63'),_0x0baa('0x64'),_0x0baa('0x65'),_0x0baa('0x66')],'order':qs[_0x0baa('0x43')](_0x0baa('0x67')),'include':[{'model':db[_0x0baa('0x68')],'as':_0x0baa('0x69'),'attributes':['id',_0x0baa('0x33'),_0x0baa('0x36')],'through':{'attributes':[]}}]})[_0x0baa('0x30')](function(_0x5a5ddd){if(_0x5a5ddd){var _0x47ad81=_0x475e11[_0x0baa('0x5f')][_0x0baa('0x55')]({'plain':!![]});if(!_0x47ad81)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47ad81[_0x0baa('0x6a')]===_0x0baa('0x5f')){return db[_0x0baa('0x6b')]['find']({'where':{'name':_0x0baa('0x6c'),'userProfileId':_0x47ad81[_0x0baa('0x6d')]},'raw':!![]})[_0x0baa('0x30')](function(_0x2a50bb){if(_0x2a50bb){if(_0x2a50bb[_0x0baa('0x6e')]===0x0){return db['UserProfileResource'][_0x0baa('0x4a')]({'where':{'sectionId':_0x2a50bb['id']},'raw':!![]})[_0x0baa('0x30')](function(_0x201f86){var _0x447ad5=[];if(_[_0x0baa('0x6f')](_0x201f86)){_0x447ad5=_[_0x0baa('0x46')](_0x5a5ddd,function(_0x1fa910){if(_0x1fa910[_0x0baa('0x6a')]!==_0x0baa('0x5e')){return _0x1fa910;}});return _0x447ad5;}else{for(var _0x5df157=0x0;_0x5df157<_0x5a5ddd[_0x0baa('0x3f')];_0x5df157++){var _0x5c4eec=_0x5a5ddd[_0x5df157];if(_0x5c4eec['role']===_0x0baa('0x5e')){var _0x5e01db=_[_0x0baa('0x70')](_0x201f86,function(_0xee9f65){return _0xee9f65['resourceId']===_0x5c4eec['id'];});if(_0x5e01db)_0x447ad5['push'](_0x5c4eec);}else{_0x447ad5[_0x0baa('0x71')](_0x5c4eec);}}return _0x447ad5;}});}else{return _0x5a5ddd;}}else{var _0x2b3bb3=_['filter'](_0x5a5ddd,function(_0x1d962d){if(_0x1d962d[_0x0baa('0x6a')]!==_0x0baa('0x5e')){return _0x1d962d;}});return _0x2b3bb3;}});}else{return _0x5a5ddd;}}})[_0x0baa('0x30')](function(_0x18f425){var _0x250577=[];if(_0x18f425){_0x5bb59b=_0x18f425;for(var _0x4f656a=0x0;_0x4f656a<_0x18f425[_0x0baa('0x3f')];_0x4f656a+=0x1){_0x5bb59b[_0x4f656a][_0x0baa('0x56')]=[];_0x250577[_0x0baa('0x71')](db[_0x0baa('0x35')]['find']({'where':{'FromId':[_0x475e11[_0x0baa('0x5f')]['id'],_0x18f425[_0x4f656a]['id']],'ToId':[_0x475e11[_0x0baa('0x5f')]['id'],_0x18f425[_0x4f656a]['id']],'ChatGroupId':null},'attributes':['id',_0x0baa('0x58'),_0x0baa('0x72'),_0x0baa('0x73'),_0x0baa('0x74'),'body'],'order':qs['sort'](_0x0baa('0x75')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x0baa('0x30')](wrapUser(_0x18f425[_0x4f656a])));}return BPromise[_0x0baa('0x76')](_0x250577);}return[];})[_0x0baa('0x30')](function(_0x153dfe){return{'rows':_0x153dfe,'count':_0x153dfe[_0x0baa('0x3f')]};})['then'](respondWithResult(_0x45aa68,null))[_0x0baa('0x4c')](handleError(_0x45aa68,null));}; \ No newline at end of file +var _0x5a92=['UserProfileResource','resourceId','push','FromId','ToId','read','all','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','error','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','keys','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','findAll','agent','admin','fullname','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x1a8b6f,_0x3aebf7){var _0x2f8ff2=function(_0x47f677){while(--_0x47f677){_0x1a8b6f['push'](_0x1a8b6f['shift']());}};_0x2f8ff2(++_0x3aebf7);}(_0x5a92,0x75));var _0x25a9=function(_0x591583,_0x255a3e){_0x591583=_0x591583-0x0;var _0x345ddd=_0x5a92[_0x591583];return _0x345ddd;};'use strict';var emlformat=require(_0x25a9('0x0'));var rimraf=require(_0x25a9('0x1'));var zipdir=require(_0x25a9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25a9('0x3'));var moment=require(_0x25a9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x25a9('0x5'));var util=require(_0x25a9('0x6'));var path=require('path');var sox=require(_0x25a9('0x7'));var csv=require(_0x25a9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x25a9('0x9'));var squel=require('squel');var crypto=require(_0x25a9('0xa'));var jsforce=require(_0x25a9('0xb'));var deskjs=require(_0x25a9('0xc'));var toCsv=require('to-csv');var querystring=require(_0x25a9('0xd'));var Papa=require(_0x25a9('0xe'));var Redis=require(_0x25a9('0xf'));var authService=require(_0x25a9('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25a9('0x11'));var logger=require(_0x25a9('0x12'))(_0x25a9('0x13'));var utils=require(_0x25a9('0x14'));var config=require(_0x25a9('0x15'));var licenseUtil=require(_0x25a9('0x16'));var db=require('../../mysqldb')['db'];config[_0x25a9('0x17')]=_[_0x25a9('0x18')](config[_0x25a9('0x17')],{'host':_0x25a9('0x19'),'port':0x18eb});var socket=require(_0x25a9('0x1a'))(new Redis(config[_0x25a9('0x17')]));require(_0x25a9('0x1b'))['register'](socket);function respondWithStatusCode(_0x47e807,_0x3e0608){_0x3e0608=_0x3e0608||0xcc;return function(_0x19addf){if(_0x19addf){return _0x47e807[_0x25a9('0x1c')](_0x3e0608);}return _0x47e807[_0x25a9('0x1d')](_0x3e0608)[_0x25a9('0x1e')]();};}function respondWithResult(_0x714890,_0x99d906){_0x99d906=_0x99d906||0xc8;return function(_0x5f3cd0){if(_0x5f3cd0){return _0x714890['status'](_0x99d906)['json'](_0x5f3cd0);}};}function respondWithFilteredResult(_0x7e31e0,_0x346591){return function(_0x41ecf2){if(_0x41ecf2){var _0x544cda=typeof _0x346591[_0x25a9('0x1f')]===_0x25a9('0x20')&&typeof _0x346591[_0x25a9('0x21')]===_0x25a9('0x20');var _0x4b54b0=_0x41ecf2[_0x25a9('0x22')];var _0x3d0c31=_0x544cda?0x0:_0x346591[_0x25a9('0x1f')];var _0x3dd674=_0x544cda?_0x41ecf2['count']:_0x346591[_0x25a9('0x1f')]+_0x346591['limit'];var _0x1621f1;if(_0x3dd674>=_0x4b54b0){_0x3dd674=_0x4b54b0;_0x1621f1=0xc8;}else{_0x1621f1=0xce;}_0x7e31e0['status'](_0x1621f1);return _0x7e31e0[_0x25a9('0x23')](_0x25a9('0x24'),_0x3d0c31+'-'+_0x3dd674+'/'+_0x4b54b0)[_0x25a9('0x25')](_0x41ecf2);}return null;};}function patchUpdates(_0x53c73f){return function(_0x3998d7){try{jsonpatch['apply'](_0x3998d7,_0x53c73f,!![]);}catch(_0x436e48){return BPromise[_0x25a9('0x26')](_0x436e48);}return _0x3998d7[_0x25a9('0x27')]();};}function saveUpdates(_0x1ac89e,_0x17dac6){return function(_0x271586){if(_0x271586){return _0x271586['update'](_0x1ac89e)[_0x25a9('0x28')](function(_0x468964){return _0x468964;});}return null;};}function removeEntity(_0x360c74,_0x5e660a){return function(_0x515c2e){if(_0x515c2e){return _0x515c2e[_0x25a9('0x29')]()[_0x25a9('0x28')](function(){_0x360c74['status'](0xcc)[_0x25a9('0x1e')]();});}};}function handleEntityNotFound(_0x5b4931,_0x279672){return function(_0x2622f8){if(!_0x2622f8){_0x5b4931['sendStatus'](0x194);}return _0x2622f8;};}function handleError(_0x1c0641,_0x1e35ba){_0x1e35ba=_0x1e35ba||0x1f4;return function(_0x3c1d81){logger[_0x25a9('0x2a')](_0x3c1d81['stack']);if(_0x3c1d81[_0x25a9('0x2b')]){delete _0x3c1d81['name'];}_0x1c0641[_0x25a9('0x1d')](_0x1e35ba)[_0x25a9('0x2c')](_0x3c1d81);};}exports[_0x25a9('0x2d')]=function(_0x10166b,_0x308c5e){var _0x9a02a2={},_0x127987={},_0x132f5a={'count':0x0,'rows':[]};var _0x2e725d=_['map'](db[_0x25a9('0x2e')][_0x25a9('0x2f')],function(_0x1e605d){return{'name':_0x1e605d[_0x25a9('0x30')],'type':_0x1e605d[_0x25a9('0x31')][_0x25a9('0x32')]};});_0x127987[_0x25a9('0x33')]=_[_0x25a9('0x34')](_0x2e725d,_0x25a9('0x2b'));_0x127987[_0x25a9('0x35')]=_['keys'](_0x10166b[_0x25a9('0x35')]);_0x127987[_0x25a9('0x36')]=_[_0x25a9('0x37')](_0x127987[_0x25a9('0x33')],_0x127987[_0x25a9('0x35')]);_0x9a02a2[_0x25a9('0x38')]=_['intersection'](_0x127987[_0x25a9('0x33')],qs[_0x25a9('0x39')](_0x10166b[_0x25a9('0x35')][_0x25a9('0x39')]));_0x9a02a2['attributes']=_0x9a02a2[_0x25a9('0x38')][_0x25a9('0x3a')]?_0x9a02a2[_0x25a9('0x38')]:_0x127987[_0x25a9('0x33')];if(!_0x10166b[_0x25a9('0x35')]['hasOwnProperty'](_0x25a9('0x3b'))){_0x9a02a2[_0x25a9('0x21')]=qs[_0x25a9('0x21')](_0x10166b[_0x25a9('0x35')][_0x25a9('0x21')]);_0x9a02a2[_0x25a9('0x1f')]=qs[_0x25a9('0x1f')](_0x10166b[_0x25a9('0x35')]['offset']);}_0x9a02a2['order']=qs[_0x25a9('0x3c')](_0x10166b[_0x25a9('0x35')][_0x25a9('0x3c')]);_0x9a02a2[_0x25a9('0x3d')]=qs[_0x25a9('0x36')](_[_0x25a9('0x3e')](_0x10166b[_0x25a9('0x35')],_0x127987[_0x25a9('0x36')]),_0x2e725d);if(_0x10166b[_0x25a9('0x35')][_0x25a9('0x3f')]){_0x9a02a2['where']=_['merge'](_0x9a02a2[_0x25a9('0x3d')],{'$or':_['map'](_0x2e725d,function(_0x56207b){if(_0x56207b[_0x25a9('0x31')]!==_0x25a9('0x40')){var _0x4ab1e2={};_0x4ab1e2[_0x56207b[_0x25a9('0x2b')]]={'$like':'%'+_0x10166b[_0x25a9('0x35')]['filter']+'%'};return _0x4ab1e2;}})});}_0x9a02a2=_[_0x25a9('0x41')]({},_0x9a02a2,_0x10166b[_0x25a9('0x42')]);var _0x455888={'where':_0x9a02a2[_0x25a9('0x3d')]};return db[_0x25a9('0x2e')][_0x25a9('0x22')](_0x455888)['then'](function(_0x316b49){_0x132f5a[_0x25a9('0x22')]=_0x316b49;if(_0x10166b[_0x25a9('0x35')][_0x25a9('0x43')]){_0x9a02a2[_0x25a9('0x44')]=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x9a02a2);})['then'](function(_0xd51a5){_0x132f5a['rows']=_0xd51a5;return _0x132f5a;})[_0x25a9('0x28')](respondWithFilteredResult(_0x308c5e,_0x9a02a2))[_0x25a9('0x45')](handleError(_0x308c5e,null));};exports[_0x25a9('0x46')]=function(_0x3f23cc,_0xca7971){var _0x4c9766={'raw':!![],'where':{'id':_0x3f23cc[_0x25a9('0x47')]['id']}},_0x225810={};_0x225810[_0x25a9('0x33')]=_['keys'](db[_0x25a9('0x2e')][_0x25a9('0x2f')]);_0x225810[_0x25a9('0x35')]=_[_0x25a9('0x48')](_0x3f23cc['query']);_0x225810[_0x25a9('0x36')]=_[_0x25a9('0x37')](_0x225810[_0x25a9('0x33')],_0x225810['query']);_0x4c9766[_0x25a9('0x38')]=_[_0x25a9('0x37')](_0x225810[_0x25a9('0x33')],qs[_0x25a9('0x39')](_0x3f23cc[_0x25a9('0x35')][_0x25a9('0x39')]));_0x4c9766['attributes']=_0x4c9766[_0x25a9('0x38')][_0x25a9('0x3a')]?_0x4c9766[_0x25a9('0x38')]:_0x225810[_0x25a9('0x33')];if(_0x3f23cc['query']['includeAll']){_0x4c9766['include']=[{'all':!![]}];}_0x4c9766=_['merge']({},_0x4c9766,_0x3f23cc[_0x25a9('0x42')]);return db[_0x25a9('0x2e')][_0x25a9('0x49')](_0x4c9766)['then'](handleEntityNotFound(_0xca7971,null))[_0x25a9('0x28')](respondWithResult(_0xca7971,null))[_0x25a9('0x45')](handleError(_0xca7971,null));};exports['create']=function(_0x19e121,_0x2d8501){return db[_0x25a9('0x2e')][_0x25a9('0x4a')](_0x19e121['body'],{})[_0x25a9('0x28')](respondWithResult(_0x2d8501,0xc9))[_0x25a9('0x45')](handleError(_0x2d8501,null));};exports['update']=function(_0x5a33ba,_0x24cc32){if(_0x5a33ba[_0x25a9('0x4b')]['id']){delete _0x5a33ba[_0x25a9('0x4b')]['id'];}return db[_0x25a9('0x2e')][_0x25a9('0x49')]({'where':{'id':_0x5a33ba[_0x25a9('0x47')]['id']}})[_0x25a9('0x28')](handleEntityNotFound(_0x24cc32,null))['then'](saveUpdates(_0x5a33ba[_0x25a9('0x4b')],null))[_0x25a9('0x28')](respondWithResult(_0x24cc32,null))[_0x25a9('0x45')](handleError(_0x24cc32,null));};exports['destroy']=function(_0x49f038,_0x1623f1){return db[_0x25a9('0x2e')][_0x25a9('0x49')]({'where':{'id':_0x49f038['params']['id']}})['then'](handleEntityNotFound(_0x1623f1,null))[_0x25a9('0x28')](removeEntity(_0x1623f1,null))['catch'](handleError(_0x1623f1,null));};exports[_0x25a9('0x4c')]=function(_0xeac259,_0x90fd58){return db[_0x25a9('0x2e')]['describe']()['then'](respondWithResult(_0x90fd58,null))[_0x25a9('0x45')](handleError(_0x90fd58,null));};function wrapUser(_0x56b634){return function(_0x3ccd9e){var _0x140efe=_0x56b634[_0x25a9('0x4d')]({'plain':!![]});_0x140efe[_0x25a9('0x4e')]=[];if(_0x3ccd9e){_0x140efe[_0x25a9('0x4f')]=_0x3ccd9e[_0x25a9('0x50')];_0x140efe[_0x25a9('0x51')]=_0x3ccd9e;}else{_0x140efe['lastMessageAt']=moment(0x0)[_0x25a9('0x52')](_0x25a9('0x53'));_0x140efe['lastMessage']={};}return _0x140efe;};}exports['getUsers']=function(_0x4488bb,_0x2e9cab,_0x1d15f7){var _0xd645c4=[];return db[_0x25a9('0x54')][_0x25a9('0x55')]({'where':{'role':[_0x25a9('0x56'),_0x25a9('0x57'),'user']},'attributes':['id',_0x25a9('0x58'),'name','role',_0x25a9('0x59'),_0x25a9('0x5a'),_0x25a9('0x5b'),_0x25a9('0x5c'),_0x25a9('0x5d'),_0x25a9('0x5e')],'order':qs[_0x25a9('0x3c')](_0x25a9('0x5f')),'include':[{'model':db[_0x25a9('0x60')],'as':_0x25a9('0x61'),'attributes':['id',_0x25a9('0x2b'),_0x25a9('0x31')],'through':{'attributes':[]}}]})[_0x25a9('0x28')](function(_0x224a10){if(_0x224a10){var _0xf9102d=_0x4488bb[_0x25a9('0x62')][_0x25a9('0x4d')]({'plain':!![]});if(!_0xf9102d)throw new Error(_0x25a9('0x63'));if(_0xf9102d[_0x25a9('0x64')]==='user'){return db[_0x25a9('0x65')][_0x25a9('0x49')]({'where':{'name':'Agents','userProfileId':_0xf9102d[_0x25a9('0x66')]},'raw':!![]})[_0x25a9('0x28')](function(_0x41626e){if(_0x41626e){if(_0x41626e['autoAssociation']===0x0){return db[_0x25a9('0x67')][_0x25a9('0x55')]({'where':{'sectionId':_0x41626e['id']},'raw':!![]})[_0x25a9('0x28')](function(_0x2276eb){var _0x51c11f=[];if(_['isEmpty'](_0x2276eb)){_0x51c11f=_['filter'](_0x224a10,function(_0x166e99){if(_0x166e99[_0x25a9('0x64')]!==_0x25a9('0x56')){return _0x166e99;}});return _0x51c11f;}else{for(var _0x3b48ce=0x0;_0x3b48ce<_0x224a10['length'];_0x3b48ce++){var _0x3f8d5f=_0x224a10[_0x3b48ce];if(_0x3f8d5f[_0x25a9('0x64')]==='agent'){var _0x513580=_[_0x25a9('0x49')](_0x2276eb,function(_0x394734){return _0x394734[_0x25a9('0x68')]===_0x3f8d5f['id'];});if(_0x513580)_0x51c11f[_0x25a9('0x69')](_0x3f8d5f);}else{_0x51c11f[_0x25a9('0x69')](_0x3f8d5f);}}return _0x51c11f;}});}else{return _0x224a10;}}else{var _0x448155=_[_0x25a9('0x3f')](_0x224a10,function(_0x3c57ae){if(_0x3c57ae['role']!==_0x25a9('0x56')){return _0x3c57ae;}});return _0x448155;}});}else{return _0x224a10;}}})[_0x25a9('0x28')](function(_0x4cdaef){var _0x27ec58=[];if(_0x4cdaef){_0xd645c4=_0x4cdaef;for(var _0x4b560e=0x0;_0x4b560e<_0x4cdaef[_0x25a9('0x3a')];_0x4b560e+=0x1){_0xd645c4[_0x4b560e]['messages']=[];_0x27ec58[_0x25a9('0x69')](db[_0x25a9('0x2e')][_0x25a9('0x49')]({'where':{'FromId':[_0x4488bb[_0x25a9('0x62')]['id'],_0x4cdaef[_0x4b560e]['id']],'ToId':[_0x4488bb[_0x25a9('0x62')]['id'],_0x4cdaef[_0x4b560e]['id']],'ChatGroupId':null},'attributes':['id',_0x25a9('0x50'),_0x25a9('0x6a'),_0x25a9('0x6b'),_0x25a9('0x6c'),_0x25a9('0x4b')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x25a9('0x28')](wrapUser(_0x4cdaef[_0x4b560e])));}return BPromise[_0x25a9('0x6d')](_0x27ec58);}return[];})[_0x25a9('0x28')](function(_0x3ad143){return{'rows':_0x3ad143,'count':_0x3ad143[_0x25a9('0x3a')]};})[_0x25a9('0x28')](respondWithResult(_0x2e9cab,null))[_0x25a9('0x45')](handleError(_0x2e9cab,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index b94e411..dadb59d 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 _0x036d=['hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','emit'];(function(_0x3bc7a6,_0x3783f1){var _0x596ca0=function(_0x35f6f7){while(--_0x35f6f7){_0x3bc7a6['push'](_0x3bc7a6['shift']());}};_0x596ca0(++_0x3783f1);}(_0x036d,0x1a9));var _0xd036=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x036d[_0x3ff085];return _0x2b68c3;};'use strict';var EventEmitter=require(_0xd036('0x0'));var ChatInternalMessage=require(_0xd036('0x1'))['db'][_0xd036('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xd036('0x3')](0x0);var events={'afterCreate':_0xd036('0x4'),'afterUpdate':_0xd036('0x5'),'afterDestroy':'remove'};function emitEvent(_0x576687){return function(_0x412d6e,_0x26f8fe,_0x3d435b){ChatInternalMessageEvents[_0xd036('0x6')](_0x576687+':'+_0x412d6e['id'],_0x412d6e);ChatInternalMessageEvents['emit'](_0x576687,_0x412d6e);_0x3d435b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xd036('0x7')](e,emitEvent(event));}}module[_0xd036('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x57e9=['update','remove','emit','events','../../mysqldb','ChatInternalMessage','save'];(function(_0x5ed413,_0x4f26c0){var _0x3cca33=function(_0x214afe){while(--_0x214afe){_0x5ed413['push'](_0x5ed413['shift']());}};_0x3cca33(++_0x4f26c0);}(_0x57e9,0xce));var _0x957e=function(_0x5b7a0a,_0x4d62d5){_0x5b7a0a=_0x5b7a0a-0x0;var _0x3418b6=_0x57e9[_0x5b7a0a];return _0x3418b6;};'use strict';var EventEmitter=require(_0x957e('0x0'));var ChatInternalMessage=require(_0x957e('0x1'))['db'][_0x957e('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x957e('0x3'),'afterUpdate':_0x957e('0x4'),'afterDestroy':_0x957e('0x5')};function emitEvent(_0x44410f){return function(_0x3a44d5,_0xee6b30,_0x581cf6){ChatInternalMessageEvents[_0x957e('0x6')](_0x44410f+':'+_0x3a44d5['id'],_0x3a44d5);ChatInternalMessageEvents['emit'](_0x44410f,_0x3a44d5);_0x581cf6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](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 de523d4..25ba955 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 _0x4cdf=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash'];(function(_0x567e5a,_0x2d143d){var _0xa17ebe=function(_0x292f7e){while(--_0x292f7e){_0x567e5a['push'](_0x567e5a['shift']());}};_0xa17ebe(++_0x2d143d);}(_0x4cdf,0xe9));var _0xf4cd=function(_0x4da0da,_0x54fdec){_0x4da0da=_0x4da0da-0x0;var _0x50fb2b=_0x4cdf[_0x4da0da];return _0x50fb2b;};'use strict';var _=require(_0xf4cd('0x0'));var util=require(_0xf4cd('0x1'));var logger=require(_0xf4cd('0x2'))(_0xf4cd('0x3'));var moment=require(_0xf4cd('0x4'));var BPromise=require(_0xf4cd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf4cd('0x6'));var config=require(_0xf4cd('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0xf4cd('0x8')]=function(_0x4c4784,_0x4d9f74){return _0x4c4784[_0xf4cd('0x9')](_0xf4cd('0xa'),attributes,{'tableName':_0xf4cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf4cd('0xc')});}; \ No newline at end of file +var _0x84ca=['rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise'];(function(_0x33acc2,_0x198db3){var _0x29f09d=function(_0x3c527e){while(--_0x3c527e){_0x33acc2['push'](_0x33acc2['shift']());}};_0x29f09d(++_0x198db3);}(_0x84ca,0xca));var _0xa84c=function(_0x5ec57a,_0x4fb107){_0x5ec57a=_0x5ec57a-0x0;var _0x2b717b=_0x84ca[_0x5ec57a];return _0x2b717b;};'use strict';var _=require(_0xa84c('0x0'));var util=require(_0xa84c('0x1'));var logger=require('../../config/logger')(_0xa84c('0x2'));var moment=require(_0xa84c('0x3'));var BPromise=require(_0xa84c('0x4'));var rp=require(_0xa84c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa84c('0x6'));var config=require(_0xa84c('0x7'));var attributes=require(_0xa84c('0x8'));module[_0xa84c('0x9')]=function(_0x522894,_0x13b07c){return _0x522894[_0xa84c('0xa')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa84c('0xb'),'collate':_0xa84c('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 4084ab7..6bee3a7 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 _0x6467=['result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','info','ChatInternalMessage,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x2af5ec,_0x1b35cb){var _0x31919b=function(_0x44aa7f){while(--_0x44aa7f){_0x2af5ec['push'](_0x2af5ec['shift']());}};_0x31919b(++_0x1b35cb);}(_0x6467,0x110));var _0x7646=function(_0x1320bd,_0x41012c){_0x1320bd=_0x1320bd-0x0;var _0x27cb35=_0x6467[_0x1320bd];return _0x27cb35;};'use strict';var _=require(_0x7646('0x0'));var util=require(_0x7646('0x1'));var moment=require(_0x7646('0x2'));var BPromise=require(_0x7646('0x3'));var rs=require(_0x7646('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7646('0x5'));var logger=require(_0x7646('0x6'))(_0x7646('0x7'));var config=require(_0x7646('0x8'));var jayson=require(_0x7646('0x9'));var client=jayson[_0x7646('0xa')][_0x7646('0xb')]({'port':0x232a});config[_0x7646('0xc')]=_[_0x7646('0xd')](config['redis'],{'host':_0x7646('0xe'),'port':0x18eb});var socket=require(_0x7646('0xf'))(new Redis(config[_0x7646('0xc')]));require(_0x7646('0x10'))[_0x7646('0x11')](socket);function respondWithRpcPromise(_0x42b19e,_0x2ebec,_0x1a88d9){return new BPromise(function(_0x2acf4f,_0x23fcee){return client['request'](_0x42b19e,_0x1a88d9)['then'](function(_0x59ba3d){logger[_0x7646('0x12')](_0x7646('0x13'),_0x2ebec,'request\x20sent');logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x2ebec,'request\x20sent',JSON[_0x7646('0x14')](_0x59ba3d));if(_0x59ba3d[_0x7646('0x15')]){if(_0x59ba3d[_0x7646('0x15')][_0x7646('0x16')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x2ebec,_0x59ba3d[_0x7646('0x15')][_0x7646('0x17')]);return _0x23fcee(_0x59ba3d['error'][_0x7646('0x17')]);}logger[_0x7646('0x15')](_0x7646('0x13'),_0x2ebec,_0x59ba3d['error']['message']);return _0x2acf4f(_0x59ba3d['error']['message']);}else{logger['info'](_0x7646('0x13'),_0x2ebec,_0x7646('0x18'));_0x2acf4f(_0x59ba3d[_0x7646('0x19')][_0x7646('0x17')]);}})[_0x7646('0x1a')](function(_0x108c46){logger[_0x7646('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x2ebec,_0x108c46);_0x23fcee(_0x108c46);});});} \ No newline at end of file +var _0xb6a9=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb6a9,0xc4));var _0x9b6a=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xb6a9[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0x9b6a('0x0'));var util=require(_0x9b6a('0x1'));var moment=require('moment');var BPromise=require(_0x9b6a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b6a('0x3'));var db=require(_0x9b6a('0x4'))['db'];var utils=require(_0x9b6a('0x5'));var logger=require(_0x9b6a('0x6'))(_0x9b6a('0x7'));var config=require('../../config/environment');var jayson=require(_0x9b6a('0x8'));var client=jayson[_0x9b6a('0x9')][_0x9b6a('0xa')]({'port':0x232a});config[_0x9b6a('0xb')]=_[_0x9b6a('0xc')](config[_0x9b6a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9b6a('0xd'))(new Redis(config['redis']));require(_0x9b6a('0xe'))[_0x9b6a('0xf')](socket);function respondWithRpcPromise(_0x5efc13,_0x271ef4,_0x525480){return new BPromise(function(_0x55af0c,_0x222780){return client[_0x9b6a('0x10')](_0x5efc13,_0x525480)[_0x9b6a('0x11')](function(_0x2295f0){logger[_0x9b6a('0x12')](_0x9b6a('0x13'),_0x271ef4,_0x9b6a('0x14'));logger[_0x9b6a('0x15')](_0x9b6a('0x16'),_0x271ef4,_0x9b6a('0x14'),JSON[_0x9b6a('0x17')](_0x2295f0));if(_0x2295f0[_0x9b6a('0x18')]){if(_0x2295f0[_0x9b6a('0x18')]['code']===0x1f4){logger['error'](_0x9b6a('0x13'),_0x271ef4,_0x2295f0[_0x9b6a('0x18')][_0x9b6a('0x19')]);return _0x222780(_0x2295f0[_0x9b6a('0x18')][_0x9b6a('0x19')]);}logger[_0x9b6a('0x18')](_0x9b6a('0x13'),_0x271ef4,_0x2295f0[_0x9b6a('0x18')][_0x9b6a('0x19')]);return _0x55af0c(_0x2295f0[_0x9b6a('0x18')][_0x9b6a('0x19')]);}else{logger[_0x9b6a('0x12')](_0x9b6a('0x13'),_0x271ef4,_0x9b6a('0x14'));_0x55af0c(_0x2295f0[_0x9b6a('0x1a')][_0x9b6a('0x19')]);}})[_0x9b6a('0x1b')](function(_0xa8e9d6){logger[_0x9b6a('0x18')](_0x9b6a('0x13'),_0x271ef4,_0xa8e9d6);_0x222780(_0xa8e9d6);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 684ff7c..bb0f84f 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 _0x62d8=['chatInternalMessage:','./chatInternalMessage.events','remove','update','register','length'];(function(_0x40b7ec,_0x307707){var _0x72b976=function(_0x5bfcc3){while(--_0x5bfcc3){_0x40b7ec['push'](_0x40b7ec['shift']());}};_0x72b976(++_0x307707);}(_0x62d8,0x199));var _0x862d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x62d8[_0x501510];return _0x1e6ee5;};'use strict';var ChatInternalMessageEvents=require(_0x862d('0x0'));var events=['save',_0x862d('0x1'),_0x862d('0x2')];function createListener(_0x17e8b8,_0x52c62e){return function(_0xc0a6fe){_0x52c62e['emit'](_0x17e8b8,_0xc0a6fe);};}function removeListener(_0x32de59,_0x458e30){return function(){ChatInternalMessageEvents['removeListener'](_0x32de59,_0x458e30);};}exports[_0x862d('0x3')]=function(_0x3a99e8){for(var _0x2acf65=0x0,_0x2cb145=events[_0x862d('0x4')];_0x2acf65<_0x2cb145;_0x2acf65++){var _0x2117ba=events[_0x2acf65];var _0xc9f224=createListener(_0x862d('0x5')+_0x2117ba,_0x3a99e8);ChatInternalMessageEvents['on'](_0x2117ba,_0xc9f224);}}; \ No newline at end of file +var _0xd6ec=['update','emit','register','length','chatInternalMessage:','./chatInternalMessage.events','remove'];(function(_0x4ecb61,_0xf4fe26){var _0x25eec8=function(_0xa0aeb){while(--_0xa0aeb){_0x4ecb61['push'](_0x4ecb61['shift']());}};_0x25eec8(++_0xf4fe26);}(_0xd6ec,0x18d));var _0xcd6e=function(_0x11f586,_0x1a11da){_0x11f586=_0x11f586-0x0;var _0x46b786=_0xd6ec[_0x11f586];return _0x46b786;};'use strict';var ChatInternalMessageEvents=require(_0xcd6e('0x0'));var events=['save',_0xcd6e('0x1'),_0xcd6e('0x2')];function createListener(_0x2269b6,_0x35f8b1){return function(_0x15bcf2){_0x35f8b1[_0xcd6e('0x3')](_0x2269b6,_0x15bcf2);};}function removeListener(_0x1ce042,_0x4f29f2){return function(){ChatInternalMessageEvents['removeListener'](_0x1ce042,_0x4f29f2);};}exports[_0xcd6e('0x4')]=function(_0x371d76){for(var _0x1f8c89=0x0,_0x176612=events[_0xcd6e('0x5')];_0x1f8c89<_0x176612;_0x1f8c89++){var _0xde523e=events[_0x1f8c89];var _0x8d3396=createListener(_0xcd6e('0x6')+_0xde523e,_0x371d76);ChatInternalMessageEvents['on'](_0xde523e,_0x8d3396);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index e55dbb8..39c142c 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 _0x4f9d=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/users','getUsers','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x1479fa,_0x315d83){var _0x2c13d5=function(_0x17b2d6){while(--_0x17b2d6){_0x1479fa['push'](_0x1479fa['shift']());}};_0x2c13d5(++_0x315d83);}(_0x4f9d,0x1b3));var _0xd4f9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4f9d[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xd4f9('0x0'));var util=require(_0xd4f9('0x1'));var path=require(_0xd4f9('0x2'));var timeout=require('connect-timeout');var express=require(_0xd4f9('0x3'));var router=express[_0xd4f9('0x4')]();var fs_extra=require(_0xd4f9('0x5'));var auth=require(_0xd4f9('0x6'));var interaction=require(_0xd4f9('0x7'));var config=require('../../config/environment');var controller=require('./chatInternalMessage.controller');router[_0xd4f9('0x8')]('/',auth[_0xd4f9('0x9')](),controller['index']);router[_0xd4f9('0x8')](_0xd4f9('0xa'),auth[_0xd4f9('0x9')](),controller[_0xd4f9('0xb')]);router['get'](_0xd4f9('0xc'),auth[_0xd4f9('0x9')](),controller[_0xd4f9('0xd')]);router[_0xd4f9('0x8')]('/:id',auth[_0xd4f9('0x9')](),controller[_0xd4f9('0xe')]);router[_0xd4f9('0xf')]('/',auth[_0xd4f9('0x9')](),controller[_0xd4f9('0x10')]);router[_0xd4f9('0x11')]('/:id',controller[_0xd4f9('0x12')]);router[_0xd4f9('0x13')]('/:id',auth[_0xd4f9('0x9')](),controller[_0xd4f9('0x14')]);module[_0xd4f9('0x15')]=router; \ No newline at end of file +var _0x2ff7=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','getUsers','/:id','show','create','put','update','delete','destroy','multer','util'];(function(_0x448422,_0x362248){var _0xcc0afd=function(_0x576b07){while(--_0x576b07){_0x448422['push'](_0x448422['shift']());}};_0xcc0afd(++_0x362248);}(_0x2ff7,0xbb));var _0x72ff=function(_0x5223de,_0xb0a127){_0x5223de=_0x5223de-0x0;var _0x4a52ee=_0x2ff7[_0x5223de];return _0x4a52ee;};'use strict';var multer=require(_0x72ff('0x0'));var util=require(_0x72ff('0x1'));var path=require('path');var timeout=require(_0x72ff('0x2'));var express=require(_0x72ff('0x3'));var router=express[_0x72ff('0x4')]();var fs_extra=require(_0x72ff('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x72ff('0x6'));var config=require(_0x72ff('0x7'));var controller=require(_0x72ff('0x8'));router[_0x72ff('0x9')]('/',auth[_0x72ff('0xa')](),controller['index']);router[_0x72ff('0x9')](_0x72ff('0xb'),auth[_0x72ff('0xa')](),controller[_0x72ff('0xc')]);router[_0x72ff('0x9')]('/users',auth[_0x72ff('0xa')](),controller[_0x72ff('0xd')]);router[_0x72ff('0x9')](_0x72ff('0xe'),auth[_0x72ff('0xa')](),controller[_0x72ff('0xf')]);router['post']('/',auth[_0x72ff('0xa')](),controller[_0x72ff('0x10')]);router[_0x72ff('0x11')](_0x72ff('0xe'),controller[_0x72ff('0x12')]);router[_0x72ff('0x13')](_0x72ff('0xe'),auth[_0x72ff('0xa')](),controller[_0x72ff('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index cda2f42..ebe9587 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 _0x9c9b=['TEXT','medium','BOOLEAN','out','exports'];(function(_0x452144,_0x170931){var _0x37f223=function(_0x32d7b8){while(--_0x32d7b8){_0x452144['push'](_0x452144['shift']());}};_0x37f223(++_0x170931);}(_0x9c9b,0x194));var _0xb9c9=function(_0x2038d4,_0x393888){_0x2038d4=_0x2038d4-0x0;var _0x2d65dd=_0x9c9b[_0x2038d4];return _0x2d65dd;};'use strict';var Sequelize=require('sequelize');module[_0xb9c9('0x0')]={'body':{'type':Sequelize[_0xb9c9('0x1')](_0xb9c9('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb9c9('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb9c9('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb9c9('0x4')),'defaultValue':_0xb9c9('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4849=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x52923d,_0x1c45a4){var _0x56ec0e=function(_0x27630c){while(--_0x27630c){_0x52923d['push'](_0x52923d['shift']());}};_0x56ec0e(++_0x1c45a4);}(_0x4849,0xf8));var _0x9484=function(_0x3db99c,_0xd75b6f){_0x3db99c=_0x3db99c-0x0;var _0xf5263b=_0x4849[_0x3db99c];return _0xf5263b;};'use strict';var Sequelize=require(_0x9484('0x0'));module[_0x9484('0x1')]={'body':{'type':Sequelize[_0x9484('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x9484('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9484('0x4')]('in',_0x9484('0x5')),'defaultValue':_0x9484('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x9484('0x6')]},'providerName':{'type':Sequelize[_0x9484('0x7')]},'providerResponse':{'type':Sequelize[_0x9484('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 0f10a74..7905795 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 _0x753c=['query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','accept','chat','acceptMessage','reject','UserId','user','get','ChatInteractionId','role','RejectMessage','rejectMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','interface','format','SIP/%s','channel','EventManager','parse','interaction','util','lodash','ioredis','../../components/interaction/service','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','http','chat-interactions','request','then','info','request\x20sent','debug','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','status','json','undefined','count','offset','set','Content-Range','update','sendStatus','stack','name','send','index','ChatMessage','key','map'];(function(_0x5cfb75,_0x224a85){var _0x2613d6=function(_0x4f1a6b){while(--_0x4f1a6b){_0x5cfb75['push'](_0x5cfb75['shift']());}};_0x2613d6(++_0x224a85);}(_0x753c,0xfd));var _0xc753=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x753c[_0x3947c9];return _0x2e7871;};'use strict';var util=require(_0xc753('0x0'));var _=require(_0xc753('0x1'));var Redis=require(_0xc753('0x2'));var interactionService=require(_0xc753('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xc753('0x4'));var config=require(_0xc753('0x5'));var db=require(_0xc753('0x6'))['db'];config[_0xc753('0x7')]=_[_0xc753('0x8')](config[_0xc753('0x7')],{'host':_0xc753('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc753('0x7')]));require(_0xc753('0xa'))[_0xc753('0xb')](socket);var jayson=require(_0xc753('0xc'));var client=jayson['client'][_0xc753('0xd')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var interaction_log=require('../../config/logger')(_0xc753('0xe'));function respondWithRpcPromise(_0x144afb,_0x334b9e,_0x175ed6,_0x2d7b08){return new Promise(function(_0x164290,_0x22f5c0){var _0x15967d=_0x2d7b08||client;return _0x15967d[_0xc753('0xf')](_0x144afb,_0x175ed6)[_0xc753('0x10')](function(_0x480139){logger[_0xc753('0x11')]('ChatMessage,\x20%s,\x20%s',_0x334b9e,_0xc753('0x12'));logger[_0xc753('0x13')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x334b9e,_0xc753('0x12'),JSON[_0xc753('0x14')](_0x480139));if(_0x480139[_0xc753('0x15')]){if(_0x480139['error'][_0xc753('0x16')]===0x1f4){logger[_0xc753('0x15')](_0xc753('0x17'),_0x334b9e,_0x480139[_0xc753('0x15')][_0xc753('0x18')]);return _0x22f5c0(_0x480139['error'][_0xc753('0x18')]);}logger[_0xc753('0x15')](_0xc753('0x17'),_0x334b9e,_0x480139[_0xc753('0x15')]['message']);return _0x164290(_0x480139[_0xc753('0x15')][_0xc753('0x18')]);}else{logger[_0xc753('0x11')](_0xc753('0x17'),_0x334b9e,_0xc753('0x12'));_0x164290(_0x480139['result'][_0xc753('0x18')]);}})['catch'](function(_0x5094f7){logger[_0xc753('0x15')](_0xc753('0x17'),_0x334b9e,_0x5094f7);_0x22f5c0(_0x5094f7);});});}function respondWithResult(_0x3cd0e5,_0x354e86){_0x354e86=_0x354e86||0xc8;return function(_0x426499){if(_0x426499){return _0x3cd0e5[_0xc753('0x19')](_0x354e86)[_0xc753('0x1a')](_0x426499);}};}function respondWithFilteredResult(_0xae7cdd,_0x35c9af){return function(_0x3a2797){if(_0x3a2797){var _0x242050=typeof _0x35c9af['offset']==='undefined'&&typeof _0x35c9af['limit']===_0xc753('0x1b');var _0x46512e=_0x3a2797[_0xc753('0x1c')];var _0xffdd44=_0x242050?0x0:_0x35c9af[_0xc753('0x1d')];var _0x54adb2=_0x242050?_0x3a2797['count']:_0x35c9af[_0xc753('0x1d')]+_0x35c9af['limit'];var _0x53d831;if(_0x54adb2>=_0x46512e){_0x54adb2=_0x46512e;_0x53d831=0xc8;}else{_0x53d831=0xce;}_0xae7cdd[_0xc753('0x19')](_0x53d831);return _0xae7cdd[_0xc753('0x1e')](_0xc753('0x1f'),_0xffdd44+'-'+_0x54adb2+'/'+_0x46512e)[_0xc753('0x1a')](_0x3a2797);}return null;};}function saveUpdates(_0x3a742e){return function(_0x2e6ede){if(_0x2e6ede){return _0x2e6ede[_0xc753('0x20')](_0x3a742e)['then'](function(_0x2f1544){return _0x2f1544;});}return null;};}function removeEntity(_0x35f51d){return function(_0x56a74f){if(_0x56a74f){return _0x56a74f['destroy']()['then'](function(){_0x35f51d[_0xc753('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x501c31){return function(_0x2809d8){if(!_0x2809d8){_0x501c31[_0xc753('0x21')](0x194);}return _0x2809d8;};}function handleError(_0x562895,_0x4af7f7){_0x4af7f7=_0x4af7f7||0x1f4;return function(_0x24c15d){logger['error'](_0x24c15d[_0xc753('0x22')]);if(_0x24c15d[_0xc753('0x23')]){delete _0x24c15d['name'];}_0x562895[_0xc753('0x19')](_0x4af7f7)[_0xc753('0x24')](_0x24c15d);};}exports[_0xc753('0x25')]=function(_0x2c0d3c,_0x460bd8){var _0x387e66={},_0x48cbad={},_0x2808d1={'count':0x0,'rows':[]};var _0x5ebb4d=_['map'](db[_0xc753('0x26')]['rawAttributes'],function(_0x37c96b){return{'name':_0x37c96b['fieldName'],'type':_0x37c96b['type'][_0xc753('0x27')]};});_0x48cbad['model']=_[_0xc753('0x28')](_0x5ebb4d,_0xc753('0x23'));_0x48cbad[_0xc753('0x29')]=_[_0xc753('0x2a')](_0x2c0d3c['query']);_0x48cbad[_0xc753('0x2b')]=_[_0xc753('0x2c')](_0x48cbad[_0xc753('0x2d')],_0x48cbad[_0xc753('0x29')]);_0x387e66[_0xc753('0x2e')]=_[_0xc753('0x2c')](_0x48cbad[_0xc753('0x2d')],qs[_0xc753('0x2f')](_0x2c0d3c[_0xc753('0x29')][_0xc753('0x2f')]));_0x387e66[_0xc753('0x2e')]=_0x387e66[_0xc753('0x2e')][_0xc753('0x30')]?_0x387e66[_0xc753('0x2e')]:_0x48cbad[_0xc753('0x2d')];if(!_0x2c0d3c[_0xc753('0x29')][_0xc753('0x31')](_0xc753('0x32'))){_0x387e66[_0xc753('0x33')]=qs['limit'](_0x2c0d3c[_0xc753('0x29')]['limit']);_0x387e66[_0xc753('0x1d')]=qs[_0xc753('0x1d')](_0x2c0d3c[_0xc753('0x29')]['offset']);}_0x387e66[_0xc753('0x34')]=qs['sort'](_0x2c0d3c[_0xc753('0x29')][_0xc753('0x35')]);_0x387e66['where']=qs[_0xc753('0x2b')](_[_0xc753('0x36')](_0x2c0d3c[_0xc753('0x29')],_0x48cbad[_0xc753('0x2b')]),_0x5ebb4d);if(_0x2c0d3c['query'][_0xc753('0x37')]){_0x387e66[_0xc753('0x38')]=_[_0xc753('0x39')](_0x387e66['where'],{'$or':_[_0xc753('0x28')](_0x5ebb4d,function(_0x21c760){if(_0x21c760[_0xc753('0x3a')]!==_0xc753('0x3b')){var _0x56ee1a={};_0x56ee1a[_0x21c760[_0xc753('0x23')]]={'$like':'%'+_0x2c0d3c[_0xc753('0x29')][_0xc753('0x37')]+'%'};return _0x56ee1a;}})});}_0x387e66=_['merge']({},_0x387e66,_0x2c0d3c[_0xc753('0x3c')]);var _0x385193={'where':_0x387e66[_0xc753('0x38')]};return db['ChatMessage']['count'](_0x385193)[_0xc753('0x10')](function(_0x472f18){_0x2808d1[_0xc753('0x1c')]=_0x472f18;if(_0x2c0d3c[_0xc753('0x29')][_0xc753('0x3d')]){_0x387e66['include']=[{'all':!![]}];}return db[_0xc753('0x26')][_0xc753('0x3e')](_0x387e66);})[_0xc753('0x10')](function(_0x3c29ec){_0x2808d1[_0xc753('0x3f')]=_0x3c29ec;return _0x2808d1;})['then'](respondWithFilteredResult(_0x460bd8,_0x387e66))[_0xc753('0x40')](handleError(_0x460bd8,null));};exports[_0xc753('0x41')]=function(_0x1e1d05,_0x3b97f5){var _0x50b420={'raw':!![],'where':{'id':_0x1e1d05[_0xc753('0x42')]['id']}},_0x27d3f3={};_0x27d3f3['model']=_[_0xc753('0x2a')](db[_0xc753('0x26')][_0xc753('0x43')]);_0x27d3f3[_0xc753('0x29')]=_[_0xc753('0x2a')](_0x1e1d05[_0xc753('0x29')]);_0x27d3f3[_0xc753('0x2b')]=_[_0xc753('0x2c')](_0x27d3f3['model'],_0x27d3f3[_0xc753('0x29')]);_0x50b420[_0xc753('0x2e')]=_[_0xc753('0x2c')](_0x27d3f3['model'],qs[_0xc753('0x2f')](_0x1e1d05[_0xc753('0x29')]['fields']));_0x50b420['attributes']=_0x50b420[_0xc753('0x2e')]['length']?_0x50b420[_0xc753('0x2e')]:_0x27d3f3['model'];if(_0x1e1d05[_0xc753('0x29')][_0xc753('0x3d')]){_0x50b420['include']=[{'all':!![]}];}_0x50b420=_['merge']({},_0x50b420,_0x1e1d05[_0xc753('0x3c')]);return db[_0xc753('0x26')]['find'](_0x50b420)[_0xc753('0x10')](handleEntityNotFound(_0x3b97f5,null))[_0xc753('0x10')](respondWithResult(_0x3b97f5,null))['catch'](handleError(_0x3b97f5,null));};exports[_0xc753('0x44')]=function(_0x4fe238,_0x1b74f5){return db[_0xc753('0x26')][_0xc753('0x44')](_0x4fe238['body'],{})['then'](respondWithResult(_0x1b74f5,0xc9))[_0xc753('0x40')](handleError(_0x1b74f5,null));};exports['update']=function(_0x4309c9,_0x86ceb3){if(_0x4309c9[_0xc753('0x45')]['id']){delete _0x4309c9['body']['id'];}return db[_0xc753('0x26')][_0xc753('0x46')]({'where':{'id':_0x4309c9[_0xc753('0x42')]['id']}})['then'](handleEntityNotFound(_0x86ceb3,null))[_0xc753('0x10')](saveUpdates(_0x4309c9[_0xc753('0x45')],null))['then'](respondWithResult(_0x86ceb3,null))[_0xc753('0x40')](handleError(_0x86ceb3,null));};exports['destroy']=function(_0x36c5db,_0x518790){return db[_0xc753('0x26')][_0xc753('0x46')]({'where':{'id':_0x36c5db[_0xc753('0x42')]['id']}})['then'](handleEntityNotFound(_0x518790,null))[_0xc753('0x10')](removeEntity(_0x518790,null))[_0xc753('0x40')](handleError(_0x518790,null));};exports[_0xc753('0x47')]=function(_0x33ed94,_0x1bbdcc){return db['ChatMessage'][_0xc753('0x47')]()[_0xc753('0x10')](respondWithResult(_0x1bbdcc,null))[_0xc753('0x40')](handleError(_0x1bbdcc,null));};exports[_0xc753('0x48')]=function(_0x397ab4,_0x28a80f){var _0x38da44=_0xc753('0x49');return interactionService[_0xc753('0x4a')](_0x397ab4,_0x38da44)['then'](respondWithResult(_0x28a80f,null))[_0xc753('0x40')](handleError(_0x28a80f,null));};exports[_0xc753('0x4b')]=function(_0x212f33,_0x1229d2){var _0x5a619c={'agent':{},'channel':_0xc753('0x49')};if(_0x212f33[_0xc753('0x45')]['id']){delete _0x212f33['body']['id'];}_0x212f33[_0xc753('0x45')]['UserId']=_0x212f33[_0xc753('0x45')][_0xc753('0x4c')]||_0x212f33[_0xc753('0x4d')]['id'];_0x5a619c['agent']['id']=_0x212f33[_0xc753('0x45')]['UserId'];return db[_0xc753('0x26')][_0xc753('0x46')]({'where':{'id':_0x212f33['params']['id'],'UserId':null}})[_0xc753('0x10')](handleEntityNotFound(_0x1229d2,null))['then'](function(_0x14120){if(_0x14120){_0x5a619c['message']=_0x14120[_0xc753('0x4e')]({'plain':!![]});return db['ChatInteraction'][_0xc753('0x46')]({'where':{'id':_0x14120[_0xc753('0x4f')]}});}return null;})[_0xc753('0x10')](handleEntityNotFound(_0x1229d2,null))[_0xc753('0x10')](function(_0x2958bc){if(_0x2958bc){_0x5a619c['interaction']=_0x2958bc[_0xc753('0x4e')]({'plain':!![]});interaction_log[_0xc753('0x11')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x212f33[_0xc753('0x4d')]['id'],_0x212f33[_0xc753('0x4d')][_0xc753('0x23')],_0x212f33['user'][_0xc753('0x50')],_0x5a619c['interaction']['id'],_0x212f33[_0xc753('0x45')]?JSON['stringify'](_0x212f33['body']):'null');return respondWithRpcPromise(_0xc753('0x51'),_0xc753('0x52'),_0x5a619c);}return null;})['then'](function(_0x33f3e3){var _0x51747f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x33f3e3[_0xc753('0x18')][_0xc753('0x53')];return db['sequelize']['query'](_0x51747f,{'type':db[_0xc753('0x54')][_0xc753('0x55')][_0xc753('0x56')],'raw':!![]})[_0xc753('0x10')](function(_0x3c59f3){return _0x3c59f3;});})[_0xc753('0x10')](function(_0x27a1fd){if(_0x27a1fd){_0x5a619c[_0xc753('0x18')][_0xc753('0x57')]=_0x27a1fd[0x0];if(!_0x212f33[_0xc753('0x45')][_0xc753('0x4c')])return;return db[_0xc753('0x58')]['find']({'where':{'id':_0x212f33[_0xc753('0x45')]['UserId'],'role':'agent'},'attributes':['id','name',_0xc753('0x59'),'email',_0xc753('0x5a')],'raw':!![]});}return null;})[_0xc753('0x10')](function(_0x53d577){if(!_0x53d577)return null;_0x5a619c[_0xc753('0x18')]['agent']=_0x53d577;return _0x5a619c;})['then'](function(_0x3ba3c9){if(_0x3ba3c9){_0x3ba3c9[_0xc753('0x18')][_0xc753('0x5b')]=util[_0xc753('0x5c')](_0xc753('0x5d'),_0x212f33[_0xc753('0x4d')]['name']);_0x3ba3c9[_0xc753('0x18')][_0xc753('0x5e')]=_0x5a619c[_0xc753('0x5e')];_0x3ba3c9['message']['motionChannel']=_0x5a619c[_0xc753('0x5e')];_0x3ba3c9[_0xc753('0x18')]['event']='reject';respondWithRpcPromise('EventManager',_0xc753('0x5f'),{'event':'rejectmessage','message':_[_0xc753('0x39')](_0x5a619c[_0xc753('0x18')],JSON[_0xc753('0x60')](_0x5a619c[_0xc753('0x61')]['formData']))},client9002);return _0x5a619c;}return null;})[_0xc753('0x10')](respondWithResult(_0x1229d2,null))['catch'](handleError(_0x1229d2,null));}; \ No newline at end of file +var _0xf6c6=['find','create','update','body','destroy','describe','accept','acceptMessage','reject','chat','UserId','agent','get','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','fullname','email','internal','format','SIP/%s','channel','event','EventManager','rejectmessage','interaction','formData','util','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./chatMessage.socket','register','jayson/promise','http','client','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','limit','undefined','count','Content-Range','then','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','ChatMessage','includeAll','include','findAll','rows','show','params','keys'];(function(_0x4f6173,_0xe63497){var _0x2eb711=function(_0x2b0c38){while(--_0x2b0c38){_0x4f6173['push'](_0x4f6173['shift']());}};_0x2eb711(++_0xe63497);}(_0xf6c6,0x8d));var _0x6f6c=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xf6c6[_0x44946b];return _0x249bc4;};'use strict';var util=require(_0x6f6c('0x0'));var _=require(_0x6f6c('0x1'));var Redis=require(_0x6f6c('0x2'));var interactionService=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0x6f6c('0x3'))(_0x6f6c('0x4'));var config=require(_0x6f6c('0x5'));var db=require(_0x6f6c('0x6'))['db'];config['redis']=_[_0x6f6c('0x7')](config[_0x6f6c('0x8')],{'host':_0x6f6c('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6f6c('0xa'))[_0x6f6c('0xb')](socket);var jayson=require(_0x6f6c('0xc'));var client=jayson['client'][_0x6f6c('0xd')]({'port':0x232c});var client9002=jayson[_0x6f6c('0xe')][_0x6f6c('0xd')]({'port':0x232a});var interaction_log=require(_0x6f6c('0x3'))('chat-interactions');function respondWithRpcPromise(_0x32bd1a,_0x5ec938,_0x2f352d,_0xe0b67f){return new Promise(function(_0x2bbeb9,_0xf79d2d){var _0x452a02=_0xe0b67f||client;return _0x452a02[_0x6f6c('0xf')](_0x32bd1a,_0x2f352d)['then'](function(_0x2cb519){logger[_0x6f6c('0x10')](_0x6f6c('0x11'),_0x5ec938,_0x6f6c('0x12'));logger['debug'](_0x6f6c('0x13'),_0x5ec938,_0x6f6c('0x12'),JSON[_0x6f6c('0x14')](_0x2cb519));if(_0x2cb519[_0x6f6c('0x15')]){if(_0x2cb519[_0x6f6c('0x15')][_0x6f6c('0x16')]===0x1f4){logger['error'](_0x6f6c('0x11'),_0x5ec938,_0x2cb519[_0x6f6c('0x15')][_0x6f6c('0x17')]);return _0xf79d2d(_0x2cb519[_0x6f6c('0x15')][_0x6f6c('0x17')]);}logger[_0x6f6c('0x15')]('ChatMessage,\x20%s,\x20%s',_0x5ec938,_0x2cb519[_0x6f6c('0x15')][_0x6f6c('0x17')]);return _0x2bbeb9(_0x2cb519[_0x6f6c('0x15')]['message']);}else{logger['info'](_0x6f6c('0x11'),_0x5ec938,_0x6f6c('0x12'));_0x2bbeb9(_0x2cb519[_0x6f6c('0x18')][_0x6f6c('0x17')]);}})[_0x6f6c('0x19')](function(_0x3bd6c0){logger[_0x6f6c('0x15')](_0x6f6c('0x11'),_0x5ec938,_0x3bd6c0);_0xf79d2d(_0x3bd6c0);});});}function respondWithResult(_0x3184d7,_0x43d288){_0x43d288=_0x43d288||0xc8;return function(_0x2ecf8a){if(_0x2ecf8a){return _0x3184d7[_0x6f6c('0x1a')](_0x43d288)[_0x6f6c('0x1b')](_0x2ecf8a);}};}function respondWithFilteredResult(_0x56ea08,_0x5f17da){return function(_0x4842ee){if(_0x4842ee){var _0x14f811=typeof _0x5f17da[_0x6f6c('0x1c')]==='undefined'&&typeof _0x5f17da[_0x6f6c('0x1d')]===_0x6f6c('0x1e');var _0x58fdaa=_0x4842ee[_0x6f6c('0x1f')];var _0x42a7f3=_0x14f811?0x0:_0x5f17da[_0x6f6c('0x1c')];var _0x47673e=_0x14f811?_0x4842ee[_0x6f6c('0x1f')]:_0x5f17da['offset']+_0x5f17da[_0x6f6c('0x1d')];var _0x1fa26a;if(_0x47673e>=_0x58fdaa){_0x47673e=_0x58fdaa;_0x1fa26a=0xc8;}else{_0x1fa26a=0xce;}_0x56ea08[_0x6f6c('0x1a')](_0x1fa26a);return _0x56ea08['set'](_0x6f6c('0x20'),_0x42a7f3+'-'+_0x47673e+'/'+_0x58fdaa)[_0x6f6c('0x1b')](_0x4842ee);}return null;};}function saveUpdates(_0xf39934){return function(_0x3c03b2){if(_0x3c03b2){return _0x3c03b2['update'](_0xf39934)[_0x6f6c('0x21')](function(_0x295fea){return _0x295fea;});}return null;};}function removeEntity(_0x5031f7){return function(_0x13496e){if(_0x13496e){return _0x13496e['destroy']()[_0x6f6c('0x21')](function(){_0x5031f7[_0x6f6c('0x1a')](0xcc)[_0x6f6c('0x22')]();});}};}function handleEntityNotFound(_0x12aff5){return function(_0x172a7a){if(!_0x172a7a){_0x12aff5[_0x6f6c('0x23')](0x194);}return _0x172a7a;};}function handleError(_0x21d80f,_0xaf4f){_0xaf4f=_0xaf4f||0x1f4;return function(_0x15212e){logger[_0x6f6c('0x15')](_0x15212e[_0x6f6c('0x24')]);if(_0x15212e[_0x6f6c('0x25')]){delete _0x15212e['name'];}_0x21d80f['status'](_0xaf4f)[_0x6f6c('0x26')](_0x15212e);};}exports[_0x6f6c('0x27')]=function(_0x4f5590,_0x1f55e3){var _0xdfcd78={},_0xe6f2b0={},_0x5b4156={'count':0x0,'rows':[]};var _0x150545=_[_0x6f6c('0x28')](db['ChatMessage'][_0x6f6c('0x29')],function(_0x5121b8){return{'name':_0x5121b8[_0x6f6c('0x2a')],'type':_0x5121b8[_0x6f6c('0x2b')][_0x6f6c('0x2c')]};});_0xe6f2b0['model']=_[_0x6f6c('0x28')](_0x150545,_0x6f6c('0x25'));_0xe6f2b0[_0x6f6c('0x2d')]=_['keys'](_0x4f5590[_0x6f6c('0x2d')]);_0xe6f2b0[_0x6f6c('0x2e')]=_[_0x6f6c('0x2f')](_0xe6f2b0[_0x6f6c('0x30')],_0xe6f2b0['query']);_0xdfcd78[_0x6f6c('0x31')]=_['intersection'](_0xe6f2b0[_0x6f6c('0x30')],qs[_0x6f6c('0x32')](_0x4f5590[_0x6f6c('0x2d')]['fields']));_0xdfcd78[_0x6f6c('0x31')]=_0xdfcd78['attributes'][_0x6f6c('0x33')]?_0xdfcd78[_0x6f6c('0x31')]:_0xe6f2b0[_0x6f6c('0x30')];if(!_0x4f5590['query'][_0x6f6c('0x34')]('nolimit')){_0xdfcd78['limit']=qs['limit'](_0x4f5590[_0x6f6c('0x2d')]['limit']);_0xdfcd78[_0x6f6c('0x1c')]=qs[_0x6f6c('0x1c')](_0x4f5590[_0x6f6c('0x2d')][_0x6f6c('0x1c')]);}_0xdfcd78[_0x6f6c('0x35')]=qs[_0x6f6c('0x36')](_0x4f5590[_0x6f6c('0x2d')][_0x6f6c('0x36')]);_0xdfcd78['where']=qs[_0x6f6c('0x2e')](_[_0x6f6c('0x37')](_0x4f5590[_0x6f6c('0x2d')],_0xe6f2b0['filters']),_0x150545);if(_0x4f5590[_0x6f6c('0x2d')][_0x6f6c('0x38')]){_0xdfcd78[_0x6f6c('0x39')]=_[_0x6f6c('0x3a')](_0xdfcd78['where'],{'$or':_[_0x6f6c('0x28')](_0x150545,function(_0x15a03a){if(_0x15a03a[_0x6f6c('0x2b')]!==_0x6f6c('0x3b')){var _0xf31723={};_0xf31723[_0x15a03a[_0x6f6c('0x25')]]={'$like':'%'+_0x4f5590['query'][_0x6f6c('0x38')]+'%'};return _0xf31723;}})});}_0xdfcd78=_[_0x6f6c('0x3a')]({},_0xdfcd78,_0x4f5590[_0x6f6c('0x3c')]);var _0x3327d4={'where':_0xdfcd78[_0x6f6c('0x39')]};return db[_0x6f6c('0x3d')][_0x6f6c('0x1f')](_0x3327d4)['then'](function(_0x502f7d){_0x5b4156['count']=_0x502f7d;if(_0x4f5590[_0x6f6c('0x2d')][_0x6f6c('0x3e')]){_0xdfcd78[_0x6f6c('0x3f')]=[{'all':!![]}];}return db['ChatMessage'][_0x6f6c('0x40')](_0xdfcd78);})[_0x6f6c('0x21')](function(_0x31eaea){_0x5b4156[_0x6f6c('0x41')]=_0x31eaea;return _0x5b4156;})[_0x6f6c('0x21')](respondWithFilteredResult(_0x1f55e3,_0xdfcd78))[_0x6f6c('0x19')](handleError(_0x1f55e3,null));};exports[_0x6f6c('0x42')]=function(_0x1ab6a3,_0x3e5b33){var _0xe8ee2c={'raw':!![],'where':{'id':_0x1ab6a3[_0x6f6c('0x43')]['id']}},_0x4f14d1={};_0x4f14d1['model']=_[_0x6f6c('0x44')](db[_0x6f6c('0x3d')][_0x6f6c('0x29')]);_0x4f14d1[_0x6f6c('0x2d')]=_[_0x6f6c('0x44')](_0x1ab6a3['query']);_0x4f14d1['filters']=_[_0x6f6c('0x2f')](_0x4f14d1[_0x6f6c('0x30')],_0x4f14d1[_0x6f6c('0x2d')]);_0xe8ee2c[_0x6f6c('0x31')]=_[_0x6f6c('0x2f')](_0x4f14d1[_0x6f6c('0x30')],qs['fields'](_0x1ab6a3[_0x6f6c('0x2d')]['fields']));_0xe8ee2c[_0x6f6c('0x31')]=_0xe8ee2c[_0x6f6c('0x31')]['length']?_0xe8ee2c['attributes']:_0x4f14d1['model'];if(_0x1ab6a3['query'][_0x6f6c('0x3e')]){_0xe8ee2c[_0x6f6c('0x3f')]=[{'all':!![]}];}_0xe8ee2c=_[_0x6f6c('0x3a')]({},_0xe8ee2c,_0x1ab6a3[_0x6f6c('0x3c')]);return db[_0x6f6c('0x3d')][_0x6f6c('0x45')](_0xe8ee2c)[_0x6f6c('0x21')](handleEntityNotFound(_0x3e5b33,null))[_0x6f6c('0x21')](respondWithResult(_0x3e5b33,null))[_0x6f6c('0x19')](handleError(_0x3e5b33,null));};exports[_0x6f6c('0x46')]=function(_0x163235,_0x37d181){return db[_0x6f6c('0x3d')]['create'](_0x163235['body'],{})['then'](respondWithResult(_0x37d181,0xc9))[_0x6f6c('0x19')](handleError(_0x37d181,null));};exports[_0x6f6c('0x47')]=function(_0x34f07e,_0x13ca9a){if(_0x34f07e[_0x6f6c('0x48')]['id']){delete _0x34f07e[_0x6f6c('0x48')]['id'];}return db[_0x6f6c('0x3d')][_0x6f6c('0x45')]({'where':{'id':_0x34f07e['params']['id']}})[_0x6f6c('0x21')](handleEntityNotFound(_0x13ca9a,null))[_0x6f6c('0x21')](saveUpdates(_0x34f07e[_0x6f6c('0x48')],null))['then'](respondWithResult(_0x13ca9a,null))[_0x6f6c('0x19')](handleError(_0x13ca9a,null));};exports[_0x6f6c('0x49')]=function(_0x141e54,_0x567356){return db[_0x6f6c('0x3d')][_0x6f6c('0x45')]({'where':{'id':_0x141e54[_0x6f6c('0x43')]['id']}})[_0x6f6c('0x21')](handleEntityNotFound(_0x567356,null))[_0x6f6c('0x21')](removeEntity(_0x567356,null))[_0x6f6c('0x19')](handleError(_0x567356,null));};exports[_0x6f6c('0x4a')]=function(_0x156061,_0x579672){return db[_0x6f6c('0x3d')]['describe']()[_0x6f6c('0x21')](respondWithResult(_0x579672,null))[_0x6f6c('0x19')](handleError(_0x579672,null));};exports[_0x6f6c('0x4b')]=function(_0x3f7c78,_0x241acc){var _0x5c18d3='chat';return interactionService[_0x6f6c('0x4c')](_0x3f7c78,_0x5c18d3)[_0x6f6c('0x21')](respondWithResult(_0x241acc,null))[_0x6f6c('0x19')](handleError(_0x241acc,null));};exports[_0x6f6c('0x4d')]=function(_0x49cb28,_0x310f6f){var _0x14efff={'agent':{},'channel':_0x6f6c('0x4e')};if(_0x49cb28[_0x6f6c('0x48')]['id']){delete _0x49cb28['body']['id'];}_0x49cb28['body']['UserId']=_0x49cb28[_0x6f6c('0x48')][_0x6f6c('0x4f')]||_0x49cb28['user']['id'];_0x14efff[_0x6f6c('0x50')]['id']=_0x49cb28['body'][_0x6f6c('0x4f')];return db[_0x6f6c('0x3d')][_0x6f6c('0x45')]({'where':{'id':_0x49cb28[_0x6f6c('0x43')]['id'],'UserId':null}})[_0x6f6c('0x21')](handleEntityNotFound(_0x310f6f,null))[_0x6f6c('0x21')](function(_0x1ef112){if(_0x1ef112){_0x14efff['message']=_0x1ef112[_0x6f6c('0x51')]({'plain':!![]});return db[_0x6f6c('0x52')][_0x6f6c('0x45')]({'where':{'id':_0x1ef112['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x310f6f,null))['then'](function(_0x44526f){if(_0x44526f){_0x14efff['interaction']=_0x44526f['get']({'plain':!![]});interaction_log[_0x6f6c('0x10')](_0x6f6c('0x53'),_0x49cb28[_0x6f6c('0x54')]['id'],_0x49cb28[_0x6f6c('0x54')][_0x6f6c('0x25')],_0x49cb28[_0x6f6c('0x54')][_0x6f6c('0x55')],_0x14efff['interaction']['id'],_0x49cb28[_0x6f6c('0x48')]?JSON['stringify'](_0x49cb28[_0x6f6c('0x48')]):_0x6f6c('0x56'));return respondWithRpcPromise(_0x6f6c('0x57'),_0x6f6c('0x58'),_0x14efff);}return null;})[_0x6f6c('0x21')](function(_0x23c02b){var _0x3e7aa0=_0x6f6c('0x59')+_0x23c02b['message'][_0x6f6c('0x5a')];return db[_0x6f6c('0x5b')][_0x6f6c('0x2d')](_0x3e7aa0,{'type':db['Sequelize'][_0x6f6c('0x5c')][_0x6f6c('0x5d')],'raw':!![]})['then'](function(_0x682fa){return _0x682fa;});})[_0x6f6c('0x21')](function(_0xcc6ced){if(_0xcc6ced){_0x14efff[_0x6f6c('0x17')]['contact']=_0xcc6ced[0x0];if(!_0x49cb28['body'][_0x6f6c('0x4f')])return;return db['User']['find']({'where':{'id':_0x49cb28[_0x6f6c('0x48')]['UserId'],'role':_0x6f6c('0x50')},'attributes':['id',_0x6f6c('0x25'),_0x6f6c('0x5e'),_0x6f6c('0x5f'),_0x6f6c('0x60')],'raw':!![]});}return null;})['then'](function(_0x29aa17){if(!_0x29aa17)return null;_0x14efff[_0x6f6c('0x17')][_0x6f6c('0x50')]=_0x29aa17;return _0x14efff;})[_0x6f6c('0x21')](function(_0x371760){if(_0x371760){_0x371760[_0x6f6c('0x17')]['interface']=util[_0x6f6c('0x61')](_0x6f6c('0x62'),_0x49cb28[_0x6f6c('0x54')]['name']);_0x371760[_0x6f6c('0x17')][_0x6f6c('0x63')]=_0x14efff[_0x6f6c('0x63')];_0x371760[_0x6f6c('0x17')]['motionChannel']=_0x14efff['channel'];_0x371760['message'][_0x6f6c('0x64')]=_0x6f6c('0x4d');respondWithRpcPromise(_0x6f6c('0x65'),_0x6f6c('0x65'),{'event':_0x6f6c('0x66'),'message':_[_0x6f6c('0x3a')](_0x14efff['message'],JSON['parse'](_0x14efff[_0x6f6c('0x67')][_0x6f6c('0x68')]))},client9002);return _0x14efff;}return null;})[_0x6f6c('0x21')](respondWithResult(_0x310f6f,null))[_0x6f6c('0x19')](handleError(_0x310f6f,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index c0a4105..c26a15d 100644 --- a/server/api/chatMessage/chatMessage.events.js +++ b/server/api/chatMessage/chatMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe33a=['exports','events','../../mysqldb','ChatMessage','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x2b81be,_0x544bdf){var _0x8ed4a7=function(_0x4a7bf4){while(--_0x4a7bf4){_0x2b81be['push'](_0x2b81be['shift']());}};_0x8ed4a7(++_0x544bdf);}(_0xe33a,0x106));var _0xae33=function(_0x21e2e7,_0x5d28ae){_0x21e2e7=_0x21e2e7-0x0;var _0x4fb468=_0xe33a[_0x21e2e7];return _0x4fb468;};'use strict';var EventEmitter=require(_0xae33('0x0'));var ChatMessage=require(_0xae33('0x1'))['db'][_0xae33('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xae33('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xae33('0x4')};function emitEvent(_0xe56fd){return function(_0x1c1774,_0x2788a9,_0xab24d0){ChatMessageEvents[_0xae33('0x5')](_0xe56fd+':'+_0x1c1774['id'],_0x1c1774);ChatMessageEvents[_0xae33('0x5')](_0xe56fd,_0x1c1774);_0xab24d0(null);};}for(var e in events){if(events[_0xae33('0x6')](e)){var event=events[e];ChatMessage[_0xae33('0x7')](e,emitEvent(event));}}module[_0xae33('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x2a0a=['save','remove','emit','hasOwnProperty','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x5e7361,_0x31140d){var _0x248a05=function(_0x292e2c){while(--_0x292e2c){_0x5e7361['push'](_0x5e7361['shift']());}};_0x248a05(++_0x31140d);}(_0x2a0a,0x1e4));var _0xa2a0=function(_0x4a1b40,_0x3b0b46){_0x4a1b40=_0x4a1b40-0x0;var _0x268522=_0x2a0a[_0x4a1b40];return _0x268522;};'use strict';var EventEmitter=require(_0xa2a0('0x0'));var ChatMessage=require(_0xa2a0('0x1'))['db'][_0xa2a0('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa2a0('0x3')](0x0);var events={'afterCreate':_0xa2a0('0x4'),'afterUpdate':'update','afterDestroy':_0xa2a0('0x5')};function emitEvent(_0x22012d){return function(_0x371d2f,_0x2b000a,_0x94948){ChatMessageEvents[_0xa2a0('0x6')](_0x22012d+':'+_0x371d2f['id'],_0x371d2f);ChatMessageEvents[_0xa2a0('0x6')](_0x22012d,_0x371d2f);_0x94948(null);};}for(var e in events){if(events[_0xa2a0('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index eb5743c..f1674a7 100644 --- a/server/api/chatMessage/chatMessage.model.js +++ b/server/api/chatMessage/chatMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa157=['../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','ChatInteraction','ChatInteractionId','then','createdAt','catch','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x10d34b,_0x4fef76){var _0x92b0bf=function(_0x16e291){while(--_0x16e291){_0x10d34b['push'](_0x10d34b['shift']());}};_0x92b0bf(++_0x4fef76);}(_0xa157,0xf5));var _0x7a15=function(_0x81a64b,_0x1d5afd){_0x81a64b=_0x81a64b-0x0;var _0xd196a2=_0xa157[_0x81a64b];return _0xd196a2;};'use strict';var _=require(_0x7a15('0x0'));var util=require(_0x7a15('0x1'));var logger=require('../../config/logger')(_0x7a15('0x2'));var moment=require('moment');var BPromise=require(_0x7a15('0x3'));var rp=require(_0x7a15('0x4'));var fs=require('fs');var path=require(_0x7a15('0x5'));var rimraf=require(_0x7a15('0x6'));var config=require(_0x7a15('0x7'));var attributes=require(_0x7a15('0x8'));module[_0x7a15('0x9')]=function(_0x3b87be,_0xabbc28){return _0x3b87be[_0x7a15('0xa')](_0x7a15('0xb'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x7a15('0xc'),'fields':[_0x7a15('0xd')],'type':_0x7a15('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ce43c,_0x120771,_0x41733d){var _0x237947=_0x3b87be[_0x7a15('0xf')];var _0x196ded=_0x3ce43c[_0x7a15('0x10')]({'plain':!![]});if(_0x196ded[_0x7a15('0x11')]['toLowerCase']()==='in'||_0x196ded[_0x7a15('0x11')][_0x7a15('0x12')]()===_0x7a15('0x13')&&!_0x196ded[_0x7a15('0x14')]&&!_[_0x7a15('0x15')](_0x196ded['UserId'])){_0x237947[_0x7a15('0x16')]['findOne']({'where':{'id':_0x196ded[_0x7a15('0x17')]}})[_0x7a15('0x18')](function(_0x3669c5){if(_0x3669c5){_0x3669c5['update']({'lastMsgAt':_0x196ded[_0x7a15('0x19')],'lastMsgDirection':_0x196ded[_0x7a15('0x11')][_0x7a15('0x12')]()});}})[_0x7a15('0x1a')](function(_0xc2123f){console['error'](_0xc2123f);});}_0x41733d();}},'charset':'utf8mb4','collate':_0x7a15('0x1b')});}; \ No newline at end of file +var _0x418a=['./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','out','isNil','ChatInteraction','findOne','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','rimraf'];(function(_0x4ab756,_0x4b4496){var _0x309a02=function(_0x22646f){while(--_0x22646f){_0x4ab756['push'](_0x4ab756['shift']());}};_0x309a02(++_0x4b4496);}(_0x418a,0xb7));var _0xa418=function(_0x41fe6c,_0xe9f85f){_0x41fe6c=_0x41fe6c-0x0;var _0x51f106=_0x418a[_0x41fe6c];return _0x51f106;};'use strict';var _=require(_0xa418('0x0'));var util=require(_0xa418('0x1'));var logger=require(_0xa418('0x2'))('api');var moment=require(_0xa418('0x3'));var BPromise=require('bluebird');var rp=require(_0xa418('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa418('0x5'));var config=require('../../config/environment');var attributes=require(_0xa418('0x6'));module[_0xa418('0x7')]=function(_0x5b1306,_0x10a8c8){return _0x5b1306[_0xa418('0x8')](_0xa418('0x9'),attributes,{'tableName':_0xa418('0xa'),'paranoid':![],'indexes':[{'name':_0xa418('0xb'),'fields':[_0xa418('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1fed75,_0x5d15cb,_0x4d799f){var _0x29cf55=_0x5b1306[_0xa418('0xd')];var _0x43a0bc=_0x1fed75[_0xa418('0xe')]({'plain':!![]});if(_0x43a0bc[_0xa418('0xf')][_0xa418('0x10')]()==='in'||_0x43a0bc['direction']['toLowerCase']()===_0xa418('0x11')&&!_0x43a0bc['secret']&&!_[_0xa418('0x12')](_0x43a0bc['UserId'])){_0x29cf55[_0xa418('0x13')][_0xa418('0x14')]({'where':{'id':_0x43a0bc['ChatInteractionId']}})[_0xa418('0x15')](function(_0x543d2c){if(_0x543d2c){_0x543d2c[_0xa418('0x16')]({'lastMsgAt':_0x43a0bc[_0xa418('0x17')],'lastMsgDirection':_0x43a0bc[_0xa418('0xf')][_0xa418('0x10')]()});}})[_0xa418('0x18')](function(_0x5c6da7){console['error'](_0x5c6da7);});}_0x4d799f();}},'charset':_0xa418('0x19'),'collate':_0xa418('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index e347d01..4ac97eb 100644 --- a/server/api/chatMessage/chatMessage.rpc.js +++ b/server/api/chatMessage/chatMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfdc4=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateChatMessage','create','body','options','raw','stringify','lodash','bluebird','randomstring'];(function(_0x8d3cd,_0x1ca7af){var _0x4fa90f=function(_0x14f599){while(--_0x14f599){_0x8d3cd['push'](_0x8d3cd['shift']());}};_0x4fa90f(++_0x1ca7af);}(_0xfdc4,0x81));var _0x4fdc=function(_0x3c783b,_0x43a9f6){_0x3c783b=_0x3c783b-0x0;var _0x3b2861=_0xfdc4[_0x3c783b];return _0x3b2861;};'use strict';var _=require(_0x4fdc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4fdc('0x1'));var rs=require(_0x4fdc('0x2'));var fs=require('fs');var Redis=require(_0x4fdc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4fdc('0x4'));var logger=require(_0x4fdc('0x5'))(_0x4fdc('0x6'));var config=require(_0x4fdc('0x7'));var jayson=require(_0x4fdc('0x8'));var client=jayson[_0x4fdc('0x9')][_0x4fdc('0xa')]({'port':0x232a});config[_0x4fdc('0xb')]=_['defaults'](config[_0x4fdc('0xb')],{'host':_0x4fdc('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4fdc('0xb')]));require(_0x4fdc('0xd'))[_0x4fdc('0xe')](socket);function respondWithRpcPromise(_0x3154c7,_0x562acb,_0x55f349){return new BPromise(function(_0x2fd1d9,_0x3c04bd){return client[_0x4fdc('0xf')](_0x3154c7,_0x55f349)[_0x4fdc('0x10')](function(_0x180536){logger[_0x4fdc('0x11')](_0x4fdc('0x12'),_0x562acb,_0x4fdc('0x13'));logger[_0x4fdc('0x14')](_0x4fdc('0x15'),_0x562acb,_0x4fdc('0x13'),JSON['stringify'](_0x180536));if(_0x180536[_0x4fdc('0x16')]){if(_0x180536[_0x4fdc('0x16')][_0x4fdc('0x17')]===0x1f4){logger[_0x4fdc('0x16')](_0x4fdc('0x12'),_0x562acb,_0x180536['error'][_0x4fdc('0x18')]);return _0x3c04bd(_0x180536['error'][_0x4fdc('0x18')]);}logger[_0x4fdc('0x16')](_0x4fdc('0x12'),_0x562acb,_0x180536[_0x4fdc('0x16')][_0x4fdc('0x18')]);return _0x2fd1d9(_0x180536['error'][_0x4fdc('0x18')]);}else{logger['info'](_0x4fdc('0x12'),_0x562acb,_0x4fdc('0x13'));_0x2fd1d9(_0x180536[_0x4fdc('0x19')][_0x4fdc('0x18')]);}})[_0x4fdc('0x1a')](function(_0x3969df){logger[_0x4fdc('0x16')](_0x4fdc('0x12'),_0x562acb,_0x3969df);_0x3c04bd(_0x3969df);});});}exports[_0x4fdc('0x1b')]=function(_0x2e8af0){var _0x2641b0=this;return new Promise(function(_0x12ce81,_0xd3f688){return db['ChatMessage'][_0x4fdc('0x1c')](_0x2e8af0[_0x4fdc('0x1d')],{'raw':_0x2e8af0[_0x4fdc('0x1e')]?_0x2e8af0[_0x4fdc('0x1e')][_0x4fdc('0x1f')]===undefined?!![]:![]:!![]})[_0x4fdc('0x10')](function(_0x25fa18){logger[_0x4fdc('0x11')]('CreateChatMessage',_0x2e8af0);logger[_0x4fdc('0x14')]('CreateChatMessage',_0x2e8af0,JSON[_0x4fdc('0x20')](_0x25fa18));_0x12ce81(_0x25fa18);})[_0x4fdc('0x1a')](function(_0x230541){logger[_0x4fdc('0x16')](_0x4fdc('0x1b'),_0x230541[_0x4fdc('0x18')],_0x2e8af0);_0xd3f688(_0x2641b0[_0x4fdc('0x16')](0x1f4,_0x230541[_0x4fdc('0x18')]));});});}; \ No newline at end of file +var _0x5aae=['stringify','error','message','request\x20sent','result','catch','ChatMessage','create','body','options','raw','CreateChatMessage','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','localhost','redis','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0xf78a1e,_0x19af07){var _0xc72a=function(_0xf84ce5){while(--_0xf84ce5){_0xf78a1e['push'](_0xf78a1e['shift']());}};_0xc72a(++_0x19af07);}(_0x5aae,0xe5));var _0xe5aa=function(_0x41e8c4,_0x30d9ff){_0x41e8c4=_0x41e8c4-0x0;var _0x54ffbe=_0x5aae[_0x41e8c4];return _0x54ffbe;};'use strict';var _=require(_0xe5aa('0x0'));var util=require(_0xe5aa('0x1'));var moment=require(_0xe5aa('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe5aa('0x3'))['db'];var utils=require(_0xe5aa('0x4'));var logger=require(_0xe5aa('0x5'))('rpc');var config=require(_0xe5aa('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe5aa('0x7')][_0xe5aa('0x8')]({'port':0x232a});config['redis']=_[_0xe5aa('0x9')](config['redis'],{'host':_0xe5aa('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe5aa('0xb')]));require(_0xe5aa('0xc'))['register'](socket);function respondWithRpcPromise(_0xfb2450,_0x42f6ff,_0x3197e2){return new BPromise(function(_0x232e1b,_0x5c3512){return client[_0xe5aa('0xd')](_0xfb2450,_0x3197e2)[_0xe5aa('0xe')](function(_0x498150){logger[_0xe5aa('0xf')](_0xe5aa('0x10'),_0x42f6ff,'request\x20sent');logger[_0xe5aa('0x11')](_0xe5aa('0x12'),_0x42f6ff,'request\x20sent',JSON[_0xe5aa('0x13')](_0x498150));if(_0x498150[_0xe5aa('0x14')]){if(_0x498150[_0xe5aa('0x14')]['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x42f6ff,_0x498150[_0xe5aa('0x14')][_0xe5aa('0x15')]);return _0x5c3512(_0x498150[_0xe5aa('0x14')][_0xe5aa('0x15')]);}logger[_0xe5aa('0x14')](_0xe5aa('0x10'),_0x42f6ff,_0x498150[_0xe5aa('0x14')][_0xe5aa('0x15')]);return _0x232e1b(_0x498150[_0xe5aa('0x14')][_0xe5aa('0x15')]);}else{logger[_0xe5aa('0xf')](_0xe5aa('0x10'),_0x42f6ff,_0xe5aa('0x16'));_0x232e1b(_0x498150[_0xe5aa('0x17')][_0xe5aa('0x15')]);}})[_0xe5aa('0x18')](function(_0x3e6021){logger[_0xe5aa('0x14')]('ChatMessage,\x20%s,\x20%s',_0x42f6ff,_0x3e6021);_0x5c3512(_0x3e6021);});});}exports['CreateChatMessage']=function(_0x18cca0){var _0x37b354=this;return new Promise(function(_0xdc3427,_0x3a3f11){return db[_0xe5aa('0x19')][_0xe5aa('0x1a')](_0x18cca0[_0xe5aa('0x1b')],{'raw':_0x18cca0[_0xe5aa('0x1c')]?_0x18cca0[_0xe5aa('0x1c')][_0xe5aa('0x1d')]===undefined?!![]:![]:!![]})[_0xe5aa('0xe')](function(_0x545376){logger[_0xe5aa('0xf')](_0xe5aa('0x1e'),_0x18cca0);logger[_0xe5aa('0x11')](_0xe5aa('0x1e'),_0x18cca0,JSON['stringify'](_0x545376));_0xdc3427(_0x545376);})[_0xe5aa('0x18')](function(_0x479537){logger[_0xe5aa('0x14')](_0xe5aa('0x1e'),_0x479537[_0xe5aa('0x15')],_0x18cca0);_0x3a3f11(_0x37b354[_0xe5aa('0x14')](0x1f4,_0x479537[_0xe5aa('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 52f7833..ccad792 100644 --- a/server/api/chatMessage/chatMessage.socket.js +++ b/server/api/chatMessage/chatMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a3a=['save','remove','update','emit','removeListener','register','length','./chatMessage.events'];(function(_0x5480fe,_0x2c0e51){var _0x4cd88d=function(_0x3c3c89){while(--_0x3c3c89){_0x5480fe['push'](_0x5480fe['shift']());}};_0x4cd88d(++_0x2c0e51);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x5870ae,_0x5ca9de){_0x5870ae=_0x5870ae-0x0;var _0x4f5d9e=_0x2a3a[_0x5870ae];return _0x4f5d9e;};'use strict';var ChatMessageEvents=require(_0xa2a3('0x0'));var events=[_0xa2a3('0x1'),_0xa2a3('0x2'),_0xa2a3('0x3')];function createListener(_0x45ba85,_0x4caf0f){return function(_0x531167){_0x4caf0f[_0xa2a3('0x4')](_0x45ba85,_0x531167);};}function removeListener(_0x34d7f9,_0x1e61b2){return function(){ChatMessageEvents[_0xa2a3('0x5')](_0x34d7f9,_0x1e61b2);};}exports[_0xa2a3('0x6')]=function(_0xf652d7){for(var _0x186655=0x0,_0x5e5e50=events[_0xa2a3('0x7')];_0x186655<_0x5e5e50;_0x186655++){var _0x196c96=events[_0x186655];var _0x2a3753=createListener('chatMessage:'+_0x196c96,_0xf652d7);ChatMessageEvents['on'](_0x196c96,_0x2a3753);}}; \ No newline at end of file +var _0xcd59=['remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x31e16a,_0x210c6c){var _0x58e686=function(_0x2bb73c){while(--_0x2bb73c){_0x31e16a['push'](_0x31e16a['shift']());}};_0x58e686(++_0x210c6c);}(_0xcd59,0x14b));var _0x9cd5=function(_0x2df7c7,_0x5ec3eb){_0x2df7c7=_0x2df7c7-0x0;var _0x42995b=_0xcd59[_0x2df7c7];return _0x42995b;};'use strict';var ChatMessageEvents=require(_0x9cd5('0x0'));var events=[_0x9cd5('0x1'),_0x9cd5('0x2'),_0x9cd5('0x3')];function createListener(_0x271070,_0x302b21){return function(_0x4b93b9){_0x302b21[_0x9cd5('0x4')](_0x271070,_0x4b93b9);};}function removeListener(_0x191236,_0xf96efa){return function(){ChatMessageEvents[_0x9cd5('0x5')](_0x191236,_0xf96efa);};}exports[_0x9cd5('0x6')]=function(_0x2db192){for(var _0x46277c=0x0,_0x2cd19a=events[_0x9cd5('0x7')];_0x46277c<_0x2cd19a;_0x46277c++){var _0x3f888f=events[_0x46277c];var _0x545407=createListener(_0x9cd5('0x8')+_0x3f888f,_0x2db192);ChatMessageEvents['on'](_0x3f888f,_0x545407);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index f6bf161..e59331e 100644 --- a/server/api/chatMessage/index.js +++ b/server/api/chatMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea04=['get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','put','update','/:id/accept','accept','reject','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller'];(function(_0x25806f,_0x1b1392){var _0x56117d=function(_0x103383){while(--_0x103383){_0x25806f['push'](_0x25806f['shift']());}};_0x56117d(++_0x1b1392);}(_0xea04,0x7a));var _0x4ea0=function(_0x11fb16,_0x29a381){_0x11fb16=_0x11fb16-0x0;var _0x343de1=_0xea04[_0x11fb16];return _0x343de1;};'use strict';var multer=require(_0x4ea0('0x0'));var util=require(_0x4ea0('0x1'));var path=require(_0x4ea0('0x2'));var timeout=require('connect-timeout');var express=require(_0x4ea0('0x3'));var router=express['Router']();var fs_extra=require(_0x4ea0('0x4'));var auth=require(_0x4ea0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4ea0('0x6'));var controller=require(_0x4ea0('0x7'));router[_0x4ea0('0x8')]('/',auth[_0x4ea0('0x9')](),controller[_0x4ea0('0xa')]);router['get'](_0x4ea0('0xb'),auth[_0x4ea0('0x9')](),controller[_0x4ea0('0xc')]);router[_0x4ea0('0x8')](_0x4ea0('0xd'),auth[_0x4ea0('0x9')](),controller[_0x4ea0('0xe')]);router[_0x4ea0('0xf')]('/',auth[_0x4ea0('0x9')](),interaction[_0x4ea0('0x10')](_0x4ea0('0x11'),_0x4ea0('0x12')),controller['create']);router[_0x4ea0('0x13')](_0x4ea0('0xd'),controller[_0x4ea0('0x14')]);router['put'](_0x4ea0('0x15'),auth['isAuthenticated'](),controller[_0x4ea0('0x16')]);router['put']('/:id/reject',auth[_0x4ea0('0x9')](),controller[_0x4ea0('0x17')]);router[_0x4ea0('0x18')](_0x4ea0('0xd'),auth[_0x4ea0('0x9')](),controller[_0x4ea0('0x19')]);module['exports']=router; \ No newline at end of file +var _0x6328=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','chat','create','put','update','/:id/accept','reject'];(function(_0xce8373,_0x2ad630){var _0xa5cd5f=function(_0x5e0be0){while(--_0x5e0be0){_0xce8373['push'](_0xce8373['shift']());}};_0xa5cd5f(++_0x2ad630);}(_0x6328,0x1d7));var _0x8632=function(_0xbf5e16,_0x146ce3){_0xbf5e16=_0xbf5e16-0x0;var _0x5975a5=_0x6328[_0xbf5e16];return _0x5975a5;};'use strict';var multer=require(_0x8632('0x0'));var util=require(_0x8632('0x1'));var path=require('path');var timeout=require(_0x8632('0x2'));var express=require(_0x8632('0x3'));var router=express[_0x8632('0x4')]();var fs_extra=require(_0x8632('0x5'));var auth=require(_0x8632('0x6'));var interaction=require(_0x8632('0x7'));var config=require(_0x8632('0x8'));var controller=require(_0x8632('0x9'));router[_0x8632('0xa')]('/',auth[_0x8632('0xb')](),controller['index']);router[_0x8632('0xa')](_0x8632('0xc'),auth['isAuthenticated'](),controller[_0x8632('0xd')]);router['get'](_0x8632('0xe'),auth['isAuthenticated'](),controller[_0x8632('0xf')]);router[_0x8632('0x10')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x8632('0x11'),'chatmessage:create'),controller[_0x8632('0x12')]);router[_0x8632('0x13')](_0x8632('0xe'),controller[_0x8632('0x14')]);router['put'](_0x8632('0x15'),auth[_0x8632('0xb')](),controller['accept']);router[_0x8632('0x13')]('/:id/reject',auth['isAuthenticated'](),controller[_0x8632('0x16')]);router[_0x8632('0x17')](_0x8632('0xe'),auth[_0x8632('0xb')](),controller[_0x8632('0x18')]);module[_0x8632('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 8eb86ff..bbabce2 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['medium','TEXT','exports'];(function(_0x5bddb8,_0x4062c5){var _0xcce5e4=function(_0x3e2238){while(--_0x3e2238){_0x5bddb8['push'](_0x5bddb8['shift']());}};_0xcce5e4(++_0x4062c5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x2032=['medium','exports','TEXT'];(function(_0x370b75,_0x1e8cf4){var _0x4605ed=function(_0x1de0c3){while(--_0x1de0c3){_0x370b75['push'](_0x370b75['shift']());}};_0x4605ed(++_0x1e8cf4);}(_0x2032,0xd9));var _0x2203=function(_0x3391e5,_0x76cc0d){_0x3391e5=_0x3391e5-0x0;var _0x24387b=_0x2032[_0x3391e5];return _0x24387b;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 3cd8e16..acf874e 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x7a54,0x106));var _0x47a5=function(_0x3f50fb,_0x172f07){_0x3f50fb=_0x3f50fb-0x0;var _0x2ea639=_0x7a54[_0x3f50fb];return _0x2ea639;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x7a54,0x106));var _0x47a5=function(_0x48e390,_0x303e2c){_0x48e390=_0x48e390-0x0;var _0x326730=_0x7a54[_0x48e390];return _0x326730;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 0df3e39..186ddb1 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f0e=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','update'];(function(_0x517988,_0x3e3a63){var _0x2e9b5d=function(_0x4f3925){while(--_0x4f3925){_0x517988['push'](_0x517988['shift']());}};_0x2e9b5d(++_0x3e3a63);}(_0x5f0e,0x19a));var _0xe5f0=function(_0x45efa6,_0x14f10c){_0x45efa6=_0x45efa6-0x0;var _0x3535ea=_0x5f0e[_0x45efa6];return _0x3535ea;};'use strict';var EventEmitter=require(_0xe5f0('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xe5f0('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe5f0('0x2'),'afterDestroy':'remove'};function emitEvent(_0xdb626c){return function(_0x13c9d6,_0x5662ce,_0x4f6c9c){ChatOfflineMessageEvents['emit'](_0xdb626c+':'+_0x13c9d6['id'],_0x13c9d6);ChatOfflineMessageEvents[_0xe5f0('0x3')](_0xdb626c,_0x13c9d6);_0x4f6c9c(null);};}for(var e in events){if(events[_0xe5f0('0x4')](e)){var event=events[e];ChatOfflineMessage[_0xe5f0('0x5')](e,emitEvent(event));}}module[_0xe5f0('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x4984=['events','ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4a1f0a,_0x564fcb){var _0x274c22=function(_0x463e1a){while(--_0x463e1a){_0x4a1f0a['push'](_0x4a1f0a['shift']());}};_0x274c22(++_0x564fcb);}(_0x4984,0x154));var _0x4498=function(_0x2f4aa2,_0xb72e14){_0x2f4aa2=_0x2f4aa2-0x0;var _0x4fdb16=_0x4984[_0x2f4aa2];return _0x4fdb16;};'use strict';var EventEmitter=require(_0x4498('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x4498('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x4498('0x2')](0x0);var events={'afterCreate':_0x4498('0x3'),'afterUpdate':_0x4498('0x4'),'afterDestroy':_0x4498('0x5')};function emitEvent(_0x549cd5){return function(_0x35a60e,_0x3133a2,_0x7f3761){ChatOfflineMessageEvents[_0x4498('0x6')](_0x549cd5+':'+_0x35a60e['id'],_0x35a60e);ChatOfflineMessageEvents[_0x4498('0x6')](_0x549cd5,_0x35a60e);_0x7f3761(null);};}for(var e in events){if(events[_0x4498('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x4498('0x8')](e,emitEvent(event));}}module[_0x4498('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 2b459fb..5d44339 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 _0x19d1=['chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','define','ChatOfflineMessage'];(function(_0x57f5f2,_0x24a6c9){var _0x1f9429=function(_0x1edb10){while(--_0x1edb10){_0x57f5f2['push'](_0x57f5f2['shift']());}};_0x1f9429(++_0x24a6c9);}(_0x19d1,0x76));var _0x119d=function(_0x424a83,_0x1b3f16){_0x424a83=_0x424a83-0x0;var _0xeefe49=_0x19d1[_0x424a83];return _0xeefe49;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x4a3619){return _0x4a3619[_0x119d('0x0')](_0x119d('0x1'),attributes,{'tableName':_0x119d('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x119d('0x3'),'collate':_0x119d('0x4')});}; \ No newline at end of file +var _0x798a=['chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','exports','define','ChatOfflineMessage'];(function(_0x5e25d0,_0x15ece2){var _0x13fb23=function(_0xf27573){while(--_0xf27573){_0x5e25d0['push'](_0x5e25d0['shift']());}};_0x13fb23(++_0x15ece2);}(_0x798a,0x1a1));var _0xa798=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x798a[_0x7e2eb0];return _0xd92de4;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xa798('0x0')]=function(_0x20ee10){return _0x20ee10[_0xa798('0x1')](_0xa798('0x2'),attributes,{'tableName':_0xa798('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa798('0x4'),'collate':_0xa798('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index d6c54db..403609f 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 _0x5162=['jayson/promise','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x5162,0x103));var _0x2516=function(_0x4179b3,_0x2eaff2){_0x4179b3=_0x4179b3-0x0;var _0x5b5c7e=_0x5162[_0x4179b3];return _0x5b5c7e;};'use strict';var _=require(_0x2516('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2516('0x1'));var db=require(_0x2516('0x2'))['db'];var utils=require(_0x2516('0x3'));var logger=require(_0x2516('0x4'))(_0x2516('0x5'));var config=require(_0x2516('0x6'));var jayson=require(_0x2516('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5beeb3,_0x20a4a4,_0xba4b36){return new BPromise(function(_0xa1557,_0x3a8834){return client[_0x2516('0x8')](_0x5beeb3,_0xba4b36)[_0x2516('0x9')](function(_0x1cb817){logger['info'](_0x2516('0xa'),_0x20a4a4,_0x2516('0xb'));logger[_0x2516('0xc')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x20a4a4,'request\x20sent',JSON['stringify'](_0x1cb817));if(_0x1cb817['error']){if(_0x1cb817[_0x2516('0xd')][_0x2516('0xe')]===0x1f4){logger[_0x2516('0xd')](_0x2516('0xa'),_0x20a4a4,_0x1cb817['error'][_0x2516('0xf')]);return _0x3a8834(_0x1cb817[_0x2516('0xd')][_0x2516('0xf')]);}logger[_0x2516('0xd')](_0x2516('0xa'),_0x20a4a4,_0x1cb817[_0x2516('0xd')][_0x2516('0xf')]);return _0xa1557(_0x1cb817[_0x2516('0xd')][_0x2516('0xf')]);}else{logger[_0x2516('0x10')](_0x2516('0xa'),_0x20a4a4,_0x2516('0xb'));_0xa1557(_0x1cb817[_0x2516('0x11')][_0x2516('0xf')]);}})[_0x2516('0x12')](function(_0x5623be){logger[_0x2516('0xd')](_0x2516('0xa'),_0x20a4a4,_0x5623be);_0x3a8834(_0x5623be);});});} \ No newline at end of file +var _0x6b6d=['error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4c10e0,_0x2ef0d2){var _0x2aa24d=function(_0x475a06){while(--_0x475a06){_0x4c10e0['push'](_0x4c10e0['shift']());}};_0x2aa24d(++_0x2ef0d2);}(_0x6b6d,0xbd));var _0xd6b6=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x6b6d[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xd6b6('0x0'));var util=require(_0xd6b6('0x1'));var moment=require(_0xd6b6('0x2'));var BPromise=require(_0xd6b6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6b6('0x4'));var db=require(_0xd6b6('0x5'))['db'];var utils=require(_0xd6b6('0x6'));var logger=require(_0xd6b6('0x7'))('rpc');var config=require(_0xd6b6('0x8'));var jayson=require(_0xd6b6('0x9'));var client=jayson[_0xd6b6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d4fa7,_0x151300,_0xee52b3){return new BPromise(function(_0xb796b4,_0xf48c95){return client[_0xd6b6('0xb')](_0x1d4fa7,_0xee52b3)['then'](function(_0x577101){logger[_0xd6b6('0xc')](_0xd6b6('0xd'),_0x151300,'request\x20sent');logger[_0xd6b6('0xe')](_0xd6b6('0xf'),_0x151300,_0xd6b6('0x10'),JSON[_0xd6b6('0x11')](_0x577101));if(_0x577101[_0xd6b6('0x12')]){if(_0x577101[_0xd6b6('0x12')][_0xd6b6('0x13')]===0x1f4){logger[_0xd6b6('0x12')](_0xd6b6('0xd'),_0x151300,_0x577101['error'][_0xd6b6('0x14')]);return _0xf48c95(_0x577101[_0xd6b6('0x12')][_0xd6b6('0x14')]);}logger[_0xd6b6('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x151300,_0x577101[_0xd6b6('0x12')][_0xd6b6('0x14')]);return _0xb796b4(_0x577101[_0xd6b6('0x12')][_0xd6b6('0x14')]);}else{logger[_0xd6b6('0xc')](_0xd6b6('0xd'),_0x151300,_0xd6b6('0x10'));_0xb796b4(_0x577101[_0xd6b6('0x15')][_0xd6b6('0x14')]);}})[_0xd6b6('0x16')](function(_0x2d3464){logger[_0xd6b6('0x12')](_0xd6b6('0xd'),_0x151300,_0x2d3464);_0xf48c95(_0x2d3464);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 754a881..f8f9316 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 _0x9c99=['util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','create','put','delete','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9c99,0xa5));var _0x99c9=function(_0x454db7,_0x19898f){_0x454db7=_0x454db7-0x0;var _0x520d54=_0x9c99[_0x454db7];return _0x520d54;};'use strict';var multer=require('multer');var util=require(_0x99c9('0x0'));var path=require('path');var timeout=require(_0x99c9('0x1'));var express=require(_0x99c9('0x2'));var router=express['Router']();var fs_extra=require(_0x99c9('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x99c9('0x4'));var config=require(_0x99c9('0x5'));var controller=require('./chatOfflineMessage.controller');router[_0x99c9('0x6')]('/',auth[_0x99c9('0x7')](),controller['index']);router['get'](_0x99c9('0x8'),auth[_0x99c9('0x7')](),controller['describe']);router[_0x99c9('0x6')](_0x99c9('0x9'),auth[_0x99c9('0x7')](),controller[_0x99c9('0xa')]);router['post']('/',auth[_0x99c9('0x7')](),controller[_0x99c9('0xb')]);router[_0x99c9('0xc')](_0x99c9('0x9'),auth[_0x99c9('0x7')](),controller['update']);router[_0x99c9('0xd')](_0x99c9('0x9'),auth[_0x99c9('0x7')](),controller['destroy']);module[_0x99c9('0xe')]=router; \ No newline at end of file +var _0x7a8d=['/:id','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','post','update'];(function(_0x1b502c,_0x251bbe){var _0x5f5561=function(_0x47bdf7){while(--_0x47bdf7){_0x1b502c['push'](_0x1b502c['shift']());}};_0x5f5561(++_0x251bbe);}(_0x7a8d,0xab));var _0xd7a8=function(_0x546ec1,_0x10b117){_0x546ec1=_0x546ec1-0x0;var _0x3031ef=_0x7a8d[_0x546ec1];return _0x3031ef;};'use strict';var multer=require(_0xd7a8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd7a8('0x1'));var express=require(_0xd7a8('0x2'));var router=express['Router']();var fs_extra=require(_0xd7a8('0x3'));var auth=require(_0xd7a8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd7a8('0x5'));var controller=require('./chatOfflineMessage.controller');router[_0xd7a8('0x6')]('/',auth[_0xd7a8('0x7')](),controller[_0xd7a8('0x8')]);router['get']('/describe',auth[_0xd7a8('0x7')](),controller['describe']);router[_0xd7a8('0x6')]('/:id',auth[_0xd7a8('0x7')](),controller['show']);router[_0xd7a8('0x9')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xd7a8('0x7')](),controller[_0xd7a8('0xa')]);router['delete'](_0xd7a8('0xb'),auth[_0xd7a8('0x7')](),controller[_0xd7a8('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index a055965..876e290 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 _0x6533=['mouseOver','timeout','INTEGER','sequelize','ENUM'];(function(_0x46f1c5,_0x74e765){var _0x47230d=function(_0x37e36c){while(--_0x37e36c){_0x46f1c5['push'](_0x46f1c5['shift']());}};_0x47230d(++_0x74e765);}(_0x6533,0x198));var _0x3653=function(_0xece513,_0x252953){_0xece513=_0xece513-0x0;var _0x4f5f69=_0x6533[_0xece513];return _0x4f5f69;};'use strict';var Sequelize=require(_0x3653('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3653('0x1')](_0x3653('0x2'),_0x3653('0x3')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3653('0x4')]}}; \ No newline at end of file +var _0xb2a8=['STRING','INTEGER','exports','ENUM','mouseOver'];(function(_0x4ab759,_0x552b39){var _0x3f3435=function(_0x14aac6){while(--_0x14aac6){_0x4ab759['push'](_0x4ab759['shift']());}};_0x3f3435(++_0x552b39);}(_0xb2a8,0x18d));var _0x8b2a=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xb2a8[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require('sequelize');module[_0x8b2a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x8b2a('0x1')](_0x8b2a('0x2'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x8b2a('0x3')]},'timeout':{'type':Sequelize[_0x8b2a('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 4706ca7..a574fb7 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 _0xb1a3=['limit','count','set','Content-Range','json','reject','save','then','destroy','end','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields','length','include','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined'];(function(_0x13e086,_0x56e64e){var _0x2efedb=function(_0x12a29a){while(--_0x12a29a){_0x13e086['push'](_0x13e086['shift']());}};_0x2efedb(++_0x56e64e);}(_0xb1a3,0x1cc));var _0x3b1a=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0xb1a3[_0x5d4f12];return _0x4eb577;};'use strict';var emlformat=require(_0x3b1a('0x0'));var rimraf=require(_0x3b1a('0x1'));var zipdir=require(_0x3b1a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b1a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3b1a('0x4'));var util=require(_0x3b1a('0x5'));var path=require(_0x3b1a('0x6'));var sox=require(_0x3b1a('0x7'));var csv=require(_0x3b1a('0x8'));var ejs=require(_0x3b1a('0x9'));var fs=require('fs');var fs_extra=require(_0x3b1a('0xa'));var _=require('lodash');var squel=require(_0x3b1a('0xb'));var crypto=require(_0x3b1a('0xc'));var jsforce=require(_0x3b1a('0xd'));var deskjs=require(_0x3b1a('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3b1a('0xf'));var Redis=require(_0x3b1a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3b1a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b1a('0x12'));var logger=require('../../config/logger')(_0x3b1a('0x13'));var utils=require(_0x3b1a('0x14'));var config=require(_0x3b1a('0x15'));var licenseUtil=require(_0x3b1a('0x16'));var db=require(_0x3b1a('0x17'))['db'];function respondWithStatusCode(_0x1fea99,_0x2bd423){_0x2bd423=_0x2bd423||0xcc;return function(_0x32e77a){if(_0x32e77a){return _0x1fea99[_0x3b1a('0x18')](_0x2bd423);}return _0x1fea99['status'](_0x2bd423)['end']();};}function respondWithResult(_0x8aad4b,_0x3dfeda){_0x3dfeda=_0x3dfeda||0xc8;return function(_0x19c135){if(_0x19c135){return _0x8aad4b[_0x3b1a('0x19')](_0x3dfeda)['json'](_0x19c135);}};}function respondWithFilteredResult(_0x1b175e,_0x2f0674){return function(_0x55ac06){if(_0x55ac06){var _0x19bbc1=typeof _0x2f0674[_0x3b1a('0x1a')]===_0x3b1a('0x1b')&&typeof _0x2f0674[_0x3b1a('0x1c')]===_0x3b1a('0x1b');var _0xf10b60=_0x55ac06[_0x3b1a('0x1d')];var _0x220869=_0x19bbc1?0x0:_0x2f0674['offset'];var _0x14996f=_0x19bbc1?_0x55ac06[_0x3b1a('0x1d')]:_0x2f0674['offset']+_0x2f0674[_0x3b1a('0x1c')];var _0x5758fd;if(_0x14996f>=_0xf10b60){_0x14996f=_0xf10b60;_0x5758fd=0xc8;}else{_0x5758fd=0xce;}_0x1b175e[_0x3b1a('0x19')](_0x5758fd);return _0x1b175e[_0x3b1a('0x1e')](_0x3b1a('0x1f'),_0x220869+'-'+_0x14996f+'/'+_0xf10b60)[_0x3b1a('0x20')](_0x55ac06);}return null;};}function patchUpdates(_0xe1113d){return function(_0x13eeec){try{jsonpatch['apply'](_0x13eeec,_0xe1113d,!![]);}catch(_0x2c0a87){return BPromise[_0x3b1a('0x21')](_0x2c0a87);}return _0x13eeec[_0x3b1a('0x22')]();};}function saveUpdates(_0x1a09f1,_0x42bdf6){return function(_0x4f5f52){if(_0x4f5f52){return _0x4f5f52['update'](_0x1a09f1)[_0x3b1a('0x23')](function(_0x447d94){return _0x447d94;});}return null;};}function removeEntity(_0x5829ea,_0x3af980){return function(_0x1728df){if(_0x1728df){return _0x1728df[_0x3b1a('0x24')]()[_0x3b1a('0x23')](function(){_0x5829ea['status'](0xcc)[_0x3b1a('0x25')]();});}};}function handleEntityNotFound(_0x417c2e,_0x2fbac5){return function(_0x482484){if(!_0x482484){_0x417c2e[_0x3b1a('0x18')](0x194);}return _0x482484;};}function handleError(_0x3744f0,_0x155d77){_0x155d77=_0x155d77||0x1f4;return function(_0x45ebfc){logger[_0x3b1a('0x26')](_0x45ebfc[_0x3b1a('0x27')]);if(_0x45ebfc['name']){delete _0x45ebfc[_0x3b1a('0x28')];}_0x3744f0[_0x3b1a('0x19')](_0x155d77)[_0x3b1a('0x29')](_0x45ebfc);};}exports[_0x3b1a('0x2a')]=function(_0x2ff415,_0x1c6399){var _0x5cb4d0={'raw':!![],'where':{'id':_0x2ff415[_0x3b1a('0x2b')]['id']}},_0x58aec7={};_0x58aec7[_0x3b1a('0x2c')]=_[_0x3b1a('0x2d')](db[_0x3b1a('0x2e')][_0x3b1a('0x2f')]);_0x58aec7[_0x3b1a('0x30')]=_[_0x3b1a('0x2d')](_0x2ff415[_0x3b1a('0x30')]);_0x58aec7[_0x3b1a('0x31')]=_['intersection'](_0x58aec7[_0x3b1a('0x2c')],_0x58aec7[_0x3b1a('0x30')]);_0x5cb4d0[_0x3b1a('0x32')]=_[_0x3b1a('0x33')](_0x58aec7[_0x3b1a('0x2c')],qs[_0x3b1a('0x34')](_0x2ff415[_0x3b1a('0x30')][_0x3b1a('0x34')]));_0x5cb4d0[_0x3b1a('0x32')]=_0x5cb4d0['attributes'][_0x3b1a('0x35')]?_0x5cb4d0[_0x3b1a('0x32')]:_0x58aec7[_0x3b1a('0x2c')];if(_0x2ff415[_0x3b1a('0x30')]['includeAll']){_0x5cb4d0[_0x3b1a('0x36')]=[{'all':!![]}];}_0x5cb4d0=_[_0x3b1a('0x37')]({},_0x5cb4d0,_0x2ff415[_0x3b1a('0x38')]);return db[_0x3b1a('0x2e')][_0x3b1a('0x39')](_0x5cb4d0)[_0x3b1a('0x23')](handleEntityNotFound(_0x1c6399,null))[_0x3b1a('0x23')](respondWithResult(_0x1c6399,null))[_0x3b1a('0x3a')](handleError(_0x1c6399,null));};exports['create']=function(_0x189e00,_0x2be45d){return db[_0x3b1a('0x2e')][_0x3b1a('0x3b')](_0x189e00[_0x3b1a('0x3c')],{})[_0x3b1a('0x23')](respondWithResult(_0x2be45d,0xc9))[_0x3b1a('0x3a')](handleError(_0x2be45d,null));};exports['update']=function(_0x3c2108,_0x420d13){if(_0x3c2108[_0x3b1a('0x3c')]['id']){delete _0x3c2108[_0x3b1a('0x3c')]['id'];}return db['ChatProactiveAction'][_0x3b1a('0x39')]({'where':{'id':_0x3c2108[_0x3b1a('0x2b')]['id']}})[_0x3b1a('0x23')](handleEntityNotFound(_0x420d13,null))[_0x3b1a('0x23')](saveUpdates(_0x3c2108[_0x3b1a('0x3c')],null))[_0x3b1a('0x23')](respondWithResult(_0x420d13,null))[_0x3b1a('0x3a')](handleError(_0x420d13,null));};exports[_0x3b1a('0x24')]=function(_0x228667,_0x5277bb){return db[_0x3b1a('0x2e')][_0x3b1a('0x39')]({'where':{'id':_0x228667['params']['id']}})[_0x3b1a('0x23')](handleEntityNotFound(_0x5277bb,null))[_0x3b1a('0x23')](removeEntity(_0x5277bb,null))[_0x3b1a('0x3a')](handleError(_0x5277bb,null));}; \ No newline at end of file +var _0x7722=['bluebird','mustache','util','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','error','stack','name','send','show','params','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','create','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x252e9d,_0x4d938b){var _0x251f6d=function(_0x5c97e7){while(--_0x5c97e7){_0x252e9d['push'](_0x252e9d['shift']());}};_0x251f6d(++_0x4d938b);}(_0x7722,0x14e));var _0x2772=function(_0x3c85f1,_0x4cee02){_0x3c85f1=_0x3c85f1-0x0;var _0x22ad27=_0x7722[_0x3c85f1];return _0x22ad27;};'use strict';var emlformat=require(_0x2772('0x0'));var rimraf=require(_0x2772('0x1'));var zipdir=require(_0x2772('0x2'));var jsonpatch=require(_0x2772('0x3'));var rp=require(_0x2772('0x4'));var moment=require(_0x2772('0x5'));var BPromise=require(_0x2772('0x6'));var Mustache=require(_0x2772('0x7'));var util=require(_0x2772('0x8'));var path=require('path');var sox=require(_0x2772('0x9'));var csv=require('to-csv');var ejs=require(_0x2772('0xa'));var fs=require('fs');var fs_extra=require(_0x2772('0xb'));var _=require(_0x2772('0xc'));var squel=require(_0x2772('0xd'));var crypto=require(_0x2772('0xe'));var jsforce=require(_0x2772('0xf'));var deskjs=require(_0x2772('0x10'));var toCsv=require(_0x2772('0x11'));var querystring=require(_0x2772('0x12'));var Papa=require(_0x2772('0x13'));var Redis=require(_0x2772('0x14'));var authService=require(_0x2772('0x15'));var qs=require(_0x2772('0x16'));var as=require(_0x2772('0x17'));var hardwareService=require(_0x2772('0x18'));var logger=require(_0x2772('0x19'))('api');var utils=require(_0x2772('0x1a'));var config=require(_0x2772('0x1b'));var licenseUtil=require(_0x2772('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14b427,_0x35afaf){_0x35afaf=_0x35afaf||0xcc;return function(_0x3d1440){if(_0x3d1440){return _0x14b427[_0x2772('0x1d')](_0x35afaf);}return _0x14b427[_0x2772('0x1e')](_0x35afaf)['end']();};}function respondWithResult(_0x21443a,_0x286672){_0x286672=_0x286672||0xc8;return function(_0x38fa62){if(_0x38fa62){return _0x21443a[_0x2772('0x1e')](_0x286672)['json'](_0x38fa62);}};}function respondWithFilteredResult(_0x1aecec,_0x580a8b){return function(_0x245645){if(_0x245645){var _0x122628=typeof _0x580a8b[_0x2772('0x1f')]===_0x2772('0x20')&&typeof _0x580a8b[_0x2772('0x21')]===_0x2772('0x20');var _0x314ba1=_0x245645['count'];var _0x27868d=_0x122628?0x0:_0x580a8b[_0x2772('0x1f')];var _0x3dd1ed=_0x122628?_0x245645[_0x2772('0x22')]:_0x580a8b[_0x2772('0x1f')]+_0x580a8b[_0x2772('0x21')];var _0x34eb25;if(_0x3dd1ed>=_0x314ba1){_0x3dd1ed=_0x314ba1;_0x34eb25=0xc8;}else{_0x34eb25=0xce;}_0x1aecec[_0x2772('0x1e')](_0x34eb25);return _0x1aecec[_0x2772('0x23')](_0x2772('0x24'),_0x27868d+'-'+_0x3dd1ed+'/'+_0x314ba1)['json'](_0x245645);}return null;};}function patchUpdates(_0x51beac){return function(_0x123e62){try{jsonpatch[_0x2772('0x25')](_0x123e62,_0x51beac,!![]);}catch(_0x2ef869){return BPromise[_0x2772('0x26')](_0x2ef869);}return _0x123e62[_0x2772('0x27')]();};}function saveUpdates(_0x4a3e28,_0x35a0dd){return function(_0x11c1b8){if(_0x11c1b8){return _0x11c1b8['update'](_0x4a3e28)['then'](function(_0x499214){return _0x499214;});}return null;};}function removeEntity(_0x5bc8f7,_0x52c703){return function(_0x4147dc){if(_0x4147dc){return _0x4147dc['destroy']()[_0x2772('0x28')](function(){_0x5bc8f7[_0x2772('0x1e')](0xcc)[_0x2772('0x29')]();});}};}function handleEntityNotFound(_0x26ffc5,_0x3d4c2f){return function(_0x111fdd){if(!_0x111fdd){_0x26ffc5[_0x2772('0x1d')](0x194);}return _0x111fdd;};}function handleError(_0xd34b26,_0x43995a){_0x43995a=_0x43995a||0x1f4;return function(_0x2de9a4){logger[_0x2772('0x2a')](_0x2de9a4[_0x2772('0x2b')]);if(_0x2de9a4['name']){delete _0x2de9a4[_0x2772('0x2c')];}_0xd34b26[_0x2772('0x1e')](_0x43995a)[_0x2772('0x2d')](_0x2de9a4);};}exports[_0x2772('0x2e')]=function(_0x3c7dda,_0x4923b0){var _0x4583d4={'raw':!![],'where':{'id':_0x3c7dda[_0x2772('0x2f')]['id']}},_0x4323f0={};_0x4323f0['model']=_['keys'](db[_0x2772('0x30')][_0x2772('0x31')]);_0x4323f0[_0x2772('0x32')]=_[_0x2772('0x33')](_0x3c7dda['query']);_0x4323f0[_0x2772('0x34')]=_[_0x2772('0x35')](_0x4323f0[_0x2772('0x36')],_0x4323f0['query']);_0x4583d4[_0x2772('0x37')]=_[_0x2772('0x35')](_0x4323f0[_0x2772('0x36')],qs['fields'](_0x3c7dda['query'][_0x2772('0x38')]));_0x4583d4['attributes']=_0x4583d4['attributes'][_0x2772('0x39')]?_0x4583d4[_0x2772('0x37')]:_0x4323f0[_0x2772('0x36')];if(_0x3c7dda[_0x2772('0x32')][_0x2772('0x3a')]){_0x4583d4[_0x2772('0x3b')]=[{'all':!![]}];}_0x4583d4=_[_0x2772('0x3c')]({},_0x4583d4,_0x3c7dda[_0x2772('0x3d')]);return db[_0x2772('0x30')][_0x2772('0x3e')](_0x4583d4)[_0x2772('0x28')](handleEntityNotFound(_0x4923b0,null))[_0x2772('0x28')](respondWithResult(_0x4923b0,null))[_0x2772('0x3f')](handleError(_0x4923b0,null));};exports['create']=function(_0xef3a95,_0x3b3ef2){return db[_0x2772('0x30')][_0x2772('0x40')](_0xef3a95['body'],{})[_0x2772('0x28')](respondWithResult(_0x3b3ef2,0xc9))[_0x2772('0x3f')](handleError(_0x3b3ef2,null));};exports[_0x2772('0x41')]=function(_0x20aefd,_0x44ef94){if(_0x20aefd[_0x2772('0x42')]['id']){delete _0x20aefd[_0x2772('0x42')]['id'];}return db[_0x2772('0x30')]['find']({'where':{'id':_0x20aefd[_0x2772('0x2f')]['id']}})[_0x2772('0x28')](handleEntityNotFound(_0x44ef94,null))[_0x2772('0x28')](saveUpdates(_0x20aefd[_0x2772('0x42')],null))['then'](respondWithResult(_0x44ef94,null))[_0x2772('0x3f')](handleError(_0x44ef94,null));};exports[_0x2772('0x43')]=function(_0x488424,_0x2eb1e6){return db[_0x2772('0x30')][_0x2772('0x3e')]({'where':{'id':_0x488424[_0x2772('0x2f')]['id']}})[_0x2772('0x28')](handleEntityNotFound(_0x2eb1e6,null))[_0x2772('0x28')](removeEntity(_0x2eb1e6,null))[_0x2772('0x3f')](handleError(_0x2eb1e6,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index af03411..2be812d 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 _0xce70=['lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x2fa1c6,_0x4a5b8d){var _0x5f3257=function(_0x195b53){while(--_0x195b53){_0x2fa1c6['push'](_0x2fa1c6['shift']());}};_0x5f3257(++_0x4a5b8d);}(_0xce70,0x9a));var _0x0ce7=function(_0x53091a,_0x32a4d1){_0x53091a=_0x53091a-0x0;var _0x147390=_0xce70[_0x53091a];return _0x147390;};'use strict';var _=require(_0x0ce7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0ce7('0x1'));var moment=require(_0x0ce7('0x2'));var BPromise=require(_0x0ce7('0x3'));var rp=require(_0x0ce7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ce7('0x5'));var config=require(_0x0ce7('0x6'));var attributes=require(_0x0ce7('0x7'));module['exports']=function(_0xd7238d,_0xa6ca81){return _0xd7238d[_0x0ce7('0x8')](_0x0ce7('0x9'),attributes,{'tableName':_0x0ce7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f57=['define','ChatProactiveAction','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports'];(function(_0x3bc086,_0x2d5f25){var _0x434424=function(_0x1d2bfa){while(--_0x1d2bfa){_0x3bc086['push'](_0x3bc086['shift']());}};_0x434424(++_0x2d5f25);}(_0x3f57,0x1ca));var _0x73f5=function(_0x396d77,_0x3d62b1){_0x396d77=_0x396d77-0x0;var _0x22379a=_0x3f57[_0x396d77];return _0x22379a;};'use strict';var _=require(_0x73f5('0x0'));var util=require(_0x73f5('0x1'));var logger=require('../../config/logger')(_0x73f5('0x2'));var moment=require(_0x73f5('0x3'));var BPromise=require(_0x73f5('0x4'));var rp=require(_0x73f5('0x5'));var fs=require('fs');var path=require(_0x73f5('0x6'));var rimraf=require('rimraf');var config=require(_0x73f5('0x7'));var attributes=require(_0x73f5('0x8'));module[_0x73f5('0x9')]=function(_0x57e2e0,_0x577a36){return _0x57e2e0[_0x73f5('0xa')](_0x73f5('0xb'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 1db6a6f..8cc017d 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 _0xacd7=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch'];(function(_0xf44b77,_0x28e6e2){var _0x3c8e22=function(_0x2d0d11){while(--_0x2d0d11){_0xf44b77['push'](_0xf44b77['shift']());}};_0x3c8e22(++_0x28e6e2);}(_0xacd7,0x1a2));var _0x7acd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xacd7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7acd('0x0'));var moment=require(_0x7acd('0x1'));var BPromise=require(_0x7acd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7acd('0x3'))['db'];var utils=require(_0x7acd('0x4'));var logger=require(_0x7acd('0x5'))('rpc');var config=require(_0x7acd('0x6'));var jayson=require(_0x7acd('0x7'));var client=jayson[_0x7acd('0x8')][_0x7acd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x322352,_0x2d0d3e,_0x156374){return new BPromise(function(_0x13c827,_0x35e0bc){return client[_0x7acd('0xa')](_0x322352,_0x156374)[_0x7acd('0xb')](function(_0x2a87bc){logger['info'](_0x7acd('0xc'),_0x2d0d3e,'request\x20sent');logger[_0x7acd('0xd')](_0x7acd('0xe'),_0x2d0d3e,_0x7acd('0xf'),JSON[_0x7acd('0x10')](_0x2a87bc));if(_0x2a87bc[_0x7acd('0x11')]){if(_0x2a87bc[_0x7acd('0x11')][_0x7acd('0x12')]===0x1f4){logger[_0x7acd('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x2d0d3e,_0x2a87bc[_0x7acd('0x11')]['message']);return _0x35e0bc(_0x2a87bc[_0x7acd('0x11')][_0x7acd('0x13')]);}logger['error'](_0x7acd('0xc'),_0x2d0d3e,_0x2a87bc[_0x7acd('0x11')][_0x7acd('0x13')]);return _0x13c827(_0x2a87bc['error'][_0x7acd('0x13')]);}else{logger[_0x7acd('0x14')]('ChatProactiveAction,\x20%s,\x20%s',_0x2d0d3e,'request\x20sent');_0x13c827(_0x2a87bc['result']['message']);}})[_0x7acd('0x15')](function(_0xd159bf){logger[_0x7acd('0x11')](_0x7acd('0xc'),_0x2d0d3e,_0xd159bf);_0x35e0bc(_0xd159bf);});});} \ No newline at end of file +var _0x56c1=['debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x56c1,0xb7));var _0x156c=function(_0x50caa6,_0x140c98){_0x50caa6=_0x50caa6-0x0;var _0x5627eb=_0x56c1[_0x50caa6];return _0x5627eb;};'use strict';var _=require(_0x156c('0x0'));var util=require('util');var moment=require(_0x156c('0x1'));var BPromise=require(_0x156c('0x2'));var rs=require(_0x156c('0x3'));var fs=require('fs');var Redis=require(_0x156c('0x4'));var db=require(_0x156c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x156c('0x6'))(_0x156c('0x7'));var config=require(_0x156c('0x8'));var jayson=require(_0x156c('0x9'));var client=jayson[_0x156c('0xa')][_0x156c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59b8b5,_0x1b984c,_0x23f2c0){return new BPromise(function(_0x5f1e5b,_0x17c15f){return client[_0x156c('0xc')](_0x59b8b5,_0x23f2c0)[_0x156c('0xd')](function(_0x554665){logger[_0x156c('0xe')](_0x156c('0xf'),_0x1b984c,_0x156c('0x10'));logger[_0x156c('0x11')](_0x156c('0x12'),_0x1b984c,_0x156c('0x10'),JSON[_0x156c('0x13')](_0x554665));if(_0x554665[_0x156c('0x14')]){if(_0x554665['error'][_0x156c('0x15')]===0x1f4){logger[_0x156c('0x14')](_0x156c('0xf'),_0x1b984c,_0x554665[_0x156c('0x14')][_0x156c('0x16')]);return _0x17c15f(_0x554665['error'][_0x156c('0x16')]);}logger['error'](_0x156c('0xf'),_0x1b984c,_0x554665[_0x156c('0x14')][_0x156c('0x16')]);return _0x5f1e5b(_0x554665[_0x156c('0x14')][_0x156c('0x16')]);}else{logger['info'](_0x156c('0xf'),_0x1b984c,'request\x20sent');_0x5f1e5b(_0x554665[_0x156c('0x17')][_0x156c('0x16')]);}})[_0x156c('0x18')](function(_0x1f9702){logger['error'](_0x156c('0xf'),_0x1b984c,_0x1f9702);_0x17c15f(_0x1f9702);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 7690ce6..80aa709 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 _0x5d58=['/:id','isAuthenticated','show','create','update','delete','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0xcbf03b,_0x2ddbfd){var _0x2384a6=function(_0x58a614){while(--_0x58a614){_0xcbf03b['push'](_0xcbf03b['shift']());}};_0x2384a6(++_0x2ddbfd);}(_0x5d58,0x187));var _0x85d5=function(_0x26a4fd,_0x11b9e4){_0x26a4fd=_0x26a4fd-0x0;var _0x2b0990=_0x5d58[_0x26a4fd];return _0x2b0990;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85d5('0x0')]();var fs_extra=require(_0x85d5('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var controller=require('./chatProactiveAction.controller');router[_0x85d5('0x4')](_0x85d5('0x5'),auth[_0x85d5('0x6')](),controller[_0x85d5('0x7')]);router['post']('/',auth[_0x85d5('0x6')](),controller[_0x85d5('0x8')]);router['put'](_0x85d5('0x5'),auth['isAuthenticated'](),controller[_0x85d5('0x9')]);router[_0x85d5('0xa')](_0x85d5('0x5'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbd51=['show','post','isAuthenticated','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','./chatProactiveAction.controller','get','/:id'];(function(_0x1f467a,_0x541b53){var _0x4776f9=function(_0x556e0e){while(--_0x556e0e){_0x1f467a['push'](_0x1f467a['shift']());}};_0x4776f9(++_0x541b53);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x24e994,_0x4c48fe){_0x24e994=_0x24e994-0x0;var _0xbbf19a=_0xbd51[_0x24e994];return _0xbbf19a;};'use strict';var multer=require(_0x1bd5('0x0'));var util=require('util');var path=require(_0x1bd5('0x1'));var timeout=require(_0x1bd5('0x2'));var express=require(_0x1bd5('0x3'));var router=express[_0x1bd5('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(_0x1bd5('0x5'));router[_0x1bd5('0x6')](_0x1bd5('0x7'),auth['isAuthenticated'](),controller[_0x1bd5('0x8')]);router[_0x1bd5('0x9')]('/',auth[_0x1bd5('0xa')](),controller[_0x1bd5('0xb')]);router[_0x1bd5('0xc')]('/:id',auth[_0x1bd5('0xa')](),controller['update']);router[_0x1bd5('0xd')](_0x1bd5('0x7'),auth[_0x1bd5('0xa')](),controller[_0x1bd5('0xe')]);module[_0x1bd5('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index a39c762..3d9c094 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 _0x77d9=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x4579ff,_0xaa6f5){var _0x403c4c=function(_0xc3c2d6){while(--_0xc3c2d6){_0x4579ff['push'](_0x4579ff['shift']());}};_0x403c4c(++_0xaa6f5);}(_0x77d9,0x104));var _0x977d=function(_0x1b90e0,_0x128583){_0x1b90e0=_0x1b90e0-0x0;var _0x2a26c4=_0x77d9[_0x1b90e0];return _0x2a26c4;};'use strict';var Sequelize=require(_0x977d('0x0'));module[_0x977d('0x1')]={'name':{'type':Sequelize[_0x977d('0x2')],'unique':_0x977d('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x977d('0x2')]},'timeout':{'type':Sequelize[_0x977d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x977d('0x5')](_0x977d('0x6'),_0x977d('0x7'),_0x977d('0x8'))}}; \ No newline at end of file +var _0x01f8=['STRING','name','INTEGER','beepall','roundrobin','sequelize'];(function(_0x619d16,_0x56d4a3){var _0x481301=function(_0x365ab2){while(--_0x365ab2){_0x619d16['push'](_0x619d16['shift']());}};_0x481301(++_0x56d4a3);}(_0x01f8,0x1c1));var _0x801f=function(_0x5d61f8,_0x45c759){_0x5d61f8=_0x5d61f8-0x0;var _0x21a83a=_0x01f8[_0x5d61f8];return _0x21a83a;};'use strict';var Sequelize=require(_0x801f('0x0'));module['exports']={'name':{'type':Sequelize[_0x801f('0x1')],'unique':_0x801f('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x801f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x801f('0x4'),_0x801f('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index b79ff11..4af0210 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 _0xa92b=['getAgents','nolimit','bluebird','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','get','ChatQueues','UserProfileResource','destroy','end','error','stack','name','index','rawAttributes','fieldName','type','key','getOptions','where','include','query','ChatQueue','rows','show','model','keys','filters','intersection','fields','attributes','length','options','catch','create','body','user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','UserChatQueue','hasOwnProperty','sort','pick','ChatQueueId','filter','merge','map','findAll','User','findAndCountAll','UserId','agent','chatPause','%s/%s','SIP','updatedAt','getTeams','Team','order','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','SELECT','includes','all','union','compact','value','removeAgents','addAgents','omit','spread','userChatQueue:save','userChatQueue:remove','findOne'];(function(_0x59276e,_0x4a3b7e){var _0x3a7801=function(_0x5d90e9){while(--_0x5d90e9){_0x59276e['push'](_0x59276e['shift']());}};_0x3a7801(++_0x4a3b7e);}(_0xa92b,0x7b));var _0xba92=function(_0x3cbe1c,_0x4bcabd){_0x3cbe1c=_0x3cbe1c-0x0;var _0x5ee08b=_0xa92b[_0x3cbe1c];return _0x5ee08b;};'use strict';var BPromise=require(_0xba92('0x0'));var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require(_0xba92('0x1'));var qs=require(_0xba92('0x2'));var logger=require(_0xba92('0x3'))(_0xba92('0x4'));var config=require(_0xba92('0x5'));var db=require(_0xba92('0x6'))['db'];config[_0xba92('0x7')]=_[_0xba92('0x8')](config['redis'],{'host':_0xba92('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba92('0x7')]));require(_0xba92('0xa'))[_0xba92('0xb')](socket);function respondWithStatusCode(_0x248946,_0x2a2c39){_0x2a2c39=_0x2a2c39||0xcc;return function(_0x451e78){if(_0x451e78){return _0x248946[_0xba92('0xc')](_0x2a2c39);}return _0x248946[_0xba92('0xd')](_0x2a2c39)['end']();};}function respondWithResult(_0x477c9a,_0x12cd02){_0x12cd02=_0x12cd02||0xc8;return function(_0x4aa5fc){if(_0x4aa5fc){return _0x477c9a[_0xba92('0xd')](_0x12cd02)[_0xba92('0xe')](_0x4aa5fc);}};}function respondWithFilteredResult(_0x1ccf12,_0x47f4a9){return function(_0x2f6b56){if(_0x2f6b56){var _0x160dfc=typeof _0x47f4a9[_0xba92('0xf')]===_0xba92('0x10')&&typeof _0x47f4a9[_0xba92('0x11')]===_0xba92('0x10');var _0x1ded03=_0x2f6b56[_0xba92('0x12')];var _0x58496d=_0x160dfc?0x0:_0x47f4a9['offset'];var _0x4a7ab5=_0x160dfc?_0x2f6b56[_0xba92('0x12')]:_0x47f4a9['offset']+_0x47f4a9[_0xba92('0x11')];var _0x5a6800;if(_0x4a7ab5>=_0x1ded03){_0x4a7ab5=_0x1ded03;_0x5a6800=0xc8;}else{_0x5a6800=0xce;}_0x1ccf12[_0xba92('0xd')](_0x5a6800);return _0x1ccf12[_0xba92('0x13')](_0xba92('0x14'),_0x58496d+'-'+_0x4a7ab5+'/'+_0x1ded03)[_0xba92('0xe')](_0x2f6b56);}return null;};}function saveUpdates(_0x495164){return function(_0x47886f){if(_0x47886f){return _0x47886f[_0xba92('0x15')](_0x495164)[_0xba92('0x16')](function(_0x379a59){return _0x379a59;});}return null;};}function removeEntity(_0x3c6adb){return function(_0x406f43){if(_0x406f43){return _0x406f43['destroy']()[_0xba92('0x16')](function(){var _0x48b27f=_0x406f43[_0xba92('0x17')]({'plain':!![]});var _0x12c083=_0xba92('0x18');return db[_0xba92('0x19')][_0xba92('0x1a')]({'where':{'type':_0x12c083,'resourceId':_0x48b27f['id']}})['then'](function(){return _0x406f43;});})[_0xba92('0x16')](function(){_0x3c6adb[_0xba92('0xd')](0xcc)[_0xba92('0x1b')]();});}};}function handleEntityNotFound(_0x2b7f82){return function(_0x5eba5d){if(!_0x5eba5d){_0x2b7f82['sendStatus'](0x194);}return _0x5eba5d;};}function handleError(_0x18f25c,_0x5b4cf2){_0x5b4cf2=_0x5b4cf2||0x1f4;return function(_0x5a5bee){logger[_0xba92('0x1c')](_0x5a5bee[_0xba92('0x1d')]);if(_0x5a5bee[_0xba92('0x1e')]){delete _0x5a5bee[_0xba92('0x1e')];}_0x18f25c[_0xba92('0xd')](_0x5b4cf2)['send'](_0x5a5bee);};}exports[_0xba92('0x1f')]=function(_0x5e072c,_0x413986){var _0x5a461a={};var _0x53cd5d={'count':0x0,'rows':[]};var _0x3519c1=_['map'](db['ChatQueue'][_0xba92('0x20')],function(_0x301b24){return{'name':_0x301b24[_0xba92('0x21')],'type':_0x301b24[_0xba92('0x22')][_0xba92('0x23')]};});_0x5a461a=qs[_0xba92('0x24')](_0x3519c1,_0x5e072c);var _0x2ac7fc={'where':_0x5a461a[_0xba92('0x25')]};return db['ChatQueue'][_0xba92('0x12')](_0x2ac7fc)[_0xba92('0x16')](function(_0x79e687){_0x53cd5d['count']=_0x79e687;_0x5a461a[_0xba92('0x26')]=qs[_0xba92('0x26')](_0x5e072c[_0xba92('0x27')]);return db[_0xba92('0x28')]['findAll'](_0x5a461a);})[_0xba92('0x16')](function(_0x1015e1){_0x53cd5d[_0xba92('0x29')]=_0x1015e1;return _0x53cd5d;})[_0xba92('0x16')](respondWithFilteredResult(_0x413986,_0x5a461a))['catch'](handleError(_0x413986,null));};exports[_0xba92('0x2a')]=function(_0x166c85,_0x1f84e9){var _0x2d8f9f={'raw':!![],'where':{'id':_0x166c85['params']['id']}},_0x34647a={};_0x34647a[_0xba92('0x2b')]=_[_0xba92('0x2c')](db[_0xba92('0x28')]['rawAttributes']);_0x34647a[_0xba92('0x27')]=_[_0xba92('0x2c')](_0x166c85['query']);_0x34647a[_0xba92('0x2d')]=_[_0xba92('0x2e')](_0x34647a['model'],_0x34647a[_0xba92('0x27')]);_0x2d8f9f['attributes']=_[_0xba92('0x2e')](_0x34647a['model'],qs[_0xba92('0x2f')](_0x166c85[_0xba92('0x27')]['fields']));_0x2d8f9f[_0xba92('0x30')]=_0x2d8f9f[_0xba92('0x30')][_0xba92('0x31')]?_0x2d8f9f[_0xba92('0x30')]:_0x34647a[_0xba92('0x2b')];if(_0x166c85[_0xba92('0x27')]['includeAll']){_0x2d8f9f[_0xba92('0x26')]=[{'all':!![]}];}_0x2d8f9f=_['merge']({},_0x2d8f9f,_0x166c85[_0xba92('0x32')]);return db[_0xba92('0x28')]['find'](_0x2d8f9f)[_0xba92('0x16')](handleEntityNotFound(_0x1f84e9,null))['then'](respondWithResult(_0x1f84e9,null))[_0xba92('0x33')](handleError(_0x1f84e9,null));};exports[_0xba92('0x34')]=function(_0x2bf79d,_0x3ad23a){return db[_0xba92('0x28')][_0xba92('0x34')](_0x2bf79d[_0xba92('0x35')],{})['then'](function(_0x2df4fc){var _0x18f85e=_0x2bf79d[_0xba92('0x36')][_0xba92('0x17')]({'plain':!![]});if(!_0x18f85e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18f85e[_0xba92('0x37')]===_0xba92('0x36')){var _0xc209ac=_0x2df4fc[_0xba92('0x17')]({'plain':!![]});var _0x4f6a0a=_0xba92('0x18');return db['UserProfileSection'][_0xba92('0x38')]({'where':{'name':_0x4f6a0a,'userProfileId':_0x18f85e[_0xba92('0x39')]},'raw':!![]})[_0xba92('0x16')](function(_0x327084){if(_0x327084&&_0x327084[_0xba92('0x3a')]===0x0){return db[_0xba92('0x19')]['create']({'name':_0xc209ac[_0xba92('0x1e')],'resourceId':_0xc209ac['id'],'type':_0x327084[_0xba92('0x1e')],'sectionId':_0x327084['id']},{})[_0xba92('0x16')](function(){return _0x2df4fc;});}else{return _0x2df4fc;}})[_0xba92('0x33')](function(_0x2f918b){logger[_0xba92('0x1c')](_0xba92('0x3b'),_0x2f918b);throw _0x2f918b;});}return _0x2df4fc;})[_0xba92('0x16')](respondWithResult(_0x3ad23a,0xc9))[_0xba92('0x33')](handleError(_0x3ad23a,null));};exports[_0xba92('0x15')]=function(_0x3a5bb8,_0x12658a){if(_0x3a5bb8['body']['id']){delete _0x3a5bb8[_0xba92('0x35')]['id'];}return db[_0xba92('0x28')][_0xba92('0x38')]({'where':{'id':_0x3a5bb8[_0xba92('0x3c')]['id']}})[_0xba92('0x16')](handleEntityNotFound(_0x12658a,null))['then'](saveUpdates(_0x3a5bb8[_0xba92('0x35')],null))[_0xba92('0x16')](respondWithResult(_0x12658a,null))[_0xba92('0x33')](handleError(_0x12658a,null));};exports[_0xba92('0x1a')]=function(_0x5bc0c4,_0x503c47){return db[_0xba92('0x28')][_0xba92('0x38')]({'where':{'id':_0x5bc0c4[_0xba92('0x3c')]['id']}})[_0xba92('0x16')](handleEntityNotFound(_0x503c47,null))['then'](removeEntity(_0x503c47,null))[_0xba92('0x33')](handleError(_0x503c47,null));};exports[_0xba92('0x3d')]=function(_0x1a0ada,_0x4f9dce){return db[_0xba92('0x28')][_0xba92('0x3d')]()[_0xba92('0x16')](respondWithResult(_0x4f9dce,null))[_0xba92('0x33')](handleError(_0x4f9dce,null));};exports[_0xba92('0x3e')]=function(_0x1c7587,_0x1cae35){var _0xeb482c={'raw':!![],'where':{}},_0x4fef6b={},_0x37ed62;return db[_0xba92('0x28')]['findOne']({'where':{'id':_0x1c7587['params']['id']}})[_0xba92('0x16')](handleEntityNotFound(_0x1cae35,null))[_0xba92('0x16')](function(_0x7be4eb){if(_0x7be4eb){_0x37ed62=_0x7be4eb[_0xba92('0x17')]({'plain':!![]});_0x4fef6b[_0xba92('0x2b')]=_[_0xba92('0x2c')](db[_0xba92('0x3f')][_0xba92('0x20')]);_0x4fef6b[_0xba92('0x27')]=_[_0xba92('0x2c')](_0x1c7587['query']);_0x4fef6b[_0xba92('0x2d')]=_[_0xba92('0x2e')](_0x4fef6b['model'],_0x4fef6b['query']);_0xeb482c[_0xba92('0x30')]=_[_0xba92('0x2e')](_0x4fef6b[_0xba92('0x2b')],qs[_0xba92('0x2f')](_0x1c7587[_0xba92('0x27')]['fields']));_0xeb482c['attributes']=_0xeb482c['attributes'][_0xba92('0x31')]?_0xeb482c[_0xba92('0x30')]:_0x4fef6b[_0xba92('0x2b')];if(!_0x1c7587['query'][_0xba92('0x40')]('nolimit')){_0xeb482c[_0xba92('0x11')]=qs[_0xba92('0x11')](_0x1c7587[_0xba92('0x27')][_0xba92('0x11')]);_0xeb482c['offset']=qs[_0xba92('0xf')](_0x1c7587[_0xba92('0x27')]['offset']);}_0xeb482c['order']=qs[_0xba92('0x41')](_0x1c7587[_0xba92('0x27')][_0xba92('0x41')]);_0xeb482c['where']=qs[_0xba92('0x2d')](_[_0xba92('0x42')](_0x1c7587[_0xba92('0x27')],_0x4fef6b[_0xba92('0x2d')]));_0xeb482c[_0xba92('0x25')][_0xba92('0x43')]=_0x7be4eb['id'];if(_0x1c7587['query'][_0xba92('0x44')]){_0xeb482c[_0xba92('0x25')]=_[_0xba92('0x45')](_0xeb482c[_0xba92('0x25')],{'$or':_[_0xba92('0x46')](_0xeb482c[_0xba92('0x30')],function(_0x42f1a6){var _0x4fe445={};_0x4fe445[_0x42f1a6]={'$like':'%'+_0x1c7587[_0xba92('0x27')][_0xba92('0x44')]+'%'};return _0x4fe445;})});}_0xeb482c=_[_0xba92('0x45')]({},_0xeb482c,_0x1c7587['options']);return db[_0xba92('0x3f')][_0xba92('0x47')](_0xeb482c);}})[_0xba92('0x16')](function(_0x16ed3c){if(_0x16ed3c){return db[_0xba92('0x48')][_0xba92('0x49')]({'where':{'id':_[_0xba92('0x46')](_0x16ed3c,_0xba92('0x4a')),'role':_0xba92('0x4b')},'attributes':['id',_0xba92('0x1e'),_0xba92('0x4c'),'updatedAt','createdAt']});}})['then'](function(_0x124dc0){if(_0x124dc0){return{'count':_0x124dc0[_0xba92('0x12')],'rows':_[_0xba92('0x46')](_0x124dc0[_0xba92('0x29')],function(_0x2c9c42){return{'membername':_0x2c9c42['name'],'UserId':_0x2c9c42['id'],'queue_name':_0x37ed62[_0xba92('0x1e')],'ChatQueueId':_0x37ed62['id'],'interface':util['format'](_0xba92('0x4d'),_0xba92('0x4e'),_0x2c9c42[_0xba92('0x1e')]),'penalty':0x0,'paused':_0x2c9c42[_0xba92('0x4c')],'createdAt':_0x2c9c42['createdAt'],'updatedAt':_0x2c9c42[_0xba92('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xba92('0x16')](respondWithFilteredResult(_0x1cae35,_0xeb482c))[_0xba92('0x33')](handleError(_0x1cae35,null));};exports[_0xba92('0x50')]=function(_0x533793,_0x2f68e3){var _0x28f211={};var _0x4deef2={};var _0x4f1fda;var _0x30c617;return db[_0xba92('0x28')]['findOne']({'where':{'id':_0x533793[_0xba92('0x3c')]['id']}})[_0xba92('0x16')](handleEntityNotFound(_0x2f68e3,null))[_0xba92('0x16')](function(_0x2c4b0c){if(_0x2c4b0c){_0x4f1fda=_0x2c4b0c;_0x4deef2[_0xba92('0x2b')]=_[_0xba92('0x2c')](db[_0xba92('0x51')][_0xba92('0x20')]);_0x4deef2[_0xba92('0x27')]=_['keys'](_0x533793['query']);_0x4deef2[_0xba92('0x2d')]=_[_0xba92('0x2e')](_0x4deef2[_0xba92('0x2b')],_0x4deef2['query']);_0x28f211[_0xba92('0x30')]=_[_0xba92('0x2e')](_0x4deef2[_0xba92('0x2b')],qs['fields'](_0x533793[_0xba92('0x27')][_0xba92('0x2f')]));_0x28f211['attributes']=_0x28f211[_0xba92('0x30')][_0xba92('0x31')]?_0x28f211['attributes']:_0x4deef2[_0xba92('0x2b')];_0x28f211[_0xba92('0x52')]=qs[_0xba92('0x41')](_0x533793[_0xba92('0x27')][_0xba92('0x41')]);_0x28f211[_0xba92('0x25')]=qs[_0xba92('0x2d')](_[_0xba92('0x42')](_0x533793[_0xba92('0x27')],_0x4deef2['filters']));if(_0x533793[_0xba92('0x27')][_0xba92('0x44')]){_0x28f211[_0xba92('0x25')]=_['merge'](_0x28f211[_0xba92('0x25')],{'$or':_['map'](_0x28f211[_0xba92('0x30')],function(_0x2335b4){var _0xed0028={};_0xed0028[_0x2335b4]={'$like':'%'+_0x533793[_0xba92('0x27')][_0xba92('0x44')]+'%'};return _0xed0028;})});}_0x28f211=_[_0xba92('0x45')]({},_0x28f211,_0x533793[_0xba92('0x32')]);return _0x4f1fda[_0xba92('0x50')](_0x28f211);}})[_0xba92('0x16')](function(_0x555813){if(_0x555813){_0x30c617=_0x555813[_0xba92('0x31')];if(!_0x533793['query'][_0xba92('0x40')]('nolimit')){_0x28f211[_0xba92('0x11')]=qs[_0xba92('0x11')](_0x533793[_0xba92('0x27')][_0xba92('0x11')]);_0x28f211['offset']=qs[_0xba92('0xf')](_0x533793[_0xba92('0x27')][_0xba92('0xf')]);}return _0x4f1fda[_0xba92('0x50')](_0x28f211);}})[_0xba92('0x16')](function(_0x320246){if(_0x320246){return _0x320246?{'count':_0x30c617,'rows':_0x320246}:null;}})[_0xba92('0x16')](respondWithResult(_0x2f68e3,null))[_0xba92('0x33')](handleError(_0x2f68e3,null));};exports[_0xba92('0x53')]=function(_0x242907,_0x541125){var _0x3a88a1=_0x242907['body'][_0xba92('0x54')];return db[_0xba92('0x51')]['findAll']({'where':{'id':_0x3a88a1},'attributes':['id'],'include':[{'model':db[_0xba92('0x48')],'as':_0xba92('0x55'),'attributes':['id','name',_0xba92('0x56'),_0xba92('0x57'),'interface'],'raw':!![]}]})[_0xba92('0x16')](function(_0x3e5edb){if(_0x3e5edb){var _0x2cbe48=_[_0xba92('0x58')](_0x3e5edb,function(_0x29be63){var _0x1f7d7c=_0x29be63['get']({'plain':!![]});return _0x1f7d7c['Agents'];});return db[_0xba92('0x28')]['find']({'where':{'id':_0x242907['params']['id']}})[_0xba92('0x16')](function(_0x48d935){return db[_0xba92('0x59')][_0xba92('0x5a')](function(_0x286d56){return _0x48d935[_0xba92('0x53')](_0x3a88a1,{'transaction':_0x286d56})[_0xba92('0x16')](function(){return BPromise[_0xba92('0x5b')](_0x2cbe48,function(_0x4e7a63){return db[_0xba92('0x3f')][_0xba92('0x5c')]({'where':{'UserId':_0x4e7a63['id'],'ChatQueueId':_0x242907[_0xba92('0x3c')]['id']},'transaction':_0x286d56});});})[_0xba92('0x16')](function(){_0x2cbe48[_0xba92('0x5d')](function(_0x54eb1b){socket[_0xba92('0x5e')]('userChatQueue:save',{'UserId':_0x54eb1b['id'],'ChatQueueId':_0x48d935['id']});});});});});}})[_0xba92('0x16')](respondWithStatusCode(_0x541125,null))[_0xba92('0x33')](handleError(_0x541125,null));};exports[_0xba92('0x5f')]=function(_0x45a206,_0x39161a){return db['Team']['findAll']({'where':{'id':_0x45a206['query'][_0xba92('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xba92('0x55'),'attributes':['id'],'raw':!![]}]})[_0xba92('0x16')](handleEntityNotFound(_0x39161a,null))[_0xba92('0x16')](function(_0x141a3d){var _0x5a5404=_[_0xba92('0x46')](_0x141a3d,'id');var _0x4a1ebf=[];var _0x25cf16=[];var _0x35b47b=squel[_0xba92('0x60')]();_0x35b47b[_0xba92('0x61')](_0xba92('0x62'))[_0xba92('0x63')](_0xba92('0x64'),'tq')[_0xba92('0x65')](_0xba92('0x66'),'ut',_0xba92('0x67'))[_0xba92('0x25')]('ChatQueueId\x20=\x20?',_0x45a206[_0xba92('0x3c')]['id']);for(var _0x3fedf4=0x0;_0x3fedf4<_0x141a3d[_0xba92('0x31')];_0x3fedf4+=0x1){let _0x4559e5=_0x141a3d[_0x3fedf4];for(var _0x3ba9a3=0x0;_0x3ba9a3<_0x4559e5[_0xba92('0x55')][_0xba92('0x31')];_0x3ba9a3+=0x1){let _0x57b095=_0x4559e5['Agents'][_0x3ba9a3];var _0x194d7a=_0x35b47b[_0xba92('0x68')]();_0x194d7a[_0xba92('0x25')](_0xba92('0x69'),_0x57b095['id']);_0x25cf16['push'](db[_0xba92('0x59')][_0xba92('0x27')](_0x194d7a['toString'](),{'type':db[_0xba92('0x59')]['QueryTypes'][_0xba92('0x6a')]})['then'](function(_0x53c681){if(_0x53c681[_0xba92('0x31')]===0x1){return _0x57b095['id'];}else{var _0x383fb5=_['every'](_[_0xba92('0x46')](_0x53c681,'TeamId'),function(_0x519c16){return _[_0xba92('0x6b')](_0x5a5404,_0x519c16);});if(_0x383fb5){return _0x57b095['id'];}}}));}}return BPromise[_0xba92('0x6c')](_0x25cf16)[_0xba92('0x16')](function(_0x1e4d4a){_0x4a1ebf=_(_0x4a1ebf)[_0xba92('0x6d')](_0x1e4d4a)[_0xba92('0x6e')]()[_0xba92('0x6f')]();return db[_0xba92('0x28')][_0xba92('0x38')]({'where':{'id':_0x45a206[_0xba92('0x3c')]['id']}})[_0xba92('0x16')](function(_0xf158d1){return db[_0xba92('0x59')][_0xba92('0x5a')](function(_0xa44da8){return _0xf158d1[_0xba92('0x5f')](_0x45a206[_0xba92('0x27')]['ids'],{'transaction':_0xa44da8})[_0xba92('0x16')](function(){if(!_['isEmpty'](_0x4a1ebf)){return _0xf158d1[_0xba92('0x70')](_0x4a1ebf,{'transaction':_0xa44da8});}})[_0xba92('0x16')](function(){_0x4a1ebf[_0xba92('0x5d')](function(_0x1dda3c){socket['emit']('userChatQueue:remove',{'UserId':_0x1dda3c,'ChatQueueId':_0xf158d1['id']});});});});});});})[_0xba92('0x16')](respondWithStatusCode(_0x39161a,null))[_0xba92('0x33')](handleError(_0x39161a,null));};exports[_0xba92('0x71')]=function(_0x3274d9,_0xc07841){return db[_0xba92('0x28')]['find']({'where':{'id':_0x3274d9[_0xba92('0x3c')]['id']}})[_0xba92('0x16')](handleEntityNotFound(_0xc07841,null))[_0xba92('0x16')](function(_0x41821b){if(_0x41821b){return _0x41821b[_0xba92('0x71')](_0x3274d9['body'][_0xba92('0x54')],_[_0xba92('0x72')](_0x3274d9[_0xba92('0x35')],[_0xba92('0x54'),'id'])||{})[_0xba92('0x73')](function(_0x5a4228){for(var _0x3dc82d=0x0;_0x3dc82d<_0x3274d9[_0xba92('0x35')][_0xba92('0x54')]['length'];_0x3dc82d+=0x1){socket[_0xba92('0x5e')](_0xba92('0x74'),{'UserId':Number(_0x3274d9[_0xba92('0x35')][_0xba92('0x54')][_0x3dc82d]),'ChatQueueId':Number(_0x3274d9[_0xba92('0x3c')]['id'])});}return _0x5a4228;});}})[_0xba92('0x16')](respondWithResult(_0xc07841,null))[_0xba92('0x33')](handleError(_0xc07841,null));};exports[_0xba92('0x70')]=function(_0x160599,_0xd4f001){return db[_0xba92('0x28')][_0xba92('0x38')]({'where':{'id':_0x160599[_0xba92('0x3c')]['id']}})[_0xba92('0x16')](handleEntityNotFound(_0xd4f001,null))['then'](function(_0x4ac02c){if(_0x4ac02c){return _0x4ac02c[_0xba92('0x70')](_0x160599['query']['ids'])[_0xba92('0x16')](function(){if(_['isArray'](_0x160599['query'][_0xba92('0x54')])){for(var _0x49c6e0=0x0;_0x49c6e0<_0x160599[_0xba92('0x27')][_0xba92('0x54')][_0xba92('0x31')];_0x49c6e0+=0x1){socket['emit'](_0xba92('0x75'),{'UserId':Number(_0x160599['query'][_0xba92('0x54')][_0x49c6e0]),'ChatQueueId':Number(_0x160599['params']['id'])});}}else{socket[_0xba92('0x5e')](_0xba92('0x75'),{'UserId':Number(_0x160599[_0xba92('0x27')]['ids']),'ChatQueueId':Number(_0x160599[_0xba92('0x3c')]['id'])});}});}})['then'](respondWithStatusCode(_0xd4f001,null))[_0xba92('0x33')](handleError(_0xd4f001,null));};exports['getAgents']=function(_0x72d6d6,_0xa34e45){var _0x26f04f={};var _0x38f030={};var _0x427486;var _0x49b2b8;return db['ChatQueue'][_0xba92('0x76')]({'where':{'id':_0x72d6d6[_0xba92('0x3c')]['id']}})[_0xba92('0x16')](handleEntityNotFound(_0xa34e45,null))['then'](function(_0x3f1be9){if(_0x3f1be9){_0x427486=_0x3f1be9;_0x38f030[_0xba92('0x2b')]=_[_0xba92('0x2c')](db[_0xba92('0x48')][_0xba92('0x20')]);_0x38f030[_0xba92('0x27')]=_['keys'](_0x72d6d6[_0xba92('0x27')]);_0x38f030['filters']=_['intersection'](_0x38f030[_0xba92('0x2b')],_0x38f030[_0xba92('0x27')]);_0x26f04f[_0xba92('0x30')]=_[_0xba92('0x2e')](_0x38f030[_0xba92('0x2b')],qs['fields'](_0x72d6d6[_0xba92('0x27')][_0xba92('0x2f')]));_0x26f04f[_0xba92('0x30')]=_0x26f04f['attributes']['length']?_0x26f04f[_0xba92('0x30')]:_0x38f030[_0xba92('0x2b')];_0x26f04f['order']=qs['sort'](_0x72d6d6[_0xba92('0x27')]['sort']);_0x26f04f[_0xba92('0x25')]=qs[_0xba92('0x2d')](_[_0xba92('0x42')](_0x72d6d6[_0xba92('0x27')],_0x38f030[_0xba92('0x2d')]));if(_0x72d6d6[_0xba92('0x27')]['filter']){_0x26f04f[_0xba92('0x25')]=_['merge'](_0x26f04f[_0xba92('0x25')],{'$or':_['map'](_0x26f04f[_0xba92('0x30')],function(_0x2c8dc1){var _0x30df0c={};_0x30df0c[_0x2c8dc1]={'$like':'%'+_0x72d6d6['query'][_0xba92('0x44')]+'%'};return _0x30df0c;})});}_0x26f04f=_[_0xba92('0x45')]({},_0x26f04f,_0x72d6d6[_0xba92('0x32')]);return _0x427486[_0xba92('0x77')](_0x26f04f);}})[_0xba92('0x16')](function(_0x590d98){if(_0x590d98){_0x49b2b8=_0x590d98[_0xba92('0x31')];if(!_0x72d6d6[_0xba92('0x27')][_0xba92('0x40')](_0xba92('0x78'))){_0x26f04f[_0xba92('0x11')]=qs[_0xba92('0x11')](_0x72d6d6[_0xba92('0x27')][_0xba92('0x11')]);_0x26f04f[_0xba92('0xf')]=qs['offset'](_0x72d6d6['query'][_0xba92('0xf')]);}return _0x427486[_0xba92('0x77')](_0x26f04f);}})['then'](function(_0x10dfd0){if(_0x10dfd0){return _0x10dfd0?{'count':_0x49b2b8,'rows':_0x10dfd0}:null;}})[_0xba92('0x16')](respondWithResult(_0xa34e45,null))[_0xba92('0x33')](handleError(_0xa34e45,null));}; \ No newline at end of file +var _0x2339=['squel','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','destroy','then','get','ChatQueues','UserProfileResource','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','ChatQueue','include','query','rows','catch','show','params','model','keys','filters','intersection','fields','attributes','length','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserChatQueue','nolimit','order','sort','where','pick','ChatQueueId','map','filter','options','findAll','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','User','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userChatQueue:save','ids','Agents','select','field','tq.TeamId','from','team_has_chat_queues','join','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','union','compact','removeTeams','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','spread','isArray','getAgents','util','lodash'];(function(_0x19ce7a,_0x2317f7){var _0x57d7b1=function(_0x547bb1){while(--_0x547bb1){_0x19ce7a['push'](_0x19ce7a['shift']());}};_0x57d7b1(++_0x2317f7);}(_0x2339,0xf2));var _0x9233=function(_0x3f527c,_0x33dc39){_0x3f527c=_0x3f527c-0x0;var _0x5bc470=_0x2339[_0x3f527c];return _0x5bc470;};'use strict';var BPromise=require('bluebird');var util=require(_0x9233('0x0'));var _=require(_0x9233('0x1'));var squel=require(_0x9233('0x2'));var Redis=require('ioredis');var qs=require(_0x9233('0x3'));var logger=require(_0x9233('0x4'))(_0x9233('0x5'));var config=require('../../config/environment');var db=require(_0x9233('0x6'))['db'];config[_0x9233('0x7')]=_[_0x9233('0x8')](config[_0x9233('0x7')],{'host':_0x9233('0x9'),'port':0x18eb});var socket=require(_0x9233('0xa'))(new Redis(config[_0x9233('0x7')]));require(_0x9233('0xb'))['register'](socket);function respondWithStatusCode(_0x47eb42,_0x36ab37){_0x36ab37=_0x36ab37||0xcc;return function(_0x338d93){if(_0x338d93){return _0x47eb42[_0x9233('0xc')](_0x36ab37);}return _0x47eb42[_0x9233('0xd')](_0x36ab37)['end']();};}function respondWithResult(_0x3f4e7b,_0x27333e){_0x27333e=_0x27333e||0xc8;return function(_0x282625){if(_0x282625){return _0x3f4e7b['status'](_0x27333e)[_0x9233('0xe')](_0x282625);}};}function respondWithFilteredResult(_0x587147,_0x35d953){return function(_0x26de7d){if(_0x26de7d){var _0x130cb2=typeof _0x35d953[_0x9233('0xf')]==='undefined'&&typeof _0x35d953['limit']===_0x9233('0x10');var _0x3dd6b8=_0x26de7d[_0x9233('0x11')];var _0x6e6c62=_0x130cb2?0x0:_0x35d953[_0x9233('0xf')];var _0x10ff6c=_0x130cb2?_0x26de7d[_0x9233('0x11')]:_0x35d953[_0x9233('0xf')]+_0x35d953[_0x9233('0x12')];var _0x1fb62d;if(_0x10ff6c>=_0x3dd6b8){_0x10ff6c=_0x3dd6b8;_0x1fb62d=0xc8;}else{_0x1fb62d=0xce;}_0x587147[_0x9233('0xd')](_0x1fb62d);return _0x587147[_0x9233('0x13')](_0x9233('0x14'),_0x6e6c62+'-'+_0x10ff6c+'/'+_0x3dd6b8)[_0x9233('0xe')](_0x26de7d);}return null;};}function saveUpdates(_0x3a0993){return function(_0x4cdba5){if(_0x4cdba5){return _0x4cdba5['update'](_0x3a0993)['then'](function(_0x551073){return _0x551073;});}return null;};}function removeEntity(_0x4073ff){return function(_0x4ab4e7){if(_0x4ab4e7){return _0x4ab4e7[_0x9233('0x15')]()[_0x9233('0x16')](function(){var _0x295ea5=_0x4ab4e7[_0x9233('0x17')]({'plain':!![]});var _0x414f30=_0x9233('0x18');return db[_0x9233('0x19')][_0x9233('0x15')]({'where':{'type':_0x414f30,'resourceId':_0x295ea5['id']}})[_0x9233('0x16')](function(){return _0x4ab4e7;});})[_0x9233('0x16')](function(){_0x4073ff['status'](0xcc)[_0x9233('0x1a')]();});}};}function handleEntityNotFound(_0x259b65){return function(_0x1f5cb8){if(!_0x1f5cb8){_0x259b65[_0x9233('0xc')](0x194);}return _0x1f5cb8;};}function handleError(_0xddb274,_0x58f166){_0x58f166=_0x58f166||0x1f4;return function(_0x3f8541){logger[_0x9233('0x1b')](_0x3f8541[_0x9233('0x1c')]);if(_0x3f8541['name']){delete _0x3f8541[_0x9233('0x1d')];}_0xddb274[_0x9233('0xd')](_0x58f166)[_0x9233('0x1e')](_0x3f8541);};}exports[_0x9233('0x1f')]=function(_0x53ad7b,_0x56fd8b){var _0x54a697={};var _0xb8ddac={'count':0x0,'rows':[]};var _0x5ee2a1=_['map'](db['ChatQueue'][_0x9233('0x20')],function(_0x12006a){return{'name':_0x12006a[_0x9233('0x21')],'type':_0x12006a[_0x9233('0x22')][_0x9233('0x23')]};});_0x54a697=qs['getOptions'](_0x5ee2a1,_0x53ad7b);var _0x1f4a5f={'where':_0x54a697['where']};return db[_0x9233('0x24')]['count'](_0x1f4a5f)['then'](function(_0x3a86e2){_0xb8ddac[_0x9233('0x11')]=_0x3a86e2;_0x54a697[_0x9233('0x25')]=qs[_0x9233('0x25')](_0x53ad7b[_0x9233('0x26')]);return db['ChatQueue']['findAll'](_0x54a697);})[_0x9233('0x16')](function(_0x13fdaf){_0xb8ddac[_0x9233('0x27')]=_0x13fdaf;return _0xb8ddac;})[_0x9233('0x16')](respondWithFilteredResult(_0x56fd8b,_0x54a697))[_0x9233('0x28')](handleError(_0x56fd8b,null));};exports[_0x9233('0x29')]=function(_0x32bc8b,_0x4c6dca){var _0x352c98={'raw':!![],'where':{'id':_0x32bc8b[_0x9233('0x2a')]['id']}},_0x452674={};_0x452674[_0x9233('0x2b')]=_['keys'](db[_0x9233('0x24')]['rawAttributes']);_0x452674[_0x9233('0x26')]=_[_0x9233('0x2c')](_0x32bc8b[_0x9233('0x26')]);_0x452674[_0x9233('0x2d')]=_[_0x9233('0x2e')](_0x452674['model'],_0x452674[_0x9233('0x26')]);_0x352c98['attributes']=_['intersection'](_0x452674[_0x9233('0x2b')],qs['fields'](_0x32bc8b[_0x9233('0x26')][_0x9233('0x2f')]));_0x352c98['attributes']=_0x352c98[_0x9233('0x30')][_0x9233('0x31')]?_0x352c98[_0x9233('0x30')]:_0x452674[_0x9233('0x2b')];if(_0x32bc8b[_0x9233('0x26')]['includeAll']){_0x352c98[_0x9233('0x25')]=[{'all':!![]}];}_0x352c98=_[_0x9233('0x32')]({},_0x352c98,_0x32bc8b['options']);return db[_0x9233('0x24')]['find'](_0x352c98)[_0x9233('0x16')](handleEntityNotFound(_0x4c6dca,null))[_0x9233('0x16')](respondWithResult(_0x4c6dca,null))[_0x9233('0x28')](handleError(_0x4c6dca,null));};exports[_0x9233('0x33')]=function(_0x405c44,_0x5337e0){return db[_0x9233('0x24')][_0x9233('0x33')](_0x405c44[_0x9233('0x34')],{})[_0x9233('0x16')](function(_0x99139e){var _0x356b19=_0x405c44[_0x9233('0x35')][_0x9233('0x17')]({'plain':!![]});if(!_0x356b19)throw new Error(_0x9233('0x36'));if(_0x356b19[_0x9233('0x37')]===_0x9233('0x35')){var _0x5648ae=_0x99139e['get']({'plain':!![]});var _0x431e05=_0x9233('0x18');return db[_0x9233('0x38')][_0x9233('0x39')]({'where':{'name':_0x431e05,'userProfileId':_0x356b19[_0x9233('0x3a')]},'raw':!![]})[_0x9233('0x16')](function(_0x5b5d56){if(_0x5b5d56&&_0x5b5d56[_0x9233('0x3b')]===0x0){return db[_0x9233('0x19')]['create']({'name':_0x5648ae[_0x9233('0x1d')],'resourceId':_0x5648ae['id'],'type':_0x5b5d56[_0x9233('0x1d')],'sectionId':_0x5b5d56['id']},{})[_0x9233('0x16')](function(){return _0x99139e;});}else{return _0x99139e;}})[_0x9233('0x28')](function(_0x59db25){logger[_0x9233('0x1b')](_0x9233('0x3c'),_0x59db25);throw _0x59db25;});}return _0x99139e;})['then'](respondWithResult(_0x5337e0,0xc9))[_0x9233('0x28')](handleError(_0x5337e0,null));};exports[_0x9233('0x3d')]=function(_0x1a6dea,_0x552fee){if(_0x1a6dea[_0x9233('0x34')]['id']){delete _0x1a6dea[_0x9233('0x34')]['id'];}return db['ChatQueue'][_0x9233('0x39')]({'where':{'id':_0x1a6dea[_0x9233('0x2a')]['id']}})[_0x9233('0x16')](handleEntityNotFound(_0x552fee,null))[_0x9233('0x16')](saveUpdates(_0x1a6dea[_0x9233('0x34')],null))[_0x9233('0x16')](respondWithResult(_0x552fee,null))[_0x9233('0x28')](handleError(_0x552fee,null));};exports['destroy']=function(_0x5ba9cb,_0x10614c){return db[_0x9233('0x24')][_0x9233('0x39')]({'where':{'id':_0x5ba9cb[_0x9233('0x2a')]['id']}})[_0x9233('0x16')](handleEntityNotFound(_0x10614c,null))[_0x9233('0x16')](removeEntity(_0x10614c,null))[_0x9233('0x28')](handleError(_0x10614c,null));};exports[_0x9233('0x3e')]=function(_0x5df49c,_0x50e158){return db['ChatQueue'][_0x9233('0x3e')]()[_0x9233('0x16')](respondWithResult(_0x50e158,null))['catch'](handleError(_0x50e158,null));};exports[_0x9233('0x3f')]=function(_0x4946be,_0x20a727){var _0x2fcba2={'raw':!![],'where':{}},_0x111a8d={},_0x245dba;return db[_0x9233('0x24')][_0x9233('0x40')]({'where':{'id':_0x4946be[_0x9233('0x2a')]['id']}})['then'](handleEntityNotFound(_0x20a727,null))[_0x9233('0x16')](function(_0x594b0d){if(_0x594b0d){_0x245dba=_0x594b0d['get']({'plain':!![]});_0x111a8d['model']=_[_0x9233('0x2c')](db[_0x9233('0x41')][_0x9233('0x20')]);_0x111a8d['query']=_['keys'](_0x4946be[_0x9233('0x26')]);_0x111a8d['filters']=_[_0x9233('0x2e')](_0x111a8d[_0x9233('0x2b')],_0x111a8d['query']);_0x2fcba2[_0x9233('0x30')]=_['intersection'](_0x111a8d['model'],qs[_0x9233('0x2f')](_0x4946be[_0x9233('0x26')][_0x9233('0x2f')]));_0x2fcba2[_0x9233('0x30')]=_0x2fcba2[_0x9233('0x30')]['length']?_0x2fcba2[_0x9233('0x30')]:_0x111a8d[_0x9233('0x2b')];if(!_0x4946be[_0x9233('0x26')]['hasOwnProperty'](_0x9233('0x42'))){_0x2fcba2[_0x9233('0x12')]=qs[_0x9233('0x12')](_0x4946be['query']['limit']);_0x2fcba2['offset']=qs['offset'](_0x4946be[_0x9233('0x26')][_0x9233('0xf')]);}_0x2fcba2[_0x9233('0x43')]=qs[_0x9233('0x44')](_0x4946be['query'][_0x9233('0x44')]);_0x2fcba2[_0x9233('0x45')]=qs[_0x9233('0x2d')](_[_0x9233('0x46')](_0x4946be[_0x9233('0x26')],_0x111a8d[_0x9233('0x2d')]));_0x2fcba2[_0x9233('0x45')][_0x9233('0x47')]=_0x594b0d['id'];if(_0x4946be[_0x9233('0x26')]['filter']){_0x2fcba2[_0x9233('0x45')]=_[_0x9233('0x32')](_0x2fcba2['where'],{'$or':_[_0x9233('0x48')](_0x2fcba2[_0x9233('0x30')],function(_0x47ca09){var _0x1b3564={};_0x1b3564[_0x47ca09]={'$like':'%'+_0x4946be[_0x9233('0x26')][_0x9233('0x49')]+'%'};return _0x1b3564;})});}_0x2fcba2=_[_0x9233('0x32')]({},_0x2fcba2,_0x4946be[_0x9233('0x4a')]);return db[_0x9233('0x41')][_0x9233('0x4b')](_0x2fcba2);}})[_0x9233('0x16')](function(_0xf6d35){if(_0xf6d35){return db['User']['findAndCountAll']({'where':{'id':_[_0x9233('0x48')](_0xf6d35,'UserId'),'role':_0x9233('0x4c')},'attributes':['id',_0x9233('0x1d'),_0x9233('0x4d'),_0x9233('0x4e'),_0x9233('0x4f')]});}})['then'](function(_0x2914dd){if(_0x2914dd){return{'count':_0x2914dd[_0x9233('0x11')],'rows':_[_0x9233('0x48')](_0x2914dd[_0x9233('0x27')],function(_0x503653){return{'membername':_0x503653[_0x9233('0x1d')],'UserId':_0x503653['id'],'queue_name':_0x245dba[_0x9233('0x1d')],'ChatQueueId':_0x245dba['id'],'interface':util[_0x9233('0x50')](_0x9233('0x51'),_0x9233('0x52'),_0x503653[_0x9233('0x1d')]),'penalty':0x0,'paused':_0x503653[_0x9233('0x4d')],'createdAt':_0x503653[_0x9233('0x4f')],'updatedAt':_0x503653[_0x9233('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9233('0x16')](respondWithFilteredResult(_0x20a727,_0x2fcba2))[_0x9233('0x28')](handleError(_0x20a727,null));};exports[_0x9233('0x53')]=function(_0x194264,_0x1f401d){var _0x5a30c5={};var _0x86bf89={};var _0x264077;var _0x3d9098;return db[_0x9233('0x24')][_0x9233('0x40')]({'where':{'id':_0x194264[_0x9233('0x2a')]['id']}})[_0x9233('0x16')](handleEntityNotFound(_0x1f401d,null))[_0x9233('0x16')](function(_0x425c9f){if(_0x425c9f){_0x264077=_0x425c9f;_0x86bf89[_0x9233('0x2b')]=_[_0x9233('0x2c')](db[_0x9233('0x54')][_0x9233('0x20')]);_0x86bf89['query']=_[_0x9233('0x2c')](_0x194264['query']);_0x86bf89['filters']=_[_0x9233('0x2e')](_0x86bf89[_0x9233('0x2b')],_0x86bf89['query']);_0x5a30c5['attributes']=_[_0x9233('0x2e')](_0x86bf89[_0x9233('0x2b')],qs[_0x9233('0x2f')](_0x194264[_0x9233('0x26')][_0x9233('0x2f')]));_0x5a30c5[_0x9233('0x30')]=_0x5a30c5[_0x9233('0x30')][_0x9233('0x31')]?_0x5a30c5[_0x9233('0x30')]:_0x86bf89[_0x9233('0x2b')];_0x5a30c5[_0x9233('0x43')]=qs[_0x9233('0x44')](_0x194264[_0x9233('0x26')][_0x9233('0x44')]);_0x5a30c5[_0x9233('0x45')]=qs['filters'](_[_0x9233('0x46')](_0x194264['query'],_0x86bf89[_0x9233('0x2d')]));if(_0x194264[_0x9233('0x26')][_0x9233('0x49')]){_0x5a30c5[_0x9233('0x45')]=_[_0x9233('0x32')](_0x5a30c5[_0x9233('0x45')],{'$or':_[_0x9233('0x48')](_0x5a30c5[_0x9233('0x30')],function(_0x2b1cf5){var _0x201e33={};_0x201e33[_0x2b1cf5]={'$like':'%'+_0x194264[_0x9233('0x26')]['filter']+'%'};return _0x201e33;})});}_0x5a30c5=_[_0x9233('0x32')]({},_0x5a30c5,_0x194264[_0x9233('0x4a')]);return _0x264077[_0x9233('0x53')](_0x5a30c5);}})['then'](function(_0x2acad0){if(_0x2acad0){_0x3d9098=_0x2acad0[_0x9233('0x31')];if(!_0x194264[_0x9233('0x26')][_0x9233('0x55')](_0x9233('0x42'))){_0x5a30c5[_0x9233('0x12')]=qs[_0x9233('0x12')](_0x194264[_0x9233('0x26')][_0x9233('0x12')]);_0x5a30c5[_0x9233('0xf')]=qs['offset'](_0x194264[_0x9233('0x26')][_0x9233('0xf')]);}return _0x264077['getTeams'](_0x5a30c5);}})[_0x9233('0x16')](function(_0x446e92){if(_0x446e92){return _0x446e92?{'count':_0x3d9098,'rows':_0x446e92}:null;}})[_0x9233('0x16')](respondWithResult(_0x1f401d,null))['catch'](handleError(_0x1f401d,null));};exports[_0x9233('0x56')]=function(_0x4558e3,_0x241705){var _0x2dcdb2=_0x4558e3[_0x9233('0x34')]['ids'];return db[_0x9233('0x54')][_0x9233('0x4b')]({'where':{'id':_0x2dcdb2},'attributes':['id'],'include':[{'model':db[_0x9233('0x57')],'as':'Agents','attributes':['id',_0x9233('0x1d'),'online','voicePause',_0x9233('0x58')],'raw':!![]}]})['then'](function(_0x2af982){if(_0x2af982){var _0x4ea715=_[_0x9233('0x59')](_0x2af982,function(_0x24b8f7){var _0x32a639=_0x24b8f7[_0x9233('0x17')]({'plain':!![]});return _0x32a639['Agents'];});return db[_0x9233('0x24')][_0x9233('0x39')]({'where':{'id':_0x4558e3['params']['id']}})['then'](function(_0x2d2028){return db[_0x9233('0x5a')][_0x9233('0x5b')](function(_0x14faf6){return _0x2d2028[_0x9233('0x56')](_0x2dcdb2,{'transaction':_0x14faf6})[_0x9233('0x16')](function(){return BPromise[_0x9233('0x5c')](_0x4ea715,function(_0x1c8f80){return db[_0x9233('0x41')][_0x9233('0x5d')]({'where':{'UserId':_0x1c8f80['id'],'ChatQueueId':_0x4558e3['params']['id']},'transaction':_0x14faf6});});})['then'](function(){_0x4ea715[_0x9233('0x5e')](function(_0x5be4a4){socket['emit'](_0x9233('0x5f'),{'UserId':_0x5be4a4['id'],'ChatQueueId':_0x2d2028['id']});});});});});}})['then'](respondWithStatusCode(_0x241705,null))[_0x9233('0x28')](handleError(_0x241705,null));};exports['removeTeams']=function(_0x4467b2,_0x2f8b82){return db[_0x9233('0x54')][_0x9233('0x4b')]({'where':{'id':_0x4467b2['query'][_0x9233('0x60')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9233('0x61'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2f8b82,null))[_0x9233('0x16')](function(_0x3d2243){var _0x678e2f=_[_0x9233('0x48')](_0x3d2243,'id');var _0x2c10b9=[];var _0x32564f=[];var _0x1f777a=squel[_0x9233('0x62')]();_0x1f777a[_0x9233('0x63')](_0x9233('0x64'))[_0x9233('0x65')](_0x9233('0x66'),'tq')[_0x9233('0x67')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9233('0x45')](_0x9233('0x68'),_0x4467b2['params']['id']);for(var _0x15d1ac=0x0;_0x15d1ac<_0x3d2243['length'];_0x15d1ac+=0x1){let _0x359843=_0x3d2243[_0x15d1ac];for(var _0x4b1d7d=0x0;_0x4b1d7d<_0x359843[_0x9233('0x61')]['length'];_0x4b1d7d+=0x1){let _0x28bc94=_0x359843[_0x9233('0x61')][_0x4b1d7d];var _0x383096=_0x1f777a[_0x9233('0x69')]();_0x383096['where'](_0x9233('0x6a'),_0x28bc94['id']);_0x32564f['push'](db[_0x9233('0x5a')][_0x9233('0x26')](_0x383096[_0x9233('0x6b')](),{'type':db['sequelize'][_0x9233('0x6c')]['SELECT']})[_0x9233('0x16')](function(_0x3151d4){if(_0x3151d4[_0x9233('0x31')]===0x1){return _0x28bc94['id'];}else{var _0x489dad=_[_0x9233('0x6d')](_[_0x9233('0x48')](_0x3151d4,_0x9233('0x6e')),function(_0x5e04be){return _['includes'](_0x678e2f,_0x5e04be);});if(_0x489dad){return _0x28bc94['id'];}}}));}}return BPromise['all'](_0x32564f)[_0x9233('0x16')](function(_0x3107a1){_0x2c10b9=_(_0x2c10b9)[_0x9233('0x6f')](_0x3107a1)[_0x9233('0x70')]()['value']();return db['ChatQueue'][_0x9233('0x39')]({'where':{'id':_0x4467b2[_0x9233('0x2a')]['id']}})[_0x9233('0x16')](function(_0xb0a3ea){return db['sequelize'][_0x9233('0x5b')](function(_0x289434){return _0xb0a3ea[_0x9233('0x71')](_0x4467b2[_0x9233('0x26')]['ids'],{'transaction':_0x289434})['then'](function(){if(!_[_0x9233('0x72')](_0x2c10b9)){return _0xb0a3ea[_0x9233('0x73')](_0x2c10b9,{'transaction':_0x289434});}})[_0x9233('0x16')](function(){_0x2c10b9[_0x9233('0x5e')](function(_0x6f254a){socket[_0x9233('0x74')](_0x9233('0x75'),{'UserId':_0x6f254a,'ChatQueueId':_0xb0a3ea['id']});});});});});});})[_0x9233('0x16')](respondWithStatusCode(_0x2f8b82,null))[_0x9233('0x28')](handleError(_0x2f8b82,null));};exports['addAgents']=function(_0x249a44,_0x232855){return db[_0x9233('0x24')][_0x9233('0x39')]({'where':{'id':_0x249a44[_0x9233('0x2a')]['id']}})[_0x9233('0x16')](handleEntityNotFound(_0x232855,null))[_0x9233('0x16')](function(_0x4c0230){if(_0x4c0230){return _0x4c0230[_0x9233('0x76')](_0x249a44[_0x9233('0x34')]['ids'],_['omit'](_0x249a44[_0x9233('0x34')],['ids','id'])||{})[_0x9233('0x77')](function(_0x28409e){for(var _0x5f3a33=0x0;_0x5f3a33<_0x249a44['body'][_0x9233('0x60')][_0x9233('0x31')];_0x5f3a33+=0x1){socket[_0x9233('0x74')](_0x9233('0x5f'),{'UserId':Number(_0x249a44[_0x9233('0x34')][_0x9233('0x60')][_0x5f3a33]),'ChatQueueId':Number(_0x249a44[_0x9233('0x2a')]['id'])});}return _0x28409e;});}})['then'](respondWithResult(_0x232855,null))[_0x9233('0x28')](handleError(_0x232855,null));};exports['removeAgents']=function(_0x471cc9,_0x522bf1){return db[_0x9233('0x24')][_0x9233('0x39')]({'where':{'id':_0x471cc9[_0x9233('0x2a')]['id']}})[_0x9233('0x16')](handleEntityNotFound(_0x522bf1,null))['then'](function(_0x21bbdf){if(_0x21bbdf){return _0x21bbdf[_0x9233('0x73')](_0x471cc9[_0x9233('0x26')]['ids'])['then'](function(){if(_[_0x9233('0x78')](_0x471cc9[_0x9233('0x26')][_0x9233('0x60')])){for(var _0x3a5c18=0x0;_0x3a5c18<_0x471cc9[_0x9233('0x26')]['ids'][_0x9233('0x31')];_0x3a5c18+=0x1){socket[_0x9233('0x74')](_0x9233('0x75'),{'UserId':Number(_0x471cc9[_0x9233('0x26')]['ids'][_0x3a5c18]),'ChatQueueId':Number(_0x471cc9[_0x9233('0x2a')]['id'])});}}else{socket['emit'](_0x9233('0x75'),{'UserId':Number(_0x471cc9[_0x9233('0x26')][_0x9233('0x60')]),'ChatQueueId':Number(_0x471cc9['params']['id'])});}});}})[_0x9233('0x16')](respondWithStatusCode(_0x522bf1,null))[_0x9233('0x28')](handleError(_0x522bf1,null));};exports[_0x9233('0x79')]=function(_0xd34a22,_0x48b4cd){var _0x44040b={};var _0x6dbf7a={};var _0x535506;var _0x16e97e;return db[_0x9233('0x24')]['findOne']({'where':{'id':_0xd34a22[_0x9233('0x2a')]['id']}})['then'](handleEntityNotFound(_0x48b4cd,null))[_0x9233('0x16')](function(_0x1ec6d6){if(_0x1ec6d6){_0x535506=_0x1ec6d6;_0x6dbf7a[_0x9233('0x2b')]=_['keys'](db[_0x9233('0x57')][_0x9233('0x20')]);_0x6dbf7a[_0x9233('0x26')]=_[_0x9233('0x2c')](_0xd34a22[_0x9233('0x26')]);_0x6dbf7a[_0x9233('0x2d')]=_[_0x9233('0x2e')](_0x6dbf7a[_0x9233('0x2b')],_0x6dbf7a[_0x9233('0x26')]);_0x44040b['attributes']=_[_0x9233('0x2e')](_0x6dbf7a[_0x9233('0x2b')],qs[_0x9233('0x2f')](_0xd34a22['query']['fields']));_0x44040b[_0x9233('0x30')]=_0x44040b[_0x9233('0x30')][_0x9233('0x31')]?_0x44040b[_0x9233('0x30')]:_0x6dbf7a[_0x9233('0x2b')];_0x44040b[_0x9233('0x43')]=qs[_0x9233('0x44')](_0xd34a22[_0x9233('0x26')]['sort']);_0x44040b[_0x9233('0x45')]=qs[_0x9233('0x2d')](_['pick'](_0xd34a22['query'],_0x6dbf7a[_0x9233('0x2d')]));if(_0xd34a22[_0x9233('0x26')][_0x9233('0x49')]){_0x44040b[_0x9233('0x45')]=_[_0x9233('0x32')](_0x44040b[_0x9233('0x45')],{'$or':_['map'](_0x44040b[_0x9233('0x30')],function(_0x2973a3){var _0x592a07={};_0x592a07[_0x2973a3]={'$like':'%'+_0xd34a22[_0x9233('0x26')][_0x9233('0x49')]+'%'};return _0x592a07;})});}_0x44040b=_[_0x9233('0x32')]({},_0x44040b,_0xd34a22[_0x9233('0x4a')]);return _0x535506[_0x9233('0x79')](_0x44040b);}})[_0x9233('0x16')](function(_0x57c43d){if(_0x57c43d){_0x16e97e=_0x57c43d[_0x9233('0x31')];if(!_0xd34a22['query']['hasOwnProperty'](_0x9233('0x42'))){_0x44040b[_0x9233('0x12')]=qs['limit'](_0xd34a22[_0x9233('0x26')]['limit']);_0x44040b[_0x9233('0xf')]=qs[_0x9233('0xf')](_0xd34a22[_0x9233('0x26')]['offset']);}return _0x535506[_0x9233('0x79')](_0x44040b);}})[_0x9233('0x16')](function(_0x41698b){if(_0x41698b){return _0x41698b?{'count':_0x16e97e,'rows':_0x41698b}:null;}})['then'](respondWithResult(_0x48b4cd,null))[_0x9233('0x28')](handleError(_0x48b4cd,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index f6f94c7..c90edaf 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 _0x5e57=['ChatQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x104f06,_0xb99f12){var _0x4a6ffd=function(_0x1a7668){while(--_0x1a7668){_0x104f06['push'](_0x104f06['shift']());}};_0x4a6ffd(++_0xb99f12);}(_0x5e57,0x170));var _0x75e5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5e57[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x75e5('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x75e5('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x75e5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x75e5('0x3'),'afterDestroy':_0x75e5('0x4')};function emitEvent(_0x4efba7){return function(_0x40d02e,_0x46a5cf,_0x45c20e){ChatQueueEvents[_0x75e5('0x5')](_0x4efba7+':'+_0x40d02e['id'],_0x40d02e);ChatQueueEvents[_0x75e5('0x5')](_0x4efba7,_0x40d02e);_0x45c20e(null);};}for(var e in events){if(events[_0x75e5('0x6')](e)){var event=events[e];ChatQueue[_0x75e5('0x7')](e,emitEvent(event));}}module[_0x75e5('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xa3e6=['hook','exports','events','ChatQueue','save','update','remove','emit','hasOwnProperty'];(function(_0x3fc5e8,_0x5af2c0){var _0x280d80=function(_0x199afb){while(--_0x199afb){_0x3fc5e8['push'](_0x3fc5e8['shift']());}};_0x280d80(++_0x5af2c0);}(_0xa3e6,0x158));var _0x6a3e=function(_0xb881d2,_0x65f919){_0xb881d2=_0xb881d2-0x0;var _0x247b51=_0xa3e6[_0xb881d2];return _0x247b51;};'use strict';var EventEmitter=require(_0x6a3e('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x6a3e('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6a3e('0x2'),'afterUpdate':_0x6a3e('0x3'),'afterDestroy':_0x6a3e('0x4')};function emitEvent(_0x5d8e3d){return function(_0x2190fc,_0x35a2b6,_0x3da56a){ChatQueueEvents[_0x6a3e('0x5')](_0x5d8e3d+':'+_0x2190fc['id'],_0x2190fc);ChatQueueEvents[_0x6a3e('0x5')](_0x5d8e3d,_0x2190fc);_0x3da56a(null);};}for(var e in events){if(events[_0x6a3e('0x6')](e)){var event=events[e];ChatQueue[_0x6a3e('0x7')](e,emitEvent(event));}}module[_0x6a3e('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 22cee6a..7a1a208 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 _0xe6e7=['bluebird','request-promise','path','../../config/environment','./chatQueue.attributes','define','ChatQueue','chat_queues','lodash','util','../../config/logger'];(function(_0x225f1d,_0x586a65){var _0x1f44bb=function(_0x1c51bd){while(--_0x1c51bd){_0x225f1d['push'](_0x225f1d['shift']());}};_0x1f44bb(++_0x586a65);}(_0xe6e7,0x81));var _0x7e6e=function(_0x3a3735,_0x2c7b7c){_0x3a3735=_0x3a3735-0x0;var _0x425ccc=_0xe6e7[_0x3a3735];return _0x425ccc;};'use strict';var _=require(_0x7e6e('0x0'));var util=require(_0x7e6e('0x1'));var logger=require(_0x7e6e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7e6e('0x3'));var rp=require(_0x7e6e('0x4'));var fs=require('fs');var path=require(_0x7e6e('0x5'));var rimraf=require('rimraf');var config=require(_0x7e6e('0x6'));var attributes=require(_0x7e6e('0x7'));module['exports']=function(_0xc63d94,_0x1ab8de){return _0xc63d94[_0x7e6e('0x8')](_0x7e6e('0x9'),attributes,{'tableName':_0x7e6e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ed5=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x3333de,_0x323c42){var _0x20da72=function(_0x151536){while(--_0x151536){_0x3333de['push'](_0x3333de['shift']());}};_0x20da72(++_0x323c42);}(_0x6ed5,0xb6));var _0x56ed=function(_0x4561f1,_0x171083){_0x4561f1=_0x4561f1-0x0;var _0x1ddfb4=_0x6ed5[_0x4561f1];return _0x1ddfb4;};'use strict';var _=require(_0x56ed('0x0'));var util=require(_0x56ed('0x1'));var logger=require(_0x56ed('0x2'))(_0x56ed('0x3'));var moment=require(_0x56ed('0x4'));var BPromise=require(_0x56ed('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x56ed('0x6'));var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module[_0x56ed('0x7')]=function(_0x442557,_0x2a763a){return _0x442557[_0x56ed('0x8')]('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index c91e716..9d5d60a 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 _0x1a37=['then','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowChatQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request'];(function(_0x1f8e00,_0x4efcde){var _0x693a73=function(_0xd7e651){while(--_0xd7e651){_0x1f8e00['push'](_0x1f8e00['shift']());}};_0x693a73(++_0x4efcde);}(_0x1a37,0x127));var _0x71a3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a37[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var moment=require(_0x71a3('0x2'));var BPromise=require(_0x71a3('0x3'));var rs=require(_0x71a3('0x4'));var fs=require('fs');var Redis=require(_0x71a3('0x5'));var db=require(_0x71a3('0x6'))['db'];var utils=require(_0x71a3('0x7'));var logger=require(_0x71a3('0x8'))(_0x71a3('0x9'));var config=require(_0x71a3('0xa'));var jayson=require(_0x71a3('0xb'));var client=jayson[_0x71a3('0xc')][_0x71a3('0xd')]({'port':0x232a});config[_0x71a3('0xe')]=_[_0x71a3('0xf')](config[_0x71a3('0xe')],{'host':_0x71a3('0x10'),'port':0x18eb});var socket=require(_0x71a3('0x11'))(new Redis(config[_0x71a3('0xe')]));require('./chatQueue.socket')[_0x71a3('0x12')](socket);function respondWithRpcPromise(_0x302975,_0x4a91d6,_0x52df4a){return new BPromise(function(_0x71346a,_0x5ee94d){return client[_0x71a3('0x13')](_0x302975,_0x52df4a)[_0x71a3('0x14')](function(_0x471b42){logger['info']('ChatQueue,\x20%s,\x20%s',_0x4a91d6,'request\x20sent');logger[_0x71a3('0x15')](_0x71a3('0x16'),_0x4a91d6,_0x71a3('0x17'),JSON[_0x71a3('0x18')](_0x471b42));if(_0x471b42[_0x71a3('0x19')]){if(_0x471b42[_0x71a3('0x19')][_0x71a3('0x1a')]===0x1f4){logger[_0x71a3('0x19')](_0x71a3('0x1b'),_0x4a91d6,_0x471b42[_0x71a3('0x19')]['message']);return _0x5ee94d(_0x471b42[_0x71a3('0x19')][_0x71a3('0x1c')]);}logger['error'](_0x71a3('0x1b'),_0x4a91d6,_0x471b42[_0x71a3('0x19')][_0x71a3('0x1c')]);return _0x71346a(_0x471b42[_0x71a3('0x19')]['message']);}else{logger[_0x71a3('0x1d')](_0x71a3('0x1b'),_0x4a91d6,_0x71a3('0x17'));_0x71346a(_0x471b42[_0x71a3('0x1e')][_0x71a3('0x1c')]);}})[_0x71a3('0x1f')](function(_0x1f998d){logger[_0x71a3('0x19')]('ChatQueue,\x20%s,\x20%s',_0x4a91d6,_0x1f998d);_0x5ee94d(_0x1f998d);});});}exports[_0x71a3('0x20')]=function(_0x41c124){var _0x4eb38e=this;return new Promise(function(_0x5dc0c7,_0x523935){return db[_0x71a3('0x21')][_0x71a3('0x22')]({'raw':_0x41c124[_0x71a3('0x23')]?_0x41c124[_0x71a3('0x23')][_0x71a3('0x24')]===undefined?!![]:![]:!![],'where':_0x41c124[_0x71a3('0x23')]?_0x41c124['options'][_0x71a3('0x25')]||null:null,'attributes':_0x41c124[_0x71a3('0x23')]?_0x41c124['options']['attributes']||null:null,'limit':_0x41c124['options']?_0x41c124[_0x71a3('0x23')][_0x71a3('0x26')]||null:null,'include':_0x41c124[_0x71a3('0x23')]?_0x41c124[_0x71a3('0x23')][_0x71a3('0x27')]?_[_0x71a3('0x28')](_0x41c124[_0x71a3('0x23')]['include'],function(_0x3b4ebb){return{'model':db[_0x3b4ebb[_0x71a3('0x29')]],'as':_0x3b4ebb['as'],'attributes':_0x3b4ebb['attributes'],'include':_0x3b4ebb[_0x71a3('0x27')]?_[_0x71a3('0x28')](_0x3b4ebb[_0x71a3('0x27')],function(_0x2d42d9){return{'model':db[_0x2d42d9['model']],'as':_0x2d42d9['as'],'attributes':_0x2d42d9[_0x71a3('0x2a')],'include':_0x2d42d9['include']?_[_0x71a3('0x28')](_0x2d42d9[_0x71a3('0x27')],function(_0x3d29c3){return{'model':db[_0x3d29c3[_0x71a3('0x29')]],'as':_0x3d29c3['as'],'attributes':_0x3d29c3[_0x71a3('0x2a')]};}):[]};}):[]};}):[]:[]})[_0x71a3('0x14')](function(_0x547cc3){logger[_0x71a3('0x1d')]('GetChatQueue',_0x41c124);logger[_0x71a3('0x15')](_0x71a3('0x20'),_0x41c124,JSON[_0x71a3('0x18')](_0x547cc3));_0x5dc0c7(_0x547cc3);})[_0x71a3('0x1f')](function(_0x1e489a){logger[_0x71a3('0x19')]('GetChatQueue',_0x1e489a[_0x71a3('0x1c')],_0x41c124);_0x523935(_0x4eb38e[_0x71a3('0x19')](0x1f4,_0x1e489a[_0x71a3('0x1c')]));});});};exports[_0x71a3('0x2b')]=function(_0x3f7afd){var _0x472ef2=this;return new Promise(function(_0x3f5f0f,_0x1c22a4){return db[_0x71a3('0x21')][_0x71a3('0x2c')]({'raw':_0x3f7afd[_0x71a3('0x23')]?_0x3f7afd[_0x71a3('0x23')][_0x71a3('0x24')]===undefined?!![]:![]:!![],'where':_0x3f7afd['options']?_0x3f7afd[_0x71a3('0x23')][_0x71a3('0x25')]||null:null,'attributes':_0x3f7afd[_0x71a3('0x23')]?_0x3f7afd[_0x71a3('0x23')][_0x71a3('0x2a')]||null:null,'include':_0x3f7afd[_0x71a3('0x23')]?_0x3f7afd['options'][_0x71a3('0x27')]?_[_0x71a3('0x28')](_0x3f7afd[_0x71a3('0x23')][_0x71a3('0x27')],function(_0x1ee01a){return{'model':db[_0x1ee01a[_0x71a3('0x29')]],'as':_0x1ee01a['as'],'attributes':_0x1ee01a[_0x71a3('0x2a')],'include':_0x1ee01a['include']?_[_0x71a3('0x28')](_0x1ee01a['include'],function(_0xc17a92){return{'model':db[_0xc17a92[_0x71a3('0x29')]],'as':_0xc17a92['as'],'attributes':_0xc17a92[_0x71a3('0x2a')],'include':_0xc17a92[_0x71a3('0x27')]?_['map'](_0xc17a92[_0x71a3('0x27')],function(_0x51cce4){return{'model':db[_0x51cce4[_0x71a3('0x29')]],'as':_0x51cce4['as'],'attributes':_0x51cce4[_0x71a3('0x2a')]};}):[]};}):[]};}):[]:[]})[_0x71a3('0x14')](function(_0x3561a4){logger[_0x71a3('0x1d')](_0x71a3('0x2b'),_0x3f7afd);logger['debug'](_0x71a3('0x2b'),_0x3f7afd,JSON[_0x71a3('0x18')](_0x3561a4));_0x3f5f0f(_0x3561a4);})['catch'](function(_0x4f95a8){logger[_0x71a3('0x19')](_0x71a3('0x2b'),_0x4f95a8[_0x71a3('0x1c')],_0x3f7afd);_0x1c22a4(_0x472ef2['error'](0x1f4,_0x4f95a8[_0x71a3('0x1c')]));});});}; \ No newline at end of file +var _0x332b=['options','where','attributes','include','map','model','then','debug','ShowChatQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetChatQueue','ChatQueue'];(function(_0x2969bc,_0x1d0a93){var _0x4790df=function(_0x4ec7ed){while(--_0x4ec7ed){_0x2969bc['push'](_0x2969bc['shift']());}};_0x4790df(++_0x1d0a93);}(_0x332b,0x1eb));var _0xb332=function(_0x37b003,_0x330b7a){_0x37b003=_0x37b003-0x0;var _0x1cb93a=_0x332b[_0x37b003];return _0x1cb93a;};'use strict';var _=require(_0xb332('0x0'));var util=require(_0xb332('0x1'));var moment=require(_0xb332('0x2'));var BPromise=require(_0xb332('0x3'));var rs=require(_0xb332('0x4'));var fs=require('fs');var Redis=require(_0xb332('0x5'));var db=require(_0xb332('0x6'))['db'];var utils=require(_0xb332('0x7'));var logger=require(_0xb332('0x8'))('rpc');var config=require(_0xb332('0x9'));var jayson=require(_0xb332('0xa'));var client=jayson[_0xb332('0xb')][_0xb332('0xc')]({'port':0x232a});config[_0xb332('0xd')]=_[_0xb332('0xe')](config[_0xb332('0xd')],{'host':_0xb332('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb332('0xd')]));require('./chatQueue.socket')[_0xb332('0x10')](socket);function respondWithRpcPromise(_0x3a8cc4,_0xf85dc6,_0x3c2721){return new BPromise(function(_0x596db2,_0x55d578){return client['request'](_0x3a8cc4,_0x3c2721)['then'](function(_0x4f9696){logger[_0xb332('0x11')](_0xb332('0x12'),_0xf85dc6,_0xb332('0x13'));logger['debug'](_0xb332('0x14'),_0xf85dc6,'request\x20sent',JSON[_0xb332('0x15')](_0x4f9696));if(_0x4f9696['error']){if(_0x4f9696['error'][_0xb332('0x16')]===0x1f4){logger[_0xb332('0x17')](_0xb332('0x12'),_0xf85dc6,_0x4f9696[_0xb332('0x17')][_0xb332('0x18')]);return _0x55d578(_0x4f9696[_0xb332('0x17')][_0xb332('0x18')]);}logger[_0xb332('0x17')](_0xb332('0x12'),_0xf85dc6,_0x4f9696[_0xb332('0x17')][_0xb332('0x18')]);return _0x596db2(_0x4f9696['error']['message']);}else{logger['info'](_0xb332('0x12'),_0xf85dc6,'request\x20sent');_0x596db2(_0x4f9696[_0xb332('0x19')]['message']);}})[_0xb332('0x1a')](function(_0x1b092d){logger[_0xb332('0x17')](_0xb332('0x12'),_0xf85dc6,_0x1b092d);_0x55d578(_0x1b092d);});});}exports[_0xb332('0x1b')]=function(_0x22312f){var _0x4a1ba0=this;return new Promise(function(_0x2b82db,_0x14dee6){return db[_0xb332('0x1c')]['findAll']({'raw':_0x22312f[_0xb332('0x1d')]?_0x22312f['options']['raw']===undefined?!![]:![]:!![],'where':_0x22312f[_0xb332('0x1d')]?_0x22312f[_0xb332('0x1d')][_0xb332('0x1e')]||null:null,'attributes':_0x22312f['options']?_0x22312f[_0xb332('0x1d')][_0xb332('0x1f')]||null:null,'limit':_0x22312f['options']?_0x22312f[_0xb332('0x1d')]['limit']||null:null,'include':_0x22312f[_0xb332('0x1d')]?_0x22312f[_0xb332('0x1d')][_0xb332('0x20')]?_[_0xb332('0x21')](_0x22312f['options'][_0xb332('0x20')],function(_0x49999a){return{'model':db[_0x49999a['model']],'as':_0x49999a['as'],'attributes':_0x49999a[_0xb332('0x1f')],'include':_0x49999a['include']?_[_0xb332('0x21')](_0x49999a[_0xb332('0x20')],function(_0x17fc02){return{'model':db[_0x17fc02['model']],'as':_0x17fc02['as'],'attributes':_0x17fc02[_0xb332('0x1f')],'include':_0x17fc02['include']?_[_0xb332('0x21')](_0x17fc02[_0xb332('0x20')],function(_0x3c8809){return{'model':db[_0x3c8809[_0xb332('0x22')]],'as':_0x3c8809['as'],'attributes':_0x3c8809[_0xb332('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb332('0x23')](function(_0x51ea26){logger[_0xb332('0x11')](_0xb332('0x1b'),_0x22312f);logger[_0xb332('0x24')](_0xb332('0x1b'),_0x22312f,JSON[_0xb332('0x15')](_0x51ea26));_0x2b82db(_0x51ea26);})[_0xb332('0x1a')](function(_0x197adf){logger[_0xb332('0x17')](_0xb332('0x1b'),_0x197adf['message'],_0x22312f);_0x14dee6(_0x4a1ba0[_0xb332('0x17')](0x1f4,_0x197adf[_0xb332('0x18')]));});});};exports[_0xb332('0x25')]=function(_0x4a7ddd){var _0x3845af=this;return new Promise(function(_0x4c55d3,_0x102df6){return db[_0xb332('0x1c')][_0xb332('0x26')]({'raw':_0x4a7ddd[_0xb332('0x1d')]?_0x4a7ddd[_0xb332('0x1d')][_0xb332('0x27')]===undefined?!![]:![]:!![],'where':_0x4a7ddd['options']?_0x4a7ddd['options'][_0xb332('0x1e')]||null:null,'attributes':_0x4a7ddd[_0xb332('0x1d')]?_0x4a7ddd[_0xb332('0x1d')]['attributes']||null:null,'include':_0x4a7ddd[_0xb332('0x1d')]?_0x4a7ddd[_0xb332('0x1d')][_0xb332('0x20')]?_[_0xb332('0x21')](_0x4a7ddd['options'][_0xb332('0x20')],function(_0x2e10fe){return{'model':db[_0x2e10fe[_0xb332('0x22')]],'as':_0x2e10fe['as'],'attributes':_0x2e10fe[_0xb332('0x1f')],'include':_0x2e10fe[_0xb332('0x20')]?_[_0xb332('0x21')](_0x2e10fe[_0xb332('0x20')],function(_0x46df74){return{'model':db[_0x46df74['model']],'as':_0x46df74['as'],'attributes':_0x46df74[_0xb332('0x1f')],'include':_0x46df74[_0xb332('0x20')]?_[_0xb332('0x21')](_0x46df74[_0xb332('0x20')],function(_0x440fd5){return{'model':db[_0x440fd5[_0xb332('0x22')]],'as':_0x440fd5['as'],'attributes':_0x440fd5[_0xb332('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb332('0x23')](function(_0x10247f){logger[_0xb332('0x11')](_0xb332('0x25'),_0x4a7ddd);logger[_0xb332('0x24')]('ShowChatQueue',_0x4a7ddd,JSON[_0xb332('0x15')](_0x10247f));_0x4c55d3(_0x10247f);})[_0xb332('0x1a')](function(_0x126c0){logger[_0xb332('0x17')](_0xb332('0x25'),_0x126c0['message'],_0x4a7ddd);_0x102df6(_0x3845af[_0xb332('0x17')](0x1f4,_0x126c0[_0xb332('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index d5e493e..458909a 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 _0x80d9=['./chatQueue.events','remove','update','emit','removeListener','chatQueue:'];(function(_0x409b87,_0x5ef488){var _0x46fa68=function(_0x2ddda7){while(--_0x2ddda7){_0x409b87['push'](_0x409b87['shift']());}};_0x46fa68(++_0x5ef488);}(_0x80d9,0x15c));var _0x980d=function(_0x1f8f75,_0x115390){_0x1f8f75=_0x1f8f75-0x0;var _0x4d1161=_0x80d9[_0x1f8f75];return _0x4d1161;};'use strict';var ChatQueueEvents=require(_0x980d('0x0'));var events=['save',_0x980d('0x1'),_0x980d('0x2')];function createListener(_0xac96e5,_0x5d4b87){return function(_0x358d0a){_0x5d4b87[_0x980d('0x3')](_0xac96e5,_0x358d0a);};}function removeListener(_0x38d1b9,_0x279d93){return function(){ChatQueueEvents[_0x980d('0x4')](_0x38d1b9,_0x279d93);};}exports['register']=function(_0x4c3533){for(var _0x2fd4b9=0x0,_0x50854e=events['length'];_0x2fd4b9<_0x50854e;_0x2fd4b9++){var _0x7e96f7=events[_0x2fd4b9];var _0x758fc3=createListener(_0x980d('0x5')+_0x7e96f7,_0x4c3533);ChatQueueEvents['on'](_0x7e96f7,_0x758fc3);}}; \ No newline at end of file +var _0xc3b5=['length','remove','update','emit','register'];(function(_0x2915ed,_0x1407b8){var _0x1d4fd9=function(_0x357ebc){while(--_0x357ebc){_0x2915ed['push'](_0x2915ed['shift']());}};_0x1d4fd9(++_0x1407b8);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x1e8332,_0x19907e){_0x1e8332=_0x1e8332-0x0;var _0x46d11f=_0xc3b5[_0x1e8332];return _0x46d11f;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=['save',_0x5c3b('0x0'),_0x5c3b('0x1')];function createListener(_0xbe95d4,_0x3acf12){return function(_0x2f9a72){_0x3acf12[_0x5c3b('0x2')](_0xbe95d4,_0x2f9a72);};}function removeListener(_0x237a61,_0x48f8a1){return function(){ChatQueueEvents['removeListener'](_0x237a61,_0x48f8a1);};}exports[_0x5c3b('0x3')]=function(_0x6b8a1e){for(var _0x56345e=0x0,_0x568a28=events[_0x5c3b('0x4')];_0x56345e<_0x568a28;_0x56345e++){var _0x420839=events[_0x56345e];var _0x3892ad=createListener('chatQueue:'+_0x420839,_0x6b8a1e);ChatQueueEvents['on'](_0x420839,_0x3892ad);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 104ae04..e3ee10b 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 _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x1d1c0b,_0x3449f2){var _0x57ccd1=function(_0x192b0f){while(--_0x192b0f){_0x1d1c0b['push'](_0x1d1c0b['shift']());}};_0x57ccd1(++_0x3449f2);}(_0x814b,0x1a2));var _0xb814=function(_0x4730bd,_0x1e9541){_0x4730bd=_0x4730bd-0x0;var _0x1b2849=_0x814b[_0x4730bd];return _0x1b2849;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x5966de,_0x2a212e){var _0x287241=function(_0x4f8a91){while(--_0x4f8a91){_0x5966de['push'](_0x5966de['shift']());}};_0x287241(++_0x2a212e);}(_0xe14b,0x93));var _0xbe14=function(_0x20c299,_0x3d9bb3){_0x20c299=_0x20c299-0x0;var _0x2fd0c3=_0xe14b[_0x20c299];return _0x2fd0c3;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index adb1ee7..b290287 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 _0x02ca=['exports','STRING','DATE','moment','sequelize'];(function(_0x26cebd,_0x13b265){var _0x499dc3=function(_0x38dd9a){while(--_0x38dd9a){_0x26cebd['push'](_0x26cebd['shift']());}};_0x499dc3(++_0x13b265);}(_0x02ca,0xdf));var _0xa02c=function(_0x502379,_0x437032){_0x502379=_0x502379-0x0;var _0x1bd978=_0x02ca[_0x502379];return _0x1bd978;};'use strict';var moment=require(_0xa02c('0x0'));var Sequelize=require(_0xa02c('0x1'));module[_0xa02c('0x2')]={'uniqueid':{'type':Sequelize[_0xa02c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa02c('0x3')]},'joinAt':{'type':Sequelize[_0xa02c('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa02c('0x4')]},'exitAt':{'type':Sequelize[_0xa02c('0x4')]},'reason':{'type':Sequelize[_0xa02c('0x3')]}}; \ No newline at end of file +var _0xdf85=['sequelize','STRING','DATE'];(function(_0x368d1a,_0x552486){var _0x4834c6=function(_0x2ce26b){while(--_0x2ce26b){_0x368d1a['push'](_0x368d1a['shift']());}};_0x4834c6(++_0x552486);}(_0xdf85,0x12c));var _0x5df8=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xdf85[_0x57b54c];return _0x59cc19;};'use strict';var moment=require('moment');var Sequelize=require(_0x5df8('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x5df8('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x5df8('0x1')]},'joinAt':{'type':Sequelize[_0x5df8('0x2')]},'leaveAt':{'type':Sequelize[_0x5df8('0x2')]},'acceptAt':{'type':Sequelize[_0x5df8('0x2')]},'exitAt':{'type':Sequelize[_0x5df8('0x2')]},'reason':{'type':Sequelize[_0x5df8('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index ac21f8c..2724b3e 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 _0x8ce1=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','Content-Range','reject','save','update','destroy','then','name','send','index','map','ChatQueueReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','includeAll','include','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis'];(function(_0x3707b0,_0x2d3bbc){var _0x405040=function(_0x135308){while(--_0x135308){_0x3707b0['push'](_0x3707b0['shift']());}};_0x405040(++_0x2d3bbc);}(_0x8ce1,0x152));var _0x18ce=function(_0xa03b53,_0x321d51){_0xa03b53=_0xa03b53-0x0;var _0x55928e=_0x8ce1[_0xa03b53];return _0x55928e;};'use strict';var emlformat=require(_0x18ce('0x0'));var rimraf=require(_0x18ce('0x1'));var zipdir=require(_0x18ce('0x2'));var jsonpatch=require(_0x18ce('0x3'));var rp=require(_0x18ce('0x4'));var moment=require(_0x18ce('0x5'));var BPromise=require(_0x18ce('0x6'));var Mustache=require('mustache');var util=require(_0x18ce('0x7'));var path=require(_0x18ce('0x8'));var sox=require(_0x18ce('0x9'));var csv=require(_0x18ce('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x18ce('0xb'));var _=require(_0x18ce('0xc'));var squel=require('squel');var crypto=require(_0x18ce('0xd'));var jsforce=require(_0x18ce('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x18ce('0xa'));var querystring=require('querystring');var Papa=require(_0x18ce('0xf'));var Redis=require(_0x18ce('0x10'));var authService=require(_0x18ce('0x11'));var qs=require(_0x18ce('0x12'));var as=require(_0x18ce('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x18ce('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x18ce('0x15'));var db=require(_0x18ce('0x16'))['db'];function respondWithStatusCode(_0x13a7d4,_0x361dca){_0x361dca=_0x361dca||0xcc;return function(_0x2f9e0c){if(_0x2f9e0c){return _0x13a7d4[_0x18ce('0x17')](_0x361dca);}return _0x13a7d4['status'](_0x361dca)[_0x18ce('0x18')]();};}function respondWithResult(_0x49c3a6,_0x187c41){_0x187c41=_0x187c41||0xc8;return function(_0x4563ff){if(_0x4563ff){return _0x49c3a6[_0x18ce('0x19')](_0x187c41)[_0x18ce('0x1a')](_0x4563ff);}};}function respondWithFilteredResult(_0x13e59f,_0x4ee0af){return function(_0x40134c){if(_0x40134c){var _0x5a7d99=typeof _0x4ee0af['offset']==='undefined'&&typeof _0x4ee0af['limit']===_0x18ce('0x1b');var _0x3d6202=_0x40134c[_0x18ce('0x1c')];var _0x4e65ba=_0x5a7d99?0x0:_0x4ee0af[_0x18ce('0x1d')];var _0xf9363b=_0x5a7d99?_0x40134c[_0x18ce('0x1c')]:_0x4ee0af[_0x18ce('0x1d')]+_0x4ee0af['limit'];var _0x3e9b16;if(_0xf9363b>=_0x3d6202){_0xf9363b=_0x3d6202;_0x3e9b16=0xc8;}else{_0x3e9b16=0xce;}_0x13e59f[_0x18ce('0x19')](_0x3e9b16);return _0x13e59f['set'](_0x18ce('0x1e'),_0x4e65ba+'-'+_0xf9363b+'/'+_0x3d6202)[_0x18ce('0x1a')](_0x40134c);}return null;};}function patchUpdates(_0x43ff5e){return function(_0x1f8e30){try{jsonpatch['apply'](_0x1f8e30,_0x43ff5e,!![]);}catch(_0x5a92cd){return BPromise[_0x18ce('0x1f')](_0x5a92cd);}return _0x1f8e30[_0x18ce('0x20')]();};}function saveUpdates(_0xc25148,_0x2e1df5){return function(_0x387110){if(_0x387110){return _0x387110[_0x18ce('0x21')](_0xc25148)['then'](function(_0x5e185e){return _0x5e185e;});}return null;};}function removeEntity(_0x52c3b1,_0x163cb8){return function(_0x3c4890){if(_0x3c4890){return _0x3c4890[_0x18ce('0x22')]()[_0x18ce('0x23')](function(){_0x52c3b1[_0x18ce('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c057f,_0x4bb2df){return function(_0x1469cf){if(!_0x1469cf){_0x3c057f['sendStatus'](0x194);}return _0x1469cf;};}function handleError(_0x511ab8,_0x163bfa){_0x163bfa=_0x163bfa||0x1f4;return function(_0x5b5588){logger['error'](_0x5b5588['stack']);if(_0x5b5588[_0x18ce('0x24')]){delete _0x5b5588['name'];}_0x511ab8[_0x18ce('0x19')](_0x163bfa)[_0x18ce('0x25')](_0x5b5588);};}exports[_0x18ce('0x26')]=function(_0xd07835,_0x54ddca){var _0x28a046={},_0x211848={},_0x9bfe7c={'count':0x0,'rows':[]};var _0x347e0b=_[_0x18ce('0x27')](db[_0x18ce('0x28')]['rawAttributes'],function(_0x59d764){return{'name':_0x59d764['fieldName'],'type':_0x59d764[_0x18ce('0x29')][_0x18ce('0x2a')]};});_0x211848[_0x18ce('0x2b')]=_[_0x18ce('0x27')](_0x347e0b,_0x18ce('0x24'));_0x211848[_0x18ce('0x2c')]=_[_0x18ce('0x2d')](_0xd07835[_0x18ce('0x2c')]);_0x211848[_0x18ce('0x2e')]=_[_0x18ce('0x2f')](_0x211848[_0x18ce('0x2b')],_0x211848[_0x18ce('0x2c')]);_0x28a046[_0x18ce('0x30')]=_['intersection'](_0x211848['model'],qs[_0x18ce('0x31')](_0xd07835[_0x18ce('0x2c')][_0x18ce('0x31')]));_0x28a046[_0x18ce('0x30')]=_0x28a046[_0x18ce('0x30')][_0x18ce('0x32')]?_0x28a046[_0x18ce('0x30')]:_0x211848[_0x18ce('0x2b')];if(!_0xd07835[_0x18ce('0x2c')][_0x18ce('0x33')](_0x18ce('0x34'))){_0x28a046[_0x18ce('0x35')]=qs['limit'](_0xd07835['query'][_0x18ce('0x35')]);_0x28a046[_0x18ce('0x1d')]=qs['offset'](_0xd07835['query'][_0x18ce('0x1d')]);}_0x28a046[_0x18ce('0x36')]=qs[_0x18ce('0x37')](_0xd07835['query'][_0x18ce('0x37')]);_0x28a046['where']=qs[_0x18ce('0x2e')](_[_0x18ce('0x38')](_0xd07835[_0x18ce('0x2c')],_0x211848[_0x18ce('0x2e')]),_0x347e0b);if(_0xd07835[_0x18ce('0x2c')][_0x18ce('0x39')]){_0x28a046[_0x18ce('0x3a')]=_[_0x18ce('0x3b')](_0x28a046['where'],{'$or':_['map'](_0x347e0b,function(_0x194d82){if(_0x194d82['type']!==_0x18ce('0x3c')){var _0x167528={};_0x167528[_0x194d82[_0x18ce('0x24')]]={'$like':'%'+_0xd07835[_0x18ce('0x2c')][_0x18ce('0x39')]+'%'};return _0x167528;}})});}_0x28a046=_['merge']({},_0x28a046,_0xd07835[_0x18ce('0x3d')]);var _0x49c4a6={'where':_0x28a046['where']};return db['ChatQueueReport']['count'](_0x49c4a6)[_0x18ce('0x23')](function(_0x2bffac){_0x9bfe7c[_0x18ce('0x1c')]=_0x2bffac;if(_0xd07835[_0x18ce('0x2c')]['includeAll']){_0x28a046['include']=[{'all':!![]}];}return db[_0x18ce('0x28')][_0x18ce('0x3e')](_0x28a046);})[_0x18ce('0x23')](function(_0x4ae02f){_0x9bfe7c['rows']=_0x4ae02f;return _0x9bfe7c;})['then'](respondWithFilteredResult(_0x54ddca,_0x28a046))['catch'](handleError(_0x54ddca,null));};exports['show']=function(_0x55ac56,_0x55ccb0){var _0x1ebeb2={'raw':!![],'where':{'id':_0x55ac56['params']['id']}},_0x37d1bb={};_0x37d1bb[_0x18ce('0x2b')]=_[_0x18ce('0x2d')](db['ChatQueueReport']['rawAttributes']);_0x37d1bb[_0x18ce('0x2c')]=_[_0x18ce('0x2d')](_0x55ac56['query']);_0x37d1bb[_0x18ce('0x2e')]=_[_0x18ce('0x2f')](_0x37d1bb['model'],_0x37d1bb[_0x18ce('0x2c')]);_0x1ebeb2[_0x18ce('0x30')]=_[_0x18ce('0x2f')](_0x37d1bb[_0x18ce('0x2b')],qs[_0x18ce('0x31')](_0x55ac56[_0x18ce('0x2c')]['fields']));_0x1ebeb2['attributes']=_0x1ebeb2[_0x18ce('0x30')][_0x18ce('0x32')]?_0x1ebeb2[_0x18ce('0x30')]:_0x37d1bb[_0x18ce('0x2b')];if(_0x55ac56[_0x18ce('0x2c')][_0x18ce('0x3f')]){_0x1ebeb2[_0x18ce('0x40')]=[{'all':!![]}];}_0x1ebeb2=_[_0x18ce('0x3b')]({},_0x1ebeb2,_0x55ac56[_0x18ce('0x3d')]);return db['ChatQueueReport'][_0x18ce('0x41')](_0x1ebeb2)[_0x18ce('0x23')](handleEntityNotFound(_0x55ccb0,null))[_0x18ce('0x23')](respondWithResult(_0x55ccb0,null))[_0x18ce('0x42')](handleError(_0x55ccb0,null));};exports[_0x18ce('0x43')]=function(_0x24b6dd,_0x5061d3){return db['ChatQueueReport']['create'](_0x24b6dd[_0x18ce('0x44')],{})['then'](respondWithResult(_0x5061d3,0xc9))[_0x18ce('0x42')](handleError(_0x5061d3,null));};exports[_0x18ce('0x21')]=function(_0x4a783d,_0x192cf2){if(_0x4a783d[_0x18ce('0x44')]['id']){delete _0x4a783d[_0x18ce('0x44')]['id'];}return db[_0x18ce('0x28')][_0x18ce('0x41')]({'where':{'id':_0x4a783d[_0x18ce('0x45')]['id']}})[_0x18ce('0x23')](handleEntityNotFound(_0x192cf2,null))['then'](saveUpdates(_0x4a783d['body'],null))[_0x18ce('0x23')](respondWithResult(_0x192cf2,null))[_0x18ce('0x42')](handleError(_0x192cf2,null));};exports[_0x18ce('0x22')]=function(_0x55e771,_0x1d4c23){return db[_0x18ce('0x28')][_0x18ce('0x41')]({'where':{'id':_0x55e771[_0x18ce('0x45')]['id']}})[_0x18ce('0x23')](handleEntityNotFound(_0x1d4c23,null))['then'](removeEntity(_0x1d4c23,null))[_0x18ce('0x42')](handleError(_0x1d4c23,null));};exports[_0x18ce('0x46')]=function(_0x318575,_0x5e2370){return db[_0x18ce('0x28')]['describe']()['then'](respondWithResult(_0x5e2370,null))[_0x18ce('0x42')](handleError(_0x5e2370,null));}; \ No newline at end of file +var _0xed20=['../../mysqldb','sendStatus','end','status','offset','limit','undefined','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','count','includeAll','include','rows','show','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x20f92e,_0x54358f){var _0x4779d5=function(_0x2fca65){while(--_0x2fca65){_0x20f92e['push'](_0x20f92e['shift']());}};_0x4779d5(++_0x54358f);}(_0xed20,0xce));var _0x0ed2=function(_0x591cc7,_0x4437cf){_0x591cc7=_0x591cc7-0x0;var _0x2cd866=_0xed20[_0x591cc7];return _0x2cd866;};'use strict';var emlformat=require(_0x0ed2('0x0'));var rimraf=require(_0x0ed2('0x1'));var zipdir=require(_0x0ed2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ed2('0x3'));var moment=require(_0x0ed2('0x4'));var BPromise=require(_0x0ed2('0x5'));var Mustache=require(_0x0ed2('0x6'));var util=require(_0x0ed2('0x7'));var path=require(_0x0ed2('0x8'));var sox=require('sox');var csv=require(_0x0ed2('0x9'));var ejs=require(_0x0ed2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ed2('0xb'));var squel=require(_0x0ed2('0xc'));var crypto=require(_0x0ed2('0xd'));var jsforce=require(_0x0ed2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0ed2('0x9'));var querystring=require(_0x0ed2('0xf'));var Papa=require(_0x0ed2('0x10'));var Redis=require(_0x0ed2('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0ed2('0x12'));var hardwareService=require(_0x0ed2('0x13'));var logger=require(_0x0ed2('0x14'))(_0x0ed2('0x15'));var utils=require(_0x0ed2('0x16'));var config=require(_0x0ed2('0x17'));var licenseUtil=require(_0x0ed2('0x18'));var db=require(_0x0ed2('0x19'))['db'];function respondWithStatusCode(_0x3cc6b4,_0x342768){_0x342768=_0x342768||0xcc;return function(_0x14355d){if(_0x14355d){return _0x3cc6b4[_0x0ed2('0x1a')](_0x342768);}return _0x3cc6b4['status'](_0x342768)[_0x0ed2('0x1b')]();};}function respondWithResult(_0x3b0f4b,_0x28c90f){_0x28c90f=_0x28c90f||0xc8;return function(_0x11b884){if(_0x11b884){return _0x3b0f4b[_0x0ed2('0x1c')](_0x28c90f)['json'](_0x11b884);}};}function respondWithFilteredResult(_0x30ccd2,_0x55ca){return function(_0x350995){if(_0x350995){var _0x5101f2=typeof _0x55ca[_0x0ed2('0x1d')]==='undefined'&&typeof _0x55ca[_0x0ed2('0x1e')]===_0x0ed2('0x1f');var _0xc0f621=_0x350995['count'];var _0x50c142=_0x5101f2?0x0:_0x55ca[_0x0ed2('0x1d')];var _0x6b3af1=_0x5101f2?_0x350995['count']:_0x55ca[_0x0ed2('0x1d')]+_0x55ca['limit'];var _0x25e4dc;if(_0x6b3af1>=_0xc0f621){_0x6b3af1=_0xc0f621;_0x25e4dc=0xc8;}else{_0x25e4dc=0xce;}_0x30ccd2[_0x0ed2('0x1c')](_0x25e4dc);return _0x30ccd2['set']('Content-Range',_0x50c142+'-'+_0x6b3af1+'/'+_0xc0f621)['json'](_0x350995);}return null;};}function patchUpdates(_0x13060b){return function(_0x270de4){try{jsonpatch[_0x0ed2('0x20')](_0x270de4,_0x13060b,!![]);}catch(_0x1206e3){return BPromise[_0x0ed2('0x21')](_0x1206e3);}return _0x270de4[_0x0ed2('0x22')]();};}function saveUpdates(_0x13d3b7,_0x56f511){return function(_0x4c1dbd){if(_0x4c1dbd){return _0x4c1dbd[_0x0ed2('0x23')](_0x13d3b7)[_0x0ed2('0x24')](function(_0x7a3157){return _0x7a3157;});}return null;};}function removeEntity(_0x505321,_0x42911c){return function(_0x306f97){if(_0x306f97){return _0x306f97[_0x0ed2('0x25')]()[_0x0ed2('0x24')](function(){_0x505321['status'](0xcc)[_0x0ed2('0x1b')]();});}};}function handleEntityNotFound(_0x24983e,_0x1abc6f){return function(_0x19ffde){if(!_0x19ffde){_0x24983e[_0x0ed2('0x1a')](0x194);}return _0x19ffde;};}function handleError(_0x5bb903,_0x14c0e6){_0x14c0e6=_0x14c0e6||0x1f4;return function(_0x23b304){logger[_0x0ed2('0x26')](_0x23b304[_0x0ed2('0x27')]);if(_0x23b304[_0x0ed2('0x28')]){delete _0x23b304[_0x0ed2('0x28')];}_0x5bb903[_0x0ed2('0x1c')](_0x14c0e6)[_0x0ed2('0x29')](_0x23b304);};}exports[_0x0ed2('0x2a')]=function(_0x1e6efe,_0x597c6e){var _0x3bc558={},_0x5e9d4d={},_0x49ff37={'count':0x0,'rows':[]};var _0x3c62e4=_[_0x0ed2('0x2b')](db[_0x0ed2('0x2c')][_0x0ed2('0x2d')],function(_0x2a9b01){return{'name':_0x2a9b01[_0x0ed2('0x2e')],'type':_0x2a9b01['type']['key']};});_0x5e9d4d['model']=_[_0x0ed2('0x2b')](_0x3c62e4,_0x0ed2('0x28'));_0x5e9d4d[_0x0ed2('0x2f')]=_[_0x0ed2('0x30')](_0x1e6efe['query']);_0x5e9d4d[_0x0ed2('0x31')]=_['intersection'](_0x5e9d4d[_0x0ed2('0x32')],_0x5e9d4d[_0x0ed2('0x2f')]);_0x3bc558['attributes']=_[_0x0ed2('0x33')](_0x5e9d4d['model'],qs[_0x0ed2('0x34')](_0x1e6efe[_0x0ed2('0x2f')][_0x0ed2('0x34')]));_0x3bc558[_0x0ed2('0x35')]=_0x3bc558['attributes'][_0x0ed2('0x36')]?_0x3bc558[_0x0ed2('0x35')]:_0x5e9d4d['model'];if(!_0x1e6efe[_0x0ed2('0x2f')][_0x0ed2('0x37')](_0x0ed2('0x38'))){_0x3bc558[_0x0ed2('0x1e')]=qs[_0x0ed2('0x1e')](_0x1e6efe[_0x0ed2('0x2f')][_0x0ed2('0x1e')]);_0x3bc558[_0x0ed2('0x1d')]=qs[_0x0ed2('0x1d')](_0x1e6efe[_0x0ed2('0x2f')][_0x0ed2('0x1d')]);}_0x3bc558[_0x0ed2('0x39')]=qs['sort'](_0x1e6efe['query'][_0x0ed2('0x3a')]);_0x3bc558['where']=qs[_0x0ed2('0x31')](_[_0x0ed2('0x3b')](_0x1e6efe[_0x0ed2('0x2f')],_0x5e9d4d[_0x0ed2('0x31')]),_0x3c62e4);if(_0x1e6efe[_0x0ed2('0x2f')]['filter']){_0x3bc558[_0x0ed2('0x3c')]=_[_0x0ed2('0x3d')](_0x3bc558[_0x0ed2('0x3c')],{'$or':_[_0x0ed2('0x2b')](_0x3c62e4,function(_0x1ec43b){if(_0x1ec43b[_0x0ed2('0x3e')]!==_0x0ed2('0x3f')){var _0x5b9c67={};_0x5b9c67[_0x1ec43b['name']]={'$like':'%'+_0x1e6efe['query'][_0x0ed2('0x40')]+'%'};return _0x5b9c67;}})});}_0x3bc558=_[_0x0ed2('0x3d')]({},_0x3bc558,_0x1e6efe[_0x0ed2('0x41')]);var _0x5606d7={'where':_0x3bc558[_0x0ed2('0x3c')]};return db['ChatQueueReport'][_0x0ed2('0x42')](_0x5606d7)[_0x0ed2('0x24')](function(_0x694ebb){_0x49ff37[_0x0ed2('0x42')]=_0x694ebb;if(_0x1e6efe[_0x0ed2('0x2f')][_0x0ed2('0x43')]){_0x3bc558[_0x0ed2('0x44')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x3bc558);})[_0x0ed2('0x24')](function(_0x4ced59){_0x49ff37[_0x0ed2('0x45')]=_0x4ced59;return _0x49ff37;})[_0x0ed2('0x24')](respondWithFilteredResult(_0x597c6e,_0x3bc558))['catch'](handleError(_0x597c6e,null));};exports[_0x0ed2('0x46')]=function(_0x3f5fa3,_0x50f596){var _0x1b4103={'raw':!![],'where':{'id':_0x3f5fa3['params']['id']}},_0x11c59d={};_0x11c59d[_0x0ed2('0x32')]=_['keys'](db[_0x0ed2('0x2c')][_0x0ed2('0x2d')]);_0x11c59d[_0x0ed2('0x2f')]=_['keys'](_0x3f5fa3['query']);_0x11c59d[_0x0ed2('0x31')]=_[_0x0ed2('0x33')](_0x11c59d[_0x0ed2('0x32')],_0x11c59d[_0x0ed2('0x2f')]);_0x1b4103['attributes']=_['intersection'](_0x11c59d[_0x0ed2('0x32')],qs['fields'](_0x3f5fa3[_0x0ed2('0x2f')][_0x0ed2('0x34')]));_0x1b4103[_0x0ed2('0x35')]=_0x1b4103[_0x0ed2('0x35')][_0x0ed2('0x36')]?_0x1b4103['attributes']:_0x11c59d[_0x0ed2('0x32')];if(_0x3f5fa3[_0x0ed2('0x2f')]['includeAll']){_0x1b4103[_0x0ed2('0x44')]=[{'all':!![]}];}_0x1b4103=_['merge']({},_0x1b4103,_0x3f5fa3['options']);return db[_0x0ed2('0x2c')][_0x0ed2('0x47')](_0x1b4103)[_0x0ed2('0x24')](handleEntityNotFound(_0x50f596,null))[_0x0ed2('0x24')](respondWithResult(_0x50f596,null))[_0x0ed2('0x48')](handleError(_0x50f596,null));};exports['create']=function(_0x567d5e,_0xa5b266){return db[_0x0ed2('0x2c')][_0x0ed2('0x49')](_0x567d5e[_0x0ed2('0x4a')],{})[_0x0ed2('0x24')](respondWithResult(_0xa5b266,0xc9))[_0x0ed2('0x48')](handleError(_0xa5b266,null));};exports[_0x0ed2('0x23')]=function(_0x6b3269,_0x3387e1){if(_0x6b3269[_0x0ed2('0x4a')]['id']){delete _0x6b3269[_0x0ed2('0x4a')]['id'];}return db[_0x0ed2('0x2c')][_0x0ed2('0x47')]({'where':{'id':_0x6b3269[_0x0ed2('0x4b')]['id']}})[_0x0ed2('0x24')](handleEntityNotFound(_0x3387e1,null))[_0x0ed2('0x24')](saveUpdates(_0x6b3269[_0x0ed2('0x4a')],null))['then'](respondWithResult(_0x3387e1,null))[_0x0ed2('0x48')](handleError(_0x3387e1,null));};exports[_0x0ed2('0x25')]=function(_0x204460,_0x58e9ca){return db[_0x0ed2('0x2c')]['find']({'where':{'id':_0x204460[_0x0ed2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x58e9ca,null))[_0x0ed2('0x24')](removeEntity(_0x58e9ca,null))[_0x0ed2('0x48')](handleError(_0x58e9ca,null));};exports[_0x0ed2('0x4c')]=function(_0x1c77e2,_0x4b690e){return db['ChatQueueReport'][_0x0ed2('0x4c')]()['then'](respondWithResult(_0x4b690e,null))[_0x0ed2('0x48')](handleError(_0x4b690e,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index ca523ab..00740b4 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 _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x38ca5d,_0x4664ca){var _0x11ead7=function(_0x44aebc){while(--_0x44aebc){_0x38ca5d['push'](_0x38ca5d['shift']());}};_0x11ead7(++_0x4664ca);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x4d01e3,_0x44c37e){var _0x3b2491=function(_0x40b771){while(--_0x40b771){_0x4d01e3['push'](_0x4d01e3['shift']());}};_0x3b2491(++_0x44c37e);}(_0x757a,0xde));var _0xa757=function(_0x9fadbd,_0x29b939){_0x9fadbd=_0x9fadbd-0x0;var _0x437523=_0x757a[_0x9fadbd];return _0x437523;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index b56b04b..afd917a 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 _0xbbd3=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','info','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0x500655,_0x111a9c){var _0x395b0a=function(_0x478385){while(--_0x478385){_0x500655['push'](_0x500655['shift']());}};_0x395b0a(++_0x111a9c);}(_0xbbd3,0xf8));var _0x3bbd=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xbbd3[_0x2064e5];return _0x21a233;};'use strict';var _=require(_0x3bbd('0x0'));var util=require(_0x3bbd('0x1'));var moment=require(_0x3bbd('0x2'));var BPromise=require(_0x3bbd('0x3'));var rs=require(_0x3bbd('0x4'));var fs=require('fs');var Redis=require(_0x3bbd('0x5'));var db=require(_0x3bbd('0x6'))['db'];var utils=require(_0x3bbd('0x7'));var logger=require('../../config/logger')(_0x3bbd('0x8'));var config=require(_0x3bbd('0x9'));var jayson=require(_0x3bbd('0xa'));var client=jayson[_0x3bbd('0xb')][_0x3bbd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14e71f,_0xc39e73,_0x3ae881){return new BPromise(function(_0x23379f,_0x2c2fa9){return client[_0x3bbd('0xd')](_0x14e71f,_0x3ae881)[_0x3bbd('0xe')](function(_0xd2add3){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0xc39e73,'request\x20sent');logger[_0x3bbd('0xf')](_0x3bbd('0x10'),_0xc39e73,_0x3bbd('0x11'),JSON[_0x3bbd('0x12')](_0xd2add3));if(_0xd2add3[_0x3bbd('0x13')]){if(_0xd2add3[_0x3bbd('0x13')][_0x3bbd('0x14')]===0x1f4){logger[_0x3bbd('0x13')](_0x3bbd('0x15'),_0xc39e73,_0xd2add3[_0x3bbd('0x13')][_0x3bbd('0x16')]);return _0x2c2fa9(_0xd2add3[_0x3bbd('0x13')][_0x3bbd('0x16')]);}logger[_0x3bbd('0x13')](_0x3bbd('0x15'),_0xc39e73,_0xd2add3[_0x3bbd('0x13')][_0x3bbd('0x16')]);return _0x23379f(_0xd2add3[_0x3bbd('0x13')][_0x3bbd('0x16')]);}else{logger[_0x3bbd('0x17')](_0x3bbd('0x15'),_0xc39e73,'request\x20sent');_0x23379f(_0xd2add3['result'][_0x3bbd('0x16')]);}})[_0x3bbd('0x18')](function(_0x9ac90d){logger[_0x3bbd('0x13')](_0x3bbd('0x15'),_0xc39e73,_0x9ac90d);_0x2c2fa9(_0x9ac90d);});});}exports[_0x3bbd('0x19')]=function(_0x6d8b31){var _0x3c87d7=this;return new Promise(function(_0x4c406d,_0x1666bc){return db[_0x3bbd('0x1a')][_0x3bbd('0x1b')](_0x6d8b31[_0x3bbd('0x1c')],{'raw':_0x6d8b31['options']?_0x6d8b31[_0x3bbd('0x1d')][_0x3bbd('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x1a6b30){logger[_0x3bbd('0x17')](_0x3bbd('0x19'),_0x6d8b31);logger[_0x3bbd('0xf')](_0x3bbd('0x19'),_0x6d8b31,JSON['stringify'](_0x1a6b30));_0x4c406d(_0x1a6b30);})[_0x3bbd('0x18')](function(_0x386762){logger['error'](_0x3bbd('0x19'),_0x386762[_0x3bbd('0x16')],_0x6d8b31);_0x1666bc(_0x3c87d7[_0x3bbd('0x13')](0x1f4,_0x386762['message']));});});};exports[_0x3bbd('0x1f')]=function(_0xb3ac43){var _0x202e7f=this;return new Promise(function(_0x114e97,_0x2c9dab){return db[_0x3bbd('0x1a')][_0x3bbd('0x20')](_0xb3ac43[_0x3bbd('0x1c')],{'raw':_0xb3ac43['options']?_0xb3ac43['options'][_0x3bbd('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb3ac43[_0x3bbd('0x1d')]?_0xb3ac43[_0x3bbd('0x1d')][_0x3bbd('0x21')]||null:null,'attributes':_0xb3ac43[_0x3bbd('0x1d')]?_0xb3ac43['options'][_0x3bbd('0x22')]||null:null,'limit':_0xb3ac43[_0x3bbd('0x1d')]?_0xb3ac43['options'][_0x3bbd('0x23')]||null:null})[_0x3bbd('0xe')](function(_0x92e061){logger[_0x3bbd('0x17')](_0x3bbd('0x1f'),_0xb3ac43);logger[_0x3bbd('0xf')](_0x3bbd('0x1f'),_0xb3ac43,JSON[_0x3bbd('0x12')](_0x92e061));_0x114e97(_0x92e061);})[_0x3bbd('0x18')](function(_0x65d79a){logger[_0x3bbd('0x13')](_0x3bbd('0x1f'),_0x65d79a[_0x3bbd('0x16')],_0xb3ac43);_0x2c9dab(_0x202e7f[_0x3bbd('0x13')](0x1f4,_0x65d79a[_0x3bbd('0x16')]));});});}; \ No newline at end of file +var _0xea36=['where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','ChatQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','then','UpdateChatQueueReport','update','body'];(function(_0x1e4612,_0xcfd7d6){var _0x40aaa3=function(_0x2aa6dd){while(--_0x2aa6dd){_0x1e4612['push'](_0x1e4612['shift']());}};_0x40aaa3(++_0xcfd7d6);}(_0xea36,0xfa));var _0x6ea3=function(_0x331bc7,_0x35ee48){_0x331bc7=_0x331bc7-0x0;var _0x286a84=_0xea36[_0x331bc7];return _0x286a84;};'use strict';var _=require(_0x6ea3('0x0'));var util=require(_0x6ea3('0x1'));var moment=require(_0x6ea3('0x2'));var BPromise=require(_0x6ea3('0x3'));var rs=require(_0x6ea3('0x4'));var fs=require('fs');var Redis=require(_0x6ea3('0x5'));var db=require(_0x6ea3('0x6'))['db'];var utils=require(_0x6ea3('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6ea3('0x8'));var jayson=require(_0x6ea3('0x9'));var client=jayson[_0x6ea3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1163b7,_0x7c406a,_0x33c269){return new BPromise(function(_0x5864e9,_0x340c8d){return client['request'](_0x1163b7,_0x33c269)['then'](function(_0x5ec474){logger['info'](_0x6ea3('0xb'),_0x7c406a,'request\x20sent');logger[_0x6ea3('0xc')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x7c406a,_0x6ea3('0xd'),JSON[_0x6ea3('0xe')](_0x5ec474));if(_0x5ec474[_0x6ea3('0xf')]){if(_0x5ec474[_0x6ea3('0xf')][_0x6ea3('0x10')]===0x1f4){logger[_0x6ea3('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x7c406a,_0x5ec474[_0x6ea3('0xf')][_0x6ea3('0x11')]);return _0x340c8d(_0x5ec474[_0x6ea3('0xf')][_0x6ea3('0x11')]);}logger[_0x6ea3('0xf')](_0x6ea3('0xb'),_0x7c406a,_0x5ec474[_0x6ea3('0xf')]['message']);return _0x5864e9(_0x5ec474[_0x6ea3('0xf')][_0x6ea3('0x11')]);}else{logger[_0x6ea3('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x7c406a,'request\x20sent');_0x5864e9(_0x5ec474['result'][_0x6ea3('0x11')]);}})[_0x6ea3('0x13')](function(_0x1ca246){logger[_0x6ea3('0xf')](_0x6ea3('0xb'),_0x7c406a,_0x1ca246);_0x340c8d(_0x1ca246);});});}exports[_0x6ea3('0x14')]=function(_0x198e09){var _0x5b3ae6=this;return new Promise(function(_0x13c6ab,_0x4ce7a1){return db[_0x6ea3('0x15')][_0x6ea3('0x16')](_0x198e09['body'],{'raw':_0x198e09[_0x6ea3('0x17')]?_0x198e09[_0x6ea3('0x17')][_0x6ea3('0x18')]===undefined?!![]:![]:!![]})[_0x6ea3('0x19')](function(_0x56210a){logger[_0x6ea3('0x12')](_0x6ea3('0x14'),_0x198e09);logger[_0x6ea3('0xc')](_0x6ea3('0x14'),_0x198e09,JSON[_0x6ea3('0xe')](_0x56210a));_0x13c6ab(_0x56210a);})['catch'](function(_0x2c6ec8){logger['error'](_0x6ea3('0x14'),_0x2c6ec8[_0x6ea3('0x11')],_0x198e09);_0x4ce7a1(_0x5b3ae6['error'](0x1f4,_0x2c6ec8['message']));});});};exports[_0x6ea3('0x1a')]=function(_0x199880){var _0x2207ec=this;return new Promise(function(_0x4c53bc,_0x3b091a){return db[_0x6ea3('0x15')][_0x6ea3('0x1b')](_0x199880[_0x6ea3('0x1c')],{'raw':_0x199880[_0x6ea3('0x17')]?_0x199880[_0x6ea3('0x17')][_0x6ea3('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x199880['options']?_0x199880['options'][_0x6ea3('0x1d')]||null:null,'attributes':_0x199880[_0x6ea3('0x17')]?_0x199880['options']['attributes']||null:null,'limit':_0x199880[_0x6ea3('0x17')]?_0x199880['options'][_0x6ea3('0x1e')]||null:null})['then'](function(_0x1619e6){logger[_0x6ea3('0x12')](_0x6ea3('0x1a'),_0x199880);logger[_0x6ea3('0xc')](_0x6ea3('0x1a'),_0x199880,JSON['stringify'](_0x1619e6));_0x4c53bc(_0x1619e6);})[_0x6ea3('0x13')](function(_0x124b34){logger[_0x6ea3('0xf')](_0x6ea3('0x1a'),_0x124b34[_0x6ea3('0x11')],_0x199880);_0x3b091a(_0x2207ec[_0x6ea3('0xf')](0x1f4,_0x124b34['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 49858cd..2131b07 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 _0x67f5=['index','/describe','/:id','show','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated'];(function(_0x53437b,_0x33a52a){var _0x60e84b=function(_0x10275b){while(--_0x10275b){_0x53437b['push'](_0x53437b['shift']());}};_0x60e84b(++_0x33a52a);}(_0x67f5,0x9b));var _0x567f=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x67f5[_0x4709c0];return _0x13348b;};'use strict';var multer=require(_0x567f('0x0'));var util=require(_0x567f('0x1'));var path=require(_0x567f('0x2'));var timeout=require(_0x567f('0x3'));var express=require(_0x567f('0x4'));var router=express[_0x567f('0x5')]();var fs_extra=require(_0x567f('0x6'));var auth=require(_0x567f('0x7'));var interaction=require(_0x567f('0x8'));var config=require(_0x567f('0x9'));var controller=require(_0x567f('0xa'));router[_0x567f('0xb')]('/',auth[_0x567f('0xc')](),controller[_0x567f('0xd')]);router[_0x567f('0xb')](_0x567f('0xe'),auth[_0x567f('0xc')](),controller['describe']);router['get'](_0x567f('0xf'),auth[_0x567f('0xc')](),controller[_0x567f('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x567f('0x11')]('/:id',auth[_0x567f('0xc')](),controller[_0x567f('0x12')]);router['delete'](_0x567f('0xf'),auth[_0x567f('0xc')](),controller[_0x567f('0x13')]);module[_0x567f('0x14')]=router; \ No newline at end of file +var _0x2dd8=['./chatQueueReport.controller','get','isAuthenticated','index','/describe','/:id','create','put','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service'];(function(_0x13c3bd,_0x11bcfb){var _0x4bbc90=function(_0x3958d2){while(--_0x3958d2){_0x13c3bd['push'](_0x13c3bd['shift']());}};_0x4bbc90(++_0x11bcfb);}(_0x2dd8,0x11b));var _0x82dd=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2dd8[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x82dd('0x0'));var util=require(_0x82dd('0x1'));var path=require(_0x82dd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x82dd('0x3')]();var fs_extra=require(_0x82dd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x82dd('0x5'));var config=require('../../config/environment');var controller=require(_0x82dd('0x6'));router[_0x82dd('0x7')]('/',auth[_0x82dd('0x8')](),controller[_0x82dd('0x9')]);router[_0x82dd('0x7')](_0x82dd('0xa'),auth[_0x82dd('0x8')](),controller['describe']);router[_0x82dd('0x7')](_0x82dd('0xb'),auth[_0x82dd('0x8')](),controller['show']);router['post']('/',auth[_0x82dd('0x8')](),controller[_0x82dd('0xc')]);router[_0x82dd('0xd')](_0x82dd('0xb'),auth[_0x82dd('0x8')](),controller['update']);router[_0x82dd('0xe')](_0x82dd('0xb'),auth[_0x82dd('0x8')](),controller[_0x82dd('0xf')]);module[_0x82dd('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 2b269f5..0f33388 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x153136,_0x2be1b6){var _0x35abfd=function(_0xc9e71f){while(--_0xc9e71f){_0x153136['push'](_0x153136['shift']());}};_0x35abfd(++_0x2be1b6);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0xeec444,_0x267a72){var _0x124b7b=function(_0x50712d){while(--_0x50712d){_0xeec444['push'](_0xeec444['shift']());}};_0x124b7b(++_0x267a72);}(_0x70e0,0x17b));var _0x070e=function(_0x5b0ad9,_0x346d66){_0x5b0ad9=_0x5b0ad9-0x0;var _0xc976c6=_0x70e0[_0x5b0ad9];return _0xc976c6;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 37889ec..8a2fca2 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 _0xd2ad=['ChatTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','keys','length','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','undefined','offset','count','limit','set','Content-Range','reject','save','update','then','error','stack','name','send'];(function(_0x329d13,_0x1aff27){var _0x33efd9=function(_0x265b7d){while(--_0x265b7d){_0x329d13['push'](_0x329d13['shift']());}};_0x33efd9(++_0x1aff27);}(_0xd2ad,0x13b));var _0xdd2a=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xd2ad[_0x373dee];return _0x46798f;};'use strict';var emlformat=require(_0xdd2a('0x0'));var rimraf=require(_0xdd2a('0x1'));var zipdir=require(_0xdd2a('0x2'));var jsonpatch=require(_0xdd2a('0x3'));var rp=require(_0xdd2a('0x4'));var moment=require(_0xdd2a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdd2a('0x6'));var util=require(_0xdd2a('0x7'));var path=require(_0xdd2a('0x8'));var sox=require(_0xdd2a('0x9'));var csv=require(_0xdd2a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdd2a('0xb'));var _=require(_0xdd2a('0xc'));var squel=require('squel');var crypto=require(_0xdd2a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdd2a('0xe'));var toCsv=require(_0xdd2a('0xa'));var querystring=require(_0xdd2a('0xf'));var Papa=require(_0xdd2a('0x10'));var Redis=require(_0xdd2a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdd2a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd2a('0x13'))(_0xdd2a('0x14'));var utils=require(_0xdd2a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdd2a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x381447,_0x37160e){_0x37160e=_0x37160e||0xcc;return function(_0x1dec8a){if(_0x1dec8a){return _0x381447[_0xdd2a('0x17')](_0x37160e);}return _0x381447['status'](_0x37160e)[_0xdd2a('0x18')]();};}function respondWithResult(_0x42f414,_0x109cb2){_0x109cb2=_0x109cb2||0xc8;return function(_0x26748e){if(_0x26748e){return _0x42f414[_0xdd2a('0x19')](_0x109cb2)['json'](_0x26748e);}};}function respondWithFilteredResult(_0x50abac,_0x58ed46){return function(_0x5a19ed){if(_0x5a19ed){var _0x13af5c=typeof _0x58ed46['offset']===_0xdd2a('0x1a')&&typeof _0x58ed46['limit']===_0xdd2a('0x1a');var _0x3fc569=_0x5a19ed['count'];var _0x40bdd5=_0x13af5c?0x0:_0x58ed46[_0xdd2a('0x1b')];var _0xebd63c=_0x13af5c?_0x5a19ed[_0xdd2a('0x1c')]:_0x58ed46['offset']+_0x58ed46[_0xdd2a('0x1d')];var _0x5a7803;if(_0xebd63c>=_0x3fc569){_0xebd63c=_0x3fc569;_0x5a7803=0xc8;}else{_0x5a7803=0xce;}_0x50abac[_0xdd2a('0x19')](_0x5a7803);return _0x50abac[_0xdd2a('0x1e')](_0xdd2a('0x1f'),_0x40bdd5+'-'+_0xebd63c+'/'+_0x3fc569)['json'](_0x5a19ed);}return null;};}function patchUpdates(_0x1a584e){return function(_0xa7ed2c){try{jsonpatch['apply'](_0xa7ed2c,_0x1a584e,!![]);}catch(_0x37818c){return BPromise[_0xdd2a('0x20')](_0x37818c);}return _0xa7ed2c[_0xdd2a('0x21')]();};}function saveUpdates(_0x437260,_0x5ce928){return function(_0x2029ce){if(_0x2029ce){return _0x2029ce[_0xdd2a('0x22')](_0x437260)[_0xdd2a('0x23')](function(_0x1bddbe){return _0x1bddbe;});}return null;};}function removeEntity(_0x255fc7,_0x3acafc){return function(_0x4a0730){if(_0x4a0730){return _0x4a0730['destroy']()[_0xdd2a('0x23')](function(){_0x255fc7[_0xdd2a('0x19')](0xcc)[_0xdd2a('0x18')]();});}};}function handleEntityNotFound(_0x2d727d,_0x1f2ac7){return function(_0x4c3578){if(!_0x4c3578){_0x2d727d[_0xdd2a('0x17')](0x194);}return _0x4c3578;};}function handleError(_0x3a40b3,_0xb1967e){_0xb1967e=_0xb1967e||0x1f4;return function(_0x2f4794){logger[_0xdd2a('0x24')](_0x2f4794[_0xdd2a('0x25')]);if(_0x2f4794[_0xdd2a('0x26')]){delete _0x2f4794[_0xdd2a('0x26')];}_0x3a40b3['status'](_0xb1967e)[_0xdd2a('0x27')](_0x2f4794);};}exports['index']=function(_0x37ba2a,_0x3934a5){var _0x175ee8={},_0x2239d1={},_0xb10df3={'count':0x0,'rows':[]};var _0x265340=_['map'](db[_0xdd2a('0x28')][_0xdd2a('0x29')],function(_0x1b12ce){return{'name':_0x1b12ce[_0xdd2a('0x2a')],'type':_0x1b12ce[_0xdd2a('0x2b')][_0xdd2a('0x2c')]};});_0x2239d1[_0xdd2a('0x2d')]=_['map'](_0x265340,_0xdd2a('0x26'));_0x2239d1[_0xdd2a('0x2e')]=_['keys'](_0x37ba2a[_0xdd2a('0x2e')]);_0x2239d1[_0xdd2a('0x2f')]=_[_0xdd2a('0x30')](_0x2239d1[_0xdd2a('0x2d')],_0x2239d1['query']);_0x175ee8[_0xdd2a('0x31')]=_[_0xdd2a('0x30')](_0x2239d1[_0xdd2a('0x2d')],qs[_0xdd2a('0x32')](_0x37ba2a[_0xdd2a('0x2e')][_0xdd2a('0x32')]));_0x175ee8['attributes']=_0x175ee8[_0xdd2a('0x31')]['length']?_0x175ee8[_0xdd2a('0x31')]:_0x2239d1['model'];if(!_0x37ba2a['query']['hasOwnProperty'](_0xdd2a('0x33'))){_0x175ee8[_0xdd2a('0x1d')]=qs[_0xdd2a('0x1d')](_0x37ba2a[_0xdd2a('0x2e')][_0xdd2a('0x1d')]);_0x175ee8[_0xdd2a('0x1b')]=qs['offset'](_0x37ba2a['query'][_0xdd2a('0x1b')]);}_0x175ee8[_0xdd2a('0x34')]=qs[_0xdd2a('0x35')](_0x37ba2a[_0xdd2a('0x2e')][_0xdd2a('0x35')]);_0x175ee8[_0xdd2a('0x36')]=qs[_0xdd2a('0x2f')](_[_0xdd2a('0x37')](_0x37ba2a[_0xdd2a('0x2e')],_0x2239d1[_0xdd2a('0x2f')]),_0x265340);if(_0x37ba2a[_0xdd2a('0x2e')]['filter']){_0x175ee8['where']=_['merge'](_0x175ee8[_0xdd2a('0x36')],{'$or':_['map'](_0x265340,function(_0x54cc95){if(_0x54cc95[_0xdd2a('0x2b')]!==_0xdd2a('0x38')){var _0x2d2fe6={};_0x2d2fe6[_0x54cc95[_0xdd2a('0x26')]]={'$like':'%'+_0x37ba2a[_0xdd2a('0x2e')][_0xdd2a('0x39')]+'%'};return _0x2d2fe6;}})});}_0x175ee8=_['merge']({},_0x175ee8,_0x37ba2a[_0xdd2a('0x3a')]);var _0x2e4cb5={'where':_0x175ee8[_0xdd2a('0x36')]};return db[_0xdd2a('0x28')][_0xdd2a('0x1c')](_0x2e4cb5)[_0xdd2a('0x23')](function(_0x5d074b){_0xb10df3[_0xdd2a('0x1c')]=_0x5d074b;if(_0x37ba2a['query'][_0xdd2a('0x3b')]){_0x175ee8[_0xdd2a('0x3c')]=[{'all':!![]}];}return db[_0xdd2a('0x28')][_0xdd2a('0x3d')](_0x175ee8);})['then'](function(_0x252656){_0xb10df3['rows']=_0x252656;return _0xb10df3;})[_0xdd2a('0x23')](respondWithFilteredResult(_0x3934a5,_0x175ee8))[_0xdd2a('0x3e')](handleError(_0x3934a5,null));};exports['show']=function(_0x91186d,_0x48bafc){var _0x5031a6={'raw':!![],'where':{'id':_0x91186d[_0xdd2a('0x3f')]['id']}},_0xc5906a={};_0xc5906a['model']=_[_0xdd2a('0x40')](db['ChatTransferReport'][_0xdd2a('0x29')]);_0xc5906a[_0xdd2a('0x2e')]=_[_0xdd2a('0x40')](_0x91186d[_0xdd2a('0x2e')]);_0xc5906a[_0xdd2a('0x2f')]=_[_0xdd2a('0x30')](_0xc5906a[_0xdd2a('0x2d')],_0xc5906a[_0xdd2a('0x2e')]);_0x5031a6[_0xdd2a('0x31')]=_[_0xdd2a('0x30')](_0xc5906a[_0xdd2a('0x2d')],qs[_0xdd2a('0x32')](_0x91186d[_0xdd2a('0x2e')]['fields']));_0x5031a6['attributes']=_0x5031a6[_0xdd2a('0x31')][_0xdd2a('0x41')]?_0x5031a6['attributes']:_0xc5906a[_0xdd2a('0x2d')];if(_0x91186d[_0xdd2a('0x2e')][_0xdd2a('0x3b')]){_0x5031a6[_0xdd2a('0x3c')]=[{'all':!![]}];}_0x5031a6=_[_0xdd2a('0x42')]({},_0x5031a6,_0x91186d[_0xdd2a('0x3a')]);return db[_0xdd2a('0x28')][_0xdd2a('0x43')](_0x5031a6)[_0xdd2a('0x23')](handleEntityNotFound(_0x48bafc,null))[_0xdd2a('0x23')](respondWithResult(_0x48bafc,null))['catch'](handleError(_0x48bafc,null));};exports[_0xdd2a('0x44')]=function(_0x5c8ab2,_0x306ce5){return db[_0xdd2a('0x28')][_0xdd2a('0x44')](_0x5c8ab2[_0xdd2a('0x45')],{})[_0xdd2a('0x23')](respondWithResult(_0x306ce5,0xc9))['catch'](handleError(_0x306ce5,null));};exports[_0xdd2a('0x22')]=function(_0x7de236,_0x284373){if(_0x7de236[_0xdd2a('0x45')]['id']){delete _0x7de236[_0xdd2a('0x45')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x7de236[_0xdd2a('0x3f')]['id']}})[_0xdd2a('0x23')](handleEntityNotFound(_0x284373,null))[_0xdd2a('0x23')](saveUpdates(_0x7de236['body'],null))['then'](respondWithResult(_0x284373,null))[_0xdd2a('0x3e')](handleError(_0x284373,null));};exports['destroy']=function(_0x5bf9c7,_0x29a308){return db[_0xdd2a('0x28')][_0xdd2a('0x43')]({'where':{'id':_0x5bf9c7[_0xdd2a('0x3f')]['id']}})[_0xdd2a('0x23')](handleEntityNotFound(_0x29a308,null))[_0xdd2a('0x23')](removeEntity(_0x29a308,null))['catch'](handleError(_0x29a308,null));};exports[_0xdd2a('0x46')]=function(_0x259cf9,_0x275ab4){return db[_0xdd2a('0x28')][_0xdd2a('0x46')]()[_0xdd2a('0x23')](respondWithResult(_0x275ab4,null))['catch'](handleError(_0x275ab4,null));}; \ No newline at end of file +var _0x9baf=['body','find','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','ChatTransferReport','includeAll','findAll','rows','catch','show','params','keys','include','create'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9baf,0x1dd));var _0xf9ba=function(_0xf8cafb,_0x3bb857){_0xf8cafb=_0xf8cafb-0x0;var _0x11d273=_0x9baf[_0xf8cafb];return _0x11d273;};'use strict';var emlformat=require(_0xf9ba('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf9ba('0x1'));var rp=require('request-promise');var moment=require(_0xf9ba('0x2'));var BPromise=require(_0xf9ba('0x3'));var Mustache=require(_0xf9ba('0x4'));var util=require(_0xf9ba('0x5'));var path=require(_0xf9ba('0x6'));var sox=require(_0xf9ba('0x7'));var csv=require(_0xf9ba('0x8'));var ejs=require(_0xf9ba('0x9'));var fs=require('fs');var fs_extra=require(_0xf9ba('0xa'));var _=require(_0xf9ba('0xb'));var squel=require(_0xf9ba('0xc'));var crypto=require(_0xf9ba('0xd'));var jsforce=require(_0xf9ba('0xe'));var deskjs=require(_0xf9ba('0xf'));var toCsv=require(_0xf9ba('0x8'));var querystring=require(_0xf9ba('0x10'));var Papa=require(_0xf9ba('0x11'));var Redis=require(_0xf9ba('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf9ba('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf9ba('0x14'));var logger=require(_0xf9ba('0x15'))(_0xf9ba('0x16'));var utils=require(_0xf9ba('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf9ba('0x18'));var db=require(_0xf9ba('0x19'))['db'];function respondWithStatusCode(_0x5c14a9,_0x2213e3){_0x2213e3=_0x2213e3||0xcc;return function(_0x84f397){if(_0x84f397){return _0x5c14a9[_0xf9ba('0x1a')](_0x2213e3);}return _0x5c14a9['status'](_0x2213e3)['end']();};}function respondWithResult(_0x458474,_0x3beb82){_0x3beb82=_0x3beb82||0xc8;return function(_0x3ae1cf){if(_0x3ae1cf){return _0x458474[_0xf9ba('0x1b')](_0x3beb82)[_0xf9ba('0x1c')](_0x3ae1cf);}};}function respondWithFilteredResult(_0x47535a,_0x476a22){return function(_0x1ddb6d){if(_0x1ddb6d){var _0x5cfa1d=typeof _0x476a22['offset']==='undefined'&&typeof _0x476a22[_0xf9ba('0x1d')]===_0xf9ba('0x1e');var _0x898f0d=_0x1ddb6d[_0xf9ba('0x1f')];var _0xbbaa4c=_0x5cfa1d?0x0:_0x476a22[_0xf9ba('0x20')];var _0x461ce6=_0x5cfa1d?_0x1ddb6d[_0xf9ba('0x1f')]:_0x476a22['offset']+_0x476a22[_0xf9ba('0x1d')];var _0x9fa1e3;if(_0x461ce6>=_0x898f0d){_0x461ce6=_0x898f0d;_0x9fa1e3=0xc8;}else{_0x9fa1e3=0xce;}_0x47535a[_0xf9ba('0x1b')](_0x9fa1e3);return _0x47535a[_0xf9ba('0x21')]('Content-Range',_0xbbaa4c+'-'+_0x461ce6+'/'+_0x898f0d)[_0xf9ba('0x1c')](_0x1ddb6d);}return null;};}function patchUpdates(_0x1acb0e){return function(_0x45e2f0){try{jsonpatch[_0xf9ba('0x22')](_0x45e2f0,_0x1acb0e,!![]);}catch(_0x576318){return BPromise[_0xf9ba('0x23')](_0x576318);}return _0x45e2f0[_0xf9ba('0x24')]();};}function saveUpdates(_0x1d6d89,_0x18b495){return function(_0xe6ecf2){if(_0xe6ecf2){return _0xe6ecf2[_0xf9ba('0x25')](_0x1d6d89)[_0xf9ba('0x26')](function(_0x313f71){return _0x313f71;});}return null;};}function removeEntity(_0x1dbdb2,_0x288c72){return function(_0x194a0a){if(_0x194a0a){return _0x194a0a[_0xf9ba('0x27')]()[_0xf9ba('0x26')](function(){_0x1dbdb2[_0xf9ba('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45777f,_0xc6e83){return function(_0x4f56aa){if(!_0x4f56aa){_0x45777f[_0xf9ba('0x1a')](0x194);}return _0x4f56aa;};}function handleError(_0x4bd37d,_0x46a993){_0x46a993=_0x46a993||0x1f4;return function(_0x25eb5e){logger[_0xf9ba('0x28')](_0x25eb5e[_0xf9ba('0x29')]);if(_0x25eb5e[_0xf9ba('0x2a')]){delete _0x25eb5e[_0xf9ba('0x2a')];}_0x4bd37d['status'](_0x46a993)[_0xf9ba('0x2b')](_0x25eb5e);};}exports['index']=function(_0x1ff183,_0x19c57e){var _0x55829d={},_0x2494d9={},_0x21bb75={'count':0x0,'rows':[]};var _0x1ec9e1=_[_0xf9ba('0x2c')](db['ChatTransferReport'][_0xf9ba('0x2d')],function(_0x3aae87){return{'name':_0x3aae87[_0xf9ba('0x2e')],'type':_0x3aae87[_0xf9ba('0x2f')][_0xf9ba('0x30')]};});_0x2494d9[_0xf9ba('0x31')]=_[_0xf9ba('0x2c')](_0x1ec9e1,'name');_0x2494d9[_0xf9ba('0x32')]=_['keys'](_0x1ff183[_0xf9ba('0x32')]);_0x2494d9['filters']=_[_0xf9ba('0x33')](_0x2494d9[_0xf9ba('0x31')],_0x2494d9[_0xf9ba('0x32')]);_0x55829d[_0xf9ba('0x34')]=_[_0xf9ba('0x33')](_0x2494d9[_0xf9ba('0x31')],qs[_0xf9ba('0x35')](_0x1ff183[_0xf9ba('0x32')][_0xf9ba('0x35')]));_0x55829d[_0xf9ba('0x34')]=_0x55829d['attributes'][_0xf9ba('0x36')]?_0x55829d[_0xf9ba('0x34')]:_0x2494d9[_0xf9ba('0x31')];if(!_0x1ff183[_0xf9ba('0x32')][_0xf9ba('0x37')](_0xf9ba('0x38'))){_0x55829d['limit']=qs[_0xf9ba('0x1d')](_0x1ff183[_0xf9ba('0x32')]['limit']);_0x55829d[_0xf9ba('0x20')]=qs[_0xf9ba('0x20')](_0x1ff183['query'][_0xf9ba('0x20')]);}_0x55829d[_0xf9ba('0x39')]=qs[_0xf9ba('0x3a')](_0x1ff183[_0xf9ba('0x32')][_0xf9ba('0x3a')]);_0x55829d['where']=qs['filters'](_[_0xf9ba('0x3b')](_0x1ff183['query'],_0x2494d9[_0xf9ba('0x3c')]),_0x1ec9e1);if(_0x1ff183[_0xf9ba('0x32')][_0xf9ba('0x3d')]){_0x55829d[_0xf9ba('0x3e')]=_[_0xf9ba('0x3f')](_0x55829d[_0xf9ba('0x3e')],{'$or':_[_0xf9ba('0x2c')](_0x1ec9e1,function(_0x1aa33e){if(_0x1aa33e[_0xf9ba('0x2f')]!==_0xf9ba('0x40')){var _0x219067={};_0x219067[_0x1aa33e[_0xf9ba('0x2a')]]={'$like':'%'+_0x1ff183['query'][_0xf9ba('0x3d')]+'%'};return _0x219067;}})});}_0x55829d=_[_0xf9ba('0x3f')]({},_0x55829d,_0x1ff183[_0xf9ba('0x41')]);var _0x2d7b13={'where':_0x55829d[_0xf9ba('0x3e')]};return db[_0xf9ba('0x42')][_0xf9ba('0x1f')](_0x2d7b13)[_0xf9ba('0x26')](function(_0x20c711){_0x21bb75['count']=_0x20c711;if(_0x1ff183[_0xf9ba('0x32')][_0xf9ba('0x43')]){_0x55829d['include']=[{'all':!![]}];}return db[_0xf9ba('0x42')][_0xf9ba('0x44')](_0x55829d);})[_0xf9ba('0x26')](function(_0x47dd69){_0x21bb75[_0xf9ba('0x45')]=_0x47dd69;return _0x21bb75;})[_0xf9ba('0x26')](respondWithFilteredResult(_0x19c57e,_0x55829d))[_0xf9ba('0x46')](handleError(_0x19c57e,null));};exports[_0xf9ba('0x47')]=function(_0x242e06,_0x57e8c6){var _0x30c4d7={'raw':!![],'where':{'id':_0x242e06[_0xf9ba('0x48')]['id']}},_0x3fbf21={};_0x3fbf21[_0xf9ba('0x31')]=_[_0xf9ba('0x49')](db[_0xf9ba('0x42')][_0xf9ba('0x2d')]);_0x3fbf21[_0xf9ba('0x32')]=_[_0xf9ba('0x49')](_0x242e06[_0xf9ba('0x32')]);_0x3fbf21[_0xf9ba('0x3c')]=_[_0xf9ba('0x33')](_0x3fbf21[_0xf9ba('0x31')],_0x3fbf21['query']);_0x30c4d7[_0xf9ba('0x34')]=_[_0xf9ba('0x33')](_0x3fbf21['model'],qs[_0xf9ba('0x35')](_0x242e06['query'][_0xf9ba('0x35')]));_0x30c4d7[_0xf9ba('0x34')]=_0x30c4d7[_0xf9ba('0x34')][_0xf9ba('0x36')]?_0x30c4d7['attributes']:_0x3fbf21[_0xf9ba('0x31')];if(_0x242e06[_0xf9ba('0x32')][_0xf9ba('0x43')]){_0x30c4d7[_0xf9ba('0x4a')]=[{'all':!![]}];}_0x30c4d7=_['merge']({},_0x30c4d7,_0x242e06[_0xf9ba('0x41')]);return db[_0xf9ba('0x42')]['find'](_0x30c4d7)[_0xf9ba('0x26')](handleEntityNotFound(_0x57e8c6,null))[_0xf9ba('0x26')](respondWithResult(_0x57e8c6,null))[_0xf9ba('0x46')](handleError(_0x57e8c6,null));};exports['create']=function(_0x577151,_0x47547d){return db['ChatTransferReport'][_0xf9ba('0x4b')](_0x577151[_0xf9ba('0x4c')],{})['then'](respondWithResult(_0x47547d,0xc9))['catch'](handleError(_0x47547d,null));};exports['update']=function(_0x28fc45,_0x4ffc4b){if(_0x28fc45['body']['id']){delete _0x28fc45[_0xf9ba('0x4c')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x28fc45[_0xf9ba('0x48')]['id']}})[_0xf9ba('0x26')](handleEntityNotFound(_0x4ffc4b,null))[_0xf9ba('0x26')](saveUpdates(_0x28fc45[_0xf9ba('0x4c')],null))['then'](respondWithResult(_0x4ffc4b,null))[_0xf9ba('0x46')](handleError(_0x4ffc4b,null));};exports[_0xf9ba('0x27')]=function(_0x277ef0,_0xd9a2b6){return db['ChatTransferReport'][_0xf9ba('0x4d')]({'where':{'id':_0x277ef0['params']['id']}})[_0xf9ba('0x26')](handleEntityNotFound(_0xd9a2b6,null))[_0xf9ba('0x26')](removeEntity(_0xd9a2b6,null))[_0xf9ba('0x46')](handleError(_0xd9a2b6,null));};exports['describe']=function(_0x51b407,_0x17c061){return db[_0xf9ba('0x42')][_0xf9ba('0x4e')]()[_0xf9ba('0x26')](respondWithResult(_0x17c061,null))[_0xf9ba('0x46')](handleError(_0x17c061,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 6cf9479..3c92e6d 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 _0x7a77=['rimraf','../../config/environment','exports','define','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5b8642,_0x49d4d5){var _0x5c0d3b=function(_0x17e52c){while(--_0x17e52c){_0x5b8642['push'](_0x5b8642['shift']());}};_0x5c0d3b(++_0x49d4d5);}(_0x7a77,0x164));var _0x77a7=function(_0x37a899,_0x567b0c){_0x37a899=_0x37a899-0x0;var _0x9d4b3=_0x7a77[_0x37a899];return _0x9d4b3;};'use strict';var _=require(_0x77a7('0x0'));var util=require(_0x77a7('0x1'));var logger=require(_0x77a7('0x2'))(_0x77a7('0x3'));var moment=require(_0x77a7('0x4'));var BPromise=require(_0x77a7('0x5'));var rp=require(_0x77a7('0x6'));var fs=require('fs');var path=require(_0x77a7('0x7'));var rimraf=require(_0x77a7('0x8'));var config=require(_0x77a7('0x9'));var attributes=require('./chatTransferReport.attributes');module[_0x77a7('0xa')]=function(_0xef5b97,_0x433f8d){return _0xef5b97[_0x77a7('0xb')]('ChatTransferReport',attributes,{'tableName':_0x77a7('0xc'),'paranoid':![],'indexes':[{'name':_0x77a7('0xd'),'fields':[_0x77a7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa34=['path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x1213eb,_0x254d44){var _0x1cb4bb=function(_0x37c984){while(--_0x37c984){_0x1213eb['push'](_0x1213eb['shift']());}};_0x1cb4bb(++_0x254d44);}(_0xfa34,0xbe));var _0x4fa3=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xfa34[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require(_0x4fa3('0x0'));var util=require(_0x4fa3('0x1'));var logger=require(_0x4fa3('0x2'))(_0x4fa3('0x3'));var moment=require(_0x4fa3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4fa3('0x5'));var rimraf=require(_0x4fa3('0x6'));var config=require(_0x4fa3('0x7'));var attributes=require(_0x4fa3('0x8'));module['exports']=function(_0x3f3c08,_0x91010e){return _0x3f3c08[_0x4fa3('0x9')](_0x4fa3('0xa'),attributes,{'tableName':_0x4fa3('0xb'),'paranoid':![],'indexes':[{'name':_0x4fa3('0xc'),'fields':[_0x4fa3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index e24786b..b599ded 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 _0x9ab8=['http','request','then','info','ChatTransferReport,\x20%s,\x20%s','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1805ce,_0x565a64){var _0x344d75=function(_0x1ec743){while(--_0x1ec743){_0x1805ce['push'](_0x1805ce['shift']());}};_0x344d75(++_0x565a64);}(_0x9ab8,0xd1));var _0x89ab=function(_0x296cb0,_0x3f5ae1){_0x296cb0=_0x296cb0-0x0;var _0x31bb6a=_0x9ab8[_0x296cb0];return _0x31bb6a;};'use strict';var _=require(_0x89ab('0x0'));var util=require(_0x89ab('0x1'));var moment=require(_0x89ab('0x2'));var BPromise=require(_0x89ab('0x3'));var rs=require(_0x89ab('0x4'));var fs=require('fs');var Redis=require(_0x89ab('0x5'));var db=require(_0x89ab('0x6'))['db'];var utils=require(_0x89ab('0x7'));var logger=require(_0x89ab('0x8'))('rpc');var config=require(_0x89ab('0x9'));var jayson=require(_0x89ab('0xa'));var client=jayson['client'][_0x89ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2666e4,_0x5726bc,_0x3f295f){return new BPromise(function(_0x4a26de,_0x1d48fe){return client[_0x89ab('0xc')](_0x2666e4,_0x3f295f)[_0x89ab('0xd')](function(_0x5789cf){logger[_0x89ab('0xe')](_0x89ab('0xf'),_0x5726bc,'request\x20sent');logger[_0x89ab('0x10')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x5726bc,'request\x20sent',JSON[_0x89ab('0x11')](_0x5789cf));if(_0x5789cf[_0x89ab('0x12')]){if(_0x5789cf[_0x89ab('0x12')]['code']===0x1f4){logger[_0x89ab('0x12')](_0x89ab('0xf'),_0x5726bc,_0x5789cf[_0x89ab('0x12')][_0x89ab('0x13')]);return _0x1d48fe(_0x5789cf['error'][_0x89ab('0x13')]);}logger['error'](_0x89ab('0xf'),_0x5726bc,_0x5789cf['error'][_0x89ab('0x13')]);return _0x4a26de(_0x5789cf[_0x89ab('0x12')]['message']);}else{logger[_0x89ab('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x5726bc,'request\x20sent');_0x4a26de(_0x5789cf[_0x89ab('0x14')]['message']);}})[_0x89ab('0x15')](function(_0x162fb0){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x5726bc,_0x162fb0);_0x1d48fe(_0x162fb0);});});} \ No newline at end of file +var _0xb1fb=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','randomstring'];(function(_0x3bea28,_0x42a177){var _0xfcc523=function(_0x20bea0){while(--_0x20bea0){_0x3bea28['push'](_0x3bea28['shift']());}};_0xfcc523(++_0x42a177);}(_0xb1fb,0xec));var _0xbb1f=function(_0x4d18c8,_0x43a0d1){_0x4d18c8=_0x4d18c8-0x0;var _0x4314c9=_0xb1fb[_0x4d18c8];return _0x4314c9;};'use strict';var _=require('lodash');var util=require(_0xbb1f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbb1f('0x1'));var fs=require('fs');var Redis=require(_0xbb1f('0x2'));var db=require(_0xbb1f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb1f('0x4'))('rpc');var config=require(_0xbb1f('0x5'));var jayson=require(_0xbb1f('0x6'));var client=jayson[_0xbb1f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33cad5,_0x4022,_0x2cb5e8){return new BPromise(function(_0x190189,_0x4ffd16){return client['request'](_0x33cad5,_0x2cb5e8)[_0xbb1f('0x8')](function(_0x169479){logger['info'](_0xbb1f('0x9'),_0x4022,_0xbb1f('0xa'));logger['debug'](_0xbb1f('0xb'),_0x4022,_0xbb1f('0xa'),JSON[_0xbb1f('0xc')](_0x169479));if(_0x169479[_0xbb1f('0xd')]){if(_0x169479[_0xbb1f('0xd')][_0xbb1f('0xe')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x4022,_0x169479[_0xbb1f('0xd')][_0xbb1f('0xf')]);return _0x4ffd16(_0x169479[_0xbb1f('0xd')][_0xbb1f('0xf')]);}logger[_0xbb1f('0xd')](_0xbb1f('0x9'),_0x4022,_0x169479[_0xbb1f('0xd')][_0xbb1f('0xf')]);return _0x190189(_0x169479[_0xbb1f('0xd')][_0xbb1f('0xf')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x4022,_0xbb1f('0xa'));_0x190189(_0x169479['result'][_0xbb1f('0xf')]);}})[_0xbb1f('0x10')](function(_0x1caa45){logger[_0xbb1f('0xd')](_0xbb1f('0x9'),_0x4022,_0x1caa45);_0x4ffd16(_0x1caa45);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 521dbde..1c4c127 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 _0x66cd=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0x66cd,0xca));var _0xd66c=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x66cd[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0xd66c('0x0'));var util=require(_0xd66c('0x1'));var path=require('path');var timeout=require(_0xd66c('0x2'));var express=require(_0xd66c('0x3'));var router=express[_0xd66c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd66c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd66c('0x6'));var controller=require('./chatTransferReport.controller');router[_0xd66c('0x7')]('/',auth[_0xd66c('0x8')](),controller[_0xd66c('0x9')]);router[_0xd66c('0x7')](_0xd66c('0xa'),auth[_0xd66c('0x8')](),controller[_0xd66c('0xb')]);router[_0xd66c('0x7')](_0xd66c('0xc'),auth['isAuthenticated'](),controller[_0xd66c('0xd')]);router[_0xd66c('0xe')]('/',auth[_0xd66c('0x8')](),controller[_0xd66c('0xf')]);router[_0xd66c('0x10')]('/:id',auth[_0xd66c('0x8')](),controller[_0xd66c('0x11')]);router[_0xd66c('0x12')](_0xd66c('0xc'),auth[_0xd66c('0x8')](),controller[_0xd66c('0x13')]);module[_0xd66c('0x14')]=router; \ No newline at end of file +var _0x9d64=['./chatTransferReport.controller','isAuthenticated','get','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d64,0x122));var _0x49d6=function(_0x4a3d63,_0x5cbed5){_0x4a3d63=_0x4a3d63-0x0;var _0x8cbc66=_0x9d64[_0x4a3d63];return _0x8cbc66;};'use strict';var multer=require(_0x49d6('0x0'));var util=require(_0x49d6('0x1'));var path=require(_0x49d6('0x2'));var timeout=require(_0x49d6('0x3'));var express=require(_0x49d6('0x4'));var router=express[_0x49d6('0x5')]();var fs_extra=require(_0x49d6('0x6'));var auth=require(_0x49d6('0x7'));var interaction=require(_0x49d6('0x8'));var config=require(_0x49d6('0x9'));var controller=require(_0x49d6('0xa'));router['get']('/',auth[_0x49d6('0xb')](),controller['index']);router[_0x49d6('0xc')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x49d6('0xc')](_0x49d6('0xd'),auth['isAuthenticated'](),controller[_0x49d6('0xe')]);router[_0x49d6('0xf')]('/',auth['isAuthenticated'](),controller[_0x49d6('0x10')]);router['put'](_0x49d6('0xd'),auth[_0x49d6('0xb')](),controller['update']);router[_0x49d6('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x49d6('0x12')]);module[_0x49d6('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 969d937..b34e31c 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 _0x470b=['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','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','ENUM','star','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','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','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x470b,0x1da));var _0xb470=function(_0x2d071c,_0x2a0600){_0x2d071c=_0x2d071c-0x0;var _0x3d71f9=_0x470b[_0x2d071c];return _0x3d71f9;};'use strict';var Sequelize=require(_0xb470('0x0'));var rs=require(_0xb470('0x1'));module[_0xb470('0x2')]={'name':{'type':Sequelize[_0xb470('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xb470('0x3')],'allowNull':![],'unique':_0xb470('0x4')},'description':{'type':Sequelize[_0xb470('0x3')]},'mapKey':{'type':Sequelize[_0xb470('0x3')],'defaultValue':_0xb470('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xb470('0x5')},'key':{'type':Sequelize[_0xb470('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xb470('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xb470('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xb470('0x3')],'allowNull':![],'defaultValue':_0xb470('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xb470('0x3')],'allowNull':![],'defaultValue':_0xb470('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xb470('0x3')],'allowNull':![],'defaultValue':_0xb470('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb470('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xb470('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xb470('0x3')]},'animation':{'type':Sequelize[_0xb470('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xb470('0xa'),_0xb470('0xb')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xb470('0x3')],'defaultValue':_0xb470('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xb470('0xd')},'offline_chat_button':{'type':Sequelize[_0xb470('0x3')],'defaultValue':_0xb470('0xe')},'header_offline':{'type':Sequelize[_0xb470('0x3')],'defaultValue':_0xb470('0xf')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xb470('0x3')],'defaultValue':_0xb470('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0xb470('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xb470('0x11')]},'closingQuestion':{'type':Sequelize[_0xb470('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xb470('0x3')],'defaultValue':_0xb470('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0xb470('0x3')],'defaultValue':_0xb470('0x13')},'noteTitle':{'type':Sequelize[_0xb470('0x3')],'defaultValue':_0xb470('0x14')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb470('0x15')},'closingMessage':{'type':Sequelize[_0xb470('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xb470('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xb470('0x3')],'defaultValue':_0xb470('0x16')},'conditionAgreement':{'type':Sequelize[_0xb470('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xb470('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xb470('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xb470('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xb470('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xb470('0x17')](_0xb470('0x18'),'thumb'),'defaultValue':_0xb470('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xb470('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xb470('0x11')],'defaultValue':function(){return JSON[_0xb470('0x19')]({'items':[{'type':_0xb470('0x1a'),'variable':null,'config':{'placeholder':_0xb470('0x1b'),'type':'text','required':!![]},'props':{'title':_0xb470('0x1b'),'helpText':''}},{'type':'input','props':{'title':_0xb470('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xb470('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xb470('0x1c')](_0xb470('0x1d'))?JSON[_0xb470('0x1e')](this[_0xb470('0x1c')](_0xb470('0x1d'))):{};},'set':function(_0x1ca15c){return this[_0xb470('0x1f')]('onlineForm',JSON['stringify'](_0x1ca15c));}},'offlineForm':{'type':Sequelize[_0xb470('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xb470('0x1a'),'props':{'title':_0xb470('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xb470('0x5'),'type':_0xb470('0x5')},'variable':null},{'type':_0xb470('0x20'),'config':{'placeholder':_0xb470('0x21')},'props':{'title':_0xb470('0x21'),'helpText':_0xb470('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0xb470('0x1c')]('offlineForm')?JSON[_0xb470('0x1e')](this[_0xb470('0x1c')]('offlineForm')):{};},'set':function(_0x182025){return this['setDataValue']('offlineForm',JSON[_0xb470('0x19')](_0x182025));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xb470('0x23')]();}},'autoclose':{'type':Sequelize[_0xb470('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xb470('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xb470('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xb470('0x3')]},'forwardOffline':{'type':Sequelize[_0xb470('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xb470('0x3')],'defaultValue':_0xb470('0x24')},'waitingMessage':{'type':Sequelize[_0xb470('0x3')],'defaultValue':_0xb470('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xb470('0x3')],'defaultValue':_0xb470('0x26')},'offlineMessageBody':{'type':Sequelize[_0xb470('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xb470('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xb470('0x3')],'defaultValue':_0xb470('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xb470('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0xb470('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xb470('0x11')]},'showAgentAvatar':{'type':Sequelize[_0xb470('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xb470('0x11')],'defaultValue':function(){return _0xb470('0x28');}},'notificationSound':{'type':Sequelize[_0xb470('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb470('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xb470('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xb470('0x3')],'defaultValue':_0xb470('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xb470('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb470('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xb470('0x3')],'defaultValue':_0xb470('0x2a')},'verticalAlignment':{'type':Sequelize[_0xb470('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xb470('0x3')],'defaultValue':_0xb470('0x2b')},'messagesAlignment':{'type':Sequelize[_0xb470('0x3')],'defaultValue':_0xb470('0x2c')},'defaultTitle':{'type':Sequelize[_0xb470('0x3')]},'customerAvatar':{'type':Sequelize[_0xb470('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0xb470('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xb470('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xb470('0x3')],'allowNull':![],'defaultValue':_0xb470('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xb470('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb470('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb470('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb470('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xb470('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xb470('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0xb470('0x9')],'defaultValue':![],'comment':_0xb470('0x2f'),'set':function(_0x26be94){if(!_0x26be94)this['setDataValue'](_0xb470('0x30'),null);this[_0xb470('0x1f')](_0xb470('0x31'),_0x26be94);}},'vidaooEscalation':{'type':Sequelize[_0xb470('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xb470('0x3')]},'vidaooTopic':{'type':Sequelize[_0xb470('0x3')],'allowNull':![],'defaultValue':_0xb470('0x32')},'vidaooNote':{'type':Sequelize[_0xb470('0x3')],'defaultValue':function(){return _0xb470('0x33');}},'vidaooMetadata':{'type':Sequelize[_0xb470('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xb470('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xb470('0x11')]}}; \ No newline at end of file +var _0x8032=['Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','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}}','randomstring','exports','STRING','address','Agent','#011F6A','#ffffff','INTEGER','squared','rounded','We\x20are\x20here!','Chat','Send','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','star','thumb','input','name','text','email','parse','getDataValue','setDataValue','onlineForm','stringify','textarea'];(function(_0x516387,_0x133120){var _0x181646=function(_0x2e4297){while(--_0x2e4297){_0x516387['push'](_0x516387['shift']());}};_0x181646(++_0x133120);}(_0x8032,0x163));var _0x2803=function(_0x26dd96,_0x1e70a6){_0x26dd96=_0x26dd96-0x0;var _0x1aa18f=_0x8032[_0x26dd96];return _0x1aa18f;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x2803('0x0'));module[_0x2803('0x1')]={'name':{'type':Sequelize[_0x2803('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x2803('0x2')],'allowNull':![],'unique':_0x2803('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x2803('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize[_0x2803('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x4')},'customerAlias':{'type':Sequelize[_0x2803('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2803('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x2803('0x2')],'allowNull':![],'defaultValue':_0x2803('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x2803('0x2')],'allowNull':![],'defaultValue':_0x2803('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x2803('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x2803('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0x2803('0x8')),'defaultValue':_0x2803('0x9')},'header_online':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0xa')},'start_chat_button':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0xb')},'offline_chat_button':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0xc')},'header_offline':{'type':Sequelize[_0x2803('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x2803('0xd')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x2803('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x2803('0xf')]},'closingQuestion':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x12')},'noteTitle':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x13')},'placeholderMessage':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x14')},'closingMessage':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x15')},'closingMessageButton':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0xc')},'skipMessageButton':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x16')},'conditionAgreement':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x17')},'ratingType':{'type':Sequelize[_0x2803('0x18')](_0x2803('0x19'),_0x2803('0x1a')),'defaultValue':_0x2803('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x2803('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x2803('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x2803('0x1b'),'variable':null,'config':{'placeholder':_0x2803('0x1c'),'type':_0x2803('0x1d'),'required':!![]},'props':{'title':_0x2803('0x1c'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x2803('0x1e')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0x2803('0x1f')](this[_0x2803('0x20')]('onlineForm')):{};},'set':function(_0x507363){return this[_0x2803('0x21')](_0x2803('0x22'),JSON[_0x2803('0x23')](_0x507363));}},'offlineForm':{'type':Sequelize[_0x2803('0xf')],'defaultValue':function(){return JSON[_0x2803('0x23')]({'items':[{'type':'input','props':{'title':_0x2803('0x1e'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x2803('0x1e')},'variable':null},{'type':_0x2803('0x24'),'config':{'placeholder':_0x2803('0x25')},'props':{'title':_0x2803('0x25'),'helpText':_0x2803('0x26')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x2803('0x27'))?JSON[_0x2803('0x1f')](this[_0x2803('0x20')](_0x2803('0x27'))):{};},'set':function(_0x563db1){return this[_0x2803('0x21')](_0x2803('0x27'),JSON[_0x2803('0x23')](_0x563db1));}},'token':{'type':Sequelize[_0x2803('0x2')],'defaultValue':function(){return rs[_0x2803('0x28')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x2803('0x2')]},'forwardOffline':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x2803('0x2')]},'waitingTitle':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x29')},'waitingMessage':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x2a')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x2803('0x2b')},'offlineMessageBody':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x2c')},'enableUnmanagedNote':{'type':Sequelize[_0x2803('0xd')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x2803('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x2803('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x2803('0xf')],'defaultValue':function(){return _0x2803('0x2d');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x2803('0x2e')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2803('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x2803('0x2f')},'verticalAlignment':{'type':Sequelize[_0x2803('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x2803('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x2803('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x2803('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x2803('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2803('0x30'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2803('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2803('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x2803('0x2')],'defaultValue':_0x2803('0x31')},'systemAvatar':{'type':Sequelize[_0x2803('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2803('0x7')],'comment':_0x2803('0x32')},'mandatoryDisposition':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![],'comment':_0x2803('0x33'),'set':function(_0x239011){if(!_0x239011)this[_0x2803('0x21')](_0x2803('0x34'),null);this[_0x2803('0x21')](_0x2803('0x35'),_0x239011);}},'vidaooEscalation':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x2803('0x2')]},'vidaooTopic':{'type':Sequelize[_0x2803('0x2')],'allowNull':![],'defaultValue':_0x2803('0x36')},'vidaooNote':{'type':Sequelize[_0x2803('0x2')],'defaultValue':function(){return _0x2803('0x37');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x2803('0xd')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x2803('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 9efb1e6..ce07d77 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 _0x0e85=['externalUrl','ChatInteraction','ContactId','interaction','contact','firstName','messageId','created','push','close','ChatMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','queueId','ChatQueue','Start','startRouting','EventManager','notify','files','ValidationError','no\x20available\x20attributes','difference','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','ChatOfflineMessage','fromString','server','attachments','offline-chat','basename','sequelize','transaction','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','openNewInteraction','originalname','mimetype','subjectOffline','Chat','MailAccountId','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','findOne','Contact','User','Owner','fullname','Tags','color','tag','getSnippet','getProactiveActions','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','origin','http://localhost:9000','testWebsiteWithWildcard','remote','connection','remoteAddress','virtual','replace','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','Transaction','READ_COMMITTED','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachment','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','ejs','fs-extra','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','APIBadRequestError','../../errors/api','APINotFoundError','APIOutOfIntervalError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','defaults','socket.io-emitter','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','update','then','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','model','device','vendor','type','index','Pause','ChatWebsite','rawAttributes','fieldName','key','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','rows','show','params','include','create','address','forEach','testWildcardValidity','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','trim','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','mandatoryDispositionPause','describe','ChatWebsiteId','getDispositions','order','includeAll','Disposition','removeDispositions','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','ids','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','getLogo','join','root','../../config/license/util','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','server/files/images/avatars/system_avatar.png','systemAvatar','timezone','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','from','DESC','ChatApplication','Applications','Interval','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','applications','priority','account','list','List','Contacts','headers','threadId','closed','Writing\x20on\x20closed\x20interaction'];(function(_0x2d861c,_0x47be4d){var _0x47c2c4=function(_0x310185){while(--_0x310185){_0x2d861c['push'](_0x2d861c['shift']());}};_0x47c2c4(++_0x47be4d);}(_0x0e85,0x7c));var _0x50e8=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x0e85[_0x4dc7b9];return _0x3ab114;};'use strict';var Mustache=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var path=require('path');var ejs=require(_0x50e8('0x2'));var fs=require('fs');var fs_extra=require(_0x50e8('0x3'));var _=require('lodash');var querystring=require('querystring');var htmlToText=require('html-to-text');var Redis=require(_0x50e8('0x4'));var jayson=require('jayson/promise');var qs=require(_0x50e8('0x5'));var logger=require(_0x50e8('0x6'))(_0x50e8('0x7'));var config=require(_0x50e8('0x8'));var APIBadRequestError=require('../../errors/api')[_0x50e8('0x9')];var APINotFoundError=require(_0x50e8('0xa'))[_0x50e8('0xb')];var APIOutOfIntervalError=require(_0x50e8('0xa'))[_0x50e8('0xc')];var APIHandleError=require(_0x50e8('0xa'))['handleError'];var APIConflictError=require(_0x50e8('0xa'))[_0x50e8('0xd')];var wildcardUtils=require(_0x50e8('0xe'));var URL=require(_0x50e8('0xf'))[_0x50e8('0x10')];var db=require(_0x50e8('0x11'))['db'];config[_0x50e8('0x12')]=_[_0x50e8('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x50e8('0x14'))(new Redis(config[_0x50e8('0x12')]));require('./chatWebsite.socket')['register'](socket);var client=jayson[_0x50e8('0x15')][_0x50e8('0x16')]({'port':0x232c});var client9002=jayson[_0x50e8('0x15')][_0x50e8('0x16')]({'port':0x232a});var client9003=jayson['client'][_0x50e8('0x16')]({'port':0x232b});var client9001=jayson[_0x50e8('0x15')][_0x50e8('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x5c3baa,_0x5524a3,_0x30a872,_0xf02b48){return new Promise(function(_0x40c184,_0x291fb7){var _0x211731=_0xf02b48||client;return _0x211731[_0x50e8('0x17')](_0x5c3baa,_0x30a872)['then'](function(_0x5a5ef2){logger[_0x50e8('0x18')](_0x50e8('0x19'),_0x5524a3,_0x50e8('0x1a'));logger[_0x50e8('0x1b')](_0x50e8('0x1c'),_0x5524a3,_0x50e8('0x1a'),JSON[_0x50e8('0x1d')](_0x5a5ef2));if(_0x5a5ef2['error']){if(_0x5a5ef2[_0x50e8('0x1e')]['code']===0x1f4){logger[_0x50e8('0x1e')](_0x50e8('0x19'),_0x5524a3,_0x5a5ef2[_0x50e8('0x1e')][_0x50e8('0x1f')]);return _0x291fb7(_0x5a5ef2[_0x50e8('0x1e')]['message']);}logger[_0x50e8('0x1e')](_0x50e8('0x19'),_0x5524a3,_0x5a5ef2['error'][_0x50e8('0x1f')]);return _0x40c184(_0x5a5ef2[_0x50e8('0x1e')]['message']);}else{logger[_0x50e8('0x18')](_0x50e8('0x19'),_0x5524a3,'request\x20sent');_0x40c184(_0x5a5ef2['result']['message']);}})[_0x50e8('0x20')](function(_0x160372){logger[_0x50e8('0x1e')](_0x50e8('0x19'),_0x5524a3,_0x160372);_0x291fb7(_0x160372);});});}function respondWithStatusCode(_0xc2f832,_0x13b6e9){_0x13b6e9=_0x13b6e9||0xcc;return function(_0x53d848){if(_0x53d848){return _0xc2f832[_0x50e8('0x21')](_0x13b6e9);}return _0xc2f832[_0x50e8('0x22')](_0x13b6e9)['end']();};}function respondWithResult(_0x177201,_0x2bc8d8){_0x2bc8d8=_0x2bc8d8||0xc8;return function(_0x3a14ca){if(_0x3a14ca){return _0x177201[_0x50e8('0x22')](_0x2bc8d8)['json'](_0x3a14ca);}};}function respondWithFilteredResult(_0x1f5a6c,_0x5b0723){return function(_0x30fedf){if(_0x30fedf){var _0x39c0c6=typeof _0x5b0723[_0x50e8('0x23')]==='undefined'&&typeof _0x5b0723[_0x50e8('0x24')]===_0x50e8('0x25');var _0x1bed48=_0x30fedf[_0x50e8('0x26')];var _0x1d77d0=_0x39c0c6?0x0:_0x5b0723[_0x50e8('0x23')];var _0x2c6fb3=_0x39c0c6?_0x30fedf['count']:_0x5b0723[_0x50e8('0x23')]+_0x5b0723[_0x50e8('0x24')];var _0x535c24;if(_0x2c6fb3>=_0x1bed48){_0x2c6fb3=_0x1bed48;_0x535c24=0xc8;}else{_0x535c24=0xce;}_0x1f5a6c['status'](_0x535c24);return _0x1f5a6c[_0x50e8('0x27')](_0x50e8('0x28'),_0x1d77d0+'-'+_0x2c6fb3+'/'+_0x1bed48)[_0x50e8('0x29')](_0x30fedf);}return null;};}function saveUpdates(_0x47ace2){return function(_0x594187){if(_0x594187){return _0x594187[_0x50e8('0x2a')](_0x47ace2)[_0x50e8('0x2b')](function(_0x5c2e04){return _0x5c2e04;});}return null;};}function removeEntity(_0x26b974){return function(_0x17c6a5){if(_0x17c6a5){return _0x17c6a5[_0x50e8('0x2c')]()[_0x50e8('0x2b')](function(){var _0x5d279c=_0x17c6a5[_0x50e8('0x2d')]({'plain':!![]});var _0x4ec6ad=_0x50e8('0x2e');return db[_0x50e8('0x2f')][_0x50e8('0x2c')]({'where':{'type':_0x4ec6ad,'resourceId':_0x5d279c['id']}})['then'](function(){return _0x17c6a5;});})[_0x50e8('0x2b')](function(){_0x26b974[_0x50e8('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x245b45){return function(_0x1c2fdb){if(!_0x1c2fdb){_0x245b45[_0x50e8('0x21')](0x194);}return _0x1c2fdb;};}function handleError(_0x1a7ba4,_0x5b827f){_0x5b827f=_0x5b827f||0x1f4;return function(_0x1c513c){logger[_0x50e8('0x1e')](_0x1c513c[_0x50e8('0x30')]);if(_0x1c513c[_0x50e8('0x31')]){delete _0x1c513c['name'];}_0x1a7ba4[_0x50e8('0x22')](_0x5b827f)[_0x50e8('0x32')](_0x1c513c);};}function createInteractionObject(_0x3f01ee,_0x4d3454,_0x58ec1c,_0x5dff99){var _0xd39553=require(_0x50e8('0x33'));var _0x2cbee3=new _0xd39553();var _0x2d17b0=_0x2cbee3[_0x50e8('0x34')](_0x58ec1c[_0x50e8('0x35')])[_0x50e8('0x36')]();var _0x40b57c=_0x4d3454[_0x50e8('0x37')];if(_0x58ec1c[_0x50e8('0x38')]){_0x40b57c=_0x58ec1c['cf-connecting-ip'];}else if(_0x58ec1c[_0x50e8('0x39')]){_0x40b57c=_[_0x50e8('0x3a')](_0x58ec1c[_0x50e8('0x39')][_0x50e8('0x3b')](','));}return{'ContactId':_0x5dff99['id'],'ChatWebsiteId':_0x3f01ee,'from':(_0x5dff99['firstName']||'')+'\x20'+(_0x5dff99[_0x50e8('0x3c')]||''),'customerIp':_0x40b57c,'customerPort':_0x58ec1c[_0x50e8('0x3d')]?_0x58ec1c[_0x50e8('0x3d')]:null,'referer':_0x4d3454[_0x50e8('0x3e')],'browserName':_0x2d17b0[_0x50e8('0x3f')]['name']&&_0x2d17b0['browser'][_0x50e8('0x40')]?util[_0x50e8('0x41')]('%s\x20%s',_0x2d17b0[_0x50e8('0x3f')][_0x50e8('0x31')],_0x2d17b0[_0x50e8('0x3f')][_0x50e8('0x40')]):_0x50e8('0x42'),'browserVersion':_0x2d17b0[_0x50e8('0x3f')][_0x50e8('0x40')]||_0x50e8('0x42'),'osName':util['format'](_0x50e8('0x43'),_0x2d17b0['os'][_0x50e8('0x31')],_0x2d17b0['os'][_0x50e8('0x40')]),'osVersion':_0x2d17b0['os'][_0x50e8('0x40')],'deviceModel':_0x2d17b0['device'][_0x50e8('0x44')]&&_0x2d17b0[_0x50e8('0x45')][_0x50e8('0x46')]?util[_0x50e8('0x41')]('%s\x20%s\x20%s',_0x2d17b0[_0x50e8('0x45')]['model'],_0x2d17b0['device']['vendor'],_0x2d17b0[_0x50e8('0x45')][_0x50e8('0x47')]):null,'deviceVendor':_0x2d17b0['device'][_0x50e8('0x46')],'deviceType':_0x2d17b0[_0x50e8('0x45')][_0x50e8('0x47')],'formData':JSON[_0x50e8('0x1d')](_0x4d3454)};}exports[_0x50e8('0x48')]=function(_0x22527f,_0x51d239){var _0x16fdf6={'include':[{'model':db[_0x50e8('0x49')],'as':'mandatoryDispositionPause'}]},_0x596f62={},_0x1cc4fe={'count':0x0,'rows':[]};var _0xcac7c2=_['map'](db[_0x50e8('0x4a')][_0x50e8('0x4b')],function(_0x2e55ed){return{'name':_0x2e55ed[_0x50e8('0x4c')],'type':_0x2e55ed[_0x50e8('0x47')][_0x50e8('0x4d')]};});_0x596f62[_0x50e8('0x44')]=_[_0x50e8('0x4e')](_0xcac7c2,_0x50e8('0x31'));_0x596f62[_0x50e8('0x4f')]=_[_0x50e8('0x50')](_0x22527f['query']);_0x596f62[_0x50e8('0x51')]=_[_0x50e8('0x52')](_0x596f62['model'],_0x596f62[_0x50e8('0x4f')]);_0x16fdf6['attributes']=_[_0x50e8('0x52')](_0x596f62['model'],qs[_0x50e8('0x53')](_0x22527f[_0x50e8('0x4f')][_0x50e8('0x53')]));_0x16fdf6[_0x50e8('0x54')]=_0x16fdf6[_0x50e8('0x54')][_0x50e8('0x55')]?_0x16fdf6[_0x50e8('0x54')]:_0x596f62['model'];if(!_0x22527f[_0x50e8('0x4f')][_0x50e8('0x56')](_0x50e8('0x57'))){_0x16fdf6[_0x50e8('0x24')]=qs[_0x50e8('0x24')](_0x22527f[_0x50e8('0x4f')]['limit']);_0x16fdf6[_0x50e8('0x23')]=qs[_0x50e8('0x23')](_0x22527f[_0x50e8('0x4f')][_0x50e8('0x23')]);}_0x16fdf6['order']=qs[_0x50e8('0x58')](_0x22527f[_0x50e8('0x4f')][_0x50e8('0x58')]);_0x16fdf6[_0x50e8('0x59')]=qs[_0x50e8('0x51')](_[_0x50e8('0x5a')](_0x22527f[_0x50e8('0x4f')],_0x596f62['filters']),_0xcac7c2);if(_0x22527f['query']['filter']){_0x16fdf6[_0x50e8('0x59')]=_[_0x50e8('0x5b')](_0x16fdf6[_0x50e8('0x59')],{'$or':_[_0x50e8('0x4e')](_0xcac7c2,function(_0xa33e6e){if(_0xa33e6e[_0x50e8('0x47')]!=='VIRTUAL'){var _0x2f2154={};_0x2f2154[_0xa33e6e[_0x50e8('0x31')]]={'$like':'%'+_0x22527f[_0x50e8('0x4f')][_0x50e8('0x5c')]+'%'};return _0x2f2154;}})});}_0x16fdf6=_['merge']({},_0x16fdf6,_0x22527f[_0x50e8('0x5d')]);var _0xf773fd={'where':_0x16fdf6[_0x50e8('0x59')]};return db[_0x50e8('0x4a')][_0x50e8('0x26')](_0xf773fd)[_0x50e8('0x2b')](function(_0x57a73a){_0x1cc4fe[_0x50e8('0x26')]=_0x57a73a;if(_0x22527f['query']['includeAll']){_0x16fdf6['include']=[{'all':!![]}];}return db[_0x50e8('0x4a')]['findAll'](_0x16fdf6);})[_0x50e8('0x2b')](function(_0x2d4759){_0x1cc4fe[_0x50e8('0x5e')]=_0x2d4759;return _0x1cc4fe;})[_0x50e8('0x2b')](respondWithFilteredResult(_0x51d239,_0x16fdf6))[_0x50e8('0x20')](handleError(_0x51d239,null));};exports[_0x50e8('0x5f')]=function(_0x229445,_0x59cdf2){var _0x26ab46={'raw':![],'where':{'id':_0x229445[_0x50e8('0x60')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x42f1ed={};_0x42f1ed['model']=_[_0x50e8('0x50')](db[_0x50e8('0x4a')][_0x50e8('0x4b')]);_0x42f1ed[_0x50e8('0x4f')]=_[_0x50e8('0x50')](_0x229445[_0x50e8('0x4f')]);_0x42f1ed['filters']=_[_0x50e8('0x52')](_0x42f1ed['model'],_0x42f1ed[_0x50e8('0x4f')]);_0x26ab46[_0x50e8('0x54')]=_['intersection'](_0x42f1ed['model'],qs['fields'](_0x229445[_0x50e8('0x4f')][_0x50e8('0x53')]));_0x26ab46['attributes']=_0x26ab46[_0x50e8('0x54')][_0x50e8('0x55')]?_0x26ab46[_0x50e8('0x54')]:_0x42f1ed[_0x50e8('0x44')];if(_0x229445[_0x50e8('0x4f')]['includeAll']){_0x26ab46[_0x50e8('0x61')]=[{'all':!![]}];}_0x26ab46=_[_0x50e8('0x5b')]({},_0x26ab46,_0x229445[_0x50e8('0x5d')]);return db['ChatWebsite']['find'](_0x26ab46)[_0x50e8('0x2b')](handleEntityNotFound(_0x59cdf2,null))[_0x50e8('0x2b')](respondWithResult(_0x59cdf2,null))[_0x50e8('0x20')](handleError(_0x59cdf2,null));};exports[_0x50e8('0x62')]=function(_0x2b59f5,_0x257f9e){var _0x58714c=null;_0x2b59f5['body'][_0x50e8('0x63')]['split'](',')[_0x50e8('0x64')](_0x36a288=>{if(_0x36a288['trim']()!==''&&!wildcardUtils[_0x50e8('0x65')](_0x36a288['trim']())){_0x58714c=new APIBadRequestError('\x22'+_0x36a288['trim']()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x58714c){return handleError(_0x257f9e,null)(_0x58714c);}return db[_0x50e8('0x4a')][_0x50e8('0x62')](_0x2b59f5[_0x50e8('0x66')],{})[_0x50e8('0x2b')](function(_0x590a33){var _0x480362=_0x2b59f5[_0x50e8('0x67')][_0x50e8('0x2d')]({'plain':!![]});if(!_0x480362)throw new Error(_0x50e8('0x68'));if(_0x480362[_0x50e8('0x69')]===_0x50e8('0x67')){var _0x3fea05=_0x590a33[_0x50e8('0x2d')]({'plain':!![]});var _0x29c80a=_0x50e8('0x2e');return db[_0x50e8('0x6a')][_0x50e8('0x6b')]({'where':{'name':_0x29c80a,'userProfileId':_0x480362[_0x50e8('0x6c')]},'raw':!![]})[_0x50e8('0x2b')](function(_0x3f7935){if(_0x3f7935&&_0x3f7935[_0x50e8('0x6d')]===0x0){return db[_0x50e8('0x2f')][_0x50e8('0x62')]({'name':_0x3fea05[_0x50e8('0x31')],'resourceId':_0x3fea05['id'],'type':_0x3f7935['name'],'sectionId':_0x3f7935['id']},{})[_0x50e8('0x2b')](function(){return _0x590a33;});}else{return _0x590a33;}})[_0x50e8('0x20')](function(_0xd9e82e){logger[_0x50e8('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd9e82e);throw _0xd9e82e;});}return _0x590a33;})[_0x50e8('0x2b')](respondWithResult(_0x257f9e,0xc9))[_0x50e8('0x20')](handleError(_0x257f9e,null));};exports[_0x50e8('0x2a')]=function(_0x161a07,_0x76d18a){var _0x9319f0=null;_0x161a07['body'][_0x50e8('0x63')][_0x50e8('0x3b')](',')[_0x50e8('0x64')](_0x13667e=>{if(_0x13667e['trim']()!==''&&!wildcardUtils[_0x50e8('0x65')](_0x13667e['trim']())){_0x9319f0=new APIBadRequestError('\x22'+_0x13667e[_0x50e8('0x6e')]()+_0x50e8('0x6f'));}});if(_0x9319f0){return handleError(_0x76d18a,null)(_0x9319f0);}if(_0x161a07[_0x50e8('0x66')]['id']){delete _0x161a07[_0x50e8('0x66')]['id'];}return db[_0x50e8('0x4a')]['find']({'where':{'id':_0x161a07[_0x50e8('0x60')]['id']},'include':[{'model':db[_0x50e8('0x49')],'as':_0x50e8('0x70')}]})[_0x50e8('0x2b')](handleEntityNotFound(_0x76d18a,null))[_0x50e8('0x2b')](saveUpdates(_0x161a07[_0x50e8('0x66')],null))['then'](respondWithResult(_0x76d18a,null))[_0x50e8('0x20')](handleError(_0x76d18a,null));};exports[_0x50e8('0x2c')]=function(_0x4fc73d,_0x2d35ab){return db[_0x50e8('0x4a')]['find']({'where':{'id':_0x4fc73d[_0x50e8('0x60')]['id']}})['then'](handleEntityNotFound(_0x2d35ab,null))[_0x50e8('0x2b')](removeEntity(_0x2d35ab,null))[_0x50e8('0x20')](handleError(_0x2d35ab,null));};exports['describe']=function(_0x1cc4c3,_0x1733f5){return db[_0x50e8('0x4a')][_0x50e8('0x71')]()['then'](respondWithResult(_0x1733f5,null))[_0x50e8('0x20')](handleError(_0x1733f5,null));};exports['addDisposition']=function(_0x1691f4,_0x3b6d54){if(_0x1691f4['body']['id']){delete _0x1691f4[_0x50e8('0x66')]['id'];}return db[_0x50e8('0x4a')][_0x50e8('0x6b')]({'where':{'id':_0x1691f4[_0x50e8('0x60')]['id']}})[_0x50e8('0x2b')](handleEntityNotFound(_0x3b6d54,null))[_0x50e8('0x2b')](function(_0x2c85a6){if(_0x2c85a6){_0x1691f4[_0x50e8('0x66')][_0x50e8('0x72')]=_0x2c85a6['id'];return db['Disposition'][_0x50e8('0x62')](_0x1691f4[_0x50e8('0x66')]);}})[_0x50e8('0x2b')](respondWithResult(_0x3b6d54,null))['catch'](handleError(_0x3b6d54,null));};exports[_0x50e8('0x73')]=function(_0x1bf6ae,_0x1812b7){var _0x530681={'raw':![],'where':{}};var _0x56d8f1={};var _0x37839e={'count':0x0,'rows':[]};return db[_0x50e8('0x4a')]['findOne']({'where':{'id':_0x1bf6ae[_0x50e8('0x60')]['id']}})['then'](handleEntityNotFound(_0x1812b7,null))[_0x50e8('0x2b')](function(_0x21bff2){if(_0x21bff2){_0x56d8f1[_0x50e8('0x44')]=_[_0x50e8('0x50')](db['Disposition'][_0x50e8('0x4b')]);_0x56d8f1['query']=_[_0x50e8('0x50')](_0x1bf6ae['query']);_0x56d8f1['filters']=_[_0x50e8('0x52')](_0x56d8f1[_0x50e8('0x44')],_0x56d8f1['query']);_0x530681[_0x50e8('0x54')]=_['intersection'](_0x56d8f1[_0x50e8('0x44')],qs['fields'](_0x1bf6ae['query'][_0x50e8('0x53')]));_0x530681[_0x50e8('0x54')]=_0x530681[_0x50e8('0x54')][_0x50e8('0x55')]?_0x530681['attributes']:_0x56d8f1[_0x50e8('0x44')];if(!_0x1bf6ae['query']['hasOwnProperty'](_0x50e8('0x57'))){_0x530681[_0x50e8('0x24')]=qs[_0x50e8('0x24')](_0x1bf6ae['query']['limit']);_0x530681['offset']=qs[_0x50e8('0x23')](_0x1bf6ae[_0x50e8('0x4f')][_0x50e8('0x23')]);}_0x530681[_0x50e8('0x74')]=qs[_0x50e8('0x58')](_0x1bf6ae[_0x50e8('0x4f')]['sort']);_0x530681['where']=qs[_0x50e8('0x51')](_[_0x50e8('0x5a')](_0x1bf6ae[_0x50e8('0x4f')],_0x56d8f1[_0x50e8('0x51')]));_0x530681[_0x50e8('0x59')]['ChatWebsiteId']=_0x21bff2['id'];if(_0x1bf6ae[_0x50e8('0x4f')][_0x50e8('0x5c')]){_0x530681[_0x50e8('0x59')]=_['merge'](_0x530681['where'],{'$or':_[_0x50e8('0x4e')](_0x530681[_0x50e8('0x54')],function(_0x474dc){var _0x53d8c7={};_0x53d8c7[_0x474dc]={'$like':'%'+_0x1bf6ae[_0x50e8('0x4f')][_0x50e8('0x5c')]+'%'};return _0x53d8c7;})});}_0x530681=_['merge']({},_0x530681,_0x1bf6ae[_0x50e8('0x5d')]);return db['Disposition'][_0x50e8('0x26')]({'where':_0x530681[_0x50e8('0x59')]})[_0x50e8('0x2b')](function(_0x34be73){_0x37839e[_0x50e8('0x26')]=_0x34be73;if(_0x1bf6ae[_0x50e8('0x4f')][_0x50e8('0x75')]){_0x530681[_0x50e8('0x61')]=[{'all':!![]}];}return db[_0x50e8('0x76')]['findAll'](_0x530681);})[_0x50e8('0x2b')](function(_0x4e431e){_0x37839e[_0x50e8('0x5e')]=_0x4e431e;return _0x37839e;});}})[_0x50e8('0x2b')](respondWithFilteredResult(_0x1812b7,_0x530681))[_0x50e8('0x20')](handleError(_0x1812b7,null));};exports[_0x50e8('0x77')]=function(_0x556af1,_0x3cb2f2){return db['ChatWebsite'][_0x50e8('0x6b')]({'where':{'id':_0x556af1[_0x50e8('0x60')]['id']}})[_0x50e8('0x2b')](handleEntityNotFound(_0x3cb2f2,null))[_0x50e8('0x2b')](function(_0x443638){if(_0x443638){return _0x443638[_0x50e8('0x77')](_0x556af1[_0x50e8('0x4f')]['ids']);}})[_0x50e8('0x2b')](respondWithStatusCode(_0x3cb2f2,null))[_0x50e8('0x20')](handleError(_0x3cb2f2,null));};exports[_0x50e8('0x78')]=function(_0xc55fb5,_0x28ce03){if(_0xc55fb5[_0x50e8('0x66')]['id']){delete _0xc55fb5[_0x50e8('0x66')]['id'];}return db[_0x50e8('0x4a')]['find']({'where':{'id':_0xc55fb5['params']['id']}})['then'](handleEntityNotFound(_0x28ce03,null))[_0x50e8('0x2b')](function(_0x4d055e){if(_0x4d055e){_0xc55fb5[_0x50e8('0x66')][_0x50e8('0x72')]=_0x4d055e['id'];return db[_0x50e8('0x79')][_0x50e8('0x62')](_0xc55fb5[_0x50e8('0x66')]);}})[_0x50e8('0x2b')](respondWithResult(_0x28ce03,null))[_0x50e8('0x20')](handleError(_0x28ce03,null));};exports[_0x50e8('0x7a')]=function(_0x351ece,_0xbe9538){var _0xfe25fb={'raw':![],'where':{}};var _0x5a1afd={};var _0x528fdf={'count':0x0,'rows':[]};return db[_0x50e8('0x4a')]['findOne']({'where':{'id':_0x351ece[_0x50e8('0x60')]['id']}})[_0x50e8('0x2b')](handleEntityNotFound(_0xbe9538,null))[_0x50e8('0x2b')](function(_0x228f7e){if(_0x228f7e){_0x5a1afd['model']=_[_0x50e8('0x50')](db[_0x50e8('0x79')]['rawAttributes']);_0x5a1afd[_0x50e8('0x4f')]=_['keys'](_0x351ece[_0x50e8('0x4f')]);_0x5a1afd[_0x50e8('0x51')]=_[_0x50e8('0x52')](_0x5a1afd[_0x50e8('0x44')],_0x5a1afd[_0x50e8('0x4f')]);_0xfe25fb[_0x50e8('0x54')]=_[_0x50e8('0x52')](_0x5a1afd[_0x50e8('0x44')],qs[_0x50e8('0x53')](_0x351ece['query'][_0x50e8('0x53')]));_0xfe25fb[_0x50e8('0x54')]=_0xfe25fb[_0x50e8('0x54')]['length']?_0xfe25fb[_0x50e8('0x54')]:_0x5a1afd[_0x50e8('0x44')];if(!_0x351ece[_0x50e8('0x4f')][_0x50e8('0x56')]('nolimit')){_0xfe25fb['limit']=qs[_0x50e8('0x24')](_0x351ece[_0x50e8('0x4f')][_0x50e8('0x24')]);_0xfe25fb[_0x50e8('0x23')]=qs[_0x50e8('0x23')](_0x351ece['query'][_0x50e8('0x23')]);}_0xfe25fb[_0x50e8('0x74')]=qs['sort'](_0x351ece['query'][_0x50e8('0x58')]);_0xfe25fb[_0x50e8('0x59')]=qs['filters'](_[_0x50e8('0x5a')](_0x351ece['query'],_0x5a1afd[_0x50e8('0x51')]));_0xfe25fb[_0x50e8('0x59')][_0x50e8('0x72')]=_0x228f7e['id'];if(_0x351ece[_0x50e8('0x4f')][_0x50e8('0x5c')]){_0xfe25fb[_0x50e8('0x59')]=_['merge'](_0xfe25fb['where'],{'$or':_[_0x50e8('0x4e')](_0xfe25fb[_0x50e8('0x54')],function(_0x5d0198){var _0x52ef2c={};_0x52ef2c[_0x5d0198]={'$like':'%'+_0x351ece[_0x50e8('0x4f')]['filter']+'%'};return _0x52ef2c;})});}_0xfe25fb=_[_0x50e8('0x5b')]({},_0xfe25fb,_0x351ece[_0x50e8('0x5d')]);return db['CannedAnswer'][_0x50e8('0x26')]({'where':_0xfe25fb['where']})[_0x50e8('0x2b')](function(_0x47bdfc){_0x528fdf[_0x50e8('0x26')]=_0x47bdfc;if(_0x351ece['query'][_0x50e8('0x75')]){_0xfe25fb[_0x50e8('0x61')]=[{'all':!![]}];}return db[_0x50e8('0x79')][_0x50e8('0x7b')](_0xfe25fb);})['then'](function(_0xcea0a5){_0x528fdf[_0x50e8('0x5e')]=_0xcea0a5;return _0x528fdf;});}})['then'](respondWithFilteredResult(_0xbe9538,_0xfe25fb))[_0x50e8('0x20')](handleError(_0xbe9538,null));};exports[_0x50e8('0x7c')]=function(_0x3d9855,_0x33d56d){return db[_0x50e8('0x4a')][_0x50e8('0x6b')]({'where':{'id':_0x3d9855[_0x50e8('0x60')]['id']}})['then'](handleEntityNotFound(_0x33d56d,null))[_0x50e8('0x2b')](function(_0x431017){if(_0x431017){return _0x431017[_0x50e8('0x7c')](_0x3d9855[_0x50e8('0x4f')][_0x50e8('0x7d')]);}})[_0x50e8('0x2b')](respondWithStatusCode(_0x33d56d,null))[_0x50e8('0x20')](handleError(_0x33d56d,null));};exports[_0x50e8('0x7e')]=function(_0x26ecb5,_0x4bdd8c){_0x26ecb5[_0x50e8('0x66')][_0x50e8('0x7f')]=_0x26ecb5[_0x50e8('0x80')][_0x50e8('0x81')];return db[_0x50e8('0x4a')][_0x50e8('0x6b')]({'where':{'id':_0x26ecb5[_0x50e8('0x60')]['id']}})[_0x50e8('0x2b')](handleEntityNotFound(_0x4bdd8c,null))[_0x50e8('0x2b')](saveUpdates(_0x26ecb5['body'],null))[_0x50e8('0x2b')](respondWithResult(_0x4bdd8c,null))['catch'](handleError(_0x4bdd8c,null));};exports['addAvatar']=function(_0x31b00e,_0x4e9801){_0x31b00e[_0x50e8('0x66')][_0x50e8('0x82')]=_0x31b00e['file']['filename'];return db[_0x50e8('0x4a')][_0x50e8('0x6b')]({'where':{'id':_0x31b00e[_0x50e8('0x60')]['id']}})['then'](handleEntityNotFound(_0x4e9801,null))[_0x50e8('0x2b')](saveUpdates(_0x31b00e['body'],null))[_0x50e8('0x2b')](respondWithResult(_0x4e9801,null))[_0x50e8('0x20')](handleError(_0x4e9801,null));};exports[_0x50e8('0x83')]=function(_0x1fc0bf,_0x4b0fe3){_0x1fc0bf[_0x50e8('0x66')][_0x50e8('0x84')]=_0x1fc0bf[_0x50e8('0x80')][_0x50e8('0x81')];return db['ChatWebsite'][_0x50e8('0x6b')]({'where':{'id':_0x1fc0bf[_0x50e8('0x60')]['id']}})['then'](handleEntityNotFound(_0x4b0fe3,null))[_0x50e8('0x2b')](saveUpdates(_0x1fc0bf[_0x50e8('0x66')],null))['then'](respondWithResult(_0x4b0fe3,null))['catch'](handleError(_0x4b0fe3,null));};exports['addSystemAvatar']=function(_0x2e5e22,_0x2cf10f){_0x2e5e22[_0x50e8('0x66')]['systemAvatar']=_0x2e5e22[_0x50e8('0x80')][_0x50e8('0x81')];return db['ChatWebsite'][_0x50e8('0x6b')]({'where':{'id':_0x2e5e22[_0x50e8('0x60')]['id']}})[_0x50e8('0x2b')](handleEntityNotFound(_0x2cf10f,null))[_0x50e8('0x2b')](saveUpdates(_0x2e5e22[_0x50e8('0x66')],null))[_0x50e8('0x2b')](respondWithResult(_0x2cf10f,null))['catch'](handleError(_0x2cf10f,null));};exports[_0x50e8('0x85')]=function(_0x592357,_0x344319){var _0x5a4fa8=path[_0x50e8('0x86')](config[_0x50e8('0x87')],'server/files/images/logos/default_logo.svg');var _0x2ef5d9={'where':{'id':_0x592357[_0x50e8('0x60')]['id']},'attributes':['id',_0x50e8('0x7f')],'raw':!![]};var _0x32819a=![];return require(_0x50e8('0x88'))[_0x50e8('0x89')]()[_0x50e8('0x2b')](function(_0x132798){if(_0x132798){_0x32819a=_0x132798[_0x50e8('0x8a')];}})[_0x50e8('0x2b')](function(){return db[_0x50e8('0x4a')][_0x50e8('0x6b')](_0x2ef5d9);})['then'](handleEntityNotFound(_0x344319,null))[_0x50e8('0x2b')](function(_0x9b79ee){if(_0x9b79ee){if(!_[_0x50e8('0x8b')](_0x9b79ee[_0x50e8('0x7f')])){if(fs[_0x50e8('0x8c')](path[_0x50e8('0x86')](config[_0x50e8('0x87')],'server/files/images/logos/',_0x9b79ee[_0x50e8('0x7f')]))&&_0x32819a){_0x5a4fa8=path[_0x50e8('0x86')](config[_0x50e8('0x87')],_0x50e8('0x8d'),_0x9b79ee[_0x50e8('0x7f')]);}}return _0x344319[_0x50e8('0x8e')](_0x5a4fa8);}})['catch'](handleError(_0x344319,null));};exports['getAvatar']=function(_0xc8a217,_0x2eded4){var _0x546026=path[_0x50e8('0x86')](config[_0x50e8('0x87')],_0x50e8('0x8f'));var _0x5a8ad4={'where':{'id':_0xc8a217[_0x50e8('0x60')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x50e8('0x4a')][_0x50e8('0x6b')](_0x5a8ad4)['then'](handleEntityNotFound(_0x2eded4,null))['then'](function(_0x320a5a){if(_0x320a5a){if(!_[_0x50e8('0x8b')](_0x320a5a[_0x50e8('0x82')])){if(fs['existsSync'](path[_0x50e8('0x86')](config['root'],_0x50e8('0x90'),_0x320a5a[_0x50e8('0x82')]))){_0x546026=path[_0x50e8('0x86')](config[_0x50e8('0x87')],'server/files/images/avatars/',_0x320a5a[_0x50e8('0x82')]);}}return _0x2eded4[_0x50e8('0x8e')](_0x546026);}})[_0x50e8('0x20')](handleError(_0x2eded4,null));};exports[_0x50e8('0x91')]=function(_0x4a4b06,_0xea8c5d){var _0x5be029=path[_0x50e8('0x86')](config['root'],_0x50e8('0x92'));var _0xc3b3ae={'where':{'id':_0x4a4b06[_0x50e8('0x60')]['id']},'attributes':['id',_0x50e8('0x84'),_0x50e8('0x93')],'raw':!![]};return db[_0x50e8('0x4a')]['find'](_0xc3b3ae)[_0x50e8('0x2b')](handleEntityNotFound(_0xea8c5d,null))[_0x50e8('0x2b')](function(_0x3fff9e){if(_0x3fff9e){if(!_[_0x50e8('0x8b')](_0x3fff9e[_0x50e8('0x84')])){if(fs[_0x50e8('0x8c')](path[_0x50e8('0x86')](config[_0x50e8('0x87')],_0x50e8('0x90'),_0x3fff9e[_0x50e8('0x84')]))&&_0x3fff9e[_0x50e8('0x93')]){_0x5be029=path['join'](config['root'],_0x50e8('0x90'),_0x3fff9e[_0x50e8('0x84')]);}}return _0xea8c5d[_0x50e8('0x8e')](_0x5be029);}})[_0x50e8('0x20')](handleError(_0xea8c5d,null));};exports['getSystemAvatar']=function(_0x17061d,_0x2b952b){var _0x58c1d5=path[_0x50e8('0x86')](config[_0x50e8('0x87')],_0x50e8('0x94'));var _0x152f45={'where':{'id':_0x17061d[_0x50e8('0x60')]['id']},'attributes':['id',_0x50e8('0x95')],'raw':!![]};return db[_0x50e8('0x4a')][_0x50e8('0x6b')](_0x152f45)[_0x50e8('0x2b')](handleEntityNotFound(_0x2b952b,null))[_0x50e8('0x2b')](function(_0x44e3d5){if(_0x44e3d5){if(!_[_0x50e8('0x8b')](_0x44e3d5['systemAvatar'])){if(fs[_0x50e8('0x8c')](path[_0x50e8('0x86')](config[_0x50e8('0x87')],_0x50e8('0x90'),_0x44e3d5[_0x50e8('0x95')]))){_0x58c1d5=path[_0x50e8('0x86')](config[_0x50e8('0x87')],_0x50e8('0x90'),_0x44e3d5[_0x50e8('0x95')]);}}return _0x2b952b['download'](_0x58c1d5);}})[_0x50e8('0x20')](handleError(_0x2b952b,null));};function checkWebsiteInterval(_0x4ecddb){var _0x5ba641=_0x4ecddb['Interval'];if(!_0x5ba641){return Promise['resolve'](_0x4ecddb);}var _0x3cd6bf=_0x4ecddb[_0x50e8('0x96')]||undefined;return _0x5ba641['ifTime'](_0x3cd6bf)[_0x50e8('0x2b')](function(_0x4596b0){if(!_0x4596b0){throw new APIOutOfIntervalError();}return _0x4ecddb;});}exports['notify']=function(_0x415022,_0x10ae58){var _0x549f58={'body':_0x415022[_0x50e8('0x66')],'channel':'chat'};var _0x1fccd9=[];var _0x358f4c=[];var _0x5d77e4={};var _0x43d6a2=![];if(_0x415022[_0x50e8('0x66')]['id']){delete _0x415022[_0x50e8('0x66')]['id'];}if(_['isNil'](_0x415022[_0x50e8('0x66')]['from'])){throw new APIBadRequestError(_0x50e8('0x97'));}if(_['isNil'](_0x415022['body'][_0x50e8('0x98')])){throw new APIBadRequestError(_0x50e8('0x99'));}if(_[_0x50e8('0x9a')](_0x415022[_0x50e8('0x66')][_0x50e8('0x66')])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0x1bd2ac=_0x415022[_0x50e8('0x66')][_0x50e8('0x37')]&&_0x415022['body']['referer'];return db[_0x50e8('0x9b')]['describe']()['then'](function(_0x5163e4){if(!_0x5163e4){throw new Error(_0x50e8('0x9c'));}_0x1fccd9=Object[_0x50e8('0x50')](_0x5163e4)['filter'](function(_0x28886c){return![_0x50e8('0x9d'),_0x50e8('0x9e')][_0x50e8('0x9f')](_0x28886c);});_0x358f4c=Object[_0x50e8('0x50')](_0x5163e4)['filter'](function(_0x4587cc){return![_0x50e8('0x9d'),_0x50e8('0x9e'),_0x50e8('0xa0'),_0x50e8('0xa1')]['includes'](_0x4587cc);});if(!_[_0x50e8('0x9f')](_0x358f4c,_0x415022[_0x50e8('0x66')][_0x50e8('0x98')])){throw new APIBadRequestError(_0x50e8('0xa2')+_0x358f4c['join'](',\x20'));}_0x5d77e4[_0x415022[_0x50e8('0x66')][_0x50e8('0x98')]]=_0x415022[_0x50e8('0x66')][_0x50e8('0xa3')];})['then'](function(){return db[_0x50e8('0x4a')][_0x50e8('0x6b')]({'where':{'id':_0x415022[_0x50e8('0x60')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x5d77e4,'limit':0x1,'order':[[_0x50e8('0x9e'),_0x50e8('0xa4')]]}]},{'model':db[_0x50e8('0xa5')],'as':_0x50e8('0xa6')},{'model':db[_0x50e8('0xa7')],'as':_0x50e8('0xa7'),'include':[{'model':db['Interval'],'as':_0x50e8('0xa8'),'attributes':['id',_0x50e8('0xa9')],'raw':!![]}]}]});})[_0x50e8('0x2b')](function(_0x5553b6){if(!_0x5553b6){throw new APINotFoundError(util[_0x50e8('0x41')](_0x50e8('0xaa'),_0x415022[_0x50e8('0x60')]['id']));}if(_0x1bd2ac){return checkWebsiteInterval(_0x5553b6);}return _0x5553b6;})['then'](function(_0x40d700){_0x549f58['account']=_0x40d700;_0x549f58[_0x50e8('0xab')]=_['orderBy'](_0x40d700[_0x50e8('0xa6')],[_0x50e8('0xac')],['asc']);if(_0x549f58[_0x50e8('0xad')][_0x50e8('0xa6')]){delete _0x549f58[_0x50e8('0xad')]['Applications'];}_0x549f58[_0x50e8('0xae')]=_0x40d700[_0x50e8('0xaf')]||{'id':_0x40d700['ListId']};if(_0x549f58[_0x50e8('0xae')]&&_0x549f58[_0x50e8('0xae')][_0x50e8('0xb0')][_0x50e8('0x55')]){return _0x549f58[_0x50e8('0xae')][_0x50e8('0xb0')][0x0];}var _0x30a4ad=_[_0x50e8('0x13')](_0x415022[_0x50e8('0x66')],{'firstName':_0x415022[_0x50e8('0x66')][_0x50e8('0xa3')],'ListId':_0x40d700['ListId']});_0x30a4ad[_0x415022[_0x50e8('0x66')][_0x50e8('0x98')]]=_0x415022[_0x50e8('0x66')][_0x50e8('0xa3')];return db['CmContact'][_0x50e8('0x62')](_0x30a4ad,{'fields':_0x1fccd9,'raw':!![]});})[_0x50e8('0x2b')](function(_0x36ea2c){_0x549f58['contact']=_0x36ea2c;var _0x3f03d1=createInteractionObject(_0x415022[_0x50e8('0x60')]['id'],_0x415022[_0x50e8('0x66')],_0x415022[_0x50e8('0xb1')],_0x36ea2c);var _0xc59473={'ChatWebsiteId':_0x415022[_0x50e8('0x60')]['id']};if(_0x415022['body'][_0x50e8('0xb2')]){_0xc59473[_0x50e8('0xb2')]=_0x415022[_0x50e8('0x66')][_0x50e8('0xb2')];_0xc59473[_0x50e8('0xb3')]=![];return db['ChatInteraction'][_0x50e8('0x6b')]({'where':_0xc59473})[_0x50e8('0x2b')](function(_0x1f4768){var _0x52b77a=_0x415022['body'][_0x50e8('0x37')]&&_0x415022[_0x50e8('0x66')][_0x50e8('0x3e')];if(_0x1f4768){_0x43d6a2=!![];return _0x1f4768;}else if(!_0x52b77a&&_0x1f4768&&_0x1f4768[_0x50e8('0xb3')]){throw new APIConflictError(_0x50e8('0xb4'));}_0x3f03d1[_0x50e8('0xb2')]=_0x415022[_0x50e8('0x66')]['threadId'];_0x3f03d1[_0x50e8('0xb5')]=_0x415022[_0x50e8('0x66')][_0x50e8('0xb5')];return db[_0x50e8('0xb6')]['create'](_0x3f03d1);});}_0xc59473[_0x50e8('0xb7')]=_0x36ea2c['id'];if(_0x415022[_0x50e8('0x66')][_0x50e8('0xb8')]&&_0x415022[_0x50e8('0x66')][_0x50e8('0xb8')]['id']){_0xc59473['id']=_0x415022[_0x50e8('0x66')][_0x50e8('0xb8')]['id'];return db['ChatInteraction'][_0x50e8('0x6b')]({'where':_0xc59473})['then'](function(_0x34eb5d){var _0x1ee3eb=_0x415022[_0x50e8('0x66')][_0x50e8('0x37')]&&_0x415022['body'][_0x50e8('0x3e')];if(!_0x1ee3eb&&_0x34eb5d&&_0x34eb5d[_0x50e8('0xb3')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}else if(_0x34eb5d){_0x43d6a2=!![];return _0x34eb5d;}else{return db[_0x50e8('0xb6')][_0x50e8('0x62')](_0x3f03d1);}});}return db[_0x50e8('0xb6')][_0x50e8('0x62')](_0x3f03d1);})[_0x50e8('0x2b')](function(_0x2ece4a){if(!_0x43d6a2){return _0x2ece4a;}var _0x55dd46={'from':(_0x549f58[_0x50e8('0xb9')][_0x50e8('0xba')]||'')+'\x20'+(_0x549f58[_0x50e8('0xb9')]['lastName']||'')};if(_0x415022['body'][_0x50e8('0xb2')]&&_0x415022[_0x50e8('0x66')][_0x50e8('0xbb')]&&_0x415022[_0x50e8('0x66')]['threadId']!=_0x415022[_0x50e8('0x66')][_0x50e8('0xbb')]){_0x55dd46[_0x50e8('0xb2')]=_0x415022['body'][_0x50e8('0xbb')];}return _0x2ece4a[_0x50e8('0x2a')](_0x55dd46);})[_0x50e8('0x2b')](function(_0x49c22c){_0x549f58[_0x50e8('0xb8')]=_0x49c22c['get']({'plain':!![]});_0x549f58[_0x50e8('0xb8')][_0x50e8('0xbc')]=!_0x43d6a2;if(_0x549f58[_0x50e8('0xb8')][_0x50e8('0xbc')]){if(_0x549f58['account']['autoclose']){_0x549f58[_0x50e8('0xab')][_0x50e8('0xbd')]({'id':0x0,'priority':_0x549f58[_0x50e8('0xab')][_0x50e8('0x55')]+0x1,'app':_0x50e8('0xbe'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x50e8('0xbf')]['create']({'body':_0x415022['body'][_0x50e8('0x66')],'ChatWebsiteId':_0x415022[_0x50e8('0x60')]['id'],'ChatInteractionId':_0x49c22c['id'],'direction':'in','ContactId':_0x549f58[_0x50e8('0xb9')]['id'],'AttachmentId':_0x415022['body'][_0x50e8('0xc0')]});})[_0x50e8('0x2b')](function(_0x17d2a6){_0x549f58[_0x50e8('0x1f')]=_0x17d2a6;if(!_0x549f58[_0x50e8('0xb8')][_0x50e8('0xc1')]){return;}return db['User']['find']({'attributes':['id',_0x50e8('0x31')],'where':{'id':_0x549f58[_0x50e8('0xb8')][_0x50e8('0xc1')]}});})['then'](function(_0x27b09f){if(_0x27b09f){_0x549f58['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x50e8('0xc2'),'appdata':_0x27b09f[_0x50e8('0x31')]+','+(_0x549f58[_0x50e8('0xad')][_0x50e8('0xc3')]||0xa),'interval':_0x50e8('0xc4')});_0x549f58[_0x50e8('0xc5')]=!![];}if(!_0x549f58[_0x50e8('0xb8')][_0x50e8('0xc6')]){return;}return db[_0x50e8('0xc7')]['find']({'attributes':['id',_0x50e8('0x31')],'where':{'id':_0x549f58[_0x50e8('0xb8')][_0x50e8('0xc6')]}});})[_0x50e8('0x2b')](function(_0x4952b4){if(_0x4952b4){_0x549f58[_0x50e8('0xab')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4952b4[_0x50e8('0x31')]+','+(_0x549f58[_0x50e8('0xad')]['waitForTheAssignedQueue']||0x12c),'interval':_0x50e8('0xc4')});}return respondWithRpcPromise(_0x50e8('0xc8'),_0x50e8('0xc9'),_0x549f58);})[_0x50e8('0x2b')](function(_0x4b2166){respondWithRpcPromise(_0x50e8('0xca'),_0x50e8('0xca'),{'event':_0x50e8('0xcb'),'message':_0x4b2166},client9002);return _0x4b2166;})[_0x50e8('0x2b')](respondWithResult(_0x10ae58,null))[_0x50e8('0x20')](APIHandleError(_0x10ae58));};exports['offline']=function(_0x317038,_0x5ed182){var _0xdd5f70,_0x2a6b90,_0x5c1ab2;var _0x13aa64=[];var _0x564d66={};var _0x2176ec=_0x317038[_0x50e8('0xcc')]||[];var _0xb280fb=[];var _0x3152e6;return db[_0x50e8('0x9b')][_0x50e8('0x71')]()[_0x50e8('0x2b')](function(_0x32c703){if(!_0x32c703){throw new db['Sequelize'][(_0x50e8('0xcd'))](_0x50e8('0xce'));}_0x13aa64=_[_0x50e8('0xcf')](_[_0x50e8('0x50')](_0x32c703),['createdAt',_0x50e8('0x9e'),'CompanyId',_0x50e8('0xa1')]);if(_0x317038[_0x50e8('0x66')]['id']){delete _0x317038['body']['id'];}if(_['isNil'](_0x317038[_0x50e8('0x66')][_0x50e8('0xa3')])){throw _0x5ed182[_0x50e8('0x22')](0x1f4)[_0x50e8('0x32')](new db[(_0x50e8('0xd0'))]['ValidationError'](_0x50e8('0xd1')));}if(_[_0x50e8('0x8b')](_0x317038[_0x50e8('0x66')]['body'])||_0x317038['body']['body']===''){throw _0x5ed182[_0x50e8('0x22')](0x1f4)[_0x50e8('0x32')](new db[(_0x50e8('0xd0'))][(_0x50e8('0xcd'))](_0x50e8('0xd2')));}if(_[_0x50e8('0x8b')](_0x317038[_0x50e8('0x66')][_0x50e8('0xd3')])){throw _0x5ed182['status'](0x1f4)[_0x50e8('0x32')](new db['Sequelize'][(_0x50e8('0xcd'))](_0x50e8('0xd4')+_0x13aa64));}if(!_['includes'](_0x13aa64,_0x317038[_0x50e8('0x66')]['mapKeyOffline'])){throw _0x5ed182[_0x50e8('0x22')](0x1f4)['send'](new db[(_0x50e8('0xd0'))]['ValidationError'](_0x50e8('0xd5')+_0x13aa64));}_0x564d66[_0x317038[_0x50e8('0x66')][_0x50e8('0xd3')]]=_0x317038['body']['from'];})[_0x50e8('0x2b')](function(){return db['ChatWebsite'][_0x50e8('0x6b')]({'where':{'id':_0x317038['params']['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db['MailAccount'],'as':_0x50e8('0xd6')}]});})[_0x50e8('0x2b')](handleEntityNotFound(_0x5ed182,null))['then'](function(_0x2aee57){if(_0x2aee57&&_0x2aee57[_0x50e8('0xaf')]){_0x2a6b90=_0x2aee57;var _0x1b5e5f=_['defaults'](_0x317038[_0x50e8('0x66')],{'firstName':_0x317038[_0x50e8('0x66')][_0x50e8('0xa3')],'phone':_0x317038[_0x50e8('0x66')][_0x50e8('0xa3')],'ListId':_0x2aee57['ListId']});_0x1b5e5f[_0x317038['body'][_0x50e8('0xd3')]]=_0x317038[_0x50e8('0x66')][_0x50e8('0xa3')];return db[_0x50e8('0x9b')][_0x50e8('0xd7')]({'where':_0x564d66,'defaults':_0x1b5e5f});}})[_0x50e8('0xd8')](function(_0x49b47f){if(_0x49b47f){_0x5c1ab2=_0x49b47f;var _0x36c557=fs[_0x50e8('0xd9')](path[_0x50e8('0x86')](config['root'],_0x50e8('0xda')),_0x50e8('0xdb'));var _0x5c5cd8=ejs[_0x50e8('0xdc')](_0x36c557,{'body':_['toPairs'](_0x317038[_0x50e8('0x66')][_0x50e8('0x66')]),'bodyTitle':_0x2a6b90[_0x50e8('0xdd')]});return db[_0x50e8('0xde')][_0x50e8('0x62')]({'body':_0x5c5cd8,'plainBody':htmlToText[_0x50e8('0xdf')](_0x5c5cd8),'ContactId':_0x49b47f['id'],'ChatWebsiteId':_0x2a6b90['id']});}})[_0x50e8('0x2b')](function(_0x3bdb40){_0x3152e6=_0x3bdb40;if(_0x2176ec[_0x50e8('0x55')]){var _0x145f55=_0x2176ec[_0x50e8('0x4e')](function(_0x4df157){return{'name':_0x4df157['originalname'],'basename':_0x4df157[_0x50e8('0x81')],'type':_0x4df157['mimetype'],'ChatOfflineMessageId':_0x3bdb40['id']};});_0xb280fb=_0x145f55['map'](_0x45e5a0=>{var _0x29d9c7={'filename':_0x45e5a0[_0x50e8('0x31')],'path':path[_0x50e8('0x86')](config[_0x50e8('0x87')],_0x50e8('0xe0'),_0x50e8('0xcc'),_0x50e8('0xe1'),_0x50e8('0xe2'),_0x45e5a0[_0x50e8('0xe3')])};return _0x29d9c7;});if(!_0x2a6b90['openNewInteraction']){return db[_0x50e8('0xe4')][_0x50e8('0xe5')](function(_0x2a451d){return db['Attachment'][_0x50e8('0xe6')](_0x145f55,{'transaction':_0x2a451d});});}}})['then'](function(){if(_0x3152e6){_0xdd5f70=_0x3152e6;return db[_0x50e8('0xd6')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x50e8('0xe7')],'as':_0x50e8('0xe8'),'raw':!![],'include':[{'model':db[_0x50e8('0xe9')],'as':_0x50e8('0xe9'),'raw':!![]}]}]});}})[_0x50e8('0x2b')](function(_0x48f4de){if(_0x48f4de&&_0x48f4de[_0x50e8('0xe8')]&&_0x2a6b90[_0x50e8('0xea')]&&_0x2a6b90[_0x50e8('0xeb')]){var _0x5a50fa=_0x48f4de[_0x50e8('0xec')]();return respondWithRpcPromise(_0x50e8('0xed'),_0x50e8('0xee'),{'account':_0x5a50fa,'message':{'from':util[_0x50e8('0x41')](_0x50e8('0xef'),_0x48f4de[_0x50e8('0x31')],_0x48f4de[_0x50e8('0xf0')]||_0x48f4de['Smtp'][_0x50e8('0x67')]),'to':_0x2a6b90[_0x50e8('0xeb')],'subject':_0x2a6b90[_0x50e8('0xf1')],'html':_0xdd5f70[_0x50e8('0x66')],'attachments':_0xb280fb}},client9003)[_0x50e8('0x2b')](function(){return _0xdd5f70;})[_0x50e8('0x20')](function(_0x319b5a){logger[_0x50e8('0x1e')](_0x319b5a);});}})[_0x50e8('0x2b')](function(){if(_0x2a6b90&&_0x2a6b90[_0x50e8('0xf2')]&&_0x2a6b90['MailAccountId']){var _0x56d2e6=[];if(_0x2176ec[_0x50e8('0x55')]){_0x56d2e6=_0x2176ec[_0x50e8('0x4e')](function(_0x110c9f){return{'name':_0x110c9f[_0x50e8('0xf3')],'basename':_0x110c9f[_0x50e8('0x81')],'type':_0x110c9f[_0x50e8('0xf4')],'ChatOfflineMessageId':_0x3152e6['id']};});}var _0x4b9ca2;if(!_[_0x50e8('0x8b')](_0x2a6b90[_0x50e8('0xf5')])){var _0x46a7ed=_[_0x50e8('0x4e')](_0x317038[_0x50e8('0x66')],function(_0x40c9a7){return _0x40c9a7;});var _0x289024=_['toPairsIn'](_0x46a7ed)[0x0];var _0x38b87f=_['mapValues'](_0x289024,function(_0x1abc45){return _0x1abc45;});_0x4b9ca2=_0x38b87f[0x1][_0x2a6b90[_0x50e8('0xf5')]];}var _0x6c75c2={'from':_0x5c1ab2[_0x50e8('0xf0')],'firstName':_0x5c1ab2[_0x50e8('0xba')],'lastName':_0x5c1ab2[_0x50e8('0x3c')],'mapKey':_0x50e8('0xf0'),'message':{'from':_0x5c1ab2[_0x50e8('0xf0')],'to':_0x2a6b90['MailAccount'][_0x50e8('0xf0')],'cc':'','subject':_[_0x50e8('0x8b')](_0x4b9ca2)?_0x2a6b90[_0x50e8('0xf1')]:_0x4b9ca2,'messageId':'','sentAt':new Date(),'attach':_0x56d2e6['length'],'attachments':_0x56d2e6,'originChannel':_0x50e8('0xf6'),'ChatWebsiteId':_0x2a6b90['id'],'ChatOfflineMessageId':_0xdd5f70['id'],'originTo':_0x2a6b90['MailAccount'][_0x50e8('0xf0')]},'body':_0xdd5f70[_0x50e8('0x66')]};var _0x8ca769={'account':{'id':_0x2a6b90[_0x50e8('0xf7')]},'body':_0x6c75c2,'log':_0x50e8('0xf8')};return respondWithRpcPromise(_0x50e8('0xf8'),_0x50e8('0xf9'),_0x8ca769,client9001)[_0x50e8('0x2b')](function(){return _0xdd5f70;})[_0x50e8('0x20')](function(_0x3fe6de){logger['error'](_0x3fe6de);});}return;})['then'](function(){if(_0xdd5f70){return _0xdd5f70;}})[_0x50e8('0x2b')](respondWithResult(_0x5ed182,null))[_0x50e8('0x20')](function(){for(var _0x27ac6b of _0x2176ec){var _0x1a0b3f=path[_0x50e8('0x86')](config[_0x50e8('0x87')],_0x50e8('0xe0'),_0x50e8('0xcc'),'attachments','offline-chat',_0x27ac6b[_0x50e8('0x81')]);fs_extra[_0x50e8('0xfa')](_0x1a0b3f)['catch'](function(_0x48be40){logger[_0x50e8('0x1e')](_0x50e8('0xfb'),_0x1a0b3f,_0x48be40);});}});};exports['addInteraction']=function(_0x305a8d,_0x2c9735){return db[_0x50e8('0xb6')][_0x50e8('0x6b')]({'where':{'id':_0x305a8d['params']['id']}})[_0x50e8('0x2b')](handleEntityNotFound(_0x2c9735,null))[_0x50e8('0x2b')](function(_0x2cf4c9){if(_0x2cf4c9){return _0x2cf4c9[_0x50e8('0xfc')](_0x305a8d[_0x50e8('0x66')][_0x50e8('0x7d')],_[_0x50e8('0xfd')](_0x305a8d[_0x50e8('0x66')],[_0x50e8('0x7d'),'id'])||{});}})['then'](respondWithResult(_0x2c9735,null))['catch'](handleError(_0x2c9735,null));};exports['getInteractions']=function(_0x356534,_0x163440){var _0x13fcc7={'raw':![],'where':{}};var _0x1acbf1={};var _0x2d018e={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x50e8('0xfe')]({'where':{'id':_0x356534[_0x50e8('0x60')]['id']}})['then'](handleEntityNotFound(_0x163440,null))[_0x50e8('0x2b')](function(_0x53bad8){if(_0x53bad8){_0x1acbf1[_0x50e8('0x44')]=_[_0x50e8('0x50')](db[_0x50e8('0xb6')][_0x50e8('0x4b')]);_0x1acbf1[_0x50e8('0x4f')]=_[_0x50e8('0x50')](_0x356534[_0x50e8('0x4f')]);_0x1acbf1[_0x50e8('0x51')]=_['intersection'](_0x1acbf1[_0x50e8('0x44')],_0x1acbf1[_0x50e8('0x4f')]);_0x13fcc7[_0x50e8('0x54')]=_[_0x50e8('0x52')](_0x1acbf1[_0x50e8('0x44')],qs['fields'](_0x356534[_0x50e8('0x4f')][_0x50e8('0x53')]));_0x13fcc7['attributes']=_0x13fcc7[_0x50e8('0x54')][_0x50e8('0x55')]?_0x13fcc7['attributes']:_0x1acbf1['model'];if(!_0x356534[_0x50e8('0x4f')]['hasOwnProperty'](_0x50e8('0x57'))){_0x13fcc7[_0x50e8('0x24')]=qs['limit'](_0x356534[_0x50e8('0x4f')]['limit']);_0x13fcc7[_0x50e8('0x23')]=qs[_0x50e8('0x23')](_0x356534[_0x50e8('0x4f')]['offset']);}_0x13fcc7['order']=qs[_0x50e8('0x58')](_0x356534[_0x50e8('0x4f')]['sort']);_0x13fcc7[_0x50e8('0x59')]=qs[_0x50e8('0x51')](_[_0x50e8('0x5a')](_0x356534[_0x50e8('0x4f')],_0x1acbf1[_0x50e8('0x51')]));_0x13fcc7['where'][_0x50e8('0x72')]=_0x53bad8['id'];if(_0x356534[_0x50e8('0x4f')][_0x50e8('0x5c')]){_0x13fcc7['where']=_[_0x50e8('0x5b')](_0x13fcc7[_0x50e8('0x59')],{'$or':_[_0x50e8('0x4e')](_0x13fcc7[_0x50e8('0x54')],function(_0x578121){var _0xbbe47f={};_0xbbe47f[_0x578121]={'$like':'%'+_0x356534[_0x50e8('0x4f')][_0x50e8('0x5c')]+'%'};return _0xbbe47f;})});}_0x13fcc7=_[_0x50e8('0x5b')]({},_0x13fcc7,_0x356534['options']);return db[_0x50e8('0xb6')][_0x50e8('0x26')]({'where':_0x13fcc7[_0x50e8('0x59')]})[_0x50e8('0x2b')](function(_0x441ad6){_0x2d018e[_0x50e8('0x26')]=_0x441ad6;if(_0x356534[_0x50e8('0x4f')][_0x50e8('0x75')]){_0x13fcc7[_0x50e8('0x61')]=[{'model':db[_0x50e8('0x9b')],'as':_0x50e8('0xff'),'required':![]},{'model':db[_0x50e8('0x100')],'as':_0x50e8('0x101'),'attributes':['name',_0x50e8('0x102'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x50e8('0x103'),'attributes':['id',_0x50e8('0x31'),_0x50e8('0x104')],'where':_0x356534[_0x50e8('0x4f')][_0x50e8('0x105')]?{'id':_0x356534[_0x50e8('0x4f')]['tag']}:undefined,'required':_0x356534['query'][_0x50e8('0x105')]?!![]:![]}];}return db['ChatInteraction'][_0x50e8('0x7b')](_0x13fcc7);})[_0x50e8('0x2b')](function(_0xad321e){_0x2d018e['rows']=_0xad321e;return _0x2d018e;});}})[_0x50e8('0x2b')](respondWithFilteredResult(_0x163440,_0x13fcc7))[_0x50e8('0x20')](handleError(_0x163440,null));};exports[_0x50e8('0x106')]=function(_0x59d284,_0x52999d){var _0x52a70d=0x0;var _0x150977=0x0;var _0xaa3d55=![];var _0x1b048d;var _0x3556fb;return db[_0x50e8('0x4a')][_0x50e8('0x6b')]({'where':{'id':_0x59d284['params']['id']},'include':[{'model':db[_0x50e8('0xa7')],'as':_0x50e8('0xa7'),'include':[{'model':db['Interval'],'as':_0x50e8('0xa8'),'attributes':['id',_0x50e8('0xa9')]}]}]})[_0x50e8('0x2b')](handleEntityNotFound(_0x52999d,null))[_0x50e8('0x2b')](function(_0xdd947a){if(_0xdd947a){_0x1b048d=_0xdd947a;return _0xdd947a[_0x50e8('0x107')]({'raw':!![]});}})['then'](function(_0x25bec3){if(_0x1b048d){if(_0x25bec3){_0x3556fb=_0x25bec3;}}return require(_0x50e8('0x88'))[_0x50e8('0x89')]();})[_0x50e8('0x2b')](function(_0x1c3342){if(_0x1c3342){_0x150977=_0x1c3342['virtual'];_0xaa3d55=_0x1c3342[_0x50e8('0x8a')];}})[_0x50e8('0x2b')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0x50e8('0x2b')](function(_0x161e16){_0x52a70d=_0x161e16;if(_0x150977&&_0x161e16>_0x150977){return db[_0x50e8('0x108')][_0x50e8('0xfe')]({'where':{'id':0x1}})[_0x50e8('0x2b')](function(_0x3f0648){if(_0x3f0648){_0x3f0648[_0x50e8('0x109')](_0x50e8('0x10a'));}});}})[_0x50e8('0x2b')](function(){var _0x597109=_0x1b048d['Interval'];var _0x3f06d8=_0x1b048d[_0x50e8('0x96')]||undefined;return _0x597109?_0x597109['ifTime'](_0x3f06d8):!![];})[_0x50e8('0x2b')](function(_0x6e869){var _0x2cc727=fs['readFileSync'](path[_0x50e8('0x86')](config[_0x50e8('0x87')],_0x50e8('0x10b')),_0x50e8('0xdb'));var _0x5b9328='3.13.0';var _0x53eb2c=![];var _0x29336e,_0x422bc1;if(_0x59d284[_0x50e8('0xb1')][_0x50e8('0x3e')]){_0x29336e=new URL(_0x59d284[_0x50e8('0xb1')][_0x50e8('0x3e')])['origin'];}else if(_0x59d284[_0x50e8('0xb1')][_0x50e8('0x10c')]){_0x29336e=new URL(_0x59d284[_0x50e8('0xb1')][_0x50e8('0x10c')])[_0x50e8('0x10c')];}else{_0x29336e=_0x50e8('0x10d');}_0x422bc1=typeof _0x1b048d['address']['split'](',')[_0x50e8('0x6b')](function(_0x12a9b5){return wildcardUtils[_0x50e8('0x10e')](_0x12a9b5,_0x29336e);})!==_0x50e8('0x25');var _0x119050={'chatVersion':_0x5b9328,'chatWebsiteAddressOrigin':_0x422bc1?_0x29336e:_0x1b048d[_0x50e8('0x63')],'remote':_0x1b048d[_0x50e8('0x10f')],'query':querystring[_0x50e8('0x1d')](_[_0x50e8('0x5b')](_0x1b048d[_0x50e8('0x2d')]({'plain':!![]}),{'customerIp':_0x59d284['headers'][_0x50e8('0x39')]||_0x59d284['headers']['x-real-ip']||_0x59d284[_0x50e8('0x110')][_0x50e8('0x111')]||_0x59d284['ip'],'referer':_0x59d284[_0x50e8('0xb1')][_0x50e8('0x3e')],'openedInteractions':_0x52a70d,'maxInteractions':_0x150977,'virtual':_0xaa3d55[_0x50e8('0x112')],'online':_0x6e869,'custom':_0xaa3d55,'address':_0x422bc1?_0x29336e:null}))[_0x50e8('0x113')](/'/g,'\x5c\x27')};_0x52999d[_0x50e8('0x32')](ejs[_0x50e8('0xdc')](Mustache[_0x50e8('0xdc')](_0x2cc727,_0x119050),{'proactiveActions':_0x3556fb,'alignment':_0x1b048d[_0x50e8('0x114')],'verticalAlignment':_0x1b048d[_0x50e8('0x115')],'div_color':_0x1b048d['color'],'labelText':_0x1b048d[_0x50e8('0x116')],'text_color':_0x1b048d[_0x50e8('0x117')],'text_button_color':_0x1b048d['textButtonColor'],'button_color':_0x1b048d[_0x50e8('0x118')],'background_color':_0x1b048d[_0x50e8('0x119')],'hideWhenOffline':_0x1b048d[_0x50e8('0x11a')],'intervalId':_0x1b048d[_0x50e8('0x11b')],'isDevelopment':_0x53eb2c,'chatVersion':_0x5b9328}));})[_0x50e8('0x20')](handleError(_0x52999d,null));};exports['addApplications']=function(_0xbd278b,_0x346072){var _0x36889e=_0xbd278b[_0x50e8('0x60')]['id'];var _0x123e78=_0xbd278b[_0x50e8('0x66')];var _0x429fa1=0xc8;var _0x2094cf=null;return db[_0x50e8('0xe4')][_0x50e8('0xe5')]({'isolationLevel':db[_0x50e8('0xe4')][_0x50e8('0x11c')]['ISOLATION_LEVELS'][_0x50e8('0x11d')]},function(_0x1d1cbd){return db[_0x50e8('0x4a')]['findOne']({'where':{'id':_0x36889e},'transaction':_0x1d1cbd})[_0x50e8('0x2b')](function(_0x95929b){if(_0x95929b){return db['ChatApplication'][_0x50e8('0x2c')]({'where':{'ChatWebsiteId':_0x36889e},'transaction':_0x1d1cbd})[_0x50e8('0x2b')](function(){var _0x3d1f34=_[_0x50e8('0x4e')](_0x123e78,function(_0x2782d7){_0x2782d7['ChatWebsiteId']=_0x36889e;return _0x2782d7;});return db[_0x50e8('0xa5')][_0x50e8('0xe6')](_0x3d1f34,{'transaction':_0x1d1cbd});});}else{_0x429fa1=0x194;_0x2094cf=[];}});})[_0x50e8('0x2b')](function(){if(_0x429fa1!==0x194){return db[_0x50e8('0xa5')][_0x50e8('0x11e')]({'where':{'ChatWebsiteId':_0x36889e},'order':'priority'})[_0x50e8('0x2b')](function(_0x1b52c2){_0x2094cf=_0x1b52c2;});}})[_0x50e8('0x20')](function(_0x2d3bf6){_0x429fa1=0x1f4;logger[_0x50e8('0x1e')](_0x2d3bf6[_0x50e8('0x30')]);if(_0x2d3bf6[_0x50e8('0x31')]){delete _0x2d3bf6[_0x50e8('0x31')];}_0x2094cf=_0x2d3bf6;})['finally'](function(){if(_0x2094cf===null){_0x346072[_0x50e8('0x21')](_0x429fa1);}else{if(_0x429fa1===0x1f4){_0x346072['status'](_0x429fa1)[_0x50e8('0x32')](_0x2094cf);}else{_0x346072[_0x50e8('0x22')](_0x429fa1)['json'](_0x2094cf);}}});};exports[_0x50e8('0x11f')]=function(_0x5f25d9,_0x242212){var _0x37cfaa={};var _0x280e4d={};var _0x21106a;var _0x46aa04;return db[_0x50e8('0x4a')][_0x50e8('0xfe')]({'where':{'id':_0x5f25d9['params']['id']}})[_0x50e8('0x2b')](handleEntityNotFound(_0x242212,null))['then'](function(_0x1c3d12){if(_0x1c3d12){_0x21106a=_0x1c3d12;_0x280e4d['model']=_['keys'](db[_0x50e8('0xa5')]['rawAttributes']);_0x280e4d[_0x50e8('0x4f')]=_[_0x50e8('0x50')](_0x5f25d9[_0x50e8('0x4f')]);_0x280e4d['filters']=_['intersection'](_0x280e4d[_0x50e8('0x44')],_0x280e4d['query']);_0x37cfaa[_0x50e8('0x54')]=_[_0x50e8('0x52')](_0x280e4d[_0x50e8('0x44')],qs['fields'](_0x5f25d9[_0x50e8('0x4f')][_0x50e8('0x53')]));_0x37cfaa[_0x50e8('0x54')]=_0x37cfaa[_0x50e8('0x54')][_0x50e8('0x55')]?_0x37cfaa['attributes']:_0x280e4d['model'];_0x37cfaa['order']=qs[_0x50e8('0x58')](_0x5f25d9[_0x50e8('0x4f')][_0x50e8('0x58')]);_0x37cfaa[_0x50e8('0x59')]=qs[_0x50e8('0x51')](_[_0x50e8('0x5a')](_0x5f25d9['query'],_0x280e4d[_0x50e8('0x51')]));if(_0x5f25d9[_0x50e8('0x4f')]['filter']){_0x37cfaa[_0x50e8('0x59')]=_[_0x50e8('0x5b')](_0x37cfaa['where'],{'$or':_[_0x50e8('0x4e')](_0x37cfaa['attributes'],function(_0x3aefea){var _0x174121={};_0x174121[_0x3aefea]={'$like':'%'+_0x5f25d9[_0x50e8('0x4f')][_0x50e8('0x5c')]+'%'};return _0x174121;})});}_0x37cfaa=_[_0x50e8('0x5b')]({},_0x37cfaa,_0x5f25d9[_0x50e8('0x5d')]);return _0x21106a['getApplications'](_0x37cfaa);}})['then'](function(_0x41c881){if(_0x41c881){_0x46aa04=_0x41c881['length'];if(!_0x5f25d9[_0x50e8('0x4f')][_0x50e8('0x56')](_0x50e8('0x57'))){_0x37cfaa[_0x50e8('0x24')]=qs[_0x50e8('0x24')](_0x5f25d9['query'][_0x50e8('0x24')]);_0x37cfaa[_0x50e8('0x23')]=qs[_0x50e8('0x23')](_0x5f25d9[_0x50e8('0x4f')]['offset']);}return _0x21106a[_0x50e8('0x11f')](_0x37cfaa);}})[_0x50e8('0x2b')](function(_0x4a73e9){if(_0x4a73e9){return _0x4a73e9?{'count':_0x46aa04,'rows':_0x4a73e9}:null;}})[_0x50e8('0x2b')](respondWithResult(_0x242212,null))[_0x50e8('0x20')](handleError(_0x242212,null));};exports[_0x50e8('0x120')]=function(_0x1beccc,_0x3a5324){return db[_0x50e8('0x121')]['find']({'where':{'id':_0x1beccc[_0x50e8('0x60')]['id']}})[_0x50e8('0x2b')](handleEntityNotFound(_0x3a5324,null))['then'](function(_0x525bf8){if(_0x525bf8){return _0x525bf8[_0x50e8('0x120')](_0x1beccc[_0x50e8('0x66')][_0x50e8('0x7d')],_['omit'](_0x1beccc['body'],['ids','id'])||{});}})[_0x50e8('0x2b')](respondWithResult(_0x3a5324,null))['catch'](handleError(_0x3a5324,null));};exports[_0x50e8('0x107')]=function(_0x12ea11,_0x19ca64){var _0x24a442={};var _0x407740={};var _0x3b0fe6;var _0x24108a;return db[_0x50e8('0x4a')]['findOne']({'where':{'id':_0x12ea11[_0x50e8('0x60')]['id']}})[_0x50e8('0x2b')](handleEntityNotFound(_0x19ca64,null))['then'](function(_0x3dadb3){if(_0x3dadb3){_0x3b0fe6=_0x3dadb3;_0x407740[_0x50e8('0x44')]=_[_0x50e8('0x50')](db[_0x50e8('0x122')][_0x50e8('0x4b')]);_0x407740[_0x50e8('0x4f')]=_[_0x50e8('0x50')](_0x12ea11['query']);_0x407740[_0x50e8('0x51')]=_[_0x50e8('0x52')](_0x407740[_0x50e8('0x44')],_0x407740[_0x50e8('0x4f')]);_0x24a442[_0x50e8('0x54')]=_['intersection'](_0x407740['model'],qs[_0x50e8('0x53')](_0x12ea11[_0x50e8('0x4f')]['fields']));_0x24a442[_0x50e8('0x54')]=_0x24a442[_0x50e8('0x54')][_0x50e8('0x55')]?_0x24a442['attributes']:_0x407740[_0x50e8('0x44')];_0x24a442['order']=qs['sort'](_0x12ea11[_0x50e8('0x4f')][_0x50e8('0x58')]);_0x24a442[_0x50e8('0x59')]=qs['filters'](_[_0x50e8('0x5a')](_0x12ea11[_0x50e8('0x4f')],_0x407740[_0x50e8('0x51')]));if(_0x12ea11['query'][_0x50e8('0x5c')]){_0x24a442[_0x50e8('0x59')]=_[_0x50e8('0x5b')](_0x24a442[_0x50e8('0x59')],{'$or':_['map'](_0x24a442[_0x50e8('0x54')],function(_0x48a100){var _0x784fca={};_0x784fca[_0x48a100]={'$like':'%'+_0x12ea11[_0x50e8('0x4f')][_0x50e8('0x5c')]+'%'};return _0x784fca;})});}_0x24a442=_[_0x50e8('0x5b')]({},_0x24a442,_0x12ea11[_0x50e8('0x5d')]);return _0x3b0fe6['getProactiveActions'](_0x24a442);}})[_0x50e8('0x2b')](function(_0x12d822){if(_0x12d822){_0x24108a=_0x12d822['length'];if(!_0x12ea11[_0x50e8('0x4f')][_0x50e8('0x56')]('nolimit')){_0x24a442[_0x50e8('0x24')]=qs['limit'](_0x12ea11['query'][_0x50e8('0x24')]);_0x24a442['offset']=qs[_0x50e8('0x23')](_0x12ea11['query'][_0x50e8('0x23')]);}return _0x3b0fe6['getProactiveActions'](_0x24a442);}})[_0x50e8('0x2b')](function(_0x349895){if(_0x349895){return _0x349895?{'count':_0x24108a,'rows':_0x349895}:null;}})[_0x50e8('0x2b')](respondWithResult(_0x19ca64,null))[_0x50e8('0x20')](handleError(_0x19ca64,null));};exports['getFields']=function(_0x4bd679,_0x19a2d1){var _0x38a275=_0x4bd679['query']['online']==='false'?_0x50e8('0x123'):_0x50e8('0x124');return db[_0x50e8('0x4a')][_0x50e8('0x6b')]({'attributes':['id',_0x38a275],'where':{'id':_0x4bd679[_0x50e8('0x60')]['id']}})[_0x50e8('0x2b')](handleEntityNotFound(_0x19a2d1,null))[_0x50e8('0x2b')](function(_0x47b64b){if(_0x47b64b){var _0x3eda59=_0x47b64b[_0x38a275];var _0x5f1843=_0x3eda59&&_0x3eda59['items']?_0x3eda59[_0x50e8('0x125')]:[];_0x19a2d1[_0x50e8('0x32')]({'fromKey':_['isNil'](_0x3eda59[_0x50e8('0x126')])?undefined:_0x3eda59[_0x50e8('0x126')],'count':_0x5f1843[_0x50e8('0x55')],'rows':_0x5f1843});}})[_0x50e8('0x20')](handleError(_0x19a2d1,null));};exports[_0x50e8('0x127')]=function(_0x4ffc03,_0x56f592){var _0xc2ca3b={'raw':![],'where':{}};var _0x446d27={};var _0x1ae92e={'count':0x0,'rows':[]};return db[_0x50e8('0x4a')]['findOne']({'where':{'id':_0x4ffc03[_0x50e8('0x60')]['id']}})[_0x50e8('0x2b')](handleEntityNotFound(_0x56f592,null))[_0x50e8('0x2b')](function(_0x3400f2){if(_0x3400f2){_0x446d27[_0x50e8('0x44')]=_[_0x50e8('0x50')](db[_0x50e8('0xde')][_0x50e8('0x4b')]);_0x446d27[_0x50e8('0x4f')]=_[_0x50e8('0x50')](_0x4ffc03[_0x50e8('0x4f')]);_0x446d27[_0x50e8('0x51')]=_[_0x50e8('0x52')](_0x446d27[_0x50e8('0x44')],_0x446d27[_0x50e8('0x4f')]);_0xc2ca3b['attributes']=_[_0x50e8('0x52')](_0x446d27[_0x50e8('0x44')],qs[_0x50e8('0x53')](_0x4ffc03['query'][_0x50e8('0x53')]));_0xc2ca3b[_0x50e8('0x54')]=_0xc2ca3b[_0x50e8('0x54')][_0x50e8('0x55')]?_0xc2ca3b[_0x50e8('0x54')]:_0x446d27[_0x50e8('0x44')];if(!_0x4ffc03[_0x50e8('0x4f')][_0x50e8('0x56')](_0x50e8('0x57'))){_0xc2ca3b['limit']=qs[_0x50e8('0x24')](_0x4ffc03['query'][_0x50e8('0x24')]);_0xc2ca3b[_0x50e8('0x23')]=qs[_0x50e8('0x23')](_0x4ffc03[_0x50e8('0x4f')]['offset']);}_0xc2ca3b[_0x50e8('0x74')]=qs[_0x50e8('0x58')](_0x4ffc03[_0x50e8('0x4f')][_0x50e8('0x58')]);_0xc2ca3b['where']=qs[_0x50e8('0x51')](_[_0x50e8('0x5a')](_0x4ffc03['query'],_0x446d27[_0x50e8('0x51')]));_0xc2ca3b[_0x50e8('0x59')][_0x50e8('0x72')]=_0x3400f2['id'];if(_0x4ffc03[_0x50e8('0x4f')][_0x50e8('0x5c')]){_0xc2ca3b[_0x50e8('0x59')]=_[_0x50e8('0x5b')](_0xc2ca3b[_0x50e8('0x59')],{'$or':_[_0x50e8('0x4e')](_0xc2ca3b['attributes'],function(_0x27b2c5){var _0x38ba5d={};_0x38ba5d[_0x27b2c5]={'$like':'%'+_0x4ffc03['query'][_0x50e8('0x5c')]+'%'};return _0x38ba5d;})});}_0xc2ca3b=_[_0x50e8('0x5b')]({},_0xc2ca3b,_0x4ffc03[_0x50e8('0x5d')]);return db[_0x50e8('0xde')][_0x50e8('0x26')]({'where':_0xc2ca3b[_0x50e8('0x59')]})['then'](function(_0x3c6795){_0x1ae92e['count']=_0x3c6795;if(_0x4ffc03[_0x50e8('0x4f')][_0x50e8('0x75')]){_0xc2ca3b['include']=[{'all':!![]}];}else{_0xc2ca3b['include']=[{'model':db[_0x50e8('0x9b')],'as':_0x50e8('0xff'),'required':![]},{'model':db[_0x50e8('0x128')],'as':_0x50e8('0x129'),'required':![]}];}return db[_0x50e8('0xde')][_0x50e8('0x7b')](_0xc2ca3b);})[_0x50e8('0x2b')](function(_0x47769c){_0x1ae92e['rows']=_0x47769c;return _0x1ae92e;});}})[_0x50e8('0x2b')](respondWithFilteredResult(_0x56f592,_0xc2ca3b))[_0x50e8('0x20')](handleError(_0x56f592,null));};exports[_0x50e8('0x12a')]=function(_0x45ca98,_0x3c0c54){return db[_0x50e8('0x4a')]['find']({'where':{'id':_0x45ca98[_0x50e8('0x60')]['id']}})[_0x50e8('0x2b')](handleEntityNotFound(_0x3c0c54,null))[_0x50e8('0x2b')](function(_0x243638){if(_0x243638){return _0x243638['addAgents'](_0x45ca98[_0x50e8('0x66')]['ids'],_[_0x50e8('0xfd')](_0x45ca98['body'],[_0x50e8('0x7d'),'id'])||{})['spread'](function(_0x5eac76){for(var _0x885e6f=0x0;_0x885e6f<_0x45ca98[_0x50e8('0x66')]['ids'][_0x50e8('0x55')];_0x885e6f+=0x1){socket[_0x50e8('0x12b')](_0x50e8('0x12c'),{'UserId':Number(_0x45ca98['body'][_0x50e8('0x7d')][_0x885e6f]),'ChatWebsiteId':Number(_0x45ca98['params']['id'])});}return _0x5eac76;});}})['then'](respondWithResult(_0x3c0c54,null))[_0x50e8('0x20')](handleError(_0x3c0c54,null));};exports[_0x50e8('0x12d')]=function(_0x316ff6,_0x271bc3){return db['ChatWebsite'][_0x50e8('0x6b')]({'where':{'id':_0x316ff6[_0x50e8('0x60')]['id']}})[_0x50e8('0x2b')](handleEntityNotFound(_0x271bc3,null))[_0x50e8('0x2b')](function(_0x2aecb0){if(_0x2aecb0){return _0x2aecb0['removeAgents'](_0x316ff6[_0x50e8('0x4f')][_0x50e8('0x7d')])[_0x50e8('0x2b')](function(){if(_[_0x50e8('0x12e')](_0x316ff6[_0x50e8('0x4f')]['ids'])){for(var _0x2b9df0=0x0;_0x2b9df0<_0x316ff6['query'][_0x50e8('0x7d')][_0x50e8('0x55')];_0x2b9df0+=0x1){socket['emit'](_0x50e8('0x12f'),{'UserId':Number(_0x316ff6['query'][_0x50e8('0x7d')][_0x2b9df0]),'ChatWebsiteId':Number(_0x316ff6[_0x50e8('0x60')]['id'])});}}else{socket[_0x50e8('0x12b')](_0x50e8('0x12f'),{'UserId':Number(_0x316ff6[_0x50e8('0x4f')][_0x50e8('0x7d')]),'ChatWebsiteId':Number(_0x316ff6[_0x50e8('0x60')]['id'])});}});}})[_0x50e8('0x2b')](respondWithStatusCode(_0x271bc3,null))[_0x50e8('0x20')](handleError(_0x271bc3,null));};exports[_0x50e8('0x130')]=function(_0x167951,_0x507df4){var _0xa53e97={};var _0x4f34f2={};var _0x528da7;var _0x456f17;return db[_0x50e8('0x4a')][_0x50e8('0xfe')]({'where':{'id':_0x167951[_0x50e8('0x60')]['id']}})[_0x50e8('0x2b')](handleEntityNotFound(_0x507df4,null))['then'](function(_0x3edbc6){if(_0x3edbc6){_0x528da7=_0x3edbc6;_0x4f34f2[_0x50e8('0x44')]=_['keys'](db[_0x50e8('0x100')][_0x50e8('0x4b')]);_0x4f34f2['query']=_[_0x50e8('0x50')](_0x167951[_0x50e8('0x4f')]);_0x4f34f2[_0x50e8('0x51')]=_[_0x50e8('0x52')](_0x4f34f2[_0x50e8('0x44')],_0x4f34f2[_0x50e8('0x4f')]);_0xa53e97[_0x50e8('0x54')]=_[_0x50e8('0x52')](_0x4f34f2[_0x50e8('0x44')],qs[_0x50e8('0x53')](_0x167951[_0x50e8('0x4f')][_0x50e8('0x53')]));_0xa53e97['attributes']=_0xa53e97[_0x50e8('0x54')][_0x50e8('0x55')]?_0xa53e97[_0x50e8('0x54')]:_0x4f34f2[_0x50e8('0x44')];_0xa53e97[_0x50e8('0x74')]=qs['sort'](_0x167951[_0x50e8('0x4f')]['sort']);_0xa53e97[_0x50e8('0x59')]=qs[_0x50e8('0x51')](_['pick'](_0x167951[_0x50e8('0x4f')],_0x4f34f2[_0x50e8('0x51')]));if(_0x167951[_0x50e8('0x4f')][_0x50e8('0x5c')]){_0xa53e97[_0x50e8('0x59')]=_[_0x50e8('0x5b')](_0xa53e97[_0x50e8('0x59')],{'$or':_[_0x50e8('0x4e')](_0xa53e97[_0x50e8('0x54')],function(_0x8d3f42){var _0x5417cb={};_0x5417cb[_0x8d3f42]={'$like':'%'+_0x167951[_0x50e8('0x4f')][_0x50e8('0x5c')]+'%'};return _0x5417cb;})});}_0xa53e97=_[_0x50e8('0x5b')]({},_0xa53e97,_0x167951['options']);return _0x528da7[_0x50e8('0x130')](_0xa53e97);}})['then'](function(_0x33f480){if(_0x33f480){_0x456f17=_0x33f480['length'];if(!_0x167951[_0x50e8('0x4f')][_0x50e8('0x56')](_0x50e8('0x57'))){_0xa53e97[_0x50e8('0x24')]=qs[_0x50e8('0x24')](_0x167951['query'][_0x50e8('0x24')]);_0xa53e97[_0x50e8('0x23')]=qs[_0x50e8('0x23')](_0x167951[_0x50e8('0x4f')][_0x50e8('0x23')]);}return _0x528da7[_0x50e8('0x130')](_0xa53e97);}})[_0x50e8('0x2b')](function(_0x2cd184){if(_0x2cd184){return _0x2cd184?{'count':_0x456f17,'rows':_0x2cd184}:null;}})['then'](respondWithResult(_0x507df4,null))[_0x50e8('0x20')](handleError(_0x507df4,null));}; \ No newline at end of file +var _0xb138=['getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','Interval','resolve','timezone','chat','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','CmContact','createdAt','updatedAt','includes','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','from','List','Contacts','DESC','ChatApplication','Applications','Intervals','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','asc','list','ListId','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','autoclose','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','EventManager','notify','offline','Sequelize','no\x20available\x20attributes','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','ValidationError','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','ChatOfflineMessage','fromString','originalname','server','files','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Smtp','user','MailAccountId','mimetype','toPairsIn','mapValues','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','ids','omit','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','interval','getProactiveActions','virtual','License','ifTime','readFileSync','server/files/chat/iframe.ejs','3.13.0','origin','http://localhost:9000','testWebsiteWithWildcard','remote','x-real-ip','connection','remoteAddress','render','alignment','verticalAlignment','labelText','textButtonColor','color_button','READ_COMMITTED','findAndCountAll','stack','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','jayson/promise','../../components/parsers/qs','api','../../config/environment','APIBadRequestError','../../errors/api','APINotFoundError','APIOutOfIntervalError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','http','client','request','then','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','update','destroy','get','ChatWebsites','UserProfileResource','name','send','setUA','getResult','customerIp','cf-connecting-ip','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','model','vendor','%s\x20%s\x20%s','type','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','Pause','find','create','address','split','forEach','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','getLogo','root','../../config/license/util','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar'];(function(_0x64b2e1,_0x4b12fe){var _0x1ca8cd=function(_0x38992b){while(--_0x38992b){_0x64b2e1['push'](_0x64b2e1['shift']());}};_0x1ca8cd(++_0x4b12fe);}(_0xb138,0x1dd));var _0x8b13=function(_0x3df38b,_0x46223e){_0x3df38b=_0x3df38b-0x0;var _0x5e5e22=_0xb138[_0x3df38b];return _0x5e5e22;};'use strict';var Mustache=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var ejs=require(_0x8b13('0x3'));var fs=require('fs');var fs_extra=require(_0x8b13('0x4'));var _=require(_0x8b13('0x5'));var querystring=require(_0x8b13('0x6'));var htmlToText=require('html-to-text');var Redis=require(_0x8b13('0x7'));var jayson=require(_0x8b13('0x8'));var qs=require(_0x8b13('0x9'));var logger=require('../../config/logger')(_0x8b13('0xa'));var config=require(_0x8b13('0xb'));var APIBadRequestError=require('../../errors/api')[_0x8b13('0xc')];var APINotFoundError=require(_0x8b13('0xd'))[_0x8b13('0xe')];var APIOutOfIntervalError=require('../../errors/api')[_0x8b13('0xf')];var APIHandleError=require(_0x8b13('0xd'))['handleError'];var APIConflictError=require('../../errors/api')[_0x8b13('0x10')];var wildcardUtils=require(_0x8b13('0x11'));var URL=require(_0x8b13('0x12'))[_0x8b13('0x13')];var db=require(_0x8b13('0x14'))['db'];config['redis']=_[_0x8b13('0x15')](config[_0x8b13('0x16')],{'host':_0x8b13('0x17'),'port':0x18eb});var socket=require(_0x8b13('0x18'))(new Redis(config[_0x8b13('0x16')]));require(_0x8b13('0x19'))['register'](socket);var client=jayson['client'][_0x8b13('0x1a')]({'port':0x232c});var client9002=jayson[_0x8b13('0x1b')]['http']({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson[_0x8b13('0x1b')][_0x8b13('0x1a')]({'port':0x2329});function respondWithRpcPromise(_0xf29086,_0x2c615a,_0x13f956,_0x542357){return new Promise(function(_0x1c6c99,_0xea7881){var _0x393bc1=_0x542357||client;return _0x393bc1[_0x8b13('0x1c')](_0xf29086,_0x13f956)[_0x8b13('0x1d')](function(_0x1fcfe6){logger[_0x8b13('0x1e')](_0x8b13('0x1f'),_0x2c615a,'request\x20sent');logger['debug'](_0x8b13('0x20'),_0x2c615a,_0x8b13('0x21'),JSON[_0x8b13('0x22')](_0x1fcfe6));if(_0x1fcfe6[_0x8b13('0x23')]){if(_0x1fcfe6[_0x8b13('0x23')][_0x8b13('0x24')]===0x1f4){logger['error'](_0x8b13('0x1f'),_0x2c615a,_0x1fcfe6[_0x8b13('0x23')][_0x8b13('0x25')]);return _0xea7881(_0x1fcfe6['error']['message']);}logger[_0x8b13('0x23')](_0x8b13('0x1f'),_0x2c615a,_0x1fcfe6['error'][_0x8b13('0x25')]);return _0x1c6c99(_0x1fcfe6[_0x8b13('0x23')][_0x8b13('0x25')]);}else{logger[_0x8b13('0x1e')](_0x8b13('0x1f'),_0x2c615a,'request\x20sent');_0x1c6c99(_0x1fcfe6[_0x8b13('0x26')][_0x8b13('0x25')]);}})['catch'](function(_0x33422f){logger['error'](_0x8b13('0x1f'),_0x2c615a,_0x33422f);_0xea7881(_0x33422f);});});}function respondWithStatusCode(_0x325d68,_0x54786a){_0x54786a=_0x54786a||0xcc;return function(_0x3f1756){if(_0x3f1756){return _0x325d68[_0x8b13('0x27')](_0x54786a);}return _0x325d68['status'](_0x54786a)[_0x8b13('0x28')]();};}function respondWithResult(_0x14a739,_0x410122){_0x410122=_0x410122||0xc8;return function(_0x4048e4){if(_0x4048e4){return _0x14a739[_0x8b13('0x29')](_0x410122)['json'](_0x4048e4);}};}function respondWithFilteredResult(_0x6023f5,_0x1b09e2){return function(_0x3475d8){if(_0x3475d8){var _0x1511bf=typeof _0x1b09e2[_0x8b13('0x2a')]===_0x8b13('0x2b')&&typeof _0x1b09e2['limit']===_0x8b13('0x2b');var _0xfec033=_0x3475d8[_0x8b13('0x2c')];var _0x9d2377=_0x1511bf?0x0:_0x1b09e2[_0x8b13('0x2a')];var _0x29946e=_0x1511bf?_0x3475d8[_0x8b13('0x2c')]:_0x1b09e2[_0x8b13('0x2a')]+_0x1b09e2[_0x8b13('0x2d')];var _0x5751db;if(_0x29946e>=_0xfec033){_0x29946e=_0xfec033;_0x5751db=0xc8;}else{_0x5751db=0xce;}_0x6023f5[_0x8b13('0x29')](_0x5751db);return _0x6023f5[_0x8b13('0x2e')](_0x8b13('0x2f'),_0x9d2377+'-'+_0x29946e+'/'+_0xfec033)[_0x8b13('0x30')](_0x3475d8);}return null;};}function saveUpdates(_0x51a334){return function(_0x4f7d91){if(_0x4f7d91){return _0x4f7d91[_0x8b13('0x31')](_0x51a334)['then'](function(_0x5663fa){return _0x5663fa;});}return null;};}function removeEntity(_0x3b1dfa){return function(_0x535521){if(_0x535521){return _0x535521[_0x8b13('0x32')]()[_0x8b13('0x1d')](function(){var _0x40fc29=_0x535521[_0x8b13('0x33')]({'plain':!![]});var _0x11657e=_0x8b13('0x34');return db[_0x8b13('0x35')][_0x8b13('0x32')]({'where':{'type':_0x11657e,'resourceId':_0x40fc29['id']}})[_0x8b13('0x1d')](function(){return _0x535521;});})[_0x8b13('0x1d')](function(){_0x3b1dfa['status'](0xcc)[_0x8b13('0x28')]();});}};}function handleEntityNotFound(_0x31f5bd){return function(_0x19b21c){if(!_0x19b21c){_0x31f5bd[_0x8b13('0x27')](0x194);}return _0x19b21c;};}function handleError(_0x1ff25c,_0x24179a){_0x24179a=_0x24179a||0x1f4;return function(_0x6b4645){logger[_0x8b13('0x23')](_0x6b4645['stack']);if(_0x6b4645[_0x8b13('0x36')]){delete _0x6b4645['name'];}_0x1ff25c[_0x8b13('0x29')](_0x24179a)[_0x8b13('0x37')](_0x6b4645);};}function createInteractionObject(_0x2a8f6b,_0x5e63f6,_0x2bf1b0,_0x327eb1){var _0x4ec1a5=require('user-agent-parser');var _0xe6963d=new _0x4ec1a5();var _0x5daee9=_0xe6963d[_0x8b13('0x38')](_0x2bf1b0['user-agent'])[_0x8b13('0x39')]();var _0x3a8e06=_0x5e63f6[_0x8b13('0x3a')];if(_0x2bf1b0[_0x8b13('0x3b')]){_0x3a8e06=_0x2bf1b0[_0x8b13('0x3b')];}else if(_0x2bf1b0['x-forwarded-for']){_0x3a8e06=_['first'](_0x2bf1b0[_0x8b13('0x3c')]['split'](','));}return{'ContactId':_0x327eb1['id'],'ChatWebsiteId':_0x2a8f6b,'from':(_0x327eb1[_0x8b13('0x3d')]||'')+'\x20'+(_0x327eb1[_0x8b13('0x3e')]||''),'customerIp':_0x3a8e06,'customerPort':_0x2bf1b0['x-real-port']?_0x2bf1b0[_0x8b13('0x3f')]:null,'referer':_0x5e63f6[_0x8b13('0x40')],'browserName':_0x5daee9[_0x8b13('0x41')][_0x8b13('0x36')]&&_0x5daee9[_0x8b13('0x41')][_0x8b13('0x42')]?util[_0x8b13('0x43')]('%s\x20%s',_0x5daee9['browser']['name'],_0x5daee9[_0x8b13('0x41')][_0x8b13('0x42')]):_0x8b13('0x44'),'browserVersion':_0x5daee9[_0x8b13('0x41')][_0x8b13('0x42')]||_0x8b13('0x44'),'osName':util['format'](_0x8b13('0x45'),_0x5daee9['os']['name'],_0x5daee9['os'][_0x8b13('0x42')]),'osVersion':_0x5daee9['os']['version'],'deviceModel':_0x5daee9[_0x8b13('0x46')][_0x8b13('0x47')]&&_0x5daee9[_0x8b13('0x46')][_0x8b13('0x48')]?util[_0x8b13('0x43')](_0x8b13('0x49'),_0x5daee9[_0x8b13('0x46')]['model'],_0x5daee9['device']['vendor'],_0x5daee9[_0x8b13('0x46')][_0x8b13('0x4a')]):null,'deviceVendor':_0x5daee9[_0x8b13('0x46')][_0x8b13('0x48')],'deviceType':_0x5daee9['device']['type'],'formData':JSON[_0x8b13('0x22')](_0x5e63f6)};}exports['index']=function(_0x24262a,_0x10928d){var _0x20c363={'include':[{'model':db['Pause'],'as':_0x8b13('0x4b')}]},_0x28ae75={},_0x46556f={'count':0x0,'rows':[]};var _0x2044fc=_[_0x8b13('0x4c')](db[_0x8b13('0x4d')][_0x8b13('0x4e')],function(_0x2619df){return{'name':_0x2619df[_0x8b13('0x4f')],'type':_0x2619df[_0x8b13('0x4a')][_0x8b13('0x50')]};});_0x28ae75['model']=_[_0x8b13('0x4c')](_0x2044fc,'name');_0x28ae75[_0x8b13('0x51')]=_[_0x8b13('0x52')](_0x24262a[_0x8b13('0x51')]);_0x28ae75['filters']=_[_0x8b13('0x53')](_0x28ae75[_0x8b13('0x47')],_0x28ae75[_0x8b13('0x51')]);_0x20c363[_0x8b13('0x54')]=_[_0x8b13('0x53')](_0x28ae75[_0x8b13('0x47')],qs[_0x8b13('0x55')](_0x24262a['query'][_0x8b13('0x55')]));_0x20c363['attributes']=_0x20c363[_0x8b13('0x54')][_0x8b13('0x56')]?_0x20c363[_0x8b13('0x54')]:_0x28ae75[_0x8b13('0x47')];if(!_0x24262a[_0x8b13('0x51')][_0x8b13('0x57')](_0x8b13('0x58'))){_0x20c363[_0x8b13('0x2d')]=qs[_0x8b13('0x2d')](_0x24262a[_0x8b13('0x51')][_0x8b13('0x2d')]);_0x20c363[_0x8b13('0x2a')]=qs[_0x8b13('0x2a')](_0x24262a[_0x8b13('0x51')][_0x8b13('0x2a')]);}_0x20c363[_0x8b13('0x59')]=qs[_0x8b13('0x5a')](_0x24262a['query'][_0x8b13('0x5a')]);_0x20c363[_0x8b13('0x5b')]=qs['filters'](_[_0x8b13('0x5c')](_0x24262a[_0x8b13('0x51')],_0x28ae75[_0x8b13('0x5d')]),_0x2044fc);if(_0x24262a[_0x8b13('0x51')][_0x8b13('0x5e')]){_0x20c363[_0x8b13('0x5b')]=_[_0x8b13('0x5f')](_0x20c363[_0x8b13('0x5b')],{'$or':_[_0x8b13('0x4c')](_0x2044fc,function(_0x1ff311){if(_0x1ff311[_0x8b13('0x4a')]!==_0x8b13('0x60')){var _0x137e8c={};_0x137e8c[_0x1ff311[_0x8b13('0x36')]]={'$like':'%'+_0x24262a[_0x8b13('0x51')]['filter']+'%'};return _0x137e8c;}})});}_0x20c363=_[_0x8b13('0x5f')]({},_0x20c363,_0x24262a[_0x8b13('0x61')]);var _0x47a3fa={'where':_0x20c363[_0x8b13('0x5b')]};return db[_0x8b13('0x4d')][_0x8b13('0x2c')](_0x47a3fa)[_0x8b13('0x1d')](function(_0x1263f4){_0x46556f['count']=_0x1263f4;if(_0x24262a[_0x8b13('0x51')][_0x8b13('0x62')]){_0x20c363[_0x8b13('0x63')]=[{'all':!![]}];}return db['ChatWebsite'][_0x8b13('0x64')](_0x20c363);})[_0x8b13('0x1d')](function(_0x585392){_0x46556f[_0x8b13('0x65')]=_0x585392;return _0x46556f;})[_0x8b13('0x1d')](respondWithFilteredResult(_0x10928d,_0x20c363))[_0x8b13('0x66')](handleError(_0x10928d,null));};exports[_0x8b13('0x67')]=function(_0x49e5cd,_0x13c8bd){var _0x28d568={'raw':![],'where':{'id':_0x49e5cd[_0x8b13('0x68')]['id']},'include':[{'model':db[_0x8b13('0x69')],'as':_0x8b13('0x4b')}]},_0x52e705={};_0x52e705[_0x8b13('0x47')]=_['keys'](db[_0x8b13('0x4d')][_0x8b13('0x4e')]);_0x52e705[_0x8b13('0x51')]=_[_0x8b13('0x52')](_0x49e5cd[_0x8b13('0x51')]);_0x52e705[_0x8b13('0x5d')]=_['intersection'](_0x52e705[_0x8b13('0x47')],_0x52e705[_0x8b13('0x51')]);_0x28d568[_0x8b13('0x54')]=_['intersection'](_0x52e705[_0x8b13('0x47')],qs[_0x8b13('0x55')](_0x49e5cd[_0x8b13('0x51')][_0x8b13('0x55')]));_0x28d568['attributes']=_0x28d568['attributes']['length']?_0x28d568['attributes']:_0x52e705['model'];if(_0x49e5cd[_0x8b13('0x51')][_0x8b13('0x62')]){_0x28d568['include']=[{'all':!![]}];}_0x28d568=_[_0x8b13('0x5f')]({},_0x28d568,_0x49e5cd['options']);return db[_0x8b13('0x4d')][_0x8b13('0x6a')](_0x28d568)[_0x8b13('0x1d')](handleEntityNotFound(_0x13c8bd,null))[_0x8b13('0x1d')](respondWithResult(_0x13c8bd,null))[_0x8b13('0x66')](handleError(_0x13c8bd,null));};exports[_0x8b13('0x6b')]=function(_0xa7c7d5,_0x4c433c){var _0xe7e8eb=null;_0xa7c7d5['body'][_0x8b13('0x6c')][_0x8b13('0x6d')](',')[_0x8b13('0x6e')](_0x11a4ba=>{if(_0x11a4ba[_0x8b13('0x6f')]()!==''&&!wildcardUtils[_0x8b13('0x70')](_0x11a4ba[_0x8b13('0x6f')]())){_0xe7e8eb=new APIBadRequestError('\x22'+_0x11a4ba['trim']()+_0x8b13('0x71'));}});if(_0xe7e8eb){return handleError(_0x4c433c,null)(_0xe7e8eb);}return db['ChatWebsite'][_0x8b13('0x6b')](_0xa7c7d5[_0x8b13('0x72')],{})[_0x8b13('0x1d')](function(_0x177f73){var _0x177a64=_0xa7c7d5['user']['get']({'plain':!![]});if(!_0x177a64)throw new Error(_0x8b13('0x73'));if(_0x177a64[_0x8b13('0x74')]==='user'){var _0x180866=_0x177f73[_0x8b13('0x33')]({'plain':!![]});var _0x670b3e='ChatWebsites';return db[_0x8b13('0x75')][_0x8b13('0x6a')]({'where':{'name':_0x670b3e,'userProfileId':_0x177a64[_0x8b13('0x76')]},'raw':!![]})[_0x8b13('0x1d')](function(_0x52850c){if(_0x52850c&&_0x52850c[_0x8b13('0x77')]===0x0){return db[_0x8b13('0x35')]['create']({'name':_0x180866[_0x8b13('0x36')],'resourceId':_0x180866['id'],'type':_0x52850c[_0x8b13('0x36')],'sectionId':_0x52850c['id']},{})[_0x8b13('0x1d')](function(){return _0x177f73;});}else{return _0x177f73;}})[_0x8b13('0x66')](function(_0x45fe23){logger[_0x8b13('0x23')](_0x8b13('0x78'),_0x45fe23);throw _0x45fe23;});}return _0x177f73;})[_0x8b13('0x1d')](respondWithResult(_0x4c433c,0xc9))[_0x8b13('0x66')](handleError(_0x4c433c,null));};exports[_0x8b13('0x31')]=function(_0x2f2bc5,_0x46c25c){var _0x26b888=null;_0x2f2bc5[_0x8b13('0x72')]['address'][_0x8b13('0x6d')](',')['forEach'](_0x14dee4=>{if(_0x14dee4[_0x8b13('0x6f')]()!==''&&!wildcardUtils[_0x8b13('0x70')](_0x14dee4[_0x8b13('0x6f')]())){_0x26b888=new APIBadRequestError('\x22'+_0x14dee4['trim']()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x26b888){return handleError(_0x46c25c,null)(_0x26b888);}if(_0x2f2bc5[_0x8b13('0x72')]['id']){delete _0x2f2bc5[_0x8b13('0x72')]['id'];}return db['ChatWebsite'][_0x8b13('0x6a')]({'where':{'id':_0x2f2bc5[_0x8b13('0x68')]['id']},'include':[{'model':db[_0x8b13('0x69')],'as':_0x8b13('0x4b')}]})[_0x8b13('0x1d')](handleEntityNotFound(_0x46c25c,null))[_0x8b13('0x1d')](saveUpdates(_0x2f2bc5[_0x8b13('0x72')],null))[_0x8b13('0x1d')](respondWithResult(_0x46c25c,null))[_0x8b13('0x66')](handleError(_0x46c25c,null));};exports[_0x8b13('0x32')]=function(_0x48fd36,_0x2a1fd3){return db[_0x8b13('0x4d')]['find']({'where':{'id':_0x48fd36[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x2a1fd3,null))['then'](removeEntity(_0x2a1fd3,null))[_0x8b13('0x66')](handleError(_0x2a1fd3,null));};exports[_0x8b13('0x79')]=function(_0x1f77b1,_0x1dce78){return db[_0x8b13('0x4d')][_0x8b13('0x79')]()[_0x8b13('0x1d')](respondWithResult(_0x1dce78,null))[_0x8b13('0x66')](handleError(_0x1dce78,null));};exports['addDisposition']=function(_0x2642b1,_0x213b43){if(_0x2642b1[_0x8b13('0x72')]['id']){delete _0x2642b1['body']['id'];}return db[_0x8b13('0x4d')]['find']({'where':{'id':_0x2642b1[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x213b43,null))[_0x8b13('0x1d')](function(_0x40fefa){if(_0x40fefa){_0x2642b1[_0x8b13('0x72')][_0x8b13('0x7a')]=_0x40fefa['id'];return db[_0x8b13('0x7b')][_0x8b13('0x6b')](_0x2642b1[_0x8b13('0x72')]);}})[_0x8b13('0x1d')](respondWithResult(_0x213b43,null))['catch'](handleError(_0x213b43,null));};exports[_0x8b13('0x7c')]=function(_0x111a4f,_0x235b61){var _0xc76c8b={'raw':![],'where':{}};var _0x15f169={};var _0x120a71={'count':0x0,'rows':[]};return db[_0x8b13('0x4d')][_0x8b13('0x7d')]({'where':{'id':_0x111a4f[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x235b61,null))[_0x8b13('0x1d')](function(_0x1819fb){if(_0x1819fb){_0x15f169[_0x8b13('0x47')]=_['keys'](db['Disposition'][_0x8b13('0x4e')]);_0x15f169['query']=_[_0x8b13('0x52')](_0x111a4f[_0x8b13('0x51')]);_0x15f169['filters']=_['intersection'](_0x15f169[_0x8b13('0x47')],_0x15f169[_0x8b13('0x51')]);_0xc76c8b[_0x8b13('0x54')]=_[_0x8b13('0x53')](_0x15f169[_0x8b13('0x47')],qs['fields'](_0x111a4f[_0x8b13('0x51')]['fields']));_0xc76c8b[_0x8b13('0x54')]=_0xc76c8b[_0x8b13('0x54')]['length']?_0xc76c8b[_0x8b13('0x54')]:_0x15f169[_0x8b13('0x47')];if(!_0x111a4f[_0x8b13('0x51')][_0x8b13('0x57')](_0x8b13('0x58'))){_0xc76c8b['limit']=qs[_0x8b13('0x2d')](_0x111a4f[_0x8b13('0x51')][_0x8b13('0x2d')]);_0xc76c8b['offset']=qs[_0x8b13('0x2a')](_0x111a4f['query'][_0x8b13('0x2a')]);}_0xc76c8b[_0x8b13('0x59')]=qs[_0x8b13('0x5a')](_0x111a4f[_0x8b13('0x51')][_0x8b13('0x5a')]);_0xc76c8b[_0x8b13('0x5b')]=qs[_0x8b13('0x5d')](_[_0x8b13('0x5c')](_0x111a4f[_0x8b13('0x51')],_0x15f169[_0x8b13('0x5d')]));_0xc76c8b['where'][_0x8b13('0x7a')]=_0x1819fb['id'];if(_0x111a4f[_0x8b13('0x51')][_0x8b13('0x5e')]){_0xc76c8b[_0x8b13('0x5b')]=_[_0x8b13('0x5f')](_0xc76c8b['where'],{'$or':_[_0x8b13('0x4c')](_0xc76c8b[_0x8b13('0x54')],function(_0x350441){var _0x10bf1a={};_0x10bf1a[_0x350441]={'$like':'%'+_0x111a4f[_0x8b13('0x51')][_0x8b13('0x5e')]+'%'};return _0x10bf1a;})});}_0xc76c8b=_['merge']({},_0xc76c8b,_0x111a4f[_0x8b13('0x61')]);return db[_0x8b13('0x7b')]['count']({'where':_0xc76c8b[_0x8b13('0x5b')]})['then'](function(_0x1e85eb){_0x120a71['count']=_0x1e85eb;if(_0x111a4f[_0x8b13('0x51')][_0x8b13('0x62')]){_0xc76c8b[_0x8b13('0x63')]=[{'all':!![]}];}return db[_0x8b13('0x7b')][_0x8b13('0x64')](_0xc76c8b);})[_0x8b13('0x1d')](function(_0x165813){_0x120a71[_0x8b13('0x65')]=_0x165813;return _0x120a71;});}})['then'](respondWithFilteredResult(_0x235b61,_0xc76c8b))[_0x8b13('0x66')](handleError(_0x235b61,null));};exports[_0x8b13('0x7e')]=function(_0x5f190a,_0x35c94d){return db[_0x8b13('0x4d')]['find']({'where':{'id':_0x5f190a[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x35c94d,null))[_0x8b13('0x1d')](function(_0x42de53){if(_0x42de53){return _0x42de53[_0x8b13('0x7e')](_0x5f190a['query']['ids']);}})[_0x8b13('0x1d')](respondWithStatusCode(_0x35c94d,null))[_0x8b13('0x66')](handleError(_0x35c94d,null));};exports[_0x8b13('0x7f')]=function(_0x36f3af,_0xcafeff){if(_0x36f3af[_0x8b13('0x72')]['id']){delete _0x36f3af[_0x8b13('0x72')]['id'];}return db[_0x8b13('0x4d')][_0x8b13('0x6a')]({'where':{'id':_0x36f3af[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0xcafeff,null))[_0x8b13('0x1d')](function(_0xf19be7){if(_0xf19be7){_0x36f3af[_0x8b13('0x72')][_0x8b13('0x7a')]=_0xf19be7['id'];return db[_0x8b13('0x80')]['create'](_0x36f3af[_0x8b13('0x72')]);}})['then'](respondWithResult(_0xcafeff,null))[_0x8b13('0x66')](handleError(_0xcafeff,null));};exports[_0x8b13('0x81')]=function(_0xeb3c0f,_0x394932){var _0x148dde={'raw':![],'where':{}};var _0x402c92={};var _0x7e200e={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x8b13('0x7d')]({'where':{'id':_0xeb3c0f['params']['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x394932,null))[_0x8b13('0x1d')](function(_0x4db508){if(_0x4db508){_0x402c92['model']=_[_0x8b13('0x52')](db[_0x8b13('0x80')][_0x8b13('0x4e')]);_0x402c92[_0x8b13('0x51')]=_[_0x8b13('0x52')](_0xeb3c0f[_0x8b13('0x51')]);_0x402c92['filters']=_[_0x8b13('0x53')](_0x402c92[_0x8b13('0x47')],_0x402c92['query']);_0x148dde['attributes']=_['intersection'](_0x402c92[_0x8b13('0x47')],qs[_0x8b13('0x55')](_0xeb3c0f[_0x8b13('0x51')][_0x8b13('0x55')]));_0x148dde[_0x8b13('0x54')]=_0x148dde[_0x8b13('0x54')][_0x8b13('0x56')]?_0x148dde[_0x8b13('0x54')]:_0x402c92['model'];if(!_0xeb3c0f[_0x8b13('0x51')]['hasOwnProperty'](_0x8b13('0x58'))){_0x148dde['limit']=qs[_0x8b13('0x2d')](_0xeb3c0f[_0x8b13('0x51')]['limit']);_0x148dde[_0x8b13('0x2a')]=qs[_0x8b13('0x2a')](_0xeb3c0f[_0x8b13('0x51')][_0x8b13('0x2a')]);}_0x148dde[_0x8b13('0x59')]=qs['sort'](_0xeb3c0f[_0x8b13('0x51')][_0x8b13('0x5a')]);_0x148dde[_0x8b13('0x5b')]=qs[_0x8b13('0x5d')](_['pick'](_0xeb3c0f[_0x8b13('0x51')],_0x402c92['filters']));_0x148dde[_0x8b13('0x5b')][_0x8b13('0x7a')]=_0x4db508['id'];if(_0xeb3c0f[_0x8b13('0x51')]['filter']){_0x148dde['where']=_['merge'](_0x148dde['where'],{'$or':_[_0x8b13('0x4c')](_0x148dde['attributes'],function(_0x390acb){var _0x4a32ea={};_0x4a32ea[_0x390acb]={'$like':'%'+_0xeb3c0f[_0x8b13('0x51')][_0x8b13('0x5e')]+'%'};return _0x4a32ea;})});}_0x148dde=_[_0x8b13('0x5f')]({},_0x148dde,_0xeb3c0f[_0x8b13('0x61')]);return db[_0x8b13('0x80')][_0x8b13('0x2c')]({'where':_0x148dde[_0x8b13('0x5b')]})[_0x8b13('0x1d')](function(_0x2a5ed3){_0x7e200e[_0x8b13('0x2c')]=_0x2a5ed3;if(_0xeb3c0f[_0x8b13('0x51')][_0x8b13('0x62')]){_0x148dde[_0x8b13('0x63')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8b13('0x64')](_0x148dde);})['then'](function(_0x592d90){_0x7e200e['rows']=_0x592d90;return _0x7e200e;});}})[_0x8b13('0x1d')](respondWithFilteredResult(_0x394932,_0x148dde))[_0x8b13('0x66')](handleError(_0x394932,null));};exports[_0x8b13('0x82')]=function(_0x9f7c7c,_0x58545c){return db[_0x8b13('0x4d')]['find']({'where':{'id':_0x9f7c7c[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x58545c,null))['then'](function(_0x218f95){if(_0x218f95){return _0x218f95[_0x8b13('0x82')](_0x9f7c7c[_0x8b13('0x51')]['ids']);}})[_0x8b13('0x1d')](respondWithStatusCode(_0x58545c,null))[_0x8b13('0x66')](handleError(_0x58545c,null));};exports[_0x8b13('0x83')]=function(_0xf629c6,_0x3f2ac6){_0xf629c6[_0x8b13('0x72')][_0x8b13('0x84')]=_0xf629c6[_0x8b13('0x85')][_0x8b13('0x86')];return db[_0x8b13('0x4d')][_0x8b13('0x6a')]({'where':{'id':_0xf629c6[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x3f2ac6,null))[_0x8b13('0x1d')](saveUpdates(_0xf629c6[_0x8b13('0x72')],null))[_0x8b13('0x1d')](respondWithResult(_0x3f2ac6,null))['catch'](handleError(_0x3f2ac6,null));};exports[_0x8b13('0x87')]=function(_0x386b00,_0x350c62){_0x386b00['body'][_0x8b13('0x88')]=_0x386b00['file'][_0x8b13('0x86')];return db[_0x8b13('0x4d')][_0x8b13('0x6a')]({'where':{'id':_0x386b00['params']['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x350c62,null))[_0x8b13('0x1d')](saveUpdates(_0x386b00[_0x8b13('0x72')],null))['then'](respondWithResult(_0x350c62,null))[_0x8b13('0x66')](handleError(_0x350c62,null));};exports[_0x8b13('0x89')]=function(_0x56d3e5,_0x1d8a81){_0x56d3e5[_0x8b13('0x72')][_0x8b13('0x8a')]=_0x56d3e5[_0x8b13('0x85')]['filename'];return db[_0x8b13('0x4d')][_0x8b13('0x6a')]({'where':{'id':_0x56d3e5[_0x8b13('0x68')]['id']}})['then'](handleEntityNotFound(_0x1d8a81,null))[_0x8b13('0x1d')](saveUpdates(_0x56d3e5[_0x8b13('0x72')],null))['then'](respondWithResult(_0x1d8a81,null))[_0x8b13('0x66')](handleError(_0x1d8a81,null));};exports['addSystemAvatar']=function(_0x2e3023,_0x178d6b){_0x2e3023['body']['systemAvatar']=_0x2e3023[_0x8b13('0x85')][_0x8b13('0x86')];return db[_0x8b13('0x4d')][_0x8b13('0x6a')]({'where':{'id':_0x2e3023[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x178d6b,null))[_0x8b13('0x1d')](saveUpdates(_0x2e3023[_0x8b13('0x72')],null))[_0x8b13('0x1d')](respondWithResult(_0x178d6b,null))[_0x8b13('0x66')](handleError(_0x178d6b,null));};exports[_0x8b13('0x8b')]=function(_0x49f5f7,_0x305103){var _0x2c2f68=path['join'](config[_0x8b13('0x8c')],'server/files/images/logos/default_logo.svg');var _0x1a9b61={'where':{'id':_0x49f5f7[_0x8b13('0x68')]['id']},'attributes':['id',_0x8b13('0x84')],'raw':!![]};var _0x59ed6e=![];return require(_0x8b13('0x8d'))[_0x8b13('0x8e')]()[_0x8b13('0x1d')](function(_0x3e0cf8){if(_0x3e0cf8){_0x59ed6e=_0x3e0cf8[_0x8b13('0x8f')];}})['then'](function(){return db[_0x8b13('0x4d')][_0x8b13('0x6a')](_0x1a9b61);})[_0x8b13('0x1d')](handleEntityNotFound(_0x305103,null))[_0x8b13('0x1d')](function(_0xfe9601){if(_0xfe9601){if(!_[_0x8b13('0x90')](_0xfe9601['sitepic'])){if(fs[_0x8b13('0x91')](path[_0x8b13('0x92')](config[_0x8b13('0x8c')],_0x8b13('0x93'),_0xfe9601['sitepic']))&&_0x59ed6e){_0x2c2f68=path[_0x8b13('0x92')](config['root'],'server/files/images/logos/',_0xfe9601[_0x8b13('0x84')]);}}return _0x305103[_0x8b13('0x94')](_0x2c2f68);}})['catch'](handleError(_0x305103,null));};exports[_0x8b13('0x95')]=function(_0x4bb94f,_0x38cbc5){var _0x5ac718=path[_0x8b13('0x92')](config[_0x8b13('0x8c')],_0x8b13('0x96'));var _0x4049ae={'where':{'id':_0x4bb94f[_0x8b13('0x68')]['id']},'attributes':['id',_0x8b13('0x88')],'raw':!![]};return db[_0x8b13('0x4d')][_0x8b13('0x6a')](_0x4049ae)[_0x8b13('0x1d')](handleEntityNotFound(_0x38cbc5,null))['then'](function(_0x146e07){if(_0x146e07){if(!_[_0x8b13('0x90')](_0x146e07['agentAvatar'])){if(fs[_0x8b13('0x91')](path[_0x8b13('0x92')](config[_0x8b13('0x8c')],'server/files/images/avatars/',_0x146e07[_0x8b13('0x88')]))){_0x5ac718=path[_0x8b13('0x92')](config[_0x8b13('0x8c')],_0x8b13('0x97'),_0x146e07['agentAvatar']);}}return _0x38cbc5[_0x8b13('0x94')](_0x5ac718);}})[_0x8b13('0x66')](handleError(_0x38cbc5,null));};exports[_0x8b13('0x98')]=function(_0x2ad402,_0x2a44a7){var _0x46d487=path[_0x8b13('0x92')](config[_0x8b13('0x8c')],_0x8b13('0x99'));var _0x3c2bf8={'where':{'id':_0x2ad402[_0x8b13('0x68')]['id']},'attributes':['id','customerAvatar',_0x8b13('0x9a')],'raw':!![]};return db[_0x8b13('0x4d')]['find'](_0x3c2bf8)[_0x8b13('0x1d')](handleEntityNotFound(_0x2a44a7,null))['then'](function(_0x254c92){if(_0x254c92){if(!_[_0x8b13('0x90')](_0x254c92[_0x8b13('0x8a')])){if(fs[_0x8b13('0x91')](path[_0x8b13('0x92')](config[_0x8b13('0x8c')],_0x8b13('0x97'),_0x254c92[_0x8b13('0x8a')]))&&_0x254c92[_0x8b13('0x9a')]){_0x46d487=path[_0x8b13('0x92')](config[_0x8b13('0x8c')],_0x8b13('0x97'),_0x254c92[_0x8b13('0x8a')]);}}return _0x2a44a7[_0x8b13('0x94')](_0x46d487);}})[_0x8b13('0x66')](handleError(_0x2a44a7,null));};exports[_0x8b13('0x9b')]=function(_0x11e8df,_0x406603){var _0x2a31c5=path[_0x8b13('0x92')](config['root'],_0x8b13('0x9c'));var _0x4d8e3c={'where':{'id':_0x11e8df[_0x8b13('0x68')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x8b13('0x4d')]['find'](_0x4d8e3c)[_0x8b13('0x1d')](handleEntityNotFound(_0x406603,null))['then'](function(_0x2de36d){if(_0x2de36d){if(!_[_0x8b13('0x90')](_0x2de36d[_0x8b13('0x9d')])){if(fs['existsSync'](path[_0x8b13('0x92')](config[_0x8b13('0x8c')],_0x8b13('0x97'),_0x2de36d[_0x8b13('0x9d')]))){_0x2a31c5=path['join'](config[_0x8b13('0x8c')],_0x8b13('0x97'),_0x2de36d[_0x8b13('0x9d')]);}}return _0x406603[_0x8b13('0x94')](_0x2a31c5);}})[_0x8b13('0x66')](handleError(_0x406603,null));};function checkWebsiteInterval(_0x5f1130){var _0x3a7034=_0x5f1130[_0x8b13('0x9e')];if(!_0x3a7034){return Promise[_0x8b13('0x9f')](_0x5f1130);}var _0x440ba0=_0x5f1130[_0x8b13('0xa0')]||undefined;return _0x3a7034['ifTime'](_0x440ba0)['then'](function(_0x408300){if(!_0x408300){throw new APIOutOfIntervalError();}return _0x5f1130;});}exports['notify']=function(_0x35d90b,_0x3ce2f6){var _0x467779={'body':_0x35d90b[_0x8b13('0x72')],'channel':_0x8b13('0xa1')};var _0x28905c=[];var _0x360e01=[];var _0x146486={};var _0xf31db9=![];if(_0x35d90b[_0x8b13('0x72')]['id']){delete _0x35d90b[_0x8b13('0x72')]['id'];}if(_[_0x8b13('0x90')](_0x35d90b['body']['from'])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_['isNil'](_0x35d90b['body'][_0x8b13('0xa2')])){throw new APIBadRequestError(_0x8b13('0xa3'));}if(_[_0x8b13('0xa4')](_0x35d90b[_0x8b13('0x72')][_0x8b13('0x72')])){throw new APIBadRequestError(_0x8b13('0xa5'));}var _0x33ab8d=_0x35d90b[_0x8b13('0x72')][_0x8b13('0x3a')]&&_0x35d90b[_0x8b13('0x72')]['referer'];return db[_0x8b13('0xa6')][_0x8b13('0x79')]()[_0x8b13('0x1d')](function(_0x5ce5e8){if(!_0x5ce5e8){throw new Error('No\x20available\x20attributes');}_0x28905c=Object[_0x8b13('0x52')](_0x5ce5e8)[_0x8b13('0x5e')](function(_0x5188d5){return![_0x8b13('0xa7'),_0x8b13('0xa8')]['includes'](_0x5188d5);});_0x360e01=Object[_0x8b13('0x52')](_0x5ce5e8)[_0x8b13('0x5e')](function(_0x1ed1d5){return![_0x8b13('0xa7'),_0x8b13('0xa8'),'CompanyId','ListId'][_0x8b13('0xa9')](_0x1ed1d5);});if(!_['includes'](_0x360e01,_0x35d90b[_0x8b13('0x72')][_0x8b13('0xa2')])){throw new APIBadRequestError(_0x8b13('0xaa')+_0x360e01['join'](',\x20'));}_0x146486[_0x35d90b[_0x8b13('0x72')][_0x8b13('0xa2')]]=_0x35d90b[_0x8b13('0x72')][_0x8b13('0xab')];})['then'](function(){return db[_0x8b13('0x4d')]['find']({'where':{'id':_0x35d90b[_0x8b13('0x68')]['id']},'include':[{'model':db['CmList'],'as':_0x8b13('0xac'),'include':[{'model':db[_0x8b13('0xa6')],'as':_0x8b13('0xad'),'where':_0x146486,'limit':0x1,'order':[[_0x8b13('0xa8'),_0x8b13('0xae')]]}]},{'model':db[_0x8b13('0xaf')],'as':_0x8b13('0xb0')},{'model':db[_0x8b13('0x9e')],'as':_0x8b13('0x9e'),'include':[{'model':db[_0x8b13('0x9e')],'as':_0x8b13('0xb1'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0x8b13('0x1d')](function(_0xc42df9){if(!_0xc42df9){throw new APINotFoundError(util['format'](_0x8b13('0xb2'),_0x35d90b[_0x8b13('0x68')]['id']));}if(_0x33ab8d){return checkWebsiteInterval(_0xc42df9);}return _0xc42df9;})[_0x8b13('0x1d')](function(_0x2d605e){_0x467779[_0x8b13('0xb3')]=_0x2d605e;_0x467779[_0x8b13('0xb4')]=_[_0x8b13('0xb5')](_0x2d605e[_0x8b13('0xb0')],[_0x8b13('0xb6')],[_0x8b13('0xb7')]);if(_0x467779['account'][_0x8b13('0xb0')]){delete _0x467779['account'][_0x8b13('0xb0')];}_0x467779['list']=_0x2d605e[_0x8b13('0xac')]||{'id':_0x2d605e['ListId']};if(_0x467779[_0x8b13('0xb8')]&&_0x467779['list'][_0x8b13('0xad')][_0x8b13('0x56')]){return _0x467779[_0x8b13('0xb8')][_0x8b13('0xad')][0x0];}var _0x43d524=_[_0x8b13('0x15')](_0x35d90b[_0x8b13('0x72')],{'firstName':_0x35d90b[_0x8b13('0x72')][_0x8b13('0xab')],'ListId':_0x2d605e[_0x8b13('0xb9')]});_0x43d524[_0x35d90b[_0x8b13('0x72')]['mapKey']]=_0x35d90b[_0x8b13('0x72')][_0x8b13('0xab')];return db[_0x8b13('0xa6')][_0x8b13('0x6b')](_0x43d524,{'fields':_0x28905c,'raw':!![]});})['then'](function(_0x50ba6e){_0x467779[_0x8b13('0xba')]=_0x50ba6e;var _0x15c9d8=createInteractionObject(_0x35d90b[_0x8b13('0x68')]['id'],_0x35d90b[_0x8b13('0x72')],_0x35d90b[_0x8b13('0xbb')],_0x50ba6e);var _0x55827a={'ChatWebsiteId':_0x35d90b[_0x8b13('0x68')]['id']};if(_0x35d90b[_0x8b13('0x72')][_0x8b13('0xbc')]){_0x55827a[_0x8b13('0xbc')]=_0x35d90b[_0x8b13('0x72')][_0x8b13('0xbc')];_0x55827a[_0x8b13('0xbd')]=![];return db[_0x8b13('0xbe')][_0x8b13('0x6a')]({'where':_0x55827a})[_0x8b13('0x1d')](function(_0x5cbbe3){var _0x478185=_0x35d90b[_0x8b13('0x72')]['customerIp']&&_0x35d90b[_0x8b13('0x72')]['referer'];if(_0x5cbbe3){_0xf31db9=!![];return _0x5cbbe3;}else if(!_0x478185&&_0x5cbbe3&&_0x5cbbe3[_0x8b13('0xbd')]){throw new APIConflictError(_0x8b13('0xbf'));}_0x15c9d8[_0x8b13('0xbc')]=_0x35d90b[_0x8b13('0x72')]['threadId'];_0x15c9d8[_0x8b13('0xc0')]=_0x35d90b[_0x8b13('0x72')]['externalUrl'];return db[_0x8b13('0xbe')]['create'](_0x15c9d8);});}_0x55827a[_0x8b13('0xc1')]=_0x50ba6e['id'];if(_0x35d90b[_0x8b13('0x72')][_0x8b13('0xc2')]&&_0x35d90b[_0x8b13('0x72')][_0x8b13('0xc2')]['id']){_0x55827a['id']=_0x35d90b[_0x8b13('0x72')][_0x8b13('0xc2')]['id'];return db['ChatInteraction'][_0x8b13('0x6a')]({'where':_0x55827a})[_0x8b13('0x1d')](function(_0x1a4d35){var _0x1fc092=_0x35d90b['body']['customerIp']&&_0x35d90b['body'][_0x8b13('0x40')];if(!_0x1fc092&&_0x1a4d35&&_0x1a4d35['closed']){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}else if(_0x1a4d35){_0xf31db9=!![];return _0x1a4d35;}else{return db[_0x8b13('0xbe')][_0x8b13('0x6b')](_0x15c9d8);}});}return db[_0x8b13('0xbe')][_0x8b13('0x6b')](_0x15c9d8);})[_0x8b13('0x1d')](function(_0x2a90ae){if(!_0xf31db9){return _0x2a90ae;}var _0x2e865f={'from':(_0x467779['contact']['firstName']||'')+'\x20'+(_0x467779[_0x8b13('0xba')]['lastName']||'')};if(_0x35d90b[_0x8b13('0x72')][_0x8b13('0xbc')]&&_0x35d90b[_0x8b13('0x72')]['messageId']&&_0x35d90b[_0x8b13('0x72')]['threadId']!=_0x35d90b[_0x8b13('0x72')][_0x8b13('0xc3')]){_0x2e865f[_0x8b13('0xbc')]=_0x35d90b['body'][_0x8b13('0xc3')];}return _0x2a90ae[_0x8b13('0x31')](_0x2e865f);})[_0x8b13('0x1d')](function(_0x3cc463){_0x467779[_0x8b13('0xc2')]=_0x3cc463[_0x8b13('0x33')]({'plain':!![]});_0x467779[_0x8b13('0xc2')]['created']=!_0xf31db9;if(_0x467779['interaction']['created']){if(_0x467779[_0x8b13('0xb3')][_0x8b13('0xc4')]){_0x467779['applications'][_0x8b13('0xc5')]({'id':0x0,'priority':_0x467779['applications'][_0x8b13('0x56')]+0x1,'app':_0x8b13('0xc6'),'appdata':'unmanaged','interval':_0x8b13('0xc7')});}}return db[_0x8b13('0xc8')][_0x8b13('0x6b')]({'body':_0x35d90b[_0x8b13('0x72')][_0x8b13('0x72')],'ChatWebsiteId':_0x35d90b['params']['id'],'ChatInteractionId':_0x3cc463['id'],'direction':'in','ContactId':_0x467779['contact']['id'],'AttachmentId':_0x35d90b[_0x8b13('0x72')][_0x8b13('0xc9')]});})[_0x8b13('0x1d')](function(_0x1e3cc8){_0x467779[_0x8b13('0x25')]=_0x1e3cc8;if(!_0x467779[_0x8b13('0xc2')][_0x8b13('0xca')]){return;}return db[_0x8b13('0xcb')]['find']({'attributes':['id',_0x8b13('0x36')],'where':{'id':_0x467779['interaction'][_0x8b13('0xca')]}});})[_0x8b13('0x1d')](function(_0x1883b0){if(_0x1883b0){_0x467779[_0x8b13('0xb4')][_0x8b13('0xcc')]({'id':0x0,'priority':0x0,'app':_0x8b13('0xcd'),'appdata':_0x1883b0[_0x8b13('0x36')]+','+(_0x467779[_0x8b13('0xb3')][_0x8b13('0xce')]||0xa),'interval':_0x8b13('0xc7')});_0x467779[_0x8b13('0xcf')]=!![];}if(!_0x467779[_0x8b13('0xc2')][_0x8b13('0xd0')]){return;}return db[_0x8b13('0xd1')]['find']({'attributes':['id',_0x8b13('0x36')],'where':{'id':_0x467779[_0x8b13('0xc2')][_0x8b13('0xd0')]}});})[_0x8b13('0x1d')](function(_0x2d43e0){if(_0x2d43e0){_0x467779[_0x8b13('0xb4')][_0x8b13('0xcc')]({'id':0x0,'priority':0x1,'app':_0x8b13('0xd2'),'appdata':_0x2d43e0[_0x8b13('0x36')]+','+(_0x467779[_0x8b13('0xb3')][_0x8b13('0xd3')]||0x12c),'interval':_0x8b13('0xc7')});}return respondWithRpcPromise(_0x8b13('0xd4'),'startRouting',_0x467779);})['then'](function(_0x347e78){respondWithRpcPromise(_0x8b13('0xd5'),'EventManager',{'event':_0x8b13('0xd6'),'message':_0x347e78},client9002);return _0x347e78;})[_0x8b13('0x1d')](respondWithResult(_0x3ce2f6,null))[_0x8b13('0x66')](APIHandleError(_0x3ce2f6));};exports[_0x8b13('0xd7')]=function(_0x59babb,_0x5f4be9){var _0x12a4f8,_0xed9630,_0x350a80;var _0x35f557=[];var _0x1e84f3={};var _0x446fab=_0x59babb['files']||[];var _0x32c2d9=[];var _0x8c1dc0;return db['CmContact']['describe']()[_0x8b13('0x1d')](function(_0x2350d3){if(!_0x2350d3){throw new db[(_0x8b13('0xd8'))]['ValidationError'](_0x8b13('0xd9'));}_0x35f557=_['difference'](_['keys'](_0x2350d3),[_0x8b13('0xa7'),_0x8b13('0xa8'),'CompanyId','ListId']);if(_0x59babb[_0x8b13('0x72')]['id']){delete _0x59babb['body']['id'];}if(_[_0x8b13('0x90')](_0x59babb[_0x8b13('0x72')][_0x8b13('0xab')])){throw _0x5f4be9[_0x8b13('0x29')](0x1f4)[_0x8b13('0x37')](new db['Sequelize']['ValidationError'](_0x8b13('0xda')));}if(_['isNil'](_0x59babb['body'][_0x8b13('0x72')])||_0x59babb[_0x8b13('0x72')][_0x8b13('0x72')]===''){throw _0x5f4be9[_0x8b13('0x29')](0x1f4)[_0x8b13('0x37')](new db[(_0x8b13('0xd8'))]['ValidationError'](_0x8b13('0xdb')));}if(_[_0x8b13('0x90')](_0x59babb[_0x8b13('0x72')][_0x8b13('0xdc')])){throw _0x5f4be9['status'](0x1f4)['send'](new db[(_0x8b13('0xd8'))][(_0x8b13('0xdd'))](_0x8b13('0xde')+_0x35f557));}if(!_[_0x8b13('0xa9')](_0x35f557,_0x59babb[_0x8b13('0x72')]['mapKeyOffline'])){throw _0x5f4be9[_0x8b13('0x29')](0x1f4)['send'](new db[(_0x8b13('0xd8'))][(_0x8b13('0xdd'))](_0x8b13('0xdf')+_0x35f557));}_0x1e84f3[_0x59babb['body'][_0x8b13('0xdc')]]=_0x59babb[_0x8b13('0x72')][_0x8b13('0xab')];})['then'](function(){return db[_0x8b13('0x4d')][_0x8b13('0x6a')]({'where':{'id':_0x59babb[_0x8b13('0x68')]['id']},'include':[{'model':db[_0x8b13('0xe0')],'as':_0x8b13('0xac')},{'model':db[_0x8b13('0xe1')],'as':'MailAccount'}]});})[_0x8b13('0x1d')](handleEntityNotFound(_0x5f4be9,null))[_0x8b13('0x1d')](function(_0x4c9273){if(_0x4c9273&&_0x4c9273['List']){_0xed9630=_0x4c9273;var _0x4935f0=_[_0x8b13('0x15')](_0x59babb['body'],{'firstName':_0x59babb[_0x8b13('0x72')][_0x8b13('0xab')],'phone':_0x59babb[_0x8b13('0x72')]['from'],'ListId':_0x4c9273['ListId']});_0x4935f0[_0x59babb['body'][_0x8b13('0xdc')]]=_0x59babb[_0x8b13('0x72')][_0x8b13('0xab')];return db['CmContact'][_0x8b13('0xe2')]({'where':_0x1e84f3,'defaults':_0x4935f0});}})['spread'](function(_0x28090c){if(_0x28090c){_0x350a80=_0x28090c;var _0x5011be=fs['readFileSync'](path[_0x8b13('0x92')](config[_0x8b13('0x8c')],_0x8b13('0xe3')),_0x8b13('0xe4'));var _0x5b033b=ejs['render'](_0x5011be,{'body':_[_0x8b13('0xe5')](_0x59babb[_0x8b13('0x72')]['body']),'bodyTitle':_0xed9630['offlineMessageBody']});return db[_0x8b13('0xe6')][_0x8b13('0x6b')]({'body':_0x5b033b,'plainBody':htmlToText[_0x8b13('0xe7')](_0x5b033b),'ContactId':_0x28090c['id'],'ChatWebsiteId':_0xed9630['id']});}})[_0x8b13('0x1d')](function(_0x2de61d){_0x8c1dc0=_0x2de61d;if(_0x446fab[_0x8b13('0x56')]){var _0x5a195d=_0x446fab[_0x8b13('0x4c')](function(_0xecc8ea){return{'name':_0xecc8ea[_0x8b13('0xe8')],'basename':_0xecc8ea[_0x8b13('0x86')],'type':_0xecc8ea['mimetype'],'ChatOfflineMessageId':_0x2de61d['id']};});_0x32c2d9=_0x5a195d['map'](_0x2e24f2=>{var _0x1e2036={'filename':_0x2e24f2[_0x8b13('0x36')],'path':path[_0x8b13('0x92')](config['root'],_0x8b13('0xe9'),_0x8b13('0xea'),'attachments',_0x8b13('0xeb'),_0x2e24f2['basename'])};return _0x1e2036;});if(!_0xed9630[_0x8b13('0xec')]){return db[_0x8b13('0xed')][_0x8b13('0xee')](function(_0x24b945){return db[_0x8b13('0xef')][_0x8b13('0xf0')](_0x5a195d,{'transaction':_0x24b945});});}}})[_0x8b13('0x1d')](function(){if(_0x8c1dc0){_0x12a4f8=_0x8c1dc0;return db['MailAccount'][_0x8b13('0x7d')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x8b13('0xf1')],'as':_0x8b13('0xf1'),'raw':!![]}]}]});}})[_0x8b13('0x1d')](function(_0x38a88d){if(_0x38a88d&&_0x38a88d['Smtp']&&_0xed9630[_0x8b13('0xf2')]&&_0xed9630[_0x8b13('0xf3')]){var _0x1f9f15=_0x38a88d['getSmtpOptions']();return respondWithRpcPromise(_0x8b13('0xf4'),_0x8b13('0xf5'),{'account':_0x1f9f15,'message':{'from':util[_0x8b13('0x43')](_0x8b13('0xf6'),_0x38a88d[_0x8b13('0x36')],_0x38a88d[_0x8b13('0xf7')]||_0x38a88d[_0x8b13('0xf8')][_0x8b13('0xf9')]),'to':_0xed9630[_0x8b13('0xf3')],'subject':_0xed9630['offlineMessageSubject'],'html':_0x12a4f8[_0x8b13('0x72')],'attachments':_0x32c2d9}},client9003)[_0x8b13('0x1d')](function(){return _0x12a4f8;})[_0x8b13('0x66')](function(_0x104e89){logger['error'](_0x104e89);});}})['then'](function(){if(_0xed9630&&_0xed9630[_0x8b13('0xec')]&&_0xed9630[_0x8b13('0xfa')]){var _0x331434=[];if(_0x446fab[_0x8b13('0x56')]){_0x331434=_0x446fab[_0x8b13('0x4c')](function(_0x4a19ef){return{'name':_0x4a19ef[_0x8b13('0xe8')],'basename':_0x4a19ef[_0x8b13('0x86')],'type':_0x4a19ef[_0x8b13('0xfb')],'ChatOfflineMessageId':_0x8c1dc0['id']};});}var _0x49a92f;if(!_['isNil'](_0xed9630['subjectOffline'])){var _0x542e1b=_[_0x8b13('0x4c')](_0x59babb[_0x8b13('0x72')],function(_0x59615c){return _0x59615c;});var _0x132e63=_[_0x8b13('0xfc')](_0x542e1b)[0x0];var _0x27c8d9=_[_0x8b13('0xfd')](_0x132e63,function(_0x3eda97){return _0x3eda97;});_0x49a92f=_0x27c8d9[0x1][_0xed9630['subjectOffline']];}var _0x1f544c={'from':_0x350a80['email'],'firstName':_0x350a80['firstName'],'lastName':_0x350a80[_0x8b13('0x3e')],'mapKey':_0x8b13('0xf7'),'message':{'from':_0x350a80[_0x8b13('0xf7')],'to':_0xed9630[_0x8b13('0xe1')]['email'],'cc':'','subject':_[_0x8b13('0x90')](_0x49a92f)?_0xed9630[_0x8b13('0xfe')]:_0x49a92f,'messageId':'','sentAt':new Date(),'attach':_0x331434['length'],'attachments':_0x331434,'originChannel':_0x8b13('0xff'),'ChatWebsiteId':_0xed9630['id'],'ChatOfflineMessageId':_0x12a4f8['id'],'originTo':_0xed9630[_0x8b13('0xe1')]['email']},'body':_0x12a4f8[_0x8b13('0x72')]};var _0x1d47ff={'account':{'id':_0xed9630['MailAccountId']},'body':_0x1f544c,'log':_0x8b13('0x100')};return respondWithRpcPromise(_0x8b13('0x100'),_0x8b13('0x101'),_0x1d47ff,client9001)[_0x8b13('0x1d')](function(){return _0x12a4f8;})['catch'](function(_0xfb0a65){logger['error'](_0xfb0a65);});}return;})[_0x8b13('0x1d')](function(){if(_0x12a4f8){return _0x12a4f8;}})[_0x8b13('0x1d')](respondWithResult(_0x5f4be9,null))[_0x8b13('0x66')](function(){for(var _0x3c12ea of _0x446fab){var _0x8cd0e=path[_0x8b13('0x92')](config[_0x8b13('0x8c')],_0x8b13('0xe9'),_0x8b13('0xea'),_0x8b13('0x102'),_0x8b13('0xeb'),_0x3c12ea[_0x8b13('0x86')]);fs_extra[_0x8b13('0x103')](_0x8cd0e)['catch'](function(_0x188f6e){logger[_0x8b13('0x23')](_0x8b13('0x104'),_0x8cd0e,_0x188f6e);});}});};exports[_0x8b13('0x105')]=function(_0x2db1b7,_0x433862){return db[_0x8b13('0xbe')]['find']({'where':{'id':_0x2db1b7['params']['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x433862,null))[_0x8b13('0x1d')](function(_0x2defbf){if(_0x2defbf){return _0x2defbf[_0x8b13('0x105')](_0x2db1b7[_0x8b13('0x72')][_0x8b13('0x106')],_[_0x8b13('0x107')](_0x2db1b7[_0x8b13('0x72')],['ids','id'])||{});}})['then'](respondWithResult(_0x433862,null))['catch'](handleError(_0x433862,null));};exports[_0x8b13('0x108')]=function(_0x392239,_0x360153){var _0x33e47b={'raw':![],'where':{}};var _0x1be7a8={};var _0x5369e2={'count':0x0,'rows':[]};return db[_0x8b13('0x4d')][_0x8b13('0x7d')]({'where':{'id':_0x392239[_0x8b13('0x68')]['id']}})['then'](handleEntityNotFound(_0x360153,null))[_0x8b13('0x1d')](function(_0x1f771c){if(_0x1f771c){_0x1be7a8[_0x8b13('0x47')]=_[_0x8b13('0x52')](db[_0x8b13('0xbe')]['rawAttributes']);_0x1be7a8['query']=_['keys'](_0x392239[_0x8b13('0x51')]);_0x1be7a8[_0x8b13('0x5d')]=_[_0x8b13('0x53')](_0x1be7a8[_0x8b13('0x47')],_0x1be7a8[_0x8b13('0x51')]);_0x33e47b[_0x8b13('0x54')]=_['intersection'](_0x1be7a8[_0x8b13('0x47')],qs[_0x8b13('0x55')](_0x392239['query']['fields']));_0x33e47b['attributes']=_0x33e47b[_0x8b13('0x54')]['length']?_0x33e47b['attributes']:_0x1be7a8[_0x8b13('0x47')];if(!_0x392239['query'][_0x8b13('0x57')](_0x8b13('0x58'))){_0x33e47b[_0x8b13('0x2d')]=qs['limit'](_0x392239['query'][_0x8b13('0x2d')]);_0x33e47b[_0x8b13('0x2a')]=qs['offset'](_0x392239[_0x8b13('0x51')]['offset']);}_0x33e47b[_0x8b13('0x59')]=qs[_0x8b13('0x5a')](_0x392239['query'][_0x8b13('0x5a')]);_0x33e47b['where']=qs[_0x8b13('0x5d')](_[_0x8b13('0x5c')](_0x392239[_0x8b13('0x51')],_0x1be7a8['filters']));_0x33e47b[_0x8b13('0x5b')][_0x8b13('0x7a')]=_0x1f771c['id'];if(_0x392239[_0x8b13('0x51')][_0x8b13('0x5e')]){_0x33e47b[_0x8b13('0x5b')]=_[_0x8b13('0x5f')](_0x33e47b[_0x8b13('0x5b')],{'$or':_['map'](_0x33e47b[_0x8b13('0x54')],function(_0x476cce){var _0x378484={};_0x378484[_0x476cce]={'$like':'%'+_0x392239[_0x8b13('0x51')]['filter']+'%'};return _0x378484;})});}_0x33e47b=_[_0x8b13('0x5f')]({},_0x33e47b,_0x392239['options']);return db[_0x8b13('0xbe')][_0x8b13('0x2c')]({'where':_0x33e47b['where']})[_0x8b13('0x1d')](function(_0x110259){_0x5369e2['count']=_0x110259;if(_0x392239[_0x8b13('0x51')][_0x8b13('0x62')]){_0x33e47b['include']=[{'model':db['CmContact'],'as':_0x8b13('0x109'),'required':![]},{'model':db[_0x8b13('0xcb')],'as':_0x8b13('0x10a'),'attributes':[_0x8b13('0x36'),_0x8b13('0x10b'),'internal'],'required':![]},{'model':db[_0x8b13('0x10c')],'as':_0x8b13('0x10d'),'attributes':['id',_0x8b13('0x36'),_0x8b13('0x10e')],'where':_0x392239['query'][_0x8b13('0x10f')]?{'id':_0x392239['query']['tag']}:undefined,'required':_0x392239[_0x8b13('0x51')][_0x8b13('0x10f')]?!![]:![]}];}return db[_0x8b13('0xbe')]['findAll'](_0x33e47b);})['then'](function(_0xf3a99b){_0x5369e2[_0x8b13('0x65')]=_0xf3a99b;return _0x5369e2;});}})[_0x8b13('0x1d')](respondWithFilteredResult(_0x360153,_0x33e47b))[_0x8b13('0x66')](handleError(_0x360153,null));};exports['getSnippet']=function(_0x4d1e8f,_0xce789c){var _0x29db49=0x0;var _0x20a25a=0x0;var _0x2be3a5=![];var _0x1c1513;var _0x2dc404;return db['ChatWebsite'][_0x8b13('0x6a')]({'where':{'id':_0x4d1e8f[_0x8b13('0x68')]['id']},'include':[{'model':db['Interval'],'as':_0x8b13('0x9e'),'include':[{'model':db[_0x8b13('0x9e')],'as':_0x8b13('0xb1'),'attributes':['id',_0x8b13('0x110')]}]}]})[_0x8b13('0x1d')](handleEntityNotFound(_0xce789c,null))['then'](function(_0x43f7ff){if(_0x43f7ff){_0x1c1513=_0x43f7ff;return _0x43f7ff[_0x8b13('0x111')]({'raw':!![]});}})[_0x8b13('0x1d')](function(_0x48d167){if(_0x1c1513){if(_0x48d167){_0x2dc404=_0x48d167;}}return require(_0x8b13('0x8d'))[_0x8b13('0x8e')]();})['then'](function(_0x19f701){if(_0x19f701){_0x20a25a=_0x19f701[_0x8b13('0x112')];_0x2be3a5=_0x19f701[_0x8b13('0x8f')];}})['then'](function(){return db['ChatInteraction'][_0x8b13('0x2c')]({'where':{'closed':![]}});})['then'](function(_0x2dc339){_0x29db49=_0x2dc339;if(_0x20a25a&&_0x2dc339>_0x20a25a){return db[_0x8b13('0x113')][_0x8b13('0x7d')]({'where':{'id':0x1}})['then'](function(_0x18aa8f){if(_0x18aa8f){_0x18aa8f['increment']('chatLicenseExceeded');}});}})[_0x8b13('0x1d')](function(){var _0x12408a=_0x1c1513[_0x8b13('0x9e')];var _0x1c87fa=_0x1c1513[_0x8b13('0xa0')]||undefined;return _0x12408a?_0x12408a[_0x8b13('0x114')](_0x1c87fa):!![];})['then'](function(_0x273dec){var _0x3680b8=fs[_0x8b13('0x115')](path[_0x8b13('0x92')](config['root'],_0x8b13('0x116')),_0x8b13('0xe4'));var _0x41d888=_0x8b13('0x117');var _0x1a3b50=![];var _0x3af827,_0xc62a7c;if(_0x4d1e8f['headers'][_0x8b13('0x40')]){_0x3af827=new URL(_0x4d1e8f[_0x8b13('0xbb')][_0x8b13('0x40')])[_0x8b13('0x118')];}else if(_0x4d1e8f[_0x8b13('0xbb')][_0x8b13('0x118')]){_0x3af827=new URL(_0x4d1e8f[_0x8b13('0xbb')][_0x8b13('0x118')])['origin'];}else{_0x3af827=_0x8b13('0x119');}_0xc62a7c=typeof _0x1c1513['address'][_0x8b13('0x6d')](',')[_0x8b13('0x6a')](function(_0x1f0508){return wildcardUtils[_0x8b13('0x11a')](_0x1f0508,_0x3af827);})!==_0x8b13('0x2b');var _0x132264={'chatVersion':_0x41d888,'chatWebsiteAddressOrigin':_0xc62a7c?_0x3af827:_0x1c1513['address'],'remote':_0x1c1513[_0x8b13('0x11b')],'query':querystring[_0x8b13('0x22')](_['merge'](_0x1c1513['get']({'plain':!![]}),{'customerIp':_0x4d1e8f['headers']['x-forwarded-for']||_0x4d1e8f[_0x8b13('0xbb')][_0x8b13('0x11c')]||_0x4d1e8f[_0x8b13('0x11d')][_0x8b13('0x11e')]||_0x4d1e8f['ip'],'referer':_0x4d1e8f[_0x8b13('0xbb')][_0x8b13('0x40')],'openedInteractions':_0x29db49,'maxInteractions':_0x20a25a,'virtual':_0x2be3a5['virtual'],'online':_0x273dec,'custom':_0x2be3a5,'address':_0xc62a7c?_0x3af827:null}))['replace'](/'/g,'\x5c\x27')};_0xce789c[_0x8b13('0x37')](ejs[_0x8b13('0x11f')](Mustache[_0x8b13('0x11f')](_0x3680b8,_0x132264),{'proactiveActions':_0x2dc404,'alignment':_0x1c1513[_0x8b13('0x120')],'verticalAlignment':_0x1c1513[_0x8b13('0x121')],'div_color':_0x1c1513[_0x8b13('0x10e')],'labelText':_0x1c1513[_0x8b13('0x122')],'text_color':_0x1c1513['textColor'],'text_button_color':_0x1c1513[_0x8b13('0x123')],'button_color':_0x1c1513[_0x8b13('0x124')],'background_color':_0x1c1513['backgroundColor'],'hideWhenOffline':_0x1c1513['hideWhenOffline'],'intervalId':_0x1c1513['IntervalId'],'isDevelopment':_0x1a3b50,'chatVersion':_0x41d888}));})[_0x8b13('0x66')](handleError(_0xce789c,null));};exports['addApplications']=function(_0x458c8f,_0xdda7e0){var _0xd5a593=_0x458c8f[_0x8b13('0x68')]['id'];var _0x17df3f=_0x458c8f[_0x8b13('0x72')];var _0x68adf4=0xc8;var _0x429040=null;return db[_0x8b13('0xed')]['transaction']({'isolationLevel':db[_0x8b13('0xed')]['Transaction']['ISOLATION_LEVELS'][_0x8b13('0x125')]},function(_0x259a1f){return db['ChatWebsite'][_0x8b13('0x7d')]({'where':{'id':_0xd5a593},'transaction':_0x259a1f})[_0x8b13('0x1d')](function(_0x457dd1){if(_0x457dd1){return db[_0x8b13('0xaf')][_0x8b13('0x32')]({'where':{'ChatWebsiteId':_0xd5a593},'transaction':_0x259a1f})[_0x8b13('0x1d')](function(){var _0x2c8a6d=_[_0x8b13('0x4c')](_0x17df3f,function(_0x3f35c1){_0x3f35c1[_0x8b13('0x7a')]=_0xd5a593;return _0x3f35c1;});return db[_0x8b13('0xaf')][_0x8b13('0xf0')](_0x2c8a6d,{'transaction':_0x259a1f});});}else{_0x68adf4=0x194;_0x429040=[];}});})[_0x8b13('0x1d')](function(){if(_0x68adf4!==0x194){return db[_0x8b13('0xaf')][_0x8b13('0x126')]({'where':{'ChatWebsiteId':_0xd5a593},'order':_0x8b13('0xb6')})[_0x8b13('0x1d')](function(_0x1ea799){_0x429040=_0x1ea799;});}})[_0x8b13('0x66')](function(_0x50032d){_0x68adf4=0x1f4;logger[_0x8b13('0x23')](_0x50032d[_0x8b13('0x127')]);if(_0x50032d['name']){delete _0x50032d[_0x8b13('0x36')];}_0x429040=_0x50032d;})['finally'](function(){if(_0x429040===null){_0xdda7e0[_0x8b13('0x27')](_0x68adf4);}else{if(_0x68adf4===0x1f4){_0xdda7e0[_0x8b13('0x29')](_0x68adf4)[_0x8b13('0x37')](_0x429040);}else{_0xdda7e0[_0x8b13('0x29')](_0x68adf4)[_0x8b13('0x30')](_0x429040);}}});};exports[_0x8b13('0x128')]=function(_0xdf5ae6,_0x286254){var _0x18abba={};var _0x2a1b92={};var _0x95e9fb;var _0x2dcef4;return db[_0x8b13('0x4d')][_0x8b13('0x7d')]({'where':{'id':_0xdf5ae6[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x286254,null))[_0x8b13('0x1d')](function(_0x3349ac){if(_0x3349ac){_0x95e9fb=_0x3349ac;_0x2a1b92['model']=_[_0x8b13('0x52')](db[_0x8b13('0xaf')][_0x8b13('0x4e')]);_0x2a1b92[_0x8b13('0x51')]=_[_0x8b13('0x52')](_0xdf5ae6['query']);_0x2a1b92[_0x8b13('0x5d')]=_[_0x8b13('0x53')](_0x2a1b92[_0x8b13('0x47')],_0x2a1b92[_0x8b13('0x51')]);_0x18abba[_0x8b13('0x54')]=_[_0x8b13('0x53')](_0x2a1b92['model'],qs[_0x8b13('0x55')](_0xdf5ae6[_0x8b13('0x51')][_0x8b13('0x55')]));_0x18abba[_0x8b13('0x54')]=_0x18abba[_0x8b13('0x54')]['length']?_0x18abba[_0x8b13('0x54')]:_0x2a1b92['model'];_0x18abba[_0x8b13('0x59')]=qs[_0x8b13('0x5a')](_0xdf5ae6['query'][_0x8b13('0x5a')]);_0x18abba[_0x8b13('0x5b')]=qs[_0x8b13('0x5d')](_[_0x8b13('0x5c')](_0xdf5ae6[_0x8b13('0x51')],_0x2a1b92[_0x8b13('0x5d')]));if(_0xdf5ae6[_0x8b13('0x51')][_0x8b13('0x5e')]){_0x18abba[_0x8b13('0x5b')]=_['merge'](_0x18abba[_0x8b13('0x5b')],{'$or':_[_0x8b13('0x4c')](_0x18abba[_0x8b13('0x54')],function(_0x29503b){var _0x246e17={};_0x246e17[_0x29503b]={'$like':'%'+_0xdf5ae6[_0x8b13('0x51')][_0x8b13('0x5e')]+'%'};return _0x246e17;})});}_0x18abba=_[_0x8b13('0x5f')]({},_0x18abba,_0xdf5ae6[_0x8b13('0x61')]);return _0x95e9fb['getApplications'](_0x18abba);}})['then'](function(_0x405fa3){if(_0x405fa3){_0x2dcef4=_0x405fa3[_0x8b13('0x56')];if(!_0xdf5ae6['query'][_0x8b13('0x57')]('nolimit')){_0x18abba['limit']=qs[_0x8b13('0x2d')](_0xdf5ae6[_0x8b13('0x51')]['limit']);_0x18abba['offset']=qs[_0x8b13('0x2a')](_0xdf5ae6[_0x8b13('0x51')][_0x8b13('0x2a')]);}return _0x95e9fb[_0x8b13('0x128')](_0x18abba);}})[_0x8b13('0x1d')](function(_0x359014){if(_0x359014){return _0x359014?{'count':_0x2dcef4,'rows':_0x359014}:null;}})[_0x8b13('0x1d')](respondWithResult(_0x286254,null))[_0x8b13('0x66')](handleError(_0x286254,null));};exports[_0x8b13('0x129')]=function(_0x7c338d,_0x50bf52){return db[_0x8b13('0x12a')][_0x8b13('0x6a')]({'where':{'id':_0x7c338d[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x50bf52,null))['then'](function(_0x54c415){if(_0x54c415){return _0x54c415[_0x8b13('0x129')](_0x7c338d[_0x8b13('0x72')][_0x8b13('0x106')],_[_0x8b13('0x107')](_0x7c338d[_0x8b13('0x72')],['ids','id'])||{});}})['then'](respondWithResult(_0x50bf52,null))[_0x8b13('0x66')](handleError(_0x50bf52,null));};exports[_0x8b13('0x111')]=function(_0x2d15be,_0x393e7e){var _0x3a0822={};var _0x5e49c9={};var _0x18a6ad;var _0x9c9c4;return db[_0x8b13('0x4d')][_0x8b13('0x7d')]({'where':{'id':_0x2d15be[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x393e7e,null))[_0x8b13('0x1d')](function(_0x3e4da0){if(_0x3e4da0){_0x18a6ad=_0x3e4da0;_0x5e49c9[_0x8b13('0x47')]=_[_0x8b13('0x52')](db[_0x8b13('0x12b')][_0x8b13('0x4e')]);_0x5e49c9[_0x8b13('0x51')]=_['keys'](_0x2d15be['query']);_0x5e49c9['filters']=_['intersection'](_0x5e49c9['model'],_0x5e49c9[_0x8b13('0x51')]);_0x3a0822['attributes']=_[_0x8b13('0x53')](_0x5e49c9[_0x8b13('0x47')],qs['fields'](_0x2d15be['query']['fields']));_0x3a0822[_0x8b13('0x54')]=_0x3a0822[_0x8b13('0x54')]['length']?_0x3a0822['attributes']:_0x5e49c9['model'];_0x3a0822[_0x8b13('0x59')]=qs[_0x8b13('0x5a')](_0x2d15be[_0x8b13('0x51')]['sort']);_0x3a0822['where']=qs['filters'](_[_0x8b13('0x5c')](_0x2d15be[_0x8b13('0x51')],_0x5e49c9[_0x8b13('0x5d')]));if(_0x2d15be[_0x8b13('0x51')][_0x8b13('0x5e')]){_0x3a0822[_0x8b13('0x5b')]=_[_0x8b13('0x5f')](_0x3a0822[_0x8b13('0x5b')],{'$or':_[_0x8b13('0x4c')](_0x3a0822[_0x8b13('0x54')],function(_0x4f5f8d){var _0x438b94={};_0x438b94[_0x4f5f8d]={'$like':'%'+_0x2d15be[_0x8b13('0x51')][_0x8b13('0x5e')]+'%'};return _0x438b94;})});}_0x3a0822=_[_0x8b13('0x5f')]({},_0x3a0822,_0x2d15be[_0x8b13('0x61')]);return _0x18a6ad[_0x8b13('0x111')](_0x3a0822);}})['then'](function(_0x220af3){if(_0x220af3){_0x9c9c4=_0x220af3[_0x8b13('0x56')];if(!_0x2d15be[_0x8b13('0x51')][_0x8b13('0x57')](_0x8b13('0x58'))){_0x3a0822['limit']=qs[_0x8b13('0x2d')](_0x2d15be[_0x8b13('0x51')][_0x8b13('0x2d')]);_0x3a0822[_0x8b13('0x2a')]=qs[_0x8b13('0x2a')](_0x2d15be['query'][_0x8b13('0x2a')]);}return _0x18a6ad[_0x8b13('0x111')](_0x3a0822);}})[_0x8b13('0x1d')](function(_0x29b91b){if(_0x29b91b){return _0x29b91b?{'count':_0x9c9c4,'rows':_0x29b91b}:null;}})[_0x8b13('0x1d')](respondWithResult(_0x393e7e,null))['catch'](handleError(_0x393e7e,null));};exports[_0x8b13('0x12c')]=function(_0x5d1b47,_0x545e66){var _0x531a35=_0x5d1b47[_0x8b13('0x51')][_0x8b13('0x12d')]===_0x8b13('0x12e')?_0x8b13('0x12f'):_0x8b13('0x130');return db[_0x8b13('0x4d')][_0x8b13('0x6a')]({'attributes':['id',_0x531a35],'where':{'id':_0x5d1b47[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x545e66,null))[_0x8b13('0x1d')](function(_0x118f07){if(_0x118f07){var _0x3cc93f=_0x118f07[_0x531a35];var _0x436d82=_0x3cc93f&&_0x3cc93f[_0x8b13('0x131')]?_0x3cc93f['items']:[];_0x545e66[_0x8b13('0x37')]({'fromKey':_[_0x8b13('0x90')](_0x3cc93f[_0x8b13('0x132')])?undefined:_0x3cc93f['fromKey'],'count':_0x436d82['length'],'rows':_0x436d82});}})[_0x8b13('0x66')](handleError(_0x545e66,null));};exports[_0x8b13('0x133')]=function(_0x5e0767,_0x3dc6f2){var _0xd2411f={'raw':![],'where':{}};var _0x34f260={};var _0x22e6bd={'count':0x0,'rows':[]};return db[_0x8b13('0x4d')][_0x8b13('0x7d')]({'where':{'id':_0x5e0767[_0x8b13('0x68')]['id']}})['then'](handleEntityNotFound(_0x3dc6f2,null))['then'](function(_0x411ee5){if(_0x411ee5){_0x34f260[_0x8b13('0x47')]=_[_0x8b13('0x52')](db[_0x8b13('0xe6')][_0x8b13('0x4e')]);_0x34f260[_0x8b13('0x51')]=_[_0x8b13('0x52')](_0x5e0767[_0x8b13('0x51')]);_0x34f260[_0x8b13('0x5d')]=_[_0x8b13('0x53')](_0x34f260[_0x8b13('0x47')],_0x34f260[_0x8b13('0x51')]);_0xd2411f[_0x8b13('0x54')]=_['intersection'](_0x34f260['model'],qs[_0x8b13('0x55')](_0x5e0767[_0x8b13('0x51')][_0x8b13('0x55')]));_0xd2411f[_0x8b13('0x54')]=_0xd2411f[_0x8b13('0x54')][_0x8b13('0x56')]?_0xd2411f['attributes']:_0x34f260[_0x8b13('0x47')];if(!_0x5e0767[_0x8b13('0x51')][_0x8b13('0x57')](_0x8b13('0x58'))){_0xd2411f['limit']=qs[_0x8b13('0x2d')](_0x5e0767[_0x8b13('0x51')][_0x8b13('0x2d')]);_0xd2411f[_0x8b13('0x2a')]=qs[_0x8b13('0x2a')](_0x5e0767[_0x8b13('0x51')][_0x8b13('0x2a')]);}_0xd2411f[_0x8b13('0x59')]=qs[_0x8b13('0x5a')](_0x5e0767[_0x8b13('0x51')][_0x8b13('0x5a')]);_0xd2411f['where']=qs[_0x8b13('0x5d')](_[_0x8b13('0x5c')](_0x5e0767[_0x8b13('0x51')],_0x34f260[_0x8b13('0x5d')]));_0xd2411f[_0x8b13('0x5b')][_0x8b13('0x7a')]=_0x411ee5['id'];if(_0x5e0767[_0x8b13('0x51')][_0x8b13('0x5e')]){_0xd2411f[_0x8b13('0x5b')]=_[_0x8b13('0x5f')](_0xd2411f['where'],{'$or':_[_0x8b13('0x4c')](_0xd2411f[_0x8b13('0x54')],function(_0x419f85){var _0x3b62e4={};_0x3b62e4[_0x419f85]={'$like':'%'+_0x5e0767[_0x8b13('0x51')][_0x8b13('0x5e')]+'%'};return _0x3b62e4;})});}_0xd2411f=_[_0x8b13('0x5f')]({},_0xd2411f,_0x5e0767[_0x8b13('0x61')]);return db[_0x8b13('0xe6')]['count']({'where':_0xd2411f[_0x8b13('0x5b')]})['then'](function(_0xc5960e){_0x22e6bd[_0x8b13('0x2c')]=_0xc5960e;if(_0x5e0767[_0x8b13('0x51')]['includeAll']){_0xd2411f[_0x8b13('0x63')]=[{'all':!![]}];}else{_0xd2411f[_0x8b13('0x63')]=[{'model':db['CmContact'],'as':_0x8b13('0x109'),'required':![]},{'model':db[_0x8b13('0xef')],'as':'Attachments','required':![]}];}return db[_0x8b13('0xe6')]['findAll'](_0xd2411f);})['then'](function(_0x25d83b){_0x22e6bd[_0x8b13('0x65')]=_0x25d83b;return _0x22e6bd;});}})[_0x8b13('0x1d')](respondWithFilteredResult(_0x3dc6f2,_0xd2411f))[_0x8b13('0x66')](handleError(_0x3dc6f2,null));};exports[_0x8b13('0x134')]=function(_0xc43aba,_0x1c68da){return db[_0x8b13('0x4d')]['find']({'where':{'id':_0xc43aba[_0x8b13('0x68')]['id']}})['then'](handleEntityNotFound(_0x1c68da,null))[_0x8b13('0x1d')](function(_0xf3e201){if(_0xf3e201){return _0xf3e201[_0x8b13('0x134')](_0xc43aba['body'][_0x8b13('0x106')],_['omit'](_0xc43aba['body'],[_0x8b13('0x106'),'id'])||{})[_0x8b13('0x135')](function(_0x559cdf){for(var _0x1f2a30=0x0;_0x1f2a30<_0xc43aba[_0x8b13('0x72')][_0x8b13('0x106')][_0x8b13('0x56')];_0x1f2a30+=0x1){socket[_0x8b13('0x136')](_0x8b13('0x137'),{'UserId':Number(_0xc43aba[_0x8b13('0x72')]['ids'][_0x1f2a30]),'ChatWebsiteId':Number(_0xc43aba[_0x8b13('0x68')]['id'])});}return _0x559cdf;});}})['then'](respondWithResult(_0x1c68da,null))[_0x8b13('0x66')](handleError(_0x1c68da,null));};exports[_0x8b13('0x138')]=function(_0x5d245e,_0x2b4de7){return db[_0x8b13('0x4d')][_0x8b13('0x6a')]({'where':{'id':_0x5d245e[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x2b4de7,null))[_0x8b13('0x1d')](function(_0x51e2da){if(_0x51e2da){return _0x51e2da['removeAgents'](_0x5d245e[_0x8b13('0x51')][_0x8b13('0x106')])['then'](function(){if(_[_0x8b13('0x139')](_0x5d245e['query']['ids'])){for(var _0x5827ee=0x0;_0x5827ee<_0x5d245e[_0x8b13('0x51')]['ids'][_0x8b13('0x56')];_0x5827ee+=0x1){socket[_0x8b13('0x136')](_0x8b13('0x13a'),{'UserId':Number(_0x5d245e[_0x8b13('0x51')][_0x8b13('0x106')][_0x5827ee]),'ChatWebsiteId':Number(_0x5d245e[_0x8b13('0x68')]['id'])});}}else{socket['emit'](_0x8b13('0x13a'),{'UserId':Number(_0x5d245e[_0x8b13('0x51')][_0x8b13('0x106')]),'ChatWebsiteId':Number(_0x5d245e[_0x8b13('0x68')]['id'])});}});}})['then'](respondWithStatusCode(_0x2b4de7,null))[_0x8b13('0x66')](handleError(_0x2b4de7,null));};exports['getAgents']=function(_0x703e,_0x326163){var _0x503451={};var _0x21dedb={};var _0x50e0b8;var _0x555589;return db[_0x8b13('0x4d')][_0x8b13('0x7d')]({'where':{'id':_0x703e[_0x8b13('0x68')]['id']}})[_0x8b13('0x1d')](handleEntityNotFound(_0x326163,null))[_0x8b13('0x1d')](function(_0x36cbd3){if(_0x36cbd3){_0x50e0b8=_0x36cbd3;_0x21dedb[_0x8b13('0x47')]=_[_0x8b13('0x52')](db['User'][_0x8b13('0x4e')]);_0x21dedb['query']=_[_0x8b13('0x52')](_0x703e[_0x8b13('0x51')]);_0x21dedb[_0x8b13('0x5d')]=_[_0x8b13('0x53')](_0x21dedb[_0x8b13('0x47')],_0x21dedb['query']);_0x503451[_0x8b13('0x54')]=_[_0x8b13('0x53')](_0x21dedb[_0x8b13('0x47')],qs[_0x8b13('0x55')](_0x703e['query'][_0x8b13('0x55')]));_0x503451[_0x8b13('0x54')]=_0x503451['attributes']['length']?_0x503451[_0x8b13('0x54')]:_0x21dedb[_0x8b13('0x47')];_0x503451['order']=qs[_0x8b13('0x5a')](_0x703e[_0x8b13('0x51')][_0x8b13('0x5a')]);_0x503451[_0x8b13('0x5b')]=qs[_0x8b13('0x5d')](_[_0x8b13('0x5c')](_0x703e[_0x8b13('0x51')],_0x21dedb['filters']));if(_0x703e[_0x8b13('0x51')][_0x8b13('0x5e')]){_0x503451['where']=_[_0x8b13('0x5f')](_0x503451[_0x8b13('0x5b')],{'$or':_['map'](_0x503451['attributes'],function(_0x5e3ec8){var _0x24c28c={};_0x24c28c[_0x5e3ec8]={'$like':'%'+_0x703e[_0x8b13('0x51')][_0x8b13('0x5e')]+'%'};return _0x24c28c;})});}_0x503451=_[_0x8b13('0x5f')]({},_0x503451,_0x703e[_0x8b13('0x61')]);return _0x50e0b8[_0x8b13('0x13b')](_0x503451);}})[_0x8b13('0x1d')](function(_0xe679a3){if(_0xe679a3){_0x555589=_0xe679a3['length'];if(!_0x703e[_0x8b13('0x51')][_0x8b13('0x57')](_0x8b13('0x58'))){_0x503451[_0x8b13('0x2d')]=qs[_0x8b13('0x2d')](_0x703e[_0x8b13('0x51')][_0x8b13('0x2d')]);_0x503451[_0x8b13('0x2a')]=qs['offset'](_0x703e[_0x8b13('0x51')][_0x8b13('0x2a')]);}return _0x50e0b8[_0x8b13('0x13b')](_0x503451);}})[_0x8b13('0x1d')](function(_0x5816cd){if(_0x5816cd){return _0x5816cd?{'count':_0x555589,'rows':_0x5816cd}:null;}})[_0x8b13('0x1d')](respondWithResult(_0x326163,null))[_0x8b13('0x66')](handleError(_0x326163,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 9961da4..3dfa82c 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 _0x56e6=['../../mysqldb','ChatWebsite','setMaxListeners','save','update','emit','hasOwnProperty','exports','events'];(function(_0x5a0583,_0x104158){var _0x16488e=function(_0x45ed90){while(--_0x45ed90){_0x5a0583['push'](_0x5a0583['shift']());}};_0x16488e(++_0x104158);}(_0x56e6,0x6b));var _0x656e=function(_0xbd2a8d,_0x451894){_0xbd2a8d=_0xbd2a8d-0x0;var _0x5dc929=_0x56e6[_0xbd2a8d];return _0x5dc929;};'use strict';var EventEmitter=require(_0x656e('0x0'));var ChatWebsite=require(_0x656e('0x1'))['db'][_0x656e('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x656e('0x3')](0x0);var events={'afterCreate':_0x656e('0x4'),'afterUpdate':_0x656e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x40a874){return function(_0x23c947,_0xe7d540,_0x162ffe){ChatWebsiteEvents[_0x656e('0x6')](_0x40a874+':'+_0x23c947['id'],_0x23c947);ChatWebsiteEvents[_0x656e('0x6')](_0x40a874,_0x23c947);_0x162ffe(null);};}for(var e in events){if(events[_0x656e('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x656e('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x6a88=['ChatWebsite','setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x6a88,0xa9));var _0x86a8=function(_0x187d80,_0x5b793f){_0x187d80=_0x187d80-0x0;var _0x498a77=_0x6a88[_0x187d80];return _0x498a77;};'use strict';var EventEmitter=require(_0x86a8('0x0'));var ChatWebsite=require(_0x86a8('0x1'))['db'][_0x86a8('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x86a8('0x3')](0x0);var events={'afterCreate':_0x86a8('0x4'),'afterUpdate':_0x86a8('0x5'),'afterDestroy':_0x86a8('0x6')};function emitEvent(_0x510057){return function(_0x21afeb,_0x5aa681,_0x59313b){ChatWebsiteEvents[_0x86a8('0x7')](_0x510057+':'+_0x21afeb['id'],_0x21afeb);ChatWebsiteEvents[_0x86a8('0x7')](_0x510057,_0x21afeb);_0x59313b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x86a8('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 4a40114..130377b 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 _0xd85e=['bluebird','request-promise','../../config/environment','./chatWebsite.attributes','define','chat_websites','util','../../config/logger','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd85e,0xde));var _0xed85=function(_0x3212a3,_0x59fba4){_0x3212a3=_0x3212a3-0x0;var _0x52275=_0xd85e[_0x3212a3];return _0x52275;};'use strict';var _=require('lodash');var util=require(_0xed85('0x0'));var logger=require(_0xed85('0x1'))('api');var moment=require(_0xed85('0x2'));var BPromise=require(_0xed85('0x3'));var rp=require(_0xed85('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xed85('0x5'));var attributes=require(_0xed85('0x6'));module['exports']=function(_0x4d9fa8,_0x49bed0){return _0x4d9fa8[_0xed85('0x7')]('ChatWebsite',attributes,{'tableName':_0xed85('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bb6=['../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x1be72f,_0x50ca93){var _0xbfdb40=function(_0x572568){while(--_0x572568){_0x1be72f['push'](_0x1be72f['shift']());}};_0xbfdb40(++_0x50ca93);}(_0x4bb6,0x1e5));var _0x64bb=function(_0xe069b2,_0x1259a5){_0xe069b2=_0xe069b2-0x0;var _0x4a9d61=_0x4bb6[_0xe069b2];return _0x4a9d61;};'use strict';var _=require(_0x64bb('0x0'));var util=require(_0x64bb('0x1'));var logger=require('../../config/logger')(_0x64bb('0x2'));var moment=require('moment');var BPromise=require(_0x64bb('0x3'));var rp=require(_0x64bb('0x4'));var fs=require('fs');var path=require(_0x64bb('0x5'));var rimraf=require(_0x64bb('0x6'));var config=require(_0x64bb('0x7'));var attributes=require(_0x64bb('0x8'));module[_0x64bb('0x9')]=function(_0x1422eb,_0x5cdff5){return _0x1422eb[_0x64bb('0xa')](_0x64bb('0xb'),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 6ee51d7..f38c4d3 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 _0x2259=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','code','error','ChatWebsite,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x2259,0x1c7));var _0x9225=function(_0x3927f9,_0x547878){_0x3927f9=_0x3927f9-0x0;var _0x8fae7d=_0x2259[_0x3927f9];return _0x8fae7d;};'use strict';var _=require('lodash');var util=require(_0x9225('0x0'));var moment=require(_0x9225('0x1'));var BPromise=require(_0x9225('0x2'));var rs=require(_0x9225('0x3'));var fs=require('fs');var Redis=require(_0x9225('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9225('0x5'));var logger=require(_0x9225('0x6'))(_0x9225('0x7'));var config=require(_0x9225('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9225('0x9')]['http']({'port':0x232a});config[_0x9225('0xa')]=_[_0x9225('0xb')](config[_0x9225('0xa')],{'host':_0x9225('0xc'),'port':0x18eb});var socket=require(_0x9225('0xd'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x9225('0xe')](socket);function respondWithRpcPromise(_0x59a5a7,_0x1605cc,_0xaef688){return new BPromise(function(_0x5f1ec3,_0x3084b1){return client[_0x9225('0xf')](_0x59a5a7,_0xaef688)[_0x9225('0x10')](function(_0x5580bb){logger[_0x9225('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x1605cc,_0x9225('0x12'));logger[_0x9225('0x13')](_0x9225('0x14'),_0x1605cc,_0x9225('0x12'),JSON[_0x9225('0x15')](_0x5580bb));if(_0x5580bb['error']){if(_0x5580bb['error'][_0x9225('0x16')]===0x1f4){logger[_0x9225('0x17')](_0x9225('0x18'),_0x1605cc,_0x5580bb[_0x9225('0x17')][_0x9225('0x19')]);return _0x3084b1(_0x5580bb['error'][_0x9225('0x19')]);}logger['error'](_0x9225('0x18'),_0x1605cc,_0x5580bb[_0x9225('0x17')][_0x9225('0x19')]);return _0x5f1ec3(_0x5580bb['error'][_0x9225('0x19')]);}else{logger['info'](_0x9225('0x18'),_0x1605cc,_0x9225('0x12'));_0x5f1ec3(_0x5580bb[_0x9225('0x1a')][_0x9225('0x19')]);}})['catch'](function(_0xd90ed2){logger[_0x9225('0x17')](_0x9225('0x18'),_0x1605cc,_0xd90ed2);_0x3084b1(_0xd90ed2);});});} \ No newline at end of file +var _0x36bc=['register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x2dc2f9,_0x3f3394){var _0x7f9396=function(_0x38d080){while(--_0x38d080){_0x2dc2f9['push'](_0x2dc2f9['shift']());}};_0x7f9396(++_0x3f3394);}(_0x36bc,0xd1));var _0xc36b=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x36bc[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0xc36b('0x0'));var util=require(_0xc36b('0x1'));var moment=require(_0xc36b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc36b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc36b('0x4'));var config=require(_0xc36b('0x5'));var jayson=require(_0xc36b('0x6'));var client=jayson[_0xc36b('0x7')][_0xc36b('0x8')]({'port':0x232a});config[_0xc36b('0x9')]=_['defaults'](config['redis'],{'host':_0xc36b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc36b('0x9')]));require('./chatWebsite.socket')[_0xc36b('0xb')](socket);function respondWithRpcPromise(_0xe1f33c,_0x406b10,_0x4e4336){return new BPromise(function(_0x1a2df1,_0x3e8083){return client[_0xc36b('0xc')](_0xe1f33c,_0x4e4336)[_0xc36b('0xd')](function(_0xbfaa78){logger['info'](_0xc36b('0xe'),_0x406b10,'request\x20sent');logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x406b10,_0xc36b('0xf'),JSON[_0xc36b('0x10')](_0xbfaa78));if(_0xbfaa78[_0xc36b('0x11')]){if(_0xbfaa78['error'][_0xc36b('0x12')]===0x1f4){logger[_0xc36b('0x11')](_0xc36b('0xe'),_0x406b10,_0xbfaa78[_0xc36b('0x11')][_0xc36b('0x13')]);return _0x3e8083(_0xbfaa78['error'][_0xc36b('0x13')]);}logger[_0xc36b('0x11')](_0xc36b('0xe'),_0x406b10,_0xbfaa78[_0xc36b('0x11')]['message']);return _0x1a2df1(_0xbfaa78[_0xc36b('0x11')]['message']);}else{logger[_0xc36b('0x14')](_0xc36b('0xe'),_0x406b10,_0xc36b('0xf'));_0x1a2df1(_0xbfaa78[_0xc36b('0x15')]['message']);}})['catch'](function(_0x18a54d){logger[_0xc36b('0x11')](_0xc36b('0xe'),_0x406b10,_0x18a54d);_0x3e8083(_0x18a54d);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index d1a8d79..85c0951 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 _0x46f7=['length','chatWebsite:','./chatWebsite.events','save','remove','update','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x46f7,0x16a));var _0x746f=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x46f7[_0x2b4411];return _0x8e41ef;};'use strict';var ChatWebsiteEvents=require(_0x746f('0x0'));var events=[_0x746f('0x1'),_0x746f('0x2'),_0x746f('0x3')];function createListener(_0x1df0c6,_0x4bd309){return function(_0x3a96ef){_0x4bd309['emit'](_0x1df0c6,_0x3a96ef);};}function removeListener(_0x4efe61,_0x4b7bcd){return function(){ChatWebsiteEvents[_0x746f('0x4')](_0x4efe61,_0x4b7bcd);};}exports[_0x746f('0x5')]=function(_0x7673d0){for(var _0xe5da01=0x0,_0x421875=events[_0x746f('0x6')];_0xe5da01<_0x421875;_0xe5da01++){var _0x29ad43=events[_0xe5da01];var _0x2f90f8=createListener(_0x746f('0x7')+_0x29ad43,_0x7673d0);ChatWebsiteEvents['on'](_0x29ad43,_0x2f90f8);}}; \ No newline at end of file +var _0x2016=['register','chatWebsite:','./chatWebsite.events','save','remove','update','emit','removeListener'];(function(_0x1a9cd8,_0x2d4348){var _0x4fcb0b=function(_0x356822){while(--_0x356822){_0x1a9cd8['push'](_0x1a9cd8['shift']());}};_0x4fcb0b(++_0x2d4348);}(_0x2016,0xb2));var _0x6201=function(_0x592db3,_0x4ad1f9){_0x592db3=_0x592db3-0x0;var _0x2320e7=_0x2016[_0x592db3];return _0x2320e7;};'use strict';var ChatWebsiteEvents=require(_0x6201('0x0'));var events=[_0x6201('0x1'),_0x6201('0x2'),_0x6201('0x3')];function createListener(_0x2d28e7,_0x32e72d){return function(_0x2abacd){_0x32e72d[_0x6201('0x4')](_0x2d28e7,_0x2abacd);};}function removeListener(_0x271273,_0x2e896f){return function(){ChatWebsiteEvents[_0x6201('0x5')](_0x271273,_0x2e896f);};}exports[_0x6201('0x6')]=function(_0xe0cf3d){for(var _0xcc2881=0x0,_0x3302c0=events['length'];_0xcc2881<_0x3302c0;_0xcc2881++){var _0x4e4540=events[_0xcc2881];var _0xa1b91c=createListener(_0x6201('0x7')+_0x4e4540,_0xe0cf3d);ChatWebsiteEvents['on'](_0x4e4540,_0xa1b91c);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index bea9790..dcc5042 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1280=['replace','localhost','test','([\x5cw]+)','../../../utils/misc','url','URL'];(function(_0x300860,_0x509371){var _0x2094ad=function(_0x2090a2){while(--_0x2090a2){_0x300860['push'](_0x300860['shift']());}};_0x2094ad(++_0x509371);}(_0x1280,0xac));var _0x0128=function(_0x559a80,_0x3d193d){_0x559a80=_0x559a80-0x0;var _0x42f555=_0x1280[_0x559a80];return _0x42f555;};var escapeRegExp=require(_0x0128('0x0'))['escapeRegExp'];var URL=require(_0x0128('0x1'))[_0x0128('0x2')];function testWildcardValidity(_0x80931f){var _0xf0c1aa=!![];try{new URL(_0x80931f[_0x0128('0x3')]('*',_0x0128('0x4')));}catch(_0x4bd1f3){_0xf0c1aa=![];}return _0xf0c1aa&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x0128('0x5')](_0x80931f);}function testWebsiteWithWildcard(_0x30da23,_0xa65596){var _0x2631a2;var _0x4aa391=escapeRegExp(_0x30da23['trim']()[_0x0128('0x3')](/\/$/,''))[_0x0128('0x3')]('\x5c*',_0x0128('0x6'));try{new URL(_0x30da23[_0x0128('0x3')]('\x5c*','localhost'));_0x2631a2=new RegExp(_0x4aa391)[_0x0128('0x5')](_0xa65596);}catch(_0x2fa9cb){_0x2631a2=![];}return _0x2631a2;}module['exports']={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x1ab1=['URL','localhost','test','trim','replace','([\x5cw]+)','../../../utils/misc'];(function(_0x4faa2c,_0x2d8ecd){var _0x32514d=function(_0x418f7b){while(--_0x418f7b){_0x4faa2c['push'](_0x4faa2c['shift']());}};_0x32514d(++_0x2d8ecd);}(_0x1ab1,0x12c));var _0x11ab=function(_0x394729,_0x3c0b55){_0x394729=_0x394729-0x0;var _0x1b4e61=_0x1ab1[_0x394729];return _0x1b4e61;};var escapeRegExp=require(_0x11ab('0x0'))['escapeRegExp'];var URL=require('url')[_0x11ab('0x1')];function testWildcardValidity(_0x49ed3f){var _0x593928=!![];try{new URL(_0x49ed3f['replace']('*',_0x11ab('0x2')));}catch(_0x4a6492){_0x593928=![];}return _0x593928&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x11ab('0x3')](_0x49ed3f);}function testWebsiteWithWildcard(_0x363103,_0x1edb9b){var _0x1399f4;var _0x5758c5=escapeRegExp(_0x363103[_0x11ab('0x4')]()[_0x11ab('0x5')](/\/$/,''))[_0x11ab('0x5')]('\x5c*',_0x11ab('0x6'));try{new URL(_0x363103[_0x11ab('0x5')]('\x5c*',_0x11ab('0x2')));_0x1399f4=new RegExp(_0x5758c5)['test'](_0x1edb9b);}catch(_0x1abc4e){_0x1399f4=![];}return _0x1399f4;}module['exports']={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index fbf616d..47a65c7 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 _0xb27c=['/:id/canned_answers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/applications','getApplications','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addDisposition','addAnswer','diskStorage','join','root','format','%s-%s','now','originalname','/:id/logo','single','addLogo','file','addAvatar','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','any','offline','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id','getDispositions'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb27c,0x14f));var _0xcb27=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xb27c[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0xcb27('0x0'));var util=require(_0xcb27('0x1'));var path=require(_0xcb27('0x2'));var timeout=require(_0xcb27('0x3'));var express=require('express');var router=express[_0xcb27('0x4')]();var fs_extra=require(_0xcb27('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcb27('0x6'));var config=require('../../config/environment');var controller=require(_0xcb27('0x7'));router['get']('/',auth[_0xcb27('0x8')](),controller[_0xcb27('0x9')]);router[_0xcb27('0xa')](_0xcb27('0xb'),auth[_0xcb27('0x8')](),controller[_0xcb27('0xc')]);router['get'](_0xcb27('0xd'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/dispositions',auth[_0xcb27('0x8')](),controller[_0xcb27('0xe')]);router[_0xcb27('0xa')](_0xcb27('0xf'),auth[_0xcb27('0x8')](),controller['getAnswers']);router[_0xcb27('0xa')]('/:id/logo',controller[_0xcb27('0x10')]);router[_0xcb27('0xa')](_0xcb27('0x11'),controller[_0xcb27('0x12')]);router['get'](_0xcb27('0x13'),controller[_0xcb27('0x14')]);router[_0xcb27('0xa')](_0xcb27('0x15'),controller['getSystemAvatar']);router[_0xcb27('0xa')](_0xcb27('0x16'),auth[_0xcb27('0x8')](),controller[_0xcb27('0x17')]);router[_0xcb27('0xa')]('/:id/snippet',controller['getSnippet']);router['get'](_0xcb27('0x18'),auth[_0xcb27('0x8')](),controller[_0xcb27('0x19')]);router[_0xcb27('0xa')]('/:id/proactive_actions',auth[_0xcb27('0x8')](),controller['getProactiveActions']);router[_0xcb27('0xa')]('/:id/fields',controller[_0xcb27('0x1a')]);router[_0xcb27('0xa')](_0xcb27('0x1b'),auth[_0xcb27('0x8')](),controller[_0xcb27('0x1c')]);router[_0xcb27('0xa')](_0xcb27('0x1d'),auth['isAuthenticated'](),controller[_0xcb27('0x1e')]);router['post']('/',auth[_0xcb27('0x8')](),controller['create']);router[_0xcb27('0x1f')]('/:id/dispositions',auth[_0xcb27('0x8')](),controller[_0xcb27('0x20')]);router[_0xcb27('0x1f')](_0xcb27('0xf'),auth[_0xcb27('0x8')](),controller[_0xcb27('0x21')]);var upload=multer({'storage':multer[_0xcb27('0x22')]({'destination':function(_0x13051d,_0x10a496,_0x16b8c8){_0x16b8c8(null,path[_0xcb27('0x23')](config[_0xcb27('0x24')],'server/files/images/logos/'));},'filename':function(_0x48f5cd,_0x16a919,_0x38352f){_0x38352f(null,util[_0xcb27('0x25')](_0xcb27('0x26'),Date[_0xcb27('0x27')](),_0x16a919[_0xcb27('0x28')]));}})});router[_0xcb27('0x1f')](_0xcb27('0x29'),upload[_0xcb27('0x2a')]('file'),controller[_0xcb27('0x2b')]);var upload=multer({'storage':multer[_0xcb27('0x22')]({'destination':function(_0x46eed7,_0x2ceb6a,_0x42a740){_0x42a740(null,path[_0xcb27('0x23')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x29d42c,_0x324b6d,_0x28dd37){_0x28dd37(null,util[_0xcb27('0x25')](_0xcb27('0x26'),Date['now'](),_0x324b6d[_0xcb27('0x28')]));}})});router[_0xcb27('0x1f')]('/:id/avatar',upload[_0xcb27('0x2a')](_0xcb27('0x2c')),controller[_0xcb27('0x2d')]);var upload=multer({'storage':multer[_0xcb27('0x22')]({'destination':function(_0x399159,_0x5301f7,_0x55ac68){_0x55ac68(null,path[_0xcb27('0x23')](config[_0xcb27('0x24')],_0xcb27('0x2e')));},'filename':function(_0x55e4f5,_0x2b26ec,_0x298a94){_0x298a94(null,util[_0xcb27('0x25')](_0xcb27('0x26'),Date[_0xcb27('0x27')](),_0x2b26ec['originalname']));}})});router[_0xcb27('0x1f')](_0xcb27('0x13'),upload['single'](_0xcb27('0x2c')),controller[_0xcb27('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3d1d20,_0x2fa236,_0x39d75a){_0x39d75a(null,path[_0xcb27('0x23')](config[_0xcb27('0x24')],_0xcb27('0x2e')));},'filename':function(_0xb3aa11,_0x5d3abd,_0x529f9e){_0x529f9e(null,util[_0xcb27('0x25')]('%s-%s',Date[_0xcb27('0x27')](),_0x5d3abd[_0xcb27('0x28')]));}})});router['post'](_0xcb27('0x15'),upload['single'](_0xcb27('0x2c')),controller[_0xcb27('0x30')]);router[_0xcb27('0x1f')](_0xcb27('0x31'),controller[_0xcb27('0x32')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x193ae3,_0x1cd384,_0x3c64a7){const _0x204788=path[_0xcb27('0x23')](config[_0xcb27('0x24')],_0xcb27('0x33'),_0xcb27('0x34'),_0xcb27('0x35'));fs_extra[_0xcb27('0x36')](_0x204788,function(){_0x3c64a7(null,_0x204788);});},'filename':function(_0x40308c,_0x407b97,_0x48bc5d){const _0x2e3432=_0x407b97['originalname'][_0xcb27('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5b2c26=path[_0xcb27('0x38')](_0x2e3432);const _0x7c1984=Date[_0xcb27('0x27')]()+'-'+_0x2e3432[_0xcb27('0x37')](_0x5b2c26,'')+_0x5b2c26;_0x48bc5d(null,_0x7c1984);}})});router[_0xcb27('0x1f')]('/:id/offline',offlineUploadMulter[_0xcb27('0x39')](),controller[_0xcb27('0x3a')]);router[_0xcb27('0x1f')](_0xcb27('0x16'),auth[_0xcb27('0x8')](),controller[_0xcb27('0x3b')]);router[_0xcb27('0x1f')](_0xcb27('0x18'),auth[_0xcb27('0x8')](),controller[_0xcb27('0x3c')]);router[_0xcb27('0x1f')](_0xcb27('0x3d'),auth[_0xcb27('0x8')](),controller[_0xcb27('0x3e')]);router['post'](_0xcb27('0x1d'),auth[_0xcb27('0x8')](),controller[_0xcb27('0x3f')]);router['put']('/:id',auth[_0xcb27('0x8')](),controller[_0xcb27('0x40')]);router[_0xcb27('0x41')](_0xcb27('0xd'),auth[_0xcb27('0x8')](),controller['destroy']);router[_0xcb27('0x41')]('/:id/dispositions',auth[_0xcb27('0x8')](),controller[_0xcb27('0x42')]);router[_0xcb27('0x41')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xcb27('0x43')]);router[_0xcb27('0x41')]('/:id/users',auth[_0xcb27('0x8')](),controller[_0xcb27('0x44')]);module[_0xcb27('0x45')]=router; \ No newline at end of file +var _0x405b=['/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','format','%s-%s','now','originalname','single','file','diskStorage','join','root','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','extname','replace','any','offline','addApplications','addProactiveActions','put','/:id','update','delete','destroy','removeAnswers','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x5af39d,_0x3944b5){var _0x4a8b97=function(_0x22936e){while(--_0x22936e){_0x5af39d['push'](_0x5af39d['shift']());}};_0x4a8b97(++_0x3944b5);}(_0x405b,0x80));var _0xb405=function(_0x27eab3,_0x751481){_0x27eab3=_0x27eab3-0x0;var _0x25802f=_0x405b[_0x27eab3];return _0x25802f;};'use strict';var multer=require('multer');var util=require(_0xb405('0x0'));var path=require(_0xb405('0x1'));var timeout=require(_0xb405('0x2'));var express=require('express');var router=express[_0xb405('0x3')]();var fs_extra=require(_0xb405('0x4'));var auth=require(_0xb405('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb405('0x6'));var controller=require('./chatWebsite.controller');router[_0xb405('0x7')]('/',auth[_0xb405('0x8')](),controller[_0xb405('0x9')]);router[_0xb405('0x7')](_0xb405('0xa'),auth[_0xb405('0x8')](),controller['describe']);router[_0xb405('0x7')]('/:id',auth[_0xb405('0x8')](),controller[_0xb405('0xb')]);router[_0xb405('0x7')](_0xb405('0xc'),auth[_0xb405('0x8')](),controller[_0xb405('0xd')]);router[_0xb405('0x7')](_0xb405('0xe'),auth[_0xb405('0x8')](),controller[_0xb405('0xf')]);router[_0xb405('0x7')](_0xb405('0x10'),controller[_0xb405('0x11')]);router[_0xb405('0x7')](_0xb405('0x12'),controller[_0xb405('0x13')]);router[_0xb405('0x7')](_0xb405('0x14'),controller['getCustomerAvatar']);router[_0xb405('0x7')](_0xb405('0x15'),controller[_0xb405('0x16')]);router[_0xb405('0x7')](_0xb405('0x17'),auth[_0xb405('0x8')](),controller[_0xb405('0x18')]);router[_0xb405('0x7')](_0xb405('0x19'),controller[_0xb405('0x1a')]);router[_0xb405('0x7')](_0xb405('0x1b'),auth[_0xb405('0x8')](),controller['getApplications']);router[_0xb405('0x7')](_0xb405('0x1c'),auth[_0xb405('0x8')](),controller[_0xb405('0x1d')]);router['get'](_0xb405('0x1e'),controller['getFields']);router[_0xb405('0x7')]('/:id/offline_messages',auth['isAuthenticated'](),controller[_0xb405('0x1f')]);router[_0xb405('0x7')](_0xb405('0x20'),auth[_0xb405('0x8')](),controller['getAgents']);router[_0xb405('0x21')]('/',auth[_0xb405('0x8')](),controller[_0xb405('0x22')]);router['post'](_0xb405('0xc'),auth['isAuthenticated'](),controller[_0xb405('0x23')]);router[_0xb405('0x21')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xb405('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4d4ce4,_0x1e36f5,_0x20eb1a){_0x20eb1a(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0xe764,_0xafaf79,_0x26d092){_0x26d092(null,util[_0xb405('0x25')](_0xb405('0x26'),Date[_0xb405('0x27')](),_0xafaf79[_0xb405('0x28')]));}})});router[_0xb405('0x21')](_0xb405('0x10'),upload[_0xb405('0x29')](_0xb405('0x2a')),controller['addLogo']);var upload=multer({'storage':multer[_0xb405('0x2b')]({'destination':function(_0xc99531,_0x503c4e,_0x31101d){_0x31101d(null,path[_0xb405('0x2c')](config[_0xb405('0x2d')],_0xb405('0x2e')));},'filename':function(_0x1d192e,_0x322fec,_0x4ff3f5){_0x4ff3f5(null,util[_0xb405('0x25')]('%s-%s',Date[_0xb405('0x27')](),_0x322fec[_0xb405('0x28')]));}})});router[_0xb405('0x21')](_0xb405('0x12'),upload['single']('file'),controller['addAvatar']);var upload=multer({'storage':multer[_0xb405('0x2b')]({'destination':function(_0x4c1b16,_0x511a09,_0x57ec9b){_0x57ec9b(null,path[_0xb405('0x2c')](config[_0xb405('0x2d')],_0xb405('0x2e')));},'filename':function(_0x59b499,_0x343604,_0x29f4c9){_0x29f4c9(null,util[_0xb405('0x25')](_0xb405('0x26'),Date[_0xb405('0x27')](),_0x343604[_0xb405('0x28')]));}})});router['post'](_0xb405('0x14'),upload['single'](_0xb405('0x2a')),controller[_0xb405('0x2f')]);var upload=multer({'storage':multer[_0xb405('0x2b')]({'destination':function(_0x2e2189,_0x5329d0,_0x2e5f02){_0x2e5f02(null,path[_0xb405('0x2c')](config[_0xb405('0x2d')],_0xb405('0x2e')));},'filename':function(_0x5630c0,_0x639e64,_0x258808){_0x258808(null,util[_0xb405('0x25')](_0xb405('0x26'),Date[_0xb405('0x27')](),_0x639e64['originalname']));}})});router['post']('/:id/system_avatar',upload['single']('file'),controller[_0xb405('0x30')]);router[_0xb405('0x21')](_0xb405('0x31'),controller[_0xb405('0x32')]);const offlineUploadMulter=multer({'storage':multer[_0xb405('0x2b')]({'destination':function(_0x1beb74,_0x282f11,_0x85be36){const _0x5202d1=path['join'](config[_0xb405('0x2d')],_0xb405('0x33'),_0xb405('0x34'),_0xb405('0x35'));fs_extra[_0xb405('0x36')](_0x5202d1,function(){_0x85be36(null,_0x5202d1);});},'filename':function(_0x5232e4,_0xb96436,_0x2915df){const _0x5ca3ef=_0xb96436[_0xb405('0x28')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x150368=path[_0xb405('0x37')](_0x5ca3ef);const _0x410c9d=Date[_0xb405('0x27')]()+'-'+_0x5ca3ef[_0xb405('0x38')](_0x150368,'')+_0x150368;_0x2915df(null,_0x410c9d);}})});router[_0xb405('0x21')]('/:id/offline',offlineUploadMulter[_0xb405('0x39')](),controller[_0xb405('0x3a')]);router[_0xb405('0x21')]('/:id/interactions',auth[_0xb405('0x8')](),controller['addInteraction']);router['post']('/:id/applications',auth[_0xb405('0x8')](),controller[_0xb405('0x3b')]);router[_0xb405('0x21')]('/:id/proactive_actions',auth[_0xb405('0x8')](),controller[_0xb405('0x3c')]);router['post'](_0xb405('0x20'),auth[_0xb405('0x8')](),controller['addAgents']);router[_0xb405('0x3d')](_0xb405('0x3e'),auth[_0xb405('0x8')](),controller[_0xb405('0x3f')]);router[_0xb405('0x40')]('/:id',auth[_0xb405('0x8')](),controller[_0xb405('0x41')]);router['delete'](_0xb405('0xc'),auth[_0xb405('0x8')](),controller['removeDispositions']);router[_0xb405('0x40')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xb405('0x42')]);router['delete'](_0xb405('0x20'),auth[_0xb405('0x8')](),controller[_0xb405('0x43')]);module[_0xb405('0x44')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 4f84595..de9a884 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x03fc=['Router','env','app','get','expressEndpoint','use','isAuthenticated','beaver-logger/server','express','../components/auth/service'];(function(_0x3d8d04,_0x51536b){var _0x43b01a=function(_0x330909){while(--_0x330909){_0x3d8d04['push'](_0x3d8d04['shift']());}};_0x43b01a(++_0x51536b);}(_0x03fc,0xa7));var _0xc03f=function(_0x20db6c,_0x4ff24a){_0x20db6c=_0x20db6c-0x0;var _0x30b5d3=_0x03fc[_0x20db6c];return _0x30b5d3;};var beaverLogger=require(_0xc03f('0x0'));var express=require(_0xc03f('0x1'));var auth=require(_0xc03f('0x2'));var config=require('../config/environment');var router=express[_0xc03f('0x3')]();var isProduction=config[_0xc03f('0x4')]==='production'||![];function clientSideLogs(_0x4c5ced,_0x18a083,_0x3fd4dd){var _0x372de6=_0x4c5ced[_0xc03f('0x5')][_0xc03f('0x6')]('client-side-logger');if(!_0x372de6){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0xc03f('0x7')]({'uri':'/client-logs','logger':_0x372de6,'enableCors':!isProduction})(_0x4c5ced,_0x18a083,_0x3fd4dd);}router[_0xc03f('0x8')](auth[_0xc03f('0x9')](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0x8d85=['../config/environment','Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','isAuthenticated','exports','beaver-logger/server','express'];(function(_0x4626c2,_0x69aced){var _0x4dec86=function(_0x1a92a9){while(--_0x1a92a9){_0x4626c2['push'](_0x4626c2['shift']());}};_0x4dec86(++_0x69aced);}(_0x8d85,0x16a));var _0x58d8=function(_0x30308a,_0x178f66){_0x30308a=_0x30308a-0x0;var _0x13771c=_0x8d85[_0x30308a];return _0x13771c;};var beaverLogger=require(_0x58d8('0x0'));var express=require(_0x58d8('0x1'));var auth=require('../components/auth/service');var config=require(_0x58d8('0x2'));var router=express[_0x58d8('0x3')]();var isProduction=config[_0x58d8('0x4')]===_0x58d8('0x5')||![];function clientSideLogs(_0x45d62b,_0x3b1476,_0x216962){var _0x3308d0=_0x45d62b[_0x58d8('0x6')][_0x58d8('0x7')](_0x58d8('0x8'));if(!_0x3308d0){throw new Error(_0x58d8('0x9'));}return beaverLogger[_0x58d8('0xa')]({'uri':'/client-logs','logger':_0x3308d0,'enableCors':!isProduction})(_0x45d62b,_0x3b1476,_0x216962);}router['use'](auth[_0x58d8('0xb')](),clientSideLogs);module[_0x58d8('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index d419571..05017ae 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 _0xdae5=['TEXT','MicrosoftAzure\x20=>\x20refresh_token','sequelize','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri'];(function(_0x504b79,_0x4115b0){var _0x10f21a=function(_0x36dcb9){while(--_0x36dcb9){_0x504b79['push'](_0x504b79['shift']());}};_0x10f21a(++_0x4115b0);}(_0xdae5,0xe2));var _0x5dae=function(_0x42c32e,_0x54a035){_0x42c32e=_0x42c32e-0x0;var _0xee9088=_0xdae5[_0x42c32e];return _0xee9088;};'use strict';var Sequelize=require(_0x5dae('0x0'));module['exports']={'name':{'type':Sequelize[_0x5dae('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x5dae('0x2')](_0x5dae('0x3'),_0x5dae('0x4'),_0x5dae('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x5dae('0x2')](_0x5dae('0x6'),_0x5dae('0x7'))},'data1':{'type':Sequelize[_0x5dae('0x1')],'comment':_0x5dae('0x8')},'data2':{'type':Sequelize[_0x5dae('0x1')],'comment':_0x5dae('0x9')},'data3':{'type':Sequelize[_0x5dae('0x1')],'comment':_0x5dae('0xa')},'data4':{'type':Sequelize['STRING'],'comment':_0x5dae('0xb')},'data5':{'type':Sequelize[_0x5dae('0xc')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize['TEXT'],'comment':_0x5dae('0xd')},'data7':{'type':Sequelize[_0x5dae('0xc')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0xcf36=['MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','Dynamics365'];(function(_0x2c0acf,_0x310413){var _0x513851=function(_0x4105b0){while(--_0x4105b0){_0x2c0acf['push'](_0x2c0acf['shift']());}};_0x513851(++_0x310413);}(_0xcf36,0x1b9));var _0x6cf3=function(_0x288522,_0x18a6d8){_0x288522=_0x288522-0x0;var _0x37851f=_0xcf36[_0x288522];return _0x37851f;};'use strict';var Sequelize=require(_0x6cf3('0x0'));module[_0x6cf3('0x1')]={'name':{'type':Sequelize[_0x6cf3('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x6cf3('0x3')](_0x6cf3('0x4'),_0x6cf3('0x5'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x6cf3('0x3')]('Outlook365',_0x6cf3('0x6'))},'data1':{'type':Sequelize[_0x6cf3('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize['STRING'],'comment':_0x6cf3('0x7')},'data3':{'type':Sequelize[_0x6cf3('0x2')],'comment':_0x6cf3('0x8')},'data4':{'type':Sequelize[_0x6cf3('0x2')],'comment':_0x6cf3('0x9')},'data5':{'type':Sequelize['TEXT'],'comment':_0x6cf3('0xa')},'data6':{'type':Sequelize['TEXT'],'comment':_0x6cf3('0xb')},'data7':{'type':Sequelize[_0x6cf3('0xc')],'comment':_0x6cf3('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 78848e9..6118190 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 _0xba32=['MicrosoftAzure','create','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','update','params','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','state','base64','toString','ascii','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','limit','count','offset','set','destroy','then','error','stack','name','send','padEnd','slice','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','options','CloudProvider','includeAll','include','findAll','rows','service','decryptString','data3','catch','show','keys','find'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xba32,0x87));var _0x2ba3=function(_0x155574,_0x4e0b0b){_0x155574=_0x155574-0x0;var _0x56b559=_0xba32[_0x155574];return _0x56b559;};'use strict';var _=require(_0x2ba3('0x0'));var Redis=require(_0x2ba3('0x1'));var qs=require(_0x2ba3('0x2'));var encryptor=require(_0x2ba3('0x3'));var config=require(_0x2ba3('0x4'));var logger=require('../../config/logger')(_0x2ba3('0x5'));var db=require(_0x2ba3('0x6'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x2ba3('0x7')]=_[_0x2ba3('0x8')](config[_0x2ba3('0x7')],{'host':_0x2ba3('0x9'),'port':0x18eb});var socket=require(_0x2ba3('0xa'))(new Redis(config[_0x2ba3('0x7')]));var redis=new Redis(config[_0x2ba3('0x7')]);function respondWithStatusCode(_0x14b7d2,_0x31b888){_0x31b888=_0x31b888||0xcc;return function(_0x30b983){if(_0x30b983){return _0x14b7d2[_0x2ba3('0xb')](_0x31b888);}return _0x14b7d2['status'](_0x31b888)[_0x2ba3('0xc')]();};}function respondWithResult(_0xa49de5,_0x30eeee){_0x30eeee=_0x30eeee||0xc8;return function(_0x279ad9){if(_0x279ad9){return _0xa49de5[_0x2ba3('0xd')](_0x30eeee)['json'](_0x279ad9);}};}function respondWithFilteredResult(_0x55fe19,_0x471916){return function(_0x5eb79c){if(_0x5eb79c){var _0x271ede=typeof _0x471916['offset']==='undefined'&&typeof _0x471916[_0x2ba3('0xe')]==='undefined';var _0x29887f=_0x5eb79c[_0x2ba3('0xf')];var _0x5b972b=_0x271ede?0x0:_0x471916[_0x2ba3('0x10')];var _0x146376=_0x271ede?_0x5eb79c[_0x2ba3('0xf')]:_0x471916['offset']+_0x471916[_0x2ba3('0xe')];var _0x4408d4;if(_0x146376>=_0x29887f){_0x146376=_0x29887f;_0x4408d4=0xc8;}else{_0x4408d4=0xce;}_0x55fe19[_0x2ba3('0xd')](_0x4408d4);return _0x55fe19[_0x2ba3('0x11')]('Content-Range',_0x5b972b+'-'+_0x146376+'/'+_0x29887f)['json'](_0x5eb79c);}return null;};}function saveUpdates(_0x415599){return function(_0x283c18){if(_0x283c18){return _0x283c18['update'](_0x415599)['then'](function(_0x35ad80){return _0x35ad80;});}return null;};}function removeEntity(_0x385150){return function(_0x50cf36){if(_0x50cf36){return _0x50cf36[_0x2ba3('0x12')]()[_0x2ba3('0x13')](function(){_0x385150[_0x2ba3('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45814b){return function(_0x48fe2d){if(!_0x48fe2d){_0x45814b[_0x2ba3('0xb')](0x194);}return _0x48fe2d;};}function handleError(_0x42aaac,_0x479a1b){_0x479a1b=_0x479a1b||0x1f4;return function(_0x31173a){logger[_0x2ba3('0x14')](_0x31173a[_0x2ba3('0x15')]);if(_0x31173a[_0x2ba3('0x16')]){delete _0x31173a['name'];}_0x42aaac[_0x2ba3('0xd')](_0x479a1b)[_0x2ba3('0x17')](_0x31173a);};}function maskClientSecret(_0x2c85ff){return _[_0x2ba3('0x18')](_0x2c85ff[_0x2ba3('0x19')](0x0,0x3),0x14,'*');}exports[_0x2ba3('0x1a')]=function(_0x126093,_0x7467a6){var _0x5cd739={},_0x1c018d={},_0x31d24e={'count':0x0,'rows':[]};var _0x164a77=_[_0x2ba3('0x1b')](db['CloudProvider'][_0x2ba3('0x1c')],function(_0x5c8166){return{'name':_0x5c8166[_0x2ba3('0x1d')],'type':_0x5c8166[_0x2ba3('0x1e')][_0x2ba3('0x1f')]};});_0x1c018d[_0x2ba3('0x20')]=_[_0x2ba3('0x1b')](_0x164a77,'name');_0x1c018d[_0x2ba3('0x21')]=_['keys'](_0x126093[_0x2ba3('0x21')]);_0x1c018d[_0x2ba3('0x22')]=_[_0x2ba3('0x23')](_0x1c018d[_0x2ba3('0x20')],_0x1c018d[_0x2ba3('0x21')]);_0x5cd739['attributes']=_[_0x2ba3('0x23')](_0x1c018d[_0x2ba3('0x20')],qs[_0x2ba3('0x24')](_0x126093[_0x2ba3('0x21')][_0x2ba3('0x24')]));_0x5cd739['attributes']=_0x5cd739[_0x2ba3('0x25')][_0x2ba3('0x26')]?_0x5cd739[_0x2ba3('0x25')]:_0x1c018d[_0x2ba3('0x20')];if(!_0x126093[_0x2ba3('0x21')][_0x2ba3('0x27')]('nolimit')){_0x5cd739['limit']=qs['limit'](_0x126093[_0x2ba3('0x21')]['limit']);_0x5cd739[_0x2ba3('0x10')]=qs[_0x2ba3('0x10')](_0x126093[_0x2ba3('0x21')][_0x2ba3('0x10')]);}_0x5cd739[_0x2ba3('0x28')]=qs[_0x2ba3('0x29')](_0x126093[_0x2ba3('0x21')][_0x2ba3('0x29')]);_0x5cd739['where']=qs['filters'](_['pick'](_0x126093[_0x2ba3('0x21')],_0x1c018d['filters']),_0x164a77);if(_0x126093[_0x2ba3('0x21')][_0x2ba3('0x2a')]){_0x5cd739['where']=_[_0x2ba3('0x2b')](_0x5cd739[_0x2ba3('0x2c')],{'$or':_[_0x2ba3('0x1b')](_0x164a77,function(_0x512626){if(_0x512626[_0x2ba3('0x1e')]!==_0x2ba3('0x2d')){var _0x5430ff={};_0x5430ff[_0x512626[_0x2ba3('0x16')]]={'$like':'%'+_0x126093[_0x2ba3('0x21')]['filter']+'%'};return _0x5430ff;}})});}_0x5cd739=_[_0x2ba3('0x2b')]({},_0x5cd739,_0x126093[_0x2ba3('0x2e')]);var _0x5c3d66={'where':_0x5cd739[_0x2ba3('0x2c')]};return db[_0x2ba3('0x2f')][_0x2ba3('0xf')](_0x5c3d66)['then'](function(_0x156c72){_0x31d24e['count']=_0x156c72;if(_0x126093[_0x2ba3('0x21')][_0x2ba3('0x30')]){_0x5cd739[_0x2ba3('0x31')]=[{'all':!![]}];}return db[_0x2ba3('0x2f')][_0x2ba3('0x32')](_0x5cd739);})['then'](function(_0x3a36f0){_0x31d24e[_0x2ba3('0x33')]=_[_0x2ba3('0x1b')](_0x3a36f0,function(_0x346987){if(_0x346987[_0x2ba3('0x34')]==='MicrosoftAzure'){var _0x193379=encryptor[_0x2ba3('0x35')](_0x346987['data3']);_0x346987[_0x2ba3('0x36')]=maskClientSecret(_0x193379);}return _0x346987;});return _0x31d24e;})['then'](respondWithFilteredResult(_0x7467a6,_0x5cd739))[_0x2ba3('0x37')](handleError(_0x7467a6,null));};exports[_0x2ba3('0x38')]=function(_0xc224bf,_0x21f57e){var _0x5d1f03={'raw':!![],'where':{'id':_0xc224bf['params']['id']}},_0x190ca8={};_0x190ca8['model']=_['keys'](db['CloudProvider'][_0x2ba3('0x1c')]);_0x190ca8[_0x2ba3('0x21')]=_[_0x2ba3('0x39')](_0xc224bf[_0x2ba3('0x21')]);_0x190ca8[_0x2ba3('0x22')]=_[_0x2ba3('0x23')](_0x190ca8[_0x2ba3('0x20')],_0x190ca8['query']);_0x5d1f03['attributes']=_['intersection'](_0x190ca8['model'],qs[_0x2ba3('0x24')](_0xc224bf['query'][_0x2ba3('0x24')]));_0x5d1f03['attributes']=_0x5d1f03[_0x2ba3('0x25')]['length']?_0x5d1f03[_0x2ba3('0x25')]:_0x190ca8[_0x2ba3('0x20')];if(_0xc224bf[_0x2ba3('0x21')][_0x2ba3('0x30')]){_0x5d1f03[_0x2ba3('0x31')]=[{'all':!![]}];}_0x5d1f03=_[_0x2ba3('0x2b')]({},_0x5d1f03,_0xc224bf[_0x2ba3('0x2e')]);return db['CloudProvider'][_0x2ba3('0x3a')](_0x5d1f03)[_0x2ba3('0x13')](handleEntityNotFound(_0x21f57e,null))[_0x2ba3('0x13')](function(_0x532dd9){if(_0x532dd9['service']===_0x2ba3('0x3b')){var _0x4fc569=encryptor[_0x2ba3('0x35')](_0x532dd9[_0x2ba3('0x36')]);_0x532dd9[_0x2ba3('0x36')]=maskClientSecret(_0x4fc569);}return _0x532dd9;})['then'](respondWithResult(_0x21f57e,null))['catch'](handleError(_0x21f57e,null));};exports[_0x2ba3('0x3c')]=function(_0x57eeda,_0x3ca4db){if(!_0x57eeda['body'][_0x2ba3('0x16')])throw new Error(_0x2ba3('0x3d'));if(!_0x57eeda[_0x2ba3('0x3e')]['service'])throw new Error(_0x2ba3('0x3f'));var _0x33f1a4=db['CloudProvider'][_0x2ba3('0x1c')]['service'][_0x2ba3('0x40')];if(!_0x33f1a4[_0x2ba3('0x41')](_0x57eeda['body'][_0x2ba3('0x34')]))throw new Error(_0x2ba3('0x42')+_0x33f1a4[_0x2ba3('0x43')](',\x20'));if(_0x57eeda[_0x2ba3('0x3e')][_0x2ba3('0x34')]==='MicrosoftAzure'&&_0x57eeda[_0x2ba3('0x3e')][_0x2ba3('0x36')]){_0x57eeda[_0x2ba3('0x3e')]['data3']=encryptor[_0x2ba3('0x44')](_0x57eeda[_0x2ba3('0x3e')]['data3']);}return db[_0x2ba3('0x2f')][_0x2ba3('0x3c')](_0x57eeda[_0x2ba3('0x3e')],{})[_0x2ba3('0x13')](respondWithResult(_0x3ca4db,0xc9))[_0x2ba3('0x37')](handleError(_0x3ca4db,null));};exports[_0x2ba3('0x45')]=function(_0x46c6c7,_0x3279d0){if(_0x46c6c7[_0x2ba3('0x3e')]['id']){delete _0x46c6c7['body']['id'];}return db[_0x2ba3('0x2f')][_0x2ba3('0x3a')]({'where':{'id':_0x46c6c7['params']['id']}})[_0x2ba3('0x13')](handleEntityNotFound(_0x3279d0,null))[_0x2ba3('0x13')](function(_0x5c4662){if(_0x5c4662[_0x2ba3('0x34')]===_0x2ba3('0x3b')&&_0x46c6c7[_0x2ba3('0x3e')][_0x2ba3('0x36')]){_0x46c6c7['body']['data3']=encryptor[_0x2ba3('0x44')](_0x46c6c7['body'][_0x2ba3('0x36')]);}return _0x5c4662;})[_0x2ba3('0x13')](saveUpdates(_0x46c6c7[_0x2ba3('0x3e')],null))[_0x2ba3('0x13')](respondWithResult(_0x3279d0,null))[_0x2ba3('0x37')](handleError(_0x3279d0,null));};exports[_0x2ba3('0x12')]=function(_0x5b0cae,_0xae7f31){return db[_0x2ba3('0x2f')]['find']({'where':{'id':_0x5b0cae[_0x2ba3('0x46')]['id']}})[_0x2ba3('0x13')](handleEntityNotFound(_0xae7f31,null))['then'](removeEntity(_0xae7f31,null))['catch'](handleError(_0xae7f31,null));};exports['oauth2MicrosoftAuthorize']=function(_0x3be2ed,_0x21b3c3){return db['CloudProvider'][_0x2ba3('0x47')]({'where':{'id':_0x3be2ed[_0x2ba3('0x46')]['id']},'raw':!![]})[_0x2ba3('0x13')](function(_0x52460a){if(!_0x52460a)return _0x21b3c3[_0x2ba3('0xb')](0x194);return{'url':oauth[_0x2ba3('0x48')](_0x52460a,_0x3be2ed[_0x2ba3('0x49')]['id'])};})['then'](respondWithResult(_0x21b3c3,null))[_0x2ba3('0x37')](handleError(_0x21b3c3,null));};exports[_0x2ba3('0x4a')]=function(_0x46ea19,_0xb3df64){var _0x1b013b=_0x46ea19[_0x2ba3('0x3e')];var _0x314d69;var _0x168d9d;if(_0x1b013b[_0x2ba3('0x14')])throw _0x1b013b;redis[_0x2ba3('0x4b')](_0x1b013b['state'])['then'](function(_0x3a6207){if(!_0x3a6207)throw new Error(_0x2ba3('0x4c'));_0x314d69=JSON[_0x2ba3('0x4d')](_0x3a6207);var _0x21a864=Buffer['from'](_0x1b013b[_0x2ba3('0x4e')],_0x2ba3('0x4f'))[_0x2ba3('0x50')](_0x2ba3('0x51'));_0x168d9d=JSON[_0x2ba3('0x4d')](_0x21a864);if(!oauth['isValidIdToken'](_0x1b013b['id_token'],_0x314d69['oauth2Claims']))throw new Error(_0x2ba3('0x52'));redis[_0x2ba3('0x53')](_0x1b013b[_0x2ba3('0x4e')]);return oauth[_0x2ba3('0x54')](_0x1b013b[_0x2ba3('0x55')],_0x314d69);})[_0x2ba3('0x13')](function(_0x2e3102){_0x314d69['data5']=_0x2e3102[_0x2ba3('0x56')];_0x314d69[_0x2ba3('0x57')]=_0x2e3102[_0x2ba3('0x58')];return db[_0x2ba3('0x2f')][_0x2ba3('0x45')]({'data5':_0x314d69[_0x2ba3('0x59')],'data6':_0x314d69[_0x2ba3('0x57')]},{'where':{'id':_0x314d69['id']}});})['then'](function(){oauth[_0x2ba3('0x5a')](_0x314d69);socket[_0x2ba3('0x5b')](_0x2ba3('0x5c'),{'id':_0x168d9d['id']});return;})['then'](respondWithStatusCode(_0xb3df64,null))['catch'](function(_0x4c88c2){if(_0x168d9d){socket['emit'](_0x2ba3('0x5d'),{'id':_0x168d9d['id']});}if(!_0x314d69){logger[_0x2ba3('0x14')](_0x2ba3('0x5e'),_0x4c88c2);return _0xb3df64[_0x2ba3('0xd')](0x1f4)[_0x2ba3('0x17')](_0x4c88c2[_0x2ba3('0x5f')]);}logger[_0x2ba3('0x14')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x314d69['id'],JSON[_0x2ba3('0x60')](_0x4c88c2));});}; \ No newline at end of file +var _0xaa45=['generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','from','state','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','data5','data6','startRefreshInterval','emit','microsoftAuthorization:success','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','end','error','name','slice','index','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','rows','service','MicrosoftAzure','show','options','find','decryptString','data3','create','body','Name\x20parameter\x20not\x20specified','includes','join','encryptString','update','params','catch','destroy','oauth2MicrosoftAuthorize'];(function(_0xb83ec2,_0x18e73b){var _0x4d2fbf=function(_0x16538a){while(--_0x16538a){_0xb83ec2['push'](_0xb83ec2['shift']());}};_0x4d2fbf(++_0x18e73b);}(_0xaa45,0x130));var _0x5aa4=function(_0x421725,_0x318a04){_0x421725=_0x421725-0x0;var _0x51b322=_0xaa45[_0x421725];return _0x51b322;};'use strict';var _=require('lodash');var Redis=require(_0x5aa4('0x0'));var qs=require(_0x5aa4('0x1'));var encryptor=require(_0x5aa4('0x2'));var config=require(_0x5aa4('0x3'));var logger=require(_0x5aa4('0x4'))('api');var db=require(_0x5aa4('0x5'))['db'];var oauth=require(_0x5aa4('0x6'));config[_0x5aa4('0x7')]=_[_0x5aa4('0x8')](config[_0x5aa4('0x7')],{'host':_0x5aa4('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5aa4('0x7')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x45b863,_0x4c819d){_0x4c819d=_0x4c819d||0xcc;return function(_0x3b8194){if(_0x3b8194){return _0x45b863[_0x5aa4('0xa')](_0x4c819d);}return _0x45b863['status'](_0x4c819d)['end']();};}function respondWithResult(_0x16c984,_0x2dcedf){_0x2dcedf=_0x2dcedf||0xc8;return function(_0x52d7f7){if(_0x52d7f7){return _0x16c984[_0x5aa4('0xb')](_0x2dcedf)[_0x5aa4('0xc')](_0x52d7f7);}};}function respondWithFilteredResult(_0x22b797,_0x3a4443){return function(_0x51811f){if(_0x51811f){var _0x5cd221=typeof _0x3a4443[_0x5aa4('0xd')]===_0x5aa4('0xe')&&typeof _0x3a4443[_0x5aa4('0xf')]===_0x5aa4('0xe');var _0x2a61fc=_0x51811f[_0x5aa4('0x10')];var _0x28df28=_0x5cd221?0x0:_0x3a4443['offset'];var _0x263a28=_0x5cd221?_0x51811f[_0x5aa4('0x10')]:_0x3a4443[_0x5aa4('0xd')]+_0x3a4443[_0x5aa4('0xf')];var _0x7f576;if(_0x263a28>=_0x2a61fc){_0x263a28=_0x2a61fc;_0x7f576=0xc8;}else{_0x7f576=0xce;}_0x22b797[_0x5aa4('0xb')](_0x7f576);return _0x22b797[_0x5aa4('0x11')](_0x5aa4('0x12'),_0x28df28+'-'+_0x263a28+'/'+_0x2a61fc)[_0x5aa4('0xc')](_0x51811f);}return null;};}function saveUpdates(_0x5972f5){return function(_0x503957){if(_0x503957){return _0x503957['update'](_0x5972f5)[_0x5aa4('0x13')](function(_0x3b6a03){return _0x3b6a03;});}return null;};}function removeEntity(_0x1e0eb7){return function(_0x167e0f){if(_0x167e0f){return _0x167e0f['destroy']()[_0x5aa4('0x13')](function(){_0x1e0eb7[_0x5aa4('0xb')](0xcc)[_0x5aa4('0x14')]();});}};}function handleEntityNotFound(_0x58bcf5){return function(_0x53b970){if(!_0x53b970){_0x58bcf5[_0x5aa4('0xa')](0x194);}return _0x53b970;};}function handleError(_0x513da0,_0x9353b3){_0x9353b3=_0x9353b3||0x1f4;return function(_0x94010c){logger[_0x5aa4('0x15')](_0x94010c['stack']);if(_0x94010c[_0x5aa4('0x16')]){delete _0x94010c[_0x5aa4('0x16')];}_0x513da0[_0x5aa4('0xb')](_0x9353b3)['send'](_0x94010c);};}function maskClientSecret(_0x528ea3){return _['padEnd'](_0x528ea3[_0x5aa4('0x17')](0x0,0x3),0x14,'*');}exports[_0x5aa4('0x18')]=function(_0x1efd00,_0x128395){var _0x11ed4c={},_0x5d32a3={},_0x35b197={'count':0x0,'rows':[]};var _0xca403b=_['map'](db[_0x5aa4('0x19')][_0x5aa4('0x1a')],function(_0x42b26d){return{'name':_0x42b26d[_0x5aa4('0x1b')],'type':_0x42b26d[_0x5aa4('0x1c')][_0x5aa4('0x1d')]};});_0x5d32a3[_0x5aa4('0x1e')]=_['map'](_0xca403b,'name');_0x5d32a3[_0x5aa4('0x1f')]=_[_0x5aa4('0x20')](_0x1efd00[_0x5aa4('0x1f')]);_0x5d32a3[_0x5aa4('0x21')]=_[_0x5aa4('0x22')](_0x5d32a3[_0x5aa4('0x1e')],_0x5d32a3[_0x5aa4('0x1f')]);_0x11ed4c[_0x5aa4('0x23')]=_[_0x5aa4('0x22')](_0x5d32a3[_0x5aa4('0x1e')],qs['fields'](_0x1efd00['query'][_0x5aa4('0x24')]));_0x11ed4c[_0x5aa4('0x23')]=_0x11ed4c[_0x5aa4('0x23')][_0x5aa4('0x25')]?_0x11ed4c[_0x5aa4('0x23')]:_0x5d32a3['model'];if(!_0x1efd00[_0x5aa4('0x1f')][_0x5aa4('0x26')]('nolimit')){_0x11ed4c['limit']=qs[_0x5aa4('0xf')](_0x1efd00[_0x5aa4('0x1f')]['limit']);_0x11ed4c['offset']=qs['offset'](_0x1efd00['query'][_0x5aa4('0xd')]);}_0x11ed4c[_0x5aa4('0x27')]=qs[_0x5aa4('0x28')](_0x1efd00[_0x5aa4('0x1f')]['sort']);_0x11ed4c[_0x5aa4('0x29')]=qs[_0x5aa4('0x21')](_[_0x5aa4('0x2a')](_0x1efd00[_0x5aa4('0x1f')],_0x5d32a3[_0x5aa4('0x21')]),_0xca403b);if(_0x1efd00[_0x5aa4('0x1f')][_0x5aa4('0x2b')]){_0x11ed4c['where']=_[_0x5aa4('0x2c')](_0x11ed4c[_0x5aa4('0x29')],{'$or':_[_0x5aa4('0x2d')](_0xca403b,function(_0x1e96cc){if(_0x1e96cc[_0x5aa4('0x1c')]!==_0x5aa4('0x2e')){var _0x4d0af4={};_0x4d0af4[_0x1e96cc[_0x5aa4('0x16')]]={'$like':'%'+_0x1efd00[_0x5aa4('0x1f')][_0x5aa4('0x2b')]+'%'};return _0x4d0af4;}})});}_0x11ed4c=_[_0x5aa4('0x2c')]({},_0x11ed4c,_0x1efd00['options']);var _0x115c2c={'where':_0x11ed4c['where']};return db[_0x5aa4('0x19')][_0x5aa4('0x10')](_0x115c2c)[_0x5aa4('0x13')](function(_0x1c3de9){_0x35b197[_0x5aa4('0x10')]=_0x1c3de9;if(_0x1efd00[_0x5aa4('0x1f')][_0x5aa4('0x2f')]){_0x11ed4c['include']=[{'all':!![]}];}return db[_0x5aa4('0x19')][_0x5aa4('0x30')](_0x11ed4c);})[_0x5aa4('0x13')](function(_0x594b95){_0x35b197[_0x5aa4('0x31')]=_[_0x5aa4('0x2d')](_0x594b95,function(_0x1aaaf1){if(_0x1aaaf1[_0x5aa4('0x32')]===_0x5aa4('0x33')){var _0x5ddb60=encryptor['decryptString'](_0x1aaaf1['data3']);_0x1aaaf1['data3']=maskClientSecret(_0x5ddb60);}return _0x1aaaf1;});return _0x35b197;})['then'](respondWithFilteredResult(_0x128395,_0x11ed4c))['catch'](handleError(_0x128395,null));};exports[_0x5aa4('0x34')]=function(_0x288e99,_0x58cd00){var _0x5b841b={'raw':!![],'where':{'id':_0x288e99['params']['id']}},_0x16d0f4={};_0x16d0f4[_0x5aa4('0x1e')]=_[_0x5aa4('0x20')](db[_0x5aa4('0x19')]['rawAttributes']);_0x16d0f4['query']=_[_0x5aa4('0x20')](_0x288e99[_0x5aa4('0x1f')]);_0x16d0f4[_0x5aa4('0x21')]=_[_0x5aa4('0x22')](_0x16d0f4[_0x5aa4('0x1e')],_0x16d0f4[_0x5aa4('0x1f')]);_0x5b841b[_0x5aa4('0x23')]=_[_0x5aa4('0x22')](_0x16d0f4[_0x5aa4('0x1e')],qs[_0x5aa4('0x24')](_0x288e99[_0x5aa4('0x1f')][_0x5aa4('0x24')]));_0x5b841b[_0x5aa4('0x23')]=_0x5b841b[_0x5aa4('0x23')][_0x5aa4('0x25')]?_0x5b841b['attributes']:_0x16d0f4['model'];if(_0x288e99['query'][_0x5aa4('0x2f')]){_0x5b841b['include']=[{'all':!![]}];}_0x5b841b=_['merge']({},_0x5b841b,_0x288e99[_0x5aa4('0x35')]);return db[_0x5aa4('0x19')][_0x5aa4('0x36')](_0x5b841b)['then'](handleEntityNotFound(_0x58cd00,null))[_0x5aa4('0x13')](function(_0x1c63ee){if(_0x1c63ee[_0x5aa4('0x32')]===_0x5aa4('0x33')){var _0x569e78=encryptor[_0x5aa4('0x37')](_0x1c63ee[_0x5aa4('0x38')]);_0x1c63ee[_0x5aa4('0x38')]=maskClientSecret(_0x569e78);}return _0x1c63ee;})[_0x5aa4('0x13')](respondWithResult(_0x58cd00,null))['catch'](handleError(_0x58cd00,null));};exports[_0x5aa4('0x39')]=function(_0x31cba4,_0x2fa1cf){if(!_0x31cba4[_0x5aa4('0x3a')][_0x5aa4('0x16')])throw new Error(_0x5aa4('0x3b'));if(!_0x31cba4[_0x5aa4('0x3a')][_0x5aa4('0x32')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x4b9691=db[_0x5aa4('0x19')][_0x5aa4('0x1a')][_0x5aa4('0x32')]['values'];if(!_0x4b9691[_0x5aa4('0x3c')](_0x31cba4[_0x5aa4('0x3a')]['service']))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x4b9691[_0x5aa4('0x3d')](',\x20'));if(_0x31cba4[_0x5aa4('0x3a')]['service']==='MicrosoftAzure'&&_0x31cba4[_0x5aa4('0x3a')][_0x5aa4('0x38')]){_0x31cba4['body'][_0x5aa4('0x38')]=encryptor[_0x5aa4('0x3e')](_0x31cba4[_0x5aa4('0x3a')]['data3']);}return db['CloudProvider'][_0x5aa4('0x39')](_0x31cba4['body'],{})[_0x5aa4('0x13')](respondWithResult(_0x2fa1cf,0xc9))['catch'](handleError(_0x2fa1cf,null));};exports[_0x5aa4('0x3f')]=function(_0x4cf064,_0x5423a4){if(_0x4cf064['body']['id']){delete _0x4cf064[_0x5aa4('0x3a')]['id'];}return db[_0x5aa4('0x19')]['find']({'where':{'id':_0x4cf064[_0x5aa4('0x40')]['id']}})[_0x5aa4('0x13')](handleEntityNotFound(_0x5423a4,null))[_0x5aa4('0x13')](function(_0x37c74f){if(_0x37c74f[_0x5aa4('0x32')]===_0x5aa4('0x33')&&_0x4cf064[_0x5aa4('0x3a')]['data3']){_0x4cf064['body'][_0x5aa4('0x38')]=encryptor[_0x5aa4('0x3e')](_0x4cf064[_0x5aa4('0x3a')][_0x5aa4('0x38')]);}return _0x37c74f;})[_0x5aa4('0x13')](saveUpdates(_0x4cf064[_0x5aa4('0x3a')],null))[_0x5aa4('0x13')](respondWithResult(_0x5423a4,null))[_0x5aa4('0x41')](handleError(_0x5423a4,null));};exports[_0x5aa4('0x42')]=function(_0x45943d,_0x4d0685){return db[_0x5aa4('0x19')][_0x5aa4('0x36')]({'where':{'id':_0x45943d['params']['id']}})[_0x5aa4('0x13')](handleEntityNotFound(_0x4d0685,null))[_0x5aa4('0x13')](removeEntity(_0x4d0685,null))[_0x5aa4('0x41')](handleError(_0x4d0685,null));};exports[_0x5aa4('0x43')]=function(_0x4e2c8c,_0x4fa874){return db[_0x5aa4('0x19')]['findOne']({'where':{'id':_0x4e2c8c[_0x5aa4('0x40')]['id']},'raw':!![]})[_0x5aa4('0x13')](function(_0xc9248d){if(!_0xc9248d)return _0x4fa874['sendStatus'](0x194);return{'url':oauth[_0x5aa4('0x44')](_0xc9248d,_0x4e2c8c[_0x5aa4('0x45')]['id'])};})[_0x5aa4('0x13')](respondWithResult(_0x4fa874,null))['catch'](handleError(_0x4fa874,null));};exports[_0x5aa4('0x46')]=function(_0x246981,_0x38adf2){var _0x433f2a=_0x246981[_0x5aa4('0x3a')];var _0x1b0320;var _0x134493;if(_0x433f2a['error'])throw _0x433f2a;redis[_0x5aa4('0x47')](_0x433f2a['state'])['then'](function(_0x551651){if(!_0x551651)throw new Error(_0x5aa4('0x48'));_0x1b0320=JSON[_0x5aa4('0x49')](_0x551651);var _0x33abf5=Buffer[_0x5aa4('0x4a')](_0x433f2a[_0x5aa4('0x4b')],_0x5aa4('0x4c'))[_0x5aa4('0x4d')](_0x5aa4('0x4e'));_0x134493=JSON[_0x5aa4('0x49')](_0x33abf5);if(!oauth[_0x5aa4('0x4f')](_0x433f2a[_0x5aa4('0x50')],_0x1b0320[_0x5aa4('0x51')]))throw new Error(_0x5aa4('0x52'));redis[_0x5aa4('0x53')](_0x433f2a[_0x5aa4('0x4b')]);return oauth['getOauth2MicrosoftAccessToken'](_0x433f2a['code'],_0x1b0320);})['then'](function(_0x52126e){_0x1b0320[_0x5aa4('0x54')]=_0x52126e['access_token'];_0x1b0320[_0x5aa4('0x55')]=_0x52126e['refresh_token'];return db[_0x5aa4('0x19')][_0x5aa4('0x3f')]({'data5':_0x1b0320['data5'],'data6':_0x1b0320['data6']},{'where':{'id':_0x1b0320['id']}});})['then'](function(){oauth[_0x5aa4('0x56')](_0x1b0320);socket[_0x5aa4('0x57')](_0x5aa4('0x58'),{'id':_0x134493['id']});return;})[_0x5aa4('0x13')](respondWithStatusCode(_0x38adf2,null))[_0x5aa4('0x41')](function(_0x44fcac){if(_0x134493){socket[_0x5aa4('0x57')]('microsoftAuthorization:error',{'id':_0x134493['id']});}if(!_0x1b0320){logger[_0x5aa4('0x15')]('Invalid\x20authentication\x20state\x20parameter',_0x44fcac);return _0x38adf2[_0x5aa4('0xb')](0x1f4)[_0x5aa4('0x59')](_0x44fcac[_0x5aa4('0x5a')]);}logger[_0x5aa4('0x15')](_0x5aa4('0x5b'),_0x1b0320['id'],JSON[_0x5aa4('0x5c')](_0x44fcac));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 6f67a9f..c3f4c05 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 _0xdaae=['../../config/environment','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash','bluebird','request-promise','path','rimraf'];(function(_0xb4d928,_0x579093){var _0x47166e=function(_0x198064){while(--_0x198064){_0xb4d928['push'](_0xb4d928['shift']());}};_0x47166e(++_0x579093);}(_0xdaae,0x1bd));var _0xedaa=function(_0x260f28,_0x4e9b30){_0x260f28=_0x260f28-0x0;var _0x3aefcc=_0xdaae[_0x260f28];return _0x3aefcc;};'use strict';var _=require(_0xedaa('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xedaa('0x1'));var rp=require(_0xedaa('0x2'));var fs=require('fs');var path=require(_0xedaa('0x3'));var rimraf=require(_0xedaa('0x4'));var config=require(_0xedaa('0x5'));var attributes=require(_0xedaa('0x6'));module[_0xedaa('0x7')]=function(_0x324ff7,_0x3b8052){return _0x324ff7['define'](_0xedaa('0x8'),attributes,{'tableName':_0xedaa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2214=['../../config/logger','api','bluebird','rimraf','./cloudProvider.attributes','define','util'];(function(_0x5d4c9e,_0x208e78){var _0x4ae946=function(_0x1375a6){while(--_0x1375a6){_0x5d4c9e['push'](_0x5d4c9e['shift']());}};_0x4ae946(++_0x208e78);}(_0x2214,0x1a3));var _0x4221=function(_0x33f7f6,_0x44bcb8){_0x33f7f6=_0x33f7f6-0x0;var _0x4a5c30=_0x2214[_0x33f7f6];return _0x4a5c30;};'use strict';var _=require('lodash');var util=require(_0x4221('0x0'));var logger=require(_0x4221('0x1'))(_0x4221('0x2'));var moment=require('moment');var BPromise=require(_0x4221('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4221('0x4'));var config=require('../../config/environment');var attributes=require(_0x4221('0x5'));module['exports']=function(_0x2488b1,_0x2f59f6){return _0x2488b1[_0x4221('0x6')]('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 4c4196c..500f3be 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4920=['https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','push','/.default','replace','data2','id_token','from','stringify','toString','randomBytes','hex','data1','response_type','join','response_mode','form_post','scope','state','nonce','prompt','login','key','value','oauth2Claims','oauth2/','decode','payload','iss','issuer','aud','isAfter','exp','resolve','then','data3','findOne','refresh_token','data6','data4','POST','{TENANT_ID}','data5','CloudProvider','update','error','authorization_code','decryptString','intervals','findAll','all','catch','inspect','exports','lodash','jsonwebtoken','moment','ioredis','request-promise','util','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All'];(function(_0x923556,_0x22b18e){var _0x37d5e=function(_0x1286ea){while(--_0x1286ea){_0x923556['push'](_0x923556['shift']());}};_0x37d5e(++_0x22b18e);}(_0x4920,0xd7));var _0x0492=function(_0x13bc77,_0x1495ee){_0x13bc77=_0x13bc77-0x0;var _0x56b6e7=_0x4920[_0x13bc77];return _0x56b6e7;};'use strict';var _=require(_0x0492('0x0'));var crypto=require('crypto');var jwt=require(_0x0492('0x1'));var moment=require(_0x0492('0x2'));var Redis=require(_0x0492('0x3'));var rp=require(_0x0492('0x4'));var util=require(_0x0492('0x5'));var encryptor=require('../../components/encryptor');var config=require(_0x0492('0x6'));var logger=require(_0x0492('0x7'))(_0x0492('0x8'));var schedule=require(_0x0492('0x9'));var db=require('../../mysqldb')['db'];config[_0x0492('0xa')]=_[_0x0492('0xb')](config[_0x0492('0xa')],{'host':_0x0492('0xc'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x0492('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x0492('0xe'),_0x0492('0xf'),_0x0492('0x10'),_0x0492('0x11'),_0x0492('0x12'),_0x0492('0x13'),_0x0492('0x14')],'Dynamics365':['openid',_0x0492('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0x0492('0x15');var MICROSOFT_TOKEN_ENDPOINT=_0x0492('0x16');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x3965bd){var _0x367c80=_[_0x0492('0x17')](AZURE_AUTH_SCOPES[_0x3965bd[_0x0492('0x18')]]);if(_0x3965bd[_0x0492('0x18')]===_0x0492('0x19'))_0x367c80[_0x0492('0x1a')](_0x3965bd['data7']+_0x0492('0x1b'));return _0x367c80['join']('\x20');}function getAccessTokenScope(_0x48a20c){if(_0x48a20c[_0x0492('0x18')]==='Outlook365')return _0x0492('0x12');if(_0x48a20c[_0x0492('0x18')]==='Dynamics365')return _0x48a20c['data7']+_0x0492('0x1b');}function generateMicrosoftAuthorizationUrl(_0x44a4bc,_0x41de48){var _0x7c9b45=MICROSOFT_AUTH_URL[_0x0492('0x1c')]('{TENANT_ID}',_0x44a4bc[_0x0492('0x1d')]);var _0x2cfe0d=['code',_0x0492('0x1e')];var _0x28755b=Buffer[_0x0492('0x1f')](JSON[_0x0492('0x20')]({'id':_0x41de48}))[_0x0492('0x21')]('base64');var _0x36e69e=crypto[_0x0492('0x22')](0x10)[_0x0492('0x21')](_0x0492('0x23'));var _0xf302bc=getAuthorizationScopes(_0x44a4bc);var _0x28ec6f=[{'key':'client_id','value':_0x44a4bc[_0x0492('0x24')]},{'key':_0x0492('0x25'),'value':encodeURIComponent(_0x2cfe0d[_0x0492('0x26')]('\x20'))},{'key':'redirect_uri','value':_0x44a4bc['data4']},{'key':_0x0492('0x27'),'value':_0x0492('0x28')},{'key':_0x0492('0x29'),'value':encodeURIComponent(_0xf302bc)},{'key':_0x0492('0x2a'),'value':_0x28755b},{'key':_0x0492('0x2b'),'value':_0x36e69e},{'key':_0x0492('0x2c'),'value':_0x0492('0x2d')}];var _0x3ffa92=_0x7c9b45+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x0492('0x17')](_0x28ec6f,function(_0x1ec629){return _0x1ec629[_0x0492('0x2e')]+'='+_0x1ec629[_0x0492('0x2f')];})[_0x0492('0x26')]('&');_0x44a4bc[_0x0492('0x30')]={'issuer':_0x7c9b45[_0x0492('0x1c')](_0x0492('0x31'),''),'audience':_0x44a4bc[_0x0492('0x24')],'state':_0x28755b,'nonce':_0x36e69e};redis['set'](_0x28755b,JSON[_0x0492('0x20')](_0x44a4bc));return _0x3ffa92;}function isValidIdToken(_0x1ea4db,_0x5efde6){try{var _0xac7d05=jwt[_0x0492('0x32')](_0x1ea4db,{'complete':!![]});var _0x14eb6f=_0xac7d05[_0x0492('0x33')];if(_0x14eb6f[_0x0492('0x34')]!==_0x5efde6[_0x0492('0x35')])return![];if(_0x14eb6f[_0x0492('0x36')]!==_0x5efde6['audience'])return![];if(_0x14eb6f[_0x0492('0x2b')]!==_0x5efde6[_0x0492('0x2b')])return![];if(moment()[_0x0492('0x37')](moment['unix'](_0x14eb6f[_0x0492('0x38')])))return![];return!![];}catch(_0x4f24a4){throw _0x4f24a4;}}function refreshOauth2MicrosoftAccessToken(_0x3ed013){return Promise[_0x0492('0x39')]()[_0x0492('0x3a')](function(){if(_0x3ed013[_0x0492('0x3b')])return _0x3ed013;return db['CloudProvider'][_0x0492('0x3c')]({'where':{'id':_0x3ed013['id']},'raw':!![]});})[_0x0492('0x3a')](function(_0x27a295){var _0x6ef1bb={'grant_type':_0x0492('0x3d'),'refresh_token':_0x27a295[_0x0492('0x3e')],'scope':getAccessTokenScope(_0x27a295),'redirect_uri':_0x27a295[_0x0492('0x3f')],'client_id':_0x27a295['data1'],'client_secret':encryptor['decryptString'](_0x27a295[_0x0492('0x3b')])};var _0x156d95={'method':_0x0492('0x40'),'uri':MICROSOFT_AUTH_URL[_0x0492('0x1c')](_0x0492('0x41'),_0x27a295['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x6ef1bb,'json':!![]};return rp(_0x156d95);})[_0x0492('0x3a')](function(_0x6916f7){_0x3ed013[_0x0492('0x42')]=_0x6916f7['access_token'];_0x3ed013[_0x0492('0x3e')]=_0x6916f7[_0x0492('0x3d')];return db[_0x0492('0x43')][_0x0492('0x44')]({'data5':_0x3ed013[_0x0492('0x42')],'data6':_0x3ed013['data6']},{'where':{'id':_0x3ed013['id']}});})[_0x0492('0x3a')](function(){return _0x3ed013;})['catch'](function(_0x4c5cf1){logger[_0x0492('0x45')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x3ed013['id'],_0x4c5cf1);});}function getOauth2MicrosoftAccessToken(_0x31e0bd,_0x1b46e5){var _0x5a6b4a={'grant_type':_0x0492('0x46'),'code':_0x31e0bd,'scope':getAccessTokenScope(_0x1b46e5),'redirect_uri':_0x1b46e5[_0x0492('0x3f')],'client_id':_0x1b46e5['data1'],'client_secret':encryptor[_0x0492('0x47')](_0x1b46e5[_0x0492('0x3b')])};var _0x5362fb={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x0492('0x1c')](_0x0492('0x41'),_0x1b46e5[_0x0492('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5a6b4a,'json':!![]};return rp(_0x5362fb);}function startRefreshInterval(_0x1f058d){var _0x419a67=schedule[_0x0492('0x48')];if(_0x419a67[_0x1f058d['id']])clearInterval(_0x419a67[_0x1f058d['id']]);_0x419a67[_0x1f058d['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x1f058d['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x0492('0x48')]=_0x419a67;}function startAllRefreshIntervals(){return db[_0x0492('0x43')][_0x0492('0x49')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x0492('0x3a')](function(_0x51732d){var _0x1f3d81=_0x51732d['map'](function(_0x314fde){return refreshOauth2MicrosoftAccessToken(_0x314fde)[_0x0492('0x3a')](function(_0x1d00da){startRefreshInterval(_0x1d00da);});});return Promise[_0x0492('0x4a')](_0x1f3d81);})[_0x0492('0x4b')](function(_0x3ed1fa){var _0x2571bb=_0x3ed1fa?util[_0x0492('0x4c')](_0x3ed1fa,{'showHidden':![],'depth':null}):'';logger[_0x0492('0x45')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x2571bb);});}module[_0x0492('0x4d')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x226d=['oauth2Claims','oauth2/','set','payload','iss','issuer','exp','resolve','data3','CloudProvider','findOne','then','data6','decryptString','POST','access_token','update','data5','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','ioredis','request-promise','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','localhost','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/authorize','map','type','Dynamics365','push','/.default','join','Outlook365','data7','replace','{TENANT_ID}','data2','code','stringify','base64','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','nonce','prompt','value'];(function(_0x4993a3,_0x492845){var _0x5723ec=function(_0x2b9d18){while(--_0x2b9d18){_0x4993a3['push'](_0x4993a3['shift']());}};_0x5723ec(++_0x492845);}(_0x226d,0x13c));var _0xd226=function(_0x502372,_0x304dd9){_0x502372=_0x502372-0x0;var _0xf99629=_0x226d[_0x502372];return _0xf99629;};'use strict';var _=require(_0xd226('0x0'));var crypto=require(_0xd226('0x1'));var jwt=require(_0xd226('0x2'));var moment=require('moment');var Redis=require(_0xd226('0x3'));var rp=require(_0xd226('0x4'));var util=require('util');var encryptor=require(_0xd226('0x5'));var config=require(_0xd226('0x6'));var logger=require(_0xd226('0x7'))(_0xd226('0x8'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0xd226('0x9'))['db'];config[_0xd226('0xa')]=_['defaults'](config['redis'],{'host':_0xd226('0xb'),'port':0x18eb});var redis=new Redis(config[_0xd226('0xa')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xd226('0xc'),_0xd226('0xd'),_0xd226('0xe'),_0xd226('0xf'),_0xd226('0x10'),_0xd226('0x11'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xd226('0xc'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xd226('0x12');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2f06de){var _0x59291e=_[_0xd226('0x13')](AZURE_AUTH_SCOPES[_0x2f06de[_0xd226('0x14')]]);if(_0x2f06de[_0xd226('0x14')]===_0xd226('0x15'))_0x59291e[_0xd226('0x16')](_0x2f06de['data7']+_0xd226('0x17'));return _0x59291e[_0xd226('0x18')]('\x20');}function getAccessTokenScope(_0x431ada){if(_0x431ada[_0xd226('0x14')]===_0xd226('0x19'))return _0xd226('0x10');if(_0x431ada['type']===_0xd226('0x15'))return _0x431ada[_0xd226('0x1a')]+_0xd226('0x17');}function generateMicrosoftAuthorizationUrl(_0x448a19,_0x2dd0e5){var _0x2bb8cc=MICROSOFT_AUTH_URL[_0xd226('0x1b')](_0xd226('0x1c'),_0x448a19[_0xd226('0x1d')]);var _0x535417=[_0xd226('0x1e'),'id_token'];var _0x59f418=Buffer['from'](JSON[_0xd226('0x1f')]({'id':_0x2dd0e5}))['toString'](_0xd226('0x20'));var _0xd9d6a8=crypto['randomBytes'](0x10)['toString'](_0xd226('0x21'));var _0x18aa59=getAuthorizationScopes(_0x448a19);var _0x18b6bd=[{'key':_0xd226('0x22'),'value':_0x448a19[_0xd226('0x23')]},{'key':_0xd226('0x24'),'value':encodeURIComponent(_0x535417['join']('\x20'))},{'key':_0xd226('0x25'),'value':_0x448a19[_0xd226('0x26')]},{'key':_0xd226('0x27'),'value':_0xd226('0x28')},{'key':'scope','value':encodeURIComponent(_0x18aa59)},{'key':'state','value':_0x59f418},{'key':_0xd226('0x29'),'value':_0xd9d6a8},{'key':_0xd226('0x2a'),'value':'login'}];var _0x263e22=_0x2bb8cc+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x18b6bd,function(_0x33692d){return _0x33692d['key']+'='+_0x33692d[_0xd226('0x2b')];})[_0xd226('0x18')]('&');_0x448a19[_0xd226('0x2c')]={'issuer':_0x2bb8cc[_0xd226('0x1b')](_0xd226('0x2d'),''),'audience':_0x448a19[_0xd226('0x23')],'state':_0x59f418,'nonce':_0xd9d6a8};redis[_0xd226('0x2e')](_0x59f418,JSON[_0xd226('0x1f')](_0x448a19));return _0x263e22;}function isValidIdToken(_0x74d1b1,_0x4f954a){try{var _0x5698b2=jwt['decode'](_0x74d1b1,{'complete':!![]});var _0x5ba309=_0x5698b2[_0xd226('0x2f')];if(_0x5ba309[_0xd226('0x30')]!==_0x4f954a[_0xd226('0x31')])return![];if(_0x5ba309['aud']!==_0x4f954a['audience'])return![];if(_0x5ba309['nonce']!==_0x4f954a[_0xd226('0x29')])return![];if(moment()['isAfter'](moment['unix'](_0x5ba309[_0xd226('0x32')])))return![];return!![];}catch(_0x4a6f2c){throw _0x4a6f2c;}}function refreshOauth2MicrosoftAccessToken(_0x540e59){return Promise[_0xd226('0x33')]()['then'](function(){if(_0x540e59[_0xd226('0x34')])return _0x540e59;return db[_0xd226('0x35')][_0xd226('0x36')]({'where':{'id':_0x540e59['id']},'raw':!![]});})[_0xd226('0x37')](function(_0x4faa60){var _0x400a93={'grant_type':'refresh_token','refresh_token':_0x4faa60[_0xd226('0x38')],'scope':getAccessTokenScope(_0x4faa60),'redirect_uri':_0x4faa60['data4'],'client_id':_0x4faa60[_0xd226('0x23')],'client_secret':encryptor[_0xd226('0x39')](_0x4faa60[_0xd226('0x34')])};var _0x2d8a44={'method':_0xd226('0x3a'),'uri':MICROSOFT_AUTH_URL[_0xd226('0x1b')]('{TENANT_ID}',_0x4faa60['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x400a93,'json':!![]};return rp(_0x2d8a44);})[_0xd226('0x37')](function(_0x268e58){_0x540e59['data5']=_0x268e58[_0xd226('0x3b')];_0x540e59['data6']=_0x268e58['refresh_token'];return db[_0xd226('0x35')][_0xd226('0x3c')]({'data5':_0x540e59[_0xd226('0x3d')],'data6':_0x540e59[_0xd226('0x38')]},{'where':{'id':_0x540e59['id']}});})['then'](function(){return _0x540e59;})[_0xd226('0x3e')](function(_0x3f5cbc){logger[_0xd226('0x3f')](_0xd226('0x40'),_0x540e59['id'],_0x3f5cbc);});}function getOauth2MicrosoftAccessToken(_0x13b66d,_0x42f93a){var _0x16bcbe={'grant_type':_0xd226('0x41'),'code':_0x13b66d,'scope':getAccessTokenScope(_0x42f93a),'redirect_uri':_0x42f93a[_0xd226('0x26')],'client_id':_0x42f93a['data1'],'client_secret':encryptor[_0xd226('0x39')](_0x42f93a[_0xd226('0x34')])};var _0x1a2861={'method':_0xd226('0x3a'),'uri':MICROSOFT_AUTH_URL['replace'](_0xd226('0x1c'),_0x42f93a[_0xd226('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x16bcbe,'json':!![]};return rp(_0x1a2861);}function startRefreshInterval(_0xa56c31){var _0x4ec8b9=schedule[_0xd226('0x42')];if(_0x4ec8b9[_0xa56c31['id']])clearInterval(_0x4ec8b9[_0xa56c31['id']]);_0x4ec8b9[_0xa56c31['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0xa56c31['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xd226('0x42')]=_0x4ec8b9;}function startAllRefreshIntervals(){return db[_0xd226('0x35')][_0xd226('0x43')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xd226('0x37')](function(_0x1c6b10){var _0x26ced=_0x1c6b10[_0xd226('0x13')](function(_0x1ba123){return refreshOauth2MicrosoftAccessToken(_0x1ba123)[_0xd226('0x37')](function(_0x1157a1){startRefreshInterval(_0x1157a1);});});return Promise[_0xd226('0x44')](_0x26ced);})[_0xd226('0x3e')](function(_0x14993c){var _0x2597a7=_0x14993c?util[_0xd226('0x45')](_0x14993c,{'showHidden':![],'depth':null}):'';logger[_0xd226('0x3f')](_0xd226('0x46'),_0x2597a7);});}module[_0xd226('0x47')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 1fc45b5..9acb437 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 _0xd48e=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CloudProvider,\x20%s,\x20%s','message','catch'];(function(_0x2eb8ce,_0x4417c0){var _0x58f7ff=function(_0x536032){while(--_0x536032){_0x2eb8ce['push'](_0x2eb8ce['shift']());}};_0x58f7ff(++_0x4417c0);}(_0xd48e,0x93));var _0xed48=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xd48e[_0x45bf86];return _0x1f02b7;};'use strict';var _=require('lodash');var util=require(_0xed48('0x0'));var moment=require(_0xed48('0x1'));var BPromise=require(_0xed48('0x2'));var rs=require(_0xed48('0x3'));var fs=require('fs');var Redis=require(_0xed48('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed48('0x5'));var logger=require(_0xed48('0x6'))(_0xed48('0x7'));var config=require('../../config/environment');var jayson=require(_0xed48('0x8'));var client=jayson[_0xed48('0x9')][_0xed48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50b4ce,_0x2cc522,_0x1c9299){return new BPromise(function(_0x52a5e2,_0x5f0f1b){return client['request'](_0x50b4ce,_0x1c9299)[_0xed48('0xb')](function(_0x28096a){logger[_0xed48('0xc')]('CloudProvider,\x20%s,\x20%s',_0x2cc522,'request\x20sent');logger[_0xed48('0xd')](_0xed48('0xe'),_0x2cc522,_0xed48('0xf'),JSON['stringify'](_0x28096a));if(_0x28096a[_0xed48('0x10')]){if(_0x28096a[_0xed48('0x10')][_0xed48('0x11')]===0x1f4){logger[_0xed48('0x10')](_0xed48('0x12'),_0x2cc522,_0x28096a[_0xed48('0x10')][_0xed48('0x13')]);return _0x5f0f1b(_0x28096a[_0xed48('0x10')][_0xed48('0x13')]);}logger[_0xed48('0x10')](_0xed48('0x12'),_0x2cc522,_0x28096a[_0xed48('0x10')][_0xed48('0x13')]);return _0x52a5e2(_0x28096a['error'][_0xed48('0x13')]);}else{logger['info'](_0xed48('0x12'),_0x2cc522,'request\x20sent');_0x52a5e2(_0x28096a['result'][_0xed48('0x13')]);}})[_0xed48('0x14')](function(_0x3dd77d){logger[_0xed48('0x10')](_0xed48('0x12'),_0x2cc522,_0x3dd77d);_0x5f0f1b(_0x3dd77d);});});} \ No newline at end of file +var _0xedf1=['CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then'];(function(_0x45a1c4,_0x78263e){var _0x1947bf=function(_0x4c40ba){while(--_0x4c40ba){_0x45a1c4['push'](_0x45a1c4['shift']());}};_0x1947bf(++_0x78263e);}(_0xedf1,0xb2));var _0x1edf=function(_0x25b80e,_0x503088){_0x25b80e=_0x25b80e-0x0;var _0xd2c680=_0xedf1[_0x25b80e];return _0xd2c680;};'use strict';var _=require(_0x1edf('0x0'));var util=require(_0x1edf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1edf('0x2'));var fs=require('fs');var Redis=require(_0x1edf('0x3'));var db=require(_0x1edf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1edf('0x5'))(_0x1edf('0x6'));var config=require(_0x1edf('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1edf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1615b2,_0x1029fe,_0x20b629){return new BPromise(function(_0x12293b,_0x206f63){return client[_0x1edf('0x9')](_0x1615b2,_0x20b629)[_0x1edf('0xa')](function(_0x30a13f){logger['info'](_0x1edf('0xb'),_0x1029fe,_0x1edf('0xc'));logger[_0x1edf('0xd')](_0x1edf('0xe'),_0x1029fe,'request\x20sent',JSON[_0x1edf('0xf')](_0x30a13f));if(_0x30a13f['error']){if(_0x30a13f[_0x1edf('0x10')][_0x1edf('0x11')]===0x1f4){logger[_0x1edf('0x10')](_0x1edf('0xb'),_0x1029fe,_0x30a13f[_0x1edf('0x10')][_0x1edf('0x12')]);return _0x206f63(_0x30a13f[_0x1edf('0x10')][_0x1edf('0x12')]);}logger[_0x1edf('0x10')]('CloudProvider,\x20%s,\x20%s',_0x1029fe,_0x30a13f[_0x1edf('0x10')][_0x1edf('0x12')]);return _0x12293b(_0x30a13f['error'][_0x1edf('0x12')]);}else{logger[_0x1edf('0x13')](_0x1edf('0xb'),_0x1029fe,_0x1edf('0xc'));_0x12293b(_0x30a13f[_0x1edf('0x14')][_0x1edf('0x12')]);}})['catch'](function(_0x4f2584){logger[_0x1edf('0x10')](_0x1edf('0xb'),_0x1029fe,_0x4f2584);_0x206f63(_0x4f2584);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index faabc27..8a3dbb5 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 _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x105154,_0x11f478){var _0x295abf=function(_0x4367e0){while(--_0x4367e0){_0x105154['push'](_0x105154['shift']());}};_0x295abf(++_0x11f478);}(_0xdb28,0x106));var _0x8db2=function(_0x1f38d3,_0x235a4a){_0x1f38d3=_0x1f38d3-0x0;var _0x942b6d=_0xdb28[_0x1f38d3];return _0x942b6d;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x3b9d5f,_0x2e9039){var _0x39924e=function(_0x5752ee){while(--_0x5752ee){_0x3b9d5f['push'](_0x3b9d5f['shift']());}};_0x39924e(++_0x2e9039);}(_0x1261,0x144));var _0x1126=function(_0x1e393b,_0x355f6b){_0x1e393b=_0x1e393b-0x0;var _0x3d0bfe=_0x1261[_0x1e393b];return _0x3d0bfe;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index d86dbfb..d5b4016 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 _0x8c2f=['name','STRING'];(function(_0x81f67b,_0x4409a5){var _0x22f2ff=function(_0x577350){while(--_0x577350){_0x81f67b['push'](_0x81f67b['shift']());}};_0x22f2ff(++_0x4409a5);}(_0x8c2f,0xdc));var _0xf8c2=function(_0x423035,_0x51ddeb){_0x423035=_0x423035-0x0;var _0x3645fc=_0x8c2f[_0x423035];return _0x3645fc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xf8c2('0x0'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xf8c2('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xf8c2('0x1')]},'type':{'type':Sequelize[_0xf8c2('0x1')]},'street':{'type':Sequelize[_0xf8c2('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xf8c2('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xf8c2('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xf8c2('0x1')]},'sStreet':{'type':Sequelize[_0xf8c2('0x1')]},'sPostalCode':{'type':Sequelize[_0xf8c2('0x1')]},'sCity':{'type':Sequelize[_0xf8c2('0x1')]},'sCountry':{'type':Sequelize[_0xf8c2('0x1')]},'description':{'type':Sequelize[_0xf8c2('0x1')]}}; \ No newline at end of file +var _0xf350=['STRING','sequelize','exports','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf350,0x1e9));var _0x0f35=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf350[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x0f35('0x0'));module[_0x0f35('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0f35('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x0f35('0x3')]},'companyId':{'type':Sequelize[_0x0f35('0x3')]},'website':{'type':Sequelize[_0x0f35('0x3')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x0f35('0x3')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x0f35('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x0f35('0x3')]},'email':{'type':Sequelize[_0x0f35('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x0f35('0x3')]},'sStreet':{'type':Sequelize[_0x0f35('0x3')]},'sPostalCode':{'type':Sequelize[_0x0f35('0x3')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0f35('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 1a1f405..7a7cf94 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 _0x7a67=['show','params','length','include','find','create','body','user','role','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','omit','CmContact','rawAttributes','getContacts','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','update','destroy','then','get','UserProfileResource','stack','name','send','index','describe','model','keys','query','intersection','attributes','fields','order','sort','where','pick','filters','filter','merge','map','options','CmCompany','includeAll','findAll','rows','catch'];(function(_0x3877c6,_0x12bb7f){var _0x4e3936=function(_0x1aaa93){while(--_0x1aaa93){_0x3877c6['push'](_0x3877c6['shift']());}};_0x4e3936(++_0x12bb7f);}(_0x7a67,0x10e));var _0x77a6=function(_0x41462e,_0x4af00a){_0x41462e=_0x41462e-0x0;var _0x354bc1=_0x7a67[_0x41462e];return _0x354bc1;};'use strict';var emlformat=require(_0x77a6('0x0'));var rimraf=require(_0x77a6('0x1'));var zipdir=require(_0x77a6('0x2'));var jsonpatch=require(_0x77a6('0x3'));var rp=require(_0x77a6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x77a6('0x5'));var util=require('util');var path=require(_0x77a6('0x6'));var sox=require(_0x77a6('0x7'));var csv=require('to-csv');var ejs=require(_0x77a6('0x8'));var fs=require('fs');var fs_extra=require(_0x77a6('0x9'));var _=require(_0x77a6('0xa'));var squel=require(_0x77a6('0xb'));var crypto=require(_0x77a6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x77a6('0xd'));var toCsv=require(_0x77a6('0xe'));var querystring=require(_0x77a6('0xf'));var Papa=require(_0x77a6('0x10'));var Redis=require(_0x77a6('0x11'));var authService=require(_0x77a6('0x12'));var qs=require(_0x77a6('0x13'));var as=require(_0x77a6('0x14'));var hardwareService=require(_0x77a6('0x15'));var logger=require(_0x77a6('0x16'))(_0x77a6('0x17'));var utils=require('../../config/utils');var config=require(_0x77a6('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x77a6('0x19'))['db'];function respondWithStatusCode(_0x2b1215,_0x10e850){_0x10e850=_0x10e850||0xcc;return function(_0x38fa78){if(_0x38fa78){return _0x2b1215[_0x77a6('0x1a')](_0x10e850);}return _0x2b1215[_0x77a6('0x1b')](_0x10e850)[_0x77a6('0x1c')]();};}function respondWithResult(_0x5d2cf3,_0x1d5997){_0x1d5997=_0x1d5997||0xc8;return function(_0xa5cc0b){if(_0xa5cc0b){return _0x5d2cf3[_0x77a6('0x1b')](_0x1d5997)['json'](_0xa5cc0b);}};}function respondWithFilteredResult(_0x343bc0,_0x4762d9){return function(_0x3c8561){if(_0x3c8561){var _0x3997bb=typeof _0x4762d9['offset']===_0x77a6('0x1d')&&typeof _0x4762d9['limit']===_0x77a6('0x1d');var _0x43efd0=_0x3c8561[_0x77a6('0x1e')];var _0x5cb482=_0x3997bb?0x0:_0x4762d9['offset'];var _0x9cd957=_0x3997bb?_0x3c8561[_0x77a6('0x1e')]:_0x4762d9[_0x77a6('0x1f')]+_0x4762d9[_0x77a6('0x20')];var _0x4410c2;if(_0x9cd957>=_0x43efd0){_0x9cd957=_0x43efd0;_0x4410c2=0xc8;}else{_0x4410c2=0xce;}_0x343bc0[_0x77a6('0x1b')](_0x4410c2);return _0x343bc0['set'](_0x77a6('0x21'),_0x5cb482+'-'+_0x9cd957+'/'+_0x43efd0)[_0x77a6('0x22')](_0x3c8561);}return null;};}function patchUpdates(_0x502e70){return function(_0x448b49){try{jsonpatch[_0x77a6('0x23')](_0x448b49,_0x502e70,!![]);}catch(_0x1b74a7){return BPromise['reject'](_0x1b74a7);}return _0x448b49['save']();};}function saveUpdates(_0x132c23,_0x1c61cc){return function(_0x19334f){if(_0x19334f){return _0x19334f[_0x77a6('0x24')](_0x132c23)['then'](function(_0xccdc75){return _0xccdc75;});}return null;};}function removeEntity(_0x771e00,_0xd448cb){return function(_0x534694){if(_0x534694){return _0x534694[_0x77a6('0x25')]()[_0x77a6('0x26')](function(){var _0x2fdc41=_0x534694[_0x77a6('0x27')]({'plain':!![]});var _0xc281e7='Companies';return db[_0x77a6('0x28')]['destroy']({'where':{'type':_0xc281e7,'resourceId':_0x2fdc41['id']}})['then'](function(){return _0x534694;});})[_0x77a6('0x26')](function(){_0x771e00['status'](0xcc)[_0x77a6('0x1c')]();});}};}function handleEntityNotFound(_0x2729ee,_0x4aaf8a){return function(_0x3911a8){if(!_0x3911a8){_0x2729ee[_0x77a6('0x1a')](0x194);}return _0x3911a8;};}function handleError(_0x45207f,_0x4da1c6){_0x4da1c6=_0x4da1c6||0x1f4;return function(_0x52831b){logger['error'](_0x52831b[_0x77a6('0x29')]);if(_0x52831b[_0x77a6('0x2a')]){delete _0x52831b[_0x77a6('0x2a')];}_0x45207f[_0x77a6('0x1b')](_0x4da1c6)[_0x77a6('0x2b')](_0x52831b);};}exports[_0x77a6('0x2c')]=function(_0x2d2f77,_0x689fb3){var _0x3809e7={},_0xfb485b={},_0x534f2c={'count':0x0,'rows':[]};return db['CmCompany'][_0x77a6('0x2d')]()[_0x77a6('0x26')](function(_0x39cf57){_0xfb485b[_0x77a6('0x2e')]=_[_0x77a6('0x2f')](_0x39cf57);_0xfb485b[_0x77a6('0x30')]=_['keys'](_0x2d2f77[_0x77a6('0x30')]);_0xfb485b['filters']=_[_0x77a6('0x31')](_0xfb485b[_0x77a6('0x2e')],_0xfb485b[_0x77a6('0x30')]);_0x3809e7[_0x77a6('0x32')]=_['intersection'](_0xfb485b[_0x77a6('0x2e')],qs[_0x77a6('0x33')](_0x2d2f77['query'][_0x77a6('0x33')]));_0x3809e7[_0x77a6('0x32')]=_0x3809e7['attributes']['length']?_0x3809e7[_0x77a6('0x32')]:_0xfb485b[_0x77a6('0x2e')];if(!_0x2d2f77[_0x77a6('0x30')]['hasOwnProperty']('nolimit')){_0x3809e7[_0x77a6('0x20')]=qs['limit'](_0x2d2f77[_0x77a6('0x30')][_0x77a6('0x20')]);_0x3809e7[_0x77a6('0x1f')]=qs['offset'](_0x2d2f77[_0x77a6('0x30')][_0x77a6('0x1f')]);}_0x3809e7[_0x77a6('0x34')]=qs[_0x77a6('0x35')](_0x2d2f77[_0x77a6('0x30')][_0x77a6('0x35')]);_0x3809e7[_0x77a6('0x36')]=qs['filters'](_[_0x77a6('0x37')](_0x2d2f77[_0x77a6('0x30')],_0xfb485b[_0x77a6('0x38')]),_0x39cf57);if(_0x2d2f77['query'][_0x77a6('0x39')]){_0x3809e7['where']=_[_0x77a6('0x3a')](_0x3809e7[_0x77a6('0x36')],{'$or':_[_0x77a6('0x3b')](_0x3809e7[_0x77a6('0x32')],function(_0x5ac8cc){var _0x4793c9={};_0x4793c9[_0x5ac8cc]={'$like':'%'+_0x2d2f77[_0x77a6('0x30')]['filter']+'%'};return _0x4793c9;})});}_0x3809e7=_[_0x77a6('0x3a')]({},_0x3809e7,_0x2d2f77[_0x77a6('0x3c')]);var _0x1aa89c={'where':_0x3809e7[_0x77a6('0x36')]};return db[_0x77a6('0x3d')]['count'](_0x1aa89c)[_0x77a6('0x26')](function(_0x5b3620){_0x534f2c['count']=_0x5b3620;if(_0x2d2f77[_0x77a6('0x30')][_0x77a6('0x3e')]){_0x3809e7['include']=[{'all':!![]}];}return db[_0x77a6('0x3d')][_0x77a6('0x3f')](_0x3809e7);})[_0x77a6('0x26')](function(_0x268ee4){_0x534f2c[_0x77a6('0x40')]=_0x268ee4;return _0x534f2c;})[_0x77a6('0x26')](respondWithFilteredResult(_0x689fb3,_0x3809e7))[_0x77a6('0x41')](handleError(_0x689fb3,null));})[_0x77a6('0x41')](handleError(_0x689fb3,null));};exports[_0x77a6('0x42')]=function(_0x214de4,_0x40e5a8){var _0x2ebf99={'raw':![],'where':{'id':_0x214de4[_0x77a6('0x43')]['id']}},_0x527102={};_0x527102['model']=_['keys'](db[_0x77a6('0x3d')]['rawAttributes']);_0x527102[_0x77a6('0x30')]=_['keys'](_0x214de4[_0x77a6('0x30')]);_0x527102[_0x77a6('0x38')]=_['intersection'](_0x527102['model'],_0x527102[_0x77a6('0x30')]);_0x2ebf99['attributes']=_[_0x77a6('0x31')](_0x527102[_0x77a6('0x2e')],qs[_0x77a6('0x33')](_0x214de4[_0x77a6('0x30')]['fields']));_0x2ebf99[_0x77a6('0x32')]=_0x2ebf99[_0x77a6('0x32')][_0x77a6('0x44')]?_0x2ebf99[_0x77a6('0x32')]:_0x527102['model'];if(_0x214de4[_0x77a6('0x30')][_0x77a6('0x3e')]){_0x2ebf99[_0x77a6('0x45')]=[{'all':!![]}];}_0x2ebf99=_['merge']({},_0x2ebf99,_0x214de4[_0x77a6('0x3c')]);return db[_0x77a6('0x3d')][_0x77a6('0x46')](_0x2ebf99)[_0x77a6('0x26')](handleEntityNotFound(_0x40e5a8,null))['then'](respondWithResult(_0x40e5a8,null))[_0x77a6('0x41')](handleError(_0x40e5a8,null));};exports[_0x77a6('0x47')]=function(_0x1bcafd,_0x558583){return db[_0x77a6('0x3d')][_0x77a6('0x47')](_0x1bcafd[_0x77a6('0x48')],{})[_0x77a6('0x26')](function(_0x5b2a5a){var _0x4c2149=_0x1bcafd[_0x77a6('0x49')][_0x77a6('0x27')]({'plain':!![]});if(!_0x4c2149)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c2149[_0x77a6('0x4a')]===_0x77a6('0x49')){var _0x1f0ae0=_0x5b2a5a[_0x77a6('0x27')]({'plain':!![]});var _0x2150c4='Companies';return db[_0x77a6('0x4b')][_0x77a6('0x46')]({'where':{'name':_0x2150c4,'userProfileId':_0x4c2149['userProfileId']},'raw':!![]})[_0x77a6('0x26')](function(_0x340c63){if(_0x340c63&&_0x340c63['autoAssociation']===0x0){return db[_0x77a6('0x28')][_0x77a6('0x47')]({'name':_0x1f0ae0[_0x77a6('0x2a')],'resourceId':_0x1f0ae0['id'],'type':_0x340c63[_0x77a6('0x2a')],'sectionId':_0x340c63['id']},{})[_0x77a6('0x26')](function(){return _0x5b2a5a;});}else{return _0x5b2a5a;}})['catch'](function(_0x1b44db){logger[_0x77a6('0x4c')](_0x77a6('0x4d'),_0x1b44db);throw _0x1b44db;});}return _0x5b2a5a;})[_0x77a6('0x26')](respondWithResult(_0x558583,0xc9))[_0x77a6('0x41')](handleError(_0x558583,null));};exports[_0x77a6('0x24')]=function(_0x17a437,_0x5e9009){if(_0x17a437[_0x77a6('0x48')]['id']){delete _0x17a437[_0x77a6('0x48')]['id'];}return db[_0x77a6('0x3d')][_0x77a6('0x46')]({'where':{'id':_0x17a437[_0x77a6('0x43')]['id']}})[_0x77a6('0x26')](handleEntityNotFound(_0x5e9009,null))[_0x77a6('0x26')](saveUpdates(_0x17a437['body'],null))['then'](respondWithResult(_0x5e9009,null))[_0x77a6('0x41')](handleError(_0x5e9009,null));};exports[_0x77a6('0x25')]=function(_0x36b736,_0x43f791){return db[_0x77a6('0x3d')]['find']({'where':{'id':_0x36b736[_0x77a6('0x43')]['id']}})[_0x77a6('0x26')](handleEntityNotFound(_0x43f791,null))['then'](removeEntity(_0x43f791,null))[_0x77a6('0x41')](handleError(_0x43f791,null));};exports[_0x77a6('0x2d')]=function(_0x417091,_0x223dc5){return db[_0x77a6('0x3d')][_0x77a6('0x2d')]()['then'](respondWithResult(_0x223dc5,null))[_0x77a6('0x41')](handleError(_0x223dc5,null));};exports['addContacts']=function(_0x2e4a,_0x317c7f,_0x398003){return db['CmContact'][_0x77a6('0x46')]({'where':{'id':_0x2e4a[_0x77a6('0x43')]['id']}})[_0x77a6('0x26')](handleEntityNotFound(_0x317c7f,null))[_0x77a6('0x26')](function(_0xf1da7b){if(_0xf1da7b){return _0xf1da7b[_0x77a6('0x4e')](_0x2e4a[_0x77a6('0x48')]['ids'],_[_0x77a6('0x4f')](_0x2e4a[_0x77a6('0x48')],['ids','id'])||{});}})[_0x77a6('0x26')](respondWithResult(_0x317c7f,null))[_0x77a6('0x41')](handleError(_0x317c7f,null));};exports['getContacts']=function(_0x37c2bd,_0x546e70,_0x62f0d2){var _0x331eed={};var _0x30d3d1={};var _0x54fd7b;var _0xa9516;return db[_0x77a6('0x3d')]['findOne']({'where':{'id':_0x37c2bd[_0x77a6('0x43')]['id']}})[_0x77a6('0x26')](handleEntityNotFound(_0x546e70,null))[_0x77a6('0x26')](function(_0x571134){if(_0x571134){_0x54fd7b=_0x571134;_0x30d3d1[_0x77a6('0x2e')]=_[_0x77a6('0x2f')](db[_0x77a6('0x50')][_0x77a6('0x51')]);_0x30d3d1[_0x77a6('0x30')]=_[_0x77a6('0x2f')](_0x37c2bd[_0x77a6('0x30')]);_0x30d3d1[_0x77a6('0x38')]=_[_0x77a6('0x31')](_0x30d3d1[_0x77a6('0x2e')],_0x30d3d1['query']);_0x331eed[_0x77a6('0x32')]=_['intersection'](_0x30d3d1[_0x77a6('0x2e')],qs[_0x77a6('0x33')](_0x37c2bd['query'][_0x77a6('0x33')]));_0x331eed[_0x77a6('0x32')]=_0x331eed[_0x77a6('0x32')][_0x77a6('0x44')]?_0x331eed['attributes']:_0x30d3d1[_0x77a6('0x2e')];_0x331eed[_0x77a6('0x34')]=qs[_0x77a6('0x35')](_0x37c2bd[_0x77a6('0x30')][_0x77a6('0x35')]);_0x331eed['where']=qs['filters'](_['pick'](_0x37c2bd[_0x77a6('0x30')],_0x30d3d1[_0x77a6('0x38')]));if(_0x37c2bd['query'][_0x77a6('0x39')]){_0x331eed[_0x77a6('0x36')]=_['merge'](_0x331eed[_0x77a6('0x36')],{'$or':_[_0x77a6('0x3b')](_0x331eed['attributes'],function(_0x5c31a3){var _0x3f942c={};_0x3f942c[_0x5c31a3]={'$like':'%'+_0x37c2bd[_0x77a6('0x30')][_0x77a6('0x39')]+'%'};return _0x3f942c;})});}_0x331eed=_[_0x77a6('0x3a')]({},_0x331eed,_0x37c2bd[_0x77a6('0x3c')]);return _0x54fd7b[_0x77a6('0x52')](_0x331eed);}})['then'](function(_0x25feb8){if(_0x25feb8){_0xa9516=_0x25feb8['length'];if(!_0x37c2bd['query']['hasOwnProperty'](_0x77a6('0x53'))){_0x331eed[_0x77a6('0x20')]=qs['limit'](_0x37c2bd[_0x77a6('0x30')][_0x77a6('0x20')]);_0x331eed[_0x77a6('0x1f')]=qs[_0x77a6('0x1f')](_0x37c2bd[_0x77a6('0x30')][_0x77a6('0x1f')]);}return _0x54fd7b[_0x77a6('0x52')](_0x331eed);}})['then'](function(_0x14bcdb){if(_0x14bcdb){return _0x14bcdb?{'count':_0xa9516,'rows':_0x14bcdb}:null;}})[_0x77a6('0x26')](respondWithResult(_0x546e70,null))[_0x77a6('0x41')](handleError(_0x546e70,null));}; \ No newline at end of file +var _0x5323=['Companies','UserProfileResource','error','name','CmCompany','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','map','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','CmContact','addContacts','ids','omit','getContacts','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x5323,0x1e8));var _0x3532=function(_0x4495f4,_0x1df31f){_0x4495f4=_0x4495f4-0x0;var _0xc2651c=_0x5323[_0x4495f4];return _0xc2651c;};'use strict';var emlformat=require(_0x3532('0x0'));var rimraf=require(_0x3532('0x1'));var zipdir=require(_0x3532('0x2'));var jsonpatch=require(_0x3532('0x3'));var rp=require(_0x3532('0x4'));var moment=require('moment');var BPromise=require(_0x3532('0x5'));var Mustache=require(_0x3532('0x6'));var util=require(_0x3532('0x7'));var path=require('path');var sox=require(_0x3532('0x8'));var csv=require(_0x3532('0x9'));var ejs=require(_0x3532('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3532('0xb'));var squel=require(_0x3532('0xc'));var crypto=require(_0x3532('0xd'));var jsforce=require(_0x3532('0xe'));var deskjs=require(_0x3532('0xf'));var toCsv=require(_0x3532('0x9'));var querystring=require('querystring');var Papa=require(_0x3532('0x10'));var Redis=require(_0x3532('0x11'));var authService=require(_0x3532('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3532('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3532('0x14'));var utils=require(_0x3532('0x15'));var config=require(_0x3532('0x16'));var licenseUtil=require(_0x3532('0x17'));var db=require(_0x3532('0x18'))['db'];function respondWithStatusCode(_0x379f29,_0x212786){_0x212786=_0x212786||0xcc;return function(_0x4a56c2){if(_0x4a56c2){return _0x379f29[_0x3532('0x19')](_0x212786);}return _0x379f29[_0x3532('0x1a')](_0x212786)[_0x3532('0x1b')]();};}function respondWithResult(_0x80089b,_0x465846){_0x465846=_0x465846||0xc8;return function(_0x706a49){if(_0x706a49){return _0x80089b['status'](_0x465846)[_0x3532('0x1c')](_0x706a49);}};}function respondWithFilteredResult(_0x4e3ffd,_0x3d619b){return function(_0x580693){if(_0x580693){var _0x19ed61=typeof _0x3d619b[_0x3532('0x1d')]==='undefined'&&typeof _0x3d619b[_0x3532('0x1e')]===_0x3532('0x1f');var _0x48eb5d=_0x580693[_0x3532('0x20')];var _0x19b3c5=_0x19ed61?0x0:_0x3d619b[_0x3532('0x1d')];var _0x3be0ec=_0x19ed61?_0x580693['count']:_0x3d619b[_0x3532('0x1d')]+_0x3d619b[_0x3532('0x1e')];var _0x1e961c;if(_0x3be0ec>=_0x48eb5d){_0x3be0ec=_0x48eb5d;_0x1e961c=0xc8;}else{_0x1e961c=0xce;}_0x4e3ffd[_0x3532('0x1a')](_0x1e961c);return _0x4e3ffd[_0x3532('0x21')](_0x3532('0x22'),_0x19b3c5+'-'+_0x3be0ec+'/'+_0x48eb5d)[_0x3532('0x1c')](_0x580693);}return null;};}function patchUpdates(_0x5eea7e){return function(_0x56f35f){try{jsonpatch['apply'](_0x56f35f,_0x5eea7e,!![]);}catch(_0x5ca2ca){return BPromise[_0x3532('0x23')](_0x5ca2ca);}return _0x56f35f[_0x3532('0x24')]();};}function saveUpdates(_0x82cde4,_0x450a32){return function(_0x2b1e03){if(_0x2b1e03){return _0x2b1e03[_0x3532('0x25')](_0x82cde4)['then'](function(_0x54be45){return _0x54be45;});}return null;};}function removeEntity(_0x1836a7,_0x5e97b8){return function(_0xbe99eb){if(_0xbe99eb){return _0xbe99eb[_0x3532('0x26')]()[_0x3532('0x27')](function(){var _0x3751d8=_0xbe99eb['get']({'plain':!![]});var _0x146c4d=_0x3532('0x28');return db[_0x3532('0x29')]['destroy']({'where':{'type':_0x146c4d,'resourceId':_0x3751d8['id']}})[_0x3532('0x27')](function(){return _0xbe99eb;});})[_0x3532('0x27')](function(){_0x1836a7['status'](0xcc)[_0x3532('0x1b')]();});}};}function handleEntityNotFound(_0x206cd6,_0x3cacae){return function(_0x47fe58){if(!_0x47fe58){_0x206cd6[_0x3532('0x19')](0x194);}return _0x47fe58;};}function handleError(_0x28dc84,_0x23d003){_0x23d003=_0x23d003||0x1f4;return function(_0x2c38b7){logger[_0x3532('0x2a')](_0x2c38b7['stack']);if(_0x2c38b7[_0x3532('0x2b')]){delete _0x2c38b7[_0x3532('0x2b')];}_0x28dc84[_0x3532('0x1a')](_0x23d003)['send'](_0x2c38b7);};}exports['index']=function(_0x495a03,_0x56d634){var _0x5260c5={},_0x144ad9={},_0x409fd3={'count':0x0,'rows':[]};return db[_0x3532('0x2c')]['describe']()[_0x3532('0x27')](function(_0x5b6f19){_0x144ad9[_0x3532('0x2d')]=_[_0x3532('0x2e')](_0x5b6f19);_0x144ad9[_0x3532('0x2f')]=_[_0x3532('0x2e')](_0x495a03[_0x3532('0x2f')]);_0x144ad9[_0x3532('0x30')]=_[_0x3532('0x31')](_0x144ad9[_0x3532('0x2d')],_0x144ad9[_0x3532('0x2f')]);_0x5260c5[_0x3532('0x32')]=_[_0x3532('0x31')](_0x144ad9[_0x3532('0x2d')],qs[_0x3532('0x33')](_0x495a03[_0x3532('0x2f')][_0x3532('0x33')]));_0x5260c5[_0x3532('0x32')]=_0x5260c5[_0x3532('0x32')][_0x3532('0x34')]?_0x5260c5['attributes']:_0x144ad9[_0x3532('0x2d')];if(!_0x495a03[_0x3532('0x2f')]['hasOwnProperty'](_0x3532('0x35'))){_0x5260c5[_0x3532('0x1e')]=qs[_0x3532('0x1e')](_0x495a03[_0x3532('0x2f')][_0x3532('0x1e')]);_0x5260c5[_0x3532('0x1d')]=qs[_0x3532('0x1d')](_0x495a03[_0x3532('0x2f')][_0x3532('0x1d')]);}_0x5260c5[_0x3532('0x36')]=qs[_0x3532('0x37')](_0x495a03[_0x3532('0x2f')]['sort']);_0x5260c5[_0x3532('0x38')]=qs[_0x3532('0x30')](_[_0x3532('0x39')](_0x495a03[_0x3532('0x2f')],_0x144ad9[_0x3532('0x30')]),_0x5b6f19);if(_0x495a03[_0x3532('0x2f')][_0x3532('0x3a')]){_0x5260c5[_0x3532('0x38')]=_['merge'](_0x5260c5['where'],{'$or':_[_0x3532('0x3b')](_0x5260c5[_0x3532('0x32')],function(_0x4de40d){var _0x3dbcbc={};_0x3dbcbc[_0x4de40d]={'$like':'%'+_0x495a03['query'][_0x3532('0x3a')]+'%'};return _0x3dbcbc;})});}_0x5260c5=_[_0x3532('0x3c')]({},_0x5260c5,_0x495a03[_0x3532('0x3d')]);var _0x476f54={'where':_0x5260c5[_0x3532('0x38')]};return db[_0x3532('0x2c')]['count'](_0x476f54)[_0x3532('0x27')](function(_0x149201){_0x409fd3[_0x3532('0x20')]=_0x149201;if(_0x495a03[_0x3532('0x2f')][_0x3532('0x3e')]){_0x5260c5[_0x3532('0x3f')]=[{'all':!![]}];}return db[_0x3532('0x2c')][_0x3532('0x40')](_0x5260c5);})[_0x3532('0x27')](function(_0x443a61){_0x409fd3[_0x3532('0x41')]=_0x443a61;return _0x409fd3;})['then'](respondWithFilteredResult(_0x56d634,_0x5260c5))[_0x3532('0x42')](handleError(_0x56d634,null));})[_0x3532('0x42')](handleError(_0x56d634,null));};exports[_0x3532('0x43')]=function(_0x221e7f,_0x1c98b7){var _0x2acf54={'raw':![],'where':{'id':_0x221e7f['params']['id']}},_0x3c7e19={};_0x3c7e19[_0x3532('0x2d')]=_['keys'](db[_0x3532('0x2c')][_0x3532('0x44')]);_0x3c7e19[_0x3532('0x2f')]=_[_0x3532('0x2e')](_0x221e7f[_0x3532('0x2f')]);_0x3c7e19[_0x3532('0x30')]=_['intersection'](_0x3c7e19[_0x3532('0x2d')],_0x3c7e19['query']);_0x2acf54[_0x3532('0x32')]=_[_0x3532('0x31')](_0x3c7e19[_0x3532('0x2d')],qs[_0x3532('0x33')](_0x221e7f[_0x3532('0x2f')][_0x3532('0x33')]));_0x2acf54[_0x3532('0x32')]=_0x2acf54[_0x3532('0x32')][_0x3532('0x34')]?_0x2acf54['attributes']:_0x3c7e19[_0x3532('0x2d')];if(_0x221e7f['query']['includeAll']){_0x2acf54[_0x3532('0x3f')]=[{'all':!![]}];}_0x2acf54=_['merge']({},_0x2acf54,_0x221e7f[_0x3532('0x3d')]);return db['CmCompany'][_0x3532('0x45')](_0x2acf54)['then'](handleEntityNotFound(_0x1c98b7,null))[_0x3532('0x27')](respondWithResult(_0x1c98b7,null))[_0x3532('0x42')](handleError(_0x1c98b7,null));};exports[_0x3532('0x46')]=function(_0x70a162,_0x1f12e0){return db['CmCompany'][_0x3532('0x46')](_0x70a162[_0x3532('0x47')],{})[_0x3532('0x27')](function(_0x5883e6){var _0x200588=_0x70a162[_0x3532('0x48')][_0x3532('0x49')]({'plain':!![]});if(!_0x200588)throw new Error(_0x3532('0x4a'));if(_0x200588[_0x3532('0x4b')]==='user'){var _0x5a3605=_0x5883e6[_0x3532('0x49')]({'plain':!![]});var _0x493e6c=_0x3532('0x28');return db[_0x3532('0x4c')][_0x3532('0x45')]({'where':{'name':_0x493e6c,'userProfileId':_0x200588[_0x3532('0x4d')]},'raw':!![]})[_0x3532('0x27')](function(_0xd347ad){if(_0xd347ad&&_0xd347ad[_0x3532('0x4e')]===0x0){return db[_0x3532('0x29')][_0x3532('0x46')]({'name':_0x5a3605[_0x3532('0x2b')],'resourceId':_0x5a3605['id'],'type':_0xd347ad[_0x3532('0x2b')],'sectionId':_0xd347ad['id']},{})[_0x3532('0x27')](function(){return _0x5883e6;});}else{return _0x5883e6;}})['catch'](function(_0x253a40){logger['error'](_0x3532('0x4f'),_0x253a40);throw _0x253a40;});}return _0x5883e6;})[_0x3532('0x27')](respondWithResult(_0x1f12e0,0xc9))[_0x3532('0x42')](handleError(_0x1f12e0,null));};exports['update']=function(_0x550585,_0x19b9af){if(_0x550585[_0x3532('0x47')]['id']){delete _0x550585['body']['id'];}return db[_0x3532('0x2c')][_0x3532('0x45')]({'where':{'id':_0x550585[_0x3532('0x50')]['id']}})['then'](handleEntityNotFound(_0x19b9af,null))[_0x3532('0x27')](saveUpdates(_0x550585[_0x3532('0x47')],null))['then'](respondWithResult(_0x19b9af,null))[_0x3532('0x42')](handleError(_0x19b9af,null));};exports['destroy']=function(_0x6c93a1,_0x593938){return db[_0x3532('0x2c')][_0x3532('0x45')]({'where':{'id':_0x6c93a1[_0x3532('0x50')]['id']}})[_0x3532('0x27')](handleEntityNotFound(_0x593938,null))['then'](removeEntity(_0x593938,null))[_0x3532('0x42')](handleError(_0x593938,null));};exports['describe']=function(_0x1282bb,_0x44b6a7){return db[_0x3532('0x2c')][_0x3532('0x51')]()[_0x3532('0x27')](respondWithResult(_0x44b6a7,null))['catch'](handleError(_0x44b6a7,null));};exports['addContacts']=function(_0x15e7fb,_0x100d84,_0x1a7cec){return db[_0x3532('0x52')][_0x3532('0x45')]({'where':{'id':_0x15e7fb[_0x3532('0x50')]['id']}})['then'](handleEntityNotFound(_0x100d84,null))['then'](function(_0x5bce3d){if(_0x5bce3d){return _0x5bce3d[_0x3532('0x53')](_0x15e7fb[_0x3532('0x47')][_0x3532('0x54')],_[_0x3532('0x55')](_0x15e7fb[_0x3532('0x47')],['ids','id'])||{});}})['then'](respondWithResult(_0x100d84,null))[_0x3532('0x42')](handleError(_0x100d84,null));};exports[_0x3532('0x56')]=function(_0x380a30,_0x480359,_0x197b20){var _0x23674b={};var _0x11d3da={};var _0x1fab4f;var _0x5b288b;return db[_0x3532('0x2c')]['findOne']({'where':{'id':_0x380a30[_0x3532('0x50')]['id']}})[_0x3532('0x27')](handleEntityNotFound(_0x480359,null))[_0x3532('0x27')](function(_0x2120b0){if(_0x2120b0){_0x1fab4f=_0x2120b0;_0x11d3da[_0x3532('0x2d')]=_[_0x3532('0x2e')](db['CmContact'][_0x3532('0x44')]);_0x11d3da['query']=_[_0x3532('0x2e')](_0x380a30[_0x3532('0x2f')]);_0x11d3da[_0x3532('0x30')]=_[_0x3532('0x31')](_0x11d3da['model'],_0x11d3da[_0x3532('0x2f')]);_0x23674b[_0x3532('0x32')]=_[_0x3532('0x31')](_0x11d3da[_0x3532('0x2d')],qs[_0x3532('0x33')](_0x380a30[_0x3532('0x2f')]['fields']));_0x23674b[_0x3532('0x32')]=_0x23674b[_0x3532('0x32')][_0x3532('0x34')]?_0x23674b[_0x3532('0x32')]:_0x11d3da['model'];_0x23674b[_0x3532('0x36')]=qs[_0x3532('0x37')](_0x380a30['query'][_0x3532('0x37')]);_0x23674b[_0x3532('0x38')]=qs[_0x3532('0x30')](_[_0x3532('0x39')](_0x380a30[_0x3532('0x2f')],_0x11d3da[_0x3532('0x30')]));if(_0x380a30['query'][_0x3532('0x3a')]){_0x23674b['where']=_['merge'](_0x23674b[_0x3532('0x38')],{'$or':_[_0x3532('0x3b')](_0x23674b[_0x3532('0x32')],function(_0x6d4e7){var _0x52a89a={};_0x52a89a[_0x6d4e7]={'$like':'%'+_0x380a30[_0x3532('0x2f')][_0x3532('0x3a')]+'%'};return _0x52a89a;})});}_0x23674b=_['merge']({},_0x23674b,_0x380a30['options']);return _0x1fab4f[_0x3532('0x56')](_0x23674b);}})[_0x3532('0x27')](function(_0x1e406e){if(_0x1e406e){_0x5b288b=_0x1e406e[_0x3532('0x34')];if(!_0x380a30['query'][_0x3532('0x57')](_0x3532('0x35'))){_0x23674b['limit']=qs['limit'](_0x380a30[_0x3532('0x2f')]['limit']);_0x23674b[_0x3532('0x1d')]=qs[_0x3532('0x1d')](_0x380a30['query'][_0x3532('0x1d')]);}return _0x1fab4f[_0x3532('0x56')](_0x23674b);}})[_0x3532('0x27')](function(_0x3dd9d7){if(_0x3dd9d7){return _0x3dd9d7?{'count':_0x5b288b,'rows':_0x3dd9d7}:null;}})['then'](respondWithResult(_0x480359,null))['catch'](handleError(_0x480359,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index a08de6e..77b2709 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 _0x78c2=['rimraf','./cmCompany.attributes','exports','define','cm_companies','lodash','util','moment','bluebird'];(function(_0xa82c60,_0x3f05bf){var _0x291fef=function(_0x31feda){while(--_0x31feda){_0xa82c60['push'](_0xa82c60['shift']());}};_0x291fef(++_0x3f05bf);}(_0x78c2,0xcb));var _0x278c=function(_0x30fcdb,_0x553637){_0x30fcdb=_0x30fcdb-0x0;var _0x4ccd2e=_0x78c2[_0x30fcdb];return _0x4ccd2e;};'use strict';var _=require(_0x278c('0x0'));var util=require(_0x278c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x278c('0x2'));var BPromise=require(_0x278c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x278c('0x4'));var config=require('../../config/environment');var attributes=require(_0x278c('0x5'));module[_0x278c('0x6')]=function(_0x22e738,_0x1d0262){return _0x22e738[_0x278c('0x7')]('CmCompany',attributes,{'tableName':_0x278c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadcd=['request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','api','moment'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xadcd,0x141));var _0xdadc=function(_0x17e3d6,_0x40ec46){_0x17e3d6=_0x17e3d6-0x0;var _0x987bbe=_0xadcd[_0x17e3d6];return _0x987bbe;};'use strict';var _=require(_0xdadc('0x0'));var util=require(_0xdadc('0x1'));var logger=require('../../config/logger')(_0xdadc('0x2'));var moment=require(_0xdadc('0x3'));var BPromise=require('bluebird');var rp=require(_0xdadc('0x4'));var fs=require('fs');var path=require(_0xdadc('0x5'));var rimraf=require(_0xdadc('0x6'));var config=require(_0xdadc('0x7'));var attributes=require(_0xdadc('0x8'));module[_0xdadc('0x9')]=function(_0x516874,_0x17614c){return _0x516874[_0xdadc('0xa')](_0xdadc('0xb'),attributes,{'tableName':_0xdadc('0xc'),'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 245b922..8d416e0 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 _0x5d52=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','bluebird'];(function(_0x3f8561,_0x294bd2){var _0x529730=function(_0x33baaa){while(--_0x33baaa){_0x3f8561['push'](_0x3f8561['shift']());}};_0x529730(++_0x294bd2);}(_0x5d52,0x1cd));var _0x25d5=function(_0x53afa6,_0x59e786){_0x53afa6=_0x53afa6-0x0;var _0x51f86a=_0x5d52[_0x53afa6];return _0x51f86a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x25d5('0x0'));var rs=require(_0x25d5('0x1'));var fs=require('fs');var Redis=require(_0x25d5('0x2'));var db=require(_0x25d5('0x3'))['db'];var utils=require(_0x25d5('0x4'));var logger=require(_0x25d5('0x5'))(_0x25d5('0x6'));var config=require(_0x25d5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x25d5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2dca8c,_0x1793c,_0x584c96){return new BPromise(function(_0x170899,_0xb88ec6){return client[_0x25d5('0x9')](_0x2dca8c,_0x584c96)[_0x25d5('0xa')](function(_0x227516){logger['info'](_0x25d5('0xb'),_0x1793c,_0x25d5('0xc'));logger[_0x25d5('0xd')](_0x25d5('0xe'),_0x1793c,_0x25d5('0xc'),JSON[_0x25d5('0xf')](_0x227516));if(_0x227516[_0x25d5('0x10')]){if(_0x227516[_0x25d5('0x10')][_0x25d5('0x11')]===0x1f4){logger[_0x25d5('0x10')](_0x25d5('0xb'),_0x1793c,_0x227516['error'][_0x25d5('0x12')]);return _0xb88ec6(_0x227516[_0x25d5('0x10')][_0x25d5('0x12')]);}logger[_0x25d5('0x10')](_0x25d5('0xb'),_0x1793c,_0x227516[_0x25d5('0x10')][_0x25d5('0x12')]);return _0x170899(_0x227516[_0x25d5('0x10')][_0x25d5('0x12')]);}else{logger[_0x25d5('0x13')]('CmCompany,\x20%s,\x20%s',_0x1793c,_0x25d5('0xc'));_0x170899(_0x227516[_0x25d5('0x14')]['message']);}})[_0x25d5('0x15')](function(_0x21119e){logger['error'](_0x25d5('0xb'),_0x1793c,_0x21119e);_0xb88ec6(_0x21119e);});});} \ No newline at end of file +var _0x2b01=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','CmCompany,\x20%s,\x20%s','result','catch','util','moment','bluebird'];(function(_0x14f7fe,_0x5132c4){var _0x3d8309=function(_0x22f5c7){while(--_0x22f5c7){_0x14f7fe['push'](_0x14f7fe['shift']());}};_0x3d8309(++_0x5132c4);}(_0x2b01,0xed));var _0x12b0=function(_0xff4115,_0x4ee874){_0xff4115=_0xff4115-0x0;var _0x271f95=_0x2b01[_0xff4115];return _0x271f95;};'use strict';var _=require('lodash');var util=require(_0x12b0('0x0'));var moment=require(_0x12b0('0x1'));var BPromise=require(_0x12b0('0x2'));var rs=require(_0x12b0('0x3'));var fs=require('fs');var Redis=require(_0x12b0('0x4'));var db=require(_0x12b0('0x5'))['db'];var utils=require(_0x12b0('0x6'));var logger=require('../../config/logger')(_0x12b0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x128afc,_0x54ea84,_0x1b29da){return new BPromise(function(_0x449c6c,_0x491a3d){return client[_0x12b0('0x8')](_0x128afc,_0x1b29da)[_0x12b0('0x9')](function(_0x5b9d06){logger[_0x12b0('0xa')]('CmCompany,\x20%s,\x20%s',_0x54ea84,_0x12b0('0xb'));logger[_0x12b0('0xc')](_0x12b0('0xd'),_0x54ea84,'request\x20sent',JSON[_0x12b0('0xe')](_0x5b9d06));if(_0x5b9d06['error']){if(_0x5b9d06[_0x12b0('0xf')]['code']===0x1f4){logger[_0x12b0('0xf')]('CmCompany,\x20%s,\x20%s',_0x54ea84,_0x5b9d06[_0x12b0('0xf')][_0x12b0('0x10')]);return _0x491a3d(_0x5b9d06[_0x12b0('0xf')][_0x12b0('0x10')]);}logger['error'](_0x12b0('0x11'),_0x54ea84,_0x5b9d06[_0x12b0('0xf')][_0x12b0('0x10')]);return _0x449c6c(_0x5b9d06['error']['message']);}else{logger[_0x12b0('0xa')](_0x12b0('0x11'),_0x54ea84,_0x12b0('0xb'));_0x449c6c(_0x5b9d06[_0x12b0('0x12')][_0x12b0('0x10')]);}})[_0x12b0('0x13')](function(_0x3ae4cd){logger['error'](_0x12b0('0x11'),_0x54ea84,_0x3ae4cd);_0x491a3d(_0x3ae4cd);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index d4abe56..48ad87b 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 _0x4f27=['/:id','/:id/contacts','getContacts','post','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/describe','isAuthenticated'];(function(_0x41e8c4,_0x30d9ff){var _0x54ffbe=function(_0x4131af){while(--_0x4131af){_0x41e8c4['push'](_0x41e8c4['shift']());}};_0x54ffbe(++_0x30d9ff);}(_0x4f27,0x8c));var _0x74f2=function(_0x198a95,_0x3f0ffe){_0x198a95=_0x198a95-0x0;var _0x557884=_0x4f27[_0x198a95];return _0x557884;};'use strict';var multer=require(_0x74f2('0x0'));var util=require('util');var path=require(_0x74f2('0x1'));var timeout=require('connect-timeout');var express=require(_0x74f2('0x2'));var router=express[_0x74f2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x74f2('0x4'));var interaction=require(_0x74f2('0x5'));var config=require(_0x74f2('0x6'));var controller=require(_0x74f2('0x7'));router[_0x74f2('0x8')]('/',auth['isAuthenticated'](),controller[_0x74f2('0x9')]);router[_0x74f2('0x8')](_0x74f2('0xa'),auth[_0x74f2('0xb')](),controller['describe']);router[_0x74f2('0x8')](_0x74f2('0xc'),auth[_0x74f2('0xb')](),controller['show']);router[_0x74f2('0x8')](_0x74f2('0xd'),auth[_0x74f2('0xb')](),controller[_0x74f2('0xe')]);router[_0x74f2('0xf')]('/',auth[_0x74f2('0xb')](),controller['create']);router[_0x74f2('0xf')](_0x74f2('0xd'),auth[_0x74f2('0xb')](),controller['addContacts']);router['put'](_0x74f2('0xc'),auth[_0x74f2('0xb')](),controller['update']);router[_0x74f2('0x10')](_0x74f2('0xc'),auth[_0x74f2('0xb')](),controller[_0x74f2('0x11')]);module[_0x74f2('0x12')]=router; \ No newline at end of file +var _0x39ff=['../../config/environment','./cmCompany.controller','isAuthenticated','get','/describe','show','/:id/contacts','getContacts','create','post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x55febe,_0x459f86){var _0x35e354=function(_0x5c90b6){while(--_0x5c90b6){_0x55febe['push'](_0x55febe['shift']());}};_0x35e354(++_0x459f86);}(_0x39ff,0xd5));var _0xf39f=function(_0x24d2fc,_0x29f500){_0x24d2fc=_0x24d2fc-0x0;var _0x3cd97f=_0x39ff[_0x24d2fc];return _0x3cd97f;};'use strict';var multer=require(_0xf39f('0x0'));var util=require(_0xf39f('0x1'));var path=require(_0xf39f('0x2'));var timeout=require(_0xf39f('0x3'));var express=require(_0xf39f('0x4'));var router=express[_0xf39f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf39f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf39f('0x7'));var controller=require(_0xf39f('0x8'));router['get']('/',auth[_0xf39f('0x9')](),controller['index']);router[_0xf39f('0xa')](_0xf39f('0xb'),auth[_0xf39f('0x9')](),controller['describe']);router[_0xf39f('0xa')]('/:id',auth[_0xf39f('0x9')](),controller[_0xf39f('0xc')]);router[_0xf39f('0xa')](_0xf39f('0xd'),auth[_0xf39f('0x9')](),controller[_0xf39f('0xe')]);router['post']('/',auth[_0xf39f('0x9')](),controller[_0xf39f('0xf')]);router[_0xf39f('0x10')](_0xf39f('0xd'),auth[_0xf39f('0x9')](),controller['addContacts']);router['put'](_0xf39f('0x11'),auth[_0xf39f('0x9')](),controller[_0xf39f('0x12')]);router[_0xf39f('0x13')](_0xf39f('0x11'),auth[_0xf39f('0x9')](),controller[_0xf39f('0x14')]);module[_0xf39f('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 9dd108a..c630206 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 _0xa8d2=['STRING','TEXT','INTEGER','DATE','lodash','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8d2,0xa0));var _0x2a8d=function(_0xae25f6,_0x2d930b){_0xae25f6=_0xae25f6-0x0;var _0x3d820f=_0xa8d2[_0xae25f6];return _0x3d820f;};'use strict';var _=require(_0x2a8d('0x0'));var Sequelize=require('sequelize');module[_0x2a8d('0x1')]={'firstName':{'type':Sequelize[_0x2a8d('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x2a8d('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x2a8d('0x2')]},'country':{'type':Sequelize[_0x2a8d('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2a8d('0x3')]},'phone':{'type':Sequelize[_0x2a8d('0x2')]},'mobile':{'type':Sequelize[_0x2a8d('0x2')]},'fax':{'type':Sequelize[_0x2a8d('0x2')]},'email':{'type':Sequelize[_0x2a8d('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x2a8d('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x2a8d('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x2a8d('0x2')]},'wechat':{'type':Sequelize[_0x2a8d('0x2')]},'telegram':{'type':Sequelize[_0x2a8d('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x2a8d('0x2')]},'priority':{'type':Sequelize[_0x2a8d('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x2a8d('0x5')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x2a8d('0x2')]},'utcOffset':{'type':Sequelize[_0x2a8d('0x4')]}}; \ No newline at end of file +var _0x2193=['INTEGER','UNSIGNED','DATE','NOW','sequelize','STRING'];(function(_0x5cafe1,_0x3ab7cb){var _0x3acc70=function(_0x60081f){while(--_0x60081f){_0x5cafe1['push'](_0x5cafe1['shift']());}};_0x3acc70(++_0x3ab7cb);}(_0x2193,0x1f0));var _0x3219=function(_0x4d75af,_0x39c35a){_0x4d75af=_0x4d75af-0x0;var _0x2abbea=_0x2193[_0x4d75af];return _0x2abbea;};'use strict';var _=require('lodash');var Sequelize=require(_0x3219('0x0'));module['exports']={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x3219('0x1')]},'street':{'type':Sequelize[_0x3219('0x1')]},'postalCode':{'type':Sequelize[_0x3219('0x1')]},'city':{'type':Sequelize[_0x3219('0x1')]},'country':{'type':Sequelize[_0x3219('0x1')]},'dateOfBirth':{'type':Sequelize[_0x3219('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x3219('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3219('0x1')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x3219('0x1')]},'fb_data':{'type':Sequelize[_0x3219('0x1')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x3219('0x1')]},'viber':{'type':Sequelize[_0x3219('0x1')]},'line':{'type':Sequelize[_0x3219('0x1')]},'wechat':{'type':Sequelize[_0x3219('0x1')]},'telegram':{'type':Sequelize[_0x3219('0x1')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3219('0x2')](0x2)[_0x3219('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x3219('0x4')],'defaultValue':Sequelize[_0x3219('0x5')]},'dialTimezone':{'type':Sequelize[_0x3219('0x1')]},'utcOffset':{'type':Sequelize[_0x3219('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index c8190cd..3288a99 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 _0x4efc=['source','callerid','starttime','endtime','note','createdAt','userDisposition','userThirdDisposition','UserId','fullname','DESC','VoiceCallReport','alias','startCase','Account','closed','disposition','secondDisposition','thirdDisposition','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','openchannel','externalUrl','Interaction','findAndCountAll','flatten','sortBy','reverse','value','moment','bluebird','util','path','lodash','ioredis','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','./cmContact.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','index','describe','getOptions','findAll','query','user','CmContact','find','catch','tags','keys','cf_','columnName','displayName','analytics','CmCustomField','custom','values','info','forEach','hasOwnProperty','merge','body','from','length','get','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappQueueReport','isNil','dialTimezone','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','push','ListId','findOrCreate','spread','all','params','Tag','Tags','color','tag','CmContactHasItem','Phones','ItemType','sequelize','literal','Phones.OrderBy','omit','map','format','cf_%d','timezones','$and','pickBy','startsWith','isEmpty','table','cm_contacts','setFields','toParam','text','phone','getTags','rawAttributes','filters','intersection','model','attributes','fields','order','sort','pick','filter','options','nolimit','setTags','findOne','ids','setAdditionalPhones','items','item_types','description','OrderBy','ItemTypeId','contact\x20phone\x20exists','PHONE','item','ContactItemType','CmHopperId','ItemType.OrderBy','CmHopperAdditionalPhone','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','hopperId','getHoppers','ContactId','include','getHopperHistories','CmHopperHistory','includeAll','rows','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','socket_timestamp','binding_values','split','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','chmodSync','0777','fork','CompanyId','File\x20uploaded\x20correctly!','pid','upload','file','parse','User','agent','binding','child_process','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','chat','sms','whatsapp','-createdAt','resolve','toLowerCase','Invalid\x20channel','channel','range','isValid','Invalid\x20createdAt\x20filter','voice','uniqueid','type'];(function(_0x4c817a,_0x5b67b1){var _0x20ac98=function(_0x4fc8e3){while(--_0x4fc8e3){_0x4c817a['push'](_0x4c817a['shift']());}};_0x20ac98(++_0x5b67b1);}(_0x4efc,0x125));var _0xc4ef=function(_0x261a4a,_0x41ec2e){_0x261a4a=_0x261a4a-0x0;var _0x33da9d=_0x4efc[_0x261a4a];return _0x33da9d;};'use strict';var moment=require(_0xc4ef('0x0'));var BPromise=require(_0xc4ef('0x1'));var util=require(_0xc4ef('0x2'));var path=require(_0xc4ef('0x3'));var fs=require('fs');var _=require(_0xc4ef('0x4'));var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0xc4ef('0x5'));var contacts=require('../../components/contacts');var qs=require('../../components/parsers/qs');var logger=require(_0xc4ef('0x6'))(_0xc4ef('0x7'));var config=require(_0xc4ef('0x8'));var shared=require(_0xc4ef('0x9'));var db=require(_0xc4ef('0xa'))['db'];config[_0xc4ef('0xb')]=_[_0xc4ef('0xc')](config['redis'],{'host':_0xc4ef('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc4ef('0xb')]));require(_0xc4ef('0xe'))[_0xc4ef('0xf')](socket);function respondWithResult(_0x37ae73,_0x8c3349){_0x8c3349=_0x8c3349||0xc8;return function(_0x445cb7){if(_0x445cb7){return _0x37ae73[_0xc4ef('0x10')](_0x8c3349)[_0xc4ef('0x11')](_0x445cb7);}};}function respondWithFilteredResult(_0x17f3c5,_0x1bb71d){return function(_0xf41b43){if(_0xf41b43){var _0x215aa8=typeof _0x1bb71d[_0xc4ef('0x12')]===_0xc4ef('0x13')&&typeof _0x1bb71d['limit']===_0xc4ef('0x13');var _0x4f67f7=_0xf41b43[_0xc4ef('0x14')];var _0x5a0c5f=_0x215aa8?0x0:_0x1bb71d[_0xc4ef('0x12')];var _0x50b6f=_0x215aa8?_0xf41b43[_0xc4ef('0x14')]:_0x1bb71d[_0xc4ef('0x12')]+_0x1bb71d[_0xc4ef('0x15')];var _0x3bd9aa;if(_0x50b6f>=_0x4f67f7){_0x50b6f=_0x4f67f7;_0x3bd9aa=0xc8;}else{_0x3bd9aa=0xce;}_0x17f3c5[_0xc4ef('0x10')](_0x3bd9aa);return _0x17f3c5[_0xc4ef('0x16')](_0xc4ef('0x17'),_0x5a0c5f+'-'+_0x50b6f+'/'+_0x4f67f7)[_0xc4ef('0x11')](_0xf41b43);}return null;};}function saveUpdates(_0x332cea){return function(_0x479dca){if(_0x479dca){return _0x479dca[_0xc4ef('0x18')](_0x332cea)[_0xc4ef('0x19')](function(_0x18b042){return _0x18b042;});}return null;};}function removeEntity(_0x3f8c23){return function(_0x17cd5c){if(_0x17cd5c){return _0x17cd5c[_0xc4ef('0x1a')]()[_0xc4ef('0x19')](function(){_0x3f8c23[_0xc4ef('0x10')](0xcc)[_0xc4ef('0x1b')]();});}};}function handleEntityNotFound(_0x301954){return function(_0x4cc66e){if(!_0x4cc66e){_0x301954[_0xc4ef('0x1c')](0x194);}return _0x4cc66e;};}function handleError(_0x3b03a7,_0x309831){_0x309831=_0x309831||0x1f4;return function(_0xe62609){logger[_0xc4ef('0x1d')](_0xe62609[_0xc4ef('0x1e')]);if(_0xe62609[_0xc4ef('0x1f')]){delete _0xe62609['name'];}_0x3b03a7[_0xc4ef('0x10')](_0x309831)['send'](_0xe62609);};}exports[_0xc4ef('0x20')]=function(_0xcd39a9,_0xc7ee11){var _0x2447fe={};return contacts[_0xc4ef('0x21')]()[_0xc4ef('0x19')](function(_0x4ce73e){_0x2447fe=qs[_0xc4ef('0x22')](_0x4ce73e,_0xcd39a9);return contacts[_0xc4ef('0x23')](_0xcd39a9[_0xc4ef('0x24')],_0xcd39a9[_0xc4ef('0x25')],_0x2447fe,_0x4ce73e);})[_0xc4ef('0x19')](respondWithFilteredResult(_0xc7ee11,_0x2447fe))['catch'](handleError(_0xc7ee11,null));};exports[_0xc4ef('0x1a')]=function(_0x2e6de,_0x45d71d){return db[_0xc4ef('0x26')][_0xc4ef('0x27')]({'where':{'id':_0x2e6de['params']['id']}})[_0xc4ef('0x19')](handleEntityNotFound(_0x45d71d,null))[_0xc4ef('0x19')](removeEntity(_0x45d71d,null))[_0xc4ef('0x28')](handleError(_0x45d71d,null));};exports['describe']=function(_0x4f1ff1,_0x2f514b){return db[_0xc4ef('0x26')][_0xc4ef('0x21')]()[_0xc4ef('0x19')](function(_0x5d4c6b){delete _0x5d4c6b[_0xc4ef('0x29')];for(var _0x46c9dd=0x0;_0x46c9dd0x0){return new Promise(function(_0x46a110){var _0x33126b=[];for(var _0x28fe1f=0x0;_0x28fe1f<_0x489f87[_0xc4ef('0x38')];_0x28fe1f++){_0x33126b[_0xc4ef('0x5c')](insertAdditionalPhones(_0x489f87[_0x28fe1f]['contact'],_0x489f87[_0x28fe1f][_0xc4ef('0x57')]));}Promise[_0xc4ef('0x60')](_0x33126b)[_0xc4ef('0x19')](function(){_0x46a110(0x1);});})[_0xc4ef('0x19')](function(){return{'success':_0x53988d,'failure':_0x2037b7,'duplicates':_0x20b3b9};});}else{return{'success':_0x53988d,'failure':_0x2037b7,'duplicates':_0x20b3b9};}}})[_0xc4ef('0x19')](respondWithResult(_0xa3bafe,0xc9))[_0xc4ef('0x28')](handleError(_0xa3bafe,null));};exports['show']=function(_0x180fd1,_0x58aa69){var _0xd3d0b7;return db[_0xc4ef('0x26')][_0xc4ef('0x21')]()[_0xc4ef('0x19')](function(_0x18fe08){return db[_0xc4ef('0x26')][_0xc4ef('0x27')]({'where':{'id':_0x180fd1[_0xc4ef('0x61')]['id']},'include':[{'model':db[_0xc4ef('0x62')],'as':_0xc4ef('0x63'),'attributes':['id',_0xc4ef('0x1f'),_0xc4ef('0x64')],'required':_0x180fd1['query'][_0xc4ef('0x65')]?!![]:![]},{'model':db[_0xc4ef('0x66')],'as':_0xc4ef('0x67'),'where':{'CmContactId':_0x180fd1[_0xc4ef('0x61')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0xc4ef('0x68')}]}],'order':[db[_0xc4ef('0x69')][_0xc4ef('0x6a')](_0xc4ef('0x6b'))],'attributes':_[_0xc4ef('0x2a')](_0x18fe08)});})[_0xc4ef('0x19')](function(_0x5348de){if(!_[_0xc4ef('0x54')](_0x5348de)){_0xd3d0b7=_0x5348de[_0xc4ef('0x39')]({'plain':!![]});var _0xe2e4e0={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5348de&&_0x5348de[_0xc4ef('0x5d')]){if(_0x5348de['ListId']){_0xe2e4e0['where']['$and'][_0xc4ef('0x5c')]({'ListId':{'$ne':_0x5348de[_0xc4ef('0x5d')]}});}}return db[_0xc4ef('0x2f')][_0xc4ef('0x23')](_0xe2e4e0);}})['then'](function(_0x551c8b){if(!_['isNil'](_0x551c8b)){return _[_0xc4ef('0x6c')](_0xd3d0b7,_[_0xc4ef('0x6d')](_0x551c8b,function(_0x2c9aeb){return util[_0xc4ef('0x6e')](_0xc4ef('0x6f'),_0x2c9aeb['id']);}));}})['then'](handleEntityNotFound(_0x58aa69,null))['then'](respondWithResult(_0x58aa69,null))[_0xc4ef('0x28')](handleError(_0x58aa69,null));};exports[_0xc4ef('0x18')]=function(_0x2ce16a,_0x5c52f2){var _0x401bba;if(_0x2ce16a[_0xc4ef('0x36')]['id']){delete _0x2ce16a[_0xc4ef('0x36')]['id'];}if(!_[_0xc4ef('0x54')](_0x2ce16a[_0xc4ef('0x36')][_0xc4ef('0x55')])){var _0x1e689b=_0x2ce16a[_0xc4ef('0x36')]['dialTimezone'];if(!_['isNil'](shared[_0xc4ef('0x70')][_0x1e689b]))_0x2ce16a[_0xc4ef('0x36')][_0xc4ef('0x56')]=shared[_0xc4ef('0x70')][_0x1e689b][_0xc4ef('0x56')];}return db[_0xc4ef('0x26')]['find']({'where':{'id':_0x2ce16a[_0xc4ef('0x61')]['id']}})['then'](handleEntityNotFound(_0x5c52f2,null))[_0xc4ef('0x19')](saveUpdates(_0x2ce16a[_0xc4ef('0x36')],null))[_0xc4ef('0x19')](function(_0x33e9ce){_0x401bba=_0x33e9ce;var _0x19c9ff={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x33e9ce&&_0x33e9ce[_0xc4ef('0x5d')]){if(_0x33e9ce[_0xc4ef('0x5d')]){_0x19c9ff[_0xc4ef('0x5b')][_0xc4ef('0x71')][_0xc4ef('0x5c')]({'ListId':{'$ne':_0x33e9ce[_0xc4ef('0x5d')]}});}}return db[_0xc4ef('0x2f')][_0xc4ef('0x23')](_0x19c9ff);})[_0xc4ef('0x19')](function(_0x53f6d7){if(_0x53f6d7){return _[_0xc4ef('0x6c')](_[_0xc4ef('0x72')](_0x2ce16a[_0xc4ef('0x36')],function(_0xe09129,_0x51a44d){return _[_0xc4ef('0x73')](_0x51a44d,_0xc4ef('0x2b'));}),_[_0xc4ef('0x6d')](_0x53f6d7,function(_0x1746fb){return util[_0xc4ef('0x6e')](_0xc4ef('0x6f'),_0x1746fb['id']);}));}})[_0xc4ef('0x19')](function(_0x70a93){if(_0x70a93&&!_[_0xc4ef('0x74')](_0x70a93)){var _0x5de488=squel[_0xc4ef('0x18')]()[_0xc4ef('0x75')](_0xc4ef('0x76'))[_0xc4ef('0x77')](_0x70a93)['where']('id\x20=\x20?',_0x2ce16a[_0xc4ef('0x61')]['id'])[_0xc4ef('0x78')]();return db['sequelize'][_0xc4ef('0x24')](_0x5de488[_0xc4ef('0x79')],{'replacements':_0x5de488['values']});}})['then'](function(){if(_0x2ce16a[_0xc4ef('0x36')][_0xc4ef('0x7a')]&&_0x401bba){return db[_0xc4ef('0x3d')][_0xc4ef('0x18')]({'phone':_0x2ce16a[_0xc4ef('0x36')][_0xc4ef('0x7a')],'OrderBy':0x0},{'where':{'ContactId':_0x401bba['id']}});}})[_0xc4ef('0x19')](function(){return _0x401bba;})[_0xc4ef('0x19')](respondWithResult(_0x5c52f2,null))['catch'](handleError(_0x5c52f2,null));};exports[_0xc4ef('0x7b')]=function(_0x2581e4,_0x3b42d0){var _0x54743d={};var _0x3b734a={};var _0x409924;var _0x5dc1f8;return db[_0xc4ef('0x26')]['findOne']({'where':{'id':_0x2581e4['params']['id']}})[_0xc4ef('0x19')](handleEntityNotFound(_0x3b42d0,null))[_0xc4ef('0x19')](function(_0x734907){if(_0x734907){_0x409924=_0x734907;_0x3b734a['model']=_[_0xc4ef('0x2a')](db[_0xc4ef('0x62')][_0xc4ef('0x7c')]);_0x3b734a[_0xc4ef('0x24')]=_[_0xc4ef('0x2a')](_0x2581e4[_0xc4ef('0x24')]);_0x3b734a[_0xc4ef('0x7d')]=_[_0xc4ef('0x7e')](_0x3b734a[_0xc4ef('0x7f')],_0x3b734a[_0xc4ef('0x24')]);_0x54743d[_0xc4ef('0x80')]=_[_0xc4ef('0x7e')](_0x3b734a[_0xc4ef('0x7f')],qs[_0xc4ef('0x81')](_0x2581e4['query'][_0xc4ef('0x81')]));_0x54743d[_0xc4ef('0x80')]=_0x54743d[_0xc4ef('0x80')][_0xc4ef('0x38')]?_0x54743d[_0xc4ef('0x80')]:_0x3b734a[_0xc4ef('0x7f')];_0x54743d[_0xc4ef('0x82')]=qs[_0xc4ef('0x83')](_0x2581e4[_0xc4ef('0x24')][_0xc4ef('0x83')]);_0x54743d['where']=qs[_0xc4ef('0x7d')](_[_0xc4ef('0x84')](_0x2581e4[_0xc4ef('0x24')],_0x3b734a[_0xc4ef('0x7d')]));if(_0x2581e4[_0xc4ef('0x24')]['filter']){_0x54743d['where']=_[_0xc4ef('0x35')](_0x54743d['where'],{'$or':_[_0xc4ef('0x6d')](_0x54743d[_0xc4ef('0x80')],function(_0x196a52){var _0x1a99e0={};_0x1a99e0[_0x196a52]={'$like':'%'+_0x2581e4['query'][_0xc4ef('0x85')]+'%'};return _0x1a99e0;})});}_0x54743d=_[_0xc4ef('0x35')]({},_0x54743d,_0x2581e4[_0xc4ef('0x86')]);return _0x409924['getTags'](_0x54743d);}})[_0xc4ef('0x19')](function(_0x2eca31){if(_0x2eca31){_0x5dc1f8=_0x2eca31['length'];if(!_0x2581e4[_0xc4ef('0x24')]['hasOwnProperty'](_0xc4ef('0x87'))){_0x54743d['limit']=qs['limit'](_0x2581e4['query'][_0xc4ef('0x15')]);_0x54743d['offset']=qs[_0xc4ef('0x12')](_0x2581e4[_0xc4ef('0x24')]['offset']);}return _0x409924['getTags'](_0x54743d);}})[_0xc4ef('0x19')](function(_0x452628){if(_0x452628){return _0x452628?{'count':_0x5dc1f8,'rows':_0x452628}:null;}})[_0xc4ef('0x19')](respondWithResult(_0x3b42d0,null))[_0xc4ef('0x28')](handleError(_0x3b42d0,null));};exports[_0xc4ef('0x88')]=function(_0x5f402e,_0x3b6aa7){if(_0x5f402e[_0xc4ef('0x36')]['id']){delete _0x5f402e['body']['id'];}return db[_0xc4ef('0x26')][_0xc4ef('0x89')]({'where':{'id':_0x5f402e[_0xc4ef('0x61')]['id']}})[_0xc4ef('0x19')](handleEntityNotFound(_0x3b6aa7,null))[_0xc4ef('0x19')](function(_0x559993){if(_0x559993){return _0x559993[_0xc4ef('0x88')](_0x5f402e['body'][_0xc4ef('0x8a')]||[]);}return null;})['then'](respondWithResult(_0x3b6aa7,null))[_0xc4ef('0x28')](handleError(_0x3b6aa7,null));};exports[_0xc4ef('0x8b')]=function(_0x181eec,_0x3bb435){var _0x43df45=[];_0x43df45[_0xc4ef('0x5c')](addAdditionalPhones(_0x181eec[_0xc4ef('0x36')]));Promise[_0xc4ef('0x60')](_0x43df45)[_0xc4ef('0x19')](function(){_0x43df45=[];_0x43df45[_0xc4ef('0x5c')](deleteCmHopperPhones(_0x181eec[_0xc4ef('0x36')]['id']));_0x43df45['push'](addCmHopperPhones(_0x181eec[_0xc4ef('0x36')]['id']));Promise[_0xc4ef('0x60')](_0x43df45)['then'](function(){return[0x1];})[_0xc4ef('0x19')](respondWithResult(_0x3bb435,null));});};function addAdditionalPhones(_0x38517c){var _0x539a0b;return new Promise(function(_0x1479e3){return db[_0xc4ef('0x66')]['destroy']({'where':{'CmContactId':_0x38517c['id']}})[_0xc4ef('0x19')](function(){db['ContactItemType'][_0xc4ef('0x23')]({'raw':!![],'attributes':['id','OrderBy']})[_0xc4ef('0x19')](function(_0x927b24){var _0x58c277=[];for(var _0x563ff7=0x0;_0x563ff7<_0x38517c[_0xc4ef('0x8c')]['length'];_0x563ff7++){var _0x1bc271=_0x38517c[_0xc4ef('0x8d')]?_[_0xc4ef('0x54')](_0x38517c['item_types'][_0x563ff7])?'':_0x38517c['item_types'][_0x563ff7]:_0x38517c['items'][_0x563ff7]['ItemTypeId']?_0x38517c[_0xc4ef('0x8c')][_0x563ff7]['ItemTypeId']:'';var _0x58cacd=_[_0xc4ef('0x54')](_0x38517c['items'][_0x563ff7]['description'])?'':_0x38517c[_0xc4ef('0x8c')][_0x563ff7][_0xc4ef('0x8e')];var _0x1fc152=_0x1bc271+':'+_0x38517c[_0xc4ef('0x8c')][_0x563ff7]['phone']+'§'+_0x58cacd;if(_[_0xc4ef('0x54')](_0x539a0b))_0x539a0b=_0x1fc152;else _0x539a0b+=';'+_0x1fc152;var _0x1e2836=null;var _0x330c98=null;if(_0x38517c[_0xc4ef('0x8d')]){if(!_['isNil'](_0x38517c['item_types'][_0x563ff7])){_0x330c98=_[_0xc4ef('0x27')](_0x927b24,function(_0x3cef92){return _0x3cef92['id']===_0x38517c['item_types'][_0x563ff7];});if(!_[_0xc4ef('0x54')](_0x330c98)){_0x1e2836=_0x330c98[_0xc4ef('0x8f')];}}}else{if(!_[_0xc4ef('0x54')](_0x38517c['items'][_0x563ff7])){_0x330c98=_['find'](_0x927b24,function(_0x494039){return _0x494039['id']===_0x38517c[_0xc4ef('0x8c')][_0x563ff7][_0xc4ef('0x90')];});if(!_[_0xc4ef('0x54')](_0x330c98)){_0x1e2836=_0x563ff7;}}}if(_[_0xc4ef('0x54')](_0x1e2836)){_0x1e2836=0x64;}_0x58c277[_0xc4ef('0x5c')](addAdditionalPhone(_0x38517c['id'],_0x38517c[_0xc4ef('0x8c')][_0x563ff7][_0xc4ef('0x7a')],_0x38517c[_0xc4ef('0x8d')]?_[_0xc4ef('0x54')](_0x38517c[_0xc4ef('0x8d')][_0x563ff7])?null:_0x38517c['item_types'][_0x563ff7]:_0x38517c[_0xc4ef('0x8c')][_0x563ff7][_0xc4ef('0x90')]?_0x38517c[_0xc4ef('0x8c')][_0x563ff7][_0xc4ef('0x90')]:null,_0x1e2836,_0x58cacd));}Promise[_0xc4ef('0x60')](_0x58c277)[_0xc4ef('0x19')](function(){db[_0xc4ef('0x26')]['update']({'AdditionalPhones':_0x539a0b},{'where':{'id':_0x38517c['id']}})[_0xc4ef('0x19')](function(){_0x1479e3(0x1);});});});});});}function addAdditionalPhone(_0x5d0bda,_0x5487e2,_0x2479b8,_0x28a1d3,_0x116d26){return db[_0xc4ef('0x66')][_0xc4ef('0x27')]({'where':{'CmContactId':_0x5d0bda,'item':_0x5487e2}})[_0xc4ef('0x19')](function(_0x2de212){if(_0x2de212)logger[_0xc4ef('0x32')](_0xc4ef('0x91'),_0x2de212);else{db[_0xc4ef('0x66')]['create']({'CmContactId':_0x5d0bda,'item':_0x5487e2,'ItemTypeId':_0x2479b8,'OrderBy':_0x28a1d3,'ItemClass':_0xc4ef('0x92'),'description':_0x116d26});}});}function deleteCmHopperPhones(_0x294a40){return new Promise(function(_0x2e643c){return db[_0xc4ef('0x3d')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x294a40}})[_0xc4ef('0x19')](function(_0x3d3dc0){db['CmHopperAdditionalPhone'][_0xc4ef('0x1a')]({'where':{'CmHopperId':{'$in':_['map'](_0x3d3dc0,'id')}}});})[_0xc4ef('0x19')](function(){_0x2e643c(0x1);});});}function addCmHopperPhones(_0x4bd505){return new Promise(function(_0x2abafb){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4bd505}})[_0xc4ef('0x19')](function(_0x5d2c1f){var _0x45a6be=[];_['map'](_0x5d2c1f,function(_0x22d67a){_0x45a6be[_0xc4ef('0x5c')](createCmHopperPhone(_0x4bd505,_0x22d67a['id']));});Promise[_0xc4ef('0x60')](_0x45a6be)[_0xc4ef('0x19')](function(){_0x2abafb(0x1);});});});}function createCmHopperPhone(_0x69c34c,_0x4c5955){return new Promise(function(_0x2ccbf5){db[_0xc4ef('0x66')]['findAll']({'raw':!![],'attributes':[_0xc4ef('0x93'),_0xc4ef('0x8f')],'where':{'CmContactId':_0x69c34c,'ItemClass':_0xc4ef('0x92')},'include':[{'model':db[_0xc4ef('0x94')],'attributes':[_0xc4ef('0x8f')],'as':_0xc4ef('0x68')}],'order':['OrderBy',db['sequelize']['literal']('`ItemType`.OrderBy')]})['then'](function(_0x10e780){var _0x564cf8=0x1;var _0xd4317e=_[_0xc4ef('0x6d')](_0x10e780,function(_0x2fb4cb){_0x2fb4cb[_0xc4ef('0x95')]=_0x4c5955;_0x2fb4cb['phone']=_0x2fb4cb[_0xc4ef('0x93')];_0x2fb4cb[_0xc4ef('0x8f')]=_0x564cf8;delete _0x2fb4cb[_0xc4ef('0x96')];_0x564cf8=_0x564cf8+0x1;return _0x2fb4cb;});return db[_0xc4ef('0x97')][_0xc4ef('0x58')](_0xd4317e,{});})['then'](function(){_0x2ccbf5(0x1);});});}function insertAdditionalPhones(_0x23b1de,_0x464c61){return new Promise(function(_0x137356){var _0x2c008e=[];for(var _0x22fa9d=0x0;_0x22fa9d<_0x464c61[_0xc4ef('0x38')];_0x22fa9d++){var _0x4fbc3f=_0x464c61[_0x22fa9d];_0x2c008e[_0xc4ef('0x5c')](parseContactItemType(_0x4fbc3f));}Promise[_0xc4ef('0x60')](_0x2c008e)[_0xc4ef('0x19')](function(){var _0x5c32ed={'id':_0x23b1de['id'],'items':_0x464c61};return addAdditionalPhones(_0x5c32ed)['then'](function(){return addCmHopperPhones(_0x23b1de['id']);});})[_0xc4ef('0x19')](function(){_0x137356(_0x23b1de);});});}function parseContactItemType(_0x112558){return new Promise(function(_0x1ef539){if(_0x112558['hasOwnProperty'](_0xc4ef('0x90'))){_0x1ef539(_0x112558);}else{return db[_0xc4ef('0x94')][_0xc4ef('0x27')]({'where':{'name':_0x112558[_0xc4ef('0x68')]}})[_0xc4ef('0x19')](function(_0x68c3ae){if(_[_0xc4ef('0x54')](_0x68c3ae))_0x112558['ItemTypeId']=null;else _0x112558[_0xc4ef('0x90')]=_0x68c3ae['id'];_0x1ef539(_0x112558);});}});}exports['getAdditionalPhones']=function(_0x5f3974,_0x55d005){return db[_0xc4ef('0x66')][_0xc4ef('0x23')]({'raw':!![],'where':{'CmContactId':_0x5f3974[_0xc4ef('0x61')]['id'],'ItemClass':_0xc4ef('0x92')},'include':[{'model':db[_0xc4ef('0x94')],'as':_0xc4ef('0x68')}],'order':[[_0xc4ef('0x8f')],[db[_0xc4ef('0x69')][_0xc4ef('0x6a')](_0xc4ef('0x98'))]]})[_0xc4ef('0x19')](function(_0x39eb72){return _0x39eb72;})['then'](respondWithResult(_0x55d005,null))[_0xc4ef('0x28')](handleError(_0x55d005,null));};exports[_0xc4ef('0x99')]=function(_0x736ecc,_0xf43ebc){return db['CmContactHasItem'][_0xc4ef('0x23')]({'raw':!![],'where':{'CmContactId':_0x736ecc[_0xc4ef('0x36')][_0xc4ef('0x9a')]}})[_0xc4ef('0x19')](function(_0x2ef7c1){var _0x357383=_['map'](_0x2ef7c1,function(_0xcfa265){_0xcfa265[_0xc4ef('0x9b')]=_0x736ecc[_0xc4ef('0x36')][_0xc4ef('0x9c')];return _0xcfa265;});return db['CmContactHasItem'][_0xc4ef('0x58')](_0x357383,{});})[_0xc4ef('0x19')](function(){return addCmHopperPhones(_0x736ecc[_0xc4ef('0x36')][_0xc4ef('0x9c')]);})[_0xc4ef('0x19')](function(){return['ok'];})[_0xc4ef('0x19')](respondWithResult(_0xf43ebc,null))[_0xc4ef('0x28')](handleError(_0xf43ebc,null));};exports['rescheduleAdditionalPhones']=function(_0x2c426a,_0x1b070f){var _0x1b411e=[];_0x1b411e[_0xc4ef('0x5c')](createCmHopperPhone(_0x2c426a[_0xc4ef('0x36')]['id'],_0x2c426a[_0xc4ef('0x36')][_0xc4ef('0x9d')]));Promise[_0xc4ef('0x60')](_0x1b411e)[_0xc4ef('0x19')](function(){return[0x1];})[_0xc4ef('0x19')](respondWithResult(_0x1b070f,null));};exports[_0xc4ef('0x9e')]=function(_0x41f204,_0x4c94cd){var _0x264671={'raw':![],'where':{}};var _0x3dcef5={};var _0x55ef09={'count':0x0,'rows':[]};return db[_0xc4ef('0x26')][_0xc4ef('0x89')]({'where':{'id':_0x41f204[_0xc4ef('0x61')]['id']}})[_0xc4ef('0x19')](handleEntityNotFound(_0x4c94cd,null))[_0xc4ef('0x19')](function(_0x16860d){if(_0x16860d){_0x3dcef5[_0xc4ef('0x7f')]=_[_0xc4ef('0x2a')](db[_0xc4ef('0x3d')][_0xc4ef('0x7c')]);_0x3dcef5[_0xc4ef('0x24')]=_['keys'](_0x41f204['query']);_0x3dcef5[_0xc4ef('0x7d')]=_[_0xc4ef('0x7e')](_0x3dcef5['model'],_0x3dcef5[_0xc4ef('0x24')]);_0x264671[_0xc4ef('0x80')]=_['intersection'](_0x3dcef5['model'],qs[_0xc4ef('0x81')](_0x41f204[_0xc4ef('0x24')][_0xc4ef('0x81')]));_0x264671[_0xc4ef('0x80')]=_0x264671[_0xc4ef('0x80')]['length']?_0x264671['attributes']:_0x3dcef5['model'];if(!_0x41f204['query'][_0xc4ef('0x34')]('nolimit')){_0x264671['limit']=qs['limit'](_0x41f204[_0xc4ef('0x24')][_0xc4ef('0x15')]);_0x264671['offset']=qs['offset'](_0x41f204['query']['offset']);}_0x264671[_0xc4ef('0x82')]=qs[_0xc4ef('0x83')](_0x41f204[_0xc4ef('0x24')][_0xc4ef('0x83')]);_0x264671[_0xc4ef('0x5b')]=qs[_0xc4ef('0x7d')](_[_0xc4ef('0x84')](_0x41f204['query'],_0x3dcef5[_0xc4ef('0x7d')]));_0x264671[_0xc4ef('0x5b')][_0xc4ef('0x9f')]=_0x16860d['id'];if(_0x41f204[_0xc4ef('0x24')][_0xc4ef('0x85')]){_0x264671['where']=_[_0xc4ef('0x35')](_0x264671[_0xc4ef('0x5b')],{'$or':_['map'](_0x264671[_0xc4ef('0x80')],function(_0x57f4ce){var _0x30523e={};_0x30523e[_0x57f4ce]={'$like':'%'+_0x41f204[_0xc4ef('0x24')][_0xc4ef('0x85')]+'%'};return _0x30523e;})});}_0x264671=_[_0xc4ef('0x35')]({},_0x264671,_0x41f204[_0xc4ef('0x86')]);return db[_0xc4ef('0x3d')][_0xc4ef('0x14')]({'where':_0x264671[_0xc4ef('0x5b')]})[_0xc4ef('0x19')](function(_0x52fdc0){_0x55ef09[_0xc4ef('0x14')]=_0x52fdc0;if(_0x41f204[_0xc4ef('0x24')]['includeAll']){_0x264671[_0xc4ef('0xa0')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x264671);})[_0xc4ef('0x19')](function(_0x2e6e56){_0x55ef09['rows']=_0x2e6e56;return _0x55ef09;});}})[_0xc4ef('0x19')](respondWithFilteredResult(_0x4c94cd,_0x264671))[_0xc4ef('0x28')](handleError(_0x4c94cd,null));};exports[_0xc4ef('0xa1')]=function(_0x53129e,_0x14db43){var _0x291a7f={'raw':!![],'where':{}};var _0x388b4f={};var _0x29c259={'count':0x0,'rows':[]};return db['CmContact'][_0xc4ef('0x89')]({'where':{'id':_0x53129e[_0xc4ef('0x61')]['id']}})[_0xc4ef('0x19')](handleEntityNotFound(_0x14db43,null))[_0xc4ef('0x19')](function(_0x4ca66c){if(_0x4ca66c){_0x388b4f[_0xc4ef('0x7f')]=_['keys'](db[_0xc4ef('0xa2')][_0xc4ef('0x7c')]);_0x388b4f[_0xc4ef('0x24')]=_['keys'](_0x53129e['query']);_0x388b4f[_0xc4ef('0x7d')]=_[_0xc4ef('0x7e')](_0x388b4f[_0xc4ef('0x7f')],_0x388b4f[_0xc4ef('0x24')]);_0x291a7f[_0xc4ef('0x80')]=_['intersection'](_0x388b4f['model'],qs['fields'](_0x53129e[_0xc4ef('0x24')][_0xc4ef('0x81')]));_0x291a7f[_0xc4ef('0x80')]=_0x291a7f[_0xc4ef('0x80')]['length']?_0x291a7f[_0xc4ef('0x80')]:_0x388b4f[_0xc4ef('0x7f')];if(!_0x53129e['query'][_0xc4ef('0x34')]('nolimit')){_0x291a7f[_0xc4ef('0x15')]=qs[_0xc4ef('0x15')](_0x53129e[_0xc4ef('0x24')][_0xc4ef('0x15')]);_0x291a7f[_0xc4ef('0x12')]=qs[_0xc4ef('0x12')](_0x53129e['query'][_0xc4ef('0x12')]);}_0x291a7f['order']=qs[_0xc4ef('0x83')](_0x53129e['query']['sort']);_0x291a7f[_0xc4ef('0x5b')]=qs['filters'](_[_0xc4ef('0x84')](_0x53129e[_0xc4ef('0x24')],_0x388b4f['filters']));_0x291a7f[_0xc4ef('0x5b')][_0xc4ef('0x9f')]=_0x4ca66c['id'];if(_0x53129e[_0xc4ef('0x24')][_0xc4ef('0x85')]){_0x291a7f[_0xc4ef('0x5b')]=_[_0xc4ef('0x35')](_0x291a7f['where'],{'$or':_[_0xc4ef('0x6d')](_0x291a7f[_0xc4ef('0x80')],function(_0x166970){var _0x429deb={};_0x429deb[_0x166970]={'$like':'%'+_0x53129e[_0xc4ef('0x24')][_0xc4ef('0x85')]+'%'};return _0x429deb;})});}_0x291a7f=_[_0xc4ef('0x35')]({},_0x291a7f,_0x53129e[_0xc4ef('0x86')]);return db[_0xc4ef('0xa2')][_0xc4ef('0x14')]({'where':_0x291a7f['where']})[_0xc4ef('0x19')](function(_0x44eeff){_0x29c259[_0xc4ef('0x14')]=_0x44eeff;if(_0x53129e[_0xc4ef('0x24')][_0xc4ef('0xa3')]){_0x291a7f['include']=[{'all':!![]}];}return db[_0xc4ef('0xa2')][_0xc4ef('0x23')](_0x291a7f);})[_0xc4ef('0x19')](function(_0x118972){_0x29c259['rows']=_0x118972;return _0x29c259;});}})[_0xc4ef('0x19')](respondWithFilteredResult(_0x14db43,_0x291a7f))[_0xc4ef('0x28')](handleError(_0x14db43,null));};exports['getHopperFinals']=function(_0x19d16a,_0x4961ea){var _0x2eda0c={'raw':!![],'where':{}};var _0x2c5ed1={};var _0x158c94={'count':0x0,'rows':[]};return db[_0xc4ef('0x26')]['findOne']({'where':{'id':_0x19d16a[_0xc4ef('0x61')]['id']}})[_0xc4ef('0x19')](handleEntityNotFound(_0x4961ea,null))['then'](function(_0x5c9998){if(_0x5c9998){_0x2c5ed1[_0xc4ef('0x7f')]=_['keys'](db[_0xc4ef('0x4b')][_0xc4ef('0x7c')]);_0x2c5ed1[_0xc4ef('0x24')]=_[_0xc4ef('0x2a')](_0x19d16a[_0xc4ef('0x24')]);_0x2c5ed1['filters']=_[_0xc4ef('0x7e')](_0x2c5ed1[_0xc4ef('0x7f')],_0x2c5ed1['query']);_0x2eda0c[_0xc4ef('0x80')]=_['intersection'](_0x2c5ed1[_0xc4ef('0x7f')],qs[_0xc4ef('0x81')](_0x19d16a['query'][_0xc4ef('0x81')]));_0x2eda0c[_0xc4ef('0x80')]=_0x2eda0c[_0xc4ef('0x80')][_0xc4ef('0x38')]?_0x2eda0c[_0xc4ef('0x80')]:_0x2c5ed1[_0xc4ef('0x7f')];if(!_0x19d16a[_0xc4ef('0x24')]['hasOwnProperty'](_0xc4ef('0x87'))){_0x2eda0c[_0xc4ef('0x15')]=qs[_0xc4ef('0x15')](_0x19d16a[_0xc4ef('0x24')][_0xc4ef('0x15')]);_0x2eda0c[_0xc4ef('0x12')]=qs[_0xc4ef('0x12')](_0x19d16a[_0xc4ef('0x24')][_0xc4ef('0x12')]);}_0x2eda0c[_0xc4ef('0x82')]=qs[_0xc4ef('0x83')](_0x19d16a[_0xc4ef('0x24')][_0xc4ef('0x83')]);_0x2eda0c['where']=qs[_0xc4ef('0x7d')](_['pick'](_0x19d16a['query'],_0x2c5ed1[_0xc4ef('0x7d')]));_0x2eda0c[_0xc4ef('0x5b')][_0xc4ef('0x9f')]=_0x5c9998['id'];if(_0x19d16a['query'][_0xc4ef('0x85')]){_0x2eda0c[_0xc4ef('0x5b')]=_[_0xc4ef('0x35')](_0x2eda0c[_0xc4ef('0x5b')],{'$or':_[_0xc4ef('0x6d')](_0x2eda0c[_0xc4ef('0x80')],function(_0x35ff08){var _0x1afb9d={};_0x1afb9d[_0x35ff08]={'$like':'%'+_0x19d16a[_0xc4ef('0x24')][_0xc4ef('0x85')]+'%'};return _0x1afb9d;})});}_0x2eda0c=_[_0xc4ef('0x35')]({},_0x2eda0c,_0x19d16a['options']);return db[_0xc4ef('0x4b')][_0xc4ef('0x14')]({'where':_0x2eda0c[_0xc4ef('0x5b')]})['then'](function(_0x11abdd){_0x158c94['count']=_0x11abdd;if(_0x19d16a['query'][_0xc4ef('0xa3')]){_0x2eda0c[_0xc4ef('0xa0')]=[{'all':!![]}];}return db[_0xc4ef('0x4b')][_0xc4ef('0x23')](_0x2eda0c);})[_0xc4ef('0x19')](function(_0xe2895a){_0x158c94[_0xc4ef('0xa4')]=_0xe2895a;return _0x158c94;});}})['then'](respondWithFilteredResult(_0x4961ea,_0x2eda0c))[_0xc4ef('0x28')](handleError(_0x4961ea,null));};exports[_0xc4ef('0xa5')]=function(_0x3478b3,_0x5cd37d){var _0x509939={'raw':!![],'where':{}};var _0x13f1bc={};var _0x445534={'count':0x0,'rows':[]};return db[_0xc4ef('0x26')][_0xc4ef('0x89')]({'where':{'id':_0x3478b3['params']['id']}})['then'](handleEntityNotFound(_0x5cd37d,null))[_0xc4ef('0x19')](function(_0xb682b4){if(_0xb682b4){_0x13f1bc[_0xc4ef('0x7f')]=_['keys'](db[_0xc4ef('0x51')]['rawAttributes']);_0x13f1bc[_0xc4ef('0x24')]=_[_0xc4ef('0x2a')](_0x3478b3[_0xc4ef('0x24')]);_0x13f1bc[_0xc4ef('0x7d')]=_[_0xc4ef('0x7e')](_0x13f1bc['model'],_0x13f1bc[_0xc4ef('0x24')]);_0x509939['attributes']=_[_0xc4ef('0x7e')](_0x13f1bc[_0xc4ef('0x7f')],qs[_0xc4ef('0x81')](_0x3478b3[_0xc4ef('0x24')][_0xc4ef('0x81')]));_0x509939[_0xc4ef('0x80')]=_0x509939[_0xc4ef('0x80')][_0xc4ef('0x38')]?_0x509939[_0xc4ef('0x80')]:_0x13f1bc[_0xc4ef('0x7f')];if(!_0x3478b3['query'][_0xc4ef('0x34')](_0xc4ef('0x87'))){_0x509939[_0xc4ef('0x15')]=qs[_0xc4ef('0x15')](_0x3478b3[_0xc4ef('0x24')][_0xc4ef('0x15')]);_0x509939[_0xc4ef('0x12')]=qs['offset'](_0x3478b3['query']['offset']);}_0x509939['order']=qs[_0xc4ef('0x83')](_0x3478b3['query'][_0xc4ef('0x83')]);_0x509939[_0xc4ef('0x5b')]=qs[_0xc4ef('0x7d')](_[_0xc4ef('0x84')](_0x3478b3[_0xc4ef('0x24')],_0x13f1bc[_0xc4ef('0x7d')]));_0x509939['where'][_0xc4ef('0x9f')]=_0xb682b4['id'];if(_0x3478b3['query'][_0xc4ef('0x85')]){_0x509939[_0xc4ef('0x5b')]=_[_0xc4ef('0x35')](_0x509939[_0xc4ef('0x5b')],{'$or':_[_0xc4ef('0x6d')](_0x509939[_0xc4ef('0x80')],function(_0x45efea){var _0x420e04={};_0x420e04[_0x45efea]={'$like':'%'+_0x3478b3[_0xc4ef('0x24')][_0xc4ef('0x85')]+'%'};return _0x420e04;})});}_0x509939=_['merge']({},_0x509939,_0x3478b3[_0xc4ef('0x86')]);return db[_0xc4ef('0x51')][_0xc4ef('0x14')]({'where':_0x509939['where']})['then'](function(_0x13b925){_0x445534['count']=_0x13b925;if(_0x3478b3[_0xc4ef('0x24')]['includeAll']){_0x509939[_0xc4ef('0xa0')]=[{'all':!![]}];}return db[_0xc4ef('0x51')]['findAll'](_0x509939);})[_0xc4ef('0x19')](function(_0x5ebd30){_0x445534['rows']=_0x5ebd30;return _0x445534;});}})[_0xc4ef('0x19')](respondWithFilteredResult(_0x5cd37d,_0x509939))[_0xc4ef('0x28')](handleError(_0x5cd37d,null));};exports[_0xc4ef('0xa6')]=function(_0x3ea73e,_0x3a2faa){try{if(!_0x3ea73e['body'][_0xc4ef('0x5d')]){throw new Error(_0xc4ef('0xa7'));}if(!_0x3ea73e[_0xc4ef('0x36')][_0xc4ef('0xa8')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x3ea73e[_0xc4ef('0x36')]['binding_values']){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x3ea73e['body'][_0xc4ef('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x3fce9d=_0x3ea73e[_0xc4ef('0x36')][_0xc4ef('0xa8')]['split'](',');var _0x17a55f=_0x3ea73e[_0xc4ef('0x36')][_0xc4ef('0xaa')][_0xc4ef('0xab')](',');if(!_0x3fce9d['length']||!_0x17a55f[_0xc4ef('0x38')]||_0x3fce9d[_0xc4ef('0x38')]!==_0x17a55f[_0xc4ef('0x38')]){throw new Error(_0xc4ef('0xac'));}_0x3ea73e[_0xc4ef('0x36')][_0xc4ef('0x81')]=_['zipObject'](_0x3fce9d,_0x17a55f);if(!_0x3ea73e[_0xc4ef('0x36')][_0xc4ef('0x81')][_0xc4ef('0x7a')]){throw new Error(_0xc4ef('0xad'));}if(!_0x3ea73e[_0xc4ef('0x36')]['fields'][_0xc4ef('0xae')]){throw new Error(_0xc4ef('0xaf'));}var _0x49abe1=path[_0xc4ef('0x3b')](config[_0xc4ef('0xb0')],_0xc4ef('0xb1'),_0x3ea73e['file'][_0xc4ef('0xb2')]);fs[_0xc4ef('0xb3')](_0x49abe1,parseInt(_0xc4ef('0xb4'),0x8));var _0x25f585=require('child_process')[_0xc4ef('0xb5')](path[_0xc4ef('0x3b')](__dirname,'../../components/import/cm/csv'),[_0x49abe1,_0x3ea73e['body'][_0xc4ef('0xa8')],_0x3ea73e[_0xc4ef('0x36')][_0xc4ef('0xaa')],_0x3ea73e[_0xc4ef('0x36')][_0xc4ef('0x5d')],_0x3ea73e['body'][_0xc4ef('0xb6')],_0x3ea73e['body'][_0xc4ef('0x5a')],_0x3ea73e[_0xc4ef('0x36')][_0xc4ef('0xa9')]]);return _0x3a2faa['status'](0xc8)[_0xc4ef('0x11')]({'message':_0xc4ef('0xb7'),'pid':_0x25f585[_0xc4ef('0xb8')]});}catch(_0x2132b4){return _0x3a2faa[_0xc4ef('0x10')](0x1f4)['send'](_0x2132b4);}};exports[_0xc4ef('0xb9')]=function(_0x4954f5,_0x26a451){var _0x116444=fs['createReadStream'](_0x4954f5[_0xc4ef('0xba')]['path']);Papa[_0xc4ef('0xbb')](_0x116444,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0xaa982e){return _0x26a451[_0xc4ef('0x10')](0xc8)[_0xc4ef('0x11')]({'file':_0x4954f5['file'],'fields':_0xaa982e['meta'][_0xc4ef('0x81')]});}});};exports['import']=function(_0xcd2dff,_0x2f2a8a){return db[_0xc4ef('0xbc')][_0xc4ef('0x23')]({'raw':!![],'attributes':['id'],'where':{'role':_0xc4ef('0xbd')}})[_0xc4ef('0x19')](function(_0x5b5bc2){var _0x494e5c=![];if(!_0xcd2dff[_0xc4ef('0x36')][_0xc4ef('0x5d')]){throw new Error(_0xc4ef('0xa7'));}if(!_0xcd2dff[_0xc4ef('0x36')][_0xc4ef('0xbe')][_0xc4ef('0x7a')]){throw new Error(_0xc4ef('0xad'));}if(!_0xcd2dff[_0xc4ef('0x36')]['binding'][_0xc4ef('0xae')]){throw new Error(_0xc4ef('0xaf'));}if(!_0xcd2dff['body'][_0xc4ef('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x50f2ce=require(_0xc4ef('0xbf'))[_0xc4ef('0xb5')](path[_0xc4ef('0x3b')](__dirname,'../../components/import/cm/csv2'),[_0xcd2dff['params']['id'],JSON['stringify'](_0xcd2dff[_0xc4ef('0x36')]),JSON[_0xc4ef('0xc0')](_0x5b5bc2)]);_0x50f2ce['on'](_0xc4ef('0xc1'),function(){_0x494e5c=!![];return _0x2f2a8a[_0xc4ef('0x10')](0xc8)['json']({'message':_0xc4ef('0xc2'),'pid':_0x50f2ce[_0xc4ef('0xb8')]});});_0x50f2ce['on'](_0xc4ef('0xc3'),function(_0x458e29){if(_0x458e29&&!_0x494e5c){return _0x2f2a8a[_0xc4ef('0x10')](0x1f4)[_0xc4ef('0x11')]({'message':_0xc4ef('0xc4'),'pid':_0x50f2ce[_0xc4ef('0xb8')]});}});})[_0xc4ef('0x28')](handleError(_0x2f2a8a,null));};exports[_0xc4ef('0xc5')]=function(_0x486eb1,_0x270ffb){return db[_0xc4ef('0xbc')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0xc4ef('0x19')](function(_0x279785){var _0x4e89f6=![];if(!_0x486eb1[_0xc4ef('0x36')][_0xc4ef('0x5d')]){throw new Error(_0xc4ef('0xa7'));}if(!_0x486eb1[_0xc4ef('0x36')][_0xc4ef('0xbe')]['phone']){throw new Error(_0xc4ef('0xad'));}if(!_0x486eb1[_0xc4ef('0x36')][_0xc4ef('0xbe')][_0xc4ef('0xae')]){throw new Error(_0xc4ef('0xaf'));}if(!_0x486eb1['body']['socket_timestamp']){throw new Error(_0xc4ef('0xc6'));}var _0x12691f=require(_0xc4ef('0xbf'))[_0xc4ef('0xb5')](path[_0xc4ef('0x3b')](__dirname,'../../components/import/cm/csvUpdates'),[_0x486eb1[_0xc4ef('0x61')]['id'],JSON[_0xc4ef('0xc0')](_0x486eb1[_0xc4ef('0x36')]),JSON[_0xc4ef('0xc0')](_0x279785)]);_0x12691f['on'](_0xc4ef('0xc1'),function(){_0x4e89f6=!![];return _0x270ffb[_0xc4ef('0x10')](0xc8)[_0xc4ef('0x11')]({'message':_0xc4ef('0xc2'),'pid':_0x12691f[_0xc4ef('0xb8')]});});_0x12691f['on']('exit',function(_0x5f11df){if(_0x5f11df&&!_0x4e89f6){return _0x270ffb['status'](0x1f4)['json']({'message':_0xc4ef('0xc4'),'pid':_0x12691f[_0xc4ef('0xb8')]});}});})[_0xc4ef('0x28')](handleError(_0x270ffb,null));};exports['getJourney']=function(_0x1eea95,_0x5605d7){var _0x1df31a=['mail',_0xc4ef('0xc7'),_0xc4ef('0xc8'),'openchannel','fax',_0xc4ef('0xc9'),'voice'];var _0x339a97={'offset':0x0,'order':qs[_0xc4ef('0x83')](_0xc4ef('0xca'))},_0x377769={'count':0x0,'rows':[]};Promise[_0xc4ef('0xcb')]()[_0xc4ef('0x19')](function(){if(_0x1eea95[_0xc4ef('0x24')]['channel']){if(!_['includes'](_0x1df31a,_0x1eea95['query']['channel'][_0xc4ef('0xcc')]())){throw new Error(_0xc4ef('0xcd'));}_0x1df31a=[_0x1eea95[_0xc4ef('0x24')][_0xc4ef('0xce')][_0xc4ef('0xcc')]()];}if(_0x1eea95['query'][_0xc4ef('0xcf')]){try{var _0x51eb99=JSON[_0xc4ef('0xbb')](_0x1eea95[_0xc4ef('0x24')][_0xc4ef('0xcf')]);if(!moment(_0x51eb99[_0xc4ef('0x37')])[_0xc4ef('0xd0')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x51eb99['to'])[_0xc4ef('0xd0')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x5a635d){throw new Error(_0xc4ef('0xd1'));}}if(!_0x1eea95[_0xc4ef('0x24')][_0xc4ef('0x34')](_0xc4ef('0x87'))){_0x339a97[_0xc4ef('0x15')]=qs['limit'](_0x1eea95[_0xc4ef('0x24')][_0xc4ef('0x15')]||0xa);_0x339a97[_0xc4ef('0x12')]=qs['offset'](_0x1eea95['query'][_0xc4ef('0x12')]);}var _0x5c5054=_0x1df31a[_0xc4ef('0x6d')](function(_0x320b8f){if(_0x320b8f===_0xc4ef('0xd2')){var _0x426d8a={'attributes':['id',_0xc4ef('0xd3'),_0xc4ef('0xd4'),_0xc4ef('0xd5'),'destination',_0xc4ef('0xd6'),_0xc4ef('0xd7'),_0xc4ef('0xd8'),'duration',_0xc4ef('0xd9'),_0xc4ef('0xda'),_0xc4ef('0xdb'),'userSecondDisposition',_0xc4ef('0xdc'),_0xc4ef('0xdd')],'where':{'ContactId':_0x1eea95[_0xc4ef('0x61')]['id']},'include':[{'model':db['User'],'as':_0xc4ef('0xbc'),'attributes':['id',_0xc4ef('0x1f'),_0xc4ef('0xde'),'alias']}],'order':[['createdAt',_0xc4ef('0xdf')]]};if(_0x1eea95[_0xc4ef('0x24')][_0xc4ef('0xcf')]){_0x426d8a[_0xc4ef('0x5b')][_0xc4ef('0xda')]={'$gte':_0x51eb99['from'],'$lte':_0x51eb99['to']};}return db[_0xc4ef('0xe0')]['findAndCountAll'](_0x426d8a)['then'](function(_0x27c39c){_0x377769['count']+=_0x27c39c[_0xc4ef('0x14')];return _[_0xc4ef('0x6d')](_0x27c39c[_0xc4ef('0xa4')],function(_0x4ab74d){var _0x51dbb8=_0x4ab74d['get']({'plain':!![]});_0x51dbb8['channel']=_0x320b8f;if(_0x51dbb8[_0xc4ef('0xbc')]){_0x51dbb8[_0xc4ef('0xbc')]={'id':_0x51dbb8[_0xc4ef('0xbc')]['id'],'name':_0x51dbb8[_0xc4ef('0xbc')]['name'],'fullname':_0x51dbb8[_0xc4ef('0xbc')][_0xc4ef('0xde')],'alias':_0x51dbb8[_0xc4ef('0xbc')][_0xc4ef('0xe1')]};}return _0x51dbb8;});});}else{var _0xf2e640=_[_0xc4ef('0xe2')](_0x320b8f)+(_0x320b8f===_0xc4ef('0xc7')?'Website':_0xc4ef('0xe3'));var _0x2a3cfc={'attributes':['id',_0xc4ef('0xe4'),'closedAt',_0xc4ef('0xda'),_0xc4ef('0xd9'),_0xc4ef('0xe5'),_0xc4ef('0xe6'),_0xc4ef('0xe7'),_0xc4ef('0xdd'),_0xf2e640+'Id'],'where':{'ContactId':_0x1eea95[_0xc4ef('0x61')]['id']},'include':[{'model':db[_0xf2e640],'as':_0xc4ef('0xe3'),'attributes':['id',_0xc4ef('0x1f'),_0xc4ef('0xe8')]},{'model':db['User'],'as':_0xc4ef('0xe9'),'attributes':['id',_0xc4ef('0x1f'),'fullname']},{'model':db['Tag'],'as':_0xc4ef('0x63'),'attributes':['id','name','color'],'through':{'attributes':[]}}],'order':[[_0xc4ef('0xda'),_0xc4ef('0xdf')]]};if(_0x1eea95[_0xc4ef('0x24')][_0xc4ef('0xcf')]){_0x2a3cfc['where'][_0xc4ef('0xda')]={'$gte':_0x51eb99[_0xc4ef('0x37')],'$lte':_0x51eb99['to']};}switch(_0x320b8f){case _0xc4ef('0xc7'):_0x2a3cfc[_0xc4ef('0x80')][_0xc4ef('0x5c')](_0xc4ef('0xea'),_0xc4ef('0xeb'),_0xc4ef('0xec'),_0xc4ef('0xed'),_0xc4ef('0xee'),_0xc4ef('0xef'),_0xc4ef('0xf0'),_0xc4ef('0xf1'),_0xc4ef('0xf2'));break;case'mail':_0x2a3cfc[_0xc4ef('0x80')][_0xc4ef('0x5c')](_0xc4ef('0xf3'),_0xc4ef('0xf4'));break;case _0xc4ef('0xf5'):_0x2a3cfc['attributes'][_0xc4ef('0x5c')](_0xc4ef('0xf6'),'threadId');break;}return db[_[_0xc4ef('0xe2')](_0x320b8f)+_0xc4ef('0xf7')][_0xc4ef('0xf8')](_0x2a3cfc)[_0xc4ef('0x19')](function(_0x32aa02){_0x377769[_0xc4ef('0x14')]+=_0x32aa02['count'];return _[_0xc4ef('0x6d')](_0x32aa02[_0xc4ef('0xa4')],function(_0x1d8a6c){var _0x52c061=_0x1d8a6c['get']({'plain':!![]});_0x52c061[_0xc4ef('0xce')]=_0x320b8f;if(_0x52c061[_0xc4ef('0xe9')]){_0x52c061[_0xc4ef('0xe9')]={'id':_0x52c061['Owner']['id'],'name':_0x52c061[_0xc4ef('0xe9')][_0xc4ef('0x1f')],'fullname':_0x52c061['Owner'][_0xc4ef('0xde')]};}return _0x52c061;});});}});return Promise[_0xc4ef('0x60')](_0x5c5054);})['then'](function(_0x3623d3){return _(_0x3623d3)[_0xc4ef('0xf9')]()[_0xc4ef('0xfa')](_0xc4ef('0xda'))[_0xc4ef('0xfb')]()[_0xc4ef('0xfc')]();})[_0xc4ef('0x19')](function(_0x2087e3){_0x377769[_0xc4ef('0xa4')]=_0x339a97['limit']?_0x2087e3['slice'](_0x339a97[_0xc4ef('0x12')],_0x339a97[_0xc4ef('0x12')]+_0x339a97[_0xc4ef('0x15')]):_0x2087e3;return _0x377769;})[_0xc4ef('0x19')](respondWithFilteredResult(_0x5605d7,_0x339a97))[_0xc4ef('0x28')](handleError(_0x5605d7,null));}; \ No newline at end of file +var _0x8d77=['OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','isNil','dialTimezone','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','ListId','findOrCreate','spread','push','contact','show','Tag','Tags','color','tag','ContactItemType','ItemType','sequelize','Phones.OrderBy','get','CmCustomField','omit','format','timezones','$and','pickBy','startsWith','map','cf_%d','isEmpty','table','cm_contacts','id\x20=\x20?','CmHopper','phone','findOne','model','rawAttributes','intersection','attributes','order','sort','filters','filter','options','getTags','setTags','ids','setAdditionalPhones','all','OrderBy','items','item_types','ItemTypeId','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','literal','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','fields','nolimit','ContactId','includeAll','include','getHopperHistories','CmHopperHistory','rows','getHopperFinals','pick','uploadCsv','No\x20ListId\x20specified','binding_keys','socket_timestamp','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','0777','child_process','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','parse','meta','import','User','agent','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','fork','../../components/import/cm/csv2','stringify','error\x20child\x20process','importUpdates','message','start\x20child\x20process\x20correctly!','exit','getJourney','mail','chat','sms','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','source','destination','starttime','endtime','duration','note','createdAt','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','findAndCountAll','startCase','Account','closed','disposition','secondDisposition','thirdDisposition','Owner','customerIp','customerPort','deviceModel','osName','ratingType','referer','subject','substatus','openchannel','externalUrl','threadId','flatten','reverse','value','slice','moment','util','path','lodash','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./cmContact.socket','register','status','json','undefined','limit','count','offset','Content-Range','update','then','end','error','name','send','index','describe','getOptions','findAll','query','user','catch','CmContact','find','params','keys','length','cf_','columnName','displayName','analytics','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','mergeWith','isArray','tags','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','destroy','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8d77,0x1ae));var _0x78d7=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x8d77[_0x433a86];return _0x23000c;};'use strict';var moment=require(_0x78d7('0x0'));var BPromise=require('bluebird');var util=require(_0x78d7('0x1'));var path=require(_0x78d7('0x2'));var fs=require('fs');var _=require(_0x78d7('0x3'));var squel=require('squel');var Papa=require(_0x78d7('0x4'));var Redis=require(_0x78d7('0x5'));var contacts=require('../../components/contacts');var qs=require(_0x78d7('0x6'));var logger=require(_0x78d7('0x7'))(_0x78d7('0x8'));var config=require(_0x78d7('0x9'));var shared=require('../../config/environment/shared');var db=require('../../mysqldb')['db'];config[_0x78d7('0xa')]=_[_0x78d7('0xb')](config[_0x78d7('0xa')],{'host':_0x78d7('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x78d7('0xa')]));require(_0x78d7('0xd'))[_0x78d7('0xe')](socket);function respondWithResult(_0x5c99f9,_0x3bd607){_0x3bd607=_0x3bd607||0xc8;return function(_0x20e34f){if(_0x20e34f){return _0x5c99f9[_0x78d7('0xf')](_0x3bd607)[_0x78d7('0x10')](_0x20e34f);}};}function respondWithFilteredResult(_0x493d57,_0xa26860){return function(_0x76b6b){if(_0x76b6b){var _0x5e0fed=typeof _0xa26860['offset']===_0x78d7('0x11')&&typeof _0xa26860[_0x78d7('0x12')]===_0x78d7('0x11');var _0x31d29c=_0x76b6b[_0x78d7('0x13')];var _0x5866b7=_0x5e0fed?0x0:_0xa26860[_0x78d7('0x14')];var _0x380f3a=_0x5e0fed?_0x76b6b['count']:_0xa26860['offset']+_0xa26860[_0x78d7('0x12')];var _0x3838db;if(_0x380f3a>=_0x31d29c){_0x380f3a=_0x31d29c;_0x3838db=0xc8;}else{_0x3838db=0xce;}_0x493d57[_0x78d7('0xf')](_0x3838db);return _0x493d57['set'](_0x78d7('0x15'),_0x5866b7+'-'+_0x380f3a+'/'+_0x31d29c)['json'](_0x76b6b);}return null;};}function saveUpdates(_0x1eba9f){return function(_0x5e0ec4){if(_0x5e0ec4){return _0x5e0ec4[_0x78d7('0x16')](_0x1eba9f)[_0x78d7('0x17')](function(_0x4d3029){return _0x4d3029;});}return null;};}function removeEntity(_0x30ab62){return function(_0xbe014e){if(_0xbe014e){return _0xbe014e['destroy']()[_0x78d7('0x17')](function(){_0x30ab62[_0x78d7('0xf')](0xcc)[_0x78d7('0x18')]();});}};}function handleEntityNotFound(_0x59caf6){return function(_0x182c20){if(!_0x182c20){_0x59caf6['sendStatus'](0x194);}return _0x182c20;};}function handleError(_0xc79c99,_0x2540f8){_0x2540f8=_0x2540f8||0x1f4;return function(_0xe88049){logger[_0x78d7('0x19')](_0xe88049['stack']);if(_0xe88049[_0x78d7('0x1a')]){delete _0xe88049[_0x78d7('0x1a')];}_0xc79c99[_0x78d7('0xf')](_0x2540f8)[_0x78d7('0x1b')](_0xe88049);};}exports[_0x78d7('0x1c')]=function(_0x83a444,_0x1ee336){var _0x57f43c={};return contacts[_0x78d7('0x1d')]()[_0x78d7('0x17')](function(_0x24055d){_0x57f43c=qs[_0x78d7('0x1e')](_0x24055d,_0x83a444);return contacts[_0x78d7('0x1f')](_0x83a444[_0x78d7('0x20')],_0x83a444[_0x78d7('0x21')],_0x57f43c,_0x24055d);})['then'](respondWithFilteredResult(_0x1ee336,_0x57f43c))[_0x78d7('0x22')](handleError(_0x1ee336,null));};exports['destroy']=function(_0x14a9ac,_0x2e2b63){return db[_0x78d7('0x23')][_0x78d7('0x24')]({'where':{'id':_0x14a9ac[_0x78d7('0x25')]['id']}})[_0x78d7('0x17')](handleEntityNotFound(_0x2e2b63,null))[_0x78d7('0x17')](removeEntity(_0x2e2b63,null))[_0x78d7('0x22')](handleError(_0x2e2b63,null));};exports[_0x78d7('0x1d')]=function(_0x55ca31,_0x1279bf){return db[_0x78d7('0x23')]['describe']()['then'](function(_0x3e0946){delete _0x3e0946['tags'];for(var _0x479d4b=0x0;_0x479d4b0x0){return new Promise(function(_0x276408){var _0x2708ad=[];for(var _0x4fbd7c=0x0;_0x4fbd7c<_0xc402ec['length'];_0x4fbd7c++){_0x2708ad[_0x78d7('0x5e')](insertAdditionalPhones(_0xc402ec[_0x4fbd7c][_0x78d7('0x5f')],_0xc402ec[_0x4fbd7c][_0x78d7('0x55')]));}Promise['all'](_0x2708ad)[_0x78d7('0x17')](function(){_0x276408(0x1);});})[_0x78d7('0x17')](function(){return{'success':_0x4bc266,'failure':_0x23b331,'duplicates':_0x121968};});}else{return{'success':_0x4bc266,'failure':_0x23b331,'duplicates':_0x121968};}}})[_0x78d7('0x17')](respondWithResult(_0x3a3d36,0xc9))['catch'](handleError(_0x3a3d36,null));};exports[_0x78d7('0x60')]=function(_0x7cff06,_0x1fcdc3){var _0x4010b4;return db[_0x78d7('0x23')]['describe']()[_0x78d7('0x17')](function(_0x4776c8){return db[_0x78d7('0x23')][_0x78d7('0x24')]({'where':{'id':_0x7cff06[_0x78d7('0x25')]['id']},'include':[{'model':db[_0x78d7('0x61')],'as':_0x78d7('0x62'),'attributes':['id',_0x78d7('0x1a'),_0x78d7('0x63')],'required':_0x7cff06[_0x78d7('0x20')][_0x78d7('0x64')]?!![]:![]},{'model':db[_0x78d7('0x49')],'as':'Phones','where':{'CmContactId':_0x7cff06[_0x78d7('0x25')]['id']},'required':![],'include':[{'model':db[_0x78d7('0x65')],'as':_0x78d7('0x66')}]}],'order':[db[_0x78d7('0x67')]['literal'](_0x78d7('0x68'))],'attributes':_[_0x78d7('0x26')](_0x4776c8)});})[_0x78d7('0x17')](function(_0x5381bc){if(!_[_0x78d7('0x52')](_0x5381bc)){_0x4010b4=_0x5381bc[_0x78d7('0x69')]({'plain':!![]});var _0x2f641f={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5381bc&&_0x5381bc['ListId']){if(_0x5381bc[_0x78d7('0x5b')]){_0x2f641f[_0x78d7('0x59')]['$and'][_0x78d7('0x5e')]({'ListId':{'$ne':_0x5381bc[_0x78d7('0x5b')]}});}}return db[_0x78d7('0x6a')][_0x78d7('0x1f')](_0x2f641f);}})[_0x78d7('0x17')](function(_0x4662fd){if(!_[_0x78d7('0x52')](_0x4662fd)){return _[_0x78d7('0x6b')](_0x4010b4,_['map'](_0x4662fd,function(_0x11e792){return util[_0x78d7('0x6c')]('cf_%d',_0x11e792['id']);}));}})[_0x78d7('0x17')](handleEntityNotFound(_0x1fcdc3,null))[_0x78d7('0x17')](respondWithResult(_0x1fcdc3,null))['catch'](handleError(_0x1fcdc3,null));};exports['update']=function(_0x8770d5,_0x3cbbd2){var _0x27eb28;if(_0x8770d5[_0x78d7('0x35')]['id']){delete _0x8770d5[_0x78d7('0x35')]['id'];}if(!_[_0x78d7('0x52')](_0x8770d5[_0x78d7('0x35')][_0x78d7('0x53')])){var _0x3beba4=_0x8770d5[_0x78d7('0x35')][_0x78d7('0x53')];if(!_[_0x78d7('0x52')](shared[_0x78d7('0x6d')][_0x3beba4]))_0x8770d5['body']['utcOffset']=shared[_0x78d7('0x6d')][_0x3beba4][_0x78d7('0x54')];}return db['CmContact']['find']({'where':{'id':_0x8770d5[_0x78d7('0x25')]['id']}})[_0x78d7('0x17')](handleEntityNotFound(_0x3cbbd2,null))[_0x78d7('0x17')](saveUpdates(_0x8770d5[_0x78d7('0x35')],null))['then'](function(_0x4928c0){_0x27eb28=_0x4928c0;var _0x1d2a6b={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4928c0&&_0x4928c0[_0x78d7('0x5b')]){if(_0x4928c0[_0x78d7('0x5b')]){_0x1d2a6b[_0x78d7('0x59')][_0x78d7('0x6e')][_0x78d7('0x5e')]({'ListId':{'$ne':_0x4928c0[_0x78d7('0x5b')]}});}}return db[_0x78d7('0x6a')][_0x78d7('0x1f')](_0x1d2a6b);})['then'](function(_0x1c6457){if(_0x1c6457){return _['omit'](_[_0x78d7('0x6f')](_0x8770d5[_0x78d7('0x35')],function(_0x29d370,_0xa79f17){return _[_0x78d7('0x70')](_0xa79f17,'cf_');}),_[_0x78d7('0x71')](_0x1c6457,function(_0x239cfe){return util[_0x78d7('0x6c')](_0x78d7('0x72'),_0x239cfe['id']);}));}})[_0x78d7('0x17')](function(_0x28c2b0){if(_0x28c2b0&&!_[_0x78d7('0x73')](_0x28c2b0)){var _0x32351c=squel['update']()[_0x78d7('0x74')](_0x78d7('0x75'))['setFields'](_0x28c2b0)[_0x78d7('0x59')](_0x78d7('0x76'),_0x8770d5['params']['id'])['toParam']();return db[_0x78d7('0x67')]['query'](_0x32351c['text'],{'replacements':_0x32351c[_0x78d7('0x2f')]});}})[_0x78d7('0x17')](function(){if(_0x8770d5['body']['phone']&&_0x27eb28){return db[_0x78d7('0x77')]['update']({'phone':_0x8770d5[_0x78d7('0x35')][_0x78d7('0x78')],'OrderBy':0x0},{'where':{'ContactId':_0x27eb28['id']}});}})[_0x78d7('0x17')](function(){return _0x27eb28;})[_0x78d7('0x17')](respondWithResult(_0x3cbbd2,null))[_0x78d7('0x22')](handleError(_0x3cbbd2,null));};exports['getTags']=function(_0x26499a,_0xbf1f5f){var _0x31d729={};var _0x3e5dd0={};var _0xc295dc;var _0x318594;return db[_0x78d7('0x23')][_0x78d7('0x79')]({'where':{'id':_0x26499a[_0x78d7('0x25')]['id']}})[_0x78d7('0x17')](handleEntityNotFound(_0xbf1f5f,null))[_0x78d7('0x17')](function(_0xef0445){if(_0xef0445){_0xc295dc=_0xef0445;_0x3e5dd0[_0x78d7('0x7a')]=_[_0x78d7('0x26')](db[_0x78d7('0x61')][_0x78d7('0x7b')]);_0x3e5dd0[_0x78d7('0x20')]=_[_0x78d7('0x26')](_0x26499a['query']);_0x3e5dd0['filters']=_[_0x78d7('0x7c')](_0x3e5dd0[_0x78d7('0x7a')],_0x3e5dd0[_0x78d7('0x20')]);_0x31d729[_0x78d7('0x7d')]=_[_0x78d7('0x7c')](_0x3e5dd0[_0x78d7('0x7a')],qs['fields'](_0x26499a[_0x78d7('0x20')]['fields']));_0x31d729['attributes']=_0x31d729['attributes']['length']?_0x31d729[_0x78d7('0x7d')]:_0x3e5dd0[_0x78d7('0x7a')];_0x31d729[_0x78d7('0x7e')]=qs[_0x78d7('0x7f')](_0x26499a['query'][_0x78d7('0x7f')]);_0x31d729[_0x78d7('0x59')]=qs['filters'](_['pick'](_0x26499a[_0x78d7('0x20')],_0x3e5dd0[_0x78d7('0x80')]));if(_0x26499a[_0x78d7('0x20')][_0x78d7('0x81')]){_0x31d729[_0x78d7('0x59')]=_['merge'](_0x31d729[_0x78d7('0x59')],{'$or':_[_0x78d7('0x71')](_0x31d729[_0x78d7('0x7d')],function(_0x1a252b){var _0xe38e5a={};_0xe38e5a[_0x1a252b]={'$like':'%'+_0x26499a['query'][_0x78d7('0x81')]+'%'};return _0xe38e5a;})});}_0x31d729=_[_0x78d7('0x34')]({},_0x31d729,_0x26499a[_0x78d7('0x82')]);return _0xc295dc[_0x78d7('0x83')](_0x31d729);}})[_0x78d7('0x17')](function(_0x527501){if(_0x527501){_0x318594=_0x527501[_0x78d7('0x27')];if(!_0x26499a['query']['hasOwnProperty']('nolimit')){_0x31d729[_0x78d7('0x12')]=qs['limit'](_0x26499a['query'][_0x78d7('0x12')]);_0x31d729[_0x78d7('0x14')]=qs[_0x78d7('0x14')](_0x26499a[_0x78d7('0x20')]['offset']);}return _0xc295dc[_0x78d7('0x83')](_0x31d729);}})[_0x78d7('0x17')](function(_0x1b8453){if(_0x1b8453){return _0x1b8453?{'count':_0x318594,'rows':_0x1b8453}:null;}})[_0x78d7('0x17')](respondWithResult(_0xbf1f5f,null))['catch'](handleError(_0xbf1f5f,null));};exports['setTags']=function(_0x21a3bc,_0x1a0f34){if(_0x21a3bc[_0x78d7('0x35')]['id']){delete _0x21a3bc[_0x78d7('0x35')]['id'];}return db[_0x78d7('0x23')][_0x78d7('0x79')]({'where':{'id':_0x21a3bc['params']['id']}})['then'](handleEntityNotFound(_0x1a0f34,null))[_0x78d7('0x17')](function(_0x36a475){if(_0x36a475){return _0x36a475[_0x78d7('0x84')](_0x21a3bc['body'][_0x78d7('0x85')]||[]);}return null;})['then'](respondWithResult(_0x1a0f34,null))[_0x78d7('0x22')](handleError(_0x1a0f34,null));};exports[_0x78d7('0x86')]=function(_0x53f7aa,_0x148cc3){var _0xb3ad5e=[];_0xb3ad5e[_0x78d7('0x5e')](addAdditionalPhones(_0x53f7aa['body']));Promise[_0x78d7('0x87')](_0xb3ad5e)[_0x78d7('0x17')](function(){_0xb3ad5e=[];_0xb3ad5e[_0x78d7('0x5e')](deleteCmHopperPhones(_0x53f7aa[_0x78d7('0x35')]['id']));_0xb3ad5e['push'](addCmHopperPhones(_0x53f7aa[_0x78d7('0x35')]['id']));Promise[_0x78d7('0x87')](_0xb3ad5e)[_0x78d7('0x17')](function(){return[0x1];})[_0x78d7('0x17')](respondWithResult(_0x148cc3,null));});};function addAdditionalPhones(_0x4ba06e){var _0xaff239;return new Promise(function(_0x2bd1af){return db[_0x78d7('0x49')][_0x78d7('0x3c')]({'where':{'CmContactId':_0x4ba06e['id']}})[_0x78d7('0x17')](function(){db[_0x78d7('0x65')][_0x78d7('0x1f')]({'raw':!![],'attributes':['id',_0x78d7('0x88')]})[_0x78d7('0x17')](function(_0x44cff7){var _0x355305=[];for(var _0x345971=0x0;_0x345971<_0x4ba06e[_0x78d7('0x89')][_0x78d7('0x27')];_0x345971++){var _0x4f2337=_0x4ba06e[_0x78d7('0x8a')]?_['isNil'](_0x4ba06e[_0x78d7('0x8a')][_0x345971])?'':_0x4ba06e[_0x78d7('0x8a')][_0x345971]:_0x4ba06e[_0x78d7('0x89')][_0x345971]['ItemTypeId']?_0x4ba06e[_0x78d7('0x89')][_0x345971][_0x78d7('0x8b')]:'';var _0x17eef9=_['isNil'](_0x4ba06e[_0x78d7('0x89')][_0x345971]['description'])?'':_0x4ba06e[_0x78d7('0x89')][_0x345971]['description'];var _0x5bcee0=_0x4f2337+':'+_0x4ba06e[_0x78d7('0x89')][_0x345971][_0x78d7('0x78')]+'§'+_0x17eef9;if(_['isNil'](_0xaff239))_0xaff239=_0x5bcee0;else _0xaff239+=';'+_0x5bcee0;var _0x429bee=null;var _0xe9a5bd=null;if(_0x4ba06e[_0x78d7('0x8a')]){if(!_[_0x78d7('0x52')](_0x4ba06e[_0x78d7('0x8a')][_0x345971])){_0xe9a5bd=_[_0x78d7('0x24')](_0x44cff7,function(_0x818f36){return _0x818f36['id']===_0x4ba06e['item_types'][_0x345971];});if(!_[_0x78d7('0x52')](_0xe9a5bd)){_0x429bee=_0xe9a5bd[_0x78d7('0x88')];}}}else{if(!_[_0x78d7('0x52')](_0x4ba06e['items'][_0x345971])){_0xe9a5bd=_[_0x78d7('0x24')](_0x44cff7,function(_0x43391e){return _0x43391e['id']===_0x4ba06e['items'][_0x345971][_0x78d7('0x8b')];});if(!_[_0x78d7('0x52')](_0xe9a5bd)){_0x429bee=_0x345971;}}}if(_[_0x78d7('0x52')](_0x429bee)){_0x429bee=0x64;}_0x355305['push'](addAdditionalPhone(_0x4ba06e['id'],_0x4ba06e['items'][_0x345971][_0x78d7('0x78')],_0x4ba06e[_0x78d7('0x8a')]?_[_0x78d7('0x52')](_0x4ba06e['item_types'][_0x345971])?null:_0x4ba06e[_0x78d7('0x8a')][_0x345971]:_0x4ba06e[_0x78d7('0x89')][_0x345971][_0x78d7('0x8b')]?_0x4ba06e[_0x78d7('0x89')][_0x345971][_0x78d7('0x8b')]:null,_0x429bee,_0x17eef9));}Promise[_0x78d7('0x87')](_0x355305)[_0x78d7('0x17')](function(){db[_0x78d7('0x23')][_0x78d7('0x16')]({'AdditionalPhones':_0xaff239},{'where':{'id':_0x4ba06e['id']}})[_0x78d7('0x17')](function(){_0x2bd1af(0x1);});});});});});}function addAdditionalPhone(_0x20c936,_0x1dee8a,_0x50ee9b,_0xba68c2,_0x5b6e73){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0x20c936,'item':_0x1dee8a}})[_0x78d7('0x17')](function(_0x32a999){if(_0x32a999)logger[_0x78d7('0x30')](_0x78d7('0x8c'),_0x32a999);else{db[_0x78d7('0x49')]['create']({'CmContactId':_0x20c936,'item':_0x1dee8a,'ItemTypeId':_0x50ee9b,'OrderBy':_0xba68c2,'ItemClass':_0x78d7('0x8d'),'description':_0x5b6e73});}});}function deleteCmHopperPhones(_0x28279a){return new Promise(function(_0x1a7267){return db[_0x78d7('0x77')][_0x78d7('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x28279a}})['then'](function(_0x3c2798){db[_0x78d7('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x78d7('0x71')](_0x3c2798,'id')}}});})[_0x78d7('0x17')](function(){_0x1a7267(0x1);});});}function addCmHopperPhones(_0x1da471){return new Promise(function(_0x2c3256){return db['CmHopper'][_0x78d7('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1da471}})[_0x78d7('0x17')](function(_0x263e31){var _0x50bec8=[];_[_0x78d7('0x71')](_0x263e31,function(_0x25554a){_0x50bec8[_0x78d7('0x5e')](createCmHopperPhone(_0x1da471,_0x25554a['id']));});Promise[_0x78d7('0x87')](_0x50bec8)[_0x78d7('0x17')](function(){_0x2c3256(0x1);});});});}function createCmHopperPhone(_0x514671,_0x381e2b){return new Promise(function(_0x270bf3){db[_0x78d7('0x49')]['findAll']({'raw':!![],'attributes':[_0x78d7('0x8f'),_0x78d7('0x88')],'where':{'CmContactId':_0x514671,'ItemClass':'PHONE'},'include':[{'model':db[_0x78d7('0x65')],'attributes':[_0x78d7('0x88')],'as':_0x78d7('0x66')}],'order':[_0x78d7('0x88'),db[_0x78d7('0x67')][_0x78d7('0x90')](_0x78d7('0x91'))]})[_0x78d7('0x17')](function(_0x306566){var _0x47a92e=0x1;var _0x202954=_[_0x78d7('0x71')](_0x306566,function(_0x4856d4){_0x4856d4['CmHopperId']=_0x381e2b;_0x4856d4[_0x78d7('0x78')]=_0x4856d4[_0x78d7('0x8f')];_0x4856d4[_0x78d7('0x88')]=_0x47a92e;delete _0x4856d4['ItemType.OrderBy'];_0x47a92e=_0x47a92e+0x1;return _0x4856d4;});return db[_0x78d7('0x8e')]['bulkCreate'](_0x202954,{});})[_0x78d7('0x17')](function(){_0x270bf3(0x1);});});}function insertAdditionalPhones(_0x2ab99a,_0x1d4687){return new Promise(function(_0x5b8769){var _0x133adf=[];for(var _0x3f9637=0x0;_0x3f9637<_0x1d4687[_0x78d7('0x27')];_0x3f9637++){var _0x5cce25=_0x1d4687[_0x3f9637];_0x133adf[_0x78d7('0x5e')](parseContactItemType(_0x5cce25));}Promise[_0x78d7('0x87')](_0x133adf)['then'](function(){var _0x1fc2ad={'id':_0x2ab99a['id'],'items':_0x1d4687};return addAdditionalPhones(_0x1fc2ad)[_0x78d7('0x17')](function(){return addCmHopperPhones(_0x2ab99a['id']);});})[_0x78d7('0x17')](function(){_0x5b8769(_0x2ab99a);});});}function parseContactItemType(_0x1d9d76){return new Promise(function(_0x532d51){if(_0x1d9d76[_0x78d7('0x33')]('ItemTypeId')){_0x532d51(_0x1d9d76);}else{return db['ContactItemType'][_0x78d7('0x24')]({'where':{'name':_0x1d9d76[_0x78d7('0x66')]}})[_0x78d7('0x17')](function(_0x3e144f){if(_[_0x78d7('0x52')](_0x3e144f))_0x1d9d76[_0x78d7('0x8b')]=null;else _0x1d9d76[_0x78d7('0x8b')]=_0x3e144f['id'];_0x532d51(_0x1d9d76);});}});}exports['getAdditionalPhones']=function(_0x462a44,_0x2bb5f5){return db['CmContactHasItem'][_0x78d7('0x1f')]({'raw':!![],'where':{'CmContactId':_0x462a44[_0x78d7('0x25')]['id'],'ItemClass':_0x78d7('0x8d')},'include':[{'model':db[_0x78d7('0x65')],'as':_0x78d7('0x66')}],'order':[[_0x78d7('0x88')],[db[_0x78d7('0x67')][_0x78d7('0x90')](_0x78d7('0x91'))]]})[_0x78d7('0x17')](function(_0x58e847){return _0x58e847;})[_0x78d7('0x17')](respondWithResult(_0x2bb5f5,null))[_0x78d7('0x22')](handleError(_0x2bb5f5,null));};exports[_0x78d7('0x92')]=function(_0x4e99ee,_0x400b44){return db['CmContactHasItem'][_0x78d7('0x1f')]({'raw':!![],'where':{'CmContactId':_0x4e99ee[_0x78d7('0x35')][_0x78d7('0x93')]}})['then'](function(_0x54840c){var _0x182811=_[_0x78d7('0x71')](_0x54840c,function(_0x55afd6){_0x55afd6[_0x78d7('0x94')]=_0x4e99ee['body'][_0x78d7('0x95')];return _0x55afd6;});return db[_0x78d7('0x49')][_0x78d7('0x56')](_0x182811,{});})[_0x78d7('0x17')](function(){return addCmHopperPhones(_0x4e99ee[_0x78d7('0x35')]['toContactId']);})[_0x78d7('0x17')](function(){return['ok'];})[_0x78d7('0x17')](respondWithResult(_0x400b44,null))[_0x78d7('0x22')](handleError(_0x400b44,null));};exports[_0x78d7('0x96')]=function(_0x17cd3e,_0xe259cf){var _0x137ce8=[];_0x137ce8[_0x78d7('0x5e')](createCmHopperPhone(_0x17cd3e[_0x78d7('0x35')]['id'],_0x17cd3e[_0x78d7('0x35')]['hopperId']));Promise[_0x78d7('0x87')](_0x137ce8)[_0x78d7('0x17')](function(){return[0x1];})[_0x78d7('0x17')](respondWithResult(_0xe259cf,null));};exports[_0x78d7('0x97')]=function(_0x4687a3,_0x4c1069){var _0x1ebe25={'raw':![],'where':{}};var _0x1186b9={};var _0x37d7c5={'count':0x0,'rows':[]};return db[_0x78d7('0x23')][_0x78d7('0x79')]({'where':{'id':_0x4687a3['params']['id']}})[_0x78d7('0x17')](handleEntityNotFound(_0x4c1069,null))[_0x78d7('0x17')](function(_0x205fc1){if(_0x205fc1){_0x1186b9['model']=_['keys'](db[_0x78d7('0x77')]['rawAttributes']);_0x1186b9[_0x78d7('0x20')]=_[_0x78d7('0x26')](_0x4687a3[_0x78d7('0x20')]);_0x1186b9[_0x78d7('0x80')]=_[_0x78d7('0x7c')](_0x1186b9[_0x78d7('0x7a')],_0x1186b9[_0x78d7('0x20')]);_0x1ebe25[_0x78d7('0x7d')]=_[_0x78d7('0x7c')](_0x1186b9[_0x78d7('0x7a')],qs[_0x78d7('0x98')](_0x4687a3[_0x78d7('0x20')]['fields']));_0x1ebe25[_0x78d7('0x7d')]=_0x1ebe25[_0x78d7('0x7d')][_0x78d7('0x27')]?_0x1ebe25['attributes']:_0x1186b9[_0x78d7('0x7a')];if(!_0x4687a3['query'][_0x78d7('0x33')](_0x78d7('0x99'))){_0x1ebe25[_0x78d7('0x12')]=qs[_0x78d7('0x12')](_0x4687a3[_0x78d7('0x20')][_0x78d7('0x12')]);_0x1ebe25[_0x78d7('0x14')]=qs[_0x78d7('0x14')](_0x4687a3[_0x78d7('0x20')][_0x78d7('0x14')]);}_0x1ebe25[_0x78d7('0x7e')]=qs[_0x78d7('0x7f')](_0x4687a3[_0x78d7('0x20')][_0x78d7('0x7f')]);_0x1ebe25[_0x78d7('0x59')]=qs[_0x78d7('0x80')](_['pick'](_0x4687a3['query'],_0x1186b9[_0x78d7('0x80')]));_0x1ebe25[_0x78d7('0x59')][_0x78d7('0x9a')]=_0x205fc1['id'];if(_0x4687a3[_0x78d7('0x20')][_0x78d7('0x81')]){_0x1ebe25[_0x78d7('0x59')]=_['merge'](_0x1ebe25[_0x78d7('0x59')],{'$or':_[_0x78d7('0x71')](_0x1ebe25[_0x78d7('0x7d')],function(_0x15f09e){var _0x34a093={};_0x34a093[_0x15f09e]={'$like':'%'+_0x4687a3[_0x78d7('0x20')][_0x78d7('0x81')]+'%'};return _0x34a093;})});}_0x1ebe25=_[_0x78d7('0x34')]({},_0x1ebe25,_0x4687a3[_0x78d7('0x82')]);return db['CmHopper'][_0x78d7('0x13')]({'where':_0x1ebe25[_0x78d7('0x59')]})[_0x78d7('0x17')](function(_0x5b00ac){_0x37d7c5[_0x78d7('0x13')]=_0x5b00ac;if(_0x4687a3[_0x78d7('0x20')][_0x78d7('0x9b')]){_0x1ebe25[_0x78d7('0x9c')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x1ebe25);})[_0x78d7('0x17')](function(_0x57e455){_0x37d7c5['rows']=_0x57e455;return _0x37d7c5;});}})[_0x78d7('0x17')](respondWithFilteredResult(_0x4c1069,_0x1ebe25))[_0x78d7('0x22')](handleError(_0x4c1069,null));};exports[_0x78d7('0x9d')]=function(_0x7f9d1,_0x297f55){var _0x59bc14={'raw':!![],'where':{}};var _0x29e39c={};var _0x41482e={'count':0x0,'rows':[]};return db[_0x78d7('0x23')][_0x78d7('0x79')]({'where':{'id':_0x7f9d1[_0x78d7('0x25')]['id']}})[_0x78d7('0x17')](handleEntityNotFound(_0x297f55,null))[_0x78d7('0x17')](function(_0x3ae61c){if(_0x3ae61c){_0x29e39c[_0x78d7('0x7a')]=_['keys'](db[_0x78d7('0x9e')][_0x78d7('0x7b')]);_0x29e39c['query']=_[_0x78d7('0x26')](_0x7f9d1[_0x78d7('0x20')]);_0x29e39c[_0x78d7('0x80')]=_[_0x78d7('0x7c')](_0x29e39c['model'],_0x29e39c[_0x78d7('0x20')]);_0x59bc14[_0x78d7('0x7d')]=_['intersection'](_0x29e39c[_0x78d7('0x7a')],qs[_0x78d7('0x98')](_0x7f9d1[_0x78d7('0x20')][_0x78d7('0x98')]));_0x59bc14[_0x78d7('0x7d')]=_0x59bc14[_0x78d7('0x7d')][_0x78d7('0x27')]?_0x59bc14[_0x78d7('0x7d')]:_0x29e39c['model'];if(!_0x7f9d1['query'][_0x78d7('0x33')]('nolimit')){_0x59bc14[_0x78d7('0x12')]=qs[_0x78d7('0x12')](_0x7f9d1[_0x78d7('0x20')][_0x78d7('0x12')]);_0x59bc14[_0x78d7('0x14')]=qs[_0x78d7('0x14')](_0x7f9d1['query']['offset']);}_0x59bc14[_0x78d7('0x7e')]=qs[_0x78d7('0x7f')](_0x7f9d1[_0x78d7('0x20')][_0x78d7('0x7f')]);_0x59bc14[_0x78d7('0x59')]=qs['filters'](_['pick'](_0x7f9d1[_0x78d7('0x20')],_0x29e39c[_0x78d7('0x80')]));_0x59bc14[_0x78d7('0x59')]['ContactId']=_0x3ae61c['id'];if(_0x7f9d1['query'][_0x78d7('0x81')]){_0x59bc14[_0x78d7('0x59')]=_['merge'](_0x59bc14[_0x78d7('0x59')],{'$or':_[_0x78d7('0x71')](_0x59bc14[_0x78d7('0x7d')],function(_0x26909e){var _0x3eba47={};_0x3eba47[_0x26909e]={'$like':'%'+_0x7f9d1[_0x78d7('0x20')][_0x78d7('0x81')]+'%'};return _0x3eba47;})});}_0x59bc14=_['merge']({},_0x59bc14,_0x7f9d1[_0x78d7('0x82')]);return db[_0x78d7('0x9e')]['count']({'where':_0x59bc14[_0x78d7('0x59')]})[_0x78d7('0x17')](function(_0x12db34){_0x41482e[_0x78d7('0x13')]=_0x12db34;if(_0x7f9d1[_0x78d7('0x20')][_0x78d7('0x9b')]){_0x59bc14['include']=[{'all':!![]}];}return db[_0x78d7('0x9e')][_0x78d7('0x1f')](_0x59bc14);})[_0x78d7('0x17')](function(_0x3e7814){_0x41482e[_0x78d7('0x9f')]=_0x3e7814;return _0x41482e;});}})['then'](respondWithFilteredResult(_0x297f55,_0x59bc14))['catch'](handleError(_0x297f55,null));};exports[_0x78d7('0xa0')]=function(_0x95c17c,_0x384a4f){var _0x4e54bd={'raw':!![],'where':{}};var _0xde2f2a={};var _0x2c07bb={'count':0x0,'rows':[]};return db[_0x78d7('0x23')]['findOne']({'where':{'id':_0x95c17c['params']['id']}})[_0x78d7('0x17')](handleEntityNotFound(_0x384a4f,null))[_0x78d7('0x17')](function(_0xeab451){if(_0xeab451){_0xde2f2a[_0x78d7('0x7a')]=_['keys'](db['CmHopperFinal'][_0x78d7('0x7b')]);_0xde2f2a[_0x78d7('0x20')]=_[_0x78d7('0x26')](_0x95c17c['query']);_0xde2f2a['filters']=_[_0x78d7('0x7c')](_0xde2f2a['model'],_0xde2f2a[_0x78d7('0x20')]);_0x4e54bd[_0x78d7('0x7d')]=_[_0x78d7('0x7c')](_0xde2f2a['model'],qs['fields'](_0x95c17c['query'][_0x78d7('0x98')]));_0x4e54bd[_0x78d7('0x7d')]=_0x4e54bd[_0x78d7('0x7d')][_0x78d7('0x27')]?_0x4e54bd[_0x78d7('0x7d')]:_0xde2f2a[_0x78d7('0x7a')];if(!_0x95c17c[_0x78d7('0x20')]['hasOwnProperty'](_0x78d7('0x99'))){_0x4e54bd[_0x78d7('0x12')]=qs[_0x78d7('0x12')](_0x95c17c['query'][_0x78d7('0x12')]);_0x4e54bd[_0x78d7('0x14')]=qs[_0x78d7('0x14')](_0x95c17c[_0x78d7('0x20')][_0x78d7('0x14')]);}_0x4e54bd['order']=qs['sort'](_0x95c17c[_0x78d7('0x20')][_0x78d7('0x7f')]);_0x4e54bd[_0x78d7('0x59')]=qs[_0x78d7('0x80')](_[_0x78d7('0xa1')](_0x95c17c['query'],_0xde2f2a['filters']));_0x4e54bd['where']['ContactId']=_0xeab451['id'];if(_0x95c17c[_0x78d7('0x20')]['filter']){_0x4e54bd[_0x78d7('0x59')]=_['merge'](_0x4e54bd[_0x78d7('0x59')],{'$or':_[_0x78d7('0x71')](_0x4e54bd[_0x78d7('0x7d')],function(_0x322c30){var _0x14b892={};_0x14b892[_0x322c30]={'$like':'%'+_0x95c17c[_0x78d7('0x20')][_0x78d7('0x81')]+'%'};return _0x14b892;})});}_0x4e54bd=_[_0x78d7('0x34')]({},_0x4e54bd,_0x95c17c[_0x78d7('0x82')]);return db[_0x78d7('0x4a')][_0x78d7('0x13')]({'where':_0x4e54bd[_0x78d7('0x59')]})[_0x78d7('0x17')](function(_0x5c97ba){_0x2c07bb[_0x78d7('0x13')]=_0x5c97ba;if(_0x95c17c[_0x78d7('0x20')][_0x78d7('0x9b')]){_0x4e54bd[_0x78d7('0x9c')]=[{'all':!![]}];}return db[_0x78d7('0x4a')][_0x78d7('0x1f')](_0x4e54bd);})[_0x78d7('0x17')](function(_0x18ab12){_0x2c07bb[_0x78d7('0x9f')]=_0x18ab12;return _0x2c07bb;});}})[_0x78d7('0x17')](respondWithFilteredResult(_0x384a4f,_0x4e54bd))[_0x78d7('0x22')](handleError(_0x384a4f,null));};exports['getJscriptySessions']=function(_0x570fb3,_0x163839){var _0x1d2c2e={'raw':!![],'where':{}};var _0x377291={};var _0x15e2fa={'count':0x0,'rows':[]};return db[_0x78d7('0x23')][_0x78d7('0x79')]({'where':{'id':_0x570fb3[_0x78d7('0x25')]['id']}})['then'](handleEntityNotFound(_0x163839,null))['then'](function(_0x125b89){if(_0x125b89){_0x377291[_0x78d7('0x7a')]=_[_0x78d7('0x26')](db[_0x78d7('0x4f')][_0x78d7('0x7b')]);_0x377291[_0x78d7('0x20')]=_['keys'](_0x570fb3['query']);_0x377291['filters']=_[_0x78d7('0x7c')](_0x377291['model'],_0x377291['query']);_0x1d2c2e[_0x78d7('0x7d')]=_[_0x78d7('0x7c')](_0x377291[_0x78d7('0x7a')],qs[_0x78d7('0x98')](_0x570fb3['query'][_0x78d7('0x98')]));_0x1d2c2e['attributes']=_0x1d2c2e[_0x78d7('0x7d')][_0x78d7('0x27')]?_0x1d2c2e[_0x78d7('0x7d')]:_0x377291[_0x78d7('0x7a')];if(!_0x570fb3[_0x78d7('0x20')][_0x78d7('0x33')](_0x78d7('0x99'))){_0x1d2c2e[_0x78d7('0x12')]=qs[_0x78d7('0x12')](_0x570fb3[_0x78d7('0x20')]['limit']);_0x1d2c2e['offset']=qs['offset'](_0x570fb3[_0x78d7('0x20')][_0x78d7('0x14')]);}_0x1d2c2e[_0x78d7('0x7e')]=qs[_0x78d7('0x7f')](_0x570fb3['query'][_0x78d7('0x7f')]);_0x1d2c2e[_0x78d7('0x59')]=qs[_0x78d7('0x80')](_[_0x78d7('0xa1')](_0x570fb3[_0x78d7('0x20')],_0x377291[_0x78d7('0x80')]));_0x1d2c2e[_0x78d7('0x59')]['ContactId']=_0x125b89['id'];if(_0x570fb3[_0x78d7('0x20')]['filter']){_0x1d2c2e[_0x78d7('0x59')]=_[_0x78d7('0x34')](_0x1d2c2e[_0x78d7('0x59')],{'$or':_[_0x78d7('0x71')](_0x1d2c2e[_0x78d7('0x7d')],function(_0x18ff8d){var _0x5dfd39={};_0x5dfd39[_0x18ff8d]={'$like':'%'+_0x570fb3[_0x78d7('0x20')]['filter']+'%'};return _0x5dfd39;})});}_0x1d2c2e=_[_0x78d7('0x34')]({},_0x1d2c2e,_0x570fb3[_0x78d7('0x82')]);return db[_0x78d7('0x4f')]['count']({'where':_0x1d2c2e[_0x78d7('0x59')]})[_0x78d7('0x17')](function(_0x3ecae2){_0x15e2fa[_0x78d7('0x13')]=_0x3ecae2;if(_0x570fb3[_0x78d7('0x20')][_0x78d7('0x9b')]){_0x1d2c2e[_0x78d7('0x9c')]=[{'all':!![]}];}return db[_0x78d7('0x4f')][_0x78d7('0x1f')](_0x1d2c2e);})[_0x78d7('0x17')](function(_0x206806){_0x15e2fa[_0x78d7('0x9f')]=_0x206806;return _0x15e2fa;});}})[_0x78d7('0x17')](respondWithFilteredResult(_0x163839,_0x1d2c2e))[_0x78d7('0x22')](handleError(_0x163839,null));};exports[_0x78d7('0xa2')]=function(_0x3d3c10,_0x271e7d){try{if(!_0x3d3c10[_0x78d7('0x35')]['ListId']){throw new Error(_0x78d7('0xa3'));}if(!_0x3d3c10[_0x78d7('0x35')][_0x78d7('0xa4')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x3d3c10['body']['binding_values']){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x3d3c10['body'][_0x78d7('0xa5')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x495080=_0x3d3c10[_0x78d7('0x35')][_0x78d7('0xa4')][_0x78d7('0xa6')](',');var _0x1a092d=_0x3d3c10[_0x78d7('0x35')][_0x78d7('0xa7')][_0x78d7('0xa6')](',');if(!_0x495080[_0x78d7('0x27')]||!_0x1a092d[_0x78d7('0x27')]||_0x495080['length']!==_0x1a092d[_0x78d7('0x27')]){throw new Error(_0x78d7('0xa8'));}_0x3d3c10[_0x78d7('0x35')]['fields']=_[_0x78d7('0xa9')](_0x495080,_0x1a092d);if(!_0x3d3c10[_0x78d7('0x35')][_0x78d7('0x98')]['phone']){throw new Error(_0x78d7('0xaa'));}if(!_0x3d3c10[_0x78d7('0x35')]['fields'][_0x78d7('0xab')]){throw new Error(_0x78d7('0xac'));}var _0x504f35=path['join'](config[_0x78d7('0xad')],_0x78d7('0xae'),_0x3d3c10[_0x78d7('0xaf')][_0x78d7('0xb0')]);fs['chmodSync'](_0x504f35,parseInt(_0x78d7('0xb1'),0x8));var _0x3c4e32=require(_0x78d7('0xb2'))['fork'](path[_0x78d7('0x39')](__dirname,_0x78d7('0xb3')),[_0x504f35,_0x3d3c10['body'][_0x78d7('0xa4')],_0x3d3c10[_0x78d7('0x35')][_0x78d7('0xa7')],_0x3d3c10[_0x78d7('0x35')][_0x78d7('0x5b')],_0x3d3c10[_0x78d7('0x35')][_0x78d7('0xb4')],_0x3d3c10[_0x78d7('0x35')][_0x78d7('0x58')],_0x3d3c10['body'][_0x78d7('0xa5')]]);return _0x271e7d['status'](0xc8)[_0x78d7('0x10')]({'message':_0x78d7('0xb5'),'pid':_0x3c4e32[_0x78d7('0xb6')]});}catch(_0x4f161d){return _0x271e7d[_0x78d7('0xf')](0x1f4)[_0x78d7('0x1b')](_0x4f161d);}};exports['upload']=function(_0x4d0f0a,_0x2b2d2d){var _0x309316=fs['createReadStream'](_0x4d0f0a[_0x78d7('0xaf')][_0x78d7('0x2')]);Papa[_0x78d7('0xb7')](_0x309316,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x35e112){return _0x2b2d2d[_0x78d7('0xf')](0xc8)[_0x78d7('0x10')]({'file':_0x4d0f0a[_0x78d7('0xaf')],'fields':_0x35e112[_0x78d7('0xb8')][_0x78d7('0x98')]});}});};exports[_0x78d7('0xb9')]=function(_0x2434dc,_0x2894fd){return db[_0x78d7('0xba')][_0x78d7('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':_0x78d7('0xbb')}})[_0x78d7('0x17')](function(_0x48a774){var _0x549f48=![];if(!_0x2434dc[_0x78d7('0x35')][_0x78d7('0x5b')]){throw new Error('No\x20ListId\x20specified');}if(!_0x2434dc[_0x78d7('0x35')][_0x78d7('0xbc')]['phone']){throw new Error(_0x78d7('0xaa'));}if(!_0x2434dc['body'][_0x78d7('0xbc')][_0x78d7('0xab')]){throw new Error(_0x78d7('0xac'));}if(!_0x2434dc[_0x78d7('0x35')][_0x78d7('0xa5')]){throw new Error(_0x78d7('0xbd'));}var _0x517bbd=require(_0x78d7('0xb2'))[_0x78d7('0xbe')](path[_0x78d7('0x39')](__dirname,_0x78d7('0xbf')),[_0x2434dc[_0x78d7('0x25')]['id'],JSON['stringify'](_0x2434dc['body']),JSON[_0x78d7('0xc0')](_0x48a774)]);_0x517bbd['on']('message',function(){_0x549f48=!![];return _0x2894fd['status'](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x517bbd[_0x78d7('0xb6')]});});_0x517bbd['on']('exit',function(_0x3185a7){if(_0x3185a7&&!_0x549f48){return _0x2894fd[_0x78d7('0xf')](0x1f4)['json']({'message':_0x78d7('0xc1'),'pid':_0x517bbd['pid']});}});})[_0x78d7('0x22')](handleError(_0x2894fd,null));};exports[_0x78d7('0xc2')]=function(_0x36c7e8,_0x331c29){return db['User'][_0x78d7('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':_0x78d7('0xbb')}})[_0x78d7('0x17')](function(_0x2d3515){var _0x54d069=![];if(!_0x36c7e8['body'][_0x78d7('0x5b')]){throw new Error(_0x78d7('0xa3'));}if(!_0x36c7e8[_0x78d7('0x35')][_0x78d7('0xbc')][_0x78d7('0x78')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x36c7e8[_0x78d7('0x35')][_0x78d7('0xbc')][_0x78d7('0xab')]){throw new Error(_0x78d7('0xac'));}if(!_0x36c7e8[_0x78d7('0x35')][_0x78d7('0xa5')]){throw new Error(_0x78d7('0xbd'));}var _0x564035=require('child_process')[_0x78d7('0xbe')](path['join'](__dirname,'../../components/import/cm/csvUpdates'),[_0x36c7e8[_0x78d7('0x25')]['id'],JSON[_0x78d7('0xc0')](_0x36c7e8[_0x78d7('0x35')]),JSON[_0x78d7('0xc0')](_0x2d3515)]);_0x564035['on'](_0x78d7('0xc3'),function(){_0x54d069=!![];return _0x331c29[_0x78d7('0xf')](0xc8)[_0x78d7('0x10')]({'message':_0x78d7('0xc4'),'pid':_0x564035[_0x78d7('0xb6')]});});_0x564035['on'](_0x78d7('0xc5'),function(_0x3247af){if(_0x3247af&&!_0x54d069){return _0x331c29[_0x78d7('0xf')](0x1f4)[_0x78d7('0x10')]({'message':_0x78d7('0xc1'),'pid':_0x564035[_0x78d7('0xb6')]});}});})[_0x78d7('0x22')](handleError(_0x331c29,null));};exports[_0x78d7('0xc6')]=function(_0x6cfac1,_0x317d3d){var _0x475ff8=[_0x78d7('0xc7'),_0x78d7('0xc8'),_0x78d7('0xc9'),'openchannel',_0x78d7('0xca'),_0x78d7('0xcb'),_0x78d7('0xcc')];var _0x3a7614={'offset':0x0,'order':qs['sort'](_0x78d7('0xcd'))},_0x2e029e={'count':0x0,'rows':[]};Promise[_0x78d7('0xce')]()[_0x78d7('0x17')](function(){if(_0x6cfac1[_0x78d7('0x20')][_0x78d7('0xcf')]){if(!_[_0x78d7('0xd0')](_0x475ff8,_0x6cfac1[_0x78d7('0x20')][_0x78d7('0xcf')][_0x78d7('0xd1')]())){throw new Error(_0x78d7('0xd2'));}_0x475ff8=[_0x6cfac1[_0x78d7('0x20')][_0x78d7('0xcf')][_0x78d7('0xd1')]()];}if(_0x6cfac1[_0x78d7('0x20')][_0x78d7('0xd3')]){try{var _0xea98d0=JSON['parse'](_0x6cfac1[_0x78d7('0x20')][_0x78d7('0xd3')]);if(!moment(_0xea98d0['from'])[_0x78d7('0xd4')]()){throw new Error(_0x78d7('0xd5'));}if(!moment(_0xea98d0['to'])[_0x78d7('0xd4')]()){throw new Error(_0x78d7('0xd6'));}}catch(_0x5951fd){throw new Error(_0x78d7('0xd7'));}}if(!_0x6cfac1[_0x78d7('0x20')]['hasOwnProperty'](_0x78d7('0x99'))){_0x3a7614[_0x78d7('0x12')]=qs[_0x78d7('0x12')](_0x6cfac1[_0x78d7('0x20')][_0x78d7('0x12')]||0xa);_0x3a7614['offset']=qs[_0x78d7('0x14')](_0x6cfac1[_0x78d7('0x20')][_0x78d7('0x14')]);}var _0x33f4d2=_0x475ff8[_0x78d7('0x71')](function(_0x43234d){if(_0x43234d===_0x78d7('0xcc')){var _0xbeb229={'attributes':['id','uniqueid',_0x78d7('0x2e'),_0x78d7('0xd8'),_0x78d7('0xd9'),'callerid',_0x78d7('0xda'),_0x78d7('0xdb'),_0x78d7('0xdc'),_0x78d7('0xdd'),_0x78d7('0xde'),'userDisposition',_0x78d7('0xdf'),_0x78d7('0xe0'),_0x78d7('0xe1')],'where':{'ContactId':_0x6cfac1[_0x78d7('0x25')]['id']},'include':[{'model':db[_0x78d7('0xba')],'as':_0x78d7('0xba'),'attributes':['id',_0x78d7('0x1a'),_0x78d7('0xe2'),'alias']}],'order':[[_0x78d7('0xde'),_0x78d7('0xe3')]]};if(_0x6cfac1[_0x78d7('0x20')][_0x78d7('0xd3')]){_0xbeb229[_0x78d7('0x59')][_0x78d7('0xde')]={'$gte':_0xea98d0[_0x78d7('0x3b')],'$lte':_0xea98d0['to']};}return db[_0x78d7('0x4c')][_0x78d7('0xe4')](_0xbeb229)[_0x78d7('0x17')](function(_0x5f23a8){_0x2e029e[_0x78d7('0x13')]+=_0x5f23a8[_0x78d7('0x13')];return _[_0x78d7('0x71')](_0x5f23a8[_0x78d7('0x9f')],function(_0x1fa608){var _0x4b72e9=_0x1fa608[_0x78d7('0x69')]({'plain':!![]});_0x4b72e9['channel']=_0x43234d;if(_0x4b72e9[_0x78d7('0xba')]){_0x4b72e9['User']={'id':_0x4b72e9[_0x78d7('0xba')]['id'],'name':_0x4b72e9[_0x78d7('0xba')][_0x78d7('0x1a')],'fullname':_0x4b72e9['User'][_0x78d7('0xe2')],'alias':_0x4b72e9[_0x78d7('0xba')][_0x78d7('0x2c')]};}return _0x4b72e9;});});}else{var _0xd2712d=_[_0x78d7('0xe5')](_0x43234d)+(_0x43234d==='chat'?'Website':_0x78d7('0xe6'));var _0x1bafab={'attributes':['id',_0x78d7('0xe7'),'closedAt',_0x78d7('0xde'),_0x78d7('0xdd'),_0x78d7('0xe8'),_0x78d7('0xe9'),_0x78d7('0xea'),'UserId',_0xd2712d+'Id'],'where':{'ContactId':_0x6cfac1[_0x78d7('0x25')]['id']},'include':[{'model':db[_0xd2712d],'as':'Account','attributes':['id',_0x78d7('0x1a'),'key']},{'model':db[_0x78d7('0xba')],'as':_0x78d7('0xeb'),'attributes':['id',_0x78d7('0x1a'),_0x78d7('0xe2')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x78d7('0x1a'),_0x78d7('0x63')],'through':{'attributes':[]}}],'order':[[_0x78d7('0xde'),_0x78d7('0xe3')]]};if(_0x6cfac1[_0x78d7('0x20')][_0x78d7('0xd3')]){_0x1bafab[_0x78d7('0x59')]['createdAt']={'$gte':_0xea98d0[_0x78d7('0x3b')],'$lte':_0xea98d0['to']};}switch(_0x43234d){case'chat':_0x1bafab[_0x78d7('0x7d')]['push']('browserName',_0x78d7('0xec'),_0x78d7('0xed'),_0x78d7('0xee'),_0x78d7('0xef'),'ratingMessage',_0x78d7('0xf0'),'ratingValue',_0x78d7('0xf1'));break;case _0x78d7('0xc7'):_0x1bafab['attributes'][_0x78d7('0x5e')](_0x78d7('0xf2'),_0x78d7('0xf3'));break;case _0x78d7('0xf4'):_0x1bafab['attributes']['push'](_0x78d7('0xf5'),_0x78d7('0xf6'));break;}return db[_[_0x78d7('0xe5')](_0x43234d)+'Interaction']['findAndCountAll'](_0x1bafab)[_0x78d7('0x17')](function(_0x2d3ba1){_0x2e029e[_0x78d7('0x13')]+=_0x2d3ba1[_0x78d7('0x13')];return _[_0x78d7('0x71')](_0x2d3ba1[_0x78d7('0x9f')],function(_0x3e05e2){var _0x1c53cd=_0x3e05e2['get']({'plain':!![]});_0x1c53cd[_0x78d7('0xcf')]=_0x43234d;if(_0x1c53cd[_0x78d7('0xeb')]){_0x1c53cd[_0x78d7('0xeb')]={'id':_0x1c53cd['Owner']['id'],'name':_0x1c53cd['Owner']['name'],'fullname':_0x1c53cd[_0x78d7('0xeb')][_0x78d7('0xe2')]};}return _0x1c53cd;});});}});return Promise[_0x78d7('0x87')](_0x33f4d2);})['then'](function(_0xb51eda){return _(_0xb51eda)[_0x78d7('0xf7')]()['sortBy'](_0x78d7('0xde'))[_0x78d7('0xf8')]()[_0x78d7('0xf9')]();})['then'](function(_0x455073){_0x2e029e[_0x78d7('0x9f')]=_0x3a7614[_0x78d7('0x12')]?_0x455073[_0x78d7('0xfa')](_0x3a7614[_0x78d7('0x14')],_0x3a7614[_0x78d7('0x14')]+_0x3a7614[_0x78d7('0x12')]):_0x455073;return _0x2e029e;})[_0x78d7('0x17')](respondWithFilteredResult(_0x317d3d,_0x3a7614))[_0x78d7('0x22')](handleError(_0x317d3d,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 6a43757..785eef1 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 _0xbb4c=['../../mysqldb','setMaxListeners','save','remove','emit','exports','events'];(function(_0x17ee76,_0x4c5ddf){var _0x2d11c5=function(_0x2b8d3f){while(--_0x2b8d3f){_0x17ee76['push'](_0x17ee76['shift']());}};_0x2d11c5(++_0x4c5ddf);}(_0xbb4c,0x11e));var _0xcbb4=function(_0x34f709,_0x462672){_0x34f709=_0x34f709-0x0;var _0x11de47=_0xbb4c[_0x34f709];return _0x11de47;};'use strict';var EventEmitter=require(_0xcbb4('0x0'));var CmContact=require(_0xcbb4('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0xcbb4('0x2')](0x0);var events={'afterCreate':_0xcbb4('0x3'),'afterUpdate':'update','afterDestroy':_0xcbb4('0x4')};function emitEvent(_0xea6b87){return function(_0x187bb8,_0x56571f,_0x6b1f22){CmContactEvents['emit'](_0xea6b87+':'+_0x187bb8['id'],_0x187bb8);CmContactEvents[_0xcbb4('0x5')](_0xea6b87,_0x187bb8);_0x6b1f22(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xcbb4('0x6')]=CmContactEvents; \ No newline at end of file +var _0x37aa=['update','remove','emit','hook','exports','events','../../mysqldb','CmContact','save'];(function(_0x234e1e,_0x531528){var _0x22a084=function(_0x5de93d){while(--_0x5de93d){_0x234e1e['push'](_0x234e1e['shift']());}};_0x22a084(++_0x531528);}(_0x37aa,0x11c));var _0xa37a=function(_0x1deb72,_0x3f6338){_0x1deb72=_0x1deb72-0x0;var _0x18bbdf=_0x37aa[_0x1deb72];return _0x18bbdf;};'use strict';var EventEmitter=require(_0xa37a('0x0'));var CmContact=require(_0xa37a('0x1'))['db'][_0xa37a('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa37a('0x3'),'afterUpdate':_0xa37a('0x4'),'afterDestroy':_0xa37a('0x5')};function emitEvent(_0x2b5dc7){return function(_0x379600,_0x476123,_0x33aacb){CmContactEvents[_0xa37a('0x6')](_0x2b5dc7+':'+_0x379600['id'],_0x379600);CmContactEvents[_0xa37a('0x6')](_0x2b5dc7,_0x379600);_0x33aacb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xa37a('0x7')](e,emitEvent(event));}}module[_0xa37a('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 8b1f3bb..9d403d9 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 _0x1c0b=['Campaign','VoiceQueue','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','then','add','minutes','format','phone','ListId','callbackUniqueid','assign','CmHopper','findOne','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','always','onlyIfOpen','findAll','outbound','dialCheckDuplicateType','Lists','map','all','CmList','BlackLists','CmHopperBlack','exports','CmContact','cm_contacts','fti_cm_contacts','firstName','lastName','mobile','utf8mb4','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','message','destroy','ContactId','push','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','util','api','moment'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x1c0b,0x133));var _0xb1c0=function(_0xd89835,_0x2913fa){_0xd89835=_0xd89835-0x0;var _0x10a6fb=_0x1c0b[_0xd89835];return _0x10a6fb;};'use strict';var _=require('lodash');var util=require(_0xb1c0('0x0'));var logger=require('../../config/logger')(_0xb1c0('0x1'));var moment=require(_0xb1c0('0x2'));var shared=require('../../config/environment/shared');var attributes=require('./cmContact.attributes');function getTimezoneCallbackAt(_0x4d4007,_0x210645,_0x279835,_0x272ffb){var _0x5a642f=_0x272ffb?_0xb1c0('0x3'):_0xb1c0('0x4');var _0xf80ef9=_0x279835['scheduledat']?_0x279835[_0xb1c0('0x5')]:moment()['format'](_0xb1c0('0x6'));if(_[_0xb1c0('0x7')](_0x279835[_0xb1c0('0x8')])){return Promise[_0xb1c0('0x9')](_0xf80ef9);}return _0x4d4007[_0x5a642f]['findOne']({'where':{'id':_0x210645}})[_0xb1c0('0xa')](function(_0x263786){if(_['isNil'](_0x263786)||_[_0xb1c0('0x7')](_0x263786[_0xb1c0('0x8')])){return Promise[_0xb1c0('0x9')](_0xf80ef9);}var _0x107a56=shared['timezones'];var _0x1a30e3=_0x107a56[_0x263786[_0xb1c0('0x8')]];var _0x1c1cbf=_0x107a56[_0x279835[_0xb1c0('0x8')]];if(_[_0xb1c0('0x7')](_0x1a30e3)&&_[_0xb1c0('0x7')](_0x1c1cbf)){return Promise[_0xb1c0('0x9')](_0xf80ef9);}var _0x4f56ec=_0x1a30e3['utcOffset']-_0x1c1cbf['utcOffset'];var _0x177c0e=_0x279835[_0xb1c0('0x5')]?_0x279835[_0xb1c0('0x5')]:moment();_0xf80ef9=moment(_0x177c0e)[_0xb1c0('0xb')](_0x4f56ec,_0xb1c0('0xc'))[_0xb1c0('0xd')](_0xb1c0('0x6'));return Promise[_0xb1c0('0x9')](_0xf80ef9);});}function getNewHopperPayload(_0xe149af){return{'phone':_0xe149af[_0xb1c0('0xe')],'ContactId':_0xe149af['id'],'ListId':_0xe149af[_0xb1c0('0xf')],'scheduledat':_0xe149af[_0xb1c0('0x5')]?_0xe149af[_0xb1c0('0x5')]:moment()['format'](_0xb1c0('0x6')),'priority':_0xe149af['priority']?_0xe149af['priority']:0x2,'callback':_0xe149af[_0xb1c0('0x10')]?!![]:![],'callbackuniqueid':_0xe149af[_0xb1c0('0x10')]?_0xe149af[_0xb1c0('0x10')]:undefined,'callbackat':_0xe149af['callbackUniqueid']?moment()[_0xb1c0('0xd')](_0xb1c0('0x6')):undefined};}function handleAlwaysCheckDuplicate(_0x2aa81b,_0x1ce809,_0x1075ce,_0x3e669c){var _0x2e8012={'phone':_0x1075ce[_0xb1c0('0xe')]};var _0x210a15={'calleridnum':_0x1075ce['phone']};if(_0x3e669c){Object[_0xb1c0('0x11')](_0x2e8012,{'CampaignId':_0x1ce809['id']});Object['assign'](_0x210a15,{'CampaignId':_0x1ce809['id']});}else{Object[_0xb1c0('0x11')](_0x2e8012,{'VoiceQueueId':_0x1ce809['id']});Object[_0xb1c0('0x11')](_0x210a15,{'VoiceQueueId':_0x1ce809['id']});}return _0x2aa81b[_0xb1c0('0x12')][_0xb1c0('0x13')]({'where':_0x2e8012})['then'](function(_0xc507ee){if(_0xc507ee){throw new Error(_0xb1c0('0x14')+_0x1075ce[_0xb1c0('0xe')]+_0xb1c0('0x15')+_0x1ce809['id']);}return _0x2aa81b[_0xb1c0('0x16')][_0xb1c0('0x13')]({'where':_0x210a15});})['then'](function(_0x1afabb){if(_0x1afabb){throw new Error(_0xb1c0('0x17')+_0x1075ce['phone']+_0xb1c0('0x15')+_0x1ce809['id']);}var _0x26a1dc=getNewHopperPayload(_0x1075ce);if(_0x3e669c){_0x26a1dc[_0xb1c0('0x18')]=_0x1ce809['id'];}else{_0x26a1dc[_0xb1c0('0x19')]=_0x1ce809['id'];}return _0x2aa81b['CmHopper'][_0xb1c0('0x1a')](_0x26a1dc);});}function handleOnlyIfOpenCheckDuplicate(_0x127b13,_0x4b037e,_0x5a00e6,_0x1342c5){var _0x3e9fdc={'phone':_0x5a00e6[_0xb1c0('0xe')]};if(_0x1342c5){Object[_0xb1c0('0x11')](_0x3e9fdc,{'CampaignId':_0x4b037e['id']});}else{Object[_0xb1c0('0x11')](_0x3e9fdc,{'VoiceQueueId':_0x4b037e['id']});}return _0x127b13[_0xb1c0('0x12')]['findOne']({'where':_0x3e9fdc})[_0xb1c0('0xa')](function(_0x2438f5){if(_0x2438f5){throw new Error(_0xb1c0('0x1b')+_0x5a00e6[_0xb1c0('0xe')]+_0xb1c0('0x15')+_0x4b037e['id']);}var _0x3e45c6=getNewHopperPayload(_0x5a00e6);if(_0x1342c5){_0x3e45c6[_0xb1c0('0x18')]=_0x4b037e['id'];}else{_0x3e45c6[_0xb1c0('0x19')]=_0x4b037e['id'];}return _0x127b13['CmHopper'][_0xb1c0('0x1a')](_0x3e45c6);});}function handleNeverCheckDuplicate(_0x51f364,_0x167489,_0x270709){var _0xc518c9=getNewHopperPayload(_0x270709);_0xc518c9['VoiceQueueId']=_0x167489['id'];return _0x51f364[_0xb1c0('0x12')][_0xb1c0('0x1a')](_0xc518c9);}function handleCheckDuplicate(_0x5c57ab,_0x28fb40,_0x5df1eb,_0x5f5bc1){return getTimezoneCallbackAt(_0x5c57ab,_0x28fb40,_0x5df1eb,_0x5f5bc1)[_0xb1c0('0xa')](function(_0x194588){_0x5df1eb[_0xb1c0('0x5')]=_0x194588;switch(_0x28fb40['dialCheckDuplicateType']){case _0xb1c0('0x1c'):return handleAlwaysCheckDuplicate(_0x5c57ab,_0x28fb40,_0x5df1eb,_0x5f5bc1);case _0xb1c0('0x1d'):return handleOnlyIfOpenCheckDuplicate(_0x5c57ab,_0x28fb40,_0x5df1eb,_0x5f5bc1);default:return handleNeverCheckDuplicate(_0x5c57ab,_0x28fb40,_0x5df1eb);}});}function createHopperForVoiceQueues(_0x125b0d,_0x3ad4bd){return _0x125b0d[_0xb1c0('0x4')][_0xb1c0('0x1e')]({'where':{'type':_0xb1c0('0x1f')},'attributes':['id',_0xb1c0('0x20'),'dialTimezone'],'include':[{'model':_0x125b0d['CmList'],'as':_0xb1c0('0x21'),'where':{'id':_0x3ad4bd['ListId']}}],'raw':!![]})[_0xb1c0('0xa')](function(_0x1b7eea){var _0x385907=_0x1b7eea[_0xb1c0('0x22')](function(_0x1d033c){return handleCheckDuplicate(_0x125b0d,_0x1d033c,_0x3ad4bd,![]);});return Promise[_0xb1c0('0x23')](_0x385907);});}function createHopperForCampaigns(_0x332a3a,_0x4cf0fe){return _0x332a3a['Campaign'][_0xb1c0('0x1e')]({'attributes':['id',_0xb1c0('0x20'),_0xb1c0('0x8')],'include':[{'model':_0x332a3a[_0xb1c0('0x24')],'as':'Lists','where':{'id':_0x4cf0fe[_0xb1c0('0xf')]}}],'raw':!![]})[_0xb1c0('0xa')](function(_0x14e2f1){var _0x414a14=_0x14e2f1['map'](function(_0x258812){return handleCheckDuplicate(_0x332a3a,_0x258812,_0x4cf0fe,!![]);});return Promise[_0xb1c0('0x23')](_0x414a14);});}function createHopperBlackForVoiceQueues(_0x57c37d,_0x2f5d13){return _0x57c37d['VoiceQueue'][_0xb1c0('0x1e')]({'where':{'type':_0xb1c0('0x1f')},'attributes':['id'],'include':[{'model':_0x57c37d['CmList'],'as':_0xb1c0('0x25'),'where':{'id':_0x2f5d13[_0xb1c0('0xf')]}}],'raw':!![]})['then'](function(_0x15057c){var _0x8c51a5=_0x15057c['map'](function(_0x189930){return _0x57c37d[_0xb1c0('0x26')]['create']({'phone':_0x2f5d13['phone'],'ContactId':_0x2f5d13['id'],'ListId':_0x2f5d13['ListId'],'VoiceQueueId':_0x189930['id']});});return Promise['all'](_0x8c51a5);});}function createHopperBlackForCampaigns(_0x7ddf7a,_0x1c9fa2){return _0x7ddf7a[_0xb1c0('0x3')]['findAll']({'attributes':['id'],'include':[{'model':_0x7ddf7a[_0xb1c0('0x24')],'as':_0xb1c0('0x25'),'where':{'id':_0x1c9fa2[_0xb1c0('0xf')]}}],'raw':!![]})[_0xb1c0('0xa')](function(_0x24464b){var _0xfb0da9=_0x24464b[_0xb1c0('0x22')](function(_0x32d3d4){return _0x7ddf7a[_0xb1c0('0x26')][_0xb1c0('0x1a')]({'phone':_0x1c9fa2[_0xb1c0('0xe')],'ContactId':_0x1c9fa2['id'],'ListId':_0x1c9fa2[_0xb1c0('0xf')],'CampaignId':_0x32d3d4['id']});});return Promise[_0xb1c0('0x23')](_0xfb0da9);});}module[_0xb1c0('0x27')]=function(_0x17b702){return _0x17b702['define'](_0xb1c0('0x28'),attributes,{'tableName':_0xb1c0('0x29'),'paranoid':!![],'indexes':[{'name':_0xb1c0('0xe'),'fields':[_0xb1c0('0xe')]},{'name':_0xb1c0('0x2a'),'fields':[_0xb1c0('0x2b'),_0xb1c0('0x2c'),_0xb1c0('0xe'),_0xb1c0('0x2d'),'fax','email'],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xb1c0('0x2e'),'collate':_0xb1c0('0x2f'),'hooks':{'afterCreate':function(_0x3f53f5,_0x1fa410,_0x3b6c9d){var _0x4635ef=_0x17b702[_0xb1c0('0x30')];var _0x7a9596=_0x3f53f5[_0xb1c0('0x31')]({'plain':!![]});if(!_0x7a9596['ListId']){logger[_0xb1c0('0x32')](_0xb1c0('0x33')+_0x7a9596['id']);return _0x3b6c9d();}if(!_0x7a9596[_0xb1c0('0xe')]){return _0x3b6c9d();}return createHopperForVoiceQueues(_0x4635ef,_0x7a9596)[_0xb1c0('0xa')](function(){return createHopperBlackForVoiceQueues(_0x4635ef,_0x7a9596);})[_0xb1c0('0xa')](function(){return createHopperForCampaigns(_0x4635ef,_0x7a9596);})[_0xb1c0('0xa')](function(){return createHopperBlackForCampaigns(_0x4635ef,_0x7a9596);})[_0xb1c0('0xa')](function(){return _0x3b6c9d();})[_0xb1c0('0x34')](function(_0x179db7){logger['error'](_0xb1c0('0x35'),_0x179db7[_0xb1c0('0x36')]);_0x3b6c9d();});},'afterDestroy':function(_0x5bf2a2,_0x11ae7e,_0x576666){var _0x141e4d=_0x17b702[_0xb1c0('0x30')];var _0x54d3c9=_0x5bf2a2['get']({'plain':!![]});return _0x141e4d[_0xb1c0('0x12')][_0xb1c0('0x1e')]({'raw':!![],'where':{'ListId':_0x54d3c9[_0xb1c0('0xf')],'ContactId':_0x54d3c9['id']}})['then'](function(_0x45cea1){if(!_['isEmpty'](_0x45cea1)){var _0x1017a3=[];for(var _0x9f30ea=0x0;_0x9f30ea<_0x45cea1['length'];_0x9f30ea+=0x1){var _0x3ca2d8=_0x141e4d[_0xb1c0('0x12')][_0xb1c0('0x37')]({'where':{'ListId':_0x45cea1[_0x9f30ea]['ListId'],'ContactId':_0x45cea1[_0x9f30ea][_0xb1c0('0x38')],'VoiceQueueId':_0x45cea1[_0x9f30ea][_0xb1c0('0x19')],'CampaignId':_0x45cea1[_0x9f30ea][_0xb1c0('0x18')]}});_0x1017a3[_0xb1c0('0x39')](_0x3ca2d8);}return Promise['all'](_0x1017a3);}})[_0xb1c0('0xa')](function(_0x195a1f){logger[_0xb1c0('0x3a')](_0xb1c0('0x3b'),util[_0xb1c0('0x3c')](_0x195a1f,{'showHidden':![],'depth':null}));_0x576666();})['catch'](function(_0x16289b){logger['error'](_0xb1c0('0x3d'),util[_0xb1c0('0x3c')](_0x16289b,{'showHidden':![],'depth':null}));_0x576666(_0x16289b);});}}});}; \ No newline at end of file +var _0x157e=['utf8mb4','utf8mb4_unicode_ci','models','get','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','message','isEmpty','length','destroy','ContactId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','inspect','../../config/logger','moment','./cmContact.attributes','scheduledat','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','findOne','then','isNil','resolve','timezones','utcOffset','add','minutes','format','phone','priority','callbackUniqueid','assign','CmHopper','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','create','always','onlyIfOpen','findAll','dialCheckDuplicateType','CmList','Lists','ListId','all','Campaign','map','VoiceQueue','BlackLists','CmHopperBlack','exports','define','CmContact','cm_contacts','fti_cm_contacts','firstName','lastName','mobile','email','FULLTEXT'];(function(_0x2ef9a9,_0x1f4fff){var _0x475eb1=function(_0x306893){while(--_0x306893){_0x2ef9a9['push'](_0x2ef9a9['shift']());}};_0x475eb1(++_0x1f4fff);}(_0x157e,0x94));var _0xe157=function(_0x673ea4,_0x449076){_0x673ea4=_0x673ea4-0x0;var _0x3e5938=_0x157e[_0x673ea4];return _0x3e5938;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe157('0x0'))('api');var moment=require(_0xe157('0x1'));var shared=require('../../config/environment/shared');var attributes=require(_0xe157('0x2'));function getTimezoneCallbackAt(_0xd7d882,_0x43c1ec,_0x56aa6c,_0x5b588a){var _0x2af660=_0x5b588a?'Campaign':'VoiceQueue';var _0x2d0329=_0x56aa6c[_0xe157('0x3')]?_0x56aa6c['scheduledat']:moment()['format'](_0xe157('0x4'));if(_['isNil'](_0x56aa6c[_0xe157('0x5')])){return Promise['resolve'](_0x2d0329);}return _0xd7d882[_0x2af660][_0xe157('0x6')]({'where':{'id':_0x43c1ec}})[_0xe157('0x7')](function(_0x23169c){if(_[_0xe157('0x8')](_0x23169c)||_[_0xe157('0x8')](_0x23169c['dialTimezone'])){return Promise[_0xe157('0x9')](_0x2d0329);}var _0x54aa21=shared[_0xe157('0xa')];var _0x426188=_0x54aa21[_0x23169c[_0xe157('0x5')]];var _0x9b0c6e=_0x54aa21[_0x56aa6c[_0xe157('0x5')]];if(_[_0xe157('0x8')](_0x426188)&&_[_0xe157('0x8')](_0x9b0c6e)){return Promise[_0xe157('0x9')](_0x2d0329);}var _0x222fb8=_0x426188[_0xe157('0xb')]-_0x9b0c6e['utcOffset'];var _0x406f0f=_0x56aa6c[_0xe157('0x3')]?_0x56aa6c[_0xe157('0x3')]:moment();_0x2d0329=moment(_0x406f0f)[_0xe157('0xc')](_0x222fb8,_0xe157('0xd'))[_0xe157('0xe')](_0xe157('0x4'));return Promise['resolve'](_0x2d0329);});}function getNewHopperPayload(_0x4f96dc){return{'phone':_0x4f96dc[_0xe157('0xf')],'ContactId':_0x4f96dc['id'],'ListId':_0x4f96dc['ListId'],'scheduledat':_0x4f96dc[_0xe157('0x3')]?_0x4f96dc['scheduledat']:moment()[_0xe157('0xe')](_0xe157('0x4')),'priority':_0x4f96dc['priority']?_0x4f96dc[_0xe157('0x10')]:0x2,'callback':_0x4f96dc[_0xe157('0x11')]?!![]:![],'callbackuniqueid':_0x4f96dc[_0xe157('0x11')]?_0x4f96dc[_0xe157('0x11')]:undefined,'callbackat':_0x4f96dc['callbackUniqueid']?moment()[_0xe157('0xe')](_0xe157('0x4')):undefined};}function handleAlwaysCheckDuplicate(_0x33ad58,_0x5da87e,_0x4dc387,_0x59779a){var _0x5c89d4={'phone':_0x4dc387[_0xe157('0xf')]};var _0x4284ce={'calleridnum':_0x4dc387[_0xe157('0xf')]};if(_0x59779a){Object[_0xe157('0x12')](_0x5c89d4,{'CampaignId':_0x5da87e['id']});Object[_0xe157('0x12')](_0x4284ce,{'CampaignId':_0x5da87e['id']});}else{Object[_0xe157('0x12')](_0x5c89d4,{'VoiceQueueId':_0x5da87e['id']});Object[_0xe157('0x12')](_0x4284ce,{'VoiceQueueId':_0x5da87e['id']});}return _0x33ad58[_0xe157('0x13')][_0xe157('0x6')]({'where':_0x5c89d4})[_0xe157('0x7')](function(_0x524084){if(_0x524084){throw new Error('[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x4dc387[_0xe157('0xf')]+_0xe157('0x14')+_0x5da87e['id']);}return _0x33ad58[_0xe157('0x15')][_0xe157('0x6')]({'where':_0x4284ce});})[_0xe157('0x7')](function(_0x924118){if(_0x924118){throw new Error(_0xe157('0x16')+_0x4dc387[_0xe157('0xf')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x5da87e['id']);}var _0x659ae0=getNewHopperPayload(_0x4dc387);if(_0x59779a){_0x659ae0[_0xe157('0x17')]=_0x5da87e['id'];}else{_0x659ae0[_0xe157('0x18')]=_0x5da87e['id'];}return _0x33ad58[_0xe157('0x13')]['create'](_0x659ae0);});}function handleOnlyIfOpenCheckDuplicate(_0x30fca0,_0x315115,_0x2bd5fd,_0x1588eb){var _0x16eb86={'phone':_0x2bd5fd[_0xe157('0xf')]};if(_0x1588eb){Object[_0xe157('0x12')](_0x16eb86,{'CampaignId':_0x315115['id']});}else{Object[_0xe157('0x12')](_0x16eb86,{'VoiceQueueId':_0x315115['id']});}return _0x30fca0['CmHopper']['findOne']({'where':_0x16eb86})['then'](function(_0x13d92d){if(_0x13d92d){throw new Error(_0xe157('0x19')+_0x2bd5fd[_0xe157('0xf')]+_0xe157('0x14')+_0x315115['id']);}var _0x1ea01f=getNewHopperPayload(_0x2bd5fd);if(_0x1588eb){_0x1ea01f['CampaignId']=_0x315115['id'];}else{_0x1ea01f[_0xe157('0x18')]=_0x315115['id'];}return _0x30fca0['CmHopper'][_0xe157('0x1a')](_0x1ea01f);});}function handleNeverCheckDuplicate(_0x39425a,_0x465b0b,_0x1960c7){var _0x1af537=getNewHopperPayload(_0x1960c7);_0x1af537[_0xe157('0x18')]=_0x465b0b['id'];return _0x39425a[_0xe157('0x13')]['create'](_0x1af537);}function handleCheckDuplicate(_0x391ccb,_0x1128ae,_0xa65a73,_0x4e2a48){return getTimezoneCallbackAt(_0x391ccb,_0x1128ae,_0xa65a73,_0x4e2a48)[_0xe157('0x7')](function(_0x308691){_0xa65a73['scheduledat']=_0x308691;switch(_0x1128ae['dialCheckDuplicateType']){case _0xe157('0x1b'):return handleAlwaysCheckDuplicate(_0x391ccb,_0x1128ae,_0xa65a73,_0x4e2a48);case _0xe157('0x1c'):return handleOnlyIfOpenCheckDuplicate(_0x391ccb,_0x1128ae,_0xa65a73,_0x4e2a48);default:return handleNeverCheckDuplicate(_0x391ccb,_0x1128ae,_0xa65a73);}});}function createHopperForVoiceQueues(_0xdb20ac,_0x38384d){return _0xdb20ac['VoiceQueue'][_0xe157('0x1d')]({'where':{'type':'outbound'},'attributes':['id',_0xe157('0x1e'),_0xe157('0x5')],'include':[{'model':_0xdb20ac[_0xe157('0x1f')],'as':_0xe157('0x20'),'where':{'id':_0x38384d[_0xe157('0x21')]}}],'raw':!![]})[_0xe157('0x7')](function(_0x4e73a7){var _0x511e9e=_0x4e73a7['map'](function(_0x49e2b1){return handleCheckDuplicate(_0xdb20ac,_0x49e2b1,_0x38384d,![]);});return Promise[_0xe157('0x22')](_0x511e9e);});}function createHopperForCampaigns(_0x5d7e8a,_0x4806ae){return _0x5d7e8a[_0xe157('0x23')][_0xe157('0x1d')]({'attributes':['id',_0xe157('0x1e'),_0xe157('0x5')],'include':[{'model':_0x5d7e8a[_0xe157('0x1f')],'as':_0xe157('0x20'),'where':{'id':_0x4806ae[_0xe157('0x21')]}}],'raw':!![]})['then'](function(_0x566e86){var _0x553a80=_0x566e86[_0xe157('0x24')](function(_0x1a5906){return handleCheckDuplicate(_0x5d7e8a,_0x1a5906,_0x4806ae,!![]);});return Promise['all'](_0x553a80);});}function createHopperBlackForVoiceQueues(_0x15d6e2,_0x1b5dc2){return _0x15d6e2[_0xe157('0x25')][_0xe157('0x1d')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x15d6e2['CmList'],'as':_0xe157('0x26'),'where':{'id':_0x1b5dc2[_0xe157('0x21')]}}],'raw':!![]})['then'](function(_0x107788){var _0x44a3fb=_0x107788['map'](function(_0x499d10){return _0x15d6e2['CmHopperBlack'][_0xe157('0x1a')]({'phone':_0x1b5dc2[_0xe157('0xf')],'ContactId':_0x1b5dc2['id'],'ListId':_0x1b5dc2['ListId'],'VoiceQueueId':_0x499d10['id']});});return Promise[_0xe157('0x22')](_0x44a3fb);});}function createHopperBlackForCampaigns(_0x40d2d6,_0x34552b){return _0x40d2d6[_0xe157('0x23')][_0xe157('0x1d')]({'attributes':['id'],'include':[{'model':_0x40d2d6[_0xe157('0x1f')],'as':_0xe157('0x26'),'where':{'id':_0x34552b[_0xe157('0x21')]}}],'raw':!![]})['then'](function(_0x23fb3f){var _0x5cd03d=_0x23fb3f[_0xe157('0x24')](function(_0x10b611){return _0x40d2d6[_0xe157('0x27')]['create']({'phone':_0x34552b[_0xe157('0xf')],'ContactId':_0x34552b['id'],'ListId':_0x34552b[_0xe157('0x21')],'CampaignId':_0x10b611['id']});});return Promise['all'](_0x5cd03d);});}module[_0xe157('0x28')]=function(_0x59a2d4){return _0x59a2d4[_0xe157('0x29')](_0xe157('0x2a'),attributes,{'tableName':_0xe157('0x2b'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0xe157('0xf')]},{'name':_0xe157('0x2c'),'fields':[_0xe157('0x2d'),_0xe157('0x2e'),_0xe157('0xf'),_0xe157('0x2f'),'fax',_0xe157('0x30')],'type':_0xe157('0x31')}],'timestamps':!![],'charset':_0xe157('0x32'),'collate':_0xe157('0x33'),'hooks':{'afterCreate':function(_0x283bff,_0x4bb55d,_0x2e8f0d){var _0x3ccad4=_0x59a2d4[_0xe157('0x34')];var _0x1bcc18=_0x283bff[_0xe157('0x35')]({'plain':!![]});if(!_0x1bcc18[_0xe157('0x21')]){logger['error'](_0xe157('0x36')+_0x1bcc18['id']);return _0x2e8f0d();}if(!_0x1bcc18[_0xe157('0xf')]){return _0x2e8f0d();}return createHopperForVoiceQueues(_0x3ccad4,_0x1bcc18)[_0xe157('0x7')](function(){return createHopperBlackForVoiceQueues(_0x3ccad4,_0x1bcc18);})[_0xe157('0x7')](function(){return createHopperForCampaigns(_0x3ccad4,_0x1bcc18);})['then'](function(){return createHopperBlackForCampaigns(_0x3ccad4,_0x1bcc18);})[_0xe157('0x7')](function(){return _0x2e8f0d();})[_0xe157('0x37')](function(_0x10e853){logger['error']('[cmContact][afterCreate]',_0x10e853[_0xe157('0x38')]);_0x2e8f0d();});},'afterDestroy':function(_0x5aae19,_0x460313,_0x2dad82){var _0x10fde5=_0x59a2d4[_0xe157('0x34')];var _0x4cbdb3=_0x5aae19['get']({'plain':!![]});return _0x10fde5[_0xe157('0x13')][_0xe157('0x1d')]({'raw':!![],'where':{'ListId':_0x4cbdb3['ListId'],'ContactId':_0x4cbdb3['id']}})['then'](function(_0x539b53){if(!_[_0xe157('0x39')](_0x539b53)){var _0x25f4e6=[];for(var _0x11776f=0x0;_0x11776f<_0x539b53[_0xe157('0x3a')];_0x11776f+=0x1){var _0x232a6c=_0x10fde5[_0xe157('0x13')][_0xe157('0x3b')]({'where':{'ListId':_0x539b53[_0x11776f][_0xe157('0x21')],'ContactId':_0x539b53[_0x11776f][_0xe157('0x3c')],'VoiceQueueId':_0x539b53[_0x11776f][_0xe157('0x18')],'CampaignId':_0x539b53[_0x11776f][_0xe157('0x17')]}});_0x25f4e6[_0xe157('0x3d')](_0x232a6c);}return Promise[_0xe157('0x22')](_0x25f4e6);}})[_0xe157('0x7')](function(_0x41fc5d){logger[_0xe157('0x3e')](_0xe157('0x3f'),util['inspect'](_0x41fc5d,{'showHidden':![],'depth':null}));_0x2dad82();})[_0xe157('0x37')](function(_0x1800f5){logger['error'](_0xe157('0x40'),util[_0xe157('0x41')](_0x1800f5,{'showHidden':![],'depth':null}));_0x2dad82(_0x1800f5);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 1a5cf1e..b9f6430 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 _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x54e3e0,_0x24d855){var _0x576a24=function(_0x156e4){while(--_0x156e4){_0x54e3e0['push'](_0x54e3e0['shift']());}};_0x576a24(++_0x24d855);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 5d89311..84e3bde 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 _0x7914=['STRING','INTEGER','PHONE','sequelize','exports'];(function(_0x51065f,_0xd93aa8){var _0x42bed3=function(_0x2063d5){while(--_0x2063d5){_0x51065f['push'](_0x51065f['shift']());}};_0x42bed3(++_0xd93aa8);}(_0x7914,0x107));var _0x4791=function(_0x5ec079,_0x16a8ab){_0x5ec079=_0x5ec079-0x0;var _0x3bfa56=_0x7914[_0x5ec079];return _0x3bfa56;};'use strict';var Sequelize=require(_0x4791('0x0'));module[_0x4791('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x4791('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x4791('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x4791('0x2')],'defaultValue':_0x4791('0x4')},'OrderBy':{'type':Sequelize[_0x4791('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x4791('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xc9b7=['STRING','PHONE','sequelize','exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc9b7,0x1ab));var _0x7c9b=function(_0x5ed652,_0x531731){_0x5ed652=_0x5ed652-0x0;var _0x3c0826=_0xc9b7[_0x5ed652];return _0x3c0826;};'use strict';var Sequelize=require(_0x7c9b('0x0'));module[_0x7c9b('0x1')]={'CmContactId':{'type':Sequelize[_0x7c9b('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x7c9b('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x7c9b('0x3')],'defaultValue':_0x7c9b('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x7c9b('0x3')],'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 7f624d3..154a967 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 _0x3f8f=['../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','Content-Range','apply','reject','save','then','destroy','get','CmContactHasItems','UserProfileResource','end','error','stack','name','index','map','CmContactHasItem','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','update','body','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x1c50c7,_0x53f7f0){var _0x27c9d5=function(_0x28652e){while(--_0x28652e){_0x1c50c7['push'](_0x1c50c7['shift']());}};_0x27c9d5(++_0x53f7f0);}(_0x3f8f,0x1f4));var _0xf3f8=function(_0x299d1e,_0x3f4d39){_0x299d1e=_0x299d1e-0x0;var _0xbc6aab=_0x3f8f[_0x299d1e];return _0xbc6aab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf3f8('0x0'));var zipdir=require(_0xf3f8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf3f8('0x2'));var moment=require('moment');var BPromise=require(_0xf3f8('0x3'));var Mustache=require(_0xf3f8('0x4'));var util=require('util');var path=require('path');var sox=require(_0xf3f8('0x5'));var csv=require(_0xf3f8('0x6'));var ejs=require(_0xf3f8('0x7'));var fs=require('fs');var fs_extra=require(_0xf3f8('0x8'));var _=require(_0xf3f8('0x9'));var squel=require(_0xf3f8('0xa'));var crypto=require('crypto');var jsforce=require(_0xf3f8('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf3f8('0xc'));var Papa=require('papaparse');var Redis=require(_0xf3f8('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf3f8('0xe'));var as=require(_0xf3f8('0xf'));var hardwareService=require(_0xf3f8('0x10'));var logger=require(_0xf3f8('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xf3f8('0x12'));var licenseUtil=require(_0xf3f8('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x281021,_0x35e11a){_0x35e11a=_0x35e11a||0xcc;return function(_0x5ede48){if(_0x5ede48){return _0x281021[_0xf3f8('0x14')](_0x35e11a);}return _0x281021[_0xf3f8('0x15')](_0x35e11a)['end']();};}function respondWithResult(_0x2cc1ef,_0x2508e9){_0x2508e9=_0x2508e9||0xc8;return function(_0x52f12a){if(_0x52f12a){return _0x2cc1ef[_0xf3f8('0x15')](_0x2508e9)[_0xf3f8('0x16')](_0x52f12a);}};}function respondWithFilteredResult(_0x4aee1a,_0x5b97c8){return function(_0x25c7d1){if(_0x25c7d1){var _0x365455=typeof _0x5b97c8[_0xf3f8('0x17')]==='undefined'&&typeof _0x5b97c8[_0xf3f8('0x18')]==='undefined';var _0x5f49db=_0x25c7d1[_0xf3f8('0x19')];var _0x2b6cd0=_0x365455?0x0:_0x5b97c8[_0xf3f8('0x17')];var _0x4ff3ad=_0x365455?_0x25c7d1['count']:_0x5b97c8[_0xf3f8('0x17')]+_0x5b97c8[_0xf3f8('0x18')];var _0x5de18;if(_0x4ff3ad>=_0x5f49db){_0x4ff3ad=_0x5f49db;_0x5de18=0xc8;}else{_0x5de18=0xce;}_0x4aee1a[_0xf3f8('0x15')](_0x5de18);return _0x4aee1a['set'](_0xf3f8('0x1a'),_0x2b6cd0+'-'+_0x4ff3ad+'/'+_0x5f49db)[_0xf3f8('0x16')](_0x25c7d1);}return null;};}function patchUpdates(_0x4ec40d){return function(_0x5dd6a8){try{jsonpatch[_0xf3f8('0x1b')](_0x5dd6a8,_0x4ec40d,!![]);}catch(_0x1ad470){return BPromise[_0xf3f8('0x1c')](_0x1ad470);}return _0x5dd6a8[_0xf3f8('0x1d')]();};}function saveUpdates(_0x43bfd2,_0x48b034){return function(_0x5cac0d){if(_0x5cac0d){return _0x5cac0d['update'](_0x43bfd2)[_0xf3f8('0x1e')](function(_0x54f3a5){return _0x54f3a5;});}return null;};}function removeEntity(_0x44c802,_0x2aafcf){return function(_0x4a3ac0){if(_0x4a3ac0){return _0x4a3ac0[_0xf3f8('0x1f')]()[_0xf3f8('0x1e')](function(){var _0x4efc81=_0x4a3ac0[_0xf3f8('0x20')]({'plain':!![]});var _0x569bb0=_0xf3f8('0x21');return db[_0xf3f8('0x22')][_0xf3f8('0x1f')]({'where':{'type':_0x569bb0,'resourceId':_0x4efc81['id']}})[_0xf3f8('0x1e')](function(){return _0x4a3ac0;});})[_0xf3f8('0x1e')](function(){_0x44c802[_0xf3f8('0x15')](0xcc)[_0xf3f8('0x23')]();});}};}function handleEntityNotFound(_0x5326fb,_0x232167){return function(_0x457ae3){if(!_0x457ae3){_0x5326fb[_0xf3f8('0x14')](0x194);}return _0x457ae3;};}function handleError(_0x2a5281,_0x4a9897){_0x4a9897=_0x4a9897||0x1f4;return function(_0x106506){logger[_0xf3f8('0x24')](_0x106506[_0xf3f8('0x25')]);if(_0x106506[_0xf3f8('0x26')]){delete _0x106506[_0xf3f8('0x26')];}_0x2a5281[_0xf3f8('0x15')](_0x4a9897)['send'](_0x106506);};}exports[_0xf3f8('0x27')]=function(_0x5739bd,_0xcb9401){var _0x5a4b8f={},_0x172880={},_0x4906c0={'count':0x0,'rows':[]};var _0x523e62=_[_0xf3f8('0x28')](db[_0xf3f8('0x29')][_0xf3f8('0x2a')],function(_0x11a223){return{'name':_0x11a223[_0xf3f8('0x2b')],'type':_0x11a223[_0xf3f8('0x2c')]['key']};});_0x172880[_0xf3f8('0x2d')]=_[_0xf3f8('0x28')](_0x523e62,_0xf3f8('0x26'));_0x172880[_0xf3f8('0x2e')]=_[_0xf3f8('0x2f')](_0x5739bd[_0xf3f8('0x2e')]);_0x172880['filters']=_[_0xf3f8('0x30')](_0x172880[_0xf3f8('0x2d')],_0x172880[_0xf3f8('0x2e')]);_0x5a4b8f[_0xf3f8('0x31')]=_[_0xf3f8('0x30')](_0x172880[_0xf3f8('0x2d')],qs[_0xf3f8('0x32')](_0x5739bd[_0xf3f8('0x2e')][_0xf3f8('0x32')]));_0x5a4b8f[_0xf3f8('0x31')]=_0x5a4b8f[_0xf3f8('0x31')][_0xf3f8('0x33')]?_0x5a4b8f[_0xf3f8('0x31')]:_0x172880[_0xf3f8('0x2d')];if(!_0x5739bd[_0xf3f8('0x2e')]['hasOwnProperty'](_0xf3f8('0x34'))){_0x5a4b8f[_0xf3f8('0x18')]=qs[_0xf3f8('0x18')](_0x5739bd[_0xf3f8('0x2e')][_0xf3f8('0x18')]);_0x5a4b8f[_0xf3f8('0x17')]=qs[_0xf3f8('0x17')](_0x5739bd['query'][_0xf3f8('0x17')]);}_0x5a4b8f['order']=qs[_0xf3f8('0x35')](_0x5739bd[_0xf3f8('0x2e')]['sort']);_0x5a4b8f[_0xf3f8('0x36')]=qs[_0xf3f8('0x37')](_['pick'](_0x5739bd[_0xf3f8('0x2e')],_0x172880[_0xf3f8('0x37')]),_0x523e62);if(_0x5739bd[_0xf3f8('0x2e')][_0xf3f8('0x38')]){_0x5a4b8f[_0xf3f8('0x36')]=_['merge'](_0x5a4b8f[_0xf3f8('0x36')],{'$or':_[_0xf3f8('0x28')](_0x523e62,function(_0x20391e){if(_0x20391e[_0xf3f8('0x2c')]!==_0xf3f8('0x39')){var _0x308b79={};_0x308b79[_0x20391e[_0xf3f8('0x26')]]={'$like':'%'+_0x5739bd[_0xf3f8('0x2e')][_0xf3f8('0x38')]+'%'};return _0x308b79;}})});}_0x5a4b8f=_[_0xf3f8('0x3a')]({},_0x5a4b8f,_0x5739bd[_0xf3f8('0x3b')]);var _0xc08341={'where':_0x5a4b8f[_0xf3f8('0x36')]};return db['CmContactHasItem'][_0xf3f8('0x19')](_0xc08341)[_0xf3f8('0x1e')](function(_0x464d3c){_0x4906c0['count']=_0x464d3c;if(_0x5739bd[_0xf3f8('0x2e')]['includeAll']){_0x5a4b8f[_0xf3f8('0x3c')]=[{'all':!![]}];}return db[_0xf3f8('0x29')][_0xf3f8('0x3d')](_0x5a4b8f);})[_0xf3f8('0x1e')](function(_0x5804c5){_0x4906c0[_0xf3f8('0x3e')]=_0x5804c5;return _0x4906c0;})[_0xf3f8('0x1e')](respondWithFilteredResult(_0xcb9401,_0x5a4b8f))[_0xf3f8('0x3f')](handleError(_0xcb9401,null));};exports[_0xf3f8('0x40')]=function(_0x5a18b2,_0x2efb93){var _0x393313={'raw':!![],'where':{'id':_0x5a18b2[_0xf3f8('0x41')]['id']}},_0x382a40={};_0x382a40['model']=_['keys'](db['CmContactHasItem'][_0xf3f8('0x2a')]);_0x382a40[_0xf3f8('0x2e')]=_['keys'](_0x5a18b2['query']);_0x382a40['filters']=_[_0xf3f8('0x30')](_0x382a40[_0xf3f8('0x2d')],_0x382a40[_0xf3f8('0x2e')]);_0x393313[_0xf3f8('0x31')]=_[_0xf3f8('0x30')](_0x382a40[_0xf3f8('0x2d')],qs[_0xf3f8('0x32')](_0x5a18b2['query']['fields']));_0x393313[_0xf3f8('0x31')]=_0x393313['attributes']['length']?_0x393313[_0xf3f8('0x31')]:_0x382a40[_0xf3f8('0x2d')];if(_0x5a18b2[_0xf3f8('0x2e')]['includeAll']){_0x393313['include']=[{'all':!![]}];}_0x393313=_['merge']({},_0x393313,_0x5a18b2[_0xf3f8('0x3b')]);return db[_0xf3f8('0x29')][_0xf3f8('0x42')](_0x393313)[_0xf3f8('0x1e')](handleEntityNotFound(_0x2efb93,null))[_0xf3f8('0x1e')](respondWithResult(_0x2efb93,null))[_0xf3f8('0x3f')](handleError(_0x2efb93,null));};exports[_0xf3f8('0x43')]=function(_0x1b0e8d,_0x592997){return db[_0xf3f8('0x29')]['create'](_0x1b0e8d['body'],{})[_0xf3f8('0x1e')](function(_0x28933e){var _0x5924d2=_0x1b0e8d[_0xf3f8('0x44')][_0xf3f8('0x20')]({'plain':!![]});if(!_0x5924d2)throw new Error(_0xf3f8('0x45'));if(_0x5924d2[_0xf3f8('0x46')]===_0xf3f8('0x44')){var _0x49e329=_0x28933e['get']({'plain':!![]});var _0x2d2580=_0xf3f8('0x21');return db['UserProfileSection'][_0xf3f8('0x42')]({'where':{'name':_0x2d2580,'userProfileId':_0x5924d2['userProfileId']},'raw':!![]})[_0xf3f8('0x1e')](function(_0x19537e){if(_0x19537e&&_0x19537e[_0xf3f8('0x47')]===0x0){return db[_0xf3f8('0x22')]['create']({'name':_0x49e329['name'],'resourceId':_0x49e329['id'],'type':_0x19537e[_0xf3f8('0x26')],'sectionId':_0x19537e['id']},{})[_0xf3f8('0x1e')](function(){return _0x28933e;});}else{return _0x28933e;}})[_0xf3f8('0x3f')](function(_0x4440e6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4440e6);throw _0x4440e6;});}return _0x28933e;})[_0xf3f8('0x1e')](respondWithResult(_0x592997,0xc9))[_0xf3f8('0x3f')](handleError(_0x592997,null));};exports[_0xf3f8('0x48')]=function(_0x5aa4f5,_0x4b5f41){if(_0x5aa4f5['body']['id']){delete _0x5aa4f5[_0xf3f8('0x49')]['id'];}return db[_0xf3f8('0x29')][_0xf3f8('0x42')]({'where':{'id':_0x5aa4f5[_0xf3f8('0x41')]['id']}})[_0xf3f8('0x1e')](handleEntityNotFound(_0x4b5f41,null))[_0xf3f8('0x1e')](saveUpdates(_0x5aa4f5['body'],null))[_0xf3f8('0x1e')](respondWithResult(_0x4b5f41,null))[_0xf3f8('0x3f')](handleError(_0x4b5f41,null));};exports['destroy']=function(_0x46b6cc,_0x6a4cef){return db[_0xf3f8('0x29')][_0xf3f8('0x42')]({'where':{'id':_0x46b6cc['params']['id']}})[_0xf3f8('0x1e')](handleEntityNotFound(_0x6a4cef,null))[_0xf3f8('0x1e')](removeEntity(_0x6a4cef,null))[_0xf3f8('0x3f')](handleError(_0x6a4cef,null));}; \ No newline at end of file +var _0x74c8=['catch','show','params','options','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','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','CmContactHasItems','UserProfileResource','stack','name','index','map','CmContactHasItem','rawAttributes','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows'];(function(_0xc84c38,_0x49fbeb){var _0x1253bc=function(_0x3ab7e9){while(--_0x3ab7e9){_0xc84c38['push'](_0xc84c38['shift']());}};_0x1253bc(++_0x49fbeb);}(_0x74c8,0x1b9));var _0x874c=function(_0x170ccb,_0xa9c592){_0x170ccb=_0x170ccb-0x0;var _0x29f8e5=_0x74c8[_0x170ccb];return _0x29f8e5;};'use strict';var emlformat=require(_0x874c('0x0'));var rimraf=require(_0x874c('0x1'));var zipdir=require(_0x874c('0x2'));var jsonpatch=require(_0x874c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x874c('0x4'));var util=require('util');var path=require(_0x874c('0x5'));var sox=require(_0x874c('0x6'));var csv=require(_0x874c('0x7'));var ejs=require(_0x874c('0x8'));var fs=require('fs');var fs_extra=require(_0x874c('0x9'));var _=require('lodash');var squel=require(_0x874c('0xa'));var crypto=require(_0x874c('0xb'));var jsforce=require(_0x874c('0xc'));var deskjs=require(_0x874c('0xd'));var toCsv=require(_0x874c('0x7'));var querystring=require(_0x874c('0xe'));var Papa=require(_0x874c('0xf'));var Redis=require(_0x874c('0x10'));var authService=require(_0x874c('0x11'));var qs=require(_0x874c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x874c('0x13'));var logger=require(_0x874c('0x14'))(_0x874c('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x874c('0x16'))['db'];function respondWithStatusCode(_0xde9740,_0x41e084){_0x41e084=_0x41e084||0xcc;return function(_0x40c296){if(_0x40c296){return _0xde9740[_0x874c('0x17')](_0x41e084);}return _0xde9740[_0x874c('0x18')](_0x41e084)[_0x874c('0x19')]();};}function respondWithResult(_0x207197,_0x5dc45d){_0x5dc45d=_0x5dc45d||0xc8;return function(_0x11bdee){if(_0x11bdee){return _0x207197[_0x874c('0x18')](_0x5dc45d)[_0x874c('0x1a')](_0x11bdee);}};}function respondWithFilteredResult(_0x28b0fd,_0x49901f){return function(_0x5b73ee){if(_0x5b73ee){var _0x41723b=typeof _0x49901f[_0x874c('0x1b')]===_0x874c('0x1c')&&typeof _0x49901f['limit']===_0x874c('0x1c');var _0x474038=_0x5b73ee['count'];var _0x34870e=_0x41723b?0x0:_0x49901f[_0x874c('0x1b')];var _0xb11603=_0x41723b?_0x5b73ee[_0x874c('0x1d')]:_0x49901f[_0x874c('0x1b')]+_0x49901f['limit'];var _0x473882;if(_0xb11603>=_0x474038){_0xb11603=_0x474038;_0x473882=0xc8;}else{_0x473882=0xce;}_0x28b0fd[_0x874c('0x18')](_0x473882);return _0x28b0fd[_0x874c('0x1e')]('Content-Range',_0x34870e+'-'+_0xb11603+'/'+_0x474038)[_0x874c('0x1a')](_0x5b73ee);}return null;};}function patchUpdates(_0x346f7f){return function(_0x370717){try{jsonpatch[_0x874c('0x1f')](_0x370717,_0x346f7f,!![]);}catch(_0x54fea9){return BPromise[_0x874c('0x20')](_0x54fea9);}return _0x370717[_0x874c('0x21')]();};}function saveUpdates(_0x510871,_0x482a65){return function(_0x41d451){if(_0x41d451){return _0x41d451[_0x874c('0x22')](_0x510871)[_0x874c('0x23')](function(_0x5a16f8){return _0x5a16f8;});}return null;};}function removeEntity(_0x4b18eb,_0x37ea60){return function(_0x3d5580){if(_0x3d5580){return _0x3d5580[_0x874c('0x24')]()[_0x874c('0x23')](function(){var _0x3c887f=_0x3d5580['get']({'plain':!![]});var _0x272c82=_0x874c('0x25');return db[_0x874c('0x26')][_0x874c('0x24')]({'where':{'type':_0x272c82,'resourceId':_0x3c887f['id']}})[_0x874c('0x23')](function(){return _0x3d5580;});})['then'](function(){_0x4b18eb['status'](0xcc)[_0x874c('0x19')]();});}};}function handleEntityNotFound(_0x38cd31,_0x45ff4d){return function(_0x24ef80){if(!_0x24ef80){_0x38cd31[_0x874c('0x17')](0x194);}return _0x24ef80;};}function handleError(_0x479946,_0x461cd4){_0x461cd4=_0x461cd4||0x1f4;return function(_0x1d66a1){logger['error'](_0x1d66a1[_0x874c('0x27')]);if(_0x1d66a1[_0x874c('0x28')]){delete _0x1d66a1['name'];}_0x479946[_0x874c('0x18')](_0x461cd4)['send'](_0x1d66a1);};}exports[_0x874c('0x29')]=function(_0xe9f1bd,_0x29899b){var _0x3e2df2={},_0x4883e6={},_0x4a146f={'count':0x0,'rows':[]};var _0x7a834c=_[_0x874c('0x2a')](db[_0x874c('0x2b')][_0x874c('0x2c')],function(_0x2541e2){return{'name':_0x2541e2['fieldName'],'type':_0x2541e2['type'][_0x874c('0x2d')]};});_0x4883e6['model']=_[_0x874c('0x2a')](_0x7a834c,_0x874c('0x28'));_0x4883e6['query']=_[_0x874c('0x2e')](_0xe9f1bd[_0x874c('0x2f')]);_0x4883e6[_0x874c('0x30')]=_[_0x874c('0x31')](_0x4883e6[_0x874c('0x32')],_0x4883e6[_0x874c('0x2f')]);_0x3e2df2[_0x874c('0x33')]=_['intersection'](_0x4883e6[_0x874c('0x32')],qs[_0x874c('0x34')](_0xe9f1bd['query'][_0x874c('0x34')]));_0x3e2df2['attributes']=_0x3e2df2[_0x874c('0x33')][_0x874c('0x35')]?_0x3e2df2[_0x874c('0x33')]:_0x4883e6['model'];if(!_0xe9f1bd[_0x874c('0x2f')][_0x874c('0x36')](_0x874c('0x37'))){_0x3e2df2[_0x874c('0x38')]=qs[_0x874c('0x38')](_0xe9f1bd[_0x874c('0x2f')]['limit']);_0x3e2df2['offset']=qs['offset'](_0xe9f1bd[_0x874c('0x2f')][_0x874c('0x1b')]);}_0x3e2df2[_0x874c('0x39')]=qs[_0x874c('0x3a')](_0xe9f1bd[_0x874c('0x2f')][_0x874c('0x3a')]);_0x3e2df2[_0x874c('0x3b')]=qs[_0x874c('0x30')](_[_0x874c('0x3c')](_0xe9f1bd['query'],_0x4883e6['filters']),_0x7a834c);if(_0xe9f1bd[_0x874c('0x2f')]['filter']){_0x3e2df2[_0x874c('0x3b')]=_[_0x874c('0x3d')](_0x3e2df2['where'],{'$or':_[_0x874c('0x2a')](_0x7a834c,function(_0x53b3b6){if(_0x53b3b6[_0x874c('0x3e')]!==_0x874c('0x3f')){var _0x60e998={};_0x60e998[_0x53b3b6[_0x874c('0x28')]]={'$like':'%'+_0xe9f1bd[_0x874c('0x2f')][_0x874c('0x40')]+'%'};return _0x60e998;}})});}_0x3e2df2=_['merge']({},_0x3e2df2,_0xe9f1bd['options']);var _0x55bfc9={'where':_0x3e2df2['where']};return db['CmContactHasItem']['count'](_0x55bfc9)[_0x874c('0x23')](function(_0x9aea6d){_0x4a146f[_0x874c('0x1d')]=_0x9aea6d;if(_0xe9f1bd[_0x874c('0x2f')][_0x874c('0x41')]){_0x3e2df2[_0x874c('0x42')]=[{'all':!![]}];}return db[_0x874c('0x2b')][_0x874c('0x43')](_0x3e2df2);})[_0x874c('0x23')](function(_0x4dde1e){_0x4a146f[_0x874c('0x44')]=_0x4dde1e;return _0x4a146f;})['then'](respondWithFilteredResult(_0x29899b,_0x3e2df2))[_0x874c('0x45')](handleError(_0x29899b,null));};exports[_0x874c('0x46')]=function(_0x15053a,_0x222d01){var _0x264fbd={'raw':!![],'where':{'id':_0x15053a[_0x874c('0x47')]['id']}},_0x5e0d98={};_0x5e0d98[_0x874c('0x32')]=_['keys'](db['CmContactHasItem'][_0x874c('0x2c')]);_0x5e0d98[_0x874c('0x2f')]=_[_0x874c('0x2e')](_0x15053a[_0x874c('0x2f')]);_0x5e0d98[_0x874c('0x30')]=_['intersection'](_0x5e0d98['model'],_0x5e0d98[_0x874c('0x2f')]);_0x264fbd[_0x874c('0x33')]=_['intersection'](_0x5e0d98[_0x874c('0x32')],qs[_0x874c('0x34')](_0x15053a[_0x874c('0x2f')]['fields']));_0x264fbd[_0x874c('0x33')]=_0x264fbd[_0x874c('0x33')][_0x874c('0x35')]?_0x264fbd[_0x874c('0x33')]:_0x5e0d98[_0x874c('0x32')];if(_0x15053a['query']['includeAll']){_0x264fbd[_0x874c('0x42')]=[{'all':!![]}];}_0x264fbd=_[_0x874c('0x3d')]({},_0x264fbd,_0x15053a[_0x874c('0x48')]);return db[_0x874c('0x2b')][_0x874c('0x49')](_0x264fbd)[_0x874c('0x23')](handleEntityNotFound(_0x222d01,null))[_0x874c('0x23')](respondWithResult(_0x222d01,null))[_0x874c('0x45')](handleError(_0x222d01,null));};exports[_0x874c('0x4a')]=function(_0x2ac65d,_0x31c4f5){return db[_0x874c('0x2b')][_0x874c('0x4a')](_0x2ac65d[_0x874c('0x4b')],{})[_0x874c('0x23')](function(_0x54131a){var _0x34b65d=_0x2ac65d[_0x874c('0x4c')][_0x874c('0x4d')]({'plain':!![]});if(!_0x34b65d)throw new Error(_0x874c('0x4e'));if(_0x34b65d[_0x874c('0x4f')]===_0x874c('0x4c')){var _0x475076=_0x54131a[_0x874c('0x4d')]({'plain':!![]});var _0x486d78='CmContactHasItems';return db[_0x874c('0x50')][_0x874c('0x49')]({'where':{'name':_0x486d78,'userProfileId':_0x34b65d[_0x874c('0x51')]},'raw':!![]})['then'](function(_0x4126b5){if(_0x4126b5&&_0x4126b5[_0x874c('0x52')]===0x0){return db[_0x874c('0x26')][_0x874c('0x4a')]({'name':_0x475076['name'],'resourceId':_0x475076['id'],'type':_0x4126b5[_0x874c('0x28')],'sectionId':_0x4126b5['id']},{})[_0x874c('0x23')](function(){return _0x54131a;});}else{return _0x54131a;}})[_0x874c('0x45')](function(_0xb2b62c){logger[_0x874c('0x53')](_0x874c('0x54'),_0xb2b62c);throw _0xb2b62c;});}return _0x54131a;})[_0x874c('0x23')](respondWithResult(_0x31c4f5,0xc9))['catch'](handleError(_0x31c4f5,null));};exports[_0x874c('0x22')]=function(_0x2772d7,_0x211a07){if(_0x2772d7[_0x874c('0x4b')]['id']){delete _0x2772d7[_0x874c('0x4b')]['id'];}return db[_0x874c('0x2b')][_0x874c('0x49')]({'where':{'id':_0x2772d7[_0x874c('0x47')]['id']}})[_0x874c('0x23')](handleEntityNotFound(_0x211a07,null))['then'](saveUpdates(_0x2772d7[_0x874c('0x4b')],null))[_0x874c('0x23')](respondWithResult(_0x211a07,null))[_0x874c('0x45')](handleError(_0x211a07,null));};exports[_0x874c('0x24')]=function(_0x26f666,_0x356dbe){return db[_0x874c('0x2b')][_0x874c('0x49')]({'where':{'id':_0x26f666['params']['id']}})[_0x874c('0x23')](handleEntityNotFound(_0x356dbe,null))[_0x874c('0x23')](removeEntity(_0x356dbe,null))[_0x874c('0x45')](handleError(_0x356dbe,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 60cc640..a3e1564 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 _0xb633=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util'];(function(_0x4722a4,_0x1c710e){var _0x9e8608=function(_0x1738ec){while(--_0x1738ec){_0x4722a4['push'](_0x4722a4['shift']());}};_0x9e8608(++_0x1c710e);}(_0xb633,0x1be));var _0x3b63=function(_0x3c82e2,_0x2bff81){_0x3c82e2=_0x3c82e2-0x0;var _0x1317b8=_0xb633[_0x3c82e2];return _0x1317b8;};'use strict';var _=require(_0x3b63('0x0'));var util=require(_0x3b63('0x1'));var logger=require(_0x3b63('0x2'))(_0x3b63('0x3'));var moment=require(_0x3b63('0x4'));var BPromise=require('bluebird');var rp=require(_0x3b63('0x5'));var fs=require('fs');var path=require(_0x3b63('0x6'));var rimraf=require(_0x3b63('0x7'));var config=require(_0x3b63('0x8'));var attributes=require(_0x3b63('0x9'));module[_0x3b63('0xa')]=function(_0x5608ba,_0x3151b5){return _0x5608ba[_0x3b63('0xb')](_0x3b63('0xc'),attributes,{'tableName':_0x3b63('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69a2=['cm_contact_has_items','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem'];(function(_0x4b2892,_0x5546b2){var _0x34aaac=function(_0x30d6ab){while(--_0x30d6ab){_0x4b2892['push'](_0x4b2892['shift']());}};_0x34aaac(++_0x5546b2);}(_0x69a2,0x1a1));var _0x269a=function(_0x1baa21,_0x4aed8b){_0x1baa21=_0x1baa21-0x0;var _0x3c3057=_0x69a2[_0x1baa21];return _0x3c3057;};'use strict';var _=require(_0x269a('0x0'));var util=require('util');var logger=require(_0x269a('0x1'))(_0x269a('0x2'));var moment=require(_0x269a('0x3'));var BPromise=require(_0x269a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x269a('0x5'));var rimraf=require(_0x269a('0x6'));var config=require(_0x269a('0x7'));var attributes=require(_0x269a('0x8'));module[_0x269a('0x9')]=function(_0x20f512,_0x592a71){return _0x20f512[_0x269a('0xa')](_0x269a('0xb'),attributes,{'tableName':_0x269a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 6a21114..5a01373 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 _0x7e8b=['message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','debug','stringify','error'];(function(_0x900f17,_0xd94723){var _0x37261d=function(_0x3f21b0){while(--_0x3f21b0){_0x900f17['push'](_0x900f17['shift']());}};_0x37261d(++_0xd94723);}(_0x7e8b,0x174));var _0xb7e8=function(_0x40e39f,_0x13396a){_0x40e39f=_0x40e39f-0x0;var _0x5166bc=_0x7e8b[_0x40e39f];return _0x5166bc;};'use strict';var _=require(_0xb7e8('0x0'));var util=require(_0xb7e8('0x1'));var moment=require(_0xb7e8('0x2'));var BPromise=require('bluebird');var rs=require(_0xb7e8('0x3'));var fs=require('fs');var Redis=require(_0xb7e8('0x4'));var db=require(_0xb7e8('0x5'))['db'];var utils=require(_0xb7e8('0x6'));var logger=require(_0xb7e8('0x7'))(_0xb7e8('0x8'));var config=require('../../config/environment');var jayson=require(_0xb7e8('0x9'));var client=jayson[_0xb7e8('0xa')][_0xb7e8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x557ee4,_0x1a37e4,_0x1a6d7f){return new BPromise(function(_0x4461c5,_0x2d3829){return client[_0xb7e8('0xc')](_0x557ee4,_0x1a6d7f)[_0xb7e8('0xd')](function(_0xe23f21){logger[_0xb7e8('0xe')](_0xb7e8('0xf'),_0x1a37e4,'request\x20sent');logger[_0xb7e8('0x10')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x1a37e4,'request\x20sent',JSON[_0xb7e8('0x11')](_0xe23f21));if(_0xe23f21[_0xb7e8('0x12')]){if(_0xe23f21[_0xb7e8('0x12')]['code']===0x1f4){logger['error'](_0xb7e8('0xf'),_0x1a37e4,_0xe23f21[_0xb7e8('0x12')][_0xb7e8('0x13')]);return _0x2d3829(_0xe23f21[_0xb7e8('0x12')]['message']);}logger['error'](_0xb7e8('0xf'),_0x1a37e4,_0xe23f21[_0xb7e8('0x12')]['message']);return _0x4461c5(_0xe23f21['error'][_0xb7e8('0x13')]);}else{logger[_0xb7e8('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x1a37e4,_0xb7e8('0x14'));_0x4461c5(_0xe23f21[_0xb7e8('0x15')][_0xb7e8('0x13')]);}})[_0xb7e8('0x16')](function(_0x96f812){logger[_0xb7e8('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x1a37e4,_0x96f812);_0x2d3829(_0x96f812);});});} \ No newline at end of file +var _0xc155=['code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x436985,_0x2e7f0b){var _0x2a8d4d=function(_0x9aadd4){while(--_0x9aadd4){_0x436985['push'](_0x436985['shift']());}};_0x2a8d4d(++_0x2e7f0b);}(_0xc155,0xa1));var _0x5c15=function(_0x5992ac,_0x2253b0){_0x5992ac=_0x5992ac-0x0;var _0x540bba=_0xc155[_0x5992ac];return _0x540bba;};'use strict';var _=require(_0x5c15('0x0'));var util=require('util');var moment=require(_0x5c15('0x1'));var BPromise=require(_0x5c15('0x2'));var rs=require(_0x5c15('0x3'));var fs=require('fs');var Redis=require(_0x5c15('0x4'));var db=require(_0x5c15('0x5'))['db'];var utils=require(_0x5c15('0x6'));var logger=require(_0x5c15('0x7'))(_0x5c15('0x8'));var config=require(_0x5c15('0x9'));var jayson=require(_0x5c15('0xa'));var client=jayson[_0x5c15('0xb')][_0x5c15('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x586889,_0x4ae624,_0x580283){return new BPromise(function(_0x3104e6,_0x463f0b){return client[_0x5c15('0xd')](_0x586889,_0x580283)[_0x5c15('0xe')](function(_0x462811){logger['info'](_0x5c15('0xf'),_0x4ae624,_0x5c15('0x10'));logger[_0x5c15('0x11')](_0x5c15('0x12'),_0x4ae624,_0x5c15('0x10'),JSON[_0x5c15('0x13')](_0x462811));if(_0x462811[_0x5c15('0x14')]){if(_0x462811['error'][_0x5c15('0x15')]===0x1f4){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x4ae624,_0x462811['error'][_0x5c15('0x16')]);return _0x463f0b(_0x462811[_0x5c15('0x14')][_0x5c15('0x16')]);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x4ae624,_0x462811[_0x5c15('0x14')][_0x5c15('0x16')]);return _0x3104e6(_0x462811['error']['message']);}else{logger[_0x5c15('0x17')](_0x5c15('0xf'),_0x4ae624,_0x5c15('0x10'));_0x3104e6(_0x462811[_0x5c15('0x18')][_0x5c15('0x16')]);}})[_0x5c15('0x19')](function(_0x4f35dd){logger['error'](_0x5c15('0xf'),_0x4ae624,_0x4f35dd);_0x463f0b(_0x4f35dd);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index e7fe934..7a4b596 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 _0x40e5=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','show','post','create','put','/:id','update'];(function(_0x642f78,_0x46eefe){var _0x2c31ff=function(_0x4f1faf){while(--_0x4f1faf){_0x642f78['push'](_0x642f78['shift']());}};_0x2c31ff(++_0x46eefe);}(_0x40e5,0x12f));var _0x540e=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x40e5[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require(_0x540e('0x0'));var util=require(_0x540e('0x1'));var path=require('path');var timeout=require(_0x540e('0x2'));var express=require(_0x540e('0x3'));var router=express[_0x540e('0x4')]();var fs_extra=require(_0x540e('0x5'));var auth=require(_0x540e('0x6'));var interaction=require(_0x540e('0x7'));var config=require(_0x540e('0x8'));var controller=require(_0x540e('0x9'));router['get']('/',auth[_0x540e('0xa')](),controller['index']);router['get']('/:id',auth[_0x540e('0xa')](),controller[_0x540e('0xb')]);router[_0x540e('0xc')]('/',auth[_0x540e('0xa')](),controller[_0x540e('0xd')]);router[_0x540e('0xe')](_0x540e('0xf'),auth[_0x540e('0xa')](),controller[_0x540e('0x10')]);router[_0x540e('0x11')]('/:id',auth[_0x540e('0xa')](),controller[_0x540e('0x12')]);module[_0x540e('0x13')]=router; \ No newline at end of file +var _0xbaf4=['update','/:id','destroy','exports','multer','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','isAuthenticated','index','get','post','create','put'];(function(_0x1563bc,_0x5e29bd){var _0xcf61a7=function(_0x3c0a2f){while(--_0x3c0a2f){_0x1563bc['push'](_0x1563bc['shift']());}};_0xcf61a7(++_0x5e29bd);}(_0xbaf4,0x13f));var _0x4baf=function(_0x47c36f,_0x2cae4f){_0x47c36f=_0x47c36f-0x0;var _0x54ad58=_0xbaf4[_0x47c36f];return _0x54ad58;};'use strict';var multer=require(_0x4baf('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4baf('0x1'));var auth=require(_0x4baf('0x2'));var interaction=require(_0x4baf('0x3'));var config=require('../../config/environment');var controller=require(_0x4baf('0x4'));router['get']('/',auth[_0x4baf('0x5')](),controller[_0x4baf('0x6')]);router[_0x4baf('0x7')]('/:id',auth[_0x4baf('0x5')](),controller['show']);router[_0x4baf('0x8')]('/',auth[_0x4baf('0x5')](),controller[_0x4baf('0x9')]);router[_0x4baf('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4baf('0xb')]);router['delete'](_0x4baf('0xc'),auth[_0x4baf('0x5')](),controller[_0x4baf('0xd')]);module[_0x4baf('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 648433b..66adf8d 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 _0xe775=['sequelize','VIRTUAL','getDataValue','alias','STRING','TEXT','long','type','select','values','isArray','setDataValue','stringify','BOOLEAN','ENUM'];(function(_0x324f7d,_0x3a0184){var _0x158d1e=function(_0x460f99){while(--_0x460f99){_0x324f7d['push'](_0x324f7d['shift']());}};_0x158d1e(++_0x3a0184);}(_0xe775,0x13b));var _0x5e77=function(_0x25fa5c,_0x421141){_0x25fa5c=_0x25fa5c-0x0;var _0x1bade2=_0xe775[_0x25fa5c];return _0x1bade2;};'use strict';var Sequelize=require(_0x5e77('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x5e77('0x1')],'get':function(_0x3a0174){return this[_0x5e77('0x2')](_0x5e77('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x1b74be){this['setDataValue'](_0x5e77('0x3'),_0x1b74be?_0x1b74be:this[_0x5e77('0x2')]('name'));}},'type':{'type':Sequelize[_0x5e77('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x5e77('0x5')](_0x5e77('0x6')),'get':function(){if(this[_0x5e77('0x2')](_0x5e77('0x7'))===_0x5e77('0x8')){return JSON['parse'](this[_0x5e77('0x2')](_0x5e77('0x9')));}else{return this[_0x5e77('0x2')](_0x5e77('0x9'));}},'set':function(_0x4e089d){if(Array[_0x5e77('0xa')](_0x4e089d)){this[_0x5e77('0xb')](_0x5e77('0x9'),JSON[_0x5e77('0xc')](_0x4e089d));}else{this[_0x5e77('0xb')]('values',_0x4e089d);}}},'required':{'type':Sequelize[_0x5e77('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x5e77('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x5e77('0xe')]('voice')}}; \ No newline at end of file +var _0xf128=['sequelize','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','type','select','parse','values','isArray','BOOLEAN','ENUM'];(function(_0x4364eb,_0x53842f){var _0x43725e=function(_0x1714af){while(--_0x1714af){_0x4364eb['push'](_0x4364eb['shift']());}};_0x43725e(++_0x53842f);}(_0xf128,0x198));var _0x8f12=function(_0x4ff120,_0x30ee0b){_0x4ff120=_0x4ff120-0x0;var _0x1a8437=_0xf128[_0x4ff120];return _0x1a8437;};'use strict';var Sequelize=require(_0x8f12('0x0'));var _=require(_0x8f12('0x1'));module[_0x8f12('0x2')]={'name':{'type':Sequelize[_0x8f12('0x3')],'get':function(_0x5ac201){return this[_0x8f12('0x4')](_0x8f12('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x21e5c0){this[_0x8f12('0x6')](_0x8f12('0x5'),_0x21e5c0?_0x21e5c0:this[_0x8f12('0x4')](_0x8f12('0x7')));}},'type':{'type':Sequelize[_0x8f12('0x8')],'allowNull':![]},'values':{'type':Sequelize[_0x8f12('0x9')]('long'),'get':function(){if(this[_0x8f12('0x4')](_0x8f12('0xa'))===_0x8f12('0xb')){return JSON[_0x8f12('0xc')](this[_0x8f12('0x4')](_0x8f12('0xd')));}else{return this[_0x8f12('0x4')](_0x8f12('0xd'));}},'set':function(_0x2d6377){if(Array[_0x8f12('0xe')](_0x2d6377)){this[_0x8f12('0x6')]('values',JSON['stringify'](_0x2d6377));}else{this['setDataValue'](_0x8f12('0xd'),_0x2d6377);}}},'required':{'type':Sequelize[_0x8f12('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x8f12('0x10')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index caa2cec..eae3ae4 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 _0xf0c2=['rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','VIRTUAL','merge','where','CmCustomField','includeAll','include','findAll','rows','show','length','options','find','catch','body','params','create','transaction','Sequelize','TEXT','number','switch','BOOLEAN','defaultValue','sequelize','queryInterface','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','stack','name','send','map'];(function(_0x5524a1,_0x37c171){var _0x4ea5e3=function(_0x493ee1){while(--_0x493ee1){_0x5524a1['push'](_0x5524a1['shift']());}};_0x4ea5e3(++_0x37c171);}(_0xf0c2,0x86));var _0x2f0c=function(_0x9f6f09,_0x10b75e){_0x9f6f09=_0x9f6f09-0x0;var _0x2c352f=_0xf0c2[_0x9f6f09];return _0x2c352f;};'use strict';var emlformat=require(_0x2f0c('0x0'));var rimraf=require(_0x2f0c('0x1'));var zipdir=require(_0x2f0c('0x2'));var jsonpatch=require(_0x2f0c('0x3'));var rp=require('request-promise');var moment=require(_0x2f0c('0x4'));var BPromise=require(_0x2f0c('0x5'));var Mustache=require(_0x2f0c('0x6'));var util=require(_0x2f0c('0x7'));var path=require(_0x2f0c('0x8'));var sox=require(_0x2f0c('0x9'));var csv=require(_0x2f0c('0xa'));var ejs=require(_0x2f0c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f0c('0xc'));var squel=require(_0x2f0c('0xd'));var crypto=require(_0x2f0c('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2f0c('0xa'));var querystring=require(_0x2f0c('0xf'));var Papa=require(_0x2f0c('0x10'));var Redis=require(_0x2f0c('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2f0c('0x12'));var hardwareService=require(_0x2f0c('0x13'));var logger=require(_0x2f0c('0x14'))('api');var utils=require(_0x2f0c('0x15'));var config=require(_0x2f0c('0x16'));var licenseUtil=require(_0x2f0c('0x17'));var db=require(_0x2f0c('0x18'))['db'];function respondWithStatusCode(_0x44f2b2,_0x4c6a59){_0x4c6a59=_0x4c6a59||0xcc;return function(_0x4a60a9){if(_0x4a60a9){return _0x44f2b2[_0x2f0c('0x19')](_0x4c6a59);}return _0x44f2b2['status'](_0x4c6a59)[_0x2f0c('0x1a')]();};}function respondWithResult(_0x22af4c,_0x49295d){_0x49295d=_0x49295d||0xc8;return function(_0x1ded2c){if(_0x1ded2c){return _0x22af4c[_0x2f0c('0x1b')](_0x49295d)['json'](_0x1ded2c);}};}function respondWithFilteredResult(_0x4341b2,_0x1d2efb){return function(_0x38a474){if(_0x38a474){var _0x588e62=typeof _0x1d2efb['offset']===_0x2f0c('0x1c')&&typeof _0x1d2efb[_0x2f0c('0x1d')]==='undefined';var _0x267fd7=_0x38a474[_0x2f0c('0x1e')];var _0x4505c5=_0x588e62?0x0:_0x1d2efb[_0x2f0c('0x1f')];var _0x50ea58=_0x588e62?_0x38a474['count']:_0x1d2efb[_0x2f0c('0x1f')]+_0x1d2efb['limit'];var _0x1c3e97;if(_0x50ea58>=_0x267fd7){_0x50ea58=_0x267fd7;_0x1c3e97=0xc8;}else{_0x1c3e97=0xce;}_0x4341b2[_0x2f0c('0x1b')](_0x1c3e97);return _0x4341b2[_0x2f0c('0x20')](_0x2f0c('0x21'),_0x4505c5+'-'+_0x50ea58+'/'+_0x267fd7)[_0x2f0c('0x22')](_0x38a474);}return null;};}function patchUpdates(_0x113fb1){return function(_0x1d9e06){try{jsonpatch['apply'](_0x1d9e06,_0x113fb1,!![]);}catch(_0x15339e){return BPromise[_0x2f0c('0x23')](_0x15339e);}return _0x1d9e06[_0x2f0c('0x24')]();};}function saveUpdates(_0x4ed950,_0x1fdcff){return function(_0x59634e){if(_0x59634e){return _0x59634e[_0x2f0c('0x25')](_0x4ed950)[_0x2f0c('0x26')](function(_0x1d32a9){return _0x1d32a9;});}return null;};}function removeEntity(_0x309d2d,_0x370f12){return function(_0x53c565){if(_0x53c565){return _0x53c565[_0x2f0c('0x27')]()[_0x2f0c('0x26')](function(){_0x309d2d['status'](0xcc)[_0x2f0c('0x1a')]();});}};}function handleEntityNotFound(_0x494861,_0xee56ef){return function(_0x5d15c8){if(!_0x5d15c8){_0x494861[_0x2f0c('0x19')](0x194);}return _0x5d15c8;};}function handleError(_0x471949,_0x26eedb){_0x26eedb=_0x26eedb||0x1f4;return function(_0x59a94e){logger['error'](_0x59a94e[_0x2f0c('0x28')]);if(_0x59a94e['name']){delete _0x59a94e[_0x2f0c('0x29')];}_0x471949[_0x2f0c('0x1b')](_0x26eedb)[_0x2f0c('0x2a')](_0x59a94e);};}exports['index']=function(_0x5c41a2,_0x250f63){var _0x4e78fd={},_0x3fb495={},_0xce5537={'count':0x0,'rows':[]};var _0x58fa41=_[_0x2f0c('0x2b')](db['CmCustomField'][_0x2f0c('0x2c')],function(_0x3ceb61){return{'name':_0x3ceb61[_0x2f0c('0x2d')],'type':_0x3ceb61[_0x2f0c('0x2e')][_0x2f0c('0x2f')]};});_0x3fb495[_0x2f0c('0x30')]=_[_0x2f0c('0x31')](_[_0x2f0c('0x2b')](_0x58fa41,_0x2f0c('0x29')),['name']);_0x3fb495[_0x2f0c('0x32')]=_[_0x2f0c('0x33')](_0x5c41a2[_0x2f0c('0x32')]);_0x3fb495[_0x2f0c('0x34')]=_['intersection'](_0x3fb495[_0x2f0c('0x30')],_0x3fb495['query']);_0x4e78fd['attributes']=_[_0x2f0c('0x35')](_0x3fb495[_0x2f0c('0x30')],qs[_0x2f0c('0x36')](_0x5c41a2[_0x2f0c('0x32')]['fields']));_0x4e78fd[_0x2f0c('0x37')]=_0x4e78fd[_0x2f0c('0x37')]['length']?_0x4e78fd[_0x2f0c('0x37')]:_0x3fb495[_0x2f0c('0x30')];if(!_0x5c41a2[_0x2f0c('0x32')][_0x2f0c('0x38')](_0x2f0c('0x39'))){_0x4e78fd[_0x2f0c('0x1d')]=qs[_0x2f0c('0x1d')](_0x5c41a2[_0x2f0c('0x32')][_0x2f0c('0x1d')]);_0x4e78fd[_0x2f0c('0x1f')]=qs[_0x2f0c('0x1f')](_0x5c41a2[_0x2f0c('0x32')]['offset']);}_0x4e78fd['order']=qs[_0x2f0c('0x3a')](_0x5c41a2[_0x2f0c('0x32')]['sort']);_0x4e78fd['where']=qs['filters'](_[_0x2f0c('0x3b')](_0x5c41a2[_0x2f0c('0x32')],_0x3fb495[_0x2f0c('0x34')]),_0x58fa41);if(_0x5c41a2['query'][_0x2f0c('0x3c')]){_0x4e78fd['where']=_['merge'](_0x4e78fd['where'],{'$or':_[_0x2f0c('0x2b')](_0x58fa41,function(_0x41dec1){if(_0x41dec1[_0x2f0c('0x2e')]!==_0x2f0c('0x3d')){var _0x4d42bd={};_0x4d42bd[_0x41dec1['name']]={'$like':'%'+_0x5c41a2[_0x2f0c('0x32')][_0x2f0c('0x3c')]+'%'};return _0x4d42bd;}})});}_0x4e78fd=_[_0x2f0c('0x3e')]({},_0x4e78fd,_0x5c41a2['options']);var _0x22e2cb={'where':_0x4e78fd[_0x2f0c('0x3f')]};return db[_0x2f0c('0x40')]['count'](_0x22e2cb)['then'](function(_0x580de0){_0xce5537[_0x2f0c('0x1e')]=_0x580de0;if(_0x5c41a2[_0x2f0c('0x32')][_0x2f0c('0x41')]){_0x4e78fd[_0x2f0c('0x42')]=[{'all':!![]}];}return db[_0x2f0c('0x40')][_0x2f0c('0x43')](_0x4e78fd);})['then'](function(_0x49db7b){_0xce5537[_0x2f0c('0x44')]=_0x49db7b;return _0xce5537;})[_0x2f0c('0x26')](respondWithFilteredResult(_0x250f63,_0x4e78fd))['catch'](handleError(_0x250f63,null));};exports[_0x2f0c('0x45')]=function(_0x3db3f5,_0x5b1590){var _0x238d1d={'raw':!![],'where':{'id':_0x3db3f5['params']['id']}},_0x3c8fec={};_0x3c8fec[_0x2f0c('0x30')]=_[_0x2f0c('0x33')](db['CmCustomField'][_0x2f0c('0x2c')]);_0x3c8fec['query']=_['keys'](_0x3db3f5[_0x2f0c('0x32')]);_0x3c8fec[_0x2f0c('0x34')]=_[_0x2f0c('0x35')](_0x3c8fec[_0x2f0c('0x30')],_0x3c8fec[_0x2f0c('0x32')]);_0x238d1d[_0x2f0c('0x37')]=_[_0x2f0c('0x35')](_0x3c8fec[_0x2f0c('0x30')],qs['fields'](_0x3db3f5[_0x2f0c('0x32')]['fields']));_0x238d1d[_0x2f0c('0x37')]=_0x238d1d[_0x2f0c('0x37')][_0x2f0c('0x46')]?_0x238d1d[_0x2f0c('0x37')]:_0x3c8fec[_0x2f0c('0x30')];if(_0x3db3f5[_0x2f0c('0x32')][_0x2f0c('0x41')]){_0x238d1d[_0x2f0c('0x42')]=[{'all':!![]}];}_0x238d1d=_[_0x2f0c('0x3e')]({},_0x238d1d,_0x3db3f5[_0x2f0c('0x47')]);return db['CmCustomField'][_0x2f0c('0x48')](_0x238d1d)['then'](handleEntityNotFound(_0x5b1590,null))['then'](respondWithResult(_0x5b1590,null))[_0x2f0c('0x49')](handleError(_0x5b1590,null));};exports[_0x2f0c('0x25')]=function(_0x420683,_0x15b982){if(_0x420683[_0x2f0c('0x4a')]['id']){delete _0x420683[_0x2f0c('0x4a')]['id'];}return db[_0x2f0c('0x40')]['find']({'where':{'id':_0x420683['params']['id']}})[_0x2f0c('0x26')](handleEntityNotFound(_0x15b982,null))['then'](saveUpdates(_0x420683[_0x2f0c('0x4a')],null))['then'](respondWithResult(_0x15b982,null))['catch'](handleError(_0x15b982,null));};exports[_0x2f0c('0x27')]=function(_0x423f34,_0x24855a){return db[_0x2f0c('0x40')][_0x2f0c('0x48')]({'where':{'id':_0x423f34[_0x2f0c('0x4b')]['id']}})[_0x2f0c('0x26')](handleEntityNotFound(_0x24855a,null))[_0x2f0c('0x26')](removeEntity(_0x24855a,null))[_0x2f0c('0x49')](handleError(_0x24855a,null));};exports[_0x2f0c('0x4c')]=function(_0x57d2ee,_0x5cf40e){var _0x2d0035;return db['sequelize'][_0x2f0c('0x4d')](function(_0x2d0f2c){return db[_0x2f0c('0x40')]['create'](_0x57d2ee[_0x2f0c('0x4a')],{'transaction':_0x2d0f2c})[_0x2f0c('0x26')](function(_0x4c0bcc){_0x2d0035=_0x4c0bcc;var _0x1d9ce6={'type':db[_0x2f0c('0x4e')][_0x2f0c('0x4f')],'transaction':_0x2d0f2c};switch(_0x57d2ee[_0x2f0c('0x4a')][_0x2f0c('0x2e')]){case'text':_0x1d9ce6[_0x2f0c('0x2e')]=db[_0x2f0c('0x4e')]['TEXT'];break;case _0x2f0c('0x50'):_0x1d9ce6[_0x2f0c('0x2e')]=db[_0x2f0c('0x4e')]['INTEGER'];break;case _0x2f0c('0x51'):_0x1d9ce6[_0x2f0c('0x2e')]=db[_0x2f0c('0x4e')][_0x2f0c('0x52')];_0x1d9ce6[_0x2f0c('0x53')]=![];break;default:}return db[_0x2f0c('0x54')][_0x2f0c('0x55')]['addColumn'](_0x2f0c('0x56'),util[_0x2f0c('0x57')](_0x2f0c('0x58'),_0x2d0035['id']),_0x1d9ce6);})['then'](function(){return _0x2d0035;});})['then'](respondWithResult(_0x5cf40e,0xc9))[_0x2f0c('0x49')](handleError(_0x5cf40e,null));}; \ No newline at end of file +var _0xc75c=['name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','body','find','params','sequelize','create','Sequelize','text','TEXT','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','update','then','destroy','stack'];(function(_0x56641c,_0x4d0ee3){var _0x3e6270=function(_0x2ce371){while(--_0x2ce371){_0x56641c['push'](_0x56641c['shift']());}};_0x3e6270(++_0x4d0ee3);}(_0xc75c,0x11b));var _0xcc75=function(_0xf1f37e,_0x159a20){_0xf1f37e=_0xf1f37e-0x0;var _0x2e3a6d=_0xc75c[_0xf1f37e];return _0x2e3a6d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc75('0x0'));var zipdir=require(_0xcc75('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc75('0x2'));var moment=require(_0xcc75('0x3'));var BPromise=require(_0xcc75('0x4'));var Mustache=require(_0xcc75('0x5'));var util=require(_0xcc75('0x6'));var path=require(_0xcc75('0x7'));var sox=require(_0xcc75('0x8'));var csv=require(_0xcc75('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc75('0xa'));var squel=require('squel');var crypto=require(_0xcc75('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcc75('0xc'));var toCsv=require(_0xcc75('0x9'));var querystring=require(_0xcc75('0xd'));var Papa=require('papaparse');var Redis=require(_0xcc75('0xe'));var authService=require(_0xcc75('0xf'));var qs=require(_0xcc75('0x10'));var as=require(_0xcc75('0x11'));var hardwareService=require(_0xcc75('0x12'));var logger=require(_0xcc75('0x13'))(_0xcc75('0x14'));var utils=require(_0xcc75('0x15'));var config=require(_0xcc75('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc75('0x17'))['db'];function respondWithStatusCode(_0x54def0,_0x115485){_0x115485=_0x115485||0xcc;return function(_0x3b5c7c){if(_0x3b5c7c){return _0x54def0[_0xcc75('0x18')](_0x115485);}return _0x54def0[_0xcc75('0x19')](_0x115485)[_0xcc75('0x1a')]();};}function respondWithResult(_0x5c41b4,_0x9b8949){_0x9b8949=_0x9b8949||0xc8;return function(_0x3efcde){if(_0x3efcde){return _0x5c41b4[_0xcc75('0x19')](_0x9b8949)['json'](_0x3efcde);}};}function respondWithFilteredResult(_0x560e1a,_0x3cf88){return function(_0x35e38f){if(_0x35e38f){var _0x4f0a35=typeof _0x3cf88[_0xcc75('0x1b')]===_0xcc75('0x1c')&&typeof _0x3cf88[_0xcc75('0x1d')]===_0xcc75('0x1c');var _0x5d5379=_0x35e38f[_0xcc75('0x1e')];var _0x2459ef=_0x4f0a35?0x0:_0x3cf88[_0xcc75('0x1b')];var _0x2aeaf9=_0x4f0a35?_0x35e38f[_0xcc75('0x1e')]:_0x3cf88[_0xcc75('0x1b')]+_0x3cf88[_0xcc75('0x1d')];var _0x4d8ea7;if(_0x2aeaf9>=_0x5d5379){_0x2aeaf9=_0x5d5379;_0x4d8ea7=0xc8;}else{_0x4d8ea7=0xce;}_0x560e1a[_0xcc75('0x19')](_0x4d8ea7);return _0x560e1a['set']('Content-Range',_0x2459ef+'-'+_0x2aeaf9+'/'+_0x5d5379)[_0xcc75('0x1f')](_0x35e38f);}return null;};}function patchUpdates(_0x453918){return function(_0x4f05fa){try{jsonpatch[_0xcc75('0x20')](_0x4f05fa,_0x453918,!![]);}catch(_0x3bb6e6){return BPromise['reject'](_0x3bb6e6);}return _0x4f05fa['save']();};}function saveUpdates(_0x37329e,_0x3690dc){return function(_0x2f3014){if(_0x2f3014){return _0x2f3014[_0xcc75('0x21')](_0x37329e)[_0xcc75('0x22')](function(_0x229ed4){return _0x229ed4;});}return null;};}function removeEntity(_0x229738,_0x1822bb){return function(_0x188642){if(_0x188642){return _0x188642[_0xcc75('0x23')]()[_0xcc75('0x22')](function(){_0x229738[_0xcc75('0x19')](0xcc)[_0xcc75('0x1a')]();});}};}function handleEntityNotFound(_0x160d37,_0x2f03a2){return function(_0x4a6420){if(!_0x4a6420){_0x160d37[_0xcc75('0x18')](0x194);}return _0x4a6420;};}function handleError(_0x1ee12b,_0x52863f){_0x52863f=_0x52863f||0x1f4;return function(_0x41ab60){logger['error'](_0x41ab60[_0xcc75('0x24')]);if(_0x41ab60[_0xcc75('0x25')]){delete _0x41ab60[_0xcc75('0x25')];}_0x1ee12b['status'](_0x52863f)[_0xcc75('0x26')](_0x41ab60);};}exports[_0xcc75('0x27')]=function(_0x3d5414,_0x546663){var _0x222be4={},_0x9fcdca={},_0x2033e0={'count':0x0,'rows':[]};var _0xaaa0d1=_[_0xcc75('0x28')](db[_0xcc75('0x29')][_0xcc75('0x2a')],function(_0x36b3ce){return{'name':_0x36b3ce[_0xcc75('0x2b')],'type':_0x36b3ce[_0xcc75('0x2c')][_0xcc75('0x2d')]};});_0x9fcdca[_0xcc75('0x2e')]=_['differenceBy'](_[_0xcc75('0x28')](_0xaaa0d1,_0xcc75('0x25')),[_0xcc75('0x25')]);_0x9fcdca['query']=_['keys'](_0x3d5414['query']);_0x9fcdca[_0xcc75('0x2f')]=_[_0xcc75('0x30')](_0x9fcdca['model'],_0x9fcdca[_0xcc75('0x31')]);_0x222be4[_0xcc75('0x32')]=_[_0xcc75('0x30')](_0x9fcdca[_0xcc75('0x2e')],qs['fields'](_0x3d5414[_0xcc75('0x31')][_0xcc75('0x33')]));_0x222be4[_0xcc75('0x32')]=_0x222be4[_0xcc75('0x32')]['length']?_0x222be4[_0xcc75('0x32')]:_0x9fcdca['model'];if(!_0x3d5414['query']['hasOwnProperty']('nolimit')){_0x222be4[_0xcc75('0x1d')]=qs['limit'](_0x3d5414['query'][_0xcc75('0x1d')]);_0x222be4['offset']=qs[_0xcc75('0x1b')](_0x3d5414['query'][_0xcc75('0x1b')]);}_0x222be4[_0xcc75('0x34')]=qs[_0xcc75('0x35')](_0x3d5414[_0xcc75('0x31')][_0xcc75('0x35')]);_0x222be4[_0xcc75('0x36')]=qs[_0xcc75('0x2f')](_['pick'](_0x3d5414['query'],_0x9fcdca[_0xcc75('0x2f')]),_0xaaa0d1);if(_0x3d5414['query'][_0xcc75('0x37')]){_0x222be4[_0xcc75('0x36')]=_[_0xcc75('0x38')](_0x222be4['where'],{'$or':_['map'](_0xaaa0d1,function(_0x301c35){if(_0x301c35['type']!==_0xcc75('0x39')){var _0x128863={};_0x128863[_0x301c35[_0xcc75('0x25')]]={'$like':'%'+_0x3d5414['query'][_0xcc75('0x37')]+'%'};return _0x128863;}})});}_0x222be4=_[_0xcc75('0x38')]({},_0x222be4,_0x3d5414[_0xcc75('0x3a')]);var _0x1f69bc={'where':_0x222be4[_0xcc75('0x36')]};return db[_0xcc75('0x29')][_0xcc75('0x1e')](_0x1f69bc)[_0xcc75('0x22')](function(_0x180304){_0x2033e0['count']=_0x180304;if(_0x3d5414[_0xcc75('0x31')][_0xcc75('0x3b')]){_0x222be4[_0xcc75('0x3c')]=[{'all':!![]}];}return db[_0xcc75('0x29')][_0xcc75('0x3d')](_0x222be4);})[_0xcc75('0x22')](function(_0x4767b3){_0x2033e0[_0xcc75('0x3e')]=_0x4767b3;return _0x2033e0;})[_0xcc75('0x22')](respondWithFilteredResult(_0x546663,_0x222be4))[_0xcc75('0x3f')](handleError(_0x546663,null));};exports['show']=function(_0x478c4b,_0x321de1){var _0x27b0fa={'raw':!![],'where':{'id':_0x478c4b['params']['id']}},_0x2ff845={};_0x2ff845[_0xcc75('0x2e')]=_[_0xcc75('0x40')](db[_0xcc75('0x29')][_0xcc75('0x2a')]);_0x2ff845['query']=_[_0xcc75('0x40')](_0x478c4b['query']);_0x2ff845[_0xcc75('0x2f')]=_[_0xcc75('0x30')](_0x2ff845[_0xcc75('0x2e')],_0x2ff845['query']);_0x27b0fa['attributes']=_['intersection'](_0x2ff845['model'],qs[_0xcc75('0x33')](_0x478c4b['query'][_0xcc75('0x33')]));_0x27b0fa[_0xcc75('0x32')]=_0x27b0fa[_0xcc75('0x32')]['length']?_0x27b0fa[_0xcc75('0x32')]:_0x2ff845[_0xcc75('0x2e')];if(_0x478c4b[_0xcc75('0x31')]['includeAll']){_0x27b0fa[_0xcc75('0x3c')]=[{'all':!![]}];}_0x27b0fa=_['merge']({},_0x27b0fa,_0x478c4b[_0xcc75('0x3a')]);return db[_0xcc75('0x29')]['find'](_0x27b0fa)['then'](handleEntityNotFound(_0x321de1,null))[_0xcc75('0x22')](respondWithResult(_0x321de1,null))[_0xcc75('0x3f')](handleError(_0x321de1,null));};exports[_0xcc75('0x21')]=function(_0xc81c84,_0x1336b8){if(_0xc81c84['body']['id']){delete _0xc81c84[_0xcc75('0x41')]['id'];}return db[_0xcc75('0x29')][_0xcc75('0x42')]({'where':{'id':_0xc81c84[_0xcc75('0x43')]['id']}})['then'](handleEntityNotFound(_0x1336b8,null))['then'](saveUpdates(_0xc81c84[_0xcc75('0x41')],null))[_0xcc75('0x22')](respondWithResult(_0x1336b8,null))['catch'](handleError(_0x1336b8,null));};exports[_0xcc75('0x23')]=function(_0x59fd66,_0x4d57eb){return db[_0xcc75('0x29')][_0xcc75('0x42')]({'where':{'id':_0x59fd66[_0xcc75('0x43')]['id']}})[_0xcc75('0x22')](handleEntityNotFound(_0x4d57eb,null))['then'](removeEntity(_0x4d57eb,null))[_0xcc75('0x3f')](handleError(_0x4d57eb,null));};exports['create']=function(_0x226ea7,_0x139009){var _0x24d698;return db[_0xcc75('0x44')]['transaction'](function(_0x3eb389){return db[_0xcc75('0x29')][_0xcc75('0x45')](_0x226ea7['body'],{'transaction':_0x3eb389})[_0xcc75('0x22')](function(_0x20eae0){_0x24d698=_0x20eae0;var _0x13f26d={'type':db[_0xcc75('0x46')]['TEXT'],'transaction':_0x3eb389};switch(_0x226ea7[_0xcc75('0x41')][_0xcc75('0x2c')]){case _0xcc75('0x47'):_0x13f26d[_0xcc75('0x2c')]=db[_0xcc75('0x46')][_0xcc75('0x48')];break;case _0xcc75('0x49'):_0x13f26d[_0xcc75('0x2c')]=db[_0xcc75('0x46')][_0xcc75('0x4a')];break;case'switch':_0x13f26d[_0xcc75('0x2c')]=db[_0xcc75('0x46')][_0xcc75('0x4b')];_0x13f26d[_0xcc75('0x4c')]=![];break;default:}return db['sequelize'][_0xcc75('0x4d')][_0xcc75('0x4e')]('cm_contacts',util[_0xcc75('0x4f')]('cf_%d',_0x24d698['id']),_0x13f26d);})['then'](function(){return _0x24d698;});})[_0xcc75('0x22')](respondWithResult(_0x139009,0xc9))[_0xcc75('0x3f')](handleError(_0x139009,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index fa28958..7c479df 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 _0xeeed=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','lodash','util'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0xeeed,0x143));var _0xdeee=function(_0x2d65c7,_0x1cf341){_0x2d65c7=_0x2d65c7-0x0;var _0xce7ca7=_0xeeed[_0x2d65c7];return _0xce7ca7;};'use strict';var _=require(_0xdeee('0x0'));var util=require(_0xdeee('0x1'));var logger=require('../../config/logger')(_0xdeee('0x2'));var moment=require(_0xdeee('0x3'));var BPromise=require(_0xdeee('0x4'));var rp=require(_0xdeee('0x5'));var fs=require('fs');var path=require(_0xdeee('0x6'));var rimraf=require(_0xdeee('0x7'));var config=require(_0xdeee('0x8'));var attributes=require(_0xdeee('0x9'));module[_0xdeee('0xa')]=function(_0x482371,_0x5a17fb){return _0x482371[_0xdeee('0xb')](_0xdeee('0xc'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6256=['bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','moment'];(function(_0x5db4c4,_0x2a8ced){var _0x5c32a0=function(_0x7b7ee5){while(--_0x7b7ee5){_0x5db4c4['push'](_0x5db4c4['shift']());}};_0x5c32a0(++_0x2a8ced);}(_0x6256,0x17c));var _0x6625=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x6256[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0x6625('0x0'));var util=require(_0x6625('0x1'));var logger=require(_0x6625('0x2'))('api');var moment=require(_0x6625('0x3'));var BPromise=require(_0x6625('0x4'));var rp=require(_0x6625('0x5'));var fs=require('fs');var path=require(_0x6625('0x6'));var rimraf=require('rimraf');var config=require(_0x6625('0x7'));var attributes=require(_0x6625('0x8'));module['exports']=function(_0x2fa55d,_0x59d061){return _0x2fa55d[_0x6625('0x9')](_0x6625('0xa'),attributes,{'tableName':_0x6625('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 4a75507..522f4e5 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 _0x4c58=['error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s'];(function(_0x229128,_0x273558){var _0x1875b9=function(_0x275e35){while(--_0x275e35){_0x229128['push'](_0x229128['shift']());}};_0x1875b9(++_0x273558);}(_0x4c58,0x14e));var _0x84c5=function(_0x296e52,_0x428515){_0x296e52=_0x296e52-0x0;var _0x286070=_0x4c58[_0x296e52];return _0x286070;};'use strict';var _=require(_0x84c5('0x0'));var util=require(_0x84c5('0x1'));var moment=require(_0x84c5('0x2'));var BPromise=require(_0x84c5('0x3'));var rs=require(_0x84c5('0x4'));var fs=require('fs');var Redis=require(_0x84c5('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x84c5('0x6'))(_0x84c5('0x7'));var config=require(_0x84c5('0x8'));var jayson=require(_0x84c5('0x9'));var client=jayson[_0x84c5('0xa')][_0x84c5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28c6da,_0x4ff3c2,_0x5cdebc){return new BPromise(function(_0x5a0dbb,_0x344a87){return client[_0x84c5('0xc')](_0x28c6da,_0x5cdebc)[_0x84c5('0xd')](function(_0xfad321){logger['info'](_0x84c5('0xe'),_0x4ff3c2,_0x84c5('0xf'));logger[_0x84c5('0x10')](_0x84c5('0x11'),_0x4ff3c2,_0x84c5('0xf'),JSON['stringify'](_0xfad321));if(_0xfad321[_0x84c5('0x12')]){if(_0xfad321[_0x84c5('0x12')][_0x84c5('0x13')]===0x1f4){logger[_0x84c5('0x12')](_0x84c5('0xe'),_0x4ff3c2,_0xfad321[_0x84c5('0x12')][_0x84c5('0x14')]);return _0x344a87(_0xfad321[_0x84c5('0x12')]['message']);}logger[_0x84c5('0x12')](_0x84c5('0xe'),_0x4ff3c2,_0xfad321[_0x84c5('0x12')][_0x84c5('0x14')]);return _0x5a0dbb(_0xfad321['error']['message']);}else{logger[_0x84c5('0x15')]('CmCustomField,\x20%s,\x20%s',_0x4ff3c2,'request\x20sent');_0x5a0dbb(_0xfad321['result'][_0x84c5('0x14')]);}})['catch'](function(_0x28a48e){logger[_0x84c5('0x12')](_0x84c5('0xe'),_0x4ff3c2,_0x28a48e);_0x344a87(_0x28a48e);});});} \ No newline at end of file +var _0x0d7e=['jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x0d7e,0x167));var _0xe0d7=function(_0x45df9a,_0xfb0576){_0x45df9a=_0x45df9a-0x0;var _0x3023e8=_0x0d7e[_0x45df9a];return _0x3023e8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe0d7('0x0'));var BPromise=require(_0xe0d7('0x1'));var rs=require(_0xe0d7('0x2'));var fs=require('fs');var Redis=require(_0xe0d7('0x3'));var db=require(_0xe0d7('0x4'))['db'];var utils=require(_0xe0d7('0x5'));var logger=require(_0xe0d7('0x6'))(_0xe0d7('0x7'));var config=require(_0xe0d7('0x8'));var jayson=require(_0xe0d7('0x9'));var client=jayson[_0xe0d7('0xa')][_0xe0d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32d3c7,_0x2afd10,_0x5b38e8){return new BPromise(function(_0x46e9fc,_0x4aebcb){return client[_0xe0d7('0xc')](_0x32d3c7,_0x5b38e8)[_0xe0d7('0xd')](function(_0x58271f){logger[_0xe0d7('0xe')](_0xe0d7('0xf'),_0x2afd10,'request\x20sent');logger[_0xe0d7('0x10')](_0xe0d7('0x11'),_0x2afd10,'request\x20sent',JSON[_0xe0d7('0x12')](_0x58271f));if(_0x58271f[_0xe0d7('0x13')]){if(_0x58271f[_0xe0d7('0x13')][_0xe0d7('0x14')]===0x1f4){logger['error']('CmCustomField,\x20%s,\x20%s',_0x2afd10,_0x58271f[_0xe0d7('0x13')][_0xe0d7('0x15')]);return _0x4aebcb(_0x58271f[_0xe0d7('0x13')][_0xe0d7('0x15')]);}logger[_0xe0d7('0x13')](_0xe0d7('0xf'),_0x2afd10,_0x58271f[_0xe0d7('0x13')][_0xe0d7('0x15')]);return _0x46e9fc(_0x58271f[_0xe0d7('0x13')][_0xe0d7('0x15')]);}else{logger[_0xe0d7('0xe')]('CmCustomField,\x20%s,\x20%s',_0x2afd10,'request\x20sent');_0x46e9fc(_0x58271f[_0xe0d7('0x16')][_0xe0d7('0x15')]);}})['catch'](function(_0x1f4dbd){logger['error'](_0xe0d7('0xf'),_0x2afd10,_0x1f4dbd);_0x4aebcb(_0x1f4dbd);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 0dca941..25d2c2a 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 _0x05dc=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','util','express'];(function(_0x5871cd,_0x212833){var _0x47c869=function(_0x5cfffb){while(--_0x5cfffb){_0x5871cd['push'](_0x5871cd['shift']());}};_0x47c869(++_0x212833);}(_0x05dc,0x178));var _0xc05d=function(_0x135d2a,_0x546cd1){_0x135d2a=_0x135d2a-0x0;var _0xae488=_0x05dc[_0x135d2a];return _0xae488;};'use strict';var multer=require('multer');var util=require(_0xc05d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc05d('0x1'));var router=express[_0xc05d('0x2')]();var fs_extra=require(_0xc05d('0x3'));var auth=require(_0xc05d('0x4'));var interaction=require(_0xc05d('0x5'));var config=require(_0xc05d('0x6'));var controller=require(_0xc05d('0x7'));router[_0xc05d('0x8')]('/',auth[_0xc05d('0x9')](),controller[_0xc05d('0xa')]);router[_0xc05d('0x8')]('/:id',auth[_0xc05d('0x9')](),controller[_0xc05d('0xb')]);router[_0xc05d('0xc')]('/',auth[_0xc05d('0x9')](),controller[_0xc05d('0xd')]);router[_0xc05d('0xe')](_0xc05d('0xf'),auth[_0xc05d('0x9')](),controller[_0xc05d('0x10')]);router[_0xc05d('0x11')](_0xc05d('0xf'),auth[_0xc05d('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5687=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','post','create','update','delete'];(function(_0x3ae5fd,_0x206748){var _0x4609f1=function(_0x9884ce){while(--_0x9884ce){_0x3ae5fd['push'](_0x3ae5fd['shift']());}};_0x4609f1(++_0x206748);}(_0x5687,0x1ce));var _0x7568=function(_0x19f59c,_0x4c62c6){_0x19f59c=_0x19f59c-0x0;var _0x4d6cc6=_0x5687[_0x19f59c];return _0x4d6cc6;};'use strict';var multer=require(_0x7568('0x0'));var util=require(_0x7568('0x1'));var path=require(_0x7568('0x2'));var timeout=require(_0x7568('0x3'));var express=require(_0x7568('0x4'));var router=express[_0x7568('0x5')]();var fs_extra=require(_0x7568('0x6'));var auth=require(_0x7568('0x7'));var interaction=require(_0x7568('0x8'));var config=require('../../config/environment');var controller=require(_0x7568('0x9'));router[_0x7568('0xa')]('/',auth[_0x7568('0xb')](),controller[_0x7568('0xc')]);router['get'](_0x7568('0xd'),auth[_0x7568('0xb')](),controller['show']);router[_0x7568('0xe')]('/',auth['isAuthenticated'](),controller[_0x7568('0xf')]);router['put'](_0x7568('0xd'),auth[_0x7568('0xb')](),controller[_0x7568('0x10')]);router[_0x7568('0x11')](_0x7568('0xd'),auth[_0x7568('0xb')](),controller[_0x7568('0x12')]);module[_0x7568('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 6c046d6..7877b52 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 _0x36e7=['moment','sequelize','STRING','BOOLEAN','DATE','INTEGER','contactListQueue'];(function(_0x25a1cf,_0x6582f){var _0x58dec5=function(_0x39be86){while(--_0x39be86){_0x25a1cf['push'](_0x25a1cf['shift']());}};_0x58dec5(++_0x6582f);}(_0x36e7,0xb6));var _0x736e=function(_0x3929fc,_0x5cd26f){_0x3929fc=_0x3929fc-0x0;var _0x251c46=_0x36e7[_0x3929fc];return _0x251c46;};'use strict';var moment=require(_0x736e('0x0'));var Sequelize=require(_0x736e('0x1'));module['exports']={'phone':{'type':Sequelize[_0x736e('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x736e('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x736e('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x736e('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x736e('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x736e('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x736e('0x4')]},'priority':{'type':Sequelize[_0x736e('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x736e('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x736e('0x5')],'unique':_0x736e('0x6')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x736e('0x6')},'UserId':{'type':Sequelize[_0x736e('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x736e('0x5')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x736e('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x736e('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x736e('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x736e('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x736e('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x736e('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xd76d=['INTEGER','UNSIGNED','contactListQueue','STRING','moment','sequelize','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x167d22,_0x14553d){var _0x2901ab=function(_0x575b81){while(--_0x575b81){_0x167d22['push'](_0x167d22['shift']());}};_0x2901ab(++_0x14553d);}(_0xd76d,0x90));var _0xdd76=function(_0x5426e2,_0x5f2968){_0x5426e2=_0x5426e2-0x0;var _0x920dc=_0xd76d[_0x5426e2];return _0x920dc;};'use strict';var moment=require(_0xdd76('0x0'));var Sequelize=require(_0xdd76('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xdd76('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xdd76('0x3')],'defaultValue':moment()[_0xdd76('0x4')](_0xdd76('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xdd76('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdd76('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xdd76('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdd76('0x3')]},'priority':{'type':Sequelize[_0xdd76('0x6')](0x2)[_0xdd76('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xdd76('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xdd76('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xdd76('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xdd76('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xdd76('0x6')],'unique':_0xdd76('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xdd76('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdd76('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdd76('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xdd76('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xdd76('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xdd76('0x9')]},'recallmeNotifiedDate':{'type':Sequelize[_0xdd76('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index df11cea..9fa2a0d 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 _0x1224=['Company','List','Queue','getPreviewRecall','findOne','Contact','CmList','dialActive','getVoiceQueues','sendStatus','getTimezones','timezones','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','json','offset','undefined','limit','count','status','set','Content-Range','update','then','error','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','$and','$gte','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','attributes','intersection','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','fields','find','create','CmHopper','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','createdAt','updatedAt','state','deleted','membername','user','UserId','deletedat','format','calleridnum','phone','campaigntype','CmContact','ContactId','lastName','isNil','firstName','calleridname','CmHopperFinal','CmHopperAdditionalPhone','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','LOCK','UPDATE','CmCompany'];(function(_0x3f01b4,_0x3c333c){var _0x54ec0f=function(_0x4774f9){while(--_0x4774f9){_0x3f01b4['push'](_0x3f01b4['shift']());}};_0x54ec0f(++_0x3c333c);}(_0x1224,0x10d));var _0x4122=function(_0x2a0ab3,_0xcdddf1){_0x2a0ab3=_0x2a0ab3-0x0;var _0x73f2ad=_0x1224[_0x2a0ab3];return _0x73f2ad;};'use strict';var moment=require(_0x4122('0x0'));var _=require(_0x4122('0x1'));var qs=require(_0x4122('0x2'));var logger=require(_0x4122('0x3'))(_0x4122('0x4'));var shared=require(_0x4122('0x5'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x1b3b05,_0x1f1533){_0x1f1533=_0x1f1533||0xc8;return function(_0x2f506b){if(_0x2f506b){return _0x1b3b05['status'](_0x1f1533)[_0x4122('0x6')](_0x2f506b);}};}function respondWithFilteredResult(_0x76278c,_0xc6dfaf){return function(_0x40b5e4){if(_0x40b5e4){var _0x2a952c=typeof _0xc6dfaf[_0x4122('0x7')]===_0x4122('0x8')&&typeof _0xc6dfaf[_0x4122('0x9')]===_0x4122('0x8');var _0x3e812e=_0x40b5e4[_0x4122('0xa')];var _0x4779e2=_0x2a952c?0x0:_0xc6dfaf[_0x4122('0x7')];var _0x35160c=_0x2a952c?_0x40b5e4[_0x4122('0xa')]:_0xc6dfaf[_0x4122('0x7')]+_0xc6dfaf[_0x4122('0x9')];var _0x2d3fa6;if(_0x35160c>=_0x3e812e){_0x35160c=_0x3e812e;_0x2d3fa6=0xc8;}else{_0x2d3fa6=0xce;}_0x76278c[_0x4122('0xb')](_0x2d3fa6);return _0x76278c[_0x4122('0xc')](_0x4122('0xd'),_0x4779e2+'-'+_0x35160c+'/'+_0x3e812e)[_0x4122('0x6')](_0x40b5e4);}return null;};}function saveUpdates(_0x440ff0,_0x8d4876){return function(_0xe213d){if(_0xe213d){return _0xe213d[_0x4122('0xe')](_0x440ff0)[_0x4122('0xf')](function(_0x33278f){return _0x33278f;});}return null;};}function handleEntityNotFound(_0x421ee3,_0x1a701e){return function(_0x3a88fe){if(!_0x3a88fe){_0x421ee3['sendStatus'](0x194);}return _0x3a88fe;};}function handleError(_0x4761a0,_0x3c674e){_0x3c674e=_0x3c674e||0x1f4;return function(_0x192e77){logger[_0x4122('0x10')](_0x192e77['stack']);if(_0x192e77[_0x4122('0x11')]){delete _0x192e77[_0x4122('0x11')];}_0x4761a0['status'](_0x3c674e)[_0x4122('0x12')](_0x192e77);};}exports[_0x4122('0x13')]=function(_0x399003,_0x4636ae){var _0xf6ba87={},_0x42374d={},_0x2d2782={'count':0x0,'rows':[]};var _0x5a4fe6=_['map'](db['CmHopper'][_0x4122('0x14')],function(_0x2d95e8){return{'name':_0x2d95e8[_0x4122('0x15')],'type':_0x2d95e8[_0x4122('0x16')][_0x4122('0x17')]};});_0x42374d[_0x4122('0x18')]=_[_0x4122('0x19')](_0x5a4fe6,_0x4122('0x11'));_0x42374d['query']=_[_0x4122('0x1a')](_0x399003['query']);_0x42374d['filters']=_['intersection'](_0x42374d[_0x4122('0x18')],_0x42374d[_0x4122('0x1b')]);_0x42374d[_0x4122('0x1c')]=_['concat'](_0x42374d[_0x4122('0x1c')],[_0x4122('0x1d'),'$or','$gt',_0x4122('0x1e'),'$lt','$lte','$ne',_0x4122('0x1f'),_0x4122('0x20'),_0x4122('0x21'),_0x4122('0x22'),_0x4122('0x23'),_0x4122('0x24'),_0x4122('0x25'),_0x4122('0x26'),_0x4122('0x27'),_0x4122('0x28'),_0x4122('0x25'),_0x4122('0x29'),_0x4122('0x2a'),'$contained',_0x4122('0x2b')]);_0xf6ba87[_0x4122('0x2c')]=_[_0x4122('0x2d')](_0x42374d[_0x4122('0x18')],qs['fields'](_0x399003[_0x4122('0x1b')]['fields']));_0xf6ba87[_0x4122('0x2c')]=_0xf6ba87[_0x4122('0x2c')][_0x4122('0x2e')]?_0xf6ba87[_0x4122('0x2c')]:_0x42374d[_0x4122('0x18')];if(!_0x399003[_0x4122('0x1b')][_0x4122('0x2f')](_0x4122('0x30'))){_0xf6ba87['limit']=qs[_0x4122('0x9')](_0x399003[_0x4122('0x1b')]['limit']);_0xf6ba87[_0x4122('0x7')]=qs[_0x4122('0x7')](_0x399003[_0x4122('0x1b')][_0x4122('0x7')]);}_0xf6ba87['order']=qs[_0x4122('0x31')](_0x399003[_0x4122('0x1b')]['sort']);_0xf6ba87['where']=qs[_0x4122('0x1c')](_['pick'](_0x399003[_0x4122('0x1b')],_0x42374d[_0x4122('0x1c')]),_0x5a4fe6);if(_0x399003['query'][_0x4122('0x32')]){_0xf6ba87[_0x4122('0x33')]=_[_0x4122('0x34')](_0xf6ba87['where'],{'$or':_[_0x4122('0x19')](_0x5a4fe6,function(_0x5b925d){if(_0x5b925d[_0x4122('0x16')]!==_0x4122('0x35')){var _0x3dbfae={};_0x3dbfae[_0x5b925d['name']]={'$like':'%'+_0x399003[_0x4122('0x1b')]['filter']+'%'};return _0x3dbfae;}})});}_0xf6ba87=_[_0x4122('0x34')]({},_0xf6ba87,_0x399003[_0x4122('0x36')]);var _0x4cb4d0={'where':_0xf6ba87['where']};return db['CmHopper'][_0x4122('0xa')](_0x4cb4d0)['then'](function(_0x477e51){_0x2d2782[_0x4122('0xa')]=_0x477e51;if(_0x399003[_0x4122('0x1b')][_0x4122('0x37')]){_0xf6ba87[_0x4122('0x38')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0xf6ba87);})[_0x4122('0xf')](function(_0x4a1d1e){_0x2d2782[_0x4122('0x39')]=_0x4a1d1e;return _0x2d2782;})['then'](respondWithFilteredResult(_0x4636ae,_0xf6ba87))[_0x4122('0x3a')](handleError(_0x4636ae,null));};exports[_0x4122('0x3b')]=function(_0x4fbcd5,_0x1b33e6){var _0x2b7d56={'raw':!![],'where':{'id':_0x4fbcd5[_0x4122('0x3c')]['id']}},_0x36c306={};_0x36c306[_0x4122('0x18')]=_[_0x4122('0x1a')](db['CmHopper'][_0x4122('0x14')]);_0x36c306['query']=_[_0x4122('0x1a')](_0x4fbcd5['query']);_0x36c306[_0x4122('0x1c')]=_[_0x4122('0x2d')](_0x36c306[_0x4122('0x18')],_0x36c306[_0x4122('0x1b')]);_0x2b7d56[_0x4122('0x2c')]=_['intersection'](_0x36c306[_0x4122('0x18')],qs[_0x4122('0x3d')](_0x4fbcd5['query']['fields']));_0x2b7d56['attributes']=_0x2b7d56[_0x4122('0x2c')][_0x4122('0x2e')]?_0x2b7d56[_0x4122('0x2c')]:_0x36c306[_0x4122('0x18')];if(_0x4fbcd5[_0x4122('0x1b')][_0x4122('0x37')]){_0x2b7d56[_0x4122('0x38')]=[{'all':!![]}];}_0x2b7d56=_[_0x4122('0x34')]({},_0x2b7d56,_0x4fbcd5[_0x4122('0x36')]);return db['CmHopper'][_0x4122('0x3e')](_0x2b7d56)['then'](handleEntityNotFound(_0x1b33e6,null))['then'](respondWithResult(_0x1b33e6,null))[_0x4122('0x3a')](handleError(_0x1b33e6,null));};exports[_0x4122('0x3f')]=function(_0x87305d,_0x5ed2c7){return db[_0x4122('0x40')][_0x4122('0x3f')](_0x87305d['body'],{})[_0x4122('0xf')](respondWithResult(_0x5ed2c7,0xc9))[_0x4122('0x3a')](handleError(_0x5ed2c7,null));};exports[_0x4122('0xe')]=function(_0x46f775,_0x49d246){if(_0x46f775[_0x4122('0x41')]['id']){delete _0x46f775[_0x4122('0x41')]['id'];}return db[_0x4122('0x40')][_0x4122('0x3e')]({'where':{'id':_0x46f775[_0x4122('0x3c')]['id']}})['then'](handleEntityNotFound(_0x49d246,null))['then'](saveUpdates(_0x46f775[_0x4122('0x41')],null))[_0x4122('0xf')](respondWithResult(_0x49d246,null))[_0x4122('0x3a')](handleError(_0x49d246,null));};exports[_0x4122('0x42')]=function(_0x144d4c,_0x53dc0a){return db[_0x4122('0x40')][_0x4122('0x42')]()[_0x4122('0xf')](respondWithResult(_0x53dc0a,null))['catch'](handleError(_0x53dc0a,null));};exports[_0x4122('0x43')]=function(_0x53f7d9,_0x39515c){var _0x163224;var _0x337788=_0x53f7d9[_0x4122('0x3c')]['id'];return db['CmHopper']['find']({'where':{'id':_0x53f7d9[_0x4122('0x3c')]['id']}})[_0x4122('0xf')](handleEntityNotFound(_0x39515c,null))[_0x4122('0xf')](function(_0x181640){if(_0x181640){return _0x181640['destroy']()[_0x4122('0xf')](function(_0x5678ff){return _0x5678ff;});}})[_0x4122('0xf')](function(_0x49f11a){_0x163224=_0x49f11a;if(_0x49f11a){if(_0x49f11a[_0x4122('0x44')]||_0x49f11a[_0x4122('0x45')]){return db[_0x49f11a[_0x4122('0x44')]?_0x4122('0x46'):_0x4122('0x47')][_0x4122('0x3e')]({'where':{'id':_0x49f11a['VoiceQueueId']?_0x49f11a[_0x4122('0x44')]:_0x49f11a['CampaignId']},'attributes':['id',_0x4122('0x11')],'raw':!![]});}}})[_0x4122('0xf')](function(_0x1223c9){var _0x348af2={};if(_0x1223c9){_[_0x4122('0x34')](_0x348af2,_['omit'](_0x163224[_0x4122('0x48')],[_0x4122('0x49'),_0x4122('0x4a'),'id']));_0x348af2[_0x4122('0x4b')]=0x15;_0x348af2['statedesc']=_0x4122('0x4c');_0x348af2['campaign']=_0x1223c9[_0x4122('0x11')];_0x348af2[_0x4122('0x4d')]=_0x53f7d9[_0x4122('0x4e')][_0x4122('0x11')];_0x348af2[_0x4122('0x4f')]=_0x53f7d9[_0x4122('0x4e')]['id'];_0x348af2[_0x4122('0x4c')]=!![];_0x348af2[_0x4122('0x50')]=moment()[_0x4122('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x348af2[_0x4122('0x52')]=_0x163224[_0x4122('0x53')];_0x348af2[_0x4122('0x54')]=_0x163224['VoiceQueueId']?'queue':'ivr';return db[_0x4122('0x55')][_0x4122('0x3e')]({'where':{'id':_0x348af2[_0x4122('0x56')]},'attributes':['firstName',_0x4122('0x57')]})[_0x4122('0xf')](function(_0x31421f){if(!_[_0x4122('0x58')](_0x39515c)&&!_[_0x4122('0x58')](_0x31421f[_0x4122('0x59')])){_0x348af2[_0x4122('0x5a')]=_0x31421f[_0x4122('0x59')];if(!_[_0x4122('0x58')](_0x31421f[_0x4122('0x57')])){_0x348af2[_0x4122('0x5a')]+='\x20'+_0x31421f[_0x4122('0x57')];}}})['finally'](function(){return db[_0x4122('0x5b')]['create'](_0x348af2);});}})[_0x4122('0xf')](function(_0x34f40a){return db[_0x4122('0x5c')][_0x4122('0x43')]({'where':{'CmHopperId':_0x337788}});})[_0x4122('0xf')](function(){return _0x39515c[_0x4122('0xb')](0xcc)['end']();})[_0x4122('0x3a')](handleError(_0x39515c,null));};exports['getPreview']=function(_0x127d94,_0x26b19e){var _0xa46835=[];return db['CmContact'][_0x4122('0x42')]()[_0x4122('0xf')](function(_0x49d85f){_0xa46835=_[_0x4122('0x1a')](_0x49d85f);return _0x127d94[_0x4122('0x4e')]['getVoiceQueues']({'where':{'type':_0x4122('0x5d'),'dialActive':!![],'dialMethod':_0x4122('0x5e')},'attributes':['id',_0x4122('0x5f'),_0x4122('0x60')],'raw':!![]});})[_0x4122('0xf')](function(_0x37124c){if(_0x37124c&&_0x37124c[_0x4122('0x2e')]){return db[_0x4122('0x61')][_0x4122('0x62')](function(_0x41ebf5){var _0x4befa6={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4122('0x51')](_0x4122('0x63'))},'VoiceQueueId':{'$in':_[_0x4122('0x19')](_0x37124c,'id')},'$or':[{'UserId':null},{'UserId':_0x127d94[_0x4122('0x4e')]['id']}]};var _0x4a4882={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x37124c)[_0x4122('0x32')]([_0x4122('0x60'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x127d94[_0x4122('0x4e')]['id']}]};var _0xf2e8b7={'$or':[_0x4befa6,_0x4a4882]};var _0x456c19=[];if(_0x127d94['body']['direction']&&_0x127d94['body'][_0x4122('0x64')]==='prev'){if(!_['isEmpty'](_0x127d94[_0x4122('0x41')][_0x4122('0x65')])){_0xf2e8b7['id']={'$in':_0x127d94[_0x4122('0x41')]['hopperIds']};}_0x456c19=[[_0x4122('0x66'),_0x4122('0x67')],[_0x4122('0x68'),_0x37124c[0x0][_0x4122('0x5f')]===_0x4122('0x67')?_0x4122('0x69'):_0x4122('0x67')],db[_0x4122('0x61')][_0x4122('0x6a')](_0x4122('0x6b')),['id',_0x4122('0x69')]];}else{if(!_[_0x4122('0x6c')](_0x127d94['body']['hopperIds'])){_0xf2e8b7['id']={'$notIn':_0x127d94[_0x4122('0x41')][_0x4122('0x65')]};}_0x456c19=[[_0x4122('0x66'),'DESC'],[_0x4122('0x68'),_0x37124c[0x0]['dialOrderByScheduledAt']],db[_0x4122('0x61')][_0x4122('0x6a')](_0x4122('0x6d')),['id',_0x4122('0x67')]];}return db[_0x4122('0x40')]['findOne']({'attributes':['id',_0x4122('0x6e'),_0x4122('0x53'),_0x4122('0x6f')],'where':_0xf2e8b7,'order':_0x456c19,'transaction':_0x41ebf5,'lock':_0x41ebf5[_0x4122('0x70')][_0x4122('0x71')],'include':[{'model':db[_0x4122('0x55')],'as':'Contact','attributes':_0xa46835,'include':[{'model':db[_0x4122('0x72')],'as':_0x4122('0x73'),'attributes':['id',_0x4122('0x11')]}]},{'model':db['CmList'],'as':_0x4122('0x74'),'attributes':['id',_0x4122('0x11')]},{'model':db[_0x4122('0x46')],'as':_0x4122('0x75'),'attributes':['id',_0x4122('0x11'),'dialActive']}]})[_0x4122('0xf')](function(_0x1f57b5){if(_0x1f57b5){return _0x1f57b5[_0x4122('0xe')]({'UserId':_0x127d94['user']['id']},{'transaction':_0x41ebf5});}});});}})[_0x4122('0xf')](handleEntityNotFound(_0x26b19e,null))[_0x4122('0xf')](respondWithResult(_0x26b19e,null))['catch'](handleError(_0x26b19e,null));};exports[_0x4122('0x76')]=function(_0x48c00b,_0x454096,_0x3b3187){var _0x3c7546=[];var _0x112561=_0x48c00b[_0x4122('0x3c')]['id'];var _0x4ff046=_0x48c00b['user']['id'];return db[_0x4122('0x55')]['describe']()[_0x4122('0xf')](function(_0x5d168b){_0x3c7546=_['keys'](_0x5d168b);return db['sequelize']['transaction'](function(_0x22daf8){const _0x5f0135={'id':_0x112561};return db['CmHopper'][_0x4122('0x77')]({'attributes':['id','scheduledat',_0x4122('0x6f')],'where':_0x5f0135,'transaction':_0x22daf8,'lock':_0x22daf8['LOCK'][_0x4122('0x71')],'include':[{'model':db[_0x4122('0x55')],'as':_0x4122('0x78'),'attributes':_0x3c7546,'include':[{'model':db['CmCompany'],'as':_0x4122('0x73'),'attributes':['id','name']}]},{'model':db[_0x4122('0x79')],'as':_0x4122('0x74'),'attributes':['id','name']},{'model':db[_0x4122('0x46')],'as':_0x4122('0x75'),'attributes':['id',_0x4122('0x11'),_0x4122('0x7a')]}]})[_0x4122('0xf')](function(_0x397aa7){if(_0x397aa7){return _0x397aa7['update']({'UserId':_0x4ff046},{'transaction':_0x22daf8});}});});})['then'](handleEntityNotFound(_0x454096,null))[_0x4122('0xf')](respondWithResult(_0x454096,null))[_0x4122('0x3a')](handleError(_0x454096,null));};exports['getOpenContacts']=function(_0x504b9f,_0x26983d){return _0x504b9f[_0x4122('0x4e')][_0x4122('0x7b')]({'where':{'type':_0x4122('0x5d'),'dialActive':!![],'dialMethod':_0x4122('0x5e')},'attributes':['id'],'raw':!![]})[_0x4122('0xf')](function(_0x5a3aca){if(_0x5a3aca&&_0x5a3aca[_0x4122('0x2e')]){return db['CmHopper'][_0x4122('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x4122('0x63'))},'VoiceQueueId':{'$in':_['map'](_0x5a3aca,'id')},'$or':[{'UserId':null},{'UserId':_0x504b9f[_0x4122('0x4e')]['id']}]}});}return 0x0;})['then'](function(_0x384d9a){if(!_[_0x4122('0x58')](_0x384d9a)&&_['isNumber'](_0x384d9a)){return _0x26983d['status'](0xc8)[_0x4122('0x6')]({'contacts':_0x384d9a});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts',0x194,'entity\x20not\x20found');_0x26983d[_0x4122('0x7c')](0x194);}})['catch'](handleError(_0x26983d,null));};exports[_0x4122('0x7d')]=function(_0x2771df,_0x49a446){var _0x2ef69a=shared[_0x4122('0x7e')];var _0x59177c=[];_[_0x4122('0x19')](_0x2ef69a,function(_0x45c9fa){_0x59177c['push']({'id':_0x45c9fa['name'],'name':_0x45c9fa[_0x4122('0x11')],'utcOffset':_0x45c9fa['utcOffset']});});return _0x49a446[_0x4122('0xb')](0xc8)[_0x4122('0x6')]({'tz':_0x59177c});};exports[_0x4122('0x7f')]=function(_0x529f8c,_0x4889f8){var _0x38b940=shared[_0x4122('0x7e')];var _0x44d091={};if(!_[_0x4122('0x58')](_0x38b940[_0x529f8c['body']['id']]))_0x44d091=_0x38b940[_0x529f8c[_0x4122('0x41')]['id']];return _0x4889f8[_0x4122('0xb')](0xc8)[_0x4122('0x6')](_0x44d091);}; \ No newline at end of file +var _0x0bde=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','CmHopper','rows','show','params','options','catch','create','body','find','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','deletedat','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','dialPreviewAutoRecallMe','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','sequelize','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','Queue','dialActive','scheduledat','getOpenContacts','outbound','preview','format','YYYY-MM-DD\x20HH:mm:ss','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','lodash','../../config/logger','api','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','Content-Range','update','then','sendStatus','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','intersection','filters','$and','$or','$gt','$gte','$lt','$lte','$ne','$between','$notBetween','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','attributes','fields'];(function(_0x3b594b,_0x5835c3){var _0x1ea5f8=function(_0x191b3e){while(--_0x191b3e){_0x3b594b['push'](_0x3b594b['shift']());}};_0x1ea5f8(++_0x5835c3);}(_0x0bde,0xe7));var _0xe0bd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0bde[_0x2641f9];return _0x585741;};'use strict';var moment=require('moment');var _=require(_0xe0bd('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0xe0bd('0x1'))(_0xe0bd('0x2'));var shared=require(_0xe0bd('0x3'));var db=require(_0xe0bd('0x4'))['db'];function respondWithResult(_0x2da4bd,_0x5541b9){_0x5541b9=_0x5541b9||0xc8;return function(_0x34df88){if(_0x34df88){return _0x2da4bd[_0xe0bd('0x5')](_0x5541b9)[_0xe0bd('0x6')](_0x34df88);}};}function respondWithFilteredResult(_0x3b712a,_0x22bfd1){return function(_0x26393f){if(_0x26393f){var _0x217145=typeof _0x22bfd1['offset']===_0xe0bd('0x7')&&typeof _0x22bfd1[_0xe0bd('0x8')]===_0xe0bd('0x7');var _0x2d32c6=_0x26393f[_0xe0bd('0x9')];var _0x3c47c4=_0x217145?0x0:_0x22bfd1[_0xe0bd('0xa')];var _0x58d892=_0x217145?_0x26393f['count']:_0x22bfd1['offset']+_0x22bfd1['limit'];var _0x44ffa9;if(_0x58d892>=_0x2d32c6){_0x58d892=_0x2d32c6;_0x44ffa9=0xc8;}else{_0x44ffa9=0xce;}_0x3b712a['status'](_0x44ffa9);return _0x3b712a['set'](_0xe0bd('0xb'),_0x3c47c4+'-'+_0x58d892+'/'+_0x2d32c6)[_0xe0bd('0x6')](_0x26393f);}return null;};}function saveUpdates(_0x54d40e,_0xc492b4){return function(_0x5272ca){if(_0x5272ca){return _0x5272ca[_0xe0bd('0xc')](_0x54d40e)[_0xe0bd('0xd')](function(_0x3b2fb1){return _0x3b2fb1;});}return null;};}function handleEntityNotFound(_0x20ab47,_0x47664e){return function(_0x335f17){if(!_0x335f17){_0x20ab47[_0xe0bd('0xe')](0x194);}return _0x335f17;};}function handleError(_0x210f20,_0x4f63fa){_0x4f63fa=_0x4f63fa||0x1f4;return function(_0x50891d){logger['error'](_0x50891d[_0xe0bd('0xf')]);if(_0x50891d[_0xe0bd('0x10')]){delete _0x50891d[_0xe0bd('0x10')];}_0x210f20[_0xe0bd('0x5')](_0x4f63fa)[_0xe0bd('0x11')](_0x50891d);};}exports['index']=function(_0x4ebe7a,_0x1becc8){var _0x4ac920={},_0x4f36f7={},_0x418d64={'count':0x0,'rows':[]};var _0xec158d=_[_0xe0bd('0x12')](db['CmHopper'][_0xe0bd('0x13')],function(_0xe1d808){return{'name':_0xe1d808[_0xe0bd('0x14')],'type':_0xe1d808['type'][_0xe0bd('0x15')]};});_0x4f36f7[_0xe0bd('0x16')]=_[_0xe0bd('0x12')](_0xec158d,'name');_0x4f36f7[_0xe0bd('0x17')]=_[_0xe0bd('0x18')](_0x4ebe7a[_0xe0bd('0x17')]);_0x4f36f7['filters']=_[_0xe0bd('0x19')](_0x4f36f7['model'],_0x4f36f7[_0xe0bd('0x17')]);_0x4f36f7[_0xe0bd('0x1a')]=_['concat'](_0x4f36f7[_0xe0bd('0x1a')],[_0xe0bd('0x1b'),_0xe0bd('0x1c'),_0xe0bd('0x1d'),_0xe0bd('0x1e'),_0xe0bd('0x1f'),_0xe0bd('0x20'),_0xe0bd('0x21'),'$eq','$not',_0xe0bd('0x22'),_0xe0bd('0x23'),'$in','$notIn',_0xe0bd('0x24'),_0xe0bd('0x25'),_0xe0bd('0x26'),_0xe0bd('0x27'),'$like',_0xe0bd('0x28'),'$contains',_0xe0bd('0x29'),_0xe0bd('0x2a')]);_0x4ac920[_0xe0bd('0x2b')]=_[_0xe0bd('0x19')](_0x4f36f7[_0xe0bd('0x16')],qs[_0xe0bd('0x2c')](_0x4ebe7a[_0xe0bd('0x17')][_0xe0bd('0x2c')]));_0x4ac920[_0xe0bd('0x2b')]=_0x4ac920[_0xe0bd('0x2b')][_0xe0bd('0x2d')]?_0x4ac920[_0xe0bd('0x2b')]:_0x4f36f7[_0xe0bd('0x16')];if(!_0x4ebe7a['query'][_0xe0bd('0x2e')](_0xe0bd('0x2f'))){_0x4ac920[_0xe0bd('0x8')]=qs[_0xe0bd('0x8')](_0x4ebe7a[_0xe0bd('0x17')][_0xe0bd('0x8')]);_0x4ac920['offset']=qs['offset'](_0x4ebe7a[_0xe0bd('0x17')][_0xe0bd('0xa')]);}_0x4ac920[_0xe0bd('0x30')]=qs[_0xe0bd('0x31')](_0x4ebe7a[_0xe0bd('0x17')][_0xe0bd('0x31')]);_0x4ac920[_0xe0bd('0x32')]=qs['filters'](_[_0xe0bd('0x33')](_0x4ebe7a[_0xe0bd('0x17')],_0x4f36f7[_0xe0bd('0x1a')]),_0xec158d);if(_0x4ebe7a[_0xe0bd('0x17')][_0xe0bd('0x34')]){_0x4ac920[_0xe0bd('0x32')]=_['merge'](_0x4ac920[_0xe0bd('0x32')],{'$or':_[_0xe0bd('0x12')](_0xec158d,function(_0x24b857){if(_0x24b857[_0xe0bd('0x35')]!==_0xe0bd('0x36')){var _0x5881e5={};_0x5881e5[_0x24b857['name']]={'$like':'%'+_0x4ebe7a[_0xe0bd('0x17')][_0xe0bd('0x34')]+'%'};return _0x5881e5;}})});}_0x4ac920=_[_0xe0bd('0x37')]({},_0x4ac920,_0x4ebe7a['options']);var _0x8a331={'where':_0x4ac920['where']};return db['CmHopper'][_0xe0bd('0x9')](_0x8a331)[_0xe0bd('0xd')](function(_0x4d8695){_0x418d64['count']=_0x4d8695;if(_0x4ebe7a['query'][_0xe0bd('0x38')]){_0x4ac920[_0xe0bd('0x39')]=[{'all':!![]}];}return db[_0xe0bd('0x3a')]['findAll'](_0x4ac920);})[_0xe0bd('0xd')](function(_0x2b4814){_0x418d64[_0xe0bd('0x3b')]=_0x2b4814;return _0x418d64;})['then'](respondWithFilteredResult(_0x1becc8,_0x4ac920))['catch'](handleError(_0x1becc8,null));};exports[_0xe0bd('0x3c')]=function(_0x4e5247,_0x1eba8b){var _0x195f0f={'raw':!![],'where':{'id':_0x4e5247[_0xe0bd('0x3d')]['id']}},_0x5aee49={};_0x5aee49[_0xe0bd('0x16')]=_[_0xe0bd('0x18')](db[_0xe0bd('0x3a')][_0xe0bd('0x13')]);_0x5aee49[_0xe0bd('0x17')]=_[_0xe0bd('0x18')](_0x4e5247['query']);_0x5aee49[_0xe0bd('0x1a')]=_[_0xe0bd('0x19')](_0x5aee49[_0xe0bd('0x16')],_0x5aee49[_0xe0bd('0x17')]);_0x195f0f[_0xe0bd('0x2b')]=_['intersection'](_0x5aee49['model'],qs['fields'](_0x4e5247[_0xe0bd('0x17')][_0xe0bd('0x2c')]));_0x195f0f[_0xe0bd('0x2b')]=_0x195f0f[_0xe0bd('0x2b')]['length']?_0x195f0f['attributes']:_0x5aee49[_0xe0bd('0x16')];if(_0x4e5247[_0xe0bd('0x17')][_0xe0bd('0x38')]){_0x195f0f[_0xe0bd('0x39')]=[{'all':!![]}];}_0x195f0f=_[_0xe0bd('0x37')]({},_0x195f0f,_0x4e5247[_0xe0bd('0x3e')]);return db[_0xe0bd('0x3a')]['find'](_0x195f0f)[_0xe0bd('0xd')](handleEntityNotFound(_0x1eba8b,null))['then'](respondWithResult(_0x1eba8b,null))[_0xe0bd('0x3f')](handleError(_0x1eba8b,null));};exports[_0xe0bd('0x40')]=function(_0x507876,_0x4cfad0){return db[_0xe0bd('0x3a')][_0xe0bd('0x40')](_0x507876[_0xe0bd('0x41')],{})[_0xe0bd('0xd')](respondWithResult(_0x4cfad0,0xc9))[_0xe0bd('0x3f')](handleError(_0x4cfad0,null));};exports[_0xe0bd('0xc')]=function(_0x368549,_0x37f9ea){if(_0x368549[_0xe0bd('0x41')]['id']){delete _0x368549['body']['id'];}return db[_0xe0bd('0x3a')][_0xe0bd('0x42')]({'where':{'id':_0x368549[_0xe0bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x37f9ea,null))[_0xe0bd('0xd')](saveUpdates(_0x368549[_0xe0bd('0x41')],null))['then'](respondWithResult(_0x37f9ea,null))[_0xe0bd('0x3f')](handleError(_0x37f9ea,null));};exports[_0xe0bd('0x43')]=function(_0x578792,_0xd14c1d){return db[_0xe0bd('0x3a')][_0xe0bd('0x43')]()['then'](respondWithResult(_0xd14c1d,null))[_0xe0bd('0x3f')](handleError(_0xd14c1d,null));};exports[_0xe0bd('0x44')]=function(_0x147438,_0x21ae20){var _0x119d5c;var _0x2eff0d=_0x147438[_0xe0bd('0x3d')]['id'];return db[_0xe0bd('0x3a')][_0xe0bd('0x42')]({'where':{'id':_0x147438['params']['id']}})['then'](handleEntityNotFound(_0x21ae20,null))['then'](function(_0x43b646){if(_0x43b646){return _0x43b646[_0xe0bd('0x44')]()['then'](function(_0xacd120){return _0xacd120;});}})[_0xe0bd('0xd')](function(_0x1ab9b0){_0x119d5c=_0x1ab9b0;if(_0x1ab9b0){if(_0x1ab9b0[_0xe0bd('0x45')]||_0x1ab9b0[_0xe0bd('0x46')]){return db[_0x1ab9b0[_0xe0bd('0x45')]?_0xe0bd('0x47'):_0xe0bd('0x48')][_0xe0bd('0x42')]({'where':{'id':_0x1ab9b0[_0xe0bd('0x45')]?_0x1ab9b0['VoiceQueueId']:_0x1ab9b0[_0xe0bd('0x46')]},'attributes':['id',_0xe0bd('0x10')],'raw':!![]});}}})[_0xe0bd('0xd')](function(_0x52573c){var _0x16dda5={};if(_0x52573c){_[_0xe0bd('0x37')](_0x16dda5,_[_0xe0bd('0x49')](_0x119d5c[_0xe0bd('0x4a')],[_0xe0bd('0x4b'),_0xe0bd('0x4c'),'id']));_0x16dda5[_0xe0bd('0x4d')]=0x15;_0x16dda5[_0xe0bd('0x4e')]=_0xe0bd('0x4f');_0x16dda5['campaign']=_0x52573c[_0xe0bd('0x10')];_0x16dda5[_0xe0bd('0x50')]=_0x147438[_0xe0bd('0x51')][_0xe0bd('0x10')];_0x16dda5['UserId']=_0x147438[_0xe0bd('0x51')]['id'];_0x16dda5[_0xe0bd('0x4f')]=!![];_0x16dda5[_0xe0bd('0x52')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x16dda5[_0xe0bd('0x53')]=_0x119d5c[_0xe0bd('0x54')];_0x16dda5['campaigntype']=_0x119d5c[_0xe0bd('0x45')]?_0xe0bd('0x55'):_0xe0bd('0x56');return db[_0xe0bd('0x57')]['find']({'where':{'id':_0x16dda5[_0xe0bd('0x58')]},'attributes':[_0xe0bd('0x59'),_0xe0bd('0x5a')]})[_0xe0bd('0xd')](function(_0x373846){if(!_[_0xe0bd('0x5b')](_0x21ae20)&&!_[_0xe0bd('0x5b')](_0x373846['firstName'])){_0x16dda5[_0xe0bd('0x5c')]=_0x373846[_0xe0bd('0x59')];if(!_[_0xe0bd('0x5b')](_0x373846[_0xe0bd('0x5a')])){_0x16dda5[_0xe0bd('0x5c')]+='\x20'+_0x373846[_0xe0bd('0x5a')];}}})[_0xe0bd('0x5d')](function(){return db[_0xe0bd('0x5e')][_0xe0bd('0x40')](_0x16dda5);});}})[_0xe0bd('0xd')](function(_0x29b248){return db[_0xe0bd('0x5f')][_0xe0bd('0x44')]({'where':{'CmHopperId':_0x2eff0d}});})[_0xe0bd('0xd')](function(){return _0x21ae20[_0xe0bd('0x5')](0xcc)[_0xe0bd('0x60')]();})[_0xe0bd('0x3f')](handleError(_0x21ae20,null));};exports[_0xe0bd('0x61')]=function(_0x178398,_0x8e61d6){var _0x9d03de=[];return db[_0xe0bd('0x57')][_0xe0bd('0x43')]()['then'](function(_0x4b461a){_0x9d03de=_[_0xe0bd('0x18')](_0x4b461a);return _0x178398[_0xe0bd('0x51')][_0xe0bd('0x62')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt',_0xe0bd('0x63')],'raw':!![]});})[_0xe0bd('0xd')](function(_0x4dfd2a){if(_0x4dfd2a&&_0x4dfd2a[_0xe0bd('0x2d')]){return db['sequelize'][_0xe0bd('0x64')](function(_0x2ede67){var _0x14bbeb={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x4dfd2a,'id')},'$or':[{'UserId':null},{'UserId':_0x178398[_0xe0bd('0x51')]['id']}]};var _0x1c9407={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4dfd2a)[_0xe0bd('0x34')]([_0xe0bd('0x63'),0x0])[_0xe0bd('0x12')]('id')[_0xe0bd('0x65')]()},'$or':[{'UserId':null},{'UserId':_0x178398['user']['id']}]};var _0x338028={'$or':[_0x14bbeb,_0x1c9407]};var _0x40a584=[];if(_0x178398['body'][_0xe0bd('0x66')]&&_0x178398[_0xe0bd('0x41')][_0xe0bd('0x66')]===_0xe0bd('0x67')){if(!_[_0xe0bd('0x68')](_0x178398[_0xe0bd('0x41')][_0xe0bd('0x69')])){_0x338028['id']={'$in':_0x178398[_0xe0bd('0x41')]['hopperIds']};}_0x40a584=[[_0xe0bd('0x6a'),_0xe0bd('0x6b')],[_0xe0bd('0x6c'),_0x4dfd2a[0x0]['dialOrderByScheduledAt']===_0xe0bd('0x6b')?_0xe0bd('0x6d'):_0xe0bd('0x6b')],db[_0xe0bd('0x6e')]['literal'](_0xe0bd('0x6f')),['id',_0xe0bd('0x6d')]];}else{if(!_[_0xe0bd('0x68')](_0x178398['body'][_0xe0bd('0x69')])){_0x338028['id']={'$notIn':_0x178398[_0xe0bd('0x41')][_0xe0bd('0x69')]};}_0x40a584=[['priority',_0xe0bd('0x6d')],['scheduledAt',_0x4dfd2a[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0xe0bd('0x70')](_0xe0bd('0x71')),['id',_0xe0bd('0x6b')]];}return db[_0xe0bd('0x3a')]['findOne']({'attributes':['id','scheduledat',_0xe0bd('0x54'),_0xe0bd('0x72')],'where':_0x338028,'order':_0x40a584,'transaction':_0x2ede67,'lock':_0x2ede67[_0xe0bd('0x73')][_0xe0bd('0x74')],'include':[{'model':db[_0xe0bd('0x57')],'as':_0xe0bd('0x75'),'attributes':_0x9d03de,'include':[{'model':db[_0xe0bd('0x76')],'as':_0xe0bd('0x77'),'attributes':['id',_0xe0bd('0x10')]}]},{'model':db[_0xe0bd('0x78')],'as':'List','attributes':['id',_0xe0bd('0x10')]},{'model':db['VoiceQueue'],'as':_0xe0bd('0x79'),'attributes':['id',_0xe0bd('0x10'),_0xe0bd('0x7a')]}]})[_0xe0bd('0xd')](function(_0x191423){if(_0x191423){return _0x191423[_0xe0bd('0xc')]({'UserId':_0x178398[_0xe0bd('0x51')]['id']},{'transaction':_0x2ede67});}});});}})['then'](handleEntityNotFound(_0x8e61d6,null))[_0xe0bd('0xd')](respondWithResult(_0x8e61d6,null))[_0xe0bd('0x3f')](handleError(_0x8e61d6,null));};exports['getPreviewRecall']=function(_0x4303ec,_0x2acb14,_0x1f230d){var _0x4fb0cb=[];var _0x5991e5=_0x4303ec[_0xe0bd('0x3d')]['id'];var _0x1cc0dd=_0x4303ec['user']['id'];return db[_0xe0bd('0x57')][_0xe0bd('0x43')]()['then'](function(_0x485bde){_0x4fb0cb=_[_0xe0bd('0x18')](_0x485bde);return db[_0xe0bd('0x6e')][_0xe0bd('0x64')](function(_0x6e9712){const _0x4e3815={'id':_0x5991e5};return db[_0xe0bd('0x3a')]['findOne']({'attributes':['id',_0xe0bd('0x7b'),_0xe0bd('0x72')],'where':_0x4e3815,'transaction':_0x6e9712,'lock':_0x6e9712[_0xe0bd('0x73')][_0xe0bd('0x74')],'include':[{'model':db[_0xe0bd('0x57')],'as':_0xe0bd('0x75'),'attributes':_0x4fb0cb,'include':[{'model':db[_0xe0bd('0x76')],'as':_0xe0bd('0x77'),'attributes':['id',_0xe0bd('0x10')]}]},{'model':db[_0xe0bd('0x78')],'as':'List','attributes':['id',_0xe0bd('0x10')]},{'model':db[_0xe0bd('0x47')],'as':_0xe0bd('0x79'),'attributes':['id','name',_0xe0bd('0x7a')]}]})[_0xe0bd('0xd')](function(_0x6a6012){if(_0x6a6012){return _0x6a6012[_0xe0bd('0xc')]({'UserId':_0x1cc0dd},{'transaction':_0x6e9712});}});});})[_0xe0bd('0xd')](handleEntityNotFound(_0x2acb14,null))[_0xe0bd('0xd')](respondWithResult(_0x2acb14,null))['catch'](handleError(_0x2acb14,null));};exports[_0xe0bd('0x7c')]=function(_0x378034,_0x17435d){return _0x378034[_0xe0bd('0x51')]['getVoiceQueues']({'where':{'type':_0xe0bd('0x7d'),'dialActive':!![],'dialMethod':_0xe0bd('0x7e')},'attributes':['id'],'raw':!![]})[_0xe0bd('0xd')](function(_0x3fb7f9){if(_0x3fb7f9&&_0x3fb7f9[_0xe0bd('0x2d')]){return db['CmHopper'][_0xe0bd('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe0bd('0x7f')](_0xe0bd('0x80'))},'VoiceQueueId':{'$in':_[_0xe0bd('0x12')](_0x3fb7f9,'id')},'$or':[{'UserId':null},{'UserId':_0x378034[_0xe0bd('0x51')]['id']}]}});}return 0x0;})[_0xe0bd('0xd')](function(_0x3a82a5){if(!_[_0xe0bd('0x5b')](_0x3a82a5)&&_[_0xe0bd('0x81')](_0x3a82a5)){return _0x17435d[_0xe0bd('0x5')](0xc8)[_0xe0bd('0x6')]({'contacts':_0x3a82a5});}else{logger[_0xe0bd('0x82')](_0xe0bd('0x83'),_0xe0bd('0x7c'),0x194,_0xe0bd('0x84'));_0x17435d[_0xe0bd('0xe')](0x194);}})[_0xe0bd('0x3f')](handleError(_0x17435d,null));};exports[_0xe0bd('0x85')]=function(_0x5a9a57,_0x9b312e){var _0x36ca72=shared[_0xe0bd('0x86')];var _0x52287d=[];_[_0xe0bd('0x12')](_0x36ca72,function(_0x1ae29c){_0x52287d[_0xe0bd('0x87')]({'id':_0x1ae29c[_0xe0bd('0x10')],'name':_0x1ae29c[_0xe0bd('0x10')],'utcOffset':_0x1ae29c[_0xe0bd('0x88')]});});return _0x9b312e[_0xe0bd('0x5')](0xc8)[_0xe0bd('0x6')]({'tz':_0x52287d});};exports[_0xe0bd('0x89')]=function(_0x531f39,_0x52a859){var _0x4e9fe0=shared[_0xe0bd('0x86')];var _0x42b1b4={};if(!_[_0xe0bd('0x5b')](_0x4e9fe0[_0x531f39['body']['id']]))_0x42b1b4=_0x4e9fe0[_0x531f39[_0xe0bd('0x41')]['id']];return _0x52a859[_0xe0bd('0x5')](0xc8)[_0xe0bd('0x6')](_0x42b1b4);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 141d2f5..a1e691e 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 _0x6f47=['CmHopper','scheduledat','phone','priority','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports','define'];(function(_0x1ee0a1,_0x51058e){var _0x1d2d5b=function(_0x35cfb5){while(--_0x35cfb5){_0x1ee0a1['push'](_0x1ee0a1['shift']());}};_0x1d2d5b(++_0x51058e);}(_0x6f47,0xc7));var _0x76f4=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x6f47[_0x42f009];return _0x22a1e0;};'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_hopper','paranoid':![],'indexes':[{'name':_0x76f4('0xa'),'fields':[_0x76f4('0xa')]},{'name':_0x76f4('0xb'),'fields':[_0x76f4('0xb')]},{'name':_0x76f4('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1883=['../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x219361,_0xe89c58){var _0x27c488=function(_0xab8dc9){while(--_0xab8dc9){_0x219361['push'](_0x219361['shift']());}};_0x27c488(++_0xe89c58);}(_0x1883,0xab));var _0x3188=function(_0x546108,_0x4d2a3c){_0x546108=_0x546108-0x0;var _0x3278f0=_0x1883[_0x546108];return _0x3278f0;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));module[_0x3188('0xb')]=function(_0x408ae0,_0x33b62d){return _0x408ae0[_0x3188('0xc')](_0x3188('0xd'),attributes,{'tableName':_0x3188('0xe'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x3188('0xf')]},{'name':_0x3188('0x10'),'fields':['phone']},{'name':_0x3188('0x11'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 0af4a74..f7da19d 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 _0x6f67=['options','raw','where','attributes','map','include','model','then','GetCmHopper','debug','catch','error','message','ShowCmHopper','CmHopper','find','info','stringify','create','body','CreateCmHopper','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','describe','transaction','limit','order','LOCK','CmContact','Contact','keys','User','Agent','name','voicePause','UserId','push','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','GetContactDialer','MoveContactManagedDialer','sequelize','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','GetContactRecallMe','UPDATE','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','lodash','util','moment','../../mysqldb','rpc','findAll'];(function(_0x4c6c3a,_0x18836d){var _0x253c13=function(_0x1a9a31){while(--_0x1a9a31){_0x4c6c3a['push'](_0x4c6c3a['shift']());}};_0x253c13(++_0x18836d);}(_0x6f67,0xf0));var _0x76f6=function(_0x187a0a,_0x2d285c){_0x187a0a=_0x187a0a-0x0;var _0x1847a6=_0x6f67[_0x187a0a];return _0x1847a6;};'use strict';var _=require(_0x76f6('0x0'));var util=require(_0x76f6('0x1'));var moment=require(_0x76f6('0x2'));var BPromise=require('bluebird');var db=require(_0x76f6('0x3'))['db'];var logger=require('../../config/logger')(_0x76f6('0x4'));exports['GetCmHopper']=function(_0x22ce4b){var _0x3806fb=this;return new Promise(function(_0x3b2546,_0x7a91ed){return db['CmHopper'][_0x76f6('0x5')]({'raw':_0x22ce4b[_0x76f6('0x6')]?_0x22ce4b[_0x76f6('0x6')][_0x76f6('0x7')]===undefined?!![]:![]:!![],'where':_0x22ce4b[_0x76f6('0x6')]?_0x22ce4b[_0x76f6('0x6')][_0x76f6('0x8')]||null:null,'attributes':_0x22ce4b[_0x76f6('0x6')]?_0x22ce4b[_0x76f6('0x6')][_0x76f6('0x9')]||null:null,'limit':_0x22ce4b['options']?_0x22ce4b[_0x76f6('0x6')]['limit']||null:null,'include':_0x22ce4b[_0x76f6('0x6')]?_0x22ce4b['options']['include']?_[_0x76f6('0xa')](_0x22ce4b[_0x76f6('0x6')][_0x76f6('0xb')],function(_0x1c8193){return{'model':db[_0x1c8193['model']],'as':_0x1c8193['as'],'attributes':_0x1c8193[_0x76f6('0x9')],'include':_0x1c8193[_0x76f6('0xb')]?_['map'](_0x1c8193[_0x76f6('0xb')],function(_0x336045){return{'model':db[_0x336045[_0x76f6('0xc')]],'as':_0x336045['as'],'attributes':_0x336045[_0x76f6('0x9')],'include':_0x336045['include']?_[_0x76f6('0xa')](_0x336045[_0x76f6('0xb')],function(_0x73a50c){return{'model':db[_0x73a50c[_0x76f6('0xc')]],'as':_0x73a50c['as'],'attributes':_0x73a50c[_0x76f6('0x9')]};}):[]};}):[]};}):[]:[]})[_0x76f6('0xd')](function(_0x2668dc){logger['info'](_0x76f6('0xe'),_0x22ce4b);logger[_0x76f6('0xf')](_0x76f6('0xe'),_0x22ce4b,JSON['stringify'](_0x2668dc));_0x3b2546(_0x2668dc);})[_0x76f6('0x10')](function(_0x2af9af){logger[_0x76f6('0x11')](_0x76f6('0xe'),_0x2af9af[_0x76f6('0x12')],_0x22ce4b);_0x7a91ed(_0x3806fb['error'](0x1f4,_0x2af9af[_0x76f6('0x12')]));});});};exports[_0x76f6('0x13')]=function(_0x390673){var _0x3b98d2=this;return new Promise(function(_0x2883fc,_0xf0d8c3){return db[_0x76f6('0x14')][_0x76f6('0x15')]({'raw':_0x390673[_0x76f6('0x6')]?_0x390673[_0x76f6('0x6')][_0x76f6('0x7')]===undefined?!![]:![]:!![],'where':_0x390673[_0x76f6('0x6')]?_0x390673[_0x76f6('0x6')][_0x76f6('0x8')]||null:null,'attributes':_0x390673['options']?_0x390673['options'][_0x76f6('0x9')]||null:null,'include':_0x390673[_0x76f6('0x6')]?_0x390673[_0x76f6('0x6')]['include']?_[_0x76f6('0xa')](_0x390673[_0x76f6('0x6')][_0x76f6('0xb')],function(_0xdd5345){return{'model':db[_0xdd5345[_0x76f6('0xc')]],'as':_0xdd5345['as'],'attributes':_0xdd5345['attributes'],'include':_0xdd5345[_0x76f6('0xb')]?_[_0x76f6('0xa')](_0xdd5345[_0x76f6('0xb')],function(_0x253eba){return{'model':db[_0x253eba['model']],'as':_0x253eba['as'],'attributes':_0x253eba[_0x76f6('0x9')],'include':_0x253eba[_0x76f6('0xb')]?_[_0x76f6('0xa')](_0x253eba[_0x76f6('0xb')],function(_0x425892){return{'model':db[_0x425892[_0x76f6('0xc')]],'as':_0x425892['as'],'attributes':_0x425892[_0x76f6('0x9')]};}):[]};}):[]};}):[]:[]})[_0x76f6('0xd')](function(_0x5eaad0){logger[_0x76f6('0x16')](_0x76f6('0x13'),_0x390673);logger['debug'](_0x76f6('0x13'),_0x390673,JSON[_0x76f6('0x17')](_0x5eaad0));_0x2883fc(_0x5eaad0);})['catch'](function(_0x51151c){logger['error'](_0x76f6('0x13'),_0x51151c[_0x76f6('0x12')],_0x390673);_0xf0d8c3(_0x3b98d2[_0x76f6('0x11')](0x1f4,_0x51151c[_0x76f6('0x12')]));});});};exports['CreateCmHopper']=function(_0xaf4261){var _0xc390b8=this;return new Promise(function(_0x3af179,_0x2b625a){return db[_0x76f6('0x14')][_0x76f6('0x18')](_0xaf4261[_0x76f6('0x19')],{'raw':_0xaf4261['options']?_0xaf4261[_0x76f6('0x6')][_0x76f6('0x7')]===undefined?!![]:![]:!![]})[_0x76f6('0xd')](function(_0x2d2251){logger[_0x76f6('0x16')](_0x76f6('0x1a'),_0xaf4261);logger[_0x76f6('0xf')](_0x76f6('0x1a'),_0xaf4261,JSON['stringify'](_0x2d2251));_0x3af179(_0x2d2251);})['catch'](function(_0x1449fa){logger['error'](_0x76f6('0x1a'),_0x1449fa['message'],_0xaf4261);_0x2b625a(_0xc390b8['error'](0x1f4,_0x1449fa['message']));});});};exports[_0x76f6('0x1b')]=function(_0x39c6e7){var _0x35a75f=this;return new Promise(function(_0x286ef5,_0x507180){return db[_0x76f6('0x14')][_0x76f6('0x1c')](_0x39c6e7[_0x76f6('0x19')],{'raw':_0x39c6e7['options']?_0x39c6e7['options'][_0x76f6('0x7')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39c6e7[_0x76f6('0x6')]?_0x39c6e7[_0x76f6('0x6')]['where']||null:null,'attributes':_0x39c6e7[_0x76f6('0x6')]?_0x39c6e7[_0x76f6('0x6')][_0x76f6('0x9')]||null:null,'limit':_0x39c6e7[_0x76f6('0x6')]?_0x39c6e7[_0x76f6('0x6')]['limit']||null:null})[_0x76f6('0xd')](function(_0x6b9ce6){logger[_0x76f6('0x16')](_0x76f6('0x1b'),_0x39c6e7);logger['info'](_0x76f6('0x1d'),JSON[_0x76f6('0x17')](_0x39c6e7['options'][_0x76f6('0x8')]),_0x39c6e7[_0x76f6('0x19')][_0x76f6('0x1e')]);logger[_0x76f6('0xf')](_0x76f6('0x1b'),_0x39c6e7,JSON[_0x76f6('0x17')](_0x6b9ce6));_0x286ef5(_0x6b9ce6);})[_0x76f6('0x10')](function(_0x5c5a46){logger[_0x76f6('0x11')](_0x76f6('0x1b'),_0x5c5a46[_0x76f6('0x12')],_0x39c6e7);_0x507180(_0x35a75f[_0x76f6('0x11')](0x1f4,_0x5c5a46[_0x76f6('0x12')]));});});};exports[_0x76f6('0x1f')]=function(_0x3ebbc6){var _0x34ff3a=this;return new Promise(function(_0x21991b,_0xc92f47){return db[_0x76f6('0x14')][_0x76f6('0x20')]({'where':_0x3ebbc6[_0x76f6('0x6')]?_0x3ebbc6['options'][_0x76f6('0x8')]||null:null})['then'](function(_0x3254cf){logger[_0x76f6('0x16')](_0x76f6('0x1f'),_0x3ebbc6);logger[_0x76f6('0xf')](_0x76f6('0x1f'),_0x3ebbc6,JSON[_0x76f6('0x17')](_0x3254cf));_0x21991b(_0x3254cf);})[_0x76f6('0x10')](function(_0x2c8c71){logger['error'](_0x76f6('0x1f'),_0x2c8c71[_0x76f6('0x12')],_0x3ebbc6);_0xc92f47(_0x34ff3a[_0x76f6('0x11')](0x1f4,_0x2c8c71[_0x76f6('0x12')]));});});};exports['GetContactDialer']=function(_0x3068d5){var _0x5ec943=this;return new Promise(function(_0x3b9c1c,_0x4b4247){return db['CmContact'][_0x76f6('0x21')]()[_0x76f6('0xd')](function(_0x5188ad){return db['sequelize'][_0x76f6('0x22')](function(_0x269c1c){return db['CmHopper'][_0x76f6('0x5')]({'where':_0x3068d5[_0x76f6('0x6')]?_0x3068d5['options'][_0x76f6('0x8')]||null:null,'attributes':_0x3068d5[_0x76f6('0x6')]?_0x3068d5[_0x76f6('0x6')][_0x76f6('0x9')]||null:null,'limit':_0x3068d5[_0x76f6('0x6')]?_0x3068d5['options'][_0x76f6('0x23')]||null:null,'order':_0x3068d5[_0x76f6('0x6')]?_0x3068d5[_0x76f6('0x6')][_0x76f6('0x24')]||null:null,'transaction':_0x269c1c,'lock':_0x269c1c[_0x76f6('0x25')]['UPDATE'],'include':[{'model':db[_0x76f6('0x26')],'as':_0x76f6('0x27'),'attributes':_[_0x76f6('0x28')](_0x5188ad)},{'model':db[_0x76f6('0x29')],'as':_0x76f6('0x2a'),'attributes':['id',_0x76f6('0x2b'),_0x76f6('0x2c')]}]})[_0x76f6('0xd')](function(_0x2372c1){var _0xf529c4=[];var _0x53d9ce=[];for(var _0x47ef36=0x0;_0x47ef36<_0x2372c1['length'];_0x47ef36+=0x1){var _0x4df99e=_0x2372c1[_0x47ef36][_0x76f6('0x2d')];if(_0x4df99e===null){_0xf529c4[_0x76f6('0x2e')](_0x2372c1[_0x47ef36][_0x76f6('0x1c')](_0x3068d5[_0x76f6('0x19')],{'transaction':_0x269c1c}));}else if(!_0x53d9ce[_0x76f6('0x2f')](_0x4df99e)){_0x53d9ce[_0x76f6('0x2e')](_0x4df99e);_0xf529c4[_0x76f6('0x2e')](_0x2372c1[_0x47ef36]['update'](_0x3068d5[_0x76f6('0x19')],{'transaction':_0x269c1c}));}}return BPromise[_0x76f6('0x30')](_0xf529c4);});})[_0x76f6('0xd')](function(_0x993d4c){logger['info']('GetContactDialer',_0x3068d5);if(_0x993d4c[_0x76f6('0x31')]>0x0){logger[_0x76f6('0x16')](_0x76f6('0x32'),_0x993d4c[0x0][_0x76f6('0x33')]['id'],_0x993d4c[0x0][_0x76f6('0x33')][_0x76f6('0x34')],_0x993d4c[0x0][_0x76f6('0x33')][_0x76f6('0x1e')]);}logger[_0x76f6('0xf')](_0x76f6('0x35'),_0x3068d5,JSON[_0x76f6('0x17')](_0x993d4c));_0x3b9c1c(_0x993d4c);})[_0x76f6('0x10')](function(_0x22083f){logger[_0x76f6('0x11')](_0x76f6('0x35'),_0x22083f['message'],_0x3068d5);_0x4b4247(_0x5ec943[_0x76f6('0x11')](0x1f4,_0x22083f['message']));});});});};exports[_0x76f6('0x36')]=function(_0x4dba4e){var _0x1d24c4=this;return new Promise(function(_0x32c4c7,_0x4911af){return db[_0x76f6('0x37')][_0x76f6('0x22')](function(_0x4e8de7){return db[_0x76f6('0x38')][_0x76f6('0x18')](_0x4dba4e[_0x76f6('0x19')],{'raw':_0x4dba4e[_0x76f6('0x6')]?_0x4dba4e[_0x76f6('0x6')][_0x76f6('0x7')]===undefined?!![]:![]:!![],'transaction':_0x4e8de7})[_0x76f6('0xd')](function(){logger['info'](_0x76f6('0x39'),JSON[_0x76f6('0x17')](_0x4dba4e[_0x76f6('0x6')][_0x76f6('0x8')]),_0x4dba4e[_0x76f6('0x6')][_0x76f6('0x8')]['active']);return db['CmHopper'][_0x76f6('0x20')]({'where':_0x4dba4e[_0x76f6('0x6')]?_0x4dba4e['options']['where']||null:null,'transaction':_0x4e8de7});});})['then'](function(_0x166bea){logger[_0x76f6('0x16')]('MoveContactManagedDialer',_0x4dba4e);logger[_0x76f6('0xf')](_0x76f6('0x36'),_0x4dba4e,JSON[_0x76f6('0x17')](_0x166bea));_0x32c4c7(_0x166bea);})[_0x76f6('0x10')](function(_0x3e83fa){logger[_0x76f6('0x11')](_0x76f6('0x36'),_0x3e83fa['message'],_0x4dba4e);_0x4911af(_0x1d24c4[_0x76f6('0x11')](0x1f4,_0x3e83fa['message']));});});};exports[_0x76f6('0x3a')]=function(_0x5eef47){var _0x221e15=this;return new Promise(function(_0x1a7532,_0x58f3be){return db[_0x76f6('0x14')][_0x76f6('0x5')]({'raw':_0x5eef47['options']?_0x5eef47[_0x76f6('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x5eef47[_0x76f6('0x6')]?_0x5eef47[_0x76f6('0x6')][_0x76f6('0x8')]||null:null,'attributes':[[db[_0x76f6('0x37')]['fn'](_0x76f6('0x3b'),db[_0x76f6('0x37')]['fn']('IF',db['sequelize'][_0x76f6('0x3c')](_0x76f6('0x3d')+util[_0x76f6('0x3e')](_0x76f6('0x3f'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0x76f6('0x40')))),'contactsRescheduled']]})[_0x76f6('0xd')](function(_0x18cbc3){logger['info'](_0x76f6('0x3a'),_0x5eef47);logger['debug'](_0x76f6('0x3a'),_0x5eef47,JSON[_0x76f6('0x17')](_0x18cbc3));_0x1a7532(_0x18cbc3);})[_0x76f6('0x10')](function(_0x5c0105){logger[_0x76f6('0x11')](_0x76f6('0x3a'),_0x5c0105['message'],_0x5eef47);_0x58f3be(_0x221e15['error'](0x1f4,_0x5c0105[_0x76f6('0x12')]));});});};exports[_0x76f6('0x41')]=function(_0x70c420){var _0x28deca=this;return new Promise(function(_0x581a9a,_0x5889be){return db['CmContact'][_0x76f6('0x21')]()[_0x76f6('0xd')](function(){return db[_0x76f6('0x37')][_0x76f6('0x22')](function(_0x5ba526){return db[_0x76f6('0x14')][_0x76f6('0x5')]({'where':_0x70c420[_0x76f6('0x6')]?_0x70c420[_0x76f6('0x6')]['where']||null:null,'attributes':_0x70c420[_0x76f6('0x6')]?_0x70c420['options']['attributes']||null:null,'limit':0x1,'order':_0x70c420[_0x76f6('0x6')]?_0x70c420[_0x76f6('0x6')]['order']||null:null,'group':db[_0x76f6('0x14')][_0x76f6('0x2d')],'transaction':_0x5ba526,'lock':_0x5ba526[_0x76f6('0x25')][_0x76f6('0x42')],'include':_0x70c420[_0x76f6('0x6')]?_0x70c420[_0x76f6('0x6')]['include']?_[_0x76f6('0xa')](_0x70c420[_0x76f6('0x6')][_0x76f6('0xb')],function(_0x41addc){return{'model':db[_0x41addc['model']],'as':_0x41addc['as'],'attributes':_0x41addc[_0x76f6('0x9')],'include':_0x41addc[_0x76f6('0xb')]?_[_0x76f6('0xa')](_0x41addc['include'],function(_0x2c6fb4){return{'model':db[_0x2c6fb4[_0x76f6('0xc')]],'as':_0x2c6fb4['as'],'attributes':_0x2c6fb4['attributes'],'include':_0x2c6fb4[_0x76f6('0xb')]?_[_0x76f6('0xa')](_0x2c6fb4['include'],function(_0x3152fa){return{'model':db[_0x3152fa['model']],'as':_0x3152fa['as'],'attributes':_0x3152fa[_0x76f6('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dffa0){var _0x420b22=[];for(var _0xc69216=0x0;_0xc69216<_0x3dffa0[_0x76f6('0x31')];_0xc69216+=0x1){_0x420b22['push'](_0x3dffa0[_0xc69216][_0x76f6('0x1c')](_0x70c420[_0x76f6('0x19')],{'transaction':_0x5ba526}));}return BPromise[_0x76f6('0x30')](_0x420b22);});})['then'](function(_0x5025f9){logger['info'](_0x76f6('0x41'),_0x70c420);logger[_0x76f6('0xf')](_0x76f6('0x41'),_0x70c420,JSON[_0x76f6('0x17')](_0x5025f9));_0x581a9a(_0x5025f9);})[_0x76f6('0x10')](function(_0x1b2c60){logger[_0x76f6('0x11')](_0x76f6('0x41'),_0x1b2c60[_0x76f6('0x12')],_0x70c420);_0x5889be(_0x28deca['error'](0x1f4,_0x1b2c60[_0x76f6('0x12')]));});});});};exports['GetCmHopperPreview']=function(_0x21e54f){var _0x5d073e=this;return new Promise(function(_0x3e9ec0,_0xde1ae9){db[_0x76f6('0x26')][_0x76f6('0x21')]()[_0x76f6('0xd')](function(_0x443908){return db['CmHopper'][_0x76f6('0x5')]({'raw':_0x21e54f['options']?_0x21e54f[_0x76f6('0x6')][_0x76f6('0x7')]===undefined?!![]:![]:!![],'where':_0x21e54f[_0x76f6('0x6')]?_0x21e54f[_0x76f6('0x6')][_0x76f6('0x8')]||null:null,'attributes':_0x21e54f[_0x76f6('0x6')]?_0x21e54f[_0x76f6('0x6')][_0x76f6('0x9')]||null:null,'limit':_0x21e54f[_0x76f6('0x6')]?_0x21e54f['options'][_0x76f6('0x23')]||null:null,'include':_0x21e54f[_0x76f6('0x6')]?_0x21e54f[_0x76f6('0x6')][_0x76f6('0xb')]?_[_0x76f6('0xa')](_0x21e54f[_0x76f6('0x6')]['include'],function(_0x17f0b5){return{'model':db[_0x17f0b5[_0x76f6('0xc')]],'as':_0x17f0b5['as'],'attributes':_0x17f0b5['as']==='Contact'?_[_0x76f6('0x28')](_0x443908):_0x17f0b5[_0x76f6('0x9')],'include':_0x17f0b5[_0x76f6('0xb')]?_[_0x76f6('0xa')](_0x17f0b5[_0x76f6('0xb')],function(_0x439e7e){return{'model':db[_0x439e7e[_0x76f6('0xc')]],'as':_0x439e7e['as'],'attributes':_0x439e7e['attributes'],'include':_0x439e7e['include']?_[_0x76f6('0xa')](_0x439e7e[_0x76f6('0xb')],function(_0x15467b){return{'model':db[_0x15467b['model']],'as':_0x15467b['as'],'attributes':_0x15467b[_0x76f6('0x9')]};}):[]};}):[]};}):[]:[]})[_0x76f6('0xd')](function(_0x23f501){logger['info'](_0x76f6('0xe'),_0x21e54f);logger[_0x76f6('0xf')]('GetCmHopper',_0x21e54f,JSON['stringify'](_0x23f501));_0x3e9ec0(_0x23f501);})['catch'](function(_0x154ead){logger[_0x76f6('0x11')](_0x76f6('0xe'),_0x154ead[_0x76f6('0x12')],_0x21e54f);_0xde1ae9(_0x5d073e[_0x76f6('0x11')](0x1f4,_0x154ead['message']));});});});};exports[_0x76f6('0x43')]=function(_0x26ef3e){var _0x23fa87=this;return new Promise(function(_0xa2c7c8,_0x4aca68){return db[_0x76f6('0x26')][_0x76f6('0x44')]({'raw':!![],'where':{'phone':_0x26ef3e[_0x76f6('0x6')][_0x76f6('0x8')][_0x76f6('0x45')]},'attributes':['id',_0x76f6('0x46')],'order':[['id',_0x76f6('0x47')]]})['then'](function(_0x1079a4){logger[_0x76f6('0x16')](_0x76f6('0x48'),_0x26ef3e);logger[_0x76f6('0xf')]('getContactByPhone',_0x26ef3e,JSON[_0x76f6('0x17')](_0x1079a4));_0xa2c7c8(_0x1079a4);})[_0x76f6('0x10')](function(_0x430cf3){logger[_0x76f6('0x11')](_0x76f6('0x48'),_0x430cf3[_0x76f6('0x12')],_0x26ef3e);_0x4aca68(_0x23fa87[_0x76f6('0x11')](0x1f4,_0x430cf3[_0x76f6('0x12')]));});});};exports[_0x76f6('0x49')]=function(_0xcb9ff6){var _0x27ab80=this;return new Promise(function(_0x3811f6,_0xa6d072){return db[_0x76f6('0x37')][_0x76f6('0x22')](function(_0x5492b7){var _0x436c8b=_0xcb9ff6[_0x76f6('0x6')]&&_0xcb9ff6['options']['where']?_0xcb9ff6['options'][_0x76f6('0x8')]:{};return db[_0x76f6('0x14')][_0x76f6('0x1c')](_0xcb9ff6['body'],{'where':_0x436c8b,'transaction':_0x5492b7})['then'](function(_0x1e7f6b){logger['info']('ResetActiveCalls',_0xcb9ff6);logger[_0x76f6('0xf')](_0x76f6('0x49'),_0xcb9ff6,JSON['stringify'](_0x1e7f6b));_0x3811f6(_0x1e7f6b);})[_0x76f6('0x10')](function(_0x5e8910){logger['error']('ResetActiveCalls',_0x5e8910[_0x76f6('0x12')],_0xcb9ff6);_0xa6d072(_0x27ab80[_0x76f6('0x11')](0x1f4,_0x5e8910[_0x76f6('0x12')]));});});});};exports[_0x76f6('0x4a')]=function(_0x1d36ce){var _0x1fc84a=this;var _0x29e6f1=_0x1d36ce[_0x76f6('0x19')][_0x76f6('0x8')][_0x76f6('0x4b')];var _0x12d292=_0x1d36ce['body'][_0x76f6('0x8')]['interval'];var _0x4b8368=_0x1d36ce[_0x76f6('0x19')]['where'][_0x76f6('0x4c')];return new Promise(function(_0x48894a,_0x3cf94b){return db[_0x76f6('0x14')]['findAll']({'where':{'voiceQueueId':{'$in':_0x29e6f1},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x76f6('0x37')][_0x76f6('0x3c')](_0x76f6('0x4d')+_0x12d292+_0x76f6('0x4e')),'$gt':db['sequelize'][_0x76f6('0x3c')](_0x76f6('0x4f'))}},'UserId':{'$in':_0x4b8368}},'include':[{'model':db[_0x76f6('0x26')],'as':_0x76f6('0x27')},{'model':db[_0x76f6('0x29')],'as':_0x76f6('0x2a'),'attributes':['id','name',_0x76f6('0x2c')]},{'model':db[_0x76f6('0x50')],'as':_0x76f6('0x51')}]})[_0x76f6('0xd')](function(_0x4660fb){if(_0x4660fb['length']>0x0){return db[_0x76f6('0x37')][_0x76f6('0x22')](function(_0x35cf79){return db[_0x76f6('0x14')][_0x76f6('0x1c')]({'recallmeNotifiedDate':db['sequelize'][_0x76f6('0x3c')]('NOW()')},{'where':{'id':{'$in':_[_0x76f6('0xa')](_0x4660fb,'id')}},'transaction':_0x35cf79})[_0x76f6('0xd')](function(){_0x48894a(_0x4660fb);})[_0x76f6('0x10')](function(_0x4986b2){logger[_0x76f6('0x11')](_0x76f6('0x4a'),_0x4986b2['message'],_0x1d36ce);_0x3cf94b(_0x1fc84a[_0x76f6('0x11')](0x1f4,_0x4986b2[_0x76f6('0x12')]));});})[_0x76f6('0x10')](function(_0x239df2){logger['error'](_0x76f6('0x4a'),_0x239df2['message'],_0x1d36ce);_0x3cf94b(_0x1fc84a[_0x76f6('0x11')](0x1f4,_0x239df2['message']));});}else{_0x48894a(_0x4660fb);}});});}; \ No newline at end of file +var _0xbc1b=['YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UserId','LOCK','GetCmHopperPreview','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','CmHopperHandlePreviewRecallNotifications','lodash','util','moment','bluebird','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','model','map','then','info','debug','stringify','catch','message','error','ShowCmHopper','find','create','body','CreateCmHopper','UpdateCmHopper','update','active','DestroyCmHopper','destroy','GetContactDialer','describe','transaction','order','UPDATE','CmContact','Contact','User','Agent','name','voicePause','length','includes','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','sequelize','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22'];(function(_0x40c9a2,_0x5b6985){var _0xc879f=function(_0x492976){while(--_0x492976){_0x40c9a2['push'](_0x40c9a2['shift']());}};_0xc879f(++_0x5b6985);}(_0xbc1b,0xb6));var _0xbbc1=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0xbc1b[_0x2e50a2];return _0x47e5de;};'use strict';var _=require(_0xbbc1('0x0'));var util=require(_0xbbc1('0x1'));var moment=require(_0xbbc1('0x2'));var BPromise=require(_0xbbc1('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xbbc1('0x4'))(_0xbbc1('0x5'));exports[_0xbbc1('0x6')]=function(_0x329a80){var _0x10e61c=this;return new Promise(function(_0x423d3e,_0xd1653b){return db[_0xbbc1('0x7')][_0xbbc1('0x8')]({'raw':_0x329a80[_0xbbc1('0x9')]?_0x329a80[_0xbbc1('0x9')][_0xbbc1('0xa')]===undefined?!![]:![]:!![],'where':_0x329a80[_0xbbc1('0x9')]?_0x329a80[_0xbbc1('0x9')][_0xbbc1('0xb')]||null:null,'attributes':_0x329a80[_0xbbc1('0x9')]?_0x329a80[_0xbbc1('0x9')][_0xbbc1('0xc')]||null:null,'limit':_0x329a80[_0xbbc1('0x9')]?_0x329a80[_0xbbc1('0x9')][_0xbbc1('0xd')]||null:null,'include':_0x329a80['options']?_0x329a80[_0xbbc1('0x9')][_0xbbc1('0xe')]?_['map'](_0x329a80[_0xbbc1('0x9')][_0xbbc1('0xe')],function(_0x4434f9){return{'model':db[_0x4434f9[_0xbbc1('0xf')]],'as':_0x4434f9['as'],'attributes':_0x4434f9[_0xbbc1('0xc')],'include':_0x4434f9['include']?_[_0xbbc1('0x10')](_0x4434f9['include'],function(_0x4fc061){return{'model':db[_0x4fc061[_0xbbc1('0xf')]],'as':_0x4fc061['as'],'attributes':_0x4fc061[_0xbbc1('0xc')],'include':_0x4fc061['include']?_[_0xbbc1('0x10')](_0x4fc061[_0xbbc1('0xe')],function(_0x48ef94){return{'model':db[_0x48ef94[_0xbbc1('0xf')]],'as':_0x48ef94['as'],'attributes':_0x48ef94[_0xbbc1('0xc')]};}):[]};}):[]};}):[]:[]})[_0xbbc1('0x11')](function(_0x15b7da){logger[_0xbbc1('0x12')](_0xbbc1('0x6'),_0x329a80);logger[_0xbbc1('0x13')](_0xbbc1('0x6'),_0x329a80,JSON[_0xbbc1('0x14')](_0x15b7da));_0x423d3e(_0x15b7da);})[_0xbbc1('0x15')](function(_0xa64ea8){logger['error'](_0xbbc1('0x6'),_0xa64ea8[_0xbbc1('0x16')],_0x329a80);_0xd1653b(_0x10e61c[_0xbbc1('0x17')](0x1f4,_0xa64ea8[_0xbbc1('0x16')]));});});};exports[_0xbbc1('0x18')]=function(_0x4a4754){var _0x369bd8=this;return new Promise(function(_0x5f59fc,_0x5d14ee){return db['CmHopper'][_0xbbc1('0x19')]({'raw':_0x4a4754[_0xbbc1('0x9')]?_0x4a4754[_0xbbc1('0x9')][_0xbbc1('0xa')]===undefined?!![]:![]:!![],'where':_0x4a4754[_0xbbc1('0x9')]?_0x4a4754[_0xbbc1('0x9')]['where']||null:null,'attributes':_0x4a4754[_0xbbc1('0x9')]?_0x4a4754['options'][_0xbbc1('0xc')]||null:null,'include':_0x4a4754[_0xbbc1('0x9')]?_0x4a4754[_0xbbc1('0x9')][_0xbbc1('0xe')]?_[_0xbbc1('0x10')](_0x4a4754[_0xbbc1('0x9')]['include'],function(_0x3d6847){return{'model':db[_0x3d6847[_0xbbc1('0xf')]],'as':_0x3d6847['as'],'attributes':_0x3d6847[_0xbbc1('0xc')],'include':_0x3d6847[_0xbbc1('0xe')]?_[_0xbbc1('0x10')](_0x3d6847[_0xbbc1('0xe')],function(_0x5dfb08){return{'model':db[_0x5dfb08['model']],'as':_0x5dfb08['as'],'attributes':_0x5dfb08[_0xbbc1('0xc')],'include':_0x5dfb08[_0xbbc1('0xe')]?_[_0xbbc1('0x10')](_0x5dfb08[_0xbbc1('0xe')],function(_0x45d1f7){return{'model':db[_0x45d1f7[_0xbbc1('0xf')]],'as':_0x45d1f7['as'],'attributes':_0x45d1f7[_0xbbc1('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x319a3e){logger['info'](_0xbbc1('0x18'),_0x4a4754);logger[_0xbbc1('0x13')]('ShowCmHopper',_0x4a4754,JSON[_0xbbc1('0x14')](_0x319a3e));_0x5f59fc(_0x319a3e);})[_0xbbc1('0x15')](function(_0x4a9750){logger['error']('ShowCmHopper',_0x4a9750['message'],_0x4a4754);_0x5d14ee(_0x369bd8[_0xbbc1('0x17')](0x1f4,_0x4a9750['message']));});});};exports['CreateCmHopper']=function(_0x263cad){var _0x2ce5a0=this;return new Promise(function(_0x1d7321,_0x43c09e){return db['CmHopper'][_0xbbc1('0x1a')](_0x263cad[_0xbbc1('0x1b')],{'raw':_0x263cad['options']?_0x263cad[_0xbbc1('0x9')][_0xbbc1('0xa')]===undefined?!![]:![]:!![]})['then'](function(_0x15d09e){logger[_0xbbc1('0x12')]('CreateCmHopper',_0x263cad);logger[_0xbbc1('0x13')]('CreateCmHopper',_0x263cad,JSON[_0xbbc1('0x14')](_0x15d09e));_0x1d7321(_0x15d09e);})[_0xbbc1('0x15')](function(_0x13fe0e){logger[_0xbbc1('0x17')](_0xbbc1('0x1c'),_0x13fe0e[_0xbbc1('0x16')],_0x263cad);_0x43c09e(_0x2ce5a0[_0xbbc1('0x17')](0x1f4,_0x13fe0e[_0xbbc1('0x16')]));});});};exports[_0xbbc1('0x1d')]=function(_0x2bbb2b){var _0x3a4c10=this;return new Promise(function(_0x9f2c0b,_0x29f62e){return db[_0xbbc1('0x7')][_0xbbc1('0x1e')](_0x2bbb2b[_0xbbc1('0x1b')],{'raw':_0x2bbb2b[_0xbbc1('0x9')]?_0x2bbb2b[_0xbbc1('0x9')][_0xbbc1('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bbb2b['options']?_0x2bbb2b[_0xbbc1('0x9')]['where']||null:null,'attributes':_0x2bbb2b['options']?_0x2bbb2b[_0xbbc1('0x9')][_0xbbc1('0xc')]||null:null,'limit':_0x2bbb2b[_0xbbc1('0x9')]?_0x2bbb2b['options'][_0xbbc1('0xd')]||null:null})['then'](function(_0x36f33c){logger[_0xbbc1('0x12')](_0xbbc1('0x1d'),_0x2bbb2b);logger[_0xbbc1('0x12')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x2bbb2b['options'][_0xbbc1('0xb')]),_0x2bbb2b[_0xbbc1('0x1b')][_0xbbc1('0x1f')]);logger['debug']('UpdateCmHopper',_0x2bbb2b,JSON[_0xbbc1('0x14')](_0x36f33c));_0x9f2c0b(_0x36f33c);})['catch'](function(_0x118b49){logger[_0xbbc1('0x17')](_0xbbc1('0x1d'),_0x118b49['message'],_0x2bbb2b);_0x29f62e(_0x3a4c10['error'](0x1f4,_0x118b49[_0xbbc1('0x16')]));});});};exports[_0xbbc1('0x20')]=function(_0x5f1db){var _0x61fd86=this;return new Promise(function(_0x3acc83,_0x57b149){return db[_0xbbc1('0x7')][_0xbbc1('0x21')]({'where':_0x5f1db[_0xbbc1('0x9')]?_0x5f1db[_0xbbc1('0x9')][_0xbbc1('0xb')]||null:null})['then'](function(_0x1cd257){logger[_0xbbc1('0x12')]('DestroyCmHopper',_0x5f1db);logger[_0xbbc1('0x13')](_0xbbc1('0x20'),_0x5f1db,JSON[_0xbbc1('0x14')](_0x1cd257));_0x3acc83(_0x1cd257);})[_0xbbc1('0x15')](function(_0x1c9694){logger[_0xbbc1('0x17')]('DestroyCmHopper',_0x1c9694[_0xbbc1('0x16')],_0x5f1db);_0x57b149(_0x61fd86[_0xbbc1('0x17')](0x1f4,_0x1c9694[_0xbbc1('0x16')]));});});};exports[_0xbbc1('0x22')]=function(_0x178580){var _0x3d53a9=this;return new Promise(function(_0x404895,_0x131da3){return db['CmContact'][_0xbbc1('0x23')]()['then'](function(_0x1d8428){return db['sequelize'][_0xbbc1('0x24')](function(_0x9b7c81){return db['CmHopper'][_0xbbc1('0x8')]({'where':_0x178580[_0xbbc1('0x9')]?_0x178580['options'][_0xbbc1('0xb')]||null:null,'attributes':_0x178580[_0xbbc1('0x9')]?_0x178580[_0xbbc1('0x9')]['attributes']||null:null,'limit':_0x178580['options']?_0x178580[_0xbbc1('0x9')][_0xbbc1('0xd')]||null:null,'order':_0x178580[_0xbbc1('0x9')]?_0x178580[_0xbbc1('0x9')][_0xbbc1('0x25')]||null:null,'transaction':_0x9b7c81,'lock':_0x9b7c81['LOCK'][_0xbbc1('0x26')],'include':[{'model':db[_0xbbc1('0x27')],'as':_0xbbc1('0x28'),'attributes':_['keys'](_0x1d8428)},{'model':db[_0xbbc1('0x29')],'as':_0xbbc1('0x2a'),'attributes':['id',_0xbbc1('0x2b'),_0xbbc1('0x2c')]}]})[_0xbbc1('0x11')](function(_0x47fd4c){var _0x44f45b=[];var _0x3f719f=[];for(var _0x864752=0x0;_0x864752<_0x47fd4c[_0xbbc1('0x2d')];_0x864752+=0x1){var _0x482fd1=_0x47fd4c[_0x864752]['UserId'];if(_0x482fd1===null){_0x44f45b['push'](_0x47fd4c[_0x864752][_0xbbc1('0x1e')](_0x178580[_0xbbc1('0x1b')],{'transaction':_0x9b7c81}));}else if(!_0x3f719f[_0xbbc1('0x2e')](_0x482fd1)){_0x3f719f['push'](_0x482fd1);_0x44f45b[_0xbbc1('0x2f')](_0x47fd4c[_0x864752][_0xbbc1('0x1e')](_0x178580[_0xbbc1('0x1b')],{'transaction':_0x9b7c81}));}}return BPromise[_0xbbc1('0x30')](_0x44f45b);});})[_0xbbc1('0x11')](function(_0x3220ac){logger['info'](_0xbbc1('0x22'),_0x178580);if(_0x3220ac[_0xbbc1('0x2d')]>0x0){logger['info'](_0xbbc1('0x31'),_0x3220ac[0x0]['dataValues']['id'],_0x3220ac[0x0]['dataValues'][_0xbbc1('0x32')],_0x3220ac[0x0]['dataValues'][_0xbbc1('0x1f')]);}logger['debug'](_0xbbc1('0x22'),_0x178580,JSON['stringify'](_0x3220ac));_0x404895(_0x3220ac);})[_0xbbc1('0x15')](function(_0x58e3a8){logger[_0xbbc1('0x17')](_0xbbc1('0x22'),_0x58e3a8['message'],_0x178580);_0x131da3(_0x3d53a9['error'](0x1f4,_0x58e3a8[_0xbbc1('0x16')]));});});});};exports[_0xbbc1('0x33')]=function(_0x2b0fe6){var _0x4ac138=this;return new Promise(function(_0x587cb4,_0x39678a){return db['sequelize'][_0xbbc1('0x24')](function(_0x2abd27){return db[_0xbbc1('0x34')][_0xbbc1('0x1a')](_0x2b0fe6[_0xbbc1('0x1b')],{'raw':_0x2b0fe6[_0xbbc1('0x9')]?_0x2b0fe6[_0xbbc1('0x9')]['raw']===undefined?!![]:![]:!![],'transaction':_0x2abd27})[_0xbbc1('0x11')](function(){logger['info'](_0xbbc1('0x35'),JSON['stringify'](_0x2b0fe6[_0xbbc1('0x9')][_0xbbc1('0xb')]),_0x2b0fe6[_0xbbc1('0x9')][_0xbbc1('0xb')][_0xbbc1('0x1f')]);return db[_0xbbc1('0x7')][_0xbbc1('0x21')]({'where':_0x2b0fe6[_0xbbc1('0x9')]?_0x2b0fe6[_0xbbc1('0x9')][_0xbbc1('0xb')]||null:null,'transaction':_0x2abd27});});})[_0xbbc1('0x11')](function(_0x46cde8){logger['info'](_0xbbc1('0x33'),_0x2b0fe6);logger[_0xbbc1('0x13')](_0xbbc1('0x33'),_0x2b0fe6,JSON[_0xbbc1('0x14')](_0x46cde8));_0x587cb4(_0x46cde8);})[_0xbbc1('0x15')](function(_0x1bab72){logger[_0xbbc1('0x17')](_0xbbc1('0x33'),_0x1bab72['message'],_0x2b0fe6);_0x39678a(_0x4ac138[_0xbbc1('0x17')](0x1f4,_0x1bab72[_0xbbc1('0x16')]));});});};exports[_0xbbc1('0x36')]=function(_0xa893ad){var _0x4c5594=this;return new Promise(function(_0x2e6326,_0xcfac27){return db[_0xbbc1('0x7')][_0xbbc1('0x8')]({'raw':_0xa893ad[_0xbbc1('0x9')]?_0xa893ad[_0xbbc1('0x9')][_0xbbc1('0xa')]===undefined?!![]:![]:!![],'where':_0xa893ad[_0xbbc1('0x9')]?_0xa893ad[_0xbbc1('0x9')][_0xbbc1('0xb')]||null:null,'attributes':[[db[_0xbbc1('0x37')]['fn'](_0xbbc1('0x38'),db['sequelize']['fn']('IF',db[_0xbbc1('0x37')][_0xbbc1('0x39')](_0xbbc1('0x3a')+util[_0xbbc1('0x3b')](_0xbbc1('0x3c'),moment()[_0xbbc1('0x3b')](_0xbbc1('0x3d')))+_0xbbc1('0x3e')))),_0xbbc1('0x3f')]]})['then'](function(_0x564b3b){logger['info'](_0xbbc1('0x36'),_0xa893ad);logger[_0xbbc1('0x13')](_0xbbc1('0x36'),_0xa893ad,JSON[_0xbbc1('0x14')](_0x564b3b));_0x2e6326(_0x564b3b);})[_0xbbc1('0x15')](function(_0x474e81){logger[_0xbbc1('0x17')](_0xbbc1('0x36'),_0x474e81['message'],_0xa893ad);_0xcfac27(_0x4c5594['error'](0x1f4,_0x474e81[_0xbbc1('0x16')]));});});};exports[_0xbbc1('0x40')]=function(_0x326b39){var _0x1838e7=this;return new Promise(function(_0x23bbe9,_0x4bb450){return db['CmContact'][_0xbbc1('0x23')]()[_0xbbc1('0x11')](function(){return db['sequelize'][_0xbbc1('0x24')](function(_0x35ea6c){return db[_0xbbc1('0x7')]['findAll']({'where':_0x326b39['options']?_0x326b39[_0xbbc1('0x9')][_0xbbc1('0xb')]||null:null,'attributes':_0x326b39[_0xbbc1('0x9')]?_0x326b39[_0xbbc1('0x9')][_0xbbc1('0xc')]||null:null,'limit':0x1,'order':_0x326b39['options']?_0x326b39[_0xbbc1('0x9')][_0xbbc1('0x25')]||null:null,'group':db['CmHopper'][_0xbbc1('0x41')],'transaction':_0x35ea6c,'lock':_0x35ea6c[_0xbbc1('0x42')]['UPDATE'],'include':_0x326b39[_0xbbc1('0x9')]?_0x326b39[_0xbbc1('0x9')]['include']?_['map'](_0x326b39['options'][_0xbbc1('0xe')],function(_0x27b084){return{'model':db[_0x27b084[_0xbbc1('0xf')]],'as':_0x27b084['as'],'attributes':_0x27b084[_0xbbc1('0xc')],'include':_0x27b084[_0xbbc1('0xe')]?_[_0xbbc1('0x10')](_0x27b084[_0xbbc1('0xe')],function(_0x16e668){return{'model':db[_0x16e668[_0xbbc1('0xf')]],'as':_0x16e668['as'],'attributes':_0x16e668[_0xbbc1('0xc')],'include':_0x16e668['include']?_[_0xbbc1('0x10')](_0x16e668['include'],function(_0x266839){return{'model':db[_0x266839['model']],'as':_0x266839['as'],'attributes':_0x266839[_0xbbc1('0xc')]};}):[]};}):[]};}):[]:[]})[_0xbbc1('0x11')](function(_0x339179){var _0x5a1392=[];for(var _0x355f7c=0x0;_0x355f7c<_0x339179['length'];_0x355f7c+=0x1){_0x5a1392['push'](_0x339179[_0x355f7c][_0xbbc1('0x1e')](_0x326b39['body'],{'transaction':_0x35ea6c}));}return BPromise[_0xbbc1('0x30')](_0x5a1392);});})[_0xbbc1('0x11')](function(_0x19f5ee){logger['info'](_0xbbc1('0x40'),_0x326b39);logger[_0xbbc1('0x13')](_0xbbc1('0x40'),_0x326b39,JSON[_0xbbc1('0x14')](_0x19f5ee));_0x23bbe9(_0x19f5ee);})['catch'](function(_0x4e761f){logger[_0xbbc1('0x17')](_0xbbc1('0x40'),_0x4e761f[_0xbbc1('0x16')],_0x326b39);_0x4bb450(_0x1838e7[_0xbbc1('0x17')](0x1f4,_0x4e761f[_0xbbc1('0x16')]));});});});};exports[_0xbbc1('0x43')]=function(_0x2cf518){var _0x2a63f2=this;return new Promise(function(_0x3b4496,_0x48f49d){db['CmContact'][_0xbbc1('0x23')]()[_0xbbc1('0x11')](function(_0x1b0718){return db[_0xbbc1('0x7')][_0xbbc1('0x8')]({'raw':_0x2cf518[_0xbbc1('0x9')]?_0x2cf518[_0xbbc1('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x2cf518[_0xbbc1('0x9')]?_0x2cf518[_0xbbc1('0x9')][_0xbbc1('0xb')]||null:null,'attributes':_0x2cf518[_0xbbc1('0x9')]?_0x2cf518['options']['attributes']||null:null,'limit':_0x2cf518[_0xbbc1('0x9')]?_0x2cf518[_0xbbc1('0x9')][_0xbbc1('0xd')]||null:null,'include':_0x2cf518[_0xbbc1('0x9')]?_0x2cf518['options'][_0xbbc1('0xe')]?_[_0xbbc1('0x10')](_0x2cf518[_0xbbc1('0x9')]['include'],function(_0x13a7a9){return{'model':db[_0x13a7a9[_0xbbc1('0xf')]],'as':_0x13a7a9['as'],'attributes':_0x13a7a9['as']===_0xbbc1('0x28')?_['keys'](_0x1b0718):_0x13a7a9[_0xbbc1('0xc')],'include':_0x13a7a9[_0xbbc1('0xe')]?_[_0xbbc1('0x10')](_0x13a7a9[_0xbbc1('0xe')],function(_0x182079){return{'model':db[_0x182079[_0xbbc1('0xf')]],'as':_0x182079['as'],'attributes':_0x182079[_0xbbc1('0xc')],'include':_0x182079[_0xbbc1('0xe')]?_[_0xbbc1('0x10')](_0x182079[_0xbbc1('0xe')],function(_0x5558d9){return{'model':db[_0x5558d9[_0xbbc1('0xf')]],'as':_0x5558d9['as'],'attributes':_0x5558d9[_0xbbc1('0xc')]};}):[]};}):[]};}):[]:[]})[_0xbbc1('0x11')](function(_0x24ab42){logger[_0xbbc1('0x12')](_0xbbc1('0x6'),_0x2cf518);logger[_0xbbc1('0x13')]('GetCmHopper',_0x2cf518,JSON[_0xbbc1('0x14')](_0x24ab42));_0x3b4496(_0x24ab42);})[_0xbbc1('0x15')](function(_0x357619){logger[_0xbbc1('0x17')](_0xbbc1('0x6'),_0x357619['message'],_0x2cf518);_0x48f49d(_0x2a63f2['error'](0x1f4,_0x357619[_0xbbc1('0x16')]));});});});};exports['GetContactByPhone']=function(_0x407cd4){var _0x341a86=this;return new Promise(function(_0xcdbfec,_0x191c7a){return db['CmContact'][_0xbbc1('0x44')]({'raw':!![],'where':{'phone':_0x407cd4['options'][_0xbbc1('0xb')][_0xbbc1('0x45')]},'attributes':['id',_0xbbc1('0x46')],'order':[['id','DESC']]})[_0xbbc1('0x11')](function(_0x4a2aa0){logger[_0xbbc1('0x12')]('getContactByPhone',_0x407cd4);logger[_0xbbc1('0x13')](_0xbbc1('0x47'),_0x407cd4,JSON[_0xbbc1('0x14')](_0x4a2aa0));_0xcdbfec(_0x4a2aa0);})[_0xbbc1('0x15')](function(_0x31832d){logger[_0xbbc1('0x17')]('getContactByPhone',_0x31832d[_0xbbc1('0x16')],_0x407cd4);_0x191c7a(_0x341a86['error'](0x1f4,_0x31832d[_0xbbc1('0x16')]));});});};exports[_0xbbc1('0x48')]=function(_0x2e3fa4){var _0x5bea06=this;return new Promise(function(_0x201d67,_0x68559d){return db[_0xbbc1('0x37')][_0xbbc1('0x24')](function(_0xf09044){var _0x1e4fbf=_0x2e3fa4[_0xbbc1('0x9')]&&_0x2e3fa4[_0xbbc1('0x9')][_0xbbc1('0xb')]?_0x2e3fa4[_0xbbc1('0x9')][_0xbbc1('0xb')]:{};return db[_0xbbc1('0x7')][_0xbbc1('0x1e')](_0x2e3fa4['body'],{'where':_0x1e4fbf,'transaction':_0xf09044})['then'](function(_0x8aeba2){logger['info']('ResetActiveCalls',_0x2e3fa4);logger['debug'](_0xbbc1('0x48'),_0x2e3fa4,JSON['stringify'](_0x8aeba2));_0x201d67(_0x8aeba2);})[_0xbbc1('0x15')](function(_0x4246aa){logger['error'](_0xbbc1('0x48'),_0x4246aa['message'],_0x2e3fa4);_0x68559d(_0x5bea06[_0xbbc1('0x17')](0x1f4,_0x4246aa['message']));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x50fa21){var _0x135a7e=this;var _0x40dd9e=_0x50fa21[_0xbbc1('0x1b')][_0xbbc1('0xb')]['voiceQueueIds'];var _0x3007bb=_0x50fa21[_0xbbc1('0x1b')][_0xbbc1('0xb')][_0xbbc1('0x49')];var _0x4b5a1c=_0x50fa21[_0xbbc1('0x1b')][_0xbbc1('0xb')][_0xbbc1('0x4a')];return new Promise(function(_0x21ff2f,_0x6f1024){return db[_0xbbc1('0x7')][_0xbbc1('0x8')]({'where':{'voiceQueueId':{'$in':_0x40dd9e},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal'](_0xbbc1('0x4b')+_0x3007bb+_0xbbc1('0x4c')),'$gt':db[_0xbbc1('0x37')][_0xbbc1('0x39')](_0xbbc1('0x4d'))}},'UserId':{'$in':_0x4b5a1c}},'include':[{'model':db[_0xbbc1('0x27')],'as':_0xbbc1('0x28')},{'model':db['User'],'as':_0xbbc1('0x2a'),'attributes':['id',_0xbbc1('0x2b'),_0xbbc1('0x2c')]},{'model':db[_0xbbc1('0x4e')],'as':_0xbbc1('0x4f')}]})['then'](function(_0x112f01){if(_0x112f01[_0xbbc1('0x2d')]>0x0){return db[_0xbbc1('0x37')][_0xbbc1('0x24')](function(_0x514034){return db[_0xbbc1('0x7')][_0xbbc1('0x1e')]({'recallmeNotifiedDate':db['sequelize'][_0xbbc1('0x39')](_0xbbc1('0x4d'))},{'where':{'id':{'$in':_['map'](_0x112f01,'id')}},'transaction':_0x514034})['then'](function(){_0x21ff2f(_0x112f01);})[_0xbbc1('0x15')](function(_0x1c4540){logger[_0xbbc1('0x17')](_0xbbc1('0x50'),_0x1c4540[_0xbbc1('0x16')],_0x50fa21);_0x6f1024(_0x135a7e['error'](0x1f4,_0x1c4540[_0xbbc1('0x16')]));});})[_0xbbc1('0x15')](function(_0xc89939){logger[_0xbbc1('0x17')]('CmHopperHandlePreviewRecallNotifications',_0xc89939['message'],_0x50fa21);_0x6f1024(_0x135a7e[_0xbbc1('0x17')](0x1f4,_0xc89939['message']));});}else{_0x21ff2f(_0x112f01);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 34541bf..0df9016 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 _0x7d06=['exports','./cmHopper.controller','get','isAuthenticated','/opencontacts','getOpenContacts','getTimezones','/:id','getPreviewRecall','post','/timezone','getTimezone','put','update','delete','destroy'];(function(_0x491ee6,_0x290b18){var _0x541e79=function(_0x4f1b11){while(--_0x4f1b11){_0x491ee6['push'](_0x491ee6['shift']());}};_0x541e79(++_0x290b18);}(_0x7d06,0x141));var _0x67d0=function(_0x40392e,_0x4fb35d){_0x40392e=_0x40392e-0x0;var _0x54012d=_0x7d06[_0x40392e];return _0x54012d;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x67d0('0x0'));router[_0x67d0('0x1')]('/',auth[_0x67d0('0x2')](),controller['index']);router['get']('/describe',auth[_0x67d0('0x2')](),controller['describe']);router[_0x67d0('0x1')](_0x67d0('0x3'),auth[_0x67d0('0x2')](),controller[_0x67d0('0x4')]);router[_0x67d0('0x1')]('/timezones',auth[_0x67d0('0x2')](),controller[_0x67d0('0x5')]);router[_0x67d0('0x1')](_0x67d0('0x6'),auth['isAuthenticated'](),controller['show']);router[_0x67d0('0x1')]('/:id/previewrecall',auth['isAuthenticated'](),controller[_0x67d0('0x7')]);router[_0x67d0('0x8')]('/',auth[_0x67d0('0x2')](),controller['create']);router['post']('/preview',auth[_0x67d0('0x2')](),controller['getPreview']);router[_0x67d0('0x8')](_0x67d0('0x9'),auth[_0x67d0('0x2')](),controller[_0x67d0('0xa')]);router[_0x67d0('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x67d0('0xc')]);router[_0x67d0('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x67d0('0xe')]);module[_0x67d0('0xf')]=router; \ No newline at end of file +var _0x7834=['Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','/:id/previewrecall','post','create','/timezone','getTimezone','put','delete','destroy','exports'];(function(_0x13adc2,_0x456fac){var _0x46f01f=function(_0x7bc52d){while(--_0x7bc52d){_0x13adc2['push'](_0x13adc2['shift']());}};_0x46f01f(++_0x456fac);}(_0x7834,0x160));var _0x4783=function(_0x113974,_0x4850e4){_0x113974=_0x113974-0x0;var _0x1b242f=_0x7834[_0x113974];return _0x1b242f;};'use strict';var express=require('express');var router=express[_0x4783('0x0')]();var auth=require(_0x4783('0x1'));var controller=require(_0x4783('0x2'));router[_0x4783('0x3')]('/',auth[_0x4783('0x4')](),controller[_0x4783('0x5')]);router[_0x4783('0x3')](_0x4783('0x6'),auth[_0x4783('0x4')](),controller[_0x4783('0x7')]);router['get'](_0x4783('0x8'),auth[_0x4783('0x4')](),controller[_0x4783('0x9')]);router[_0x4783('0x3')]('/timezones',auth[_0x4783('0x4')](),controller[_0x4783('0xa')]);router[_0x4783('0x3')](_0x4783('0xb'),auth['isAuthenticated'](),controller[_0x4783('0xc')]);router[_0x4783('0x3')](_0x4783('0xd'),auth[_0x4783('0x4')](),controller['getPreviewRecall']);router[_0x4783('0xe')]('/',auth['isAuthenticated'](),controller[_0x4783('0xf')]);router['post']('/preview',auth['isAuthenticated'](),controller['getPreview']);router[_0x4783('0xe')](_0x4783('0x10'),auth[_0x4783('0x4')](),controller[_0x4783('0x11')]);router[_0x4783('0x12')](_0x4783('0xb'),auth[_0x4783('0x4')](),controller['update']);router[_0x4783('0x13')](_0x4783('0xb'),auth['isAuthenticated'](),controller[_0x4783('0x14')]);module[_0x4783('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 08686aa..a4fd4ac 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 _0xe25a=['INTEGER','STRING','DATE','format','moment','exports'];(function(_0x40c402,_0x42ee7d){var _0x4e7680=function(_0x52b150){while(--_0x52b150){_0x40c402['push'](_0x40c402['shift']());}};_0x4e7680(++_0x42ee7d);}(_0xe25a,0x19c));var _0xae25=function(_0x50b6ca,_0x5e83dc){_0x50b6ca=_0x50b6ca-0x0;var _0x3f874d=_0xe25a[_0x50b6ca];return _0x3f874d;};'use strict';var moment=require(_0xae25('0x0'));var Sequelize=require('sequelize');module[_0xae25('0x1')]={'CmHopperId':{'type':Sequelize[_0xae25('0x2')]},'phone':{'type':Sequelize[_0xae25('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xae25('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xae25('0x4')],'defaultValue':moment()[_0xae25('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xae25('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xae25('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xae25('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xae25('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xae25('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xae25('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1378=['sequelize','exports','INTEGER','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0x1378,0x1e2));var _0x8137=function(_0x38b047,_0xeec7a2){_0x38b047=_0x38b047-0x0;var _0x20af37=_0x1378[_0x38b047];return _0x20af37;};'use strict';var moment=require(_0x8137('0x0'));var Sequelize=require(_0x8137('0x1'));module[_0x8137('0x2')]={'CmHopperId':{'type':Sequelize[_0x8137('0x3')]},'phone':{'type':Sequelize[_0x8137('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x8137('0x5')],'defaultValue':moment()['format'](_0x8137('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8137('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8137('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x8137('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8137('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8137('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 503155f..c0aa6ea 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 _0x5c1c=['index','map','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','CmHopperAdditionalPhone','include','catch','show','keys','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send'];(function(_0x1061b2,_0xda0e95){var _0x167d94=function(_0x231114){while(--_0x231114){_0x1061b2['push'](_0x1061b2['shift']());}};_0x167d94(++_0xda0e95);}(_0x5c1c,0x1a9));var _0xc5c1=function(_0x42dd53,_0x4da3c7){_0x42dd53=_0x42dd53-0x0;var _0x3ea6d6=_0x5c1c[_0x42dd53];return _0x3ea6d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc5c1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc5c1('0x1'));var rp=require(_0xc5c1('0x2'));var moment=require(_0xc5c1('0x3'));var BPromise=require(_0xc5c1('0x4'));var Mustache=require(_0xc5c1('0x5'));var util=require(_0xc5c1('0x6'));var path=require(_0xc5c1('0x7'));var sox=require(_0xc5c1('0x8'));var csv=require(_0xc5c1('0x9'));var ejs=require(_0xc5c1('0xa'));var fs=require('fs');var fs_extra=require(_0xc5c1('0xb'));var _=require(_0xc5c1('0xc'));var squel=require(_0xc5c1('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc5c1('0xe'));var toCsv=require(_0xc5c1('0x9'));var querystring=require(_0xc5c1('0xf'));var Papa=require('papaparse');var Redis=require(_0xc5c1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc5c1('0x11'));var as=require(_0xc5c1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc5c1('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xc5c1('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc5c1('0x15'))['db'];function respondWithStatusCode(_0x55844d,_0x16ddcd){_0x16ddcd=_0x16ddcd||0xcc;return function(_0xacc03a){if(_0xacc03a){return _0x55844d[_0xc5c1('0x16')](_0x16ddcd);}return _0x55844d['status'](_0x16ddcd)[_0xc5c1('0x17')]();};}function respondWithResult(_0x185c74,_0x48deff){_0x48deff=_0x48deff||0xc8;return function(_0x1af3d5){if(_0x1af3d5){return _0x185c74['status'](_0x48deff)[_0xc5c1('0x18')](_0x1af3d5);}};}function respondWithFilteredResult(_0x4a4ae6,_0x5964bc){return function(_0x3f1b9c){if(_0x3f1b9c){var _0x3afff3=typeof _0x5964bc[_0xc5c1('0x19')]===_0xc5c1('0x1a')&&typeof _0x5964bc[_0xc5c1('0x1b')]==='undefined';var _0x20df9c=_0x3f1b9c[_0xc5c1('0x1c')];var _0x5d28a2=_0x3afff3?0x0:_0x5964bc[_0xc5c1('0x19')];var _0x20f78e=_0x3afff3?_0x3f1b9c[_0xc5c1('0x1c')]:_0x5964bc[_0xc5c1('0x19')]+_0x5964bc[_0xc5c1('0x1b')];var _0x352fe9;if(_0x20f78e>=_0x20df9c){_0x20f78e=_0x20df9c;_0x352fe9=0xc8;}else{_0x352fe9=0xce;}_0x4a4ae6[_0xc5c1('0x1d')](_0x352fe9);return _0x4a4ae6[_0xc5c1('0x1e')]('Content-Range',_0x5d28a2+'-'+_0x20f78e+'/'+_0x20df9c)[_0xc5c1('0x18')](_0x3f1b9c);}return null;};}function patchUpdates(_0x591ba4){return function(_0x5dda69){try{jsonpatch[_0xc5c1('0x1f')](_0x5dda69,_0x591ba4,!![]);}catch(_0x14b291){return BPromise['reject'](_0x14b291);}return _0x5dda69[_0xc5c1('0x20')]();};}function saveUpdates(_0x35cc0f,_0x1cd169){return function(_0x989866){if(_0x989866){return _0x989866[_0xc5c1('0x21')](_0x35cc0f)[_0xc5c1('0x22')](function(_0x47f646){return _0x47f646;});}return null;};}function removeEntity(_0x1828cd,_0x1986c4){return function(_0x847f3c){if(_0x847f3c){return _0x847f3c[_0xc5c1('0x23')]()['then'](function(){var _0x34469a=_0x847f3c[_0xc5c1('0x24')]({'plain':!![]});var _0x267771=_0xc5c1('0x25');return db[_0xc5c1('0x26')][_0xc5c1('0x23')]({'where':{'type':_0x267771,'resourceId':_0x34469a['id']}})['then'](function(){return _0x847f3c;});})[_0xc5c1('0x22')](function(){_0x1828cd[_0xc5c1('0x1d')](0xcc)[_0xc5c1('0x17')]();});}};}function handleEntityNotFound(_0x43c14d,_0x12ca64){return function(_0x9f6e9c){if(!_0x9f6e9c){_0x43c14d['sendStatus'](0x194);}return _0x9f6e9c;};}function handleError(_0x481123,_0x209c2b){_0x209c2b=_0x209c2b||0x1f4;return function(_0x92c1b0){logger[_0xc5c1('0x27')](_0x92c1b0[_0xc5c1('0x28')]);if(_0x92c1b0[_0xc5c1('0x29')]){delete _0x92c1b0['name'];}_0x481123['status'](_0x209c2b)[_0xc5c1('0x2a')](_0x92c1b0);};}exports[_0xc5c1('0x2b')]=function(_0x3cf565,_0x21ae3d){var _0x5e3594={},_0x3b0fe8={},_0x2e473d={'count':0x0,'rows':[]};var _0xfe8822=_[_0xc5c1('0x2c')](db['CmHopperAdditionalPhone']['rawAttributes'],function(_0x2b6065){return{'name':_0x2b6065[_0xc5c1('0x2d')],'type':_0x2b6065[_0xc5c1('0x2e')]['key']};});_0x3b0fe8[_0xc5c1('0x2f')]=_[_0xc5c1('0x2c')](_0xfe8822,_0xc5c1('0x29'));_0x3b0fe8[_0xc5c1('0x30')]=_['keys'](_0x3cf565[_0xc5c1('0x30')]);_0x3b0fe8[_0xc5c1('0x31')]=_[_0xc5c1('0x32')](_0x3b0fe8[_0xc5c1('0x2f')],_0x3b0fe8[_0xc5c1('0x30')]);_0x5e3594[_0xc5c1('0x33')]=_['intersection'](_0x3b0fe8[_0xc5c1('0x2f')],qs[_0xc5c1('0x34')](_0x3cf565[_0xc5c1('0x30')]['fields']));_0x5e3594['attributes']=_0x5e3594[_0xc5c1('0x33')][_0xc5c1('0x35')]?_0x5e3594['attributes']:_0x3b0fe8['model'];if(!_0x3cf565['query'][_0xc5c1('0x36')](_0xc5c1('0x37'))){_0x5e3594[_0xc5c1('0x1b')]=qs['limit'](_0x3cf565[_0xc5c1('0x30')][_0xc5c1('0x1b')]);_0x5e3594[_0xc5c1('0x19')]=qs[_0xc5c1('0x19')](_0x3cf565[_0xc5c1('0x30')][_0xc5c1('0x19')]);}_0x5e3594['order']=qs[_0xc5c1('0x38')](_0x3cf565[_0xc5c1('0x30')][_0xc5c1('0x38')]);_0x5e3594[_0xc5c1('0x39')]=qs[_0xc5c1('0x31')](_[_0xc5c1('0x3a')](_0x3cf565[_0xc5c1('0x30')],_0x3b0fe8[_0xc5c1('0x31')]),_0xfe8822);if(_0x3cf565['query'][_0xc5c1('0x3b')]){_0x5e3594[_0xc5c1('0x39')]=_[_0xc5c1('0x3c')](_0x5e3594[_0xc5c1('0x39')],{'$or':_[_0xc5c1('0x2c')](_0xfe8822,function(_0x9d044a){if(_0x9d044a[_0xc5c1('0x2e')]!==_0xc5c1('0x3d')){var _0x541000={};_0x541000[_0x9d044a[_0xc5c1('0x29')]]={'$like':'%'+_0x3cf565[_0xc5c1('0x30')][_0xc5c1('0x3b')]+'%'};return _0x541000;}})});}_0x5e3594=_[_0xc5c1('0x3c')]({},_0x5e3594,_0x3cf565['options']);var _0x1555da={'where':_0x5e3594['where']};return db[_0xc5c1('0x3e')][_0xc5c1('0x1c')](_0x1555da)['then'](function(_0x4c1b9a){_0x2e473d['count']=_0x4c1b9a;if(_0x3cf565[_0xc5c1('0x30')]['includeAll']){_0x5e3594[_0xc5c1('0x3f')]=[{'all':!![]}];}return db[_0xc5c1('0x3e')]['findAll'](_0x5e3594);})['then'](function(_0x2bc1df){_0x2e473d['rows']=_0x2bc1df;return _0x2e473d;})[_0xc5c1('0x22')](respondWithFilteredResult(_0x21ae3d,_0x5e3594))[_0xc5c1('0x40')](handleError(_0x21ae3d,null));};exports[_0xc5c1('0x41')]=function(_0x4376ee,_0x4a92ff){var _0xb959bf={'raw':!![],'where':{'id':_0x4376ee['params']['id']}},_0x5b1cd5={};_0x5b1cd5[_0xc5c1('0x2f')]=_[_0xc5c1('0x42')](db[_0xc5c1('0x3e')]['rawAttributes']);_0x5b1cd5[_0xc5c1('0x30')]=_['keys'](_0x4376ee[_0xc5c1('0x30')]);_0x5b1cd5[_0xc5c1('0x31')]=_['intersection'](_0x5b1cd5[_0xc5c1('0x2f')],_0x5b1cd5[_0xc5c1('0x30')]);_0xb959bf[_0xc5c1('0x33')]=_['intersection'](_0x5b1cd5[_0xc5c1('0x2f')],qs['fields'](_0x4376ee[_0xc5c1('0x30')][_0xc5c1('0x34')]));_0xb959bf['attributes']=_0xb959bf[_0xc5c1('0x33')][_0xc5c1('0x35')]?_0xb959bf[_0xc5c1('0x33')]:_0x5b1cd5['model'];if(_0x4376ee[_0xc5c1('0x30')][_0xc5c1('0x43')]){_0xb959bf[_0xc5c1('0x3f')]=[{'all':!![]}];}_0xb959bf=_[_0xc5c1('0x3c')]({},_0xb959bf,_0x4376ee[_0xc5c1('0x44')]);return db['CmHopperAdditionalPhone'][_0xc5c1('0x45')](_0xb959bf)[_0xc5c1('0x22')](handleEntityNotFound(_0x4a92ff,null))['then'](respondWithResult(_0x4a92ff,null))[_0xc5c1('0x40')](handleError(_0x4a92ff,null));};exports[_0xc5c1('0x46')]=function(_0xfd4cb9,_0x21afc5){return db['CmHopperAdditionalPhone']['create'](_0xfd4cb9[_0xc5c1('0x47')],{})[_0xc5c1('0x22')](function(_0x106fb4){var _0xf6f069=_0xfd4cb9[_0xc5c1('0x48')][_0xc5c1('0x24')]({'plain':!![]});if(!_0xf6f069)throw new Error(_0xc5c1('0x49'));if(_0xf6f069[_0xc5c1('0x4a')]===_0xc5c1('0x48')){var _0x5e3151=_0x106fb4['get']({'plain':!![]});var _0xcacdd5=_0xc5c1('0x25');return db[_0xc5c1('0x4b')]['find']({'where':{'name':_0xcacdd5,'userProfileId':_0xf6f069[_0xc5c1('0x4c')]},'raw':!![]})[_0xc5c1('0x22')](function(_0x215c68){if(_0x215c68&&_0x215c68['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5e3151['name'],'resourceId':_0x5e3151['id'],'type':_0x215c68[_0xc5c1('0x29')],'sectionId':_0x215c68['id']},{})[_0xc5c1('0x22')](function(){return _0x106fb4;});}else{return _0x106fb4;}})[_0xc5c1('0x40')](function(_0x369c4f){logger['error'](_0xc5c1('0x4d'),_0x369c4f);throw _0x369c4f;});}return _0x106fb4;})['then'](respondWithResult(_0x21afc5,0xc9))[_0xc5c1('0x40')](handleError(_0x21afc5,null));};exports[_0xc5c1('0x21')]=function(_0x995a68,_0x482c8a){if(_0x995a68[_0xc5c1('0x47')]['id']){delete _0x995a68['body']['id'];}return db['CmHopperAdditionalPhone'][_0xc5c1('0x45')]({'where':{'id':_0x995a68['params']['id']}})[_0xc5c1('0x22')](handleEntityNotFound(_0x482c8a,null))[_0xc5c1('0x22')](saveUpdates(_0x995a68[_0xc5c1('0x47')],null))[_0xc5c1('0x22')](respondWithResult(_0x482c8a,null))[_0xc5c1('0x40')](handleError(_0x482c8a,null));};exports['destroy']=function(_0xf23cce,_0x29b2c9){return db[_0xc5c1('0x3e')][_0xc5c1('0x45')]({'where':{'id':_0xf23cce['params']['id']}})[_0xc5c1('0x22')](handleEntityNotFound(_0x29b2c9,null))[_0xc5c1('0x22')](removeEntity(_0x29b2c9,null))[_0xc5c1('0x40')](handleError(_0x29b2c9,null));}; \ No newline at end of file +var _0x4ad7=['include','rows','params','find','catch','create','body','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','end','stack','send','map','CmHopperAdditionalPhone','rawAttributes','key','name','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll'];(function(_0x587ba2,_0x42eb40){var _0x50ec73=function(_0x2f32e3){while(--_0x2f32e3){_0x587ba2['push'](_0x587ba2['shift']());}};_0x50ec73(++_0x42eb40);}(_0x4ad7,0x159));var _0x74ad=function(_0x5ad5f3,_0x17b05e){_0x5ad5f3=_0x5ad5f3-0x0;var _0x331296=_0x4ad7[_0x5ad5f3];return _0x331296;};'use strict';var emlformat=require(_0x74ad('0x0'));var rimraf=require(_0x74ad('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x74ad('0x2'));var rp=require(_0x74ad('0x3'));var moment=require(_0x74ad('0x4'));var BPromise=require(_0x74ad('0x5'));var Mustache=require(_0x74ad('0x6'));var util=require('util');var path=require(_0x74ad('0x7'));var sox=require(_0x74ad('0x8'));var csv=require(_0x74ad('0x9'));var ejs=require(_0x74ad('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74ad('0xb'));var squel=require(_0x74ad('0xc'));var crypto=require(_0x74ad('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x74ad('0x9'));var querystring=require(_0x74ad('0xe'));var Papa=require(_0x74ad('0xf'));var Redis=require(_0x74ad('0x10'));var authService=require(_0x74ad('0x11'));var qs=require(_0x74ad('0x12'));var as=require(_0x74ad('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74ad('0x14'))('api');var utils=require(_0x74ad('0x15'));var config=require(_0x74ad('0x16'));var licenseUtil=require(_0x74ad('0x17'));var db=require(_0x74ad('0x18'))['db'];function respondWithStatusCode(_0xd762a5,_0x19d3dd){_0x19d3dd=_0x19d3dd||0xcc;return function(_0x5d7389){if(_0x5d7389){return _0xd762a5[_0x74ad('0x19')](_0x19d3dd);}return _0xd762a5[_0x74ad('0x1a')](_0x19d3dd)['end']();};}function respondWithResult(_0x47ab7a,_0x78c3f5){_0x78c3f5=_0x78c3f5||0xc8;return function(_0x432658){if(_0x432658){return _0x47ab7a['status'](_0x78c3f5)[_0x74ad('0x1b')](_0x432658);}};}function respondWithFilteredResult(_0x51e72c,_0x4835c9){return function(_0x2d77aa){if(_0x2d77aa){var _0x3281f0=typeof _0x4835c9[_0x74ad('0x1c')]===_0x74ad('0x1d')&&typeof _0x4835c9[_0x74ad('0x1e')]===_0x74ad('0x1d');var _0x321bef=_0x2d77aa[_0x74ad('0x1f')];var _0x8c1d97=_0x3281f0?0x0:_0x4835c9[_0x74ad('0x1c')];var _0x37b39d=_0x3281f0?_0x2d77aa[_0x74ad('0x1f')]:_0x4835c9['offset']+_0x4835c9['limit'];var _0x5d9e8e;if(_0x37b39d>=_0x321bef){_0x37b39d=_0x321bef;_0x5d9e8e=0xc8;}else{_0x5d9e8e=0xce;}_0x51e72c['status'](_0x5d9e8e);return _0x51e72c[_0x74ad('0x20')](_0x74ad('0x21'),_0x8c1d97+'-'+_0x37b39d+'/'+_0x321bef)[_0x74ad('0x1b')](_0x2d77aa);}return null;};}function patchUpdates(_0x478bb0){return function(_0x6ba5da){try{jsonpatch['apply'](_0x6ba5da,_0x478bb0,!![]);}catch(_0x350d5e){return BPromise[_0x74ad('0x22')](_0x350d5e);}return _0x6ba5da[_0x74ad('0x23')]();};}function saveUpdates(_0xacb1df,_0x2bae40){return function(_0x5b9156){if(_0x5b9156){return _0x5b9156[_0x74ad('0x24')](_0xacb1df)[_0x74ad('0x25')](function(_0x4e8168){return _0x4e8168;});}return null;};}function removeEntity(_0x384b03,_0x572a62){return function(_0x1949ab){if(_0x1949ab){return _0x1949ab[_0x74ad('0x26')]()['then'](function(){var _0x23abd0=_0x1949ab[_0x74ad('0x27')]({'plain':!![]});var _0x4465e8=_0x74ad('0x28');return db[_0x74ad('0x29')]['destroy']({'where':{'type':_0x4465e8,'resourceId':_0x23abd0['id']}})['then'](function(){return _0x1949ab;});})[_0x74ad('0x25')](function(){_0x384b03[_0x74ad('0x1a')](0xcc)[_0x74ad('0x2a')]();});}};}function handleEntityNotFound(_0x572b7b,_0x44e7d7){return function(_0x52dce3){if(!_0x52dce3){_0x572b7b[_0x74ad('0x19')](0x194);}return _0x52dce3;};}function handleError(_0x3e8d53,_0x3baa88){_0x3baa88=_0x3baa88||0x1f4;return function(_0x55ee04){logger['error'](_0x55ee04[_0x74ad('0x2b')]);if(_0x55ee04['name']){delete _0x55ee04['name'];}_0x3e8d53[_0x74ad('0x1a')](_0x3baa88)[_0x74ad('0x2c')](_0x55ee04);};}exports['index']=function(_0x1a5f28,_0x50e446){var _0x488541={},_0x5a8898={},_0x11bc21={'count':0x0,'rows':[]};var _0x59fb28=_[_0x74ad('0x2d')](db[_0x74ad('0x2e')][_0x74ad('0x2f')],function(_0x245089){return{'name':_0x245089['fieldName'],'type':_0x245089['type'][_0x74ad('0x30')]};});_0x5a8898['model']=_[_0x74ad('0x2d')](_0x59fb28,_0x74ad('0x31'));_0x5a8898['query']=_[_0x74ad('0x32')](_0x1a5f28[_0x74ad('0x33')]);_0x5a8898[_0x74ad('0x34')]=_[_0x74ad('0x35')](_0x5a8898[_0x74ad('0x36')],_0x5a8898[_0x74ad('0x33')]);_0x488541['attributes']=_['intersection'](_0x5a8898['model'],qs[_0x74ad('0x37')](_0x1a5f28['query'][_0x74ad('0x37')]));_0x488541['attributes']=_0x488541[_0x74ad('0x38')][_0x74ad('0x39')]?_0x488541[_0x74ad('0x38')]:_0x5a8898['model'];if(!_0x1a5f28[_0x74ad('0x33')][_0x74ad('0x3a')](_0x74ad('0x3b'))){_0x488541[_0x74ad('0x1e')]=qs[_0x74ad('0x1e')](_0x1a5f28[_0x74ad('0x33')]['limit']);_0x488541[_0x74ad('0x1c')]=qs['offset'](_0x1a5f28[_0x74ad('0x33')][_0x74ad('0x1c')]);}_0x488541[_0x74ad('0x3c')]=qs[_0x74ad('0x3d')](_0x1a5f28[_0x74ad('0x33')]['sort']);_0x488541['where']=qs[_0x74ad('0x34')](_[_0x74ad('0x3e')](_0x1a5f28[_0x74ad('0x33')],_0x5a8898[_0x74ad('0x34')]),_0x59fb28);if(_0x1a5f28[_0x74ad('0x33')][_0x74ad('0x3f')]){_0x488541[_0x74ad('0x40')]=_[_0x74ad('0x41')](_0x488541['where'],{'$or':_[_0x74ad('0x2d')](_0x59fb28,function(_0x27e0df){if(_0x27e0df[_0x74ad('0x42')]!==_0x74ad('0x43')){var _0x14a478={};_0x14a478[_0x27e0df['name']]={'$like':'%'+_0x1a5f28[_0x74ad('0x33')][_0x74ad('0x3f')]+'%'};return _0x14a478;}})});}_0x488541=_['merge']({},_0x488541,_0x1a5f28[_0x74ad('0x44')]);var _0x237c6a={'where':_0x488541[_0x74ad('0x40')]};return db[_0x74ad('0x2e')][_0x74ad('0x1f')](_0x237c6a)[_0x74ad('0x25')](function(_0x1f4e51){_0x11bc21[_0x74ad('0x1f')]=_0x1f4e51;if(_0x1a5f28[_0x74ad('0x33')][_0x74ad('0x45')]){_0x488541[_0x74ad('0x46')]=[{'all':!![]}];}return db[_0x74ad('0x2e')]['findAll'](_0x488541);})['then'](function(_0x5afdde){_0x11bc21[_0x74ad('0x47')]=_0x5afdde;return _0x11bc21;})[_0x74ad('0x25')](respondWithFilteredResult(_0x50e446,_0x488541))['catch'](handleError(_0x50e446,null));};exports['show']=function(_0x18f952,_0x836419){var _0x2e6266={'raw':!![],'where':{'id':_0x18f952[_0x74ad('0x48')]['id']}},_0x2e4726={};_0x2e4726[_0x74ad('0x36')]=_[_0x74ad('0x32')](db['CmHopperAdditionalPhone'][_0x74ad('0x2f')]);_0x2e4726[_0x74ad('0x33')]=_[_0x74ad('0x32')](_0x18f952[_0x74ad('0x33')]);_0x2e4726[_0x74ad('0x34')]=_['intersection'](_0x2e4726[_0x74ad('0x36')],_0x2e4726[_0x74ad('0x33')]);_0x2e6266['attributes']=_[_0x74ad('0x35')](_0x2e4726[_0x74ad('0x36')],qs['fields'](_0x18f952[_0x74ad('0x33')][_0x74ad('0x37')]));_0x2e6266['attributes']=_0x2e6266['attributes']['length']?_0x2e6266[_0x74ad('0x38')]:_0x2e4726[_0x74ad('0x36')];if(_0x18f952[_0x74ad('0x33')][_0x74ad('0x45')]){_0x2e6266[_0x74ad('0x46')]=[{'all':!![]}];}_0x2e6266=_[_0x74ad('0x41')]({},_0x2e6266,_0x18f952[_0x74ad('0x44')]);return db[_0x74ad('0x2e')][_0x74ad('0x49')](_0x2e6266)[_0x74ad('0x25')](handleEntityNotFound(_0x836419,null))[_0x74ad('0x25')](respondWithResult(_0x836419,null))[_0x74ad('0x4a')](handleError(_0x836419,null));};exports['create']=function(_0x3c5e82,_0x2f549a){return db['CmHopperAdditionalPhone'][_0x74ad('0x4b')](_0x3c5e82[_0x74ad('0x4c')],{})[_0x74ad('0x25')](function(_0x2cc543){var _0x4ceab3=_0x3c5e82[_0x74ad('0x4d')][_0x74ad('0x27')]({'plain':!![]});if(!_0x4ceab3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ceab3['role']==='user'){var _0x4bd557=_0x2cc543['get']({'plain':!![]});var _0x386aad=_0x74ad('0x28');return db[_0x74ad('0x4e')][_0x74ad('0x49')]({'where':{'name':_0x386aad,'userProfileId':_0x4ceab3[_0x74ad('0x4f')]},'raw':!![]})[_0x74ad('0x25')](function(_0x30b8a0){if(_0x30b8a0&&_0x30b8a0[_0x74ad('0x50')]===0x0){return db[_0x74ad('0x29')][_0x74ad('0x4b')]({'name':_0x4bd557[_0x74ad('0x31')],'resourceId':_0x4bd557['id'],'type':_0x30b8a0['name'],'sectionId':_0x30b8a0['id']},{})[_0x74ad('0x25')](function(){return _0x2cc543;});}else{return _0x2cc543;}})[_0x74ad('0x4a')](function(_0x416a1f){logger[_0x74ad('0x51')](_0x74ad('0x52'),_0x416a1f);throw _0x416a1f;});}return _0x2cc543;})['then'](respondWithResult(_0x2f549a,0xc9))[_0x74ad('0x4a')](handleError(_0x2f549a,null));};exports[_0x74ad('0x24')]=function(_0x28de3d,_0x29a501){if(_0x28de3d[_0x74ad('0x4c')]['id']){delete _0x28de3d[_0x74ad('0x4c')]['id'];}return db[_0x74ad('0x2e')][_0x74ad('0x49')]({'where':{'id':_0x28de3d[_0x74ad('0x48')]['id']}})['then'](handleEntityNotFound(_0x29a501,null))['then'](saveUpdates(_0x28de3d['body'],null))['then'](respondWithResult(_0x29a501,null))['catch'](handleError(_0x29a501,null));};exports['destroy']=function(_0x5b07d3,_0x4eda41){return db['CmHopperAdditionalPhone'][_0x74ad('0x49')]({'where':{'id':_0x5b07d3[_0x74ad('0x48')]['id']}})[_0x74ad('0x25')](handleEntityNotFound(_0x4eda41,null))['then'](removeEntity(_0x4eda41,null))[_0x74ad('0x4a')](handleError(_0x4eda41,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 60a28fa..d428446 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 _0x6d2f=['cm_hopper_additional_phones','lodash','util','../../config/logger','api','bluebird','request-promise','path','./cmHopperAdditionalPhone.attributes','define'];(function(_0x45960d,_0x1201ba){var _0x477246=function(_0x53a402){while(--_0x53a402){_0x45960d['push'](_0x45960d['shift']());}};_0x477246(++_0x1201ba);}(_0x6d2f,0x1eb));var _0xf6d2=function(_0x5b4c44,_0x2e495e){_0x5b4c44=_0x5b4c44-0x0;var _0x58485a=_0x6d2f[_0x5b4c44];return _0x58485a;};'use strict';var _=require(_0xf6d2('0x0'));var util=require(_0xf6d2('0x1'));var logger=require(_0xf6d2('0x2'))(_0xf6d2('0x3'));var moment=require('moment');var BPromise=require(_0xf6d2('0x4'));var rp=require(_0xf6d2('0x5'));var fs=require('fs');var path=require(_0xf6d2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf6d2('0x7'));module['exports']=function(_0x3b1bc4,_0x5c53d3){return _0x3b1bc4[_0xf6d2('0x8')]('CmHopperAdditionalPhone',attributes,{'tableName':_0xf6d2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadd2=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones'];(function(_0x4af06e,_0x410295){var _0x3a3ab4=function(_0x520a8b){while(--_0x520a8b){_0x4af06e['push'](_0x4af06e['shift']());}};_0x3a3ab4(++_0x410295);}(_0xadd2,0xa5));var _0x2add=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xadd2[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2add('0x0'))('api');var moment=require(_0x2add('0x1'));var BPromise=require(_0x2add('0x2'));var rp=require(_0x2add('0x3'));var fs=require('fs');var path=require(_0x2add('0x4'));var rimraf=require(_0x2add('0x5'));var config=require(_0x2add('0x6'));var attributes=require(_0x2add('0x7'));module[_0x2add('0x8')]=function(_0x30d864,_0x53a89d){return _0x30d864['define'](_0x2add('0x9'),attributes,{'tableName':_0x2add('0xa'),'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 bc6a439..b457eca 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 _0x6e27=['lodash','moment','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','dialGlobalMaxRetry','countbusyretry','countagentrejectretry','entity','SwapAdditionalPhones','ListId','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','update','IncrementPreviewCounters'];(function(_0x35cbaf,_0xf5cd5){var _0x23c8cb=function(_0x4d2510){while(--_0x4d2510){_0x35cbaf['push'](_0x35cbaf['shift']());}};_0x23c8cb(++_0xf5cd5);}(_0x6e27,0x190));var _0x76e2=function(_0x263f9d,_0x3d854e){_0x263f9d=_0x263f9d-0x0;var _0x4c4efa=_0x6e27[_0x263f9d];return _0x4c4efa;};'use strict';var _=require(_0x76e2('0x0'));var util=require('util');var moment=require(_0x76e2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x76e2('0x2'));var db=require(_0x76e2('0x3'))['db'];var utils=require(_0x76e2('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x76e2('0x5'));var client=jayson[_0x76e2('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f5fdf,_0xdb8819,_0x62c816){return new BPromise(function(_0x20f94f,_0x28b797){return client[_0x76e2('0x7')](_0x4f5fdf,_0x62c816)[_0x76e2('0x8')](function(_0x43e6af){logger[_0x76e2('0x9')](_0x76e2('0xa'),_0xdb8819,_0x76e2('0xb'));logger['debug']('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0xdb8819,_0x76e2('0xb'),JSON[_0x76e2('0xc')](_0x43e6af));if(_0x43e6af['error']){if(_0x43e6af[_0x76e2('0xd')][_0x76e2('0xe')]===0x1f4){logger[_0x76e2('0xd')](_0x76e2('0xa'),_0xdb8819,_0x43e6af['error'][_0x76e2('0xf')]);return _0x28b797(_0x43e6af[_0x76e2('0xd')][_0x76e2('0xf')]);}logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xdb8819,_0x43e6af[_0x76e2('0xd')]['message']);return _0x20f94f(_0x43e6af[_0x76e2('0xd')][_0x76e2('0xf')]);}else{logger[_0x76e2('0x9')](_0x76e2('0xa'),_0xdb8819,'request\x20sent');_0x20f94f(_0x43e6af[_0x76e2('0x10')][_0x76e2('0xf')]);}})[_0x76e2('0x11')](function(_0x474d44){logger[_0x76e2('0xd')](_0x76e2('0xa'),_0xdb8819,_0x474d44);_0x28b797(_0x474d44);});});}exports[_0x76e2('0x12')]=function(_0xec2ecb){var _0x1660ec=this;return new Promise(function(_0x49d307,_0x28ccb5){return db[_0x76e2('0x13')][_0x76e2('0x14')]({'raw':!![],'where':{'ContactId':_0xec2ecb['body'][_0x76e2('0x15')],'ListId':_0xec2ecb[_0x76e2('0x16')]['ListId'],'VoiceQueueId':_0xec2ecb[_0x76e2('0x16')][_0x76e2('0x17')]===undefined?null:_0xec2ecb[_0x76e2('0x16')][_0x76e2('0x17')],'CampaignId':_0xec2ecb[_0x76e2('0x16')][_0x76e2('0x18')]===undefined?null:_0xec2ecb['body'][_0x76e2('0x18')]}})[_0x76e2('0x8')](function(_0x34a5cc){if(_0x34a5cc!=null){return db[_0x76e2('0x19')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x34a5cc['id'],'OrderBy':{'$gt':_0x34a5cc[_0x76e2('0x1a')]}},'order':[[_0x76e2('0x1a'),_0x76e2('0x1b')]]})[_0x76e2('0x8')](function(_0x1a351d){var _0x408311=0x0;if(_0x1a351d){if(_0x1a351d['countbusyretry']+_0x1a351d[_0x76e2('0x1c')]+_0x1a351d[_0x76e2('0x1d')]+_0x1a351d[_0x76e2('0x1e')]+_0x1a351d[_0x76e2('0x1f')]+_0x1a351d[_0x76e2('0x20')]+_0x1a351d[_0x76e2('0x21')]+_0x1a351d['countagentrejectretry']<_0xec2ecb['entity'][_0x76e2('0x22')])_0x408311=0x1;_0x49d307({'additional':_0x408311});}else{return db[_0x76e2('0x19')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x34a5cc['id']},'order':[['OrderBy',_0x76e2('0x1b')]]})[_0x76e2('0x8')](function(_0x11d001){var _0x1461e0=0x0;if(_0x11d001){if(_0x11d001[_0x76e2('0x23')]+_0x11d001['countcongestionretry']+_0x11d001[_0x76e2('0x1d')]+_0x11d001[_0x76e2('0x1e')]+_0x11d001[_0x76e2('0x1f')]+_0x11d001[_0x76e2('0x20')]+_0x11d001[_0x76e2('0x21')]+_0x11d001[_0x76e2('0x24')]<_0xec2ecb[_0x76e2('0x25')]['dialGlobalMaxRetry'])_0x1461e0=0x1;_0x49d307({'additional':_0x1461e0});}else{_0x49d307({'additional':0x0});}})[_0x76e2('0x11')](function(_0x1b7a36){logger['error'](_0x76e2('0x12'),_0x1b7a36[_0x76e2('0xf')]);_0x28ccb5(_0x1660ec[_0x76e2('0xd')](0x1f4,_0x1b7a36[_0x76e2('0xf')]));});}})[_0x76e2('0x11')](function(_0x648d43){logger[_0x76e2('0xd')]('VerifyAdditionalPhones',_0x648d43[_0x76e2('0xf')]);_0x28ccb5(_0x1660ec[_0x76e2('0xd')](0x1f4,_0x648d43['message']));});}else _0x49d307({'additional':0x0});});});};exports[_0x76e2('0x26')]=function(_0x4d9004){var _0xa5ad51=this;return new Promise(function(_0x3b04f9,_0x2a292f){return db[_0x76e2('0x13')][_0x76e2('0x14')]({'raw':!![],'where':{'ContactId':_0x4d9004['body'][_0x76e2('0x15')],'ListId':_0x4d9004[_0x76e2('0x16')][_0x76e2('0x27')],'VoiceQueueId':_0x4d9004[_0x76e2('0x16')]['VoiceQueueId']===undefined?null:_0x4d9004[_0x76e2('0x16')][_0x76e2('0x17')],'CampaignId':_0x4d9004[_0x76e2('0x16')][_0x76e2('0x18')]===undefined?null:_0x4d9004[_0x76e2('0x16')]['CampaignId']}})[_0x76e2('0x8')](function(_0x4ba965){if(_0x4ba965!=null){return db[_0x76e2('0x19')][_0x76e2('0x14')]({'raw':!![],'where':{'CmHopperId':_0x4ba965['id'],'OrderBy':{'$gte':_0x4ba965[_0x76e2('0x1a')]}},'order':[[_0x76e2('0x1a'),_0x76e2('0x1b')]]})['then'](function(_0xaa7917){if(_0xaa7917)return activateAdditionalPhone(_0x4ba965,_0x4d9004[_0x76e2('0x16')],_0xaa7917,_0x4d9004[_0x76e2('0x28')],_0x4d9004['waitTime'])[_0x76e2('0x8')](function(_0x4e765d){_0x3b04f9(_0x4e765d);});else{return db[_0x76e2('0x19')][_0x76e2('0x14')]({'raw':!![],'where':{'CmHopperId':_0x4ba965['id']},'order':[['OrderBy',_0x76e2('0x1b')]]})['then'](function(_0x27a07c){if(_0x27a07c)return activateAdditionalPhone(_0x4ba965,_0x4d9004[_0x76e2('0x16')],_0x27a07c,_0x4d9004[_0x76e2('0x28')],_0x4d9004[_0x76e2('0x29')])['then'](function(_0x550fcb){_0x3b04f9(_0x550fcb);});else{_0x3b04f9({'id':_0x4ba965['id'],'phone':''});}})[_0x76e2('0x11')](function(_0x607b9f){logger[_0x76e2('0xd')]('VerifyAdditionalPhones',_0x607b9f[_0x76e2('0xf')]);_0x2a292f(_0xa5ad51[_0x76e2('0xd')](0x1f4,_0x607b9f[_0x76e2('0xf')]));});}})[_0x76e2('0x11')](function(_0x224a73){logger['error'](_0x76e2('0x12'),_0x224a73['message']);_0x2a292f(_0xa5ad51[_0x76e2('0xd')](0x1f4,_0x224a73[_0x76e2('0xf')]));});}else _0x3b04f9(0x1);});});};function activateAdditionalPhone(_0x301c61,_0x599e92,_0x1671b7,_0x5c506a,_0x7cb76b){return new Promise(function(_0x245804,_0x23dbcf){var _0x38964a;if(_[_0x76e2('0x2a')](_0x1671b7[_0x76e2('0x2b')])){_0x1671b7['scheduledat']=moment();}if(moment()>moment(_0x1671b7[_0x76e2('0x2b')])){_0x38964a=moment()[_0x76e2('0x2c')](_0x7cb76b||0x3,_0x76e2('0x2d'));}else{if(_0x1671b7[_0x76e2('0x1a')]==0x0){_0x38964a=moment(_0x1671b7[_0x76e2('0x2b')]);}else{_0x38964a=moment()[_0x76e2('0x2c')](_0x7cb76b||0x3,_0x76e2('0x2d'));}}if(_[_0x76e2('0x2a')](_0x38964a)){_0x38964a=moment()[_0x76e2('0x2c')](_0x7cb76b||0x3,'minutes');}var _0x4f71d3={'phone':_0x301c61[_0x76e2('0x2e')],'active':0x0,'OrderBy':_[_0x76e2('0x2a')](_0x301c61[_0x76e2('0x1a')])?0x0:_0x301c61[_0x76e2('0x1a')],'scheduledat':moment()[_0x76e2('0x2c')](_0x5c506a||0x1,'minutes'),'countbusyretry':_0x599e92[_0x76e2('0x23')],'countcongestionretry':_0x599e92['countcongestionretry'],'countnoanswerretry':_0x599e92[_0x76e2('0x1d')],'countnosuchnumberretry':_0x599e92[_0x76e2('0x1e')],'countdropretry':_0x599e92[_0x76e2('0x1f')],'countabandonedretry':_0x599e92[_0x76e2('0x20')],'countmachineretry':_0x599e92[_0x76e2('0x21')],'countagentrejectretry':_0x599e92[_0x76e2('0x24')],'createdAt':_0x599e92['createdAt'],'updatedAt':_0x599e92['updatedAt']};var _0x273580={'CmHopperId':_0x301c61['id'],'phone':_0x1671b7['phone'],'active':0x0,'OrderBy':_[_0x76e2('0x2a')](_0x1671b7[_0x76e2('0x1a')])?0x0:_0x1671b7[_0x76e2('0x1a')],'scheduledat':_0x38964a,'countbusyretry':_0x1671b7[_0x76e2('0x23')],'countcongestionretry':_0x1671b7[_0x76e2('0x1c')],'countnoanswerretry':_0x1671b7[_0x76e2('0x1d')],'countnosuchnumberretry':_0x1671b7[_0x76e2('0x1e')],'countdropretry':_0x1671b7[_0x76e2('0x1f')],'countabandonedretry':_0x1671b7['countabandonedretry'],'countmachineretry':_0x1671b7[_0x76e2('0x21')],'countagentrejectretry':_0x1671b7[_0x76e2('0x24')],'createdAt':_0x1671b7[_0x76e2('0x2f')],'updatedAt':_0x1671b7['updatedAt']};return db['sequelize']['transaction'](function(_0x4c435f){return db[_0x76e2('0x19')]['update'](_0x4f71d3,{'where':{'id':_0x1671b7['id']}},{'transaction':_0x4c435f})['then'](function(){return db[_0x76e2('0x13')][_0x76e2('0x30')](_0x273580,{'where':{'id':_0x301c61['id']}},{'transaction':_0x4c435f});});})[_0x76e2('0x8')](function(_0x123450){_0x245804({'id':_0x301c61['id'],'phone':_0x1671b7[_0x76e2('0x2e')]});})[_0x76e2('0x11')](function(_0x152371){logger[_0x76e2('0xd')]('activateAdditionalPhone',_0x152371[_0x76e2('0xf')]);_0x23dbcf({'error':_0x152371[_0x76e2('0xf')]});});});}exports[_0x76e2('0x31')]=function(_0x5b37cf){var _0x50fa79=this;return new Promise(function(_0x36caf5,_0x43d8d7){return db['CmHopper'][_0x76e2('0x30')](_0x5b37cf['body']['field'],{'where':{'id':_0x5b37cf['body']['id']}})[_0x76e2('0x8')](function(_0x4f3e56){_0x36caf5(_0x4f3e56);})[_0x76e2('0x11')](function(_0x2936b6){logger[_0x76e2('0xd')]('IncrementPreviewCounters',_0x2936b6[_0x76e2('0xf')]);_0x43d8d7(_0x50fa79[_0x76e2('0xd')](0x1f4,_0x2936b6[_0x76e2('0xf')]));});});}; \ No newline at end of file +var _0xed0e=['request\x20sent','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','VoiceQueueId','body','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','countbusyretry','SwapAdditionalPhones','ContactId','ListId','waitTime','duration','scheduledat','add','minutes','isNil','phone','createdAt','updatedAt','transaction','update','IncrementPreviewCounters','field','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s'];(function(_0x3a96bc,_0x2db635){var _0x42f0f3=function(_0x43e538){while(--_0x43e538){_0x3a96bc['push'](_0x3a96bc['shift']());}};_0x42f0f3(++_0x2db635);}(_0xed0e,0x95));var _0xeed0=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0xed0e[_0x22f8ab];return _0x2a70e5;};'use strict';var _=require('lodash');var util=require(_0xeed0('0x0'));var moment=require('moment');var BPromise=require(_0xeed0('0x1'));var rs=require(_0xeed0('0x2'));var fs=require('fs');var Redis=require(_0xeed0('0x3'));var db=require(_0xeed0('0x4'))['db'];var utils=require(_0xeed0('0x5'));var logger=require(_0xeed0('0x6'))('rpc');var config=require(_0xeed0('0x7'));var jayson=require(_0xeed0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4fcbca,_0xc4e061,_0x30e9d1){return new BPromise(function(_0x41a38e,_0xf4860f){return client[_0xeed0('0x9')](_0x4fcbca,_0x30e9d1)[_0xeed0('0xa')](function(_0x16c6f5){logger[_0xeed0('0xb')](_0xeed0('0xc'),_0xc4e061,_0xeed0('0xd'));logger['debug']('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0xc4e061,_0xeed0('0xd'),JSON[_0xeed0('0xe')](_0x16c6f5));if(_0x16c6f5[_0xeed0('0xf')]){if(_0x16c6f5[_0xeed0('0xf')][_0xeed0('0x10')]===0x1f4){logger[_0xeed0('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xc4e061,_0x16c6f5[_0xeed0('0xf')][_0xeed0('0x11')]);return _0xf4860f(_0x16c6f5[_0xeed0('0xf')][_0xeed0('0x11')]);}logger[_0xeed0('0xf')](_0xeed0('0xc'),_0xc4e061,_0x16c6f5[_0xeed0('0xf')]['message']);return _0x41a38e(_0x16c6f5[_0xeed0('0xf')][_0xeed0('0x11')]);}else{logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xc4e061,_0xeed0('0xd'));_0x41a38e(_0x16c6f5[_0xeed0('0x12')][_0xeed0('0x11')]);}})[_0xeed0('0x13')](function(_0x10d707){logger['error'](_0xeed0('0xc'),_0xc4e061,_0x10d707);_0xf4860f(_0x10d707);});});}exports[_0xeed0('0x14')]=function(_0x5977ce){var _0x3db5cc=this;return new Promise(function(_0x287d31,_0x15b865){return db[_0xeed0('0x15')][_0xeed0('0x16')]({'raw':!![],'where':{'ContactId':_0x5977ce['body']['ContactId'],'ListId':_0x5977ce['body']['ListId'],'VoiceQueueId':_0x5977ce['body'][_0xeed0('0x17')]===undefined?null:_0x5977ce[_0xeed0('0x18')][_0xeed0('0x17')],'CampaignId':_0x5977ce[_0xeed0('0x18')]['CampaignId']===undefined?null:_0x5977ce['body'][_0xeed0('0x19')]}})[_0xeed0('0xa')](function(_0x2a5721){if(_0x2a5721!=null){return db[_0xeed0('0x1a')][_0xeed0('0x16')]({'raw':!![],'where':{'CmHopperId':_0x2a5721['id'],'OrderBy':{'$gt':_0x2a5721[_0xeed0('0x1b')]}},'order':[[_0xeed0('0x1b'),_0xeed0('0x1c')]]})[_0xeed0('0xa')](function(_0x11a716){var _0x2e5194=0x0;if(_0x11a716){if(_0x11a716['countbusyretry']+_0x11a716[_0xeed0('0x1d')]+_0x11a716[_0xeed0('0x1e')]+_0x11a716[_0xeed0('0x1f')]+_0x11a716[_0xeed0('0x20')]+_0x11a716[_0xeed0('0x21')]+_0x11a716[_0xeed0('0x22')]+_0x11a716[_0xeed0('0x23')]<_0x5977ce['entity'][_0xeed0('0x24')])_0x2e5194=0x1;_0x287d31({'additional':_0x2e5194});}else{return db[_0xeed0('0x1a')][_0xeed0('0x16')]({'raw':!![],'where':{'CmHopperId':_0x2a5721['id']},'order':[[_0xeed0('0x1b'),_0xeed0('0x1c')]]})[_0xeed0('0xa')](function(_0x47cf9){var _0x200c0f=0x0;if(_0x47cf9){if(_0x47cf9[_0xeed0('0x25')]+_0x47cf9[_0xeed0('0x1d')]+_0x47cf9[_0xeed0('0x1e')]+_0x47cf9[_0xeed0('0x1f')]+_0x47cf9['countdropretry']+_0x47cf9['countabandonedretry']+_0x47cf9[_0xeed0('0x22')]+_0x47cf9[_0xeed0('0x23')]<_0x5977ce['entity'][_0xeed0('0x24')])_0x200c0f=0x1;_0x287d31({'additional':_0x200c0f});}else{_0x287d31({'additional':0x0});}})[_0xeed0('0x13')](function(_0x485ec1){logger[_0xeed0('0xf')](_0xeed0('0x14'),_0x485ec1['message']);_0x15b865(_0x3db5cc[_0xeed0('0xf')](0x1f4,_0x485ec1['message']));});}})[_0xeed0('0x13')](function(_0x3ae7bd){logger['error'](_0xeed0('0x14'),_0x3ae7bd['message']);_0x15b865(_0x3db5cc[_0xeed0('0xf')](0x1f4,_0x3ae7bd[_0xeed0('0x11')]));});}else _0x287d31({'additional':0x0});});});};exports[_0xeed0('0x26')]=function(_0x5c70c4){var _0x1ac5da=this;return new Promise(function(_0x21181c,_0x11c177){return db[_0xeed0('0x15')][_0xeed0('0x16')]({'raw':!![],'where':{'ContactId':_0x5c70c4[_0xeed0('0x18')][_0xeed0('0x27')],'ListId':_0x5c70c4[_0xeed0('0x18')][_0xeed0('0x28')],'VoiceQueueId':_0x5c70c4['body']['VoiceQueueId']===undefined?null:_0x5c70c4[_0xeed0('0x18')]['VoiceQueueId'],'CampaignId':_0x5c70c4[_0xeed0('0x18')][_0xeed0('0x19')]===undefined?null:_0x5c70c4[_0xeed0('0x18')]['CampaignId']}})[_0xeed0('0xa')](function(_0x1d0285){if(_0x1d0285!=null){return db[_0xeed0('0x1a')][_0xeed0('0x16')]({'raw':!![],'where':{'CmHopperId':_0x1d0285['id'],'OrderBy':{'$gte':_0x1d0285[_0xeed0('0x1b')]}},'order':[[_0xeed0('0x1b'),_0xeed0('0x1c')]]})[_0xeed0('0xa')](function(_0xb4c892){if(_0xb4c892)return activateAdditionalPhone(_0x1d0285,_0x5c70c4['body'],_0xb4c892,_0x5c70c4['duration'],_0x5c70c4[_0xeed0('0x29')])['then'](function(_0x21e2a8){_0x21181c(_0x21e2a8);});else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x1d0285['id']},'order':[[_0xeed0('0x1b'),_0xeed0('0x1c')]]})[_0xeed0('0xa')](function(_0x4cc2f4){if(_0x4cc2f4)return activateAdditionalPhone(_0x1d0285,_0x5c70c4[_0xeed0('0x18')],_0x4cc2f4,_0x5c70c4[_0xeed0('0x2a')],_0x5c70c4[_0xeed0('0x29')])['then'](function(_0x40b9e7){_0x21181c(_0x40b9e7);});else{_0x21181c({'id':_0x1d0285['id'],'phone':''});}})[_0xeed0('0x13')](function(_0x21d310){logger['error']('VerifyAdditionalPhones',_0x21d310[_0xeed0('0x11')]);_0x11c177(_0x1ac5da[_0xeed0('0xf')](0x1f4,_0x21d310['message']));});}})[_0xeed0('0x13')](function(_0x3d6ed9){logger[_0xeed0('0xf')](_0xeed0('0x14'),_0x3d6ed9[_0xeed0('0x11')]);_0x11c177(_0x1ac5da[_0xeed0('0xf')](0x1f4,_0x3d6ed9['message']));});}else _0x21181c(0x1);});});};function activateAdditionalPhone(_0x4ba76b,_0x10843d,_0x43246e,_0x46f838,_0x3dbf87){return new Promise(function(_0x55f6fb,_0x17ce22){var _0x103bd8;if(_['isNil'](_0x43246e[_0xeed0('0x2b')])){_0x43246e[_0xeed0('0x2b')]=moment();}if(moment()>moment(_0x43246e[_0xeed0('0x2b')])){_0x103bd8=moment()[_0xeed0('0x2c')](_0x3dbf87||0x3,_0xeed0('0x2d'));}else{if(_0x43246e[_0xeed0('0x1b')]==0x0){_0x103bd8=moment(_0x43246e[_0xeed0('0x2b')]);}else{_0x103bd8=moment()['add'](_0x3dbf87||0x3,'minutes');}}if(_[_0xeed0('0x2e')](_0x103bd8)){_0x103bd8=moment()['add'](_0x3dbf87||0x3,_0xeed0('0x2d'));}var _0x55166b={'phone':_0x4ba76b[_0xeed0('0x2f')],'active':0x0,'OrderBy':_['isNil'](_0x4ba76b[_0xeed0('0x1b')])?0x0:_0x4ba76b[_0xeed0('0x1b')],'scheduledat':moment()[_0xeed0('0x2c')](_0x46f838||0x1,_0xeed0('0x2d')),'countbusyretry':_0x10843d[_0xeed0('0x25')],'countcongestionretry':_0x10843d[_0xeed0('0x1d')],'countnoanswerretry':_0x10843d[_0xeed0('0x1e')],'countnosuchnumberretry':_0x10843d[_0xeed0('0x1f')],'countdropretry':_0x10843d[_0xeed0('0x20')],'countabandonedretry':_0x10843d[_0xeed0('0x21')],'countmachineretry':_0x10843d[_0xeed0('0x22')],'countagentrejectretry':_0x10843d[_0xeed0('0x23')],'createdAt':_0x10843d[_0xeed0('0x30')],'updatedAt':_0x10843d[_0xeed0('0x31')]};var _0x4c3863={'CmHopperId':_0x4ba76b['id'],'phone':_0x43246e['phone'],'active':0x0,'OrderBy':_[_0xeed0('0x2e')](_0x43246e[_0xeed0('0x1b')])?0x0:_0x43246e[_0xeed0('0x1b')],'scheduledat':_0x103bd8,'countbusyretry':_0x43246e[_0xeed0('0x25')],'countcongestionretry':_0x43246e[_0xeed0('0x1d')],'countnoanswerretry':_0x43246e[_0xeed0('0x1e')],'countnosuchnumberretry':_0x43246e[_0xeed0('0x1f')],'countdropretry':_0x43246e[_0xeed0('0x20')],'countabandonedretry':_0x43246e[_0xeed0('0x21')],'countmachineretry':_0x43246e['countmachineretry'],'countagentrejectretry':_0x43246e['countagentrejectretry'],'createdAt':_0x43246e[_0xeed0('0x30')],'updatedAt':_0x43246e[_0xeed0('0x31')]};return db['sequelize'][_0xeed0('0x32')](function(_0x1b8a74){return db[_0xeed0('0x1a')][_0xeed0('0x33')](_0x55166b,{'where':{'id':_0x43246e['id']}},{'transaction':_0x1b8a74})['then'](function(){return db[_0xeed0('0x15')][_0xeed0('0x33')](_0x4c3863,{'where':{'id':_0x4ba76b['id']}},{'transaction':_0x1b8a74});});})['then'](function(_0xe49950){_0x55f6fb({'id':_0x4ba76b['id'],'phone':_0x43246e['phone']});})[_0xeed0('0x13')](function(_0x49f14b){logger['error']('activateAdditionalPhone',_0x49f14b[_0xeed0('0x11')]);_0x17ce22({'error':_0x49f14b['message']});});});}exports[_0xeed0('0x34')]=function(_0x5b22fc){var _0x307642=this;return new Promise(function(_0x531434,_0x4ea7cc){return db[_0xeed0('0x15')]['update'](_0x5b22fc[_0xeed0('0x18')][_0xeed0('0x35')],{'where':{'id':_0x5b22fc[_0xeed0('0x18')]['id']}})['then'](function(_0x3f11d6){_0x531434(_0x3f11d6);})[_0xeed0('0x13')](function(_0x569711){logger[_0xeed0('0xf')](_0xeed0('0x34'),_0x569711[_0xeed0('0x11')]);_0x4ea7cc(_0x307642[_0xeed0('0xf')](0x1f4,_0x569711[_0xeed0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index b6521ae..2d4acfc 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 _0x7d13=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports'];(function(_0x2900bf,_0x396900){var _0x4ff896=function(_0x4366c7){while(--_0x4366c7){_0x2900bf['push'](_0x2900bf['shift']());}};_0x4ff896(++_0x396900);}(_0x7d13,0x6c));var _0x37d1=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0x7d13[_0x5951e8];return _0x20a1f5;};'use strict';var multer=require('multer');var util=require(_0x37d1('0x0'));var path=require('path');var timeout=require(_0x37d1('0x1'));var express=require('express');var router=express[_0x37d1('0x2')]();var fs_extra=require(_0x37d1('0x3'));var auth=require(_0x37d1('0x4'));var interaction=require(_0x37d1('0x5'));var config=require(_0x37d1('0x6'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x37d1('0x7')]('/',auth[_0x37d1('0x8')](),controller[_0x37d1('0x9')]);router[_0x37d1('0x7')]('/:id',auth[_0x37d1('0x8')](),controller[_0x37d1('0xa')]);router[_0x37d1('0xb')]('/',auth[_0x37d1('0x8')](),controller[_0x37d1('0xc')]);router[_0x37d1('0xd')](_0x37d1('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x37d1('0xf')](_0x37d1('0xe'),auth['isAuthenticated'](),controller[_0x37d1('0x10')]);module[_0x37d1('0x11')]=router; \ No newline at end of file +var _0x0123=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x2d2ef0,_0x2ed0b7){var _0x3f85c0=function(_0xf98fc4){while(--_0xf98fc4){_0x2d2ef0['push'](_0x2d2ef0['shift']());}};_0x3f85c0(++_0x2ed0b7);}(_0x0123,0x191));var _0x3012=function(_0x391df5,_0xa08526){_0x391df5=_0x391df5-0x0;var _0x33f4c2=_0x0123[_0x391df5];return _0x33f4c2;};'use strict';var multer=require('multer');var util=require(_0x3012('0x0'));var path=require(_0x3012('0x1'));var timeout=require(_0x3012('0x2'));var express=require(_0x3012('0x3'));var router=express[_0x3012('0x4')]();var fs_extra=require(_0x3012('0x5'));var auth=require(_0x3012('0x6'));var interaction=require(_0x3012('0x7'));var config=require(_0x3012('0x8'));var controller=require(_0x3012('0x9'));router[_0x3012('0xa')]('/',auth[_0x3012('0xb')](),controller[_0x3012('0xc')]);router[_0x3012('0xa')](_0x3012('0xd'),auth[_0x3012('0xb')](),controller[_0x3012('0xe')]);router[_0x3012('0xf')]('/',auth[_0x3012('0xb')](),controller[_0x3012('0x10')]);router[_0x3012('0x11')](_0x3012('0xd'),auth[_0x3012('0xb')](),controller[_0x3012('0x12')]);router[_0x3012('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x3012('0x14')]);module[_0x3012('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index a9cedb0..29c56e9 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 _0x07d7=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x2b4f1f,_0x300f01){var _0x421219=function(_0x1cb065){while(--_0x1cb065){_0x2b4f1f['push'](_0x2b4f1f['shift']());}};_0x421219(++_0x300f01);}(_0x07d7,0x85));var _0x707d=function(_0x1d2bc8,_0x2860bc){_0x1d2bc8=_0x1d2bc8-0x0;var _0x1857e1=_0x07d7[_0x1d2bc8];return _0x1857e1;};'use strict';var moment=require(_0x707d('0x0'));var Sequelize=require(_0x707d('0x1'));module[_0x707d('0x2')]={'phone':{'type':Sequelize[_0x707d('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x707d('0x4')],'unique':_0x707d('0x5')},'ListId':{'type':Sequelize[_0x707d('0x4')],'unique':_0x707d('0x5')},'VoiceQueueId':{'type':Sequelize[_0x707d('0x4')],'unique':_0x707d('0x5')}}; \ No newline at end of file +var _0xcff4=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x1635a4,_0x47ff86){var _0x59dc0b=function(_0x2f17d1){while(--_0x2f17d1){_0x1635a4['push'](_0x1635a4['shift']());}};_0x59dc0b(++_0x47ff86);}(_0xcff4,0x11e));var _0x4cff=function(_0x20f2d9,_0x2f0cb2){_0x20f2d9=_0x20f2d9-0x0;var _0x448821=_0xcff4[_0x20f2d9];return _0x448821;};'use strict';var moment=require(_0x4cff('0x0'));var Sequelize=require(_0x4cff('0x1'));module[_0x4cff('0x2')]={'phone':{'type':Sequelize[_0x4cff('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x4cff('0x4')],'unique':_0x4cff('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x4cff('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x4cff('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 5a6ba73..f71bf23 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 _0x2c31=['then','error','stack','name','map','CmHopperBlack','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','rawAttributes','find','body','destroy','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update'];(function(_0x43e2c4,_0x1449ed){var _0x5aa736=function(_0x16726a){while(--_0x16726a){_0x43e2c4['push'](_0x43e2c4['shift']());}};_0x5aa736(++_0x1449ed);}(_0x2c31,0xb6));var _0x12c3=function(_0x1e184e,_0xb2f66a){_0x1e184e=_0x1e184e-0x0;var _0x5c61e4=_0x2c31[_0x1e184e];return _0x5c61e4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x12c3('0x0'));var jsonpatch=require(_0x12c3('0x1'));var rp=require('request-promise');var moment=require(_0x12c3('0x2'));var BPromise=require(_0x12c3('0x3'));var Mustache=require(_0x12c3('0x4'));var util=require(_0x12c3('0x5'));var path=require(_0x12c3('0x6'));var sox=require(_0x12c3('0x7'));var csv=require(_0x12c3('0x8'));var ejs=require(_0x12c3('0x9'));var fs=require('fs');var fs_extra=require(_0x12c3('0xa'));var _=require('lodash');var squel=require(_0x12c3('0xb'));var crypto=require('crypto');var jsforce=require(_0x12c3('0xc'));var deskjs=require(_0x12c3('0xd'));var toCsv=require('to-csv');var querystring=require(_0x12c3('0xe'));var Papa=require('papaparse');var Redis=require(_0x12c3('0xf'));var authService=require(_0x12c3('0x10'));var qs=require(_0x12c3('0x11'));var as=require(_0x12c3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x12c3('0x13'));var utils=require(_0x12c3('0x14'));var config=require(_0x12c3('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x12c3('0x16'))['db'];function respondWithStatusCode(_0x54e299,_0x2fd47f){_0x2fd47f=_0x2fd47f||0xcc;return function(_0x27b047){if(_0x27b047){return _0x54e299[_0x12c3('0x17')](_0x2fd47f);}return _0x54e299['status'](_0x2fd47f)[_0x12c3('0x18')]();};}function respondWithResult(_0x2f7748,_0x251b16){_0x251b16=_0x251b16||0xc8;return function(_0x4d03c9){if(_0x4d03c9){return _0x2f7748['status'](_0x251b16)[_0x12c3('0x19')](_0x4d03c9);}};}function respondWithFilteredResult(_0x5eba8b,_0x29f92e){return function(_0x4c7234){if(_0x4c7234){var _0x387489=typeof _0x29f92e[_0x12c3('0x1a')]===_0x12c3('0x1b')&&typeof _0x29f92e[_0x12c3('0x1c')]==='undefined';var _0x4a8fcb=_0x4c7234[_0x12c3('0x1d')];var _0x397ecc=_0x387489?0x0:_0x29f92e[_0x12c3('0x1a')];var _0x144a68=_0x387489?_0x4c7234[_0x12c3('0x1d')]:_0x29f92e[_0x12c3('0x1a')]+_0x29f92e[_0x12c3('0x1c')];var _0x148b21;if(_0x144a68>=_0x4a8fcb){_0x144a68=_0x4a8fcb;_0x148b21=0xc8;}else{_0x148b21=0xce;}_0x5eba8b[_0x12c3('0x1e')](_0x148b21);return _0x5eba8b[_0x12c3('0x1f')](_0x12c3('0x20'),_0x397ecc+'-'+_0x144a68+'/'+_0x4a8fcb)[_0x12c3('0x19')](_0x4c7234);}return null;};}function patchUpdates(_0x3f11b1){return function(_0xbc887){try{jsonpatch[_0x12c3('0x21')](_0xbc887,_0x3f11b1,!![]);}catch(_0x11061b){return BPromise[_0x12c3('0x22')](_0x11061b);}return _0xbc887[_0x12c3('0x23')]();};}function saveUpdates(_0x57109e,_0x39ef4b){return function(_0x558836){if(_0x558836){return _0x558836[_0x12c3('0x24')](_0x57109e)[_0x12c3('0x25')](function(_0x5a2a95){return _0x5a2a95;});}return null;};}function removeEntity(_0x15c26b,_0x5aa232){return function(_0x545dd2){if(_0x545dd2){return _0x545dd2['destroy']()[_0x12c3('0x25')](function(){_0x15c26b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x34c3f3,_0x2e55b2){return function(_0x26efb8){if(!_0x26efb8){_0x34c3f3[_0x12c3('0x17')](0x194);}return _0x26efb8;};}function handleError(_0x25c199,_0x789610){_0x789610=_0x789610||0x1f4;return function(_0x20c43d){logger[_0x12c3('0x26')](_0x20c43d[_0x12c3('0x27')]);if(_0x20c43d[_0x12c3('0x28')]){delete _0x20c43d[_0x12c3('0x28')];}_0x25c199[_0x12c3('0x1e')](_0x789610)['send'](_0x20c43d);};}exports['index']=function(_0x59b35e,_0x4caa1c){var _0xc90a07={},_0x5a2111={},_0x42c6e2={'count':0x0,'rows':[]};var _0x24cc2b=_[_0x12c3('0x29')](db[_0x12c3('0x2a')]['rawAttributes'],function(_0x3ffa66){return{'name':_0x3ffa66[_0x12c3('0x2b')],'type':_0x3ffa66[_0x12c3('0x2c')][_0x12c3('0x2d')]};});_0x5a2111[_0x12c3('0x2e')]=_[_0x12c3('0x29')](_0x24cc2b,_0x12c3('0x28'));_0x5a2111[_0x12c3('0x2f')]=_[_0x12c3('0x30')](_0x59b35e['query']);_0x5a2111['filters']=_[_0x12c3('0x31')](_0x5a2111[_0x12c3('0x2e')],_0x5a2111[_0x12c3('0x2f')]);_0xc90a07[_0x12c3('0x32')]=_[_0x12c3('0x31')](_0x5a2111[_0x12c3('0x2e')],qs[_0x12c3('0x33')](_0x59b35e[_0x12c3('0x2f')][_0x12c3('0x33')]));_0xc90a07[_0x12c3('0x32')]=_0xc90a07[_0x12c3('0x32')][_0x12c3('0x34')]?_0xc90a07['attributes']:_0x5a2111[_0x12c3('0x2e')];if(!_0x59b35e[_0x12c3('0x2f')]['hasOwnProperty'](_0x12c3('0x35'))){_0xc90a07[_0x12c3('0x1c')]=qs[_0x12c3('0x1c')](_0x59b35e[_0x12c3('0x2f')]['limit']);_0xc90a07['offset']=qs[_0x12c3('0x1a')](_0x59b35e[_0x12c3('0x2f')]['offset']);}_0xc90a07[_0x12c3('0x36')]=qs[_0x12c3('0x37')](_0x59b35e[_0x12c3('0x2f')][_0x12c3('0x37')]);_0xc90a07[_0x12c3('0x38')]=qs[_0x12c3('0x39')](_[_0x12c3('0x3a')](_0x59b35e[_0x12c3('0x2f')],_0x5a2111[_0x12c3('0x39')]),_0x24cc2b);if(_0x59b35e['query']['filter']){_0xc90a07[_0x12c3('0x38')]=_[_0x12c3('0x3b')](_0xc90a07[_0x12c3('0x38')],{'$or':_[_0x12c3('0x29')](_0x24cc2b,function(_0x4703dc){if(_0x4703dc['type']!==_0x12c3('0x3c')){var _0x3f9008={};_0x3f9008[_0x4703dc['name']]={'$like':'%'+_0x59b35e[_0x12c3('0x2f')][_0x12c3('0x3d')]+'%'};return _0x3f9008;}})});}_0xc90a07=_['merge']({},_0xc90a07,_0x59b35e[_0x12c3('0x3e')]);var _0x52ea7d={'where':_0xc90a07[_0x12c3('0x38')]};return db['CmHopperBlack']['count'](_0x52ea7d)[_0x12c3('0x25')](function(_0x513a9d){_0x42c6e2['count']=_0x513a9d;if(_0x59b35e['query'][_0x12c3('0x3f')]){_0xc90a07['include']=[{'all':!![]}];}return db[_0x12c3('0x2a')][_0x12c3('0x40')](_0xc90a07);})[_0x12c3('0x25')](function(_0x30d191){_0x42c6e2['rows']=_0x30d191;return _0x42c6e2;})['then'](respondWithFilteredResult(_0x4caa1c,_0xc90a07))[_0x12c3('0x41')](handleError(_0x4caa1c,null));};exports[_0x12c3('0x42')]=function(_0x35b82e,_0x29affc){var _0x388cea={'raw':!![],'where':{'id':_0x35b82e[_0x12c3('0x43')]['id']}},_0x266db6={};_0x266db6[_0x12c3('0x2e')]=_['keys'](db['CmHopperBlack'][_0x12c3('0x44')]);_0x266db6[_0x12c3('0x2f')]=_[_0x12c3('0x30')](_0x35b82e[_0x12c3('0x2f')]);_0x266db6[_0x12c3('0x39')]=_[_0x12c3('0x31')](_0x266db6[_0x12c3('0x2e')],_0x266db6[_0x12c3('0x2f')]);_0x388cea[_0x12c3('0x32')]=_[_0x12c3('0x31')](_0x266db6['model'],qs[_0x12c3('0x33')](_0x35b82e[_0x12c3('0x2f')][_0x12c3('0x33')]));_0x388cea[_0x12c3('0x32')]=_0x388cea['attributes'][_0x12c3('0x34')]?_0x388cea[_0x12c3('0x32')]:_0x266db6['model'];if(_0x35b82e[_0x12c3('0x2f')][_0x12c3('0x3f')]){_0x388cea['include']=[{'all':!![]}];}_0x388cea=_[_0x12c3('0x3b')]({},_0x388cea,_0x35b82e[_0x12c3('0x3e')]);return db['CmHopperBlack'][_0x12c3('0x45')](_0x388cea)[_0x12c3('0x25')](handleEntityNotFound(_0x29affc,null))[_0x12c3('0x25')](respondWithResult(_0x29affc,null))[_0x12c3('0x41')](handleError(_0x29affc,null));};exports['update']=function(_0x5e9868,_0x3ba3ac){if(_0x5e9868[_0x12c3('0x46')]['id']){delete _0x5e9868[_0x12c3('0x46')]['id'];}return db[_0x12c3('0x2a')]['find']({'where':{'id':_0x5e9868[_0x12c3('0x43')]['id']}})[_0x12c3('0x25')](handleEntityNotFound(_0x3ba3ac,null))[_0x12c3('0x25')](saveUpdates(_0x5e9868[_0x12c3('0x46')],null))[_0x12c3('0x25')](respondWithResult(_0x3ba3ac,null))[_0x12c3('0x41')](handleError(_0x3ba3ac,null));};exports[_0x12c3('0x47')]=function(_0x5567c2,_0x2fdd37){return db['CmHopperBlack'][_0x12c3('0x45')]({'where':{'id':_0x5567c2['params']['id']}})['then'](handleEntityNotFound(_0x2fdd37,null))[_0x12c3('0x25')](removeEntity(_0x2fdd37,null))[_0x12c3('0x41')](handleError(_0x2fdd37,null));};exports['describe']=function(_0x5667cd,_0x26b1aa){return db[_0x12c3('0x2a')][_0x12c3('0x48')]()[_0x12c3('0x25')](respondWithResult(_0x26b1aa,null))[_0x12c3('0x41')](handleError(_0x26b1aa,null));}; \ No newline at end of file +var _0x7a9d=['includeAll','include','rows','show','params','find','catch','body','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','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','destroy','then','sendStatus','stack','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options'];(function(_0x6ba805,_0x34e8a9){var _0x2baf16=function(_0x2d702f){while(--_0x2d702f){_0x6ba805['push'](_0x6ba805['shift']());}};_0x2baf16(++_0x34e8a9);}(_0x7a9d,0xf9));var _0xd7a9=function(_0x3a64f6,_0x1d8dfd){_0x3a64f6=_0x3a64f6-0x0;var _0x10335c=_0x7a9d[_0x3a64f6];return _0x10335c;};'use strict';var emlformat=require(_0xd7a9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd7a9('0x1'));var jsonpatch=require(_0xd7a9('0x2'));var rp=require('request-promise');var moment=require(_0xd7a9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd7a9('0x4'));var util=require('util');var path=require(_0xd7a9('0x5'));var sox=require(_0xd7a9('0x6'));var csv=require(_0xd7a9('0x7'));var ejs=require(_0xd7a9('0x8'));var fs=require('fs');var fs_extra=require(_0xd7a9('0x9'));var _=require(_0xd7a9('0xa'));var squel=require(_0xd7a9('0xb'));var crypto=require(_0xd7a9('0xc'));var jsforce=require(_0xd7a9('0xd'));var deskjs=require(_0xd7a9('0xe'));var toCsv=require(_0xd7a9('0x7'));var querystring=require(_0xd7a9('0xf'));var Papa=require(_0xd7a9('0x10'));var Redis=require(_0xd7a9('0x11'));var authService=require(_0xd7a9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd7a9('0x13'));var hardwareService=require(_0xd7a9('0x14'));var logger=require(_0xd7a9('0x15'))(_0xd7a9('0x16'));var utils=require(_0xd7a9('0x17'));var config=require(_0xd7a9('0x18'));var licenseUtil=require(_0xd7a9('0x19'));var db=require(_0xd7a9('0x1a'))['db'];function respondWithStatusCode(_0x456979,_0x3f5de8){_0x3f5de8=_0x3f5de8||0xcc;return function(_0x3ef915){if(_0x3ef915){return _0x456979['sendStatus'](_0x3f5de8);}return _0x456979[_0xd7a9('0x1b')](_0x3f5de8)[_0xd7a9('0x1c')]();};}function respondWithResult(_0xdce765,_0x56d018){_0x56d018=_0x56d018||0xc8;return function(_0x45cc71){if(_0x45cc71){return _0xdce765[_0xd7a9('0x1b')](_0x56d018)[_0xd7a9('0x1d')](_0x45cc71);}};}function respondWithFilteredResult(_0x17b8bf,_0x546604){return function(_0x583735){if(_0x583735){var _0x3e3402=typeof _0x546604[_0xd7a9('0x1e')]===_0xd7a9('0x1f')&&typeof _0x546604[_0xd7a9('0x20')]===_0xd7a9('0x1f');var _0x30fc30=_0x583735['count'];var _0x53cf75=_0x3e3402?0x0:_0x546604[_0xd7a9('0x1e')];var _0x1d62a0=_0x3e3402?_0x583735[_0xd7a9('0x21')]:_0x546604[_0xd7a9('0x1e')]+_0x546604[_0xd7a9('0x20')];var _0xebb35d;if(_0x1d62a0>=_0x30fc30){_0x1d62a0=_0x30fc30;_0xebb35d=0xc8;}else{_0xebb35d=0xce;}_0x17b8bf['status'](_0xebb35d);return _0x17b8bf[_0xd7a9('0x22')](_0xd7a9('0x23'),_0x53cf75+'-'+_0x1d62a0+'/'+_0x30fc30)[_0xd7a9('0x1d')](_0x583735);}return null;};}function patchUpdates(_0x45d19e){return function(_0x14dee0){try{jsonpatch[_0xd7a9('0x24')](_0x14dee0,_0x45d19e,!![]);}catch(_0x32e1bf){return BPromise[_0xd7a9('0x25')](_0x32e1bf);}return _0x14dee0[_0xd7a9('0x26')]();};}function saveUpdates(_0x169c77,_0x15e368){return function(_0x351bf6){if(_0x351bf6){return _0x351bf6[_0xd7a9('0x27')](_0x169c77)['then'](function(_0x3febe3){return _0x3febe3;});}return null;};}function removeEntity(_0x3436b5,_0x4b687f){return function(_0x3e6c12){if(_0x3e6c12){return _0x3e6c12[_0xd7a9('0x28')]()[_0xd7a9('0x29')](function(){_0x3436b5[_0xd7a9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3914ca,_0x4daff4){return function(_0xb39c57){if(!_0xb39c57){_0x3914ca[_0xd7a9('0x2a')](0x194);}return _0xb39c57;};}function handleError(_0x43de7e,_0x227977){_0x227977=_0x227977||0x1f4;return function(_0x3ed862){logger['error'](_0x3ed862[_0xd7a9('0x2b')]);if(_0x3ed862[_0xd7a9('0x2c')]){delete _0x3ed862[_0xd7a9('0x2c')];}_0x43de7e[_0xd7a9('0x1b')](_0x227977)[_0xd7a9('0x2d')](_0x3ed862);};}exports[_0xd7a9('0x2e')]=function(_0x5d6dba,_0x2a8702){var _0x13b5f7={},_0xde64d2={},_0x1ee548={'count':0x0,'rows':[]};var _0x491347=_['map'](db[_0xd7a9('0x2f')][_0xd7a9('0x30')],function(_0x1a00bf){return{'name':_0x1a00bf[_0xd7a9('0x31')],'type':_0x1a00bf[_0xd7a9('0x32')][_0xd7a9('0x33')]};});_0xde64d2[_0xd7a9('0x34')]=_['map'](_0x491347,_0xd7a9('0x2c'));_0xde64d2[_0xd7a9('0x35')]=_[_0xd7a9('0x36')](_0x5d6dba[_0xd7a9('0x35')]);_0xde64d2[_0xd7a9('0x37')]=_['intersection'](_0xde64d2[_0xd7a9('0x34')],_0xde64d2['query']);_0x13b5f7[_0xd7a9('0x38')]=_[_0xd7a9('0x39')](_0xde64d2[_0xd7a9('0x34')],qs[_0xd7a9('0x3a')](_0x5d6dba['query']['fields']));_0x13b5f7[_0xd7a9('0x38')]=_0x13b5f7[_0xd7a9('0x38')][_0xd7a9('0x3b')]?_0x13b5f7[_0xd7a9('0x38')]:_0xde64d2[_0xd7a9('0x34')];if(!_0x5d6dba[_0xd7a9('0x35')][_0xd7a9('0x3c')](_0xd7a9('0x3d'))){_0x13b5f7[_0xd7a9('0x20')]=qs[_0xd7a9('0x20')](_0x5d6dba[_0xd7a9('0x35')][_0xd7a9('0x20')]);_0x13b5f7[_0xd7a9('0x1e')]=qs['offset'](_0x5d6dba[_0xd7a9('0x35')][_0xd7a9('0x1e')]);}_0x13b5f7[_0xd7a9('0x3e')]=qs[_0xd7a9('0x3f')](_0x5d6dba[_0xd7a9('0x35')]['sort']);_0x13b5f7[_0xd7a9('0x40')]=qs[_0xd7a9('0x37')](_[_0xd7a9('0x41')](_0x5d6dba['query'],_0xde64d2['filters']),_0x491347);if(_0x5d6dba[_0xd7a9('0x35')][_0xd7a9('0x42')]){_0x13b5f7['where']=_['merge'](_0x13b5f7[_0xd7a9('0x40')],{'$or':_[_0xd7a9('0x43')](_0x491347,function(_0x359979){if(_0x359979[_0xd7a9('0x32')]!==_0xd7a9('0x44')){var _0x1cdbcc={};_0x1cdbcc[_0x359979[_0xd7a9('0x2c')]]={'$like':'%'+_0x5d6dba['query'][_0xd7a9('0x42')]+'%'};return _0x1cdbcc;}})});}_0x13b5f7=_[_0xd7a9('0x45')]({},_0x13b5f7,_0x5d6dba[_0xd7a9('0x46')]);var _0x2e596c={'where':_0x13b5f7[_0xd7a9('0x40')]};return db[_0xd7a9('0x2f')][_0xd7a9('0x21')](_0x2e596c)['then'](function(_0x21242d){_0x1ee548[_0xd7a9('0x21')]=_0x21242d;if(_0x5d6dba[_0xd7a9('0x35')][_0xd7a9('0x47')]){_0x13b5f7[_0xd7a9('0x48')]=[{'all':!![]}];}return db[_0xd7a9('0x2f')]['findAll'](_0x13b5f7);})[_0xd7a9('0x29')](function(_0x5bf323){_0x1ee548[_0xd7a9('0x49')]=_0x5bf323;return _0x1ee548;})['then'](respondWithFilteredResult(_0x2a8702,_0x13b5f7))['catch'](handleError(_0x2a8702,null));};exports[_0xd7a9('0x4a')]=function(_0x477622,_0xb7baf6){var _0x43291f={'raw':!![],'where':{'id':_0x477622[_0xd7a9('0x4b')]['id']}},_0x92dc9d={};_0x92dc9d[_0xd7a9('0x34')]=_['keys'](db[_0xd7a9('0x2f')][_0xd7a9('0x30')]);_0x92dc9d['query']=_[_0xd7a9('0x36')](_0x477622[_0xd7a9('0x35')]);_0x92dc9d[_0xd7a9('0x37')]=_[_0xd7a9('0x39')](_0x92dc9d[_0xd7a9('0x34')],_0x92dc9d[_0xd7a9('0x35')]);_0x43291f[_0xd7a9('0x38')]=_[_0xd7a9('0x39')](_0x92dc9d['model'],qs[_0xd7a9('0x3a')](_0x477622[_0xd7a9('0x35')][_0xd7a9('0x3a')]));_0x43291f['attributes']=_0x43291f[_0xd7a9('0x38')][_0xd7a9('0x3b')]?_0x43291f[_0xd7a9('0x38')]:_0x92dc9d['model'];if(_0x477622[_0xd7a9('0x35')][_0xd7a9('0x47')]){_0x43291f[_0xd7a9('0x48')]=[{'all':!![]}];}_0x43291f=_[_0xd7a9('0x45')]({},_0x43291f,_0x477622['options']);return db[_0xd7a9('0x2f')][_0xd7a9('0x4c')](_0x43291f)['then'](handleEntityNotFound(_0xb7baf6,null))[_0xd7a9('0x29')](respondWithResult(_0xb7baf6,null))[_0xd7a9('0x4d')](handleError(_0xb7baf6,null));};exports[_0xd7a9('0x27')]=function(_0x375492,_0x51a87d){if(_0x375492[_0xd7a9('0x4e')]['id']){delete _0x375492[_0xd7a9('0x4e')]['id'];}return db[_0xd7a9('0x2f')][_0xd7a9('0x4c')]({'where':{'id':_0x375492['params']['id']}})['then'](handleEntityNotFound(_0x51a87d,null))['then'](saveUpdates(_0x375492[_0xd7a9('0x4e')],null))[_0xd7a9('0x29')](respondWithResult(_0x51a87d,null))[_0xd7a9('0x4d')](handleError(_0x51a87d,null));};exports['destroy']=function(_0x2708e3,_0x8f8ca5){return db['CmHopperBlack']['find']({'where':{'id':_0x2708e3[_0xd7a9('0x4b')]['id']}})[_0xd7a9('0x29')](handleEntityNotFound(_0x8f8ca5,null))['then'](removeEntity(_0x8f8ca5,null))['catch'](handleError(_0x8f8ca5,null));};exports['describe']=function(_0x5aadc8,_0x35160e){return db['CmHopperBlack'][_0xd7a9('0x4f')]()[_0xd7a9('0x29')](respondWithResult(_0x35160e,null))['catch'](handleError(_0x35160e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 74fa063..bce76e0 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 _0x9bb0=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment'];(function(_0x26678b,_0x38dffe){var _0x4ab534=function(_0xf54785){while(--_0xf54785){_0x26678b['push'](_0x26678b['shift']());}};_0x4ab534(++_0x38dffe);}(_0x9bb0,0x1f3));var _0x09bb=function(_0x111b26,_0xf76620){_0x111b26=_0x111b26-0x0;var _0x3a0a1e=_0x9bb0[_0x111b26];return _0x3a0a1e;};'use strict';var _=require(_0x09bb('0x0'));var util=require(_0x09bb('0x1'));var logger=require(_0x09bb('0x2'))(_0x09bb('0x3'));var moment=require(_0x09bb('0x4'));var BPromise=require(_0x09bb('0x5'));var rp=require(_0x09bb('0x6'));var fs=require('fs');var path=require(_0x09bb('0x7'));var rimraf=require(_0x09bb('0x8'));var config=require(_0x09bb('0x9'));var attributes=require(_0x09bb('0xa'));module[_0x09bb('0xb')]=function(_0xc0b73f,_0xced27a){return _0xc0b73f['define'](_0x09bb('0xc'),attributes,{'tableName':_0x09bb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b34=['cm_hopper_black','lodash','moment','bluebird','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack'];(function(_0x52a8a8,_0x5147b4){var _0x5f0770=function(_0x37f452){while(--_0x37f452){_0x52a8a8['push'](_0x52a8a8['shift']());}};_0x5f0770(++_0x5147b4);}(_0x3b34,0xd2));var _0x43b3=function(_0x25865d,_0x2ffb6b){_0x25865d=_0x25865d-0x0;var _0x13927c=_0x3b34[_0x25865d];return _0x13927c;};'use strict';var _=require(_0x43b3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x43b3('0x1'));var BPromise=require(_0x43b3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x43b3('0x3'));var rimraf=require(_0x43b3('0x4'));var config=require(_0x43b3('0x5'));var attributes=require(_0x43b3('0x6'));module[_0x43b3('0x7')]=function(_0x29b1cb,_0x21f129){return _0x29b1cb[_0x43b3('0x8')](_0x43b3('0x9'),attributes,{'tableName':_0x43b3('0xa'),'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 97b4e5e..aedd20d 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 _0x0129=['../../config/logger','rpc','jayson/promise','client','http','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','model','map','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x44f283,_0x2e12d8){var _0x11896f=function(_0xf832ad){while(--_0xf832ad){_0x44f283['push'](_0x44f283['shift']());}};_0x11896f(++_0x2e12d8);}(_0x0129,0x1c1));var _0x9012=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0129[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9012('0x0'));var util=require(_0x9012('0x1'));var moment=require(_0x9012('0x2'));var BPromise=require('bluebird');var rs=require(_0x9012('0x3'));var fs=require('fs');var Redis=require(_0x9012('0x4'));var db=require(_0x9012('0x5'))['db'];var utils=require(_0x9012('0x6'));var logger=require(_0x9012('0x7'))(_0x9012('0x8'));var config=require('../../config/environment');var jayson=require(_0x9012('0x9'));var client=jayson[_0x9012('0xa')][_0x9012('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x511961,_0x2834be,_0x5e9dbb){return new BPromise(function(_0x55aab1,_0x3fe7ea){return client['request'](_0x511961,_0x5e9dbb)[_0x9012('0xc')](function(_0x1d63cd){logger['info'](_0x9012('0xd'),_0x2834be,_0x9012('0xe'));logger[_0x9012('0xf')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x2834be,_0x9012('0xe'),JSON[_0x9012('0x10')](_0x1d63cd));if(_0x1d63cd[_0x9012('0x11')]){if(_0x1d63cd['error'][_0x9012('0x12')]===0x1f4){logger['error'](_0x9012('0xd'),_0x2834be,_0x1d63cd['error'][_0x9012('0x13')]);return _0x3fe7ea(_0x1d63cd[_0x9012('0x11')][_0x9012('0x13')]);}logger[_0x9012('0x11')](_0x9012('0xd'),_0x2834be,_0x1d63cd[_0x9012('0x11')]['message']);return _0x55aab1(_0x1d63cd[_0x9012('0x11')][_0x9012('0x13')]);}else{logger[_0x9012('0x14')]('CmHopperBlack,\x20%s,\x20%s',_0x2834be,'request\x20sent');_0x55aab1(_0x1d63cd['result'][_0x9012('0x13')]);}})[_0x9012('0x15')](function(_0x3b6e73){logger[_0x9012('0x11')](_0x9012('0xd'),_0x2834be,_0x3b6e73);_0x3fe7ea(_0x3b6e73);});});}exports[_0x9012('0x16')]=function(_0x35b7ef){var _0x4fc7f0=this;return new Promise(function(_0x4a9357,_0x53a77a){return db[_0x9012('0x17')][_0x9012('0x18')]({'raw':_0x35b7ef[_0x9012('0x19')]?_0x35b7ef[_0x9012('0x19')][_0x9012('0x1a')]===undefined?!![]:![]:!![],'where':_0x35b7ef[_0x9012('0x19')]?_0x35b7ef['options'][_0x9012('0x1b')]||null:null,'attributes':_0x35b7ef['options']?_0x35b7ef[_0x9012('0x19')][_0x9012('0x1c')]||null:null,'limit':_0x35b7ef[_0x9012('0x19')]?_0x35b7ef[_0x9012('0x19')][_0x9012('0x1d')]||null:null,'include':_0x35b7ef[_0x9012('0x19')]?_0x35b7ef[_0x9012('0x19')][_0x9012('0x1e')]?_['map'](_0x35b7ef['options'][_0x9012('0x1e')],function(_0x3267a1){return{'model':db[_0x3267a1[_0x9012('0x1f')]],'as':_0x3267a1['as'],'attributes':_0x3267a1[_0x9012('0x1c')],'include':_0x3267a1[_0x9012('0x1e')]?_[_0x9012('0x20')](_0x3267a1[_0x9012('0x1e')],function(_0x4ccd78){return{'model':db[_0x4ccd78[_0x9012('0x1f')]],'as':_0x4ccd78['as'],'attributes':_0x4ccd78[_0x9012('0x1c')],'include':_0x4ccd78[_0x9012('0x1e')]?_['map'](_0x4ccd78['include'],function(_0x4dde42){return{'model':db[_0x4dde42[_0x9012('0x1f')]],'as':_0x4dde42['as'],'attributes':_0x4dde42[_0x9012('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9012('0xc')](function(_0x2d263e){logger['info'](_0x9012('0x16'),_0x35b7ef);logger[_0x9012('0xf')](_0x9012('0x16'),_0x35b7ef,JSON[_0x9012('0x10')](_0x2d263e));_0x4a9357(_0x2d263e);})[_0x9012('0x15')](function(_0x37a34d){logger[_0x9012('0x11')]('GetCmHopperBlack',_0x37a34d['message'],_0x35b7ef);_0x53a77a(_0x4fc7f0['error'](0x1f4,_0x37a34d[_0x9012('0x13')]));});});};exports[_0x9012('0x21')]=function(_0x5af547){var _0x565548=this;return new Promise(function(_0x482733,_0x58cd9a){return db[_0x9012('0x17')][_0x9012('0x22')](_0x5af547[_0x9012('0x23')],{'raw':_0x5af547[_0x9012('0x19')]?_0x5af547[_0x9012('0x19')][_0x9012('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5af547[_0x9012('0x19')]?_0x5af547[_0x9012('0x19')][_0x9012('0x1b')]||null:null,'attributes':_0x5af547[_0x9012('0x19')]?_0x5af547[_0x9012('0x19')][_0x9012('0x1c')]||null:null,'limit':_0x5af547[_0x9012('0x19')]?_0x5af547[_0x9012('0x19')][_0x9012('0x1d')]||null:null})[_0x9012('0xc')](function(_0x307bc8){logger['info'](_0x9012('0x21'),_0x5af547);logger[_0x9012('0xf')](_0x9012('0x21'),_0x5af547,JSON['stringify'](_0x307bc8));_0x482733(_0x307bc8);})['catch'](function(_0x27cd79){logger[_0x9012('0x11')](_0x9012('0x21'),_0x27cd79[_0x9012('0x13')],_0x5af547);_0x58cd9a(_0x565548[_0x9012('0x11')](0x1f4,_0x27cd79[_0x9012('0x13')]));});});};exports[_0x9012('0x24')]=function(_0x26b9b5){var _0x55965b=this;return new Promise(function(_0x5a211a,_0x219eab){return db[_0x9012('0x17')][_0x9012('0x25')]({'where':_0x26b9b5[_0x9012('0x19')]?_0x26b9b5[_0x9012('0x19')][_0x9012('0x1b')]||null:null})[_0x9012('0xc')](function(_0x73ba2a){logger['info'](_0x9012('0x24'),_0x26b9b5);logger[_0x9012('0xf')](_0x9012('0x24'),_0x26b9b5,JSON['stringify'](_0x73ba2a));_0x5a211a(_0x73ba2a);})[_0x9012('0x15')](function(_0x5ce56f){logger['error'](_0x9012('0x24'),_0x5ce56f['message'],_0x26b9b5);_0x219eab(_0x55965b[_0x9012('0x11')](0x1f4,_0x5ce56f[_0x9012('0x13')]));});});}; \ No newline at end of file +var _0xaea0=['options','where','limit','include','map','attributes','model','UpdateCmHopperBlack','update','body','raw','DestroyCmHopperBlack','destroy','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll'];(function(_0x20a8a1,_0x4b961b){var _0x28ec54=function(_0x153804){while(--_0x153804){_0x20a8a1['push'](_0x20a8a1['shift']());}};_0x28ec54(++_0x4b961b);}(_0xaea0,0xe5));var _0x0aea=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0xaea0[_0xf2628e];return _0x13863a;};'use strict';var _=require(_0x0aea('0x0'));var util=require(_0x0aea('0x1'));var moment=require(_0x0aea('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0aea('0x3'));var db=require(_0x0aea('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0aea('0x5'))('rpc');var config=require(_0x0aea('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0aea('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32d639,_0x1139e5,_0x33681d){return new BPromise(function(_0x4484ad,_0x43a134){return client['request'](_0x32d639,_0x33681d)[_0x0aea('0x8')](function(_0x42ac3c){logger[_0x0aea('0x9')]('CmHopperBlack,\x20%s,\x20%s',_0x1139e5,_0x0aea('0xa'));logger[_0x0aea('0xb')](_0x0aea('0xc'),_0x1139e5,_0x0aea('0xa'),JSON[_0x0aea('0xd')](_0x42ac3c));if(_0x42ac3c[_0x0aea('0xe')]){if(_0x42ac3c['error'][_0x0aea('0xf')]===0x1f4){logger[_0x0aea('0xe')](_0x0aea('0x10'),_0x1139e5,_0x42ac3c[_0x0aea('0xe')]['message']);return _0x43a134(_0x42ac3c[_0x0aea('0xe')]['message']);}logger[_0x0aea('0xe')](_0x0aea('0x10'),_0x1139e5,_0x42ac3c[_0x0aea('0xe')][_0x0aea('0x11')]);return _0x4484ad(_0x42ac3c[_0x0aea('0xe')]['message']);}else{logger[_0x0aea('0x9')]('CmHopperBlack,\x20%s,\x20%s',_0x1139e5,_0x0aea('0xa'));_0x4484ad(_0x42ac3c[_0x0aea('0x12')]['message']);}})[_0x0aea('0x13')](function(_0x400ccb){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x1139e5,_0x400ccb);_0x43a134(_0x400ccb);});});}exports[_0x0aea('0x14')]=function(_0x4d807f){var _0x3c685f=this;return new Promise(function(_0x106ca8,_0x43d3cd){return db[_0x0aea('0x15')][_0x0aea('0x16')]({'raw':_0x4d807f[_0x0aea('0x17')]?_0x4d807f[_0x0aea('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4d807f[_0x0aea('0x17')]?_0x4d807f[_0x0aea('0x17')][_0x0aea('0x18')]||null:null,'attributes':_0x4d807f[_0x0aea('0x17')]?_0x4d807f[_0x0aea('0x17')]['attributes']||null:null,'limit':_0x4d807f[_0x0aea('0x17')]?_0x4d807f['options'][_0x0aea('0x19')]||null:null,'include':_0x4d807f['options']?_0x4d807f[_0x0aea('0x17')][_0x0aea('0x1a')]?_[_0x0aea('0x1b')](_0x4d807f[_0x0aea('0x17')][_0x0aea('0x1a')],function(_0x6b8edf){return{'model':db[_0x6b8edf['model']],'as':_0x6b8edf['as'],'attributes':_0x6b8edf[_0x0aea('0x1c')],'include':_0x6b8edf['include']?_[_0x0aea('0x1b')](_0x6b8edf['include'],function(_0x51fcfc){return{'model':db[_0x51fcfc['model']],'as':_0x51fcfc['as'],'attributes':_0x51fcfc[_0x0aea('0x1c')],'include':_0x51fcfc['include']?_[_0x0aea('0x1b')](_0x51fcfc[_0x0aea('0x1a')],function(_0x5846ff){return{'model':db[_0x5846ff[_0x0aea('0x1d')]],'as':_0x5846ff['as'],'attributes':_0x5846ff[_0x0aea('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0aea('0x8')](function(_0x152abd){logger[_0x0aea('0x9')]('GetCmHopperBlack',_0x4d807f);logger['debug'](_0x0aea('0x14'),_0x4d807f,JSON[_0x0aea('0xd')](_0x152abd));_0x106ca8(_0x152abd);})['catch'](function(_0x309f0f){logger[_0x0aea('0xe')]('GetCmHopperBlack',_0x309f0f[_0x0aea('0x11')],_0x4d807f);_0x43d3cd(_0x3c685f[_0x0aea('0xe')](0x1f4,_0x309f0f['message']));});});};exports[_0x0aea('0x1e')]=function(_0x3b18ce){var _0x186920=this;return new Promise(function(_0x5ca094,_0x398937){return db[_0x0aea('0x15')][_0x0aea('0x1f')](_0x3b18ce[_0x0aea('0x20')],{'raw':_0x3b18ce[_0x0aea('0x17')]?_0x3b18ce[_0x0aea('0x17')][_0x0aea('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b18ce['options']?_0x3b18ce['options'][_0x0aea('0x18')]||null:null,'attributes':_0x3b18ce['options']?_0x3b18ce[_0x0aea('0x17')][_0x0aea('0x1c')]||null:null,'limit':_0x3b18ce[_0x0aea('0x17')]?_0x3b18ce[_0x0aea('0x17')][_0x0aea('0x19')]||null:null})[_0x0aea('0x8')](function(_0x27318e){logger[_0x0aea('0x9')](_0x0aea('0x1e'),_0x3b18ce);logger[_0x0aea('0xb')](_0x0aea('0x1e'),_0x3b18ce,JSON[_0x0aea('0xd')](_0x27318e));_0x5ca094(_0x27318e);})['catch'](function(_0x3819a8){logger['error']('UpdateCmHopperBlack',_0x3819a8[_0x0aea('0x11')],_0x3b18ce);_0x398937(_0x186920[_0x0aea('0xe')](0x1f4,_0x3819a8[_0x0aea('0x11')]));});});};exports[_0x0aea('0x22')]=function(_0x38bae5){var _0x5e1e75=this;return new Promise(function(_0x1afa52,_0x3ddc2d){return db[_0x0aea('0x15')][_0x0aea('0x23')]({'where':_0x38bae5[_0x0aea('0x17')]?_0x38bae5[_0x0aea('0x17')]['where']||null:null})['then'](function(_0x5c410e){logger['info'](_0x0aea('0x22'),_0x38bae5);logger['debug'](_0x0aea('0x22'),_0x38bae5,JSON[_0x0aea('0xd')](_0x5c410e));_0x1afa52(_0x5c410e);})[_0x0aea('0x13')](function(_0x5f1b06){logger[_0x0aea('0xe')](_0x0aea('0x22'),_0x5f1b06[_0x0aea('0x11')],_0x38bae5);_0x3ddc2d(_0x5e1e75['error'](0x1f4,_0x5f1b06[_0x0aea('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index a3a9be6..65d8f74 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 _0x7bd0=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','update','delete','destroy','exports'];(function(_0x45fe9c,_0x55e0d7){var _0x233d48=function(_0xa2ba2e){while(--_0xa2ba2e){_0x45fe9c['push'](_0x45fe9c['shift']());}};_0x233d48(++_0x55e0d7);}(_0x7bd0,0x111));var _0x07bd=function(_0xffd8b0,_0x12c51f){_0xffd8b0=_0xffd8b0-0x0;var _0x301ba0=_0x7bd0[_0xffd8b0];return _0x301ba0;};'use strict';var multer=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var path=require(_0x07bd('0x2'));var timeout=require(_0x07bd('0x3'));var express=require(_0x07bd('0x4'));var router=express[_0x07bd('0x5')]();var fs_extra=require(_0x07bd('0x6'));var auth=require(_0x07bd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x07bd('0x8'));var controller=require(_0x07bd('0x9'));router[_0x07bd('0xa')]('/',auth[_0x07bd('0xb')](),controller[_0x07bd('0xc')]);router[_0x07bd('0xa')](_0x07bd('0xd'),auth['isAuthenticated'](),controller[_0x07bd('0xe')]);router['get'](_0x07bd('0xf'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x10')]);router['put'](_0x07bd('0xf'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x11')]);router[_0x07bd('0x12')]('/:id',auth[_0x07bd('0xb')](),controller[_0x07bd('0x13')]);module[_0x07bd('0x14')]=router; \ No newline at end of file +var _0xc4aa=['isAuthenticated','index','/describe','/:id','show','update','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x2fb72d,_0x507cc1){var _0x2c1152=function(_0x250556){while(--_0x250556){_0x2fb72d['push'](_0x2fb72d['shift']());}};_0x2c1152(++_0x507cc1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xc4aa[_0x11005e];return _0x29338f;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['put'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router['delete'](_0xac4a('0xc'),auth['isAuthenticated'](),controller[_0xac4a('0xf')]);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 d715a7d..d687cc6 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 _0x3eeb=['getDataValue','endtime','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE'];(function(_0x207731,_0x3b02d3){var _0x2460e4=function(_0x30e236){while(--_0x30e236){_0x207731['push'](_0x207731['shift']());}};_0x2460e4(++_0x3b02d3);}(_0x3eeb,0x132));var _0xb3ee=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x3eeb[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0xb3ee('0x0'));var moment=require(_0xb3ee('0x1'));module[_0xb3ee('0x2')]={'state':{'type':Sequelize[_0xb3ee('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xb3ee('0x4')]},'scheduledat':{'type':Sequelize[_0xb3ee('0x5')]},'countbusyretry':{'type':Sequelize[_0xb3ee('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb3ee('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb3ee('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb3ee('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xb3ee('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb3ee('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xb3ee('0x5')]},'answertime':{'type':Sequelize[_0xb3ee('0x5')]},'droptime':{'type':Sequelize[_0xb3ee('0x5')]},'endtime':{'type':Sequelize[_0xb3ee('0x5')]},'ringtime':{'type':Sequelize[_0xb3ee('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb3ee('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb3ee('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb3ee('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb3ee('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xb3ee('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xb3ee('0x4')]},'disposition':{'type':Sequelize[_0xb3ee('0x4')]},'secondDisposition':{'type':Sequelize[_0xb3ee('0x4')]},'thirdDisposition':{'type':Sequelize[_0xb3ee('0x4')]},'dispositionat':{'type':Sequelize[_0xb3ee('0x5')],'set':function(_0x406fa5){var _0x3dc0e4=this[_0xb3ee('0x6')](_0xb3ee('0x7'));if(_0x3dc0e4&&_0x406fa5){this['setDataValue'](_0xb3ee('0x8'),moment(_0x406fa5)[_0xb3ee('0x9')](moment(_0x3dc0e4),_0xb3ee('0xa')));}}},'amd':{'type':Sequelize[_0xb3ee('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb3ee('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xb3ee('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xb3ee('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xb3ee('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb3ee('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb3ee('0x5')]},'deleted':{'type':Sequelize[_0xb3ee('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xb3ee('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xb3ee('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xb3ee('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb3ee('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb3ee('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb3ee('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc7d6=['DATE','getDataValue','setDataValue','followuptime','seconds','BOOLEAN','sequelize','moment','INTEGER','STRING'];(function(_0x12506b,_0x1e2146){var _0x267aaf=function(_0x11a42f){while(--_0x11a42f){_0x12506b['push'](_0x12506b['shift']());}};_0x267aaf(++_0x1e2146);}(_0xc7d6,0x132));var _0x6c7d=function(_0x22587f,_0x1fd6ce){_0x22587f=_0x22587f-0x0;var _0x109ba4=_0xc7d6[_0x22587f];return _0x109ba4;};'use strict';var Sequelize=require(_0x6c7d('0x0'));var moment=require(_0x6c7d('0x1'));module['exports']={'state':{'type':Sequelize[_0x6c7d('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6c7d('0x3')]},'scheduledat':{'type':Sequelize[_0x6c7d('0x4')]},'countbusyretry':{'type':Sequelize[_0x6c7d('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6c7d('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6c7d('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6c7d('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x6c7d('0x3')]},'originatecalleridname':{'type':Sequelize[_0x6c7d('0x3')]},'calleridnum':{'type':Sequelize[_0x6c7d('0x3')]},'calleridname':{'type':Sequelize[_0x6c7d('0x3')]},'starttime':{'type':Sequelize[_0x6c7d('0x4')]},'responsetime':{'type':Sequelize[_0x6c7d('0x4')]},'answertime':{'type':Sequelize[_0x6c7d('0x4')]},'droptime':{'type':Sequelize[_0x6c7d('0x4')]},'endtime':{'type':Sequelize[_0x6c7d('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6c7d('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6c7d('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6c7d('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6c7d('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x6c7d('0x3')]},'membername':{'type':Sequelize[_0x6c7d('0x3')]},'reason':{'type':Sequelize[_0x6c7d('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6c7d('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6c7d('0x3')]},'dispositionat':{'type':Sequelize[_0x6c7d('0x4')],'set':function(_0x2c5179){var _0x381ff6=this[_0x6c7d('0x5')]('endtime');if(_0x381ff6&&_0x2c5179){this[_0x6c7d('0x6')](_0x6c7d('0x7'),moment(_0x2c5179)['diff'](moment(_0x381ff6),_0x6c7d('0x8')));}}},'amd':{'type':Sequelize[_0x6c7d('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6c7d('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6c7d('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6c7d('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6c7d('0x4')]},'deleted':{'type':Sequelize[_0x6c7d('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6c7d('0x4')]},'recallme':{'type':Sequelize[_0x6c7d('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6c7d('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6c7d('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6c7d('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6c7d('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6c7d('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index c5dcada..532508a 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 _0xc4aa=['ContactId','ListId','ANY_VALUE(VoiceQueueId)','NOW()','createdAt','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','cm_hopper','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','phone','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','CmHopperFinal','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','describe','uniqueid','find','body','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','scheduledAt','VoiceQueueId','updatedAt','field','ANY_VALUE(calleridnum)'];(function(_0x35cb30,_0x12ac50){var _0x2742b9=function(_0x54e888){while(--_0x54e888){_0x35cb30['push'](_0x35cb30['shift']());}};_0x2742b9(++_0x12ac50);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc4aa[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':!![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')]()['then'](respondWithResult(_0x244950,null))['catch'](handleError(_0x244950,null));};exports[_0xac4a('0x23')]=function(_0x4aaeff,_0x18ae96){if(_0x4aaeff['body'][_0xac4a('0x4a')]){delete _0x4aaeff['body'][_0xac4a('0x4a')];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'uniqueid':_0x4aaeff[_0xac4a('0x46')]['id']}})['then'](handleEntityNotFound(_0x18ae96,null))[_0xac4a('0x24')](saveUpdates(_0x4aaeff[_0xac4a('0x4c')],null))[_0xac4a('0x24')](respondWithResult(_0x18ae96,null))[_0xac4a('0x44')](handleError(_0x18ae96,null));};exports[_0xac4a('0x4d')]=function(_0x138876,_0x187306,_0x4e6e19){return db[_0xac4a('0x2c')][_0xac4a('0x4e')]({'raw':![],'where':{'VoiceQueueId':_0x138876['params']['id']},'attributes':[[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x51')))),_0xac4a('0x52')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')]('`state`\x20=\x203,\x201,\x20null'))),_0xac4a('0x54')],[db[_0xac4a('0x4f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')]('`state`\x20=\x205,\x201,\x20null'))),_0xac4a('0x55')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x56')))),_0xac4a('0x57')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x58')))),_0xac4a('0x59')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5a')))),_0xac4a('0x5b')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5c')))),_0xac4a('0x5d')],[db['sequelize']['fn'](_0xac4a('0x50'),db['sequelize']['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x5e')))),'answeringMachine']]})[_0xac4a('0x24')](handleEntityNotFound(_0x187306,null))['then'](respondWithResult(_0x187306,null))['catch'](handleError(_0x187306,null));};exports[_0xac4a('0x5f')]=function(_0x568ffb,_0x3bcae2,_0x3c2f84){return db[_0xac4a('0x2c')][_0xac4a('0x4e')]({'raw':![],'where':{'CampaignId':_0x568ffb['params']['id']},'attributes':[[db[_0xac4a('0x4f')]['fn']('COUNT',db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x51')))),_0xac4a('0x52')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x60')))),_0xac4a('0x54')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x61')))),_0xac4a('0x55')],[db['sequelize']['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x56')))),_0xac4a('0x57')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db['sequelize']['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x58')))),_0xac4a('0x59')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5a')))),_0xac4a('0x5b')],[db[_0xac4a('0x4f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5c')))),_0xac4a('0x5d')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5e')))),_0xac4a('0x62')]]})[_0xac4a('0x24')](handleEntityNotFound(_0x3bcae2,null))['then'](respondWithResult(_0x3bcae2,null))[_0xac4a('0x44')](handleError(_0x3bcae2,null));};exports[_0xac4a('0x63')]=function(_0x26bd31,_0x231932,_0x513976){return db[_0xac4a('0x64')]['find']({'where':{'id':_0x26bd31[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x231932,null))['then'](function(_0x5bd95b){var _0x17eac2;if(_0x5bd95b){_0x17eac2=squel[_0xac4a('0x65')]()[_0xac4a('0x66')]('cm_hopper')[_0xac4a('0x67')](['phone',_0xac4a('0x68'),'ContactId','ListId',_0xac4a('0x69'),'createdAt',_0xac4a('0x6a')],squel['select']()[_0xac4a('0x6b')](_0xac4a('0x6c'),'phone')[_0xac4a('0x6b')]('NOW()',_0xac4a('0x68'))[_0xac4a('0x6b')]('ANY_VALUE(ContactId)',_0xac4a('0x6d'))['field']('ANY_VALUE(ListId)',_0xac4a('0x6e'))['field'](_0xac4a('0x6f'),'VoiceQueueId')['field'](_0xac4a('0x70'),_0xac4a('0x71'))[_0xac4a('0x6b')]('NOW()','updatedAt')[_0xac4a('0x72')](_0xac4a('0x73'))['where']('VoiceQueueId\x20=\x20?',_0x26bd31[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x75'),_0x26bd31[_0xac4a('0x4c')][_0xac4a('0x76')][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x77'))['where'](_0xac4a('0x78'),squel[_0xac4a('0x79')]()[_0xac4a('0x6b')]('phone')[_0xac4a('0x72')](_0xac4a('0x7a'))[_0xac4a('0x3d')](_0xac4a('0x7b'),_0x26bd31[_0xac4a('0x46')]['id']['toString']()))[_0xac4a('0x3d')](_0xac4a('0x78'),squel[_0xac4a('0x79')]()[_0xac4a('0x6b')](_0xac4a('0x7c'))[_0xac4a('0x72')](_0xac4a('0x73'))['where'](_0xac4a('0x7b'),_0x26bd31[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x7d')))[_0xac4a('0x7e')]('ContactId'))[_0xac4a('0x74')]();return db[_0xac4a('0x4f')][_0xac4a('0x31')](_0x17eac2);}return[];})[_0xac4a('0x24')](respondWithResult(_0x231932,null))['catch'](handleError(_0x231932,null));};exports[_0xac4a('0x7f')]=function(_0x56a934,_0x4447b5,_0x22b718){return db['Campaign']['find']({'where':{'id':_0x56a934[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x4447b5,null))[_0xac4a('0x24')](function(_0x4bb03d){var _0x1f3f1c;if(_0x4bb03d){_0x1f3f1c=squel['insert']()[_0xac4a('0x66')](_0xac4a('0x7a'))[_0xac4a('0x67')]([_0xac4a('0x80'),_0xac4a('0x68'),'ContactId','ListId',_0xac4a('0x81'),_0xac4a('0x71'),_0xac4a('0x6a')],squel[_0xac4a('0x79')]()[_0xac4a('0x6b')](_0xac4a('0x6c'),_0xac4a('0x80'))[_0xac4a('0x6b')]('NOW()','scheduledAt')[_0xac4a('0x6b')](_0xac4a('0x82'),_0xac4a('0x6d'))[_0xac4a('0x6b')](_0xac4a('0x83'),_0xac4a('0x6e'))[_0xac4a('0x6b')](_0xac4a('0x84'),'CampaignId')['field'](_0xac4a('0x70'),_0xac4a('0x71'))[_0xac4a('0x6b')](_0xac4a('0x70'),_0xac4a('0x6a'))[_0xac4a('0x72')](_0xac4a('0x73'))['where'](_0xac4a('0x85'),_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())['where'](_0xac4a('0x75'),_0x56a934[_0xac4a('0x4c')][_0xac4a('0x76')][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x77'))[_0xac4a('0x3d')](_0xac4a('0x78'),squel[_0xac4a('0x79')]()['field'](_0xac4a('0x80'))['from'](_0xac4a('0x7a'))[_0xac4a('0x3d')](_0xac4a('0x85'),_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]()))[_0xac4a('0x3d')](_0xac4a('0x78'),squel['select']()[_0xac4a('0x6b')](_0xac4a('0x7c'))[_0xac4a('0x72')](_0xac4a('0x73'))[_0xac4a('0x3d')]('CampaignId\x20=\x20?',_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())['where']('state\x20=\x204'))[_0xac4a('0x7e')](_0xac4a('0x6d')))['toString']();return db[_0xac4a('0x4f')][_0xac4a('0x31')](_0x1f3f1c);}return[];})[_0xac4a('0x24')](respondWithResult(_0x4447b5,null))[_0xac4a('0x44')](handleError(_0x4447b5,null));};exports[_0xac4a('0x86')]=function(_0x34787c,_0x599775,_0xbdff4b){return db[_0xac4a('0x87')][_0xac4a('0x88')]({'where':{'VoiceQueueId':_0x34787c['body'][_0xac4a('0x69')],'CampaignId':_0x34787c[_0xac4a('0x4c')][_0xac4a('0x81')],'ContactId':_0x34787c[_0xac4a('0x4c')][_0xac4a('0x6d')]}})[_0xac4a('0x24')](handleEntityNotFound(_0x599775,null))['then'](function(_0xe84bf7){if(_0xe84bf7){return _0xe84bf7;}return null;})[_0xac4a('0x24')](respondWithResult(_0x599775,null))['catch'](handleError(_0x599775,null));}; \ No newline at end of file +var _0x4137=['squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index','map','CmHopperFinal','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','literal','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','moveContactsIvrCampaignHopperFinal','Campaign','cm_hopper','fromQuery','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','group','checkContactHopper','CmHopper','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4137,0xf8));var _0x7413=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x4137[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x26')]();});}};}function handleEntityNotFound(_0x1d455b,_0x5a8329){return function(_0x5cb15f){if(!_0x5cb15f){_0x1d455b[_0x7413('0x27')](0x194);}return _0x5cb15f;};}function handleError(_0x48c2dc,_0x46c895){_0x46c895=_0x46c895||0x1f4;return function(_0x71cbb4){logger[_0x7413('0x28')](_0x71cbb4['stack']);if(_0x71cbb4[_0x7413('0x29')]){delete _0x71cbb4[_0x7413('0x29')];}_0x48c2dc[_0x7413('0x1a')](_0x46c895)[_0x7413('0x2a')](_0x71cbb4);};}exports[_0x7413('0x2b')]=function(_0x2e521f,_0x5eb4d9){var _0x24dce7={},_0x4ed662={},_0x1d0bde={'count':0x0,'rows':[]};var _0x23e682=_[_0x7413('0x2c')](db[_0x7413('0x2d')][_0x7413('0x2e')],function(_0x2004ea){return{'name':_0x2004ea['fieldName'],'type':_0x2004ea[_0x7413('0x2f')][_0x7413('0x30')]};});_0x4ed662[_0x7413('0x31')]=_[_0x7413('0x2c')](_0x23e682,_0x7413('0x29'));_0x4ed662[_0x7413('0x32')]=_[_0x7413('0x33')](_0x2e521f['query']);_0x4ed662[_0x7413('0x34')]=_[_0x7413('0x35')](_0x4ed662[_0x7413('0x31')],_0x4ed662[_0x7413('0x32')]);_0x24dce7[_0x7413('0x36')]=_['intersection'](_0x4ed662[_0x7413('0x31')],qs['fields'](_0x2e521f[_0x7413('0x32')][_0x7413('0x37')]));_0x24dce7[_0x7413('0x36')]=_0x24dce7['attributes'][_0x7413('0x38')]?_0x24dce7['attributes']:_0x4ed662[_0x7413('0x31')];if(!_0x2e521f[_0x7413('0x32')]['hasOwnProperty']('nolimit')){_0x24dce7[_0x7413('0x1d')]=qs[_0x7413('0x1d')](_0x2e521f[_0x7413('0x32')]['limit']);_0x24dce7['offset']=qs[_0x7413('0x1c')](_0x2e521f['query']['offset']);}_0x24dce7[_0x7413('0x39')]=qs['sort'](_0x2e521f[_0x7413('0x32')][_0x7413('0x3a')]);_0x24dce7[_0x7413('0x3b')]=qs[_0x7413('0x34')](_[_0x7413('0x3c')](_0x2e521f['query'],_0x4ed662[_0x7413('0x34')]),_0x23e682);if(_0x2e521f[_0x7413('0x32')][_0x7413('0x3d')]){_0x24dce7[_0x7413('0x3b')]=_[_0x7413('0x3e')](_0x24dce7[_0x7413('0x3b')],{'$or':_[_0x7413('0x2c')](_0x23e682,function(_0x385156){if(_0x385156[_0x7413('0x2f')]!==_0x7413('0x3f')){var _0x5c03eb={};_0x5c03eb[_0x385156[_0x7413('0x29')]]={'$like':'%'+_0x2e521f['query'][_0x7413('0x3d')]+'%'};return _0x5c03eb;}})});}_0x24dce7=_['merge']({},_0x24dce7,_0x2e521f['options']);var _0x5b592c={'where':_0x24dce7['where']};return db['CmHopperFinal'][_0x7413('0x1e')](_0x5b592c)['then'](function(_0x535e49){_0x1d0bde[_0x7413('0x1e')]=_0x535e49;if(_0x2e521f['query']['includeAll']){_0x24dce7[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2d')][_0x7413('0x41')](_0x24dce7);})[_0x7413('0x25')](function(_0x8049c0){_0x1d0bde['rows']=_0x8049c0;return _0x1d0bde;})[_0x7413('0x25')](respondWithFilteredResult(_0x5eb4d9,_0x24dce7))['catch'](handleError(_0x5eb4d9,null));};exports[_0x7413('0x42')]=function(_0x1d8219,_0xa063d1){var _0xfe0daa={'raw':!![],'where':{'id':_0x1d8219[_0x7413('0x43')]['id']}},_0x3f7da2={};_0x3f7da2[_0x7413('0x31')]=_[_0x7413('0x33')](db[_0x7413('0x2d')][_0x7413('0x2e')]);_0x3f7da2[_0x7413('0x32')]=_[_0x7413('0x33')](_0x1d8219[_0x7413('0x32')]);_0x3f7da2['filters']=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],_0x3f7da2[_0x7413('0x32')]);_0xfe0daa[_0x7413('0x36')]=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],qs[_0x7413('0x37')](_0x1d8219[_0x7413('0x32')][_0x7413('0x37')]));_0xfe0daa[_0x7413('0x36')]=_0xfe0daa[_0x7413('0x36')]['length']?_0xfe0daa[_0x7413('0x36')]:_0x3f7da2['model'];if(_0x1d8219[_0x7413('0x32')][_0x7413('0x44')]){_0xfe0daa[_0x7413('0x40')]=[{'all':!![]}];}_0xfe0daa=_[_0x7413('0x3e')]({},_0xfe0daa,_0x1d8219[_0x7413('0x45')]);return db[_0x7413('0x2d')][_0x7413('0x46')](_0xfe0daa)[_0x7413('0x25')](handleEntityNotFound(_0xa063d1,null))[_0x7413('0x25')](respondWithResult(_0xa063d1,null))[_0x7413('0x47')](handleError(_0xa063d1,null));};exports['describe']=function(_0x513657,_0x3c1f1a){return db['CmHopperFinal']['describe']()[_0x7413('0x25')](respondWithResult(_0x3c1f1a,null))[_0x7413('0x47')](handleError(_0x3c1f1a,null));};exports['update']=function(_0x2aa12c,_0x586d25){if(_0x2aa12c['body'][_0x7413('0x48')]){delete _0x2aa12c['body'][_0x7413('0x48')];}return db[_0x7413('0x2d')][_0x7413('0x46')]({'where':{'uniqueid':_0x2aa12c[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x586d25,null))[_0x7413('0x25')](saveUpdates(_0x2aa12c[_0x7413('0x49')],null))[_0x7413('0x25')](respondWithResult(_0x586d25,null))[_0x7413('0x47')](handleError(_0x586d25,null));};exports[_0x7413('0x4a')]=function(_0x50a27d,_0x369891,_0x501407){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x50a27d[_0x7413('0x43')]['id']},'attributes':[[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x7413('0x4d')))),'noSuchContacts'],[db[_0x7413('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x7413('0x4e')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')]['literal'](_0x7413('0x4f')))),_0x7413('0x50')],[db[_0x7413('0x4b')]['fn']('COUNT',db[_0x7413('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x7413('0x51')))),_0x7413('0x52')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')]['literal'](_0x7413('0x53')))),'dropContacts'],[db[_0x7413('0x4b')]['fn']('COUNT',db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x55')))),'abandonedContacts'],[db[_0x7413('0x4b')]['fn']('COUNT',db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')]['literal'](_0x7413('0x56')))),_0x7413('0x57')],[db['sequelize']['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x58')))),_0x7413('0x59')]]})[_0x7413('0x25')](handleEntityNotFound(_0x369891,null))[_0x7413('0x25')](respondWithResult(_0x369891,null))[_0x7413('0x47')](handleError(_0x369891,null));};exports[_0x7413('0x5a')]=function(_0x28130e,_0x593571,_0x35f7e8){return db['CmHopperFinal'][_0x7413('0x41')]({'raw':![],'where':{'CampaignId':_0x28130e[_0x7413('0x43')]['id']},'attributes':[[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x5b')))),_0x7413('0x4e')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x4f')))),_0x7413('0x50')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x51')))),'congestionContacts'],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x53')))),'dropContacts'],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db['sequelize']['fn']('IF',db[_0x7413('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7413('0x5c')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x56')))),_0x7413('0x57')],[db['sequelize']['fn'](_0x7413('0x4c'),db['sequelize']['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x58')))),_0x7413('0x59')]]})[_0x7413('0x25')](handleEntityNotFound(_0x593571,null))[_0x7413('0x25')](respondWithResult(_0x593571,null))[_0x7413('0x47')](handleError(_0x593571,null));};exports[_0x7413('0x5d')]=function(_0x2c504e,_0x50910a,_0x5988bd){return db[_0x7413('0x5e')]['find']({'where':{'id':_0x2c504e[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x50910a,null))['then'](function(_0x2be9b1){var _0x4b676a;if(_0x2be9b1){_0x4b676a=squel[_0x7413('0x5f')]()[_0x7413('0x60')]('cm_hopper')['fromQuery']([_0x7413('0x61'),_0x7413('0x62'),_0x7413('0x63'),'ListId',_0x7413('0x64'),_0x7413('0x65'),_0x7413('0x66')],squel[_0x7413('0x67')]()[_0x7413('0x68')](_0x7413('0x69'),'phone')[_0x7413('0x68')](_0x7413('0x6a'),_0x7413('0x62'))['field'](_0x7413('0x6b'),_0x7413('0x63'))[_0x7413('0x68')](_0x7413('0x6c'),_0x7413('0x6d'))[_0x7413('0x68')](_0x7413('0x6e'),_0x7413('0x64'))[_0x7413('0x68')]('NOW()',_0x7413('0x65'))[_0x7413('0x68')](_0x7413('0x6a'),_0x7413('0x66'))[_0x7413('0x6f')](_0x7413('0x70'))['where'](_0x7413('0x71'),_0x2c504e['params']['id']['toString']())[_0x7413('0x3b')](_0x7413('0x72'),_0x2c504e['body'][_0x7413('0x73')][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x75'))[_0x7413('0x3b')](_0x7413('0x76'),squel[_0x7413('0x67')]()[_0x7413('0x68')]('phone')[_0x7413('0x6f')]('cm_hopper')[_0x7413('0x3b')](_0x7413('0x71'),_0x2c504e['params']['id'][_0x7413('0x74')]()))[_0x7413('0x3b')](_0x7413('0x76'),squel[_0x7413('0x67')]()[_0x7413('0x68')](_0x7413('0x77'))[_0x7413('0x6f')](_0x7413('0x70'))[_0x7413('0x3b')](_0x7413('0x71'),_0x2c504e['params']['id'][_0x7413('0x74')]())[_0x7413('0x3b')]('state\x20=\x204'))['group']('ContactId'))[_0x7413('0x74')]();return db['sequelize'][_0x7413('0x32')](_0x4b676a);}return[];})[_0x7413('0x25')](respondWithResult(_0x50910a,null))[_0x7413('0x47')](handleError(_0x50910a,null));};exports[_0x7413('0x78')]=function(_0x470c21,_0x17c115,_0xbba3c7){return db[_0x7413('0x79')][_0x7413('0x46')]({'where':{'id':_0x470c21['params']['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x17c115,null))[_0x7413('0x25')](function(_0x38bb4e){var _0x4ea60e;if(_0x38bb4e){_0x4ea60e=squel[_0x7413('0x5f')]()[_0x7413('0x60')](_0x7413('0x7a'))[_0x7413('0x7b')]([_0x7413('0x61'),_0x7413('0x62'),_0x7413('0x63'),_0x7413('0x6d'),_0x7413('0x7c'),_0x7413('0x65'),'updatedAt'],squel[_0x7413('0x67')]()[_0x7413('0x68')]('ANY_VALUE(calleridnum)',_0x7413('0x61'))[_0x7413('0x68')]('NOW()',_0x7413('0x62'))[_0x7413('0x68')](_0x7413('0x6b'),'ContactId')[_0x7413('0x68')]('ANY_VALUE(ListId)',_0x7413('0x6d'))[_0x7413('0x68')](_0x7413('0x7d'),_0x7413('0x7c'))[_0x7413('0x68')](_0x7413('0x6a'),'createdAt')[_0x7413('0x68')](_0x7413('0x6a'),_0x7413('0x66'))[_0x7413('0x6f')](_0x7413('0x70'))['where'](_0x7413('0x7e'),_0x470c21[_0x7413('0x43')]['id'][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x72'),_0x470c21['body']['state'][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x75'))[_0x7413('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x7413('0x68')](_0x7413('0x61'))[_0x7413('0x6f')]('cm_hopper')['where'](_0x7413('0x7e'),_0x470c21[_0x7413('0x43')]['id'][_0x7413('0x74')]()))[_0x7413('0x3b')](_0x7413('0x76'),squel[_0x7413('0x67')]()[_0x7413('0x68')]('calleridnum')['from'](_0x7413('0x70'))[_0x7413('0x3b')]('CampaignId\x20=\x20?',_0x470c21[_0x7413('0x43')]['id'][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x7f')))[_0x7413('0x80')](_0x7413('0x63')))[_0x7413('0x74')]();return db[_0x7413('0x4b')][_0x7413('0x32')](_0x4ea60e);}return[];})['then'](respondWithResult(_0x17c115,null))[_0x7413('0x47')](handleError(_0x17c115,null));};exports[_0x7413('0x81')]=function(_0x59d665,_0x1f3e26,_0xccd480){return db[_0x7413('0x82')]['findOne']({'where':{'VoiceQueueId':_0x59d665['body']['VoiceQueueId'],'CampaignId':_0x59d665[_0x7413('0x49')][_0x7413('0x7c')],'ContactId':_0x59d665[_0x7413('0x49')][_0x7413('0x63')]}})[_0x7413('0x25')](handleEntityNotFound(_0x1f3e26,null))[_0x7413('0x25')](function(_0x207293){if(_0x207293){return _0x207293;}return null;})[_0x7413('0x25')](respondWithResult(_0x1f3e26,null))['catch'](handleError(_0x1f3e26,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index d65ea4f..d20f772 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 _0x1da9=['exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','moment','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes'];(function(_0x2bf916,_0x5cff9b){var _0x4b8dd5=function(_0x47b63a){while(--_0x47b63a){_0x2bf916['push'](_0x2bf916['shift']());}};_0x4b8dd5(++_0x5cff9b);}(_0x1da9,0x88));var _0x91da=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x1da9[_0xbca1b1];return _0x4e1686;};'use strict';var _=require('lodash');var util=require(_0x91da('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x91da('0x1'));var BPromise=require(_0x91da('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91da('0x3'));var rimraf=require(_0x91da('0x4'));var config=require(_0x91da('0x5'));var attributes=require(_0x91da('0x6'));module[_0x91da('0x7')]=function(_0x5ce4cb,_0x56f470){return _0x5ce4cb[_0x91da('0x8')](_0x91da('0x9'),attributes,{'tableName':_0x91da('0xa'),'paranoid':![],'indexes':[{'name':_0x91da('0xb'),'fields':[_0x91da('0xb')]},{'name':_0x91da('0xc'),'fields':[_0x91da('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xea05=['util','api','moment','path','rimraf','../../config/environment','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x151334,_0x1e11ac){var _0x3d03da=function(_0x2099cf){while(--_0x2099cf){_0x151334['push'](_0x151334['shift']());}};_0x3d03da(++_0x1e11ac);}(_0xea05,0x9b));var _0x5ea0=function(_0x22c353,_0x15ee55){_0x22c353=_0x22c353-0x0;var _0x54d388=_0xea05[_0x22c353];return _0x54d388;};'use strict';var _=require(_0x5ea0('0x0'));var util=require(_0x5ea0('0x1'));var logger=require('../../config/logger')(_0x5ea0('0x2'));var moment=require(_0x5ea0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ea0('0x4'));var rimraf=require(_0x5ea0('0x5'));var config=require(_0x5ea0('0x6'));var attributes=require('./cmHopperFinal.attributes');module[_0x5ea0('0x7')]=function(_0x48f0d6,_0x5c1d84){return _0x48f0d6[_0x5ea0('0x8')](_0x5ea0('0x9'),attributes,{'tableName':_0x5ea0('0xa'),'paranoid':![],'indexes':[{'name':_0x5ea0('0xb'),'fields':[_0x5ea0('0xb')]},{'name':_0x5ea0('0xc'),'fields':[_0x5ea0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 39312d2..93e23fa 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x330b68,_0x38daca){var _0x4ea306=function(_0x26e574){while(--_0x26e574){_0x330b68['push'](_0x330b68['shift']());}};_0x4ea306(++_0x38daca);}(_0x7a54,0x106));var _0x47a5=function(_0x3e770b,_0x327656){_0x3e770b=_0x3e770b-0x0;var _0x43a9f2=_0x7a54[_0x3e770b];return _0x43a9f2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1908c1,_0x5e6c18){var _0x2be77f=function(_0x5ecffd){while(--_0x5ecffd){_0x1908c1['push'](_0x1908c1['shift']());}};_0x2be77f(++_0x5e6c18);}(_0x7a54,0x106));var _0x47a5=function(_0x2d7230,_0x3f5ff0){_0x2d7230=_0x2d7230-0x0;var _0x2855d3=_0x7a54[_0x2d7230];return _0x2855d3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index e7ed55d..89f0a0b 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 _0x9fda=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','connect-timeout','express','Router'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x9fda,0x8c));var _0xa9fd=function(_0x1f1507,_0x30356b){_0x1f1507=_0x1f1507-0x0;var _0x41681b=_0x9fda[_0x1f1507];return _0x41681b;};'use strict';var multer=require(_0xa9fd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa9fd('0x1'));var express=require(_0xa9fd('0x2'));var router=express[_0xa9fd('0x3')]();var fs_extra=require(_0xa9fd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa9fd('0x5'));var config=require(_0xa9fd('0x6'));var controller=require('./cmHopperFinal.controller');router[_0xa9fd('0x7')]('/',auth[_0xa9fd('0x8')](),controller['index']);router['get'](_0xa9fd('0x9'),auth[_0xa9fd('0x8')](),controller[_0xa9fd('0xa')]);router[_0xa9fd('0x7')](_0xa9fd('0xb'),auth['isAuthenticated'](),controller[_0xa9fd('0xc')]);router[_0xa9fd('0x7')](_0xa9fd('0xd'),auth['isAuthenticated'](),controller[_0xa9fd('0xe')]);router['get']('/campaign/countAttributes/:id',auth[_0xa9fd('0x8')](),controller[_0xa9fd('0xf')]);router[_0xa9fd('0x10')]('/voice/queue/moveContacts/:id',auth[_0xa9fd('0x8')](),controller[_0xa9fd('0x11')]);router[_0xa9fd('0x10')](_0xa9fd('0x12'),auth['isAuthenticated'](),controller[_0xa9fd('0x13')]);router[_0xa9fd('0x10')](_0xa9fd('0x14'),auth[_0xa9fd('0x8')](),controller[_0xa9fd('0x15')]);router[_0xa9fd('0x16')](_0xa9fd('0xb'),auth[_0xa9fd('0x8')](),controller['update']);module[_0xa9fd('0x17')]=router; \ No newline at end of file +var _0x4dd9=['countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','get','/describe','describe','/:id','/voice/queue/countAttributes/:id'];(function(_0x52f189,_0x222a76){var _0x417d4f=function(_0xcaeedb){while(--_0xcaeedb){_0x52f189['push'](_0x52f189['shift']());}};_0x417d4f(++_0x222a76);}(_0x4dd9,0x1f2));var _0x94dd=function(_0x4cfcbf,_0x7804a2){_0x4cfcbf=_0x4cfcbf-0x0;var _0x152d90=_0x4dd9[_0x4cfcbf];return _0x152d90;};'use strict';var multer=require(_0x94dd('0x0'));var util=require(_0x94dd('0x1'));var path=require(_0x94dd('0x2'));var timeout=require(_0x94dd('0x3'));var express=require(_0x94dd('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x94dd('0x5'));var interaction=require(_0x94dd('0x6'));var config=require(_0x94dd('0x7'));var controller=require(_0x94dd('0x8'));router['get']('/',auth[_0x94dd('0x9')](),controller['index']);router[_0x94dd('0xa')](_0x94dd('0xb'),auth[_0x94dd('0x9')](),controller[_0x94dd('0xc')]);router[_0x94dd('0xa')](_0x94dd('0xd'),auth[_0x94dd('0x9')](),controller['show']);router[_0x94dd('0xa')](_0x94dd('0xe'),auth['isAuthenticated'](),controller[_0x94dd('0xf')]);router[_0x94dd('0xa')](_0x94dd('0x10'),auth['isAuthenticated'](),controller[_0x94dd('0x11')]);router[_0x94dd('0x12')](_0x94dd('0x13'),auth[_0x94dd('0x9')](),controller[_0x94dd('0x14')]);router['post'](_0x94dd('0x15'),auth[_0x94dd('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x94dd('0x12')](_0x94dd('0x16'),auth[_0x94dd('0x9')](),controller[_0x94dd('0x17')]);router[_0x94dd('0x18')](_0x94dd('0xd'),auth[_0x94dd('0x9')](),controller[_0x94dd('0x19')]);module[_0x94dd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index d04ef6e..50408d5 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 _0x6140=['STRING','DATE','BOOLEAN','sequelize','INTEGER'];(function(_0x12aefd,_0x1192e8){var _0x3ce59d=function(_0x7d07c2){while(--_0x7d07c2){_0x12aefd['push'](_0x12aefd['shift']());}};_0x3ce59d(++_0x1192e8);}(_0x6140,0x125));var _0x0614=function(_0x568b93,_0x1a7f8b){_0x568b93=_0x568b93-0x0;var _0xffd843=_0x6140[_0x568b93];return _0xffd843;};'use strict';var Sequelize=require(_0x0614('0x0'));module['exports']={'state':{'type':Sequelize[_0x0614('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x0614('0x2')]},'scheduledat':{'type':Sequelize[_0x0614('0x3')]},'countbusyretry':{'type':Sequelize[_0x0614('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0614('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0614('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x0614('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0614('0x2')]},'calleridname':{'type':Sequelize[_0x0614('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x0614('0x3')]},'answertime':{'type':Sequelize[_0x0614('0x3')]},'droptime':{'type':Sequelize[_0x0614('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0614('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0614('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0614('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x0614('0x2')]},'membername':{'type':Sequelize[_0x0614('0x2')]},'reason':{'type':Sequelize[_0x0614('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x0614('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0614('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x0614('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x0614('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0614('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0614('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0614('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3525=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x4aba11,_0x22e531){var _0x8808aa=function(_0x30967c){while(--_0x30967c){_0x4aba11['push'](_0x4aba11['shift']());}};_0x8808aa(++_0x22e531);}(_0x3525,0x16a));var _0x5352=function(_0x4ec7d1,_0x1cb648){_0x4ec7d1=_0x4ec7d1-0x0;var _0x147f03=_0x3525[_0x4ec7d1];return _0x147f03;};'use strict';var Sequelize=require(_0x5352('0x0'));module[_0x5352('0x1')]={'state':{'type':Sequelize[_0x5352('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5352('0x3')]},'scheduledat':{'type':Sequelize[_0x5352('0x4')]},'countbusyretry':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x5352('0x3')]},'originatecalleridname':{'type':Sequelize[_0x5352('0x3')]},'calleridnum':{'type':Sequelize[_0x5352('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x5352('0x4')]},'answertime':{'type':Sequelize[_0x5352('0x4')]},'droptime':{'type':Sequelize[_0x5352('0x4')]},'endtime':{'type':Sequelize[_0x5352('0x4')]},'ringtime':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x5352('0x3')]},'campaigntype':{'type':Sequelize[_0x5352('0x3')]},'membername':{'type':Sequelize[_0x5352('0x3')]},'reason':{'type':Sequelize[_0x5352('0x3')]},'amd':{'type':Sequelize[_0x5352('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5352('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x5352('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5352('0x4')]},'edited':{'type':Sequelize[_0x5352('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5352('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5352('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 0848bb8..d01a623 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 _0x652a=['body','describe','uniqueid','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','json','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','filter','options','CmHopperHistory','rows','catch','params','includeAll','find'];(function(_0x596974,_0x2f7e48){var _0x2cf1f3=function(_0x264390){while(--_0x264390){_0x596974['push'](_0x596974['shift']());}};_0x2cf1f3(++_0x2f7e48);}(_0x652a,0x195));var _0xa652=function(_0x4d31c9,_0x2fbc37){_0x4d31c9=_0x4d31c9-0x0;var _0x1518d9=_0x652a[_0x4d31c9];return _0x1518d9;};'use strict';var emlformat=require(_0xa652('0x0'));var rimraf=require(_0xa652('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa652('0x2'));var rp=require(_0xa652('0x3'));var moment=require(_0xa652('0x4'));var BPromise=require(_0xa652('0x5'));var Mustache=require(_0xa652('0x6'));var util=require('util');var path=require(_0xa652('0x7'));var sox=require('sox');var csv=require(_0xa652('0x8'));var ejs=require(_0xa652('0x9'));var fs=require('fs');var fs_extra=require(_0xa652('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa652('0xb'));var jsforce=require(_0xa652('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa652('0xd'));var Papa=require(_0xa652('0xe'));var Redis=require(_0xa652('0xf'));var authService=require(_0xa652('0x10'));var qs=require(_0xa652('0x11'));var as=require(_0xa652('0x12'));var hardwareService=require(_0xa652('0x13'));var logger=require('../../config/logger')(_0xa652('0x14'));var utils=require('../../config/utils');var config=require(_0xa652('0x15'));var licenseUtil=require(_0xa652('0x16'));var db=require(_0xa652('0x17'))['db'];function respondWithStatusCode(_0x1c66bd,_0x531bbc){_0x531bbc=_0x531bbc||0xcc;return function(_0x573afc){if(_0x573afc){return _0x1c66bd['sendStatus'](_0x531bbc);}return _0x1c66bd[_0xa652('0x18')](_0x531bbc)[_0xa652('0x19')]();};}function respondWithResult(_0x5a4287,_0x5d772a){_0x5d772a=_0x5d772a||0xc8;return function(_0x50fe48){if(_0x50fe48){return _0x5a4287[_0xa652('0x18')](_0x5d772a)['json'](_0x50fe48);}};}function respondWithFilteredResult(_0x11099b,_0x3039a8){return function(_0xfd1040){if(_0xfd1040){var _0x141950=typeof _0x3039a8[_0xa652('0x1a')]===_0xa652('0x1b')&&typeof _0x3039a8[_0xa652('0x1c')]===_0xa652('0x1b');var _0x307439=_0xfd1040[_0xa652('0x1d')];var _0x2c54c6=_0x141950?0x0:_0x3039a8[_0xa652('0x1a')];var _0x3bef73=_0x141950?_0xfd1040[_0xa652('0x1d')]:_0x3039a8[_0xa652('0x1a')]+_0x3039a8[_0xa652('0x1c')];var _0x5e2820;if(_0x3bef73>=_0x307439){_0x3bef73=_0x307439;_0x5e2820=0xc8;}else{_0x5e2820=0xce;}_0x11099b[_0xa652('0x18')](_0x5e2820);return _0x11099b['set']('Content-Range',_0x2c54c6+'-'+_0x3bef73+'/'+_0x307439)[_0xa652('0x1e')](_0xfd1040);}return null;};}function patchUpdates(_0x1a793e){return function(_0x4d4ef5){try{jsonpatch[_0xa652('0x1f')](_0x4d4ef5,_0x1a793e,!![]);}catch(_0x1600cb){return BPromise[_0xa652('0x20')](_0x1600cb);}return _0x4d4ef5[_0xa652('0x21')]();};}function saveUpdates(_0x29e8dc,_0x284c44){return function(_0x3964ad){if(_0x3964ad){return _0x3964ad['update'](_0x29e8dc)[_0xa652('0x22')](function(_0x21350e){return _0x21350e;});}return null;};}function removeEntity(_0x4fb0b1,_0x1c9044){return function(_0x2a2588){if(_0x2a2588){return _0x2a2588[_0xa652('0x23')]()[_0xa652('0x22')](function(){_0x4fb0b1[_0xa652('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23a995,_0x354887){return function(_0x406da4){if(!_0x406da4){_0x23a995['sendStatus'](0x194);}return _0x406da4;};}function handleError(_0x16d92d,_0x19bad7){_0x19bad7=_0x19bad7||0x1f4;return function(_0xd28cc0){logger['error'](_0xd28cc0[_0xa652('0x24')]);if(_0xd28cc0[_0xa652('0x25')]){delete _0xd28cc0[_0xa652('0x25')];}_0x16d92d[_0xa652('0x18')](_0x19bad7)[_0xa652('0x26')](_0xd28cc0);};}exports[_0xa652('0x27')]=function(_0x14c1ac,_0xc0cec2){var _0x3ab97c={},_0x4935f8={},_0x144535={'count':0x0,'rows':[]};var _0x1611ea=_[_0xa652('0x28')](db['CmHopperHistory'][_0xa652('0x29')],function(_0x5a618d){return{'name':_0x5a618d['fieldName'],'type':_0x5a618d[_0xa652('0x2a')]['key']};});_0x4935f8[_0xa652('0x2b')]=_[_0xa652('0x28')](_0x1611ea,_0xa652('0x25'));_0x4935f8[_0xa652('0x2c')]=_[_0xa652('0x2d')](_0x14c1ac['query']);_0x4935f8[_0xa652('0x2e')]=_['intersection'](_0x4935f8[_0xa652('0x2b')],_0x4935f8['query']);_0x3ab97c[_0xa652('0x2f')]=_[_0xa652('0x30')](_0x4935f8[_0xa652('0x2b')],qs[_0xa652('0x31')](_0x14c1ac['query']['fields']));_0x3ab97c[_0xa652('0x2f')]=_0x3ab97c[_0xa652('0x2f')][_0xa652('0x32')]?_0x3ab97c[_0xa652('0x2f')]:_0x4935f8[_0xa652('0x2b')];if(!_0x14c1ac['query']['hasOwnProperty']('nolimit')){_0x3ab97c[_0xa652('0x1c')]=qs[_0xa652('0x1c')](_0x14c1ac[_0xa652('0x2c')][_0xa652('0x1c')]);_0x3ab97c[_0xa652('0x1a')]=qs[_0xa652('0x1a')](_0x14c1ac[_0xa652('0x2c')][_0xa652('0x1a')]);}_0x3ab97c[_0xa652('0x33')]=qs['sort'](_0x14c1ac[_0xa652('0x2c')][_0xa652('0x34')]);_0x3ab97c[_0xa652('0x35')]=qs[_0xa652('0x2e')](_[_0xa652('0x36')](_0x14c1ac[_0xa652('0x2c')],_0x4935f8[_0xa652('0x2e')]),_0x1611ea);if(_0x14c1ac['query']['filter']){_0x3ab97c['where']=_[_0xa652('0x37')](_0x3ab97c['where'],{'$or':_['map'](_0x1611ea,function(_0x179dbf){if(_0x179dbf[_0xa652('0x2a')]!=='VIRTUAL'){var _0x5899d6={};_0x5899d6[_0x179dbf['name']]={'$like':'%'+_0x14c1ac['query'][_0xa652('0x38')]+'%'};return _0x5899d6;}})});}_0x3ab97c=_[_0xa652('0x37')]({},_0x3ab97c,_0x14c1ac[_0xa652('0x39')]);var _0x4f3ee2={'where':_0x3ab97c[_0xa652('0x35')]};return db[_0xa652('0x3a')][_0xa652('0x1d')](_0x4f3ee2)['then'](function(_0x1a7f40){_0x144535[_0xa652('0x1d')]=_0x1a7f40;if(_0x14c1ac[_0xa652('0x2c')]['includeAll']){_0x3ab97c['include']=[{'all':!![]}];}return db[_0xa652('0x3a')]['findAll'](_0x3ab97c);})[_0xa652('0x22')](function(_0x1a50a7){_0x144535[_0xa652('0x3b')]=_0x1a50a7;return _0x144535;})[_0xa652('0x22')](respondWithFilteredResult(_0xc0cec2,_0x3ab97c))[_0xa652('0x3c')](handleError(_0xc0cec2,null));};exports['show']=function(_0x4f1068,_0x3a6d8b){var _0xec426d={'raw':!![],'where':{'id':_0x4f1068[_0xa652('0x3d')]['id']}},_0x2c06d2={};_0x2c06d2['model']=_['keys'](db[_0xa652('0x3a')]['rawAttributes']);_0x2c06d2['query']=_['keys'](_0x4f1068['query']);_0x2c06d2[_0xa652('0x2e')]=_['intersection'](_0x2c06d2[_0xa652('0x2b')],_0x2c06d2['query']);_0xec426d['attributes']=_[_0xa652('0x30')](_0x2c06d2[_0xa652('0x2b')],qs['fields'](_0x4f1068[_0xa652('0x2c')][_0xa652('0x31')]));_0xec426d[_0xa652('0x2f')]=_0xec426d[_0xa652('0x2f')][_0xa652('0x32')]?_0xec426d['attributes']:_0x2c06d2[_0xa652('0x2b')];if(_0x4f1068['query'][_0xa652('0x3e')]){_0xec426d['include']=[{'all':!![]}];}_0xec426d=_[_0xa652('0x37')]({},_0xec426d,_0x4f1068[_0xa652('0x39')]);return db[_0xa652('0x3a')][_0xa652('0x3f')](_0xec426d)[_0xa652('0x22')](handleEntityNotFound(_0x3a6d8b,null))[_0xa652('0x22')](respondWithResult(_0x3a6d8b,null))['catch'](handleError(_0x3a6d8b,null));};exports['create']=function(_0x2b1b06,_0x4c7927){return db[_0xa652('0x3a')]['create'](_0x2b1b06[_0xa652('0x40')],{})['then'](respondWithResult(_0x4c7927,0xc9))[_0xa652('0x3c')](handleError(_0x4c7927,null));};exports[_0xa652('0x41')]=function(_0x56e2b1,_0x572678){return db['CmHopperHistory'][_0xa652('0x41')]()[_0xa652('0x22')](respondWithResult(_0x572678,null))['catch'](handleError(_0x572678,null));};exports['update']=function(_0x49ce86,_0x1d039a){if(_0x49ce86['body'][_0xa652('0x42')]){delete _0x49ce86[_0xa652('0x40')][_0xa652('0x42')];}return db[_0xa652('0x3a')][_0xa652('0x3f')]({'where':{'uniqueid':_0x49ce86[_0xa652('0x3d')]['id']}})[_0xa652('0x22')](handleEntityNotFound(_0x1d039a,null))[_0xa652('0x22')](saveUpdates(_0x49ce86['body'],null))['then'](respondWithResult(_0x1d039a,null))[_0xa652('0x3c')](handleError(_0x1d039a,null));}; \ No newline at end of file +var _0xc89f=['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','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','length','find','create','describe','body','uniqueid','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x149e78,_0x46a344){var _0xe7834d=function(_0xdf06f9){while(--_0xdf06f9){_0x149e78['push'](_0x149e78['shift']());}};_0xe7834d(++_0x46a344);}(_0xc89f,0x8f));var _0xfc89=function(_0x4214ae,_0x2dd218){_0x4214ae=_0x4214ae-0x0;var _0x1f15ec=_0xc89f[_0x4214ae];return _0x1f15ec;};'use strict';var emlformat=require(_0xfc89('0x0'));var rimraf=require(_0xfc89('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfc89('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfc89('0x3'));var Mustache=require(_0xfc89('0x4'));var util=require(_0xfc89('0x5'));var path=require(_0xfc89('0x6'));var sox=require(_0xfc89('0x7'));var csv=require(_0xfc89('0x8'));var ejs=require(_0xfc89('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfc89('0xa'));var squel=require(_0xfc89('0xb'));var crypto=require(_0xfc89('0xc'));var jsforce=require(_0xfc89('0xd'));var deskjs=require(_0xfc89('0xe'));var toCsv=require(_0xfc89('0x8'));var querystring=require(_0xfc89('0xf'));var Papa=require(_0xfc89('0x10'));var Redis=require(_0xfc89('0x11'));var authService=require(_0xfc89('0x12'));var qs=require(_0xfc89('0x13'));var as=require(_0xfc89('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc89('0x15'))(_0xfc89('0x16'));var utils=require(_0xfc89('0x17'));var config=require(_0xfc89('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xfc89('0x19'))['db'];function respondWithStatusCode(_0x2cc076,_0x472290){_0x472290=_0x472290||0xcc;return function(_0x200b8c){if(_0x200b8c){return _0x2cc076[_0xfc89('0x1a')](_0x472290);}return _0x2cc076[_0xfc89('0x1b')](_0x472290)[_0xfc89('0x1c')]();};}function respondWithResult(_0x27a4b2,_0x332ea2){_0x332ea2=_0x332ea2||0xc8;return function(_0x55c937){if(_0x55c937){return _0x27a4b2[_0xfc89('0x1b')](_0x332ea2)[_0xfc89('0x1d')](_0x55c937);}};}function respondWithFilteredResult(_0x56cdf,_0x2ff777){return function(_0x1cb4e7){if(_0x1cb4e7){var _0x3018e5=typeof _0x2ff777[_0xfc89('0x1e')]===_0xfc89('0x1f')&&typeof _0x2ff777['limit']==='undefined';var _0xe869a9=_0x1cb4e7['count'];var _0x5ed477=_0x3018e5?0x0:_0x2ff777[_0xfc89('0x1e')];var _0x4bc3f0=_0x3018e5?_0x1cb4e7[_0xfc89('0x20')]:_0x2ff777[_0xfc89('0x1e')]+_0x2ff777[_0xfc89('0x21')];var _0x27a4e0;if(_0x4bc3f0>=_0xe869a9){_0x4bc3f0=_0xe869a9;_0x27a4e0=0xc8;}else{_0x27a4e0=0xce;}_0x56cdf['status'](_0x27a4e0);return _0x56cdf[_0xfc89('0x22')](_0xfc89('0x23'),_0x5ed477+'-'+_0x4bc3f0+'/'+_0xe869a9)[_0xfc89('0x1d')](_0x1cb4e7);}return null;};}function patchUpdates(_0x186f49){return function(_0x33cad0){try{jsonpatch['apply'](_0x33cad0,_0x186f49,!![]);}catch(_0x6af972){return BPromise[_0xfc89('0x24')](_0x6af972);}return _0x33cad0[_0xfc89('0x25')]();};}function saveUpdates(_0x3239d5,_0x198913){return function(_0x57bd33){if(_0x57bd33){return _0x57bd33[_0xfc89('0x26')](_0x3239d5)['then'](function(_0x3d357a){return _0x3d357a;});}return null;};}function removeEntity(_0x28ca1f,_0x2dbe8c){return function(_0x5a113d){if(_0x5a113d){return _0x5a113d['destroy']()[_0xfc89('0x27')](function(){_0x28ca1f[_0xfc89('0x1b')](0xcc)[_0xfc89('0x1c')]();});}};}function handleEntityNotFound(_0x27940b,_0x1cf396){return function(_0x203445){if(!_0x203445){_0x27940b[_0xfc89('0x1a')](0x194);}return _0x203445;};}function handleError(_0x3ecc58,_0x5630af){_0x5630af=_0x5630af||0x1f4;return function(_0x556a99){logger[_0xfc89('0x28')](_0x556a99[_0xfc89('0x29')]);if(_0x556a99[_0xfc89('0x2a')]){delete _0x556a99[_0xfc89('0x2a')];}_0x3ecc58[_0xfc89('0x1b')](_0x5630af)[_0xfc89('0x2b')](_0x556a99);};}exports[_0xfc89('0x2c')]=function(_0x45d2e7,_0x15feb0){var _0x146211={},_0x3d2188={},_0xfa8310={'count':0x0,'rows':[]};var _0x2c9ffb=_[_0xfc89('0x2d')](db[_0xfc89('0x2e')][_0xfc89('0x2f')],function(_0x52281b){return{'name':_0x52281b['fieldName'],'type':_0x52281b[_0xfc89('0x30')][_0xfc89('0x31')]};});_0x3d2188[_0xfc89('0x32')]=_[_0xfc89('0x2d')](_0x2c9ffb,_0xfc89('0x2a'));_0x3d2188[_0xfc89('0x33')]=_[_0xfc89('0x34')](_0x45d2e7['query']);_0x3d2188[_0xfc89('0x35')]=_[_0xfc89('0x36')](_0x3d2188[_0xfc89('0x32')],_0x3d2188[_0xfc89('0x33')]);_0x146211[_0xfc89('0x37')]=_['intersection'](_0x3d2188[_0xfc89('0x32')],qs[_0xfc89('0x38')](_0x45d2e7['query'][_0xfc89('0x38')]));_0x146211[_0xfc89('0x37')]=_0x146211[_0xfc89('0x37')]['length']?_0x146211['attributes']:_0x3d2188['model'];if(!_0x45d2e7[_0xfc89('0x33')][_0xfc89('0x39')]('nolimit')){_0x146211[_0xfc89('0x21')]=qs['limit'](_0x45d2e7[_0xfc89('0x33')][_0xfc89('0x21')]);_0x146211['offset']=qs[_0xfc89('0x1e')](_0x45d2e7['query'][_0xfc89('0x1e')]);}_0x146211[_0xfc89('0x3a')]=qs['sort'](_0x45d2e7['query'][_0xfc89('0x3b')]);_0x146211[_0xfc89('0x3c')]=qs[_0xfc89('0x35')](_[_0xfc89('0x3d')](_0x45d2e7[_0xfc89('0x33')],_0x3d2188[_0xfc89('0x35')]),_0x2c9ffb);if(_0x45d2e7[_0xfc89('0x33')]['filter']){_0x146211[_0xfc89('0x3c')]=_[_0xfc89('0x3e')](_0x146211[_0xfc89('0x3c')],{'$or':_[_0xfc89('0x2d')](_0x2c9ffb,function(_0xe49f22){if(_0xe49f22[_0xfc89('0x30')]!==_0xfc89('0x3f')){var _0x31337f={};_0x31337f[_0xe49f22[_0xfc89('0x2a')]]={'$like':'%'+_0x45d2e7['query'][_0xfc89('0x40')]+'%'};return _0x31337f;}})});}_0x146211=_[_0xfc89('0x3e')]({},_0x146211,_0x45d2e7[_0xfc89('0x41')]);var _0x1363c5={'where':_0x146211['where']};return db[_0xfc89('0x2e')][_0xfc89('0x20')](_0x1363c5)[_0xfc89('0x27')](function(_0x3d8e59){_0xfa8310['count']=_0x3d8e59;if(_0x45d2e7[_0xfc89('0x33')][_0xfc89('0x42')]){_0x146211[_0xfc89('0x43')]=[{'all':!![]}];}return db[_0xfc89('0x2e')][_0xfc89('0x44')](_0x146211);})[_0xfc89('0x27')](function(_0x4bf28f){_0xfa8310['rows']=_0x4bf28f;return _0xfa8310;})[_0xfc89('0x27')](respondWithFilteredResult(_0x15feb0,_0x146211))[_0xfc89('0x45')](handleError(_0x15feb0,null));};exports['show']=function(_0x19c537,_0x4c30f1){var _0x28af8b={'raw':!![],'where':{'id':_0x19c537[_0xfc89('0x46')]['id']}},_0x4a61a9={};_0x4a61a9[_0xfc89('0x32')]=_['keys'](db['CmHopperHistory'][_0xfc89('0x2f')]);_0x4a61a9[_0xfc89('0x33')]=_['keys'](_0x19c537[_0xfc89('0x33')]);_0x4a61a9[_0xfc89('0x35')]=_['intersection'](_0x4a61a9[_0xfc89('0x32')],_0x4a61a9[_0xfc89('0x33')]);_0x28af8b[_0xfc89('0x37')]=_[_0xfc89('0x36')](_0x4a61a9[_0xfc89('0x32')],qs[_0xfc89('0x38')](_0x19c537[_0xfc89('0x33')][_0xfc89('0x38')]));_0x28af8b[_0xfc89('0x37')]=_0x28af8b['attributes'][_0xfc89('0x47')]?_0x28af8b['attributes']:_0x4a61a9['model'];if(_0x19c537[_0xfc89('0x33')][_0xfc89('0x42')]){_0x28af8b[_0xfc89('0x43')]=[{'all':!![]}];}_0x28af8b=_[_0xfc89('0x3e')]({},_0x28af8b,_0x19c537[_0xfc89('0x41')]);return db[_0xfc89('0x2e')][_0xfc89('0x48')](_0x28af8b)[_0xfc89('0x27')](handleEntityNotFound(_0x4c30f1,null))[_0xfc89('0x27')](respondWithResult(_0x4c30f1,null))[_0xfc89('0x45')](handleError(_0x4c30f1,null));};exports[_0xfc89('0x49')]=function(_0x1ee40e,_0x11a8af){return db[_0xfc89('0x2e')]['create'](_0x1ee40e['body'],{})[_0xfc89('0x27')](respondWithResult(_0x11a8af,0xc9))[_0xfc89('0x45')](handleError(_0x11a8af,null));};exports[_0xfc89('0x4a')]=function(_0x4e4bad,_0x2403cd){return db[_0xfc89('0x2e')][_0xfc89('0x4a')]()[_0xfc89('0x27')](respondWithResult(_0x2403cd,null))[_0xfc89('0x45')](handleError(_0x2403cd,null));};exports[_0xfc89('0x26')]=function(_0xfa0372,_0x57c1dc){if(_0xfa0372[_0xfc89('0x4b')][_0xfc89('0x4c')]){delete _0xfa0372[_0xfc89('0x4b')][_0xfc89('0x4c')];}return db[_0xfc89('0x2e')]['find']({'where':{'uniqueid':_0xfa0372[_0xfc89('0x46')]['id']}})[_0xfc89('0x27')](handleEntityNotFound(_0x57c1dc,null))['then'](saveUpdates(_0xfa0372[_0xfc89('0x4b')],null))[_0xfc89('0x27')](respondWithResult(_0x57c1dc,null))['catch'](handleError(_0x57c1dc,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index e56ee6b..b265e25 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 _0x056b=['cm_hopper_history','endtime','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory'];(function(_0x23a673,_0x31e4bc){var _0x2213b7=function(_0x3c5dcc){while(--_0x3c5dcc){_0x23a673['push'](_0x23a673['shift']());}};_0x2213b7(++_0x31e4bc);}(_0x056b,0xb6));var _0xb056=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x056b[_0x1da04e];return _0xdd8c41;};'use strict';var _=require('lodash');var util=require(_0xb056('0x0'));var logger=require(_0xb056('0x1'))(_0xb056('0x2'));var moment=require(_0xb056('0x3'));var BPromise=require(_0xb056('0x4'));var rp=require(_0xb056('0x5'));var fs=require('fs');var path=require(_0xb056('0x6'));var rimraf=require(_0xb056('0x7'));var config=require(_0xb056('0x8'));var attributes=require(_0xb056('0x9'));module[_0xb056('0xa')]=function(_0x515612,_0x2d5e4f){return _0x515612[_0xb056('0xb')](_0xb056('0xc'),attributes,{'tableName':_0xb056('0xd'),'paranoid':![],'indexes':[{'name':_0xb056('0xe'),'fields':[_0xb056('0xe')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa5c9=['define','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','request-promise','path','exports'];(function(_0x351509,_0x54725c){var _0x4e9861=function(_0x54f92c){while(--_0x54f92c){_0x351509['push'](_0x351509['shift']());}};_0x4e9861(++_0x54725c);}(_0xa5c9,0x143));var _0x9a5c=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xa5c9[_0x2642cb];return _0xe6e41;};'use strict';var _=require(_0x9a5c('0x0'));var util=require(_0x9a5c('0x1'));var logger=require(_0x9a5c('0x2'))(_0x9a5c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9a5c('0x4'));var fs=require('fs');var path=require(_0x9a5c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0x9a5c('0x6')]=function(_0x2a697c,_0x2cac2a){return _0x2a697c[_0x9a5c('0x7')]('CmHopperHistory',attributes,{'tableName':_0x9a5c('0x8'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x9a5c('0x9')]},{'name':_0x9a5c('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index a818541..96ecdcb 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 _0x24cf=['findAll','where','sequelize','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','COUNT','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','name','col','ivrTotalCallsDays','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','stringify','AvgHandleTime'];(function(_0x380c6e,_0x536610){var _0x25828c=function(_0x2276eb){while(--_0x2276eb){_0x380c6e['push'](_0x380c6e['shift']());}};_0x25828c(++_0x536610);}(_0x24cf,0x1d5));var _0xf24c=function(_0x2494a3,_0x96013f){_0x2494a3=_0x2494a3-0x0;var _0x53c047=_0x24cf[_0x2494a3];return _0x53c047;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf24c('0x0'));var BPromise=require(_0xf24c('0x1'));var rs=require(_0xf24c('0x2'));var fs=require('fs');var Redis=require(_0xf24c('0x3'));var db=require(_0xf24c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf24c('0x5'))(_0xf24c('0x6'));var config=require(_0xf24c('0x7'));var jayson=require(_0xf24c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5104bd,_0x272d25,_0x596e81){return new BPromise(function(_0x3b7cf1,_0x13163e){return client[_0xf24c('0x9')](_0x5104bd,_0x596e81)[_0xf24c('0xa')](function(_0x4b3ea3){logger[_0xf24c('0xb')](_0xf24c('0xc'),_0x272d25,_0xf24c('0xd'));logger[_0xf24c('0xe')](_0xf24c('0xf'),_0x272d25,_0xf24c('0xd'),JSON['stringify'](_0x4b3ea3));if(_0x4b3ea3[_0xf24c('0x10')]){if(_0x4b3ea3[_0xf24c('0x10')][_0xf24c('0x11')]===0x1f4){logger['error'](_0xf24c('0xc'),_0x272d25,_0x4b3ea3[_0xf24c('0x10')]['message']);return _0x13163e(_0x4b3ea3['error'][_0xf24c('0x12')]);}logger['error'](_0xf24c('0xc'),_0x272d25,_0x4b3ea3[_0xf24c('0x10')]['message']);return _0x3b7cf1(_0x4b3ea3[_0xf24c('0x10')][_0xf24c('0x12')]);}else{logger[_0xf24c('0xb')](_0xf24c('0xc'),_0x272d25,_0xf24c('0xd'));_0x3b7cf1(_0x4b3ea3['result']['message']);}})[_0xf24c('0x13')](function(_0x462801){logger['error'](_0xf24c('0xc'),_0x272d25,_0x462801);_0x13163e(_0x462801);});});}exports[_0xf24c('0x14')]=function(_0x2d9015){var _0x3eb8e1=this;return new Promise(function(_0x1a17c6,_0x3a0b61){return db[_0xf24c('0x15')][_0xf24c('0x16')](_0x2d9015[_0xf24c('0x17')],{'raw':_0x2d9015[_0xf24c('0x18')]?_0x2d9015[_0xf24c('0x18')][_0xf24c('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x24bf58){logger[_0xf24c('0xb')]('CreateCmHopperHistory',_0x2d9015);logger[_0xf24c('0xe')](_0xf24c('0x14'),_0x2d9015,JSON[_0xf24c('0x1a')](_0x24bf58));_0x1a17c6(_0x24bf58);})['catch'](function(_0x5885a5){logger['error'](_0xf24c('0x14'),_0x5885a5[_0xf24c('0x12')],_0x2d9015);_0x3a0b61(_0x3eb8e1['error'](0x1f4,_0x5885a5[_0xf24c('0x12')]));});});};exports[_0xf24c('0x1b')]=function(_0x106771){var _0x35ba83=this;return new Promise(function(_0x273a80,_0xe6973e){return db[_0xf24c('0x15')][_0xf24c('0x1c')]({'raw':_0x106771[_0xf24c('0x18')]?_0x106771[_0xf24c('0x18')][_0xf24c('0x19')]===undefined?!![]:![]:!![],'where':_0x106771['options']?_0x106771['options'][_0xf24c('0x1d')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xf24c('0x1e')]['col']('id')),_0xf24c('0x1f')],[db[_0xf24c('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xf24c('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0xf24c('0x21')],[db[_0xf24c('0x1e')]['fn'](_0xf24c('0x22'),db['sequelize']['fn']('IF',db[_0xf24c('0x1e')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0xf24c('0x23')],[db[_0xf24c('0x1e')]['fn'](_0xf24c('0x22'),db[_0xf24c('0x1e')]['fn']('IF',db['sequelize'][_0xf24c('0x20')](_0xf24c('0x24')))),_0xf24c('0x25')],[db[_0xf24c('0x1e')]['fn'](_0xf24c('0x26'),db[_0xf24c('0x1e')]['fn']('IF',db['sequelize'][_0xf24c('0x20')](_0xf24c('0x27')))),_0xf24c('0x28')],[db[_0xf24c('0x1e')]['fn'](_0xf24c('0x26'),db[_0xf24c('0x1e')]['fn']('IF',db[_0xf24c('0x1e')]['literal'](_0xf24c('0x29')))),'predictiveIntervalAvgTalktime']]})[_0xf24c('0xa')](function(_0x2fa14b){logger['info'](_0xf24c('0x1b'),_0x106771);logger['debug'](_0xf24c('0x1b'),_0x106771,JSON[_0xf24c('0x1a')](_0x2fa14b));_0x273a80(_0x2fa14b);})[_0xf24c('0x13')](function(_0x47f733){logger[_0xf24c('0x10')]('AvgHandleTime',_0x47f733[_0xf24c('0x12')],_0x106771);_0xe6973e(_0x35ba83['error'](0x1f4,_0x47f733['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x1c74b7){var _0x2bd44c=this;return new Promise(function(_0x447761,_0x3334b3){return db[_0xf24c('0x15')][_0xf24c('0x1c')]({'raw':_0x1c74b7[_0xf24c('0x18')]?_0x1c74b7['options'][_0xf24c('0x19')]===undefined?!![]:![]:!![],'where':_0x1c74b7[_0xf24c('0x18')]?_0x1c74b7[_0xf24c('0x18')][_0xf24c('0x1d')]||null:null,'attributes':[[_0xf24c('0x2a'),'name'],[db[_0xf24c('0x1e')]['fn']('COUNT',db[_0xf24c('0x1e')]['fn']('IF',db[_0xf24c('0x1e')][_0xf24c('0x20')](_0xf24c('0x2b')))),_0xf24c('0x2c')],[db[_0xf24c('0x1e')]['fn'](_0xf24c('0x22'),db[_0xf24c('0x1e')]['fn']('IF',db[_0xf24c('0x1e')][_0xf24c('0x20')](_0xf24c('0x2d')))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0xf24c('0x22'),db[_0xf24c('0x1e')]['fn']('IF',db[_0xf24c('0x1e')][_0xf24c('0x20')](_0xf24c('0x2e')))),_0xf24c('0x2f')],[db[_0xf24c('0x1e')]['fn'](_0xf24c('0x22'),db[_0xf24c('0x1e')]['fn']('IF',db[_0xf24c('0x1e')][_0xf24c('0x20')]('`state`\x20=\x205,\x201,\x20null'))),_0xf24c('0x30')],[db['sequelize']['fn'](_0xf24c('0x22'),db[_0xf24c('0x1e')]['fn']('IF',db[_0xf24c('0x1e')][_0xf24c('0x20')](_0xf24c('0x31')))),_0xf24c('0x32')],[db[_0xf24c('0x1e')]['fn'](_0xf24c('0x22'),db[_0xf24c('0x1e')]['fn']('IF',db[_0xf24c('0x1e')][_0xf24c('0x20')](_0xf24c('0x33')))),_0xf24c('0x34')],[db[_0xf24c('0x1e')]['fn'](_0xf24c('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0xf24c('0x20')](_0xf24c('0x35')))),_0xf24c('0x36')],[db[_0xf24c('0x1e')]['fn'](_0xf24c('0x22'),db['sequelize']['fn']('IF',db[_0xf24c('0x1e')][_0xf24c('0x20')](_0xf24c('0x37')))),_0xf24c('0x38')],[db['sequelize']['fn'](_0xf24c('0x22'),db[_0xf24c('0x1e')]['fn']('IF',db[_0xf24c('0x1e')][_0xf24c('0x20')](_0xf24c('0x39')))),_0xf24c('0x3a')],[db[_0xf24c('0x1e')]['fn'](_0xf24c('0x22'),db[_0xf24c('0x1e')]['fn']('IF',db[_0xf24c('0x1e')][_0xf24c('0x20')](_0xf24c('0x3b')))),_0xf24c('0x3c')],[db[_0xf24c('0x1e')]['fn'](_0xf24c('0x22'),db[_0xf24c('0x1e')]['fn']('IF',db[_0xf24c('0x1e')]['literal'](_0xf24c('0x3d')))),_0xf24c('0x3e')],[db[_0xf24c('0x1e')]['fn'](_0xf24c('0x22'),db[_0xf24c('0x1e')]['fn']('IF',db[_0xf24c('0x1e')][_0xf24c('0x20')](_0xf24c('0x3f')))),_0xf24c('0x40')],[db[_0xf24c('0x1e')]['fn']('COUNT',db[_0xf24c('0x1e')]['fn']('IF',db[_0xf24c('0x1e')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0xf24c('0x3e')],[db[_0xf24c('0x1e')]['fn'](_0xf24c('0x22'),db[_0xf24c('0x1e')]['fn']('IF',db[_0xf24c('0x1e')][_0xf24c('0x20')](_0xf24c('0x41')))),_0xf24c('0x42')]],'group':[_0xf24c('0x2a')]})['then'](function(_0x28099c){logger['info']('GetVoiceQueueHopperHistory',_0x1c74b7);logger[_0xf24c('0xe')](_0xf24c('0x43'),_0x1c74b7,JSON[_0xf24c('0x1a')](_0x28099c));_0x447761(_0x28099c);})[_0xf24c('0x13')](function(_0x168df5){logger[_0xf24c('0x10')](_0xf24c('0x43'),_0x168df5[_0xf24c('0x12')],_0x1c74b7);_0x3334b3(_0x2bd44c[_0xf24c('0x10')](0x1f4,_0x168df5[_0xf24c('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x5c2757){var _0x524ef2=this;return new Promise(function(_0x4fca6c,_0x2b9b2d){return db[_0xf24c('0x15')][_0xf24c('0x1c')]({'raw':_0x5c2757[_0xf24c('0x18')]?_0x5c2757[_0xf24c('0x18')][_0xf24c('0x19')]===undefined?!![]:![]:!![],'where':_0x5c2757[_0xf24c('0x18')]?_0x5c2757[_0xf24c('0x18')][_0xf24c('0x1d')]||null:null,'attributes':[[_0xf24c('0x2a'),_0xf24c('0x44')],[db[_0xf24c('0x1e')]['fn']('COUNT',db['sequelize'][_0xf24c('0x45')]('id')),_0xf24c('0x46')],[db['sequelize']['fn'](_0xf24c('0x22'),db[_0xf24c('0x1e')]['fn']('IF',db[_0xf24c('0x1e')][_0xf24c('0x20')](_0xf24c('0x2e')))),'ivrAnswerCallsDay']],'group':[_0xf24c('0x2a')]})[_0xf24c('0xa')](function(_0x52081e){logger['info']('GetCampaignHopperHistory',_0x5c2757);logger[_0xf24c('0xe')]('GetCampaignHopperHistory',_0x5c2757,JSON[_0xf24c('0x1a')](_0x52081e));_0x4fca6c(_0x52081e);})[_0xf24c('0x13')](function(_0x5c92b7){logger['error']('GetCampaignHopperHistory',_0x5c92b7[_0xf24c('0x12')],_0x5c2757);_0x2b9b2d(_0x524ef2[_0xf24c('0x10')](0x1f4,_0x5c92b7['message']));});});}; \ No newline at end of file +var _0xc874=['outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`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=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','catch','AvgHandleTime','findAll','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','where','name','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null'];(function(_0x2982db,_0x2f0901){var _0x127f47=function(_0x30b1fb){while(--_0x30b1fb){_0x2982db['push'](_0x2982db['shift']());}};_0x127f47(++_0x2f0901);}(_0xc874,0x154));var _0x4c87=function(_0x7feb90,_0x28e700){_0x7feb90=_0x7feb90-0x0;var _0x3c5b33=_0xc874[_0x7feb90];return _0x3c5b33;};'use strict';var _=require(_0x4c87('0x0'));var util=require('util');var moment=require(_0x4c87('0x1'));var BPromise=require(_0x4c87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c87('0x3'))['db'];var utils=require(_0x4c87('0x4'));var logger=require(_0x4c87('0x5'))('rpc');var config=require(_0x4c87('0x6'));var jayson=require(_0x4c87('0x7'));var client=jayson['client'][_0x4c87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dafe0,_0x30c939,_0xdc4a29){return new BPromise(function(_0x116649,_0x5b7720){return client[_0x4c87('0x9')](_0x3dafe0,_0xdc4a29)['then'](function(_0x384268){logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,_0x4c87('0xc'));logger[_0x4c87('0xd')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x30c939,_0x4c87('0xc'),JSON[_0x4c87('0xe')](_0x384268));if(_0x384268['error']){if(_0x384268[_0x4c87('0xf')][_0x4c87('0x10')]===0x1f4){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')]['message']);return _0x5b7720(_0x384268['error']['message']);}logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);return _0x116649(_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);}else{logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,'request\x20sent');_0x116649(_0x384268[_0x4c87('0x12')][_0x4c87('0x11')]);}})['catch'](function(_0x575de5){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x575de5);_0x5b7720(_0x575de5);});});}exports[_0x4c87('0x13')]=function(_0x547d92){var _0x428144=this;return new Promise(function(_0x561441,_0x9bc75f){return db[_0x4c87('0x14')][_0x4c87('0x15')](_0x547d92[_0x4c87('0x16')],{'raw':_0x547d92['options']?_0x547d92[_0x4c87('0x17')][_0x4c87('0x18')]===undefined?!![]:![]:!![]})[_0x4c87('0x19')](function(_0x3f27d4){logger[_0x4c87('0xa')](_0x4c87('0x13'),_0x547d92);logger[_0x4c87('0xd')](_0x4c87('0x13'),_0x547d92,JSON['stringify'](_0x3f27d4));_0x561441(_0x3f27d4);})[_0x4c87('0x1a')](function(_0x33aafd){logger['error'](_0x4c87('0x13'),_0x33aafd[_0x4c87('0x11')],_0x547d92);_0x9bc75f(_0x428144['error'](0x1f4,_0x33aafd[_0x4c87('0x11')]));});});};exports[_0x4c87('0x1b')]=function(_0x40a413){var _0x3b4399=this;return new Promise(function(_0x5cd58d,_0x4735f2){return db[_0x4c87('0x14')][_0x4c87('0x1c')]({'raw':_0x40a413[_0x4c87('0x17')]?_0x40a413[_0x4c87('0x17')][_0x4c87('0x18')]===undefined?!![]:![]:!![],'where':_0x40a413[_0x4c87('0x17')]?_0x40a413[_0x4c87('0x17')]['where']||null:null,'attributes':[[db[_0x4c87('0x1d')]['fn']('COUNT',db[_0x4c87('0x1d')][_0x4c87('0x1e')]('id')),_0x4c87('0x1f')],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['fn']('IF',db['sequelize'][_0x4c87('0x21')](_0x4c87('0x22')))),_0x4c87('0x23')],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['fn']('IF',db[_0x4c87('0x1d')][_0x4c87('0x21')](_0x4c87('0x24')))),_0x4c87('0x25')],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['fn']('IF',db[_0x4c87('0x1d')][_0x4c87('0x21')](_0x4c87('0x26')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x4c87('0x1d')]['fn']('AVG',db[_0x4c87('0x1d')]['fn']('IF',db['sequelize'][_0x4c87('0x21')](_0x4c87('0x27')))),_0x4c87('0x28')],[db[_0x4c87('0x1d')]['fn']('AVG',db[_0x4c87('0x1d')]['fn']('IF',db[_0x4c87('0x1d')][_0x4c87('0x21')](_0x4c87('0x29')))),'predictiveIntervalAvgTalktime']]})[_0x4c87('0x19')](function(_0x32d0f2){logger[_0x4c87('0xa')](_0x4c87('0x1b'),_0x40a413);logger['debug'](_0x4c87('0x1b'),_0x40a413,JSON[_0x4c87('0xe')](_0x32d0f2));_0x5cd58d(_0x32d0f2);})[_0x4c87('0x1a')](function(_0x24197d){logger['error']('AvgHandleTime',_0x24197d[_0x4c87('0x11')],_0x40a413);_0x4735f2(_0x3b4399['error'](0x1f4,_0x24197d[_0x4c87('0x11')]));});});};exports[_0x4c87('0x2a')]=function(_0x217141){var _0x66e7f6=this;return new Promise(function(_0x100ca5,_0x5aea33){return db[_0x4c87('0x14')][_0x4c87('0x1c')]({'raw':_0x217141[_0x4c87('0x17')]?_0x217141['options']['raw']===undefined?!![]:![]:!![],'where':_0x217141[_0x4c87('0x17')]?_0x217141[_0x4c87('0x17')][_0x4c87('0x2b')]||null:null,'attributes':[['campaign',_0x4c87('0x2c')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4c87('0x1d')][_0x4c87('0x21')](_0x4c87('0x2d')))),'outboundNoSuchCallsDay'],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db['sequelize']['fn']('IF',db[_0x4c87('0x1d')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x4c87('0x2e')],[db['sequelize']['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['fn']('IF',db['sequelize'][_0x4c87('0x21')](_0x4c87('0x22')))),'outboundAnswerCallsDay'],[db[_0x4c87('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4c87('0x1d')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x4c87('0x2f')],[db[_0x4c87('0x1d')]['fn']('COUNT',db[_0x4c87('0x1d')]['fn']('IF',db[_0x4c87('0x1d')][_0x4c87('0x21')](_0x4c87('0x30')))),'outboundCongestionCallsDay'],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['fn']('IF',db[_0x4c87('0x1d')]['literal'](_0x4c87('0x31')))),_0x4c87('0x32')],[db[_0x4c87('0x1d')]['fn']('COUNT',db[_0x4c87('0x1d')]['fn']('IF',db[_0x4c87('0x1d')][_0x4c87('0x21')](_0x4c87('0x33')))),'outboundDropCallsDayCallersExit'],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x4c87('0x34')))),_0x4c87('0x35')],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x4c87('0x21')](_0x4c87('0x36')))),_0x4c87('0x37')],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['fn']('IF',db[_0x4c87('0x1d')][_0x4c87('0x21')](_0x4c87('0x38')))),_0x4c87('0x39')],[db['sequelize']['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['fn']('IF',db[_0x4c87('0x1d')][_0x4c87('0x21')]('`state`\x20=\x2018,\x201,\x20null'))),_0x4c87('0x3a')],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db['sequelize']['fn']('IF',db[_0x4c87('0x1d')][_0x4c87('0x21')](_0x4c87('0x3b')))),'outboundAnswerAgiCallsDay'],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x4c87('0x3c')))),_0x4c87('0x3d')]],'group':[_0x4c87('0x3e')]})[_0x4c87('0x19')](function(_0x31c1e2){logger[_0x4c87('0xa')](_0x4c87('0x2a'),_0x217141);logger[_0x4c87('0xd')]('GetVoiceQueueHopperHistory',_0x217141,JSON['stringify'](_0x31c1e2));_0x100ca5(_0x31c1e2);})[_0x4c87('0x1a')](function(_0x4debb0){logger[_0x4c87('0xf')](_0x4c87('0x2a'),_0x4debb0[_0x4c87('0x11')],_0x217141);_0x5aea33(_0x66e7f6[_0x4c87('0xf')](0x1f4,_0x4debb0[_0x4c87('0x11')]));});});};exports[_0x4c87('0x3f')]=function(_0x1b13e3){var _0x2a4bf1=this;return new Promise(function(_0x4aa6e3,_0x57f1c9){return db[_0x4c87('0x14')]['findAll']({'raw':_0x1b13e3[_0x4c87('0x17')]?_0x1b13e3[_0x4c87('0x17')][_0x4c87('0x18')]===undefined?!![]:![]:!![],'where':_0x1b13e3['options']?_0x1b13e3[_0x4c87('0x17')][_0x4c87('0x2b')]||null:null,'attributes':[[_0x4c87('0x3e'),_0x4c87('0x2c')],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['col']('id')),'ivrTotalCallsDays'],[db[_0x4c87('0x1d')]['fn'](_0x4c87('0x20'),db[_0x4c87('0x1d')]['fn']('IF',db[_0x4c87('0x1d')][_0x4c87('0x21')](_0x4c87('0x22')))),_0x4c87('0x40')]],'group':[_0x4c87('0x3e')]})[_0x4c87('0x19')](function(_0x133d03){logger[_0x4c87('0xa')](_0x4c87('0x3f'),_0x1b13e3);logger[_0x4c87('0xd')]('GetCampaignHopperHistory',_0x1b13e3,JSON[_0x4c87('0xe')](_0x133d03));_0x4aa6e3(_0x133d03);})[_0x4c87('0x1a')](function(_0x114dac){logger[_0x4c87('0xf')](_0x4c87('0x3f'),_0x114dac[_0x4c87('0x11')],_0x1b13e3);_0x57f1c9(_0x2a4bf1[_0x4c87('0xf')](0x1f4,_0x114dac['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index d4d1667..caea972 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 _0x418a=['/:id','show','update','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe'];(function(_0x37a6fd,_0x25edae){var _0x572126=function(_0x4ec961){while(--_0x4ec961){_0x37a6fd['push'](_0x37a6fd['shift']());}};_0x572126(++_0x25edae);}(_0x418a,0x8c));var _0xa418=function(_0x56cb18,_0xb011f6){_0x56cb18=_0x56cb18-0x0;var _0x4e468e=_0x418a[_0x56cb18];return _0x4e468e;};'use strict';var multer=require('multer');var util=require(_0xa418('0x0'));var path=require('path');var timeout=require(_0xa418('0x1'));var express=require(_0xa418('0x2'));var router=express[_0xa418('0x3')]();var fs_extra=require(_0xa418('0x4'));var auth=require(_0xa418('0x5'));var interaction=require(_0xa418('0x6'));var config=require(_0xa418('0x7'));var controller=require(_0xa418('0x8'));router[_0xa418('0x9')]('/',auth[_0xa418('0xa')](),controller['index']);router[_0xa418('0x9')](_0xa418('0xb'),auth[_0xa418('0xa')](),controller[_0xa418('0xc')]);router[_0xa418('0x9')](_0xa418('0xd'),auth[_0xa418('0xa')](),controller[_0xa418('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa418('0xd'),auth[_0xa418('0xa')](),controller[_0xa418('0xf')]);module[_0xa418('0x10')]=router; \ No newline at end of file +var _0x57c3=['update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','/:id','post','create'];(function(_0x1057ce,_0x2be3d6){var _0x29e85a=function(_0x59cb1b){while(--_0x59cb1b){_0x1057ce['push'](_0x1057ce['shift']());}};_0x29e85a(++_0x2be3d6);}(_0x57c3,0x1b6));var _0x357c=function(_0x1011fa,_0x398703){_0x1011fa=_0x1011fa-0x0;var _0x5db6e6=_0x57c3[_0x1011fa];return _0x5db6e6;};'use strict';var multer=require(_0x357c('0x0'));var util=require(_0x357c('0x1'));var path=require(_0x357c('0x2'));var timeout=require(_0x357c('0x3'));var express=require(_0x357c('0x4'));var router=express[_0x357c('0x5')]();var fs_extra=require(_0x357c('0x6'));var auth=require(_0x357c('0x7'));var interaction=require(_0x357c('0x8'));var config=require(_0x357c('0x9'));var controller=require(_0x357c('0xa'));router[_0x357c('0xb')]('/',auth[_0x357c('0xc')](),controller['index']);router[_0x357c('0xb')](_0x357c('0xd'),auth[_0x357c('0xc')](),controller[_0x357c('0xe')]);router[_0x357c('0xb')](_0x357c('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x357c('0x10')]('/',auth[_0x357c('0xc')](),controller[_0x357c('0x11')]);router['put'](_0x357c('0xf'),auth[_0x357c('0xc')](),controller[_0x357c('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 68b89b0..535c178 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 _0x7217=['sequelize','STRING','name'];(function(_0x17f7a3,_0x5a7131){var _0x1b6343=function(_0x2ddaa0){while(--_0x2ddaa0){_0x17f7a3['push'](_0x17f7a3['shift']());}};_0x1b6343(++_0x5a7131);}(_0x7217,0x19e));var _0x7721=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x7217[_0x3899d1];return _0xeb4a7d;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'name':{'type':Sequelize[_0x7721('0x1')],'unique':_0x7721('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7721('0x1')]},'dialPrefix':{'type':Sequelize[_0x7721('0x1')]}}; \ No newline at end of file +var _0xaced=['sequelize','exports','STRING','name'];(function(_0x5d3a21,_0x249fc2){var _0x30b5f7=function(_0x26244b){while(--_0x26244b){_0x5d3a21['push'](_0x5d3a21['shift']());}};_0x30b5f7(++_0x249fc2);}(_0xaced,0x18c));var _0xdace=function(_0x4fe345,_0x2d0f1f){_0x4fe345=_0x4fe345-0x0;var _0x8b92fb=_0xaced[_0x4fe345];return _0x8b92fb;};'use strict';var Sequelize=require(_0xdace('0x0'));module[_0xdace('0x1')]={'name':{'type':Sequelize[_0xdace('0x2')],'unique':_0xdace('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdace('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 67cb41c..fe9489a 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 _0xf04a=['end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Lists','UserProfileResource','sendStatus','error','stack','name','index','map','CmList','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','sort','ListId','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','push','each','success','dataValues','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContacts','findAll','select','c.cf_','customField_','alias','field','from','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','cm_contact_has_items','description_additionalPhone_','toString','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','text/csv','download','addCustomField','findOne','sequelize','addCustomFields','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','emit','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf04a,0x119));var _0xaf04=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xf04a[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xaf04('0x0'));var rimraf=require(_0xaf04('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf04('0x2'));var rp=require(_0xaf04('0x3'));var moment=require(_0xaf04('0x4'));var BPromise=require(_0xaf04('0x5'));var Mustache=require(_0xaf04('0x6'));var util=require('util');var path=require(_0xaf04('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaf04('0x8'));var _=require(_0xaf04('0x9'));var squel=require('squel');var crypto=require(_0xaf04('0xa'));var jsforce=require(_0xaf04('0xb'));var deskjs=require(_0xaf04('0xc'));var toCsv=require(_0xaf04('0xd'));var querystring=require(_0xaf04('0xe'));var Papa=require(_0xaf04('0xf'));var Redis=require(_0xaf04('0x10'));var authService=require(_0xaf04('0x11'));var qs=require(_0xaf04('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaf04('0x13'));var logger=require(_0xaf04('0x14'))(_0xaf04('0x15'));var utils=require(_0xaf04('0x16'));var config=require(_0xaf04('0x17'));var licenseUtil=require(_0xaf04('0x18'));var db=require(_0xaf04('0x19'))['db'];var csv_results;config['redis']=_['defaults'](config[_0xaf04('0x1a')],{'host':_0xaf04('0x1b'),'port':0x18eb});var socket=require(_0xaf04('0x1c'))(new Redis(config[_0xaf04('0x1a')]));require('./cmList.socket')[_0xaf04('0x1d')](socket);function respondWithStatusCode(_0x54834a,_0x4e2512){_0x4e2512=_0x4e2512||0xcc;return function(_0xef19bb){if(_0xef19bb){return _0x54834a['sendStatus'](_0x4e2512);}return _0x54834a[_0xaf04('0x1e')](_0x4e2512)[_0xaf04('0x1f')]();};}function respondWithResult(_0xbf86ae,_0x11ed85){_0x11ed85=_0x11ed85||0xc8;return function(_0x437f21){if(_0x437f21){return _0xbf86ae['status'](_0x11ed85)[_0xaf04('0x20')](_0x437f21);}};}function respondWithFilteredResult(_0x243462,_0x4809b1){return function(_0x32bd58){if(_0x32bd58){var _0x32969=typeof _0x4809b1[_0xaf04('0x21')]===_0xaf04('0x22')&&typeof _0x4809b1[_0xaf04('0x23')]===_0xaf04('0x22');var _0x17ed0c=_0x32bd58[_0xaf04('0x24')];var _0x38c6bd=_0x32969?0x0:_0x4809b1[_0xaf04('0x21')];var _0x49a502=_0x32969?_0x32bd58[_0xaf04('0x24')]:_0x4809b1[_0xaf04('0x21')]+_0x4809b1[_0xaf04('0x23')];var _0x3d1db4;if(_0x49a502>=_0x17ed0c){_0x49a502=_0x17ed0c;_0x3d1db4=0xc8;}else{_0x3d1db4=0xce;}_0x243462['status'](_0x3d1db4);return _0x243462[_0xaf04('0x25')](_0xaf04('0x26'),_0x38c6bd+'-'+_0x49a502+'/'+_0x17ed0c)[_0xaf04('0x20')](_0x32bd58);}return null;};}function patchUpdates(_0x38b082){return function(_0x1dbd18){try{jsonpatch[_0xaf04('0x27')](_0x1dbd18,_0x38b082,!![]);}catch(_0x26eda9){return BPromise['reject'](_0x26eda9);}return _0x1dbd18[_0xaf04('0x28')]();};}function saveUpdates(_0x2e672d,_0x55bd72){return function(_0x1b8d8e){if(_0x1b8d8e){return _0x1b8d8e[_0xaf04('0x29')](_0x2e672d)[_0xaf04('0x2a')](function(_0x25b386){return _0x25b386;});}return null;};}function removeEntity(_0x5d998f,_0x5841b7){return function(_0x5d1464){if(_0x5d1464){return _0x5d1464[_0xaf04('0x2b')]()[_0xaf04('0x2a')](function(){var _0x4b8080=_0x5d1464[_0xaf04('0x2c')]({'plain':!![]});var _0x3e1288=_0xaf04('0x2d');return db[_0xaf04('0x2e')][_0xaf04('0x2b')]({'where':{'type':_0x3e1288,'resourceId':_0x4b8080['id']}})['then'](function(){return _0x5d1464;});})[_0xaf04('0x2a')](function(){_0x5d998f['status'](0xcc)[_0xaf04('0x1f')]();});}};}function handleEntityNotFound(_0x40e98f,_0x2c7351){return function(_0x4da56e){if(!_0x4da56e){_0x40e98f[_0xaf04('0x2f')](0x194);}return _0x4da56e;};}function handleError(_0x15ca5d,_0x38ddde){_0x38ddde=_0x38ddde||0x1f4;return function(_0x10ba46){logger[_0xaf04('0x30')](_0x10ba46[_0xaf04('0x31')]);if(_0x10ba46[_0xaf04('0x32')]){delete _0x10ba46[_0xaf04('0x32')];}_0x15ca5d[_0xaf04('0x1e')](_0x38ddde)['send'](_0x10ba46);};}exports[_0xaf04('0x33')]=function(_0x1a58ee,_0x37ccc7){var _0x3fe048={},_0x3edaa8={},_0x78bd85={'count':0x0,'rows':[]};var _0x7522fb=_[_0xaf04('0x34')](db[_0xaf04('0x35')][_0xaf04('0x36')],function(_0x5ae641){return{'name':_0x5ae641['fieldName'],'type':_0x5ae641[_0xaf04('0x37')][_0xaf04('0x38')]};});_0x3edaa8[_0xaf04('0x39')]=_['map'](_0x7522fb,'name');_0x3edaa8[_0xaf04('0x3a')]=_[_0xaf04('0x3b')](_0x1a58ee['query']);_0x3edaa8['filters']=_[_0xaf04('0x3c')](_0x3edaa8[_0xaf04('0x39')],_0x3edaa8[_0xaf04('0x3a')]);_0x3fe048[_0xaf04('0x3d')]=_[_0xaf04('0x3c')](_0x3edaa8[_0xaf04('0x39')],qs[_0xaf04('0x3e')](_0x1a58ee[_0xaf04('0x3a')][_0xaf04('0x3e')]));_0x3fe048[_0xaf04('0x3d')]=_0x3fe048[_0xaf04('0x3d')][_0xaf04('0x3f')]?_0x3fe048[_0xaf04('0x3d')]:_0x3edaa8[_0xaf04('0x39')];if(!_0x1a58ee[_0xaf04('0x3a')][_0xaf04('0x40')](_0xaf04('0x41'))){_0x3fe048[_0xaf04('0x23')]=qs[_0xaf04('0x23')](_0x1a58ee['query'][_0xaf04('0x23')]);_0x3fe048[_0xaf04('0x21')]=qs[_0xaf04('0x21')](_0x1a58ee['query']['offset']);}_0x3fe048[_0xaf04('0x42')]=qs['sort'](_0x1a58ee[_0xaf04('0x3a')]['sort']);_0x3fe048[_0xaf04('0x43')]=qs[_0xaf04('0x44')](_[_0xaf04('0x45')](_0x1a58ee['query'],_0x3edaa8['filters']),_0x7522fb);if(_0x1a58ee[_0xaf04('0x3a')][_0xaf04('0x46')]){_0x3fe048[_0xaf04('0x43')]=_['merge'](_0x3fe048[_0xaf04('0x43')],{'$or':_[_0xaf04('0x34')](_0x7522fb,function(_0x19405d){if(_0x19405d[_0xaf04('0x37')]!==_0xaf04('0x47')){var _0x241f5c={};_0x241f5c[_0x19405d[_0xaf04('0x32')]]={'$like':'%'+_0x1a58ee[_0xaf04('0x3a')][_0xaf04('0x46')]+'%'};return _0x241f5c;}})});}_0x3fe048=_[_0xaf04('0x48')]({},_0x3fe048,_0x1a58ee[_0xaf04('0x49')]);var _0x34a1d1={'where':_0x3fe048[_0xaf04('0x43')]};return db[_0xaf04('0x35')][_0xaf04('0x24')](_0x34a1d1)['then'](function(_0x40c4b){_0x78bd85['count']=_0x40c4b;if(_0x1a58ee[_0xaf04('0x3a')][_0xaf04('0x4a')]){_0x3fe048[_0xaf04('0x4b')]=[{'all':!![]}];}return db[_0xaf04('0x35')]['findAll'](_0x3fe048);})[_0xaf04('0x2a')](function(_0x1f23c8){_0x78bd85['rows']=_0x1f23c8;return _0x78bd85;})['then'](respondWithFilteredResult(_0x37ccc7,_0x3fe048))[_0xaf04('0x4c')](handleError(_0x37ccc7,null));};exports['show']=function(_0x11a8da,_0x514c9f){var _0x441851={'raw':![],'where':{'id':_0x11a8da[_0xaf04('0x4d')]['id']}},_0x167770={};_0x167770[_0xaf04('0x39')]=_[_0xaf04('0x3b')](db[_0xaf04('0x35')][_0xaf04('0x36')]);_0x167770['query']=_[_0xaf04('0x3b')](_0x11a8da['query']);_0x167770[_0xaf04('0x44')]=_[_0xaf04('0x3c')](_0x167770[_0xaf04('0x39')],_0x167770[_0xaf04('0x3a')]);_0x441851[_0xaf04('0x3d')]=_[_0xaf04('0x3c')](_0x167770[_0xaf04('0x39')],qs[_0xaf04('0x3e')](_0x11a8da['query'][_0xaf04('0x3e')]));_0x441851[_0xaf04('0x3d')]=_0x441851[_0xaf04('0x3d')][_0xaf04('0x3f')]?_0x441851[_0xaf04('0x3d')]:_0x167770[_0xaf04('0x39')];if(_0x11a8da[_0xaf04('0x3a')][_0xaf04('0x4a')]){_0x441851['include']=[{'all':!![]}];}_0x441851=_[_0xaf04('0x48')]({},_0x441851,_0x11a8da[_0xaf04('0x49')]);return db[_0xaf04('0x35')][_0xaf04('0x4e')](_0x441851)[_0xaf04('0x2a')](handleEntityNotFound(_0x514c9f,null))[_0xaf04('0x2a')](respondWithResult(_0x514c9f,null))['catch'](handleError(_0x514c9f,null));};exports[_0xaf04('0x4f')]=function(_0x435281,_0x588720){return db[_0xaf04('0x35')]['create'](_0x435281[_0xaf04('0x50')],{})[_0xaf04('0x2a')](function(_0x5c8ddd){var _0x1d0df5=_0x435281[_0xaf04('0x51')][_0xaf04('0x2c')]({'plain':!![]});if(!_0x1d0df5)throw new Error(_0xaf04('0x52'));if(_0x1d0df5[_0xaf04('0x53')]===_0xaf04('0x51')){var _0x858f96=_0x5c8ddd[_0xaf04('0x2c')]({'plain':!![]});var _0x3a994a=_0xaf04('0x2d');return db[_0xaf04('0x54')]['find']({'where':{'name':_0x3a994a,'userProfileId':_0x1d0df5['userProfileId']},'raw':!![]})[_0xaf04('0x2a')](function(_0x3ddb25){if(_0x3ddb25&&_0x3ddb25['autoAssociation']===0x0){return db[_0xaf04('0x2e')][_0xaf04('0x4f')]({'name':_0x858f96[_0xaf04('0x32')],'resourceId':_0x858f96['id'],'type':_0x3ddb25['name'],'sectionId':_0x3ddb25['id']},{})['then'](function(){return _0x5c8ddd;});}else{return _0x5c8ddd;}})[_0xaf04('0x4c')](function(_0x2ec280){logger[_0xaf04('0x30')](_0xaf04('0x55'),_0x2ec280);throw _0x2ec280;});}return _0x5c8ddd;})['then'](respondWithResult(_0x588720,0xc9))[_0xaf04('0x4c')](handleError(_0x588720,null));};exports[_0xaf04('0x29')]=function(_0x51b230,_0xe50474){if(_0x51b230[_0xaf04('0x50')]['id']){delete _0x51b230['body']['id'];}return db[_0xaf04('0x35')][_0xaf04('0x4e')]({'where':{'id':_0x51b230['params']['id']}})[_0xaf04('0x2a')](handleEntityNotFound(_0xe50474,null))[_0xaf04('0x2a')](saveUpdates(_0x51b230[_0xaf04('0x50')],null))['then'](respondWithResult(_0xe50474,null))[_0xaf04('0x4c')](handleError(_0xe50474,null));};exports[_0xaf04('0x2b')]=function(_0xf6a30d,_0x5abfbb){return db[_0xaf04('0x35')][_0xaf04('0x4e')]({'where':{'id':_0xf6a30d[_0xaf04('0x4d')]['id']}})[_0xaf04('0x2a')](handleEntityNotFound(_0x5abfbb,null))[_0xaf04('0x2a')](removeEntity(_0x5abfbb,null))[_0xaf04('0x4c')](handleError(_0x5abfbb,null));};exports[_0xaf04('0x56')]=function(_0x5e8f5c,_0x36d0f6){return db[_0xaf04('0x35')][_0xaf04('0x56')]()['then'](respondWithResult(_0x36d0f6,null))[_0xaf04('0x4c')](handleError(_0x36d0f6,null));};exports[_0xaf04('0x57')]=function(_0x11149b,_0x223328,_0xabaa3d){if(_0x11149b[_0xaf04('0x50')]['id']){delete _0x11149b['body']['id'];}return db[_0xaf04('0x35')][_0xaf04('0x4e')]({'where':{'id':_0x11149b[_0xaf04('0x4d')]['id']}})[_0xaf04('0x2a')](handleEntityNotFound(_0x223328,null))['then'](function(_0x5e0609){if(_0x5e0609){_0x11149b[_0xaf04('0x50')]['ListId']=_0x5e0609['id'];return db[_0xaf04('0x58')][_0xaf04('0x4f')](_0x11149b['body']);}})['then'](respondWithResult(_0x223328,null))[_0xaf04('0x4c')](handleError(_0x223328,null));};exports['getDispositions']=function(_0x3b7747,_0x484eae,_0x4796d2){var _0xda2413={'raw':![],'where':{}};var _0x3f2ea5={};var _0x147ece={'count':0x0,'rows':[]};return db[_0xaf04('0x35')]['findOne']({'where':{'id':_0x3b7747[_0xaf04('0x4d')]['id']}})[_0xaf04('0x2a')](handleEntityNotFound(_0x484eae,null))[_0xaf04('0x2a')](function(_0x1de27f){if(_0x1de27f){_0x3f2ea5[_0xaf04('0x39')]=_[_0xaf04('0x3b')](db[_0xaf04('0x58')][_0xaf04('0x36')]);_0x3f2ea5['query']=_['keys'](_0x3b7747[_0xaf04('0x3a')]);_0x3f2ea5[_0xaf04('0x44')]=_[_0xaf04('0x3c')](_0x3f2ea5[_0xaf04('0x39')],_0x3f2ea5[_0xaf04('0x3a')]);_0xda2413[_0xaf04('0x3d')]=_[_0xaf04('0x3c')](_0x3f2ea5[_0xaf04('0x39')],qs[_0xaf04('0x3e')](_0x3b7747[_0xaf04('0x3a')][_0xaf04('0x3e')]));_0xda2413['attributes']=_0xda2413[_0xaf04('0x3d')][_0xaf04('0x3f')]?_0xda2413[_0xaf04('0x3d')]:_0x3f2ea5[_0xaf04('0x39')];if(!_0x3b7747[_0xaf04('0x3a')]['hasOwnProperty']('nolimit')){_0xda2413[_0xaf04('0x23')]=qs['limit'](_0x3b7747[_0xaf04('0x3a')]['limit']);_0xda2413[_0xaf04('0x21')]=qs[_0xaf04('0x21')](_0x3b7747[_0xaf04('0x3a')][_0xaf04('0x21')]);}_0xda2413[_0xaf04('0x42')]=qs[_0xaf04('0x59')](_0x3b7747[_0xaf04('0x3a')][_0xaf04('0x59')]);_0xda2413[_0xaf04('0x43')]=qs[_0xaf04('0x44')](_[_0xaf04('0x45')](_0x3b7747[_0xaf04('0x3a')],_0x3f2ea5[_0xaf04('0x44')]));_0xda2413['where'][_0xaf04('0x5a')]=_0x1de27f['id'];if(_0x3b7747[_0xaf04('0x3a')][_0xaf04('0x46')]){_0xda2413[_0xaf04('0x43')]=_[_0xaf04('0x48')](_0xda2413['where'],{'$or':_['map'](_0xda2413[_0xaf04('0x3d')],function(_0x265c45){var _0x2f6939={};_0x2f6939[_0x265c45]={'$like':'%'+_0x3b7747[_0xaf04('0x3a')][_0xaf04('0x46')]+'%'};return _0x2f6939;})});}_0xda2413=_[_0xaf04('0x48')]({},_0xda2413,_0x3b7747[_0xaf04('0x49')]);return db['Disposition'][_0xaf04('0x24')]({'where':_0xda2413[_0xaf04('0x43')]})[_0xaf04('0x2a')](function(_0x38bf5a){_0x147ece[_0xaf04('0x24')]=_0x38bf5a;if(_0x3b7747[_0xaf04('0x3a')][_0xaf04('0x4a')]){_0xda2413['include']=[{'all':!![]}];}return db[_0xaf04('0x58')]['findAll'](_0xda2413);})[_0xaf04('0x2a')](function(_0xed7033){_0x147ece['rows']=_0xed7033;return _0x147ece;});}})[_0xaf04('0x2a')](respondWithFilteredResult(_0x484eae,_0xda2413))[_0xaf04('0x4c')](handleError(_0x484eae,null));};exports[_0xaf04('0x5b')]=function(_0x4e768c,_0x255df5,_0x536b31){return db[_0xaf04('0x35')][_0xaf04('0x4e')]({'where':{'id':_0x4e768c[_0xaf04('0x4d')]['id']}})[_0xaf04('0x2a')](handleEntityNotFound(_0x255df5,null))[_0xaf04('0x2a')](function(_0x1180b0){if(_0x1180b0){return _0x1180b0[_0xaf04('0x5b')](_0x4e768c[_0xaf04('0x3a')][_0xaf04('0x5c')]);}})['then'](respondWithStatusCode(_0x255df5,null))[_0xaf04('0x4c')](handleError(_0x255df5,null));};exports[_0xaf04('0x5d')]=function(_0x1583ba,_0x541a11,_0x285cd8){return db[_0xaf04('0x35')][_0xaf04('0x4e')]({'where':{'id':_0x1583ba[_0xaf04('0x4d')]['id']}})[_0xaf04('0x2a')](handleEntityNotFound(_0x541a11,null))[_0xaf04('0x2a')](function(_0x3c6a17){if(_0x3c6a17){var _0x585360=[];var _0x345dd6={'success':[],'errors':[]};return db[_0xaf04('0x5e')][_0xaf04('0x56')]()['then'](function(_0x5a0fba){if(_0x1583ba['body']['tags']&&_[_0xaf04('0x5f')](_0x1583ba[_0xaf04('0x50')][_0xaf04('0x60')])){if(_0x1583ba[_0xaf04('0x50')][_0xaf04('0x60')]['length']){_0x1583ba[_0xaf04('0x50')][_0xaf04('0x60')]=_0x1583ba[_0xaf04('0x50')][_0xaf04('0x60')][_0xaf04('0x61')](';')+';';}else{_0x1583ba[_0xaf04('0x50')][_0xaf04('0x60')]=null;}}else{_0x1583ba['body']['tags']=null;}if(_0x1583ba[_0xaf04('0x50')]&&_['isArray'](_0x1583ba['body'])){for(var _0x6d7f2a=0x0;_0x6d7f2a<_0x1583ba[_0xaf04('0x50')][_0xaf04('0x3f')];_0x6d7f2a+=0x1){_0x1583ba[_0xaf04('0x50')][_0x6d7f2a][_0xaf04('0x5a')]=_0x1583ba[_0xaf04('0x4d')]['id'];_0x585360[_0xaf04('0x62')](_0x1583ba[_0xaf04('0x50')][_0x6d7f2a]);}return BPromise[_0xaf04('0x63')](_0x585360,function(_0x36b8f3){return db[_0xaf04('0x5e')][_0xaf04('0x4f')](_['omit'](_0x36b8f3,[_0xaf04('0x5c'),'id'])||{},{'fields':_[_0xaf04('0x3b')](_0x5a0fba),'raw':!![]})['then'](function(_0x3b4cf2){_0x345dd6[_0xaf04('0x64')][_0xaf04('0x62')](_0x3b4cf2[_0xaf04('0x65')]);})[_0xaf04('0x4c')](function(_0x537f18){_0x345dd6['errors'][_0xaf04('0x62')]({'data':_0x36b8f3,'error':_0x537f18[_0xaf04('0x66')]});});})[_0xaf04('0x2a')](function(_0x2da922){return _0x345dd6;})[_0xaf04('0x4c')](function(_0x4d441c){return _0x4d441c;});}else{_0x541a11[_0xaf04('0x1e')](0x190)[_0xaf04('0x20')]({'message':_0xaf04('0x67')});}});}})['then'](respondWithResult(_0x541a11,null))['catch'](handleError(_0x541a11,null));};exports['getContacts']=function(_0x5b9bdb,_0x5dd8ee,_0x53c787){var _0x4c86d7;return db[_0xaf04('0x35')]['find']({'where':{'id':_0x5b9bdb[_0xaf04('0x4d')]['id']},'include':[{'model':db[_0xaf04('0x68')],'as':_0xaf04('0x69')}]})[_0xaf04('0x2a')](handleEntityNotFound(_0x5dd8ee,null))[_0xaf04('0x2a')](function(_0x5bc99a){if(_0x5bc99a){_0x4c86d7=_0x5bc99a;return db[_0xaf04('0x5e')]['rawAttributes'];}})[_0xaf04('0x2a')](function(_0x5a6446){if(_0x5a6446){var _0x18a535={};var _0x53c2ea={};_0x53c2ea[_0xaf04('0x39')]=_[_0xaf04('0x6a')](_[_0xaf04('0x3b')](_0x5a6446),_['map'](_0x4c86d7['CustomFields'],function(_0x29607e){return util[_0xaf04('0x6b')](_0xaf04('0x6c'),_0x29607e['id']);}));_0x53c2ea['query']=_[_0xaf04('0x3b')](_0x5b9bdb[_0xaf04('0x3a')]);_0x53c2ea[_0xaf04('0x44')]=_['intersection'](_0x53c2ea[_0xaf04('0x39')],_0x53c2ea[_0xaf04('0x3a')]);_0x18a535[_0xaf04('0x3d')]=_[_0xaf04('0x3c')](_0x53c2ea[_0xaf04('0x39')],qs['fields'](_0x5b9bdb[_0xaf04('0x3a')][_0xaf04('0x3e')]));_0x18a535[_0xaf04('0x3d')]=_0x18a535[_0xaf04('0x3d')][_0xaf04('0x3f')]?_0x18a535[_0xaf04('0x3d')]:_0x53c2ea[_0xaf04('0x39')];if(!_0x5b9bdb[_0xaf04('0x3a')][_0xaf04('0x40')](_0xaf04('0x41'))){_0x18a535[_0xaf04('0x23')]=qs[_0xaf04('0x23')](_0x5b9bdb[_0xaf04('0x3a')][_0xaf04('0x23')]);_0x18a535[_0xaf04('0x21')]=qs[_0xaf04('0x21')](_0x5b9bdb[_0xaf04('0x3a')][_0xaf04('0x21')]);}_0x18a535[_0xaf04('0x42')]=qs['sort'](_0x5b9bdb[_0xaf04('0x3a')][_0xaf04('0x59')]);_0x18a535[_0xaf04('0x43')]=qs[_0xaf04('0x44')](_['pick'](_0x5b9bdb[_0xaf04('0x3a')],_0x53c2ea[_0xaf04('0x44')]));_0x18a535[_0xaf04('0x6d')]=!![];if(_0x5b9bdb['query']['filter']){_0x18a535['where']=_[_0xaf04('0x48')](_0x18a535[_0xaf04('0x43')],{'$or':_[_0xaf04('0x34')](_0x18a535[_0xaf04('0x3d')],function(_0x50ce24){var _0x219b90={};_0x219b90[_0x50ce24]={'$like':'%'+_0x5b9bdb['query']['filter']+'%'};return _0x219b90;})});}_0x18a535=_[_0xaf04('0x48')]({},_0x18a535,_0x5b9bdb[_0xaf04('0x49')]);return _0x4c86d7[_0xaf04('0x6e')](_0x18a535);}})['then'](respondWithResult(_0x5dd8ee,null))[_0xaf04('0x4c')](handleError(_0x5dd8ee,null));};exports['getContactsCsv']=function(_0x48ae1f,_0x59bf00,_0x5f2d78){var _0x47dc10;var _0x77100e;var _0x5bb102;var _0x4c7744=_0x48ae1f[_0xaf04('0x4d')]['id'];csv_results=[];return db['ContactItemType'][_0xaf04('0x6f')]({'attributes':['id',_0xaf04('0x32')],'raw':!![],'order':['OrderBy']})[_0xaf04('0x2a')](function(_0x1035ee){_0x47dc10=_0x1035ee;var _0x4552fc=_[_0xaf04('0x3b')](db[_0xaf04('0x5e')][_0xaf04('0x36')]);return db[_0xaf04('0x68')]['findAll']({'raw':!![],'attributes':['id','alias']})['then'](function(_0x5ea813){_0x77100e=_0x5ea813;var _0x285713=squel[_0xaf04('0x70')]()[_0xaf04('0x3e')](_0x4552fc)['from']('cm_contacts','c')[_0xaf04('0x43')]('c.ListId\x20=\x20?',_0x4c7744)[_0xaf04('0x43')]('c.deletedAt\x20is\x20null')['distinct']();for(var _0x396330=0x0;_0x396330<_0x77100e[_0xaf04('0x3f')];_0x396330++){_0x285713['field'](_0xaf04('0x71')+_0x77100e[_0x396330]['id'],_0xaf04('0x72')+_0x77100e[_0x396330][_0xaf04('0x73')]);}for(var _0x396330=0x0;_0x396330<_0x47dc10['length'];_0x396330++){_0x285713[_0xaf04('0x74')](squel['select']()[_0xaf04('0x74')]('item')[_0xaf04('0x75')]('cm_contact_has_items')[_0xaf04('0x43')](_0xaf04('0x76'),_0x47dc10[_0x396330]['id'])['where'](_0xaf04('0x77')),'additionalPhone_'+_0x47dc10[_0x396330][_0xaf04('0x32')]);_0x285713[_0xaf04('0x74')](squel[_0xaf04('0x70')]()[_0xaf04('0x74')]('description')['from'](_0xaf04('0x78'))[_0xaf04('0x43')]('ItemTypeId\x20=\x20?',_0x47dc10[_0x396330]['id'])[_0xaf04('0x43')]('CmContactId\x20=\x20c.id'),_0xaf04('0x79')+_0x47dc10[_0x396330]['name']);}var _0x10b619=[];_0x10b619[_0xaf04('0x62')](_0x285713[_0xaf04('0x7a')]());BPromise[_0xaf04('0x63')](_0x10b619,handleQuery)[_0xaf04('0x2a')](function(_0x13e48f){handleQuery(_0x285713[_0xaf04('0x7a')]());var _0x30233c=csv_results[0x0];if(!_['isEmpty'](_0x30233c)){var _0x31bb98=toCsv(_0x30233c);var _0x5b2e23=Date[_0xaf04('0x7b')]();fs[_0xaf04('0x7c')](util['format'](_0xaf04('0x7d'),_0x4c7744,_0x5b2e23),_0x31bb98);_0x59bf00['setHeader'](_0xaf04('0x7e'),_0xaf04('0x7f')+util[_0xaf04('0x6b')]('list_%d_%s.csv',_0x4c7744,_0x5b2e23));_0x59bf00[_0xaf04('0x80')]('Content-type',_0xaf04('0x81'));return _0x59bf00[_0xaf04('0x82')](util['format'](_0xaf04('0x7d'),_0x4c7744,_0x5b2e23));}else{return _0x59bf00['sendStatus'](0xcc);}});});});};exports[_0xaf04('0x83')]=function(_0x2c0ab9,_0x1b9446,_0x13f134){var _0x488b00;delete _0x2c0ab9['body']['id'];return db[_0xaf04('0x35')][_0xaf04('0x84')]({'where':{'id':_0x2c0ab9[_0xaf04('0x4d')]['id']}})[_0xaf04('0x2a')](handleEntityNotFound(_0x1b9446,null))[_0xaf04('0x2a')](function(_0x30f59d){if(_0x30f59d){return db[_0xaf04('0x85')]['transaction'](function(_0x323199){return db[_0xaf04('0x68')][_0xaf04('0x4f')](_0x2c0ab9[_0xaf04('0x50')],{'transaction':_0x323199})[_0xaf04('0x2a')](function(_0x43e0d7){_0x488b00=_0x43e0d7;return _0x30f59d[_0xaf04('0x86')](_0x43e0d7,{'transaction':_0x323199});})[_0xaf04('0x2a')](function(){var _0x2099a4={'type':db[_0xaf04('0x87')][_0xaf04('0x88')],'transaction':_0x323199};switch(_0x2c0ab9[_0xaf04('0x50')][_0xaf04('0x37')]){case _0xaf04('0x89'):_0x2099a4['type']=db['Sequelize'][_0xaf04('0x88')];break;case _0xaf04('0x8a'):_0x2099a4[_0xaf04('0x37')]=db['Sequelize']['INTEGER'];break;case _0xaf04('0x8b'):_0x2099a4[_0xaf04('0x37')]=db[_0xaf04('0x87')][_0xaf04('0x8c')];_0x2099a4[_0xaf04('0x8d')]=![];break;default:}return db[_0xaf04('0x85')][_0xaf04('0x8e')][_0xaf04('0x8f')](_0xaf04('0x90'),util[_0xaf04('0x6b')]('cf_%s',_0x488b00['id']),_0x2099a4);})[_0xaf04('0x2a')](function(){return _0x488b00;});});}})['then'](respondWithResult(_0x1b9446,null))[_0xaf04('0x4c')](handleError(_0x1b9446,null));};exports[_0xaf04('0x91')]=function(_0x28505d,_0x27eb14,_0x1d3040){var _0x49d953={};var _0x4cbf10={};var _0x32f2e6;var _0x5e0447;return db[_0xaf04('0x35')][_0xaf04('0x84')]({'where':{'id':_0x28505d[_0xaf04('0x4d')]['id']}})[_0xaf04('0x2a')](handleEntityNotFound(_0x27eb14,null))[_0xaf04('0x2a')](function(_0x37f373){if(_0x37f373){_0x32f2e6=_0x37f373;_0x4cbf10['model']=_[_0xaf04('0x3b')](db[_0xaf04('0x68')][_0xaf04('0x36')]);_0x4cbf10[_0xaf04('0x3a')]=_[_0xaf04('0x3b')](_0x28505d['query']);_0x4cbf10[_0xaf04('0x44')]=_[_0xaf04('0x3c')](_0x4cbf10[_0xaf04('0x39')],_0x4cbf10['query']);_0x49d953[_0xaf04('0x3d')]=_['intersection'](_0x4cbf10[_0xaf04('0x39')],qs['fields'](_0x28505d['query'][_0xaf04('0x3e')]));_0x49d953[_0xaf04('0x3d')]=_0x49d953[_0xaf04('0x3d')][_0xaf04('0x3f')]?_0x49d953[_0xaf04('0x3d')]:_0x4cbf10['model'];_0x49d953['order']=qs['sort'](_0x28505d['query']['sort']);_0x49d953[_0xaf04('0x43')]=qs[_0xaf04('0x44')](_[_0xaf04('0x45')](_0x28505d[_0xaf04('0x3a')],_0x4cbf10[_0xaf04('0x44')]));_0x49d953[_0xaf04('0x43')]=_[_0xaf04('0x48')](_0x49d953[_0xaf04('0x43')],{'$or':[{'ListId':_0x37f373['id']},{'ListId':null}]});if(_0x28505d[_0xaf04('0x3a')]['filter']){_0x49d953[_0xaf04('0x43')]=_['merge'](_0x49d953[_0xaf04('0x43')],{'$or':_[_0xaf04('0x34')](_0x49d953['attributes'],function(_0x4160de){var _0x5a7437={};_0x5a7437[_0x4160de]={'$like':'%'+_0x28505d[_0xaf04('0x3a')]['filter']+'%'};return _0x5a7437;})});}_0x49d953=_[_0xaf04('0x48')]({},_0x49d953,_0x28505d[_0xaf04('0x49')]);return db['CmCustomField'][_0xaf04('0x92')](_0x49d953);}})[_0xaf04('0x2a')](respondWithResult(_0x27eb14,null))[_0xaf04('0x4c')](handleError(_0x27eb14,null));};exports[_0xaf04('0x93')]=function(_0x256ab0,_0x1c4c5e){return db[_0xaf04('0x68')]['findAndCountAll']({'where':{'ListId':null}})[_0xaf04('0x2a')](handleEntityNotFound(_0x1c4c5e,null))[_0xaf04('0x2a')](function(_0x444bf3){return _0x444bf3;})[_0xaf04('0x2a')](respondWithResult(_0x1c4c5e,null))[_0xaf04('0x4c')](handleError(_0x1c4c5e,null));};exports[_0xaf04('0x94')]=function(_0x2958ca,_0x4b5c42,_0x5e06a4){return db[_0xaf04('0x35')]['find']({'where':{'id':_0x2958ca[_0xaf04('0x4d')]['id']}})[_0xaf04('0x2a')](handleEntityNotFound(_0x4b5c42,null))[_0xaf04('0x2a')](function(_0x55e5b1){if(_0x55e5b1){return _0x55e5b1[_0xaf04('0x94')](_0x2958ca[_0xaf04('0x50')][_0xaf04('0x5c')],_[_0xaf04('0x95')](_0x2958ca[_0xaf04('0x50')],['ids','id'])||{})[_0xaf04('0x96')](function(_0x5b652f){for(var _0x133037=0x0;_0x133037<_0x2958ca[_0xaf04('0x50')][_0xaf04('0x5c')][_0xaf04('0x3f')];_0x133037+=0x1){socket[_0xaf04('0x97')]('userCmList:save',{'UserId':Number(_0x2958ca[_0xaf04('0x50')]['ids'][_0x133037]),'CmListId':Number(_0x2958ca['params']['id'])});}return _0x5b652f;});}})[_0xaf04('0x2a')](respondWithResult(_0x4b5c42,null))[_0xaf04('0x4c')](handleError(_0x4b5c42,null));};exports['removeAgents']=function(_0x26fe7d,_0x53bad2,_0x3e622a){return db[_0xaf04('0x35')]['find']({'where':{'id':_0x26fe7d[_0xaf04('0x4d')]['id']}})[_0xaf04('0x2a')](handleEntityNotFound(_0x53bad2,null))['then'](function(_0xbe67ae){if(_0xbe67ae){return _0xbe67ae[_0xaf04('0x98')](_0x26fe7d['query']['ids'])[_0xaf04('0x2a')](function(){if(_[_0xaf04('0x5f')](_0x26fe7d[_0xaf04('0x3a')][_0xaf04('0x5c')])){for(var _0x31c4a8=0x0;_0x31c4a8<_0x26fe7d[_0xaf04('0x3a')][_0xaf04('0x5c')][_0xaf04('0x3f')];_0x31c4a8+=0x1){socket['emit'](_0xaf04('0x99'),{'UserId':Number(_0x26fe7d[_0xaf04('0x3a')][_0xaf04('0x5c')][_0x31c4a8]),'CmListId':Number(_0x26fe7d[_0xaf04('0x4d')]['id'])});}}else{socket[_0xaf04('0x97')]('userCmList:remove',{'UserId':Number(_0x26fe7d['query'][_0xaf04('0x5c')]),'CmListId':Number(_0x26fe7d[_0xaf04('0x4d')]['id'])});}});}})[_0xaf04('0x2a')](respondWithStatusCode(_0x53bad2,null))[_0xaf04('0x4c')](handleError(_0x53bad2,null));};exports[_0xaf04('0x9a')]=function(_0x26065a,_0x2c2181,_0x5779b8){var _0x467a4d={};var _0x21a5f2={};var _0x13639e;var _0x4b75e5;return db['CmList'][_0xaf04('0x84')]({'where':{'id':_0x26065a[_0xaf04('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2c2181,null))[_0xaf04('0x2a')](function(_0x4b1445){if(_0x4b1445){_0x13639e=_0x4b1445;_0x21a5f2[_0xaf04('0x39')]=_[_0xaf04('0x3b')](db[_0xaf04('0x9b')][_0xaf04('0x36')]);_0x21a5f2[_0xaf04('0x3a')]=_[_0xaf04('0x3b')](_0x26065a[_0xaf04('0x3a')]);_0x21a5f2[_0xaf04('0x44')]=_[_0xaf04('0x3c')](_0x21a5f2['model'],_0x21a5f2['query']);_0x467a4d['attributes']=_[_0xaf04('0x3c')](_0x21a5f2[_0xaf04('0x39')],qs[_0xaf04('0x3e')](_0x26065a[_0xaf04('0x3a')][_0xaf04('0x3e')]));_0x467a4d[_0xaf04('0x3d')]=_0x467a4d[_0xaf04('0x3d')]['length']?_0x467a4d[_0xaf04('0x3d')]:_0x21a5f2[_0xaf04('0x39')];_0x467a4d['order']=qs['sort'](_0x26065a[_0xaf04('0x3a')][_0xaf04('0x59')]);_0x467a4d[_0xaf04('0x43')]=qs['filters'](_['pick'](_0x26065a[_0xaf04('0x3a')],_0x21a5f2[_0xaf04('0x44')]));if(_0x26065a['query'][_0xaf04('0x46')]){_0x467a4d[_0xaf04('0x43')]=_[_0xaf04('0x48')](_0x467a4d[_0xaf04('0x43')],{'$or':_[_0xaf04('0x34')](_0x467a4d[_0xaf04('0x3d')],function(_0x1bee14){var _0x1e6616={};_0x1e6616[_0x1bee14]={'$like':'%'+_0x26065a[_0xaf04('0x3a')][_0xaf04('0x46')]+'%'};return _0x1e6616;})});}_0x467a4d=_[_0xaf04('0x48')]({},_0x467a4d,_0x26065a[_0xaf04('0x49')]);return _0x13639e[_0xaf04('0x9a')](_0x467a4d);}})[_0xaf04('0x2a')](function(_0x4299ca){if(_0x4299ca){_0x4b75e5=_0x4299ca['length'];if(!_0x26065a[_0xaf04('0x3a')][_0xaf04('0x40')](_0xaf04('0x41'))){_0x467a4d['limit']=qs[_0xaf04('0x23')](_0x26065a[_0xaf04('0x3a')][_0xaf04('0x23')]);_0x467a4d[_0xaf04('0x21')]=qs['offset'](_0x26065a[_0xaf04('0x3a')][_0xaf04('0x21')]);}return _0x13639e[_0xaf04('0x9a')](_0x467a4d);}})[_0xaf04('0x2a')](function(_0x2d6112){if(_0x2d6112){return _0x2d6112?{'count':_0x4b75e5,'rows':_0x2d6112}:null;}})[_0xaf04('0x2a')](respondWithResult(_0x2c2181,null))[_0xaf04('0x4c')](handleError(_0x2c2181,null));};function handleQuery(_0x100403){logger['info'](_0x100403);return db[_0xaf04('0x85')][_0xaf04('0x3a')](_0x100403)[_0xaf04('0x96')](function(_0x22a29a){csv_results['push'](_0x22a29a);})[_0xaf04('0x4c')](function(_0x25a562){logger[_0xaf04('0x30')](_0x25a562[_0xaf04('0x66')]);});} \ No newline at end of file +var _0x2145=['json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','Lists','destroy','status','end','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','Disposition','getDispositions','findOne','nolimit','sort','ListId','options','removeDispositions','ids','addContacts','tags','isArray','CmContact','omit','success','push','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','cm_contacts','distinct','field','c.cf_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','from','CmContactId\x20=\x20c.id','toString','isEmpty','writeFileSync','format','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus'];(function(_0x3b449c,_0x1b2e0d){var _0x14aa36=function(_0x1819c1){while(--_0x1819c1){_0x3b449c['push'](_0x3b449c['shift']());}};_0x14aa36(++_0x1b2e0d);}(_0x2145,0x1d6));var _0x5214=function(_0x4da624,_0x1b192b){_0x4da624=_0x4da624-0x0;var _0x5caba0=_0x2145[_0x4da624];return _0x5caba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5214('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5214('0x1'));var rp=require(_0x5214('0x2'));var moment=require(_0x5214('0x3'));var BPromise=require(_0x5214('0x4'));var Mustache=require(_0x5214('0x5'));var util=require(_0x5214('0x6'));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(_0x5214('0x7'));var _=require(_0x5214('0x8'));var squel=require(_0x5214('0x9'));var crypto=require(_0x5214('0xa'));var jsforce=require(_0x5214('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5214('0xc'));var querystring=require(_0x5214('0xd'));var Papa=require(_0x5214('0xe'));var Redis=require(_0x5214('0xf'));var authService=require(_0x5214('0x10'));var qs=require(_0x5214('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5214('0x12'));var logger=require(_0x5214('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x5214('0x14'));var licenseUtil=require(_0x5214('0x15'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x5214('0x16')]=_['defaults'](config[_0x5214('0x16')],{'host':_0x5214('0x17'),'port':0x18eb});var socket=require(_0x5214('0x18'))(new Redis(config[_0x5214('0x16')]));require(_0x5214('0x19'))[_0x5214('0x1a')](socket);function respondWithStatusCode(_0xc3aef9,_0x3e7d24){_0x3e7d24=_0x3e7d24||0xcc;return function(_0x26fce2){if(_0x26fce2){return _0xc3aef9[_0x5214('0x1b')](_0x3e7d24);}return _0xc3aef9['status'](_0x3e7d24)['end']();};}function respondWithResult(_0x17ee10,_0x2b1565){_0x2b1565=_0x2b1565||0xc8;return function(_0x513d0e){if(_0x513d0e){return _0x17ee10['status'](_0x2b1565)[_0x5214('0x1c')](_0x513d0e);}};}function respondWithFilteredResult(_0x3283a0,_0x4c6180){return function(_0x20ada2){if(_0x20ada2){var _0x429550=typeof _0x4c6180[_0x5214('0x1d')]==='undefined'&&typeof _0x4c6180[_0x5214('0x1e')]===_0x5214('0x1f');var _0xcf53d9=_0x20ada2[_0x5214('0x20')];var _0x3f6b4c=_0x429550?0x0:_0x4c6180[_0x5214('0x1d')];var _0x4a5f29=_0x429550?_0x20ada2[_0x5214('0x20')]:_0x4c6180[_0x5214('0x1d')]+_0x4c6180[_0x5214('0x1e')];var _0x4e6d3e;if(_0x4a5f29>=_0xcf53d9){_0x4a5f29=_0xcf53d9;_0x4e6d3e=0xc8;}else{_0x4e6d3e=0xce;}_0x3283a0['status'](_0x4e6d3e);return _0x3283a0[_0x5214('0x21')](_0x5214('0x22'),_0x3f6b4c+'-'+_0x4a5f29+'/'+_0xcf53d9)[_0x5214('0x1c')](_0x20ada2);}return null;};}function patchUpdates(_0x305f3b){return function(_0x573d7c){try{jsonpatch[_0x5214('0x23')](_0x573d7c,_0x305f3b,!![]);}catch(_0x124745){return BPromise[_0x5214('0x24')](_0x124745);}return _0x573d7c[_0x5214('0x25')]();};}function saveUpdates(_0x4838ca,_0x4585ef){return function(_0x49abaf){if(_0x49abaf){return _0x49abaf[_0x5214('0x26')](_0x4838ca)[_0x5214('0x27')](function(_0x2bb832){return _0x2bb832;});}return null;};}function removeEntity(_0x36dfea,_0x38d917){return function(_0x448711){if(_0x448711){return _0x448711['destroy']()[_0x5214('0x27')](function(){var _0xed75ec=_0x448711[_0x5214('0x28')]({'plain':!![]});var _0x39466f=_0x5214('0x29');return db['UserProfileResource'][_0x5214('0x2a')]({'where':{'type':_0x39466f,'resourceId':_0xed75ec['id']}})[_0x5214('0x27')](function(){return _0x448711;});})['then'](function(){_0x36dfea[_0x5214('0x2b')](0xcc)[_0x5214('0x2c')]();});}};}function handleEntityNotFound(_0x3d9f08,_0x4836f8){return function(_0x220d15){if(!_0x220d15){_0x3d9f08[_0x5214('0x1b')](0x194);}return _0x220d15;};}function handleError(_0x1c55f9,_0x1db2a1){_0x1db2a1=_0x1db2a1||0x1f4;return function(_0x1fcc34){logger[_0x5214('0x2d')](_0x1fcc34[_0x5214('0x2e')]);if(_0x1fcc34[_0x5214('0x2f')]){delete _0x1fcc34[_0x5214('0x2f')];}_0x1c55f9[_0x5214('0x2b')](_0x1db2a1)[_0x5214('0x30')](_0x1fcc34);};}exports[_0x5214('0x31')]=function(_0x2b69f,_0x39e5da){var _0x5a08c8={},_0xe235df={},_0x24a764={'count':0x0,'rows':[]};var _0x55a2c2=_[_0x5214('0x32')](db[_0x5214('0x33')][_0x5214('0x34')],function(_0x3ff336){return{'name':_0x3ff336[_0x5214('0x35')],'type':_0x3ff336[_0x5214('0x36')][_0x5214('0x37')]};});_0xe235df[_0x5214('0x38')]=_[_0x5214('0x32')](_0x55a2c2,_0x5214('0x2f'));_0xe235df[_0x5214('0x39')]=_['keys'](_0x2b69f[_0x5214('0x39')]);_0xe235df[_0x5214('0x3a')]=_[_0x5214('0x3b')](_0xe235df['model'],_0xe235df[_0x5214('0x39')]);_0x5a08c8['attributes']=_['intersection'](_0xe235df[_0x5214('0x38')],qs[_0x5214('0x3c')](_0x2b69f[_0x5214('0x39')][_0x5214('0x3c')]));_0x5a08c8['attributes']=_0x5a08c8[_0x5214('0x3d')][_0x5214('0x3e')]?_0x5a08c8[_0x5214('0x3d')]:_0xe235df[_0x5214('0x38')];if(!_0x2b69f[_0x5214('0x39')][_0x5214('0x3f')]('nolimit')){_0x5a08c8[_0x5214('0x1e')]=qs[_0x5214('0x1e')](_0x2b69f['query'][_0x5214('0x1e')]);_0x5a08c8[_0x5214('0x1d')]=qs[_0x5214('0x1d')](_0x2b69f[_0x5214('0x39')][_0x5214('0x1d')]);}_0x5a08c8[_0x5214('0x40')]=qs['sort'](_0x2b69f['query']['sort']);_0x5a08c8[_0x5214('0x41')]=qs[_0x5214('0x3a')](_[_0x5214('0x42')](_0x2b69f[_0x5214('0x39')],_0xe235df[_0x5214('0x3a')]),_0x55a2c2);if(_0x2b69f[_0x5214('0x39')][_0x5214('0x43')]){_0x5a08c8[_0x5214('0x41')]=_[_0x5214('0x44')](_0x5a08c8[_0x5214('0x41')],{'$or':_[_0x5214('0x32')](_0x55a2c2,function(_0x32b48e){if(_0x32b48e['type']!==_0x5214('0x45')){var _0x28befc={};_0x28befc[_0x32b48e[_0x5214('0x2f')]]={'$like':'%'+_0x2b69f['query'][_0x5214('0x43')]+'%'};return _0x28befc;}})});}_0x5a08c8=_[_0x5214('0x44')]({},_0x5a08c8,_0x2b69f['options']);var _0x56bf8e={'where':_0x5a08c8['where']};return db['CmList'][_0x5214('0x20')](_0x56bf8e)[_0x5214('0x27')](function(_0x202af6){_0x24a764['count']=_0x202af6;if(_0x2b69f[_0x5214('0x39')][_0x5214('0x46')]){_0x5a08c8[_0x5214('0x47')]=[{'all':!![]}];}return db[_0x5214('0x33')][_0x5214('0x48')](_0x5a08c8);})[_0x5214('0x27')](function(_0x2d02ea){_0x24a764[_0x5214('0x49')]=_0x2d02ea;return _0x24a764;})['then'](respondWithFilteredResult(_0x39e5da,_0x5a08c8))[_0x5214('0x4a')](handleError(_0x39e5da,null));};exports[_0x5214('0x4b')]=function(_0x3cc59f,_0x263b0f){var _0x1a1844={'raw':![],'where':{'id':_0x3cc59f['params']['id']}},_0x1a7348={};_0x1a7348[_0x5214('0x38')]=_[_0x5214('0x4c')](db[_0x5214('0x33')][_0x5214('0x34')]);_0x1a7348[_0x5214('0x39')]=_[_0x5214('0x4c')](_0x3cc59f[_0x5214('0x39')]);_0x1a7348[_0x5214('0x3a')]=_[_0x5214('0x3b')](_0x1a7348['model'],_0x1a7348[_0x5214('0x39')]);_0x1a1844[_0x5214('0x3d')]=_[_0x5214('0x3b')](_0x1a7348[_0x5214('0x38')],qs[_0x5214('0x3c')](_0x3cc59f[_0x5214('0x39')]['fields']));_0x1a1844['attributes']=_0x1a1844[_0x5214('0x3d')]['length']?_0x1a1844['attributes']:_0x1a7348[_0x5214('0x38')];if(_0x3cc59f['query'][_0x5214('0x46')]){_0x1a1844['include']=[{'all':!![]}];}_0x1a1844=_['merge']({},_0x1a1844,_0x3cc59f['options']);return db['CmList'][_0x5214('0x4d')](_0x1a1844)[_0x5214('0x27')](handleEntityNotFound(_0x263b0f,null))['then'](respondWithResult(_0x263b0f,null))['catch'](handleError(_0x263b0f,null));};exports[_0x5214('0x4e')]=function(_0x5a50ce,_0x37beb9){return db['CmList']['create'](_0x5a50ce[_0x5214('0x4f')],{})[_0x5214('0x27')](function(_0x163fe2){var _0x2d7a8c=_0x5a50ce[_0x5214('0x50')]['get']({'plain':!![]});if(!_0x2d7a8c)throw new Error(_0x5214('0x51'));if(_0x2d7a8c[_0x5214('0x52')]==='user'){var _0x3dbb2a=_0x163fe2[_0x5214('0x28')]({'plain':!![]});var _0x5277fc='Lists';return db[_0x5214('0x53')]['find']({'where':{'name':_0x5277fc,'userProfileId':_0x2d7a8c[_0x5214('0x54')]},'raw':!![]})[_0x5214('0x27')](function(_0x27a17d){if(_0x27a17d&&_0x27a17d[_0x5214('0x55')]===0x0){return db[_0x5214('0x56')][_0x5214('0x4e')]({'name':_0x3dbb2a['name'],'resourceId':_0x3dbb2a['id'],'type':_0x27a17d[_0x5214('0x2f')],'sectionId':_0x27a17d['id']},{})[_0x5214('0x27')](function(){return _0x163fe2;});}else{return _0x163fe2;}})[_0x5214('0x4a')](function(_0x466c43){logger['error'](_0x5214('0x57'),_0x466c43);throw _0x466c43;});}return _0x163fe2;})['then'](respondWithResult(_0x37beb9,0xc9))[_0x5214('0x4a')](handleError(_0x37beb9,null));};exports[_0x5214('0x26')]=function(_0x56aa83,_0x56a65e){if(_0x56aa83[_0x5214('0x4f')]['id']){delete _0x56aa83['body']['id'];}return db[_0x5214('0x33')][_0x5214('0x4d')]({'where':{'id':_0x56aa83[_0x5214('0x58')]['id']}})[_0x5214('0x27')](handleEntityNotFound(_0x56a65e,null))[_0x5214('0x27')](saveUpdates(_0x56aa83[_0x5214('0x4f')],null))['then'](respondWithResult(_0x56a65e,null))[_0x5214('0x4a')](handleError(_0x56a65e,null));};exports[_0x5214('0x2a')]=function(_0x15a613,_0xd4443e){return db[_0x5214('0x33')]['find']({'where':{'id':_0x15a613[_0x5214('0x58')]['id']}})[_0x5214('0x27')](handleEntityNotFound(_0xd4443e,null))[_0x5214('0x27')](removeEntity(_0xd4443e,null))[_0x5214('0x4a')](handleError(_0xd4443e,null));};exports[_0x5214('0x59')]=function(_0x33c85a,_0x3c4846){return db[_0x5214('0x33')]['describe']()['then'](respondWithResult(_0x3c4846,null))[_0x5214('0x4a')](handleError(_0x3c4846,null));};exports['addDisposition']=function(_0x2f8f3d,_0x33924e,_0x1aaf5a){if(_0x2f8f3d['body']['id']){delete _0x2f8f3d[_0x5214('0x4f')]['id'];}return db[_0x5214('0x33')][_0x5214('0x4d')]({'where':{'id':_0x2f8f3d[_0x5214('0x58')]['id']}})[_0x5214('0x27')](handleEntityNotFound(_0x33924e,null))['then'](function(_0x18e000){if(_0x18e000){_0x2f8f3d[_0x5214('0x4f')]['ListId']=_0x18e000['id'];return db[_0x5214('0x5a')][_0x5214('0x4e')](_0x2f8f3d['body']);}})['then'](respondWithResult(_0x33924e,null))['catch'](handleError(_0x33924e,null));};exports[_0x5214('0x5b')]=function(_0x175b12,_0x32c15c,_0x42964c){var _0x461ead={'raw':![],'where':{}};var _0x19696a={};var _0x527e62={'count':0x0,'rows':[]};return db['CmList'][_0x5214('0x5c')]({'where':{'id':_0x175b12[_0x5214('0x58')]['id']}})['then'](handleEntityNotFound(_0x32c15c,null))[_0x5214('0x27')](function(_0x21eaf9){if(_0x21eaf9){_0x19696a[_0x5214('0x38')]=_['keys'](db['Disposition'][_0x5214('0x34')]);_0x19696a[_0x5214('0x39')]=_[_0x5214('0x4c')](_0x175b12[_0x5214('0x39')]);_0x19696a[_0x5214('0x3a')]=_['intersection'](_0x19696a[_0x5214('0x38')],_0x19696a[_0x5214('0x39')]);_0x461ead[_0x5214('0x3d')]=_['intersection'](_0x19696a[_0x5214('0x38')],qs[_0x5214('0x3c')](_0x175b12[_0x5214('0x39')]['fields']));_0x461ead[_0x5214('0x3d')]=_0x461ead[_0x5214('0x3d')][_0x5214('0x3e')]?_0x461ead['attributes']:_0x19696a[_0x5214('0x38')];if(!_0x175b12['query'][_0x5214('0x3f')](_0x5214('0x5d'))){_0x461ead[_0x5214('0x1e')]=qs[_0x5214('0x1e')](_0x175b12[_0x5214('0x39')][_0x5214('0x1e')]);_0x461ead['offset']=qs[_0x5214('0x1d')](_0x175b12['query'][_0x5214('0x1d')]);}_0x461ead['order']=qs[_0x5214('0x5e')](_0x175b12['query'][_0x5214('0x5e')]);_0x461ead[_0x5214('0x41')]=qs[_0x5214('0x3a')](_[_0x5214('0x42')](_0x175b12[_0x5214('0x39')],_0x19696a[_0x5214('0x3a')]));_0x461ead[_0x5214('0x41')][_0x5214('0x5f')]=_0x21eaf9['id'];if(_0x175b12[_0x5214('0x39')][_0x5214('0x43')]){_0x461ead[_0x5214('0x41')]=_['merge'](_0x461ead[_0x5214('0x41')],{'$or':_[_0x5214('0x32')](_0x461ead[_0x5214('0x3d')],function(_0x28c00f){var _0x2f05c0={};_0x2f05c0[_0x28c00f]={'$like':'%'+_0x175b12['query'][_0x5214('0x43')]+'%'};return _0x2f05c0;})});}_0x461ead=_['merge']({},_0x461ead,_0x175b12[_0x5214('0x60')]);return db['Disposition'][_0x5214('0x20')]({'where':_0x461ead['where']})[_0x5214('0x27')](function(_0x47a56c){_0x527e62[_0x5214('0x20')]=_0x47a56c;if(_0x175b12[_0x5214('0x39')][_0x5214('0x46')]){_0x461ead[_0x5214('0x47')]=[{'all':!![]}];}return db[_0x5214('0x5a')][_0x5214('0x48')](_0x461ead);})[_0x5214('0x27')](function(_0x29e9a3){_0x527e62[_0x5214('0x49')]=_0x29e9a3;return _0x527e62;});}})['then'](respondWithFilteredResult(_0x32c15c,_0x461ead))[_0x5214('0x4a')](handleError(_0x32c15c,null));};exports[_0x5214('0x61')]=function(_0x1b13c1,_0x32c0cd,_0x413589){return db['CmList']['find']({'where':{'id':_0x1b13c1[_0x5214('0x58')]['id']}})[_0x5214('0x27')](handleEntityNotFound(_0x32c0cd,null))['then'](function(_0xaafa1){if(_0xaafa1){return _0xaafa1[_0x5214('0x61')](_0x1b13c1['query'][_0x5214('0x62')]);}})[_0x5214('0x27')](respondWithStatusCode(_0x32c0cd,null))[_0x5214('0x4a')](handleError(_0x32c0cd,null));};exports[_0x5214('0x63')]=function(_0x4f6ec8,_0x2871f0,_0x269e41){return db[_0x5214('0x33')]['find']({'where':{'id':_0x4f6ec8[_0x5214('0x58')]['id']}})['then'](handleEntityNotFound(_0x2871f0,null))['then'](function(_0x125bce){if(_0x125bce){var _0x46ddf7=[];var _0x1ade5a={'success':[],'errors':[]};return db['CmContact']['describe']()['then'](function(_0x371107){if(_0x4f6ec8['body'][_0x5214('0x64')]&&_[_0x5214('0x65')](_0x4f6ec8['body'][_0x5214('0x64')])){if(_0x4f6ec8[_0x5214('0x4f')]['tags'][_0x5214('0x3e')]){_0x4f6ec8[_0x5214('0x4f')][_0x5214('0x64')]=_0x4f6ec8[_0x5214('0x4f')]['tags']['join'](';')+';';}else{_0x4f6ec8[_0x5214('0x4f')][_0x5214('0x64')]=null;}}else{_0x4f6ec8[_0x5214('0x4f')]['tags']=null;}if(_0x4f6ec8[_0x5214('0x4f')]&&_[_0x5214('0x65')](_0x4f6ec8[_0x5214('0x4f')])){for(var _0x37fb9c=0x0;_0x37fb9c<_0x4f6ec8[_0x5214('0x4f')][_0x5214('0x3e')];_0x37fb9c+=0x1){_0x4f6ec8[_0x5214('0x4f')][_0x37fb9c][_0x5214('0x5f')]=_0x4f6ec8[_0x5214('0x58')]['id'];_0x46ddf7['push'](_0x4f6ec8[_0x5214('0x4f')][_0x37fb9c]);}return BPromise['each'](_0x46ddf7,function(_0x516923){return db[_0x5214('0x66')][_0x5214('0x4e')](_[_0x5214('0x67')](_0x516923,[_0x5214('0x62'),'id'])||{},{'fields':_[_0x5214('0x4c')](_0x371107),'raw':!![]})[_0x5214('0x27')](function(_0x117fc9){_0x1ade5a[_0x5214('0x68')][_0x5214('0x69')](_0x117fc9['dataValues']);})[_0x5214('0x4a')](function(_0x48a8a9){_0x1ade5a[_0x5214('0x6a')][_0x5214('0x69')]({'data':_0x516923,'error':_0x48a8a9[_0x5214('0x6b')]});});})[_0x5214('0x27')](function(_0xe02f82){return _0x1ade5a;})['catch'](function(_0x56d656){return _0x56d656;});}else{_0x2871f0[_0x5214('0x2b')](0x190)[_0x5214('0x1c')]({'message':_0x5214('0x6c')});}});}})[_0x5214('0x27')](respondWithResult(_0x2871f0,null))[_0x5214('0x4a')](handleError(_0x2871f0,null));};exports[_0x5214('0x6d')]=function(_0x1a5a23,_0x8f1308,_0x4e6752){var _0x165729;return db[_0x5214('0x33')][_0x5214('0x4d')]({'where':{'id':_0x1a5a23[_0x5214('0x58')]['id']},'include':[{'model':db[_0x5214('0x6e')],'as':'CustomFields'}]})[_0x5214('0x27')](handleEntityNotFound(_0x8f1308,null))[_0x5214('0x27')](function(_0x168ae1){if(_0x168ae1){_0x165729=_0x168ae1;return db[_0x5214('0x66')][_0x5214('0x34')];}})[_0x5214('0x27')](function(_0x227a48){if(_0x227a48){var _0x1a08bb={};var _0x16afbb={};_0x16afbb[_0x5214('0x38')]=_[_0x5214('0x6f')](_[_0x5214('0x4c')](_0x227a48),_[_0x5214('0x32')](_0x165729[_0x5214('0x70')],function(_0x5fc4ef){return util['format'](_0x5214('0x71'),_0x5fc4ef['id']);}));_0x16afbb['query']=_['keys'](_0x1a5a23[_0x5214('0x39')]);_0x16afbb['filters']=_[_0x5214('0x3b')](_0x16afbb[_0x5214('0x38')],_0x16afbb[_0x5214('0x39')]);_0x1a08bb[_0x5214('0x3d')]=_['intersection'](_0x16afbb[_0x5214('0x38')],qs[_0x5214('0x3c')](_0x1a5a23[_0x5214('0x39')][_0x5214('0x3c')]));_0x1a08bb[_0x5214('0x3d')]=_0x1a08bb[_0x5214('0x3d')][_0x5214('0x3e')]?_0x1a08bb[_0x5214('0x3d')]:_0x16afbb[_0x5214('0x38')];if(!_0x1a5a23['query'][_0x5214('0x3f')]('nolimit')){_0x1a08bb[_0x5214('0x1e')]=qs[_0x5214('0x1e')](_0x1a5a23['query'][_0x5214('0x1e')]);_0x1a08bb[_0x5214('0x1d')]=qs[_0x5214('0x1d')](_0x1a5a23[_0x5214('0x39')]['offset']);}_0x1a08bb[_0x5214('0x40')]=qs['sort'](_0x1a5a23['query'][_0x5214('0x5e')]);_0x1a08bb[_0x5214('0x41')]=qs[_0x5214('0x3a')](_[_0x5214('0x42')](_0x1a5a23['query'],_0x16afbb[_0x5214('0x3a')]));_0x1a08bb[_0x5214('0x72')]=!![];if(_0x1a5a23[_0x5214('0x39')][_0x5214('0x43')]){_0x1a08bb[_0x5214('0x41')]=_[_0x5214('0x44')](_0x1a08bb[_0x5214('0x41')],{'$or':_[_0x5214('0x32')](_0x1a08bb['attributes'],function(_0x1fd496){var _0x49ae9d={};_0x49ae9d[_0x1fd496]={'$like':'%'+_0x1a5a23[_0x5214('0x39')][_0x5214('0x43')]+'%'};return _0x49ae9d;})});}_0x1a08bb=_[_0x5214('0x44')]({},_0x1a08bb,_0x1a5a23[_0x5214('0x60')]);return _0x165729['getContacts'](_0x1a08bb);}})[_0x5214('0x27')](respondWithResult(_0x8f1308,null))[_0x5214('0x4a')](handleError(_0x8f1308,null));};exports[_0x5214('0x73')]=function(_0x349ce1,_0x470f21,_0x52845c){var _0x241553;var _0xbcfa06;var _0x2c6eac;var _0x4aac1a=_0x349ce1['params']['id'];csv_results=[];return db[_0x5214('0x74')]['findAll']({'attributes':['id',_0x5214('0x2f')],'raw':!![],'order':[_0x5214('0x75')]})[_0x5214('0x27')](function(_0x444e6d){_0x241553=_0x444e6d;var _0x2fc61d=_[_0x5214('0x4c')](db[_0x5214('0x66')][_0x5214('0x34')]);return db[_0x5214('0x6e')][_0x5214('0x48')]({'raw':!![],'attributes':['id',_0x5214('0x76')]})[_0x5214('0x27')](function(_0xfd6526){_0xbcfa06=_0xfd6526;var _0xfa6d90=squel[_0x5214('0x77')]()[_0x5214('0x3c')](_0x2fc61d)['from'](_0x5214('0x78'),'c')[_0x5214('0x41')]('c.ListId\x20=\x20?',_0x4aac1a)[_0x5214('0x41')]('c.deletedAt\x20is\x20null')[_0x5214('0x79')]();for(var _0xd7ac27=0x0;_0xd7ac27<_0xbcfa06['length'];_0xd7ac27++){_0xfa6d90[_0x5214('0x7a')](_0x5214('0x7b')+_0xbcfa06[_0xd7ac27]['id'],'customField_'+_0xbcfa06[_0xd7ac27][_0x5214('0x76')]);}for(var _0xd7ac27=0x0;_0xd7ac27<_0x241553[_0x5214('0x3e')];_0xd7ac27++){_0xfa6d90['field'](squel[_0x5214('0x77')]()[_0x5214('0x7a')](_0x5214('0x7c'))['from'](_0x5214('0x7d'))['where'](_0x5214('0x7e'),_0x241553[_0xd7ac27]['id'])[_0x5214('0x41')]('CmContactId\x20=\x20c.id'),_0x5214('0x7f')+_0x241553[_0xd7ac27][_0x5214('0x2f')]);_0xfa6d90[_0x5214('0x7a')](squel[_0x5214('0x77')]()['field']('description')[_0x5214('0x80')](_0x5214('0x7d'))['where'](_0x5214('0x7e'),_0x241553[_0xd7ac27]['id'])[_0x5214('0x41')](_0x5214('0x81')),'description_additionalPhone_'+_0x241553[_0xd7ac27][_0x5214('0x2f')]);}var _0x3aaa61=[];_0x3aaa61[_0x5214('0x69')](_0xfa6d90[_0x5214('0x82')]());BPromise['each'](_0x3aaa61,handleQuery)['then'](function(_0x3a4426){handleQuery(_0xfa6d90[_0x5214('0x82')]());var _0x198cdd=csv_results[0x0];if(!_[_0x5214('0x83')](_0x198cdd)){var _0x85e283=toCsv(_0x198cdd);var _0x55f758=Date['now']();fs[_0x5214('0x84')](util[_0x5214('0x85')](_0x5214('0x86'),_0x4aac1a,_0x55f758),_0x85e283);_0x470f21['setHeader'](_0x5214('0x87'),_0x5214('0x88')+util[_0x5214('0x85')](_0x5214('0x89'),_0x4aac1a,_0x55f758));_0x470f21[_0x5214('0x8a')](_0x5214('0x8b'),_0x5214('0x8c'));return _0x470f21[_0x5214('0x8d')](util[_0x5214('0x85')]('/tmp/list_%d_%s.csv',_0x4aac1a,_0x55f758));}else{return _0x470f21[_0x5214('0x1b')](0xcc);}});});});};exports[_0x5214('0x8e')]=function(_0x47585f,_0x5815f4,_0x2d5464){var _0x254517;delete _0x47585f[_0x5214('0x4f')]['id'];return db[_0x5214('0x33')][_0x5214('0x5c')]({'where':{'id':_0x47585f[_0x5214('0x58')]['id']}})[_0x5214('0x27')](handleEntityNotFound(_0x5815f4,null))[_0x5214('0x27')](function(_0x1a9c4b){if(_0x1a9c4b){return db[_0x5214('0x8f')][_0x5214('0x90')](function(_0x336bf7){return db[_0x5214('0x6e')]['create'](_0x47585f['body'],{'transaction':_0x336bf7})['then'](function(_0x2094a7){_0x254517=_0x2094a7;return _0x1a9c4b[_0x5214('0x91')](_0x2094a7,{'transaction':_0x336bf7});})['then'](function(){var _0x46da6c={'type':db[_0x5214('0x92')][_0x5214('0x93')],'transaction':_0x336bf7};switch(_0x47585f[_0x5214('0x4f')][_0x5214('0x36')]){case'text':_0x46da6c[_0x5214('0x36')]=db['Sequelize']['TEXT'];break;case'number':_0x46da6c[_0x5214('0x36')]=db[_0x5214('0x92')][_0x5214('0x94')];break;case _0x5214('0x95'):_0x46da6c['type']=db[_0x5214('0x92')][_0x5214('0x96')];_0x46da6c[_0x5214('0x97')]=![];break;default:}return db['sequelize'][_0x5214('0x98')][_0x5214('0x99')](_0x5214('0x78'),util[_0x5214('0x85')]('cf_%s',_0x254517['id']),_0x46da6c);})[_0x5214('0x27')](function(){return _0x254517;});});}})[_0x5214('0x27')](respondWithResult(_0x5815f4,null))[_0x5214('0x4a')](handleError(_0x5815f4,null));};exports[_0x5214('0x9a')]=function(_0x8431cc,_0x51f1e4,_0x2a48b2){var _0x394ae0={};var _0xb4ea87={};var _0x5b8169;var _0x27d146;return db['CmList'][_0x5214('0x5c')]({'where':{'id':_0x8431cc[_0x5214('0x58')]['id']}})[_0x5214('0x27')](handleEntityNotFound(_0x51f1e4,null))[_0x5214('0x27')](function(_0xde6e20){if(_0xde6e20){_0x5b8169=_0xde6e20;_0xb4ea87[_0x5214('0x38')]=_[_0x5214('0x4c')](db[_0x5214('0x6e')][_0x5214('0x34')]);_0xb4ea87[_0x5214('0x39')]=_['keys'](_0x8431cc[_0x5214('0x39')]);_0xb4ea87[_0x5214('0x3a')]=_[_0x5214('0x3b')](_0xb4ea87[_0x5214('0x38')],_0xb4ea87['query']);_0x394ae0['attributes']=_[_0x5214('0x3b')](_0xb4ea87['model'],qs[_0x5214('0x3c')](_0x8431cc[_0x5214('0x39')][_0x5214('0x3c')]));_0x394ae0[_0x5214('0x3d')]=_0x394ae0['attributes'][_0x5214('0x3e')]?_0x394ae0[_0x5214('0x3d')]:_0xb4ea87[_0x5214('0x38')];_0x394ae0[_0x5214('0x40')]=qs[_0x5214('0x5e')](_0x8431cc[_0x5214('0x39')][_0x5214('0x5e')]);_0x394ae0[_0x5214('0x41')]=qs[_0x5214('0x3a')](_[_0x5214('0x42')](_0x8431cc[_0x5214('0x39')],_0xb4ea87[_0x5214('0x3a')]));_0x394ae0[_0x5214('0x41')]=_['merge'](_0x394ae0[_0x5214('0x41')],{'$or':[{'ListId':_0xde6e20['id']},{'ListId':null}]});if(_0x8431cc['query']['filter']){_0x394ae0['where']=_[_0x5214('0x44')](_0x394ae0[_0x5214('0x41')],{'$or':_[_0x5214('0x32')](_0x394ae0['attributes'],function(_0x2e9de1){var _0x2ab280={};_0x2ab280[_0x2e9de1]={'$like':'%'+_0x8431cc['query'][_0x5214('0x43')]+'%'};return _0x2ab280;})});}_0x394ae0=_[_0x5214('0x44')]({},_0x394ae0,_0x8431cc[_0x5214('0x60')]);return db[_0x5214('0x6e')][_0x5214('0x9b')](_0x394ae0);}})[_0x5214('0x27')](respondWithResult(_0x51f1e4,null))['catch'](handleError(_0x51f1e4,null));};exports[_0x5214('0x9c')]=function(_0x1fe8e8,_0x43780d){return db['CmCustomField'][_0x5214('0x9b')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x43780d,null))[_0x5214('0x27')](function(_0x323bec){return _0x323bec;})[_0x5214('0x27')](respondWithResult(_0x43780d,null))[_0x5214('0x4a')](handleError(_0x43780d,null));};exports['addAgents']=function(_0x182f50,_0x15735d,_0x48c36f){return db[_0x5214('0x33')]['find']({'where':{'id':_0x182f50[_0x5214('0x58')]['id']}})[_0x5214('0x27')](handleEntityNotFound(_0x15735d,null))[_0x5214('0x27')](function(_0x324cad){if(_0x324cad){return _0x324cad[_0x5214('0x9d')](_0x182f50[_0x5214('0x4f')]['ids'],_[_0x5214('0x67')](_0x182f50[_0x5214('0x4f')],['ids','id'])||{})[_0x5214('0x9e')](function(_0x57514a){for(var _0x2ea670=0x0;_0x2ea670<_0x182f50[_0x5214('0x4f')]['ids'][_0x5214('0x3e')];_0x2ea670+=0x1){socket[_0x5214('0x9f')](_0x5214('0xa0'),{'UserId':Number(_0x182f50['body'][_0x5214('0x62')][_0x2ea670]),'CmListId':Number(_0x182f50[_0x5214('0x58')]['id'])});}return _0x57514a;});}})['then'](respondWithResult(_0x15735d,null))['catch'](handleError(_0x15735d,null));};exports[_0x5214('0xa1')]=function(_0x20b290,_0x46b294,_0x4151a2){return db[_0x5214('0x33')][_0x5214('0x4d')]({'where':{'id':_0x20b290[_0x5214('0x58')]['id']}})['then'](handleEntityNotFound(_0x46b294,null))['then'](function(_0x2f921d){if(_0x2f921d){return _0x2f921d['removeAgents'](_0x20b290[_0x5214('0x39')][_0x5214('0x62')])[_0x5214('0x27')](function(){if(_[_0x5214('0x65')](_0x20b290[_0x5214('0x39')][_0x5214('0x62')])){for(var _0x153d8a=0x0;_0x153d8a<_0x20b290[_0x5214('0x39')][_0x5214('0x62')][_0x5214('0x3e')];_0x153d8a+=0x1){socket[_0x5214('0x9f')](_0x5214('0xa2'),{'UserId':Number(_0x20b290[_0x5214('0x39')]['ids'][_0x153d8a]),'CmListId':Number(_0x20b290[_0x5214('0x58')]['id'])});}}else{socket[_0x5214('0x9f')]('userCmList:remove',{'UserId':Number(_0x20b290[_0x5214('0x39')][_0x5214('0x62')]),'CmListId':Number(_0x20b290[_0x5214('0x58')]['id'])});}});}})[_0x5214('0x27')](respondWithStatusCode(_0x46b294,null))[_0x5214('0x4a')](handleError(_0x46b294,null));};exports[_0x5214('0xa3')]=function(_0x48befb,_0x6218de,_0x4caa38){var _0x54e4f7={};var _0x2cccbd={};var _0x196484;var _0x39c4c2;return db[_0x5214('0x33')][_0x5214('0x5c')]({'where':{'id':_0x48befb[_0x5214('0x58')]['id']}})[_0x5214('0x27')](handleEntityNotFound(_0x6218de,null))[_0x5214('0x27')](function(_0x15ef56){if(_0x15ef56){_0x196484=_0x15ef56;_0x2cccbd[_0x5214('0x38')]=_[_0x5214('0x4c')](db[_0x5214('0xa4')]['rawAttributes']);_0x2cccbd[_0x5214('0x39')]=_[_0x5214('0x4c')](_0x48befb[_0x5214('0x39')]);_0x2cccbd[_0x5214('0x3a')]=_[_0x5214('0x3b')](_0x2cccbd[_0x5214('0x38')],_0x2cccbd[_0x5214('0x39')]);_0x54e4f7[_0x5214('0x3d')]=_[_0x5214('0x3b')](_0x2cccbd['model'],qs['fields'](_0x48befb[_0x5214('0x39')][_0x5214('0x3c')]));_0x54e4f7[_0x5214('0x3d')]=_0x54e4f7[_0x5214('0x3d')]['length']?_0x54e4f7['attributes']:_0x2cccbd[_0x5214('0x38')];_0x54e4f7[_0x5214('0x40')]=qs[_0x5214('0x5e')](_0x48befb[_0x5214('0x39')][_0x5214('0x5e')]);_0x54e4f7[_0x5214('0x41')]=qs[_0x5214('0x3a')](_['pick'](_0x48befb[_0x5214('0x39')],_0x2cccbd[_0x5214('0x3a')]));if(_0x48befb[_0x5214('0x39')][_0x5214('0x43')]){_0x54e4f7[_0x5214('0x41')]=_['merge'](_0x54e4f7['where'],{'$or':_[_0x5214('0x32')](_0x54e4f7[_0x5214('0x3d')],function(_0x4e1e1f){var _0x44aa42={};_0x44aa42[_0x4e1e1f]={'$like':'%'+_0x48befb[_0x5214('0x39')][_0x5214('0x43')]+'%'};return _0x44aa42;})});}_0x54e4f7=_[_0x5214('0x44')]({},_0x54e4f7,_0x48befb['options']);return _0x196484[_0x5214('0xa3')](_0x54e4f7);}})[_0x5214('0x27')](function(_0x598f0e){if(_0x598f0e){_0x39c4c2=_0x598f0e[_0x5214('0x3e')];if(!_0x48befb['query'][_0x5214('0x3f')](_0x5214('0x5d'))){_0x54e4f7['limit']=qs[_0x5214('0x1e')](_0x48befb['query'][_0x5214('0x1e')]);_0x54e4f7[_0x5214('0x1d')]=qs[_0x5214('0x1d')](_0x48befb[_0x5214('0x39')][_0x5214('0x1d')]);}return _0x196484[_0x5214('0xa3')](_0x54e4f7);}})[_0x5214('0x27')](function(_0x178425){if(_0x178425){return _0x178425?{'count':_0x39c4c2,'rows':_0x178425}:null;}})[_0x5214('0x27')](respondWithResult(_0x6218de,null))[_0x5214('0x4a')](handleError(_0x6218de,null));};function handleQuery(_0x3b7fab){logger[_0x5214('0xa5')](_0x3b7fab);return db[_0x5214('0x8f')][_0x5214('0x39')](_0x3b7fab)['spread'](function(_0x13e673){csv_results[_0x5214('0x69')](_0x13e673);})['catch'](function(_0x48ef0a){logger[_0x5214('0x2d')](_0x48ef0a[_0x5214('0x6b')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index aa8fbbd..d2f84ee 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 _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0x55ca,0x126));var _0xa55c=function(_0x1ea053,_0x22aecc){_0x1ea053=_0x1ea053-0x0;var _0x444b08=_0x55ca[_0x1ea053];return _0x444b08;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe14b,0x93));var _0xbe14=function(_0x2341ca,_0x55b639){_0x2341ca=_0x2341ca-0x0;var _0x44c530=_0xe14b[_0x2341ca];return _0x44c530;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 919effa..a1e6d85 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 _0xe14d=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','cm_lists','lodash'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xe14d,0x1ee));var _0xde14=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xe14d[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require('moment');var BPromise=require(_0xde14('0x4'));var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require(_0xde14('0x8'));module[_0xde14('0x9')]=function(_0x461af3,_0xba1514){return _0x461af3['define']('CmList',attributes,{'tableName':_0xde14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','CmList','cm_lists','lodash'];(function(_0x3defa2,_0x5e93db){var _0x506528=function(_0x28a9bd){while(--_0x28a9bd){_0x3defa2['push'](_0x3defa2['shift']());}};_0x506528(++_0x5e93db);}(_0xdace,0xc5));var _0xedac=function(_0x9729d7,_0x1b79a8){_0x9729d7=_0x9729d7-0x0;var _0x3c4ac6=_0xdace[_0x9729d7];return _0x3c4ac6;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./cmList.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index bdf4eea..5872350 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 _0xacb6=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xacb6,0x1a4));var _0x6acb=function(_0x40f8cb,_0x33c7b9){_0x40f8cb=_0x40f8cb-0x0;var _0x513a01=_0xacb6[_0x40f8cb];return _0x513a01;};'use strict';var _=require(_0x6acb('0x0'));var util=require(_0x6acb('0x1'));var moment=require('moment');var BPromise=require(_0x6acb('0x2'));var rs=require(_0x6acb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6acb('0x4'))['db'];var utils=require(_0x6acb('0x5'));var logger=require(_0x6acb('0x6'))('rpc');var config=require(_0x6acb('0x7'));var jayson=require(_0x6acb('0x8'));var client=jayson[_0x6acb('0x9')][_0x6acb('0xa')]({'port':0x232a});config[_0x6acb('0xb')]=_[_0x6acb('0xc')](config[_0x6acb('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6acb('0xd'))(new Redis(config[_0x6acb('0xb')]));require(_0x6acb('0xe'))[_0x6acb('0xf')](socket);function respondWithRpcPromise(_0x14e4d6,_0x47a6ef,_0x405d50){return new BPromise(function(_0x3fb44f,_0x58dfa3){return client[_0x6acb('0x10')](_0x14e4d6,_0x405d50)[_0x6acb('0x11')](function(_0x445342){logger[_0x6acb('0x12')](_0x6acb('0x13'),_0x47a6ef,_0x6acb('0x14'));logger['debug'](_0x6acb('0x15'),_0x47a6ef,_0x6acb('0x14'),JSON[_0x6acb('0x16')](_0x445342));if(_0x445342[_0x6acb('0x17')]){if(_0x445342[_0x6acb('0x17')][_0x6acb('0x18')]===0x1f4){logger[_0x6acb('0x17')](_0x6acb('0x13'),_0x47a6ef,_0x445342[_0x6acb('0x17')][_0x6acb('0x19')]);return _0x58dfa3(_0x445342[_0x6acb('0x17')][_0x6acb('0x19')]);}logger[_0x6acb('0x17')](_0x6acb('0x13'),_0x47a6ef,_0x445342[_0x6acb('0x17')][_0x6acb('0x19')]);return _0x3fb44f(_0x445342[_0x6acb('0x17')][_0x6acb('0x19')]);}else{logger[_0x6acb('0x12')](_0x6acb('0x13'),_0x47a6ef,_0x6acb('0x14'));_0x3fb44f(_0x445342[_0x6acb('0x1a')][_0x6acb('0x19')]);}})[_0x6acb('0x1b')](function(_0x479652){logger[_0x6acb('0x17')](_0x6acb('0x13'),_0x47a6ef,_0x479652);_0x58dfa3(_0x479652);});});} \ No newline at end of file +var _0x3b89=['localhost','socket.io-emitter','./cmList.socket','register','request','then','info','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CmList,\x20%s,\x20%s','message','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x3b89,0x167));var _0x93b8=function(_0xd03fed,_0x1bc7b1){_0xd03fed=_0xd03fed-0x0;var _0x578077=_0x3b89[_0xd03fed];return _0x578077;};'use strict';var _=require(_0x93b8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x93b8('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x93b8('0x2'))(_0x93b8('0x3'));var config=require(_0x93b8('0x4'));var jayson=require(_0x93b8('0x5'));var client=jayson[_0x93b8('0x6')][_0x93b8('0x7')]({'port':0x232a});config[_0x93b8('0x8')]=_['defaults'](config[_0x93b8('0x8')],{'host':_0x93b8('0x9'),'port':0x18eb});var socket=require(_0x93b8('0xa'))(new Redis(config['redis']));require(_0x93b8('0xb'))[_0x93b8('0xc')](socket);function respondWithRpcPromise(_0xa043ab,_0x4adea6,_0x24d266){return new BPromise(function(_0xdd8593,_0x3320df){return client[_0x93b8('0xd')](_0xa043ab,_0x24d266)[_0x93b8('0xe')](function(_0xc8ce5c){logger[_0x93b8('0xf')]('CmList,\x20%s,\x20%s',_0x4adea6,'request\x20sent');logger[_0x93b8('0x10')](_0x93b8('0x11'),_0x4adea6,_0x93b8('0x12'),JSON[_0x93b8('0x13')](_0xc8ce5c));if(_0xc8ce5c[_0x93b8('0x14')]){if(_0xc8ce5c[_0x93b8('0x14')]['code']===0x1f4){logger[_0x93b8('0x14')](_0x93b8('0x15'),_0x4adea6,_0xc8ce5c[_0x93b8('0x14')]['message']);return _0x3320df(_0xc8ce5c[_0x93b8('0x14')][_0x93b8('0x16')]);}logger[_0x93b8('0x14')](_0x93b8('0x15'),_0x4adea6,_0xc8ce5c[_0x93b8('0x14')][_0x93b8('0x16')]);return _0xdd8593(_0xc8ce5c[_0x93b8('0x14')][_0x93b8('0x16')]);}else{logger[_0x93b8('0xf')](_0x93b8('0x15'),_0x4adea6,_0x93b8('0x12'));_0xdd8593(_0xc8ce5c['result']['message']);}})['catch'](function(_0x3b13b7){logger[_0x93b8('0x14')]('CmList,\x20%s,\x20%s',_0x4adea6,_0x3b13b7);_0x3320df(_0x3b13b7);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 1d20242..d8ff287 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 _0xdcad=['save','remove','update','removeListener','register','./cmList.events'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xdcad,0x18b));var _0xddca=function(_0x341980,_0x15b300){_0x341980=_0x341980-0x0;var _0x47bba5=_0xdcad[_0x341980];return _0x47bba5;};'use strict';var CmListEvents=require(_0xddca('0x0'));var events=[_0xddca('0x1'),_0xddca('0x2'),_0xddca('0x3')];function createListener(_0x1cf8b1,_0x5714c0){return function(_0x52fb62){_0x5714c0['emit'](_0x1cf8b1,_0x52fb62);};}function removeListener(_0xf7faf8,_0x481f9e){return function(){CmListEvents[_0xddca('0x4')](_0xf7faf8,_0x481f9e);};}exports[_0xddca('0x5')]=function(_0x254072){for(var _0x5b1d75=0x0,_0x5e5a4f=events['length'];_0x5b1d75<_0x5e5a4f;_0x5b1d75++){var _0x180075=events[_0x5b1d75];var _0x5720fa=createListener('cmList:'+_0x180075,_0x254072);CmListEvents['on'](_0x180075,_0x5720fa);}}; \ No newline at end of file +var _0xf9cc=['update','emit','removeListener','cmList:','save','remove'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0xf9cc,0xa0));var _0xcf9c=function(_0x6e17f2,_0xcc4a45){_0x6e17f2=_0x6e17f2-0x0;var _0x1cc6b5=_0xf9cc[_0x6e17f2];return _0x1cc6b5;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xcf9c('0x0'),_0xcf9c('0x1'),_0xcf9c('0x2')];function createListener(_0x5e5d2d,_0x369b39){return function(_0x42937e){_0x369b39[_0xcf9c('0x3')](_0x5e5d2d,_0x42937e);};}function removeListener(_0x4eeae4,_0x32be6f){return function(){CmListEvents[_0xcf9c('0x4')](_0x4eeae4,_0x32be6f);};}exports['register']=function(_0x12e51c){for(var _0x1d3c06=0x0,_0x2ba292=events['length'];_0x1d3c06<_0x2ba292;_0x1d3c06++){var _0x303f1d=events[_0x1d3c06];var _0x405821=createListener(_0xcf9c('0x5')+_0x303f1d,_0x12e51c);CmListEvents['on'](_0x303f1d,_0x405821);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 0f4697a..1435e06 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 _0x07f5=['/:id/contacts','addContacts','addCustomField','addAgents','delete','destroy','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','get','/describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition'];(function(_0xbc4659,_0x578fba){var _0x5831f9=function(_0x5eb0eb){while(--_0x5eb0eb){_0xbc4659['push'](_0xbc4659['shift']());}};_0x5831f9(++_0x578fba);}(_0x07f5,0xc1));var _0x507f=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x07f5[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x507f('0x0'));var util=require(_0x507f('0x1'));var path=require(_0x507f('0x2'));var timeout=require(_0x507f('0x3'));var express=require(_0x507f('0x4'));var router=express[_0x507f('0x5')]();var fs_extra=require(_0x507f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x507f('0x7'));var config=require(_0x507f('0x8'));var controller=require(_0x507f('0x9'));router['get']('/',auth[_0x507f('0xa')](),controller[_0x507f('0xb')]);router[_0x507f('0xc')](_0x507f('0xd'),auth[_0x507f('0xa')](),controller['describe']);router[_0x507f('0xc')](_0x507f('0xe'),auth[_0x507f('0xa')](),controller[_0x507f('0xf')]);router['get'](_0x507f('0x10'),auth['isAuthenticated'](),controller[_0x507f('0x11')]);router['get'](_0x507f('0x12'),auth['isAuthenticated'](),controller[_0x507f('0x13')]);router['get']('/:id/contacts',auth[_0x507f('0xa')](),controller[_0x507f('0x14')]);router['get'](_0x507f('0x15'),auth[_0x507f('0xa')](),controller['getContactsCsv']);router['get'](_0x507f('0x16'),auth[_0x507f('0xa')](),controller[_0x507f('0x17')]);router[_0x507f('0xc')](_0x507f('0x18'),auth[_0x507f('0xa')](),controller[_0x507f('0x19')]);router[_0x507f('0x1a')]('/',auth['isAuthenticated'](),controller[_0x507f('0x1b')]);router[_0x507f('0x1a')](_0x507f('0x12'),auth[_0x507f('0xa')](),controller[_0x507f('0x1c')]);router[_0x507f('0x1a')](_0x507f('0x1d'),auth[_0x507f('0xa')](),controller[_0x507f('0x1e')]);router[_0x507f('0x1a')](_0x507f('0x16'),auth[_0x507f('0xa')](),controller[_0x507f('0x1f')]);router[_0x507f('0x1a')]('/:id/users',auth[_0x507f('0xa')](),controller[_0x507f('0x20')]);router['put'](_0x507f('0x10'),auth[_0x507f('0xa')](),controller['update']);router[_0x507f('0x21')](_0x507f('0x10'),auth['isAuthenticated'](),controller[_0x507f('0x22')]);router[_0x507f('0x21')](_0x507f('0x12'),auth['isAuthenticated'](),controller[_0x507f('0x23')]);router[_0x507f('0x21')](_0x507f('0x18'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x507f('0x24')]=router; \ No newline at end of file +var _0x90a8=['get','isAuthenticated','index','/describe','describe','/global_fields','/:id','show','/:id/contacts','getContacts','/:id/fields','getCustomFields','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addContacts','addAgents','put','update','delete','destroy','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller'];(function(_0x55be49,_0x2f8b5e){var _0x546b0a=function(_0x1c8758){while(--_0x1c8758){_0x55be49['push'](_0x55be49['shift']());}};_0x546b0a(++_0x2f8b5e);}(_0x90a8,0x14a));var _0x890a=function(_0x90adab,_0x5d9c77){_0x90adab=_0x90adab-0x0;var _0x255e34=_0x90a8[_0x90adab];return _0x255e34;};'use strict';var multer=require(_0x890a('0x0'));var util=require(_0x890a('0x1'));var path=require('path');var timeout=require(_0x890a('0x2'));var express=require(_0x890a('0x3'));var router=express[_0x890a('0x4')]();var fs_extra=require(_0x890a('0x5'));var auth=require(_0x890a('0x6'));var interaction=require(_0x890a('0x7'));var config=require(_0x890a('0x8'));var controller=require(_0x890a('0x9'));router[_0x890a('0xa')]('/',auth[_0x890a('0xb')](),controller[_0x890a('0xc')]);router['get'](_0x890a('0xd'),auth[_0x890a('0xb')](),controller[_0x890a('0xe')]);router[_0x890a('0xa')](_0x890a('0xf'),auth['isAuthenticated'](),controller['getGlobalCustomFields']);router['get'](_0x890a('0x10'),auth[_0x890a('0xb')](),controller[_0x890a('0x11')]);router[_0x890a('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0x890a('0xa')](_0x890a('0x12'),auth[_0x890a('0xb')](),controller[_0x890a('0x13')]);router[_0x890a('0xa')]('/:id/contacts/csv',auth[_0x890a('0xb')](),controller['getContactsCsv']);router['get'](_0x890a('0x14'),auth[_0x890a('0xb')](),controller[_0x890a('0x15')]);router[_0x890a('0xa')](_0x890a('0x16'),auth[_0x890a('0xb')](),controller[_0x890a('0x17')]);router[_0x890a('0x18')]('/',auth[_0x890a('0xb')](),controller['create']);router[_0x890a('0x18')](_0x890a('0x19'),auth[_0x890a('0xb')](),controller[_0x890a('0x1a')]);router['post'](_0x890a('0x12'),auth[_0x890a('0xb')](),controller[_0x890a('0x1b')]);router['post'](_0x890a('0x14'),auth[_0x890a('0xb')](),controller['addCustomField']);router[_0x890a('0x18')](_0x890a('0x16'),auth[_0x890a('0xb')](),controller[_0x890a('0x1c')]);router[_0x890a('0x1d')](_0x890a('0x10'),auth['isAuthenticated'](),controller[_0x890a('0x1e')]);router[_0x890a('0x1f')]('/:id',auth[_0x890a('0xb')](),controller[_0x890a('0x20')]);router['delete'](_0x890a('0x19'),auth[_0x890a('0xb')](),controller['removeDispositions']);router[_0x890a('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x890a('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index f304568..d53dafa 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 _0x3740=['getDataValue','STRING','sequelize','exports','VIRTUAL'];(function(_0x388e05,_0x1abd90){var _0x4c32c2=function(_0x221be6){while(--_0x221be6){_0x388e05['push'](_0x388e05['shift']());}};_0x4c32c2(++_0x1abd90);}(_0x3740,0x110));var _0x0374=function(_0x39e15b,_0x555185){_0x39e15b=_0x39e15b-0x0;var _0x4e5766=_0x3740[_0x39e15b];return _0x4e5766;};'use strict';var Sequelize=require(_0x0374('0x0'));module[_0x0374('0x1')]={'name':{'type':Sequelize[_0x0374('0x2')],'get':function(_0x2d7ba1){return this[_0x0374('0x3')]('field');}},'field':{'type':Sequelize[_0x0374('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x0374('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x465a=['sequelize','getDataValue','field','STRING'];(function(_0x425687,_0x163f19){var _0x212ea0=function(_0x1be563){while(--_0x1be563){_0x425687['push'](_0x425687['shift']());}};_0x212ea0(++_0x163f19);}(_0x465a,0x17c));var _0xa465=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x465a[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xa465('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5c9ab6){return this[_0xa465('0x1')](_0xa465('0x2'));}},'field':{'type':Sequelize[_0xa465('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xa465('0x3')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 6d75316..ce81790 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x7a76d4,_0x43d4cf){var _0x2dc552=function(_0x4c3d90){while(--_0x4c3d90){_0x7a76d4['push'](_0x7a76d4['shift']());}};_0x2dc552(++_0x43d4cf);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x2f1118,_0x5847f4){var _0xb33924=function(_0x27eb6d){while(--_0x27eb6d){_0x2f1118['push'](_0x2f1118['shift']());}};_0xb33924(++_0x5847f4);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index dfa7f0b..0a848ca 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 _0xe742=['./condition.attributes','exports','define','Condition','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x19bf8e,_0xa313b5){var _0x2f9a63=function(_0x378684){while(--_0x378684){_0x19bf8e['push'](_0x19bf8e['shift']());}};_0x2f9a63(++_0xa313b5);}(_0xe742,0xba));var _0x2e74=function(_0x46e01a,_0x5bc8e8){_0x46e01a=_0x46e01a-0x0;var _0x12b79b=_0xe742[_0x46e01a];return _0x12b79b;};'use strict';var _=require(_0x2e74('0x0'));var util=require(_0x2e74('0x1'));var logger=require(_0x2e74('0x2'))(_0x2e74('0x3'));var moment=require(_0x2e74('0x4'));var BPromise=require(_0x2e74('0x5'));var rp=require(_0x2e74('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e74('0x7'));var config=require(_0x2e74('0x8'));var attributes=require(_0x2e74('0x9'));module[_0x2e74('0xa')]=function(_0x1b58a5,_0x3148fb){return _0x1b58a5[_0x2e74('0xb')](_0x2e74('0xc'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x379e=['moment','bluebird','request-promise','rimraf','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util'];(function(_0x4dca4f,_0x3d3989){var _0xb1f24e=function(_0x125f21){while(--_0x125f21){_0x4dca4f['push'](_0x4dca4f['shift']());}};_0xb1f24e(++_0x3d3989);}(_0x379e,0xfb));var _0xe379=function(_0x22fdce,_0x14d1b3){_0x22fdce=_0x22fdce-0x0;var _0x32afaa=_0x379e[_0x22fdce];return _0x32afaa;};'use strict';var _=require(_0xe379('0x0'));var util=require(_0xe379('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe379('0x2'));var BPromise=require(_0xe379('0x3'));var rp=require(_0xe379('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe379('0x5'));var config=require('../../config/environment');var attributes=require(_0xe379('0x6'));module[_0xe379('0x7')]=function(_0x4be52b,_0x14d5f4){return _0x4be52b[_0xe379('0x8')](_0xe379('0x9'),attributes,{'tableName':_0xe379('0xa'),'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 8f99a6b..b01449f 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 _0xbcd2=['result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x55e4cf,_0x1ec447){var _0x226caa=function(_0x33ad97){while(--_0x33ad97){_0x55e4cf['push'](_0x55e4cf['shift']());}};_0x226caa(++_0x1ec447);}(_0xbcd2,0x113));var _0x2bcd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2bcd('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2bcd('0x1'));var db=require(_0x2bcd('0x2'))['db'];var utils=require(_0x2bcd('0x3'));var logger=require(_0x2bcd('0x4'))(_0x2bcd('0x5'));var config=require(_0x2bcd('0x6'));var jayson=require(_0x2bcd('0x7'));var client=jayson[_0x2bcd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a66b0,_0x39da44,_0x3ed921){return new BPromise(function(_0x2cac74,_0x2300d6){return client[_0x2bcd('0x9')](_0x4a66b0,_0x3ed921)[_0x2bcd('0xa')](function(_0x512655){logger['info'](_0x2bcd('0xb'),_0x39da44,_0x2bcd('0xc'));logger[_0x2bcd('0xd')](_0x2bcd('0xe'),_0x39da44,'request\x20sent',JSON[_0x2bcd('0xf')](_0x512655));if(_0x512655[_0x2bcd('0x10')]){if(_0x512655[_0x2bcd('0x10')][_0x2bcd('0x11')]===0x1f4){logger[_0x2bcd('0x10')]('Condition,\x20%s,\x20%s',_0x39da44,_0x512655['error'][_0x2bcd('0x12')]);return _0x2300d6(_0x512655[_0x2bcd('0x10')][_0x2bcd('0x12')]);}logger['error'](_0x2bcd('0xb'),_0x39da44,_0x512655['error']['message']);return _0x2cac74(_0x512655['error'][_0x2bcd('0x12')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x39da44,'request\x20sent');_0x2cac74(_0x512655[_0x2bcd('0x13')][_0x2bcd('0x12')]);}})[_0x2bcd('0x14')](function(_0x53d6dc){logger['error']('Condition,\x20%s,\x20%s',_0x39da44,_0x53d6dc);_0x2300d6(_0x53d6dc);});});} \ No newline at end of file +var _0x0a45=['request','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Condition,\x20%s,\x20%s','result','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2d4df7,_0x150be3){var _0x16ae27=function(_0x243377){while(--_0x243377){_0x2d4df7['push'](_0x2d4df7['shift']());}};_0x16ae27(++_0x150be3);}(_0x0a45,0x118));var _0x50a4=function(_0x5397c,_0x1b9051){_0x5397c=_0x5397c-0x0;var _0xf78f54=_0x0a45[_0x5397c];return _0xf78f54;};'use strict';var _=require(_0x50a4('0x0'));var util=require(_0x50a4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50a4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x50a4('0x3'));var logger=require(_0x50a4('0x4'))(_0x50a4('0x5'));var config=require(_0x50a4('0x6'));var jayson=require(_0x50a4('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x404c70,_0x1a2a7e,_0x3bf333){return new BPromise(function(_0x38257e,_0x59aba3){return client[_0x50a4('0x8')](_0x404c70,_0x3bf333)['then'](function(_0x5da3d5){logger['info']('Condition,\x20%s,\x20%s',_0x1a2a7e,_0x50a4('0x9'));logger[_0x50a4('0xa')](_0x50a4('0xb'),_0x1a2a7e,_0x50a4('0x9'),JSON[_0x50a4('0xc')](_0x5da3d5));if(_0x5da3d5[_0x50a4('0xd')]){if(_0x5da3d5[_0x50a4('0xd')][_0x50a4('0xe')]===0x1f4){logger[_0x50a4('0xd')]('Condition,\x20%s,\x20%s',_0x1a2a7e,_0x5da3d5['error'][_0x50a4('0xf')]);return _0x59aba3(_0x5da3d5[_0x50a4('0xd')]['message']);}logger[_0x50a4('0xd')](_0x50a4('0x10'),_0x1a2a7e,_0x5da3d5['error']['message']);return _0x38257e(_0x5da3d5[_0x50a4('0xd')][_0x50a4('0xf')]);}else{logger['info'](_0x50a4('0x10'),_0x1a2a7e,'request\x20sent');_0x38257e(_0x5da3d5[_0x50a4('0x11')][_0x50a4('0xf')]);}})['catch'](function(_0x4b1576){logger['error'](_0x50a4('0x10'),_0x1a2a7e,_0x4b1576);_0x59aba3(_0x4b1576);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 41c5c69..5606a56 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 _0x5ded=['express','Router','fs-extra','../../components/interaction/service','./condition.controller','/:id','update','delete','isAuthenticated','destroy','exports','multer','util','path','connect-timeout'];(function(_0x393bf5,_0x225cac){var _0xcb023=function(_0x4e671d){while(--_0x4e671d){_0x393bf5['push'](_0x393bf5['shift']());}};_0xcb023(++_0x225cac);}(_0x5ded,0x146));var _0xd5de=function(_0x5c0335,_0x22f68c){_0x5c0335=_0x5c0335-0x0;var _0x9a7571=_0x5ded[_0x5c0335];return _0x9a7571;};'use strict';var multer=require(_0xd5de('0x0'));var util=require(_0xd5de('0x1'));var path=require(_0xd5de('0x2'));var timeout=require(_0xd5de('0x3'));var express=require(_0xd5de('0x4'));var router=express[_0xd5de('0x5')]();var fs_extra=require(_0xd5de('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd5de('0x7'));var config=require('../../config/environment');var controller=require(_0xd5de('0x8'));router['put'](_0xd5de('0x9'),auth['isAuthenticated'](),controller[_0xd5de('0xa')]);router[_0xd5de('0xb')](_0xd5de('0x9'),auth[_0xd5de('0xc')](),controller[_0xd5de('0xd')]);module[_0xd5de('0xe')]=router; \ No newline at end of file +var _0x0eb2=['Router','fs-extra','../../components/interaction/service','/:id','isAuthenticated','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x10fc4d,_0x384abd){var _0x439538=function(_0x5aa3c0){while(--_0x5aa3c0){_0x10fc4d['push'](_0x10fc4d['shift']());}};_0x439538(++_0x384abd);}(_0x0eb2,0x11c));var _0x20eb=function(_0x3fde5f,_0xd4a28d){_0x3fde5f=_0x3fde5f-0x0;var _0x10adc2=_0x0eb2[_0x3fde5f];return _0x10adc2;};'use strict';var multer=require(_0x20eb('0x0'));var util=require('util');var path=require(_0x20eb('0x1'));var timeout=require(_0x20eb('0x2'));var express=require(_0x20eb('0x3'));var router=express[_0x20eb('0x4')]();var fs_extra=require(_0x20eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x20eb('0x6'));var config=require('../../config/environment');var controller=require('./condition.controller');router['put'](_0x20eb('0x7'),auth[_0x20eb('0x8')](),controller[_0x20eb('0x9')]);router['delete'](_0x20eb('0x7'),auth[_0x20eb('0x8')](),controller[_0x20eb('0xa')]);module[_0x20eb('0xb')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 414ed2e..297f350 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 _0x26bc=['INTEGER','exports','STRING','name'];(function(_0x12234f,_0x324959){var _0x3badac=function(_0x2d6a37){while(--_0x2d6a37){_0x12234f['push'](_0x12234f['shift']());}};_0x3badac(++_0x324959);}(_0x26bc,0x111));var _0xc26b=function(_0x54074b,_0x15564f){_0x54074b=_0x54074b-0x0;var _0x868537=_0x26bc[_0x54074b];return _0x868537;};'use strict';var Sequelize=require('sequelize');module[_0xc26b('0x0')]={'name':{'type':Sequelize[_0xc26b('0x1')],'allowNull':![],'unique':_0xc26b('0x2')},'OrderBy':{'type':Sequelize[_0xc26b('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x2b5f=['sequelize','exports','STRING','name','INTEGER'];(function(_0x2d068b,_0x54caf4){var _0x52f59f=function(_0x16540e){while(--_0x16540e){_0x2d068b['push'](_0x2d068b['shift']());}};_0x52f59f(++_0x54caf4);}(_0x2b5f,0x118));var _0xf2b5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2b5f[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xf2b5('0x0'));module[_0xf2b5('0x1')]={'name':{'type':Sequelize[_0xf2b5('0x2')],'allowNull':![],'unique':_0xf2b5('0x3')},'OrderBy':{'type':Sequelize[_0xf2b5('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xf2b5('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 ae483ae..ac9415e 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 _0xfcbb=['find','create','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContactHasItem','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','index','map','ContactItemType','fieldName','type','key','query','keys','filters','intersection','model','fields','length','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes'];(function(_0xb8c1bf,_0x1902f3){var _0x4350a8=function(_0x1908bf){while(--_0x1908bf){_0xb8c1bf['push'](_0xb8c1bf['shift']());}};_0x4350a8(++_0x1902f3);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x3ebe08,_0x19098d){_0x3ebe08=_0x3ebe08-0x0;var _0x20c8a8=_0xfcbb[_0x3ebe08];return _0x20c8a8;};'use strict';var emlformat=require(_0xbfcb('0x0'));var rimraf=require(_0xbfcb('0x1'));var zipdir=require(_0xbfcb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbfcb('0x3'));var BPromise=require(_0xbfcb('0x4'));var Mustache=require(_0xbfcb('0x5'));var util=require(_0xbfcb('0x6'));var path=require(_0xbfcb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbfcb('0x8'));var fs=require('fs');var fs_extra=require(_0xbfcb('0x9'));var _=require(_0xbfcb('0xa'));var squel=require(_0xbfcb('0xb'));var crypto=require(_0xbfcb('0xc'));var jsforce=require(_0xbfcb('0xd'));var deskjs=require(_0xbfcb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbfcb('0xf'));var Papa=require(_0xbfcb('0x10'));var Redis=require(_0xbfcb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbfcb('0x12'));var as=require(_0xbfcb('0x13'));var hardwareService=require(_0xbfcb('0x14'));var logger=require(_0xbfcb('0x15'))(_0xbfcb('0x16'));var utils=require(_0xbfcb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbfcb('0x18'));var db=require(_0xbfcb('0x19'))['db'];function respondWithStatusCode(_0xb2f601,_0x2268da){_0x2268da=_0x2268da||0xcc;return function(_0x4ba4f1){if(_0x4ba4f1){return _0xb2f601[_0xbfcb('0x1a')](_0x2268da);}return _0xb2f601['status'](_0x2268da)[_0xbfcb('0x1b')]();};}function respondWithResult(_0x1c52df,_0x44ad6c){_0x44ad6c=_0x44ad6c||0xc8;return function(_0x1047c4){if(_0x1047c4){return _0x1c52df[_0xbfcb('0x1c')](_0x44ad6c)[_0xbfcb('0x1d')](_0x1047c4);}};}function respondWithFilteredResult(_0x71304e,_0x2d314a){return function(_0x90ed8c){if(_0x90ed8c){var _0x339347=typeof _0x2d314a[_0xbfcb('0x1e')]===_0xbfcb('0x1f')&&typeof _0x2d314a[_0xbfcb('0x20')]===_0xbfcb('0x1f');var _0x318d07=_0x90ed8c[_0xbfcb('0x21')];var _0xba1d6=_0x339347?0x0:_0x2d314a[_0xbfcb('0x1e')];var _0x3404aa=_0x339347?_0x90ed8c[_0xbfcb('0x21')]:_0x2d314a[_0xbfcb('0x1e')]+_0x2d314a[_0xbfcb('0x20')];var _0x53c9e0;if(_0x3404aa>=_0x318d07){_0x3404aa=_0x318d07;_0x53c9e0=0xc8;}else{_0x53c9e0=0xce;}_0x71304e[_0xbfcb('0x1c')](_0x53c9e0);return _0x71304e[_0xbfcb('0x22')]('Content-Range',_0xba1d6+'-'+_0x3404aa+'/'+_0x318d07)[_0xbfcb('0x1d')](_0x90ed8c);}return null;};}function patchUpdates(_0x1a7225){return function(_0x48c3c8){try{jsonpatch['apply'](_0x48c3c8,_0x1a7225,!![]);}catch(_0x4199c5){return BPromise[_0xbfcb('0x23')](_0x4199c5);}return _0x48c3c8[_0xbfcb('0x24')]();};}function saveUpdates(_0x45661a,_0x1c5924){return function(_0x56c158){if(_0x56c158){return _0x56c158[_0xbfcb('0x25')](_0x45661a)[_0xbfcb('0x26')](function(_0x2d9288){return _0x2d9288;});}return null;};}function removeEntity(_0xd4d29,_0x1651e5){return function(_0x19616c){if(_0x19616c){return _0x19616c[_0xbfcb('0x27')]()[_0xbfcb('0x26')](function(){var _0x11f6f7=_0x19616c[_0xbfcb('0x28')]({'plain':!![]});var _0x1ca8c3=_0xbfcb('0x29');return db[_0xbfcb('0x2a')][_0xbfcb('0x27')]({'where':{'type':_0x1ca8c3,'resourceId':_0x11f6f7['id']}})[_0xbfcb('0x26')](function(){return _0x19616c;});})[_0xbfcb('0x26')](function(){_0xd4d29['status'](0xcc)[_0xbfcb('0x1b')]();});}};}function handleEntityNotFound(_0x2881f8,_0x4cf7ca){return function(_0x64a69){if(!_0x64a69){_0x2881f8[_0xbfcb('0x1a')](0x194);}return _0x64a69;};}function handleError(_0x781773,_0xa57d71){_0xa57d71=_0xa57d71||0x1f4;return function(_0xf4b944){logger[_0xbfcb('0x2b')](_0xf4b944[_0xbfcb('0x2c')]);if(_0xf4b944[_0xbfcb('0x2d')]){delete _0xf4b944[_0xbfcb('0x2d')];}_0x781773[_0xbfcb('0x1c')](_0xa57d71)['send'](_0xf4b944);};}exports[_0xbfcb('0x2e')]=function(_0x3aa3cd,_0x43c3c3){var _0x43de3c={},_0x1f45fc={},_0x14f6f5={'count':0x0,'rows':[]};var _0x286fb7=_[_0xbfcb('0x2f')](db[_0xbfcb('0x30')]['rawAttributes'],function(_0x297f72){return{'name':_0x297f72[_0xbfcb('0x31')],'type':_0x297f72[_0xbfcb('0x32')][_0xbfcb('0x33')]};});_0x1f45fc['model']=_['map'](_0x286fb7,_0xbfcb('0x2d'));_0x1f45fc[_0xbfcb('0x34')]=_[_0xbfcb('0x35')](_0x3aa3cd[_0xbfcb('0x34')]);_0x1f45fc[_0xbfcb('0x36')]=_[_0xbfcb('0x37')](_0x1f45fc[_0xbfcb('0x38')],_0x1f45fc['query']);_0x43de3c['attributes']=_['intersection'](_0x1f45fc[_0xbfcb('0x38')],qs['fields'](_0x3aa3cd[_0xbfcb('0x34')][_0xbfcb('0x39')]));_0x43de3c['attributes']=_0x43de3c['attributes'][_0xbfcb('0x3a')]?_0x43de3c[_0xbfcb('0x3b')]:_0x1f45fc[_0xbfcb('0x38')];if(!_0x3aa3cd[_0xbfcb('0x34')]['hasOwnProperty'](_0xbfcb('0x3c'))){_0x43de3c[_0xbfcb('0x20')]=qs['limit'](_0x3aa3cd['query'][_0xbfcb('0x20')]);_0x43de3c['offset']=qs['offset'](_0x3aa3cd[_0xbfcb('0x34')][_0xbfcb('0x1e')]);}_0x43de3c[_0xbfcb('0x3d')]=qs[_0xbfcb('0x3e')](_0x3aa3cd['query'][_0xbfcb('0x3e')]);_0x43de3c[_0xbfcb('0x3f')]=qs[_0xbfcb('0x36')](_[_0xbfcb('0x40')](_0x3aa3cd[_0xbfcb('0x34')],_0x1f45fc[_0xbfcb('0x36')]),_0x286fb7);if(_0x3aa3cd['query'][_0xbfcb('0x41')]){_0x43de3c['where']=_[_0xbfcb('0x42')](_0x43de3c['where'],{'$or':_[_0xbfcb('0x2f')](_0x286fb7,function(_0x2e4406){if(_0x2e4406[_0xbfcb('0x32')]!==_0xbfcb('0x43')){var _0x434fcd={};_0x434fcd[_0x2e4406[_0xbfcb('0x2d')]]={'$like':'%'+_0x3aa3cd[_0xbfcb('0x34')][_0xbfcb('0x41')]+'%'};return _0x434fcd;}})});}_0x43de3c=_[_0xbfcb('0x42')]({},_0x43de3c,_0x3aa3cd[_0xbfcb('0x44')]);var _0x55a95f={'where':_0x43de3c[_0xbfcb('0x3f')]};return db[_0xbfcb('0x30')]['count'](_0x55a95f)[_0xbfcb('0x26')](function(_0x306ea4){_0x14f6f5[_0xbfcb('0x21')]=_0x306ea4;if(_0x3aa3cd[_0xbfcb('0x34')][_0xbfcb('0x45')]){_0x43de3c[_0xbfcb('0x46')]=[{'all':!![]}];}return db['ContactItemType'][_0xbfcb('0x47')](_0x43de3c);})[_0xbfcb('0x26')](function(_0x10ea4f){_0x14f6f5['rows']=_0x10ea4f;return _0x14f6f5;})[_0xbfcb('0x26')](respondWithFilteredResult(_0x43c3c3,_0x43de3c))[_0xbfcb('0x48')](handleError(_0x43c3c3,null));};exports[_0xbfcb('0x49')]=function(_0x542d90,_0x5aa9c9){var _0xd7cb39={'raw':!![],'where':{'id':_0x542d90['params']['id']}},_0x58337d={};_0x58337d[_0xbfcb('0x38')]=_[_0xbfcb('0x35')](db['ContactItemType'][_0xbfcb('0x4a')]);_0x58337d[_0xbfcb('0x34')]=_['keys'](_0x542d90[_0xbfcb('0x34')]);_0x58337d[_0xbfcb('0x36')]=_[_0xbfcb('0x37')](_0x58337d[_0xbfcb('0x38')],_0x58337d[_0xbfcb('0x34')]);_0xd7cb39[_0xbfcb('0x3b')]=_[_0xbfcb('0x37')](_0x58337d[_0xbfcb('0x38')],qs[_0xbfcb('0x39')](_0x542d90[_0xbfcb('0x34')][_0xbfcb('0x39')]));_0xd7cb39[_0xbfcb('0x3b')]=_0xd7cb39['attributes'][_0xbfcb('0x3a')]?_0xd7cb39[_0xbfcb('0x3b')]:_0x58337d[_0xbfcb('0x38')];if(_0x542d90['query'][_0xbfcb('0x45')]){_0xd7cb39['include']=[{'all':!![]}];}_0xd7cb39=_['merge']({},_0xd7cb39,_0x542d90[_0xbfcb('0x44')]);return db[_0xbfcb('0x30')][_0xbfcb('0x4b')](_0xd7cb39)['then'](handleEntityNotFound(_0x5aa9c9,null))[_0xbfcb('0x26')](respondWithResult(_0x5aa9c9,null))['catch'](handleError(_0x5aa9c9,null));};exports['create']=function(_0x33725a,_0x588d32){return db[_0xbfcb('0x30')][_0xbfcb('0x4c')](_0x33725a['body'],{})[_0xbfcb('0x26')](function(_0x5d942f){var _0x8347be=_0x33725a['user'][_0xbfcb('0x28')]({'plain':!![]});if(!_0x8347be)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8347be[_0xbfcb('0x4d')]===_0xbfcb('0x4e')){var _0x5efbe1=_0x5d942f[_0xbfcb('0x28')]({'plain':!![]});var _0x547169='ContactItemTypes';return db[_0xbfcb('0x4f')][_0xbfcb('0x4b')]({'where':{'name':_0x547169,'userProfileId':_0x8347be[_0xbfcb('0x50')]},'raw':!![]})['then'](function(_0x495c34){if(_0x495c34&&_0x495c34[_0xbfcb('0x51')]===0x0){return db[_0xbfcb('0x2a')][_0xbfcb('0x4c')]({'name':_0x5efbe1[_0xbfcb('0x2d')],'resourceId':_0x5efbe1['id'],'type':_0x495c34[_0xbfcb('0x2d')],'sectionId':_0x495c34['id']},{})['then'](function(){return _0x5d942f;});}else{return _0x5d942f;}})[_0xbfcb('0x48')](function(_0x37a7e8){logger[_0xbfcb('0x2b')](_0xbfcb('0x52'),_0x37a7e8);throw _0x37a7e8;});}return _0x5d942f;})['then'](respondWithResult(_0x588d32,0xc9))['catch'](handleError(_0x588d32,null));};exports[_0xbfcb('0x25')]=function(_0x50f9f7,_0x9cc2bd){if(_0x50f9f7['body']['id']){delete _0x50f9f7['body']['id'];}return db[_0xbfcb('0x30')]['find']({'where':{'id':_0x50f9f7['params']['id']}})[_0xbfcb('0x26')](handleEntityNotFound(_0x9cc2bd,null))['then'](saveUpdates(_0x50f9f7[_0xbfcb('0x53')],null))['then'](respondWithResult(_0x9cc2bd,null))[_0xbfcb('0x48')](handleError(_0x9cc2bd,null));};exports[_0xbfcb('0x27')]=function(_0x593f4e,_0x35cd27){return db[_0xbfcb('0x30')][_0xbfcb('0x4b')]({'where':{'id':_0x593f4e['params']['id']}})[_0xbfcb('0x26')](handleEntityNotFound(_0x35cd27,null))[_0xbfcb('0x26')](db[_0xbfcb('0x54')][_0xbfcb('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x593f4e[_0xbfcb('0x55')]['id']}}))[_0xbfcb('0x26')](removeEntity(_0x35cd27,null))[_0xbfcb('0x48')](handleError(_0x35cd27,null));}; \ No newline at end of file +var _0x4888=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ContactItemType','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4f4c2a,_0x5f5a28){var _0xd15be6=function(_0x1bc725){while(--_0x1bc725){_0x4f4c2a['push'](_0x4f4c2a['shift']());}};_0xd15be6(++_0x5f5a28);}(_0x4888,0x198));var _0x8488=function(_0x4c7892,_0x1c2cb0){_0x4c7892=_0x4c7892-0x0;var _0x2a79c8=_0x4888[_0x4c7892];return _0x2a79c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14462e,_0x3d1f7a){_0x3d1f7a=_0x3d1f7a||0xcc;return function(_0x58f83d){if(_0x58f83d){return _0x14462e['sendStatus'](_0x3d1f7a);}return _0x14462e[_0x8488('0x17')](_0x3d1f7a)['end']();};}function respondWithResult(_0x214083,_0x4e94fc){_0x4e94fc=_0x4e94fc||0xc8;return function(_0x5161a3){if(_0x5161a3){return _0x214083[_0x8488('0x17')](_0x4e94fc)[_0x8488('0x18')](_0x5161a3);}};}function respondWithFilteredResult(_0x5700b,_0x2bcb7c){return function(_0x3b3cfa){if(_0x3b3cfa){var _0x8d3b3d=typeof _0x2bcb7c[_0x8488('0x19')]==='undefined'&&typeof _0x2bcb7c[_0x8488('0x1a')]===_0x8488('0x1b');var _0x3edfe4=_0x3b3cfa[_0x8488('0x1c')];var _0x60ae2f=_0x8d3b3d?0x0:_0x2bcb7c[_0x8488('0x19')];var _0x1aedb1=_0x8d3b3d?_0x3b3cfa[_0x8488('0x1c')]:_0x2bcb7c[_0x8488('0x19')]+_0x2bcb7c[_0x8488('0x1a')];var _0x10bfd6;if(_0x1aedb1>=_0x3edfe4){_0x1aedb1=_0x3edfe4;_0x10bfd6=0xc8;}else{_0x10bfd6=0xce;}_0x5700b[_0x8488('0x17')](_0x10bfd6);return _0x5700b[_0x8488('0x1d')]('Content-Range',_0x60ae2f+'-'+_0x1aedb1+'/'+_0x3edfe4)['json'](_0x3b3cfa);}return null;};}function patchUpdates(_0x340d6b){return function(_0x12d40f){try{jsonpatch[_0x8488('0x1e')](_0x12d40f,_0x340d6b,!![]);}catch(_0x3c9fc2){return BPromise[_0x8488('0x1f')](_0x3c9fc2);}return _0x12d40f[_0x8488('0x20')]();};}function saveUpdates(_0x43b672,_0x3c078c){return function(_0x39dd43){if(_0x39dd43){return _0x39dd43['update'](_0x43b672)[_0x8488('0x21')](function(_0x4e07e1){return _0x4e07e1;});}return null;};}function removeEntity(_0x140b0b,_0x1361a6){return function(_0x290b33){if(_0x290b33){return _0x290b33['destroy']()['then'](function(){var _0x5b8885=_0x290b33['get']({'plain':!![]});var _0x472624='ContactItemTypes';return db['UserProfileResource'][_0x8488('0x22')]({'where':{'type':_0x472624,'resourceId':_0x5b8885['id']}})[_0x8488('0x21')](function(){return _0x290b33;});})[_0x8488('0x21')](function(){_0x140b0b[_0x8488('0x17')](0xcc)[_0x8488('0x23')]();});}};}function handleEntityNotFound(_0x503b83,_0x1b0519){return function(_0x38c137){if(!_0x38c137){_0x503b83[_0x8488('0x24')](0x194);}return _0x38c137;};}function handleError(_0x3df1f9,_0x460001){_0x460001=_0x460001||0x1f4;return function(_0x27f5cf){logger[_0x8488('0x25')](_0x27f5cf[_0x8488('0x26')]);if(_0x27f5cf[_0x8488('0x27')]){delete _0x27f5cf[_0x8488('0x27')];}_0x3df1f9[_0x8488('0x17')](_0x460001)['send'](_0x27f5cf);};}exports['index']=function(_0x4e3fe2,_0x292fe8){var _0x408c36={},_0x19cf42={},_0x121dcc={'count':0x0,'rows':[]};var _0x117321=_[_0x8488('0x28')](db['ContactItemType'][_0x8488('0x29')],function(_0x14f378){return{'name':_0x14f378[_0x8488('0x2a')],'type':_0x14f378[_0x8488('0x2b')][_0x8488('0x2c')]};});_0x19cf42['model']=_[_0x8488('0x28')](_0x117321,_0x8488('0x27'));_0x19cf42['query']=_[_0x8488('0x2d')](_0x4e3fe2[_0x8488('0x2e')]);_0x19cf42[_0x8488('0x2f')]=_[_0x8488('0x30')](_0x19cf42[_0x8488('0x31')],_0x19cf42['query']);_0x408c36[_0x8488('0x32')]=_[_0x8488('0x30')](_0x19cf42[_0x8488('0x31')],qs['fields'](_0x4e3fe2[_0x8488('0x2e')]['fields']));_0x408c36[_0x8488('0x32')]=_0x408c36[_0x8488('0x32')][_0x8488('0x33')]?_0x408c36[_0x8488('0x32')]:_0x19cf42['model'];if(!_0x4e3fe2[_0x8488('0x2e')][_0x8488('0x34')](_0x8488('0x35'))){_0x408c36['limit']=qs[_0x8488('0x1a')](_0x4e3fe2[_0x8488('0x2e')][_0x8488('0x1a')]);_0x408c36[_0x8488('0x19')]=qs[_0x8488('0x19')](_0x4e3fe2[_0x8488('0x2e')][_0x8488('0x19')]);}_0x408c36[_0x8488('0x36')]=qs[_0x8488('0x37')](_0x4e3fe2[_0x8488('0x2e')][_0x8488('0x37')]);_0x408c36['where']=qs['filters'](_[_0x8488('0x38')](_0x4e3fe2[_0x8488('0x2e')],_0x19cf42[_0x8488('0x2f')]),_0x117321);if(_0x4e3fe2[_0x8488('0x2e')][_0x8488('0x39')]){_0x408c36[_0x8488('0x3a')]=_[_0x8488('0x3b')](_0x408c36[_0x8488('0x3a')],{'$or':_[_0x8488('0x28')](_0x117321,function(_0x5f561c){if(_0x5f561c[_0x8488('0x2b')]!==_0x8488('0x3c')){var _0x11a258={};_0x11a258[_0x5f561c['name']]={'$like':'%'+_0x4e3fe2[_0x8488('0x2e')][_0x8488('0x39')]+'%'};return _0x11a258;}})});}_0x408c36=_[_0x8488('0x3b')]({},_0x408c36,_0x4e3fe2[_0x8488('0x3d')]);var _0x44d5f2={'where':_0x408c36[_0x8488('0x3a')]};return db[_0x8488('0x3e')]['count'](_0x44d5f2)[_0x8488('0x21')](function(_0x1c33a1){_0x121dcc[_0x8488('0x1c')]=_0x1c33a1;if(_0x4e3fe2['query'][_0x8488('0x3f')]){_0x408c36['include']=[{'all':!![]}];}return db[_0x8488('0x3e')][_0x8488('0x40')](_0x408c36);})['then'](function(_0x22a3f3){_0x121dcc[_0x8488('0x41')]=_0x22a3f3;return _0x121dcc;})[_0x8488('0x21')](respondWithFilteredResult(_0x292fe8,_0x408c36))[_0x8488('0x42')](handleError(_0x292fe8,null));};exports[_0x8488('0x43')]=function(_0x4e5c83,_0x3724be){var _0x50c31d={'raw':!![],'where':{'id':_0x4e5c83[_0x8488('0x44')]['id']}},_0x3440ae={};_0x3440ae[_0x8488('0x31')]=_[_0x8488('0x2d')](db[_0x8488('0x3e')][_0x8488('0x29')]);_0x3440ae[_0x8488('0x2e')]=_[_0x8488('0x2d')](_0x4e5c83[_0x8488('0x2e')]);_0x3440ae[_0x8488('0x2f')]=_[_0x8488('0x30')](_0x3440ae[_0x8488('0x31')],_0x3440ae[_0x8488('0x2e')]);_0x50c31d[_0x8488('0x32')]=_[_0x8488('0x30')](_0x3440ae[_0x8488('0x31')],qs[_0x8488('0x45')](_0x4e5c83['query'][_0x8488('0x45')]));_0x50c31d[_0x8488('0x32')]=_0x50c31d[_0x8488('0x32')][_0x8488('0x33')]?_0x50c31d['attributes']:_0x3440ae[_0x8488('0x31')];if(_0x4e5c83[_0x8488('0x2e')][_0x8488('0x3f')]){_0x50c31d[_0x8488('0x46')]=[{'all':!![]}];}_0x50c31d=_['merge']({},_0x50c31d,_0x4e5c83[_0x8488('0x3d')]);return db[_0x8488('0x3e')][_0x8488('0x47')](_0x50c31d)[_0x8488('0x21')](handleEntityNotFound(_0x3724be,null))[_0x8488('0x21')](respondWithResult(_0x3724be,null))[_0x8488('0x42')](handleError(_0x3724be,null));};exports[_0x8488('0x48')]=function(_0x299d8e,_0x1bc2e1){return db[_0x8488('0x3e')][_0x8488('0x48')](_0x299d8e[_0x8488('0x49')],{})[_0x8488('0x21')](function(_0x58b319){var _0x56bc65=_0x299d8e[_0x8488('0x4a')][_0x8488('0x4b')]({'plain':!![]});if(!_0x56bc65)throw new Error(_0x8488('0x4c'));if(_0x56bc65[_0x8488('0x4d')]===_0x8488('0x4a')){var _0x22d22c=_0x58b319[_0x8488('0x4b')]({'plain':!![]});var _0x27dfd2=_0x8488('0x4e');return db['UserProfileSection'][_0x8488('0x47')]({'where':{'name':_0x27dfd2,'userProfileId':_0x56bc65[_0x8488('0x4f')]},'raw':!![]})['then'](function(_0x35e08a){if(_0x35e08a&&_0x35e08a[_0x8488('0x50')]===0x0){return db[_0x8488('0x51')][_0x8488('0x48')]({'name':_0x22d22c['name'],'resourceId':_0x22d22c['id'],'type':_0x35e08a[_0x8488('0x27')],'sectionId':_0x35e08a['id']},{})[_0x8488('0x21')](function(){return _0x58b319;});}else{return _0x58b319;}})[_0x8488('0x42')](function(_0x5c55bf){logger[_0x8488('0x25')](_0x8488('0x52'),_0x5c55bf);throw _0x5c55bf;});}return _0x58b319;})[_0x8488('0x21')](respondWithResult(_0x1bc2e1,0xc9))[_0x8488('0x42')](handleError(_0x1bc2e1,null));};exports['update']=function(_0x2eff23,_0x574bf1){if(_0x2eff23['body']['id']){delete _0x2eff23[_0x8488('0x49')]['id'];}return db['ContactItemType'][_0x8488('0x47')]({'where':{'id':_0x2eff23[_0x8488('0x44')]['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x574bf1,null))[_0x8488('0x21')](saveUpdates(_0x2eff23[_0x8488('0x49')],null))[_0x8488('0x21')](respondWithResult(_0x574bf1,null))['catch'](handleError(_0x574bf1,null));};exports[_0x8488('0x22')]=function(_0x693741,_0x21765b){return db[_0x8488('0x3e')][_0x8488('0x47')]({'where':{'id':_0x693741['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x21765b,null))['then'](db[_0x8488('0x53')][_0x8488('0x54')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x693741['params']['id']}}))[_0x8488('0x21')](removeEntity(_0x21765b,null))[_0x8488('0x42')](handleError(_0x21765b,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 33cbcb2..d948796 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 _0xa44c=['rimraf','./contactItemType.attributes','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1c4209,_0x294b20){var _0x1df4c6=function(_0x3d8d63){while(--_0x3d8d63){_0x1c4209['push'](_0x1c4209['shift']());}};_0x1df4c6(++_0x294b20);}(_0xa44c,0x123));var _0xca44=function(_0x2233bb,_0x1f90a9){_0x2233bb=_0x2233bb-0x0;var _0x4143a0=_0xa44c[_0x2233bb];return _0x4143a0;};'use strict';var _=require(_0xca44('0x0'));var util=require(_0xca44('0x1'));var logger=require(_0xca44('0x2'))(_0xca44('0x3'));var moment=require(_0xca44('0x4'));var BPromise=require(_0xca44('0x5'));var rp=require(_0xca44('0x6'));var fs=require('fs');var path=require(_0xca44('0x7'));var rimraf=require(_0xca44('0x8'));var config=require('../../config/environment');var attributes=require(_0xca44('0x9'));module['exports']=function(_0x39c812,_0x144ed5){return _0x39c812[_0xca44('0xa')](_0xca44('0xb'),attributes,{'tableName':_0xca44('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf54b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','tools_contact_item_types','util'];(function(_0x39b4f0,_0x2e8b0a){var _0x190c70=function(_0x1ed1e9){while(--_0x1ed1e9){_0x39b4f0['push'](_0x39b4f0['shift']());}};_0x190c70(++_0x2e8b0a);}(_0xf54b,0x99));var _0xbf54=function(_0x323d3a,_0x325482){_0x323d3a=_0x323d3a-0x0;var _0x24847a=_0xf54b[_0x323d3a];return _0x24847a;};'use strict';var _=require('lodash');var util=require(_0xbf54('0x0'));var logger=require(_0xbf54('0x1'))(_0xbf54('0x2'));var moment=require(_0xbf54('0x3'));var BPromise=require(_0xbf54('0x4'));var rp=require(_0xbf54('0x5'));var fs=require('fs');var path=require(_0xbf54('0x6'));var rimraf=require(_0xbf54('0x7'));var config=require(_0xbf54('0x8'));var attributes=require(_0xbf54('0x9'));module['exports']=function(_0x511612,_0x3ba03b){return _0x511612['define']('ContactItemType',attributes,{'tableName':_0xbf54('0xa'),'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 a14a325..ca1274b 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 _0xac3d=['ContactItemType,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','then','info'];(function(_0x10dc64,_0x11bb29){var _0x9cf98d=function(_0x558d71){while(--_0x558d71){_0x10dc64['push'](_0x10dc64['shift']());}};_0x9cf98d(++_0x11bb29);}(_0xac3d,0x1ca));var _0xdac3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xac3d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdac3('0x0'));var util=require('util');var moment=require(_0xdac3('0x1'));var BPromise=require('bluebird');var rs=require(_0xdac3('0x2'));var fs=require('fs');var Redis=require(_0xdac3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdac3('0x4'));var logger=require(_0xdac3('0x5'))(_0xdac3('0x6'));var config=require('../../config/environment');var jayson=require(_0xdac3('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x353a19,_0x41082f,_0x1ff2b6){return new BPromise(function(_0x422329,_0x4a209d){return client['request'](_0x353a19,_0x1ff2b6)[_0xdac3('0x8')](function(_0x5e14ca){logger[_0xdac3('0x9')](_0xdac3('0xa'),_0x41082f,_0xdac3('0xb'));logger['debug']('ContactItemType,\x20%s,\x20%s,\x20%s',_0x41082f,'request\x20sent',JSON[_0xdac3('0xc')](_0x5e14ca));if(_0x5e14ca[_0xdac3('0xd')]){if(_0x5e14ca[_0xdac3('0xd')][_0xdac3('0xe')]===0x1f4){logger['error'](_0xdac3('0xa'),_0x41082f,_0x5e14ca[_0xdac3('0xd')]['message']);return _0x4a209d(_0x5e14ca['error'][_0xdac3('0xf')]);}logger[_0xdac3('0xd')](_0xdac3('0xa'),_0x41082f,_0x5e14ca['error']['message']);return _0x422329(_0x5e14ca[_0xdac3('0xd')][_0xdac3('0xf')]);}else{logger[_0xdac3('0x9')](_0xdac3('0xa'),_0x41082f,'request\x20sent');_0x422329(_0x5e14ca[_0xdac3('0x10')]['message']);}})[_0xdac3('0x11')](function(_0x28102b){logger[_0xdac3('0xd')](_0xdac3('0xa'),_0x41082f,_0x28102b);_0x4a209d(_0x28102b);});});} \ No newline at end of file +var _0x51a2=['jayson/promise','http','request','then','info','ContactItemType,\x20%s,\x20%s','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xe8b93d,_0x5511fc){var _0x3b2429=function(_0x55da37){while(--_0x55da37){_0xe8b93d['push'](_0xe8b93d['shift']());}};_0x3b2429(++_0x5511fc);}(_0x51a2,0x15c));var _0x251a=function(_0x29ebe1,_0x1d717f){_0x29ebe1=_0x29ebe1-0x0;var _0x57ebce=_0x51a2[_0x29ebe1];return _0x57ebce;};'use strict';var _=require('lodash');var util=require(_0x251a('0x0'));var moment=require(_0x251a('0x1'));var BPromise=require('bluebird');var rs=require(_0x251a('0x2'));var fs=require('fs');var Redis=require(_0x251a('0x3'));var db=require(_0x251a('0x4'))['db'];var utils=require(_0x251a('0x5'));var logger=require(_0x251a('0x6'))(_0x251a('0x7'));var config=require(_0x251a('0x8'));var jayson=require(_0x251a('0x9'));var client=jayson['client'][_0x251a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d6754,_0x4c7657,_0x206468){return new BPromise(function(_0x5125eb,_0x259a0f){return client[_0x251a('0xb')](_0x1d6754,_0x206468)[_0x251a('0xc')](function(_0x3b5068){logger[_0x251a('0xd')](_0x251a('0xe'),_0x4c7657,'request\x20sent');logger['debug'](_0x251a('0xf'),_0x4c7657,_0x251a('0x10'),JSON[_0x251a('0x11')](_0x3b5068));if(_0x3b5068['error']){if(_0x3b5068[_0x251a('0x12')][_0x251a('0x13')]===0x1f4){logger[_0x251a('0x12')]('ContactItemType,\x20%s,\x20%s',_0x4c7657,_0x3b5068['error'][_0x251a('0x14')]);return _0x259a0f(_0x3b5068[_0x251a('0x12')]['message']);}logger['error'](_0x251a('0xe'),_0x4c7657,_0x3b5068[_0x251a('0x12')]['message']);return _0x5125eb(_0x3b5068[_0x251a('0x12')][_0x251a('0x14')]);}else{logger['info'](_0x251a('0xe'),_0x4c7657,_0x251a('0x10'));_0x5125eb(_0x3b5068['result'][_0x251a('0x14')]);}})['catch'](function(_0x2beb48){logger[_0x251a('0x12')](_0x251a('0xe'),_0x4c7657,_0x2beb48);_0x259a0f(_0x2beb48);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index ba09a53..74279b9 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 _0xbfd8=['../../config/environment','./contactItemType.controller','get','isAuthenticated','show','create','put','/:id','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5ac113,_0x986da8){var _0x4e8989=function(_0x5c75fb){while(--_0x5c75fb){_0x5ac113['push'](_0x5ac113['shift']());}};_0x4e8989(++_0x986da8);}(_0xbfd8,0x78));var _0x8bfd=function(_0x3899a3,_0xcb527){_0x3899a3=_0x3899a3-0x0;var _0x13e1ce=_0xbfd8[_0x3899a3];return _0x13e1ce;};'use strict';var multer=require(_0x8bfd('0x0'));var util=require('util');var path=require(_0x8bfd('0x1'));var timeout=require('connect-timeout');var express=require(_0x8bfd('0x2'));var router=express[_0x8bfd('0x3')]();var fs_extra=require(_0x8bfd('0x4'));var auth=require(_0x8bfd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8bfd('0x6'));var controller=require(_0x8bfd('0x7'));router[_0x8bfd('0x8')]('/',auth[_0x8bfd('0x9')](),controller['index']);router[_0x8bfd('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x8bfd('0xa')]);router['post']('/',auth[_0x8bfd('0x9')](),controller[_0x8bfd('0xb')]);router[_0x8bfd('0xc')](_0x8bfd('0xd'),auth[_0x8bfd('0x9')](),controller[_0x8bfd('0xe')]);router[_0x8bfd('0xf')](_0x8bfd('0xd'),auth['isAuthenticated'](),controller[_0x8bfd('0x10')]);module[_0x8bfd('0x11')]=router; \ No newline at end of file +var _0xc2c8=['isAuthenticated','index','/:id','show','post','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x363b68,_0x52f346){var _0x431f7d=function(_0x84bfac){while(--_0x84bfac){_0x363b68['push'](_0x363b68['shift']());}};_0x431f7d(++_0x52f346);}(_0xc2c8,0x1e4));var _0x8c2c=function(_0x1c4c80,_0x117640){_0x1c4c80=_0x1c4c80-0x0;var _0x3ebadf=_0xc2c8[_0x1c4c80];return _0x3ebadf;};'use strict';var multer=require(_0x8c2c('0x0'));var util=require(_0x8c2c('0x1'));var path=require(_0x8c2c('0x2'));var timeout=require('connect-timeout');var express=require(_0x8c2c('0x3'));var router=express[_0x8c2c('0x4')]();var fs_extra=require(_0x8c2c('0x5'));var auth=require(_0x8c2c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8c2c('0x7'));var controller=require('./contactItemType.controller');router[_0x8c2c('0x8')]('/',auth[_0x8c2c('0x9')](),controller[_0x8c2c('0xa')]);router['get'](_0x8c2c('0xb'),auth['isAuthenticated'](),controller[_0x8c2c('0xc')]);router[_0x8c2c('0xd')]('/',auth[_0x8c2c('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8c2c('0xe')]);router['delete'](_0x8c2c('0xb'),auth[_0x8c2c('0x9')](),controller[_0x8c2c('0xf')]);module[_0x8c2c('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 5e47f17..4ef4d90 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 _0x2032=['name','exports','STRING'];(function(_0x484958,_0x3baea9){var _0x1b7816=function(_0x3810ae){while(--_0x3810ae){_0x484958['push'](_0x484958['shift']());}};_0x1b7816(++_0x3baea9);}(_0x2032,0xd9));var _0x2203=function(_0x4f1e45,_0x51555f){_0x4f1e45=_0x4f1e45-0x0;var _0x27f4db=_0x2032[_0x4f1e45];return _0x27f4db;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x3d3638,_0x1c6f0f){var _0x3e2437=function(_0x3749ac){while(--_0x3749ac){_0x3d3638['push'](_0x3d3638['shift']());}};_0x3e2437(++_0x1c6f0f);}(_0x2032,0xd9));var _0x2203=function(_0x2164d8,_0x1ee1c){_0x2164d8=_0x2164d8-0x0;var _0x380bad=_0x2032[_0x2164d8];return _0x380bad;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 5403faa..f61b85f 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 _0x941b=['socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Dashboard','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','autoAssociation','update','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','rawAttributes','order','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','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost'];(function(_0x5f3c54,_0x4de6d1){var _0x2aab24=function(_0x2d0546){while(--_0x2d0546){_0x5f3c54['push'](_0x5f3c54['shift']());}};_0x2aab24(++_0x4de6d1);}(_0x941b,0x6a));var _0xb941=function(_0xfa0cac,_0xaa7489){_0xfa0cac=_0xfa0cac-0x0;var _0x37bb9d=_0x941b[_0xfa0cac];return _0x37bb9d;};'use strict';var emlformat=require(_0xb941('0x0'));var rimraf=require(_0xb941('0x1'));var zipdir=require(_0xb941('0x2'));var jsonpatch=require(_0xb941('0x3'));var rp=require(_0xb941('0x4'));var moment=require(_0xb941('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb941('0x6'));var util=require(_0xb941('0x7'));var path=require(_0xb941('0x8'));var sox=require(_0xb941('0x9'));var csv=require(_0xb941('0xa'));var ejs=require(_0xb941('0xb'));var fs=require('fs');var fs_extra=require(_0xb941('0xc'));var _=require(_0xb941('0xd'));var squel=require(_0xb941('0xe'));var crypto=require(_0xb941('0xf'));var jsforce=require(_0xb941('0x10'));var deskjs=require(_0xb941('0x11'));var toCsv=require(_0xb941('0xa'));var querystring=require(_0xb941('0x12'));var Papa=require(_0xb941('0x13'));var Redis=require(_0xb941('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb941('0x15'));var hardwareService=require(_0xb941('0x16'));var logger=require(_0xb941('0x17'))(_0xb941('0x18'));var utils=require(_0xb941('0x19'));var config=require(_0xb941('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb941('0x1b')]=_[_0xb941('0x1c')](config[_0xb941('0x1b')],{'host':_0xb941('0x1d'),'port':0x18eb});var socket=require(_0xb941('0x1e'))(new Redis(config['redis']));require(_0xb941('0x1f'))[_0xb941('0x20')](socket);function respondWithStatusCode(_0x126d02,_0x1eb208){_0x1eb208=_0x1eb208||0xcc;return function(_0x151fe3){if(_0x151fe3){return _0x126d02[_0xb941('0x21')](_0x1eb208);}return _0x126d02[_0xb941('0x22')](_0x1eb208)[_0xb941('0x23')]();};}function respondWithResult(_0x18fa1c,_0x200d01){_0x200d01=_0x200d01||0xc8;return function(_0x555967){if(_0x555967){return _0x18fa1c['status'](_0x200d01)[_0xb941('0x24')](_0x555967);}};}function respondWithFilteredResult(_0x5d3659,_0x1335a6){return function(_0x198b3a){if(_0x198b3a){var _0x4f8e9e=typeof _0x1335a6[_0xb941('0x25')]===_0xb941('0x26')&&typeof _0x1335a6[_0xb941('0x27')]==='undefined';var _0x38d039=_0x198b3a[_0xb941('0x28')];var _0x921e89=_0x4f8e9e?0x0:_0x1335a6[_0xb941('0x25')];var _0x504a32=_0x4f8e9e?_0x198b3a['count']:_0x1335a6[_0xb941('0x25')]+_0x1335a6[_0xb941('0x27')];var _0x310a68;if(_0x504a32>=_0x38d039){_0x504a32=_0x38d039;_0x310a68=0xc8;}else{_0x310a68=0xce;}_0x5d3659[_0xb941('0x22')](_0x310a68);return _0x5d3659[_0xb941('0x29')](_0xb941('0x2a'),_0x921e89+'-'+_0x504a32+'/'+_0x38d039)[_0xb941('0x24')](_0x198b3a);}return null;};}function patchUpdates(_0x5982b0){return function(_0x580955){try{jsonpatch[_0xb941('0x2b')](_0x580955,_0x5982b0,!![]);}catch(_0x2d09db){return BPromise[_0xb941('0x2c')](_0x2d09db);}return _0x580955[_0xb941('0x2d')]();};}function saveUpdates(_0x2018ce,_0x45a05c){return function(_0x54889a){if(_0x54889a){return _0x54889a['update'](_0x2018ce)[_0xb941('0x2e')](function(_0x512397){return _0x512397;});}return null;};}function removeEntity(_0x370266,_0x6698bc){return function(_0x592369){if(_0x592369){return _0x592369[_0xb941('0x2f')]()[_0xb941('0x2e')](function(){var _0xb75bc7=_0x592369[_0xb941('0x30')]({'plain':!![]});var _0x39d33b='CustomDashboards';return db[_0xb941('0x31')][_0xb941('0x2f')]({'where':{'type':_0x39d33b,'resourceId':_0xb75bc7['id']}})[_0xb941('0x2e')](function(){return _0x592369;});})[_0xb941('0x2e')](function(){_0x370266[_0xb941('0x22')](0xcc)[_0xb941('0x23')]();});}};}function handleEntityNotFound(_0x2a1692,_0x22dedb){return function(_0x3a0e06){if(!_0x3a0e06){_0x2a1692[_0xb941('0x21')](0x194);}return _0x3a0e06;};}function handleError(_0x5a31e7,_0x4bb071){_0x4bb071=_0x4bb071||0x1f4;return function(_0x4bb1ef){logger[_0xb941('0x32')](_0x4bb1ef[_0xb941('0x33')]);if(_0x4bb1ef['name']){delete _0x4bb1ef[_0xb941('0x34')];}_0x5a31e7[_0xb941('0x22')](_0x4bb071)[_0xb941('0x35')](_0x4bb1ef);};}exports[_0xb941('0x36')]=function(_0x5431d3,_0x3b7ea8){var _0x19056b={},_0x5c52e2={},_0x472f7f={'count':0x0,'rows':[]};var _0x3c683d=_[_0xb941('0x37')](db[_0xb941('0x38')]['rawAttributes'],function(_0x3d8f0a){return{'name':_0x3d8f0a['fieldName'],'type':_0x3d8f0a['type']['key']};});_0x5c52e2[_0xb941('0x39')]=_[_0xb941('0x37')](_0x3c683d,_0xb941('0x34'));_0x5c52e2[_0xb941('0x3a')]=_[_0xb941('0x3b')](_0x5431d3[_0xb941('0x3a')]);_0x5c52e2[_0xb941('0x3c')]=_['intersection'](_0x5c52e2[_0xb941('0x39')],_0x5c52e2['query']);_0x19056b[_0xb941('0x3d')]=_[_0xb941('0x3e')](_0x5c52e2[_0xb941('0x39')],qs[_0xb941('0x3f')](_0x5431d3['query'][_0xb941('0x3f')]));_0x19056b[_0xb941('0x3d')]=_0x19056b['attributes'][_0xb941('0x40')]?_0x19056b[_0xb941('0x3d')]:_0x5c52e2[_0xb941('0x39')];if(!_0x5431d3[_0xb941('0x3a')][_0xb941('0x41')](_0xb941('0x42'))){_0x19056b[_0xb941('0x27')]=qs[_0xb941('0x27')](_0x5431d3[_0xb941('0x3a')][_0xb941('0x27')]);_0x19056b[_0xb941('0x25')]=qs[_0xb941('0x25')](_0x5431d3[_0xb941('0x3a')][_0xb941('0x25')]);}_0x19056b['order']=qs[_0xb941('0x43')](_0x5431d3[_0xb941('0x3a')][_0xb941('0x43')]);_0x19056b[_0xb941('0x44')]=qs['filters'](_[_0xb941('0x45')](_0x5431d3[_0xb941('0x3a')],_0x5c52e2[_0xb941('0x3c')]),_0x3c683d);if(_0x5431d3[_0xb941('0x3a')][_0xb941('0x46')]){_0x19056b['where']=_[_0xb941('0x47')](_0x19056b[_0xb941('0x44')],{'$or':_[_0xb941('0x37')](_0x3c683d,function(_0x37e342){if(_0x37e342[_0xb941('0x48')]!==_0xb941('0x49')){var _0x29cf41={};_0x29cf41[_0x37e342['name']]={'$like':'%'+_0x5431d3[_0xb941('0x3a')][_0xb941('0x46')]+'%'};return _0x29cf41;}})});}_0x19056b=_[_0xb941('0x47')]({},_0x19056b,_0x5431d3[_0xb941('0x4a')]);var _0x12bd63={'where':_0x19056b[_0xb941('0x44')]};return db[_0xb941('0x38')][_0xb941('0x28')](_0x12bd63)[_0xb941('0x2e')](function(_0x10646a){_0x472f7f[_0xb941('0x28')]=_0x10646a;if(_0x5431d3['query'][_0xb941('0x4b')]){_0x19056b[_0xb941('0x4c')]=[{'all':!![]}];}return db[_0xb941('0x38')][_0xb941('0x4d')](_0x19056b);})['then'](function(_0x5a8ce1){_0x472f7f[_0xb941('0x4e')]=_0x5a8ce1;return _0x472f7f;})[_0xb941('0x2e')](respondWithFilteredResult(_0x3b7ea8,_0x19056b))[_0xb941('0x4f')](handleError(_0x3b7ea8,null));};exports[_0xb941('0x50')]=function(_0x3bef5b,_0xc598b){var _0x578fa3={'raw':![],'where':{'id':_0x3bef5b[_0xb941('0x51')]['id']}},_0x392298={};_0x392298['model']=_['keys'](db['Dashboard']['rawAttributes']);_0x392298[_0xb941('0x3a')]=_['keys'](_0x3bef5b[_0xb941('0x3a')]);_0x392298[_0xb941('0x3c')]=_[_0xb941('0x3e')](_0x392298['model'],_0x392298[_0xb941('0x3a')]);_0x578fa3[_0xb941('0x3d')]=_['intersection'](_0x392298[_0xb941('0x39')],qs[_0xb941('0x3f')](_0x3bef5b[_0xb941('0x3a')][_0xb941('0x3f')]));_0x578fa3[_0xb941('0x3d')]=_0x578fa3[_0xb941('0x3d')]['length']?_0x578fa3[_0xb941('0x3d')]:_0x392298[_0xb941('0x39')];if(_0x3bef5b[_0xb941('0x3a')][_0xb941('0x4b')]){_0x578fa3[_0xb941('0x4c')]=[{'all':!![]}];}_0x578fa3=_[_0xb941('0x47')]({},_0x578fa3,_0x3bef5b[_0xb941('0x4a')]);return db[_0xb941('0x38')]['find'](_0x578fa3)[_0xb941('0x2e')](handleEntityNotFound(_0xc598b,null))[_0xb941('0x2e')](respondWithResult(_0xc598b,null))[_0xb941('0x4f')](handleError(_0xc598b,null));};exports[_0xb941('0x52')]=function(_0x4defb9,_0x3f0f6d){return db[_0xb941('0x38')]['create'](_0x4defb9[_0xb941('0x53')],{})[_0xb941('0x2e')](function(_0x7590da){var _0x227c05=_0x4defb9[_0xb941('0x54')][_0xb941('0x30')]({'plain':!![]});if(!_0x227c05)throw new Error(_0xb941('0x55'));if(_0x227c05[_0xb941('0x56')]===_0xb941('0x54')){var _0x477cef=_0x7590da['get']({'plain':!![]});var _0x293121=_0xb941('0x57');return db[_0xb941('0x58')][_0xb941('0x59')]({'where':{'name':_0x293121,'userProfileId':_0x227c05[_0xb941('0x5a')]},'raw':!![]})[_0xb941('0x2e')](function(_0x592dc6){if(_0x592dc6&&_0x592dc6['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x477cef[_0xb941('0x34')],'resourceId':_0x477cef['id'],'type':_0x592dc6['name'],'sectionId':_0x592dc6['id']},{})['then'](function(){return _0x7590da;});}else{return _0x7590da;}})['catch'](function(_0x1c9250){logger[_0xb941('0x32')](_0xb941('0x5b'),_0x1c9250);throw _0x1c9250;});}return _0x7590da;})[_0xb941('0x2e')](respondWithResult(_0x3f0f6d,0xc9))[_0xb941('0x4f')](handleError(_0x3f0f6d,null));};exports['clone']=function(_0xa55285,_0x3547a6){var _0x1030a5={'where':{'id':_0xa55285[_0xb941('0x51')]['id']}},_0xa727ca={};_0xa727ca[_0xb941('0x39')]=_[_0xb941('0x3b')](db[_0xb941('0x38')]['rawAttributes']);_0x1030a5[_0xb941('0x3d')]=_['intersection'](_0xa727ca['model'],qs['fields'](_0xa55285[_0xb941('0x3a')][_0xb941('0x3f')]));_0x1030a5[_0xb941('0x3d')]=_0x1030a5[_0xb941('0x3d')][_0xb941('0x40')]?_0x1030a5[_0xb941('0x3d')]:_0xa727ca[_0xb941('0x39')];if(_0xa55285[_0xb941('0x3a')][_0xb941('0x4b')]){_0x1030a5[_0xb941('0x4c')]=[{'all':!![]}];}_0x1030a5=_[_0xb941('0x47')]({},_0x1030a5,_0xa55285[_0xb941('0x4a')]);return db[_0xb941('0x38')][_0xb941('0x59')](_0x1030a5)[_0xb941('0x2e')](handleEntityNotFound(_0x3547a6,null))[_0xb941('0x2e')](function(_0x5055d8){if(_0x5055d8){var _0x5187f4=_0x5055d8[_0xb941('0x30')]({'plain':!![]});_0x5187f4=qs['omit'](_0x5187f4,['id','createdAt','updatedAt']);_0xa55285[_0xb941('0x53')]=_[_0xb941('0x5c')](_0xa55285['body'],['id',_0xb941('0x5d'),_0xb941('0x5e')]);return db['Dashboard'][_0xb941('0x52')](_['merge'](_0x5187f4,_0xa55285['body']),{'include':_0xa55285[_0xb941('0x3a')][_0xb941('0x4b')]?[{'all':!![]}]:undefined})[_0xb941('0x2e')](function(_0x4a7c55){var _0x1151ab=_0xa55285['user'][_0xb941('0x30')]({'plain':!![]});if(!_0x1151ab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1151ab[_0xb941('0x56')]===_0xb941('0x54')){var _0x307c16=_0x4a7c55[_0xb941('0x30')]({'plain':!![]});var _0x42b26d=_0xb941('0x57');return db['UserProfileSection'][_0xb941('0x59')]({'where':{'name':_0x42b26d,'userProfileId':_0x1151ab[_0xb941('0x5a')]},'raw':!![]})[_0xb941('0x2e')](function(_0x2b9aa6){if(_0x2b9aa6&&_0x2b9aa6[_0xb941('0x5f')]===0x0){return db[_0xb941('0x31')][_0xb941('0x52')]({'name':_0x307c16[_0xb941('0x34')],'resourceId':_0x307c16['id'],'type':_0x2b9aa6[_0xb941('0x34')],'sectionId':_0x2b9aa6['id']},{})[_0xb941('0x2e')](function(){return _0x4a7c55;});}else{return _0x4a7c55;}})[_0xb941('0x4f')](function(_0x3cc78c){logger[_0xb941('0x32')](_0xb941('0x5b'),_0x3cc78c);throw _0x3cc78c;});}return _0x4a7c55;});}})[_0xb941('0x2e')](respondWithResult(_0x3547a6,0xc9))[_0xb941('0x4f')](handleError(_0x3547a6,null));};exports[_0xb941('0x60')]=function(_0x8750c1,_0x4127b0){if(_0x8750c1[_0xb941('0x53')]['id']){delete _0x8750c1[_0xb941('0x53')]['id'];}return db['Dashboard'][_0xb941('0x59')]({'where':{'id':_0x8750c1['params']['id']}})['then'](handleEntityNotFound(_0x4127b0,null))[_0xb941('0x2e')](saveUpdates(_0x8750c1[_0xb941('0x53')],null))[_0xb941('0x2e')](respondWithResult(_0x4127b0,null))['catch'](handleError(_0x4127b0,null));};exports['destroy']=function(_0x4f9959,_0x48460e){return db[_0xb941('0x38')][_0xb941('0x59')]({'where':{'id':_0x4f9959['params']['id']}})[_0xb941('0x2e')](handleEntityNotFound(_0x48460e,null))[_0xb941('0x2e')](removeEntity(_0x48460e,null))['catch'](handleError(_0x48460e,null));};function widgetAttributes(_0x2a8cc1){try{switch(_0x2a8cc1[_0xb941('0x48')]){case _0xb941('0x61'):return[{'name':_0xb941('0x62'),'value':_0x2a8cc1[_0xb941('0x62')]||(_0x2a8cc1[_0xb941('0x63')]&&_0x2a8cc1[_0xb941('0x63')][0x0]?_0x2a8cc1[_0xb941('0x63')][0x0][_0xb941('0x64')]:undefined)||_0xb941('0x65')}];case'custom':return[{'name':'attrPath','value':_0x2a8cc1[_0xb941('0x66')]||(_0x2a8cc1['attrs']&&_0x2a8cc1[_0xb941('0x63')][0x0]?_0x2a8cc1[_0xb941('0x63')][0x0]['value']:undefined)||''}];case _0xb941('0x67'):return[{'name':_0xb941('0x68'),'value':_0x2a8cc1['attrHourFormat']||(_0x2a8cc1[_0xb941('0x63')]&&_0x2a8cc1['attrs'][0x0]?_0x2a8cc1[_0xb941('0x63')][0x0][_0xb941('0x64')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x2a8cc1['attrTimezone']||(_0x2a8cc1[_0xb941('0x63')]&&_0x2a8cc1[_0xb941('0x63')][0x1]?_0x2a8cc1[_0xb941('0x63')][0x1][_0xb941('0x64')]:undefined)||_0xb941('0x69')},{'name':_0xb941('0x6a'),'value':_0x2a8cc1[_0xb941('0x6a')]||(_0x2a8cc1[_0xb941('0x63')]&&_0x2a8cc1[_0xb941('0x63')][0x2]?_0x2a8cc1[_0xb941('0x63')][0x2][_0xb941('0x64')]:undefined)||0xc}];case _0xb941('0x6b'):return[{'name':_0xb941('0x6c'),'value':_0x2a8cc1['attrMetric']||(_0x2a8cc1[_0xb941('0x63')]&&_0x2a8cc1[_0xb941('0x63')][0x0]?_0x2a8cc1[_0xb941('0x63')][0x0][_0xb941('0x64')]:undefined)||_0xb941('0x6d')},{'name':'attrVoiceQueues','value':_0x2a8cc1[_0xb941('0x6e')]||(_0x2a8cc1[_0xb941('0x63')]&&_0x2a8cc1[_0xb941('0x63')][0x1]?_0x2a8cc1[_0xb941('0x63')][0x1][_0xb941('0x64')]:undefined)||[]},{'name':_0xb941('0x6a'),'value':_0x2a8cc1[_0xb941('0x6a')]||(_0x2a8cc1[_0xb941('0x63')]&&_0x2a8cc1[_0xb941('0x63')][0x2]?_0x2a8cc1[_0xb941('0x63')][0x2][_0xb941('0x64')]:undefined)||0x14},{'name':_0xb941('0x6f'),'value':_0x2a8cc1['attrChannel']||(_0x2a8cc1[_0xb941('0x63')]&&_0x2a8cc1[_0xb941('0x63')][0x3]?_0x2a8cc1[_0xb941('0x63')][0x3][_0xb941('0x64')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x2a8cc1[_0xb941('0x70')]||(_0x2a8cc1[_0xb941('0x63')]&&_0x2a8cc1[_0xb941('0x63')][0x4]?_0x2a8cc1['attrs'][0x4][_0xb941('0x64')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2a8cc1[_0xb941('0x71')]||(_0x2a8cc1['attrs']&&_0x2a8cc1['attrs'][0x5]?_0x2a8cc1[_0xb941('0x63')][0x5][_0xb941('0x64')]:undefined)||''},{'name':_0xb941('0x72'),'value':_0x2a8cc1[_0xb941('0x72')]||(_0x2a8cc1['attrs']&&_0x2a8cc1[_0xb941('0x63')][0x6]?_0x2a8cc1[_0xb941('0x63')][0x6]['value']:undefined)||''},{'name':_0xb941('0x73'),'value':_0x2a8cc1[_0xb941('0x73')]||(_0x2a8cc1[_0xb941('0x63')]&&_0x2a8cc1[_0xb941('0x63')][0x7]?_0x2a8cc1[_0xb941('0x63')][0x7][_0xb941('0x64')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2a8cc1[_0xb941('0x74')]||(_0x2a8cc1[_0xb941('0x63')]&&_0x2a8cc1['attrs'][0x8]?_0x2a8cc1[_0xb941('0x63')][0x8][_0xb941('0x64')]:undefined)||''},{'name':_0xb941('0x75'),'value':_0x2a8cc1[_0xb941('0x75')]||(_0x2a8cc1['attrs']&&_0x2a8cc1[_0xb941('0x63')][0x9]?_0x2a8cc1['attrs'][0x9][_0xb941('0x64')]:undefined)||''}];case _0xb941('0x76'):case _0xb941('0x77'):return[{'name':_0xb941('0x78'),'value':_0x2a8cc1[_0xb941('0x78')]||(_0x2a8cc1['attrs']&&_0x2a8cc1['attrs'][0x0]?_0x2a8cc1[_0xb941('0x63')][0x0][_0xb941('0x64')]:undefined)||'total'},{'name':_0xb941('0x79'),'value':_0x2a8cc1[_0xb941('0x79')]||(_0x2a8cc1['attrs']&&_0x2a8cc1[_0xb941('0x63')][0x1]?_0x2a8cc1[_0xb941('0x63')][0x1]['value']:undefined)||null},{'name':_0xb941('0x7a'),'value':_0x2a8cc1[_0xb941('0x7a')]||(_0x2a8cc1['attrs']&&_0x2a8cc1[_0xb941('0x63')][0x2]?_0x2a8cc1['attrs'][0x2]['value']:undefined)||null},{'name':_0xb941('0x6e'),'value':_0x2a8cc1[_0xb941('0x6e')]||(_0x2a8cc1[_0xb941('0x63')]&&_0x2a8cc1['attrs'][0x3]?_0x2a8cc1[_0xb941('0x63')][0x3]['value']:undefined)||[]},{'name':_0xb941('0x6f'),'value':_0x2a8cc1[_0xb941('0x6f')]||(_0x2a8cc1[_0xb941('0x63')]&&_0x2a8cc1['attrs'][0x4]?_0x2a8cc1[_0xb941('0x63')][0x4][_0xb941('0x64')]:undefined)||_0xb941('0x7b')},{'name':_0xb941('0x70'),'value':_0x2a8cc1['attrEmailAccounts']||(_0x2a8cc1[_0xb941('0x63')]&&_0x2a8cc1[_0xb941('0x63')][0x5]?_0x2a8cc1[_0xb941('0x63')][0x5][_0xb941('0x64')]:undefined)||''},{'name':_0xb941('0x71'),'value':_0x2a8cc1['attrFaxAccounts']||(_0x2a8cc1['attrs']&&_0x2a8cc1['attrs'][0x6]?_0x2a8cc1[_0xb941('0x63')][0x6][_0xb941('0x64')]:undefined)||''},{'name':_0xb941('0x72'),'value':_0x2a8cc1[_0xb941('0x72')]||(_0x2a8cc1[_0xb941('0x63')]&&_0x2a8cc1[_0xb941('0x63')][0x7]?_0x2a8cc1[_0xb941('0x63')][0x7][_0xb941('0x64')]:undefined)||''},{'name':_0xb941('0x73'),'value':_0x2a8cc1[_0xb941('0x73')]||(_0x2a8cc1[_0xb941('0x63')]&&_0x2a8cc1['attrs'][0x8]?_0x2a8cc1[_0xb941('0x63')][0x8][_0xb941('0x64')]:undefined)||''},{'name':_0xb941('0x74'),'value':_0x2a8cc1[_0xb941('0x74')]||(_0x2a8cc1[_0xb941('0x63')]&&_0x2a8cc1[_0xb941('0x63')][0x9]?_0x2a8cc1[_0xb941('0x63')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x2a8cc1[_0xb941('0x75')]||(_0x2a8cc1[_0xb941('0x63')]&&_0x2a8cc1[_0xb941('0x63')][0xa]?_0x2a8cc1['attrs'][0xa][_0xb941('0x64')]:undefined)||''}];case _0xb941('0x7c'):return[{'name':_0xb941('0x7d'),'type':_0x2a8cc1[_0xb941('0x7e')]||(_0x2a8cc1['attrs']&&_0x2a8cc1[_0xb941('0x63')][0x0]?_0x2a8cc1[_0xb941('0x63')][0x0][_0xb941('0x48')]:undefined)||null,'value':_0x2a8cc1[_0xb941('0x7d')]||(_0x2a8cc1['attrs']&&_0x2a8cc1[_0xb941('0x63')][0x0]?_0x2a8cc1[_0xb941('0x63')][0x0]['value']:undefined)||null},{'name':_0xb941('0x7f'),'value':_0x2a8cc1['attrRefresh']||(_0x2a8cc1[_0xb941('0x63')]&&_0x2a8cc1[_0xb941('0x63')][0x1]?_0x2a8cc1['attrs'][0x1][_0xb941('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x834c20){logger[_0xb941('0x32')](_0xb941('0x80'),JSON['stringify'](_0x834c20));return[];}}exports[_0xb941('0x81')]=function(_0x119d2c,_0x34914a,_0x3c1ef2){if(_0x119d2c[_0xb941('0x53')]['id']){delete _0x119d2c['body']['id'];}return db[_0xb941('0x38')][_0xb941('0x59')]({'where':{'id':_0x119d2c['params']['id']}})['then'](handleEntityNotFound(_0x34914a,null))[_0xb941('0x2e')](function(_0x11c913){if(_0x11c913){_0x119d2c[_0xb941('0x53')][_0xb941('0x82')]=_0x11c913['id'];_0x119d2c[_0xb941('0x53')][_0xb941('0x63')]=widgetAttributes(_0x119d2c[_0xb941('0x53')]);return db[_0xb941('0x83')][_0xb941('0x52')](_0x119d2c[_0xb941('0x53')]);}})['then'](respondWithResult(_0x34914a,null))[_0xb941('0x4f')](handleError(_0x34914a,null));};exports[_0xb941('0x84')]=function(_0x3946ed,_0x21ad68,_0x49a324){var _0x2c7200={};var _0x175315={};var _0x5e4a30;var _0x5a8f4d;return db[_0xb941('0x38')][_0xb941('0x85')]({'where':{'id':_0x3946ed[_0xb941('0x51')]['id']}})[_0xb941('0x2e')](handleEntityNotFound(_0x21ad68,null))[_0xb941('0x2e')](function(_0x997a39){if(_0x997a39){_0x5e4a30=_0x997a39;_0x175315[_0xb941('0x39')]=_['keys'](db['DashboardItem'][_0xb941('0x86')]);_0x175315[_0xb941('0x3a')]=_[_0xb941('0x3b')](_0x3946ed[_0xb941('0x3a')]);_0x175315[_0xb941('0x3c')]=_['intersection'](_0x175315[_0xb941('0x39')],_0x175315[_0xb941('0x3a')]);_0x2c7200['attributes']=_[_0xb941('0x3e')](_0x175315[_0xb941('0x39')],qs[_0xb941('0x3f')](_0x3946ed['query'][_0xb941('0x3f')]));_0x2c7200['attributes']=_0x2c7200[_0xb941('0x3d')]['length']?_0x2c7200[_0xb941('0x3d')]:_0x175315[_0xb941('0x39')];_0x2c7200[_0xb941('0x87')]=qs[_0xb941('0x43')](_0x3946ed['query'][_0xb941('0x43')]);_0x2c7200[_0xb941('0x44')]=qs['filters'](_[_0xb941('0x45')](_0x3946ed[_0xb941('0x3a')],_0x175315[_0xb941('0x3c')]));if(_0x3946ed[_0xb941('0x3a')]['filter']){_0x2c7200[_0xb941('0x44')]=_[_0xb941('0x47')](_0x2c7200[_0xb941('0x44')],{'$or':_[_0xb941('0x37')](_0x2c7200['attributes'],function(_0x108790){var _0xb8b021={};_0xb8b021[_0x108790]={'$like':'%'+_0x3946ed[_0xb941('0x3a')][_0xb941('0x46')]+'%'};return _0xb8b021;})});}_0x2c7200=_[_0xb941('0x47')]({},_0x2c7200,_0x3946ed[_0xb941('0x4a')]);return _0x5e4a30[_0xb941('0x84')](_0x2c7200);}})[_0xb941('0x2e')](function(_0x37eeaf){if(_0x37eeaf){_0x5a8f4d=_0x37eeaf[_0xb941('0x40')];if(!_0x3946ed[_0xb941('0x3a')][_0xb941('0x41')](_0xb941('0x42'))){_0x2c7200['limit']=qs[_0xb941('0x27')](_0x3946ed[_0xb941('0x3a')][_0xb941('0x27')]);_0x2c7200['offset']=qs['offset'](_0x3946ed[_0xb941('0x3a')][_0xb941('0x25')]);}return _0x5e4a30[_0xb941('0x84')](_0x2c7200);}})[_0xb941('0x2e')](function(_0x54e43a){if(_0x54e43a){return _0x54e43a?{'count':_0x5a8f4d,'rows':_0x54e43a}:null;}})[_0xb941('0x2e')](respondWithResult(_0x21ad68,null))['catch'](handleError(_0x21ad68,null));}; \ No newline at end of file +var _0x35bd=['attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardItem','getItems','findOne','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','get','CustomDashboards','UserProfileResource','destroy','error','name','send','index','Dashboard','rawAttributes','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts'];(function(_0x48bad8,_0x45feff){var _0x5342ee=function(_0xd97273){while(--_0xd97273){_0x48bad8['push'](_0x48bad8['shift']());}};_0x5342ee(++_0x45feff);}(_0x35bd,0x18d));var _0xd35b=function(_0x10ca64,_0x5efe5e){_0x10ca64=_0x10ca64-0x0;var _0x1fe571=_0x35bd[_0x10ca64];return _0x1fe571;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd35b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd35b('0x1'));var rp=require(_0xd35b('0x2'));var moment=require(_0xd35b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd35b('0x4'));var sox=require(_0xd35b('0x5'));var csv=require(_0xd35b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd35b('0x7'));var _=require(_0xd35b('0x8'));var squel=require(_0xd35b('0x9'));var crypto=require(_0xd35b('0xa'));var jsforce=require(_0xd35b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd35b('0x6'));var querystring=require(_0xd35b('0xc'));var Papa=require(_0xd35b('0xd'));var Redis=require('ioredis');var authService=require(_0xd35b('0xe'));var qs=require(_0xd35b('0xf'));var as=require(_0xd35b('0x10'));var hardwareService=require(_0xd35b('0x11'));var logger=require(_0xd35b('0x12'))(_0xd35b('0x13'));var utils=require(_0xd35b('0x14'));var config=require(_0xd35b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd35b('0x16'))['db'];config[_0xd35b('0x17')]=_[_0xd35b('0x18')](config[_0xd35b('0x17')],{'host':_0xd35b('0x19'),'port':0x18eb});var socket=require(_0xd35b('0x1a'))(new Redis(config[_0xd35b('0x17')]));require(_0xd35b('0x1b'))[_0xd35b('0x1c')](socket);function respondWithStatusCode(_0x17aea1,_0x4282b5){_0x4282b5=_0x4282b5||0xcc;return function(_0x3e44d8){if(_0x3e44d8){return _0x17aea1[_0xd35b('0x1d')](_0x4282b5);}return _0x17aea1[_0xd35b('0x1e')](_0x4282b5)[_0xd35b('0x1f')]();};}function respondWithResult(_0x2666a5,_0x22c4d9){_0x22c4d9=_0x22c4d9||0xc8;return function(_0x5de5f7){if(_0x5de5f7){return _0x2666a5[_0xd35b('0x1e')](_0x22c4d9)[_0xd35b('0x20')](_0x5de5f7);}};}function respondWithFilteredResult(_0x573af1,_0x36a582){return function(_0x1be993){if(_0x1be993){var _0x23a446=typeof _0x36a582[_0xd35b('0x21')]==='undefined'&&typeof _0x36a582[_0xd35b('0x22')]===_0xd35b('0x23');var _0x5c10ac=_0x1be993['count'];var _0x172b15=_0x23a446?0x0:_0x36a582[_0xd35b('0x21')];var _0x4561f9=_0x23a446?_0x1be993[_0xd35b('0x24')]:_0x36a582[_0xd35b('0x21')]+_0x36a582[_0xd35b('0x22')];var _0x1e0cd2;if(_0x4561f9>=_0x5c10ac){_0x4561f9=_0x5c10ac;_0x1e0cd2=0xc8;}else{_0x1e0cd2=0xce;}_0x573af1['status'](_0x1e0cd2);return _0x573af1[_0xd35b('0x25')](_0xd35b('0x26'),_0x172b15+'-'+_0x4561f9+'/'+_0x5c10ac)[_0xd35b('0x20')](_0x1be993);}return null;};}function patchUpdates(_0x85b917){return function(_0x1ebed7){try{jsonpatch[_0xd35b('0x27')](_0x1ebed7,_0x85b917,!![]);}catch(_0x4c691e){return BPromise[_0xd35b('0x28')](_0x4c691e);}return _0x1ebed7['save']();};}function saveUpdates(_0x22c490,_0x6b97b6){return function(_0x45d065){if(_0x45d065){return _0x45d065['update'](_0x22c490)[_0xd35b('0x29')](function(_0x56365a){return _0x56365a;});}return null;};}function removeEntity(_0x2faa9a,_0x10d706){return function(_0x19ba97){if(_0x19ba97){return _0x19ba97['destroy']()[_0xd35b('0x29')](function(){var _0x2f3668=_0x19ba97[_0xd35b('0x2a')]({'plain':!![]});var _0x3d04bf=_0xd35b('0x2b');return db[_0xd35b('0x2c')][_0xd35b('0x2d')]({'where':{'type':_0x3d04bf,'resourceId':_0x2f3668['id']}})[_0xd35b('0x29')](function(){return _0x19ba97;});})['then'](function(){_0x2faa9a[_0xd35b('0x1e')](0xcc)[_0xd35b('0x1f')]();});}};}function handleEntityNotFound(_0x2982c9,_0x3b3066){return function(_0x498113){if(!_0x498113){_0x2982c9['sendStatus'](0x194);}return _0x498113;};}function handleError(_0x26433d,_0x35183d){_0x35183d=_0x35183d||0x1f4;return function(_0x1a3b1c){logger[_0xd35b('0x2e')](_0x1a3b1c['stack']);if(_0x1a3b1c['name']){delete _0x1a3b1c[_0xd35b('0x2f')];}_0x26433d[_0xd35b('0x1e')](_0x35183d)[_0xd35b('0x30')](_0x1a3b1c);};}exports[_0xd35b('0x31')]=function(_0x3085b5,_0x11868f){var _0x1d30c1={},_0x4d266a={},_0x451408={'count':0x0,'rows':[]};var _0xf65860=_['map'](db[_0xd35b('0x32')][_0xd35b('0x33')],function(_0x52fb0e){return{'name':_0x52fb0e['fieldName'],'type':_0x52fb0e[_0xd35b('0x34')][_0xd35b('0x35')]};});_0x4d266a[_0xd35b('0x36')]=_[_0xd35b('0x37')](_0xf65860,_0xd35b('0x2f'));_0x4d266a[_0xd35b('0x38')]=_['keys'](_0x3085b5[_0xd35b('0x38')]);_0x4d266a[_0xd35b('0x39')]=_['intersection'](_0x4d266a[_0xd35b('0x36')],_0x4d266a[_0xd35b('0x38')]);_0x1d30c1[_0xd35b('0x3a')]=_[_0xd35b('0x3b')](_0x4d266a['model'],qs[_0xd35b('0x3c')](_0x3085b5[_0xd35b('0x38')][_0xd35b('0x3c')]));_0x1d30c1[_0xd35b('0x3a')]=_0x1d30c1[_0xd35b('0x3a')][_0xd35b('0x3d')]?_0x1d30c1[_0xd35b('0x3a')]:_0x4d266a[_0xd35b('0x36')];if(!_0x3085b5[_0xd35b('0x38')][_0xd35b('0x3e')](_0xd35b('0x3f'))){_0x1d30c1[_0xd35b('0x22')]=qs[_0xd35b('0x22')](_0x3085b5[_0xd35b('0x38')][_0xd35b('0x22')]);_0x1d30c1[_0xd35b('0x21')]=qs['offset'](_0x3085b5[_0xd35b('0x38')]['offset']);}_0x1d30c1['order']=qs[_0xd35b('0x40')](_0x3085b5[_0xd35b('0x38')]['sort']);_0x1d30c1[_0xd35b('0x41')]=qs[_0xd35b('0x39')](_[_0xd35b('0x42')](_0x3085b5['query'],_0x4d266a[_0xd35b('0x39')]),_0xf65860);if(_0x3085b5[_0xd35b('0x38')]['filter']){_0x1d30c1[_0xd35b('0x41')]=_['merge'](_0x1d30c1[_0xd35b('0x41')],{'$or':_['map'](_0xf65860,function(_0x5c8580){if(_0x5c8580[_0xd35b('0x34')]!=='VIRTUAL'){var _0x1e89f2={};_0x1e89f2[_0x5c8580['name']]={'$like':'%'+_0x3085b5[_0xd35b('0x38')][_0xd35b('0x43')]+'%'};return _0x1e89f2;}})});}_0x1d30c1=_[_0xd35b('0x44')]({},_0x1d30c1,_0x3085b5[_0xd35b('0x45')]);var _0xa0b1bd={'where':_0x1d30c1['where']};return db[_0xd35b('0x32')]['count'](_0xa0b1bd)[_0xd35b('0x29')](function(_0x17108a){_0x451408[_0xd35b('0x24')]=_0x17108a;if(_0x3085b5[_0xd35b('0x38')][_0xd35b('0x46')]){_0x1d30c1[_0xd35b('0x47')]=[{'all':!![]}];}return db['Dashboard'][_0xd35b('0x48')](_0x1d30c1);})[_0xd35b('0x29')](function(_0x3ce828){_0x451408[_0xd35b('0x49')]=_0x3ce828;return _0x451408;})['then'](respondWithFilteredResult(_0x11868f,_0x1d30c1))[_0xd35b('0x4a')](handleError(_0x11868f,null));};exports[_0xd35b('0x4b')]=function(_0x5d0575,_0x467340){var _0x3cd264={'raw':![],'where':{'id':_0x5d0575[_0xd35b('0x4c')]['id']}},_0x32e047={};_0x32e047[_0xd35b('0x36')]=_[_0xd35b('0x4d')](db['Dashboard'][_0xd35b('0x33')]);_0x32e047['query']=_[_0xd35b('0x4d')](_0x5d0575[_0xd35b('0x38')]);_0x32e047['filters']=_[_0xd35b('0x3b')](_0x32e047[_0xd35b('0x36')],_0x32e047[_0xd35b('0x38')]);_0x3cd264['attributes']=_[_0xd35b('0x3b')](_0x32e047['model'],qs[_0xd35b('0x3c')](_0x5d0575[_0xd35b('0x38')][_0xd35b('0x3c')]));_0x3cd264[_0xd35b('0x3a')]=_0x3cd264['attributes'][_0xd35b('0x3d')]?_0x3cd264[_0xd35b('0x3a')]:_0x32e047[_0xd35b('0x36')];if(_0x5d0575['query'][_0xd35b('0x46')]){_0x3cd264[_0xd35b('0x47')]=[{'all':!![]}];}_0x3cd264=_[_0xd35b('0x44')]({},_0x3cd264,_0x5d0575['options']);return db['Dashboard'][_0xd35b('0x4e')](_0x3cd264)[_0xd35b('0x29')](handleEntityNotFound(_0x467340,null))[_0xd35b('0x29')](respondWithResult(_0x467340,null))[_0xd35b('0x4a')](handleError(_0x467340,null));};exports[_0xd35b('0x4f')]=function(_0x490244,_0x29f0ad){return db[_0xd35b('0x32')]['create'](_0x490244[_0xd35b('0x50')],{})['then'](function(_0x9f6280){var _0x2f889b=_0x490244['user'][_0xd35b('0x2a')]({'plain':!![]});if(!_0x2f889b)throw new Error(_0xd35b('0x51'));if(_0x2f889b[_0xd35b('0x52')]==='user'){var _0x591792=_0x9f6280[_0xd35b('0x2a')]({'plain':!![]});var _0x13be66='CustomDashboards';return db[_0xd35b('0x53')][_0xd35b('0x4e')]({'where':{'name':_0x13be66,'userProfileId':_0x2f889b[_0xd35b('0x54')]},'raw':!![]})[_0xd35b('0x29')](function(_0x1e5da4){if(_0x1e5da4&&_0x1e5da4[_0xd35b('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x591792['name'],'resourceId':_0x591792['id'],'type':_0x1e5da4[_0xd35b('0x2f')],'sectionId':_0x1e5da4['id']},{})[_0xd35b('0x29')](function(){return _0x9f6280;});}else{return _0x9f6280;}})['catch'](function(_0x45b0a8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45b0a8);throw _0x45b0a8;});}return _0x9f6280;})[_0xd35b('0x29')](respondWithResult(_0x29f0ad,0xc9))[_0xd35b('0x4a')](handleError(_0x29f0ad,null));};exports[_0xd35b('0x56')]=function(_0x164859,_0x3c9233){var _0x41e083={'where':{'id':_0x164859['params']['id']}},_0x266aa2={};_0x266aa2[_0xd35b('0x36')]=_[_0xd35b('0x4d')](db[_0xd35b('0x32')][_0xd35b('0x33')]);_0x41e083[_0xd35b('0x3a')]=_[_0xd35b('0x3b')](_0x266aa2[_0xd35b('0x36')],qs['fields'](_0x164859[_0xd35b('0x38')]['fields']));_0x41e083[_0xd35b('0x3a')]=_0x41e083[_0xd35b('0x3a')]['length']?_0x41e083[_0xd35b('0x3a')]:_0x266aa2[_0xd35b('0x36')];if(_0x164859[_0xd35b('0x38')][_0xd35b('0x46')]){_0x41e083[_0xd35b('0x47')]=[{'all':!![]}];}_0x41e083=_['merge']({},_0x41e083,_0x164859[_0xd35b('0x45')]);return db['Dashboard'][_0xd35b('0x4e')](_0x41e083)['then'](handleEntityNotFound(_0x3c9233,null))[_0xd35b('0x29')](function(_0x2bb2c0){if(_0x2bb2c0){var _0x5bed45=_0x2bb2c0[_0xd35b('0x2a')]({'plain':!![]});_0x5bed45=qs[_0xd35b('0x57')](_0x5bed45,['id',_0xd35b('0x58'),_0xd35b('0x59')]);_0x164859['body']=_[_0xd35b('0x57')](_0x164859[_0xd35b('0x50')],['id','createdAt',_0xd35b('0x59')]);return db[_0xd35b('0x32')][_0xd35b('0x4f')](_[_0xd35b('0x44')](_0x5bed45,_0x164859[_0xd35b('0x50')]),{'include':_0x164859['query'][_0xd35b('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x2e85a9){var _0x3b89c7=_0x164859['user'][_0xd35b('0x2a')]({'plain':!![]});if(!_0x3b89c7)throw new Error(_0xd35b('0x51'));if(_0x3b89c7[_0xd35b('0x52')]===_0xd35b('0x5a')){var _0x4c53e5=_0x2e85a9['get']({'plain':!![]});var _0x55190a=_0xd35b('0x2b');return db[_0xd35b('0x53')]['find']({'where':{'name':_0x55190a,'userProfileId':_0x3b89c7[_0xd35b('0x54')]},'raw':!![]})[_0xd35b('0x29')](function(_0x2b2c49){if(_0x2b2c49&&_0x2b2c49[_0xd35b('0x55')]===0x0){return db[_0xd35b('0x2c')][_0xd35b('0x4f')]({'name':_0x4c53e5[_0xd35b('0x2f')],'resourceId':_0x4c53e5['id'],'type':_0x2b2c49[_0xd35b('0x2f')],'sectionId':_0x2b2c49['id']},{})[_0xd35b('0x29')](function(){return _0x2e85a9;});}else{return _0x2e85a9;}})['catch'](function(_0x58f981){logger[_0xd35b('0x2e')](_0xd35b('0x5b'),_0x58f981);throw _0x58f981;});}return _0x2e85a9;});}})[_0xd35b('0x29')](respondWithResult(_0x3c9233,0xc9))[_0xd35b('0x4a')](handleError(_0x3c9233,null));};exports[_0xd35b('0x5c')]=function(_0x13253d,_0x41a063){if(_0x13253d[_0xd35b('0x50')]['id']){delete _0x13253d[_0xd35b('0x50')]['id'];}return db[_0xd35b('0x32')][_0xd35b('0x4e')]({'where':{'id':_0x13253d[_0xd35b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x41a063,null))[_0xd35b('0x29')](saveUpdates(_0x13253d[_0xd35b('0x50')],null))[_0xd35b('0x29')](respondWithResult(_0x41a063,null))['catch'](handleError(_0x41a063,null));};exports[_0xd35b('0x2d')]=function(_0xdaba24,_0x3ac8ee){return db[_0xd35b('0x32')][_0xd35b('0x4e')]({'where':{'id':_0xdaba24[_0xd35b('0x4c')]['id']}})[_0xd35b('0x29')](handleEntityNotFound(_0x3ac8ee,null))[_0xd35b('0x29')](removeEntity(_0x3ac8ee,null))['catch'](handleError(_0x3ac8ee,null));};function widgetAttributes(_0x988a92){try{switch(_0x988a92[_0xd35b('0x34')]){case _0xd35b('0x5d'):return[{'name':_0xd35b('0x5e'),'value':_0x988a92[_0xd35b('0x5e')]||(_0x988a92['attrs']&&_0x988a92[_0xd35b('0x5f')][0x0]?_0x988a92['attrs'][0x0][_0xd35b('0x60')]:undefined)||_0xd35b('0x61')}];case _0xd35b('0x62'):return[{'name':_0xd35b('0x63'),'value':_0x988a92[_0xd35b('0x63')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x0]?_0x988a92[_0xd35b('0x5f')][0x0][_0xd35b('0x60')]:undefined)||''}];case _0xd35b('0x64'):return[{'name':'attrHourFormat','value':_0x988a92[_0xd35b('0x65')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x0]?_0x988a92[_0xd35b('0x5f')][0x0]['value']:undefined)||_0xd35b('0x66')},{'name':_0xd35b('0x67'),'value':_0x988a92['attrTimezone']||(_0x988a92['attrs']&&_0x988a92[_0xd35b('0x5f')][0x1]?_0x988a92[_0xd35b('0x5f')][0x1][_0xd35b('0x60')]:undefined)||'0.00'},{'name':_0xd35b('0x68'),'value':_0x988a92['attrFontSize']||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x2]?_0x988a92[_0xd35b('0x5f')][0x2][_0xd35b('0x60')]:undefined)||0xc}];case _0xd35b('0x69'):return[{'name':_0xd35b('0x6a'),'value':_0x988a92['attrMetric']||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92['attrs'][0x0]?_0x988a92[_0xd35b('0x5f')][0x0][_0xd35b('0x60')]:undefined)||_0xd35b('0x6b')},{'name':_0xd35b('0x6c'),'value':_0x988a92[_0xd35b('0x6c')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x1]?_0x988a92[_0xd35b('0x5f')][0x1][_0xd35b('0x60')]:undefined)||[]},{'name':_0xd35b('0x68'),'value':_0x988a92[_0xd35b('0x68')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92['attrs'][0x2]?_0x988a92[_0xd35b('0x5f')][0x2][_0xd35b('0x60')]:undefined)||0x14},{'name':_0xd35b('0x6d'),'value':_0x988a92[_0xd35b('0x6d')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x3]?_0x988a92[_0xd35b('0x5f')][0x3][_0xd35b('0x60')]:undefined)||_0xd35b('0x6e')},{'name':_0xd35b('0x6f'),'value':_0x988a92[_0xd35b('0x6f')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x4]?_0x988a92[_0xd35b('0x5f')][0x4][_0xd35b('0x60')]:undefined)||''},{'name':_0xd35b('0x70'),'value':_0x988a92['attrFaxAccounts']||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92['attrs'][0x5]?_0x988a92[_0xd35b('0x5f')][0x5][_0xd35b('0x60')]:undefined)||''},{'name':_0xd35b('0x71'),'value':_0x988a92[_0xd35b('0x71')]||(_0x988a92['attrs']&&_0x988a92[_0xd35b('0x5f')][0x6]?_0x988a92['attrs'][0x6][_0xd35b('0x60')]:undefined)||''},{'name':_0xd35b('0x72'),'value':_0x988a92[_0xd35b('0x72')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x7]?_0x988a92[_0xd35b('0x5f')][0x7][_0xd35b('0x60')]:undefined)||''},{'name':_0xd35b('0x73'),'value':_0x988a92['attrWhatsappAccounts']||(_0x988a92['attrs']&&_0x988a92[_0xd35b('0x5f')][0x8]?_0x988a92[_0xd35b('0x5f')][0x8][_0xd35b('0x60')]:undefined)||''},{'name':_0xd35b('0x74'),'value':_0x988a92[_0xd35b('0x74')]||(_0x988a92['attrs']&&_0x988a92[_0xd35b('0x5f')][0x9]?_0x988a92[_0xd35b('0x5f')][0x9]['value']:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0xd35b('0x75'),'value':_0x988a92[_0xd35b('0x75')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x0]?_0x988a92[_0xd35b('0x5f')][0x0][_0xd35b('0x60')]:undefined)||_0xd35b('0x6b')},{'name':_0xd35b('0x76'),'value':_0x988a92[_0xd35b('0x76')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x1]?_0x988a92[_0xd35b('0x5f')][0x1]['value']:undefined)||null},{'name':_0xd35b('0x77'),'value':_0x988a92['attrSerie3']||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92['attrs'][0x2]?_0x988a92[_0xd35b('0x5f')][0x2][_0xd35b('0x60')]:undefined)||null},{'name':_0xd35b('0x6c'),'value':_0x988a92[_0xd35b('0x6c')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x3]?_0x988a92['attrs'][0x3][_0xd35b('0x60')]:undefined)||[]},{'name':_0xd35b('0x6d'),'value':_0x988a92[_0xd35b('0x6d')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x4]?_0x988a92[_0xd35b('0x5f')][0x4][_0xd35b('0x60')]:undefined)||'voice'},{'name':_0xd35b('0x6f'),'value':_0x988a92[_0xd35b('0x6f')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x5]?_0x988a92[_0xd35b('0x5f')][0x5][_0xd35b('0x60')]:undefined)||''},{'name':_0xd35b('0x70'),'value':_0x988a92[_0xd35b('0x70')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x6]?_0x988a92['attrs'][0x6][_0xd35b('0x60')]:undefined)||''},{'name':_0xd35b('0x71'),'value':_0x988a92[_0xd35b('0x71')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92['attrs'][0x7]?_0x988a92[_0xd35b('0x5f')][0x7][_0xd35b('0x60')]:undefined)||''},{'name':_0xd35b('0x72'),'value':_0x988a92[_0xd35b('0x72')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x8]?_0x988a92['attrs'][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x988a92['attrWhatsappAccounts']||(_0x988a92['attrs']&&_0x988a92[_0xd35b('0x5f')][0x9]?_0x988a92[_0xd35b('0x5f')][0x9][_0xd35b('0x60')]:undefined)||''},{'name':_0xd35b('0x74'),'value':_0x988a92['attrChatWebsites']||(_0x988a92['attrs']&&_0x988a92[_0xd35b('0x5f')][0xa]?_0x988a92['attrs'][0xa][_0xd35b('0x60')]:undefined)||''}];case _0xd35b('0x78'):return[{'name':_0xd35b('0x79'),'type':_0x988a92['reportType']||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x0]?_0x988a92[_0xd35b('0x5f')][0x0][_0xd35b('0x34')]:undefined)||null,'value':_0x988a92[_0xd35b('0x79')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92[_0xd35b('0x5f')][0x0]?_0x988a92[_0xd35b('0x5f')][0x0]['value']:undefined)||null},{'name':_0xd35b('0x7a'),'value':_0x988a92[_0xd35b('0x7a')]||(_0x988a92[_0xd35b('0x5f')]&&_0x988a92['attrs'][0x1]?_0x988a92[_0xd35b('0x5f')][0x1][_0xd35b('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x40020a){logger[_0xd35b('0x2e')](_0xd35b('0x7b'),JSON['stringify'](_0x40020a));return[];}}exports[_0xd35b('0x7c')]=function(_0x57f9ff,_0x585b78,_0x536f7b){if(_0x57f9ff[_0xd35b('0x50')]['id']){delete _0x57f9ff['body']['id'];}return db[_0xd35b('0x32')][_0xd35b('0x4e')]({'where':{'id':_0x57f9ff['params']['id']}})['then'](handleEntityNotFound(_0x585b78,null))['then'](function(_0x35aac9){if(_0x35aac9){_0x57f9ff[_0xd35b('0x50')]['DashboardId']=_0x35aac9['id'];_0x57f9ff[_0xd35b('0x50')][_0xd35b('0x5f')]=widgetAttributes(_0x57f9ff['body']);return db[_0xd35b('0x7d')][_0xd35b('0x4f')](_0x57f9ff[_0xd35b('0x50')]);}})[_0xd35b('0x29')](respondWithResult(_0x585b78,null))[_0xd35b('0x4a')](handleError(_0x585b78,null));};exports[_0xd35b('0x7e')]=function(_0x13e0c8,_0x3fabae,_0x4d7503){var _0x544d10={};var _0x11121a={};var _0x3dc73b;var _0x3a9d26;return db[_0xd35b('0x32')][_0xd35b('0x7f')]({'where':{'id':_0x13e0c8[_0xd35b('0x4c')]['id']}})[_0xd35b('0x29')](handleEntityNotFound(_0x3fabae,null))['then'](function(_0xe0978e){if(_0xe0978e){_0x3dc73b=_0xe0978e;_0x11121a['model']=_[_0xd35b('0x4d')](db[_0xd35b('0x7d')]['rawAttributes']);_0x11121a['query']=_['keys'](_0x13e0c8['query']);_0x11121a['filters']=_[_0xd35b('0x3b')](_0x11121a[_0xd35b('0x36')],_0x11121a['query']);_0x544d10[_0xd35b('0x3a')]=_[_0xd35b('0x3b')](_0x11121a[_0xd35b('0x36')],qs[_0xd35b('0x3c')](_0x13e0c8[_0xd35b('0x38')][_0xd35b('0x3c')]));_0x544d10[_0xd35b('0x3a')]=_0x544d10[_0xd35b('0x3a')][_0xd35b('0x3d')]?_0x544d10[_0xd35b('0x3a')]:_0x11121a['model'];_0x544d10['order']=qs[_0xd35b('0x40')](_0x13e0c8['query'][_0xd35b('0x40')]);_0x544d10[_0xd35b('0x41')]=qs[_0xd35b('0x39')](_[_0xd35b('0x42')](_0x13e0c8[_0xd35b('0x38')],_0x11121a[_0xd35b('0x39')]));if(_0x13e0c8[_0xd35b('0x38')][_0xd35b('0x43')]){_0x544d10['where']=_[_0xd35b('0x44')](_0x544d10['where'],{'$or':_[_0xd35b('0x37')](_0x544d10[_0xd35b('0x3a')],function(_0x39940c){var _0x5c48b3={};_0x5c48b3[_0x39940c]={'$like':'%'+_0x13e0c8['query'][_0xd35b('0x43')]+'%'};return _0x5c48b3;})});}_0x544d10=_[_0xd35b('0x44')]({},_0x544d10,_0x13e0c8[_0xd35b('0x45')]);return _0x3dc73b[_0xd35b('0x7e')](_0x544d10);}})[_0xd35b('0x29')](function(_0x3d213d){if(_0x3d213d){_0x3a9d26=_0x3d213d[_0xd35b('0x3d')];if(!_0x13e0c8['query'][_0xd35b('0x3e')](_0xd35b('0x3f'))){_0x544d10[_0xd35b('0x22')]=qs[_0xd35b('0x22')](_0x13e0c8['query'][_0xd35b('0x22')]);_0x544d10['offset']=qs[_0xd35b('0x21')](_0x13e0c8[_0xd35b('0x38')][_0xd35b('0x21')]);}return _0x3dc73b[_0xd35b('0x7e')](_0x544d10);}})[_0xd35b('0x29')](function(_0x41171d){if(_0x41171d){return _0x41171d?{'count':_0x3a9d26,'rows':_0x41171d}:null;}})['then'](respondWithResult(_0x3fabae,null))[_0xd35b('0x4a')](handleError(_0x3fabae,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index fc38ab2..62f445d 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 _0xd1f1=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x382602,_0x5e9d2d){var _0x14dda6=function(_0xf65c39){while(--_0xf65c39){_0x382602['push'](_0x382602['shift']());}};_0x14dda6(++_0x5e9d2d);}(_0xd1f1,0xbc));var _0x1d1f=function(_0x438685,_0x4ec0c0){_0x438685=_0x438685-0x0;var _0x41cca2=_0xd1f1[_0x438685];return _0x41cca2;};'use strict';var EventEmitter=require(_0x1d1f('0x0'));var Dashboard=require(_0x1d1f('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x1d1f('0x2')](0x0);var events={'afterCreate':_0x1d1f('0x3'),'afterUpdate':_0x1d1f('0x4'),'afterDestroy':_0x1d1f('0x5')};function emitEvent(_0x402c84){return function(_0x210e7f,_0x2a2bb4,_0x5264b1){DashboardEvents[_0x1d1f('0x6')](_0x402c84+':'+_0x210e7f['id'],_0x210e7f);DashboardEvents[_0x1d1f('0x6')](_0x402c84,_0x210e7f);_0x5264b1(null);};}for(var e in events){if(events[_0x1d1f('0x7')](e)){var event=events[e];Dashboard[_0x1d1f('0x8')](e,emitEvent(event));}}module[_0x1d1f('0x9')]=DashboardEvents; \ No newline at end of file +var _0x0f80=['hasOwnProperty','hook','exports','../../mysqldb','Dashboard','setMaxListeners','save','update','emit'];(function(_0x2c35b4,_0x5e1e1d){var _0x320eb7=function(_0x2d4c9d){while(--_0x2d4c9d){_0x2c35b4['push'](_0x2c35b4['shift']());}};_0x320eb7(++_0x5e1e1d);}(_0x0f80,0x108));var _0x00f8=function(_0x1c5541,_0x5937a){_0x1c5541=_0x1c5541-0x0;var _0x5acd40=_0x0f80[_0x1c5541];return _0x5acd40;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x00f8('0x0'))['db'][_0x00f8('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x00f8('0x2')](0x0);var events={'afterCreate':_0x00f8('0x3'),'afterUpdate':_0x00f8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1c5e26){return function(_0x1921a1,_0x257013,_0x523990){DashboardEvents[_0x00f8('0x5')](_0x1c5e26+':'+_0x1921a1['id'],_0x1921a1);DashboardEvents[_0x00f8('0x5')](_0x1c5e26,_0x1921a1);_0x523990(null);};}for(var e in events){if(events[_0x00f8('0x6')](e)){var event=events[e];Dashboard[_0x00f8('0x7')](e,emitEvent(event));}}module[_0x00f8('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 b1faea9..a36caf5 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 _0xd4dc=['../../config/logger','api','moment','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','lodash','util'];(function(_0x973f6e,_0x2df734){var _0x3959a6=function(_0x55dd6c){while(--_0x55dd6c){_0x973f6e['push'](_0x973f6e['shift']());}};_0x3959a6(++_0x2df734);}(_0xd4dc,0xbe));var _0xcd4d=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xd4dc[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0xcd4d('0x0'));var util=require(_0xcd4d('0x1'));var logger=require(_0xcd4d('0x2'))(_0xcd4d('0x3'));var moment=require(_0xcd4d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd4d('0x5'));var rimraf=require(_0xcd4d('0x6'));var config=require(_0xcd4d('0x7'));var attributes=require(_0xcd4d('0x8'));module[_0xcd4d('0x9')]=function(_0x3f004d,_0x16996f){return _0x3f004d[_0xcd4d('0xa')](_0xcd4d('0xb'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb000=['path','rimraf','../../config/environment','./dashboard.attributes','exports','define','dashboards','lodash','util','../../config/logger','moment','bluebird'];(function(_0x482115,_0x5550f5){var _0x40afb4=function(_0x44ce30){while(--_0x44ce30){_0x482115['push'](_0x482115['shift']());}};_0x40afb4(++_0x5550f5);}(_0xb000,0x8b));var _0x0b00=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0xb000[_0x470bfb];return _0x2f5d97;};'use strict';var _=require(_0x0b00('0x0'));var util=require(_0x0b00('0x1'));var logger=require(_0x0b00('0x2'))('api');var moment=require(_0x0b00('0x3'));var BPromise=require(_0x0b00('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b00('0x5'));var rimraf=require(_0x0b00('0x6'));var config=require(_0x0b00('0x7'));var attributes=require(_0x0b00('0x8'));module[_0x0b00('0x9')]=function(_0x516915,_0x5d4e06){return _0x516915[_0x0b00('0xa')]('Dashboard',attributes,{'tableName':_0x0b00('0xb'),'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 9f122a4..eead01a 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 _0x9099=['redis','localhost','socket.io-emitter','./dashboard.socket','request','info','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x4892a6,_0x1fd0b2){var _0x2db8a9=function(_0x390802){while(--_0x390802){_0x4892a6['push'](_0x4892a6['shift']());}};_0x2db8a9(++_0x1fd0b2);}(_0x9099,0x11d));var _0x9909=function(_0x26bf51,_0x5e261a){_0x26bf51=_0x26bf51-0x0;var _0x503415=_0x9099[_0x26bf51];return _0x503415;};'use strict';var _=require(_0x9909('0x0'));var util=require(_0x9909('0x1'));var moment=require(_0x9909('0x2'));var BPromise=require(_0x9909('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9909('0x4'));var db=require(_0x9909('0x5'))['db'];var utils=require(_0x9909('0x6'));var logger=require(_0x9909('0x7'))(_0x9909('0x8'));var config=require(_0x9909('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9909('0xa')][_0x9909('0xb')]({'port':0x232a});config[_0x9909('0xc')]=_['defaults'](config[_0x9909('0xc')],{'host':_0x9909('0xd'),'port':0x18eb});var socket=require(_0x9909('0xe'))(new Redis(config[_0x9909('0xc')]));require(_0x9909('0xf'))['register'](socket);function respondWithRpcPromise(_0x5385a5,_0x343405,_0x11e0b0){return new BPromise(function(_0x4406e5,_0x26979e){return client[_0x9909('0x10')](_0x5385a5,_0x11e0b0)['then'](function(_0x811842){logger[_0x9909('0x11')]('Dashboard,\x20%s,\x20%s',_0x343405,'request\x20sent');logger[_0x9909('0x12')](_0x9909('0x13'),_0x343405,'request\x20sent',JSON[_0x9909('0x14')](_0x811842));if(_0x811842[_0x9909('0x15')]){if(_0x811842[_0x9909('0x15')][_0x9909('0x16')]===0x1f4){logger['error'](_0x9909('0x17'),_0x343405,_0x811842[_0x9909('0x15')][_0x9909('0x18')]);return _0x26979e(_0x811842[_0x9909('0x15')][_0x9909('0x18')]);}logger[_0x9909('0x15')]('Dashboard,\x20%s,\x20%s',_0x343405,_0x811842[_0x9909('0x15')]['message']);return _0x4406e5(_0x811842[_0x9909('0x15')][_0x9909('0x18')]);}else{logger['info'](_0x9909('0x17'),_0x343405,_0x9909('0x19'));_0x4406e5(_0x811842[_0x9909('0x1a')]['message']);}})['catch'](function(_0x104a8c){logger[_0x9909('0x15')](_0x9909('0x17'),_0x343405,_0x104a8c);_0x26979e(_0x104a8c);});});} \ No newline at end of file +var _0x8b6d=['jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./dashboard.socket','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dashboard,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8b6d,0x124));var _0xd8b6=function(_0x453baa,_0x46c17a){_0x453baa=_0x453baa-0x0;var _0x39825=_0x8b6d[_0x453baa];return _0x39825;};'use strict';var _=require(_0xd8b6('0x0'));var util=require('util');var moment=require(_0xd8b6('0x1'));var BPromise=require(_0xd8b6('0x2'));var rs=require(_0xd8b6('0x3'));var fs=require('fs');var Redis=require(_0xd8b6('0x4'));var db=require(_0xd8b6('0x5'))['db'];var utils=require(_0xd8b6('0x6'));var logger=require('../../config/logger')(_0xd8b6('0x7'));var config=require('../../config/environment');var jayson=require(_0xd8b6('0x8'));var client=jayson[_0xd8b6('0x9')][_0xd8b6('0xa')]({'port':0x232a});config['redis']=_[_0xd8b6('0xb')](config['redis'],{'host':_0xd8b6('0xc'),'port':0x18eb});var socket=require(_0xd8b6('0xd'))(new Redis(config[_0xd8b6('0xe')]));require(_0xd8b6('0xf'))['register'](socket);function respondWithRpcPromise(_0x104137,_0x5502b4,_0x1eeb9b){return new BPromise(function(_0x3ed5fc,_0x502676){return client['request'](_0x104137,_0x1eeb9b)['then'](function(_0x52f0b8){logger['info']('Dashboard,\x20%s,\x20%s',_0x5502b4,_0xd8b6('0x10'));logger[_0xd8b6('0x11')](_0xd8b6('0x12'),_0x5502b4,_0xd8b6('0x10'),JSON[_0xd8b6('0x13')](_0x52f0b8));if(_0x52f0b8[_0xd8b6('0x14')]){if(_0x52f0b8[_0xd8b6('0x14')][_0xd8b6('0x15')]===0x1f4){logger[_0xd8b6('0x14')]('Dashboard,\x20%s,\x20%s',_0x5502b4,_0x52f0b8[_0xd8b6('0x14')][_0xd8b6('0x16')]);return _0x502676(_0x52f0b8[_0xd8b6('0x14')][_0xd8b6('0x16')]);}logger[_0xd8b6('0x14')](_0xd8b6('0x17'),_0x5502b4,_0x52f0b8[_0xd8b6('0x14')][_0xd8b6('0x16')]);return _0x3ed5fc(_0x52f0b8[_0xd8b6('0x14')][_0xd8b6('0x16')]);}else{logger['info'](_0xd8b6('0x17'),_0x5502b4,_0xd8b6('0x10'));_0x3ed5fc(_0x52f0b8[_0xd8b6('0x18')]['message']);}})['catch'](function(_0x382ac5){logger[_0xd8b6('0x14')]('Dashboard,\x20%s,\x20%s',_0x5502b4,_0x382ac5);_0x502676(_0x382ac5);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 8a920e3..7975dc0 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 _0x5b55=['update','emit','dashboard:','./dashboard.events','save','remove'];(function(_0x10aa73,_0xc744f4){var _0x3496d9=function(_0x71c780){while(--_0x71c780){_0x10aa73['push'](_0x10aa73['shift']());}};_0x3496d9(++_0xc744f4);}(_0x5b55,0xb7));var _0x55b5=function(_0x5d4364,_0x4a6c71){_0x5d4364=_0x5d4364-0x0;var _0x460809=_0x5b55[_0x5d4364];return _0x460809;};'use strict';var DashboardEvents=require(_0x55b5('0x0'));var events=[_0x55b5('0x1'),_0x55b5('0x2'),_0x55b5('0x3')];function createListener(_0x1b3eb8,_0x302d48){return function(_0x4454d9){_0x302d48[_0x55b5('0x4')](_0x1b3eb8,_0x4454d9);};}function removeListener(_0x2ca36e,_0x5896af){return function(){DashboardEvents['removeListener'](_0x2ca36e,_0x5896af);};}exports['register']=function(_0x3dbbc5){for(var _0x3fd8bd=0x0,_0x1c5e28=events['length'];_0x3fd8bd<_0x1c5e28;_0x3fd8bd++){var _0x52a098=events[_0x3fd8bd];var _0x101390=createListener(_0x55b5('0x5')+_0x52a098,_0x3dbbc5);DashboardEvents['on'](_0x52a098,_0x101390);}}; \ No newline at end of file +var _0x0faf=['remove','update','emit','removeListener','register','length','save'];(function(_0x121469,_0x131521){var _0x1390eb=function(_0x399511){while(--_0x399511){_0x121469['push'](_0x121469['shift']());}};_0x1390eb(++_0x131521);}(_0x0faf,0x148));var _0xf0fa=function(_0x10d670,_0x178996){_0x10d670=_0x10d670-0x0;var _0x20d6f8=_0x0faf[_0x10d670];return _0x20d6f8;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xf0fa('0x0'),_0xf0fa('0x1'),_0xf0fa('0x2')];function createListener(_0x571ff2,_0x22069e){return function(_0x291e2d){_0x22069e[_0xf0fa('0x3')](_0x571ff2,_0x291e2d);};}function removeListener(_0x4d8e54,_0x29ed7a){return function(){DashboardEvents[_0xf0fa('0x4')](_0x4d8e54,_0x29ed7a);};}exports[_0xf0fa('0x5')]=function(_0x3c3925){for(var _0x4c9749=0x0,_0x3e863d=events[_0xf0fa('0x6')];_0x4c9749<_0x3e863d;_0x4c9749++){var _0x11d902=events[_0x4c9749];var _0x3d95aa=createListener('dashboard:'+_0x11d902,_0x3c3925);DashboardEvents['on'](_0x11d902,_0x3d95aa);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 85b7b48..d1346ec 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 _0x7cd9=['../../components/auth/service','./dashboard.controller','get','isAuthenticated','index','/:id','show','create','post','/:id/clone','/:id/items','addItem','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x4bdec6,_0x53b478){var _0x19b466=function(_0x4d34b7){while(--_0x4d34b7){_0x4bdec6['push'](_0x4bdec6['shift']());}};_0x19b466(++_0x53b478);}(_0x7cd9,0xb2));var _0x97cd=function(_0x5abbc6,_0x365b5d){_0x5abbc6=_0x5abbc6-0x0;var _0x3d76b9=_0x7cd9[_0x5abbc6];return _0x3d76b9;};'use strict';var multer=require(_0x97cd('0x0'));var util=require(_0x97cd('0x1'));var path=require(_0x97cd('0x2'));var timeout=require('connect-timeout');var express=require(_0x97cd('0x3'));var router=express[_0x97cd('0x4')]();var fs_extra=require(_0x97cd('0x5'));var auth=require(_0x97cd('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x97cd('0x7'));router[_0x97cd('0x8')]('/',auth[_0x97cd('0x9')](),controller[_0x97cd('0xa')]);router[_0x97cd('0x8')](_0x97cd('0xb'),auth[_0x97cd('0x9')](),controller[_0x97cd('0xc')]);router[_0x97cd('0x8')]('/:id/items',auth[_0x97cd('0x9')](),controller['getItems']);router['post']('/',auth['isAuthenticated'](),controller[_0x97cd('0xd')]);router[_0x97cd('0xe')](_0x97cd('0xf'),auth[_0x97cd('0x9')](),controller['clone']);router[_0x97cd('0xe')](_0x97cd('0x10'),auth['isAuthenticated'](),controller[_0x97cd('0x11')]);router[_0x97cd('0x12')](_0x97cd('0xb'),auth[_0x97cd('0x9')](),controller[_0x97cd('0x13')]);router[_0x97cd('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x97cd('0x15')]);module[_0x97cd('0x16')]=router; \ No newline at end of file +var _0x7826=['/:id','show','/:id/items','getItems','create','post','/:id/clone','addItem','update','delete','destroy','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','isAuthenticated','index','get'];(function(_0x3080cd,_0x21a4ea){var _0x2ffe11=function(_0x571203){while(--_0x571203){_0x3080cd['push'](_0x3080cd['shift']());}};_0x2ffe11(++_0x21a4ea);}(_0x7826,0xfd));var _0x6782=function(_0x4971ca,_0x2ae39a){_0x4971ca=_0x4971ca-0x0;var _0x10c18e=_0x7826[_0x4971ca];return _0x10c18e;};'use strict';var multer=require('multer');var util=require(_0x6782('0x0'));var path=require(_0x6782('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6782('0x2')]();var fs_extra=require(_0x6782('0x3'));var auth=require(_0x6782('0x4'));var interaction=require(_0x6782('0x5'));var config=require(_0x6782('0x6'));var controller=require(_0x6782('0x7'));router['get']('/',auth[_0x6782('0x8')](),controller[_0x6782('0x9')]);router[_0x6782('0xa')](_0x6782('0xb'),auth[_0x6782('0x8')](),controller[_0x6782('0xc')]);router['get'](_0x6782('0xd'),auth['isAuthenticated'](),controller[_0x6782('0xe')]);router['post']('/',auth[_0x6782('0x8')](),controller[_0x6782('0xf')]);router[_0x6782('0x10')](_0x6782('0x11'),auth[_0x6782('0x8')](),controller['clone']);router['post'](_0x6782('0xd'),auth[_0x6782('0x8')](),controller[_0x6782('0x12')]);router['put'](_0x6782('0xb'),auth[_0x6782('0x8')](),controller[_0x6782('0x13')]);router[_0x6782('0x14')](_0x6782('0xb'),auth['isAuthenticated'](),controller[_0x6782('0x15')]);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 ef578fe..acefa7a 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 _0xabce=['squel','lodash','exports','STRING','long','parse','getDataValue','attrs','setDataValue','INTEGER','#ffffff','#2196f3','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xabce[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0xeabc('0x0'));var squel=require(_0xeabc('0x1'));var _=require(_0xeabc('0x2'));module[_0xeabc('0x3')]={'title':{'type':Sequelize[_0xeabc('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xeabc('0x5')),'get':function(){try{return JSON[_0xeabc('0x6')](this[_0xeabc('0x7')]('attrs'));}catch(_0x54e4a8){return[];}},'set':function(_0x1b07a8){try{this['setDataValue'](_0xeabc('0x8'),JSON['stringify'](_0x1b07a8));}catch(_0x3bdc29){this[_0xeabc('0x9')](_0xeabc('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xeabc('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xeabc('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xeabc('0xa')]},'col':{'type':Sequelize[_0xeabc('0xa')]},'background':{'type':Sequelize[_0xeabc('0x4')],'allowNull':![],'defaultValue':_0xeabc('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xeabc('0x4')],'allowNull':![],'defaultValue':_0xeabc('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xeabc('0x4')]},'titleFontSize':{'type':Sequelize[_0xeabc('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0xc6ac=['#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0xf5eaa0,_0x5bfa29){var _0x47039e=function(_0x4b47a6){while(--_0x4b47a6){_0xf5eaa0['push'](_0xf5eaa0['shift']());}};_0x47039e(++_0x5bfa29);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4331ea,_0x49c700){_0x4331ea=_0x4331ea-0x0;var _0x4335a8=_0xc6ac[_0x4331ea];return _0x4335a8;};'use strict';var Sequelize=require(_0xcc6a('0x0'));var squel=require(_0xcc6a('0x1'));var _=require(_0xcc6a('0x2'));module[_0xcc6a('0x3')]={'title':{'type':Sequelize[_0xcc6a('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xcc6a('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xcc6a('0x5')](_0xcc6a('0x6')),'get':function(){try{return JSON[_0xcc6a('0x7')](this[_0xcc6a('0x8')](_0xcc6a('0x9')));}catch(_0x188b05){return[];}},'set':function(_0x12330e){try{this[_0xcc6a('0xa')]('attrs',JSON[_0xcc6a('0xb')](_0x12330e));}catch(_0x11b919){this[_0xcc6a('0xa')]('attrs',JSON[_0xcc6a('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0xcc6a('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xcc6a('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xcc6a('0xc')]},'col':{'type':Sequelize[_0xcc6a('0xc')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcc6a('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xcc6a('0x4')],'allowNull':![],'defaultValue':_0xcc6a('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xcc6a('0xc')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index eaf1248..8815f99 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 _0x103f=['HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','localhost','redis','./dashboardItem.socket','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','show','DashboardItem','query','keys','model','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','params','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x103f,0x13e));var _0xf103=function(_0x5717f6,_0x889b3d){_0x5717f6=_0x5717f6-0x0;var _0x1ebe78=_0x103f[_0x5717f6];return _0x1ebe78;};'use strict';var emlformat=require(_0xf103('0x0'));var rimraf=require(_0xf103('0x1'));var zipdir=require(_0xf103('0x2'));var jsonpatch=require(_0xf103('0x3'));var rp=require(_0xf103('0x4'));var moment=require(_0xf103('0x5'));var BPromise=require(_0xf103('0x6'));var Mustache=require(_0xf103('0x7'));var util=require(_0xf103('0x8'));var path=require(_0xf103('0x9'));var sox=require('sox');var csv=require(_0xf103('0xa'));var ejs=require(_0xf103('0xb'));var fs=require('fs');var fs_extra=require(_0xf103('0xc'));var _=require(_0xf103('0xd'));var squel=require(_0xf103('0xe'));var crypto=require(_0xf103('0xf'));var jsforce=require(_0xf103('0x10'));var deskjs=require(_0xf103('0x11'));var toCsv=require(_0xf103('0xa'));var querystring=require(_0xf103('0x12'));var Papa=require(_0xf103('0x13'));var Redis=require(_0xf103('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xf103('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf103('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xf103('0x17'));var config=require(_0xf103('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf103('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xf103('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf103('0x1b')]));require(_0xf103('0x1c'))['register'](socket);function respondWithStatusCode(_0x189a41,_0x3d77bb){_0x3d77bb=_0x3d77bb||0xcc;return function(_0x587a54){if(_0x587a54){return _0x189a41[_0xf103('0x1d')](_0x3d77bb);}return _0x189a41[_0xf103('0x1e')](_0x3d77bb)['end']();};}function respondWithResult(_0x13be78,_0x49d07f){_0x49d07f=_0x49d07f||0xc8;return function(_0x4a1a87){if(_0x4a1a87){return _0x13be78[_0xf103('0x1e')](_0x49d07f)[_0xf103('0x1f')](_0x4a1a87);}};}function respondWithFilteredResult(_0x31e26e,_0x33d0fc){return function(_0x1659fa){if(_0x1659fa){var _0x2fbf42=typeof _0x33d0fc['offset']===_0xf103('0x20')&&typeof _0x33d0fc[_0xf103('0x21')]==='undefined';var _0x21ea69=_0x1659fa[_0xf103('0x22')];var _0x280aeb=_0x2fbf42?0x0:_0x33d0fc[_0xf103('0x23')];var _0xebb4ae=_0x2fbf42?_0x1659fa['count']:_0x33d0fc[_0xf103('0x23')]+_0x33d0fc[_0xf103('0x21')];var _0x467b15;if(_0xebb4ae>=_0x21ea69){_0xebb4ae=_0x21ea69;_0x467b15=0xc8;}else{_0x467b15=0xce;}_0x31e26e[_0xf103('0x1e')](_0x467b15);return _0x31e26e[_0xf103('0x24')](_0xf103('0x25'),_0x280aeb+'-'+_0xebb4ae+'/'+_0x21ea69)[_0xf103('0x1f')](_0x1659fa);}return null;};}function patchUpdates(_0x111e83){return function(_0x4aefdf){try{jsonpatch[_0xf103('0x26')](_0x4aefdf,_0x111e83,!![]);}catch(_0x4fab08){return BPromise[_0xf103('0x27')](_0x4fab08);}return _0x4aefdf['save']();};}function saveUpdates(_0x3a8d9e,_0x22c8b5){return function(_0x287998){if(_0x287998){return _0x287998[_0xf103('0x28')](_0x3a8d9e)[_0xf103('0x29')](function(_0x297198){return _0x297198;});}return null;};}function removeEntity(_0x23a122,_0x259797){return function(_0x4f24bd){if(_0x4f24bd){return _0x4f24bd[_0xf103('0x2a')]()['then'](function(){_0x23a122[_0xf103('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4423a4,_0x3352e8){return function(_0x3a807f){if(!_0x3a807f){_0x4423a4[_0xf103('0x1d')](0x194);}return _0x3a807f;};}function handleError(_0x54d590,_0x43b9b5){_0x43b9b5=_0x43b9b5||0x1f4;return function(_0x1d3cdd){logger[_0xf103('0x2b')](_0x1d3cdd['stack']);if(_0x1d3cdd['name']){delete _0x1d3cdd[_0xf103('0x2c')];}_0x54d590[_0xf103('0x1e')](_0x43b9b5)['send'](_0x1d3cdd);};}exports[_0xf103('0x2d')]=function(_0x1458ac,_0x2fab93){var _0x65b43d={'raw':![],'where':{'id':_0x1458ac['params']['id']}},_0x5becbe={};_0x5becbe['model']=_['keys'](db[_0xf103('0x2e')]['rawAttributes']);_0x5becbe[_0xf103('0x2f')]=_[_0xf103('0x30')](_0x1458ac[_0xf103('0x2f')]);_0x5becbe['filters']=_['intersection'](_0x5becbe[_0xf103('0x31')],_0x5becbe[_0xf103('0x2f')]);_0x65b43d['attributes']=_[_0xf103('0x32')](_0x5becbe[_0xf103('0x31')],qs[_0xf103('0x33')](_0x1458ac[_0xf103('0x2f')][_0xf103('0x33')]));_0x65b43d[_0xf103('0x34')]=_0x65b43d[_0xf103('0x34')][_0xf103('0x35')]?_0x65b43d[_0xf103('0x34')]:_0x5becbe[_0xf103('0x31')];if(_0x1458ac[_0xf103('0x2f')][_0xf103('0x36')]){_0x65b43d[_0xf103('0x37')]=[{'all':!![]}];}_0x65b43d=_[_0xf103('0x38')]({},_0x65b43d,_0x1458ac[_0xf103('0x39')]);return db[_0xf103('0x2e')][_0xf103('0x3a')](_0x65b43d)['then'](handleEntityNotFound(_0x2fab93,null))[_0xf103('0x29')](respondWithResult(_0x2fab93,null))[_0xf103('0x3b')](handleError(_0x2fab93,null));};exports[_0xf103('0x2a')]=function(_0x4d5755,_0x39101d){return db['DashboardItem']['find']({'where':{'id':_0x4d5755[_0xf103('0x3c')]['id']}})[_0xf103('0x29')](handleEntityNotFound(_0x39101d,null))[_0xf103('0x29')](removeEntity(_0x39101d,null))[_0xf103('0x3b')](handleError(_0x39101d,null));};function widgetAttributes(_0x192a0d){try{switch(_0x192a0d[_0xf103('0x3d')]){case _0xf103('0x3e'):return[{'name':_0xf103('0x3f'),'value':_0x192a0d[_0xf103('0x3f')]||(_0x192a0d['attrs']&&_0x192a0d[_0xf103('0x40')][0x0]?_0x192a0d[_0xf103('0x40')][0x0][_0xf103('0x41')]:undefined)||'https://'}];case _0xf103('0x42'):return[{'name':_0xf103('0x43'),'value':_0x192a0d[_0xf103('0x43')]||(_0x192a0d['attrs']&&_0x192a0d[_0xf103('0x40')][0x0]?_0x192a0d[_0xf103('0x40')][0x0][_0xf103('0x41')]:undefined)||''}];case _0xf103('0x44'):return[{'name':_0xf103('0x45'),'value':_0x192a0d['attrHourFormat']||(_0x192a0d['attrs']&&_0x192a0d[_0xf103('0x40')][0x0]?_0x192a0d[_0xf103('0x40')][0x0][_0xf103('0x41')]:undefined)||_0xf103('0x46')},{'name':_0xf103('0x47'),'value':_0x192a0d[_0xf103('0x47')]||(_0x192a0d[_0xf103('0x40')]&&_0x192a0d[_0xf103('0x40')][0x1]?_0x192a0d[_0xf103('0x40')][0x1][_0xf103('0x41')]:undefined)||_0xf103('0x48')},{'name':_0xf103('0x49'),'value':_0x192a0d[_0xf103('0x49')]||(_0x192a0d[_0xf103('0x40')]&&_0x192a0d[_0xf103('0x40')][0x2]?_0x192a0d[_0xf103('0x40')][0x2][_0xf103('0x41')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x192a0d[_0xf103('0x4a')]||(_0x192a0d[_0xf103('0x40')]&&_0x192a0d['attrs'][0x0]?_0x192a0d[_0xf103('0x40')][0x0][_0xf103('0x41')]:undefined)||_0xf103('0x4b')},{'name':_0xf103('0x4c'),'value':_0x192a0d[_0xf103('0x4c')]||(_0x192a0d['attrs']&&_0x192a0d[_0xf103('0x40')][0x1]?_0x192a0d[_0xf103('0x40')][0x1]['value']:undefined)||[]},{'name':_0xf103('0x49'),'value':_0x192a0d[_0xf103('0x49')]||(_0x192a0d[_0xf103('0x40')]&&_0x192a0d[_0xf103('0x40')][0x2]?_0x192a0d[_0xf103('0x40')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x192a0d['attrChannel']||(_0x192a0d['attrs']&&_0x192a0d[_0xf103('0x40')][0x3]?_0x192a0d[_0xf103('0x40')][0x3][_0xf103('0x41')]:undefined)||_0xf103('0x4d')},{'name':_0xf103('0x4e'),'value':_0x192a0d[_0xf103('0x4e')]||(_0x192a0d[_0xf103('0x40')]&&_0x192a0d[_0xf103('0x40')][0x4]?_0x192a0d[_0xf103('0x40')][0x4][_0xf103('0x41')]:undefined)||''},{'name':_0xf103('0x4f'),'value':_0x192a0d[_0xf103('0x4f')]||(_0x192a0d[_0xf103('0x40')]&&_0x192a0d['attrs'][0x5]?_0x192a0d[_0xf103('0x40')][0x5][_0xf103('0x41')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x192a0d[_0xf103('0x50')]||(_0x192a0d['attrs']&&_0x192a0d[_0xf103('0x40')][0x6]?_0x192a0d[_0xf103('0x40')][0x6][_0xf103('0x41')]:undefined)||''},{'name':_0xf103('0x51'),'value':_0x192a0d[_0xf103('0x51')]||(_0x192a0d['attrs']&&_0x192a0d[_0xf103('0x40')][0x7]?_0x192a0d['attrs'][0x7][_0xf103('0x41')]:undefined)||''},{'name':_0xf103('0x52'),'value':_0x192a0d['attrWhatsappAccounts']||(_0x192a0d['attrs']&&_0x192a0d[_0xf103('0x40')][0x8]?_0x192a0d[_0xf103('0x40')][0x8][_0xf103('0x41')]:undefined)||''},{'name':_0xf103('0x53'),'value':_0x192a0d[_0xf103('0x53')]||(_0x192a0d['attrs']&&_0x192a0d[_0xf103('0x40')][0x9]?_0x192a0d[_0xf103('0x40')][0x9]['value']:undefined)||''}];case _0xf103('0x54'):case _0xf103('0x55'):return[{'name':_0xf103('0x56'),'value':_0x192a0d[_0xf103('0x56')]||(_0x192a0d[_0xf103('0x40')]&&_0x192a0d['attrs'][0x0]?_0x192a0d[_0xf103('0x40')][0x0][_0xf103('0x41')]:undefined)||_0xf103('0x4b')},{'name':_0xf103('0x57'),'value':_0x192a0d[_0xf103('0x57')]||(_0x192a0d['attrs']&&_0x192a0d['attrs'][0x1]?_0x192a0d[_0xf103('0x40')][0x1][_0xf103('0x41')]:undefined)||null},{'name':_0xf103('0x58'),'value':_0x192a0d[_0xf103('0x58')]||(_0x192a0d[_0xf103('0x40')]&&_0x192a0d[_0xf103('0x40')][0x2]?_0x192a0d['attrs'][0x2]['value']:undefined)||null},{'name':_0xf103('0x4c'),'value':_0x192a0d[_0xf103('0x4c')]||(_0x192a0d[_0xf103('0x40')]&&_0x192a0d[_0xf103('0x40')][0x3]?_0x192a0d[_0xf103('0x40')][0x3][_0xf103('0x41')]:undefined)||[]},{'name':_0xf103('0x59'),'value':_0x192a0d[_0xf103('0x59')]||(_0x192a0d[_0xf103('0x40')]&&_0x192a0d[_0xf103('0x40')][0x4]?_0x192a0d[_0xf103('0x40')][0x4][_0xf103('0x41')]:undefined)||_0xf103('0x4d')},{'name':'attrEmailAccounts','value':_0x192a0d[_0xf103('0x4e')]||(_0x192a0d['attrs']&&_0x192a0d[_0xf103('0x40')][0x5]?_0x192a0d[_0xf103('0x40')][0x5][_0xf103('0x41')]:undefined)||''},{'name':_0xf103('0x4f'),'value':_0x192a0d[_0xf103('0x4f')]||(_0x192a0d['attrs']&&_0x192a0d['attrs'][0x6]?_0x192a0d[_0xf103('0x40')][0x6][_0xf103('0x41')]:undefined)||''},{'name':_0xf103('0x50'),'value':_0x192a0d[_0xf103('0x50')]||(_0x192a0d[_0xf103('0x40')]&&_0x192a0d[_0xf103('0x40')][0x7]?_0x192a0d['attrs'][0x7][_0xf103('0x41')]:undefined)||''},{'name':_0xf103('0x51'),'value':_0x192a0d[_0xf103('0x51')]||(_0x192a0d[_0xf103('0x40')]&&_0x192a0d[_0xf103('0x40')][0x8]?_0x192a0d[_0xf103('0x40')][0x8][_0xf103('0x41')]:undefined)||''},{'name':_0xf103('0x52'),'value':_0x192a0d[_0xf103('0x52')]||(_0x192a0d[_0xf103('0x40')]&&_0x192a0d[_0xf103('0x40')][0x9]?_0x192a0d[_0xf103('0x40')][0x9][_0xf103('0x41')]:undefined)||''},{'name':'attrChatWebsites','value':_0x192a0d['attrChatWebsites']||(_0x192a0d[_0xf103('0x40')]&&_0x192a0d[_0xf103('0x40')][0xa]?_0x192a0d['attrs'][0xa][_0xf103('0x41')]:undefined)||''}];case _0xf103('0x5a'):return[{'name':_0xf103('0x5b'),'type':_0x192a0d[_0xf103('0x5c')]||(_0x192a0d[_0xf103('0x40')]&&_0x192a0d[_0xf103('0x40')][0x0]?_0x192a0d[_0xf103('0x40')][0x0][_0xf103('0x3d')]:undefined)||null,'value':_0x192a0d[_0xf103('0x5b')]||(_0x192a0d[_0xf103('0x40')]&&_0x192a0d[_0xf103('0x40')][0x0]?_0x192a0d['attrs'][0x0]['value']:undefined)||null},{'name':_0xf103('0x5d'),'value':_0x192a0d[_0xf103('0x5d')]||(_0x192a0d[_0xf103('0x40')]&&_0x192a0d[_0xf103('0x40')][0x1]?_0x192a0d[_0xf103('0x40')][0x1][_0xf103('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x4776d8){logger[_0xf103('0x2b')](_0xf103('0x5e'),JSON['stringify'](_0x4776d8));return[];}}exports[_0xf103('0x5f')]=function(_0x3ecd72,_0x5bb322){if(_0x3ecd72['body']){_0x3ecd72['body'][_0xf103('0x40')]=widgetAttributes(_0x3ecd72['body']);}return db[_0xf103('0x2e')][_0xf103('0x5f')](_0x3ecd72[_0xf103('0x60')],{})[_0xf103('0x29')](respondWithResult(_0x5bb322,0xc9))[_0xf103('0x3b')](handleError(_0x5bb322,null));};exports[_0xf103('0x28')]=function(_0x12094e,_0x2d7880){if(_0x12094e[_0xf103('0x60')]['id']){delete _0x12094e[_0xf103('0x60')]['id'];}_0x12094e[_0xf103('0x60')]['attrs']=widgetAttributes(_0x12094e[_0xf103('0x60')]);return db[_0xf103('0x2e')][_0xf103('0x3a')]({'where':{'id':_0x12094e['params']['id']}})[_0xf103('0x29')](handleEntityNotFound(_0x2d7880,null))[_0xf103('0x29')](saveUpdates(_0x12094e[_0xf103('0x60')],null))[_0xf103('0x29')](respondWithResult(_0x2d7880,null))[_0xf103('0x3b')](handleError(_0x2d7880,null));}; \ No newline at end of file +var _0xf03a=['pie-chart','attrSerie1','attrSerie3','attrWhatsappAccounts','web-report','attrReport','reportType','attrRefresh','stringify','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./dashboardItem.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','destroy','then','error','stack','name','send','show','params','keys','rawAttributes','query','filters','intersection','model','fields','length','attributes','include','merge','options','DashboardItem','catch','find','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart'];(function(_0x156458,_0x3e0f5e){var _0xc81ae7=function(_0x1600fc){while(--_0x1600fc){_0x156458['push'](_0x156458['shift']());}};_0xc81ae7(++_0x3e0f5e);}(_0xf03a,0x1a0));var _0xaf03=function(_0x309b59,_0x4eceb6){_0x309b59=_0x309b59-0x0;var _0x369c42=_0xf03a[_0x309b59];return _0x369c42;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf03('0x0'));var zipdir=require(_0xaf03('0x1'));var jsonpatch=require(_0xaf03('0x2'));var rp=require(_0xaf03('0x3'));var moment=require('moment');var BPromise=require(_0xaf03('0x4'));var Mustache=require(_0xaf03('0x5'));var util=require('util');var path=require(_0xaf03('0x6'));var sox=require(_0xaf03('0x7'));var csv=require(_0xaf03('0x8'));var ejs=require(_0xaf03('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaf03('0xa'));var squel=require('squel');var crypto=require(_0xaf03('0xb'));var jsforce=require(_0xaf03('0xc'));var deskjs=require(_0xaf03('0xd'));var toCsv=require(_0xaf03('0x8'));var querystring=require(_0xaf03('0xe'));var Papa=require(_0xaf03('0xf'));var Redis=require('ioredis');var authService=require(_0xaf03('0x10'));var qs=require(_0xaf03('0x11'));var as=require(_0xaf03('0x12'));var hardwareService=require(_0xaf03('0x13'));var logger=require(_0xaf03('0x14'))('api');var utils=require(_0xaf03('0x15'));var config=require(_0xaf03('0x16'));var licenseUtil=require(_0xaf03('0x17'));var db=require(_0xaf03('0x18'))['db'];config[_0xaf03('0x19')]=_[_0xaf03('0x1a')](config[_0xaf03('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaf03('0x19')]));require(_0xaf03('0x1b'))[_0xaf03('0x1c')](socket);function respondWithStatusCode(_0x550e22,_0x50bbf6){_0x50bbf6=_0x50bbf6||0xcc;return function(_0x38ae35){if(_0x38ae35){return _0x550e22[_0xaf03('0x1d')](_0x50bbf6);}return _0x550e22[_0xaf03('0x1e')](_0x50bbf6)[_0xaf03('0x1f')]();};}function respondWithResult(_0x342f7a,_0x3902d7){_0x3902d7=_0x3902d7||0xc8;return function(_0x533699){if(_0x533699){return _0x342f7a[_0xaf03('0x1e')](_0x3902d7)[_0xaf03('0x20')](_0x533699);}};}function respondWithFilteredResult(_0x12bd6,_0x3620c6){return function(_0x24a074){if(_0x24a074){var _0x27e625=typeof _0x3620c6['offset']==='undefined'&&typeof _0x3620c6[_0xaf03('0x21')]===_0xaf03('0x22');var _0x3f5064=_0x24a074[_0xaf03('0x23')];var _0xfc2e57=_0x27e625?0x0:_0x3620c6['offset'];var _0x43a4a4=_0x27e625?_0x24a074['count']:_0x3620c6[_0xaf03('0x24')]+_0x3620c6[_0xaf03('0x21')];var _0x9e28b4;if(_0x43a4a4>=_0x3f5064){_0x43a4a4=_0x3f5064;_0x9e28b4=0xc8;}else{_0x9e28b4=0xce;}_0x12bd6[_0xaf03('0x1e')](_0x9e28b4);return _0x12bd6[_0xaf03('0x25')](_0xaf03('0x26'),_0xfc2e57+'-'+_0x43a4a4+'/'+_0x3f5064)[_0xaf03('0x20')](_0x24a074);}return null;};}function patchUpdates(_0x1cefca){return function(_0x32370d){try{jsonpatch[_0xaf03('0x27')](_0x32370d,_0x1cefca,!![]);}catch(_0x1e8cac){return BPromise['reject'](_0x1e8cac);}return _0x32370d[_0xaf03('0x28')]();};}function saveUpdates(_0x1ab68b,_0x2bc68d){return function(_0x21b865){if(_0x21b865){return _0x21b865['update'](_0x1ab68b)['then'](function(_0x38aa61){return _0x38aa61;});}return null;};}function removeEntity(_0x382e43,_0x4db61b){return function(_0x245ad7){if(_0x245ad7){return _0x245ad7[_0xaf03('0x29')]()[_0xaf03('0x2a')](function(){_0x382e43[_0xaf03('0x1e')](0xcc)[_0xaf03('0x1f')]();});}};}function handleEntityNotFound(_0x148227,_0x5bb6a7){return function(_0x50ec36){if(!_0x50ec36){_0x148227[_0xaf03('0x1d')](0x194);}return _0x50ec36;};}function handleError(_0x385aa9,_0xe104c2){_0xe104c2=_0xe104c2||0x1f4;return function(_0x166a23){logger[_0xaf03('0x2b')](_0x166a23[_0xaf03('0x2c')]);if(_0x166a23[_0xaf03('0x2d')]){delete _0x166a23[_0xaf03('0x2d')];}_0x385aa9[_0xaf03('0x1e')](_0xe104c2)[_0xaf03('0x2e')](_0x166a23);};}exports[_0xaf03('0x2f')]=function(_0x1d75f5,_0xe05319){var _0x5be2ab={'raw':![],'where':{'id':_0x1d75f5[_0xaf03('0x30')]['id']}},_0x38f1ea={};_0x38f1ea['model']=_[_0xaf03('0x31')](db['DashboardItem'][_0xaf03('0x32')]);_0x38f1ea[_0xaf03('0x33')]=_[_0xaf03('0x31')](_0x1d75f5[_0xaf03('0x33')]);_0x38f1ea[_0xaf03('0x34')]=_[_0xaf03('0x35')](_0x38f1ea['model'],_0x38f1ea[_0xaf03('0x33')]);_0x5be2ab['attributes']=_[_0xaf03('0x35')](_0x38f1ea[_0xaf03('0x36')],qs[_0xaf03('0x37')](_0x1d75f5[_0xaf03('0x33')]['fields']));_0x5be2ab['attributes']=_0x5be2ab['attributes'][_0xaf03('0x38')]?_0x5be2ab[_0xaf03('0x39')]:_0x38f1ea[_0xaf03('0x36')];if(_0x1d75f5[_0xaf03('0x33')]['includeAll']){_0x5be2ab[_0xaf03('0x3a')]=[{'all':!![]}];}_0x5be2ab=_[_0xaf03('0x3b')]({},_0x5be2ab,_0x1d75f5[_0xaf03('0x3c')]);return db[_0xaf03('0x3d')]['find'](_0x5be2ab)[_0xaf03('0x2a')](handleEntityNotFound(_0xe05319,null))['then'](respondWithResult(_0xe05319,null))[_0xaf03('0x3e')](handleError(_0xe05319,null));};exports[_0xaf03('0x29')]=function(_0xd08544,_0x4e29c2){return db[_0xaf03('0x3d')][_0xaf03('0x3f')]({'where':{'id':_0xd08544[_0xaf03('0x30')]['id']}})[_0xaf03('0x2a')](handleEntityNotFound(_0x4e29c2,null))[_0xaf03('0x2a')](removeEntity(_0x4e29c2,null))['catch'](handleError(_0x4e29c2,null));};function widgetAttributes(_0x2a72fd){try{switch(_0x2a72fd[_0xaf03('0x40')]){case _0xaf03('0x41'):return[{'name':_0xaf03('0x42'),'value':_0x2a72fd[_0xaf03('0x42')]||(_0x2a72fd['attrs']&&_0x2a72fd[_0xaf03('0x43')][0x0]?_0x2a72fd['attrs'][0x0][_0xaf03('0x44')]:undefined)||_0xaf03('0x45')}];case _0xaf03('0x46'):return[{'name':_0xaf03('0x47'),'value':_0x2a72fd['attrPath']||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x0]?_0x2a72fd[_0xaf03('0x43')][0x0][_0xaf03('0x44')]:undefined)||''}];case _0xaf03('0x48'):return[{'name':_0xaf03('0x49'),'value':_0x2a72fd[_0xaf03('0x49')]||(_0x2a72fd['attrs']&&_0x2a72fd['attrs'][0x0]?_0x2a72fd[_0xaf03('0x43')][0x0]['value']:undefined)||_0xaf03('0x4a')},{'name':_0xaf03('0x4b'),'value':_0x2a72fd[_0xaf03('0x4b')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x1]?_0x2a72fd['attrs'][0x1][_0xaf03('0x44')]:undefined)||_0xaf03('0x4c')},{'name':_0xaf03('0x4d'),'value':_0x2a72fd[_0xaf03('0x4d')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x2]?_0x2a72fd[_0xaf03('0x43')][0x2][_0xaf03('0x44')]:undefined)||0xc}];case'counter':return[{'name':_0xaf03('0x4e'),'value':_0x2a72fd[_0xaf03('0x4e')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x0]?_0x2a72fd['attrs'][0x0][_0xaf03('0x44')]:undefined)||_0xaf03('0x4f')},{'name':_0xaf03('0x50'),'value':_0x2a72fd[_0xaf03('0x50')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x1]?_0x2a72fd['attrs'][0x1][_0xaf03('0x44')]:undefined)||[]},{'name':_0xaf03('0x4d'),'value':_0x2a72fd[_0xaf03('0x4d')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd['attrs'][0x2]?_0x2a72fd[_0xaf03('0x43')][0x2][_0xaf03('0x44')]:undefined)||0x14},{'name':_0xaf03('0x51'),'value':_0x2a72fd[_0xaf03('0x51')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x3]?_0x2a72fd[_0xaf03('0x43')][0x3]['value']:undefined)||_0xaf03('0x52')},{'name':_0xaf03('0x53'),'value':_0x2a72fd[_0xaf03('0x53')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd['attrs'][0x4]?_0x2a72fd[_0xaf03('0x43')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x2a72fd[_0xaf03('0x54')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x5]?_0x2a72fd['attrs'][0x5][_0xaf03('0x44')]:undefined)||''},{'name':_0xaf03('0x55'),'value':_0x2a72fd['attrSmsAccounts']||(_0x2a72fd['attrs']&&_0x2a72fd[_0xaf03('0x43')][0x6]?_0x2a72fd[_0xaf03('0x43')][0x6][_0xaf03('0x44')]:undefined)||''},{'name':_0xaf03('0x56'),'value':_0x2a72fd[_0xaf03('0x56')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x7]?_0x2a72fd['attrs'][0x7][_0xaf03('0x44')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2a72fd['attrWhatsappAccounts']||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x8]?_0x2a72fd[_0xaf03('0x43')][0x8][_0xaf03('0x44')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2a72fd[_0xaf03('0x57')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x9]?_0x2a72fd[_0xaf03('0x43')][0x9][_0xaf03('0x44')]:undefined)||''}];case _0xaf03('0x58'):case _0xaf03('0x59'):return[{'name':_0xaf03('0x5a'),'value':_0x2a72fd[_0xaf03('0x5a')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x0]?_0x2a72fd[_0xaf03('0x43')][0x0]['value']:undefined)||_0xaf03('0x4f')},{'name':'attrSerie2','value':_0x2a72fd['attrSerie2']||(_0x2a72fd['attrs']&&_0x2a72fd[_0xaf03('0x43')][0x1]?_0x2a72fd['attrs'][0x1]['value']:undefined)||null},{'name':_0xaf03('0x5b'),'value':_0x2a72fd[_0xaf03('0x5b')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x2]?_0x2a72fd[_0xaf03('0x43')][0x2][_0xaf03('0x44')]:undefined)||null},{'name':_0xaf03('0x50'),'value':_0x2a72fd[_0xaf03('0x50')]||(_0x2a72fd['attrs']&&_0x2a72fd[_0xaf03('0x43')][0x3]?_0x2a72fd[_0xaf03('0x43')][0x3][_0xaf03('0x44')]:undefined)||[]},{'name':'attrChannel','value':_0x2a72fd[_0xaf03('0x51')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x4]?_0x2a72fd[_0xaf03('0x43')][0x4]['value']:undefined)||_0xaf03('0x52')},{'name':_0xaf03('0x53'),'value':_0x2a72fd['attrEmailAccounts']||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x5]?_0x2a72fd[_0xaf03('0x43')][0x5]['value']:undefined)||''},{'name':_0xaf03('0x54'),'value':_0x2a72fd[_0xaf03('0x54')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x6]?_0x2a72fd[_0xaf03('0x43')][0x6]['value']:undefined)||''},{'name':_0xaf03('0x55'),'value':_0x2a72fd[_0xaf03('0x55')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x7]?_0x2a72fd['attrs'][0x7][_0xaf03('0x44')]:undefined)||''},{'name':_0xaf03('0x56'),'value':_0x2a72fd[_0xaf03('0x56')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x8]?_0x2a72fd[_0xaf03('0x43')][0x8]['value']:undefined)||''},{'name':_0xaf03('0x5c'),'value':_0x2a72fd[_0xaf03('0x5c')]||(_0x2a72fd['attrs']&&_0x2a72fd[_0xaf03('0x43')][0x9]?_0x2a72fd['attrs'][0x9][_0xaf03('0x44')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2a72fd[_0xaf03('0x57')]||(_0x2a72fd['attrs']&&_0x2a72fd['attrs'][0xa]?_0x2a72fd[_0xaf03('0x43')][0xa][_0xaf03('0x44')]:undefined)||''}];case _0xaf03('0x5d'):return[{'name':_0xaf03('0x5e'),'type':_0x2a72fd[_0xaf03('0x5f')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x0]?_0x2a72fd[_0xaf03('0x43')][0x0]['type']:undefined)||null,'value':_0x2a72fd[_0xaf03('0x5e')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd['attrs'][0x0]?_0x2a72fd['attrs'][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x2a72fd[_0xaf03('0x60')]||(_0x2a72fd[_0xaf03('0x43')]&&_0x2a72fd[_0xaf03('0x43')][0x1]?_0x2a72fd[_0xaf03('0x43')][0x1][_0xaf03('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x49a9fc){logger[_0xaf03('0x2b')]('widgetAttributes:\x20%s',JSON[_0xaf03('0x61')](_0x49a9fc));return[];}}exports[_0xaf03('0x62')]=function(_0x56880c,_0x2b8b39){if(_0x56880c[_0xaf03('0x63')]){_0x56880c[_0xaf03('0x63')]['attrs']=widgetAttributes(_0x56880c[_0xaf03('0x63')]);}return db[_0xaf03('0x3d')]['create'](_0x56880c[_0xaf03('0x63')],{})['then'](respondWithResult(_0x2b8b39,0xc9))[_0xaf03('0x3e')](handleError(_0x2b8b39,null));};exports[_0xaf03('0x64')]=function(_0x13c9b9,_0x199523){if(_0x13c9b9['body']['id']){delete _0x13c9b9['body']['id'];}_0x13c9b9[_0xaf03('0x63')]['attrs']=widgetAttributes(_0x13c9b9[_0xaf03('0x63')]);return db[_0xaf03('0x3d')][_0xaf03('0x3f')]({'where':{'id':_0x13c9b9[_0xaf03('0x30')]['id']}})['then'](handleEntityNotFound(_0x199523,null))['then'](saveUpdates(_0x13c9b9['body'],null))[_0xaf03('0x2a')](respondWithResult(_0x199523,null))[_0xaf03('0x3e')](handleError(_0x199523,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index eb277f9..0bd8869 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 _0x10ac=['hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x5addf7,_0x50785e){var _0xb0746a=function(_0x2ee32b){while(--_0x2ee32b){_0x5addf7['push'](_0x5addf7['shift']());}};_0xb0746a(++_0x50785e);}(_0x10ac,0x192));var _0xc10a=function(_0x446f11,_0x95cf21){_0x446f11=_0x446f11-0x0;var _0x385cb5=_0x10ac[_0x446f11];return _0x385cb5;};'use strict';var EventEmitter=require(_0xc10a('0x0'));var DashboardItem=require(_0xc10a('0x1'))['db'][_0xc10a('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xc10a('0x3')](0x0);var events={'afterCreate':_0xc10a('0x4'),'afterUpdate':'update','afterDestroy':_0xc10a('0x5')};function emitEvent(_0x5e55ff){return function(_0x5c4403,_0x586591,_0x23ec66){DashboardItemEvents[_0xc10a('0x6')](_0x5e55ff+':'+_0x5c4403['id'],_0x5c4403);DashboardItemEvents[_0xc10a('0x6')](_0x5e55ff,_0x5c4403);_0x23ec66(null);};}for(var e in events){if(events[_0xc10a('0x7')](e)){var event=events[e];DashboardItem[_0xc10a('0x8')](e,emitEvent(event));}}module[_0xc10a('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x8b06=['DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8b06,0xb2));var _0x68b0=function(_0x15fe00,_0x128d18){_0x15fe00=_0x15fe00-0x0;var _0x3043dc=_0x8b06[_0x15fe00];return _0x3043dc;};'use strict';var EventEmitter=require(_0x68b0('0x0'));var DashboardItem=require(_0x68b0('0x1'))['db'][_0x68b0('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x68b0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x68b0('0x4'),'afterDestroy':_0x68b0('0x5')};function emitEvent(_0x11af49){return function(_0x20b28e,_0x2926f7,_0x5ca64f){DashboardItemEvents[_0x68b0('0x6')](_0x11af49+':'+_0x20b28e['id'],_0x20b28e);DashboardItemEvents['emit'](_0x11af49,_0x20b28e);_0x5ca64f(null);};}for(var e in events){if(events[_0x68b0('0x7')](e)){var event=events[e];DashboardItem[_0x68b0('0x8')](e,emitEvent(event));}}module[_0x68b0('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 601d53b..a039a6a 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 _0xb358=['request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','util','../../config/logger','bluebird'];(function(_0x351e18,_0x22e3c0){var _0x1abbca=function(_0x253fb6){while(--_0x253fb6){_0x351e18['push'](_0x351e18['shift']());}};_0x1abbca(++_0x22e3c0);}(_0xb358,0x1b5));var _0x8b35=function(_0x9fc076,_0x1fa138){_0x9fc076=_0x9fc076-0x0;var _0x309ca6=_0xb358[_0x9fc076];return _0x309ca6;};'use strict';var _=require('lodash');var util=require(_0x8b35('0x0'));var logger=require(_0x8b35('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8b35('0x2'));var rp=require(_0x8b35('0x3'));var fs=require('fs');var path=require(_0x8b35('0x4'));var rimraf=require(_0x8b35('0x5'));var config=require(_0x8b35('0x6'));var attributes=require(_0x8b35('0x7'));module[_0x8b35('0x8')]=function(_0x249e2e,_0x122a86){return _0x249e2e['define'](_0x8b35('0x9'),attributes,{'tableName':_0x8b35('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5a7=['rimraf','../../config/environment','exports','define','DashboardItem','dashboard_items','lodash','util','api','moment','request-promise','path'];(function(_0x168127,_0x59cea1){var _0x4c99ad=function(_0x4ab3f2){while(--_0x4ab3f2){_0x168127['push'](_0x168127['shift']());}};_0x4c99ad(++_0x59cea1);}(_0xf5a7,0xba));var _0x7f5a=function(_0x4640a9,_0x130a84){_0x4640a9=_0x4640a9-0x0;var _0x13736b=_0xf5a7[_0x4640a9];return _0x13736b;};'use strict';var _=require(_0x7f5a('0x0'));var util=require(_0x7f5a('0x1'));var logger=require('../../config/logger')(_0x7f5a('0x2'));var moment=require(_0x7f5a('0x3'));var BPromise=require('bluebird');var rp=require(_0x7f5a('0x4'));var fs=require('fs');var path=require(_0x7f5a('0x5'));var rimraf=require(_0x7f5a('0x6'));var config=require(_0x7f5a('0x7'));var attributes=require('./dashboardItem.attributes');module[_0x7f5a('0x8')]=function(_0x194472,_0x3e0463){return _0x194472[_0x7f5a('0x9')](_0x7f5a('0xa'),attributes,{'tableName':_0x7f5a('0xb'),'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 17ee496..0e613bb 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 _0x61fc=['catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x61fc,0x1d5));var _0xc61f=function(_0x20a1bd,_0x1e84f5){_0x20a1bd=_0x20a1bd-0x0;var _0x2b9b44=_0x61fc[_0x20a1bd];return _0x2b9b44;};'use strict';var _=require('lodash');var util=require(_0xc61f('0x0'));var moment=require('moment');var BPromise=require(_0xc61f('0x1'));var rs=require(_0xc61f('0x2'));var fs=require('fs');var Redis=require(_0xc61f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc61f('0x4'));var logger=require('../../config/logger')(_0xc61f('0x5'));var config=require(_0xc61f('0x6'));var jayson=require(_0xc61f('0x7'));var client=jayson[_0xc61f('0x8')][_0xc61f('0x9')]({'port':0x232a});config[_0xc61f('0xa')]=_['defaults'](config[_0xc61f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc61f('0xb'))(new Redis(config[_0xc61f('0xa')]));require(_0xc61f('0xc'))[_0xc61f('0xd')](socket);function respondWithRpcPromise(_0x26d1e2,_0x277a03,_0x5671a3){return new BPromise(function(_0x25a5c4,_0x1a3727){return client[_0xc61f('0xe')](_0x26d1e2,_0x5671a3)[_0xc61f('0xf')](function(_0x531ba5){logger[_0xc61f('0x10')](_0xc61f('0x11'),_0x277a03,_0xc61f('0x12'));logger['debug'](_0xc61f('0x13'),_0x277a03,_0xc61f('0x12'),JSON[_0xc61f('0x14')](_0x531ba5));if(_0x531ba5[_0xc61f('0x15')]){if(_0x531ba5[_0xc61f('0x15')][_0xc61f('0x16')]===0x1f4){logger[_0xc61f('0x15')](_0xc61f('0x11'),_0x277a03,_0x531ba5[_0xc61f('0x15')][_0xc61f('0x17')]);return _0x1a3727(_0x531ba5[_0xc61f('0x15')][_0xc61f('0x17')]);}logger[_0xc61f('0x15')](_0xc61f('0x11'),_0x277a03,_0x531ba5['error'][_0xc61f('0x17')]);return _0x25a5c4(_0x531ba5['error'][_0xc61f('0x17')]);}else{logger[_0xc61f('0x10')](_0xc61f('0x11'),_0x277a03,'request\x20sent');_0x25a5c4(_0x531ba5[_0xc61f('0x18')][_0xc61f('0x17')]);}})[_0xc61f('0x19')](function(_0x2c98fc){logger['error']('DashboardItem,\x20%s,\x20%s',_0x277a03,_0x2c98fc);_0x1a3727(_0x2c98fc);});});} \ No newline at end of file +var _0x3932=['redis','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','message','result','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http'];(function(_0x4f081c,_0x14893d){var _0x557963=function(_0x238c22){while(--_0x238c22){_0x4f081c['push'](_0x4f081c['shift']());}};_0x557963(++_0x14893d);}(_0x3932,0x13b));var _0x2393=function(_0x1c501a,_0x164378){_0x1c501a=_0x1c501a-0x0;var _0x38b65f=_0x3932[_0x1c501a];return _0x38b65f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2393('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2393('0x1'));var db=require(_0x2393('0x2'))['db'];var utils=require(_0x2393('0x3'));var logger=require('../../config/logger')(_0x2393('0x4'));var config=require('../../config/environment');var jayson=require(_0x2393('0x5'));var client=jayson['client'][_0x2393('0x6')]({'port':0x232a});config[_0x2393('0x7')]=_['defaults'](config[_0x2393('0x7')],{'host':_0x2393('0x8'),'port':0x18eb});var socket=require(_0x2393('0x9'))(new Redis(config[_0x2393('0x7')]));require(_0x2393('0xa'))[_0x2393('0xb')](socket);function respondWithRpcPromise(_0x145155,_0x130a8c,_0x5782a5){return new BPromise(function(_0x6b04c2,_0x2586b2){return client[_0x2393('0xc')](_0x145155,_0x5782a5)[_0x2393('0xd')](function(_0x18b5a2){logger['info'](_0x2393('0xe'),_0x130a8c,_0x2393('0xf'));logger[_0x2393('0x10')](_0x2393('0x11'),_0x130a8c,_0x2393('0xf'),JSON[_0x2393('0x12')](_0x18b5a2));if(_0x18b5a2[_0x2393('0x13')]){if(_0x18b5a2[_0x2393('0x13')][_0x2393('0x14')]===0x1f4){logger[_0x2393('0x13')](_0x2393('0xe'),_0x130a8c,_0x18b5a2['error'][_0x2393('0x15')]);return _0x2586b2(_0x18b5a2[_0x2393('0x13')][_0x2393('0x15')]);}logger[_0x2393('0x13')]('DashboardItem,\x20%s,\x20%s',_0x130a8c,_0x18b5a2[_0x2393('0x13')][_0x2393('0x15')]);return _0x6b04c2(_0x18b5a2[_0x2393('0x13')][_0x2393('0x15')]);}else{logger['info'](_0x2393('0xe'),_0x130a8c,_0x2393('0xf'));_0x6b04c2(_0x18b5a2[_0x2393('0x16')][_0x2393('0x15')]);}})['catch'](function(_0x47ff79){logger[_0x2393('0x13')]('DashboardItem,\x20%s,\x20%s',_0x130a8c,_0x47ff79);_0x2586b2(_0x47ff79);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index a30d8fd..bcbc516 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 _0x9ee2=['emit','removeListener','register','length','./dashboardItem.events','remove','update'];(function(_0x4c825d,_0x10ec2b){var _0x43de87=function(_0xcab4a3){while(--_0xcab4a3){_0x4c825d['push'](_0x4c825d['shift']());}};_0x43de87(++_0x10ec2b);}(_0x9ee2,0xdd));var _0x29ee=function(_0x9fc096,_0x3c997c){_0x9fc096=_0x9fc096-0x0;var _0x5c0c19=_0x9ee2[_0x9fc096];return _0x5c0c19;};'use strict';var DashboardItemEvents=require(_0x29ee('0x0'));var events=['save',_0x29ee('0x1'),_0x29ee('0x2')];function createListener(_0x505891,_0x4d1233){return function(_0x34513c){_0x4d1233[_0x29ee('0x3')](_0x505891,_0x34513c);};}function removeListener(_0x197f28,_0x425ef0){return function(){DashboardItemEvents[_0x29ee('0x4')](_0x197f28,_0x425ef0);};}exports[_0x29ee('0x5')]=function(_0x1ce073){for(var _0x3e7cf9=0x0,_0x52c9d4=events[_0x29ee('0x6')];_0x3e7cf9<_0x52c9d4;_0x3e7cf9++){var _0x241149=events[_0x3e7cf9];var _0x2bf564=createListener('dashboardItem:'+_0x241149,_0x1ce073);DashboardItemEvents['on'](_0x241149,_0x2bf564);}}; \ No newline at end of file +var _0x4ea9=['dashboardItem:','./dashboardItem.events','update','emit','removeListener','register','length'];(function(_0x18e333,_0x1caf42){var _0x41c26e=function(_0x3e3606){while(--_0x3e3606){_0x18e333['push'](_0x18e333['shift']());}};_0x41c26e(++_0x1caf42);}(_0x4ea9,0x190));var _0x94ea=function(_0xc6afb3,_0x458ba5){_0xc6afb3=_0xc6afb3-0x0;var _0x25fb64=_0x4ea9[_0xc6afb3];return _0x25fb64;};'use strict';var DashboardItemEvents=require(_0x94ea('0x0'));var events=['save','remove',_0x94ea('0x1')];function createListener(_0x3a50b5,_0x4e535b){return function(_0x4b641c){_0x4e535b[_0x94ea('0x2')](_0x3a50b5,_0x4b641c);};}function removeListener(_0x3ab7ee,_0x5bbe5d){return function(){DashboardItemEvents[_0x94ea('0x3')](_0x3ab7ee,_0x5bbe5d);};}exports[_0x94ea('0x4')]=function(_0x5cf69a){for(var _0x3d2494=0x0,_0x2fd38d=events[_0x94ea('0x5')];_0x3d2494<_0x2fd38d;_0x3d2494++){var _0x3c022d=events[_0x3d2494];var _0x14c947=createListener(_0x94ea('0x6')+_0x3c022d,_0x5cf69a);DashboardItemEvents['on'](_0x3c022d,_0x14c947);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index c8e186e..4c36e33 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 _0xc10a=['../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xc10a,0x19b));var _0xac10=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0xc10a[_0x292f93];return _0x5a94b1;};'use strict';var multer=require(_0xac10('0x0'));var util=require('util');var path=require(_0xac10('0x1'));var timeout=require('connect-timeout');var express=require(_0xac10('0x2'));var router=express[_0xac10('0x3')]();var fs_extra=require(_0xac10('0x4'));var auth=require(_0xac10('0x5'));var interaction=require(_0xac10('0x6'));var config=require(_0xac10('0x7'));var controller=require(_0xac10('0x8'));router[_0xac10('0x9')](_0xac10('0xa'),auth[_0xac10('0xb')](),controller[_0xac10('0xc')]);router[_0xac10('0xd')]('/',auth[_0xac10('0xb')](),controller[_0xac10('0xe')]);router[_0xac10('0xf')]('/:id',auth[_0xac10('0xb')](),controller[_0xac10('0x10')]);router['delete']('/:id',auth[_0xac10('0xb')](),controller[_0xac10('0x11')]);module[_0xac10('0x12')]=router; \ No newline at end of file +var _0xb3ab=['update','destroy','multer','path','connect-timeout','express','Router','fs-extra','./dashboardItem.controller','get','/:id','isAuthenticated','post','put'];(function(_0x59b419,_0x2b03d9){var _0x3b7aae=function(_0x1fe574){while(--_0x1fe574){_0x59b419['push'](_0x59b419['shift']());}};_0x3b7aae(++_0x2b03d9);}(_0xb3ab,0x11a));var _0xbb3a=function(_0x1ebeea,_0x2f54f4){_0x1ebeea=_0x1ebeea-0x0;var _0x576465=_0xb3ab[_0x1ebeea];return _0x576465;};'use strict';var multer=require(_0xbb3a('0x0'));var util=require('util');var path=require(_0xbb3a('0x1'));var timeout=require(_0xbb3a('0x2'));var express=require(_0xbb3a('0x3'));var router=express[_0xbb3a('0x4')]();var fs_extra=require(_0xbb3a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbb3a('0x6'));router[_0xbb3a('0x7')](_0xbb3a('0x8'),auth[_0xbb3a('0x9')](),controller['show']);router[_0xbb3a('0xa')]('/',auth[_0xbb3a('0x9')](),controller['create']);router[_0xbb3a('0xb')](_0xbb3a('0x8'),auth[_0xbb3a('0x9')](),controller[_0xbb3a('0xc')]);router['delete']('/:id',auth[_0xbb3a('0x9')](),controller[_0xbb3a('0xd')]);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 d825ff8..6c4dcf3 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 _0xd98d=['STRING','first','third','sequelize','exports'];(function(_0x3c28a6,_0x28835d){var _0x51750b=function(_0x58a3a2){while(--_0x58a3a2){_0x3c28a6['push'](_0x3c28a6['shift']());}};_0x51750b(++_0x28835d);}(_0xd98d,0xc6));var _0xdd98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd98d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xdd98('0x0'));module[_0xdd98('0x1')]={'name':{'type':Sequelize[_0xdd98('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xdd98('0x3'),'second',_0xdd98('0x4')),'allowNull':![],'defaultValue':_0xdd98('0x3')},'description':{'type':Sequelize[_0xdd98('0x2')]}}; \ No newline at end of file +var _0x1057=['ENUM','first','second','third','sequelize','exports','STRING'];(function(_0x392b0e,_0x4ad359){var _0x147ea3=function(_0x225250){while(--_0x225250){_0x392b0e['push'](_0x392b0e['shift']());}};_0x147ea3(++_0x4ad359);}(_0x1057,0x193));var _0x7105=function(_0x1332d5,_0x3da1df){_0x1332d5=_0x1332d5-0x0;var _0x34b1cd=_0x1057[_0x1332d5];return _0x34b1cd;};'use strict';var Sequelize=require(_0x7105('0x0'));module[_0x7105('0x1')]={'name':{'type':Sequelize[_0x7105('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x7105('0x3')](_0x7105('0x4'),_0x7105('0x5'),_0x7105('0x6')),'allowNull':![],'defaultValue':_0x7105('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 9ca567d..e61034e 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 _0x3658=['undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','show','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x3c9ca4,_0x364308){var _0xe385b3=function(_0x1c13a5){while(--_0x1c13a5){_0x3c9ca4['push'](_0x3c9ca4['shift']());}};_0xe385b3(++_0x364308);}(_0x3658,0x133));var _0x8365=function(_0x3ab4e3,_0x2b38d9){_0x3ab4e3=_0x3ab4e3-0x0;var _0x121859=_0x3658[_0x3ab4e3];return _0x121859;};'use strict';var emlformat=require(_0x8365('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8365('0x1'));var jsonpatch=require(_0x8365('0x2'));var rp=require(_0x8365('0x3'));var moment=require(_0x8365('0x4'));var BPromise=require(_0x8365('0x5'));var Mustache=require('mustache');var util=require(_0x8365('0x6'));var path=require(_0x8365('0x7'));var sox=require(_0x8365('0x8'));var csv=require(_0x8365('0x9'));var ejs=require(_0x8365('0xa'));var fs=require('fs');var fs_extra=require(_0x8365('0xb'));var _=require(_0x8365('0xc'));var squel=require(_0x8365('0xd'));var crypto=require('crypto');var jsforce=require(_0x8365('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8365('0x9'));var querystring=require(_0x8365('0xf'));var Papa=require(_0x8365('0x10'));var Redis=require(_0x8365('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8365('0x12'));var hardwareService=require(_0x8365('0x13'));var logger=require(_0x8365('0x14'))('api');var utils=require(_0x8365('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8365('0x16'));var db=require(_0x8365('0x17'))['db'];function respondWithStatusCode(_0x11d763,_0x419f69){_0x419f69=_0x419f69||0xcc;return function(_0x463cf4){if(_0x463cf4){return _0x11d763[_0x8365('0x18')](_0x419f69);}return _0x11d763[_0x8365('0x19')](_0x419f69)[_0x8365('0x1a')]();};}function respondWithResult(_0x1f91ab,_0x5a4910){_0x5a4910=_0x5a4910||0xc8;return function(_0x8073d6){if(_0x8073d6){return _0x1f91ab[_0x8365('0x19')](_0x5a4910)[_0x8365('0x1b')](_0x8073d6);}};}function respondWithFilteredResult(_0x3cee42,_0x54c04b){return function(_0x712e18){if(_0x712e18){var _0x2eaa1d=typeof _0x54c04b[_0x8365('0x1c')]===_0x8365('0x1d')&&typeof _0x54c04b[_0x8365('0x1e')]==='undefined';var _0x1774d9=_0x712e18['count'];var _0x4f5e8a=_0x2eaa1d?0x0:_0x54c04b[_0x8365('0x1c')];var _0x1ded91=_0x2eaa1d?_0x712e18['count']:_0x54c04b[_0x8365('0x1c')]+_0x54c04b['limit'];var _0x28cd72;if(_0x1ded91>=_0x1774d9){_0x1ded91=_0x1774d9;_0x28cd72=0xc8;}else{_0x28cd72=0xce;}_0x3cee42['status'](_0x28cd72);return _0x3cee42[_0x8365('0x1f')](_0x8365('0x20'),_0x4f5e8a+'-'+_0x1ded91+'/'+_0x1774d9)[_0x8365('0x1b')](_0x712e18);}return null;};}function patchUpdates(_0x47ee37){return function(_0x3ccb89){try{jsonpatch[_0x8365('0x21')](_0x3ccb89,_0x47ee37,!![]);}catch(_0x2b544a){return BPromise[_0x8365('0x22')](_0x2b544a);}return _0x3ccb89[_0x8365('0x23')]();};}function saveUpdates(_0x144797,_0x464bbb){return function(_0x3639de){if(_0x3639de){return _0x3639de[_0x8365('0x24')](_0x144797)[_0x8365('0x25')](function(_0x7678e2){return _0x7678e2;});}return null;};}function removeEntity(_0x5a4109,_0x146bae){return function(_0x5ec466){if(_0x5ec466){return _0x5ec466[_0x8365('0x26')]()[_0x8365('0x25')](function(){var _0x53020e=_0x5ec466[_0x8365('0x27')]({'plain':!![]});var _0x42a08c=_0x8365('0x28');return db[_0x8365('0x29')][_0x8365('0x26')]({'where':{'type':_0x42a08c,'resourceId':_0x53020e['id']}})[_0x8365('0x25')](function(){return _0x5ec466;});})['then'](function(){_0x5a4109[_0x8365('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49767e,_0x4dcb67){return function(_0x21532e){if(!_0x21532e){_0x49767e[_0x8365('0x18')](0x194);}return _0x21532e;};}function handleError(_0x2d93ab,_0x14f318){_0x14f318=_0x14f318||0x1f4;return function(_0x6c9398){logger[_0x8365('0x2a')](_0x6c9398[_0x8365('0x2b')]);if(_0x6c9398[_0x8365('0x2c')]){delete _0x6c9398['name'];}_0x2d93ab[_0x8365('0x19')](_0x14f318)[_0x8365('0x2d')](_0x6c9398);};}exports[_0x8365('0x2e')]=function(_0x2ebd77,_0x2a62cd){var _0x42baf2={},_0x3b5759={},_0x567022={'count':0x0,'rows':[]};var _0x511c9a=_[_0x8365('0x2f')](db[_0x8365('0x30')][_0x8365('0x31')],function(_0x3a167d){return{'name':_0x3a167d[_0x8365('0x32')],'type':_0x3a167d['type'][_0x8365('0x33')]};});_0x3b5759[_0x8365('0x34')]=_['map'](_0x511c9a,_0x8365('0x2c'));_0x3b5759['query']=_[_0x8365('0x35')](_0x2ebd77['query']);_0x3b5759[_0x8365('0x36')]=_[_0x8365('0x37')](_0x3b5759[_0x8365('0x34')],_0x3b5759[_0x8365('0x38')]);_0x42baf2[_0x8365('0x39')]=_[_0x8365('0x37')](_0x3b5759[_0x8365('0x34')],qs[_0x8365('0x3a')](_0x2ebd77['query'][_0x8365('0x3a')]));_0x42baf2['attributes']=_0x42baf2[_0x8365('0x39')]['length']?_0x42baf2[_0x8365('0x39')]:_0x3b5759['model'];if(!_0x2ebd77[_0x8365('0x38')][_0x8365('0x3b')](_0x8365('0x3c'))){_0x42baf2[_0x8365('0x1e')]=qs[_0x8365('0x1e')](_0x2ebd77[_0x8365('0x38')][_0x8365('0x1e')]);_0x42baf2[_0x8365('0x1c')]=qs[_0x8365('0x1c')](_0x2ebd77[_0x8365('0x38')][_0x8365('0x1c')]);}_0x42baf2['order']=qs[_0x8365('0x3d')](_0x2ebd77[_0x8365('0x38')][_0x8365('0x3d')]);_0x42baf2[_0x8365('0x3e')]=qs['filters'](_[_0x8365('0x3f')](_0x2ebd77['query'],_0x3b5759[_0x8365('0x36')]),_0x511c9a);if(_0x2ebd77['query'][_0x8365('0x40')]){_0x42baf2[_0x8365('0x3e')]=_[_0x8365('0x41')](_0x42baf2['where'],{'$or':_[_0x8365('0x2f')](_0x511c9a,function(_0x39b08a){if(_0x39b08a[_0x8365('0x42')]!==_0x8365('0x43')){var _0x2531b3={};_0x2531b3[_0x39b08a[_0x8365('0x2c')]]={'$like':'%'+_0x2ebd77[_0x8365('0x38')]['filter']+'%'};return _0x2531b3;}})});}_0x42baf2=_[_0x8365('0x41')]({},_0x42baf2,_0x2ebd77[_0x8365('0x44')]);var _0x4472be={'where':_0x42baf2['where']};return db[_0x8365('0x30')][_0x8365('0x45')](_0x4472be)['then'](function(_0x271f15){_0x567022[_0x8365('0x45')]=_0x271f15;if(_0x2ebd77['query'][_0x8365('0x46')]){_0x42baf2['include']=[{'all':!![]}];}return db[_0x8365('0x30')][_0x8365('0x47')](_0x42baf2);})[_0x8365('0x25')](function(_0xdd47a1){_0x567022[_0x8365('0x48')]=_0xdd47a1;return _0x567022;})['then'](respondWithFilteredResult(_0x2a62cd,_0x42baf2))['catch'](handleError(_0x2a62cd,null));};exports[_0x8365('0x49')]=function(_0x3dee9c,_0x4c4ecc){var _0x1bba97={'raw':!![],'where':{'id':_0x3dee9c['params']['id']}},_0x400645={};_0x400645[_0x8365('0x34')]=_[_0x8365('0x35')](db[_0x8365('0x30')]['rawAttributes']);_0x400645[_0x8365('0x38')]=_['keys'](_0x3dee9c[_0x8365('0x38')]);_0x400645[_0x8365('0x36')]=_[_0x8365('0x37')](_0x400645[_0x8365('0x34')],_0x400645[_0x8365('0x38')]);_0x1bba97[_0x8365('0x39')]=_['intersection'](_0x400645[_0x8365('0x34')],qs[_0x8365('0x3a')](_0x3dee9c[_0x8365('0x38')][_0x8365('0x3a')]));_0x1bba97[_0x8365('0x39')]=_0x1bba97['attributes']['length']?_0x1bba97[_0x8365('0x39')]:_0x400645[_0x8365('0x34')];if(_0x3dee9c['query']['includeAll']){_0x1bba97[_0x8365('0x4a')]=[{'all':!![]}];}_0x1bba97=_['merge']({},_0x1bba97,_0x3dee9c[_0x8365('0x44')]);return db[_0x8365('0x30')][_0x8365('0x4b')](_0x1bba97)['then'](handleEntityNotFound(_0x4c4ecc,null))[_0x8365('0x25')](respondWithResult(_0x4c4ecc,null))[_0x8365('0x4c')](handleError(_0x4c4ecc,null));};exports[_0x8365('0x4d')]=function(_0xa87cf2,_0x523afc){return db['Disposition'][_0x8365('0x4d')](_0xa87cf2[_0x8365('0x4e')],{})[_0x8365('0x25')](function(_0x2c356b){var _0xa0fd1b=_0xa87cf2[_0x8365('0x4f')][_0x8365('0x27')]({'plain':!![]});if(!_0xa0fd1b)throw new Error(_0x8365('0x50'));if(_0xa0fd1b[_0x8365('0x51')]===_0x8365('0x4f')){var _0x536e55=_0x2c356b[_0x8365('0x27')]({'plain':!![]});var _0x192c97=_0x8365('0x28');return db['UserProfileSection'][_0x8365('0x4b')]({'where':{'name':_0x192c97,'userProfileId':_0xa0fd1b['userProfileId']},'raw':!![]})['then'](function(_0xad66b5){if(_0xad66b5&&_0xad66b5[_0x8365('0x52')]===0x0){return db[_0x8365('0x29')]['create']({'name':_0x536e55[_0x8365('0x2c')],'resourceId':_0x536e55['id'],'type':_0xad66b5[_0x8365('0x2c')],'sectionId':_0xad66b5['id']},{})[_0x8365('0x25')](function(){return _0x2c356b;});}else{return _0x2c356b;}})[_0x8365('0x4c')](function(_0x427716){logger[_0x8365('0x2a')](_0x8365('0x53'),_0x427716);throw _0x427716;});}return _0x2c356b;})[_0x8365('0x25')](respondWithResult(_0x523afc,0xc9))['catch'](handleError(_0x523afc,null));};exports['update']=function(_0x4f9fba,_0x57d8aa){if(_0x4f9fba[_0x8365('0x4e')]['id']){delete _0x4f9fba[_0x8365('0x4e')]['id'];}return db[_0x8365('0x30')][_0x8365('0x4b')]({'where':{'id':_0x4f9fba['params']['id']}})[_0x8365('0x25')](handleEntityNotFound(_0x57d8aa,null))[_0x8365('0x25')](saveUpdates(_0x4f9fba[_0x8365('0x4e')],null))[_0x8365('0x25')](respondWithResult(_0x57d8aa,null))[_0x8365('0x4c')](handleError(_0x57d8aa,null));};exports[_0x8365('0x26')]=function(_0x2128a7,_0x4ec93a){return db[_0x8365('0x30')][_0x8365('0x4b')]({'where':{'id':_0x2128a7['params']['id']}})[_0x8365('0x25')](handleEntityNotFound(_0x4ec93a,null))['then'](removeEntity(_0x4ec93a,null))['catch'](handleError(_0x4ec93a,null));}; \ No newline at end of file +var _0xe958=['apply','reject','save','update','then','destroy','Dispositions','UserProfileResource','sendStatus','error','name','send','index','Disposition','fieldName','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','rawAttributes','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','json'];(function(_0x4d7116,_0xdb8175){var _0x4593dc=function(_0x51d44e){while(--_0x51d44e){_0x4d7116['push'](_0x4d7116['shift']());}};_0x4593dc(++_0xdb8175);}(_0xe958,0x191));var _0x8e95=function(_0x3b77fb,_0x2e2b07){_0x3b77fb=_0x3b77fb-0x0;var _0x4f4b14=_0xe958[_0x3b77fb];return _0x4f4b14;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8e95('0x0'));var zipdir=require(_0x8e95('0x1'));var jsonpatch=require(_0x8e95('0x2'));var rp=require(_0x8e95('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8e95('0x4'));var util=require('util');var path=require(_0x8e95('0x5'));var sox=require(_0x8e95('0x6'));var csv=require(_0x8e95('0x7'));var ejs=require(_0x8e95('0x8'));var fs=require('fs');var fs_extra=require(_0x8e95('0x9'));var _=require(_0x8e95('0xa'));var squel=require(_0x8e95('0xb'));var crypto=require(_0x8e95('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8e95('0xd'));var toCsv=require(_0x8e95('0x7'));var querystring=require(_0x8e95('0xe'));var Papa=require(_0x8e95('0xf'));var Redis=require(_0x8e95('0x10'));var authService=require(_0x8e95('0x11'));var qs=require(_0x8e95('0x12'));var as=require(_0x8e95('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e95('0x14'))(_0x8e95('0x15'));var utils=require(_0x8e95('0x16'));var config=require(_0x8e95('0x17'));var licenseUtil=require(_0x8e95('0x18'));var db=require(_0x8e95('0x19'))['db'];function respondWithStatusCode(_0x1834dc,_0x3f6f56){_0x3f6f56=_0x3f6f56||0xcc;return function(_0xba3b09){if(_0xba3b09){return _0x1834dc['sendStatus'](_0x3f6f56);}return _0x1834dc[_0x8e95('0x1a')](_0x3f6f56)[_0x8e95('0x1b')]();};}function respondWithResult(_0x1d60b6,_0x2a373d){_0x2a373d=_0x2a373d||0xc8;return function(_0x2e65e7){if(_0x2e65e7){return _0x1d60b6[_0x8e95('0x1a')](_0x2a373d)['json'](_0x2e65e7);}};}function respondWithFilteredResult(_0x8fd58e,_0x1dc931){return function(_0x326530){if(_0x326530){var _0x1e9883=typeof _0x1dc931[_0x8e95('0x1c')]===_0x8e95('0x1d')&&typeof _0x1dc931['limit']==='undefined';var _0x58ea7e=_0x326530[_0x8e95('0x1e')];var _0x126cc1=_0x1e9883?0x0:_0x1dc931['offset'];var _0x2b486c=_0x1e9883?_0x326530[_0x8e95('0x1e')]:_0x1dc931['offset']+_0x1dc931['limit'];var _0x1fb250;if(_0x2b486c>=_0x58ea7e){_0x2b486c=_0x58ea7e;_0x1fb250=0xc8;}else{_0x1fb250=0xce;}_0x8fd58e['status'](_0x1fb250);return _0x8fd58e[_0x8e95('0x1f')](_0x8e95('0x20'),_0x126cc1+'-'+_0x2b486c+'/'+_0x58ea7e)[_0x8e95('0x21')](_0x326530);}return null;};}function patchUpdates(_0x1be100){return function(_0x566f41){try{jsonpatch[_0x8e95('0x22')](_0x566f41,_0x1be100,!![]);}catch(_0x575b57){return BPromise[_0x8e95('0x23')](_0x575b57);}return _0x566f41[_0x8e95('0x24')]();};}function saveUpdates(_0x1d2bdb,_0x3834b6){return function(_0x5a3f93){if(_0x5a3f93){return _0x5a3f93[_0x8e95('0x25')](_0x1d2bdb)[_0x8e95('0x26')](function(_0x11b6da){return _0x11b6da;});}return null;};}function removeEntity(_0x239b6b,_0x2053af){return function(_0x3001c9){if(_0x3001c9){return _0x3001c9[_0x8e95('0x27')]()['then'](function(){var _0x1b9613=_0x3001c9['get']({'plain':!![]});var _0x5beaf4=_0x8e95('0x28');return db[_0x8e95('0x29')][_0x8e95('0x27')]({'where':{'type':_0x5beaf4,'resourceId':_0x1b9613['id']}})[_0x8e95('0x26')](function(){return _0x3001c9;});})[_0x8e95('0x26')](function(){_0x239b6b[_0x8e95('0x1a')](0xcc)[_0x8e95('0x1b')]();});}};}function handleEntityNotFound(_0x27b2fc,_0x32a544){return function(_0x3b24d4){if(!_0x3b24d4){_0x27b2fc[_0x8e95('0x2a')](0x194);}return _0x3b24d4;};}function handleError(_0x372edf,_0x7a155e){_0x7a155e=_0x7a155e||0x1f4;return function(_0x45dc6b){logger[_0x8e95('0x2b')](_0x45dc6b['stack']);if(_0x45dc6b[_0x8e95('0x2c')]){delete _0x45dc6b[_0x8e95('0x2c')];}_0x372edf[_0x8e95('0x1a')](_0x7a155e)[_0x8e95('0x2d')](_0x45dc6b);};}exports[_0x8e95('0x2e')]=function(_0x100c6e,_0x162423){var _0x10c9c8={},_0x19a79e={},_0x23fdd1={'count':0x0,'rows':[]};var _0x3eeb53=_['map'](db[_0x8e95('0x2f')]['rawAttributes'],function(_0xcb96eb){return{'name':_0xcb96eb[_0x8e95('0x30')],'type':_0xcb96eb['type']['key']};});_0x19a79e[_0x8e95('0x31')]=_[_0x8e95('0x32')](_0x3eeb53,_0x8e95('0x2c'));_0x19a79e[_0x8e95('0x33')]=_[_0x8e95('0x34')](_0x100c6e[_0x8e95('0x33')]);_0x19a79e['filters']=_[_0x8e95('0x35')](_0x19a79e[_0x8e95('0x31')],_0x19a79e[_0x8e95('0x33')]);_0x10c9c8[_0x8e95('0x36')]=_[_0x8e95('0x35')](_0x19a79e[_0x8e95('0x31')],qs[_0x8e95('0x37')](_0x100c6e[_0x8e95('0x33')]['fields']));_0x10c9c8[_0x8e95('0x36')]=_0x10c9c8[_0x8e95('0x36')][_0x8e95('0x38')]?_0x10c9c8[_0x8e95('0x36')]:_0x19a79e['model'];if(!_0x100c6e[_0x8e95('0x33')][_0x8e95('0x39')](_0x8e95('0x3a'))){_0x10c9c8['limit']=qs['limit'](_0x100c6e[_0x8e95('0x33')][_0x8e95('0x3b')]);_0x10c9c8['offset']=qs['offset'](_0x100c6e[_0x8e95('0x33')]['offset']);}_0x10c9c8[_0x8e95('0x3c')]=qs[_0x8e95('0x3d')](_0x100c6e['query'][_0x8e95('0x3d')]);_0x10c9c8[_0x8e95('0x3e')]=qs[_0x8e95('0x3f')](_['pick'](_0x100c6e[_0x8e95('0x33')],_0x19a79e['filters']),_0x3eeb53);if(_0x100c6e[_0x8e95('0x33')]['filter']){_0x10c9c8['where']=_['merge'](_0x10c9c8[_0x8e95('0x3e')],{'$or':_['map'](_0x3eeb53,function(_0x534987){if(_0x534987[_0x8e95('0x40')]!==_0x8e95('0x41')){var _0x49e0f3={};_0x49e0f3[_0x534987['name']]={'$like':'%'+_0x100c6e[_0x8e95('0x33')][_0x8e95('0x42')]+'%'};return _0x49e0f3;}})});}_0x10c9c8=_[_0x8e95('0x43')]({},_0x10c9c8,_0x100c6e[_0x8e95('0x44')]);var _0x9f70b9={'where':_0x10c9c8[_0x8e95('0x3e')]};return db[_0x8e95('0x2f')][_0x8e95('0x1e')](_0x9f70b9)[_0x8e95('0x26')](function(_0x42871a){_0x23fdd1['count']=_0x42871a;if(_0x100c6e[_0x8e95('0x33')][_0x8e95('0x45')]){_0x10c9c8[_0x8e95('0x46')]=[{'all':!![]}];}return db[_0x8e95('0x2f')][_0x8e95('0x47')](_0x10c9c8);})[_0x8e95('0x26')](function(_0x33d523){_0x23fdd1[_0x8e95('0x48')]=_0x33d523;return _0x23fdd1;})[_0x8e95('0x26')](respondWithFilteredResult(_0x162423,_0x10c9c8))['catch'](handleError(_0x162423,null));};exports['show']=function(_0x1cae35,_0x318a8a){var _0x1bce4a={'raw':!![],'where':{'id':_0x1cae35[_0x8e95('0x49')]['id']}},_0xbbd3e3={};_0xbbd3e3[_0x8e95('0x31')]=_[_0x8e95('0x34')](db[_0x8e95('0x2f')][_0x8e95('0x4a')]);_0xbbd3e3[_0x8e95('0x33')]=_[_0x8e95('0x34')](_0x1cae35[_0x8e95('0x33')]);_0xbbd3e3[_0x8e95('0x3f')]=_[_0x8e95('0x35')](_0xbbd3e3[_0x8e95('0x31')],_0xbbd3e3[_0x8e95('0x33')]);_0x1bce4a[_0x8e95('0x36')]=_[_0x8e95('0x35')](_0xbbd3e3[_0x8e95('0x31')],qs[_0x8e95('0x37')](_0x1cae35[_0x8e95('0x33')][_0x8e95('0x37')]));_0x1bce4a['attributes']=_0x1bce4a[_0x8e95('0x36')][_0x8e95('0x38')]?_0x1bce4a[_0x8e95('0x36')]:_0xbbd3e3[_0x8e95('0x31')];if(_0x1cae35[_0x8e95('0x33')][_0x8e95('0x45')]){_0x1bce4a[_0x8e95('0x46')]=[{'all':!![]}];}_0x1bce4a=_[_0x8e95('0x43')]({},_0x1bce4a,_0x1cae35['options']);return db[_0x8e95('0x2f')]['find'](_0x1bce4a)[_0x8e95('0x26')](handleEntityNotFound(_0x318a8a,null))[_0x8e95('0x26')](respondWithResult(_0x318a8a,null))[_0x8e95('0x4b')](handleError(_0x318a8a,null));};exports[_0x8e95('0x4c')]=function(_0xf41b5f,_0x2d8e72){return db[_0x8e95('0x2f')][_0x8e95('0x4c')](_0xf41b5f[_0x8e95('0x4d')],{})[_0x8e95('0x26')](function(_0x42110e){var _0x437045=_0xf41b5f[_0x8e95('0x4e')][_0x8e95('0x4f')]({'plain':!![]});if(!_0x437045)throw new Error(_0x8e95('0x50'));if(_0x437045[_0x8e95('0x51')]===_0x8e95('0x4e')){var _0x383c1f=_0x42110e[_0x8e95('0x4f')]({'plain':!![]});var _0x14b118=_0x8e95('0x28');return db[_0x8e95('0x52')][_0x8e95('0x53')]({'where':{'name':_0x14b118,'userProfileId':_0x437045[_0x8e95('0x54')]},'raw':!![]})[_0x8e95('0x26')](function(_0x1f83e){if(_0x1f83e&&_0x1f83e[_0x8e95('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x383c1f['name'],'resourceId':_0x383c1f['id'],'type':_0x1f83e[_0x8e95('0x2c')],'sectionId':_0x1f83e['id']},{})[_0x8e95('0x26')](function(){return _0x42110e;});}else{return _0x42110e;}})[_0x8e95('0x4b')](function(_0x21d4f9){logger['error'](_0x8e95('0x56'),_0x21d4f9);throw _0x21d4f9;});}return _0x42110e;})[_0x8e95('0x26')](respondWithResult(_0x2d8e72,0xc9))['catch'](handleError(_0x2d8e72,null));};exports['update']=function(_0x5317db,_0x1c11dd){if(_0x5317db['body']['id']){delete _0x5317db[_0x8e95('0x4d')]['id'];}return db[_0x8e95('0x2f')]['find']({'where':{'id':_0x5317db[_0x8e95('0x49')]['id']}})[_0x8e95('0x26')](handleEntityNotFound(_0x1c11dd,null))[_0x8e95('0x26')](saveUpdates(_0x5317db[_0x8e95('0x4d')],null))['then'](respondWithResult(_0x1c11dd,null))['catch'](handleError(_0x1c11dd,null));};exports[_0x8e95('0x27')]=function(_0x5f3eaf,_0x4db44a){return db['Disposition'][_0x8e95('0x53')]({'where':{'id':_0x5f3eaf['params']['id']}})[_0x8e95('0x26')](handleEntityNotFound(_0x4db44a,null))[_0x8e95('0x26')](removeEntity(_0x4db44a,null))['catch'](handleError(_0x4db44a,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 56045c5..f690a48 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 _0x6d66=['bluebird','rimraf','./disposition.attributes','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment'];(function(_0x33937f,_0x37c3a1){var _0x23ec0d=function(_0x2f46c9){while(--_0x2f46c9){_0x33937f['push'](_0x33937f['shift']());}};_0x23ec0d(++_0x37c3a1);}(_0x6d66,0x1c4));var _0x66d6=function(_0x2587d5,_0x4600f8){_0x2587d5=_0x2587d5-0x0;var _0x299824=_0x6d66[_0x2587d5];return _0x299824;};'use strict';var _=require(_0x66d6('0x0'));var util=require('util');var logger=require(_0x66d6('0x1'))(_0x66d6('0x2'));var moment=require(_0x66d6('0x3'));var BPromise=require(_0x66d6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x66d6('0x5'));var config=require('../../config/environment');var attributes=require(_0x66d6('0x6'));module['exports']=function(_0x19c689,_0x10bb61){return _0x19c689[_0x66d6('0x7')](_0x66d6('0x8'),attributes,{'tableName':_0x66d6('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x66d6('0xa'),'fields':[_0x66d6('0xb'),_0x66d6('0xc')]},{'unique':!![],'name':_0x66d6('0xd'),'fields':[_0x66d6('0xb'),_0x66d6('0xe')]},{'unique':!![],'name':_0x66d6('0xf'),'fields':['name',_0x66d6('0x10')]},{'unique':!![],'name':_0x66d6('0x11'),'fields':[_0x66d6('0xb'),'SmsAccountId']},{'unique':!![],'name':_0x66d6('0x12'),'fields':[_0x66d6('0xb'),_0x66d6('0x13')]},{'unique':!![],'name':_0x66d6('0x14'),'fields':[_0x66d6('0xb'),_0x66d6('0x15')]},{'unique':!![],'name':_0x66d6('0x16'),'fields':[_0x66d6('0xb'),_0x66d6('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x034b=['request-promise','exports','Disposition','name_voice','name','ListId','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','bluebird'];(function(_0x4c9a6a,_0x5e9a4f){var _0x58f916=function(_0x35f8ee){while(--_0x35f8ee){_0x4c9a6a['push'](_0x4c9a6a['shift']());}};_0x58f916(++_0x5e9a4f);}(_0x034b,0x1b4));var _0xb034=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x034b[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xb034('0x0'));var logger=require(_0xb034('0x1'))(_0xb034('0x2'));var moment=require('moment');var BPromise=require(_0xb034('0x3'));var rp=require(_0xb034('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0xb034('0x5')]=function(_0x201fb2,_0x48ae7b){return _0x201fb2['define'](_0xb034('0x6'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xb034('0x7'),'fields':[_0xb034('0x8'),_0xb034('0x9')]},{'unique':!![],'name':'name_chat','fields':['name',_0xb034('0xa')]},{'unique':!![],'name':_0xb034('0xb'),'fields':[_0xb034('0x8'),'MailAccountId']},{'unique':!![],'name':_0xb034('0xc'),'fields':['name',_0xb034('0xd')]},{'unique':!![],'name':_0xb034('0xe'),'fields':[_0xb034('0x8'),_0xb034('0xf')]},{'unique':!![],'name':_0xb034('0x10'),'fields':['name',_0xb034('0x11')]},{'unique':!![],'name':_0xb034('0x12'),'fields':[_0xb034('0x8'),_0xb034('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 9c35d30..f8001e2 100644 --- a/server/api/disposition/disposition.rpc.js +++ b/server/api/disposition/disposition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2f693d,_0x1c11ad){var _0xe18178=function(_0x7d28af){while(--_0x7d28af){_0x2f693d['push'](_0x2f693d['shift']());}};_0xe18178(++_0x1c11ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xc6da03,_0x2de580){var _0x2b0a5e=function(_0x46ee5b){while(--_0x46ee5b){_0xc6da03['push'](_0xc6da03['shift']());}};_0x2b0a5e(++_0x2de580);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 7efde19..d3bff77 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 _0x9f3a=['../../config/environment','get','isAuthenticated','index','/:id','show','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1d30a8,_0x34b9d0){var _0x45c388=function(_0x22e354){while(--_0x22e354){_0x1d30a8['push'](_0x1d30a8['shift']());}};_0x45c388(++_0x34b9d0);}(_0x9f3a,0xc8));var _0xa9f3=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0x9f3a[_0x276468];return _0x36dc3a;};'use strict';var multer=require(_0xa9f3('0x0'));var util=require(_0xa9f3('0x1'));var path=require(_0xa9f3('0x2'));var timeout=require(_0xa9f3('0x3'));var express=require(_0xa9f3('0x4'));var router=express[_0xa9f3('0x5')]();var fs_extra=require(_0xa9f3('0x6'));var auth=require(_0xa9f3('0x7'));var interaction=require(_0xa9f3('0x8'));var config=require(_0xa9f3('0x9'));var controller=require('./disposition.controller');router[_0xa9f3('0xa')]('/',auth[_0xa9f3('0xb')](),controller[_0xa9f3('0xc')]);router[_0xa9f3('0xa')](_0xa9f3('0xd'),auth[_0xa9f3('0xb')](),controller[_0xa9f3('0xe')]);router['post']('/',auth[_0xa9f3('0xb')](),controller['create']);router[_0xa9f3('0xf')](_0xa9f3('0xd'),auth[_0xa9f3('0xb')](),controller['update']);router[_0xa9f3('0x10')](_0xa9f3('0xd'),auth[_0xa9f3('0xb')](),controller[_0xa9f3('0x11')]);module[_0xa9f3('0x12')]=router; \ No newline at end of file +var _0xfecf=['put','update','destroy','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','post','create'];(function(_0x2ad871,_0xbbf73b){var _0x504ce9=function(_0x1b3c33){while(--_0x1b3c33){_0x2ad871['push'](_0x2ad871['shift']());}};_0x504ce9(++_0xbbf73b);}(_0xfecf,0x1f2));var _0xffec=function(_0x2c0ac3,_0x4b6520){_0x2c0ac3=_0x2c0ac3-0x0;var _0x56cb65=_0xfecf[_0x2c0ac3];return _0x56cb65;};'use strict';var multer=require('multer');var util=require(_0xffec('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xffec('0x1')]();var fs_extra=require(_0xffec('0x2'));var auth=require(_0xffec('0x3'));var interaction=require(_0xffec('0x4'));var config=require(_0xffec('0x5'));var controller=require('./disposition.controller');router[_0xffec('0x6')]('/',auth['isAuthenticated'](),controller[_0xffec('0x7')]);router[_0xffec('0x6')](_0xffec('0x8'),auth[_0xffec('0x9')](),controller['show']);router[_0xffec('0xa')]('/',auth[_0xffec('0x9')](),controller[_0xffec('0xb')]);router[_0xffec('0xc')](_0xffec('0x8'),auth[_0xffec('0x9')](),controller[_0xffec('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xffec('0xe')]);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 d4fc12f..0455f63 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 _0x6c7b=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','ENUM','yes','STRING','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','12000','14400','9600','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT'];(function(_0x536c66,_0x570b6b){var _0x221d57=function(_0x34af51){while(--_0x34af51){_0x536c66['push'](_0x536c66['shift']());}};_0x221d57(++_0x570b6b);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x744bed,_0xcac06e){_0x744bed=_0x744bed-0x0;var _0x38c05f=_0x6c7b[_0x744bed];return _0x38c05f;};'use strict';var Sequelize=require(_0xb6c7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xb6c7('0x1')]('yes','no'),'defaultValue':_0xb6c7('0x2')},'headerinfo':{'type':Sequelize[_0xb6c7('0x3')],'defaultValue':_0xb6c7('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xb6c7('0x5')},'minrate':{'type':Sequelize[_0xb6c7('0x1')](_0xb6c7('0x6'),_0xb6c7('0x7'),_0xb6c7('0x8'),'9600',_0xb6c7('0x9'),_0xb6c7('0xa')),'defaultValue':_0xb6c7('0x7')},'maxrate':{'type':Sequelize[_0xb6c7('0x1')](_0xb6c7('0x6'),_0xb6c7('0x7'),_0xb6c7('0x8'),_0xb6c7('0xb'),'12000','14400'),'defaultValue':_0xb6c7('0xa')},'modem':{'type':Sequelize[_0xb6c7('0x3')],'defaultValue':_0xb6c7('0xc')},'gateway':{'type':Sequelize[_0xb6c7('0x3')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xb6c7('0x3')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xb6c7('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xb6c7('0x1')]('SIP',_0xb6c7('0xe'),_0xb6c7('0xf'),_0xb6c7('0x10')),'defaultValue':_0xb6c7('0x11')},'key':{'type':Sequelize[_0xb6c7('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb6c7('0x12')],'defaultValue':function(){return _0xb6c7('0x13');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb6c7('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb6c7('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb6c7('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb6c7('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xb6c7('0x15')},'mandatoryDisposition':{'type':Sequelize[_0xb6c7('0x14')],'defaultValue':![],'comment':_0xb6c7('0x16'),'set':function(_0x200833){if(!_0x200833)this[_0xb6c7('0x17')](_0xb6c7('0x18'),null);this[_0xb6c7('0x17')](_0xb6c7('0x19'),_0x200833);}}}; \ No newline at end of file +var _0x9bd9=['setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','localstationid','2400','4800','7200','9600','12000','14400','INTEGER','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x209511,_0x231622){_0x209511=_0x209511-0x0;var _0x39b937=_0x9bd9[_0x209511];return _0x39b937;};'use strict';var Sequelize=require(_0x99bd('0x0'));module[_0x99bd('0x1')]={'name':{'type':Sequelize[_0x99bd('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x99bd('0x2')]},'ecm':{'type':Sequelize[_0x99bd('0x3')](_0x99bd('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x99bd('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x99bd('0x2')],'unique':_0x99bd('0x5')},'minrate':{'type':Sequelize['ENUM'](_0x99bd('0x6'),_0x99bd('0x7'),_0x99bd('0x8'),_0x99bd('0x9'),_0x99bd('0xa'),_0x99bd('0xb')),'defaultValue':_0x99bd('0x7')},'maxrate':{'type':Sequelize[_0x99bd('0x3')](_0x99bd('0x6'),_0x99bd('0x7'),_0x99bd('0x8'),_0x99bd('0x9'),_0x99bd('0xa'),_0x99bd('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x99bd('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x99bd('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x99bd('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x99bd('0x3')]('SIP',_0x99bd('0xd'),'DADHI',_0x99bd('0xe')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x99bd('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x99bd('0xf')],'defaultValue':function(){return _0x99bd('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x99bd('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x99bd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x99bd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x99bd('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x99bd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x99bd('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x99bd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x99bd('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x99bd('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x99bd('0x13'),'set':function(_0x442702){if(!_0x442702)this[_0x99bd('0x14')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x99bd('0x15'),_0x442702);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index e59ae17..273a5cd 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 _0xe955=['ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','out','Messages','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra','squel','crypto','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','map','FaxAccount','fieldName','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','length','options','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','Owner','internal','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','minrate','modem','t38timeout','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','VoiceExtension','bulkCreate','updateAccountApplications','tech','key','createdAt','updatedAt','TrunkId'];(function(_0x158212,_0x36141e){var _0x12852c=function(_0x2b00cf){while(--_0x2b00cf){_0x158212['push'](_0x158212['shift']());}};_0x12852c(++_0x36141e);}(_0xe955,0xeb));var _0x5e95=function(_0xd41320,_0x49e734){_0xd41320=_0xd41320-0x0;var _0x321b6f=_0xe955[_0xd41320];return _0x321b6f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5e95('0x0'));var zipdir=require(_0x5e95('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e95('0x2'));var moment=require(_0x5e95('0x3'));var BPromise=require(_0x5e95('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5e95('0x5'));var sox=require(_0x5e95('0x6'));var csv=require('to-csv');var ejs=require(_0x5e95('0x7'));var fs=require('fs');var fs_extra=require(_0x5e95('0x8'));var _=require('lodash');var squel=require(_0x5e95('0x9'));var crypto=require(_0x5e95('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5e95('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5e95('0xc'));var qs=require(_0x5e95('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e95('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x5e95('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0x5e95('0x10'));var db=require('../../mysqldb')['db'];config[_0x5e95('0x11')]=_[_0x5e95('0x12')](config[_0x5e95('0x11')],{'host':'localhost','port':0x18eb});var socket=require(_0x5e95('0x13'))(new Redis(config[_0x5e95('0x11')]));require(_0x5e95('0x14'))[_0x5e95('0x15')](socket);var jayson=require(_0x5e95('0x16'));var client=jayson[_0x5e95('0x17')][_0x5e95('0x18')]({'port':0x232c});var client9002=jayson[_0x5e95('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf990e9,_0x1af942,_0x5db5a6,_0x4bbb5b){return new BPromise(function(_0x1cba10,_0x1c71ae){var _0x181dc6=_0x4bbb5b||client;return _0x181dc6['request'](_0xf990e9,_0x5db5a6)[_0x5e95('0x19')](function(_0x5e86c6){logger[_0x5e95('0x1a')](_0x5e95('0x1b'),_0x1af942,_0x5e95('0x1c'));logger[_0x5e95('0x1d')](_0x5e95('0x1e'),_0x1af942,'request\x20sent',JSON['stringify'](_0x5e86c6));if(_0x5e86c6[_0x5e95('0x1f')]){if(_0x5e86c6[_0x5e95('0x1f')][_0x5e95('0x20')]===0x1f4){logger[_0x5e95('0x1f')](_0x5e95('0x1b'),_0x1af942,_0x5e86c6['error'][_0x5e95('0x21')]);return _0x1c71ae(_0x5e86c6[_0x5e95('0x1f')][_0x5e95('0x21')]);}logger[_0x5e95('0x1f')](_0x5e95('0x1b'),_0x1af942,_0x5e86c6[_0x5e95('0x1f')][_0x5e95('0x21')]);return _0x1cba10(_0x5e86c6[_0x5e95('0x1f')]['message']);}else{logger[_0x5e95('0x1a')](_0x5e95('0x1b'),_0x1af942,'request\x20sent');_0x1cba10(_0x5e86c6[_0x5e95('0x22')][_0x5e95('0x21')]);}})[_0x5e95('0x23')](function(_0x4043aa){logger[_0x5e95('0x1f')](_0x5e95('0x1b'),_0x1af942,_0x4043aa);_0x1c71ae(_0x4043aa);});});}function respondWithStatusCode(_0xf06c61,_0x3b1e57){_0x3b1e57=_0x3b1e57||0xcc;return function(_0x4fb2ed){if(_0x4fb2ed){return _0xf06c61[_0x5e95('0x24')](_0x3b1e57);}return _0xf06c61[_0x5e95('0x25')](_0x3b1e57)[_0x5e95('0x26')]();};}function respondWithResult(_0x2ff740,_0x14e9a0){_0x14e9a0=_0x14e9a0||0xc8;return function(_0x2f0714){if(_0x2f0714){return _0x2ff740[_0x5e95('0x25')](_0x14e9a0)[_0x5e95('0x27')](_0x2f0714);}};}function respondWithFilteredResult(_0x17e572,_0x368a4a){return function(_0x3b244e){if(_0x3b244e){var _0x4ab21c=typeof _0x368a4a['offset']===_0x5e95('0x28')&&typeof _0x368a4a[_0x5e95('0x29')]==='undefined';var _0x55a697=_0x3b244e[_0x5e95('0x2a')];var _0x14af5a=_0x4ab21c?0x0:_0x368a4a['offset'];var _0x242562=_0x4ab21c?_0x3b244e['count']:_0x368a4a[_0x5e95('0x2b')]+_0x368a4a[_0x5e95('0x29')];var _0x12a5ec;if(_0x242562>=_0x55a697){_0x242562=_0x55a697;_0x12a5ec=0xc8;}else{_0x12a5ec=0xce;}_0x17e572['status'](_0x12a5ec);return _0x17e572[_0x5e95('0x2c')](_0x5e95('0x2d'),_0x14af5a+'-'+_0x242562+'/'+_0x55a697)['json'](_0x3b244e);}return null;};}function patchUpdates(_0x320a2f){return function(_0x802096){try{jsonpatch[_0x5e95('0x2e')](_0x802096,_0x320a2f,!![]);}catch(_0x24e379){return BPromise[_0x5e95('0x2f')](_0x24e379);}return _0x802096[_0x5e95('0x30')]();};}function saveUpdates(_0x2866fd,_0x353272){return function(_0x373164){if(_0x373164){return _0x373164[_0x5e95('0x31')](_0x2866fd)[_0x5e95('0x19')](function(_0x3dd917){return _0x3dd917;});}return null;};}function removeEntity(_0x34f5bf,_0x5b14af){return function(_0x91655b){if(_0x91655b){return _0x91655b[_0x5e95('0x32')]()[_0x5e95('0x19')](function(){var _0x558e6a=_0x91655b['get']({'plain':!![]});var _0x2fc8c0=_0x5e95('0x33');return db[_0x5e95('0x34')]['destroy']({'where':{'type':_0x2fc8c0,'resourceId':_0x558e6a['id']}})[_0x5e95('0x19')](function(){return _0x91655b;});})[_0x5e95('0x19')](function(){_0x34f5bf['status'](0xcc)[_0x5e95('0x26')]();});}};}function handleEntityNotFound(_0x12f49a,_0xb3081b){return function(_0x5bb0f9){if(!_0x5bb0f9){_0x12f49a[_0x5e95('0x24')](0x194);}return _0x5bb0f9;};}function handleError(_0x65b6e3,_0x381b6e){_0x381b6e=_0x381b6e||0x1f4;return function(_0x1b9698){logger[_0x5e95('0x1f')](_0x1b9698[_0x5e95('0x35')]);if(_0x1b9698[_0x5e95('0x36')]){delete _0x1b9698['name'];}_0x65b6e3[_0x5e95('0x25')](_0x381b6e)[_0x5e95('0x37')](_0x1b9698);};}exports[_0x5e95('0x38')]=function(_0x54fe80,_0x121809){var _0x3184c5={'include':[{'model':db[_0x5e95('0x39')],'as':'mandatoryDispositionPause'}]},_0x102334={},_0x404832={'count':0x0,'rows':[]};var _0x5a1427=_[_0x5e95('0x3a')](db[_0x5e95('0x3b')]['rawAttributes'],function(_0x31ee05){return{'name':_0x31ee05[_0x5e95('0x3c')],'type':_0x31ee05['type']['key']};});_0x102334['model']=_['map'](_0x5a1427,_0x5e95('0x36'));_0x102334['query']=_[_0x5e95('0x3d')](_0x54fe80[_0x5e95('0x3e')]);_0x102334[_0x5e95('0x3f')]=_[_0x5e95('0x40')](_0x102334[_0x5e95('0x41')],_0x102334[_0x5e95('0x3e')]);_0x3184c5[_0x5e95('0x42')]=_[_0x5e95('0x40')](_0x102334[_0x5e95('0x41')],qs[_0x5e95('0x43')](_0x54fe80[_0x5e95('0x3e')][_0x5e95('0x43')]));_0x3184c5[_0x5e95('0x42')]=_0x3184c5[_0x5e95('0x42')]['length']?_0x3184c5[_0x5e95('0x42')]:_0x102334[_0x5e95('0x41')];if(!_0x54fe80[_0x5e95('0x3e')][_0x5e95('0x44')]('nolimit')){_0x3184c5['limit']=qs[_0x5e95('0x29')](_0x54fe80[_0x5e95('0x3e')][_0x5e95('0x29')]);_0x3184c5['offset']=qs[_0x5e95('0x2b')](_0x54fe80['query'][_0x5e95('0x2b')]);}_0x3184c5[_0x5e95('0x45')]=qs[_0x5e95('0x46')](_0x54fe80[_0x5e95('0x3e')]['sort']);_0x3184c5['where']=qs[_0x5e95('0x3f')](_[_0x5e95('0x47')](_0x54fe80['query'],_0x102334[_0x5e95('0x3f')]),_0x5a1427);if(_0x54fe80[_0x5e95('0x3e')][_0x5e95('0x48')]){_0x3184c5[_0x5e95('0x49')]=_[_0x5e95('0x4a')](_0x3184c5[_0x5e95('0x49')],{'$or':_[_0x5e95('0x3a')](_0x5a1427,function(_0x43822d){if(_0x43822d[_0x5e95('0x4b')]!==_0x5e95('0x4c')){var _0x4a3fe3={};_0x4a3fe3[_0x43822d[_0x5e95('0x36')]]={'$like':'%'+_0x54fe80['query'][_0x5e95('0x48')]+'%'};return _0x4a3fe3;}})});}_0x3184c5=_[_0x5e95('0x4a')]({},_0x3184c5,_0x54fe80['options']);var _0x4a7ec3={'where':_0x3184c5['where']};return db[_0x5e95('0x3b')][_0x5e95('0x2a')](_0x4a7ec3)[_0x5e95('0x19')](function(_0xb389ea){_0x404832[_0x5e95('0x2a')]=_0xb389ea;if(_0x54fe80[_0x5e95('0x3e')][_0x5e95('0x4d')]){_0x3184c5[_0x5e95('0x4e')]=[{'all':!![]}];}return db[_0x5e95('0x3b')][_0x5e95('0x4f')](_0x3184c5);})[_0x5e95('0x19')](function(_0x419b1d){_0x404832[_0x5e95('0x50')]=_0x419b1d;return _0x404832;})['then'](respondWithFilteredResult(_0x121809,_0x3184c5))[_0x5e95('0x23')](handleError(_0x121809,null));};exports[_0x5e95('0x51')]=function(_0x418efb,_0x8d137e){var _0x3f3808={'raw':![],'where':{'id':_0x418efb[_0x5e95('0x52')]['id']},'include':[{'model':db[_0x5e95('0x39')],'as':_0x5e95('0x53')}]},_0xb15d97={};_0xb15d97[_0x5e95('0x41')]=_[_0x5e95('0x3d')](db[_0x5e95('0x3b')][_0x5e95('0x54')]);_0xb15d97[_0x5e95('0x3e')]=_['keys'](_0x418efb['query']);_0xb15d97[_0x5e95('0x3f')]=_[_0x5e95('0x40')](_0xb15d97[_0x5e95('0x41')],_0xb15d97[_0x5e95('0x3e')]);_0x3f3808[_0x5e95('0x42')]=_['intersection'](_0xb15d97[_0x5e95('0x41')],qs['fields'](_0x418efb[_0x5e95('0x3e')][_0x5e95('0x43')]));_0x3f3808['attributes']=_0x3f3808[_0x5e95('0x42')][_0x5e95('0x55')]?_0x3f3808[_0x5e95('0x42')]:_0xb15d97[_0x5e95('0x41')];if(_0x418efb[_0x5e95('0x3e')][_0x5e95('0x4d')]){_0x3f3808[_0x5e95('0x4e')]=[{'all':!![]}];}_0x3f3808=_[_0x5e95('0x4a')]({},_0x3f3808,_0x418efb[_0x5e95('0x56')]);return db[_0x5e95('0x3b')][_0x5e95('0x57')](_0x3f3808)[_0x5e95('0x19')](handleEntityNotFound(_0x8d137e,null))['then'](respondWithResult(_0x8d137e,null))[_0x5e95('0x23')](handleError(_0x8d137e,null));};exports[_0x5e95('0x58')]=function(_0x4b18a3,_0x1c67c9){return db[_0x5e95('0x3b')][_0x5e95('0x58')](_0x4b18a3[_0x5e95('0x59')],{})[_0x5e95('0x19')](function(_0x55243f){var _0x5a90ca=_0x4b18a3[_0x5e95('0x5a')][_0x5e95('0x5b')]({'plain':!![]});if(!_0x5a90ca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a90ca[_0x5e95('0x5c')]===_0x5e95('0x5a')){var _0x566619=_0x55243f[_0x5e95('0x5b')]({'plain':!![]});var _0x4dc14e='FaxAccounts';return db[_0x5e95('0x5d')]['find']({'where':{'name':_0x4dc14e,'userProfileId':_0x5a90ca[_0x5e95('0x5e')]},'raw':!![]})[_0x5e95('0x19')](function(_0x3319e4){if(_0x3319e4&&_0x3319e4[_0x5e95('0x5f')]===0x0){return db[_0x5e95('0x34')]['create']({'name':_0x566619[_0x5e95('0x36')],'resourceId':_0x566619['id'],'type':_0x3319e4[_0x5e95('0x36')],'sectionId':_0x3319e4['id']},{})['then'](function(){return _0x55243f;});}else{return _0x55243f;}})[_0x5e95('0x23')](function(_0x4e66eb){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e66eb);throw _0x4e66eb;});}return _0x55243f;})['then'](respondWithResult(_0x1c67c9,0xc9))[_0x5e95('0x23')](handleError(_0x1c67c9,null));};exports['update']=function(_0x55774a,_0x282b39){if(_0x55774a[_0x5e95('0x59')]['id']){delete _0x55774a[_0x5e95('0x59')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x55774a[_0x5e95('0x52')]['id']},'include':[{'model':db[_0x5e95('0x39')],'as':_0x5e95('0x53')}]})['then'](handleEntityNotFound(_0x282b39,null))[_0x5e95('0x19')](saveUpdates(_0x55774a[_0x5e95('0x59')],null))['then'](respondWithResult(_0x282b39,null))[_0x5e95('0x23')](handleError(_0x282b39,null));};exports[_0x5e95('0x32')]=function(_0x35a961,_0x15bb8e){return db[_0x5e95('0x3b')][_0x5e95('0x57')]({'where':{'id':_0x35a961['params']['id']}})[_0x5e95('0x19')](handleEntityNotFound(_0x15bb8e,null))[_0x5e95('0x19')](removeEntity(_0x15bb8e,null))[_0x5e95('0x23')](handleError(_0x15bb8e,null));};exports[_0x5e95('0x60')]=function(_0x59567a,_0x417663){return db[_0x5e95('0x3b')][_0x5e95('0x60')]()[_0x5e95('0x19')](respondWithResult(_0x417663,null))[_0x5e95('0x23')](handleError(_0x417663,null));};exports[_0x5e95('0x61')]=function(_0x536184,_0x2fc44f,_0x41a0e5){if(_0x536184['body']['id']){delete _0x536184[_0x5e95('0x59')]['id'];}return db[_0x5e95('0x3b')][_0x5e95('0x57')]({'where':{'id':_0x536184[_0x5e95('0x52')]['id']}})['then'](handleEntityNotFound(_0x2fc44f,null))['then'](function(_0x3d144f){if(_0x3d144f){_0x536184['body'][_0x5e95('0x62')]=_0x3d144f['id'];return db[_0x5e95('0x63')][_0x5e95('0x58')](_0x536184[_0x5e95('0x59')]);}})[_0x5e95('0x19')](respondWithResult(_0x2fc44f,null))[_0x5e95('0x23')](handleError(_0x2fc44f,null));};exports[_0x5e95('0x64')]=function(_0x16c9ea,_0x2f59af,_0x129a5f){var _0x221103={'raw':![],'where':{}};var _0x4d1e76={};var _0x42170d={'count':0x0,'rows':[]};return db[_0x5e95('0x3b')][_0x5e95('0x65')]({'where':{'id':_0x16c9ea['params']['id']}})['then'](handleEntityNotFound(_0x2f59af,null))['then'](function(_0xa29055){if(_0xa29055){_0x4d1e76[_0x5e95('0x41')]=_[_0x5e95('0x3d')](db['Disposition'][_0x5e95('0x54')]);_0x4d1e76[_0x5e95('0x3e')]=_[_0x5e95('0x3d')](_0x16c9ea[_0x5e95('0x3e')]);_0x4d1e76[_0x5e95('0x3f')]=_[_0x5e95('0x40')](_0x4d1e76[_0x5e95('0x41')],_0x4d1e76['query']);_0x221103[_0x5e95('0x42')]=_[_0x5e95('0x40')](_0x4d1e76[_0x5e95('0x41')],qs['fields'](_0x16c9ea[_0x5e95('0x3e')]['fields']));_0x221103[_0x5e95('0x42')]=_0x221103[_0x5e95('0x42')][_0x5e95('0x55')]?_0x221103[_0x5e95('0x42')]:_0x4d1e76[_0x5e95('0x41')];if(!_0x16c9ea['query']['hasOwnProperty'](_0x5e95('0x66'))){_0x221103['limit']=qs['limit'](_0x16c9ea[_0x5e95('0x3e')]['limit']);_0x221103[_0x5e95('0x2b')]=qs[_0x5e95('0x2b')](_0x16c9ea[_0x5e95('0x3e')][_0x5e95('0x2b')]);}_0x221103[_0x5e95('0x45')]=qs[_0x5e95('0x46')](_0x16c9ea['query'][_0x5e95('0x46')]);_0x221103['where']=qs[_0x5e95('0x3f')](_[_0x5e95('0x47')](_0x16c9ea[_0x5e95('0x3e')],_0x4d1e76[_0x5e95('0x3f')]));_0x221103[_0x5e95('0x49')][_0x5e95('0x62')]=_0xa29055['id'];if(_0x16c9ea[_0x5e95('0x3e')][_0x5e95('0x48')]){_0x221103[_0x5e95('0x49')]=_['merge'](_0x221103[_0x5e95('0x49')],{'$or':_[_0x5e95('0x3a')](_0x221103[_0x5e95('0x42')],function(_0x1000de){var _0x454d8f={};_0x454d8f[_0x1000de]={'$like':'%'+_0x16c9ea[_0x5e95('0x3e')][_0x5e95('0x48')]+'%'};return _0x454d8f;})});}_0x221103=_[_0x5e95('0x4a')]({},_0x221103,_0x16c9ea['options']);return db[_0x5e95('0x63')][_0x5e95('0x2a')]({'where':_0x221103[_0x5e95('0x49')]})[_0x5e95('0x19')](function(_0xa67dad){_0x42170d[_0x5e95('0x2a')]=_0xa67dad;if(_0x16c9ea[_0x5e95('0x3e')][_0x5e95('0x4d')]){_0x221103[_0x5e95('0x4e')]=[{'all':!![]}];}return db[_0x5e95('0x63')][_0x5e95('0x4f')](_0x221103);})[_0x5e95('0x19')](function(_0x336162){_0x42170d[_0x5e95('0x50')]=_0x336162;return _0x42170d;});}})[_0x5e95('0x19')](respondWithFilteredResult(_0x2f59af,_0x221103))[_0x5e95('0x23')](handleError(_0x2f59af,null));};exports[_0x5e95('0x67')]=function(_0x489332,_0x4fac5d,_0x3a19e3){return db[_0x5e95('0x3b')]['find']({'where':{'id':_0x489332[_0x5e95('0x52')]['id']}})[_0x5e95('0x19')](handleEntityNotFound(_0x4fac5d,null))[_0x5e95('0x19')](function(_0x1e5738){if(_0x1e5738){return _0x1e5738['removeDispositions'](_0x489332[_0x5e95('0x3e')][_0x5e95('0x68')]);}})[_0x5e95('0x19')](respondWithStatusCode(_0x4fac5d,null))[_0x5e95('0x23')](handleError(_0x4fac5d,null));};exports[_0x5e95('0x69')]=function(_0xd11d38,_0x50a4b3,_0x4e9f42){if(_0xd11d38[_0x5e95('0x59')]['id']){delete _0xd11d38[_0x5e95('0x59')]['id'];}return db['FaxAccount'][_0x5e95('0x57')]({'where':{'id':_0xd11d38[_0x5e95('0x52')]['id']}})['then'](handleEntityNotFound(_0x50a4b3,null))[_0x5e95('0x19')](function(_0x1e1701){if(_0x1e1701){_0xd11d38['body']['FaxAccountId']=_0x1e1701['id'];return db['CannedAnswer']['create'](_0xd11d38[_0x5e95('0x59')]);}})[_0x5e95('0x19')](respondWithResult(_0x50a4b3,null))[_0x5e95('0x23')](handleError(_0x50a4b3,null));};exports[_0x5e95('0x6a')]=function(_0x3019ab,_0x13ef35,_0x1d25c7){var _0x2a35a2={'raw':![],'where':{}};var _0x23b308={};var _0x3cf0c8={'count':0x0,'rows':[]};return db[_0x5e95('0x3b')][_0x5e95('0x65')]({'where':{'id':_0x3019ab[_0x5e95('0x52')]['id']}})[_0x5e95('0x19')](handleEntityNotFound(_0x13ef35,null))['then'](function(_0x2d44d6){if(_0x2d44d6){_0x23b308['model']=_[_0x5e95('0x3d')](db[_0x5e95('0x6b')][_0x5e95('0x54')]);_0x23b308[_0x5e95('0x3e')]=_[_0x5e95('0x3d')](_0x3019ab[_0x5e95('0x3e')]);_0x23b308[_0x5e95('0x3f')]=_['intersection'](_0x23b308['model'],_0x23b308[_0x5e95('0x3e')]);_0x2a35a2[_0x5e95('0x42')]=_['intersection'](_0x23b308[_0x5e95('0x41')],qs[_0x5e95('0x43')](_0x3019ab[_0x5e95('0x3e')][_0x5e95('0x43')]));_0x2a35a2[_0x5e95('0x42')]=_0x2a35a2['attributes'][_0x5e95('0x55')]?_0x2a35a2[_0x5e95('0x42')]:_0x23b308[_0x5e95('0x41')];if(!_0x3019ab[_0x5e95('0x3e')]['hasOwnProperty'](_0x5e95('0x66'))){_0x2a35a2[_0x5e95('0x29')]=qs[_0x5e95('0x29')](_0x3019ab[_0x5e95('0x3e')][_0x5e95('0x29')]);_0x2a35a2[_0x5e95('0x2b')]=qs['offset'](_0x3019ab[_0x5e95('0x3e')]['offset']);}_0x2a35a2['order']=qs[_0x5e95('0x46')](_0x3019ab[_0x5e95('0x3e')][_0x5e95('0x46')]);_0x2a35a2[_0x5e95('0x49')]=qs['filters'](_[_0x5e95('0x47')](_0x3019ab[_0x5e95('0x3e')],_0x23b308[_0x5e95('0x3f')]));_0x2a35a2[_0x5e95('0x49')]['FaxAccountId']=_0x2d44d6['id'];if(_0x3019ab['query'][_0x5e95('0x48')]){_0x2a35a2[_0x5e95('0x49')]=_['merge'](_0x2a35a2[_0x5e95('0x49')],{'$or':_[_0x5e95('0x3a')](_0x2a35a2[_0x5e95('0x42')],function(_0x2044bb){var _0x2e275c={};_0x2e275c[_0x2044bb]={'$like':'%'+_0x3019ab['query'][_0x5e95('0x48')]+'%'};return _0x2e275c;})});}_0x2a35a2=_[_0x5e95('0x4a')]({},_0x2a35a2,_0x3019ab[_0x5e95('0x56')]);return db[_0x5e95('0x6b')][_0x5e95('0x2a')]({'where':_0x2a35a2[_0x5e95('0x49')]})[_0x5e95('0x19')](function(_0x1cd60b){_0x3cf0c8[_0x5e95('0x2a')]=_0x1cd60b;if(_0x3019ab[_0x5e95('0x3e')][_0x5e95('0x4d')]){_0x2a35a2[_0x5e95('0x4e')]=[{'all':!![]}];}return db[_0x5e95('0x6b')][_0x5e95('0x4f')](_0x2a35a2);})[_0x5e95('0x19')](function(_0x548bbb){_0x3cf0c8['rows']=_0x548bbb;return _0x3cf0c8;});}})[_0x5e95('0x19')](respondWithFilteredResult(_0x13ef35,_0x2a35a2))[_0x5e95('0x23')](handleError(_0x13ef35,null));};exports[_0x5e95('0x6c')]=function(_0x445337,_0x2bd014,_0x2a326c){return db[_0x5e95('0x3b')][_0x5e95('0x57')]({'where':{'id':_0x445337[_0x5e95('0x52')]['id']}})[_0x5e95('0x19')](handleEntityNotFound(_0x2bd014,null))['then'](function(_0x3fd3cd){if(_0x3fd3cd){return _0x3fd3cd['removeAnswers'](_0x445337[_0x5e95('0x3e')][_0x5e95('0x68')]);}})[_0x5e95('0x19')](respondWithStatusCode(_0x2bd014,null))[_0x5e95('0x23')](handleError(_0x2bd014,null));};exports[_0x5e95('0x6d')]=function(_0x1d601e,_0xd8ebb5,_0x178779){return db[_0x5e95('0x6e')][_0x5e95('0x57')]({'where':{'id':_0x1d601e[_0x5e95('0x52')]['id']}})['then'](handleEntityNotFound(_0xd8ebb5,null))[_0x5e95('0x19')](function(_0x5f45a3){if(_0x5f45a3){return _0x5f45a3['addInteraction'](_0x1d601e[_0x5e95('0x59')][_0x5e95('0x68')],_[_0x5e95('0x6f')](_0x1d601e['body'],[_0x5e95('0x68'),'id'])||{});}})[_0x5e95('0x19')](respondWithResult(_0xd8ebb5,null))[_0x5e95('0x23')](handleError(_0xd8ebb5,null));};exports[_0x5e95('0x70')]=function(_0x45ee01,_0x41e501,_0x2feb4a){var _0x26544a={'raw':![],'where':{}};var _0x56240a={};var _0x558862={'count':0x0,'rows':[]};return db[_0x5e95('0x3b')][_0x5e95('0x65')]({'where':{'id':_0x45ee01[_0x5e95('0x52')]['id']}})['then'](handleEntityNotFound(_0x41e501,null))['then'](function(_0x3fa046){if(_0x3fa046){_0x56240a['model']=_[_0x5e95('0x3d')](db['FaxInteraction'][_0x5e95('0x54')]);_0x56240a[_0x5e95('0x3e')]=_[_0x5e95('0x3d')](_0x45ee01[_0x5e95('0x3e')]);_0x56240a[_0x5e95('0x3f')]=_[_0x5e95('0x40')](_0x56240a['model'],_0x56240a[_0x5e95('0x3e')]);_0x26544a[_0x5e95('0x42')]=_[_0x5e95('0x40')](_0x56240a[_0x5e95('0x41')],qs[_0x5e95('0x43')](_0x45ee01[_0x5e95('0x3e')]['fields']));_0x26544a[_0x5e95('0x42')]=_0x26544a[_0x5e95('0x42')][_0x5e95('0x55')]?_0x26544a['attributes']:_0x56240a[_0x5e95('0x41')];if(!_0x45ee01[_0x5e95('0x3e')][_0x5e95('0x44')](_0x5e95('0x66'))){_0x26544a[_0x5e95('0x29')]=qs[_0x5e95('0x29')](_0x45ee01[_0x5e95('0x3e')][_0x5e95('0x29')]);_0x26544a[_0x5e95('0x2b')]=qs['offset'](_0x45ee01[_0x5e95('0x3e')]['offset']);}_0x26544a[_0x5e95('0x45')]=qs[_0x5e95('0x46')](_0x45ee01['query'][_0x5e95('0x46')]);_0x26544a[_0x5e95('0x49')]=qs[_0x5e95('0x3f')](_[_0x5e95('0x47')](_0x45ee01[_0x5e95('0x3e')],_0x56240a[_0x5e95('0x3f')]));_0x26544a[_0x5e95('0x49')][_0x5e95('0x62')]=_0x3fa046['id'];if(_0x45ee01['query'][_0x5e95('0x48')]){_0x26544a['where']=_[_0x5e95('0x4a')](_0x26544a['where'],{'$or':_['map'](_0x26544a[_0x5e95('0x42')],function(_0x4ae62b){var _0x623bdc={};_0x623bdc[_0x4ae62b]={'$like':'%'+_0x45ee01[_0x5e95('0x3e')]['filter']+'%'};return _0x623bdc;})});}_0x26544a=_['merge']({},_0x26544a,_0x45ee01['options']);return db['FaxInteraction'][_0x5e95('0x2a')]({'where':_0x26544a[_0x5e95('0x49')]})[_0x5e95('0x19')](function(_0x2a85e4){_0x558862[_0x5e95('0x2a')]=_0x2a85e4;if(_0x45ee01[_0x5e95('0x3e')][_0x5e95('0x4d')]){_0x26544a[_0x5e95('0x4e')]=[{'model':db[_0x5e95('0x71')],'as':_0x5e95('0x72'),'required':![]},{'model':db['User'],'as':_0x5e95('0x73'),'attributes':[_0x5e95('0x36'),'fullname',_0x5e95('0x74')],'required':![]},{'model':db['Tag'],'as':_0x5e95('0x75'),'attributes':['id',_0x5e95('0x36'),_0x5e95('0x76')],'where':_0x45ee01[_0x5e95('0x3e')][_0x5e95('0x77')]?{'id':_0x45ee01[_0x5e95('0x3e')]['tag']}:undefined,'required':_0x45ee01[_0x5e95('0x3e')]['tag']?!![]:![]}];}return db[_0x5e95('0x6e')][_0x5e95('0x4f')](_0x26544a);})['then'](function(_0x5a8e66){_0x558862[_0x5e95('0x50')]=_0x5a8e66;return _0x558862;});}})[_0x5e95('0x19')](respondWithFilteredResult(_0x41e501,_0x26544a))[_0x5e95('0x23')](handleError(_0x41e501,null));};exports['addApplications']=function(_0x201d88,_0x276570){var _0x3557b6=_0x201d88['params']['id'];var _0x122556=_0x201d88[_0x5e95('0x59')];var _0x21b70f=0xc8;var _0x4ffd35=null;return db[_0x5e95('0x78')][_0x5e95('0x79')]({'isolationLevel':db['sequelize'][_0x5e95('0x7a')][_0x5e95('0x7b')][_0x5e95('0x7c')]},function(_0x35ee13){return db[_0x5e95('0x3b')]['findOne']({'where':{'id':_0x3557b6},'transaction':_0x35ee13})[_0x5e95('0x19')](function(_0x3f57cb){if(_0x3f57cb){return db[_0x5e95('0x7d')]['destroy']({'where':{'FaxAccountId':_0x3557b6},'transaction':_0x35ee13})[_0x5e95('0x19')](function(){var _0x1a4741=_[_0x5e95('0x3a')](_0x122556,function(_0xde5ed5){_0xde5ed5['FaxAccountId']=_0x3557b6;return _0xde5ed5;});return db['FaxApplication']['bulkCreate'](_0x1a4741,{'transaction':_0x35ee13});});}else{_0x21b70f=0x194;_0x4ffd35=[];}});})[_0x5e95('0x19')](function(){if(_0x21b70f!==0x194){return db[_0x5e95('0x7d')][_0x5e95('0x7e')]({'where':{'FaxAccountId':_0x3557b6},'order':_0x5e95('0x7f')})[_0x5e95('0x19')](function(_0x303626){_0x4ffd35=_0x303626;});}})[_0x5e95('0x23')](function(_0x5e1ddc){_0x21b70f=0x1f4;logger[_0x5e95('0x1f')](_0x5e1ddc[_0x5e95('0x35')]);if(_0x5e1ddc[_0x5e95('0x36')]){delete _0x5e1ddc[_0x5e95('0x36')];}_0x4ffd35=_0x5e1ddc;})['finally'](function(){if(_0x4ffd35===null){_0x276570[_0x5e95('0x24')](_0x21b70f);}else{if(_0x21b70f===0x1f4){_0x276570[_0x5e95('0x25')](_0x21b70f)[_0x5e95('0x37')](_0x4ffd35);}else{_0x276570[_0x5e95('0x25')](_0x21b70f)['json'](_0x4ffd35);}}});};exports['getApplications']=function(_0x519fe8,_0x1dda14,_0x552bba){var _0x1867fb={};var _0x47d2f5={};var _0x1330c0;var _0x4cba6c;return db['FaxAccount']['findOne']({'where':{'id':_0x519fe8[_0x5e95('0x52')]['id']}})[_0x5e95('0x19')](handleEntityNotFound(_0x1dda14,null))[_0x5e95('0x19')](function(_0x5792d7){if(_0x5792d7){_0x1330c0=_0x5792d7;_0x47d2f5[_0x5e95('0x41')]=_['keys'](db[_0x5e95('0x7d')][_0x5e95('0x54')]);_0x47d2f5[_0x5e95('0x3e')]=_[_0x5e95('0x3d')](_0x519fe8[_0x5e95('0x3e')]);_0x47d2f5[_0x5e95('0x3f')]=_[_0x5e95('0x40')](_0x47d2f5[_0x5e95('0x41')],_0x47d2f5['query']);_0x1867fb[_0x5e95('0x42')]=_[_0x5e95('0x40')](_0x47d2f5['model'],qs[_0x5e95('0x43')](_0x519fe8[_0x5e95('0x3e')][_0x5e95('0x43')]));_0x1867fb['attributes']=_0x1867fb[_0x5e95('0x42')][_0x5e95('0x55')]?_0x1867fb[_0x5e95('0x42')]:_0x47d2f5[_0x5e95('0x41')];_0x1867fb['order']=qs['sort'](_0x519fe8[_0x5e95('0x3e')]['sort']);_0x1867fb[_0x5e95('0x49')]=qs[_0x5e95('0x3f')](_['pick'](_0x519fe8[_0x5e95('0x3e')],_0x47d2f5['filters']));if(_0x519fe8[_0x5e95('0x3e')]['filter']){_0x1867fb[_0x5e95('0x49')]=_[_0x5e95('0x4a')](_0x1867fb[_0x5e95('0x49')],{'$or':_[_0x5e95('0x3a')](_0x1867fb['attributes'],function(_0x1a2b12){var _0x1c6b70={};_0x1c6b70[_0x1a2b12]={'$like':'%'+_0x519fe8[_0x5e95('0x3e')][_0x5e95('0x48')]+'%'};return _0x1c6b70;})});}_0x1867fb=_[_0x5e95('0x4a')]({},_0x1867fb,_0x519fe8[_0x5e95('0x56')]);return _0x1330c0[_0x5e95('0x80')](_0x1867fb);}})[_0x5e95('0x19')](function(_0x148895){if(_0x148895){_0x4cba6c=_0x148895[_0x5e95('0x55')];if(!_0x519fe8[_0x5e95('0x3e')][_0x5e95('0x44')]('nolimit')){_0x1867fb[_0x5e95('0x29')]=qs[_0x5e95('0x29')](_0x519fe8[_0x5e95('0x3e')][_0x5e95('0x29')]);_0x1867fb[_0x5e95('0x2b')]=qs[_0x5e95('0x2b')](_0x519fe8[_0x5e95('0x3e')]['offset']);}return _0x1330c0['getApplications'](_0x1867fb);}})[_0x5e95('0x19')](function(_0x49c491){if(_0x49c491){return _0x49c491?{'count':_0x4cba6c,'rows':_0x49c491}:null;}})[_0x5e95('0x19')](respondWithResult(_0x1dda14,null))['catch'](handleError(_0x1dda14,null));};function Extension(_0x39e466,_0x2772d6,_0x460f21,_0x3241e5){this['context']=_0x5e95('0x81');this[_0x5e95('0x82')]=_0x39e466[_0x5e95('0x83')];this[_0x5e95('0x84')]=_0x3241e5;this[_0x5e95('0x4b')]=_0x5e95('0x85');this[_0x5e95('0x86')]=_0x5e95('0x87');this[_0x5e95('0x62')]=_0x39e466['id'];this[_0x5e95('0x7f')]=_0x2772d6;this[_0x5e95('0x88')]=_0x460f21;}function createExtensionsReciveFax(_0x251297){var _0x532bc7=0x1;var _0xaccbff=[];_0xaccbff[_0x5e95('0x89')](new Extension(_0x251297,_0x532bc7,'',_0x5e95('0x8a')));_0x532bc7+=0x1;_0xaccbff[_0x5e95('0x89')](new Extension(_0x251297,_0x532bc7,_0x5e95('0x8b'),_0x5e95('0x8c')));_0x532bc7+=0x1;for(var _0x200b19 in _0x251297){if(_0x251297[_0x5e95('0x44')](_0x200b19)&&(_0x200b19===_0x5e95('0x8d')||_0x200b19===_0x5e95('0x83')||_0x200b19===_0x5e95('0x8e')||_0x200b19===_0x5e95('0x8f')||_0x200b19==='headerinfo'||_0x200b19==='maxrate'||_0x200b19===_0x5e95('0x90')||_0x200b19===_0x5e95('0x91')||_0x200b19===_0x5e95('0x92'))){_0xaccbff['push'](new Extension(_0x251297,_0x532bc7,'FAXOPT('+_0x200b19+')='+_0x251297[_0x200b19],_0x5e95('0x8c')));_0x532bc7+=0x1;}}_0xaccbff[_0x5e95('0x89')](new Extension(_0x251297,_0x532bc7,'6',_0x5e95('0x93')));_0x532bc7+=0x1;_0xaccbff[_0x5e95('0x89')](new Extension(_0x251297,_0x532bc7,_0x5e95('0x94'),_0x5e95('0x95')));_0x532bc7=0x0;return _0xaccbff;}exports[_0x5e95('0x96')]=function(_0x396420,_0x3a1638,_0x98e0a9){var _0x1f0cfc;return db[_0x5e95('0x78')]['transaction'](function(_0x55700a){return db[_0x5e95('0x3b')][_0x5e95('0x58')](_0x396420[_0x5e95('0x59')],{'transaction':_0x55700a})['then'](function(_0x5320c8){_0x1f0cfc=_0x5320c8[_0x5e95('0x5b')]({'plain':!![]});return db[_0x5e95('0x97')][_0x5e95('0x98')](createExtensionsReciveFax(_0x1f0cfc),{'transaction':_0x55700a});});})[_0x5e95('0x19')](function(){return _0x1f0cfc;})[_0x5e95('0x19')](respondWithResult(_0x3a1638,null))[_0x5e95('0x23')](handleError(_0x3a1638,null));};exports[_0x5e95('0x99')]=function(_0x11f6a2,_0x3de6c2,_0x3e11ce){var _0x496154;return db[_0x5e95('0x78')][_0x5e95('0x79')](function(_0x102a3e){return db['FaxAccount'][_0x5e95('0x31')](_0x11f6a2[_0x5e95('0x59')],{'where':{'id':_0x11f6a2[_0x5e95('0x59')]['id']},'transaction':_0x102a3e})[_0x5e95('0x19')](function(_0x1753d0){return db[_0x5e95('0x97')][_0x5e95('0x32')]({'where':{'FaxAccountId':_0x11f6a2[_0x5e95('0x59')]['id']},'transaction':_0x102a3e})['then'](function(_0x17b5ae){return db['VoiceExtension'][_0x5e95('0x98')](createExtensionsReciveFax(_[_0x5e95('0x6f')](_0x11f6a2[_0x5e95('0x59')],[_0x5e95('0x9a'),_0x5e95('0x9b'),_0x5e95('0x9c'),_0x5e95('0x9d'),_0x5e95('0x9e'),_0x5e95('0x9f')])),{'transaction':_0x102a3e});});});})[_0x5e95('0x19')](function(){return db['FaxAccount'][_0x5e95('0xa0')](_0x11f6a2[_0x5e95('0x59')]['id']);})[_0x5e95('0x19')](respondWithResult(_0x3de6c2,null))['catch'](handleError(_0x3de6c2,null));};exports[_0x5e95('0xa1')]=function(_0x15a7e7,_0x25f16f,_0x3f6fd1){var _0x1117c6={'raw':!![],'where':{}};var _0x482b6f={};var _0x38e3cf={'count':0x0,'rows':[]};return db[_0x5e95('0x3b')][_0x5e95('0x65')]({'where':{'id':_0x15a7e7[_0x5e95('0x52')]['id']}})[_0x5e95('0x19')](handleEntityNotFound(_0x25f16f,null))['then'](function(_0x1560c2){if(_0x1560c2){_0x482b6f[_0x5e95('0x41')]=_[_0x5e95('0x3d')](db[_0x5e95('0xa2')][_0x5e95('0x54')]);_0x482b6f[_0x5e95('0x3e')]=_['keys'](_0x15a7e7[_0x5e95('0x3e')]);_0x482b6f[_0x5e95('0x3f')]=_[_0x5e95('0x40')](_0x482b6f[_0x5e95('0x41')],_0x482b6f['query']);_0x1117c6[_0x5e95('0x42')]=_[_0x5e95('0x40')](_0x482b6f[_0x5e95('0x41')],qs[_0x5e95('0x43')](_0x15a7e7['query'][_0x5e95('0x43')]));_0x1117c6[_0x5e95('0x42')]=_0x1117c6[_0x5e95('0x42')][_0x5e95('0x55')]?_0x1117c6[_0x5e95('0x42')]:_0x482b6f[_0x5e95('0x41')];if(!_0x15a7e7[_0x5e95('0x3e')][_0x5e95('0x44')]('nolimit')){_0x1117c6['limit']=qs[_0x5e95('0x29')](_0x15a7e7[_0x5e95('0x3e')][_0x5e95('0x29')]);_0x1117c6[_0x5e95('0x2b')]=qs[_0x5e95('0x2b')](_0x15a7e7[_0x5e95('0x3e')]['offset']);}_0x1117c6[_0x5e95('0x45')]=qs[_0x5e95('0x46')](_0x15a7e7['query']['sort']);_0x1117c6[_0x5e95('0x49')]=qs[_0x5e95('0x3f')](_[_0x5e95('0x47')](_0x15a7e7[_0x5e95('0x3e')],_0x482b6f[_0x5e95('0x3f')]));_0x1117c6[_0x5e95('0x49')][_0x5e95('0x62')]=_0x1560c2['id'];if(_0x15a7e7[_0x5e95('0x3e')]['filter']){_0x1117c6[_0x5e95('0x49')]=_[_0x5e95('0x4a')](_0x1117c6[_0x5e95('0x49')],{'$or':_[_0x5e95('0x3a')](_0x1117c6[_0x5e95('0x42')],function(_0x16b9c3){var _0x2be43e={};_0x2be43e[_0x16b9c3]={'$like':'%'+_0x15a7e7[_0x5e95('0x3e')][_0x5e95('0x48')]+'%'};return _0x2be43e;})});}if(_0x15a7e7[_0x5e95('0x3e')][_0x5e95('0xa3')]){var _0x51ac77=_0x15a7e7[_0x5e95('0x3e')][_0x5e95('0xa3')][_0x5e95('0xa4')](',');var _0x386a0f={};_0x386a0f[_0x51ac77[0x0]]={'$gte':moment(_0x51ac77[0x1])[_0x5e95('0xa5')](_0x5e95('0xa6'))};_0x1117c6[_0x5e95('0x49')]=_[_0x5e95('0x4a')](_0x1117c6[_0x5e95('0x49')],_0x386a0f);}_0x1117c6=_['merge']({},_0x1117c6,_0x15a7e7[_0x5e95('0x56')]);return db[_0x5e95('0xa2')][_0x5e95('0x2a')]({'where':_0x1117c6['where']})['then'](function(_0xee729e){_0x38e3cf[_0x5e95('0x2a')]=_0xee729e;if(_0x15a7e7[_0x5e95('0x3e')][_0x5e95('0x4d')]){_0x1117c6[_0x5e95('0x4e')]=[{'all':!![]}];}return db[_0x5e95('0xa2')][_0x5e95('0x4f')](_0x1117c6);})[_0x5e95('0x19')](function(_0x480a8d){_0x38e3cf[_0x5e95('0x50')]=_0x480a8d;return _0x38e3cf;});}})[_0x5e95('0x19')](respondWithFilteredResult(_0x25f16f,_0x1117c6))[_0x5e95('0x23')](handleError(_0x25f16f,null));};exports[_0x5e95('0x37')]=function(_0x58bae7,_0x1557b2,_0xbff5b5){var _0x38fdff,_0x2b41a1={},_0x587377;if(_0x58bae7[_0x5e95('0x59')]['to']){_0x587377=_0x58bae7[_0x5e95('0x59')]['to'][0x0];}return db['FaxAccount'][_0x5e95('0x57')]({'where':{'id':_0x58bae7[_0x5e95('0x52')]['id']},'include':[{'model':db[_0x5e95('0xa7')],'as':_0x5e95('0xa8'),'include':[{'model':db[_0x5e95('0x71')],'as':_0x5e95('0xa9'),'where':{'fax':_0x587377},'limit':0x1,'order':[[_0x5e95('0x9d'),_0x5e95('0xaa')]]}]}]})[_0x5e95('0x19')](handleEntityNotFound(_0x1557b2,null))[_0x5e95('0x19')](function(_0x2722bc){_0x38fdff=_0x2722bc;if(_0x58bae7[_0x5e95('0x59')][_0x5e95('0xab')]&&_0x58bae7[_0x5e95('0x59')][_0x5e95('0xab')][_0x5e95('0x55')]){for(var _0x40b1ad=0x0;_0x40b1ad<_0x58bae7[_0x5e95('0x59')][_0x5e95('0xab')][_0x5e95('0x55')];_0x40b1ad+=0x1){_0x58bae7[_0x5e95('0x59')][_0x5e95('0xab')][_0x40b1ad]={'filename':_0x58bae7[_0x5e95('0x59')][_0x5e95('0xab')][_0x40b1ad][_0x5e95('0x36')],'id':_0x58bae7[_0x5e95('0x59')][_0x5e95('0xab')][_0x40b1ad]['id'],'path':path[_0x5e95('0xac')](config[_0x5e95('0xad')],_0x5e95('0xae'),_0x58bae7[_0x5e95('0x59')][_0x5e95('0xab')][_0x40b1ad][_0x5e95('0xaf')])};}}return respondWithRpcPromise(_0x5e95('0xb0'),_0x5e95('0xb0'),{'FaxAccountId':_[_0x5e95('0xb1')](_0x58bae7['params']['id'])?undefined:_0x58bae7[_0x5e95('0x52')]['id'],'path':_[_0x5e95('0xb1')](_0x58bae7['body'][_0x5e95('0xab')][0x0][_0x5e95('0x5')])?undefined:_0x58bae7[_0x5e95('0x59')]['attachments'][0x0][_0x5e95('0x5')],'fax':_[_0x5e95('0xb1')](_0x58bae7[_0x5e95('0x59')]['to'][0x0])?undefined:_0x58bae7[_0x5e95('0x59')]['to'][0x0]},client9002);})[_0x5e95('0x19')](function(){if(_0x38fdff){if(_[_0x5e95('0xb1')](_0x58bae7[_0x5e95('0x59')][_0x5e95('0xb2')])){_0x58bae7['body']['from']=util['format'](_0x5e95('0xb3'),_0x38fdff[_0x5e95('0x36')],_0x38fdff[_0x5e95('0xb4')]);}if(_0x38fdff[_0x5e95('0xa8')]){if(_0x38fdff[_0x5e95('0xa8')]['Contacts'][_0x5e95('0x55')]){return _0x38fdff[_0x5e95('0xa8')][_0x5e95('0xa9')][0x0];}else{return db[_0x5e95('0x71')][_0x5e95('0x58')](_[_0x5e95('0x12')](_0x58bae7['body'],{'firstName':_0x58bae7['body']['to'][0x0],'phone':_0x58bae7['body']['to'][0x0],'fax':_0x58bae7[_0x5e95('0x59')]['to'][0x0],'ListId':_0x38fdff[_0x5e95('0x9f')]}));}}else{throw new Error(_0x5e95('0xb5'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x5e95('0x19')](function(_0xe3d0a9){if(_0xe3d0a9){return db[_0x5e95('0x6e')][_0x5e95('0x57')]({'where':{'ContactId':_0xe3d0a9['id'],'closed':![],'FaxAccountId':_0x38fdff['id']}})['then'](function(_0x3782cc){if(_0x3782cc){return[_0x3782cc,![]];}return db[_0x5e95('0x6e')][_0x5e95('0x58')]({'UserId':_0x58bae7[_0x5e95('0x5a')]['id'],'ContactId':_0xe3d0a9['id'],'FaxAccountId':_0x38fdff['id'],'fax':_0x58bae7['body']['to'][0x0],'firstMsgDirection':_0x5e95('0xb6'),'Messages':[_[_0x5e95('0x4a')](_0x58bae7[_0x5e95('0x59')],{'read':![],'body':_0x58bae7['body'][_0x5e95('0xab')][0x0]['filename'],'FaxAccountId':_0x38fdff['id'],'UserId':_0x58bae7[_0x5e95('0x5a')]['id'],'ContactId':_0xe3d0a9['id'],'AttachmentId':_0x58bae7[_0x5e95('0x59')][_0x5e95('0xab')][0x0]['id']})]},{'include':[{'model':db[_0x5e95('0xa2')],'as':_0x5e95('0xb7')}]})['then'](function(_0xfa53b7){return[_0xfa53b7,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x5e95('0xb8')](function(_0x2a125d,_0x112f1f){if(_0x112f1f){return _0x2a125d;}return db[_0x5e95('0xa2')][_0x5e95('0x58')]({'direction':'out','read':![],'body':_0x58bae7[_0x5e95('0x59')][_0x5e95('0xab')][0x0]['filename'],'FaxAccountId':_0x38fdff['id'],'FaxInteractionId':_0x2a125d['id'],'UserId':_0x58bae7[_0x5e95('0x5a')]['id'],'ContactId':_0x2a125d[_0x5e95('0xb9')],'AttachmentId':_0x58bae7[_0x5e95('0x59')]['attachments'][0x0]['id']})[_0x5e95('0x19')](function(_0xf0cfa8){_0x2a125d[_0x5e95('0xba')][_0x5e95('0xb7')]=[];_0x2a125d[_0x5e95('0xba')][_0x5e95('0xb7')]['push'](_0xf0cfa8[_0x5e95('0xba')]);return _0x2a125d;});})[_0x5e95('0x19')](function(_0x1a2ca){respondWithRpcPromise(_0x5e95('0xbb'),_0x5e95('0xbb'),{'FaxAccountId':_[_0x5e95('0xb1')](_0x58bae7[_0x5e95('0x52')]['id'])?undefined:_0x58bae7[_0x5e95('0x52')]['id'],'path':_[_0x5e95('0xb1')](_0x58bae7[_0x5e95('0x59')]['attachments'][0x0]['path'])?undefined:_0x58bae7['body'][_0x5e95('0xab')][0x0]['path'],'fax':_[_0x5e95('0xb1')](_0x58bae7[_0x5e95('0x59')]['to'][0x0])?undefined:_0x58bae7[_0x5e95('0x59')]['to'][0x0],'AttachmentId':_0x58bae7[_0x5e95('0x59')][_0x5e95('0xab')][0x0]['id']},client9002)[_0x5e95('0x19')](function(_0x1b1787){logger[_0x5e95('0x1a')](_0x5e95('0xbc'),_0x1b1787);})[_0x5e95('0x23')](function(_0x393d72){logger[_0x5e95('0x1a')](_0x5e95('0xbc'),_0x393d72);});return _0x1a2ca;})[_0x5e95('0x19')](respondWithResult(_0x1557b2,null))['catch'](handleError(_0x1557b2,null));};exports[_0x5e95('0xbd')]=function(_0x224c24,_0x1a1217,_0x915373){return db[_0x5e95('0x3b')][_0x5e95('0x57')]({'where':{'id':_0x224c24[_0x5e95('0x52')]['id']}})['then'](handleEntityNotFound(_0x1a1217,null))[_0x5e95('0x19')](function(_0x8c15f6){if(_0x8c15f6){return _0x8c15f6['addAgents'](_0x224c24['body'][_0x5e95('0x68')],_[_0x5e95('0x6f')](_0x224c24['body'],['ids','id'])||{})[_0x5e95('0xb8')](function(_0x1dd183){for(var _0x2d82d7=0x0;_0x2d82d7<_0x224c24[_0x5e95('0x59')][_0x5e95('0x68')][_0x5e95('0x55')];_0x2d82d7+=0x1){socket[_0x5e95('0xbe')](_0x5e95('0xbf'),{'UserId':Number(_0x224c24[_0x5e95('0x59')]['ids'][_0x2d82d7]),'FaxAccountId':Number(_0x224c24['params']['id'])});}return _0x1dd183;});}})[_0x5e95('0x19')](respondWithResult(_0x1a1217,null))[_0x5e95('0x23')](handleError(_0x1a1217,null));};exports[_0x5e95('0xc0')]=function(_0x3a5425,_0x5a9cb0,_0x1407a3){return db[_0x5e95('0x3b')][_0x5e95('0x57')]({'where':{'id':_0x3a5425[_0x5e95('0x52')]['id']}})['then'](handleEntityNotFound(_0x5a9cb0,null))[_0x5e95('0x19')](function(_0xac10d9){if(_0xac10d9){return _0xac10d9[_0x5e95('0xc0')](_0x3a5425[_0x5e95('0x3e')]['ids'])[_0x5e95('0x19')](function(){if(_[_0x5e95('0xc1')](_0x3a5425['query']['ids'])){for(var _0x4e9c84=0x0;_0x4e9c84<_0x3a5425[_0x5e95('0x3e')]['ids'][_0x5e95('0x55')];_0x4e9c84+=0x1){socket[_0x5e95('0xbe')](_0x5e95('0xc2'),{'UserId':Number(_0x3a5425[_0x5e95('0x3e')][_0x5e95('0x68')][_0x4e9c84]),'FaxAccountId':Number(_0x3a5425[_0x5e95('0x52')]['id'])});}}else{socket['emit'](_0x5e95('0xc2'),{'UserId':Number(_0x3a5425['query'][_0x5e95('0x68')]),'FaxAccountId':Number(_0x3a5425[_0x5e95('0x52')]['id'])});}});}})[_0x5e95('0x19')](respondWithStatusCode(_0x5a9cb0,null))[_0x5e95('0x23')](handleError(_0x5a9cb0,null));};exports[_0x5e95('0xc3')]=function(_0x6c0fb7,_0x288684,_0x914976){var _0x410d11={};var _0x268d8e={};var _0x2d7343;var _0x5b7009;return db[_0x5e95('0x3b')][_0x5e95('0x65')]({'where':{'id':_0x6c0fb7['params']['id']}})[_0x5e95('0x19')](handleEntityNotFound(_0x288684,null))[_0x5e95('0x19')](function(_0x5a9881){if(_0x5a9881){_0x2d7343=_0x5a9881;_0x268d8e[_0x5e95('0x41')]=_[_0x5e95('0x3d')](db[_0x5e95('0xc4')]['rawAttributes']);_0x268d8e[_0x5e95('0x3e')]=_['keys'](_0x6c0fb7[_0x5e95('0x3e')]);_0x268d8e[_0x5e95('0x3f')]=_[_0x5e95('0x40')](_0x268d8e[_0x5e95('0x41')],_0x268d8e['query']);_0x410d11[_0x5e95('0x42')]=_[_0x5e95('0x40')](_0x268d8e['model'],qs['fields'](_0x6c0fb7[_0x5e95('0x3e')][_0x5e95('0x43')]));_0x410d11[_0x5e95('0x42')]=_0x410d11[_0x5e95('0x42')]['length']?_0x410d11[_0x5e95('0x42')]:_0x268d8e[_0x5e95('0x41')];_0x410d11[_0x5e95('0x45')]=qs[_0x5e95('0x46')](_0x6c0fb7[_0x5e95('0x3e')][_0x5e95('0x46')]);_0x410d11[_0x5e95('0x49')]=qs[_0x5e95('0x3f')](_['pick'](_0x6c0fb7[_0x5e95('0x3e')],_0x268d8e[_0x5e95('0x3f')]));if(_0x6c0fb7['query'][_0x5e95('0x48')]){_0x410d11[_0x5e95('0x49')]=_['merge'](_0x410d11[_0x5e95('0x49')],{'$or':_[_0x5e95('0x3a')](_0x410d11[_0x5e95('0x42')],function(_0x56617d){var _0xe42e7c={};_0xe42e7c[_0x56617d]={'$like':'%'+_0x6c0fb7[_0x5e95('0x3e')]['filter']+'%'};return _0xe42e7c;})});}_0x410d11=_[_0x5e95('0x4a')]({},_0x410d11,_0x6c0fb7['options']);return _0x2d7343[_0x5e95('0xc3')](_0x410d11);}})[_0x5e95('0x19')](function(_0x28a565){if(_0x28a565){_0x5b7009=_0x28a565['length'];if(!_0x6c0fb7[_0x5e95('0x3e')]['hasOwnProperty'](_0x5e95('0x66'))){_0x410d11[_0x5e95('0x29')]=qs[_0x5e95('0x29')](_0x6c0fb7['query'][_0x5e95('0x29')]);_0x410d11['offset']=qs[_0x5e95('0x2b')](_0x6c0fb7['query'][_0x5e95('0x2b')]);}return _0x2d7343[_0x5e95('0xc3')](_0x410d11);}})[_0x5e95('0x19')](function(_0x4e72ec){if(_0x4e72ec){return _0x4e72ec?{'count':_0x5b7009,'rows':_0x4e72ec}:null;}})[_0x5e95('0x19')](respondWithResult(_0x288684,null))[_0x5e95('0x23')](handleError(_0x288684,null));}; \ No newline at end of file +var _0x2392=['ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','stack','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','maxrate','modem','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','transaction','VoiceExtension','updateAccountApplications','bulkCreate','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','attachments','root','server/files/attachments','CheckAfterSend','isNil','path','from','fax','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','zip-dir','fast-json-patch','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','sendStatus','name','send','index','Pause','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','FaxAccount','includeAll','include','findAll','show','params','mandatoryDispositionPause','find','create','body','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','options','rows','ids','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','addInteraction','omit','FaxInteraction','CmContact','Contact','User','Owner','internal','Tag','color','tag','addApplications','sequelize','Transaction'];(function(_0x142382,_0x1e373e){var _0x3b1008=function(_0x156da3){while(--_0x156da3){_0x142382['push'](_0x142382['shift']());}};_0x3b1008(++_0x1e373e);}(_0x2392,0x1ce));var _0x2239=function(_0x492d19,_0x53db70){_0x492d19=_0x492d19-0x0;var _0x2ab50b=_0x2392[_0x492d19];return _0x2ab50b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2239('0x0'));var jsonpatch=require(_0x2239('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2239('0x2'));var path=require('path');var sox=require(_0x2239('0x3'));var csv=require(_0x2239('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2239('0x5'));var _=require(_0x2239('0x6'));var squel=require(_0x2239('0x7'));var crypto=require(_0x2239('0x8'));var jsforce=require(_0x2239('0x9'));var deskjs=require(_0x2239('0xa'));var toCsv=require(_0x2239('0x4'));var querystring=require(_0x2239('0xb'));var Papa=require(_0x2239('0xc'));var Redis=require(_0x2239('0xd'));var authService=require(_0x2239('0xe'));var qs=require(_0x2239('0xf'));var as=require(_0x2239('0x10'));var hardwareService=require(_0x2239('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x2239('0x12'));var config=require(_0x2239('0x13'));var licenseUtil=require(_0x2239('0x14'));var db=require('../../mysqldb')['db'];config[_0x2239('0x15')]=_[_0x2239('0x16')](config[_0x2239('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x2239('0x17'))(new Redis(config[_0x2239('0x15')]));require('./faxAccount.socket')[_0x2239('0x18')](socket);var jayson=require(_0x2239('0x19'));var client=jayson[_0x2239('0x1a')][_0x2239('0x1b')]({'port':0x232c});var client9002=jayson[_0x2239('0x1a')][_0x2239('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x399189,_0x3a230c,_0xf29fa0,_0x54be9b){return new BPromise(function(_0x43fd08,_0x1b5947){var _0x58aa57=_0x54be9b||client;return _0x58aa57[_0x2239('0x1c')](_0x399189,_0xf29fa0)[_0x2239('0x1d')](function(_0x177d65){logger[_0x2239('0x1e')](_0x2239('0x1f'),_0x3a230c,_0x2239('0x20'));logger[_0x2239('0x21')](_0x2239('0x22'),_0x3a230c,_0x2239('0x20'),JSON[_0x2239('0x23')](_0x177d65));if(_0x177d65[_0x2239('0x24')]){if(_0x177d65['error'][_0x2239('0x25')]===0x1f4){logger['error'](_0x2239('0x1f'),_0x3a230c,_0x177d65[_0x2239('0x24')][_0x2239('0x26')]);return _0x1b5947(_0x177d65['error'][_0x2239('0x26')]);}logger[_0x2239('0x24')](_0x2239('0x1f'),_0x3a230c,_0x177d65[_0x2239('0x24')][_0x2239('0x26')]);return _0x43fd08(_0x177d65[_0x2239('0x24')][_0x2239('0x26')]);}else{logger[_0x2239('0x1e')]('FaxAccount,\x20%s,\x20%s',_0x3a230c,'request\x20sent');_0x43fd08(_0x177d65[_0x2239('0x27')][_0x2239('0x26')]);}})[_0x2239('0x28')](function(_0x24e6d4){logger[_0x2239('0x24')](_0x2239('0x1f'),_0x3a230c,_0x24e6d4);_0x1b5947(_0x24e6d4);});});}function respondWithStatusCode(_0xa3595f,_0x41eb69){_0x41eb69=_0x41eb69||0xcc;return function(_0xa41ef1){if(_0xa41ef1){return _0xa3595f['sendStatus'](_0x41eb69);}return _0xa3595f[_0x2239('0x29')](_0x41eb69)['end']();};}function respondWithResult(_0x3c92fe,_0xd6ba78){_0xd6ba78=_0xd6ba78||0xc8;return function(_0x45c145){if(_0x45c145){return _0x3c92fe[_0x2239('0x29')](_0xd6ba78)[_0x2239('0x2a')](_0x45c145);}};}function respondWithFilteredResult(_0x1a9539,_0x1ce25a){return function(_0x24b29c){if(_0x24b29c){var _0x30e594=typeof _0x1ce25a[_0x2239('0x2b')]===_0x2239('0x2c')&&typeof _0x1ce25a['limit']===_0x2239('0x2c');var _0x44a3a2=_0x24b29c[_0x2239('0x2d')];var _0x766736=_0x30e594?0x0:_0x1ce25a[_0x2239('0x2b')];var _0x2b0057=_0x30e594?_0x24b29c[_0x2239('0x2d')]:_0x1ce25a['offset']+_0x1ce25a[_0x2239('0x2e')];var _0x38ccb2;if(_0x2b0057>=_0x44a3a2){_0x2b0057=_0x44a3a2;_0x38ccb2=0xc8;}else{_0x38ccb2=0xce;}_0x1a9539[_0x2239('0x29')](_0x38ccb2);return _0x1a9539[_0x2239('0x2f')](_0x2239('0x30'),_0x766736+'-'+_0x2b0057+'/'+_0x44a3a2)[_0x2239('0x2a')](_0x24b29c);}return null;};}function patchUpdates(_0x5ed657){return function(_0x6b51ca){try{jsonpatch[_0x2239('0x31')](_0x6b51ca,_0x5ed657,!![]);}catch(_0xabf8d5){return BPromise[_0x2239('0x32')](_0xabf8d5);}return _0x6b51ca[_0x2239('0x33')]();};}function saveUpdates(_0x3202d0,_0x27b5bc){return function(_0x12b0db){if(_0x12b0db){return _0x12b0db[_0x2239('0x34')](_0x3202d0)[_0x2239('0x1d')](function(_0x58f783){return _0x58f783;});}return null;};}function removeEntity(_0x88eda9,_0x4b1080){return function(_0x1d35c5){if(_0x1d35c5){return _0x1d35c5[_0x2239('0x35')]()['then'](function(){var _0x4700f4=_0x1d35c5[_0x2239('0x36')]({'plain':!![]});var _0x3dc071=_0x2239('0x37');return db[_0x2239('0x38')][_0x2239('0x35')]({'where':{'type':_0x3dc071,'resourceId':_0x4700f4['id']}})[_0x2239('0x1d')](function(){return _0x1d35c5;});})[_0x2239('0x1d')](function(){_0x88eda9[_0x2239('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46cd79,_0x35680e){return function(_0x3c21bf){if(!_0x3c21bf){_0x46cd79[_0x2239('0x39')](0x194);}return _0x3c21bf;};}function handleError(_0x3e14b0,_0x2c7aeb){_0x2c7aeb=_0x2c7aeb||0x1f4;return function(_0x53c5de){logger[_0x2239('0x24')](_0x53c5de['stack']);if(_0x53c5de[_0x2239('0x3a')]){delete _0x53c5de[_0x2239('0x3a')];}_0x3e14b0[_0x2239('0x29')](_0x2c7aeb)[_0x2239('0x3b')](_0x53c5de);};}exports[_0x2239('0x3c')]=function(_0x96b02,_0x39a812){var _0x841031={'include':[{'model':db[_0x2239('0x3d')],'as':'mandatoryDispositionPause'}]},_0x1f28d1={},_0x73a1b5={'count':0x0,'rows':[]};var _0x203df5=_[_0x2239('0x3e')](db['FaxAccount'][_0x2239('0x3f')],function(_0x4614b0){return{'name':_0x4614b0['fieldName'],'type':_0x4614b0[_0x2239('0x40')]['key']};});_0x1f28d1[_0x2239('0x41')]=_['map'](_0x203df5,_0x2239('0x3a'));_0x1f28d1[_0x2239('0x42')]=_[_0x2239('0x43')](_0x96b02[_0x2239('0x42')]);_0x1f28d1[_0x2239('0x44')]=_[_0x2239('0x45')](_0x1f28d1[_0x2239('0x41')],_0x1f28d1[_0x2239('0x42')]);_0x841031[_0x2239('0x46')]=_[_0x2239('0x45')](_0x1f28d1[_0x2239('0x41')],qs[_0x2239('0x47')](_0x96b02[_0x2239('0x42')][_0x2239('0x47')]));_0x841031[_0x2239('0x46')]=_0x841031[_0x2239('0x46')][_0x2239('0x48')]?_0x841031[_0x2239('0x46')]:_0x1f28d1[_0x2239('0x41')];if(!_0x96b02[_0x2239('0x42')][_0x2239('0x49')]('nolimit')){_0x841031['limit']=qs['limit'](_0x96b02['query'][_0x2239('0x2e')]);_0x841031[_0x2239('0x2b')]=qs[_0x2239('0x2b')](_0x96b02['query']['offset']);}_0x841031[_0x2239('0x4a')]=qs[_0x2239('0x4b')](_0x96b02[_0x2239('0x42')][_0x2239('0x4b')]);_0x841031[_0x2239('0x4c')]=qs[_0x2239('0x44')](_[_0x2239('0x4d')](_0x96b02[_0x2239('0x42')],_0x1f28d1[_0x2239('0x44')]),_0x203df5);if(_0x96b02[_0x2239('0x42')][_0x2239('0x4e')]){_0x841031[_0x2239('0x4c')]=_['merge'](_0x841031[_0x2239('0x4c')],{'$or':_[_0x2239('0x3e')](_0x203df5,function(_0x4faa00){if(_0x4faa00[_0x2239('0x40')]!==_0x2239('0x4f')){var _0x9588d3={};_0x9588d3[_0x4faa00[_0x2239('0x3a')]]={'$like':'%'+_0x96b02[_0x2239('0x42')][_0x2239('0x4e')]+'%'};return _0x9588d3;}})});}_0x841031=_[_0x2239('0x50')]({},_0x841031,_0x96b02['options']);var _0x2e377f={'where':_0x841031[_0x2239('0x4c')]};return db[_0x2239('0x51')][_0x2239('0x2d')](_0x2e377f)[_0x2239('0x1d')](function(_0x118be7){_0x73a1b5['count']=_0x118be7;if(_0x96b02['query'][_0x2239('0x52')]){_0x841031[_0x2239('0x53')]=[{'all':!![]}];}return db[_0x2239('0x51')][_0x2239('0x54')](_0x841031);})['then'](function(_0x37cbcf){_0x73a1b5['rows']=_0x37cbcf;return _0x73a1b5;})['then'](respondWithFilteredResult(_0x39a812,_0x841031))[_0x2239('0x28')](handleError(_0x39a812,null));};exports[_0x2239('0x55')]=function(_0x878b1f,_0x39cc77){var _0x2c7a35={'raw':![],'where':{'id':_0x878b1f[_0x2239('0x56')]['id']},'include':[{'model':db[_0x2239('0x3d')],'as':_0x2239('0x57')}]},_0x8e35e0={};_0x8e35e0[_0x2239('0x41')]=_[_0x2239('0x43')](db[_0x2239('0x51')][_0x2239('0x3f')]);_0x8e35e0[_0x2239('0x42')]=_['keys'](_0x878b1f[_0x2239('0x42')]);_0x8e35e0[_0x2239('0x44')]=_['intersection'](_0x8e35e0[_0x2239('0x41')],_0x8e35e0['query']);_0x2c7a35['attributes']=_[_0x2239('0x45')](_0x8e35e0['model'],qs[_0x2239('0x47')](_0x878b1f['query'][_0x2239('0x47')]));_0x2c7a35['attributes']=_0x2c7a35['attributes'][_0x2239('0x48')]?_0x2c7a35[_0x2239('0x46')]:_0x8e35e0[_0x2239('0x41')];if(_0x878b1f[_0x2239('0x42')]['includeAll']){_0x2c7a35['include']=[{'all':!![]}];}_0x2c7a35=_['merge']({},_0x2c7a35,_0x878b1f['options']);return db['FaxAccount'][_0x2239('0x58')](_0x2c7a35)[_0x2239('0x1d')](handleEntityNotFound(_0x39cc77,null))[_0x2239('0x1d')](respondWithResult(_0x39cc77,null))[_0x2239('0x28')](handleError(_0x39cc77,null));};exports[_0x2239('0x59')]=function(_0x791bf4,_0xec5139){return db['FaxAccount']['create'](_0x791bf4[_0x2239('0x5a')],{})['then'](function(_0x4e4296){var _0x2d882d=_0x791bf4['user']['get']({'plain':!![]});if(!_0x2d882d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d882d['role']===_0x2239('0x5b')){var _0x49944a=_0x4e4296[_0x2239('0x36')]({'plain':!![]});var _0xa395e3=_0x2239('0x37');return db[_0x2239('0x5c')][_0x2239('0x58')]({'where':{'name':_0xa395e3,'userProfileId':_0x2d882d[_0x2239('0x5d')]},'raw':!![]})[_0x2239('0x1d')](function(_0x43808a){if(_0x43808a&&_0x43808a['autoAssociation']===0x0){return db[_0x2239('0x38')][_0x2239('0x59')]({'name':_0x49944a['name'],'resourceId':_0x49944a['id'],'type':_0x43808a[_0x2239('0x3a')],'sectionId':_0x43808a['id']},{})['then'](function(){return _0x4e4296;});}else{return _0x4e4296;}})['catch'](function(_0x4b4ba7){logger[_0x2239('0x24')](_0x2239('0x5e'),_0x4b4ba7);throw _0x4b4ba7;});}return _0x4e4296;})[_0x2239('0x1d')](respondWithResult(_0xec5139,0xc9))[_0x2239('0x28')](handleError(_0xec5139,null));};exports[_0x2239('0x34')]=function(_0x10c7e9,_0x462228){if(_0x10c7e9[_0x2239('0x5a')]['id']){delete _0x10c7e9['body']['id'];}return db[_0x2239('0x51')][_0x2239('0x58')]({'where':{'id':_0x10c7e9['params']['id']},'include':[{'model':db[_0x2239('0x3d')],'as':'mandatoryDispositionPause'}]})[_0x2239('0x1d')](handleEntityNotFound(_0x462228,null))[_0x2239('0x1d')](saveUpdates(_0x10c7e9[_0x2239('0x5a')],null))[_0x2239('0x1d')](respondWithResult(_0x462228,null))['catch'](handleError(_0x462228,null));};exports[_0x2239('0x35')]=function(_0x1960ee,_0xbfdcdd){return db['FaxAccount']['find']({'where':{'id':_0x1960ee[_0x2239('0x56')]['id']}})[_0x2239('0x1d')](handleEntityNotFound(_0xbfdcdd,null))['then'](removeEntity(_0xbfdcdd,null))['catch'](handleError(_0xbfdcdd,null));};exports[_0x2239('0x5f')]=function(_0x3948a9,_0xa38b7f){return db[_0x2239('0x51')][_0x2239('0x5f')]()['then'](respondWithResult(_0xa38b7f,null))[_0x2239('0x28')](handleError(_0xa38b7f,null));};exports[_0x2239('0x60')]=function(_0x4dc2c8,_0x465f50,_0x9914f){if(_0x4dc2c8['body']['id']){delete _0x4dc2c8[_0x2239('0x5a')]['id'];}return db[_0x2239('0x51')][_0x2239('0x58')]({'where':{'id':_0x4dc2c8['params']['id']}})['then'](handleEntityNotFound(_0x465f50,null))[_0x2239('0x1d')](function(_0x4e301b){if(_0x4e301b){_0x4dc2c8['body'][_0x2239('0x61')]=_0x4e301b['id'];return db[_0x2239('0x62')][_0x2239('0x59')](_0x4dc2c8[_0x2239('0x5a')]);}})[_0x2239('0x1d')](respondWithResult(_0x465f50,null))[_0x2239('0x28')](handleError(_0x465f50,null));};exports[_0x2239('0x63')]=function(_0x399ae1,_0x370b70,_0x27d26d){var _0x10281d={'raw':![],'where':{}};var _0xc8f93e={};var _0x272eb5={'count':0x0,'rows':[]};return db[_0x2239('0x51')][_0x2239('0x64')]({'where':{'id':_0x399ae1[_0x2239('0x56')]['id']}})['then'](handleEntityNotFound(_0x370b70,null))[_0x2239('0x1d')](function(_0x5d4c6b){if(_0x5d4c6b){_0xc8f93e[_0x2239('0x41')]=_['keys'](db[_0x2239('0x62')]['rawAttributes']);_0xc8f93e['query']=_[_0x2239('0x43')](_0x399ae1[_0x2239('0x42')]);_0xc8f93e[_0x2239('0x44')]=_[_0x2239('0x45')](_0xc8f93e[_0x2239('0x41')],_0xc8f93e[_0x2239('0x42')]);_0x10281d['attributes']=_[_0x2239('0x45')](_0xc8f93e[_0x2239('0x41')],qs[_0x2239('0x47')](_0x399ae1[_0x2239('0x42')][_0x2239('0x47')]));_0x10281d[_0x2239('0x46')]=_0x10281d[_0x2239('0x46')][_0x2239('0x48')]?_0x10281d[_0x2239('0x46')]:_0xc8f93e[_0x2239('0x41')];if(!_0x399ae1[_0x2239('0x42')][_0x2239('0x49')]('nolimit')){_0x10281d[_0x2239('0x2e')]=qs['limit'](_0x399ae1[_0x2239('0x42')]['limit']);_0x10281d[_0x2239('0x2b')]=qs[_0x2239('0x2b')](_0x399ae1[_0x2239('0x42')]['offset']);}_0x10281d[_0x2239('0x4a')]=qs['sort'](_0x399ae1[_0x2239('0x42')][_0x2239('0x4b')]);_0x10281d['where']=qs[_0x2239('0x44')](_[_0x2239('0x4d')](_0x399ae1[_0x2239('0x42')],_0xc8f93e['filters']));_0x10281d[_0x2239('0x4c')]['FaxAccountId']=_0x5d4c6b['id'];if(_0x399ae1[_0x2239('0x42')][_0x2239('0x4e')]){_0x10281d['where']=_[_0x2239('0x50')](_0x10281d[_0x2239('0x4c')],{'$or':_[_0x2239('0x3e')](_0x10281d[_0x2239('0x46')],function(_0xca5164){var _0x222267={};_0x222267[_0xca5164]={'$like':'%'+_0x399ae1[_0x2239('0x42')]['filter']+'%'};return _0x222267;})});}_0x10281d=_['merge']({},_0x10281d,_0x399ae1[_0x2239('0x65')]);return db[_0x2239('0x62')][_0x2239('0x2d')]({'where':_0x10281d['where']})[_0x2239('0x1d')](function(_0x504207){_0x272eb5[_0x2239('0x2d')]=_0x504207;if(_0x399ae1[_0x2239('0x42')][_0x2239('0x52')]){_0x10281d[_0x2239('0x53')]=[{'all':!![]}];}return db[_0x2239('0x62')][_0x2239('0x54')](_0x10281d);})[_0x2239('0x1d')](function(_0x39ef3c){_0x272eb5[_0x2239('0x66')]=_0x39ef3c;return _0x272eb5;});}})[_0x2239('0x1d')](respondWithFilteredResult(_0x370b70,_0x10281d))[_0x2239('0x28')](handleError(_0x370b70,null));};exports['removeDispositions']=function(_0x50b689,_0x5b0a1e,_0x4a344d){return db[_0x2239('0x51')][_0x2239('0x58')]({'where':{'id':_0x50b689[_0x2239('0x56')]['id']}})[_0x2239('0x1d')](handleEntityNotFound(_0x5b0a1e,null))[_0x2239('0x1d')](function(_0x3c952c){if(_0x3c952c){return _0x3c952c['removeDispositions'](_0x50b689[_0x2239('0x42')][_0x2239('0x67')]);}})['then'](respondWithStatusCode(_0x5b0a1e,null))[_0x2239('0x28')](handleError(_0x5b0a1e,null));};exports[_0x2239('0x68')]=function(_0x68a7b,_0x3199a7,_0x30a929){if(_0x68a7b[_0x2239('0x5a')]['id']){delete _0x68a7b['body']['id'];}return db[_0x2239('0x51')][_0x2239('0x58')]({'where':{'id':_0x68a7b['params']['id']}})[_0x2239('0x1d')](handleEntityNotFound(_0x3199a7,null))['then'](function(_0x2563fd){if(_0x2563fd){_0x68a7b[_0x2239('0x5a')][_0x2239('0x61')]=_0x2563fd['id'];return db[_0x2239('0x69')][_0x2239('0x59')](_0x68a7b[_0x2239('0x5a')]);}})[_0x2239('0x1d')](respondWithResult(_0x3199a7,null))[_0x2239('0x28')](handleError(_0x3199a7,null));};exports[_0x2239('0x6a')]=function(_0x103ebc,_0x25edf5,_0x1534e3){var _0x35b3b1={'raw':![],'where':{}};var _0x23aec3={};var _0x4cc72a={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x103ebc[_0x2239('0x56')]['id']}})['then'](handleEntityNotFound(_0x25edf5,null))[_0x2239('0x1d')](function(_0x1dde69){if(_0x1dde69){_0x23aec3[_0x2239('0x41')]=_[_0x2239('0x43')](db[_0x2239('0x69')]['rawAttributes']);_0x23aec3[_0x2239('0x42')]=_[_0x2239('0x43')](_0x103ebc['query']);_0x23aec3[_0x2239('0x44')]=_[_0x2239('0x45')](_0x23aec3[_0x2239('0x41')],_0x23aec3[_0x2239('0x42')]);_0x35b3b1[_0x2239('0x46')]=_[_0x2239('0x45')](_0x23aec3[_0x2239('0x41')],qs[_0x2239('0x47')](_0x103ebc['query'][_0x2239('0x47')]));_0x35b3b1['attributes']=_0x35b3b1[_0x2239('0x46')][_0x2239('0x48')]?_0x35b3b1[_0x2239('0x46')]:_0x23aec3[_0x2239('0x41')];if(!_0x103ebc['query']['hasOwnProperty'](_0x2239('0x6b'))){_0x35b3b1['limit']=qs['limit'](_0x103ebc[_0x2239('0x42')][_0x2239('0x2e')]);_0x35b3b1['offset']=qs['offset'](_0x103ebc['query'][_0x2239('0x2b')]);}_0x35b3b1[_0x2239('0x4a')]=qs[_0x2239('0x4b')](_0x103ebc[_0x2239('0x42')]['sort']);_0x35b3b1['where']=qs[_0x2239('0x44')](_[_0x2239('0x4d')](_0x103ebc[_0x2239('0x42')],_0x23aec3[_0x2239('0x44')]));_0x35b3b1[_0x2239('0x4c')][_0x2239('0x61')]=_0x1dde69['id'];if(_0x103ebc[_0x2239('0x42')]['filter']){_0x35b3b1[_0x2239('0x4c')]=_[_0x2239('0x50')](_0x35b3b1[_0x2239('0x4c')],{'$or':_['map'](_0x35b3b1[_0x2239('0x46')],function(_0x4044e7){var _0x1ab4be={};_0x1ab4be[_0x4044e7]={'$like':'%'+_0x103ebc[_0x2239('0x42')]['filter']+'%'};return _0x1ab4be;})});}_0x35b3b1=_[_0x2239('0x50')]({},_0x35b3b1,_0x103ebc[_0x2239('0x65')]);return db[_0x2239('0x69')]['count']({'where':_0x35b3b1['where']})[_0x2239('0x1d')](function(_0x3fa74b){_0x4cc72a[_0x2239('0x2d')]=_0x3fa74b;if(_0x103ebc[_0x2239('0x42')][_0x2239('0x52')]){_0x35b3b1[_0x2239('0x53')]=[{'all':!![]}];}return db[_0x2239('0x69')][_0x2239('0x54')](_0x35b3b1);})[_0x2239('0x1d')](function(_0xb7336a){_0x4cc72a[_0x2239('0x66')]=_0xb7336a;return _0x4cc72a;});}})[_0x2239('0x1d')](respondWithFilteredResult(_0x25edf5,_0x35b3b1))[_0x2239('0x28')](handleError(_0x25edf5,null));};exports[_0x2239('0x6c')]=function(_0x455266,_0xa13a5b,_0x11af1b){return db[_0x2239('0x51')][_0x2239('0x58')]({'where':{'id':_0x455266[_0x2239('0x56')]['id']}})[_0x2239('0x1d')](handleEntityNotFound(_0xa13a5b,null))[_0x2239('0x1d')](function(_0x53b164){if(_0x53b164){return _0x53b164[_0x2239('0x6c')](_0x455266[_0x2239('0x42')][_0x2239('0x67')]);}})[_0x2239('0x1d')](respondWithStatusCode(_0xa13a5b,null))[_0x2239('0x28')](handleError(_0xa13a5b,null));};exports['addInteraction']=function(_0x2ca60b,_0x296175,_0x4edbcc){return db['FaxInteraction'][_0x2239('0x58')]({'where':{'id':_0x2ca60b[_0x2239('0x56')]['id']}})[_0x2239('0x1d')](handleEntityNotFound(_0x296175,null))[_0x2239('0x1d')](function(_0x5b22e2){if(_0x5b22e2){return _0x5b22e2[_0x2239('0x6d')](_0x2ca60b['body'][_0x2239('0x67')],_[_0x2239('0x6e')](_0x2ca60b[_0x2239('0x5a')],[_0x2239('0x67'),'id'])||{});}})[_0x2239('0x1d')](respondWithResult(_0x296175,null))[_0x2239('0x28')](handleError(_0x296175,null));};exports['getInteractions']=function(_0xda8df4,_0x19cd8d,_0x3962fd){var _0x370e0f={'raw':![],'where':{}};var _0x3ab5b7={};var _0x1c5032={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0xda8df4[_0x2239('0x56')]['id']}})['then'](handleEntityNotFound(_0x19cd8d,null))[_0x2239('0x1d')](function(_0x278955){if(_0x278955){_0x3ab5b7[_0x2239('0x41')]=_[_0x2239('0x43')](db[_0x2239('0x6f')][_0x2239('0x3f')]);_0x3ab5b7[_0x2239('0x42')]=_[_0x2239('0x43')](_0xda8df4[_0x2239('0x42')]);_0x3ab5b7[_0x2239('0x44')]=_[_0x2239('0x45')](_0x3ab5b7[_0x2239('0x41')],_0x3ab5b7[_0x2239('0x42')]);_0x370e0f[_0x2239('0x46')]=_[_0x2239('0x45')](_0x3ab5b7[_0x2239('0x41')],qs['fields'](_0xda8df4[_0x2239('0x42')][_0x2239('0x47')]));_0x370e0f[_0x2239('0x46')]=_0x370e0f['attributes'][_0x2239('0x48')]?_0x370e0f[_0x2239('0x46')]:_0x3ab5b7['model'];if(!_0xda8df4[_0x2239('0x42')]['hasOwnProperty'](_0x2239('0x6b'))){_0x370e0f[_0x2239('0x2e')]=qs['limit'](_0xda8df4[_0x2239('0x42')][_0x2239('0x2e')]);_0x370e0f[_0x2239('0x2b')]=qs[_0x2239('0x2b')](_0xda8df4[_0x2239('0x42')][_0x2239('0x2b')]);}_0x370e0f[_0x2239('0x4a')]=qs[_0x2239('0x4b')](_0xda8df4[_0x2239('0x42')][_0x2239('0x4b')]);_0x370e0f[_0x2239('0x4c')]=qs[_0x2239('0x44')](_[_0x2239('0x4d')](_0xda8df4['query'],_0x3ab5b7['filters']));_0x370e0f[_0x2239('0x4c')][_0x2239('0x61')]=_0x278955['id'];if(_0xda8df4['query'][_0x2239('0x4e')]){_0x370e0f[_0x2239('0x4c')]=_[_0x2239('0x50')](_0x370e0f['where'],{'$or':_[_0x2239('0x3e')](_0x370e0f[_0x2239('0x46')],function(_0x17b829){var _0x18064d={};_0x18064d[_0x17b829]={'$like':'%'+_0xda8df4[_0x2239('0x42')][_0x2239('0x4e')]+'%'};return _0x18064d;})});}_0x370e0f=_[_0x2239('0x50')]({},_0x370e0f,_0xda8df4[_0x2239('0x65')]);return db[_0x2239('0x6f')][_0x2239('0x2d')]({'where':_0x370e0f[_0x2239('0x4c')]})[_0x2239('0x1d')](function(_0x31e9f5){_0x1c5032['count']=_0x31e9f5;if(_0xda8df4[_0x2239('0x42')][_0x2239('0x52')]){_0x370e0f['include']=[{'model':db[_0x2239('0x70')],'as':_0x2239('0x71'),'required':![]},{'model':db[_0x2239('0x72')],'as':_0x2239('0x73'),'attributes':[_0x2239('0x3a'),'fullname',_0x2239('0x74')],'required':![]},{'model':db[_0x2239('0x75')],'as':'Tags','attributes':['id',_0x2239('0x3a'),_0x2239('0x76')],'where':_0xda8df4['query'][_0x2239('0x77')]?{'id':_0xda8df4[_0x2239('0x42')]['tag']}:undefined,'required':_0xda8df4['query']['tag']?!![]:![]}];}return db[_0x2239('0x6f')][_0x2239('0x54')](_0x370e0f);})[_0x2239('0x1d')](function(_0x567690){_0x1c5032[_0x2239('0x66')]=_0x567690;return _0x1c5032;});}})['then'](respondWithFilteredResult(_0x19cd8d,_0x370e0f))[_0x2239('0x28')](handleError(_0x19cd8d,null));};exports[_0x2239('0x78')]=function(_0x50a150,_0x5381fc){var _0x216915=_0x50a150[_0x2239('0x56')]['id'];var _0x392f4a=_0x50a150['body'];var _0x397952=0xc8;var _0x4ba953=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x2239('0x79')][_0x2239('0x7a')][_0x2239('0x7b')][_0x2239('0x7c')]},function(_0xb1dc1b){return db[_0x2239('0x51')][_0x2239('0x64')]({'where':{'id':_0x216915},'transaction':_0xb1dc1b})[_0x2239('0x1d')](function(_0x5d0156){if(_0x5d0156){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x216915},'transaction':_0xb1dc1b})[_0x2239('0x1d')](function(){var _0x57b3a4=_[_0x2239('0x3e')](_0x392f4a,function(_0xcc1d14){_0xcc1d14[_0x2239('0x61')]=_0x216915;return _0xcc1d14;});return db[_0x2239('0x7d')]['bulkCreate'](_0x57b3a4,{'transaction':_0xb1dc1b});});}else{_0x397952=0x194;_0x4ba953=[];}});})[_0x2239('0x1d')](function(){if(_0x397952!==0x194){return db['FaxApplication'][_0x2239('0x7e')]({'where':{'FaxAccountId':_0x216915},'order':_0x2239('0x7f')})[_0x2239('0x1d')](function(_0x3e51b5){_0x4ba953=_0x3e51b5;});}})[_0x2239('0x28')](function(_0xeb4878){_0x397952=0x1f4;logger['error'](_0xeb4878[_0x2239('0x80')]);if(_0xeb4878[_0x2239('0x3a')]){delete _0xeb4878[_0x2239('0x3a')];}_0x4ba953=_0xeb4878;})[_0x2239('0x81')](function(){if(_0x4ba953===null){_0x5381fc[_0x2239('0x39')](_0x397952);}else{if(_0x397952===0x1f4){_0x5381fc[_0x2239('0x29')](_0x397952)[_0x2239('0x3b')](_0x4ba953);}else{_0x5381fc[_0x2239('0x29')](_0x397952)[_0x2239('0x2a')](_0x4ba953);}}});};exports['getApplications']=function(_0x30eea6,_0x1b8e83,_0x1843b7){var _0x218eab={};var _0x324c83={};var _0x4a4e96;var _0x785bed;return db['FaxAccount']['findOne']({'where':{'id':_0x30eea6[_0x2239('0x56')]['id']}})['then'](handleEntityNotFound(_0x1b8e83,null))[_0x2239('0x1d')](function(_0x5288be){if(_0x5288be){_0x4a4e96=_0x5288be;_0x324c83[_0x2239('0x41')]=_[_0x2239('0x43')](db[_0x2239('0x7d')][_0x2239('0x3f')]);_0x324c83[_0x2239('0x42')]=_['keys'](_0x30eea6[_0x2239('0x42')]);_0x324c83['filters']=_[_0x2239('0x45')](_0x324c83[_0x2239('0x41')],_0x324c83[_0x2239('0x42')]);_0x218eab[_0x2239('0x46')]=_[_0x2239('0x45')](_0x324c83[_0x2239('0x41')],qs[_0x2239('0x47')](_0x30eea6['query'][_0x2239('0x47')]));_0x218eab['attributes']=_0x218eab[_0x2239('0x46')][_0x2239('0x48')]?_0x218eab[_0x2239('0x46')]:_0x324c83['model'];_0x218eab[_0x2239('0x4a')]=qs[_0x2239('0x4b')](_0x30eea6[_0x2239('0x42')][_0x2239('0x4b')]);_0x218eab['where']=qs['filters'](_[_0x2239('0x4d')](_0x30eea6['query'],_0x324c83[_0x2239('0x44')]));if(_0x30eea6[_0x2239('0x42')]['filter']){_0x218eab[_0x2239('0x4c')]=_[_0x2239('0x50')](_0x218eab[_0x2239('0x4c')],{'$or':_[_0x2239('0x3e')](_0x218eab[_0x2239('0x46')],function(_0x194c36){var _0x1343b8={};_0x1343b8[_0x194c36]={'$like':'%'+_0x30eea6[_0x2239('0x42')][_0x2239('0x4e')]+'%'};return _0x1343b8;})});}_0x218eab=_['merge']({},_0x218eab,_0x30eea6[_0x2239('0x65')]);return _0x4a4e96[_0x2239('0x82')](_0x218eab);}})['then'](function(_0x22889e){if(_0x22889e){_0x785bed=_0x22889e[_0x2239('0x48')];if(!_0x30eea6[_0x2239('0x42')][_0x2239('0x49')]('nolimit')){_0x218eab[_0x2239('0x2e')]=qs[_0x2239('0x2e')](_0x30eea6[_0x2239('0x42')][_0x2239('0x2e')]);_0x218eab[_0x2239('0x2b')]=qs['offset'](_0x30eea6['query'][_0x2239('0x2b')]);}return _0x4a4e96[_0x2239('0x82')](_0x218eab);}})[_0x2239('0x1d')](function(_0x33c982){if(_0x33c982){return _0x33c982?{'count':_0x785bed,'rows':_0x33c982}:null;}})[_0x2239('0x1d')](respondWithResult(_0x1b8e83,null))[_0x2239('0x28')](handleError(_0x1b8e83,null));};function Extension(_0x288cb3,_0x4eabda,_0x21ac9a,_0x2d21fb){this[_0x2239('0x83')]=_0x2239('0x84');this[_0x2239('0x85')]=_0x288cb3[_0x2239('0x86')];this[_0x2239('0x87')]=_0x2d21fb;this['type']=_0x2239('0x88');this[_0x2239('0x89')]=_0x2239('0x8a');this[_0x2239('0x61')]=_0x288cb3['id'];this['priority']=_0x4eabda;this[_0x2239('0x8b')]=_0x21ac9a;}function createExtensionsReciveFax(_0x57ca3f){var _0x29acd7=0x1;var _0x299ff1=[];_0x299ff1[_0x2239('0x8c')](new Extension(_0x57ca3f,_0x29acd7,'','Answer'));_0x29acd7+=0x1;_0x299ff1[_0x2239('0x8c')](new Extension(_0x57ca3f,_0x29acd7,_0x2239('0x8d'),_0x2239('0x8e')));_0x29acd7+=0x1;for(var _0x1aacc6 in _0x57ca3f){if(_0x57ca3f[_0x2239('0x49')](_0x1aacc6)&&(_0x1aacc6===_0x2239('0x8f')||_0x1aacc6===_0x2239('0x86')||_0x1aacc6===_0x2239('0x90')||_0x1aacc6==='faxdetect'||_0x1aacc6===_0x2239('0x91')||_0x1aacc6===_0x2239('0x92')||_0x1aacc6==='minrate'||_0x1aacc6===_0x2239('0x93')||_0x1aacc6==='t38timeout')){_0x299ff1[_0x2239('0x8c')](new Extension(_0x57ca3f,_0x29acd7,_0x2239('0x94')+_0x1aacc6+')='+_0x57ca3f[_0x1aacc6],_0x2239('0x8e')));_0x29acd7+=0x1;}}_0x299ff1[_0x2239('0x8c')](new Extension(_0x57ca3f,_0x29acd7,'6',_0x2239('0x95')));_0x29acd7+=0x1;_0x299ff1[_0x2239('0x8c')](new Extension(_0x57ca3f,_0x29acd7,_0x2239('0x96'),_0x2239('0x97')));_0x29acd7=0x0;return _0x299ff1;}exports['addAccountApplications']=function(_0x4758db,_0x4bcd62,_0x1e48df){var _0x283ebc;return db[_0x2239('0x79')][_0x2239('0x98')](function(_0x2e76d1){return db['FaxAccount'][_0x2239('0x59')](_0x4758db['body'],{'transaction':_0x2e76d1})[_0x2239('0x1d')](function(_0x108b7e){_0x283ebc=_0x108b7e[_0x2239('0x36')]({'plain':!![]});return db[_0x2239('0x99')]['bulkCreate'](createExtensionsReciveFax(_0x283ebc),{'transaction':_0x2e76d1});});})[_0x2239('0x1d')](function(){return _0x283ebc;})['then'](respondWithResult(_0x4bcd62,null))[_0x2239('0x28')](handleError(_0x4bcd62,null));};exports[_0x2239('0x9a')]=function(_0x33529f,_0x532967,_0x569e11){var _0xd7c82f;return db[_0x2239('0x79')][_0x2239('0x98')](function(_0x49cd9b){return db['FaxAccount'][_0x2239('0x34')](_0x33529f[_0x2239('0x5a')],{'where':{'id':_0x33529f[_0x2239('0x5a')]['id']},'transaction':_0x49cd9b})[_0x2239('0x1d')](function(_0x2d46f3){return db[_0x2239('0x99')][_0x2239('0x35')]({'where':{'FaxAccountId':_0x33529f[_0x2239('0x5a')]['id']},'transaction':_0x49cd9b})[_0x2239('0x1d')](function(_0x3ee524){return db[_0x2239('0x99')][_0x2239('0x9b')](createExtensionsReciveFax(_[_0x2239('0x6e')](_0x33529f[_0x2239('0x5a')],['tech','key',_0x2239('0x9c'),'updatedAt',_0x2239('0x9d'),_0x2239('0x9e')])),{'transaction':_0x49cd9b});});});})[_0x2239('0x1d')](function(){return db[_0x2239('0x51')][_0x2239('0x9f')](_0x33529f[_0x2239('0x5a')]['id']);})[_0x2239('0x1d')](respondWithResult(_0x532967,null))['catch'](handleError(_0x532967,null));};exports[_0x2239('0xa0')]=function(_0x4f35c1,_0x23a769,_0x34ee5a){var _0x2a1573={'raw':!![],'where':{}};var _0x2e6b44={};var _0x2116a1={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2239('0x64')]({'where':{'id':_0x4f35c1[_0x2239('0x56')]['id']}})[_0x2239('0x1d')](handleEntityNotFound(_0x23a769,null))[_0x2239('0x1d')](function(_0x2fcba7){if(_0x2fcba7){_0x2e6b44[_0x2239('0x41')]=_[_0x2239('0x43')](db[_0x2239('0xa1')][_0x2239('0x3f')]);_0x2e6b44['query']=_[_0x2239('0x43')](_0x4f35c1['query']);_0x2e6b44['filters']=_[_0x2239('0x45')](_0x2e6b44[_0x2239('0x41')],_0x2e6b44[_0x2239('0x42')]);_0x2a1573['attributes']=_['intersection'](_0x2e6b44[_0x2239('0x41')],qs[_0x2239('0x47')](_0x4f35c1['query'][_0x2239('0x47')]));_0x2a1573[_0x2239('0x46')]=_0x2a1573['attributes'][_0x2239('0x48')]?_0x2a1573[_0x2239('0x46')]:_0x2e6b44[_0x2239('0x41')];if(!_0x4f35c1[_0x2239('0x42')][_0x2239('0x49')](_0x2239('0x6b'))){_0x2a1573['limit']=qs[_0x2239('0x2e')](_0x4f35c1['query'][_0x2239('0x2e')]);_0x2a1573[_0x2239('0x2b')]=qs[_0x2239('0x2b')](_0x4f35c1[_0x2239('0x42')]['offset']);}_0x2a1573[_0x2239('0x4a')]=qs['sort'](_0x4f35c1[_0x2239('0x42')]['sort']);_0x2a1573[_0x2239('0x4c')]=qs[_0x2239('0x44')](_[_0x2239('0x4d')](_0x4f35c1[_0x2239('0x42')],_0x2e6b44[_0x2239('0x44')]));_0x2a1573[_0x2239('0x4c')][_0x2239('0x61')]=_0x2fcba7['id'];if(_0x4f35c1[_0x2239('0x42')][_0x2239('0x4e')]){_0x2a1573[_0x2239('0x4c')]=_['merge'](_0x2a1573[_0x2239('0x4c')],{'$or':_['map'](_0x2a1573[_0x2239('0x46')],function(_0x4e7c73){var _0x533571={};_0x533571[_0x4e7c73]={'$like':'%'+_0x4f35c1[_0x2239('0x42')][_0x2239('0x4e')]+'%'};return _0x533571;})});}if(_0x4f35c1[_0x2239('0x42')][_0x2239('0xa2')]){var _0xd51fae=_0x4f35c1['query']['$gte'][_0x2239('0xa3')](',');var _0x29ce21={};_0x29ce21[_0xd51fae[0x0]]={'$gte':moment(_0xd51fae[0x1])['format'](_0x2239('0xa4'))};_0x2a1573[_0x2239('0x4c')]=_[_0x2239('0x50')](_0x2a1573[_0x2239('0x4c')],_0x29ce21);}_0x2a1573=_[_0x2239('0x50')]({},_0x2a1573,_0x4f35c1[_0x2239('0x65')]);return db[_0x2239('0xa1')][_0x2239('0x2d')]({'where':_0x2a1573[_0x2239('0x4c')]})[_0x2239('0x1d')](function(_0x2df373){_0x2116a1['count']=_0x2df373;if(_0x4f35c1['query']['includeAll']){_0x2a1573[_0x2239('0x53')]=[{'all':!![]}];}return db[_0x2239('0xa1')]['findAll'](_0x2a1573);})[_0x2239('0x1d')](function(_0x244e51){_0x2116a1[_0x2239('0x66')]=_0x244e51;return _0x2116a1;});}})[_0x2239('0x1d')](respondWithFilteredResult(_0x23a769,_0x2a1573))['catch'](handleError(_0x23a769,null));};exports['send']=function(_0x6c94bb,_0x325228,_0xaf5526){var _0x12b22e,_0x41feb6={},_0x28a348;if(_0x6c94bb[_0x2239('0x5a')]['to']){_0x28a348=_0x6c94bb[_0x2239('0x5a')]['to'][0x0];}return db[_0x2239('0x51')]['find']({'where':{'id':_0x6c94bb[_0x2239('0x56')]['id']},'include':[{'model':db[_0x2239('0xa5')],'as':_0x2239('0xa6'),'include':[{'model':db['CmContact'],'as':_0x2239('0xa7'),'where':{'fax':_0x28a348},'limit':0x1,'order':[[_0x2239('0xa8'),_0x2239('0xa9')]]}]}]})[_0x2239('0x1d')](handleEntityNotFound(_0x325228,null))[_0x2239('0x1d')](function(_0x1ca3a5){_0x12b22e=_0x1ca3a5;if(_0x6c94bb[_0x2239('0x5a')][_0x2239('0xaa')]&&_0x6c94bb[_0x2239('0x5a')][_0x2239('0xaa')]['length']){for(var _0x4e4369=0x0;_0x4e4369<_0x6c94bb[_0x2239('0x5a')][_0x2239('0xaa')][_0x2239('0x48')];_0x4e4369+=0x1){_0x6c94bb[_0x2239('0x5a')][_0x2239('0xaa')][_0x4e4369]={'filename':_0x6c94bb['body'][_0x2239('0xaa')][_0x4e4369][_0x2239('0x3a')],'id':_0x6c94bb[_0x2239('0x5a')]['attachments'][_0x4e4369]['id'],'path':path['join'](config[_0x2239('0xab')],_0x2239('0xac'),_0x6c94bb[_0x2239('0x5a')]['attachments'][_0x4e4369]['basename'])};}}return respondWithRpcPromise(_0x2239('0xad'),_0x2239('0xad'),{'FaxAccountId':_[_0x2239('0xae')](_0x6c94bb[_0x2239('0x56')]['id'])?undefined:_0x6c94bb['params']['id'],'path':_[_0x2239('0xae')](_0x6c94bb[_0x2239('0x5a')][_0x2239('0xaa')][0x0]['path'])?undefined:_0x6c94bb[_0x2239('0x5a')][_0x2239('0xaa')][0x0][_0x2239('0xaf')],'fax':_[_0x2239('0xae')](_0x6c94bb[_0x2239('0x5a')]['to'][0x0])?undefined:_0x6c94bb[_0x2239('0x5a')]['to'][0x0]},client9002);})[_0x2239('0x1d')](function(){if(_0x12b22e){if(_[_0x2239('0xae')](_0x6c94bb[_0x2239('0x5a')]['from'])){_0x6c94bb[_0x2239('0x5a')][_0x2239('0xb0')]=util['format']('\x22%s\x22\x20<%s>',_0x12b22e[_0x2239('0x3a')],_0x12b22e[_0x2239('0xb1')]);}if(_0x12b22e[_0x2239('0xa6')]){if(_0x12b22e[_0x2239('0xa6')][_0x2239('0xa7')][_0x2239('0x48')]){return _0x12b22e[_0x2239('0xa6')][_0x2239('0xa7')][0x0];}else{return db['CmContact'][_0x2239('0x59')](_[_0x2239('0x16')](_0x6c94bb[_0x2239('0x5a')],{'firstName':_0x6c94bb[_0x2239('0x5a')]['to'][0x0],'phone':_0x6c94bb[_0x2239('0x5a')]['to'][0x0],'fax':_0x6c94bb['body']['to'][0x0],'ListId':_0x12b22e[_0x2239('0x9e')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x2239('0xb2'));}})['then'](function(_0x55ff78){if(_0x55ff78){return db['FaxInteraction'][_0x2239('0x58')]({'where':{'ContactId':_0x55ff78['id'],'closed':![],'FaxAccountId':_0x12b22e['id']}})[_0x2239('0x1d')](function(_0x4707a9){if(_0x4707a9){return[_0x4707a9,![]];}return db[_0x2239('0x6f')][_0x2239('0x59')]({'UserId':_0x6c94bb[_0x2239('0x5b')]['id'],'ContactId':_0x55ff78['id'],'FaxAccountId':_0x12b22e['id'],'fax':_0x6c94bb['body']['to'][0x0],'firstMsgDirection':_0x2239('0xb3'),'Messages':[_[_0x2239('0x50')](_0x6c94bb[_0x2239('0x5a')],{'read':![],'body':_0x6c94bb['body']['attachments'][0x0][_0x2239('0xb4')],'FaxAccountId':_0x12b22e['id'],'UserId':_0x6c94bb['user']['id'],'ContactId':_0x55ff78['id'],'AttachmentId':_0x6c94bb[_0x2239('0x5a')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x2239('0xa1')],'as':_0x2239('0xb5')}]})['then'](function(_0x694156){return[_0x694156,!![]];});});}else{throw new Error(_0x2239('0xb6'));}})[_0x2239('0xb7')](function(_0x29825b,_0x3f07ae){if(_0x3f07ae){return _0x29825b;}return db[_0x2239('0xa1')][_0x2239('0x59')]({'direction':_0x2239('0xb3'),'read':![],'body':_0x6c94bb['body']['attachments'][0x0][_0x2239('0xb4')],'FaxAccountId':_0x12b22e['id'],'FaxInteractionId':_0x29825b['id'],'UserId':_0x6c94bb[_0x2239('0x5b')]['id'],'ContactId':_0x29825b[_0x2239('0xb8')],'AttachmentId':_0x6c94bb[_0x2239('0x5a')][_0x2239('0xaa')][0x0]['id']})[_0x2239('0x1d')](function(_0x482b4a){_0x29825b[_0x2239('0xb9')][_0x2239('0xb5')]=[];_0x29825b[_0x2239('0xb9')][_0x2239('0xb5')][_0x2239('0x8c')](_0x482b4a[_0x2239('0xb9')]);return _0x29825b;});})['then'](function(_0x56339d){respondWithRpcPromise('SendFax',_0x2239('0xba'),{'FaxAccountId':_[_0x2239('0xae')](_0x6c94bb[_0x2239('0x56')]['id'])?undefined:_0x6c94bb[_0x2239('0x56')]['id'],'path':_[_0x2239('0xae')](_0x6c94bb[_0x2239('0x5a')][_0x2239('0xaa')][0x0][_0x2239('0xaf')])?undefined:_0x6c94bb['body'][_0x2239('0xaa')][0x0][_0x2239('0xaf')],'fax':_[_0x2239('0xae')](_0x6c94bb['body']['to'][0x0])?undefined:_0x6c94bb[_0x2239('0x5a')]['to'][0x0],'AttachmentId':_0x6c94bb[_0x2239('0x5a')][_0x2239('0xaa')][0x0]['id']},client9002)[_0x2239('0x1d')](function(_0x422926){logger['info'](_0x2239('0xbb'),_0x422926);})[_0x2239('0x28')](function(_0x29d86d){logger[_0x2239('0x1e')](_0x2239('0xbb'),_0x29d86d);});return _0x56339d;})[_0x2239('0x1d')](respondWithResult(_0x325228,null))['catch'](handleError(_0x325228,null));};exports[_0x2239('0xbc')]=function(_0x52556c,_0x232651,_0x1dc97d){return db[_0x2239('0x51')]['find']({'where':{'id':_0x52556c[_0x2239('0x56')]['id']}})['then'](handleEntityNotFound(_0x232651,null))[_0x2239('0x1d')](function(_0x58a773){if(_0x58a773){return _0x58a773['addAgents'](_0x52556c[_0x2239('0x5a')]['ids'],_[_0x2239('0x6e')](_0x52556c[_0x2239('0x5a')],[_0x2239('0x67'),'id'])||{})[_0x2239('0xb7')](function(_0x5ec216){for(var _0x32e064=0x0;_0x32e064<_0x52556c['body'][_0x2239('0x67')][_0x2239('0x48')];_0x32e064+=0x1){socket[_0x2239('0xbd')](_0x2239('0xbe'),{'UserId':Number(_0x52556c[_0x2239('0x5a')][_0x2239('0x67')][_0x32e064]),'FaxAccountId':Number(_0x52556c['params']['id'])});}return _0x5ec216;});}})[_0x2239('0x1d')](respondWithResult(_0x232651,null))[_0x2239('0x28')](handleError(_0x232651,null));};exports[_0x2239('0xbf')]=function(_0x41b5f3,_0x3ca1fe,_0x272b60){return db['FaxAccount'][_0x2239('0x58')]({'where':{'id':_0x41b5f3[_0x2239('0x56')]['id']}})[_0x2239('0x1d')](handleEntityNotFound(_0x3ca1fe,null))[_0x2239('0x1d')](function(_0x5efe55){if(_0x5efe55){return _0x5efe55['removeAgents'](_0x41b5f3['query'][_0x2239('0x67')])[_0x2239('0x1d')](function(){if(_[_0x2239('0xc0')](_0x41b5f3[_0x2239('0x42')][_0x2239('0x67')])){for(var _0x150832=0x0;_0x150832<_0x41b5f3[_0x2239('0x42')]['ids'][_0x2239('0x48')];_0x150832+=0x1){socket[_0x2239('0xbd')](_0x2239('0xc1'),{'UserId':Number(_0x41b5f3[_0x2239('0x42')]['ids'][_0x150832]),'FaxAccountId':Number(_0x41b5f3[_0x2239('0x56')]['id'])});}}else{socket[_0x2239('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0x41b5f3[_0x2239('0x42')][_0x2239('0x67')]),'FaxAccountId':Number(_0x41b5f3[_0x2239('0x56')]['id'])});}});}})[_0x2239('0x1d')](respondWithStatusCode(_0x3ca1fe,null))[_0x2239('0x28')](handleError(_0x3ca1fe,null));};exports[_0x2239('0xc2')]=function(_0x42100f,_0x5ca0c7,_0x57cec1){var _0xc980d4={};var _0x3d91a3={};var _0x24b68e;var _0x522e95;return db[_0x2239('0x51')]['findOne']({'where':{'id':_0x42100f['params']['id']}})[_0x2239('0x1d')](handleEntityNotFound(_0x5ca0c7,null))[_0x2239('0x1d')](function(_0x1bc358){if(_0x1bc358){_0x24b68e=_0x1bc358;_0x3d91a3[_0x2239('0x41')]=_[_0x2239('0x43')](db[_0x2239('0x72')]['rawAttributes']);_0x3d91a3['query']=_['keys'](_0x42100f['query']);_0x3d91a3[_0x2239('0x44')]=_['intersection'](_0x3d91a3[_0x2239('0x41')],_0x3d91a3[_0x2239('0x42')]);_0xc980d4[_0x2239('0x46')]=_[_0x2239('0x45')](_0x3d91a3['model'],qs[_0x2239('0x47')](_0x42100f['query'][_0x2239('0x47')]));_0xc980d4[_0x2239('0x46')]=_0xc980d4[_0x2239('0x46')][_0x2239('0x48')]?_0xc980d4[_0x2239('0x46')]:_0x3d91a3[_0x2239('0x41')];_0xc980d4[_0x2239('0x4a')]=qs['sort'](_0x42100f[_0x2239('0x42')][_0x2239('0x4b')]);_0xc980d4[_0x2239('0x4c')]=qs[_0x2239('0x44')](_[_0x2239('0x4d')](_0x42100f[_0x2239('0x42')],_0x3d91a3[_0x2239('0x44')]));if(_0x42100f[_0x2239('0x42')][_0x2239('0x4e')]){_0xc980d4[_0x2239('0x4c')]=_[_0x2239('0x50')](_0xc980d4[_0x2239('0x4c')],{'$or':_['map'](_0xc980d4[_0x2239('0x46')],function(_0x3d7546){var _0x4c997a={};_0x4c997a[_0x3d7546]={'$like':'%'+_0x42100f[_0x2239('0x42')][_0x2239('0x4e')]+'%'};return _0x4c997a;})});}_0xc980d4=_['merge']({},_0xc980d4,_0x42100f[_0x2239('0x65')]);return _0x24b68e[_0x2239('0xc2')](_0xc980d4);}})[_0x2239('0x1d')](function(_0x3dc52f){if(_0x3dc52f){_0x522e95=_0x3dc52f[_0x2239('0x48')];if(!_0x42100f[_0x2239('0x42')][_0x2239('0x49')](_0x2239('0x6b'))){_0xc980d4[_0x2239('0x2e')]=qs[_0x2239('0x2e')](_0x42100f[_0x2239('0x42')][_0x2239('0x2e')]);_0xc980d4['offset']=qs[_0x2239('0x2b')](_0x42100f['query'][_0x2239('0x2b')]);}return _0x24b68e['getAgents'](_0xc980d4);}})[_0x2239('0x1d')](function(_0x419c11){if(_0x419c11){return _0x419c11?{'count':_0x522e95,'rows':_0x419c11}:null;}})['then'](respondWithResult(_0x5ca0c7,null))[_0x2239('0x28')](handleError(_0x5ca0c7,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 237c94d..b65c196 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 _0x3149=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','FaxAccount'];(function(_0x295b5a,_0x27b80b){var _0x42f81a=function(_0x26da79){while(--_0x26da79){_0x295b5a['push'](_0x295b5a['shift']());}};_0x42f81a(++_0x27b80b);}(_0x3149,0x181));var _0x9314=function(_0x37d9a6,_0x376e81){_0x37d9a6=_0x37d9a6-0x0;var _0x3a5b99=_0x3149[_0x37d9a6];return _0x3a5b99;};'use strict';var EventEmitter=require(_0x9314('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x9314('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x9314('0x2')](0x0);var events={'afterCreate':_0x9314('0x3'),'afterUpdate':_0x9314('0x4'),'afterDestroy':'remove'};function emitEvent(_0xd2b58e){return function(_0x29d5ef,_0x14baca,_0x19ff6e){FaxAccountEvents[_0x9314('0x5')](_0xd2b58e+':'+_0x29d5ef['id'],_0x29d5ef);FaxAccountEvents['emit'](_0xd2b58e,_0x29d5ef);_0x19ff6e(null);};}for(var e in events){if(events[_0x9314('0x6')](e)){var event=events[e];FaxAccount[_0x9314('0x7')](e,emitEvent(event));}}module[_0x9314('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x2801=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','remove'];(function(_0x45cd39,_0x33d895){var _0x149af5=function(_0x525493){while(--_0x525493){_0x45cd39['push'](_0x45cd39['shift']());}};_0x149af5(++_0x33d895);}(_0x2801,0xeb));var _0x1280=function(_0x243b6d,_0x5dcb94){_0x243b6d=_0x243b6d-0x0;var _0x52c5ce=_0x2801[_0x243b6d];return _0x52c5ce;};'use strict';var EventEmitter=require(_0x1280('0x0'));var FaxAccount=require(_0x1280('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1280('0x2')};function emitEvent(_0x5cf49){return function(_0x124087,_0x3e049f,_0x32b9e2){FaxAccountEvents[_0x1280('0x3')](_0x5cf49+':'+_0x124087['id'],_0x124087);FaxAccountEvents['emit'](_0x5cf49,_0x124087);_0x32b9e2(null);};}for(var e in events){if(events[_0x1280('0x4')](e)){var event=events[e];FaxAccount[_0x1280('0x5')](e,emitEvent(event));}}module[_0x1280('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 02bbe7d..b82cefb 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 _0x638e=['define','fax_accounts','../../config/logger','path','../../config/environment','./faxAccount.attributes','exports'];(function(_0xf130b3,_0xa0f000){var _0x5290b8=function(_0x1a2f56){while(--_0x1a2f56){_0xf130b3['push'](_0xf130b3['shift']());}};_0x5290b8(++_0xa0f000);}(_0x638e,0x1b4));var _0xe638=function(_0x5eedac,_0x366877){_0x5eedac=_0x5eedac-0x0;var _0x68fada=_0x638e[_0x5eedac];return _0x68fada;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe638('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe638('0x1'));var rimraf=require('rimraf');var config=require(_0xe638('0x2'));var attributes=require(_0xe638('0x3'));module[_0xe638('0x4')]=function(_0x37947f,_0x46405b){return _0x37947f[_0xe638('0x5')]('FaxAccount',attributes,{'tableName':_0xe638('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb1b3=['exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes'];(function(_0x47a50a,_0x11cb7a){var _0x341c34=function(_0x1fce7f){while(--_0x1fce7f){_0x47a50a['push'](_0x47a50a['shift']());}};_0x341c34(++_0x11cb7a);}(_0xb1b3,0xe4));var _0x3b1b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb1b3[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x3b1b('0x0'));var util=require(_0x3b1b('0x1'));var logger=require(_0x3b1b('0x2'))(_0x3b1b('0x3'));var moment=require(_0x3b1b('0x4'));var BPromise=require(_0x3b1b('0x5'));var rp=require(_0x3b1b('0x6'));var fs=require('fs');var path=require(_0x3b1b('0x7'));var rimraf=require('rimraf');var config=require(_0x3b1b('0x8'));var attributes=require(_0x3b1b('0x9'));module[_0x3b1b('0xa')]=function(_0x408f1f,_0x1d7e2e){return _0x408f1f[_0x3b1b('0xb')](_0x3b1b('0xc'),attributes,{'tableName':_0x3b1b('0xd'),'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 d7f3275..5b248b0 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 _0x200f=['DESC','FaxApplication','get','list','applications','priority','asc','account','Applications','contact','fax','FaxInteraction','create','spread','autoclose','push','length','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','FaxQueue','queue','waitForTheAssignedQueue','startRouting','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','NotifyFaxAccount','body','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','List','CmContact','Contacts'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x200f,0x136));var _0xf200=function(_0x4e9f1a,_0x35e3f3){_0x4e9f1a=_0x4e9f1a-0x0;var _0x441f20=_0x200f[_0x4e9f1a];return _0x441f20;};'use strict';var _=require('lodash');var util=require(_0xf200('0x0'));var moment=require(_0xf200('0x1'));var BPromise=require(_0xf200('0x2'));var rs=require(_0xf200('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf200('0x4'))['db'];var utils=require(_0xf200('0x5'));var logger=require('../../config/logger')(_0xf200('0x6'));var config=require('../../config/environment');var jayson=require(_0xf200('0x7'));var client=jayson['client'][_0xf200('0x8')]({'port':0x232c});config[_0xf200('0x9')]=_[_0xf200('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf200('0x9')]));require('./faxAccount.socket')[_0xf200('0xb')](socket);function respondWithRpcPromise(_0x183789,_0x358a71,_0x18f9f1){return new BPromise(function(_0x3ac70e,_0x61f5d5){return client[_0xf200('0xc')](_0x183789,_0x18f9f1)[_0xf200('0xd')](function(_0x4c089a){logger[_0xf200('0xe')](_0xf200('0xf'),_0x358a71,_0xf200('0x10'));logger['debug'](_0xf200('0x11'),_0x358a71,'request\x20sent',JSON[_0xf200('0x12')](_0x4c089a));if(_0x4c089a[_0xf200('0x13')]){if(_0x4c089a[_0xf200('0x13')][_0xf200('0x14')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x358a71,_0x4c089a[_0xf200('0x13')][_0xf200('0x15')]);return _0x61f5d5(_0x4c089a[_0xf200('0x13')][_0xf200('0x15')]);}logger[_0xf200('0x13')](_0xf200('0xf'),_0x358a71,_0x4c089a[_0xf200('0x13')][_0xf200('0x15')]);return _0x3ac70e(_0x4c089a[_0xf200('0x13')][_0xf200('0x15')]);}else{logger['info'](_0xf200('0xf'),_0x358a71,_0xf200('0x10'));_0x3ac70e(_0x4c089a['result'][_0xf200('0x15')]);}})[_0xf200('0x16')](function(_0x96d1ec){logger[_0xf200('0x13')]('FaxAccount,\x20%s,\x20%s',_0x358a71,_0x96d1ec);_0x61f5d5(_0x96d1ec);});});}exports[_0xf200('0x17')]=function(_0x51a0be){var _0x347f64=this;return new Promise(function(_0x902c28,_0x1888da){return db[_0xf200('0x18')][_0xf200('0x19')]({'raw':_0x51a0be[_0xf200('0x1a')]?_0x51a0be[_0xf200('0x1a')][_0xf200('0x1b')]===undefined?!![]:![]:!![],'where':_0x51a0be['options']?_0x51a0be['options'][_0xf200('0x1c')]||null:null,'attributes':_0x51a0be[_0xf200('0x1a')]?_0x51a0be[_0xf200('0x1a')][_0xf200('0x1d')]||null:null,'limit':_0x51a0be[_0xf200('0x1a')]?_0x51a0be['options'][_0xf200('0x1e')]||null:null,'include':_0x51a0be[_0xf200('0x1a')]?_0x51a0be[_0xf200('0x1a')][_0xf200('0x1f')]?_[_0xf200('0x20')](_0x51a0be[_0xf200('0x1a')]['include'],function(_0x190347){return{'model':db[_0x190347[_0xf200('0x21')]],'as':_0x190347['as'],'attributes':_0x190347[_0xf200('0x1d')],'include':_0x190347[_0xf200('0x1f')]?_['map'](_0x190347[_0xf200('0x1f')],function(_0x13aa44){return{'model':db[_0x13aa44[_0xf200('0x21')]],'as':_0x13aa44['as'],'attributes':_0x13aa44[_0xf200('0x1d')],'include':_0x13aa44[_0xf200('0x1f')]?_['map'](_0x13aa44[_0xf200('0x1f')],function(_0x38075c){return{'model':db[_0x38075c[_0xf200('0x21')]],'as':_0x38075c['as'],'attributes':_0x38075c[_0xf200('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf200('0xd')](function(_0x3d0071){logger['info']('GetFaxAccount',_0x51a0be);logger[_0xf200('0x22')](_0xf200('0x17'),_0x51a0be,JSON[_0xf200('0x12')](_0x3d0071));_0x902c28(_0x3d0071);})['catch'](function(_0x37d91e){logger[_0xf200('0x13')]('GetFaxAccount',_0x37d91e[_0xf200('0x15')],_0x51a0be);_0x1888da(_0x347f64[_0xf200('0x13')](0x1f4,_0x37d91e[_0xf200('0x15')]));});});};exports[_0xf200('0x23')]=function(_0x2bc469,_0xf3ae31,_0x4502e4){var _0x576b03=this;return new Promise(function(_0x4c1f2b,_0x3f7f03){var _0x38a9fb={'body':_0x2bc469[_0xf200('0x24')],'channel':'fax'};var _0x1eedb3=[];var _0x174b0d=[];var _0x2e37a7={};return db['CmContact'][_0xf200('0x25')]()[_0xf200('0xd')](function(_0x3cfebc){if(!_0x3cfebc){throw new db[(_0xf200('0x26'))][(_0xf200('0x27'))](_0xf200('0x28'));}_0x1eedb3=_[_0xf200('0x29')](_[_0xf200('0x2a')](_0x3cfebc),['createdAt',_0xf200('0x2b')]);_0x174b0d=_['difference'](_[_0xf200('0x2a')](_0x3cfebc),[_0xf200('0x2c'),'updatedAt',_0xf200('0x2d'),_0xf200('0x2e')]);if(_0x2bc469[_0xf200('0x24')]['id']){delete _0x2bc469[_0xf200('0x24')]['id'];}if(_[_0xf200('0x2f')](_0x2bc469[_0xf200('0x24')][_0xf200('0x30')])){throw new db[(_0xf200('0x26'))]['ValidationError'](_0xf200('0x31'));}if(_['isNil'](_0x2bc469['body'][_0xf200('0x24')])||_0x2bc469[_0xf200('0x24')][_0xf200('0x24')]===''){throw new db[(_0xf200('0x26'))][(_0xf200('0x27'))](_0xf200('0x32'));}if(_['isNil'](_0x2bc469[_0xf200('0x24')][_0xf200('0x33')])){throw new db[(_0xf200('0x26'))][(_0xf200('0x27'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x174b0d);}if(!_[_0xf200('0x34')](_0x174b0d,_0x2bc469[_0xf200('0x24')][_0xf200('0x33')])){throw new db[(_0xf200('0x26'))]['ValidationError'](_0xf200('0x35')+_0x174b0d);}_0x2e37a7[_0x2bc469[_0xf200('0x24')]['mapKey']]=_0x2bc469[_0xf200('0x24')]['from'];})['then'](function(){return db[_0xf200('0x18')][_0xf200('0x36')]({'where':{'id':_0x2bc469['account']['id']},'include':[{'model':db['CmList'],'as':_0xf200('0x37'),'include':[{'model':db[_0xf200('0x38')],'as':_0xf200('0x39'),'where':_0x2e37a7,'limit':0x1,'order':[[_0xf200('0x2b'),_0xf200('0x3a')]]}]},{'model':db[_0xf200('0x3b')],'as':'Applications'}]});})['then'](function(_0x45d8bb){if(_0x45d8bb&&_0x45d8bb[_0xf200('0x37')]){var _0x50be6f=_0x45d8bb[_0xf200('0x3c')]({'plain':!![]});_0x38a9fb['account']=_0x50be6f;_0x38a9fb['applications']=_0x50be6f['Applications'];_0x38a9fb[_0xf200('0x3d')]=_0x50be6f[_0xf200('0x37')];_0x38a9fb['applications']=_['orderBy'](_0x38a9fb[_0xf200('0x3e')],[_0xf200('0x3f')],[_0xf200('0x40')]);if(_0x38a9fb['account']['Applications']){delete _0x38a9fb[_0xf200('0x41')][_0xf200('0x42')];}if(_0x38a9fb['account'][_0xf200('0x37')]&&_0x38a9fb['account'][_0xf200('0x37')][_0xf200('0x39')]['length']){return _0x38a9fb[_0xf200('0x41')][_0xf200('0x37')]['Contacts'][0x0];}var _0x3096da=_[_0xf200('0xa')](_0x2bc469[_0xf200('0x24')],{'firstName':_0x2bc469[_0xf200('0x24')][_0xf200('0x30')],'ListId':_0x50be6f[_0xf200('0x2e')]});_0x3096da[_0x2bc469[_0xf200('0x24')][_0xf200('0x33')]]=_0x2bc469[_0xf200('0x24')][_0xf200('0x30')];return db[_0xf200('0x38')]['create'](_0x3096da,{'fields':_0x1eedb3,'raw':!![]});}})[_0xf200('0xd')](function(_0xd53359){_0x38a9fb[_0xf200('0x43')]=_0xd53359;if(_0xd53359){var _0x271dad={'ContactId':_0xd53359['id'],'FaxAccountId':_0x2bc469['account']['id'],'fax':_0xd53359[_0xf200('0x44')]};return db[_0xf200('0x45')][_0xf200('0x36')]({'where':{'ContactId':_0xd53359['id'],'closed':![],'FaxAccountId':_0x2bc469[_0xf200('0x41')]['id']}})[_0xf200('0xd')](function(_0x4e49ed){if(_0x4e49ed){return[_0x4e49ed,![]];}return db['FaxInteraction'][_0xf200('0x46')](_0x271dad)[_0xf200('0xd')](function(_0x3a9949){return[_0x3a9949,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xf200('0x47')](function(_0x25fdb2,_0x37a1a7){var _0x3f330d=_0x25fdb2['get']({'plain':!![]});if(_0x37a1a7){if(_0x38a9fb[_0xf200('0x41')][_0xf200('0x48')]){_0x38a9fb[_0xf200('0x3e')][_0xf200('0x49')]({'id':0x0,'priority':_0x38a9fb[_0xf200('0x3e')][_0xf200('0x4a')]+0x1,'app':'close','appdata':_0xf200('0x4b'),'interval':_0xf200('0x4c')});}_0x3f330d[_0xf200('0x4d')]=!![];}else{_0x3f330d[_0xf200('0x4d')]=![];}_0x38a9fb[_0xf200('0x4e')]=_0x3f330d;return db['FaxMessage']['create']({'body':_0x2bc469[_0xf200('0x24')]['body'],'FaxAccountId':_0x2bc469[_0xf200('0x41')]['id'],'FaxInteractionId':_0x25fdb2['id'],'direction':'in','ContactId':_0x25fdb2[_0xf200('0x4f')],'AttachmentId':_0x2bc469[_0xf200('0x24')][_0xf200('0x50')]});})[_0xf200('0xd')](function(_0x223e41){_0x38a9fb[_0xf200('0x15')]=_0x223e41;if(!_0x38a9fb[_0xf200('0x4e')][_0xf200('0x51')])return;return db[_0xf200('0x52')]['find']({'attributes':['id',_0xf200('0x53')],'where':{'id':_0x38a9fb[_0xf200('0x4e')][_0xf200('0x51')]}});})[_0xf200('0xd')](function(_0x498ddd){if(_0x498ddd){_0x38a9fb['applications'][_0xf200('0x54')]({'id':0x0,'priority':0x0,'app':_0xf200('0x55'),'appdata':_0x498ddd[_0xf200('0x53')]+','+(_0x38a9fb[_0xf200('0x41')][_0xf200('0x56')]||0xa),'interval':_0xf200('0x4c')});}if(!_0x38a9fb['interaction'][_0xf200('0x57')])return;return db[_0xf200('0x58')][_0xf200('0x36')]({'attributes':['id',_0xf200('0x53')],'where':{'id':_0x38a9fb[_0xf200('0x4e')][_0xf200('0x57')]}});})[_0xf200('0xd')](function(_0x1e4798){if(_0x1e4798){_0x38a9fb[_0xf200('0x3e')]['unshift']({'id':0x0,'priority':0x1,'app':_0xf200('0x59'),'appdata':_0x1e4798[_0xf200('0x53')]+','+(_0x38a9fb[_0xf200('0x41')][_0xf200('0x5a')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xf200('0x5b'),_0x38a9fb);})['then'](function(_0x275faa){_0x4c1f2b(_0x275faa);})[_0xf200('0x16')](function(_0x4a1b24){_0x3f7f03(_0x576b03[_0xf200('0x13')](0x1f4,_0x4a1b24[_0xf200('0x15')]));});});}; \ No newline at end of file +var _0x1788=['mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','Contacts','FaxApplication','Applications','List','get','applications','orderBy','priority','asc','account','length','create','contact','FaxInteraction','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','name','unshift','waitForTheAssignedAgent','queueId','FaxQueue','queue','waitForTheAssignedQueue','Start','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','where','limit','include','map','attributes','model','info','NotifyFaxAccount','body','fax','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty'];(function(_0x923e53,_0x2cc867){var _0x4d0120=function(_0x5995e1){while(--_0x5995e1){_0x923e53['push'](_0x923e53['shift']());}};_0x4d0120(++_0x2cc867);}(_0x1788,0xde));var _0x8178=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x1788[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0x8178('0x0'));var util=require('util');var moment=require(_0x8178('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8178('0x2'));var db=require(_0x8178('0x3'))['db'];var utils=require(_0x8178('0x4'));var logger=require(_0x8178('0x5'))(_0x8178('0x6'));var config=require(_0x8178('0x7'));var jayson=require(_0x8178('0x8'));var client=jayson[_0x8178('0x9')]['http']({'port':0x232c});config[_0x8178('0xa')]=_[_0x8178('0xb')](config['redis'],{'host':_0x8178('0xc'),'port':0x18eb});var socket=require(_0x8178('0xd'))(new Redis(config[_0x8178('0xa')]));require(_0x8178('0xe'))[_0x8178('0xf')](socket);function respondWithRpcPromise(_0x11fbcb,_0x2e3a15,_0x2de69a){return new BPromise(function(_0x14de83,_0x8fd9c6){return client[_0x8178('0x10')](_0x11fbcb,_0x2de69a)[_0x8178('0x11')](function(_0x5fa9c6){logger['info'](_0x8178('0x12'),_0x2e3a15,_0x8178('0x13'));logger[_0x8178('0x14')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2e3a15,_0x8178('0x13'),JSON[_0x8178('0x15')](_0x5fa9c6));if(_0x5fa9c6['error']){if(_0x5fa9c6[_0x8178('0x16')][_0x8178('0x17')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x2e3a15,_0x5fa9c6[_0x8178('0x16')]['message']);return _0x8fd9c6(_0x5fa9c6[_0x8178('0x16')]['message']);}logger[_0x8178('0x16')](_0x8178('0x12'),_0x2e3a15,_0x5fa9c6[_0x8178('0x16')][_0x8178('0x18')]);return _0x14de83(_0x5fa9c6[_0x8178('0x16')]['message']);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x2e3a15,_0x8178('0x13'));_0x14de83(_0x5fa9c6[_0x8178('0x19')]['message']);}})[_0x8178('0x1a')](function(_0x51ff9a){logger[_0x8178('0x16')](_0x8178('0x12'),_0x2e3a15,_0x51ff9a);_0x8fd9c6(_0x51ff9a);});});}exports[_0x8178('0x1b')]=function(_0x134719){var _0x463192=this;return new Promise(function(_0x396f96,_0xf148e9){return db[_0x8178('0x1c')][_0x8178('0x1d')]({'raw':_0x134719['options']?_0x134719[_0x8178('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x134719[_0x8178('0x1e')]?_0x134719[_0x8178('0x1e')][_0x8178('0x1f')]||null:null,'attributes':_0x134719[_0x8178('0x1e')]?_0x134719[_0x8178('0x1e')]['attributes']||null:null,'limit':_0x134719['options']?_0x134719[_0x8178('0x1e')][_0x8178('0x20')]||null:null,'include':_0x134719[_0x8178('0x1e')]?_0x134719[_0x8178('0x1e')][_0x8178('0x21')]?_[_0x8178('0x22')](_0x134719[_0x8178('0x1e')][_0x8178('0x21')],function(_0xe60c63){return{'model':db[_0xe60c63['model']],'as':_0xe60c63['as'],'attributes':_0xe60c63[_0x8178('0x23')],'include':_0xe60c63['include']?_[_0x8178('0x22')](_0xe60c63[_0x8178('0x21')],function(_0x251ebc){return{'model':db[_0x251ebc[_0x8178('0x24')]],'as':_0x251ebc['as'],'attributes':_0x251ebc[_0x8178('0x23')],'include':_0x251ebc[_0x8178('0x21')]?_[_0x8178('0x22')](_0x251ebc[_0x8178('0x21')],function(_0x394440){return{'model':db[_0x394440[_0x8178('0x24')]],'as':_0x394440['as'],'attributes':_0x394440['attributes']};}):[]};}):[]};}):[]:[]})[_0x8178('0x11')](function(_0x2e6fb5){logger[_0x8178('0x25')](_0x8178('0x1b'),_0x134719);logger[_0x8178('0x14')](_0x8178('0x1b'),_0x134719,JSON[_0x8178('0x15')](_0x2e6fb5));_0x396f96(_0x2e6fb5);})['catch'](function(_0x2fff1e){logger[_0x8178('0x16')]('GetFaxAccount',_0x2fff1e['message'],_0x134719);_0xf148e9(_0x463192[_0x8178('0x16')](0x1f4,_0x2fff1e[_0x8178('0x18')]));});});};exports[_0x8178('0x26')]=function(_0xcfc17a,_0x4832a2,_0x40d728){var _0x4c1f88=this;return new Promise(function(_0x4548f8,_0x69d4ad){var _0x1e1213={'body':_0xcfc17a[_0x8178('0x27')],'channel':_0x8178('0x28')};var _0x5475a8=[];var _0x33bd9c=[];var _0x10082e={};return db[_0x8178('0x29')]['describe']()[_0x8178('0x11')](function(_0x39ee5a){if(!_0x39ee5a){throw new db[(_0x8178('0x2a'))][(_0x8178('0x2b'))](_0x8178('0x2c'));}_0x5475a8=_[_0x8178('0x2d')](_[_0x8178('0x2e')](_0x39ee5a),[_0x8178('0x2f'),'updatedAt']);_0x33bd9c=_[_0x8178('0x2d')](_[_0x8178('0x2e')](_0x39ee5a),[_0x8178('0x2f'),_0x8178('0x30'),'CompanyId',_0x8178('0x31')]);if(_0xcfc17a[_0x8178('0x27')]['id']){delete _0xcfc17a[_0x8178('0x27')]['id'];}if(_[_0x8178('0x32')](_0xcfc17a['body'][_0x8178('0x33')])){throw new db[(_0x8178('0x2a'))][(_0x8178('0x2b'))](_0x8178('0x34'));}if(_['isNil'](_0xcfc17a[_0x8178('0x27')]['body'])||_0xcfc17a[_0x8178('0x27')][_0x8178('0x27')]===''){throw new db[(_0x8178('0x2a'))][(_0x8178('0x2b'))](_0x8178('0x35'));}if(_['isNil'](_0xcfc17a[_0x8178('0x27')][_0x8178('0x36')])){throw new db[(_0x8178('0x2a'))][(_0x8178('0x2b'))](_0x8178('0x37')+_0x33bd9c);}if(!_['includes'](_0x33bd9c,_0xcfc17a[_0x8178('0x27')][_0x8178('0x36')])){throw new db[(_0x8178('0x2a'))][(_0x8178('0x2b'))](_0x8178('0x38')+_0x33bd9c);}_0x10082e[_0xcfc17a[_0x8178('0x27')][_0x8178('0x36')]]=_0xcfc17a['body'][_0x8178('0x33')];})['then'](function(){return db[_0x8178('0x1c')][_0x8178('0x39')]({'where':{'id':_0xcfc17a['account']['id']},'include':[{'model':db[_0x8178('0x3a')],'as':'List','include':[{'model':db[_0x8178('0x29')],'as':_0x8178('0x3b'),'where':_0x10082e,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x8178('0x3c')],'as':_0x8178('0x3d')}]});})[_0x8178('0x11')](function(_0x4c97e9){if(_0x4c97e9&&_0x4c97e9[_0x8178('0x3e')]){var _0x4ac60e=_0x4c97e9[_0x8178('0x3f')]({'plain':!![]});_0x1e1213['account']=_0x4ac60e;_0x1e1213[_0x8178('0x40')]=_0x4ac60e['Applications'];_0x1e1213['list']=_0x4ac60e['List'];_0x1e1213[_0x8178('0x40')]=_[_0x8178('0x41')](_0x1e1213[_0x8178('0x40')],[_0x8178('0x42')],[_0x8178('0x43')]);if(_0x1e1213[_0x8178('0x44')][_0x8178('0x3d')]){delete _0x1e1213[_0x8178('0x44')]['Applications'];}if(_0x1e1213['account'][_0x8178('0x3e')]&&_0x1e1213[_0x8178('0x44')][_0x8178('0x3e')]['Contacts'][_0x8178('0x45')]){return _0x1e1213['account'][_0x8178('0x3e')][_0x8178('0x3b')][0x0];}var _0x3ebc38=_['defaults'](_0xcfc17a['body'],{'firstName':_0xcfc17a['body']['from'],'ListId':_0x4ac60e[_0x8178('0x31')]});_0x3ebc38[_0xcfc17a[_0x8178('0x27')][_0x8178('0x36')]]=_0xcfc17a[_0x8178('0x27')]['from'];return db[_0x8178('0x29')][_0x8178('0x46')](_0x3ebc38,{'fields':_0x5475a8,'raw':!![]});}})['then'](function(_0x531b51){_0x1e1213[_0x8178('0x47')]=_0x531b51;if(_0x531b51){var _0xa8f411={'ContactId':_0x531b51['id'],'FaxAccountId':_0xcfc17a[_0x8178('0x44')]['id'],'fax':_0x531b51['fax']};return db['FaxInteraction'][_0x8178('0x39')]({'where':{'ContactId':_0x531b51['id'],'closed':![],'FaxAccountId':_0xcfc17a[_0x8178('0x44')]['id']}})[_0x8178('0x11')](function(_0x4ead39){if(_0x4ead39){return[_0x4ead39,![]];}return db[_0x8178('0x48')][_0x8178('0x46')](_0xa8f411)[_0x8178('0x11')](function(_0xa2573e){return[_0xa2573e,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x8178('0x49')](function(_0x5ac3a6,_0x1aaec3){var _0x2db81f=_0x5ac3a6[_0x8178('0x3f')]({'plain':!![]});if(_0x1aaec3){if(_0x1e1213[_0x8178('0x44')][_0x8178('0x4a')]){_0x1e1213[_0x8178('0x40')][_0x8178('0x4b')]({'id':0x0,'priority':_0x1e1213[_0x8178('0x40')][_0x8178('0x45')]+0x1,'app':_0x8178('0x4c'),'appdata':_0x8178('0x4d'),'interval':_0x8178('0x4e')});}_0x2db81f[_0x8178('0x4f')]=!![];}else{_0x2db81f[_0x8178('0x4f')]=![];}_0x1e1213[_0x8178('0x50')]=_0x2db81f;return db['FaxMessage'][_0x8178('0x46')]({'body':_0xcfc17a[_0x8178('0x27')]['body'],'FaxAccountId':_0xcfc17a['account']['id'],'FaxInteractionId':_0x5ac3a6['id'],'direction':'in','ContactId':_0x5ac3a6[_0x8178('0x51')],'AttachmentId':_0xcfc17a['body'][_0x8178('0x52')]});})[_0x8178('0x11')](function(_0x4ea6a6){_0x1e1213[_0x8178('0x18')]=_0x4ea6a6;if(!_0x1e1213[_0x8178('0x50')][_0x8178('0x53')])return;return db['User']['find']({'attributes':['id',_0x8178('0x54')],'where':{'id':_0x1e1213[_0x8178('0x50')][_0x8178('0x53')]}});})['then'](function(_0x888698){if(_0x888698){_0x1e1213['applications'][_0x8178('0x55')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x888698[_0x8178('0x54')]+','+(_0x1e1213[_0x8178('0x44')][_0x8178('0x56')]||0xa),'interval':_0x8178('0x4e')});}if(!_0x1e1213[_0x8178('0x50')][_0x8178('0x57')])return;return db[_0x8178('0x58')][_0x8178('0x39')]({'attributes':['id',_0x8178('0x54')],'where':{'id':_0x1e1213[_0x8178('0x50')][_0x8178('0x57')]}});})['then'](function(_0x34630e){if(_0x34630e){_0x1e1213[_0x8178('0x40')][_0x8178('0x55')]({'id':0x0,'priority':0x1,'app':_0x8178('0x59'),'appdata':_0x34630e['name']+','+(_0x1e1213[_0x8178('0x44')][_0x8178('0x5a')]||0x12c),'interval':_0x8178('0x4e')});}return respondWithRpcPromise(_0x8178('0x5b'),'startRouting',_0x1e1213);})[_0x8178('0x11')](function(_0x5eb61b){_0x4548f8(_0x5eb61b);})[_0x8178('0x1a')](function(_0x2d82f7){_0x69d4ad(_0x4c1f88[_0x8178('0x16')](0x1f4,_0x2d82f7[_0x8178('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 91c5612..9d4a078 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 _0x81b5=['register','length','save','remove','removeListener'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x81b5,0x7f));var _0x581b=function(_0x242120,_0x47c892){_0x242120=_0x242120-0x0;var _0x279d91=_0x81b5[_0x242120];return _0x279d91;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x581b('0x0'),_0x581b('0x1'),'update'];function createListener(_0x46049f,_0x48dcac){return function(_0x56c28d){_0x48dcac['emit'](_0x46049f,_0x56c28d);};}function removeListener(_0x1e9054,_0x5d8a0d){return function(){FaxAccountEvents[_0x581b('0x2')](_0x1e9054,_0x5d8a0d);};}exports[_0x581b('0x3')]=function(_0x42cf37){for(var _0x1e6415=0x0,_0x30a289=events[_0x581b('0x4')];_0x1e6415<_0x30a289;_0x1e6415++){var _0x3b6ecf=events[_0x1e6415];var _0x38de8d=createListener('faxAccount:'+_0x3b6ecf,_0x42cf37);FaxAccountEvents['on'](_0x3b6ecf,_0x38de8d);}}; \ No newline at end of file +var _0xccf6=['removeListener','length','faxAccount:','./faxAccount.events','save','remove','update','emit'];(function(_0x5c847e,_0x3fa827){var _0x17988b=function(_0x5224ff){while(--_0x5224ff){_0x5c847e['push'](_0x5c847e['shift']());}};_0x17988b(++_0x3fa827);}(_0xccf6,0xab));var _0x6ccf=function(_0xa388a2,_0x40bde6){_0xa388a2=_0xa388a2-0x0;var _0x7ce7f6=_0xccf6[_0xa388a2];return _0x7ce7f6;};'use strict';var FaxAccountEvents=require(_0x6ccf('0x0'));var events=[_0x6ccf('0x1'),_0x6ccf('0x2'),_0x6ccf('0x3')];function createListener(_0x569211,_0x48eaf0){return function(_0x420d7f){_0x48eaf0[_0x6ccf('0x4')](_0x569211,_0x420d7f);};}function removeListener(_0x1b33e3,_0x3b1894){return function(){FaxAccountEvents[_0x6ccf('0x5')](_0x1b33e3,_0x3b1894);};}exports['register']=function(_0x3541e7){for(var _0x63c0a3=0x0,_0x28567c=events[_0x6ccf('0x6')];_0x63c0a3<_0x28567c;_0x63c0a3++){var _0x2903a8=events[_0x63c0a3];var _0x3b4299=createListener(_0x6ccf('0x7')+_0x2903a8,_0x3541e7);FaxAccountEvents['on'](_0x2903a8,_0x3b4299);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index ebd8e0e..cff5b05 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 _0xf1d6=['/:id','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','get','index','isAuthenticated','describe','/:id/dispositions','getAnswers','/:id/interactions','getInteractions','/:id/messages','getMessages','/:id/users','getAgents','post','/:id/canned_answers','addInteraction','addApplications','addAccountApplications','/:id/send','send','addAgents','put'];(function(_0x3c1287,_0x47b176){var _0x50f682=function(_0x225ab7){while(--_0x225ab7){_0x3c1287['push'](_0x3c1287['shift']());}};_0x50f682(++_0x47b176);}(_0xf1d6,0x12c));var _0x6f1d=function(_0x3fdcee,_0x17dbfe){_0x3fdcee=_0x3fdcee-0x0;var _0x4a5788=_0xf1d6[_0x3fdcee];return _0x4a5788;};'use strict';var multer=require(_0x6f1d('0x0'));var util=require(_0x6f1d('0x1'));var path=require(_0x6f1d('0x2'));var timeout=require(_0x6f1d('0x3'));var express=require(_0x6f1d('0x4'));var router=express['Router']();var fs_extra=require(_0x6f1d('0x5'));var auth=require(_0x6f1d('0x6'));var interaction=require(_0x6f1d('0x7'));var config=require('../../config/environment');var controller=require(_0x6f1d('0x8'));router[_0x6f1d('0x9')]('/',auth['isAuthenticated'](),controller[_0x6f1d('0xa')]);router[_0x6f1d('0x9')]('/describe',auth[_0x6f1d('0xb')](),controller[_0x6f1d('0xc')]);router['get']('/:id',auth[_0x6f1d('0xb')](),controller['show']);router['get'](_0x6f1d('0xd'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x6f1d('0x9')]('/:id/canned_answers',auth[_0x6f1d('0xb')](),controller[_0x6f1d('0xe')]);router[_0x6f1d('0x9')](_0x6f1d('0xf'),auth['isAuthenticated'](),controller[_0x6f1d('0x10')]);router[_0x6f1d('0x9')]('/:id/applications',auth[_0x6f1d('0xb')](),controller['getApplications']);router[_0x6f1d('0x9')](_0x6f1d('0x11'),auth[_0x6f1d('0xb')](),controller[_0x6f1d('0x12')]);router[_0x6f1d('0x9')](_0x6f1d('0x13'),auth[_0x6f1d('0xb')](),controller[_0x6f1d('0x14')]);router[_0x6f1d('0x15')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/dispositions',auth[_0x6f1d('0xb')](),controller['addDisposition']);router['post'](_0x6f1d('0x16'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0x6f1d('0xf'),auth[_0x6f1d('0xb')](),controller[_0x6f1d('0x17')]);router['post']('/:id/applications',auth[_0x6f1d('0xb')](),controller[_0x6f1d('0x18')]);router[_0x6f1d('0x15')]('/addaccountapplications',auth[_0x6f1d('0xb')](),controller[_0x6f1d('0x19')]);router[_0x6f1d('0x15')]('/updateaccountapplications',auth[_0x6f1d('0xb')](),controller['updateAccountApplications']);router[_0x6f1d('0x15')](_0x6f1d('0x1a'),auth[_0x6f1d('0xb')](),controller[_0x6f1d('0x1b')]);router[_0x6f1d('0x15')](_0x6f1d('0x13'),auth[_0x6f1d('0xb')](),controller[_0x6f1d('0x1c')]);router[_0x6f1d('0x1d')]('/:id',auth[_0x6f1d('0xb')](),controller['update']);router['delete'](_0x6f1d('0x1e'),auth[_0x6f1d('0xb')](),controller['destroy']);router[_0x6f1d('0x1f')](_0x6f1d('0xd'),auth[_0x6f1d('0xb')](),controller['removeDispositions']);router['delete'](_0x6f1d('0x16'),auth[_0x6f1d('0xb')](),controller['removeAnswers']);router[_0x6f1d('0x1f')](_0x6f1d('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x6f1d('0x20')]=router; \ No newline at end of file +var _0x72d7=['getAgents','post','create','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/:id/send','send','/:id/users','addAgents','put','update','delete','destroy','/:id/dispositions','removeDispositions','/:id/canned_answers','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/interactions','getInteractions','/:id/applications','getMessages'];(function(_0x24371e,_0x43c47b){var _0x581a8e=function(_0x488019){while(--_0x488019){_0x24371e['push'](_0x24371e['shift']());}};_0x581a8e(++_0x43c47b);}(_0x72d7,0x81));var _0x772d=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x72d7[_0x3c2a69];return _0x596bc8;};'use strict';var multer=require(_0x772d('0x0'));var util=require('util');var path=require(_0x772d('0x1'));var timeout=require(_0x772d('0x2'));var express=require(_0x772d('0x3'));var router=express[_0x772d('0x4')]();var fs_extra=require(_0x772d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x772d('0x6'));var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0x772d('0x7')]('/',auth[_0x772d('0x8')](),controller['index']);router[_0x772d('0x7')]('/describe',auth[_0x772d('0x8')](),controller['describe']);router[_0x772d('0x7')](_0x772d('0x9'),auth['isAuthenticated'](),controller[_0x772d('0xa')]);router[_0x772d('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0x772d('0x7')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x772d('0xb'),auth[_0x772d('0x8')](),controller[_0x772d('0xc')]);router[_0x772d('0x7')](_0x772d('0xd'),auth[_0x772d('0x8')](),controller['getApplications']);router[_0x772d('0x7')]('/:id/messages',auth[_0x772d('0x8')](),controller[_0x772d('0xe')]);router[_0x772d('0x7')]('/:id/users',auth[_0x772d('0x8')](),controller[_0x772d('0xf')]);router[_0x772d('0x10')]('/',auth['isAuthenticated'](),controller[_0x772d('0x11')]);router['post']('/:id/dispositions',auth[_0x772d('0x8')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0x772d('0x8')](),controller[_0x772d('0x12')]);router[_0x772d('0x10')](_0x772d('0xb'),auth[_0x772d('0x8')](),controller[_0x772d('0x13')]);router[_0x772d('0x10')]('/:id/applications',auth[_0x772d('0x8')](),controller[_0x772d('0x14')]);router[_0x772d('0x10')](_0x772d('0x15'),auth['isAuthenticated'](),controller[_0x772d('0x16')]);router[_0x772d('0x10')]('/updateaccountapplications',auth[_0x772d('0x8')](),controller['updateAccountApplications']);router[_0x772d('0x10')](_0x772d('0x17'),auth[_0x772d('0x8')](),controller[_0x772d('0x18')]);router[_0x772d('0x10')](_0x772d('0x19'),auth[_0x772d('0x8')](),controller[_0x772d('0x1a')]);router[_0x772d('0x1b')](_0x772d('0x9'),auth[_0x772d('0x8')](),controller[_0x772d('0x1c')]);router[_0x772d('0x1d')](_0x772d('0x9'),auth[_0x772d('0x8')](),controller[_0x772d('0x1e')]);router[_0x772d('0x1d')](_0x772d('0x1f'),auth[_0x772d('0x8')](),controller[_0x772d('0x20')]);router[_0x772d('0x1d')](_0x772d('0x21'),auth[_0x772d('0x8')](),controller['removeAnswers']);router[_0x772d('0x1d')]('/:id/users',auth[_0x772d('0x8')](),controller[_0x772d('0x22')]);module[_0x772d('0x23')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 5b23e23..197b72f 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 _0x2050=['TEXT','sequelize','exports','STRING','noop'];(function(_0x303064,_0x12f0c2){var _0x5a1d3d=function(_0x5b9d81){while(--_0x5b9d81){_0x303064['push'](_0x303064['shift']());}};_0x5a1d3d(++_0x12f0c2);}(_0x2050,0x1c8));var _0x0205=function(_0x5afcca,_0x533f8d){_0x5afcca=_0x5afcca-0x0;var _0x134e8a=_0x2050[_0x5afcca];return _0x134e8a;};'use strict';var Sequelize=require(_0x0205('0x0'));module[_0x0205('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0205('0x2')],'allowNull':![],'defaultValue':_0x0205('0x3')},'appdata':{'type':Sequelize[_0x0205('0x4')]()},'description':{'type':Sequelize[_0x0205('0x2')]},'interval':{'type':Sequelize[_0x0205('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x83d6=['INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x3b7ace,_0x4a4abb){var _0x45b29c=function(_0x5b003b){while(--_0x5b003b){_0x3b7ace['push'](_0x3b7ace['shift']());}};_0x45b29c(++_0x4a4abb);}(_0x83d6,0xe9));var _0x683d=function(_0x17f0fb,_0x320fef){_0x17f0fb=_0x17f0fb-0x0;var _0x24f2c8=_0x83d6[_0x17f0fb];return _0x24f2c8;};'use strict';var Sequelize=require(_0x683d('0x0'));module['exports']={'priority':{'type':Sequelize[_0x683d('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x683d('0x2')},'appdata':{'type':Sequelize[_0x683d('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x683d('0x4')],'defaultValue':_0x683d('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 40c0298..c1dbb1c 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 _0x5506=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','Content-Range','json','apply','reject','save','update','then','error','stack','name','index','map','FaxApplication','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','findAll','show','rawAttributes','length','include','options','find','catch','body','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x5506,0x123));var _0x6550=function(_0x296d67,_0x2245c3){_0x296d67=_0x296d67-0x0;var _0x9a898f=_0x5506[_0x296d67];return _0x9a898f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6550('0x0'));var zipdir=require(_0x6550('0x1'));var jsonpatch=require(_0x6550('0x2'));var rp=require(_0x6550('0x3'));var moment=require('moment');var BPromise=require(_0x6550('0x4'));var Mustache=require(_0x6550('0x5'));var util=require(_0x6550('0x6'));var path=require(_0x6550('0x7'));var sox=require(_0x6550('0x8'));var csv=require('to-csv');var ejs=require(_0x6550('0x9'));var fs=require('fs');var fs_extra=require(_0x6550('0xa'));var _=require(_0x6550('0xb'));var squel=require(_0x6550('0xc'));var crypto=require('crypto');var jsforce=require(_0x6550('0xd'));var deskjs=require(_0x6550('0xe'));var toCsv=require(_0x6550('0xf'));var querystring=require(_0x6550('0x10'));var Papa=require(_0x6550('0x11'));var Redis=require(_0x6550('0x12'));var authService=require(_0x6550('0x13'));var qs=require(_0x6550('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6550('0x15'))(_0x6550('0x16'));var utils=require(_0x6550('0x17'));var config=require(_0x6550('0x18'));var licenseUtil=require(_0x6550('0x19'));var db=require(_0x6550('0x1a'))['db'];function respondWithStatusCode(_0x361c80,_0x2b29a2){_0x2b29a2=_0x2b29a2||0xcc;return function(_0x153c24){if(_0x153c24){return _0x361c80[_0x6550('0x1b')](_0x2b29a2);}return _0x361c80['status'](_0x2b29a2)[_0x6550('0x1c')]();};}function respondWithResult(_0x39a3ed,_0x27fa7d){_0x27fa7d=_0x27fa7d||0xc8;return function(_0x3ce2a5){if(_0x3ce2a5){return _0x39a3ed['status'](_0x27fa7d)['json'](_0x3ce2a5);}};}function respondWithFilteredResult(_0x58b4a6,_0x2cb598){return function(_0x234b72){if(_0x234b72){var _0x17b38d=typeof _0x2cb598[_0x6550('0x1d')]===_0x6550('0x1e')&&typeof _0x2cb598[_0x6550('0x1f')]===_0x6550('0x1e');var _0x5134cb=_0x234b72[_0x6550('0x20')];var _0x470811=_0x17b38d?0x0:_0x2cb598[_0x6550('0x1d')];var _0x63c9e7=_0x17b38d?_0x234b72[_0x6550('0x20')]:_0x2cb598[_0x6550('0x1d')]+_0x2cb598[_0x6550('0x1f')];var _0x3e91ce;if(_0x63c9e7>=_0x5134cb){_0x63c9e7=_0x5134cb;_0x3e91ce=0xc8;}else{_0x3e91ce=0xce;}_0x58b4a6[_0x6550('0x21')](_0x3e91ce);return _0x58b4a6['set'](_0x6550('0x22'),_0x470811+'-'+_0x63c9e7+'/'+_0x5134cb)[_0x6550('0x23')](_0x234b72);}return null;};}function patchUpdates(_0x359f12){return function(_0x5039cd){try{jsonpatch[_0x6550('0x24')](_0x5039cd,_0x359f12,!![]);}catch(_0x1255b1){return BPromise[_0x6550('0x25')](_0x1255b1);}return _0x5039cd[_0x6550('0x26')]();};}function saveUpdates(_0x30139c,_0x4eb662){return function(_0x5d3509){if(_0x5d3509){return _0x5d3509[_0x6550('0x27')](_0x30139c)[_0x6550('0x28')](function(_0x5d68e3){return _0x5d68e3;});}return null;};}function removeEntity(_0x124a8d,_0x4450e5){return function(_0x226ec8){if(_0x226ec8){return _0x226ec8['destroy']()[_0x6550('0x28')](function(){_0x124a8d[_0x6550('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52ffef,_0x324c22){return function(_0x302b38){if(!_0x302b38){_0x52ffef['sendStatus'](0x194);}return _0x302b38;};}function handleError(_0x3a25a8,_0x13f4ca){_0x13f4ca=_0x13f4ca||0x1f4;return function(_0xf612ef){logger[_0x6550('0x29')](_0xf612ef[_0x6550('0x2a')]);if(_0xf612ef[_0x6550('0x2b')]){delete _0xf612ef[_0x6550('0x2b')];}_0x3a25a8[_0x6550('0x21')](_0x13f4ca)['send'](_0xf612ef);};}exports[_0x6550('0x2c')]=function(_0xb43b82,_0x275962){var _0x4d213e={},_0x1c9f6d={},_0x33c134={'count':0x0,'rows':[]};var _0x2ef8ff=_[_0x6550('0x2d')](db[_0x6550('0x2e')]['rawAttributes'],function(_0x4ffa93){return{'name':_0x4ffa93[_0x6550('0x2f')],'type':_0x4ffa93[_0x6550('0x30')][_0x6550('0x31')]};});_0x1c9f6d[_0x6550('0x32')]=_['map'](_0x2ef8ff,_0x6550('0x2b'));_0x1c9f6d[_0x6550('0x33')]=_[_0x6550('0x34')](_0xb43b82[_0x6550('0x33')]);_0x1c9f6d[_0x6550('0x35')]=_[_0x6550('0x36')](_0x1c9f6d[_0x6550('0x32')],_0x1c9f6d['query']);_0x4d213e['attributes']=_['intersection'](_0x1c9f6d['model'],qs[_0x6550('0x37')](_0xb43b82[_0x6550('0x33')][_0x6550('0x37')]));_0x4d213e[_0x6550('0x38')]=_0x4d213e[_0x6550('0x38')]['length']?_0x4d213e[_0x6550('0x38')]:_0x1c9f6d[_0x6550('0x32')];if(!_0xb43b82[_0x6550('0x33')][_0x6550('0x39')](_0x6550('0x3a'))){_0x4d213e[_0x6550('0x1f')]=qs[_0x6550('0x1f')](_0xb43b82[_0x6550('0x33')]['limit']);_0x4d213e[_0x6550('0x1d')]=qs['offset'](_0xb43b82['query'][_0x6550('0x1d')]);}_0x4d213e[_0x6550('0x3b')]=qs[_0x6550('0x3c')](_0xb43b82['query'][_0x6550('0x3c')]);_0x4d213e[_0x6550('0x3d')]=qs[_0x6550('0x35')](_[_0x6550('0x3e')](_0xb43b82['query'],_0x1c9f6d[_0x6550('0x35')]),_0x2ef8ff);if(_0xb43b82[_0x6550('0x33')][_0x6550('0x3f')]){_0x4d213e['where']=_[_0x6550('0x40')](_0x4d213e[_0x6550('0x3d')],{'$or':_[_0x6550('0x2d')](_0x2ef8ff,function(_0x23d31a){if(_0x23d31a[_0x6550('0x30')]!=='VIRTUAL'){var _0x2d572a={};_0x2d572a[_0x23d31a['name']]={'$like':'%'+_0xb43b82[_0x6550('0x33')]['filter']+'%'};return _0x2d572a;}})});}_0x4d213e=_['merge']({},_0x4d213e,_0xb43b82['options']);var _0x3ce518={'where':_0x4d213e[_0x6550('0x3d')]};return db[_0x6550('0x2e')][_0x6550('0x20')](_0x3ce518)[_0x6550('0x28')](function(_0x1482a8){_0x33c134[_0x6550('0x20')]=_0x1482a8;if(_0xb43b82[_0x6550('0x33')]['includeAll']){_0x4d213e['include']=[{'all':!![]}];}return db[_0x6550('0x2e')][_0x6550('0x41')](_0x4d213e);})['then'](function(_0x192936){_0x33c134['rows']=_0x192936;return _0x33c134;})[_0x6550('0x28')](respondWithFilteredResult(_0x275962,_0x4d213e))['catch'](handleError(_0x275962,null));};exports[_0x6550('0x42')]=function(_0x54092d,_0x1db065){var _0x2ec811={'raw':!![],'where':{'id':_0x54092d['params']['id']}},_0x3cb61a={};_0x3cb61a[_0x6550('0x32')]=_[_0x6550('0x34')](db[_0x6550('0x2e')][_0x6550('0x43')]);_0x3cb61a[_0x6550('0x33')]=_[_0x6550('0x34')](_0x54092d[_0x6550('0x33')]);_0x3cb61a[_0x6550('0x35')]=_['intersection'](_0x3cb61a[_0x6550('0x32')],_0x3cb61a[_0x6550('0x33')]);_0x2ec811[_0x6550('0x38')]=_['intersection'](_0x3cb61a[_0x6550('0x32')],qs[_0x6550('0x37')](_0x54092d['query'][_0x6550('0x37')]));_0x2ec811[_0x6550('0x38')]=_0x2ec811[_0x6550('0x38')][_0x6550('0x44')]?_0x2ec811['attributes']:_0x3cb61a[_0x6550('0x32')];if(_0x54092d[_0x6550('0x33')]['includeAll']){_0x2ec811[_0x6550('0x45')]=[{'all':!![]}];}_0x2ec811=_[_0x6550('0x40')]({},_0x2ec811,_0x54092d[_0x6550('0x46')]);return db[_0x6550('0x2e')][_0x6550('0x47')](_0x2ec811)[_0x6550('0x28')](handleEntityNotFound(_0x1db065,null))['then'](respondWithResult(_0x1db065,null))[_0x6550('0x48')](handleError(_0x1db065,null));};exports['create']=function(_0x21581b,_0x27e64a){return db[_0x6550('0x2e')]['create'](_0x21581b[_0x6550('0x49')],{})['then'](respondWithResult(_0x27e64a,0xc9))[_0x6550('0x48')](handleError(_0x27e64a,null));};exports[_0x6550('0x27')]=function(_0x528daf,_0x1bf866){if(_0x528daf[_0x6550('0x49')]['id']){delete _0x528daf['body']['id'];}return db[_0x6550('0x2e')][_0x6550('0x47')]({'where':{'id':_0x528daf[_0x6550('0x4a')]['id']}})[_0x6550('0x28')](handleEntityNotFound(_0x1bf866,null))[_0x6550('0x28')](saveUpdates(_0x528daf[_0x6550('0x49')],null))[_0x6550('0x28')](respondWithResult(_0x1bf866,null))[_0x6550('0x48')](handleError(_0x1bf866,null));};exports[_0x6550('0x4b')]=function(_0x131fbc,_0x13fffe){return db[_0x6550('0x2e')][_0x6550('0x47')]({'where':{'id':_0x131fbc[_0x6550('0x4a')]['id']}})[_0x6550('0x28')](handleEntityNotFound(_0x13fffe,null))['then'](removeEntity(_0x13fffe,null))[_0x6550('0x48')](handleError(_0x13fffe,null));}; \ No newline at end of file +var _0x4b50=['error','stack','name','send','FaxApplication','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','filters','include','find','create','body','destroy','eml-format','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','reject','save','update','then'];(function(_0xd8e357,_0x5ca985){var _0x1148c4=function(_0x133ebb){while(--_0x133ebb){_0xd8e357['push'](_0xd8e357['shift']());}};_0x1148c4(++_0x5ca985);}(_0x4b50,0xaf));var _0x04b5=function(_0x2d61ac,_0x18ff36){_0x2d61ac=_0x2d61ac-0x0;var _0x3f7d3c=_0x4b50[_0x2d61ac];return _0x3f7d3c;};'use strict';var emlformat=require(_0x04b5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x04b5('0x1'));var moment=require(_0x04b5('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x04b5('0x3'));var util=require(_0x04b5('0x4'));var path=require(_0x04b5('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x04b5('0x6'));var fs=require('fs');var fs_extra=require(_0x04b5('0x7'));var _=require(_0x04b5('0x8'));var squel=require(_0x04b5('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x04b5('0xa'));var querystring=require('querystring');var Papa=require(_0x04b5('0xb'));var Redis=require('ioredis');var authService=require(_0x04b5('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x04b5('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x04b5('0xe'));var utils=require(_0x04b5('0xf'));var config=require(_0x04b5('0x10'));var licenseUtil=require(_0x04b5('0x11'));var db=require(_0x04b5('0x12'))['db'];function respondWithStatusCode(_0x473f64,_0x3d1ad5){_0x3d1ad5=_0x3d1ad5||0xcc;return function(_0x302267){if(_0x302267){return _0x473f64[_0x04b5('0x13')](_0x3d1ad5);}return _0x473f64[_0x04b5('0x14')](_0x3d1ad5)[_0x04b5('0x15')]();};}function respondWithResult(_0x5e3614,_0x20889f){_0x20889f=_0x20889f||0xc8;return function(_0x2dd0c1){if(_0x2dd0c1){return _0x5e3614[_0x04b5('0x14')](_0x20889f)[_0x04b5('0x16')](_0x2dd0c1);}};}function respondWithFilteredResult(_0x38e66f,_0x4f0cb0){return function(_0x5723f2){if(_0x5723f2){var _0x1aed30=typeof _0x4f0cb0['offset']===_0x04b5('0x17')&&typeof _0x4f0cb0[_0x04b5('0x18')]===_0x04b5('0x17');var _0x1ba37b=_0x5723f2[_0x04b5('0x19')];var _0x1533e6=_0x1aed30?0x0:_0x4f0cb0['offset'];var _0x377a92=_0x1aed30?_0x5723f2['count']:_0x4f0cb0['offset']+_0x4f0cb0[_0x04b5('0x18')];var _0x463e6c;if(_0x377a92>=_0x1ba37b){_0x377a92=_0x1ba37b;_0x463e6c=0xc8;}else{_0x463e6c=0xce;}_0x38e66f['status'](_0x463e6c);return _0x38e66f[_0x04b5('0x1a')](_0x04b5('0x1b'),_0x1533e6+'-'+_0x377a92+'/'+_0x1ba37b)['json'](_0x5723f2);}return null;};}function patchUpdates(_0x3583c9){return function(_0x32cde6){try{jsonpatch['apply'](_0x32cde6,_0x3583c9,!![]);}catch(_0x2983a3){return BPromise[_0x04b5('0x1c')](_0x2983a3);}return _0x32cde6[_0x04b5('0x1d')]();};}function saveUpdates(_0x541a8c,_0x11d1a5){return function(_0x4dfbc0){if(_0x4dfbc0){return _0x4dfbc0[_0x04b5('0x1e')](_0x541a8c)[_0x04b5('0x1f')](function(_0x4ec056){return _0x4ec056;});}return null;};}function removeEntity(_0x589c98,_0x441888){return function(_0x3c4d11){if(_0x3c4d11){return _0x3c4d11['destroy']()['then'](function(){_0x589c98[_0x04b5('0x14')](0xcc)[_0x04b5('0x15')]();});}};}function handleEntityNotFound(_0x5d9df1,_0x4cdce3){return function(_0x49acc8){if(!_0x49acc8){_0x5d9df1[_0x04b5('0x13')](0x194);}return _0x49acc8;};}function handleError(_0x177017,_0xd7701b){_0xd7701b=_0xd7701b||0x1f4;return function(_0x40a3c4){logger[_0x04b5('0x20')](_0x40a3c4[_0x04b5('0x21')]);if(_0x40a3c4[_0x04b5('0x22')]){delete _0x40a3c4[_0x04b5('0x22')];}_0x177017['status'](_0xd7701b)[_0x04b5('0x23')](_0x40a3c4);};}exports['index']=function(_0x3ad63d,_0x1a787c){var _0x55b060={},_0x357c47={},_0x2de686={'count':0x0,'rows':[]};var _0x3782a9=_['map'](db[_0x04b5('0x24')][_0x04b5('0x25')],function(_0x4c39ec){return{'name':_0x4c39ec['fieldName'],'type':_0x4c39ec[_0x04b5('0x26')][_0x04b5('0x27')]};});_0x357c47[_0x04b5('0x28')]=_[_0x04b5('0x29')](_0x3782a9,_0x04b5('0x22'));_0x357c47[_0x04b5('0x2a')]=_[_0x04b5('0x2b')](_0x3ad63d[_0x04b5('0x2a')]);_0x357c47['filters']=_[_0x04b5('0x2c')](_0x357c47['model'],_0x357c47[_0x04b5('0x2a')]);_0x55b060[_0x04b5('0x2d')]=_[_0x04b5('0x2c')](_0x357c47[_0x04b5('0x28')],qs[_0x04b5('0x2e')](_0x3ad63d[_0x04b5('0x2a')][_0x04b5('0x2e')]));_0x55b060[_0x04b5('0x2d')]=_0x55b060[_0x04b5('0x2d')][_0x04b5('0x2f')]?_0x55b060[_0x04b5('0x2d')]:_0x357c47[_0x04b5('0x28')];if(!_0x3ad63d[_0x04b5('0x2a')][_0x04b5('0x30')](_0x04b5('0x31'))){_0x55b060[_0x04b5('0x18')]=qs[_0x04b5('0x18')](_0x3ad63d[_0x04b5('0x2a')][_0x04b5('0x18')]);_0x55b060[_0x04b5('0x32')]=qs[_0x04b5('0x32')](_0x3ad63d[_0x04b5('0x2a')][_0x04b5('0x32')]);}_0x55b060['order']=qs[_0x04b5('0x33')](_0x3ad63d[_0x04b5('0x2a')]['sort']);_0x55b060[_0x04b5('0x34')]=qs['filters'](_[_0x04b5('0x35')](_0x3ad63d[_0x04b5('0x2a')],_0x357c47['filters']),_0x3782a9);if(_0x3ad63d[_0x04b5('0x2a')][_0x04b5('0x36')]){_0x55b060[_0x04b5('0x34')]=_[_0x04b5('0x37')](_0x55b060[_0x04b5('0x34')],{'$or':_[_0x04b5('0x29')](_0x3782a9,function(_0x45deea){if(_0x45deea[_0x04b5('0x26')]!==_0x04b5('0x38')){var _0x17fc94={};_0x17fc94[_0x45deea[_0x04b5('0x22')]]={'$like':'%'+_0x3ad63d[_0x04b5('0x2a')][_0x04b5('0x36')]+'%'};return _0x17fc94;}})});}_0x55b060=_[_0x04b5('0x37')]({},_0x55b060,_0x3ad63d[_0x04b5('0x39')]);var _0x4d6fbf={'where':_0x55b060[_0x04b5('0x34')]};return db['FaxApplication']['count'](_0x4d6fbf)[_0x04b5('0x1f')](function(_0x7a89ea){_0x2de686['count']=_0x7a89ea;if(_0x3ad63d[_0x04b5('0x2a')][_0x04b5('0x3a')]){_0x55b060['include']=[{'all':!![]}];}return db[_0x04b5('0x24')]['findAll'](_0x55b060);})[_0x04b5('0x1f')](function(_0x64f835){_0x2de686[_0x04b5('0x3b')]=_0x64f835;return _0x2de686;})['then'](respondWithFilteredResult(_0x1a787c,_0x55b060))[_0x04b5('0x3c')](handleError(_0x1a787c,null));};exports[_0x04b5('0x3d')]=function(_0x1c1786,_0x5336bc){var _0xd4a07c={'raw':!![],'where':{'id':_0x1c1786[_0x04b5('0x3e')]['id']}},_0x43799a={};_0x43799a[_0x04b5('0x28')]=_[_0x04b5('0x2b')](db['FaxApplication'][_0x04b5('0x25')]);_0x43799a[_0x04b5('0x2a')]=_['keys'](_0x1c1786[_0x04b5('0x2a')]);_0x43799a[_0x04b5('0x3f')]=_[_0x04b5('0x2c')](_0x43799a['model'],_0x43799a['query']);_0xd4a07c[_0x04b5('0x2d')]=_[_0x04b5('0x2c')](_0x43799a[_0x04b5('0x28')],qs[_0x04b5('0x2e')](_0x1c1786[_0x04b5('0x2a')]['fields']));_0xd4a07c['attributes']=_0xd4a07c[_0x04b5('0x2d')][_0x04b5('0x2f')]?_0xd4a07c[_0x04b5('0x2d')]:_0x43799a[_0x04b5('0x28')];if(_0x1c1786['query'][_0x04b5('0x3a')]){_0xd4a07c[_0x04b5('0x40')]=[{'all':!![]}];}_0xd4a07c=_['merge']({},_0xd4a07c,_0x1c1786['options']);return db[_0x04b5('0x24')][_0x04b5('0x41')](_0xd4a07c)[_0x04b5('0x1f')](handleEntityNotFound(_0x5336bc,null))['then'](respondWithResult(_0x5336bc,null))[_0x04b5('0x3c')](handleError(_0x5336bc,null));};exports[_0x04b5('0x42')]=function(_0x2eae85,_0x103e96){return db['FaxApplication'][_0x04b5('0x42')](_0x2eae85['body'],{})[_0x04b5('0x1f')](respondWithResult(_0x103e96,0xc9))[_0x04b5('0x3c')](handleError(_0x103e96,null));};exports[_0x04b5('0x1e')]=function(_0x26d73d,_0xaee6b2){if(_0x26d73d[_0x04b5('0x43')]['id']){delete _0x26d73d[_0x04b5('0x43')]['id'];}return db[_0x04b5('0x24')][_0x04b5('0x41')]({'where':{'id':_0x26d73d[_0x04b5('0x3e')]['id']}})['then'](handleEntityNotFound(_0xaee6b2,null))['then'](saveUpdates(_0x26d73d[_0x04b5('0x43')],null))[_0x04b5('0x1f')](respondWithResult(_0xaee6b2,null))[_0x04b5('0x3c')](handleError(_0xaee6b2,null));};exports[_0x04b5('0x44')]=function(_0x247ac0,_0x3e46ed){return db[_0x04b5('0x24')]['find']({'where':{'id':_0x247ac0[_0x04b5('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3e46ed,null))[_0x04b5('0x1f')](removeEntity(_0x3e46ed,null))[_0x04b5('0x3c')](handleError(_0x3e46ed,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 835f39a..61a1b42 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 _0x9135=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','fax_applications','utf8mb4','lodash','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9135,0x15d));var _0x5913=function(_0x40c42b,_0x2ef7c5){_0x40c42b=_0x40c42b-0x0;var _0x841617=_0x9135[_0x40c42b];return _0x841617;};'use strict';var _=require(_0x5913('0x0'));var util=require(_0x5913('0x1'));var logger=require(_0x5913('0x2'))(_0x5913('0x3'));var moment=require(_0x5913('0x4'));var BPromise=require(_0x5913('0x5'));var rp=require(_0x5913('0x6'));var fs=require('fs');var path=require(_0x5913('0x7'));var rimraf=require(_0x5913('0x8'));var config=require(_0x5913('0x9'));var attributes=require(_0x5913('0xa'));module['exports']=function(_0x6ec8c2,_0x379447){return _0x6ec8c2['define']('FaxApplication',attributes,{'tableName':_0x5913('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5913('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf36a=['define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x16de68,_0x33d7ff){var _0x1c277e=function(_0x1d8549){while(--_0x1d8549){_0x16de68['push'](_0x16de68['shift']());}};_0x1c277e(++_0x33d7ff);}(_0xf36a,0x13c));var _0xaf36=function(_0x4a25c0,_0x85d4ba){_0x4a25c0=_0x4a25c0-0x0;var _0x34adda=_0xf36a[_0x4a25c0];return _0x34adda;};'use strict';var _=require(_0xaf36('0x0'));var util=require(_0xaf36('0x1'));var logger=require(_0xaf36('0x2'))('api');var moment=require('moment');var BPromise=require(_0xaf36('0x3'));var rp=require(_0xaf36('0x4'));var fs=require('fs');var path=require(_0xaf36('0x5'));var rimraf=require(_0xaf36('0x6'));var config=require(_0xaf36('0x7'));var attributes=require('./faxApplication.attributes');module[_0xaf36('0x8')]=function(_0x5e709e,_0x1adaee){return _0x5e709e[_0xaf36('0x9')]('FaxApplication',attributes,{'tableName':_0xaf36('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaf36('0xb'),'collate':_0xaf36('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index f89acd0..e6bf488 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 _0xe066=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','FaxApplication','update','raw','options','where','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x15fc5c,_0x3baf77){var _0x1c7abd=function(_0x45de71){while(--_0x45de71){_0x15fc5c['push'](_0x15fc5c['shift']());}};_0x1c7abd(++_0x3baf77);}(_0xe066,0xcc));var _0x6e06=function(_0x4144ca,_0x3f22e3){_0x4144ca=_0x4144ca-0x0;var _0x2de8ee=_0xe066[_0x4144ca];return _0x2de8ee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6e06('0x0'));var BPromise=require(_0x6e06('0x1'));var rs=require(_0x6e06('0x2'));var fs=require('fs');var Redis=require(_0x6e06('0x3'));var db=require(_0x6e06('0x4'))['db'];var utils=require(_0x6e06('0x5'));var logger=require(_0x6e06('0x6'))(_0x6e06('0x7'));var config=require(_0x6e06('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6e06('0x9')][_0x6e06('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20e592,_0x12351b,_0x41a51d){return new BPromise(function(_0x25896c,_0x33ccc9){return client[_0x6e06('0xb')](_0x20e592,_0x41a51d)[_0x6e06('0xc')](function(_0x4ba64a){logger[_0x6e06('0xd')](_0x6e06('0xe'),_0x12351b,_0x6e06('0xf'));logger[_0x6e06('0x10')](_0x6e06('0x11'),_0x12351b,'request\x20sent',JSON[_0x6e06('0x12')](_0x4ba64a));if(_0x4ba64a['error']){if(_0x4ba64a[_0x6e06('0x13')]['code']===0x1f4){logger['error'](_0x6e06('0xe'),_0x12351b,_0x4ba64a['error'][_0x6e06('0x14')]);return _0x33ccc9(_0x4ba64a['error']['message']);}logger[_0x6e06('0x13')](_0x6e06('0xe'),_0x12351b,_0x4ba64a['error'][_0x6e06('0x14')]);return _0x25896c(_0x4ba64a['error']['message']);}else{logger[_0x6e06('0xd')](_0x6e06('0xe'),_0x12351b,_0x6e06('0xf'));_0x25896c(_0x4ba64a[_0x6e06('0x15')]['message']);}})[_0x6e06('0x16')](function(_0x3080d7){logger[_0x6e06('0x13')](_0x6e06('0xe'),_0x12351b,_0x3080d7);_0x33ccc9(_0x3080d7);});});}exports[_0x6e06('0x17')]=function(_0x22ff0e){var _0x24444a=this;return new Promise(function(_0x37508b,_0xb84811){return db[_0x6e06('0x18')][_0x6e06('0x19')](_0x22ff0e['body'],{'raw':_0x22ff0e['options']?_0x22ff0e['options'][_0x6e06('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22ff0e[_0x6e06('0x1b')]?_0x22ff0e[_0x6e06('0x1b')][_0x6e06('0x1c')]||null:null,'attributes':_0x22ff0e[_0x6e06('0x1b')]?_0x22ff0e[_0x6e06('0x1b')]['attributes']||null:null,'limit':_0x22ff0e[_0x6e06('0x1b')]?_0x22ff0e[_0x6e06('0x1b')][_0x6e06('0x1d')]||null:null})[_0x6e06('0xc')](function(_0x16725a){logger[_0x6e06('0xd')](_0x6e06('0x17'),_0x22ff0e);logger['debug'](_0x6e06('0x17'),_0x22ff0e,JSON[_0x6e06('0x12')](_0x16725a));_0x37508b(_0x16725a);})['catch'](function(_0x3a830d){logger[_0x6e06('0x13')]('UpdateFaxApplication',_0x3a830d[_0x6e06('0x14')],_0x22ff0e);_0xb84811(_0x24444a['error'](0x1f4,_0x3a830d['message']));});});}; \ No newline at end of file +var _0x4cbc=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','update','body','options','raw','attributes','limit','UpdateFaxApplication'];(function(_0x25280c,_0x2edec1){var _0x3a58c3=function(_0x5292a0){while(--_0x5292a0){_0x25280c['push'](_0x25280c['shift']());}};_0x3a58c3(++_0x2edec1);}(_0x4cbc,0x1f0));var _0xc4cb=function(_0x1394e7,_0xb1001a){_0x1394e7=_0x1394e7-0x0;var _0x296d52=_0x4cbc[_0x1394e7];return _0x296d52;};'use strict';var _=require(_0xc4cb('0x0'));var util=require(_0xc4cb('0x1'));var moment=require(_0xc4cb('0x2'));var BPromise=require(_0xc4cb('0x3'));var rs=require(_0xc4cb('0x4'));var fs=require('fs');var Redis=require(_0xc4cb('0x5'));var db=require(_0xc4cb('0x6'))['db'];var utils=require(_0xc4cb('0x7'));var logger=require(_0xc4cb('0x8'))(_0xc4cb('0x9'));var config=require(_0xc4cb('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc4cb('0xb')][_0xc4cb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1da76d,_0x44369b,_0x4a8ad9){return new BPromise(function(_0x545af8,_0x27b804){return client[_0xc4cb('0xd')](_0x1da76d,_0x4a8ad9)[_0xc4cb('0xe')](function(_0x4a6792){logger['info'](_0xc4cb('0xf'),_0x44369b,_0xc4cb('0x10'));logger[_0xc4cb('0x11')](_0xc4cb('0x12'),_0x44369b,_0xc4cb('0x10'),JSON['stringify'](_0x4a6792));if(_0x4a6792[_0xc4cb('0x13')]){if(_0x4a6792[_0xc4cb('0x13')]['code']===0x1f4){logger[_0xc4cb('0x13')](_0xc4cb('0xf'),_0x44369b,_0x4a6792[_0xc4cb('0x13')][_0xc4cb('0x14')]);return _0x27b804(_0x4a6792[_0xc4cb('0x13')][_0xc4cb('0x14')]);}logger[_0xc4cb('0x13')]('FaxApplication,\x20%s,\x20%s',_0x44369b,_0x4a6792[_0xc4cb('0x13')][_0xc4cb('0x14')]);return _0x545af8(_0x4a6792[_0xc4cb('0x13')][_0xc4cb('0x14')]);}else{logger[_0xc4cb('0x15')]('FaxApplication,\x20%s,\x20%s',_0x44369b,_0xc4cb('0x10'));_0x545af8(_0x4a6792[_0xc4cb('0x16')][_0xc4cb('0x14')]);}})[_0xc4cb('0x17')](function(_0x317cbd){logger['error']('FaxApplication,\x20%s,\x20%s',_0x44369b,_0x317cbd);_0x27b804(_0x317cbd);});});}exports['UpdateFaxApplication']=function(_0x51b052){var _0x3fe01b=this;return new Promise(function(_0x2f2507,_0x13d9cf){return db['FaxApplication'][_0xc4cb('0x18')](_0x51b052[_0xc4cb('0x19')],{'raw':_0x51b052[_0xc4cb('0x1a')]?_0x51b052[_0xc4cb('0x1a')][_0xc4cb('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51b052[_0xc4cb('0x1a')]?_0x51b052['options']['where']||null:null,'attributes':_0x51b052[_0xc4cb('0x1a')]?_0x51b052[_0xc4cb('0x1a')][_0xc4cb('0x1c')]||null:null,'limit':_0x51b052['options']?_0x51b052['options'][_0xc4cb('0x1d')]||null:null})['then'](function(_0xbbe09d){logger[_0xc4cb('0x15')](_0xc4cb('0x1e'),_0x51b052);logger[_0xc4cb('0x11')](_0xc4cb('0x1e'),_0x51b052,JSON['stringify'](_0xbbe09d));_0x2f2507(_0xbbe09d);})[_0xc4cb('0x17')](function(_0x27305a){logger[_0xc4cb('0x13')](_0xc4cb('0x1e'),_0x27305a[_0xc4cb('0x14')],_0x51b052);_0x13d9cf(_0x3fe01b[_0xc4cb('0x13')](0x1f4,_0x27305a['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 534d7d0..79188cd 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 _0xa571=['index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x2390ad,_0x5ea29f){var _0x474ef0=function(_0x4185c2){while(--_0x4185c2){_0x2390ad['push'](_0x2390ad['shift']());}};_0x474ef0(++_0x5ea29f);}(_0xa571,0x107));var _0x1a57=function(_0x5cf777,_0x431e8a){_0x5cf777=_0x5cf777-0x0;var _0x362fce=_0xa571[_0x5cf777];return _0x362fce;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./faxApplication.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0xb')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0xc')]);router['put'](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0xe')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);module[_0x1a57('0x10')]=router; \ No newline at end of file +var _0x955f=['path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','util'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x955f,0x1eb));var _0xf955=function(_0x30fedb,_0x38183f){_0x30fedb=_0x30fedb-0x0;var _0x36360a=_0x955f[_0x30fedb];return _0x36360a;};'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('./faxApplication.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['show']);router[_0xf955('0xb')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')](_0xf955('0xa'),auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['delete'](_0xf955('0xa'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);module[_0xf955('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 31f0d54..459d4d1 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 _0xfb11=['STRING','ENUM','INTEGER','sequelize','BOOLEAN','DATE'];(function(_0x511504,_0x55c0c3){var _0x5cecc9=function(_0x2a4ec9){while(--_0x2a4ec9){_0x511504['push'](_0x511504['shift']());}};_0x5cecc9(++_0x55c0c3);}(_0xfb11,0x1ad));var _0x1fb1=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xfb11[_0xbe200f];return _0x192597;};'use strict';var Sequelize=require(_0x1fb1('0x0'));module['exports']={'closed':{'type':Sequelize[_0x1fb1('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1fb1('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1fb1('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1fb1('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x1fb1('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x1fb1('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1fb1('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x1fb1('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x1fb1('0x5')]}}; \ No newline at end of file +var _0xa30a=['exports','BOOLEAN','STRING','DATE','ENUM','out','INTEGER','sequelize'];(function(_0x307a3e,_0x25ae81){var _0x2ee135=function(_0x5e17d9){while(--_0x5e17d9){_0x307a3e['push'](_0x307a3e['shift']());}};_0x2ee135(++_0x25ae81);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xaa30('0x0'));module[_0xaa30('0x1')]={'closed':{'type':Sequelize[_0xaa30('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xaa30('0x3')]},'secondDisposition':{'type':Sequelize[_0xaa30('0x3')]},'thirdDisposition':{'type':Sequelize[_0xaa30('0x3')]},'note':{'type':Sequelize[_0xaa30('0x3')]},'read1stAt':{'type':Sequelize[_0xaa30('0x4')]},'fax':{'type':Sequelize[_0xaa30('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xaa30('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xaa30('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xaa30('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xaa30('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 9183ff5..830a124 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 _0x05dc=['../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','sendStatus','stack','name','send','index','map','FaxInteraction','type','findAll','fax','user','catch','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','find','body','describe','addMessage','FaxMessage','omit','ids','getMessages','length','nolimit','order','sort','where','pick','FaxInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','join','files','tmp','server','format','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','createReadStream','createWriteStream','resolve','zip-dir','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api'];(function(_0x491bf7,_0x5dc53c){var _0x4384b2=function(_0x42ba5b){while(--_0x42ba5b){_0x491bf7['push'](_0x491bf7['shift']());}};_0x4384b2(++_0x5dc53c);}(_0x05dc,0x17a));var _0xc05d=function(_0x3f7094,_0x4297eb){_0x3f7094=_0x3f7094-0x0;var _0x4bbedc=_0x05dc[_0x3f7094];return _0x4bbedc;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xc05d('0x0'));var moment=require('moment');var BPromise=require(_0xc05d('0x1'));var util=require(_0xc05d('0x2'));var path=require(_0xc05d('0x3'));var fs=require('fs');var _=require(_0xc05d('0x4'));var Redis=require(_0xc05d('0x5'));var interaction=require(_0xc05d('0x6'));var qs=require(_0xc05d('0x7'));var logger=require(_0xc05d('0x8'))(_0xc05d('0x9'));var config=require(_0xc05d('0xa'));var db=require(_0xc05d('0xb'))['db'];config[_0xc05d('0xc')]=_['defaults'](config['redis'],{'host':_0xc05d('0xd'),'port':0x18eb});var socket=require(_0xc05d('0xe'))(new Redis(config['redis']));require(_0xc05d('0xf'))[_0xc05d('0x10')](socket);function respondWithStatusCode(_0x59007b,_0x1ce62a){_0x1ce62a=_0x1ce62a||0xcc;return function(_0x2fec53){if(_0x2fec53){return _0x59007b['sendStatus'](_0x1ce62a);}return _0x59007b[_0xc05d('0x11')](_0x1ce62a)['end']();};}function respondWithResult(_0x1d3ec3,_0x6d00ac){_0x6d00ac=_0x6d00ac||0xc8;return function(_0x3679cd){if(_0x3679cd){return _0x1d3ec3['status'](_0x6d00ac)[_0xc05d('0x12')](_0x3679cd);}};}function respondWithFilteredResult(_0x76e644,_0x50cea5){return function(_0x54def9){if(_0x54def9){var _0x1ea748=typeof _0x50cea5[_0xc05d('0x13')]===_0xc05d('0x14')&&typeof _0x50cea5[_0xc05d('0x15')]===_0xc05d('0x14');var _0x79c62=_0x54def9['count'];var _0x4f8a6b=_0x1ea748?0x0:_0x50cea5[_0xc05d('0x13')];var _0x12ed66=_0x1ea748?_0x54def9[_0xc05d('0x16')]:_0x50cea5[_0xc05d('0x13')]+_0x50cea5[_0xc05d('0x15')];var _0x470c2b;if(_0x12ed66>=_0x79c62){_0x12ed66=_0x79c62;_0x470c2b=0xc8;}else{_0x470c2b=0xce;}_0x76e644['status'](_0x470c2b);return _0x76e644['set'](_0xc05d('0x17'),_0x4f8a6b+'-'+_0x12ed66+'/'+_0x79c62)[_0xc05d('0x12')](_0x54def9);}return null;};}function saveUpdates(_0x769464){return function(_0x3b5883){if(_0x3b5883){return _0x3b5883[_0xc05d('0x18')](_0x769464)[_0xc05d('0x19')](function(_0x400edf){return _0x400edf;});}return null;};}function removeEntity(_0x35b8b0){return function(_0x503c35){if(_0x503c35){return _0x503c35[_0xc05d('0x1a')]()[_0xc05d('0x19')](function(){_0x35b8b0[_0xc05d('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ef232){return function(_0x40f102){if(!_0x40f102){_0x2ef232[_0xc05d('0x1b')](0x194);}return _0x40f102;};}function handleError(_0x1a2871,_0x447991){_0x447991=_0x447991||0x1f4;return function(_0x4dd2cf){logger['error'](_0x4dd2cf[_0xc05d('0x1c')]);if(_0x4dd2cf['name']){delete _0x4dd2cf[_0xc05d('0x1d')];}_0x1a2871[_0xc05d('0x11')](_0x447991)[_0xc05d('0x1e')](_0x4dd2cf);};}exports[_0xc05d('0x1f')]=function(_0x3518d2,_0x258e02){var _0x362b1f={};var _0x18ed88=_[_0xc05d('0x20')](db[_0xc05d('0x21')]['rawAttributes'],function(_0xe40842){return{'name':_0xe40842['fieldName'],'type':_0xe40842[_0xc05d('0x22')]['key']};});_0x362b1f=qs['getOptions'](_0x18ed88,_0x3518d2);return interaction[_0xc05d('0x23')](_0xc05d('0x24'),_0x3518d2['query'],_0x3518d2[_0xc05d('0x25')],_0x362b1f,_0x18ed88)[_0xc05d('0x19')](respondWithFilteredResult(_0x258e02,_0x362b1f))[_0xc05d('0x26')](handleError(_0x258e02,null));};exports[_0xc05d('0x27')]=function(_0x15ad2b,_0x1d69a5){var _0x35c108={'raw':![],'where':{'id':_0x15ad2b[_0xc05d('0x28')]['id']}},_0x20f44a={};_0x20f44a[_0xc05d('0x29')]=_[_0xc05d('0x2a')](db[_0xc05d('0x21')][_0xc05d('0x2b')]);_0x20f44a[_0xc05d('0x2c')]=_['keys'](_0x15ad2b[_0xc05d('0x2c')]);_0x20f44a[_0xc05d('0x2d')]=_[_0xc05d('0x2e')](_0x20f44a[_0xc05d('0x29')],_0x20f44a['query']);_0x35c108[_0xc05d('0x2f')]=_['intersection'](_0x20f44a[_0xc05d('0x29')],qs['fields'](_0x15ad2b[_0xc05d('0x2c')][_0xc05d('0x30')]));_0x35c108[_0xc05d('0x2f')]=_0x35c108[_0xc05d('0x2f')]['length']?_0x35c108[_0xc05d('0x2f')]:_0x20f44a[_0xc05d('0x29')];if(_0x15ad2b[_0xc05d('0x2c')][_0xc05d('0x31')]){_0x35c108[_0xc05d('0x32')]=[{'all':!![]}];}_0x35c108=_[_0xc05d('0x33')]({},_0x35c108,_0x15ad2b[_0xc05d('0x34')]);return db['FaxInteraction'][_0xc05d('0x35')](_0x35c108)[_0xc05d('0x19')](handleEntityNotFound(_0x1d69a5,null))['then'](respondWithResult(_0x1d69a5,null))[_0xc05d('0x26')](handleError(_0x1d69a5,null));};exports['create']=function(_0xe9a52d,_0x586570){return db[_0xc05d('0x21')]['create'](_0xe9a52d[_0xc05d('0x36')],{})[_0xc05d('0x19')](respondWithResult(_0x586570,0xc9))[_0xc05d('0x26')](handleError(_0x586570,null));};exports[_0xc05d('0x18')]=function(_0xbc2828,_0x45550d){if(_0xbc2828[_0xc05d('0x36')]['id']){delete _0xbc2828[_0xc05d('0x36')]['id'];}return db[_0xc05d('0x21')][_0xc05d('0x35')]({'where':{'id':_0xbc2828['params']['id']}})[_0xc05d('0x19')](handleEntityNotFound(_0x45550d,null))[_0xc05d('0x19')](saveUpdates(_0xbc2828['body'],null))[_0xc05d('0x19')](respondWithResult(_0x45550d,null))['catch'](handleError(_0x45550d,null));};exports[_0xc05d('0x1a')]=function(_0x2e17e7,_0x37787f){return db['FaxInteraction'][_0xc05d('0x35')]({'where':{'id':_0x2e17e7['params']['id']}})['then'](handleEntityNotFound(_0x37787f,null))[_0xc05d('0x19')](removeEntity(_0x37787f,null))['catch'](handleError(_0x37787f,null));};exports[_0xc05d('0x37')]=function(_0x2f5a7a,_0x37c391){return db[_0xc05d('0x21')][_0xc05d('0x37')]()[_0xc05d('0x19')](respondWithResult(_0x37c391,null))[_0xc05d('0x26')](handleError(_0x37c391,null));};exports[_0xc05d('0x38')]=function(_0x399c97,_0xb2a00d){return db[_0xc05d('0x39')][_0xc05d('0x35')]({'where':{'id':_0x399c97[_0xc05d('0x28')]['id']}})[_0xc05d('0x19')](handleEntityNotFound(_0xb2a00d,null))[_0xc05d('0x19')](function(_0x46afa6){if(_0x46afa6){return _0x46afa6[_0xc05d('0x38')](_0x399c97[_0xc05d('0x36')]['ids'],_[_0xc05d('0x3a')](_0x399c97[_0xc05d('0x36')],[_0xc05d('0x3b'),'id'])||{});}})['then'](respondWithResult(_0xb2a00d,null))[_0xc05d('0x26')](handleError(_0xb2a00d,null));};exports[_0xc05d('0x3c')]=function(_0x15480c,_0x2121f4){var _0x4a32e9={'raw':![],'where':{}};var _0x1c728b={};var _0x5b29ac={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x15480c[_0xc05d('0x28')]['id']}})['then'](handleEntityNotFound(_0x2121f4,null))[_0xc05d('0x19')](function(_0x50c4c1){if(_0x50c4c1){_0x1c728b[_0xc05d('0x29')]=_[_0xc05d('0x2a')](db[_0xc05d('0x39')]['rawAttributes']);_0x1c728b[_0xc05d('0x2c')]=_[_0xc05d('0x2a')](_0x15480c[_0xc05d('0x2c')]);_0x1c728b['filters']=_[_0xc05d('0x2e')](_0x1c728b[_0xc05d('0x29')],_0x1c728b[_0xc05d('0x2c')]);_0x4a32e9['attributes']=_[_0xc05d('0x2e')](_0x1c728b['model'],qs[_0xc05d('0x30')](_0x15480c['query'][_0xc05d('0x30')]));_0x4a32e9['attributes']=_0x4a32e9[_0xc05d('0x2f')][_0xc05d('0x3d')]?_0x4a32e9[_0xc05d('0x2f')]:_0x1c728b[_0xc05d('0x29')];if(!_0x15480c[_0xc05d('0x2c')]['hasOwnProperty'](_0xc05d('0x3e'))){_0x4a32e9[_0xc05d('0x15')]=qs['limit'](_0x15480c[_0xc05d('0x2c')][_0xc05d('0x15')]);_0x4a32e9[_0xc05d('0x13')]=qs[_0xc05d('0x13')](_0x15480c[_0xc05d('0x2c')]['offset']);}_0x4a32e9[_0xc05d('0x3f')]=qs[_0xc05d('0x40')](_0x15480c['query']['sort']);_0x4a32e9[_0xc05d('0x41')]=qs[_0xc05d('0x2d')](_[_0xc05d('0x42')](_0x15480c[_0xc05d('0x2c')],_0x1c728b['filters']));_0x4a32e9[_0xc05d('0x41')][_0xc05d('0x43')]=_0x50c4c1['id'];if(_0x15480c[_0xc05d('0x2c')]['filter']){_0x4a32e9[_0xc05d('0x41')]=_['merge'](_0x4a32e9[_0xc05d('0x41')],{'$or':_['map'](_0x4a32e9[_0xc05d('0x2f')],function(_0x543b6f){var _0x2cdc8b={};_0x2cdc8b[_0x543b6f]={'$like':'%'+_0x15480c[_0xc05d('0x2c')][_0xc05d('0x44')]+'%'};return _0x2cdc8b;})});}if(_0x15480c[_0xc05d('0x2c')]['$gte']){var _0x46a4c3=_0x15480c[_0xc05d('0x2c')][_0xc05d('0x45')][_0xc05d('0x46')](',');var _0x23f6c6={};_0x23f6c6[_0x46a4c3[0x0]]={'$gte':moment(_0x46a4c3[0x1])['format'](_0xc05d('0x47'))};_0x4a32e9[_0xc05d('0x41')]=_[_0xc05d('0x33')](_0x4a32e9[_0xc05d('0x41')],_0x23f6c6);}_0x4a32e9=_[_0xc05d('0x33')]({},_0x4a32e9,_0x15480c[_0xc05d('0x34')]);return db['FaxMessage']['count']({'where':_0x4a32e9[_0xc05d('0x41')]})[_0xc05d('0x19')](function(_0x48d509){_0x5b29ac[_0xc05d('0x16')]=_0x48d509;if(_0x15480c['query']['includeAll']){_0x4a32e9[_0xc05d('0x32')]=[{'all':!![]}];}return db['FaxMessage'][_0xc05d('0x23')](_0x4a32e9);})['then'](function(_0x32383b){_0x5b29ac[_0xc05d('0x48')]=_0x32383b;return _0x5b29ac;});}})[_0xc05d('0x19')](respondWithFilteredResult(_0x2121f4,_0x4a32e9))[_0xc05d('0x26')](handleError(_0x2121f4,null));};exports[_0xc05d('0x49')]=function(_0x366013,_0x193f52){return db['FaxInteraction']['find']({'where':{'id':_0x366013['params']['id']}})[_0xc05d('0x19')](handleEntityNotFound(_0x193f52,null))[_0xc05d('0x19')](function(_0x2ad4c6){if(_0x2ad4c6){return _0x2ad4c6[_0xc05d('0x4a')](_0x366013[_0xc05d('0x36')][_0xc05d('0x3b')],_[_0xc05d('0x3a')](_0x366013[_0xc05d('0x36')],[_0xc05d('0x3b'),'id'])||{})[_0xc05d('0x4b')](function(){return db[_0xc05d('0x4c')]['findAll']({'attributes':['id','name',_0xc05d('0x4d')],'where':{'id':_0x366013[_0xc05d('0x36')][_0xc05d('0x3b')]}});})[_0xc05d('0x19')](function(_0x50a6bf){socket[_0xc05d('0x4e')]('faxInteractionTags:save',{'id':Number(_0x366013[_0xc05d('0x28')]['id']),'tags':_0x50a6bf||[]});return{'id':Number(_0x366013[_0xc05d('0x28')]['id']),'tags':_0x50a6bf||[]};});}})[_0xc05d('0x19')](respondWithResult(_0x193f52,null))[_0xc05d('0x26')](handleError(_0x193f52,null));};exports[_0xc05d('0x4f')]=function(_0x678172,_0x4cd217){return db[_0xc05d('0x21')][_0xc05d('0x35')]({'where':{'id':_0x678172[_0xc05d('0x28')]['id']}})[_0xc05d('0x19')](handleEntityNotFound(_0x4cd217,null))['then'](function(_0x535173){if(_0x535173){return _0x535173[_0xc05d('0x4f')](_0x678172[_0xc05d('0x2c')][_0xc05d('0x3b')]);}})[_0xc05d('0x19')](respondWithStatusCode(_0x4cd217,null))['catch'](handleError(_0x4cd217,null));};exports[_0xc05d('0x50')]=function(_0x214841,_0x49be94){var _0x4c1b21=moment()[_0xc05d('0x51')]()[_0xc05d('0x52')]();var _0x17617d=path[_0xc05d('0x53')](config['root'],'server',_0xc05d('0x54'),_0xc05d('0x55'));var _0x36e76d=path[_0xc05d('0x53')](config['root'],_0xc05d('0x56'),'files','attachments');var _0x3e90a4=path[_0xc05d('0x53')](_0x17617d,_0x4c1b21);var _0x3b82bf=util[_0xc05d('0x57')]('transcript-%d-%s.zip',_0x214841[_0xc05d('0x28')]['id'],_0x4c1b21);var _0x1a619b=path['join'](_0x17617d,_0x3b82bf);var _0x43f655=[];_0x43f655['push']({'model':db[_0xc05d('0x58')],'as':'Attachment','raw':!![]});var _0x3aa309=[{'model':db[_0xc05d('0x39')],'as':_0xc05d('0x59'),'attributes':['id',_0xc05d('0x36'),_0xc05d('0x5a')],'include':_0x43f655}];return db[_0xc05d('0x21')]['find']({'where':{'id':_0x214841[_0xc05d('0x28')]['id']},'include':_0x3aa309})[_0xc05d('0x19')](handleEntityNotFound(_0x49be94,null))[_0xc05d('0x19')](function(_0x54650c){if(_0x54650c&&_0x54650c['Messages']){var _0x3f9065=_0x54650c['get']({'plain':!![]});fs[_0xc05d('0x5b')](_0x3e90a4);for(var _0x5a02b9=0x0;_0x5a02b9<_0x3f9065['Messages']['length'];_0x5a02b9++){var _0x5312ba=_0x3f9065[_0xc05d('0x59')][_0x5a02b9][_0xc05d('0x58')];if(_0x5312ba){var _0x4e2c1f=path[_0xc05d('0x53')](_0x36e76d,_0x5312ba[_0xc05d('0x5c')]);if(fs[_0xc05d('0x5d')](_0x4e2c1f)){fs[_0xc05d('0x5e')](_0x4e2c1f)['pipe'](fs[_0xc05d('0x5f')](path[_0xc05d('0x53')](_0x3e90a4,_0x5312ba[_0xc05d('0x5c')])));}}}return BPromise[_0xc05d('0x60')]()['then'](function(){return new BPromise(function(_0x12c1a0,_0x17297f){zipdir(_0x3e90a4,{'saveTo':_0x1a619b},function(_0x29e707,_0x1cde78){if(_0x29e707)return _0x17297f(_0x29e707);return _0x12c1a0(_0x1cde78);});})['then'](function(){return new BPromise(function(_0x116479,_0x390abd){rimraf(_0x3e90a4,function(_0x2c6dc3){if(_0x2c6dc3)_0x390abd(_0x2c6dc3);return _0x116479();});});})[_0xc05d('0x19')](function(){return _0x49be94[_0xc05d('0x50')](_0x1a619b,_0x3b82bf,function(_0x55857c){if(_0x55857c){console['log']('err',_0x55857c);}else{fs['unlinkSync'](_0x1a619b);}});});});}else{return _0x49be94['sendStatus'](0xc8);}})['catch'](handleError(_0x49be94,null));}; \ No newline at end of file +var _0xa308=['name','send','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','user','catch','show','params','model','keys','query','filters','intersection','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','removeTags','unix','join','root','server','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','get','basename','createReadStream','pipe','createWriteStream','resolve','download','log','err','unlinkSync','rimraf','moment','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','status','json','undefined','count','offset','limit','set','update','destroy','then','end','error','stack'];(function(_0x13c1e9,_0x4496c8){var _0x4b6e75=function(_0x2618af){while(--_0x2618af){_0x13c1e9['push'](_0x13c1e9['shift']());}};_0x4b6e75(++_0x4496c8);}(_0xa308,0x1ce));var _0x8a30=function(_0x2637ac,_0x377857){_0x2637ac=_0x2637ac-0x0;var _0x4a5758=_0xa308[_0x2637ac];return _0x4a5758;};'use strict';var rimraf=require(_0x8a30('0x0'));var zipdir=require('zip-dir');var moment=require(_0x8a30('0x1'));var BPromise=require('bluebird');var util=require(_0x8a30('0x2'));var path=require(_0x8a30('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x8a30('0x4'));var interaction=require(_0x8a30('0x5'));var qs=require(_0x8a30('0x6'));var logger=require('../../config/logger')(_0x8a30('0x7'));var config=require(_0x8a30('0x8'));var db=require(_0x8a30('0x9'))['db'];config['redis']=_['defaults'](config[_0x8a30('0xa')],{'host':_0x8a30('0xb'),'port':0x18eb});var socket=require(_0x8a30('0xc'))(new Redis(config[_0x8a30('0xa')]));require(_0x8a30('0xd'))[_0x8a30('0xe')](socket);function respondWithStatusCode(_0x12b87f,_0x161ed5){_0x161ed5=_0x161ed5||0xcc;return function(_0x494156){if(_0x494156){return _0x12b87f['sendStatus'](_0x161ed5);}return _0x12b87f['status'](_0x161ed5)['end']();};}function respondWithResult(_0xc0f5b2,_0x2809cc){_0x2809cc=_0x2809cc||0xc8;return function(_0xf19ddc){if(_0xf19ddc){return _0xc0f5b2[_0x8a30('0xf')](_0x2809cc)[_0x8a30('0x10')](_0xf19ddc);}};}function respondWithFilteredResult(_0x509ae9,_0x2c633b){return function(_0x2a6e45){if(_0x2a6e45){var _0x5ae765=typeof _0x2c633b['offset']===_0x8a30('0x11')&&typeof _0x2c633b['limit']===_0x8a30('0x11');var _0x4403f2=_0x2a6e45[_0x8a30('0x12')];var _0x361d46=_0x5ae765?0x0:_0x2c633b[_0x8a30('0x13')];var _0x44fce3=_0x5ae765?_0x2a6e45[_0x8a30('0x12')]:_0x2c633b[_0x8a30('0x13')]+_0x2c633b[_0x8a30('0x14')];var _0x577c2d;if(_0x44fce3>=_0x4403f2){_0x44fce3=_0x4403f2;_0x577c2d=0xc8;}else{_0x577c2d=0xce;}_0x509ae9['status'](_0x577c2d);return _0x509ae9[_0x8a30('0x15')]('Content-Range',_0x361d46+'-'+_0x44fce3+'/'+_0x4403f2)[_0x8a30('0x10')](_0x2a6e45);}return null;};}function saveUpdates(_0x242ea5){return function(_0x2ca16f){if(_0x2ca16f){return _0x2ca16f[_0x8a30('0x16')](_0x242ea5)['then'](function(_0x3c5db3){return _0x3c5db3;});}return null;};}function removeEntity(_0x2e2fa9){return function(_0x1c9fa4){if(_0x1c9fa4){return _0x1c9fa4[_0x8a30('0x17')]()[_0x8a30('0x18')](function(){_0x2e2fa9[_0x8a30('0xf')](0xcc)[_0x8a30('0x19')]();});}};}function handleEntityNotFound(_0x327405){return function(_0x205b40){if(!_0x205b40){_0x327405['sendStatus'](0x194);}return _0x205b40;};}function handleError(_0x3a7844,_0x1a32bd){_0x1a32bd=_0x1a32bd||0x1f4;return function(_0x594357){logger[_0x8a30('0x1a')](_0x594357[_0x8a30('0x1b')]);if(_0x594357['name']){delete _0x594357[_0x8a30('0x1c')];}_0x3a7844['status'](_0x1a32bd)[_0x8a30('0x1d')](_0x594357);};}exports['index']=function(_0x45dbb8,_0x38ac70){var _0x56a066={};var _0x40c389=_[_0x8a30('0x1e')](db[_0x8a30('0x1f')][_0x8a30('0x20')],function(_0x14174d){return{'name':_0x14174d[_0x8a30('0x21')],'type':_0x14174d[_0x8a30('0x22')][_0x8a30('0x23')]};});_0x56a066=qs[_0x8a30('0x24')](_0x40c389,_0x45dbb8);return interaction['findAll']('fax',_0x45dbb8['query'],_0x45dbb8[_0x8a30('0x25')],_0x56a066,_0x40c389)['then'](respondWithFilteredResult(_0x38ac70,_0x56a066))[_0x8a30('0x26')](handleError(_0x38ac70,null));};exports[_0x8a30('0x27')]=function(_0x33511d,_0x5b02d7){var _0x1656d4={'raw':![],'where':{'id':_0x33511d[_0x8a30('0x28')]['id']}},_0x25d2d4={};_0x25d2d4[_0x8a30('0x29')]=_[_0x8a30('0x2a')](db[_0x8a30('0x1f')][_0x8a30('0x20')]);_0x25d2d4[_0x8a30('0x2b')]=_[_0x8a30('0x2a')](_0x33511d[_0x8a30('0x2b')]);_0x25d2d4[_0x8a30('0x2c')]=_[_0x8a30('0x2d')](_0x25d2d4[_0x8a30('0x29')],_0x25d2d4[_0x8a30('0x2b')]);_0x1656d4['attributes']=_[_0x8a30('0x2d')](_0x25d2d4['model'],qs['fields'](_0x33511d[_0x8a30('0x2b')][_0x8a30('0x2e')]));_0x1656d4['attributes']=_0x1656d4['attributes'][_0x8a30('0x2f')]?_0x1656d4['attributes']:_0x25d2d4[_0x8a30('0x29')];if(_0x33511d[_0x8a30('0x2b')][_0x8a30('0x30')]){_0x1656d4[_0x8a30('0x31')]=[{'all':!![]}];}_0x1656d4=_[_0x8a30('0x32')]({},_0x1656d4,_0x33511d[_0x8a30('0x33')]);return db[_0x8a30('0x1f')][_0x8a30('0x34')](_0x1656d4)[_0x8a30('0x18')](handleEntityNotFound(_0x5b02d7,null))[_0x8a30('0x18')](respondWithResult(_0x5b02d7,null))[_0x8a30('0x26')](handleError(_0x5b02d7,null));};exports[_0x8a30('0x35')]=function(_0x581bbc,_0x4c0b17){return db['FaxInteraction'][_0x8a30('0x35')](_0x581bbc[_0x8a30('0x36')],{})[_0x8a30('0x18')](respondWithResult(_0x4c0b17,0xc9))[_0x8a30('0x26')](handleError(_0x4c0b17,null));};exports[_0x8a30('0x16')]=function(_0x10327e,_0xc6ddf2){if(_0x10327e[_0x8a30('0x36')]['id']){delete _0x10327e[_0x8a30('0x36')]['id'];}return db[_0x8a30('0x1f')]['find']({'where':{'id':_0x10327e[_0x8a30('0x28')]['id']}})['then'](handleEntityNotFound(_0xc6ddf2,null))[_0x8a30('0x18')](saveUpdates(_0x10327e[_0x8a30('0x36')],null))[_0x8a30('0x18')](respondWithResult(_0xc6ddf2,null))[_0x8a30('0x26')](handleError(_0xc6ddf2,null));};exports[_0x8a30('0x17')]=function(_0x25f7b5,_0xd21fe1){return db['FaxInteraction']['find']({'where':{'id':_0x25f7b5['params']['id']}})[_0x8a30('0x18')](handleEntityNotFound(_0xd21fe1,null))[_0x8a30('0x18')](removeEntity(_0xd21fe1,null))[_0x8a30('0x26')](handleError(_0xd21fe1,null));};exports[_0x8a30('0x37')]=function(_0x623041,_0x3983b0){return db[_0x8a30('0x1f')]['describe']()[_0x8a30('0x18')](respondWithResult(_0x3983b0,null))[_0x8a30('0x26')](handleError(_0x3983b0,null));};exports[_0x8a30('0x38')]=function(_0x4b1018,_0xac9175){return db[_0x8a30('0x39')][_0x8a30('0x34')]({'where':{'id':_0x4b1018[_0x8a30('0x28')]['id']}})[_0x8a30('0x18')](handleEntityNotFound(_0xac9175,null))[_0x8a30('0x18')](function(_0x5350a0){if(_0x5350a0){return _0x5350a0['addMessage'](_0x4b1018[_0x8a30('0x36')][_0x8a30('0x3a')],_[_0x8a30('0x3b')](_0x4b1018[_0x8a30('0x36')],[_0x8a30('0x3a'),'id'])||{});}})['then'](respondWithResult(_0xac9175,null))[_0x8a30('0x26')](handleError(_0xac9175,null));};exports[_0x8a30('0x3c')]=function(_0x177934,_0x4057d0){var _0x3a7267={'raw':![],'where':{}};var _0x1f8093={};var _0x594d16={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x177934[_0x8a30('0x28')]['id']}})[_0x8a30('0x18')](handleEntityNotFound(_0x4057d0,null))['then'](function(_0x55585c){if(_0x55585c){_0x1f8093[_0x8a30('0x29')]=_['keys'](db['FaxMessage']['rawAttributes']);_0x1f8093[_0x8a30('0x2b')]=_[_0x8a30('0x2a')](_0x177934[_0x8a30('0x2b')]);_0x1f8093[_0x8a30('0x2c')]=_[_0x8a30('0x2d')](_0x1f8093[_0x8a30('0x29')],_0x1f8093[_0x8a30('0x2b')]);_0x3a7267[_0x8a30('0x3d')]=_[_0x8a30('0x2d')](_0x1f8093[_0x8a30('0x29')],qs[_0x8a30('0x2e')](_0x177934[_0x8a30('0x2b')][_0x8a30('0x2e')]));_0x3a7267[_0x8a30('0x3d')]=_0x3a7267[_0x8a30('0x3d')]['length']?_0x3a7267[_0x8a30('0x3d')]:_0x1f8093['model'];if(!_0x177934[_0x8a30('0x2b')][_0x8a30('0x3e')](_0x8a30('0x3f'))){_0x3a7267[_0x8a30('0x14')]=qs['limit'](_0x177934[_0x8a30('0x2b')]['limit']);_0x3a7267[_0x8a30('0x13')]=qs[_0x8a30('0x13')](_0x177934[_0x8a30('0x2b')][_0x8a30('0x13')]);}_0x3a7267[_0x8a30('0x40')]=qs[_0x8a30('0x41')](_0x177934[_0x8a30('0x2b')][_0x8a30('0x41')]);_0x3a7267[_0x8a30('0x42')]=qs[_0x8a30('0x2c')](_[_0x8a30('0x43')](_0x177934[_0x8a30('0x2b')],_0x1f8093['filters']));_0x3a7267[_0x8a30('0x42')]['FaxInteractionId']=_0x55585c['id'];if(_0x177934['query']['filter']){_0x3a7267[_0x8a30('0x42')]=_['merge'](_0x3a7267[_0x8a30('0x42')],{'$or':_['map'](_0x3a7267[_0x8a30('0x3d')],function(_0x15319e){var _0x17e3d2={};_0x17e3d2[_0x15319e]={'$like':'%'+_0x177934['query'][_0x8a30('0x44')]+'%'};return _0x17e3d2;})});}if(_0x177934[_0x8a30('0x2b')]['$gte']){var _0x5b488b=_0x177934[_0x8a30('0x2b')][_0x8a30('0x45')][_0x8a30('0x46')](',');var _0x514274={};_0x514274[_0x5b488b[0x0]]={'$gte':moment(_0x5b488b[0x1])[_0x8a30('0x47')](_0x8a30('0x48'))};_0x3a7267[_0x8a30('0x42')]=_[_0x8a30('0x32')](_0x3a7267[_0x8a30('0x42')],_0x514274);}_0x3a7267=_[_0x8a30('0x32')]({},_0x3a7267,_0x177934[_0x8a30('0x33')]);return db[_0x8a30('0x39')]['count']({'where':_0x3a7267[_0x8a30('0x42')]})[_0x8a30('0x18')](function(_0x4f3d72){_0x594d16[_0x8a30('0x12')]=_0x4f3d72;if(_0x177934[_0x8a30('0x2b')][_0x8a30('0x30')]){_0x3a7267[_0x8a30('0x31')]=[{'all':!![]}];}return db[_0x8a30('0x39')]['findAll'](_0x3a7267);})[_0x8a30('0x18')](function(_0x2bd6a1){_0x594d16[_0x8a30('0x49')]=_0x2bd6a1;return _0x594d16;});}})[_0x8a30('0x18')](respondWithFilteredResult(_0x4057d0,_0x3a7267))[_0x8a30('0x26')](handleError(_0x4057d0,null));};exports[_0x8a30('0x4a')]=function(_0xa5e9e6,_0x1f3a92){return db[_0x8a30('0x1f')][_0x8a30('0x34')]({'where':{'id':_0xa5e9e6[_0x8a30('0x28')]['id']}})['then'](handleEntityNotFound(_0x1f3a92,null))[_0x8a30('0x18')](function(_0x37d871){if(_0x37d871){return _0x37d871[_0x8a30('0x4b')](_0xa5e9e6[_0x8a30('0x36')][_0x8a30('0x3a')],_[_0x8a30('0x3b')](_0xa5e9e6[_0x8a30('0x36')],[_0x8a30('0x3a'),'id'])||{})[_0x8a30('0x4c')](function(){return db['Tag']['findAll']({'attributes':['id',_0x8a30('0x1c'),'color'],'where':{'id':_0xa5e9e6[_0x8a30('0x36')][_0x8a30('0x3a')]}});})['then'](function(_0x2302c4){socket['emit']('faxInteractionTags:save',{'id':Number(_0xa5e9e6[_0x8a30('0x28')]['id']),'tags':_0x2302c4||[]});return{'id':Number(_0xa5e9e6['params']['id']),'tags':_0x2302c4||[]};});}})['then'](respondWithResult(_0x1f3a92,null))[_0x8a30('0x26')](handleError(_0x1f3a92,null));};exports[_0x8a30('0x4d')]=function(_0x1ee60d,_0x5aaf67){return db[_0x8a30('0x1f')]['find']({'where':{'id':_0x1ee60d[_0x8a30('0x28')]['id']}})[_0x8a30('0x18')](handleEntityNotFound(_0x5aaf67,null))[_0x8a30('0x18')](function(_0x59b881){if(_0x59b881){return _0x59b881[_0x8a30('0x4d')](_0x1ee60d[_0x8a30('0x2b')][_0x8a30('0x3a')]);}})['then'](respondWithStatusCode(_0x5aaf67,null))['catch'](handleError(_0x5aaf67,null));};exports['download']=function(_0x47749f,_0x4c1e41){var _0x2e2844=moment()[_0x8a30('0x4e')]()['toString']();var _0x1aaeb0=path[_0x8a30('0x4f')](config[_0x8a30('0x50')],_0x8a30('0x51'),'files',_0x8a30('0x52'));var _0x351ed5=path['join'](config['root'],'server','files',_0x8a30('0x53'));var _0x3bee7c=path[_0x8a30('0x4f')](_0x1aaeb0,_0x2e2844);var _0x2cd5ec=util[_0x8a30('0x47')](_0x8a30('0x54'),_0x47749f['params']['id'],_0x2e2844);var _0xc76227=path[_0x8a30('0x4f')](_0x1aaeb0,_0x2cd5ec);var _0x5e8d29=[];_0x5e8d29[_0x8a30('0x55')]({'model':db[_0x8a30('0x56')],'as':'Attachment','raw':!![]});var _0x3b7184=[{'model':db[_0x8a30('0x39')],'as':_0x8a30('0x57'),'attributes':['id',_0x8a30('0x36'),'createdAt'],'include':_0x5e8d29}];return db['FaxInteraction'][_0x8a30('0x34')]({'where':{'id':_0x47749f[_0x8a30('0x28')]['id']},'include':_0x3b7184})[_0x8a30('0x18')](handleEntityNotFound(_0x4c1e41,null))['then'](function(_0x1737dd){if(_0x1737dd&&_0x1737dd[_0x8a30('0x57')]){var _0x1ec67b=_0x1737dd[_0x8a30('0x58')]({'plain':!![]});fs['mkdirSync'](_0x3bee7c);for(var _0x505386=0x0;_0x505386<_0x1ec67b[_0x8a30('0x57')][_0x8a30('0x2f')];_0x505386++){var _0x2c93e3=_0x1ec67b[_0x8a30('0x57')][_0x505386][_0x8a30('0x56')];if(_0x2c93e3){var _0x10d682=path[_0x8a30('0x4f')](_0x351ed5,_0x2c93e3[_0x8a30('0x59')]);if(fs['existsSync'](_0x10d682)){fs[_0x8a30('0x5a')](_0x10d682)[_0x8a30('0x5b')](fs[_0x8a30('0x5c')](path['join'](_0x3bee7c,_0x2c93e3[_0x8a30('0x59')])));}}}return BPromise[_0x8a30('0x5d')]()[_0x8a30('0x18')](function(){return new BPromise(function(_0x198173,_0x1eb7ec){zipdir(_0x3bee7c,{'saveTo':_0xc76227},function(_0x5f0e08,_0x2e3ba5){if(_0x5f0e08)return _0x1eb7ec(_0x5f0e08);return _0x198173(_0x2e3ba5);});})[_0x8a30('0x18')](function(){return new BPromise(function(_0x491a75,_0x1850b4){rimraf(_0x3bee7c,function(_0x1e08ee){if(_0x1e08ee)_0x1850b4(_0x1e08ee);return _0x491a75();});});})['then'](function(){return _0x4c1e41[_0x8a30('0x5e')](_0xc76227,_0x2cd5ec,function(_0x2a392d){if(_0x2a392d){console[_0x8a30('0x5f')](_0x8a30('0x60'),_0x2a392d);}else{fs[_0x8a30('0x61')](_0xc76227);}});});});}else{return _0x4c1e41['sendStatus'](0xc8);}})[_0x8a30('0x26')](handleError(_0x4c1e41,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 836aa93..9748e96 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 _0xef5c=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xef5c,0x189));var _0xcef5=function(_0x3f5039,_0x504468){_0x3f5039=_0x3f5039-0x0;var _0x2520b1=_0xef5c[_0x3f5039];return _0x2520b1;};'use strict';var EventEmitter=require(_0xcef5('0x0'));var FaxInteraction=require(_0xcef5('0x1'))['db']['FaxInteraction'];var FaxMessage=require('../../mysqldb')['db'][_0xcef5('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xcef5('0x3')](0x0);var events={'afterCreate':_0xcef5('0x4'),'afterUpdate':_0xcef5('0x5'),'afterDestroy':_0xcef5('0x6')};function emitEvent(_0x11616c){return function(_0x5793ab,_0x13addc,_0x13da49){_0x5793ab[_0xcef5('0x7')]({'attributes':['id'],'raw':!![]})[_0xcef5('0x8')](function(_0x31a2db){_0x5793ab[_0xcef5('0x9')](_0xcef5('0xa'),_0x31a2db['map'](function(_0x286ed7){return{'id':_0x286ed7['id']};}));return FaxMessage[_0xcef5('0xb')]({'where':{'FaxInteractionId':_0x5793ab['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1733f4){_0x5793ab[_0xcef5('0x9')](_0xcef5('0xc'),_0x1733f4[_0xcef5('0xd')]);FaxInteractionEvents[_0xcef5('0xe')](_0x11616c+':'+_0x5793ab['id'],_0x5793ab);FaxInteractionEvents[_0xcef5('0xe')](_0x11616c,_0x5793ab);_0x13da49(null);})[_0xcef5('0xf')](_0x13da49(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xcef5('0x10')](e,emitEvent(event));}}module[_0xcef5('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0x1701=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','save','update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1701,0x9c));var _0x1170=function(_0x235282,_0x350d6f){_0x235282=_0x235282-0x0;var _0x128e15=_0x1701[_0x235282];return _0x128e15;};'use strict';var EventEmitter=require(_0x1170('0x0'));var FaxInteraction=require(_0x1170('0x1'))['db'][_0x1170('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x1170('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1170('0x4'),'afterUpdate':_0x1170('0x5'),'afterDestroy':_0x1170('0x6')};function emitEvent(_0x9d4b21){return function(_0x2381e2,_0x21dd6d,_0x2b06ee){_0x2381e2[_0x1170('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3de5ee){_0x2381e2[_0x1170('0x8')](_0x1170('0x9'),_0x3de5ee[_0x1170('0xa')](function(_0xeaeabc){return{'id':_0xeaeabc['id']};}));return FaxMessage[_0x1170('0xb')]({'where':{'FaxInteractionId':_0x2381e2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1170('0xc')](function(_0x4f2c09){_0x2381e2[_0x1170('0x8')](_0x1170('0xd'),_0x4f2c09[_0x1170('0xe')]);FaxInteractionEvents['emit'](_0x9d4b21+':'+_0x2381e2['id'],_0x2381e2);FaxInteractionEvents['emit'](_0x9d4b21,_0x2381e2);_0x2b06ee(null);})[_0x1170('0xf')](_0x2b06ee(null));};}for(var e in events){if(events[_0x1170('0x10')](e)){var event=events[e];FaxInteraction[_0x1170('0x11')](e,emitEvent(event));}}module[_0x1170('0x12')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index d2bee82..5d717c6 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 _0xa688=['define','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxInteraction.attributes','exports'];(function(_0x10642e,_0x454f1c){var _0x3288ad=function(_0x447695){while(--_0x447695){_0x10642e['push'](_0x10642e['shift']());}};_0x3288ad(++_0x454f1c);}(_0xa688,0x1f4));var _0x8a68=function(_0x33b9ac,_0x1cd671){_0x33b9ac=_0x33b9ac-0x0;var _0x4da2a0=_0xa688[_0x33b9ac];return _0x4da2a0;};'use strict';var _=require('lodash');var util=require(_0x8a68('0x0'));var logger=require(_0x8a68('0x1'))(_0x8a68('0x2'));var moment=require(_0x8a68('0x3'));var BPromise=require(_0x8a68('0x4'));var rp=require(_0x8a68('0x5'));var fs=require('fs');var path=require(_0x8a68('0x6'));var rimraf=require(_0x8a68('0x7'));var config=require('../../config/environment');var attributes=require(_0x8a68('0x8'));module[_0x8a68('0x9')]=function(_0x4e6707,_0x33d52d){return _0x4e6707[_0x8a68('0xa')](_0x8a68('0xb'),attributes,{'tableName':_0x8a68('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x21f3e7,_0x4f0499,_0x529d5e){if(_0x21f3e7[_0x8a68('0xd')](_0x8a68('0xe'))){_0x21f3e7[_0x8a68('0xf')]=moment()['format'](_0x8a68('0x10'));}_0x529d5e(null,_0x21f3e7);}}});}; \ No newline at end of file +var _0x803d=['fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','FaxInteraction'];(function(_0x3d5356,_0x10e41a){var _0x40c6b6=function(_0x2babe5){while(--_0x2babe5){_0x3d5356['push'](_0x3d5356['shift']());}};_0x40c6b6(++_0x10e41a);}(_0x803d,0x15a));var _0xd803=function(_0x2d5938,_0x1fc643){_0x2d5938=_0x2d5938-0x0;var _0x4c76b9=_0x803d[_0x2d5938];return _0x4c76b9;};'use strict';var _=require(_0xd803('0x0'));var util=require('util');var logger=require(_0xd803('0x1'))(_0xd803('0x2'));var moment=require(_0xd803('0x3'));var BPromise=require(_0xd803('0x4'));var rp=require(_0xd803('0x5'));var fs=require('fs');var path=require(_0xd803('0x6'));var rimraf=require('rimraf');var config=require(_0xd803('0x7'));var attributes=require('./faxInteraction.attributes');module[_0xd803('0x8')]=function(_0x6106e5,_0x6e439e){return _0x6106e5[_0xd803('0x9')](_0xd803('0xa'),attributes,{'tableName':_0xd803('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4f4973,_0x186345,_0x1edf1b){if(_0x4f4973[_0xd803('0xc')](_0xd803('0xd'))){_0x4f4973[_0xd803('0xe')]=moment()[_0xd803('0xf')](_0xd803('0x10'));}_0x1edf1b(null,_0x4f4973);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 107be4b..8eb0c95 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 _0xf2d3=['body','options','raw','attributes','limit','then','debug','AddTagsToFaxInteraction','find','where','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update'];(function(_0x410422,_0x4b6eb9){var _0x1b329c=function(_0x19f5aa){while(--_0x19f5aa){_0x410422['push'](_0x410422['shift']());}};_0x1b329c(++_0x4b6eb9);}(_0xf2d3,0x1b5));var _0x3f2d=function(_0x272e6c,_0x51046b){_0x272e6c=_0x272e6c-0x0;var _0x3007c9=_0xf2d3[_0x272e6c];return _0x3007c9;};'use strict';var _=require(_0x3f2d('0x0'));var util=require(_0x3f2d('0x1'));var moment=require(_0x3f2d('0x2'));var BPromise=require(_0x3f2d('0x3'));var rs=require(_0x3f2d('0x4'));var fs=require('fs');var Redis=require(_0x3f2d('0x5'));var db=require(_0x3f2d('0x6'))['db'];var utils=require(_0x3f2d('0x7'));var logger=require(_0x3f2d('0x8'))(_0x3f2d('0x9'));var config=require(_0x3f2d('0xa'));var jayson=require(_0x3f2d('0xb'));var client=jayson['client'][_0x3f2d('0xc')]({'port':0x232a});config[_0x3f2d('0xd')]=_[_0x3f2d('0xe')](config[_0x3f2d('0xd')],{'host':_0x3f2d('0xf'),'port':0x18eb});var socket=require(_0x3f2d('0x10'))(new Redis(config[_0x3f2d('0xd')]));require(_0x3f2d('0x11'))[_0x3f2d('0x12')](socket);function respondWithRpcPromise(_0x1e8e45,_0x25c7b5,_0x288347){return new BPromise(function(_0x30807d,_0x533fc8){return client[_0x3f2d('0x13')](_0x1e8e45,_0x288347)['then'](function(_0x36bcee){logger[_0x3f2d('0x14')](_0x3f2d('0x15'),_0x25c7b5,'request\x20sent');logger['debug'](_0x3f2d('0x16'),_0x25c7b5,_0x3f2d('0x17'),JSON[_0x3f2d('0x18')](_0x36bcee));if(_0x36bcee[_0x3f2d('0x19')]){if(_0x36bcee[_0x3f2d('0x19')][_0x3f2d('0x1a')]===0x1f4){logger['error'](_0x3f2d('0x15'),_0x25c7b5,_0x36bcee[_0x3f2d('0x19')][_0x3f2d('0x1b')]);return _0x533fc8(_0x36bcee[_0x3f2d('0x19')][_0x3f2d('0x1b')]);}logger['error'](_0x3f2d('0x15'),_0x25c7b5,_0x36bcee[_0x3f2d('0x19')][_0x3f2d('0x1b')]);return _0x30807d(_0x36bcee['error']['message']);}else{logger[_0x3f2d('0x14')](_0x3f2d('0x15'),_0x25c7b5,_0x3f2d('0x17'));_0x30807d(_0x36bcee[_0x3f2d('0x1c')]['message']);}})[_0x3f2d('0x1d')](function(_0x440c84){logger['error'](_0x3f2d('0x15'),_0x25c7b5,_0x440c84);_0x533fc8(_0x440c84);});});}exports[_0x3f2d('0x1e')]=function(_0x2d40a9){var _0x44f536=this;return new Promise(function(_0x13d143,_0x18b156){return db[_0x3f2d('0x1f')][_0x3f2d('0x20')](_0x2d40a9[_0x3f2d('0x21')],{'raw':_0x2d40a9[_0x3f2d('0x22')]?_0x2d40a9[_0x3f2d('0x22')][_0x3f2d('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d40a9['options']?_0x2d40a9[_0x3f2d('0x22')]['where']||null:null,'attributes':_0x2d40a9[_0x3f2d('0x22')]?_0x2d40a9['options'][_0x3f2d('0x24')]||null:null,'limit':_0x2d40a9['options']?_0x2d40a9[_0x3f2d('0x22')][_0x3f2d('0x25')]||null:null})[_0x3f2d('0x26')](function(_0x5b19fb){logger['info'](_0x3f2d('0x1e'),_0x2d40a9);logger[_0x3f2d('0x27')](_0x3f2d('0x1e'),_0x2d40a9,JSON['stringify'](_0x5b19fb));_0x13d143(_0x5b19fb);})['catch'](function(_0x290b20){logger[_0x3f2d('0x19')]('UpdateFaxInteraction',_0x290b20[_0x3f2d('0x1b')],_0x2d40a9);_0x18b156(_0x44f536['error'](0x1f4,_0x290b20[_0x3f2d('0x1b')]));});});};exports[_0x3f2d('0x28')]=function(_0x215b6b){return new Promise(function(_0x13fab0,_0x56cc70){return db[_0x3f2d('0x1f')][_0x3f2d('0x29')]({'where':_0x215b6b['options']?_0x215b6b[_0x3f2d('0x22')][_0x3f2d('0x2a')]||null:null})[_0x3f2d('0x26')](function(_0x1bae07){if(_0x1bae07){return _0x1bae07[_0x3f2d('0x2b')](_0x215b6b[_0x3f2d('0x21')]['ids'],_['omit'](_0x215b6b[_0x3f2d('0x21')],[_0x3f2d('0x2c'),'id'])||{});}})[_0x3f2d('0x2d')](function(_0x11356c){logger[_0x3f2d('0x14')]('AddTags',_0x215b6b);logger['debug'](_0x3f2d('0x2e'),_0x215b6b,JSON[_0x3f2d('0x18')](_0x11356c));_0x13fab0(_0x11356c);})[_0x3f2d('0x1d')](function(_0x5e4295){logger[_0x3f2d('0x19')](_0x3f2d('0x2e'),_0x5e4295[_0x3f2d('0x1b')],_0x215b6b);_0x56cc70(_this[_0x3f2d('0x19')](0x1f4,_0x5e4295[_0x3f2d('0x1b')]));});});}; \ No newline at end of file +var _0xb879=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxInteraction,\x20%s,\x20%s','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','attributes','limit','find','where','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0xfa9eea,_0x2d1cf6){var _0x3d252f=function(_0x479699){while(--_0x479699){_0xfa9eea['push'](_0xfa9eea['shift']());}};_0x3d252f(++_0x2d1cf6);}(_0xb879,0x1bd));var _0x9b87=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xb879[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var util=require(_0x9b87('0x0'));var moment=require(_0x9b87('0x1'));var BPromise=require(_0x9b87('0x2'));var rs=require(_0x9b87('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b87('0x4'))['db'];var utils=require(_0x9b87('0x5'));var logger=require(_0x9b87('0x6'))(_0x9b87('0x7'));var config=require(_0x9b87('0x8'));var jayson=require(_0x9b87('0x9'));var client=jayson[_0x9b87('0xa')][_0x9b87('0xb')]({'port':0x232a});config[_0x9b87('0xc')]=_[_0x9b87('0xd')](config['redis'],{'host':_0x9b87('0xe'),'port':0x18eb});var socket=require(_0x9b87('0xf'))(new Redis(config[_0x9b87('0xc')]));require(_0x9b87('0x10'))[_0x9b87('0x11')](socket);function respondWithRpcPromise(_0x13b0ac,_0x1aa913,_0x4d629c){return new BPromise(function(_0x94cf14,_0x3b4eb1){return client[_0x9b87('0x12')](_0x13b0ac,_0x4d629c)[_0x9b87('0x13')](function(_0x1fb59a){logger[_0x9b87('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x1aa913,_0x9b87('0x15'));logger[_0x9b87('0x16')](_0x9b87('0x17'),_0x1aa913,'request\x20sent',JSON[_0x9b87('0x18')](_0x1fb59a));if(_0x1fb59a[_0x9b87('0x19')]){if(_0x1fb59a['error'][_0x9b87('0x1a')]===0x1f4){logger[_0x9b87('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x1aa913,_0x1fb59a[_0x9b87('0x19')][_0x9b87('0x1b')]);return _0x3b4eb1(_0x1fb59a['error'][_0x9b87('0x1b')]);}logger[_0x9b87('0x19')](_0x9b87('0x1c'),_0x1aa913,_0x1fb59a[_0x9b87('0x19')][_0x9b87('0x1b')]);return _0x94cf14(_0x1fb59a[_0x9b87('0x19')]['message']);}else{logger[_0x9b87('0x14')](_0x9b87('0x1c'),_0x1aa913,_0x9b87('0x15'));_0x94cf14(_0x1fb59a[_0x9b87('0x1d')]['message']);}})[_0x9b87('0x1e')](function(_0x5a70b0){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x1aa913,_0x5a70b0);_0x3b4eb1(_0x5a70b0);});});}exports[_0x9b87('0x1f')]=function(_0xc52056){var _0x33720b=this;return new Promise(function(_0x39d32f,_0x4d79f7){return db[_0x9b87('0x20')][_0x9b87('0x21')](_0xc52056[_0x9b87('0x22')],{'raw':_0xc52056['options']?_0xc52056['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc52056[_0x9b87('0x23')]?_0xc52056[_0x9b87('0x23')]['where']||null:null,'attributes':_0xc52056[_0x9b87('0x23')]?_0xc52056[_0x9b87('0x23')][_0x9b87('0x24')]||null:null,'limit':_0xc52056[_0x9b87('0x23')]?_0xc52056[_0x9b87('0x23')][_0x9b87('0x25')]||null:null})[_0x9b87('0x13')](function(_0x59db01){logger['info'](_0x9b87('0x1f'),_0xc52056);logger[_0x9b87('0x16')]('UpdateFaxInteraction',_0xc52056,JSON['stringify'](_0x59db01));_0x39d32f(_0x59db01);})[_0x9b87('0x1e')](function(_0x12a0c1){logger[_0x9b87('0x19')](_0x9b87('0x1f'),_0x12a0c1[_0x9b87('0x1b')],_0xc52056);_0x4d79f7(_0x33720b['error'](0x1f4,_0x12a0c1[_0x9b87('0x1b')]));});});};exports['AddTagsToFaxInteraction']=function(_0x48f9be){return new Promise(function(_0x4f9462,_0x1bf945){return db[_0x9b87('0x20')][_0x9b87('0x26')]({'where':_0x48f9be[_0x9b87('0x23')]?_0x48f9be[_0x9b87('0x23')][_0x9b87('0x27')]||null:null})[_0x9b87('0x13')](function(_0x375f79){if(_0x375f79){return _0x375f79[_0x9b87('0x28')](_0x48f9be[_0x9b87('0x22')][_0x9b87('0x29')],_[_0x9b87('0x2a')](_0x48f9be['body'],['ids','id'])||{});}})[_0x9b87('0x2b')](function(_0x5024a7){logger[_0x9b87('0x14')](_0x9b87('0x2c'),_0x48f9be);logger['debug'](_0x9b87('0x2c'),_0x48f9be,JSON['stringify'](_0x5024a7));_0x4f9462(_0x5024a7);})[_0x9b87('0x1e')](function(_0x240d0d){logger[_0x9b87('0x19')]('AddTags',_0x240d0d['message'],_0x48f9be);_0x1bf945(_this[_0x9b87('0x19')](0x1f4,_0x240d0d[_0x9b87('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 3a05900..3e07f17 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 _0x9bfe=['register','length','faxInteraction:','./faxInteraction.events','save','remove','update','emit','removeListener'];(function(_0x5a3d0a,_0x5bb673){var _0x439a4c=function(_0x188839){while(--_0x188839){_0x5a3d0a['push'](_0x5a3d0a['shift']());}};_0x439a4c(++_0x5bb673);}(_0x9bfe,0xae));var _0xe9bf=function(_0x377117,_0x5a91f6){_0x377117=_0x377117-0x0;var _0x15a5cf=_0x9bfe[_0x377117];return _0x15a5cf;};'use strict';var FaxInteractionEvents=require(_0xe9bf('0x0'));var events=[_0xe9bf('0x1'),_0xe9bf('0x2'),_0xe9bf('0x3')];function createListener(_0x2a64cd,_0x5710a0){return function(_0x5205e1){_0x5710a0[_0xe9bf('0x4')](_0x2a64cd,_0x5205e1);};}function removeListener(_0x31721e,_0x285e3c){return function(){FaxInteractionEvents[_0xe9bf('0x5')](_0x31721e,_0x285e3c);};}exports[_0xe9bf('0x6')]=function(_0x1b1381){for(var _0x31e408=0x0,_0x11951e=events[_0xe9bf('0x7')];_0x31e408<_0x11951e;_0x31e408++){var _0x1f1017=events[_0x31e408];var _0x17347c=createListener(_0xe9bf('0x8')+_0x1f1017,_0x1b1381);FaxInteractionEvents['on'](_0x1f1017,_0x17347c);}}; \ No newline at end of file +var _0xef29=['faxInteraction:','./faxInteraction.events','save','update','emit','register'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xef29,0x1c3));var _0x9ef2=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xef29[_0x40a045];return _0x1a687c;};'use strict';var FaxInteractionEvents=require(_0x9ef2('0x0'));var events=[_0x9ef2('0x1'),'remove',_0x9ef2('0x2')];function createListener(_0x1ddab1,_0x394d01){return function(_0x2f88b3){_0x394d01[_0x9ef2('0x3')](_0x1ddab1,_0x2f88b3);};}function removeListener(_0x4e0ce3,_0x1948ac){return function(){FaxInteractionEvents['removeListener'](_0x4e0ce3,_0x1948ac);};}exports[_0x9ef2('0x4')]=function(_0x3cb50a){for(var _0x398553=0x0,_0x4f99df=events['length'];_0x398553<_0x4f99df;_0x398553++){var _0x496f58=events[_0x398553];var _0x20b509=createListener(_0x9ef2('0x5')+_0x496f58,_0x3cb50a);FaxInteractionEvents['on'](_0x496f58,_0x20b509);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 3576363..95851a3 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 _0xb172=['addTags','faxinteraction:update','update','delete','removeTags','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','download','post','create','addMessage','/:id/tags','tracked','fax'];(function(_0x240932,_0x56228f){var _0x223224=function(_0x59e0d3){while(--_0x59e0d3){_0x240932['push'](_0x240932['shift']());}};_0x223224(++_0x56228f);}(_0xb172,0x75));var _0x2b17=function(_0x11c89d,_0x432a42){_0x11c89d=_0x11c89d-0x0;var _0x4286c2=_0xb172[_0x11c89d];return _0x4286c2;};'use strict';var multer=require(_0x2b17('0x0'));var util=require(_0x2b17('0x1'));var path=require(_0x2b17('0x2'));var timeout=require('connect-timeout');var express=require(_0x2b17('0x3'));var router=express[_0x2b17('0x4')]();var fs_extra=require(_0x2b17('0x5'));var auth=require(_0x2b17('0x6'));var interaction=require(_0x2b17('0x7'));var config=require('../../config/environment');var controller=require(_0x2b17('0x8'));router[_0x2b17('0x9')]('/',auth[_0x2b17('0xa')](),controller[_0x2b17('0xb')]);router[_0x2b17('0x9')]('/describe',auth[_0x2b17('0xa')](),controller[_0x2b17('0xc')]);router['get'](_0x2b17('0xd'),auth[_0x2b17('0xa')](),controller[_0x2b17('0xe')]);router['get'](_0x2b17('0xf'),auth[_0x2b17('0xa')](),controller['getMessages']);router[_0x2b17('0x9')]('/:id/download',auth[_0x2b17('0xa')](),controller[_0x2b17('0x10')]);router[_0x2b17('0x11')]('/',auth[_0x2b17('0xa')](),controller[_0x2b17('0x12')]);router['post'](_0x2b17('0xf'),auth['isAuthenticated'](),controller[_0x2b17('0x13')]);router['post'](_0x2b17('0x14'),auth[_0x2b17('0xa')](),interaction[_0x2b17('0x15')](_0x2b17('0x16'),'faxinteraction:addtags'),controller[_0x2b17('0x17')]);router['put'](_0x2b17('0xd'),auth[_0x2b17('0xa')](),interaction[_0x2b17('0x15')](_0x2b17('0x16'),_0x2b17('0x18')),controller[_0x2b17('0x19')]);router[_0x2b17('0x1a')](_0x2b17('0xd'),auth[_0x2b17('0xa')](),interaction[_0x2b17('0x15')](_0x2b17('0x16'),'faxinteraction:destroy'),controller['destroy']);router[_0x2b17('0x1a')]('/:id/tags',auth[_0x2b17('0xa')](),controller[_0x2b17('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xf596=['addTags','put','update','delete','faxinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags'];(function(_0x3cc90b,_0x1b69d9){var _0x34051b=function(_0x1f01f7){while(--_0x1f01f7){_0x3cc90b['push'](_0x3cc90b['shift']());}};_0x34051b(++_0x1b69d9);}(_0xf596,0xd3));var _0x6f59=function(_0x356719,_0x1be5ac){_0x356719=_0x356719-0x0;var _0xee4c46=_0xf596[_0x356719];return _0xee4c46;};'use strict';var multer=require(_0x6f59('0x0'));var util=require(_0x6f59('0x1'));var path=require(_0x6f59('0x2'));var timeout=require(_0x6f59('0x3'));var express=require(_0x6f59('0x4'));var router=express[_0x6f59('0x5')]();var fs_extra=require(_0x6f59('0x6'));var auth=require(_0x6f59('0x7'));var interaction=require(_0x6f59('0x8'));var config=require(_0x6f59('0x9'));var controller=require(_0x6f59('0xa'));router[_0x6f59('0xb')]('/',auth[_0x6f59('0xc')](),controller[_0x6f59('0xd')]);router[_0x6f59('0xb')]('/describe',auth[_0x6f59('0xc')](),controller['describe']);router[_0x6f59('0xb')](_0x6f59('0xe'),auth[_0x6f59('0xc')](),controller[_0x6f59('0xf')]);router['get'](_0x6f59('0x10'),auth[_0x6f59('0xc')](),controller[_0x6f59('0x11')]);router[_0x6f59('0xb')](_0x6f59('0x12'),auth[_0x6f59('0xc')](),controller[_0x6f59('0x13')]);router[_0x6f59('0x14')]('/',auth[_0x6f59('0xc')](),controller[_0x6f59('0x15')]);router[_0x6f59('0x14')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6f59('0x16')]);router['post'](_0x6f59('0x17'),auth[_0x6f59('0xc')](),interaction[_0x6f59('0x18')](_0x6f59('0x19'),_0x6f59('0x1a')),controller[_0x6f59('0x1b')]);router[_0x6f59('0x1c')]('/:id',auth[_0x6f59('0xc')](),interaction[_0x6f59('0x18')](_0x6f59('0x19'),'faxinteraction:update'),controller[_0x6f59('0x1d')]);router[_0x6f59('0x1e')](_0x6f59('0xe'),auth[_0x6f59('0xc')](),interaction['tracked'](_0x6f59('0x19'),_0x6f59('0x1f')),controller['destroy']);router[_0x6f59('0x1e')](_0x6f59('0x17'),auth[_0x6f59('0xc')](),controller[_0x6f59('0x20')]);module[_0x6f59('0x21')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 67dfeb5..0a2d81c 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 _0xdad2=['out','DATE','exports','TEXT','BOOLEAN','ENUM'];(function(_0x572dd3,_0x56be84){var _0x32c62c=function(_0x5b06df){while(--_0x5b06df){_0x572dd3['push'](_0x572dd3['shift']());}};_0x32c62c(++_0x56be84);}(_0xdad2,0x14c));var _0x2dad=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xdad2[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require('sequelize');module[_0x2dad('0x0')]={'body':{'type':Sequelize[_0x2dad('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2dad('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2dad('0x3')]('in',_0x2dad('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x2dad('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x2dad('0x5')]}}; \ No newline at end of file +var _0xc73e=['BOOLEAN','TEXT','DATE','sequelize','exports','medium'];(function(_0x3de873,_0x174b5f){var _0x380b8c=function(_0x313dea){while(--_0x313dea){_0x3de873['push'](_0x3de873['shift']());}};_0x380b8c(++_0x174b5f);}(_0xc73e,0x1e9));var _0xec73=function(_0x2a43c5,_0x143472){_0x2a43c5=_0x2a43c5-0x0;var _0x14902f=_0xc73e[_0x2a43c5];return _0x14902f;};'use strict';var Sequelize=require(_0xec73('0x0'));module[_0xec73('0x1')]={'body':{'type':Sequelize['TEXT'](_0xec73('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xec73('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xec73('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0xec73('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index a7f905f..b51d5e6 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 _0x74f3=['SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','create','findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','basename','files','attachments','download','join','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','fax-interactions','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','json','undefined','limit','offset','status','set','update','destroy','end','sendStatus','stack','name','map','FaxMessage','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','body','describe','accept','sms','fax','acceptMessage','UserId','user','agent','get','FaxInteraction','FaxInteractionId','interaction','info','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','interface','format'];(function(_0x5c5243,_0xa871bd){var _0x19a0e5=function(_0x278613){while(--_0x278613){_0x5c5243['push'](_0x5c5243['shift']());}};_0x19a0e5(++_0xa871bd);}(_0x74f3,0x83));var _0x374f=function(_0x22fd30,_0x3d7bcc){_0x22fd30=_0x22fd30-0x0;var _0x7305ff=_0x74f3[_0x22fd30];return _0x7305ff;};'use strict';var util=require('util');var path=require(_0x374f('0x0'));var _=require(_0x374f('0x1'));var Redis=require(_0x374f('0x2'));var interactionService=require('../../components/interaction/service');var qs=require(_0x374f('0x3'));var logger=require(_0x374f('0x4'))(_0x374f('0x5'));var config=require(_0x374f('0x6'));var db=require(_0x374f('0x7'))['db'];config[_0x374f('0x8')]=_[_0x374f('0x9')](config[_0x374f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x374f('0xa'))(new Redis(config[_0x374f('0x8')]));require('./faxMessage.socket')[_0x374f('0xb')](socket);var jayson=require(_0x374f('0xc'));var client=jayson[_0x374f('0xd')][_0x374f('0xe')]({'port':0x232c});var client9002=jayson['client'][_0x374f('0xe')]({'port':0x232a});var interaction_log=require(_0x374f('0x4'))(_0x374f('0xf'));function respondWithRpcPromise(_0x2f9589,_0x163f58,_0x19ffd9,_0x23c80c){return new Promise(function(_0x3283ef,_0x13da16){var _0x3425f8=_0x23c80c||client;return _0x3425f8['request'](_0x2f9589,_0x19ffd9)[_0x374f('0x10')](function(_0x85432e){logger['info'](_0x374f('0x11'),_0x163f58,_0x374f('0x12'));logger[_0x374f('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x163f58,_0x374f('0x12'),JSON[_0x374f('0x14')](_0x85432e));if(_0x85432e['error']){if(_0x85432e['error']['code']===0x1f4){logger[_0x374f('0x15')](_0x374f('0x11'),_0x163f58,_0x85432e[_0x374f('0x15')][_0x374f('0x16')]);return _0x13da16(_0x85432e[_0x374f('0x15')]['message']);}logger[_0x374f('0x15')]('FaxMessage,\x20%s,\x20%s',_0x163f58,_0x85432e[_0x374f('0x15')][_0x374f('0x16')]);return _0x3283ef(_0x85432e[_0x374f('0x15')][_0x374f('0x16')]);}else{logger['info'](_0x374f('0x11'),_0x163f58,_0x374f('0x12'));_0x3283ef(_0x85432e[_0x374f('0x17')]['message']);}})[_0x374f('0x18')](function(_0x5b6284){logger['error'](_0x374f('0x11'),_0x163f58,_0x5b6284);_0x13da16(_0x5b6284);});});}function respondWithResult(_0x110167,_0x193a08){_0x193a08=_0x193a08||0xc8;return function(_0x539386){if(_0x539386){return _0x110167['status'](_0x193a08)[_0x374f('0x19')](_0x539386);}};}function respondWithFilteredResult(_0x444511,_0x586a6e){return function(_0x4bcea7){if(_0x4bcea7){var _0x18ee8d=typeof _0x586a6e['offset']===_0x374f('0x1a')&&typeof _0x586a6e[_0x374f('0x1b')]===_0x374f('0x1a');var _0x375ad5=_0x4bcea7['count'];var _0x43ce64=_0x18ee8d?0x0:_0x586a6e[_0x374f('0x1c')];var _0x4b2a1f=_0x18ee8d?_0x4bcea7['count']:_0x586a6e[_0x374f('0x1c')]+_0x586a6e['limit'];var _0x12b239;if(_0x4b2a1f>=_0x375ad5){_0x4b2a1f=_0x375ad5;_0x12b239=0xc8;}else{_0x12b239=0xce;}_0x444511[_0x374f('0x1d')](_0x12b239);return _0x444511[_0x374f('0x1e')]('Content-Range',_0x43ce64+'-'+_0x4b2a1f+'/'+_0x375ad5)[_0x374f('0x19')](_0x4bcea7);}return null;};}function saveUpdates(_0x33880e){return function(_0x260df6){if(_0x260df6){return _0x260df6[_0x374f('0x1f')](_0x33880e)['then'](function(_0x173557){return _0x173557;});}return null;};}function removeEntity(_0x1c4b34){return function(_0x1b214c){if(_0x1b214c){return _0x1b214c[_0x374f('0x20')]()['then'](function(){_0x1c4b34[_0x374f('0x1d')](0xcc)[_0x374f('0x21')]();});}};}function handleEntityNotFound(_0x3c8ceb){return function(_0x3aff5a){if(!_0x3aff5a){_0x3c8ceb[_0x374f('0x22')](0x194);}return _0x3aff5a;};}function handleError(_0x1999cf,_0x49a27a){_0x49a27a=_0x49a27a||0x1f4;return function(_0x18e427){logger[_0x374f('0x15')](_0x18e427[_0x374f('0x23')]);if(_0x18e427[_0x374f('0x24')]){delete _0x18e427[_0x374f('0x24')];}_0x1999cf[_0x374f('0x1d')](_0x49a27a)['send'](_0x18e427);};}exports['index']=function(_0x511504,_0x24fb5c){var _0x541e17={},_0x4e72d4={},_0x273852={'count':0x0,'rows':[]};var _0x229400=_[_0x374f('0x25')](db[_0x374f('0x26')][_0x374f('0x27')],function(_0x6c4ec0){return{'name':_0x6c4ec0[_0x374f('0x28')],'type':_0x6c4ec0['type'][_0x374f('0x29')]};});_0x4e72d4['model']=_[_0x374f('0x25')](_0x229400,_0x374f('0x24'));_0x4e72d4[_0x374f('0x2a')]=_['keys'](_0x511504['query']);_0x4e72d4[_0x374f('0x2b')]=_[_0x374f('0x2c')](_0x4e72d4[_0x374f('0x2d')],_0x4e72d4[_0x374f('0x2a')]);_0x541e17['attributes']=_[_0x374f('0x2c')](_0x4e72d4[_0x374f('0x2d')],qs[_0x374f('0x2e')](_0x511504[_0x374f('0x2a')][_0x374f('0x2e')]));_0x541e17[_0x374f('0x2f')]=_0x541e17[_0x374f('0x2f')][_0x374f('0x30')]?_0x541e17[_0x374f('0x2f')]:_0x4e72d4[_0x374f('0x2d')];if(!_0x511504[_0x374f('0x2a')][_0x374f('0x31')](_0x374f('0x32'))){_0x541e17[_0x374f('0x1b')]=qs[_0x374f('0x1b')](_0x511504['query'][_0x374f('0x1b')]);_0x541e17['offset']=qs['offset'](_0x511504[_0x374f('0x2a')]['offset']);}_0x541e17[_0x374f('0x33')]=qs[_0x374f('0x34')](_0x511504[_0x374f('0x2a')][_0x374f('0x34')]);_0x541e17['where']=qs[_0x374f('0x2b')](_[_0x374f('0x35')](_0x511504['query'],_0x4e72d4['filters']),_0x229400);if(_0x511504[_0x374f('0x2a')][_0x374f('0x36')]){_0x541e17[_0x374f('0x37')]=_[_0x374f('0x38')](_0x541e17[_0x374f('0x37')],{'$or':_['map'](_0x229400,function(_0x5bb26e){if(_0x5bb26e[_0x374f('0x39')]!==_0x374f('0x3a')){var _0x43d266={};_0x43d266[_0x5bb26e[_0x374f('0x24')]]={'$like':'%'+_0x511504[_0x374f('0x2a')][_0x374f('0x36')]+'%'};return _0x43d266;}})});}_0x541e17=_[_0x374f('0x38')]({},_0x541e17,_0x511504[_0x374f('0x3b')]);var _0x3403a9={'where':_0x541e17[_0x374f('0x37')]};return db[_0x374f('0x26')]['count'](_0x3403a9)[_0x374f('0x10')](function(_0xd0dca0){_0x273852['count']=_0xd0dca0;if(_0x511504[_0x374f('0x2a')]['includeAll']){_0x541e17['include']=[{'all':!![]}];}return db['FaxMessage'][_0x374f('0x3c')](_0x541e17);})[_0x374f('0x10')](function(_0x5577b4){_0x273852[_0x374f('0x3d')]=_0x5577b4;return _0x273852;})[_0x374f('0x10')](respondWithFilteredResult(_0x24fb5c,_0x541e17))[_0x374f('0x18')](handleError(_0x24fb5c,null));};exports[_0x374f('0x3e')]=function(_0x38f566,_0x4d900f){var _0x5ed2c3={'raw':!![],'where':{'id':_0x38f566[_0x374f('0x3f')]['id']}},_0x1f445a={};_0x1f445a[_0x374f('0x2d')]=_['keys'](db['FaxMessage'][_0x374f('0x27')]);_0x1f445a[_0x374f('0x2a')]=_['keys'](_0x38f566[_0x374f('0x2a')]);_0x1f445a[_0x374f('0x2b')]=_[_0x374f('0x2c')](_0x1f445a['model'],_0x1f445a[_0x374f('0x2a')]);_0x5ed2c3[_0x374f('0x2f')]=_[_0x374f('0x2c')](_0x1f445a[_0x374f('0x2d')],qs['fields'](_0x38f566[_0x374f('0x2a')][_0x374f('0x2e')]));_0x5ed2c3[_0x374f('0x2f')]=_0x5ed2c3[_0x374f('0x2f')]['length']?_0x5ed2c3[_0x374f('0x2f')]:_0x1f445a[_0x374f('0x2d')];if(_0x38f566[_0x374f('0x2a')][_0x374f('0x40')]){_0x5ed2c3[_0x374f('0x41')]=[{'all':!![]}];}_0x5ed2c3=_[_0x374f('0x38')]({},_0x5ed2c3,_0x38f566[_0x374f('0x3b')]);return db['FaxMessage'][_0x374f('0x42')](_0x5ed2c3)[_0x374f('0x10')](handleEntityNotFound(_0x4d900f,null))['then'](respondWithResult(_0x4d900f,null))[_0x374f('0x18')](handleError(_0x4d900f,null));};exports[_0x374f('0x1f')]=function(_0x434596,_0x401a2f){if(_0x434596['body']['id']){delete _0x434596[_0x374f('0x43')]['id'];}return db[_0x374f('0x26')][_0x374f('0x42')]({'where':{'id':_0x434596[_0x374f('0x3f')]['id']}})[_0x374f('0x10')](handleEntityNotFound(_0x401a2f,null))[_0x374f('0x10')](saveUpdates(_0x434596['body'],null))[_0x374f('0x10')](respondWithResult(_0x401a2f,null))[_0x374f('0x18')](handleError(_0x401a2f,null));};exports[_0x374f('0x20')]=function(_0x5d2e8b,_0x1e925b){return db[_0x374f('0x26')][_0x374f('0x42')]({'where':{'id':_0x5d2e8b[_0x374f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1e925b,null))[_0x374f('0x10')](removeEntity(_0x1e925b,null))[_0x374f('0x18')](handleError(_0x1e925b,null));};exports['describe']=function(_0x9bb99b,_0x432b98){return db[_0x374f('0x26')][_0x374f('0x44')]()[_0x374f('0x10')](respondWithResult(_0x432b98,null))['catch'](handleError(_0x432b98,null));};exports[_0x374f('0x45')]=function(_0x2b53f6,_0x13a8ac){var _0x654a29=_0x374f('0x46');return interactionService['acceptMessage'](_0x2b53f6,_0x654a29)[_0x374f('0x10')](respondWithResult(_0x13a8ac,null))[_0x374f('0x18')](handleError(_0x13a8ac,null));};exports[_0x374f('0x45')]=function(_0x4a773a,_0x4c23a1){var _0x339a93=_0x374f('0x47');return interactionService[_0x374f('0x48')](_0x4a773a,_0x339a93)['then'](respondWithResult(_0x4c23a1,null))[_0x374f('0x18')](handleError(_0x4c23a1,null));};exports['reject']=function(_0x116e12,_0x28c1ab){var _0x31728d={'agent':{},'channel':'fax'};if(_0x116e12[_0x374f('0x43')]['id']){delete _0x116e12['body']['id'];}_0x116e12[_0x374f('0x43')][_0x374f('0x49')]=_0x116e12['body'][_0x374f('0x49')]||_0x116e12[_0x374f('0x4a')]['id'];_0x31728d[_0x374f('0x4b')]['id']=_0x116e12['body'][_0x374f('0x49')];return db[_0x374f('0x26')][_0x374f('0x42')]({'where':{'id':_0x116e12['params']['id'],'UserId':null}})[_0x374f('0x10')](handleEntityNotFound(_0x28c1ab,null))['then'](function(_0x4c9b7e){if(_0x4c9b7e){_0x31728d[_0x374f('0x16')]=_0x4c9b7e[_0x374f('0x4c')]({'plain':!![]});return db[_0x374f('0x4d')]['find']({'where':{'id':_0x4c9b7e[_0x374f('0x4e')]}});}return null;})[_0x374f('0x10')](handleEntityNotFound(_0x28c1ab,null))[_0x374f('0x10')](function(_0x31b0c4){if(_0x31b0c4){_0x31728d[_0x374f('0x4f')]=_0x31b0c4['get']({'plain':!![]});interaction_log[_0x374f('0x50')](_0x374f('0x51'),_0x116e12['user']['id'],_0x116e12[_0x374f('0x4a')][_0x374f('0x24')],_0x116e12[_0x374f('0x4a')][_0x374f('0x52')],_0x31728d['interaction']['id'],_0x116e12[_0x374f('0x43')]?JSON[_0x374f('0x14')](_0x116e12[_0x374f('0x43')]):_0x374f('0x53'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x31728d);}return null;})[_0x374f('0x10')](function(_0x441655){var _0x1860f1=_0x374f('0x54')+_0x441655[_0x374f('0x16')][_0x374f('0x55')];return db['sequelize'][_0x374f('0x2a')](_0x1860f1,{'type':db[_0x374f('0x56')][_0x374f('0x57')][_0x374f('0x58')],'raw':!![]})[_0x374f('0x10')](function(_0x3004f6){return _0x3004f6;});})['then'](function(_0x1bd6c0){if(_0x1bd6c0){_0x31728d[_0x374f('0x16')][_0x374f('0x59')]=_0x1bd6c0[0x0];if(!_0x116e12[_0x374f('0x43')][_0x374f('0x49')])return;return db[_0x374f('0x5a')][_0x374f('0x42')]({'where':{'id':_0x116e12[_0x374f('0x43')][_0x374f('0x49')],'role':_0x374f('0x4b')},'attributes':['id',_0x374f('0x24'),_0x374f('0x5b'),_0x374f('0x5c'),'internal'],'raw':!![]});}return null;})[_0x374f('0x10')](function(_0x331271){if(!_0x331271)return null;_0x31728d[_0x374f('0x16')][_0x374f('0x4b')]=_0x331271;return _0x31728d;})[_0x374f('0x10')](function(_0x5ec27f){if(_0x5ec27f){_0x5ec27f[_0x374f('0x16')][_0x374f('0x5d')]=util[_0x374f('0x5e')](_0x374f('0x5f'),_0x116e12[_0x374f('0x4a')][_0x374f('0x24')]);_0x5ec27f[_0x374f('0x16')][_0x374f('0x60')]=_0x31728d[_0x374f('0x60')];_0x5ec27f['message'][_0x374f('0x61')]=_0x31728d['channel'];_0x5ec27f[_0x374f('0x16')][_0x374f('0x62')]='reject';respondWithRpcPromise('EventManager',_0x374f('0x63'),{'event':_0x374f('0x64'),'message':_0x5ec27f[_0x374f('0x16')]},client9002);return _0x31728d;}return null;})[_0x374f('0x10')](respondWithResult(_0x28c1ab,null))[_0x374f('0x18')](handleError(_0x28c1ab,null));};exports[_0x374f('0x65')]=function(_0x286230,_0x76e45d){var _0x2e582e;return db[_0x374f('0x26')][_0x374f('0x65')](_0x286230['body'],{})[_0x374f('0x10')](function(_0x20d87e){_0x2e582e=_0x20d87e;return db['CmContact'][_0x374f('0x66')]({'where':{'id':_0x2e582e['ContactId']}});})[_0x374f('0x10')](function(_0x4998c6){if(_[_0x374f('0x67')](_0x4998c6)){return;}else{_0x2e582e[_0x374f('0x47')]=_0x4998c6[_0x374f('0x47')];return db[_0x374f('0x68')]['findOne']({'where':{'id':_0x2e582e[_0x374f('0x69')]}});}})['then'](function(_0x2c40a9){return respondWithRpcPromise(_0x374f('0x6a'),'SendFax',{'FaxAccountId':_[_0x374f('0x67')](_0x286230[_0x374f('0x43')])?undefined:_0x286230[_0x374f('0x43')][_0x374f('0x6b')],'path':_[_0x374f('0x67')](_0x2c40a9)?undefined:util[_0x374f('0x5e')]('/var/opt/motion2/server/files/attachments/%s',_0x2c40a9[_0x374f('0x6c')]),'fax':_['isNil'](_0x2e582e[_0x374f('0x47')])?undefined:_0x2e582e[_0x374f('0x47')],'AttachmentId':_0x2e582e['AttachmentId']},client9002);})[_0x374f('0x10')](respondWithResult(_0x76e45d,0xc9))['catch'](handleError(_0x76e45d,null));};exports['download']=function(_0x3bf2d6,_0x336332){var _0x1aa913=path['join'](config['root'],'server',_0x374f('0x6d'),_0x374f('0x6e'));return db['FaxMessage'][_0x374f('0x42')]({'where':{'id':_0x3bf2d6[_0x374f('0x3f')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0x374f('0x10')](handleEntityNotFound(_0x336332,null))[_0x374f('0x10')](function(_0x1f0dc1){if(_0x1f0dc1){return _0x336332[_0x374f('0x6f')](path[_0x374f('0x70')](_0x1aa913,_0x1f0dc1['Attachment'][_0x374f('0x6c')]));}})['catch'](handleError(_0x336332,null));}; \ No newline at end of file +var _0x5d65=['rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','attributes','model','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','fields','find','body','describe','accept','sms','fax','acceptMessage','reject','UserId','get','FaxInteraction','FaxInteractionId','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','RejectMessage','rejectMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','format','SIP/%s','channel','EventManager','rejectmessage','create','CmContact','findOne','isNil','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','root','server','attachments','Attachment','download','join','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','fax-interactions','request','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','FaxMessage,\x20%s,\x20%s','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','stack','name','send','FaxMessage'];(function(_0x21ff1b,_0xc206e1){var _0x525131=function(_0xc9c53e){while(--_0xc9c53e){_0x21ff1b['push'](_0x21ff1b['shift']());}};_0x525131(++_0xc206e1);}(_0x5d65,0xc4));var _0x55d6=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x5d65[_0x33032e];return _0x13316b;};'use strict';var util=require(_0x55d6('0x0'));var path=require('path');var _=require(_0x55d6('0x1'));var Redis=require(_0x55d6('0x2'));var interactionService=require(_0x55d6('0x3'));var qs=require(_0x55d6('0x4'));var logger=require(_0x55d6('0x5'))(_0x55d6('0x6'));var config=require(_0x55d6('0x7'));var db=require(_0x55d6('0x8'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x55d6('0x9'))(new Redis(config['redis']));require(_0x55d6('0xa'))['register'](socket);var jayson=require(_0x55d6('0xb'));var client=jayson[_0x55d6('0xc')][_0x55d6('0xd')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var interaction_log=require('../../config/logger')(_0x55d6('0xe'));function respondWithRpcPromise(_0x2101ca,_0x672b27,_0x4be8ee,_0x4b5f9a){return new Promise(function(_0x43074a,_0x36c554){var _0x2b30bf=_0x4b5f9a||client;return _0x2b30bf[_0x55d6('0xf')](_0x2101ca,_0x4be8ee)[_0x55d6('0x10')](function(_0x461835){logger['info']('FaxMessage,\x20%s,\x20%s',_0x672b27,_0x55d6('0x11'));logger[_0x55d6('0x12')](_0x55d6('0x13'),_0x672b27,_0x55d6('0x11'),JSON[_0x55d6('0x14')](_0x461835));if(_0x461835[_0x55d6('0x15')]){if(_0x461835[_0x55d6('0x15')][_0x55d6('0x16')]===0x1f4){logger[_0x55d6('0x15')]('FaxMessage,\x20%s,\x20%s',_0x672b27,_0x461835[_0x55d6('0x15')][_0x55d6('0x17')]);return _0x36c554(_0x461835[_0x55d6('0x15')]['message']);}logger[_0x55d6('0x15')]('FaxMessage,\x20%s,\x20%s',_0x672b27,_0x461835[_0x55d6('0x15')]['message']);return _0x43074a(_0x461835[_0x55d6('0x15')][_0x55d6('0x17')]);}else{logger[_0x55d6('0x18')](_0x55d6('0x19'),_0x672b27,_0x55d6('0x11'));_0x43074a(_0x461835[_0x55d6('0x1a')]['message']);}})[_0x55d6('0x1b')](function(_0x24664c){logger[_0x55d6('0x15')](_0x55d6('0x19'),_0x672b27,_0x24664c);_0x36c554(_0x24664c);});});}function respondWithResult(_0x381156,_0x440852){_0x440852=_0x440852||0xc8;return function(_0x25b765){if(_0x25b765){return _0x381156[_0x55d6('0x1c')](_0x440852)[_0x55d6('0x1d')](_0x25b765);}};}function respondWithFilteredResult(_0x66897c,_0x4b2a7a){return function(_0x1764c0){if(_0x1764c0){var _0x25e069=typeof _0x4b2a7a[_0x55d6('0x1e')]===_0x55d6('0x1f')&&typeof _0x4b2a7a[_0x55d6('0x20')]===_0x55d6('0x1f');var _0x5dd400=_0x1764c0['count'];var _0xcfe9f5=_0x25e069?0x0:_0x4b2a7a[_0x55d6('0x1e')];var _0x3b2dde=_0x25e069?_0x1764c0[_0x55d6('0x21')]:_0x4b2a7a[_0x55d6('0x1e')]+_0x4b2a7a[_0x55d6('0x20')];var _0xe5e03e;if(_0x3b2dde>=_0x5dd400){_0x3b2dde=_0x5dd400;_0xe5e03e=0xc8;}else{_0xe5e03e=0xce;}_0x66897c[_0x55d6('0x1c')](_0xe5e03e);return _0x66897c[_0x55d6('0x22')](_0x55d6('0x23'),_0xcfe9f5+'-'+_0x3b2dde+'/'+_0x5dd400)['json'](_0x1764c0);}return null;};}function saveUpdates(_0x44e63e){return function(_0x2f8028){if(_0x2f8028){return _0x2f8028[_0x55d6('0x24')](_0x44e63e)['then'](function(_0x319500){return _0x319500;});}return null;};}function removeEntity(_0x3acb34){return function(_0x56ddb1){if(_0x56ddb1){return _0x56ddb1[_0x55d6('0x25')]()['then'](function(){_0x3acb34['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5784e9){return function(_0x44e9a1){if(!_0x44e9a1){_0x5784e9['sendStatus'](0x194);}return _0x44e9a1;};}function handleError(_0x46cb8a,_0x4b7f81){_0x4b7f81=_0x4b7f81||0x1f4;return function(_0x1bee32){logger[_0x55d6('0x15')](_0x1bee32[_0x55d6('0x26')]);if(_0x1bee32[_0x55d6('0x27')]){delete _0x1bee32[_0x55d6('0x27')];}_0x46cb8a[_0x55d6('0x1c')](_0x4b7f81)[_0x55d6('0x28')](_0x1bee32);};}exports['index']=function(_0x3f0726,_0x580173){var _0x560947={},_0x4d539e={},_0x412a57={'count':0x0,'rows':[]};var _0x4ad535=_['map'](db[_0x55d6('0x29')][_0x55d6('0x2a')],function(_0x1f39e9){return{'name':_0x1f39e9[_0x55d6('0x2b')],'type':_0x1f39e9[_0x55d6('0x2c')][_0x55d6('0x2d')]};});_0x4d539e['model']=_[_0x55d6('0x2e')](_0x4ad535,_0x55d6('0x27'));_0x4d539e['query']=_[_0x55d6('0x2f')](_0x3f0726[_0x55d6('0x30')]);_0x4d539e[_0x55d6('0x31')]=_[_0x55d6('0x32')](_0x4d539e['model'],_0x4d539e['query']);_0x560947[_0x55d6('0x33')]=_['intersection'](_0x4d539e[_0x55d6('0x34')],qs['fields'](_0x3f0726['query']['fields']));_0x560947[_0x55d6('0x33')]=_0x560947[_0x55d6('0x33')][_0x55d6('0x35')]?_0x560947[_0x55d6('0x33')]:_0x4d539e[_0x55d6('0x34')];if(!_0x3f0726[_0x55d6('0x30')][_0x55d6('0x36')](_0x55d6('0x37'))){_0x560947[_0x55d6('0x20')]=qs['limit'](_0x3f0726[_0x55d6('0x30')][_0x55d6('0x20')]);_0x560947[_0x55d6('0x1e')]=qs[_0x55d6('0x1e')](_0x3f0726[_0x55d6('0x30')][_0x55d6('0x1e')]);}_0x560947['order']=qs['sort'](_0x3f0726[_0x55d6('0x30')][_0x55d6('0x38')]);_0x560947[_0x55d6('0x39')]=qs[_0x55d6('0x31')](_[_0x55d6('0x3a')](_0x3f0726[_0x55d6('0x30')],_0x4d539e['filters']),_0x4ad535);if(_0x3f0726[_0x55d6('0x30')][_0x55d6('0x3b')]){_0x560947[_0x55d6('0x39')]=_['merge'](_0x560947[_0x55d6('0x39')],{'$or':_['map'](_0x4ad535,function(_0x4057ad){if(_0x4057ad['type']!==_0x55d6('0x3c')){var _0x4dc9a7={};_0x4dc9a7[_0x4057ad[_0x55d6('0x27')]]={'$like':'%'+_0x3f0726[_0x55d6('0x30')][_0x55d6('0x3b')]+'%'};return _0x4dc9a7;}})});}_0x560947=_[_0x55d6('0x3d')]({},_0x560947,_0x3f0726['options']);var _0x550b7f={'where':_0x560947[_0x55d6('0x39')]};return db[_0x55d6('0x29')][_0x55d6('0x21')](_0x550b7f)[_0x55d6('0x10')](function(_0x5241a2){_0x412a57[_0x55d6('0x21')]=_0x5241a2;if(_0x3f0726['query'][_0x55d6('0x3e')]){_0x560947[_0x55d6('0x3f')]=[{'all':!![]}];}return db[_0x55d6('0x29')][_0x55d6('0x40')](_0x560947);})[_0x55d6('0x10')](function(_0x5427ef){_0x412a57[_0x55d6('0x41')]=_0x5427ef;return _0x412a57;})['then'](respondWithFilteredResult(_0x580173,_0x560947))[_0x55d6('0x1b')](handleError(_0x580173,null));};exports[_0x55d6('0x42')]=function(_0x4f8aaa,_0x1b40b2){var _0x2ac2d3={'raw':!![],'where':{'id':_0x4f8aaa[_0x55d6('0x43')]['id']}},_0x234276={};_0x234276[_0x55d6('0x34')]=_['keys'](db[_0x55d6('0x29')]['rawAttributes']);_0x234276[_0x55d6('0x30')]=_[_0x55d6('0x2f')](_0x4f8aaa['query']);_0x234276[_0x55d6('0x31')]=_['intersection'](_0x234276[_0x55d6('0x34')],_0x234276[_0x55d6('0x30')]);_0x2ac2d3[_0x55d6('0x33')]=_['intersection'](_0x234276[_0x55d6('0x34')],qs['fields'](_0x4f8aaa[_0x55d6('0x30')][_0x55d6('0x44')]));_0x2ac2d3[_0x55d6('0x33')]=_0x2ac2d3[_0x55d6('0x33')]['length']?_0x2ac2d3[_0x55d6('0x33')]:_0x234276[_0x55d6('0x34')];if(_0x4f8aaa[_0x55d6('0x30')][_0x55d6('0x3e')]){_0x2ac2d3['include']=[{'all':!![]}];}_0x2ac2d3=_[_0x55d6('0x3d')]({},_0x2ac2d3,_0x4f8aaa['options']);return db[_0x55d6('0x29')][_0x55d6('0x45')](_0x2ac2d3)[_0x55d6('0x10')](handleEntityNotFound(_0x1b40b2,null))[_0x55d6('0x10')](respondWithResult(_0x1b40b2,null))[_0x55d6('0x1b')](handleError(_0x1b40b2,null));};exports[_0x55d6('0x24')]=function(_0x163a77,_0x387d5b){if(_0x163a77['body']['id']){delete _0x163a77[_0x55d6('0x46')]['id'];}return db[_0x55d6('0x29')][_0x55d6('0x45')]({'where':{'id':_0x163a77[_0x55d6('0x43')]['id']}})[_0x55d6('0x10')](handleEntityNotFound(_0x387d5b,null))['then'](saveUpdates(_0x163a77[_0x55d6('0x46')],null))[_0x55d6('0x10')](respondWithResult(_0x387d5b,null))['catch'](handleError(_0x387d5b,null));};exports['destroy']=function(_0x361f7e,_0x410ed2){return db[_0x55d6('0x29')][_0x55d6('0x45')]({'where':{'id':_0x361f7e[_0x55d6('0x43')]['id']}})[_0x55d6('0x10')](handleEntityNotFound(_0x410ed2,null))[_0x55d6('0x10')](removeEntity(_0x410ed2,null))[_0x55d6('0x1b')](handleError(_0x410ed2,null));};exports[_0x55d6('0x47')]=function(_0x1e1c3c,_0x562b5d){return db[_0x55d6('0x29')]['describe']()[_0x55d6('0x10')](respondWithResult(_0x562b5d,null))[_0x55d6('0x1b')](handleError(_0x562b5d,null));};exports[_0x55d6('0x48')]=function(_0x415bfa,_0x42cc86){var _0x271f0f=_0x55d6('0x49');return interactionService['acceptMessage'](_0x415bfa,_0x271f0f)['then'](respondWithResult(_0x42cc86,null))[_0x55d6('0x1b')](handleError(_0x42cc86,null));};exports[_0x55d6('0x48')]=function(_0xd6b55a,_0x14b7af){var _0x36b20e=_0x55d6('0x4a');return interactionService[_0x55d6('0x4b')](_0xd6b55a,_0x36b20e)[_0x55d6('0x10')](respondWithResult(_0x14b7af,null))[_0x55d6('0x1b')](handleError(_0x14b7af,null));};exports[_0x55d6('0x4c')]=function(_0x6974f7,_0x53298e){var _0x57def9={'agent':{},'channel':_0x55d6('0x4a')};if(_0x6974f7['body']['id']){delete _0x6974f7[_0x55d6('0x46')]['id'];}_0x6974f7[_0x55d6('0x46')]['UserId']=_0x6974f7[_0x55d6('0x46')][_0x55d6('0x4d')]||_0x6974f7['user']['id'];_0x57def9['agent']['id']=_0x6974f7[_0x55d6('0x46')]['UserId'];return db[_0x55d6('0x29')][_0x55d6('0x45')]({'where':{'id':_0x6974f7['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x53298e,null))[_0x55d6('0x10')](function(_0x16ef8f){if(_0x16ef8f){_0x57def9[_0x55d6('0x17')]=_0x16ef8f[_0x55d6('0x4e')]({'plain':!![]});return db[_0x55d6('0x4f')][_0x55d6('0x45')]({'where':{'id':_0x16ef8f[_0x55d6('0x50')]}});}return null;})['then'](handleEntityNotFound(_0x53298e,null))[_0x55d6('0x10')](function(_0x3f83bf){if(_0x3f83bf){_0x57def9[_0x55d6('0x51')]=_0x3f83bf[_0x55d6('0x4e')]({'plain':!![]});interaction_log[_0x55d6('0x18')](_0x55d6('0x52'),_0x6974f7[_0x55d6('0x53')]['id'],_0x6974f7[_0x55d6('0x53')]['name'],_0x6974f7[_0x55d6('0x53')][_0x55d6('0x54')],_0x57def9[_0x55d6('0x51')]['id'],_0x6974f7[_0x55d6('0x46')]?JSON[_0x55d6('0x14')](_0x6974f7[_0x55d6('0x46')]):_0x55d6('0x55'));return respondWithRpcPromise(_0x55d6('0x56'),_0x55d6('0x57'),_0x57def9);}return null;})[_0x55d6('0x10')](function(_0x4df1d3){var _0x2d0959='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4df1d3['message'][_0x55d6('0x58')];return db[_0x55d6('0x59')]['query'](_0x2d0959,{'type':db[_0x55d6('0x5a')][_0x55d6('0x5b')][_0x55d6('0x5c')],'raw':!![]})[_0x55d6('0x10')](function(_0x5cf599){return _0x5cf599;});})['then'](function(_0x2f14df){if(_0x2f14df){_0x57def9['message'][_0x55d6('0x5d')]=_0x2f14df[0x0];if(!_0x6974f7[_0x55d6('0x46')][_0x55d6('0x4d')])return;return db[_0x55d6('0x5e')][_0x55d6('0x45')]({'where':{'id':_0x6974f7[_0x55d6('0x46')]['UserId'],'role':_0x55d6('0x5f')},'attributes':['id',_0x55d6('0x27'),_0x55d6('0x60'),_0x55d6('0x61'),_0x55d6('0x62')],'raw':!![]});}return null;})[_0x55d6('0x10')](function(_0x53b816){if(!_0x53b816)return null;_0x57def9[_0x55d6('0x17')][_0x55d6('0x5f')]=_0x53b816;return _0x57def9;})[_0x55d6('0x10')](function(_0x38de7e){if(_0x38de7e){_0x38de7e[_0x55d6('0x17')]['interface']=util[_0x55d6('0x63')](_0x55d6('0x64'),_0x6974f7[_0x55d6('0x53')][_0x55d6('0x27')]);_0x38de7e[_0x55d6('0x17')][_0x55d6('0x65')]=_0x57def9[_0x55d6('0x65')];_0x38de7e['message']['motionChannel']=_0x57def9[_0x55d6('0x65')];_0x38de7e[_0x55d6('0x17')]['event']=_0x55d6('0x4c');respondWithRpcPromise(_0x55d6('0x66'),_0x55d6('0x66'),{'event':_0x55d6('0x67'),'message':_0x38de7e[_0x55d6('0x17')]},client9002);return _0x57def9;}return null;})[_0x55d6('0x10')](respondWithResult(_0x53298e,null))[_0x55d6('0x1b')](handleError(_0x53298e,null));};exports[_0x55d6('0x68')]=function(_0x49f335,_0x22e8b5){var _0x4953c9;return db[_0x55d6('0x29')][_0x55d6('0x68')](_0x49f335['body'],{})['then'](function(_0x49e2ce){_0x4953c9=_0x49e2ce;return db[_0x55d6('0x69')][_0x55d6('0x6a')]({'where':{'id':_0x4953c9[_0x55d6('0x58')]}});})[_0x55d6('0x10')](function(_0xdfb3f){if(_[_0x55d6('0x6b')](_0xdfb3f)){return;}else{_0x4953c9[_0x55d6('0x4a')]=_0xdfb3f[_0x55d6('0x4a')];return db['Attachment']['findOne']({'where':{'id':_0x4953c9[_0x55d6('0x6c')]}});}})['then'](function(_0x23ea4f){return respondWithRpcPromise(_0x55d6('0x6d'),'SendFax',{'FaxAccountId':_[_0x55d6('0x6b')](_0x49f335[_0x55d6('0x46')])?undefined:_0x49f335[_0x55d6('0x46')][_0x55d6('0x6e')],'path':_[_0x55d6('0x6b')](_0x23ea4f)?undefined:util[_0x55d6('0x63')](_0x55d6('0x6f'),_0x23ea4f[_0x55d6('0x70')]),'fax':_[_0x55d6('0x6b')](_0x4953c9[_0x55d6('0x4a')])?undefined:_0x4953c9[_0x55d6('0x4a')],'AttachmentId':_0x4953c9[_0x55d6('0x6c')]},client9002);})['then'](respondWithResult(_0x22e8b5,0xc9))['catch'](handleError(_0x22e8b5,null));};exports['download']=function(_0xd1e9e9,_0x7de6f1){var _0xe65d61=path['join'](config[_0x55d6('0x71')],_0x55d6('0x72'),'files',_0x55d6('0x73'));return db['FaxMessage'][_0x55d6('0x45')]({'where':{'id':_0xd1e9e9['params']['id']},'include':[{'model':db[_0x55d6('0x74')],'as':_0x55d6('0x74')}]})[_0x55d6('0x10')](handleEntityNotFound(_0x7de6f1,null))[_0x55d6('0x10')](function(_0x4fc46f){if(_0x4fc46f){return _0x7de6f1[_0x55d6('0x75')](path[_0x55d6('0x76')](_0xe65d61,_0x4fc46f['Attachment']['basename']));}})[_0x55d6('0x1b')](handleError(_0x7de6f1,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index c316eef..3c0fe84 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa467=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa467,0x143));var _0x7a46=function(_0x4d7f97,_0x5d8e33){_0x4d7f97=_0x4d7f97-0x0;var _0x3c42a8=_0xa467[_0x4d7f97];return _0x3c42a8;};'use strict';var EventEmitter=require(_0x7a46('0x0'));var FaxMessage=require(_0x7a46('0x1'))['db'][_0x7a46('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7a46('0x3')](0x0);var events={'afterCreate':_0x7a46('0x4'),'afterUpdate':_0x7a46('0x5'),'afterDestroy':_0x7a46('0x6')};function emitEvent(_0x115bef){return function(_0x119b5b,_0x48b9d9,_0x4e2693){FaxMessageEvents[_0x7a46('0x7')](_0x115bef+':'+_0x119b5b['id'],_0x119b5b);FaxMessageEvents[_0x7a46('0x7')](_0x115bef,_0x119b5b);_0x4e2693(null);};}for(var e in events){if(events[_0x7a46('0x8')](e)){var event=events[e];FaxMessage[_0x7a46('0x9')](e,emitEvent(event));}}module[_0x7a46('0xa')]=FaxMessageEvents; \ No newline at end of file +var _0x88b0=['emit','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x5225a0,_0x1d3783){var _0x1c6627=function(_0x9e0229){while(--_0x9e0229){_0x5225a0['push'](_0x5225a0['shift']());}};_0x1c6627(++_0x1d3783);}(_0x88b0,0x1cb));var _0x088b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x88b0[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0x088b('0x0'));var FaxMessage=require(_0x088b('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x088b('0x2'),'afterUpdate':_0x088b('0x3'),'afterDestroy':_0x088b('0x4')};function emitEvent(_0x2a301b){return function(_0x49e80b,_0x211dfb,_0x2d19c3){FaxMessageEvents[_0x088b('0x5')](_0x2a301b+':'+_0x49e80b['id'],_0x49e80b);FaxMessageEvents['emit'](_0x2a301b,_0x49e80b);_0x2d19c3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x088b('0x6')](e,emitEvent(event));}}module[_0x088b('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index ffac4b4..e43b7a3 100644 --- a/server/api/faxMessage/faxMessage.model.js +++ b/server/api/faxMessage/faxMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4940=['out','secret','UserId','FaxInteraction','FaxInteractionId','then','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x4940,0x82));var _0x0494=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x4940[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x0494('0x0'));var util=require(_0x0494('0x1'));var logger=require('../../config/logger')(_0x0494('0x2'));var moment=require(_0x0494('0x3'));var BPromise=require(_0x0494('0x4'));var rp=require(_0x0494('0x5'));var fs=require('fs');var path=require(_0x0494('0x6'));var rimraf=require(_0x0494('0x7'));var config=require(_0x0494('0x8'));var attributes=require(_0x0494('0x9'));module[_0x0494('0xa')]=function(_0x463cd7,_0x454089){return _0x463cd7[_0x0494('0xb')](_0x0494('0xc'),attributes,{'tableName':_0x0494('0xd'),'paranoid':![],'indexes':[{'name':_0x0494('0xe'),'fields':['body'],'type':_0x0494('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xa371ec,_0x566f40,_0x1f122c){var _0x10bf26=_0x463cd7[_0x0494('0x10')];var _0x3e27c7=_0xa371ec[_0x0494('0x11')]({'plain':!![]});if(_0x3e27c7[_0x0494('0x12')][_0x0494('0x13')]()==='in'||_0x3e27c7[_0x0494('0x12')][_0x0494('0x13')]()===_0x0494('0x14')&&!_0x3e27c7[_0x0494('0x15')]&&!_['isNil'](_0x3e27c7[_0x0494('0x16')])){_0x10bf26[_0x0494('0x17')]['findOne']({'where':{'id':_0x3e27c7[_0x0494('0x18')]}})[_0x0494('0x19')](function(_0x276f6d){if(_0x276f6d){_0x276f6d[_0x0494('0x1a')]({'lastMsgAt':_0x3e27c7['createdAt'],'lastMsgDirection':_0x3e27c7['direction']['toLowerCase']()});}})[_0x0494('0x1b')](function(_0x5365a4){console['error'](_0x5365a4);});}_0x1f122c();}},'charset':_0x0494('0x1c'),'collate':_0x0494('0x1d')});}; \ No newline at end of file +var _0x6baf=['path','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','FaxInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','moment'];(function(_0x51a2a9,_0x3ebb9c){var _0x383733=function(_0x2a44fe){while(--_0x2a44fe){_0x51a2a9['push'](_0x51a2a9['shift']());}};_0x383733(++_0x3ebb9c);}(_0x6baf,0x1d7));var _0xf6ba=function(_0x515f47,_0x35329d){_0x515f47=_0x515f47-0x0;var _0x104a91=_0x6baf[_0x515f47];return _0x104a91;};'use strict';var _=require(_0xf6ba('0x0'));var util=require(_0xf6ba('0x1'));var logger=require(_0xf6ba('0x2'))('api');var moment=require(_0xf6ba('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf6ba('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module['exports']=function(_0x5ed925,_0x10b316){return _0x5ed925[_0xf6ba('0x5')](_0xf6ba('0x6'),attributes,{'tableName':_0xf6ba('0x7'),'paranoid':![],'indexes':[{'name':_0xf6ba('0x8'),'fields':[_0xf6ba('0x9')],'type':_0xf6ba('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b3f22,_0x11969b,_0x5b8fe2){var _0x3ee719=_0x5ed925[_0xf6ba('0xb')];var _0x4a433f=_0x2b3f22[_0xf6ba('0xc')]({'plain':!![]});if(_0x4a433f['direction'][_0xf6ba('0xd')]()==='in'||_0x4a433f[_0xf6ba('0xe')][_0xf6ba('0xd')]()===_0xf6ba('0xf')&&!_0x4a433f[_0xf6ba('0x10')]&&!_['isNil'](_0x4a433f['UserId'])){_0x3ee719[_0xf6ba('0x11')][_0xf6ba('0x12')]({'where':{'id':_0x4a433f['FaxInteractionId']}})[_0xf6ba('0x13')](function(_0x2d6cd1){if(_0x2d6cd1){_0x2d6cd1[_0xf6ba('0x14')]({'lastMsgAt':_0x4a433f[_0xf6ba('0x15')],'lastMsgDirection':_0x4a433f[_0xf6ba('0xe')][_0xf6ba('0xd')]()});}})[_0xf6ba('0x16')](function(_0x73b228){console[_0xf6ba('0x17')](_0x73b228);});}_0x5b8fe2();}},'charset':_0xf6ba('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index a386f81..585dfdc 100644 --- a/server/api/faxMessage/faxMessage.rpc.js +++ b/server/api/faxMessage/faxMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','info','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage','FaxMessage','body','raw','then','debug','catch','UpdateFaxMessage','update','options','where','attributes','limit'];(function(_0x1dbb6e,_0x21bbc5){var _0xdabe2d=function(_0x16c2fc){while(--_0x16c2fc){_0x1dbb6e['push'](_0x1dbb6e['shift']());}};_0xdabe2d(++_0x21bbc5);}(_0x9f62,0x154));var _0x29f6=function(_0xcc8324,_0x1c57d8){_0xcc8324=_0xcc8324-0x0;var _0x4f49d2=_0x9f62[_0xcc8324];return _0x4f49d2;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});config[_0x29f6('0x9')]=_[_0x29f6('0xa')](config[_0x29f6('0x9')],{'host':_0x29f6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0xe25841,_0x44db16,_0x4fb455){return new BPromise(function(_0x5a0724,_0x29b3f5){return client[_0x29f6('0xc')](_0xe25841,_0x4fb455)['then'](function(_0x17b69c){logger[_0x29f6('0xd')]('FaxMessage,\x20%s,\x20%s',_0x44db16,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'),JSON[_0x29f6('0xf')](_0x17b69c));if(_0x17b69c[_0x29f6('0x10')]){if(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x11')]===0x1f4){logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x29b3f5(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x5a0724(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'));_0x5a0724(_0x17b69c[_0x29f6('0x14')][_0x29f6('0x13')]);}})['catch'](function(_0xcb90){logger[_0x29f6('0x10')]('FaxMessage,\x20%s,\x20%s',_0x44db16,_0xcb90);_0x29b3f5(_0xcb90);});});}exports[_0x29f6('0x15')]=function(_0x3e81af){var _0x42a8fa=this;return new Promise(function(_0x41b9f0,_0xb6e7a9){return db[_0x29f6('0x16')]['create'](_0x3e81af[_0x29f6('0x17')],{'raw':_0x3e81af['options']?_0x3e81af['options'][_0x29f6('0x18')]===undefined?!![]:![]:!![]})[_0x29f6('0x19')](function(_0x39c6b3){logger[_0x29f6('0xd')]('CreateFaxMessage',_0x3e81af);logger[_0x29f6('0x1a')]('CreateFaxMessage',_0x3e81af,JSON[_0x29f6('0xf')](_0x39c6b3));_0x41b9f0(_0x39c6b3);})[_0x29f6('0x1b')](function(_0x4200cc){logger[_0x29f6('0x10')]('CreateFaxMessage',_0x4200cc[_0x29f6('0x13')],_0x3e81af);_0xb6e7a9(_0x42a8fa[_0x29f6('0x10')](0x1f4,_0x4200cc['message']));});});};exports[_0x29f6('0x1c')]=function(_0x45f792){var _0x2519ac=this;return new Promise(function(_0x342038,_0x84ccb7){return db[_0x29f6('0x16')][_0x29f6('0x1d')](_0x45f792['body'],{'raw':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x1f')]||null:null,'attributes':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x20')]||null:null,'limit':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x21')]||null:null})[_0x29f6('0x19')](function(_0x304c28){logger[_0x29f6('0xd')](_0x29f6('0x1c'),_0x45f792);logger[_0x29f6('0x1a')]('UpdateFaxMessage',_0x45f792,JSON['stringify'](_0x304c28));_0x342038(_0x304c28);})[_0x29f6('0x1b')](function(_0x489897){logger[_0x29f6('0x10')](_0x29f6('0x1c'),_0x489897[_0x29f6('0x13')],_0x45f792);_0x84ccb7(_0x2519ac[_0x29f6('0x10')](0x1f4,_0x489897['message']));});});}; \ No newline at end of file +var _0x008c=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','catch','options','raw','then','CreateFaxMessage','attributes','limit','UpdateFaxMessage','stringify','lodash','util','moment','bluebird'];(function(_0x298291,_0x140ada){var _0x563d83=function(_0x2cf691){while(--_0x2cf691){_0x298291['push'](_0x298291['shift']());}};_0x563d83(++_0x140ada);}(_0x008c,0x188));var _0xc008=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x008c[_0x235482];return _0x5f5bea;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});config[_0xc008('0xd')]=_['defaults'](config[_0xc008('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xc008('0xe'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xc008('0xf')](socket);function respondWithRpcPromise(_0x7231b4,_0x57c46d,_0x51ba7d){return new BPromise(function(_0x543eb8,_0x1eacfa){return client[_0xc008('0x10')](_0x7231b4,_0x51ba7d)['then'](function(_0xae2dab){logger[_0xc008('0x11')](_0xc008('0x12'),_0x57c46d,_0xc008('0x13'));logger[_0xc008('0x14')](_0xc008('0x15'),_0x57c46d,_0xc008('0x13'),JSON['stringify'](_0xae2dab));if(_0xae2dab['error']){if(_0xae2dab[_0xc008('0x16')]['code']===0x1f4){logger[_0xc008('0x16')](_0xc008('0x12'),_0x57c46d,_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);return _0x1eacfa(_0xae2dab[_0xc008('0x16')]['message']);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x57c46d,_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);return _0x543eb8(_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x57c46d,'request\x20sent');_0x543eb8(_0xae2dab['result'][_0xc008('0x17')]);}})[_0xc008('0x18')](function(_0x501137){logger[_0xc008('0x16')]('FaxMessage,\x20%s,\x20%s',_0x57c46d,_0x501137);_0x1eacfa(_0x501137);});});}exports['CreateFaxMessage']=function(_0x543e5d){var _0x50261c=this;return new Promise(function(_0x5754a0,_0x4b9726){return db['FaxMessage']['create'](_0x543e5d['body'],{'raw':_0x543e5d['options']?_0x543e5d[_0xc008('0x19')][_0xc008('0x1a')]===undefined?!![]:![]:!![]})[_0xc008('0x1b')](function(_0x415af3){logger[_0xc008('0x11')](_0xc008('0x1c'),_0x543e5d);logger['debug'](_0xc008('0x1c'),_0x543e5d,JSON['stringify'](_0x415af3));_0x5754a0(_0x415af3);})['catch'](function(_0x218599){logger[_0xc008('0x16')](_0xc008('0x1c'),_0x218599[_0xc008('0x17')],_0x543e5d);_0x4b9726(_0x50261c['error'](0x1f4,_0x218599['message']));});});};exports['UpdateFaxMessage']=function(_0x3f7b07){var _0x15dade=this;return new Promise(function(_0x92c582,_0x2e31c2){return db['FaxMessage']['update'](_0x3f7b07['body'],{'raw':_0x3f7b07['options']?_0x3f7b07['options'][_0xc008('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07[_0xc008('0x19')]['where']||null:null,'attributes':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07[_0xc008('0x19')][_0xc008('0x1d')]||null:null,'limit':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07['options'][_0xc008('0x1e')]||null:null})[_0xc008('0x1b')](function(_0x53ed35){logger['info']('UpdateFaxMessage',_0x3f7b07);logger[_0xc008('0x14')](_0xc008('0x1f'),_0x3f7b07,JSON[_0xc008('0x20')](_0x53ed35));_0x92c582(_0x53ed35);})[_0xc008('0x18')](function(_0x1de04b){logger[_0xc008('0x16')](_0xc008('0x1f'),_0x1de04b[_0xc008('0x17')],_0x3f7b07);_0x2e31c2(_0x15dade[_0xc008('0x16')](0x1f4,_0x1de04b[_0xc008('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 58a7d12..23e958e 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafab=['./faxMessage.events','update','register','length','faxMessage:'];(function(_0x53275b,_0x49e56e){var _0x3044ad=function(_0x452365){while(--_0x452365){_0x53275b['push'](_0x53275b['shift']());}};_0x3044ad(++_0x49e56e);}(_0xafab,0xb9));var _0xbafa=function(_0x2ed86d,_0x2e804e){_0x2ed86d=_0x2ed86d-0x0;var _0xe13c85=_0xafab[_0x2ed86d];return _0xe13c85;};'use strict';var FaxMessageEvents=require(_0xbafa('0x0'));var events=['save','remove',_0xbafa('0x1')];function createListener(_0x5d24aa,_0x2764eb){return function(_0x23a655){_0x2764eb['emit'](_0x5d24aa,_0x23a655);};}function removeListener(_0x7d800d,_0x3029c6){return function(){FaxMessageEvents['removeListener'](_0x7d800d,_0x3029c6);};}exports[_0xbafa('0x2')]=function(_0x43bf8b){for(var _0x14457c=0x0,_0x465368=events[_0xbafa('0x3')];_0x14457c<_0x465368;_0x14457c++){var _0x2ba8c7=events[_0x14457c];var _0x22b859=createListener(_0xbafa('0x4')+_0x2ba8c7,_0x43bf8b);FaxMessageEvents['on'](_0x2ba8c7,_0x22b859);}}; \ No newline at end of file +var _0x1209=['remove','emit','register','length','./faxMessage.events'];(function(_0x47e648,_0x15e1bf){var _0xf8bd16=function(_0x35345f){while(--_0x35345f){_0x47e648['push'](_0x47e648['shift']());}};_0xf8bd16(++_0x15e1bf);}(_0x1209,0x103));var _0x9120=function(_0x560a3b,_0x3cd259){_0x560a3b=_0x560a3b-0x0;var _0x2f8888=_0x1209[_0x560a3b];return _0x2f8888;};'use strict';var FaxMessageEvents=require(_0x9120('0x0'));var events=['save',_0x9120('0x1'),'update'];function createListener(_0x93709b,_0x4a073e){return function(_0x4d0fc8){_0x4a073e[_0x9120('0x2')](_0x93709b,_0x4d0fc8);};}function removeListener(_0x3b6635,_0x2df7a6){return function(){FaxMessageEvents['removeListener'](_0x3b6635,_0x2df7a6);};}exports[_0x9120('0x3')]=function(_0x5ef730){for(var _0x2bfbed=0x0,_0x498988=events[_0x9120('0x4')];_0x2bfbed<_0x498988;_0x2bfbed++){var _0x41d282=events[_0x2bfbed];var _0x374a89=createListener('faxMessage:'+_0x41d282,_0x5ef730);FaxMessageEvents['on'](_0x41d282,_0x374a89);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index ea0d537..4d5f640 100644 --- a/server/api/faxMessage/index.js +++ b/server/api/faxMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f7a=['tracked','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','show','download','post'];(function(_0x295a3d,_0x56d487){var _0x23a732=function(_0x15cfc2){while(--_0x15cfc2){_0x295a3d['push'](_0x295a3d['shift']());}};_0x23a732(++_0x56d487);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x46bf0c,_0x1db0d8){_0x46bf0c=_0x46bf0c-0x0;var _0x11779e=_0x6f7a[_0x46bf0c];return _0x11779e;};'use strict';var multer=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var path=require(_0xa6f7('0x2'));var timeout=require(_0xa6f7('0x3'));var express=require('express');var router=express[_0xa6f7('0x4')]();var fs_extra=require(_0xa6f7('0x5'));var auth=require(_0xa6f7('0x6'));var interaction=require(_0xa6f7('0x7'));var config=require(_0xa6f7('0x8'));var controller=require(_0xa6f7('0x9'));router[_0xa6f7('0xa')]('/',auth[_0xa6f7('0xb')](),controller[_0xa6f7('0xc')]);router[_0xa6f7('0xa')](_0xa6f7('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xa6f7('0xa')](_0xa6f7('0xe'),auth[_0xa6f7('0xb')](),controller[_0xa6f7('0xf')]);router[_0xa6f7('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xa6f7('0x10')]);router[_0xa6f7('0x11')]('/',auth['isAuthenticated'](),interaction[_0xa6f7('0x12')]('fax',_0xa6f7('0x13')),controller[_0xa6f7('0x14')]);router[_0xa6f7('0x15')](_0xa6f7('0xe'),auth['isAuthenticated'](),controller[_0xa6f7('0x16')]);router['put'](_0xa6f7('0x17'),auth[_0xa6f7('0xb')](),controller[_0xa6f7('0x18')]);router['put'](_0xa6f7('0x19'),auth['isAuthenticated'](),controller[_0xa6f7('0x1a')]);router['delete'](_0xa6f7('0xe'),auth[_0xa6f7('0xb')](),controller[_0xa6f7('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xd8b0=['tracked','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','/:id/download','download','post'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./faxMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x9')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')]('/',auth['isAuthenticated'](),interaction[_0x0d8b('0x10')]('fax',_0x0d8b('0x11')),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x13')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x13')](_0x0d8b('0x17'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x19')]);module[_0x0d8b('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 3ff5bae..94b0388 100644 --- a/server/api/faxQueue/faxQueue.attributes.js +++ b/server/api/faxQueue/faxQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4017=['sequelize','exports','STRING','name','INTEGER','beepall','roundrobin'];(function(_0x16de68,_0x33d7ff){var _0x1c277e=function(_0x1d8549){while(--_0x1d8549){_0x16de68['push'](_0x16de68['shift']());}};_0x1c277e(++_0x33d7ff);}(_0x4017,0x70));var _0x7401=function(_0x5a8e3d,_0x598ceb){_0x5a8e3d=_0x5a8e3d-0x0;var _0x359452=_0x4017[_0x5a8e3d];return _0x359452;};'use strict';var Sequelize=require(_0x7401('0x0'));module[_0x7401('0x1')]={'name':{'type':Sequelize[_0x7401('0x2')],'unique':_0x7401('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7401('0x2')]},'timeout':{'type':Sequelize[_0x7401('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x7401('0x5'),_0x7401('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x7401('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xad99=['beepall','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xad99,0xa9));var _0x9ad9=function(_0x178442,_0x300791){_0x178442=_0x178442-0x0;var _0x3f870a=_0xad99[_0x178442];return _0x3f870a;};'use strict';var Sequelize=require('sequelize');module[_0x9ad9('0x0')]={'name':{'type':Sequelize[_0x9ad9('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x9ad9('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9ad9('0x3')](_0x9ad9('0x4'),_0x9ad9('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9ad9('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index c3904a8..09505a1 100644 --- a/server/api/faxQueue/faxQueue.controller.js +++ b/server/api/faxQueue/faxQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e65=['team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeAgents','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','FaxQueues','UserProfileResource','then','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','getOptions','include','findAll','rows','params','keys','query','filters','model','intersection','fields','attributes','includeAll','merge','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','length','hasOwnProperty','nolimit','order','sort','where','pick','FaxQueueId','filter','options','UserFaxQueue','User','findAndCountAll','UserId','faxPause','createdAt','%s/%s','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId'];(function(_0x46cdd1,_0x5deeff){var _0x26f8fc=function(_0x3b2980){while(--_0x3b2980){_0x46cdd1['push'](_0x46cdd1['shift']());}};_0x26f8fc(++_0x5deeff);}(_0x2e65,0x193));var _0x52e6=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x2e65[_0x3a2a3c];return _0x50ac9a;};'use strict';var BPromise=require(_0x52e6('0x0'));var util=require(_0x52e6('0x1'));var _=require(_0x52e6('0x2'));var squel=require(_0x52e6('0x3'));var Redis=require(_0x52e6('0x4'));var qs=require(_0x52e6('0x5'));var logger=require(_0x52e6('0x6'))(_0x52e6('0x7'));var config=require('../../config/environment');var db=require(_0x52e6('0x8'))['db'];config[_0x52e6('0x9')]=_[_0x52e6('0xa')](config[_0x52e6('0x9')],{'host':_0x52e6('0xb'),'port':0x18eb});var socket=require(_0x52e6('0xc'))(new Redis(config[_0x52e6('0x9')]));require(_0x52e6('0xd'))[_0x52e6('0xe')](socket);function respondWithStatusCode(_0x2ab17e,_0x4ba03a){_0x4ba03a=_0x4ba03a||0xcc;return function(_0x1e3906){if(_0x1e3906){return _0x2ab17e[_0x52e6('0xf')](_0x4ba03a);}return _0x2ab17e['status'](_0x4ba03a)[_0x52e6('0x10')]();};}function respondWithResult(_0x543f78,_0x52b3ee){_0x52b3ee=_0x52b3ee||0xc8;return function(_0x471d57){if(_0x471d57){return _0x543f78[_0x52e6('0x11')](_0x52b3ee)[_0x52e6('0x12')](_0x471d57);}};}function respondWithFilteredResult(_0x465542,_0x30d7fb){return function(_0x33caf5){if(_0x33caf5){var _0x538471=typeof _0x30d7fb['offset']===_0x52e6('0x13')&&typeof _0x30d7fb[_0x52e6('0x14')]==='undefined';var _0x2692a8=_0x33caf5[_0x52e6('0x15')];var _0x4362e3=_0x538471?0x0:_0x30d7fb[_0x52e6('0x16')];var _0x3c80c1=_0x538471?_0x33caf5[_0x52e6('0x15')]:_0x30d7fb[_0x52e6('0x16')]+_0x30d7fb[_0x52e6('0x14')];var _0x109057;if(_0x3c80c1>=_0x2692a8){_0x3c80c1=_0x2692a8;_0x109057=0xc8;}else{_0x109057=0xce;}_0x465542[_0x52e6('0x11')](_0x109057);return _0x465542[_0x52e6('0x17')](_0x52e6('0x18'),_0x4362e3+'-'+_0x3c80c1+'/'+_0x2692a8)[_0x52e6('0x12')](_0x33caf5);}return null;};}function saveUpdates(_0x5c275c){return function(_0x5afe24){if(_0x5afe24){return _0x5afe24[_0x52e6('0x19')](_0x5c275c)['then'](function(_0x5363d9){return _0x5363d9;});}return null;};}function removeEntity(_0x3a3a47){return function(_0x3997ed){if(_0x3997ed){return _0x3997ed[_0x52e6('0x1a')]()['then'](function(){var _0x2954ce=_0x3997ed['get']({'plain':!![]});var _0x1c4ea2=_0x52e6('0x1b');return db[_0x52e6('0x1c')]['destroy']({'where':{'type':_0x1c4ea2,'resourceId':_0x2954ce['id']}})[_0x52e6('0x1d')](function(){return _0x3997ed;});})['then'](function(){_0x3a3a47[_0x52e6('0x11')](0xcc)[_0x52e6('0x10')]();});}};}function handleEntityNotFound(_0x2f0803){return function(_0x5f5c22){if(!_0x5f5c22){_0x2f0803[_0x52e6('0xf')](0x194);}return _0x5f5c22;};}function handleError(_0x994901,_0x5f004e){_0x5f004e=_0x5f004e||0x1f4;return function(_0x4ae6d8){logger['error'](_0x4ae6d8[_0x52e6('0x1e')]);if(_0x4ae6d8['name']){delete _0x4ae6d8[_0x52e6('0x1f')];}_0x994901[_0x52e6('0x11')](_0x5f004e)[_0x52e6('0x20')](_0x4ae6d8);};}exports[_0x52e6('0x21')]=function(_0x73e1f9,_0x597060){var _0x2d5087={};var _0x4e8faf={'count':0x0,'rows':[]};var _0x1119e5=_[_0x52e6('0x22')](db[_0x52e6('0x23')][_0x52e6('0x24')],function(_0x1edc6c){return{'name':_0x1edc6c[_0x52e6('0x25')],'type':_0x1edc6c[_0x52e6('0x26')][_0x52e6('0x27')]};});_0x2d5087=qs[_0x52e6('0x28')](_0x1119e5,_0x73e1f9);var _0x1ede11={'where':_0x2d5087['where']};return db[_0x52e6('0x23')][_0x52e6('0x15')](_0x1ede11)[_0x52e6('0x1d')](function(_0x1c7a03){_0x4e8faf[_0x52e6('0x15')]=_0x1c7a03;_0x2d5087[_0x52e6('0x29')]=qs[_0x52e6('0x29')](_0x73e1f9['query']);return db['FaxQueue'][_0x52e6('0x2a')](_0x2d5087);})[_0x52e6('0x1d')](function(_0x116743){_0x4e8faf[_0x52e6('0x2b')]=_0x116743;return _0x4e8faf;})[_0x52e6('0x1d')](respondWithFilteredResult(_0x597060,_0x2d5087))['catch'](handleError(_0x597060,null));};exports['show']=function(_0xdef487,_0x1f56c6){var _0x1912b5={'raw':!![],'where':{'id':_0xdef487[_0x52e6('0x2c')]['id']}},_0x10090a={};_0x10090a['model']=_[_0x52e6('0x2d')](db[_0x52e6('0x23')]['rawAttributes']);_0x10090a[_0x52e6('0x2e')]=_[_0x52e6('0x2d')](_0xdef487[_0x52e6('0x2e')]);_0x10090a[_0x52e6('0x2f')]=_['intersection'](_0x10090a[_0x52e6('0x30')],_0x10090a[_0x52e6('0x2e')]);_0x1912b5['attributes']=_[_0x52e6('0x31')](_0x10090a[_0x52e6('0x30')],qs['fields'](_0xdef487['query'][_0x52e6('0x32')]));_0x1912b5[_0x52e6('0x33')]=_0x1912b5[_0x52e6('0x33')]['length']?_0x1912b5[_0x52e6('0x33')]:_0x10090a[_0x52e6('0x30')];if(_0xdef487[_0x52e6('0x2e')][_0x52e6('0x34')]){_0x1912b5[_0x52e6('0x29')]=[{'all':!![]}];}_0x1912b5=_[_0x52e6('0x35')]({},_0x1912b5,_0xdef487['options']);return db[_0x52e6('0x23')][_0x52e6('0x36')](_0x1912b5)['then'](handleEntityNotFound(_0x1f56c6,null))[_0x52e6('0x1d')](respondWithResult(_0x1f56c6,null))[_0x52e6('0x37')](handleError(_0x1f56c6,null));};exports[_0x52e6('0x38')]=function(_0x521ac5,_0x303524){return db[_0x52e6('0x23')]['create'](_0x521ac5[_0x52e6('0x39')],{})[_0x52e6('0x1d')](function(_0xc2b984){var _0xab65b=_0x521ac5[_0x52e6('0x3a')][_0x52e6('0x3b')]({'plain':!![]});if(!_0xab65b)throw new Error(_0x52e6('0x3c'));if(_0xab65b['role']===_0x52e6('0x3a')){var _0x4b6dab=_0xc2b984[_0x52e6('0x3b')]({'plain':!![]});var _0x4c62d4=_0x52e6('0x1b');return db[_0x52e6('0x3d')][_0x52e6('0x36')]({'where':{'name':_0x4c62d4,'userProfileId':_0xab65b[_0x52e6('0x3e')]},'raw':!![]})[_0x52e6('0x1d')](function(_0x559992){if(_0x559992&&_0x559992[_0x52e6('0x3f')]===0x0){return db[_0x52e6('0x1c')]['create']({'name':_0x4b6dab[_0x52e6('0x1f')],'resourceId':_0x4b6dab['id'],'type':_0x559992[_0x52e6('0x1f')],'sectionId':_0x559992['id']},{})['then'](function(){return _0xc2b984;});}else{return _0xc2b984;}})[_0x52e6('0x37')](function(_0x3c8649){logger[_0x52e6('0x40')](_0x52e6('0x41'),_0x3c8649);throw _0x3c8649;});}return _0xc2b984;})[_0x52e6('0x1d')](respondWithResult(_0x303524,0xc9))['catch'](handleError(_0x303524,null));};exports[_0x52e6('0x19')]=function(_0x426220,_0x284375){if(_0x426220[_0x52e6('0x39')]['id']){delete _0x426220[_0x52e6('0x39')]['id'];}return db[_0x52e6('0x23')]['find']({'where':{'id':_0x426220[_0x52e6('0x2c')]['id']}})[_0x52e6('0x1d')](handleEntityNotFound(_0x284375,null))[_0x52e6('0x1d')](saveUpdates(_0x426220[_0x52e6('0x39')],null))[_0x52e6('0x1d')](respondWithResult(_0x284375,null))[_0x52e6('0x37')](handleError(_0x284375,null));};exports[_0x52e6('0x1a')]=function(_0x16af43,_0x25dfeb){return db[_0x52e6('0x23')][_0x52e6('0x36')]({'where':{'id':_0x16af43[_0x52e6('0x2c')]['id']}})[_0x52e6('0x1d')](handleEntityNotFound(_0x25dfeb,null))[_0x52e6('0x1d')](removeEntity(_0x25dfeb,null))['catch'](handleError(_0x25dfeb,null));};exports[_0x52e6('0x42')]=function(_0x585a58,_0x252111){return db['FaxQueue'][_0x52e6('0x42')]()[_0x52e6('0x1d')](respondWithResult(_0x252111,null))['catch'](handleError(_0x252111,null));};exports['getMembers']=function(_0x21296f,_0x372c64){var _0x4be720={'raw':!![],'where':{}},_0x5de92b={},_0x3b05aa;return db['FaxQueue'][_0x52e6('0x43')]({'where':{'id':_0x21296f[_0x52e6('0x2c')]['id']}})[_0x52e6('0x1d')](handleEntityNotFound(_0x372c64,null))['then'](function(_0x5149fb){if(_0x5149fb){_0x3b05aa=_0x5149fb['get']({'plain':!![]});_0x5de92b[_0x52e6('0x30')]=_[_0x52e6('0x2d')](db['UserFaxQueue']['rawAttributes']);_0x5de92b['query']=_[_0x52e6('0x2d')](_0x21296f['query']);_0x5de92b[_0x52e6('0x2f')]=_[_0x52e6('0x31')](_0x5de92b[_0x52e6('0x30')],_0x5de92b['query']);_0x4be720[_0x52e6('0x33')]=_[_0x52e6('0x31')](_0x5de92b[_0x52e6('0x30')],qs[_0x52e6('0x32')](_0x21296f['query'][_0x52e6('0x32')]));_0x4be720[_0x52e6('0x33')]=_0x4be720['attributes'][_0x52e6('0x44')]?_0x4be720[_0x52e6('0x33')]:_0x5de92b['model'];if(!_0x21296f[_0x52e6('0x2e')][_0x52e6('0x45')](_0x52e6('0x46'))){_0x4be720[_0x52e6('0x14')]=qs['limit'](_0x21296f['query'][_0x52e6('0x14')]);_0x4be720['offset']=qs[_0x52e6('0x16')](_0x21296f[_0x52e6('0x2e')][_0x52e6('0x16')]);}_0x4be720[_0x52e6('0x47')]=qs[_0x52e6('0x48')](_0x21296f[_0x52e6('0x2e')]['sort']);_0x4be720[_0x52e6('0x49')]=qs[_0x52e6('0x2f')](_[_0x52e6('0x4a')](_0x21296f[_0x52e6('0x2e')],_0x5de92b[_0x52e6('0x2f')]));_0x4be720[_0x52e6('0x49')][_0x52e6('0x4b')]=_0x5149fb['id'];if(_0x21296f[_0x52e6('0x2e')][_0x52e6('0x4c')]){_0x4be720['where']=_['merge'](_0x4be720[_0x52e6('0x49')],{'$or':_[_0x52e6('0x22')](_0x4be720[_0x52e6('0x33')],function(_0x39bee3){var _0x1071e6={};_0x1071e6[_0x39bee3]={'$like':'%'+_0x21296f[_0x52e6('0x2e')][_0x52e6('0x4c')]+'%'};return _0x1071e6;})});}_0x4be720=_[_0x52e6('0x35')]({},_0x4be720,_0x21296f[_0x52e6('0x4d')]);return db[_0x52e6('0x4e')][_0x52e6('0x2a')](_0x4be720);}})[_0x52e6('0x1d')](function(_0x58db02){if(_0x58db02){return db[_0x52e6('0x4f')][_0x52e6('0x50')]({'where':{'id':_['map'](_0x58db02,_0x52e6('0x51')),'role':'agent'},'attributes':['id','name',_0x52e6('0x52'),'updatedAt',_0x52e6('0x53')]});}})[_0x52e6('0x1d')](function(_0x4d1817){if(_0x4d1817){return{'count':_0x4d1817[_0x52e6('0x15')],'rows':_[_0x52e6('0x22')](_0x4d1817['rows'],function(_0x34d7d3){return{'membername':_0x34d7d3[_0x52e6('0x1f')],'UserId':_0x34d7d3['id'],'queue_name':_0x3b05aa[_0x52e6('0x1f')],'FaxQueueId':_0x3b05aa['id'],'interface':util['format'](_0x52e6('0x54'),'SIP',_0x34d7d3[_0x52e6('0x1f')]),'penalty':0x0,'paused':_0x34d7d3['faxPause'],'createdAt':_0x34d7d3[_0x52e6('0x53')],'updatedAt':_0x34d7d3[_0x52e6('0x55')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x52e6('0x1d')](respondWithFilteredResult(_0x372c64,_0x4be720))[_0x52e6('0x37')](handleError(_0x372c64,null));};exports[_0x52e6('0x56')]=function(_0x5cf045,_0x2caae3){var _0x101752={};var _0xf2de71={};var _0x47fd2b;var _0x526334;return db[_0x52e6('0x23')][_0x52e6('0x43')]({'where':{'id':_0x5cf045['params']['id']}})[_0x52e6('0x1d')](handleEntityNotFound(_0x2caae3,null))[_0x52e6('0x1d')](function(_0x1f4a97){if(_0x1f4a97){_0x47fd2b=_0x1f4a97;_0xf2de71[_0x52e6('0x30')]=_[_0x52e6('0x2d')](db[_0x52e6('0x57')][_0x52e6('0x24')]);_0xf2de71['query']=_['keys'](_0x5cf045[_0x52e6('0x2e')]);_0xf2de71[_0x52e6('0x2f')]=_[_0x52e6('0x31')](_0xf2de71[_0x52e6('0x30')],_0xf2de71['query']);_0x101752[_0x52e6('0x33')]=_['intersection'](_0xf2de71['model'],qs[_0x52e6('0x32')](_0x5cf045[_0x52e6('0x2e')][_0x52e6('0x32')]));_0x101752[_0x52e6('0x33')]=_0x101752[_0x52e6('0x33')][_0x52e6('0x44')]?_0x101752['attributes']:_0xf2de71[_0x52e6('0x30')];_0x101752[_0x52e6('0x47')]=qs['sort'](_0x5cf045['query'][_0x52e6('0x48')]);_0x101752[_0x52e6('0x49')]=qs[_0x52e6('0x2f')](_[_0x52e6('0x4a')](_0x5cf045[_0x52e6('0x2e')],_0xf2de71['filters']));if(_0x5cf045[_0x52e6('0x2e')][_0x52e6('0x4c')]){_0x101752['where']=_[_0x52e6('0x35')](_0x101752[_0x52e6('0x49')],{'$or':_[_0x52e6('0x22')](_0x101752[_0x52e6('0x33')],function(_0x48e94b){var _0x3c2f36={};_0x3c2f36[_0x48e94b]={'$like':'%'+_0x5cf045['query']['filter']+'%'};return _0x3c2f36;})});}_0x101752=_[_0x52e6('0x35')]({},_0x101752,_0x5cf045['options']);return _0x47fd2b[_0x52e6('0x56')](_0x101752);}})['then'](function(_0x2621d9){if(_0x2621d9){_0x526334=_0x2621d9['length'];if(!_0x5cf045[_0x52e6('0x2e')]['hasOwnProperty']('nolimit')){_0x101752[_0x52e6('0x14')]=qs[_0x52e6('0x14')](_0x5cf045['query'][_0x52e6('0x14')]);_0x101752['offset']=qs['offset'](_0x5cf045['query']['offset']);}return _0x47fd2b[_0x52e6('0x56')](_0x101752);}})[_0x52e6('0x1d')](function(_0x1b17ea){if(_0x1b17ea){return _0x1b17ea?{'count':_0x526334,'rows':_0x1b17ea}:null;}})[_0x52e6('0x1d')](respondWithResult(_0x2caae3,null))[_0x52e6('0x37')](handleError(_0x2caae3,null));};exports[_0x52e6('0x58')]=function(_0x1747bb,_0xee649f){var _0x3ccc75=_0x1747bb[_0x52e6('0x39')][_0x52e6('0x59')];return db[_0x52e6('0x57')]['findAll']({'where':{'id':_0x3ccc75},'attributes':['id'],'include':[{'model':db[_0x52e6('0x4f')],'as':_0x52e6('0x5a'),'attributes':['id',_0x52e6('0x1f'),_0x52e6('0x5b'),_0x52e6('0x5c'),_0x52e6('0x5d')],'raw':!![]}]})[_0x52e6('0x1d')](function(_0x426966){if(_0x426966){var _0x5a7080=_[_0x52e6('0x5e')](_0x426966,function(_0x2cff46){var _0x38b964=_0x2cff46[_0x52e6('0x3b')]({'plain':!![]});return _0x38b964[_0x52e6('0x5a')];});return db[_0x52e6('0x23')]['find']({'where':{'id':_0x1747bb[_0x52e6('0x2c')]['id']}})['then'](function(_0xf20ab6){return db[_0x52e6('0x5f')][_0x52e6('0x60')](function(_0x5a5f32){return _0xf20ab6[_0x52e6('0x58')](_0x3ccc75,{'transaction':_0x5a5f32})[_0x52e6('0x1d')](function(){return BPromise[_0x52e6('0x61')](_0x5a7080,function(_0x5cf0da){return db['UserFaxQueue'][_0x52e6('0x62')]({'where':{'UserId':_0x5cf0da['id'],'FaxQueueId':_0x1747bb['params']['id']},'transaction':_0x5a5f32});});})[_0x52e6('0x1d')](function(){_0x5a7080['forEach'](function(_0x477a81){socket[_0x52e6('0x63')](_0x52e6('0x64'),{'UserId':_0x477a81['id'],'FaxQueueId':_0xf20ab6['id']});});});});});}})[_0x52e6('0x1d')](respondWithStatusCode(_0xee649f,null))[_0x52e6('0x37')](handleError(_0xee649f,null));};exports[_0x52e6('0x65')]=function(_0x43474e,_0xd664d){return db['Team'][_0x52e6('0x2a')]({'where':{'id':_0x43474e[_0x52e6('0x2e')]['ids']},'attributes':['id'],'include':[{'model':db[_0x52e6('0x4f')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xd664d,null))[_0x52e6('0x1d')](function(_0x2a3dee){var _0x5773de=_[_0x52e6('0x22')](_0x2a3dee,'id');var _0x4e5339=[];var _0x15afbb=[];var _0x595f25=squel[_0x52e6('0x66')]();_0x595f25[_0x52e6('0x67')](_0x52e6('0x68'))['from'](_0x52e6('0x69'),'tq')[_0x52e6('0x6a')](_0x52e6('0x6b'),'ut',_0x52e6('0x6c'))[_0x52e6('0x49')](_0x52e6('0x6d'),_0x43474e[_0x52e6('0x2c')]['id']);for(var _0xafc47c=0x0;_0xafc47c<_0x2a3dee['length'];_0xafc47c+=0x1){let _0x724d03=_0x2a3dee[_0xafc47c];for(var _0x568460=0x0;_0x568460<_0x724d03['Agents'][_0x52e6('0x44')];_0x568460+=0x1){let _0x3428cb=_0x724d03['Agents'][_0x568460];var _0x5507e6=_0x595f25['clone']();_0x5507e6[_0x52e6('0x49')]('ut.UserId\x20=\x20?',_0x3428cb['id']);_0x15afbb[_0x52e6('0x6e')](db[_0x52e6('0x5f')]['query'](_0x5507e6[_0x52e6('0x6f')](),{'type':db[_0x52e6('0x5f')][_0x52e6('0x70')]['SELECT']})[_0x52e6('0x1d')](function(_0x36c370){if(_0x36c370[_0x52e6('0x44')]===0x1){return _0x3428cb['id'];}else{var _0xc54cd8=_[_0x52e6('0x71')](_[_0x52e6('0x22')](_0x36c370,_0x52e6('0x72')),function(_0x141a6a){return _[_0x52e6('0x73')](_0x5773de,_0x141a6a);});if(_0xc54cd8){return _0x3428cb['id'];}}}));}}return BPromise[_0x52e6('0x74')](_0x15afbb)['then'](function(_0x490ab3){_0x4e5339=_(_0x4e5339)[_0x52e6('0x75')](_0x490ab3)[_0x52e6('0x76')]()[_0x52e6('0x77')]();return db['FaxQueue'][_0x52e6('0x36')]({'where':{'id':_0x43474e['params']['id']}})[_0x52e6('0x1d')](function(_0x2aac81){return db[_0x52e6('0x5f')][_0x52e6('0x60')](function(_0x3128e0){return _0x2aac81['removeTeams'](_0x43474e['query']['ids'],{'transaction':_0x3128e0})['then'](function(){if(!_['isEmpty'](_0x4e5339)){return _0x2aac81[_0x52e6('0x78')](_0x4e5339,{'transaction':_0x3128e0});}})['then'](function(){_0x4e5339['forEach'](function(_0xc31906){socket[_0x52e6('0x63')]('userFaxQueue:remove',{'UserId':_0xc31906,'FaxQueueId':_0x2aac81['id']});});});});});});})[_0x52e6('0x1d')](respondWithStatusCode(_0xd664d,null))[_0x52e6('0x37')](handleError(_0xd664d,null));};exports[_0x52e6('0x79')]=function(_0x37d8dd,_0x3cedf7){return db[_0x52e6('0x23')]['find']({'where':{'id':_0x37d8dd['params']['id']}})[_0x52e6('0x1d')](handleEntityNotFound(_0x3cedf7,null))['then'](function(_0x362753){if(_0x362753){return _0x362753[_0x52e6('0x79')](_0x37d8dd[_0x52e6('0x39')]['ids'],_[_0x52e6('0x7a')](_0x37d8dd[_0x52e6('0x39')],['ids','id'])||{})[_0x52e6('0x7b')](function(_0x2f2b58){for(var _0x35ef58=0x0;_0x35ef58<_0x37d8dd['body']['ids'][_0x52e6('0x44')];_0x35ef58+=0x1){socket[_0x52e6('0x63')](_0x52e6('0x64'),{'UserId':Number(_0x37d8dd[_0x52e6('0x39')][_0x52e6('0x59')][_0x35ef58]),'FaxQueueId':Number(_0x37d8dd['params']['id'])});}return _0x2f2b58;});}})['then'](respondWithResult(_0x3cedf7,null))['catch'](handleError(_0x3cedf7,null));};exports[_0x52e6('0x78')]=function(_0x2e3ecd,_0x2baec3){return db['FaxQueue']['find']({'where':{'id':_0x2e3ecd[_0x52e6('0x2c')]['id']}})[_0x52e6('0x1d')](handleEntityNotFound(_0x2baec3,null))['then'](function(_0x42c11d){if(_0x42c11d){return _0x42c11d[_0x52e6('0x78')](_0x2e3ecd[_0x52e6('0x2e')][_0x52e6('0x59')])[_0x52e6('0x1d')](function(){if(_[_0x52e6('0x7c')](_0x2e3ecd['query']['ids'])){for(var _0x26b3ea=0x0;_0x26b3ea<_0x2e3ecd[_0x52e6('0x2e')]['ids'][_0x52e6('0x44')];_0x26b3ea+=0x1){socket[_0x52e6('0x63')](_0x52e6('0x7d'),{'UserId':Number(_0x2e3ecd['query']['ids'][_0x26b3ea]),'FaxQueueId':Number(_0x2e3ecd[_0x52e6('0x2c')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x2e3ecd['query']['ids']),'FaxQueueId':Number(_0x2e3ecd[_0x52e6('0x2c')]['id'])});}});}})['then'](respondWithStatusCode(_0x2baec3,null))[_0x52e6('0x37')](handleError(_0x2baec3,null));};exports[_0x52e6('0x7e')]=function(_0x444eb3,_0x529c60){var _0x326771={};var _0x3efee4={};var _0x10a2af;var _0x514e21;return db[_0x52e6('0x23')][_0x52e6('0x43')]({'where':{'id':_0x444eb3[_0x52e6('0x2c')]['id']}})['then'](handleEntityNotFound(_0x529c60,null))[_0x52e6('0x1d')](function(_0x3a277f){if(_0x3a277f){_0x10a2af=_0x3a277f;_0x3efee4[_0x52e6('0x30')]=_[_0x52e6('0x2d')](db[_0x52e6('0x4f')][_0x52e6('0x24')]);_0x3efee4[_0x52e6('0x2e')]=_[_0x52e6('0x2d')](_0x444eb3[_0x52e6('0x2e')]);_0x3efee4['filters']=_[_0x52e6('0x31')](_0x3efee4[_0x52e6('0x30')],_0x3efee4['query']);_0x326771[_0x52e6('0x33')]=_[_0x52e6('0x31')](_0x3efee4[_0x52e6('0x30')],qs[_0x52e6('0x32')](_0x444eb3['query']['fields']));_0x326771[_0x52e6('0x33')]=_0x326771[_0x52e6('0x33')][_0x52e6('0x44')]?_0x326771['attributes']:_0x3efee4[_0x52e6('0x30')];_0x326771['order']=qs[_0x52e6('0x48')](_0x444eb3[_0x52e6('0x2e')][_0x52e6('0x48')]);_0x326771[_0x52e6('0x49')]=qs['filters'](_['pick'](_0x444eb3[_0x52e6('0x2e')],_0x3efee4[_0x52e6('0x2f')]));if(_0x444eb3[_0x52e6('0x2e')][_0x52e6('0x4c')]){_0x326771[_0x52e6('0x49')]=_[_0x52e6('0x35')](_0x326771['where'],{'$or':_['map'](_0x326771[_0x52e6('0x33')],function(_0x1df621){var _0x411909={};_0x411909[_0x1df621]={'$like':'%'+_0x444eb3[_0x52e6('0x2e')][_0x52e6('0x4c')]+'%'};return _0x411909;})});}_0x326771=_[_0x52e6('0x35')]({},_0x326771,_0x444eb3['options']);return _0x10a2af[_0x52e6('0x7e')](_0x326771);}})[_0x52e6('0x1d')](function(_0x2d43a8){if(_0x2d43a8){_0x514e21=_0x2d43a8['length'];if(!_0x444eb3[_0x52e6('0x2e')][_0x52e6('0x45')](_0x52e6('0x46'))){_0x326771[_0x52e6('0x14')]=qs['limit'](_0x444eb3['query'][_0x52e6('0x14')]);_0x326771[_0x52e6('0x16')]=qs[_0x52e6('0x16')](_0x444eb3[_0x52e6('0x2e')]['offset']);}return _0x10a2af[_0x52e6('0x7e')](_0x326771);}})[_0x52e6('0x1d')](function(_0x4cdce3){if(_0x4cdce3){return _0x4cdce3?{'count':_0x514e21,'rows':_0x4cdce3}:null;}})[_0x52e6('0x1d')](respondWithResult(_0x529c60,null))[_0x52e6('0x37')](handleError(_0x529c60,null));}; \ No newline at end of file +var _0xfc65=['ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','all','union','compact','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','userFaxQueue:save','getAgents','bluebird','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','map','rawAttributes','type','key','getOptions','where','include','query','FaxQueue','findAll','catch','show','params','model','keys','filters','intersection','attributes','fields','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserFaxQueue','length','hasOwnProperty','nolimit','order','sort','FaxQueueId','filter','options','User','findAndCountAll','faxPause','createdAt','rows','findOne','Team','pick','getTeams','ids','Agents','online','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','removeTeams','tq.TeamId','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x2840d4,_0x3e8883){_0x2840d4=_0x2840d4-0x0;var _0x1c7e0e=_0xfc65[_0x2840d4];return _0x1c7e0e;};'use strict';var BPromise=require(_0x5fc6('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0x5fc6('0x1'));var Redis=require(_0x5fc6('0x2'));var qs=require(_0x5fc6('0x3'));var logger=require(_0x5fc6('0x4'))(_0x5fc6('0x5'));var config=require(_0x5fc6('0x6'));var db=require(_0x5fc6('0x7'))['db'];config[_0x5fc6('0x8')]=_[_0x5fc6('0x9')](config[_0x5fc6('0x8')],{'host':_0x5fc6('0xa'),'port':0x18eb});var socket=require(_0x5fc6('0xb'))(new Redis(config[_0x5fc6('0x8')]));require('./faxQueue.socket')[_0x5fc6('0xc')](socket);function respondWithStatusCode(_0x1f1409,_0x2d10be){_0x2d10be=_0x2d10be||0xcc;return function(_0x3d9a11){if(_0x3d9a11){return _0x1f1409[_0x5fc6('0xd')](_0x2d10be);}return _0x1f1409[_0x5fc6('0xe')](_0x2d10be)[_0x5fc6('0xf')]();};}function respondWithResult(_0x27cad8,_0x3d8781){_0x3d8781=_0x3d8781||0xc8;return function(_0x29781f){if(_0x29781f){return _0x27cad8['status'](_0x3d8781)[_0x5fc6('0x10')](_0x29781f);}};}function respondWithFilteredResult(_0x51ad7e,_0x2a2ff4){return function(_0x132fd0){if(_0x132fd0){var _0x454a44=typeof _0x2a2ff4[_0x5fc6('0x11')]==='undefined'&&typeof _0x2a2ff4[_0x5fc6('0x12')]===_0x5fc6('0x13');var _0x2f9062=_0x132fd0[_0x5fc6('0x14')];var _0x436a0c=_0x454a44?0x0:_0x2a2ff4[_0x5fc6('0x11')];var _0x23424e=_0x454a44?_0x132fd0[_0x5fc6('0x14')]:_0x2a2ff4[_0x5fc6('0x11')]+_0x2a2ff4[_0x5fc6('0x12')];var _0x54f153;if(_0x23424e>=_0x2f9062){_0x23424e=_0x2f9062;_0x54f153=0xc8;}else{_0x54f153=0xce;}_0x51ad7e['status'](_0x54f153);return _0x51ad7e[_0x5fc6('0x15')](_0x5fc6('0x16'),_0x436a0c+'-'+_0x23424e+'/'+_0x2f9062)['json'](_0x132fd0);}return null;};}function saveUpdates(_0x26d2ba){return function(_0x168119){if(_0x168119){return _0x168119[_0x5fc6('0x17')](_0x26d2ba)[_0x5fc6('0x18')](function(_0x241bfb){return _0x241bfb;});}return null;};}function removeEntity(_0x29e82f){return function(_0x569bbc){if(_0x569bbc){return _0x569bbc[_0x5fc6('0x19')]()[_0x5fc6('0x18')](function(){var _0x303995=_0x569bbc[_0x5fc6('0x1a')]({'plain':!![]});var _0x5c76e7=_0x5fc6('0x1b');return db[_0x5fc6('0x1c')][_0x5fc6('0x19')]({'where':{'type':_0x5c76e7,'resourceId':_0x303995['id']}})[_0x5fc6('0x18')](function(){return _0x569bbc;});})[_0x5fc6('0x18')](function(){_0x29e82f[_0x5fc6('0xe')](0xcc)[_0x5fc6('0xf')]();});}};}function handleEntityNotFound(_0x17fcb1){return function(_0xfd8379){if(!_0xfd8379){_0x17fcb1[_0x5fc6('0xd')](0x194);}return _0xfd8379;};}function handleError(_0x5ed932,_0x1a3c0d){_0x1a3c0d=_0x1a3c0d||0x1f4;return function(_0x3e0585){logger[_0x5fc6('0x1d')](_0x3e0585[_0x5fc6('0x1e')]);if(_0x3e0585[_0x5fc6('0x1f')]){delete _0x3e0585[_0x5fc6('0x1f')];}_0x5ed932[_0x5fc6('0xe')](_0x1a3c0d)[_0x5fc6('0x20')](_0x3e0585);};}exports['index']=function(_0x122890,_0x18e553){var _0x1db1f0={};var _0x3f384a={'count':0x0,'rows':[]};var _0x391392=_[_0x5fc6('0x21')](db['FaxQueue'][_0x5fc6('0x22')],function(_0xd31fa1){return{'name':_0xd31fa1['fieldName'],'type':_0xd31fa1[_0x5fc6('0x23')][_0x5fc6('0x24')]};});_0x1db1f0=qs[_0x5fc6('0x25')](_0x391392,_0x122890);var _0x19d630={'where':_0x1db1f0[_0x5fc6('0x26')]};return db['FaxQueue'][_0x5fc6('0x14')](_0x19d630)[_0x5fc6('0x18')](function(_0x21066b){_0x3f384a[_0x5fc6('0x14')]=_0x21066b;_0x1db1f0[_0x5fc6('0x27')]=qs[_0x5fc6('0x27')](_0x122890[_0x5fc6('0x28')]);return db[_0x5fc6('0x29')][_0x5fc6('0x2a')](_0x1db1f0);})['then'](function(_0x11d7fc){_0x3f384a['rows']=_0x11d7fc;return _0x3f384a;})[_0x5fc6('0x18')](respondWithFilteredResult(_0x18e553,_0x1db1f0))[_0x5fc6('0x2b')](handleError(_0x18e553,null));};exports[_0x5fc6('0x2c')]=function(_0x18ddf,_0x331c2b){var _0x479e96={'raw':!![],'where':{'id':_0x18ddf[_0x5fc6('0x2d')]['id']}},_0x1dbb8c={};_0x1dbb8c[_0x5fc6('0x2e')]=_[_0x5fc6('0x2f')](db[_0x5fc6('0x29')][_0x5fc6('0x22')]);_0x1dbb8c[_0x5fc6('0x28')]=_[_0x5fc6('0x2f')](_0x18ddf['query']);_0x1dbb8c[_0x5fc6('0x30')]=_[_0x5fc6('0x31')](_0x1dbb8c['model'],_0x1dbb8c['query']);_0x479e96[_0x5fc6('0x32')]=_[_0x5fc6('0x31')](_0x1dbb8c['model'],qs[_0x5fc6('0x33')](_0x18ddf[_0x5fc6('0x28')][_0x5fc6('0x33')]));_0x479e96[_0x5fc6('0x32')]=_0x479e96['attributes']['length']?_0x479e96[_0x5fc6('0x32')]:_0x1dbb8c[_0x5fc6('0x2e')];if(_0x18ddf['query']['includeAll']){_0x479e96[_0x5fc6('0x27')]=[{'all':!![]}];}_0x479e96=_[_0x5fc6('0x34')]({},_0x479e96,_0x18ddf['options']);return db[_0x5fc6('0x29')]['find'](_0x479e96)[_0x5fc6('0x18')](handleEntityNotFound(_0x331c2b,null))[_0x5fc6('0x18')](respondWithResult(_0x331c2b,null))[_0x5fc6('0x2b')](handleError(_0x331c2b,null));};exports[_0x5fc6('0x35')]=function(_0x51fe4f,_0x3ccb5){return db[_0x5fc6('0x29')][_0x5fc6('0x35')](_0x51fe4f[_0x5fc6('0x36')],{})[_0x5fc6('0x18')](function(_0x3f786e){var _0x58e67c=_0x51fe4f[_0x5fc6('0x37')]['get']({'plain':!![]});if(!_0x58e67c)throw new Error(_0x5fc6('0x38'));if(_0x58e67c[_0x5fc6('0x39')]==='user'){var _0x179598=_0x3f786e[_0x5fc6('0x1a')]({'plain':!![]});var _0x4bfb73='FaxQueues';return db[_0x5fc6('0x3a')][_0x5fc6('0x3b')]({'where':{'name':_0x4bfb73,'userProfileId':_0x58e67c[_0x5fc6('0x3c')]},'raw':!![]})[_0x5fc6('0x18')](function(_0x370bc4){if(_0x370bc4&&_0x370bc4[_0x5fc6('0x3d')]===0x0){return db[_0x5fc6('0x1c')][_0x5fc6('0x35')]({'name':_0x179598[_0x5fc6('0x1f')],'resourceId':_0x179598['id'],'type':_0x370bc4[_0x5fc6('0x1f')],'sectionId':_0x370bc4['id']},{})[_0x5fc6('0x18')](function(){return _0x3f786e;});}else{return _0x3f786e;}})['catch'](function(_0xa5a2a8){logger[_0x5fc6('0x1d')](_0x5fc6('0x3e'),_0xa5a2a8);throw _0xa5a2a8;});}return _0x3f786e;})[_0x5fc6('0x18')](respondWithResult(_0x3ccb5,0xc9))[_0x5fc6('0x2b')](handleError(_0x3ccb5,null));};exports['update']=function(_0x56dd97,_0x485d8e){if(_0x56dd97[_0x5fc6('0x36')]['id']){delete _0x56dd97[_0x5fc6('0x36')]['id'];}return db[_0x5fc6('0x29')][_0x5fc6('0x3b')]({'where':{'id':_0x56dd97['params']['id']}})[_0x5fc6('0x18')](handleEntityNotFound(_0x485d8e,null))[_0x5fc6('0x18')](saveUpdates(_0x56dd97[_0x5fc6('0x36')],null))[_0x5fc6('0x18')](respondWithResult(_0x485d8e,null))[_0x5fc6('0x2b')](handleError(_0x485d8e,null));};exports[_0x5fc6('0x19')]=function(_0x5d6667,_0xb7e7f9){return db['FaxQueue']['find']({'where':{'id':_0x5d6667['params']['id']}})[_0x5fc6('0x18')](handleEntityNotFound(_0xb7e7f9,null))['then'](removeEntity(_0xb7e7f9,null))[_0x5fc6('0x2b')](handleError(_0xb7e7f9,null));};exports[_0x5fc6('0x3f')]=function(_0x1e2dfc,_0x5381ef){return db[_0x5fc6('0x29')]['describe']()[_0x5fc6('0x18')](respondWithResult(_0x5381ef,null))[_0x5fc6('0x2b')](handleError(_0x5381ef,null));};exports['getMembers']=function(_0x1cfa42,_0x4c98f3){var _0x193f32={'raw':!![],'where':{}},_0x26857b={},_0x32164c;return db[_0x5fc6('0x29')]['findOne']({'where':{'id':_0x1cfa42[_0x5fc6('0x2d')]['id']}})[_0x5fc6('0x18')](handleEntityNotFound(_0x4c98f3,null))[_0x5fc6('0x18')](function(_0x37f30d){if(_0x37f30d){_0x32164c=_0x37f30d['get']({'plain':!![]});_0x26857b[_0x5fc6('0x2e')]=_[_0x5fc6('0x2f')](db[_0x5fc6('0x40')][_0x5fc6('0x22')]);_0x26857b[_0x5fc6('0x28')]=_[_0x5fc6('0x2f')](_0x1cfa42[_0x5fc6('0x28')]);_0x26857b['filters']=_[_0x5fc6('0x31')](_0x26857b[_0x5fc6('0x2e')],_0x26857b[_0x5fc6('0x28')]);_0x193f32['attributes']=_[_0x5fc6('0x31')](_0x26857b[_0x5fc6('0x2e')],qs[_0x5fc6('0x33')](_0x1cfa42[_0x5fc6('0x28')][_0x5fc6('0x33')]));_0x193f32[_0x5fc6('0x32')]=_0x193f32[_0x5fc6('0x32')][_0x5fc6('0x41')]?_0x193f32[_0x5fc6('0x32')]:_0x26857b['model'];if(!_0x1cfa42[_0x5fc6('0x28')][_0x5fc6('0x42')](_0x5fc6('0x43'))){_0x193f32[_0x5fc6('0x12')]=qs[_0x5fc6('0x12')](_0x1cfa42['query'][_0x5fc6('0x12')]);_0x193f32[_0x5fc6('0x11')]=qs['offset'](_0x1cfa42[_0x5fc6('0x28')][_0x5fc6('0x11')]);}_0x193f32[_0x5fc6('0x44')]=qs[_0x5fc6('0x45')](_0x1cfa42[_0x5fc6('0x28')][_0x5fc6('0x45')]);_0x193f32[_0x5fc6('0x26')]=qs['filters'](_['pick'](_0x1cfa42['query'],_0x26857b[_0x5fc6('0x30')]));_0x193f32[_0x5fc6('0x26')][_0x5fc6('0x46')]=_0x37f30d['id'];if(_0x1cfa42['query'][_0x5fc6('0x47')]){_0x193f32[_0x5fc6('0x26')]=_['merge'](_0x193f32[_0x5fc6('0x26')],{'$or':_[_0x5fc6('0x21')](_0x193f32[_0x5fc6('0x32')],function(_0x53e146){var _0x2acc84={};_0x2acc84[_0x53e146]={'$like':'%'+_0x1cfa42[_0x5fc6('0x28')]['filter']+'%'};return _0x2acc84;})});}_0x193f32=_[_0x5fc6('0x34')]({},_0x193f32,_0x1cfa42[_0x5fc6('0x48')]);return db[_0x5fc6('0x40')][_0x5fc6('0x2a')](_0x193f32);}})[_0x5fc6('0x18')](function(_0x2a664c){if(_0x2a664c){return db[_0x5fc6('0x49')][_0x5fc6('0x4a')]({'where':{'id':_[_0x5fc6('0x21')](_0x2a664c,'UserId'),'role':'agent'},'attributes':['id','name',_0x5fc6('0x4b'),'updatedAt',_0x5fc6('0x4c')]});}})[_0x5fc6('0x18')](function(_0x3d586c){if(_0x3d586c){return{'count':_0x3d586c['count'],'rows':_[_0x5fc6('0x21')](_0x3d586c[_0x5fc6('0x4d')],function(_0xc696aa){return{'membername':_0xc696aa[_0x5fc6('0x1f')],'UserId':_0xc696aa['id'],'queue_name':_0x32164c[_0x5fc6('0x1f')],'FaxQueueId':_0x32164c['id'],'interface':util['format']('%s/%s','SIP',_0xc696aa['name']),'penalty':0x0,'paused':_0xc696aa[_0x5fc6('0x4b')],'createdAt':_0xc696aa[_0x5fc6('0x4c')],'updatedAt':_0xc696aa['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5fc6('0x18')](respondWithFilteredResult(_0x4c98f3,_0x193f32))['catch'](handleError(_0x4c98f3,null));};exports['getTeams']=function(_0x4d1b47,_0x3efb2e){var _0x4a94cb={};var _0x2a6280={};var _0x24c73f;var _0x377097;return db['FaxQueue'][_0x5fc6('0x4e')]({'where':{'id':_0x4d1b47[_0x5fc6('0x2d')]['id']}})[_0x5fc6('0x18')](handleEntityNotFound(_0x3efb2e,null))['then'](function(_0x19df78){if(_0x19df78){_0x24c73f=_0x19df78;_0x2a6280[_0x5fc6('0x2e')]=_[_0x5fc6('0x2f')](db[_0x5fc6('0x4f')][_0x5fc6('0x22')]);_0x2a6280[_0x5fc6('0x28')]=_[_0x5fc6('0x2f')](_0x4d1b47[_0x5fc6('0x28')]);_0x2a6280[_0x5fc6('0x30')]=_[_0x5fc6('0x31')](_0x2a6280[_0x5fc6('0x2e')],_0x2a6280[_0x5fc6('0x28')]);_0x4a94cb[_0x5fc6('0x32')]=_['intersection'](_0x2a6280[_0x5fc6('0x2e')],qs[_0x5fc6('0x33')](_0x4d1b47[_0x5fc6('0x28')][_0x5fc6('0x33')]));_0x4a94cb[_0x5fc6('0x32')]=_0x4a94cb[_0x5fc6('0x32')]['length']?_0x4a94cb['attributes']:_0x2a6280[_0x5fc6('0x2e')];_0x4a94cb[_0x5fc6('0x44')]=qs[_0x5fc6('0x45')](_0x4d1b47[_0x5fc6('0x28')]['sort']);_0x4a94cb[_0x5fc6('0x26')]=qs[_0x5fc6('0x30')](_[_0x5fc6('0x50')](_0x4d1b47[_0x5fc6('0x28')],_0x2a6280[_0x5fc6('0x30')]));if(_0x4d1b47[_0x5fc6('0x28')]['filter']){_0x4a94cb[_0x5fc6('0x26')]=_[_0x5fc6('0x34')](_0x4a94cb[_0x5fc6('0x26')],{'$or':_[_0x5fc6('0x21')](_0x4a94cb[_0x5fc6('0x32')],function(_0x50bf18){var _0xbb348a={};_0xbb348a[_0x50bf18]={'$like':'%'+_0x4d1b47[_0x5fc6('0x28')][_0x5fc6('0x47')]+'%'};return _0xbb348a;})});}_0x4a94cb=_['merge']({},_0x4a94cb,_0x4d1b47[_0x5fc6('0x48')]);return _0x24c73f[_0x5fc6('0x51')](_0x4a94cb);}})['then'](function(_0x39190f){if(_0x39190f){_0x377097=_0x39190f[_0x5fc6('0x41')];if(!_0x4d1b47['query'][_0x5fc6('0x42')](_0x5fc6('0x43'))){_0x4a94cb['limit']=qs[_0x5fc6('0x12')](_0x4d1b47[_0x5fc6('0x28')][_0x5fc6('0x12')]);_0x4a94cb[_0x5fc6('0x11')]=qs['offset'](_0x4d1b47[_0x5fc6('0x28')][_0x5fc6('0x11')]);}return _0x24c73f[_0x5fc6('0x51')](_0x4a94cb);}})[_0x5fc6('0x18')](function(_0x2067dd){if(_0x2067dd){return _0x2067dd?{'count':_0x377097,'rows':_0x2067dd}:null;}})[_0x5fc6('0x18')](respondWithResult(_0x3efb2e,null))[_0x5fc6('0x2b')](handleError(_0x3efb2e,null));};exports['addTeams']=function(_0x4c6e4e,_0x2f8953){var _0x11ee25=_0x4c6e4e[_0x5fc6('0x36')][_0x5fc6('0x52')];return db[_0x5fc6('0x4f')]['findAll']({'where':{'id':_0x11ee25},'attributes':['id'],'include':[{'model':db[_0x5fc6('0x49')],'as':_0x5fc6('0x53'),'attributes':['id',_0x5fc6('0x1f'),_0x5fc6('0x54'),'voicePause',_0x5fc6('0x55')],'raw':!![]}]})[_0x5fc6('0x18')](function(_0x2713bb){if(_0x2713bb){var _0x5609e4=_[_0x5fc6('0x56')](_0x2713bb,function(_0x279c74){var _0x210b76=_0x279c74[_0x5fc6('0x1a')]({'plain':!![]});return _0x210b76[_0x5fc6('0x53')];});return db[_0x5fc6('0x29')][_0x5fc6('0x3b')]({'where':{'id':_0x4c6e4e[_0x5fc6('0x2d')]['id']}})[_0x5fc6('0x18')](function(_0x57e4ff){return db[_0x5fc6('0x57')]['transaction'](function(_0x437e81){return _0x57e4ff['addTeams'](_0x11ee25,{'transaction':_0x437e81})[_0x5fc6('0x18')](function(){return BPromise[_0x5fc6('0x58')](_0x5609e4,function(_0x21519c){return db[_0x5fc6('0x40')][_0x5fc6('0x59')]({'where':{'UserId':_0x21519c['id'],'FaxQueueId':_0x4c6e4e[_0x5fc6('0x2d')]['id']},'transaction':_0x437e81});});})[_0x5fc6('0x18')](function(){_0x5609e4[_0x5fc6('0x5a')](function(_0x4c0c5a){socket[_0x5fc6('0x5b')]('userFaxQueue:save',{'UserId':_0x4c0c5a['id'],'FaxQueueId':_0x57e4ff['id']});});});});});}})['then'](respondWithStatusCode(_0x2f8953,null))['catch'](handleError(_0x2f8953,null));};exports[_0x5fc6('0x5c')]=function(_0x24bff8,_0x412733){return db[_0x5fc6('0x4f')][_0x5fc6('0x2a')]({'where':{'id':_0x24bff8[_0x5fc6('0x28')][_0x5fc6('0x52')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5fc6('0x53'),'attributes':['id'],'raw':!![]}]})[_0x5fc6('0x18')](handleEntityNotFound(_0x412733,null))[_0x5fc6('0x18')](function(_0x2a5dd9){var _0x103f7f=_['map'](_0x2a5dd9,'id');var _0x5dfab6=[];var _0x42eef4=[];var _0x3282bc=squel['select']();_0x3282bc['field'](_0x5fc6('0x5d'))['from'](_0x5fc6('0x5e'),'tq')[_0x5fc6('0x5f')]('user_has_teams','ut',_0x5fc6('0x60'))[_0x5fc6('0x26')](_0x5fc6('0x61'),_0x24bff8[_0x5fc6('0x2d')]['id']);for(var _0x564c58=0x0;_0x564c58<_0x2a5dd9[_0x5fc6('0x41')];_0x564c58+=0x1){let _0x36bf0f=_0x2a5dd9[_0x564c58];for(var _0x41f43e=0x0;_0x41f43e<_0x36bf0f['Agents'][_0x5fc6('0x41')];_0x41f43e+=0x1){let _0x161347=_0x36bf0f[_0x5fc6('0x53')][_0x41f43e];var _0x3c3c57=_0x3282bc[_0x5fc6('0x62')]();_0x3c3c57['where'](_0x5fc6('0x63'),_0x161347['id']);_0x42eef4[_0x5fc6('0x64')](db[_0x5fc6('0x57')][_0x5fc6('0x28')](_0x3c3c57['toString'](),{'type':db[_0x5fc6('0x57')][_0x5fc6('0x65')][_0x5fc6('0x66')]})['then'](function(_0x542995){if(_0x542995[_0x5fc6('0x41')]===0x1){return _0x161347['id'];}else{var _0x3d1711=_[_0x5fc6('0x67')](_['map'](_0x542995,_0x5fc6('0x68')),function(_0x1d13d9){return _['includes'](_0x103f7f,_0x1d13d9);});if(_0x3d1711){return _0x161347['id'];}}}));}}return BPromise[_0x5fc6('0x69')](_0x42eef4)[_0x5fc6('0x18')](function(_0x358e04){_0x5dfab6=_(_0x5dfab6)[_0x5fc6('0x6a')](_0x358e04)[_0x5fc6('0x6b')]()['value']();return db[_0x5fc6('0x29')]['find']({'where':{'id':_0x24bff8[_0x5fc6('0x2d')]['id']}})[_0x5fc6('0x18')](function(_0x5d962d){return db[_0x5fc6('0x57')][_0x5fc6('0x6c')](function(_0x116af8){return _0x5d962d[_0x5fc6('0x5c')](_0x24bff8['query'][_0x5fc6('0x52')],{'transaction':_0x116af8})[_0x5fc6('0x18')](function(){if(!_[_0x5fc6('0x6d')](_0x5dfab6)){return _0x5d962d[_0x5fc6('0x6e')](_0x5dfab6,{'transaction':_0x116af8});}})['then'](function(){_0x5dfab6[_0x5fc6('0x5a')](function(_0x3ecf69){socket[_0x5fc6('0x5b')](_0x5fc6('0x6f'),{'UserId':_0x3ecf69,'FaxQueueId':_0x5d962d['id']});});});});});});})['then'](respondWithStatusCode(_0x412733,null))['catch'](handleError(_0x412733,null));};exports[_0x5fc6('0x70')]=function(_0x455c45,_0x353e56){return db[_0x5fc6('0x29')][_0x5fc6('0x3b')]({'where':{'id':_0x455c45[_0x5fc6('0x2d')]['id']}})['then'](handleEntityNotFound(_0x353e56,null))['then'](function(_0x5534c5){if(_0x5534c5){return _0x5534c5[_0x5fc6('0x70')](_0x455c45['body'][_0x5fc6('0x52')],_[_0x5fc6('0x71')](_0x455c45[_0x5fc6('0x36')],['ids','id'])||{})['spread'](function(_0x39946d){for(var _0x38d105=0x0;_0x38d105<_0x455c45['body']['ids'][_0x5fc6('0x41')];_0x38d105+=0x1){socket[_0x5fc6('0x5b')](_0x5fc6('0x72'),{'UserId':Number(_0x455c45[_0x5fc6('0x36')][_0x5fc6('0x52')][_0x38d105]),'FaxQueueId':Number(_0x455c45[_0x5fc6('0x2d')]['id'])});}return _0x39946d;});}})[_0x5fc6('0x18')](respondWithResult(_0x353e56,null))[_0x5fc6('0x2b')](handleError(_0x353e56,null));};exports['removeAgents']=function(_0xd6ec5c,_0x4e4c67){return db['FaxQueue'][_0x5fc6('0x3b')]({'where':{'id':_0xd6ec5c[_0x5fc6('0x2d')]['id']}})['then'](handleEntityNotFound(_0x4e4c67,null))[_0x5fc6('0x18')](function(_0x326de4){if(_0x326de4){return _0x326de4[_0x5fc6('0x6e')](_0xd6ec5c['query'][_0x5fc6('0x52')])[_0x5fc6('0x18')](function(){if(_['isArray'](_0xd6ec5c[_0x5fc6('0x28')]['ids'])){for(var _0x12f042=0x0;_0x12f042<_0xd6ec5c[_0x5fc6('0x28')][_0x5fc6('0x52')][_0x5fc6('0x41')];_0x12f042+=0x1){socket[_0x5fc6('0x5b')](_0x5fc6('0x6f'),{'UserId':Number(_0xd6ec5c[_0x5fc6('0x28')][_0x5fc6('0x52')][_0x12f042]),'FaxQueueId':Number(_0xd6ec5c['params']['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0xd6ec5c[_0x5fc6('0x28')][_0x5fc6('0x52')]),'FaxQueueId':Number(_0xd6ec5c[_0x5fc6('0x2d')]['id'])});}});}})[_0x5fc6('0x18')](respondWithStatusCode(_0x4e4c67,null))[_0x5fc6('0x2b')](handleError(_0x4e4c67,null));};exports[_0x5fc6('0x73')]=function(_0x13732c,_0x4bb35d){var _0x515b00={};var _0x305ce5={};var _0x4b02eb;var _0x7c1ae5;return db[_0x5fc6('0x29')][_0x5fc6('0x4e')]({'where':{'id':_0x13732c[_0x5fc6('0x2d')]['id']}})[_0x5fc6('0x18')](handleEntityNotFound(_0x4bb35d,null))[_0x5fc6('0x18')](function(_0x191fc0){if(_0x191fc0){_0x4b02eb=_0x191fc0;_0x305ce5[_0x5fc6('0x2e')]=_[_0x5fc6('0x2f')](db[_0x5fc6('0x49')]['rawAttributes']);_0x305ce5[_0x5fc6('0x28')]=_[_0x5fc6('0x2f')](_0x13732c[_0x5fc6('0x28')]);_0x305ce5[_0x5fc6('0x30')]=_[_0x5fc6('0x31')](_0x305ce5[_0x5fc6('0x2e')],_0x305ce5[_0x5fc6('0x28')]);_0x515b00[_0x5fc6('0x32')]=_[_0x5fc6('0x31')](_0x305ce5[_0x5fc6('0x2e')],qs[_0x5fc6('0x33')](_0x13732c[_0x5fc6('0x28')]['fields']));_0x515b00[_0x5fc6('0x32')]=_0x515b00['attributes'][_0x5fc6('0x41')]?_0x515b00[_0x5fc6('0x32')]:_0x305ce5[_0x5fc6('0x2e')];_0x515b00[_0x5fc6('0x44')]=qs[_0x5fc6('0x45')](_0x13732c['query']['sort']);_0x515b00[_0x5fc6('0x26')]=qs['filters'](_['pick'](_0x13732c[_0x5fc6('0x28')],_0x305ce5[_0x5fc6('0x30')]));if(_0x13732c[_0x5fc6('0x28')][_0x5fc6('0x47')]){_0x515b00['where']=_[_0x5fc6('0x34')](_0x515b00[_0x5fc6('0x26')],{'$or':_['map'](_0x515b00[_0x5fc6('0x32')],function(_0xc3848a){var _0x20f2ec={};_0x20f2ec[_0xc3848a]={'$like':'%'+_0x13732c[_0x5fc6('0x28')][_0x5fc6('0x47')]+'%'};return _0x20f2ec;})});}_0x515b00=_[_0x5fc6('0x34')]({},_0x515b00,_0x13732c[_0x5fc6('0x48')]);return _0x4b02eb[_0x5fc6('0x73')](_0x515b00);}})['then'](function(_0x316b19){if(_0x316b19){_0x7c1ae5=_0x316b19[_0x5fc6('0x41')];if(!_0x13732c[_0x5fc6('0x28')]['hasOwnProperty'](_0x5fc6('0x43'))){_0x515b00['limit']=qs[_0x5fc6('0x12')](_0x13732c[_0x5fc6('0x28')]['limit']);_0x515b00[_0x5fc6('0x11')]=qs[_0x5fc6('0x11')](_0x13732c[_0x5fc6('0x28')]['offset']);}return _0x4b02eb['getAgents'](_0x515b00);}})[_0x5fc6('0x18')](function(_0x1c6bc6){if(_0x1c6bc6){return _0x1c6bc6?{'count':_0x7c1ae5,'rows':_0x1c6bc6}:null;}})[_0x5fc6('0x18')](respondWithResult(_0x4bb35d,null))[_0x5fc6('0x2b')](handleError(_0x4bb35d,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index c892fb2..8fcc070 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 _0x941c=['save','remove','hasOwnProperty','hook','exports','events','FaxQueue','setMaxListeners'];(function(_0x3fbd25,_0x33dc10){var _0x5367b9=function(_0x31c791){while(--_0x31c791){_0x3fbd25['push'](_0x3fbd25['shift']());}};_0x5367b9(++_0x33dc10);}(_0x941c,0x185));var _0xc941=function(_0x20a877,_0x46be41){_0x20a877=_0x20a877-0x0;var _0x5db413=_0x941c[_0x20a877];return _0x5db413;};'use strict';var EventEmitter=require(_0xc941('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xc941('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xc941('0x2')](0x0);var events={'afterCreate':_0xc941('0x3'),'afterUpdate':'update','afterDestroy':_0xc941('0x4')};function emitEvent(_0x4eb36f){return function(_0x3a6af7,_0x3965a0,_0x29322d){FaxQueueEvents['emit'](_0x4eb36f+':'+_0x3a6af7['id'],_0x3a6af7);FaxQueueEvents['emit'](_0x4eb36f,_0x3a6af7);_0x29322d(null);};}for(var e in events){if(events[_0xc941('0x5')](e)){var event=events[e];FaxQueue[_0xc941('0x6')](e,emitEvent(event));}}module[_0xc941('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x7170=['events','FaxQueue','save','emit','hasOwnProperty','hook','exports'];(function(_0x4e69d9,_0x44b22a){var _0x2d0709=function(_0x2dbe53){while(--_0x2dbe53){_0x4e69d9['push'](_0x4e69d9['shift']());}};_0x2d0709(++_0x44b22a);}(_0x7170,0xf5));var _0x0717=function(_0x1ffb53,_0x22ac1f){_0x1ffb53=_0x1ffb53-0x0;var _0x5e6b2b=_0x7170[_0x1ffb53];return _0x5e6b2b;};'use strict';var EventEmitter=require(_0x0717('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x0717('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0717('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x35cab1){return function(_0x3970f3,_0x458d9a,_0x8bfc64){FaxQueueEvents[_0x0717('0x3')](_0x35cab1+':'+_0x3970f3['id'],_0x3970f3);FaxQueueEvents[_0x0717('0x3')](_0x35cab1,_0x3970f3);_0x8bfc64(null);};}for(var e in events){if(events[_0x0717('0x4')](e)){var event=events[e];FaxQueue[_0x0717('0x5')](e,emitEvent(event));}}module[_0x0717('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index ec5b911..26de6a9 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 _0xe0c4=['path','rimraf','../../config/environment','FaxQueue','lodash','api','moment','bluebird','request-promise'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xe0c4,0xf7));var _0x4e0c=function(_0x43241c,_0xad3f71){_0x43241c=_0x43241c-0x0;var _0x43b112=_0xe0c4[_0x43241c];return _0x43b112;};'use strict';var _=require(_0x4e0c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4e0c('0x1'));var moment=require(_0x4e0c('0x2'));var BPromise=require(_0x4e0c('0x3'));var rp=require(_0x4e0c('0x4'));var fs=require('fs');var path=require(_0x4e0c('0x5'));var rimraf=require(_0x4e0c('0x6'));var config=require(_0x4e0c('0x7'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0x2a2afe,_0x5a21a3){return _0x2a2afe['define'](_0x4e0c('0x8'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca04=['../../config/environment','exports','define','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xca04,0x118));var _0x4ca0=function(_0x497874,_0x2cf98b){_0x497874=_0x497874-0x0;var _0x34e0ab=_0xca04[_0x497874];return _0x34e0ab;};'use strict';var _=require(_0x4ca0('0x0'));var util=require(_0x4ca0('0x1'));var logger=require(_0x4ca0('0x2'))(_0x4ca0('0x3'));var moment=require(_0x4ca0('0x4'));var BPromise=require(_0x4ca0('0x5'));var rp=require(_0x4ca0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4ca0('0x7'));var config=require(_0x4ca0('0x8'));var attributes=require('./faxQueue.attributes');module[_0x4ca0('0x9')]=function(_0x379e98,_0x595335){return _0x379e98[_0x4ca0('0xa')]('FaxQueue',attributes,{'tableName':_0x4ca0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index b3747eb..1135ff3 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 _0x0999=['code','message','result','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','ShowFaxQueue','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x398d63,_0x3ae789){var _0x1077af=function(_0x145d74){while(--_0x145d74){_0x398d63['push'](_0x398d63['shift']());}};_0x1077af(++_0x3ae789);}(_0x0999,0x14a));var _0x9099=function(_0x596c43,_0x28647a){_0x596c43=_0x596c43-0x0;var _0x4e1315=_0x0999[_0x596c43];return _0x4e1315;};'use strict';var _=require(_0x9099('0x0'));var util=require('util');var moment=require(_0x9099('0x1'));var BPromise=require('bluebird');var rs=require(_0x9099('0x2'));var fs=require('fs');var Redis=require(_0x9099('0x3'));var db=require(_0x9099('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9099('0x5'))('rpc');var config=require(_0x9099('0x6'));var jayson=require(_0x9099('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x9099('0x8')](config[_0x9099('0x9')],{'host':_0x9099('0xa'),'port':0x18eb});var socket=require(_0x9099('0xb'))(new Redis(config[_0x9099('0x9')]));require(_0x9099('0xc'))['register'](socket);function respondWithRpcPromise(_0x53fbc2,_0x51fad4,_0x2003c3){return new BPromise(function(_0x5dbdf6,_0x55ab5b){return client[_0x9099('0xd')](_0x53fbc2,_0x2003c3)['then'](function(_0x1e5df1){logger[_0x9099('0xe')](_0x9099('0xf'),_0x51fad4,_0x9099('0x10'));logger[_0x9099('0x11')](_0x9099('0x12'),_0x51fad4,_0x9099('0x10'),JSON[_0x9099('0x13')](_0x1e5df1));if(_0x1e5df1['error']){if(_0x1e5df1[_0x9099('0x14')][_0x9099('0x15')]===0x1f4){logger[_0x9099('0x14')](_0x9099('0xf'),_0x51fad4,_0x1e5df1['error'][_0x9099('0x16')]);return _0x55ab5b(_0x1e5df1[_0x9099('0x14')]['message']);}logger[_0x9099('0x14')](_0x9099('0xf'),_0x51fad4,_0x1e5df1[_0x9099('0x14')][_0x9099('0x16')]);return _0x5dbdf6(_0x1e5df1[_0x9099('0x14')]['message']);}else{logger[_0x9099('0xe')](_0x9099('0xf'),_0x51fad4,'request\x20sent');_0x5dbdf6(_0x1e5df1[_0x9099('0x17')][_0x9099('0x16')]);}})['catch'](function(_0x4c8063){logger[_0x9099('0x14')](_0x9099('0xf'),_0x51fad4,_0x4c8063);_0x55ab5b(_0x4c8063);});});}exports[_0x9099('0x18')]=function(_0x2953cc){var _0x4f5c09=this;return new Promise(function(_0x2cc877,_0x2198d7){return db[_0x9099('0x19')][_0x9099('0x1a')]({'raw':_0x2953cc[_0x9099('0x1b')]?_0x2953cc[_0x9099('0x1b')][_0x9099('0x1c')]===undefined?!![]:![]:!![],'where':_0x2953cc[_0x9099('0x1b')]?_0x2953cc[_0x9099('0x1b')][_0x9099('0x1d')]||null:null,'attributes':_0x2953cc['options']?_0x2953cc[_0x9099('0x1b')][_0x9099('0x1e')]||null:null,'limit':_0x2953cc[_0x9099('0x1b')]?_0x2953cc[_0x9099('0x1b')][_0x9099('0x1f')]||null:null,'include':_0x2953cc[_0x9099('0x1b')]?_0x2953cc[_0x9099('0x1b')][_0x9099('0x20')]?_[_0x9099('0x21')](_0x2953cc[_0x9099('0x1b')]['include'],function(_0x1c38fe){return{'model':db[_0x1c38fe['model']],'as':_0x1c38fe['as'],'attributes':_0x1c38fe[_0x9099('0x1e')],'include':_0x1c38fe[_0x9099('0x20')]?_[_0x9099('0x21')](_0x1c38fe[_0x9099('0x20')],function(_0x5b86c5){return{'model':db[_0x5b86c5[_0x9099('0x22')]],'as':_0x5b86c5['as'],'attributes':_0x5b86c5[_0x9099('0x1e')],'include':_0x5b86c5[_0x9099('0x20')]?_['map'](_0x5b86c5['include'],function(_0x397add){return{'model':db[_0x397add['model']],'as':_0x397add['as'],'attributes':_0x397add[_0x9099('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9099('0x23')](function(_0x596d34){logger[_0x9099('0xe')](_0x9099('0x18'),_0x2953cc);logger['debug'](_0x9099('0x18'),_0x2953cc,JSON[_0x9099('0x13')](_0x596d34));_0x2cc877(_0x596d34);})[_0x9099('0x24')](function(_0x17ad11){logger['error'](_0x9099('0x18'),_0x17ad11[_0x9099('0x16')],_0x2953cc);_0x2198d7(_0x4f5c09['error'](0x1f4,_0x17ad11['message']));});});};exports[_0x9099('0x25')]=function(_0x41b93d){var _0x4bd08f=this;return new Promise(function(_0x492177,_0x31a613){return db['FaxQueue'][_0x9099('0x26')]({'raw':_0x41b93d['options']?_0x41b93d['options'][_0x9099('0x1c')]===undefined?!![]:![]:!![],'where':_0x41b93d[_0x9099('0x1b')]?_0x41b93d[_0x9099('0x1b')][_0x9099('0x1d')]||null:null,'attributes':_0x41b93d[_0x9099('0x1b')]?_0x41b93d['options']['attributes']||null:null,'include':_0x41b93d[_0x9099('0x1b')]?_0x41b93d['options'][_0x9099('0x20')]?_[_0x9099('0x21')](_0x41b93d[_0x9099('0x1b')][_0x9099('0x20')],function(_0x3b06ce){return{'model':db[_0x3b06ce[_0x9099('0x22')]],'as':_0x3b06ce['as'],'attributes':_0x3b06ce[_0x9099('0x1e')],'include':_0x3b06ce[_0x9099('0x20')]?_[_0x9099('0x21')](_0x3b06ce['include'],function(_0x1fb7ec){return{'model':db[_0x1fb7ec[_0x9099('0x22')]],'as':_0x1fb7ec['as'],'attributes':_0x1fb7ec['attributes'],'include':_0x1fb7ec[_0x9099('0x20')]?_['map'](_0x1fb7ec['include'],function(_0x3277a6){return{'model':db[_0x3277a6['model']],'as':_0x3277a6['as'],'attributes':_0x3277a6['attributes']};}):[]};}):[]};}):[]:[]})[_0x9099('0x23')](function(_0x354f18){logger[_0x9099('0xe')]('ShowFaxQueue',_0x41b93d);logger[_0x9099('0x11')](_0x9099('0x25'),_0x41b93d,JSON[_0x9099('0x13')](_0x354f18));_0x492177(_0x354f18);})['catch'](function(_0x2e4bf8){logger['error'](_0x9099('0x25'),_0x2e4bf8[_0x9099('0x16')],_0x41b93d);_0x31a613(_0x4bd08f[_0x9099('0x14')](0x1f4,_0x2e4bf8[_0x9099('0x16')]));});});}; \ No newline at end of file +var _0x8b95=['then','debug','stringify','ShowFaxQueue','FaxQueue','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','info','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','findAll','options','raw','limit','include','model','map','attributes'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8b95,0xef));var _0x58b9=function(_0x510840,_0x17ac89){_0x510840=_0x510840-0x0;var _0x1a9260=_0x8b95[_0x510840];return _0x1a9260;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x58b9('0x0'));var BPromise=require(_0x58b9('0x1'));var rs=require(_0x58b9('0x2'));var fs=require('fs');var Redis=require(_0x58b9('0x3'));var db=require(_0x58b9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x58b9('0x5'))(_0x58b9('0x6'));var config=require(_0x58b9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x58b9('0x8')][_0x58b9('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x58b9('0xa')],{'host':_0x58b9('0xb'),'port':0x18eb});var socket=require(_0x58b9('0xc'))(new Redis(config[_0x58b9('0xa')]));require(_0x58b9('0xd'))[_0x58b9('0xe')](socket);function respondWithRpcPromise(_0x29bd78,_0x68d068,_0x29bc04){return new BPromise(function(_0x35c05f,_0x5eb923){return client[_0x58b9('0xf')](_0x29bd78,_0x29bc04)['then'](function(_0x1b9a05){logger[_0x58b9('0x10')]('FaxQueue,\x20%s,\x20%s',_0x68d068,_0x58b9('0x11'));logger['debug'](_0x58b9('0x12'),_0x68d068,_0x58b9('0x11'),JSON['stringify'](_0x1b9a05));if(_0x1b9a05[_0x58b9('0x13')]){if(_0x1b9a05[_0x58b9('0x13')][_0x58b9('0x14')]===0x1f4){logger[_0x58b9('0x13')](_0x58b9('0x15'),_0x68d068,_0x1b9a05[_0x58b9('0x13')][_0x58b9('0x16')]);return _0x5eb923(_0x1b9a05['error'][_0x58b9('0x16')]);}logger['error'](_0x58b9('0x15'),_0x68d068,_0x1b9a05[_0x58b9('0x13')]['message']);return _0x35c05f(_0x1b9a05['error'][_0x58b9('0x16')]);}else{logger[_0x58b9('0x10')](_0x58b9('0x15'),_0x68d068,_0x58b9('0x11'));_0x35c05f(_0x1b9a05[_0x58b9('0x17')]['message']);}})[_0x58b9('0x18')](function(_0xf51f00){logger[_0x58b9('0x13')]('FaxQueue,\x20%s,\x20%s',_0x68d068,_0xf51f00);_0x5eb923(_0xf51f00);});});}exports[_0x58b9('0x19')]=function(_0x21d081){var _0x5ac718=this;return new Promise(function(_0x43eda0,_0x5acda5){return db['FaxQueue'][_0x58b9('0x1a')]({'raw':_0x21d081[_0x58b9('0x1b')]?_0x21d081[_0x58b9('0x1b')][_0x58b9('0x1c')]===undefined?!![]:![]:!![],'where':_0x21d081[_0x58b9('0x1b')]?_0x21d081[_0x58b9('0x1b')]['where']||null:null,'attributes':_0x21d081[_0x58b9('0x1b')]?_0x21d081['options']['attributes']||null:null,'limit':_0x21d081['options']?_0x21d081[_0x58b9('0x1b')][_0x58b9('0x1d')]||null:null,'include':_0x21d081[_0x58b9('0x1b')]?_0x21d081[_0x58b9('0x1b')][_0x58b9('0x1e')]?_['map'](_0x21d081[_0x58b9('0x1b')][_0x58b9('0x1e')],function(_0x49f504){return{'model':db[_0x49f504[_0x58b9('0x1f')]],'as':_0x49f504['as'],'attributes':_0x49f504['attributes'],'include':_0x49f504[_0x58b9('0x1e')]?_[_0x58b9('0x20')](_0x49f504[_0x58b9('0x1e')],function(_0x2c6cb5){return{'model':db[_0x2c6cb5[_0x58b9('0x1f')]],'as':_0x2c6cb5['as'],'attributes':_0x2c6cb5[_0x58b9('0x21')],'include':_0x2c6cb5[_0x58b9('0x1e')]?_[_0x58b9('0x20')](_0x2c6cb5['include'],function(_0x28303f){return{'model':db[_0x28303f['model']],'as':_0x28303f['as'],'attributes':_0x28303f[_0x58b9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x58b9('0x22')](function(_0x5c025a){logger[_0x58b9('0x10')](_0x58b9('0x19'),_0x21d081);logger[_0x58b9('0x23')]('GetFaxQueue',_0x21d081,JSON[_0x58b9('0x24')](_0x5c025a));_0x43eda0(_0x5c025a);})[_0x58b9('0x18')](function(_0x156861){logger[_0x58b9('0x13')]('GetFaxQueue',_0x156861[_0x58b9('0x16')],_0x21d081);_0x5acda5(_0x5ac718[_0x58b9('0x13')](0x1f4,_0x156861[_0x58b9('0x16')]));});});};exports[_0x58b9('0x25')]=function(_0x1399bd){var _0x186451=this;return new Promise(function(_0x58aa68,_0x4eaa7d){return db[_0x58b9('0x26')]['find']({'raw':_0x1399bd['options']?_0x1399bd[_0x58b9('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1399bd[_0x58b9('0x1b')]?_0x1399bd['options']['where']||null:null,'attributes':_0x1399bd[_0x58b9('0x1b')]?_0x1399bd[_0x58b9('0x1b')][_0x58b9('0x21')]||null:null,'include':_0x1399bd[_0x58b9('0x1b')]?_0x1399bd[_0x58b9('0x1b')][_0x58b9('0x1e')]?_[_0x58b9('0x20')](_0x1399bd[_0x58b9('0x1b')][_0x58b9('0x1e')],function(_0x402a28){return{'model':db[_0x402a28[_0x58b9('0x1f')]],'as':_0x402a28['as'],'attributes':_0x402a28[_0x58b9('0x21')],'include':_0x402a28[_0x58b9('0x1e')]?_[_0x58b9('0x20')](_0x402a28[_0x58b9('0x1e')],function(_0x213a34){return{'model':db[_0x213a34['model']],'as':_0x213a34['as'],'attributes':_0x213a34['attributes'],'include':_0x213a34[_0x58b9('0x1e')]?_['map'](_0x213a34[_0x58b9('0x1e')],function(_0x2f61ef){return{'model':db[_0x2f61ef['model']],'as':_0x2f61ef['as'],'attributes':_0x2f61ef['attributes']};}):[]};}):[]};}):[]:[]})[_0x58b9('0x22')](function(_0x38073e){logger[_0x58b9('0x10')](_0x58b9('0x25'),_0x1399bd);logger[_0x58b9('0x23')]('ShowFaxQueue',_0x1399bd,JSON[_0x58b9('0x24')](_0x38073e));_0x58aa68(_0x38073e);})[_0x58b9('0x18')](function(_0x3fa6bb){logger[_0x58b9('0x13')](_0x58b9('0x25'),_0x3fa6bb[_0x58b9('0x16')],_0x1399bd);_0x4eaa7d(_0x186451[_0x58b9('0x13')](0x1f4,_0x3fa6bb[_0x58b9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 371d4cf..9b411b3 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 _0xc40f=['update','removeListener','register','length','./faxQueue.events','remove'];(function(_0x48e838,_0x1d826e){var _0x2d522a=function(_0x1a07d5){while(--_0x1a07d5){_0x48e838['push'](_0x48e838['shift']());}};_0x2d522a(++_0x1d826e);}(_0xc40f,0x1f0));var _0xfc40=function(_0x4b88f8,_0x20ae18){_0x4b88f8=_0x4b88f8-0x0;var _0x15ecc5=_0xc40f[_0x4b88f8];return _0x15ecc5;};'use strict';var FaxQueueEvents=require(_0xfc40('0x0'));var events=['save',_0xfc40('0x1'),_0xfc40('0x2')];function createListener(_0x967458,_0x3a325c){return function(_0x1d169e){_0x3a325c['emit'](_0x967458,_0x1d169e);};}function removeListener(_0x512da7,_0x449f47){return function(){FaxQueueEvents[_0xfc40('0x3')](_0x512da7,_0x449f47);};}exports[_0xfc40('0x4')]=function(_0x3427a4){for(var _0x2e3a56=0x0,_0x2004ed=events[_0xfc40('0x5')];_0x2e3a56<_0x2004ed;_0x2e3a56++){var _0x1d1d59=events[_0x2e3a56];var _0xe44a59=createListener('faxQueue:'+_0x1d1d59,_0x3427a4);FaxQueueEvents['on'](_0x1d1d59,_0xe44a59);}}; \ No newline at end of file +var _0xa60e=['faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x2f34d3,_0x38d3f7){var _0x10cf63=function(_0x6c528){while(--_0x6c528){_0x2f34d3['push'](_0x2f34d3['shift']());}};_0x10cf63(++_0x38d3f7);}(_0xa60e,0x1c3));var _0xea60=function(_0x15b336,_0x382b8e){_0x15b336=_0x15b336-0x0;var _0x33dcbf=_0xa60e[_0x15b336];return _0x33dcbf;};'use strict';var FaxQueueEvents=require(_0xea60('0x0'));var events=[_0xea60('0x1'),_0xea60('0x2'),_0xea60('0x3')];function createListener(_0x2d51b7,_0x195ab2){return function(_0x220015){_0x195ab2[_0xea60('0x4')](_0x2d51b7,_0x220015);};}function removeListener(_0x2a39c9,_0x5b8fdb){return function(){FaxQueueEvents[_0xea60('0x5')](_0x2a39c9,_0x5b8fdb);};}exports[_0xea60('0x6')]=function(_0x4e205d){for(var _0x47f55b=0x0,_0x27f68c=events[_0xea60('0x7')];_0x47f55b<_0x27f68c;_0x47f55b++){var _0xa6b458=events[_0x47f55b];var _0x381ec3=createListener(_0xea60('0x8')+_0xa6b458,_0x4e205d);FaxQueueEvents['on'](_0xa6b458,_0x381ec3);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 95c07f4..c78981f 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 _0xdec3=['removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','getMembers','getTeams','/:id/users','getAgents','post','create','put','delete','destroy','/:id/teams','removeTeams'];(function(_0x3481a9,_0x1a0020){var _0x14d6a1=function(_0x4dfd3b){while(--_0x4dfd3b){_0x3481a9['push'](_0x3481a9['shift']());}};_0x14d6a1(++_0x1a0020);}(_0xdec3,0x89));var _0x3dec=function(_0x22facf,_0x4a2b55){_0x22facf=_0x22facf-0x0;var _0x35c848=_0xdec3[_0x22facf];return _0x35c848;};'use strict';var multer=require(_0x3dec('0x0'));var util=require('util');var path=require(_0x3dec('0x1'));var timeout=require(_0x3dec('0x2'));var express=require(_0x3dec('0x3'));var router=express['Router']();var fs_extra=require(_0x3dec('0x4'));var auth=require(_0x3dec('0x5'));var interaction=require(_0x3dec('0x6'));var config=require(_0x3dec('0x7'));var controller=require('./faxQueue.controller');router[_0x3dec('0x8')]('/',auth[_0x3dec('0x9')](),controller[_0x3dec('0xa')]);router[_0x3dec('0x8')](_0x3dec('0xb'),auth[_0x3dec('0x9')](),controller[_0x3dec('0xc')]);router['get'](_0x3dec('0xd'),auth[_0x3dec('0x9')](),controller['show']);router[_0x3dec('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0x3dec('0xe')]);router[_0x3dec('0x8')]('/:id/teams',auth[_0x3dec('0x9')](),controller[_0x3dec('0xf')]);router['get'](_0x3dec('0x10'),auth[_0x3dec('0x9')](),controller[_0x3dec('0x11')]);router[_0x3dec('0x12')]('/',auth[_0x3dec('0x9')](),controller[_0x3dec('0x13')]);router['post']('/:id/teams',auth[_0x3dec('0x9')](),controller['addTeams']);router[_0x3dec('0x12')](_0x3dec('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0x3dec('0x14')]('/:id',auth[_0x3dec('0x9')](),controller['update']);router[_0x3dec('0x15')]('/:id',auth[_0x3dec('0x9')](),controller[_0x3dec('0x16')]);router['delete'](_0x3dec('0x17'),auth[_0x3dec('0x9')](),controller[_0x3dec('0x18')]);router[_0x3dec('0x15')](_0x3dec('0x10'),auth[_0x3dec('0x9')](),controller[_0x3dec('0x19')]);module[_0x3dec('0x1a')]=router; \ No newline at end of file +var _0x7046=['../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','/:id','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0xf5276f,_0x1387b7){var _0x4e7834=function(_0x25cb10){while(--_0x25cb10){_0xf5276f['push'](_0xf5276f['shift']());}};_0x4e7834(++_0x1387b7);}(_0x7046,0x144));var _0x6704=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7046[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var path=require(_0x6704('0x2'));var timeout=require(_0x6704('0x3'));var express=require('express');var router=express[_0x6704('0x4')]();var fs_extra=require(_0x6704('0x5'));var auth=require(_0x6704('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6704('0x7'));var controller=require(_0x6704('0x8'));router[_0x6704('0x9')]('/',auth[_0x6704('0xa')](),controller[_0x6704('0xb')]);router['get'](_0x6704('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x6704('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6704('0xd')]);router[_0x6704('0x9')](_0x6704('0xe'),auth[_0x6704('0xa')](),controller[_0x6704('0xf')]);router[_0x6704('0x9')](_0x6704('0x10'),auth[_0x6704('0xa')](),controller['getTeams']);router[_0x6704('0x9')](_0x6704('0x11'),auth['isAuthenticated'](),controller[_0x6704('0x12')]);router[_0x6704('0x13')]('/',auth[_0x6704('0xa')](),controller[_0x6704('0x14')]);router[_0x6704('0x13')](_0x6704('0x10'),auth[_0x6704('0xa')](),controller[_0x6704('0x15')]);router[_0x6704('0x13')]('/:id/users',auth[_0x6704('0xa')](),controller[_0x6704('0x16')]);router[_0x6704('0x17')]('/:id',auth[_0x6704('0xa')](),controller[_0x6704('0x18')]);router[_0x6704('0x19')](_0x6704('0x1a'),auth[_0x6704('0xa')](),controller['destroy']);router[_0x6704('0x19')](_0x6704('0x10'),auth[_0x6704('0xa')](),controller[_0x6704('0x1b')]);router[_0x6704('0x19')]('/:id/users',auth[_0x6704('0xa')](),controller[_0x6704('0x1c')]);module[_0x6704('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 914e19a..72042ee 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 _0xf179=['moment','sequelize','exports','STRING','DATE'];(function(_0x58da8a,_0x1c0584){var _0x5ba3a3=function(_0x31552b){while(--_0x31552b){_0x58da8a['push'](_0x58da8a['shift']());}};_0x5ba3a3(++_0x1c0584);}(_0xf179,0x87));var _0x9f17=function(_0x18ad2d,_0x2d5cd1){_0x18ad2d=_0x18ad2d-0x0;var _0x25ffc4=_0xf179[_0x18ad2d];return _0x25ffc4;};'use strict';var moment=require(_0x9f17('0x0'));var Sequelize=require(_0x9f17('0x1'));module[_0x9f17('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x9f17('0x3')]},'joinAt':{'type':Sequelize[_0x9f17('0x4')]},'leaveAt':{'type':Sequelize[_0x9f17('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9f17('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4d61=['STRING','DATE','moment','sequelize','exports'];(function(_0x4914ad,_0x551a18){var _0x3cd61f=function(_0x2a773e){while(--_0x2a773e){_0x4914ad['push'](_0x4914ad['shift']());}};_0x3cd61f(++_0x551a18);}(_0x4d61,0x147));var _0x14d6=function(_0x26cc37,_0x1c49d2){_0x26cc37=_0x26cc37-0x0;var _0x244e5c=_0x4d61[_0x26cc37];return _0x244e5c;};'use strict';var moment=require(_0x14d6('0x0'));var Sequelize=require(_0x14d6('0x1'));module[_0x14d6('0x2')]={'uniqueid':{'type':Sequelize[_0x14d6('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x14d6('0x3')]},'joinAt':{'type':Sequelize[_0x14d6('0x4')]},'leaveAt':{'type':Sequelize[_0x14d6('0x4')]},'acceptAt':{'type':Sequelize[_0x14d6('0x4')]},'exitAt':{'type':Sequelize[_0x14d6('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index b6dfc93..937c74b 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 _0x5bbd=['VIRTUAL','options','includeAll','catch','params','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x97eeef,_0xab42c5){var _0x5d8a3b=function(_0xeb3910){while(--_0xeb3910){_0x97eeef['push'](_0x97eeef['shift']());}};_0x5d8a3b(++_0xab42c5);}(_0x5bbd,0x12b));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd5bb('0x0'));var rimraf=require(_0xd5bb('0x1'));var zipdir=require(_0xd5bb('0x2'));var jsonpatch=require(_0xd5bb('0x3'));var rp=require(_0xd5bb('0x4'));var moment=require(_0xd5bb('0x5'));var BPromise=require(_0xd5bb('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd5bb('0x7'));var csv=require(_0xd5bb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd5bb('0x9'));var squel=require('squel');var crypto=require(_0xd5bb('0xa'));var jsforce=require(_0xd5bb('0xb'));var deskjs=require(_0xd5bb('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd5bb('0xd'));var Redis=require(_0xd5bb('0xe'));var authService=require(_0xd5bb('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd5bb('0x10'));var hardwareService=require(_0xd5bb('0x11'));var logger=require(_0xd5bb('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xd5bb('0x13'));var licenseUtil=require(_0xd5bb('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1df75a,_0x4b1f1b){_0x4b1f1b=_0x4b1f1b||0xcc;return function(_0x16b13f){if(_0x16b13f){return _0x1df75a['sendStatus'](_0x4b1f1b);}return _0x1df75a[_0xd5bb('0x15')](_0x4b1f1b)[_0xd5bb('0x16')]();};}function respondWithResult(_0x57cdb0,_0x37bb78){_0x37bb78=_0x37bb78||0xc8;return function(_0x1f54eb){if(_0x1f54eb){return _0x57cdb0[_0xd5bb('0x15')](_0x37bb78)['json'](_0x1f54eb);}};}function respondWithFilteredResult(_0x48c60a,_0x7d2333){return function(_0xa014fe){if(_0xa014fe){var _0x516418=typeof _0x7d2333[_0xd5bb('0x17')]===_0xd5bb('0x18')&&typeof _0x7d2333[_0xd5bb('0x19')]===_0xd5bb('0x18');var _0x510d9b=_0xa014fe[_0xd5bb('0x1a')];var _0x41bc89=_0x516418?0x0:_0x7d2333[_0xd5bb('0x17')];var _0x3d312f=_0x516418?_0xa014fe[_0xd5bb('0x1a')]:_0x7d2333[_0xd5bb('0x17')]+_0x7d2333['limit'];var _0x3bb5ae;if(_0x3d312f>=_0x510d9b){_0x3d312f=_0x510d9b;_0x3bb5ae=0xc8;}else{_0x3bb5ae=0xce;}_0x48c60a[_0xd5bb('0x15')](_0x3bb5ae);return _0x48c60a[_0xd5bb('0x1b')](_0xd5bb('0x1c'),_0x41bc89+'-'+_0x3d312f+'/'+_0x510d9b)[_0xd5bb('0x1d')](_0xa014fe);}return null;};}function patchUpdates(_0x40112f){return function(_0x56a68c){try{jsonpatch[_0xd5bb('0x1e')](_0x56a68c,_0x40112f,!![]);}catch(_0x53b6fc){return BPromise['reject'](_0x53b6fc);}return _0x56a68c[_0xd5bb('0x1f')]();};}function saveUpdates(_0x4c82d3,_0x53f959){return function(_0x118e3d){if(_0x118e3d){return _0x118e3d[_0xd5bb('0x20')](_0x4c82d3)[_0xd5bb('0x21')](function(_0x44551e){return _0x44551e;});}return null;};}function removeEntity(_0x285609,_0x52383c){return function(_0x2685ad){if(_0x2685ad){return _0x2685ad[_0xd5bb('0x22')]()[_0xd5bb('0x21')](function(){_0x285609[_0xd5bb('0x15')](0xcc)[_0xd5bb('0x16')]();});}};}function handleEntityNotFound(_0x48f15d,_0x5d5dac){return function(_0x2156fd){if(!_0x2156fd){_0x48f15d[_0xd5bb('0x23')](0x194);}return _0x2156fd;};}function handleError(_0x2f920c,_0x38dc90){_0x38dc90=_0x38dc90||0x1f4;return function(_0x351c33){logger['error'](_0x351c33[_0xd5bb('0x24')]);if(_0x351c33['name']){delete _0x351c33[_0xd5bb('0x25')];}_0x2f920c[_0xd5bb('0x15')](_0x38dc90)[_0xd5bb('0x26')](_0x351c33);};}exports[_0xd5bb('0x27')]=function(_0x10e5a6,_0x31d1d1){var _0xf4ed36={},_0x228fc4={},_0x1e400e={'count':0x0,'rows':[]};var _0x36a536=_[_0xd5bb('0x28')](db[_0xd5bb('0x29')][_0xd5bb('0x2a')],function(_0x965a7f){return{'name':_0x965a7f[_0xd5bb('0x2b')],'type':_0x965a7f[_0xd5bb('0x2c')][_0xd5bb('0x2d')]};});_0x228fc4[_0xd5bb('0x2e')]=_[_0xd5bb('0x28')](_0x36a536,'name');_0x228fc4[_0xd5bb('0x2f')]=_[_0xd5bb('0x30')](_0x10e5a6['query']);_0x228fc4[_0xd5bb('0x31')]=_[_0xd5bb('0x32')](_0x228fc4[_0xd5bb('0x2e')],_0x228fc4['query']);_0xf4ed36[_0xd5bb('0x33')]=_[_0xd5bb('0x32')](_0x228fc4['model'],qs['fields'](_0x10e5a6[_0xd5bb('0x2f')][_0xd5bb('0x34')]));_0xf4ed36['attributes']=_0xf4ed36[_0xd5bb('0x33')]['length']?_0xf4ed36[_0xd5bb('0x33')]:_0x228fc4[_0xd5bb('0x2e')];if(!_0x10e5a6['query'][_0xd5bb('0x35')](_0xd5bb('0x36'))){_0xf4ed36[_0xd5bb('0x19')]=qs[_0xd5bb('0x19')](_0x10e5a6[_0xd5bb('0x2f')][_0xd5bb('0x19')]);_0xf4ed36['offset']=qs[_0xd5bb('0x17')](_0x10e5a6[_0xd5bb('0x2f')]['offset']);}_0xf4ed36[_0xd5bb('0x37')]=qs[_0xd5bb('0x38')](_0x10e5a6[_0xd5bb('0x2f')][_0xd5bb('0x38')]);_0xf4ed36[_0xd5bb('0x39')]=qs[_0xd5bb('0x31')](_[_0xd5bb('0x3a')](_0x10e5a6[_0xd5bb('0x2f')],_0x228fc4['filters']),_0x36a536);if(_0x10e5a6['query'][_0xd5bb('0x3b')]){_0xf4ed36['where']=_[_0xd5bb('0x3c')](_0xf4ed36['where'],{'$or':_['map'](_0x36a536,function(_0x2c1c62){if(_0x2c1c62[_0xd5bb('0x2c')]!==_0xd5bb('0x3d')){var _0x35208d={};_0x35208d[_0x2c1c62[_0xd5bb('0x25')]]={'$like':'%'+_0x10e5a6['query']['filter']+'%'};return _0x35208d;}})});}_0xf4ed36=_['merge']({},_0xf4ed36,_0x10e5a6[_0xd5bb('0x3e')]);var _0x1b1680={'where':_0xf4ed36[_0xd5bb('0x39')]};return db[_0xd5bb('0x29')]['count'](_0x1b1680)[_0xd5bb('0x21')](function(_0x1be73f){_0x1e400e[_0xd5bb('0x1a')]=_0x1be73f;if(_0x10e5a6['query'][_0xd5bb('0x3f')]){_0xf4ed36['include']=[{'all':!![]}];}return db[_0xd5bb('0x29')]['findAll'](_0xf4ed36);})['then'](function(_0x2e0e59){_0x1e400e['rows']=_0x2e0e59;return _0x1e400e;})['then'](respondWithFilteredResult(_0x31d1d1,_0xf4ed36))[_0xd5bb('0x40')](handleError(_0x31d1d1,null));};exports['show']=function(_0x6386c9,_0x251fcb){var _0x3ad3f6={'raw':!![],'where':{'id':_0x6386c9[_0xd5bb('0x41')]['id']}},_0x51d020={};_0x51d020[_0xd5bb('0x2e')]=_[_0xd5bb('0x30')](db[_0xd5bb('0x29')]['rawAttributes']);_0x51d020['query']=_['keys'](_0x6386c9[_0xd5bb('0x2f')]);_0x51d020[_0xd5bb('0x31')]=_[_0xd5bb('0x32')](_0x51d020[_0xd5bb('0x2e')],_0x51d020[_0xd5bb('0x2f')]);_0x3ad3f6[_0xd5bb('0x33')]=_[_0xd5bb('0x32')](_0x51d020['model'],qs[_0xd5bb('0x34')](_0x6386c9[_0xd5bb('0x2f')][_0xd5bb('0x34')]));_0x3ad3f6[_0xd5bb('0x33')]=_0x3ad3f6[_0xd5bb('0x33')][_0xd5bb('0x42')]?_0x3ad3f6['attributes']:_0x51d020[_0xd5bb('0x2e')];if(_0x6386c9[_0xd5bb('0x2f')][_0xd5bb('0x3f')]){_0x3ad3f6[_0xd5bb('0x43')]=[{'all':!![]}];}_0x3ad3f6=_[_0xd5bb('0x3c')]({},_0x3ad3f6,_0x6386c9['options']);return db['FaxQueueReport'][_0xd5bb('0x44')](_0x3ad3f6)[_0xd5bb('0x21')](handleEntityNotFound(_0x251fcb,null))['then'](respondWithResult(_0x251fcb,null))[_0xd5bb('0x40')](handleError(_0x251fcb,null));};exports[_0xd5bb('0x45')]=function(_0x4b168e,_0x2043c9){return db['FaxQueueReport'][_0xd5bb('0x45')](_0x4b168e[_0xd5bb('0x46')],{})[_0xd5bb('0x21')](respondWithResult(_0x2043c9,0xc9))[_0xd5bb('0x40')](handleError(_0x2043c9,null));};exports[_0xd5bb('0x20')]=function(_0x58553c,_0x1cbb68){if(_0x58553c['body']['id']){delete _0x58553c[_0xd5bb('0x46')]['id'];}return db['FaxQueueReport'][_0xd5bb('0x44')]({'where':{'id':_0x58553c['params']['id']}})['then'](handleEntityNotFound(_0x1cbb68,null))[_0xd5bb('0x21')](saveUpdates(_0x58553c[_0xd5bb('0x46')],null))[_0xd5bb('0x21')](respondWithResult(_0x1cbb68,null))['catch'](handleError(_0x1cbb68,null));};exports[_0xd5bb('0x22')]=function(_0x26c882,_0x1664ac){return db[_0xd5bb('0x29')][_0xd5bb('0x44')]({'where':{'id':_0x26c882[_0xd5bb('0x41')]['id']}})[_0xd5bb('0x21')](handleEntityNotFound(_0x1664ac,null))[_0xd5bb('0x21')](removeEntity(_0x1664ac,null))[_0xd5bb('0x40')](handleError(_0x1664ac,null));};exports[_0xd5bb('0x47')]=function(_0x1ee231,_0x5475ee){return db[_0xd5bb('0x29')][_0xd5bb('0x47')]()[_0xd5bb('0x21')](respondWithResult(_0x5475ee,null))[_0xd5bb('0x40')](handleError(_0x5475ee,null));}; \ No newline at end of file +var _0x2a41=['to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','stack','name','index','map','FaxQueueReport','type','key','query','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','length','include','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','desk.js'];(function(_0x276b15,_0x3cfe67){var _0x33e64b=function(_0x4fb9cb){while(--_0x4fb9cb){_0x276b15['push'](_0x276b15['shift']());}};_0x33e64b(++_0x3cfe67);}(_0x2a41,0x126));var _0x12a4=function(_0x1d16fc,_0xe56c15){_0x1d16fc=_0x1d16fc-0x0;var _0x2c84bc=_0x2a41[_0x1d16fc];return _0x2c84bc;};'use strict';var emlformat=require(_0x12a4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x12a4('0x1'));var jsonpatch=require(_0x12a4('0x2'));var rp=require(_0x12a4('0x3'));var moment=require(_0x12a4('0x4'));var BPromise=require(_0x12a4('0x5'));var Mustache=require(_0x12a4('0x6'));var util=require(_0x12a4('0x7'));var path=require(_0x12a4('0x8'));var sox=require(_0x12a4('0x9'));var csv=require('to-csv');var ejs=require(_0x12a4('0xa'));var fs=require('fs');var fs_extra=require(_0x12a4('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x12a4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x12a4('0xd'));var toCsv=require(_0x12a4('0xe'));var querystring=require(_0x12a4('0xf'));var Papa=require(_0x12a4('0x10'));var Redis=require(_0x12a4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x12a4('0x12'));var as=require(_0x12a4('0x13'));var hardwareService=require(_0x12a4('0x14'));var logger=require(_0x12a4('0x15'))(_0x12a4('0x16'));var utils=require(_0x12a4('0x17'));var config=require(_0x12a4('0x18'));var licenseUtil=require(_0x12a4('0x19'));var db=require(_0x12a4('0x1a'))['db'];function respondWithStatusCode(_0x197554,_0x28059a){_0x28059a=_0x28059a||0xcc;return function(_0x2c939e){if(_0x2c939e){return _0x197554['sendStatus'](_0x28059a);}return _0x197554[_0x12a4('0x1b')](_0x28059a)[_0x12a4('0x1c')]();};}function respondWithResult(_0x1af5f8,_0x22cfde){_0x22cfde=_0x22cfde||0xc8;return function(_0x2b6e72){if(_0x2b6e72){return _0x1af5f8['status'](_0x22cfde)['json'](_0x2b6e72);}};}function respondWithFilteredResult(_0x257d27,_0x2ccfce){return function(_0x2428ba){if(_0x2428ba){var _0x1cce66=typeof _0x2ccfce['offset']===_0x12a4('0x1d')&&typeof _0x2ccfce[_0x12a4('0x1e')]===_0x12a4('0x1d');var _0x25d54f=_0x2428ba[_0x12a4('0x1f')];var _0xe274e1=_0x1cce66?0x0:_0x2ccfce['offset'];var _0x1a6bbe=_0x1cce66?_0x2428ba[_0x12a4('0x1f')]:_0x2ccfce[_0x12a4('0x20')]+_0x2ccfce['limit'];var _0x569763;if(_0x1a6bbe>=_0x25d54f){_0x1a6bbe=_0x25d54f;_0x569763=0xc8;}else{_0x569763=0xce;}_0x257d27[_0x12a4('0x1b')](_0x569763);return _0x257d27[_0x12a4('0x21')](_0x12a4('0x22'),_0xe274e1+'-'+_0x1a6bbe+'/'+_0x25d54f)[_0x12a4('0x23')](_0x2428ba);}return null;};}function patchUpdates(_0x1a35d3){return function(_0x5c92e8){try{jsonpatch[_0x12a4('0x24')](_0x5c92e8,_0x1a35d3,!![]);}catch(_0x5617d6){return BPromise[_0x12a4('0x25')](_0x5617d6);}return _0x5c92e8[_0x12a4('0x26')]();};}function saveUpdates(_0x40bf8e,_0x475939){return function(_0x17a4cc){if(_0x17a4cc){return _0x17a4cc['update'](_0x40bf8e)[_0x12a4('0x27')](function(_0x188930){return _0x188930;});}return null;};}function removeEntity(_0x35e966,_0x1c4255){return function(_0x499b22){if(_0x499b22){return _0x499b22[_0x12a4('0x28')]()[_0x12a4('0x27')](function(){_0x35e966[_0x12a4('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x395749,_0x2f3cae){return function(_0x5950fe){if(!_0x5950fe){_0x395749[_0x12a4('0x29')](0x194);}return _0x5950fe;};}function handleError(_0xcb5f1f,_0x4f1c77){_0x4f1c77=_0x4f1c77||0x1f4;return function(_0x5e952f){logger['error'](_0x5e952f[_0x12a4('0x2a')]);if(_0x5e952f[_0x12a4('0x2b')]){delete _0x5e952f[_0x12a4('0x2b')];}_0xcb5f1f[_0x12a4('0x1b')](_0x4f1c77)['send'](_0x5e952f);};}exports[_0x12a4('0x2c')]=function(_0x56c3da,_0x1979d1){var _0x3c5584={},_0x377466={},_0x15adb7={'count':0x0,'rows':[]};var _0x56df0f=_[_0x12a4('0x2d')](db[_0x12a4('0x2e')]['rawAttributes'],function(_0x283668){return{'name':_0x283668['fieldName'],'type':_0x283668[_0x12a4('0x2f')][_0x12a4('0x30')]};});_0x377466['model']=_[_0x12a4('0x2d')](_0x56df0f,_0x12a4('0x2b'));_0x377466[_0x12a4('0x31')]=_['keys'](_0x56c3da[_0x12a4('0x31')]);_0x377466['filters']=_[_0x12a4('0x32')](_0x377466[_0x12a4('0x33')],_0x377466[_0x12a4('0x31')]);_0x3c5584[_0x12a4('0x34')]=_[_0x12a4('0x32')](_0x377466[_0x12a4('0x33')],qs['fields'](_0x56c3da[_0x12a4('0x31')][_0x12a4('0x35')]));_0x3c5584[_0x12a4('0x34')]=_0x3c5584['attributes']['length']?_0x3c5584[_0x12a4('0x34')]:_0x377466['model'];if(!_0x56c3da[_0x12a4('0x31')][_0x12a4('0x36')]('nolimit')){_0x3c5584[_0x12a4('0x1e')]=qs[_0x12a4('0x1e')](_0x56c3da[_0x12a4('0x31')][_0x12a4('0x1e')]);_0x3c5584['offset']=qs[_0x12a4('0x20')](_0x56c3da[_0x12a4('0x31')][_0x12a4('0x20')]);}_0x3c5584[_0x12a4('0x37')]=qs[_0x12a4('0x38')](_0x56c3da['query']['sort']);_0x3c5584[_0x12a4('0x39')]=qs['filters'](_[_0x12a4('0x3a')](_0x56c3da[_0x12a4('0x31')],_0x377466[_0x12a4('0x3b')]),_0x56df0f);if(_0x56c3da[_0x12a4('0x31')][_0x12a4('0x3c')]){_0x3c5584[_0x12a4('0x39')]=_[_0x12a4('0x3d')](_0x3c5584[_0x12a4('0x39')],{'$or':_[_0x12a4('0x2d')](_0x56df0f,function(_0x31e9bb){if(_0x31e9bb['type']!=='VIRTUAL'){var _0x4bba08={};_0x4bba08[_0x31e9bb[_0x12a4('0x2b')]]={'$like':'%'+_0x56c3da[_0x12a4('0x31')]['filter']+'%'};return _0x4bba08;}})});}_0x3c5584=_[_0x12a4('0x3d')]({},_0x3c5584,_0x56c3da[_0x12a4('0x3e')]);var _0x487d89={'where':_0x3c5584[_0x12a4('0x39')]};return db[_0x12a4('0x2e')][_0x12a4('0x1f')](_0x487d89)[_0x12a4('0x27')](function(_0x22f6c1){_0x15adb7[_0x12a4('0x1f')]=_0x22f6c1;if(_0x56c3da['query'][_0x12a4('0x3f')]){_0x3c5584['include']=[{'all':!![]}];}return db[_0x12a4('0x2e')][_0x12a4('0x40')](_0x3c5584);})[_0x12a4('0x27')](function(_0x2826fb){_0x15adb7[_0x12a4('0x41')]=_0x2826fb;return _0x15adb7;})['then'](respondWithFilteredResult(_0x1979d1,_0x3c5584))[_0x12a4('0x42')](handleError(_0x1979d1,null));};exports[_0x12a4('0x43')]=function(_0x201755,_0x8a1643){var _0x466df1={'raw':!![],'where':{'id':_0x201755[_0x12a4('0x44')]['id']}},_0xf2751e={};_0xf2751e['model']=_[_0x12a4('0x45')](db[_0x12a4('0x2e')][_0x12a4('0x46')]);_0xf2751e[_0x12a4('0x31')]=_[_0x12a4('0x45')](_0x201755[_0x12a4('0x31')]);_0xf2751e[_0x12a4('0x3b')]=_[_0x12a4('0x32')](_0xf2751e[_0x12a4('0x33')],_0xf2751e[_0x12a4('0x31')]);_0x466df1[_0x12a4('0x34')]=_['intersection'](_0xf2751e[_0x12a4('0x33')],qs[_0x12a4('0x35')](_0x201755[_0x12a4('0x31')]['fields']));_0x466df1['attributes']=_0x466df1[_0x12a4('0x34')][_0x12a4('0x47')]?_0x466df1[_0x12a4('0x34')]:_0xf2751e['model'];if(_0x201755[_0x12a4('0x31')][_0x12a4('0x3f')]){_0x466df1[_0x12a4('0x48')]=[{'all':!![]}];}_0x466df1=_[_0x12a4('0x3d')]({},_0x466df1,_0x201755['options']);return db['FaxQueueReport']['find'](_0x466df1)['then'](handleEntityNotFound(_0x8a1643,null))[_0x12a4('0x27')](respondWithResult(_0x8a1643,null))[_0x12a4('0x42')](handleError(_0x8a1643,null));};exports[_0x12a4('0x49')]=function(_0x1568b8,_0x4348ba){return db['FaxQueueReport'][_0x12a4('0x49')](_0x1568b8[_0x12a4('0x4a')],{})[_0x12a4('0x27')](respondWithResult(_0x4348ba,0xc9))['catch'](handleError(_0x4348ba,null));};exports['update']=function(_0x41516b,_0x11ef07){if(_0x41516b['body']['id']){delete _0x41516b['body']['id'];}return db['FaxQueueReport'][_0x12a4('0x4b')]({'where':{'id':_0x41516b[_0x12a4('0x44')]['id']}})[_0x12a4('0x27')](handleEntityNotFound(_0x11ef07,null))['then'](saveUpdates(_0x41516b[_0x12a4('0x4a')],null))[_0x12a4('0x27')](respondWithResult(_0x11ef07,null))['catch'](handleError(_0x11ef07,null));};exports[_0x12a4('0x28')]=function(_0x10f12e,_0x29598b){return db[_0x12a4('0x2e')][_0x12a4('0x4b')]({'where':{'id':_0x10f12e[_0x12a4('0x44')]['id']}})['then'](handleEntityNotFound(_0x29598b,null))[_0x12a4('0x27')](removeEntity(_0x29598b,null))['catch'](handleError(_0x29598b,null));};exports[_0x12a4('0x4c')]=function(_0x30eabd,_0x86f964){return db[_0x12a4('0x2e')][_0x12a4('0x4c')]()[_0x12a4('0x27')](respondWithResult(_0x86f964,null))[_0x12a4('0x42')](handleError(_0x86f964,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 546fb17..9f39dd4 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 _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x333ec2,_0x1498f1){var _0x17507f=function(_0x476823){while(--_0x476823){_0x333ec2['push'](_0x333ec2['shift']());}};_0x17507f(++_0x1498f1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xc4aa[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x303cf0,_0x57c61b){var _0x5b2a31=function(_0x98dce0){while(--_0x98dce0){_0x303cf0['push'](_0x303cf0['shift']());}};_0x5b2a31(++_0x57c61b);}(_0xf494,0x1c6));var _0x4f49=function(_0x491680,_0x3b8248){_0x491680=_0x491680-0x0;var _0x6e699=_0xf494[_0x491680];return _0x6e699;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 83cd118..b64c842 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 _0x3bfa=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','message','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','stringify','UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0x40d615,_0x5aba87){var _0x303e30=function(_0x2803ba){while(--_0x2803ba){_0x40d615['push'](_0x40d615['shift']());}};_0x303e30(++_0x5aba87);}(_0x3bfa,0x188));var _0xa3bf=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3bfa[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xa3bf('0x0'));var util=require(_0xa3bf('0x1'));var moment=require(_0xa3bf('0x2'));var BPromise=require(_0xa3bf('0x3'));var rs=require(_0xa3bf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa3bf('0x5'))['db'];var utils=require(_0xa3bf('0x6'));var logger=require('../../config/logger')(_0xa3bf('0x7'));var config=require(_0xa3bf('0x8'));var jayson=require(_0xa3bf('0x9'));var client=jayson[_0xa3bf('0xa')][_0xa3bf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39f886,_0x39d16a,_0x5eee60){return new BPromise(function(_0x36ec06,_0x5eff70){return client['request'](_0x39f886,_0x5eee60)[_0xa3bf('0xc')](function(_0x4ffa39){logger[_0xa3bf('0xd')](_0xa3bf('0xe'),_0x39d16a,_0xa3bf('0xf'));logger[_0xa3bf('0x10')](_0xa3bf('0x11'),_0x39d16a,_0xa3bf('0xf'),JSON['stringify'](_0x4ffa39));if(_0x4ffa39['error']){if(_0x4ffa39[_0xa3bf('0x12')]['code']===0x1f4){logger[_0xa3bf('0x12')](_0xa3bf('0xe'),_0x39d16a,_0x4ffa39[_0xa3bf('0x12')]['message']);return _0x5eff70(_0x4ffa39[_0xa3bf('0x12')][_0xa3bf('0x13')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x39d16a,_0x4ffa39[_0xa3bf('0x12')][_0xa3bf('0x13')]);return _0x36ec06(_0x4ffa39[_0xa3bf('0x12')][_0xa3bf('0x13')]);}else{logger['info'](_0xa3bf('0xe'),_0x39d16a,_0xa3bf('0xf'));_0x36ec06(_0x4ffa39['result'][_0xa3bf('0x13')]);}})[_0xa3bf('0x14')](function(_0xe7c4ab){logger[_0xa3bf('0x12')](_0xa3bf('0xe'),_0x39d16a,_0xe7c4ab);_0x5eff70(_0xe7c4ab);});});}exports[_0xa3bf('0x15')]=function(_0x25bcf0){var _0x5c2002=this;return new Promise(function(_0x521d88,_0x3b38d8){return db[_0xa3bf('0x16')][_0xa3bf('0x17')](_0x25bcf0[_0xa3bf('0x18')],{'raw':_0x25bcf0[_0xa3bf('0x19')]?_0x25bcf0[_0xa3bf('0x19')][_0xa3bf('0x1a')]===undefined?!![]:![]:!![]})[_0xa3bf('0xc')](function(_0x2f4cb6){logger['info'](_0xa3bf('0x15'),_0x25bcf0);logger[_0xa3bf('0x10')]('CreateFaxQueueReport',_0x25bcf0,JSON[_0xa3bf('0x1b')](_0x2f4cb6));_0x521d88(_0x2f4cb6);})[_0xa3bf('0x14')](function(_0x44b9a2){logger[_0xa3bf('0x12')](_0xa3bf('0x15'),_0x44b9a2[_0xa3bf('0x13')],_0x25bcf0);_0x3b38d8(_0x5c2002[_0xa3bf('0x12')](0x1f4,_0x44b9a2[_0xa3bf('0x13')]));});});};exports[_0xa3bf('0x1c')]=function(_0x4b81da){var _0x1111e2=this;return new Promise(function(_0x48ad8e,_0x42a524){return db[_0xa3bf('0x16')][_0xa3bf('0x1d')](_0x4b81da[_0xa3bf('0x18')],{'raw':_0x4b81da[_0xa3bf('0x19')]?_0x4b81da[_0xa3bf('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b81da[_0xa3bf('0x19')]?_0x4b81da[_0xa3bf('0x19')][_0xa3bf('0x1e')]||null:null,'attributes':_0x4b81da[_0xa3bf('0x19')]?_0x4b81da[_0xa3bf('0x19')][_0xa3bf('0x1f')]||null:null,'limit':_0x4b81da[_0xa3bf('0x19')]?_0x4b81da[_0xa3bf('0x19')][_0xa3bf('0x20')]||null:null})[_0xa3bf('0xc')](function(_0x10acbc){logger['info'](_0xa3bf('0x1c'),_0x4b81da);logger[_0xa3bf('0x10')](_0xa3bf('0x1c'),_0x4b81da,JSON[_0xa3bf('0x1b')](_0x10acbc));_0x48ad8e(_0x10acbc);})[_0xa3bf('0x14')](function(_0x523cde){logger['error'](_0xa3bf('0x1c'),_0x523cde[_0xa3bf('0x13')],_0x4b81da);_0x42a524(_0x1111e2['error'](0x1f4,_0x523cde[_0xa3bf('0x13')]));});});}; \ No newline at end of file +var _0x7b96=['FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','catch','UpdateFaxQueueReport','attributes','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3a2fb8,_0x4b17ab){var _0x10fa41=function(_0x5dee97){while(--_0x5dee97){_0x3a2fb8['push'](_0x3a2fb8['shift']());}};_0x10fa41(++_0x4b17ab);}(_0x7b96,0x170));var _0x67b9=function(_0x35ce2b,_0x3b81fd){_0x35ce2b=_0x35ce2b-0x0;var _0x39e935=_0x7b96[_0x35ce2b];return _0x39e935;};'use strict';var _=require(_0x67b9('0x0'));var util=require(_0x67b9('0x1'));var moment=require(_0x67b9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x67b9('0x3'));var db=require(_0x67b9('0x4'))['db'];var utils=require(_0x67b9('0x5'));var logger=require(_0x67b9('0x6'))(_0x67b9('0x7'));var config=require('../../config/environment');var jayson=require(_0x67b9('0x8'));var client=jayson[_0x67b9('0x9')][_0x67b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10fa97,_0x185a0a,_0x54e649){return new BPromise(function(_0x21aedf,_0x2910ab){return client[_0x67b9('0xb')](_0x10fa97,_0x54e649)['then'](function(_0x5a9e86){logger[_0x67b9('0xc')](_0x67b9('0xd'),_0x185a0a,_0x67b9('0xe'));logger[_0x67b9('0xf')](_0x67b9('0x10'),_0x185a0a,'request\x20sent',JSON[_0x67b9('0x11')](_0x5a9e86));if(_0x5a9e86[_0x67b9('0x12')]){if(_0x5a9e86[_0x67b9('0x12')][_0x67b9('0x13')]===0x1f4){logger[_0x67b9('0x12')](_0x67b9('0xd'),_0x185a0a,_0x5a9e86[_0x67b9('0x12')]['message']);return _0x2910ab(_0x5a9e86[_0x67b9('0x12')][_0x67b9('0x14')]);}logger[_0x67b9('0x12')](_0x67b9('0xd'),_0x185a0a,_0x5a9e86[_0x67b9('0x12')][_0x67b9('0x14')]);return _0x21aedf(_0x5a9e86[_0x67b9('0x12')][_0x67b9('0x14')]);}else{logger[_0x67b9('0xc')](_0x67b9('0xd'),_0x185a0a,_0x67b9('0xe'));_0x21aedf(_0x5a9e86[_0x67b9('0x15')][_0x67b9('0x14')]);}})['catch'](function(_0x14c8b5){logger[_0x67b9('0x12')](_0x67b9('0xd'),_0x185a0a,_0x14c8b5);_0x2910ab(_0x14c8b5);});});}exports[_0x67b9('0x16')]=function(_0x4b7e5e){var _0x332587=this;return new Promise(function(_0x29aff3,_0x177d06){return db[_0x67b9('0x17')][_0x67b9('0x18')](_0x4b7e5e[_0x67b9('0x19')],{'raw':_0x4b7e5e[_0x67b9('0x1a')]?_0x4b7e5e[_0x67b9('0x1a')][_0x67b9('0x1b')]===undefined?!![]:![]:!![]})[_0x67b9('0x1c')](function(_0x4d23e6){logger[_0x67b9('0xc')](_0x67b9('0x16'),_0x4b7e5e);logger[_0x67b9('0xf')]('CreateFaxQueueReport',_0x4b7e5e,JSON[_0x67b9('0x11')](_0x4d23e6));_0x29aff3(_0x4d23e6);})[_0x67b9('0x1d')](function(_0x3bc353){logger[_0x67b9('0x12')](_0x67b9('0x16'),_0x3bc353['message'],_0x4b7e5e);_0x177d06(_0x332587['error'](0x1f4,_0x3bc353['message']));});});};exports[_0x67b9('0x1e')]=function(_0x1fca83){var _0x250a48=this;return new Promise(function(_0x4dee13,_0x19f4ff){return db[_0x67b9('0x17')]['update'](_0x1fca83['body'],{'raw':_0x1fca83[_0x67b9('0x1a')]?_0x1fca83[_0x67b9('0x1a')][_0x67b9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fca83[_0x67b9('0x1a')]?_0x1fca83[_0x67b9('0x1a')]['where']||null:null,'attributes':_0x1fca83[_0x67b9('0x1a')]?_0x1fca83['options'][_0x67b9('0x1f')]||null:null,'limit':_0x1fca83[_0x67b9('0x1a')]?_0x1fca83[_0x67b9('0x1a')]['limit']||null:null})[_0x67b9('0x1c')](function(_0x59f100){logger[_0x67b9('0xc')]('UpdateFaxQueueReport',_0x1fca83);logger[_0x67b9('0xf')](_0x67b9('0x1e'),_0x1fca83,JSON[_0x67b9('0x11')](_0x59f100));_0x4dee13(_0x59f100);})['catch'](function(_0x365f5d){logger['error']('UpdateFaxQueueReport',_0x365f5d[_0x67b9('0x14')],_0x1fca83);_0x19f4ff(_0x250a48[_0x67b9('0x12')](0x1f4,_0x365f5d[_0x67b9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 1f0e5ad..3ac1071 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 _0x2617=['multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','delete','destroy','exports'];(function(_0x3b4157,_0x2d2ad3){var _0x28868a=function(_0x14288c){while(--_0x14288c){_0x3b4157['push'](_0x3b4157['shift']());}};_0x28868a(++_0x2d2ad3);}(_0x2617,0x18f));var _0x7261=function(_0x38025f,_0xbed53c){_0x38025f=_0x38025f-0x0;var _0x3c12d5=_0x2617[_0x38025f];return _0x3c12d5;};'use strict';var multer=require(_0x7261('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7261('0x1'));var express=require(_0x7261('0x2'));var router=express[_0x7261('0x3')]();var fs_extra=require(_0x7261('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7261('0x5'));var config=require(_0x7261('0x6'));var controller=require(_0x7261('0x7'));router[_0x7261('0x8')]('/',auth[_0x7261('0x9')](),controller[_0x7261('0xa')]);router[_0x7261('0x8')](_0x7261('0xb'),auth[_0x7261('0x9')](),controller[_0x7261('0xc')]);router[_0x7261('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x7261('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7261('0xe')]);router[_0x7261('0xf')]('/:id',auth[_0x7261('0x9')](),controller['update']);router[_0x7261('0x10')]('/:id',auth[_0x7261('0x9')](),controller[_0x7261('0x11')]);module[_0x7261('0x12')]=router; \ No newline at end of file +var _0xd61a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','update','destroy','exports','util','path','connect-timeout'];(function(_0x569942,_0x591910){var _0x2c491c=function(_0x9f2b6e){while(--_0x9f2b6e){_0x569942['push'](_0x569942['shift']());}};_0x2c491c(++_0x591910);}(_0xd61a,0x90));var _0xad61=function(_0x549a09,_0x2fe584){_0x549a09=_0x549a09-0x0;var _0x3ef978=_0xd61a[_0x549a09];return _0x3ef978;};'use strict';var multer=require('multer');var util=require(_0xad61('0x0'));var path=require(_0xad61('0x1'));var timeout=require(_0xad61('0x2'));var express=require(_0xad61('0x3'));var router=express[_0xad61('0x4')]();var fs_extra=require(_0xad61('0x5'));var auth=require(_0xad61('0x6'));var interaction=require(_0xad61('0x7'));var config=require(_0xad61('0x8'));var controller=require(_0xad61('0x9'));router[_0xad61('0xa')]('/',auth[_0xad61('0xb')](),controller[_0xad61('0xc')]);router[_0xad61('0xa')](_0xad61('0xd'),auth[_0xad61('0xb')](),controller[_0xad61('0xe')]);router['get'](_0xad61('0xf'),auth[_0xad61('0xb')](),controller['show']);router[_0xad61('0x10')]('/',auth[_0xad61('0xb')](),controller[_0xad61('0x11')]);router['put'](_0xad61('0xf'),auth[_0xad61('0xb')](),controller[_0xad61('0x12')]);router['delete'](_0xad61('0xf'),auth['isAuthenticated'](),controller[_0xad61('0x13')]);module[_0xad61('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index e7ea96c..3225eea 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x10c16d,_0x2b3e14){var _0x5896f4=function(_0x4306b9){while(--_0x4306b9){_0x10c16d['push'](_0x10c16d['shift']());}};_0x5896f4(++_0x2b3e14);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4f56a8,_0x201dfa){_0x4f56a8=_0x4f56a8-0x0;var _0x2b8b32=_0x9bde[_0x4f56a8];return _0x2b8b32;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x4a787c,_0x129bdb){var _0xf4aff6=function(_0x338500){while(--_0x338500){_0x4a787c['push'](_0x4a787c['shift']());}};_0xf4aff6(++_0x129bdb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index ef9e203..4c379e8 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 _0xe247=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','params','includeAll','include','find','catch','create','body','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x4c6302,_0x311370){var _0x58bc5c=function(_0x51f64d){while(--_0x51f64d){_0x4c6302['push'](_0x4c6302['shift']());}};_0x58bc5c(++_0x311370);}(_0xe247,0xd8));var _0x7e24=function(_0x4d7348,_0x35bc62){_0x4d7348=_0x4d7348-0x0;var _0x5b06a0=_0xe247[_0x4d7348];return _0x5b06a0;};'use strict';var emlformat=require(_0x7e24('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7e24('0x1'));var rp=require('request-promise');var moment=require(_0x7e24('0x2'));var BPromise=require(_0x7e24('0x3'));var Mustache=require(_0x7e24('0x4'));var util=require(_0x7e24('0x5'));var path=require(_0x7e24('0x6'));var sox=require('sox');var csv=require(_0x7e24('0x7'));var ejs=require(_0x7e24('0x8'));var fs=require('fs');var fs_extra=require(_0x7e24('0x9'));var _=require('lodash');var squel=require(_0x7e24('0xa'));var crypto=require(_0x7e24('0xb'));var jsforce=require(_0x7e24('0xc'));var deskjs=require(_0x7e24('0xd'));var toCsv=require(_0x7e24('0x7'));var querystring=require(_0x7e24('0xe'));var Papa=require('papaparse');var Redis=require(_0x7e24('0xf'));var authService=require(_0x7e24('0x10'));var qs=require(_0x7e24('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e24('0x12'));var logger=require(_0x7e24('0x13'))(_0x7e24('0x14'));var utils=require(_0x7e24('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7e24('0x16'));var db=require(_0x7e24('0x17'))['db'];function respondWithStatusCode(_0x3ac52f,_0x19138d){_0x19138d=_0x19138d||0xcc;return function(_0xb6ce85){if(_0xb6ce85){return _0x3ac52f['sendStatus'](_0x19138d);}return _0x3ac52f[_0x7e24('0x18')](_0x19138d)[_0x7e24('0x19')]();};}function respondWithResult(_0xdc0bc5,_0x519275){_0x519275=_0x519275||0xc8;return function(_0x395589){if(_0x395589){return _0xdc0bc5[_0x7e24('0x18')](_0x519275)['json'](_0x395589);}};}function respondWithFilteredResult(_0x47483c,_0x1a4ba5){return function(_0x58bdb2){if(_0x58bdb2){var _0x3aa1aa=typeof _0x1a4ba5[_0x7e24('0x1a')]===_0x7e24('0x1b')&&typeof _0x1a4ba5['limit']===_0x7e24('0x1b');var _0x58b11b=_0x58bdb2['count'];var _0x276c6c=_0x3aa1aa?0x0:_0x1a4ba5[_0x7e24('0x1a')];var _0x3c1ba5=_0x3aa1aa?_0x58bdb2[_0x7e24('0x1c')]:_0x1a4ba5['offset']+_0x1a4ba5[_0x7e24('0x1d')];var _0x5e20ce;if(_0x3c1ba5>=_0x58b11b){_0x3c1ba5=_0x58b11b;_0x5e20ce=0xc8;}else{_0x5e20ce=0xce;}_0x47483c[_0x7e24('0x18')](_0x5e20ce);return _0x47483c[_0x7e24('0x1e')](_0x7e24('0x1f'),_0x276c6c+'-'+_0x3c1ba5+'/'+_0x58b11b)[_0x7e24('0x20')](_0x58bdb2);}return null;};}function patchUpdates(_0x387621){return function(_0x2bd631){try{jsonpatch['apply'](_0x2bd631,_0x387621,!![]);}catch(_0x343c3f){return BPromise[_0x7e24('0x21')](_0x343c3f);}return _0x2bd631[_0x7e24('0x22')]();};}function saveUpdates(_0x4f9c00,_0x2ad30d){return function(_0xbf3538){if(_0xbf3538){return _0xbf3538[_0x7e24('0x23')](_0x4f9c00)[_0x7e24('0x24')](function(_0xec27aa){return _0xec27aa;});}return null;};}function removeEntity(_0x2a2443,_0x50cda5){return function(_0x522a39){if(_0x522a39){return _0x522a39[_0x7e24('0x25')]()[_0x7e24('0x24')](function(){_0x2a2443[_0x7e24('0x18')](0xcc)[_0x7e24('0x19')]();});}};}function handleEntityNotFound(_0x60f154,_0x3f10d9){return function(_0x210551){if(!_0x210551){_0x60f154[_0x7e24('0x26')](0x194);}return _0x210551;};}function handleError(_0x4ba5e6,_0x40fd07){_0x40fd07=_0x40fd07||0x1f4;return function(_0x19324d){logger[_0x7e24('0x27')](_0x19324d[_0x7e24('0x28')]);if(_0x19324d[_0x7e24('0x29')]){delete _0x19324d['name'];}_0x4ba5e6[_0x7e24('0x18')](_0x40fd07)[_0x7e24('0x2a')](_0x19324d);};}exports[_0x7e24('0x2b')]=function(_0x34fd0a,_0x3a0b55){var _0x5aa9f7={},_0x2c3de5={},_0xe35069={'count':0x0,'rows':[]};var _0x15492c=_[_0x7e24('0x2c')](db[_0x7e24('0x2d')][_0x7e24('0x2e')],function(_0x22d314){return{'name':_0x22d314['fieldName'],'type':_0x22d314[_0x7e24('0x2f')][_0x7e24('0x30')]};});_0x2c3de5['model']=_[_0x7e24('0x2c')](_0x15492c,_0x7e24('0x29'));_0x2c3de5[_0x7e24('0x31')]=_[_0x7e24('0x32')](_0x34fd0a['query']);_0x2c3de5[_0x7e24('0x33')]=_[_0x7e24('0x34')](_0x2c3de5[_0x7e24('0x35')],_0x2c3de5[_0x7e24('0x31')]);_0x5aa9f7['attributes']=_[_0x7e24('0x34')](_0x2c3de5['model'],qs[_0x7e24('0x36')](_0x34fd0a[_0x7e24('0x31')][_0x7e24('0x36')]));_0x5aa9f7[_0x7e24('0x37')]=_0x5aa9f7['attributes'][_0x7e24('0x38')]?_0x5aa9f7[_0x7e24('0x37')]:_0x2c3de5['model'];if(!_0x34fd0a[_0x7e24('0x31')][_0x7e24('0x39')](_0x7e24('0x3a'))){_0x5aa9f7[_0x7e24('0x1d')]=qs[_0x7e24('0x1d')](_0x34fd0a[_0x7e24('0x31')][_0x7e24('0x1d')]);_0x5aa9f7[_0x7e24('0x1a')]=qs['offset'](_0x34fd0a['query'][_0x7e24('0x1a')]);}_0x5aa9f7['order']=qs[_0x7e24('0x3b')](_0x34fd0a[_0x7e24('0x31')][_0x7e24('0x3b')]);_0x5aa9f7[_0x7e24('0x3c')]=qs['filters'](_[_0x7e24('0x3d')](_0x34fd0a[_0x7e24('0x31')],_0x2c3de5['filters']),_0x15492c);if(_0x34fd0a[_0x7e24('0x31')]['filter']){_0x5aa9f7[_0x7e24('0x3c')]=_[_0x7e24('0x3e')](_0x5aa9f7[_0x7e24('0x3c')],{'$or':_[_0x7e24('0x2c')](_0x15492c,function(_0x18e703){if(_0x18e703[_0x7e24('0x2f')]!==_0x7e24('0x3f')){var _0x2510c2={};_0x2510c2[_0x18e703[_0x7e24('0x29')]]={'$like':'%'+_0x34fd0a[_0x7e24('0x31')][_0x7e24('0x40')]+'%'};return _0x2510c2;}})});}_0x5aa9f7=_[_0x7e24('0x3e')]({},_0x5aa9f7,_0x34fd0a[_0x7e24('0x41')]);var _0x5a72b9={'where':_0x5aa9f7[_0x7e24('0x3c')]};return db[_0x7e24('0x2d')][_0x7e24('0x1c')](_0x5a72b9)[_0x7e24('0x24')](function(_0x30c0dd){_0xe35069[_0x7e24('0x1c')]=_0x30c0dd;if(_0x34fd0a[_0x7e24('0x31')]['includeAll']){_0x5aa9f7['include']=[{'all':!![]}];}return db[_0x7e24('0x2d')][_0x7e24('0x42')](_0x5aa9f7);})['then'](function(_0x9583d6){_0xe35069[_0x7e24('0x43')]=_0x9583d6;return _0xe35069;})[_0x7e24('0x24')](respondWithFilteredResult(_0x3a0b55,_0x5aa9f7))['catch'](handleError(_0x3a0b55,null));};exports['show']=function(_0x27a2d5,_0x38ff7c){var _0x59e2fe={'raw':!![],'where':{'id':_0x27a2d5[_0x7e24('0x44')]['id']}},_0x1155da={};_0x1155da[_0x7e24('0x35')]=_[_0x7e24('0x32')](db[_0x7e24('0x2d')][_0x7e24('0x2e')]);_0x1155da[_0x7e24('0x31')]=_[_0x7e24('0x32')](_0x27a2d5['query']);_0x1155da[_0x7e24('0x33')]=_['intersection'](_0x1155da[_0x7e24('0x35')],_0x1155da['query']);_0x59e2fe['attributes']=_[_0x7e24('0x34')](_0x1155da[_0x7e24('0x35')],qs['fields'](_0x27a2d5[_0x7e24('0x31')][_0x7e24('0x36')]));_0x59e2fe[_0x7e24('0x37')]=_0x59e2fe[_0x7e24('0x37')][_0x7e24('0x38')]?_0x59e2fe['attributes']:_0x1155da[_0x7e24('0x35')];if(_0x27a2d5[_0x7e24('0x31')][_0x7e24('0x45')]){_0x59e2fe[_0x7e24('0x46')]=[{'all':!![]}];}_0x59e2fe=_['merge']({},_0x59e2fe,_0x27a2d5[_0x7e24('0x41')]);return db[_0x7e24('0x2d')][_0x7e24('0x47')](_0x59e2fe)['then'](handleEntityNotFound(_0x38ff7c,null))[_0x7e24('0x24')](respondWithResult(_0x38ff7c,null))[_0x7e24('0x48')](handleError(_0x38ff7c,null));};exports[_0x7e24('0x49')]=function(_0x2e75e0,_0x44a3f8){return db[_0x7e24('0x2d')][_0x7e24('0x49')](_0x2e75e0['body'],{})[_0x7e24('0x24')](respondWithResult(_0x44a3f8,0xc9))[_0x7e24('0x48')](handleError(_0x44a3f8,null));};exports[_0x7e24('0x23')]=function(_0x540e63,_0x498d8d){if(_0x540e63[_0x7e24('0x4a')]['id']){delete _0x540e63[_0x7e24('0x4a')]['id'];}return db[_0x7e24('0x2d')]['find']({'where':{'id':_0x540e63[_0x7e24('0x44')]['id']}})['then'](handleEntityNotFound(_0x498d8d,null))[_0x7e24('0x24')](saveUpdates(_0x540e63['body'],null))['then'](respondWithResult(_0x498d8d,null))[_0x7e24('0x48')](handleError(_0x498d8d,null));};exports[_0x7e24('0x25')]=function(_0x3ec779,_0x4da3d3){return db[_0x7e24('0x2d')][_0x7e24('0x47')]({'where':{'id':_0x3ec779[_0x7e24('0x44')]['id']}})[_0x7e24('0x24')](handleEntityNotFound(_0x4da3d3,null))[_0x7e24('0x24')](removeEntity(_0x4da3d3,null))[_0x7e24('0x48')](handleError(_0x4da3d3,null));};exports[_0x7e24('0x4b')]=function(_0x13e24c,_0x505bac){return db[_0x7e24('0x2d')][_0x7e24('0x4b')]()[_0x7e24('0x24')](respondWithResult(_0x505bac,null))[_0x7e24('0x48')](handleError(_0x505bac,null));}; \ No newline at end of file +var _0xfab7=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','save','update','then','destroy','error','stack','name','send','FaxTransferReport','rawAttributes','type','key','map','query','filters','attributes','model','fields'];(function(_0x240f64,_0xf518e1){var _0x75d513=function(_0x2b3257){while(--_0x2b3257){_0x240f64['push'](_0x240f64['shift']());}};_0x75d513(++_0xf518e1);}(_0xfab7,0x1c1));var _0x7fab=function(_0x528d8d,_0x3d64ff){_0x528d8d=_0x528d8d-0x0;var _0x35c2f8=_0xfab7[_0x528d8d];return _0x35c2f8;};'use strict';var emlformat=require(_0x7fab('0x0'));var rimraf=require(_0x7fab('0x1'));var zipdir=require(_0x7fab('0x2'));var jsonpatch=require(_0x7fab('0x3'));var rp=require(_0x7fab('0x4'));var moment=require(_0x7fab('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7fab('0x6'));var csv=require(_0x7fab('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7fab('0x8'));var squel=require(_0x7fab('0x9'));var crypto=require(_0x7fab('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7fab('0xb'));var toCsv=require(_0x7fab('0x7'));var querystring=require(_0x7fab('0xc'));var Papa=require(_0x7fab('0xd'));var Redis=require(_0x7fab('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7fab('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fab('0x10'))(_0x7fab('0x11'));var utils=require(_0x7fab('0x12'));var config=require(_0x7fab('0x13'));var licenseUtil=require(_0x7fab('0x14'));var db=require(_0x7fab('0x15'))['db'];function respondWithStatusCode(_0x170e5a,_0x2caba3){_0x2caba3=_0x2caba3||0xcc;return function(_0x2383b1){if(_0x2383b1){return _0x170e5a['sendStatus'](_0x2caba3);}return _0x170e5a[_0x7fab('0x16')](_0x2caba3)[_0x7fab('0x17')]();};}function respondWithResult(_0x5e5043,_0x50460e){_0x50460e=_0x50460e||0xc8;return function(_0x28ac98){if(_0x28ac98){return _0x5e5043[_0x7fab('0x16')](_0x50460e)[_0x7fab('0x18')](_0x28ac98);}};}function respondWithFilteredResult(_0x5a2bb7,_0x35d035){return function(_0x8c68c9){if(_0x8c68c9){var _0x55249c=typeof _0x35d035[_0x7fab('0x19')]===_0x7fab('0x1a')&&typeof _0x35d035[_0x7fab('0x1b')]===_0x7fab('0x1a');var _0x20ba30=_0x8c68c9['count'];var _0x137a6b=_0x55249c?0x0:_0x35d035['offset'];var _0x5ec741=_0x55249c?_0x8c68c9[_0x7fab('0x1c')]:_0x35d035[_0x7fab('0x19')]+_0x35d035[_0x7fab('0x1b')];var _0x116e97;if(_0x5ec741>=_0x20ba30){_0x5ec741=_0x20ba30;_0x116e97=0xc8;}else{_0x116e97=0xce;}_0x5a2bb7[_0x7fab('0x16')](_0x116e97);return _0x5a2bb7['set']('Content-Range',_0x137a6b+'-'+_0x5ec741+'/'+_0x20ba30)[_0x7fab('0x18')](_0x8c68c9);}return null;};}function patchUpdates(_0x4f0303){return function(_0x1706da){try{jsonpatch[_0x7fab('0x1d')](_0x1706da,_0x4f0303,!![]);}catch(_0x2fb93d){return BPromise['reject'](_0x2fb93d);}return _0x1706da[_0x7fab('0x1e')]();};}function saveUpdates(_0x47e3b5,_0x823965){return function(_0x204dd2){if(_0x204dd2){return _0x204dd2[_0x7fab('0x1f')](_0x47e3b5)[_0x7fab('0x20')](function(_0x595c6f){return _0x595c6f;});}return null;};}function removeEntity(_0x3920dc,_0x3494c5){return function(_0x38260b){if(_0x38260b){return _0x38260b[_0x7fab('0x21')]()[_0x7fab('0x20')](function(){_0x3920dc[_0x7fab('0x16')](0xcc)[_0x7fab('0x17')]();});}};}function handleEntityNotFound(_0x205f4f,_0x2208ea){return function(_0x4efba5){if(!_0x4efba5){_0x205f4f['sendStatus'](0x194);}return _0x4efba5;};}function handleError(_0x1cd3c9,_0x53d297){_0x53d297=_0x53d297||0x1f4;return function(_0x1e96e8){logger[_0x7fab('0x22')](_0x1e96e8[_0x7fab('0x23')]);if(_0x1e96e8[_0x7fab('0x24')]){delete _0x1e96e8[_0x7fab('0x24')];}_0x1cd3c9[_0x7fab('0x16')](_0x53d297)[_0x7fab('0x25')](_0x1e96e8);};}exports['index']=function(_0x32f0e1,_0x15b695){var _0x3ad6bf={},_0x52b740={},_0x2bf053={'count':0x0,'rows':[]};var _0x373d97=_['map'](db[_0x7fab('0x26')][_0x7fab('0x27')],function(_0x5685d9){return{'name':_0x5685d9['fieldName'],'type':_0x5685d9[_0x7fab('0x28')][_0x7fab('0x29')]};});_0x52b740['model']=_[_0x7fab('0x2a')](_0x373d97,_0x7fab('0x24'));_0x52b740[_0x7fab('0x2b')]=_['keys'](_0x32f0e1['query']);_0x52b740[_0x7fab('0x2c')]=_['intersection'](_0x52b740['model'],_0x52b740['query']);_0x3ad6bf[_0x7fab('0x2d')]=_['intersection'](_0x52b740[_0x7fab('0x2e')],qs[_0x7fab('0x2f')](_0x32f0e1['query'][_0x7fab('0x2f')]));_0x3ad6bf[_0x7fab('0x2d')]=_0x3ad6bf[_0x7fab('0x2d')][_0x7fab('0x30')]?_0x3ad6bf[_0x7fab('0x2d')]:_0x52b740[_0x7fab('0x2e')];if(!_0x32f0e1[_0x7fab('0x2b')][_0x7fab('0x31')](_0x7fab('0x32'))){_0x3ad6bf[_0x7fab('0x1b')]=qs[_0x7fab('0x1b')](_0x32f0e1[_0x7fab('0x2b')]['limit']);_0x3ad6bf[_0x7fab('0x19')]=qs['offset'](_0x32f0e1['query'][_0x7fab('0x19')]);}_0x3ad6bf[_0x7fab('0x33')]=qs[_0x7fab('0x34')](_0x32f0e1[_0x7fab('0x2b')][_0x7fab('0x34')]);_0x3ad6bf[_0x7fab('0x35')]=qs[_0x7fab('0x2c')](_[_0x7fab('0x36')](_0x32f0e1[_0x7fab('0x2b')],_0x52b740[_0x7fab('0x2c')]),_0x373d97);if(_0x32f0e1[_0x7fab('0x2b')][_0x7fab('0x37')]){_0x3ad6bf[_0x7fab('0x35')]=_[_0x7fab('0x38')](_0x3ad6bf[_0x7fab('0x35')],{'$or':_[_0x7fab('0x2a')](_0x373d97,function(_0x2eaa70){if(_0x2eaa70['type']!==_0x7fab('0x39')){var _0x399fe1={};_0x399fe1[_0x2eaa70['name']]={'$like':'%'+_0x32f0e1[_0x7fab('0x2b')][_0x7fab('0x37')]+'%'};return _0x399fe1;}})});}_0x3ad6bf=_[_0x7fab('0x38')]({},_0x3ad6bf,_0x32f0e1[_0x7fab('0x3a')]);var _0x3c5351={'where':_0x3ad6bf[_0x7fab('0x35')]};return db[_0x7fab('0x26')]['count'](_0x3c5351)[_0x7fab('0x20')](function(_0x332890){_0x2bf053['count']=_0x332890;if(_0x32f0e1['query'][_0x7fab('0x3b')]){_0x3ad6bf[_0x7fab('0x3c')]=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0x3ad6bf);})[_0x7fab('0x20')](function(_0x1b37f3){_0x2bf053[_0x7fab('0x3d')]=_0x1b37f3;return _0x2bf053;})[_0x7fab('0x20')](respondWithFilteredResult(_0x15b695,_0x3ad6bf))[_0x7fab('0x3e')](handleError(_0x15b695,null));};exports[_0x7fab('0x3f')]=function(_0x5753fd,_0x374812){var _0x3f29ae={'raw':!![],'where':{'id':_0x5753fd[_0x7fab('0x40')]['id']}},_0x536739={};_0x536739[_0x7fab('0x2e')]=_['keys'](db['FaxTransferReport'][_0x7fab('0x27')]);_0x536739[_0x7fab('0x2b')]=_[_0x7fab('0x41')](_0x5753fd['query']);_0x536739[_0x7fab('0x2c')]=_[_0x7fab('0x42')](_0x536739[_0x7fab('0x2e')],_0x536739['query']);_0x3f29ae[_0x7fab('0x2d')]=_[_0x7fab('0x42')](_0x536739['model'],qs['fields'](_0x5753fd[_0x7fab('0x2b')][_0x7fab('0x2f')]));_0x3f29ae[_0x7fab('0x2d')]=_0x3f29ae[_0x7fab('0x2d')][_0x7fab('0x30')]?_0x3f29ae[_0x7fab('0x2d')]:_0x536739[_0x7fab('0x2e')];if(_0x5753fd['query']['includeAll']){_0x3f29ae[_0x7fab('0x3c')]=[{'all':!![]}];}_0x3f29ae=_[_0x7fab('0x38')]({},_0x3f29ae,_0x5753fd[_0x7fab('0x3a')]);return db[_0x7fab('0x26')][_0x7fab('0x43')](_0x3f29ae)['then'](handleEntityNotFound(_0x374812,null))[_0x7fab('0x20')](respondWithResult(_0x374812,null))[_0x7fab('0x3e')](handleError(_0x374812,null));};exports[_0x7fab('0x44')]=function(_0x58d769,_0x33ab28){return db[_0x7fab('0x26')][_0x7fab('0x44')](_0x58d769[_0x7fab('0x45')],{})['then'](respondWithResult(_0x33ab28,0xc9))[_0x7fab('0x3e')](handleError(_0x33ab28,null));};exports['update']=function(_0x4a7539,_0x4590a8){if(_0x4a7539[_0x7fab('0x45')]['id']){delete _0x4a7539[_0x7fab('0x45')]['id'];}return db[_0x7fab('0x26')][_0x7fab('0x43')]({'where':{'id':_0x4a7539[_0x7fab('0x40')]['id']}})[_0x7fab('0x20')](handleEntityNotFound(_0x4590a8,null))[_0x7fab('0x20')](saveUpdates(_0x4a7539[_0x7fab('0x45')],null))['then'](respondWithResult(_0x4590a8,null))[_0x7fab('0x3e')](handleError(_0x4590a8,null));};exports[_0x7fab('0x21')]=function(_0x476d9f,_0x2dc90c){return db['FaxTransferReport'][_0x7fab('0x43')]({'where':{'id':_0x476d9f['params']['id']}})['then'](handleEntityNotFound(_0x2dc90c,null))[_0x7fab('0x20')](removeEntity(_0x2dc90c,null))[_0x7fab('0x3e')](handleError(_0x2dc90c,null));};exports[_0x7fab('0x46')]=function(_0x522252,_0x34153b){return db['FaxTransferReport'][_0x7fab('0x46')]()['then'](respondWithResult(_0x34153b,null))['catch'](handleError(_0x34153b,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 433c7f3..a22341f 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 _0xe76d=['report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./faxTransferReport.attributes','define','FaxTransferReport'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0xe76d,0x1bc));var _0xde76=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xe76d[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0xde76('0x0'));var util=require(_0xde76('0x1'));var logger=require(_0xde76('0x2'))(_0xde76('0x3'));var moment=require(_0xde76('0x4'));var BPromise=require(_0xde76('0x5'));var rp=require(_0xde76('0x6'));var fs=require('fs');var path=require(_0xde76('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xde76('0x8'));module['exports']=function(_0x34422e,_0x4be407){return _0x34422e[_0xde76('0x9')](_0xde76('0xa'),attributes,{'tableName':_0xde76('0xb'),'paranoid':![],'indexes':[{'name':_0xde76('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0608=['api','moment','path','rimraf','../../config/environment','define','FaxTransferReport','uniqueid','lodash','util','../../config/logger'];(function(_0x4934b5,_0x12110e){var _0x308a9e=function(_0x2933cc){while(--_0x2933cc){_0x4934b5['push'](_0x4934b5['shift']());}};_0x308a9e(++_0x12110e);}(_0x0608,0x1d6));var _0x8060=function(_0x4689f9,_0x210b35){_0x4689f9=_0x4689f9-0x0;var _0x4baade=_0x0608[_0x4689f9];return _0x4baade;};'use strict';var _=require(_0x8060('0x0'));var util=require(_0x8060('0x1'));var logger=require(_0x8060('0x2'))(_0x8060('0x3'));var moment=require(_0x8060('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8060('0x5'));var rimraf=require(_0x8060('0x6'));var config=require(_0x8060('0x7'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x449870,_0x2fe793){return _0x449870[_0x8060('0x8')](_0x8060('0x9'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x8060('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 06cd572..189bf1a 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 _0xf8a4=['stringify','error','message','FaxTransferReport,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf8a4,0xf8));var _0x4f8a=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xf8a4[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var util=require(_0x4f8a('0x0'));var moment=require(_0x4f8a('0x1'));var BPromise=require(_0x4f8a('0x2'));var rs=require(_0x4f8a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f8a('0x4'))['db'];var utils=require(_0x4f8a('0x5'));var logger=require(_0x4f8a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4f8a('0x7'));var client=jayson[_0x4f8a('0x8')][_0x4f8a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ee95c,_0x272289,_0x1c2d41){return new BPromise(function(_0x1f7552,_0x3c616e){return client[_0x4f8a('0xa')](_0x3ee95c,_0x1c2d41)[_0x4f8a('0xb')](function(_0x4bc1da){logger[_0x4f8a('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x272289,_0x4f8a('0xd'));logger[_0x4f8a('0xe')](_0x4f8a('0xf'),_0x272289,_0x4f8a('0xd'),JSON[_0x4f8a('0x10')](_0x4bc1da));if(_0x4bc1da['error']){if(_0x4bc1da[_0x4f8a('0x11')]['code']===0x1f4){logger[_0x4f8a('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x272289,_0x4bc1da['error'][_0x4f8a('0x12')]);return _0x3c616e(_0x4bc1da['error'][_0x4f8a('0x12')]);}logger[_0x4f8a('0x11')](_0x4f8a('0x13'),_0x272289,_0x4bc1da[_0x4f8a('0x11')]['message']);return _0x1f7552(_0x4bc1da['error'][_0x4f8a('0x12')]);}else{logger[_0x4f8a('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x272289,_0x4f8a('0xd'));_0x1f7552(_0x4bc1da[_0x4f8a('0x14')][_0x4f8a('0x12')]);}})[_0x4f8a('0x15')](function(_0x21b6d8){logger[_0x4f8a('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x272289,_0x21b6d8);_0x3c616e(_0x21b6d8);});});} \ No newline at end of file +var _0xe9c0=['ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxTransferReport,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe9c0,0x172));var _0x0e9c=function(_0x3ffb34,_0x969b13){_0x3ffb34=_0x3ffb34-0x0;var _0x57e2f1=_0xe9c0[_0x3ffb34];return _0x57e2f1;};'use strict';var _=require(_0x0e9c('0x0'));var util=require('util');var moment=require(_0x0e9c('0x1'));var BPromise=require(_0x0e9c('0x2'));var rs=require(_0x0e9c('0x3'));var fs=require('fs');var Redis=require(_0x0e9c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e9c('0x5'));var logger=require('../../config/logger')(_0x0e9c('0x6'));var config=require('../../config/environment');var jayson=require(_0x0e9c('0x7'));var client=jayson[_0x0e9c('0x8')][_0x0e9c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36a04c,_0x40fe7c,_0x453c2c){return new BPromise(function(_0x1c2311,_0x5149b2){return client[_0x0e9c('0xa')](_0x36a04c,_0x453c2c)[_0x0e9c('0xb')](function(_0xf4cc3f){logger[_0x0e9c('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x40fe7c,_0x0e9c('0xd'));logger['debug'](_0x0e9c('0xe'),_0x40fe7c,'request\x20sent',JSON[_0x0e9c('0xf')](_0xf4cc3f));if(_0xf4cc3f[_0x0e9c('0x10')]){if(_0xf4cc3f[_0x0e9c('0x10')][_0x0e9c('0x11')]===0x1f4){logger[_0x0e9c('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x40fe7c,_0xf4cc3f[_0x0e9c('0x10')][_0x0e9c('0x12')]);return _0x5149b2(_0xf4cc3f[_0x0e9c('0x10')]['message']);}logger[_0x0e9c('0x10')](_0x0e9c('0x13'),_0x40fe7c,_0xf4cc3f[_0x0e9c('0x10')][_0x0e9c('0x12')]);return _0x1c2311(_0xf4cc3f[_0x0e9c('0x10')][_0x0e9c('0x12')]);}else{logger[_0x0e9c('0xc')](_0x0e9c('0x13'),_0x40fe7c,_0x0e9c('0xd'));_0x1c2311(_0xf4cc3f[_0x0e9c('0x14')][_0x0e9c('0x12')]);}})[_0x0e9c('0x15')](function(_0x559a6b){logger[_0x0e9c('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x40fe7c,_0x559a6b);_0x5149b2(_0x559a6b);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 91e5c69..c9c5c42 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 _0x30a8=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./faxTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x2eda1a,_0x39151b){var _0x44358b=function(_0x584fb7){while(--_0x584fb7){_0x2eda1a['push'](_0x2eda1a['shift']());}};_0x44358b(++_0x39151b);}(_0x30a8,0x142));var _0x830a=function(_0x372c44,_0x312b31){_0x372c44=_0x372c44-0x0;var _0x29abe7=_0x30a8[_0x372c44];return _0x29abe7;};'use strict';var multer=require(_0x830a('0x0'));var util=require(_0x830a('0x1'));var path=require(_0x830a('0x2'));var timeout=require(_0x830a('0x3'));var express=require(_0x830a('0x4'));var router=express[_0x830a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x830a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x830a('0x7'));router[_0x830a('0x8')]('/',auth[_0x830a('0x9')](),controller['index']);router[_0x830a('0x8')](_0x830a('0xa'),auth[_0x830a('0x9')](),controller[_0x830a('0xb')]);router[_0x830a('0x8')](_0x830a('0xc'),auth['isAuthenticated'](),controller[_0x830a('0xd')]);router[_0x830a('0xe')]('/',auth[_0x830a('0x9')](),controller[_0x830a('0xf')]);router[_0x830a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x830a('0x11')]);router[_0x830a('0x12')](_0x830a('0xc'),auth[_0x830a('0x9')](),controller[_0x830a('0x13')]);module[_0x830a('0x14')]=router; \ No newline at end of file +var _0xef15=['../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xd2f4ac,_0x5aa8e5){var _0x9757b2=function(_0x442ced){while(--_0x442ced){_0xd2f4ac['push'](_0xd2f4ac['shift']());}};_0x9757b2(++_0x5aa8e5);}(_0xef15,0xbe));var _0x5ef1=function(_0x30b094,_0x555417){_0x30b094=_0x30b094-0x0;var _0x4337f3=_0xef15[_0x30b094];return _0x4337f3;};'use strict';var multer=require(_0x5ef1('0x0'));var util=require('util');var path=require(_0x5ef1('0x1'));var timeout=require(_0x5ef1('0x2'));var express=require(_0x5ef1('0x3'));var router=express[_0x5ef1('0x4')]();var fs_extra=require(_0x5ef1('0x5'));var auth=require(_0x5ef1('0x6'));var interaction=require(_0x5ef1('0x7'));var config=require(_0x5ef1('0x8'));var controller=require(_0x5ef1('0x9'));router[_0x5ef1('0xa')]('/',auth[_0x5ef1('0xb')](),controller[_0x5ef1('0xc')]);router[_0x5ef1('0xa')](_0x5ef1('0xd'),auth[_0x5ef1('0xb')](),controller[_0x5ef1('0xe')]);router[_0x5ef1('0xa')](_0x5ef1('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x5ef1('0x10')]('/',auth[_0x5ef1('0xb')](),controller[_0x5ef1('0x11')]);router[_0x5ef1('0x12')](_0x5ef1('0xf'),auth[_0x5ef1('0xb')](),controller['update']);router[_0x5ef1('0x13')](_0x5ef1('0xf'),auth[_0x5ef1('0xb')](),controller[_0x5ef1('0x14')]);module[_0x5ef1('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 697e5bf..4258f2f 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 _0x444c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x444c,0xd4));var _0xc444=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x444c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc444('0x0'));var util=require('util');var path=require(_0xc444('0x1'));var timeout=require(_0xc444('0x2'));var express=require('express');var router=express[_0xc444('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc444('0x4'));var interaction=require(_0xc444('0x5'));var config=require(_0xc444('0x6'));var controller=require(_0xc444('0x7'));router[_0xc444('0x8')]('/',auth[_0xc444('0x9')](),controller['index']);router['get'](_0xc444('0xa'),auth[_0xc444('0x9')](),controller[_0xc444('0xb')]);router[_0xc444('0x8')](_0xc444('0xc'),auth[_0xc444('0x9')](),controller[_0xc444('0xd')]);router[_0xc444('0x8')](_0xc444('0xe'),auth[_0xc444('0x9')](),controller[_0xc444('0xf')]);router['post']('/',auth[_0xc444('0x9')](),controller[_0xc444('0x10')]);router[_0xc444('0x11')](_0xc444('0xc'),auth['isAuthenticated'](),controller[_0xc444('0x12')]);router[_0xc444('0x13')](_0xc444('0xa'),auth['isAuthenticated'](),controller[_0xc444('0x14')]);router[_0xc444('0x15')](_0xc444('0xa'),auth[_0xc444('0x9')](),controller[_0xc444('0x16')]);module[_0xc444('0x17')]=router; \ No newline at end of file +var _0xe5ca=['create','addConfiguration','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe5ca,0xcf));var _0xae5c=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xe5ca[_0x17928f];return _0x500b63;};'use strict';var multer=require('multer');var util=require(_0xae5c('0x0'));var path=require(_0xae5c('0x1'));var timeout=require(_0xae5c('0x2'));var express=require(_0xae5c('0x3'));var router=express[_0xae5c('0x4')]();var fs_extra=require(_0xae5c('0x5'));var auth=require(_0xae5c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xae5c('0x7'));var controller=require(_0xae5c('0x8'));router[_0xae5c('0x9')]('/',auth[_0xae5c('0xa')](),controller[_0xae5c('0xb')]);router[_0xae5c('0x9')]('/:id',auth[_0xae5c('0xa')](),controller[_0xae5c('0xc')]);router[_0xae5c('0x9')](_0xae5c('0xd'),auth[_0xae5c('0xa')](),controller[_0xae5c('0xe')]);router[_0xae5c('0x9')](_0xae5c('0xf'),auth[_0xae5c('0xa')](),controller[_0xae5c('0x10')]);router[_0xae5c('0x11')]('/',auth[_0xae5c('0xa')](),controller[_0xae5c('0x12')]);router[_0xae5c('0x11')]('/:id/configurations',auth[_0xae5c('0xa')](),controller[_0xae5c('0x13')]);router[_0xae5c('0x14')](_0xae5c('0x15'),auth[_0xae5c('0xa')](),controller[_0xae5c('0x16')]);router[_0xae5c('0x17')](_0xae5c('0x15'),auth[_0xae5c('0xa')](),controller['destroy']);module[_0xae5c('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 40ddc90..331035d 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 _0xf801=['ENUM','basic','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x11ed63,_0x37b1cf){var _0x59f5fe=function(_0x33809b){while(--_0x33809b){_0x11ed63['push'](_0x11ed63['shift']());}};_0x59f5fe(++_0x37b1cf);}(_0xf801,0x19a));var _0x1f80=function(_0x962edb,_0x5dd356){_0x962edb=_0x962edb-0x0;var _0x359dcf=_0xf801[_0x962edb];return _0x359dcf;};'use strict';var Sequelize=require(_0x1f80('0x0'));module[_0x1f80('0x1')]={'name':{'type':Sequelize[_0x1f80('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1f80('0x2')]},'remoteUri':{'type':Sequelize[_0x1f80('0x2')]},'authType':{'type':Sequelize[_0x1f80('0x3')](_0x1f80('0x4')),'defaultValue':_0x1f80('0x4')},'password':{'type':Sequelize[_0x1f80('0x2')]},'consumerKey':{'type':Sequelize[_0x1f80('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x1f80('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1f80('0x3')](_0x1f80('0x5'),_0x1f80('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x4cf7=['newTab','sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4cf7,0x12e));var _0x74cf=function(_0x16b3b9,_0x2cf9cb){_0x16b3b9=_0x16b3b9-0x0;var _0x1b4337=_0x4cf7[_0x16b3b9];return _0x1b4337;};'use strict';var Sequelize=require(_0x74cf('0x0'));module[_0x74cf('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x74cf('0x2')]},'username':{'type':Sequelize[_0x74cf('0x2')]},'remoteUri':{'type':Sequelize[_0x74cf('0x2')]},'authType':{'type':Sequelize[_0x74cf('0x3')](_0x74cf('0x4')),'defaultValue':_0x74cf('0x4')},'password':{'type':Sequelize[_0x74cf('0x2')]},'consumerKey':{'type':Sequelize[_0x74cf('0x2')]},'consumerSecret':{'type':Sequelize[_0x74cf('0x2')]},'token':{'type':Sequelize[_0x74cf('0x2')]},'tokenSecret':{'type':Sequelize[_0x74cf('0x2')]},'serverUrl':{'type':Sequelize[_0x74cf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x74cf('0x3')](_0x74cf('0x5'),_0x74cf('0x6')),'defaultValue':_0x74cf('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 26d1e07..ebb21e3 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 _0x3d23=['Wrong\x20credentials','statusCode','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','DeskAccount','includeAll','include','catch','show','params','options','find','create','body','findOne','DeskConfiguration','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','slice','format','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','username','toString','base64','concat','_embedded','entries','active','label','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3d23,0xf2));var _0x33d2=function(_0x1ebc6c,_0x58a00b){_0x1ebc6c=_0x1ebc6c-0x0;var _0x3a826d=_0x3d23[_0x1ebc6c];return _0x3a826d;};'use strict';var emlformat=require(_0x33d2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x33d2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x33d2('0x2'));var moment=require(_0x33d2('0x3'));var BPromise=require(_0x33d2('0x4'));var Mustache=require(_0x33d2('0x5'));var util=require(_0x33d2('0x6'));var path=require(_0x33d2('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x33d2('0x8'));var fs=require('fs');var fs_extra=require(_0x33d2('0x9'));var _=require(_0x33d2('0xa'));var squel=require(_0x33d2('0xb'));var crypto=require(_0x33d2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x33d2('0xd'));var toCsv=require(_0x33d2('0xe'));var querystring=require(_0x33d2('0xf'));var Papa=require(_0x33d2('0x10'));var Redis=require(_0x33d2('0x11'));var authService=require(_0x33d2('0x12'));var qs=require(_0x33d2('0x13'));var as=require(_0x33d2('0x14'));var hardwareService=require(_0x33d2('0x15'));var logger=require(_0x33d2('0x16'))(_0x33d2('0x17'));var utils=require(_0x33d2('0x18'));var config=require(_0x33d2('0x19'));var licenseUtil=require(_0x33d2('0x1a'));var db=require(_0x33d2('0x1b'))['db'];var integrations=require(_0x33d2('0x1c'));function respondWithStatusCode(_0x335a6d,_0x36d052){_0x36d052=_0x36d052||0xcc;return function(_0x215250){if(_0x215250){return _0x335a6d[_0x33d2('0x1d')](_0x36d052);}return _0x335a6d['status'](_0x36d052)[_0x33d2('0x1e')]();};}function respondWithResult(_0x3c2634,_0x1600b7){_0x1600b7=_0x1600b7||0xc8;return function(_0x37e7ee){if(_0x37e7ee){return _0x3c2634[_0x33d2('0x1f')](_0x1600b7)[_0x33d2('0x20')](_0x37e7ee);}};}function respondWithFilteredResult(_0x2df0dc,_0x398b43){return function(_0x6eae8d){if(_0x6eae8d){var _0x369786=typeof _0x398b43['offset']===_0x33d2('0x21')&&typeof _0x398b43[_0x33d2('0x22')]===_0x33d2('0x21');var _0x6016fb=_0x6eae8d[_0x33d2('0x23')];var _0x13ab84=_0x369786?0x0:_0x398b43[_0x33d2('0x24')];var _0x2ce9ac=_0x369786?_0x6eae8d[_0x33d2('0x23')]:_0x398b43[_0x33d2('0x24')]+_0x398b43[_0x33d2('0x22')];var _0x3ef2aa;if(_0x2ce9ac>=_0x6016fb){_0x2ce9ac=_0x6016fb;_0x3ef2aa=0xc8;}else{_0x3ef2aa=0xce;}_0x2df0dc[_0x33d2('0x1f')](_0x3ef2aa);return _0x2df0dc[_0x33d2('0x25')]('Content-Range',_0x13ab84+'-'+_0x2ce9ac+'/'+_0x6016fb)[_0x33d2('0x20')](_0x6eae8d);}return null;};}function patchUpdates(_0x3f4d1d){return function(_0x51d496){try{jsonpatch[_0x33d2('0x26')](_0x51d496,_0x3f4d1d,!![]);}catch(_0x154d4b){return BPromise[_0x33d2('0x27')](_0x154d4b);}return _0x51d496[_0x33d2('0x28')]();};}function saveUpdates(_0x148f8c,_0x96ac6a){return function(_0x1c3110){if(_0x1c3110){return _0x1c3110[_0x33d2('0x29')](_0x148f8c)[_0x33d2('0x2a')](function(_0x2ce6cb){return _0x2ce6cb;});}return null;};}function removeEntity(_0x364cb9,_0x5ee9d6){return function(_0x4cb4e0){if(_0x4cb4e0){return _0x4cb4e0[_0x33d2('0x2b')]()['then'](function(){_0x364cb9[_0x33d2('0x1f')](0xcc)[_0x33d2('0x1e')]();});}};}function handleEntityNotFound(_0x593dfd,_0x2010c4){return function(_0x10ef4f){if(!_0x10ef4f){_0x593dfd['sendStatus'](0x194);}return _0x10ef4f;};}function handleError(_0x56096a,_0x5b0c0f){_0x5b0c0f=_0x5b0c0f||0x1f4;return function(_0x22b967){logger[_0x33d2('0x2c')](_0x22b967[_0x33d2('0x2d')]);if(_0x22b967['name']){delete _0x22b967[_0x33d2('0x2e')];}_0x56096a[_0x33d2('0x1f')](_0x5b0c0f)['send'](_0x22b967);};}exports[_0x33d2('0x2f')]=function(_0x153bf2,_0x8b3943){var _0x4e680d={},_0x1275f3={},_0x40ad7e={'count':0x0,'rows':[]};var _0x340106=_['map'](db['DeskAccount'][_0x33d2('0x30')],function(_0x35ec73){return{'name':_0x35ec73[_0x33d2('0x31')],'type':_0x35ec73[_0x33d2('0x32')][_0x33d2('0x33')]};});_0x1275f3[_0x33d2('0x34')]=_[_0x33d2('0x35')](_0x340106,_0x33d2('0x2e'));_0x1275f3[_0x33d2('0x36')]=_[_0x33d2('0x37')](_0x153bf2[_0x33d2('0x36')]);_0x1275f3[_0x33d2('0x38')]=_['intersection'](_0x1275f3[_0x33d2('0x34')],_0x1275f3[_0x33d2('0x36')]);_0x4e680d['attributes']=_[_0x33d2('0x39')](_0x1275f3[_0x33d2('0x34')],qs[_0x33d2('0x3a')](_0x153bf2[_0x33d2('0x36')][_0x33d2('0x3a')]));_0x4e680d['attributes']=_0x4e680d[_0x33d2('0x3b')][_0x33d2('0x3c')]?_0x4e680d[_0x33d2('0x3b')]:_0x1275f3[_0x33d2('0x34')];if(!_0x153bf2['query']['hasOwnProperty'](_0x33d2('0x3d'))){_0x4e680d['limit']=qs[_0x33d2('0x22')](_0x153bf2[_0x33d2('0x36')][_0x33d2('0x22')]);_0x4e680d[_0x33d2('0x24')]=qs[_0x33d2('0x24')](_0x153bf2['query']['offset']);}_0x4e680d[_0x33d2('0x3e')]=qs[_0x33d2('0x3f')](_0x153bf2[_0x33d2('0x36')][_0x33d2('0x3f')]);_0x4e680d[_0x33d2('0x40')]=qs[_0x33d2('0x38')](_[_0x33d2('0x41')](_0x153bf2[_0x33d2('0x36')],_0x1275f3[_0x33d2('0x38')]),_0x340106);if(_0x153bf2[_0x33d2('0x36')]['filter']){_0x4e680d['where']=_[_0x33d2('0x42')](_0x4e680d[_0x33d2('0x40')],{'$or':_['map'](_0x340106,function(_0x3560e5){if(_0x3560e5[_0x33d2('0x32')]!==_0x33d2('0x43')){var _0x2e2666={};_0x2e2666[_0x3560e5['name']]={'$like':'%'+_0x153bf2[_0x33d2('0x36')][_0x33d2('0x44')]+'%'};return _0x2e2666;}})});}_0x4e680d=_[_0x33d2('0x42')]({},_0x4e680d,_0x153bf2['options']);var _0x5c830b={'where':_0x4e680d[_0x33d2('0x40')]};return db[_0x33d2('0x45')][_0x33d2('0x23')](_0x5c830b)[_0x33d2('0x2a')](function(_0x10fe89){_0x40ad7e[_0x33d2('0x23')]=_0x10fe89;if(_0x153bf2['query'][_0x33d2('0x46')]){_0x4e680d[_0x33d2('0x47')]=[{'all':!![]}];}return db[_0x33d2('0x45')]['findAll'](_0x4e680d);})[_0x33d2('0x2a')](function(_0x411f53){_0x40ad7e['rows']=_0x411f53;return _0x40ad7e;})[_0x33d2('0x2a')](respondWithFilteredResult(_0x8b3943,_0x4e680d))[_0x33d2('0x48')](handleError(_0x8b3943,null));};exports[_0x33d2('0x49')]=function(_0x215b28,_0x2d39b3){var _0x3ee2a8={'raw':![],'where':{'id':_0x215b28[_0x33d2('0x4a')]['id']}},_0x4e5b2d={};_0x4e5b2d['model']=_[_0x33d2('0x37')](db[_0x33d2('0x45')][_0x33d2('0x30')]);_0x4e5b2d[_0x33d2('0x36')]=_[_0x33d2('0x37')](_0x215b28['query']);_0x4e5b2d[_0x33d2('0x38')]=_[_0x33d2('0x39')](_0x4e5b2d[_0x33d2('0x34')],_0x4e5b2d[_0x33d2('0x36')]);_0x3ee2a8[_0x33d2('0x3b')]=_[_0x33d2('0x39')](_0x4e5b2d[_0x33d2('0x34')],qs[_0x33d2('0x3a')](_0x215b28['query'][_0x33d2('0x3a')]));_0x3ee2a8[_0x33d2('0x3b')]=_0x3ee2a8[_0x33d2('0x3b')]['length']?_0x3ee2a8[_0x33d2('0x3b')]:_0x4e5b2d[_0x33d2('0x34')];if(_0x215b28[_0x33d2('0x36')][_0x33d2('0x46')]){_0x3ee2a8['include']=[{'all':!![]}];}_0x3ee2a8=_['merge']({},_0x3ee2a8,_0x215b28[_0x33d2('0x4b')]);return db[_0x33d2('0x45')][_0x33d2('0x4c')](_0x3ee2a8)[_0x33d2('0x2a')](handleEntityNotFound(_0x2d39b3,null))[_0x33d2('0x2a')](respondWithResult(_0x2d39b3,null))[_0x33d2('0x48')](handleError(_0x2d39b3,null));};exports['create']=function(_0x1f6ef1,_0x8cabe7){return db[_0x33d2('0x45')][_0x33d2('0x4d')](_0x1f6ef1[_0x33d2('0x4e')],{})[_0x33d2('0x2a')](respondWithResult(_0x8cabe7,0xc9))[_0x33d2('0x48')](handleError(_0x8cabe7,null));};exports[_0x33d2('0x29')]=function(_0x25b54a,_0x40f0d9){if(_0x25b54a['body']['id']){delete _0x25b54a[_0x33d2('0x4e')]['id'];}return db[_0x33d2('0x45')]['find']({'where':{'id':_0x25b54a[_0x33d2('0x4a')]['id']}})[_0x33d2('0x2a')](handleEntityNotFound(_0x40f0d9,null))[_0x33d2('0x2a')](saveUpdates(_0x25b54a[_0x33d2('0x4e')],null))[_0x33d2('0x2a')](respondWithResult(_0x40f0d9,null))[_0x33d2('0x48')](handleError(_0x40f0d9,null));};exports[_0x33d2('0x2b')]=function(_0x4868b2,_0x5b4088){return db[_0x33d2('0x45')][_0x33d2('0x4c')]({'where':{'id':_0x4868b2[_0x33d2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5b4088,null))[_0x33d2('0x2a')](removeEntity(_0x5b4088,null))[_0x33d2('0x48')](handleError(_0x5b4088,null));};exports['getConfigurations']=function(_0x395dce,_0x1614a0,_0x4ba5c2){var _0x16a90e={};var _0x4a898b={};var _0xec25af;var _0x38f258;return db[_0x33d2('0x45')][_0x33d2('0x4f')]({'where':{'id':_0x395dce[_0x33d2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1614a0,null))[_0x33d2('0x2a')](function(_0x3c3e63){if(_0x3c3e63){_0xec25af=_0x3c3e63;_0x4a898b[_0x33d2('0x34')]=_[_0x33d2('0x37')](db[_0x33d2('0x50')][_0x33d2('0x30')]);_0x4a898b[_0x33d2('0x36')]=_[_0x33d2('0x37')](_0x395dce[_0x33d2('0x36')]);_0x4a898b[_0x33d2('0x38')]=_[_0x33d2('0x39')](_0x4a898b[_0x33d2('0x34')],_0x4a898b[_0x33d2('0x36')]);_0x16a90e['attributes']=_[_0x33d2('0x39')](_0x4a898b['model'],qs[_0x33d2('0x3a')](_0x395dce[_0x33d2('0x36')][_0x33d2('0x3a')]));_0x16a90e[_0x33d2('0x3b')]=_0x16a90e[_0x33d2('0x3b')][_0x33d2('0x3c')]?_0x16a90e[_0x33d2('0x3b')]:_0x4a898b['model'];_0x16a90e[_0x33d2('0x3e')]=qs[_0x33d2('0x3f')](_0x395dce[_0x33d2('0x36')][_0x33d2('0x3f')]);_0x16a90e[_0x33d2('0x40')]=qs[_0x33d2('0x38')](_[_0x33d2('0x41')](_0x395dce[_0x33d2('0x36')],_0x4a898b[_0x33d2('0x38')]));if(_0x395dce[_0x33d2('0x36')][_0x33d2('0x44')]){_0x16a90e[_0x33d2('0x40')]=_[_0x33d2('0x42')](_0x16a90e[_0x33d2('0x40')],{'$or':_['map'](_0x16a90e['attributes'],function(_0x1dbcbd){var _0x54aa7c={};_0x54aa7c[_0x1dbcbd]={'$like':'%'+_0x395dce[_0x33d2('0x36')][_0x33d2('0x44')]+'%'};return _0x54aa7c;})});}_0x16a90e=_[_0x33d2('0x42')]({},_0x16a90e,_0x395dce[_0x33d2('0x4b')]);return _0xec25af['getConfigurations'](_0x16a90e);}})[_0x33d2('0x2a')](function(_0x2f51db){if(_0x2f51db){_0x38f258=_0x2f51db[_0x33d2('0x3c')];if(!_0x395dce[_0x33d2('0x36')][_0x33d2('0x51')](_0x33d2('0x3d'))){_0x16a90e[_0x33d2('0x22')]=qs[_0x33d2('0x22')](_0x395dce[_0x33d2('0x36')]['limit']);_0x16a90e[_0x33d2('0x24')]=qs[_0x33d2('0x24')](_0x395dce[_0x33d2('0x36')][_0x33d2('0x24')]);}return _0xec25af['getConfigurations'](_0x16a90e);}})[_0x33d2('0x2a')](function(_0xab9e76){if(_0xab9e76){return _0xab9e76?{'count':_0x38f258,'rows':_0xab9e76}:null;}})[_0x33d2('0x2a')](respondWithResult(_0x1614a0,null))[_0x33d2('0x48')](handleError(_0x1614a0,null));};exports['addConfiguration']=function(_0xd82278,_0x593cd2,_0x1bf365){if(_0xd82278['body']['id']){delete _0xd82278[_0x33d2('0x4e')]['id'];}return db[_0x33d2('0x45')][_0x33d2('0x4f')]({'where':{'id':_0xd82278['params']['id']}})[_0x33d2('0x2a')](handleEntityNotFound(_0x593cd2,null))['then'](function(_0x586052){if(_0x586052){_0xd82278[_0x33d2('0x4e')][_0x33d2('0x52')]=_0x586052['id'];_0xd82278[_0x33d2('0x4e')][_0x33d2('0x53')]=integrations[_0x33d2('0x54')](_0xd82278[_0x33d2('0x4e')][_0x33d2('0x55')],_0xd82278['body']['type']);_0xd82278[_0x33d2('0x4e')][_0x33d2('0x56')]=integrations[_0x33d2('0x57')](_0xd82278[_0x33d2('0x4e')][_0x33d2('0x55')],_0xd82278['body'][_0x33d2('0x32')]);return db[_0x33d2('0x50')]['create'](_0xd82278['body'],{'include':[{'model':db['DeskField'],'as':_0x33d2('0x53')},{'model':db[_0x33d2('0x58')],'as':_0x33d2('0x56')}]});}return null;})[_0x33d2('0x2a')](respondWithResult(_0x593cd2,null))['catch'](handleError(_0x593cd2,null));};exports[_0x33d2('0x59')]=function(_0x62006a,_0x277934,_0x9e6994){var _0x30a9e2=[{'name':_0x33d2('0x5a'),'label':_0x33d2('0x5a'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x5bed6d='';return db[_0x33d2('0x45')]['findOne']({'where':{'id':_0x62006a[_0x33d2('0x4a')]['id']},'attributes':['id',_0x33d2('0x5b'),_0x33d2('0x5c'),'username',_0x33d2('0x5d'),_0x33d2('0x5e'),_0x33d2('0x5f'),_0x33d2('0x60'),_0x33d2('0x61')]})[_0x33d2('0x2a')](handleEntityNotFound(_0x277934,null))[_0x33d2('0x2a')](function(_0x6a647e){if(_0x6a647e){_0x5bed6d=_0x6a647e[_0x33d2('0x5b')];var _0x41b1f0=_0x5bed6d[_0x33d2('0x62')](-0x1);if(_0x41b1f0==='/'){_0x5bed6d=_0x5bed6d['substring'](0x0,_0x5bed6d['lastIndexOf'](_0x41b1f0));}var _0x3cc397={'method':'GET','uri':util[_0x33d2('0x63')]('%s/custom_fields',_0x5bed6d),'headers':{'Content-Type':_0x33d2('0x64'),'Accept':'application/json'},'json':!![]};if(_0x6a647e[_0x33d2('0x5c')]===_0x33d2('0x65')){_0x3cc397[_0x33d2('0x66')][_0x33d2('0x67')]=util[_0x33d2('0x63')](_0x33d2('0x68'),new Buffer(util[_0x33d2('0x63')](_0x33d2('0x69'),_0x6a647e[_0x33d2('0x6a')],_0x6a647e[_0x33d2('0x5d')]))[_0x33d2('0x6b')](_0x33d2('0x6c')));}return rp(_0x3cc397)[_0x33d2('0x2a')](function(_0xba2519){return _0x30a9e2[_0x33d2('0x6d')](_[_0x33d2('0x35')](_0xba2519[_0x33d2('0x6e')][_0x33d2('0x6f')],function(_0xed4949){return{'id':_0xed4949[_0x33d2('0x2e')],'name':_0xed4949[_0x33d2('0x2e')],'type':_0xed4949[_0x33d2('0x32')],'active':_0xed4949[_0x33d2('0x70')],'label':_0xed4949[_0x33d2('0x71')],'custom':!![]};}));});}})[_0x33d2('0x2a')](function(_0x173c98){return{'count':_0x173c98[_0x33d2('0x3c')],'rows':_0x173c98};})[_0x33d2('0x2a')](respondWithResult(_0x277934,null))[_0x33d2('0x48')](function(_0x1ebe68){var _0x392996=_0x62006a[_0x33d2('0x36')]['test']?0x1f4:_0x1ebe68['statusCode']||0x1f4;logger['error'](_0x33d2('0x72'),_0x33d2('0x59'),_0x392996,JSON[_0x33d2('0x73')](_0x1ebe68));delete _0x1ebe68[_0x33d2('0x2e')];if(_0x392996===0x191){_0x392996=0x190;}_0x277934[_0x33d2('0x1f')](_0x392996)[_0x33d2('0x74')](_0x62006a[_0x33d2('0x36')][_0x33d2('0x75')]?{'message':_0x33d2('0x76'),'statusCode':_0x1ebe68[_0x33d2('0x77')]}:_0x1ebe68);});}; \ No newline at end of file +var _0x3c46=['getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','%s:%s','toString','entries','active','statusCode','stringify','send','test','Wrong\x20credentials','eml-format','rimraf','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','count','offset','limit','set','reject','save','destroy','then','error','stack','name','index','map','DeskAccount','rawAttributes','fieldName','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','intersection','find','create','body','update','findOne','DeskConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions'];(function(_0x1b8310,_0x241270){var _0x11a850=function(_0x3576b1){while(--_0x3576b1){_0x1b8310['push'](_0x1b8310['shift']());}};_0x11a850(++_0x241270);}(_0x3c46,0x8a));var _0x63c4=function(_0x2aec85,_0x59c8b6){_0x2aec85=_0x2aec85-0x0;var _0x1214ce=_0x3c46[_0x2aec85];return _0x1214ce;};'use strict';var emlformat=require(_0x63c4('0x0'));var rimraf=require(_0x63c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x63c4('0x2'));var Mustache=require(_0x63c4('0x3'));var util=require(_0x63c4('0x4'));var path=require(_0x63c4('0x5'));var sox=require(_0x63c4('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x63c4('0x7'));var _=require(_0x63c4('0x8'));var squel=require(_0x63c4('0x9'));var crypto=require('crypto');var jsforce=require(_0x63c4('0xa'));var deskjs=require(_0x63c4('0xb'));var toCsv=require(_0x63c4('0xc'));var querystring=require(_0x63c4('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x63c4('0xe'));var as=require(_0x63c4('0xf'));var hardwareService=require(_0x63c4('0x10'));var logger=require('../../config/logger')(_0x63c4('0x11'));var utils=require(_0x63c4('0x12'));var config=require(_0x63c4('0x13'));var licenseUtil=require(_0x63c4('0x14'));var db=require(_0x63c4('0x15'))['db'];var integrations=require(_0x63c4('0x16'));function respondWithStatusCode(_0x11c467,_0x2450b1){_0x2450b1=_0x2450b1||0xcc;return function(_0x19372c){if(_0x19372c){return _0x11c467[_0x63c4('0x17')](_0x2450b1);}return _0x11c467['status'](_0x2450b1)[_0x63c4('0x18')]();};}function respondWithResult(_0x4024fc,_0x5a9aa9){_0x5a9aa9=_0x5a9aa9||0xc8;return function(_0x2988f3){if(_0x2988f3){return _0x4024fc[_0x63c4('0x19')](_0x5a9aa9)[_0x63c4('0x1a')](_0x2988f3);}};}function respondWithFilteredResult(_0x4d3c3e,_0x1cfed7){return function(_0xac9a08){if(_0xac9a08){var _0x241825=typeof _0x1cfed7['offset']===_0x63c4('0x1b')&&typeof _0x1cfed7['limit']===_0x63c4('0x1b');var _0x17a3cd=_0xac9a08[_0x63c4('0x1c')];var _0x8ecbe0=_0x241825?0x0:_0x1cfed7[_0x63c4('0x1d')];var _0xba3534=_0x241825?_0xac9a08[_0x63c4('0x1c')]:_0x1cfed7[_0x63c4('0x1d')]+_0x1cfed7[_0x63c4('0x1e')];var _0x4c45ec;if(_0xba3534>=_0x17a3cd){_0xba3534=_0x17a3cd;_0x4c45ec=0xc8;}else{_0x4c45ec=0xce;}_0x4d3c3e[_0x63c4('0x19')](_0x4c45ec);return _0x4d3c3e[_0x63c4('0x1f')]('Content-Range',_0x8ecbe0+'-'+_0xba3534+'/'+_0x17a3cd)[_0x63c4('0x1a')](_0xac9a08);}return null;};}function patchUpdates(_0x30a5ae){return function(_0x4fdc1b){try{jsonpatch['apply'](_0x4fdc1b,_0x30a5ae,!![]);}catch(_0x4efd37){return BPromise[_0x63c4('0x20')](_0x4efd37);}return _0x4fdc1b[_0x63c4('0x21')]();};}function saveUpdates(_0xfe7a4f,_0x56f529){return function(_0x5293cd){if(_0x5293cd){return _0x5293cd['update'](_0xfe7a4f)['then'](function(_0x26462b){return _0x26462b;});}return null;};}function removeEntity(_0x3beb4e,_0x4f56cd){return function(_0x58685c){if(_0x58685c){return _0x58685c[_0x63c4('0x22')]()[_0x63c4('0x23')](function(){_0x3beb4e[_0x63c4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x597ec7,_0x2d0089){return function(_0x5ca229){if(!_0x5ca229){_0x597ec7[_0x63c4('0x17')](0x194);}return _0x5ca229;};}function handleError(_0x1b5215,_0x5cbd83){_0x5cbd83=_0x5cbd83||0x1f4;return function(_0x45e65b){logger[_0x63c4('0x24')](_0x45e65b[_0x63c4('0x25')]);if(_0x45e65b[_0x63c4('0x26')]){delete _0x45e65b['name'];}_0x1b5215[_0x63c4('0x19')](_0x5cbd83)['send'](_0x45e65b);};}exports[_0x63c4('0x27')]=function(_0x41c4c1,_0x5f07bf){var _0x19b4a7={},_0x5102ff={},_0x3b465e={'count':0x0,'rows':[]};var _0x23be11=_[_0x63c4('0x28')](db[_0x63c4('0x29')][_0x63c4('0x2a')],function(_0x5f1515){return{'name':_0x5f1515[_0x63c4('0x2b')],'type':_0x5f1515[_0x63c4('0x2c')]['key']};});_0x5102ff[_0x63c4('0x2d')]=_[_0x63c4('0x28')](_0x23be11,_0x63c4('0x26'));_0x5102ff[_0x63c4('0x2e')]=_[_0x63c4('0x2f')](_0x41c4c1[_0x63c4('0x2e')]);_0x5102ff['filters']=_['intersection'](_0x5102ff[_0x63c4('0x2d')],_0x5102ff[_0x63c4('0x2e')]);_0x19b4a7[_0x63c4('0x30')]=_['intersection'](_0x5102ff[_0x63c4('0x2d')],qs[_0x63c4('0x31')](_0x41c4c1['query']['fields']));_0x19b4a7['attributes']=_0x19b4a7[_0x63c4('0x30')][_0x63c4('0x32')]?_0x19b4a7[_0x63c4('0x30')]:_0x5102ff[_0x63c4('0x2d')];if(!_0x41c4c1[_0x63c4('0x2e')][_0x63c4('0x33')](_0x63c4('0x34'))){_0x19b4a7[_0x63c4('0x1e')]=qs['limit'](_0x41c4c1[_0x63c4('0x2e')][_0x63c4('0x1e')]);_0x19b4a7[_0x63c4('0x1d')]=qs[_0x63c4('0x1d')](_0x41c4c1[_0x63c4('0x2e')][_0x63c4('0x1d')]);}_0x19b4a7[_0x63c4('0x35')]=qs[_0x63c4('0x36')](_0x41c4c1[_0x63c4('0x2e')][_0x63c4('0x36')]);_0x19b4a7['where']=qs['filters'](_[_0x63c4('0x37')](_0x41c4c1[_0x63c4('0x2e')],_0x5102ff[_0x63c4('0x38')]),_0x23be11);if(_0x41c4c1[_0x63c4('0x2e')][_0x63c4('0x39')]){_0x19b4a7[_0x63c4('0x3a')]=_[_0x63c4('0x3b')](_0x19b4a7[_0x63c4('0x3a')],{'$or':_[_0x63c4('0x28')](_0x23be11,function(_0x567f40){if(_0x567f40['type']!==_0x63c4('0x3c')){var _0x85e11d={};_0x85e11d[_0x567f40[_0x63c4('0x26')]]={'$like':'%'+_0x41c4c1[_0x63c4('0x2e')]['filter']+'%'};return _0x85e11d;}})});}_0x19b4a7=_[_0x63c4('0x3b')]({},_0x19b4a7,_0x41c4c1[_0x63c4('0x3d')]);var _0x275fdc={'where':_0x19b4a7[_0x63c4('0x3a')]};return db['DeskAccount']['count'](_0x275fdc)[_0x63c4('0x23')](function(_0x47c92e){_0x3b465e['count']=_0x47c92e;if(_0x41c4c1['query']['includeAll']){_0x19b4a7[_0x63c4('0x3e')]=[{'all':!![]}];}return db[_0x63c4('0x29')][_0x63c4('0x3f')](_0x19b4a7);})[_0x63c4('0x23')](function(_0x77faa6){_0x3b465e['rows']=_0x77faa6;return _0x3b465e;})[_0x63c4('0x23')](respondWithFilteredResult(_0x5f07bf,_0x19b4a7))[_0x63c4('0x40')](handleError(_0x5f07bf,null));};exports[_0x63c4('0x41')]=function(_0x149fa4,_0x4b2f02){var _0x4a8628={'raw':![],'where':{'id':_0x149fa4[_0x63c4('0x42')]['id']}},_0x4ed312={};_0x4ed312[_0x63c4('0x2d')]=_['keys'](db['DeskAccount']['rawAttributes']);_0x4ed312['query']=_[_0x63c4('0x2f')](_0x149fa4[_0x63c4('0x2e')]);_0x4ed312['filters']=_['intersection'](_0x4ed312['model'],_0x4ed312['query']);_0x4a8628['attributes']=_[_0x63c4('0x43')](_0x4ed312[_0x63c4('0x2d')],qs[_0x63c4('0x31')](_0x149fa4[_0x63c4('0x2e')]['fields']));_0x4a8628[_0x63c4('0x30')]=_0x4a8628[_0x63c4('0x30')][_0x63c4('0x32')]?_0x4a8628[_0x63c4('0x30')]:_0x4ed312[_0x63c4('0x2d')];if(_0x149fa4[_0x63c4('0x2e')]['includeAll']){_0x4a8628[_0x63c4('0x3e')]=[{'all':!![]}];}_0x4a8628=_[_0x63c4('0x3b')]({},_0x4a8628,_0x149fa4[_0x63c4('0x3d')]);return db[_0x63c4('0x29')][_0x63c4('0x44')](_0x4a8628)['then'](handleEntityNotFound(_0x4b2f02,null))['then'](respondWithResult(_0x4b2f02,null))['catch'](handleError(_0x4b2f02,null));};exports[_0x63c4('0x45')]=function(_0x586b65,_0x1354e6){return db[_0x63c4('0x29')][_0x63c4('0x45')](_0x586b65[_0x63c4('0x46')],{})[_0x63c4('0x23')](respondWithResult(_0x1354e6,0xc9))[_0x63c4('0x40')](handleError(_0x1354e6,null));};exports[_0x63c4('0x47')]=function(_0x15acb6,_0x5df2e7){if(_0x15acb6['body']['id']){delete _0x15acb6[_0x63c4('0x46')]['id'];}return db['DeskAccount'][_0x63c4('0x44')]({'where':{'id':_0x15acb6[_0x63c4('0x42')]['id']}})[_0x63c4('0x23')](handleEntityNotFound(_0x5df2e7,null))[_0x63c4('0x23')](saveUpdates(_0x15acb6['body'],null))[_0x63c4('0x23')](respondWithResult(_0x5df2e7,null))[_0x63c4('0x40')](handleError(_0x5df2e7,null));};exports[_0x63c4('0x22')]=function(_0x266838,_0xbab834){return db[_0x63c4('0x29')]['find']({'where':{'id':_0x266838['params']['id']}})[_0x63c4('0x23')](handleEntityNotFound(_0xbab834,null))['then'](removeEntity(_0xbab834,null))[_0x63c4('0x40')](handleError(_0xbab834,null));};exports['getConfigurations']=function(_0x2c7376,_0x2852c5,_0x5464b5){var _0x4d7cd2={};var _0x26df32={};var _0x40d149;var _0x308e22;return db[_0x63c4('0x29')][_0x63c4('0x48')]({'where':{'id':_0x2c7376[_0x63c4('0x42')]['id']}})[_0x63c4('0x23')](handleEntityNotFound(_0x2852c5,null))['then'](function(_0x132b3){if(_0x132b3){_0x40d149=_0x132b3;_0x26df32[_0x63c4('0x2d')]=_[_0x63c4('0x2f')](db[_0x63c4('0x49')][_0x63c4('0x2a')]);_0x26df32[_0x63c4('0x2e')]=_[_0x63c4('0x2f')](_0x2c7376[_0x63c4('0x2e')]);_0x26df32[_0x63c4('0x38')]=_[_0x63c4('0x43')](_0x26df32['model'],_0x26df32[_0x63c4('0x2e')]);_0x4d7cd2[_0x63c4('0x30')]=_[_0x63c4('0x43')](_0x26df32[_0x63c4('0x2d')],qs[_0x63c4('0x31')](_0x2c7376['query'][_0x63c4('0x31')]));_0x4d7cd2[_0x63c4('0x30')]=_0x4d7cd2[_0x63c4('0x30')]['length']?_0x4d7cd2['attributes']:_0x26df32[_0x63c4('0x2d')];_0x4d7cd2[_0x63c4('0x35')]=qs[_0x63c4('0x36')](_0x2c7376[_0x63c4('0x2e')][_0x63c4('0x36')]);_0x4d7cd2[_0x63c4('0x3a')]=qs[_0x63c4('0x38')](_[_0x63c4('0x37')](_0x2c7376[_0x63c4('0x2e')],_0x26df32['filters']));if(_0x2c7376[_0x63c4('0x2e')][_0x63c4('0x39')]){_0x4d7cd2[_0x63c4('0x3a')]=_[_0x63c4('0x3b')](_0x4d7cd2[_0x63c4('0x3a')],{'$or':_[_0x63c4('0x28')](_0x4d7cd2[_0x63c4('0x30')],function(_0x2ca56f){var _0x515301={};_0x515301[_0x2ca56f]={'$like':'%'+_0x2c7376[_0x63c4('0x2e')]['filter']+'%'};return _0x515301;})});}_0x4d7cd2=_[_0x63c4('0x3b')]({},_0x4d7cd2,_0x2c7376[_0x63c4('0x3d')]);return _0x40d149[_0x63c4('0x4a')](_0x4d7cd2);}})[_0x63c4('0x23')](function(_0x2c413a){if(_0x2c413a){_0x308e22=_0x2c413a[_0x63c4('0x32')];if(!_0x2c7376[_0x63c4('0x2e')][_0x63c4('0x33')](_0x63c4('0x34'))){_0x4d7cd2['limit']=qs[_0x63c4('0x1e')](_0x2c7376['query'][_0x63c4('0x1e')]);_0x4d7cd2[_0x63c4('0x1d')]=qs['offset'](_0x2c7376['query'][_0x63c4('0x1d')]);}return _0x40d149[_0x63c4('0x4a')](_0x4d7cd2);}})[_0x63c4('0x23')](function(_0x183e66){if(_0x183e66){return _0x183e66?{'count':_0x308e22,'rows':_0x183e66}:null;}})['then'](respondWithResult(_0x2852c5,null))[_0x63c4('0x40')](handleError(_0x2852c5,null));};exports[_0x63c4('0x4b')]=function(_0x33f466,_0x942b93,_0x15e52a){if(_0x33f466[_0x63c4('0x46')]['id']){delete _0x33f466[_0x63c4('0x46')]['id'];}return db[_0x63c4('0x29')][_0x63c4('0x48')]({'where':{'id':_0x33f466[_0x63c4('0x42')]['id']}})[_0x63c4('0x23')](handleEntityNotFound(_0x942b93,null))['then'](function(_0x2ecc98){if(_0x2ecc98){_0x33f466[_0x63c4('0x46')]['AccountId']=_0x2ecc98['id'];_0x33f466[_0x63c4('0x46')][_0x63c4('0x4c')]=integrations[_0x63c4('0x4d')](_0x33f466['body'][_0x63c4('0x4e')],_0x33f466[_0x63c4('0x46')]['type']);_0x33f466[_0x63c4('0x46')][_0x63c4('0x4f')]=integrations[_0x63c4('0x50')](_0x33f466[_0x63c4('0x46')]['channel'],_0x33f466[_0x63c4('0x46')][_0x63c4('0x2c')]);return db['DeskConfiguration']['create'](_0x33f466['body'],{'include':[{'model':db[_0x63c4('0x51')],'as':_0x63c4('0x4c')},{'model':db[_0x63c4('0x51')],'as':'Descriptions'}]});}return null;})[_0x63c4('0x23')](respondWithResult(_0x942b93,null))[_0x63c4('0x40')](handleError(_0x942b93,null));};exports[_0x63c4('0x52')]=function(_0x471a0c,_0x15e012,_0x2122a2){var _0xbad155=[{'name':_0x63c4('0x53'),'label':_0x63c4('0x53'),'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 _0x4277e7='';return db['DeskAccount'][_0x63c4('0x48')]({'where':{'id':_0x471a0c['params']['id']},'attributes':['id',_0x63c4('0x54'),_0x63c4('0x55'),_0x63c4('0x56'),_0x63c4('0x57'),_0x63c4('0x58'),'consumerSecret',_0x63c4('0x59'),_0x63c4('0x5a')]})[_0x63c4('0x23')](handleEntityNotFound(_0x15e012,null))[_0x63c4('0x23')](function(_0x571d61){if(_0x571d61){_0x4277e7=_0x571d61['remoteUri'];var _0x10470b=_0x4277e7['slice'](-0x1);if(_0x10470b==='/'){_0x4277e7=_0x4277e7[_0x63c4('0x5b')](0x0,_0x4277e7[_0x63c4('0x5c')](_0x10470b));}var _0x34f7aa={'method':_0x63c4('0x5d'),'uri':util[_0x63c4('0x5e')](_0x63c4('0x5f'),_0x4277e7),'headers':{'Content-Type':_0x63c4('0x60'),'Accept':'application/json'},'json':!![]};if(_0x571d61['authType']==='basic'){_0x34f7aa[_0x63c4('0x61')][_0x63c4('0x62')]=util[_0x63c4('0x5e')](_0x63c4('0x63'),new Buffer(util[_0x63c4('0x5e')](_0x63c4('0x64'),_0x571d61[_0x63c4('0x56')],_0x571d61[_0x63c4('0x57')]))[_0x63c4('0x65')]('base64'));}return rp(_0x34f7aa)[_0x63c4('0x23')](function(_0x34b021){return _0xbad155['concat'](_[_0x63c4('0x28')](_0x34b021['_embedded'][_0x63c4('0x66')],function(_0x24c044){return{'id':_0x24c044[_0x63c4('0x26')],'name':_0x24c044[_0x63c4('0x26')],'type':_0x24c044[_0x63c4('0x2c')],'active':_0x24c044[_0x63c4('0x67')],'label':_0x24c044['label'],'custom':!![]};}));});}})[_0x63c4('0x23')](function(_0x15c48c){return{'count':_0x15c48c[_0x63c4('0x32')],'rows':_0x15c48c};})[_0x63c4('0x23')](respondWithResult(_0x15e012,null))[_0x63c4('0x40')](function(_0x72e7d4){var _0x8d3c90=_0x471a0c[_0x63c4('0x2e')]['test']?0x1f4:_0x72e7d4[_0x63c4('0x68')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x8d3c90,JSON[_0x63c4('0x69')](_0x72e7d4));delete _0x72e7d4[_0x63c4('0x26')];if(_0x8d3c90===0x191){_0x8d3c90=0x190;}_0x15e012[_0x63c4('0x19')](_0x8d3c90)[_0x63c4('0x6a')](_0x471a0c[_0x63c4('0x2e')][_0x63c4('0x6b')]?{'message':_0x63c4('0x6c'),'statusCode':_0x72e7d4[_0x63c4('0x68')]}:_0x72e7d4);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index f73092e..1a37859 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 _0x1756=['api','moment','bluebird','request-promise','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','define','int_desk_accounts','util','../../config/logger'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0x1756,0x172));var _0x6175=function(_0x27f516,_0x209ada){_0x27f516=_0x27f516-0x0;var _0x49e138=_0x1756[_0x27f516];return _0x49e138;};'use strict';var _=require('lodash');var util=require(_0x6175('0x0'));var logger=require(_0x6175('0x1'))(_0x6175('0x2'));var moment=require(_0x6175('0x3'));var BPromise=require(_0x6175('0x4'));var rp=require(_0x6175('0x5'));var fs=require('fs');var path=require(_0x6175('0x6'));var rimraf=require(_0x6175('0x7'));var config=require('../../config/environment');var attributes=require(_0x6175('0x8'));var integrations=require(_0x6175('0x9'));module['exports']=function(_0x296113,_0x3162ff){return _0x296113[_0x6175('0xa')]('DeskAccount',attributes,{'tableName':_0x6175('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0aa9=['./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x50cec9,_0x252ff5){var _0x3cabb9=function(_0x30a547){while(--_0x30a547){_0x50cec9['push'](_0x50cec9['shift']());}};_0x3cabb9(++_0x252ff5);}(_0x0aa9,0x1c1));var _0x90aa=function(_0x4e4ff2,_0x30c8e7){_0x4e4ff2=_0x4e4ff2-0x0;var _0x49a1c7=_0x0aa9[_0x4e4ff2];return _0x49a1c7;};'use strict';var _=require(_0x90aa('0x0'));var util=require(_0x90aa('0x1'));var logger=require(_0x90aa('0x2'))(_0x90aa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x90aa('0x4'));var fs=require('fs');var path=require(_0x90aa('0x5'));var rimraf=require(_0x90aa('0x6'));var config=require('../../config/environment');var attributes=require(_0x90aa('0x7'));var integrations=require(_0x90aa('0x8'));module[_0x90aa('0x9')]=function(_0x51bc1b,_0xad75dd){return _0x51bc1b['define'](_0x90aa('0xa'),attributes,{'tableName':_0x90aa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index bf570ee..7e569dc 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 _0xb3ed=['then','ShowDeskAccount','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskAccount,\x20%s,\x20%s','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','limit','include','map','model','attributes','find','where'];(function(_0x4e6bcf,_0xeece0f){var _0x48bfab=function(_0x2220c1){while(--_0x2220c1){_0x4e6bcf['push'](_0x4e6bcf['shift']());}};_0x48bfab(++_0xeece0f);}(_0xb3ed,0x1a4));var _0xdb3e=function(_0x3bff7b,_0xe6f474){_0x3bff7b=_0x3bff7b-0x0;var _0x448130=_0xb3ed[_0x3bff7b];return _0x448130;};'use strict';var _=require(_0xdb3e('0x0'));var util=require('util');var moment=require(_0xdb3e('0x1'));var BPromise=require(_0xdb3e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb3e('0x3'));var db=require(_0xdb3e('0x4'))['db'];var utils=require(_0xdb3e('0x5'));var logger=require(_0xdb3e('0x6'))(_0xdb3e('0x7'));var config=require(_0xdb3e('0x8'));var jayson=require(_0xdb3e('0x9'));var client=jayson[_0xdb3e('0xa')][_0xdb3e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21934a,_0x19dade,_0x3a9ef6){return new BPromise(function(_0x495114,_0x30d1e7){return client[_0xdb3e('0xc')](_0x21934a,_0x3a9ef6)['then'](function(_0x189144){logger[_0xdb3e('0xd')]('DeskAccount,\x20%s,\x20%s',_0x19dade,_0xdb3e('0xe'));logger[_0xdb3e('0xf')](_0xdb3e('0x10'),_0x19dade,_0xdb3e('0xe'),JSON[_0xdb3e('0x11')](_0x189144));if(_0x189144[_0xdb3e('0x12')]){if(_0x189144['error'][_0xdb3e('0x13')]===0x1f4){logger[_0xdb3e('0x12')]('DeskAccount,\x20%s,\x20%s',_0x19dade,_0x189144[_0xdb3e('0x12')]['message']);return _0x30d1e7(_0x189144['error'][_0xdb3e('0x14')]);}logger[_0xdb3e('0x12')](_0xdb3e('0x15'),_0x19dade,_0x189144[_0xdb3e('0x12')]['message']);return _0x495114(_0x189144[_0xdb3e('0x12')][_0xdb3e('0x14')]);}else{logger[_0xdb3e('0xd')](_0xdb3e('0x15'),_0x19dade,_0xdb3e('0xe'));_0x495114(_0x189144[_0xdb3e('0x16')][_0xdb3e('0x14')]);}})[_0xdb3e('0x17')](function(_0x13c26e){logger[_0xdb3e('0x12')](_0xdb3e('0x15'),_0x19dade,_0x13c26e);_0x30d1e7(_0x13c26e);});});}exports[_0xdb3e('0x18')]=function(_0xda9694){var _0x250991=this;return new Promise(function(_0x2c49d3,_0x12a8c8){return db[_0xdb3e('0x19')][_0xdb3e('0x1a')]({'raw':_0xda9694[_0xdb3e('0x1b')]?_0xda9694[_0xdb3e('0x1b')][_0xdb3e('0x1c')]===undefined?!![]:![]:!![],'where':_0xda9694[_0xdb3e('0x1b')]?_0xda9694[_0xdb3e('0x1b')]['where']||null:null,'attributes':_0xda9694['options']?_0xda9694[_0xdb3e('0x1b')]['attributes']||null:null,'limit':_0xda9694['options']?_0xda9694['options'][_0xdb3e('0x1d')]||null:null,'include':_0xda9694[_0xdb3e('0x1b')]?_0xda9694[_0xdb3e('0x1b')][_0xdb3e('0x1e')]?_[_0xdb3e('0x1f')](_0xda9694[_0xdb3e('0x1b')][_0xdb3e('0x1e')],function(_0x5d4740){return{'model':db[_0x5d4740[_0xdb3e('0x20')]],'as':_0x5d4740['as'],'attributes':_0x5d4740[_0xdb3e('0x21')],'include':_0x5d4740[_0xdb3e('0x1e')]?_[_0xdb3e('0x1f')](_0x5d4740[_0xdb3e('0x1e')],function(_0x20b6ac){return{'model':db[_0x20b6ac[_0xdb3e('0x20')]],'as':_0x20b6ac['as'],'attributes':_0x20b6ac[_0xdb3e('0x21')],'include':_0x20b6ac[_0xdb3e('0x1e')]?_[_0xdb3e('0x1f')](_0x20b6ac[_0xdb3e('0x1e')],function(_0x1d24b5){return{'model':db[_0x1d24b5['model']],'as':_0x1d24b5['as'],'attributes':_0x1d24b5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x482371){logger[_0xdb3e('0xd')]('GetDeskAccount',_0xda9694);logger[_0xdb3e('0xf')](_0xdb3e('0x18'),_0xda9694,JSON[_0xdb3e('0x11')](_0x482371));_0x2c49d3(_0x482371);})['catch'](function(_0xc5cd07){logger[_0xdb3e('0x12')](_0xdb3e('0x18'),_0xc5cd07[_0xdb3e('0x14')],_0xda9694);_0x12a8c8(_0x250991[_0xdb3e('0x12')](0x1f4,_0xc5cd07[_0xdb3e('0x14')]));});});};exports['ShowDeskAccount']=function(_0x2210ee){var _0x3089b6=this;return new Promise(function(_0x1cb875,_0x5bb6d2){return db[_0xdb3e('0x19')][_0xdb3e('0x22')]({'raw':_0x2210ee[_0xdb3e('0x1b')]?_0x2210ee[_0xdb3e('0x1b')][_0xdb3e('0x1c')]===undefined?!![]:![]:!![],'where':_0x2210ee['options']?_0x2210ee['options'][_0xdb3e('0x23')]||null:null,'attributes':_0x2210ee[_0xdb3e('0x1b')]?_0x2210ee['options'][_0xdb3e('0x21')]||null:null,'include':_0x2210ee[_0xdb3e('0x1b')]?_0x2210ee[_0xdb3e('0x1b')][_0xdb3e('0x1e')]?_[_0xdb3e('0x1f')](_0x2210ee[_0xdb3e('0x1b')][_0xdb3e('0x1e')],function(_0x226c33){return{'model':db[_0x226c33[_0xdb3e('0x20')]],'as':_0x226c33['as'],'attributes':_0x226c33[_0xdb3e('0x21')],'include':_0x226c33[_0xdb3e('0x1e')]?_['map'](_0x226c33[_0xdb3e('0x1e')],function(_0x3f595f){return{'model':db[_0x3f595f[_0xdb3e('0x20')]],'as':_0x3f595f['as'],'attributes':_0x3f595f[_0xdb3e('0x21')],'include':_0x3f595f['include']?_[_0xdb3e('0x1f')](_0x3f595f[_0xdb3e('0x1e')],function(_0x304ad4){return{'model':db[_0x304ad4[_0xdb3e('0x20')]],'as':_0x304ad4['as'],'attributes':_0x304ad4[_0xdb3e('0x21')]};}):[]};}):[]};}):[]:[]})[_0xdb3e('0x24')](function(_0x4ac6b6){logger[_0xdb3e('0xd')]('ShowDeskAccount',_0x2210ee);logger[_0xdb3e('0xf')]('ShowDeskAccount',_0x2210ee,JSON['stringify'](_0x4ac6b6));_0x1cb875(_0x4ac6b6);})[_0xdb3e('0x17')](function(_0x59710d){logger[_0xdb3e('0x12')](_0xdb3e('0x25'),_0x59710d['message'],_0x2210ee);_0x5bb6d2(_0x3089b6[_0xdb3e('0x12')](0x1f4,_0x59710d[_0xdb3e('0x14')]));});});}; \ No newline at end of file +var _0x8645=['include','map','model','ShowDeskAccount','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount','options','where','attributes','limit'];(function(_0x3411a2,_0x37d6d7){var _0x3861f0=function(_0x42b182){while(--_0x42b182){_0x3411a2['push'](_0x3411a2['shift']());}};_0x3861f0(++_0x37d6d7);}(_0x8645,0x1e1));var _0x5864=function(_0x2c985c,_0x1e59db){_0x2c985c=_0x2c985c-0x0;var _0x3fb09a=_0x8645[_0x2c985c];return _0x3fb09a;};'use strict';var _=require(_0x5864('0x0'));var util=require('util');var moment=require(_0x5864('0x1'));var BPromise=require(_0x5864('0x2'));var rs=require(_0x5864('0x3'));var fs=require('fs');var Redis=require(_0x5864('0x4'));var db=require(_0x5864('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5864('0x6'));var config=require(_0x5864('0x7'));var jayson=require(_0x5864('0x8'));var client=jayson[_0x5864('0x9')][_0x5864('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ab013,_0x408e06,_0x1af882){return new BPromise(function(_0xd4ff5f,_0x57704b){return client[_0x5864('0xb')](_0x2ab013,_0x1af882)[_0x5864('0xc')](function(_0x4b5aec){logger[_0x5864('0xd')]('DeskAccount,\x20%s,\x20%s',_0x408e06,'request\x20sent');logger[_0x5864('0xe')](_0x5864('0xf'),_0x408e06,'request\x20sent',JSON[_0x5864('0x10')](_0x4b5aec));if(_0x4b5aec[_0x5864('0x11')]){if(_0x4b5aec[_0x5864('0x11')][_0x5864('0x12')]===0x1f4){logger[_0x5864('0x11')](_0x5864('0x13'),_0x408e06,_0x4b5aec[_0x5864('0x11')]['message']);return _0x57704b(_0x4b5aec[_0x5864('0x11')]['message']);}logger['error'](_0x5864('0x13'),_0x408e06,_0x4b5aec[_0x5864('0x11')][_0x5864('0x14')]);return _0xd4ff5f(_0x4b5aec[_0x5864('0x11')][_0x5864('0x14')]);}else{logger[_0x5864('0xd')](_0x5864('0x13'),_0x408e06,'request\x20sent');_0xd4ff5f(_0x4b5aec[_0x5864('0x15')][_0x5864('0x14')]);}})[_0x5864('0x16')](function(_0x1c7f64){logger[_0x5864('0x11')](_0x5864('0x13'),_0x408e06,_0x1c7f64);_0x57704b(_0x1c7f64);});});}exports[_0x5864('0x17')]=function(_0x57b527){var _0x13a5cc=this;return new Promise(function(_0x202f6f,_0xf944ff){return db[_0x5864('0x18')]['findAll']({'raw':_0x57b527[_0x5864('0x19')]?_0x57b527['options']['raw']===undefined?!![]:![]:!![],'where':_0x57b527[_0x5864('0x19')]?_0x57b527[_0x5864('0x19')][_0x5864('0x1a')]||null:null,'attributes':_0x57b527[_0x5864('0x19')]?_0x57b527['options'][_0x5864('0x1b')]||null:null,'limit':_0x57b527[_0x5864('0x19')]?_0x57b527['options'][_0x5864('0x1c')]||null:null,'include':_0x57b527[_0x5864('0x19')]?_0x57b527[_0x5864('0x19')][_0x5864('0x1d')]?_['map'](_0x57b527[_0x5864('0x19')][_0x5864('0x1d')],function(_0x22d206){return{'model':db[_0x22d206['model']],'as':_0x22d206['as'],'attributes':_0x22d206['attributes'],'include':_0x22d206[_0x5864('0x1d')]?_[_0x5864('0x1e')](_0x22d206['include'],function(_0x28c569){return{'model':db[_0x28c569[_0x5864('0x1f')]],'as':_0x28c569['as'],'attributes':_0x28c569['attributes'],'include':_0x28c569[_0x5864('0x1d')]?_[_0x5864('0x1e')](_0x28c569[_0x5864('0x1d')],function(_0x3e035c){return{'model':db[_0x3e035c['model']],'as':_0x3e035c['as'],'attributes':_0x3e035c['attributes']};}):[]};}):[]};}):[]:[]})[_0x5864('0xc')](function(_0x402676){logger[_0x5864('0xd')](_0x5864('0x17'),_0x57b527);logger[_0x5864('0xe')](_0x5864('0x17'),_0x57b527,JSON[_0x5864('0x10')](_0x402676));_0x202f6f(_0x402676);})[_0x5864('0x16')](function(_0xbecc0e){logger[_0x5864('0x11')](_0x5864('0x17'),_0xbecc0e[_0x5864('0x14')],_0x57b527);_0xf944ff(_0x13a5cc['error'](0x1f4,_0xbecc0e[_0x5864('0x14')]));});});};exports[_0x5864('0x20')]=function(_0x573349){var _0x2cd2e9=this;return new Promise(function(_0x465135,_0x7f3178){return db[_0x5864('0x18')]['find']({'raw':_0x573349[_0x5864('0x19')]?_0x573349[_0x5864('0x19')][_0x5864('0x21')]===undefined?!![]:![]:!![],'where':_0x573349[_0x5864('0x19')]?_0x573349[_0x5864('0x19')][_0x5864('0x1a')]||null:null,'attributes':_0x573349['options']?_0x573349[_0x5864('0x19')][_0x5864('0x1b')]||null:null,'include':_0x573349['options']?_0x573349[_0x5864('0x19')][_0x5864('0x1d')]?_[_0x5864('0x1e')](_0x573349[_0x5864('0x19')][_0x5864('0x1d')],function(_0x4d94b5){return{'model':db[_0x4d94b5[_0x5864('0x1f')]],'as':_0x4d94b5['as'],'attributes':_0x4d94b5[_0x5864('0x1b')],'include':_0x4d94b5['include']?_[_0x5864('0x1e')](_0x4d94b5[_0x5864('0x1d')],function(_0x428761){return{'model':db[_0x428761['model']],'as':_0x428761['as'],'attributes':_0x428761['attributes'],'include':_0x428761[_0x5864('0x1d')]?_[_0x5864('0x1e')](_0x428761[_0x5864('0x1d')],function(_0xe4c016){return{'model':db[_0xe4c016[_0x5864('0x1f')]],'as':_0xe4c016['as'],'attributes':_0xe4c016[_0x5864('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5864('0xc')](function(_0x180551){logger[_0x5864('0xd')](_0x5864('0x20'),_0x573349);logger[_0x5864('0xe')]('ShowDeskAccount',_0x573349,JSON[_0x5864('0x10')](_0x180551));_0x465135(_0x180551);})['catch'](function(_0x48571c){logger['error'](_0x5864('0x20'),_0x48571c[_0x5864('0x14')],_0x573349);_0x7f3178(_0x2cd2e9['error'](0x1f4,_0x48571c['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 9021e95..b90d2ae 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x121195,_0x277af4){var _0xf0b9df=function(_0x5d619f){while(--_0x5d619f){_0x121195['push'](_0x121195['shift']());}};_0xf0b9df(++_0x277af4);}(_0x3e74,0x175));var _0x43e7=function(_0xd36c5a,_0x140514){_0xd36c5a=_0xd36c5a-0x0;var _0x334cf9=_0x3e74[_0xd36c5a];return _0x334cf9;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x492d17,_0x53e5c2){var _0xfe07eb=function(_0x43b2f2){while(--_0x43b2f2){_0x492d17['push'](_0x492d17['shift']());}};_0xfe07eb(++_0x53e5c2);}(_0x008c,0x188));var _0xc008=function(_0x1795df,_0xcb261e){_0x1795df=_0x1795df-0x0;var _0x3f13c0=_0x008c[_0x1795df];return _0x3f13c0;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index fbdc525..0a46961 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 _0xb5a5=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb5a5,0x95));var _0x5b5a=function(_0x23e7b8,_0x5af08e){_0x23e7b8=_0x23e7b8-0x0;var _0x3007cc=_0xb5a5[_0x23e7b8];return _0x3007cc;};'use strict';var Sequelize=require(_0x5b5a('0x0'));module[_0x5b5a('0x1')]={'name':{'type':Sequelize[_0x5b5a('0x2')]},'description':{'type':Sequelize[_0x5b5a('0x2')]}}; \ No newline at end of file +var _0xb6ec=['exports','STRING','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb6ec,0x164));var _0xcb6e=function(_0x24f498,_0x3d93a3){_0x24f498=_0x24f498-0x0;var _0xa9c070=_0xb6ec[_0x24f498];return _0xa9c070;};'use strict';var Sequelize=require(_0xcb6e('0x0'));module[_0xcb6e('0x1')]={'name':{'type':Sequelize[_0xcb6e('0x2')]},'description':{'type':Sequelize[_0xcb6e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index e848c89..b9e5ecb 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 _0xd946=['options','catch','create','body','update','find','getFields','findOne','DeskField','order','hasOwnProperty','getSubjects','getDescriptions','pick','getTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','Content-Range','json','apply','reject','then','destroy','end','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','keys','query','intersection','model','fields','attributes','length','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','count','includeAll','include','rows','params'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd946,0xfd));var _0x6d94=function(_0x4bc678,_0x4300b1){_0x4bc678=_0x4bc678-0x0;var _0x4b711e=_0xd946[_0x4bc678];return _0x4b711e;};'use strict';var emlformat=require(_0x6d94('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6d94('0x1'));var jsonpatch=require(_0x6d94('0x2'));var rp=require(_0x6d94('0x3'));var moment=require('moment');var BPromise=require(_0x6d94('0x4'));var Mustache=require(_0x6d94('0x5'));var util=require('util');var path=require(_0x6d94('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6d94('0x7'));var fs=require('fs');var fs_extra=require(_0x6d94('0x8'));var _=require('lodash');var squel=require(_0x6d94('0x9'));var crypto=require(_0x6d94('0xa'));var jsforce=require(_0x6d94('0xb'));var deskjs=require(_0x6d94('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6d94('0xd'));var Redis=require(_0x6d94('0xe'));var authService=require(_0x6d94('0xf'));var qs=require(_0x6d94('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6d94('0x11'))('api');var utils=require(_0x6d94('0x12'));var config=require(_0x6d94('0x13'));var licenseUtil=require(_0x6d94('0x14'));var db=require(_0x6d94('0x15'))['db'];function respondWithStatusCode(_0x84d4fa,_0x44c068){_0x44c068=_0x44c068||0xcc;return function(_0x3d4bcd){if(_0x3d4bcd){return _0x84d4fa[_0x6d94('0x16')](_0x44c068);}return _0x84d4fa[_0x6d94('0x17')](_0x44c068)['end']();};}function respondWithResult(_0x59626d,_0x3b9485){_0x3b9485=_0x3b9485||0xc8;return function(_0xc1ea53){if(_0xc1ea53){return _0x59626d[_0x6d94('0x17')](_0x3b9485)['json'](_0xc1ea53);}};}function respondWithFilteredResult(_0x7d9537,_0x5c025a){return function(_0xb167e7){if(_0xb167e7){var _0xeb1bf5=typeof _0x5c025a[_0x6d94('0x18')]===_0x6d94('0x19')&&typeof _0x5c025a[_0x6d94('0x1a')]===_0x6d94('0x19');var _0x49990a=_0xb167e7['count'];var _0x160f0f=_0xeb1bf5?0x0:_0x5c025a[_0x6d94('0x18')];var _0x2ae038=_0xeb1bf5?_0xb167e7['count']:_0x5c025a[_0x6d94('0x18')]+_0x5c025a[_0x6d94('0x1a')];var _0x151533;if(_0x2ae038>=_0x49990a){_0x2ae038=_0x49990a;_0x151533=0xc8;}else{_0x151533=0xce;}_0x7d9537[_0x6d94('0x17')](_0x151533);return _0x7d9537['set'](_0x6d94('0x1b'),_0x160f0f+'-'+_0x2ae038+'/'+_0x49990a)[_0x6d94('0x1c')](_0xb167e7);}return null;};}function patchUpdates(_0x3dd929){return function(_0x4e0bbb){try{jsonpatch[_0x6d94('0x1d')](_0x4e0bbb,_0x3dd929,!![]);}catch(_0x535786){return BPromise[_0x6d94('0x1e')](_0x535786);}return _0x4e0bbb['save']();};}function saveUpdates(_0x25ecbb,_0x4f18df){return function(_0x1555a9){if(_0x1555a9){return _0x1555a9['update'](_0x25ecbb)[_0x6d94('0x1f')](function(_0x50f9bf){return _0x50f9bf;});}return null;};}function removeEntity(_0x52ec87,_0x3b1e87){return function(_0x38aa92){if(_0x38aa92){return _0x38aa92[_0x6d94('0x20')]()[_0x6d94('0x1f')](function(){_0x52ec87[_0x6d94('0x17')](0xcc)[_0x6d94('0x21')]();});}};}function handleEntityNotFound(_0x3fec93,_0x2e2914){return function(_0x115ec1){if(!_0x115ec1){_0x3fec93[_0x6d94('0x16')](0x194);}return _0x115ec1;};}function handleError(_0x15441b,_0x4e8be8){_0x4e8be8=_0x4e8be8||0x1f4;return function(_0x1eb201){logger[_0x6d94('0x22')](_0x1eb201[_0x6d94('0x23')]);if(_0x1eb201[_0x6d94('0x24')]){delete _0x1eb201['name'];}_0x15441b[_0x6d94('0x17')](_0x4e8be8)[_0x6d94('0x25')](_0x1eb201);};}exports[_0x6d94('0x26')]=function(_0x3a8d12,_0x3df75d){var _0x77ce49={},_0x14f2f9={},_0x2ce2d1={'count':0x0,'rows':[]};var _0x7bd336=_[_0x6d94('0x27')](db[_0x6d94('0x28')][_0x6d94('0x29')],function(_0x3cee68){return{'name':_0x3cee68[_0x6d94('0x2a')],'type':_0x3cee68['type']['key']};});_0x14f2f9['model']=_[_0x6d94('0x27')](_0x7bd336,'name');_0x14f2f9['query']=_[_0x6d94('0x2b')](_0x3a8d12[_0x6d94('0x2c')]);_0x14f2f9['filters']=_[_0x6d94('0x2d')](_0x14f2f9['model'],_0x14f2f9[_0x6d94('0x2c')]);_0x77ce49['attributes']=_[_0x6d94('0x2d')](_0x14f2f9[_0x6d94('0x2e')],qs[_0x6d94('0x2f')](_0x3a8d12[_0x6d94('0x2c')][_0x6d94('0x2f')]));_0x77ce49[_0x6d94('0x30')]=_0x77ce49['attributes'][_0x6d94('0x31')]?_0x77ce49[_0x6d94('0x30')]:_0x14f2f9[_0x6d94('0x2e')];if(!_0x3a8d12[_0x6d94('0x2c')]['hasOwnProperty'](_0x6d94('0x32'))){_0x77ce49[_0x6d94('0x1a')]=qs[_0x6d94('0x1a')](_0x3a8d12['query']['limit']);_0x77ce49[_0x6d94('0x18')]=qs[_0x6d94('0x18')](_0x3a8d12[_0x6d94('0x2c')][_0x6d94('0x18')]);}_0x77ce49['order']=qs[_0x6d94('0x33')](_0x3a8d12[_0x6d94('0x2c')]['sort']);_0x77ce49[_0x6d94('0x34')]=qs[_0x6d94('0x35')](_['pick'](_0x3a8d12[_0x6d94('0x2c')],_0x14f2f9[_0x6d94('0x35')]),_0x7bd336);if(_0x3a8d12[_0x6d94('0x2c')][_0x6d94('0x36')]){_0x77ce49['where']=_[_0x6d94('0x37')](_0x77ce49[_0x6d94('0x34')],{'$or':_[_0x6d94('0x27')](_0x7bd336,function(_0x185065){if(_0x185065[_0x6d94('0x38')]!==_0x6d94('0x39')){var _0x372f7c={};_0x372f7c[_0x185065['name']]={'$like':'%'+_0x3a8d12['query'][_0x6d94('0x36')]+'%'};return _0x372f7c;}})});}_0x77ce49=_[_0x6d94('0x37')]({},_0x77ce49,_0x3a8d12['options']);var _0x46f6c6={'where':_0x77ce49[_0x6d94('0x34')]};return db[_0x6d94('0x28')][_0x6d94('0x3a')](_0x46f6c6)[_0x6d94('0x1f')](function(_0x162170){_0x2ce2d1[_0x6d94('0x3a')]=_0x162170;if(_0x3a8d12['query'][_0x6d94('0x3b')]){_0x77ce49[_0x6d94('0x3c')]=[{'all':!![]}];}return db[_0x6d94('0x28')]['findAll'](_0x77ce49);})['then'](function(_0x5c490b){_0x2ce2d1[_0x6d94('0x3d')]=_0x5c490b;return _0x2ce2d1;})['then'](respondWithFilteredResult(_0x3df75d,_0x77ce49))['catch'](handleError(_0x3df75d,null));};exports['show']=function(_0x9cb854,_0x284be4){var _0x31bf10={'raw':![],'where':{'id':_0x9cb854[_0x6d94('0x3e')]['id']}},_0x55035d={};_0x55035d[_0x6d94('0x2e')]=_[_0x6d94('0x2b')](db[_0x6d94('0x28')][_0x6d94('0x29')]);_0x55035d['query']=_[_0x6d94('0x2b')](_0x9cb854[_0x6d94('0x2c')]);_0x55035d[_0x6d94('0x35')]=_[_0x6d94('0x2d')](_0x55035d[_0x6d94('0x2e')],_0x55035d[_0x6d94('0x2c')]);_0x31bf10['attributes']=_[_0x6d94('0x2d')](_0x55035d[_0x6d94('0x2e')],qs[_0x6d94('0x2f')](_0x9cb854[_0x6d94('0x2c')][_0x6d94('0x2f')]));_0x31bf10['attributes']=_0x31bf10['attributes'][_0x6d94('0x31')]?_0x31bf10['attributes']:_0x55035d[_0x6d94('0x2e')];if(_0x9cb854[_0x6d94('0x2c')][_0x6d94('0x3b')]){_0x31bf10[_0x6d94('0x3c')]=[{'all':!![]}];}_0x31bf10=_[_0x6d94('0x37')]({},_0x31bf10,_0x9cb854[_0x6d94('0x3f')]);return db[_0x6d94('0x28')]['find'](_0x31bf10)[_0x6d94('0x1f')](handleEntityNotFound(_0x284be4,null))[_0x6d94('0x1f')](respondWithResult(_0x284be4,null))[_0x6d94('0x40')](handleError(_0x284be4,null));};exports[_0x6d94('0x41')]=function(_0x32390d,_0x5c0934){return db[_0x6d94('0x28')]['create'](_0x32390d[_0x6d94('0x42')],{})[_0x6d94('0x1f')](respondWithResult(_0x5c0934,0xc9))['catch'](handleError(_0x5c0934,null));};exports[_0x6d94('0x43')]=function(_0x5cd2c6,_0x22b256){if(_0x5cd2c6[_0x6d94('0x42')]['id']){delete _0x5cd2c6[_0x6d94('0x42')]['id'];}return db[_0x6d94('0x28')]['find']({'where':{'id':_0x5cd2c6['params']['id']}})['then'](handleEntityNotFound(_0x22b256,null))['then'](saveUpdates(_0x5cd2c6['body'],null))[_0x6d94('0x1f')](respondWithResult(_0x22b256,null))[_0x6d94('0x40')](handleError(_0x22b256,null));};exports[_0x6d94('0x20')]=function(_0x29819e,_0x4ad94d){return db['DeskConfiguration'][_0x6d94('0x44')]({'where':{'id':_0x29819e['params']['id']}})[_0x6d94('0x1f')](handleEntityNotFound(_0x4ad94d,null))[_0x6d94('0x1f')](removeEntity(_0x4ad94d,null))[_0x6d94('0x40')](handleError(_0x4ad94d,null));};exports[_0x6d94('0x45')]=function(_0x5c61cc,_0x20760b,_0x2c242f){var _0x110b25={};var _0x409926={};var _0x2aebc7;var _0x5648f3;return db[_0x6d94('0x28')][_0x6d94('0x46')]({'where':{'id':_0x5c61cc['params']['id']}})[_0x6d94('0x1f')](handleEntityNotFound(_0x20760b,null))[_0x6d94('0x1f')](function(_0x1c6f7f){if(_0x1c6f7f){_0x2aebc7=_0x1c6f7f;_0x409926[_0x6d94('0x2e')]=_[_0x6d94('0x2b')](db[_0x6d94('0x47')][_0x6d94('0x29')]);_0x409926[_0x6d94('0x2c')]=_[_0x6d94('0x2b')](_0x5c61cc[_0x6d94('0x2c')]);_0x409926['filters']=_['intersection'](_0x409926['model'],_0x409926[_0x6d94('0x2c')]);_0x110b25['attributes']=_[_0x6d94('0x2d')](_0x409926[_0x6d94('0x2e')],qs[_0x6d94('0x2f')](_0x5c61cc[_0x6d94('0x2c')][_0x6d94('0x2f')]));_0x110b25[_0x6d94('0x30')]=_0x110b25[_0x6d94('0x30')][_0x6d94('0x31')]?_0x110b25[_0x6d94('0x30')]:_0x409926[_0x6d94('0x2e')];_0x110b25[_0x6d94('0x48')]=qs[_0x6d94('0x33')](_0x5c61cc[_0x6d94('0x2c')][_0x6d94('0x33')]);_0x110b25['where']=qs[_0x6d94('0x35')](_['pick'](_0x5c61cc[_0x6d94('0x2c')],_0x409926['filters']));if(_0x5c61cc['query'][_0x6d94('0x36')]){_0x110b25[_0x6d94('0x34')]=_[_0x6d94('0x37')](_0x110b25['where'],{'$or':_[_0x6d94('0x27')](_0x110b25[_0x6d94('0x30')],function(_0x4e4557){var _0x5add85={};_0x5add85[_0x4e4557]={'$like':'%'+_0x5c61cc['query'][_0x6d94('0x36')]+'%'};return _0x5add85;})});}_0x110b25=_[_0x6d94('0x37')]({},_0x110b25,_0x5c61cc['options']);return _0x2aebc7[_0x6d94('0x45')](_0x110b25);}})['then'](function(_0x592621){if(_0x592621){_0x5648f3=_0x592621['length'];if(!_0x5c61cc['query'][_0x6d94('0x49')]('nolimit')){_0x110b25[_0x6d94('0x1a')]=qs[_0x6d94('0x1a')](_0x5c61cc[_0x6d94('0x2c')][_0x6d94('0x1a')]);_0x110b25[_0x6d94('0x18')]=qs[_0x6d94('0x18')](_0x5c61cc[_0x6d94('0x2c')][_0x6d94('0x18')]);}return _0x2aebc7[_0x6d94('0x45')](_0x110b25);}})[_0x6d94('0x1f')](function(_0xbf0e91){if(_0xbf0e91){return _0xbf0e91?{'count':_0x5648f3,'rows':_0xbf0e91}:null;}})[_0x6d94('0x1f')](respondWithResult(_0x20760b,null))[_0x6d94('0x40')](handleError(_0x20760b,null));};exports[_0x6d94('0x4a')]=function(_0x5488df,_0x147fe4,_0x44ca08){var _0x5140d8={};var _0x1766c8={};var _0x64b371;var _0x43b889;return db[_0x6d94('0x28')][_0x6d94('0x46')]({'where':{'id':_0x5488df[_0x6d94('0x3e')]['id']}})[_0x6d94('0x1f')](handleEntityNotFound(_0x147fe4,null))['then'](function(_0x299217){if(_0x299217){_0x64b371=_0x299217;_0x1766c8[_0x6d94('0x2e')]=_['keys'](db[_0x6d94('0x47')][_0x6d94('0x29')]);_0x1766c8[_0x6d94('0x2c')]=_[_0x6d94('0x2b')](_0x5488df[_0x6d94('0x2c')]);_0x1766c8[_0x6d94('0x35')]=_[_0x6d94('0x2d')](_0x1766c8['model'],_0x1766c8[_0x6d94('0x2c')]);_0x5140d8[_0x6d94('0x30')]=_[_0x6d94('0x2d')](_0x1766c8[_0x6d94('0x2e')],qs['fields'](_0x5488df[_0x6d94('0x2c')][_0x6d94('0x2f')]));_0x5140d8['attributes']=_0x5140d8[_0x6d94('0x30')]['length']?_0x5140d8['attributes']:_0x1766c8[_0x6d94('0x2e')];_0x5140d8['order']=qs[_0x6d94('0x33')](_0x5488df['query'][_0x6d94('0x33')]);_0x5140d8[_0x6d94('0x34')]=qs[_0x6d94('0x35')](_['pick'](_0x5488df['query'],_0x1766c8[_0x6d94('0x35')]));if(_0x5488df[_0x6d94('0x2c')][_0x6d94('0x36')]){_0x5140d8[_0x6d94('0x34')]=_['merge'](_0x5140d8[_0x6d94('0x34')],{'$or':_[_0x6d94('0x27')](_0x5140d8[_0x6d94('0x30')],function(_0x50acb5){var _0x370c7d={};_0x370c7d[_0x50acb5]={'$like':'%'+_0x5488df[_0x6d94('0x2c')][_0x6d94('0x36')]+'%'};return _0x370c7d;})});}_0x5140d8=_[_0x6d94('0x37')]({},_0x5140d8,_0x5488df[_0x6d94('0x3f')]);return _0x64b371[_0x6d94('0x4a')](_0x5140d8);}})[_0x6d94('0x1f')](function(_0x1b527a){if(_0x1b527a){_0x43b889=_0x1b527a[_0x6d94('0x31')];if(!_0x5488df[_0x6d94('0x2c')][_0x6d94('0x49')](_0x6d94('0x32'))){_0x5140d8[_0x6d94('0x1a')]=qs[_0x6d94('0x1a')](_0x5488df[_0x6d94('0x2c')]['limit']);_0x5140d8[_0x6d94('0x18')]=qs[_0x6d94('0x18')](_0x5488df[_0x6d94('0x2c')][_0x6d94('0x18')]);}return _0x64b371[_0x6d94('0x4a')](_0x5140d8);}})[_0x6d94('0x1f')](function(_0x1cdd36){if(_0x1cdd36){return _0x1cdd36?{'count':_0x43b889,'rows':_0x1cdd36}:null;}})['then'](respondWithResult(_0x147fe4,null))[_0x6d94('0x40')](handleError(_0x147fe4,null));};exports[_0x6d94('0x4b')]=function(_0x253d88,_0x1ac0e2,_0x1673d7){var _0x5736c7={};var _0x4d07b2={};var _0x2c35de;var _0x3bfe3c;return db['DeskConfiguration'][_0x6d94('0x46')]({'where':{'id':_0x253d88['params']['id']}})[_0x6d94('0x1f')](handleEntityNotFound(_0x1ac0e2,null))['then'](function(_0x219c67){if(_0x219c67){_0x2c35de=_0x219c67;_0x4d07b2[_0x6d94('0x2e')]=_[_0x6d94('0x2b')](db[_0x6d94('0x47')][_0x6d94('0x29')]);_0x4d07b2[_0x6d94('0x2c')]=_['keys'](_0x253d88['query']);_0x4d07b2[_0x6d94('0x35')]=_[_0x6d94('0x2d')](_0x4d07b2[_0x6d94('0x2e')],_0x4d07b2[_0x6d94('0x2c')]);_0x5736c7['attributes']=_[_0x6d94('0x2d')](_0x4d07b2[_0x6d94('0x2e')],qs['fields'](_0x253d88[_0x6d94('0x2c')][_0x6d94('0x2f')]));_0x5736c7['attributes']=_0x5736c7['attributes'][_0x6d94('0x31')]?_0x5736c7[_0x6d94('0x30')]:_0x4d07b2[_0x6d94('0x2e')];_0x5736c7[_0x6d94('0x48')]=qs[_0x6d94('0x33')](_0x253d88[_0x6d94('0x2c')]['sort']);_0x5736c7[_0x6d94('0x34')]=qs[_0x6d94('0x35')](_[_0x6d94('0x4c')](_0x253d88[_0x6d94('0x2c')],_0x4d07b2[_0x6d94('0x35')]));if(_0x253d88[_0x6d94('0x2c')][_0x6d94('0x36')]){_0x5736c7[_0x6d94('0x34')]=_['merge'](_0x5736c7[_0x6d94('0x34')],{'$or':_['map'](_0x5736c7[_0x6d94('0x30')],function(_0x920338){var _0x322304={};_0x322304[_0x920338]={'$like':'%'+_0x253d88[_0x6d94('0x2c')]['filter']+'%'};return _0x322304;})});}_0x5736c7=_[_0x6d94('0x37')]({},_0x5736c7,_0x253d88[_0x6d94('0x3f')]);return _0x2c35de[_0x6d94('0x4b')](_0x5736c7);}})[_0x6d94('0x1f')](function(_0x1b9015){if(_0x1b9015){_0x3bfe3c=_0x1b9015[_0x6d94('0x31')];if(!_0x253d88[_0x6d94('0x2c')]['hasOwnProperty']('nolimit')){_0x5736c7[_0x6d94('0x1a')]=qs[_0x6d94('0x1a')](_0x253d88[_0x6d94('0x2c')][_0x6d94('0x1a')]);_0x5736c7['offset']=qs[_0x6d94('0x18')](_0x253d88[_0x6d94('0x2c')][_0x6d94('0x18')]);}return _0x2c35de[_0x6d94('0x4b')](_0x5736c7);}})[_0x6d94('0x1f')](function(_0x32fd55){if(_0x32fd55){return _0x32fd55?{'count':_0x3bfe3c,'rows':_0x32fd55}:null;}})['then'](respondWithResult(_0x1ac0e2,null))['catch'](handleError(_0x1ac0e2,null));};exports[_0x6d94('0x4d')]=function(_0x3c7ca6,_0x44d110,_0x3c2e00){var _0x138a0e={};var _0x55d2cc={};var _0x51da81;var _0x1b74a3;return db['DeskConfiguration']['findOne']({'where':{'id':_0x3c7ca6['params']['id']}})[_0x6d94('0x1f')](handleEntityNotFound(_0x44d110,null))[_0x6d94('0x1f')](function(_0x1cd78b){if(_0x1cd78b){_0x51da81=_0x1cd78b;_0x55d2cc['model']=_[_0x6d94('0x2b')](db['Tag']['rawAttributes']);_0x55d2cc[_0x6d94('0x2c')]=_[_0x6d94('0x2b')](_0x3c7ca6[_0x6d94('0x2c')]);_0x55d2cc['filters']=_['intersection'](_0x55d2cc[_0x6d94('0x2e')],_0x55d2cc[_0x6d94('0x2c')]);_0x138a0e['attributes']=_[_0x6d94('0x2d')](_0x55d2cc['model'],qs[_0x6d94('0x2f')](_0x3c7ca6['query'][_0x6d94('0x2f')]));_0x138a0e['attributes']=_0x138a0e['attributes'][_0x6d94('0x31')]?_0x138a0e[_0x6d94('0x30')]:_0x55d2cc[_0x6d94('0x2e')];_0x138a0e[_0x6d94('0x48')]=qs['sort'](_0x3c7ca6[_0x6d94('0x2c')]['sort']);_0x138a0e['where']=qs[_0x6d94('0x35')](_[_0x6d94('0x4c')](_0x3c7ca6[_0x6d94('0x2c')],_0x55d2cc[_0x6d94('0x35')]));if(_0x3c7ca6[_0x6d94('0x2c')]['filter']){_0x138a0e[_0x6d94('0x34')]=_['merge'](_0x138a0e['where'],{'$or':_[_0x6d94('0x27')](_0x138a0e[_0x6d94('0x30')],function(_0x4d387b){var _0x517895={};_0x517895[_0x4d387b]={'$like':'%'+_0x3c7ca6[_0x6d94('0x2c')][_0x6d94('0x36')]+'%'};return _0x517895;})});}_0x138a0e=_[_0x6d94('0x37')]({},_0x138a0e,_0x3c7ca6[_0x6d94('0x3f')]);return _0x51da81['getTags'](_0x138a0e);}})[_0x6d94('0x1f')](function(_0x11158a){if(_0x11158a){_0x1b74a3=_0x11158a[_0x6d94('0x31')];if(!_0x3c7ca6[_0x6d94('0x2c')][_0x6d94('0x49')](_0x6d94('0x32'))){_0x138a0e['limit']=qs[_0x6d94('0x1a')](_0x3c7ca6[_0x6d94('0x2c')]['limit']);_0x138a0e[_0x6d94('0x18')]=qs[_0x6d94('0x18')](_0x3c7ca6['query'][_0x6d94('0x18')]);}return _0x51da81[_0x6d94('0x4d')](_0x138a0e);}})['then'](function(_0x43a785){if(_0x43a785){return _0x43a785?{'count':_0x1b74a3,'rows':_0x43a785}:null;}})[_0x6d94('0x1f')](respondWithResult(_0x44d110,null))[_0x6d94('0x40')](handleError(_0x44d110,null));};exports['setTags']=function(_0x3483f1,_0x5090f5,_0xc895e8){if(_0x3483f1[_0x6d94('0x42')]['id']){delete _0x3483f1[_0x6d94('0x42')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x3483f1[_0x6d94('0x3e')]['id']}})[_0x6d94('0x1f')](handleEntityNotFound(_0x5090f5,null))['then'](function(_0x2989cc){if(_0x2989cc){return _0x2989cc['setTags'](_0x3483f1['body'][_0x6d94('0x4e')]||[]);}return null;})[_0x6d94('0x1f')](respondWithResult(_0x5090f5,null))[_0x6d94('0x40')](handleError(_0x5090f5,null));}; \ No newline at end of file +var _0x7c84=['keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','DeskConfiguration','includeAll','include','findAll','rows','catch','find','create','body','getFields','findOne','params','DeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','reject','save','update','then','destroy','status','error','send','rawAttributes','type','key','model','map','name'];(function(_0x55e32d,_0x2164d9){var _0x183313=function(_0x33ee7f){while(--_0x33ee7f){_0x55e32d['push'](_0x55e32d['shift']());}};_0x183313(++_0x2164d9);}(_0x7c84,0x1aa));var _0x47c8=function(_0xe4a4ae,_0x3b960b){_0xe4a4ae=_0xe4a4ae-0x0;var _0x4aa22c=_0x7c84[_0xe4a4ae];return _0x4aa22c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x47c8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47c8('0x1'));var rp=require(_0x47c8('0x2'));var moment=require(_0x47c8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x47c8('0x4'));var path=require(_0x47c8('0x5'));var sox=require(_0x47c8('0x6'));var csv=require(_0x47c8('0x7'));var ejs=require(_0x47c8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x47c8('0x9'));var squel=require('squel');var crypto=require(_0x47c8('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x47c8('0x7'));var querystring=require(_0x47c8('0xb'));var Papa=require(_0x47c8('0xc'));var Redis=require(_0x47c8('0xd'));var authService=require(_0x47c8('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x47c8('0xf'));var logger=require(_0x47c8('0x10'))(_0x47c8('0x11'));var utils=require('../../config/utils');var config=require(_0x47c8('0x12'));var licenseUtil=require(_0x47c8('0x13'));var db=require(_0x47c8('0x14'))['db'];function respondWithStatusCode(_0x145869,_0x1a5400){_0x1a5400=_0x1a5400||0xcc;return function(_0x40d3c3){if(_0x40d3c3){return _0x145869[_0x47c8('0x15')](_0x1a5400);}return _0x145869['status'](_0x1a5400)[_0x47c8('0x16')]();};}function respondWithResult(_0x21450a,_0x399e00){_0x399e00=_0x399e00||0xc8;return function(_0x3456bd){if(_0x3456bd){return _0x21450a['status'](_0x399e00)[_0x47c8('0x17')](_0x3456bd);}};}function respondWithFilteredResult(_0x569fb2,_0x7d70dd){return function(_0x4f7c9e){if(_0x4f7c9e){var _0x30119b=typeof _0x7d70dd[_0x47c8('0x18')]===_0x47c8('0x19')&&typeof _0x7d70dd[_0x47c8('0x1a')]===_0x47c8('0x19');var _0x53a06d=_0x4f7c9e['count'];var _0x146cb6=_0x30119b?0x0:_0x7d70dd[_0x47c8('0x18')];var _0x23ab04=_0x30119b?_0x4f7c9e[_0x47c8('0x1b')]:_0x7d70dd[_0x47c8('0x18')]+_0x7d70dd[_0x47c8('0x1a')];var _0xaaca56;if(_0x23ab04>=_0x53a06d){_0x23ab04=_0x53a06d;_0xaaca56=0xc8;}else{_0xaaca56=0xce;}_0x569fb2['status'](_0xaaca56);return _0x569fb2['set']('Content-Range',_0x146cb6+'-'+_0x23ab04+'/'+_0x53a06d)['json'](_0x4f7c9e);}return null;};}function patchUpdates(_0x551b59){return function(_0x3754f6){try{jsonpatch['apply'](_0x3754f6,_0x551b59,!![]);}catch(_0x7c2291){return BPromise[_0x47c8('0x1c')](_0x7c2291);}return _0x3754f6[_0x47c8('0x1d')]();};}function saveUpdates(_0x365122,_0x4601af){return function(_0x51caed){if(_0x51caed){return _0x51caed[_0x47c8('0x1e')](_0x365122)[_0x47c8('0x1f')](function(_0x7199d6){return _0x7199d6;});}return null;};}function removeEntity(_0x2c7073,_0x255e7c){return function(_0x1fe88d){if(_0x1fe88d){return _0x1fe88d[_0x47c8('0x20')]()[_0x47c8('0x1f')](function(){_0x2c7073[_0x47c8('0x21')](0xcc)[_0x47c8('0x16')]();});}};}function handleEntityNotFound(_0x5961ea,_0x439f55){return function(_0xe4a1db){if(!_0xe4a1db){_0x5961ea['sendStatus'](0x194);}return _0xe4a1db;};}function handleError(_0x47f0fa,_0x45f57c){_0x45f57c=_0x45f57c||0x1f4;return function(_0x56504e){logger[_0x47c8('0x22')](_0x56504e['stack']);if(_0x56504e['name']){delete _0x56504e['name'];}_0x47f0fa[_0x47c8('0x21')](_0x45f57c)[_0x47c8('0x23')](_0x56504e);};}exports['index']=function(_0x5fe772,_0xf9c583){var _0x4acbf5={},_0xb05664={},_0x33e116={'count':0x0,'rows':[]};var _0x57c32a=_['map'](db['DeskConfiguration'][_0x47c8('0x24')],function(_0x2245ff){return{'name':_0x2245ff['fieldName'],'type':_0x2245ff[_0x47c8('0x25')][_0x47c8('0x26')]};});_0xb05664[_0x47c8('0x27')]=_[_0x47c8('0x28')](_0x57c32a,_0x47c8('0x29'));_0xb05664['query']=_[_0x47c8('0x2a')](_0x5fe772[_0x47c8('0x2b')]);_0xb05664[_0x47c8('0x2c')]=_[_0x47c8('0x2d')](_0xb05664[_0x47c8('0x27')],_0xb05664[_0x47c8('0x2b')]);_0x4acbf5[_0x47c8('0x2e')]=_[_0x47c8('0x2d')](_0xb05664['model'],qs['fields'](_0x5fe772[_0x47c8('0x2b')][_0x47c8('0x2f')]));_0x4acbf5[_0x47c8('0x2e')]=_0x4acbf5[_0x47c8('0x2e')][_0x47c8('0x30')]?_0x4acbf5[_0x47c8('0x2e')]:_0xb05664['model'];if(!_0x5fe772['query'][_0x47c8('0x31')](_0x47c8('0x32'))){_0x4acbf5[_0x47c8('0x1a')]=qs[_0x47c8('0x1a')](_0x5fe772[_0x47c8('0x2b')][_0x47c8('0x1a')]);_0x4acbf5[_0x47c8('0x18')]=qs[_0x47c8('0x18')](_0x5fe772['query']['offset']);}_0x4acbf5['order']=qs[_0x47c8('0x33')](_0x5fe772[_0x47c8('0x2b')][_0x47c8('0x33')]);_0x4acbf5[_0x47c8('0x34')]=qs[_0x47c8('0x2c')](_[_0x47c8('0x35')](_0x5fe772[_0x47c8('0x2b')],_0xb05664[_0x47c8('0x2c')]),_0x57c32a);if(_0x5fe772[_0x47c8('0x2b')][_0x47c8('0x36')]){_0x4acbf5[_0x47c8('0x34')]=_[_0x47c8('0x37')](_0x4acbf5[_0x47c8('0x34')],{'$or':_[_0x47c8('0x28')](_0x57c32a,function(_0x39446c){if(_0x39446c[_0x47c8('0x25')]!==_0x47c8('0x38')){var _0x3eceaf={};_0x3eceaf[_0x39446c['name']]={'$like':'%'+_0x5fe772[_0x47c8('0x2b')]['filter']+'%'};return _0x3eceaf;}})});}_0x4acbf5=_[_0x47c8('0x37')]({},_0x4acbf5,_0x5fe772[_0x47c8('0x39')]);var _0x480f4f={'where':_0x4acbf5[_0x47c8('0x34')]};return db[_0x47c8('0x3a')][_0x47c8('0x1b')](_0x480f4f)[_0x47c8('0x1f')](function(_0x2efeba){_0x33e116[_0x47c8('0x1b')]=_0x2efeba;if(_0x5fe772[_0x47c8('0x2b')][_0x47c8('0x3b')]){_0x4acbf5[_0x47c8('0x3c')]=[{'all':!![]}];}return db[_0x47c8('0x3a')][_0x47c8('0x3d')](_0x4acbf5);})[_0x47c8('0x1f')](function(_0x214812){_0x33e116[_0x47c8('0x3e')]=_0x214812;return _0x33e116;})[_0x47c8('0x1f')](respondWithFilteredResult(_0xf9c583,_0x4acbf5))[_0x47c8('0x3f')](handleError(_0xf9c583,null));};exports['show']=function(_0x4cd316,_0x3359ed){var _0x49e4a6={'raw':![],'where':{'id':_0x4cd316['params']['id']}},_0x10436a={};_0x10436a[_0x47c8('0x27')]=_[_0x47c8('0x2a')](db[_0x47c8('0x3a')][_0x47c8('0x24')]);_0x10436a[_0x47c8('0x2b')]=_[_0x47c8('0x2a')](_0x4cd316[_0x47c8('0x2b')]);_0x10436a['filters']=_['intersection'](_0x10436a[_0x47c8('0x27')],_0x10436a['query']);_0x49e4a6[_0x47c8('0x2e')]=_[_0x47c8('0x2d')](_0x10436a[_0x47c8('0x27')],qs['fields'](_0x4cd316[_0x47c8('0x2b')][_0x47c8('0x2f')]));_0x49e4a6[_0x47c8('0x2e')]=_0x49e4a6[_0x47c8('0x2e')]['length']?_0x49e4a6[_0x47c8('0x2e')]:_0x10436a['model'];if(_0x4cd316[_0x47c8('0x2b')][_0x47c8('0x3b')]){_0x49e4a6[_0x47c8('0x3c')]=[{'all':!![]}];}_0x49e4a6=_[_0x47c8('0x37')]({},_0x49e4a6,_0x4cd316[_0x47c8('0x39')]);return db['DeskConfiguration'][_0x47c8('0x40')](_0x49e4a6)[_0x47c8('0x1f')](handleEntityNotFound(_0x3359ed,null))[_0x47c8('0x1f')](respondWithResult(_0x3359ed,null))['catch'](handleError(_0x3359ed,null));};exports[_0x47c8('0x41')]=function(_0x248e48,_0x59ee96){return db['DeskConfiguration'][_0x47c8('0x41')](_0x248e48[_0x47c8('0x42')],{})[_0x47c8('0x1f')](respondWithResult(_0x59ee96,0xc9))[_0x47c8('0x3f')](handleError(_0x59ee96,null));};exports[_0x47c8('0x1e')]=function(_0x5c882b,_0x377d3b){if(_0x5c882b[_0x47c8('0x42')]['id']){delete _0x5c882b[_0x47c8('0x42')]['id'];}return db[_0x47c8('0x3a')][_0x47c8('0x40')]({'where':{'id':_0x5c882b['params']['id']}})[_0x47c8('0x1f')](handleEntityNotFound(_0x377d3b,null))[_0x47c8('0x1f')](saveUpdates(_0x5c882b[_0x47c8('0x42')],null))[_0x47c8('0x1f')](respondWithResult(_0x377d3b,null))[_0x47c8('0x3f')](handleError(_0x377d3b,null));};exports['destroy']=function(_0x5eadfa,_0x14c0b9){return db[_0x47c8('0x3a')][_0x47c8('0x40')]({'where':{'id':_0x5eadfa['params']['id']}})[_0x47c8('0x1f')](handleEntityNotFound(_0x14c0b9,null))[_0x47c8('0x1f')](removeEntity(_0x14c0b9,null))['catch'](handleError(_0x14c0b9,null));};exports[_0x47c8('0x43')]=function(_0x541a58,_0x2ea7d9,_0xc90624){var _0x228fe8={};var _0x4fea75={};var _0x3fa35e;var _0x3c09bf;return db['DeskConfiguration'][_0x47c8('0x44')]({'where':{'id':_0x541a58[_0x47c8('0x45')]['id']}})[_0x47c8('0x1f')](handleEntityNotFound(_0x2ea7d9,null))[_0x47c8('0x1f')](function(_0xa3a5c4){if(_0xa3a5c4){_0x3fa35e=_0xa3a5c4;_0x4fea75['model']=_[_0x47c8('0x2a')](db[_0x47c8('0x46')][_0x47c8('0x24')]);_0x4fea75['query']=_['keys'](_0x541a58['query']);_0x4fea75[_0x47c8('0x2c')]=_[_0x47c8('0x2d')](_0x4fea75[_0x47c8('0x27')],_0x4fea75[_0x47c8('0x2b')]);_0x228fe8[_0x47c8('0x2e')]=_[_0x47c8('0x2d')](_0x4fea75[_0x47c8('0x27')],qs['fields'](_0x541a58[_0x47c8('0x2b')]['fields']));_0x228fe8[_0x47c8('0x2e')]=_0x228fe8[_0x47c8('0x2e')][_0x47c8('0x30')]?_0x228fe8['attributes']:_0x4fea75[_0x47c8('0x27')];_0x228fe8[_0x47c8('0x47')]=qs[_0x47c8('0x33')](_0x541a58[_0x47c8('0x2b')][_0x47c8('0x33')]);_0x228fe8[_0x47c8('0x34')]=qs[_0x47c8('0x2c')](_[_0x47c8('0x35')](_0x541a58[_0x47c8('0x2b')],_0x4fea75['filters']));if(_0x541a58[_0x47c8('0x2b')][_0x47c8('0x36')]){_0x228fe8[_0x47c8('0x34')]=_[_0x47c8('0x37')](_0x228fe8[_0x47c8('0x34')],{'$or':_[_0x47c8('0x28')](_0x228fe8[_0x47c8('0x2e')],function(_0xd2e670){var _0x25cba4={};_0x25cba4[_0xd2e670]={'$like':'%'+_0x541a58[_0x47c8('0x2b')][_0x47c8('0x36')]+'%'};return _0x25cba4;})});}_0x228fe8=_['merge']({},_0x228fe8,_0x541a58[_0x47c8('0x39')]);return _0x3fa35e[_0x47c8('0x43')](_0x228fe8);}})[_0x47c8('0x1f')](function(_0x2c0adc){if(_0x2c0adc){_0x3c09bf=_0x2c0adc[_0x47c8('0x30')];if(!_0x541a58['query'][_0x47c8('0x31')](_0x47c8('0x32'))){_0x228fe8['limit']=qs[_0x47c8('0x1a')](_0x541a58['query'][_0x47c8('0x1a')]);_0x228fe8[_0x47c8('0x18')]=qs[_0x47c8('0x18')](_0x541a58[_0x47c8('0x2b')][_0x47c8('0x18')]);}return _0x3fa35e['getFields'](_0x228fe8);}})[_0x47c8('0x1f')](function(_0x24ab03){if(_0x24ab03){return _0x24ab03?{'count':_0x3c09bf,'rows':_0x24ab03}:null;}})[_0x47c8('0x1f')](respondWithResult(_0x2ea7d9,null))[_0x47c8('0x3f')](handleError(_0x2ea7d9,null));};exports[_0x47c8('0x48')]=function(_0x57aab3,_0x4d3664,_0x18e4c8){var _0x117b9b={};var _0x4276a4={};var _0x5700ab;var _0x260e3b;return db[_0x47c8('0x3a')]['findOne']({'where':{'id':_0x57aab3[_0x47c8('0x45')]['id']}})['then'](handleEntityNotFound(_0x4d3664,null))[_0x47c8('0x1f')](function(_0x151740){if(_0x151740){_0x5700ab=_0x151740;_0x4276a4[_0x47c8('0x27')]=_[_0x47c8('0x2a')](db[_0x47c8('0x46')][_0x47c8('0x24')]);_0x4276a4['query']=_[_0x47c8('0x2a')](_0x57aab3['query']);_0x4276a4['filters']=_[_0x47c8('0x2d')](_0x4276a4[_0x47c8('0x27')],_0x4276a4[_0x47c8('0x2b')]);_0x117b9b['attributes']=_['intersection'](_0x4276a4[_0x47c8('0x27')],qs[_0x47c8('0x2f')](_0x57aab3[_0x47c8('0x2b')][_0x47c8('0x2f')]));_0x117b9b[_0x47c8('0x2e')]=_0x117b9b['attributes'][_0x47c8('0x30')]?_0x117b9b['attributes']:_0x4276a4[_0x47c8('0x27')];_0x117b9b[_0x47c8('0x47')]=qs['sort'](_0x57aab3[_0x47c8('0x2b')][_0x47c8('0x33')]);_0x117b9b['where']=qs[_0x47c8('0x2c')](_[_0x47c8('0x35')](_0x57aab3[_0x47c8('0x2b')],_0x4276a4[_0x47c8('0x2c')]));if(_0x57aab3['query'][_0x47c8('0x36')]){_0x117b9b['where']=_[_0x47c8('0x37')](_0x117b9b['where'],{'$or':_[_0x47c8('0x28')](_0x117b9b['attributes'],function(_0x152072){var _0x5d5e54={};_0x5d5e54[_0x152072]={'$like':'%'+_0x57aab3[_0x47c8('0x2b')][_0x47c8('0x36')]+'%'};return _0x5d5e54;})});}_0x117b9b=_[_0x47c8('0x37')]({},_0x117b9b,_0x57aab3['options']);return _0x5700ab['getSubjects'](_0x117b9b);}})['then'](function(_0x151043){if(_0x151043){_0x260e3b=_0x151043[_0x47c8('0x30')];if(!_0x57aab3['query'][_0x47c8('0x31')]('nolimit')){_0x117b9b['limit']=qs[_0x47c8('0x1a')](_0x57aab3[_0x47c8('0x2b')][_0x47c8('0x1a')]);_0x117b9b[_0x47c8('0x18')]=qs[_0x47c8('0x18')](_0x57aab3[_0x47c8('0x2b')][_0x47c8('0x18')]);}return _0x5700ab['getSubjects'](_0x117b9b);}})['then'](function(_0x16d831){if(_0x16d831){return _0x16d831?{'count':_0x260e3b,'rows':_0x16d831}:null;}})[_0x47c8('0x1f')](respondWithResult(_0x4d3664,null))[_0x47c8('0x3f')](handleError(_0x4d3664,null));};exports[_0x47c8('0x49')]=function(_0x586b97,_0x596aab,_0x561bd5){var _0x2df343={};var _0x1f3e9e={};var _0x5a6b16;var _0xb15cec;return db[_0x47c8('0x3a')]['findOne']({'where':{'id':_0x586b97[_0x47c8('0x45')]['id']}})[_0x47c8('0x1f')](handleEntityNotFound(_0x596aab,null))[_0x47c8('0x1f')](function(_0x26d4e9){if(_0x26d4e9){_0x5a6b16=_0x26d4e9;_0x1f3e9e[_0x47c8('0x27')]=_[_0x47c8('0x2a')](db[_0x47c8('0x46')][_0x47c8('0x24')]);_0x1f3e9e[_0x47c8('0x2b')]=_['keys'](_0x586b97[_0x47c8('0x2b')]);_0x1f3e9e['filters']=_['intersection'](_0x1f3e9e['model'],_0x1f3e9e[_0x47c8('0x2b')]);_0x2df343['attributes']=_[_0x47c8('0x2d')](_0x1f3e9e[_0x47c8('0x27')],qs['fields'](_0x586b97[_0x47c8('0x2b')][_0x47c8('0x2f')]));_0x2df343[_0x47c8('0x2e')]=_0x2df343[_0x47c8('0x2e')]['length']?_0x2df343['attributes']:_0x1f3e9e[_0x47c8('0x27')];_0x2df343[_0x47c8('0x47')]=qs[_0x47c8('0x33')](_0x586b97[_0x47c8('0x2b')][_0x47c8('0x33')]);_0x2df343[_0x47c8('0x34')]=qs[_0x47c8('0x2c')](_[_0x47c8('0x35')](_0x586b97[_0x47c8('0x2b')],_0x1f3e9e[_0x47c8('0x2c')]));if(_0x586b97[_0x47c8('0x2b')]['filter']){_0x2df343['where']=_[_0x47c8('0x37')](_0x2df343[_0x47c8('0x34')],{'$or':_[_0x47c8('0x28')](_0x2df343[_0x47c8('0x2e')],function(_0x1ee08e){var _0x2ba2d8={};_0x2ba2d8[_0x1ee08e]={'$like':'%'+_0x586b97[_0x47c8('0x2b')][_0x47c8('0x36')]+'%'};return _0x2ba2d8;})});}_0x2df343=_[_0x47c8('0x37')]({},_0x2df343,_0x586b97[_0x47c8('0x39')]);return _0x5a6b16[_0x47c8('0x49')](_0x2df343);}})[_0x47c8('0x1f')](function(_0x4bc299){if(_0x4bc299){_0xb15cec=_0x4bc299[_0x47c8('0x30')];if(!_0x586b97['query']['hasOwnProperty'](_0x47c8('0x32'))){_0x2df343[_0x47c8('0x1a')]=qs[_0x47c8('0x1a')](_0x586b97[_0x47c8('0x2b')]['limit']);_0x2df343[_0x47c8('0x18')]=qs['offset'](_0x586b97['query'][_0x47c8('0x18')]);}return _0x5a6b16['getDescriptions'](_0x2df343);}})[_0x47c8('0x1f')](function(_0x19fb57){if(_0x19fb57){return _0x19fb57?{'count':_0xb15cec,'rows':_0x19fb57}:null;}})['then'](respondWithResult(_0x596aab,null))['catch'](handleError(_0x596aab,null));};exports[_0x47c8('0x4a')]=function(_0x2b686e,_0xa59f95,_0x3ffd13){var _0x4f8639={};var _0x2f82e6={};var _0x32b154;var _0x2f2408;return db[_0x47c8('0x3a')]['findOne']({'where':{'id':_0x2b686e['params']['id']}})[_0x47c8('0x1f')](handleEntityNotFound(_0xa59f95,null))[_0x47c8('0x1f')](function(_0x5570dd){if(_0x5570dd){_0x32b154=_0x5570dd;_0x2f82e6[_0x47c8('0x27')]=_[_0x47c8('0x2a')](db[_0x47c8('0x4b')][_0x47c8('0x24')]);_0x2f82e6[_0x47c8('0x2b')]=_[_0x47c8('0x2a')](_0x2b686e['query']);_0x2f82e6[_0x47c8('0x2c')]=_['intersection'](_0x2f82e6[_0x47c8('0x27')],_0x2f82e6['query']);_0x4f8639[_0x47c8('0x2e')]=_['intersection'](_0x2f82e6[_0x47c8('0x27')],qs[_0x47c8('0x2f')](_0x2b686e[_0x47c8('0x2b')][_0x47c8('0x2f')]));_0x4f8639['attributes']=_0x4f8639[_0x47c8('0x2e')][_0x47c8('0x30')]?_0x4f8639[_0x47c8('0x2e')]:_0x2f82e6[_0x47c8('0x27')];_0x4f8639[_0x47c8('0x47')]=qs[_0x47c8('0x33')](_0x2b686e[_0x47c8('0x2b')]['sort']);_0x4f8639['where']=qs[_0x47c8('0x2c')](_[_0x47c8('0x35')](_0x2b686e[_0x47c8('0x2b')],_0x2f82e6[_0x47c8('0x2c')]));if(_0x2b686e[_0x47c8('0x2b')][_0x47c8('0x36')]){_0x4f8639['where']=_[_0x47c8('0x37')](_0x4f8639[_0x47c8('0x34')],{'$or':_['map'](_0x4f8639[_0x47c8('0x2e')],function(_0x5819ad){var _0x48f91b={};_0x48f91b[_0x5819ad]={'$like':'%'+_0x2b686e[_0x47c8('0x2b')][_0x47c8('0x36')]+'%'};return _0x48f91b;})});}_0x4f8639=_['merge']({},_0x4f8639,_0x2b686e[_0x47c8('0x39')]);return _0x32b154[_0x47c8('0x4a')](_0x4f8639);}})[_0x47c8('0x1f')](function(_0x436eaf){if(_0x436eaf){_0x2f2408=_0x436eaf[_0x47c8('0x30')];if(!_0x2b686e['query'][_0x47c8('0x31')](_0x47c8('0x32'))){_0x4f8639[_0x47c8('0x1a')]=qs[_0x47c8('0x1a')](_0x2b686e[_0x47c8('0x2b')][_0x47c8('0x1a')]);_0x4f8639['offset']=qs[_0x47c8('0x18')](_0x2b686e[_0x47c8('0x2b')][_0x47c8('0x18')]);}return _0x32b154[_0x47c8('0x4a')](_0x4f8639);}})[_0x47c8('0x1f')](function(_0x487d36){if(_0x487d36){return _0x487d36?{'count':_0x2f2408,'rows':_0x487d36}:null;}})[_0x47c8('0x1f')](respondWithResult(_0xa59f95,null))[_0x47c8('0x3f')](handleError(_0xa59f95,null));};exports[_0x47c8('0x4c')]=function(_0x362c2a,_0x2d3046,_0x387934){if(_0x362c2a[_0x47c8('0x42')]['id']){delete _0x362c2a[_0x47c8('0x42')]['id'];}return db[_0x47c8('0x3a')]['findOne']({'where':{'id':_0x362c2a[_0x47c8('0x45')]['id']}})['then'](handleEntityNotFound(_0x2d3046,null))['then'](function(_0xb9f622){if(_0xb9f622){return _0xb9f622[_0x47c8('0x4c')](_0x362c2a['body'][_0x47c8('0x4d')]||[]);}return null;})[_0x47c8('0x1f')](respondWithResult(_0x2d3046,null))[_0x47c8('0x3f')](handleError(_0x2d3046,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 3d7aff6..ee81cda 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 _0xf330=['rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','bluebird','request-promise'];(function(_0x41623c,_0x4defb2){var _0x157c65=function(_0x4244b2){while(--_0x4244b2){_0x41623c['push'](_0x41623c['shift']());}};_0x157c65(++_0x4defb2);}(_0xf330,0x146));var _0x0f33=function(_0x328a0e,_0x1d814c){_0x328a0e=_0x328a0e-0x0;var _0x310954=_0xf330[_0x328a0e];return _0x310954;};'use strict';var _=require(_0x0f33('0x0'));var util=require('util');var logger=require(_0x0f33('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0f33('0x2'));var rp=require(_0x0f33('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f33('0x4'));var config=require('../../config/environment');var attributes=require(_0x0f33('0x5'));module[_0x0f33('0x6')]=function(_0x5cfe0b,_0x4774af){return _0x5cfe0b[_0x0f33('0x7')](_0x0f33('0x8'),attributes,{'tableName':_0x0f33('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d6b=['../../config/environment','./intDeskConfiguration.attributes','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x8d6b,0x124));var _0xb8d6=function(_0xc67a64,_0x5edc72){_0xc67a64=_0xc67a64-0x0;var _0xe4e1d2=_0x8d6b[_0xc67a64];return _0xe4e1d2;};'use strict';var _=require(_0xb8d6('0x0'));var util=require(_0xb8d6('0x1'));var logger=require(_0xb8d6('0x2'))(_0xb8d6('0x3'));var moment=require(_0xb8d6('0x4'));var BPromise=require('bluebird');var rp=require(_0xb8d6('0x5'));var fs=require('fs');var path=require(_0xb8d6('0x6'));var rimraf=require(_0xb8d6('0x7'));var config=require(_0xb8d6('0x8'));var attributes=require(_0xb8d6('0x9'));module['exports']=function(_0x2a40a2,_0x1b38fa){return _0x2a40a2['define'](_0xb8d6('0xa'),attributes,{'tableName':_0xb8d6('0xb'),'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 8b9ce38..1e0fa7b 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 _0x258c=['message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x5309d5,_0x50b54c){var _0x3c5fc=function(_0x45e48){while(--_0x45e48){_0x5309d5['push'](_0x5309d5['shift']());}};_0x3c5fc(++_0x50b54c);}(_0x258c,0x168));var _0xc258=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x258c[_0x49b207];return _0x2dc8fa;};'use strict';var _=require('lodash');var util=require(_0xc258('0x0'));var moment=require('moment');var BPromise=require(_0xc258('0x1'));var rs=require(_0xc258('0x2'));var fs=require('fs');var Redis=require(_0xc258('0x3'));var db=require(_0xc258('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc258('0x5'))(_0xc258('0x6'));var config=require(_0xc258('0x7'));var jayson=require(_0xc258('0x8'));var client=jayson['client'][_0xc258('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcfa4e4,_0x562556,_0x31411f){return new BPromise(function(_0x318c7a,_0x77f721){return client[_0xc258('0xa')](_0xcfa4e4,_0x31411f)[_0xc258('0xb')](function(_0x194b88){logger[_0xc258('0xc')](_0xc258('0xd'),_0x562556,_0xc258('0xe'));logger[_0xc258('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x562556,_0xc258('0xe'),JSON['stringify'](_0x194b88));if(_0x194b88[_0xc258('0x10')]){if(_0x194b88[_0xc258('0x10')][_0xc258('0x11')]===0x1f4){logger['error'](_0xc258('0xd'),_0x562556,_0x194b88[_0xc258('0x10')][_0xc258('0x12')]);return _0x77f721(_0x194b88[_0xc258('0x10')][_0xc258('0x12')]);}logger[_0xc258('0x10')](_0xc258('0xd'),_0x562556,_0x194b88[_0xc258('0x10')][_0xc258('0x12')]);return _0x318c7a(_0x194b88[_0xc258('0x10')][_0xc258('0x12')]);}else{logger[_0xc258('0xc')](_0xc258('0xd'),_0x562556,_0xc258('0xe'));_0x318c7a(_0x194b88[_0xc258('0x13')][_0xc258('0x12')]);}})[_0xc258('0x14')](function(_0x35b7b2){logger[_0xc258('0x10')](_0xc258('0xd'),_0x562556,_0x35b7b2);_0x77f721(_0x35b7b2);});});} \ No newline at end of file +var _0x00f4=['http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x00f4,0x137));var _0x400f=function(_0x576737,_0x25aa7f){_0x576737=_0x576737-0x0;var _0x4995eb=_0x00f4[_0x576737];return _0x4995eb;};'use strict';var _=require(_0x400f('0x0'));var util=require('util');var moment=require(_0x400f('0x1'));var BPromise=require(_0x400f('0x2'));var rs=require(_0x400f('0x3'));var fs=require('fs');var Redis=require(_0x400f('0x4'));var db=require(_0x400f('0x5'))['db'];var utils=require(_0x400f('0x6'));var logger=require(_0x400f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x400f('0x8'));var client=jayson['client'][_0x400f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x360f0e,_0x2efbc4,_0x1b9b4f){return new BPromise(function(_0x32a24e,_0x3e2cfb){return client[_0x400f('0xa')](_0x360f0e,_0x1b9b4f)['then'](function(_0x4c4174){logger[_0x400f('0xb')](_0x400f('0xc'),_0x2efbc4,_0x400f('0xd'));logger['debug'](_0x400f('0xe'),_0x2efbc4,_0x400f('0xd'),JSON['stringify'](_0x4c4174));if(_0x4c4174[_0x400f('0xf')]){if(_0x4c4174['error'][_0x400f('0x10')]===0x1f4){logger[_0x400f('0xf')](_0x400f('0xc'),_0x2efbc4,_0x4c4174[_0x400f('0xf')]['message']);return _0x3e2cfb(_0x4c4174['error']['message']);}logger[_0x400f('0xf')](_0x400f('0xc'),_0x2efbc4,_0x4c4174[_0x400f('0xf')][_0x400f('0x11')]);return _0x32a24e(_0x4c4174['error'][_0x400f('0x11')]);}else{logger[_0x400f('0xb')](_0x400f('0xc'),_0x2efbc4,_0x400f('0xd'));_0x32a24e(_0x4c4174[_0x400f('0x12')]['message']);}})[_0x400f('0x13')](function(_0x133f24){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x2efbc4,_0x133f24);_0x3e2cfb(_0x133f24);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index ab85275..5fd2002 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 _0x8cc2=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8cc2,0x1d8));var _0x28cc=function(_0xb7636f,_0x193a8c){_0xb7636f=_0xb7636f-0x0;var _0x1d5d3a=_0x8cc2[_0xb7636f];return _0x1d5d3a;};'use strict';var multer=require(_0x28cc('0x0'));var util=require(_0x28cc('0x1'));var path=require(_0x28cc('0x2'));var timeout=require(_0x28cc('0x3'));var express=require(_0x28cc('0x4'));var router=express[_0x28cc('0x5')]();var fs_extra=require(_0x28cc('0x6'));var auth=require(_0x28cc('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x28cc('0x8'));var controller=require('./intDeskField.controller');router[_0x28cc('0x9')]('/',auth[_0x28cc('0xa')](),controller[_0x28cc('0xb')]);router[_0x28cc('0x9')](_0x28cc('0xc'),auth[_0x28cc('0xa')](),controller[_0x28cc('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x28cc('0xe')]('/:id',auth[_0x28cc('0xa')](),controller[_0x28cc('0xf')]);router[_0x28cc('0x10')]('/:id',auth[_0x28cc('0xa')](),controller[_0x28cc('0x11')]);module[_0x28cc('0x12')]=router; \ No newline at end of file +var _0xb506=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer','connect-timeout'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb506,0x10c));var _0x6b50=function(_0x228a72,_0x486368){_0x228a72=_0x228a72-0x0;var _0x44c0d1=_0xb506[_0x228a72];return _0x44c0d1;};'use strict';var multer=require(_0x6b50('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6b50('0x1'));var express=require(_0x6b50('0x2'));var router=express[_0x6b50('0x3')]();var fs_extra=require(_0x6b50('0x4'));var auth=require(_0x6b50('0x5'));var interaction=require(_0x6b50('0x6'));var config=require('../../config/environment');var controller=require(_0x6b50('0x7'));router['get']('/',auth[_0x6b50('0x8')](),controller[_0x6b50('0x9')]);router[_0x6b50('0xa')](_0x6b50('0xb'),auth['isAuthenticated'](),controller[_0x6b50('0xc')]);router[_0x6b50('0xd')]('/',auth[_0x6b50('0x8')](),controller[_0x6b50('0xe')]);router['put'](_0x6b50('0xb'),auth[_0x6b50('0x8')](),controller['update']);router[_0x6b50('0xf')](_0x6b50('0xb'),auth['isAuthenticated'](),controller[_0x6b50('0x10')]);module[_0x6b50('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 18d3b8f..fdbfa7a 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 _0x73c7=['variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x73c7,0xf8));var _0x773c=function(_0x5aa9da,_0x53b030){_0x5aa9da=_0x5aa9da-0x0;var _0x584a79=_0x73c7[_0x5aa9da];return _0x584a79;};'use strict';var Sequelize=require(_0x773c('0x0'));module[_0x773c('0x1')]={'type':{'type':Sequelize[_0x773c('0x2')](_0x773c('0x3'),_0x773c('0x4'),_0x773c('0x5'),_0x773c('0x6'),_0x773c('0x7')),'defaultValue':_0x773c('0x3')},'content':{'type':Sequelize[_0x773c('0x8')]},'key':{'type':Sequelize[_0x773c('0x8')]},'keyType':{'type':Sequelize[_0x773c('0x2')](_0x773c('0x3'),_0x773c('0x4'),_0x773c('0x5'))},'keyContent':{'type':Sequelize[_0x773c('0x8')]},'idField':{'type':Sequelize[_0x773c('0x8')]},'nameField':{'type':Sequelize[_0x773c('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x82d5=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x37b7a5,_0x5deea0){var _0x3e68d5=function(_0x50af6b){while(--_0x50af6b){_0x37b7a5['push'](_0x37b7a5['shift']());}};_0x3e68d5(++_0x5deea0);}(_0x82d5,0x144));var _0x582d=function(_0x282442,_0x185644){_0x282442=_0x282442-0x0;var _0x244748=_0x82d5[_0x282442];return _0x244748;};'use strict';var Sequelize=require(_0x582d('0x0'));module[_0x582d('0x1')]={'type':{'type':Sequelize[_0x582d('0x2')](_0x582d('0x3'),_0x582d('0x4'),_0x582d('0x5'),_0x582d('0x6'),_0x582d('0x7')),'defaultValue':_0x582d('0x3')},'content':{'type':Sequelize[_0x582d('0x8')]},'key':{'type':Sequelize[_0x582d('0x8')]},'keyType':{'type':Sequelize[_0x582d('0x2')](_0x582d('0x3'),_0x582d('0x4'),_0x582d('0x5'))},'keyContent':{'type':Sequelize[_0x582d('0x8')]},'idField':{'type':Sequelize[_0x582d('0x8')]},'nameField':{'type':Sequelize[_0x582d('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index cba5460..7bc6288 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 _0x8403=['set','apply','save','update','then','error','stack','name','send','index','DeskField','rawAttributes','fieldName','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','includeAll','include','findAll','catch','params','keys','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','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','sendStatus','end','status','json','offset','undefined','limit','count'];(function(_0x4e84d3,_0x1add05){var _0x1a0df6=function(_0x7c5212){while(--_0x7c5212){_0x4e84d3['push'](_0x4e84d3['shift']());}};_0x1a0df6(++_0x1add05);}(_0x8403,0x1a5));var _0x3840=function(_0x2ffc26,_0x2de4c7){_0x2ffc26=_0x2ffc26-0x0;var _0x44cbb6=_0x8403[_0x2ffc26];return _0x44cbb6;};'use strict';var emlformat=require(_0x3840('0x0'));var rimraf=require(_0x3840('0x1'));var zipdir=require(_0x3840('0x2'));var jsonpatch=require(_0x3840('0x3'));var rp=require(_0x3840('0x4'));var moment=require(_0x3840('0x5'));var BPromise=require(_0x3840('0x6'));var Mustache=require(_0x3840('0x7'));var util=require(_0x3840('0x8'));var path=require('path');var sox=require(_0x3840('0x9'));var csv=require(_0x3840('0xa'));var ejs=require(_0x3840('0xb'));var fs=require('fs');var fs_extra=require(_0x3840('0xc'));var _=require(_0x3840('0xd'));var squel=require(_0x3840('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3840('0xf'));var toCsv=require(_0x3840('0xa'));var querystring=require(_0x3840('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3840('0x11'));var qs=require(_0x3840('0x12'));var as=require(_0x3840('0x13'));var hardwareService=require(_0x3840('0x14'));var logger=require(_0x3840('0x15'))(_0x3840('0x16'));var utils=require(_0x3840('0x17'));var config=require(_0x3840('0x18'));var licenseUtil=require(_0x3840('0x19'));var db=require(_0x3840('0x1a'))['db'];function respondWithStatusCode(_0x4afef9,_0x1204a6){_0x1204a6=_0x1204a6||0xcc;return function(_0x469bf3){if(_0x469bf3){return _0x4afef9[_0x3840('0x1b')](_0x1204a6);}return _0x4afef9['status'](_0x1204a6)[_0x3840('0x1c')]();};}function respondWithResult(_0x251fce,_0x570c98){_0x570c98=_0x570c98||0xc8;return function(_0x178a30){if(_0x178a30){return _0x251fce[_0x3840('0x1d')](_0x570c98)[_0x3840('0x1e')](_0x178a30);}};}function respondWithFilteredResult(_0x1f3b02,_0x2cf194){return function(_0x443380){if(_0x443380){var _0x1d74b2=typeof _0x2cf194[_0x3840('0x1f')]===_0x3840('0x20')&&typeof _0x2cf194[_0x3840('0x21')]===_0x3840('0x20');var _0x58d2d8=_0x443380['count'];var _0x3bc1be=_0x1d74b2?0x0:_0x2cf194['offset'];var _0x1f1df5=_0x1d74b2?_0x443380[_0x3840('0x22')]:_0x2cf194['offset']+_0x2cf194['limit'];var _0x439455;if(_0x1f1df5>=_0x58d2d8){_0x1f1df5=_0x58d2d8;_0x439455=0xc8;}else{_0x439455=0xce;}_0x1f3b02[_0x3840('0x1d')](_0x439455);return _0x1f3b02[_0x3840('0x23')]('Content-Range',_0x3bc1be+'-'+_0x1f1df5+'/'+_0x58d2d8)[_0x3840('0x1e')](_0x443380);}return null;};}function patchUpdates(_0xd03d51){return function(_0x49c2d9){try{jsonpatch[_0x3840('0x24')](_0x49c2d9,_0xd03d51,!![]);}catch(_0x178037){return BPromise['reject'](_0x178037);}return _0x49c2d9[_0x3840('0x25')]();};}function saveUpdates(_0x20f021,_0x47eb14){return function(_0x35f548){if(_0x35f548){return _0x35f548[_0x3840('0x26')](_0x20f021)[_0x3840('0x27')](function(_0x36e089){return _0x36e089;});}return null;};}function removeEntity(_0x1e771a,_0x3bf539){return function(_0x3ce779){if(_0x3ce779){return _0x3ce779['destroy']()[_0x3840('0x27')](function(){_0x1e771a[_0x3840('0x1d')](0xcc)[_0x3840('0x1c')]();});}};}function handleEntityNotFound(_0x29abcb,_0x5ef056){return function(_0x54d1be){if(!_0x54d1be){_0x29abcb['sendStatus'](0x194);}return _0x54d1be;};}function handleError(_0x14f955,_0x5f21de){_0x5f21de=_0x5f21de||0x1f4;return function(_0x5eb7b1){logger[_0x3840('0x28')](_0x5eb7b1[_0x3840('0x29')]);if(_0x5eb7b1[_0x3840('0x2a')]){delete _0x5eb7b1['name'];}_0x14f955[_0x3840('0x1d')](_0x5f21de)[_0x3840('0x2b')](_0x5eb7b1);};}exports[_0x3840('0x2c')]=function(_0x344749,_0x3fffae){var _0x9da640={},_0x250a95={},_0x10494c={'count':0x0,'rows':[]};var _0x5326be=_['map'](db[_0x3840('0x2d')][_0x3840('0x2e')],function(_0x126a5b){return{'name':_0x126a5b[_0x3840('0x2f')],'type':_0x126a5b['type']['key']};});_0x250a95[_0x3840('0x30')]=_[_0x3840('0x31')](_0x5326be,_0x3840('0x2a'));_0x250a95[_0x3840('0x32')]=_['keys'](_0x344749[_0x3840('0x32')]);_0x250a95['filters']=_[_0x3840('0x33')](_0x250a95['model'],_0x250a95[_0x3840('0x32')]);_0x9da640[_0x3840('0x34')]=_[_0x3840('0x33')](_0x250a95[_0x3840('0x30')],qs['fields'](_0x344749[_0x3840('0x32')][_0x3840('0x35')]));_0x9da640[_0x3840('0x34')]=_0x9da640['attributes'][_0x3840('0x36')]?_0x9da640[_0x3840('0x34')]:_0x250a95['model'];if(!_0x344749['query'][_0x3840('0x37')](_0x3840('0x38'))){_0x9da640[_0x3840('0x21')]=qs['limit'](_0x344749['query'][_0x3840('0x21')]);_0x9da640[_0x3840('0x1f')]=qs[_0x3840('0x1f')](_0x344749['query']['offset']);}_0x9da640[_0x3840('0x39')]=qs[_0x3840('0x3a')](_0x344749[_0x3840('0x32')]['sort']);_0x9da640[_0x3840('0x3b')]=qs[_0x3840('0x3c')](_[_0x3840('0x3d')](_0x344749[_0x3840('0x32')],_0x250a95[_0x3840('0x3c')]),_0x5326be);if(_0x344749[_0x3840('0x32')][_0x3840('0x3e')]){_0x9da640[_0x3840('0x3b')]=_[_0x3840('0x3f')](_0x9da640['where'],{'$or':_['map'](_0x5326be,function(_0x24694a){if(_0x24694a[_0x3840('0x40')]!=='VIRTUAL'){var _0x1a3e13={};_0x1a3e13[_0x24694a[_0x3840('0x2a')]]={'$like':'%'+_0x344749[_0x3840('0x32')][_0x3840('0x3e')]+'%'};return _0x1a3e13;}})});}_0x9da640=_[_0x3840('0x3f')]({},_0x9da640,_0x344749['options']);var _0x332728={'where':_0x9da640['where']};return db[_0x3840('0x2d')][_0x3840('0x22')](_0x332728)[_0x3840('0x27')](function(_0xd8d372){_0x10494c[_0x3840('0x22')]=_0xd8d372;if(_0x344749['query'][_0x3840('0x41')]){_0x9da640[_0x3840('0x42')]=[{'all':!![]}];}return db[_0x3840('0x2d')][_0x3840('0x43')](_0x9da640);})[_0x3840('0x27')](function(_0x565457){_0x10494c['rows']=_0x565457;return _0x10494c;})[_0x3840('0x27')](respondWithFilteredResult(_0x3fffae,_0x9da640))[_0x3840('0x44')](handleError(_0x3fffae,null));};exports['show']=function(_0x398476,_0x30b43c){var _0x4a829c={'raw':!![],'where':{'id':_0x398476[_0x3840('0x45')]['id']}},_0x58f812={};_0x58f812[_0x3840('0x30')]=_['keys'](db['DeskField'][_0x3840('0x2e')]);_0x58f812[_0x3840('0x32')]=_[_0x3840('0x46')](_0x398476[_0x3840('0x32')]);_0x58f812[_0x3840('0x3c')]=_[_0x3840('0x33')](_0x58f812[_0x3840('0x30')],_0x58f812[_0x3840('0x32')]);_0x4a829c[_0x3840('0x34')]=_[_0x3840('0x33')](_0x58f812[_0x3840('0x30')],qs[_0x3840('0x35')](_0x398476[_0x3840('0x32')][_0x3840('0x35')]));_0x4a829c[_0x3840('0x34')]=_0x4a829c[_0x3840('0x34')][_0x3840('0x36')]?_0x4a829c[_0x3840('0x34')]:_0x58f812['model'];if(_0x398476[_0x3840('0x32')][_0x3840('0x41')]){_0x4a829c['include']=[{'all':!![]}];}_0x4a829c=_['merge']({},_0x4a829c,_0x398476[_0x3840('0x47')]);return db[_0x3840('0x2d')][_0x3840('0x48')](_0x4a829c)['then'](handleEntityNotFound(_0x30b43c,null))[_0x3840('0x27')](respondWithResult(_0x30b43c,null))[_0x3840('0x44')](handleError(_0x30b43c,null));};exports[_0x3840('0x49')]=function(_0x178924,_0x13f520){return db['DeskField'][_0x3840('0x49')](_0x178924[_0x3840('0x4a')],{})[_0x3840('0x27')](respondWithResult(_0x13f520,0xc9))[_0x3840('0x44')](handleError(_0x13f520,null));};exports[_0x3840('0x26')]=function(_0x3e98fd,_0x5d5689){if(_0x3e98fd['body']['id']){delete _0x3e98fd[_0x3840('0x4a')]['id'];}return db[_0x3840('0x2d')][_0x3840('0x48')]({'where':{'id':_0x3e98fd[_0x3840('0x45')]['id']}})[_0x3840('0x27')](handleEntityNotFound(_0x5d5689,null))['then'](saveUpdates(_0x3e98fd[_0x3840('0x4a')],null))['then'](respondWithResult(_0x5d5689,null))[_0x3840('0x44')](handleError(_0x5d5689,null));};exports[_0x3840('0x4b')]=function(_0x2918cf,_0x3c8bd3){return db[_0x3840('0x2d')][_0x3840('0x48')]({'where':{'id':_0x2918cf[_0x3840('0x45')]['id']}})[_0x3840('0x27')](handleEntityNotFound(_0x3c8bd3,null))[_0x3840('0x27')](removeEntity(_0x3c8bd3,null))[_0x3840('0x44')](handleError(_0x3c8bd3,null));}; \ No newline at end of file +var _0xc16d=['length','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','count','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','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/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','apply','update','then','destroy','sendStatus','error','stack','name','send','index','DeskField','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields'];(function(_0x1a605a,_0x5aa4aa){var _0x193a35=function(_0x343340){while(--_0x343340){_0x1a605a['push'](_0x1a605a['shift']());}};_0x193a35(++_0x5aa4aa);}(_0xc16d,0x145));var _0xdc16=function(_0x33c497,_0x5d7fb5){_0x33c497=_0x33c497-0x0;var _0x35179e=_0xc16d[_0x33c497];return _0x35179e;};'use strict';var emlformat=require(_0xdc16('0x0'));var rimraf=require(_0xdc16('0x1'));var zipdir=require(_0xdc16('0x2'));var jsonpatch=require(_0xdc16('0x3'));var rp=require(_0xdc16('0x4'));var moment=require(_0xdc16('0x5'));var BPromise=require(_0xdc16('0x6'));var Mustache=require('mustache');var util=require(_0xdc16('0x7'));var path=require(_0xdc16('0x8'));var sox=require(_0xdc16('0x9'));var csv=require(_0xdc16('0xa'));var ejs=require(_0xdc16('0xb'));var fs=require('fs');var fs_extra=require(_0xdc16('0xc'));var _=require(_0xdc16('0xd'));var squel=require(_0xdc16('0xe'));var crypto=require(_0xdc16('0xf'));var jsforce=require(_0xdc16('0x10'));var deskjs=require(_0xdc16('0x11'));var toCsv=require(_0xdc16('0xa'));var querystring=require(_0xdc16('0x12'));var Papa=require(_0xdc16('0x13'));var Redis=require(_0xdc16('0x14'));var authService=require(_0xdc16('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xdc16('0x16'));var hardwareService=require(_0xdc16('0x17'));var logger=require(_0xdc16('0x18'))(_0xdc16('0x19'));var utils=require('../../config/utils');var config=require(_0xdc16('0x1a'));var licenseUtil=require(_0xdc16('0x1b'));var db=require(_0xdc16('0x1c'))['db'];function respondWithStatusCode(_0x1224c6,_0x5137db){_0x5137db=_0x5137db||0xcc;return function(_0x42ce38){if(_0x42ce38){return _0x1224c6['sendStatus'](_0x5137db);}return _0x1224c6['status'](_0x5137db)[_0xdc16('0x1d')]();};}function respondWithResult(_0x50d023,_0x12bef5){_0x12bef5=_0x12bef5||0xc8;return function(_0x42b482){if(_0x42b482){return _0x50d023[_0xdc16('0x1e')](_0x12bef5)['json'](_0x42b482);}};}function respondWithFilteredResult(_0xd7ff38,_0x5a2b26){return function(_0x33d3e7){if(_0x33d3e7){var _0x13742b=typeof _0x5a2b26[_0xdc16('0x1f')]===_0xdc16('0x20')&&typeof _0x5a2b26['limit']===_0xdc16('0x20');var _0xc00f29=_0x33d3e7['count'];var _0x37b627=_0x13742b?0x0:_0x5a2b26[_0xdc16('0x1f')];var _0x1fc714=_0x13742b?_0x33d3e7['count']:_0x5a2b26['offset']+_0x5a2b26[_0xdc16('0x21')];var _0x5d9519;if(_0x1fc714>=_0xc00f29){_0x1fc714=_0xc00f29;_0x5d9519=0xc8;}else{_0x5d9519=0xce;}_0xd7ff38[_0xdc16('0x1e')](_0x5d9519);return _0xd7ff38['set']('Content-Range',_0x37b627+'-'+_0x1fc714+'/'+_0xc00f29)['json'](_0x33d3e7);}return null;};}function patchUpdates(_0x524949){return function(_0x192f74){try{jsonpatch[_0xdc16('0x22')](_0x192f74,_0x524949,!![]);}catch(_0x471522){return BPromise['reject'](_0x471522);}return _0x192f74['save']();};}function saveUpdates(_0x504c04,_0x1fdec0){return function(_0x50d974){if(_0x50d974){return _0x50d974[_0xdc16('0x23')](_0x504c04)[_0xdc16('0x24')](function(_0x1c0419){return _0x1c0419;});}return null;};}function removeEntity(_0x4ae7fc,_0x5c4b4a){return function(_0x46ee55){if(_0x46ee55){return _0x46ee55[_0xdc16('0x25')]()[_0xdc16('0x24')](function(){_0x4ae7fc[_0xdc16('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x525789,_0x48747a){return function(_0x1efa8f){if(!_0x1efa8f){_0x525789[_0xdc16('0x26')](0x194);}return _0x1efa8f;};}function handleError(_0x14fc27,_0x4964a7){_0x4964a7=_0x4964a7||0x1f4;return function(_0x235f78){logger[_0xdc16('0x27')](_0x235f78[_0xdc16('0x28')]);if(_0x235f78[_0xdc16('0x29')]){delete _0x235f78['name'];}_0x14fc27['status'](_0x4964a7)[_0xdc16('0x2a')](_0x235f78);};}exports[_0xdc16('0x2b')]=function(_0x563f5b,_0x44f7b3){var _0x597a1c={},_0x338f7a={},_0x2da8ad={'count':0x0,'rows':[]};var _0x247392=_['map'](db[_0xdc16('0x2c')][_0xdc16('0x2d')],function(_0x224965){return{'name':_0x224965['fieldName'],'type':_0x224965[_0xdc16('0x2e')][_0xdc16('0x2f')]};});_0x338f7a[_0xdc16('0x30')]=_['map'](_0x247392,_0xdc16('0x29'));_0x338f7a[_0xdc16('0x31')]=_[_0xdc16('0x32')](_0x563f5b[_0xdc16('0x31')]);_0x338f7a[_0xdc16('0x33')]=_['intersection'](_0x338f7a[_0xdc16('0x30')],_0x338f7a[_0xdc16('0x31')]);_0x597a1c[_0xdc16('0x34')]=_[_0xdc16('0x35')](_0x338f7a[_0xdc16('0x30')],qs['fields'](_0x563f5b[_0xdc16('0x31')][_0xdc16('0x36')]));_0x597a1c[_0xdc16('0x34')]=_0x597a1c['attributes'][_0xdc16('0x37')]?_0x597a1c[_0xdc16('0x34')]:_0x338f7a[_0xdc16('0x30')];if(!_0x563f5b['query'][_0xdc16('0x38')]('nolimit')){_0x597a1c[_0xdc16('0x21')]=qs[_0xdc16('0x21')](_0x563f5b[_0xdc16('0x31')]['limit']);_0x597a1c['offset']=qs['offset'](_0x563f5b['query'][_0xdc16('0x1f')]);}_0x597a1c[_0xdc16('0x39')]=qs[_0xdc16('0x3a')](_0x563f5b[_0xdc16('0x31')]['sort']);_0x597a1c[_0xdc16('0x3b')]=qs[_0xdc16('0x33')](_[_0xdc16('0x3c')](_0x563f5b['query'],_0x338f7a['filters']),_0x247392);if(_0x563f5b[_0xdc16('0x31')]['filter']){_0x597a1c[_0xdc16('0x3b')]=_[_0xdc16('0x3d')](_0x597a1c[_0xdc16('0x3b')],{'$or':_[_0xdc16('0x3e')](_0x247392,function(_0x3167e7){if(_0x3167e7[_0xdc16('0x2e')]!==_0xdc16('0x3f')){var _0x599c2c={};_0x599c2c[_0x3167e7[_0xdc16('0x29')]]={'$like':'%'+_0x563f5b['query']['filter']+'%'};return _0x599c2c;}})});}_0x597a1c=_[_0xdc16('0x3d')]({},_0x597a1c,_0x563f5b['options']);var _0x4f5e8a={'where':_0x597a1c[_0xdc16('0x3b')]};return db[_0xdc16('0x2c')][_0xdc16('0x40')](_0x4f5e8a)[_0xdc16('0x24')](function(_0x3b67bf){_0x2da8ad[_0xdc16('0x40')]=_0x3b67bf;if(_0x563f5b[_0xdc16('0x31')]['includeAll']){_0x597a1c[_0xdc16('0x41')]=[{'all':!![]}];}return db['DeskField'][_0xdc16('0x42')](_0x597a1c);})['then'](function(_0x52386d){_0x2da8ad[_0xdc16('0x43')]=_0x52386d;return _0x2da8ad;})[_0xdc16('0x24')](respondWithFilteredResult(_0x44f7b3,_0x597a1c))[_0xdc16('0x44')](handleError(_0x44f7b3,null));};exports[_0xdc16('0x45')]=function(_0x1036f3,_0x2e8964){var _0x34af1b={'raw':!![],'where':{'id':_0x1036f3['params']['id']}},_0x4de320={};_0x4de320[_0xdc16('0x30')]=_[_0xdc16('0x32')](db[_0xdc16('0x2c')][_0xdc16('0x2d')]);_0x4de320[_0xdc16('0x31')]=_[_0xdc16('0x32')](_0x1036f3[_0xdc16('0x31')]);_0x4de320[_0xdc16('0x33')]=_[_0xdc16('0x35')](_0x4de320[_0xdc16('0x30')],_0x4de320[_0xdc16('0x31')]);_0x34af1b[_0xdc16('0x34')]=_[_0xdc16('0x35')](_0x4de320[_0xdc16('0x30')],qs[_0xdc16('0x36')](_0x1036f3[_0xdc16('0x31')]['fields']));_0x34af1b[_0xdc16('0x34')]=_0x34af1b['attributes']['length']?_0x34af1b[_0xdc16('0x34')]:_0x4de320[_0xdc16('0x30')];if(_0x1036f3[_0xdc16('0x31')][_0xdc16('0x46')]){_0x34af1b[_0xdc16('0x41')]=[{'all':!![]}];}_0x34af1b=_[_0xdc16('0x3d')]({},_0x34af1b,_0x1036f3[_0xdc16('0x47')]);return db[_0xdc16('0x2c')][_0xdc16('0x48')](_0x34af1b)['then'](handleEntityNotFound(_0x2e8964,null))[_0xdc16('0x24')](respondWithResult(_0x2e8964,null))[_0xdc16('0x44')](handleError(_0x2e8964,null));};exports[_0xdc16('0x49')]=function(_0x33f50e,_0x2061a4){return db[_0xdc16('0x2c')][_0xdc16('0x49')](_0x33f50e['body'],{})[_0xdc16('0x24')](respondWithResult(_0x2061a4,0xc9))[_0xdc16('0x44')](handleError(_0x2061a4,null));};exports[_0xdc16('0x23')]=function(_0x4f6455,_0x1fbb49){if(_0x4f6455[_0xdc16('0x4a')]['id']){delete _0x4f6455[_0xdc16('0x4a')]['id'];}return db['DeskField'][_0xdc16('0x48')]({'where':{'id':_0x4f6455[_0xdc16('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1fbb49,null))[_0xdc16('0x24')](saveUpdates(_0x4f6455['body'],null))[_0xdc16('0x24')](respondWithResult(_0x1fbb49,null))[_0xdc16('0x44')](handleError(_0x1fbb49,null));};exports[_0xdc16('0x25')]=function(_0x2a1d0d,_0x2a2521){return db[_0xdc16('0x2c')][_0xdc16('0x48')]({'where':{'id':_0x2a1d0d[_0xdc16('0x4b')]['id']}})[_0xdc16('0x24')](handleEntityNotFound(_0x2a2521,null))[_0xdc16('0x24')](removeEntity(_0x2a2521,null))[_0xdc16('0x44')](handleError(_0x2a2521,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 83a8358..bc875d3 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 _0x1ab9=['desk_unique_index','lodash','util','api','bluebird','request-promise','path','rimraf','./intDeskField.attributes','exports','define','DeskField','int_desk_fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ab9,0x187));var _0x91ab=function(_0x21d3c4,_0x48d915){_0x21d3c4=_0x21d3c4-0x0;var _0x341584=_0x1ab9[_0x21d3c4];return _0x341584;};'use strict';var _=require(_0x91ab('0x0'));var util=require(_0x91ab('0x1'));var logger=require('../../config/logger')(_0x91ab('0x2'));var moment=require('moment');var BPromise=require(_0x91ab('0x3'));var rp=require(_0x91ab('0x4'));var fs=require('fs');var path=require(_0x91ab('0x5'));var rimraf=require(_0x91ab('0x6'));var config=require('../../config/environment');var attributes=require(_0x91ab('0x7'));module[_0x91ab('0x8')]=function(_0x462a68,_0xc77ac8){return _0x462a68[_0x91ab('0x9')](_0x91ab('0xa'),attributes,{'tableName':_0x91ab('0xb'),'paranoid':![],'indexes':[{'name':_0x91ab('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc1a3=['exports','define','DeskField','int_desk_fields','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','rimraf','./intDeskField.attributes'];(function(_0x3c2ccc,_0x44120d){var _0x306570=function(_0x4200d2){while(--_0x4200d2){_0x3c2ccc['push'](_0x3c2ccc['shift']());}};_0x306570(++_0x44120d);}(_0xc1a3,0x7b));var _0x3c1a=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0xc1a3[_0xf79bae];return _0x5d2cb7;};'use strict';var _=require(_0x3c1a('0x0'));var util=require(_0x3c1a('0x1'));var logger=require(_0x3c1a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3c1a('0x3'));var rp=require(_0x3c1a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c1a('0x5'));var config=require('../../config/environment');var attributes=require(_0x3c1a('0x6'));module[_0x3c1a('0x7')]=function(_0xeef068,_0x175394){return _0xeef068[_0x3c1a('0x8')](_0x3c1a('0x9'),attributes,{'tableName':_0x3c1a('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x3c1a('0xb'),_0x3c1a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 4786c26..f5a1f17 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 _0xa6b6=['catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x4b7968,_0x3a4aa3){var _0x1125ae=function(_0x4d798e){while(--_0x4d798e){_0x4b7968['push'](_0x4b7968['shift']());}};_0x1125ae(++_0x3a4aa3);}(_0xa6b6,0x133));var _0x6a6b=function(_0x448e8d,_0x43a056){_0x448e8d=_0x448e8d-0x0;var _0x46e774=_0xa6b6[_0x448e8d];return _0x46e774;};'use strict';var _=require(_0x6a6b('0x0'));var util=require('util');var moment=require(_0x6a6b('0x1'));var BPromise=require('bluebird');var rs=require(_0x6a6b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a6b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a6b('0x4'))('rpc');var config=require(_0x6a6b('0x5'));var jayson=require(_0x6a6b('0x6'));var client=jayson['client'][_0x6a6b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x45dc32,_0x33bbd9,_0xa7e39a){return new BPromise(function(_0x6d037c,_0x5187e2){return client['request'](_0x45dc32,_0xa7e39a)['then'](function(_0x1977f8){logger['info'](_0x6a6b('0x8'),_0x33bbd9,_0x6a6b('0x9'));logger['debug'](_0x6a6b('0xa'),_0x33bbd9,'request\x20sent',JSON[_0x6a6b('0xb')](_0x1977f8));if(_0x1977f8[_0x6a6b('0xc')]){if(_0x1977f8[_0x6a6b('0xc')][_0x6a6b('0xd')]===0x1f4){logger[_0x6a6b('0xc')]('DeskField,\x20%s,\x20%s',_0x33bbd9,_0x1977f8[_0x6a6b('0xc')][_0x6a6b('0xe')]);return _0x5187e2(_0x1977f8[_0x6a6b('0xc')][_0x6a6b('0xe')]);}logger[_0x6a6b('0xc')]('DeskField,\x20%s,\x20%s',_0x33bbd9,_0x1977f8['error'][_0x6a6b('0xe')]);return _0x6d037c(_0x1977f8[_0x6a6b('0xc')][_0x6a6b('0xe')]);}else{logger['info'](_0x6a6b('0x8'),_0x33bbd9,_0x6a6b('0x9'));_0x6d037c(_0x1977f8[_0x6a6b('0xf')][_0x6a6b('0xe')]);}})[_0x6a6b('0x10')](function(_0x32c1be){logger[_0x6a6b('0xc')]('DeskField,\x20%s,\x20%s',_0x33bbd9,_0x32c1be);_0x5187e2(_0x32c1be);});});} \ No newline at end of file +var _0x0100=['DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','debug'];(function(_0x434d7c,_0x270614){var _0x512c7c=function(_0x4920d6){while(--_0x4920d6){_0x434d7c['push'](_0x434d7c['shift']());}};_0x512c7c(++_0x270614);}(_0x0100,0xcc));var _0x0010=function(_0x36f0d4,_0x59d034){_0x36f0d4=_0x36f0d4-0x0;var _0x4d3c56=_0x0100[_0x36f0d4];return _0x4d3c56;};'use strict';var _=require(_0x0010('0x0'));var util=require(_0x0010('0x1'));var moment=require(_0x0010('0x2'));var BPromise=require('bluebird');var rs=require(_0x0010('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0010('0x4'))['db'];var utils=require(_0x0010('0x5'));var logger=require(_0x0010('0x6'))(_0x0010('0x7'));var config=require('../../config/environment');var jayson=require(_0x0010('0x8'));var client=jayson[_0x0010('0x9')][_0x0010('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x370640,_0x41ffdc,_0x58b1c6){return new BPromise(function(_0x556f9c,_0x29613d){return client[_0x0010('0xb')](_0x370640,_0x58b1c6)[_0x0010('0xc')](function(_0x88888){logger[_0x0010('0xd')](_0x0010('0xe'),_0x41ffdc,'request\x20sent');logger[_0x0010('0xf')](_0x0010('0x10'),_0x41ffdc,_0x0010('0x11'),JSON['stringify'](_0x88888));if(_0x88888['error']){if(_0x88888[_0x0010('0x12')][_0x0010('0x13')]===0x1f4){logger[_0x0010('0x12')](_0x0010('0xe'),_0x41ffdc,_0x88888[_0x0010('0x12')]['message']);return _0x29613d(_0x88888[_0x0010('0x12')]['message']);}logger[_0x0010('0x12')](_0x0010('0xe'),_0x41ffdc,_0x88888[_0x0010('0x12')][_0x0010('0x14')]);return _0x556f9c(_0x88888[_0x0010('0x12')][_0x0010('0x14')]);}else{logger[_0x0010('0xd')](_0x0010('0xe'),_0x41ffdc,_0x0010('0x11'));_0x556f9c(_0x88888['result'][_0x0010('0x14')]);}})[_0x0010('0x15')](function(_0xb5a788){logger[_0x0010('0x12')](_0x0010('0xe'),_0x41ffdc,_0xb5a788);_0x29613d(_0xb5a788);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index b914743..08bab67 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 _0xc8ce=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','post','create','update','delete','destroy','multer','util','connect-timeout'];(function(_0x4ceab1,_0x17f8a7){var _0x29ab00=function(_0x57ffc5){while(--_0x57ffc5){_0x4ceab1['push'](_0x4ceab1['shift']());}};_0x29ab00(++_0x17f8a7);}(_0xc8ce,0x162));var _0xec8c=function(_0x27031e,_0x1eb8cd){_0x27031e=_0x27031e-0x0;var _0xfd46b3=_0xc8ce[_0x27031e];return _0xfd46b3;};'use strict';var multer=require(_0xec8c('0x0'));var util=require(_0xec8c('0x1'));var path=require('path');var timeout=require(_0xec8c('0x2'));var express=require(_0xec8c('0x3'));var router=express[_0xec8c('0x4')]();var fs_extra=require(_0xec8c('0x5'));var auth=require(_0xec8c('0x6'));var interaction=require(_0xec8c('0x7'));var config=require(_0xec8c('0x8'));var controller=require(_0xec8c('0x9'));router[_0xec8c('0xa')]('/',auth[_0xec8c('0xb')](),controller['index']);router[_0xec8c('0xa')](_0xec8c('0xc'),auth[_0xec8c('0xb')](),controller[_0xec8c('0xd')]);router[_0xec8c('0xa')](_0xec8c('0xe'),auth[_0xec8c('0xb')](),controller['getConfigurations']);router['get'](_0xec8c('0xf'),auth[_0xec8c('0xb')](),controller['getFields']);router[_0xec8c('0x10')]('/',auth['isAuthenticated'](),controller[_0xec8c('0x11')]);router['post'](_0xec8c('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0xec8c('0xc'),auth['isAuthenticated'](),controller[_0xec8c('0x12')]);router[_0xec8c('0x13')](_0xec8c('0xc'),auth[_0xec8c('0xb')](),controller[_0xec8c('0x14')]);module['exports']=router; \ No newline at end of file +var _0xeae4=['/:id/fields','getFields','post','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x1f7075,_0x3ca810){var _0x14562d=function(_0x14edb5){while(--_0x14edb5){_0x1f7075['push'](_0x1f7075['shift']());}};_0x14562d(++_0x3ca810);}(_0xeae4,0x17c));var _0x4eae=function(_0x4e82e8,_0x27866c){_0x4e82e8=_0x4e82e8-0x0;var _0x39aa22=_0xeae4[_0x4e82e8];return _0x39aa22;};'use strict';var multer=require(_0x4eae('0x0'));var util=require(_0x4eae('0x1'));var path=require(_0x4eae('0x2'));var timeout=require(_0x4eae('0x3'));var express=require(_0x4eae('0x4'));var router=express[_0x4eae('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4eae('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4eae('0x7'));var controller=require(_0x4eae('0x8'));router[_0x4eae('0x9')]('/',auth[_0x4eae('0xa')](),controller[_0x4eae('0xb')]);router['get'](_0x4eae('0xc'),auth[_0x4eae('0xa')](),controller[_0x4eae('0xd')]);router[_0x4eae('0x9')](_0x4eae('0xe'),auth[_0x4eae('0xa')](),controller[_0x4eae('0xf')]);router[_0x4eae('0x9')](_0x4eae('0x10'),auth[_0x4eae('0xa')](),controller[_0x4eae('0x11')]);router[_0x4eae('0x12')]('/',auth[_0x4eae('0xa')](),controller['create']);router[_0x4eae('0x12')](_0x4eae('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x4eae('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x4eae('0x13')](_0x4eae('0xc'),auth['isAuthenticated'](),controller[_0x4eae('0x14')]);module[_0x4eae('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 8eec113..1038d4d 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 _0x2cd3=['BOOLEAN','sequelize','STRING'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x2cd3,0xf1));var _0x32cd=function(_0x29e3b6,_0x40b0b4){_0x29e3b6=_0x29e3b6-0x0;var _0x55d4b0=_0x2cd3[_0x29e3b6];return _0x55d4b0;};'use strict';var Sequelize=require(_0x32cd('0x0'));module['exports']={'name':{'type':Sequelize[_0x32cd('0x1')]},'username':{'type':Sequelize[_0x32cd('0x1')]},'password':{'type':Sequelize[_0x32cd('0x1')]},'remoteUri':{'type':Sequelize[_0x32cd('0x1')]},'tenantId':{'type':Sequelize[_0x32cd('0x1')]},'clientId':{'type':Sequelize[_0x32cd('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x32cd('0x1')]},'modernAuthentication':{'type':Sequelize[_0x32cd('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x280b=['STRING','BOOLEAN','sequelize','exports'];(function(_0x13ad2f,_0x2f99cb){var _0x509efd=function(_0x5a1c0e){while(--_0x5a1c0e){_0x13ad2f['push'](_0x13ad2f['shift']());}};_0x509efd(++_0x2f99cb);}(_0x280b,0xce));var _0xb280=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x280b[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xb280('0x0'));module[_0xb280('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb280('0x2')]},'password':{'type':Sequelize[_0xb280('0x2')]},'remoteUri':{'type':Sequelize[_0xb280('0x2')]},'tenantId':{'type':Sequelize[_0xb280('0x2')]},'clientId':{'type':Sequelize[_0xb280('0x2')]},'clientSecret':{'type':Sequelize[_0xb280('0x2')]},'serverUrl':{'type':Sequelize[_0xb280('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb280('0x2')]},'modernAuthentication':{'type':Sequelize[_0xb280('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index fabec86..f9b4983 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 _0x4221=['modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','statecode','subjectidname','transactioncurrencyidname','utcconversiontimezonecode','username','password','remoteUri','clientId','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','tenantId','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','LogicalName','@odata.type','push','all','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','Value','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false','DisplayName','request-promise','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','limit','undefined','count','offset','set','json','update','destroy','then','end','error','stack','name','send','map','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','type','VIRTUAL','include','Dynamics365Account','findAll','rows','params','includeAll','options','find','catch','create','body','findOne','Dynamics365Configuration','order','pick','getConfigurations','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','substring','lastIndexOf','format','getFields','Incident','title','description','ownerid','phonenumber','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','entitlementidname','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x4221,0x1a1));var _0x1422=function(_0x18a492,_0x581e9f){_0x18a492=_0x18a492-0x0;var _0x1ba0cd=_0x4221[_0x18a492];return _0x1ba0cd;};'use strict';var rp=require(_0x1422('0x0'));var util=require('util');var _=require(_0x1422('0x1'));var qs=require(_0x1422('0x2'));var logger=require(_0x1422('0x3'))(_0x1422('0x4'));var db=require(_0x1422('0x5'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x14ad74,_0x5d1845){_0x5d1845=_0x5d1845||0xc8;return function(_0xc8faa9){if(_0xc8faa9){return _0x14ad74[_0x1422('0x6')](_0x5d1845)['json'](_0xc8faa9);}};}function respondWithFilteredResult(_0x5f4a00,_0x614005){return function(_0x734ad8){if(_0x734ad8){var _0x1112d0=typeof _0x614005['offset']==='undefined'&&typeof _0x614005[_0x1422('0x7')]===_0x1422('0x8');var _0x9cd5e8=_0x734ad8[_0x1422('0x9')];var _0x271cb7=_0x1112d0?0x0:_0x614005[_0x1422('0xa')];var _0x584bf3=_0x1112d0?_0x734ad8[_0x1422('0x9')]:_0x614005[_0x1422('0xa')]+_0x614005[_0x1422('0x7')];var _0x599f35;if(_0x584bf3>=_0x9cd5e8){_0x584bf3=_0x9cd5e8;_0x599f35=0xc8;}else{_0x599f35=0xce;}_0x5f4a00[_0x1422('0x6')](_0x599f35);return _0x5f4a00[_0x1422('0xb')]('Content-Range',_0x271cb7+'-'+_0x584bf3+'/'+_0x9cd5e8)[_0x1422('0xc')](_0x734ad8);}return null;};}function saveUpdates(_0x56bb6e){return function(_0x308578){if(_0x308578){return _0x308578[_0x1422('0xd')](_0x56bb6e)['then'](function(_0x57b3eb){return _0x57b3eb;});}return null;};}function removeEntity(_0x1f149c){return function(_0xcd7cfe){if(_0xcd7cfe){return _0xcd7cfe[_0x1422('0xe')]()[_0x1422('0xf')](function(){_0x1f149c[_0x1422('0x6')](0xcc)[_0x1422('0x10')]();});}};}function handleEntityNotFound(_0x21526f){return function(_0x32b0e8){if(!_0x32b0e8){_0x21526f['sendStatus'](0x194);}return _0x32b0e8;};}function handleError(_0x6875a9,_0x5bf611){_0x5bf611=_0x5bf611||0x1f4;return function(_0x25f320){logger[_0x1422('0x11')](_0x25f320[_0x1422('0x12')]);if(_0x25f320[_0x1422('0x13')]){delete _0x25f320[_0x1422('0x13')];}_0x6875a9[_0x1422('0x6')](_0x5bf611)[_0x1422('0x14')](_0x25f320);};}exports['index']=function(_0x4f6a66,_0x5b5da8){var _0x52cb76={},_0x11b0c2={},_0x45e009={'count':0x0,'rows':[]};var _0x42d797=_[_0x1422('0x15')](db['Dynamics365Account'][_0x1422('0x16')],function(_0x428636){return{'name':_0x428636['fieldName'],'type':_0x428636['type']['key']};});_0x11b0c2[_0x1422('0x17')]=_[_0x1422('0x15')](_0x42d797,_0x1422('0x13'));_0x11b0c2['query']=_[_0x1422('0x18')](_0x4f6a66[_0x1422('0x19')]);_0x11b0c2[_0x1422('0x1a')]=_[_0x1422('0x1b')](_0x11b0c2[_0x1422('0x17')],_0x11b0c2[_0x1422('0x19')]);_0x52cb76[_0x1422('0x1c')]=_['intersection'](_0x11b0c2[_0x1422('0x17')],qs[_0x1422('0x1d')](_0x4f6a66[_0x1422('0x19')][_0x1422('0x1d')]));_0x52cb76[_0x1422('0x1c')]=_0x52cb76[_0x1422('0x1c')][_0x1422('0x1e')]?_0x52cb76['attributes']:_0x11b0c2[_0x1422('0x17')];if(!_0x4f6a66['query'][_0x1422('0x1f')](_0x1422('0x20'))){_0x52cb76['limit']=qs[_0x1422('0x7')](_0x4f6a66[_0x1422('0x19')]['limit']);_0x52cb76[_0x1422('0xa')]=qs[_0x1422('0xa')](_0x4f6a66['query']['offset']);}_0x52cb76['order']=qs['sort'](_0x4f6a66['query'][_0x1422('0x21')]);_0x52cb76['where']=qs[_0x1422('0x1a')](_['pick'](_0x4f6a66[_0x1422('0x19')],_0x11b0c2['filters']),_0x42d797);if(_0x4f6a66[_0x1422('0x19')][_0x1422('0x22')]){_0x52cb76[_0x1422('0x23')]=_[_0x1422('0x24')](_0x52cb76['where'],{'$or':_[_0x1422('0x15')](_0x42d797,function(_0x4bd4c1){if(_0x4bd4c1[_0x1422('0x25')]!==_0x1422('0x26')){var _0xe940f6={};_0xe940f6[_0x4bd4c1['name']]={'$like':'%'+_0x4f6a66[_0x1422('0x19')][_0x1422('0x22')]+'%'};return _0xe940f6;}})});}_0x52cb76=_[_0x1422('0x24')]({},_0x52cb76,_0x4f6a66['options']);var _0x2d2aaa={'where':_0x52cb76[_0x1422('0x23')]};return db['Dynamics365Account'][_0x1422('0x9')](_0x2d2aaa)[_0x1422('0xf')](function(_0x31eb3a){_0x45e009['count']=_0x31eb3a;if(_0x4f6a66[_0x1422('0x19')]['includeAll']){_0x52cb76[_0x1422('0x27')]=[{'all':!![]}];}return db[_0x1422('0x28')][_0x1422('0x29')](_0x52cb76);})['then'](function(_0x3c5db5){_0x45e009[_0x1422('0x2a')]=_0x3c5db5;return _0x45e009;})[_0x1422('0xf')](respondWithFilteredResult(_0x5b5da8,_0x52cb76))['catch'](handleError(_0x5b5da8,null));};exports['show']=function(_0x22bb20,_0xcbaba){var _0xa2c134={'raw':![],'where':{'id':_0x22bb20[_0x1422('0x2b')]['id']}},_0x1342f0={};_0x1342f0[_0x1422('0x17')]=_[_0x1422('0x18')](db['Dynamics365Account'][_0x1422('0x16')]);_0x1342f0[_0x1422('0x19')]=_[_0x1422('0x18')](_0x22bb20['query']);_0x1342f0[_0x1422('0x1a')]=_[_0x1422('0x1b')](_0x1342f0[_0x1422('0x17')],_0x1342f0[_0x1422('0x19')]);_0xa2c134[_0x1422('0x1c')]=_[_0x1422('0x1b')](_0x1342f0[_0x1422('0x17')],qs[_0x1422('0x1d')](_0x22bb20[_0x1422('0x19')][_0x1422('0x1d')]));_0xa2c134[_0x1422('0x1c')]=_0xa2c134['attributes'][_0x1422('0x1e')]?_0xa2c134['attributes']:_0x1342f0[_0x1422('0x17')];if(_0x22bb20[_0x1422('0x19')][_0x1422('0x2c')]){_0xa2c134[_0x1422('0x27')]=[{'all':!![]}];}_0xa2c134=_[_0x1422('0x24')]({},_0xa2c134,_0x22bb20[_0x1422('0x2d')]);return db['Dynamics365Account'][_0x1422('0x2e')](_0xa2c134)[_0x1422('0xf')](handleEntityNotFound(_0xcbaba,null))[_0x1422('0xf')](respondWithResult(_0xcbaba,null))[_0x1422('0x2f')](handleError(_0xcbaba,null));};exports[_0x1422('0x30')]=function(_0x130d9d,_0x30c6f0){return db[_0x1422('0x28')][_0x1422('0x30')](_0x130d9d['body'],{})[_0x1422('0xf')](respondWithResult(_0x30c6f0,0xc9))['catch'](handleError(_0x30c6f0,null));};exports['update']=function(_0x9e79c8,_0x29bade){if(_0x9e79c8[_0x1422('0x31')]['id']){delete _0x9e79c8[_0x1422('0x31')]['id'];}return db[_0x1422('0x28')][_0x1422('0x2e')]({'where':{'id':_0x9e79c8['params']['id']}})[_0x1422('0xf')](handleEntityNotFound(_0x29bade,null))[_0x1422('0xf')](saveUpdates(_0x9e79c8[_0x1422('0x31')],null))[_0x1422('0xf')](respondWithResult(_0x29bade,null))[_0x1422('0x2f')](handleError(_0x29bade,null));};exports[_0x1422('0xe')]=function(_0x1dbb6d,_0x4289c0){return db[_0x1422('0x28')][_0x1422('0x2e')]({'where':{'id':_0x1dbb6d['params']['id']}})[_0x1422('0xf')](handleEntityNotFound(_0x4289c0,null))['then'](removeEntity(_0x4289c0,null))[_0x1422('0x2f')](handleError(_0x4289c0,null));};exports['getConfigurations']=function(_0x23c077,_0x51bf7b){var _0x5a1219={};var _0x26e010={};var _0x5c9c08;var _0x475738;return db[_0x1422('0x28')][_0x1422('0x32')]({'where':{'id':_0x23c077[_0x1422('0x2b')]['id']}})[_0x1422('0xf')](handleEntityNotFound(_0x51bf7b,null))[_0x1422('0xf')](function(_0x5a22d7){if(_0x5a22d7){_0x5c9c08=_0x5a22d7;_0x26e010['model']=_['keys'](db[_0x1422('0x33')][_0x1422('0x16')]);_0x26e010[_0x1422('0x19')]=_['keys'](_0x23c077[_0x1422('0x19')]);_0x26e010[_0x1422('0x1a')]=_[_0x1422('0x1b')](_0x26e010['model'],_0x26e010[_0x1422('0x19')]);_0x5a1219[_0x1422('0x1c')]=_['intersection'](_0x26e010[_0x1422('0x17')],qs[_0x1422('0x1d')](_0x23c077[_0x1422('0x19')][_0x1422('0x1d')]));_0x5a1219[_0x1422('0x1c')]=_0x5a1219[_0x1422('0x1c')][_0x1422('0x1e')]?_0x5a1219[_0x1422('0x1c')]:_0x26e010[_0x1422('0x17')];_0x5a1219[_0x1422('0x34')]=qs[_0x1422('0x21')](_0x23c077[_0x1422('0x19')][_0x1422('0x21')]);_0x5a1219[_0x1422('0x23')]=qs[_0x1422('0x1a')](_[_0x1422('0x35')](_0x23c077[_0x1422('0x19')],_0x26e010['filters']));if(_0x23c077[_0x1422('0x19')][_0x1422('0x22')]){_0x5a1219['where']=_[_0x1422('0x24')](_0x5a1219[_0x1422('0x23')],{'$or':_[_0x1422('0x15')](_0x5a1219['attributes'],function(_0x1c4bca){var _0x6cba46={};_0x6cba46[_0x1c4bca]={'$like':'%'+_0x23c077[_0x1422('0x19')][_0x1422('0x22')]+'%'};return _0x6cba46;})});}_0x5a1219=_[_0x1422('0x24')]({},_0x5a1219,_0x23c077[_0x1422('0x2d')]);return _0x5c9c08[_0x1422('0x36')](_0x5a1219);}})[_0x1422('0xf')](function(_0xe42b9c){if(_0xe42b9c){_0x475738=_0xe42b9c[_0x1422('0x1e')];if(!_0x23c077[_0x1422('0x19')][_0x1422('0x1f')]('nolimit')){_0x5a1219[_0x1422('0x7')]=qs[_0x1422('0x7')](_0x23c077[_0x1422('0x19')]['limit']);_0x5a1219[_0x1422('0xa')]=qs[_0x1422('0xa')](_0x23c077[_0x1422('0x19')][_0x1422('0xa')]);}return _0x5c9c08[_0x1422('0x36')](_0x5a1219);}})[_0x1422('0xf')](function(_0x2d4f36){if(_0x2d4f36){return _0x2d4f36?{'count':_0x475738,'rows':_0x2d4f36}:null;}})[_0x1422('0xf')](respondWithResult(_0x51bf7b,null))[_0x1422('0x2f')](handleError(_0x51bf7b,null));};exports[_0x1422('0x37')]=function(_0x44c6b3,_0x256d35){if(_0x44c6b3[_0x1422('0x31')]['id']){delete _0x44c6b3[_0x1422('0x31')]['id'];}return db[_0x1422('0x28')][_0x1422('0x32')]({'where':{'id':_0x44c6b3[_0x1422('0x2b')]['id']}})['then'](handleEntityNotFound(_0x256d35,null))[_0x1422('0xf')](function(_0x5baa95){if(_0x5baa95){_0x44c6b3[_0x1422('0x31')][_0x1422('0x38')]=_0x5baa95['id'];_0x44c6b3[_0x1422('0x31')]['Subjects']=integrations[_0x1422('0x39')](_0x44c6b3[_0x1422('0x31')]['channel'],_0x44c6b3[_0x1422('0x31')][_0x1422('0x25')]);_0x44c6b3[_0x1422('0x31')][_0x1422('0x3a')]=integrations[_0x1422('0x3b')](_0x44c6b3[_0x1422('0x31')][_0x1422('0x3c')],_0x44c6b3['body']['type']);return db[_0x1422('0x33')]['create'](_0x44c6b3[_0x1422('0x31')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0x1422('0x3d')],'as':_0x1422('0x3a')}]});}return null;})[_0x1422('0xf')](respondWithResult(_0x256d35,null))['catch'](handleError(_0x256d35,null));};function sanitizeRemoteUri(_0x408d9f){var _0x23507c=_0x408d9f['slice'](-0x1);if(_0x23507c==='/')return _0x408d9f[_0x1422('0x3e')](0x0,_0x408d9f[_0x1422('0x3f')](_0x23507c));return _0x408d9f;}function getWebApiUrl(_0x3e865d){return util[_0x1422('0x40')]('%s/api/data/v9.0/',_0x3e865d);}exports[_0x1422('0x41')]=function(_0x5cf230,_0x3b8fad){var _0x266bed=_0x5cf230[_0x1422('0x19')]['ticketType'];var _0x565201=_0x266bed==='incident'?_0x1422('0x42'):'PhoneCall';var _0x40183a='';var _0x4800df='';var _0x381d2c='';var _0x1e4282='';var _0x2578e3='';var _0x2d20c4='';var _0x4782df='';var _0x368d1c='';var _0x441fe8=[_0x1422('0x43'),_0x1422('0x44'),'customerid',_0x1422('0x45'),'caseorigincode','subject',_0x1422('0x46'),'regardingobjectid','directioncode',_0x1422('0x47')];var _0x130dd6=['accountidname',_0x1422('0x48'),_0x1422('0x49'),_0x1422('0x4a'),_0x1422('0x4b'),_0x1422('0x4c'),'contractdetailidname',_0x1422('0x4d'),_0x1422('0x4e'),_0x1422('0x4f'),_0x1422('0x50'),_0x1422('0x51'),_0x1422('0x52'),'createdonbehalfbyname',_0x1422('0x53'),_0x1422('0x54'),_0x1422('0x55'),'customeridyominame','emailaddress',_0x1422('0x56'),'entityimage_timestamp',_0x1422('0x57'),_0x1422('0x58'),_0x1422('0x59'),_0x1422('0x5a'),_0x1422('0x5b'),_0x1422('0x5c'),_0x1422('0x5d'),_0x1422('0x5e'),'lastonholdtime',_0x1422('0x5f'),'modifiedbyexternalpartyname',_0x1422('0x60'),_0x1422('0x61'),_0x1422('0x62'),_0x1422('0x63'),_0x1422('0x64'),'modifiedonbehalfbyyominame',_0x1422('0x65'),'msdyn_iotalertname',_0x1422('0x66'),_0x1422('0x67'),_0x1422('0x68'),'owneridname',_0x1422('0x69'),_0x1422('0x6a'),'parentcaseidname',_0x1422('0x6b'),_0x1422('0x6c'),_0x1422('0x6d'),'productidname',_0x1422('0x6e'),_0x1422('0x6f'),_0x1422('0x70'),_0x1422('0x71'),'responsiblecontactidname',_0x1422('0x72'),_0x1422('0x73'),'slainvokedidname','slaname','socialprofileidname',_0x1422('0x74'),'statuscode',_0x1422('0x75'),'ticketnumber','timezoneruleversionnumber',_0x1422('0x76'),'traversedpath',_0x1422('0x77'),'versionnumber'];var _0x29206e=_0x441fe8['concat'](_0x130dd6);return db['Dynamics365Account'][_0x1422('0x32')]({'where':{'id':_0x5cf230['params']['id']},'attributes':['id',_0x1422('0x78'),_0x1422('0x79'),_0x1422('0x7a'),'tenantId',_0x1422('0x7b'),'clientSecret','modernAuthentication'],'include':[{'model':db['CloudProvider'],'as':_0x1422('0x7c'),'attributes':['id',_0x1422('0x7d'),_0x1422('0x7e')]}]})[_0x1422('0xf')](handleEntityNotFound(_0x3b8fad,null))[_0x1422('0xf')](function(_0x20a95c){if(_0x20a95c){if(_0x20a95c['modernAuthentication']){_0x20a95c[_0x1422('0x7f')]=_0x20a95c[_0x1422('0x7c')][_0x1422('0x7d')];_0x368d1c=sanitizeRemoteUri(_0x20a95c[_0x1422('0x7c')][_0x1422('0x7e')]);_0x4782df=getWebApiUrl(_0x368d1c);return _0x20a95c;}_0x368d1c=sanitizeRemoteUri(_0x20a95c[_0x1422('0x7a')]);_0x4782df=getWebApiUrl(_0x368d1c);var _0x36a33c={'method':_0x1422('0x80'),'uri':_0x1422('0x81')+_0x20a95c[_0x1422('0x82')]+'/oauth2/token','form':{'client_id':_0x20a95c['clientId'],'resource':_0x368d1c,'username':_0x20a95c[_0x1422('0x78')],'password':_0x20a95c[_0x1422('0x79')],'grant_type':'password','client_secret':_0x20a95c[_0x1422('0x83')]},'json':!![]};return rp(_0x36a33c);}})[_0x1422('0xf')](function(_0x571f5a){_0x2d20c4=_0x571f5a[_0x1422('0x7f')];var _0x29d8a9={'method':_0x1422('0x84'),'uri':encodeURI(_0x4782df+_0x1422('0x85')+_0x565201+'\x27'),'headers':{'Authorization':_0x1422('0x86')+_0x2d20c4,'If-None-Match':null,'OData-Version':_0x1422('0x87')},'json':!![]};return rp(_0x29d8a9);})[_0x1422('0xf')](function(_0x4bc267){var _0x243c92=_0x4bc267[_0x1422('0x88')][0x0];var _0x6a4ba7=_0x243c92[_0x1422('0x89')];var _0x2b377b={'method':_0x1422('0x84'),'uri':_0x4782df+_0x1422('0x8a')+_0x6a4ba7+_0x1422('0x8b'),'headers':{'Authorization':_0x1422('0x86')+_0x2d20c4,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2b377b);})[_0x1422('0xf')](function(_0x355763){_0x40183a=_0x355763;_0x4800df=_0x40183a[_0x1422('0x8c')];_0x4800df=_['remove'](_0x4800df,function(_0x3823b7){return!_0x29206e['includes'](_0x3823b7[_0x1422('0x8d')]);});var _0x4fd089=[];var _0x1c9702=[];_0x4800df['forEach'](function(_0x462d8e){if(_0x462d8e['@odata.type']){var _0x44caa8=_0x462d8e[_0x1422('0x8e')][_0x1422('0x3e')](_0x462d8e[_0x1422('0x8e')][_0x1422('0x3f')]('.')+0x1);if(_0x44caa8==='PicklistAttributeMetadata'){_0x4fd089[_0x1422('0x8f')](getSelectList(_0x4782df,_0x266bed,_0x1c9702,_0x40183a[_0x1422('0x89')],_0x462d8e[_0x1422('0x89')],_0x2d20c4));}}});return Promise[_0x1422('0x90')](_0x4fd089);})['then'](function(_0x437f5c){_0x381d2c=_0x437f5c[0x0];var _0x57e06d=[];var _0x1821cb=[];_0x4800df[_0x1422('0x91')](function(_0x486071){if(!_[_0x1422('0x92')](_0x486071[_0x1422('0x8e')])){var _0x568437=_0x486071[_0x1422('0x8e')][_0x1422('0x3e')](_0x486071[_0x1422('0x8e')]['lastIndexOf']('.')+0x1);if(_0x568437===_0x1422('0x93')){_0x57e06d[_0x1422('0x8f')](getBooleanList(_0x4782df,_0x266bed,_0x1821cb,_0x40183a[_0x1422('0x89')],_0x486071['MetadataId'],_0x2d20c4));}}});return Promise[_0x1422('0x90')](_0x57e06d);})[_0x1422('0xf')](function(_0x5604cd){_0x1e4282=_0x5604cd[0x0];var _0x40a32d=[];var _0x1ab2cc=[];_0x4800df['forEach'](function(_0xf815f){if(_0xf815f[_0x1422('0x8e')]){var _0x28b641=_0xf815f[_0x1422('0x8e')][_0x1422('0x3e')](_0xf815f['@odata.type']['lastIndexOf']('.')+0x1);if(_0x28b641===_0x1422('0x94')||_0x28b641===_0x1422('0x95')||_0x28b641==='BigIntAttributeMetadata'||_0x28b641===_0x1422('0x96')||_0x28b641===_0x1422('0x97')||_0x28b641===_0x1422('0x98')||_0x28b641==='StatusAttributeMetadata'||_0x28b641==='EntityNameAttributeMetadata'||_0x28b641===_0x1422('0x99')||_0x28b641===_0x1422('0x9a')){_0x40a32d[_0x1422('0x8f')](getInputList(_0x4782df,_0x266bed,_0x28b641,_0x1ab2cc,_0x40183a['MetadataId'],_0xf815f[_0x1422('0x89')],_0x2d20c4));}}});return Promise[_0x1422('0x90')](_0x40a32d);})[_0x1422('0xf')](function(_0x5774ef){_0x2578e3=_0x5774ef[0x0];var _0x55bad2=_0x381d2c[_0x1422('0x9b')](_0x1e4282)[_0x1422('0x9b')](_0x2578e3);var _0x4b9070={'count':_0x55bad2[_0x1422('0x1e')],'rows':_0x55bad2};return _0x4b9070;})[_0x1422('0xf')](respondWithResult(_0x3b8fad,null))['catch'](function(_0x5ec27c){var _0x4686a2=_0x5cf230[_0x1422('0x19')][_0x1422('0x9c')]?0x1f4:_0x5ec27c['statusCode']||0x1f4;logger['error'](_0x5ec27c[_0x1422('0x12')]);delete _0x5ec27c['name'];if(_0x4686a2===0x191){_0x4686a2=0x190;}_0x3b8fad[_0x1422('0x6')](_0x4686a2)[_0x1422('0x14')](_0x5cf230['query']['test']?{'message':_0x1422('0x9d'),'statusCode':_0x5ec27c[_0x1422('0x9e')]}:_0x5ec27c);});};function getSelectList(_0x44026b,_0x2f1d39,_0x2358b5,_0x287127,_0x3e9b6e,_0x4b6e11){var _0x342488={'method':_0x1422('0x84'),'uri':_0x44026b+_0x1422('0x8a')+_0x287127+_0x1422('0x9f')+_0x3e9b6e+_0x1422('0xa0')+_0x1422('0xa1'),'headers':{'Authorization':_0x1422('0x86')+_0x4b6e11,'If-None-Match':null,'OData-Version':_0x1422('0x87')},'json':!![]};return rp(_0x342488)[_0x1422('0xf')](function(_0x5a86ee){var _0x42993a=[];var _0x35ccaf=_0x5a86ee[_0x1422('0xa2')]['Options'];_0x35ccaf[_0x1422('0x91')](function(_0x491d87){_0x42993a[_0x1422('0x8f')]({'name':_0x491d87[_0x1422('0xa3')]['UserLocalizedLabel'][_0x1422('0xa3')],'value':String(_0x491d87[_0x1422('0xa4')])});});var _0xa7c640={'id':_0x2f1d39+'_'+_0x5a86ee[_0x1422('0x8d')],'name':_0x5a86ee['DisplayName'][_0x1422('0xa5')][_0x1422('0xa3')],'custom':![],'options':_0x42993a};_0x2358b5[_0x1422('0x8f')](_0xa7c640);return _0x2358b5;});}function getBooleanList(_0x551a91,_0xc9bcff,_0x528215,_0x14e0b6,_0x3397a1,_0x5ab230){var _0x3b40b8={'method':_0x1422('0x84'),'uri':_0x551a91+'EntityDefinitions('+_0x14e0b6+_0x1422('0x9f')+_0x3397a1+_0x1422('0xa6'),'headers':{'Authorization':_0x1422('0x86')+_0x5ab230,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3b40b8)['then'](function(_0x358c30){var _0x26c43d=[];_0x26c43d[_0x1422('0x8f')]({'name':_0x358c30[_0x1422('0xa2')][_0x1422('0xa7')]['Label']['UserLocalizedLabel'][_0x1422('0xa3')],'value':'true'},{'name':_0x358c30[_0x1422('0xa2')][_0x1422('0xa8')][_0x1422('0xa3')][_0x1422('0xa5')][_0x1422('0xa3')],'value':_0x1422('0xa9')});var _0x1dbf7a={'id':_0xc9bcff+'_'+_0x358c30['LogicalName'],'name':_0x358c30[_0x1422('0xaa')]['UserLocalizedLabel'][_0x1422('0xa3')],'custom':![],'options':_0x26c43d};_0x528215[_0x1422('0x8f')](_0x1dbf7a);return _0x528215;});}function getInputList(_0x128709,_0x5c4030,_0x1dc7ac,_0x3988ac,_0x4485ea,_0x191c52,_0x3c3a4e){var _0x32f420={'method':'GET','uri':_0x128709+_0x1422('0x8a')+_0x4485ea+_0x1422('0x9f')+_0x191c52+')/Microsoft.Dynamics.CRM.'+_0x1dc7ac+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x3c3a4e,'If-None-Match':null,'OData-Version':_0x1422('0x87')},'json':!![]};return rp(_0x32f420)[_0x1422('0xf')](function(_0x59652e){var _0x1edc13={'id':_0x5c4030+'_'+_0x59652e['LogicalName'],'name':_0x59652e[_0x1422('0xaa')][_0x1422('0xa5')]?_0x59652e[_0x1422('0xaa')]['UserLocalizedLabel'][_0x1422('0xa3')]:_0x59652e[_0x1422('0x8d')],'custom':![],'options':[]};_0x3988ac[_0x1422('0x8f')](_0x1edc13);return _0x3988ac;});} \ No newline at end of file +var _0xcfa3=['getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientSecret','modernAuthentication','CloudProvider','data7','data5','POST','tenantId','clientId','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','Attributes','remove','includes','@odata.type','PicklistAttributeMetadata','push','all','forEach','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','Value','LogicalName','TrueOption','true','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','../../components/parsers/qs','../../config/logger','../../mysqldb','../../components/integrations/configuration','status','json','undefined','count','offset','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','rawAttributes','catch','create','body','params','find','getConfigurations','Dynamics365Configuration','addConfiguration','findOne','Subjects'];(function(_0x28ab78,_0x1b3462){var _0x2abc34=function(_0x5ef548){while(--_0x5ef548){_0x28ab78['push'](_0x28ab78['shift']());}};_0x2abc34(++_0x1b3462);}(_0xcfa3,0x88));var _0x3cfa=function(_0x2732b6,_0x39e5a1){_0x2732b6=_0x2732b6-0x0;var _0xd95214=_0xcfa3[_0x2732b6];return _0xd95214;};'use strict';var rp=require('request-promise');var util=require(_0x3cfa('0x0'));var _=require('lodash');var qs=require(_0x3cfa('0x1'));var logger=require(_0x3cfa('0x2'))('api');var db=require(_0x3cfa('0x3'))['db'];var integrations=require(_0x3cfa('0x4'));function respondWithResult(_0xb7434a,_0x156845){_0x156845=_0x156845||0xc8;return function(_0x1b98a3){if(_0x1b98a3){return _0xb7434a[_0x3cfa('0x5')](_0x156845)[_0x3cfa('0x6')](_0x1b98a3);}};}function respondWithFilteredResult(_0x454773,_0x568844){return function(_0x162ee7){if(_0x162ee7){var _0x3a7790=typeof _0x568844['offset']===_0x3cfa('0x7')&&typeof _0x568844['limit']==='undefined';var _0x870fa3=_0x162ee7[_0x3cfa('0x8')];var _0x3e1a35=_0x3a7790?0x0:_0x568844[_0x3cfa('0x9')];var _0x91dcae=_0x3a7790?_0x162ee7[_0x3cfa('0x8')]:_0x568844[_0x3cfa('0x9')]+_0x568844['limit'];var _0xc4c3a5;if(_0x91dcae>=_0x870fa3){_0x91dcae=_0x870fa3;_0xc4c3a5=0xc8;}else{_0xc4c3a5=0xce;}_0x454773[_0x3cfa('0x5')](_0xc4c3a5);return _0x454773['set'](_0x3cfa('0xa'),_0x3e1a35+'-'+_0x91dcae+'/'+_0x870fa3)[_0x3cfa('0x6')](_0x162ee7);}return null;};}function saveUpdates(_0x295f21){return function(_0x5e6d84){if(_0x5e6d84){return _0x5e6d84[_0x3cfa('0xb')](_0x295f21)[_0x3cfa('0xc')](function(_0x4c2044){return _0x4c2044;});}return null;};}function removeEntity(_0x223212){return function(_0x17ba2a){if(_0x17ba2a){return _0x17ba2a[_0x3cfa('0xd')]()[_0x3cfa('0xc')](function(){_0x223212[_0x3cfa('0x5')](0xcc)[_0x3cfa('0xe')]();});}};}function handleEntityNotFound(_0x3e7cf3){return function(_0x40ef51){if(!_0x40ef51){_0x3e7cf3[_0x3cfa('0xf')](0x194);}return _0x40ef51;};}function handleError(_0x254fd5,_0x176906){_0x176906=_0x176906||0x1f4;return function(_0xc16ce5){logger[_0x3cfa('0x10')](_0xc16ce5[_0x3cfa('0x11')]);if(_0xc16ce5[_0x3cfa('0x12')]){delete _0xc16ce5[_0x3cfa('0x12')];}_0x254fd5[_0x3cfa('0x5')](_0x176906)[_0x3cfa('0x13')](_0xc16ce5);};}exports[_0x3cfa('0x14')]=function(_0x42754a,_0x3d8ace){var _0x405414={},_0x1f655a={},_0x23c7b0={'count':0x0,'rows':[]};var _0x51699a=_[_0x3cfa('0x15')](db[_0x3cfa('0x16')]['rawAttributes'],function(_0x45ee11){return{'name':_0x45ee11['fieldName'],'type':_0x45ee11[_0x3cfa('0x17')][_0x3cfa('0x18')]};});_0x1f655a[_0x3cfa('0x19')]=_['map'](_0x51699a,'name');_0x1f655a[_0x3cfa('0x1a')]=_[_0x3cfa('0x1b')](_0x42754a[_0x3cfa('0x1a')]);_0x1f655a[_0x3cfa('0x1c')]=_['intersection'](_0x1f655a[_0x3cfa('0x19')],_0x1f655a[_0x3cfa('0x1a')]);_0x405414['attributes']=_[_0x3cfa('0x1d')](_0x1f655a[_0x3cfa('0x19')],qs[_0x3cfa('0x1e')](_0x42754a['query']['fields']));_0x405414[_0x3cfa('0x1f')]=_0x405414[_0x3cfa('0x1f')][_0x3cfa('0x20')]?_0x405414[_0x3cfa('0x1f')]:_0x1f655a['model'];if(!_0x42754a[_0x3cfa('0x1a')][_0x3cfa('0x21')](_0x3cfa('0x22'))){_0x405414['limit']=qs[_0x3cfa('0x23')](_0x42754a['query'][_0x3cfa('0x23')]);_0x405414[_0x3cfa('0x9')]=qs['offset'](_0x42754a[_0x3cfa('0x1a')][_0x3cfa('0x9')]);}_0x405414[_0x3cfa('0x24')]=qs[_0x3cfa('0x25')](_0x42754a[_0x3cfa('0x1a')][_0x3cfa('0x25')]);_0x405414[_0x3cfa('0x26')]=qs[_0x3cfa('0x1c')](_[_0x3cfa('0x27')](_0x42754a[_0x3cfa('0x1a')],_0x1f655a[_0x3cfa('0x1c')]),_0x51699a);if(_0x42754a['query'][_0x3cfa('0x28')]){_0x405414[_0x3cfa('0x26')]=_[_0x3cfa('0x29')](_0x405414['where'],{'$or':_[_0x3cfa('0x15')](_0x51699a,function(_0x5b9184){if(_0x5b9184[_0x3cfa('0x17')]!==_0x3cfa('0x2a')){var _0x9f7d78={};_0x9f7d78[_0x5b9184[_0x3cfa('0x12')]]={'$like':'%'+_0x42754a[_0x3cfa('0x1a')][_0x3cfa('0x28')]+'%'};return _0x9f7d78;}})});}_0x405414=_[_0x3cfa('0x29')]({},_0x405414,_0x42754a[_0x3cfa('0x2b')]);var _0x246659={'where':_0x405414[_0x3cfa('0x26')]};return db[_0x3cfa('0x16')][_0x3cfa('0x8')](_0x246659)[_0x3cfa('0xc')](function(_0x38fc42){_0x23c7b0[_0x3cfa('0x8')]=_0x38fc42;if(_0x42754a[_0x3cfa('0x1a')][_0x3cfa('0x2c')]){_0x405414[_0x3cfa('0x2d')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x3cfa('0x2e')](_0x405414);})[_0x3cfa('0xc')](function(_0x561618){_0x23c7b0[_0x3cfa('0x2f')]=_0x561618;return _0x23c7b0;})[_0x3cfa('0xc')](respondWithFilteredResult(_0x3d8ace,_0x405414))['catch'](handleError(_0x3d8ace,null));};exports['show']=function(_0x45b7a7,_0x43ab5a){var _0x43a948={'raw':![],'where':{'id':_0x45b7a7['params']['id']}},_0x4c72fb={};_0x4c72fb[_0x3cfa('0x19')]=_[_0x3cfa('0x1b')](db['Dynamics365Account'][_0x3cfa('0x30')]);_0x4c72fb[_0x3cfa('0x1a')]=_['keys'](_0x45b7a7[_0x3cfa('0x1a')]);_0x4c72fb[_0x3cfa('0x1c')]=_[_0x3cfa('0x1d')](_0x4c72fb[_0x3cfa('0x19')],_0x4c72fb['query']);_0x43a948[_0x3cfa('0x1f')]=_[_0x3cfa('0x1d')](_0x4c72fb[_0x3cfa('0x19')],qs[_0x3cfa('0x1e')](_0x45b7a7[_0x3cfa('0x1a')]['fields']));_0x43a948['attributes']=_0x43a948[_0x3cfa('0x1f')]['length']?_0x43a948[_0x3cfa('0x1f')]:_0x4c72fb[_0x3cfa('0x19')];if(_0x45b7a7[_0x3cfa('0x1a')][_0x3cfa('0x2c')]){_0x43a948['include']=[{'all':!![]}];}_0x43a948=_[_0x3cfa('0x29')]({},_0x43a948,_0x45b7a7[_0x3cfa('0x2b')]);return db['Dynamics365Account']['find'](_0x43a948)[_0x3cfa('0xc')](handleEntityNotFound(_0x43ab5a,null))[_0x3cfa('0xc')](respondWithResult(_0x43ab5a,null))[_0x3cfa('0x31')](handleError(_0x43ab5a,null));};exports[_0x3cfa('0x32')]=function(_0x30b018,_0x10937e){return db[_0x3cfa('0x16')]['create'](_0x30b018[_0x3cfa('0x33')],{})[_0x3cfa('0xc')](respondWithResult(_0x10937e,0xc9))[_0x3cfa('0x31')](handleError(_0x10937e,null));};exports[_0x3cfa('0xb')]=function(_0x5d60ec,_0x4b6bd5){if(_0x5d60ec['body']['id']){delete _0x5d60ec[_0x3cfa('0x33')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x5d60ec[_0x3cfa('0x34')]['id']}})['then'](handleEntityNotFound(_0x4b6bd5,null))[_0x3cfa('0xc')](saveUpdates(_0x5d60ec['body'],null))[_0x3cfa('0xc')](respondWithResult(_0x4b6bd5,null))[_0x3cfa('0x31')](handleError(_0x4b6bd5,null));};exports[_0x3cfa('0xd')]=function(_0x5f47b9,_0x14ecb4){return db[_0x3cfa('0x16')][_0x3cfa('0x35')]({'where':{'id':_0x5f47b9['params']['id']}})['then'](handleEntityNotFound(_0x14ecb4,null))['then'](removeEntity(_0x14ecb4,null))[_0x3cfa('0x31')](handleError(_0x14ecb4,null));};exports[_0x3cfa('0x36')]=function(_0x5ace98,_0x3c926a){var _0x40e3fe={};var _0x25523d={};var _0x2cc825;var _0x3a057f;return db[_0x3cfa('0x16')]['findOne']({'where':{'id':_0x5ace98[_0x3cfa('0x34')]['id']}})[_0x3cfa('0xc')](handleEntityNotFound(_0x3c926a,null))[_0x3cfa('0xc')](function(_0x55fa89){if(_0x55fa89){_0x2cc825=_0x55fa89;_0x25523d[_0x3cfa('0x19')]=_[_0x3cfa('0x1b')](db[_0x3cfa('0x37')][_0x3cfa('0x30')]);_0x25523d[_0x3cfa('0x1a')]=_['keys'](_0x5ace98[_0x3cfa('0x1a')]);_0x25523d[_0x3cfa('0x1c')]=_[_0x3cfa('0x1d')](_0x25523d[_0x3cfa('0x19')],_0x25523d[_0x3cfa('0x1a')]);_0x40e3fe[_0x3cfa('0x1f')]=_['intersection'](_0x25523d[_0x3cfa('0x19')],qs[_0x3cfa('0x1e')](_0x5ace98[_0x3cfa('0x1a')]['fields']));_0x40e3fe['attributes']=_0x40e3fe['attributes']['length']?_0x40e3fe[_0x3cfa('0x1f')]:_0x25523d[_0x3cfa('0x19')];_0x40e3fe['order']=qs['sort'](_0x5ace98[_0x3cfa('0x1a')][_0x3cfa('0x25')]);_0x40e3fe[_0x3cfa('0x26')]=qs[_0x3cfa('0x1c')](_['pick'](_0x5ace98[_0x3cfa('0x1a')],_0x25523d[_0x3cfa('0x1c')]));if(_0x5ace98['query'][_0x3cfa('0x28')]){_0x40e3fe['where']=_[_0x3cfa('0x29')](_0x40e3fe[_0x3cfa('0x26')],{'$or':_['map'](_0x40e3fe[_0x3cfa('0x1f')],function(_0x458cdb){var _0x5a0c47={};_0x5a0c47[_0x458cdb]={'$like':'%'+_0x5ace98[_0x3cfa('0x1a')][_0x3cfa('0x28')]+'%'};return _0x5a0c47;})});}_0x40e3fe=_[_0x3cfa('0x29')]({},_0x40e3fe,_0x5ace98[_0x3cfa('0x2b')]);return _0x2cc825[_0x3cfa('0x36')](_0x40e3fe);}})[_0x3cfa('0xc')](function(_0x14fb3e){if(_0x14fb3e){_0x3a057f=_0x14fb3e[_0x3cfa('0x20')];if(!_0x5ace98[_0x3cfa('0x1a')][_0x3cfa('0x21')]('nolimit')){_0x40e3fe[_0x3cfa('0x23')]=qs['limit'](_0x5ace98[_0x3cfa('0x1a')][_0x3cfa('0x23')]);_0x40e3fe['offset']=qs[_0x3cfa('0x9')](_0x5ace98[_0x3cfa('0x1a')][_0x3cfa('0x9')]);}return _0x2cc825[_0x3cfa('0x36')](_0x40e3fe);}})[_0x3cfa('0xc')](function(_0x5251fa){if(_0x5251fa){return _0x5251fa?{'count':_0x3a057f,'rows':_0x5251fa}:null;}})[_0x3cfa('0xc')](respondWithResult(_0x3c926a,null))[_0x3cfa('0x31')](handleError(_0x3c926a,null));};exports[_0x3cfa('0x38')]=function(_0xe400a1,_0x19ec34){if(_0xe400a1[_0x3cfa('0x33')]['id']){delete _0xe400a1[_0x3cfa('0x33')]['id'];}return db['Dynamics365Account'][_0x3cfa('0x39')]({'where':{'id':_0xe400a1[_0x3cfa('0x34')]['id']}})[_0x3cfa('0xc')](handleEntityNotFound(_0x19ec34,null))[_0x3cfa('0xc')](function(_0x219341){if(_0x219341){_0xe400a1['body']['AccountId']=_0x219341['id'];_0xe400a1[_0x3cfa('0x33')][_0x3cfa('0x3a')]=integrations[_0x3cfa('0x3b')](_0xe400a1[_0x3cfa('0x33')][_0x3cfa('0x3c')],_0xe400a1['body']['type']);_0xe400a1[_0x3cfa('0x33')][_0x3cfa('0x3d')]=integrations[_0x3cfa('0x3e')](_0xe400a1['body'][_0x3cfa('0x3c')],_0xe400a1[_0x3cfa('0x33')]['type']);return db[_0x3cfa('0x37')][_0x3cfa('0x32')](_0xe400a1[_0x3cfa('0x33')],{'include':[{'model':db['Dynamics365Field'],'as':_0x3cfa('0x3a')},{'model':db[_0x3cfa('0x3f')],'as':_0x3cfa('0x3d')}]});}return null;})[_0x3cfa('0xc')](respondWithResult(_0x19ec34,null))[_0x3cfa('0x31')](handleError(_0x19ec34,null));};function sanitizeRemoteUri(_0x1727a3){var _0x41e085=_0x1727a3[_0x3cfa('0x40')](-0x1);if(_0x41e085==='/')return _0x1727a3[_0x3cfa('0x41')](0x0,_0x1727a3[_0x3cfa('0x42')](_0x41e085));return _0x1727a3;}function getWebApiUrl(_0x83ebb9){return util[_0x3cfa('0x43')](_0x3cfa('0x44'),_0x83ebb9);}exports[_0x3cfa('0x45')]=function(_0x225bd6,_0x3a6863){var _0x240237=_0x225bd6[_0x3cfa('0x1a')][_0x3cfa('0x46')];var _0x2749a3=_0x240237===_0x3cfa('0x47')?_0x3cfa('0x48'):_0x3cfa('0x49');var _0xf4ae1a='';var _0x4aba90='';var _0x34f1a0='';var _0xcfa233='';var _0x5c2335='';var _0x262420='';var _0x261236='';var _0x34ea17='';var _0x2a6d9b=[_0x3cfa('0x4a'),_0x3cfa('0x4b'),_0x3cfa('0x4c'),_0x3cfa('0x4d'),'caseorigincode',_0x3cfa('0x4e'),_0x3cfa('0x4f'),_0x3cfa('0x50'),_0x3cfa('0x51'),_0x3cfa('0x52')];var _0x24686b=[_0x3cfa('0x53'),_0x3cfa('0x54'),'actualserviceunits',_0x3cfa('0x55'),_0x3cfa('0x56'),_0x3cfa('0x57'),_0x3cfa('0x58'),_0x3cfa('0x59'),_0x3cfa('0x5a'),'createdbyexternalpartyyominame',_0x3cfa('0x5b'),_0x3cfa('0x5c'),_0x3cfa('0x5d'),_0x3cfa('0x5e'),'createdonbehalfbyyominame',_0x3cfa('0x5f'),_0x3cfa('0x60'),_0x3cfa('0x61'),_0x3cfa('0x62'),_0x3cfa('0x63'),_0x3cfa('0x64'),'entityimage_url',_0x3cfa('0x65'),_0x3cfa('0x66'),_0x3cfa('0x67'),_0x3cfa('0x68'),'importsequencenumber','influencescore',_0x3cfa('0x69'),_0x3cfa('0x6a'),_0x3cfa('0x6b'),_0x3cfa('0x6c'),_0x3cfa('0x6d'),_0x3cfa('0x6e'),_0x3cfa('0x6f'),_0x3cfa('0x70'),_0x3cfa('0x71'),_0x3cfa('0x72'),'msdyn_incidenttypename','msdyn_iotalertname',_0x3cfa('0x73'),_0x3cfa('0x74'),'overriddencreatedon',_0x3cfa('0x75'),_0x3cfa('0x76'),_0x3cfa('0x77'),_0x3cfa('0x78'),_0x3cfa('0x79'),_0x3cfa('0x7a'),'prioritycodename',_0x3cfa('0x7b'),_0x3cfa('0x7c'),_0x3cfa('0x7d'),_0x3cfa('0x7e'),'responseby',_0x3cfa('0x7f'),_0x3cfa('0x80'),'sentimentvalue',_0x3cfa('0x81'),_0x3cfa('0x82'),_0x3cfa('0x83'),_0x3cfa('0x84'),'statuscode',_0x3cfa('0x85'),_0x3cfa('0x86'),_0x3cfa('0x87'),_0x3cfa('0x88'),_0x3cfa('0x89'),_0x3cfa('0x8a'),_0x3cfa('0x8b')];var _0x117f04=_0x2a6d9b[_0x3cfa('0x8c')](_0x24686b);return db[_0x3cfa('0x16')][_0x3cfa('0x39')]({'where':{'id':_0x225bd6[_0x3cfa('0x34')]['id']},'attributes':['id',_0x3cfa('0x8d'),_0x3cfa('0x8e'),_0x3cfa('0x8f'),'tenantId','clientId',_0x3cfa('0x90'),_0x3cfa('0x91')],'include':[{'model':db[_0x3cfa('0x92')],'as':_0x3cfa('0x92'),'attributes':['id','data5',_0x3cfa('0x93')]}]})[_0x3cfa('0xc')](handleEntityNotFound(_0x3a6863,null))[_0x3cfa('0xc')](function(_0x83b1fb){if(_0x83b1fb){if(_0x83b1fb[_0x3cfa('0x91')]){_0x83b1fb['access_token']=_0x83b1fb['CloudProvider'][_0x3cfa('0x94')];_0x34ea17=sanitizeRemoteUri(_0x83b1fb[_0x3cfa('0x92')]['data7']);_0x261236=getWebApiUrl(_0x34ea17);return _0x83b1fb;}_0x34ea17=sanitizeRemoteUri(_0x83b1fb[_0x3cfa('0x8f')]);_0x261236=getWebApiUrl(_0x34ea17);var _0x48a06f={'method':_0x3cfa('0x95'),'uri':'https://login.microsoftonline.com/'+_0x83b1fb[_0x3cfa('0x96')]+'/oauth2/token','form':{'client_id':_0x83b1fb[_0x3cfa('0x97')],'resource':_0x34ea17,'username':_0x83b1fb['username'],'password':_0x83b1fb[_0x3cfa('0x8e')],'grant_type':_0x3cfa('0x8e'),'client_secret':_0x83b1fb[_0x3cfa('0x90')]},'json':!![]};return rp(_0x48a06f);}})[_0x3cfa('0xc')](function(_0x36eb23){_0x262420=_0x36eb23[_0x3cfa('0x98')];var _0x144e82={'method':_0x3cfa('0x99'),'uri':encodeURI(_0x261236+_0x3cfa('0x9a')+_0x2749a3+'\x27'),'headers':{'Authorization':_0x3cfa('0x9b')+_0x262420,'If-None-Match':null,'OData-Version':_0x3cfa('0x9c')},'json':!![]};return rp(_0x144e82);})[_0x3cfa('0xc')](function(_0x12b302){var _0x2c4245=_0x12b302[_0x3cfa('0x9d')][0x0];var _0x557637=_0x2c4245[_0x3cfa('0x9e')];var _0x3204fb={'method':_0x3cfa('0x99'),'uri':_0x261236+'EntityDefinitions('+_0x557637+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x3cfa('0x9b')+_0x262420,'If-None-Match':null,'OData-Version':_0x3cfa('0x9c')},'json':!![]};return rp(_0x3204fb);})[_0x3cfa('0xc')](function(_0x57d7c3){_0xf4ae1a=_0x57d7c3;_0x4aba90=_0xf4ae1a[_0x3cfa('0x9f')];_0x4aba90=_[_0x3cfa('0xa0')](_0x4aba90,function(_0x4804bc){return!_0x117f04[_0x3cfa('0xa1')](_0x4804bc['LogicalName']);});var _0x257321=[];var _0x4c6cce=[];_0x4aba90['forEach'](function(_0x7b5bf1){if(_0x7b5bf1[_0x3cfa('0xa2')]){var _0xd74b01=_0x7b5bf1['@odata.type'][_0x3cfa('0x41')](_0x7b5bf1[_0x3cfa('0xa2')]['lastIndexOf']('.')+0x1);if(_0xd74b01===_0x3cfa('0xa3')){_0x257321[_0x3cfa('0xa4')](getSelectList(_0x261236,_0x240237,_0x4c6cce,_0xf4ae1a[_0x3cfa('0x9e')],_0x7b5bf1[_0x3cfa('0x9e')],_0x262420));}}});return Promise[_0x3cfa('0xa5')](_0x257321);})[_0x3cfa('0xc')](function(_0xfec8a5){_0x34f1a0=_0xfec8a5[0x0];var _0x51f217=[];var _0x5a3079=[];_0x4aba90[_0x3cfa('0xa6')](function(_0x56a9de){if(!_['isNil'](_0x56a9de[_0x3cfa('0xa2')])){var _0x1cdd97=_0x56a9de[_0x3cfa('0xa2')]['substring'](_0x56a9de[_0x3cfa('0xa2')][_0x3cfa('0x42')]('.')+0x1);if(_0x1cdd97===_0x3cfa('0xa7')){_0x51f217['push'](getBooleanList(_0x261236,_0x240237,_0x5a3079,_0xf4ae1a[_0x3cfa('0x9e')],_0x56a9de['MetadataId'],_0x262420));}}});return Promise['all'](_0x51f217);})[_0x3cfa('0xc')](function(_0x1dcef0){_0xcfa233=_0x1dcef0[0x0];var _0x37406e=[];var _0x491e5d=[];_0x4aba90['forEach'](function(_0x27d3a4){if(_0x27d3a4[_0x3cfa('0xa2')]){var _0x32653b=_0x27d3a4['@odata.type']['substring'](_0x27d3a4[_0x3cfa('0xa2')][_0x3cfa('0x42')]('.')+0x1);if(_0x32653b===_0x3cfa('0xa8')||_0x32653b===_0x3cfa('0xa9')||_0x32653b===_0x3cfa('0xaa')||_0x32653b===_0x3cfa('0xab')||_0x32653b===_0x3cfa('0xac')||_0x32653b===_0x3cfa('0xad')||_0x32653b===_0x3cfa('0xae')||_0x32653b===_0x3cfa('0xaf')||_0x32653b===_0x3cfa('0xb0')||_0x32653b===_0x3cfa('0xb1')){_0x37406e['push'](getInputList(_0x261236,_0x240237,_0x32653b,_0x491e5d,_0xf4ae1a[_0x3cfa('0x9e')],_0x27d3a4[_0x3cfa('0x9e')],_0x262420));}}});return Promise['all'](_0x37406e);})[_0x3cfa('0xc')](function(_0x3242dd){_0x5c2335=_0x3242dd[0x0];var _0x4c5758=_0x34f1a0['concat'](_0xcfa233)[_0x3cfa('0x8c')](_0x5c2335);var _0x371aa6={'count':_0x4c5758[_0x3cfa('0x20')],'rows':_0x4c5758};return _0x371aa6;})[_0x3cfa('0xc')](respondWithResult(_0x3a6863,null))['catch'](function(_0x126330){var _0x138638=_0x225bd6[_0x3cfa('0x1a')][_0x3cfa('0xb2')]?0x1f4:_0x126330[_0x3cfa('0xb3')]||0x1f4;logger[_0x3cfa('0x10')](_0x126330[_0x3cfa('0x11')]);delete _0x126330[_0x3cfa('0x12')];if(_0x138638===0x191){_0x138638=0x190;}_0x3a6863['status'](_0x138638)[_0x3cfa('0x13')](_0x225bd6[_0x3cfa('0x1a')][_0x3cfa('0xb2')]?{'message':'Wrong\x20credentials','statusCode':_0x126330[_0x3cfa('0xb3')]}:_0x126330);});};function getSelectList(_0x2089fe,_0xb7253e,_0x27faf2,_0x4c4bc5,_0x5891b3,_0xfeb0ff){var _0x3d11bc={'method':'GET','uri':_0x2089fe+_0x3cfa('0xb4')+_0x4c4bc5+_0x3cfa('0xb5')+_0x5891b3+_0x3cfa('0xb6')+_0x3cfa('0xb7'),'headers':{'Authorization':_0x3cfa('0x9b')+_0xfeb0ff,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3d11bc)[_0x3cfa('0xc')](function(_0x2b10c0){var _0x132e4c=[];var _0x2dddac=_0x2b10c0[_0x3cfa('0xb8')][_0x3cfa('0xb9')];_0x2dddac[_0x3cfa('0xa6')](function(_0x4c46f7){_0x132e4c[_0x3cfa('0xa4')]({'name':_0x4c46f7['Label'][_0x3cfa('0xba')][_0x3cfa('0xbb')],'value':String(_0x4c46f7[_0x3cfa('0xbc')])});});var _0x556a28={'id':_0xb7253e+'_'+_0x2b10c0[_0x3cfa('0xbd')],'name':_0x2b10c0['DisplayName'][_0x3cfa('0xba')][_0x3cfa('0xbb')],'custom':![],'options':_0x132e4c};_0x27faf2[_0x3cfa('0xa4')](_0x556a28);return _0x27faf2;});}function getBooleanList(_0x4f72ef,_0x1a0a56,_0x34f533,_0x22529d,_0x26f19d,_0x5f1295){var _0x5f0f16={'method':_0x3cfa('0x99'),'uri':_0x4f72ef+_0x3cfa('0xb4')+_0x22529d+')/Attributes('+_0x26f19d+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x5f1295,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5f0f16)['then'](function(_0x5ea596){var _0x1f0c82=[];_0x1f0c82[_0x3cfa('0xa4')]({'name':_0x5ea596[_0x3cfa('0xb8')][_0x3cfa('0xbe')][_0x3cfa('0xbb')][_0x3cfa('0xba')][_0x3cfa('0xbb')],'value':_0x3cfa('0xbf')},{'name':_0x5ea596[_0x3cfa('0xb8')]['FalseOption']['Label'][_0x3cfa('0xba')][_0x3cfa('0xbb')],'value':'false'});var _0x10a744={'id':_0x1a0a56+'_'+_0x5ea596[_0x3cfa('0xbd')],'name':_0x5ea596[_0x3cfa('0xc0')][_0x3cfa('0xba')][_0x3cfa('0xbb')],'custom':![],'options':_0x1f0c82};_0x34f533[_0x3cfa('0xa4')](_0x10a744);return _0x34f533;});}function getInputList(_0x8dda45,_0x5d9977,_0x17d65f,_0x2cc024,_0x302f42,_0x54cbce,_0x274486){var _0x3c69dc={'method':'GET','uri':_0x8dda45+_0x3cfa('0xb4')+_0x302f42+')/Attributes('+_0x54cbce+_0x3cfa('0xc1')+_0x17d65f+_0x3cfa('0xc2'),'headers':{'Authorization':_0x3cfa('0x9b')+_0x274486,'If-None-Match':null,'OData-Version':_0x3cfa('0x9c')},'json':!![]};return rp(_0x3c69dc)[_0x3cfa('0xc')](function(_0x5170b1){var _0x5d96fa={'id':_0x5d9977+'_'+_0x5170b1[_0x3cfa('0xbd')],'name':_0x5170b1['DisplayName'][_0x3cfa('0xba')]?_0x5170b1[_0x3cfa('0xc0')]['UserLocalizedLabel'][_0x3cfa('0xbb')]:_0x5170b1[_0x3cfa('0xbd')],'custom':![],'options':[]};_0x2cc024['push'](_0x5d96fa);return _0x2cc024;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 411332c..8c24278 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x29509b,_0x2b2348){var _0x286cc4=function(_0x1e71ca){while(--_0x1e71ca){_0x29509b['push'](_0x29509b['shift']());}};_0x286cc4(++_0x2b2348);}(_0xe706,0xa3));var _0x6e70=function(_0x2136d5,_0x4b0479){_0x2136d5=_0x2136d5-0x0;var _0x3bee2e=_0xe706[_0x2136d5];return _0x3bee2e;};'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'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0xfa15e1,_0x5dd0d1){var _0x18b362=function(_0x2203af){while(--_0x2203af){_0xfa15e1['push'](_0xfa15e1['shift']());}};_0x18b362(++_0x5dd0d1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 3167841..75062f1 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 _0x7bbb=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','limit','map','include','model','then','ShowDynamics365Account','find','lodash'];(function(_0x31777f,_0x2342ce){var _0x379924=function(_0x137c89){while(--_0x137c89){_0x31777f['push'](_0x31777f['shift']());}};_0x379924(++_0x2342ce);}(_0x7bbb,0x18b));var _0xb7bb=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x7bbb[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0xb7bb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb7bb('0x1'));var rs=require(_0xb7bb('0x2'));var fs=require('fs');var Redis=require(_0xb7bb('0x3'));var db=require(_0xb7bb('0x4'))['db'];var utils=require(_0xb7bb('0x5'));var logger=require(_0xb7bb('0x6'))(_0xb7bb('0x7'));var config=require(_0xb7bb('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x304911,_0x2d97c5,_0x4da8e8){return new BPromise(function(_0x45c431,_0x52377f){return client[_0xb7bb('0x9')](_0x304911,_0x4da8e8)['then'](function(_0x425626){logger[_0xb7bb('0xa')](_0xb7bb('0xb'),_0x2d97c5,_0xb7bb('0xc'));logger[_0xb7bb('0xd')](_0xb7bb('0xe'),_0x2d97c5,'request\x20sent',JSON[_0xb7bb('0xf')](_0x425626));if(_0x425626[_0xb7bb('0x10')]){if(_0x425626[_0xb7bb('0x10')]['code']===0x1f4){logger[_0xb7bb('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x2d97c5,_0x425626['error'][_0xb7bb('0x11')]);return _0x52377f(_0x425626[_0xb7bb('0x10')][_0xb7bb('0x11')]);}logger[_0xb7bb('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x2d97c5,_0x425626[_0xb7bb('0x10')][_0xb7bb('0x11')]);return _0x45c431(_0x425626[_0xb7bb('0x10')][_0xb7bb('0x11')]);}else{logger[_0xb7bb('0xa')](_0xb7bb('0xb'),_0x2d97c5,_0xb7bb('0xc'));_0x45c431(_0x425626[_0xb7bb('0x12')]['message']);}})[_0xb7bb('0x13')](function(_0x4afaaa){logger[_0xb7bb('0x10')](_0xb7bb('0xb'),_0x2d97c5,_0x4afaaa);_0x52377f(_0x4afaaa);});});}exports[_0xb7bb('0x14')]=function(_0x17534a){var _0x3aea50=this;return new Promise(function(_0x1b3d92,_0x50ff5f){return db[_0xb7bb('0x15')]['findAll']({'raw':_0x17534a[_0xb7bb('0x16')]?_0x17534a[_0xb7bb('0x16')][_0xb7bb('0x17')]===undefined?!![]:![]:!![],'where':_0x17534a[_0xb7bb('0x16')]?_0x17534a[_0xb7bb('0x16')][_0xb7bb('0x18')]||null:null,'attributes':_0x17534a[_0xb7bb('0x16')]?_0x17534a[_0xb7bb('0x16')][_0xb7bb('0x19')]||null:null,'limit':_0x17534a[_0xb7bb('0x16')]?_0x17534a[_0xb7bb('0x16')][_0xb7bb('0x1a')]||null:null,'include':_0x17534a['options']?_0x17534a[_0xb7bb('0x16')]['include']?_[_0xb7bb('0x1b')](_0x17534a[_0xb7bb('0x16')][_0xb7bb('0x1c')],function(_0x1f5c7a){return{'model':db[_0x1f5c7a['model']],'as':_0x1f5c7a['as'],'attributes':_0x1f5c7a[_0xb7bb('0x19')],'include':_0x1f5c7a[_0xb7bb('0x1c')]?_[_0xb7bb('0x1b')](_0x1f5c7a[_0xb7bb('0x1c')],function(_0x3968d0){return{'model':db[_0x3968d0[_0xb7bb('0x1d')]],'as':_0x3968d0['as'],'attributes':_0x3968d0[_0xb7bb('0x19')],'include':_0x3968d0[_0xb7bb('0x1c')]?_[_0xb7bb('0x1b')](_0x3968d0['include'],function(_0x5d08d8){return{'model':db[_0x5d08d8['model']],'as':_0x5d08d8['as'],'attributes':_0x5d08d8[_0xb7bb('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb7bb('0x1e')](function(_0x4c7de5){logger['info']('GetDynamics365Account',_0x17534a);logger['debug'](_0xb7bb('0x14'),_0x17534a,JSON[_0xb7bb('0xf')](_0x4c7de5));_0x1b3d92(_0x4c7de5);})[_0xb7bb('0x13')](function(_0x456b2c){logger[_0xb7bb('0x10')](_0xb7bb('0x14'),_0x456b2c[_0xb7bb('0x11')],_0x17534a);_0x50ff5f(_0x3aea50[_0xb7bb('0x10')](0x1f4,_0x456b2c[_0xb7bb('0x11')]));});});};exports[_0xb7bb('0x1f')]=function(_0x197570){var _0x3a83d6=this;return new Promise(function(_0x4f9a4f,_0x9cee46){return db[_0xb7bb('0x15')][_0xb7bb('0x20')]({'raw':_0x197570[_0xb7bb('0x16')]?_0x197570[_0xb7bb('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x197570[_0xb7bb('0x16')]?_0x197570[_0xb7bb('0x16')][_0xb7bb('0x18')]||null:null,'attributes':_0x197570[_0xb7bb('0x16')]?_0x197570[_0xb7bb('0x16')][_0xb7bb('0x19')]||null:null,'include':_0x197570[_0xb7bb('0x16')]?_0x197570[_0xb7bb('0x16')][_0xb7bb('0x1c')]?_[_0xb7bb('0x1b')](_0x197570['options'][_0xb7bb('0x1c')],function(_0x24e474){return{'model':db[_0x24e474[_0xb7bb('0x1d')]],'as':_0x24e474['as'],'attributes':_0x24e474[_0xb7bb('0x19')],'include':_0x24e474[_0xb7bb('0x1c')]?_['map'](_0x24e474[_0xb7bb('0x1c')],function(_0x4dc236){return{'model':db[_0x4dc236['model']],'as':_0x4dc236['as'],'attributes':_0x4dc236[_0xb7bb('0x19')],'include':_0x4dc236['include']?_[_0xb7bb('0x1b')](_0x4dc236['include'],function(_0x3cf856){return{'model':db[_0x3cf856['model']],'as':_0x3cf856['as'],'attributes':_0x3cf856[_0xb7bb('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb7bb('0x1e')](function(_0x271148){logger['info'](_0xb7bb('0x1f'),_0x197570);logger[_0xb7bb('0xd')](_0xb7bb('0x1f'),_0x197570,JSON['stringify'](_0x271148));_0x4f9a4f(_0x271148);})[_0xb7bb('0x13')](function(_0x1415a2){logger[_0xb7bb('0x10')](_0xb7bb('0x1f'),_0x1415a2[_0xb7bb('0x11')],_0x197570);_0x9cee46(_0x3a83d6[_0xb7bb('0x10')](0x1f4,_0x1415a2['message']));});});}; \ No newline at end of file +var _0xb34b=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','limit','include','map','model','find','where','ShowDynamics365Account','lodash'];(function(_0x386bbe,_0x525293){var _0x22ab48=function(_0x13605a){while(--_0x13605a){_0x386bbe['push'](_0x386bbe['shift']());}};_0x22ab48(++_0x525293);}(_0xb34b,0x1e9));var _0xbb34=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xb34b[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xbb34('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbb34('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb34('0x2'));var db=require(_0xbb34('0x3'))['db'];var utils=require(_0xbb34('0x4'));var logger=require('../../config/logger')(_0xbb34('0x5'));var config=require(_0xbb34('0x6'));var jayson=require(_0xbb34('0x7'));var client=jayson[_0xbb34('0x8')][_0xbb34('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5488f9,_0x56d00b,_0x1854b7){return new BPromise(function(_0x37e05f,_0x1d0730){return client[_0xbb34('0xa')](_0x5488f9,_0x1854b7)[_0xbb34('0xb')](function(_0x1b5e30){logger[_0xbb34('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x56d00b,'request\x20sent');logger[_0xbb34('0xd')](_0xbb34('0xe'),_0x56d00b,_0xbb34('0xf'),JSON[_0xbb34('0x10')](_0x1b5e30));if(_0x1b5e30[_0xbb34('0x11')]){if(_0x1b5e30['error']['code']===0x1f4){logger[_0xbb34('0x11')](_0xbb34('0x12'),_0x56d00b,_0x1b5e30[_0xbb34('0x11')][_0xbb34('0x13')]);return _0x1d0730(_0x1b5e30[_0xbb34('0x11')][_0xbb34('0x13')]);}logger[_0xbb34('0x11')](_0xbb34('0x12'),_0x56d00b,_0x1b5e30[_0xbb34('0x11')][_0xbb34('0x13')]);return _0x37e05f(_0x1b5e30[_0xbb34('0x11')][_0xbb34('0x13')]);}else{logger[_0xbb34('0xc')](_0xbb34('0x12'),_0x56d00b,_0xbb34('0xf'));_0x37e05f(_0x1b5e30[_0xbb34('0x14')]['message']);}})[_0xbb34('0x15')](function(_0x51107b){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x56d00b,_0x51107b);_0x1d0730(_0x51107b);});});}exports[_0xbb34('0x16')]=function(_0x5bade6){var _0x4f6019=this;return new Promise(function(_0x4a5cc1,_0x4a397e){return db[_0xbb34('0x17')][_0xbb34('0x18')]({'raw':_0x5bade6[_0xbb34('0x19')]?_0x5bade6[_0xbb34('0x19')][_0xbb34('0x1a')]===undefined?!![]:![]:!![],'where':_0x5bade6[_0xbb34('0x19')]?_0x5bade6[_0xbb34('0x19')]['where']||null:null,'attributes':_0x5bade6[_0xbb34('0x19')]?_0x5bade6[_0xbb34('0x19')][_0xbb34('0x1b')]||null:null,'limit':_0x5bade6[_0xbb34('0x19')]?_0x5bade6[_0xbb34('0x19')][_0xbb34('0x1c')]||null:null,'include':_0x5bade6[_0xbb34('0x19')]?_0x5bade6[_0xbb34('0x19')][_0xbb34('0x1d')]?_[_0xbb34('0x1e')](_0x5bade6[_0xbb34('0x19')][_0xbb34('0x1d')],function(_0x8b4ec0){return{'model':db[_0x8b4ec0[_0xbb34('0x1f')]],'as':_0x8b4ec0['as'],'attributes':_0x8b4ec0[_0xbb34('0x1b')],'include':_0x8b4ec0[_0xbb34('0x1d')]?_['map'](_0x8b4ec0[_0xbb34('0x1d')],function(_0x160753){return{'model':db[_0x160753[_0xbb34('0x1f')]],'as':_0x160753['as'],'attributes':_0x160753['attributes'],'include':_0x160753['include']?_['map'](_0x160753[_0xbb34('0x1d')],function(_0x31cf1d){return{'model':db[_0x31cf1d['model']],'as':_0x31cf1d['as'],'attributes':_0x31cf1d[_0xbb34('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb34('0xb')](function(_0x1c5527){logger[_0xbb34('0xc')](_0xbb34('0x16'),_0x5bade6);logger[_0xbb34('0xd')](_0xbb34('0x16'),_0x5bade6,JSON['stringify'](_0x1c5527));_0x4a5cc1(_0x1c5527);})['catch'](function(_0x30cd69){logger['error'](_0xbb34('0x16'),_0x30cd69['message'],_0x5bade6);_0x4a397e(_0x4f6019[_0xbb34('0x11')](0x1f4,_0x30cd69[_0xbb34('0x13')]));});});};exports['ShowDynamics365Account']=function(_0xa4e4b3){var _0x19bc8c=this;return new Promise(function(_0x684908,_0x18124e){return db[_0xbb34('0x17')][_0xbb34('0x20')]({'raw':_0xa4e4b3[_0xbb34('0x19')]?_0xa4e4b3['options'][_0xbb34('0x1a')]===undefined?!![]:![]:!![],'where':_0xa4e4b3[_0xbb34('0x19')]?_0xa4e4b3[_0xbb34('0x19')][_0xbb34('0x21')]||null:null,'attributes':_0xa4e4b3[_0xbb34('0x19')]?_0xa4e4b3['options'][_0xbb34('0x1b')]||null:null,'include':_0xa4e4b3[_0xbb34('0x19')]?_0xa4e4b3['options'][_0xbb34('0x1d')]?_[_0xbb34('0x1e')](_0xa4e4b3['options'][_0xbb34('0x1d')],function(_0x56bbfd){return{'model':db[_0x56bbfd[_0xbb34('0x1f')]],'as':_0x56bbfd['as'],'attributes':_0x56bbfd[_0xbb34('0x1b')],'include':_0x56bbfd[_0xbb34('0x1d')]?_[_0xbb34('0x1e')](_0x56bbfd['include'],function(_0x53ef0c){return{'model':db[_0x53ef0c['model']],'as':_0x53ef0c['as'],'attributes':_0x53ef0c[_0xbb34('0x1b')],'include':_0x53ef0c['include']?_['map'](_0x53ef0c['include'],function(_0x599869){return{'model':db[_0x599869[_0xbb34('0x1f')]],'as':_0x599869['as'],'attributes':_0x599869[_0xbb34('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb34('0xb')](function(_0x9e1cbc){logger[_0xbb34('0xc')]('ShowDynamics365Account',_0xa4e4b3);logger[_0xbb34('0xd')](_0xbb34('0x22'),_0xa4e4b3,JSON['stringify'](_0x9e1cbc));_0x684908(_0x9e1cbc);})[_0xbb34('0x15')](function(_0x3b436e){logger[_0xbb34('0x11')](_0xbb34('0x22'),_0x3b436e[_0xbb34('0x13')],_0xa4e4b3);_0x18124e(_0x19bc8c[_0xbb34('0x11')](0x1f4,_0x3b436e[_0xbb34('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 5d37ce9..99da826 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 _0x2d19=['isAuthenticated','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','put','update','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','/:id'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x2d19,0x1d9));var _0x92d1=function(_0x2298f0,_0x3bbf4f){_0x2298f0=_0x2298f0-0x0;var _0x39b136=_0x2d19[_0x2298f0];return _0x39b136;};'use strict';var multer=require(_0x92d1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x92d1('0x1'));var router=express[_0x92d1('0x2')]();var fs_extra=require(_0x92d1('0x3'));var auth=require(_0x92d1('0x4'));var interaction=require(_0x92d1('0x5'));var config=require(_0x92d1('0x6'));var controller=require(_0x92d1('0x7'));router[_0x92d1('0x8')]('/',auth['isAuthenticated'](),controller[_0x92d1('0x9')]);router[_0x92d1('0x8')](_0x92d1('0xa'),auth[_0x92d1('0xb')](),controller[_0x92d1('0xc')]);router[_0x92d1('0x8')](_0x92d1('0xd'),auth[_0x92d1('0xb')](),controller['getFields']);router[_0x92d1('0x8')]('/:id/subjects',auth[_0x92d1('0xb')](),controller[_0x92d1('0xe')]);router[_0x92d1('0x8')](_0x92d1('0xf'),auth['isAuthenticated'](),controller[_0x92d1('0x10')]);router[_0x92d1('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x92d1('0x12')](_0x92d1('0xa'),auth[_0x92d1('0xb')](),controller[_0x92d1('0x13')]);router['delete']('/:id',auth[_0x92d1('0xb')](),controller[_0x92d1('0x14')]);module[_0x92d1('0x15')]=router; \ No newline at end of file +var _0xd9b4=['/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDynamics365Configuration.controller','isAuthenticated','index','get'];(function(_0x20c512,_0x36c198){var _0x25236e=function(_0x418ec3){while(--_0x418ec3){_0x20c512['push'](_0x20c512['shift']());}};_0x25236e(++_0x36c198);}(_0xd9b4,0x1c0));var _0x4d9b=function(_0x4661ea,_0x2abbad){_0x4661ea=_0x4661ea-0x0;var _0x400aaf=_0xd9b4[_0x4661ea];return _0x400aaf;};'use strict';var multer=require(_0x4d9b('0x0'));var util=require(_0x4d9b('0x1'));var path=require(_0x4d9b('0x2'));var timeout=require(_0x4d9b('0x3'));var express=require(_0x4d9b('0x4'));var router=express[_0x4d9b('0x5')]();var fs_extra=require(_0x4d9b('0x6'));var auth=require(_0x4d9b('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4d9b('0x8'));router['get']('/',auth[_0x4d9b('0x9')](),controller[_0x4d9b('0xa')]);router[_0x4d9b('0xb')](_0x4d9b('0xc'),auth[_0x4d9b('0x9')](),controller[_0x4d9b('0xd')]);router['get'](_0x4d9b('0xe'),auth['isAuthenticated'](),controller[_0x4d9b('0xf')]);router['get']('/:id/subjects',auth[_0x4d9b('0x9')](),controller['getSubjects']);router[_0x4d9b('0xb')](_0x4d9b('0x10'),auth['isAuthenticated'](),controller[_0x4d9b('0x11')]);router['post']('/',auth[_0x4d9b('0x9')](),controller[_0x4d9b('0x12')]);router[_0x4d9b('0x13')](_0x4d9b('0xc'),auth[_0x4d9b('0x9')](),controller['update']);router[_0x4d9b('0x14')](_0x4d9b('0xc'),auth[_0x4d9b('0x9')](),controller[_0x4d9b('0x15')]);module[_0x4d9b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 84635b2..0567a20 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 _0x4b87=['BOOLEAN','sequelize','exports','STRING','phonecall','contact','nothing'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x4b87,0xc5));var _0x74b8=function(_0x2bb9f9,_0x47d38b){_0x2bb9f9=_0x2bb9f9-0x0;var _0x7cbdd1=_0x4b87[_0x2bb9f9];return _0x7cbdd1;};'use strict';var Sequelize=require(_0x74b8('0x0'));module[_0x74b8('0x1')]={'name':{'type':Sequelize[_0x74b8('0x2')]},'description':{'type':Sequelize[_0x74b8('0x2')]},'ticketType':{'type':Sequelize['ENUM']('incident',_0x74b8('0x3')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM'](_0x74b8('0x4'),_0x74b8('0x5')),'defaultValue':_0x74b8('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x74b8('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7c0a=['nothing','contact','BOOLEAN','sequelize','exports','STRING','ENUM','incident'];(function(_0x558050,_0x174ec4){var _0x3ee149=function(_0x22be0f){while(--_0x22be0f){_0x558050['push'](_0x558050['shift']());}};_0x3ee149(++_0x174ec4);}(_0x7c0a,0x19b));var _0xa7c0=function(_0x193302,_0x31c981){_0x193302=_0x193302-0x0;var _0x56ab6b=_0x7c0a[_0x193302];return _0x56ab6b;};'use strict';var Sequelize=require(_0xa7c0('0x0'));module[_0xa7c0('0x1')]={'name':{'type':Sequelize[_0xa7c0('0x2')]},'description':{'type':Sequelize[_0xa7c0('0x2')]},'ticketType':{'type':Sequelize[_0xa7c0('0x3')](_0xa7c0('0x4'),'phonecall'),'defaultValue':_0xa7c0('0x4')},'moduleCreate':{'type':Sequelize[_0xa7c0('0x3')]('contact',_0xa7c0('0x5')),'defaultValue':_0xa7c0('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xa7c0('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xa7c0('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 1aa029e..ee58455 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 _0x8575=['create','body','update','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','hasOwnProperty','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','limit','count','offset','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','find'];(function(_0x20a2d6,_0x148a0a){var _0x26e4cb=function(_0x120039){while(--_0x120039){_0x20a2d6['push'](_0x20a2d6['shift']());}};_0x26e4cb(++_0x148a0a);}(_0x8575,0xa7));var _0x5857=function(_0x51dba5,_0x24735c){_0x51dba5=_0x51dba5-0x0;var _0x58d2a7=_0x8575[_0x51dba5];return _0x58d2a7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5857('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5857('0x1'));var rp=require('request-promise');var moment=require(_0x5857('0x2'));var BPromise=require(_0x5857('0x3'));var Mustache=require(_0x5857('0x4'));var util=require(_0x5857('0x5'));var path=require(_0x5857('0x6'));var sox=require(_0x5857('0x7'));var csv=require(_0x5857('0x8'));var ejs=require(_0x5857('0x9'));var fs=require('fs');var fs_extra=require(_0x5857('0xa'));var _=require(_0x5857('0xb'));var squel=require(_0x5857('0xc'));var crypto=require(_0x5857('0xd'));var jsforce=require(_0x5857('0xe'));var deskjs=require(_0x5857('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5857('0x10'));var Redis=require(_0x5857('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5857('0x12'));var logger=require(_0x5857('0x13'))(_0x5857('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5857('0x15'));var db=require(_0x5857('0x16'))['db'];function respondWithStatusCode(_0x1552bf,_0x29c053){_0x29c053=_0x29c053||0xcc;return function(_0xb03590){if(_0xb03590){return _0x1552bf['sendStatus'](_0x29c053);}return _0x1552bf[_0x5857('0x17')](_0x29c053)[_0x5857('0x18')]();};}function respondWithResult(_0x4ded26,_0x540603){_0x540603=_0x540603||0xc8;return function(_0x1f99b2){if(_0x1f99b2){return _0x4ded26[_0x5857('0x17')](_0x540603)['json'](_0x1f99b2);}};}function respondWithFilteredResult(_0x595142,_0x52b683){return function(_0x26b0a8){if(_0x26b0a8){var _0x37f125=typeof _0x52b683['offset']==='undefined'&&typeof _0x52b683[_0x5857('0x19')]==='undefined';var _0x14d9b=_0x26b0a8[_0x5857('0x1a')];var _0x57f5d6=_0x37f125?0x0:_0x52b683['offset'];var _0xbf8eb6=_0x37f125?_0x26b0a8[_0x5857('0x1a')]:_0x52b683[_0x5857('0x1b')]+_0x52b683[_0x5857('0x19')];var _0x383b3a;if(_0xbf8eb6>=_0x14d9b){_0xbf8eb6=_0x14d9b;_0x383b3a=0xc8;}else{_0x383b3a=0xce;}_0x595142[_0x5857('0x17')](_0x383b3a);return _0x595142['set'](_0x5857('0x1c'),_0x57f5d6+'-'+_0xbf8eb6+'/'+_0x14d9b)[_0x5857('0x1d')](_0x26b0a8);}return null;};}function patchUpdates(_0x1b5dfc){return function(_0x3777e0){try{jsonpatch[_0x5857('0x1e')](_0x3777e0,_0x1b5dfc,!![]);}catch(_0x21d7ea){return BPromise[_0x5857('0x1f')](_0x21d7ea);}return _0x3777e0[_0x5857('0x20')]();};}function saveUpdates(_0x53cbd0,_0x4b136e){return function(_0x38f874){if(_0x38f874){return _0x38f874['update'](_0x53cbd0)[_0x5857('0x21')](function(_0x3d42db){return _0x3d42db;});}return null;};}function removeEntity(_0x49c3df,_0x3569d9){return function(_0xadda11){if(_0xadda11){return _0xadda11[_0x5857('0x22')]()[_0x5857('0x21')](function(){_0x49c3df[_0x5857('0x17')](0xcc)[_0x5857('0x18')]();});}};}function handleEntityNotFound(_0x294b87,_0x802918){return function(_0x6c3ca6){if(!_0x6c3ca6){_0x294b87[_0x5857('0x23')](0x194);}return _0x6c3ca6;};}function handleError(_0x360dcc,_0x1ece0c){_0x1ece0c=_0x1ece0c||0x1f4;return function(_0x5d5c02){logger[_0x5857('0x24')](_0x5d5c02[_0x5857('0x25')]);if(_0x5d5c02[_0x5857('0x26')]){delete _0x5d5c02[_0x5857('0x26')];}_0x360dcc[_0x5857('0x17')](_0x1ece0c)[_0x5857('0x27')](_0x5d5c02);};}exports[_0x5857('0x28')]=function(_0xf20764,_0x15d650){var _0x146395={},_0x378b9c={},_0x1cfc1d={'count':0x0,'rows':[]};var _0x543c52=_['map'](db[_0x5857('0x29')][_0x5857('0x2a')],function(_0x50f810){return{'name':_0x50f810[_0x5857('0x2b')],'type':_0x50f810[_0x5857('0x2c')][_0x5857('0x2d')]};});_0x378b9c['model']=_[_0x5857('0x2e')](_0x543c52,_0x5857('0x26'));_0x378b9c[_0x5857('0x2f')]=_[_0x5857('0x30')](_0xf20764[_0x5857('0x2f')]);_0x378b9c[_0x5857('0x31')]=_['intersection'](_0x378b9c[_0x5857('0x32')],_0x378b9c[_0x5857('0x2f')]);_0x146395[_0x5857('0x33')]=_[_0x5857('0x34')](_0x378b9c[_0x5857('0x32')],qs[_0x5857('0x35')](_0xf20764[_0x5857('0x2f')][_0x5857('0x35')]));_0x146395[_0x5857('0x33')]=_0x146395[_0x5857('0x33')][_0x5857('0x36')]?_0x146395['attributes']:_0x378b9c[_0x5857('0x32')];if(!_0xf20764[_0x5857('0x2f')]['hasOwnProperty'](_0x5857('0x37'))){_0x146395[_0x5857('0x19')]=qs[_0x5857('0x19')](_0xf20764['query'][_0x5857('0x19')]);_0x146395[_0x5857('0x1b')]=qs[_0x5857('0x1b')](_0xf20764[_0x5857('0x2f')][_0x5857('0x1b')]);}_0x146395[_0x5857('0x38')]=qs[_0x5857('0x39')](_0xf20764[_0x5857('0x2f')][_0x5857('0x39')]);_0x146395[_0x5857('0x3a')]=qs[_0x5857('0x31')](_[_0x5857('0x3b')](_0xf20764[_0x5857('0x2f')],_0x378b9c[_0x5857('0x31')]),_0x543c52);if(_0xf20764[_0x5857('0x2f')][_0x5857('0x3c')]){_0x146395['where']=_[_0x5857('0x3d')](_0x146395[_0x5857('0x3a')],{'$or':_[_0x5857('0x2e')](_0x543c52,function(_0x216772){if(_0x216772[_0x5857('0x2c')]!=='VIRTUAL'){var _0x1520dc={};_0x1520dc[_0x216772[_0x5857('0x26')]]={'$like':'%'+_0xf20764[_0x5857('0x2f')]['filter']+'%'};return _0x1520dc;}})});}_0x146395=_[_0x5857('0x3d')]({},_0x146395,_0xf20764[_0x5857('0x3e')]);var _0x10b4d7={'where':_0x146395[_0x5857('0x3a')]};return db[_0x5857('0x29')][_0x5857('0x1a')](_0x10b4d7)[_0x5857('0x21')](function(_0x5b4cf7){_0x1cfc1d[_0x5857('0x1a')]=_0x5b4cf7;if(_0xf20764[_0x5857('0x2f')][_0x5857('0x3f')]){_0x146395[_0x5857('0x40')]=[{'all':!![]}];}return db[_0x5857('0x29')][_0x5857('0x41')](_0x146395);})['then'](function(_0x2d4503){_0x1cfc1d[_0x5857('0x42')]=_0x2d4503;return _0x1cfc1d;})[_0x5857('0x21')](respondWithFilteredResult(_0x15d650,_0x146395))[_0x5857('0x43')](handleError(_0x15d650,null));};exports['show']=function(_0x426341,_0x284795){var _0xc0b1f0={'raw':![],'where':{'id':_0x426341[_0x5857('0x44')]['id']}},_0x1fbddd={};_0x1fbddd[_0x5857('0x32')]=_[_0x5857('0x30')](db[_0x5857('0x29')][_0x5857('0x2a')]);_0x1fbddd[_0x5857('0x2f')]=_['keys'](_0x426341[_0x5857('0x2f')]);_0x1fbddd[_0x5857('0x31')]=_[_0x5857('0x34')](_0x1fbddd[_0x5857('0x32')],_0x1fbddd[_0x5857('0x2f')]);_0xc0b1f0[_0x5857('0x33')]=_['intersection'](_0x1fbddd[_0x5857('0x32')],qs['fields'](_0x426341['query'][_0x5857('0x35')]));_0xc0b1f0['attributes']=_0xc0b1f0[_0x5857('0x33')][_0x5857('0x36')]?_0xc0b1f0[_0x5857('0x33')]:_0x1fbddd[_0x5857('0x32')];if(_0x426341[_0x5857('0x2f')]['includeAll']){_0xc0b1f0['include']=[{'all':!![]}];}_0xc0b1f0=_[_0x5857('0x3d')]({},_0xc0b1f0,_0x426341[_0x5857('0x3e')]);return db[_0x5857('0x29')][_0x5857('0x45')](_0xc0b1f0)['then'](handleEntityNotFound(_0x284795,null))[_0x5857('0x21')](respondWithResult(_0x284795,null))[_0x5857('0x43')](handleError(_0x284795,null));};exports[_0x5857('0x46')]=function(_0x150322,_0x3ad06){return db[_0x5857('0x29')][_0x5857('0x46')](_0x150322[_0x5857('0x47')],{})[_0x5857('0x21')](respondWithResult(_0x3ad06,0xc9))[_0x5857('0x43')](handleError(_0x3ad06,null));};exports[_0x5857('0x48')]=function(_0x48a54d,_0x476d9f){if(_0x48a54d[_0x5857('0x47')]['id']){delete _0x48a54d[_0x5857('0x47')]['id'];}return db[_0x5857('0x29')]['find']({'where':{'id':_0x48a54d[_0x5857('0x44')]['id']}})[_0x5857('0x21')](handleEntityNotFound(_0x476d9f,null))[_0x5857('0x21')](saveUpdates(_0x48a54d['body'],null))[_0x5857('0x21')](respondWithResult(_0x476d9f,null))['catch'](handleError(_0x476d9f,null));};exports['destroy']=function(_0x107fea,_0x3d61a2){return db[_0x5857('0x29')]['find']({'where':{'id':_0x107fea[_0x5857('0x44')]['id']}})[_0x5857('0x21')](handleEntityNotFound(_0x3d61a2,null))[_0x5857('0x21')](removeEntity(_0x3d61a2,null))['catch'](handleError(_0x3d61a2,null));};exports[_0x5857('0x49')]=function(_0x2bae0a,_0x1a0722,_0x1faeba){var _0x4e708f={};var _0x5c8346={};var _0x160a10;var _0x4308e1;return db[_0x5857('0x29')][_0x5857('0x4a')]({'where':{'id':_0x2bae0a[_0x5857('0x44')]['id']}})['then'](handleEntityNotFound(_0x1a0722,null))[_0x5857('0x21')](function(_0x1ba356){if(_0x1ba356){_0x160a10=_0x1ba356;_0x5c8346[_0x5857('0x32')]=_['keys'](db[_0x5857('0x4b')][_0x5857('0x2a')]);_0x5c8346[_0x5857('0x2f')]=_[_0x5857('0x30')](_0x2bae0a[_0x5857('0x2f')]);_0x5c8346[_0x5857('0x31')]=_[_0x5857('0x34')](_0x5c8346[_0x5857('0x32')],_0x5c8346[_0x5857('0x2f')]);_0x4e708f[_0x5857('0x33')]=_['intersection'](_0x5c8346['model'],qs['fields'](_0x2bae0a[_0x5857('0x2f')][_0x5857('0x35')]));_0x4e708f[_0x5857('0x33')]=_0x4e708f[_0x5857('0x33')][_0x5857('0x36')]?_0x4e708f[_0x5857('0x33')]:_0x5c8346[_0x5857('0x32')];_0x4e708f[_0x5857('0x38')]=qs[_0x5857('0x39')](_0x2bae0a[_0x5857('0x2f')][_0x5857('0x39')]);_0x4e708f[_0x5857('0x3a')]=qs[_0x5857('0x31')](_[_0x5857('0x3b')](_0x2bae0a[_0x5857('0x2f')],_0x5c8346[_0x5857('0x31')]));if(_0x2bae0a[_0x5857('0x2f')][_0x5857('0x3c')]){_0x4e708f[_0x5857('0x3a')]=_[_0x5857('0x3d')](_0x4e708f[_0x5857('0x3a')],{'$or':_[_0x5857('0x2e')](_0x4e708f['attributes'],function(_0x4a1c0e){var _0x3c42f0={};_0x3c42f0[_0x4a1c0e]={'$like':'%'+_0x2bae0a[_0x5857('0x2f')][_0x5857('0x3c')]+'%'};return _0x3c42f0;})});}_0x4e708f=_['merge']({},_0x4e708f,_0x2bae0a[_0x5857('0x3e')]);return _0x160a10[_0x5857('0x49')](_0x4e708f);}})[_0x5857('0x21')](function(_0x26111b){if(_0x26111b){_0x4308e1=_0x26111b[_0x5857('0x36')];if(!_0x2bae0a[_0x5857('0x2f')]['hasOwnProperty'](_0x5857('0x37'))){_0x4e708f[_0x5857('0x19')]=qs[_0x5857('0x19')](_0x2bae0a['query'][_0x5857('0x19')]);_0x4e708f[_0x5857('0x1b')]=qs[_0x5857('0x1b')](_0x2bae0a[_0x5857('0x2f')]['offset']);}return _0x160a10[_0x5857('0x49')](_0x4e708f);}})[_0x5857('0x21')](function(_0x3ae48e){if(_0x3ae48e){return _0x3ae48e?{'count':_0x4308e1,'rows':_0x3ae48e}:null;}})[_0x5857('0x21')](respondWithResult(_0x1a0722,null))['catch'](handleError(_0x1a0722,null));};exports[_0x5857('0x4c')]=function(_0x441c0f,_0x55d93e,_0x9464a6){var _0x15e37e={};var _0x66f875={};var _0x2b8525;var _0xd028fb;return db[_0x5857('0x29')][_0x5857('0x4a')]({'where':{'id':_0x441c0f[_0x5857('0x44')]['id']}})[_0x5857('0x21')](handleEntityNotFound(_0x55d93e,null))[_0x5857('0x21')](function(_0x2021e4){if(_0x2021e4){_0x2b8525=_0x2021e4;_0x66f875[_0x5857('0x32')]=_[_0x5857('0x30')](db[_0x5857('0x4b')][_0x5857('0x2a')]);_0x66f875['query']=_['keys'](_0x441c0f[_0x5857('0x2f')]);_0x66f875['filters']=_[_0x5857('0x34')](_0x66f875[_0x5857('0x32')],_0x66f875[_0x5857('0x2f')]);_0x15e37e[_0x5857('0x33')]=_[_0x5857('0x34')](_0x66f875[_0x5857('0x32')],qs[_0x5857('0x35')](_0x441c0f[_0x5857('0x2f')]['fields']));_0x15e37e[_0x5857('0x33')]=_0x15e37e[_0x5857('0x33')][_0x5857('0x36')]?_0x15e37e[_0x5857('0x33')]:_0x66f875['model'];_0x15e37e[_0x5857('0x38')]=qs[_0x5857('0x39')](_0x441c0f[_0x5857('0x2f')][_0x5857('0x39')]);_0x15e37e[_0x5857('0x3a')]=qs[_0x5857('0x31')](_[_0x5857('0x3b')](_0x441c0f['query'],_0x66f875[_0x5857('0x31')]));if(_0x441c0f['query'][_0x5857('0x3c')]){_0x15e37e[_0x5857('0x3a')]=_[_0x5857('0x3d')](_0x15e37e[_0x5857('0x3a')],{'$or':_[_0x5857('0x2e')](_0x15e37e['attributes'],function(_0x3c5ba4){var _0x25f4da={};_0x25f4da[_0x3c5ba4]={'$like':'%'+_0x441c0f[_0x5857('0x2f')][_0x5857('0x3c')]+'%'};return _0x25f4da;})});}_0x15e37e=_[_0x5857('0x3d')]({},_0x15e37e,_0x441c0f[_0x5857('0x3e')]);return _0x2b8525['getSubjects'](_0x15e37e);}})[_0x5857('0x21')](function(_0x4a79ff){if(_0x4a79ff){_0xd028fb=_0x4a79ff[_0x5857('0x36')];if(!_0x441c0f[_0x5857('0x2f')]['hasOwnProperty'](_0x5857('0x37'))){_0x15e37e['limit']=qs[_0x5857('0x19')](_0x441c0f[_0x5857('0x2f')][_0x5857('0x19')]);_0x15e37e['offset']=qs['offset'](_0x441c0f['query'][_0x5857('0x1b')]);}return _0x2b8525[_0x5857('0x4c')](_0x15e37e);}})[_0x5857('0x21')](function(_0x3ed990){if(_0x3ed990){return _0x3ed990?{'count':_0xd028fb,'rows':_0x3ed990}:null;}})[_0x5857('0x21')](respondWithResult(_0x55d93e,null))[_0x5857('0x43')](handleError(_0x55d93e,null));};exports[_0x5857('0x4d')]=function(_0x58db1b,_0x46b4c4,_0x11b63b){var _0x2d923b={};var _0x5cb5c7={};var _0x395123;var _0x3767dd;return db[_0x5857('0x29')][_0x5857('0x4a')]({'where':{'id':_0x58db1b[_0x5857('0x44')]['id']}})[_0x5857('0x21')](handleEntityNotFound(_0x46b4c4,null))['then'](function(_0x3f0152){if(_0x3f0152){_0x395123=_0x3f0152;_0x5cb5c7['model']=_['keys'](db['Dynamics365Field'][_0x5857('0x2a')]);_0x5cb5c7['query']=_[_0x5857('0x30')](_0x58db1b[_0x5857('0x2f')]);_0x5cb5c7['filters']=_[_0x5857('0x34')](_0x5cb5c7[_0x5857('0x32')],_0x5cb5c7[_0x5857('0x2f')]);_0x2d923b[_0x5857('0x33')]=_[_0x5857('0x34')](_0x5cb5c7['model'],qs[_0x5857('0x35')](_0x58db1b['query'][_0x5857('0x35')]));_0x2d923b[_0x5857('0x33')]=_0x2d923b['attributes'][_0x5857('0x36')]?_0x2d923b['attributes']:_0x5cb5c7[_0x5857('0x32')];_0x2d923b[_0x5857('0x38')]=qs[_0x5857('0x39')](_0x58db1b['query'][_0x5857('0x39')]);_0x2d923b[_0x5857('0x3a')]=qs[_0x5857('0x31')](_[_0x5857('0x3b')](_0x58db1b['query'],_0x5cb5c7[_0x5857('0x31')]));if(_0x58db1b[_0x5857('0x2f')][_0x5857('0x3c')]){_0x2d923b['where']=_[_0x5857('0x3d')](_0x2d923b['where'],{'$or':_[_0x5857('0x2e')](_0x2d923b['attributes'],function(_0x80aec1){var _0x2585b9={};_0x2585b9[_0x80aec1]={'$like':'%'+_0x58db1b[_0x5857('0x2f')][_0x5857('0x3c')]+'%'};return _0x2585b9;})});}_0x2d923b=_[_0x5857('0x3d')]({},_0x2d923b,_0x58db1b['options']);return _0x395123[_0x5857('0x4d')](_0x2d923b);}})[_0x5857('0x21')](function(_0x1bb6a0){if(_0x1bb6a0){_0x3767dd=_0x1bb6a0[_0x5857('0x36')];if(!_0x58db1b[_0x5857('0x2f')][_0x5857('0x4e')](_0x5857('0x37'))){_0x2d923b[_0x5857('0x19')]=qs[_0x5857('0x19')](_0x58db1b[_0x5857('0x2f')][_0x5857('0x19')]);_0x2d923b[_0x5857('0x1b')]=qs[_0x5857('0x1b')](_0x58db1b[_0x5857('0x2f')][_0x5857('0x1b')]);}return _0x395123[_0x5857('0x4d')](_0x2d923b);}})[_0x5857('0x21')](function(_0x1411cb){if(_0x1411cb){return _0x1411cb?{'count':_0x3767dd,'rows':_0x1411cb}:null;}})['then'](respondWithResult(_0x46b4c4,null))[_0x5857('0x43')](handleError(_0x46b4c4,null));}; \ No newline at end of file +var _0x1db8=['getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','save','update','destroy','error','stack','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','count','includeAll','include','findAll','then','catch','params','length','find','create','body','getFields','findOne','Dynamics365Field','pick','options','nolimit','getSubjects'];(function(_0xf68a38,_0x8ac731){var _0x1c07bc=function(_0x446365){while(--_0x446365){_0xf68a38['push'](_0xf68a38['shift']());}};_0x1c07bc(++_0x8ac731);}(_0x1db8,0x145));var _0x81db=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1db8[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x81db('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x81db('0x1'));var jsonpatch=require(_0x81db('0x2'));var rp=require(_0x81db('0x3'));var moment=require(_0x81db('0x4'));var BPromise=require(_0x81db('0x5'));var Mustache=require(_0x81db('0x6'));var util=require(_0x81db('0x7'));var path=require(_0x81db('0x8'));var sox=require(_0x81db('0x9'));var csv=require(_0x81db('0xa'));var ejs=require(_0x81db('0xb'));var fs=require('fs');var fs_extra=require(_0x81db('0xc'));var _=require(_0x81db('0xd'));var squel=require('squel');var crypto=require(_0x81db('0xe'));var jsforce=require(_0x81db('0xf'));var deskjs=require(_0x81db('0x10'));var toCsv=require(_0x81db('0xa'));var querystring=require(_0x81db('0x11'));var Papa=require(_0x81db('0x12'));var Redis=require(_0x81db('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x81db('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x81db('0x15'));var logger=require(_0x81db('0x16'))(_0x81db('0x17'));var utils=require('../../config/utils');var config=require(_0x81db('0x18'));var licenseUtil=require(_0x81db('0x19'));var db=require(_0x81db('0x1a'))['db'];function respondWithStatusCode(_0x392a4d,_0x501c91){_0x501c91=_0x501c91||0xcc;return function(_0x5aac39){if(_0x5aac39){return _0x392a4d[_0x81db('0x1b')](_0x501c91);}return _0x392a4d[_0x81db('0x1c')](_0x501c91)[_0x81db('0x1d')]();};}function respondWithResult(_0x1dd59e,_0x1f2940){_0x1f2940=_0x1f2940||0xc8;return function(_0x2741a1){if(_0x2741a1){return _0x1dd59e[_0x81db('0x1c')](_0x1f2940)[_0x81db('0x1e')](_0x2741a1);}};}function respondWithFilteredResult(_0x5b8c57,_0x52187a){return function(_0x1251e8){if(_0x1251e8){var _0x288690=typeof _0x52187a[_0x81db('0x1f')]==='undefined'&&typeof _0x52187a[_0x81db('0x20')]==='undefined';var _0xcfe102=_0x1251e8['count'];var _0x4a3764=_0x288690?0x0:_0x52187a[_0x81db('0x1f')];var _0x3bdd31=_0x288690?_0x1251e8['count']:_0x52187a[_0x81db('0x1f')]+_0x52187a[_0x81db('0x20')];var _0x17de66;if(_0x3bdd31>=_0xcfe102){_0x3bdd31=_0xcfe102;_0x17de66=0xc8;}else{_0x17de66=0xce;}_0x5b8c57[_0x81db('0x1c')](_0x17de66);return _0x5b8c57[_0x81db('0x21')]('Content-Range',_0x4a3764+'-'+_0x3bdd31+'/'+_0xcfe102)[_0x81db('0x1e')](_0x1251e8);}return null;};}function patchUpdates(_0x4220fa){return function(_0x5f251a){try{jsonpatch[_0x81db('0x22')](_0x5f251a,_0x4220fa,!![]);}catch(_0x5c4477){return BPromise['reject'](_0x5c4477);}return _0x5f251a[_0x81db('0x23')]();};}function saveUpdates(_0x4617a6,_0x52ddd3){return function(_0x5c6e6e){if(_0x5c6e6e){return _0x5c6e6e[_0x81db('0x24')](_0x4617a6)['then'](function(_0x5d95e1){return _0x5d95e1;});}return null;};}function removeEntity(_0x32d1b9,_0x3a7b28){return function(_0x45fa2a){if(_0x45fa2a){return _0x45fa2a[_0x81db('0x25')]()['then'](function(){_0x32d1b9[_0x81db('0x1c')](0xcc)[_0x81db('0x1d')]();});}};}function handleEntityNotFound(_0x16c27b,_0x5d014c){return function(_0x445d47){if(!_0x445d47){_0x16c27b['sendStatus'](0x194);}return _0x445d47;};}function handleError(_0x3c7883,_0x22bbb2){_0x22bbb2=_0x22bbb2||0x1f4;return function(_0x45196b){logger[_0x81db('0x26')](_0x45196b[_0x81db('0x27')]);if(_0x45196b[_0x81db('0x28')]){delete _0x45196b[_0x81db('0x28')];}_0x3c7883['status'](_0x22bbb2)['send'](_0x45196b);};}exports[_0x81db('0x29')]=function(_0x3b90f7,_0x3bc485){var _0xd2dd13={},_0x557f18={},_0x892975={'count':0x0,'rows':[]};var _0x1cdab4=_[_0x81db('0x2a')](db[_0x81db('0x2b')][_0x81db('0x2c')],function(_0x5ad674){return{'name':_0x5ad674[_0x81db('0x2d')],'type':_0x5ad674[_0x81db('0x2e')][_0x81db('0x2f')]};});_0x557f18['model']=_[_0x81db('0x2a')](_0x1cdab4,_0x81db('0x28'));_0x557f18[_0x81db('0x30')]=_[_0x81db('0x31')](_0x3b90f7[_0x81db('0x30')]);_0x557f18[_0x81db('0x32')]=_['intersection'](_0x557f18['model'],_0x557f18[_0x81db('0x30')]);_0xd2dd13[_0x81db('0x33')]=_[_0x81db('0x34')](_0x557f18[_0x81db('0x35')],qs['fields'](_0x3b90f7[_0x81db('0x30')][_0x81db('0x36')]));_0xd2dd13['attributes']=_0xd2dd13['attributes']['length']?_0xd2dd13[_0x81db('0x33')]:_0x557f18[_0x81db('0x35')];if(!_0x3b90f7[_0x81db('0x30')][_0x81db('0x37')]('nolimit')){_0xd2dd13[_0x81db('0x20')]=qs[_0x81db('0x20')](_0x3b90f7[_0x81db('0x30')]['limit']);_0xd2dd13[_0x81db('0x1f')]=qs[_0x81db('0x1f')](_0x3b90f7[_0x81db('0x30')][_0x81db('0x1f')]);}_0xd2dd13[_0x81db('0x38')]=qs['sort'](_0x3b90f7[_0x81db('0x30')][_0x81db('0x39')]);_0xd2dd13[_0x81db('0x3a')]=qs[_0x81db('0x32')](_['pick'](_0x3b90f7[_0x81db('0x30')],_0x557f18[_0x81db('0x32')]),_0x1cdab4);if(_0x3b90f7[_0x81db('0x30')][_0x81db('0x3b')]){_0xd2dd13[_0x81db('0x3a')]=_[_0x81db('0x3c')](_0xd2dd13[_0x81db('0x3a')],{'$or':_[_0x81db('0x2a')](_0x1cdab4,function(_0x1e18f3){if(_0x1e18f3[_0x81db('0x2e')]!==_0x81db('0x3d')){var _0x103a7e={};_0x103a7e[_0x1e18f3['name']]={'$like':'%'+_0x3b90f7['query']['filter']+'%'};return _0x103a7e;}})});}_0xd2dd13=_[_0x81db('0x3c')]({},_0xd2dd13,_0x3b90f7['options']);var _0x1350d1={'where':_0xd2dd13['where']};return db['Dynamics365Configuration']['count'](_0x1350d1)['then'](function(_0x4302ee){_0x892975[_0x81db('0x3e')]=_0x4302ee;if(_0x3b90f7[_0x81db('0x30')][_0x81db('0x3f')]){_0xd2dd13[_0x81db('0x40')]=[{'all':!![]}];}return db[_0x81db('0x2b')][_0x81db('0x41')](_0xd2dd13);})[_0x81db('0x42')](function(_0x573a8a){_0x892975['rows']=_0x573a8a;return _0x892975;})[_0x81db('0x42')](respondWithFilteredResult(_0x3bc485,_0xd2dd13))[_0x81db('0x43')](handleError(_0x3bc485,null));};exports['show']=function(_0x22d994,_0x162e71){var _0xce6ffa={'raw':![],'where':{'id':_0x22d994[_0x81db('0x44')]['id']}},_0x5db30d={};_0x5db30d[_0x81db('0x35')]=_[_0x81db('0x31')](db[_0x81db('0x2b')]['rawAttributes']);_0x5db30d['query']=_[_0x81db('0x31')](_0x22d994[_0x81db('0x30')]);_0x5db30d[_0x81db('0x32')]=_['intersection'](_0x5db30d[_0x81db('0x35')],_0x5db30d[_0x81db('0x30')]);_0xce6ffa['attributes']=_['intersection'](_0x5db30d[_0x81db('0x35')],qs[_0x81db('0x36')](_0x22d994[_0x81db('0x30')][_0x81db('0x36')]));_0xce6ffa[_0x81db('0x33')]=_0xce6ffa[_0x81db('0x33')][_0x81db('0x45')]?_0xce6ffa[_0x81db('0x33')]:_0x5db30d[_0x81db('0x35')];if(_0x22d994[_0x81db('0x30')]['includeAll']){_0xce6ffa[_0x81db('0x40')]=[{'all':!![]}];}_0xce6ffa=_[_0x81db('0x3c')]({},_0xce6ffa,_0x22d994['options']);return db[_0x81db('0x2b')][_0x81db('0x46')](_0xce6ffa)['then'](handleEntityNotFound(_0x162e71,null))[_0x81db('0x42')](respondWithResult(_0x162e71,null))['catch'](handleError(_0x162e71,null));};exports['create']=function(_0x55cbbe,_0x294688){return db[_0x81db('0x2b')][_0x81db('0x47')](_0x55cbbe[_0x81db('0x48')],{})[_0x81db('0x42')](respondWithResult(_0x294688,0xc9))[_0x81db('0x43')](handleError(_0x294688,null));};exports[_0x81db('0x24')]=function(_0x128196,_0x3795d4){if(_0x128196[_0x81db('0x48')]['id']){delete _0x128196[_0x81db('0x48')]['id'];}return db[_0x81db('0x2b')][_0x81db('0x46')]({'where':{'id':_0x128196[_0x81db('0x44')]['id']}})[_0x81db('0x42')](handleEntityNotFound(_0x3795d4,null))['then'](saveUpdates(_0x128196['body'],null))[_0x81db('0x42')](respondWithResult(_0x3795d4,null))[_0x81db('0x43')](handleError(_0x3795d4,null));};exports[_0x81db('0x25')]=function(_0x18a771,_0x25e61c){return db[_0x81db('0x2b')][_0x81db('0x46')]({'where':{'id':_0x18a771[_0x81db('0x44')]['id']}})[_0x81db('0x42')](handleEntityNotFound(_0x25e61c,null))[_0x81db('0x42')](removeEntity(_0x25e61c,null))[_0x81db('0x43')](handleError(_0x25e61c,null));};exports[_0x81db('0x49')]=function(_0x2a9b69,_0x572f4b,_0x49bed6){var _0x3549b2={};var _0x29e9f1={};var _0x1011e9;var _0x55b685;return db[_0x81db('0x2b')][_0x81db('0x4a')]({'where':{'id':_0x2a9b69[_0x81db('0x44')]['id']}})[_0x81db('0x42')](handleEntityNotFound(_0x572f4b,null))[_0x81db('0x42')](function(_0x2e7d55){if(_0x2e7d55){_0x1011e9=_0x2e7d55;_0x29e9f1[_0x81db('0x35')]=_[_0x81db('0x31')](db[_0x81db('0x4b')][_0x81db('0x2c')]);_0x29e9f1[_0x81db('0x30')]=_[_0x81db('0x31')](_0x2a9b69[_0x81db('0x30')]);_0x29e9f1[_0x81db('0x32')]=_[_0x81db('0x34')](_0x29e9f1[_0x81db('0x35')],_0x29e9f1['query']);_0x3549b2[_0x81db('0x33')]=_[_0x81db('0x34')](_0x29e9f1[_0x81db('0x35')],qs[_0x81db('0x36')](_0x2a9b69['query'][_0x81db('0x36')]));_0x3549b2[_0x81db('0x33')]=_0x3549b2[_0x81db('0x33')][_0x81db('0x45')]?_0x3549b2['attributes']:_0x29e9f1[_0x81db('0x35')];_0x3549b2[_0x81db('0x38')]=qs[_0x81db('0x39')](_0x2a9b69['query'][_0x81db('0x39')]);_0x3549b2[_0x81db('0x3a')]=qs[_0x81db('0x32')](_[_0x81db('0x4c')](_0x2a9b69[_0x81db('0x30')],_0x29e9f1['filters']));if(_0x2a9b69[_0x81db('0x30')][_0x81db('0x3b')]){_0x3549b2['where']=_[_0x81db('0x3c')](_0x3549b2[_0x81db('0x3a')],{'$or':_[_0x81db('0x2a')](_0x3549b2[_0x81db('0x33')],function(_0x3223a3){var _0x54c6cc={};_0x54c6cc[_0x3223a3]={'$like':'%'+_0x2a9b69[_0x81db('0x30')][_0x81db('0x3b')]+'%'};return _0x54c6cc;})});}_0x3549b2=_[_0x81db('0x3c')]({},_0x3549b2,_0x2a9b69[_0x81db('0x4d')]);return _0x1011e9[_0x81db('0x49')](_0x3549b2);}})['then'](function(_0x23e27c){if(_0x23e27c){_0x55b685=_0x23e27c['length'];if(!_0x2a9b69[_0x81db('0x30')][_0x81db('0x37')](_0x81db('0x4e'))){_0x3549b2[_0x81db('0x20')]=qs[_0x81db('0x20')](_0x2a9b69[_0x81db('0x30')]['limit']);_0x3549b2['offset']=qs[_0x81db('0x1f')](_0x2a9b69[_0x81db('0x30')][_0x81db('0x1f')]);}return _0x1011e9['getFields'](_0x3549b2);}})[_0x81db('0x42')](function(_0x568c51){if(_0x568c51){return _0x568c51?{'count':_0x55b685,'rows':_0x568c51}:null;}})[_0x81db('0x42')](respondWithResult(_0x572f4b,null))['catch'](handleError(_0x572f4b,null));};exports[_0x81db('0x4f')]=function(_0x15da7e,_0x3a7d20,_0x19e37b){var _0x5592f5={};var _0x3932c0={};var _0x50c893;var _0x184b05;return db[_0x81db('0x2b')][_0x81db('0x4a')]({'where':{'id':_0x15da7e['params']['id']}})[_0x81db('0x42')](handleEntityNotFound(_0x3a7d20,null))[_0x81db('0x42')](function(_0x60b794){if(_0x60b794){_0x50c893=_0x60b794;_0x3932c0[_0x81db('0x35')]=_[_0x81db('0x31')](db[_0x81db('0x4b')][_0x81db('0x2c')]);_0x3932c0['query']=_['keys'](_0x15da7e[_0x81db('0x30')]);_0x3932c0[_0x81db('0x32')]=_[_0x81db('0x34')](_0x3932c0[_0x81db('0x35')],_0x3932c0[_0x81db('0x30')]);_0x5592f5[_0x81db('0x33')]=_['intersection'](_0x3932c0[_0x81db('0x35')],qs[_0x81db('0x36')](_0x15da7e[_0x81db('0x30')][_0x81db('0x36')]));_0x5592f5[_0x81db('0x33')]=_0x5592f5[_0x81db('0x33')][_0x81db('0x45')]?_0x5592f5[_0x81db('0x33')]:_0x3932c0[_0x81db('0x35')];_0x5592f5['order']=qs[_0x81db('0x39')](_0x15da7e[_0x81db('0x30')]['sort']);_0x5592f5[_0x81db('0x3a')]=qs[_0x81db('0x32')](_[_0x81db('0x4c')](_0x15da7e[_0x81db('0x30')],_0x3932c0[_0x81db('0x32')]));if(_0x15da7e[_0x81db('0x30')]['filter']){_0x5592f5[_0x81db('0x3a')]=_[_0x81db('0x3c')](_0x5592f5[_0x81db('0x3a')],{'$or':_['map'](_0x5592f5[_0x81db('0x33')],function(_0x593161){var _0x1da515={};_0x1da515[_0x593161]={'$like':'%'+_0x15da7e[_0x81db('0x30')][_0x81db('0x3b')]+'%'};return _0x1da515;})});}_0x5592f5=_['merge']({},_0x5592f5,_0x15da7e[_0x81db('0x4d')]);return _0x50c893[_0x81db('0x4f')](_0x5592f5);}})[_0x81db('0x42')](function(_0x2d73fe){if(_0x2d73fe){_0x184b05=_0x2d73fe['length'];if(!_0x15da7e[_0x81db('0x30')][_0x81db('0x37')]('nolimit')){_0x5592f5['limit']=qs[_0x81db('0x20')](_0x15da7e[_0x81db('0x30')]['limit']);_0x5592f5['offset']=qs[_0x81db('0x1f')](_0x15da7e[_0x81db('0x30')][_0x81db('0x1f')]);}return _0x50c893[_0x81db('0x4f')](_0x5592f5);}})[_0x81db('0x42')](function(_0x199880){if(_0x199880){return _0x199880?{'count':_0x184b05,'rows':_0x199880}:null;}})[_0x81db('0x42')](respondWithResult(_0x3a7d20,null))['catch'](handleError(_0x3a7d20,null));};exports[_0x81db('0x50')]=function(_0x1a2b6e,_0x37e4f2,_0x55693e){var _0x5b594c={};var _0x397bd0={};var _0x2acf2d;var _0x24188f;return db[_0x81db('0x2b')]['findOne']({'where':{'id':_0x1a2b6e[_0x81db('0x44')]['id']}})['then'](handleEntityNotFound(_0x37e4f2,null))[_0x81db('0x42')](function(_0x4f147c){if(_0x4f147c){_0x2acf2d=_0x4f147c;_0x397bd0[_0x81db('0x35')]=_[_0x81db('0x31')](db[_0x81db('0x4b')]['rawAttributes']);_0x397bd0[_0x81db('0x30')]=_[_0x81db('0x31')](_0x1a2b6e['query']);_0x397bd0['filters']=_[_0x81db('0x34')](_0x397bd0[_0x81db('0x35')],_0x397bd0['query']);_0x5b594c[_0x81db('0x33')]=_[_0x81db('0x34')](_0x397bd0['model'],qs[_0x81db('0x36')](_0x1a2b6e['query']['fields']));_0x5b594c[_0x81db('0x33')]=_0x5b594c[_0x81db('0x33')][_0x81db('0x45')]?_0x5b594c[_0x81db('0x33')]:_0x397bd0[_0x81db('0x35')];_0x5b594c[_0x81db('0x38')]=qs[_0x81db('0x39')](_0x1a2b6e[_0x81db('0x30')][_0x81db('0x39')]);_0x5b594c['where']=qs[_0x81db('0x32')](_[_0x81db('0x4c')](_0x1a2b6e[_0x81db('0x30')],_0x397bd0[_0x81db('0x32')]));if(_0x1a2b6e[_0x81db('0x30')]['filter']){_0x5b594c['where']=_[_0x81db('0x3c')](_0x5b594c[_0x81db('0x3a')],{'$or':_[_0x81db('0x2a')](_0x5b594c[_0x81db('0x33')],function(_0x202b05){var _0x2a8250={};_0x2a8250[_0x202b05]={'$like':'%'+_0x1a2b6e['query']['filter']+'%'};return _0x2a8250;})});}_0x5b594c=_[_0x81db('0x3c')]({},_0x5b594c,_0x1a2b6e[_0x81db('0x4d')]);return _0x2acf2d[_0x81db('0x50')](_0x5b594c);}})[_0x81db('0x42')](function(_0x20de2e){if(_0x20de2e){_0x24188f=_0x20de2e['length'];if(!_0x1a2b6e[_0x81db('0x30')]['hasOwnProperty'](_0x81db('0x4e'))){_0x5b594c[_0x81db('0x20')]=qs[_0x81db('0x20')](_0x1a2b6e[_0x81db('0x30')]['limit']);_0x5b594c[_0x81db('0x1f')]=qs[_0x81db('0x1f')](_0x1a2b6e[_0x81db('0x30')][_0x81db('0x1f')]);}return _0x2acf2d[_0x81db('0x50')](_0x5b594c);}})[_0x81db('0x42')](function(_0x16bad7){if(_0x16bad7){return _0x16bad7?{'count':_0x24188f,'rows':_0x16bad7}:null;}})[_0x81db('0x42')](respondWithResult(_0x37e4f2,null))[_0x81db('0x43')](handleError(_0x37e4f2,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index e5a8894..ac5d1e0 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 _0x9f62=['api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util'];(function(_0xda0dfb,_0x19f923){var _0x164913=function(_0x2660fc){while(--_0x2660fc){_0xda0dfb['push'](_0xda0dfb['shift']());}};_0x164913(++_0x19f923);}(_0x9f62,0x154));var _0x29f6=function(_0x427359,_0x5ef689){_0x427359=_0x427359-0x0;var _0x8f00a8=_0x9f62[_0x427359];return _0x8f00a8;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb821=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','bluebird'];(function(_0x2638c7,_0x3e2ff3){var _0x3af4d2=function(_0x409c87){while(--_0x409c87){_0x2638c7['push'](_0x2638c7['shift']());}};_0x3af4d2(++_0x3e2ff3);}(_0xb821,0xa7));var _0x1b82=function(_0x16a20b,_0x57d4c1){_0x16a20b=_0x16a20b-0x0;var _0x3e86c2=_0xb821[_0x16a20b];return _0x3e86c2;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 38b204f..5d3b9b1 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 _0x9ca9=['request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x12af8d,_0x2b7101){var _0x2ab7de=function(_0x59e119){while(--_0x59e119){_0x12af8d['push'](_0x12af8d['shift']());}};_0x2ab7de(++_0x2b7101);}(_0x9ca9,0x1ab));var _0x99ca=function(_0xa8d7cb,_0x58cdb9){_0xa8d7cb=_0xa8d7cb-0x0;var _0x538572=_0x9ca9[_0xa8d7cb];return _0x538572;};'use strict';var _=require('lodash');var util=require(_0x99ca('0x0'));var moment=require(_0x99ca('0x1'));var BPromise=require(_0x99ca('0x2'));var rs=require(_0x99ca('0x3'));var fs=require('fs');var Redis=require(_0x99ca('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x99ca('0x5'));var logger=require('../../config/logger')(_0x99ca('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x99ca('0x7')][_0x99ca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ac57b,_0x200093,_0x2af360){return new BPromise(function(_0x5e407a,_0x1f3628){return client[_0x99ca('0x9')](_0x3ac57b,_0x2af360)[_0x99ca('0xa')](function(_0x17a33b){logger[_0x99ca('0xb')](_0x99ca('0xc'),_0x200093,_0x99ca('0xd'));logger[_0x99ca('0xe')](_0x99ca('0xf'),_0x200093,'request\x20sent',JSON[_0x99ca('0x10')](_0x17a33b));if(_0x17a33b[_0x99ca('0x11')]){if(_0x17a33b[_0x99ca('0x11')][_0x99ca('0x12')]===0x1f4){logger[_0x99ca('0x11')](_0x99ca('0xc'),_0x200093,_0x17a33b[_0x99ca('0x11')][_0x99ca('0x13')]);return _0x1f3628(_0x17a33b[_0x99ca('0x11')][_0x99ca('0x13')]);}logger[_0x99ca('0x11')](_0x99ca('0xc'),_0x200093,_0x17a33b[_0x99ca('0x11')]['message']);return _0x5e407a(_0x17a33b[_0x99ca('0x11')][_0x99ca('0x13')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x200093,_0x99ca('0xd'));_0x5e407a(_0x17a33b[_0x99ca('0x14')][_0x99ca('0x13')]);}})[_0x99ca('0x15')](function(_0x22e91a){logger[_0x99ca('0x11')](_0x99ca('0xc'),_0x200093,_0x22e91a);_0x1f3628(_0x22e91a);});});} \ No newline at end of file +var _0xcfea=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x21ecf3,_0x3b4b99){var _0x3cf63a=function(_0x536c67){while(--_0x536c67){_0x21ecf3['push'](_0x21ecf3['shift']());}};_0x3cf63a(++_0x3b4b99);}(_0xcfea,0x134));var _0xacfe=function(_0x136b43,_0x32bae0){_0x136b43=_0x136b43-0x0;var _0x2449a6=_0xcfea[_0x136b43];return _0x2449a6;};'use strict';var _=require(_0xacfe('0x0'));var util=require(_0xacfe('0x1'));var moment=require(_0xacfe('0x2'));var BPromise=require(_0xacfe('0x3'));var rs=require(_0xacfe('0x4'));var fs=require('fs');var Redis=require(_0xacfe('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xacfe('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xacfe('0x7'));var client=jayson[_0xacfe('0x8')][_0xacfe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d13ec,_0x5c56d2,_0x324a5b){return new BPromise(function(_0x358a9d,_0x4e077a){return client[_0xacfe('0xa')](_0x3d13ec,_0x324a5b)[_0xacfe('0xb')](function(_0x404c68){logger[_0xacfe('0xc')](_0xacfe('0xd'),_0x5c56d2,'request\x20sent');logger[_0xacfe('0xe')](_0xacfe('0xf'),_0x5c56d2,_0xacfe('0x10'),JSON['stringify'](_0x404c68));if(_0x404c68[_0xacfe('0x11')]){if(_0x404c68['error'][_0xacfe('0x12')]===0x1f4){logger[_0xacfe('0x11')](_0xacfe('0xd'),_0x5c56d2,_0x404c68[_0xacfe('0x11')][_0xacfe('0x13')]);return _0x4e077a(_0x404c68[_0xacfe('0x11')][_0xacfe('0x13')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x5c56d2,_0x404c68[_0xacfe('0x11')][_0xacfe('0x13')]);return _0x358a9d(_0x404c68[_0xacfe('0x11')][_0xacfe('0x13')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x5c56d2,_0xacfe('0x10'));_0x358a9d(_0x404c68[_0xacfe('0x14')]['message']);}})[_0xacfe('0x15')](function(_0xc5180c){logger[_0xacfe('0x11')](_0xacfe('0xd'),_0x5c56d2,_0xc5180c);_0x4e077a(_0xc5180c);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index c14caae..dbce0bd 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 _0x36eb=['destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','index','isAuthenticated','show','post','put','/:id','update','delete'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0x36eb,0xad));var _0xb36e=function(_0x1d3b18,_0x3460f7){_0x1d3b18=_0x1d3b18-0x0;var _0x336702=_0x36eb[_0x1d3b18];return _0x336702;};'use strict';var multer=require('multer');var util=require(_0xb36e('0x0'));var path=require(_0xb36e('0x1'));var timeout=require(_0xb36e('0x2'));var express=require(_0xb36e('0x3'));var router=express['Router']();var fs_extra=require(_0xb36e('0x4'));var auth=require(_0xb36e('0x5'));var interaction=require(_0xb36e('0x6'));var config=require(_0xb36e('0x7'));var controller=require(_0xb36e('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb36e('0x9')]);router['get']('/:id',auth[_0xb36e('0xa')](),controller[_0xb36e('0xb')]);router[_0xb36e('0xc')]('/',auth[_0xb36e('0xa')](),controller['create']);router[_0xb36e('0xd')](_0xb36e('0xe'),auth[_0xb36e('0xa')](),controller[_0xb36e('0xf')]);router[_0xb36e('0x10')]('/:id',auth[_0xb36e('0xa')](),controller[_0xb36e('0x11')]);module[_0xb36e('0x12')]=router; \ No newline at end of file +var _0xbe70=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','exports','multer'];(function(_0x1b45b0,_0x2cd9dc){var _0x2c206c=function(_0x1c2f84){while(--_0x1c2f84){_0x1b45b0['push'](_0x1b45b0['shift']());}};_0x2c206c(++_0x2cd9dc);}(_0xbe70,0x12f));var _0x0be7=function(_0x273963,_0x3aeb6e){_0x273963=_0x273963-0x0;var _0x3cf7de=_0xbe70[_0x273963];return _0x3cf7de;};'use strict';var multer=require(_0x0be7('0x0'));var util=require(_0x0be7('0x1'));var path=require(_0x0be7('0x2'));var timeout=require(_0x0be7('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0be7('0x4'));var auth=require(_0x0be7('0x5'));var interaction=require(_0x0be7('0x6'));var config=require(_0x0be7('0x7'));var controller=require(_0x0be7('0x8'));router[_0x0be7('0x9')]('/',auth['isAuthenticated'](),controller[_0x0be7('0xa')]);router[_0x0be7('0x9')](_0x0be7('0xb'),auth[_0x0be7('0xc')](),controller[_0x0be7('0xd')]);router[_0x0be7('0xe')]('/',auth['isAuthenticated'](),controller[_0x0be7('0xf')]);router[_0x0be7('0x10')](_0x0be7('0xb'),auth[_0x0be7('0xc')](),controller[_0x0be7('0x11')]);router['delete'](_0x0be7('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x0be7('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index db20a68..eae1efe 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 _0x0cd8=['variable','customVariable','keyValue','picklist','string','STRING','ENUM','BOOLEAN','exports'];(function(_0x2423a2,_0x4c1574){var _0x3f43a5=function(_0x390525){while(--_0x390525){_0x2423a2['push'](_0x2423a2['shift']());}};_0x3f43a5(++_0x4c1574);}(_0x0cd8,0xfb));var _0x80cd=function(_0x584a0e,_0x2638d0){_0x584a0e=_0x584a0e-0x0;var _0x4dc726=_0x0cd8[_0x584a0e];return _0x4dc726;};'use strict';var Sequelize=require('sequelize');module[_0x80cd('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x80cd('0x1'),_0x80cd('0x2'),_0x80cd('0x3'),_0x80cd('0x4')),'defaultValue':_0x80cd('0x5')},'content':{'type':Sequelize[_0x80cd('0x6')]},'key':{'type':Sequelize[_0x80cd('0x6')]},'keyType':{'type':Sequelize[_0x80cd('0x7')]('string',_0x80cd('0x1'),'customVariable')},'keyContent':{'type':Sequelize[_0x80cd('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x80cd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x80cd('0x6')]}}; \ No newline at end of file +var _0x035c=['keyValue','picklist','STRING','string','variable','BOOLEAN','sequelize','exports','ENUM','customVariable'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x035c,0x1a0));var _0xc035=function(_0x44ec86,_0x2c6106){_0x44ec86=_0x44ec86-0x0;var _0xbf55cd=_0x035c[_0x44ec86];return _0xbf55cd;};'use strict';var Sequelize=require(_0xc035('0x0'));module[_0xc035('0x1')]={'type':{'type':Sequelize[_0xc035('0x2')]('string','variable',_0xc035('0x3'),_0xc035('0x4'),_0xc035('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc035('0x6')]},'keyType':{'type':Sequelize[_0xc035('0x2')](_0xc035('0x7'),_0xc035('0x8'),_0xc035('0x3'))},'keyContent':{'type':Sequelize[_0xc035('0x6')]},'idField':{'type':Sequelize[_0xc035('0x6')]},'nameField':{'type':Sequelize[_0xc035('0x6')]},'customField':{'type':Sequelize[_0xc035('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc035('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 736570b..70eb2cf 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 _0x7949=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','reject','update','then','destroy','error','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','merge','options','find','create','body','rimraf','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x18a188,_0x53651a){var _0x57e1e9=function(_0x5acdad){while(--_0x5acdad){_0x18a188['push'](_0x18a188['shift']());}};_0x57e1e9(++_0x53651a);}(_0x7949,0x152));var _0x9794=function(_0x102050,_0x56f06c){_0x102050=_0x102050-0x0;var _0x51fbc8=_0x7949[_0x102050];return _0x51fbc8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9794('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9794('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9794('0x2'));var Mustache=require(_0x9794('0x3'));var util=require(_0x9794('0x4'));var path=require(_0x9794('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9794('0x6'));var fs=require('fs');var fs_extra=require(_0x9794('0x7'));var _=require(_0x9794('0x8'));var squel=require(_0x9794('0x9'));var crypto=require(_0x9794('0xa'));var jsforce=require(_0x9794('0xb'));var deskjs=require(_0x9794('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9794('0xd'));var Papa=require(_0x9794('0xe'));var Redis=require(_0x9794('0xf'));var authService=require(_0x9794('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9794('0x11'));var hardwareService=require(_0x9794('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x9794('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9794('0x14'));var db=require(_0x9794('0x15'))['db'];function respondWithStatusCode(_0x1ef71f,_0x23fa19){_0x23fa19=_0x23fa19||0xcc;return function(_0x12120e){if(_0x12120e){return _0x1ef71f[_0x9794('0x16')](_0x23fa19);}return _0x1ef71f[_0x9794('0x17')](_0x23fa19)[_0x9794('0x18')]();};}function respondWithResult(_0x274b8c,_0x4f0f14){_0x4f0f14=_0x4f0f14||0xc8;return function(_0x4413fd){if(_0x4413fd){return _0x274b8c['status'](_0x4f0f14)[_0x9794('0x19')](_0x4413fd);}};}function respondWithFilteredResult(_0x56062c,_0x2d4393){return function(_0x48eee9){if(_0x48eee9){var _0xbe49b2=typeof _0x2d4393[_0x9794('0x1a')]==='undefined'&&typeof _0x2d4393[_0x9794('0x1b')]==='undefined';var _0x192708=_0x48eee9[_0x9794('0x1c')];var _0x40b99c=_0xbe49b2?0x0:_0x2d4393[_0x9794('0x1a')];var _0x54fb9b=_0xbe49b2?_0x48eee9[_0x9794('0x1c')]:_0x2d4393['offset']+_0x2d4393[_0x9794('0x1b')];var _0x27153b;if(_0x54fb9b>=_0x192708){_0x54fb9b=_0x192708;_0x27153b=0xc8;}else{_0x27153b=0xce;}_0x56062c['status'](_0x27153b);return _0x56062c[_0x9794('0x1d')]('Content-Range',_0x40b99c+'-'+_0x54fb9b+'/'+_0x192708)['json'](_0x48eee9);}return null;};}function patchUpdates(_0xccab28){return function(_0x171090){try{jsonpatch['apply'](_0x171090,_0xccab28,!![]);}catch(_0x13ef82){return BPromise[_0x9794('0x1e')](_0x13ef82);}return _0x171090['save']();};}function saveUpdates(_0x2694c8,_0x1cdd0e){return function(_0x151027){if(_0x151027){return _0x151027[_0x9794('0x1f')](_0x2694c8)[_0x9794('0x20')](function(_0xe6f58){return _0xe6f58;});}return null;};}function removeEntity(_0x5aa3ec,_0x2a215f){return function(_0x35e901){if(_0x35e901){return _0x35e901[_0x9794('0x21')]()[_0x9794('0x20')](function(){_0x5aa3ec['status'](0xcc)[_0x9794('0x18')]();});}};}function handleEntityNotFound(_0x3919f8,_0xa9abdd){return function(_0x3b3c18){if(!_0x3b3c18){_0x3919f8[_0x9794('0x16')](0x194);}return _0x3b3c18;};}function handleError(_0x3abe5d,_0x8356c7){_0x8356c7=_0x8356c7||0x1f4;return function(_0x35b4a6){logger[_0x9794('0x22')](_0x35b4a6[_0x9794('0x23')]);if(_0x35b4a6['name']){delete _0x35b4a6[_0x9794('0x24')];}_0x3abe5d['status'](_0x8356c7)[_0x9794('0x25')](_0x35b4a6);};}exports[_0x9794('0x26')]=function(_0x17e300,_0x219ee0){var _0x4b7753={},_0xb3eb79={},_0x259509={'count':0x0,'rows':[]};var _0x24e446=_['map'](db[_0x9794('0x27')][_0x9794('0x28')],function(_0x5a1d28){return{'name':_0x5a1d28[_0x9794('0x29')],'type':_0x5a1d28[_0x9794('0x2a')][_0x9794('0x2b')]};});_0xb3eb79[_0x9794('0x2c')]=_['map'](_0x24e446,_0x9794('0x24'));_0xb3eb79[_0x9794('0x2d')]=_[_0x9794('0x2e')](_0x17e300[_0x9794('0x2d')]);_0xb3eb79[_0x9794('0x2f')]=_[_0x9794('0x30')](_0xb3eb79[_0x9794('0x2c')],_0xb3eb79[_0x9794('0x2d')]);_0x4b7753[_0x9794('0x31')]=_[_0x9794('0x30')](_0xb3eb79[_0x9794('0x2c')],qs[_0x9794('0x32')](_0x17e300['query'][_0x9794('0x32')]));_0x4b7753[_0x9794('0x31')]=_0x4b7753['attributes'][_0x9794('0x33')]?_0x4b7753['attributes']:_0xb3eb79[_0x9794('0x2c')];if(!_0x17e300[_0x9794('0x2d')][_0x9794('0x34')](_0x9794('0x35'))){_0x4b7753[_0x9794('0x1b')]=qs[_0x9794('0x1b')](_0x17e300[_0x9794('0x2d')][_0x9794('0x1b')]);_0x4b7753[_0x9794('0x1a')]=qs['offset'](_0x17e300[_0x9794('0x2d')]['offset']);}_0x4b7753[_0x9794('0x36')]=qs['sort'](_0x17e300[_0x9794('0x2d')][_0x9794('0x37')]);_0x4b7753[_0x9794('0x38')]=qs[_0x9794('0x2f')](_['pick'](_0x17e300[_0x9794('0x2d')],_0xb3eb79[_0x9794('0x2f')]),_0x24e446);if(_0x17e300['query'][_0x9794('0x39')]){_0x4b7753[_0x9794('0x38')]=_['merge'](_0x4b7753[_0x9794('0x38')],{'$or':_['map'](_0x24e446,function(_0x41927a){if(_0x41927a[_0x9794('0x2a')]!==_0x9794('0x3a')){var _0x3def13={};_0x3def13[_0x41927a[_0x9794('0x24')]]={'$like':'%'+_0x17e300[_0x9794('0x2d')]['filter']+'%'};return _0x3def13;}})});}_0x4b7753=_['merge']({},_0x4b7753,_0x17e300['options']);var _0xa98ea={'where':_0x4b7753['where']};return db[_0x9794('0x27')]['count'](_0xa98ea)[_0x9794('0x20')](function(_0x5835a7){_0x259509[_0x9794('0x1c')]=_0x5835a7;if(_0x17e300[_0x9794('0x2d')][_0x9794('0x3b')]){_0x4b7753[_0x9794('0x3c')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x9794('0x3d')](_0x4b7753);})[_0x9794('0x20')](function(_0x293fb8){_0x259509[_0x9794('0x3e')]=_0x293fb8;return _0x259509;})[_0x9794('0x20')](respondWithFilteredResult(_0x219ee0,_0x4b7753))[_0x9794('0x3f')](handleError(_0x219ee0,null));};exports[_0x9794('0x40')]=function(_0x59f9b8,_0x2efa28){var _0x1f5c7a={'raw':!![],'where':{'id':_0x59f9b8[_0x9794('0x41')]['id']}},_0x5e7a7a={};_0x5e7a7a[_0x9794('0x2c')]=_['keys'](db[_0x9794('0x27')]['rawAttributes']);_0x5e7a7a[_0x9794('0x2d')]=_[_0x9794('0x2e')](_0x59f9b8[_0x9794('0x2d')]);_0x5e7a7a[_0x9794('0x2f')]=_[_0x9794('0x30')](_0x5e7a7a[_0x9794('0x2c')],_0x5e7a7a[_0x9794('0x2d')]);_0x1f5c7a[_0x9794('0x31')]=_['intersection'](_0x5e7a7a[_0x9794('0x2c')],qs['fields'](_0x59f9b8[_0x9794('0x2d')][_0x9794('0x32')]));_0x1f5c7a[_0x9794('0x31')]=_0x1f5c7a['attributes'][_0x9794('0x33')]?_0x1f5c7a[_0x9794('0x31')]:_0x5e7a7a[_0x9794('0x2c')];if(_0x59f9b8[_0x9794('0x2d')][_0x9794('0x3b')]){_0x1f5c7a[_0x9794('0x3c')]=[{'all':!![]}];}_0x1f5c7a=_[_0x9794('0x42')]({},_0x1f5c7a,_0x59f9b8[_0x9794('0x43')]);return db[_0x9794('0x27')][_0x9794('0x44')](_0x1f5c7a)['then'](handleEntityNotFound(_0x2efa28,null))[_0x9794('0x20')](respondWithResult(_0x2efa28,null))[_0x9794('0x3f')](handleError(_0x2efa28,null));};exports[_0x9794('0x45')]=function(_0x4cd97d,_0x71132f){return db[_0x9794('0x27')]['create'](_0x4cd97d[_0x9794('0x46')],{})[_0x9794('0x20')](respondWithResult(_0x71132f,0xc9))[_0x9794('0x3f')](handleError(_0x71132f,null));};exports[_0x9794('0x1f')]=function(_0xef63da,_0x525139){if(_0xef63da['body']['id']){delete _0xef63da[_0x9794('0x46')]['id'];}return db['Dynamics365Field'][_0x9794('0x44')]({'where':{'id':_0xef63da[_0x9794('0x41')]['id']}})[_0x9794('0x20')](handleEntityNotFound(_0x525139,null))[_0x9794('0x20')](saveUpdates(_0xef63da[_0x9794('0x46')],null))[_0x9794('0x20')](respondWithResult(_0x525139,null))[_0x9794('0x3f')](handleError(_0x525139,null));};exports[_0x9794('0x21')]=function(_0x3f6ea0,_0x375211){return db[_0x9794('0x27')][_0x9794('0x44')]({'where':{'id':_0x3f6ea0[_0x9794('0x41')]['id']}})['then'](handleEntityNotFound(_0x375211,null))[_0x9794('0x20')](removeEntity(_0x375211,null))['catch'](handleError(_0x375211,null));}; \ No newline at end of file +var _0x8be8=['catch','keys','includeAll','include','options','find','create','body','params','eml-format','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','findAll'];(function(_0x5f2bd3,_0xa1da97){var _0x15134b=function(_0x46a88d){while(--_0x46a88d){_0x5f2bd3['push'](_0x5f2bd3['shift']());}};_0x15134b(++_0xa1da97);}(_0x8be8,0xd8));var _0x88be=function(_0x239394,_0x55e733){_0x239394=_0x239394-0x0;var _0x596491=_0x8be8[_0x239394];return _0x596491;};'use strict';var emlformat=require(_0x88be('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x88be('0x1'));var Mustache=require(_0x88be('0x2'));var util=require(_0x88be('0x3'));var path=require(_0x88be('0x4'));var sox=require(_0x88be('0x5'));var csv=require(_0x88be('0x6'));var ejs=require(_0x88be('0x7'));var fs=require('fs');var fs_extra=require(_0x88be('0x8'));var _=require(_0x88be('0x9'));var squel=require('squel');var crypto=require(_0x88be('0xa'));var jsforce=require(_0x88be('0xb'));var deskjs=require(_0x88be('0xc'));var toCsv=require(_0x88be('0x6'));var querystring=require('querystring');var Papa=require(_0x88be('0xd'));var Redis=require('ioredis');var authService=require(_0x88be('0xe'));var qs=require(_0x88be('0xf'));var as=require(_0x88be('0x10'));var hardwareService=require(_0x88be('0x11'));var logger=require(_0x88be('0x12'))(_0x88be('0x13'));var utils=require('../../config/utils');var config=require(_0x88be('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x88be('0x15'))['db'];function respondWithStatusCode(_0x2ef7b2,_0x4db065){_0x4db065=_0x4db065||0xcc;return function(_0x4d752d){if(_0x4d752d){return _0x2ef7b2[_0x88be('0x16')](_0x4db065);}return _0x2ef7b2[_0x88be('0x17')](_0x4db065)[_0x88be('0x18')]();};}function respondWithResult(_0xaff36,_0x1a0b8d){_0x1a0b8d=_0x1a0b8d||0xc8;return function(_0x374c6c){if(_0x374c6c){return _0xaff36[_0x88be('0x17')](_0x1a0b8d)['json'](_0x374c6c);}};}function respondWithFilteredResult(_0x4a9f72,_0x388db9){return function(_0xd80131){if(_0xd80131){var _0x26fb4e=typeof _0x388db9[_0x88be('0x19')]===_0x88be('0x1a')&&typeof _0x388db9[_0x88be('0x1b')]===_0x88be('0x1a');var _0x168aa7=_0xd80131[_0x88be('0x1c')];var _0x5e6c61=_0x26fb4e?0x0:_0x388db9['offset'];var _0x5695df=_0x26fb4e?_0xd80131[_0x88be('0x1c')]:_0x388db9['offset']+_0x388db9['limit'];var _0x1a5299;if(_0x5695df>=_0x168aa7){_0x5695df=_0x168aa7;_0x1a5299=0xc8;}else{_0x1a5299=0xce;}_0x4a9f72['status'](_0x1a5299);return _0x4a9f72[_0x88be('0x1d')](_0x88be('0x1e'),_0x5e6c61+'-'+_0x5695df+'/'+_0x168aa7)[_0x88be('0x1f')](_0xd80131);}return null;};}function patchUpdates(_0x42ff87){return function(_0x1ee492){try{jsonpatch[_0x88be('0x20')](_0x1ee492,_0x42ff87,!![]);}catch(_0x53b6a7){return BPromise['reject'](_0x53b6a7);}return _0x1ee492[_0x88be('0x21')]();};}function saveUpdates(_0x4daa49,_0xef7b95){return function(_0x53cf29){if(_0x53cf29){return _0x53cf29[_0x88be('0x22')](_0x4daa49)[_0x88be('0x23')](function(_0x1f702e){return _0x1f702e;});}return null;};}function removeEntity(_0x202d04,_0x4b35a5){return function(_0x2c0524){if(_0x2c0524){return _0x2c0524['destroy']()['then'](function(){_0x202d04[_0x88be('0x17')](0xcc)[_0x88be('0x18')]();});}};}function handleEntityNotFound(_0x50d4b5,_0x4cd010){return function(_0x442c7d){if(!_0x442c7d){_0x50d4b5['sendStatus'](0x194);}return _0x442c7d;};}function handleError(_0x4ff860,_0x2dc363){_0x2dc363=_0x2dc363||0x1f4;return function(_0xe96d9d){logger['error'](_0xe96d9d[_0x88be('0x24')]);if(_0xe96d9d[_0x88be('0x25')]){delete _0xe96d9d[_0x88be('0x25')];}_0x4ff860[_0x88be('0x17')](_0x2dc363)[_0x88be('0x26')](_0xe96d9d);};}exports[_0x88be('0x27')]=function(_0x5d6f40,_0x13da1c){var _0x162313={},_0x26c1ca={},_0x50fb8c={'count':0x0,'rows':[]};var _0x461832=_[_0x88be('0x28')](db[_0x88be('0x29')][_0x88be('0x2a')],function(_0x3347b6){return{'name':_0x3347b6[_0x88be('0x2b')],'type':_0x3347b6[_0x88be('0x2c')][_0x88be('0x2d')]};});_0x26c1ca[_0x88be('0x2e')]=_['map'](_0x461832,_0x88be('0x25'));_0x26c1ca[_0x88be('0x2f')]=_['keys'](_0x5d6f40[_0x88be('0x2f')]);_0x26c1ca[_0x88be('0x30')]=_['intersection'](_0x26c1ca[_0x88be('0x2e')],_0x26c1ca[_0x88be('0x2f')]);_0x162313[_0x88be('0x31')]=_[_0x88be('0x32')](_0x26c1ca[_0x88be('0x2e')],qs[_0x88be('0x33')](_0x5d6f40['query']['fields']));_0x162313[_0x88be('0x31')]=_0x162313[_0x88be('0x31')][_0x88be('0x34')]?_0x162313[_0x88be('0x31')]:_0x26c1ca[_0x88be('0x2e')];if(!_0x5d6f40[_0x88be('0x2f')]['hasOwnProperty'](_0x88be('0x35'))){_0x162313[_0x88be('0x1b')]=qs[_0x88be('0x1b')](_0x5d6f40[_0x88be('0x2f')]['limit']);_0x162313['offset']=qs[_0x88be('0x19')](_0x5d6f40[_0x88be('0x2f')]['offset']);}_0x162313['order']=qs[_0x88be('0x36')](_0x5d6f40[_0x88be('0x2f')][_0x88be('0x36')]);_0x162313[_0x88be('0x37')]=qs[_0x88be('0x30')](_[_0x88be('0x38')](_0x5d6f40[_0x88be('0x2f')],_0x26c1ca[_0x88be('0x30')]),_0x461832);if(_0x5d6f40['query'][_0x88be('0x39')]){_0x162313[_0x88be('0x37')]=_[_0x88be('0x3a')](_0x162313[_0x88be('0x37')],{'$or':_[_0x88be('0x28')](_0x461832,function(_0x4bab94){if(_0x4bab94[_0x88be('0x2c')]!=='VIRTUAL'){var _0x294052={};_0x294052[_0x4bab94['name']]={'$like':'%'+_0x5d6f40['query'][_0x88be('0x39')]+'%'};return _0x294052;}})});}_0x162313=_['merge']({},_0x162313,_0x5d6f40['options']);var _0x409fa5={'where':_0x162313[_0x88be('0x37')]};return db['Dynamics365Field']['count'](_0x409fa5)[_0x88be('0x23')](function(_0x3dd5ac){_0x50fb8c[_0x88be('0x1c')]=_0x3dd5ac;if(_0x5d6f40[_0x88be('0x2f')]['includeAll']){_0x162313['include']=[{'all':!![]}];}return db[_0x88be('0x29')][_0x88be('0x3b')](_0x162313);})['then'](function(_0x37dff2){_0x50fb8c['rows']=_0x37dff2;return _0x50fb8c;})['then'](respondWithFilteredResult(_0x13da1c,_0x162313))[_0x88be('0x3c')](handleError(_0x13da1c,null));};exports['show']=function(_0x527083,_0x35b215){var _0x4d20a6={'raw':!![],'where':{'id':_0x527083['params']['id']}},_0x13b274={};_0x13b274['model']=_[_0x88be('0x3d')](db['Dynamics365Field'][_0x88be('0x2a')]);_0x13b274[_0x88be('0x2f')]=_['keys'](_0x527083['query']);_0x13b274[_0x88be('0x30')]=_[_0x88be('0x32')](_0x13b274['model'],_0x13b274['query']);_0x4d20a6[_0x88be('0x31')]=_[_0x88be('0x32')](_0x13b274['model'],qs[_0x88be('0x33')](_0x527083[_0x88be('0x2f')][_0x88be('0x33')]));_0x4d20a6[_0x88be('0x31')]=_0x4d20a6[_0x88be('0x31')]['length']?_0x4d20a6[_0x88be('0x31')]:_0x13b274[_0x88be('0x2e')];if(_0x527083[_0x88be('0x2f')][_0x88be('0x3e')]){_0x4d20a6[_0x88be('0x3f')]=[{'all':!![]}];}_0x4d20a6=_[_0x88be('0x3a')]({},_0x4d20a6,_0x527083[_0x88be('0x40')]);return db[_0x88be('0x29')][_0x88be('0x41')](_0x4d20a6)[_0x88be('0x23')](handleEntityNotFound(_0x35b215,null))[_0x88be('0x23')](respondWithResult(_0x35b215,null))['catch'](handleError(_0x35b215,null));};exports[_0x88be('0x42')]=function(_0x484bbc,_0x2631a5){return db[_0x88be('0x29')]['create'](_0x484bbc[_0x88be('0x43')],{})['then'](respondWithResult(_0x2631a5,0xc9))[_0x88be('0x3c')](handleError(_0x2631a5,null));};exports[_0x88be('0x22')]=function(_0x2d80f6,_0x1aa59b){if(_0x2d80f6['body']['id']){delete _0x2d80f6[_0x88be('0x43')]['id'];}return db[_0x88be('0x29')][_0x88be('0x41')]({'where':{'id':_0x2d80f6[_0x88be('0x44')]['id']}})['then'](handleEntityNotFound(_0x1aa59b,null))[_0x88be('0x23')](saveUpdates(_0x2d80f6['body'],null))[_0x88be('0x23')](respondWithResult(_0x1aa59b,null))[_0x88be('0x3c')](handleError(_0x1aa59b,null));};exports['destroy']=function(_0xafe236,_0xd2e0e0){return db[_0x88be('0x29')][_0x88be('0x41')]({'where':{'id':_0xafe236[_0x88be('0x44')]['id']}})[_0x88be('0x23')](handleEntityNotFound(_0xd2e0e0,null))[_0x88be('0x23')](removeEntity(_0xd2e0e0,null))[_0x88be('0x3c')](handleError(_0xd2e0e0,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index c621672..cf7c5b1 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 _0x4bef=['lodash','util','../../config/logger','bluebird','request-promise','rimraf','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId'];(function(_0xd9f102,_0x5a0d28){var _0x2652e4=function(_0x5021a1){while(--_0x5021a1){_0xd9f102['push'](_0xd9f102['shift']());}};_0x2652e4(++_0x5a0d28);}(_0x4bef,0x6e));var _0xf4be=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0x4bef[_0x5e6cb8];return _0x3faeb3;};'use strict';var _=require(_0xf4be('0x0'));var util=require(_0xf4be('0x1'));var logger=require(_0xf4be('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf4be('0x3'));var rp=require(_0xf4be('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf4be('0x5'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x196fea,_0x43c504){return _0x196fea['define'](_0xf4be('0x6'),attributes,{'tableName':_0xf4be('0x7'),'paranoid':![],'indexes':[{'name':_0xf4be('0x8'),'fields':[_0xf4be('0x9'),_0xf4be('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa18c=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId'];(function(_0x59e932,_0x2c522c){var _0xebd075=function(_0x486ad4){while(--_0x486ad4){_0x59e932['push'](_0x59e932['shift']());}};_0xebd075(++_0x2c522c);}(_0xa18c,0x165));var _0xca18=function(_0x101e6b,_0x57fe42){_0x101e6b=_0x101e6b-0x0;var _0x37b281=_0xa18c[_0x101e6b];return _0x37b281;};'use strict';var _=require(_0xca18('0x0'));var util=require(_0xca18('0x1'));var logger=require('../../config/logger')(_0xca18('0x2'));var moment=require(_0xca18('0x3'));var BPromise=require(_0xca18('0x4'));var rp=require(_0xca18('0x5'));var fs=require('fs');var path=require(_0xca18('0x6'));var rimraf=require(_0xca18('0x7'));var config=require(_0xca18('0x8'));var attributes=require(_0xca18('0x9'));module[_0xca18('0xa')]=function(_0x15c84e,_0x2bf859){return _0x15c84e[_0xca18('0xb')](_0xca18('0xc'),attributes,{'tableName':_0xca18('0xd'),'paranoid':![],'indexes':[{'name':_0xca18('0xe'),'fields':[_0xca18('0xf'),_0xca18('0x10')],'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 f8b7fc8..cca3598 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 _0xc3a2=['../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xc3a2,0xec));var _0x2c3a=function(_0x3c2b58,_0x2e7c3c){_0x3c2b58=_0x3c2b58-0x0;var _0x4f92bf=_0xc3a2[_0x3c2b58];return _0x4f92bf;};'use strict';var _=require(_0x2c3a('0x0'));var util=require(_0x2c3a('0x1'));var moment=require('moment');var BPromise=require(_0x2c3a('0x2'));var rs=require(_0x2c3a('0x3'));var fs=require('fs');var Redis=require(_0x2c3a('0x4'));var db=require(_0x2c3a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c3a('0x6'))('rpc');var config=require(_0x2c3a('0x7'));var jayson=require(_0x2c3a('0x8'));var client=jayson['client'][_0x2c3a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2861f5,_0x1a4dcf,_0x39717c){return new BPromise(function(_0x1a9cf6,_0x22e5d3){return client[_0x2c3a('0xa')](_0x2861f5,_0x39717c)[_0x2c3a('0xb')](function(_0x3aeceb){logger[_0x2c3a('0xc')](_0x2c3a('0xd'),_0x1a4dcf,_0x2c3a('0xe'));logger['debug'](_0x2c3a('0xf'),_0x1a4dcf,_0x2c3a('0xe'),JSON[_0x2c3a('0x10')](_0x3aeceb));if(_0x3aeceb['error']){if(_0x3aeceb[_0x2c3a('0x11')][_0x2c3a('0x12')]===0x1f4){logger[_0x2c3a('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x1a4dcf,_0x3aeceb[_0x2c3a('0x11')][_0x2c3a('0x13')]);return _0x22e5d3(_0x3aeceb[_0x2c3a('0x11')][_0x2c3a('0x13')]);}logger[_0x2c3a('0x11')](_0x2c3a('0xd'),_0x1a4dcf,_0x3aeceb[_0x2c3a('0x11')][_0x2c3a('0x13')]);return _0x1a9cf6(_0x3aeceb[_0x2c3a('0x11')]['message']);}else{logger[_0x2c3a('0xc')](_0x2c3a('0xd'),_0x1a4dcf,_0x2c3a('0xe'));_0x1a9cf6(_0x3aeceb[_0x2c3a('0x14')][_0x2c3a('0x13')]);}})[_0x2c3a('0x15')](function(_0xfba169){logger[_0x2c3a('0x11')](_0x2c3a('0xd'),_0x1a4dcf,_0xfba169);_0x22e5d3(_0xfba169);});});} \ No newline at end of file +var _0xc988=['rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x41925c,_0x14b681){var _0x5db3a0=function(_0x7a498a){while(--_0x7a498a){_0x41925c['push'](_0x41925c['shift']());}};_0x5db3a0(++_0x14b681);}(_0xc988,0x189));var _0x8c98=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xc988[_0x44946b];return _0x249bc4;};'use strict';var _=require(_0x8c98('0x0'));var util=require(_0x8c98('0x1'));var moment=require(_0x8c98('0x2'));var BPromise=require('bluebird');var rs=require(_0x8c98('0x3'));var fs=require('fs');var Redis=require(_0x8c98('0x4'));var db=require(_0x8c98('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c98('0x6'))(_0x8c98('0x7'));var config=require(_0x8c98('0x8'));var jayson=require(_0x8c98('0x9'));var client=jayson['client'][_0x8c98('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49b9e1,_0x2bb342,_0xfca4c4){return new BPromise(function(_0x2a6a63,_0x26b299){return client[_0x8c98('0xb')](_0x49b9e1,_0xfca4c4)[_0x8c98('0xc')](function(_0x574b21){logger[_0x8c98('0xd')](_0x8c98('0xe'),_0x2bb342,_0x8c98('0xf'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x2bb342,_0x8c98('0xf'),JSON[_0x8c98('0x10')](_0x574b21));if(_0x574b21[_0x8c98('0x11')]){if(_0x574b21[_0x8c98('0x11')][_0x8c98('0x12')]===0x1f4){logger[_0x8c98('0x11')](_0x8c98('0xe'),_0x2bb342,_0x574b21[_0x8c98('0x11')][_0x8c98('0x13')]);return _0x26b299(_0x574b21[_0x8c98('0x11')][_0x8c98('0x13')]);}logger[_0x8c98('0x11')](_0x8c98('0xe'),_0x2bb342,_0x574b21[_0x8c98('0x11')][_0x8c98('0x13')]);return _0x2a6a63(_0x574b21['error'][_0x8c98('0x13')]);}else{logger[_0x8c98('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x2bb342,_0x8c98('0xf'));_0x2a6a63(_0x574b21['result'][_0x8c98('0x13')]);}})['catch'](function(_0x10b450){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x2bb342,_0x10b450);_0x26b299(_0x10b450);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index fc2cb27..699dcd4 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 _0x27d8=['destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','put','update','delete'];(function(_0x19258b,_0x22e850){var _0x5be66a=function(_0x24e321){while(--_0x24e321){_0x19258b['push'](_0x19258b['shift']());}};_0x5be66a(++_0x22e850);}(_0x27d8,0x74));var _0x827d=function(_0x54381d,_0x247b2c){_0x54381d=_0x54381d-0x0;var _0x5308a7=_0x27d8[_0x54381d];return _0x5308a7;};'use strict';var multer=require(_0x827d('0x0'));var util=require(_0x827d('0x1'));var path=require(_0x827d('0x2'));var timeout=require(_0x827d('0x3'));var express=require(_0x827d('0x4'));var router=express['Router']();var fs_extra=require(_0x827d('0x5'));var auth=require(_0x827d('0x6'));var interaction=require(_0x827d('0x7'));var config=require('../../config/environment');var controller=require(_0x827d('0x8'));router[_0x827d('0x9')]('/',auth[_0x827d('0xa')](),controller[_0x827d('0xb')]);router[_0x827d('0x9')](_0x827d('0xc'),auth[_0x827d('0xa')](),controller[_0x827d('0xd')]);router['get'](_0x827d('0xe'),auth['isAuthenticated'](),controller[_0x827d('0xf')]);router['get']('/:id/fields',auth[_0x827d('0xa')](),controller[_0x827d('0x10')]);router[_0x827d('0x11')]('/',auth[_0x827d('0xa')](),controller[_0x827d('0x12')]);router[_0x827d('0x11')](_0x827d('0xe'),auth[_0x827d('0xa')](),controller['addConfiguration']);router[_0x827d('0x13')](_0x827d('0xc'),auth[_0x827d('0xa')](),controller[_0x827d('0x14')]);router[_0x827d('0x15')](_0x827d('0xc'),auth[_0x827d('0xa')](),controller[_0x827d('0x16')]);module['exports']=router; \ No newline at end of file +var _0x3e5d=['isAuthenticated','index','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get'];(function(_0x26e7fc,_0x49ca39){var _0x3230ca=function(_0x51d88c){while(--_0x51d88c){_0x26e7fc['push'](_0x26e7fc['shift']());}};_0x3230ca(++_0x49ca39);}(_0x3e5d,0x81));var _0xd3e5=function(_0x45ff85,_0x14adde){_0x45ff85=_0x45ff85-0x0;var _0x73c5fc=_0x3e5d[_0x45ff85];return _0x73c5fc;};'use strict';var multer=require(_0xd3e5('0x0'));var util=require(_0xd3e5('0x1'));var path=require(_0xd3e5('0x2'));var timeout=require(_0xd3e5('0x3'));var express=require(_0xd3e5('0x4'));var router=express[_0xd3e5('0x5')]();var fs_extra=require(_0xd3e5('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd3e5('0x7'));var controller=require('./intFreshdeskAccount.controller');router[_0xd3e5('0x8')]('/',auth[_0xd3e5('0x9')](),controller[_0xd3e5('0xa')]);router[_0xd3e5('0x8')]('/:id',auth[_0xd3e5('0x9')](),controller['show']);router[_0xd3e5('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xd3e5('0xb')]);router[_0xd3e5('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xd3e5('0xc')]);router[_0xd3e5('0xd')]('/',auth[_0xd3e5('0x9')](),controller[_0xd3e5('0xe')]);router[_0xd3e5('0xd')](_0xd3e5('0xf'),auth[_0xd3e5('0x9')](),controller[_0xd3e5('0x10')]);router[_0xd3e5('0x11')]('/:id',auth[_0xd3e5('0x9')](),controller[_0xd3e5('0x12')]);router[_0xd3e5('0x13')](_0xd3e5('0x14'),auth[_0xd3e5('0x9')](),controller[_0xd3e5('0x15')]);module[_0xd3e5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index b8391f1..1a7df6d 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 _0x2032=['remoteUri','exports','STRING','username'];(function(_0x4c799c,_0x553f73){var _0x50385e=function(_0x34c7aa){while(--_0x34c7aa){_0x4c799c['push'](_0x4c799c['shift']());}};_0x50385e(++_0x553f73);}(_0x2032,0xd9));var _0x2203=function(_0x1cda3e,_0x1a5e5e){_0x1cda3e=_0x1cda3e-0x0;var _0xef38f=_0x2032[_0x1cda3e];return _0xef38f;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')]},'description':{'type':Sequelize[_0x2203('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x2203('0x2')},'apiKey':{'type':Sequelize[_0x2203('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x2203('0x3')},'serverUrl':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2272=['sequelize','exports','STRING','remoteUri'];(function(_0x1f4e09,_0x1fc591){var _0x10deec=function(_0x5c1fb9){while(--_0x5c1fb9){_0x1f4e09['push'](_0x1f4e09['shift']());}};_0x10deec(++_0x1fc591);}(_0x2272,0xd8));var _0x2227=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2272[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x2227('0x0'));module[_0x2227('0x1')]={'name':{'type':Sequelize[_0x2227('0x2')]},'description':{'type':Sequelize[_0x2227('0x2')]},'username':{'type':Sequelize[_0x2227('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x2227('0x2')]},'remoteUri':{'type':Sequelize[_0x2227('0x2')],'unique':_0x2227('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 8302076..a33d9ce 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 _0xe211=['group','source','ticket_type','company','remove','includes','custom_text','label','default','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','statusCode','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','FreshdeskAccount','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','order','sort','where','pick','merge','VIRTUAL','filter','count','findAll','catch','show','params','rawAttributes','includeAll','include','find','create','body','findOne','options','hasOwnProperty','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','agent','description','priority'];(function(_0x5ac339,_0x2958f2){var _0x5f3931=function(_0x15a15b){while(--_0x15a15b){_0x5ac339['push'](_0x5ac339['shift']());}};_0x5f3931(++_0x2958f2);}(_0xe211,0x166));var _0x1e21=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe211[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1e21('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1e21('0x1'));var moment=require(_0x1e21('0x2'));var BPromise=require(_0x1e21('0x3'));var Mustache=require(_0x1e21('0x4'));var util=require(_0x1e21('0x5'));var path=require('path');var sox=require(_0x1e21('0x6'));var csv=require(_0x1e21('0x7'));var ejs=require(_0x1e21('0x8'));var fs=require('fs');var fs_extra=require(_0x1e21('0x9'));var _=require(_0x1e21('0xa'));var squel=require('squel');var crypto=require(_0x1e21('0xb'));var jsforce=require(_0x1e21('0xc'));var deskjs=require(_0x1e21('0xd'));var toCsv=require(_0x1e21('0x7'));var querystring=require(_0x1e21('0xe'));var Papa=require(_0x1e21('0xf'));var Redis=require(_0x1e21('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1e21('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1e21('0x12'));var logger=require(_0x1e21('0x13'))('api');var utils=require(_0x1e21('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1e21('0x15'));var db=require(_0x1e21('0x16'))['db'];var integrations=require(_0x1e21('0x17'));function respondWithStatusCode(_0x306300,_0x3783c2){_0x3783c2=_0x3783c2||0xcc;return function(_0x41d337){if(_0x41d337){return _0x306300[_0x1e21('0x18')](_0x3783c2);}return _0x306300[_0x1e21('0x19')](_0x3783c2)[_0x1e21('0x1a')]();};}function respondWithResult(_0x23b7b0,_0x5111a8){_0x5111a8=_0x5111a8||0xc8;return function(_0x12e936){if(_0x12e936){return _0x23b7b0['status'](_0x5111a8)[_0x1e21('0x1b')](_0x12e936);}};}function respondWithFilteredResult(_0x32773f,_0x30c686){return function(_0x195abd){if(_0x195abd){var _0x4fb57e=typeof _0x30c686[_0x1e21('0x1c')]===_0x1e21('0x1d')&&typeof _0x30c686[_0x1e21('0x1e')]==='undefined';var _0x4e296b=_0x195abd['count'];var _0x28dc2e=_0x4fb57e?0x0:_0x30c686[_0x1e21('0x1c')];var _0x547eaf=_0x4fb57e?_0x195abd['count']:_0x30c686[_0x1e21('0x1c')]+_0x30c686['limit'];var _0x4f206a;if(_0x547eaf>=_0x4e296b){_0x547eaf=_0x4e296b;_0x4f206a=0xc8;}else{_0x4f206a=0xce;}_0x32773f[_0x1e21('0x19')](_0x4f206a);return _0x32773f['set'](_0x1e21('0x1f'),_0x28dc2e+'-'+_0x547eaf+'/'+_0x4e296b)[_0x1e21('0x1b')](_0x195abd);}return null;};}function patchUpdates(_0x370a17){return function(_0x10abd4){try{jsonpatch[_0x1e21('0x20')](_0x10abd4,_0x370a17,!![]);}catch(_0x955f12){return BPromise[_0x1e21('0x21')](_0x955f12);}return _0x10abd4['save']();};}function saveUpdates(_0x1c5701,_0x316c40){return function(_0x4ec0f2){if(_0x4ec0f2){return _0x4ec0f2[_0x1e21('0x22')](_0x1c5701)[_0x1e21('0x23')](function(_0x2a58f0){return _0x2a58f0;});}return null;};}function removeEntity(_0x114b8e,_0x4817e0){return function(_0x4c477a){if(_0x4c477a){return _0x4c477a[_0x1e21('0x24')]()[_0x1e21('0x23')](function(){_0x114b8e[_0x1e21('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57dd71,_0x3f6a4d){return function(_0x4572a0){if(!_0x4572a0){_0x57dd71[_0x1e21('0x18')](0x194);}return _0x4572a0;};}function handleError(_0x460a7c,_0x6a6cfe){_0x6a6cfe=_0x6a6cfe||0x1f4;return function(_0x387eb2){logger[_0x1e21('0x25')](_0x387eb2[_0x1e21('0x26')]);if(_0x387eb2[_0x1e21('0x27')]){delete _0x387eb2[_0x1e21('0x27')];}_0x460a7c[_0x1e21('0x19')](_0x6a6cfe)['send'](_0x387eb2);};}exports[_0x1e21('0x28')]=function(_0x277deb,_0x3b42bc){var _0xf34a60={},_0x469714={},_0x34db1c={'count':0x0,'rows':[]};var _0x29d650=_[_0x1e21('0x29')](db[_0x1e21('0x2a')]['rawAttributes'],function(_0x3587d5){return{'name':_0x3587d5[_0x1e21('0x2b')],'type':_0x3587d5['type'][_0x1e21('0x2c')]};});_0x469714[_0x1e21('0x2d')]=_['map'](_0x29d650,_0x1e21('0x27'));_0x469714['query']=_[_0x1e21('0x2e')](_0x277deb[_0x1e21('0x2f')]);_0x469714[_0x1e21('0x30')]=_['intersection'](_0x469714[_0x1e21('0x2d')],_0x469714[_0x1e21('0x2f')]);_0xf34a60['attributes']=_[_0x1e21('0x31')](_0x469714[_0x1e21('0x2d')],qs[_0x1e21('0x32')](_0x277deb[_0x1e21('0x2f')]['fields']));_0xf34a60[_0x1e21('0x33')]=_0xf34a60[_0x1e21('0x33')][_0x1e21('0x34')]?_0xf34a60[_0x1e21('0x33')]:_0x469714[_0x1e21('0x2d')];if(!_0x277deb[_0x1e21('0x2f')]['hasOwnProperty']('nolimit')){_0xf34a60[_0x1e21('0x1e')]=qs[_0x1e21('0x1e')](_0x277deb[_0x1e21('0x2f')]['limit']);_0xf34a60[_0x1e21('0x1c')]=qs['offset'](_0x277deb['query'][_0x1e21('0x1c')]);}_0xf34a60[_0x1e21('0x35')]=qs[_0x1e21('0x36')](_0x277deb['query']['sort']);_0xf34a60[_0x1e21('0x37')]=qs[_0x1e21('0x30')](_[_0x1e21('0x38')](_0x277deb[_0x1e21('0x2f')],_0x469714[_0x1e21('0x30')]),_0x29d650);if(_0x277deb[_0x1e21('0x2f')]['filter']){_0xf34a60[_0x1e21('0x37')]=_[_0x1e21('0x39')](_0xf34a60[_0x1e21('0x37')],{'$or':_[_0x1e21('0x29')](_0x29d650,function(_0x1cae90){if(_0x1cae90['type']!==_0x1e21('0x3a')){var _0x2d73a6={};_0x2d73a6[_0x1cae90[_0x1e21('0x27')]]={'$like':'%'+_0x277deb[_0x1e21('0x2f')][_0x1e21('0x3b')]+'%'};return _0x2d73a6;}})});}_0xf34a60=_['merge']({},_0xf34a60,_0x277deb['options']);var _0x53201e={'where':_0xf34a60[_0x1e21('0x37')]};return db[_0x1e21('0x2a')][_0x1e21('0x3c')](_0x53201e)['then'](function(_0x327f5d){_0x34db1c[_0x1e21('0x3c')]=_0x327f5d;if(_0x277deb['query']['includeAll']){_0xf34a60['include']=[{'all':!![]}];}return db[_0x1e21('0x2a')][_0x1e21('0x3d')](_0xf34a60);})[_0x1e21('0x23')](function(_0x30cef3){_0x34db1c['rows']=_0x30cef3;return _0x34db1c;})[_0x1e21('0x23')](respondWithFilteredResult(_0x3b42bc,_0xf34a60))[_0x1e21('0x3e')](handleError(_0x3b42bc,null));};exports[_0x1e21('0x3f')]=function(_0x5443c6,_0x565fa4){var _0x5b1c9d={'raw':![],'where':{'id':_0x5443c6[_0x1e21('0x40')]['id']}},_0x136129={};_0x136129['model']=_[_0x1e21('0x2e')](db[_0x1e21('0x2a')][_0x1e21('0x41')]);_0x136129[_0x1e21('0x2f')]=_[_0x1e21('0x2e')](_0x5443c6[_0x1e21('0x2f')]);_0x136129[_0x1e21('0x30')]=_[_0x1e21('0x31')](_0x136129[_0x1e21('0x2d')],_0x136129['query']);_0x5b1c9d[_0x1e21('0x33')]=_[_0x1e21('0x31')](_0x136129[_0x1e21('0x2d')],qs[_0x1e21('0x32')](_0x5443c6['query'][_0x1e21('0x32')]));_0x5b1c9d[_0x1e21('0x33')]=_0x5b1c9d['attributes'][_0x1e21('0x34')]?_0x5b1c9d[_0x1e21('0x33')]:_0x136129['model'];if(_0x5443c6['query'][_0x1e21('0x42')]){_0x5b1c9d[_0x1e21('0x43')]=[{'all':!![]}];}_0x5b1c9d=_[_0x1e21('0x39')]({},_0x5b1c9d,_0x5443c6['options']);return db[_0x1e21('0x2a')][_0x1e21('0x44')](_0x5b1c9d)['then'](handleEntityNotFound(_0x565fa4,null))[_0x1e21('0x23')](respondWithResult(_0x565fa4,null))['catch'](handleError(_0x565fa4,null));};exports['create']=function(_0x309a78,_0x37a1b3){return db['FreshdeskAccount'][_0x1e21('0x45')](_0x309a78[_0x1e21('0x46')],{})['then'](respondWithResult(_0x37a1b3,0xc9))[_0x1e21('0x3e')](handleError(_0x37a1b3,null));};exports['update']=function(_0x45b186,_0x5be588){if(_0x45b186[_0x1e21('0x46')]['id']){delete _0x45b186[_0x1e21('0x46')]['id'];}return db[_0x1e21('0x2a')][_0x1e21('0x44')]({'where':{'id':_0x45b186[_0x1e21('0x40')]['id']}})[_0x1e21('0x23')](handleEntityNotFound(_0x5be588,null))['then'](saveUpdates(_0x45b186[_0x1e21('0x46')],null))['then'](respondWithResult(_0x5be588,null))[_0x1e21('0x3e')](handleError(_0x5be588,null));};exports[_0x1e21('0x24')]=function(_0x2656fb,_0x1da050){return db[_0x1e21('0x2a')][_0x1e21('0x44')]({'where':{'id':_0x2656fb[_0x1e21('0x40')]['id']}})[_0x1e21('0x23')](handleEntityNotFound(_0x1da050,null))['then'](removeEntity(_0x1da050,null))[_0x1e21('0x3e')](handleError(_0x1da050,null));};exports['getConfigurations']=function(_0x136c9d,_0x4bf606,_0x17a809){var _0x161a65={};var _0x1dff36={};var _0x2e67a5;var _0x2cf9d0;return db['FreshdeskAccount'][_0x1e21('0x47')]({'where':{'id':_0x136c9d[_0x1e21('0x40')]['id']}})['then'](handleEntityNotFound(_0x4bf606,null))['then'](function(_0x424e6b){if(_0x424e6b){_0x2e67a5=_0x424e6b;_0x1dff36[_0x1e21('0x2d')]=_[_0x1e21('0x2e')](db['FreshdeskConfiguration']['rawAttributes']);_0x1dff36['query']=_[_0x1e21('0x2e')](_0x136c9d['query']);_0x1dff36[_0x1e21('0x30')]=_[_0x1e21('0x31')](_0x1dff36[_0x1e21('0x2d')],_0x1dff36[_0x1e21('0x2f')]);_0x161a65['attributes']=_[_0x1e21('0x31')](_0x1dff36[_0x1e21('0x2d')],qs[_0x1e21('0x32')](_0x136c9d['query']['fields']));_0x161a65[_0x1e21('0x33')]=_0x161a65[_0x1e21('0x33')][_0x1e21('0x34')]?_0x161a65[_0x1e21('0x33')]:_0x1dff36[_0x1e21('0x2d')];_0x161a65[_0x1e21('0x35')]=qs['sort'](_0x136c9d[_0x1e21('0x2f')][_0x1e21('0x36')]);_0x161a65[_0x1e21('0x37')]=qs[_0x1e21('0x30')](_[_0x1e21('0x38')](_0x136c9d[_0x1e21('0x2f')],_0x1dff36[_0x1e21('0x30')]));if(_0x136c9d[_0x1e21('0x2f')][_0x1e21('0x3b')]){_0x161a65['where']=_['merge'](_0x161a65[_0x1e21('0x37')],{'$or':_[_0x1e21('0x29')](_0x161a65[_0x1e21('0x33')],function(_0x2fba90){var _0x4e9878={};_0x4e9878[_0x2fba90]={'$like':'%'+_0x136c9d[_0x1e21('0x2f')]['filter']+'%'};return _0x4e9878;})});}_0x161a65=_[_0x1e21('0x39')]({},_0x161a65,_0x136c9d[_0x1e21('0x48')]);return _0x2e67a5['getConfigurations'](_0x161a65);}})[_0x1e21('0x23')](function(_0x5b9faa){if(_0x5b9faa){_0x2cf9d0=_0x5b9faa[_0x1e21('0x34')];if(!_0x136c9d[_0x1e21('0x2f')][_0x1e21('0x49')]('nolimit')){_0x161a65[_0x1e21('0x1e')]=qs[_0x1e21('0x1e')](_0x136c9d['query'][_0x1e21('0x1e')]);_0x161a65[_0x1e21('0x1c')]=qs[_0x1e21('0x1c')](_0x136c9d['query'][_0x1e21('0x1c')]);}return _0x2e67a5[_0x1e21('0x4a')](_0x161a65);}})[_0x1e21('0x23')](function(_0x9d0a14){if(_0x9d0a14){return _0x9d0a14?{'count':_0x2cf9d0,'rows':_0x9d0a14}:null;}})[_0x1e21('0x23')](respondWithResult(_0x4bf606,null))['catch'](handleError(_0x4bf606,null));};exports[_0x1e21('0x4b')]=function(_0x3f030a,_0x31fb0b,_0x77c1a3){if(_0x3f030a[_0x1e21('0x46')]['id']){delete _0x3f030a[_0x1e21('0x46')]['id'];}return db[_0x1e21('0x2a')][_0x1e21('0x47')]({'where':{'id':_0x3f030a[_0x1e21('0x40')]['id']}})['then'](handleEntityNotFound(_0x31fb0b,null))['then'](function(_0xf34355){if(_0xf34355){_0x3f030a[_0x1e21('0x46')][_0x1e21('0x4c')]=_0xf34355['id'];_0x3f030a['body'][_0x1e21('0x4d')]=integrations[_0x1e21('0x4e')](_0x3f030a['body']['channel'],_0x3f030a[_0x1e21('0x46')][_0x1e21('0x4f')]);_0x3f030a[_0x1e21('0x46')][_0x1e21('0x50')]=integrations[_0x1e21('0x51')](_0x3f030a[_0x1e21('0x46')][_0x1e21('0x52')],_0x3f030a['body'][_0x1e21('0x4f')]);return db[_0x1e21('0x53')][_0x1e21('0x45')](_0x3f030a[_0x1e21('0x46')],{'include':[{'model':db[_0x1e21('0x54')],'as':_0x1e21('0x4d')},{'model':db['FreshdeskField'],'as':_0x1e21('0x50')}]});}return null;})[_0x1e21('0x23')](respondWithResult(_0x31fb0b,null))[_0x1e21('0x3e')](handleError(_0x31fb0b,null));};exports[_0x1e21('0x55')]=function(_0x390c70,_0x34fcac,_0x5d8873){var _0xe87d78='';return db[_0x1e21('0x2a')]['findOne']({'where':{'id':_0x390c70[_0x1e21('0x40')]['id']},'attributes':['id',_0x1e21('0x56'),_0x1e21('0x57')]})[_0x1e21('0x23')](handleEntityNotFound(_0x34fcac,null))[_0x1e21('0x23')](function(_0x36e541){if(_0x36e541){_0xe87d78=_0x36e541[_0x1e21('0x56')];var _0x520a3f=_0xe87d78[_0x1e21('0x58')](-0x1);if(_0x520a3f==='/'){_0xe87d78=_0xe87d78['substring'](0x0,_0xe87d78[_0x1e21('0x59')](_0x520a3f));}return rp({'method':_0x1e21('0x5a'),'uri':util[_0x1e21('0x5b')](_0x1e21('0x5c'),_0xe87d78,_0x1e21('0x5d')),'headers':{'Authorization':util[_0x1e21('0x5b')](_0x1e21('0x5e'),new Buffer(util['format']('%s:X',_0x36e541['apiKey']))['toString']('base64'))},'json':!![]});}})[_0x1e21('0x23')](function(_0x3257a2){if(_0x3257a2){var _0x7554cf=['requester','subject',_0x1e21('0x5f'),_0x1e21('0x60'),_0x1e21('0x19'),_0x1e21('0x61'),_0x1e21('0x62'),_0x1e21('0x63'),_0x1e21('0x64'),_0x1e21('0x62'),_0x1e21('0x65')];_[_0x1e21('0x66')](_0x3257a2,function(_0x4ace09){return _0x7554cf[_0x1e21('0x67')](_0x4ace09[_0x1e21('0x27')])||!_0x4ace09['default']&&_0x4ace09[_0x1e21('0x4f')]!==_0x1e21('0x68')&&_0x4ace09[_0x1e21('0x4f')]!=='custom_dropdown';});return{'count':_0x3257a2[_0x1e21('0x34')],'rows':_[_0x1e21('0x29')](_0x3257a2,function(_0x5739c8){return{'id':_0x5739c8[_0x1e21('0x27')],'name':_0x5739c8[_0x1e21('0x69')],'custom':!_0x5739c8[_0x1e21('0x6a')],'options':_0x5739c8[_0x1e21('0x6b')]?_['map'](_0x5739c8[_0x1e21('0x6b')],function(_0x31af26){return{'name':_[_0x1e21('0x6c')](_0x31af26),'value':_0x31af26};}):[]};})};}})[_0x1e21('0x23')](respondWithResult(_0x34fcac,null))[_0x1e21('0x3e')](function(_0x2ad682){var _0x184141=_0x390c70[_0x1e21('0x2f')][_0x1e21('0x6d')]?0x1f4:_0x2ad682['statusCode']||0x1f4;logger[_0x1e21('0x25')](_0x1e21('0x6e'),_0x1e21('0x55'),_0x184141,JSON[_0x1e21('0x6f')](_0x2ad682));delete _0x2ad682[_0x1e21('0x27')];if(_0x184141===0x191){_0x184141=0x190;}_0x34fcac[_0x1e21('0x19')](_0x184141)[_0x1e21('0x70')](_0x390c70[_0x1e21('0x2f')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x2ad682[_0x1e21('0x71')]}:_0x2ad682);});}; \ No newline at end of file +var _0x7980=['include','findAll','rows','catch','show','params','find','create','body','findOne','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskConfiguration','Descriptions','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','Basic\x20%s','%s:X','toString','base64','requester','agent','description','priority','group','source','ticket_type','remove','includes','custom_text','custom_dropdown','default','choices','capitalize','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','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','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskAccount','includeAll'];(function(_0x2481f9,_0x2bd8dd){var _0x2f1da3=function(_0x3eaff9){while(--_0x3eaff9){_0x2481f9['push'](_0x2481f9['shift']());}};_0x2f1da3(++_0x2bd8dd);}(_0x7980,0xab));var _0x0798=function(_0x3a0840,_0x54c20c){_0x3a0840=_0x3a0840-0x0;var _0x407e44=_0x7980[_0x3a0840];return _0x407e44;};'use strict';var emlformat=require(_0x0798('0x0'));var rimraf=require(_0x0798('0x1'));var zipdir=require(_0x0798('0x2'));var jsonpatch=require(_0x0798('0x3'));var rp=require(_0x0798('0x4'));var moment=require('moment');var BPromise=require(_0x0798('0x5'));var Mustache=require(_0x0798('0x6'));var util=require(_0x0798('0x7'));var path=require(_0x0798('0x8'));var sox=require(_0x0798('0x9'));var csv=require('to-csv');var ejs=require(_0x0798('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0798('0xb'));var squel=require(_0x0798('0xc'));var crypto=require(_0x0798('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0798('0xe'));var querystring=require(_0x0798('0xf'));var Papa=require(_0x0798('0x10'));var Redis=require(_0x0798('0x11'));var authService=require(_0x0798('0x12'));var qs=require(_0x0798('0x13'));var as=require(_0x0798('0x14'));var hardwareService=require(_0x0798('0x15'));var logger=require(_0x0798('0x16'))(_0x0798('0x17'));var utils=require('../../config/utils');var config=require(_0x0798('0x18'));var licenseUtil=require(_0x0798('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x588f9d,_0x376a60){_0x376a60=_0x376a60||0xcc;return function(_0x27a0d5){if(_0x27a0d5){return _0x588f9d[_0x0798('0x1a')](_0x376a60);}return _0x588f9d[_0x0798('0x1b')](_0x376a60)[_0x0798('0x1c')]();};}function respondWithResult(_0xfd88af,_0x5f1640){_0x5f1640=_0x5f1640||0xc8;return function(_0x486bcf){if(_0x486bcf){return _0xfd88af[_0x0798('0x1b')](_0x5f1640)[_0x0798('0x1d')](_0x486bcf);}};}function respondWithFilteredResult(_0x47be56,_0x555c45){return function(_0x21c30b){if(_0x21c30b){var _0x45cae6=typeof _0x555c45[_0x0798('0x1e')]==='undefined'&&typeof _0x555c45['limit']===_0x0798('0x1f');var _0x502635=_0x21c30b[_0x0798('0x20')];var _0x46e74c=_0x45cae6?0x0:_0x555c45[_0x0798('0x1e')];var _0x145197=_0x45cae6?_0x21c30b['count']:_0x555c45[_0x0798('0x1e')]+_0x555c45[_0x0798('0x21')];var _0x4f3f01;if(_0x145197>=_0x502635){_0x145197=_0x502635;_0x4f3f01=0xc8;}else{_0x4f3f01=0xce;}_0x47be56[_0x0798('0x1b')](_0x4f3f01);return _0x47be56[_0x0798('0x22')](_0x0798('0x23'),_0x46e74c+'-'+_0x145197+'/'+_0x502635)[_0x0798('0x1d')](_0x21c30b);}return null;};}function patchUpdates(_0xfbb4a5){return function(_0x273ba8){try{jsonpatch[_0x0798('0x24')](_0x273ba8,_0xfbb4a5,!![]);}catch(_0x212ad5){return BPromise[_0x0798('0x25')](_0x212ad5);}return _0x273ba8['save']();};}function saveUpdates(_0x2aaabf,_0x35c141){return function(_0x3bca45){if(_0x3bca45){return _0x3bca45[_0x0798('0x26')](_0x2aaabf)[_0x0798('0x27')](function(_0x23f283){return _0x23f283;});}return null;};}function removeEntity(_0x52037c,_0x3f66e2){return function(_0x3e80d7){if(_0x3e80d7){return _0x3e80d7[_0x0798('0x28')]()[_0x0798('0x27')](function(){_0x52037c[_0x0798('0x1b')](0xcc)[_0x0798('0x1c')]();});}};}function handleEntityNotFound(_0x4f648a,_0x43d99f){return function(_0x14f828){if(!_0x14f828){_0x4f648a[_0x0798('0x1a')](0x194);}return _0x14f828;};}function handleError(_0x4d4e0a,_0x4bc3f3){_0x4bc3f3=_0x4bc3f3||0x1f4;return function(_0x5e7246){logger['error'](_0x5e7246[_0x0798('0x29')]);if(_0x5e7246[_0x0798('0x2a')]){delete _0x5e7246[_0x0798('0x2a')];}_0x4d4e0a[_0x0798('0x1b')](_0x4bc3f3)[_0x0798('0x2b')](_0x5e7246);};}exports[_0x0798('0x2c')]=function(_0x30bec,_0x23e770){var _0x5bbe3d={},_0x167960={},_0x4f5d1d={'count':0x0,'rows':[]};var _0x5f1780=_[_0x0798('0x2d')](db['FreshdeskAccount'][_0x0798('0x2e')],function(_0x4a5fb1){return{'name':_0x4a5fb1[_0x0798('0x2f')],'type':_0x4a5fb1[_0x0798('0x30')][_0x0798('0x31')]};});_0x167960[_0x0798('0x32')]=_[_0x0798('0x2d')](_0x5f1780,_0x0798('0x2a'));_0x167960[_0x0798('0x33')]=_[_0x0798('0x34')](_0x30bec[_0x0798('0x33')]);_0x167960[_0x0798('0x35')]=_[_0x0798('0x36')](_0x167960[_0x0798('0x32')],_0x167960['query']);_0x5bbe3d[_0x0798('0x37')]=_['intersection'](_0x167960['model'],qs[_0x0798('0x38')](_0x30bec[_0x0798('0x33')]['fields']));_0x5bbe3d['attributes']=_0x5bbe3d[_0x0798('0x37')][_0x0798('0x39')]?_0x5bbe3d[_0x0798('0x37')]:_0x167960[_0x0798('0x32')];if(!_0x30bec[_0x0798('0x33')][_0x0798('0x3a')]('nolimit')){_0x5bbe3d['limit']=qs[_0x0798('0x21')](_0x30bec[_0x0798('0x33')][_0x0798('0x21')]);_0x5bbe3d['offset']=qs['offset'](_0x30bec['query'][_0x0798('0x1e')]);}_0x5bbe3d[_0x0798('0x3b')]=qs[_0x0798('0x3c')](_0x30bec[_0x0798('0x33')][_0x0798('0x3c')]);_0x5bbe3d[_0x0798('0x3d')]=qs[_0x0798('0x35')](_[_0x0798('0x3e')](_0x30bec['query'],_0x167960[_0x0798('0x35')]),_0x5f1780);if(_0x30bec['query'][_0x0798('0x3f')]){_0x5bbe3d[_0x0798('0x3d')]=_[_0x0798('0x40')](_0x5bbe3d['where'],{'$or':_[_0x0798('0x2d')](_0x5f1780,function(_0x591862){if(_0x591862[_0x0798('0x30')]!==_0x0798('0x41')){var _0x223751={};_0x223751[_0x591862['name']]={'$like':'%'+_0x30bec[_0x0798('0x33')][_0x0798('0x3f')]+'%'};return _0x223751;}})});}_0x5bbe3d=_['merge']({},_0x5bbe3d,_0x30bec[_0x0798('0x42')]);var _0x5cb953={'where':_0x5bbe3d['where']};return db[_0x0798('0x43')][_0x0798('0x20')](_0x5cb953)['then'](function(_0x4ddbca){_0x4f5d1d[_0x0798('0x20')]=_0x4ddbca;if(_0x30bec[_0x0798('0x33')][_0x0798('0x44')]){_0x5bbe3d[_0x0798('0x45')]=[{'all':!![]}];}return db[_0x0798('0x43')][_0x0798('0x46')](_0x5bbe3d);})[_0x0798('0x27')](function(_0x521829){_0x4f5d1d[_0x0798('0x47')]=_0x521829;return _0x4f5d1d;})[_0x0798('0x27')](respondWithFilteredResult(_0x23e770,_0x5bbe3d))[_0x0798('0x48')](handleError(_0x23e770,null));};exports[_0x0798('0x49')]=function(_0x3a8a14,_0x26e9cb){var _0x4c2d8a={'raw':![],'where':{'id':_0x3a8a14[_0x0798('0x4a')]['id']}},_0x192e15={};_0x192e15[_0x0798('0x32')]=_[_0x0798('0x34')](db[_0x0798('0x43')][_0x0798('0x2e')]);_0x192e15[_0x0798('0x33')]=_[_0x0798('0x34')](_0x3a8a14[_0x0798('0x33')]);_0x192e15[_0x0798('0x35')]=_[_0x0798('0x36')](_0x192e15[_0x0798('0x32')],_0x192e15['query']);_0x4c2d8a[_0x0798('0x37')]=_[_0x0798('0x36')](_0x192e15[_0x0798('0x32')],qs[_0x0798('0x38')](_0x3a8a14['query']['fields']));_0x4c2d8a[_0x0798('0x37')]=_0x4c2d8a[_0x0798('0x37')][_0x0798('0x39')]?_0x4c2d8a[_0x0798('0x37')]:_0x192e15['model'];if(_0x3a8a14[_0x0798('0x33')]['includeAll']){_0x4c2d8a['include']=[{'all':!![]}];}_0x4c2d8a=_[_0x0798('0x40')]({},_0x4c2d8a,_0x3a8a14[_0x0798('0x42')]);return db[_0x0798('0x43')][_0x0798('0x4b')](_0x4c2d8a)[_0x0798('0x27')](handleEntityNotFound(_0x26e9cb,null))[_0x0798('0x27')](respondWithResult(_0x26e9cb,null))[_0x0798('0x48')](handleError(_0x26e9cb,null));};exports[_0x0798('0x4c')]=function(_0x182e3b,_0x580bcd){return db[_0x0798('0x43')]['create'](_0x182e3b[_0x0798('0x4d')],{})[_0x0798('0x27')](respondWithResult(_0x580bcd,0xc9))[_0x0798('0x48')](handleError(_0x580bcd,null));};exports['update']=function(_0x9dea1f,_0x275e6e){if(_0x9dea1f[_0x0798('0x4d')]['id']){delete _0x9dea1f[_0x0798('0x4d')]['id'];}return db['FreshdeskAccount'][_0x0798('0x4b')]({'where':{'id':_0x9dea1f[_0x0798('0x4a')]['id']}})[_0x0798('0x27')](handleEntityNotFound(_0x275e6e,null))[_0x0798('0x27')](saveUpdates(_0x9dea1f[_0x0798('0x4d')],null))['then'](respondWithResult(_0x275e6e,null))[_0x0798('0x48')](handleError(_0x275e6e,null));};exports[_0x0798('0x28')]=function(_0x2679b1,_0x10173d){return db[_0x0798('0x43')][_0x0798('0x4b')]({'where':{'id':_0x2679b1[_0x0798('0x4a')]['id']}})[_0x0798('0x27')](handleEntityNotFound(_0x10173d,null))[_0x0798('0x27')](removeEntity(_0x10173d,null))['catch'](handleError(_0x10173d,null));};exports['getConfigurations']=function(_0x450fb2,_0x499073,_0x375f11){var _0x17967e={};var _0x40b3d6={};var _0x2cc9a5;var _0x3fa571;return db['FreshdeskAccount'][_0x0798('0x4e')]({'where':{'id':_0x450fb2['params']['id']}})[_0x0798('0x27')](handleEntityNotFound(_0x499073,null))[_0x0798('0x27')](function(_0x3a3cc7){if(_0x3a3cc7){_0x2cc9a5=_0x3a3cc7;_0x40b3d6['model']=_['keys'](db['FreshdeskConfiguration'][_0x0798('0x2e')]);_0x40b3d6['query']=_['keys'](_0x450fb2[_0x0798('0x33')]);_0x40b3d6[_0x0798('0x35')]=_[_0x0798('0x36')](_0x40b3d6['model'],_0x40b3d6[_0x0798('0x33')]);_0x17967e[_0x0798('0x37')]=_[_0x0798('0x36')](_0x40b3d6[_0x0798('0x32')],qs['fields'](_0x450fb2['query'][_0x0798('0x38')]));_0x17967e[_0x0798('0x37')]=_0x17967e[_0x0798('0x37')]['length']?_0x17967e['attributes']:_0x40b3d6[_0x0798('0x32')];_0x17967e[_0x0798('0x3b')]=qs[_0x0798('0x3c')](_0x450fb2[_0x0798('0x33')][_0x0798('0x3c')]);_0x17967e[_0x0798('0x3d')]=qs[_0x0798('0x35')](_[_0x0798('0x3e')](_0x450fb2['query'],_0x40b3d6[_0x0798('0x35')]));if(_0x450fb2[_0x0798('0x33')]['filter']){_0x17967e[_0x0798('0x3d')]=_[_0x0798('0x40')](_0x17967e['where'],{'$or':_[_0x0798('0x2d')](_0x17967e[_0x0798('0x37')],function(_0x445872){var _0x257c8d={};_0x257c8d[_0x445872]={'$like':'%'+_0x450fb2[_0x0798('0x33')]['filter']+'%'};return _0x257c8d;})});}_0x17967e=_[_0x0798('0x40')]({},_0x17967e,_0x450fb2[_0x0798('0x42')]);return _0x2cc9a5[_0x0798('0x4f')](_0x17967e);}})['then'](function(_0x1135d5){if(_0x1135d5){_0x3fa571=_0x1135d5['length'];if(!_0x450fb2[_0x0798('0x33')][_0x0798('0x3a')](_0x0798('0x50'))){_0x17967e[_0x0798('0x21')]=qs[_0x0798('0x21')](_0x450fb2[_0x0798('0x33')]['limit']);_0x17967e[_0x0798('0x1e')]=qs[_0x0798('0x1e')](_0x450fb2[_0x0798('0x33')][_0x0798('0x1e')]);}return _0x2cc9a5['getConfigurations'](_0x17967e);}})[_0x0798('0x27')](function(_0x105f88){if(_0x105f88){return _0x105f88?{'count':_0x3fa571,'rows':_0x105f88}:null;}})[_0x0798('0x27')](respondWithResult(_0x499073,null))[_0x0798('0x48')](handleError(_0x499073,null));};exports[_0x0798('0x51')]=function(_0x523a2b,_0x3ad6d9,_0x3d933a){if(_0x523a2b['body']['id']){delete _0x523a2b[_0x0798('0x4d')]['id'];}return db[_0x0798('0x43')][_0x0798('0x4e')]({'where':{'id':_0x523a2b['params']['id']}})[_0x0798('0x27')](handleEntityNotFound(_0x3ad6d9,null))[_0x0798('0x27')](function(_0x3c218b){if(_0x3c218b){_0x523a2b[_0x0798('0x4d')][_0x0798('0x52')]=_0x3c218b['id'];_0x523a2b[_0x0798('0x4d')][_0x0798('0x53')]=integrations[_0x0798('0x54')](_0x523a2b['body'][_0x0798('0x55')],_0x523a2b[_0x0798('0x4d')][_0x0798('0x30')]);_0x523a2b[_0x0798('0x4d')]['Descriptions']=integrations[_0x0798('0x56')](_0x523a2b[_0x0798('0x4d')][_0x0798('0x55')],_0x523a2b[_0x0798('0x4d')][_0x0798('0x30')]);return db[_0x0798('0x57')][_0x0798('0x4c')](_0x523a2b[_0x0798('0x4d')],{'include':[{'model':db['FreshdeskField'],'as':_0x0798('0x53')},{'model':db['FreshdeskField'],'as':_0x0798('0x58')}]});}return null;})[_0x0798('0x27')](respondWithResult(_0x3ad6d9,null))[_0x0798('0x48')](handleError(_0x3ad6d9,null));};exports['getFields']=function(_0x1fad8c,_0x15eb2b,_0x540703){var _0x11dcc6='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x1fad8c[_0x0798('0x4a')]['id']},'attributes':['id',_0x0798('0x59'),_0x0798('0x5a')]})[_0x0798('0x27')](handleEntityNotFound(_0x15eb2b,null))['then'](function(_0x3ebb8e){if(_0x3ebb8e){_0x11dcc6=_0x3ebb8e[_0x0798('0x59')];var _0x4750f8=_0x11dcc6[_0x0798('0x5b')](-0x1);if(_0x4750f8==='/'){_0x11dcc6=_0x11dcc6[_0x0798('0x5c')](0x0,_0x11dcc6[_0x0798('0x5d')](_0x4750f8));}return rp({'method':_0x0798('0x5e'),'uri':util['format']('%s/%s',_0x11dcc6,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x0798('0x5f')](_0x0798('0x60'),new Buffer(util[_0x0798('0x5f')](_0x0798('0x61'),_0x3ebb8e['apiKey']))[_0x0798('0x62')](_0x0798('0x63')))},'json':!![]});}})['then'](function(_0x12393b){if(_0x12393b){var _0x5c46aa=[_0x0798('0x64'),'subject',_0x0798('0x65'),_0x0798('0x66'),_0x0798('0x1b'),_0x0798('0x67'),_0x0798('0x68'),_0x0798('0x69'),_0x0798('0x6a'),_0x0798('0x68'),'company'];_[_0x0798('0x6b')](_0x12393b,function(_0x47e5bd){return _0x5c46aa[_0x0798('0x6c')](_0x47e5bd[_0x0798('0x2a')])||!_0x47e5bd['default']&&_0x47e5bd[_0x0798('0x30')]!==_0x0798('0x6d')&&_0x47e5bd['type']!==_0x0798('0x6e');});return{'count':_0x12393b['length'],'rows':_[_0x0798('0x2d')](_0x12393b,function(_0x447d3c){return{'id':_0x447d3c[_0x0798('0x2a')],'name':_0x447d3c['label'],'custom':!_0x447d3c[_0x0798('0x6f')],'options':_0x447d3c[_0x0798('0x70')]?_[_0x0798('0x2d')](_0x447d3c[_0x0798('0x70')],function(_0x530e1f){return{'name':_[_0x0798('0x71')](_0x530e1f),'value':_0x530e1f};}):[]};})};}})[_0x0798('0x27')](respondWithResult(_0x15eb2b,null))[_0x0798('0x48')](function(_0x1c9a79){var _0x389452=_0x1fad8c[_0x0798('0x33')]['test']?0x1f4:_0x1c9a79['statusCode']||0x1f4;logger[_0x0798('0x72')](_0x0798('0x73'),_0x0798('0x74'),_0x389452,JSON[_0x0798('0x75')](_0x1c9a79));delete _0x1c9a79[_0x0798('0x2a')];if(_0x389452===0x191){_0x389452=0x190;}_0x15eb2b[_0x0798('0x1b')](_0x389452)['send'](_0x1fad8c['query'][_0x0798('0x76')]?{'message':_0x0798('0x77'),'statusCode':_0x1c9a79['statusCode']}:_0x1c9a79);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 077c289..810465e 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 _0xde2d=['./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x50424f,_0x50aa88){var _0xd5e2de=function(_0x31dc63){while(--_0x31dc63){_0x50424f['push'](_0x50424f['shift']());}};_0xd5e2de(++_0x50aa88);}(_0xde2d,0x1c0));var _0xdde2=function(_0x38e730,_0x2e63b6){_0x38e730=_0x38e730-0x0;var _0x29b82e=_0xde2d[_0x38e730];return _0x29b82e;};'use strict';var _=require(_0xdde2('0x0'));var util=require('util');var logger=require(_0xdde2('0x1'))('api');var moment=require(_0xdde2('0x2'));var BPromise=require(_0xdde2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdde2('0x4'));var rimraf=require(_0xdde2('0x5'));var config=require(_0xdde2('0x6'));var attributes=require(_0xdde2('0x7'));var integrations=require(_0xdde2('0x8'));module[_0xdde2('0x9')]=function(_0x4b1140,_0x86ebe9){return _0x4b1140[_0xdde2('0xa')](_0xdde2('0xb'),attributes,{'tableName':_0xdde2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x017f=['path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','bluebird','request-promise'];(function(_0x368f42,_0x14ed6e){var _0x4b3cf6=function(_0x4a3320){while(--_0x4a3320){_0x368f42['push'](_0x368f42['shift']());}};_0x4b3cf6(++_0x14ed6e);}(_0x017f,0x1a8));var _0xf017=function(_0x14e220,_0x57056){_0x14e220=_0x14e220-0x0;var _0x746d60=_0x017f[_0x14e220];return _0x746d60;};'use strict';var _=require('lodash');var util=require(_0xf017('0x0'));var logger=require(_0xf017('0x1'))(_0xf017('0x2'));var moment=require('moment');var BPromise=require(_0xf017('0x3'));var rp=require(_0xf017('0x4'));var fs=require('fs');var path=require(_0xf017('0x5'));var rimraf=require(_0xf017('0x6'));var config=require(_0xf017('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xf017('0x8'));module[_0xf017('0x9')]=function(_0x46751e,_0x14ce4f){return _0x46751e[_0xf017('0xa')](_0xf017('0xb'),attributes,{'tableName':_0xf017('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 e239d9d..f07d8f0 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 _0x2121=['info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','limit','include','map','model','attributes','debug','catch','find','ShowFreshdeskAccount','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x2121,0x1b4));var _0x1212=function(_0x4c7d96,_0x4cc0d6){_0x4c7d96=_0x4c7d96-0x0;var _0x540511=_0x2121[_0x4c7d96];return _0x540511;};'use strict';var _=require(_0x1212('0x0'));var util=require(_0x1212('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1212('0x2'));var fs=require('fs');var Redis=require(_0x1212('0x3'));var db=require(_0x1212('0x4'))['db'];var utils=require(_0x1212('0x5'));var logger=require(_0x1212('0x6'))('rpc');var config=require(_0x1212('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1212('0x8')][_0x1212('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20fadc,_0x1b1ef5,_0x233a53){return new BPromise(function(_0x642ed5,_0x4a3d2a){return client[_0x1212('0xa')](_0x20fadc,_0x233a53)[_0x1212('0xb')](function(_0x434d23){logger[_0x1212('0xc')](_0x1212('0xd'),_0x1b1ef5,_0x1212('0xe'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x1b1ef5,_0x1212('0xe'),JSON[_0x1212('0xf')](_0x434d23));if(_0x434d23[_0x1212('0x10')]){if(_0x434d23[_0x1212('0x10')]['code']===0x1f4){logger[_0x1212('0x10')](_0x1212('0xd'),_0x1b1ef5,_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);return _0x4a3d2a(_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);}logger[_0x1212('0x10')](_0x1212('0xd'),_0x1b1ef5,_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);return _0x642ed5(_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);}else{logger[_0x1212('0xc')](_0x1212('0xd'),_0x1b1ef5,_0x1212('0xe'));_0x642ed5(_0x434d23['result']['message']);}})['catch'](function(_0x3cfe21){logger[_0x1212('0x10')](_0x1212('0xd'),_0x1b1ef5,_0x3cfe21);_0x4a3d2a(_0x3cfe21);});});}exports[_0x1212('0x12')]=function(_0x3cf284){var _0x3face0=this;return new Promise(function(_0xb0dc88,_0x22eefb){return db[_0x1212('0x13')]['findAll']({'raw':_0x3cf284[_0x1212('0x14')]?_0x3cf284[_0x1212('0x14')][_0x1212('0x15')]===undefined?!![]:![]:!![],'where':_0x3cf284[_0x1212('0x14')]?_0x3cf284[_0x1212('0x14')][_0x1212('0x16')]||null:null,'attributes':_0x3cf284[_0x1212('0x14')]?_0x3cf284[_0x1212('0x14')]['attributes']||null:null,'limit':_0x3cf284[_0x1212('0x14')]?_0x3cf284[_0x1212('0x14')][_0x1212('0x17')]||null:null,'include':_0x3cf284[_0x1212('0x14')]?_0x3cf284[_0x1212('0x14')][_0x1212('0x18')]?_[_0x1212('0x19')](_0x3cf284[_0x1212('0x14')]['include'],function(_0x58ab5b){return{'model':db[_0x58ab5b['model']],'as':_0x58ab5b['as'],'attributes':_0x58ab5b['attributes'],'include':_0x58ab5b['include']?_[_0x1212('0x19')](_0x58ab5b[_0x1212('0x18')],function(_0x4c32a7){return{'model':db[_0x4c32a7[_0x1212('0x1a')]],'as':_0x4c32a7['as'],'attributes':_0x4c32a7[_0x1212('0x1b')],'include':_0x4c32a7['include']?_[_0x1212('0x19')](_0x4c32a7[_0x1212('0x18')],function(_0x4630b4){return{'model':db[_0x4630b4[_0x1212('0x1a')]],'as':_0x4630b4['as'],'attributes':_0x4630b4[_0x1212('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1212('0xb')](function(_0x2750b0){logger[_0x1212('0xc')]('GetFreshdeskAccount',_0x3cf284);logger[_0x1212('0x1c')](_0x1212('0x12'),_0x3cf284,JSON[_0x1212('0xf')](_0x2750b0));_0xb0dc88(_0x2750b0);})[_0x1212('0x1d')](function(_0x17d0f6){logger[_0x1212('0x10')](_0x1212('0x12'),_0x17d0f6[_0x1212('0x11')],_0x3cf284);_0x22eefb(_0x3face0[_0x1212('0x10')](0x1f4,_0x17d0f6[_0x1212('0x11')]));});});};exports['ShowFreshdeskAccount']=function(_0x5a9b18){var _0x365232=this;return new Promise(function(_0x5769a9,_0x339d58){return db['FreshdeskAccount'][_0x1212('0x1e')]({'raw':_0x5a9b18['options']?_0x5a9b18[_0x1212('0x14')][_0x1212('0x15')]===undefined?!![]:![]:!![],'where':_0x5a9b18[_0x1212('0x14')]?_0x5a9b18[_0x1212('0x14')]['where']||null:null,'attributes':_0x5a9b18[_0x1212('0x14')]?_0x5a9b18[_0x1212('0x14')][_0x1212('0x1b')]||null:null,'include':_0x5a9b18[_0x1212('0x14')]?_0x5a9b18[_0x1212('0x14')]['include']?_[_0x1212('0x19')](_0x5a9b18[_0x1212('0x14')][_0x1212('0x18')],function(_0x48a9ad){return{'model':db[_0x48a9ad[_0x1212('0x1a')]],'as':_0x48a9ad['as'],'attributes':_0x48a9ad[_0x1212('0x1b')],'include':_0x48a9ad[_0x1212('0x18')]?_[_0x1212('0x19')](_0x48a9ad['include'],function(_0x39591f){return{'model':db[_0x39591f[_0x1212('0x1a')]],'as':_0x39591f['as'],'attributes':_0x39591f['attributes'],'include':_0x39591f[_0x1212('0x18')]?_[_0x1212('0x19')](_0x39591f[_0x1212('0x18')],function(_0x54deac){return{'model':db[_0x54deac[_0x1212('0x1a')]],'as':_0x54deac['as'],'attributes':_0x54deac[_0x1212('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1212('0xb')](function(_0x5606fd){logger[_0x1212('0xc')]('ShowFreshdeskAccount',_0x5a9b18);logger[_0x1212('0x1c')](_0x1212('0x1f'),_0x5a9b18,JSON['stringify'](_0x5606fd));_0x5769a9(_0x5606fd);})['catch'](function(_0x2447c6){logger['error'](_0x1212('0x1f'),_0x2447c6[_0x1212('0x11')],_0x5a9b18);_0x339d58(_0x365232[_0x1212('0x10')](0x1f4,_0x2447c6[_0x1212('0x11')]));});});}; \ No newline at end of file +var _0x79d6=['error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowFreshdeskAccount','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x79d6,0x166));var _0x679d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x79d6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x679d('0x0'));var moment=require(_0x679d('0x1'));var BPromise=require(_0x679d('0x2'));var rs=require(_0x679d('0x3'));var fs=require('fs');var Redis=require(_0x679d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x679d('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x679d('0x6'));var client=jayson[_0x679d('0x7')][_0x679d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36637e,_0x2ebef0,_0x2c9352){return new BPromise(function(_0x141cf4,_0x567b7c){return client['request'](_0x36637e,_0x2c9352)[_0x679d('0x9')](function(_0x263fd9){logger[_0x679d('0xa')](_0x679d('0xb'),_0x2ebef0,_0x679d('0xc'));logger[_0x679d('0xd')](_0x679d('0xe'),_0x2ebef0,_0x679d('0xc'),JSON[_0x679d('0xf')](_0x263fd9));if(_0x263fd9[_0x679d('0x10')]){if(_0x263fd9[_0x679d('0x10')][_0x679d('0x11')]===0x1f4){logger[_0x679d('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x2ebef0,_0x263fd9[_0x679d('0x10')][_0x679d('0x12')]);return _0x567b7c(_0x263fd9[_0x679d('0x10')][_0x679d('0x12')]);}logger[_0x679d('0x10')](_0x679d('0xb'),_0x2ebef0,_0x263fd9[_0x679d('0x10')][_0x679d('0x12')]);return _0x141cf4(_0x263fd9[_0x679d('0x10')][_0x679d('0x12')]);}else{logger[_0x679d('0xa')]('FreshdeskAccount,\x20%s,\x20%s',_0x2ebef0,_0x679d('0xc'));_0x141cf4(_0x263fd9[_0x679d('0x13')][_0x679d('0x12')]);}})['catch'](function(_0x57119d){logger[_0x679d('0x10')](_0x679d('0xb'),_0x2ebef0,_0x57119d);_0x567b7c(_0x57119d);});});}exports[_0x679d('0x14')]=function(_0x324183){var _0x31dfd5=this;return new Promise(function(_0x432722,_0x479c56){return db[_0x679d('0x15')][_0x679d('0x16')]({'raw':_0x324183[_0x679d('0x17')]?_0x324183['options'][_0x679d('0x18')]===undefined?!![]:![]:!![],'where':_0x324183[_0x679d('0x17')]?_0x324183[_0x679d('0x17')][_0x679d('0x19')]||null:null,'attributes':_0x324183['options']?_0x324183[_0x679d('0x17')][_0x679d('0x1a')]||null:null,'limit':_0x324183[_0x679d('0x17')]?_0x324183[_0x679d('0x17')][_0x679d('0x1b')]||null:null,'include':_0x324183[_0x679d('0x17')]?_0x324183[_0x679d('0x17')][_0x679d('0x1c')]?_[_0x679d('0x1d')](_0x324183[_0x679d('0x17')][_0x679d('0x1c')],function(_0x869962){return{'model':db[_0x869962[_0x679d('0x1e')]],'as':_0x869962['as'],'attributes':_0x869962[_0x679d('0x1a')],'include':_0x869962[_0x679d('0x1c')]?_['map'](_0x869962['include'],function(_0x59d3ae){return{'model':db[_0x59d3ae[_0x679d('0x1e')]],'as':_0x59d3ae['as'],'attributes':_0x59d3ae[_0x679d('0x1a')],'include':_0x59d3ae[_0x679d('0x1c')]?_[_0x679d('0x1d')](_0x59d3ae[_0x679d('0x1c')],function(_0x4e9a0d){return{'model':db[_0x4e9a0d[_0x679d('0x1e')]],'as':_0x4e9a0d['as'],'attributes':_0x4e9a0d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x83a0c8){logger[_0x679d('0xa')]('GetFreshdeskAccount',_0x324183);logger[_0x679d('0xd')](_0x679d('0x14'),_0x324183,JSON['stringify'](_0x83a0c8));_0x432722(_0x83a0c8);})[_0x679d('0x1f')](function(_0x34fab3){logger[_0x679d('0x10')](_0x679d('0x14'),_0x34fab3[_0x679d('0x12')],_0x324183);_0x479c56(_0x31dfd5[_0x679d('0x10')](0x1f4,_0x34fab3['message']));});});};exports[_0x679d('0x20')]=function(_0x2254bf){var _0x1ed7a2=this;return new Promise(function(_0xa373b7,_0x4e2a10){return db[_0x679d('0x15')][_0x679d('0x21')]({'raw':_0x2254bf['options']?_0x2254bf['options'][_0x679d('0x18')]===undefined?!![]:![]:!![],'where':_0x2254bf[_0x679d('0x17')]?_0x2254bf[_0x679d('0x17')][_0x679d('0x19')]||null:null,'attributes':_0x2254bf[_0x679d('0x17')]?_0x2254bf[_0x679d('0x17')][_0x679d('0x1a')]||null:null,'include':_0x2254bf[_0x679d('0x17')]?_0x2254bf[_0x679d('0x17')][_0x679d('0x1c')]?_[_0x679d('0x1d')](_0x2254bf[_0x679d('0x17')][_0x679d('0x1c')],function(_0x7b1d12){return{'model':db[_0x7b1d12[_0x679d('0x1e')]],'as':_0x7b1d12['as'],'attributes':_0x7b1d12[_0x679d('0x1a')],'include':_0x7b1d12[_0x679d('0x1c')]?_['map'](_0x7b1d12[_0x679d('0x1c')],function(_0x36e5c6){return{'model':db[_0x36e5c6[_0x679d('0x1e')]],'as':_0x36e5c6['as'],'attributes':_0x36e5c6[_0x679d('0x1a')],'include':_0x36e5c6[_0x679d('0x1c')]?_['map'](_0x36e5c6[_0x679d('0x1c')],function(_0x8471b6){return{'model':db[_0x8471b6['model']],'as':_0x8471b6['as'],'attributes':_0x8471b6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1751c2){logger[_0x679d('0xa')](_0x679d('0x20'),_0x2254bf);logger[_0x679d('0xd')](_0x679d('0x20'),_0x2254bf,JSON['stringify'](_0x1751c2));_0xa373b7(_0x1751c2);})['catch'](function(_0x147edc){logger[_0x679d('0x10')](_0x679d('0x20'),_0x147edc[_0x679d('0x12')],_0x2254bf);_0x4e2a10(_0x1ed7a2[_0x679d('0x10')](0x1f4,_0x147edc[_0x679d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 8b4970d..93202dc 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 _0x0005=['./intFreshdeskConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x28f69f,_0x401e5d){var _0x4881c8=function(_0x2e4b06){while(--_0x2e4b06){_0x28f69f['push'](_0x28f69f['shift']());}};_0x4881c8(++_0x401e5d);}(_0x0005,0x121));var _0x5000=function(_0x2762c1,_0x49590e){_0x2762c1=_0x2762c1-0x0;var _0x13e1ff=_0x0005[_0x2762c1];return _0x13e1ff;};'use strict';var multer=require('multer');var util=require(_0x5000('0x0'));var path=require(_0x5000('0x1'));var timeout=require(_0x5000('0x2'));var express=require(_0x5000('0x3'));var router=express['Router']();var fs_extra=require(_0x5000('0x4'));var auth=require(_0x5000('0x5'));var interaction=require(_0x5000('0x6'));var config=require(_0x5000('0x7'));var controller=require(_0x5000('0x8'));router[_0x5000('0x9')]('/',auth['isAuthenticated'](),controller[_0x5000('0xa')]);router['get'](_0x5000('0xb'),auth[_0x5000('0xc')](),controller['show']);router['get'](_0x5000('0xd'),auth[_0x5000('0xc')](),controller[_0x5000('0xe')]);router['get']('/:id/subjects',auth[_0x5000('0xc')](),controller[_0x5000('0xf')]);router['get'](_0x5000('0x10'),auth[_0x5000('0xc')](),controller[_0x5000('0x11')]);router[_0x5000('0x9')](_0x5000('0x12'),auth[_0x5000('0xc')](),controller['getTags']);router['post']('/',auth[_0x5000('0xc')](),controller[_0x5000('0x13')]);router[_0x5000('0x14')](_0x5000('0x12'),auth['isAuthenticated'](),controller[_0x5000('0x15')]);router[_0x5000('0x16')](_0x5000('0xb'),auth[_0x5000('0xc')](),controller[_0x5000('0x17')]);router[_0x5000('0x18')]('/:id',auth[_0x5000('0xc')](),controller[_0x5000('0x19')]);module[_0x5000('0x1a')]=router; \ No newline at end of file +var _0x25dc=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','setTags','put','delete','destroy','multer'];(function(_0x554a83,_0x4f0604){var _0x5c3d02=function(_0x51ba44){while(--_0x51ba44){_0x554a83['push'](_0x554a83['shift']());}};_0x5c3d02(++_0x4f0604);}(_0x25dc,0x125));var _0xc25d=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x25dc[_0xe73080];return _0x12cbc4;};'use strict';var multer=require(_0xc25d('0x0'));var util=require(_0xc25d('0x1'));var path=require(_0xc25d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc25d('0x3')]();var fs_extra=require(_0xc25d('0x4'));var auth=require(_0xc25d('0x5'));var interaction=require(_0xc25d('0x6'));var config=require(_0xc25d('0x7'));var controller=require('./intFreshdeskConfiguration.controller');router[_0xc25d('0x8')]('/',auth['isAuthenticated'](),controller[_0xc25d('0x9')]);router[_0xc25d('0x8')](_0xc25d('0xa'),auth[_0xc25d('0xb')](),controller['show']);router[_0xc25d('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc25d('0xc')]);router['get'](_0xc25d('0xd'),auth['isAuthenticated'](),controller[_0xc25d('0xe')]);router[_0xc25d('0x8')](_0xc25d('0xf'),auth[_0xc25d('0xb')](),controller['getDescriptions']);router[_0xc25d('0x8')]('/:id/tags',auth[_0xc25d('0xb')](),controller['getTags']);router[_0xc25d('0x10')]('/',auth[_0xc25d('0xb')](),controller['create']);router['post']('/:id/tags',auth[_0xc25d('0xb')](),controller[_0xc25d('0x11')]);router[_0xc25d('0x12')](_0xc25d('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xc25d('0x13')](_0xc25d('0xa'),auth[_0xc25d('0xb')](),controller[_0xc25d('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 068657b..cc96c7d 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 _0x8a43=['STRING','sequelize','exports'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_0x8a43,0x1e7));var _0x38a4=function(_0x3958db,_0x5a84d8){_0x3958db=_0x3958db-0x0;var _0x41d593=_0x8a43[_0x3958db];return _0x41d593;};'use strict';var Sequelize=require(_0x38a4('0x0'));module[_0x38a4('0x1')]={'name':{'type':Sequelize[_0x38a4('0x2')]},'description':{'type':Sequelize[_0x38a4('0x2')]}}; \ No newline at end of file +var _0x2df3=['STRING'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x2df3,0x171));var _0x32df=function(_0x319d75,_0x5b5e7f){_0x319d75=_0x319d75-0x0;var _0x5882bb=_0x2df3[_0x319d75];return _0x5882bb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x32df('0x0')]},'description':{'type':Sequelize[_0x32df('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index a6aac90..88244f9 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 _0x0c4f=['fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','keys','include','find','catch','create','body','getFields','FreshdeskField','getSubjects','findOne','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes'];(function(_0x38b90e,_0x496195){var _0x3caf41=function(_0x5cfd76){while(--_0x5cfd76){_0x38b90e['push'](_0x38b90e['shift']());}};_0x3caf41(++_0x496195);}(_0x0c4f,0x7c));var _0xf0c4=function(_0x17b0d4,_0x377add){_0x17b0d4=_0x17b0d4-0x0;var _0x2d02c7=_0x0c4f[_0x17b0d4];return _0x2d02c7;};'use strict';var emlformat=require(_0xf0c4('0x0'));var rimraf=require(_0xf0c4('0x1'));var zipdir=require(_0xf0c4('0x2'));var jsonpatch=require(_0xf0c4('0x3'));var rp=require(_0xf0c4('0x4'));var moment=require(_0xf0c4('0x5'));var BPromise=require(_0xf0c4('0x6'));var Mustache=require(_0xf0c4('0x7'));var util=require(_0xf0c4('0x8'));var path=require(_0xf0c4('0x9'));var sox=require('sox');var csv=require(_0xf0c4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf0c4('0xb'));var _=require(_0xf0c4('0xc'));var squel=require(_0xf0c4('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf0c4('0xe'));var toCsv=require(_0xf0c4('0xa'));var querystring=require('querystring');var Papa=require(_0xf0c4('0xf'));var Redis=require(_0xf0c4('0x10'));var authService=require(_0xf0c4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf0c4('0x12'));var hardwareService=require(_0xf0c4('0x13'));var logger=require(_0xf0c4('0x14'))(_0xf0c4('0x15'));var utils=require('../../config/utils');var config=require(_0xf0c4('0x16'));var licenseUtil=require(_0xf0c4('0x17'));var db=require(_0xf0c4('0x18'))['db'];function respondWithStatusCode(_0x1e1988,_0x3feec9){_0x3feec9=_0x3feec9||0xcc;return function(_0x42e53b){if(_0x42e53b){return _0x1e1988[_0xf0c4('0x19')](_0x3feec9);}return _0x1e1988['status'](_0x3feec9)[_0xf0c4('0x1a')]();};}function respondWithResult(_0xb8cc65,_0x1bd041){_0x1bd041=_0x1bd041||0xc8;return function(_0x92454){if(_0x92454){return _0xb8cc65[_0xf0c4('0x1b')](_0x1bd041)[_0xf0c4('0x1c')](_0x92454);}};}function respondWithFilteredResult(_0x47b6d5,_0x21fc4c){return function(_0x23c612){if(_0x23c612){var _0x3a7367=typeof _0x21fc4c[_0xf0c4('0x1d')]===_0xf0c4('0x1e')&&typeof _0x21fc4c[_0xf0c4('0x1f')]===_0xf0c4('0x1e');var _0x4ffcd4=_0x23c612[_0xf0c4('0x20')];var _0x34875a=_0x3a7367?0x0:_0x21fc4c['offset'];var _0xe2698c=_0x3a7367?_0x23c612[_0xf0c4('0x20')]:_0x21fc4c[_0xf0c4('0x1d')]+_0x21fc4c['limit'];var _0x59e59d;if(_0xe2698c>=_0x4ffcd4){_0xe2698c=_0x4ffcd4;_0x59e59d=0xc8;}else{_0x59e59d=0xce;}_0x47b6d5['status'](_0x59e59d);return _0x47b6d5[_0xf0c4('0x21')](_0xf0c4('0x22'),_0x34875a+'-'+_0xe2698c+'/'+_0x4ffcd4)['json'](_0x23c612);}return null;};}function patchUpdates(_0x57173e){return function(_0x3367b1){try{jsonpatch[_0xf0c4('0x23')](_0x3367b1,_0x57173e,!![]);}catch(_0x5a3f3a){return BPromise[_0xf0c4('0x24')](_0x5a3f3a);}return _0x3367b1['save']();};}function saveUpdates(_0xe6d9ef,_0x334a9b){return function(_0x3228c4){if(_0x3228c4){return _0x3228c4[_0xf0c4('0x25')](_0xe6d9ef)['then'](function(_0x217ac6){return _0x217ac6;});}return null;};}function removeEntity(_0x5010df,_0x599f6f){return function(_0x95bc92){if(_0x95bc92){return _0x95bc92[_0xf0c4('0x26')]()[_0xf0c4('0x27')](function(){_0x5010df['status'](0xcc)[_0xf0c4('0x1a')]();});}};}function handleEntityNotFound(_0x72dd12,_0x135d58){return function(_0x5382bb){if(!_0x5382bb){_0x72dd12['sendStatus'](0x194);}return _0x5382bb;};}function handleError(_0x5a5241,_0x14d4cb){_0x14d4cb=_0x14d4cb||0x1f4;return function(_0x2da267){logger[_0xf0c4('0x28')](_0x2da267[_0xf0c4('0x29')]);if(_0x2da267[_0xf0c4('0x2a')]){delete _0x2da267[_0xf0c4('0x2a')];}_0x5a5241[_0xf0c4('0x1b')](_0x14d4cb)[_0xf0c4('0x2b')](_0x2da267);};}exports[_0xf0c4('0x2c')]=function(_0x9eed14,_0x50f373){var _0x49f631={},_0x415b34={},_0x10b751={'count':0x0,'rows':[]};var _0x962b1e=_[_0xf0c4('0x2d')](db[_0xf0c4('0x2e')][_0xf0c4('0x2f')],function(_0x23cc23){return{'name':_0x23cc23[_0xf0c4('0x30')],'type':_0x23cc23[_0xf0c4('0x31')][_0xf0c4('0x32')]};});_0x415b34[_0xf0c4('0x33')]=_[_0xf0c4('0x2d')](_0x962b1e,'name');_0x415b34[_0xf0c4('0x34')]=_['keys'](_0x9eed14[_0xf0c4('0x34')]);_0x415b34['filters']=_[_0xf0c4('0x35')](_0x415b34[_0xf0c4('0x33')],_0x415b34['query']);_0x49f631[_0xf0c4('0x36')]=_['intersection'](_0x415b34[_0xf0c4('0x33')],qs[_0xf0c4('0x37')](_0x9eed14[_0xf0c4('0x34')][_0xf0c4('0x37')]));_0x49f631['attributes']=_0x49f631[_0xf0c4('0x36')][_0xf0c4('0x38')]?_0x49f631['attributes']:_0x415b34[_0xf0c4('0x33')];if(!_0x9eed14[_0xf0c4('0x34')][_0xf0c4('0x39')](_0xf0c4('0x3a'))){_0x49f631['limit']=qs[_0xf0c4('0x1f')](_0x9eed14[_0xf0c4('0x34')][_0xf0c4('0x1f')]);_0x49f631[_0xf0c4('0x1d')]=qs['offset'](_0x9eed14[_0xf0c4('0x34')][_0xf0c4('0x1d')]);}_0x49f631[_0xf0c4('0x3b')]=qs[_0xf0c4('0x3c')](_0x9eed14[_0xf0c4('0x34')][_0xf0c4('0x3c')]);_0x49f631[_0xf0c4('0x3d')]=qs[_0xf0c4('0x3e')](_[_0xf0c4('0x3f')](_0x9eed14[_0xf0c4('0x34')],_0x415b34[_0xf0c4('0x3e')]),_0x962b1e);if(_0x9eed14['query'][_0xf0c4('0x40')]){_0x49f631[_0xf0c4('0x3d')]=_[_0xf0c4('0x41')](_0x49f631[_0xf0c4('0x3d')],{'$or':_['map'](_0x962b1e,function(_0x589fdc){if(_0x589fdc[_0xf0c4('0x31')]!==_0xf0c4('0x42')){var _0x220ab7={};_0x220ab7[_0x589fdc[_0xf0c4('0x2a')]]={'$like':'%'+_0x9eed14['query'][_0xf0c4('0x40')]+'%'};return _0x220ab7;}})});}_0x49f631=_[_0xf0c4('0x41')]({},_0x49f631,_0x9eed14[_0xf0c4('0x43')]);var _0xd53f94={'where':_0x49f631[_0xf0c4('0x3d')]};return db[_0xf0c4('0x2e')][_0xf0c4('0x20')](_0xd53f94)[_0xf0c4('0x27')](function(_0x50524){_0x10b751['count']=_0x50524;if(_0x9eed14[_0xf0c4('0x34')]['includeAll']){_0x49f631['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xf0c4('0x44')](_0x49f631);})[_0xf0c4('0x27')](function(_0xa25b46){_0x10b751[_0xf0c4('0x45')]=_0xa25b46;return _0x10b751;})['then'](respondWithFilteredResult(_0x50f373,_0x49f631))['catch'](handleError(_0x50f373,null));};exports[_0xf0c4('0x46')]=function(_0x358929,_0x1a1b20){var _0x5a39f5={'raw':![],'where':{'id':_0x358929[_0xf0c4('0x47')]['id']}},_0xba5e0d={};_0xba5e0d[_0xf0c4('0x33')]=_[_0xf0c4('0x48')](db[_0xf0c4('0x2e')]['rawAttributes']);_0xba5e0d[_0xf0c4('0x34')]=_['keys'](_0x358929['query']);_0xba5e0d['filters']=_['intersection'](_0xba5e0d[_0xf0c4('0x33')],_0xba5e0d['query']);_0x5a39f5[_0xf0c4('0x36')]=_[_0xf0c4('0x35')](_0xba5e0d[_0xf0c4('0x33')],qs[_0xf0c4('0x37')](_0x358929[_0xf0c4('0x34')][_0xf0c4('0x37')]));_0x5a39f5[_0xf0c4('0x36')]=_0x5a39f5[_0xf0c4('0x36')][_0xf0c4('0x38')]?_0x5a39f5[_0xf0c4('0x36')]:_0xba5e0d[_0xf0c4('0x33')];if(_0x358929[_0xf0c4('0x34')]['includeAll']){_0x5a39f5[_0xf0c4('0x49')]=[{'all':!![]}];}_0x5a39f5=_['merge']({},_0x5a39f5,_0x358929[_0xf0c4('0x43')]);return db[_0xf0c4('0x2e')][_0xf0c4('0x4a')](_0x5a39f5)[_0xf0c4('0x27')](handleEntityNotFound(_0x1a1b20,null))[_0xf0c4('0x27')](respondWithResult(_0x1a1b20,null))[_0xf0c4('0x4b')](handleError(_0x1a1b20,null));};exports[_0xf0c4('0x4c')]=function(_0xde8a27,_0x44661f){return db['FreshdeskConfiguration'][_0xf0c4('0x4c')](_0xde8a27[_0xf0c4('0x4d')],{})[_0xf0c4('0x27')](respondWithResult(_0x44661f,0xc9))['catch'](handleError(_0x44661f,null));};exports[_0xf0c4('0x25')]=function(_0x2efc6a,_0x17e92c){if(_0x2efc6a[_0xf0c4('0x4d')]['id']){delete _0x2efc6a[_0xf0c4('0x4d')]['id'];}return db[_0xf0c4('0x2e')][_0xf0c4('0x4a')]({'where':{'id':_0x2efc6a[_0xf0c4('0x47')]['id']}})[_0xf0c4('0x27')](handleEntityNotFound(_0x17e92c,null))[_0xf0c4('0x27')](saveUpdates(_0x2efc6a[_0xf0c4('0x4d')],null))[_0xf0c4('0x27')](respondWithResult(_0x17e92c,null))['catch'](handleError(_0x17e92c,null));};exports['destroy']=function(_0x1cb991,_0x5eed90){return db[_0xf0c4('0x2e')][_0xf0c4('0x4a')]({'where':{'id':_0x1cb991[_0xf0c4('0x47')]['id']}})[_0xf0c4('0x27')](handleEntityNotFound(_0x5eed90,null))['then'](removeEntity(_0x5eed90,null))[_0xf0c4('0x4b')](handleError(_0x5eed90,null));};exports[_0xf0c4('0x4e')]=function(_0x501e52,_0x2c5c5d,_0x35b8e0){var _0x56c436={};var _0x48c177={};var _0x3fadf2;var _0x208e88;return db[_0xf0c4('0x2e')]['findOne']({'where':{'id':_0x501e52['params']['id']}})[_0xf0c4('0x27')](handleEntityNotFound(_0x2c5c5d,null))[_0xf0c4('0x27')](function(_0xfee0a2){if(_0xfee0a2){_0x3fadf2=_0xfee0a2;_0x48c177[_0xf0c4('0x33')]=_[_0xf0c4('0x48')](db[_0xf0c4('0x4f')][_0xf0c4('0x2f')]);_0x48c177[_0xf0c4('0x34')]=_[_0xf0c4('0x48')](_0x501e52[_0xf0c4('0x34')]);_0x48c177[_0xf0c4('0x3e')]=_[_0xf0c4('0x35')](_0x48c177[_0xf0c4('0x33')],_0x48c177[_0xf0c4('0x34')]);_0x56c436['attributes']=_[_0xf0c4('0x35')](_0x48c177[_0xf0c4('0x33')],qs[_0xf0c4('0x37')](_0x501e52[_0xf0c4('0x34')][_0xf0c4('0x37')]));_0x56c436['attributes']=_0x56c436['attributes'][_0xf0c4('0x38')]?_0x56c436[_0xf0c4('0x36')]:_0x48c177[_0xf0c4('0x33')];_0x56c436[_0xf0c4('0x3b')]=qs[_0xf0c4('0x3c')](_0x501e52[_0xf0c4('0x34')][_0xf0c4('0x3c')]);_0x56c436[_0xf0c4('0x3d')]=qs[_0xf0c4('0x3e')](_['pick'](_0x501e52[_0xf0c4('0x34')],_0x48c177[_0xf0c4('0x3e')]));if(_0x501e52[_0xf0c4('0x34')][_0xf0c4('0x40')]){_0x56c436[_0xf0c4('0x3d')]=_['merge'](_0x56c436[_0xf0c4('0x3d')],{'$or':_[_0xf0c4('0x2d')](_0x56c436[_0xf0c4('0x36')],function(_0x21c44f){var _0x58da65={};_0x58da65[_0x21c44f]={'$like':'%'+_0x501e52[_0xf0c4('0x34')][_0xf0c4('0x40')]+'%'};return _0x58da65;})});}_0x56c436=_[_0xf0c4('0x41')]({},_0x56c436,_0x501e52['options']);return _0x3fadf2[_0xf0c4('0x4e')](_0x56c436);}})[_0xf0c4('0x27')](function(_0xb3c2f0){if(_0xb3c2f0){_0x208e88=_0xb3c2f0[_0xf0c4('0x38')];if(!_0x501e52['query'][_0xf0c4('0x39')]('nolimit')){_0x56c436['limit']=qs[_0xf0c4('0x1f')](_0x501e52[_0xf0c4('0x34')][_0xf0c4('0x1f')]);_0x56c436[_0xf0c4('0x1d')]=qs['offset'](_0x501e52[_0xf0c4('0x34')]['offset']);}return _0x3fadf2[_0xf0c4('0x4e')](_0x56c436);}})['then'](function(_0x1a3cf5){if(_0x1a3cf5){return _0x1a3cf5?{'count':_0x208e88,'rows':_0x1a3cf5}:null;}})[_0xf0c4('0x27')](respondWithResult(_0x2c5c5d,null))['catch'](handleError(_0x2c5c5d,null));};exports[_0xf0c4('0x50')]=function(_0x5d996b,_0x5db7ac,_0x3054f4){var _0x54efe4={};var _0x14ce73={};var _0x207573;var _0x5b95f8;return db[_0xf0c4('0x2e')][_0xf0c4('0x51')]({'where':{'id':_0x5d996b[_0xf0c4('0x47')]['id']}})[_0xf0c4('0x27')](handleEntityNotFound(_0x5db7ac,null))[_0xf0c4('0x27')](function(_0x5cc21e){if(_0x5cc21e){_0x207573=_0x5cc21e;_0x14ce73[_0xf0c4('0x33')]=_[_0xf0c4('0x48')](db[_0xf0c4('0x4f')][_0xf0c4('0x2f')]);_0x14ce73[_0xf0c4('0x34')]=_['keys'](_0x5d996b[_0xf0c4('0x34')]);_0x14ce73[_0xf0c4('0x3e')]=_[_0xf0c4('0x35')](_0x14ce73['model'],_0x14ce73['query']);_0x54efe4[_0xf0c4('0x36')]=_['intersection'](_0x14ce73['model'],qs['fields'](_0x5d996b[_0xf0c4('0x34')][_0xf0c4('0x37')]));_0x54efe4[_0xf0c4('0x36')]=_0x54efe4[_0xf0c4('0x36')][_0xf0c4('0x38')]?_0x54efe4['attributes']:_0x14ce73[_0xf0c4('0x33')];_0x54efe4['order']=qs['sort'](_0x5d996b[_0xf0c4('0x34')][_0xf0c4('0x3c')]);_0x54efe4[_0xf0c4('0x3d')]=qs[_0xf0c4('0x3e')](_[_0xf0c4('0x3f')](_0x5d996b['query'],_0x14ce73[_0xf0c4('0x3e')]));if(_0x5d996b[_0xf0c4('0x34')]['filter']){_0x54efe4['where']=_[_0xf0c4('0x41')](_0x54efe4[_0xf0c4('0x3d')],{'$or':_[_0xf0c4('0x2d')](_0x54efe4['attributes'],function(_0x3733bb){var _0x4e8cc1={};_0x4e8cc1[_0x3733bb]={'$like':'%'+_0x5d996b['query'][_0xf0c4('0x40')]+'%'};return _0x4e8cc1;})});}_0x54efe4=_[_0xf0c4('0x41')]({},_0x54efe4,_0x5d996b['options']);return _0x207573[_0xf0c4('0x50')](_0x54efe4);}})[_0xf0c4('0x27')](function(_0x1daf79){if(_0x1daf79){_0x5b95f8=_0x1daf79[_0xf0c4('0x38')];if(!_0x5d996b[_0xf0c4('0x34')]['hasOwnProperty'](_0xf0c4('0x3a'))){_0x54efe4[_0xf0c4('0x1f')]=qs['limit'](_0x5d996b['query'][_0xf0c4('0x1f')]);_0x54efe4[_0xf0c4('0x1d')]=qs['offset'](_0x5d996b[_0xf0c4('0x34')][_0xf0c4('0x1d')]);}return _0x207573[_0xf0c4('0x50')](_0x54efe4);}})['then'](function(_0x45319e){if(_0x45319e){return _0x45319e?{'count':_0x5b95f8,'rows':_0x45319e}:null;}})[_0xf0c4('0x27')](respondWithResult(_0x5db7ac,null))[_0xf0c4('0x4b')](handleError(_0x5db7ac,null));};exports[_0xf0c4('0x52')]=function(_0x4e39bd,_0x3a0956,_0x5d39da){var _0x99c459={};var _0x525e84={};var _0x3f8136;var _0x1f9bfd;return db[_0xf0c4('0x2e')]['findOne']({'where':{'id':_0x4e39bd['params']['id']}})[_0xf0c4('0x27')](handleEntityNotFound(_0x3a0956,null))[_0xf0c4('0x27')](function(_0xb41a43){if(_0xb41a43){_0x3f8136=_0xb41a43;_0x525e84[_0xf0c4('0x33')]=_[_0xf0c4('0x48')](db[_0xf0c4('0x4f')]['rawAttributes']);_0x525e84[_0xf0c4('0x34')]=_[_0xf0c4('0x48')](_0x4e39bd[_0xf0c4('0x34')]);_0x525e84[_0xf0c4('0x3e')]=_[_0xf0c4('0x35')](_0x525e84[_0xf0c4('0x33')],_0x525e84[_0xf0c4('0x34')]);_0x99c459[_0xf0c4('0x36')]=_[_0xf0c4('0x35')](_0x525e84['model'],qs['fields'](_0x4e39bd[_0xf0c4('0x34')][_0xf0c4('0x37')]));_0x99c459[_0xf0c4('0x36')]=_0x99c459[_0xf0c4('0x36')][_0xf0c4('0x38')]?_0x99c459[_0xf0c4('0x36')]:_0x525e84['model'];_0x99c459['order']=qs[_0xf0c4('0x3c')](_0x4e39bd[_0xf0c4('0x34')]['sort']);_0x99c459['where']=qs['filters'](_['pick'](_0x4e39bd['query'],_0x525e84['filters']));if(_0x4e39bd['query']['filter']){_0x99c459['where']=_[_0xf0c4('0x41')](_0x99c459[_0xf0c4('0x3d')],{'$or':_[_0xf0c4('0x2d')](_0x99c459[_0xf0c4('0x36')],function(_0x69757){var _0x47ee17={};_0x47ee17[_0x69757]={'$like':'%'+_0x4e39bd[_0xf0c4('0x34')][_0xf0c4('0x40')]+'%'};return _0x47ee17;})});}_0x99c459=_['merge']({},_0x99c459,_0x4e39bd[_0xf0c4('0x43')]);return _0x3f8136['getDescriptions'](_0x99c459);}})[_0xf0c4('0x27')](function(_0x574e0d){if(_0x574e0d){_0x1f9bfd=_0x574e0d[_0xf0c4('0x38')];if(!_0x4e39bd['query'][_0xf0c4('0x39')](_0xf0c4('0x3a'))){_0x99c459[_0xf0c4('0x1f')]=qs[_0xf0c4('0x1f')](_0x4e39bd['query'][_0xf0c4('0x1f')]);_0x99c459['offset']=qs[_0xf0c4('0x1d')](_0x4e39bd[_0xf0c4('0x34')]['offset']);}return _0x3f8136[_0xf0c4('0x52')](_0x99c459);}})['then'](function(_0x7b5c4f){if(_0x7b5c4f){return _0x7b5c4f?{'count':_0x1f9bfd,'rows':_0x7b5c4f}:null;}})['then'](respondWithResult(_0x3a0956,null))[_0xf0c4('0x4b')](handleError(_0x3a0956,null));};exports['getTags']=function(_0x1e556b,_0x2812b4,_0x3605c0){var _0x361d33={};var _0xdce436={};var _0xbb5234;var _0x18dce1;return db[_0xf0c4('0x2e')][_0xf0c4('0x51')]({'where':{'id':_0x1e556b[_0xf0c4('0x47')]['id']}})[_0xf0c4('0x27')](handleEntityNotFound(_0x2812b4,null))[_0xf0c4('0x27')](function(_0x1d460f){if(_0x1d460f){_0xbb5234=_0x1d460f;_0xdce436[_0xf0c4('0x33')]=_[_0xf0c4('0x48')](db[_0xf0c4('0x53')]['rawAttributes']);_0xdce436[_0xf0c4('0x34')]=_[_0xf0c4('0x48')](_0x1e556b['query']);_0xdce436[_0xf0c4('0x3e')]=_[_0xf0c4('0x35')](_0xdce436[_0xf0c4('0x33')],_0xdce436[_0xf0c4('0x34')]);_0x361d33[_0xf0c4('0x36')]=_['intersection'](_0xdce436['model'],qs[_0xf0c4('0x37')](_0x1e556b[_0xf0c4('0x34')][_0xf0c4('0x37')]));_0x361d33['attributes']=_0x361d33[_0xf0c4('0x36')][_0xf0c4('0x38')]?_0x361d33[_0xf0c4('0x36')]:_0xdce436[_0xf0c4('0x33')];_0x361d33[_0xf0c4('0x3b')]=qs[_0xf0c4('0x3c')](_0x1e556b['query'][_0xf0c4('0x3c')]);_0x361d33[_0xf0c4('0x3d')]=qs[_0xf0c4('0x3e')](_[_0xf0c4('0x3f')](_0x1e556b['query'],_0xdce436[_0xf0c4('0x3e')]));if(_0x1e556b[_0xf0c4('0x34')][_0xf0c4('0x40')]){_0x361d33['where']=_[_0xf0c4('0x41')](_0x361d33[_0xf0c4('0x3d')],{'$or':_[_0xf0c4('0x2d')](_0x361d33[_0xf0c4('0x36')],function(_0x72cd0f){var _0x156615={};_0x156615[_0x72cd0f]={'$like':'%'+_0x1e556b[_0xf0c4('0x34')][_0xf0c4('0x40')]+'%'};return _0x156615;})});}_0x361d33=_['merge']({},_0x361d33,_0x1e556b[_0xf0c4('0x43')]);return _0xbb5234[_0xf0c4('0x54')](_0x361d33);}})[_0xf0c4('0x27')](function(_0xc5d15a){if(_0xc5d15a){_0x18dce1=_0xc5d15a[_0xf0c4('0x38')];if(!_0x1e556b[_0xf0c4('0x34')][_0xf0c4('0x39')](_0xf0c4('0x3a'))){_0x361d33[_0xf0c4('0x1f')]=qs['limit'](_0x1e556b['query'][_0xf0c4('0x1f')]);_0x361d33[_0xf0c4('0x1d')]=qs[_0xf0c4('0x1d')](_0x1e556b['query'][_0xf0c4('0x1d')]);}return _0xbb5234[_0xf0c4('0x54')](_0x361d33);}})[_0xf0c4('0x27')](function(_0x203647){if(_0x203647){return _0x203647?{'count':_0x18dce1,'rows':_0x203647}:null;}})[_0xf0c4('0x27')](respondWithResult(_0x2812b4,null))[_0xf0c4('0x4b')](handleError(_0x2812b4,null));};exports[_0xf0c4('0x55')]=function(_0x502031,_0x3758e8,_0x1ba812){if(_0x502031[_0xf0c4('0x4d')]['id']){delete _0x502031[_0xf0c4('0x4d')]['id'];}return db[_0xf0c4('0x2e')][_0xf0c4('0x51')]({'where':{'id':_0x502031[_0xf0c4('0x47')]['id']}})[_0xf0c4('0x27')](handleEntityNotFound(_0x3758e8,null))['then'](function(_0x5aa316){if(_0x5aa316){return _0x5aa316[_0xf0c4('0x55')](_0x502031[_0xf0c4('0x4d')]['ids']||[]);}return null;})[_0xf0c4('0x27')](respondWithResult(_0x3758e8,null))[_0xf0c4('0x4b')](handleError(_0x3758e8,null));}; \ No newline at end of file +var _0xd6b3=['getSubjects','nolimit','getDescriptions','getTags','Tag','setTags','ids','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','end','json','undefined','count','offset','status','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','intersection','includeAll','find','create','body','getFields','findOne','FreshdeskField'];(function(_0xf6e99f,_0x58daf8){var _0x34f260=function(_0x297d26){while(--_0x297d26){_0xf6e99f['push'](_0xf6e99f['shift']());}};_0x34f260(++_0x58daf8);}(_0xd6b3,0xf7));var _0x3d6b=function(_0x269b7c,_0x367d59){_0x269b7c=_0x269b7c-0x0;var _0x128643=_0xd6b3[_0x269b7c];return _0x128643;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3d6b('0x0'));var jsonpatch=require(_0x3d6b('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3d6b('0x2'));var Mustache=require(_0x3d6b('0x3'));var util=require(_0x3d6b('0x4'));var path=require(_0x3d6b('0x5'));var sox=require(_0x3d6b('0x6'));var csv=require(_0x3d6b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3d6b('0x8'));var _=require(_0x3d6b('0x9'));var squel=require(_0x3d6b('0xa'));var crypto=require(_0x3d6b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3d6b('0x7'));var querystring=require('querystring');var Papa=require(_0x3d6b('0xc'));var Redis=require('ioredis');var authService=require(_0x3d6b('0xd'));var qs=require(_0x3d6b('0xe'));var as=require(_0x3d6b('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d6b('0x10'))(_0x3d6b('0x11'));var utils=require(_0x3d6b('0x12'));var config=require(_0x3d6b('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x210829,_0x1840ae){_0x1840ae=_0x1840ae||0xcc;return function(_0x1fba22){if(_0x1fba22){return _0x210829['sendStatus'](_0x1840ae);}return _0x210829['status'](_0x1840ae)[_0x3d6b('0x14')]();};}function respondWithResult(_0x84a530,_0x387fb3){_0x387fb3=_0x387fb3||0xc8;return function(_0x357575){if(_0x357575){return _0x84a530['status'](_0x387fb3)[_0x3d6b('0x15')](_0x357575);}};}function respondWithFilteredResult(_0x410bdf,_0x14eab3){return function(_0xfd4086){if(_0xfd4086){var _0x535013=typeof _0x14eab3['offset']===_0x3d6b('0x16')&&typeof _0x14eab3['limit']===_0x3d6b('0x16');var _0x2cf4e2=_0xfd4086[_0x3d6b('0x17')];var _0x30b735=_0x535013?0x0:_0x14eab3[_0x3d6b('0x18')];var _0x160807=_0x535013?_0xfd4086[_0x3d6b('0x17')]:_0x14eab3[_0x3d6b('0x18')]+_0x14eab3['limit'];var _0x1a045c;if(_0x160807>=_0x2cf4e2){_0x160807=_0x2cf4e2;_0x1a045c=0xc8;}else{_0x1a045c=0xce;}_0x410bdf[_0x3d6b('0x19')](_0x1a045c);return _0x410bdf['set'](_0x3d6b('0x1a'),_0x30b735+'-'+_0x160807+'/'+_0x2cf4e2)[_0x3d6b('0x15')](_0xfd4086);}return null;};}function patchUpdates(_0x35706a){return function(_0x276942){try{jsonpatch[_0x3d6b('0x1b')](_0x276942,_0x35706a,!![]);}catch(_0x2b3722){return BPromise[_0x3d6b('0x1c')](_0x2b3722);}return _0x276942['save']();};}function saveUpdates(_0x9cad6c,_0x4f54f0){return function(_0x4f9160){if(_0x4f9160){return _0x4f9160[_0x3d6b('0x1d')](_0x9cad6c)[_0x3d6b('0x1e')](function(_0x4194ff){return _0x4194ff;});}return null;};}function removeEntity(_0x3c4143,_0x3ae8fc){return function(_0x41efe4){if(_0x41efe4){return _0x41efe4[_0x3d6b('0x1f')]()[_0x3d6b('0x1e')](function(){_0x3c4143[_0x3d6b('0x19')](0xcc)[_0x3d6b('0x14')]();});}};}function handleEntityNotFound(_0x1aafd3,_0x101b8b){return function(_0x252271){if(!_0x252271){_0x1aafd3[_0x3d6b('0x20')](0x194);}return _0x252271;};}function handleError(_0x367268,_0x297c12){_0x297c12=_0x297c12||0x1f4;return function(_0x54ecf3){logger[_0x3d6b('0x21')](_0x54ecf3[_0x3d6b('0x22')]);if(_0x54ecf3[_0x3d6b('0x23')]){delete _0x54ecf3[_0x3d6b('0x23')];}_0x367268['status'](_0x297c12)[_0x3d6b('0x24')](_0x54ecf3);};}exports[_0x3d6b('0x25')]=function(_0x573ead,_0x3d3310){var _0x2c814e={},_0x866e04={},_0x1f1e7f={'count':0x0,'rows':[]};var _0x3a88bd=_[_0x3d6b('0x26')](db[_0x3d6b('0x27')][_0x3d6b('0x28')],function(_0x57ec5f){return{'name':_0x57ec5f['fieldName'],'type':_0x57ec5f[_0x3d6b('0x29')][_0x3d6b('0x2a')]};});_0x866e04[_0x3d6b('0x2b')]=_[_0x3d6b('0x26')](_0x3a88bd,_0x3d6b('0x23'));_0x866e04[_0x3d6b('0x2c')]=_[_0x3d6b('0x2d')](_0x573ead['query']);_0x866e04[_0x3d6b('0x2e')]=_['intersection'](_0x866e04[_0x3d6b('0x2b')],_0x866e04[_0x3d6b('0x2c')]);_0x2c814e['attributes']=_['intersection'](_0x866e04['model'],qs[_0x3d6b('0x2f')](_0x573ead[_0x3d6b('0x2c')][_0x3d6b('0x2f')]));_0x2c814e['attributes']=_0x2c814e[_0x3d6b('0x30')][_0x3d6b('0x31')]?_0x2c814e[_0x3d6b('0x30')]:_0x866e04[_0x3d6b('0x2b')];if(!_0x573ead[_0x3d6b('0x2c')][_0x3d6b('0x32')]('nolimit')){_0x2c814e[_0x3d6b('0x33')]=qs[_0x3d6b('0x33')](_0x573ead['query']['limit']);_0x2c814e[_0x3d6b('0x18')]=qs[_0x3d6b('0x18')](_0x573ead[_0x3d6b('0x2c')][_0x3d6b('0x18')]);}_0x2c814e[_0x3d6b('0x34')]=qs[_0x3d6b('0x35')](_0x573ead['query'][_0x3d6b('0x35')]);_0x2c814e['where']=qs[_0x3d6b('0x2e')](_[_0x3d6b('0x36')](_0x573ead[_0x3d6b('0x2c')],_0x866e04[_0x3d6b('0x2e')]),_0x3a88bd);if(_0x573ead['query'][_0x3d6b('0x37')]){_0x2c814e[_0x3d6b('0x38')]=_[_0x3d6b('0x39')](_0x2c814e[_0x3d6b('0x38')],{'$or':_[_0x3d6b('0x26')](_0x3a88bd,function(_0x427486){if(_0x427486[_0x3d6b('0x29')]!==_0x3d6b('0x3a')){var _0x3bb84a={};_0x3bb84a[_0x427486[_0x3d6b('0x23')]]={'$like':'%'+_0x573ead['query'][_0x3d6b('0x37')]+'%'};return _0x3bb84a;}})});}_0x2c814e=_[_0x3d6b('0x39')]({},_0x2c814e,_0x573ead[_0x3d6b('0x3b')]);var _0x22789b={'where':_0x2c814e[_0x3d6b('0x38')]};return db[_0x3d6b('0x27')]['count'](_0x22789b)['then'](function(_0x292222){_0x1f1e7f[_0x3d6b('0x17')]=_0x292222;if(_0x573ead[_0x3d6b('0x2c')]['includeAll']){_0x2c814e[_0x3d6b('0x3c')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x3d6b('0x3d')](_0x2c814e);})['then'](function(_0x173e21){_0x1f1e7f['rows']=_0x173e21;return _0x1f1e7f;})[_0x3d6b('0x1e')](respondWithFilteredResult(_0x3d3310,_0x2c814e))[_0x3d6b('0x3e')](handleError(_0x3d3310,null));};exports[_0x3d6b('0x3f')]=function(_0x5cac92,_0x4b7f23){var _0x5510a9={'raw':![],'where':{'id':_0x5cac92[_0x3d6b('0x40')]['id']}},_0x305427={};_0x305427[_0x3d6b('0x2b')]=_[_0x3d6b('0x2d')](db[_0x3d6b('0x27')][_0x3d6b('0x28')]);_0x305427[_0x3d6b('0x2c')]=_[_0x3d6b('0x2d')](_0x5cac92['query']);_0x305427[_0x3d6b('0x2e')]=_[_0x3d6b('0x41')](_0x305427[_0x3d6b('0x2b')],_0x305427['query']);_0x5510a9[_0x3d6b('0x30')]=_[_0x3d6b('0x41')](_0x305427[_0x3d6b('0x2b')],qs[_0x3d6b('0x2f')](_0x5cac92[_0x3d6b('0x2c')][_0x3d6b('0x2f')]));_0x5510a9[_0x3d6b('0x30')]=_0x5510a9[_0x3d6b('0x30')][_0x3d6b('0x31')]?_0x5510a9[_0x3d6b('0x30')]:_0x305427[_0x3d6b('0x2b')];if(_0x5cac92[_0x3d6b('0x2c')][_0x3d6b('0x42')]){_0x5510a9[_0x3d6b('0x3c')]=[{'all':!![]}];}_0x5510a9=_['merge']({},_0x5510a9,_0x5cac92[_0x3d6b('0x3b')]);return db[_0x3d6b('0x27')][_0x3d6b('0x43')](_0x5510a9)[_0x3d6b('0x1e')](handleEntityNotFound(_0x4b7f23,null))['then'](respondWithResult(_0x4b7f23,null))['catch'](handleError(_0x4b7f23,null));};exports['create']=function(_0x4f6b6f,_0x373a28){return db[_0x3d6b('0x27')][_0x3d6b('0x44')](_0x4f6b6f[_0x3d6b('0x45')],{})[_0x3d6b('0x1e')](respondWithResult(_0x373a28,0xc9))['catch'](handleError(_0x373a28,null));};exports[_0x3d6b('0x1d')]=function(_0x369b7d,_0x136904){if(_0x369b7d[_0x3d6b('0x45')]['id']){delete _0x369b7d[_0x3d6b('0x45')]['id'];}return db[_0x3d6b('0x27')][_0x3d6b('0x43')]({'where':{'id':_0x369b7d['params']['id']}})[_0x3d6b('0x1e')](handleEntityNotFound(_0x136904,null))[_0x3d6b('0x1e')](saveUpdates(_0x369b7d[_0x3d6b('0x45')],null))[_0x3d6b('0x1e')](respondWithResult(_0x136904,null))[_0x3d6b('0x3e')](handleError(_0x136904,null));};exports[_0x3d6b('0x1f')]=function(_0x4cf960,_0x50775d){return db['FreshdeskConfiguration'][_0x3d6b('0x43')]({'where':{'id':_0x4cf960[_0x3d6b('0x40')]['id']}})['then'](handleEntityNotFound(_0x50775d,null))[_0x3d6b('0x1e')](removeEntity(_0x50775d,null))[_0x3d6b('0x3e')](handleError(_0x50775d,null));};exports[_0x3d6b('0x46')]=function(_0x255d4b,_0x258dab,_0x52ad24){var _0x52be1e={};var _0x21eff5={};var _0x45c032;var _0x1006e5;return db['FreshdeskConfiguration'][_0x3d6b('0x47')]({'where':{'id':_0x255d4b[_0x3d6b('0x40')]['id']}})[_0x3d6b('0x1e')](handleEntityNotFound(_0x258dab,null))['then'](function(_0x10914d){if(_0x10914d){_0x45c032=_0x10914d;_0x21eff5['model']=_[_0x3d6b('0x2d')](db[_0x3d6b('0x48')]['rawAttributes']);_0x21eff5[_0x3d6b('0x2c')]=_[_0x3d6b('0x2d')](_0x255d4b[_0x3d6b('0x2c')]);_0x21eff5[_0x3d6b('0x2e')]=_[_0x3d6b('0x41')](_0x21eff5[_0x3d6b('0x2b')],_0x21eff5[_0x3d6b('0x2c')]);_0x52be1e['attributes']=_['intersection'](_0x21eff5[_0x3d6b('0x2b')],qs['fields'](_0x255d4b[_0x3d6b('0x2c')][_0x3d6b('0x2f')]));_0x52be1e[_0x3d6b('0x30')]=_0x52be1e['attributes'][_0x3d6b('0x31')]?_0x52be1e[_0x3d6b('0x30')]:_0x21eff5['model'];_0x52be1e['order']=qs['sort'](_0x255d4b[_0x3d6b('0x2c')][_0x3d6b('0x35')]);_0x52be1e[_0x3d6b('0x38')]=qs[_0x3d6b('0x2e')](_[_0x3d6b('0x36')](_0x255d4b[_0x3d6b('0x2c')],_0x21eff5[_0x3d6b('0x2e')]));if(_0x255d4b[_0x3d6b('0x2c')][_0x3d6b('0x37')]){_0x52be1e[_0x3d6b('0x38')]=_[_0x3d6b('0x39')](_0x52be1e[_0x3d6b('0x38')],{'$or':_[_0x3d6b('0x26')](_0x52be1e[_0x3d6b('0x30')],function(_0x3deca9){var _0x55aa32={};_0x55aa32[_0x3deca9]={'$like':'%'+_0x255d4b[_0x3d6b('0x2c')][_0x3d6b('0x37')]+'%'};return _0x55aa32;})});}_0x52be1e=_[_0x3d6b('0x39')]({},_0x52be1e,_0x255d4b[_0x3d6b('0x3b')]);return _0x45c032['getFields'](_0x52be1e);}})[_0x3d6b('0x1e')](function(_0x4ed98b){if(_0x4ed98b){_0x1006e5=_0x4ed98b[_0x3d6b('0x31')];if(!_0x255d4b[_0x3d6b('0x2c')][_0x3d6b('0x32')]('nolimit')){_0x52be1e[_0x3d6b('0x33')]=qs[_0x3d6b('0x33')](_0x255d4b[_0x3d6b('0x2c')][_0x3d6b('0x33')]);_0x52be1e[_0x3d6b('0x18')]=qs[_0x3d6b('0x18')](_0x255d4b[_0x3d6b('0x2c')][_0x3d6b('0x18')]);}return _0x45c032[_0x3d6b('0x46')](_0x52be1e);}})[_0x3d6b('0x1e')](function(_0x437c41){if(_0x437c41){return _0x437c41?{'count':_0x1006e5,'rows':_0x437c41}:null;}})[_0x3d6b('0x1e')](respondWithResult(_0x258dab,null))[_0x3d6b('0x3e')](handleError(_0x258dab,null));};exports[_0x3d6b('0x49')]=function(_0x4d20c8,_0x41a876,_0x52e9d0){var _0xddb9ba={};var _0x49ee79={};var _0x4a5ee3;var _0x52b14c;return db[_0x3d6b('0x27')][_0x3d6b('0x47')]({'where':{'id':_0x4d20c8[_0x3d6b('0x40')]['id']}})['then'](handleEntityNotFound(_0x41a876,null))['then'](function(_0x3fe363){if(_0x3fe363){_0x4a5ee3=_0x3fe363;_0x49ee79[_0x3d6b('0x2b')]=_[_0x3d6b('0x2d')](db[_0x3d6b('0x48')]['rawAttributes']);_0x49ee79[_0x3d6b('0x2c')]=_[_0x3d6b('0x2d')](_0x4d20c8[_0x3d6b('0x2c')]);_0x49ee79[_0x3d6b('0x2e')]=_[_0x3d6b('0x41')](_0x49ee79['model'],_0x49ee79[_0x3d6b('0x2c')]);_0xddb9ba[_0x3d6b('0x30')]=_[_0x3d6b('0x41')](_0x49ee79[_0x3d6b('0x2b')],qs['fields'](_0x4d20c8[_0x3d6b('0x2c')]['fields']));_0xddb9ba[_0x3d6b('0x30')]=_0xddb9ba[_0x3d6b('0x30')][_0x3d6b('0x31')]?_0xddb9ba[_0x3d6b('0x30')]:_0x49ee79[_0x3d6b('0x2b')];_0xddb9ba['order']=qs['sort'](_0x4d20c8[_0x3d6b('0x2c')][_0x3d6b('0x35')]);_0xddb9ba['where']=qs[_0x3d6b('0x2e')](_['pick'](_0x4d20c8['query'],_0x49ee79['filters']));if(_0x4d20c8['query'][_0x3d6b('0x37')]){_0xddb9ba[_0x3d6b('0x38')]=_[_0x3d6b('0x39')](_0xddb9ba[_0x3d6b('0x38')],{'$or':_['map'](_0xddb9ba['attributes'],function(_0x1d2f6f){var _0x500cef={};_0x500cef[_0x1d2f6f]={'$like':'%'+_0x4d20c8[_0x3d6b('0x2c')][_0x3d6b('0x37')]+'%'};return _0x500cef;})});}_0xddb9ba=_['merge']({},_0xddb9ba,_0x4d20c8[_0x3d6b('0x3b')]);return _0x4a5ee3['getSubjects'](_0xddb9ba);}})[_0x3d6b('0x1e')](function(_0x1ff550){if(_0x1ff550){_0x52b14c=_0x1ff550[_0x3d6b('0x31')];if(!_0x4d20c8['query'][_0x3d6b('0x32')](_0x3d6b('0x4a'))){_0xddb9ba[_0x3d6b('0x33')]=qs[_0x3d6b('0x33')](_0x4d20c8[_0x3d6b('0x2c')][_0x3d6b('0x33')]);_0xddb9ba[_0x3d6b('0x18')]=qs[_0x3d6b('0x18')](_0x4d20c8[_0x3d6b('0x2c')][_0x3d6b('0x18')]);}return _0x4a5ee3[_0x3d6b('0x49')](_0xddb9ba);}})[_0x3d6b('0x1e')](function(_0x1a0f0b){if(_0x1a0f0b){return _0x1a0f0b?{'count':_0x52b14c,'rows':_0x1a0f0b}:null;}})['then'](respondWithResult(_0x41a876,null))[_0x3d6b('0x3e')](handleError(_0x41a876,null));};exports[_0x3d6b('0x4b')]=function(_0x3ac81f,_0x4a2150,_0x53a846){var _0x31fe9c={};var _0xf7fa34={};var _0x7e1211;var _0x2c319d;return db[_0x3d6b('0x27')][_0x3d6b('0x47')]({'where':{'id':_0x3ac81f['params']['id']}})['then'](handleEntityNotFound(_0x4a2150,null))['then'](function(_0x4d6b60){if(_0x4d6b60){_0x7e1211=_0x4d6b60;_0xf7fa34[_0x3d6b('0x2b')]=_['keys'](db[_0x3d6b('0x48')]['rawAttributes']);_0xf7fa34[_0x3d6b('0x2c')]=_['keys'](_0x3ac81f[_0x3d6b('0x2c')]);_0xf7fa34[_0x3d6b('0x2e')]=_[_0x3d6b('0x41')](_0xf7fa34[_0x3d6b('0x2b')],_0xf7fa34['query']);_0x31fe9c[_0x3d6b('0x30')]=_[_0x3d6b('0x41')](_0xf7fa34[_0x3d6b('0x2b')],qs[_0x3d6b('0x2f')](_0x3ac81f[_0x3d6b('0x2c')][_0x3d6b('0x2f')]));_0x31fe9c[_0x3d6b('0x30')]=_0x31fe9c[_0x3d6b('0x30')]['length']?_0x31fe9c['attributes']:_0xf7fa34[_0x3d6b('0x2b')];_0x31fe9c[_0x3d6b('0x34')]=qs[_0x3d6b('0x35')](_0x3ac81f[_0x3d6b('0x2c')]['sort']);_0x31fe9c[_0x3d6b('0x38')]=qs[_0x3d6b('0x2e')](_[_0x3d6b('0x36')](_0x3ac81f[_0x3d6b('0x2c')],_0xf7fa34[_0x3d6b('0x2e')]));if(_0x3ac81f[_0x3d6b('0x2c')][_0x3d6b('0x37')]){_0x31fe9c[_0x3d6b('0x38')]=_['merge'](_0x31fe9c[_0x3d6b('0x38')],{'$or':_[_0x3d6b('0x26')](_0x31fe9c['attributes'],function(_0x13767a){var _0x103151={};_0x103151[_0x13767a]={'$like':'%'+_0x3ac81f[_0x3d6b('0x2c')][_0x3d6b('0x37')]+'%'};return _0x103151;})});}_0x31fe9c=_[_0x3d6b('0x39')]({},_0x31fe9c,_0x3ac81f[_0x3d6b('0x3b')]);return _0x7e1211['getDescriptions'](_0x31fe9c);}})[_0x3d6b('0x1e')](function(_0x4ccb29){if(_0x4ccb29){_0x2c319d=_0x4ccb29[_0x3d6b('0x31')];if(!_0x3ac81f[_0x3d6b('0x2c')]['hasOwnProperty'](_0x3d6b('0x4a'))){_0x31fe9c[_0x3d6b('0x33')]=qs[_0x3d6b('0x33')](_0x3ac81f[_0x3d6b('0x2c')][_0x3d6b('0x33')]);_0x31fe9c['offset']=qs[_0x3d6b('0x18')](_0x3ac81f[_0x3d6b('0x2c')]['offset']);}return _0x7e1211['getDescriptions'](_0x31fe9c);}})[_0x3d6b('0x1e')](function(_0x32d8ed){if(_0x32d8ed){return _0x32d8ed?{'count':_0x2c319d,'rows':_0x32d8ed}:null;}})[_0x3d6b('0x1e')](respondWithResult(_0x4a2150,null))[_0x3d6b('0x3e')](handleError(_0x4a2150,null));};exports[_0x3d6b('0x4c')]=function(_0x36160a,_0x5e9428,_0x18bc8f){var _0x3133bd={};var _0x516230={};var _0x429c1f;var _0x36685a;return db[_0x3d6b('0x27')][_0x3d6b('0x47')]({'where':{'id':_0x36160a[_0x3d6b('0x40')]['id']}})['then'](handleEntityNotFound(_0x5e9428,null))[_0x3d6b('0x1e')](function(_0x53c591){if(_0x53c591){_0x429c1f=_0x53c591;_0x516230[_0x3d6b('0x2b')]=_['keys'](db[_0x3d6b('0x4d')][_0x3d6b('0x28')]);_0x516230[_0x3d6b('0x2c')]=_[_0x3d6b('0x2d')](_0x36160a[_0x3d6b('0x2c')]);_0x516230['filters']=_['intersection'](_0x516230[_0x3d6b('0x2b')],_0x516230[_0x3d6b('0x2c')]);_0x3133bd[_0x3d6b('0x30')]=_[_0x3d6b('0x41')](_0x516230[_0x3d6b('0x2b')],qs[_0x3d6b('0x2f')](_0x36160a[_0x3d6b('0x2c')][_0x3d6b('0x2f')]));_0x3133bd[_0x3d6b('0x30')]=_0x3133bd[_0x3d6b('0x30')]['length']?_0x3133bd['attributes']:_0x516230[_0x3d6b('0x2b')];_0x3133bd['order']=qs[_0x3d6b('0x35')](_0x36160a[_0x3d6b('0x2c')][_0x3d6b('0x35')]);_0x3133bd['where']=qs[_0x3d6b('0x2e')](_[_0x3d6b('0x36')](_0x36160a[_0x3d6b('0x2c')],_0x516230['filters']));if(_0x36160a[_0x3d6b('0x2c')][_0x3d6b('0x37')]){_0x3133bd[_0x3d6b('0x38')]=_[_0x3d6b('0x39')](_0x3133bd[_0x3d6b('0x38')],{'$or':_['map'](_0x3133bd[_0x3d6b('0x30')],function(_0x39f75a){var _0x4c4a57={};_0x4c4a57[_0x39f75a]={'$like':'%'+_0x36160a['query'][_0x3d6b('0x37')]+'%'};return _0x4c4a57;})});}_0x3133bd=_[_0x3d6b('0x39')]({},_0x3133bd,_0x36160a[_0x3d6b('0x3b')]);return _0x429c1f[_0x3d6b('0x4c')](_0x3133bd);}})['then'](function(_0x34619a){if(_0x34619a){_0x36685a=_0x34619a[_0x3d6b('0x31')];if(!_0x36160a[_0x3d6b('0x2c')]['hasOwnProperty'](_0x3d6b('0x4a'))){_0x3133bd[_0x3d6b('0x33')]=qs[_0x3d6b('0x33')](_0x36160a[_0x3d6b('0x2c')][_0x3d6b('0x33')]);_0x3133bd[_0x3d6b('0x18')]=qs[_0x3d6b('0x18')](_0x36160a[_0x3d6b('0x2c')]['offset']);}return _0x429c1f[_0x3d6b('0x4c')](_0x3133bd);}})[_0x3d6b('0x1e')](function(_0x1ad04e){if(_0x1ad04e){return _0x1ad04e?{'count':_0x36685a,'rows':_0x1ad04e}:null;}})['then'](respondWithResult(_0x5e9428,null))[_0x3d6b('0x3e')](handleError(_0x5e9428,null));};exports[_0x3d6b('0x4e')]=function(_0x944756,_0x55972c,_0x2c315b){if(_0x944756[_0x3d6b('0x45')]['id']){delete _0x944756['body']['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x944756['params']['id']}})[_0x3d6b('0x1e')](handleEntityNotFound(_0x55972c,null))[_0x3d6b('0x1e')](function(_0x1f7d31){if(_0x1f7d31){return _0x1f7d31['setTags'](_0x944756[_0x3d6b('0x45')][_0x3d6b('0x4f')]||[]);}return null;})[_0x3d6b('0x1e')](respondWithResult(_0x55972c,null))[_0x3d6b('0x3e')](handleError(_0x55972c,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index b956a1d..3b591eb 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 _0xdab3=['int_freshdesk_configurations','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x16b362,_0x10f74b){var _0x3556f2=function(_0x5a7eee){while(--_0x5a7eee){_0x16b362['push'](_0x16b362['shift']());}};_0x3556f2(++_0x10f74b);}(_0xdab3,0xc9));var _0x3dab=function(_0x148186,_0x433823){_0x148186=_0x148186-0x0;var _0x2fb5d4=_0xdab3[_0x148186];return _0x2fb5d4;};'use strict';var _=require(_0x3dab('0x0'));var util=require(_0x3dab('0x1'));var logger=require('../../config/logger')(_0x3dab('0x2'));var moment=require(_0x3dab('0x3'));var BPromise=require(_0x3dab('0x4'));var rp=require(_0x3dab('0x5'));var fs=require('fs');var path=require(_0x3dab('0x6'));var rimraf=require('rimraf');var config=require(_0x3dab('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x13fd3b,_0x36f127){return _0x13fd3b[_0x3dab('0x8')]('FreshdeskConfiguration',attributes,{'tableName':_0x3dab('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf03f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x33673f,_0x1a9f86){var _0x172f00=function(_0x942fb5){while(--_0x942fb5){_0x33673f['push'](_0x33673f['shift']());}};_0x172f00(++_0x1a9f86);}(_0xf03f,0x104));var _0xff03=function(_0x9b7a64,_0x38d4a8){_0x9b7a64=_0x9b7a64-0x0;var _0x33fd98=_0xf03f[_0x9b7a64];return _0x33fd98;};'use strict';var _=require(_0xff03('0x0'));var util=require(_0xff03('0x1'));var logger=require(_0xff03('0x2'))(_0xff03('0x3'));var moment=require(_0xff03('0x4'));var BPromise=require(_0xff03('0x5'));var rp=require(_0xff03('0x6'));var fs=require('fs');var path=require(_0xff03('0x7'));var rimraf=require(_0xff03('0x8'));var config=require(_0xff03('0x9'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xff03('0xa')]=function(_0x27e16d,_0x3810c5){return _0x27e16d['define'](_0xff03('0xb'),attributes,{'tableName':_0xff03('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index f37e3d0..9c47b6a 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 _0x85b8=['request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x19416d,_0x54c85e){var _0x17528f=function(_0x29fb3f){while(--_0x29fb3f){_0x19416d['push'](_0x19416d['shift']());}};_0x17528f(++_0x54c85e);}(_0x85b8,0x170));var _0x885b=function(_0x351865,_0x595cbe){_0x351865=_0x351865-0x0;var _0x28e5ff=_0x85b8[_0x351865];return _0x28e5ff;};'use strict';var _=require(_0x885b('0x0'));var util=require(_0x885b('0x1'));var moment=require(_0x885b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x885b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x885b('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x885b('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2079e8,_0x412912,_0x534714){return new BPromise(function(_0x5ed65c,_0x49e49a){return client[_0x885b('0x6')](_0x2079e8,_0x534714)[_0x885b('0x7')](function(_0x336fd2){logger[_0x885b('0x8')](_0x885b('0x9'),_0x412912,_0x885b('0xa'));logger[_0x885b('0xb')](_0x885b('0xc'),_0x412912,_0x885b('0xa'),JSON[_0x885b('0xd')](_0x336fd2));if(_0x336fd2['error']){if(_0x336fd2[_0x885b('0xe')]['code']===0x1f4){logger[_0x885b('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x412912,_0x336fd2[_0x885b('0xe')][_0x885b('0xf')]);return _0x49e49a(_0x336fd2['error']['message']);}logger[_0x885b('0xe')](_0x885b('0x9'),_0x412912,_0x336fd2[_0x885b('0xe')][_0x885b('0xf')]);return _0x5ed65c(_0x336fd2[_0x885b('0xe')][_0x885b('0xf')]);}else{logger[_0x885b('0x8')](_0x885b('0x9'),_0x412912,_0x885b('0xa'));_0x5ed65c(_0x336fd2[_0x885b('0x10')]['message']);}})[_0x885b('0x11')](function(_0x59be6f){logger[_0x885b('0xe')](_0x885b('0x9'),_0x412912,_0x59be6f);_0x49e49a(_0x59be6f);});});} \ No newline at end of file +var _0xe0fa=['result','catch','lodash','randomstring','../../config/logger','jayson/promise','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent'];(function(_0x56d7b2,_0x2ca43e){var _0x4a114c=function(_0x5080bb){while(--_0x5080bb){_0x56d7b2['push'](_0x56d7b2['shift']());}};_0x4a114c(++_0x2ca43e);}(_0xe0fa,0x18e));var _0xae0f=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xe0fa[_0x4ed520];return _0x4415a6;};'use strict';var _=require(_0xae0f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xae0f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xae0f('0x2'))('rpc');var config=require('../../config/environment');var jayson=require(_0xae0f('0x3'));var client=jayson['client'][_0xae0f('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x291dd1,_0xb07dfc,_0x5b1e5d){return new BPromise(function(_0x2ceeb7,_0x4db3bf){return client[_0xae0f('0x5')](_0x291dd1,_0x5b1e5d)[_0xae0f('0x6')](function(_0x15d519){logger['info'](_0xae0f('0x7'),_0xb07dfc,'request\x20sent');logger[_0xae0f('0x8')](_0xae0f('0x9'),_0xb07dfc,'request\x20sent',JSON[_0xae0f('0xa')](_0x15d519));if(_0x15d519[_0xae0f('0xb')]){if(_0x15d519[_0xae0f('0xb')][_0xae0f('0xc')]===0x1f4){logger['error'](_0xae0f('0x7'),_0xb07dfc,_0x15d519['error'][_0xae0f('0xd')]);return _0x4db3bf(_0x15d519[_0xae0f('0xb')][_0xae0f('0xd')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0xb07dfc,_0x15d519[_0xae0f('0xb')][_0xae0f('0xd')]);return _0x2ceeb7(_0x15d519[_0xae0f('0xb')][_0xae0f('0xd')]);}else{logger[_0xae0f('0xe')](_0xae0f('0x7'),_0xb07dfc,_0xae0f('0xf'));_0x2ceeb7(_0x15d519[_0xae0f('0x10')][_0xae0f('0xd')]);}})[_0xae0f('0x11')](function(_0x551103){logger[_0xae0f('0xb')](_0xae0f('0x7'),_0xb07dfc,_0x551103);_0x4db3bf(_0x551103);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index ea2938f..f40abd2 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 _0x9477=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show','create','put','delete','destroy'];(function(_0x1ad9b4,_0x5df9ed){var _0xbbee74=function(_0x39c75f){while(--_0x39c75f){_0x1ad9b4['push'](_0x1ad9b4['shift']());}};_0xbbee74(++_0x5df9ed);}(_0x9477,0x131));var _0x7947=function(_0x34817e,_0x51822d){_0x34817e=_0x34817e-0x0;var _0x1dc422=_0x9477[_0x34817e];return _0x1dc422;};'use strict';var multer=require(_0x7947('0x0'));var util=require(_0x7947('0x1'));var path=require(_0x7947('0x2'));var timeout=require('connect-timeout');var express=require(_0x7947('0x3'));var router=express[_0x7947('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7947('0x5'));var interaction=require(_0x7947('0x6'));var config=require(_0x7947('0x7'));var controller=require(_0x7947('0x8'));router['get']('/',auth[_0x7947('0x9')](),controller[_0x7947('0xa')]);router[_0x7947('0xb')](_0x7947('0xc'),auth[_0x7947('0x9')](),controller[_0x7947('0xd')]);router['post']('/',auth[_0x7947('0x9')](),controller[_0x7947('0xe')]);router[_0x7947('0xf')](_0x7947('0xc'),auth[_0x7947('0x9')](),controller['update']);router[_0x7947('0x10')](_0x7947('0xc'),auth['isAuthenticated'](),controller[_0x7947('0x11')]);module[_0x7947('0x12')]=router; \ No newline at end of file +var _0x958a=['get','isAuthenticated','/:id','show','create','update','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x958a,0x138));var _0xa958=function(_0x5870af,_0x1b8655){_0x5870af=_0x5870af-0x0;var _0xe14a42=_0x958a[_0x5870af];return _0xe14a42;};'use strict';var multer=require('multer');var util=require(_0xa958('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa958('0x1'));var router=express[_0xa958('0x2')]();var fs_extra=require(_0xa958('0x3'));var auth=require(_0xa958('0x4'));var interaction=require(_0xa958('0x5'));var config=require(_0xa958('0x6'));var controller=require(_0xa958('0x7'));router[_0xa958('0x8')]('/',auth[_0xa958('0x9')](),controller['index']);router[_0xa958('0x8')](_0xa958('0xa'),auth[_0xa958('0x9')](),controller[_0xa958('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa958('0xc')]);router['put'](_0xa958('0xa'),auth[_0xa958('0x9')](),controller[_0xa958('0xd')]);router['delete'](_0xa958('0xa'),auth[_0xa958('0x9')](),controller[_0xa958('0xe')]);module[_0xa958('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 7d635fb..6b61a0d 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 _0x45d2=['exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x45d2,0xb3));var _0x245d=function(_0x168af2,_0x6a246){_0x168af2=_0x168af2-0x0;var _0x5dba52=_0x45d2[_0x168af2];return _0x5dba52;};'use strict';var Sequelize=require(_0x245d('0x0'));module[_0x245d('0x1')]={'type':{'type':Sequelize[_0x245d('0x2')](_0x245d('0x3'),_0x245d('0x4'),_0x245d('0x5'),'keyValue',_0x245d('0x6')),'defaultValue':_0x245d('0x3')},'content':{'type':Sequelize[_0x245d('0x7')]},'key':{'type':Sequelize[_0x245d('0x7')]},'keyType':{'type':Sequelize[_0x245d('0x2')](_0x245d('0x3'),_0x245d('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x245d('0x7')]},'idField':{'type':Sequelize[_0x245d('0x7')]},'nameField':{'type':Sequelize[_0x245d('0x7')]},'customField':{'type':Sequelize[_0x245d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x245d('0x7')]}}; \ No newline at end of file +var _0x37de=['sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN'];(function(_0x5a2340,_0x3b7fad){var _0x1c5331=function(_0x3972db){while(--_0x3972db){_0x5a2340['push'](_0x5a2340['shift']());}};_0x1c5331(++_0x3b7fad);}(_0x37de,0x144));var _0xe37d=function(_0x20048c,_0x337690){_0x20048c=_0x20048c-0x0;var _0x1d7f4b=_0x37de[_0x20048c];return _0x1d7f4b;};'use strict';var Sequelize=require(_0xe37d('0x0'));module[_0xe37d('0x1')]={'type':{'type':Sequelize[_0xe37d('0x2')](_0xe37d('0x3'),_0xe37d('0x4'),_0xe37d('0x5'),'keyValue',_0xe37d('0x6')),'defaultValue':_0xe37d('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xe37d('0x7')]},'keyType':{'type':Sequelize[_0xe37d('0x2')]('string',_0xe37d('0x4'),_0xe37d('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe37d('0x7')]},'nameField':{'type':Sequelize[_0xe37d('0x7')]},'customField':{'type':Sequelize[_0xe37d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 8f674c4..46f2602 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 _0x6b24=['rawAttributes','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','options','includeAll','findAll','rows','catch','include','merge','find','create','body','destroy','params','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','FreshdeskField'];(function(_0x51e57f,_0x57f18f){var _0x56b72f=function(_0x6d96a7){while(--_0x6d96a7){_0x51e57f['push'](_0x51e57f['shift']());}};_0x56b72f(++_0x57f18f);}(_0x6b24,0x1ce));var _0x46b2=function(_0x549d16,_0x4d069a){_0x549d16=_0x549d16-0x0;var _0x344ccc=_0x6b24[_0x549d16];return _0x344ccc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x46b2('0x0'));var zipdir=require(_0x46b2('0x1'));var jsonpatch=require(_0x46b2('0x2'));var rp=require(_0x46b2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x46b2('0x4'));var path=require('path');var sox=require(_0x46b2('0x5'));var csv=require('to-csv');var ejs=require(_0x46b2('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x46b2('0x7'));var crypto=require(_0x46b2('0x8'));var jsforce=require(_0x46b2('0x9'));var deskjs=require(_0x46b2('0xa'));var toCsv=require(_0x46b2('0xb'));var querystring=require(_0x46b2('0xc'));var Papa=require(_0x46b2('0xd'));var Redis=require(_0x46b2('0xe'));var authService=require(_0x46b2('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x46b2('0x10'));var logger=require(_0x46b2('0x11'))(_0x46b2('0x12'));var utils=require('../../config/utils');var config=require(_0x46b2('0x13'));var licenseUtil=require(_0x46b2('0x14'));var db=require(_0x46b2('0x15'))['db'];function respondWithStatusCode(_0x5343fc,_0x468ae9){_0x468ae9=_0x468ae9||0xcc;return function(_0x886e41){if(_0x886e41){return _0x5343fc[_0x46b2('0x16')](_0x468ae9);}return _0x5343fc[_0x46b2('0x17')](_0x468ae9)[_0x46b2('0x18')]();};}function respondWithResult(_0x1cf0f0,_0x3ff25d){_0x3ff25d=_0x3ff25d||0xc8;return function(_0x228261){if(_0x228261){return _0x1cf0f0[_0x46b2('0x17')](_0x3ff25d)[_0x46b2('0x19')](_0x228261);}};}function respondWithFilteredResult(_0x563b05,_0x43e0d9){return function(_0x5b49da){if(_0x5b49da){var _0x49479c=typeof _0x43e0d9[_0x46b2('0x1a')]===_0x46b2('0x1b')&&typeof _0x43e0d9[_0x46b2('0x1c')]===_0x46b2('0x1b');var _0x373c49=_0x5b49da[_0x46b2('0x1d')];var _0x226ab5=_0x49479c?0x0:_0x43e0d9['offset'];var _0x316c39=_0x49479c?_0x5b49da['count']:_0x43e0d9[_0x46b2('0x1a')]+_0x43e0d9[_0x46b2('0x1c')];var _0x9b4723;if(_0x316c39>=_0x373c49){_0x316c39=_0x373c49;_0x9b4723=0xc8;}else{_0x9b4723=0xce;}_0x563b05['status'](_0x9b4723);return _0x563b05[_0x46b2('0x1e')](_0x46b2('0x1f'),_0x226ab5+'-'+_0x316c39+'/'+_0x373c49)[_0x46b2('0x19')](_0x5b49da);}return null;};}function patchUpdates(_0x1e5c35){return function(_0x350f85){try{jsonpatch[_0x46b2('0x20')](_0x350f85,_0x1e5c35,!![]);}catch(_0x3a0ea5){return BPromise[_0x46b2('0x21')](_0x3a0ea5);}return _0x350f85[_0x46b2('0x22')]();};}function saveUpdates(_0x259f2f,_0x29ade9){return function(_0x1b5fbe){if(_0x1b5fbe){return _0x1b5fbe[_0x46b2('0x23')](_0x259f2f)[_0x46b2('0x24')](function(_0x1caa77){return _0x1caa77;});}return null;};}function removeEntity(_0x50011b,_0x209519){return function(_0x4c2983){if(_0x4c2983){return _0x4c2983['destroy']()[_0x46b2('0x24')](function(){_0x50011b[_0x46b2('0x17')](0xcc)[_0x46b2('0x18')]();});}};}function handleEntityNotFound(_0x134526,_0x16f646){return function(_0x58069e){if(!_0x58069e){_0x134526[_0x46b2('0x16')](0x194);}return _0x58069e;};}function handleError(_0x138f6c,_0x5ca1c7){_0x5ca1c7=_0x5ca1c7||0x1f4;return function(_0x3c5997){logger['error'](_0x3c5997[_0x46b2('0x25')]);if(_0x3c5997[_0x46b2('0x26')]){delete _0x3c5997[_0x46b2('0x26')];}_0x138f6c[_0x46b2('0x17')](_0x5ca1c7)[_0x46b2('0x27')](_0x3c5997);};}exports[_0x46b2('0x28')]=function(_0x74615,_0x1a6caf){var _0x429496={},_0x20ccb2={},_0x5421d9={'count':0x0,'rows':[]};var _0x4e2a9b=_['map'](db[_0x46b2('0x29')][_0x46b2('0x2a')],function(_0x2a2f8d){return{'name':_0x2a2f8d['fieldName'],'type':_0x2a2f8d[_0x46b2('0x2b')][_0x46b2('0x2c')]};});_0x20ccb2['model']=_[_0x46b2('0x2d')](_0x4e2a9b,_0x46b2('0x26'));_0x20ccb2[_0x46b2('0x2e')]=_[_0x46b2('0x2f')](_0x74615[_0x46b2('0x2e')]);_0x20ccb2[_0x46b2('0x30')]=_[_0x46b2('0x31')](_0x20ccb2[_0x46b2('0x32')],_0x20ccb2[_0x46b2('0x2e')]);_0x429496['attributes']=_[_0x46b2('0x31')](_0x20ccb2[_0x46b2('0x32')],qs[_0x46b2('0x33')](_0x74615['query'][_0x46b2('0x33')]));_0x429496[_0x46b2('0x34')]=_0x429496[_0x46b2('0x34')][_0x46b2('0x35')]?_0x429496['attributes']:_0x20ccb2[_0x46b2('0x32')];if(!_0x74615['query'][_0x46b2('0x36')](_0x46b2('0x37'))){_0x429496[_0x46b2('0x1c')]=qs[_0x46b2('0x1c')](_0x74615[_0x46b2('0x2e')][_0x46b2('0x1c')]);_0x429496[_0x46b2('0x1a')]=qs['offset'](_0x74615[_0x46b2('0x2e')][_0x46b2('0x1a')]);}_0x429496[_0x46b2('0x38')]=qs[_0x46b2('0x39')](_0x74615[_0x46b2('0x2e')][_0x46b2('0x39')]);_0x429496[_0x46b2('0x3a')]=qs['filters'](_['pick'](_0x74615['query'],_0x20ccb2[_0x46b2('0x30')]),_0x4e2a9b);if(_0x74615[_0x46b2('0x2e')]['filter']){_0x429496[_0x46b2('0x3a')]=_['merge'](_0x429496['where'],{'$or':_[_0x46b2('0x2d')](_0x4e2a9b,function(_0x1716a3){if(_0x1716a3[_0x46b2('0x2b')]!==_0x46b2('0x3b')){var _0x4dcd03={};_0x4dcd03[_0x1716a3[_0x46b2('0x26')]]={'$like':'%'+_0x74615['query']['filter']+'%'};return _0x4dcd03;}})});}_0x429496=_['merge']({},_0x429496,_0x74615[_0x46b2('0x3c')]);var _0x1599fa={'where':_0x429496[_0x46b2('0x3a')]};return db['FreshdeskField'][_0x46b2('0x1d')](_0x1599fa)['then'](function(_0x30afdb){_0x5421d9[_0x46b2('0x1d')]=_0x30afdb;if(_0x74615['query'][_0x46b2('0x3d')]){_0x429496['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x46b2('0x3e')](_0x429496);})['then'](function(_0x22c896){_0x5421d9[_0x46b2('0x3f')]=_0x22c896;return _0x5421d9;})[_0x46b2('0x24')](respondWithFilteredResult(_0x1a6caf,_0x429496))[_0x46b2('0x40')](handleError(_0x1a6caf,null));};exports['show']=function(_0x15451a,_0x13343e){var _0x205027={'raw':!![],'where':{'id':_0x15451a['params']['id']}},_0x4fdfeb={};_0x4fdfeb[_0x46b2('0x32')]=_[_0x46b2('0x2f')](db[_0x46b2('0x29')][_0x46b2('0x2a')]);_0x4fdfeb['query']=_['keys'](_0x15451a[_0x46b2('0x2e')]);_0x4fdfeb[_0x46b2('0x30')]=_[_0x46b2('0x31')](_0x4fdfeb[_0x46b2('0x32')],_0x4fdfeb[_0x46b2('0x2e')]);_0x205027[_0x46b2('0x34')]=_['intersection'](_0x4fdfeb['model'],qs[_0x46b2('0x33')](_0x15451a[_0x46b2('0x2e')][_0x46b2('0x33')]));_0x205027[_0x46b2('0x34')]=_0x205027['attributes'][_0x46b2('0x35')]?_0x205027[_0x46b2('0x34')]:_0x4fdfeb[_0x46b2('0x32')];if(_0x15451a[_0x46b2('0x2e')]['includeAll']){_0x205027[_0x46b2('0x41')]=[{'all':!![]}];}_0x205027=_[_0x46b2('0x42')]({},_0x205027,_0x15451a[_0x46b2('0x3c')]);return db[_0x46b2('0x29')][_0x46b2('0x43')](_0x205027)[_0x46b2('0x24')](handleEntityNotFound(_0x13343e,null))[_0x46b2('0x24')](respondWithResult(_0x13343e,null))['catch'](handleError(_0x13343e,null));};exports[_0x46b2('0x44')]=function(_0x14cdc9,_0x55c0aa){return db[_0x46b2('0x29')]['create'](_0x14cdc9[_0x46b2('0x45')],{})['then'](respondWithResult(_0x55c0aa,0xc9))[_0x46b2('0x40')](handleError(_0x55c0aa,null));};exports[_0x46b2('0x23')]=function(_0x4f8bd6,_0x301c64){if(_0x4f8bd6[_0x46b2('0x45')]['id']){delete _0x4f8bd6['body']['id'];}return db['FreshdeskField'][_0x46b2('0x43')]({'where':{'id':_0x4f8bd6['params']['id']}})[_0x46b2('0x24')](handleEntityNotFound(_0x301c64,null))['then'](saveUpdates(_0x4f8bd6[_0x46b2('0x45')],null))[_0x46b2('0x24')](respondWithResult(_0x301c64,null))[_0x46b2('0x40')](handleError(_0x301c64,null));};exports[_0x46b2('0x46')]=function(_0x27a9cf,_0x251c28){return db[_0x46b2('0x29')][_0x46b2('0x43')]({'where':{'id':_0x27a9cf[_0x46b2('0x47')]['id']}})[_0x46b2('0x24')](handleEntityNotFound(_0x251c28,null))[_0x46b2('0x24')](removeEntity(_0x251c28,null))[_0x46b2('0x40')](handleError(_0x251c28,null));}; \ No newline at end of file +var _0x1306=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','type','VIRTUAL','filter','then','includeAll','include','findAll','rows','show','params','keys','length','options','find','catch','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x1306,0x17a));var _0x6130=function(_0x1d1c3a,_0x257980){_0x1d1c3a=_0x1d1c3a-0x0;var _0x352825=_0x1306[_0x1d1c3a];return _0x352825;};'use strict';var emlformat=require(_0x6130('0x0'));var rimraf=require(_0x6130('0x1'));var zipdir=require(_0x6130('0x2'));var jsonpatch=require(_0x6130('0x3'));var rp=require(_0x6130('0x4'));var moment=require(_0x6130('0x5'));var BPromise=require(_0x6130('0x6'));var Mustache=require(_0x6130('0x7'));var util=require(_0x6130('0x8'));var path=require(_0x6130('0x9'));var sox=require(_0x6130('0xa'));var csv=require(_0x6130('0xb'));var ejs=require(_0x6130('0xc'));var fs=require('fs');var fs_extra=require(_0x6130('0xd'));var _=require(_0x6130('0xe'));var squel=require(_0x6130('0xf'));var crypto=require(_0x6130('0x10'));var jsforce=require(_0x6130('0x11'));var deskjs=require(_0x6130('0x12'));var toCsv=require(_0x6130('0xb'));var querystring=require(_0x6130('0x13'));var Papa=require(_0x6130('0x14'));var Redis=require(_0x6130('0x15'));var authService=require(_0x6130('0x16'));var qs=require(_0x6130('0x17'));var as=require(_0x6130('0x18'));var hardwareService=require(_0x6130('0x19'));var logger=require(_0x6130('0x1a'))(_0x6130('0x1b'));var utils=require('../../config/utils');var config=require(_0x6130('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x6130('0x1d'))['db'];function respondWithStatusCode(_0x2fbf3d,_0x5e0234){_0x5e0234=_0x5e0234||0xcc;return function(_0x1c0339){if(_0x1c0339){return _0x2fbf3d[_0x6130('0x1e')](_0x5e0234);}return _0x2fbf3d[_0x6130('0x1f')](_0x5e0234)[_0x6130('0x20')]();};}function respondWithResult(_0x1d736c,_0x3470e8){_0x3470e8=_0x3470e8||0xc8;return function(_0x4cdac6){if(_0x4cdac6){return _0x1d736c[_0x6130('0x1f')](_0x3470e8)[_0x6130('0x21')](_0x4cdac6);}};}function respondWithFilteredResult(_0x3ef4c1,_0x401a70){return function(_0x4626a2){if(_0x4626a2){var _0x39b444=typeof _0x401a70[_0x6130('0x22')]===_0x6130('0x23')&&typeof _0x401a70[_0x6130('0x24')]==='undefined';var _0x4b9a20=_0x4626a2[_0x6130('0x25')];var _0x49803e=_0x39b444?0x0:_0x401a70[_0x6130('0x22')];var _0xb6575d=_0x39b444?_0x4626a2[_0x6130('0x25')]:_0x401a70[_0x6130('0x22')]+_0x401a70[_0x6130('0x24')];var _0x4b4b35;if(_0xb6575d>=_0x4b9a20){_0xb6575d=_0x4b9a20;_0x4b4b35=0xc8;}else{_0x4b4b35=0xce;}_0x3ef4c1[_0x6130('0x1f')](_0x4b4b35);return _0x3ef4c1['set'](_0x6130('0x26'),_0x49803e+'-'+_0xb6575d+'/'+_0x4b9a20)[_0x6130('0x21')](_0x4626a2);}return null;};}function patchUpdates(_0x18bb78){return function(_0x1839db){try{jsonpatch[_0x6130('0x27')](_0x1839db,_0x18bb78,!![]);}catch(_0x5c8b08){return BPromise['reject'](_0x5c8b08);}return _0x1839db[_0x6130('0x28')]();};}function saveUpdates(_0x534390,_0x30b4f2){return function(_0x289c7b){if(_0x289c7b){return _0x289c7b['update'](_0x534390)['then'](function(_0x54fc67){return _0x54fc67;});}return null;};}function removeEntity(_0x2a8aad,_0x5369e3){return function(_0x371b84){if(_0x371b84){return _0x371b84['destroy']()['then'](function(){_0x2a8aad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5069bf,_0x140468){return function(_0x1ba07d){if(!_0x1ba07d){_0x5069bf['sendStatus'](0x194);}return _0x1ba07d;};}function handleError(_0x188657,_0x552c54){_0x552c54=_0x552c54||0x1f4;return function(_0x306935){logger['error'](_0x306935['stack']);if(_0x306935[_0x6130('0x29')]){delete _0x306935[_0x6130('0x29')];}_0x188657[_0x6130('0x1f')](_0x552c54)[_0x6130('0x2a')](_0x306935);};}exports[_0x6130('0x2b')]=function(_0x392386,_0x2aa0e3){var _0x19eb47={},_0x14dff0={},_0x5809e4={'count':0x0,'rows':[]};var _0x5363cc=_[_0x6130('0x2c')](db[_0x6130('0x2d')][_0x6130('0x2e')],function(_0x4345ac){return{'name':_0x4345ac[_0x6130('0x2f')],'type':_0x4345ac['type'][_0x6130('0x30')]};});_0x14dff0[_0x6130('0x31')]=_[_0x6130('0x2c')](_0x5363cc,_0x6130('0x29'));_0x14dff0[_0x6130('0x32')]=_['keys'](_0x392386[_0x6130('0x32')]);_0x14dff0[_0x6130('0x33')]=_[_0x6130('0x34')](_0x14dff0['model'],_0x14dff0[_0x6130('0x32')]);_0x19eb47[_0x6130('0x35')]=_[_0x6130('0x34')](_0x14dff0[_0x6130('0x31')],qs[_0x6130('0x36')](_0x392386[_0x6130('0x32')][_0x6130('0x36')]));_0x19eb47[_0x6130('0x35')]=_0x19eb47[_0x6130('0x35')]['length']?_0x19eb47[_0x6130('0x35')]:_0x14dff0['model'];if(!_0x392386['query']['hasOwnProperty'](_0x6130('0x37'))){_0x19eb47[_0x6130('0x24')]=qs[_0x6130('0x24')](_0x392386[_0x6130('0x32')][_0x6130('0x24')]);_0x19eb47[_0x6130('0x22')]=qs[_0x6130('0x22')](_0x392386[_0x6130('0x32')]['offset']);}_0x19eb47[_0x6130('0x38')]=qs[_0x6130('0x39')](_0x392386['query'][_0x6130('0x39')]);_0x19eb47[_0x6130('0x3a')]=qs[_0x6130('0x33')](_['pick'](_0x392386[_0x6130('0x32')],_0x14dff0[_0x6130('0x33')]),_0x5363cc);if(_0x392386['query']['filter']){_0x19eb47[_0x6130('0x3a')]=_[_0x6130('0x3b')](_0x19eb47[_0x6130('0x3a')],{'$or':_['map'](_0x5363cc,function(_0x596c98){if(_0x596c98[_0x6130('0x3c')]!==_0x6130('0x3d')){var _0x3c6aac={};_0x3c6aac[_0x596c98[_0x6130('0x29')]]={'$like':'%'+_0x392386[_0x6130('0x32')][_0x6130('0x3e')]+'%'};return _0x3c6aac;}})});}_0x19eb47=_[_0x6130('0x3b')]({},_0x19eb47,_0x392386['options']);var _0x45bfe0={'where':_0x19eb47[_0x6130('0x3a')]};return db[_0x6130('0x2d')][_0x6130('0x25')](_0x45bfe0)[_0x6130('0x3f')](function(_0x3249f2){_0x5809e4[_0x6130('0x25')]=_0x3249f2;if(_0x392386['query'][_0x6130('0x40')]){_0x19eb47[_0x6130('0x41')]=[{'all':!![]}];}return db[_0x6130('0x2d')][_0x6130('0x42')](_0x19eb47);})[_0x6130('0x3f')](function(_0x142385){_0x5809e4[_0x6130('0x43')]=_0x142385;return _0x5809e4;})[_0x6130('0x3f')](respondWithFilteredResult(_0x2aa0e3,_0x19eb47))['catch'](handleError(_0x2aa0e3,null));};exports[_0x6130('0x44')]=function(_0x154891,_0x6eebc6){var _0x4c727b={'raw':!![],'where':{'id':_0x154891[_0x6130('0x45')]['id']}},_0x176506={};_0x176506[_0x6130('0x31')]=_['keys'](db['FreshdeskField'][_0x6130('0x2e')]);_0x176506[_0x6130('0x32')]=_[_0x6130('0x46')](_0x154891[_0x6130('0x32')]);_0x176506[_0x6130('0x33')]=_['intersection'](_0x176506[_0x6130('0x31')],_0x176506[_0x6130('0x32')]);_0x4c727b['attributes']=_[_0x6130('0x34')](_0x176506[_0x6130('0x31')],qs[_0x6130('0x36')](_0x154891[_0x6130('0x32')][_0x6130('0x36')]));_0x4c727b[_0x6130('0x35')]=_0x4c727b[_0x6130('0x35')][_0x6130('0x47')]?_0x4c727b['attributes']:_0x176506['model'];if(_0x154891[_0x6130('0x32')]['includeAll']){_0x4c727b[_0x6130('0x41')]=[{'all':!![]}];}_0x4c727b=_[_0x6130('0x3b')]({},_0x4c727b,_0x154891[_0x6130('0x48')]);return db[_0x6130('0x2d')][_0x6130('0x49')](_0x4c727b)[_0x6130('0x3f')](handleEntityNotFound(_0x6eebc6,null))[_0x6130('0x3f')](respondWithResult(_0x6eebc6,null))[_0x6130('0x4a')](handleError(_0x6eebc6,null));};exports[_0x6130('0x4b')]=function(_0x19dcb7,_0x3936a8){return db['FreshdeskField'][_0x6130('0x4b')](_0x19dcb7[_0x6130('0x4c')],{})[_0x6130('0x3f')](respondWithResult(_0x3936a8,0xc9))[_0x6130('0x4a')](handleError(_0x3936a8,null));};exports[_0x6130('0x4d')]=function(_0x13f591,_0x35939b){if(_0x13f591[_0x6130('0x4c')]['id']){delete _0x13f591[_0x6130('0x4c')]['id'];}return db[_0x6130('0x2d')]['find']({'where':{'id':_0x13f591[_0x6130('0x45')]['id']}})[_0x6130('0x3f')](handleEntityNotFound(_0x35939b,null))[_0x6130('0x3f')](saveUpdates(_0x13f591[_0x6130('0x4c')],null))[_0x6130('0x3f')](respondWithResult(_0x35939b,null))[_0x6130('0x4a')](handleError(_0x35939b,null));};exports[_0x6130('0x4e')]=function(_0x37ee0c,_0x3a64ef){return db['FreshdeskField'][_0x6130('0x49')]({'where':{'id':_0x37ee0c[_0x6130('0x45')]['id']}})[_0x6130('0x3f')](handleEntityNotFound(_0x3a64ef,null))[_0x6130('0x3f')](removeEntity(_0x3a64ef,null))[_0x6130('0x4a')](handleError(_0x3a64ef,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 734b5f5..3d3194d 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 _0x98f3=['moment','bluebird','path','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0x15876a,_0x15383d){var _0xbd900f=function(_0x103e59){while(--_0x103e59){_0x15876a['push'](_0x15876a['shift']());}};_0xbd900f(++_0x15383d);}(_0x98f3,0x1a1));var _0x398f=function(_0x4ec119,_0x5e20f7){_0x4ec119=_0x4ec119-0x0;var _0x1f45a9=_0x98f3[_0x4ec119];return _0x1f45a9;};'use strict';var _=require(_0x398f('0x0'));var util=require('util');var logger=require(_0x398f('0x1'))(_0x398f('0x2'));var moment=require(_0x398f('0x3'));var BPromise=require(_0x398f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x398f('0x5'));var rimraf=require('rimraf');var config=require(_0x398f('0x6'));var attributes=require(_0x398f('0x7'));module[_0x398f('0x8')]=function(_0x157d06,_0x55137d){return _0x157d06[_0x398f('0x9')](_0x398f('0xa'),attributes,{'tableName':_0x398f('0xb'),'paranoid':![],'indexes':[{'name':_0x398f('0xc'),'fields':[_0x398f('0xd'),_0x398f('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa58e=['util','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','define','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash'];(function(_0x43a6cd,_0x503d1a){var _0x5acb36=function(_0x2dd95e){while(--_0x2dd95e){_0x43a6cd['push'](_0x43a6cd['shift']());}};_0x5acb36(++_0x503d1a);}(_0xa58e,0x1d3));var _0xea58=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa58e[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xea58('0x0'));var util=require(_0xea58('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xea58('0x2'));var fs=require('fs');var path=require(_0xea58('0x3'));var rimraf=require(_0xea58('0x4'));var config=require(_0xea58('0x5'));var attributes=require(_0xea58('0x6'));module['exports']=function(_0x34d83f,_0x56968f){return _0x34d83f[_0xea58('0x7')]('FreshdeskField',attributes,{'tableName':_0xea58('0x8'),'paranoid':![],'indexes':[{'name':_0xea58('0x9'),'fields':[_0xea58('0xa'),_0xea58('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index fb87515..695a8a6 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 _0x3dd9=['error','code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x629c83,_0x367800){var _0x315d48=function(_0x571bb9){while(--_0x571bb9){_0x629c83['push'](_0x629c83['shift']());}};_0x315d48(++_0x367800);}(_0x3dd9,0x13d));var _0x93dd=function(_0x315132,_0x56952d){_0x315132=_0x315132-0x0;var _0x5aa6ec=_0x3dd9[_0x315132];return _0x5aa6ec;};'use strict';var _=require(_0x93dd('0x0'));var util=require(_0x93dd('0x1'));var moment=require(_0x93dd('0x2'));var BPromise=require('bluebird');var rs=require(_0x93dd('0x3'));var fs=require('fs');var Redis=require(_0x93dd('0x4'));var db=require(_0x93dd('0x5'))['db'];var utils=require(_0x93dd('0x6'));var logger=require(_0x93dd('0x7'))(_0x93dd('0x8'));var config=require('../../config/environment');var jayson=require(_0x93dd('0x9'));var client=jayson[_0x93dd('0xa')][_0x93dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45d556,_0x4eaac1,_0x4339d2){return new BPromise(function(_0x3ec25e,_0x47a224){return client[_0x93dd('0xc')](_0x45d556,_0x4339d2)[_0x93dd('0xd')](function(_0x5386e0){logger['info'](_0x93dd('0xe'),_0x4eaac1,_0x93dd('0xf'));logger[_0x93dd('0x10')](_0x93dd('0x11'),_0x4eaac1,_0x93dd('0xf'),JSON[_0x93dd('0x12')](_0x5386e0));if(_0x5386e0['error']){if(_0x5386e0[_0x93dd('0x13')][_0x93dd('0x14')]===0x1f4){logger['error'](_0x93dd('0xe'),_0x4eaac1,_0x5386e0[_0x93dd('0x13')][_0x93dd('0x15')]);return _0x47a224(_0x5386e0[_0x93dd('0x13')][_0x93dd('0x15')]);}logger[_0x93dd('0x13')](_0x93dd('0xe'),_0x4eaac1,_0x5386e0['error']['message']);return _0x3ec25e(_0x5386e0[_0x93dd('0x13')][_0x93dd('0x15')]);}else{logger[_0x93dd('0x16')]('FreshdeskField,\x20%s,\x20%s',_0x4eaac1,'request\x20sent');_0x3ec25e(_0x5386e0['result']['message']);}})[_0x93dd('0x17')](function(_0x54fc2f){logger[_0x93dd('0x13')](_0x93dd('0xe'),_0x4eaac1,_0x54fc2f);_0x47a224(_0x54fc2f);});});} \ No newline at end of file +var _0xbf06=['../../config/environment','jayson/promise','client','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x159cb0,_0x4c9113){var _0x250c11=function(_0x25e1ea){while(--_0x25e1ea){_0x159cb0['push'](_0x159cb0['shift']());}};_0x250c11(++_0x4c9113);}(_0xbf06,0x101));var _0x6bf0=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xbf06[_0x4ea69d];return _0x5318e0;};'use strict';var _=require('lodash');var util=require(_0x6bf0('0x0'));var moment=require(_0x6bf0('0x1'));var BPromise=require(_0x6bf0('0x2'));var rs=require(_0x6bf0('0x3'));var fs=require('fs');var Redis=require(_0x6bf0('0x4'));var db=require(_0x6bf0('0x5'))['db'];var utils=require(_0x6bf0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6bf0('0x7'));var jayson=require(_0x6bf0('0x8'));var client=jayson[_0x6bf0('0x9')][_0x6bf0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fc26f,_0x77d107,_0x29f59d){return new BPromise(function(_0x1db2a7,_0xfa0ba8){return client[_0x6bf0('0xb')](_0x4fc26f,_0x29f59d)['then'](function(_0x3a3e12){logger[_0x6bf0('0xc')](_0x6bf0('0xd'),_0x77d107,_0x6bf0('0xe'));logger[_0x6bf0('0xf')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x77d107,'request\x20sent',JSON[_0x6bf0('0x10')](_0x3a3e12));if(_0x3a3e12[_0x6bf0('0x11')]){if(_0x3a3e12[_0x6bf0('0x11')][_0x6bf0('0x12')]===0x1f4){logger[_0x6bf0('0x11')](_0x6bf0('0xd'),_0x77d107,_0x3a3e12[_0x6bf0('0x11')][_0x6bf0('0x13')]);return _0xfa0ba8(_0x3a3e12[_0x6bf0('0x11')]['message']);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x77d107,_0x3a3e12['error'][_0x6bf0('0x13')]);return _0x1db2a7(_0x3a3e12[_0x6bf0('0x11')][_0x6bf0('0x13')]);}else{logger[_0x6bf0('0xc')](_0x6bf0('0xd'),_0x77d107,_0x6bf0('0xe'));_0x1db2a7(_0x3a3e12[_0x6bf0('0x14')]['message']);}})[_0x6bf0('0x15')](function(_0x3e0b2b){logger[_0x6bf0('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x77d107,_0x3e0b2b);_0xfa0ba8(_0x3e0b2b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index a984f2f..25cc92a 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 _0x1339=['/:id/configurations','getConfigurations','/:id/fields','post','create','put','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x379247,_0x24070c){var _0x4a217b=function(_0xdb077a){while(--_0xdb077a){_0x379247['push'](_0x379247['shift']());}};_0x4a217b(++_0x24070c);}(_0x1339,0x1ed));var _0x9133=function(_0x4624b8,_0x275983){_0x4624b8=_0x4624b8-0x0;var _0x1fd678=_0x1339[_0x4624b8];return _0x1fd678;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9133('0x0'));var timeout=require(_0x9133('0x1'));var express=require(_0x9133('0x2'));var router=express[_0x9133('0x3')]();var fs_extra=require(_0x9133('0x4'));var auth=require(_0x9133('0x5'));var interaction=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0x9133('0x8')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0xa')]);router['get'](_0x9133('0xb'),auth[_0x9133('0x9')](),controller[_0x9133('0xc')]);router[_0x9133('0x8')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller[_0x9133('0xe')]);router[_0x9133('0x8')](_0x9133('0xf'),auth[_0x9133('0x9')](),controller['getFields']);router[_0x9133('0x10')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0x11')]);router[_0x9133('0x10')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller['addConfiguration']);router[_0x9133('0x12')](_0x9133('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x9133('0x13')]('/:id',auth[_0x9133('0x9')](),controller[_0x9133('0x14')]);module[_0x9133('0x15')]=router; \ No newline at end of file +var _0x9348=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x532d78,_0x25b6a8){var _0x5990c4=function(_0x3f23fe){while(--_0x3f23fe){_0x532d78['push'](_0x532d78['shift']());}};_0x5990c4(++_0x25b6a8);}(_0x9348,0x10d));var _0x8934=function(_0x5d60a8,_0x5db4ad){_0x5d60a8=_0x5d60a8-0x0;var _0x32cc7a=_0x9348[_0x5d60a8];return _0x32cc7a;};'use strict';var multer=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var path=require(_0x8934('0x2'));var timeout=require(_0x8934('0x3'));var express=require(_0x8934('0x4'));var router=express['Router']();var fs_extra=require(_0x8934('0x5'));var auth=require(_0x8934('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8934('0x7'));var controller=require(_0x8934('0x8'));router[_0x8934('0x9')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0xb')]);router[_0x8934('0x9')]('/:id',auth[_0x8934('0xa')](),controller[_0x8934('0xc')]);router[_0x8934('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x8934('0xd'),auth['isAuthenticated'](),controller[_0x8934('0xe')]);router[_0x8934('0xf')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0x10')]);router[_0x8934('0xf')](_0x8934('0x11'),auth[_0x8934('0xa')](),controller[_0x8934('0x12')]);router['put'](_0x8934('0x13'),auth[_0x8934('0xa')](),controller[_0x8934('0x14')]);router[_0x8934('0x15')](_0x8934('0x13'),auth[_0x8934('0xa')](),controller['destroy']);module[_0x8934('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index fc81fb6..e5eb447 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 _0xfef3=['sequelize','STRING','username','remoteUri'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xfef3,0x118));var _0x3fef=function(_0x306902,_0x15482c){_0x306902=_0x306902-0x0;var _0x3d6f3c=_0xfef3[_0x306902];return _0x3d6f3c;};'use strict';var Sequelize=require(_0x3fef('0x0'));module['exports']={'name':{'type':Sequelize[_0x3fef('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3fef('0x1')],'unique':_0x3fef('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3fef('0x1')],'unique':_0x3fef('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x1399=['exports','STRING','username','remoteUri','sequelize'];(function(_0x5756c6,_0x58290a){var _0x4b5806=function(_0x193246){while(--_0x193246){_0x5756c6['push'](_0x5756c6['shift']());}};_0x4b5806(++_0x58290a);}(_0x1399,0x16c));var _0x9139=function(_0x14dcc5,_0x163ab7){_0x14dcc5=_0x14dcc5-0x0;var _0x35d6cc=_0x1399[_0x14dcc5];return _0x35d6cc;};'use strict';var Sequelize=require(_0x9139('0x0'));module[_0x9139('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9139('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x9139('0x3')},'apiKey':{'type':Sequelize[_0x9139('0x2')]},'remoteUri':{'type':Sequelize[_0x9139('0x2')],'unique':_0x9139('0x4')},'serverUrl':{'type':Sequelize[_0x9139('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 1ec0f78..7e096d2 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 _0xb287=['name','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','find','create','body','update','getConfigurations','findOne','FreshsalesConfiguration','hasOwnProperty','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','destroy','then','error','stack'];(function(_0x287f37,_0x1c9b63){var _0x15fa30=function(_0x3d2e56){while(--_0x3d2e56){_0x287f37['push'](_0x287f37['shift']());}};_0x15fa30(++_0x1c9b63);}(_0xb287,0xa4));var _0x7b28=function(_0x3a7201,_0x59a9dd){_0x3a7201=_0x3a7201-0x0;var _0x17a437=_0xb287[_0x3a7201];return _0x17a437;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b28('0x0'));var zipdir=require(_0x7b28('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b28('0x2'));var moment=require(_0x7b28('0x3'));var BPromise=require(_0x7b28('0x4'));var Mustache=require(_0x7b28('0x5'));var util=require(_0x7b28('0x6'));var path=require(_0x7b28('0x7'));var sox=require(_0x7b28('0x8'));var csv=require(_0x7b28('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b28('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7b28('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7b28('0xc'));var toCsv=require(_0x7b28('0x9'));var querystring=require(_0x7b28('0xd'));var Papa=require(_0x7b28('0xe'));var Redis=require('ioredis');var authService=require(_0x7b28('0xf'));var qs=require(_0x7b28('0x10'));var as=require(_0x7b28('0x11'));var hardwareService=require(_0x7b28('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x7b28('0x13'));var config=require(_0x7b28('0x14'));var licenseUtil=require(_0x7b28('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5897f0,_0x116e39){_0x116e39=_0x116e39||0xcc;return function(_0x5f1628){if(_0x5f1628){return _0x5897f0[_0x7b28('0x16')](_0x116e39);}return _0x5897f0['status'](_0x116e39)[_0x7b28('0x17')]();};}function respondWithResult(_0x1dd485,_0x54e275){_0x54e275=_0x54e275||0xc8;return function(_0x3fa529){if(_0x3fa529){return _0x1dd485[_0x7b28('0x18')](_0x54e275)['json'](_0x3fa529);}};}function respondWithFilteredResult(_0x57b611,_0x566511){return function(_0x3feb6b){if(_0x3feb6b){var _0x2ec49f=typeof _0x566511[_0x7b28('0x19')]===_0x7b28('0x1a')&&typeof _0x566511[_0x7b28('0x1b')]===_0x7b28('0x1a');var _0x212027=_0x3feb6b[_0x7b28('0x1c')];var _0x2350f4=_0x2ec49f?0x0:_0x566511['offset'];var _0x55567c=_0x2ec49f?_0x3feb6b[_0x7b28('0x1c')]:_0x566511[_0x7b28('0x19')]+_0x566511['limit'];var _0xfad4de;if(_0x55567c>=_0x212027){_0x55567c=_0x212027;_0xfad4de=0xc8;}else{_0xfad4de=0xce;}_0x57b611['status'](_0xfad4de);return _0x57b611[_0x7b28('0x1d')](_0x7b28('0x1e'),_0x2350f4+'-'+_0x55567c+'/'+_0x212027)[_0x7b28('0x1f')](_0x3feb6b);}return null;};}function patchUpdates(_0x5a4bf0){return function(_0x1af375){try{jsonpatch['apply'](_0x1af375,_0x5a4bf0,!![]);}catch(_0x453668){return BPromise[_0x7b28('0x20')](_0x453668);}return _0x1af375[_0x7b28('0x21')]();};}function saveUpdates(_0x219311,_0x130b94){return function(_0x3b848e){if(_0x3b848e){return _0x3b848e['update'](_0x219311)['then'](function(_0x30e8bc){return _0x30e8bc;});}return null;};}function removeEntity(_0x11b5f3,_0x4fc730){return function(_0x483148){if(_0x483148){return _0x483148[_0x7b28('0x22')]()[_0x7b28('0x23')](function(){_0x11b5f3['status'](0xcc)[_0x7b28('0x17')]();});}};}function handleEntityNotFound(_0x1094e3,_0x50be66){return function(_0x152536){if(!_0x152536){_0x1094e3['sendStatus'](0x194);}return _0x152536;};}function handleError(_0x459937,_0x182a18){_0x182a18=_0x182a18||0x1f4;return function(_0x158851){logger[_0x7b28('0x24')](_0x158851[_0x7b28('0x25')]);if(_0x158851['name']){delete _0x158851[_0x7b28('0x26')];}_0x459937[_0x7b28('0x18')](_0x182a18)['send'](_0x158851);};}exports[_0x7b28('0x27')]=function(_0x57d1df,_0x4d6e39){var _0x1819f9={},_0x34d832={},_0xc7c80d={'count':0x0,'rows':[]};var _0x591030=_[_0x7b28('0x28')](db[_0x7b28('0x29')][_0x7b28('0x2a')],function(_0x296b46){return{'name':_0x296b46[_0x7b28('0x2b')],'type':_0x296b46[_0x7b28('0x2c')][_0x7b28('0x2d')]};});_0x34d832[_0x7b28('0x2e')]=_[_0x7b28('0x28')](_0x591030,_0x7b28('0x26'));_0x34d832[_0x7b28('0x2f')]=_[_0x7b28('0x30')](_0x57d1df[_0x7b28('0x2f')]);_0x34d832[_0x7b28('0x31')]=_['intersection'](_0x34d832[_0x7b28('0x2e')],_0x34d832[_0x7b28('0x2f')]);_0x1819f9[_0x7b28('0x32')]=_[_0x7b28('0x33')](_0x34d832['model'],qs[_0x7b28('0x34')](_0x57d1df['query'][_0x7b28('0x34')]));_0x1819f9[_0x7b28('0x32')]=_0x1819f9[_0x7b28('0x32')][_0x7b28('0x35')]?_0x1819f9['attributes']:_0x34d832[_0x7b28('0x2e')];if(!_0x57d1df[_0x7b28('0x2f')]['hasOwnProperty'](_0x7b28('0x36'))){_0x1819f9[_0x7b28('0x1b')]=qs[_0x7b28('0x1b')](_0x57d1df[_0x7b28('0x2f')]['limit']);_0x1819f9[_0x7b28('0x19')]=qs[_0x7b28('0x19')](_0x57d1df[_0x7b28('0x2f')][_0x7b28('0x19')]);}_0x1819f9[_0x7b28('0x37')]=qs[_0x7b28('0x38')](_0x57d1df[_0x7b28('0x2f')][_0x7b28('0x38')]);_0x1819f9[_0x7b28('0x39')]=qs[_0x7b28('0x31')](_[_0x7b28('0x3a')](_0x57d1df[_0x7b28('0x2f')],_0x34d832[_0x7b28('0x31')]),_0x591030);if(_0x57d1df[_0x7b28('0x2f')][_0x7b28('0x3b')]){_0x1819f9[_0x7b28('0x39')]=_[_0x7b28('0x3c')](_0x1819f9[_0x7b28('0x39')],{'$or':_[_0x7b28('0x28')](_0x591030,function(_0x4f1032){if(_0x4f1032[_0x7b28('0x2c')]!=='VIRTUAL'){var _0x1a67bf={};_0x1a67bf[_0x4f1032[_0x7b28('0x26')]]={'$like':'%'+_0x57d1df[_0x7b28('0x2f')][_0x7b28('0x3b')]+'%'};return _0x1a67bf;}})});}_0x1819f9=_[_0x7b28('0x3c')]({},_0x1819f9,_0x57d1df[_0x7b28('0x3d')]);var _0x431282={'where':_0x1819f9[_0x7b28('0x39')]};return db['FreshsalesAccount'][_0x7b28('0x1c')](_0x431282)['then'](function(_0x1d5631){_0xc7c80d[_0x7b28('0x1c')]=_0x1d5631;if(_0x57d1df[_0x7b28('0x2f')][_0x7b28('0x3e')]){_0x1819f9['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x7b28('0x3f')](_0x1819f9);})[_0x7b28('0x23')](function(_0x5ebfab){_0xc7c80d['rows']=_0x5ebfab;return _0xc7c80d;})[_0x7b28('0x23')](respondWithFilteredResult(_0x4d6e39,_0x1819f9))[_0x7b28('0x40')](handleError(_0x4d6e39,null));};exports[_0x7b28('0x41')]=function(_0x2dd786,_0x4d7716){var _0x490336={'raw':![],'where':{'id':_0x2dd786[_0x7b28('0x42')]['id']}},_0x380b1b={};_0x380b1b[_0x7b28('0x2e')]=_['keys'](db['FreshsalesAccount']['rawAttributes']);_0x380b1b[_0x7b28('0x2f')]=_['keys'](_0x2dd786[_0x7b28('0x2f')]);_0x380b1b['filters']=_[_0x7b28('0x33')](_0x380b1b[_0x7b28('0x2e')],_0x380b1b[_0x7b28('0x2f')]);_0x490336[_0x7b28('0x32')]=_['intersection'](_0x380b1b[_0x7b28('0x2e')],qs['fields'](_0x2dd786['query'][_0x7b28('0x34')]));_0x490336[_0x7b28('0x32')]=_0x490336['attributes'][_0x7b28('0x35')]?_0x490336['attributes']:_0x380b1b['model'];if(_0x2dd786[_0x7b28('0x2f')][_0x7b28('0x3e')]){_0x490336['include']=[{'all':!![]}];}_0x490336=_[_0x7b28('0x3c')]({},_0x490336,_0x2dd786[_0x7b28('0x3d')]);return db['FreshsalesAccount'][_0x7b28('0x43')](_0x490336)['then'](handleEntityNotFound(_0x4d7716,null))[_0x7b28('0x23')](respondWithResult(_0x4d7716,null))[_0x7b28('0x40')](handleError(_0x4d7716,null));};exports[_0x7b28('0x44')]=function(_0x4086d1,_0x23600c){return db['FreshsalesAccount'][_0x7b28('0x44')](_0x4086d1[_0x7b28('0x45')],{})[_0x7b28('0x23')](respondWithResult(_0x23600c,0xc9))[_0x7b28('0x40')](handleError(_0x23600c,null));};exports[_0x7b28('0x46')]=function(_0x127792,_0x19aee7){if(_0x127792[_0x7b28('0x45')]['id']){delete _0x127792[_0x7b28('0x45')]['id'];}return db['FreshsalesAccount'][_0x7b28('0x43')]({'where':{'id':_0x127792[_0x7b28('0x42')]['id']}})[_0x7b28('0x23')](handleEntityNotFound(_0x19aee7,null))[_0x7b28('0x23')](saveUpdates(_0x127792[_0x7b28('0x45')],null))[_0x7b28('0x23')](respondWithResult(_0x19aee7,null))[_0x7b28('0x40')](handleError(_0x19aee7,null));};exports['destroy']=function(_0x1e01c5,_0x48f06f){return db['FreshsalesAccount'][_0x7b28('0x43')]({'where':{'id':_0x1e01c5['params']['id']}})[_0x7b28('0x23')](handleEntityNotFound(_0x48f06f,null))[_0x7b28('0x23')](removeEntity(_0x48f06f,null))[_0x7b28('0x40')](handleError(_0x48f06f,null));};exports[_0x7b28('0x47')]=function(_0x1b38b9,_0x5d1a5d,_0x1b21b2){var _0x26fa25={};var _0x285d16={};var _0x2f3b0d;var _0x14630d;return db[_0x7b28('0x29')][_0x7b28('0x48')]({'where':{'id':_0x1b38b9['params']['id']}})[_0x7b28('0x23')](handleEntityNotFound(_0x5d1a5d,null))[_0x7b28('0x23')](function(_0x5b87b4){if(_0x5b87b4){_0x2f3b0d=_0x5b87b4;_0x285d16['model']=_[_0x7b28('0x30')](db[_0x7b28('0x49')][_0x7b28('0x2a')]);_0x285d16[_0x7b28('0x2f')]=_['keys'](_0x1b38b9[_0x7b28('0x2f')]);_0x285d16[_0x7b28('0x31')]=_[_0x7b28('0x33')](_0x285d16[_0x7b28('0x2e')],_0x285d16[_0x7b28('0x2f')]);_0x26fa25[_0x7b28('0x32')]=_[_0x7b28('0x33')](_0x285d16[_0x7b28('0x2e')],qs['fields'](_0x1b38b9[_0x7b28('0x2f')][_0x7b28('0x34')]));_0x26fa25[_0x7b28('0x32')]=_0x26fa25['attributes'][_0x7b28('0x35')]?_0x26fa25[_0x7b28('0x32')]:_0x285d16[_0x7b28('0x2e')];_0x26fa25['order']=qs[_0x7b28('0x38')](_0x1b38b9[_0x7b28('0x2f')][_0x7b28('0x38')]);_0x26fa25[_0x7b28('0x39')]=qs[_0x7b28('0x31')](_[_0x7b28('0x3a')](_0x1b38b9[_0x7b28('0x2f')],_0x285d16[_0x7b28('0x31')]));if(_0x1b38b9[_0x7b28('0x2f')][_0x7b28('0x3b')]){_0x26fa25['where']=_[_0x7b28('0x3c')](_0x26fa25[_0x7b28('0x39')],{'$or':_[_0x7b28('0x28')](_0x26fa25[_0x7b28('0x32')],function(_0x2af0f6){var _0x5dcf33={};_0x5dcf33[_0x2af0f6]={'$like':'%'+_0x1b38b9[_0x7b28('0x2f')]['filter']+'%'};return _0x5dcf33;})});}_0x26fa25=_['merge']({},_0x26fa25,_0x1b38b9['options']);return _0x2f3b0d['getConfigurations'](_0x26fa25);}})[_0x7b28('0x23')](function(_0xaa3ec3){if(_0xaa3ec3){_0x14630d=_0xaa3ec3[_0x7b28('0x35')];if(!_0x1b38b9['query'][_0x7b28('0x4a')](_0x7b28('0x36'))){_0x26fa25[_0x7b28('0x1b')]=qs[_0x7b28('0x1b')](_0x1b38b9[_0x7b28('0x2f')][_0x7b28('0x1b')]);_0x26fa25['offset']=qs[_0x7b28('0x19')](_0x1b38b9[_0x7b28('0x2f')][_0x7b28('0x19')]);}return _0x2f3b0d[_0x7b28('0x47')](_0x26fa25);}})['then'](function(_0x2348c1){if(_0x2348c1){return _0x2348c1?{'count':_0x14630d,'rows':_0x2348c1}:null;}})[_0x7b28('0x23')](respondWithResult(_0x5d1a5d,null))['catch'](handleError(_0x5d1a5d,null));};exports['addConfiguration']=function(_0x7248dd,_0xee1ffd,_0x347840){if(_0x7248dd[_0x7b28('0x45')]['id']){delete _0x7248dd[_0x7b28('0x45')]['id'];}return db[_0x7b28('0x29')][_0x7b28('0x48')]({'where':{'id':_0x7248dd[_0x7b28('0x42')]['id']}})[_0x7b28('0x23')](handleEntityNotFound(_0xee1ffd,null))[_0x7b28('0x23')](function(_0x91b629){if(_0x91b629){_0x7248dd[_0x7b28('0x45')][_0x7b28('0x4b')]=_0x91b629['id'];_0x7248dd['body']['Subjects']=integrations[_0x7b28('0x4c')](_0x7248dd[_0x7b28('0x45')][_0x7b28('0x4d')],_0x7248dd[_0x7b28('0x45')][_0x7b28('0x2c')]);_0x7248dd[_0x7b28('0x45')][_0x7b28('0x4e')]=integrations[_0x7b28('0x4f')](_0x7248dd['body'][_0x7b28('0x4d')],_0x7248dd[_0x7b28('0x45')]['type']);return db[_0x7b28('0x49')][_0x7b28('0x44')](_0x7248dd[_0x7b28('0x45')],{'include':[{'model':db[_0x7b28('0x50')],'as':_0x7b28('0x51')},{'model':db['FreshsalesField'],'as':_0x7b28('0x4e')}]});}return null;})[_0x7b28('0x23')](respondWithResult(_0xee1ffd,null))['catch'](handleError(_0xee1ffd,null));};exports[_0x7b28('0x52')]=function(_0x2adb02,_0x410656,_0x4bfaee){var _0xed7870='';var _0x55f308='';return db[_0x7b28('0x29')][_0x7b28('0x48')]({'where':{'id':_0x2adb02['params']['id']},'attributes':['id',_0x7b28('0x53'),_0x7b28('0x54'),_0x7b28('0x55')]})[_0x7b28('0x23')](handleEntityNotFound(_0x410656,null))[_0x7b28('0x23')](function(_0x57bf52){if(_0x57bf52){_0x55f308=_0x57bf52[_0x7b28('0x53')];_0xed7870=_0x57bf52[_0x7b28('0x54')];var _0x170964=_0x57bf52[_0x7b28('0x54')][_0x7b28('0x56')](-0x1);if(_0x170964==='/'){_0xed7870=_0xed7870[_0x7b28('0x57')](0x0,_0xed7870[_0x7b28('0x58')](_0x170964));}return rp({'method':_0x7b28('0x59'),'uri':util['format'](_0x7b28('0x5a'),_0xed7870,_0x7b28('0x5b')),'headers':{'Authorization':_0x7b28('0x5c')+_0x57bf52[_0x7b28('0x55')]},'json':!![]});}})[_0x7b28('0x23')](function(_0x38ea59){if(_0x38ea59){var _0x55eceb=_0x38ea59['users'];var _0x50da54=![];var _0x5b510c=null;for(_0x5b510c=0x0;_0x5b510c<_0x55eceb[_0x7b28('0x35')];_0x5b510c++){if(_0x55eceb[_0x5b510c][_0x7b28('0x5d')]===_0x55f308){_0x50da54=!![];}}if(_0x50da54){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x7b28('0x5e')});}}})[_0x7b28('0x23')](respondWithResult(_0x410656,null))[_0x7b28('0x40')](function(_0x3f2c49){var _0x133d5d=_0x2adb02[_0x7b28('0x2f')][_0x7b28('0x5f')]?0x1f4:_0x3f2c49[_0x7b28('0x60')]||0x1f4;logger[_0x7b28('0x24')](_0x7b28('0x61'),_0x7b28('0x52'),_0x133d5d,JSON[_0x7b28('0x62')](_0x3f2c49));delete _0x3f2c49[_0x7b28('0x26')];if(_0x133d5d===0x191){_0x133d5d=0x190;}_0x410656[_0x7b28('0x18')](_0x133d5d)[_0x7b28('0x63')](_0x2adb02[_0x7b28('0x2f')][_0x7b28('0x5f')]?{'message':_0x7b28('0x64'),'statusCode':_0x3f2c49['statusCode']}:_0x3f2c49);});}; \ No newline at end of file +var _0xbf95=['email','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','nolimit','order','sort','where','filter','merge','options','FreshsalesAccount','include','findAll','rows','params','length','includeAll','find','catch','create','body','update','getConfigurations','findOne','FreshsalesConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','Subjects','FreshsalesField','username','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','users'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xbf95,0x68));var _0x5bf9=function(_0x3be775,_0x90c2da){_0x3be775=_0x3be775-0x0;var _0x345b11=_0xbf95[_0x3be775];return _0x345b11;};'use strict';var emlformat=require(_0x5bf9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5bf9('0x1'));var jsonpatch=require(_0x5bf9('0x2'));var rp=require('request-promise');var moment=require(_0x5bf9('0x3'));var BPromise=require(_0x5bf9('0x4'));var Mustache=require('mustache');var util=require(_0x5bf9('0x5'));var path=require(_0x5bf9('0x6'));var sox=require(_0x5bf9('0x7'));var csv=require(_0x5bf9('0x8'));var ejs=require(_0x5bf9('0x9'));var fs=require('fs');var fs_extra=require(_0x5bf9('0xa'));var _=require(_0x5bf9('0xb'));var squel=require(_0x5bf9('0xc'));var crypto=require(_0x5bf9('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5bf9('0x8'));var querystring=require(_0x5bf9('0xe'));var Papa=require(_0x5bf9('0xf'));var Redis=require('ioredis');var authService=require(_0x5bf9('0x10'));var qs=require(_0x5bf9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bf9('0x12'));var logger=require(_0x5bf9('0x13'))(_0x5bf9('0x14'));var utils=require(_0x5bf9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5bf9('0x16'))['db'];var integrations=require(_0x5bf9('0x17'));function respondWithStatusCode(_0x3bd1d2,_0x3adff5){_0x3adff5=_0x3adff5||0xcc;return function(_0x36e9e4){if(_0x36e9e4){return _0x3bd1d2[_0x5bf9('0x18')](_0x3adff5);}return _0x3bd1d2['status'](_0x3adff5)[_0x5bf9('0x19')]();};}function respondWithResult(_0xbfb606,_0x350f45){_0x350f45=_0x350f45||0xc8;return function(_0x525753){if(_0x525753){return _0xbfb606['status'](_0x350f45)[_0x5bf9('0x1a')](_0x525753);}};}function respondWithFilteredResult(_0x29ba25,_0x223a40){return function(_0x4d67d6){if(_0x4d67d6){var _0x16d630=typeof _0x223a40[_0x5bf9('0x1b')]==='undefined'&&typeof _0x223a40[_0x5bf9('0x1c')]===_0x5bf9('0x1d');var _0x262eea=_0x4d67d6[_0x5bf9('0x1e')];var _0x40d4c2=_0x16d630?0x0:_0x223a40[_0x5bf9('0x1b')];var _0x29c919=_0x16d630?_0x4d67d6[_0x5bf9('0x1e')]:_0x223a40['offset']+_0x223a40[_0x5bf9('0x1c')];var _0x48ec7e;if(_0x29c919>=_0x262eea){_0x29c919=_0x262eea;_0x48ec7e=0xc8;}else{_0x48ec7e=0xce;}_0x29ba25[_0x5bf9('0x1f')](_0x48ec7e);return _0x29ba25[_0x5bf9('0x20')](_0x5bf9('0x21'),_0x40d4c2+'-'+_0x29c919+'/'+_0x262eea)[_0x5bf9('0x1a')](_0x4d67d6);}return null;};}function patchUpdates(_0x53e940){return function(_0x262b58){try{jsonpatch[_0x5bf9('0x22')](_0x262b58,_0x53e940,!![]);}catch(_0x33aacb){return BPromise[_0x5bf9('0x23')](_0x33aacb);}return _0x262b58['save']();};}function saveUpdates(_0x9af01a,_0x50c5d9){return function(_0x36991d){if(_0x36991d){return _0x36991d['update'](_0x9af01a)[_0x5bf9('0x24')](function(_0x520c3d){return _0x520c3d;});}return null;};}function removeEntity(_0x5cc371,_0x43e074){return function(_0x1cb5f3){if(_0x1cb5f3){return _0x1cb5f3[_0x5bf9('0x25')]()[_0x5bf9('0x24')](function(){_0x5cc371['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x25622d,_0x2be179){return function(_0x56fa5d){if(!_0x56fa5d){_0x25622d[_0x5bf9('0x18')](0x194);}return _0x56fa5d;};}function handleError(_0x3e9fc4,_0x5ba4f1){_0x5ba4f1=_0x5ba4f1||0x1f4;return function(_0x268c33){logger[_0x5bf9('0x26')](_0x268c33[_0x5bf9('0x27')]);if(_0x268c33[_0x5bf9('0x28')]){delete _0x268c33[_0x5bf9('0x28')];}_0x3e9fc4[_0x5bf9('0x1f')](_0x5ba4f1)[_0x5bf9('0x29')](_0x268c33);};}exports[_0x5bf9('0x2a')]=function(_0x276888,_0x5b86d3){var _0x259768={},_0x3e47ea={},_0x5b5109={'count':0x0,'rows':[]};var _0x4689af=_[_0x5bf9('0x2b')](db['FreshsalesAccount']['rawAttributes'],function(_0x3404a3){return{'name':_0x3404a3[_0x5bf9('0x2c')],'type':_0x3404a3[_0x5bf9('0x2d')][_0x5bf9('0x2e')]};});_0x3e47ea['model']=_[_0x5bf9('0x2b')](_0x4689af,_0x5bf9('0x28'));_0x3e47ea[_0x5bf9('0x2f')]=_[_0x5bf9('0x30')](_0x276888[_0x5bf9('0x2f')]);_0x3e47ea[_0x5bf9('0x31')]=_['intersection'](_0x3e47ea[_0x5bf9('0x32')],_0x3e47ea[_0x5bf9('0x2f')]);_0x259768[_0x5bf9('0x33')]=_[_0x5bf9('0x34')](_0x3e47ea['model'],qs[_0x5bf9('0x35')](_0x276888['query'][_0x5bf9('0x35')]));_0x259768[_0x5bf9('0x33')]=_0x259768[_0x5bf9('0x33')]['length']?_0x259768[_0x5bf9('0x33')]:_0x3e47ea['model'];if(!_0x276888[_0x5bf9('0x2f')]['hasOwnProperty'](_0x5bf9('0x36'))){_0x259768[_0x5bf9('0x1c')]=qs['limit'](_0x276888[_0x5bf9('0x2f')]['limit']);_0x259768['offset']=qs[_0x5bf9('0x1b')](_0x276888['query']['offset']);}_0x259768[_0x5bf9('0x37')]=qs[_0x5bf9('0x38')](_0x276888[_0x5bf9('0x2f')][_0x5bf9('0x38')]);_0x259768[_0x5bf9('0x39')]=qs[_0x5bf9('0x31')](_['pick'](_0x276888[_0x5bf9('0x2f')],_0x3e47ea['filters']),_0x4689af);if(_0x276888[_0x5bf9('0x2f')][_0x5bf9('0x3a')]){_0x259768[_0x5bf9('0x39')]=_[_0x5bf9('0x3b')](_0x259768[_0x5bf9('0x39')],{'$or':_[_0x5bf9('0x2b')](_0x4689af,function(_0x1e1184){if(_0x1e1184[_0x5bf9('0x2d')]!=='VIRTUAL'){var _0x4ccdc0={};_0x4ccdc0[_0x1e1184[_0x5bf9('0x28')]]={'$like':'%'+_0x276888[_0x5bf9('0x2f')][_0x5bf9('0x3a')]+'%'};return _0x4ccdc0;}})});}_0x259768=_[_0x5bf9('0x3b')]({},_0x259768,_0x276888[_0x5bf9('0x3c')]);var _0x3618e5={'where':_0x259768[_0x5bf9('0x39')]};return db[_0x5bf9('0x3d')][_0x5bf9('0x1e')](_0x3618e5)['then'](function(_0x2e00c0){_0x5b5109[_0x5bf9('0x1e')]=_0x2e00c0;if(_0x276888[_0x5bf9('0x2f')]['includeAll']){_0x259768[_0x5bf9('0x3e')]=[{'all':!![]}];}return db[_0x5bf9('0x3d')][_0x5bf9('0x3f')](_0x259768);})[_0x5bf9('0x24')](function(_0x31c096){_0x5b5109[_0x5bf9('0x40')]=_0x31c096;return _0x5b5109;})['then'](respondWithFilteredResult(_0x5b86d3,_0x259768))['catch'](handleError(_0x5b86d3,null));};exports['show']=function(_0x5ee2da,_0x37743e){var _0x2fdb33={'raw':![],'where':{'id':_0x5ee2da[_0x5bf9('0x41')]['id']}},_0x32b6f9={};_0x32b6f9['model']=_[_0x5bf9('0x30')](db['FreshsalesAccount']['rawAttributes']);_0x32b6f9[_0x5bf9('0x2f')]=_[_0x5bf9('0x30')](_0x5ee2da['query']);_0x32b6f9[_0x5bf9('0x31')]=_[_0x5bf9('0x34')](_0x32b6f9['model'],_0x32b6f9[_0x5bf9('0x2f')]);_0x2fdb33[_0x5bf9('0x33')]=_[_0x5bf9('0x34')](_0x32b6f9[_0x5bf9('0x32')],qs[_0x5bf9('0x35')](_0x5ee2da['query'][_0x5bf9('0x35')]));_0x2fdb33[_0x5bf9('0x33')]=_0x2fdb33[_0x5bf9('0x33')][_0x5bf9('0x42')]?_0x2fdb33[_0x5bf9('0x33')]:_0x32b6f9[_0x5bf9('0x32')];if(_0x5ee2da['query'][_0x5bf9('0x43')]){_0x2fdb33['include']=[{'all':!![]}];}_0x2fdb33=_[_0x5bf9('0x3b')]({},_0x2fdb33,_0x5ee2da[_0x5bf9('0x3c')]);return db[_0x5bf9('0x3d')][_0x5bf9('0x44')](_0x2fdb33)[_0x5bf9('0x24')](handleEntityNotFound(_0x37743e,null))[_0x5bf9('0x24')](respondWithResult(_0x37743e,null))[_0x5bf9('0x45')](handleError(_0x37743e,null));};exports[_0x5bf9('0x46')]=function(_0x211249,_0x233fab){return db[_0x5bf9('0x3d')][_0x5bf9('0x46')](_0x211249[_0x5bf9('0x47')],{})[_0x5bf9('0x24')](respondWithResult(_0x233fab,0xc9))[_0x5bf9('0x45')](handleError(_0x233fab,null));};exports[_0x5bf9('0x48')]=function(_0x5cfc4c,_0x2ec961){if(_0x5cfc4c[_0x5bf9('0x47')]['id']){delete _0x5cfc4c[_0x5bf9('0x47')]['id'];}return db[_0x5bf9('0x3d')][_0x5bf9('0x44')]({'where':{'id':_0x5cfc4c['params']['id']}})[_0x5bf9('0x24')](handleEntityNotFound(_0x2ec961,null))[_0x5bf9('0x24')](saveUpdates(_0x5cfc4c[_0x5bf9('0x47')],null))['then'](respondWithResult(_0x2ec961,null))[_0x5bf9('0x45')](handleError(_0x2ec961,null));};exports[_0x5bf9('0x25')]=function(_0x55f39e,_0x3764b2){return db[_0x5bf9('0x3d')][_0x5bf9('0x44')]({'where':{'id':_0x55f39e[_0x5bf9('0x41')]['id']}})['then'](handleEntityNotFound(_0x3764b2,null))[_0x5bf9('0x24')](removeEntity(_0x3764b2,null))[_0x5bf9('0x45')](handleError(_0x3764b2,null));};exports[_0x5bf9('0x49')]=function(_0x584049,_0xe3b359,_0x3f8c97){var _0x4b051b={};var _0x7c7a4b={};var _0x550f5f;var _0x52ad16;return db[_0x5bf9('0x3d')][_0x5bf9('0x4a')]({'where':{'id':_0x584049[_0x5bf9('0x41')]['id']}})[_0x5bf9('0x24')](handleEntityNotFound(_0xe3b359,null))[_0x5bf9('0x24')](function(_0x26098c){if(_0x26098c){_0x550f5f=_0x26098c;_0x7c7a4b[_0x5bf9('0x32')]=_[_0x5bf9('0x30')](db[_0x5bf9('0x4b')]['rawAttributes']);_0x7c7a4b['query']=_[_0x5bf9('0x30')](_0x584049[_0x5bf9('0x2f')]);_0x7c7a4b[_0x5bf9('0x31')]=_['intersection'](_0x7c7a4b[_0x5bf9('0x32')],_0x7c7a4b[_0x5bf9('0x2f')]);_0x4b051b[_0x5bf9('0x33')]=_[_0x5bf9('0x34')](_0x7c7a4b[_0x5bf9('0x32')],qs[_0x5bf9('0x35')](_0x584049[_0x5bf9('0x2f')][_0x5bf9('0x35')]));_0x4b051b[_0x5bf9('0x33')]=_0x4b051b['attributes'][_0x5bf9('0x42')]?_0x4b051b[_0x5bf9('0x33')]:_0x7c7a4b[_0x5bf9('0x32')];_0x4b051b[_0x5bf9('0x37')]=qs[_0x5bf9('0x38')](_0x584049[_0x5bf9('0x2f')][_0x5bf9('0x38')]);_0x4b051b['where']=qs[_0x5bf9('0x31')](_[_0x5bf9('0x4c')](_0x584049[_0x5bf9('0x2f')],_0x7c7a4b[_0x5bf9('0x31')]));if(_0x584049[_0x5bf9('0x2f')][_0x5bf9('0x3a')]){_0x4b051b['where']=_[_0x5bf9('0x3b')](_0x4b051b[_0x5bf9('0x39')],{'$or':_[_0x5bf9('0x2b')](_0x4b051b[_0x5bf9('0x33')],function(_0x1f3e76){var _0x1b8e46={};_0x1b8e46[_0x1f3e76]={'$like':'%'+_0x584049[_0x5bf9('0x2f')][_0x5bf9('0x3a')]+'%'};return _0x1b8e46;})});}_0x4b051b=_['merge']({},_0x4b051b,_0x584049['options']);return _0x550f5f[_0x5bf9('0x49')](_0x4b051b);}})[_0x5bf9('0x24')](function(_0x489e61){if(_0x489e61){_0x52ad16=_0x489e61[_0x5bf9('0x42')];if(!_0x584049['query'][_0x5bf9('0x4d')](_0x5bf9('0x36'))){_0x4b051b[_0x5bf9('0x1c')]=qs['limit'](_0x584049[_0x5bf9('0x2f')][_0x5bf9('0x1c')]);_0x4b051b['offset']=qs[_0x5bf9('0x1b')](_0x584049[_0x5bf9('0x2f')][_0x5bf9('0x1b')]);}return _0x550f5f[_0x5bf9('0x49')](_0x4b051b);}})[_0x5bf9('0x24')](function(_0x3a9e1e){if(_0x3a9e1e){return _0x3a9e1e?{'count':_0x52ad16,'rows':_0x3a9e1e}:null;}})[_0x5bf9('0x24')](respondWithResult(_0xe3b359,null))['catch'](handleError(_0xe3b359,null));};exports[_0x5bf9('0x4e')]=function(_0x3d07b5,_0x450fd1,_0x1ca4d3){if(_0x3d07b5['body']['id']){delete _0x3d07b5[_0x5bf9('0x47')]['id'];}return db[_0x5bf9('0x3d')][_0x5bf9('0x4a')]({'where':{'id':_0x3d07b5['params']['id']}})['then'](handleEntityNotFound(_0x450fd1,null))[_0x5bf9('0x24')](function(_0x1c9946){if(_0x1c9946){_0x3d07b5[_0x5bf9('0x47')][_0x5bf9('0x4f')]=_0x1c9946['id'];_0x3d07b5['body']['Subjects']=integrations[_0x5bf9('0x50')](_0x3d07b5[_0x5bf9('0x47')][_0x5bf9('0x51')],_0x3d07b5['body'][_0x5bf9('0x2d')]);_0x3d07b5[_0x5bf9('0x47')][_0x5bf9('0x52')]=integrations['getDescriptions'](_0x3d07b5[_0x5bf9('0x47')]['channel'],_0x3d07b5[_0x5bf9('0x47')][_0x5bf9('0x2d')]);return db['FreshsalesConfiguration'][_0x5bf9('0x46')](_0x3d07b5[_0x5bf9('0x47')],{'include':[{'model':db['FreshsalesField'],'as':_0x5bf9('0x53')},{'model':db[_0x5bf9('0x54')],'as':_0x5bf9('0x52')}]});}return null;})[_0x5bf9('0x24')](respondWithResult(_0x450fd1,null))[_0x5bf9('0x45')](handleError(_0x450fd1,null));};exports['getFields']=function(_0x46a34e,_0x573ca0,_0x191a81){var _0x378aff='';var _0x46cb4d='';return db[_0x5bf9('0x3d')][_0x5bf9('0x4a')]({'where':{'id':_0x46a34e[_0x5bf9('0x41')]['id']},'attributes':['id',_0x5bf9('0x55'),_0x5bf9('0x56'),_0x5bf9('0x57')]})[_0x5bf9('0x24')](handleEntityNotFound(_0x573ca0,null))['then'](function(_0x39c3e7){if(_0x39c3e7){_0x46cb4d=_0x39c3e7[_0x5bf9('0x55')];_0x378aff=_0x39c3e7[_0x5bf9('0x56')];var _0x5d961a=_0x39c3e7[_0x5bf9('0x56')][_0x5bf9('0x58')](-0x1);if(_0x5d961a==='/'){_0x378aff=_0x378aff[_0x5bf9('0x59')](0x0,_0x378aff[_0x5bf9('0x5a')](_0x5d961a));}return rp({'method':'GET','uri':util[_0x5bf9('0x5b')](_0x5bf9('0x5c'),_0x378aff,_0x5bf9('0x5d')),'headers':{'Authorization':_0x5bf9('0x5e')+_0x39c3e7[_0x5bf9('0x57')]},'json':!![]});}})[_0x5bf9('0x24')](function(_0x5887ac){if(_0x5887ac){var _0x5d667c=_0x5887ac[_0x5bf9('0x5f')];var _0x469dff=![];var _0x4692e4=null;for(_0x4692e4=0x0;_0x4692e4<_0x5d667c[_0x5bf9('0x42')];_0x4692e4++){if(_0x5d667c[_0x4692e4][_0x5bf9('0x60')]===_0x46cb4d){_0x469dff=!![];}}if(_0x469dff){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x5bf9('0x24')](respondWithResult(_0x573ca0,null))[_0x5bf9('0x45')](function(_0x372936){var _0x51b8ad=_0x46a34e[_0x5bf9('0x2f')][_0x5bf9('0x61')]?0x1f4:_0x372936[_0x5bf9('0x62')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x51b8ad,JSON['stringify'](_0x372936));delete _0x372936[_0x5bf9('0x28')];if(_0x51b8ad===0x191){_0x51b8ad=0x190;}_0x573ca0[_0x5bf9('0x1f')](_0x51b8ad)[_0x5bf9('0x29')](_0x46a34e['query'][_0x5bf9('0x61')]?{'message':_0x5bf9('0x63'),'statusCode':_0x372936[_0x5bf9('0x62')]}:_0x372936);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 717c96d..8cb5e1a 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 _0x430c=['define','FreshsalesAccount','int_freshsales_accounts','lodash','api','moment','bluebird','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x339285,_0x31f85f){var _0x594933=function(_0x109fbf){while(--_0x109fbf){_0x339285['push'](_0x339285['shift']());}};_0x594933(++_0x31f85f);}(_0x430c,0x1a1));var _0xc430=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0x430c[_0x16db8b];return _0x5ba017;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('0x3'));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(_0xc430('0x4'));var integrations=require(_0xc430('0x5'));module['exports']=function(_0x42aa9c,_0x4de44f){return _0x42aa9c[_0xc430('0x6')](_0xc430('0x7'),attributes,{'tableName':_0xc430('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1532e5,_0x342ea7){var _0x3b82bd=function(_0x1a8ab9){while(--_0x1a8ab9){_0x1532e5['push'](_0x1532e5['shift']());}};_0x3b82bd(++_0x342ea7);}(_0x4975,0x86));var _0x5497=function(_0x5da0e0,_0x5ddd63){_0x5da0e0=_0x5da0e0-0x0;var _0x2f0a21=_0x4975[_0x5da0e0];return _0x2f0a21;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));var integrations=require(_0x5497('0xa'));module['exports']=function(_0x37e48d,_0x4f563d){return _0x37e48d[_0x5497('0xb')](_0x5497('0xc'),attributes,{'tableName':_0x5497('0xd'),'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 a3ed70b..63dabc8 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 _0x2da6=['info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FreshsalesAccount','options','raw','where','attributes','include','map','model','GetFreshsalesAccount','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then'];(function(_0x28e5f7,_0x18ce28){var _0x1ba4de=function(_0x3775dd){while(--_0x3775dd){_0x28e5f7['push'](_0x28e5f7['shift']());}};_0x1ba4de(++_0x18ce28);}(_0x2da6,0x1dd));var _0x62da=function(_0x4a95ad,_0x2396dd){_0x4a95ad=_0x4a95ad-0x0;var _0x326257=_0x2da6[_0x4a95ad];return _0x326257;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var moment=require(_0x62da('0x2'));var BPromise=require(_0x62da('0x3'));var rs=require(_0x62da('0x4'));var fs=require('fs');var Redis=require(_0x62da('0x5'));var db=require(_0x62da('0x6'))['db'];var utils=require(_0x62da('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x62da('0x8'));var jayson=require(_0x62da('0x9'));var client=jayson[_0x62da('0xa')][_0x62da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x100e73,_0x9d9139,_0x310c15){return new BPromise(function(_0x16f919,_0xbfd2b0){return client['request'](_0x100e73,_0x310c15)[_0x62da('0xc')](function(_0x2a3937){logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,'request\x20sent');logger[_0x62da('0xf')](_0x62da('0x10'),_0x9d9139,_0x62da('0x11'),JSON[_0x62da('0x12')](_0x2a3937));if(_0x2a3937[_0x62da('0x13')]){if(_0x2a3937['error'][_0x62da('0x14')]===0x1f4){logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0xbfd2b0(_0x2a3937['error']['message']);}logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0x16f919(_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);}else{logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,_0x62da('0x11'));_0x16f919(_0x2a3937[_0x62da('0x16')][_0x62da('0x15')]);}})[_0x62da('0x17')](function(_0x1f6bc8){logger[_0x62da('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x9d9139,_0x1f6bc8);_0xbfd2b0(_0x1f6bc8);});});}exports['GetFreshsalesAccount']=function(_0xa7050b){var _0x4ae4fb=this;return new Promise(function(_0x4d6482,_0x264366){return db[_0x62da('0x18')]['findAll']({'raw':_0xa7050b[_0x62da('0x19')]?_0xa7050b['options'][_0x62da('0x1a')]===undefined?!![]:![]:!![],'where':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')][_0x62da('0x1b')]||null:null,'attributes':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')][_0x62da('0x1c')]||null:null,'limit':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')]['limit']||null:null,'include':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')][_0x62da('0x1d')]?_[_0x62da('0x1e')](_0xa7050b[_0x62da('0x19')][_0x62da('0x1d')],function(_0x24298a){return{'model':db[_0x24298a['model']],'as':_0x24298a['as'],'attributes':_0x24298a['attributes'],'include':_0x24298a['include']?_[_0x62da('0x1e')](_0x24298a[_0x62da('0x1d')],function(_0x14897c){return{'model':db[_0x14897c[_0x62da('0x1f')]],'as':_0x14897c['as'],'attributes':_0x14897c['attributes'],'include':_0x14897c[_0x62da('0x1d')]?_[_0x62da('0x1e')](_0x14897c['include'],function(_0x3ccf96){return{'model':db[_0x3ccf96[_0x62da('0x1f')]],'as':_0x3ccf96['as'],'attributes':_0x3ccf96[_0x62da('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41de3a){logger[_0x62da('0xd')](_0x62da('0x20'),_0xa7050b);logger['debug']('GetFreshsalesAccount',_0xa7050b,JSON[_0x62da('0x12')](_0x41de3a));_0x4d6482(_0x41de3a);})[_0x62da('0x17')](function(_0x220ffc){logger['error'](_0x62da('0x20'),_0x220ffc[_0x62da('0x15')],_0xa7050b);_0x264366(_0x4ae4fb[_0x62da('0x13')](0x1f4,_0x220ffc[_0x62da('0x15')]));});});};exports[_0x62da('0x21')]=function(_0x1cf765){var _0x592c6c=this;return new Promise(function(_0xbe398f,_0x4f71bc){return db[_0x62da('0x18')][_0x62da('0x22')]({'raw':_0x1cf765[_0x62da('0x19')]?_0x1cf765[_0x62da('0x19')][_0x62da('0x1a')]===undefined?!![]:![]:!![],'where':_0x1cf765[_0x62da('0x19')]?_0x1cf765['options'][_0x62da('0x1b')]||null:null,'attributes':_0x1cf765[_0x62da('0x19')]?_0x1cf765[_0x62da('0x19')]['attributes']||null:null,'include':_0x1cf765[_0x62da('0x19')]?_0x1cf765[_0x62da('0x19')][_0x62da('0x1d')]?_['map'](_0x1cf765[_0x62da('0x19')][_0x62da('0x1d')],function(_0x55eda7){return{'model':db[_0x55eda7[_0x62da('0x1f')]],'as':_0x55eda7['as'],'attributes':_0x55eda7[_0x62da('0x1c')],'include':_0x55eda7['include']?_[_0x62da('0x1e')](_0x55eda7[_0x62da('0x1d')],function(_0x11bf73){return{'model':db[_0x11bf73[_0x62da('0x1f')]],'as':_0x11bf73['as'],'attributes':_0x11bf73[_0x62da('0x1c')],'include':_0x11bf73[_0x62da('0x1d')]?_[_0x62da('0x1e')](_0x11bf73[_0x62da('0x1d')],function(_0x2f1115){return{'model':db[_0x2f1115[_0x62da('0x1f')]],'as':_0x2f1115['as'],'attributes':_0x2f1115[_0x62da('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x62da('0xc')](function(_0x3057f6){logger[_0x62da('0xd')](_0x62da('0x21'),_0x1cf765);logger[_0x62da('0xf')](_0x62da('0x21'),_0x1cf765,JSON['stringify'](_0x3057f6));_0xbe398f(_0x3057f6);})[_0x62da('0x17')](function(_0x5e9295){logger[_0x62da('0x13')](_0x62da('0x21'),_0x5e9295[_0x62da('0x15')],_0x1cf765);_0x4f71bc(_0x592c6c['error'](0x1f4,_0x5e9295[_0x62da('0x15')]));});});}; \ No newline at end of file +var _0x896e=['limit','include','model','attributes','map','ShowFreshsalesAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw'];(function(_0xf5dce0,_0x40632b){var _0x8d3881=function(_0x4a0284){while(--_0x4a0284){_0xf5dce0['push'](_0xf5dce0['shift']());}};_0x8d3881(++_0x40632b);}(_0x896e,0x1e9));var _0xe896=function(_0x2be3b7,_0x30e912){_0x2be3b7=_0x2be3b7-0x0;var _0x313d1c=_0x896e[_0x2be3b7];return _0x313d1c;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});}exports[_0xe896('0x18')]=function(_0x32f86d){var _0x2d4cf0=this;return new Promise(function(_0x5dc89d,_0x782813){return db[_0xe896('0x19')][_0xe896('0x1a')]({'raw':_0x32f86d[_0xe896('0x1b')]?_0x32f86d[_0xe896('0x1b')][_0xe896('0x1c')]===undefined?!![]:![]:!![],'where':_0x32f86d[_0xe896('0x1b')]?_0x32f86d[_0xe896('0x1b')]['where']||null:null,'attributes':_0x32f86d[_0xe896('0x1b')]?_0x32f86d['options']['attributes']||null:null,'limit':_0x32f86d[_0xe896('0x1b')]?_0x32f86d[_0xe896('0x1b')][_0xe896('0x1d')]||null:null,'include':_0x32f86d[_0xe896('0x1b')]?_0x32f86d['options'][_0xe896('0x1e')]?_['map'](_0x32f86d['options'][_0xe896('0x1e')],function(_0x41e689){return{'model':db[_0x41e689[_0xe896('0x1f')]],'as':_0x41e689['as'],'attributes':_0x41e689[_0xe896('0x20')],'include':_0x41e689[_0xe896('0x1e')]?_[_0xe896('0x21')](_0x41e689[_0xe896('0x1e')],function(_0x4b71cc){return{'model':db[_0x4b71cc[_0xe896('0x1f')]],'as':_0x4b71cc['as'],'attributes':_0x4b71cc[_0xe896('0x20')],'include':_0x4b71cc[_0xe896('0x1e')]?_['map'](_0x4b71cc[_0xe896('0x1e')],function(_0xd50fe2){return{'model':db[_0xd50fe2[_0xe896('0x1f')]],'as':_0xd50fe2['as'],'attributes':_0xd50fe2[_0xe896('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe896('0xe')](function(_0x3f8ceb){logger['info'](_0xe896('0x18'),_0x32f86d);logger[_0xe896('0x10')](_0xe896('0x18'),_0x32f86d,JSON[_0xe896('0x12')](_0x3f8ceb));_0x5dc89d(_0x3f8ceb);})[_0xe896('0x17')](function(_0x5e0d9b){logger['error']('GetFreshsalesAccount',_0x5e0d9b['message'],_0x32f86d);_0x782813(_0x2d4cf0['error'](0x1f4,_0x5e0d9b[_0xe896('0x15')]));});});};exports[_0xe896('0x22')]=function(_0x10fd26){var _0x76c781=this;return new Promise(function(_0x3cd88e,_0x1a6090){return db[_0xe896('0x19')][_0xe896('0x23')]({'raw':_0x10fd26['options']?_0x10fd26['options'][_0xe896('0x1c')]===undefined?!![]:![]:!![],'where':_0x10fd26[_0xe896('0x1b')]?_0x10fd26[_0xe896('0x1b')][_0xe896('0x24')]||null:null,'attributes':_0x10fd26['options']?_0x10fd26[_0xe896('0x1b')]['attributes']||null:null,'include':_0x10fd26['options']?_0x10fd26[_0xe896('0x1b')][_0xe896('0x1e')]?_[_0xe896('0x21')](_0x10fd26['options']['include'],function(_0x567589){return{'model':db[_0x567589[_0xe896('0x1f')]],'as':_0x567589['as'],'attributes':_0x567589[_0xe896('0x20')],'include':_0x567589[_0xe896('0x1e')]?_[_0xe896('0x21')](_0x567589[_0xe896('0x1e')],function(_0x486eb5){return{'model':db[_0x486eb5[_0xe896('0x1f')]],'as':_0x486eb5['as'],'attributes':_0x486eb5[_0xe896('0x20')],'include':_0x486eb5[_0xe896('0x1e')]?_[_0xe896('0x21')](_0x486eb5[_0xe896('0x1e')],function(_0x2cce09){return{'model':db[_0x2cce09[_0xe896('0x1f')]],'as':_0x2cce09['as'],'attributes':_0x2cce09[_0xe896('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x42f3fb){logger[_0xe896('0x16')]('ShowFreshsalesAccount',_0x10fd26);logger[_0xe896('0x10')]('ShowFreshsalesAccount',_0x10fd26,JSON[_0xe896('0x12')](_0x42f3fb));_0x3cd88e(_0x42f3fb);})['catch'](function(_0x42f445){logger['error'](_0xe896('0x22'),_0x42f445[_0xe896('0x15')],_0x10fd26);_0x1a6090(_0x76c781[_0xe896('0x13')](0x1f4,_0x42f445[_0xe896('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 97b83da..af6caac 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 _0xb46a=['./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2172bc,_0x55194f){var _0x8711b8=function(_0x5bc79b){while(--_0x5bc79b){_0x2172bc['push'](_0x2172bc['shift']());}};_0x8711b8(++_0x55194f);}(_0xb46a,0xb0));var _0xab46=function(_0x8aa1c5,_0x38b6c7){_0x8aa1c5=_0x8aa1c5-0x0;var _0x369f54=_0xb46a[_0x8aa1c5];return _0x369f54;};'use strict';var multer=require(_0xab46('0x0'));var util=require(_0xab46('0x1'));var path=require('path');var timeout=require(_0xab46('0x2'));var express=require('express');var router=express[_0xab46('0x3')]();var fs_extra=require(_0xab46('0x4'));var auth=require(_0xab46('0x5'));var interaction=require(_0xab46('0x6'));var config=require(_0xab46('0x7'));var controller=require(_0xab46('0x8'));router[_0xab46('0x9')]('/',auth['isAuthenticated'](),controller[_0xab46('0xa')]);router[_0xab46('0x9')](_0xab46('0xb'),auth[_0xab46('0xc')](),controller[_0xab46('0xd')]);router[_0xab46('0x9')](_0xab46('0xe'),auth[_0xab46('0xc')](),controller[_0xab46('0xf')]);router['get'](_0xab46('0x10'),auth[_0xab46('0xc')](),controller[_0xab46('0x11')]);router[_0xab46('0x9')](_0xab46('0x12'),auth[_0xab46('0xc')](),controller[_0xab46('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xab46('0xb'),auth['isAuthenticated'](),controller[_0xab46('0x14')]);router[_0xab46('0x15')](_0xab46('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xab46('0x16')]=router; \ No newline at end of file +var _0xbcfb=['get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbcfb,0xcf));var _0xbbcf=function(_0x46111d,_0x5d286b){_0x46111d=_0x46111d-0x0;var _0xe82586=_0xbcfb[_0x46111d];return _0xe82586;};'use strict';var multer=require(_0xbbcf('0x0'));var util=require(_0xbbcf('0x1'));var path=require(_0xbbcf('0x2'));var timeout=require(_0xbbcf('0x3'));var express=require('express');var router=express[_0xbbcf('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbbcf('0x5'));var interaction=require(_0xbbcf('0x6'));var config=require(_0xbbcf('0x7'));var controller=require(_0xbbcf('0x8'));router[_0xbbcf('0x9')]('/',auth[_0xbbcf('0xa')](),controller[_0xbbcf('0xb')]);router[_0xbbcf('0x9')](_0xbbcf('0xc'),auth[_0xbbcf('0xa')](),controller[_0xbbcf('0xd')]);router[_0xbbcf('0x9')](_0xbbcf('0xe'),auth[_0xbbcf('0xa')](),controller[_0xbbcf('0xf')]);router[_0xbbcf('0x9')](_0xbbcf('0x10'),auth['isAuthenticated'](),controller[_0xbbcf('0x11')]);router[_0xbbcf('0x9')](_0xbbcf('0x12'),auth[_0xbbcf('0xa')](),controller[_0xbbcf('0x13')]);router[_0xbbcf('0x14')]('/',auth[_0xbbcf('0xa')](),controller['create']);router[_0xbbcf('0x15')]('/:id',auth[_0xbbcf('0xa')](),controller['update']);router[_0xbbcf('0x16')]('/:id',auth[_0xbbcf('0xa')](),controller['destroy']);module[_0xbbcf('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index ead6a34..863fc22 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 _0xf196=['sequelize','STRING'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0xf196,0x130));var _0x6f19=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf196[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x6f19('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6f19('0x1')]}}; \ No newline at end of file +var _0xac84=['sequelize','exports','STRING'];(function(_0x1b8ff4,_0x8ea99c){var _0x1f4acd=function(_0x41beb0){while(--_0x41beb0){_0x1b8ff4['push'](_0x1b8ff4['shift']());}};_0x1f4acd(++_0x8ea99c);}(_0xac84,0x16b));var _0x4ac8=function(_0x53417c,_0x126dee){_0x53417c=_0x53417c-0x0;var _0x49407d=_0xac84[_0x53417c];return _0x49407d;};'use strict';var Sequelize=require(_0x4ac8('0x0'));module[_0x4ac8('0x1')]={'name':{'type':Sequelize[_0x4ac8('0x2')]},'description':{'type':Sequelize[_0x4ac8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index fe63c63..1e66040 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 _0xf6e6=['map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','FreshsalesConfiguration','includeAll','include','rows','catch','params','rawAttributes','create','body','destroy','find','getSubjects','FreshsalesField','pick','getDescriptions','order','getFields','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','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','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','end','error','stack','name','send'];(function(_0x4032e3,_0x6d6449){var _0x34f51a=function(_0x3f77e4){while(--_0x3f77e4){_0x4032e3['push'](_0x4032e3['shift']());}};_0x34f51a(++_0x6d6449);}(_0xf6e6,0xc5));var _0x6f6e=function(_0x55e82d,_0x30e589){_0x55e82d=_0x55e82d-0x0;var _0x2c0887=_0xf6e6[_0x55e82d];return _0x2c0887;};'use strict';var emlformat=require(_0x6f6e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6f6e('0x1'));var jsonpatch=require(_0x6f6e('0x2'));var rp=require(_0x6f6e('0x3'));var moment=require('moment');var BPromise=require(_0x6f6e('0x4'));var Mustache=require(_0x6f6e('0x5'));var util=require(_0x6f6e('0x6'));var path=require(_0x6f6e('0x7'));var sox=require(_0x6f6e('0x8'));var csv=require(_0x6f6e('0x9'));var ejs=require(_0x6f6e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f6e('0xb'));var squel=require('squel');var crypto=require(_0x6f6e('0xc'));var jsforce=require(_0x6f6e('0xd'));var deskjs=require(_0x6f6e('0xe'));var toCsv=require(_0x6f6e('0x9'));var querystring=require(_0x6f6e('0xf'));var Papa=require(_0x6f6e('0x10'));var Redis=require('ioredis');var authService=require(_0x6f6e('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f6e('0x12'));var logger=require(_0x6f6e('0x13'))(_0x6f6e('0x14'));var utils=require(_0x6f6e('0x15'));var config=require(_0x6f6e('0x16'));var licenseUtil=require(_0x6f6e('0x17'));var db=require(_0x6f6e('0x18'))['db'];function respondWithStatusCode(_0xeac4b4,_0x4478e1){_0x4478e1=_0x4478e1||0xcc;return function(_0x33ff9d){if(_0x33ff9d){return _0xeac4b4[_0x6f6e('0x19')](_0x4478e1);}return _0xeac4b4[_0x6f6e('0x1a')](_0x4478e1)['end']();};}function respondWithResult(_0x2c4fbc,_0xddc9e6){_0xddc9e6=_0xddc9e6||0xc8;return function(_0x196529){if(_0x196529){return _0x2c4fbc[_0x6f6e('0x1a')](_0xddc9e6)[_0x6f6e('0x1b')](_0x196529);}};}function respondWithFilteredResult(_0x587e14,_0x524716){return function(_0x3b54b0){if(_0x3b54b0){var _0x43a622=typeof _0x524716['offset']===_0x6f6e('0x1c')&&typeof _0x524716[_0x6f6e('0x1d')]===_0x6f6e('0x1c');var _0x2a7432=_0x3b54b0[_0x6f6e('0x1e')];var _0x367ac5=_0x43a622?0x0:_0x524716[_0x6f6e('0x1f')];var _0x597d39=_0x43a622?_0x3b54b0[_0x6f6e('0x1e')]:_0x524716[_0x6f6e('0x1f')]+_0x524716[_0x6f6e('0x1d')];var _0x1dfe3c;if(_0x597d39>=_0x2a7432){_0x597d39=_0x2a7432;_0x1dfe3c=0xc8;}else{_0x1dfe3c=0xce;}_0x587e14[_0x6f6e('0x1a')](_0x1dfe3c);return _0x587e14[_0x6f6e('0x20')](_0x6f6e('0x21'),_0x367ac5+'-'+_0x597d39+'/'+_0x2a7432)[_0x6f6e('0x1b')](_0x3b54b0);}return null;};}function patchUpdates(_0x591106){return function(_0x908ad2){try{jsonpatch[_0x6f6e('0x22')](_0x908ad2,_0x591106,!![]);}catch(_0x2e97a8){return BPromise['reject'](_0x2e97a8);}return _0x908ad2[_0x6f6e('0x23')]();};}function saveUpdates(_0x561e68,_0x20c4fd){return function(_0x2d477b){if(_0x2d477b){return _0x2d477b[_0x6f6e('0x24')](_0x561e68)[_0x6f6e('0x25')](function(_0x570ca9){return _0x570ca9;});}return null;};}function removeEntity(_0x2244b4,_0x402fe1){return function(_0x21b435){if(_0x21b435){return _0x21b435['destroy']()['then'](function(){_0x2244b4[_0x6f6e('0x1a')](0xcc)[_0x6f6e('0x26')]();});}};}function handleEntityNotFound(_0x281842,_0x2363f2){return function(_0x186158){if(!_0x186158){_0x281842[_0x6f6e('0x19')](0x194);}return _0x186158;};}function handleError(_0x1987f3,_0x5cc8e1){_0x5cc8e1=_0x5cc8e1||0x1f4;return function(_0x598525){logger[_0x6f6e('0x27')](_0x598525[_0x6f6e('0x28')]);if(_0x598525[_0x6f6e('0x29')]){delete _0x598525[_0x6f6e('0x29')];}_0x1987f3[_0x6f6e('0x1a')](_0x5cc8e1)[_0x6f6e('0x2a')](_0x598525);};}exports['index']=function(_0x429cf3,_0x139497){var _0xa939a5={},_0x1f921c={},_0x209371={'count':0x0,'rows':[]};var _0x2799ef=_[_0x6f6e('0x2b')](db['FreshsalesConfiguration']['rawAttributes'],function(_0x2e86f1){return{'name':_0x2e86f1[_0x6f6e('0x2c')],'type':_0x2e86f1[_0x6f6e('0x2d')][_0x6f6e('0x2e')]};});_0x1f921c[_0x6f6e('0x2f')]=_[_0x6f6e('0x2b')](_0x2799ef,_0x6f6e('0x29'));_0x1f921c[_0x6f6e('0x30')]=_[_0x6f6e('0x31')](_0x429cf3[_0x6f6e('0x30')]);_0x1f921c['filters']=_[_0x6f6e('0x32')](_0x1f921c['model'],_0x1f921c[_0x6f6e('0x30')]);_0xa939a5[_0x6f6e('0x33')]=_[_0x6f6e('0x32')](_0x1f921c[_0x6f6e('0x2f')],qs[_0x6f6e('0x34')](_0x429cf3['query']['fields']));_0xa939a5['attributes']=_0xa939a5['attributes'][_0x6f6e('0x35')]?_0xa939a5[_0x6f6e('0x33')]:_0x1f921c[_0x6f6e('0x2f')];if(!_0x429cf3[_0x6f6e('0x30')][_0x6f6e('0x36')](_0x6f6e('0x37'))){_0xa939a5[_0x6f6e('0x1d')]=qs[_0x6f6e('0x1d')](_0x429cf3['query'][_0x6f6e('0x1d')]);_0xa939a5[_0x6f6e('0x1f')]=qs[_0x6f6e('0x1f')](_0x429cf3['query'][_0x6f6e('0x1f')]);}_0xa939a5['order']=qs[_0x6f6e('0x38')](_0x429cf3[_0x6f6e('0x30')][_0x6f6e('0x38')]);_0xa939a5[_0x6f6e('0x39')]=qs[_0x6f6e('0x3a')](_['pick'](_0x429cf3[_0x6f6e('0x30')],_0x1f921c['filters']),_0x2799ef);if(_0x429cf3[_0x6f6e('0x30')][_0x6f6e('0x3b')]){_0xa939a5['where']=_[_0x6f6e('0x3c')](_0xa939a5[_0x6f6e('0x39')],{'$or':_[_0x6f6e('0x2b')](_0x2799ef,function(_0x3a4900){if(_0x3a4900['type']!==_0x6f6e('0x3d')){var _0x243588={};_0x243588[_0x3a4900[_0x6f6e('0x29')]]={'$like':'%'+_0x429cf3[_0x6f6e('0x30')][_0x6f6e('0x3b')]+'%'};return _0x243588;}})});}_0xa939a5=_['merge']({},_0xa939a5,_0x429cf3[_0x6f6e('0x3e')]);var _0x55d54d={'where':_0xa939a5[_0x6f6e('0x39')]};return db[_0x6f6e('0x3f')][_0x6f6e('0x1e')](_0x55d54d)[_0x6f6e('0x25')](function(_0xee6999){_0x209371['count']=_0xee6999;if(_0x429cf3[_0x6f6e('0x30')][_0x6f6e('0x40')]){_0xa939a5[_0x6f6e('0x41')]=[{'all':!![]}];}return db[_0x6f6e('0x3f')]['findAll'](_0xa939a5);})[_0x6f6e('0x25')](function(_0x1a1acc){_0x209371[_0x6f6e('0x42')]=_0x1a1acc;return _0x209371;})['then'](respondWithFilteredResult(_0x139497,_0xa939a5))[_0x6f6e('0x43')](handleError(_0x139497,null));};exports['show']=function(_0x419393,_0x354d8f){var _0x5663d9={'raw':![],'where':{'id':_0x419393[_0x6f6e('0x44')]['id']}},_0x21d030={};_0x21d030['model']=_[_0x6f6e('0x31')](db[_0x6f6e('0x3f')][_0x6f6e('0x45')]);_0x21d030[_0x6f6e('0x30')]=_[_0x6f6e('0x31')](_0x419393[_0x6f6e('0x30')]);_0x21d030[_0x6f6e('0x3a')]=_[_0x6f6e('0x32')](_0x21d030['model'],_0x21d030['query']);_0x5663d9['attributes']=_['intersection'](_0x21d030[_0x6f6e('0x2f')],qs['fields'](_0x419393[_0x6f6e('0x30')][_0x6f6e('0x34')]));_0x5663d9[_0x6f6e('0x33')]=_0x5663d9['attributes']['length']?_0x5663d9[_0x6f6e('0x33')]:_0x21d030[_0x6f6e('0x2f')];if(_0x419393[_0x6f6e('0x30')][_0x6f6e('0x40')]){_0x5663d9[_0x6f6e('0x41')]=[{'all':!![]}];}_0x5663d9=_[_0x6f6e('0x3c')]({},_0x5663d9,_0x419393[_0x6f6e('0x3e')]);return db[_0x6f6e('0x3f')]['find'](_0x5663d9)[_0x6f6e('0x25')](handleEntityNotFound(_0x354d8f,null))[_0x6f6e('0x25')](respondWithResult(_0x354d8f,null))['catch'](handleError(_0x354d8f,null));};exports[_0x6f6e('0x46')]=function(_0x207a51,_0x5b6f94){return db[_0x6f6e('0x3f')][_0x6f6e('0x46')](_0x207a51['body'],{})[_0x6f6e('0x25')](respondWithResult(_0x5b6f94,0xc9))[_0x6f6e('0x43')](handleError(_0x5b6f94,null));};exports['update']=function(_0x2b4cab,_0x9cfa57){if(_0x2b4cab[_0x6f6e('0x47')]['id']){delete _0x2b4cab[_0x6f6e('0x47')]['id'];}return db[_0x6f6e('0x3f')]['find']({'where':{'id':_0x2b4cab['params']['id']}})['then'](handleEntityNotFound(_0x9cfa57,null))[_0x6f6e('0x25')](saveUpdates(_0x2b4cab[_0x6f6e('0x47')],null))['then'](respondWithResult(_0x9cfa57,null))[_0x6f6e('0x43')](handleError(_0x9cfa57,null));};exports[_0x6f6e('0x48')]=function(_0x4d80b8,_0x5cba02){return db['FreshsalesConfiguration'][_0x6f6e('0x49')]({'where':{'id':_0x4d80b8['params']['id']}})[_0x6f6e('0x25')](handleEntityNotFound(_0x5cba02,null))[_0x6f6e('0x25')](removeEntity(_0x5cba02,null))[_0x6f6e('0x43')](handleError(_0x5cba02,null));};exports[_0x6f6e('0x4a')]=function(_0x2460b0,_0x24f778,_0x2f1d70){var _0x350494={};var _0x496a4f={};var _0x1d588f;var _0x19eac3;return db[_0x6f6e('0x3f')]['findOne']({'where':{'id':_0x2460b0[_0x6f6e('0x44')]['id']}})[_0x6f6e('0x25')](handleEntityNotFound(_0x24f778,null))[_0x6f6e('0x25')](function(_0x7d76ac){if(_0x7d76ac){_0x1d588f=_0x7d76ac;_0x496a4f[_0x6f6e('0x2f')]=_[_0x6f6e('0x31')](db[_0x6f6e('0x4b')][_0x6f6e('0x45')]);_0x496a4f[_0x6f6e('0x30')]=_[_0x6f6e('0x31')](_0x2460b0[_0x6f6e('0x30')]);_0x496a4f[_0x6f6e('0x3a')]=_[_0x6f6e('0x32')](_0x496a4f[_0x6f6e('0x2f')],_0x496a4f[_0x6f6e('0x30')]);_0x350494['attributes']=_[_0x6f6e('0x32')](_0x496a4f['model'],qs[_0x6f6e('0x34')](_0x2460b0[_0x6f6e('0x30')][_0x6f6e('0x34')]));_0x350494['attributes']=_0x350494[_0x6f6e('0x33')][_0x6f6e('0x35')]?_0x350494['attributes']:_0x496a4f[_0x6f6e('0x2f')];_0x350494['order']=qs[_0x6f6e('0x38')](_0x2460b0[_0x6f6e('0x30')][_0x6f6e('0x38')]);_0x350494[_0x6f6e('0x39')]=qs[_0x6f6e('0x3a')](_[_0x6f6e('0x4c')](_0x2460b0[_0x6f6e('0x30')],_0x496a4f[_0x6f6e('0x3a')]));if(_0x2460b0['query'][_0x6f6e('0x3b')]){_0x350494[_0x6f6e('0x39')]=_[_0x6f6e('0x3c')](_0x350494['where'],{'$or':_[_0x6f6e('0x2b')](_0x350494['attributes'],function(_0x161512){var _0x5c1f99={};_0x5c1f99[_0x161512]={'$like':'%'+_0x2460b0[_0x6f6e('0x30')][_0x6f6e('0x3b')]+'%'};return _0x5c1f99;})});}_0x350494=_[_0x6f6e('0x3c')]({},_0x350494,_0x2460b0['options']);return _0x1d588f['getSubjects'](_0x350494);}})[_0x6f6e('0x25')](function(_0x18f24c){if(_0x18f24c){_0x19eac3=_0x18f24c[_0x6f6e('0x35')];if(!_0x2460b0['query'][_0x6f6e('0x36')]('nolimit')){_0x350494[_0x6f6e('0x1d')]=qs[_0x6f6e('0x1d')](_0x2460b0[_0x6f6e('0x30')]['limit']);_0x350494['offset']=qs[_0x6f6e('0x1f')](_0x2460b0[_0x6f6e('0x30')][_0x6f6e('0x1f')]);}return _0x1d588f[_0x6f6e('0x4a')](_0x350494);}})[_0x6f6e('0x25')](function(_0x222d64){if(_0x222d64){return _0x222d64?{'count':_0x19eac3,'rows':_0x222d64}:null;}})[_0x6f6e('0x25')](respondWithResult(_0x24f778,null))[_0x6f6e('0x43')](handleError(_0x24f778,null));};exports[_0x6f6e('0x4d')]=function(_0x2d3f3f,_0x338d6b,_0x5abca1){var _0x1f999f={};var _0x585078={};var _0x485769;var _0x225ab7;return db[_0x6f6e('0x3f')]['findOne']({'where':{'id':_0x2d3f3f['params']['id']}})[_0x6f6e('0x25')](handleEntityNotFound(_0x338d6b,null))[_0x6f6e('0x25')](function(_0x45de7b){if(_0x45de7b){_0x485769=_0x45de7b;_0x585078[_0x6f6e('0x2f')]=_[_0x6f6e('0x31')](db[_0x6f6e('0x4b')][_0x6f6e('0x45')]);_0x585078[_0x6f6e('0x30')]=_[_0x6f6e('0x31')](_0x2d3f3f[_0x6f6e('0x30')]);_0x585078[_0x6f6e('0x3a')]=_['intersection'](_0x585078['model'],_0x585078[_0x6f6e('0x30')]);_0x1f999f[_0x6f6e('0x33')]=_[_0x6f6e('0x32')](_0x585078['model'],qs['fields'](_0x2d3f3f[_0x6f6e('0x30')][_0x6f6e('0x34')]));_0x1f999f[_0x6f6e('0x33')]=_0x1f999f['attributes'][_0x6f6e('0x35')]?_0x1f999f[_0x6f6e('0x33')]:_0x585078[_0x6f6e('0x2f')];_0x1f999f[_0x6f6e('0x4e')]=qs[_0x6f6e('0x38')](_0x2d3f3f[_0x6f6e('0x30')]['sort']);_0x1f999f[_0x6f6e('0x39')]=qs[_0x6f6e('0x3a')](_[_0x6f6e('0x4c')](_0x2d3f3f[_0x6f6e('0x30')],_0x585078[_0x6f6e('0x3a')]));if(_0x2d3f3f[_0x6f6e('0x30')][_0x6f6e('0x3b')]){_0x1f999f[_0x6f6e('0x39')]=_[_0x6f6e('0x3c')](_0x1f999f[_0x6f6e('0x39')],{'$or':_[_0x6f6e('0x2b')](_0x1f999f[_0x6f6e('0x33')],function(_0x585fa7){var _0x237459={};_0x237459[_0x585fa7]={'$like':'%'+_0x2d3f3f[_0x6f6e('0x30')][_0x6f6e('0x3b')]+'%'};return _0x237459;})});}_0x1f999f=_[_0x6f6e('0x3c')]({},_0x1f999f,_0x2d3f3f[_0x6f6e('0x3e')]);return _0x485769[_0x6f6e('0x4d')](_0x1f999f);}})['then'](function(_0x5916db){if(_0x5916db){_0x225ab7=_0x5916db[_0x6f6e('0x35')];if(!_0x2d3f3f[_0x6f6e('0x30')][_0x6f6e('0x36')](_0x6f6e('0x37'))){_0x1f999f[_0x6f6e('0x1d')]=qs['limit'](_0x2d3f3f['query']['limit']);_0x1f999f[_0x6f6e('0x1f')]=qs[_0x6f6e('0x1f')](_0x2d3f3f[_0x6f6e('0x30')][_0x6f6e('0x1f')]);}return _0x485769[_0x6f6e('0x4d')](_0x1f999f);}})[_0x6f6e('0x25')](function(_0x10be30){if(_0x10be30){return _0x10be30?{'count':_0x225ab7,'rows':_0x10be30}:null;}})[_0x6f6e('0x25')](respondWithResult(_0x338d6b,null))[_0x6f6e('0x43')](handleError(_0x338d6b,null));};exports[_0x6f6e('0x4f')]=function(_0x30ee36,_0xe8b4ee,_0x1c9364){var _0x1411b5={};var _0x4ccde1={};var _0x59f428;var _0x112fcd;return db[_0x6f6e('0x3f')]['findOne']({'where':{'id':_0x30ee36[_0x6f6e('0x44')]['id']}})[_0x6f6e('0x25')](handleEntityNotFound(_0xe8b4ee,null))['then'](function(_0x58ed68){if(_0x58ed68){_0x59f428=_0x58ed68;_0x4ccde1['model']=_[_0x6f6e('0x31')](db[_0x6f6e('0x4b')]['rawAttributes']);_0x4ccde1[_0x6f6e('0x30')]=_[_0x6f6e('0x31')](_0x30ee36[_0x6f6e('0x30')]);_0x4ccde1['filters']=_[_0x6f6e('0x32')](_0x4ccde1[_0x6f6e('0x2f')],_0x4ccde1[_0x6f6e('0x30')]);_0x1411b5[_0x6f6e('0x33')]=_[_0x6f6e('0x32')](_0x4ccde1['model'],qs[_0x6f6e('0x34')](_0x30ee36[_0x6f6e('0x30')][_0x6f6e('0x34')]));_0x1411b5[_0x6f6e('0x33')]=_0x1411b5['attributes']['length']?_0x1411b5[_0x6f6e('0x33')]:_0x4ccde1[_0x6f6e('0x2f')];_0x1411b5[_0x6f6e('0x4e')]=qs['sort'](_0x30ee36[_0x6f6e('0x30')]['sort']);_0x1411b5['where']=qs['filters'](_[_0x6f6e('0x4c')](_0x30ee36[_0x6f6e('0x30')],_0x4ccde1[_0x6f6e('0x3a')]));if(_0x30ee36[_0x6f6e('0x30')][_0x6f6e('0x3b')]){_0x1411b5[_0x6f6e('0x39')]=_[_0x6f6e('0x3c')](_0x1411b5[_0x6f6e('0x39')],{'$or':_['map'](_0x1411b5[_0x6f6e('0x33')],function(_0x34c917){var _0x47223a={};_0x47223a[_0x34c917]={'$like':'%'+_0x30ee36[_0x6f6e('0x30')][_0x6f6e('0x3b')]+'%'};return _0x47223a;})});}_0x1411b5=_['merge']({},_0x1411b5,_0x30ee36['options']);return _0x59f428['getFields'](_0x1411b5);}})[_0x6f6e('0x25')](function(_0x2bd758){if(_0x2bd758){_0x112fcd=_0x2bd758[_0x6f6e('0x35')];if(!_0x30ee36[_0x6f6e('0x30')][_0x6f6e('0x36')](_0x6f6e('0x37'))){_0x1411b5[_0x6f6e('0x1d')]=qs[_0x6f6e('0x1d')](_0x30ee36[_0x6f6e('0x30')][_0x6f6e('0x1d')]);_0x1411b5[_0x6f6e('0x1f')]=qs[_0x6f6e('0x1f')](_0x30ee36['query'][_0x6f6e('0x1f')]);}return _0x59f428['getFields'](_0x1411b5);}})['then'](function(_0x51d2a5){if(_0x51d2a5){return _0x51d2a5?{'count':_0x112fcd,'rows':_0x51d2a5}:null;}})['then'](respondWithResult(_0xe8b4ee,null))[_0x6f6e('0x43')](handleError(_0xe8b4ee,null));}; \ No newline at end of file +var _0xa9ea=['stack','name','send','index','FreshsalesConfiguration','fieldName','type','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','keys','options','find','create','body','update','getSubjects','FreshsalesField','rawAttributes','order','pick','getDescriptions','findOne','getFields','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end'];(function(_0x4d3774,_0x12f7a8){var _0x23cb6d=function(_0x3876eb){while(--_0x3876eb){_0x4d3774['push'](_0x4d3774['shift']());}};_0x23cb6d(++_0x12f7a8);}(_0xa9ea,0x7b));var _0xaa9e=function(_0x2563e4,_0x456262){_0x2563e4=_0x2563e4-0x0;var _0x53e6d8=_0xa9ea[_0x2563e4];return _0x53e6d8;};'use strict';var emlformat=require(_0xaa9e('0x0'));var rimraf=require(_0xaa9e('0x1'));var zipdir=require(_0xaa9e('0x2'));var jsonpatch=require(_0xaa9e('0x3'));var rp=require(_0xaa9e('0x4'));var moment=require(_0xaa9e('0x5'));var BPromise=require(_0xaa9e('0x6'));var Mustache=require(_0xaa9e('0x7'));var util=require(_0xaa9e('0x8'));var path=require(_0xaa9e('0x9'));var sox=require('sox');var csv=require(_0xaa9e('0xa'));var ejs=require(_0xaa9e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa9e('0xc'));var squel=require(_0xaa9e('0xd'));var crypto=require(_0xaa9e('0xe'));var jsforce=require(_0xaa9e('0xf'));var deskjs=require(_0xaa9e('0x10'));var toCsv=require(_0xaa9e('0xa'));var querystring=require(_0xaa9e('0x11'));var Papa=require(_0xaa9e('0x12'));var Redis=require(_0xaa9e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xaa9e('0x14'));var as=require(_0xaa9e('0x15'));var hardwareService=require(_0xaa9e('0x16'));var logger=require(_0xaa9e('0x17'))(_0xaa9e('0x18'));var utils=require(_0xaa9e('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaa9e('0x1a'))['db'];function respondWithStatusCode(_0x4218b2,_0x334ce5){_0x334ce5=_0x334ce5||0xcc;return function(_0x52c273){if(_0x52c273){return _0x4218b2[_0xaa9e('0x1b')](_0x334ce5);}return _0x4218b2[_0xaa9e('0x1c')](_0x334ce5)['end']();};}function respondWithResult(_0x6e7b66,_0xaa229d){_0xaa229d=_0xaa229d||0xc8;return function(_0x2421e5){if(_0x2421e5){return _0x6e7b66[_0xaa9e('0x1c')](_0xaa229d)[_0xaa9e('0x1d')](_0x2421e5);}};}function respondWithFilteredResult(_0x2a1a60,_0x41e6df){return function(_0x1ec317){if(_0x1ec317){var _0x1a0efb=typeof _0x41e6df[_0xaa9e('0x1e')]===_0xaa9e('0x1f')&&typeof _0x41e6df[_0xaa9e('0x20')]===_0xaa9e('0x1f');var _0x1cc07b=_0x1ec317[_0xaa9e('0x21')];var _0x78b7a2=_0x1a0efb?0x0:_0x41e6df['offset'];var _0x52a538=_0x1a0efb?_0x1ec317[_0xaa9e('0x21')]:_0x41e6df[_0xaa9e('0x1e')]+_0x41e6df['limit'];var _0x1d153f;if(_0x52a538>=_0x1cc07b){_0x52a538=_0x1cc07b;_0x1d153f=0xc8;}else{_0x1d153f=0xce;}_0x2a1a60[_0xaa9e('0x1c')](_0x1d153f);return _0x2a1a60[_0xaa9e('0x22')]('Content-Range',_0x78b7a2+'-'+_0x52a538+'/'+_0x1cc07b)[_0xaa9e('0x1d')](_0x1ec317);}return null;};}function patchUpdates(_0xbd5162){return function(_0x426b54){try{jsonpatch[_0xaa9e('0x23')](_0x426b54,_0xbd5162,!![]);}catch(_0x4458bd){return BPromise[_0xaa9e('0x24')](_0x4458bd);}return _0x426b54[_0xaa9e('0x25')]();};}function saveUpdates(_0x3b4b95,_0x413675){return function(_0x21c4c7){if(_0x21c4c7){return _0x21c4c7['update'](_0x3b4b95)[_0xaa9e('0x26')](function(_0x39d2aa){return _0x39d2aa;});}return null;};}function removeEntity(_0x9906d8,_0x2ed3b9){return function(_0x5bf58e){if(_0x5bf58e){return _0x5bf58e[_0xaa9e('0x27')]()[_0xaa9e('0x26')](function(){_0x9906d8[_0xaa9e('0x1c')](0xcc)[_0xaa9e('0x28')]();});}};}function handleEntityNotFound(_0x154673,_0x1813b7){return function(_0x349c55){if(!_0x349c55){_0x154673[_0xaa9e('0x1b')](0x194);}return _0x349c55;};}function handleError(_0xae5501,_0x202b6b){_0x202b6b=_0x202b6b||0x1f4;return function(_0x3c18c5){logger['error'](_0x3c18c5[_0xaa9e('0x29')]);if(_0x3c18c5['name']){delete _0x3c18c5[_0xaa9e('0x2a')];}_0xae5501[_0xaa9e('0x1c')](_0x202b6b)[_0xaa9e('0x2b')](_0x3c18c5);};}exports[_0xaa9e('0x2c')]=function(_0x27e2be,_0x44aac7){var _0xd00ecf={},_0x4aa028={},_0x4f057e={'count':0x0,'rows':[]};var _0x1b163a=_['map'](db[_0xaa9e('0x2d')]['rawAttributes'],function(_0x5f4783){return{'name':_0x5f4783[_0xaa9e('0x2e')],'type':_0x5f4783[_0xaa9e('0x2f')]['key']};});_0x4aa028[_0xaa9e('0x30')]=_[_0xaa9e('0x31')](_0x1b163a,_0xaa9e('0x2a'));_0x4aa028['query']=_['keys'](_0x27e2be[_0xaa9e('0x32')]);_0x4aa028[_0xaa9e('0x33')]=_['intersection'](_0x4aa028[_0xaa9e('0x30')],_0x4aa028[_0xaa9e('0x32')]);_0xd00ecf[_0xaa9e('0x34')]=_[_0xaa9e('0x35')](_0x4aa028[_0xaa9e('0x30')],qs[_0xaa9e('0x36')](_0x27e2be['query'][_0xaa9e('0x36')]));_0xd00ecf[_0xaa9e('0x34')]=_0xd00ecf[_0xaa9e('0x34')][_0xaa9e('0x37')]?_0xd00ecf['attributes']:_0x4aa028[_0xaa9e('0x30')];if(!_0x27e2be['query'][_0xaa9e('0x38')](_0xaa9e('0x39'))){_0xd00ecf[_0xaa9e('0x20')]=qs['limit'](_0x27e2be['query']['limit']);_0xd00ecf[_0xaa9e('0x1e')]=qs[_0xaa9e('0x1e')](_0x27e2be['query'][_0xaa9e('0x1e')]);}_0xd00ecf['order']=qs[_0xaa9e('0x3a')](_0x27e2be[_0xaa9e('0x32')][_0xaa9e('0x3a')]);_0xd00ecf[_0xaa9e('0x3b')]=qs[_0xaa9e('0x33')](_['pick'](_0x27e2be['query'],_0x4aa028['filters']),_0x1b163a);if(_0x27e2be['query'][_0xaa9e('0x3c')]){_0xd00ecf[_0xaa9e('0x3b')]=_[_0xaa9e('0x3d')](_0xd00ecf[_0xaa9e('0x3b')],{'$or':_[_0xaa9e('0x31')](_0x1b163a,function(_0x58c162){if(_0x58c162[_0xaa9e('0x2f')]!==_0xaa9e('0x3e')){var _0x424a1c={};_0x424a1c[_0x58c162[_0xaa9e('0x2a')]]={'$like':'%'+_0x27e2be[_0xaa9e('0x32')][_0xaa9e('0x3c')]+'%'};return _0x424a1c;}})});}_0xd00ecf=_[_0xaa9e('0x3d')]({},_0xd00ecf,_0x27e2be['options']);var _0x3d1b3c={'where':_0xd00ecf[_0xaa9e('0x3b')]};return db[_0xaa9e('0x2d')][_0xaa9e('0x21')](_0x3d1b3c)[_0xaa9e('0x26')](function(_0x3daf0d){_0x4f057e[_0xaa9e('0x21')]=_0x3daf0d;if(_0x27e2be[_0xaa9e('0x32')][_0xaa9e('0x3f')]){_0xd00ecf[_0xaa9e('0x40')]=[{'all':!![]}];}return db[_0xaa9e('0x2d')]['findAll'](_0xd00ecf);})['then'](function(_0x17cd5b){_0x4f057e[_0xaa9e('0x41')]=_0x17cd5b;return _0x4f057e;})[_0xaa9e('0x26')](respondWithFilteredResult(_0x44aac7,_0xd00ecf))[_0xaa9e('0x42')](handleError(_0x44aac7,null));};exports['show']=function(_0x5eefc9,_0x428de6){var _0x22517e={'raw':![],'where':{'id':_0x5eefc9[_0xaa9e('0x43')]['id']}},_0x48fb0f={};_0x48fb0f[_0xaa9e('0x30')]=_[_0xaa9e('0x44')](db['FreshsalesConfiguration']['rawAttributes']);_0x48fb0f[_0xaa9e('0x32')]=_[_0xaa9e('0x44')](_0x5eefc9[_0xaa9e('0x32')]);_0x48fb0f[_0xaa9e('0x33')]=_[_0xaa9e('0x35')](_0x48fb0f[_0xaa9e('0x30')],_0x48fb0f['query']);_0x22517e[_0xaa9e('0x34')]=_['intersection'](_0x48fb0f[_0xaa9e('0x30')],qs[_0xaa9e('0x36')](_0x5eefc9[_0xaa9e('0x32')][_0xaa9e('0x36')]));_0x22517e[_0xaa9e('0x34')]=_0x22517e[_0xaa9e('0x34')][_0xaa9e('0x37')]?_0x22517e[_0xaa9e('0x34')]:_0x48fb0f['model'];if(_0x5eefc9[_0xaa9e('0x32')][_0xaa9e('0x3f')]){_0x22517e['include']=[{'all':!![]}];}_0x22517e=_[_0xaa9e('0x3d')]({},_0x22517e,_0x5eefc9[_0xaa9e('0x45')]);return db[_0xaa9e('0x2d')][_0xaa9e('0x46')](_0x22517e)[_0xaa9e('0x26')](handleEntityNotFound(_0x428de6,null))['then'](respondWithResult(_0x428de6,null))['catch'](handleError(_0x428de6,null));};exports[_0xaa9e('0x47')]=function(_0x2867f3,_0x5d4407){return db[_0xaa9e('0x2d')][_0xaa9e('0x47')](_0x2867f3[_0xaa9e('0x48')],{})[_0xaa9e('0x26')](respondWithResult(_0x5d4407,0xc9))[_0xaa9e('0x42')](handleError(_0x5d4407,null));};exports[_0xaa9e('0x49')]=function(_0x12be09,_0x51d374){if(_0x12be09[_0xaa9e('0x48')]['id']){delete _0x12be09['body']['id'];}return db[_0xaa9e('0x2d')][_0xaa9e('0x46')]({'where':{'id':_0x12be09[_0xaa9e('0x43')]['id']}})[_0xaa9e('0x26')](handleEntityNotFound(_0x51d374,null))[_0xaa9e('0x26')](saveUpdates(_0x12be09[_0xaa9e('0x48')],null))[_0xaa9e('0x26')](respondWithResult(_0x51d374,null))[_0xaa9e('0x42')](handleError(_0x51d374,null));};exports[_0xaa9e('0x27')]=function(_0x16e3ee,_0x371b7d){return db[_0xaa9e('0x2d')]['find']({'where':{'id':_0x16e3ee['params']['id']}})[_0xaa9e('0x26')](handleEntityNotFound(_0x371b7d,null))[_0xaa9e('0x26')](removeEntity(_0x371b7d,null))['catch'](handleError(_0x371b7d,null));};exports[_0xaa9e('0x4a')]=function(_0x5c54e2,_0x139f69,_0x470bbd){var _0x17c32d={};var _0xac5f80={};var _0x3ff7b9;var _0x1d6ea1;return db[_0xaa9e('0x2d')]['findOne']({'where':{'id':_0x5c54e2[_0xaa9e('0x43')]['id']}})[_0xaa9e('0x26')](handleEntityNotFound(_0x139f69,null))[_0xaa9e('0x26')](function(_0x30d616){if(_0x30d616){_0x3ff7b9=_0x30d616;_0xac5f80['model']=_[_0xaa9e('0x44')](db[_0xaa9e('0x4b')][_0xaa9e('0x4c')]);_0xac5f80[_0xaa9e('0x32')]=_[_0xaa9e('0x44')](_0x5c54e2[_0xaa9e('0x32')]);_0xac5f80['filters']=_['intersection'](_0xac5f80[_0xaa9e('0x30')],_0xac5f80[_0xaa9e('0x32')]);_0x17c32d[_0xaa9e('0x34')]=_['intersection'](_0xac5f80[_0xaa9e('0x30')],qs[_0xaa9e('0x36')](_0x5c54e2[_0xaa9e('0x32')][_0xaa9e('0x36')]));_0x17c32d[_0xaa9e('0x34')]=_0x17c32d[_0xaa9e('0x34')]['length']?_0x17c32d[_0xaa9e('0x34')]:_0xac5f80[_0xaa9e('0x30')];_0x17c32d[_0xaa9e('0x4d')]=qs[_0xaa9e('0x3a')](_0x5c54e2[_0xaa9e('0x32')][_0xaa9e('0x3a')]);_0x17c32d[_0xaa9e('0x3b')]=qs[_0xaa9e('0x33')](_[_0xaa9e('0x4e')](_0x5c54e2['query'],_0xac5f80['filters']));if(_0x5c54e2['query'][_0xaa9e('0x3c')]){_0x17c32d[_0xaa9e('0x3b')]=_[_0xaa9e('0x3d')](_0x17c32d['where'],{'$or':_[_0xaa9e('0x31')](_0x17c32d[_0xaa9e('0x34')],function(_0x5ea305){var _0x6cc721={};_0x6cc721[_0x5ea305]={'$like':'%'+_0x5c54e2['query'][_0xaa9e('0x3c')]+'%'};return _0x6cc721;})});}_0x17c32d=_['merge']({},_0x17c32d,_0x5c54e2[_0xaa9e('0x45')]);return _0x3ff7b9['getSubjects'](_0x17c32d);}})[_0xaa9e('0x26')](function(_0x3c0704){if(_0x3c0704){_0x1d6ea1=_0x3c0704[_0xaa9e('0x37')];if(!_0x5c54e2[_0xaa9e('0x32')][_0xaa9e('0x38')]('nolimit')){_0x17c32d[_0xaa9e('0x20')]=qs[_0xaa9e('0x20')](_0x5c54e2['query'][_0xaa9e('0x20')]);_0x17c32d['offset']=qs[_0xaa9e('0x1e')](_0x5c54e2['query'][_0xaa9e('0x1e')]);}return _0x3ff7b9[_0xaa9e('0x4a')](_0x17c32d);}})[_0xaa9e('0x26')](function(_0x193095){if(_0x193095){return _0x193095?{'count':_0x1d6ea1,'rows':_0x193095}:null;}})['then'](respondWithResult(_0x139f69,null))['catch'](handleError(_0x139f69,null));};exports[_0xaa9e('0x4f')]=function(_0x13c5f3,_0x3b6fc3,_0x9ef3a0){var _0x25a107={};var _0x4b2a57={};var _0x5d9404;var _0x38d148;return db[_0xaa9e('0x2d')][_0xaa9e('0x50')]({'where':{'id':_0x13c5f3[_0xaa9e('0x43')]['id']}})[_0xaa9e('0x26')](handleEntityNotFound(_0x3b6fc3,null))[_0xaa9e('0x26')](function(_0x5928c8){if(_0x5928c8){_0x5d9404=_0x5928c8;_0x4b2a57[_0xaa9e('0x30')]=_[_0xaa9e('0x44')](db[_0xaa9e('0x4b')][_0xaa9e('0x4c')]);_0x4b2a57[_0xaa9e('0x32')]=_['keys'](_0x13c5f3[_0xaa9e('0x32')]);_0x4b2a57['filters']=_['intersection'](_0x4b2a57['model'],_0x4b2a57['query']);_0x25a107[_0xaa9e('0x34')]=_['intersection'](_0x4b2a57[_0xaa9e('0x30')],qs['fields'](_0x13c5f3['query']['fields']));_0x25a107['attributes']=_0x25a107[_0xaa9e('0x34')][_0xaa9e('0x37')]?_0x25a107[_0xaa9e('0x34')]:_0x4b2a57[_0xaa9e('0x30')];_0x25a107[_0xaa9e('0x4d')]=qs[_0xaa9e('0x3a')](_0x13c5f3[_0xaa9e('0x32')][_0xaa9e('0x3a')]);_0x25a107[_0xaa9e('0x3b')]=qs[_0xaa9e('0x33')](_[_0xaa9e('0x4e')](_0x13c5f3['query'],_0x4b2a57[_0xaa9e('0x33')]));if(_0x13c5f3[_0xaa9e('0x32')][_0xaa9e('0x3c')]){_0x25a107[_0xaa9e('0x3b')]=_['merge'](_0x25a107[_0xaa9e('0x3b')],{'$or':_[_0xaa9e('0x31')](_0x25a107[_0xaa9e('0x34')],function(_0x71e63){var _0x20afe5={};_0x20afe5[_0x71e63]={'$like':'%'+_0x13c5f3[_0xaa9e('0x32')]['filter']+'%'};return _0x20afe5;})});}_0x25a107=_[_0xaa9e('0x3d')]({},_0x25a107,_0x13c5f3[_0xaa9e('0x45')]);return _0x5d9404['getDescriptions'](_0x25a107);}})[_0xaa9e('0x26')](function(_0xa41933){if(_0xa41933){_0x38d148=_0xa41933['length'];if(!_0x13c5f3[_0xaa9e('0x32')][_0xaa9e('0x38')](_0xaa9e('0x39'))){_0x25a107[_0xaa9e('0x20')]=qs[_0xaa9e('0x20')](_0x13c5f3[_0xaa9e('0x32')][_0xaa9e('0x20')]);_0x25a107['offset']=qs['offset'](_0x13c5f3['query']['offset']);}return _0x5d9404[_0xaa9e('0x4f')](_0x25a107);}})[_0xaa9e('0x26')](function(_0x38be4d){if(_0x38be4d){return _0x38be4d?{'count':_0x38d148,'rows':_0x38be4d}:null;}})[_0xaa9e('0x26')](respondWithResult(_0x3b6fc3,null))[_0xaa9e('0x42')](handleError(_0x3b6fc3,null));};exports[_0xaa9e('0x51')]=function(_0x5bdb96,_0x322791,_0x192509){var _0x58a8ba={};var _0x472c85={};var _0x1ad5e5;var _0x14d72c;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x5bdb96[_0xaa9e('0x43')]['id']}})[_0xaa9e('0x26')](handleEntityNotFound(_0x322791,null))['then'](function(_0xa2751d){if(_0xa2751d){_0x1ad5e5=_0xa2751d;_0x472c85['model']=_[_0xaa9e('0x44')](db['FreshsalesField'][_0xaa9e('0x4c')]);_0x472c85[_0xaa9e('0x32')]=_[_0xaa9e('0x44')](_0x5bdb96[_0xaa9e('0x32')]);_0x472c85[_0xaa9e('0x33')]=_[_0xaa9e('0x35')](_0x472c85[_0xaa9e('0x30')],_0x472c85['query']);_0x58a8ba[_0xaa9e('0x34')]=_[_0xaa9e('0x35')](_0x472c85[_0xaa9e('0x30')],qs[_0xaa9e('0x36')](_0x5bdb96['query'][_0xaa9e('0x36')]));_0x58a8ba[_0xaa9e('0x34')]=_0x58a8ba[_0xaa9e('0x34')][_0xaa9e('0x37')]?_0x58a8ba[_0xaa9e('0x34')]:_0x472c85[_0xaa9e('0x30')];_0x58a8ba[_0xaa9e('0x4d')]=qs['sort'](_0x5bdb96[_0xaa9e('0x32')]['sort']);_0x58a8ba[_0xaa9e('0x3b')]=qs['filters'](_['pick'](_0x5bdb96[_0xaa9e('0x32')],_0x472c85[_0xaa9e('0x33')]));if(_0x5bdb96[_0xaa9e('0x32')][_0xaa9e('0x3c')]){_0x58a8ba[_0xaa9e('0x3b')]=_[_0xaa9e('0x3d')](_0x58a8ba[_0xaa9e('0x3b')],{'$or':_['map'](_0x58a8ba[_0xaa9e('0x34')],function(_0x4ad239){var _0x4d9685={};_0x4d9685[_0x4ad239]={'$like':'%'+_0x5bdb96['query'][_0xaa9e('0x3c')]+'%'};return _0x4d9685;})});}_0x58a8ba=_[_0xaa9e('0x3d')]({},_0x58a8ba,_0x5bdb96[_0xaa9e('0x45')]);return _0x1ad5e5[_0xaa9e('0x51')](_0x58a8ba);}})[_0xaa9e('0x26')](function(_0x190848){if(_0x190848){_0x14d72c=_0x190848[_0xaa9e('0x37')];if(!_0x5bdb96[_0xaa9e('0x32')][_0xaa9e('0x38')](_0xaa9e('0x39'))){_0x58a8ba[_0xaa9e('0x20')]=qs[_0xaa9e('0x20')](_0x5bdb96['query'][_0xaa9e('0x20')]);_0x58a8ba['offset']=qs[_0xaa9e('0x1e')](_0x5bdb96[_0xaa9e('0x32')][_0xaa9e('0x1e')]);}return _0x1ad5e5[_0xaa9e('0x51')](_0x58a8ba);}})['then'](function(_0x1bb98c){if(_0x1bb98c){return _0x1bb98c?{'count':_0x14d72c,'rows':_0x1bb98c}:null;}})[_0xaa9e('0x26')](respondWithResult(_0x322791,null))[_0xaa9e('0x42')](handleError(_0x322791,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 9fcce51..4241c37 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 _0xb4d3=['int_freshsales_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports'];(function(_0x436849,_0x430b00){var _0x5c5f73=function(_0x5bdf78){while(--_0x5bdf78){_0x436849['push'](_0x436849['shift']());}};_0x5c5f73(++_0x430b00);}(_0xb4d3,0x79));var _0x3b4d=function(_0x1f6e71,_0x19360b){_0x1f6e71=_0x1f6e71-0x0;var _0x2271aa=_0xb4d3[_0x1f6e71];return _0x2271aa;};'use strict';var _=require(_0x3b4d('0x0'));var util=require(_0x3b4d('0x1'));var logger=require('../../config/logger')(_0x3b4d('0x2'));var moment=require(_0x3b4d('0x3'));var BPromise=require(_0x3b4d('0x4'));var rp=require(_0x3b4d('0x5'));var fs=require('fs');var path=require(_0x3b4d('0x6'));var rimraf=require(_0x3b4d('0x7'));var config=require(_0x3b4d('0x8'));var attributes=require(_0x3b4d('0x9'));module[_0x3b4d('0xa')]=function(_0x461164,_0x3fec7d){return _0x461164['define']('FreshsalesConfiguration',attributes,{'tableName':_0x3b4d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c9e=['moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x3c9e,0x1d1));var _0xe3c9=function(_0x3e1ffb,_0x16d000){_0x3e1ffb=_0x3e1ffb-0x0;var _0x4a28c6=_0x3c9e[_0x3e1ffb];return _0x4a28c6;};'use strict';var _=require(_0xe3c9('0x0'));var util=require(_0xe3c9('0x1'));var logger=require(_0xe3c9('0x2'))('api');var moment=require(_0xe3c9('0x3'));var BPromise=require(_0xe3c9('0x4'));var rp=require(_0xe3c9('0x5'));var fs=require('fs');var path=require(_0xe3c9('0x6'));var rimraf=require('rimraf');var config=require(_0xe3c9('0x7'));var attributes=require(_0xe3c9('0x8'));module[_0xe3c9('0x9')]=function(_0xfb73c1,_0x305246){return _0xfb73c1[_0xe3c9('0xa')](_0xe3c9('0xb'),attributes,{'tableName':_0xe3c9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 42056de..dc3806a 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 _0x4833=['result','catch','lodash','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x138b2c,_0x142181){var _0xa8b921=function(_0xc1799e){while(--_0xc1799e){_0x138b2c['push'](_0x138b2c['shift']());}};_0xa8b921(++_0x142181);}(_0x4833,0x191));var _0x3483=function(_0x53fc07,_0x4812f0){_0x53fc07=_0x53fc07-0x0;var _0x1eceb6=_0x4833[_0x53fc07];return _0x1eceb6;};'use strict';var _=require(_0x3483('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3483('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3483('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x3483('0x3'))(_0x3483('0x4'));var config=require(_0x3483('0x5'));var jayson=require(_0x3483('0x6'));var client=jayson[_0x3483('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x382b2e,_0x332b3c,_0x19d0dd){return new BPromise(function(_0x1fa3a2,_0x3d9c83){return client[_0x3483('0x8')](_0x382b2e,_0x19d0dd)[_0x3483('0x9')](function(_0x31c7c6){logger[_0x3483('0xa')](_0x3483('0xb'),_0x332b3c,_0x3483('0xc'));logger[_0x3483('0xd')](_0x3483('0xe'),_0x332b3c,_0x3483('0xc'),JSON[_0x3483('0xf')](_0x31c7c6));if(_0x31c7c6[_0x3483('0x10')]){if(_0x31c7c6[_0x3483('0x10')][_0x3483('0x11')]===0x1f4){logger[_0x3483('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x332b3c,_0x31c7c6[_0x3483('0x10')][_0x3483('0x12')]);return _0x3d9c83(_0x31c7c6['error'][_0x3483('0x12')]);}logger[_0x3483('0x10')](_0x3483('0xb'),_0x332b3c,_0x31c7c6[_0x3483('0x10')][_0x3483('0x12')]);return _0x1fa3a2(_0x31c7c6['error']['message']);}else{logger['info'](_0x3483('0xb'),_0x332b3c,'request\x20sent');_0x1fa3a2(_0x31c7c6[_0x3483('0x13')][_0x3483('0x12')]);}})[_0x3483('0x14')](function(_0x43459c){logger[_0x3483('0x10')](_0x3483('0xb'),_0x332b3c,_0x43459c);_0x3d9c83(_0x43459c);});});} \ No newline at end of file +var _0x6c49=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x258fb5,_0x47c7f5){var _0x124437=function(_0x4a0ad1){while(--_0x4a0ad1){_0x258fb5['push'](_0x258fb5['shift']());}};_0x124437(++_0x47c7f5);}(_0x6c49,0xd4));var _0x96c4=function(_0x228ab8,_0x5098c9){_0x228ab8=_0x228ab8-0x0;var _0xb73004=_0x6c49[_0x228ab8];return _0xb73004;};'use strict';var _=require(_0x96c4('0x0'));var util=require(_0x96c4('0x1'));var moment=require(_0x96c4('0x2'));var BPromise=require(_0x96c4('0x3'));var rs=require(_0x96c4('0x4'));var fs=require('fs');var Redis=require(_0x96c4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x96c4('0x6'));var logger=require(_0x96c4('0x7'))(_0x96c4('0x8'));var config=require(_0x96c4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x96c4('0xa')][_0x96c4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3707da,_0x43d223,_0x58fd27){return new BPromise(function(_0x42b279,_0x4a9405){return client['request'](_0x3707da,_0x58fd27)[_0x96c4('0xc')](function(_0x2daaa1){logger[_0x96c4('0xd')](_0x96c4('0xe'),_0x43d223,_0x96c4('0xf'));logger[_0x96c4('0x10')](_0x96c4('0x11'),_0x43d223,_0x96c4('0xf'),JSON[_0x96c4('0x12')](_0x2daaa1));if(_0x2daaa1[_0x96c4('0x13')]){if(_0x2daaa1['error'][_0x96c4('0x14')]===0x1f4){logger[_0x96c4('0x13')](_0x96c4('0xe'),_0x43d223,_0x2daaa1['error'][_0x96c4('0x15')]);return _0x4a9405(_0x2daaa1[_0x96c4('0x13')][_0x96c4('0x15')]);}logger['error'](_0x96c4('0xe'),_0x43d223,_0x2daaa1[_0x96c4('0x13')]['message']);return _0x42b279(_0x2daaa1[_0x96c4('0x13')]['message']);}else{logger[_0x96c4('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x43d223,_0x96c4('0xf'));_0x42b279(_0x2daaa1[_0x96c4('0x16')][_0x96c4('0x15')]);}})[_0x96c4('0x17')](function(_0x5822d0){logger[_0x96c4('0x13')](_0x96c4('0xe'),_0x43d223,_0x5822d0);_0x4a9405(_0x5822d0);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 1663535..5f3411f 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 _0xdecb=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','util','path'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xdecb,0xe2));var _0xbdec=function(_0x447ed6,_0x2fecaa){_0x447ed6=_0x447ed6-0x0;var _0x5c4e69=_0xdecb[_0x447ed6];return _0x5c4e69;};'use strict';var multer=require('multer');var util=require(_0xbdec('0x0'));var path=require(_0xbdec('0x1'));var timeout=require(_0xbdec('0x2'));var express=require('express');var router=express[_0xbdec('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbdec('0x4'));var interaction=require(_0xbdec('0x5'));var config=require(_0xbdec('0x6'));var controller=require(_0xbdec('0x7'));router[_0xbdec('0x8')]('/',auth[_0xbdec('0x9')](),controller[_0xbdec('0xa')]);router['get'](_0xbdec('0xb'),auth[_0xbdec('0x9')](),controller[_0xbdec('0xc')]);router[_0xbdec('0xd')]('/',auth[_0xbdec('0x9')](),controller[_0xbdec('0xe')]);router[_0xbdec('0xf')](_0xbdec('0xb'),auth['isAuthenticated'](),controller[_0xbdec('0x10')]);router[_0xbdec('0x11')](_0xbdec('0xb'),auth[_0xbdec('0x9')](),controller['destroy']);module[_0xbdec('0x12')]=router; \ No newline at end of file +var _0x9099=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x5ac682,_0x40927){var _0x40218e=function(_0x710a6f){while(--_0x710a6f){_0x5ac682['push'](_0x5ac682['shift']());}};_0x40218e(++_0x40927);}(_0x9099,0x1ac));var _0x9909=function(_0x7feb90,_0x28e700){_0x7feb90=_0x7feb90-0x0;var _0x3c5b33=_0x9099[_0x7feb90];return _0x3c5b33;};'use strict';var multer=require(_0x9909('0x0'));var util=require('util');var path=require(_0x9909('0x1'));var timeout=require(_0x9909('0x2'));var express=require(_0x9909('0x3'));var router=express[_0x9909('0x4')]();var fs_extra=require(_0x9909('0x5'));var auth=require(_0x9909('0x6'));var interaction=require(_0x9909('0x7'));var config=require(_0x9909('0x8'));var controller=require(_0x9909('0x9'));router[_0x9909('0xa')]('/',auth[_0x9909('0xb')](),controller[_0x9909('0xc')]);router[_0x9909('0xa')](_0x9909('0xd'),auth['isAuthenticated'](),controller[_0x9909('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x9909('0xd'),auth['isAuthenticated'](),controller[_0x9909('0xf')]);router[_0x9909('0x10')](_0x9909('0xd'),auth['isAuthenticated'](),controller[_0x9909('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index da9de8e..096a29a 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 _0x72d8=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x33cb78,_0x5f530a){var _0xa38d8e=function(_0x255bb9){while(--_0x255bb9){_0x33cb78['push'](_0x33cb78['shift']());}};_0xa38d8e(++_0x5f530a);}(_0x72d8,0x140));var _0x872d=function(_0xe8fb87,_0x597079){_0xe8fb87=_0xe8fb87-0x0;var _0x118b05=_0x72d8[_0xe8fb87];return _0x118b05;};'use strict';var Sequelize=require('sequelize');module[_0x872d('0x0')]={'type':{'type':Sequelize[_0x872d('0x1')](_0x872d('0x2'),_0x872d('0x3'),_0x872d('0x4'),_0x872d('0x5'),'picklist'),'defaultValue':_0x872d('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x872d('0x6')]},'keyType':{'type':Sequelize[_0x872d('0x1')](_0x872d('0x2'),_0x872d('0x3'),_0x872d('0x4'))},'keyContent':{'type':Sequelize[_0x872d('0x6')]},'idField':{'type':Sequelize[_0x872d('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x872d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x872d('0x6')]}}; \ No newline at end of file +var _0xccf1=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0xccf1,0x1e6));var _0x1ccf=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0xccf1[_0x1ee351];return _0x245aaf;};'use strict';var Sequelize=require('sequelize');module[_0x1ccf('0x0')]={'type':{'type':Sequelize[_0x1ccf('0x1')](_0x1ccf('0x2'),_0x1ccf('0x3'),_0x1ccf('0x4'),_0x1ccf('0x5'),_0x1ccf('0x6')),'defaultValue':_0x1ccf('0x2')},'content':{'type':Sequelize[_0x1ccf('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1ccf('0x1')]('string',_0x1ccf('0x3'),_0x1ccf('0x4'))},'keyContent':{'type':Sequelize[_0x1ccf('0x7')]},'idField':{'type':Sequelize[_0x1ccf('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1ccf('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index ebefa75..87faa7e 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 _0x0649=['../../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','reject','save','update','destroy','then','name','send','map','FreshsalesField','rawAttributes','fieldName','type','key','keys','query','filters','attributes','model','fields','length','hasOwnProperty','sort','where','filter','merge','rows','catch','show','params','intersection','includeAll','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0649,0x7f));var _0x9064=function(_0x1dac7c,_0x1572b7){_0x1dac7c=_0x1dac7c-0x0;var _0x39f0c3=_0x0649[_0x1dac7c];return _0x39f0c3;};'use strict';var emlformat=require(_0x9064('0x0'));var rimraf=require(_0x9064('0x1'));var zipdir=require(_0x9064('0x2'));var jsonpatch=require(_0x9064('0x3'));var rp=require(_0x9064('0x4'));var moment=require(_0x9064('0x5'));var BPromise=require(_0x9064('0x6'));var Mustache=require(_0x9064('0x7'));var util=require(_0x9064('0x8'));var path=require(_0x9064('0x9'));var sox=require(_0x9064('0xa'));var csv=require(_0x9064('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9064('0xc'));var _=require('lodash');var squel=require(_0x9064('0xd'));var crypto=require(_0x9064('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9064('0xf'));var toCsv=require(_0x9064('0xb'));var querystring=require(_0x9064('0x10'));var Papa=require(_0x9064('0x11'));var Redis=require(_0x9064('0x12'));var authService=require(_0x9064('0x13'));var qs=require(_0x9064('0x14'));var as=require(_0x9064('0x15'));var hardwareService=require(_0x9064('0x16'));var logger=require(_0x9064('0x17'))(_0x9064('0x18'));var utils=require(_0x9064('0x19'));var config=require(_0x9064('0x1a'));var licenseUtil=require(_0x9064('0x1b'));var db=require(_0x9064('0x1c'))['db'];function respondWithStatusCode(_0xe95f5a,_0x483b6c){_0x483b6c=_0x483b6c||0xcc;return function(_0x286b4e){if(_0x286b4e){return _0xe95f5a[_0x9064('0x1d')](_0x483b6c);}return _0xe95f5a[_0x9064('0x1e')](_0x483b6c)[_0x9064('0x1f')]();};}function respondWithResult(_0x3ee573,_0x4aeacc){_0x4aeacc=_0x4aeacc||0xc8;return function(_0x551ab5){if(_0x551ab5){return _0x3ee573[_0x9064('0x1e')](_0x4aeacc)[_0x9064('0x20')](_0x551ab5);}};}function respondWithFilteredResult(_0x42f6b2,_0x455128){return function(_0x299e40){if(_0x299e40){var _0x197353=typeof _0x455128[_0x9064('0x21')]===_0x9064('0x22')&&typeof _0x455128[_0x9064('0x23')]===_0x9064('0x22');var _0x3d1886=_0x299e40[_0x9064('0x24')];var _0x31c1fd=_0x197353?0x0:_0x455128[_0x9064('0x21')];var _0x1d7623=_0x197353?_0x299e40[_0x9064('0x24')]:_0x455128[_0x9064('0x21')]+_0x455128[_0x9064('0x23')];var _0x2f2652;if(_0x1d7623>=_0x3d1886){_0x1d7623=_0x3d1886;_0x2f2652=0xc8;}else{_0x2f2652=0xce;}_0x42f6b2['status'](_0x2f2652);return _0x42f6b2['set']('Content-Range',_0x31c1fd+'-'+_0x1d7623+'/'+_0x3d1886)['json'](_0x299e40);}return null;};}function patchUpdates(_0x31a5c7){return function(_0x2a5dc6){try{jsonpatch['apply'](_0x2a5dc6,_0x31a5c7,!![]);}catch(_0x2be23e){return BPromise[_0x9064('0x25')](_0x2be23e);}return _0x2a5dc6[_0x9064('0x26')]();};}function saveUpdates(_0x924f9e,_0x3f321){return function(_0x4872fc){if(_0x4872fc){return _0x4872fc[_0x9064('0x27')](_0x924f9e)['then'](function(_0xe11c01){return _0xe11c01;});}return null;};}function removeEntity(_0x3f25af,_0x4105c1){return function(_0x5ef824){if(_0x5ef824){return _0x5ef824[_0x9064('0x28')]()[_0x9064('0x29')](function(){_0x3f25af[_0x9064('0x1e')](0xcc)[_0x9064('0x1f')]();});}};}function handleEntityNotFound(_0x5a1a56,_0x1f13fc){return function(_0x429cb6){if(!_0x429cb6){_0x5a1a56[_0x9064('0x1d')](0x194);}return _0x429cb6;};}function handleError(_0x304887,_0xa87d0d){_0xa87d0d=_0xa87d0d||0x1f4;return function(_0x1ab22b){logger['error'](_0x1ab22b['stack']);if(_0x1ab22b['name']){delete _0x1ab22b[_0x9064('0x2a')];}_0x304887[_0x9064('0x1e')](_0xa87d0d)[_0x9064('0x2b')](_0x1ab22b);};}exports['index']=function(_0x3e79bb,_0x16bd4a){var _0x1dab29={},_0xe2c7a={},_0x32eee8={'count':0x0,'rows':[]};var _0x4b6a2b=_[_0x9064('0x2c')](db[_0x9064('0x2d')][_0x9064('0x2e')],function(_0x1e51e2){return{'name':_0x1e51e2[_0x9064('0x2f')],'type':_0x1e51e2[_0x9064('0x30')][_0x9064('0x31')]};});_0xe2c7a['model']=_[_0x9064('0x2c')](_0x4b6a2b,_0x9064('0x2a'));_0xe2c7a['query']=_[_0x9064('0x32')](_0x3e79bb[_0x9064('0x33')]);_0xe2c7a[_0x9064('0x34')]=_['intersection'](_0xe2c7a['model'],_0xe2c7a[_0x9064('0x33')]);_0x1dab29[_0x9064('0x35')]=_['intersection'](_0xe2c7a[_0x9064('0x36')],qs[_0x9064('0x37')](_0x3e79bb[_0x9064('0x33')][_0x9064('0x37')]));_0x1dab29[_0x9064('0x35')]=_0x1dab29[_0x9064('0x35')][_0x9064('0x38')]?_0x1dab29['attributes']:_0xe2c7a[_0x9064('0x36')];if(!_0x3e79bb[_0x9064('0x33')][_0x9064('0x39')]('nolimit')){_0x1dab29[_0x9064('0x23')]=qs[_0x9064('0x23')](_0x3e79bb[_0x9064('0x33')][_0x9064('0x23')]);_0x1dab29[_0x9064('0x21')]=qs[_0x9064('0x21')](_0x3e79bb['query'][_0x9064('0x21')]);}_0x1dab29['order']=qs[_0x9064('0x3a')](_0x3e79bb[_0x9064('0x33')][_0x9064('0x3a')]);_0x1dab29[_0x9064('0x3b')]=qs['filters'](_['pick'](_0x3e79bb[_0x9064('0x33')],_0xe2c7a['filters']),_0x4b6a2b);if(_0x3e79bb[_0x9064('0x33')][_0x9064('0x3c')]){_0x1dab29['where']=_[_0x9064('0x3d')](_0x1dab29[_0x9064('0x3b')],{'$or':_[_0x9064('0x2c')](_0x4b6a2b,function(_0x5cc70f){if(_0x5cc70f[_0x9064('0x30')]!=='VIRTUAL'){var _0x276a08={};_0x276a08[_0x5cc70f[_0x9064('0x2a')]]={'$like':'%'+_0x3e79bb[_0x9064('0x33')][_0x9064('0x3c')]+'%'};return _0x276a08;}})});}_0x1dab29=_[_0x9064('0x3d')]({},_0x1dab29,_0x3e79bb['options']);var _0x459da9={'where':_0x1dab29[_0x9064('0x3b')]};return db[_0x9064('0x2d')][_0x9064('0x24')](_0x459da9)[_0x9064('0x29')](function(_0x389186){_0x32eee8['count']=_0x389186;if(_0x3e79bb[_0x9064('0x33')]['includeAll']){_0x1dab29['include']=[{'all':!![]}];}return db[_0x9064('0x2d')]['findAll'](_0x1dab29);})[_0x9064('0x29')](function(_0x8d1512){_0x32eee8[_0x9064('0x3e')]=_0x8d1512;return _0x32eee8;})[_0x9064('0x29')](respondWithFilteredResult(_0x16bd4a,_0x1dab29))[_0x9064('0x3f')](handleError(_0x16bd4a,null));};exports[_0x9064('0x40')]=function(_0x24b94d,_0x490862){var _0x28bd09={'raw':!![],'where':{'id':_0x24b94d[_0x9064('0x41')]['id']}},_0x234046={};_0x234046[_0x9064('0x36')]=_[_0x9064('0x32')](db['FreshsalesField'][_0x9064('0x2e')]);_0x234046['query']=_[_0x9064('0x32')](_0x24b94d[_0x9064('0x33')]);_0x234046[_0x9064('0x34')]=_[_0x9064('0x42')](_0x234046['model'],_0x234046['query']);_0x28bd09[_0x9064('0x35')]=_[_0x9064('0x42')](_0x234046['model'],qs['fields'](_0x24b94d[_0x9064('0x33')][_0x9064('0x37')]));_0x28bd09[_0x9064('0x35')]=_0x28bd09[_0x9064('0x35')][_0x9064('0x38')]?_0x28bd09[_0x9064('0x35')]:_0x234046[_0x9064('0x36')];if(_0x24b94d[_0x9064('0x33')][_0x9064('0x43')]){_0x28bd09[_0x9064('0x44')]=[{'all':!![]}];}_0x28bd09=_[_0x9064('0x3d')]({},_0x28bd09,_0x24b94d[_0x9064('0x45')]);return db[_0x9064('0x2d')][_0x9064('0x46')](_0x28bd09)['then'](handleEntityNotFound(_0x490862,null))[_0x9064('0x29')](respondWithResult(_0x490862,null))[_0x9064('0x3f')](handleError(_0x490862,null));};exports[_0x9064('0x47')]=function(_0xa332f,_0x4515eb){return db[_0x9064('0x2d')][_0x9064('0x47')](_0xa332f[_0x9064('0x48')],{})[_0x9064('0x29')](respondWithResult(_0x4515eb,0xc9))[_0x9064('0x3f')](handleError(_0x4515eb,null));};exports['update']=function(_0x48aaeb,_0x4b2949){if(_0x48aaeb[_0x9064('0x48')]['id']){delete _0x48aaeb[_0x9064('0x48')]['id'];}return db['FreshsalesField'][_0x9064('0x46')]({'where':{'id':_0x48aaeb[_0x9064('0x41')]['id']}})[_0x9064('0x29')](handleEntityNotFound(_0x4b2949,null))[_0x9064('0x29')](saveUpdates(_0x48aaeb[_0x9064('0x48')],null))[_0x9064('0x29')](respondWithResult(_0x4b2949,null))[_0x9064('0x3f')](handleError(_0x4b2949,null));};exports[_0x9064('0x28')]=function(_0xc7e5fb,_0x29a3c2){return db[_0x9064('0x2d')][_0x9064('0x46')]({'where':{'id':_0xc7e5fb[_0x9064('0x41')]['id']}})[_0x9064('0x29')](handleEntityNotFound(_0x29a3c2,null))[_0x9064('0x29')](removeEntity(_0x29a3c2,null))[_0x9064('0x3f')](handleError(_0x29a3c2,null));}; \ No newline at end of file +var _0xab40=['send','index','map','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','options','FreshsalesField','includeAll','include','rows','catch','show','params','find','create','body','request-promise','bluebird','mustache','util','ejs','fs-extra','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name'];(function(_0x29b35c,_0x2001c5){var _0x5ab131=function(_0x4afc0a){while(--_0x4afc0a){_0x29b35c['push'](_0x29b35c['shift']());}};_0x5ab131(++_0x2001c5);}(_0xab40,0x135));var _0x0ab4=function(_0x649db,_0x54de3a){_0x649db=_0x649db-0x0;var _0x513406=_0xab40[_0x649db];return _0x513406;};'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(_0x0ab4('0x0'));var moment=require('moment');var BPromise=require(_0x0ab4('0x1'));var Mustache=require(_0x0ab4('0x2'));var util=require(_0x0ab4('0x3'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0ab4('0x4'));var fs=require('fs');var fs_extra=require(_0x0ab4('0x5'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0ab4('0x6'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0ab4('0x7'));var Papa=require(_0x0ab4('0x8'));var Redis=require('ioredis');var authService=require(_0x0ab4('0x9'));var qs=require(_0x0ab4('0xa'));var as=require(_0x0ab4('0xb'));var hardwareService=require(_0x0ab4('0xc'));var logger=require(_0x0ab4('0xd'))(_0x0ab4('0xe'));var utils=require(_0x0ab4('0xf'));var config=require(_0x0ab4('0x10'));var licenseUtil=require(_0x0ab4('0x11'));var db=require(_0x0ab4('0x12'))['db'];function respondWithStatusCode(_0x571645,_0x118d2f){_0x118d2f=_0x118d2f||0xcc;return function(_0x48af0a){if(_0x48af0a){return _0x571645[_0x0ab4('0x13')](_0x118d2f);}return _0x571645['status'](_0x118d2f)['end']();};}function respondWithResult(_0x45672c,_0x2a717e){_0x2a717e=_0x2a717e||0xc8;return function(_0x13b7dd){if(_0x13b7dd){return _0x45672c[_0x0ab4('0x14')](_0x2a717e)['json'](_0x13b7dd);}};}function respondWithFilteredResult(_0x5aa99a,_0x13c071){return function(_0x22dede){if(_0x22dede){var _0x13999a=typeof _0x13c071[_0x0ab4('0x15')]===_0x0ab4('0x16')&&typeof _0x13c071[_0x0ab4('0x17')]==='undefined';var _0x5bebb8=_0x22dede[_0x0ab4('0x18')];var _0x486659=_0x13999a?0x0:_0x13c071[_0x0ab4('0x15')];var _0x563750=_0x13999a?_0x22dede['count']:_0x13c071[_0x0ab4('0x15')]+_0x13c071[_0x0ab4('0x17')];var _0xb01023;if(_0x563750>=_0x5bebb8){_0x563750=_0x5bebb8;_0xb01023=0xc8;}else{_0xb01023=0xce;}_0x5aa99a[_0x0ab4('0x14')](_0xb01023);return _0x5aa99a[_0x0ab4('0x19')](_0x0ab4('0x1a'),_0x486659+'-'+_0x563750+'/'+_0x5bebb8)[_0x0ab4('0x1b')](_0x22dede);}return null;};}function patchUpdates(_0x4ce39b){return function(_0x105994){try{jsonpatch[_0x0ab4('0x1c')](_0x105994,_0x4ce39b,!![]);}catch(_0x41bbf9){return BPromise['reject'](_0x41bbf9);}return _0x105994[_0x0ab4('0x1d')]();};}function saveUpdates(_0x29cadd,_0x42ab42){return function(_0x1337d6){if(_0x1337d6){return _0x1337d6[_0x0ab4('0x1e')](_0x29cadd)[_0x0ab4('0x1f')](function(_0x164c38){return _0x164c38;});}return null;};}function removeEntity(_0x12873d,_0x21376d){return function(_0x7b8d98){if(_0x7b8d98){return _0x7b8d98[_0x0ab4('0x20')]()['then'](function(){_0x12873d[_0x0ab4('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5afa74,_0x27e9be){return function(_0x3256b6){if(!_0x3256b6){_0x5afa74[_0x0ab4('0x13')](0x194);}return _0x3256b6;};}function handleError(_0x5d4ee3,_0x1491b0){_0x1491b0=_0x1491b0||0x1f4;return function(_0x16a81d){logger[_0x0ab4('0x21')](_0x16a81d[_0x0ab4('0x22')]);if(_0x16a81d['name']){delete _0x16a81d[_0x0ab4('0x23')];}_0x5d4ee3[_0x0ab4('0x14')](_0x1491b0)[_0x0ab4('0x24')](_0x16a81d);};}exports[_0x0ab4('0x25')]=function(_0x35c90e,_0x3f80ec){var _0x57ab4a={},_0x4e4607={},_0x5ec76a={'count':0x0,'rows':[]};var _0x30683c=_[_0x0ab4('0x26')](db['FreshsalesField'][_0x0ab4('0x27')],function(_0x33b94c){return{'name':_0x33b94c[_0x0ab4('0x28')],'type':_0x33b94c[_0x0ab4('0x29')]['key']};});_0x4e4607[_0x0ab4('0x2a')]=_[_0x0ab4('0x26')](_0x30683c,_0x0ab4('0x23'));_0x4e4607['query']=_[_0x0ab4('0x2b')](_0x35c90e[_0x0ab4('0x2c')]);_0x4e4607['filters']=_[_0x0ab4('0x2d')](_0x4e4607[_0x0ab4('0x2a')],_0x4e4607[_0x0ab4('0x2c')]);_0x57ab4a['attributes']=_[_0x0ab4('0x2d')](_0x4e4607[_0x0ab4('0x2a')],qs[_0x0ab4('0x2e')](_0x35c90e[_0x0ab4('0x2c')][_0x0ab4('0x2e')]));_0x57ab4a[_0x0ab4('0x2f')]=_0x57ab4a[_0x0ab4('0x2f')][_0x0ab4('0x30')]?_0x57ab4a[_0x0ab4('0x2f')]:_0x4e4607[_0x0ab4('0x2a')];if(!_0x35c90e['query'][_0x0ab4('0x31')](_0x0ab4('0x32'))){_0x57ab4a['limit']=qs[_0x0ab4('0x17')](_0x35c90e['query']['limit']);_0x57ab4a['offset']=qs[_0x0ab4('0x15')](_0x35c90e['query'][_0x0ab4('0x15')]);}_0x57ab4a[_0x0ab4('0x33')]=qs[_0x0ab4('0x34')](_0x35c90e['query'][_0x0ab4('0x34')]);_0x57ab4a['where']=qs[_0x0ab4('0x35')](_[_0x0ab4('0x36')](_0x35c90e[_0x0ab4('0x2c')],_0x4e4607[_0x0ab4('0x35')]),_0x30683c);if(_0x35c90e['query'][_0x0ab4('0x37')]){_0x57ab4a['where']=_[_0x0ab4('0x38')](_0x57ab4a[_0x0ab4('0x39')],{'$or':_['map'](_0x30683c,function(_0xc1b688){if(_0xc1b688['type']!=='VIRTUAL'){var _0xce0aa7={};_0xce0aa7[_0xc1b688[_0x0ab4('0x23')]]={'$like':'%'+_0x35c90e[_0x0ab4('0x2c')]['filter']+'%'};return _0xce0aa7;}})});}_0x57ab4a=_['merge']({},_0x57ab4a,_0x35c90e[_0x0ab4('0x3a')]);var _0x4140b6={'where':_0x57ab4a[_0x0ab4('0x39')]};return db[_0x0ab4('0x3b')][_0x0ab4('0x18')](_0x4140b6)[_0x0ab4('0x1f')](function(_0x2d7e2d){_0x5ec76a[_0x0ab4('0x18')]=_0x2d7e2d;if(_0x35c90e['query'][_0x0ab4('0x3c')]){_0x57ab4a[_0x0ab4('0x3d')]=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x57ab4a);})[_0x0ab4('0x1f')](function(_0x3ea4ce){_0x5ec76a[_0x0ab4('0x3e')]=_0x3ea4ce;return _0x5ec76a;})[_0x0ab4('0x1f')](respondWithFilteredResult(_0x3f80ec,_0x57ab4a))[_0x0ab4('0x3f')](handleError(_0x3f80ec,null));};exports[_0x0ab4('0x40')]=function(_0x97a36a,_0x56db79){var _0x529a9c={'raw':!![],'where':{'id':_0x97a36a[_0x0ab4('0x41')]['id']}},_0xf57d10={};_0xf57d10['model']=_[_0x0ab4('0x2b')](db[_0x0ab4('0x3b')][_0x0ab4('0x27')]);_0xf57d10['query']=_['keys'](_0x97a36a['query']);_0xf57d10[_0x0ab4('0x35')]=_[_0x0ab4('0x2d')](_0xf57d10[_0x0ab4('0x2a')],_0xf57d10[_0x0ab4('0x2c')]);_0x529a9c[_0x0ab4('0x2f')]=_[_0x0ab4('0x2d')](_0xf57d10[_0x0ab4('0x2a')],qs[_0x0ab4('0x2e')](_0x97a36a[_0x0ab4('0x2c')]['fields']));_0x529a9c[_0x0ab4('0x2f')]=_0x529a9c['attributes'][_0x0ab4('0x30')]?_0x529a9c[_0x0ab4('0x2f')]:_0xf57d10[_0x0ab4('0x2a')];if(_0x97a36a[_0x0ab4('0x2c')][_0x0ab4('0x3c')]){_0x529a9c['include']=[{'all':!![]}];}_0x529a9c=_[_0x0ab4('0x38')]({},_0x529a9c,_0x97a36a['options']);return db[_0x0ab4('0x3b')][_0x0ab4('0x42')](_0x529a9c)['then'](handleEntityNotFound(_0x56db79,null))[_0x0ab4('0x1f')](respondWithResult(_0x56db79,null))[_0x0ab4('0x3f')](handleError(_0x56db79,null));};exports[_0x0ab4('0x43')]=function(_0x2e419f,_0x21665d){return db['FreshsalesField'][_0x0ab4('0x43')](_0x2e419f['body'],{})[_0x0ab4('0x1f')](respondWithResult(_0x21665d,0xc9))['catch'](handleError(_0x21665d,null));};exports['update']=function(_0x5ccd84,_0x4e38f1){if(_0x5ccd84[_0x0ab4('0x44')]['id']){delete _0x5ccd84[_0x0ab4('0x44')]['id'];}return db[_0x0ab4('0x3b')][_0x0ab4('0x42')]({'where':{'id':_0x5ccd84['params']['id']}})['then'](handleEntityNotFound(_0x4e38f1,null))[_0x0ab4('0x1f')](saveUpdates(_0x5ccd84[_0x0ab4('0x44')],null))['then'](respondWithResult(_0x4e38f1,null))[_0x0ab4('0x3f')](handleError(_0x4e38f1,null));};exports[_0x0ab4('0x20')]=function(_0x3ce2ad,_0x83c954){return db[_0x0ab4('0x3b')]['find']({'where':{'id':_0x3ce2ad[_0x0ab4('0x41')]['id']}})['then'](handleEntityNotFound(_0x83c954,null))[_0x0ab4('0x1f')](removeEntity(_0x83c954,null))['catch'](handleError(_0x83c954,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index eea53c5..0c9fb44 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 _0xf8f2=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash'];(function(_0x1a89a1,_0x56d889){var _0x3d5b46=function(_0x56debf){while(--_0x56debf){_0x1a89a1['push'](_0x1a89a1['shift']());}};_0x3d5b46(++_0x56d889);}(_0xf8f2,0xc2));var _0x2f8f=function(_0x4ad394,_0x21e512){_0x4ad394=_0x4ad394-0x0;var _0xa38357=_0xf8f2[_0x4ad394];return _0xa38357;};'use strict';var _=require(_0x2f8f('0x0'));var util=require(_0x2f8f('0x1'));var logger=require(_0x2f8f('0x2'))(_0x2f8f('0x3'));var moment=require('moment');var BPromise=require(_0x2f8f('0x4'));var rp=require(_0x2f8f('0x5'));var fs=require('fs');var path=require(_0x2f8f('0x6'));var rimraf=require(_0x2f8f('0x7'));var config=require(_0x2f8f('0x8'));var attributes=require('./intFreshsalesField.attributes');module[_0x2f8f('0x9')]=function(_0x45f175,_0x3d2aad){return _0x45f175[_0x2f8f('0xa')](_0x2f8f('0xb'),attributes,{'tableName':_0x2f8f('0xc'),'paranoid':![],'indexes':[{'name':_0x2f8f('0xd'),'fields':[_0x2f8f('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5464=['util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash'];(function(_0x5dd71d,_0x849e85){var _0x510182=function(_0x47defe){while(--_0x47defe){_0x5dd71d['push'](_0x5dd71d['shift']());}};_0x510182(++_0x849e85);}(_0x5464,0x15d));var _0x4546=function(_0x4a7fed,_0x3a3d7a){_0x4a7fed=_0x4a7fed-0x0;var _0x270075=_0x5464[_0x4a7fed];return _0x270075;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var logger=require(_0x4546('0x2'))('api');var moment=require(_0x4546('0x3'));var BPromise=require('bluebird');var rp=require(_0x4546('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4546('0x5'));var config=require(_0x4546('0x6'));var attributes=require(_0x4546('0x7'));module[_0x4546('0x8')]=function(_0x54228a,_0x57391f){return _0x54228a['define'](_0x4546('0x9'),attributes,{'tableName':_0x4546('0xa'),'paranoid':![],'indexes':[{'name':_0x4546('0xb'),'fields':[_0x4546('0xc'),_0x4546('0xd')],'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 c503336..a979f54 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 _0x3f8a=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0xed35e0,_0x3fbfa7){_0xed35e0=_0xed35e0-0x0;var _0x1dad57=_0x3f8a[_0xed35e0];return _0x1dad57;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var moment=require(_0xa3f8('0x2'));var BPromise=require(_0xa3f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3f8('0x4'));var db=require(_0xa3f8('0x5'))['db'];var utils=require(_0xa3f8('0x6'));var logger=require(_0xa3f8('0x7'))(_0xa3f8('0x8'));var config=require(_0xa3f8('0x9'));var jayson=require(_0xa3f8('0xa'));var client=jayson[_0xa3f8('0xb')][_0xa3f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf895d9,_0xcfea5,_0x268332){return new BPromise(function(_0x2faf2e,_0x2448de){return client[_0xa3f8('0xd')](_0xf895d9,_0x268332)[_0xa3f8('0xe')](function(_0xcdb0d4){logger['info'](_0xa3f8('0xf'),_0xcfea5,_0xa3f8('0x10'));logger[_0xa3f8('0x11')](_0xa3f8('0x12'),_0xcfea5,'request\x20sent',JSON[_0xa3f8('0x13')](_0xcdb0d4));if(_0xcdb0d4[_0xa3f8('0x14')]){if(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x15')]===0x1f4){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);return _0x2448de(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4['error'][_0xa3f8('0x16')]);return _0x2faf2e(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}else{logger[_0xa3f8('0x17')]('FreshsalesField,\x20%s,\x20%s',_0xcfea5,_0xa3f8('0x10'));_0x2faf2e(_0xcdb0d4[_0xa3f8('0x18')][_0xa3f8('0x16')]);}})[_0xa3f8('0x19')](function(_0x45ef64){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0x45ef64);_0x2448de(_0x45ef64);});});} \ No newline at end of file +var _0xdbf5=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','result','catch'];(function(_0x56deef,_0x1c92d3){var _0x336bc8=function(_0x59e4c8){while(--_0x59e4c8){_0x56deef['push'](_0x56deef['shift']());}};_0x336bc8(++_0x1c92d3);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x26d097,_0x44bf71){_0x26d097=_0x26d097-0x0;var _0x44d762=_0xdbf5[_0x26d097];return _0x44d762;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5dbf('0x1'));var fs=require('fs');var Redis=require(_0x5dbf('0x2'));var db=require(_0x5dbf('0x3'))['db'];var utils=require(_0x5dbf('0x4'));var logger=require(_0x5dbf('0x5'))(_0x5dbf('0x6'));var config=require(_0x5dbf('0x7'));var jayson=require(_0x5dbf('0x8'));var client=jayson[_0x5dbf('0x9')][_0x5dbf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x209b7d,_0x88128e,_0x93e657){return new BPromise(function(_0x52b039,_0x134810){return client['request'](_0x209b7d,_0x93e657)[_0x5dbf('0xb')](function(_0x3bec50){logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x88128e,'request\x20sent');logger[_0x5dbf('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x88128e,'request\x20sent',JSON[_0x5dbf('0xf')](_0x3bec50));if(_0x3bec50['error']){if(_0x3bec50['error'][_0x5dbf('0x10')]===0x1f4){logger['error'](_0x5dbf('0xd'),_0x88128e,_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);return _0x134810(_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x88128e,_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);return _0x52b039(_0x3bec50['error'][_0x5dbf('0x12')]);}else{logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x88128e,_0x5dbf('0x13'));_0x52b039(_0x3bec50[_0x5dbf('0x14')][_0x5dbf('0x12')]);}})[_0x5dbf('0x15')](function(_0x50ef1d){logger['error'](_0x5dbf('0xd'),_0x88128e,_0x50ef1d);_0x134810(_0x50ef1d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 0a9741c..10c5974 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x247731,_0x5880b7){var _0x113cbf=function(_0x47b2c0){while(--_0x47b2c0){_0x247731['push'](_0x247731['shift']());}};_0x113cbf(++_0x5880b7);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x26db6c,_0x1f5699){var _0x17972a=function(_0x16f749){while(--_0x16f749){_0x26db6c['push'](_0x26db6c['shift']());}};_0x17972a(++_0x1f5699);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index f6fc98e..4366a0e 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 _0xafa7=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x5d04ee,_0x2a38ca){var _0x4a666a=function(_0x1883e4){while(--_0x1883e4){_0x5d04ee['push'](_0x5d04ee['shift']());}};_0x4a666a(++_0x2a38ca);}(_0xafa7,0x122));var _0x7afa=function(_0x1098db,_0x39ba6b){_0x1098db=_0x1098db-0x0;var _0x14f090=_0xafa7[_0x1098db];return _0x14f090;};'use strict';var Sequelize=require(_0x7afa('0x0'));module[_0x7afa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7afa('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x7afa('0x3')},'remoteUri':{'type':Sequelize[_0x7afa('0x2')]},'password':{'type':Sequelize[_0x7afa('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x7afa('0x2')]},'serverUrl':{'type':Sequelize[_0x7afa('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7afa('0x4')](_0x7afa('0x5'),_0x7afa('0x6')),'defaultValue':_0x7afa('0x5')}}; \ No newline at end of file +var _0x1a21=['username','ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x526ab1,_0x137bfa){var _0x411007=function(_0x4e0dff){while(--_0x4e0dff){_0x526ab1['push'](_0x526ab1['shift']());}};_0x411007(++_0x137bfa);}(_0x1a21,0x1d9));var _0x11a2=function(_0x50cd41,_0x4874a7){_0x50cd41=_0x50cd41-0x0;var _0x399475=_0x1a21[_0x50cd41];return _0x399475;};'use strict';var Sequelize=require(_0x11a2('0x0'));module[_0x11a2('0x1')]={'name':{'type':Sequelize[_0x11a2('0x2')]},'description':{'type':Sequelize[_0x11a2('0x2')]},'username':{'type':Sequelize[_0x11a2('0x2')],'unique':_0x11a2('0x3')},'remoteUri':{'type':Sequelize[_0x11a2('0x2')]},'password':{'type':Sequelize[_0x11a2('0x2')]},'clientId':{'type':Sequelize[_0x11a2('0x2')]},'clientSecret':{'type':Sequelize[_0x11a2('0x2')]},'securityToken':{'type':Sequelize[_0x11a2('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x11a2('0x4')](_0x11a2('0x5'),_0x11a2('0x6')),'defaultValue':_0x11a2('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 501719f..88eb98e 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 _0xd239=['ejs','lodash','squel','crypto','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','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','SalesforceAccount','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','then','include','findAll','rows','catch','find','create','body','params','findOne','SalesforceConfiguration','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientId','clientSecret','username','password','securityToken','slice','substring','Connection','login','concat','isNil','ticketType','OwnerId','ActivityDate','IsReminderSet','Description','int','boolean','email','textarea','custom','picklistValues','label','value','True','true','False','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xd239,0x6f));var _0x9d23=function(_0x5ea825,_0x2cb2bb){_0x5ea825=_0x5ea825-0x0;var _0x180af3=_0xd239[_0x5ea825];return _0x180af3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d23('0x0'));var zipdir=require(_0x9d23('0x1'));var jsonpatch=require(_0x9d23('0x2'));var rp=require(_0x9d23('0x3'));var moment=require('moment');var BPromise=require(_0x9d23('0x4'));var Mustache=require(_0x9d23('0x5'));var util=require(_0x9d23('0x6'));var path=require(_0x9d23('0x7'));var sox=require(_0x9d23('0x8'));var csv=require(_0x9d23('0x9'));var ejs=require(_0x9d23('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d23('0xb'));var squel=require(_0x9d23('0xc'));var crypto=require(_0x9d23('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9d23('0xe'));var toCsv=require(_0x9d23('0x9'));var querystring=require(_0x9d23('0xf'));var Papa=require(_0x9d23('0x10'));var Redis=require(_0x9d23('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9d23('0x12'));var as=require(_0x9d23('0x13'));var hardwareService=require(_0x9d23('0x14'));var logger=require(_0x9d23('0x15'))(_0x9d23('0x16'));var utils=require(_0x9d23('0x17'));var config=require(_0x9d23('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d23('0x19'))['db'];var integrations=require(_0x9d23('0x1a'));function respondWithStatusCode(_0x26f7f2,_0x3f71fb){_0x3f71fb=_0x3f71fb||0xcc;return function(_0x2a4bfa){if(_0x2a4bfa){return _0x26f7f2[_0x9d23('0x1b')](_0x3f71fb);}return _0x26f7f2[_0x9d23('0x1c')](_0x3f71fb)[_0x9d23('0x1d')]();};}function respondWithResult(_0xbeb4e6,_0x3e4c17){_0x3e4c17=_0x3e4c17||0xc8;return function(_0x11d35e){if(_0x11d35e){return _0xbeb4e6[_0x9d23('0x1c')](_0x3e4c17)['json'](_0x11d35e);}};}function respondWithFilteredResult(_0x423c62,_0x59702a){return function(_0x5f011e){if(_0x5f011e){var _0x1f6cf8=typeof _0x59702a[_0x9d23('0x1e')]===_0x9d23('0x1f')&&typeof _0x59702a[_0x9d23('0x20')]===_0x9d23('0x1f');var _0x10b7ff=_0x5f011e[_0x9d23('0x21')];var _0x328907=_0x1f6cf8?0x0:_0x59702a[_0x9d23('0x1e')];var _0x112eb3=_0x1f6cf8?_0x5f011e[_0x9d23('0x21')]:_0x59702a[_0x9d23('0x1e')]+_0x59702a[_0x9d23('0x20')];var _0x5034fb;if(_0x112eb3>=_0x10b7ff){_0x112eb3=_0x10b7ff;_0x5034fb=0xc8;}else{_0x5034fb=0xce;}_0x423c62[_0x9d23('0x1c')](_0x5034fb);return _0x423c62[_0x9d23('0x22')](_0x9d23('0x23'),_0x328907+'-'+_0x112eb3+'/'+_0x10b7ff)[_0x9d23('0x24')](_0x5f011e);}return null;};}function patchUpdates(_0x10c393){return function(_0x5df85e){try{jsonpatch[_0x9d23('0x25')](_0x5df85e,_0x10c393,!![]);}catch(_0x3e9bad){return BPromise[_0x9d23('0x26')](_0x3e9bad);}return _0x5df85e[_0x9d23('0x27')]();};}function saveUpdates(_0x4306c5,_0x403d99){return function(_0x46ca21){if(_0x46ca21){return _0x46ca21[_0x9d23('0x28')](_0x4306c5)['then'](function(_0x396c93){return _0x396c93;});}return null;};}function removeEntity(_0x304d66,_0x1cb0db){return function(_0x282950){if(_0x282950){return _0x282950[_0x9d23('0x29')]()['then'](function(){_0x304d66['status'](0xcc)[_0x9d23('0x1d')]();});}};}function handleEntityNotFound(_0x3d97a8,_0x30ca75){return function(_0x27893c){if(!_0x27893c){_0x3d97a8['sendStatus'](0x194);}return _0x27893c;};}function handleError(_0x4e53a8,_0xd9d4c4){_0xd9d4c4=_0xd9d4c4||0x1f4;return function(_0x3bb28b){logger[_0x9d23('0x2a')](_0x3bb28b[_0x9d23('0x2b')]);if(_0x3bb28b[_0x9d23('0x2c')]){delete _0x3bb28b['name'];}_0x4e53a8[_0x9d23('0x1c')](_0xd9d4c4)[_0x9d23('0x2d')](_0x3bb28b);};}exports['index']=function(_0x39e00e,_0x478a6c){var _0x4970ff={},_0x251fd5={},_0xa9ab9c={'count':0x0,'rows':[]};var _0x475357=_['map'](db[_0x9d23('0x2e')]['rawAttributes'],function(_0x1b1a46){return{'name':_0x1b1a46[_0x9d23('0x2f')],'type':_0x1b1a46[_0x9d23('0x30')][_0x9d23('0x31')]};});_0x251fd5[_0x9d23('0x32')]=_[_0x9d23('0x33')](_0x475357,_0x9d23('0x2c'));_0x251fd5['query']=_[_0x9d23('0x34')](_0x39e00e['query']);_0x251fd5[_0x9d23('0x35')]=_[_0x9d23('0x36')](_0x251fd5[_0x9d23('0x32')],_0x251fd5[_0x9d23('0x37')]);_0x4970ff[_0x9d23('0x38')]=_['intersection'](_0x251fd5[_0x9d23('0x32')],qs[_0x9d23('0x39')](_0x39e00e[_0x9d23('0x37')][_0x9d23('0x39')]));_0x4970ff[_0x9d23('0x38')]=_0x4970ff[_0x9d23('0x38')][_0x9d23('0x3a')]?_0x4970ff['attributes']:_0x251fd5[_0x9d23('0x32')];if(!_0x39e00e['query'][_0x9d23('0x3b')]('nolimit')){_0x4970ff['limit']=qs['limit'](_0x39e00e[_0x9d23('0x37')][_0x9d23('0x20')]);_0x4970ff['offset']=qs['offset'](_0x39e00e[_0x9d23('0x37')][_0x9d23('0x1e')]);}_0x4970ff[_0x9d23('0x3c')]=qs['sort'](_0x39e00e['query']['sort']);_0x4970ff[_0x9d23('0x3d')]=qs[_0x9d23('0x35')](_[_0x9d23('0x3e')](_0x39e00e[_0x9d23('0x37')],_0x251fd5[_0x9d23('0x35')]),_0x475357);if(_0x39e00e[_0x9d23('0x37')][_0x9d23('0x3f')]){_0x4970ff[_0x9d23('0x3d')]=_[_0x9d23('0x40')](_0x4970ff['where'],{'$or':_[_0x9d23('0x33')](_0x475357,function(_0x1c4dcd){if(_0x1c4dcd[_0x9d23('0x30')]!==_0x9d23('0x41')){var _0x20b054={};_0x20b054[_0x1c4dcd[_0x9d23('0x2c')]]={'$like':'%'+_0x39e00e[_0x9d23('0x37')]['filter']+'%'};return _0x20b054;}})});}_0x4970ff=_['merge']({},_0x4970ff,_0x39e00e[_0x9d23('0x42')]);var _0x52b4a5={'where':_0x4970ff[_0x9d23('0x3d')]};return db[_0x9d23('0x2e')][_0x9d23('0x21')](_0x52b4a5)[_0x9d23('0x43')](function(_0xded9ca){_0xa9ab9c[_0x9d23('0x21')]=_0xded9ca;if(_0x39e00e[_0x9d23('0x37')]['includeAll']){_0x4970ff[_0x9d23('0x44')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x9d23('0x45')](_0x4970ff);})[_0x9d23('0x43')](function(_0x4b319a){_0xa9ab9c[_0x9d23('0x46')]=_0x4b319a;return _0xa9ab9c;})['then'](respondWithFilteredResult(_0x478a6c,_0x4970ff))[_0x9d23('0x47')](handleError(_0x478a6c,null));};exports['show']=function(_0x1ebfce,_0x562873){var _0x2f83de={'raw':![],'where':{'id':_0x1ebfce['params']['id']}},_0x2567ba={};_0x2567ba['model']=_[_0x9d23('0x34')](db[_0x9d23('0x2e')]['rawAttributes']);_0x2567ba[_0x9d23('0x37')]=_[_0x9d23('0x34')](_0x1ebfce['query']);_0x2567ba[_0x9d23('0x35')]=_[_0x9d23('0x36')](_0x2567ba[_0x9d23('0x32')],_0x2567ba['query']);_0x2f83de[_0x9d23('0x38')]=_[_0x9d23('0x36')](_0x2567ba['model'],qs['fields'](_0x1ebfce['query'][_0x9d23('0x39')]));_0x2f83de['attributes']=_0x2f83de[_0x9d23('0x38')][_0x9d23('0x3a')]?_0x2f83de[_0x9d23('0x38')]:_0x2567ba[_0x9d23('0x32')];if(_0x1ebfce[_0x9d23('0x37')]['includeAll']){_0x2f83de[_0x9d23('0x44')]=[{'all':!![]}];}_0x2f83de=_[_0x9d23('0x40')]({},_0x2f83de,_0x1ebfce[_0x9d23('0x42')]);return db['SalesforceAccount'][_0x9d23('0x48')](_0x2f83de)[_0x9d23('0x43')](handleEntityNotFound(_0x562873,null))[_0x9d23('0x43')](respondWithResult(_0x562873,null))['catch'](handleError(_0x562873,null));};exports[_0x9d23('0x49')]=function(_0x350b81,_0x53cdd4){return db[_0x9d23('0x2e')][_0x9d23('0x49')](_0x350b81[_0x9d23('0x4a')],{})[_0x9d23('0x43')](respondWithResult(_0x53cdd4,0xc9))[_0x9d23('0x47')](handleError(_0x53cdd4,null));};exports['update']=function(_0x5c45bb,_0x4fabce){if(_0x5c45bb['body']['id']){delete _0x5c45bb[_0x9d23('0x4a')]['id'];}return db[_0x9d23('0x2e')][_0x9d23('0x48')]({'where':{'id':_0x5c45bb[_0x9d23('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4fabce,null))[_0x9d23('0x43')](saveUpdates(_0x5c45bb['body'],null))[_0x9d23('0x43')](respondWithResult(_0x4fabce,null))[_0x9d23('0x47')](handleError(_0x4fabce,null));};exports[_0x9d23('0x29')]=function(_0x10d6fa,_0x5368b9){return db[_0x9d23('0x2e')][_0x9d23('0x48')]({'where':{'id':_0x10d6fa['params']['id']}})[_0x9d23('0x43')](handleEntityNotFound(_0x5368b9,null))[_0x9d23('0x43')](removeEntity(_0x5368b9,null))[_0x9d23('0x47')](handleError(_0x5368b9,null));};exports['getConfigurations']=function(_0xd3854b,_0xba1cf0,_0x355c5d){var _0x95c4a1={};var _0x1700b2={};var _0x101f71;var _0x44403e;return db[_0x9d23('0x2e')][_0x9d23('0x4c')]({'where':{'id':_0xd3854b[_0x9d23('0x4b')]['id']}})['then'](handleEntityNotFound(_0xba1cf0,null))[_0x9d23('0x43')](function(_0x2ab8d3){if(_0x2ab8d3){_0x101f71=_0x2ab8d3;_0x1700b2[_0x9d23('0x32')]=_[_0x9d23('0x34')](db[_0x9d23('0x4d')]['rawAttributes']);_0x1700b2[_0x9d23('0x37')]=_[_0x9d23('0x34')](_0xd3854b[_0x9d23('0x37')]);_0x1700b2[_0x9d23('0x35')]=_[_0x9d23('0x36')](_0x1700b2[_0x9d23('0x32')],_0x1700b2['query']);_0x95c4a1[_0x9d23('0x38')]=_[_0x9d23('0x36')](_0x1700b2[_0x9d23('0x32')],qs['fields'](_0xd3854b[_0x9d23('0x37')][_0x9d23('0x39')]));_0x95c4a1['attributes']=_0x95c4a1['attributes'][_0x9d23('0x3a')]?_0x95c4a1[_0x9d23('0x38')]:_0x1700b2[_0x9d23('0x32')];_0x95c4a1[_0x9d23('0x3c')]=qs['sort'](_0xd3854b['query']['sort']);_0x95c4a1[_0x9d23('0x3d')]=qs[_0x9d23('0x35')](_[_0x9d23('0x3e')](_0xd3854b[_0x9d23('0x37')],_0x1700b2[_0x9d23('0x35')]));if(_0xd3854b[_0x9d23('0x37')][_0x9d23('0x3f')]){_0x95c4a1[_0x9d23('0x3d')]=_['merge'](_0x95c4a1[_0x9d23('0x3d')],{'$or':_[_0x9d23('0x33')](_0x95c4a1[_0x9d23('0x38')],function(_0x3df0b8){var _0x296c3a={};_0x296c3a[_0x3df0b8]={'$like':'%'+_0xd3854b[_0x9d23('0x37')][_0x9d23('0x3f')]+'%'};return _0x296c3a;})});}_0x95c4a1=_[_0x9d23('0x40')]({},_0x95c4a1,_0xd3854b['options']);return _0x101f71[_0x9d23('0x4e')](_0x95c4a1);}})[_0x9d23('0x43')](function(_0x4d5d4d){if(_0x4d5d4d){_0x44403e=_0x4d5d4d[_0x9d23('0x3a')];if(!_0xd3854b[_0x9d23('0x37')]['hasOwnProperty'](_0x9d23('0x4f'))){_0x95c4a1[_0x9d23('0x20')]=qs[_0x9d23('0x20')](_0xd3854b[_0x9d23('0x37')]['limit']);_0x95c4a1[_0x9d23('0x1e')]=qs[_0x9d23('0x1e')](_0xd3854b['query'][_0x9d23('0x1e')]);}return _0x101f71[_0x9d23('0x4e')](_0x95c4a1);}})[_0x9d23('0x43')](function(_0x29665e){if(_0x29665e){return _0x29665e?{'count':_0x44403e,'rows':_0x29665e}:null;}})[_0x9d23('0x43')](respondWithResult(_0xba1cf0,null))[_0x9d23('0x47')](handleError(_0xba1cf0,null));};exports[_0x9d23('0x50')]=function(_0x17c46f,_0x2b1ac8,_0x4e72b2){if(_0x17c46f[_0x9d23('0x4a')]['id']){delete _0x17c46f['body']['id'];}return db[_0x9d23('0x2e')]['findOne']({'where':{'id':_0x17c46f[_0x9d23('0x4b')]['id']}})[_0x9d23('0x43')](handleEntityNotFound(_0x2b1ac8,null))[_0x9d23('0x43')](function(_0x2295ea){if(_0x2295ea){_0x17c46f['body'][_0x9d23('0x51')]=_0x2295ea['id'];_0x17c46f['body'][_0x9d23('0x52')]=integrations[_0x9d23('0x53')](_0x17c46f[_0x9d23('0x4a')][_0x9d23('0x54')],_0x17c46f[_0x9d23('0x4a')][_0x9d23('0x30')]);_0x17c46f['body'][_0x9d23('0x55')]=integrations[_0x9d23('0x56')](_0x17c46f['body'][_0x9d23('0x54')],_0x17c46f[_0x9d23('0x4a')][_0x9d23('0x30')]);return db['SalesforceConfiguration']['create'](_0x17c46f['body'],{'include':[{'model':db[_0x9d23('0x57')],'as':'Subjects'},{'model':db[_0x9d23('0x57')],'as':_0x9d23('0x55')}]});}return null;})['then'](respondWithResult(_0x2b1ac8,null))[_0x9d23('0x47')](handleError(_0x2b1ac8,null));};exports[_0x9d23('0x58')]=function(_0x56c5a8,_0xc359d3,_0x4965de){var _0x3d75c7;var _0x21fcb3='';var _0x17186e=_0x9d23('0x59');return db[_0x9d23('0x2e')][_0x9d23('0x4c')]({'where':{'id':_0x56c5a8['params']['id']},'attributes':['id','remoteUri',_0x9d23('0x5a'),_0x9d23('0x5b'),_0x9d23('0x5c'),_0x9d23('0x5d'),_0x9d23('0x5e')]})['then'](handleEntityNotFound(_0xc359d3,null))[_0x9d23('0x43')](function(_0x5776f2){if(_0x5776f2){_0x21fcb3=_0x5776f2['remoteUri'];var _0x50b7f1=_0x21fcb3[_0x9d23('0x5f')](-0x1);if(_0x50b7f1==='/'){_0x21fcb3=_0x21fcb3[_0x9d23('0x60')](0x0,_0x21fcb3['lastIndexOf'](_0x50b7f1));}_0x3d75c7=new jsforce[(_0x9d23('0x61'))]({'oauth2':{'loginUrl':_0x21fcb3,'clientId':_0x5776f2[_0x9d23('0x5a')],'clientSecret':_0x5776f2['clientSecret']}});return _0x3d75c7[_0x9d23('0x62')](_0x5776f2[_0x9d23('0x5c')],_0x5776f2[_0x9d23('0x5d')][_0x9d23('0x63')](_0x5776f2['securityToken']));}})['then'](function(_0x3f96b4){if(_0x3f96b4){if(!_[_0x9d23('0x64')](_0x56c5a8[_0x9d23('0x37')][_0x9d23('0x65')])){_0x17186e=_0x56c5a8['query'][_0x9d23('0x65')];}return _0x3d75c7['sobject'](_0x17186e)['describe']();}})[_0x9d23('0x43')](function(_0x30bbe0){var _0xccc623=[_0x9d23('0x66'),_0x9d23('0x67'),_0x9d23('0x68'),'IsRecurrence','Subject',_0x9d23('0x69')];var _0x1319ce=['string',_0x9d23('0x6a'),'picklist',_0x9d23('0x6b'),_0x9d23('0x6c'),_0x9d23('0x6d'),'phone'];if(_0x30bbe0){_['remove'](_0x30bbe0[_0x9d23('0x39')],function(_0x1051ca){return _0xccc623['includes'](_0x1051ca[_0x9d23('0x2c')])||!_0x1319ce['includes'](_0x1051ca[_0x9d23('0x30')]);});return{'count':_0x30bbe0[_0x9d23('0x39')][_0x9d23('0x3a')],'rows':_[_0x9d23('0x33')](_0x30bbe0[_0x9d23('0x39')],function(_0x11f545){return{'id':_0x11f545[_0x9d23('0x2c')],'name':_0x11f545['label'],'custom':_0x11f545[_0x9d23('0x6e')],'options':_0x11f545[_0x9d23('0x6f')][_0x9d23('0x3a')]>0x0?_[_0x9d23('0x33')](_0x11f545[_0x9d23('0x6f')],function(_0x3ed097){return{'name':_0x3ed097[_0x9d23('0x70')],'value':_0x3ed097[_0x9d23('0x71')]};}):_0x11f545[_0x9d23('0x30')]==_0x9d23('0x6b')?[{'name':_0x9d23('0x72'),'value':_0x9d23('0x73')},{'name':_0x9d23('0x74'),'value':'false'}]:[]};})};}})[_0x9d23('0x43')](respondWithResult(_0xc359d3,null))[_0x9d23('0x47')](function(_0x5553bb){var _0x5d42a6=_0x56c5a8[_0x9d23('0x37')]['test']?0x1f4:_0x5553bb['statusCode']||0x1f4;logger['error'](_0x9d23('0x75'),_0x9d23('0x58'),_0x5d42a6,JSON[_0x9d23('0x76')](_0x5553bb));delete _0x5553bb[_0x9d23('0x2c')];if(_0x5d42a6===0x191){_0x5d42a6=0x190;}_0xc359d3[_0x9d23('0x1c')](_0x5d42a6)[_0x9d23('0x2d')](_0x56c5a8[_0x9d23('0x37')]['test']?{'message':_0x9d23('0x77'),'statusCode':_0x5553bb[_0x9d23('0x78')]}:_0x5553bb);});}; \ No newline at end of file +var _0x5714=['key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','getConfigurations','findOne','SalesforceConfiguration','length','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getFields','Task','remoteUri','clientId','username','password','securityToken','substring','lastIndexOf','Connection','clientSecret','concat','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','Description','int','boolean','email','phone','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','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','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','index','map','SalesforceAccount','fieldName','type'];(function(_0x1da33a,_0x3b20a0){var _0x2a2e78=function(_0x17f0ee){while(--_0x17f0ee){_0x1da33a['push'](_0x1da33a['shift']());}};_0x2a2e78(++_0x3b20a0);}(_0x5714,0xc3));var _0x4571=function(_0x434498,_0x2110c3){_0x434498=_0x434498-0x0;var _0x36e62a=_0x5714[_0x434498];return _0x36e62a;};'use strict';var emlformat=require(_0x4571('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4571('0x1'));var jsonpatch=require(_0x4571('0x2'));var rp=require(_0x4571('0x3'));var moment=require(_0x4571('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4571('0x5'));var path=require(_0x4571('0x6'));var sox=require(_0x4571('0x7'));var csv=require('to-csv');var ejs=require(_0x4571('0x8'));var fs=require('fs');var fs_extra=require(_0x4571('0x9'));var _=require(_0x4571('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4571('0xb'));var deskjs=require(_0x4571('0xc'));var toCsv=require(_0x4571('0xd'));var querystring=require(_0x4571('0xe'));var Papa=require(_0x4571('0xf'));var Redis=require(_0x4571('0x10'));var authService=require(_0x4571('0x11'));var qs=require(_0x4571('0x12'));var as=require(_0x4571('0x13'));var hardwareService=require(_0x4571('0x14'));var logger=require('../../config/logger')(_0x4571('0x15'));var utils=require('../../config/utils');var config=require(_0x4571('0x16'));var licenseUtil=require(_0x4571('0x17'));var db=require(_0x4571('0x18'))['db'];var integrations=require(_0x4571('0x19'));function respondWithStatusCode(_0x113510,_0x3eff1a){_0x3eff1a=_0x3eff1a||0xcc;return function(_0x2753b3){if(_0x2753b3){return _0x113510[_0x4571('0x1a')](_0x3eff1a);}return _0x113510[_0x4571('0x1b')](_0x3eff1a)[_0x4571('0x1c')]();};}function respondWithResult(_0x12f6fa,_0x564c99){_0x564c99=_0x564c99||0xc8;return function(_0x323165){if(_0x323165){return _0x12f6fa[_0x4571('0x1b')](_0x564c99)[_0x4571('0x1d')](_0x323165);}};}function respondWithFilteredResult(_0x298e50,_0x36c014){return function(_0x52ddbd){if(_0x52ddbd){var _0x1bbf20=typeof _0x36c014[_0x4571('0x1e')]===_0x4571('0x1f')&&typeof _0x36c014[_0x4571('0x20')]==='undefined';var _0x5879e6=_0x52ddbd[_0x4571('0x21')];var _0x147f24=_0x1bbf20?0x0:_0x36c014[_0x4571('0x1e')];var _0x169c2a=_0x1bbf20?_0x52ddbd[_0x4571('0x21')]:_0x36c014[_0x4571('0x1e')]+_0x36c014['limit'];var _0x4d0fb3;if(_0x169c2a>=_0x5879e6){_0x169c2a=_0x5879e6;_0x4d0fb3=0xc8;}else{_0x4d0fb3=0xce;}_0x298e50[_0x4571('0x1b')](_0x4d0fb3);return _0x298e50[_0x4571('0x22')]('Content-Range',_0x147f24+'-'+_0x169c2a+'/'+_0x5879e6)[_0x4571('0x1d')](_0x52ddbd);}return null;};}function patchUpdates(_0x45a5b7){return function(_0x53190b){try{jsonpatch[_0x4571('0x23')](_0x53190b,_0x45a5b7,!![]);}catch(_0x182601){return BPromise['reject'](_0x182601);}return _0x53190b[_0x4571('0x24')]();};}function saveUpdates(_0x1e122f,_0x5e6a32){return function(_0x1e92a8){if(_0x1e92a8){return _0x1e92a8[_0x4571('0x25')](_0x1e122f)[_0x4571('0x26')](function(_0x5ba437){return _0x5ba437;});}return null;};}function removeEntity(_0x5592e1,_0x15d0e2){return function(_0x3f8959){if(_0x3f8959){return _0x3f8959[_0x4571('0x27')]()[_0x4571('0x26')](function(){_0x5592e1[_0x4571('0x1b')](0xcc)[_0x4571('0x1c')]();});}};}function handleEntityNotFound(_0xd7dc85,_0x5075e0){return function(_0x114e73){if(!_0x114e73){_0xd7dc85[_0x4571('0x1a')](0x194);}return _0x114e73;};}function handleError(_0x2d6d98,_0x3a26a7){_0x3a26a7=_0x3a26a7||0x1f4;return function(_0x43011a){logger[_0x4571('0x28')](_0x43011a[_0x4571('0x29')]);if(_0x43011a[_0x4571('0x2a')]){delete _0x43011a[_0x4571('0x2a')];}_0x2d6d98[_0x4571('0x1b')](_0x3a26a7)[_0x4571('0x2b')](_0x43011a);};}exports[_0x4571('0x2c')]=function(_0x4e572b,_0x3cb9b6){var _0x1196e5={},_0x1a0d08={},_0x5b2782={'count':0x0,'rows':[]};var _0x17a356=_[_0x4571('0x2d')](db[_0x4571('0x2e')]['rawAttributes'],function(_0x1466ef){return{'name':_0x1466ef[_0x4571('0x2f')],'type':_0x1466ef[_0x4571('0x30')][_0x4571('0x31')]};});_0x1a0d08[_0x4571('0x32')]=_['map'](_0x17a356,'name');_0x1a0d08[_0x4571('0x33')]=_[_0x4571('0x34')](_0x4e572b[_0x4571('0x33')]);_0x1a0d08[_0x4571('0x35')]=_[_0x4571('0x36')](_0x1a0d08[_0x4571('0x32')],_0x1a0d08[_0x4571('0x33')]);_0x1196e5[_0x4571('0x37')]=_[_0x4571('0x36')](_0x1a0d08[_0x4571('0x32')],qs[_0x4571('0x38')](_0x4e572b[_0x4571('0x33')][_0x4571('0x38')]));_0x1196e5[_0x4571('0x37')]=_0x1196e5[_0x4571('0x37')]['length']?_0x1196e5['attributes']:_0x1a0d08[_0x4571('0x32')];if(!_0x4e572b[_0x4571('0x33')]['hasOwnProperty'](_0x4571('0x39'))){_0x1196e5['limit']=qs[_0x4571('0x20')](_0x4e572b[_0x4571('0x33')][_0x4571('0x20')]);_0x1196e5['offset']=qs['offset'](_0x4e572b[_0x4571('0x33')]['offset']);}_0x1196e5[_0x4571('0x3a')]=qs[_0x4571('0x3b')](_0x4e572b['query']['sort']);_0x1196e5[_0x4571('0x3c')]=qs[_0x4571('0x35')](_[_0x4571('0x3d')](_0x4e572b['query'],_0x1a0d08['filters']),_0x17a356);if(_0x4e572b[_0x4571('0x33')][_0x4571('0x3e')]){_0x1196e5[_0x4571('0x3c')]=_[_0x4571('0x3f')](_0x1196e5[_0x4571('0x3c')],{'$or':_[_0x4571('0x2d')](_0x17a356,function(_0x5d90ec){if(_0x5d90ec[_0x4571('0x30')]!==_0x4571('0x40')){var _0x14773b={};_0x14773b[_0x5d90ec['name']]={'$like':'%'+_0x4e572b[_0x4571('0x33')][_0x4571('0x3e')]+'%'};return _0x14773b;}})});}_0x1196e5=_['merge']({},_0x1196e5,_0x4e572b[_0x4571('0x41')]);var _0x3390de={'where':_0x1196e5['where']};return db[_0x4571('0x2e')][_0x4571('0x21')](_0x3390de)[_0x4571('0x26')](function(_0x8ad232){_0x5b2782['count']=_0x8ad232;if(_0x4e572b[_0x4571('0x33')][_0x4571('0x42')]){_0x1196e5[_0x4571('0x43')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x1196e5);})[_0x4571('0x26')](function(_0x555156){_0x5b2782[_0x4571('0x44')]=_0x555156;return _0x5b2782;})[_0x4571('0x26')](respondWithFilteredResult(_0x3cb9b6,_0x1196e5))[_0x4571('0x45')](handleError(_0x3cb9b6,null));};exports[_0x4571('0x46')]=function(_0x2a56b6,_0x3f82bc){var _0x2f6ed7={'raw':![],'where':{'id':_0x2a56b6[_0x4571('0x47')]['id']}},_0x3e99e0={};_0x3e99e0[_0x4571('0x32')]=_[_0x4571('0x34')](db[_0x4571('0x2e')][_0x4571('0x48')]);_0x3e99e0[_0x4571('0x33')]=_[_0x4571('0x34')](_0x2a56b6[_0x4571('0x33')]);_0x3e99e0['filters']=_[_0x4571('0x36')](_0x3e99e0[_0x4571('0x32')],_0x3e99e0[_0x4571('0x33')]);_0x2f6ed7[_0x4571('0x37')]=_[_0x4571('0x36')](_0x3e99e0['model'],qs[_0x4571('0x38')](_0x2a56b6[_0x4571('0x33')]['fields']));_0x2f6ed7[_0x4571('0x37')]=_0x2f6ed7['attributes']['length']?_0x2f6ed7['attributes']:_0x3e99e0[_0x4571('0x32')];if(_0x2a56b6[_0x4571('0x33')][_0x4571('0x42')]){_0x2f6ed7[_0x4571('0x43')]=[{'all':!![]}];}_0x2f6ed7=_[_0x4571('0x3f')]({},_0x2f6ed7,_0x2a56b6[_0x4571('0x41')]);return db[_0x4571('0x2e')][_0x4571('0x49')](_0x2f6ed7)['then'](handleEntityNotFound(_0x3f82bc,null))['then'](respondWithResult(_0x3f82bc,null))[_0x4571('0x45')](handleError(_0x3f82bc,null));};exports[_0x4571('0x4a')]=function(_0x5b55a4,_0xab151c){return db[_0x4571('0x2e')][_0x4571('0x4a')](_0x5b55a4[_0x4571('0x4b')],{})[_0x4571('0x26')](respondWithResult(_0xab151c,0xc9))[_0x4571('0x45')](handleError(_0xab151c,null));};exports[_0x4571('0x25')]=function(_0x570f6a,_0x559093){if(_0x570f6a[_0x4571('0x4b')]['id']){delete _0x570f6a[_0x4571('0x4b')]['id'];}return db[_0x4571('0x2e')][_0x4571('0x49')]({'where':{'id':_0x570f6a['params']['id']}})['then'](handleEntityNotFound(_0x559093,null))[_0x4571('0x26')](saveUpdates(_0x570f6a[_0x4571('0x4b')],null))[_0x4571('0x26')](respondWithResult(_0x559093,null))['catch'](handleError(_0x559093,null));};exports[_0x4571('0x27')]=function(_0x486434,_0x25af5c){return db[_0x4571('0x2e')]['find']({'where':{'id':_0x486434[_0x4571('0x47')]['id']}})[_0x4571('0x26')](handleEntityNotFound(_0x25af5c,null))[_0x4571('0x26')](removeEntity(_0x25af5c,null))[_0x4571('0x45')](handleError(_0x25af5c,null));};exports[_0x4571('0x4c')]=function(_0x571c61,_0x4579c7,_0x13e909){var _0x1f2ee2={};var _0x513176={};var _0xf57919;var _0x3b185d;return db[_0x4571('0x2e')][_0x4571('0x4d')]({'where':{'id':_0x571c61[_0x4571('0x47')]['id']}})[_0x4571('0x26')](handleEntityNotFound(_0x4579c7,null))[_0x4571('0x26')](function(_0x105e21){if(_0x105e21){_0xf57919=_0x105e21;_0x513176['model']=_['keys'](db[_0x4571('0x4e')][_0x4571('0x48')]);_0x513176[_0x4571('0x33')]=_[_0x4571('0x34')](_0x571c61[_0x4571('0x33')]);_0x513176[_0x4571('0x35')]=_['intersection'](_0x513176[_0x4571('0x32')],_0x513176[_0x4571('0x33')]);_0x1f2ee2['attributes']=_['intersection'](_0x513176[_0x4571('0x32')],qs[_0x4571('0x38')](_0x571c61[_0x4571('0x33')][_0x4571('0x38')]));_0x1f2ee2[_0x4571('0x37')]=_0x1f2ee2[_0x4571('0x37')][_0x4571('0x4f')]?_0x1f2ee2['attributes']:_0x513176[_0x4571('0x32')];_0x1f2ee2[_0x4571('0x3a')]=qs[_0x4571('0x3b')](_0x571c61['query']['sort']);_0x1f2ee2[_0x4571('0x3c')]=qs[_0x4571('0x35')](_['pick'](_0x571c61[_0x4571('0x33')],_0x513176['filters']));if(_0x571c61[_0x4571('0x33')][_0x4571('0x3e')]){_0x1f2ee2[_0x4571('0x3c')]=_[_0x4571('0x3f')](_0x1f2ee2[_0x4571('0x3c')],{'$or':_[_0x4571('0x2d')](_0x1f2ee2[_0x4571('0x37')],function(_0x51b207){var _0x6f0f98={};_0x6f0f98[_0x51b207]={'$like':'%'+_0x571c61[_0x4571('0x33')][_0x4571('0x3e')]+'%'};return _0x6f0f98;})});}_0x1f2ee2=_[_0x4571('0x3f')]({},_0x1f2ee2,_0x571c61[_0x4571('0x41')]);return _0xf57919[_0x4571('0x4c')](_0x1f2ee2);}})[_0x4571('0x26')](function(_0x535c39){if(_0x535c39){_0x3b185d=_0x535c39[_0x4571('0x4f')];if(!_0x571c61[_0x4571('0x33')][_0x4571('0x50')](_0x4571('0x39'))){_0x1f2ee2[_0x4571('0x20')]=qs[_0x4571('0x20')](_0x571c61[_0x4571('0x33')][_0x4571('0x20')]);_0x1f2ee2[_0x4571('0x1e')]=qs[_0x4571('0x1e')](_0x571c61[_0x4571('0x33')][_0x4571('0x1e')]);}return _0xf57919[_0x4571('0x4c')](_0x1f2ee2);}})[_0x4571('0x26')](function(_0x120ea9){if(_0x120ea9){return _0x120ea9?{'count':_0x3b185d,'rows':_0x120ea9}:null;}})[_0x4571('0x26')](respondWithResult(_0x4579c7,null))[_0x4571('0x45')](handleError(_0x4579c7,null));};exports['addConfiguration']=function(_0x33d1d7,_0x560e37,_0x252064){if(_0x33d1d7[_0x4571('0x4b')]['id']){delete _0x33d1d7['body']['id'];}return db[_0x4571('0x2e')][_0x4571('0x4d')]({'where':{'id':_0x33d1d7['params']['id']}})['then'](handleEntityNotFound(_0x560e37,null))[_0x4571('0x26')](function(_0x537a9e){if(_0x537a9e){_0x33d1d7['body'][_0x4571('0x51')]=_0x537a9e['id'];_0x33d1d7[_0x4571('0x4b')][_0x4571('0x52')]=integrations[_0x4571('0x53')](_0x33d1d7['body'][_0x4571('0x54')],_0x33d1d7[_0x4571('0x4b')][_0x4571('0x30')]);_0x33d1d7[_0x4571('0x4b')]['Descriptions']=integrations['getDescriptions'](_0x33d1d7['body'][_0x4571('0x54')],_0x33d1d7[_0x4571('0x4b')][_0x4571('0x30')]);return db[_0x4571('0x4e')][_0x4571('0x4a')](_0x33d1d7[_0x4571('0x4b')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0x4571('0x55')}]});}return null;})[_0x4571('0x26')](respondWithResult(_0x560e37,null))[_0x4571('0x45')](handleError(_0x560e37,null));};exports[_0x4571('0x56')]=function(_0x49d70c,_0x3cf147,_0x29145f){var _0x5b9d58;var _0x4174ee='';var _0x1141ba=_0x4571('0x57');return db['SalesforceAccount'][_0x4571('0x4d')]({'where':{'id':_0x49d70c[_0x4571('0x47')]['id']},'attributes':['id',_0x4571('0x58'),_0x4571('0x59'),'clientSecret',_0x4571('0x5a'),_0x4571('0x5b'),_0x4571('0x5c')]})[_0x4571('0x26')](handleEntityNotFound(_0x3cf147,null))[_0x4571('0x26')](function(_0x1a8c08){if(_0x1a8c08){_0x4174ee=_0x1a8c08[_0x4571('0x58')];var _0x454670=_0x4174ee['slice'](-0x1);if(_0x454670==='/'){_0x4174ee=_0x4174ee[_0x4571('0x5d')](0x0,_0x4174ee[_0x4571('0x5e')](_0x454670));}_0x5b9d58=new jsforce[(_0x4571('0x5f'))]({'oauth2':{'loginUrl':_0x4174ee,'clientId':_0x1a8c08[_0x4571('0x59')],'clientSecret':_0x1a8c08[_0x4571('0x60')]}});return _0x5b9d58['login'](_0x1a8c08[_0x4571('0x5a')],_0x1a8c08[_0x4571('0x5b')][_0x4571('0x61')](_0x1a8c08[_0x4571('0x5c')]));}})[_0x4571('0x26')](function(_0x17c3fd){if(_0x17c3fd){if(!_['isNil'](_0x49d70c[_0x4571('0x33')][_0x4571('0x62')])){_0x1141ba=_0x49d70c[_0x4571('0x33')]['ticketType'];}return _0x5b9d58['sobject'](_0x1141ba)[_0x4571('0x63')]();}})['then'](function(_0x5715dc){var _0x4a2f23=[_0x4571('0x64'),_0x4571('0x65'),_0x4571('0x66'),'IsRecurrence','Subject',_0x4571('0x67')];var _0x3f882d=['string',_0x4571('0x68'),'picklist',_0x4571('0x69'),_0x4571('0x6a'),'textarea',_0x4571('0x6b')];if(_0x5715dc){_[_0x4571('0x6c')](_0x5715dc[_0x4571('0x38')],function(_0x5a07f9){return _0x4a2f23[_0x4571('0x6d')](_0x5a07f9[_0x4571('0x2a')])||!_0x3f882d[_0x4571('0x6d')](_0x5a07f9[_0x4571('0x30')]);});return{'count':_0x5715dc[_0x4571('0x38')][_0x4571('0x4f')],'rows':_['map'](_0x5715dc[_0x4571('0x38')],function(_0x6f058b){return{'id':_0x6f058b[_0x4571('0x2a')],'name':_0x6f058b[_0x4571('0x6e')],'custom':_0x6f058b[_0x4571('0x6f')],'options':_0x6f058b[_0x4571('0x70')][_0x4571('0x4f')]>0x0?_[_0x4571('0x2d')](_0x6f058b['picklistValues'],function(_0x4a72bb){return{'name':_0x4a72bb['label'],'value':_0x4a72bb[_0x4571('0x71')]};}):_0x6f058b[_0x4571('0x30')]==_0x4571('0x69')?[{'name':_0x4571('0x72'),'value':_0x4571('0x73')},{'name':_0x4571('0x74'),'value':_0x4571('0x75')}]:[]};})};}})[_0x4571('0x26')](respondWithResult(_0x3cf147,null))[_0x4571('0x45')](function(_0x1bab3f){var _0x175b0e=_0x49d70c[_0x4571('0x33')][_0x4571('0x76')]?0x1f4:_0x1bab3f['statusCode']||0x1f4;logger[_0x4571('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x4571('0x56'),_0x175b0e,JSON[_0x4571('0x77')](_0x1bab3f));delete _0x1bab3f['name'];if(_0x175b0e===0x191){_0x175b0e=0x190;}_0x3cf147[_0x4571('0x1b')](_0x175b0e)[_0x4571('0x2b')](_0x49d70c[_0x4571('0x33')][_0x4571('0x76')]?{'message':_0x4571('0x78'),'statusCode':_0x1bab3f[_0x4571('0x79')]}:_0x1bab3f);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 57dd4f9..3c1ea76 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 _0x6737=['exports','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x13d5bc,_0x3fce3c){var _0x4b8a40=function(_0xe3ef3a){while(--_0xe3ef3a){_0x13d5bc['push'](_0x13d5bc['shift']());}};_0x4b8a40(++_0x3fce3c);}(_0x6737,0xe2));var _0x7673=function(_0x199ace,_0x15b5e7){_0x199ace=_0x199ace-0x0;var _0x4e44b7=_0x6737[_0x199ace];return _0x4e44b7;};'use strict';var _=require('lodash');var util=require(_0x7673('0x0'));var logger=require(_0x7673('0x1'))('api');var moment=require(_0x7673('0x2'));var BPromise=require(_0x7673('0x3'));var rp=require(_0x7673('0x4'));var fs=require('fs');var path=require(_0x7673('0x5'));var rimraf=require('rimraf');var config=require(_0x7673('0x6'));var attributes=require(_0x7673('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x7673('0x8')]=function(_0x15230f,_0x5af802){return _0x15230f['define']('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c32=['path','../../config/environment','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x8c32,0x89));var _0x28c3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8c32[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x28c3('0x0'));var util=require(_0x28c3('0x1'));var logger=require(_0x28c3('0x2'))(_0x28c3('0x3'));var moment=require('moment');var BPromise=require(_0x28c3('0x4'));var rp=require(_0x28c3('0x5'));var fs=require('fs');var path=require(_0x28c3('0x6'));var rimraf=require('rimraf');var config=require(_0x28c3('0x7'));var attributes=require(_0x28c3('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x28c3('0x9')]=function(_0x32a8aa,_0x40bb2c){return _0x32a8aa[_0x28c3('0xa')](_0x28c3('0xb'),attributes,{'tableName':_0x28c3('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 16cfeaa..366855d 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 _0x6dda=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','SalesforceAccount','findAll','options','raw','where','attributes','limit','map','include','GetSalesforceAccount','ShowSalesforceAccount','find','model','lodash','util'];(function(_0xa5cec5,_0x507486){var _0x39a539=function(_0x5de509){while(--_0x5de509){_0xa5cec5['push'](_0xa5cec5['shift']());}};_0x39a539(++_0x507486);}(_0x6dda,0x17a));var _0xa6dd=function(_0x551115,_0x5670a3){_0x551115=_0x551115-0x0;var _0xfd01e8=_0x6dda[_0x551115];return _0xfd01e8;};'use strict';var _=require(_0xa6dd('0x0'));var util=require(_0xa6dd('0x1'));var moment=require('moment');var BPromise=require(_0xa6dd('0x2'));var rs=require(_0xa6dd('0x3'));var fs=require('fs');var Redis=require(_0xa6dd('0x4'));var db=require(_0xa6dd('0x5'))['db'];var utils=require(_0xa6dd('0x6'));var logger=require(_0xa6dd('0x7'))(_0xa6dd('0x8'));var config=require(_0xa6dd('0x9'));var jayson=require(_0xa6dd('0xa'));var client=jayson[_0xa6dd('0xb')][_0xa6dd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x48c2c5,_0x1f1422,_0x2e1485){return new BPromise(function(_0x5ec3da,_0xc15a42){return client[_0xa6dd('0xd')](_0x48c2c5,_0x2e1485)[_0xa6dd('0xe')](function(_0x35894a){logger[_0xa6dd('0xf')](_0xa6dd('0x10'),_0x1f1422,'request\x20sent');logger[_0xa6dd('0x11')](_0xa6dd('0x12'),_0x1f1422,_0xa6dd('0x13'),JSON[_0xa6dd('0x14')](_0x35894a));if(_0x35894a[_0xa6dd('0x15')]){if(_0x35894a[_0xa6dd('0x15')][_0xa6dd('0x16')]===0x1f4){logger['error'](_0xa6dd('0x10'),_0x1f1422,_0x35894a[_0xa6dd('0x15')][_0xa6dd('0x17')]);return _0xc15a42(_0x35894a[_0xa6dd('0x15')][_0xa6dd('0x17')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x1f1422,_0x35894a[_0xa6dd('0x15')]['message']);return _0x5ec3da(_0x35894a[_0xa6dd('0x15')]['message']);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x1f1422,_0xa6dd('0x13'));_0x5ec3da(_0x35894a['result'][_0xa6dd('0x17')]);}})[_0xa6dd('0x18')](function(_0x452bb0){logger['error'](_0xa6dd('0x10'),_0x1f1422,_0x452bb0);_0xc15a42(_0x452bb0);});});}exports['GetSalesforceAccount']=function(_0x4a72bf){var _0x29002c=this;return new Promise(function(_0x3e60d9,_0x311aac){return db[_0xa6dd('0x19')][_0xa6dd('0x1a')]({'raw':_0x4a72bf['options']?_0x4a72bf[_0xa6dd('0x1b')][_0xa6dd('0x1c')]===undefined?!![]:![]:!![],'where':_0x4a72bf[_0xa6dd('0x1b')]?_0x4a72bf[_0xa6dd('0x1b')][_0xa6dd('0x1d')]||null:null,'attributes':_0x4a72bf[_0xa6dd('0x1b')]?_0x4a72bf['options'][_0xa6dd('0x1e')]||null:null,'limit':_0x4a72bf['options']?_0x4a72bf[_0xa6dd('0x1b')][_0xa6dd('0x1f')]||null:null,'include':_0x4a72bf['options']?_0x4a72bf[_0xa6dd('0x1b')]['include']?_[_0xa6dd('0x20')](_0x4a72bf[_0xa6dd('0x1b')][_0xa6dd('0x21')],function(_0x52b997){return{'model':db[_0x52b997['model']],'as':_0x52b997['as'],'attributes':_0x52b997[_0xa6dd('0x1e')],'include':_0x52b997[_0xa6dd('0x21')]?_[_0xa6dd('0x20')](_0x52b997[_0xa6dd('0x21')],function(_0x5d576e){return{'model':db[_0x5d576e['model']],'as':_0x5d576e['as'],'attributes':_0x5d576e['attributes'],'include':_0x5d576e[_0xa6dd('0x21')]?_[_0xa6dd('0x20')](_0x5d576e['include'],function(_0x4d2be4){return{'model':db[_0x4d2be4['model']],'as':_0x4d2be4['as'],'attributes':_0x4d2be4[_0xa6dd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa6dd('0xe')](function(_0x216b10){logger[_0xa6dd('0xf')](_0xa6dd('0x22'),_0x4a72bf);logger[_0xa6dd('0x11')](_0xa6dd('0x22'),_0x4a72bf,JSON['stringify'](_0x216b10));_0x3e60d9(_0x216b10);})[_0xa6dd('0x18')](function(_0xe2079a){logger[_0xa6dd('0x15')](_0xa6dd('0x22'),_0xe2079a[_0xa6dd('0x17')],_0x4a72bf);_0x311aac(_0x29002c['error'](0x1f4,_0xe2079a[_0xa6dd('0x17')]));});});};exports[_0xa6dd('0x23')]=function(_0x163805){var _0x3ea030=this;return new Promise(function(_0x24a881,_0x21b3e4){return db[_0xa6dd('0x19')][_0xa6dd('0x24')]({'raw':_0x163805[_0xa6dd('0x1b')]?_0x163805[_0xa6dd('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x163805[_0xa6dd('0x1b')]?_0x163805[_0xa6dd('0x1b')][_0xa6dd('0x1d')]||null:null,'attributes':_0x163805[_0xa6dd('0x1b')]?_0x163805['options'][_0xa6dd('0x1e')]||null:null,'include':_0x163805['options']?_0x163805[_0xa6dd('0x1b')][_0xa6dd('0x21')]?_[_0xa6dd('0x20')](_0x163805[_0xa6dd('0x1b')][_0xa6dd('0x21')],function(_0x3952f4){return{'model':db[_0x3952f4[_0xa6dd('0x25')]],'as':_0x3952f4['as'],'attributes':_0x3952f4[_0xa6dd('0x1e')],'include':_0x3952f4[_0xa6dd('0x21')]?_[_0xa6dd('0x20')](_0x3952f4[_0xa6dd('0x21')],function(_0x5a8291){return{'model':db[_0x5a8291[_0xa6dd('0x25')]],'as':_0x5a8291['as'],'attributes':_0x5a8291[_0xa6dd('0x1e')],'include':_0x5a8291['include']?_[_0xa6dd('0x20')](_0x5a8291[_0xa6dd('0x21')],function(_0x27a52c){return{'model':db[_0x27a52c[_0xa6dd('0x25')]],'as':_0x27a52c['as'],'attributes':_0x27a52c[_0xa6dd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa6dd('0xe')](function(_0x409236){logger[_0xa6dd('0xf')]('ShowSalesforceAccount',_0x163805);logger['debug'](_0xa6dd('0x23'),_0x163805,JSON[_0xa6dd('0x14')](_0x409236));_0x24a881(_0x409236);})[_0xa6dd('0x18')](function(_0x491a86){logger['error'](_0xa6dd('0x23'),_0x491a86[_0xa6dd('0x17')],_0x163805);_0x21b3e4(_0x3ea030[_0xa6dd('0x15')](0x1f4,_0x491a86['message']));});});}; \ No newline at end of file +var _0x30d8=['SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowSalesforceAccount','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x30d8,0x187));var _0x830d=function(_0x12d0e5,_0x1d1209){_0x12d0e5=_0x12d0e5-0x0;var _0x20d304=_0x30d8[_0x12d0e5];return _0x20d304;};'use strict';var _=require(_0x830d('0x0'));var util=require('util');var moment=require(_0x830d('0x1'));var BPromise=require('bluebird');var rs=require(_0x830d('0x2'));var fs=require('fs');var Redis=require(_0x830d('0x3'));var db=require(_0x830d('0x4'))['db'];var utils=require(_0x830d('0x5'));var logger=require(_0x830d('0x6'))(_0x830d('0x7'));var config=require(_0x830d('0x8'));var jayson=require(_0x830d('0x9'));var client=jayson['client'][_0x830d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50981f,_0x1b2bdb,_0x199c1c){return new BPromise(function(_0x34650e,_0x24555d){return client[_0x830d('0xb')](_0x50981f,_0x199c1c)[_0x830d('0xc')](function(_0x1a3334){logger['info'](_0x830d('0xd'),_0x1b2bdb,_0x830d('0xe'));logger[_0x830d('0xf')](_0x830d('0x10'),_0x1b2bdb,'request\x20sent',JSON[_0x830d('0x11')](_0x1a3334));if(_0x1a3334[_0x830d('0x12')]){if(_0x1a3334[_0x830d('0x12')][_0x830d('0x13')]===0x1f4){logger[_0x830d('0x12')](_0x830d('0xd'),_0x1b2bdb,_0x1a3334[_0x830d('0x12')][_0x830d('0x14')]);return _0x24555d(_0x1a3334[_0x830d('0x12')][_0x830d('0x14')]);}logger[_0x830d('0x12')](_0x830d('0xd'),_0x1b2bdb,_0x1a3334[_0x830d('0x12')][_0x830d('0x14')]);return _0x34650e(_0x1a3334['error'][_0x830d('0x14')]);}else{logger[_0x830d('0x15')](_0x830d('0xd'),_0x1b2bdb,_0x830d('0xe'));_0x34650e(_0x1a3334[_0x830d('0x16')][_0x830d('0x14')]);}})[_0x830d('0x17')](function(_0x3d8220){logger[_0x830d('0x12')](_0x830d('0xd'),_0x1b2bdb,_0x3d8220);_0x24555d(_0x3d8220);});});}exports[_0x830d('0x18')]=function(_0x28b3cc){var _0x2daa2a=this;return new Promise(function(_0x5d91f6,_0x4d8228){return db[_0x830d('0x19')][_0x830d('0x1a')]({'raw':_0x28b3cc[_0x830d('0x1b')]?_0x28b3cc[_0x830d('0x1b')][_0x830d('0x1c')]===undefined?!![]:![]:!![],'where':_0x28b3cc[_0x830d('0x1b')]?_0x28b3cc['options'][_0x830d('0x1d')]||null:null,'attributes':_0x28b3cc['options']?_0x28b3cc[_0x830d('0x1b')][_0x830d('0x1e')]||null:null,'limit':_0x28b3cc[_0x830d('0x1b')]?_0x28b3cc[_0x830d('0x1b')][_0x830d('0x1f')]||null:null,'include':_0x28b3cc[_0x830d('0x1b')]?_0x28b3cc[_0x830d('0x1b')][_0x830d('0x20')]?_[_0x830d('0x21')](_0x28b3cc[_0x830d('0x1b')][_0x830d('0x20')],function(_0x572f54){return{'model':db[_0x572f54[_0x830d('0x22')]],'as':_0x572f54['as'],'attributes':_0x572f54[_0x830d('0x1e')],'include':_0x572f54[_0x830d('0x20')]?_[_0x830d('0x21')](_0x572f54[_0x830d('0x20')],function(_0x517d97){return{'model':db[_0x517d97[_0x830d('0x22')]],'as':_0x517d97['as'],'attributes':_0x517d97[_0x830d('0x1e')],'include':_0x517d97[_0x830d('0x20')]?_[_0x830d('0x21')](_0x517d97[_0x830d('0x20')],function(_0x51452d){return{'model':db[_0x51452d['model']],'as':_0x51452d['as'],'attributes':_0x51452d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x17ad12){logger[_0x830d('0x15')](_0x830d('0x18'),_0x28b3cc);logger['debug'](_0x830d('0x18'),_0x28b3cc,JSON[_0x830d('0x11')](_0x17ad12));_0x5d91f6(_0x17ad12);})['catch'](function(_0x6cc2c5){logger[_0x830d('0x12')](_0x830d('0x18'),_0x6cc2c5[_0x830d('0x14')],_0x28b3cc);_0x4d8228(_0x2daa2a[_0x830d('0x12')](0x1f4,_0x6cc2c5['message']));});});};exports['ShowSalesforceAccount']=function(_0x371f6b){var _0x7ec706=this;return new Promise(function(_0x293cdd,_0x22531b){return db[_0x830d('0x19')][_0x830d('0x23')]({'raw':_0x371f6b[_0x830d('0x1b')]?_0x371f6b[_0x830d('0x1b')][_0x830d('0x1c')]===undefined?!![]:![]:!![],'where':_0x371f6b['options']?_0x371f6b[_0x830d('0x1b')]['where']||null:null,'attributes':_0x371f6b[_0x830d('0x1b')]?_0x371f6b[_0x830d('0x1b')][_0x830d('0x1e')]||null:null,'include':_0x371f6b['options']?_0x371f6b['options']['include']?_[_0x830d('0x21')](_0x371f6b['options'][_0x830d('0x20')],function(_0x482ee7){return{'model':db[_0x482ee7[_0x830d('0x22')]],'as':_0x482ee7['as'],'attributes':_0x482ee7[_0x830d('0x1e')],'include':_0x482ee7[_0x830d('0x20')]?_['map'](_0x482ee7['include'],function(_0x3067cb){return{'model':db[_0x3067cb['model']],'as':_0x3067cb['as'],'attributes':_0x3067cb['attributes'],'include':_0x3067cb[_0x830d('0x20')]?_[_0x830d('0x21')](_0x3067cb['include'],function(_0x30622f){return{'model':db[_0x30622f[_0x830d('0x22')]],'as':_0x30622f['as'],'attributes':_0x30622f[_0x830d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x830d('0xc')](function(_0x53bff3){logger[_0x830d('0x15')](_0x830d('0x24'),_0x371f6b);logger[_0x830d('0xf')](_0x830d('0x24'),_0x371f6b,JSON['stringify'](_0x53bff3));_0x293cdd(_0x53bff3);})['catch'](function(_0x1c8b8f){logger[_0x830d('0x12')](_0x830d('0x24'),_0x1c8b8f[_0x830d('0x14')],_0x371f6b);_0x22531b(_0x7ec706[_0x830d('0x12')](0x1f4,_0x1c8b8f[_0x830d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 2bc03a2..2b4adcc 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 _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1f5a63,_0x511504){_0x1f5a63=_0x1f5a63-0x0;var _0x30bb7a=_0x0b0e[_0x1f5a63];return _0x30bb7a;};'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')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=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(_0x12c414,_0x44036e){var _0x3e9087=function(_0x50136c){while(--_0x50136c){_0x12c414['push'](_0x12c414['shift']());}};_0x3e9087(++_0x44036e);}(_0xadb5,0xad));var _0x5adb=function(_0x3da727,_0x102cb4){_0x3da727=_0x3da727-0x0;var _0x2710b2=_0xadb5[_0x3da727];return _0x2710b2;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index fc4231f..617ffa0 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 _0x7d25=['contact_lead','nothing','account','exports','STRING','ENUM','Task','Case','account_contact_lead'];(function(_0x20b440,_0x4bb44b){var _0x175794=function(_0x5a47f2){while(--_0x5a47f2){_0x20b440['push'](_0x20b440['shift']());}};_0x175794(++_0x4bb44b);}(_0x7d25,0x8a));var _0x57d2=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x7d25[_0x4ed520];return _0x4415a6;};'use strict';var Sequelize=require('sequelize');module[_0x57d2('0x0')]={'name':{'type':Sequelize[_0x57d2('0x1')]},'description':{'type':Sequelize[_0x57d2('0x1')]},'ticketType':{'type':Sequelize[_0x57d2('0x2')](_0x57d2('0x3'),_0x57d2('0x4')),'defaultValue':_0x57d2('0x3')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead','contact','lead',_0x57d2('0x5'),'account'),'defaultValue':_0x57d2('0x6')},'moduleCreate':{'type':Sequelize[_0x57d2('0x2')](_0x57d2('0x7'),'contact','lead',_0x57d2('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x57d2('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x57d2('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x57d2('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa531=['account','lead','sequelize','exports','STRING','Task','ENUM','contact_lead','contact','account_contact_lead'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0xa531,0x12e));var _0x1a53=function(_0x128970,_0xc69c78){_0x128970=_0x128970-0x0;var _0x399724=_0xa531[_0x128970];return _0x399724;};'use strict';var Sequelize=require(_0x1a53('0x0'));module[_0x1a53('0x1')]={'name':{'type':Sequelize[_0x1a53('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x1a53('0x3'),'Case'),'defaultValue':_0x1a53('0x3')},'moduleSearch':{'type':Sequelize[_0x1a53('0x4')](_0x1a53('0x5'),_0x1a53('0x6'),'lead',_0x1a53('0x7'),_0x1a53('0x8')),'defaultValue':_0x1a53('0x5')},'moduleCreate':{'type':Sequelize[_0x1a53('0x4')]('nothing','contact',_0x1a53('0x9'),_0x1a53('0x8')),'defaultValue':_0x1a53('0x9')},'leadId':{'type':Sequelize[_0x1a53('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x1a53('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x1a53('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 399f140..f3d4c7a 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 _0xe2f5=['end','sendStatus','stack','name','send','SalesforceConfiguration','rawAttributes','fieldName','type','model','map','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','length','options','create','body','find','params','order','pick','getFields','getSubjects','findOne','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','then'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xe2f5,0x1ba));var _0x5e2f=function(_0x170286,_0x38f12d){_0x170286=_0x170286-0x0;var _0x18de6f=_0xe2f5[_0x170286];return _0x18de6f;};'use strict';var emlformat=require(_0x5e2f('0x0'));var rimraf=require(_0x5e2f('0x1'));var zipdir=require(_0x5e2f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e2f('0x3'));var moment=require(_0x5e2f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5e2f('0x5'));var sox=require(_0x5e2f('0x6'));var csv=require(_0x5e2f('0x7'));var ejs=require(_0x5e2f('0x8'));var fs=require('fs');var fs_extra=require(_0x5e2f('0x9'));var _=require(_0x5e2f('0xa'));var squel=require(_0x5e2f('0xb'));var crypto=require(_0x5e2f('0xc'));var jsforce=require(_0x5e2f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5e2f('0x7'));var querystring=require(_0x5e2f('0xe'));var Papa=require(_0x5e2f('0xf'));var Redis=require(_0x5e2f('0x10'));var authService=require(_0x5e2f('0x11'));var qs=require(_0x5e2f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e2f('0x13'));var logger=require(_0x5e2f('0x14'))(_0x5e2f('0x15'));var utils=require(_0x5e2f('0x16'));var config=require(_0x5e2f('0x17'));var licenseUtil=require(_0x5e2f('0x18'));var db=require(_0x5e2f('0x19'))['db'];function respondWithStatusCode(_0x319d5b,_0x58d73e){_0x58d73e=_0x58d73e||0xcc;return function(_0x64717c){if(_0x64717c){return _0x319d5b['sendStatus'](_0x58d73e);}return _0x319d5b[_0x5e2f('0x1a')](_0x58d73e)['end']();};}function respondWithResult(_0x5ad886,_0x35a8cf){_0x35a8cf=_0x35a8cf||0xc8;return function(_0x26bbbd){if(_0x26bbbd){return _0x5ad886[_0x5e2f('0x1a')](_0x35a8cf)['json'](_0x26bbbd);}};}function respondWithFilteredResult(_0x4c1fdf,_0x301d67){return function(_0x5d0482){if(_0x5d0482){var _0x48e8fd=typeof _0x301d67['offset']==='undefined'&&typeof _0x301d67['limit']===_0x5e2f('0x1b');var _0x581d3f=_0x5d0482[_0x5e2f('0x1c')];var _0x7a8c33=_0x48e8fd?0x0:_0x301d67[_0x5e2f('0x1d')];var _0x4ed2a9=_0x48e8fd?_0x5d0482[_0x5e2f('0x1c')]:_0x301d67[_0x5e2f('0x1d')]+_0x301d67[_0x5e2f('0x1e')];var _0x5960af;if(_0x4ed2a9>=_0x581d3f){_0x4ed2a9=_0x581d3f;_0x5960af=0xc8;}else{_0x5960af=0xce;}_0x4c1fdf[_0x5e2f('0x1a')](_0x5960af);return _0x4c1fdf[_0x5e2f('0x1f')](_0x5e2f('0x20'),_0x7a8c33+'-'+_0x4ed2a9+'/'+_0x581d3f)[_0x5e2f('0x21')](_0x5d0482);}return null;};}function patchUpdates(_0x5d19c4){return function(_0x40ff2f){try{jsonpatch[_0x5e2f('0x22')](_0x40ff2f,_0x5d19c4,!![]);}catch(_0xb9a6f1){return BPromise[_0x5e2f('0x23')](_0xb9a6f1);}return _0x40ff2f['save']();};}function saveUpdates(_0x30924b,_0x4870e8){return function(_0x1b5a19){if(_0x1b5a19){return _0x1b5a19[_0x5e2f('0x24')](_0x30924b)[_0x5e2f('0x25')](function(_0x40067a){return _0x40067a;});}return null;};}function removeEntity(_0x5f03ee,_0x3dbccf){return function(_0x254363){if(_0x254363){return _0x254363['destroy']()['then'](function(){_0x5f03ee[_0x5e2f('0x1a')](0xcc)[_0x5e2f('0x26')]();});}};}function handleEntityNotFound(_0x5674d4,_0xae846a){return function(_0x21bd37){if(!_0x21bd37){_0x5674d4[_0x5e2f('0x27')](0x194);}return _0x21bd37;};}function handleError(_0xb7b4f4,_0x1d778f){_0x1d778f=_0x1d778f||0x1f4;return function(_0x5e07c){logger['error'](_0x5e07c[_0x5e2f('0x28')]);if(_0x5e07c[_0x5e2f('0x29')]){delete _0x5e07c[_0x5e2f('0x29')];}_0xb7b4f4[_0x5e2f('0x1a')](_0x1d778f)[_0x5e2f('0x2a')](_0x5e07c);};}exports['index']=function(_0xb82211,_0x25bd28){var _0x1f9822={},_0x51d4ac={},_0x4fdb8a={'count':0x0,'rows':[]};var _0x56c68d=_['map'](db[_0x5e2f('0x2b')][_0x5e2f('0x2c')],function(_0x5efc70){return{'name':_0x5efc70[_0x5e2f('0x2d')],'type':_0x5efc70[_0x5e2f('0x2e')]['key']};});_0x51d4ac[_0x5e2f('0x2f')]=_[_0x5e2f('0x30')](_0x56c68d,_0x5e2f('0x29'));_0x51d4ac['query']=_[_0x5e2f('0x31')](_0xb82211['query']);_0x51d4ac['filters']=_[_0x5e2f('0x32')](_0x51d4ac[_0x5e2f('0x2f')],_0x51d4ac[_0x5e2f('0x33')]);_0x1f9822[_0x5e2f('0x34')]=_[_0x5e2f('0x32')](_0x51d4ac['model'],qs[_0x5e2f('0x35')](_0xb82211[_0x5e2f('0x33')]['fields']));_0x1f9822[_0x5e2f('0x34')]=_0x1f9822[_0x5e2f('0x34')]['length']?_0x1f9822[_0x5e2f('0x34')]:_0x51d4ac[_0x5e2f('0x2f')];if(!_0xb82211[_0x5e2f('0x33')][_0x5e2f('0x36')](_0x5e2f('0x37'))){_0x1f9822[_0x5e2f('0x1e')]=qs[_0x5e2f('0x1e')](_0xb82211['query'][_0x5e2f('0x1e')]);_0x1f9822['offset']=qs['offset'](_0xb82211[_0x5e2f('0x33')][_0x5e2f('0x1d')]);}_0x1f9822['order']=qs[_0x5e2f('0x38')](_0xb82211[_0x5e2f('0x33')]['sort']);_0x1f9822[_0x5e2f('0x39')]=qs[_0x5e2f('0x3a')](_['pick'](_0xb82211[_0x5e2f('0x33')],_0x51d4ac['filters']),_0x56c68d);if(_0xb82211['query'][_0x5e2f('0x3b')]){_0x1f9822[_0x5e2f('0x39')]=_[_0x5e2f('0x3c')](_0x1f9822[_0x5e2f('0x39')],{'$or':_[_0x5e2f('0x30')](_0x56c68d,function(_0x3df685){if(_0x3df685[_0x5e2f('0x2e')]!==_0x5e2f('0x3d')){var _0x5c59f8={};_0x5c59f8[_0x3df685[_0x5e2f('0x29')]]={'$like':'%'+_0xb82211[_0x5e2f('0x33')][_0x5e2f('0x3b')]+'%'};return _0x5c59f8;}})});}_0x1f9822=_[_0x5e2f('0x3c')]({},_0x1f9822,_0xb82211['options']);var _0xd43a53={'where':_0x1f9822['where']};return db[_0x5e2f('0x2b')][_0x5e2f('0x1c')](_0xd43a53)[_0x5e2f('0x25')](function(_0x1e66ce){_0x4fdb8a['count']=_0x1e66ce;if(_0xb82211['query'][_0x5e2f('0x3e')]){_0x1f9822[_0x5e2f('0x3f')]=[{'all':!![]}];}return db[_0x5e2f('0x2b')]['findAll'](_0x1f9822);})[_0x5e2f('0x25')](function(_0x520ce4){_0x4fdb8a[_0x5e2f('0x40')]=_0x520ce4;return _0x4fdb8a;})[_0x5e2f('0x25')](respondWithFilteredResult(_0x25bd28,_0x1f9822))[_0x5e2f('0x41')](handleError(_0x25bd28,null));};exports[_0x5e2f('0x42')]=function(_0x6381bb,_0x1789e6){var _0x4272f1={'raw':![],'where':{'id':_0x6381bb['params']['id']}},_0x3323cb={};_0x3323cb[_0x5e2f('0x2f')]=_['keys'](db['SalesforceConfiguration'][_0x5e2f('0x2c')]);_0x3323cb[_0x5e2f('0x33')]=_[_0x5e2f('0x31')](_0x6381bb[_0x5e2f('0x33')]);_0x3323cb[_0x5e2f('0x3a')]=_[_0x5e2f('0x32')](_0x3323cb['model'],_0x3323cb['query']);_0x4272f1[_0x5e2f('0x34')]=_['intersection'](_0x3323cb['model'],qs[_0x5e2f('0x35')](_0x6381bb[_0x5e2f('0x33')]['fields']));_0x4272f1[_0x5e2f('0x34')]=_0x4272f1['attributes'][_0x5e2f('0x43')]?_0x4272f1['attributes']:_0x3323cb[_0x5e2f('0x2f')];if(_0x6381bb[_0x5e2f('0x33')][_0x5e2f('0x3e')]){_0x4272f1[_0x5e2f('0x3f')]=[{'all':!![]}];}_0x4272f1=_[_0x5e2f('0x3c')]({},_0x4272f1,_0x6381bb[_0x5e2f('0x44')]);return db[_0x5e2f('0x2b')]['find'](_0x4272f1)[_0x5e2f('0x25')](handleEntityNotFound(_0x1789e6,null))[_0x5e2f('0x25')](respondWithResult(_0x1789e6,null))[_0x5e2f('0x41')](handleError(_0x1789e6,null));};exports['create']=function(_0x4d1592,_0x56a369){return db[_0x5e2f('0x2b')][_0x5e2f('0x45')](_0x4d1592[_0x5e2f('0x46')],{})['then'](respondWithResult(_0x56a369,0xc9))['catch'](handleError(_0x56a369,null));};exports[_0x5e2f('0x24')]=function(_0x270d9f,_0x4ab585){if(_0x270d9f[_0x5e2f('0x46')]['id']){delete _0x270d9f[_0x5e2f('0x46')]['id'];}return db['SalesforceConfiguration'][_0x5e2f('0x47')]({'where':{'id':_0x270d9f[_0x5e2f('0x48')]['id']}})['then'](handleEntityNotFound(_0x4ab585,null))['then'](saveUpdates(_0x270d9f[_0x5e2f('0x46')],null))[_0x5e2f('0x25')](respondWithResult(_0x4ab585,null))['catch'](handleError(_0x4ab585,null));};exports['destroy']=function(_0x40ab65,_0x522894){return db[_0x5e2f('0x2b')][_0x5e2f('0x47')]({'where':{'id':_0x40ab65[_0x5e2f('0x48')]['id']}})['then'](handleEntityNotFound(_0x522894,null))[_0x5e2f('0x25')](removeEntity(_0x522894,null))['catch'](handleError(_0x522894,null));};exports['getFields']=function(_0x4287b9,_0x320355,_0x37c594){var _0x11d7d2={};var _0x337e34={};var _0x3702b7;var _0x3ad4e3;return db[_0x5e2f('0x2b')]['findOne']({'where':{'id':_0x4287b9['params']['id']}})[_0x5e2f('0x25')](handleEntityNotFound(_0x320355,null))[_0x5e2f('0x25')](function(_0x226d21){if(_0x226d21){_0x3702b7=_0x226d21;_0x337e34[_0x5e2f('0x2f')]=_['keys'](db['SalesforceField'][_0x5e2f('0x2c')]);_0x337e34['query']=_[_0x5e2f('0x31')](_0x4287b9['query']);_0x337e34[_0x5e2f('0x3a')]=_[_0x5e2f('0x32')](_0x337e34[_0x5e2f('0x2f')],_0x337e34[_0x5e2f('0x33')]);_0x11d7d2['attributes']=_[_0x5e2f('0x32')](_0x337e34[_0x5e2f('0x2f')],qs[_0x5e2f('0x35')](_0x4287b9[_0x5e2f('0x33')]['fields']));_0x11d7d2[_0x5e2f('0x34')]=_0x11d7d2['attributes'][_0x5e2f('0x43')]?_0x11d7d2[_0x5e2f('0x34')]:_0x337e34[_0x5e2f('0x2f')];_0x11d7d2[_0x5e2f('0x49')]=qs[_0x5e2f('0x38')](_0x4287b9[_0x5e2f('0x33')][_0x5e2f('0x38')]);_0x11d7d2['where']=qs['filters'](_[_0x5e2f('0x4a')](_0x4287b9[_0x5e2f('0x33')],_0x337e34['filters']));if(_0x4287b9[_0x5e2f('0x33')][_0x5e2f('0x3b')]){_0x11d7d2[_0x5e2f('0x39')]=_[_0x5e2f('0x3c')](_0x11d7d2[_0x5e2f('0x39')],{'$or':_['map'](_0x11d7d2[_0x5e2f('0x34')],function(_0x3554e4){var _0x478dc4={};_0x478dc4[_0x3554e4]={'$like':'%'+_0x4287b9[_0x5e2f('0x33')][_0x5e2f('0x3b')]+'%'};return _0x478dc4;})});}_0x11d7d2=_[_0x5e2f('0x3c')]({},_0x11d7d2,_0x4287b9[_0x5e2f('0x44')]);return _0x3702b7[_0x5e2f('0x4b')](_0x11d7d2);}})[_0x5e2f('0x25')](function(_0xbbcfe3){if(_0xbbcfe3){_0x3ad4e3=_0xbbcfe3['length'];if(!_0x4287b9[_0x5e2f('0x33')][_0x5e2f('0x36')]('nolimit')){_0x11d7d2[_0x5e2f('0x1e')]=qs[_0x5e2f('0x1e')](_0x4287b9[_0x5e2f('0x33')]['limit']);_0x11d7d2[_0x5e2f('0x1d')]=qs[_0x5e2f('0x1d')](_0x4287b9[_0x5e2f('0x33')][_0x5e2f('0x1d')]);}return _0x3702b7['getFields'](_0x11d7d2);}})['then'](function(_0x377972){if(_0x377972){return _0x377972?{'count':_0x3ad4e3,'rows':_0x377972}:null;}})[_0x5e2f('0x25')](respondWithResult(_0x320355,null))[_0x5e2f('0x41')](handleError(_0x320355,null));};exports[_0x5e2f('0x4c')]=function(_0x5624a7,_0x4b4fd2,_0x249cd0){var _0x35c3cd={};var _0x40046c={};var _0x307a0f;var _0x86f46;return db[_0x5e2f('0x2b')][_0x5e2f('0x4d')]({'where':{'id':_0x5624a7[_0x5e2f('0x48')]['id']}})[_0x5e2f('0x25')](handleEntityNotFound(_0x4b4fd2,null))[_0x5e2f('0x25')](function(_0x4069bf){if(_0x4069bf){_0x307a0f=_0x4069bf;_0x40046c[_0x5e2f('0x2f')]=_['keys'](db[_0x5e2f('0x4e')][_0x5e2f('0x2c')]);_0x40046c['query']=_[_0x5e2f('0x31')](_0x5624a7['query']);_0x40046c[_0x5e2f('0x3a')]=_[_0x5e2f('0x32')](_0x40046c[_0x5e2f('0x2f')],_0x40046c[_0x5e2f('0x33')]);_0x35c3cd['attributes']=_[_0x5e2f('0x32')](_0x40046c['model'],qs[_0x5e2f('0x35')](_0x5624a7[_0x5e2f('0x33')][_0x5e2f('0x35')]));_0x35c3cd[_0x5e2f('0x34')]=_0x35c3cd[_0x5e2f('0x34')][_0x5e2f('0x43')]?_0x35c3cd[_0x5e2f('0x34')]:_0x40046c[_0x5e2f('0x2f')];_0x35c3cd[_0x5e2f('0x49')]=qs[_0x5e2f('0x38')](_0x5624a7['query'][_0x5e2f('0x38')]);_0x35c3cd[_0x5e2f('0x39')]=qs[_0x5e2f('0x3a')](_[_0x5e2f('0x4a')](_0x5624a7[_0x5e2f('0x33')],_0x40046c[_0x5e2f('0x3a')]));if(_0x5624a7['query'][_0x5e2f('0x3b')]){_0x35c3cd[_0x5e2f('0x39')]=_['merge'](_0x35c3cd['where'],{'$or':_[_0x5e2f('0x30')](_0x35c3cd[_0x5e2f('0x34')],function(_0xc67cb0){var _0x3c84f2={};_0x3c84f2[_0xc67cb0]={'$like':'%'+_0x5624a7[_0x5e2f('0x33')][_0x5e2f('0x3b')]+'%'};return _0x3c84f2;})});}_0x35c3cd=_['merge']({},_0x35c3cd,_0x5624a7[_0x5e2f('0x44')]);return _0x307a0f[_0x5e2f('0x4c')](_0x35c3cd);}})[_0x5e2f('0x25')](function(_0x1ed160){if(_0x1ed160){_0x86f46=_0x1ed160['length'];if(!_0x5624a7[_0x5e2f('0x33')][_0x5e2f('0x36')](_0x5e2f('0x37'))){_0x35c3cd[_0x5e2f('0x1e')]=qs[_0x5e2f('0x1e')](_0x5624a7[_0x5e2f('0x33')][_0x5e2f('0x1e')]);_0x35c3cd[_0x5e2f('0x1d')]=qs[_0x5e2f('0x1d')](_0x5624a7['query'][_0x5e2f('0x1d')]);}return _0x307a0f[_0x5e2f('0x4c')](_0x35c3cd);}})[_0x5e2f('0x25')](function(_0x12c039){if(_0x12c039){return _0x12c039?{'count':_0x86f46,'rows':_0x12c039}:null;}})[_0x5e2f('0x25')](respondWithResult(_0x4b4fd2,null))[_0x5e2f('0x41')](handleError(_0x4b4fd2,null));};exports[_0x5e2f('0x4f')]=function(_0x242f53,_0x28472c,_0x3639be){var _0x3199b0={};var _0x545096={};var _0x48f433;var _0x3f1c58;return db[_0x5e2f('0x2b')][_0x5e2f('0x4d')]({'where':{'id':_0x242f53['params']['id']}})[_0x5e2f('0x25')](handleEntityNotFound(_0x28472c,null))[_0x5e2f('0x25')](function(_0x199842){if(_0x199842){_0x48f433=_0x199842;_0x545096[_0x5e2f('0x2f')]=_[_0x5e2f('0x31')](db[_0x5e2f('0x4e')]['rawAttributes']);_0x545096[_0x5e2f('0x33')]=_[_0x5e2f('0x31')](_0x242f53[_0x5e2f('0x33')]);_0x545096[_0x5e2f('0x3a')]=_[_0x5e2f('0x32')](_0x545096[_0x5e2f('0x2f')],_0x545096[_0x5e2f('0x33')]);_0x3199b0['attributes']=_[_0x5e2f('0x32')](_0x545096[_0x5e2f('0x2f')],qs[_0x5e2f('0x35')](_0x242f53['query'][_0x5e2f('0x35')]));_0x3199b0['attributes']=_0x3199b0[_0x5e2f('0x34')][_0x5e2f('0x43')]?_0x3199b0[_0x5e2f('0x34')]:_0x545096[_0x5e2f('0x2f')];_0x3199b0[_0x5e2f('0x49')]=qs[_0x5e2f('0x38')](_0x242f53[_0x5e2f('0x33')][_0x5e2f('0x38')]);_0x3199b0['where']=qs[_0x5e2f('0x3a')](_[_0x5e2f('0x4a')](_0x242f53[_0x5e2f('0x33')],_0x545096[_0x5e2f('0x3a')]));if(_0x242f53['query'][_0x5e2f('0x3b')]){_0x3199b0[_0x5e2f('0x39')]=_[_0x5e2f('0x3c')](_0x3199b0[_0x5e2f('0x39')],{'$or':_[_0x5e2f('0x30')](_0x3199b0[_0x5e2f('0x34')],function(_0x47a07c){var _0x422e43={};_0x422e43[_0x47a07c]={'$like':'%'+_0x242f53[_0x5e2f('0x33')][_0x5e2f('0x3b')]+'%'};return _0x422e43;})});}_0x3199b0=_[_0x5e2f('0x3c')]({},_0x3199b0,_0x242f53[_0x5e2f('0x44')]);return _0x48f433['getDescriptions'](_0x3199b0);}})[_0x5e2f('0x25')](function(_0x376764){if(_0x376764){_0x3f1c58=_0x376764['length'];if(!_0x242f53[_0x5e2f('0x33')][_0x5e2f('0x36')](_0x5e2f('0x37'))){_0x3199b0[_0x5e2f('0x1e')]=qs[_0x5e2f('0x1e')](_0x242f53[_0x5e2f('0x33')][_0x5e2f('0x1e')]);_0x3199b0[_0x5e2f('0x1d')]=qs['offset'](_0x242f53[_0x5e2f('0x33')][_0x5e2f('0x1d')]);}return _0x48f433[_0x5e2f('0x4f')](_0x3199b0);}})[_0x5e2f('0x25')](function(_0x53aea8){if(_0x53aea8){return _0x53aea8?{'count':_0x3f1c58,'rows':_0x53aea8}:null;}})[_0x5e2f('0x25')](respondWithResult(_0x28472c,null))['catch'](handleError(_0x28472c,null));}; \ No newline at end of file +var _0x78d3=['hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','SalesforceConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','length','create','update','body','find','destroy','findOne','SalesforceField','rawAttributes','getFields','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','end','error','stack','index','key','map','name','query','filters','intersection','model','fields','attributes'];(function(_0x4193ec,_0x2623d0){var _0x722f00=function(_0x52957b){while(--_0x52957b){_0x4193ec['push'](_0x4193ec['shift']());}};_0x722f00(++_0x2623d0);}(_0x78d3,0x73));var _0x378d=function(_0xbadd3c,_0x2d770a){_0xbadd3c=_0xbadd3c-0x0;var _0x46e363=_0x78d3[_0xbadd3c];return _0x46e363;};'use strict';var emlformat=require(_0x378d('0x0'));var rimraf=require(_0x378d('0x1'));var zipdir=require(_0x378d('0x2'));var jsonpatch=require(_0x378d('0x3'));var rp=require(_0x378d('0x4'));var moment=require(_0x378d('0x5'));var BPromise=require(_0x378d('0x6'));var Mustache=require(_0x378d('0x7'));var util=require(_0x378d('0x8'));var path=require(_0x378d('0x9'));var sox=require(_0x378d('0xa'));var csv=require(_0x378d('0xb'));var ejs=require(_0x378d('0xc'));var fs=require('fs');var fs_extra=require(_0x378d('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x378d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x378d('0xf'));var toCsv=require(_0x378d('0xb'));var querystring=require(_0x378d('0x10'));var Papa=require(_0x378d('0x11'));var Redis=require(_0x378d('0x12'));var authService=require(_0x378d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x378d('0x14'));var hardwareService=require(_0x378d('0x15'));var logger=require(_0x378d('0x16'))('api');var utils=require(_0x378d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x378d('0x18'))['db'];function respondWithStatusCode(_0x184383,_0x5a1c1f){_0x5a1c1f=_0x5a1c1f||0xcc;return function(_0x43785f){if(_0x43785f){return _0x184383[_0x378d('0x19')](_0x5a1c1f);}return _0x184383[_0x378d('0x1a')](_0x5a1c1f)['end']();};}function respondWithResult(_0x4609b7,_0x5bf43f){_0x5bf43f=_0x5bf43f||0xc8;return function(_0x756450){if(_0x756450){return _0x4609b7[_0x378d('0x1a')](_0x5bf43f)[_0x378d('0x1b')](_0x756450);}};}function respondWithFilteredResult(_0x40c4fb,_0x209292){return function(_0x5f48db){if(_0x5f48db){var _0x46856f=typeof _0x209292['offset']===_0x378d('0x1c')&&typeof _0x209292[_0x378d('0x1d')]===_0x378d('0x1c');var _0x254ff5=_0x5f48db[_0x378d('0x1e')];var _0x50ce98=_0x46856f?0x0:_0x209292[_0x378d('0x1f')];var _0x4b54c7=_0x46856f?_0x5f48db[_0x378d('0x1e')]:_0x209292[_0x378d('0x1f')]+_0x209292[_0x378d('0x1d')];var _0x1d2852;if(_0x4b54c7>=_0x254ff5){_0x4b54c7=_0x254ff5;_0x1d2852=0xc8;}else{_0x1d2852=0xce;}_0x40c4fb[_0x378d('0x1a')](_0x1d2852);return _0x40c4fb[_0x378d('0x20')](_0x378d('0x21'),_0x50ce98+'-'+_0x4b54c7+'/'+_0x254ff5)['json'](_0x5f48db);}return null;};}function patchUpdates(_0x5a936c){return function(_0x238f30){try{jsonpatch[_0x378d('0x22')](_0x238f30,_0x5a936c,!![]);}catch(_0x48b7f9){return BPromise[_0x378d('0x23')](_0x48b7f9);}return _0x238f30[_0x378d('0x24')]();};}function saveUpdates(_0x2d6c8f,_0x1339fb){return function(_0x3acdf9){if(_0x3acdf9){return _0x3acdf9['update'](_0x2d6c8f)[_0x378d('0x25')](function(_0x4f43a6){return _0x4f43a6;});}return null;};}function removeEntity(_0x17bbf2,_0x402913){return function(_0x3f2ebc){if(_0x3f2ebc){return _0x3f2ebc['destroy']()[_0x378d('0x25')](function(){_0x17bbf2[_0x378d('0x1a')](0xcc)[_0x378d('0x26')]();});}};}function handleEntityNotFound(_0x5e515d,_0x20e5e6){return function(_0x22fee7){if(!_0x22fee7){_0x5e515d[_0x378d('0x19')](0x194);}return _0x22fee7;};}function handleError(_0x1c302a,_0xb65852){_0xb65852=_0xb65852||0x1f4;return function(_0x2ed3ed){logger[_0x378d('0x27')](_0x2ed3ed[_0x378d('0x28')]);if(_0x2ed3ed['name']){delete _0x2ed3ed['name'];}_0x1c302a[_0x378d('0x1a')](_0xb65852)['send'](_0x2ed3ed);};}exports[_0x378d('0x29')]=function(_0x292b73,_0x3f2d5b){var _0x17f952={},_0x53637f={},_0x59945b={'count':0x0,'rows':[]};var _0x3de1af=_['map'](db['SalesforceConfiguration']['rawAttributes'],function(_0x3e1dac){return{'name':_0x3e1dac['fieldName'],'type':_0x3e1dac['type'][_0x378d('0x2a')]};});_0x53637f['model']=_[_0x378d('0x2b')](_0x3de1af,_0x378d('0x2c'));_0x53637f[_0x378d('0x2d')]=_['keys'](_0x292b73[_0x378d('0x2d')]);_0x53637f[_0x378d('0x2e')]=_[_0x378d('0x2f')](_0x53637f[_0x378d('0x30')],_0x53637f[_0x378d('0x2d')]);_0x17f952['attributes']=_[_0x378d('0x2f')](_0x53637f[_0x378d('0x30')],qs[_0x378d('0x31')](_0x292b73[_0x378d('0x2d')]['fields']));_0x17f952[_0x378d('0x32')]=_0x17f952['attributes']['length']?_0x17f952[_0x378d('0x32')]:_0x53637f[_0x378d('0x30')];if(!_0x292b73['query'][_0x378d('0x33')]('nolimit')){_0x17f952['limit']=qs['limit'](_0x292b73[_0x378d('0x2d')][_0x378d('0x1d')]);_0x17f952[_0x378d('0x1f')]=qs[_0x378d('0x1f')](_0x292b73[_0x378d('0x2d')]['offset']);}_0x17f952[_0x378d('0x34')]=qs[_0x378d('0x35')](_0x292b73[_0x378d('0x2d')]['sort']);_0x17f952[_0x378d('0x36')]=qs[_0x378d('0x2e')](_[_0x378d('0x37')](_0x292b73['query'],_0x53637f[_0x378d('0x2e')]),_0x3de1af);if(_0x292b73['query'][_0x378d('0x38')]){_0x17f952['where']=_['merge'](_0x17f952[_0x378d('0x36')],{'$or':_[_0x378d('0x2b')](_0x3de1af,function(_0x43a0d7){if(_0x43a0d7[_0x378d('0x39')]!==_0x378d('0x3a')){var _0x7f668c={};_0x7f668c[_0x43a0d7['name']]={'$like':'%'+_0x292b73['query'][_0x378d('0x38')]+'%'};return _0x7f668c;}})});}_0x17f952=_[_0x378d('0x3b')]({},_0x17f952,_0x292b73[_0x378d('0x3c')]);var _0x1b039d={'where':_0x17f952[_0x378d('0x36')]};return db[_0x378d('0x3d')][_0x378d('0x1e')](_0x1b039d)[_0x378d('0x25')](function(_0x32c4f6){_0x59945b[_0x378d('0x1e')]=_0x32c4f6;if(_0x292b73[_0x378d('0x2d')][_0x378d('0x3e')]){_0x17f952[_0x378d('0x3f')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x378d('0x40')](_0x17f952);})['then'](function(_0x5e1b33){_0x59945b[_0x378d('0x41')]=_0x5e1b33;return _0x59945b;})['then'](respondWithFilteredResult(_0x3f2d5b,_0x17f952))[_0x378d('0x42')](handleError(_0x3f2d5b,null));};exports[_0x378d('0x43')]=function(_0x514c6d,_0x480835){var _0x5c3e1e={'raw':![],'where':{'id':_0x514c6d[_0x378d('0x44')]['id']}},_0x2d2ee2={};_0x2d2ee2[_0x378d('0x30')]=_['keys'](db[_0x378d('0x3d')]['rawAttributes']);_0x2d2ee2[_0x378d('0x2d')]=_[_0x378d('0x45')](_0x514c6d[_0x378d('0x2d')]);_0x2d2ee2[_0x378d('0x2e')]=_['intersection'](_0x2d2ee2[_0x378d('0x30')],_0x2d2ee2['query']);_0x5c3e1e[_0x378d('0x32')]=_[_0x378d('0x2f')](_0x2d2ee2[_0x378d('0x30')],qs[_0x378d('0x31')](_0x514c6d[_0x378d('0x2d')][_0x378d('0x31')]));_0x5c3e1e['attributes']=_0x5c3e1e['attributes'][_0x378d('0x46')]?_0x5c3e1e[_0x378d('0x32')]:_0x2d2ee2[_0x378d('0x30')];if(_0x514c6d['query']['includeAll']){_0x5c3e1e[_0x378d('0x3f')]=[{'all':!![]}];}_0x5c3e1e=_['merge']({},_0x5c3e1e,_0x514c6d['options']);return db['SalesforceConfiguration']['find'](_0x5c3e1e)[_0x378d('0x25')](handleEntityNotFound(_0x480835,null))[_0x378d('0x25')](respondWithResult(_0x480835,null))[_0x378d('0x42')](handleError(_0x480835,null));};exports[_0x378d('0x47')]=function(_0x404176,_0x5c5733){return db[_0x378d('0x3d')][_0x378d('0x47')](_0x404176['body'],{})['then'](respondWithResult(_0x5c5733,0xc9))[_0x378d('0x42')](handleError(_0x5c5733,null));};exports[_0x378d('0x48')]=function(_0x50a8a0,_0x3e6275){if(_0x50a8a0[_0x378d('0x49')]['id']){delete _0x50a8a0[_0x378d('0x49')]['id'];}return db[_0x378d('0x3d')][_0x378d('0x4a')]({'where':{'id':_0x50a8a0[_0x378d('0x44')]['id']}})[_0x378d('0x25')](handleEntityNotFound(_0x3e6275,null))['then'](saveUpdates(_0x50a8a0[_0x378d('0x49')],null))[_0x378d('0x25')](respondWithResult(_0x3e6275,null))[_0x378d('0x42')](handleError(_0x3e6275,null));};exports[_0x378d('0x4b')]=function(_0x509bf1,_0x2e4cd0){return db[_0x378d('0x3d')]['find']({'where':{'id':_0x509bf1[_0x378d('0x44')]['id']}})[_0x378d('0x25')](handleEntityNotFound(_0x2e4cd0,null))['then'](removeEntity(_0x2e4cd0,null))[_0x378d('0x42')](handleError(_0x2e4cd0,null));};exports['getFields']=function(_0x31b959,_0x5562d8,_0x20d37a){var _0x1a8733={};var _0x15f52f={};var _0xcd6f22;var _0x4b6f16;return db[_0x378d('0x3d')][_0x378d('0x4c')]({'where':{'id':_0x31b959[_0x378d('0x44')]['id']}})[_0x378d('0x25')](handleEntityNotFound(_0x5562d8,null))[_0x378d('0x25')](function(_0x4daccc){if(_0x4daccc){_0xcd6f22=_0x4daccc;_0x15f52f[_0x378d('0x30')]=_[_0x378d('0x45')](db[_0x378d('0x4d')][_0x378d('0x4e')]);_0x15f52f[_0x378d('0x2d')]=_['keys'](_0x31b959[_0x378d('0x2d')]);_0x15f52f['filters']=_['intersection'](_0x15f52f[_0x378d('0x30')],_0x15f52f[_0x378d('0x2d')]);_0x1a8733[_0x378d('0x32')]=_[_0x378d('0x2f')](_0x15f52f[_0x378d('0x30')],qs['fields'](_0x31b959[_0x378d('0x2d')][_0x378d('0x31')]));_0x1a8733[_0x378d('0x32')]=_0x1a8733[_0x378d('0x32')][_0x378d('0x46')]?_0x1a8733[_0x378d('0x32')]:_0x15f52f[_0x378d('0x30')];_0x1a8733[_0x378d('0x34')]=qs[_0x378d('0x35')](_0x31b959[_0x378d('0x2d')]['sort']);_0x1a8733[_0x378d('0x36')]=qs[_0x378d('0x2e')](_[_0x378d('0x37')](_0x31b959[_0x378d('0x2d')],_0x15f52f['filters']));if(_0x31b959[_0x378d('0x2d')]['filter']){_0x1a8733[_0x378d('0x36')]=_[_0x378d('0x3b')](_0x1a8733[_0x378d('0x36')],{'$or':_[_0x378d('0x2b')](_0x1a8733['attributes'],function(_0x206af4){var _0x2a55c3={};_0x2a55c3[_0x206af4]={'$like':'%'+_0x31b959[_0x378d('0x2d')][_0x378d('0x38')]+'%'};return _0x2a55c3;})});}_0x1a8733=_[_0x378d('0x3b')]({},_0x1a8733,_0x31b959['options']);return _0xcd6f22[_0x378d('0x4f')](_0x1a8733);}})[_0x378d('0x25')](function(_0x573256){if(_0x573256){_0x4b6f16=_0x573256[_0x378d('0x46')];if(!_0x31b959[_0x378d('0x2d')][_0x378d('0x33')](_0x378d('0x50'))){_0x1a8733[_0x378d('0x1d')]=qs['limit'](_0x31b959[_0x378d('0x2d')]['limit']);_0x1a8733[_0x378d('0x1f')]=qs['offset'](_0x31b959[_0x378d('0x2d')][_0x378d('0x1f')]);}return _0xcd6f22[_0x378d('0x4f')](_0x1a8733);}})['then'](function(_0x5bc1db){if(_0x5bc1db){return _0x5bc1db?{'count':_0x4b6f16,'rows':_0x5bc1db}:null;}})[_0x378d('0x25')](respondWithResult(_0x5562d8,null))[_0x378d('0x42')](handleError(_0x5562d8,null));};exports[_0x378d('0x51')]=function(_0x2796c7,_0x293329,_0x448502){var _0x13c681={};var _0x483a9e={};var _0x19dfaa;var _0x207c53;return db['SalesforceConfiguration'][_0x378d('0x4c')]({'where':{'id':_0x2796c7[_0x378d('0x44')]['id']}})[_0x378d('0x25')](handleEntityNotFound(_0x293329,null))['then'](function(_0x5adcf9){if(_0x5adcf9){_0x19dfaa=_0x5adcf9;_0x483a9e['model']=_[_0x378d('0x45')](db['SalesforceField']['rawAttributes']);_0x483a9e[_0x378d('0x2d')]=_[_0x378d('0x45')](_0x2796c7[_0x378d('0x2d')]);_0x483a9e[_0x378d('0x2e')]=_[_0x378d('0x2f')](_0x483a9e[_0x378d('0x30')],_0x483a9e[_0x378d('0x2d')]);_0x13c681[_0x378d('0x32')]=_[_0x378d('0x2f')](_0x483a9e[_0x378d('0x30')],qs[_0x378d('0x31')](_0x2796c7['query'][_0x378d('0x31')]));_0x13c681[_0x378d('0x32')]=_0x13c681[_0x378d('0x32')][_0x378d('0x46')]?_0x13c681['attributes']:_0x483a9e[_0x378d('0x30')];_0x13c681[_0x378d('0x34')]=qs[_0x378d('0x35')](_0x2796c7[_0x378d('0x2d')][_0x378d('0x35')]);_0x13c681[_0x378d('0x36')]=qs[_0x378d('0x2e')](_['pick'](_0x2796c7[_0x378d('0x2d')],_0x483a9e[_0x378d('0x2e')]));if(_0x2796c7[_0x378d('0x2d')]['filter']){_0x13c681[_0x378d('0x36')]=_['merge'](_0x13c681[_0x378d('0x36')],{'$or':_[_0x378d('0x2b')](_0x13c681[_0x378d('0x32')],function(_0x1817fe){var _0x4c7c12={};_0x4c7c12[_0x1817fe]={'$like':'%'+_0x2796c7['query'][_0x378d('0x38')]+'%'};return _0x4c7c12;})});}_0x13c681=_[_0x378d('0x3b')]({},_0x13c681,_0x2796c7[_0x378d('0x3c')]);return _0x19dfaa[_0x378d('0x51')](_0x13c681);}})[_0x378d('0x25')](function(_0x511f13){if(_0x511f13){_0x207c53=_0x511f13[_0x378d('0x46')];if(!_0x2796c7[_0x378d('0x2d')][_0x378d('0x33')](_0x378d('0x50'))){_0x13c681[_0x378d('0x1d')]=qs['limit'](_0x2796c7[_0x378d('0x2d')]['limit']);_0x13c681[_0x378d('0x1f')]=qs[_0x378d('0x1f')](_0x2796c7['query'][_0x378d('0x1f')]);}return _0x19dfaa[_0x378d('0x51')](_0x13c681);}})[_0x378d('0x25')](function(_0x47c57e){if(_0x47c57e){return _0x47c57e?{'count':_0x207c53,'rows':_0x47c57e}:null;}})['then'](respondWithResult(_0x293329,null))[_0x378d('0x42')](handleError(_0x293329,null));};exports[_0x378d('0x52')]=function(_0x42559d,_0x3ee8d3,_0x4e93d7){var _0x44c830={};var _0x5ea6ea={};var _0x1ee712;var _0x2f6e9e;return db['SalesforceConfiguration'][_0x378d('0x4c')]({'where':{'id':_0x42559d[_0x378d('0x44')]['id']}})[_0x378d('0x25')](handleEntityNotFound(_0x3ee8d3,null))[_0x378d('0x25')](function(_0x4d13a1){if(_0x4d13a1){_0x1ee712=_0x4d13a1;_0x5ea6ea[_0x378d('0x30')]=_[_0x378d('0x45')](db[_0x378d('0x4d')][_0x378d('0x4e')]);_0x5ea6ea['query']=_[_0x378d('0x45')](_0x42559d['query']);_0x5ea6ea['filters']=_[_0x378d('0x2f')](_0x5ea6ea['model'],_0x5ea6ea[_0x378d('0x2d')]);_0x44c830[_0x378d('0x32')]=_[_0x378d('0x2f')](_0x5ea6ea[_0x378d('0x30')],qs['fields'](_0x42559d['query'][_0x378d('0x31')]));_0x44c830['attributes']=_0x44c830[_0x378d('0x32')]['length']?_0x44c830['attributes']:_0x5ea6ea[_0x378d('0x30')];_0x44c830[_0x378d('0x34')]=qs['sort'](_0x42559d[_0x378d('0x2d')]['sort']);_0x44c830[_0x378d('0x36')]=qs[_0x378d('0x2e')](_[_0x378d('0x37')](_0x42559d[_0x378d('0x2d')],_0x5ea6ea['filters']));if(_0x42559d[_0x378d('0x2d')][_0x378d('0x38')]){_0x44c830[_0x378d('0x36')]=_[_0x378d('0x3b')](_0x44c830['where'],{'$or':_[_0x378d('0x2b')](_0x44c830['attributes'],function(_0x543aca){var _0x1e0d23={};_0x1e0d23[_0x543aca]={'$like':'%'+_0x42559d['query']['filter']+'%'};return _0x1e0d23;})});}_0x44c830=_['merge']({},_0x44c830,_0x42559d[_0x378d('0x3c')]);return _0x1ee712[_0x378d('0x52')](_0x44c830);}})[_0x378d('0x25')](function(_0x4c8c9e){if(_0x4c8c9e){_0x2f6e9e=_0x4c8c9e[_0x378d('0x46')];if(!_0x42559d[_0x378d('0x2d')][_0x378d('0x33')](_0x378d('0x50'))){_0x44c830[_0x378d('0x1d')]=qs[_0x378d('0x1d')](_0x42559d['query'][_0x378d('0x1d')]);_0x44c830[_0x378d('0x1f')]=qs[_0x378d('0x1f')](_0x42559d[_0x378d('0x2d')][_0x378d('0x1f')]);}return _0x1ee712[_0x378d('0x52')](_0x44c830);}})[_0x378d('0x25')](function(_0x100ced){if(_0x100ced){return _0x100ced?{'count':_0x2f6e9e,'rows':_0x100ced}:null;}})['then'](respondWithResult(_0x3ee8d3,null))[_0x378d('0x42')](handleError(_0x3ee8d3,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index cb2e800..fac4aba 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 _0x459e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','api'];(function(_0x5eebac,_0x31a380){var _0x1418ff=function(_0x1dc5cf){while(--_0x1dc5cf){_0x5eebac['push'](_0x5eebac['shift']());}};_0x1418ff(++_0x31a380);}(_0x459e,0x142));var _0xe459=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x459e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe459('0x0'));var util=require(_0xe459('0x1'));var logger=require('../../config/logger')(_0xe459('0x2'));var moment=require(_0xe459('0x3'));var BPromise=require(_0xe459('0x4'));var rp=require(_0xe459('0x5'));var fs=require('fs');var path=require(_0xe459('0x6'));var rimraf=require(_0xe459('0x7'));var config=require(_0xe459('0x8'));var attributes=require(_0xe459('0x9'));module['exports']=function(_0x9c620,_0x222f69){return _0x9c620[_0xe459('0xa')](_0xe459('0xb'),attributes,{'tableName':_0xe459('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ead=['path','../../config/environment','exports','define','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5ef412,_0x5267bb){var _0x386df5=function(_0x1f8334){while(--_0x1f8334){_0x5ef412['push'](_0x5ef412['shift']());}};_0x386df5(++_0x5267bb);}(_0x9ead,0xdd));var _0xd9ea=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x9ead[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xd9ea('0x0'));var util=require(_0xd9ea('0x1'));var logger=require(_0xd9ea('0x2'))(_0xd9ea('0x3'));var moment=require(_0xd9ea('0x4'));var BPromise=require(_0xd9ea('0x5'));var rp=require(_0xd9ea('0x6'));var fs=require('fs');var path=require(_0xd9ea('0x7'));var rimraf=require('rimraf');var config=require(_0xd9ea('0x8'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xd9ea('0x9')]=function(_0x5638bc,_0x2be0d7){return _0x5638bc[_0xd9ea('0xa')]('SalesforceConfiguration',attributes,{'tableName':_0xd9ea('0xb'),'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 1c96c2c..234b97f 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 _0x95cd=['client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0xb04645,_0x4ca117){var _0x74af0d=function(_0x35997c){while(--_0x35997c){_0xb04645['push'](_0xb04645['shift']());}};_0x74af0d(++_0x4ca117);}(_0x95cd,0x6a));var _0xd95c=function(_0x102c76,_0x5d1914){_0x102c76=_0x102c76-0x0;var _0x2b6c36=_0x95cd[_0x102c76];return _0x2b6c36;};'use strict';var _=require(_0xd95c('0x0'));var util=require(_0xd95c('0x1'));var moment=require('moment');var BPromise=require(_0xd95c('0x2'));var rs=require(_0xd95c('0x3'));var fs=require('fs');var Redis=require(_0xd95c('0x4'));var db=require(_0xd95c('0x5'))['db'];var utils=require(_0xd95c('0x6'));var logger=require(_0xd95c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd95c('0x8'));var client=jayson[_0xd95c('0x9')][_0xd95c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d6a1e,_0x286417,_0x2bf287){return new BPromise(function(_0x2f60a5,_0xf2ffe7){return client['request'](_0x2d6a1e,_0x2bf287)[_0xd95c('0xb')](function(_0x207912){logger[_0xd95c('0xc')](_0xd95c('0xd'),_0x286417,_0xd95c('0xe'));logger[_0xd95c('0xf')](_0xd95c('0x10'),_0x286417,_0xd95c('0xe'),JSON[_0xd95c('0x11')](_0x207912));if(_0x207912['error']){if(_0x207912[_0xd95c('0x12')][_0xd95c('0x13')]===0x1f4){logger[_0xd95c('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x286417,_0x207912[_0xd95c('0x12')][_0xd95c('0x14')]);return _0xf2ffe7(_0x207912[_0xd95c('0x12')]['message']);}logger['error'](_0xd95c('0xd'),_0x286417,_0x207912[_0xd95c('0x12')][_0xd95c('0x14')]);return _0x2f60a5(_0x207912[_0xd95c('0x12')][_0xd95c('0x14')]);}else{logger[_0xd95c('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x286417,'request\x20sent');_0x2f60a5(_0x207912[_0xd95c('0x15')]['message']);}})[_0xd95c('0x16')](function(_0x5bf397){logger[_0xd95c('0x12')](_0xd95c('0xd'),_0x286417,_0x5bf397);_0xf2ffe7(_0x5bf397);});});} \ No newline at end of file +var _0x15dd=['http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x518d69,_0x3c4d7c){var _0x15079d=function(_0x17422c){while(--_0x17422c){_0x518d69['push'](_0x518d69['shift']());}};_0x15079d(++_0x3c4d7c);}(_0x15dd,0x1d9));var _0xd15d=function(_0xef9d03,_0x37617a){_0xef9d03=_0xef9d03-0x0;var _0x393bec=_0x15dd[_0xef9d03];return _0x393bec;};'use strict';var _=require('lodash');var util=require(_0xd15d('0x0'));var moment=require(_0xd15d('0x1'));var BPromise=require('bluebird');var rs=require(_0xd15d('0x2'));var fs=require('fs');var Redis=require(_0xd15d('0x3'));var db=require(_0xd15d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd15d('0x5'))(_0xd15d('0x6'));var config=require(_0xd15d('0x7'));var jayson=require(_0xd15d('0x8'));var client=jayson[_0xd15d('0x9')][_0xd15d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a9beb,_0x52cd08,_0x4690a5){return new BPromise(function(_0x2bc795,_0x22c995){return client[_0xd15d('0xb')](_0x4a9beb,_0x4690a5)[_0xd15d('0xc')](function(_0x1c1b51){logger[_0xd15d('0xd')](_0xd15d('0xe'),_0x52cd08,'request\x20sent');logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x52cd08,_0xd15d('0xf'),JSON[_0xd15d('0x10')](_0x1c1b51));if(_0x1c1b51[_0xd15d('0x11')]){if(_0x1c1b51[_0xd15d('0x11')][_0xd15d('0x12')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x52cd08,_0x1c1b51[_0xd15d('0x11')][_0xd15d('0x13')]);return _0x22c995(_0x1c1b51['error']['message']);}logger[_0xd15d('0x11')](_0xd15d('0xe'),_0x52cd08,_0x1c1b51[_0xd15d('0x11')][_0xd15d('0x13')]);return _0x2bc795(_0x1c1b51[_0xd15d('0x11')][_0xd15d('0x13')]);}else{logger[_0xd15d('0xd')](_0xd15d('0xe'),_0x52cd08,_0xd15d('0xf'));_0x2bc795(_0x1c1b51['result'][_0xd15d('0x13')]);}})[_0xd15d('0x14')](function(_0x464d21){logger[_0xd15d('0x11')](_0xd15d('0xe'),_0x52cd08,_0x464d21);_0x22c995(_0x464d21);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 857185b..60e2806 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 _0xbc59=['destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','index','show','post','isAuthenticated','create','put','/:id','update','delete'];(function(_0x3722a0,_0x23102f){var _0x34700d=function(_0x2a98ec){while(--_0x2a98ec){_0x3722a0['push'](_0x3722a0['shift']());}};_0x34700d(++_0x23102f);}(_0xbc59,0x158));var _0x9bc5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbc59[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x9bc5('0x0'));var util=require(_0x9bc5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9bc5('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9bc5('0x3'));var interaction=require(_0x9bc5('0x4'));var config=require(_0x9bc5('0x5'));var controller=require(_0x9bc5('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x9bc5('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9bc5('0x8')]);router[_0x9bc5('0x9')]('/',auth[_0x9bc5('0xa')](),controller[_0x9bc5('0xb')]);router[_0x9bc5('0xc')](_0x9bc5('0xd'),auth[_0x9bc5('0xa')](),controller[_0x9bc5('0xe')]);router[_0x9bc5('0xf')](_0x9bc5('0xd'),auth[_0x9bc5('0xa')](),controller[_0x9bc5('0x10')]);module[_0x9bc5('0x11')]=router; \ No newline at end of file +var _0x042d=['post','create','put','update','delete','/:id','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index'];(function(_0x970068,_0x3e4142){var _0x51063d=function(_0x32b30e){while(--_0x32b30e){_0x970068['push'](_0x970068['shift']());}};_0x51063d(++_0x3e4142);}(_0x042d,0x15e));var _0xd042=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x042d[_0x57d13b];return _0x467696;};'use strict';var multer=require(_0xd042('0x0'));var util=require('util');var path=require(_0xd042('0x1'));var timeout=require('connect-timeout');var express=require(_0xd042('0x2'));var router=express[_0xd042('0x3')]();var fs_extra=require(_0xd042('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd042('0x5'));var config=require(_0xd042('0x6'));var controller=require(_0xd042('0x7'));router[_0xd042('0x8')]('/',auth[_0xd042('0x9')](),controller[_0xd042('0xa')]);router[_0xd042('0x8')]('/:id',auth[_0xd042('0x9')](),controller['show']);router[_0xd042('0xb')]('/',auth[_0xd042('0x9')](),controller[_0xd042('0xc')]);router[_0xd042('0xd')]('/:id',auth[_0xd042('0x9')](),controller[_0xd042('0xe')]);router[_0xd042('0xf')](_0xd042('0x10'),auth['isAuthenticated'](),controller[_0xd042('0x11')]);module[_0xd042('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 1481c74..5a2228d 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 _0x569a=['ENUM','variable','customVariable','keyValue','picklist','string','STRING','sequelize','exports'];(function(_0x2e668c,_0x106b6b){var _0x7f1524=function(_0x4c0dc6){while(--_0x4c0dc6){_0x2e668c['push'](_0x2e668c['shift']());}};_0x7f1524(++_0x106b6b);}(_0x569a,0x178));var _0xa569=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x569a[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0xa569('0x0'));module[_0xa569('0x1')]={'type':{'type':Sequelize[_0xa569('0x2')]('string',_0xa569('0x3'),_0xa569('0x4'),_0xa569('0x5'),_0xa569('0x6')),'defaultValue':_0xa569('0x7')},'content':{'type':Sequelize[_0xa569('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa569('0x2')]('string',_0xa569('0x3'),_0xa569('0x4'))},'keyContent':{'type':Sequelize[_0xa569('0x8')]},'idField':{'type':Sequelize[_0xa569('0x8')]},'variableName':{'type':Sequelize[_0xa569('0x8')]}}; \ No newline at end of file +var _0x8932=['customVariable','exports','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x3a9213,_0x307da3){var _0x221236=function(_0x1824cf){while(--_0x1824cf){_0x3a9213['push'](_0x3a9213['shift']());}};_0x221236(++_0x307da3);}(_0x8932,0x101));var _0x2893=function(_0x358e42,_0x88ec74){_0x358e42=_0x358e42-0x0;var _0x5b14a4=_0x8932[_0x358e42];return _0x5b14a4;};'use strict';var Sequelize=require('sequelize');module[_0x2893('0x0')]={'type':{'type':Sequelize[_0x2893('0x1')](_0x2893('0x2'),_0x2893('0x3'),'customVariable',_0x2893('0x4'),_0x2893('0x5')),'defaultValue':_0x2893('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2893('0x6')]},'keyType':{'type':Sequelize[_0x2893('0x1')](_0x2893('0x2'),_0x2893('0x3'),_0x2893('0x7'))},'keyContent':{'type':Sequelize[_0x2893('0x6')]},'idField':{'type':Sequelize[_0x2893('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 082ff88..d09b6a4 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 _0x92a7=['lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','name','index','map','SalesforceField','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','include','findAll','catch','intersection','includeAll','merge','find','create','body','params','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x92a7,0x1a1));var _0x792a=function(_0x3b2afe,_0x2aa0e7){_0x3b2afe=_0x3b2afe-0x0;var _0x473a1e=_0x92a7[_0x3b2afe];return _0x473a1e;};'use strict';var emlformat=require(_0x792a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x792a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x792a('0x2'));var moment=require(_0x792a('0x3'));var BPromise=require(_0x792a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x792a('0x5'));var sox=require(_0x792a('0x6'));var csv=require('to-csv');var ejs=require(_0x792a('0x7'));var fs=require('fs');var fs_extra=require(_0x792a('0x8'));var _=require(_0x792a('0x9'));var squel=require(_0x792a('0xa'));var crypto=require('crypto');var jsforce=require(_0x792a('0xb'));var deskjs=require(_0x792a('0xc'));var toCsv=require(_0x792a('0xd'));var querystring=require(_0x792a('0xe'));var Papa=require(_0x792a('0xf'));var Redis=require(_0x792a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x792a('0x11'));var as=require(_0x792a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x792a('0x13'))(_0x792a('0x14'));var utils=require('../../config/utils');var config=require(_0x792a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x792a('0x16'))['db'];function respondWithStatusCode(_0x59d385,_0x2e6513){_0x2e6513=_0x2e6513||0xcc;return function(_0x1e95ac){if(_0x1e95ac){return _0x59d385[_0x792a('0x17')](_0x2e6513);}return _0x59d385['status'](_0x2e6513)['end']();};}function respondWithResult(_0x185a0f,_0x5a60f4){_0x5a60f4=_0x5a60f4||0xc8;return function(_0x2c479f){if(_0x2c479f){return _0x185a0f[_0x792a('0x18')](_0x5a60f4)['json'](_0x2c479f);}};}function respondWithFilteredResult(_0x3f02d5,_0x13c63e){return function(_0x33e69f){if(_0x33e69f){var _0x7dba1a=typeof _0x13c63e[_0x792a('0x19')]==='undefined'&&typeof _0x13c63e[_0x792a('0x1a')]===_0x792a('0x1b');var _0x1cfdbc=_0x33e69f['count'];var _0x502669=_0x7dba1a?0x0:_0x13c63e[_0x792a('0x19')];var _0x53c022=_0x7dba1a?_0x33e69f[_0x792a('0x1c')]:_0x13c63e['offset']+_0x13c63e[_0x792a('0x1a')];var _0x46dae2;if(_0x53c022>=_0x1cfdbc){_0x53c022=_0x1cfdbc;_0x46dae2=0xc8;}else{_0x46dae2=0xce;}_0x3f02d5['status'](_0x46dae2);return _0x3f02d5[_0x792a('0x1d')](_0x792a('0x1e'),_0x502669+'-'+_0x53c022+'/'+_0x1cfdbc)[_0x792a('0x1f')](_0x33e69f);}return null;};}function patchUpdates(_0x234301){return function(_0x1f75fe){try{jsonpatch[_0x792a('0x20')](_0x1f75fe,_0x234301,!![]);}catch(_0x55bd9c){return BPromise[_0x792a('0x21')](_0x55bd9c);}return _0x1f75fe[_0x792a('0x22')]();};}function saveUpdates(_0x432545,_0x21dc24){return function(_0x2a0f04){if(_0x2a0f04){return _0x2a0f04[_0x792a('0x23')](_0x432545)[_0x792a('0x24')](function(_0x26bfa9){return _0x26bfa9;});}return null;};}function removeEntity(_0x3134af,_0x41838d){return function(_0x2e7647){if(_0x2e7647){return _0x2e7647[_0x792a('0x25')]()[_0x792a('0x24')](function(){_0x3134af[_0x792a('0x18')](0xcc)[_0x792a('0x26')]();});}};}function handleEntityNotFound(_0x492c24,_0x4f267b){return function(_0x43d484){if(!_0x43d484){_0x492c24[_0x792a('0x17')](0x194);}return _0x43d484;};}function handleError(_0x2af851,_0x3fed64){_0x3fed64=_0x3fed64||0x1f4;return function(_0x510eea){logger['error'](_0x510eea['stack']);if(_0x510eea['name']){delete _0x510eea[_0x792a('0x27')];}_0x2af851[_0x792a('0x18')](_0x3fed64)['send'](_0x510eea);};}exports[_0x792a('0x28')]=function(_0x1923b0,_0x2e9df4){var _0x182eea={},_0x118e85={},_0x46a292={'count':0x0,'rows':[]};var _0x1c5417=_[_0x792a('0x29')](db[_0x792a('0x2a')][_0x792a('0x2b')],function(_0x4eaa7e){return{'name':_0x4eaa7e[_0x792a('0x2c')],'type':_0x4eaa7e[_0x792a('0x2d')]['key']};});_0x118e85[_0x792a('0x2e')]=_[_0x792a('0x29')](_0x1c5417,_0x792a('0x27'));_0x118e85[_0x792a('0x2f')]=_[_0x792a('0x30')](_0x1923b0[_0x792a('0x2f')]);_0x118e85[_0x792a('0x31')]=_['intersection'](_0x118e85[_0x792a('0x2e')],_0x118e85[_0x792a('0x2f')]);_0x182eea[_0x792a('0x32')]=_['intersection'](_0x118e85['model'],qs['fields'](_0x1923b0[_0x792a('0x2f')][_0x792a('0x33')]));_0x182eea['attributes']=_0x182eea[_0x792a('0x32')][_0x792a('0x34')]?_0x182eea[_0x792a('0x32')]:_0x118e85['model'];if(!_0x1923b0[_0x792a('0x2f')][_0x792a('0x35')](_0x792a('0x36'))){_0x182eea[_0x792a('0x1a')]=qs[_0x792a('0x1a')](_0x1923b0[_0x792a('0x2f')][_0x792a('0x1a')]);_0x182eea['offset']=qs[_0x792a('0x19')](_0x1923b0[_0x792a('0x2f')][_0x792a('0x19')]);}_0x182eea[_0x792a('0x37')]=qs[_0x792a('0x38')](_0x1923b0[_0x792a('0x2f')][_0x792a('0x38')]);_0x182eea[_0x792a('0x39')]=qs[_0x792a('0x31')](_[_0x792a('0x3a')](_0x1923b0['query'],_0x118e85[_0x792a('0x31')]),_0x1c5417);if(_0x1923b0['query'][_0x792a('0x3b')]){_0x182eea[_0x792a('0x39')]=_['merge'](_0x182eea[_0x792a('0x39')],{'$or':_[_0x792a('0x29')](_0x1c5417,function(_0x52a44d){if(_0x52a44d[_0x792a('0x2d')]!=='VIRTUAL'){var _0x1daed9={};_0x1daed9[_0x52a44d[_0x792a('0x27')]]={'$like':'%'+_0x1923b0[_0x792a('0x2f')][_0x792a('0x3b')]+'%'};return _0x1daed9;}})});}_0x182eea=_['merge']({},_0x182eea,_0x1923b0[_0x792a('0x3c')]);var _0x5c0b1f={'where':_0x182eea[_0x792a('0x39')]};return db[_0x792a('0x2a')][_0x792a('0x1c')](_0x5c0b1f)[_0x792a('0x24')](function(_0x53fb7e){_0x46a292[_0x792a('0x1c')]=_0x53fb7e;if(_0x1923b0[_0x792a('0x2f')]['includeAll']){_0x182eea[_0x792a('0x3d')]=[{'all':!![]}];}return db[_0x792a('0x2a')][_0x792a('0x3e')](_0x182eea);})[_0x792a('0x24')](function(_0x4f5d7d){_0x46a292['rows']=_0x4f5d7d;return _0x46a292;})[_0x792a('0x24')](respondWithFilteredResult(_0x2e9df4,_0x182eea))[_0x792a('0x3f')](handleError(_0x2e9df4,null));};exports['show']=function(_0x4ecc02,_0x2cc284){var _0x35c287={'raw':!![],'where':{'id':_0x4ecc02['params']['id']}},_0x5b9b32={};_0x5b9b32[_0x792a('0x2e')]=_[_0x792a('0x30')](db[_0x792a('0x2a')][_0x792a('0x2b')]);_0x5b9b32[_0x792a('0x2f')]=_[_0x792a('0x30')](_0x4ecc02[_0x792a('0x2f')]);_0x5b9b32[_0x792a('0x31')]=_[_0x792a('0x40')](_0x5b9b32[_0x792a('0x2e')],_0x5b9b32[_0x792a('0x2f')]);_0x35c287[_0x792a('0x32')]=_[_0x792a('0x40')](_0x5b9b32[_0x792a('0x2e')],qs[_0x792a('0x33')](_0x4ecc02[_0x792a('0x2f')][_0x792a('0x33')]));_0x35c287['attributes']=_0x35c287[_0x792a('0x32')][_0x792a('0x34')]?_0x35c287[_0x792a('0x32')]:_0x5b9b32[_0x792a('0x2e')];if(_0x4ecc02['query'][_0x792a('0x41')]){_0x35c287[_0x792a('0x3d')]=[{'all':!![]}];}_0x35c287=_[_0x792a('0x42')]({},_0x35c287,_0x4ecc02['options']);return db[_0x792a('0x2a')][_0x792a('0x43')](_0x35c287)[_0x792a('0x24')](handleEntityNotFound(_0x2cc284,null))['then'](respondWithResult(_0x2cc284,null))[_0x792a('0x3f')](handleError(_0x2cc284,null));};exports[_0x792a('0x44')]=function(_0x2e9bb2,_0x5b5b79){return db[_0x792a('0x2a')][_0x792a('0x44')](_0x2e9bb2[_0x792a('0x45')],{})[_0x792a('0x24')](respondWithResult(_0x5b5b79,0xc9))[_0x792a('0x3f')](handleError(_0x5b5b79,null));};exports[_0x792a('0x23')]=function(_0x3760c8,_0x4f348b){if(_0x3760c8[_0x792a('0x45')]['id']){delete _0x3760c8[_0x792a('0x45')]['id'];}return db['SalesforceField'][_0x792a('0x43')]({'where':{'id':_0x3760c8[_0x792a('0x46')]['id']}})[_0x792a('0x24')](handleEntityNotFound(_0x4f348b,null))[_0x792a('0x24')](saveUpdates(_0x3760c8[_0x792a('0x45')],null))['then'](respondWithResult(_0x4f348b,null))['catch'](handleError(_0x4f348b,null));};exports[_0x792a('0x25')]=function(_0x56f934,_0x3ad9eb){return db[_0x792a('0x2a')][_0x792a('0x43')]({'where':{'id':_0x56f934[_0x792a('0x46')]['id']}})['then'](handleEntityNotFound(_0x3ad9eb,null))[_0x792a('0x24')](removeEntity(_0x3ad9eb,null))['catch'](handleError(_0x3ad9eb,null));}; \ No newline at end of file +var _0x06ca=['fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','SalesforceField','includeAll','include','findAll','show','params','rawAttributes','length','options','find','catch','create','body','eml-format','rimraf','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','key','model','query','keys','filters','intersection','attributes'];(function(_0x3ead25,_0x456c38){var _0x45a399=function(_0x6b1524){while(--_0x6b1524){_0x3ead25['push'](_0x3ead25['shift']());}};_0x45a399(++_0x456c38);}(_0x06ca,0x101));var _0xa06c=function(_0x4dc46a,_0x4c8f59){_0x4dc46a=_0x4dc46a-0x0;var _0x304a3c=_0x06ca[_0x4dc46a];return _0x304a3c;};'use strict';var emlformat=require(_0xa06c('0x0'));var rimraf=require(_0xa06c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa06c('0x2'));var rp=require(_0xa06c('0x3'));var moment=require(_0xa06c('0x4'));var BPromise=require(_0xa06c('0x5'));var Mustache=require(_0xa06c('0x6'));var util=require(_0xa06c('0x7'));var path=require(_0xa06c('0x8'));var sox=require(_0xa06c('0x9'));var csv=require(_0xa06c('0xa'));var ejs=require(_0xa06c('0xb'));var fs=require('fs');var fs_extra=require(_0xa06c('0xc'));var _=require(_0xa06c('0xd'));var squel=require(_0xa06c('0xe'));var crypto=require(_0xa06c('0xf'));var jsforce=require(_0xa06c('0x10'));var deskjs=require(_0xa06c('0x11'));var toCsv=require(_0xa06c('0xa'));var querystring=require(_0xa06c('0x12'));var Papa=require(_0xa06c('0x13'));var Redis=require(_0xa06c('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa06c('0x15'));var hardwareService=require(_0xa06c('0x16'));var logger=require(_0xa06c('0x17'))('api');var utils=require(_0xa06c('0x18'));var config=require(_0xa06c('0x19'));var licenseUtil=require(_0xa06c('0x1a'));var db=require(_0xa06c('0x1b'))['db'];function respondWithStatusCode(_0x21d192,_0xb4d06f){_0xb4d06f=_0xb4d06f||0xcc;return function(_0x226e59){if(_0x226e59){return _0x21d192[_0xa06c('0x1c')](_0xb4d06f);}return _0x21d192[_0xa06c('0x1d')](_0xb4d06f)[_0xa06c('0x1e')]();};}function respondWithResult(_0x39d24e,_0x460512){_0x460512=_0x460512||0xc8;return function(_0x14e088){if(_0x14e088){return _0x39d24e[_0xa06c('0x1d')](_0x460512)[_0xa06c('0x1f')](_0x14e088);}};}function respondWithFilteredResult(_0x3c3575,_0x531a05){return function(_0x427869){if(_0x427869){var _0x4b449f=typeof _0x531a05[_0xa06c('0x20')]===_0xa06c('0x21')&&typeof _0x531a05[_0xa06c('0x22')]===_0xa06c('0x21');var _0x72ab53=_0x427869[_0xa06c('0x23')];var _0x5a103b=_0x4b449f?0x0:_0x531a05['offset'];var _0x17bdba=_0x4b449f?_0x427869[_0xa06c('0x23')]:_0x531a05['offset']+_0x531a05[_0xa06c('0x22')];var _0x22882a;if(_0x17bdba>=_0x72ab53){_0x17bdba=_0x72ab53;_0x22882a=0xc8;}else{_0x22882a=0xce;}_0x3c3575[_0xa06c('0x1d')](_0x22882a);return _0x3c3575[_0xa06c('0x24')](_0xa06c('0x25'),_0x5a103b+'-'+_0x17bdba+'/'+_0x72ab53)[_0xa06c('0x1f')](_0x427869);}return null;};}function patchUpdates(_0x4d1246){return function(_0x5b4d61){try{jsonpatch[_0xa06c('0x26')](_0x5b4d61,_0x4d1246,!![]);}catch(_0x590549){return BPromise['reject'](_0x590549);}return _0x5b4d61[_0xa06c('0x27')]();};}function saveUpdates(_0x3bfdc1,_0x5437b5){return function(_0x5e75d2){if(_0x5e75d2){return _0x5e75d2[_0xa06c('0x28')](_0x3bfdc1)[_0xa06c('0x29')](function(_0x47d601){return _0x47d601;});}return null;};}function removeEntity(_0x29077f,_0x16f9f7){return function(_0x2293a3){if(_0x2293a3){return _0x2293a3[_0xa06c('0x2a')]()[_0xa06c('0x29')](function(){_0x29077f[_0xa06c('0x1d')](0xcc)[_0xa06c('0x1e')]();});}};}function handleEntityNotFound(_0x4ab976,_0x437613){return function(_0x4bb46c){if(!_0x4bb46c){_0x4ab976[_0xa06c('0x1c')](0x194);}return _0x4bb46c;};}function handleError(_0x49aecc,_0x250760){_0x250760=_0x250760||0x1f4;return function(_0xe2311f){logger['error'](_0xe2311f[_0xa06c('0x2b')]);if(_0xe2311f[_0xa06c('0x2c')]){delete _0xe2311f[_0xa06c('0x2c')];}_0x49aecc[_0xa06c('0x1d')](_0x250760)[_0xa06c('0x2d')](_0xe2311f);};}exports[_0xa06c('0x2e')]=function(_0x3958a4,_0x5c8969){var _0x1a8cb4={},_0x5012eb={},_0xd690d5={'count':0x0,'rows':[]};var _0x1f9daa=_[_0xa06c('0x2f')](db['SalesforceField']['rawAttributes'],function(_0x2b4430){return{'name':_0x2b4430['fieldName'],'type':_0x2b4430['type'][_0xa06c('0x30')]};});_0x5012eb[_0xa06c('0x31')]=_[_0xa06c('0x2f')](_0x1f9daa,'name');_0x5012eb[_0xa06c('0x32')]=_[_0xa06c('0x33')](_0x3958a4['query']);_0x5012eb[_0xa06c('0x34')]=_[_0xa06c('0x35')](_0x5012eb[_0xa06c('0x31')],_0x5012eb[_0xa06c('0x32')]);_0x1a8cb4[_0xa06c('0x36')]=_['intersection'](_0x5012eb[_0xa06c('0x31')],qs[_0xa06c('0x37')](_0x3958a4[_0xa06c('0x32')][_0xa06c('0x37')]));_0x1a8cb4[_0xa06c('0x36')]=_0x1a8cb4['attributes']['length']?_0x1a8cb4[_0xa06c('0x36')]:_0x5012eb[_0xa06c('0x31')];if(!_0x3958a4['query']['hasOwnProperty'](_0xa06c('0x38'))){_0x1a8cb4[_0xa06c('0x22')]=qs[_0xa06c('0x22')](_0x3958a4[_0xa06c('0x32')][_0xa06c('0x22')]);_0x1a8cb4['offset']=qs[_0xa06c('0x20')](_0x3958a4[_0xa06c('0x32')]['offset']);}_0x1a8cb4[_0xa06c('0x39')]=qs['sort'](_0x3958a4[_0xa06c('0x32')][_0xa06c('0x3a')]);_0x1a8cb4[_0xa06c('0x3b')]=qs[_0xa06c('0x34')](_[_0xa06c('0x3c')](_0x3958a4[_0xa06c('0x32')],_0x5012eb[_0xa06c('0x34')]),_0x1f9daa);if(_0x3958a4[_0xa06c('0x32')][_0xa06c('0x3d')]){_0x1a8cb4[_0xa06c('0x3b')]=_[_0xa06c('0x3e')](_0x1a8cb4[_0xa06c('0x3b')],{'$or':_[_0xa06c('0x2f')](_0x1f9daa,function(_0x265912){if(_0x265912[_0xa06c('0x3f')]!==_0xa06c('0x40')){var _0x352695={};_0x352695[_0x265912[_0xa06c('0x2c')]]={'$like':'%'+_0x3958a4['query'][_0xa06c('0x3d')]+'%'};return _0x352695;}})});}_0x1a8cb4=_[_0xa06c('0x3e')]({},_0x1a8cb4,_0x3958a4['options']);var _0x1c4184={'where':_0x1a8cb4[_0xa06c('0x3b')]};return db[_0xa06c('0x41')]['count'](_0x1c4184)[_0xa06c('0x29')](function(_0x43df71){_0xd690d5[_0xa06c('0x23')]=_0x43df71;if(_0x3958a4[_0xa06c('0x32')][_0xa06c('0x42')]){_0x1a8cb4[_0xa06c('0x43')]=[{'all':!![]}];}return db[_0xa06c('0x41')][_0xa06c('0x44')](_0x1a8cb4);})[_0xa06c('0x29')](function(_0x4ace2b){_0xd690d5['rows']=_0x4ace2b;return _0xd690d5;})[_0xa06c('0x29')](respondWithFilteredResult(_0x5c8969,_0x1a8cb4))['catch'](handleError(_0x5c8969,null));};exports[_0xa06c('0x45')]=function(_0x5c1896,_0x3e69de){var _0x3efd00={'raw':!![],'where':{'id':_0x5c1896[_0xa06c('0x46')]['id']}},_0x7ce069={};_0x7ce069[_0xa06c('0x31')]=_['keys'](db[_0xa06c('0x41')][_0xa06c('0x47')]);_0x7ce069[_0xa06c('0x32')]=_[_0xa06c('0x33')](_0x5c1896[_0xa06c('0x32')]);_0x7ce069['filters']=_['intersection'](_0x7ce069['model'],_0x7ce069[_0xa06c('0x32')]);_0x3efd00[_0xa06c('0x36')]=_[_0xa06c('0x35')](_0x7ce069['model'],qs['fields'](_0x5c1896[_0xa06c('0x32')][_0xa06c('0x37')]));_0x3efd00[_0xa06c('0x36')]=_0x3efd00[_0xa06c('0x36')][_0xa06c('0x48')]?_0x3efd00[_0xa06c('0x36')]:_0x7ce069['model'];if(_0x5c1896[_0xa06c('0x32')][_0xa06c('0x42')]){_0x3efd00[_0xa06c('0x43')]=[{'all':!![]}];}_0x3efd00=_['merge']({},_0x3efd00,_0x5c1896[_0xa06c('0x49')]);return db[_0xa06c('0x41')][_0xa06c('0x4a')](_0x3efd00)[_0xa06c('0x29')](handleEntityNotFound(_0x3e69de,null))[_0xa06c('0x29')](respondWithResult(_0x3e69de,null))[_0xa06c('0x4b')](handleError(_0x3e69de,null));};exports[_0xa06c('0x4c')]=function(_0x20fd86,_0xafa18e){return db[_0xa06c('0x41')][_0xa06c('0x4c')](_0x20fd86[_0xa06c('0x4d')],{})[_0xa06c('0x29')](respondWithResult(_0xafa18e,0xc9))[_0xa06c('0x4b')](handleError(_0xafa18e,null));};exports[_0xa06c('0x28')]=function(_0x309dcd,_0x8fe5e7){if(_0x309dcd[_0xa06c('0x4d')]['id']){delete _0x309dcd[_0xa06c('0x4d')]['id'];}return db[_0xa06c('0x41')]['find']({'where':{'id':_0x309dcd[_0xa06c('0x46')]['id']}})[_0xa06c('0x29')](handleEntityNotFound(_0x8fe5e7,null))[_0xa06c('0x29')](saveUpdates(_0x309dcd[_0xa06c('0x4d')],null))[_0xa06c('0x29')](respondWithResult(_0x8fe5e7,null))[_0xa06c('0x4b')](handleError(_0x8fe5e7,null));};exports['destroy']=function(_0x478361,_0x20bbd8){return db[_0xa06c('0x41')]['find']({'where':{'id':_0x478361['params']['id']}})[_0xa06c('0x29')](handleEntityNotFound(_0x20bbd8,null))['then'](removeEntity(_0x20bbd8,null))[_0xa06c('0x4b')](handleError(_0x20bbd8,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 861da40..7b7be31 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 _0xe3be=['define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports'];(function(_0x26641c,_0x1ba2a5){var _0x42c01a=function(_0x15c7da){while(--_0x15c7da){_0x26641c['push'](_0x26641c['shift']());}};_0x42c01a(++_0x1ba2a5);}(_0xe3be,0xb9));var _0xee3b=function(_0x324f78,_0x5056e7){_0x324f78=_0x324f78-0x0;var _0x3cd932=_0xe3be[_0x324f78];return _0x3cd932;};'use strict';var _=require(_0xee3b('0x0'));var util=require(_0xee3b('0x1'));var logger=require(_0xee3b('0x2'))(_0xee3b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xee3b('0x4'));var fs=require('fs');var path=require(_0xee3b('0x5'));var rimraf=require(_0xee3b('0x6'));var config=require(_0xee3b('0x7'));var attributes=require(_0xee3b('0x8'));module[_0xee3b('0x9')]=function(_0x27f69d,_0x130726){return _0x27f69d[_0xee3b('0xa')]('SalesforceField',attributes,{'tableName':_0xee3b('0xb'),'paranoid':![],'indexes':[{'name':_0xee3b('0xc'),'fields':[_0xee3b('0xd'),_0xee3b('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f1a=['salesforce_unique_index','FieldId','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields'];(function(_0x4805a8,_0x48aa94){var _0x5e1b2f=function(_0x2571ee){while(--_0x2571ee){_0x4805a8['push'](_0x4805a8['shift']());}};_0x5e1b2f(++_0x48aa94);}(_0x4f1a,0x154));var _0xa4f1=function(_0x1aab33,_0x327f92){_0x1aab33=_0x1aab33-0x0;var _0x4bf0df=_0x4f1a[_0x1aab33];return _0x4bf0df;};'use strict';var _=require(_0xa4f1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa4f1('0x1'));var moment=require(_0xa4f1('0x2'));var BPromise=require('bluebird');var rp=require(_0xa4f1('0x3'));var fs=require('fs');var path=require(_0xa4f1('0x4'));var rimraf=require(_0xa4f1('0x5'));var config=require(_0xa4f1('0x6'));var attributes=require(_0xa4f1('0x7'));module[_0xa4f1('0x8')]=function(_0xe46783,_0x1fbdfc){return _0xe46783['define'](_0xa4f1('0x9'),attributes,{'tableName':_0xa4f1('0xa'),'paranoid':![],'indexes':[{'name':_0xa4f1('0xb'),'fields':['idField',_0xa4f1('0xc')],'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 2117b76..d4a6431 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 _0x758b=['../../config/environment','client','http','request','then','request\x20sent','debug','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','info','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xbe383e,_0x53ca49){var _0x2bfa59=function(_0x5d95e4){while(--_0x5d95e4){_0xbe383e['push'](_0xbe383e['shift']());}};_0x2bfa59(++_0x53ca49);}(_0x758b,0x8c));var _0xb758=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x758b[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xb758('0x0'));var util=require(_0xb758('0x1'));var moment=require(_0xb758('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb758('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb758('0x4'));var logger=require(_0xb758('0x5'))(_0xb758('0x6'));var config=require(_0xb758('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb758('0x8')][_0xb758('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d8666,_0x39152c,_0x1032f0){return new BPromise(function(_0xdf9c26,_0x451881){return client[_0xb758('0xa')](_0x5d8666,_0x1032f0)[_0xb758('0xb')](function(_0x27c9ca){logger['info']('SalesforceField,\x20%s,\x20%s',_0x39152c,_0xb758('0xc'));logger[_0xb758('0xd')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x39152c,'request\x20sent',JSON[_0xb758('0xe')](_0x27c9ca));if(_0x27c9ca[_0xb758('0xf')]){if(_0x27c9ca['error'][_0xb758('0x10')]===0x1f4){logger['error'](_0xb758('0x11'),_0x39152c,_0x27c9ca['error'][_0xb758('0x12')]);return _0x451881(_0x27c9ca[_0xb758('0xf')][_0xb758('0x12')]);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x39152c,_0x27c9ca[_0xb758('0xf')][_0xb758('0x12')]);return _0xdf9c26(_0x27c9ca[_0xb758('0xf')][_0xb758('0x12')]);}else{logger[_0xb758('0x13')](_0xb758('0x11'),_0x39152c,_0xb758('0xc'));_0xdf9c26(_0x27c9ca['result'][_0xb758('0x12')]);}})[_0xb758('0x14')](function(_0x42414d){logger[_0xb758('0xf')](_0xb758('0x11'),_0x39152c,_0x42414d);_0x451881(_0x42414d);});});} \ No newline at end of file +var _0x089f=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x5c0bed,_0x178478){var _0x603226=function(_0xe97300){while(--_0xe97300){_0x5c0bed['push'](_0x5c0bed['shift']());}};_0x603226(++_0x178478);}(_0x089f,0x168));var _0xf089=function(_0x2b57e7,_0x2501ec){_0x2b57e7=_0x2b57e7-0x0;var _0x3f27c2=_0x089f[_0x2b57e7];return _0x3f27c2;};'use strict';var _=require(_0xf089('0x0'));var util=require(_0xf089('0x1'));var moment=require('moment');var BPromise=require(_0xf089('0x2'));var rs=require(_0xf089('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf089('0x4'))['db'];var utils=require(_0xf089('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf089('0x6'));var jayson=require(_0xf089('0x7'));var client=jayson['client'][_0xf089('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4110e8,_0x21aae8,_0x240a94){return new BPromise(function(_0x5504eb,_0x20ea72){return client[_0xf089('0x9')](_0x4110e8,_0x240a94)['then'](function(_0x4d3fb1){logger[_0xf089('0xa')](_0xf089('0xb'),_0x21aae8,_0xf089('0xc'));logger['debug'](_0xf089('0xd'),_0x21aae8,_0xf089('0xc'),JSON[_0xf089('0xe')](_0x4d3fb1));if(_0x4d3fb1[_0xf089('0xf')]){if(_0x4d3fb1[_0xf089('0xf')][_0xf089('0x10')]===0x1f4){logger[_0xf089('0xf')](_0xf089('0xb'),_0x21aae8,_0x4d3fb1['error'][_0xf089('0x11')]);return _0x20ea72(_0x4d3fb1[_0xf089('0xf')]['message']);}logger[_0xf089('0xf')](_0xf089('0xb'),_0x21aae8,_0x4d3fb1[_0xf089('0xf')][_0xf089('0x11')]);return _0x5504eb(_0x4d3fb1['error'][_0xf089('0x11')]);}else{logger[_0xf089('0xa')](_0xf089('0xb'),_0x21aae8,_0xf089('0xc'));_0x5504eb(_0x4d3fb1['result'][_0xf089('0x11')]);}})[_0xf089('0x12')](function(_0x43e94a){logger[_0xf089('0xf')]('SalesforceField,\x20%s,\x20%s',_0x21aae8,_0x43e94a);_0x20ea72(_0x43e94a);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 1b873c4..852a421 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 _0x23c6=['../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','/:id','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x29fff7,_0x2631d1){var _0x2dba76=function(_0x4170fa){while(--_0x4170fa){_0x29fff7['push'](_0x29fff7['shift']());}};_0x2dba76(++_0x2631d1);}(_0x23c6,0xe1));var _0x623c=function(_0x29be7a,_0x57dd8c){_0x29be7a=_0x29be7a-0x0;var _0x22d1bf=_0x23c6[_0x29be7a];return _0x22d1bf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x623c('0x0'));var timeout=require('connect-timeout');var express=require(_0x623c('0x1'));var router=express[_0x623c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x623c('0x3'));var interaction=require(_0x623c('0x4'));var config=require(_0x623c('0x5'));var controller=require(_0x623c('0x6'));router['get']('/',auth[_0x623c('0x7')](),controller[_0x623c('0x8')]);router[_0x623c('0x9')]('/:id',auth[_0x623c('0x7')](),controller[_0x623c('0xa')]);router[_0x623c('0x9')](_0x623c('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x623c('0x9')](_0x623c('0xc'),auth[_0x623c('0x7')](),controller[_0x623c('0xd')]);router[_0x623c('0xe')]('/',auth[_0x623c('0x7')](),controller[_0x623c('0xf')]);router['post'](_0x623c('0xb'),auth[_0x623c('0x7')](),controller[_0x623c('0x10')]);router[_0x623c('0x11')]('/:id',auth[_0x623c('0x7')](),controller[_0x623c('0x12')]);router[_0x623c('0x13')](_0x623c('0x14'),auth[_0x623c('0x7')](),controller[_0x623c('0x15')]);module[_0x623c('0x16')]=router; \ No newline at end of file +var _0x47c2=['create','addConfiguration','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post'];(function(_0x27b397,_0x445a20){var _0x34f616=function(_0x326bf7){while(--_0x326bf7){_0x27b397['push'](_0x27b397['shift']());}};_0x34f616(++_0x445a20);}(_0x47c2,0x1ae));var _0x247c=function(_0x460614,_0x18baf4){_0x460614=_0x460614-0x0;var _0x4685f1=_0x47c2[_0x460614];return _0x4685f1;};'use strict';var multer=require(_0x247c('0x0'));var util=require(_0x247c('0x1'));var path=require(_0x247c('0x2'));var timeout=require(_0x247c('0x3'));var express=require(_0x247c('0x4'));var router=express[_0x247c('0x5')]();var fs_extra=require(_0x247c('0x6'));var auth=require(_0x247c('0x7'));var interaction=require(_0x247c('0x8'));var config=require(_0x247c('0x9'));var controller=require(_0x247c('0xa'));router[_0x247c('0xb')]('/',auth[_0x247c('0xc')](),controller[_0x247c('0xd')]);router[_0x247c('0xb')](_0x247c('0xe'),auth['isAuthenticated'](),controller[_0x247c('0xf')]);router['get'](_0x247c('0x10'),auth[_0x247c('0xc')](),controller['getConfigurations']);router[_0x247c('0xb')](_0x247c('0x11'),auth['isAuthenticated'](),controller[_0x247c('0x12')]);router[_0x247c('0x13')]('/',auth[_0x247c('0xc')](),controller[_0x247c('0x14')]);router[_0x247c('0x13')](_0x247c('0x10'),auth['isAuthenticated'](),controller[_0x247c('0x15')]);router['put'](_0x247c('0xe'),auth[_0x247c('0xc')](),controller[_0x247c('0x16')]);router[_0x247c('0x17')](_0x247c('0xe'),auth[_0x247c('0xc')](),controller[_0x247c('0x18')]);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 ab39a37..5e9897a 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 _0x09a5=['sequelize','exports','STRING','username','remoteUri'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x09a5,0x154));var _0x509a=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x09a5[_0x387777];return _0x3f84c0;};'use strict';var Sequelize=require(_0x509a('0x0'));module[_0x509a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x509a('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x509a('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x509a('0x2')]},'remoteUri':{'type':Sequelize[_0x509a('0x2')],'unique':_0x509a('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x89f7=['exports','STRING','username'];(function(_0x3299d1,_0x545733){var _0x44356e=function(_0x52fd77){while(--_0x52fd77){_0x3299d1['push'](_0x3299d1['shift']());}};_0x44356e(++_0x545733);}(_0x89f7,0x1e9));var _0x789f=function(_0x39157f,_0x3d8c1e){_0x39157f=_0x39157f-0x0;var _0x1ae4e2=_0x89f7[_0x39157f];return _0x1ae4e2;};'use strict';var Sequelize=require('sequelize');module[_0x789f('0x0')]={'name':{'type':Sequelize[_0x789f('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x789f('0x1')],'unique':_0x789f('0x2')},'password':{'type':Sequelize[_0x789f('0x1')]},'email':{'type':Sequelize[_0x789f('0x1')]},'remoteUri':{'type':Sequelize[_0x789f('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index c5ba516..764b7eb 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 _0x72a2=['username','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','includes','forEach','internalType','push','all','assign','TCL:\x20_object','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','inactive','label','value','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','ServicenowAccount','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','getConfigurations','findOne','ServicenowConfiguration','getSubjects','channel','getDescriptions','ServicenowField','Subjects','Descriptions','made_sla','hold_reason','knowledge','subcategory','notify','incident_state','severity','category','parent','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','rfc','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','short_description','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','password','email','remoteUri','serverUrl','substring','format','%s/api/now/table/'];(function(_0x46ac36,_0x2c68c6){var _0x3826b8=function(_0x4de4c8){while(--_0x4de4c8){_0x46ac36['push'](_0x46ac36['shift']());}};_0x3826b8(++_0x2c68c6);}(_0x72a2,0x195));var _0x272a=function(_0x594762,_0x166d0f){_0x594762=_0x594762-0x0;var _0x1e9670=_0x72a2[_0x594762];return _0x1e9670;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x272a('0x0'));var rp=require(_0x272a('0x1'));var moment=require(_0x272a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x272a('0x3'));var util=require(_0x272a('0x4'));var path=require(_0x272a('0x5'));var sox=require('sox');var csv=require(_0x272a('0x6'));var ejs=require(_0x272a('0x7'));var fs=require('fs');var fs_extra=require(_0x272a('0x8'));var _=require(_0x272a('0x9'));var squel=require(_0x272a('0xa'));var crypto=require('crypto');var jsforce=require(_0x272a('0xb'));var deskjs=require(_0x272a('0xc'));var toCsv=require(_0x272a('0x6'));var querystring=require(_0x272a('0xd'));var Papa=require('papaparse');var Redis=require(_0x272a('0xe'));var authService=require(_0x272a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x272a('0x10'));var hardwareService=require(_0x272a('0x11'));var logger=require(_0x272a('0x12'))(_0x272a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x272a('0x14'));var db=require(_0x272a('0x15'))['db'];var integrations=require(_0x272a('0x16'));function respondWithStatusCode(_0x1baab5,_0x52a1c7){_0x52a1c7=_0x52a1c7||0xcc;return function(_0x5aaa69){if(_0x5aaa69){return _0x1baab5[_0x272a('0x17')](_0x52a1c7);}return _0x1baab5[_0x272a('0x18')](_0x52a1c7)[_0x272a('0x19')]();};}function respondWithResult(_0x2c43c3,_0x3c9076){_0x3c9076=_0x3c9076||0xc8;return function(_0x557d39){if(_0x557d39){return _0x2c43c3[_0x272a('0x18')](_0x3c9076)['json'](_0x557d39);}};}function respondWithFilteredResult(_0x583290,_0x4788c1){return function(_0x242bd2){if(_0x242bd2){var _0x1154ff=typeof _0x4788c1[_0x272a('0x1a')]===_0x272a('0x1b')&&typeof _0x4788c1[_0x272a('0x1c')]===_0x272a('0x1b');var _0x1be459=_0x242bd2[_0x272a('0x1d')];var _0x2d6c96=_0x1154ff?0x0:_0x4788c1[_0x272a('0x1a')];var _0x12f159=_0x1154ff?_0x242bd2[_0x272a('0x1d')]:_0x4788c1[_0x272a('0x1a')]+_0x4788c1[_0x272a('0x1c')];var _0x4b3438;if(_0x12f159>=_0x1be459){_0x12f159=_0x1be459;_0x4b3438=0xc8;}else{_0x4b3438=0xce;}_0x583290[_0x272a('0x18')](_0x4b3438);return _0x583290[_0x272a('0x1e')]('Content-Range',_0x2d6c96+'-'+_0x12f159+'/'+_0x1be459)['json'](_0x242bd2);}return null;};}function patchUpdates(_0x4e5cdc){return function(_0x28f24e){try{jsonpatch[_0x272a('0x1f')](_0x28f24e,_0x4e5cdc,!![]);}catch(_0x49bf31){return BPromise[_0x272a('0x20')](_0x49bf31);}return _0x28f24e['save']();};}function saveUpdates(_0x55b881,_0x4ace82){return function(_0x3edc02){if(_0x3edc02){return _0x3edc02[_0x272a('0x21')](_0x55b881)[_0x272a('0x22')](function(_0x1b84a7){return _0x1b84a7;});}return null;};}function removeEntity(_0x593463,_0x3b0a6f){return function(_0x5446ab){if(_0x5446ab){return _0x5446ab[_0x272a('0x23')]()[_0x272a('0x22')](function(){_0x593463[_0x272a('0x18')](0xcc)[_0x272a('0x19')]();});}};}function handleEntityNotFound(_0x565ca7,_0x5eca10){return function(_0x30e72f){if(!_0x30e72f){_0x565ca7[_0x272a('0x17')](0x194);}return _0x30e72f;};}function handleError(_0x1d5b37,_0x5e2596){_0x5e2596=_0x5e2596||0x1f4;return function(_0x1c5237){logger[_0x272a('0x24')](_0x1c5237[_0x272a('0x25')]);if(_0x1c5237[_0x272a('0x26')]){delete _0x1c5237[_0x272a('0x26')];}_0x1d5b37['status'](_0x5e2596)[_0x272a('0x27')](_0x1c5237);};}exports[_0x272a('0x28')]=function(_0x4c779e,_0x35139b){var _0x42a111={},_0x26ece7={},_0x336a55={'count':0x0,'rows':[]};var _0x2c45c0=_[_0x272a('0x29')](db[_0x272a('0x2a')]['rawAttributes'],function(_0x550dca){return{'name':_0x550dca[_0x272a('0x2b')],'type':_0x550dca[_0x272a('0x2c')][_0x272a('0x2d')]};});_0x26ece7['model']=_['map'](_0x2c45c0,_0x272a('0x26'));_0x26ece7[_0x272a('0x2e')]=_[_0x272a('0x2f')](_0x4c779e['query']);_0x26ece7[_0x272a('0x30')]=_['intersection'](_0x26ece7[_0x272a('0x31')],_0x26ece7['query']);_0x42a111[_0x272a('0x32')]=_[_0x272a('0x33')](_0x26ece7[_0x272a('0x31')],qs[_0x272a('0x34')](_0x4c779e['query'][_0x272a('0x34')]));_0x42a111[_0x272a('0x32')]=_0x42a111[_0x272a('0x32')][_0x272a('0x35')]?_0x42a111[_0x272a('0x32')]:_0x26ece7[_0x272a('0x31')];if(!_0x4c779e['query'][_0x272a('0x36')](_0x272a('0x37'))){_0x42a111['limit']=qs[_0x272a('0x1c')](_0x4c779e[_0x272a('0x2e')][_0x272a('0x1c')]);_0x42a111[_0x272a('0x1a')]=qs[_0x272a('0x1a')](_0x4c779e[_0x272a('0x2e')][_0x272a('0x1a')]);}_0x42a111[_0x272a('0x38')]=qs[_0x272a('0x39')](_0x4c779e['query'][_0x272a('0x39')]);_0x42a111[_0x272a('0x3a')]=qs[_0x272a('0x30')](_[_0x272a('0x3b')](_0x4c779e[_0x272a('0x2e')],_0x26ece7[_0x272a('0x30')]),_0x2c45c0);if(_0x4c779e['query'][_0x272a('0x3c')]){_0x42a111[_0x272a('0x3a')]=_[_0x272a('0x3d')](_0x42a111['where'],{'$or':_['map'](_0x2c45c0,function(_0x1dbced){if(_0x1dbced['type']!==_0x272a('0x3e')){var _0x2cbac1={};_0x2cbac1[_0x1dbced[_0x272a('0x26')]]={'$like':'%'+_0x4c779e[_0x272a('0x2e')]['filter']+'%'};return _0x2cbac1;}})});}_0x42a111=_[_0x272a('0x3d')]({},_0x42a111,_0x4c779e[_0x272a('0x3f')]);var _0x4ccb0e={'where':_0x42a111[_0x272a('0x3a')]};return db['ServicenowAccount'][_0x272a('0x1d')](_0x4ccb0e)[_0x272a('0x22')](function(_0x5304ba){_0x336a55[_0x272a('0x1d')]=_0x5304ba;if(_0x4c779e[_0x272a('0x2e')][_0x272a('0x40')]){_0x42a111['include']=[{'all':!![]}];}return db[_0x272a('0x2a')][_0x272a('0x41')](_0x42a111);})[_0x272a('0x22')](function(_0x8c278){_0x336a55[_0x272a('0x42')]=_0x8c278;return _0x336a55;})[_0x272a('0x22')](respondWithFilteredResult(_0x35139b,_0x42a111))[_0x272a('0x43')](handleError(_0x35139b,null));};exports['show']=function(_0x2f0d95,_0x370416){var _0x1b6504={'raw':![],'where':{'id':_0x2f0d95[_0x272a('0x44')]['id']}},_0x1f03c3={};_0x1f03c3['model']=_[_0x272a('0x2f')](db[_0x272a('0x2a')][_0x272a('0x45')]);_0x1f03c3[_0x272a('0x2e')]=_[_0x272a('0x2f')](_0x2f0d95[_0x272a('0x2e')]);_0x1f03c3[_0x272a('0x30')]=_['intersection'](_0x1f03c3[_0x272a('0x31')],_0x1f03c3[_0x272a('0x2e')]);_0x1b6504[_0x272a('0x32')]=_[_0x272a('0x33')](_0x1f03c3[_0x272a('0x31')],qs[_0x272a('0x34')](_0x2f0d95[_0x272a('0x2e')][_0x272a('0x34')]));_0x1b6504['attributes']=_0x1b6504[_0x272a('0x32')][_0x272a('0x35')]?_0x1b6504['attributes']:_0x1f03c3['model'];if(_0x2f0d95[_0x272a('0x2e')][_0x272a('0x40')]){_0x1b6504[_0x272a('0x46')]=[{'all':!![]}];}_0x1b6504=_[_0x272a('0x3d')]({},_0x1b6504,_0x2f0d95[_0x272a('0x3f')]);return db['ServicenowAccount'][_0x272a('0x47')](_0x1b6504)[_0x272a('0x22')](handleEntityNotFound(_0x370416,null))['then'](respondWithResult(_0x370416,null))[_0x272a('0x43')](handleError(_0x370416,null));};exports[_0x272a('0x48')]=function(_0x3272a4,_0xed4b85){return db[_0x272a('0x2a')]['create'](_0x3272a4[_0x272a('0x49')],{})[_0x272a('0x22')](respondWithResult(_0xed4b85,0xc9))[_0x272a('0x43')](handleError(_0xed4b85,null));};exports['update']=function(_0x29293a,_0x30a6aa){if(_0x29293a[_0x272a('0x49')]['id']){delete _0x29293a[_0x272a('0x49')]['id'];}return db[_0x272a('0x2a')][_0x272a('0x47')]({'where':{'id':_0x29293a[_0x272a('0x44')]['id']}})[_0x272a('0x22')](handleEntityNotFound(_0x30a6aa,null))['then'](saveUpdates(_0x29293a[_0x272a('0x49')],null))[_0x272a('0x22')](respondWithResult(_0x30a6aa,null))[_0x272a('0x43')](handleError(_0x30a6aa,null));};exports[_0x272a('0x23')]=function(_0x2653d3,_0x3de26a){return db[_0x272a('0x2a')][_0x272a('0x47')]({'where':{'id':_0x2653d3[_0x272a('0x44')]['id']}})[_0x272a('0x22')](handleEntityNotFound(_0x3de26a,null))[_0x272a('0x22')](removeEntity(_0x3de26a,null))['catch'](handleError(_0x3de26a,null));};exports[_0x272a('0x4a')]=function(_0x109a4b,_0xbf3d94,_0x3bfa0f){var _0x4ff721={};var _0x220827={};var _0x2c8077;var _0x49fca8;return db[_0x272a('0x2a')][_0x272a('0x4b')]({'where':{'id':_0x109a4b['params']['id']}})[_0x272a('0x22')](handleEntityNotFound(_0xbf3d94,null))[_0x272a('0x22')](function(_0x7303ee){if(_0x7303ee){_0x2c8077=_0x7303ee;_0x220827[_0x272a('0x31')]=_['keys'](db[_0x272a('0x4c')][_0x272a('0x45')]);_0x220827[_0x272a('0x2e')]=_[_0x272a('0x2f')](_0x109a4b['query']);_0x220827[_0x272a('0x30')]=_[_0x272a('0x33')](_0x220827[_0x272a('0x31')],_0x220827['query']);_0x4ff721[_0x272a('0x32')]=_[_0x272a('0x33')](_0x220827[_0x272a('0x31')],qs[_0x272a('0x34')](_0x109a4b[_0x272a('0x2e')]['fields']));_0x4ff721[_0x272a('0x32')]=_0x4ff721[_0x272a('0x32')][_0x272a('0x35')]?_0x4ff721[_0x272a('0x32')]:_0x220827['model'];_0x4ff721['order']=qs['sort'](_0x109a4b[_0x272a('0x2e')][_0x272a('0x39')]);_0x4ff721['where']=qs[_0x272a('0x30')](_[_0x272a('0x3b')](_0x109a4b[_0x272a('0x2e')],_0x220827['filters']));if(_0x109a4b['query'][_0x272a('0x3c')]){_0x4ff721[_0x272a('0x3a')]=_['merge'](_0x4ff721[_0x272a('0x3a')],{'$or':_['map'](_0x4ff721[_0x272a('0x32')],function(_0x3e5082){var _0x435542={};_0x435542[_0x3e5082]={'$like':'%'+_0x109a4b['query'][_0x272a('0x3c')]+'%'};return _0x435542;})});}_0x4ff721=_[_0x272a('0x3d')]({},_0x4ff721,_0x109a4b[_0x272a('0x3f')]);return _0x2c8077[_0x272a('0x4a')](_0x4ff721);}})['then'](function(_0x3311ca){if(_0x3311ca){_0x49fca8=_0x3311ca[_0x272a('0x35')];if(!_0x109a4b[_0x272a('0x2e')][_0x272a('0x36')](_0x272a('0x37'))){_0x4ff721[_0x272a('0x1c')]=qs[_0x272a('0x1c')](_0x109a4b[_0x272a('0x2e')][_0x272a('0x1c')]);_0x4ff721['offset']=qs[_0x272a('0x1a')](_0x109a4b[_0x272a('0x2e')][_0x272a('0x1a')]);}return _0x2c8077['getConfigurations'](_0x4ff721);}})[_0x272a('0x22')](function(_0x16e3a8){if(_0x16e3a8){return _0x16e3a8?{'count':_0x49fca8,'rows':_0x16e3a8}:null;}})[_0x272a('0x22')](respondWithResult(_0xbf3d94,null))['catch'](handleError(_0xbf3d94,null));};exports['addConfiguration']=function(_0x239f48,_0x23e6f3,_0x3c6d3f){if(_0x239f48['body']['id']){delete _0x239f48[_0x272a('0x49')]['id'];}return db[_0x272a('0x2a')][_0x272a('0x4b')]({'where':{'id':_0x239f48['params']['id']}})[_0x272a('0x22')](handleEntityNotFound(_0x23e6f3,null))[_0x272a('0x22')](function(_0x34de5f){if(_0x34de5f){_0x239f48['body']['AccountId']=_0x34de5f['id'];_0x239f48['body']['Subjects']=integrations[_0x272a('0x4d')](_0x239f48['body'][_0x272a('0x4e')],_0x239f48['body'][_0x272a('0x2c')]);_0x239f48[_0x272a('0x49')]['Descriptions']=integrations[_0x272a('0x4f')](_0x239f48[_0x272a('0x49')][_0x272a('0x4e')],_0x239f48['body'][_0x272a('0x2c')]);return db['ServicenowConfiguration'][_0x272a('0x48')](_0x239f48[_0x272a('0x49')],{'include':[{'model':db[_0x272a('0x50')],'as':_0x272a('0x51')},{'model':db[_0x272a('0x50')],'as':_0x272a('0x52')}]});}return null;})[_0x272a('0x22')](respondWithResult(_0x23e6f3,null))[_0x272a('0x43')](handleError(_0x23e6f3,null));};exports['getFields']=function(_0x47a459,_0x225816,_0x4c9f87){var _0x220b51=[_0x272a('0x53'),_0x272a('0x54'),_0x272a('0x55'),_0x272a('0x56'),'close_code',_0x272a('0x57'),_0x272a('0x58'),_0x272a('0x59'),_0x272a('0x5a')];var _0x32c39b=[_0x272a('0x5b'),_0x272a('0x53'),'caused_by','watch_list',_0x272a('0x5c'),_0x272a('0x5d'),_0x272a('0x5e'),_0x272a('0x54'),_0x272a('0x5f'),_0x272a('0x60'),_0x272a('0x61'),_0x272a('0x62'),_0x272a('0x63'),_0x272a('0x64'),_0x272a('0x65'),_0x272a('0x66'),_0x272a('0x67'),_0x272a('0x68'),_0x272a('0x55'),_0x272a('0x38'),_0x272a('0x69'),_0x272a('0x6a'),_0x272a('0x6b'),_0x272a('0x6c'),'impact',_0x272a('0x6d'),_0x272a('0x6e'),_0x272a('0x6f'),_0x272a('0x70'),_0x272a('0x71'),_0x272a('0x72'),'time_worked',_0x272a('0x73'),_0x272a('0x74'),_0x272a('0x75'),_0x272a('0x76'),_0x272a('0x77'),_0x272a('0x78'),_0x272a('0x79'),_0x272a('0x7a'),'approval_set',_0x272a('0x56'),'work_notes',_0x272a('0x7b'),'close_code','correlation_display',_0x272a('0x7c'),_0x272a('0x7d'),'assignment_group',_0x272a('0x7e'),_0x272a('0x7f'),_0x272a('0x80'),_0x272a('0x81'),_0x272a('0x57'),_0x272a('0x82'),_0x272a('0x83'),_0x272a('0x84'),_0x272a('0x85'),_0x272a('0x86'),_0x272a('0x87'),_0x272a('0x88'),_0x272a('0x89'),'incident_state',_0x272a('0x8a'),_0x272a('0x8b'),_0x272a('0x8c'),_0x272a('0x8d'),_0x272a('0x8e'),_0x272a('0x8f'),'severity',_0x272a('0x90'),_0x272a('0x91'),_0x272a('0x92'),_0x272a('0x93'),_0x272a('0x94'),_0x272a('0x95'),_0x272a('0x96'),'sys_tags',_0x272a('0x97'),_0x272a('0x98'),_0x272a('0x99'),_0x272a('0x9a'),_0x272a('0x5a')];var _0x5a7996='';var _0x1d6e6e='';var _0x29e121=[];var _0x5638b4='';var _0x1b2bfa='';var _0xb0bb9d=[];var _0x560fc5='';var _0x34c65f='';var _0x3473ff={};var _0x2c25f2='';return db[_0x272a('0x2a')]['findOne']({'where':{'id':_0x47a459['params']['id']},'attributes':['id','username',_0x272a('0x9b'),_0x272a('0x9c'),_0x272a('0x9d'),_0x272a('0x9e')]})[_0x272a('0x22')](handleEntityNotFound(_0x225816,null))[_0x272a('0x22')](function(_0x125c2f){if(_0x125c2f){_0x2c25f2=_0x125c2f[_0x272a('0x9d')];var _0x5908bc=_0x2c25f2['slice'](-0x1);if(_0x5908bc==='/'){_0x2c25f2=_0x2c25f2[_0x272a('0x9f')](0x0,_0x2c25f2['lastIndexOf'](_0x5908bc));}_0x34c65f=util[_0x272a('0xa0')]('%s/api/now/doc/table/schema/',_0x2c25f2);_0x560fc5=util['format'](_0x272a('0xa1'),_0x2c25f2);_0x3473ff={'user':_0x125c2f[_0x272a('0xa2')],'pass':_0x125c2f['password']};var _0x3631d0={'method':_0x272a('0xa3'),'uri':_0x34c65f+_0x272a('0xa4'),'auth':_0x3473ff,'json':!![]};return rp(_0x3631d0);}})[_0x272a('0x22')](function(_0x3bcfa3){if(_0x3bcfa3[_0x272a('0xa5')][_0x272a('0x35')]>0x0){_0x5a7996=_0x3bcfa3[_0x272a('0xa5')];}console[_0x272a('0xa6')](_0x272a('0xa7'),_0x5a7996);_0xb0bb9d=[];_0x1d6e6e=Object['assign']([],_0x5a7996);_[_0x272a('0xa8')](_0x1d6e6e,function(_0x2a55fd){return!_0x220b51[_0x272a('0xa9')](_0x2a55fd[_0x272a('0x26')]);});_0x1d6e6e[_0x272a('0xaa')](function(_0x5159dd){var _0xa396ea=createFieldObject(_0x560fc5,_0x3473ff,_0x5159dd[_0x272a('0xab')],_0x5159dd['name'],_0x5159dd['label'],![]);_0xb0bb9d[_0x272a('0xac')](_0xa396ea);});return Promise[_0x272a('0xad')](_0xb0bb9d);})['then'](function(_0x27e0d2){_0x29e121=_0x27e0d2;_0x5638b4=Object[_0x272a('0xae')]([],_0x5a7996);console[_0x272a('0xa6')](_0x272a('0xaf'),_0x5a7996);_[_0x272a('0xa8')](_0x5638b4,function(_0x1dfb08){return _0x32c39b[_0x272a('0xa9')](_0x1dfb08[_0x272a('0x26')]);});console[_0x272a('0xa6')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x5638b4);_0xb0bb9d=[];_0x5638b4[_0x272a('0xaa')](function(_0x126702){var _0x31dc6b=createFieldObject(_0x560fc5,_0x3473ff,_0x126702[_0x272a('0xab')],_0x126702[_0x272a('0x26')],_0x126702['label'],!![]);_0xb0bb9d[_0x272a('0xac')](_0x31dc6b);});return Promise[_0x272a('0xad')](_0xb0bb9d);})['then'](function(_0x22ee3f){_0x1b2bfa=_0x22ee3f;var _0x11ca05=_0x29e121[_0x272a('0xb0')](_0x1b2bfa);return{'count':_0x11ca05[_0x272a('0x35')],'rows':_0x11ca05};})['then'](respondWithResult(_0x225816,null))[_0x272a('0x43')](function(_0x5e975b){console['log'](_0x272a('0xb1')+_0x5e975b);var _0x3ab2cb=_0x47a459[_0x272a('0x2e')][_0x272a('0xb2')]?0x1f4:_0x5e975b[_0x272a('0xb3')]||0x1f4;logger[_0x272a('0x24')](_0x5e975b['stack']);delete _0x5e975b[_0x272a('0x26')];if(_0x3ab2cb===0x191){_0x3ab2cb=0x190;}_0x225816[_0x272a('0x18')](_0x3ab2cb)[_0x272a('0x27')](_0x47a459[_0x272a('0x2e')][_0x272a('0xb2')]?{'message':_0x272a('0xb4'),'statusCode':_0x5e975b['statusCode']}:_0x5e975b);});};function createFieldObject(_0x4cdbef,_0x4c2aa8,_0x3ca2b2,_0x410d56,_0x46470f,_0x4fe585){return new Promise(function(_0x5702bd,_0x4ac7ad){var _0x5d7f66={'id':_0x410d56,'name':_0x46470f,'custom':_0x4fe585};if(_0x3ca2b2===_0x272a('0xb5')){_0x5d7f66[_0x272a('0x3f')]=[{'name':_0x272a('0xb6'),'value':_0x272a('0xb7')},{'name':_0x272a('0xb8'),'value':_0x272a('0xb9')}];_0x5702bd(_0x5d7f66);}else{var _0x1fbdf9={'method':_0x272a('0xa3'),'uri':_0x4cdbef+'sys_choice?sysparm_query=name=incident^element='+_0x410d56,'auth':_0x4c2aa8,'json':!![]};return rp(_0x1fbdf9)[_0x272a('0x22')](function(_0x316e53){var _0x121412=[];if(_0x316e53[_0x272a('0xa5')][_0x272a('0x35')]>0x0){_0x316e53[_0x272a('0xa5')][_0x272a('0xaa')](function(_0x5e9fb8){if(_0x5e9fb8[_0x272a('0xba')]===_0x272a('0xb9')){var _0x322e93={'name':_0x5e9fb8[_0x272a('0xbb')],'value':_0x5e9fb8[_0x272a('0xbc')]};_0x121412[_0x272a('0xac')](_0x322e93);}});}_0x5d7f66[_0x272a('0x3f')]=_0x121412;if(_0x5d7f66[_0x272a('0x3f')][_0x272a('0x35')]>0x0){_0x5702bd(_0x5d7f66);}else{if(_0x4fe585==![]){_0x5702bd();}else{_0x5702bd(_0x5d7f66);}}});}});} \ No newline at end of file +var _0x29c7=['getConfigurations','findOne','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','group_list','work_end','reopened_time','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','follow_up','contact_type','reopened_by','problem_id','reassignment_count','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','password','email','remoteUri','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','remove','includes','internalType','push','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','ServiceNow\x20error:\x20','test','send','Wrong\x20credentials','statusCode','boolean','True','False','sys_choice?sysparm_query=name=incident^element=','forEach','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','ServicenowAccount','type','key','model','query','filters','intersection','fields','attributes','length','limit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','create','body'];(function(_0x444432,_0x8279f7){var _0x4bacbb=function(_0x2e5c0e){while(--_0x2e5c0e){_0x444432['push'](_0x444432['shift']());}};_0x4bacbb(++_0x8279f7);}(_0x29c7,0x1ee));var _0x729c=function(_0x32d233,_0x3348ba){_0x32d233=_0x32d233-0x0;var _0x3afc58=_0x29c7[_0x32d233];return _0x3afc58;};'use strict';var emlformat=require(_0x729c('0x0'));var rimraf=require(_0x729c('0x1'));var zipdir=require(_0x729c('0x2'));var jsonpatch=require(_0x729c('0x3'));var rp=require(_0x729c('0x4'));var moment=require(_0x729c('0x5'));var BPromise=require(_0x729c('0x6'));var Mustache=require(_0x729c('0x7'));var util=require(_0x729c('0x8'));var path=require(_0x729c('0x9'));var sox=require(_0x729c('0xa'));var csv=require(_0x729c('0xb'));var ejs=require(_0x729c('0xc'));var fs=require('fs');var fs_extra=require(_0x729c('0xd'));var _=require(_0x729c('0xe'));var squel=require(_0x729c('0xf'));var crypto=require(_0x729c('0x10'));var jsforce=require(_0x729c('0x11'));var deskjs=require(_0x729c('0x12'));var toCsv=require(_0x729c('0xb'));var querystring=require('querystring');var Papa=require(_0x729c('0x13'));var Redis=require(_0x729c('0x14'));var authService=require(_0x729c('0x15'));var qs=require(_0x729c('0x16'));var as=require(_0x729c('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x729c('0x18'));var utils=require(_0x729c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x729c('0x1a'));var db=require(_0x729c('0x1b'))['db'];var integrations=require(_0x729c('0x1c'));function respondWithStatusCode(_0x24f238,_0x25305b){_0x25305b=_0x25305b||0xcc;return function(_0x667eaa){if(_0x667eaa){return _0x24f238[_0x729c('0x1d')](_0x25305b);}return _0x24f238[_0x729c('0x1e')](_0x25305b)[_0x729c('0x1f')]();};}function respondWithResult(_0x3f442f,_0x326274){_0x326274=_0x326274||0xc8;return function(_0x3d879f){if(_0x3d879f){return _0x3f442f['status'](_0x326274)[_0x729c('0x20')](_0x3d879f);}};}function respondWithFilteredResult(_0x127b73,_0x34da91){return function(_0x20fd35){if(_0x20fd35){var _0x419df7=typeof _0x34da91[_0x729c('0x21')]===_0x729c('0x22')&&typeof _0x34da91['limit']==='undefined';var _0x35f94e=_0x20fd35[_0x729c('0x23')];var _0x2d338e=_0x419df7?0x0:_0x34da91[_0x729c('0x21')];var _0x1ca2b2=_0x419df7?_0x20fd35[_0x729c('0x23')]:_0x34da91[_0x729c('0x21')]+_0x34da91['limit'];var _0x5589d6;if(_0x1ca2b2>=_0x35f94e){_0x1ca2b2=_0x35f94e;_0x5589d6=0xc8;}else{_0x5589d6=0xce;}_0x127b73['status'](_0x5589d6);return _0x127b73['set'](_0x729c('0x24'),_0x2d338e+'-'+_0x1ca2b2+'/'+_0x35f94e)[_0x729c('0x20')](_0x20fd35);}return null;};}function patchUpdates(_0x26e8b1){return function(_0x2abb48){try{jsonpatch[_0x729c('0x25')](_0x2abb48,_0x26e8b1,!![]);}catch(_0x46c3fd){return BPromise[_0x729c('0x26')](_0x46c3fd);}return _0x2abb48[_0x729c('0x27')]();};}function saveUpdates(_0x31d314,_0x20bcb6){return function(_0x88c196){if(_0x88c196){return _0x88c196[_0x729c('0x28')](_0x31d314)['then'](function(_0x5d056f){return _0x5d056f;});}return null;};}function removeEntity(_0x383ad2,_0x201087){return function(_0x5ac2d1){if(_0x5ac2d1){return _0x5ac2d1[_0x729c('0x29')]()[_0x729c('0x2a')](function(){_0x383ad2[_0x729c('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x525997,_0x3e23e5){return function(_0x32192e){if(!_0x32192e){_0x525997[_0x729c('0x1d')](0x194);}return _0x32192e;};}function handleError(_0x4f1ebb,_0x1a736b){_0x1a736b=_0x1a736b||0x1f4;return function(_0x58de39){logger[_0x729c('0x2b')](_0x58de39[_0x729c('0x2c')]);if(_0x58de39[_0x729c('0x2d')]){delete _0x58de39[_0x729c('0x2d')];}_0x4f1ebb[_0x729c('0x1e')](_0x1a736b)['send'](_0x58de39);};}exports[_0x729c('0x2e')]=function(_0x31800f,_0x201da1){var _0x329578={},_0x1edb22={},_0x438fbd={'count':0x0,'rows':[]};var _0x35c6ef=_[_0x729c('0x2f')](db[_0x729c('0x30')]['rawAttributes'],function(_0x48cf6d){return{'name':_0x48cf6d['fieldName'],'type':_0x48cf6d[_0x729c('0x31')][_0x729c('0x32')]};});_0x1edb22[_0x729c('0x33')]=_[_0x729c('0x2f')](_0x35c6ef,'name');_0x1edb22['query']=_['keys'](_0x31800f[_0x729c('0x34')]);_0x1edb22[_0x729c('0x35')]=_[_0x729c('0x36')](_0x1edb22['model'],_0x1edb22[_0x729c('0x34')]);_0x329578['attributes']=_[_0x729c('0x36')](_0x1edb22['model'],qs[_0x729c('0x37')](_0x31800f[_0x729c('0x34')][_0x729c('0x37')]));_0x329578[_0x729c('0x38')]=_0x329578[_0x729c('0x38')][_0x729c('0x39')]?_0x329578['attributes']:_0x1edb22[_0x729c('0x33')];if(!_0x31800f[_0x729c('0x34')]['hasOwnProperty']('nolimit')){_0x329578['limit']=qs[_0x729c('0x3a')](_0x31800f[_0x729c('0x34')][_0x729c('0x3a')]);_0x329578[_0x729c('0x21')]=qs['offset'](_0x31800f[_0x729c('0x34')][_0x729c('0x21')]);}_0x329578[_0x729c('0x3b')]=qs[_0x729c('0x3c')](_0x31800f[_0x729c('0x34')][_0x729c('0x3c')]);_0x329578[_0x729c('0x3d')]=qs[_0x729c('0x35')](_['pick'](_0x31800f[_0x729c('0x34')],_0x1edb22[_0x729c('0x35')]),_0x35c6ef);if(_0x31800f[_0x729c('0x34')][_0x729c('0x3e')]){_0x329578['where']=_[_0x729c('0x3f')](_0x329578[_0x729c('0x3d')],{'$or':_[_0x729c('0x2f')](_0x35c6ef,function(_0x139cbe){if(_0x139cbe[_0x729c('0x31')]!=='VIRTUAL'){var _0x30c76f={};_0x30c76f[_0x139cbe['name']]={'$like':'%'+_0x31800f[_0x729c('0x34')][_0x729c('0x3e')]+'%'};return _0x30c76f;}})});}_0x329578=_[_0x729c('0x3f')]({},_0x329578,_0x31800f[_0x729c('0x40')]);var _0x536138={'where':_0x329578[_0x729c('0x3d')]};return db['ServicenowAccount'][_0x729c('0x23')](_0x536138)[_0x729c('0x2a')](function(_0x576356){_0x438fbd[_0x729c('0x23')]=_0x576356;if(_0x31800f[_0x729c('0x34')][_0x729c('0x41')]){_0x329578[_0x729c('0x42')]=[{'all':!![]}];}return db[_0x729c('0x30')][_0x729c('0x43')](_0x329578);})['then'](function(_0x5ac5ca){_0x438fbd[_0x729c('0x44')]=_0x5ac5ca;return _0x438fbd;})[_0x729c('0x2a')](respondWithFilteredResult(_0x201da1,_0x329578))[_0x729c('0x45')](handleError(_0x201da1,null));};exports['show']=function(_0x33c362,_0xe59a35){var _0x3f953c={'raw':![],'where':{'id':_0x33c362[_0x729c('0x46')]['id']}},_0x4a3b29={};_0x4a3b29['model']=_[_0x729c('0x47')](db[_0x729c('0x30')][_0x729c('0x48')]);_0x4a3b29[_0x729c('0x34')]=_[_0x729c('0x47')](_0x33c362[_0x729c('0x34')]);_0x4a3b29[_0x729c('0x35')]=_[_0x729c('0x36')](_0x4a3b29[_0x729c('0x33')],_0x4a3b29[_0x729c('0x34')]);_0x3f953c[_0x729c('0x38')]=_[_0x729c('0x36')](_0x4a3b29['model'],qs[_0x729c('0x37')](_0x33c362['query']['fields']));_0x3f953c[_0x729c('0x38')]=_0x3f953c[_0x729c('0x38')][_0x729c('0x39')]?_0x3f953c[_0x729c('0x38')]:_0x4a3b29['model'];if(_0x33c362['query'][_0x729c('0x41')]){_0x3f953c[_0x729c('0x42')]=[{'all':!![]}];}_0x3f953c=_[_0x729c('0x3f')]({},_0x3f953c,_0x33c362[_0x729c('0x40')]);return db[_0x729c('0x30')][_0x729c('0x49')](_0x3f953c)[_0x729c('0x2a')](handleEntityNotFound(_0xe59a35,null))['then'](respondWithResult(_0xe59a35,null))['catch'](handleError(_0xe59a35,null));};exports[_0x729c('0x4a')]=function(_0x4d1233,_0xade872){return db[_0x729c('0x30')][_0x729c('0x4a')](_0x4d1233[_0x729c('0x4b')],{})[_0x729c('0x2a')](respondWithResult(_0xade872,0xc9))[_0x729c('0x45')](handleError(_0xade872,null));};exports['update']=function(_0x3a157a,_0x540976){if(_0x3a157a[_0x729c('0x4b')]['id']){delete _0x3a157a[_0x729c('0x4b')]['id'];}return db[_0x729c('0x30')]['find']({'where':{'id':_0x3a157a['params']['id']}})['then'](handleEntityNotFound(_0x540976,null))[_0x729c('0x2a')](saveUpdates(_0x3a157a[_0x729c('0x4b')],null))[_0x729c('0x2a')](respondWithResult(_0x540976,null))[_0x729c('0x45')](handleError(_0x540976,null));};exports[_0x729c('0x29')]=function(_0x8168b,_0xf822ad){return db[_0x729c('0x30')]['find']({'where':{'id':_0x8168b['params']['id']}})['then'](handleEntityNotFound(_0xf822ad,null))[_0x729c('0x2a')](removeEntity(_0xf822ad,null))['catch'](handleError(_0xf822ad,null));};exports[_0x729c('0x4c')]=function(_0x497389,_0x5b6f1e,_0x438f9a){var _0xc538f9={};var _0x987adb={};var _0x42c18c;var _0x2d0f5c;return db[_0x729c('0x30')][_0x729c('0x4d')]({'where':{'id':_0x497389['params']['id']}})[_0x729c('0x2a')](handleEntityNotFound(_0x5b6f1e,null))[_0x729c('0x2a')](function(_0xa8c3e8){if(_0xa8c3e8){_0x42c18c=_0xa8c3e8;_0x987adb[_0x729c('0x33')]=_[_0x729c('0x47')](db['ServicenowConfiguration'][_0x729c('0x48')]);_0x987adb['query']=_['keys'](_0x497389['query']);_0x987adb[_0x729c('0x35')]=_[_0x729c('0x36')](_0x987adb[_0x729c('0x33')],_0x987adb[_0x729c('0x34')]);_0xc538f9['attributes']=_[_0x729c('0x36')](_0x987adb[_0x729c('0x33')],qs[_0x729c('0x37')](_0x497389[_0x729c('0x34')][_0x729c('0x37')]));_0xc538f9['attributes']=_0xc538f9['attributes'][_0x729c('0x39')]?_0xc538f9[_0x729c('0x38')]:_0x987adb[_0x729c('0x33')];_0xc538f9[_0x729c('0x3b')]=qs[_0x729c('0x3c')](_0x497389[_0x729c('0x34')][_0x729c('0x3c')]);_0xc538f9[_0x729c('0x3d')]=qs[_0x729c('0x35')](_[_0x729c('0x4e')](_0x497389[_0x729c('0x34')],_0x987adb['filters']));if(_0x497389[_0x729c('0x34')][_0x729c('0x3e')]){_0xc538f9['where']=_[_0x729c('0x3f')](_0xc538f9[_0x729c('0x3d')],{'$or':_[_0x729c('0x2f')](_0xc538f9[_0x729c('0x38')],function(_0x1dc57a){var _0xb06c14={};_0xb06c14[_0x1dc57a]={'$like':'%'+_0x497389['query'][_0x729c('0x3e')]+'%'};return _0xb06c14;})});}_0xc538f9=_[_0x729c('0x3f')]({},_0xc538f9,_0x497389['options']);return _0x42c18c[_0x729c('0x4c')](_0xc538f9);}})[_0x729c('0x2a')](function(_0x1e1ad9){if(_0x1e1ad9){_0x2d0f5c=_0x1e1ad9[_0x729c('0x39')];if(!_0x497389[_0x729c('0x34')]['hasOwnProperty'](_0x729c('0x4f'))){_0xc538f9[_0x729c('0x3a')]=qs['limit'](_0x497389[_0x729c('0x34')][_0x729c('0x3a')]);_0xc538f9[_0x729c('0x21')]=qs[_0x729c('0x21')](_0x497389[_0x729c('0x34')][_0x729c('0x21')]);}return _0x42c18c[_0x729c('0x4c')](_0xc538f9);}})[_0x729c('0x2a')](function(_0x33166e){if(_0x33166e){return _0x33166e?{'count':_0x2d0f5c,'rows':_0x33166e}:null;}})[_0x729c('0x2a')](respondWithResult(_0x5b6f1e,null))['catch'](handleError(_0x5b6f1e,null));};exports[_0x729c('0x50')]=function(_0x1480f6,_0x4981ff,_0x5f602a){if(_0x1480f6['body']['id']){delete _0x1480f6[_0x729c('0x4b')]['id'];}return db[_0x729c('0x30')][_0x729c('0x4d')]({'where':{'id':_0x1480f6[_0x729c('0x46')]['id']}})['then'](handleEntityNotFound(_0x4981ff,null))[_0x729c('0x2a')](function(_0xeefd24){if(_0xeefd24){_0x1480f6[_0x729c('0x4b')][_0x729c('0x51')]=_0xeefd24['id'];_0x1480f6['body'][_0x729c('0x52')]=integrations[_0x729c('0x53')](_0x1480f6[_0x729c('0x4b')][_0x729c('0x54')],_0x1480f6['body']['type']);_0x1480f6[_0x729c('0x4b')][_0x729c('0x55')]=integrations[_0x729c('0x56')](_0x1480f6[_0x729c('0x4b')][_0x729c('0x54')],_0x1480f6['body'][_0x729c('0x31')]);return db[_0x729c('0x57')][_0x729c('0x4a')](_0x1480f6['body'],{'include':[{'model':db[_0x729c('0x58')],'as':_0x729c('0x52')},{'model':db[_0x729c('0x58')],'as':_0x729c('0x55')}]});}return null;})[_0x729c('0x2a')](respondWithResult(_0x4981ff,null))[_0x729c('0x45')](handleError(_0x4981ff,null));};exports[_0x729c('0x59')]=function(_0x559f87,_0x21a6e1,_0x4101a6){var _0x4f09b5=[_0x729c('0x5a'),_0x729c('0x5b'),_0x729c('0x5c'),_0x729c('0x5d'),_0x729c('0x5e'),_0x729c('0x5f'),_0x729c('0x60'),_0x729c('0x61'),_0x729c('0x62')];var _0x5e3142=[_0x729c('0x63'),_0x729c('0x5a'),_0x729c('0x64'),_0x729c('0x65'),_0x729c('0x66'),'sys_updated_on',_0x729c('0x67'),'hold_reason',_0x729c('0x68'),_0x729c('0x69'),_0x729c('0x6a'),_0x729c('0x6b'),_0x729c('0x6c'),'user_input',_0x729c('0x6d'),_0x729c('0x6e'),_0x729c('0x6f'),_0x729c('0x70'),_0x729c('0x5c'),'order',_0x729c('0x71'),_0x729c('0x72'),_0x729c('0x73'),_0x729c('0x74'),'impact',_0x729c('0x75'),_0x729c('0x76'),_0x729c('0x77'),_0x729c('0x78'),_0x729c('0x79'),'rfc',_0x729c('0x7a'),'expected_start','opened_at','business_duration',_0x729c('0x7b'),_0x729c('0x7c'),_0x729c('0x7d'),'resolved_at','caller_id',_0x729c('0x7e'),_0x729c('0x5d'),_0x729c('0x7f'),_0x729c('0x80'),_0x729c('0x5e'),_0x729c('0x81'),_0x729c('0x82'),_0x729c('0x83'),_0x729c('0x84'),'business_stc',_0x729c('0x85'),_0x729c('0x86'),_0x729c('0x87'),_0x729c('0x5f'),_0x729c('0x88'),'close_notes','closed_by',_0x729c('0x89'),'parent_incident','sys_id',_0x729c('0x8a'),_0x729c('0x8b'),_0x729c('0x60'),'urgency',_0x729c('0x8c'),'company',_0x729c('0x8d'),_0x729c('0x8e'),_0x729c('0x8f'),'severity','comments',_0x729c('0x90'),_0x729c('0x91'),_0x729c('0x92'),_0x729c('0x93'),_0x729c('0x94'),_0x729c('0x95'),_0x729c('0x96'),_0x729c('0x97'),'upon_approval',_0x729c('0x98'),_0x729c('0x99'),_0x729c('0x62')];var _0x360e0f='';var _0x37457d='';var _0x1e6075=[];var _0x52127d='';var _0x2981dc='';var _0x111505=[];var _0x305803='';var _0x55de78='';var _0x1d8a04={};var _0x2fd609='';return db['ServicenowAccount'][_0x729c('0x4d')]({'where':{'id':_0x559f87[_0x729c('0x46')]['id']},'attributes':['id','username',_0x729c('0x9a'),_0x729c('0x9b'),_0x729c('0x9c'),_0x729c('0x9d')]})[_0x729c('0x2a')](handleEntityNotFound(_0x21a6e1,null))[_0x729c('0x2a')](function(_0x617a3){if(_0x617a3){_0x2fd609=_0x617a3[_0x729c('0x9c')];var _0xa515c3=_0x2fd609[_0x729c('0x9e')](-0x1);if(_0xa515c3==='/'){_0x2fd609=_0x2fd609[_0x729c('0x9f')](0x0,_0x2fd609['lastIndexOf'](_0xa515c3));}_0x55de78=util[_0x729c('0xa0')](_0x729c('0xa1'),_0x2fd609);_0x305803=util[_0x729c('0xa0')](_0x729c('0xa2'),_0x2fd609);_0x1d8a04={'user':_0x617a3[_0x729c('0xa3')],'pass':_0x617a3[_0x729c('0x9a')]};var _0x7fb23b={'method':_0x729c('0xa4'),'uri':_0x55de78+_0x729c('0xa5'),'auth':_0x1d8a04,'json':!![]};return rp(_0x7fb23b);}})[_0x729c('0x2a')](function(_0x25d6d4){if(_0x25d6d4[_0x729c('0xa6')][_0x729c('0x39')]>0x0){_0x360e0f=_0x25d6d4[_0x729c('0xa6')];}console[_0x729c('0xa7')]('incident\x20table\x20objects',_0x360e0f);_0x111505=[];_0x37457d=Object['assign']([],_0x360e0f);_[_0x729c('0xa8')](_0x37457d,function(_0x18e540){return!_0x4f09b5[_0x729c('0xa9')](_0x18e540[_0x729c('0x2d')]);});_0x37457d['forEach'](function(_0x4b2dcd){var _0x3d703f=createFieldObject(_0x305803,_0x1d8a04,_0x4b2dcd[_0x729c('0xaa')],_0x4b2dcd[_0x729c('0x2d')],_0x4b2dcd['label'],![]);_0x111505[_0x729c('0xab')](_0x3d703f);});return Promise[_0x729c('0xac')](_0x111505);})[_0x729c('0x2a')](function(_0x2df819){_0x1e6075=_0x2df819;_0x52127d=Object[_0x729c('0xad')]([],_0x360e0f);console[_0x729c('0xa7')](_0x729c('0xae'),_0x360e0f);_[_0x729c('0xa8')](_0x52127d,function(_0x51401e){return _0x5e3142[_0x729c('0xa9')](_0x51401e[_0x729c('0x2d')]);});console[_0x729c('0xa7')](_0x729c('0xaf'),_0x52127d);_0x111505=[];_0x52127d['forEach'](function(_0x2aad47){var _0x35bc9d=createFieldObject(_0x305803,_0x1d8a04,_0x2aad47['internalType'],_0x2aad47['name'],_0x2aad47[_0x729c('0xb0')],!![]);_0x111505[_0x729c('0xab')](_0x35bc9d);});return Promise[_0x729c('0xac')](_0x111505);})['then'](function(_0x35fc43){_0x2981dc=_0x35fc43;var _0x3b0356=_0x1e6075[_0x729c('0xb1')](_0x2981dc);return{'count':_0x3b0356['length'],'rows':_0x3b0356};})[_0x729c('0x2a')](respondWithResult(_0x21a6e1,null))[_0x729c('0x45')](function(_0x224490){console[_0x729c('0xa7')](_0x729c('0xb2')+_0x224490);var _0x4c5235=_0x559f87[_0x729c('0x34')][_0x729c('0xb3')]?0x1f4:_0x224490['statusCode']||0x1f4;logger['error'](_0x224490[_0x729c('0x2c')]);delete _0x224490[_0x729c('0x2d')];if(_0x4c5235===0x191){_0x4c5235=0x190;}_0x21a6e1[_0x729c('0x1e')](_0x4c5235)[_0x729c('0xb4')](_0x559f87['query']['test']?{'message':_0x729c('0xb5'),'statusCode':_0x224490[_0x729c('0xb6')]}:_0x224490);});};function createFieldObject(_0x811215,_0x1b62ba,_0x1d2a25,_0x81be10,_0xb6c4ae,_0x3eb295){return new Promise(function(_0x10b9b9,_0x63d5da){var _0x817fc0={'id':_0x81be10,'name':_0xb6c4ae,'custom':_0x3eb295};if(_0x1d2a25===_0x729c('0xb7')){_0x817fc0['options']=[{'name':_0x729c('0xb8'),'value':'true'},{'name':_0x729c('0xb9'),'value':'false'}];_0x10b9b9(_0x817fc0);}else{var _0x289aee={'method':_0x729c('0xa4'),'uri':_0x811215+_0x729c('0xba')+_0x81be10,'auth':_0x1b62ba,'json':!![]};return rp(_0x289aee)[_0x729c('0x2a')](function(_0x5093f5){var _0x46a577=[];if(_0x5093f5[_0x729c('0xa6')][_0x729c('0x39')]>0x0){_0x5093f5[_0x729c('0xa6')][_0x729c('0xbb')](function(_0x1c2c55){if(_0x1c2c55[_0x729c('0xbc')]==='false'){var _0x10b49d={'name':_0x1c2c55[_0x729c('0xb0')],'value':_0x1c2c55[_0x729c('0xbd')]};_0x46a577[_0x729c('0xab')](_0x10b49d);}});}_0x817fc0[_0x729c('0x40')]=_0x46a577;if(_0x817fc0['options'][_0x729c('0x39')]>0x0){_0x10b9b9(_0x817fc0);}else{if(_0x3eb295==![]){_0x10b9b9();}else{_0x10b9b9(_0x817fc0);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 43acb05..03da060 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 _0x90b1=['define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x90b1,0x1bb));var _0x190b=function(_0x10865b,_0x252f1b){_0x10865b=_0x10865b-0x0;var _0x157426=_0x90b1[_0x10865b];return _0x157426;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x27ff8c,_0x34a689){return _0x27ff8c[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xc4aa[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));var integrations=require(_0xac4a('0x8'));module[_0xac4a('0x9')]=function(_0x96be2b,_0x15cd34){return _0x96be2b[_0xac4a('0xa')](_0xac4a('0xb'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index dbff268..dee89cc 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 _0x35d2=['map','then','where','ShowServicenowAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','include','model'];(function(_0x1d236b,_0x250fba){var _0x4d6a06=function(_0x1d4cd1){while(--_0x1d4cd1){_0x1d236b['push'](_0x1d236b['shift']());}};_0x4d6a06(++_0x250fba);}(_0x35d2,0x1e0));var _0x235d=function(_0x24d764,_0x4fb195){_0x24d764=_0x24d764-0x0;var _0x4c5e51=_0x35d2[_0x24d764];return _0x4c5e51;};'use strict';var _=require(_0x235d('0x0'));var util=require(_0x235d('0x1'));var moment=require(_0x235d('0x2'));var BPromise=require('bluebird');var rs=require(_0x235d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x235d('0x4'))['db'];var utils=require(_0x235d('0x5'));var logger=require(_0x235d('0x6'))(_0x235d('0x7'));var config=require(_0x235d('0x8'));var jayson=require(_0x235d('0x9'));var client=jayson[_0x235d('0xa')][_0x235d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9302,_0x41eddd,_0x287143){return new BPromise(function(_0x43dc71,_0x3754ba){return client[_0x235d('0xc')](_0x3f9302,_0x287143)['then'](function(_0x3a98ea){logger[_0x235d('0xd')](_0x235d('0xe'),_0x41eddd,_0x235d('0xf'));logger[_0x235d('0x10')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x41eddd,_0x235d('0xf'),JSON[_0x235d('0x11')](_0x3a98ea));if(_0x3a98ea[_0x235d('0x12')]){if(_0x3a98ea[_0x235d('0x12')][_0x235d('0x13')]===0x1f4){logger[_0x235d('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x41eddd,_0x3a98ea['error']['message']);return _0x3754ba(_0x3a98ea[_0x235d('0x12')][_0x235d('0x14')]);}logger[_0x235d('0x12')](_0x235d('0xe'),_0x41eddd,_0x3a98ea[_0x235d('0x12')][_0x235d('0x14')]);return _0x43dc71(_0x3a98ea[_0x235d('0x12')][_0x235d('0x14')]);}else{logger[_0x235d('0xd')](_0x235d('0xe'),_0x41eddd,_0x235d('0xf'));_0x43dc71(_0x3a98ea['result'][_0x235d('0x14')]);}})[_0x235d('0x15')](function(_0x4429f1){logger['error'](_0x235d('0xe'),_0x41eddd,_0x4429f1);_0x3754ba(_0x4429f1);});});}exports[_0x235d('0x16')]=function(_0x127f48){var _0x44a5c0=this;return new Promise(function(_0x3c30c7,_0x32a4f4){return db[_0x235d('0x17')][_0x235d('0x18')]({'raw':_0x127f48[_0x235d('0x19')]?_0x127f48[_0x235d('0x19')][_0x235d('0x1a')]===undefined?!![]:![]:!![],'where':_0x127f48[_0x235d('0x19')]?_0x127f48[_0x235d('0x19')]['where']||null:null,'attributes':_0x127f48[_0x235d('0x19')]?_0x127f48[_0x235d('0x19')][_0x235d('0x1b')]||null:null,'limit':_0x127f48['options']?_0x127f48[_0x235d('0x19')]['limit']||null:null,'include':_0x127f48[_0x235d('0x19')]?_0x127f48[_0x235d('0x19')]['include']?_['map'](_0x127f48[_0x235d('0x19')][_0x235d('0x1c')],function(_0x124cb9){return{'model':db[_0x124cb9[_0x235d('0x1d')]],'as':_0x124cb9['as'],'attributes':_0x124cb9[_0x235d('0x1b')],'include':_0x124cb9[_0x235d('0x1c')]?_[_0x235d('0x1e')](_0x124cb9[_0x235d('0x1c')],function(_0x54499d){return{'model':db[_0x54499d[_0x235d('0x1d')]],'as':_0x54499d['as'],'attributes':_0x54499d['attributes'],'include':_0x54499d[_0x235d('0x1c')]?_[_0x235d('0x1e')](_0x54499d[_0x235d('0x1c')],function(_0x5d5af7){return{'model':db[_0x5d5af7[_0x235d('0x1d')]],'as':_0x5d5af7['as'],'attributes':_0x5d5af7[_0x235d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x235d('0x1f')](function(_0x7cf3cc){logger['info']('GetServicenowAccount',_0x127f48);logger['debug'](_0x235d('0x16'),_0x127f48,JSON[_0x235d('0x11')](_0x7cf3cc));_0x3c30c7(_0x7cf3cc);})[_0x235d('0x15')](function(_0xab763e){logger[_0x235d('0x12')]('GetServicenowAccount',_0xab763e[_0x235d('0x14')],_0x127f48);_0x32a4f4(_0x44a5c0['error'](0x1f4,_0xab763e['message']));});});};exports['ShowServicenowAccount']=function(_0x2d2b45){var _0x367894=this;return new Promise(function(_0xb0bdb0,_0x4d91b8){return db[_0x235d('0x17')]['find']({'raw':_0x2d2b45[_0x235d('0x19')]?_0x2d2b45[_0x235d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2d2b45[_0x235d('0x19')]?_0x2d2b45[_0x235d('0x19')][_0x235d('0x20')]||null:null,'attributes':_0x2d2b45['options']?_0x2d2b45[_0x235d('0x19')][_0x235d('0x1b')]||null:null,'include':_0x2d2b45['options']?_0x2d2b45[_0x235d('0x19')]['include']?_['map'](_0x2d2b45['options'][_0x235d('0x1c')],function(_0x269e4a){return{'model':db[_0x269e4a['model']],'as':_0x269e4a['as'],'attributes':_0x269e4a[_0x235d('0x1b')],'include':_0x269e4a[_0x235d('0x1c')]?_['map'](_0x269e4a[_0x235d('0x1c')],function(_0x25f351){return{'model':db[_0x25f351[_0x235d('0x1d')]],'as':_0x25f351['as'],'attributes':_0x25f351['attributes'],'include':_0x25f351[_0x235d('0x1c')]?_[_0x235d('0x1e')](_0x25f351[_0x235d('0x1c')],function(_0x68e483){return{'model':db[_0x68e483[_0x235d('0x1d')]],'as':_0x68e483['as'],'attributes':_0x68e483[_0x235d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x293c9f){logger[_0x235d('0xd')](_0x235d('0x21'),_0x2d2b45);logger[_0x235d('0x10')](_0x235d('0x21'),_0x2d2b45,JSON[_0x235d('0x11')](_0x293c9f));_0xb0bdb0(_0x293c9f);})[_0x235d('0x15')](function(_0x381cd7){logger[_0x235d('0x12')]('ShowServicenowAccount',_0x381cd7['message'],_0x2d2b45);_0x4d91b8(_0x367894[_0x235d('0x12')](0x1f4,_0x381cd7[_0x235d('0x14')]));});});}; \ No newline at end of file +var _0x368d=['map','ShowServicenowAccount','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','ServicenowAccount','options','where','limit','include','model','attributes'];(function(_0x39e374,_0x3c8ea3){var _0x153283=function(_0x587aeb){while(--_0x587aeb){_0x39e374['push'](_0x39e374['shift']());}};_0x153283(++_0x3c8ea3);}(_0x368d,0xf1));var _0xd368=function(_0x5081bc,_0x242a1a){_0x5081bc=_0x5081bc-0x0;var _0x2fe221=_0x368d[_0x5081bc];return _0x2fe221;};'use strict';var _=require('lodash');var util=require(_0xd368('0x0'));var moment=require(_0xd368('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd368('0x2'))['db'];var utils=require(_0xd368('0x3'));var logger=require(_0xd368('0x4'))(_0xd368('0x5'));var config=require(_0xd368('0x6'));var jayson=require(_0xd368('0x7'));var client=jayson[_0xd368('0x8')][_0xd368('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11923e,_0x3a8fb0,_0x542619){return new BPromise(function(_0x409a95,_0x4f6980){return client[_0xd368('0xa')](_0x11923e,_0x542619)[_0xd368('0xb')](function(_0x2f2f90){logger[_0xd368('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x3a8fb0,'request\x20sent');logger[_0xd368('0xd')](_0xd368('0xe'),_0x3a8fb0,_0xd368('0xf'),JSON[_0xd368('0x10')](_0x2f2f90));if(_0x2f2f90[_0xd368('0x11')]){if(_0x2f2f90[_0xd368('0x11')][_0xd368('0x12')]===0x1f4){logger['error'](_0xd368('0x13'),_0x3a8fb0,_0x2f2f90['error'][_0xd368('0x14')]);return _0x4f6980(_0x2f2f90[_0xd368('0x11')]['message']);}logger[_0xd368('0x11')](_0xd368('0x13'),_0x3a8fb0,_0x2f2f90[_0xd368('0x11')][_0xd368('0x14')]);return _0x409a95(_0x2f2f90[_0xd368('0x11')][_0xd368('0x14')]);}else{logger[_0xd368('0xc')](_0xd368('0x13'),_0x3a8fb0,_0xd368('0xf'));_0x409a95(_0x2f2f90[_0xd368('0x15')][_0xd368('0x14')]);}})[_0xd368('0x16')](function(_0x1546c6){logger[_0xd368('0x11')](_0xd368('0x13'),_0x3a8fb0,_0x1546c6);_0x4f6980(_0x1546c6);});});}exports[_0xd368('0x17')]=function(_0x3c484b){var _0x3586c0=this;return new Promise(function(_0x1ef42b,_0x33ec95){return db[_0xd368('0x18')]['findAll']({'raw':_0x3c484b['options']?_0x3c484b[_0xd368('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3c484b[_0xd368('0x19')]?_0x3c484b[_0xd368('0x19')][_0xd368('0x1a')]||null:null,'attributes':_0x3c484b['options']?_0x3c484b[_0xd368('0x19')]['attributes']||null:null,'limit':_0x3c484b['options']?_0x3c484b[_0xd368('0x19')][_0xd368('0x1b')]||null:null,'include':_0x3c484b[_0xd368('0x19')]?_0x3c484b['options'][_0xd368('0x1c')]?_['map'](_0x3c484b[_0xd368('0x19')][_0xd368('0x1c')],function(_0xbc2505){return{'model':db[_0xbc2505[_0xd368('0x1d')]],'as':_0xbc2505['as'],'attributes':_0xbc2505[_0xd368('0x1e')],'include':_0xbc2505['include']?_[_0xd368('0x1f')](_0xbc2505[_0xd368('0x1c')],function(_0xee735c){return{'model':db[_0xee735c[_0xd368('0x1d')]],'as':_0xee735c['as'],'attributes':_0xee735c[_0xd368('0x1e')],'include':_0xee735c[_0xd368('0x1c')]?_[_0xd368('0x1f')](_0xee735c[_0xd368('0x1c')],function(_0x308d52){return{'model':db[_0x308d52[_0xd368('0x1d')]],'as':_0x308d52['as'],'attributes':_0x308d52[_0xd368('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd368('0xb')](function(_0x506b38){logger[_0xd368('0xc')](_0xd368('0x17'),_0x3c484b);logger[_0xd368('0xd')]('GetServicenowAccount',_0x3c484b,JSON[_0xd368('0x10')](_0x506b38));_0x1ef42b(_0x506b38);})[_0xd368('0x16')](function(_0x3012b6){logger[_0xd368('0x11')]('GetServicenowAccount',_0x3012b6['message'],_0x3c484b);_0x33ec95(_0x3586c0['error'](0x1f4,_0x3012b6[_0xd368('0x14')]));});});};exports[_0xd368('0x20')]=function(_0x3512f7){var _0x3040e8=this;return new Promise(function(_0xe5f847,_0x15853c){return db['ServicenowAccount']['find']({'raw':_0x3512f7[_0xd368('0x19')]?_0x3512f7[_0xd368('0x19')][_0xd368('0x21')]===undefined?!![]:![]:!![],'where':_0x3512f7[_0xd368('0x19')]?_0x3512f7[_0xd368('0x19')]['where']||null:null,'attributes':_0x3512f7[_0xd368('0x19')]?_0x3512f7[_0xd368('0x19')]['attributes']||null:null,'include':_0x3512f7[_0xd368('0x19')]?_0x3512f7[_0xd368('0x19')][_0xd368('0x1c')]?_['map'](_0x3512f7[_0xd368('0x19')][_0xd368('0x1c')],function(_0x215a71){return{'model':db[_0x215a71[_0xd368('0x1d')]],'as':_0x215a71['as'],'attributes':_0x215a71['attributes'],'include':_0x215a71['include']?_['map'](_0x215a71[_0xd368('0x1c')],function(_0x52c7f1){return{'model':db[_0x52c7f1[_0xd368('0x1d')]],'as':_0x52c7f1['as'],'attributes':_0x52c7f1[_0xd368('0x1e')],'include':_0x52c7f1['include']?_[_0xd368('0x1f')](_0x52c7f1['include'],function(_0x132993){return{'model':db[_0x132993[_0xd368('0x1d')]],'as':_0x132993['as'],'attributes':_0x132993[_0xd368('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x319960){logger[_0xd368('0xc')]('ShowServicenowAccount',_0x3512f7);logger[_0xd368('0xd')](_0xd368('0x20'),_0x3512f7,JSON[_0xd368('0x10')](_0x319960));_0xe5f847(_0x319960);})[_0xd368('0x16')](function(_0x26d87b){logger[_0xd368('0x11')](_0xd368('0x20'),_0x26d87b[_0xd368('0x14')],_0x3512f7);_0x15853c(_0x3040e8[_0xd368('0x11')](0x1f4,_0x26d87b[_0xd368('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 5cf084f..7925075 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 _0x00d4=['/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x4f6ef1,_0x2e240c){var _0x234b91=function(_0x4c527d){while(--_0x4c527d){_0x4f6ef1['push'](_0x4f6ef1['shift']());}};_0x234b91(++_0x2e240c);}(_0x00d4,0x6b));var _0x400d=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x00d4[_0x243b59];return _0x3e1676;};'use strict';var multer=require(_0x400d('0x0'));var util=require('util');var path=require(_0x400d('0x1'));var timeout=require(_0x400d('0x2'));var express=require(_0x400d('0x3'));var router=express[_0x400d('0x4')]();var fs_extra=require(_0x400d('0x5'));var auth=require(_0x400d('0x6'));var interaction=require(_0x400d('0x7'));var config=require('../../config/environment');var controller=require(_0x400d('0x8'));router[_0x400d('0x9')]('/',auth[_0x400d('0xa')](),controller[_0x400d('0xb')]);router['get'](_0x400d('0xc'),auth[_0x400d('0xa')](),controller['show']);router[_0x400d('0x9')](_0x400d('0xd'),auth[_0x400d('0xa')](),controller[_0x400d('0xe')]);router[_0x400d('0x9')](_0x400d('0xf'),auth['isAuthenticated'](),controller[_0x400d('0x10')]);router[_0x400d('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x400d('0x11')]);router[_0x400d('0x12')]('/',auth[_0x400d('0xa')](),controller[_0x400d('0x13')]);router['put']('/:id',auth[_0x400d('0xa')](),controller[_0x400d('0x14')]);router[_0x400d('0x15')](_0x400d('0xc'),auth[_0x400d('0xa')](),controller[_0x400d('0x16')]);module[_0x400d('0x17')]=router; \ No newline at end of file +var _0xc33c=['/:id/subjects','getSubjects','post','create','put','/:id','update','delete','destroy','exports','multer','express','Router','fs-extra','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0xc33c,0xb2));var _0xcc33=function(_0x2f6db1,_0x3b140e){_0x2f6db1=_0x2f6db1-0x0;var _0x54184b=_0xc33c[_0x2f6db1];return _0x54184b;};'use strict';var multer=require(_0xcc33('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcc33('0x1'));var router=express[_0xcc33('0x2')]();var fs_extra=require(_0xcc33('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcc33('0x4'));var controller=require(_0xcc33('0x5'));router[_0xcc33('0x6')]('/',auth[_0xcc33('0x7')](),controller[_0xcc33('0x8')]);router[_0xcc33('0x6')]('/:id',auth[_0xcc33('0x7')](),controller['show']);router[_0xcc33('0x6')](_0xcc33('0x9'),auth['isAuthenticated'](),controller[_0xcc33('0xa')]);router[_0xcc33('0x6')](_0xcc33('0xb'),auth[_0xcc33('0x7')](),controller[_0xcc33('0xc')]);router[_0xcc33('0x6')]('/:id/descriptions',auth[_0xcc33('0x7')](),controller['getDescriptions']);router[_0xcc33('0xd')]('/',auth['isAuthenticated'](),controller[_0xcc33('0xe')]);router[_0xcc33('0xf')](_0xcc33('0x10'),auth[_0xcc33('0x7')](),controller[_0xcc33('0x11')]);router[_0xcc33('0x12')](_0xcc33('0x10'),auth['isAuthenticated'](),controller[_0xcc33('0x13')]);module[_0xcc33('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 33a1031..dcaaa14 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 _0xeaa2=['exports','STRING','sequelize'];(function(_0x317f1f,_0x459756){var _0xd973b1=function(_0x4048a6){while(--_0x4048a6){_0x317f1f['push'](_0x317f1f['shift']());}};_0xd973b1(++_0x459756);}(_0xeaa2,0x1b8));var _0x2eaa=function(_0x5f1c59,_0x3fff4c){_0x5f1c59=_0x5f1c59-0x0;var _0xbfb242=_0xeaa2[_0x5f1c59];return _0xbfb242;};'use strict';var Sequelize=require(_0x2eaa('0x0'));module[_0x2eaa('0x1')]={'name':{'type':Sequelize[_0x2eaa('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5e0b=['STRING','sequelize'];(function(_0x3b65b7,_0x1756e2){var _0x186695=function(_0x1c8e92){while(--_0x1c8e92){_0x3b65b7['push'](_0x3b65b7['shift']());}};_0x186695(++_0x1756e2);}(_0x5e0b,0x89));var _0xb5e0=function(_0x2ac71a,_0x1d2a02){_0x2ac71a=_0x2ac71a-0x0;var _0x3ee904=_0x5e0b[_0x2ac71a];return _0x3ee904;};'use strict';var Sequelize=require(_0xb5e0('0x0'));module['exports']={'name':{'type':Sequelize[_0xb5e0('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index e777460..66e5d2a 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 _0x4cdb=['ServicenowConfiguration','fieldName','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','includeAll','rows','catch','show','rawAttributes','intersection','length','merge','options','find','body','params','getFields','findOne','ServicenowField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','end','error','name','send','map'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x4cdb,0x109));var _0xb4cd=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x4cdb[_0x455c6c];return _0x488242;};'use strict';var emlformat=require(_0xb4cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb4cd('0x1'));var jsonpatch=require(_0xb4cd('0x2'));var rp=require(_0xb4cd('0x3'));var moment=require(_0xb4cd('0x4'));var BPromise=require(_0xb4cd('0x5'));var Mustache=require(_0xb4cd('0x6'));var util=require('util');var path=require(_0xb4cd('0x7'));var sox=require('sox');var csv=require(_0xb4cd('0x8'));var ejs=require(_0xb4cd('0x9'));var fs=require('fs');var fs_extra=require(_0xb4cd('0xa'));var _=require('lodash');var squel=require(_0xb4cd('0xb'));var crypto=require('crypto');var jsforce=require(_0xb4cd('0xc'));var deskjs=require(_0xb4cd('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb4cd('0xe'));var Redis=require(_0xb4cd('0xf'));var authService=require(_0xb4cd('0x10'));var qs=require(_0xb4cd('0x11'));var as=require(_0xb4cd('0x12'));var hardwareService=require(_0xb4cd('0x13'));var logger=require(_0xb4cd('0x14'))('api');var utils=require(_0xb4cd('0x15'));var config=require(_0xb4cd('0x16'));var licenseUtil=require(_0xb4cd('0x17'));var db=require(_0xb4cd('0x18'))['db'];function respondWithStatusCode(_0x9a57eb,_0x45a009){_0x45a009=_0x45a009||0xcc;return function(_0x3c79a1){if(_0x3c79a1){return _0x9a57eb[_0xb4cd('0x19')](_0x45a009);}return _0x9a57eb[_0xb4cd('0x1a')](_0x45a009)['end']();};}function respondWithResult(_0x3145bf,_0x3269ae){_0x3269ae=_0x3269ae||0xc8;return function(_0x496cae){if(_0x496cae){return _0x3145bf[_0xb4cd('0x1a')](_0x3269ae)[_0xb4cd('0x1b')](_0x496cae);}};}function respondWithFilteredResult(_0x3abc54,_0x379256){return function(_0xed21bf){if(_0xed21bf){var _0xacbdf7=typeof _0x379256[_0xb4cd('0x1c')]===_0xb4cd('0x1d')&&typeof _0x379256[_0xb4cd('0x1e')]===_0xb4cd('0x1d');var _0x5878f0=_0xed21bf[_0xb4cd('0x1f')];var _0x2e325f=_0xacbdf7?0x0:_0x379256[_0xb4cd('0x1c')];var _0x31e7ed=_0xacbdf7?_0xed21bf[_0xb4cd('0x1f')]:_0x379256['offset']+_0x379256['limit'];var _0x36963c;if(_0x31e7ed>=_0x5878f0){_0x31e7ed=_0x5878f0;_0x36963c=0xc8;}else{_0x36963c=0xce;}_0x3abc54[_0xb4cd('0x1a')](_0x36963c);return _0x3abc54['set']('Content-Range',_0x2e325f+'-'+_0x31e7ed+'/'+_0x5878f0)['json'](_0xed21bf);}return null;};}function patchUpdates(_0x1e508f){return function(_0x2f0ee7){try{jsonpatch[_0xb4cd('0x20')](_0x2f0ee7,_0x1e508f,!![]);}catch(_0x54184c){return BPromise[_0xb4cd('0x21')](_0x54184c);}return _0x2f0ee7[_0xb4cd('0x22')]();};}function saveUpdates(_0x1d2eb1,_0x255284){return function(_0x4f9dec){if(_0x4f9dec){return _0x4f9dec[_0xb4cd('0x23')](_0x1d2eb1)['then'](function(_0x3ca35d){return _0x3ca35d;});}return null;};}function removeEntity(_0x514b2f,_0x1374c4){return function(_0x37f076){if(_0x37f076){return _0x37f076[_0xb4cd('0x24')]()[_0xb4cd('0x25')](function(){_0x514b2f['status'](0xcc)[_0xb4cd('0x26')]();});}};}function handleEntityNotFound(_0x3bcf5b,_0x3e8cbe){return function(_0x1f0c07){if(!_0x1f0c07){_0x3bcf5b[_0xb4cd('0x19')](0x194);}return _0x1f0c07;};}function handleError(_0x2d2cfe,_0x3d7397){_0x3d7397=_0x3d7397||0x1f4;return function(_0x332e24){logger[_0xb4cd('0x27')](_0x332e24['stack']);if(_0x332e24[_0xb4cd('0x28')]){delete _0x332e24[_0xb4cd('0x28')];}_0x2d2cfe[_0xb4cd('0x1a')](_0x3d7397)[_0xb4cd('0x29')](_0x332e24);};}exports['index']=function(_0x21af33,_0x3165cb){var _0xa6cf97={},_0x33dfb4={},_0x32dd7d={'count':0x0,'rows':[]};var _0x1ebdab=_[_0xb4cd('0x2a')](db[_0xb4cd('0x2b')]['rawAttributes'],function(_0x594cad){return{'name':_0x594cad[_0xb4cd('0x2c')],'type':_0x594cad[_0xb4cd('0x2d')][_0xb4cd('0x2e')]};});_0x33dfb4[_0xb4cd('0x2f')]=_[_0xb4cd('0x2a')](_0x1ebdab,_0xb4cd('0x28'));_0x33dfb4[_0xb4cd('0x30')]=_[_0xb4cd('0x31')](_0x21af33['query']);_0x33dfb4[_0xb4cd('0x32')]=_['intersection'](_0x33dfb4[_0xb4cd('0x2f')],_0x33dfb4[_0xb4cd('0x30')]);_0xa6cf97['attributes']=_['intersection'](_0x33dfb4[_0xb4cd('0x2f')],qs[_0xb4cd('0x33')](_0x21af33['query'][_0xb4cd('0x33')]));_0xa6cf97[_0xb4cd('0x34')]=_0xa6cf97[_0xb4cd('0x34')]['length']?_0xa6cf97[_0xb4cd('0x34')]:_0x33dfb4[_0xb4cd('0x2f')];if(!_0x21af33['query'][_0xb4cd('0x35')](_0xb4cd('0x36'))){_0xa6cf97['limit']=qs[_0xb4cd('0x1e')](_0x21af33['query'][_0xb4cd('0x1e')]);_0xa6cf97[_0xb4cd('0x1c')]=qs['offset'](_0x21af33[_0xb4cd('0x30')][_0xb4cd('0x1c')]);}_0xa6cf97[_0xb4cd('0x37')]=qs[_0xb4cd('0x38')](_0x21af33[_0xb4cd('0x30')][_0xb4cd('0x38')]);_0xa6cf97['where']=qs[_0xb4cd('0x32')](_['pick'](_0x21af33[_0xb4cd('0x30')],_0x33dfb4[_0xb4cd('0x32')]),_0x1ebdab);if(_0x21af33[_0xb4cd('0x30')][_0xb4cd('0x39')]){_0xa6cf97[_0xb4cd('0x3a')]=_['merge'](_0xa6cf97[_0xb4cd('0x3a')],{'$or':_[_0xb4cd('0x2a')](_0x1ebdab,function(_0x1bf004){if(_0x1bf004[_0xb4cd('0x2d')]!==_0xb4cd('0x3b')){var _0x200c4a={};_0x200c4a[_0x1bf004[_0xb4cd('0x28')]]={'$like':'%'+_0x21af33['query']['filter']+'%'};return _0x200c4a;}})});}_0xa6cf97=_['merge']({},_0xa6cf97,_0x21af33['options']);var _0x4d0fe0={'where':_0xa6cf97[_0xb4cd('0x3a')]};return db[_0xb4cd('0x2b')][_0xb4cd('0x1f')](_0x4d0fe0)['then'](function(_0x411e84){_0x32dd7d['count']=_0x411e84;if(_0x21af33[_0xb4cd('0x30')][_0xb4cd('0x3c')]){_0xa6cf97['include']=[{'all':!![]}];}return db[_0xb4cd('0x2b')]['findAll'](_0xa6cf97);})[_0xb4cd('0x25')](function(_0x301d9d){_0x32dd7d[_0xb4cd('0x3d')]=_0x301d9d;return _0x32dd7d;})[_0xb4cd('0x25')](respondWithFilteredResult(_0x3165cb,_0xa6cf97))[_0xb4cd('0x3e')](handleError(_0x3165cb,null));};exports[_0xb4cd('0x3f')]=function(_0x523551,_0x4cc948){var _0x1fd5b8={'raw':![],'where':{'id':_0x523551['params']['id']}},_0x19676a={};_0x19676a[_0xb4cd('0x2f')]=_[_0xb4cd('0x31')](db[_0xb4cd('0x2b')][_0xb4cd('0x40')]);_0x19676a[_0xb4cd('0x30')]=_[_0xb4cd('0x31')](_0x523551[_0xb4cd('0x30')]);_0x19676a[_0xb4cd('0x32')]=_[_0xb4cd('0x41')](_0x19676a[_0xb4cd('0x2f')],_0x19676a[_0xb4cd('0x30')]);_0x1fd5b8['attributes']=_[_0xb4cd('0x41')](_0x19676a['model'],qs['fields'](_0x523551[_0xb4cd('0x30')][_0xb4cd('0x33')]));_0x1fd5b8['attributes']=_0x1fd5b8[_0xb4cd('0x34')][_0xb4cd('0x42')]?_0x1fd5b8[_0xb4cd('0x34')]:_0x19676a['model'];if(_0x523551[_0xb4cd('0x30')]['includeAll']){_0x1fd5b8['include']=[{'all':!![]}];}_0x1fd5b8=_[_0xb4cd('0x43')]({},_0x1fd5b8,_0x523551[_0xb4cd('0x44')]);return db[_0xb4cd('0x2b')][_0xb4cd('0x45')](_0x1fd5b8)[_0xb4cd('0x25')](handleEntityNotFound(_0x4cc948,null))[_0xb4cd('0x25')](respondWithResult(_0x4cc948,null))['catch'](handleError(_0x4cc948,null));};exports['create']=function(_0x1d8ffa,_0x17ea98){return db[_0xb4cd('0x2b')]['create'](_0x1d8ffa[_0xb4cd('0x46')],{})['then'](respondWithResult(_0x17ea98,0xc9))[_0xb4cd('0x3e')](handleError(_0x17ea98,null));};exports[_0xb4cd('0x23')]=function(_0x598a07,_0x2f012c){if(_0x598a07[_0xb4cd('0x46')]['id']){delete _0x598a07['body']['id'];}return db[_0xb4cd('0x2b')][_0xb4cd('0x45')]({'where':{'id':_0x598a07['params']['id']}})[_0xb4cd('0x25')](handleEntityNotFound(_0x2f012c,null))['then'](saveUpdates(_0x598a07[_0xb4cd('0x46')],null))[_0xb4cd('0x25')](respondWithResult(_0x2f012c,null))['catch'](handleError(_0x2f012c,null));};exports[_0xb4cd('0x24')]=function(_0x22e3f3,_0x1fcd36){return db[_0xb4cd('0x2b')][_0xb4cd('0x45')]({'where':{'id':_0x22e3f3[_0xb4cd('0x47')]['id']}})['then'](handleEntityNotFound(_0x1fcd36,null))[_0xb4cd('0x25')](removeEntity(_0x1fcd36,null))[_0xb4cd('0x3e')](handleError(_0x1fcd36,null));};exports[_0xb4cd('0x48')]=function(_0x317cde,_0x6acf72,_0x136521){var _0xa2b387={};var _0x1864b6={};var _0x207303;var _0xb9653e;return db[_0xb4cd('0x2b')][_0xb4cd('0x49')]({'where':{'id':_0x317cde[_0xb4cd('0x47')]['id']}})[_0xb4cd('0x25')](handleEntityNotFound(_0x6acf72,null))[_0xb4cd('0x25')](function(_0x446c6a){if(_0x446c6a){_0x207303=_0x446c6a;_0x1864b6[_0xb4cd('0x2f')]=_[_0xb4cd('0x31')](db[_0xb4cd('0x4a')]['rawAttributes']);_0x1864b6[_0xb4cd('0x30')]=_[_0xb4cd('0x31')](_0x317cde[_0xb4cd('0x30')]);_0x1864b6['filters']=_[_0xb4cd('0x41')](_0x1864b6[_0xb4cd('0x2f')],_0x1864b6['query']);_0xa2b387['attributes']=_['intersection'](_0x1864b6[_0xb4cd('0x2f')],qs[_0xb4cd('0x33')](_0x317cde[_0xb4cd('0x30')]['fields']));_0xa2b387[_0xb4cd('0x34')]=_0xa2b387[_0xb4cd('0x34')][_0xb4cd('0x42')]?_0xa2b387[_0xb4cd('0x34')]:_0x1864b6[_0xb4cd('0x2f')];_0xa2b387[_0xb4cd('0x37')]=qs['sort'](_0x317cde[_0xb4cd('0x30')]['sort']);_0xa2b387[_0xb4cd('0x3a')]=qs[_0xb4cd('0x32')](_['pick'](_0x317cde[_0xb4cd('0x30')],_0x1864b6[_0xb4cd('0x32')]));if(_0x317cde[_0xb4cd('0x30')]['filter']){_0xa2b387[_0xb4cd('0x3a')]=_['merge'](_0xa2b387[_0xb4cd('0x3a')],{'$or':_['map'](_0xa2b387[_0xb4cd('0x34')],function(_0x3d1a30){var _0x1edc71={};_0x1edc71[_0x3d1a30]={'$like':'%'+_0x317cde[_0xb4cd('0x30')][_0xb4cd('0x39')]+'%'};return _0x1edc71;})});}_0xa2b387=_[_0xb4cd('0x43')]({},_0xa2b387,_0x317cde[_0xb4cd('0x44')]);return _0x207303[_0xb4cd('0x48')](_0xa2b387);}})['then'](function(_0x3c4d25){if(_0x3c4d25){_0xb9653e=_0x3c4d25['length'];if(!_0x317cde[_0xb4cd('0x30')]['hasOwnProperty'](_0xb4cd('0x36'))){_0xa2b387[_0xb4cd('0x1e')]=qs['limit'](_0x317cde[_0xb4cd('0x30')]['limit']);_0xa2b387[_0xb4cd('0x1c')]=qs[_0xb4cd('0x1c')](_0x317cde['query'][_0xb4cd('0x1c')]);}return _0x207303[_0xb4cd('0x48')](_0xa2b387);}})['then'](function(_0xecb673){if(_0xecb673){return _0xecb673?{'count':_0xb9653e,'rows':_0xecb673}:null;}})['then'](respondWithResult(_0x6acf72,null))[_0xb4cd('0x3e')](handleError(_0x6acf72,null));};exports[_0xb4cd('0x4b')]=function(_0x40a1cf,_0x7f2137,_0xebc029){var _0x1d2de0={};var _0x47dc2f={};var _0x19a099;var _0x18798d;return db[_0xb4cd('0x2b')][_0xb4cd('0x49')]({'where':{'id':_0x40a1cf[_0xb4cd('0x47')]['id']}})[_0xb4cd('0x25')](handleEntityNotFound(_0x7f2137,null))[_0xb4cd('0x25')](function(_0x5b186e){if(_0x5b186e){_0x19a099=_0x5b186e;_0x47dc2f['model']=_[_0xb4cd('0x31')](db['ServicenowField'][_0xb4cd('0x40')]);_0x47dc2f[_0xb4cd('0x30')]=_[_0xb4cd('0x31')](_0x40a1cf[_0xb4cd('0x30')]);_0x47dc2f['filters']=_[_0xb4cd('0x41')](_0x47dc2f['model'],_0x47dc2f[_0xb4cd('0x30')]);_0x1d2de0['attributes']=_[_0xb4cd('0x41')](_0x47dc2f[_0xb4cd('0x2f')],qs[_0xb4cd('0x33')](_0x40a1cf[_0xb4cd('0x30')][_0xb4cd('0x33')]));_0x1d2de0[_0xb4cd('0x34')]=_0x1d2de0[_0xb4cd('0x34')][_0xb4cd('0x42')]?_0x1d2de0['attributes']:_0x47dc2f[_0xb4cd('0x2f')];_0x1d2de0[_0xb4cd('0x37')]=qs['sort'](_0x40a1cf[_0xb4cd('0x30')][_0xb4cd('0x38')]);_0x1d2de0[_0xb4cd('0x3a')]=qs[_0xb4cd('0x32')](_['pick'](_0x40a1cf[_0xb4cd('0x30')],_0x47dc2f[_0xb4cd('0x32')]));if(_0x40a1cf[_0xb4cd('0x30')][_0xb4cd('0x39')]){_0x1d2de0[_0xb4cd('0x3a')]=_[_0xb4cd('0x43')](_0x1d2de0[_0xb4cd('0x3a')],{'$or':_['map'](_0x1d2de0[_0xb4cd('0x34')],function(_0xf9af9c){var _0x18416b={};_0x18416b[_0xf9af9c]={'$like':'%'+_0x40a1cf['query'][_0xb4cd('0x39')]+'%'};return _0x18416b;})});}_0x1d2de0=_[_0xb4cd('0x43')]({},_0x1d2de0,_0x40a1cf[_0xb4cd('0x44')]);return _0x19a099[_0xb4cd('0x4b')](_0x1d2de0);}})[_0xb4cd('0x25')](function(_0x44d4dc){if(_0x44d4dc){_0x18798d=_0x44d4dc[_0xb4cd('0x42')];if(!_0x40a1cf[_0xb4cd('0x30')][_0xb4cd('0x35')](_0xb4cd('0x36'))){_0x1d2de0['limit']=qs[_0xb4cd('0x1e')](_0x40a1cf[_0xb4cd('0x30')][_0xb4cd('0x1e')]);_0x1d2de0[_0xb4cd('0x1c')]=qs[_0xb4cd('0x1c')](_0x40a1cf[_0xb4cd('0x30')][_0xb4cd('0x1c')]);}return _0x19a099[_0xb4cd('0x4b')](_0x1d2de0);}})['then'](function(_0x4ff034){if(_0x4ff034){return _0x4ff034?{'count':_0x18798d,'rows':_0x4ff034}:null;}})[_0xb4cd('0x25')](respondWithResult(_0x7f2137,null))[_0xb4cd('0x3e')](handleError(_0x7f2137,null));};exports[_0xb4cd('0x4c')]=function(_0x52e6b4,_0x55a4a8,_0x49da83){var _0x2e9a5b={};var _0x123e96={};var _0x10f2f7;var _0x3fcffb;return db[_0xb4cd('0x2b')][_0xb4cd('0x49')]({'where':{'id':_0x52e6b4[_0xb4cd('0x47')]['id']}})[_0xb4cd('0x25')](handleEntityNotFound(_0x55a4a8,null))[_0xb4cd('0x25')](function(_0x48fe9b){if(_0x48fe9b){_0x10f2f7=_0x48fe9b;_0x123e96['model']=_['keys'](db['ServicenowField'][_0xb4cd('0x40')]);_0x123e96[_0xb4cd('0x30')]=_[_0xb4cd('0x31')](_0x52e6b4['query']);_0x123e96['filters']=_[_0xb4cd('0x41')](_0x123e96['model'],_0x123e96[_0xb4cd('0x30')]);_0x2e9a5b[_0xb4cd('0x34')]=_[_0xb4cd('0x41')](_0x123e96['model'],qs[_0xb4cd('0x33')](_0x52e6b4[_0xb4cd('0x30')][_0xb4cd('0x33')]));_0x2e9a5b[_0xb4cd('0x34')]=_0x2e9a5b[_0xb4cd('0x34')][_0xb4cd('0x42')]?_0x2e9a5b[_0xb4cd('0x34')]:_0x123e96['model'];_0x2e9a5b[_0xb4cd('0x37')]=qs['sort'](_0x52e6b4['query'][_0xb4cd('0x38')]);_0x2e9a5b[_0xb4cd('0x3a')]=qs[_0xb4cd('0x32')](_['pick'](_0x52e6b4[_0xb4cd('0x30')],_0x123e96['filters']));if(_0x52e6b4[_0xb4cd('0x30')][_0xb4cd('0x39')]){_0x2e9a5b[_0xb4cd('0x3a')]=_[_0xb4cd('0x43')](_0x2e9a5b[_0xb4cd('0x3a')],{'$or':_['map'](_0x2e9a5b[_0xb4cd('0x34')],function(_0x21626a){var _0x50891e={};_0x50891e[_0x21626a]={'$like':'%'+_0x52e6b4[_0xb4cd('0x30')][_0xb4cd('0x39')]+'%'};return _0x50891e;})});}_0x2e9a5b=_[_0xb4cd('0x43')]({},_0x2e9a5b,_0x52e6b4[_0xb4cd('0x44')]);return _0x10f2f7[_0xb4cd('0x4c')](_0x2e9a5b);}})['then'](function(_0x1fb61f){if(_0x1fb61f){_0x3fcffb=_0x1fb61f[_0xb4cd('0x42')];if(!_0x52e6b4[_0xb4cd('0x30')][_0xb4cd('0x35')](_0xb4cd('0x36'))){_0x2e9a5b[_0xb4cd('0x1e')]=qs[_0xb4cd('0x1e')](_0x52e6b4['query'][_0xb4cd('0x1e')]);_0x2e9a5b[_0xb4cd('0x1c')]=qs[_0xb4cd('0x1c')](_0x52e6b4['query'][_0xb4cd('0x1c')]);}return _0x10f2f7[_0xb4cd('0x4c')](_0x2e9a5b);}})[_0xb4cd('0x25')](function(_0xeb2371){if(_0xeb2371){return _0xeb2371?{'count':_0x3fcffb,'rows':_0xeb2371}:null;}})[_0xb4cd('0x25')](respondWithResult(_0x55a4a8,null))['catch'](handleError(_0x55a4a8,null));}; \ No newline at end of file +var _0x5d3c=['undefined','count','limit','set','reject','save','update','then','end','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','keys','includeAll','create','body','params','destroy','find','getFields','findOne','ServicenowField','nolimit','getSubjects','getDescriptions','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset'];(function(_0x5b96c1,_0x404402){var _0x3aea56=function(_0x484600){while(--_0x484600){_0x5b96c1['push'](_0x5b96c1['shift']());}};_0x3aea56(++_0x404402);}(_0x5d3c,0x124));var _0xc5d3=function(_0x39342b,_0x30ee8c){_0x39342b=_0x39342b-0x0;var _0x3c7f3f=_0x5d3c[_0x39342b];return _0x3c7f3f;};'use strict';var emlformat=require(_0xc5d3('0x0'));var rimraf=require(_0xc5d3('0x1'));var zipdir=require(_0xc5d3('0x2'));var jsonpatch=require(_0xc5d3('0x3'));var rp=require(_0xc5d3('0x4'));var moment=require('moment');var BPromise=require(_0xc5d3('0x5'));var Mustache=require(_0xc5d3('0x6'));var util=require(_0xc5d3('0x7'));var path=require('path');var sox=require(_0xc5d3('0x8'));var csv=require(_0xc5d3('0x9'));var ejs=require(_0xc5d3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc5d3('0xb'));var squel=require(_0xc5d3('0xc'));var crypto=require('crypto');var jsforce=require(_0xc5d3('0xd'));var deskjs=require(_0xc5d3('0xe'));var toCsv=require(_0xc5d3('0x9'));var querystring=require(_0xc5d3('0xf'));var Papa=require(_0xc5d3('0x10'));var Redis=require('ioredis');var authService=require(_0xc5d3('0x11'));var qs=require(_0xc5d3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5d3('0x13'));var logger=require(_0xc5d3('0x14'))(_0xc5d3('0x15'));var utils=require(_0xc5d3('0x16'));var config=require(_0xc5d3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc5d3('0x18'))['db'];function respondWithStatusCode(_0x4f5feb,_0x548f98){_0x548f98=_0x548f98||0xcc;return function(_0x13d8e8){if(_0x13d8e8){return _0x4f5feb[_0xc5d3('0x19')](_0x548f98);}return _0x4f5feb[_0xc5d3('0x1a')](_0x548f98)['end']();};}function respondWithResult(_0x3de5c4,_0x15c68e){_0x15c68e=_0x15c68e||0xc8;return function(_0x270052){if(_0x270052){return _0x3de5c4[_0xc5d3('0x1a')](_0x15c68e)['json'](_0x270052);}};}function respondWithFilteredResult(_0x343a4d,_0x25dd5c){return function(_0x9e9b4b){if(_0x9e9b4b){var _0x5ca405=typeof _0x25dd5c[_0xc5d3('0x1b')]===_0xc5d3('0x1c')&&typeof _0x25dd5c['limit']==='undefined';var _0x400384=_0x9e9b4b['count'];var _0x239150=_0x5ca405?0x0:_0x25dd5c[_0xc5d3('0x1b')];var _0x52299a=_0x5ca405?_0x9e9b4b[_0xc5d3('0x1d')]:_0x25dd5c[_0xc5d3('0x1b')]+_0x25dd5c[_0xc5d3('0x1e')];var _0x3d609f;if(_0x52299a>=_0x400384){_0x52299a=_0x400384;_0x3d609f=0xc8;}else{_0x3d609f=0xce;}_0x343a4d[_0xc5d3('0x1a')](_0x3d609f);return _0x343a4d[_0xc5d3('0x1f')]('Content-Range',_0x239150+'-'+_0x52299a+'/'+_0x400384)['json'](_0x9e9b4b);}return null;};}function patchUpdates(_0x9bbe1){return function(_0x2859a2){try{jsonpatch['apply'](_0x2859a2,_0x9bbe1,!![]);}catch(_0x2a766b){return BPromise[_0xc5d3('0x20')](_0x2a766b);}return _0x2859a2[_0xc5d3('0x21')]();};}function saveUpdates(_0x189a11,_0x30faa0){return function(_0x44920a){if(_0x44920a){return _0x44920a[_0xc5d3('0x22')](_0x189a11)[_0xc5d3('0x23')](function(_0x29e117){return _0x29e117;});}return null;};}function removeEntity(_0x5247ec,_0x848d3d){return function(_0x16b534){if(_0x16b534){return _0x16b534['destroy']()['then'](function(){_0x5247ec['status'](0xcc)[_0xc5d3('0x24')]();});}};}function handleEntityNotFound(_0x936ff5,_0x348bb6){return function(_0x1e54d9){if(!_0x1e54d9){_0x936ff5[_0xc5d3('0x19')](0x194);}return _0x1e54d9;};}function handleError(_0x57a580,_0x3d089e){_0x3d089e=_0x3d089e||0x1f4;return function(_0x1d7303){logger['error'](_0x1d7303[_0xc5d3('0x25')]);if(_0x1d7303['name']){delete _0x1d7303[_0xc5d3('0x26')];}_0x57a580['status'](_0x3d089e)[_0xc5d3('0x27')](_0x1d7303);};}exports[_0xc5d3('0x28')]=function(_0x18f293,_0x1c2442){var _0x4001e7={},_0x3fcbef={},_0x9cd55b={'count':0x0,'rows':[]};var _0x3c4a99=_[_0xc5d3('0x29')](db[_0xc5d3('0x2a')][_0xc5d3('0x2b')],function(_0x3c2276){return{'name':_0x3c2276[_0xc5d3('0x2c')],'type':_0x3c2276[_0xc5d3('0x2d')][_0xc5d3('0x2e')]};});_0x3fcbef[_0xc5d3('0x2f')]=_[_0xc5d3('0x29')](_0x3c4a99,_0xc5d3('0x26'));_0x3fcbef['query']=_['keys'](_0x18f293[_0xc5d3('0x30')]);_0x3fcbef[_0xc5d3('0x31')]=_[_0xc5d3('0x32')](_0x3fcbef[_0xc5d3('0x2f')],_0x3fcbef[_0xc5d3('0x30')]);_0x4001e7[_0xc5d3('0x33')]=_[_0xc5d3('0x32')](_0x3fcbef[_0xc5d3('0x2f')],qs['fields'](_0x18f293[_0xc5d3('0x30')][_0xc5d3('0x34')]));_0x4001e7[_0xc5d3('0x33')]=_0x4001e7[_0xc5d3('0x33')][_0xc5d3('0x35')]?_0x4001e7['attributes']:_0x3fcbef[_0xc5d3('0x2f')];if(!_0x18f293['query']['hasOwnProperty']('nolimit')){_0x4001e7[_0xc5d3('0x1e')]=qs['limit'](_0x18f293[_0xc5d3('0x30')]['limit']);_0x4001e7['offset']=qs[_0xc5d3('0x1b')](_0x18f293[_0xc5d3('0x30')]['offset']);}_0x4001e7[_0xc5d3('0x36')]=qs[_0xc5d3('0x37')](_0x18f293['query'][_0xc5d3('0x37')]);_0x4001e7['where']=qs[_0xc5d3('0x31')](_[_0xc5d3('0x38')](_0x18f293[_0xc5d3('0x30')],_0x3fcbef['filters']),_0x3c4a99);if(_0x18f293['query']['filter']){_0x4001e7[_0xc5d3('0x39')]=_[_0xc5d3('0x3a')](_0x4001e7[_0xc5d3('0x39')],{'$or':_[_0xc5d3('0x29')](_0x3c4a99,function(_0x371895){if(_0x371895[_0xc5d3('0x2d')]!==_0xc5d3('0x3b')){var _0x4c5840={};_0x4c5840[_0x371895[_0xc5d3('0x26')]]={'$like':'%'+_0x18f293['query'][_0xc5d3('0x3c')]+'%'};return _0x4c5840;}})});}_0x4001e7=_['merge']({},_0x4001e7,_0x18f293[_0xc5d3('0x3d')]);var _0x3b8639={'where':_0x4001e7['where']};return db[_0xc5d3('0x2a')][_0xc5d3('0x1d')](_0x3b8639)[_0xc5d3('0x23')](function(_0xb676ba){_0x9cd55b[_0xc5d3('0x1d')]=_0xb676ba;if(_0x18f293[_0xc5d3('0x30')]['includeAll']){_0x4001e7[_0xc5d3('0x3e')]=[{'all':!![]}];}return db[_0xc5d3('0x2a')][_0xc5d3('0x3f')](_0x4001e7);})[_0xc5d3('0x23')](function(_0x35d589){_0x9cd55b[_0xc5d3('0x40')]=_0x35d589;return _0x9cd55b;})[_0xc5d3('0x23')](respondWithFilteredResult(_0x1c2442,_0x4001e7))[_0xc5d3('0x41')](handleError(_0x1c2442,null));};exports['show']=function(_0x17d225,_0x158414){var _0x2fa7cf={'raw':![],'where':{'id':_0x17d225['params']['id']}},_0x43ad86={};_0x43ad86['model']=_['keys'](db['ServicenowConfiguration'][_0xc5d3('0x2b')]);_0x43ad86['query']=_[_0xc5d3('0x42')](_0x17d225[_0xc5d3('0x30')]);_0x43ad86[_0xc5d3('0x31')]=_['intersection'](_0x43ad86[_0xc5d3('0x2f')],_0x43ad86[_0xc5d3('0x30')]);_0x2fa7cf[_0xc5d3('0x33')]=_[_0xc5d3('0x32')](_0x43ad86['model'],qs['fields'](_0x17d225[_0xc5d3('0x30')][_0xc5d3('0x34')]));_0x2fa7cf[_0xc5d3('0x33')]=_0x2fa7cf[_0xc5d3('0x33')][_0xc5d3('0x35')]?_0x2fa7cf[_0xc5d3('0x33')]:_0x43ad86[_0xc5d3('0x2f')];if(_0x17d225[_0xc5d3('0x30')][_0xc5d3('0x43')]){_0x2fa7cf[_0xc5d3('0x3e')]=[{'all':!![]}];}_0x2fa7cf=_['merge']({},_0x2fa7cf,_0x17d225[_0xc5d3('0x3d')]);return db[_0xc5d3('0x2a')]['find'](_0x2fa7cf)['then'](handleEntityNotFound(_0x158414,null))[_0xc5d3('0x23')](respondWithResult(_0x158414,null))['catch'](handleError(_0x158414,null));};exports[_0xc5d3('0x44')]=function(_0x5579fa,_0x4236b6){return db[_0xc5d3('0x2a')]['create'](_0x5579fa['body'],{})['then'](respondWithResult(_0x4236b6,0xc9))['catch'](handleError(_0x4236b6,null));};exports[_0xc5d3('0x22')]=function(_0x46776a,_0x1b5575){if(_0x46776a[_0xc5d3('0x45')]['id']){delete _0x46776a[_0xc5d3('0x45')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x46776a[_0xc5d3('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b5575,null))['then'](saveUpdates(_0x46776a['body'],null))[_0xc5d3('0x23')](respondWithResult(_0x1b5575,null))['catch'](handleError(_0x1b5575,null));};exports[_0xc5d3('0x47')]=function(_0x33716c,_0x21a4cd){return db[_0xc5d3('0x2a')][_0xc5d3('0x48')]({'where':{'id':_0x33716c[_0xc5d3('0x46')]['id']}})['then'](handleEntityNotFound(_0x21a4cd,null))['then'](removeEntity(_0x21a4cd,null))[_0xc5d3('0x41')](handleError(_0x21a4cd,null));};exports[_0xc5d3('0x49')]=function(_0x2d1de2,_0x301070,_0x37bda9){var _0x1ada53={};var _0x53993d={};var _0x4f2460;var _0x392e7a;return db[_0xc5d3('0x2a')][_0xc5d3('0x4a')]({'where':{'id':_0x2d1de2[_0xc5d3('0x46')]['id']}})['then'](handleEntityNotFound(_0x301070,null))[_0xc5d3('0x23')](function(_0x56de05){if(_0x56de05){_0x4f2460=_0x56de05;_0x53993d['model']=_[_0xc5d3('0x42')](db[_0xc5d3('0x4b')][_0xc5d3('0x2b')]);_0x53993d[_0xc5d3('0x30')]=_[_0xc5d3('0x42')](_0x2d1de2[_0xc5d3('0x30')]);_0x53993d[_0xc5d3('0x31')]=_[_0xc5d3('0x32')](_0x53993d[_0xc5d3('0x2f')],_0x53993d[_0xc5d3('0x30')]);_0x1ada53[_0xc5d3('0x33')]=_[_0xc5d3('0x32')](_0x53993d['model'],qs[_0xc5d3('0x34')](_0x2d1de2['query'][_0xc5d3('0x34')]));_0x1ada53[_0xc5d3('0x33')]=_0x1ada53[_0xc5d3('0x33')]['length']?_0x1ada53[_0xc5d3('0x33')]:_0x53993d[_0xc5d3('0x2f')];_0x1ada53[_0xc5d3('0x36')]=qs[_0xc5d3('0x37')](_0x2d1de2[_0xc5d3('0x30')][_0xc5d3('0x37')]);_0x1ada53[_0xc5d3('0x39')]=qs[_0xc5d3('0x31')](_['pick'](_0x2d1de2[_0xc5d3('0x30')],_0x53993d[_0xc5d3('0x31')]));if(_0x2d1de2[_0xc5d3('0x30')][_0xc5d3('0x3c')]){_0x1ada53['where']=_[_0xc5d3('0x3a')](_0x1ada53[_0xc5d3('0x39')],{'$or':_[_0xc5d3('0x29')](_0x1ada53[_0xc5d3('0x33')],function(_0x43ad98){var _0x15b3b8={};_0x15b3b8[_0x43ad98]={'$like':'%'+_0x2d1de2[_0xc5d3('0x30')]['filter']+'%'};return _0x15b3b8;})});}_0x1ada53=_[_0xc5d3('0x3a')]({},_0x1ada53,_0x2d1de2[_0xc5d3('0x3d')]);return _0x4f2460['getFields'](_0x1ada53);}})[_0xc5d3('0x23')](function(_0x2d2573){if(_0x2d2573){_0x392e7a=_0x2d2573[_0xc5d3('0x35')];if(!_0x2d1de2[_0xc5d3('0x30')]['hasOwnProperty'](_0xc5d3('0x4c'))){_0x1ada53[_0xc5d3('0x1e')]=qs[_0xc5d3('0x1e')](_0x2d1de2['query'][_0xc5d3('0x1e')]);_0x1ada53[_0xc5d3('0x1b')]=qs[_0xc5d3('0x1b')](_0x2d1de2[_0xc5d3('0x30')][_0xc5d3('0x1b')]);}return _0x4f2460[_0xc5d3('0x49')](_0x1ada53);}})[_0xc5d3('0x23')](function(_0x2eb477){if(_0x2eb477){return _0x2eb477?{'count':_0x392e7a,'rows':_0x2eb477}:null;}})[_0xc5d3('0x23')](respondWithResult(_0x301070,null))[_0xc5d3('0x41')](handleError(_0x301070,null));};exports['getSubjects']=function(_0x3fd561,_0x163d7b,_0x6e666d){var _0x15f211={};var _0x3bede5={};var _0x41f24f;var _0x40ea8c;return db[_0xc5d3('0x2a')][_0xc5d3('0x4a')]({'where':{'id':_0x3fd561[_0xc5d3('0x46')]['id']}})[_0xc5d3('0x23')](handleEntityNotFound(_0x163d7b,null))[_0xc5d3('0x23')](function(_0x567dc6){if(_0x567dc6){_0x41f24f=_0x567dc6;_0x3bede5[_0xc5d3('0x2f')]=_['keys'](db[_0xc5d3('0x4b')][_0xc5d3('0x2b')]);_0x3bede5[_0xc5d3('0x30')]=_['keys'](_0x3fd561[_0xc5d3('0x30')]);_0x3bede5[_0xc5d3('0x31')]=_[_0xc5d3('0x32')](_0x3bede5['model'],_0x3bede5[_0xc5d3('0x30')]);_0x15f211[_0xc5d3('0x33')]=_['intersection'](_0x3bede5[_0xc5d3('0x2f')],qs[_0xc5d3('0x34')](_0x3fd561[_0xc5d3('0x30')][_0xc5d3('0x34')]));_0x15f211[_0xc5d3('0x33')]=_0x15f211[_0xc5d3('0x33')][_0xc5d3('0x35')]?_0x15f211['attributes']:_0x3bede5[_0xc5d3('0x2f')];_0x15f211[_0xc5d3('0x36')]=qs[_0xc5d3('0x37')](_0x3fd561[_0xc5d3('0x30')][_0xc5d3('0x37')]);_0x15f211[_0xc5d3('0x39')]=qs['filters'](_[_0xc5d3('0x38')](_0x3fd561[_0xc5d3('0x30')],_0x3bede5['filters']));if(_0x3fd561['query'][_0xc5d3('0x3c')]){_0x15f211[_0xc5d3('0x39')]=_[_0xc5d3('0x3a')](_0x15f211[_0xc5d3('0x39')],{'$or':_[_0xc5d3('0x29')](_0x15f211['attributes'],function(_0x5e5959){var _0x6bdd1b={};_0x6bdd1b[_0x5e5959]={'$like':'%'+_0x3fd561[_0xc5d3('0x30')][_0xc5d3('0x3c')]+'%'};return _0x6bdd1b;})});}_0x15f211=_[_0xc5d3('0x3a')]({},_0x15f211,_0x3fd561[_0xc5d3('0x3d')]);return _0x41f24f['getSubjects'](_0x15f211);}})[_0xc5d3('0x23')](function(_0x3836dc){if(_0x3836dc){_0x40ea8c=_0x3836dc[_0xc5d3('0x35')];if(!_0x3fd561['query']['hasOwnProperty'](_0xc5d3('0x4c'))){_0x15f211[_0xc5d3('0x1e')]=qs[_0xc5d3('0x1e')](_0x3fd561[_0xc5d3('0x30')][_0xc5d3('0x1e')]);_0x15f211[_0xc5d3('0x1b')]=qs[_0xc5d3('0x1b')](_0x3fd561[_0xc5d3('0x30')][_0xc5d3('0x1b')]);}return _0x41f24f[_0xc5d3('0x4d')](_0x15f211);}})[_0xc5d3('0x23')](function(_0x7a5869){if(_0x7a5869){return _0x7a5869?{'count':_0x40ea8c,'rows':_0x7a5869}:null;}})['then'](respondWithResult(_0x163d7b,null))[_0xc5d3('0x41')](handleError(_0x163d7b,null));};exports['getDescriptions']=function(_0x288419,_0xeaf374,_0xeb69c3){var _0x5870d={};var _0x867fc5={};var _0x2e25c5;var _0x541d0d;return db['ServicenowConfiguration'][_0xc5d3('0x4a')]({'where':{'id':_0x288419[_0xc5d3('0x46')]['id']}})[_0xc5d3('0x23')](handleEntityNotFound(_0xeaf374,null))[_0xc5d3('0x23')](function(_0x32b212){if(_0x32b212){_0x2e25c5=_0x32b212;_0x867fc5['model']=_[_0xc5d3('0x42')](db[_0xc5d3('0x4b')][_0xc5d3('0x2b')]);_0x867fc5['query']=_['keys'](_0x288419[_0xc5d3('0x30')]);_0x867fc5[_0xc5d3('0x31')]=_[_0xc5d3('0x32')](_0x867fc5[_0xc5d3('0x2f')],_0x867fc5[_0xc5d3('0x30')]);_0x5870d[_0xc5d3('0x33')]=_[_0xc5d3('0x32')](_0x867fc5[_0xc5d3('0x2f')],qs[_0xc5d3('0x34')](_0x288419[_0xc5d3('0x30')][_0xc5d3('0x34')]));_0x5870d[_0xc5d3('0x33')]=_0x5870d[_0xc5d3('0x33')][_0xc5d3('0x35')]?_0x5870d[_0xc5d3('0x33')]:_0x867fc5[_0xc5d3('0x2f')];_0x5870d[_0xc5d3('0x36')]=qs[_0xc5d3('0x37')](_0x288419['query']['sort']);_0x5870d[_0xc5d3('0x39')]=qs[_0xc5d3('0x31')](_[_0xc5d3('0x38')](_0x288419['query'],_0x867fc5[_0xc5d3('0x31')]));if(_0x288419[_0xc5d3('0x30')][_0xc5d3('0x3c')]){_0x5870d[_0xc5d3('0x39')]=_[_0xc5d3('0x3a')](_0x5870d[_0xc5d3('0x39')],{'$or':_['map'](_0x5870d[_0xc5d3('0x33')],function(_0x325b75){var _0x4f666d={};_0x4f666d[_0x325b75]={'$like':'%'+_0x288419[_0xc5d3('0x30')][_0xc5d3('0x3c')]+'%'};return _0x4f666d;})});}_0x5870d=_['merge']({},_0x5870d,_0x288419[_0xc5d3('0x3d')]);return _0x2e25c5[_0xc5d3('0x4e')](_0x5870d);}})[_0xc5d3('0x23')](function(_0x40ef89){if(_0x40ef89){_0x541d0d=_0x40ef89[_0xc5d3('0x35')];if(!_0x288419[_0xc5d3('0x30')][_0xc5d3('0x4f')](_0xc5d3('0x4c'))){_0x5870d[_0xc5d3('0x1e')]=qs[_0xc5d3('0x1e')](_0x288419[_0xc5d3('0x30')][_0xc5d3('0x1e')]);_0x5870d[_0xc5d3('0x1b')]=qs[_0xc5d3('0x1b')](_0x288419[_0xc5d3('0x30')][_0xc5d3('0x1b')]);}return _0x2e25c5[_0xc5d3('0x4e')](_0x5870d);}})[_0xc5d3('0x23')](function(_0x2fb6b2){if(_0x2fb6b2){return _0x2fb6b2?{'count':_0x541d0d,'rows':_0x2fb6b2}:null;}})['then'](respondWithResult(_0xeaf374,null))[_0xc5d3('0x41')](handleError(_0xeaf374,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 5a8747d..71bba74 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 _0x81fa=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations'];(function(_0x544803,_0x5750ec){var _0x2ff1d8=function(_0x580eed){while(--_0x580eed){_0x544803['push'](_0x544803['shift']());}};_0x2ff1d8(++_0x5750ec);}(_0x81fa,0xdd));var _0xa81f=function(_0x33cb35,_0x6240ef){_0x33cb35=_0x33cb35-0x0;var _0x50a2ac=_0x81fa[_0x33cb35];return _0x50a2ac;};'use strict';var _=require(_0xa81f('0x0'));var util=require(_0xa81f('0x1'));var logger=require('../../config/logger')(_0xa81f('0x2'));var moment=require(_0xa81f('0x3'));var BPromise=require(_0xa81f('0x4'));var rp=require(_0xa81f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa81f('0x6'));var config=require(_0xa81f('0x7'));var attributes=require(_0xa81f('0x8'));module[_0xa81f('0x9')]=function(_0x1dc233,_0x158719){return _0x1dc233[_0xa81f('0xa')](_0xa81f('0xb'),attributes,{'tableName':_0xa81f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f2f=['request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','../../config/logger','api','bluebird'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0x4f2f,0x1cb));var _0xf4f2=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x4f2f[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf4f2('0x0'))(_0xf4f2('0x1'));var moment=require('moment');var BPromise=require(_0xf4f2('0x2'));var rp=require(_0xf4f2('0x3'));var fs=require('fs');var path=require(_0xf4f2('0x4'));var rimraf=require(_0xf4f2('0x5'));var config=require(_0xf4f2('0x6'));var attributes=require(_0xf4f2('0x7'));module[_0xf4f2('0x8')]=function(_0x2d7c29,_0x1e0ceb){return _0x2d7c29[_0xf4f2('0x9')](_0xf4f2('0xa'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index b8f32b8..18f9656 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 _0xc7cb=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x1193c0,_0x1ce25b){var _0x2ee678=function(_0x40d8ec){while(--_0x40d8ec){_0x1193c0['push'](_0x1193c0['shift']());}};_0x2ee678(++_0x1ce25b);}(_0xc7cb,0x115));var _0xbc7c=function(_0x15f724,_0x2794ef){_0x15f724=_0x15f724-0x0;var _0x49b152=_0xc7cb[_0x15f724];return _0x49b152;};'use strict';var _=require(_0xbc7c('0x0'));var util=require(_0xbc7c('0x1'));var moment=require('moment');var BPromise=require(_0xbc7c('0x2'));var rs=require(_0xbc7c('0x3'));var fs=require('fs');var Redis=require(_0xbc7c('0x4'));var db=require(_0xbc7c('0x5'))['db'];var utils=require(_0xbc7c('0x6'));var logger=require(_0xbc7c('0x7'))(_0xbc7c('0x8'));var config=require(_0xbc7c('0x9'));var jayson=require(_0xbc7c('0xa'));var client=jayson[_0xbc7c('0xb')][_0xbc7c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x19f2fb,_0x55066e,_0x41cf13){return new BPromise(function(_0x58aacb,_0x931adf){return client[_0xbc7c('0xd')](_0x19f2fb,_0x41cf13)['then'](function(_0x525c4a){logger[_0xbc7c('0xe')](_0xbc7c('0xf'),_0x55066e,_0xbc7c('0x10'));logger['debug'](_0xbc7c('0x11'),_0x55066e,_0xbc7c('0x10'),JSON[_0xbc7c('0x12')](_0x525c4a));if(_0x525c4a[_0xbc7c('0x13')]){if(_0x525c4a[_0xbc7c('0x13')]['code']===0x1f4){logger[_0xbc7c('0x13')](_0xbc7c('0xf'),_0x55066e,_0x525c4a[_0xbc7c('0x13')][_0xbc7c('0x14')]);return _0x931adf(_0x525c4a[_0xbc7c('0x13')][_0xbc7c('0x14')]);}logger[_0xbc7c('0x13')](_0xbc7c('0xf'),_0x55066e,_0x525c4a[_0xbc7c('0x13')]['message']);return _0x58aacb(_0x525c4a[_0xbc7c('0x13')]['message']);}else{logger[_0xbc7c('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x55066e,_0xbc7c('0x10'));_0x58aacb(_0x525c4a[_0xbc7c('0x15')][_0xbc7c('0x14')]);}})[_0xbc7c('0x16')](function(_0x3f3b0f){logger['error'](_0xbc7c('0xf'),_0x55066e,_0x3f3b0f);_0x931adf(_0x3f3b0f);});});} \ No newline at end of file +var _0xc122=['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','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x51e94c,_0x31a80b){var _0x27663=function(_0x2bb9c0){while(--_0x2bb9c0){_0x51e94c['push'](_0x51e94c['shift']());}};_0x27663(++_0x31a80b);}(_0xc122,0x66));var _0x2c12=function(_0x1b1444,_0x2591c1){_0x1b1444=_0x1b1444-0x0;var _0x58ba7d=_0xc122[_0x1b1444];return _0x58ba7d;};'use strict';var _=require(_0x2c12('0x0'));var util=require(_0x2c12('0x1'));var moment=require(_0x2c12('0x2'));var BPromise=require('bluebird');var rs=require(_0x2c12('0x3'));var fs=require('fs');var Redis=require(_0x2c12('0x4'));var db=require(_0x2c12('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c12('0x6'))(_0x2c12('0x7'));var config=require(_0x2c12('0x8'));var jayson=require(_0x2c12('0x9'));var client=jayson[_0x2c12('0xa')][_0x2c12('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59ef32,_0x5d4508,_0x1aa8cb){return new BPromise(function(_0x29f4e4,_0x55af81){return client[_0x2c12('0xc')](_0x59ef32,_0x1aa8cb)[_0x2c12('0xd')](function(_0x55b4a0){logger[_0x2c12('0xe')](_0x2c12('0xf'),_0x5d4508,_0x2c12('0x10'));logger[_0x2c12('0x11')](_0x2c12('0x12'),_0x5d4508,'request\x20sent',JSON['stringify'](_0x55b4a0));if(_0x55b4a0['error']){if(_0x55b4a0[_0x2c12('0x13')][_0x2c12('0x14')]===0x1f4){logger[_0x2c12('0x13')](_0x2c12('0xf'),_0x5d4508,_0x55b4a0['error'][_0x2c12('0x15')]);return _0x55af81(_0x55b4a0[_0x2c12('0x13')][_0x2c12('0x15')]);}logger[_0x2c12('0x13')](_0x2c12('0xf'),_0x5d4508,_0x55b4a0[_0x2c12('0x13')][_0x2c12('0x15')]);return _0x29f4e4(_0x55b4a0[_0x2c12('0x13')][_0x2c12('0x15')]);}else{logger[_0x2c12('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5d4508,'request\x20sent');_0x29f4e4(_0x55b4a0['result'][_0x2c12('0x15')]);}})[_0x2c12('0x16')](function(_0x3f6a61){logger[_0x2c12('0x13')](_0x2c12('0xf'),_0x5d4508,_0x3f6a61);_0x55af81(_0x3f6a61);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index f5971a0..50832d8 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 _0x80f9=['get','index','/:id','isAuthenticated','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller'];(function(_0x48f639,_0x3e63ce){var _0x166f99=function(_0x4fec5b){while(--_0x4fec5b){_0x48f639['push'](_0x48f639['shift']());}};_0x166f99(++_0x3e63ce);}(_0x80f9,0xda));var _0x980f=function(_0x2a6028,_0x63083c){_0x2a6028=_0x2a6028-0x0;var _0x11b31c=_0x80f9[_0x2a6028];return _0x11b31c;};'use strict';var multer=require(_0x980f('0x0'));var util=require(_0x980f('0x1'));var path=require(_0x980f('0x2'));var timeout=require(_0x980f('0x3'));var express=require(_0x980f('0x4'));var router=express[_0x980f('0x5')]();var fs_extra=require(_0x980f('0x6'));var auth=require(_0x980f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x980f('0x8'));var controller=require(_0x980f('0x9'));router[_0x980f('0xa')]('/',auth['isAuthenticated'](),controller[_0x980f('0xb')]);router[_0x980f('0xa')](_0x980f('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x980f('0xd')](),controller[_0x980f('0xe')]);router[_0x980f('0xf')]('/:id',auth[_0x980f('0xd')](),controller[_0x980f('0x10')]);router[_0x980f('0x11')](_0x980f('0xc'),auth[_0x980f('0xd')](),controller[_0x980f('0x12')]);module['exports']=router; \ No newline at end of file +var _0x6d34=['isAuthenticated','/:id','show','post','create','put','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get'];(function(_0x459a0a,_0x25c46f){var _0x4ab46c=function(_0x451a6a){while(--_0x451a6a){_0x459a0a['push'](_0x459a0a['shift']());}};_0x4ab46c(++_0x25c46f);}(_0x6d34,0x1dc));var _0x46d3=function(_0x59a9cc,_0x55eeca){_0x59a9cc=_0x59a9cc-0x0;var _0x18ec70=_0x6d34[_0x59a9cc];return _0x18ec70;};'use strict';var multer=require(_0x46d3('0x0'));var util=require(_0x46d3('0x1'));var path=require(_0x46d3('0x2'));var timeout=require(_0x46d3('0x3'));var express=require(_0x46d3('0x4'));var router=express['Router']();var fs_extra=require(_0x46d3('0x5'));var auth=require(_0x46d3('0x6'));var interaction=require(_0x46d3('0x7'));var config=require('../../config/environment');var controller=require(_0x46d3('0x8'));router[_0x46d3('0x9')]('/',auth[_0x46d3('0xa')](),controller['index']);router[_0x46d3('0x9')](_0x46d3('0xb'),auth[_0x46d3('0xa')](),controller[_0x46d3('0xc')]);router[_0x46d3('0xd')]('/',auth[_0x46d3('0xa')](),controller[_0x46d3('0xe')]);router[_0x46d3('0xf')](_0x46d3('0xb'),auth[_0x46d3('0xa')](),controller[_0x46d3('0x10')]);router['delete']('/:id',auth[_0x46d3('0xa')](),controller[_0x46d3('0x11')]);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 900f3da..6da0e0d 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 _0x8d7a=['variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x1c29ae,_0x5c38c2){var _0x296f34=function(_0x38cfa0){while(--_0x38cfa0){_0x1c29ae['push'](_0x1c29ae['shift']());}};_0x296f34(++_0x5c38c2);}(_0x8d7a,0x16d));var _0xa8d7=function(_0x299a5f,_0x4a2cd0){_0x299a5f=_0x299a5f-0x0;var _0x3b979f=_0x8d7a[_0x299a5f];return _0x3b979f;};'use strict';var Sequelize=require(_0xa8d7('0x0'));module[_0xa8d7('0x1')]={'type':{'type':Sequelize[_0xa8d7('0x2')](_0xa8d7('0x3'),_0xa8d7('0x4'),_0xa8d7('0x5'),_0xa8d7('0x6'),_0xa8d7('0x7')),'defaultValue':_0xa8d7('0x3')},'content':{'type':Sequelize[_0xa8d7('0x8')]},'key':{'type':Sequelize[_0xa8d7('0x8')]},'keyType':{'type':Sequelize[_0xa8d7('0x2')](_0xa8d7('0x3'),_0xa8d7('0x4'),_0xa8d7('0x5'))},'keyContent':{'type':Sequelize[_0xa8d7('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa8d7('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5491=['string','variable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x4a7e98,_0x250137){var _0x27d10d=function(_0x378768){while(--_0x378768){_0x4a7e98['push'](_0x4a7e98['shift']());}};_0x27d10d(++_0x250137);}(_0x5491,0x15c));var _0x1549=function(_0x5bb322,_0x20d5cd){_0x5bb322=_0x5bb322-0x0;var _0x2c6953=_0x5491[_0x5bb322];return _0x2c6953;};'use strict';var Sequelize=require(_0x1549('0x0'));module[_0x1549('0x1')]={'type':{'type':Sequelize[_0x1549('0x2')](_0x1549('0x3'),_0x1549('0x4'),'customVariable',_0x1549('0x5'),_0x1549('0x6')),'defaultValue':_0x1549('0x3')},'content':{'type':Sequelize[_0x1549('0x7')]},'key':{'type':Sequelize[_0x1549('0x7')]},'keyType':{'type':Sequelize[_0x1549('0x2')](_0x1549('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x1549('0x7')]},'customField':{'type':Sequelize[_0x1549('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1549('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 0f52120..41b91f5 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 _0xc530=['eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','Content-Range','reject','update','then','end','error','stack','name','send','index','map','ServicenowField','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','params','rawAttributes','include','find','catch','create','body','destroy'];(function(_0x4f5627,_0x3caed8){var _0x980885=function(_0x19012e){while(--_0x19012e){_0x4f5627['push'](_0x4f5627['shift']());}};_0x980885(++_0x3caed8);}(_0xc530,0x96));var _0x0c53=function(_0x1f0679,_0x53d43c){_0x1f0679=_0x1f0679-0x0;var _0x3dc3a4=_0xc530[_0x1f0679];return _0x3dc3a4;};'use strict';var emlformat=require(_0x0c53('0x0'));var rimraf=require(_0x0c53('0x1'));var zipdir=require(_0x0c53('0x2'));var jsonpatch=require(_0x0c53('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0c53('0x4'));var util=require(_0x0c53('0x5'));var path=require(_0x0c53('0x6'));var sox=require(_0x0c53('0x7'));var csv=require(_0x0c53('0x8'));var ejs=require(_0x0c53('0x9'));var fs=require('fs');var fs_extra=require(_0x0c53('0xa'));var _=require(_0x0c53('0xb'));var squel=require(_0x0c53('0xc'));var crypto=require(_0x0c53('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0c53('0xe'));var toCsv=require(_0x0c53('0x8'));var querystring=require(_0x0c53('0xf'));var Papa=require(_0x0c53('0x10'));var Redis=require('ioredis');var authService=require(_0x0c53('0x11'));var qs=require(_0x0c53('0x12'));var as=require(_0x0c53('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c53('0x14'))(_0x0c53('0x15'));var utils=require('../../config/utils');var config=require(_0x0c53('0x16'));var licenseUtil=require(_0x0c53('0x17'));var db=require(_0x0c53('0x18'))['db'];function respondWithStatusCode(_0x57ec5a,_0x768bd3){_0x768bd3=_0x768bd3||0xcc;return function(_0xf16714){if(_0xf16714){return _0x57ec5a[_0x0c53('0x19')](_0x768bd3);}return _0x57ec5a['status'](_0x768bd3)['end']();};}function respondWithResult(_0x3edbf1,_0xed1361){_0xed1361=_0xed1361||0xc8;return function(_0x5434b5){if(_0x5434b5){return _0x3edbf1['status'](_0xed1361)[_0x0c53('0x1a')](_0x5434b5);}};}function respondWithFilteredResult(_0x494000,_0x25f0e6){return function(_0x29c3e9){if(_0x29c3e9){var _0x2d4d3b=typeof _0x25f0e6[_0x0c53('0x1b')]===_0x0c53('0x1c')&&typeof _0x25f0e6[_0x0c53('0x1d')]===_0x0c53('0x1c');var _0x52ac94=_0x29c3e9[_0x0c53('0x1e')];var _0x46ccd6=_0x2d4d3b?0x0:_0x25f0e6[_0x0c53('0x1b')];var _0x4bb0cc=_0x2d4d3b?_0x29c3e9['count']:_0x25f0e6[_0x0c53('0x1b')]+_0x25f0e6[_0x0c53('0x1d')];var _0x1a9dee;if(_0x4bb0cc>=_0x52ac94){_0x4bb0cc=_0x52ac94;_0x1a9dee=0xc8;}else{_0x1a9dee=0xce;}_0x494000[_0x0c53('0x1f')](_0x1a9dee);return _0x494000['set'](_0x0c53('0x20'),_0x46ccd6+'-'+_0x4bb0cc+'/'+_0x52ac94)[_0x0c53('0x1a')](_0x29c3e9);}return null;};}function patchUpdates(_0xe7021a){return function(_0x45f1d8){try{jsonpatch['apply'](_0x45f1d8,_0xe7021a,!![]);}catch(_0x465395){return BPromise[_0x0c53('0x21')](_0x465395);}return _0x45f1d8['save']();};}function saveUpdates(_0x4a20eb,_0x5e2f2c){return function(_0x51b2cd){if(_0x51b2cd){return _0x51b2cd[_0x0c53('0x22')](_0x4a20eb)['then'](function(_0x27ad51){return _0x27ad51;});}return null;};}function removeEntity(_0x4b3a4f,_0x3ae22d){return function(_0x3c6f4f){if(_0x3c6f4f){return _0x3c6f4f['destroy']()[_0x0c53('0x23')](function(){_0x4b3a4f[_0x0c53('0x1f')](0xcc)[_0x0c53('0x24')]();});}};}function handleEntityNotFound(_0x37c89a,_0x38381c){return function(_0x15ab19){if(!_0x15ab19){_0x37c89a[_0x0c53('0x19')](0x194);}return _0x15ab19;};}function handleError(_0x4bb246,_0x5bfbd4){_0x5bfbd4=_0x5bfbd4||0x1f4;return function(_0x768b1c){logger[_0x0c53('0x25')](_0x768b1c[_0x0c53('0x26')]);if(_0x768b1c['name']){delete _0x768b1c[_0x0c53('0x27')];}_0x4bb246['status'](_0x5bfbd4)[_0x0c53('0x28')](_0x768b1c);};}exports[_0x0c53('0x29')]=function(_0x57b2c1,_0x542673){var _0x24912f={},_0x2a0ecb={},_0x2307b7={'count':0x0,'rows':[]};var _0x4ec296=_[_0x0c53('0x2a')](db[_0x0c53('0x2b')]['rawAttributes'],function(_0x2a5f7d){return{'name':_0x2a5f7d[_0x0c53('0x2c')],'type':_0x2a5f7d[_0x0c53('0x2d')][_0x0c53('0x2e')]};});_0x2a0ecb['model']=_[_0x0c53('0x2a')](_0x4ec296,_0x0c53('0x27'));_0x2a0ecb[_0x0c53('0x2f')]=_[_0x0c53('0x30')](_0x57b2c1[_0x0c53('0x2f')]);_0x2a0ecb[_0x0c53('0x31')]=_[_0x0c53('0x32')](_0x2a0ecb[_0x0c53('0x33')],_0x2a0ecb[_0x0c53('0x2f')]);_0x24912f[_0x0c53('0x34')]=_[_0x0c53('0x32')](_0x2a0ecb[_0x0c53('0x33')],qs[_0x0c53('0x35')](_0x57b2c1[_0x0c53('0x2f')][_0x0c53('0x35')]));_0x24912f[_0x0c53('0x34')]=_0x24912f[_0x0c53('0x34')][_0x0c53('0x36')]?_0x24912f['attributes']:_0x2a0ecb[_0x0c53('0x33')];if(!_0x57b2c1['query'][_0x0c53('0x37')](_0x0c53('0x38'))){_0x24912f[_0x0c53('0x1d')]=qs['limit'](_0x57b2c1[_0x0c53('0x2f')][_0x0c53('0x1d')]);_0x24912f[_0x0c53('0x1b')]=qs[_0x0c53('0x1b')](_0x57b2c1[_0x0c53('0x2f')]['offset']);}_0x24912f[_0x0c53('0x39')]=qs[_0x0c53('0x3a')](_0x57b2c1[_0x0c53('0x2f')][_0x0c53('0x3a')]);_0x24912f[_0x0c53('0x3b')]=qs[_0x0c53('0x31')](_[_0x0c53('0x3c')](_0x57b2c1[_0x0c53('0x2f')],_0x2a0ecb[_0x0c53('0x31')]),_0x4ec296);if(_0x57b2c1[_0x0c53('0x2f')][_0x0c53('0x3d')]){_0x24912f[_0x0c53('0x3b')]=_[_0x0c53('0x3e')](_0x24912f[_0x0c53('0x3b')],{'$or':_['map'](_0x4ec296,function(_0x547365){if(_0x547365[_0x0c53('0x2d')]!=='VIRTUAL'){var _0xb4032b={};_0xb4032b[_0x547365['name']]={'$like':'%'+_0x57b2c1['query'][_0x0c53('0x3d')]+'%'};return _0xb4032b;}})});}_0x24912f=_[_0x0c53('0x3e')]({},_0x24912f,_0x57b2c1[_0x0c53('0x3f')]);var _0x40387e={'where':_0x24912f['where']};return db[_0x0c53('0x2b')][_0x0c53('0x1e')](_0x40387e)[_0x0c53('0x23')](function(_0x373fc8){_0x2307b7[_0x0c53('0x1e')]=_0x373fc8;if(_0x57b2c1['query'][_0x0c53('0x40')]){_0x24912f['include']=[{'all':!![]}];}return db[_0x0c53('0x2b')][_0x0c53('0x41')](_0x24912f);})[_0x0c53('0x23')](function(_0x59d0b3){_0x2307b7[_0x0c53('0x42')]=_0x59d0b3;return _0x2307b7;})[_0x0c53('0x23')](respondWithFilteredResult(_0x542673,_0x24912f))['catch'](handleError(_0x542673,null));};exports['show']=function(_0x37930e,_0xb29994){var _0x20ec1a={'raw':!![],'where':{'id':_0x37930e[_0x0c53('0x43')]['id']}},_0x394eb3={};_0x394eb3[_0x0c53('0x33')]=_[_0x0c53('0x30')](db['ServicenowField'][_0x0c53('0x44')]);_0x394eb3[_0x0c53('0x2f')]=_['keys'](_0x37930e[_0x0c53('0x2f')]);_0x394eb3[_0x0c53('0x31')]=_[_0x0c53('0x32')](_0x394eb3[_0x0c53('0x33')],_0x394eb3[_0x0c53('0x2f')]);_0x20ec1a[_0x0c53('0x34')]=_[_0x0c53('0x32')](_0x394eb3['model'],qs[_0x0c53('0x35')](_0x37930e['query'][_0x0c53('0x35')]));_0x20ec1a[_0x0c53('0x34')]=_0x20ec1a['attributes'][_0x0c53('0x36')]?_0x20ec1a[_0x0c53('0x34')]:_0x394eb3[_0x0c53('0x33')];if(_0x37930e[_0x0c53('0x2f')]['includeAll']){_0x20ec1a[_0x0c53('0x45')]=[{'all':!![]}];}_0x20ec1a=_[_0x0c53('0x3e')]({},_0x20ec1a,_0x37930e[_0x0c53('0x3f')]);return db[_0x0c53('0x2b')][_0x0c53('0x46')](_0x20ec1a)['then'](handleEntityNotFound(_0xb29994,null))['then'](respondWithResult(_0xb29994,null))[_0x0c53('0x47')](handleError(_0xb29994,null));};exports[_0x0c53('0x48')]=function(_0x1e5aa9,_0x5b3797){return db['ServicenowField']['create'](_0x1e5aa9['body'],{})[_0x0c53('0x23')](respondWithResult(_0x5b3797,0xc9))[_0x0c53('0x47')](handleError(_0x5b3797,null));};exports[_0x0c53('0x22')]=function(_0x34b47f,_0xee42df){if(_0x34b47f[_0x0c53('0x49')]['id']){delete _0x34b47f['body']['id'];}return db[_0x0c53('0x2b')][_0x0c53('0x46')]({'where':{'id':_0x34b47f[_0x0c53('0x43')]['id']}})['then'](handleEntityNotFound(_0xee42df,null))[_0x0c53('0x23')](saveUpdates(_0x34b47f[_0x0c53('0x49')],null))['then'](respondWithResult(_0xee42df,null))[_0x0c53('0x47')](handleError(_0xee42df,null));};exports[_0x0c53('0x4a')]=function(_0x1837ef,_0x428ed7){return db[_0x0c53('0x2b')]['find']({'where':{'id':_0x1837ef['params']['id']}})[_0x0c53('0x23')](handleEntityNotFound(_0x428ed7,null))[_0x0c53('0x23')](removeEntity(_0x428ed7,null))[_0x0c53('0x47')](handleError(_0x428ed7,null));}; \ No newline at end of file +var _0x27a7=['filter','where','merge','VIRTUAL','options','ServicenowField','includeAll','include','findAll','catch','show','create','body','params','destroy','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','error','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick'];(function(_0x3820a1,_0xf8fac6){var _0x364e9c=function(_0x4e47b1){while(--_0x4e47b1){_0x3820a1['push'](_0x3820a1['shift']());}};_0x364e9c(++_0xf8fac6);}(_0x27a7,0x1b9));var _0x727a=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x27a7[_0x39e283];return _0x7de89f;};'use strict';var emlformat=require(_0x727a('0x0'));var rimraf=require(_0x727a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x727a('0x2'));var rp=require('request-promise');var moment=require(_0x727a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x727a('0x4'));var util=require(_0x727a('0x5'));var path=require(_0x727a('0x6'));var sox=require(_0x727a('0x7'));var csv=require(_0x727a('0x8'));var ejs=require(_0x727a('0x9'));var fs=require('fs');var fs_extra=require(_0x727a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x727a('0xb'));var jsforce=require(_0x727a('0xc'));var deskjs=require(_0x727a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x727a('0xe'));var Redis=require('ioredis');var authService=require(_0x727a('0xf'));var qs=require(_0x727a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x727a('0x11'));var logger=require(_0x727a('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x727a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x727a('0x14'))['db'];function respondWithStatusCode(_0x110382,_0x47ff86){_0x47ff86=_0x47ff86||0xcc;return function(_0x700535){if(_0x700535){return _0x110382[_0x727a('0x15')](_0x47ff86);}return _0x110382[_0x727a('0x16')](_0x47ff86)[_0x727a('0x17')]();};}function respondWithResult(_0x5c850c,_0x47ed3a){_0x47ed3a=_0x47ed3a||0xc8;return function(_0x1514d4){if(_0x1514d4){return _0x5c850c[_0x727a('0x16')](_0x47ed3a)[_0x727a('0x18')](_0x1514d4);}};}function respondWithFilteredResult(_0x16fdd4,_0x60a9c8){return function(_0x319419){if(_0x319419){var _0x30acba=typeof _0x60a9c8['offset']==='undefined'&&typeof _0x60a9c8[_0x727a('0x19')]===_0x727a('0x1a');var _0x3b2abb=_0x319419[_0x727a('0x1b')];var _0x390bfa=_0x30acba?0x0:_0x60a9c8['offset'];var _0x244834=_0x30acba?_0x319419[_0x727a('0x1b')]:_0x60a9c8[_0x727a('0x1c')]+_0x60a9c8[_0x727a('0x19')];var _0x23589b;if(_0x244834>=_0x3b2abb){_0x244834=_0x3b2abb;_0x23589b=0xc8;}else{_0x23589b=0xce;}_0x16fdd4[_0x727a('0x16')](_0x23589b);return _0x16fdd4[_0x727a('0x1d')](_0x727a('0x1e'),_0x390bfa+'-'+_0x244834+'/'+_0x3b2abb)[_0x727a('0x18')](_0x319419);}return null;};}function patchUpdates(_0xa3311){return function(_0xdfb140){try{jsonpatch[_0x727a('0x1f')](_0xdfb140,_0xa3311,!![]);}catch(_0x4bef56){return BPromise[_0x727a('0x20')](_0x4bef56);}return _0xdfb140['save']();};}function saveUpdates(_0x3bfcbc,_0x5ce09f){return function(_0xa96ecc){if(_0xa96ecc){return _0xa96ecc[_0x727a('0x21')](_0x3bfcbc)[_0x727a('0x22')](function(_0x21cd27){return _0x21cd27;});}return null;};}function removeEntity(_0x429316,_0x50b9a5){return function(_0x38787e){if(_0x38787e){return _0x38787e['destroy']()['then'](function(){_0x429316[_0x727a('0x16')](0xcc)[_0x727a('0x17')]();});}};}function handleEntityNotFound(_0x511351,_0x44d317){return function(_0x1f2618){if(!_0x1f2618){_0x511351[_0x727a('0x15')](0x194);}return _0x1f2618;};}function handleError(_0x26bf39,_0x531816){_0x531816=_0x531816||0x1f4;return function(_0x27dd4a){logger[_0x727a('0x23')](_0x27dd4a['stack']);if(_0x27dd4a[_0x727a('0x24')]){delete _0x27dd4a['name'];}_0x26bf39[_0x727a('0x16')](_0x531816)[_0x727a('0x25')](_0x27dd4a);};}exports[_0x727a('0x26')]=function(_0x387517,_0x2e1bdc){var _0x42195b={},_0x4ef71d={},_0x161302={'count':0x0,'rows':[]};var _0x316931=_['map'](db['ServicenowField'][_0x727a('0x27')],function(_0x3f1813){return{'name':_0x3f1813[_0x727a('0x28')],'type':_0x3f1813[_0x727a('0x29')][_0x727a('0x2a')]};});_0x4ef71d['model']=_[_0x727a('0x2b')](_0x316931,_0x727a('0x24'));_0x4ef71d[_0x727a('0x2c')]=_[_0x727a('0x2d')](_0x387517['query']);_0x4ef71d[_0x727a('0x2e')]=_['intersection'](_0x4ef71d[_0x727a('0x2f')],_0x4ef71d[_0x727a('0x2c')]);_0x42195b[_0x727a('0x30')]=_[_0x727a('0x31')](_0x4ef71d[_0x727a('0x2f')],qs[_0x727a('0x32')](_0x387517[_0x727a('0x2c')]['fields']));_0x42195b[_0x727a('0x30')]=_0x42195b[_0x727a('0x30')][_0x727a('0x33')]?_0x42195b[_0x727a('0x30')]:_0x4ef71d[_0x727a('0x2f')];if(!_0x387517[_0x727a('0x2c')][_0x727a('0x34')](_0x727a('0x35'))){_0x42195b[_0x727a('0x19')]=qs['limit'](_0x387517[_0x727a('0x2c')][_0x727a('0x19')]);_0x42195b[_0x727a('0x1c')]=qs[_0x727a('0x1c')](_0x387517['query'][_0x727a('0x1c')]);}_0x42195b['order']=qs[_0x727a('0x36')](_0x387517[_0x727a('0x2c')][_0x727a('0x36')]);_0x42195b['where']=qs[_0x727a('0x2e')](_[_0x727a('0x37')](_0x387517[_0x727a('0x2c')],_0x4ef71d[_0x727a('0x2e')]),_0x316931);if(_0x387517[_0x727a('0x2c')][_0x727a('0x38')]){_0x42195b[_0x727a('0x39')]=_[_0x727a('0x3a')](_0x42195b[_0x727a('0x39')],{'$or':_['map'](_0x316931,function(_0xa03611){if(_0xa03611[_0x727a('0x29')]!==_0x727a('0x3b')){var _0x494a8d={};_0x494a8d[_0xa03611['name']]={'$like':'%'+_0x387517[_0x727a('0x2c')][_0x727a('0x38')]+'%'};return _0x494a8d;}})});}_0x42195b=_['merge']({},_0x42195b,_0x387517[_0x727a('0x3c')]);var _0x375c35={'where':_0x42195b['where']};return db[_0x727a('0x3d')][_0x727a('0x1b')](_0x375c35)[_0x727a('0x22')](function(_0x10834b){_0x161302['count']=_0x10834b;if(_0x387517[_0x727a('0x2c')][_0x727a('0x3e')]){_0x42195b[_0x727a('0x3f')]=[{'all':!![]}];}return db[_0x727a('0x3d')][_0x727a('0x40')](_0x42195b);})[_0x727a('0x22')](function(_0x227c56){_0x161302['rows']=_0x227c56;return _0x161302;})['then'](respondWithFilteredResult(_0x2e1bdc,_0x42195b))[_0x727a('0x41')](handleError(_0x2e1bdc,null));};exports[_0x727a('0x42')]=function(_0x5b3af5,_0x4f1f58){var _0x4d2564={'raw':!![],'where':{'id':_0x5b3af5['params']['id']}},_0x46acdf={};_0x46acdf[_0x727a('0x2f')]=_[_0x727a('0x2d')](db[_0x727a('0x3d')][_0x727a('0x27')]);_0x46acdf[_0x727a('0x2c')]=_['keys'](_0x5b3af5[_0x727a('0x2c')]);_0x46acdf[_0x727a('0x2e')]=_['intersection'](_0x46acdf[_0x727a('0x2f')],_0x46acdf[_0x727a('0x2c')]);_0x4d2564[_0x727a('0x30')]=_[_0x727a('0x31')](_0x46acdf[_0x727a('0x2f')],qs[_0x727a('0x32')](_0x5b3af5[_0x727a('0x2c')][_0x727a('0x32')]));_0x4d2564['attributes']=_0x4d2564['attributes'][_0x727a('0x33')]?_0x4d2564[_0x727a('0x30')]:_0x46acdf[_0x727a('0x2f')];if(_0x5b3af5[_0x727a('0x2c')][_0x727a('0x3e')]){_0x4d2564['include']=[{'all':!![]}];}_0x4d2564=_[_0x727a('0x3a')]({},_0x4d2564,_0x5b3af5[_0x727a('0x3c')]);return db[_0x727a('0x3d')]['find'](_0x4d2564)[_0x727a('0x22')](handleEntityNotFound(_0x4f1f58,null))[_0x727a('0x22')](respondWithResult(_0x4f1f58,null))[_0x727a('0x41')](handleError(_0x4f1f58,null));};exports['create']=function(_0x512a3c,_0x3e6cdd){return db[_0x727a('0x3d')][_0x727a('0x43')](_0x512a3c['body'],{})[_0x727a('0x22')](respondWithResult(_0x3e6cdd,0xc9))[_0x727a('0x41')](handleError(_0x3e6cdd,null));};exports[_0x727a('0x21')]=function(_0x134a87,_0x5bb895){if(_0x134a87[_0x727a('0x44')]['id']){delete _0x134a87[_0x727a('0x44')]['id'];}return db[_0x727a('0x3d')]['find']({'where':{'id':_0x134a87[_0x727a('0x45')]['id']}})[_0x727a('0x22')](handleEntityNotFound(_0x5bb895,null))[_0x727a('0x22')](saveUpdates(_0x134a87[_0x727a('0x44')],null))[_0x727a('0x22')](respondWithResult(_0x5bb895,null))['catch'](handleError(_0x5bb895,null));};exports[_0x727a('0x46')]=function(_0x45f570,_0x51cb89){return db[_0x727a('0x3d')]['find']({'where':{'id':_0x45f570[_0x727a('0x45')]['id']}})[_0x727a('0x22')](handleEntityNotFound(_0x51cb89,null))['then'](removeEntity(_0x51cb89,null))['catch'](handleError(_0x51cb89,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index c83577e..7aaf9d0 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 _0x27c6=['int_servicenow_fields','idField','FieldId','lodash','util','moment','bluebird','rimraf','./intServicenowField.attributes','exports','define','ServicenowField'];(function(_0x19135f,_0x4d7711){var _0x5cdd39=function(_0x4b2c37){while(--_0x4b2c37){_0x19135f['push'](_0x19135f['shift']());}};_0x5cdd39(++_0x4d7711);}(_0x27c6,0x19b));var _0x627c=function(_0x562169,_0x3d55d8){_0x562169=_0x562169-0x0;var _0x38ea7e=_0x27c6[_0x562169];return _0x38ea7e;};'use strict';var _=require(_0x627c('0x0'));var util=require(_0x627c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x627c('0x2'));var BPromise=require(_0x627c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x627c('0x4'));var config=require('../../config/environment');var attributes=require(_0x627c('0x5'));module[_0x627c('0x6')]=function(_0x31eb91,_0x22e47f){return _0x31eb91[_0x627c('0x7')](_0x627c('0x8'),attributes,{'tableName':_0x627c('0x9'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x627c('0xa'),_0x627c('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ba1=['servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ServicenowField','int_servicenow_fields'];(function(_0x39f8b4,_0x492452){var _0x2e8275=function(_0x189436){while(--_0x189436){_0x39f8b4['push'](_0x39f8b4['shift']());}};_0x2e8275(++_0x492452);}(_0x2ba1,0xa8));var _0x12ba=function(_0x3246a9,_0x49e5b6){_0x3246a9=_0x3246a9-0x0;var _0x7fcfc5=_0x2ba1[_0x3246a9];return _0x7fcfc5;};'use strict';var _=require(_0x12ba('0x0'));var util=require(_0x12ba('0x1'));var logger=require('../../config/logger')(_0x12ba('0x2'));var moment=require(_0x12ba('0x3'));var BPromise=require(_0x12ba('0x4'));var rp=require(_0x12ba('0x5'));var fs=require('fs');var path=require(_0x12ba('0x6'));var rimraf=require('rimraf');var config=require(_0x12ba('0x7'));var attributes=require('./intServicenowField.attributes');module[_0x12ba('0x8')]=function(_0x324871,_0x2db68a){return _0x324871[_0x12ba('0x9')](_0x12ba('0xa'),attributes,{'tableName':_0x12ba('0xb'),'paranoid':![],'indexes':[{'name':_0x12ba('0xc'),'fields':[_0x12ba('0xd'),_0x12ba('0xe')],'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 96bf1dd..68d8c13 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x4dec3b,_0x1acb3d){var _0x76fe18=function(_0x5f5b17){while(--_0x5f5b17){_0x4dec3b['push'](_0x4dec3b['shift']());}};_0x76fe18(++_0x1acb3d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x30463a,_0x154f4b){var _0x2b556b=function(_0x5b0207){while(--_0x5b0207){_0x30463a['push'](_0x30463a['shift']());}};_0x2b556b(++_0x154f4b);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x38f050,_0x4b80de){_0x38f050=_0x38f050-0x0;var _0x1e03e1=_0x9ffd[_0x38f050];return _0x1e03e1;};'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']('ServicenowField,\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')]('ServicenowField,\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')]('ServicenowField,\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 diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 07b5b9f..303201b 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0xdbf591,_0xe31644){var _0x3fc6e2=function(_0x57ab84){while(--_0x57ab84){_0xdbf591['push'](_0xdbf591['shift']());}};_0x3fc6e2(++_0xe31644);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2cf420,_0x2d9df0){var _0x45d73c=function(_0x19a347){while(--_0x19a347){_0x2cf420['push'](_0x2cf420['shift']());}};_0x45d73c(++_0x2d9df0);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 4c7cbae..282dfcb 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x81ae4d,_0x385f00){var _0x3b3990=function(_0x103569){while(--_0x103569){_0x81ae4d['push'](_0x81ae4d['shift']());}};_0x3b3990(++_0x385f00);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x36151f,_0x14bb59){var _0xb04487=function(_0x3060b8){while(--_0x3060b8){_0x36151f['push'](_0x36151f['shift']());}};_0xb04487(++_0x14bb59);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index f2b1e97..57d4356 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 _0x253f=['value','test','statusCode','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmConfiguration','SugarcrmField','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_name','username','password','remoteUri','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','Calls','values','module_fields','remove','includes','label','endsWith'];(function(_0x26cf7a,_0x1f8cc5){var _0x3e1bc7=function(_0x4aff6f){while(--_0x4aff6f){_0x26cf7a['push'](_0x26cf7a['shift']());}};_0x3e1bc7(++_0x1f8cc5);}(_0x253f,0x7e));var _0xf253=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x253f[_0x50007c];return _0x5c1ec7;};'use strict';var emlformat=require(_0xf253('0x0'));var rimraf=require(_0xf253('0x1'));var zipdir=require(_0xf253('0x2'));var jsonpatch=require(_0xf253('0x3'));var rp=require(_0xf253('0x4'));var moment=require('moment');var BPromise=require(_0xf253('0x5'));var Mustache=require(_0xf253('0x6'));var util=require('util');var path=require(_0xf253('0x7'));var sox=require(_0xf253('0x8'));var csv=require(_0xf253('0x9'));var ejs=require(_0xf253('0xa'));var fs=require('fs');var fs_extra=require(_0xf253('0xb'));var _=require(_0xf253('0xc'));var squel=require(_0xf253('0xd'));var crypto=require('crypto');var jsforce=require(_0xf253('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf253('0x9'));var querystring=require('querystring');var Papa=require(_0xf253('0xf'));var Redis=require(_0xf253('0x10'));var authService=require(_0xf253('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf253('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf253('0x13'))(_0xf253('0x14'));var utils=require(_0xf253('0x15'));var config=require(_0xf253('0x16'));var licenseUtil=require(_0xf253('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf253('0x18'));function respondWithStatusCode(_0x39136b,_0x45c03e){_0x45c03e=_0x45c03e||0xcc;return function(_0x1632fe){if(_0x1632fe){return _0x39136b['sendStatus'](_0x45c03e);}return _0x39136b[_0xf253('0x19')](_0x45c03e)[_0xf253('0x1a')]();};}function respondWithResult(_0x56e163,_0x3fac02){_0x3fac02=_0x3fac02||0xc8;return function(_0x508626){if(_0x508626){return _0x56e163['status'](_0x3fac02)[_0xf253('0x1b')](_0x508626);}};}function respondWithFilteredResult(_0x6f36b4,_0x5b2924){return function(_0x5e9b2e){if(_0x5e9b2e){var _0x3fb07f=typeof _0x5b2924[_0xf253('0x1c')]===_0xf253('0x1d')&&typeof _0x5b2924[_0xf253('0x1e')]===_0xf253('0x1d');var _0x1bbab2=_0x5e9b2e[_0xf253('0x1f')];var _0x20e5ef=_0x3fb07f?0x0:_0x5b2924[_0xf253('0x1c')];var _0x26ea9a=_0x3fb07f?_0x5e9b2e[_0xf253('0x1f')]:_0x5b2924[_0xf253('0x1c')]+_0x5b2924[_0xf253('0x1e')];var _0x413ad7;if(_0x26ea9a>=_0x1bbab2){_0x26ea9a=_0x1bbab2;_0x413ad7=0xc8;}else{_0x413ad7=0xce;}_0x6f36b4[_0xf253('0x19')](_0x413ad7);return _0x6f36b4[_0xf253('0x20')](_0xf253('0x21'),_0x20e5ef+'-'+_0x26ea9a+'/'+_0x1bbab2)[_0xf253('0x1b')](_0x5e9b2e);}return null;};}function patchUpdates(_0x59784c){return function(_0x2f84ef){try{jsonpatch[_0xf253('0x22')](_0x2f84ef,_0x59784c,!![]);}catch(_0x4182f2){return BPromise[_0xf253('0x23')](_0x4182f2);}return _0x2f84ef[_0xf253('0x24')]();};}function saveUpdates(_0x1c5e35,_0x40b625){return function(_0x956dff){if(_0x956dff){return _0x956dff[_0xf253('0x25')](_0x1c5e35)[_0xf253('0x26')](function(_0x78e030){return _0x78e030;});}return null;};}function removeEntity(_0x44d604,_0x1f68cc){return function(_0xbc8c62){if(_0xbc8c62){return _0xbc8c62[_0xf253('0x27')]()[_0xf253('0x26')](function(){_0x44d604[_0xf253('0x19')](0xcc)[_0xf253('0x1a')]();});}};}function handleEntityNotFound(_0x4a39e5,_0x4f7696){return function(_0x56f968){if(!_0x56f968){_0x4a39e5[_0xf253('0x28')](0x194);}return _0x56f968;};}function handleError(_0x504b3a,_0x56c551){_0x56c551=_0x56c551||0x1f4;return function(_0x101b45){logger[_0xf253('0x29')](_0x101b45['stack']);if(_0x101b45[_0xf253('0x2a')]){delete _0x101b45[_0xf253('0x2a')];}_0x504b3a['status'](_0x56c551)[_0xf253('0x2b')](_0x101b45);};}exports[_0xf253('0x2c')]=function(_0xc81491,_0x41c3b7){var _0x238a81={},_0x52359e={},_0x14404a={'count':0x0,'rows':[]};var _0x270c28=_[_0xf253('0x2d')](db[_0xf253('0x2e')][_0xf253('0x2f')],function(_0x5e360c){return{'name':_0x5e360c[_0xf253('0x30')],'type':_0x5e360c[_0xf253('0x31')][_0xf253('0x32')]};});_0x52359e[_0xf253('0x33')]=_['map'](_0x270c28,_0xf253('0x2a'));_0x52359e[_0xf253('0x34')]=_['keys'](_0xc81491[_0xf253('0x34')]);_0x52359e[_0xf253('0x35')]=_[_0xf253('0x36')](_0x52359e[_0xf253('0x33')],_0x52359e[_0xf253('0x34')]);_0x238a81[_0xf253('0x37')]=_[_0xf253('0x36')](_0x52359e[_0xf253('0x33')],qs[_0xf253('0x38')](_0xc81491[_0xf253('0x34')][_0xf253('0x38')]));_0x238a81['attributes']=_0x238a81[_0xf253('0x37')][_0xf253('0x39')]?_0x238a81[_0xf253('0x37')]:_0x52359e[_0xf253('0x33')];if(!_0xc81491['query']['hasOwnProperty'](_0xf253('0x3a'))){_0x238a81['limit']=qs['limit'](_0xc81491[_0xf253('0x34')]['limit']);_0x238a81['offset']=qs[_0xf253('0x1c')](_0xc81491[_0xf253('0x34')][_0xf253('0x1c')]);}_0x238a81[_0xf253('0x3b')]=qs[_0xf253('0x3c')](_0xc81491[_0xf253('0x34')][_0xf253('0x3c')]);_0x238a81[_0xf253('0x3d')]=qs[_0xf253('0x35')](_[_0xf253('0x3e')](_0xc81491[_0xf253('0x34')],_0x52359e[_0xf253('0x35')]),_0x270c28);if(_0xc81491[_0xf253('0x34')][_0xf253('0x3f')]){_0x238a81[_0xf253('0x3d')]=_['merge'](_0x238a81[_0xf253('0x3d')],{'$or':_[_0xf253('0x2d')](_0x270c28,function(_0x36102d){if(_0x36102d['type']!==_0xf253('0x40')){var _0x38f5ed={};_0x38f5ed[_0x36102d[_0xf253('0x2a')]]={'$like':'%'+_0xc81491[_0xf253('0x34')][_0xf253('0x3f')]+'%'};return _0x38f5ed;}})});}_0x238a81=_[_0xf253('0x41')]({},_0x238a81,_0xc81491[_0xf253('0x42')]);var _0x5dc622={'where':_0x238a81[_0xf253('0x3d')]};return db[_0xf253('0x2e')]['count'](_0x5dc622)['then'](function(_0x32553e){_0x14404a[_0xf253('0x1f')]=_0x32553e;if(_0xc81491['query'][_0xf253('0x43')]){_0x238a81[_0xf253('0x44')]=[{'all':!![]}];}return db[_0xf253('0x2e')][_0xf253('0x45')](_0x238a81);})[_0xf253('0x26')](function(_0x49641b){_0x14404a['rows']=_0x49641b;return _0x14404a;})[_0xf253('0x26')](respondWithFilteredResult(_0x41c3b7,_0x238a81))[_0xf253('0x46')](handleError(_0x41c3b7,null));};exports[_0xf253('0x47')]=function(_0x5a0ded,_0x48870c){var _0x1fca22={'raw':![],'where':{'id':_0x5a0ded[_0xf253('0x48')]['id']}},_0xa2e8d2={};_0xa2e8d2[_0xf253('0x33')]=_[_0xf253('0x49')](db['SugarcrmAccount'][_0xf253('0x2f')]);_0xa2e8d2['query']=_[_0xf253('0x49')](_0x5a0ded[_0xf253('0x34')]);_0xa2e8d2[_0xf253('0x35')]=_[_0xf253('0x36')](_0xa2e8d2[_0xf253('0x33')],_0xa2e8d2[_0xf253('0x34')]);_0x1fca22[_0xf253('0x37')]=_[_0xf253('0x36')](_0xa2e8d2[_0xf253('0x33')],qs[_0xf253('0x38')](_0x5a0ded[_0xf253('0x34')][_0xf253('0x38')]));_0x1fca22[_0xf253('0x37')]=_0x1fca22[_0xf253('0x37')][_0xf253('0x39')]?_0x1fca22[_0xf253('0x37')]:_0xa2e8d2[_0xf253('0x33')];if(_0x5a0ded[_0xf253('0x34')]['includeAll']){_0x1fca22[_0xf253('0x44')]=[{'all':!![]}];}_0x1fca22=_[_0xf253('0x41')]({},_0x1fca22,_0x5a0ded[_0xf253('0x42')]);return db[_0xf253('0x2e')][_0xf253('0x4a')](_0x1fca22)[_0xf253('0x26')](handleEntityNotFound(_0x48870c,null))['then'](respondWithResult(_0x48870c,null))[_0xf253('0x46')](handleError(_0x48870c,null));};exports['create']=function(_0x2ea4f9,_0x399ce3){return db['SugarcrmAccount'][_0xf253('0x4b')](_0x2ea4f9[_0xf253('0x4c')],{})[_0xf253('0x26')](respondWithResult(_0x399ce3,0xc9))['catch'](handleError(_0x399ce3,null));};exports[_0xf253('0x25')]=function(_0xc8a817,_0x2ac9cd){if(_0xc8a817[_0xf253('0x4c')]['id']){delete _0xc8a817['body']['id'];}return db[_0xf253('0x2e')]['find']({'where':{'id':_0xc8a817[_0xf253('0x48')]['id']}})[_0xf253('0x26')](handleEntityNotFound(_0x2ac9cd,null))['then'](saveUpdates(_0xc8a817['body'],null))['then'](respondWithResult(_0x2ac9cd,null))[_0xf253('0x46')](handleError(_0x2ac9cd,null));};exports[_0xf253('0x27')]=function(_0x11082b,_0x3b5a24){return db['SugarcrmAccount']['find']({'where':{'id':_0x11082b[_0xf253('0x48')]['id']}})[_0xf253('0x26')](handleEntityNotFound(_0x3b5a24,null))[_0xf253('0x26')](removeEntity(_0x3b5a24,null))['catch'](handleError(_0x3b5a24,null));};exports[_0xf253('0x4d')]=function(_0x81b1c0,_0x28b728,_0x38f6ce){var _0x5deb29={};var _0xf64ee4={};var _0x8da8fa;var _0xada714;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x81b1c0[_0xf253('0x48')]['id']}})[_0xf253('0x26')](handleEntityNotFound(_0x28b728,null))[_0xf253('0x26')](function(_0x4664e0){if(_0x4664e0){_0x8da8fa=_0x4664e0;_0xf64ee4[_0xf253('0x33')]=_['keys'](db['SugarcrmConfiguration']['rawAttributes']);_0xf64ee4[_0xf253('0x34')]=_[_0xf253('0x49')](_0x81b1c0['query']);_0xf64ee4[_0xf253('0x35')]=_[_0xf253('0x36')](_0xf64ee4[_0xf253('0x33')],_0xf64ee4[_0xf253('0x34')]);_0x5deb29[_0xf253('0x37')]=_[_0xf253('0x36')](_0xf64ee4['model'],qs['fields'](_0x81b1c0['query'][_0xf253('0x38')]));_0x5deb29['attributes']=_0x5deb29[_0xf253('0x37')][_0xf253('0x39')]?_0x5deb29[_0xf253('0x37')]:_0xf64ee4['model'];_0x5deb29[_0xf253('0x3b')]=qs[_0xf253('0x3c')](_0x81b1c0['query'][_0xf253('0x3c')]);_0x5deb29[_0xf253('0x3d')]=qs[_0xf253('0x35')](_[_0xf253('0x3e')](_0x81b1c0[_0xf253('0x34')],_0xf64ee4['filters']));if(_0x81b1c0['query'][_0xf253('0x3f')]){_0x5deb29[_0xf253('0x3d')]=_['merge'](_0x5deb29[_0xf253('0x3d')],{'$or':_[_0xf253('0x2d')](_0x5deb29[_0xf253('0x37')],function(_0x1f7aa0){var _0x4f75f1={};_0x4f75f1[_0x1f7aa0]={'$like':'%'+_0x81b1c0[_0xf253('0x34')][_0xf253('0x3f')]+'%'};return _0x4f75f1;})});}_0x5deb29=_[_0xf253('0x41')]({},_0x5deb29,_0x81b1c0[_0xf253('0x42')]);return _0x8da8fa[_0xf253('0x4d')](_0x5deb29);}})['then'](function(_0x143035){if(_0x143035){_0xada714=_0x143035[_0xf253('0x39')];if(!_0x81b1c0[_0xf253('0x34')]['hasOwnProperty'](_0xf253('0x3a'))){_0x5deb29[_0xf253('0x1e')]=qs[_0xf253('0x1e')](_0x81b1c0[_0xf253('0x34')][_0xf253('0x1e')]);_0x5deb29['offset']=qs[_0xf253('0x1c')](_0x81b1c0[_0xf253('0x34')][_0xf253('0x1c')]);}return _0x8da8fa[_0xf253('0x4d')](_0x5deb29);}})[_0xf253('0x26')](function(_0x23c0e3){if(_0x23c0e3){return _0x23c0e3?{'count':_0xada714,'rows':_0x23c0e3}:null;}})[_0xf253('0x26')](respondWithResult(_0x28b728,null))[_0xf253('0x46')](handleError(_0x28b728,null));};exports['addConfiguration']=function(_0x43c561,_0x321436,_0x1490bf){if(_0x43c561['body']['id']){delete _0x43c561[_0xf253('0x4c')]['id'];}return db[_0xf253('0x2e')][_0xf253('0x4e')]({'where':{'id':_0x43c561['params']['id']}})[_0xf253('0x26')](handleEntityNotFound(_0x321436,null))[_0xf253('0x26')](function(_0x58ec01){if(_0x58ec01){_0x43c561[_0xf253('0x4c')][_0xf253('0x4f')]=_0x58ec01['id'];_0x43c561[_0xf253('0x4c')][_0xf253('0x50')]=integrations[_0xf253('0x51')](_0x43c561[_0xf253('0x4c')][_0xf253('0x52')],_0x43c561[_0xf253('0x4c')][_0xf253('0x31')]);_0x43c561['body']['Descriptions']=integrations[_0xf253('0x53')](_0x43c561[_0xf253('0x4c')][_0xf253('0x52')],_0x43c561[_0xf253('0x4c')][_0xf253('0x31')]);return db[_0xf253('0x54')][_0xf253('0x4b')](_0x43c561['body'],{'include':[{'model':db[_0xf253('0x55')],'as':_0xf253('0x50')},{'model':db[_0xf253('0x55')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x321436,null))['catch'](handleError(_0x321436,null));};exports['getFields']=function(_0x2fab17,_0xe4495b,_0x45136e){var _0x4e5248='';var _0x15e983=['id','name',_0xf253('0x56'),_0xf253('0x57'),_0xf253('0x58'),'date_start',_0xf253('0x59'),_0xf253('0x5a'),_0xf253('0x5b'),'parent_type',_0xf253('0x5c'),'direction'];return db[_0xf253('0x2e')][_0xf253('0x4e')]({'where':{'id':_0x2fab17['params']['id']},'attributes':['id',_0xf253('0x5d'),_0xf253('0x5e'),'remoteUri']})['then'](handleEntityNotFound(_0xe4495b,null))[_0xf253('0x26')](function(_0x4799b9){if(_0x4799b9){_0x4e5248=_0x4799b9[_0xf253('0x5f')];var _0x10b3a6=_0x4e5248['slice'](-0x1);if(_0x10b3a6==='/'){_0x4e5248=_0x4e5248[_0xf253('0x60')](0x0,_0x4e5248[_0xf253('0x61')](_0x10b3a6));}return rp({'method':_0xf253('0x62'),'uri':util[_0xf253('0x63')](_0xf253('0x64'),_0x4e5248,_0xf253('0x65')),'json':!![],'form':{'method':_0xf253('0x66'),'input_type':'JSON','response_type':_0xf253('0x67'),'rest_data':JSON[_0xf253('0x68')]({'user_auth':{'user_name':_0x4799b9['username'],'password':_0x4799b9[_0xf253('0x5e')],'encryption':_0xf253('0x69')},'application':_0xf253('0x6a')})}});}})[_0xf253('0x26')](function(_0x54276c){if(_0x54276c&&_0x54276c[_0xf253('0x2a')]!==_0xf253('0x6b')&&_0x54276c[_0xf253('0x2a')]!==_0xf253('0x6c')){return rp({'method':_0xf253('0x62'),'uri':util['format'](_0xf253('0x64'),_0x4e5248,_0xf253('0x65')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xf253('0x67'),'response_type':_0xf253('0x67'),'rest_data':JSON[_0xf253('0x68')]({'session':_0x54276c['id'],'module_name':_0xf253('0x6d')})}})['then'](function(_0xcfd9fa){if(_0xcfd9fa){var _0x5601a4=_[_0xf253('0x6e')](_0xcfd9fa[_0xf253('0x6f')]);_[_0xf253('0x70')](_0x5601a4,function(_0x57d688){return _0x15e983[_0xf253('0x71')](_0x57d688[_0xf253('0x2a')]);});return{'count':_0x5601a4['length'],'rows':_[_0xf253('0x2d')](_0x5601a4,function(_0x45b2c4){return{'id':_0x45b2c4[_0xf253('0x2a')],'name':_0x45b2c4[_0xf253('0x72')],'custom':_[_0xf253('0x73')](_0x45b2c4[_0xf253('0x2a')],'_c')?!![]:![],'options':_0x45b2c4[_0xf253('0x42')]?_[_0xf253('0x2d')](_[_0xf253('0x6e')](_0x45b2c4['options']),function(_0x1fca0a){return{'name':_0x1fca0a[_0xf253('0x74')],'value':_0x1fca0a['name']};}):[]};})};}})[_0xf253('0x26')](respondWithResult(_0xe4495b,null))[_0xf253('0x46')](function(_0x599cb0){var _0x265faf=_0x2fab17[_0xf253('0x34')][_0xf253('0x75')]?0x1f4:_0x599cb0[_0xf253('0x76')]||0x1f4;logger[_0xf253('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0xf253('0x77'),_0x265faf,JSON[_0xf253('0x68')](_0x599cb0));delete _0x599cb0['name'];if(_0x265faf===0x191){_0x265faf=0x190;}_0xe4495b['status'](_0x265faf)[_0xf253('0x2b')](_0x2fab17[_0xf253('0x34')][_0xf253('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x599cb0['statusCode']}:_0x599cb0);});}else{var _0x4d6e5d=0x1f4;_0xe4495b[_0xf253('0x19')](_0x4d6e5d)[_0xf253('0x2b')]({'message':_0xf253('0x78'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xd6b2=['POST','format','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','%s%s','get_module_fields','Calls','module_fields','remove','label','endsWith','values','value','test','statusCode','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','destroy','then','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','fields','length','options','find','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','password','remoteUri','slice','substring'];(function(_0x2baf85,_0x2a59a1){var _0x2ca44f=function(_0x4f3121){while(--_0x4f3121){_0x2baf85['push'](_0x2baf85['shift']());}};_0x2ca44f(++_0x2a59a1);}(_0xd6b2,0x18f));var _0x2d6b=function(_0x463167,_0x82bb2c){_0x463167=_0x463167-0x0;var _0x80b722=_0xd6b2[_0x463167];return _0x80b722;};'use strict';var emlformat=require(_0x2d6b('0x0'));var rimraf=require(_0x2d6b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d6b('0x2'));var rp=require('request-promise');var moment=require(_0x2d6b('0x3'));var BPromise=require(_0x2d6b('0x4'));var Mustache=require(_0x2d6b('0x5'));var util=require(_0x2d6b('0x6'));var path=require(_0x2d6b('0x7'));var sox=require(_0x2d6b('0x8'));var csv=require(_0x2d6b('0x9'));var ejs=require(_0x2d6b('0xa'));var fs=require('fs');var fs_extra=require(_0x2d6b('0xb'));var _=require('lodash');var squel=require(_0x2d6b('0xc'));var crypto=require(_0x2d6b('0xd'));var jsforce=require(_0x2d6b('0xe'));var deskjs=require(_0x2d6b('0xf'));var toCsv=require(_0x2d6b('0x9'));var querystring=require(_0x2d6b('0x10'));var Papa=require(_0x2d6b('0x11'));var Redis=require(_0x2d6b('0x12'));var authService=require(_0x2d6b('0x13'));var qs=require(_0x2d6b('0x14'));var as=require(_0x2d6b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d6b('0x16'))(_0x2d6b('0x17'));var utils=require(_0x2d6b('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2d6b('0x19'))['db'];var integrations=require(_0x2d6b('0x1a'));function respondWithStatusCode(_0x22d94e,_0x504096){_0x504096=_0x504096||0xcc;return function(_0x5d4e16){if(_0x5d4e16){return _0x22d94e[_0x2d6b('0x1b')](_0x504096);}return _0x22d94e[_0x2d6b('0x1c')](_0x504096)[_0x2d6b('0x1d')]();};}function respondWithResult(_0x951b7a,_0x4d7d9e){_0x4d7d9e=_0x4d7d9e||0xc8;return function(_0x3d2194){if(_0x3d2194){return _0x951b7a[_0x2d6b('0x1c')](_0x4d7d9e)[_0x2d6b('0x1e')](_0x3d2194);}};}function respondWithFilteredResult(_0x15da00,_0x4ab769){return function(_0x755167){if(_0x755167){var _0x57f56c=typeof _0x4ab769[_0x2d6b('0x1f')]==='undefined'&&typeof _0x4ab769[_0x2d6b('0x20')]===_0x2d6b('0x21');var _0x12e026=_0x755167[_0x2d6b('0x22')];var _0x18275b=_0x57f56c?0x0:_0x4ab769[_0x2d6b('0x1f')];var _0xcd0a4d=_0x57f56c?_0x755167[_0x2d6b('0x22')]:_0x4ab769[_0x2d6b('0x1f')]+_0x4ab769[_0x2d6b('0x20')];var _0x38a831;if(_0xcd0a4d>=_0x12e026){_0xcd0a4d=_0x12e026;_0x38a831=0xc8;}else{_0x38a831=0xce;}_0x15da00['status'](_0x38a831);return _0x15da00[_0x2d6b('0x23')]('Content-Range',_0x18275b+'-'+_0xcd0a4d+'/'+_0x12e026)[_0x2d6b('0x1e')](_0x755167);}return null;};}function patchUpdates(_0x921fd4){return function(_0x3cc943){try{jsonpatch[_0x2d6b('0x24')](_0x3cc943,_0x921fd4,!![]);}catch(_0x21e871){return BPromise[_0x2d6b('0x25')](_0x21e871);}return _0x3cc943[_0x2d6b('0x26')]();};}function saveUpdates(_0x23a671,_0x566697){return function(_0x4f9a6d){if(_0x4f9a6d){return _0x4f9a6d['update'](_0x23a671)['then'](function(_0x5b7412){return _0x5b7412;});}return null;};}function removeEntity(_0x37fdfe,_0x49885a){return function(_0x309991){if(_0x309991){return _0x309991[_0x2d6b('0x27')]()[_0x2d6b('0x28')](function(){_0x37fdfe[_0x2d6b('0x1c')](0xcc)[_0x2d6b('0x1d')]();});}};}function handleEntityNotFound(_0x179a91,_0x15c8c3){return function(_0x59fcee){if(!_0x59fcee){_0x179a91['sendStatus'](0x194);}return _0x59fcee;};}function handleError(_0x520c27,_0x2e4d3d){_0x2e4d3d=_0x2e4d3d||0x1f4;return function(_0x1105f6){logger[_0x2d6b('0x29')](_0x1105f6[_0x2d6b('0x2a')]);if(_0x1105f6[_0x2d6b('0x2b')]){delete _0x1105f6['name'];}_0x520c27[_0x2d6b('0x1c')](_0x2e4d3d)[_0x2d6b('0x2c')](_0x1105f6);};}exports[_0x2d6b('0x2d')]=function(_0x2598b2,_0x4578da){var _0x31bf1c={},_0x4e460b={},_0x21d571={'count':0x0,'rows':[]};var _0x58967a=_[_0x2d6b('0x2e')](db[_0x2d6b('0x2f')][_0x2d6b('0x30')],function(_0x255c6e){return{'name':_0x255c6e[_0x2d6b('0x31')],'type':_0x255c6e[_0x2d6b('0x32')][_0x2d6b('0x33')]};});_0x4e460b[_0x2d6b('0x34')]=_[_0x2d6b('0x2e')](_0x58967a,'name');_0x4e460b['query']=_[_0x2d6b('0x35')](_0x2598b2[_0x2d6b('0x36')]);_0x4e460b[_0x2d6b('0x37')]=_[_0x2d6b('0x38')](_0x4e460b[_0x2d6b('0x34')],_0x4e460b[_0x2d6b('0x36')]);_0x31bf1c[_0x2d6b('0x39')]=_['intersection'](_0x4e460b['model'],qs['fields'](_0x2598b2[_0x2d6b('0x36')]['fields']));_0x31bf1c['attributes']=_0x31bf1c['attributes']['length']?_0x31bf1c[_0x2d6b('0x39')]:_0x4e460b[_0x2d6b('0x34')];if(!_0x2598b2[_0x2d6b('0x36')]['hasOwnProperty'](_0x2d6b('0x3a'))){_0x31bf1c['limit']=qs[_0x2d6b('0x20')](_0x2598b2['query'][_0x2d6b('0x20')]);_0x31bf1c[_0x2d6b('0x1f')]=qs[_0x2d6b('0x1f')](_0x2598b2[_0x2d6b('0x36')]['offset']);}_0x31bf1c[_0x2d6b('0x3b')]=qs[_0x2d6b('0x3c')](_0x2598b2[_0x2d6b('0x36')][_0x2d6b('0x3c')]);_0x31bf1c[_0x2d6b('0x3d')]=qs[_0x2d6b('0x37')](_['pick'](_0x2598b2[_0x2d6b('0x36')],_0x4e460b[_0x2d6b('0x37')]),_0x58967a);if(_0x2598b2['query'][_0x2d6b('0x3e')]){_0x31bf1c[_0x2d6b('0x3d')]=_[_0x2d6b('0x3f')](_0x31bf1c[_0x2d6b('0x3d')],{'$or':_[_0x2d6b('0x2e')](_0x58967a,function(_0x349fe7){if(_0x349fe7[_0x2d6b('0x32')]!==_0x2d6b('0x40')){var _0x430651={};_0x430651[_0x349fe7[_0x2d6b('0x2b')]]={'$like':'%'+_0x2598b2[_0x2d6b('0x36')]['filter']+'%'};return _0x430651;}})});}_0x31bf1c=_[_0x2d6b('0x3f')]({},_0x31bf1c,_0x2598b2['options']);var _0x450579={'where':_0x31bf1c[_0x2d6b('0x3d')]};return db[_0x2d6b('0x2f')][_0x2d6b('0x22')](_0x450579)['then'](function(_0x2ef871){_0x21d571[_0x2d6b('0x22')]=_0x2ef871;if(_0x2598b2[_0x2d6b('0x36')][_0x2d6b('0x41')]){_0x31bf1c[_0x2d6b('0x42')]=[{'all':!![]}];}return db[_0x2d6b('0x2f')]['findAll'](_0x31bf1c);})[_0x2d6b('0x28')](function(_0x2a9b11){_0x21d571[_0x2d6b('0x43')]=_0x2a9b11;return _0x21d571;})['then'](respondWithFilteredResult(_0x4578da,_0x31bf1c))[_0x2d6b('0x44')](handleError(_0x4578da,null));};exports[_0x2d6b('0x45')]=function(_0x7b74ac,_0x239039){var _0x479153={'raw':![],'where':{'id':_0x7b74ac[_0x2d6b('0x46')]['id']}},_0x212809={};_0x212809[_0x2d6b('0x34')]=_['keys'](db[_0x2d6b('0x2f')][_0x2d6b('0x30')]);_0x212809[_0x2d6b('0x36')]=_[_0x2d6b('0x35')](_0x7b74ac[_0x2d6b('0x36')]);_0x212809[_0x2d6b('0x37')]=_[_0x2d6b('0x38')](_0x212809[_0x2d6b('0x34')],_0x212809[_0x2d6b('0x36')]);_0x479153[_0x2d6b('0x39')]=_[_0x2d6b('0x38')](_0x212809[_0x2d6b('0x34')],qs[_0x2d6b('0x47')](_0x7b74ac[_0x2d6b('0x36')][_0x2d6b('0x47')]));_0x479153[_0x2d6b('0x39')]=_0x479153[_0x2d6b('0x39')][_0x2d6b('0x48')]?_0x479153[_0x2d6b('0x39')]:_0x212809['model'];if(_0x7b74ac[_0x2d6b('0x36')][_0x2d6b('0x41')]){_0x479153['include']=[{'all':!![]}];}_0x479153=_['merge']({},_0x479153,_0x7b74ac[_0x2d6b('0x49')]);return db[_0x2d6b('0x2f')][_0x2d6b('0x4a')](_0x479153)[_0x2d6b('0x28')](handleEntityNotFound(_0x239039,null))[_0x2d6b('0x28')](respondWithResult(_0x239039,null))[_0x2d6b('0x44')](handleError(_0x239039,null));};exports[_0x2d6b('0x4b')]=function(_0xdfe5b7,_0x4513e4){return db['SugarcrmAccount']['create'](_0xdfe5b7[_0x2d6b('0x4c')],{})['then'](respondWithResult(_0x4513e4,0xc9))[_0x2d6b('0x44')](handleError(_0x4513e4,null));};exports[_0x2d6b('0x4d')]=function(_0x139736,_0x19079b){if(_0x139736[_0x2d6b('0x4c')]['id']){delete _0x139736[_0x2d6b('0x4c')]['id'];}return db[_0x2d6b('0x2f')][_0x2d6b('0x4a')]({'where':{'id':_0x139736[_0x2d6b('0x46')]['id']}})[_0x2d6b('0x28')](handleEntityNotFound(_0x19079b,null))[_0x2d6b('0x28')](saveUpdates(_0x139736['body'],null))[_0x2d6b('0x28')](respondWithResult(_0x19079b,null))[_0x2d6b('0x44')](handleError(_0x19079b,null));};exports[_0x2d6b('0x27')]=function(_0x907a6c,_0x264a3b){return db[_0x2d6b('0x2f')][_0x2d6b('0x4a')]({'where':{'id':_0x907a6c['params']['id']}})[_0x2d6b('0x28')](handleEntityNotFound(_0x264a3b,null))[_0x2d6b('0x28')](removeEntity(_0x264a3b,null))[_0x2d6b('0x44')](handleError(_0x264a3b,null));};exports[_0x2d6b('0x4e')]=function(_0x47ab7c,_0x5292df,_0x5bde75){var _0x16d397={};var _0x537091={};var _0x1f18e7;var _0x4f2de7;return db[_0x2d6b('0x2f')][_0x2d6b('0x4f')]({'where':{'id':_0x47ab7c['params']['id']}})[_0x2d6b('0x28')](handleEntityNotFound(_0x5292df,null))[_0x2d6b('0x28')](function(_0x3f0e00){if(_0x3f0e00){_0x1f18e7=_0x3f0e00;_0x537091['model']=_[_0x2d6b('0x35')](db[_0x2d6b('0x50')]['rawAttributes']);_0x537091[_0x2d6b('0x36')]=_['keys'](_0x47ab7c[_0x2d6b('0x36')]);_0x537091[_0x2d6b('0x37')]=_[_0x2d6b('0x38')](_0x537091[_0x2d6b('0x34')],_0x537091['query']);_0x16d397[_0x2d6b('0x39')]=_['intersection'](_0x537091['model'],qs['fields'](_0x47ab7c[_0x2d6b('0x36')]['fields']));_0x16d397[_0x2d6b('0x39')]=_0x16d397[_0x2d6b('0x39')][_0x2d6b('0x48')]?_0x16d397['attributes']:_0x537091[_0x2d6b('0x34')];_0x16d397[_0x2d6b('0x3b')]=qs['sort'](_0x47ab7c[_0x2d6b('0x36')][_0x2d6b('0x3c')]);_0x16d397[_0x2d6b('0x3d')]=qs[_0x2d6b('0x37')](_[_0x2d6b('0x51')](_0x47ab7c[_0x2d6b('0x36')],_0x537091[_0x2d6b('0x37')]));if(_0x47ab7c['query'][_0x2d6b('0x3e')]){_0x16d397[_0x2d6b('0x3d')]=_['merge'](_0x16d397[_0x2d6b('0x3d')],{'$or':_[_0x2d6b('0x2e')](_0x16d397['attributes'],function(_0x2180ac){var _0x3b3ceb={};_0x3b3ceb[_0x2180ac]={'$like':'%'+_0x47ab7c[_0x2d6b('0x36')][_0x2d6b('0x3e')]+'%'};return _0x3b3ceb;})});}_0x16d397=_[_0x2d6b('0x3f')]({},_0x16d397,_0x47ab7c[_0x2d6b('0x49')]);return _0x1f18e7['getConfigurations'](_0x16d397);}})['then'](function(_0xee1832){if(_0xee1832){_0x4f2de7=_0xee1832[_0x2d6b('0x48')];if(!_0x47ab7c[_0x2d6b('0x36')][_0x2d6b('0x52')]('nolimit')){_0x16d397[_0x2d6b('0x20')]=qs['limit'](_0x47ab7c['query'][_0x2d6b('0x20')]);_0x16d397[_0x2d6b('0x1f')]=qs[_0x2d6b('0x1f')](_0x47ab7c[_0x2d6b('0x36')]['offset']);}return _0x1f18e7[_0x2d6b('0x4e')](_0x16d397);}})['then'](function(_0x4687e9){if(_0x4687e9){return _0x4687e9?{'count':_0x4f2de7,'rows':_0x4687e9}:null;}})['then'](respondWithResult(_0x5292df,null))[_0x2d6b('0x44')](handleError(_0x5292df,null));};exports[_0x2d6b('0x53')]=function(_0x2c5026,_0xc031c1,_0x44c22e){if(_0x2c5026[_0x2d6b('0x4c')]['id']){delete _0x2c5026['body']['id'];}return db[_0x2d6b('0x2f')][_0x2d6b('0x4f')]({'where':{'id':_0x2c5026[_0x2d6b('0x46')]['id']}})[_0x2d6b('0x28')](handleEntityNotFound(_0xc031c1,null))[_0x2d6b('0x28')](function(_0x5e2ffa){if(_0x5e2ffa){_0x2c5026['body'][_0x2d6b('0x54')]=_0x5e2ffa['id'];_0x2c5026[_0x2d6b('0x4c')][_0x2d6b('0x55')]=integrations[_0x2d6b('0x56')](_0x2c5026['body'][_0x2d6b('0x57')],_0x2c5026[_0x2d6b('0x4c')][_0x2d6b('0x32')]);_0x2c5026[_0x2d6b('0x4c')]['Descriptions']=integrations[_0x2d6b('0x58')](_0x2c5026['body'][_0x2d6b('0x57')],_0x2c5026[_0x2d6b('0x4c')][_0x2d6b('0x32')]);return db['SugarcrmConfiguration'][_0x2d6b('0x4b')](_0x2c5026[_0x2d6b('0x4c')],{'include':[{'model':db[_0x2d6b('0x59')],'as':_0x2d6b('0x55')},{'model':db[_0x2d6b('0x59')],'as':_0x2d6b('0x5a')}]});}return null;})[_0x2d6b('0x28')](respondWithResult(_0xc031c1,null))[_0x2d6b('0x44')](handleError(_0xc031c1,null));};exports[_0x2d6b('0x5b')]=function(_0x1b92c9,_0x5aaaa3,_0x253743){var _0x26b225='';var _0x4a282b=['id',_0x2d6b('0x2b'),_0x2d6b('0x5c'),_0x2d6b('0x5d'),_0x2d6b('0x5e'),_0x2d6b('0x5f'),_0x2d6b('0x60'),_0x2d6b('0x61'),'parent_id',_0x2d6b('0x62'),_0x2d6b('0x63'),_0x2d6b('0x64')];return db['SugarcrmAccount'][_0x2d6b('0x4f')]({'where':{'id':_0x1b92c9[_0x2d6b('0x46')]['id']},'attributes':['id','username',_0x2d6b('0x65'),_0x2d6b('0x66')]})[_0x2d6b('0x28')](handleEntityNotFound(_0x5aaaa3,null))[_0x2d6b('0x28')](function(_0x39fbc1){if(_0x39fbc1){_0x26b225=_0x39fbc1[_0x2d6b('0x66')];var _0x3acde3=_0x26b225[_0x2d6b('0x67')](-0x1);if(_0x3acde3==='/'){_0x26b225=_0x26b225[_0x2d6b('0x68')](0x0,_0x26b225['lastIndexOf'](_0x3acde3));}return rp({'method':_0x2d6b('0x69'),'uri':util[_0x2d6b('0x6a')]('%s%s',_0x26b225,_0x2d6b('0x6b')),'json':!![],'form':{'method':_0x2d6b('0x6c'),'input_type':_0x2d6b('0x6d'),'response_type':'JSON','rest_data':JSON[_0x2d6b('0x6e')]({'user_auth':{'user_name':_0x39fbc1['username'],'password':_0x39fbc1['password'],'encryption':_0x2d6b('0x6f')},'application':_0x2d6b('0x70')})}});}})['then'](function(_0x52f8ed){if(_0x52f8ed&&_0x52f8ed[_0x2d6b('0x2b')]!==_0x2d6b('0x71')&&_0x52f8ed[_0x2d6b('0x2b')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0x2d6b('0x6a')](_0x2d6b('0x72'),_0x26b225,_0x2d6b('0x6b')),'json':!![],'form':{'method':_0x2d6b('0x73'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x2d6b('0x6e')]({'session':_0x52f8ed['id'],'module_name':_0x2d6b('0x74')})}})[_0x2d6b('0x28')](function(_0x353e67){if(_0x353e67){var _0x2d0ec0=_['values'](_0x353e67[_0x2d6b('0x75')]);_[_0x2d6b('0x76')](_0x2d0ec0,function(_0x452277){return _0x4a282b['includes'](_0x452277[_0x2d6b('0x2b')]);});return{'count':_0x2d0ec0['length'],'rows':_[_0x2d6b('0x2e')](_0x2d0ec0,function(_0x295b6c){return{'id':_0x295b6c[_0x2d6b('0x2b')],'name':_0x295b6c[_0x2d6b('0x77')],'custom':_[_0x2d6b('0x78')](_0x295b6c[_0x2d6b('0x2b')],'_c')?!![]:![],'options':_0x295b6c[_0x2d6b('0x49')]?_[_0x2d6b('0x2e')](_[_0x2d6b('0x79')](_0x295b6c[_0x2d6b('0x49')]),function(_0x431fe0){return{'name':_0x431fe0[_0x2d6b('0x7a')],'value':_0x431fe0[_0x2d6b('0x2b')]};}):[]};})};}})[_0x2d6b('0x28')](respondWithResult(_0x5aaaa3,null))['catch'](function(_0x43212f){var _0x24114f=_0x1b92c9['query'][_0x2d6b('0x7b')]?0x1f4:_0x43212f[_0x2d6b('0x7c')]||0x1f4;logger[_0x2d6b('0x29')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x24114f,JSON[_0x2d6b('0x6e')](_0x43212f));delete _0x43212f[_0x2d6b('0x2b')];if(_0x24114f===0x191){_0x24114f=0x190;}_0x5aaaa3['status'](_0x24114f)[_0x2d6b('0x2c')](_0x1b92c9[_0x2d6b('0x36')][_0x2d6b('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x43212f['statusCode']}:_0x43212f);});}else{var _0x5ef5dd=0x1f4;_0x5aaaa3[_0x2d6b('0x1c')](_0x5ef5dd)['send']({'message':_0x2d6b('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 0881941..b14293c 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 _0x528e=['../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x51026c,_0x2db840){var _0xf08cf4=function(_0x4fb781){while(--_0x4fb781){_0x51026c['push'](_0x51026c['shift']());}};_0xf08cf4(++_0x2db840);}(_0x528e,0x1d2));var _0xe528=function(_0x28c4e0,_0x111a3a){_0x28c4e0=_0x28c4e0-0x0;var _0x2ecd0d=_0x528e[_0x28c4e0];return _0x2ecd0d;};'use strict';var _=require(_0xe528('0x0'));var util=require(_0xe528('0x1'));var logger=require(_0xe528('0x2'))(_0xe528('0x3'));var moment=require(_0xe528('0x4'));var BPromise=require(_0xe528('0x5'));var rp=require(_0xe528('0x6'));var fs=require('fs');var path=require(_0xe528('0x7'));var rimraf=require(_0xe528('0x8'));var config=require(_0xe528('0x9'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xe528('0xa'));module[_0xe528('0xb')]=function(_0x112e81,_0x1cda6c){return _0x112e81['define'](_0xe528('0xc'),attributes,{'tableName':_0xe528('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9dbf=['api','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger'];(function(_0x116b52,_0x503a4b){var _0x3793e2=function(_0x5159ed){while(--_0x5159ed){_0x116b52['push'](_0x116b52['shift']());}};_0x3793e2(++_0x503a4b);}(_0x9dbf,0x1ab));var _0xf9db=function(_0x46782d,_0x144988){_0x46782d=_0x46782d-0x0;var _0x21da92=_0x9dbf[_0x46782d];return _0x21da92;};'use strict';var _=require('lodash');var util=require(_0xf9db('0x0'));var logger=require(_0xf9db('0x1'))(_0xf9db('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf9db('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf9db('0x4'));var config=require(_0xf9db('0x5'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xf9db('0x6'));module[_0xf9db('0x7')]=function(_0x3c6011,_0xb20b42){return _0x3c6011[_0xf9db('0x8')](_0xf9db('0x9'),attributes,{'tableName':_0xf9db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 6cf1f0e..19434f4 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 _0xf71b=['request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SugarcrmAccount','options','raw','attributes','limit','include','model','map','then','GetSugarcrmAccount','ShowSugarcrmAccount','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x404d7b,_0x5097c6){var _0x35c939=function(_0x444213){while(--_0x444213){_0x404d7b['push'](_0x404d7b['shift']());}};_0x35c939(++_0x5097c6);}(_0xf71b,0xa3));var _0xbf71=function(_0x5b79fb,_0x5396fe){_0x5b79fb=_0x5b79fb-0x0;var _0x263d12=_0xf71b[_0x5b79fb];return _0x263d12;};'use strict';var _=require(_0xbf71('0x0'));var util=require('util');var moment=require(_0xbf71('0x1'));var BPromise=require(_0xbf71('0x2'));var rs=require(_0xbf71('0x3'));var fs=require('fs');var Redis=require(_0xbf71('0x4'));var db=require(_0xbf71('0x5'))['db'];var utils=require(_0xbf71('0x6'));var logger=require(_0xbf71('0x7'))('rpc');var config=require(_0xbf71('0x8'));var jayson=require(_0xbf71('0x9'));var client=jayson[_0xbf71('0xa')][_0xbf71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d34f9,_0x51a166,_0x6ce79e){return new BPromise(function(_0x102973,_0x11a2db){return client[_0xbf71('0xc')](_0x4d34f9,_0x6ce79e)['then'](function(_0x49b834){logger[_0xbf71('0xd')](_0xbf71('0xe'),_0x51a166,_0xbf71('0xf'));logger[_0xbf71('0x10')](_0xbf71('0x11'),_0x51a166,_0xbf71('0xf'),JSON[_0xbf71('0x12')](_0x49b834));if(_0x49b834['error']){if(_0x49b834['error']['code']===0x1f4){logger[_0xbf71('0x13')](_0xbf71('0xe'),_0x51a166,_0x49b834[_0xbf71('0x13')][_0xbf71('0x14')]);return _0x11a2db(_0x49b834[_0xbf71('0x13')]['message']);}logger[_0xbf71('0x13')](_0xbf71('0xe'),_0x51a166,_0x49b834[_0xbf71('0x13')][_0xbf71('0x14')]);return _0x102973(_0x49b834['error'][_0xbf71('0x14')]);}else{logger[_0xbf71('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x51a166,_0xbf71('0xf'));_0x102973(_0x49b834[_0xbf71('0x15')]['message']);}})[_0xbf71('0x16')](function(_0x252109){logger['error'](_0xbf71('0xe'),_0x51a166,_0x252109);_0x11a2db(_0x252109);});});}exports['GetSugarcrmAccount']=function(_0x277d1a){var _0xa4d078=this;return new Promise(function(_0x3b56d0,_0x5450a8){return db[_0xbf71('0x17')]['findAll']({'raw':_0x277d1a[_0xbf71('0x18')]?_0x277d1a['options'][_0xbf71('0x19')]===undefined?!![]:![]:!![],'where':_0x277d1a['options']?_0x277d1a[_0xbf71('0x18')]['where']||null:null,'attributes':_0x277d1a[_0xbf71('0x18')]?_0x277d1a[_0xbf71('0x18')][_0xbf71('0x1a')]||null:null,'limit':_0x277d1a[_0xbf71('0x18')]?_0x277d1a[_0xbf71('0x18')][_0xbf71('0x1b')]||null:null,'include':_0x277d1a[_0xbf71('0x18')]?_0x277d1a['options'][_0xbf71('0x1c')]?_['map'](_0x277d1a['options'][_0xbf71('0x1c')],function(_0x5277e5){return{'model':db[_0x5277e5[_0xbf71('0x1d')]],'as':_0x5277e5['as'],'attributes':_0x5277e5[_0xbf71('0x1a')],'include':_0x5277e5[_0xbf71('0x1c')]?_['map'](_0x5277e5[_0xbf71('0x1c')],function(_0x34214d){return{'model':db[_0x34214d['model']],'as':_0x34214d['as'],'attributes':_0x34214d[_0xbf71('0x1a')],'include':_0x34214d[_0xbf71('0x1c')]?_[_0xbf71('0x1e')](_0x34214d[_0xbf71('0x1c')],function(_0x2c1723){return{'model':db[_0x2c1723['model']],'as':_0x2c1723['as'],'attributes':_0x2c1723[_0xbf71('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbf71('0x1f')](function(_0x5da3e8){logger[_0xbf71('0xd')]('GetSugarcrmAccount',_0x277d1a);logger['debug'](_0xbf71('0x20'),_0x277d1a,JSON[_0xbf71('0x12')](_0x5da3e8));_0x3b56d0(_0x5da3e8);})[_0xbf71('0x16')](function(_0xdcb53c){logger['error'](_0xbf71('0x20'),_0xdcb53c[_0xbf71('0x14')],_0x277d1a);_0x5450a8(_0xa4d078[_0xbf71('0x13')](0x1f4,_0xdcb53c['message']));});});};exports[_0xbf71('0x21')]=function(_0x22cd46){var _0x2aee41=this;return new Promise(function(_0x2fd281,_0x30ab5b){return db[_0xbf71('0x17')]['find']({'raw':_0x22cd46[_0xbf71('0x18')]?_0x22cd46[_0xbf71('0x18')][_0xbf71('0x19')]===undefined?!![]:![]:!![],'where':_0x22cd46[_0xbf71('0x18')]?_0x22cd46['options'][_0xbf71('0x22')]||null:null,'attributes':_0x22cd46[_0xbf71('0x18')]?_0x22cd46[_0xbf71('0x18')][_0xbf71('0x1a')]||null:null,'include':_0x22cd46[_0xbf71('0x18')]?_0x22cd46['options'][_0xbf71('0x1c')]?_[_0xbf71('0x1e')](_0x22cd46['options'][_0xbf71('0x1c')],function(_0xbc1330){return{'model':db[_0xbc1330['model']],'as':_0xbc1330['as'],'attributes':_0xbc1330[_0xbf71('0x1a')],'include':_0xbc1330['include']?_['map'](_0xbc1330[_0xbf71('0x1c')],function(_0x10ed5b){return{'model':db[_0x10ed5b[_0xbf71('0x1d')]],'as':_0x10ed5b['as'],'attributes':_0x10ed5b[_0xbf71('0x1a')],'include':_0x10ed5b['include']?_[_0xbf71('0x1e')](_0x10ed5b[_0xbf71('0x1c')],function(_0x3c1793){return{'model':db[_0x3c1793['model']],'as':_0x3c1793['as'],'attributes':_0x3c1793['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x46d2f5){logger['info'](_0xbf71('0x21'),_0x22cd46);logger[_0xbf71('0x10')]('ShowSugarcrmAccount',_0x22cd46,JSON['stringify'](_0x46d2f5));_0x2fd281(_0x46d2f5);})[_0xbf71('0x16')](function(_0x4c1383){logger[_0xbf71('0x13')](_0xbf71('0x21'),_0x4c1383[_0xbf71('0x14')],_0x22cd46);_0x30ab5b(_0x2aee41[_0xbf71('0x13')](0x1f4,_0x4c1383[_0xbf71('0x14')]));});});}; \ No newline at end of file +var _0xa0f5=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','include','map','model','stringify','ShowSugarcrmAccount','find','moment'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xa0f5,0x180));var _0x5a0f=function(_0x593d08,_0x124ecc){_0x593d08=_0x593d08-0x0;var _0x48eab9=_0xa0f5[_0x593d08];return _0x48eab9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5a0f('0x0'));var BPromise=require(_0x5a0f('0x1'));var rs=require(_0x5a0f('0x2'));var fs=require('fs');var Redis=require(_0x5a0f('0x3'));var db=require(_0x5a0f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5a0f('0x5'))(_0x5a0f('0x6'));var config=require(_0x5a0f('0x7'));var jayson=require(_0x5a0f('0x8'));var client=jayson[_0x5a0f('0x9')][_0x5a0f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf59e12,_0x5d1ac3,_0x405011){return new BPromise(function(_0x351637,_0x38c5fc){return client[_0x5a0f('0xb')](_0xf59e12,_0x405011)[_0x5a0f('0xc')](function(_0x3b1afe){logger[_0x5a0f('0xd')](_0x5a0f('0xe'),_0x5d1ac3,_0x5a0f('0xf'));logger[_0x5a0f('0x10')](_0x5a0f('0x11'),_0x5d1ac3,_0x5a0f('0xf'),JSON['stringify'](_0x3b1afe));if(_0x3b1afe[_0x5a0f('0x12')]){if(_0x3b1afe[_0x5a0f('0x12')]['code']===0x1f4){logger[_0x5a0f('0x12')](_0x5a0f('0xe'),_0x5d1ac3,_0x3b1afe['error'][_0x5a0f('0x13')]);return _0x38c5fc(_0x3b1afe[_0x5a0f('0x12')][_0x5a0f('0x13')]);}logger[_0x5a0f('0x12')](_0x5a0f('0xe'),_0x5d1ac3,_0x3b1afe['error'][_0x5a0f('0x13')]);return _0x351637(_0x3b1afe[_0x5a0f('0x12')][_0x5a0f('0x13')]);}else{logger['info'](_0x5a0f('0xe'),_0x5d1ac3,_0x5a0f('0xf'));_0x351637(_0x3b1afe[_0x5a0f('0x14')][_0x5a0f('0x13')]);}})[_0x5a0f('0x15')](function(_0x273494){logger[_0x5a0f('0x12')](_0x5a0f('0xe'),_0x5d1ac3,_0x273494);_0x38c5fc(_0x273494);});});}exports[_0x5a0f('0x16')]=function(_0x3b19f3){var _0x4f9090=this;return new Promise(function(_0x3620c8,_0x4432b9){return db[_0x5a0f('0x17')][_0x5a0f('0x18')]({'raw':_0x3b19f3[_0x5a0f('0x19')]?_0x3b19f3[_0x5a0f('0x19')][_0x5a0f('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b19f3[_0x5a0f('0x19')]?_0x3b19f3[_0x5a0f('0x19')][_0x5a0f('0x1b')]||null:null,'attributes':_0x3b19f3[_0x5a0f('0x19')]?_0x3b19f3[_0x5a0f('0x19')][_0x5a0f('0x1c')]||null:null,'limit':_0x3b19f3[_0x5a0f('0x19')]?_0x3b19f3[_0x5a0f('0x19')]['limit']||null:null,'include':_0x3b19f3[_0x5a0f('0x19')]?_0x3b19f3['options'][_0x5a0f('0x1d')]?_['map'](_0x3b19f3['options'][_0x5a0f('0x1d')],function(_0xac811b){return{'model':db[_0xac811b['model']],'as':_0xac811b['as'],'attributes':_0xac811b[_0x5a0f('0x1c')],'include':_0xac811b[_0x5a0f('0x1d')]?_[_0x5a0f('0x1e')](_0xac811b[_0x5a0f('0x1d')],function(_0x2832b2){return{'model':db[_0x2832b2['model']],'as':_0x2832b2['as'],'attributes':_0x2832b2[_0x5a0f('0x1c')],'include':_0x2832b2[_0x5a0f('0x1d')]?_['map'](_0x2832b2[_0x5a0f('0x1d')],function(_0x16f5d3){return{'model':db[_0x16f5d3[_0x5a0f('0x1f')]],'as':_0x16f5d3['as'],'attributes':_0x16f5d3[_0x5a0f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x42b0cf){logger[_0x5a0f('0xd')](_0x5a0f('0x16'),_0x3b19f3);logger[_0x5a0f('0x10')](_0x5a0f('0x16'),_0x3b19f3,JSON[_0x5a0f('0x20')](_0x42b0cf));_0x3620c8(_0x42b0cf);})['catch'](function(_0x241525){logger['error'](_0x5a0f('0x16'),_0x241525[_0x5a0f('0x13')],_0x3b19f3);_0x4432b9(_0x4f9090[_0x5a0f('0x12')](0x1f4,_0x241525[_0x5a0f('0x13')]));});});};exports[_0x5a0f('0x21')]=function(_0x10680c){var _0x4fee69=this;return new Promise(function(_0x3fbc85,_0x5dfb86){return db[_0x5a0f('0x17')][_0x5a0f('0x22')]({'raw':_0x10680c[_0x5a0f('0x19')]?_0x10680c[_0x5a0f('0x19')][_0x5a0f('0x1a')]===undefined?!![]:![]:!![],'where':_0x10680c['options']?_0x10680c[_0x5a0f('0x19')]['where']||null:null,'attributes':_0x10680c[_0x5a0f('0x19')]?_0x10680c['options']['attributes']||null:null,'include':_0x10680c[_0x5a0f('0x19')]?_0x10680c[_0x5a0f('0x19')][_0x5a0f('0x1d')]?_[_0x5a0f('0x1e')](_0x10680c[_0x5a0f('0x19')][_0x5a0f('0x1d')],function(_0x320674){return{'model':db[_0x320674['model']],'as':_0x320674['as'],'attributes':_0x320674['attributes'],'include':_0x320674[_0x5a0f('0x1d')]?_['map'](_0x320674[_0x5a0f('0x1d')],function(_0x158d43){return{'model':db[_0x158d43[_0x5a0f('0x1f')]],'as':_0x158d43['as'],'attributes':_0x158d43[_0x5a0f('0x1c')],'include':_0x158d43['include']?_[_0x5a0f('0x1e')](_0x158d43[_0x5a0f('0x1d')],function(_0x1fb82d){return{'model':db[_0x1fb82d[_0x5a0f('0x1f')]],'as':_0x1fb82d['as'],'attributes':_0x1fb82d[_0x5a0f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5a0f('0xc')](function(_0x2ed3d4){logger[_0x5a0f('0xd')](_0x5a0f('0x21'),_0x10680c);logger['debug'](_0x5a0f('0x21'),_0x10680c,JSON[_0x5a0f('0x20')](_0x2ed3d4));_0x3fbc85(_0x2ed3d4);})[_0x5a0f('0x15')](function(_0x758655){logger[_0x5a0f('0x12')](_0x5a0f('0x21'),_0x758655[_0x5a0f('0x13')],_0x10680c);_0x5dfb86(_0x4fee69[_0x5a0f('0x12')](0x1f4,_0x758655[_0x5a0f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 0604815..4eba59c 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 _0x66e8=['destroy','exports','multer','path','connect-timeout','Router','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id'];(function(_0xefa24d,_0x1a9e3c){var _0x1a76c3=function(_0x4f8a44){while(--_0x4f8a44){_0xefa24d['push'](_0xefa24d['shift']());}};_0x1a76c3(++_0x1a9e3c);}(_0x66e8,0x134));var _0x866e=function(_0x88a172,_0x6de59f){_0x88a172=_0x88a172-0x0;var _0x198e36=_0x66e8[_0x88a172];return _0x198e36;};'use strict';var multer=require(_0x866e('0x0'));var util=require('util');var path=require(_0x866e('0x1'));var timeout=require(_0x866e('0x2'));var express=require('express');var router=express[_0x866e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x866e('0x4'));var controller=require(_0x866e('0x5'));router[_0x866e('0x6')]('/',auth[_0x866e('0x7')](),controller['index']);router[_0x866e('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x866e('0x6')](_0x866e('0x8'),auth[_0x866e('0x7')](),controller['getFields']);router[_0x866e('0x6')](_0x866e('0x9'),auth[_0x866e('0x7')](),controller[_0x866e('0xa')]);router['get'](_0x866e('0xb'),auth[_0x866e('0x7')](),controller[_0x866e('0xc')]);router[_0x866e('0xd')]('/',auth[_0x866e('0x7')](),controller['create']);router[_0x866e('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x866e('0xf'),auth['isAuthenticated'](),controller[_0x866e('0x10')]);module[_0x866e('0x11')]=router; \ No newline at end of file +var _0x2593=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','destroy','exports'];(function(_0x44774d,_0x27fe98){var _0x282b23=function(_0x3b05d4){while(--_0x3b05d4){_0x44774d['push'](_0x44774d['shift']());}};_0x282b23(++_0x27fe98);}(_0x2593,0x7d));var _0x3259=function(_0xa1e3ca,_0x559022){_0xa1e3ca=_0xa1e3ca-0x0;var _0x5005ab=_0x2593[_0xa1e3ca];return _0x5005ab;};'use strict';var multer=require(_0x3259('0x0'));var util=require(_0x3259('0x1'));var path=require('path');var timeout=require(_0x3259('0x2'));var express=require(_0x3259('0x3'));var router=express[_0x3259('0x4')]();var fs_extra=require(_0x3259('0x5'));var auth=require(_0x3259('0x6'));var interaction=require(_0x3259('0x7'));var config=require(_0x3259('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x3259('0x9')]('/',auth[_0x3259('0xa')](),controller[_0x3259('0xb')]);router[_0x3259('0x9')](_0x3259('0xc'),auth['isAuthenticated'](),controller[_0x3259('0xd')]);router['get'](_0x3259('0xe'),auth['isAuthenticated'](),controller[_0x3259('0xf')]);router['get'](_0x3259('0x10'),auth[_0x3259('0xa')](),controller[_0x3259('0x11')]);router[_0x3259('0x9')](_0x3259('0x12'),auth[_0x3259('0xa')](),controller[_0x3259('0x13')]);router[_0x3259('0x14')]('/',auth[_0x3259('0xa')](),controller['create']);router[_0x3259('0x15')](_0x3259('0xc'),auth[_0x3259('0xa')](),controller[_0x3259('0x16')]);router['delete']('/:id',auth[_0x3259('0xa')](),controller[_0x3259('0x17')]);module[_0x3259('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 7b59384..903b101 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 _0x5402=['exports','STRING','sequelize'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5402,0x158));var _0x2540=function(_0x5cc1cc,_0x563bb9){_0x5cc1cc=_0x5cc1cc-0x0;var _0x1c1081=_0x5402[_0x5cc1cc];return _0x1c1081;};'use strict';var Sequelize=require(_0x2540('0x0'));module[_0x2540('0x1')]={'name':{'type':Sequelize[_0x2540('0x2')]},'description':{'type':Sequelize[_0x2540('0x2')]}}; \ No newline at end of file +var _0xa585=['exports','STRING','sequelize'];(function(_0x28035f,_0x294b64){var _0xfdb879=function(_0x4d24cf){while(--_0x4d24cf){_0x28035f['push'](_0x28035f['shift']());}};_0xfdb879(++_0x294b64);}(_0xa585,0xa7));var _0x5a58=function(_0x2408cc,_0x394561){_0x2408cc=_0x2408cc-0x0;var _0x22174d=_0xa585[_0x2408cc];return _0x22174d;};'use strict';var Sequelize=require(_0x5a58('0x0'));module[_0x5a58('0x1')]={'name':{'type':Sequelize[_0x5a58('0x2')]},'description':{'type':Sequelize[_0x5a58('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 6b06f32..c1511dd 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 _0x61d2=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','then','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','intersection','fields','attributes','length','nolimit','sort','filters','pick','filter','where','merge','type','VIRTUAL','SugarcrmConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','find','destroy','findOne','SugarcrmField','getFields','hasOwnProperty','order','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x61d2,0xde));var _0x261d=function(_0x468f9b,_0x5b7399){_0x468f9b=_0x468f9b-0x0;var _0x47c13e=_0x61d2[_0x468f9b];return _0x47c13e;};'use strict';var emlformat=require(_0x261d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x261d('0x1'));var jsonpatch=require(_0x261d('0x2'));var rp=require('request-promise');var moment=require(_0x261d('0x3'));var BPromise=require(_0x261d('0x4'));var Mustache=require(_0x261d('0x5'));var util=require('util');var path=require(_0x261d('0x6'));var sox=require('sox');var csv=require(_0x261d('0x7'));var ejs=require(_0x261d('0x8'));var fs=require('fs');var fs_extra=require(_0x261d('0x9'));var _=require(_0x261d('0xa'));var squel=require('squel');var crypto=require(_0x261d('0xb'));var jsforce=require(_0x261d('0xc'));var deskjs=require(_0x261d('0xd'));var toCsv=require(_0x261d('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x261d('0xe'));var authService=require(_0x261d('0xf'));var qs=require(_0x261d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x261d('0x11'));var logger=require(_0x261d('0x12'))(_0x261d('0x13'));var utils=require(_0x261d('0x14'));var config=require(_0x261d('0x15'));var licenseUtil=require(_0x261d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2be62a,_0x1c0748){_0x1c0748=_0x1c0748||0xcc;return function(_0x30ad72){if(_0x30ad72){return _0x2be62a[_0x261d('0x17')](_0x1c0748);}return _0x2be62a[_0x261d('0x18')](_0x1c0748)[_0x261d('0x19')]();};}function respondWithResult(_0x4855ae,_0x2ac14d){_0x2ac14d=_0x2ac14d||0xc8;return function(_0x165b69){if(_0x165b69){return _0x4855ae[_0x261d('0x18')](_0x2ac14d)[_0x261d('0x1a')](_0x165b69);}};}function respondWithFilteredResult(_0x230c0c,_0x2483d9){return function(_0x275685){if(_0x275685){var _0x28f11e=typeof _0x2483d9['offset']==='undefined'&&typeof _0x2483d9[_0x261d('0x1b')]===_0x261d('0x1c');var _0x344c33=_0x275685[_0x261d('0x1d')];var _0xbef587=_0x28f11e?0x0:_0x2483d9[_0x261d('0x1e')];var _0x439f7f=_0x28f11e?_0x275685['count']:_0x2483d9[_0x261d('0x1e')]+_0x2483d9['limit'];var _0x2136c6;if(_0x439f7f>=_0x344c33){_0x439f7f=_0x344c33;_0x2136c6=0xc8;}else{_0x2136c6=0xce;}_0x230c0c['status'](_0x2136c6);return _0x230c0c[_0x261d('0x1f')]('Content-Range',_0xbef587+'-'+_0x439f7f+'/'+_0x344c33)['json'](_0x275685);}return null;};}function patchUpdates(_0x8c36d){return function(_0x2cd48e){try{jsonpatch[_0x261d('0x20')](_0x2cd48e,_0x8c36d,!![]);}catch(_0x545851){return BPromise[_0x261d('0x21')](_0x545851);}return _0x2cd48e['save']();};}function saveUpdates(_0x2880fc,_0x16b29f){return function(_0x1f671a){if(_0x1f671a){return _0x1f671a['update'](_0x2880fc)[_0x261d('0x22')](function(_0x58d907){return _0x58d907;});}return null;};}function removeEntity(_0x379e31,_0x40aec4){return function(_0xe1505){if(_0xe1505){return _0xe1505['destroy']()['then'](function(){_0x379e31[_0x261d('0x18')](0xcc)[_0x261d('0x19')]();});}};}function handleEntityNotFound(_0xcd269,_0x326f5e){return function(_0x4cfdbb){if(!_0x4cfdbb){_0xcd269[_0x261d('0x17')](0x194);}return _0x4cfdbb;};}function handleError(_0x5041bf,_0xe1c2bd){_0xe1c2bd=_0xe1c2bd||0x1f4;return function(_0x40f52e){logger[_0x261d('0x23')](_0x40f52e[_0x261d('0x24')]);if(_0x40f52e[_0x261d('0x25')]){delete _0x40f52e['name'];}_0x5041bf[_0x261d('0x18')](_0xe1c2bd)[_0x261d('0x26')](_0x40f52e);};}exports[_0x261d('0x27')]=function(_0x40e35b,_0x2f3428){var _0x9bcc92={},_0x2c597d={},_0x5424cf={'count':0x0,'rows':[]};var _0x3d560e=_['map'](db['SugarcrmConfiguration'][_0x261d('0x28')],function(_0x119e6a){return{'name':_0x119e6a[_0x261d('0x29')],'type':_0x119e6a['type'][_0x261d('0x2a')]};});_0x2c597d[_0x261d('0x2b')]=_[_0x261d('0x2c')](_0x3d560e,_0x261d('0x25'));_0x2c597d[_0x261d('0x2d')]=_['keys'](_0x40e35b[_0x261d('0x2d')]);_0x2c597d['filters']=_[_0x261d('0x2e')](_0x2c597d[_0x261d('0x2b')],_0x2c597d[_0x261d('0x2d')]);_0x9bcc92['attributes']=_['intersection'](_0x2c597d[_0x261d('0x2b')],qs[_0x261d('0x2f')](_0x40e35b[_0x261d('0x2d')]['fields']));_0x9bcc92[_0x261d('0x30')]=_0x9bcc92[_0x261d('0x30')][_0x261d('0x31')]?_0x9bcc92[_0x261d('0x30')]:_0x2c597d[_0x261d('0x2b')];if(!_0x40e35b[_0x261d('0x2d')]['hasOwnProperty'](_0x261d('0x32'))){_0x9bcc92['limit']=qs[_0x261d('0x1b')](_0x40e35b[_0x261d('0x2d')][_0x261d('0x1b')]);_0x9bcc92[_0x261d('0x1e')]=qs[_0x261d('0x1e')](_0x40e35b[_0x261d('0x2d')][_0x261d('0x1e')]);}_0x9bcc92['order']=qs[_0x261d('0x33')](_0x40e35b[_0x261d('0x2d')][_0x261d('0x33')]);_0x9bcc92['where']=qs[_0x261d('0x34')](_[_0x261d('0x35')](_0x40e35b[_0x261d('0x2d')],_0x2c597d['filters']),_0x3d560e);if(_0x40e35b[_0x261d('0x2d')][_0x261d('0x36')]){_0x9bcc92[_0x261d('0x37')]=_[_0x261d('0x38')](_0x9bcc92['where'],{'$or':_['map'](_0x3d560e,function(_0x15e510){if(_0x15e510[_0x261d('0x39')]!==_0x261d('0x3a')){var _0x2666b9={};_0x2666b9[_0x15e510[_0x261d('0x25')]]={'$like':'%'+_0x40e35b[_0x261d('0x2d')][_0x261d('0x36')]+'%'};return _0x2666b9;}})});}_0x9bcc92=_[_0x261d('0x38')]({},_0x9bcc92,_0x40e35b['options']);var _0x3fa1d8={'where':_0x9bcc92['where']};return db[_0x261d('0x3b')][_0x261d('0x1d')](_0x3fa1d8)[_0x261d('0x22')](function(_0x15f39c){_0x5424cf[_0x261d('0x1d')]=_0x15f39c;if(_0x40e35b[_0x261d('0x2d')][_0x261d('0x3c')]){_0x9bcc92[_0x261d('0x3d')]=[{'all':!![]}];}return db[_0x261d('0x3b')][_0x261d('0x3e')](_0x9bcc92);})[_0x261d('0x22')](function(_0x1881ec){_0x5424cf[_0x261d('0x3f')]=_0x1881ec;return _0x5424cf;})[_0x261d('0x22')](respondWithFilteredResult(_0x2f3428,_0x9bcc92))[_0x261d('0x40')](handleError(_0x2f3428,null));};exports[_0x261d('0x41')]=function(_0xd0fd5e,_0xeadf7a){var _0xe13898={'raw':![],'where':{'id':_0xd0fd5e[_0x261d('0x42')]['id']}},_0x15e67b={};_0x15e67b[_0x261d('0x2b')]=_[_0x261d('0x43')](db['SugarcrmConfiguration'][_0x261d('0x28')]);_0x15e67b[_0x261d('0x2d')]=_[_0x261d('0x43')](_0xd0fd5e[_0x261d('0x2d')]);_0x15e67b[_0x261d('0x34')]=_[_0x261d('0x2e')](_0x15e67b[_0x261d('0x2b')],_0x15e67b[_0x261d('0x2d')]);_0xe13898[_0x261d('0x30')]=_[_0x261d('0x2e')](_0x15e67b[_0x261d('0x2b')],qs['fields'](_0xd0fd5e['query']['fields']));_0xe13898[_0x261d('0x30')]=_0xe13898['attributes'][_0x261d('0x31')]?_0xe13898[_0x261d('0x30')]:_0x15e67b[_0x261d('0x2b')];if(_0xd0fd5e['query'][_0x261d('0x3c')]){_0xe13898[_0x261d('0x3d')]=[{'all':!![]}];}_0xe13898=_[_0x261d('0x38')]({},_0xe13898,_0xd0fd5e[_0x261d('0x44')]);return db[_0x261d('0x3b')]['find'](_0xe13898)[_0x261d('0x22')](handleEntityNotFound(_0xeadf7a,null))['then'](respondWithResult(_0xeadf7a,null))[_0x261d('0x40')](handleError(_0xeadf7a,null));};exports[_0x261d('0x45')]=function(_0x13039f,_0x339958){return db[_0x261d('0x3b')][_0x261d('0x45')](_0x13039f[_0x261d('0x46')],{})[_0x261d('0x22')](respondWithResult(_0x339958,0xc9))[_0x261d('0x40')](handleError(_0x339958,null));};exports['update']=function(_0x5b3127,_0x3a4292){if(_0x5b3127[_0x261d('0x46')]['id']){delete _0x5b3127[_0x261d('0x46')]['id'];}return db[_0x261d('0x3b')][_0x261d('0x47')]({'where':{'id':_0x5b3127[_0x261d('0x42')]['id']}})['then'](handleEntityNotFound(_0x3a4292,null))['then'](saveUpdates(_0x5b3127[_0x261d('0x46')],null))[_0x261d('0x22')](respondWithResult(_0x3a4292,null))[_0x261d('0x40')](handleError(_0x3a4292,null));};exports[_0x261d('0x48')]=function(_0x4624c4,_0x3fc297){return db[_0x261d('0x3b')]['find']({'where':{'id':_0x4624c4[_0x261d('0x42')]['id']}})[_0x261d('0x22')](handleEntityNotFound(_0x3fc297,null))[_0x261d('0x22')](removeEntity(_0x3fc297,null))[_0x261d('0x40')](handleError(_0x3fc297,null));};exports['getFields']=function(_0x414988,_0x3d5fbf,_0x1a6b87){var _0x3e4783={};var _0x1d00d9={};var _0x59a55f;var _0x9fe53d;return db[_0x261d('0x3b')][_0x261d('0x49')]({'where':{'id':_0x414988[_0x261d('0x42')]['id']}})['then'](handleEntityNotFound(_0x3d5fbf,null))[_0x261d('0x22')](function(_0x47267b){if(_0x47267b){_0x59a55f=_0x47267b;_0x1d00d9[_0x261d('0x2b')]=_[_0x261d('0x43')](db[_0x261d('0x4a')][_0x261d('0x28')]);_0x1d00d9['query']=_[_0x261d('0x43')](_0x414988['query']);_0x1d00d9[_0x261d('0x34')]=_[_0x261d('0x2e')](_0x1d00d9[_0x261d('0x2b')],_0x1d00d9[_0x261d('0x2d')]);_0x3e4783[_0x261d('0x30')]=_[_0x261d('0x2e')](_0x1d00d9[_0x261d('0x2b')],qs[_0x261d('0x2f')](_0x414988[_0x261d('0x2d')]['fields']));_0x3e4783[_0x261d('0x30')]=_0x3e4783[_0x261d('0x30')][_0x261d('0x31')]?_0x3e4783[_0x261d('0x30')]:_0x1d00d9['model'];_0x3e4783['order']=qs[_0x261d('0x33')](_0x414988['query'][_0x261d('0x33')]);_0x3e4783['where']=qs[_0x261d('0x34')](_[_0x261d('0x35')](_0x414988[_0x261d('0x2d')],_0x1d00d9[_0x261d('0x34')]));if(_0x414988[_0x261d('0x2d')][_0x261d('0x36')]){_0x3e4783['where']=_[_0x261d('0x38')](_0x3e4783[_0x261d('0x37')],{'$or':_[_0x261d('0x2c')](_0x3e4783[_0x261d('0x30')],function(_0x4c1047){var _0x2ff6bc={};_0x2ff6bc[_0x4c1047]={'$like':'%'+_0x414988[_0x261d('0x2d')][_0x261d('0x36')]+'%'};return _0x2ff6bc;})});}_0x3e4783=_[_0x261d('0x38')]({},_0x3e4783,_0x414988[_0x261d('0x44')]);return _0x59a55f[_0x261d('0x4b')](_0x3e4783);}})[_0x261d('0x22')](function(_0x1c1da8){if(_0x1c1da8){_0x9fe53d=_0x1c1da8[_0x261d('0x31')];if(!_0x414988[_0x261d('0x2d')][_0x261d('0x4c')]('nolimit')){_0x3e4783[_0x261d('0x1b')]=qs[_0x261d('0x1b')](_0x414988[_0x261d('0x2d')][_0x261d('0x1b')]);_0x3e4783[_0x261d('0x1e')]=qs[_0x261d('0x1e')](_0x414988[_0x261d('0x2d')][_0x261d('0x1e')]);}return _0x59a55f[_0x261d('0x4b')](_0x3e4783);}})[_0x261d('0x22')](function(_0xa3e06a){if(_0xa3e06a){return _0xa3e06a?{'count':_0x9fe53d,'rows':_0xa3e06a}:null;}})[_0x261d('0x22')](respondWithResult(_0x3d5fbf,null))[_0x261d('0x40')](handleError(_0x3d5fbf,null));};exports['getSubjects']=function(_0x4a8326,_0x126d03,_0x87b5ea){var _0x42af78={};var _0x1e2cca={};var _0x5e9c1c;var _0x1d73ef;return db[_0x261d('0x3b')][_0x261d('0x49')]({'where':{'id':_0x4a8326[_0x261d('0x42')]['id']}})['then'](handleEntityNotFound(_0x126d03,null))[_0x261d('0x22')](function(_0xddb9d){if(_0xddb9d){_0x5e9c1c=_0xddb9d;_0x1e2cca[_0x261d('0x2b')]=_[_0x261d('0x43')](db[_0x261d('0x4a')][_0x261d('0x28')]);_0x1e2cca[_0x261d('0x2d')]=_[_0x261d('0x43')](_0x4a8326[_0x261d('0x2d')]);_0x1e2cca['filters']=_[_0x261d('0x2e')](_0x1e2cca[_0x261d('0x2b')],_0x1e2cca['query']);_0x42af78[_0x261d('0x30')]=_[_0x261d('0x2e')](_0x1e2cca['model'],qs[_0x261d('0x2f')](_0x4a8326['query'][_0x261d('0x2f')]));_0x42af78['attributes']=_0x42af78[_0x261d('0x30')][_0x261d('0x31')]?_0x42af78['attributes']:_0x1e2cca[_0x261d('0x2b')];_0x42af78[_0x261d('0x4d')]=qs['sort'](_0x4a8326[_0x261d('0x2d')][_0x261d('0x33')]);_0x42af78[_0x261d('0x37')]=qs[_0x261d('0x34')](_[_0x261d('0x35')](_0x4a8326[_0x261d('0x2d')],_0x1e2cca['filters']));if(_0x4a8326[_0x261d('0x2d')][_0x261d('0x36')]){_0x42af78['where']=_[_0x261d('0x38')](_0x42af78[_0x261d('0x37')],{'$or':_['map'](_0x42af78['attributes'],function(_0x2731cd){var _0x5acda5={};_0x5acda5[_0x2731cd]={'$like':'%'+_0x4a8326[_0x261d('0x2d')][_0x261d('0x36')]+'%'};return _0x5acda5;})});}_0x42af78=_[_0x261d('0x38')]({},_0x42af78,_0x4a8326['options']);return _0x5e9c1c[_0x261d('0x4e')](_0x42af78);}})[_0x261d('0x22')](function(_0x5792a9){if(_0x5792a9){_0x1d73ef=_0x5792a9['length'];if(!_0x4a8326[_0x261d('0x2d')][_0x261d('0x4c')](_0x261d('0x32'))){_0x42af78[_0x261d('0x1b')]=qs[_0x261d('0x1b')](_0x4a8326[_0x261d('0x2d')][_0x261d('0x1b')]);_0x42af78['offset']=qs['offset'](_0x4a8326[_0x261d('0x2d')][_0x261d('0x1e')]);}return _0x5e9c1c[_0x261d('0x4e')](_0x42af78);}})[_0x261d('0x22')](function(_0x3d77fd){if(_0x3d77fd){return _0x3d77fd?{'count':_0x1d73ef,'rows':_0x3d77fd}:null;}})['then'](respondWithResult(_0x126d03,null))[_0x261d('0x40')](handleError(_0x126d03,null));};exports[_0x261d('0x4f')]=function(_0x285bbc,_0x58da23,_0x134f4a){var _0x18a7b7={};var _0x2b699e={};var _0x195e29;var _0x2ca0f9;return db[_0x261d('0x3b')][_0x261d('0x49')]({'where':{'id':_0x285bbc[_0x261d('0x42')]['id']}})[_0x261d('0x22')](handleEntityNotFound(_0x58da23,null))[_0x261d('0x22')](function(_0x1c955f){if(_0x1c955f){_0x195e29=_0x1c955f;_0x2b699e[_0x261d('0x2b')]=_[_0x261d('0x43')](db['SugarcrmField'][_0x261d('0x28')]);_0x2b699e['query']=_[_0x261d('0x43')](_0x285bbc[_0x261d('0x2d')]);_0x2b699e['filters']=_[_0x261d('0x2e')](_0x2b699e[_0x261d('0x2b')],_0x2b699e[_0x261d('0x2d')]);_0x18a7b7['attributes']=_[_0x261d('0x2e')](_0x2b699e[_0x261d('0x2b')],qs[_0x261d('0x2f')](_0x285bbc['query'][_0x261d('0x2f')]));_0x18a7b7['attributes']=_0x18a7b7['attributes']['length']?_0x18a7b7[_0x261d('0x30')]:_0x2b699e[_0x261d('0x2b')];_0x18a7b7['order']=qs['sort'](_0x285bbc[_0x261d('0x2d')][_0x261d('0x33')]);_0x18a7b7[_0x261d('0x37')]=qs['filters'](_[_0x261d('0x35')](_0x285bbc[_0x261d('0x2d')],_0x2b699e['filters']));if(_0x285bbc['query'][_0x261d('0x36')]){_0x18a7b7[_0x261d('0x37')]=_[_0x261d('0x38')](_0x18a7b7[_0x261d('0x37')],{'$or':_['map'](_0x18a7b7['attributes'],function(_0x88a4d4){var _0x40f817={};_0x40f817[_0x88a4d4]={'$like':'%'+_0x285bbc[_0x261d('0x2d')][_0x261d('0x36')]+'%'};return _0x40f817;})});}_0x18a7b7=_[_0x261d('0x38')]({},_0x18a7b7,_0x285bbc[_0x261d('0x44')]);return _0x195e29['getDescriptions'](_0x18a7b7);}})[_0x261d('0x22')](function(_0x5d318d){if(_0x5d318d){_0x2ca0f9=_0x5d318d[_0x261d('0x31')];if(!_0x285bbc['query'][_0x261d('0x4c')](_0x261d('0x32'))){_0x18a7b7['limit']=qs[_0x261d('0x1b')](_0x285bbc['query'][_0x261d('0x1b')]);_0x18a7b7['offset']=qs[_0x261d('0x1e')](_0x285bbc[_0x261d('0x2d')][_0x261d('0x1e')]);}return _0x195e29[_0x261d('0x4f')](_0x18a7b7);}})[_0x261d('0x22')](function(_0x74967c){if(_0x74967c){return _0x74967c?{'count':_0x2ca0f9,'rows':_0x74967c}:null;}})[_0x261d('0x22')](respondWithResult(_0x58da23,null))[_0x261d('0x40')](handleError(_0x58da23,null));}; \ No newline at end of file +var _0x5ae9=['sort','where','pick','filter','merge','map','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','update','find','getFields','findOne','SugarcrmField','order','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','then','stack','name','send','index','SugarcrmConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x58a2c4,_0xd7a4ce){var _0x3f9068=function(_0x133740){while(--_0x133740){_0x58a2c4['push'](_0x58a2c4['shift']());}};_0x3f9068(++_0xd7a4ce);}(_0x5ae9,0xc6));var _0x95ae=function(_0x3c719e,_0x19719d){_0x3c719e=_0x3c719e-0x0;var _0x2d09af=_0x5ae9[_0x3c719e];return _0x2d09af;};'use strict';var emlformat=require(_0x95ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x95ae('0x1'));var jsonpatch=require(_0x95ae('0x2'));var rp=require(_0x95ae('0x3'));var moment=require(_0x95ae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x95ae('0x5'));var util=require(_0x95ae('0x6'));var path=require(_0x95ae('0x7'));var sox=require(_0x95ae('0x8'));var csv=require(_0x95ae('0x9'));var ejs=require(_0x95ae('0xa'));var fs=require('fs');var fs_extra=require(_0x95ae('0xb'));var _=require(_0x95ae('0xc'));var squel=require(_0x95ae('0xd'));var crypto=require(_0x95ae('0xe'));var jsforce=require(_0x95ae('0xf'));var deskjs=require(_0x95ae('0x10'));var toCsv=require('to-csv');var querystring=require(_0x95ae('0x11'));var Papa=require(_0x95ae('0x12'));var Redis=require(_0x95ae('0x13'));var authService=require(_0x95ae('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x95ae('0x15'));var logger=require(_0x95ae('0x16'))(_0x95ae('0x17'));var utils=require(_0x95ae('0x18'));var config=require(_0x95ae('0x19'));var licenseUtil=require(_0x95ae('0x1a'));var db=require(_0x95ae('0x1b'))['db'];function respondWithStatusCode(_0x24cb9f,_0x32f55a){_0x32f55a=_0x32f55a||0xcc;return function(_0x2d71a9){if(_0x2d71a9){return _0x24cb9f[_0x95ae('0x1c')](_0x32f55a);}return _0x24cb9f[_0x95ae('0x1d')](_0x32f55a)[_0x95ae('0x1e')]();};}function respondWithResult(_0x4750c2,_0x2092cd){_0x2092cd=_0x2092cd||0xc8;return function(_0xffc87d){if(_0xffc87d){return _0x4750c2[_0x95ae('0x1d')](_0x2092cd)[_0x95ae('0x1f')](_0xffc87d);}};}function respondWithFilteredResult(_0x364c22,_0x3992e2){return function(_0x4f538e){if(_0x4f538e){var _0x3d3ab6=typeof _0x3992e2[_0x95ae('0x20')]===_0x95ae('0x21')&&typeof _0x3992e2['limit']===_0x95ae('0x21');var _0xe93f22=_0x4f538e[_0x95ae('0x22')];var _0x44e69f=_0x3d3ab6?0x0:_0x3992e2[_0x95ae('0x20')];var _0x194ee8=_0x3d3ab6?_0x4f538e[_0x95ae('0x22')]:_0x3992e2[_0x95ae('0x20')]+_0x3992e2[_0x95ae('0x23')];var _0x4dd485;if(_0x194ee8>=_0xe93f22){_0x194ee8=_0xe93f22;_0x4dd485=0xc8;}else{_0x4dd485=0xce;}_0x364c22['status'](_0x4dd485);return _0x364c22[_0x95ae('0x24')](_0x95ae('0x25'),_0x44e69f+'-'+_0x194ee8+'/'+_0xe93f22)['json'](_0x4f538e);}return null;};}function patchUpdates(_0x1d250e){return function(_0x431994){try{jsonpatch[_0x95ae('0x26')](_0x431994,_0x1d250e,!![]);}catch(_0x15f092){return BPromise['reject'](_0x15f092);}return _0x431994[_0x95ae('0x27')]();};}function saveUpdates(_0x5c00bb,_0x7622d5){return function(_0x1098be){if(_0x1098be){return _0x1098be['update'](_0x5c00bb)['then'](function(_0x5d4e94){return _0x5d4e94;});}return null;};}function removeEntity(_0x1c1545,_0xd9c5ea){return function(_0x4dcf17){if(_0x4dcf17){return _0x4dcf17[_0x95ae('0x28')]()[_0x95ae('0x29')](function(){_0x1c1545['status'](0xcc)[_0x95ae('0x1e')]();});}};}function handleEntityNotFound(_0x2afa06,_0x45a3ae){return function(_0x41a240){if(!_0x41a240){_0x2afa06[_0x95ae('0x1c')](0x194);}return _0x41a240;};}function handleError(_0x134b88,_0x5dca72){_0x5dca72=_0x5dca72||0x1f4;return function(_0x167d88){logger['error'](_0x167d88[_0x95ae('0x2a')]);if(_0x167d88['name']){delete _0x167d88[_0x95ae('0x2b')];}_0x134b88[_0x95ae('0x1d')](_0x5dca72)[_0x95ae('0x2c')](_0x167d88);};}exports[_0x95ae('0x2d')]=function(_0x5a1b45,_0x7fa1eb){var _0x4ccf80={},_0x5241e8={},_0x1ebe5a={'count':0x0,'rows':[]};var _0x1a5e5b=_['map'](db[_0x95ae('0x2e')][_0x95ae('0x2f')],function(_0x446130){return{'name':_0x446130[_0x95ae('0x30')],'type':_0x446130['type'][_0x95ae('0x31')]};});_0x5241e8[_0x95ae('0x32')]=_['map'](_0x1a5e5b,_0x95ae('0x2b'));_0x5241e8[_0x95ae('0x33')]=_[_0x95ae('0x34')](_0x5a1b45[_0x95ae('0x33')]);_0x5241e8[_0x95ae('0x35')]=_[_0x95ae('0x36')](_0x5241e8[_0x95ae('0x32')],_0x5241e8[_0x95ae('0x33')]);_0x4ccf80['attributes']=_[_0x95ae('0x36')](_0x5241e8[_0x95ae('0x32')],qs[_0x95ae('0x37')](_0x5a1b45[_0x95ae('0x33')][_0x95ae('0x37')]));_0x4ccf80[_0x95ae('0x38')]=_0x4ccf80['attributes'][_0x95ae('0x39')]?_0x4ccf80[_0x95ae('0x38')]:_0x5241e8[_0x95ae('0x32')];if(!_0x5a1b45[_0x95ae('0x33')][_0x95ae('0x3a')](_0x95ae('0x3b'))){_0x4ccf80['limit']=qs[_0x95ae('0x23')](_0x5a1b45[_0x95ae('0x33')][_0x95ae('0x23')]);_0x4ccf80['offset']=qs[_0x95ae('0x20')](_0x5a1b45['query'][_0x95ae('0x20')]);}_0x4ccf80['order']=qs[_0x95ae('0x3c')](_0x5a1b45['query'][_0x95ae('0x3c')]);_0x4ccf80[_0x95ae('0x3d')]=qs[_0x95ae('0x35')](_[_0x95ae('0x3e')](_0x5a1b45[_0x95ae('0x33')],_0x5241e8[_0x95ae('0x35')]),_0x1a5e5b);if(_0x5a1b45['query'][_0x95ae('0x3f')]){_0x4ccf80['where']=_[_0x95ae('0x40')](_0x4ccf80['where'],{'$or':_[_0x95ae('0x41')](_0x1a5e5b,function(_0x1903b7){if(_0x1903b7[_0x95ae('0x42')]!==_0x95ae('0x43')){var _0x3e7ff1={};_0x3e7ff1[_0x1903b7['name']]={'$like':'%'+_0x5a1b45['query'][_0x95ae('0x3f')]+'%'};return _0x3e7ff1;}})});}_0x4ccf80=_['merge']({},_0x4ccf80,_0x5a1b45[_0x95ae('0x44')]);var _0x3c08c2={'where':_0x4ccf80[_0x95ae('0x3d')]};return db[_0x95ae('0x2e')]['count'](_0x3c08c2)['then'](function(_0x426421){_0x1ebe5a['count']=_0x426421;if(_0x5a1b45[_0x95ae('0x33')]['includeAll']){_0x4ccf80[_0x95ae('0x45')]=[{'all':!![]}];}return db[_0x95ae('0x2e')][_0x95ae('0x46')](_0x4ccf80);})['then'](function(_0x2e3136){_0x1ebe5a[_0x95ae('0x47')]=_0x2e3136;return _0x1ebe5a;})[_0x95ae('0x29')](respondWithFilteredResult(_0x7fa1eb,_0x4ccf80))[_0x95ae('0x48')](handleError(_0x7fa1eb,null));};exports[_0x95ae('0x49')]=function(_0x48d4fa,_0x67aede){var _0x367b7a={'raw':![],'where':{'id':_0x48d4fa[_0x95ae('0x4a')]['id']}},_0x4687f6={};_0x4687f6[_0x95ae('0x32')]=_[_0x95ae('0x34')](db[_0x95ae('0x2e')]['rawAttributes']);_0x4687f6[_0x95ae('0x33')]=_[_0x95ae('0x34')](_0x48d4fa[_0x95ae('0x33')]);_0x4687f6['filters']=_['intersection'](_0x4687f6[_0x95ae('0x32')],_0x4687f6[_0x95ae('0x33')]);_0x367b7a['attributes']=_[_0x95ae('0x36')](_0x4687f6['model'],qs[_0x95ae('0x37')](_0x48d4fa[_0x95ae('0x33')][_0x95ae('0x37')]));_0x367b7a['attributes']=_0x367b7a[_0x95ae('0x38')][_0x95ae('0x39')]?_0x367b7a[_0x95ae('0x38')]:_0x4687f6[_0x95ae('0x32')];if(_0x48d4fa[_0x95ae('0x33')][_0x95ae('0x4b')]){_0x367b7a[_0x95ae('0x45')]=[{'all':!![]}];}_0x367b7a=_[_0x95ae('0x40')]({},_0x367b7a,_0x48d4fa['options']);return db['SugarcrmConfiguration']['find'](_0x367b7a)[_0x95ae('0x29')](handleEntityNotFound(_0x67aede,null))['then'](respondWithResult(_0x67aede,null))[_0x95ae('0x48')](handleError(_0x67aede,null));};exports[_0x95ae('0x4c')]=function(_0x257b38,_0x4dbb38){return db[_0x95ae('0x2e')][_0x95ae('0x4c')](_0x257b38[_0x95ae('0x4d')],{})[_0x95ae('0x29')](respondWithResult(_0x4dbb38,0xc9))[_0x95ae('0x48')](handleError(_0x4dbb38,null));};exports[_0x95ae('0x4e')]=function(_0x2668fe,_0x4f9a44){if(_0x2668fe[_0x95ae('0x4d')]['id']){delete _0x2668fe['body']['id'];}return db[_0x95ae('0x2e')]['find']({'where':{'id':_0x2668fe[_0x95ae('0x4a')]['id']}})[_0x95ae('0x29')](handleEntityNotFound(_0x4f9a44,null))['then'](saveUpdates(_0x2668fe[_0x95ae('0x4d')],null))['then'](respondWithResult(_0x4f9a44,null))['catch'](handleError(_0x4f9a44,null));};exports[_0x95ae('0x28')]=function(_0x397f7e,_0x3085f1){return db[_0x95ae('0x2e')][_0x95ae('0x4f')]({'where':{'id':_0x397f7e[_0x95ae('0x4a')]['id']}})[_0x95ae('0x29')](handleEntityNotFound(_0x3085f1,null))[_0x95ae('0x29')](removeEntity(_0x3085f1,null))[_0x95ae('0x48')](handleError(_0x3085f1,null));};exports[_0x95ae('0x50')]=function(_0x572318,_0x3fb5b7,_0x92506b){var _0x201571={};var _0x4d9f23={};var _0x37ce1d;var _0x1097b1;return db[_0x95ae('0x2e')][_0x95ae('0x51')]({'where':{'id':_0x572318['params']['id']}})[_0x95ae('0x29')](handleEntityNotFound(_0x3fb5b7,null))[_0x95ae('0x29')](function(_0x763c4b){if(_0x763c4b){_0x37ce1d=_0x763c4b;_0x4d9f23[_0x95ae('0x32')]=_['keys'](db[_0x95ae('0x52')][_0x95ae('0x2f')]);_0x4d9f23[_0x95ae('0x33')]=_['keys'](_0x572318[_0x95ae('0x33')]);_0x4d9f23['filters']=_['intersection'](_0x4d9f23[_0x95ae('0x32')],_0x4d9f23[_0x95ae('0x33')]);_0x201571[_0x95ae('0x38')]=_['intersection'](_0x4d9f23[_0x95ae('0x32')],qs['fields'](_0x572318['query'][_0x95ae('0x37')]));_0x201571[_0x95ae('0x38')]=_0x201571[_0x95ae('0x38')]['length']?_0x201571[_0x95ae('0x38')]:_0x4d9f23['model'];_0x201571[_0x95ae('0x53')]=qs[_0x95ae('0x3c')](_0x572318[_0x95ae('0x33')][_0x95ae('0x3c')]);_0x201571[_0x95ae('0x3d')]=qs[_0x95ae('0x35')](_[_0x95ae('0x3e')](_0x572318[_0x95ae('0x33')],_0x4d9f23['filters']));if(_0x572318['query'][_0x95ae('0x3f')]){_0x201571[_0x95ae('0x3d')]=_[_0x95ae('0x40')](_0x201571[_0x95ae('0x3d')],{'$or':_['map'](_0x201571[_0x95ae('0x38')],function(_0x3ab660){var _0x15da17={};_0x15da17[_0x3ab660]={'$like':'%'+_0x572318[_0x95ae('0x33')][_0x95ae('0x3f')]+'%'};return _0x15da17;})});}_0x201571=_['merge']({},_0x201571,_0x572318['options']);return _0x37ce1d[_0x95ae('0x50')](_0x201571);}})['then'](function(_0x47fd55){if(_0x47fd55){_0x1097b1=_0x47fd55[_0x95ae('0x39')];if(!_0x572318['query'][_0x95ae('0x3a')]('nolimit')){_0x201571[_0x95ae('0x23')]=qs[_0x95ae('0x23')](_0x572318[_0x95ae('0x33')][_0x95ae('0x23')]);_0x201571[_0x95ae('0x20')]=qs['offset'](_0x572318[_0x95ae('0x33')]['offset']);}return _0x37ce1d[_0x95ae('0x50')](_0x201571);}})[_0x95ae('0x29')](function(_0xf10aff){if(_0xf10aff){return _0xf10aff?{'count':_0x1097b1,'rows':_0xf10aff}:null;}})[_0x95ae('0x29')](respondWithResult(_0x3fb5b7,null))[_0x95ae('0x48')](handleError(_0x3fb5b7,null));};exports[_0x95ae('0x54')]=function(_0xddedb6,_0x34ef78,_0x1dc55a){var _0x22a6fc={};var _0x103638={};var _0x305ad5;var _0x3f8e52;return db[_0x95ae('0x2e')][_0x95ae('0x51')]({'where':{'id':_0xddedb6[_0x95ae('0x4a')]['id']}})[_0x95ae('0x29')](handleEntityNotFound(_0x34ef78,null))[_0x95ae('0x29')](function(_0x489ff7){if(_0x489ff7){_0x305ad5=_0x489ff7;_0x103638[_0x95ae('0x32')]=_[_0x95ae('0x34')](db[_0x95ae('0x52')][_0x95ae('0x2f')]);_0x103638[_0x95ae('0x33')]=_[_0x95ae('0x34')](_0xddedb6['query']);_0x103638[_0x95ae('0x35')]=_[_0x95ae('0x36')](_0x103638[_0x95ae('0x32')],_0x103638[_0x95ae('0x33')]);_0x22a6fc[_0x95ae('0x38')]=_['intersection'](_0x103638[_0x95ae('0x32')],qs[_0x95ae('0x37')](_0xddedb6[_0x95ae('0x33')]['fields']));_0x22a6fc['attributes']=_0x22a6fc[_0x95ae('0x38')][_0x95ae('0x39')]?_0x22a6fc[_0x95ae('0x38')]:_0x103638[_0x95ae('0x32')];_0x22a6fc[_0x95ae('0x53')]=qs[_0x95ae('0x3c')](_0xddedb6[_0x95ae('0x33')]['sort']);_0x22a6fc[_0x95ae('0x3d')]=qs['filters'](_[_0x95ae('0x3e')](_0xddedb6[_0x95ae('0x33')],_0x103638[_0x95ae('0x35')]));if(_0xddedb6[_0x95ae('0x33')][_0x95ae('0x3f')]){_0x22a6fc[_0x95ae('0x3d')]=_['merge'](_0x22a6fc[_0x95ae('0x3d')],{'$or':_[_0x95ae('0x41')](_0x22a6fc[_0x95ae('0x38')],function(_0x4f9e45){var _0x2fdcd3={};_0x2fdcd3[_0x4f9e45]={'$like':'%'+_0xddedb6['query'][_0x95ae('0x3f')]+'%'};return _0x2fdcd3;})});}_0x22a6fc=_[_0x95ae('0x40')]({},_0x22a6fc,_0xddedb6[_0x95ae('0x44')]);return _0x305ad5[_0x95ae('0x54')](_0x22a6fc);}})[_0x95ae('0x29')](function(_0x528fd1){if(_0x528fd1){_0x3f8e52=_0x528fd1[_0x95ae('0x39')];if(!_0xddedb6[_0x95ae('0x33')][_0x95ae('0x3a')](_0x95ae('0x3b'))){_0x22a6fc[_0x95ae('0x23')]=qs[_0x95ae('0x23')](_0xddedb6['query'][_0x95ae('0x23')]);_0x22a6fc[_0x95ae('0x20')]=qs['offset'](_0xddedb6['query'][_0x95ae('0x20')]);}return _0x305ad5[_0x95ae('0x54')](_0x22a6fc);}})[_0x95ae('0x29')](function(_0x49c879){if(_0x49c879){return _0x49c879?{'count':_0x3f8e52,'rows':_0x49c879}:null;}})['then'](respondWithResult(_0x34ef78,null))[_0x95ae('0x48')](handleError(_0x34ef78,null));};exports[_0x95ae('0x55')]=function(_0xcd21df,_0x4162d3,_0x31e99e){var _0x2d18f4={};var _0x5f3823={};var _0x5779fb;var _0x12d001;return db[_0x95ae('0x2e')][_0x95ae('0x51')]({'where':{'id':_0xcd21df[_0x95ae('0x4a')]['id']}})[_0x95ae('0x29')](handleEntityNotFound(_0x4162d3,null))[_0x95ae('0x29')](function(_0x4fa9d7){if(_0x4fa9d7){_0x5779fb=_0x4fa9d7;_0x5f3823['model']=_['keys'](db[_0x95ae('0x52')][_0x95ae('0x2f')]);_0x5f3823[_0x95ae('0x33')]=_[_0x95ae('0x34')](_0xcd21df['query']);_0x5f3823[_0x95ae('0x35')]=_[_0x95ae('0x36')](_0x5f3823[_0x95ae('0x32')],_0x5f3823[_0x95ae('0x33')]);_0x2d18f4[_0x95ae('0x38')]=_[_0x95ae('0x36')](_0x5f3823[_0x95ae('0x32')],qs[_0x95ae('0x37')](_0xcd21df['query']['fields']));_0x2d18f4['attributes']=_0x2d18f4[_0x95ae('0x38')]['length']?_0x2d18f4['attributes']:_0x5f3823['model'];_0x2d18f4[_0x95ae('0x53')]=qs[_0x95ae('0x3c')](_0xcd21df['query'][_0x95ae('0x3c')]);_0x2d18f4[_0x95ae('0x3d')]=qs[_0x95ae('0x35')](_[_0x95ae('0x3e')](_0xcd21df['query'],_0x5f3823[_0x95ae('0x35')]));if(_0xcd21df[_0x95ae('0x33')][_0x95ae('0x3f')]){_0x2d18f4[_0x95ae('0x3d')]=_[_0x95ae('0x40')](_0x2d18f4[_0x95ae('0x3d')],{'$or':_['map'](_0x2d18f4[_0x95ae('0x38')],function(_0x244c4f){var _0x11daba={};_0x11daba[_0x244c4f]={'$like':'%'+_0xcd21df[_0x95ae('0x33')][_0x95ae('0x3f')]+'%'};return _0x11daba;})});}_0x2d18f4=_[_0x95ae('0x40')]({},_0x2d18f4,_0xcd21df[_0x95ae('0x44')]);return _0x5779fb[_0x95ae('0x55')](_0x2d18f4);}})['then'](function(_0x253512){if(_0x253512){_0x12d001=_0x253512[_0x95ae('0x39')];if(!_0xcd21df[_0x95ae('0x33')][_0x95ae('0x3a')]('nolimit')){_0x2d18f4[_0x95ae('0x23')]=qs['limit'](_0xcd21df[_0x95ae('0x33')][_0x95ae('0x23')]);_0x2d18f4[_0x95ae('0x20')]=qs[_0x95ae('0x20')](_0xcd21df[_0x95ae('0x33')][_0x95ae('0x20')]);}return _0x5779fb[_0x95ae('0x55')](_0x2d18f4);}})['then'](function(_0x1f456a){if(_0x1f456a){return _0x1f456a?{'count':_0x12d001,'rows':_0x1f456a}:null;}})[_0x95ae('0x29')](respondWithResult(_0x4162d3,null))[_0x95ae('0x48')](handleError(_0x4162d3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index bbaef4a..ca34e54 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 _0x60d3=['./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','bluebird','path','../../config/environment'];(function(_0x2ed0e5,_0x5b7826){var _0x554c3e=function(_0x534bf1){while(--_0x534bf1){_0x2ed0e5['push'](_0x2ed0e5['shift']());}};_0x554c3e(++_0x5b7826);}(_0x60d3,0xaf));var _0x360d=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x60d3[_0x725b8e];return _0x43ac45;};'use strict';var _=require('lodash');var util=require(_0x360d('0x0'));var logger=require(_0x360d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x360d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x360d('0x3'));var rimraf=require('rimraf');var config=require(_0x360d('0x4'));var attributes=require(_0x360d('0x5'));module[_0x360d('0x6')]=function(_0x596496,_0x1953e3){return _0x596496[_0x360d('0x7')](_0x360d('0x8'),attributes,{'tableName':_0x360d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a87=['./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5a87,0x17e));var _0x75a8=function(_0x56fb7d,_0x539ea1){_0x56fb7d=_0x56fb7d-0x0;var _0x3be1c3=_0x5a87[_0x56fb7d];return _0x3be1c3;};'use strict';var _=require(_0x75a8('0x0'));var util=require(_0x75a8('0x1'));var logger=require('../../config/logger')(_0x75a8('0x2'));var moment=require(_0x75a8('0x3'));var BPromise=require(_0x75a8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75a8('0x5'));var rimraf=require(_0x75a8('0x6'));var config=require(_0x75a8('0x7'));var attributes=require(_0x75a8('0x8'));module[_0x75a8('0x9')]=function(_0x29439a,_0x5f489e){return _0x29439a[_0x75a8('0xa')](_0x75a8('0xb'),attributes,{'tableName':_0x75a8('0xc'),'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 549ba9a..c99013f 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 _0xc483=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3f154b,_0x2950e7){var _0x5b4b3a=function(_0x287650){while(--_0x287650){_0x3f154b['push'](_0x3f154b['shift']());}};_0x5b4b3a(++_0x2950e7);}(_0xc483,0x75));var _0x3c48=function(_0x215a04,_0x295789){_0x215a04=_0x215a04-0x0;var _0x189dd9=_0xc483[_0x215a04];return _0x189dd9;};'use strict';var _=require(_0x3c48('0x0'));var util=require(_0x3c48('0x1'));var moment=require(_0x3c48('0x2'));var BPromise=require(_0x3c48('0x3'));var rs=require(_0x3c48('0x4'));var fs=require('fs');var Redis=require(_0x3c48('0x5'));var db=require(_0x3c48('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3c48('0x7'))(_0x3c48('0x8'));var config=require(_0x3c48('0x9'));var jayson=require(_0x3c48('0xa'));var client=jayson['client'][_0x3c48('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51bcb8,_0x10fe41,_0x29f4ed){return new BPromise(function(_0x4e315e,_0x4ac27b){return client[_0x3c48('0xc')](_0x51bcb8,_0x29f4ed)[_0x3c48('0xd')](function(_0x26ddae){logger[_0x3c48('0xe')](_0x3c48('0xf'),_0x10fe41,_0x3c48('0x10'));logger['debug'](_0x3c48('0x11'),_0x10fe41,_0x3c48('0x10'),JSON[_0x3c48('0x12')](_0x26ddae));if(_0x26ddae[_0x3c48('0x13')]){if(_0x26ddae['error']['code']===0x1f4){logger[_0x3c48('0x13')](_0x3c48('0xf'),_0x10fe41,_0x26ddae[_0x3c48('0x13')][_0x3c48('0x14')]);return _0x4ac27b(_0x26ddae['error'][_0x3c48('0x14')]);}logger[_0x3c48('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x10fe41,_0x26ddae['error']['message']);return _0x4e315e(_0x26ddae[_0x3c48('0x13')][_0x3c48('0x14')]);}else{logger[_0x3c48('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x10fe41,_0x3c48('0x10'));_0x4e315e(_0x26ddae[_0x3c48('0x15')]['message']);}})[_0x3c48('0x16')](function(_0x4e33b2){logger[_0x3c48('0x13')](_0x3c48('0xf'),_0x10fe41,_0x4e33b2);_0x4ac27b(_0x4e33b2);});});} \ No newline at end of file +var _0xd491=['debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x2df220,_0x24caf9){var _0x41a0d6=function(_0xb26fc1){while(--_0xb26fc1){_0x2df220['push'](_0x2df220['shift']());}};_0x41a0d6(++_0x24caf9);}(_0xd491,0x179));var _0x1d49=function(_0x12688b,_0x18768b){_0x12688b=_0x12688b-0x0;var _0x413662=_0xd491[_0x12688b];return _0x413662;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1d49('0x0'));var BPromise=require(_0x1d49('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d49('0x2'));var db=require(_0x1d49('0x3'))['db'];var utils=require(_0x1d49('0x4'));var logger=require(_0x1d49('0x5'))(_0x1d49('0x6'));var config=require(_0x1d49('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1d49('0x8')][_0x1d49('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fdbf4,_0x4bf996,_0x267c4e){return new BPromise(function(_0x345cca,_0xb35399){return client[_0x1d49('0xa')](_0x4fdbf4,_0x267c4e)[_0x1d49('0xb')](function(_0x47cce5){logger['info'](_0x1d49('0xc'),_0x4bf996,_0x1d49('0xd'));logger[_0x1d49('0xe')](_0x1d49('0xf'),_0x4bf996,_0x1d49('0xd'),JSON[_0x1d49('0x10')](_0x47cce5));if(_0x47cce5[_0x1d49('0x11')]){if(_0x47cce5[_0x1d49('0x11')][_0x1d49('0x12')]===0x1f4){logger['error'](_0x1d49('0xc'),_0x4bf996,_0x47cce5[_0x1d49('0x11')][_0x1d49('0x13')]);return _0xb35399(_0x47cce5[_0x1d49('0x11')]['message']);}logger['error'](_0x1d49('0xc'),_0x4bf996,_0x47cce5[_0x1d49('0x11')][_0x1d49('0x13')]);return _0x345cca(_0x47cce5[_0x1d49('0x11')]['message']);}else{logger[_0x1d49('0x14')](_0x1d49('0xc'),_0x4bf996,_0x1d49('0xd'));_0x345cca(_0x47cce5[_0x1d49('0x15')][_0x1d49('0x13')]);}})[_0x1d49('0x16')](function(_0x5957c7){logger[_0x1d49('0x11')](_0x1d49('0xc'),_0x4bf996,_0x5957c7);_0xb35399(_0x5957c7);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index a7cd525..2f39522 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 _0xcdee=['post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x34bbe2,_0x509c53){var _0x1474c0=function(_0x495a18){while(--_0x495a18){_0x34bbe2['push'](_0x34bbe2['shift']());}};_0x1474c0(++_0x509c53);}(_0xcdee,0x16e));var _0xecde=function(_0x252502,_0x30dac0){_0x252502=_0x252502-0x0;var _0x3640d0=_0xcdee[_0x252502];return _0x3640d0;};'use strict';var multer=require(_0xecde('0x0'));var util=require(_0xecde('0x1'));var path=require('path');var timeout=require(_0xecde('0x2'));var express=require(_0xecde('0x3'));var router=express[_0xecde('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xecde('0x5'));var config=require(_0xecde('0x6'));var controller=require('./intSugarcrmField.controller');router['get']('/',auth[_0xecde('0x7')](),controller[_0xecde('0x8')]);router[_0xecde('0x9')](_0xecde('0xa'),auth[_0xecde('0x7')](),controller[_0xecde('0xb')]);router[_0xecde('0xc')]('/',auth[_0xecde('0x7')](),controller[_0xecde('0xd')]);router[_0xecde('0xe')](_0xecde('0xa'),auth[_0xecde('0x7')](),controller[_0xecde('0xf')]);router[_0xecde('0x10')](_0xecde('0xa'),auth[_0xecde('0x7')](),controller['destroy']);module[_0xecde('0x11')]=router; \ No newline at end of file +var _0xbd1c=['./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x231544,_0x592bab){var _0x3a96df=function(_0x542502){while(--_0x542502){_0x231544['push'](_0x231544['shift']());}};_0x3a96df(++_0x592bab);}(_0xbd1c,0xad));var _0xcbd1=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xbd1c[_0x1573ea];return _0x51c0e2;};'use strict';var multer=require(_0xcbd1('0x0'));var util=require(_0xcbd1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcbd1('0x2'));var router=express[_0xcbd1('0x3')]();var fs_extra=require(_0xcbd1('0x4'));var auth=require(_0xcbd1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcbd1('0x6'));var controller=require(_0xcbd1('0x7'));router[_0xcbd1('0x8')]('/',auth[_0xcbd1('0x9')](),controller[_0xcbd1('0xa')]);router['get'](_0xcbd1('0xb'),auth['isAuthenticated'](),controller[_0xcbd1('0xc')]);router[_0xcbd1('0xd')]('/',auth[_0xcbd1('0x9')](),controller['create']);router[_0xcbd1('0xe')]('/:id',auth[_0xcbd1('0x9')](),controller[_0xcbd1('0xf')]);router['delete'](_0xcbd1('0xb'),auth[_0xcbd1('0x9')](),controller[_0xcbd1('0x10')]);module[_0xcbd1('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 9ddaee7..9dcd21f 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 _0x48cd=['exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x48cd,0x1cb));var _0xd48c=function(_0x4d2ddc,_0x32eac3){_0x4d2ddc=_0x4d2ddc-0x0;var _0x24b4e1=_0x48cd[_0x4d2ddc];return _0x24b4e1;};'use strict';var Sequelize=require(_0xd48c('0x0'));module[_0xd48c('0x1')]={'type':{'type':Sequelize[_0xd48c('0x2')]('string',_0xd48c('0x3'),_0xd48c('0x4'),_0xd48c('0x5'),_0xd48c('0x6')),'defaultValue':_0xd48c('0x7')},'content':{'type':Sequelize[_0xd48c('0x8')]},'key':{'type':Sequelize[_0xd48c('0x8')]},'keyType':{'type':Sequelize[_0xd48c('0x2')]('string',_0xd48c('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xd48c('0x8')]},'idField':{'type':Sequelize[_0xd48c('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd48c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb696=['exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize'];(function(_0x1064db,_0x3a6f4b){var _0x1e7444=function(_0x14b284){while(--_0x14b284){_0x1064db['push'](_0x1064db['shift']());}};_0x1e7444(++_0x3a6f4b);}(_0xb696,0x104));var _0x6b69=function(_0x11e857,_0x44d6cd){_0x11e857=_0x11e857-0x0;var _0x10508c=_0xb696[_0x11e857];return _0x10508c;};'use strict';var Sequelize=require(_0x6b69('0x0'));module[_0x6b69('0x1')]={'type':{'type':Sequelize[_0x6b69('0x2')](_0x6b69('0x3'),_0x6b69('0x4'),_0x6b69('0x5'),'keyValue',_0x6b69('0x6')),'defaultValue':_0x6b69('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6b69('0x2')]('string',_0x6b69('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6b69('0x7')]},'nameField':{'type':Sequelize[_0x6b69('0x7')]},'customField':{'type':Sequelize[_0x6b69('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6b69('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 90d3cd1..e1d708d 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 _0x4ef5=['json','undefined','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','options','catch','create','find','body','params','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4ef5,0x15c));var _0x54ef=function(_0x51dc7c,_0x5af260){_0x51dc7c=_0x51dc7c-0x0;var _0x77ec21=_0x4ef5[_0x51dc7c];return _0x77ec21;};'use strict';var emlformat=require(_0x54ef('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x54ef('0x1'));var rp=require('request-promise');var moment=require(_0x54ef('0x2'));var BPromise=require(_0x54ef('0x3'));var Mustache=require(_0x54ef('0x4'));var util=require(_0x54ef('0x5'));var path=require(_0x54ef('0x6'));var sox=require(_0x54ef('0x7'));var csv=require(_0x54ef('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x54ef('0x9'));var _=require(_0x54ef('0xa'));var squel=require(_0x54ef('0xb'));var crypto=require(_0x54ef('0xc'));var jsforce=require(_0x54ef('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x54ef('0x8'));var querystring=require(_0x54ef('0xe'));var Papa=require(_0x54ef('0xf'));var Redis=require(_0x54ef('0x10'));var authService=require(_0x54ef('0x11'));var qs=require(_0x54ef('0x12'));var as=require(_0x54ef('0x13'));var hardwareService=require(_0x54ef('0x14'));var logger=require(_0x54ef('0x15'))(_0x54ef('0x16'));var utils=require(_0x54ef('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e7d17,_0x522658){_0x522658=_0x522658||0xcc;return function(_0x4f3555){if(_0x4f3555){return _0x2e7d17[_0x54ef('0x18')](_0x522658);}return _0x2e7d17[_0x54ef('0x19')](_0x522658)[_0x54ef('0x1a')]();};}function respondWithResult(_0x4cac0a,_0x2c3465){_0x2c3465=_0x2c3465||0xc8;return function(_0x28525d){if(_0x28525d){return _0x4cac0a[_0x54ef('0x19')](_0x2c3465)[_0x54ef('0x1b')](_0x28525d);}};}function respondWithFilteredResult(_0xe31e6,_0x388ba1){return function(_0x5b5ac4){if(_0x5b5ac4){var _0xa1f6bb=typeof _0x388ba1['offset']===_0x54ef('0x1c')&&typeof _0x388ba1['limit']===_0x54ef('0x1c');var _0x5d386f=_0x5b5ac4[_0x54ef('0x1d')];var _0x24918a=_0xa1f6bb?0x0:_0x388ba1[_0x54ef('0x1e')];var _0x574be0=_0xa1f6bb?_0x5b5ac4['count']:_0x388ba1[_0x54ef('0x1e')]+_0x388ba1[_0x54ef('0x1f')];var _0x17de8a;if(_0x574be0>=_0x5d386f){_0x574be0=_0x5d386f;_0x17de8a=0xc8;}else{_0x17de8a=0xce;}_0xe31e6[_0x54ef('0x19')](_0x17de8a);return _0xe31e6[_0x54ef('0x20')]('Content-Range',_0x24918a+'-'+_0x574be0+'/'+_0x5d386f)[_0x54ef('0x1b')](_0x5b5ac4);}return null;};}function patchUpdates(_0x535f74){return function(_0x5c15eb){try{jsonpatch[_0x54ef('0x21')](_0x5c15eb,_0x535f74,!![]);}catch(_0x27c335){return BPromise['reject'](_0x27c335);}return _0x5c15eb[_0x54ef('0x22')]();};}function saveUpdates(_0x4d90fe,_0x14ac05){return function(_0x4d930e){if(_0x4d930e){return _0x4d930e[_0x54ef('0x23')](_0x4d90fe)[_0x54ef('0x24')](function(_0x290633){return _0x290633;});}return null;};}function removeEntity(_0x4b3fbe,_0x480aaa){return function(_0x1db681){if(_0x1db681){return _0x1db681[_0x54ef('0x25')]()['then'](function(){_0x4b3fbe['status'](0xcc)[_0x54ef('0x1a')]();});}};}function handleEntityNotFound(_0x4ead75,_0x190033){return function(_0x44a772){if(!_0x44a772){_0x4ead75[_0x54ef('0x18')](0x194);}return _0x44a772;};}function handleError(_0x54aefd,_0x2b3e86){_0x2b3e86=_0x2b3e86||0x1f4;return function(_0x4b61f0){logger[_0x54ef('0x26')](_0x4b61f0[_0x54ef('0x27')]);if(_0x4b61f0['name']){delete _0x4b61f0[_0x54ef('0x28')];}_0x54aefd[_0x54ef('0x19')](_0x2b3e86)[_0x54ef('0x29')](_0x4b61f0);};}exports[_0x54ef('0x2a')]=function(_0x53853a,_0x4c94e4){var _0x481f76={},_0x168017={},_0x3575e2={'count':0x0,'rows':[]};var _0x18d74c=_[_0x54ef('0x2b')](db[_0x54ef('0x2c')]['rawAttributes'],function(_0x524a61){return{'name':_0x524a61[_0x54ef('0x2d')],'type':_0x524a61['type'][_0x54ef('0x2e')]};});_0x168017[_0x54ef('0x2f')]=_[_0x54ef('0x2b')](_0x18d74c,_0x54ef('0x28'));_0x168017[_0x54ef('0x30')]=_[_0x54ef('0x31')](_0x53853a['query']);_0x168017[_0x54ef('0x32')]=_['intersection'](_0x168017[_0x54ef('0x2f')],_0x168017[_0x54ef('0x30')]);_0x481f76[_0x54ef('0x33')]=_[_0x54ef('0x34')](_0x168017['model'],qs[_0x54ef('0x35')](_0x53853a[_0x54ef('0x30')][_0x54ef('0x35')]));_0x481f76[_0x54ef('0x33')]=_0x481f76[_0x54ef('0x33')][_0x54ef('0x36')]?_0x481f76[_0x54ef('0x33')]:_0x168017[_0x54ef('0x2f')];if(!_0x53853a[_0x54ef('0x30')][_0x54ef('0x37')](_0x54ef('0x38'))){_0x481f76[_0x54ef('0x1f')]=qs[_0x54ef('0x1f')](_0x53853a[_0x54ef('0x30')][_0x54ef('0x1f')]);_0x481f76[_0x54ef('0x1e')]=qs[_0x54ef('0x1e')](_0x53853a['query']['offset']);}_0x481f76[_0x54ef('0x39')]=qs[_0x54ef('0x3a')](_0x53853a[_0x54ef('0x30')][_0x54ef('0x3a')]);_0x481f76[_0x54ef('0x3b')]=qs['filters'](_['pick'](_0x53853a[_0x54ef('0x30')],_0x168017[_0x54ef('0x32')]),_0x18d74c);if(_0x53853a[_0x54ef('0x30')][_0x54ef('0x3c')]){_0x481f76[_0x54ef('0x3b')]=_[_0x54ef('0x3d')](_0x481f76[_0x54ef('0x3b')],{'$or':_[_0x54ef('0x2b')](_0x18d74c,function(_0x53707d){if(_0x53707d[_0x54ef('0x3e')]!==_0x54ef('0x3f')){var _0x394ddb={};_0x394ddb[_0x53707d[_0x54ef('0x28')]]={'$like':'%'+_0x53853a[_0x54ef('0x30')][_0x54ef('0x3c')]+'%'};return _0x394ddb;}})});}_0x481f76=_[_0x54ef('0x3d')]({},_0x481f76,_0x53853a['options']);var _0x3867be={'where':_0x481f76[_0x54ef('0x3b')]};return db[_0x54ef('0x2c')][_0x54ef('0x1d')](_0x3867be)['then'](function(_0x562735){_0x3575e2[_0x54ef('0x1d')]=_0x562735;if(_0x53853a[_0x54ef('0x30')][_0x54ef('0x40')]){_0x481f76[_0x54ef('0x41')]=[{'all':!![]}];}return db['SugarcrmField'][_0x54ef('0x42')](_0x481f76);})[_0x54ef('0x24')](function(_0x7f74f9){_0x3575e2[_0x54ef('0x43')]=_0x7f74f9;return _0x3575e2;})['then'](respondWithFilteredResult(_0x4c94e4,_0x481f76))['catch'](handleError(_0x4c94e4,null));};exports[_0x54ef('0x44')]=function(_0x3f9385,_0x48bc8a){var _0x72c658={'raw':!![],'where':{'id':_0x3f9385['params']['id']}},_0x438554={};_0x438554['model']=_['keys'](db[_0x54ef('0x2c')]['rawAttributes']);_0x438554[_0x54ef('0x30')]=_[_0x54ef('0x31')](_0x3f9385[_0x54ef('0x30')]);_0x438554['filters']=_[_0x54ef('0x34')](_0x438554[_0x54ef('0x2f')],_0x438554[_0x54ef('0x30')]);_0x72c658['attributes']=_[_0x54ef('0x34')](_0x438554[_0x54ef('0x2f')],qs[_0x54ef('0x35')](_0x3f9385[_0x54ef('0x30')][_0x54ef('0x35')]));_0x72c658[_0x54ef('0x33')]=_0x72c658['attributes']['length']?_0x72c658[_0x54ef('0x33')]:_0x438554[_0x54ef('0x2f')];if(_0x3f9385[_0x54ef('0x30')][_0x54ef('0x40')]){_0x72c658[_0x54ef('0x41')]=[{'all':!![]}];}_0x72c658=_[_0x54ef('0x3d')]({},_0x72c658,_0x3f9385[_0x54ef('0x45')]);return db[_0x54ef('0x2c')]['find'](_0x72c658)[_0x54ef('0x24')](handleEntityNotFound(_0x48bc8a,null))['then'](respondWithResult(_0x48bc8a,null))[_0x54ef('0x46')](handleError(_0x48bc8a,null));};exports[_0x54ef('0x47')]=function(_0x168974,_0xdf7a3){return db['SugarcrmField']['create'](_0x168974['body'],{})['then'](respondWithResult(_0xdf7a3,0xc9))[_0x54ef('0x46')](handleError(_0xdf7a3,null));};exports['update']=function(_0x97abfa,_0x4a25c1){if(_0x97abfa['body']['id']){delete _0x97abfa['body']['id'];}return db[_0x54ef('0x2c')][_0x54ef('0x48')]({'where':{'id':_0x97abfa['params']['id']}})[_0x54ef('0x24')](handleEntityNotFound(_0x4a25c1,null))[_0x54ef('0x24')](saveUpdates(_0x97abfa[_0x54ef('0x49')],null))['then'](respondWithResult(_0x4a25c1,null))[_0x54ef('0x46')](handleError(_0x4a25c1,null));};exports[_0x54ef('0x25')]=function(_0x428ce4,_0xe22fa6){return db[_0x54ef('0x2c')][_0x54ef('0x48')]({'where':{'id':_0x428ce4[_0x54ef('0x4a')]['id']}})[_0x54ef('0x24')](handleEntityNotFound(_0xe22fa6,null))[_0x54ef('0x24')](removeEntity(_0xe22fa6,null))[_0x54ef('0x46')](handleError(_0xe22fa6,null));}; \ No newline at end of file +var _0xf1ef=['offset','order','sort','where','pick','filter','merge','map','VIRTUAL','options','SugarcrmField','include','findAll','rows','catch','show','keys','includeAll','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x38fb1b,_0x297586){var _0x212b60=function(_0x7dc197){while(--_0x7dc197){_0x38fb1b['push'](_0x38fb1b['shift']());}};_0x212b60(++_0x297586);}(_0xf1ef,0x1e3));var _0xff1e=function(_0x299bf3,_0x5c2955){_0x299bf3=_0x299bf3-0x0;var _0x13301e=_0xf1ef[_0x299bf3];return _0x13301e;};'use strict';var emlformat=require(_0xff1e('0x0'));var rimraf=require(_0xff1e('0x1'));var zipdir=require(_0xff1e('0x2'));var jsonpatch=require(_0xff1e('0x3'));var rp=require(_0xff1e('0x4'));var moment=require(_0xff1e('0x5'));var BPromise=require(_0xff1e('0x6'));var Mustache=require('mustache');var util=require(_0xff1e('0x7'));var path=require('path');var sox=require(_0xff1e('0x8'));var csv=require(_0xff1e('0x9'));var ejs=require(_0xff1e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xff1e('0xb'));var crypto=require(_0xff1e('0xc'));var jsforce=require(_0xff1e('0xd'));var deskjs=require(_0xff1e('0xe'));var toCsv=require(_0xff1e('0x9'));var querystring=require(_0xff1e('0xf'));var Papa=require(_0xff1e('0x10'));var Redis=require('ioredis');var authService=require(_0xff1e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xff1e('0x12'));var hardwareService=require(_0xff1e('0x13'));var logger=require(_0xff1e('0x14'))(_0xff1e('0x15'));var utils=require(_0xff1e('0x16'));var config=require(_0xff1e('0x17'));var licenseUtil=require(_0xff1e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fcb95,_0x5e12a3){_0x5e12a3=_0x5e12a3||0xcc;return function(_0x3d3706){if(_0x3d3706){return _0x2fcb95[_0xff1e('0x19')](_0x5e12a3);}return _0x2fcb95['status'](_0x5e12a3)[_0xff1e('0x1a')]();};}function respondWithResult(_0x253034,_0x278f87){_0x278f87=_0x278f87||0xc8;return function(_0x56d9cb){if(_0x56d9cb){return _0x253034[_0xff1e('0x1b')](_0x278f87)[_0xff1e('0x1c')](_0x56d9cb);}};}function respondWithFilteredResult(_0x3123b1,_0x13cfe8){return function(_0x2176fa){if(_0x2176fa){var _0x4363b2=typeof _0x13cfe8['offset']===_0xff1e('0x1d')&&typeof _0x13cfe8[_0xff1e('0x1e')]===_0xff1e('0x1d');var _0x455f56=_0x2176fa[_0xff1e('0x1f')];var _0x51abec=_0x4363b2?0x0:_0x13cfe8['offset'];var _0x4426f4=_0x4363b2?_0x2176fa[_0xff1e('0x1f')]:_0x13cfe8['offset']+_0x13cfe8[_0xff1e('0x1e')];var _0xed4f79;if(_0x4426f4>=_0x455f56){_0x4426f4=_0x455f56;_0xed4f79=0xc8;}else{_0xed4f79=0xce;}_0x3123b1[_0xff1e('0x1b')](_0xed4f79);return _0x3123b1['set'](_0xff1e('0x20'),_0x51abec+'-'+_0x4426f4+'/'+_0x455f56)['json'](_0x2176fa);}return null;};}function patchUpdates(_0x27c5a1){return function(_0x39c8f6){try{jsonpatch[_0xff1e('0x21')](_0x39c8f6,_0x27c5a1,!![]);}catch(_0x3b7abb){return BPromise[_0xff1e('0x22')](_0x3b7abb);}return _0x39c8f6[_0xff1e('0x23')]();};}function saveUpdates(_0x1a08fc,_0x4ce74a){return function(_0x41d260){if(_0x41d260){return _0x41d260[_0xff1e('0x24')](_0x1a08fc)[_0xff1e('0x25')](function(_0x2d7496){return _0x2d7496;});}return null;};}function removeEntity(_0x207f59,_0x14024b){return function(_0x364524){if(_0x364524){return _0x364524[_0xff1e('0x26')]()['then'](function(){_0x207f59['status'](0xcc)[_0xff1e('0x1a')]();});}};}function handleEntityNotFound(_0x59b0e3,_0x3d3f8b){return function(_0x5a740a){if(!_0x5a740a){_0x59b0e3[_0xff1e('0x19')](0x194);}return _0x5a740a;};}function handleError(_0x105e08,_0x38f05a){_0x38f05a=_0x38f05a||0x1f4;return function(_0x4c0c72){logger[_0xff1e('0x27')](_0x4c0c72[_0xff1e('0x28')]);if(_0x4c0c72[_0xff1e('0x29')]){delete _0x4c0c72[_0xff1e('0x29')];}_0x105e08[_0xff1e('0x1b')](_0x38f05a)[_0xff1e('0x2a')](_0x4c0c72);};}exports[_0xff1e('0x2b')]=function(_0x13ac42,_0x1b1f03){var _0x417b7f={},_0x3bb8eb={},_0x1d3c47={'count':0x0,'rows':[]};var _0x17c559=_['map'](db['SugarcrmField'][_0xff1e('0x2c')],function(_0x81f2d4){return{'name':_0x81f2d4[_0xff1e('0x2d')],'type':_0x81f2d4[_0xff1e('0x2e')][_0xff1e('0x2f')]};});_0x3bb8eb[_0xff1e('0x30')]=_['map'](_0x17c559,'name');_0x3bb8eb[_0xff1e('0x31')]=_['keys'](_0x13ac42[_0xff1e('0x31')]);_0x3bb8eb[_0xff1e('0x32')]=_[_0xff1e('0x33')](_0x3bb8eb[_0xff1e('0x30')],_0x3bb8eb[_0xff1e('0x31')]);_0x417b7f[_0xff1e('0x34')]=_[_0xff1e('0x33')](_0x3bb8eb[_0xff1e('0x30')],qs[_0xff1e('0x35')](_0x13ac42[_0xff1e('0x31')][_0xff1e('0x35')]));_0x417b7f[_0xff1e('0x34')]=_0x417b7f['attributes'][_0xff1e('0x36')]?_0x417b7f[_0xff1e('0x34')]:_0x3bb8eb[_0xff1e('0x30')];if(!_0x13ac42[_0xff1e('0x31')][_0xff1e('0x37')]('nolimit')){_0x417b7f[_0xff1e('0x1e')]=qs['limit'](_0x13ac42['query'][_0xff1e('0x1e')]);_0x417b7f['offset']=qs['offset'](_0x13ac42[_0xff1e('0x31')][_0xff1e('0x38')]);}_0x417b7f[_0xff1e('0x39')]=qs[_0xff1e('0x3a')](_0x13ac42[_0xff1e('0x31')]['sort']);_0x417b7f[_0xff1e('0x3b')]=qs[_0xff1e('0x32')](_[_0xff1e('0x3c')](_0x13ac42[_0xff1e('0x31')],_0x3bb8eb['filters']),_0x17c559);if(_0x13ac42[_0xff1e('0x31')][_0xff1e('0x3d')]){_0x417b7f[_0xff1e('0x3b')]=_[_0xff1e('0x3e')](_0x417b7f[_0xff1e('0x3b')],{'$or':_[_0xff1e('0x3f')](_0x17c559,function(_0x1bc7c5){if(_0x1bc7c5[_0xff1e('0x2e')]!==_0xff1e('0x40')){var _0x240e66={};_0x240e66[_0x1bc7c5[_0xff1e('0x29')]]={'$like':'%'+_0x13ac42[_0xff1e('0x31')]['filter']+'%'};return _0x240e66;}})});}_0x417b7f=_['merge']({},_0x417b7f,_0x13ac42[_0xff1e('0x41')]);var _0x52a68e={'where':_0x417b7f['where']};return db[_0xff1e('0x42')]['count'](_0x52a68e)[_0xff1e('0x25')](function(_0xded21b){_0x1d3c47[_0xff1e('0x1f')]=_0xded21b;if(_0x13ac42[_0xff1e('0x31')]['includeAll']){_0x417b7f[_0xff1e('0x43')]=[{'all':!![]}];}return db[_0xff1e('0x42')][_0xff1e('0x44')](_0x417b7f);})[_0xff1e('0x25')](function(_0x31cd11){_0x1d3c47[_0xff1e('0x45')]=_0x31cd11;return _0x1d3c47;})['then'](respondWithFilteredResult(_0x1b1f03,_0x417b7f))[_0xff1e('0x46')](handleError(_0x1b1f03,null));};exports[_0xff1e('0x47')]=function(_0x2886e0,_0x5d646d){var _0x5f5550={'raw':!![],'where':{'id':_0x2886e0['params']['id']}},_0x2c1949={};_0x2c1949[_0xff1e('0x30')]=_[_0xff1e('0x48')](db[_0xff1e('0x42')][_0xff1e('0x2c')]);_0x2c1949['query']=_[_0xff1e('0x48')](_0x2886e0[_0xff1e('0x31')]);_0x2c1949[_0xff1e('0x32')]=_['intersection'](_0x2c1949[_0xff1e('0x30')],_0x2c1949[_0xff1e('0x31')]);_0x5f5550[_0xff1e('0x34')]=_['intersection'](_0x2c1949[_0xff1e('0x30')],qs[_0xff1e('0x35')](_0x2886e0[_0xff1e('0x31')]['fields']));_0x5f5550[_0xff1e('0x34')]=_0x5f5550[_0xff1e('0x34')]['length']?_0x5f5550[_0xff1e('0x34')]:_0x2c1949[_0xff1e('0x30')];if(_0x2886e0[_0xff1e('0x31')][_0xff1e('0x49')]){_0x5f5550[_0xff1e('0x43')]=[{'all':!![]}];}_0x5f5550=_[_0xff1e('0x3e')]({},_0x5f5550,_0x2886e0[_0xff1e('0x41')]);return db[_0xff1e('0x42')]['find'](_0x5f5550)[_0xff1e('0x25')](handleEntityNotFound(_0x5d646d,null))[_0xff1e('0x25')](respondWithResult(_0x5d646d,null))[_0xff1e('0x46')](handleError(_0x5d646d,null));};exports[_0xff1e('0x4a')]=function(_0x20149c,_0x497bff){return db[_0xff1e('0x42')]['create'](_0x20149c[_0xff1e('0x4b')],{})[_0xff1e('0x25')](respondWithResult(_0x497bff,0xc9))['catch'](handleError(_0x497bff,null));};exports[_0xff1e('0x24')]=function(_0x34fc22,_0x295ff7){if(_0x34fc22[_0xff1e('0x4b')]['id']){delete _0x34fc22['body']['id'];}return db[_0xff1e('0x42')]['find']({'where':{'id':_0x34fc22[_0xff1e('0x4c')]['id']}})[_0xff1e('0x25')](handleEntityNotFound(_0x295ff7,null))['then'](saveUpdates(_0x34fc22['body'],null))['then'](respondWithResult(_0x295ff7,null))[_0xff1e('0x46')](handleError(_0x295ff7,null));};exports[_0xff1e('0x26')]=function(_0x2d67a5,_0x3557ee){return db[_0xff1e('0x42')]['find']({'where':{'id':_0x2d67a5[_0xff1e('0x4c')]['id']}})[_0xff1e('0x25')](handleEntityNotFound(_0x3557ee,null))[_0xff1e('0x25')](removeEntity(_0x3557ee,null))[_0xff1e('0x46')](handleError(_0x3557ee,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 87a9095..0771af9 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 _0x007a=['../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','idField','FieldId','request-promise','rimraf'];(function(_0x5ca5bc,_0x5b8a9d){var _0x26ca86=function(_0x1ad9a6){while(--_0x1ad9a6){_0x5ca5bc['push'](_0x5ca5bc['shift']());}};_0x26ca86(++_0x5b8a9d);}(_0x007a,0x139));var _0xa007=function(_0x3a2295,_0x3064c9){_0x3a2295=_0x3a2295-0x0;var _0x569710=_0x007a[_0x3a2295];return _0x569710;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa007('0x0'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa007('0x1'));var config=require(_0xa007('0x2'));var attributes=require('./intSugarcrmField.attributes');module[_0xa007('0x3')]=function(_0x5d0b60,_0x4f18e2){return _0x5d0b60[_0xa007('0x4')](_0xa007('0x5'),attributes,{'tableName':_0xa007('0x6'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xa007('0x7'),_0xa007('0x8')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x51d4=['int_sugarcrm_fields','sugarcrm_unique_index','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intSugarcrmField.attributes','exports','SugarcrmField'];(function(_0x385380,_0x1a8069){var _0x1cfcd3=function(_0x516f91){while(--_0x516f91){_0x385380['push'](_0x385380['shift']());}};_0x1cfcd3(++_0x1a8069);}(_0x51d4,0x16a));var _0x451d=function(_0x557acc,_0x2bf699){_0x557acc=_0x557acc-0x0;var _0xb965f=_0x51d4[_0x557acc];return _0xb965f;};'use strict';var _=require('lodash');var util=require(_0x451d('0x0'));var logger=require(_0x451d('0x1'))(_0x451d('0x2'));var moment=require('moment');var BPromise=require(_0x451d('0x3'));var rp=require(_0x451d('0x4'));var fs=require('fs');var path=require(_0x451d('0x5'));var rimraf=require(_0x451d('0x6'));var config=require('../../config/environment');var attributes=require(_0x451d('0x7'));module[_0x451d('0x8')]=function(_0x252be7,_0x5b617f){return _0x252be7['define'](_0x451d('0x9'),attributes,{'tableName':_0x451d('0xa'),'paranoid':![],'indexes':[{'name':_0x451d('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index cb49660..f5b4a7c 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 _0xb5ed=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x13a767,_0x219b62){var _0xbf01ea=function(_0x2e7972){while(--_0x2e7972){_0x13a767['push'](_0x13a767['shift']());}};_0xbf01ea(++_0x219b62);}(_0xb5ed,0x8c));var _0xdb5e=function(_0x411459,_0x4c3d3d){_0x411459=_0x411459-0x0;var _0x152e54=_0xb5ed[_0x411459];return _0x152e54;};'use strict';var _=require(_0xdb5e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdb5e('0x1'));var rs=require(_0xdb5e('0x2'));var fs=require('fs');var Redis=require(_0xdb5e('0x3'));var db=require(_0xdb5e('0x4'))['db'];var utils=require(_0xdb5e('0x5'));var logger=require(_0xdb5e('0x6'))(_0xdb5e('0x7'));var config=require(_0xdb5e('0x8'));var jayson=require(_0xdb5e('0x9'));var client=jayson[_0xdb5e('0xa')][_0xdb5e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48b830,_0x3b0364,_0x12c78d){return new BPromise(function(_0x2c23dc,_0xecfc5f){return client[_0xdb5e('0xc')](_0x48b830,_0x12c78d)['then'](function(_0x31d2c5){logger[_0xdb5e('0xd')](_0xdb5e('0xe'),_0x3b0364,_0xdb5e('0xf'));logger[_0xdb5e('0x10')](_0xdb5e('0x11'),_0x3b0364,_0xdb5e('0xf'),JSON[_0xdb5e('0x12')](_0x31d2c5));if(_0x31d2c5[_0xdb5e('0x13')]){if(_0x31d2c5[_0xdb5e('0x13')][_0xdb5e('0x14')]===0x1f4){logger['error'](_0xdb5e('0xe'),_0x3b0364,_0x31d2c5[_0xdb5e('0x13')][_0xdb5e('0x15')]);return _0xecfc5f(_0x31d2c5[_0xdb5e('0x13')][_0xdb5e('0x15')]);}logger[_0xdb5e('0x13')](_0xdb5e('0xe'),_0x3b0364,_0x31d2c5[_0xdb5e('0x13')][_0xdb5e('0x15')]);return _0x2c23dc(_0x31d2c5['error'][_0xdb5e('0x15')]);}else{logger['info'](_0xdb5e('0xe'),_0x3b0364,_0xdb5e('0xf'));_0x2c23dc(_0x31d2c5[_0xdb5e('0x16')][_0xdb5e('0x15')]);}})[_0xdb5e('0x17')](function(_0x3c91fa){logger[_0xdb5e('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x3b0364,_0x3c91fa);_0xecfc5f(_0x3c91fa);});});} \ No newline at end of file +var _0x7142=['SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x1a5a3c,_0x5c0c48){var _0x1a02fa=function(_0x40bec2){while(--_0x40bec2){_0x1a5a3c['push'](_0x1a5a3c['shift']());}};_0x1a02fa(++_0x5c0c48);}(_0x7142,0xf9));var _0x2714=function(_0x4aeb4f,_0x581549){_0x4aeb4f=_0x4aeb4f-0x0;var _0x5311bb=_0x7142[_0x4aeb4f];return _0x5311bb;};'use strict';var _=require(_0x2714('0x0'));var util=require(_0x2714('0x1'));var moment=require('moment');var BPromise=require(_0x2714('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2714('0x3'))['db'];var utils=require(_0x2714('0x4'));var logger=require('../../config/logger')(_0x2714('0x5'));var config=require(_0x2714('0x6'));var jayson=require(_0x2714('0x7'));var client=jayson[_0x2714('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f54fa,_0x36ff44,_0x5dcdf2){return new BPromise(function(_0x59cd4b,_0xde5fe2){return client[_0x2714('0x9')](_0x4f54fa,_0x5dcdf2)[_0x2714('0xa')](function(_0x4b0c5a){logger['info'](_0x2714('0xb'),_0x36ff44,_0x2714('0xc'));logger['debug'](_0x2714('0xd'),_0x36ff44,_0x2714('0xc'),JSON[_0x2714('0xe')](_0x4b0c5a));if(_0x4b0c5a[_0x2714('0xf')]){if(_0x4b0c5a[_0x2714('0xf')][_0x2714('0x10')]===0x1f4){logger['error'](_0x2714('0xb'),_0x36ff44,_0x4b0c5a[_0x2714('0xf')][_0x2714('0x11')]);return _0xde5fe2(_0x4b0c5a[_0x2714('0xf')][_0x2714('0x11')]);}logger[_0x2714('0xf')](_0x2714('0xb'),_0x36ff44,_0x4b0c5a[_0x2714('0xf')][_0x2714('0x11')]);return _0x59cd4b(_0x4b0c5a['error'][_0x2714('0x11')]);}else{logger[_0x2714('0x12')](_0x2714('0xb'),_0x36ff44,_0x2714('0xc'));_0x59cd4b(_0x4b0c5a[_0x2714('0x13')][_0x2714('0x11')]);}})['catch'](function(_0x534f84){logger['error'](_0x2714('0xb'),_0x36ff44,_0x534f84);_0xde5fe2(_0x534f84);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 5873564..9982981 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 _0x649b=['fs-extra','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','getFields','post','put','/:id','update','destroy','path','connect-timeout'];(function(_0x56e4e7,_0x1db098){var _0x383618=function(_0xb088c6){while(--_0xb088c6){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x383618(++_0x1db098);}(_0x649b,0x166));var _0xb649=function(_0x2865ef,_0xf0e643){_0x2865ef=_0x2865ef-0x0;var _0x4fc567=_0x649b[_0x2865ef];return _0x4fc567;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb649('0x0'));var timeout=require(_0xb649('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb649('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xb649('0x3'));var config=require(_0xb649('0x4'));var controller=require(_0xb649('0x5'));router['get']('/',auth[_0xb649('0x6')](),controller[_0xb649('0x7')]);router[_0xb649('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb649('0x9')]);router['get'](_0xb649('0xa'),auth[_0xb649('0x6')](),controller[_0xb649('0xb')]);router[_0xb649('0x8')]('/:id/fields',auth[_0xb649('0x6')](),controller[_0xb649('0xc')]);router[_0xb649('0xd')]('/',auth[_0xb649('0x6')](),controller['create']);router[_0xb649('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0xb649('0xe')](_0xb649('0xf'),auth[_0xb649('0x6')](),controller[_0xb649('0x10')]);router['delete'](_0xb649('0xf'),auth[_0xb649('0x6')](),controller[_0xb649('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0dba=['/:id/configurations','getConfigurations','getFields','create','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','/:id','isAuthenticated','show'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0dba,0x136));var _0xa0db=function(_0x3e0d9b,_0x1e4467){_0x3e0d9b=_0x3e0d9b-0x0;var _0x1c8716=_0x0dba[_0x3e0d9b];return _0x1c8716;};'use strict';var multer=require(_0xa0db('0x0'));var util=require(_0xa0db('0x1'));var path=require(_0xa0db('0x2'));var timeout=require(_0xa0db('0x3'));var express=require(_0xa0db('0x4'));var router=express[_0xa0db('0x5')]();var fs_extra=require(_0xa0db('0x6'));var auth=require(_0xa0db('0x7'));var interaction=require(_0xa0db('0x8'));var config=require(_0xa0db('0x9'));var controller=require(_0xa0db('0xa'));router[_0xa0db('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa0db('0xc'),auth[_0xa0db('0xd')](),controller[_0xa0db('0xe')]);router['get'](_0xa0db('0xf'),auth[_0xa0db('0xd')](),controller[_0xa0db('0x10')]);router[_0xa0db('0xb')]('/:id/fields',auth[_0xa0db('0xd')](),controller[_0xa0db('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa0db('0x12')]);router[_0xa0db('0x13')](_0xa0db('0xf'),auth[_0xa0db('0xd')](),controller['addConfiguration']);router[_0xa0db('0x14')](_0xa0db('0xc'),auth[_0xa0db('0xd')](),controller[_0xa0db('0x15')]);router[_0xa0db('0x16')](_0xa0db('0xc'),auth[_0xa0db('0xd')](),controller[_0xa0db('0x17')]);module[_0xa0db('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 70eef8c..d902eb8 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 _0xfdd1=['HelpDesk','exports','STRING'];(function(_0x584c45,_0x2705df){var _0xbb3c26=function(_0x5d07ba){while(--_0x5d07ba){_0x584c45['push'](_0x584c45['shift']());}};_0xbb3c26(++_0x2705df);}(_0xfdd1,0x1c3));var _0x1fdd=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0xfdd1[_0x2ae2ad];return _0x26dbd7;};'use strict';var Sequelize=require('sequelize');module[_0x1fdd('0x0')]={'name':{'type':Sequelize[_0x1fdd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1fdd('0x1')]},'username':{'type':Sequelize[_0x1fdd('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1fdd('0x2')},'remoteUri':{'type':Sequelize[_0x1fdd('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x1fdd('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x1fdd('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x88e4=['exports','STRING','sequelize'];(function(_0x2f71a0,_0x29f6b4){var _0x25a4cd=function(_0x10abe6){while(--_0x10abe6){_0x2f71a0['push'](_0x2f71a0['shift']());}};_0x25a4cd(++_0x29f6b4);}(_0x88e4,0xa7));var _0x488e=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x88e4[_0x5a79e2];return _0x266c45;};'use strict';var Sequelize=require(_0x488e('0x0'));module[_0x488e('0x1')]={'name':{'type':Sequelize[_0x488e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x488e('0x2')]},'username':{'type':Sequelize[_0x488e('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x488e('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x488e('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x488e('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 6258692..a951e69 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 _0x85fc=['addConfiguration','Subjects','channel','Descriptions','VtigerField','md5','getFields','username','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','%s/webservice.php','getchallenge','success','GET','describe','result','sessionName','reference','remove','includes','editable','false','startsWith','cf_','picklistValues','label','value','log','vTiger\x20error:\x20','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','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/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','rows','catch','length','includeAll','find','create','body','destroy','params','getConfigurations','findOne','VtigerConfiguration'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x85fc,0x9b));var _0xc85f=function(_0x1a2570,_0x3b8e42){_0x1a2570=_0x1a2570-0x0;var _0x2ae038=_0x85fc[_0x1a2570];return _0x2ae038;};'use strict';var emlformat=require(_0xc85f('0x0'));var rimraf=require(_0xc85f('0x1'));var zipdir=require(_0xc85f('0x2'));var jsonpatch=require(_0xc85f('0x3'));var rp=require('request-promise');var moment=require(_0xc85f('0x4'));var BPromise=require(_0xc85f('0x5'));var Mustache=require('mustache');var util=require(_0xc85f('0x6'));var path=require(_0xc85f('0x7'));var sox=require(_0xc85f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc85f('0x9'));var _=require(_0xc85f('0xa'));var squel=require(_0xc85f('0xb'));var crypto=require(_0xc85f('0xc'));var jsforce=require(_0xc85f('0xd'));var deskjs=require(_0xc85f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc85f('0xf'));var Papa=require('papaparse');var Redis=require(_0xc85f('0x10'));var authService=require(_0xc85f('0x11'));var qs=require(_0xc85f('0x12'));var as=require(_0xc85f('0x13'));var hardwareService=require(_0xc85f('0x14'));var logger=require(_0xc85f('0x15'))('api');var utils=require(_0xc85f('0x16'));var config=require(_0xc85f('0x17'));var licenseUtil=require(_0xc85f('0x18'));var db=require(_0xc85f('0x19'))['db'];var integrations=require(_0xc85f('0x1a'));function respondWithStatusCode(_0x31de8d,_0x46dd3b){_0x46dd3b=_0x46dd3b||0xcc;return function(_0x57740b){if(_0x57740b){return _0x31de8d['sendStatus'](_0x46dd3b);}return _0x31de8d['status'](_0x46dd3b)[_0xc85f('0x1b')]();};}function respondWithResult(_0x93c2c4,_0x2d89d3){_0x2d89d3=_0x2d89d3||0xc8;return function(_0x346b62){if(_0x346b62){return _0x93c2c4[_0xc85f('0x1c')](_0x2d89d3)[_0xc85f('0x1d')](_0x346b62);}};}function respondWithFilteredResult(_0xa71273,_0x570efe){return function(_0x3856f6){if(_0x3856f6){var _0x381c4b=typeof _0x570efe['offset']===_0xc85f('0x1e')&&typeof _0x570efe[_0xc85f('0x1f')]===_0xc85f('0x1e');var _0xa44556=_0x3856f6['count'];var _0x3f8995=_0x381c4b?0x0:_0x570efe[_0xc85f('0x20')];var _0x57a5c1=_0x381c4b?_0x3856f6[_0xc85f('0x21')]:_0x570efe['offset']+_0x570efe[_0xc85f('0x1f')];var _0x5f23d5;if(_0x57a5c1>=_0xa44556){_0x57a5c1=_0xa44556;_0x5f23d5=0xc8;}else{_0x5f23d5=0xce;}_0xa71273[_0xc85f('0x1c')](_0x5f23d5);return _0xa71273['set'](_0xc85f('0x22'),_0x3f8995+'-'+_0x57a5c1+'/'+_0xa44556)[_0xc85f('0x1d')](_0x3856f6);}return null;};}function patchUpdates(_0x4b0c77){return function(_0x276852){try{jsonpatch[_0xc85f('0x23')](_0x276852,_0x4b0c77,!![]);}catch(_0x3010bc){return BPromise[_0xc85f('0x24')](_0x3010bc);}return _0x276852[_0xc85f('0x25')]();};}function saveUpdates(_0x4524fb,_0x1163ad){return function(_0x1ec920){if(_0x1ec920){return _0x1ec920[_0xc85f('0x26')](_0x4524fb)['then'](function(_0x5e501a){return _0x5e501a;});}return null;};}function removeEntity(_0x5201b7,_0x2a1570){return function(_0x5a7bf9){if(_0x5a7bf9){return _0x5a7bf9['destroy']()[_0xc85f('0x27')](function(){_0x5201b7[_0xc85f('0x1c')](0xcc)[_0xc85f('0x1b')]();});}};}function handleEntityNotFound(_0x372cd0,_0x2bb26c){return function(_0x154be2){if(!_0x154be2){_0x372cd0['sendStatus'](0x194);}return _0x154be2;};}function handleError(_0x3b1b5f,_0x40cc35){_0x40cc35=_0x40cc35||0x1f4;return function(_0x152711){logger['error'](_0x152711['stack']);if(_0x152711[_0xc85f('0x28')]){delete _0x152711[_0xc85f('0x28')];}_0x3b1b5f['status'](_0x40cc35)[_0xc85f('0x29')](_0x152711);};}exports[_0xc85f('0x2a')]=function(_0x3c2be6,_0xb764a1){var _0xf4374e={},_0x523f68={},_0x515b4f={'count':0x0,'rows':[]};var _0x141574=_[_0xc85f('0x2b')](db[_0xc85f('0x2c')][_0xc85f('0x2d')],function(_0x542322){return{'name':_0x542322[_0xc85f('0x2e')],'type':_0x542322[_0xc85f('0x2f')]['key']};});_0x523f68[_0xc85f('0x30')]=_[_0xc85f('0x2b')](_0x141574,_0xc85f('0x28'));_0x523f68[_0xc85f('0x31')]=_[_0xc85f('0x32')](_0x3c2be6['query']);_0x523f68[_0xc85f('0x33')]=_[_0xc85f('0x34')](_0x523f68[_0xc85f('0x30')],_0x523f68[_0xc85f('0x31')]);_0xf4374e[_0xc85f('0x35')]=_[_0xc85f('0x34')](_0x523f68['model'],qs[_0xc85f('0x36')](_0x3c2be6[_0xc85f('0x31')][_0xc85f('0x36')]));_0xf4374e[_0xc85f('0x35')]=_0xf4374e[_0xc85f('0x35')]['length']?_0xf4374e[_0xc85f('0x35')]:_0x523f68[_0xc85f('0x30')];if(!_0x3c2be6[_0xc85f('0x31')][_0xc85f('0x37')](_0xc85f('0x38'))){_0xf4374e[_0xc85f('0x1f')]=qs[_0xc85f('0x1f')](_0x3c2be6[_0xc85f('0x31')][_0xc85f('0x1f')]);_0xf4374e[_0xc85f('0x20')]=qs[_0xc85f('0x20')](_0x3c2be6[_0xc85f('0x31')][_0xc85f('0x20')]);}_0xf4374e[_0xc85f('0x39')]=qs[_0xc85f('0x3a')](_0x3c2be6[_0xc85f('0x31')][_0xc85f('0x3a')]);_0xf4374e[_0xc85f('0x3b')]=qs[_0xc85f('0x33')](_[_0xc85f('0x3c')](_0x3c2be6[_0xc85f('0x31')],_0x523f68[_0xc85f('0x33')]),_0x141574);if(_0x3c2be6[_0xc85f('0x31')][_0xc85f('0x3d')]){_0xf4374e[_0xc85f('0x3b')]=_['merge'](_0xf4374e['where'],{'$or':_['map'](_0x141574,function(_0x1b86f5){if(_0x1b86f5['type']!=='VIRTUAL'){var _0x194a90={};_0x194a90[_0x1b86f5['name']]={'$like':'%'+_0x3c2be6['query'][_0xc85f('0x3d')]+'%'};return _0x194a90;}})});}_0xf4374e=_[_0xc85f('0x3e')]({},_0xf4374e,_0x3c2be6[_0xc85f('0x3f')]);var _0x3f23b8={'where':_0xf4374e[_0xc85f('0x3b')]};return db[_0xc85f('0x2c')][_0xc85f('0x21')](_0x3f23b8)[_0xc85f('0x27')](function(_0x3cb442){_0x515b4f[_0xc85f('0x21')]=_0x3cb442;if(_0x3c2be6[_0xc85f('0x31')]['includeAll']){_0xf4374e['include']=[{'all':!![]}];}return db['VtigerAccount'][_0xc85f('0x40')](_0xf4374e);})[_0xc85f('0x27')](function(_0x56b547){_0x515b4f[_0xc85f('0x41')]=_0x56b547;return _0x515b4f;})['then'](respondWithFilteredResult(_0xb764a1,_0xf4374e))[_0xc85f('0x42')](handleError(_0xb764a1,null));};exports['show']=function(_0x29f210,_0x2382ff){var _0x3ea873={'raw':![],'where':{'id':_0x29f210['params']['id']}},_0x152bca={};_0x152bca[_0xc85f('0x30')]=_[_0xc85f('0x32')](db['VtigerAccount'][_0xc85f('0x2d')]);_0x152bca[_0xc85f('0x31')]=_['keys'](_0x29f210[_0xc85f('0x31')]);_0x152bca[_0xc85f('0x33')]=_[_0xc85f('0x34')](_0x152bca[_0xc85f('0x30')],_0x152bca[_0xc85f('0x31')]);_0x3ea873['attributes']=_[_0xc85f('0x34')](_0x152bca[_0xc85f('0x30')],qs[_0xc85f('0x36')](_0x29f210[_0xc85f('0x31')]['fields']));_0x3ea873[_0xc85f('0x35')]=_0x3ea873[_0xc85f('0x35')][_0xc85f('0x43')]?_0x3ea873[_0xc85f('0x35')]:_0x152bca[_0xc85f('0x30')];if(_0x29f210[_0xc85f('0x31')][_0xc85f('0x44')]){_0x3ea873['include']=[{'all':!![]}];}_0x3ea873=_['merge']({},_0x3ea873,_0x29f210[_0xc85f('0x3f')]);return db[_0xc85f('0x2c')][_0xc85f('0x45')](_0x3ea873)[_0xc85f('0x27')](handleEntityNotFound(_0x2382ff,null))[_0xc85f('0x27')](respondWithResult(_0x2382ff,null))[_0xc85f('0x42')](handleError(_0x2382ff,null));};exports['create']=function(_0x35267f,_0x470655){return db[_0xc85f('0x2c')][_0xc85f('0x46')](_0x35267f[_0xc85f('0x47')],{})['then'](respondWithResult(_0x470655,0xc9))[_0xc85f('0x42')](handleError(_0x470655,null));};exports['update']=function(_0x3932f5,_0x317e28){if(_0x3932f5['body']['id']){delete _0x3932f5['body']['id'];}return db[_0xc85f('0x2c')][_0xc85f('0x45')]({'where':{'id':_0x3932f5['params']['id']}})[_0xc85f('0x27')](handleEntityNotFound(_0x317e28,null))[_0xc85f('0x27')](saveUpdates(_0x3932f5['body'],null))['then'](respondWithResult(_0x317e28,null))[_0xc85f('0x42')](handleError(_0x317e28,null));};exports[_0xc85f('0x48')]=function(_0xcf6aa5,_0x181457){return db['VtigerAccount'][_0xc85f('0x45')]({'where':{'id':_0xcf6aa5[_0xc85f('0x49')]['id']}})[_0xc85f('0x27')](handleEntityNotFound(_0x181457,null))['then'](removeEntity(_0x181457,null))['catch'](handleError(_0x181457,null));};exports[_0xc85f('0x4a')]=function(_0x4daa12,_0xaf41af,_0x460138){var _0x69a927={};var _0x4c6387={};var _0x54da06;var _0x224f39;return db[_0xc85f('0x2c')][_0xc85f('0x4b')]({'where':{'id':_0x4daa12[_0xc85f('0x49')]['id']}})['then'](handleEntityNotFound(_0xaf41af,null))[_0xc85f('0x27')](function(_0x59af22){if(_0x59af22){_0x54da06=_0x59af22;_0x4c6387[_0xc85f('0x30')]=_['keys'](db[_0xc85f('0x4c')][_0xc85f('0x2d')]);_0x4c6387[_0xc85f('0x31')]=_['keys'](_0x4daa12[_0xc85f('0x31')]);_0x4c6387['filters']=_[_0xc85f('0x34')](_0x4c6387[_0xc85f('0x30')],_0x4c6387[_0xc85f('0x31')]);_0x69a927['attributes']=_[_0xc85f('0x34')](_0x4c6387['model'],qs[_0xc85f('0x36')](_0x4daa12[_0xc85f('0x31')][_0xc85f('0x36')]));_0x69a927[_0xc85f('0x35')]=_0x69a927[_0xc85f('0x35')][_0xc85f('0x43')]?_0x69a927[_0xc85f('0x35')]:_0x4c6387[_0xc85f('0x30')];_0x69a927[_0xc85f('0x39')]=qs[_0xc85f('0x3a')](_0x4daa12[_0xc85f('0x31')]['sort']);_0x69a927[_0xc85f('0x3b')]=qs['filters'](_[_0xc85f('0x3c')](_0x4daa12[_0xc85f('0x31')],_0x4c6387[_0xc85f('0x33')]));if(_0x4daa12[_0xc85f('0x31')][_0xc85f('0x3d')]){_0x69a927['where']=_[_0xc85f('0x3e')](_0x69a927['where'],{'$or':_['map'](_0x69a927[_0xc85f('0x35')],function(_0x2ed882){var _0x59d9c8={};_0x59d9c8[_0x2ed882]={'$like':'%'+_0x4daa12['query'][_0xc85f('0x3d')]+'%'};return _0x59d9c8;})});}_0x69a927=_[_0xc85f('0x3e')]({},_0x69a927,_0x4daa12[_0xc85f('0x3f')]);return _0x54da06[_0xc85f('0x4a')](_0x69a927);}})['then'](function(_0x58f174){if(_0x58f174){_0x224f39=_0x58f174['length'];if(!_0x4daa12[_0xc85f('0x31')]['hasOwnProperty'](_0xc85f('0x38'))){_0x69a927[_0xc85f('0x1f')]=qs['limit'](_0x4daa12[_0xc85f('0x31')][_0xc85f('0x1f')]);_0x69a927[_0xc85f('0x20')]=qs[_0xc85f('0x20')](_0x4daa12[_0xc85f('0x31')]['offset']);}return _0x54da06[_0xc85f('0x4a')](_0x69a927);}})[_0xc85f('0x27')](function(_0x4e5c26){if(_0x4e5c26){return _0x4e5c26?{'count':_0x224f39,'rows':_0x4e5c26}:null;}})['then'](respondWithResult(_0xaf41af,null))[_0xc85f('0x42')](handleError(_0xaf41af,null));};exports[_0xc85f('0x4d')]=function(_0x151c0f,_0x55d41f,_0x40f4d3){if(_0x151c0f[_0xc85f('0x47')]['id']){delete _0x151c0f['body']['id'];}return db['VtigerAccount'][_0xc85f('0x4b')]({'where':{'id':_0x151c0f['params']['id']}})['then'](handleEntityNotFound(_0x55d41f,null))[_0xc85f('0x27')](function(_0x342dfb){if(_0x342dfb){_0x151c0f[_0xc85f('0x47')]['AccountId']=_0x342dfb['id'];_0x151c0f[_0xc85f('0x47')][_0xc85f('0x4e')]=integrations['getSubjects'](_0x151c0f[_0xc85f('0x47')][_0xc85f('0x4f')],_0x151c0f[_0xc85f('0x47')][_0xc85f('0x2f')]);_0x151c0f[_0xc85f('0x47')][_0xc85f('0x50')]=integrations['getDescriptions'](_0x151c0f[_0xc85f('0x47')][_0xc85f('0x4f')],_0x151c0f[_0xc85f('0x47')][_0xc85f('0x2f')]);return db['VtigerConfiguration'][_0xc85f('0x46')](_0x151c0f[_0xc85f('0x47')],{'include':[{'model':db['VtigerField'],'as':_0xc85f('0x4e')},{'model':db[_0xc85f('0x51')],'as':_0xc85f('0x50')}]});}return null;})[_0xc85f('0x27')](respondWithResult(_0x55d41f,null))[_0xc85f('0x42')](handleError(_0x55d41f,null));};var md5=require(_0xc85f('0x52'));exports[_0xc85f('0x53')]=function(_0x2a44e0,_0x532389,_0x1396a1){var _0x5b4e30=null;var _0x58a6d4=null;var _0x2a5ad3=null;var _0x41628b=null;var _0xd36ed7='';return db[_0xc85f('0x2c')][_0xc85f('0x4b')]({'where':{'id':_0x2a44e0['params']['id']},'attributes':['id',_0xc85f('0x28'),_0xc85f('0x54'),'description',_0xc85f('0x55'),_0xc85f('0x56'),_0xc85f('0x57'),_0xc85f('0x58')]})[_0xc85f('0x27')](handleEntityNotFound(_0x532389,null))['then'](function(_0x318fa1){if(_0x318fa1){_0x5b4e30=_0x318fa1[_0xc85f('0x54')];_0x58a6d4=_0x318fa1[_0xc85f('0x58')];_0x2a5ad3=_0x318fa1[_0xc85f('0x55')];_0xd36ed7=_0x318fa1[_0xc85f('0x56')];var _0x117ec5=_0xd36ed7[_0xc85f('0x59')](-0x1);if(_0x117ec5==='/'){_0xd36ed7=_0xd36ed7[_0xc85f('0x5a')](0x0,_0xd36ed7[_0xc85f('0x5b')](_0x117ec5));}_0x41628b=util['format'](_0xc85f('0x5c'),_0xd36ed7);var _0x2dd1f3={'method':'GET','uri':_0x41628b,'qs':{'operation':_0xc85f('0x5d'),'username':_0x318fa1[_0xc85f('0x54')]},'json':!![]};return rp(_0x2dd1f3);}})[_0xc85f('0x27')](function(_0x3d3938){if(_0x3d3938[_0xc85f('0x5e')]){var _0x42f55e={'method':'POST','uri':_0x41628b,'form':{'operation':'login','username':_0x5b4e30,'accessKey':md5(_0x3d3938['result']['token']+_0x58a6d4)},'json':!![]};return rp(_0x42f55e);}})[_0xc85f('0x27')](function(_0x4366b8){if(_0x4366b8[_0xc85f('0x5e')]){var _0x38064b={'method':_0xc85f('0x5f'),'uri':_0x41628b,'qs':{'operation':_0xc85f('0x60'),'username':_0x5b4e30,'sessionName':_0x4366b8[_0xc85f('0x61')][_0xc85f('0x62')],'elementType':_0x2a5ad3},'json':!![]};return rp(_0x38064b);}})[_0xc85f('0x27')](function(_0x381885){if(_0x381885['success']){var _0x377d8a=['autogenerated',_0xc85f('0x63'),'owner'];_[_0xc85f('0x64')](_0x381885[_0xc85f('0x61')][_0xc85f('0x36')],function(_0x542e2a){return _0x377d8a[_0xc85f('0x65')](_0x542e2a[_0xc85f('0x2f')][_0xc85f('0x28')]);});_[_0xc85f('0x64')](_0x381885[_0xc85f('0x61')][_0xc85f('0x36')],function(_0x5942f8){return _0x5942f8[_0xc85f('0x66')]===_0xc85f('0x67');});return{'count':_0x381885[_0xc85f('0x61')][_0xc85f('0x36')][_0xc85f('0x43')],'rows':_[_0xc85f('0x2b')](_0x381885[_0xc85f('0x61')][_0xc85f('0x36')],function(_0x1fd36a){return{'id':_0x1fd36a['name'],'name':_0x1fd36a['label'],'custom':_[_0xc85f('0x68')](_0x1fd36a[_0xc85f('0x28')],_0xc85f('0x69'))?!![]:![],'options':_0x1fd36a[_0xc85f('0x2f')]['name']==='picklist'&&_0x1fd36a[_0xc85f('0x2f')][_0xc85f('0x6a')][_0xc85f('0x43')]>0x0?_[_0xc85f('0x2b')](_0x1fd36a[_0xc85f('0x2f')][_0xc85f('0x6a')],function(_0x597fda){return{'name':_0x597fda[_0xc85f('0x6b')],'value':_0x597fda[_0xc85f('0x6c')]};}):[]};})};}})[_0xc85f('0x27')](respondWithResult(_0x532389,null))[_0xc85f('0x42')](function(_0xcf899e){console[_0xc85f('0x6d')](_0xc85f('0x6e')+_0xcf899e);var _0x51a49f=_0x2a44e0[_0xc85f('0x31')][_0xc85f('0x6f')]?0x1f4:_0xcf899e[_0xc85f('0x70')]||0x1f4;logger[_0xc85f('0x71')]('getFields,\x20%s,\x20%s,\x20%s',_0xc85f('0x53'),_0x51a49f,JSON[_0xc85f('0x72')](_0xcf899e));delete _0xcf899e[_0xc85f('0x28')];if(_0x51a49f===0x191){_0x51a49f=0x190;}_0x532389[_0xc85f('0x1c')](_0x51a49f)[_0xc85f('0x29')](_0x2a44e0[_0xc85f('0x31')][_0xc85f('0x6f')]?{'message':_0xc85f('0x73'),'statusCode':_0xcf899e['statusCode']}:_0xcf899e);});}; \ No newline at end of file +var _0xa910=['picklistValues','value','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VtigerAccount','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','find','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','VtigerField','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','GET','getchallenge','success','POST','result','describe','sessionName','autogenerated','remove','includes','editable','false','label','startsWith','cf_'];(function(_0x2ee368,_0x935ce3){var _0x4cd5d3=function(_0x210a90){while(--_0x210a90){_0x2ee368['push'](_0x2ee368['shift']());}};_0x4cd5d3(++_0x935ce3);}(_0xa910,0x1d5));var _0x0a91=function(_0x5a6fc3,_0x314aa8){_0x5a6fc3=_0x5a6fc3-0x0;var _0x4d3f32=_0xa910[_0x5a6fc3];return _0x4d3f32;};'use strict';var emlformat=require(_0x0a91('0x0'));var rimraf=require(_0x0a91('0x1'));var zipdir=require(_0x0a91('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0a91('0x3'));var moment=require(_0x0a91('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0a91('0x5'));var util=require(_0x0a91('0x6'));var path=require(_0x0a91('0x7'));var sox=require(_0x0a91('0x8'));var csv=require(_0x0a91('0x9'));var ejs=require(_0x0a91('0xa'));var fs=require('fs');var fs_extra=require(_0x0a91('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0a91('0xc'));var jsforce=require(_0x0a91('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0a91('0x9'));var querystring=require(_0x0a91('0xe'));var Papa=require(_0x0a91('0xf'));var Redis=require(_0x0a91('0x10'));var authService=require(_0x0a91('0x11'));var qs=require(_0x0a91('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a91('0x13'));var logger=require('../../config/logger')(_0x0a91('0x14'));var utils=require('../../config/utils');var config=require(_0x0a91('0x15'));var licenseUtil=require(_0x0a91('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0a91('0x17'));function respondWithStatusCode(_0x2c4885,_0x201473){_0x201473=_0x201473||0xcc;return function(_0x59f2ae){if(_0x59f2ae){return _0x2c4885['sendStatus'](_0x201473);}return _0x2c4885[_0x0a91('0x18')](_0x201473)['end']();};}function respondWithResult(_0x576c21,_0x3d944c){_0x3d944c=_0x3d944c||0xc8;return function(_0x4d31de){if(_0x4d31de){return _0x576c21[_0x0a91('0x18')](_0x3d944c)[_0x0a91('0x19')](_0x4d31de);}};}function respondWithFilteredResult(_0x2987da,_0x343094){return function(_0x1d8769){if(_0x1d8769){var _0x35c628=typeof _0x343094[_0x0a91('0x1a')]===_0x0a91('0x1b')&&typeof _0x343094[_0x0a91('0x1c')]===_0x0a91('0x1b');var _0x4373c6=_0x1d8769[_0x0a91('0x1d')];var _0x3e155d=_0x35c628?0x0:_0x343094[_0x0a91('0x1a')];var _0x3dc9bc=_0x35c628?_0x1d8769['count']:_0x343094[_0x0a91('0x1a')]+_0x343094[_0x0a91('0x1c')];var _0x57d0af;if(_0x3dc9bc>=_0x4373c6){_0x3dc9bc=_0x4373c6;_0x57d0af=0xc8;}else{_0x57d0af=0xce;}_0x2987da[_0x0a91('0x18')](_0x57d0af);return _0x2987da['set'](_0x0a91('0x1e'),_0x3e155d+'-'+_0x3dc9bc+'/'+_0x4373c6)[_0x0a91('0x19')](_0x1d8769);}return null;};}function patchUpdates(_0x888fa4){return function(_0x4642ce){try{jsonpatch[_0x0a91('0x1f')](_0x4642ce,_0x888fa4,!![]);}catch(_0x1de1db){return BPromise[_0x0a91('0x20')](_0x1de1db);}return _0x4642ce[_0x0a91('0x21')]();};}function saveUpdates(_0x471bbb,_0x579730){return function(_0x441635){if(_0x441635){return _0x441635[_0x0a91('0x22')](_0x471bbb)[_0x0a91('0x23')](function(_0x48cb44){return _0x48cb44;});}return null;};}function removeEntity(_0xeb1692,_0x4a6e72){return function(_0x55cd13){if(_0x55cd13){return _0x55cd13[_0x0a91('0x24')]()[_0x0a91('0x23')](function(){_0xeb1692[_0x0a91('0x18')](0xcc)[_0x0a91('0x25')]();});}};}function handleEntityNotFound(_0x42eb6c,_0xee7239){return function(_0x39e75a){if(!_0x39e75a){_0x42eb6c['sendStatus'](0x194);}return _0x39e75a;};}function handleError(_0x4e1389,_0x496d2e){_0x496d2e=_0x496d2e||0x1f4;return function(_0x1173a3){logger[_0x0a91('0x26')](_0x1173a3['stack']);if(_0x1173a3[_0x0a91('0x27')]){delete _0x1173a3[_0x0a91('0x27')];}_0x4e1389['status'](_0x496d2e)[_0x0a91('0x28')](_0x1173a3);};}exports[_0x0a91('0x29')]=function(_0x30a25e,_0x5ee291){var _0x163eb1={},_0x969fbb={},_0x5bf789={'count':0x0,'rows':[]};var _0x3420ef=_[_0x0a91('0x2a')](db[_0x0a91('0x2b')]['rawAttributes'],function(_0x66e3af){return{'name':_0x66e3af['fieldName'],'type':_0x66e3af[_0x0a91('0x2c')]['key']};});_0x969fbb[_0x0a91('0x2d')]=_[_0x0a91('0x2a')](_0x3420ef,_0x0a91('0x27'));_0x969fbb[_0x0a91('0x2e')]=_[_0x0a91('0x2f')](_0x30a25e[_0x0a91('0x2e')]);_0x969fbb['filters']=_['intersection'](_0x969fbb[_0x0a91('0x2d')],_0x969fbb['query']);_0x163eb1['attributes']=_[_0x0a91('0x30')](_0x969fbb[_0x0a91('0x2d')],qs[_0x0a91('0x31')](_0x30a25e['query']['fields']));_0x163eb1[_0x0a91('0x32')]=_0x163eb1[_0x0a91('0x32')][_0x0a91('0x33')]?_0x163eb1['attributes']:_0x969fbb['model'];if(!_0x30a25e['query'][_0x0a91('0x34')](_0x0a91('0x35'))){_0x163eb1['limit']=qs[_0x0a91('0x1c')](_0x30a25e[_0x0a91('0x2e')][_0x0a91('0x1c')]);_0x163eb1['offset']=qs[_0x0a91('0x1a')](_0x30a25e['query']['offset']);}_0x163eb1[_0x0a91('0x36')]=qs[_0x0a91('0x37')](_0x30a25e[_0x0a91('0x2e')][_0x0a91('0x37')]);_0x163eb1[_0x0a91('0x38')]=qs['filters'](_[_0x0a91('0x39')](_0x30a25e['query'],_0x969fbb[_0x0a91('0x3a')]),_0x3420ef);if(_0x30a25e['query']['filter']){_0x163eb1['where']=_[_0x0a91('0x3b')](_0x163eb1[_0x0a91('0x38')],{'$or':_[_0x0a91('0x2a')](_0x3420ef,function(_0x2e9af3){if(_0x2e9af3[_0x0a91('0x2c')]!=='VIRTUAL'){var _0x2fd91f={};_0x2fd91f[_0x2e9af3[_0x0a91('0x27')]]={'$like':'%'+_0x30a25e['query'][_0x0a91('0x3c')]+'%'};return _0x2fd91f;}})});}_0x163eb1=_[_0x0a91('0x3b')]({},_0x163eb1,_0x30a25e['options']);var _0x29e61c={'where':_0x163eb1[_0x0a91('0x38')]};return db[_0x0a91('0x2b')][_0x0a91('0x1d')](_0x29e61c)[_0x0a91('0x23')](function(_0x58492b){_0x5bf789[_0x0a91('0x1d')]=_0x58492b;if(_0x30a25e['query'][_0x0a91('0x3d')]){_0x163eb1[_0x0a91('0x3e')]=[{'all':!![]}];}return db[_0x0a91('0x2b')][_0x0a91('0x3f')](_0x163eb1);})['then'](function(_0x2422cc){_0x5bf789[_0x0a91('0x40')]=_0x2422cc;return _0x5bf789;})[_0x0a91('0x23')](respondWithFilteredResult(_0x5ee291,_0x163eb1))[_0x0a91('0x41')](handleError(_0x5ee291,null));};exports[_0x0a91('0x42')]=function(_0x56634d,_0x27dea3){var _0x48b58e={'raw':![],'where':{'id':_0x56634d[_0x0a91('0x43')]['id']}},_0x38711c={};_0x38711c['model']=_['keys'](db[_0x0a91('0x2b')][_0x0a91('0x44')]);_0x38711c['query']=_[_0x0a91('0x2f')](_0x56634d[_0x0a91('0x2e')]);_0x38711c[_0x0a91('0x3a')]=_[_0x0a91('0x30')](_0x38711c[_0x0a91('0x2d')],_0x38711c[_0x0a91('0x2e')]);_0x48b58e[_0x0a91('0x32')]=_['intersection'](_0x38711c[_0x0a91('0x2d')],qs[_0x0a91('0x31')](_0x56634d[_0x0a91('0x2e')]['fields']));_0x48b58e[_0x0a91('0x32')]=_0x48b58e[_0x0a91('0x32')][_0x0a91('0x33')]?_0x48b58e[_0x0a91('0x32')]:_0x38711c['model'];if(_0x56634d['query'][_0x0a91('0x3d')]){_0x48b58e[_0x0a91('0x3e')]=[{'all':!![]}];}_0x48b58e=_[_0x0a91('0x3b')]({},_0x48b58e,_0x56634d[_0x0a91('0x45')]);return db[_0x0a91('0x2b')]['find'](_0x48b58e)['then'](handleEntityNotFound(_0x27dea3,null))[_0x0a91('0x23')](respondWithResult(_0x27dea3,null))[_0x0a91('0x41')](handleError(_0x27dea3,null));};exports['create']=function(_0x28bd40,_0x2d42e1){return db[_0x0a91('0x2b')][_0x0a91('0x46')](_0x28bd40[_0x0a91('0x47')],{})['then'](respondWithResult(_0x2d42e1,0xc9))[_0x0a91('0x41')](handleError(_0x2d42e1,null));};exports[_0x0a91('0x22')]=function(_0x2b6e73,_0x1299ac){if(_0x2b6e73[_0x0a91('0x47')]['id']){delete _0x2b6e73[_0x0a91('0x47')]['id'];}return db[_0x0a91('0x2b')]['find']({'where':{'id':_0x2b6e73[_0x0a91('0x43')]['id']}})['then'](handleEntityNotFound(_0x1299ac,null))['then'](saveUpdates(_0x2b6e73[_0x0a91('0x47')],null))[_0x0a91('0x23')](respondWithResult(_0x1299ac,null))[_0x0a91('0x41')](handleError(_0x1299ac,null));};exports[_0x0a91('0x24')]=function(_0x12d44d,_0x212051){return db['VtigerAccount'][_0x0a91('0x48')]({'where':{'id':_0x12d44d['params']['id']}})[_0x0a91('0x23')](handleEntityNotFound(_0x212051,null))['then'](removeEntity(_0x212051,null))['catch'](handleError(_0x212051,null));};exports[_0x0a91('0x49')]=function(_0x1368ab,_0xed7211,_0x5193cd){var _0xe9c2dd={};var _0x3d8010={};var _0x13a8f7;var _0x947e99;return db[_0x0a91('0x2b')][_0x0a91('0x4a')]({'where':{'id':_0x1368ab[_0x0a91('0x43')]['id']}})['then'](handleEntityNotFound(_0xed7211,null))[_0x0a91('0x23')](function(_0x167acc){if(_0x167acc){_0x13a8f7=_0x167acc;_0x3d8010[_0x0a91('0x2d')]=_['keys'](db[_0x0a91('0x4b')][_0x0a91('0x44')]);_0x3d8010[_0x0a91('0x2e')]=_[_0x0a91('0x2f')](_0x1368ab[_0x0a91('0x2e')]);_0x3d8010[_0x0a91('0x3a')]=_[_0x0a91('0x30')](_0x3d8010['model'],_0x3d8010[_0x0a91('0x2e')]);_0xe9c2dd[_0x0a91('0x32')]=_[_0x0a91('0x30')](_0x3d8010['model'],qs['fields'](_0x1368ab[_0x0a91('0x2e')]['fields']));_0xe9c2dd[_0x0a91('0x32')]=_0xe9c2dd[_0x0a91('0x32')][_0x0a91('0x33')]?_0xe9c2dd['attributes']:_0x3d8010['model'];_0xe9c2dd[_0x0a91('0x36')]=qs[_0x0a91('0x37')](_0x1368ab['query'][_0x0a91('0x37')]);_0xe9c2dd['where']=qs[_0x0a91('0x3a')](_[_0x0a91('0x39')](_0x1368ab['query'],_0x3d8010[_0x0a91('0x3a')]));if(_0x1368ab['query'][_0x0a91('0x3c')]){_0xe9c2dd[_0x0a91('0x38')]=_[_0x0a91('0x3b')](_0xe9c2dd['where'],{'$or':_[_0x0a91('0x2a')](_0xe9c2dd[_0x0a91('0x32')],function(_0x21783a){var _0x4a8823={};_0x4a8823[_0x21783a]={'$like':'%'+_0x1368ab['query'][_0x0a91('0x3c')]+'%'};return _0x4a8823;})});}_0xe9c2dd=_['merge']({},_0xe9c2dd,_0x1368ab[_0x0a91('0x45')]);return _0x13a8f7[_0x0a91('0x49')](_0xe9c2dd);}})[_0x0a91('0x23')](function(_0x1709a6){if(_0x1709a6){_0x947e99=_0x1709a6[_0x0a91('0x33')];if(!_0x1368ab['query']['hasOwnProperty'](_0x0a91('0x35'))){_0xe9c2dd[_0x0a91('0x1c')]=qs[_0x0a91('0x1c')](_0x1368ab[_0x0a91('0x2e')][_0x0a91('0x1c')]);_0xe9c2dd[_0x0a91('0x1a')]=qs[_0x0a91('0x1a')](_0x1368ab[_0x0a91('0x2e')][_0x0a91('0x1a')]);}return _0x13a8f7[_0x0a91('0x49')](_0xe9c2dd);}})[_0x0a91('0x23')](function(_0x1dbb7c){if(_0x1dbb7c){return _0x1dbb7c?{'count':_0x947e99,'rows':_0x1dbb7c}:null;}})[_0x0a91('0x23')](respondWithResult(_0xed7211,null))[_0x0a91('0x41')](handleError(_0xed7211,null));};exports[_0x0a91('0x4c')]=function(_0x2cb87c,_0x363b37,_0x5c52c6){if(_0x2cb87c[_0x0a91('0x47')]['id']){delete _0x2cb87c[_0x0a91('0x47')]['id'];}return db['VtigerAccount'][_0x0a91('0x4a')]({'where':{'id':_0x2cb87c[_0x0a91('0x43')]['id']}})[_0x0a91('0x23')](handleEntityNotFound(_0x363b37,null))[_0x0a91('0x23')](function(_0x17eb54){if(_0x17eb54){_0x2cb87c[_0x0a91('0x47')][_0x0a91('0x4d')]=_0x17eb54['id'];_0x2cb87c['body'][_0x0a91('0x4e')]=integrations[_0x0a91('0x4f')](_0x2cb87c[_0x0a91('0x47')][_0x0a91('0x50')],_0x2cb87c[_0x0a91('0x47')][_0x0a91('0x2c')]);_0x2cb87c[_0x0a91('0x47')]['Descriptions']=integrations['getDescriptions'](_0x2cb87c['body'][_0x0a91('0x50')],_0x2cb87c[_0x0a91('0x47')][_0x0a91('0x2c')]);return db[_0x0a91('0x4b')]['create'](_0x2cb87c[_0x0a91('0x47')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0x0a91('0x51')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x363b37,null))['catch'](handleError(_0x363b37,null));};var md5=require('md5');exports['getFields']=function(_0x48e97a,_0x3cb384,_0x1152d1){var _0x2094b2=null;var _0xfa3198=null;var _0x17de21=null;var _0x17b206=null;var _0x129bce='';return db[_0x0a91('0x2b')][_0x0a91('0x4a')]({'where':{'id':_0x48e97a['params']['id']},'attributes':['id',_0x0a91('0x27'),_0x0a91('0x52'),_0x0a91('0x53'),_0x0a91('0x54'),_0x0a91('0x55'),_0x0a91('0x56'),'accessKey']})[_0x0a91('0x23')](handleEntityNotFound(_0x3cb384,null))['then'](function(_0x4bf2c0){if(_0x4bf2c0){_0x2094b2=_0x4bf2c0[_0x0a91('0x52')];_0xfa3198=_0x4bf2c0[_0x0a91('0x57')];_0x17de21=_0x4bf2c0['moduleName'];_0x129bce=_0x4bf2c0[_0x0a91('0x55')];var _0x2b1a00=_0x129bce[_0x0a91('0x58')](-0x1);if(_0x2b1a00==='/'){_0x129bce=_0x129bce[_0x0a91('0x59')](0x0,_0x129bce[_0x0a91('0x5a')](_0x2b1a00));}_0x17b206=util['format']('%s/webservice.php',_0x129bce);var _0x72f9c1={'method':_0x0a91('0x5b'),'uri':_0x17b206,'qs':{'operation':_0x0a91('0x5c'),'username':_0x4bf2c0['username']},'json':!![]};return rp(_0x72f9c1);}})[_0x0a91('0x23')](function(_0x47df84){if(_0x47df84[_0x0a91('0x5d')]){var _0x5c36d2={'method':_0x0a91('0x5e'),'uri':_0x17b206,'form':{'operation':'login','username':_0x2094b2,'accessKey':md5(_0x47df84[_0x0a91('0x5f')]['token']+_0xfa3198)},'json':!![]};return rp(_0x5c36d2);}})[_0x0a91('0x23')](function(_0x11badb){if(_0x11badb['success']){var _0x157704={'method':'GET','uri':_0x17b206,'qs':{'operation':_0x0a91('0x60'),'username':_0x2094b2,'sessionName':_0x11badb[_0x0a91('0x5f')][_0x0a91('0x61')],'elementType':_0x17de21},'json':!![]};return rp(_0x157704);}})[_0x0a91('0x23')](function(_0x324b8e){if(_0x324b8e[_0x0a91('0x5d')]){var _0x4a2c21=[_0x0a91('0x62'),'reference','owner'];_[_0x0a91('0x63')](_0x324b8e[_0x0a91('0x5f')]['fields'],function(_0x3180d3){return _0x4a2c21[_0x0a91('0x64')](_0x3180d3[_0x0a91('0x2c')]['name']);});_['remove'](_0x324b8e[_0x0a91('0x5f')][_0x0a91('0x31')],function(_0x6db0a6){return _0x6db0a6[_0x0a91('0x65')]===_0x0a91('0x66');});return{'count':_0x324b8e[_0x0a91('0x5f')][_0x0a91('0x31')][_0x0a91('0x33')],'rows':_[_0x0a91('0x2a')](_0x324b8e[_0x0a91('0x5f')][_0x0a91('0x31')],function(_0x4f16cb){return{'id':_0x4f16cb[_0x0a91('0x27')],'name':_0x4f16cb[_0x0a91('0x67')],'custom':_[_0x0a91('0x68')](_0x4f16cb[_0x0a91('0x27')],_0x0a91('0x69'))?!![]:![],'options':_0x4f16cb[_0x0a91('0x2c')][_0x0a91('0x27')]==='picklist'&&_0x4f16cb[_0x0a91('0x2c')]['picklistValues'][_0x0a91('0x33')]>0x0?_[_0x0a91('0x2a')](_0x4f16cb[_0x0a91('0x2c')][_0x0a91('0x6a')],function(_0x8edf6f){return{'name':_0x8edf6f[_0x0a91('0x67')],'value':_0x8edf6f[_0x0a91('0x6b')]};}):[]};})};}})[_0x0a91('0x23')](respondWithResult(_0x3cb384,null))[_0x0a91('0x41')](function(_0x45be8e){console['log'](_0x0a91('0x6c')+_0x45be8e);var _0x2d741a=_0x48e97a[_0x0a91('0x2e')][_0x0a91('0x6d')]?0x1f4:_0x45be8e[_0x0a91('0x6e')]||0x1f4;logger['error'](_0x0a91('0x6f'),_0x0a91('0x70'),_0x2d741a,JSON[_0x0a91('0x71')](_0x45be8e));delete _0x45be8e['name'];if(_0x2d741a===0x191){_0x2d741a=0x190;}_0x3cb384[_0x0a91('0x18')](_0x2d741a)[_0x0a91('0x28')](_0x48e97a[_0x0a91('0x2e')][_0x0a91('0x6d')]?{'message':_0x0a91('0x72'),'statusCode':_0x45be8e[_0x0a91('0x6e')]}:_0x45be8e);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index aa17ffb..13855e5 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 _0xae37=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','VtigerAccount','int_vtiger_accounts'];(function(_0x276b13,_0x51caaf){var _0x6d59b5=function(_0x3aa390){while(--_0x3aa390){_0x276b13['push'](_0x276b13['shift']());}};_0x6d59b5(++_0x51caaf);}(_0xae37,0xc3));var _0x7ae3=function(_0x3489dc,_0x5c9f11){_0x3489dc=_0x3489dc-0x0;var _0x53b272=_0xae37[_0x3489dc];return _0x53b272;};'use strict';var _=require(_0x7ae3('0x0'));var util=require(_0x7ae3('0x1'));var logger=require(_0x7ae3('0x2'))(_0x7ae3('0x3'));var moment=require(_0x7ae3('0x4'));var BPromise=require('bluebird');var rp=require(_0x7ae3('0x5'));var fs=require('fs');var path=require(_0x7ae3('0x6'));var rimraf=require(_0x7ae3('0x7'));var config=require(_0x7ae3('0x8'));var attributes=require(_0x7ae3('0x9'));var integrations=require(_0x7ae3('0xa'));module['exports']=function(_0x62dea4,_0x1e2761){return _0x62dea4['define'](_0x7ae3('0xb'),attributes,{'tableName':_0x7ae3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9ab=['VtigerAccount','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports'];(function(_0xa88736,_0x3a1108){var _0x2a1c1b=function(_0x5acd73){while(--_0x5acd73){_0xa88736['push'](_0xa88736['shift']());}};_0x2a1c1b(++_0x3a1108);}(_0xb9ab,0x1c9));var _0xbb9a=function(_0x5e56db,_0x2cf1ad){_0x5e56db=_0x5e56db-0x0;var _0x1750e5=_0xb9ab[_0x5e56db];return _0x1750e5;};'use strict';var _=require(_0xbb9a('0x0'));var util=require(_0xbb9a('0x1'));var logger=require(_0xbb9a('0x2'))(_0xbb9a('0x3'));var moment=require('moment');var BPromise=require(_0xbb9a('0x4'));var rp=require(_0xbb9a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb9a('0x6'));var config=require(_0xbb9a('0x7'));var attributes=require(_0xbb9a('0x8'));var integrations=require(_0xbb9a('0x9'));module[_0xbb9a('0xa')]=function(_0x401003,_0x23536a){return _0x401003['define'](_0xbb9a('0xb'),attributes,{'tableName':'int_vtiger_accounts','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 e186aea..3fcacf3 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 _0x58a4=['include','model','then','VtigerAccount','find','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','options','raw','where','attributes','limit','map'];(function(_0x57dd20,_0x3d7e78){var _0x2781ca=function(_0x265e10){while(--_0x265e10){_0x57dd20['push'](_0x57dd20['shift']());}};_0x2781ca(++_0x3d7e78);}(_0x58a4,0xbf));var _0x458a=function(_0x22e133,_0x527287){_0x22e133=_0x22e133-0x0;var _0x3455ca=_0x58a4[_0x22e133];return _0x3455ca;};'use strict';var _=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var moment=require(_0x458a('0x2'));var BPromise=require(_0x458a('0x3'));var rs=require(_0x458a('0x4'));var fs=require('fs');var Redis=require(_0x458a('0x5'));var db=require(_0x458a('0x6'))['db'];var utils=require(_0x458a('0x7'));var logger=require(_0x458a('0x8'))(_0x458a('0x9'));var config=require(_0x458a('0xa'));var jayson=require(_0x458a('0xb'));var client=jayson[_0x458a('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5358c2,_0x30b095,_0x11fcaa){return new BPromise(function(_0x2029bc,_0x1e658e){return client[_0x458a('0xd')](_0x5358c2,_0x11fcaa)['then'](function(_0x4bedce){logger[_0x458a('0xe')](_0x458a('0xf'),_0x30b095,_0x458a('0x10'));logger[_0x458a('0x11')](_0x458a('0x12'),_0x30b095,'request\x20sent',JSON[_0x458a('0x13')](_0x4bedce));if(_0x4bedce[_0x458a('0x14')]){if(_0x4bedce['error'][_0x458a('0x15')]===0x1f4){logger[_0x458a('0x14')](_0x458a('0xf'),_0x30b095,_0x4bedce[_0x458a('0x14')][_0x458a('0x16')]);return _0x1e658e(_0x4bedce['error']['message']);}logger[_0x458a('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x30b095,_0x4bedce[_0x458a('0x14')][_0x458a('0x16')]);return _0x2029bc(_0x4bedce[_0x458a('0x14')][_0x458a('0x16')]);}else{logger[_0x458a('0xe')](_0x458a('0xf'),_0x30b095,'request\x20sent');_0x2029bc(_0x4bedce['result']['message']);}})[_0x458a('0x17')](function(_0x3fd6d4){logger[_0x458a('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x30b095,_0x3fd6d4);_0x1e658e(_0x3fd6d4);});});}exports[_0x458a('0x18')]=function(_0x260c87){var _0x18504d=this;return new Promise(function(_0x392986,_0xa91473){return db['VtigerAccount']['findAll']({'raw':_0x260c87[_0x458a('0x19')]?_0x260c87['options'][_0x458a('0x1a')]===undefined?!![]:![]:!![],'where':_0x260c87[_0x458a('0x19')]?_0x260c87['options'][_0x458a('0x1b')]||null:null,'attributes':_0x260c87['options']?_0x260c87[_0x458a('0x19')][_0x458a('0x1c')]||null:null,'limit':_0x260c87['options']?_0x260c87[_0x458a('0x19')][_0x458a('0x1d')]||null:null,'include':_0x260c87['options']?_0x260c87[_0x458a('0x19')]['include']?_[_0x458a('0x1e')](_0x260c87['options'][_0x458a('0x1f')],function(_0x5dfc6c){return{'model':db[_0x5dfc6c[_0x458a('0x20')]],'as':_0x5dfc6c['as'],'attributes':_0x5dfc6c[_0x458a('0x1c')],'include':_0x5dfc6c[_0x458a('0x1f')]?_[_0x458a('0x1e')](_0x5dfc6c[_0x458a('0x1f')],function(_0x19bd5){return{'model':db[_0x19bd5[_0x458a('0x20')]],'as':_0x19bd5['as'],'attributes':_0x19bd5[_0x458a('0x1c')],'include':_0x19bd5[_0x458a('0x1f')]?_[_0x458a('0x1e')](_0x19bd5[_0x458a('0x1f')],function(_0x327fcb){return{'model':db[_0x327fcb[_0x458a('0x20')]],'as':_0x327fcb['as'],'attributes':_0x327fcb['attributes']};}):[]};}):[]};}):[]:[]})[_0x458a('0x21')](function(_0x112fa6){logger['info']('GetVtigerAccount',_0x260c87);logger[_0x458a('0x11')]('GetVtigerAccount',_0x260c87,JSON[_0x458a('0x13')](_0x112fa6));_0x392986(_0x112fa6);})[_0x458a('0x17')](function(_0x223f73){logger['error'](_0x458a('0x18'),_0x223f73[_0x458a('0x16')],_0x260c87);_0xa91473(_0x18504d[_0x458a('0x14')](0x1f4,_0x223f73['message']));});});};exports['ShowVtigerAccount']=function(_0x18c890){var _0x4cf059=this;return new Promise(function(_0x185f1c,_0x56e0b9){return db[_0x458a('0x22')][_0x458a('0x23')]({'raw':_0x18c890['options']?_0x18c890[_0x458a('0x19')][_0x458a('0x1a')]===undefined?!![]:![]:!![],'where':_0x18c890[_0x458a('0x19')]?_0x18c890['options'][_0x458a('0x1b')]||null:null,'attributes':_0x18c890[_0x458a('0x19')]?_0x18c890[_0x458a('0x19')][_0x458a('0x1c')]||null:null,'include':_0x18c890[_0x458a('0x19')]?_0x18c890['options'][_0x458a('0x1f')]?_[_0x458a('0x1e')](_0x18c890[_0x458a('0x19')][_0x458a('0x1f')],function(_0x35ec8f){return{'model':db[_0x35ec8f[_0x458a('0x20')]],'as':_0x35ec8f['as'],'attributes':_0x35ec8f['attributes'],'include':_0x35ec8f[_0x458a('0x1f')]?_[_0x458a('0x1e')](_0x35ec8f[_0x458a('0x1f')],function(_0x2f9b7b){return{'model':db[_0x2f9b7b[_0x458a('0x20')]],'as':_0x2f9b7b['as'],'attributes':_0x2f9b7b[_0x458a('0x1c')],'include':_0x2f9b7b[_0x458a('0x1f')]?_[_0x458a('0x1e')](_0x2f9b7b[_0x458a('0x1f')],function(_0x4cb8be){return{'model':db[_0x4cb8be[_0x458a('0x20')]],'as':_0x4cb8be['as'],'attributes':_0x4cb8be[_0x458a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x458a('0x21')](function(_0x101ece){logger[_0x458a('0xe')](_0x458a('0x24'),_0x18c890);logger[_0x458a('0x11')](_0x458a('0x24'),_0x18c890,JSON[_0x458a('0x13')](_0x101ece));_0x185f1c(_0x101ece);})[_0x458a('0x17')](function(_0x1a4011){logger[_0x458a('0x14')](_0x458a('0x24'),_0x1a4011[_0x458a('0x16')],_0x18c890);_0x56e0b9(_0x4cf059[_0x458a('0x14')](0x1f4,_0x1a4011['message']));});});}; \ No newline at end of file +var _0xbaf0=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','model','map','ShowVtigerAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetVtigerAccount',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowVtigerAccount',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index a955cf7..455af6f 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 _0x6adc=['isAuthenticated','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0xa53eb1,_0x466a1){var _0x4e0dcc=function(_0x3deb26){while(--_0x3deb26){_0xa53eb1['push'](_0xa53eb1['shift']());}};_0x4e0dcc(++_0x466a1);}(_0x6adc,0x179));var _0xc6ad=function(_0x3fe4b5,_0x2b167e){_0x3fe4b5=_0x3fe4b5-0x0;var _0xde0f13=_0x6adc[_0x3fe4b5];return _0xde0f13;};'use strict';var multer=require(_0xc6ad('0x0'));var util=require(_0xc6ad('0x1'));var path=require(_0xc6ad('0x2'));var timeout=require(_0xc6ad('0x3'));var express=require('express');var router=express[_0xc6ad('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc6ad('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc6ad('0x6'));var controller=require(_0xc6ad('0x7'));router[_0xc6ad('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc6ad('0x9'),auth['isAuthenticated'](),controller[_0xc6ad('0xa')]);router[_0xc6ad('0x8')](_0xc6ad('0xb'),auth['isAuthenticated'](),controller[_0xc6ad('0xc')]);router[_0xc6ad('0x8')](_0xc6ad('0xd'),auth[_0xc6ad('0xe')](),controller['getSubjects']);router[_0xc6ad('0x8')](_0xc6ad('0xf'),auth[_0xc6ad('0xe')](),controller[_0xc6ad('0x10')]);router[_0xc6ad('0x11')]('/',auth[_0xc6ad('0xe')](),controller[_0xc6ad('0x12')]);router[_0xc6ad('0x13')](_0xc6ad('0x9'),auth[_0xc6ad('0xe')](),controller[_0xc6ad('0x14')]);router['delete'](_0xc6ad('0x9'),auth[_0xc6ad('0xe')](),controller[_0xc6ad('0x15')]);module[_0xc6ad('0x16')]=router; \ No newline at end of file +var _0xeafd=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','destroy','exports','util','path','express','Router','fs-extra'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xeafd,0x14b));var _0xdeaf=function(_0x261e29,_0x10fffd){_0x261e29=_0x261e29-0x0;var _0x25ef43=_0xeafd[_0x261e29];return _0x25ef43;};'use strict';var multer=require('multer');var util=require(_0xdeaf('0x0'));var path=require(_0xdeaf('0x1'));var timeout=require('connect-timeout');var express=require(_0xdeaf('0x2'));var router=express[_0xdeaf('0x3')]();var fs_extra=require(_0xdeaf('0x4'));var auth=require(_0xdeaf('0x5'));var interaction=require(_0xdeaf('0x6'));var config=require(_0xdeaf('0x7'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0xdeaf('0x8')](),controller[_0xdeaf('0x9')]);router[_0xdeaf('0xa')](_0xdeaf('0xb'),auth[_0xdeaf('0x8')](),controller[_0xdeaf('0xc')]);router[_0xdeaf('0xa')](_0xdeaf('0xd'),auth[_0xdeaf('0x8')](),controller[_0xdeaf('0xe')]);router['get'](_0xdeaf('0xf'),auth[_0xdeaf('0x8')](),controller[_0xdeaf('0x10')]);router[_0xdeaf('0xa')](_0xdeaf('0x11'),auth['isAuthenticated'](),controller[_0xdeaf('0x12')]);router[_0xdeaf('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdeaf('0x14')]('/:id',auth[_0xdeaf('0x8')](),controller[_0xdeaf('0x15')]);router['delete'](_0xdeaf('0xb'),auth[_0xdeaf('0x8')](),controller[_0xdeaf('0x16')]);module[_0xdeaf('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 75469a9..c35bdbc 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 _0x1546=['sequelize'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x1546,0x164));var _0x6154=function(_0x2edb6b,_0x22f4c1){_0x2edb6b=_0x2edb6b-0x0;var _0xabab9a=_0x1546[_0x2edb6b];return _0xabab9a;};'use strict';var Sequelize=require(_0x6154('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7737=['sequelize'];(function(_0x44fd6b,_0x338098){var _0x7cba12=function(_0x5a6bb5){while(--_0x5a6bb5){_0x44fd6b['push'](_0x44fd6b['shift']());}};_0x7cba12(++_0x338098);}(_0x7737,0xb1));var _0x7773=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0x7737[_0x3f5dca];return _0x5b833a;};'use strict';var Sequelize=require(_0x7773('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index b029973..e08a88f 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 _0xda46=['undefined','limit','count','offset','Content-Range','apply','then','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','merge','where','includeAll','include','findAll','rows','show','options','find','catch','create','body','params','destroy','getFields','findOne','VtigerField','pick','filter','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xda46,0x118));var _0x6da4=function(_0x1ec95b,_0x5ef511){_0x1ec95b=_0x1ec95b-0x0;var _0x2f326d=_0xda46[_0x1ec95b];return _0x2f326d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6da4('0x0'));var zipdir=require(_0x6da4('0x1'));var jsonpatch=require(_0x6da4('0x2'));var rp=require(_0x6da4('0x3'));var moment=require(_0x6da4('0x4'));var BPromise=require(_0x6da4('0x5'));var Mustache=require(_0x6da4('0x6'));var util=require(_0x6da4('0x7'));var path=require(_0x6da4('0x8'));var sox=require(_0x6da4('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6da4('0xa'));var squel=require(_0x6da4('0xb'));var crypto=require('crypto');var jsforce=require(_0x6da4('0xc'));var deskjs=require(_0x6da4('0xd'));var toCsv=require(_0x6da4('0xe'));var querystring=require(_0x6da4('0xf'));var Papa=require(_0x6da4('0x10'));var Redis=require(_0x6da4('0x11'));var authService=require(_0x6da4('0x12'));var qs=require(_0x6da4('0x13'));var as=require(_0x6da4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6da4('0x15'));var utils=require('../../config/utils');var config=require(_0x6da4('0x16'));var licenseUtil=require(_0x6da4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x422e13,_0x2a63c8){_0x2a63c8=_0x2a63c8||0xcc;return function(_0x590ff1){if(_0x590ff1){return _0x422e13[_0x6da4('0x18')](_0x2a63c8);}return _0x422e13[_0x6da4('0x19')](_0x2a63c8)[_0x6da4('0x1a')]();};}function respondWithResult(_0x2303d5,_0x1b68c5){_0x1b68c5=_0x1b68c5||0xc8;return function(_0x377f5e){if(_0x377f5e){return _0x2303d5[_0x6da4('0x19')](_0x1b68c5)[_0x6da4('0x1b')](_0x377f5e);}};}function respondWithFilteredResult(_0x293d7b,_0xbaaaec){return function(_0x94026){if(_0x94026){var _0x5e80fc=typeof _0xbaaaec['offset']===_0x6da4('0x1c')&&typeof _0xbaaaec[_0x6da4('0x1d')]===_0x6da4('0x1c');var _0x322d90=_0x94026[_0x6da4('0x1e')];var _0x2699aa=_0x5e80fc?0x0:_0xbaaaec[_0x6da4('0x1f')];var _0x429ad7=_0x5e80fc?_0x94026[_0x6da4('0x1e')]:_0xbaaaec[_0x6da4('0x1f')]+_0xbaaaec[_0x6da4('0x1d')];var _0x3798b6;if(_0x429ad7>=_0x322d90){_0x429ad7=_0x322d90;_0x3798b6=0xc8;}else{_0x3798b6=0xce;}_0x293d7b[_0x6da4('0x19')](_0x3798b6);return _0x293d7b['set'](_0x6da4('0x20'),_0x2699aa+'-'+_0x429ad7+'/'+_0x322d90)[_0x6da4('0x1b')](_0x94026);}return null;};}function patchUpdates(_0x4b797b){return function(_0x2e52c1){try{jsonpatch[_0x6da4('0x21')](_0x2e52c1,_0x4b797b,!![]);}catch(_0x160f4e){return BPromise['reject'](_0x160f4e);}return _0x2e52c1['save']();};}function saveUpdates(_0x162a5f,_0x3d05ef){return function(_0x389dd3){if(_0x389dd3){return _0x389dd3['update'](_0x162a5f)[_0x6da4('0x22')](function(_0x164100){return _0x164100;});}return null;};}function removeEntity(_0x52faee,_0x1baecc){return function(_0x24225b){if(_0x24225b){return _0x24225b['destroy']()['then'](function(){_0x52faee['status'](0xcc)[_0x6da4('0x1a')]();});}};}function handleEntityNotFound(_0x357def,_0x11c988){return function(_0x5f2290){if(!_0x5f2290){_0x357def[_0x6da4('0x18')](0x194);}return _0x5f2290;};}function handleError(_0x53161e,_0x5137ac){_0x5137ac=_0x5137ac||0x1f4;return function(_0x57e7bd){logger[_0x6da4('0x23')](_0x57e7bd[_0x6da4('0x24')]);if(_0x57e7bd[_0x6da4('0x25')]){delete _0x57e7bd[_0x6da4('0x25')];}_0x53161e[_0x6da4('0x19')](_0x5137ac)[_0x6da4('0x26')](_0x57e7bd);};}exports[_0x6da4('0x27')]=function(_0x38460,_0x58d730){var _0x106a95={},_0x345e5b={},_0x29f612={'count':0x0,'rows':[]};var _0x4787bf=_[_0x6da4('0x28')](db[_0x6da4('0x29')][_0x6da4('0x2a')],function(_0x19b924){return{'name':_0x19b924[_0x6da4('0x2b')],'type':_0x19b924[_0x6da4('0x2c')]['key']};});_0x345e5b[_0x6da4('0x2d')]=_[_0x6da4('0x28')](_0x4787bf,_0x6da4('0x25'));_0x345e5b[_0x6da4('0x2e')]=_[_0x6da4('0x2f')](_0x38460[_0x6da4('0x2e')]);_0x345e5b[_0x6da4('0x30')]=_['intersection'](_0x345e5b[_0x6da4('0x2d')],_0x345e5b[_0x6da4('0x2e')]);_0x106a95[_0x6da4('0x31')]=_[_0x6da4('0x32')](_0x345e5b[_0x6da4('0x2d')],qs[_0x6da4('0x33')](_0x38460[_0x6da4('0x2e')][_0x6da4('0x33')]));_0x106a95[_0x6da4('0x31')]=_0x106a95[_0x6da4('0x31')][_0x6da4('0x34')]?_0x106a95[_0x6da4('0x31')]:_0x345e5b[_0x6da4('0x2d')];if(!_0x38460[_0x6da4('0x2e')][_0x6da4('0x35')]('nolimit')){_0x106a95['limit']=qs['limit'](_0x38460[_0x6da4('0x2e')][_0x6da4('0x1d')]);_0x106a95['offset']=qs[_0x6da4('0x1f')](_0x38460[_0x6da4('0x2e')][_0x6da4('0x1f')]);}_0x106a95[_0x6da4('0x36')]=qs[_0x6da4('0x37')](_0x38460['query'][_0x6da4('0x37')]);_0x106a95['where']=qs[_0x6da4('0x30')](_['pick'](_0x38460[_0x6da4('0x2e')],_0x345e5b['filters']),_0x4787bf);if(_0x38460['query']['filter']){_0x106a95['where']=_[_0x6da4('0x38')](_0x106a95[_0x6da4('0x39')],{'$or':_[_0x6da4('0x28')](_0x4787bf,function(_0x313827){if(_0x313827[_0x6da4('0x2c')]!=='VIRTUAL'){var _0x588851={};_0x588851[_0x313827[_0x6da4('0x25')]]={'$like':'%'+_0x38460[_0x6da4('0x2e')]['filter']+'%'};return _0x588851;}})});}_0x106a95=_[_0x6da4('0x38')]({},_0x106a95,_0x38460['options']);var _0x4576dc={'where':_0x106a95[_0x6da4('0x39')]};return db[_0x6da4('0x29')][_0x6da4('0x1e')](_0x4576dc)[_0x6da4('0x22')](function(_0xe9c5c5){_0x29f612['count']=_0xe9c5c5;if(_0x38460[_0x6da4('0x2e')][_0x6da4('0x3a')]){_0x106a95[_0x6da4('0x3b')]=[{'all':!![]}];}return db[_0x6da4('0x29')][_0x6da4('0x3c')](_0x106a95);})[_0x6da4('0x22')](function(_0x312561){_0x29f612[_0x6da4('0x3d')]=_0x312561;return _0x29f612;})[_0x6da4('0x22')](respondWithFilteredResult(_0x58d730,_0x106a95))['catch'](handleError(_0x58d730,null));};exports[_0x6da4('0x3e')]=function(_0x1c9841,_0x6f2b8d){var _0xee844a={'raw':![],'where':{'id':_0x1c9841['params']['id']}},_0x5cf07c={};_0x5cf07c[_0x6da4('0x2d')]=_[_0x6da4('0x2f')](db['VtigerConfiguration']['rawAttributes']);_0x5cf07c['query']=_[_0x6da4('0x2f')](_0x1c9841[_0x6da4('0x2e')]);_0x5cf07c[_0x6da4('0x30')]=_['intersection'](_0x5cf07c[_0x6da4('0x2d')],_0x5cf07c['query']);_0xee844a[_0x6da4('0x31')]=_[_0x6da4('0x32')](_0x5cf07c[_0x6da4('0x2d')],qs[_0x6da4('0x33')](_0x1c9841['query']['fields']));_0xee844a[_0x6da4('0x31')]=_0xee844a[_0x6da4('0x31')][_0x6da4('0x34')]?_0xee844a[_0x6da4('0x31')]:_0x5cf07c[_0x6da4('0x2d')];if(_0x1c9841[_0x6da4('0x2e')][_0x6da4('0x3a')]){_0xee844a[_0x6da4('0x3b')]=[{'all':!![]}];}_0xee844a=_[_0x6da4('0x38')]({},_0xee844a,_0x1c9841[_0x6da4('0x3f')]);return db['VtigerConfiguration'][_0x6da4('0x40')](_0xee844a)[_0x6da4('0x22')](handleEntityNotFound(_0x6f2b8d,null))[_0x6da4('0x22')](respondWithResult(_0x6f2b8d,null))[_0x6da4('0x41')](handleError(_0x6f2b8d,null));};exports[_0x6da4('0x42')]=function(_0x43bf41,_0x587421){return db[_0x6da4('0x29')][_0x6da4('0x42')](_0x43bf41[_0x6da4('0x43')],{})[_0x6da4('0x22')](respondWithResult(_0x587421,0xc9))['catch'](handleError(_0x587421,null));};exports['update']=function(_0x2ca323,_0x55e5cd){if(_0x2ca323[_0x6da4('0x43')]['id']){delete _0x2ca323[_0x6da4('0x43')]['id'];}return db[_0x6da4('0x29')]['find']({'where':{'id':_0x2ca323[_0x6da4('0x44')]['id']}})[_0x6da4('0x22')](handleEntityNotFound(_0x55e5cd,null))[_0x6da4('0x22')](saveUpdates(_0x2ca323[_0x6da4('0x43')],null))[_0x6da4('0x22')](respondWithResult(_0x55e5cd,null))[_0x6da4('0x41')](handleError(_0x55e5cd,null));};exports[_0x6da4('0x45')]=function(_0x4f00ce,_0x30bf40){return db['VtigerConfiguration'][_0x6da4('0x40')]({'where':{'id':_0x4f00ce[_0x6da4('0x44')]['id']}})['then'](handleEntityNotFound(_0x30bf40,null))['then'](removeEntity(_0x30bf40,null))[_0x6da4('0x41')](handleError(_0x30bf40,null));};exports[_0x6da4('0x46')]=function(_0x4e88d9,_0x3e5925,_0x2a0b4e){var _0x588e4c={};var _0x4f58f5={};var _0x2a9104;var _0x28631b;return db[_0x6da4('0x29')][_0x6da4('0x47')]({'where':{'id':_0x4e88d9[_0x6da4('0x44')]['id']}})[_0x6da4('0x22')](handleEntityNotFound(_0x3e5925,null))[_0x6da4('0x22')](function(_0x506184){if(_0x506184){_0x2a9104=_0x506184;_0x4f58f5['model']=_[_0x6da4('0x2f')](db[_0x6da4('0x48')][_0x6da4('0x2a')]);_0x4f58f5[_0x6da4('0x2e')]=_[_0x6da4('0x2f')](_0x4e88d9['query']);_0x4f58f5[_0x6da4('0x30')]=_[_0x6da4('0x32')](_0x4f58f5[_0x6da4('0x2d')],_0x4f58f5[_0x6da4('0x2e')]);_0x588e4c['attributes']=_['intersection'](_0x4f58f5['model'],qs[_0x6da4('0x33')](_0x4e88d9[_0x6da4('0x2e')]['fields']));_0x588e4c[_0x6da4('0x31')]=_0x588e4c[_0x6da4('0x31')][_0x6da4('0x34')]?_0x588e4c[_0x6da4('0x31')]:_0x4f58f5['model'];_0x588e4c['order']=qs[_0x6da4('0x37')](_0x4e88d9[_0x6da4('0x2e')][_0x6da4('0x37')]);_0x588e4c[_0x6da4('0x39')]=qs[_0x6da4('0x30')](_[_0x6da4('0x49')](_0x4e88d9[_0x6da4('0x2e')],_0x4f58f5[_0x6da4('0x30')]));if(_0x4e88d9['query'][_0x6da4('0x4a')]){_0x588e4c[_0x6da4('0x39')]=_[_0x6da4('0x38')](_0x588e4c[_0x6da4('0x39')],{'$or':_['map'](_0x588e4c['attributes'],function(_0x7fbdda){var _0x2d2903={};_0x2d2903[_0x7fbdda]={'$like':'%'+_0x4e88d9[_0x6da4('0x2e')]['filter']+'%'};return _0x2d2903;})});}_0x588e4c=_[_0x6da4('0x38')]({},_0x588e4c,_0x4e88d9[_0x6da4('0x3f')]);return _0x2a9104['getFields'](_0x588e4c);}})[_0x6da4('0x22')](function(_0x2e22f5){if(_0x2e22f5){_0x28631b=_0x2e22f5['length'];if(!_0x4e88d9[_0x6da4('0x2e')]['hasOwnProperty']('nolimit')){_0x588e4c[_0x6da4('0x1d')]=qs[_0x6da4('0x1d')](_0x4e88d9[_0x6da4('0x2e')][_0x6da4('0x1d')]);_0x588e4c[_0x6da4('0x1f')]=qs[_0x6da4('0x1f')](_0x4e88d9[_0x6da4('0x2e')][_0x6da4('0x1f')]);}return _0x2a9104[_0x6da4('0x46')](_0x588e4c);}})[_0x6da4('0x22')](function(_0x2d5e0f){if(_0x2d5e0f){return _0x2d5e0f?{'count':_0x28631b,'rows':_0x2d5e0f}:null;}})[_0x6da4('0x22')](respondWithResult(_0x3e5925,null))[_0x6da4('0x41')](handleError(_0x3e5925,null));};exports[_0x6da4('0x4b')]=function(_0x58a195,_0x449891,_0x4dd904){var _0x1644a5={};var _0x4a76df={};var _0x537cfb;var _0x1ad0a1;return db[_0x6da4('0x29')][_0x6da4('0x47')]({'where':{'id':_0x58a195[_0x6da4('0x44')]['id']}})[_0x6da4('0x22')](handleEntityNotFound(_0x449891,null))[_0x6da4('0x22')](function(_0x464255){if(_0x464255){_0x537cfb=_0x464255;_0x4a76df['model']=_[_0x6da4('0x2f')](db[_0x6da4('0x48')][_0x6da4('0x2a')]);_0x4a76df[_0x6da4('0x2e')]=_[_0x6da4('0x2f')](_0x58a195[_0x6da4('0x2e')]);_0x4a76df[_0x6da4('0x30')]=_['intersection'](_0x4a76df[_0x6da4('0x2d')],_0x4a76df[_0x6da4('0x2e')]);_0x1644a5[_0x6da4('0x31')]=_['intersection'](_0x4a76df[_0x6da4('0x2d')],qs[_0x6da4('0x33')](_0x58a195[_0x6da4('0x2e')]['fields']));_0x1644a5[_0x6da4('0x31')]=_0x1644a5[_0x6da4('0x31')][_0x6da4('0x34')]?_0x1644a5[_0x6da4('0x31')]:_0x4a76df['model'];_0x1644a5[_0x6da4('0x36')]=qs['sort'](_0x58a195[_0x6da4('0x2e')]['sort']);_0x1644a5[_0x6da4('0x39')]=qs[_0x6da4('0x30')](_[_0x6da4('0x49')](_0x58a195[_0x6da4('0x2e')],_0x4a76df[_0x6da4('0x30')]));if(_0x58a195['query'][_0x6da4('0x4a')]){_0x1644a5[_0x6da4('0x39')]=_['merge'](_0x1644a5[_0x6da4('0x39')],{'$or':_[_0x6da4('0x28')](_0x1644a5[_0x6da4('0x31')],function(_0x27b2ee){var _0x229680={};_0x229680[_0x27b2ee]={'$like':'%'+_0x58a195[_0x6da4('0x2e')][_0x6da4('0x4a')]+'%'};return _0x229680;})});}_0x1644a5=_[_0x6da4('0x38')]({},_0x1644a5,_0x58a195[_0x6da4('0x3f')]);return _0x537cfb['getSubjects'](_0x1644a5);}})['then'](function(_0x363e34){if(_0x363e34){_0x1ad0a1=_0x363e34['length'];if(!_0x58a195[_0x6da4('0x2e')][_0x6da4('0x35')]('nolimit')){_0x1644a5[_0x6da4('0x1d')]=qs['limit'](_0x58a195[_0x6da4('0x2e')]['limit']);_0x1644a5['offset']=qs[_0x6da4('0x1f')](_0x58a195['query']['offset']);}return _0x537cfb['getSubjects'](_0x1644a5);}})[_0x6da4('0x22')](function(_0x5d0a88){if(_0x5d0a88){return _0x5d0a88?{'count':_0x1ad0a1,'rows':_0x5d0a88}:null;}})[_0x6da4('0x22')](respondWithResult(_0x449891,null))['catch'](handleError(_0x449891,null));};exports[_0x6da4('0x4c')]=function(_0x3ac480,_0x535e3e,_0x5a78a7){var _0x56ad17={};var _0x341465={};var _0x186a60;var _0x384b5d;return db[_0x6da4('0x29')][_0x6da4('0x47')]({'where':{'id':_0x3ac480[_0x6da4('0x44')]['id']}})[_0x6da4('0x22')](handleEntityNotFound(_0x535e3e,null))[_0x6da4('0x22')](function(_0x4dbab4){if(_0x4dbab4){_0x186a60=_0x4dbab4;_0x341465[_0x6da4('0x2d')]=_['keys'](db[_0x6da4('0x48')][_0x6da4('0x2a')]);_0x341465['query']=_[_0x6da4('0x2f')](_0x3ac480[_0x6da4('0x2e')]);_0x341465[_0x6da4('0x30')]=_[_0x6da4('0x32')](_0x341465[_0x6da4('0x2d')],_0x341465[_0x6da4('0x2e')]);_0x56ad17[_0x6da4('0x31')]=_['intersection'](_0x341465[_0x6da4('0x2d')],qs[_0x6da4('0x33')](_0x3ac480['query'][_0x6da4('0x33')]));_0x56ad17['attributes']=_0x56ad17['attributes']['length']?_0x56ad17[_0x6da4('0x31')]:_0x341465[_0x6da4('0x2d')];_0x56ad17[_0x6da4('0x36')]=qs['sort'](_0x3ac480[_0x6da4('0x2e')]['sort']);_0x56ad17[_0x6da4('0x39')]=qs[_0x6da4('0x30')](_[_0x6da4('0x49')](_0x3ac480[_0x6da4('0x2e')],_0x341465[_0x6da4('0x30')]));if(_0x3ac480[_0x6da4('0x2e')][_0x6da4('0x4a')]){_0x56ad17['where']=_['merge'](_0x56ad17['where'],{'$or':_[_0x6da4('0x28')](_0x56ad17['attributes'],function(_0x14a178){var _0x54d3f7={};_0x54d3f7[_0x14a178]={'$like':'%'+_0x3ac480[_0x6da4('0x2e')][_0x6da4('0x4a')]+'%'};return _0x54d3f7;})});}_0x56ad17=_['merge']({},_0x56ad17,_0x3ac480[_0x6da4('0x3f')]);return _0x186a60[_0x6da4('0x4c')](_0x56ad17);}})[_0x6da4('0x22')](function(_0xb93566){if(_0xb93566){_0x384b5d=_0xb93566[_0x6da4('0x34')];if(!_0x3ac480[_0x6da4('0x2e')]['hasOwnProperty']('nolimit')){_0x56ad17['limit']=qs[_0x6da4('0x1d')](_0x3ac480[_0x6da4('0x2e')][_0x6da4('0x1d')]);_0x56ad17[_0x6da4('0x1f')]=qs[_0x6da4('0x1f')](_0x3ac480['query']['offset']);}return _0x186a60[_0x6da4('0x4c')](_0x56ad17);}})['then'](function(_0x45192f){if(_0x45192f){return _0x45192f?{'count':_0x384b5d,'rows':_0x45192f}:null;}})['then'](respondWithResult(_0x535e3e,null))[_0x6da4('0x41')](handleError(_0x535e3e,null));}; \ No newline at end of file +var _0x239c=['json','apply','reject','save','destroy','then','end','sendStatus','error','stack','name','map','VtigerConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','merge','where','options','include','findAll','rows','show','params','keys','length','includeAll','find','catch','create','body','getFields','VtigerField','order','nolimit','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','limit','count','Content-Range'];(function(_0x3fa594,_0x3c8e74){var _0x5c5c62=function(_0x1d26ca){while(--_0x1d26ca){_0x3fa594['push'](_0x3fa594['shift']());}};_0x5c5c62(++_0x3c8e74);}(_0x239c,0x7b));var _0xc239=function(_0x4780cc,_0x4c3674){_0x4780cc=_0x4780cc-0x0;var _0x4ee746=_0x239c[_0x4780cc];return _0x4ee746;};'use strict';var emlformat=require(_0xc239('0x0'));var rimraf=require(_0xc239('0x1'));var zipdir=require(_0xc239('0x2'));var jsonpatch=require(_0xc239('0x3'));var rp=require(_0xc239('0x4'));var moment=require(_0xc239('0x5'));var BPromise=require(_0xc239('0x6'));var Mustache=require(_0xc239('0x7'));var util=require('util');var path=require('path');var sox=require(_0xc239('0x8'));var csv=require(_0xc239('0x9'));var ejs=require(_0xc239('0xa'));var fs=require('fs');var fs_extra=require(_0xc239('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc239('0xc'));var toCsv=require(_0xc239('0x9'));var querystring=require('querystring');var Papa=require(_0xc239('0xd'));var Redis=require('ioredis');var authService=require(_0xc239('0xe'));var qs=require(_0xc239('0xf'));var as=require(_0xc239('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc239('0x11'))('api');var utils=require(_0xc239('0x12'));var config=require(_0xc239('0x13'));var licenseUtil=require(_0xc239('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f8b47,_0x374cfa){_0x374cfa=_0x374cfa||0xcc;return function(_0x520b90){if(_0x520b90){return _0x3f8b47['sendStatus'](_0x374cfa);}return _0x3f8b47[_0xc239('0x15')](_0x374cfa)['end']();};}function respondWithResult(_0xe0ed18,_0x2dfed4){_0x2dfed4=_0x2dfed4||0xc8;return function(_0x186b95){if(_0x186b95){return _0xe0ed18['status'](_0x2dfed4)['json'](_0x186b95);}};}function respondWithFilteredResult(_0x1a6e26,_0x39a9ba){return function(_0x1a99ec){if(_0x1a99ec){var _0x31dc9e=typeof _0x39a9ba[_0xc239('0x16')]===_0xc239('0x17')&&typeof _0x39a9ba[_0xc239('0x18')]===_0xc239('0x17');var _0x44f1d5=_0x1a99ec[_0xc239('0x19')];var _0x4fa436=_0x31dc9e?0x0:_0x39a9ba['offset'];var _0x2d17af=_0x31dc9e?_0x1a99ec[_0xc239('0x19')]:_0x39a9ba['offset']+_0x39a9ba[_0xc239('0x18')];var _0x2de5a3;if(_0x2d17af>=_0x44f1d5){_0x2d17af=_0x44f1d5;_0x2de5a3=0xc8;}else{_0x2de5a3=0xce;}_0x1a6e26[_0xc239('0x15')](_0x2de5a3);return _0x1a6e26['set'](_0xc239('0x1a'),_0x4fa436+'-'+_0x2d17af+'/'+_0x44f1d5)[_0xc239('0x1b')](_0x1a99ec);}return null;};}function patchUpdates(_0x26d1a1){return function(_0x34a3bc){try{jsonpatch[_0xc239('0x1c')](_0x34a3bc,_0x26d1a1,!![]);}catch(_0x3e4408){return BPromise[_0xc239('0x1d')](_0x3e4408);}return _0x34a3bc[_0xc239('0x1e')]();};}function saveUpdates(_0x286ec5,_0x1c6acb){return function(_0x59f60f){if(_0x59f60f){return _0x59f60f['update'](_0x286ec5)['then'](function(_0x34f163){return _0x34f163;});}return null;};}function removeEntity(_0xea633,_0x1aa6a7){return function(_0xcef68f){if(_0xcef68f){return _0xcef68f[_0xc239('0x1f')]()[_0xc239('0x20')](function(){_0xea633[_0xc239('0x15')](0xcc)[_0xc239('0x21')]();});}};}function handleEntityNotFound(_0x1da673,_0x2c293d){return function(_0x55ba42){if(!_0x55ba42){_0x1da673[_0xc239('0x22')](0x194);}return _0x55ba42;};}function handleError(_0xc7e4fc,_0x12f2b6){_0x12f2b6=_0x12f2b6||0x1f4;return function(_0x334c81){logger[_0xc239('0x23')](_0x334c81[_0xc239('0x24')]);if(_0x334c81[_0xc239('0x25')]){delete _0x334c81['name'];}_0xc7e4fc[_0xc239('0x15')](_0x12f2b6)['send'](_0x334c81);};}exports['index']=function(_0x4368a9,_0x11fafa){var _0xeebf19={},_0x3803e3={},_0x5546c7={'count':0x0,'rows':[]};var _0x34dd0b=_[_0xc239('0x26')](db[_0xc239('0x27')][_0xc239('0x28')],function(_0x195a81){return{'name':_0x195a81[_0xc239('0x29')],'type':_0x195a81[_0xc239('0x2a')]['key']};});_0x3803e3[_0xc239('0x2b')]=_[_0xc239('0x26')](_0x34dd0b,_0xc239('0x25'));_0x3803e3['query']=_['keys'](_0x4368a9[_0xc239('0x2c')]);_0x3803e3[_0xc239('0x2d')]=_[_0xc239('0x2e')](_0x3803e3[_0xc239('0x2b')],_0x3803e3[_0xc239('0x2c')]);_0xeebf19[_0xc239('0x2f')]=_['intersection'](_0x3803e3[_0xc239('0x2b')],qs[_0xc239('0x30')](_0x4368a9[_0xc239('0x2c')]['fields']));_0xeebf19[_0xc239('0x2f')]=_0xeebf19[_0xc239('0x2f')]['length']?_0xeebf19[_0xc239('0x2f')]:_0x3803e3['model'];if(!_0x4368a9[_0xc239('0x2c')][_0xc239('0x31')]('nolimit')){_0xeebf19[_0xc239('0x18')]=qs[_0xc239('0x18')](_0x4368a9[_0xc239('0x2c')]['limit']);_0xeebf19['offset']=qs[_0xc239('0x16')](_0x4368a9[_0xc239('0x2c')][_0xc239('0x16')]);}_0xeebf19['order']=qs[_0xc239('0x32')](_0x4368a9[_0xc239('0x2c')][_0xc239('0x32')]);_0xeebf19['where']=qs[_0xc239('0x2d')](_[_0xc239('0x33')](_0x4368a9[_0xc239('0x2c')],_0x3803e3[_0xc239('0x2d')]),_0x34dd0b);if(_0x4368a9['query'][_0xc239('0x34')]){_0xeebf19['where']=_[_0xc239('0x35')](_0xeebf19[_0xc239('0x36')],{'$or':_[_0xc239('0x26')](_0x34dd0b,function(_0x2c3515){if(_0x2c3515[_0xc239('0x2a')]!=='VIRTUAL'){var _0x11b918={};_0x11b918[_0x2c3515['name']]={'$like':'%'+_0x4368a9['query']['filter']+'%'};return _0x11b918;}})});}_0xeebf19=_[_0xc239('0x35')]({},_0xeebf19,_0x4368a9[_0xc239('0x37')]);var _0x3565fb={'where':_0xeebf19['where']};return db[_0xc239('0x27')][_0xc239('0x19')](_0x3565fb)[_0xc239('0x20')](function(_0x578f77){_0x5546c7[_0xc239('0x19')]=_0x578f77;if(_0x4368a9[_0xc239('0x2c')]['includeAll']){_0xeebf19[_0xc239('0x38')]=[{'all':!![]}];}return db[_0xc239('0x27')][_0xc239('0x39')](_0xeebf19);})[_0xc239('0x20')](function(_0x45b860){_0x5546c7[_0xc239('0x3a')]=_0x45b860;return _0x5546c7;})[_0xc239('0x20')](respondWithFilteredResult(_0x11fafa,_0xeebf19))['catch'](handleError(_0x11fafa,null));};exports[_0xc239('0x3b')]=function(_0x305fb1,_0x463e7d){var _0x197f14={'raw':![],'where':{'id':_0x305fb1[_0xc239('0x3c')]['id']}},_0x10901c={};_0x10901c[_0xc239('0x2b')]=_[_0xc239('0x3d')](db['VtigerConfiguration'][_0xc239('0x28')]);_0x10901c[_0xc239('0x2c')]=_[_0xc239('0x3d')](_0x305fb1[_0xc239('0x2c')]);_0x10901c[_0xc239('0x2d')]=_[_0xc239('0x2e')](_0x10901c[_0xc239('0x2b')],_0x10901c[_0xc239('0x2c')]);_0x197f14[_0xc239('0x2f')]=_[_0xc239('0x2e')](_0x10901c[_0xc239('0x2b')],qs['fields'](_0x305fb1[_0xc239('0x2c')]['fields']));_0x197f14[_0xc239('0x2f')]=_0x197f14['attributes'][_0xc239('0x3e')]?_0x197f14['attributes']:_0x10901c[_0xc239('0x2b')];if(_0x305fb1['query'][_0xc239('0x3f')]){_0x197f14[_0xc239('0x38')]=[{'all':!![]}];}_0x197f14=_[_0xc239('0x35')]({},_0x197f14,_0x305fb1['options']);return db[_0xc239('0x27')][_0xc239('0x40')](_0x197f14)['then'](handleEntityNotFound(_0x463e7d,null))[_0xc239('0x20')](respondWithResult(_0x463e7d,null))[_0xc239('0x41')](handleError(_0x463e7d,null));};exports[_0xc239('0x42')]=function(_0x5bfb15,_0x441c11){return db[_0xc239('0x27')][_0xc239('0x42')](_0x5bfb15[_0xc239('0x43')],{})['then'](respondWithResult(_0x441c11,0xc9))[_0xc239('0x41')](handleError(_0x441c11,null));};exports['update']=function(_0x53aba0,_0x13ce1b){if(_0x53aba0[_0xc239('0x43')]['id']){delete _0x53aba0[_0xc239('0x43')]['id'];}return db[_0xc239('0x27')][_0xc239('0x40')]({'where':{'id':_0x53aba0[_0xc239('0x3c')]['id']}})[_0xc239('0x20')](handleEntityNotFound(_0x13ce1b,null))[_0xc239('0x20')](saveUpdates(_0x53aba0['body'],null))[_0xc239('0x20')](respondWithResult(_0x13ce1b,null))['catch'](handleError(_0x13ce1b,null));};exports['destroy']=function(_0x36c6f3,_0x28a2bf){return db[_0xc239('0x27')][_0xc239('0x40')]({'where':{'id':_0x36c6f3[_0xc239('0x3c')]['id']}})[_0xc239('0x20')](handleEntityNotFound(_0x28a2bf,null))[_0xc239('0x20')](removeEntity(_0x28a2bf,null))[_0xc239('0x41')](handleError(_0x28a2bf,null));};exports[_0xc239('0x44')]=function(_0x3c94c3,_0x2a9c1d,_0xa9e53){var _0x42f8af={};var _0x3f6558={};var _0x11305b;var _0xc1d627;return db[_0xc239('0x27')]['findOne']({'where':{'id':_0x3c94c3[_0xc239('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2a9c1d,null))[_0xc239('0x20')](function(_0x387a09){if(_0x387a09){_0x11305b=_0x387a09;_0x3f6558[_0xc239('0x2b')]=_[_0xc239('0x3d')](db[_0xc239('0x45')][_0xc239('0x28')]);_0x3f6558[_0xc239('0x2c')]=_[_0xc239('0x3d')](_0x3c94c3['query']);_0x3f6558[_0xc239('0x2d')]=_[_0xc239('0x2e')](_0x3f6558[_0xc239('0x2b')],_0x3f6558[_0xc239('0x2c')]);_0x42f8af['attributes']=_[_0xc239('0x2e')](_0x3f6558['model'],qs[_0xc239('0x30')](_0x3c94c3[_0xc239('0x2c')][_0xc239('0x30')]));_0x42f8af[_0xc239('0x2f')]=_0x42f8af[_0xc239('0x2f')][_0xc239('0x3e')]?_0x42f8af['attributes']:_0x3f6558[_0xc239('0x2b')];_0x42f8af[_0xc239('0x46')]=qs[_0xc239('0x32')](_0x3c94c3[_0xc239('0x2c')]['sort']);_0x42f8af[_0xc239('0x36')]=qs['filters'](_[_0xc239('0x33')](_0x3c94c3[_0xc239('0x2c')],_0x3f6558[_0xc239('0x2d')]));if(_0x3c94c3[_0xc239('0x2c')][_0xc239('0x34')]){_0x42f8af[_0xc239('0x36')]=_[_0xc239('0x35')](_0x42f8af[_0xc239('0x36')],{'$or':_[_0xc239('0x26')](_0x42f8af[_0xc239('0x2f')],function(_0x25f142){var _0x16820a={};_0x16820a[_0x25f142]={'$like':'%'+_0x3c94c3[_0xc239('0x2c')][_0xc239('0x34')]+'%'};return _0x16820a;})});}_0x42f8af=_[_0xc239('0x35')]({},_0x42f8af,_0x3c94c3['options']);return _0x11305b[_0xc239('0x44')](_0x42f8af);}})['then'](function(_0xa84bc4){if(_0xa84bc4){_0xc1d627=_0xa84bc4['length'];if(!_0x3c94c3[_0xc239('0x2c')]['hasOwnProperty'](_0xc239('0x47'))){_0x42f8af[_0xc239('0x18')]=qs['limit'](_0x3c94c3[_0xc239('0x2c')][_0xc239('0x18')]);_0x42f8af['offset']=qs[_0xc239('0x16')](_0x3c94c3[_0xc239('0x2c')]['offset']);}return _0x11305b[_0xc239('0x44')](_0x42f8af);}})['then'](function(_0x2258fe){if(_0x2258fe){return _0x2258fe?{'count':_0xc1d627,'rows':_0x2258fe}:null;}})['then'](respondWithResult(_0x2a9c1d,null))[_0xc239('0x41')](handleError(_0x2a9c1d,null));};exports['getSubjects']=function(_0x39874a,_0x4b925e,_0x5631f6){var _0x3ec333={};var _0x4a0e26={};var _0x47d0d6;var _0x42ac2e;return db[_0xc239('0x27')][_0xc239('0x48')]({'where':{'id':_0x39874a[_0xc239('0x3c')]['id']}})[_0xc239('0x20')](handleEntityNotFound(_0x4b925e,null))[_0xc239('0x20')](function(_0x526fa8){if(_0x526fa8){_0x47d0d6=_0x526fa8;_0x4a0e26[_0xc239('0x2b')]=_[_0xc239('0x3d')](db[_0xc239('0x45')][_0xc239('0x28')]);_0x4a0e26[_0xc239('0x2c')]=_[_0xc239('0x3d')](_0x39874a[_0xc239('0x2c')]);_0x4a0e26[_0xc239('0x2d')]=_[_0xc239('0x2e')](_0x4a0e26[_0xc239('0x2b')],_0x4a0e26[_0xc239('0x2c')]);_0x3ec333['attributes']=_[_0xc239('0x2e')](_0x4a0e26[_0xc239('0x2b')],qs[_0xc239('0x30')](_0x39874a[_0xc239('0x2c')][_0xc239('0x30')]));_0x3ec333[_0xc239('0x2f')]=_0x3ec333[_0xc239('0x2f')][_0xc239('0x3e')]?_0x3ec333['attributes']:_0x4a0e26['model'];_0x3ec333[_0xc239('0x46')]=qs[_0xc239('0x32')](_0x39874a[_0xc239('0x2c')][_0xc239('0x32')]);_0x3ec333[_0xc239('0x36')]=qs[_0xc239('0x2d')](_['pick'](_0x39874a[_0xc239('0x2c')],_0x4a0e26[_0xc239('0x2d')]));if(_0x39874a['query'][_0xc239('0x34')]){_0x3ec333['where']=_[_0xc239('0x35')](_0x3ec333[_0xc239('0x36')],{'$or':_['map'](_0x3ec333['attributes'],function(_0x5e2bd8){var _0x560b7d={};_0x560b7d[_0x5e2bd8]={'$like':'%'+_0x39874a['query'][_0xc239('0x34')]+'%'};return _0x560b7d;})});}_0x3ec333=_[_0xc239('0x35')]({},_0x3ec333,_0x39874a[_0xc239('0x37')]);return _0x47d0d6[_0xc239('0x49')](_0x3ec333);}})[_0xc239('0x20')](function(_0x16749d){if(_0x16749d){_0x42ac2e=_0x16749d[_0xc239('0x3e')];if(!_0x39874a[_0xc239('0x2c')][_0xc239('0x31')](_0xc239('0x47'))){_0x3ec333[_0xc239('0x18')]=qs['limit'](_0x39874a[_0xc239('0x2c')][_0xc239('0x18')]);_0x3ec333[_0xc239('0x16')]=qs[_0xc239('0x16')](_0x39874a[_0xc239('0x2c')][_0xc239('0x16')]);}return _0x47d0d6[_0xc239('0x49')](_0x3ec333);}})['then'](function(_0x2f1bb8){if(_0x2f1bb8){return _0x2f1bb8?{'count':_0x42ac2e,'rows':_0x2f1bb8}:null;}})[_0xc239('0x20')](respondWithResult(_0x4b925e,null))['catch'](handleError(_0x4b925e,null));};exports[_0xc239('0x4a')]=function(_0x105557,_0x4708ce,_0xaa3fa8){var _0x358f45={};var _0x311829={};var _0x7e31f9;var _0x202f17;return db['VtigerConfiguration'][_0xc239('0x48')]({'where':{'id':_0x105557['params']['id']}})[_0xc239('0x20')](handleEntityNotFound(_0x4708ce,null))[_0xc239('0x20')](function(_0x5c9588){if(_0x5c9588){_0x7e31f9=_0x5c9588;_0x311829['model']=_['keys'](db[_0xc239('0x45')]['rawAttributes']);_0x311829[_0xc239('0x2c')]=_['keys'](_0x105557[_0xc239('0x2c')]);_0x311829[_0xc239('0x2d')]=_[_0xc239('0x2e')](_0x311829[_0xc239('0x2b')],_0x311829[_0xc239('0x2c')]);_0x358f45[_0xc239('0x2f')]=_[_0xc239('0x2e')](_0x311829[_0xc239('0x2b')],qs[_0xc239('0x30')](_0x105557[_0xc239('0x2c')][_0xc239('0x30')]));_0x358f45[_0xc239('0x2f')]=_0x358f45['attributes'][_0xc239('0x3e')]?_0x358f45[_0xc239('0x2f')]:_0x311829['model'];_0x358f45[_0xc239('0x46')]=qs[_0xc239('0x32')](_0x105557[_0xc239('0x2c')][_0xc239('0x32')]);_0x358f45['where']=qs[_0xc239('0x2d')](_['pick'](_0x105557[_0xc239('0x2c')],_0x311829[_0xc239('0x2d')]));if(_0x105557['query'][_0xc239('0x34')]){_0x358f45['where']=_[_0xc239('0x35')](_0x358f45[_0xc239('0x36')],{'$or':_[_0xc239('0x26')](_0x358f45['attributes'],function(_0x2e73c0){var _0x141d80={};_0x141d80[_0x2e73c0]={'$like':'%'+_0x105557['query'][_0xc239('0x34')]+'%'};return _0x141d80;})});}_0x358f45=_[_0xc239('0x35')]({},_0x358f45,_0x105557[_0xc239('0x37')]);return _0x7e31f9[_0xc239('0x4a')](_0x358f45);}})['then'](function(_0x5c7fd2){if(_0x5c7fd2){_0x202f17=_0x5c7fd2[_0xc239('0x3e')];if(!_0x105557['query']['hasOwnProperty'](_0xc239('0x47'))){_0x358f45['limit']=qs['limit'](_0x105557[_0xc239('0x2c')]['limit']);_0x358f45[_0xc239('0x16')]=qs[_0xc239('0x16')](_0x105557[_0xc239('0x2c')][_0xc239('0x16')]);}return _0x7e31f9[_0xc239('0x4a')](_0x358f45);}})[_0xc239('0x20')](function(_0x26a3e5){if(_0x26a3e5){return _0x26a3e5?{'count':_0x202f17,'rows':_0x26a3e5}:null;}})[_0xc239('0x20')](respondWithResult(_0x4708ce,null))['catch'](handleError(_0x4708ce,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 681eb26..a481fa5 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 _0x5abf=['define','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x5abf,0x16c));var _0xf5ab=function(_0x473e3f,_0x2f0947){_0x473e3f=_0x473e3f-0x0;var _0x59399b=_0x5abf[_0x473e3f];return _0x59399b;};'use strict';var _=require(_0xf5ab('0x0'));var util=require(_0xf5ab('0x1'));var logger=require(_0xf5ab('0x2'))(_0xf5ab('0x3'));var moment=require('moment');var BPromise=require(_0xf5ab('0x4'));var rp=require(_0xf5ab('0x5'));var fs=require('fs');var path=require(_0xf5ab('0x6'));var rimraf=require('rimraf');var config=require(_0xf5ab('0x7'));var attributes=require(_0xf5ab('0x8'));module[_0xf5ab('0x9')]=function(_0x2918a9,_0x32cc50){return _0x2918a9[_0xf5ab('0xa')]('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x451d=['lodash','util','../../config/logger','moment','path','../../config/environment','./intVtigerConfiguration.attributes','define','int_vtiger_configurations'];(function(_0x3211db,_0x13503d){var _0xb565fb=function(_0x521a42){while(--_0x521a42){_0x3211db['push'](_0x3211db['shift']());}};_0xb565fb(++_0x13503d);}(_0x451d,0xbd));var _0xd451=function(_0x2b2520,_0x315cd0){_0x2b2520=_0x2b2520-0x0;var _0x25d74e=_0x451d[_0x2b2520];return _0x25d74e;};'use strict';var _=require(_0xd451('0x0'));var util=require(_0xd451('0x1'));var logger=require(_0xd451('0x2'))('api');var moment=require(_0xd451('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd451('0x4'));var rimraf=require('rimraf');var config=require(_0xd451('0x5'));var attributes=require(_0xd451('0x6'));module['exports']=function(_0x1054dc,_0x26378f){return _0x1054dc[_0xd451('0x7')]('VtigerConfiguration',attributes,{'tableName':_0xd451('0x8'),'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 c416752..01cd9d2 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 _0x3131=['stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x3b0e76,_0x239221){var _0x1e4af4=function(_0x4c1daa){while(--_0x4c1daa){_0x3b0e76['push'](_0x3b0e76['shift']());}};_0x1e4af4(++_0x239221);}(_0x3131,0x16e));var _0x1313=function(_0x28f530,_0x3f6507){_0x28f530=_0x28f530-0x0;var _0x5a81d0=_0x3131[_0x28f530];return _0x5a81d0;};'use strict';var _=require(_0x1313('0x0'));var util=require('util');var moment=require(_0x1313('0x1'));var BPromise=require(_0x1313('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1313('0x3'));var db=require(_0x1313('0x4'))['db'];var utils=require(_0x1313('0x5'));var logger=require('../../config/logger')(_0x1313('0x6'));var config=require(_0x1313('0x7'));var jayson=require(_0x1313('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x28fcc2,_0x17ecbd,_0xc3bbf4){return new BPromise(function(_0xafd6ba,_0x321d41){return client[_0x1313('0x9')](_0x28fcc2,_0xc3bbf4)[_0x1313('0xa')](function(_0x4d79fb){logger[_0x1313('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x17ecbd,'request\x20sent');logger[_0x1313('0xc')](_0x1313('0xd'),_0x17ecbd,'request\x20sent',JSON[_0x1313('0xe')](_0x4d79fb));if(_0x4d79fb[_0x1313('0xf')]){if(_0x4d79fb[_0x1313('0xf')][_0x1313('0x10')]===0x1f4){logger['error'](_0x1313('0x11'),_0x17ecbd,_0x4d79fb[_0x1313('0xf')][_0x1313('0x12')]);return _0x321d41(_0x4d79fb[_0x1313('0xf')][_0x1313('0x12')]);}logger[_0x1313('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x17ecbd,_0x4d79fb[_0x1313('0xf')][_0x1313('0x12')]);return _0xafd6ba(_0x4d79fb[_0x1313('0xf')][_0x1313('0x12')]);}else{logger[_0x1313('0xb')](_0x1313('0x11'),_0x17ecbd,'request\x20sent');_0xafd6ba(_0x4d79fb['result']['message']);}})['catch'](function(_0x34050d){logger[_0x1313('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x17ecbd,_0x34050d);_0x321d41(_0x34050d);});});} \ No newline at end of file +var _0xef4c=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash'];(function(_0x296af4,_0x289930){var _0x55b14c=function(_0x2c5dbf){while(--_0x2c5dbf){_0x296af4['push'](_0x296af4['shift']());}};_0x55b14c(++_0x289930);}(_0xef4c,0x11c));var _0xcef4=function(_0x3c2fb6,_0x3c4520){_0x3c2fb6=_0x3c2fb6-0x0;var _0xb69e10=_0xef4c[_0x3c2fb6];return _0xb69e10;};'use strict';var _=require(_0xcef4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcef4('0x1'));var fs=require('fs');var Redis=require(_0xcef4('0x2'));var db=require(_0xcef4('0x3'))['db'];var utils=require(_0xcef4('0x4'));var logger=require(_0xcef4('0x5'))('rpc');var config=require(_0xcef4('0x6'));var jayson=require(_0xcef4('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x58e483,_0x339a97,_0x5633c9){return new BPromise(function(_0x56efa4,_0x2f5433){return client[_0xcef4('0x8')](_0x58e483,_0x5633c9)[_0xcef4('0x9')](function(_0x59ed57){logger[_0xcef4('0xa')](_0xcef4('0xb'),_0x339a97,_0xcef4('0xc'));logger[_0xcef4('0xd')](_0xcef4('0xe'),_0x339a97,_0xcef4('0xc'),JSON['stringify'](_0x59ed57));if(_0x59ed57[_0xcef4('0xf')]){if(_0x59ed57[_0xcef4('0xf')]['code']===0x1f4){logger[_0xcef4('0xf')](_0xcef4('0xb'),_0x339a97,_0x59ed57[_0xcef4('0xf')][_0xcef4('0x10')]);return _0x2f5433(_0x59ed57[_0xcef4('0xf')]['message']);}logger[_0xcef4('0xf')](_0xcef4('0xb'),_0x339a97,_0x59ed57[_0xcef4('0xf')][_0xcef4('0x10')]);return _0x56efa4(_0x59ed57['error'][_0xcef4('0x10')]);}else{logger[_0xcef4('0xa')]('VtigerConfiguration,\x20%s,\x20%s',_0x339a97,_0xcef4('0xc'));_0x56efa4(_0x59ed57[_0xcef4('0x11')]['message']);}})[_0xcef4('0x12')](function(_0x4abc13){logger[_0xcef4('0xf')](_0xcef4('0xb'),_0x339a97,_0x4abc13);_0x2f5433(_0x4abc13);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 77327b0..c315c23 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 _0x4e3e=['multer','util','express','Router','fs-extra','../../config/environment','./intVtigerField.controller','isAuthenticated','get','/:id','show','create','delete','destroy','exports'];(function(_0x425012,_0x162bf4){var _0x521e97=function(_0x130b77){while(--_0x130b77){_0x425012['push'](_0x425012['shift']());}};_0x521e97(++_0x162bf4);}(_0x4e3e,0x1a4));var _0xe4e3=function(_0x2e726e,_0x3faf87){_0x2e726e=_0x2e726e-0x0;var _0x273748=_0x4e3e[_0x2e726e];return _0x273748;};'use strict';var multer=require(_0xe4e3('0x0'));var util=require(_0xe4e3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe4e3('0x2'));var router=express[_0xe4e3('0x3')]();var fs_extra=require(_0xe4e3('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe4e3('0x5'));var controller=require(_0xe4e3('0x6'));router['get']('/',auth[_0xe4e3('0x7')](),controller['index']);router[_0xe4e3('0x8')](_0xe4e3('0x9'),auth[_0xe4e3('0x7')](),controller[_0xe4e3('0xa')]);router['post']('/',auth[_0xe4e3('0x7')](),controller[_0xe4e3('0xb')]);router['put']('/:id',auth[_0xe4e3('0x7')](),controller['update']);router[_0xe4e3('0xc')](_0xe4e3('0x9'),auth[_0xe4e3('0x7')](),controller[_0xe4e3('0xd')]);module[_0xe4e3('0xe')]=router; \ No newline at end of file +var _0x0039=['delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x0039,0x158));var _0x9003=function(_0x201d19,_0x41595b){_0x201d19=_0x201d19-0x0;var _0x25d546=_0x0039[_0x201d19];return _0x25d546;};'use strict';var multer=require('multer');var util=require(_0x9003('0x0'));var path=require(_0x9003('0x1'));var timeout=require(_0x9003('0x2'));var express=require('express');var router=express[_0x9003('0x3')]();var fs_extra=require(_0x9003('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9003('0x5'));var config=require(_0x9003('0x6'));var controller=require(_0x9003('0x7'));router[_0x9003('0x8')]('/',auth[_0x9003('0x9')](),controller[_0x9003('0xa')]);router['get'](_0x9003('0xb'),auth[_0x9003('0x9')](),controller[_0x9003('0xc')]);router[_0x9003('0xd')]('/',auth[_0x9003('0x9')](),controller[_0x9003('0xe')]);router[_0x9003('0xf')](_0x9003('0xb'),auth[_0x9003('0x9')](),controller[_0x9003('0x10')]);router[_0x9003('0x11')](_0x9003('0xb'),auth['isAuthenticated'](),controller[_0x9003('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 2b46b27..153c507 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 _0xe80e=['picklist','variable','STRING','BOOLEAN','exports','ENUM','customVariable','keyValue'];(function(_0x5e0fcd,_0x3482db){var _0x190cc7=function(_0xcfedb3){while(--_0xcfedb3){_0x5e0fcd['push'](_0x5e0fcd['shift']());}};_0x190cc7(++_0x3482db);}(_0xe80e,0x18c));var _0xee80=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0xe80e[_0x166742];return _0xb7814a;};'use strict';var Sequelize=require('sequelize');module[_0xee80('0x0')]={'type':{'type':Sequelize[_0xee80('0x1')]('string','variable',_0xee80('0x2'),_0xee80('0x3'),_0xee80('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xee80('0x1')]('string',_0xee80('0x5'),_0xee80('0x2'))},'keyContent':{'type':Sequelize[_0xee80('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xee80('0x6')]},'customField':{'type':Sequelize[_0xee80('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa390=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist'];(function(_0x461228,_0x56edbd){var _0x6cb437=function(_0x85aca7){while(--_0x85aca7){_0x461228['push'](_0x461228['shift']());}};_0x6cb437(++_0x56edbd);}(_0xa390,0xcb));var _0x0a39=function(_0x32c013,_0x2e2793){_0x32c013=_0x32c013-0x0;var _0x5532ac=_0xa390[_0x32c013];return _0x5532ac;};'use strict';var Sequelize=require(_0x0a39('0x0'));module[_0x0a39('0x1')]={'type':{'type':Sequelize[_0x0a39('0x2')](_0x0a39('0x3'),'variable',_0x0a39('0x4'),_0x0a39('0x5'),_0x0a39('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0a39('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x0a39('0x3'),_0x0a39('0x8'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0a39('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0a39('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0a39('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index d0b5c33..0e2bcaa 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 _0xfa83=['zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','map','rawAttributes','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','VtigerField','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','eml-format','rimraf'];(function(_0x4f5fd3,_0xc8ade3){var _0x15a0dc=function(_0xfe31f6){while(--_0xfe31f6){_0x4f5fd3['push'](_0x4f5fd3['shift']());}};_0x15a0dc(++_0xc8ade3);}(_0xfa83,0x175));var _0x3fa8=function(_0x47542d,_0x3fca59){_0x47542d=_0x47542d-0x0;var _0x1ca7e3=_0xfa83[_0x47542d];return _0x1ca7e3;};'use strict';var emlformat=require(_0x3fa8('0x0'));var rimraf=require(_0x3fa8('0x1'));var zipdir=require(_0x3fa8('0x2'));var jsonpatch=require(_0x3fa8('0x3'));var rp=require('request-promise');var moment=require(_0x3fa8('0x4'));var BPromise=require(_0x3fa8('0x5'));var Mustache=require(_0x3fa8('0x6'));var util=require(_0x3fa8('0x7'));var path=require('path');var sox=require(_0x3fa8('0x8'));var csv=require('to-csv');var ejs=require(_0x3fa8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3fa8('0xa'));var squel=require(_0x3fa8('0xb'));var crypto=require(_0x3fa8('0xc'));var jsforce=require(_0x3fa8('0xd'));var deskjs=require(_0x3fa8('0xe'));var toCsv=require(_0x3fa8('0xf'));var querystring=require('querystring');var Papa=require(_0x3fa8('0x10'));var Redis=require(_0x3fa8('0x11'));var authService=require(_0x3fa8('0x12'));var qs=require(_0x3fa8('0x13'));var as=require(_0x3fa8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3fa8('0x15'))(_0x3fa8('0x16'));var utils=require(_0x3fa8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3fa8('0x18'));var db=require(_0x3fa8('0x19'))['db'];function respondWithStatusCode(_0x212315,_0x4049c2){_0x4049c2=_0x4049c2||0xcc;return function(_0x188e3e){if(_0x188e3e){return _0x212315[_0x3fa8('0x1a')](_0x4049c2);}return _0x212315['status'](_0x4049c2)[_0x3fa8('0x1b')]();};}function respondWithResult(_0x3f654f,_0x23e71b){_0x23e71b=_0x23e71b||0xc8;return function(_0x358b4b){if(_0x358b4b){return _0x3f654f[_0x3fa8('0x1c')](_0x23e71b)[_0x3fa8('0x1d')](_0x358b4b);}};}function respondWithFilteredResult(_0x10d22a,_0x9ea3c1){return function(_0x1d2932){if(_0x1d2932){var _0xa46893=typeof _0x9ea3c1[_0x3fa8('0x1e')]==='undefined'&&typeof _0x9ea3c1['limit']===_0x3fa8('0x1f');var _0x18df02=_0x1d2932['count'];var _0x47fc1c=_0xa46893?0x0:_0x9ea3c1['offset'];var _0x4b37c1=_0xa46893?_0x1d2932[_0x3fa8('0x20')]:_0x9ea3c1[_0x3fa8('0x1e')]+_0x9ea3c1['limit'];var _0x3ebef0;if(_0x4b37c1>=_0x18df02){_0x4b37c1=_0x18df02;_0x3ebef0=0xc8;}else{_0x3ebef0=0xce;}_0x10d22a[_0x3fa8('0x1c')](_0x3ebef0);return _0x10d22a[_0x3fa8('0x21')](_0x3fa8('0x22'),_0x47fc1c+'-'+_0x4b37c1+'/'+_0x18df02)['json'](_0x1d2932);}return null;};}function patchUpdates(_0x432f36){return function(_0x4dd7bc){try{jsonpatch[_0x3fa8('0x23')](_0x4dd7bc,_0x432f36,!![]);}catch(_0x555387){return BPromise[_0x3fa8('0x24')](_0x555387);}return _0x4dd7bc[_0x3fa8('0x25')]();};}function saveUpdates(_0x3c5232,_0x56b057){return function(_0x25920e){if(_0x25920e){return _0x25920e['update'](_0x3c5232)[_0x3fa8('0x26')](function(_0x214b40){return _0x214b40;});}return null;};}function removeEntity(_0x590d05,_0x39d1b0){return function(_0x1b31c9){if(_0x1b31c9){return _0x1b31c9[_0x3fa8('0x27')]()[_0x3fa8('0x26')](function(){_0x590d05['status'](0xcc)[_0x3fa8('0x1b')]();});}};}function handleEntityNotFound(_0x3da411,_0x3a7d9a){return function(_0x2a91d2){if(!_0x2a91d2){_0x3da411[_0x3fa8('0x1a')](0x194);}return _0x2a91d2;};}function handleError(_0x394d16,_0x1f08e2){_0x1f08e2=_0x1f08e2||0x1f4;return function(_0x275d28){logger[_0x3fa8('0x28')](_0x275d28[_0x3fa8('0x29')]);if(_0x275d28[_0x3fa8('0x2a')]){delete _0x275d28['name'];}_0x394d16[_0x3fa8('0x1c')](_0x1f08e2)['send'](_0x275d28);};}exports['index']=function(_0x5c0279,_0x24b327){var _0x4caa46={},_0x19bc1a={},_0x4bae08={'count':0x0,'rows':[]};var _0x5405d3=_[_0x3fa8('0x2b')](db['VtigerField'][_0x3fa8('0x2c')],function(_0x4078aa){return{'name':_0x4078aa['fieldName'],'type':_0x4078aa[_0x3fa8('0x2d')]['key']};});_0x19bc1a['model']=_[_0x3fa8('0x2b')](_0x5405d3,_0x3fa8('0x2a'));_0x19bc1a[_0x3fa8('0x2e')]=_['keys'](_0x5c0279[_0x3fa8('0x2e')]);_0x19bc1a[_0x3fa8('0x2f')]=_['intersection'](_0x19bc1a[_0x3fa8('0x30')],_0x19bc1a[_0x3fa8('0x2e')]);_0x4caa46[_0x3fa8('0x31')]=_[_0x3fa8('0x32')](_0x19bc1a[_0x3fa8('0x30')],qs[_0x3fa8('0x33')](_0x5c0279[_0x3fa8('0x2e')][_0x3fa8('0x33')]));_0x4caa46[_0x3fa8('0x31')]=_0x4caa46[_0x3fa8('0x31')][_0x3fa8('0x34')]?_0x4caa46[_0x3fa8('0x31')]:_0x19bc1a['model'];if(!_0x5c0279[_0x3fa8('0x2e')][_0x3fa8('0x35')](_0x3fa8('0x36'))){_0x4caa46[_0x3fa8('0x37')]=qs[_0x3fa8('0x37')](_0x5c0279[_0x3fa8('0x2e')]['limit']);_0x4caa46[_0x3fa8('0x1e')]=qs[_0x3fa8('0x1e')](_0x5c0279[_0x3fa8('0x2e')]['offset']);}_0x4caa46[_0x3fa8('0x38')]=qs[_0x3fa8('0x39')](_0x5c0279[_0x3fa8('0x2e')][_0x3fa8('0x39')]);_0x4caa46['where']=qs[_0x3fa8('0x2f')](_[_0x3fa8('0x3a')](_0x5c0279[_0x3fa8('0x2e')],_0x19bc1a[_0x3fa8('0x2f')]),_0x5405d3);if(_0x5c0279['query'][_0x3fa8('0x3b')]){_0x4caa46[_0x3fa8('0x3c')]=_[_0x3fa8('0x3d')](_0x4caa46['where'],{'$or':_[_0x3fa8('0x2b')](_0x5405d3,function(_0x2044df){if(_0x2044df[_0x3fa8('0x2d')]!==_0x3fa8('0x3e')){var _0x36b09f={};_0x36b09f[_0x2044df[_0x3fa8('0x2a')]]={'$like':'%'+_0x5c0279['query'][_0x3fa8('0x3b')]+'%'};return _0x36b09f;}})});}_0x4caa46=_[_0x3fa8('0x3d')]({},_0x4caa46,_0x5c0279['options']);var _0x133744={'where':_0x4caa46['where']};return db[_0x3fa8('0x3f')][_0x3fa8('0x20')](_0x133744)[_0x3fa8('0x26')](function(_0x49697d){_0x4bae08[_0x3fa8('0x20')]=_0x49697d;if(_0x5c0279[_0x3fa8('0x2e')][_0x3fa8('0x40')]){_0x4caa46[_0x3fa8('0x41')]=[{'all':!![]}];}return db[_0x3fa8('0x3f')][_0x3fa8('0x42')](_0x4caa46);})['then'](function(_0x27cdc9){_0x4bae08['rows']=_0x27cdc9;return _0x4bae08;})[_0x3fa8('0x26')](respondWithFilteredResult(_0x24b327,_0x4caa46))[_0x3fa8('0x43')](handleError(_0x24b327,null));};exports[_0x3fa8('0x44')]=function(_0x93078c,_0x386407){var _0x1ed0a7={'raw':!![],'where':{'id':_0x93078c[_0x3fa8('0x45')]['id']}},_0x3163b3={};_0x3163b3[_0x3fa8('0x30')]=_[_0x3fa8('0x46')](db['VtigerField'][_0x3fa8('0x2c')]);_0x3163b3['query']=_[_0x3fa8('0x46')](_0x93078c[_0x3fa8('0x2e')]);_0x3163b3[_0x3fa8('0x2f')]=_[_0x3fa8('0x32')](_0x3163b3[_0x3fa8('0x30')],_0x3163b3[_0x3fa8('0x2e')]);_0x1ed0a7[_0x3fa8('0x31')]=_['intersection'](_0x3163b3[_0x3fa8('0x30')],qs[_0x3fa8('0x33')](_0x93078c[_0x3fa8('0x2e')]['fields']));_0x1ed0a7['attributes']=_0x1ed0a7[_0x3fa8('0x31')][_0x3fa8('0x34')]?_0x1ed0a7[_0x3fa8('0x31')]:_0x3163b3['model'];if(_0x93078c['query'][_0x3fa8('0x40')]){_0x1ed0a7[_0x3fa8('0x41')]=[{'all':!![]}];}_0x1ed0a7=_[_0x3fa8('0x3d')]({},_0x1ed0a7,_0x93078c[_0x3fa8('0x47')]);return db[_0x3fa8('0x3f')][_0x3fa8('0x48')](_0x1ed0a7)[_0x3fa8('0x26')](handleEntityNotFound(_0x386407,null))[_0x3fa8('0x26')](respondWithResult(_0x386407,null))[_0x3fa8('0x43')](handleError(_0x386407,null));};exports['create']=function(_0x21fa20,_0x542545){return db[_0x3fa8('0x3f')][_0x3fa8('0x49')](_0x21fa20[_0x3fa8('0x4a')],{})[_0x3fa8('0x26')](respondWithResult(_0x542545,0xc9))[_0x3fa8('0x43')](handleError(_0x542545,null));};exports['update']=function(_0x472d50,_0x595935){if(_0x472d50[_0x3fa8('0x4a')]['id']){delete _0x472d50[_0x3fa8('0x4a')]['id'];}return db['VtigerField'][_0x3fa8('0x48')]({'where':{'id':_0x472d50[_0x3fa8('0x45')]['id']}})[_0x3fa8('0x26')](handleEntityNotFound(_0x595935,null))[_0x3fa8('0x26')](saveUpdates(_0x472d50[_0x3fa8('0x4a')],null))[_0x3fa8('0x26')](respondWithResult(_0x595935,null))[_0x3fa8('0x43')](handleError(_0x595935,null));};exports[_0x3fa8('0x27')]=function(_0x3494e7,_0x198db3){return db['VtigerField'][_0x3fa8('0x48')]({'where':{'id':_0x3494e7[_0x3fa8('0x45')]['id']}})[_0x3fa8('0x26')](handleEntityNotFound(_0x198db3,null))[_0x3fa8('0x26')](removeEntity(_0x198db3,null))[_0x3fa8('0x43')](handleError(_0x198db3,null));}; \ No newline at end of file +var _0xb98c=['then','destroy','sendStatus','stack','send','index','VtigerField','rawAttributes','fieldName','type','key','model','name','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','map','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','params','include','create','body','find','eml-format','fast-json-patch','mustache','util','sox','ejs','lodash','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/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb98c,0x199));var _0xcb98=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xb98c[_0x4c7fb5];return _0x2e10ac;};'use strict';var emlformat=require(_0xcb98('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcb98('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcb98('0x2'));var util=require(_0xcb98('0x3'));var path=require('path');var sox=require(_0xcb98('0x4'));var csv=require('to-csv');var ejs=require(_0xcb98('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcb98('0x6'));var squel=require(_0xcb98('0x7'));var crypto=require('crypto');var jsforce=require(_0xcb98('0x8'));var deskjs=require(_0xcb98('0x9'));var toCsv=require(_0xcb98('0xa'));var querystring=require(_0xcb98('0xb'));var Papa=require(_0xcb98('0xc'));var Redis=require('ioredis');var authService=require(_0xcb98('0xd'));var qs=require(_0xcb98('0xe'));var as=require(_0xcb98('0xf'));var hardwareService=require(_0xcb98('0x10'));var logger=require(_0xcb98('0x11'))(_0xcb98('0x12'));var utils=require(_0xcb98('0x13'));var config=require(_0xcb98('0x14'));var licenseUtil=require(_0xcb98('0x15'));var db=require(_0xcb98('0x16'))['db'];function respondWithStatusCode(_0x10ac3d,_0x3dcb0e){_0x3dcb0e=_0x3dcb0e||0xcc;return function(_0x493fa0){if(_0x493fa0){return _0x10ac3d['sendStatus'](_0x3dcb0e);}return _0x10ac3d[_0xcb98('0x17')](_0x3dcb0e)[_0xcb98('0x18')]();};}function respondWithResult(_0x548ca0,_0x1afa00){_0x1afa00=_0x1afa00||0xc8;return function(_0xc9803d){if(_0xc9803d){return _0x548ca0[_0xcb98('0x17')](_0x1afa00)['json'](_0xc9803d);}};}function respondWithFilteredResult(_0x50fd3a,_0x5390da){return function(_0x396abc){if(_0x396abc){var _0x12c355=typeof _0x5390da[_0xcb98('0x19')]===_0xcb98('0x1a')&&typeof _0x5390da[_0xcb98('0x1b')]===_0xcb98('0x1a');var _0x1e6ee6=_0x396abc[_0xcb98('0x1c')];var _0x1b857c=_0x12c355?0x0:_0x5390da['offset'];var _0x4a6c30=_0x12c355?_0x396abc[_0xcb98('0x1c')]:_0x5390da[_0xcb98('0x19')]+_0x5390da[_0xcb98('0x1b')];var _0x25f71d;if(_0x4a6c30>=_0x1e6ee6){_0x4a6c30=_0x1e6ee6;_0x25f71d=0xc8;}else{_0x25f71d=0xce;}_0x50fd3a[_0xcb98('0x17')](_0x25f71d);return _0x50fd3a[_0xcb98('0x1d')](_0xcb98('0x1e'),_0x1b857c+'-'+_0x4a6c30+'/'+_0x1e6ee6)[_0xcb98('0x1f')](_0x396abc);}return null;};}function patchUpdates(_0x3b00cb){return function(_0x4211f4){try{jsonpatch['apply'](_0x4211f4,_0x3b00cb,!![]);}catch(_0x414043){return BPromise[_0xcb98('0x20')](_0x414043);}return _0x4211f4[_0xcb98('0x21')]();};}function saveUpdates(_0x2bd375,_0x4057d2){return function(_0x47a3a8){if(_0x47a3a8){return _0x47a3a8[_0xcb98('0x22')](_0x2bd375)[_0xcb98('0x23')](function(_0x16b1fa){return _0x16b1fa;});}return null;};}function removeEntity(_0xa5d859,_0x3772dc){return function(_0x1fa5ef){if(_0x1fa5ef){return _0x1fa5ef[_0xcb98('0x24')]()[_0xcb98('0x23')](function(){_0xa5d859[_0xcb98('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x376597,_0x54f5bc){return function(_0x3dfdcf){if(!_0x3dfdcf){_0x376597[_0xcb98('0x25')](0x194);}return _0x3dfdcf;};}function handleError(_0x1cd893,_0x255bbf){_0x255bbf=_0x255bbf||0x1f4;return function(_0x46b378){logger['error'](_0x46b378[_0xcb98('0x26')]);if(_0x46b378['name']){delete _0x46b378['name'];}_0x1cd893[_0xcb98('0x17')](_0x255bbf)[_0xcb98('0x27')](_0x46b378);};}exports[_0xcb98('0x28')]=function(_0x1a7e39,_0x2fbea3){var _0x306eee={},_0x77214c={},_0x5b14da={'count':0x0,'rows':[]};var _0xf6b572=_['map'](db[_0xcb98('0x29')][_0xcb98('0x2a')],function(_0x516f57){return{'name':_0x516f57[_0xcb98('0x2b')],'type':_0x516f57[_0xcb98('0x2c')][_0xcb98('0x2d')]};});_0x77214c[_0xcb98('0x2e')]=_['map'](_0xf6b572,_0xcb98('0x2f'));_0x77214c['query']=_[_0xcb98('0x30')](_0x1a7e39['query']);_0x77214c['filters']=_[_0xcb98('0x31')](_0x77214c[_0xcb98('0x2e')],_0x77214c[_0xcb98('0x32')]);_0x306eee[_0xcb98('0x33')]=_[_0xcb98('0x31')](_0x77214c[_0xcb98('0x2e')],qs[_0xcb98('0x34')](_0x1a7e39[_0xcb98('0x32')]['fields']));_0x306eee[_0xcb98('0x33')]=_0x306eee[_0xcb98('0x33')][_0xcb98('0x35')]?_0x306eee['attributes']:_0x77214c[_0xcb98('0x2e')];if(!_0x1a7e39['query'][_0xcb98('0x36')](_0xcb98('0x37'))){_0x306eee[_0xcb98('0x1b')]=qs['limit'](_0x1a7e39[_0xcb98('0x32')]['limit']);_0x306eee[_0xcb98('0x19')]=qs[_0xcb98('0x19')](_0x1a7e39[_0xcb98('0x32')]['offset']);}_0x306eee[_0xcb98('0x38')]=qs[_0xcb98('0x39')](_0x1a7e39['query']['sort']);_0x306eee[_0xcb98('0x3a')]=qs['filters'](_['pick'](_0x1a7e39[_0xcb98('0x32')],_0x77214c[_0xcb98('0x3b')]),_0xf6b572);if(_0x1a7e39['query']['filter']){_0x306eee[_0xcb98('0x3a')]=_['merge'](_0x306eee[_0xcb98('0x3a')],{'$or':_[_0xcb98('0x3c')](_0xf6b572,function(_0x14c782){if(_0x14c782[_0xcb98('0x2c')]!==_0xcb98('0x3d')){var _0x1ac1e9={};_0x1ac1e9[_0x14c782['name']]={'$like':'%'+_0x1a7e39[_0xcb98('0x32')][_0xcb98('0x3e')]+'%'};return _0x1ac1e9;}})});}_0x306eee=_[_0xcb98('0x3f')]({},_0x306eee,_0x1a7e39[_0xcb98('0x40')]);var _0x1cabbd={'where':_0x306eee[_0xcb98('0x3a')]};return db[_0xcb98('0x29')][_0xcb98('0x1c')](_0x1cabbd)['then'](function(_0x4ed914){_0x5b14da[_0xcb98('0x1c')]=_0x4ed914;if(_0x1a7e39[_0xcb98('0x32')][_0xcb98('0x41')]){_0x306eee['include']=[{'all':!![]}];}return db['VtigerField'][_0xcb98('0x42')](_0x306eee);})['then'](function(_0x2c8f38){_0x5b14da[_0xcb98('0x43')]=_0x2c8f38;return _0x5b14da;})['then'](respondWithFilteredResult(_0x2fbea3,_0x306eee))[_0xcb98('0x44')](handleError(_0x2fbea3,null));};exports['show']=function(_0x3e959a,_0x5ac50e){var _0xc65d44={'raw':!![],'where':{'id':_0x3e959a[_0xcb98('0x45')]['id']}},_0x27a35a={};_0x27a35a[_0xcb98('0x2e')]=_['keys'](db[_0xcb98('0x29')][_0xcb98('0x2a')]);_0x27a35a[_0xcb98('0x32')]=_[_0xcb98('0x30')](_0x3e959a[_0xcb98('0x32')]);_0x27a35a[_0xcb98('0x3b')]=_['intersection'](_0x27a35a[_0xcb98('0x2e')],_0x27a35a[_0xcb98('0x32')]);_0xc65d44['attributes']=_['intersection'](_0x27a35a['model'],qs['fields'](_0x3e959a[_0xcb98('0x32')][_0xcb98('0x34')]));_0xc65d44[_0xcb98('0x33')]=_0xc65d44[_0xcb98('0x33')][_0xcb98('0x35')]?_0xc65d44[_0xcb98('0x33')]:_0x27a35a[_0xcb98('0x2e')];if(_0x3e959a[_0xcb98('0x32')]['includeAll']){_0xc65d44[_0xcb98('0x46')]=[{'all':!![]}];}_0xc65d44=_[_0xcb98('0x3f')]({},_0xc65d44,_0x3e959a[_0xcb98('0x40')]);return db['VtigerField']['find'](_0xc65d44)[_0xcb98('0x23')](handleEntityNotFound(_0x5ac50e,null))[_0xcb98('0x23')](respondWithResult(_0x5ac50e,null))[_0xcb98('0x44')](handleError(_0x5ac50e,null));};exports[_0xcb98('0x47')]=function(_0x2a1d57,_0x463f16){return db[_0xcb98('0x29')][_0xcb98('0x47')](_0x2a1d57[_0xcb98('0x48')],{})[_0xcb98('0x23')](respondWithResult(_0x463f16,0xc9))[_0xcb98('0x44')](handleError(_0x463f16,null));};exports[_0xcb98('0x22')]=function(_0xabd7cf,_0x34fbbb){if(_0xabd7cf[_0xcb98('0x48')]['id']){delete _0xabd7cf['body']['id'];}return db[_0xcb98('0x29')][_0xcb98('0x49')]({'where':{'id':_0xabd7cf[_0xcb98('0x45')]['id']}})[_0xcb98('0x23')](handleEntityNotFound(_0x34fbbb,null))[_0xcb98('0x23')](saveUpdates(_0xabd7cf[_0xcb98('0x48')],null))[_0xcb98('0x23')](respondWithResult(_0x34fbbb,null))[_0xcb98('0x44')](handleError(_0x34fbbb,null));};exports['destroy']=function(_0x29e936,_0x14e14d){return db[_0xcb98('0x29')][_0xcb98('0x49')]({'where':{'id':_0x29e936[_0xcb98('0x45')]['id']}})[_0xcb98('0x23')](handleEntityNotFound(_0x14e14d,null))['then'](removeEntity(_0x14e14d,null))[_0xcb98('0x44')](handleError(_0x14e14d,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index d4c6d35..ae38ec0 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 _0x3afa=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intVtigerField.attributes','exports','define','int_vtiger_fields','vtiger_unique_index','idField','FieldId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3afa,0x142));var _0xa3af=function(_0x119cd8,_0x556b73){_0x119cd8=_0x119cd8-0x0;var _0x7072a3=_0x3afa[_0x119cd8];return _0x7072a3;};'use strict';var _=require('lodash');var util=require(_0xa3af('0x0'));var logger=require(_0xa3af('0x1'))(_0xa3af('0x2'));var moment=require(_0xa3af('0x3'));var BPromise=require('bluebird');var rp=require(_0xa3af('0x4'));var fs=require('fs');var path=require(_0xa3af('0x5'));var rimraf=require('rimraf');var config=require(_0xa3af('0x6'));var attributes=require(_0xa3af('0x7'));module[_0xa3af('0x8')]=function(_0x53dfe5,_0x4fe9a6){return _0x53dfe5[_0xa3af('0x9')]('VtigerField',attributes,{'tableName':_0xa3af('0xa'),'paranoid':![],'indexes':[{'name':_0xa3af('0xb'),'fields':[_0xa3af('0xc'),_0xa3af('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c59=['path','rimraf','../../config/environment','./intVtigerField.attributes','VtigerField','vtiger_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird'];(function(_0x24bba0,_0x6d581f){var _0x11b8cd=function(_0x55893f){while(--_0x55893f){_0x24bba0['push'](_0x24bba0['shift']());}};_0x11b8cd(++_0x6d581f);}(_0x5c59,0xd8));var _0x95c5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5c59[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x95c5('0x0'));var logger=require(_0x95c5('0x1'))(_0x95c5('0x2'));var moment=require(_0x95c5('0x3'));var BPromise=require(_0x95c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x95c5('0x5'));var rimraf=require(_0x95c5('0x6'));var config=require(_0x95c5('0x7'));var attributes=require(_0x95c5('0x8'));module['exports']=function(_0x8562eb,_0x2d0236){return _0x8562eb['define'](_0x95c5('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x95c5('0xa'),'fields':[_0x95c5('0xb'),_0x95c5('0xc')],'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 d5b99b7..447ae48 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 _0x21c9=['stringify','code','message','error','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x4029a0,_0x5d3398){var _0x2cb414=function(_0x5aaaf5){while(--_0x5aaaf5){_0x4029a0['push'](_0x4029a0['shift']());}};_0x2cb414(++_0x5d3398);}(_0x21c9,0x84));var _0x921c=function(_0x1650bf,_0xf8c07){_0x1650bf=_0x1650bf-0x0;var _0x40f175=_0x21c9[_0x1650bf];return _0x40f175;};'use strict';var _=require(_0x921c('0x0'));var util=require(_0x921c('0x1'));var moment=require(_0x921c('0x2'));var BPromise=require('bluebird');var rs=require(_0x921c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x921c('0x4'))['db'];var utils=require(_0x921c('0x5'));var logger=require(_0x921c('0x6'))(_0x921c('0x7'));var config=require(_0x921c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x921c('0x9')][_0x921c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f543f,_0x2f391e,_0xba2fa1){return new BPromise(function(_0x1aa1f2,_0x3e1123){return client[_0x921c('0xb')](_0x3f543f,_0xba2fa1)['then'](function(_0x3ef3cc){logger['info'](_0x921c('0xc'),_0x2f391e,_0x921c('0xd'));logger['debug'](_0x921c('0xe'),_0x2f391e,_0x921c('0xd'),JSON[_0x921c('0xf')](_0x3ef3cc));if(_0x3ef3cc['error']){if(_0x3ef3cc['error'][_0x921c('0x10')]===0x1f4){logger['error'](_0x921c('0xc'),_0x2f391e,_0x3ef3cc['error'][_0x921c('0x11')]);return _0x3e1123(_0x3ef3cc[_0x921c('0x12')][_0x921c('0x11')]);}logger[_0x921c('0x12')](_0x921c('0xc'),_0x2f391e,_0x3ef3cc['error'][_0x921c('0x11')]);return _0x1aa1f2(_0x3ef3cc[_0x921c('0x12')]['message']);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x2f391e,'request\x20sent');_0x1aa1f2(_0x3ef3cc[_0x921c('0x13')][_0x921c('0x11')]);}})[_0x921c('0x14')](function(_0x404e90){logger[_0x921c('0x12')]('VtigerField,\x20%s,\x20%s',_0x2f391e,_0x404e90);_0x3e1123(_0x404e90);});});} \ No newline at end of file +var _0x91e3=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','stringify','code','error','VtigerField,\x20%s,\x20%s','message','result','util','bluebird'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0x91e3,0x1d2));var _0x391e=function(_0x582689,_0x256d34){_0x582689=_0x582689-0x0;var _0x5dc6d6=_0x91e3[_0x582689];return _0x5dc6d6;};'use strict';var _=require('lodash');var util=require(_0x391e('0x0'));var moment=require('moment');var BPromise=require(_0x391e('0x1'));var rs=require(_0x391e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x391e('0x3'))['db'];var utils=require(_0x391e('0x4'));var logger=require(_0x391e('0x5'))(_0x391e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x391e('0x7')][_0x391e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x562869,_0x4ba71b,_0x1ca983){return new BPromise(function(_0x5e8384,_0x75d1d2){return client['request'](_0x562869,_0x1ca983)[_0x391e('0x9')](function(_0xd97418){logger[_0x391e('0xa')]('VtigerField,\x20%s,\x20%s',_0x4ba71b,_0x391e('0xb'));logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x4ba71b,_0x391e('0xb'),JSON[_0x391e('0xc')](_0xd97418));if(_0xd97418['error']){if(_0xd97418['error'][_0x391e('0xd')]===0x1f4){logger[_0x391e('0xe')](_0x391e('0xf'),_0x4ba71b,_0xd97418['error'][_0x391e('0x10')]);return _0x75d1d2(_0xd97418['error'][_0x391e('0x10')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x4ba71b,_0xd97418['error'][_0x391e('0x10')]);return _0x5e8384(_0xd97418[_0x391e('0xe')][_0x391e('0x10')]);}else{logger[_0x391e('0xa')]('VtigerField,\x20%s,\x20%s',_0x4ba71b,_0x391e('0xb'));_0x5e8384(_0xd97418[_0x391e('0x11')][_0x391e('0x10')]);}})['catch'](function(_0x230c16){logger[_0x391e('0xe')](_0x391e('0xf'),_0x4ba71b,_0x230c16);_0x75d1d2(_0x230c16);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index fda688b..5eacf6e 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 _0x1a9d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5e8edc,_0x3a3129){var _0xc9b988=function(_0x4c30a7){while(--_0x4c30a7){_0x5e8edc['push'](_0x5e8edc['shift']());}};_0xc9b988(++_0x3a3129);}(_0x1a9d,0xfe));var _0xd1a9=function(_0x87c752,_0x1ae88c){_0x87c752=_0x87c752-0x0;var _0x31bcf7=_0x1a9d[_0x87c752];return _0x31bcf7;};'use strict';var multer=require(_0xd1a9('0x0'));var util=require(_0xd1a9('0x1'));var path=require(_0xd1a9('0x2'));var timeout=require(_0xd1a9('0x3'));var express=require(_0xd1a9('0x4'));var router=express[_0xd1a9('0x5')]();var fs_extra=require(_0xd1a9('0x6'));var auth=require(_0xd1a9('0x7'));var interaction=require(_0xd1a9('0x8'));var config=require(_0xd1a9('0x9'));var controller=require(_0xd1a9('0xa'));router[_0xd1a9('0xb')]('/',auth[_0xd1a9('0xc')](),controller['index']);router[_0xd1a9('0xb')](_0xd1a9('0xd'),auth[_0xd1a9('0xc')](),controller[_0xd1a9('0xe')]);router[_0xd1a9('0xb')](_0xd1a9('0xf'),auth[_0xd1a9('0xc')](),controller['getConfigurations']);router[_0xd1a9('0xb')](_0xd1a9('0x10'),auth[_0xd1a9('0xc')](),controller[_0xd1a9('0x11')]);router[_0xd1a9('0x12')]('/',auth['isAuthenticated'](),controller[_0xd1a9('0x13')]);router[_0xd1a9('0x12')](_0xd1a9('0xf'),auth[_0xd1a9('0xc')](),controller[_0xd1a9('0x14')]);router[_0xd1a9('0x15')](_0xd1a9('0xd'),auth[_0xd1a9('0xc')](),controller[_0xd1a9('0x16')]);router[_0xd1a9('0x17')](_0xd1a9('0xd'),auth['isAuthenticated'](),controller[_0xd1a9('0x18')]);module[_0xd1a9('0x19')]=router; \ No newline at end of file +var _0x7d8a=['path','connect-timeout','express','fs-extra','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7d8a,0x1e1));var _0xa7d8=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0x7d8a[_0x19159a];return _0xa677f4;};'use strict';var multer=require(_0xa7d8('0x0'));var util=require(_0xa7d8('0x1'));var path=require(_0xa7d8('0x2'));var timeout=require(_0xa7d8('0x3'));var express=require(_0xa7d8('0x4'));var router=express['Router']();var fs_extra=require(_0xa7d8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa7d8('0x6'));var config=require('../../config/environment');var controller=require(_0xa7d8('0x7'));router[_0xa7d8('0x8')]('/',auth[_0xa7d8('0x9')](),controller['index']);router[_0xa7d8('0x8')](_0xa7d8('0xa'),auth[_0xa7d8('0x9')](),controller['show']);router['get'](_0xa7d8('0xb'),auth[_0xa7d8('0x9')](),controller[_0xa7d8('0xc')]);router['get'](_0xa7d8('0xd'),auth[_0xa7d8('0x9')](),controller[_0xa7d8('0xe')]);router[_0xa7d8('0xf')]('/',auth[_0xa7d8('0x9')](),controller[_0xa7d8('0x10')]);router[_0xa7d8('0xf')](_0xa7d8('0xb'),auth[_0xa7d8('0x9')](),controller[_0xa7d8('0x11')]);router[_0xa7d8('0x12')](_0xa7d8('0xa'),auth['isAuthenticated'](),controller[_0xa7d8('0x13')]);router[_0xa7d8('0x14')](_0xa7d8('0xa'),auth['isAuthenticated'](),controller[_0xa7d8('0x15')]);module[_0xa7d8('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index e828aff..c951783 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 _0x11e5=['password','newTab','integrationTab','sequelize','STRING','username','remoteUri','token'];(function(_0x21b383,_0x3317e0){var _0x5c0188=function(_0x1b07dd){while(--_0x1b07dd){_0x21b383['push'](_0x21b383['shift']());}};_0x5c0188(++_0x3317e0);}(_0x11e5,0x8b));var _0x511e=function(_0x341c44,_0x2e1057){_0x341c44=_0x341c44-0x0;var _0x2bda72=_0x11e5[_0x341c44];return _0x2bda72;};'use strict';var Sequelize=require(_0x511e('0x0'));module['exports']={'name':{'type':Sequelize[_0x511e('0x1')]},'description':{'type':Sequelize[_0x511e('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x511e('0x2')},'password':{'type':Sequelize[_0x511e('0x1')]},'token':{'type':Sequelize[_0x511e('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x511e('0x3')},'authType':{'type':Sequelize['ENUM']('password',_0x511e('0x4')),'defaultValue':_0x511e('0x5')},'serverUrl':{'type':Sequelize[_0x511e('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x511e('0x6')),'defaultValue':_0x511e('0x7')}}; \ No newline at end of file +var _0xdec3=['newTab','sequelize','STRING','remoteUri','password','token','ENUM','integrationTab'];(function(_0x238098,_0xc099cd){var _0x495bac=function(_0x3f43c6){while(--_0x3f43c6){_0x238098['push'](_0x238098['shift']());}};_0x495bac(++_0xc099cd);}(_0xdec3,0x89));var _0x3dec=function(_0x56bd4c,_0x3cd91d){_0x56bd4c=_0x56bd4c-0x0;var _0x462287=_0xdec3[_0x56bd4c];return _0x462287;};'use strict';var Sequelize=require(_0x3dec('0x0'));module['exports']={'name':{'type':Sequelize[_0x3dec('0x1')]},'description':{'type':Sequelize[_0x3dec('0x1')]},'username':{'type':Sequelize[_0x3dec('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x3dec('0x1')]},'token':{'type':Sequelize[_0x3dec('0x1')]},'remoteUri':{'type':Sequelize[_0x3dec('0x1')],'unique':_0x3dec('0x2')},'authType':{'type':Sequelize['ENUM'](_0x3dec('0x3'),_0x3dec('0x4')),'defaultValue':_0x3dec('0x3')},'serverUrl':{'type':Sequelize[_0x3dec('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3dec('0x5')](_0x3dec('0x6'),_0x3dec('0x7')),'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 03755a2..bf8351a 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 _0xd87e=['undefined','count','limit','set','Content-Range','reject','update','destroy','error','stack','name','index','ZendeskAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','include','findAll','then','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','order','pick','filter','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskConfiguration','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','headers','format','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','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/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x48b4a1,_0x3c2bf4){var _0x2df379=function(_0x5962c1){while(--_0x5962c1){_0x48b4a1['push'](_0x48b4a1['shift']());}};_0x2df379(++_0x3c2bf4);}(_0xd87e,0x1bf));var _0xed87=function(_0x3e4f74,_0x26ce71){_0x3e4f74=_0x3e4f74-0x0;var _0xd07d99=_0xd87e[_0x3e4f74];return _0xd07d99;};'use strict';var emlformat=require(_0xed87('0x0'));var rimraf=require(_0xed87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed87('0x2'));var rp=require(_0xed87('0x3'));var moment=require(_0xed87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed87('0x5'));var util=require('util');var path=require(_0xed87('0x6'));var sox=require(_0xed87('0x7'));var csv=require('to-csv');var ejs=require(_0xed87('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xed87('0x9'));var crypto=require(_0xed87('0xa'));var jsforce=require(_0xed87('0xb'));var deskjs=require(_0xed87('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed87('0xd'));var Papa=require(_0xed87('0xe'));var Redis=require(_0xed87('0xf'));var authService=require(_0xed87('0x10'));var qs=require(_0xed87('0x11'));var as=require(_0xed87('0x12'));var hardwareService=require(_0xed87('0x13'));var logger=require('../../config/logger')(_0xed87('0x14'));var utils=require(_0xed87('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xed87('0x16'));var db=require(_0xed87('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4ffc2d,_0x466f35){_0x466f35=_0x466f35||0xcc;return function(_0x32276e){if(_0x32276e){return _0x4ffc2d[_0xed87('0x18')](_0x466f35);}return _0x4ffc2d[_0xed87('0x19')](_0x466f35)[_0xed87('0x1a')]();};}function respondWithResult(_0x3865c5,_0x52dfe8){_0x52dfe8=_0x52dfe8||0xc8;return function(_0x4494da){if(_0x4494da){return _0x3865c5[_0xed87('0x19')](_0x52dfe8)[_0xed87('0x1b')](_0x4494da);}};}function respondWithFilteredResult(_0x1e9a3d,_0x2f2fd3){return function(_0xd34e0e){if(_0xd34e0e){var _0x173413=typeof _0x2f2fd3[_0xed87('0x1c')]===_0xed87('0x1d')&&typeof _0x2f2fd3['limit']===_0xed87('0x1d');var _0x18ab7d=_0xd34e0e[_0xed87('0x1e')];var _0xfb8a44=_0x173413?0x0:_0x2f2fd3['offset'];var _0x211085=_0x173413?_0xd34e0e[_0xed87('0x1e')]:_0x2f2fd3[_0xed87('0x1c')]+_0x2f2fd3[_0xed87('0x1f')];var _0x98a2ca;if(_0x211085>=_0x18ab7d){_0x211085=_0x18ab7d;_0x98a2ca=0xc8;}else{_0x98a2ca=0xce;}_0x1e9a3d[_0xed87('0x19')](_0x98a2ca);return _0x1e9a3d[_0xed87('0x20')](_0xed87('0x21'),_0xfb8a44+'-'+_0x211085+'/'+_0x18ab7d)[_0xed87('0x1b')](_0xd34e0e);}return null;};}function patchUpdates(_0x52e81c){return function(_0x5a7329){try{jsonpatch['apply'](_0x5a7329,_0x52e81c,!![]);}catch(_0x47c121){return BPromise[_0xed87('0x22')](_0x47c121);}return _0x5a7329['save']();};}function saveUpdates(_0x4191a7,_0x2b0b98){return function(_0x5b1659){if(_0x5b1659){return _0x5b1659[_0xed87('0x23')](_0x4191a7)['then'](function(_0x3d1641){return _0x3d1641;});}return null;};}function removeEntity(_0x24962e,_0x27799a){return function(_0x2a8733){if(_0x2a8733){return _0x2a8733[_0xed87('0x24')]()['then'](function(){_0x24962e[_0xed87('0x19')](0xcc)[_0xed87('0x1a')]();});}};}function handleEntityNotFound(_0x41e0d4,_0x320bcc){return function(_0x31c600){if(!_0x31c600){_0x41e0d4[_0xed87('0x18')](0x194);}return _0x31c600;};}function handleError(_0x25a6f7,_0x4735b3){_0x4735b3=_0x4735b3||0x1f4;return function(_0x40b2fa){logger[_0xed87('0x25')](_0x40b2fa[_0xed87('0x26')]);if(_0x40b2fa[_0xed87('0x27')]){delete _0x40b2fa[_0xed87('0x27')];}_0x25a6f7[_0xed87('0x19')](_0x4735b3)['send'](_0x40b2fa);};}exports[_0xed87('0x28')]=function(_0x1c4a65,_0x4eaa44){var _0x3dff74={},_0x33c367={},_0x21c93b={'count':0x0,'rows':[]};var _0x4b259e=_['map'](db[_0xed87('0x29')][_0xed87('0x2a')],function(_0x21ab8a){return{'name':_0x21ab8a['fieldName'],'type':_0x21ab8a[_0xed87('0x2b')][_0xed87('0x2c')]};});_0x33c367[_0xed87('0x2d')]=_[_0xed87('0x2e')](_0x4b259e,_0xed87('0x27'));_0x33c367[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x1c4a65[_0xed87('0x2f')]);_0x33c367[_0xed87('0x31')]=_['intersection'](_0x33c367[_0xed87('0x2d')],_0x33c367[_0xed87('0x2f')]);_0x3dff74['attributes']=_[_0xed87('0x32')](_0x33c367['model'],qs[_0xed87('0x33')](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x33')]));_0x3dff74[_0xed87('0x34')]=_0x3dff74[_0xed87('0x34')][_0xed87('0x35')]?_0x3dff74[_0xed87('0x34')]:_0x33c367[_0xed87('0x2d')];if(!_0x1c4a65[_0xed87('0x2f')][_0xed87('0x36')](_0xed87('0x37'))){_0x3dff74['limit']=qs[_0xed87('0x1f')](_0x1c4a65[_0xed87('0x2f')]['limit']);_0x3dff74[_0xed87('0x1c')]=qs['offset'](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x1c')]);}_0x3dff74['order']=qs[_0xed87('0x38')](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x38')]);_0x3dff74[_0xed87('0x39')]=qs[_0xed87('0x31')](_['pick'](_0x1c4a65[_0xed87('0x2f')],_0x33c367['filters']),_0x4b259e);if(_0x1c4a65[_0xed87('0x2f')]['filter']){_0x3dff74[_0xed87('0x39')]=_[_0xed87('0x3a')](_0x3dff74[_0xed87('0x39')],{'$or':_[_0xed87('0x2e')](_0x4b259e,function(_0x319f69){if(_0x319f69[_0xed87('0x2b')]!==_0xed87('0x3b')){var _0x161491={};_0x161491[_0x319f69[_0xed87('0x27')]]={'$like':'%'+_0x1c4a65['query']['filter']+'%'};return _0x161491;}})});}_0x3dff74=_[_0xed87('0x3a')]({},_0x3dff74,_0x1c4a65[_0xed87('0x3c')]);var _0x1f16a8={'where':_0x3dff74[_0xed87('0x39')]};return db[_0xed87('0x29')][_0xed87('0x1e')](_0x1f16a8)['then'](function(_0x4398a0){_0x21c93b[_0xed87('0x1e')]=_0x4398a0;if(_0x1c4a65[_0xed87('0x2f')]['includeAll']){_0x3dff74[_0xed87('0x3d')]=[{'all':!![]}];}return db[_0xed87('0x29')][_0xed87('0x3e')](_0x3dff74);})[_0xed87('0x3f')](function(_0x1d1e99){_0x21c93b[_0xed87('0x40')]=_0x1d1e99;return _0x21c93b;})[_0xed87('0x3f')](respondWithFilteredResult(_0x4eaa44,_0x3dff74))[_0xed87('0x41')](handleError(_0x4eaa44,null));};exports[_0xed87('0x42')]=function(_0x406b73,_0x5c6925){var _0x7e6cbb={'raw':![],'where':{'id':_0x406b73[_0xed87('0x43')]['id']}},_0x3c7fcc={};_0x3c7fcc['model']=_['keys'](db[_0xed87('0x29')][_0xed87('0x2a')]);_0x3c7fcc[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x406b73['query']);_0x3c7fcc[_0xed87('0x31')]=_[_0xed87('0x32')](_0x3c7fcc['model'],_0x3c7fcc[_0xed87('0x2f')]);_0x7e6cbb[_0xed87('0x34')]=_[_0xed87('0x32')](_0x3c7fcc[_0xed87('0x2d')],qs[_0xed87('0x33')](_0x406b73[_0xed87('0x2f')][_0xed87('0x33')]));_0x7e6cbb[_0xed87('0x34')]=_0x7e6cbb[_0xed87('0x34')][_0xed87('0x35')]?_0x7e6cbb[_0xed87('0x34')]:_0x3c7fcc['model'];if(_0x406b73[_0xed87('0x2f')][_0xed87('0x44')]){_0x7e6cbb[_0xed87('0x3d')]=[{'all':!![]}];}_0x7e6cbb=_[_0xed87('0x3a')]({},_0x7e6cbb,_0x406b73[_0xed87('0x3c')]);return db[_0xed87('0x29')][_0xed87('0x45')](_0x7e6cbb)[_0xed87('0x3f')](handleEntityNotFound(_0x5c6925,null))[_0xed87('0x3f')](respondWithResult(_0x5c6925,null))[_0xed87('0x41')](handleError(_0x5c6925,null));};exports[_0xed87('0x46')]=function(_0x26c8f4,_0x27ed22){return db[_0xed87('0x29')][_0xed87('0x46')](_0x26c8f4[_0xed87('0x47')],{})[_0xed87('0x3f')](respondWithResult(_0x27ed22,0xc9))['catch'](handleError(_0x27ed22,null));};exports[_0xed87('0x23')]=function(_0x1a68a7,_0x3a91c5){if(_0x1a68a7['body']['id']){delete _0x1a68a7[_0xed87('0x47')]['id'];}return db[_0xed87('0x29')]['find']({'where':{'id':_0x1a68a7[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x3a91c5,null))[_0xed87('0x3f')](saveUpdates(_0x1a68a7[_0xed87('0x47')],null))['then'](respondWithResult(_0x3a91c5,null))[_0xed87('0x41')](handleError(_0x3a91c5,null));};exports[_0xed87('0x24')]=function(_0x3ca34c,_0x272a07){return db[_0xed87('0x29')][_0xed87('0x45')]({'where':{'id':_0x3ca34c[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x272a07,null))[_0xed87('0x3f')](removeEntity(_0x272a07,null))[_0xed87('0x41')](handleError(_0x272a07,null));};exports[_0xed87('0x48')]=function(_0x18846f,_0x2e5a9f,_0x4df105){var _0x43ffa4={};var _0x4ea4e3={};var _0x17cad7;var _0x329973;return db[_0xed87('0x29')][_0xed87('0x49')]({'where':{'id':_0x18846f[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x2e5a9f,null))[_0xed87('0x3f')](function(_0xccdbb6){if(_0xccdbb6){_0x17cad7=_0xccdbb6;_0x4ea4e3[_0xed87('0x2d')]=_[_0xed87('0x30')](db['ZendeskConfiguration'][_0xed87('0x2a')]);_0x4ea4e3[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x18846f[_0xed87('0x2f')]);_0x4ea4e3[_0xed87('0x31')]=_[_0xed87('0x32')](_0x4ea4e3[_0xed87('0x2d')],_0x4ea4e3[_0xed87('0x2f')]);_0x43ffa4[_0xed87('0x34')]=_[_0xed87('0x32')](_0x4ea4e3[_0xed87('0x2d')],qs['fields'](_0x18846f['query'][_0xed87('0x33')]));_0x43ffa4[_0xed87('0x34')]=_0x43ffa4[_0xed87('0x34')][_0xed87('0x35')]?_0x43ffa4[_0xed87('0x34')]:_0x4ea4e3['model'];_0x43ffa4[_0xed87('0x4a')]=qs[_0xed87('0x38')](_0x18846f[_0xed87('0x2f')][_0xed87('0x38')]);_0x43ffa4[_0xed87('0x39')]=qs[_0xed87('0x31')](_[_0xed87('0x4b')](_0x18846f[_0xed87('0x2f')],_0x4ea4e3[_0xed87('0x31')]));if(_0x18846f[_0xed87('0x2f')][_0xed87('0x4c')]){_0x43ffa4[_0xed87('0x39')]=_[_0xed87('0x3a')](_0x43ffa4[_0xed87('0x39')],{'$or':_['map'](_0x43ffa4[_0xed87('0x34')],function(_0x10a19c){var _0x2f03d4={};_0x2f03d4[_0x10a19c]={'$like':'%'+_0x18846f[_0xed87('0x2f')][_0xed87('0x4c')]+'%'};return _0x2f03d4;})});}_0x43ffa4=_[_0xed87('0x3a')]({},_0x43ffa4,_0x18846f[_0xed87('0x3c')]);return _0x17cad7[_0xed87('0x48')](_0x43ffa4);}})['then'](function(_0x4367c3){if(_0x4367c3){_0x329973=_0x4367c3[_0xed87('0x35')];if(!_0x18846f[_0xed87('0x2f')][_0xed87('0x36')](_0xed87('0x37'))){_0x43ffa4[_0xed87('0x1f')]=qs['limit'](_0x18846f['query'][_0xed87('0x1f')]);_0x43ffa4[_0xed87('0x1c')]=qs[_0xed87('0x1c')](_0x18846f[_0xed87('0x2f')][_0xed87('0x1c')]);}return _0x17cad7[_0xed87('0x48')](_0x43ffa4);}})[_0xed87('0x3f')](function(_0x3bdf7c){if(_0x3bdf7c){return _0x3bdf7c?{'count':_0x329973,'rows':_0x3bdf7c}:null;}})['then'](respondWithResult(_0x2e5a9f,null))[_0xed87('0x41')](handleError(_0x2e5a9f,null));};exports['addConfiguration']=function(_0xd3b300,_0x3c82de,_0x4e5055){if(_0xd3b300[_0xed87('0x47')]['id']){delete _0xd3b300[_0xed87('0x47')]['id'];}return db['ZendeskAccount'][_0xed87('0x49')]({'where':{'id':_0xd3b300[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x3c82de,null))[_0xed87('0x3f')](function(_0x112685){if(_0x112685){_0xd3b300['body'][_0xed87('0x4d')]=_0x112685['id'];_0xd3b300[_0xed87('0x47')][_0xed87('0x4e')]=integrations[_0xed87('0x4f')](_0xd3b300['body']['channel'],_0xd3b300[_0xed87('0x47')][_0xed87('0x2b')]);_0xd3b300['body'][_0xed87('0x50')]=integrations[_0xed87('0x51')](_0xd3b300[_0xed87('0x47')][_0xed87('0x52')],_0xd3b300[_0xed87('0x47')][_0xed87('0x2b')]);return db[_0xed87('0x53')][_0xed87('0x46')](_0xd3b300[_0xed87('0x47')],{'include':[{'model':db[_0xed87('0x54')],'as':_0xed87('0x4e')},{'model':db[_0xed87('0x54')],'as':_0xed87('0x50')}]});}return null;})[_0xed87('0x3f')](respondWithResult(_0x3c82de,null))['catch'](handleError(_0x3c82de,null));};exports[_0xed87('0x55')]=function(_0x2686cd,_0x566ace,_0x4f7b92){var _0x5136c9='';return db[_0xed87('0x29')][_0xed87('0x49')]({'where':{'id':_0x2686cd[_0xed87('0x43')]['id']},'attributes':['id',_0xed87('0x56'),_0xed87('0x57'),_0xed87('0x58'),_0xed87('0x59'),'remoteUri']})[_0xed87('0x3f')](handleEntityNotFound(_0x566ace,null))[_0xed87('0x3f')](function(_0x3b6a9b){if(_0x3b6a9b){_0x5136c9=_0x3b6a9b[_0xed87('0x5a')];var _0xc35cab=_0x5136c9[_0xed87('0x5b')](-0x1);if(_0xc35cab==='/'){_0x5136c9=_0x5136c9[_0xed87('0x5c')](0x0,_0x5136c9[_0xed87('0x5d')](_0xc35cab));}var _0x116198={'method':_0xed87('0x5e'),'uri':util['format']('%s/%s',_0x5136c9,'ticket_fields'),'json':!![]};switch(_0x3b6a9b[_0xed87('0x59')]){case _0xed87('0x57'):_0x116198[_0xed87('0x5f')]={'Authorization':util[_0xed87('0x60')](_0xed87('0x61'),new Buffer(util['format'](_0xed87('0x62'),_0x3b6a9b[_0xed87('0x56')],_0x3b6a9b[_0xed87('0x57')]))[_0xed87('0x63')](_0xed87('0x64')))};break;case _0xed87('0x58'):_0x116198['headers']={'Authorization':util['format'](_0xed87('0x61'),new Buffer(util[_0xed87('0x60')](_0xed87('0x65'),_0x3b6a9b[_0xed87('0x56')],_0x3b6a9b[_0xed87('0x58')]))[_0xed87('0x63')](_0xed87('0x64')))};break;default:throw new db[(_0xed87('0x66'))][(_0xed87('0x67'))](_0xed87('0x68'));}return rp(_0x116198);}})[_0xed87('0x3f')](function(_0x1a1f95){if(_0x1a1f95){var _0x52af5c=[_0xed87('0x69'),_0xed87('0x6a'),_0xed87('0x6b'),_0xed87('0x6c')];_[_0xed87('0x6d')](_0x1a1f95[_0xed87('0x6e')],function(_0x4ae84c){return _0x52af5c[_0xed87('0x6f')](_0x4ae84c[_0xed87('0x2b')]);});return{'count':_0x1a1f95[_0xed87('0x6e')][_0xed87('0x35')],'rows':_['map'](_0x1a1f95['ticket_fields'],function(_0x4bfca0){return{'id':_0x4bfca0['id'],'name':_0x4bfca0['position']>0x7?_0x4bfca0['title']:_0x4bfca0[_0xed87('0x2b')],'custom':_0x4bfca0[_0xed87('0x70')]>0x7?!![]:![],'options':_0x4bfca0[_0xed87('0x71')]?_0x4bfca0[_0xed87('0x71')]:_0x4bfca0[_0xed87('0x72')]?_0x4bfca0[_0xed87('0x72')]:[]};})};}})[_0xed87('0x3f')](respondWithResult(_0x566ace,null))[_0xed87('0x41')](function(_0x1b223b){var _0x510066=_0x2686cd['query'][_0xed87('0x73')]?0x1f4:_0x1b223b[_0xed87('0x74')]||0x1f4;logger[_0xed87('0x25')](_0xed87('0x75'),_0xed87('0x55'),_0x510066,JSON['stringify'](_0x1b223b));delete _0x1b223b['name'];if(_0x510066===0x191){_0x510066=0x190;}_0x566ace[_0xed87('0x19')](_0x510066)[_0xed87('0x76')](_0x2686cd['query'][_0xed87('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x1b223b[_0xed87('0x74')]}:_0x1b223b);});}; \ No newline at end of file +var _0x757a=['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','../../config/license/hardware','../../config/logger','api','sendStatus','status','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','error','name','ZendeskAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','getConfigurations','findOne','ZendeskConfiguration','nolimit','AccountId','getSubjects','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','username','password','authType','remoteUri','slice','substring','lastIndexOf','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','token','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials'];(function(_0x3238ea,_0x91809d){var _0x4aaac2=function(_0xc5b102){while(--_0xc5b102){_0x3238ea['push'](_0x3238ea['shift']());}};_0x4aaac2(++_0x91809d);}(_0x757a,0xde));var _0xa757=function(_0x477eda,_0x1140d0){_0x477eda=_0x477eda-0x0;var _0x3cc690=_0x757a[_0x477eda];return _0x3cc690;};'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'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x421040,_0x544b45){_0x544b45=_0x544b45||0xcc;return function(_0x564187){if(_0x564187){return _0x421040[_0xa757('0x15')](_0x544b45);}return _0x421040['status'](_0x544b45)['end']();};}function respondWithResult(_0x32112b,_0x1b670e){_0x1b670e=_0x1b670e||0xc8;return function(_0x355f0a){if(_0x355f0a){return _0x32112b[_0xa757('0x16')](_0x1b670e)[_0xa757('0x17')](_0x355f0a);}};}function respondWithFilteredResult(_0x31cfd2,_0xf12b68){return function(_0x2f7947){if(_0x2f7947){var _0x185011=typeof _0xf12b68[_0xa757('0x18')]==='undefined'&&typeof _0xf12b68[_0xa757('0x19')]===_0xa757('0x1a');var _0xde8248=_0x2f7947['count'];var _0x54b305=_0x185011?0x0:_0xf12b68[_0xa757('0x18')];var _0x468d45=_0x185011?_0x2f7947[_0xa757('0x1b')]:_0xf12b68[_0xa757('0x18')]+_0xf12b68[_0xa757('0x19')];var _0xe2d567;if(_0x468d45>=_0xde8248){_0x468d45=_0xde8248;_0xe2d567=0xc8;}else{_0xe2d567=0xce;}_0x31cfd2['status'](_0xe2d567);return _0x31cfd2[_0xa757('0x1c')]('Content-Range',_0x54b305+'-'+_0x468d45+'/'+_0xde8248)[_0xa757('0x17')](_0x2f7947);}return null;};}function patchUpdates(_0x167640){return function(_0x14014c){try{jsonpatch[_0xa757('0x1d')](_0x14014c,_0x167640,!![]);}catch(_0x4d598c){return BPromise['reject'](_0x4d598c);}return _0x14014c[_0xa757('0x1e')]();};}function saveUpdates(_0x2159cf,_0x2ba923){return function(_0x8d121f){if(_0x8d121f){return _0x8d121f[_0xa757('0x1f')](_0x2159cf)[_0xa757('0x20')](function(_0x2ca10d){return _0x2ca10d;});}return null;};}function removeEntity(_0x21f1af,_0x2bf276){return function(_0x59fae6){if(_0x59fae6){return _0x59fae6[_0xa757('0x21')]()['then'](function(){_0x21f1af[_0xa757('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40551d,_0x3859ce){return function(_0x37c7e6){if(!_0x37c7e6){_0x40551d['sendStatus'](0x194);}return _0x37c7e6;};}function handleError(_0x2b19d5,_0xcd98bd){_0xcd98bd=_0xcd98bd||0x1f4;return function(_0x471e84){logger[_0xa757('0x22')](_0x471e84['stack']);if(_0x471e84[_0xa757('0x23')]){delete _0x471e84['name'];}_0x2b19d5['status'](_0xcd98bd)['send'](_0x471e84);};}exports['index']=function(_0xfdf69d,_0x596ae2){var _0x2208f9={},_0x3bc24c={},_0x55c5f8={'count':0x0,'rows':[]};var _0x2a0c9a=_['map'](db[_0xa757('0x24')][_0xa757('0x25')],function(_0x5307c3){return{'name':_0x5307c3[_0xa757('0x26')],'type':_0x5307c3['type'][_0xa757('0x27')]};});_0x3bc24c[_0xa757('0x28')]=_[_0xa757('0x29')](_0x2a0c9a,_0xa757('0x23'));_0x3bc24c[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0xfdf69d[_0xa757('0x2a')]);_0x3bc24c[_0xa757('0x2c')]=_[_0xa757('0x2d')](_0x3bc24c[_0xa757('0x28')],_0x3bc24c[_0xa757('0x2a')]);_0x2208f9[_0xa757('0x2e')]=_[_0xa757('0x2d')](_0x3bc24c[_0xa757('0x28')],qs[_0xa757('0x2f')](_0xfdf69d[_0xa757('0x2a')][_0xa757('0x2f')]));_0x2208f9[_0xa757('0x2e')]=_0x2208f9[_0xa757('0x2e')][_0xa757('0x30')]?_0x2208f9[_0xa757('0x2e')]:_0x3bc24c[_0xa757('0x28')];if(!_0xfdf69d[_0xa757('0x2a')][_0xa757('0x31')]('nolimit')){_0x2208f9[_0xa757('0x19')]=qs[_0xa757('0x19')](_0xfdf69d[_0xa757('0x2a')][_0xa757('0x19')]);_0x2208f9[_0xa757('0x18')]=qs['offset'](_0xfdf69d[_0xa757('0x2a')][_0xa757('0x18')]);}_0x2208f9[_0xa757('0x32')]=qs[_0xa757('0x33')](_0xfdf69d[_0xa757('0x2a')][_0xa757('0x33')]);_0x2208f9['where']=qs[_0xa757('0x2c')](_[_0xa757('0x34')](_0xfdf69d[_0xa757('0x2a')],_0x3bc24c[_0xa757('0x2c')]),_0x2a0c9a);if(_0xfdf69d[_0xa757('0x2a')][_0xa757('0x35')]){_0x2208f9[_0xa757('0x36')]=_[_0xa757('0x37')](_0x2208f9[_0xa757('0x36')],{'$or':_['map'](_0x2a0c9a,function(_0x300be4){if(_0x300be4[_0xa757('0x38')]!==_0xa757('0x39')){var _0x35c15a={};_0x35c15a[_0x300be4[_0xa757('0x23')]]={'$like':'%'+_0xfdf69d[_0xa757('0x2a')]['filter']+'%'};return _0x35c15a;}})});}_0x2208f9=_[_0xa757('0x37')]({},_0x2208f9,_0xfdf69d[_0xa757('0x3a')]);var _0x48cde9={'where':_0x2208f9['where']};return db[_0xa757('0x24')][_0xa757('0x1b')](_0x48cde9)['then'](function(_0x51c3d1){_0x55c5f8[_0xa757('0x1b')]=_0x51c3d1;if(_0xfdf69d[_0xa757('0x2a')][_0xa757('0x3b')]){_0x2208f9['include']=[{'all':!![]}];}return db[_0xa757('0x24')][_0xa757('0x3c')](_0x2208f9);})[_0xa757('0x20')](function(_0x1ba399){_0x55c5f8[_0xa757('0x3d')]=_0x1ba399;return _0x55c5f8;})['then'](respondWithFilteredResult(_0x596ae2,_0x2208f9))[_0xa757('0x3e')](handleError(_0x596ae2,null));};exports['show']=function(_0x564d40,_0x43329c){var _0x57298b={'raw':![],'where':{'id':_0x564d40[_0xa757('0x3f')]['id']}},_0x373747={};_0x373747[_0xa757('0x28')]=_['keys'](db['ZendeskAccount'][_0xa757('0x25')]);_0x373747[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0x564d40[_0xa757('0x2a')]);_0x373747[_0xa757('0x2c')]=_[_0xa757('0x2d')](_0x373747['model'],_0x373747[_0xa757('0x2a')]);_0x57298b[_0xa757('0x2e')]=_['intersection'](_0x373747[_0xa757('0x28')],qs['fields'](_0x564d40[_0xa757('0x2a')][_0xa757('0x2f')]));_0x57298b['attributes']=_0x57298b[_0xa757('0x2e')][_0xa757('0x30')]?_0x57298b['attributes']:_0x373747[_0xa757('0x28')];if(_0x564d40[_0xa757('0x2a')][_0xa757('0x3b')]){_0x57298b[_0xa757('0x40')]=[{'all':!![]}];}_0x57298b=_['merge']({},_0x57298b,_0x564d40[_0xa757('0x3a')]);return db[_0xa757('0x24')][_0xa757('0x41')](_0x57298b)[_0xa757('0x20')](handleEntityNotFound(_0x43329c,null))['then'](respondWithResult(_0x43329c,null))[_0xa757('0x3e')](handleError(_0x43329c,null));};exports['create']=function(_0x50c131,_0x2acf88){return db[_0xa757('0x24')][_0xa757('0x42')](_0x50c131['body'],{})[_0xa757('0x20')](respondWithResult(_0x2acf88,0xc9))['catch'](handleError(_0x2acf88,null));};exports[_0xa757('0x1f')]=function(_0x151cc3,_0x265793){if(_0x151cc3[_0xa757('0x43')]['id']){delete _0x151cc3[_0xa757('0x43')]['id'];}return db[_0xa757('0x24')][_0xa757('0x41')]({'where':{'id':_0x151cc3[_0xa757('0x3f')]['id']}})['then'](handleEntityNotFound(_0x265793,null))[_0xa757('0x20')](saveUpdates(_0x151cc3[_0xa757('0x43')],null))[_0xa757('0x20')](respondWithResult(_0x265793,null))[_0xa757('0x3e')](handleError(_0x265793,null));};exports[_0xa757('0x21')]=function(_0x1f10cf,_0x15bad7){return db[_0xa757('0x24')][_0xa757('0x41')]({'where':{'id':_0x1f10cf[_0xa757('0x3f')]['id']}})[_0xa757('0x20')](handleEntityNotFound(_0x15bad7,null))[_0xa757('0x20')](removeEntity(_0x15bad7,null))[_0xa757('0x3e')](handleError(_0x15bad7,null));};exports[_0xa757('0x44')]=function(_0x388573,_0x23caca,_0x492e7e){var _0x3b5116={};var _0x51157e={};var _0x48af6e;var _0x311c25;return db[_0xa757('0x24')][_0xa757('0x45')]({'where':{'id':_0x388573['params']['id']}})[_0xa757('0x20')](handleEntityNotFound(_0x23caca,null))[_0xa757('0x20')](function(_0x8614f9){if(_0x8614f9){_0x48af6e=_0x8614f9;_0x51157e[_0xa757('0x28')]=_['keys'](db[_0xa757('0x46')][_0xa757('0x25')]);_0x51157e[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0x388573[_0xa757('0x2a')]);_0x51157e[_0xa757('0x2c')]=_['intersection'](_0x51157e['model'],_0x51157e['query']);_0x3b5116['attributes']=_[_0xa757('0x2d')](_0x51157e[_0xa757('0x28')],qs[_0xa757('0x2f')](_0x388573[_0xa757('0x2a')][_0xa757('0x2f')]));_0x3b5116[_0xa757('0x2e')]=_0x3b5116['attributes'][_0xa757('0x30')]?_0x3b5116[_0xa757('0x2e')]:_0x51157e[_0xa757('0x28')];_0x3b5116[_0xa757('0x32')]=qs['sort'](_0x388573[_0xa757('0x2a')][_0xa757('0x33')]);_0x3b5116['where']=qs[_0xa757('0x2c')](_['pick'](_0x388573[_0xa757('0x2a')],_0x51157e['filters']));if(_0x388573[_0xa757('0x2a')]['filter']){_0x3b5116['where']=_[_0xa757('0x37')](_0x3b5116[_0xa757('0x36')],{'$or':_[_0xa757('0x29')](_0x3b5116[_0xa757('0x2e')],function(_0x14e226){var _0xc5ae37={};_0xc5ae37[_0x14e226]={'$like':'%'+_0x388573['query']['filter']+'%'};return _0xc5ae37;})});}_0x3b5116=_[_0xa757('0x37')]({},_0x3b5116,_0x388573[_0xa757('0x3a')]);return _0x48af6e[_0xa757('0x44')](_0x3b5116);}})['then'](function(_0x55a7d2){if(_0x55a7d2){_0x311c25=_0x55a7d2[_0xa757('0x30')];if(!_0x388573[_0xa757('0x2a')][_0xa757('0x31')](_0xa757('0x47'))){_0x3b5116[_0xa757('0x19')]=qs[_0xa757('0x19')](_0x388573['query'][_0xa757('0x19')]);_0x3b5116[_0xa757('0x18')]=qs[_0xa757('0x18')](_0x388573[_0xa757('0x2a')][_0xa757('0x18')]);}return _0x48af6e[_0xa757('0x44')](_0x3b5116);}})[_0xa757('0x20')](function(_0x13dd81){if(_0x13dd81){return _0x13dd81?{'count':_0x311c25,'rows':_0x13dd81}:null;}})[_0xa757('0x20')](respondWithResult(_0x23caca,null))[_0xa757('0x3e')](handleError(_0x23caca,null));};exports['addConfiguration']=function(_0x9e96e6,_0x5c803a,_0x5851fd){if(_0x9e96e6[_0xa757('0x43')]['id']){delete _0x9e96e6[_0xa757('0x43')]['id'];}return db[_0xa757('0x24')][_0xa757('0x45')]({'where':{'id':_0x9e96e6[_0xa757('0x3f')]['id']}})[_0xa757('0x20')](handleEntityNotFound(_0x5c803a,null))[_0xa757('0x20')](function(_0x32e0b9){if(_0x32e0b9){_0x9e96e6[_0xa757('0x43')][_0xa757('0x48')]=_0x32e0b9['id'];_0x9e96e6[_0xa757('0x43')]['Subjects']=integrations[_0xa757('0x49')](_0x9e96e6[_0xa757('0x43')]['channel'],_0x9e96e6[_0xa757('0x43')][_0xa757('0x38')]);_0x9e96e6[_0xa757('0x43')][_0xa757('0x4a')]=integrations[_0xa757('0x4b')](_0x9e96e6[_0xa757('0x43')]['channel'],_0x9e96e6[_0xa757('0x43')]['type']);return db[_0xa757('0x46')][_0xa757('0x42')](_0x9e96e6[_0xa757('0x43')],{'include':[{'model':db[_0xa757('0x4c')],'as':_0xa757('0x4d')},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0xa757('0x20')](respondWithResult(_0x5c803a,null))[_0xa757('0x3e')](handleError(_0x5c803a,null));};exports[_0xa757('0x4e')]=function(_0x5f450f,_0x115a94,_0x55bc0f){var _0x34982a='';return db[_0xa757('0x24')][_0xa757('0x45')]({'where':{'id':_0x5f450f[_0xa757('0x3f')]['id']},'attributes':['id',_0xa757('0x4f'),_0xa757('0x50'),'token',_0xa757('0x51'),_0xa757('0x52')]})[_0xa757('0x20')](handleEntityNotFound(_0x115a94,null))[_0xa757('0x20')](function(_0x1c35bc){if(_0x1c35bc){_0x34982a=_0x1c35bc['remoteUri'];var _0x2586f9=_0x34982a[_0xa757('0x53')](-0x1);if(_0x2586f9==='/'){_0x34982a=_0x34982a[_0xa757('0x54')](0x0,_0x34982a[_0xa757('0x55')](_0x2586f9));}var _0x43cc0a={'method':'GET','uri':util[_0xa757('0x56')](_0xa757('0x57'),_0x34982a,_0xa757('0x58')),'json':!![]};switch(_0x1c35bc['authType']){case _0xa757('0x50'):_0x43cc0a[_0xa757('0x59')]={'Authorization':util[_0xa757('0x56')](_0xa757('0x5a'),new Buffer(util[_0xa757('0x56')](_0xa757('0x5b'),_0x1c35bc[_0xa757('0x4f')],_0x1c35bc[_0xa757('0x50')]))[_0xa757('0x5c')](_0xa757('0x5d')))};break;case _0xa757('0x5e'):_0x43cc0a[_0xa757('0x59')]={'Authorization':util[_0xa757('0x56')](_0xa757('0x5a'),new Buffer(util['format'](_0xa757('0x5f'),_0x1c35bc[_0xa757('0x4f')],_0x1c35bc['token']))[_0xa757('0x5c')](_0xa757('0x5d')))};break;default:throw new db['Sequelize'][(_0xa757('0x60'))](_0xa757('0x61'));}return rp(_0x43cc0a);}})[_0xa757('0x20')](function(_0x2e1198){if(_0x2e1198){var _0x3a00ef=[_0xa757('0x62'),_0xa757('0x63'),_0xa757('0x64'),_0xa757('0x65')];_[_0xa757('0x66')](_0x2e1198[_0xa757('0x58')],function(_0x189195){return _0x3a00ef[_0xa757('0x67')](_0x189195[_0xa757('0x38')]);});return{'count':_0x2e1198[_0xa757('0x58')][_0xa757('0x30')],'rows':_['map'](_0x2e1198[_0xa757('0x58')],function(_0x56ba75){return{'id':_0x56ba75['id'],'name':_0x56ba75[_0xa757('0x68')]>0x7?_0x56ba75[_0xa757('0x69')]:_0x56ba75[_0xa757('0x38')],'custom':_0x56ba75[_0xa757('0x68')]>0x7?!![]:![],'options':_0x56ba75[_0xa757('0x6a')]?_0x56ba75['system_field_options']:_0x56ba75[_0xa757('0x6b')]?_0x56ba75[_0xa757('0x6b')]:[]};})};}})[_0xa757('0x20')](respondWithResult(_0x115a94,null))['catch'](function(_0x3317d8){var _0x3619ec=_0x5f450f[_0xa757('0x2a')]['test']?0x1f4:_0x3317d8['statusCode']||0x1f4;logger[_0xa757('0x22')](_0xa757('0x6c'),_0xa757('0x4e'),_0x3619ec,JSON['stringify'](_0x3317d8));delete _0x3317d8[_0xa757('0x23')];if(_0x3619ec===0x191){_0x3619ec=0x190;}_0x115a94['status'](_0x3619ec)['send'](_0x5f450f[_0xa757('0x2a')][_0xa757('0x6d')]?{'message':_0xa757('0x6e'),'statusCode':_0x3317d8['statusCode']}:_0x3317d8);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 20e1fd6..579a7e0 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 _0x7dcd=['int_zendesk_accounts','api','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','ZendeskAccount'];(function(_0x233cb1,_0x8ca9a2){var _0x29ee7e=function(_0x20e277){while(--_0x20e277){_0x233cb1['push'](_0x233cb1['shift']());}};_0x29ee7e(++_0x8ca9a2);}(_0x7dcd,0xe2));var _0xd7dc=function(_0x56c313,_0x4acb15){_0x56c313=_0x56c313-0x0;var _0x12987d=_0x7dcd[_0x56c313];return _0x12987d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd7dc('0x0'));var moment=require(_0xd7dc('0x1'));var BPromise=require(_0xd7dc('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd7dc('0x3'));var rimraf=require(_0xd7dc('0x4'));var config=require(_0xd7dc('0x5'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xd7dc('0x6'));module['exports']=function(_0x1d1c44,_0x4c7ebc){return _0x1d1c44['define'](_0xd7dc('0x7'),attributes,{'tableName':_0xd7dc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3e7=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash'];(function(_0x53e5ca,_0x3742a1){var _0x5926c5=function(_0x2cd9a2){while(--_0x2cd9a2){_0x53e5ca['push'](_0x53e5ca['shift']());}};_0x5926c5(++_0x3742a1);}(_0xd3e7,0xe3));var _0x7d3e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd3e7[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7d3e('0x0'));var util=require('util');var logger=require(_0x7d3e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7d3e('0x2'));var rp=require(_0x7d3e('0x3'));var fs=require('fs');var path=require(_0x7d3e('0x4'));var rimraf=require(_0x7d3e('0x5'));var config=require(_0x7d3e('0x6'));var attributes=require(_0x7d3e('0x7'));var integrations=require(_0x7d3e('0x8'));module[_0x7d3e('0x9')]=function(_0x506bf,_0xe3fb9c){return _0x506bf[_0x7d3e('0xa')](_0x7d3e('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 7ec7835..4968f71 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 _0xd442=['code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','include','map','model','attributes','ShowZendeskAccount','find','where','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x20e51b,_0x3e9eb6){var _0x4e12a8=function(_0x271b0d){while(--_0x271b0d){_0x20e51b['push'](_0x20e51b['shift']());}};_0x4e12a8(++_0x3e9eb6);}(_0xd442,0x1b5));var _0x2d44=function(_0x19da1b,_0x1ac657){_0x19da1b=_0x19da1b-0x0;var _0x14c942=_0xd442[_0x19da1b];return _0x14c942;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2d44('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d44('0x1'));var db=require(_0x2d44('0x2'))['db'];var utils=require(_0x2d44('0x3'));var logger=require(_0x2d44('0x4'))(_0x2d44('0x5'));var config=require(_0x2d44('0x6'));var jayson=require(_0x2d44('0x7'));var client=jayson[_0x2d44('0x8')][_0x2d44('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x307323,_0x47f26d,_0x444062){return new BPromise(function(_0x86211f,_0xefd015){return client[_0x2d44('0xa')](_0x307323,_0x444062)[_0x2d44('0xb')](function(_0x34c7cd){logger[_0x2d44('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x47f26d,_0x2d44('0xd'));logger[_0x2d44('0xe')](_0x2d44('0xf'),_0x47f26d,'request\x20sent',JSON[_0x2d44('0x10')](_0x34c7cd));if(_0x34c7cd[_0x2d44('0x11')]){if(_0x34c7cd[_0x2d44('0x11')][_0x2d44('0x12')]===0x1f4){logger['error'](_0x2d44('0x13'),_0x47f26d,_0x34c7cd[_0x2d44('0x11')]['message']);return _0xefd015(_0x34c7cd[_0x2d44('0x11')][_0x2d44('0x14')]);}logger[_0x2d44('0x11')](_0x2d44('0x13'),_0x47f26d,_0x34c7cd[_0x2d44('0x11')][_0x2d44('0x14')]);return _0x86211f(_0x34c7cd['error'][_0x2d44('0x14')]);}else{logger[_0x2d44('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x47f26d,'request\x20sent');_0x86211f(_0x34c7cd[_0x2d44('0x15')][_0x2d44('0x14')]);}})[_0x2d44('0x16')](function(_0x2ec9b2){logger[_0x2d44('0x11')](_0x2d44('0x13'),_0x47f26d,_0x2ec9b2);_0xefd015(_0x2ec9b2);});});}exports[_0x2d44('0x17')]=function(_0x52bdff){var _0x452607=this;return new Promise(function(_0x207f2a,_0x293d1c){return db[_0x2d44('0x18')][_0x2d44('0x19')]({'raw':_0x52bdff['options']?_0x52bdff[_0x2d44('0x1a')][_0x2d44('0x1b')]===undefined?!![]:![]:!![],'where':_0x52bdff[_0x2d44('0x1a')]?_0x52bdff['options']['where']||null:null,'attributes':_0x52bdff[_0x2d44('0x1a')]?_0x52bdff[_0x2d44('0x1a')]['attributes']||null:null,'limit':_0x52bdff['options']?_0x52bdff[_0x2d44('0x1a')]['limit']||null:null,'include':_0x52bdff[_0x2d44('0x1a')]?_0x52bdff[_0x2d44('0x1a')][_0x2d44('0x1c')]?_[_0x2d44('0x1d')](_0x52bdff['options'][_0x2d44('0x1c')],function(_0x27aeec){return{'model':db[_0x27aeec[_0x2d44('0x1e')]],'as':_0x27aeec['as'],'attributes':_0x27aeec[_0x2d44('0x1f')],'include':_0x27aeec[_0x2d44('0x1c')]?_[_0x2d44('0x1d')](_0x27aeec[_0x2d44('0x1c')],function(_0x3ac164){return{'model':db[_0x3ac164[_0x2d44('0x1e')]],'as':_0x3ac164['as'],'attributes':_0x3ac164[_0x2d44('0x1f')],'include':_0x3ac164['include']?_['map'](_0x3ac164[_0x2d44('0x1c')],function(_0x53a586){return{'model':db[_0x53a586[_0x2d44('0x1e')]],'as':_0x53a586['as'],'attributes':_0x53a586[_0x2d44('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2d44('0xb')](function(_0x5a1a31){logger[_0x2d44('0xc')](_0x2d44('0x17'),_0x52bdff);logger[_0x2d44('0xe')](_0x2d44('0x17'),_0x52bdff,JSON[_0x2d44('0x10')](_0x5a1a31));_0x207f2a(_0x5a1a31);})[_0x2d44('0x16')](function(_0x10bbe2){logger['error'](_0x2d44('0x17'),_0x10bbe2[_0x2d44('0x14')],_0x52bdff);_0x293d1c(_0x452607[_0x2d44('0x11')](0x1f4,_0x10bbe2[_0x2d44('0x14')]));});});};exports[_0x2d44('0x20')]=function(_0x39d8a9){var _0x30094b=this;return new Promise(function(_0x48b235,_0x58c650){return db[_0x2d44('0x18')][_0x2d44('0x21')]({'raw':_0x39d8a9[_0x2d44('0x1a')]?_0x39d8a9[_0x2d44('0x1a')][_0x2d44('0x1b')]===undefined?!![]:![]:!![],'where':_0x39d8a9[_0x2d44('0x1a')]?_0x39d8a9[_0x2d44('0x1a')][_0x2d44('0x22')]||null:null,'attributes':_0x39d8a9[_0x2d44('0x1a')]?_0x39d8a9['options'][_0x2d44('0x1f')]||null:null,'include':_0x39d8a9[_0x2d44('0x1a')]?_0x39d8a9[_0x2d44('0x1a')]['include']?_['map'](_0x39d8a9[_0x2d44('0x1a')][_0x2d44('0x1c')],function(_0x5cbf6f){return{'model':db[_0x5cbf6f['model']],'as':_0x5cbf6f['as'],'attributes':_0x5cbf6f[_0x2d44('0x1f')],'include':_0x5cbf6f[_0x2d44('0x1c')]?_['map'](_0x5cbf6f[_0x2d44('0x1c')],function(_0x55b7ba){return{'model':db[_0x55b7ba[_0x2d44('0x1e')]],'as':_0x55b7ba['as'],'attributes':_0x55b7ba['attributes'],'include':_0x55b7ba[_0x2d44('0x1c')]?_[_0x2d44('0x1d')](_0x55b7ba[_0x2d44('0x1c')],function(_0x3143be){return{'model':db[_0x3143be[_0x2d44('0x1e')]],'as':_0x3143be['as'],'attributes':_0x3143be[_0x2d44('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2d44('0xb')](function(_0x107a9d){logger[_0x2d44('0xc')](_0x2d44('0x20'),_0x39d8a9);logger[_0x2d44('0xe')]('ShowZendeskAccount',_0x39d8a9,JSON[_0x2d44('0x10')](_0x107a9d));_0x48b235(_0x107a9d);})[_0x2d44('0x16')](function(_0x5d0ba9){logger[_0x2d44('0x11')]('ShowZendeskAccount',_0x5d0ba9[_0x2d44('0x14')],_0x39d8a9);_0x58c650(_0x30094b['error'](0x1f4,_0x5d0ba9[_0x2d44('0x14')]));});});}; \ No newline at end of file +var _0xdf77=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','GetZendeskAccount','findAll','options','where','attributes','limit','include','model','map','debug','ShowZendeskAccount','ZendeskAccount','find','lodash','util','bluebird'];(function(_0xaf4e3b,_0x3527ac){var _0x37a1e1=function(_0x49dc7f){while(--_0x49dc7f){_0xaf4e3b['push'](_0xaf4e3b['shift']());}};_0x37a1e1(++_0x3527ac);}(_0xdf77,0x138));var _0x7df7=function(_0x524815,_0x18a7d4){_0x524815=_0x524815-0x0;var _0x4c7a2c=_0xdf77[_0x524815];return _0x4c7a2c;};'use strict';var _=require(_0x7df7('0x0'));var util=require(_0x7df7('0x1'));var moment=require('moment');var BPromise=require(_0x7df7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7df7('0x3'));var db=require(_0x7df7('0x4'))['db'];var utils=require(_0x7df7('0x5'));var logger=require(_0x7df7('0x6'))(_0x7df7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7df7('0x8')][_0x7df7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x310812,_0xefd18d,_0x3ab668){return new BPromise(function(_0x5a376b,_0xc95091){return client[_0x7df7('0xa')](_0x310812,_0x3ab668)[_0x7df7('0xb')](function(_0x1bfde6){logger['info'](_0x7df7('0xc'),_0xefd18d,_0x7df7('0xd'));logger['debug'](_0x7df7('0xe'),_0xefd18d,_0x7df7('0xd'),JSON[_0x7df7('0xf')](_0x1bfde6));if(_0x1bfde6['error']){if(_0x1bfde6['error'][_0x7df7('0x10')]===0x1f4){logger[_0x7df7('0x11')](_0x7df7('0xc'),_0xefd18d,_0x1bfde6[_0x7df7('0x11')][_0x7df7('0x12')]);return _0xc95091(_0x1bfde6[_0x7df7('0x11')]['message']);}logger[_0x7df7('0x11')](_0x7df7('0xc'),_0xefd18d,_0x1bfde6['error']['message']);return _0x5a376b(_0x1bfde6[_0x7df7('0x11')][_0x7df7('0x12')]);}else{logger[_0x7df7('0x13')](_0x7df7('0xc'),_0xefd18d,_0x7df7('0xd'));_0x5a376b(_0x1bfde6[_0x7df7('0x14')][_0x7df7('0x12')]);}})[_0x7df7('0x15')](function(_0xdc6dff){logger[_0x7df7('0x11')](_0x7df7('0xc'),_0xefd18d,_0xdc6dff);_0xc95091(_0xdc6dff);});});}exports[_0x7df7('0x16')]=function(_0x277375){var _0xb9dc70=this;return new Promise(function(_0x45c8a4,_0x19f270){return db['ZendeskAccount'][_0x7df7('0x17')]({'raw':_0x277375[_0x7df7('0x18')]?_0x277375['options']['raw']===undefined?!![]:![]:!![],'where':_0x277375[_0x7df7('0x18')]?_0x277375[_0x7df7('0x18')][_0x7df7('0x19')]||null:null,'attributes':_0x277375['options']?_0x277375[_0x7df7('0x18')][_0x7df7('0x1a')]||null:null,'limit':_0x277375[_0x7df7('0x18')]?_0x277375['options'][_0x7df7('0x1b')]||null:null,'include':_0x277375['options']?_0x277375[_0x7df7('0x18')][_0x7df7('0x1c')]?_['map'](_0x277375[_0x7df7('0x18')][_0x7df7('0x1c')],function(_0xf556cd){return{'model':db[_0xf556cd[_0x7df7('0x1d')]],'as':_0xf556cd['as'],'attributes':_0xf556cd[_0x7df7('0x1a')],'include':_0xf556cd[_0x7df7('0x1c')]?_[_0x7df7('0x1e')](_0xf556cd[_0x7df7('0x1c')],function(_0x108e89){return{'model':db[_0x108e89['model']],'as':_0x108e89['as'],'attributes':_0x108e89[_0x7df7('0x1a')],'include':_0x108e89['include']?_[_0x7df7('0x1e')](_0x108e89[_0x7df7('0x1c')],function(_0x55f132){return{'model':db[_0x55f132['model']],'as':_0x55f132['as'],'attributes':_0x55f132['attributes']};}):[]};}):[]};}):[]:[]})[_0x7df7('0xb')](function(_0x557ede){logger[_0x7df7('0x13')](_0x7df7('0x16'),_0x277375);logger[_0x7df7('0x1f')](_0x7df7('0x16'),_0x277375,JSON['stringify'](_0x557ede));_0x45c8a4(_0x557ede);})[_0x7df7('0x15')](function(_0x58b105){logger['error'](_0x7df7('0x16'),_0x58b105[_0x7df7('0x12')],_0x277375);_0x19f270(_0xb9dc70[_0x7df7('0x11')](0x1f4,_0x58b105[_0x7df7('0x12')]));});});};exports[_0x7df7('0x20')]=function(_0x4c43f8){var _0x1bbd01=this;return new Promise(function(_0x698605,_0x4281b6){return db[_0x7df7('0x21')][_0x7df7('0x22')]({'raw':_0x4c43f8['options']?_0x4c43f8[_0x7df7('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4c43f8[_0x7df7('0x18')]?_0x4c43f8[_0x7df7('0x18')]['where']||null:null,'attributes':_0x4c43f8[_0x7df7('0x18')]?_0x4c43f8[_0x7df7('0x18')]['attributes']||null:null,'include':_0x4c43f8[_0x7df7('0x18')]?_0x4c43f8[_0x7df7('0x18')][_0x7df7('0x1c')]?_[_0x7df7('0x1e')](_0x4c43f8['options']['include'],function(_0x20fe65){return{'model':db[_0x20fe65[_0x7df7('0x1d')]],'as':_0x20fe65['as'],'attributes':_0x20fe65[_0x7df7('0x1a')],'include':_0x20fe65[_0x7df7('0x1c')]?_[_0x7df7('0x1e')](_0x20fe65[_0x7df7('0x1c')],function(_0x15ebea){return{'model':db[_0x15ebea[_0x7df7('0x1d')]],'as':_0x15ebea['as'],'attributes':_0x15ebea['attributes'],'include':_0x15ebea[_0x7df7('0x1c')]?_['map'](_0x15ebea[_0x7df7('0x1c')],function(_0x5171cd){return{'model':db[_0x5171cd[_0x7df7('0x1d')]],'as':_0x5171cd['as'],'attributes':_0x5171cd[_0x7df7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7df7('0xb')](function(_0x56605d){logger[_0x7df7('0x13')](_0x7df7('0x20'),_0x4c43f8);logger[_0x7df7('0x1f')](_0x7df7('0x20'),_0x4c43f8,JSON['stringify'](_0x56605d));_0x698605(_0x56605d);})['catch'](function(_0x1f0549){logger[_0x7df7('0x11')](_0x7df7('0x20'),_0x1f0549[_0x7df7('0x12')],_0x4c43f8);_0x4281b6(_0x1bbd01[_0x7df7('0x11')](0x1f4,_0x1f0549['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 3c62d73..526cab3 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 _0x5eb8=['getTags','post','/:id/tags','setTags','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x16d2d2,_0x378a93){var _0x2418c3=function(_0x5af80f){while(--_0x5af80f){_0x16d2d2['push'](_0x16d2d2['shift']());}};_0x2418c3(++_0x378a93);}(_0x5eb8,0xb0));var _0x85eb=function(_0xf15be4,_0x2c2591){_0xf15be4=_0xf15be4-0x0;var _0x2b6849=_0x5eb8[_0xf15be4];return _0x2b6849;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x9')](_0x85eb('0x12'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x9')]('/:id/tags',auth[_0x85eb('0xa')](),controller[_0x85eb('0x14')]);router[_0x85eb('0x15')]('/',auth[_0x85eb('0xa')](),controller['create']);router['post'](_0x85eb('0x16'),auth['isAuthenticated'](),controller[_0x85eb('0x17')]);router[_0x85eb('0x18')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x19')]);router['delete'](_0x85eb('0xc'),auth['isAuthenticated'](),controller[_0x85eb('0x1a')]);module[_0x85eb('0x1b')]=router; \ No newline at end of file +var _0x757a=['index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','setTags','put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x56f8aa,_0x2d0904){var _0x25d055=function(_0x5baab0){while(--_0x5baab0){_0x56f8aa['push'](_0x56f8aa['shift']());}};_0x25d055(++_0x2d0904);}(_0x757a,0xde));var _0xa757=function(_0x5eb91c,_0x3bfea1){_0x5eb91c=_0x5eb91c-0x0;var _0x552baa=_0x757a[_0x5eb91c];return _0x552baa;};'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')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['getFields']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0xa757('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa757('0x10')]);router[_0xa757('0x11')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x15')]);module[_0xa757('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 1c5b8a2..e73770b 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 _0xf376=['STRING','sequelize','exports'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xf376,0x1ea));var _0x6f37=function(_0x309648,_0x247c21){_0x309648=_0x309648-0x0;var _0x282f6b=_0xf376[_0x309648];return _0x282f6b;};'use strict';var Sequelize=require(_0x6f37('0x0'));module[_0x6f37('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6f37('0x2')]}}; \ No newline at end of file +var _0x71a3=['STRING','exports'];(function(_0x382879,_0x2ef53d){var _0x3944e3=function(_0x8c4cf0){while(--_0x8c4cf0){_0x382879['push'](_0x382879['shift']());}};_0x3944e3(++_0x2ef53d);}(_0x71a3,0x18b));var _0x371a=function(_0x2e1f26,_0x7e95c2){_0x2e1f26=_0x2e1f26-0x0;var _0x1717d2=_0x71a3[_0x2e1f26];return _0x1717d2;};'use strict';var Sequelize=require('sequelize');module[_0x371a('0x0')]={'name':{'type':Sequelize[_0x371a('0x1')]},'description':{'type':Sequelize[_0x371a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index fa5e588..0a54acc 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 _0x9340=['create','body','getFields','ZendeskField','filter','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','ZendeskConfiguration','findAll','show','params','find','catch'];(function(_0x34933a,_0x327378){var _0x36abb4=function(_0x2d6814){while(--_0x2d6814){_0x34933a['push'](_0x34933a['shift']());}};_0x36abb4(++_0x327378);}(_0x9340,0x150));var _0x0934=function(_0x29bc6e,_0x2b35b8){_0x29bc6e=_0x29bc6e-0x0;var _0x262d85=_0x9340[_0x29bc6e];return _0x262d85;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0934('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0934('0x1'));var moment=require(_0x0934('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0934('0x3'));var util=require(_0x0934('0x4'));var path=require(_0x0934('0x5'));var sox=require(_0x0934('0x6'));var csv=require(_0x0934('0x7'));var ejs=require(_0x0934('0x8'));var fs=require('fs');var fs_extra=require(_0x0934('0x9'));var _=require(_0x0934('0xa'));var squel=require(_0x0934('0xb'));var crypto=require(_0x0934('0xc'));var jsforce=require(_0x0934('0xd'));var deskjs=require(_0x0934('0xe'));var toCsv=require(_0x0934('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0934('0xf'));var authService=require(_0x0934('0x10'));var qs=require(_0x0934('0x11'));var as=require(_0x0934('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0934('0x13'))('api');var utils=require(_0x0934('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0934('0x15'));var db=require(_0x0934('0x16'))['db'];function respondWithStatusCode(_0x4b29c4,_0x1ee0e2){_0x1ee0e2=_0x1ee0e2||0xcc;return function(_0x39696f){if(_0x39696f){return _0x4b29c4[_0x0934('0x17')](_0x1ee0e2);}return _0x4b29c4[_0x0934('0x18')](_0x1ee0e2)[_0x0934('0x19')]();};}function respondWithResult(_0x558251,_0x10868b){_0x10868b=_0x10868b||0xc8;return function(_0x1dae8d){if(_0x1dae8d){return _0x558251['status'](_0x10868b)[_0x0934('0x1a')](_0x1dae8d);}};}function respondWithFilteredResult(_0x5f2d2c,_0x4277a1){return function(_0x5b1094){if(_0x5b1094){var _0x57d50d=typeof _0x4277a1[_0x0934('0x1b')]===_0x0934('0x1c')&&typeof _0x4277a1[_0x0934('0x1d')]===_0x0934('0x1c');var _0x1c9b95=_0x5b1094[_0x0934('0x1e')];var _0x71606e=_0x57d50d?0x0:_0x4277a1[_0x0934('0x1b')];var _0x14a52a=_0x57d50d?_0x5b1094[_0x0934('0x1e')]:_0x4277a1[_0x0934('0x1b')]+_0x4277a1[_0x0934('0x1d')];var _0x4a6ce6;if(_0x14a52a>=_0x1c9b95){_0x14a52a=_0x1c9b95;_0x4a6ce6=0xc8;}else{_0x4a6ce6=0xce;}_0x5f2d2c['status'](_0x4a6ce6);return _0x5f2d2c[_0x0934('0x1f')]('Content-Range',_0x71606e+'-'+_0x14a52a+'/'+_0x1c9b95)[_0x0934('0x1a')](_0x5b1094);}return null;};}function patchUpdates(_0x25a126){return function(_0x3314e2){try{jsonpatch['apply'](_0x3314e2,_0x25a126,!![]);}catch(_0x455a8f){return BPromise['reject'](_0x455a8f);}return _0x3314e2[_0x0934('0x20')]();};}function saveUpdates(_0x4318b4,_0x464271){return function(_0x1248b2){if(_0x1248b2){return _0x1248b2['update'](_0x4318b4)[_0x0934('0x21')](function(_0x16bb42){return _0x16bb42;});}return null;};}function removeEntity(_0x55200b,_0x2a8c11){return function(_0x37c803){if(_0x37c803){return _0x37c803[_0x0934('0x22')]()[_0x0934('0x21')](function(){_0x55200b[_0x0934('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b7c82,_0x1822f9){return function(_0x125f36){if(!_0x125f36){_0x2b7c82[_0x0934('0x17')](0x194);}return _0x125f36;};}function handleError(_0x2ef059,_0x323545){_0x323545=_0x323545||0x1f4;return function(_0x445922){logger[_0x0934('0x23')](_0x445922[_0x0934('0x24')]);if(_0x445922[_0x0934('0x25')]){delete _0x445922[_0x0934('0x25')];}_0x2ef059[_0x0934('0x18')](_0x323545)[_0x0934('0x26')](_0x445922);};}exports[_0x0934('0x27')]=function(_0x2b55ea,_0x2d45a5){var _0x5a5801={},_0x3004b5={},_0x2b420b={'count':0x0,'rows':[]};var _0x38fb3a=_[_0x0934('0x28')](db['ZendeskConfiguration'][_0x0934('0x29')],function(_0x24cb78){return{'name':_0x24cb78[_0x0934('0x2a')],'type':_0x24cb78['type'][_0x0934('0x2b')]};});_0x3004b5[_0x0934('0x2c')]=_['map'](_0x38fb3a,_0x0934('0x25'));_0x3004b5[_0x0934('0x2d')]=_[_0x0934('0x2e')](_0x2b55ea[_0x0934('0x2d')]);_0x3004b5[_0x0934('0x2f')]=_[_0x0934('0x30')](_0x3004b5[_0x0934('0x2c')],_0x3004b5[_0x0934('0x2d')]);_0x5a5801[_0x0934('0x31')]=_[_0x0934('0x30')](_0x3004b5[_0x0934('0x2c')],qs[_0x0934('0x32')](_0x2b55ea[_0x0934('0x2d')][_0x0934('0x32')]));_0x5a5801[_0x0934('0x31')]=_0x5a5801[_0x0934('0x31')][_0x0934('0x33')]?_0x5a5801[_0x0934('0x31')]:_0x3004b5['model'];if(!_0x2b55ea[_0x0934('0x2d')][_0x0934('0x34')](_0x0934('0x35'))){_0x5a5801['limit']=qs['limit'](_0x2b55ea[_0x0934('0x2d')][_0x0934('0x1d')]);_0x5a5801['offset']=qs[_0x0934('0x1b')](_0x2b55ea[_0x0934('0x2d')][_0x0934('0x1b')]);}_0x5a5801[_0x0934('0x36')]=qs[_0x0934('0x37')](_0x2b55ea[_0x0934('0x2d')][_0x0934('0x37')]);_0x5a5801[_0x0934('0x38')]=qs[_0x0934('0x2f')](_[_0x0934('0x39')](_0x2b55ea[_0x0934('0x2d')],_0x3004b5[_0x0934('0x2f')]),_0x38fb3a);if(_0x2b55ea[_0x0934('0x2d')]['filter']){_0x5a5801[_0x0934('0x38')]=_[_0x0934('0x3a')](_0x5a5801[_0x0934('0x38')],{'$or':_[_0x0934('0x28')](_0x38fb3a,function(_0x41d008){if(_0x41d008[_0x0934('0x3b')]!==_0x0934('0x3c')){var _0x105f2e={};_0x105f2e[_0x41d008['name']]={'$like':'%'+_0x2b55ea[_0x0934('0x2d')]['filter']+'%'};return _0x105f2e;}})});}_0x5a5801=_['merge']({},_0x5a5801,_0x2b55ea[_0x0934('0x3d')]);var _0x48bce3={'where':_0x5a5801[_0x0934('0x38')]};return db['ZendeskConfiguration'][_0x0934('0x1e')](_0x48bce3)[_0x0934('0x21')](function(_0x14ded4){_0x2b420b[_0x0934('0x1e')]=_0x14ded4;if(_0x2b55ea[_0x0934('0x2d')][_0x0934('0x3e')]){_0x5a5801['include']=[{'all':!![]}];}return db[_0x0934('0x3f')][_0x0934('0x40')](_0x5a5801);})['then'](function(_0x241d3b){_0x2b420b['rows']=_0x241d3b;return _0x2b420b;})[_0x0934('0x21')](respondWithFilteredResult(_0x2d45a5,_0x5a5801))['catch'](handleError(_0x2d45a5,null));};exports[_0x0934('0x41')]=function(_0x10fa56,_0xe50dd5){var _0x403723={'raw':![],'where':{'id':_0x10fa56[_0x0934('0x42')]['id']}},_0x2c4bf2={};_0x2c4bf2[_0x0934('0x2c')]=_[_0x0934('0x2e')](db['ZendeskConfiguration'][_0x0934('0x29')]);_0x2c4bf2[_0x0934('0x2d')]=_['keys'](_0x10fa56[_0x0934('0x2d')]);_0x2c4bf2[_0x0934('0x2f')]=_['intersection'](_0x2c4bf2[_0x0934('0x2c')],_0x2c4bf2[_0x0934('0x2d')]);_0x403723[_0x0934('0x31')]=_[_0x0934('0x30')](_0x2c4bf2['model'],qs[_0x0934('0x32')](_0x10fa56[_0x0934('0x2d')][_0x0934('0x32')]));_0x403723['attributes']=_0x403723[_0x0934('0x31')]['length']?_0x403723['attributes']:_0x2c4bf2[_0x0934('0x2c')];if(_0x10fa56[_0x0934('0x2d')]['includeAll']){_0x403723['include']=[{'all':!![]}];}_0x403723=_[_0x0934('0x3a')]({},_0x403723,_0x10fa56[_0x0934('0x3d')]);return db[_0x0934('0x3f')][_0x0934('0x43')](_0x403723)[_0x0934('0x21')](handleEntityNotFound(_0xe50dd5,null))[_0x0934('0x21')](respondWithResult(_0xe50dd5,null))[_0x0934('0x44')](handleError(_0xe50dd5,null));};exports[_0x0934('0x45')]=function(_0x49b362,_0x1c3ef2){return db['ZendeskConfiguration']['create'](_0x49b362[_0x0934('0x46')],{})[_0x0934('0x21')](respondWithResult(_0x1c3ef2,0xc9))[_0x0934('0x44')](handleError(_0x1c3ef2,null));};exports['update']=function(_0x494c0c,_0x3f7456){if(_0x494c0c[_0x0934('0x46')]['id']){delete _0x494c0c[_0x0934('0x46')]['id'];}return db[_0x0934('0x3f')]['find']({'where':{'id':_0x494c0c[_0x0934('0x42')]['id']}})[_0x0934('0x21')](handleEntityNotFound(_0x3f7456,null))[_0x0934('0x21')](saveUpdates(_0x494c0c[_0x0934('0x46')],null))[_0x0934('0x21')](respondWithResult(_0x3f7456,null))[_0x0934('0x44')](handleError(_0x3f7456,null));};exports['destroy']=function(_0x26f4fe,_0x56b4c9){return db[_0x0934('0x3f')][_0x0934('0x43')]({'where':{'id':_0x26f4fe['params']['id']}})[_0x0934('0x21')](handleEntityNotFound(_0x56b4c9,null))[_0x0934('0x21')](removeEntity(_0x56b4c9,null))[_0x0934('0x44')](handleError(_0x56b4c9,null));};exports[_0x0934('0x47')]=function(_0x2caf3b,_0x5f031d,_0x5b489a){var _0x44ccf8={};var _0x5a12a5={};var _0x2126b6;var _0x499737;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x2caf3b[_0x0934('0x42')]['id']}})[_0x0934('0x21')](handleEntityNotFound(_0x5f031d,null))['then'](function(_0x1a4610){if(_0x1a4610){_0x2126b6=_0x1a4610;_0x5a12a5[_0x0934('0x2c')]=_['keys'](db[_0x0934('0x48')][_0x0934('0x29')]);_0x5a12a5['query']=_[_0x0934('0x2e')](_0x2caf3b[_0x0934('0x2d')]);_0x5a12a5['filters']=_[_0x0934('0x30')](_0x5a12a5[_0x0934('0x2c')],_0x5a12a5[_0x0934('0x2d')]);_0x44ccf8['attributes']=_['intersection'](_0x5a12a5['model'],qs[_0x0934('0x32')](_0x2caf3b[_0x0934('0x2d')][_0x0934('0x32')]));_0x44ccf8[_0x0934('0x31')]=_0x44ccf8['attributes']['length']?_0x44ccf8[_0x0934('0x31')]:_0x5a12a5[_0x0934('0x2c')];_0x44ccf8[_0x0934('0x36')]=qs[_0x0934('0x37')](_0x2caf3b[_0x0934('0x2d')][_0x0934('0x37')]);_0x44ccf8[_0x0934('0x38')]=qs['filters'](_[_0x0934('0x39')](_0x2caf3b[_0x0934('0x2d')],_0x5a12a5['filters']));if(_0x2caf3b[_0x0934('0x2d')][_0x0934('0x49')]){_0x44ccf8['where']=_[_0x0934('0x3a')](_0x44ccf8['where'],{'$or':_[_0x0934('0x28')](_0x44ccf8[_0x0934('0x31')],function(_0x23f7c0){var _0x1e72ad={};_0x1e72ad[_0x23f7c0]={'$like':'%'+_0x2caf3b['query']['filter']+'%'};return _0x1e72ad;})});}_0x44ccf8=_[_0x0934('0x3a')]({},_0x44ccf8,_0x2caf3b[_0x0934('0x3d')]);return _0x2126b6[_0x0934('0x47')](_0x44ccf8);}})[_0x0934('0x21')](function(_0x26fa8c){if(_0x26fa8c){_0x499737=_0x26fa8c[_0x0934('0x33')];if(!_0x2caf3b[_0x0934('0x2d')]['hasOwnProperty']('nolimit')){_0x44ccf8[_0x0934('0x1d')]=qs[_0x0934('0x1d')](_0x2caf3b[_0x0934('0x2d')][_0x0934('0x1d')]);_0x44ccf8[_0x0934('0x1b')]=qs[_0x0934('0x1b')](_0x2caf3b['query'][_0x0934('0x1b')]);}return _0x2126b6[_0x0934('0x47')](_0x44ccf8);}})[_0x0934('0x21')](function(_0x4cb0cc){if(_0x4cb0cc){return _0x4cb0cc?{'count':_0x499737,'rows':_0x4cb0cc}:null;}})[_0x0934('0x21')](respondWithResult(_0x5f031d,null))['catch'](handleError(_0x5f031d,null));};exports[_0x0934('0x4a')]=function(_0x1d458c,_0x284e6a,_0x46684){var _0x2e8aaf={};var _0x32c948={};var _0x2ec817;var _0x2e1ae8;return db[_0x0934('0x3f')][_0x0934('0x4b')]({'where':{'id':_0x1d458c[_0x0934('0x42')]['id']}})['then'](handleEntityNotFound(_0x284e6a,null))['then'](function(_0xc997cf){if(_0xc997cf){_0x2ec817=_0xc997cf;_0x32c948[_0x0934('0x2c')]=_[_0x0934('0x2e')](db[_0x0934('0x48')][_0x0934('0x29')]);_0x32c948[_0x0934('0x2d')]=_[_0x0934('0x2e')](_0x1d458c['query']);_0x32c948[_0x0934('0x2f')]=_[_0x0934('0x30')](_0x32c948['model'],_0x32c948['query']);_0x2e8aaf['attributes']=_[_0x0934('0x30')](_0x32c948[_0x0934('0x2c')],qs[_0x0934('0x32')](_0x1d458c[_0x0934('0x2d')][_0x0934('0x32')]));_0x2e8aaf[_0x0934('0x31')]=_0x2e8aaf[_0x0934('0x31')][_0x0934('0x33')]?_0x2e8aaf[_0x0934('0x31')]:_0x32c948[_0x0934('0x2c')];_0x2e8aaf[_0x0934('0x36')]=qs['sort'](_0x1d458c[_0x0934('0x2d')]['sort']);_0x2e8aaf[_0x0934('0x38')]=qs[_0x0934('0x2f')](_[_0x0934('0x39')](_0x1d458c[_0x0934('0x2d')],_0x32c948['filters']));if(_0x1d458c['query'][_0x0934('0x49')]){_0x2e8aaf[_0x0934('0x38')]=_[_0x0934('0x3a')](_0x2e8aaf['where'],{'$or':_[_0x0934('0x28')](_0x2e8aaf[_0x0934('0x31')],function(_0xd615a3){var _0x2bdcea={};_0x2bdcea[_0xd615a3]={'$like':'%'+_0x1d458c[_0x0934('0x2d')][_0x0934('0x49')]+'%'};return _0x2bdcea;})});}_0x2e8aaf=_[_0x0934('0x3a')]({},_0x2e8aaf,_0x1d458c[_0x0934('0x3d')]);return _0x2ec817[_0x0934('0x4a')](_0x2e8aaf);}})[_0x0934('0x21')](function(_0x820227){if(_0x820227){_0x2e1ae8=_0x820227[_0x0934('0x33')];if(!_0x1d458c[_0x0934('0x2d')][_0x0934('0x34')](_0x0934('0x35'))){_0x2e8aaf[_0x0934('0x1d')]=qs[_0x0934('0x1d')](_0x1d458c[_0x0934('0x2d')][_0x0934('0x1d')]);_0x2e8aaf[_0x0934('0x1b')]=qs[_0x0934('0x1b')](_0x1d458c[_0x0934('0x2d')][_0x0934('0x1b')]);}return _0x2ec817[_0x0934('0x4a')](_0x2e8aaf);}})[_0x0934('0x21')](function(_0x23e55d){if(_0x23e55d){return _0x23e55d?{'count':_0x2e1ae8,'rows':_0x23e55d}:null;}})[_0x0934('0x21')](respondWithResult(_0x284e6a,null))[_0x0934('0x44')](handleError(_0x284e6a,null));};exports[_0x0934('0x4c')]=function(_0x48fa87,_0x3faae9,_0x485e16){var _0x4c06a4={};var _0x58540a={};var _0x3245a3;var _0x1ceb25;return db[_0x0934('0x3f')][_0x0934('0x4b')]({'where':{'id':_0x48fa87[_0x0934('0x42')]['id']}})[_0x0934('0x21')](handleEntityNotFound(_0x3faae9,null))[_0x0934('0x21')](function(_0x2d8d67){if(_0x2d8d67){_0x3245a3=_0x2d8d67;_0x58540a['model']=_[_0x0934('0x2e')](db[_0x0934('0x48')][_0x0934('0x29')]);_0x58540a[_0x0934('0x2d')]=_[_0x0934('0x2e')](_0x48fa87[_0x0934('0x2d')]);_0x58540a[_0x0934('0x2f')]=_[_0x0934('0x30')](_0x58540a[_0x0934('0x2c')],_0x58540a[_0x0934('0x2d')]);_0x4c06a4[_0x0934('0x31')]=_[_0x0934('0x30')](_0x58540a[_0x0934('0x2c')],qs[_0x0934('0x32')](_0x48fa87['query'][_0x0934('0x32')]));_0x4c06a4[_0x0934('0x31')]=_0x4c06a4[_0x0934('0x31')][_0x0934('0x33')]?_0x4c06a4[_0x0934('0x31')]:_0x58540a[_0x0934('0x2c')];_0x4c06a4[_0x0934('0x36')]=qs[_0x0934('0x37')](_0x48fa87[_0x0934('0x2d')][_0x0934('0x37')]);_0x4c06a4['where']=qs[_0x0934('0x2f')](_[_0x0934('0x39')](_0x48fa87['query'],_0x58540a[_0x0934('0x2f')]));if(_0x48fa87[_0x0934('0x2d')][_0x0934('0x49')]){_0x4c06a4[_0x0934('0x38')]=_[_0x0934('0x3a')](_0x4c06a4['where'],{'$or':_['map'](_0x4c06a4['attributes'],function(_0x2177a3){var _0x46706f={};_0x46706f[_0x2177a3]={'$like':'%'+_0x48fa87[_0x0934('0x2d')][_0x0934('0x49')]+'%'};return _0x46706f;})});}_0x4c06a4=_[_0x0934('0x3a')]({},_0x4c06a4,_0x48fa87['options']);return _0x3245a3[_0x0934('0x4c')](_0x4c06a4);}})[_0x0934('0x21')](function(_0x4981ba){if(_0x4981ba){_0x1ceb25=_0x4981ba[_0x0934('0x33')];if(!_0x48fa87['query'][_0x0934('0x34')](_0x0934('0x35'))){_0x4c06a4[_0x0934('0x1d')]=qs['limit'](_0x48fa87['query'][_0x0934('0x1d')]);_0x4c06a4[_0x0934('0x1b')]=qs[_0x0934('0x1b')](_0x48fa87[_0x0934('0x2d')]['offset']);}return _0x3245a3[_0x0934('0x4c')](_0x4c06a4);}})[_0x0934('0x21')](function(_0x40f970){if(_0x40f970){return _0x40f970?{'count':_0x1ceb25,'rows':_0x40f970}:null;}})[_0x0934('0x21')](respondWithResult(_0x3faae9,null))[_0x0934('0x44')](handleError(_0x3faae9,null));};exports[_0x0934('0x4d')]=function(_0x37a8b8,_0x15c8e9,_0x59f47c){var _0x1244f3={};var _0x42b8a4={};var _0x5d3fb4;var _0x33f7e0;return db[_0x0934('0x3f')][_0x0934('0x4b')]({'where':{'id':_0x37a8b8[_0x0934('0x42')]['id']}})[_0x0934('0x21')](handleEntityNotFound(_0x15c8e9,null))[_0x0934('0x21')](function(_0x34dc88){if(_0x34dc88){_0x5d3fb4=_0x34dc88;_0x42b8a4['model']=_[_0x0934('0x2e')](db[_0x0934('0x4e')][_0x0934('0x29')]);_0x42b8a4[_0x0934('0x2d')]=_[_0x0934('0x2e')](_0x37a8b8[_0x0934('0x2d')]);_0x42b8a4[_0x0934('0x2f')]=_[_0x0934('0x30')](_0x42b8a4['model'],_0x42b8a4[_0x0934('0x2d')]);_0x1244f3[_0x0934('0x31')]=_[_0x0934('0x30')](_0x42b8a4[_0x0934('0x2c')],qs[_0x0934('0x32')](_0x37a8b8[_0x0934('0x2d')][_0x0934('0x32')]));_0x1244f3['attributes']=_0x1244f3[_0x0934('0x31')]['length']?_0x1244f3['attributes']:_0x42b8a4[_0x0934('0x2c')];_0x1244f3['order']=qs[_0x0934('0x37')](_0x37a8b8[_0x0934('0x2d')][_0x0934('0x37')]);_0x1244f3['where']=qs[_0x0934('0x2f')](_[_0x0934('0x39')](_0x37a8b8[_0x0934('0x2d')],_0x42b8a4[_0x0934('0x2f')]));if(_0x37a8b8['query'][_0x0934('0x49')]){_0x1244f3[_0x0934('0x38')]=_[_0x0934('0x3a')](_0x1244f3[_0x0934('0x38')],{'$or':_[_0x0934('0x28')](_0x1244f3[_0x0934('0x31')],function(_0x47c658){var _0xfc95cb={};_0xfc95cb[_0x47c658]={'$like':'%'+_0x37a8b8[_0x0934('0x2d')]['filter']+'%'};return _0xfc95cb;})});}_0x1244f3=_[_0x0934('0x3a')]({},_0x1244f3,_0x37a8b8[_0x0934('0x3d')]);return _0x5d3fb4[_0x0934('0x4d')](_0x1244f3);}})[_0x0934('0x21')](function(_0x4fa70b){if(_0x4fa70b){_0x33f7e0=_0x4fa70b[_0x0934('0x33')];if(!_0x37a8b8['query'][_0x0934('0x34')](_0x0934('0x35'))){_0x1244f3['limit']=qs[_0x0934('0x1d')](_0x37a8b8[_0x0934('0x2d')][_0x0934('0x1d')]);_0x1244f3[_0x0934('0x1b')]=qs[_0x0934('0x1b')](_0x37a8b8[_0x0934('0x2d')][_0x0934('0x1b')]);}return _0x5d3fb4['getTags'](_0x1244f3);}})['then'](function(_0xe25d28){if(_0xe25d28){return _0xe25d28?{'count':_0x33f7e0,'rows':_0xe25d28}:null;}})[_0x0934('0x21')](respondWithResult(_0x15c8e9,null))[_0x0934('0x44')](handleError(_0x15c8e9,null));};exports[_0x0934('0x4f')]=function(_0x57a8f1,_0x3673d5,_0x16f964){if(_0x57a8f1[_0x0934('0x46')]['id']){delete _0x57a8f1['body']['id'];}return db[_0x0934('0x3f')][_0x0934('0x4b')]({'where':{'id':_0x57a8f1[_0x0934('0x42')]['id']}})[_0x0934('0x21')](handleEntityNotFound(_0x3673d5,null))['then'](function(_0x2d6597){if(_0x2d6597){return _0x2d6597['setTags'](_0x57a8f1[_0x0934('0x46')][_0x0934('0x50')]||[]);}return null;})['then'](respondWithResult(_0x3673d5,null))[_0x0934('0x44')](handleError(_0x3673d5,null));}; \ No newline at end of file +var _0xc0ea=['error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','update','body','getFields','findOne','getSubjects','ZendeskField','getDescriptions','getTags','Tag','setTags','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','then','destroy'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xc0ea,0x185));var _0xac0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc0ea[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac0e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac0e('0x1'));var rp=require(_0xac0e('0x2'));var moment=require('moment');var BPromise=require(_0xac0e('0x3'));var Mustache=require(_0xac0e('0x4'));var util=require(_0xac0e('0x5'));var path=require(_0xac0e('0x6'));var sox=require(_0xac0e('0x7'));var csv=require(_0xac0e('0x8'));var ejs=require(_0xac0e('0x9'));var fs=require('fs');var fs_extra=require(_0xac0e('0xa'));var _=require(_0xac0e('0xb'));var squel=require(_0xac0e('0xc'));var crypto=require(_0xac0e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xac0e('0xe'));var toCsv=require(_0xac0e('0x8'));var querystring=require(_0xac0e('0xf'));var Papa=require(_0xac0e('0x10'));var Redis=require(_0xac0e('0x11'));var authService=require(_0xac0e('0x12'));var qs=require(_0xac0e('0x13'));var as=require(_0xac0e('0x14'));var hardwareService=require(_0xac0e('0x15'));var logger=require(_0xac0e('0x16'))(_0xac0e('0x17'));var utils=require(_0xac0e('0x18'));var config=require(_0xac0e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xac0e('0x1a'))['db'];function respondWithStatusCode(_0x2fe338,_0x46fdb8){_0x46fdb8=_0x46fdb8||0xcc;return function(_0x2bfc04){if(_0x2bfc04){return _0x2fe338[_0xac0e('0x1b')](_0x46fdb8);}return _0x2fe338[_0xac0e('0x1c')](_0x46fdb8)[_0xac0e('0x1d')]();};}function respondWithResult(_0x4a9bb7,_0xf072ce){_0xf072ce=_0xf072ce||0xc8;return function(_0x256958){if(_0x256958){return _0x4a9bb7[_0xac0e('0x1c')](_0xf072ce)['json'](_0x256958);}};}function respondWithFilteredResult(_0x361b25,_0x49501d){return function(_0x1feb52){if(_0x1feb52){var _0xb40d41=typeof _0x49501d['offset']==='undefined'&&typeof _0x49501d[_0xac0e('0x1e')]===_0xac0e('0x1f');var _0x125e22=_0x1feb52[_0xac0e('0x20')];var _0x5119e9=_0xb40d41?0x0:_0x49501d[_0xac0e('0x21')];var _0x1db95e=_0xb40d41?_0x1feb52['count']:_0x49501d[_0xac0e('0x21')]+_0x49501d[_0xac0e('0x1e')];var _0x1b050f;if(_0x1db95e>=_0x125e22){_0x1db95e=_0x125e22;_0x1b050f=0xc8;}else{_0x1b050f=0xce;}_0x361b25[_0xac0e('0x1c')](_0x1b050f);return _0x361b25[_0xac0e('0x22')](_0xac0e('0x23'),_0x5119e9+'-'+_0x1db95e+'/'+_0x125e22)[_0xac0e('0x24')](_0x1feb52);}return null;};}function patchUpdates(_0x3b4ee7){return function(_0x38f34e){try{jsonpatch[_0xac0e('0x25')](_0x38f34e,_0x3b4ee7,!![]);}catch(_0x31c422){return BPromise[_0xac0e('0x26')](_0x31c422);}return _0x38f34e['save']();};}function saveUpdates(_0x30c842,_0x318bc3){return function(_0x4c024a){if(_0x4c024a){return _0x4c024a['update'](_0x30c842)[_0xac0e('0x27')](function(_0x475b5c){return _0x475b5c;});}return null;};}function removeEntity(_0x1ede31,_0x2c7fc6){return function(_0x1f8735){if(_0x1f8735){return _0x1f8735[_0xac0e('0x28')]()[_0xac0e('0x27')](function(){_0x1ede31[_0xac0e('0x1c')](0xcc)[_0xac0e('0x1d')]();});}};}function handleEntityNotFound(_0x223d31,_0xdb17a3){return function(_0x278ad3){if(!_0x278ad3){_0x223d31['sendStatus'](0x194);}return _0x278ad3;};}function handleError(_0x3c6679,_0x10f8bb){_0x10f8bb=_0x10f8bb||0x1f4;return function(_0x4d2a2e){logger[_0xac0e('0x29')](_0x4d2a2e[_0xac0e('0x2a')]);if(_0x4d2a2e['name']){delete _0x4d2a2e[_0xac0e('0x2b')];}_0x3c6679[_0xac0e('0x1c')](_0x10f8bb)[_0xac0e('0x2c')](_0x4d2a2e);};}exports[_0xac0e('0x2d')]=function(_0x1022a3,_0x27e4b1){var _0x2960f5={},_0x80a025={},_0x2d2703={'count':0x0,'rows':[]};var _0x4377b0=_[_0xac0e('0x2e')](db[_0xac0e('0x2f')][_0xac0e('0x30')],function(_0x43d4e7){return{'name':_0x43d4e7['fieldName'],'type':_0x43d4e7['type'][_0xac0e('0x31')]};});_0x80a025[_0xac0e('0x32')]=_[_0xac0e('0x2e')](_0x4377b0,_0xac0e('0x2b'));_0x80a025[_0xac0e('0x33')]=_[_0xac0e('0x34')](_0x1022a3[_0xac0e('0x33')]);_0x80a025[_0xac0e('0x35')]=_[_0xac0e('0x36')](_0x80a025[_0xac0e('0x32')],_0x80a025[_0xac0e('0x33')]);_0x2960f5['attributes']=_[_0xac0e('0x36')](_0x80a025[_0xac0e('0x32')],qs[_0xac0e('0x37')](_0x1022a3[_0xac0e('0x33')][_0xac0e('0x37')]));_0x2960f5[_0xac0e('0x38')]=_0x2960f5[_0xac0e('0x38')][_0xac0e('0x39')]?_0x2960f5[_0xac0e('0x38')]:_0x80a025[_0xac0e('0x32')];if(!_0x1022a3['query'][_0xac0e('0x3a')](_0xac0e('0x3b'))){_0x2960f5[_0xac0e('0x1e')]=qs[_0xac0e('0x1e')](_0x1022a3['query']['limit']);_0x2960f5[_0xac0e('0x21')]=qs[_0xac0e('0x21')](_0x1022a3['query'][_0xac0e('0x21')]);}_0x2960f5[_0xac0e('0x3c')]=qs['sort'](_0x1022a3[_0xac0e('0x33')][_0xac0e('0x3d')]);_0x2960f5['where']=qs['filters'](_[_0xac0e('0x3e')](_0x1022a3[_0xac0e('0x33')],_0x80a025[_0xac0e('0x35')]),_0x4377b0);if(_0x1022a3[_0xac0e('0x33')][_0xac0e('0x3f')]){_0x2960f5['where']=_[_0xac0e('0x40')](_0x2960f5[_0xac0e('0x41')],{'$or':_[_0xac0e('0x2e')](_0x4377b0,function(_0x18f9fb){if(_0x18f9fb[_0xac0e('0x42')]!==_0xac0e('0x43')){var _0x412423={};_0x412423[_0x18f9fb[_0xac0e('0x2b')]]={'$like':'%'+_0x1022a3[_0xac0e('0x33')][_0xac0e('0x3f')]+'%'};return _0x412423;}})});}_0x2960f5=_[_0xac0e('0x40')]({},_0x2960f5,_0x1022a3[_0xac0e('0x44')]);var _0x4f3139={'where':_0x2960f5[_0xac0e('0x41')]};return db[_0xac0e('0x2f')]['count'](_0x4f3139)['then'](function(_0x1292e0){_0x2d2703[_0xac0e('0x20')]=_0x1292e0;if(_0x1022a3['query'][_0xac0e('0x45')]){_0x2960f5[_0xac0e('0x46')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xac0e('0x47')](_0x2960f5);})[_0xac0e('0x27')](function(_0x128cfa){_0x2d2703[_0xac0e('0x48')]=_0x128cfa;return _0x2d2703;})[_0xac0e('0x27')](respondWithFilteredResult(_0x27e4b1,_0x2960f5))[_0xac0e('0x49')](handleError(_0x27e4b1,null));};exports['show']=function(_0x3e0a5c,_0x3081bc){var _0x36d933={'raw':![],'where':{'id':_0x3e0a5c[_0xac0e('0x4a')]['id']}},_0xe3060c={};_0xe3060c['model']=_['keys'](db['ZendeskConfiguration'][_0xac0e('0x30')]);_0xe3060c[_0xac0e('0x33')]=_[_0xac0e('0x34')](_0x3e0a5c[_0xac0e('0x33')]);_0xe3060c[_0xac0e('0x35')]=_['intersection'](_0xe3060c[_0xac0e('0x32')],_0xe3060c[_0xac0e('0x33')]);_0x36d933[_0xac0e('0x38')]=_[_0xac0e('0x36')](_0xe3060c[_0xac0e('0x32')],qs[_0xac0e('0x37')](_0x3e0a5c['query'][_0xac0e('0x37')]));_0x36d933[_0xac0e('0x38')]=_0x36d933[_0xac0e('0x38')][_0xac0e('0x39')]?_0x36d933[_0xac0e('0x38')]:_0xe3060c[_0xac0e('0x32')];if(_0x3e0a5c[_0xac0e('0x33')]['includeAll']){_0x36d933[_0xac0e('0x46')]=[{'all':!![]}];}_0x36d933=_[_0xac0e('0x40')]({},_0x36d933,_0x3e0a5c[_0xac0e('0x44')]);return db['ZendeskConfiguration'][_0xac0e('0x4b')](_0x36d933)[_0xac0e('0x27')](handleEntityNotFound(_0x3081bc,null))[_0xac0e('0x27')](respondWithResult(_0x3081bc,null))['catch'](handleError(_0x3081bc,null));};exports['create']=function(_0x16b61b,_0x1ebab3){return db['ZendeskConfiguration']['create'](_0x16b61b['body'],{})[_0xac0e('0x27')](respondWithResult(_0x1ebab3,0xc9))['catch'](handleError(_0x1ebab3,null));};exports[_0xac0e('0x4c')]=function(_0x4cde4b,_0x4b7a90){if(_0x4cde4b[_0xac0e('0x4d')]['id']){delete _0x4cde4b[_0xac0e('0x4d')]['id'];}return db[_0xac0e('0x2f')][_0xac0e('0x4b')]({'where':{'id':_0x4cde4b[_0xac0e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4b7a90,null))['then'](saveUpdates(_0x4cde4b[_0xac0e('0x4d')],null))[_0xac0e('0x27')](respondWithResult(_0x4b7a90,null))['catch'](handleError(_0x4b7a90,null));};exports[_0xac0e('0x28')]=function(_0x533ec0,_0x42f51c){return db[_0xac0e('0x2f')]['find']({'where':{'id':_0x533ec0[_0xac0e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x42f51c,null))['then'](removeEntity(_0x42f51c,null))['catch'](handleError(_0x42f51c,null));};exports[_0xac0e('0x4e')]=function(_0x451c5f,_0x4d5ba8,_0x126d8d){var _0x1cc155={};var _0x218181={};var _0xf87e26;var _0x40f854;return db[_0xac0e('0x2f')][_0xac0e('0x4f')]({'where':{'id':_0x451c5f[_0xac0e('0x4a')]['id']}})[_0xac0e('0x27')](handleEntityNotFound(_0x4d5ba8,null))['then'](function(_0x2deed1){if(_0x2deed1){_0xf87e26=_0x2deed1;_0x218181[_0xac0e('0x32')]=_['keys'](db['ZendeskField'][_0xac0e('0x30')]);_0x218181[_0xac0e('0x33')]=_[_0xac0e('0x34')](_0x451c5f['query']);_0x218181[_0xac0e('0x35')]=_[_0xac0e('0x36')](_0x218181[_0xac0e('0x32')],_0x218181[_0xac0e('0x33')]);_0x1cc155[_0xac0e('0x38')]=_[_0xac0e('0x36')](_0x218181[_0xac0e('0x32')],qs[_0xac0e('0x37')](_0x451c5f[_0xac0e('0x33')]['fields']));_0x1cc155[_0xac0e('0x38')]=_0x1cc155[_0xac0e('0x38')][_0xac0e('0x39')]?_0x1cc155[_0xac0e('0x38')]:_0x218181[_0xac0e('0x32')];_0x1cc155[_0xac0e('0x3c')]=qs[_0xac0e('0x3d')](_0x451c5f[_0xac0e('0x33')][_0xac0e('0x3d')]);_0x1cc155['where']=qs[_0xac0e('0x35')](_[_0xac0e('0x3e')](_0x451c5f[_0xac0e('0x33')],_0x218181['filters']));if(_0x451c5f[_0xac0e('0x33')][_0xac0e('0x3f')]){_0x1cc155[_0xac0e('0x41')]=_[_0xac0e('0x40')](_0x1cc155[_0xac0e('0x41')],{'$or':_[_0xac0e('0x2e')](_0x1cc155[_0xac0e('0x38')],function(_0x4302cd){var _0x1ba2b2={};_0x1ba2b2[_0x4302cd]={'$like':'%'+_0x451c5f['query'][_0xac0e('0x3f')]+'%'};return _0x1ba2b2;})});}_0x1cc155=_[_0xac0e('0x40')]({},_0x1cc155,_0x451c5f[_0xac0e('0x44')]);return _0xf87e26[_0xac0e('0x4e')](_0x1cc155);}})[_0xac0e('0x27')](function(_0x12e8d4){if(_0x12e8d4){_0x40f854=_0x12e8d4[_0xac0e('0x39')];if(!_0x451c5f['query'][_0xac0e('0x3a')]('nolimit')){_0x1cc155[_0xac0e('0x1e')]=qs[_0xac0e('0x1e')](_0x451c5f[_0xac0e('0x33')][_0xac0e('0x1e')]);_0x1cc155[_0xac0e('0x21')]=qs[_0xac0e('0x21')](_0x451c5f[_0xac0e('0x33')]['offset']);}return _0xf87e26['getFields'](_0x1cc155);}})[_0xac0e('0x27')](function(_0x1bcb7b){if(_0x1bcb7b){return _0x1bcb7b?{'count':_0x40f854,'rows':_0x1bcb7b}:null;}})[_0xac0e('0x27')](respondWithResult(_0x4d5ba8,null))[_0xac0e('0x49')](handleError(_0x4d5ba8,null));};exports[_0xac0e('0x50')]=function(_0x10ae3f,_0x5d2d58,_0x19961a){var _0x5ad375={};var _0x2bb14b={};var _0x3e290c;var _0x1655b5;return db[_0xac0e('0x2f')][_0xac0e('0x4f')]({'where':{'id':_0x10ae3f[_0xac0e('0x4a')]['id']}})[_0xac0e('0x27')](handleEntityNotFound(_0x5d2d58,null))[_0xac0e('0x27')](function(_0x2364f2){if(_0x2364f2){_0x3e290c=_0x2364f2;_0x2bb14b['model']=_[_0xac0e('0x34')](db[_0xac0e('0x51')][_0xac0e('0x30')]);_0x2bb14b[_0xac0e('0x33')]=_[_0xac0e('0x34')](_0x10ae3f['query']);_0x2bb14b[_0xac0e('0x35')]=_[_0xac0e('0x36')](_0x2bb14b[_0xac0e('0x32')],_0x2bb14b[_0xac0e('0x33')]);_0x5ad375[_0xac0e('0x38')]=_['intersection'](_0x2bb14b[_0xac0e('0x32')],qs[_0xac0e('0x37')](_0x10ae3f[_0xac0e('0x33')][_0xac0e('0x37')]));_0x5ad375['attributes']=_0x5ad375[_0xac0e('0x38')]['length']?_0x5ad375[_0xac0e('0x38')]:_0x2bb14b[_0xac0e('0x32')];_0x5ad375[_0xac0e('0x3c')]=qs[_0xac0e('0x3d')](_0x10ae3f[_0xac0e('0x33')]['sort']);_0x5ad375[_0xac0e('0x41')]=qs[_0xac0e('0x35')](_[_0xac0e('0x3e')](_0x10ae3f[_0xac0e('0x33')],_0x2bb14b[_0xac0e('0x35')]));if(_0x10ae3f['query']['filter']){_0x5ad375['where']=_[_0xac0e('0x40')](_0x5ad375['where'],{'$or':_[_0xac0e('0x2e')](_0x5ad375[_0xac0e('0x38')],function(_0x36ca43){var _0x47a3ec={};_0x47a3ec[_0x36ca43]={'$like':'%'+_0x10ae3f[_0xac0e('0x33')]['filter']+'%'};return _0x47a3ec;})});}_0x5ad375=_[_0xac0e('0x40')]({},_0x5ad375,_0x10ae3f[_0xac0e('0x44')]);return _0x3e290c[_0xac0e('0x50')](_0x5ad375);}})[_0xac0e('0x27')](function(_0x10a8ae){if(_0x10a8ae){_0x1655b5=_0x10a8ae[_0xac0e('0x39')];if(!_0x10ae3f['query'][_0xac0e('0x3a')](_0xac0e('0x3b'))){_0x5ad375['limit']=qs[_0xac0e('0x1e')](_0x10ae3f['query'][_0xac0e('0x1e')]);_0x5ad375[_0xac0e('0x21')]=qs[_0xac0e('0x21')](_0x10ae3f[_0xac0e('0x33')][_0xac0e('0x21')]);}return _0x3e290c[_0xac0e('0x50')](_0x5ad375);}})[_0xac0e('0x27')](function(_0x412fbd){if(_0x412fbd){return _0x412fbd?{'count':_0x1655b5,'rows':_0x412fbd}:null;}})[_0xac0e('0x27')](respondWithResult(_0x5d2d58,null))['catch'](handleError(_0x5d2d58,null));};exports[_0xac0e('0x52')]=function(_0x1e6ba9,_0x33388a,_0x229f7a){var _0x338492={};var _0x2f2aaa={};var _0x55a9dc;var _0x5874ff;return db[_0xac0e('0x2f')][_0xac0e('0x4f')]({'where':{'id':_0x1e6ba9[_0xac0e('0x4a')]['id']}})[_0xac0e('0x27')](handleEntityNotFound(_0x33388a,null))[_0xac0e('0x27')](function(_0x1057a6){if(_0x1057a6){_0x55a9dc=_0x1057a6;_0x2f2aaa['model']=_[_0xac0e('0x34')](db[_0xac0e('0x51')]['rawAttributes']);_0x2f2aaa[_0xac0e('0x33')]=_['keys'](_0x1e6ba9[_0xac0e('0x33')]);_0x2f2aaa['filters']=_[_0xac0e('0x36')](_0x2f2aaa['model'],_0x2f2aaa['query']);_0x338492[_0xac0e('0x38')]=_['intersection'](_0x2f2aaa[_0xac0e('0x32')],qs['fields'](_0x1e6ba9[_0xac0e('0x33')][_0xac0e('0x37')]));_0x338492[_0xac0e('0x38')]=_0x338492[_0xac0e('0x38')][_0xac0e('0x39')]?_0x338492[_0xac0e('0x38')]:_0x2f2aaa[_0xac0e('0x32')];_0x338492['order']=qs[_0xac0e('0x3d')](_0x1e6ba9[_0xac0e('0x33')]['sort']);_0x338492[_0xac0e('0x41')]=qs[_0xac0e('0x35')](_['pick'](_0x1e6ba9[_0xac0e('0x33')],_0x2f2aaa[_0xac0e('0x35')]));if(_0x1e6ba9['query'][_0xac0e('0x3f')]){_0x338492[_0xac0e('0x41')]=_[_0xac0e('0x40')](_0x338492['where'],{'$or':_[_0xac0e('0x2e')](_0x338492[_0xac0e('0x38')],function(_0x5e055d){var _0x27b4d3={};_0x27b4d3[_0x5e055d]={'$like':'%'+_0x1e6ba9[_0xac0e('0x33')][_0xac0e('0x3f')]+'%'};return _0x27b4d3;})});}_0x338492=_['merge']({},_0x338492,_0x1e6ba9['options']);return _0x55a9dc['getDescriptions'](_0x338492);}})[_0xac0e('0x27')](function(_0x716da1){if(_0x716da1){_0x5874ff=_0x716da1['length'];if(!_0x1e6ba9['query'][_0xac0e('0x3a')](_0xac0e('0x3b'))){_0x338492[_0xac0e('0x1e')]=qs['limit'](_0x1e6ba9[_0xac0e('0x33')]['limit']);_0x338492['offset']=qs[_0xac0e('0x21')](_0x1e6ba9['query'][_0xac0e('0x21')]);}return _0x55a9dc[_0xac0e('0x52')](_0x338492);}})[_0xac0e('0x27')](function(_0xde1d9f){if(_0xde1d9f){return _0xde1d9f?{'count':_0x5874ff,'rows':_0xde1d9f}:null;}})['then'](respondWithResult(_0x33388a,null))[_0xac0e('0x49')](handleError(_0x33388a,null));};exports[_0xac0e('0x53')]=function(_0x3b80ab,_0x13bebb,_0x222c35){var _0x216452={};var _0x5db5e0={};var _0x296aeb;var _0x52704f;return db['ZendeskConfiguration'][_0xac0e('0x4f')]({'where':{'id':_0x3b80ab[_0xac0e('0x4a')]['id']}})[_0xac0e('0x27')](handleEntityNotFound(_0x13bebb,null))[_0xac0e('0x27')](function(_0x1c17a9){if(_0x1c17a9){_0x296aeb=_0x1c17a9;_0x5db5e0[_0xac0e('0x32')]=_[_0xac0e('0x34')](db[_0xac0e('0x54')][_0xac0e('0x30')]);_0x5db5e0['query']=_[_0xac0e('0x34')](_0x3b80ab[_0xac0e('0x33')]);_0x5db5e0[_0xac0e('0x35')]=_['intersection'](_0x5db5e0[_0xac0e('0x32')],_0x5db5e0['query']);_0x216452[_0xac0e('0x38')]=_['intersection'](_0x5db5e0['model'],qs[_0xac0e('0x37')](_0x3b80ab[_0xac0e('0x33')][_0xac0e('0x37')]));_0x216452[_0xac0e('0x38')]=_0x216452[_0xac0e('0x38')][_0xac0e('0x39')]?_0x216452[_0xac0e('0x38')]:_0x5db5e0[_0xac0e('0x32')];_0x216452[_0xac0e('0x3c')]=qs[_0xac0e('0x3d')](_0x3b80ab[_0xac0e('0x33')][_0xac0e('0x3d')]);_0x216452[_0xac0e('0x41')]=qs[_0xac0e('0x35')](_['pick'](_0x3b80ab[_0xac0e('0x33')],_0x5db5e0[_0xac0e('0x35')]));if(_0x3b80ab[_0xac0e('0x33')]['filter']){_0x216452[_0xac0e('0x41')]=_[_0xac0e('0x40')](_0x216452[_0xac0e('0x41')],{'$or':_[_0xac0e('0x2e')](_0x216452[_0xac0e('0x38')],function(_0x19ec51){var _0x2c4e81={};_0x2c4e81[_0x19ec51]={'$like':'%'+_0x3b80ab['query'][_0xac0e('0x3f')]+'%'};return _0x2c4e81;})});}_0x216452=_[_0xac0e('0x40')]({},_0x216452,_0x3b80ab[_0xac0e('0x44')]);return _0x296aeb['getTags'](_0x216452);}})[_0xac0e('0x27')](function(_0x170ba1){if(_0x170ba1){_0x52704f=_0x170ba1['length'];if(!_0x3b80ab[_0xac0e('0x33')][_0xac0e('0x3a')](_0xac0e('0x3b'))){_0x216452[_0xac0e('0x1e')]=qs[_0xac0e('0x1e')](_0x3b80ab[_0xac0e('0x33')][_0xac0e('0x1e')]);_0x216452[_0xac0e('0x21')]=qs[_0xac0e('0x21')](_0x3b80ab[_0xac0e('0x33')][_0xac0e('0x21')]);}return _0x296aeb[_0xac0e('0x53')](_0x216452);}})[_0xac0e('0x27')](function(_0x483df4){if(_0x483df4){return _0x483df4?{'count':_0x52704f,'rows':_0x483df4}:null;}})[_0xac0e('0x27')](respondWithResult(_0x13bebb,null))[_0xac0e('0x49')](handleError(_0x13bebb,null));};exports[_0xac0e('0x55')]=function(_0x2e40f7,_0x2a8e76,_0x526f30){if(_0x2e40f7[_0xac0e('0x4d')]['id']){delete _0x2e40f7[_0xac0e('0x4d')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x2e40f7[_0xac0e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a8e76,null))[_0xac0e('0x27')](function(_0x56985a){if(_0x56985a){return _0x56985a[_0xac0e('0x55')](_0x2e40f7[_0xac0e('0x4d')]['ids']||[]);}return null;})[_0xac0e('0x27')](respondWithResult(_0x2a8e76,null))[_0xac0e('0x49')](handleError(_0x2a8e76,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 2aac00c..e77a3f8 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 _0x3f8c=['exports','define','ZendeskConfiguration','int_zendesk_configurations','../../config/logger','api','moment','bluebird'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x3f8c,0x104));var _0xc3f8=function(_0x3c9f01,_0x3efbb0){_0x3c9f01=_0x3c9f01-0x0;var _0x59fdcd=_0x3f8c[_0x3c9f01];return _0x59fdcd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc3f8('0x0'))(_0xc3f8('0x1'));var moment=require(_0xc3f8('0x2'));var BPromise=require(_0xc3f8('0x3'));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('./intZendeskConfiguration.attributes');module[_0xc3f8('0x4')]=function(_0x1a6976,_0x3a4e2f){return _0x1a6976[_0xc3f8('0x5')](_0xc3f8('0x6'),attributes,{'tableName':_0xc3f8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5eb8=['request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','../../config/logger','api','moment','bluebird'];(function(_0x562d4b,_0x3b7f1c){var _0x3f6615=function(_0x44d64a){while(--_0x44d64a){_0x562d4b['push'](_0x562d4b['shift']());}};_0x3f6615(++_0x3b7f1c);}(_0x5eb8,0xb0));var _0x85eb=function(_0x43c3f9,_0x1861cb){_0x43c3f9=_0x43c3f9-0x0;var _0x4f4f54=_0x5eb8[_0x43c3f9];return _0x4f4f54;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x85eb('0x0'))(_0x85eb('0x1'));var moment=require(_0x85eb('0x2'));var BPromise=require(_0x85eb('0x3'));var rp=require(_0x85eb('0x4'));var fs=require('fs');var path=require(_0x85eb('0x5'));var rimraf=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var attributes=require(_0x85eb('0x8'));module[_0x85eb('0x9')]=function(_0x2bf83c,_0x1ba1d8){return _0x2bf83c['define'](_0x85eb('0xa'),attributes,{'tableName':_0x85eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 2a228f2..1fba935 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 _0x9404=['info','ZendeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then'];(function(_0x26c4aa,_0x2eb22c){var _0xd7c782=function(_0x538ee9){while(--_0x538ee9){_0x26c4aa['push'](_0x26c4aa['shift']());}};_0xd7c782(++_0x2eb22c);}(_0x9404,0xba));var _0x4940=function(_0x3962cc,_0x320e19){_0x3962cc=_0x3962cc-0x0;var _0x263186=_0x9404[_0x3962cc];return _0x263186;};'use strict';var _=require(_0x4940('0x0'));var util=require(_0x4940('0x1'));var moment=require(_0x4940('0x2'));var BPromise=require(_0x4940('0x3'));var rs=require(_0x4940('0x4'));var fs=require('fs');var Redis=require(_0x4940('0x5'));var db=require(_0x4940('0x6'))['db'];var utils=require(_0x4940('0x7'));var logger=require(_0x4940('0x8'))(_0x4940('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x482df8,_0x5559c8,_0x3bc5e0){return new BPromise(function(_0x9d0971,_0x1bba49){return client[_0x4940('0xa')](_0x482df8,_0x3bc5e0)[_0x4940('0xb')](function(_0x410f22){logger[_0x4940('0xc')](_0x4940('0xd'),_0x5559c8,'request\x20sent');logger[_0x4940('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5559c8,_0x4940('0xf'),JSON[_0x4940('0x10')](_0x410f22));if(_0x410f22[_0x4940('0x11')]){if(_0x410f22[_0x4940('0x11')][_0x4940('0x12')]===0x1f4){logger[_0x4940('0x11')](_0x4940('0xd'),_0x5559c8,_0x410f22[_0x4940('0x11')][_0x4940('0x13')]);return _0x1bba49(_0x410f22['error'][_0x4940('0x13')]);}logger[_0x4940('0x11')](_0x4940('0xd'),_0x5559c8,_0x410f22[_0x4940('0x11')][_0x4940('0x13')]);return _0x9d0971(_0x410f22['error']['message']);}else{logger[_0x4940('0xc')](_0x4940('0xd'),_0x5559c8,_0x4940('0xf'));_0x9d0971(_0x410f22[_0x4940('0x14')][_0x4940('0x13')]);}})[_0x4940('0x15')](function(_0x43a882){logger[_0x4940('0x11')](_0x4940('0xd'),_0x5559c8,_0x43a882);_0x1bba49(_0x43a882);});});} \ No newline at end of file +var _0xe1d2=['ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x2a2e72,_0x1de962){var _0x3cfb4a=function(_0x3d435c){while(--_0x3d435c){_0x2a2e72['push'](_0x2a2e72['shift']());}};_0x3cfb4a(++_0x1de962);}(_0xe1d2,0x194));var _0x2e1d=function(_0x3fd6b6,_0x4ea38b){_0x3fd6b6=_0x3fd6b6-0x0;var _0x474fd4=_0xe1d2[_0x3fd6b6];return _0x474fd4;};'use strict';var _=require(_0x2e1d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2e1d('0x1'));var rs=require(_0x2e1d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e1d('0x3'))['db'];var utils=require(_0x2e1d('0x4'));var logger=require('../../config/logger')(_0x2e1d('0x5'));var config=require(_0x2e1d('0x6'));var jayson=require(_0x2e1d('0x7'));var client=jayson[_0x2e1d('0x8')][_0x2e1d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe09354,_0x2cd4a9,_0x683a7c){return new BPromise(function(_0x28cc54,_0x53a0ec){return client[_0x2e1d('0xa')](_0xe09354,_0x683a7c)['then'](function(_0x5f32c6){logger[_0x2e1d('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2cd4a9,_0x2e1d('0xc'));logger[_0x2e1d('0xd')](_0x2e1d('0xe'),_0x2cd4a9,_0x2e1d('0xc'),JSON[_0x2e1d('0xf')](_0x5f32c6));if(_0x5f32c6['error']){if(_0x5f32c6[_0x2e1d('0x10')][_0x2e1d('0x11')]===0x1f4){logger[_0x2e1d('0x10')](_0x2e1d('0x12'),_0x2cd4a9,_0x5f32c6[_0x2e1d('0x10')][_0x2e1d('0x13')]);return _0x53a0ec(_0x5f32c6[_0x2e1d('0x10')]['message']);}logger[_0x2e1d('0x10')](_0x2e1d('0x12'),_0x2cd4a9,_0x5f32c6[_0x2e1d('0x10')][_0x2e1d('0x13')]);return _0x28cc54(_0x5f32c6[_0x2e1d('0x10')][_0x2e1d('0x13')]);}else{logger[_0x2e1d('0xb')](_0x2e1d('0x12'),_0x2cd4a9,'request\x20sent');_0x28cc54(_0x5f32c6[_0x2e1d('0x14')][_0x2e1d('0x13')]);}})[_0x2e1d('0x15')](function(_0x25a6ff){logger[_0x2e1d('0x10')](_0x2e1d('0x12'),_0x2cd4a9,_0x25a6ff);_0x53a0ec(_0x25a6ff);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 3eeda55..80ce672 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 _0x06b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x76abeb,_0x3d7d25){var _0x4b9310=function(_0x2beaca){while(--_0x2beaca){_0x76abeb['push'](_0x76abeb['shift']());}};_0x4b9310(++_0x3d7d25);}(_0x06b0,0x1c3));var _0x006b=function(_0xeba4a3,_0x4d8017){_0xeba4a3=_0xeba4a3-0x0;var _0x54f292=_0x06b0[_0xeba4a3];return _0x54f292;};'use strict';var multer=require(_0x006b('0x0'));var util=require(_0x006b('0x1'));var path=require(_0x006b('0x2'));var timeout=require(_0x006b('0x3'));var express=require(_0x006b('0x4'));var router=express[_0x006b('0x5')]();var fs_extra=require(_0x006b('0x6'));var auth=require(_0x006b('0x7'));var interaction=require(_0x006b('0x8'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router['get']('/',auth[_0x006b('0x9')](),controller[_0x006b('0xa')]);router[_0x006b('0xb')](_0x006b('0xc'),auth[_0x006b('0x9')](),controller[_0x006b('0xd')]);router[_0x006b('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x006b('0xf')](_0x006b('0xc'),auth['isAuthenticated'](),controller[_0x006b('0x10')]);router['delete'](_0x006b('0xc'),auth[_0x006b('0x9')](),controller[_0x006b('0x11')]);module[_0x006b('0x12')]=router; \ No newline at end of file +var _0x1baa=['post','isAuthenticated','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x417303,_0x50bac5){var _0x458fa5=function(_0x10ebaa){while(--_0x10ebaa){_0x417303['push'](_0x417303['shift']());}};_0x458fa5(++_0x50bac5);}(_0x1baa,0xeb));var _0xa1ba=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x1baa[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xa1ba('0x0'));var util=require(_0xa1ba('0x1'));var path=require(_0xa1ba('0x2'));var timeout=require(_0xa1ba('0x3'));var express=require(_0xa1ba('0x4'));var router=express[_0xa1ba('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa1ba('0x6'));var interaction=require(_0xa1ba('0x7'));var config=require(_0xa1ba('0x8'));var controller=require('./intZendeskField.controller');router[_0xa1ba('0x9')]('/',auth['isAuthenticated'](),controller[_0xa1ba('0xa')]);router['get'](_0xa1ba('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xa1ba('0xc')]('/',auth[_0xa1ba('0xd')](),controller[_0xa1ba('0xe')]);router['put']('/:id',auth[_0xa1ba('0xd')](),controller[_0xa1ba('0xf')]);router[_0xa1ba('0x10')]('/:id',auth[_0xa1ba('0xd')](),controller[_0xa1ba('0x11')]);module[_0xa1ba('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index bc4bee5..0b8b0fb 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 _0x9401=['sequelize','exports','ENUM','variable','keyValue','picklist','STRING','customVariable'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9401,0xb0));var _0x1940=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x9401[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x1940('0x0'));module[_0x1940('0x1')]={'type':{'type':Sequelize[_0x1940('0x2')]('string',_0x1940('0x3'),'customVariable',_0x1940('0x4'),_0x1940('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1940('0x6')]},'keyType':{'type':Sequelize[_0x1940('0x2')]('string','variable',_0x1940('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1940('0x6')]},'nameField':{'type':Sequelize[_0x1940('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1940('0x6')]}}; \ No newline at end of file +var _0x4015=['variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x4015,0x1e2));var _0x5401=function(_0x254076,_0x5e7b8d){_0x254076=_0x254076-0x0;var _0x21a93e=_0x4015[_0x254076];return _0x21a93e;};'use strict';var Sequelize=require(_0x5401('0x0'));module[_0x5401('0x1')]={'type':{'type':Sequelize[_0x5401('0x2')](_0x5401('0x3'),'variable',_0x5401('0x4'),_0x5401('0x5'),_0x5401('0x6')),'defaultValue':_0x5401('0x3')},'content':{'type':Sequelize[_0x5401('0x7')]},'key':{'type':Sequelize[_0x5401('0x7')]},'keyType':{'type':Sequelize[_0x5401('0x2')](_0x5401('0x3'),_0x5401('0x8'),_0x5401('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5401('0x7')]},'nameField':{'type':Sequelize[_0x5401('0x7')]},'customField':{'type':Sequelize[_0x5401('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5401('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 03931c3..ee1eb46 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 _0x9c2c=['VIRTUAL','filter','options','includeAll','ZendeskField','findAll','rows','catch','show','params','keys','length','include','find','create','body','eml-format','rimraf','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge'];(function(_0x148986,_0x597db3){var _0x3dff1b=function(_0x45b118){while(--_0x45b118){_0x148986['push'](_0x148986['shift']());}};_0x3dff1b(++_0x597db3);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc9c2('0x0'));var rimraf=require(_0xc9c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc9c2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc9c2('0x3'));var util=require(_0xc9c2('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xc9c2('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc9c2('0x6'));var _=require(_0xc9c2('0x7'));var squel=require(_0xc9c2('0x8'));var crypto=require(_0xc9c2('0x9'));var jsforce=require(_0xc9c2('0xa'));var deskjs=require(_0xc9c2('0xb'));var toCsv=require(_0xc9c2('0x5'));var querystring=require(_0xc9c2('0xc'));var Papa=require(_0xc9c2('0xd'));var Redis=require('ioredis');var authService=require(_0xc9c2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc9c2('0xf'));var hardwareService=require(_0xc9c2('0x10'));var logger=require(_0xc9c2('0x11'))(_0xc9c2('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc9c2('0x13'));var db=require(_0xc9c2('0x14'))['db'];function respondWithStatusCode(_0x568f69,_0x7ec780){_0x7ec780=_0x7ec780||0xcc;return function(_0x1f08a7){if(_0x1f08a7){return _0x568f69[_0xc9c2('0x15')](_0x7ec780);}return _0x568f69[_0xc9c2('0x16')](_0x7ec780)[_0xc9c2('0x17')]();};}function respondWithResult(_0x3b0058,_0x33b288){_0x33b288=_0x33b288||0xc8;return function(_0x132702){if(_0x132702){return _0x3b0058[_0xc9c2('0x16')](_0x33b288)[_0xc9c2('0x18')](_0x132702);}};}function respondWithFilteredResult(_0xf94209,_0x383667){return function(_0x480d7c){if(_0x480d7c){var _0x27840d=typeof _0x383667[_0xc9c2('0x19')]===_0xc9c2('0x1a')&&typeof _0x383667[_0xc9c2('0x1b')]===_0xc9c2('0x1a');var _0x49413b=_0x480d7c[_0xc9c2('0x1c')];var _0x37c027=_0x27840d?0x0:_0x383667[_0xc9c2('0x19')];var _0x4e4ded=_0x27840d?_0x480d7c[_0xc9c2('0x1c')]:_0x383667[_0xc9c2('0x19')]+_0x383667[_0xc9c2('0x1b')];var _0x484ca3;if(_0x4e4ded>=_0x49413b){_0x4e4ded=_0x49413b;_0x484ca3=0xc8;}else{_0x484ca3=0xce;}_0xf94209[_0xc9c2('0x16')](_0x484ca3);return _0xf94209[_0xc9c2('0x1d')]('Content-Range',_0x37c027+'-'+_0x4e4ded+'/'+_0x49413b)['json'](_0x480d7c);}return null;};}function patchUpdates(_0x37e3){return function(_0x50f280){try{jsonpatch[_0xc9c2('0x1e')](_0x50f280,_0x37e3,!![]);}catch(_0x140c8a){return BPromise[_0xc9c2('0x1f')](_0x140c8a);}return _0x50f280[_0xc9c2('0x20')]();};}function saveUpdates(_0x3e1774,_0x53c460){return function(_0x1fbac4){if(_0x1fbac4){return _0x1fbac4[_0xc9c2('0x21')](_0x3e1774)[_0xc9c2('0x22')](function(_0x11cc07){return _0x11cc07;});}return null;};}function removeEntity(_0x32c372,_0x385030){return function(_0x56e515){if(_0x56e515){return _0x56e515[_0xc9c2('0x23')]()[_0xc9c2('0x22')](function(){_0x32c372['status'](0xcc)[_0xc9c2('0x17')]();});}};}function handleEntityNotFound(_0x4b3b97,_0xa18b32){return function(_0xd803e9){if(!_0xd803e9){_0x4b3b97[_0xc9c2('0x15')](0x194);}return _0xd803e9;};}function handleError(_0x2222e4,_0x484d55){_0x484d55=_0x484d55||0x1f4;return function(_0x2073ef){logger['error'](_0x2073ef[_0xc9c2('0x24')]);if(_0x2073ef[_0xc9c2('0x25')]){delete _0x2073ef[_0xc9c2('0x25')];}_0x2222e4[_0xc9c2('0x16')](_0x484d55)[_0xc9c2('0x26')](_0x2073ef);};}exports['index']=function(_0x3cedb5,_0xe2f93b){var _0x40033a={},_0x1554ae={},_0xa89cb8={'count':0x0,'rows':[]};var _0x460832=_[_0xc9c2('0x27')](db['ZendeskField'][_0xc9c2('0x28')],function(_0x4a9fca){return{'name':_0x4a9fca[_0xc9c2('0x29')],'type':_0x4a9fca[_0xc9c2('0x2a')]['key']};});_0x1554ae[_0xc9c2('0x2b')]=_[_0xc9c2('0x27')](_0x460832,_0xc9c2('0x25'));_0x1554ae[_0xc9c2('0x2c')]=_['keys'](_0x3cedb5[_0xc9c2('0x2c')]);_0x1554ae[_0xc9c2('0x2d')]=_['intersection'](_0x1554ae['model'],_0x1554ae[_0xc9c2('0x2c')]);_0x40033a[_0xc9c2('0x2e')]=_[_0xc9c2('0x2f')](_0x1554ae['model'],qs['fields'](_0x3cedb5[_0xc9c2('0x2c')][_0xc9c2('0x30')]));_0x40033a['attributes']=_0x40033a[_0xc9c2('0x2e')]['length']?_0x40033a[_0xc9c2('0x2e')]:_0x1554ae[_0xc9c2('0x2b')];if(!_0x3cedb5[_0xc9c2('0x2c')][_0xc9c2('0x31')](_0xc9c2('0x32'))){_0x40033a[_0xc9c2('0x1b')]=qs[_0xc9c2('0x1b')](_0x3cedb5[_0xc9c2('0x2c')][_0xc9c2('0x1b')]);_0x40033a['offset']=qs[_0xc9c2('0x19')](_0x3cedb5['query'][_0xc9c2('0x19')]);}_0x40033a[_0xc9c2('0x33')]=qs['sort'](_0x3cedb5[_0xc9c2('0x2c')][_0xc9c2('0x34')]);_0x40033a['where']=qs[_0xc9c2('0x2d')](_[_0xc9c2('0x35')](_0x3cedb5[_0xc9c2('0x2c')],_0x1554ae['filters']),_0x460832);if(_0x3cedb5[_0xc9c2('0x2c')]['filter']){_0x40033a[_0xc9c2('0x36')]=_[_0xc9c2('0x37')](_0x40033a['where'],{'$or':_[_0xc9c2('0x27')](_0x460832,function(_0x3f718a){if(_0x3f718a[_0xc9c2('0x2a')]!==_0xc9c2('0x38')){var _0x3f9248={};_0x3f9248[_0x3f718a[_0xc9c2('0x25')]]={'$like':'%'+_0x3cedb5[_0xc9c2('0x2c')][_0xc9c2('0x39')]+'%'};return _0x3f9248;}})});}_0x40033a=_[_0xc9c2('0x37')]({},_0x40033a,_0x3cedb5[_0xc9c2('0x3a')]);var _0x8d6710={'where':_0x40033a['where']};return db['ZendeskField'][_0xc9c2('0x1c')](_0x8d6710)[_0xc9c2('0x22')](function(_0x4507c9){_0xa89cb8[_0xc9c2('0x1c')]=_0x4507c9;if(_0x3cedb5[_0xc9c2('0x2c')][_0xc9c2('0x3b')]){_0x40033a['include']=[{'all':!![]}];}return db[_0xc9c2('0x3c')][_0xc9c2('0x3d')](_0x40033a);})[_0xc9c2('0x22')](function(_0x46c740){_0xa89cb8[_0xc9c2('0x3e')]=_0x46c740;return _0xa89cb8;})['then'](respondWithFilteredResult(_0xe2f93b,_0x40033a))[_0xc9c2('0x3f')](handleError(_0xe2f93b,null));};exports[_0xc9c2('0x40')]=function(_0x2126f8,_0x4f6bc9){var _0x3a05f8={'raw':!![],'where':{'id':_0x2126f8[_0xc9c2('0x41')]['id']}},_0xd3d946={};_0xd3d946[_0xc9c2('0x2b')]=_[_0xc9c2('0x42')](db['ZendeskField']['rawAttributes']);_0xd3d946[_0xc9c2('0x2c')]=_[_0xc9c2('0x42')](_0x2126f8['query']);_0xd3d946[_0xc9c2('0x2d')]=_[_0xc9c2('0x2f')](_0xd3d946[_0xc9c2('0x2b')],_0xd3d946[_0xc9c2('0x2c')]);_0x3a05f8[_0xc9c2('0x2e')]=_[_0xc9c2('0x2f')](_0xd3d946[_0xc9c2('0x2b')],qs['fields'](_0x2126f8[_0xc9c2('0x2c')]['fields']));_0x3a05f8[_0xc9c2('0x2e')]=_0x3a05f8['attributes'][_0xc9c2('0x43')]?_0x3a05f8['attributes']:_0xd3d946[_0xc9c2('0x2b')];if(_0x2126f8['query'][_0xc9c2('0x3b')]){_0x3a05f8[_0xc9c2('0x44')]=[{'all':!![]}];}_0x3a05f8=_[_0xc9c2('0x37')]({},_0x3a05f8,_0x2126f8[_0xc9c2('0x3a')]);return db[_0xc9c2('0x3c')][_0xc9c2('0x45')](_0x3a05f8)[_0xc9c2('0x22')](handleEntityNotFound(_0x4f6bc9,null))['then'](respondWithResult(_0x4f6bc9,null))[_0xc9c2('0x3f')](handleError(_0x4f6bc9,null));};exports[_0xc9c2('0x46')]=function(_0x412df0,_0xad73d4){return db[_0xc9c2('0x3c')][_0xc9c2('0x46')](_0x412df0['body'],{})[_0xc9c2('0x22')](respondWithResult(_0xad73d4,0xc9))[_0xc9c2('0x3f')](handleError(_0xad73d4,null));};exports[_0xc9c2('0x21')]=function(_0x88fa84,_0x2e9925){if(_0x88fa84[_0xc9c2('0x47')]['id']){delete _0x88fa84[_0xc9c2('0x47')]['id'];}return db[_0xc9c2('0x3c')]['find']({'where':{'id':_0x88fa84[_0xc9c2('0x41')]['id']}})[_0xc9c2('0x22')](handleEntityNotFound(_0x2e9925,null))[_0xc9c2('0x22')](saveUpdates(_0x88fa84[_0xc9c2('0x47')],null))[_0xc9c2('0x22')](respondWithResult(_0x2e9925,null))['catch'](handleError(_0x2e9925,null));};exports[_0xc9c2('0x23')]=function(_0x4e2589,_0xdedc7c){return db['ZendeskField'][_0xc9c2('0x45')]({'where':{'id':_0x4e2589['params']['id']}})[_0xc9c2('0x22')](handleEntityNotFound(_0xdedc7c,null))['then'](removeEntity(_0xdedc7c,null))['catch'](handleError(_0xdedc7c,null));}; \ No newline at end of file +var _0xc8bf=['moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','ZendeskField','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x43d558,_0x4bae4f){var _0x2cb7a9=function(_0x33dd08){while(--_0x33dd08){_0x43d558['push'](_0x43d558['shift']());}};_0x2cb7a9(++_0x4bae4f);}(_0xc8bf,0x181));var _0xfc8b=function(_0x313e7c,_0x52f808){_0x313e7c=_0x313e7c-0x0;var _0x3ea27f=_0xc8bf[_0x313e7c];return _0x3ea27f;};'use strict';var emlformat=require(_0xfc8b('0x0'));var rimraf=require(_0xfc8b('0x1'));var zipdir=require(_0xfc8b('0x2'));var jsonpatch=require(_0xfc8b('0x3'));var rp=require(_0xfc8b('0x4'));var moment=require(_0xfc8b('0x5'));var BPromise=require(_0xfc8b('0x6'));var Mustache=require(_0xfc8b('0x7'));var util=require('util');var path=require(_0xfc8b('0x8'));var sox=require(_0xfc8b('0x9'));var csv=require(_0xfc8b('0xa'));var ejs=require(_0xfc8b('0xb'));var fs=require('fs');var fs_extra=require(_0xfc8b('0xc'));var _=require('lodash');var squel=require(_0xfc8b('0xd'));var crypto=require('crypto');var jsforce=require(_0xfc8b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xfc8b('0xa'));var querystring=require('querystring');var Papa=require(_0xfc8b('0xf'));var Redis=require(_0xfc8b('0x10'));var authService=require(_0xfc8b('0x11'));var qs=require(_0xfc8b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc8b('0x13'));var logger=require('../../config/logger')(_0xfc8b('0x14'));var utils=require(_0xfc8b('0x15'));var config=require(_0xfc8b('0x16'));var licenseUtil=require(_0xfc8b('0x17'));var db=require(_0xfc8b('0x18'))['db'];function respondWithStatusCode(_0x2d16a2,_0x36c122){_0x36c122=_0x36c122||0xcc;return function(_0x15a126){if(_0x15a126){return _0x2d16a2[_0xfc8b('0x19')](_0x36c122);}return _0x2d16a2['status'](_0x36c122)[_0xfc8b('0x1a')]();};}function respondWithResult(_0x1a9572,_0x5c7958){_0x5c7958=_0x5c7958||0xc8;return function(_0x78eb76){if(_0x78eb76){return _0x1a9572[_0xfc8b('0x1b')](_0x5c7958)[_0xfc8b('0x1c')](_0x78eb76);}};}function respondWithFilteredResult(_0x1c3141,_0x206039){return function(_0x1a32a0){if(_0x1a32a0){var _0x4bfee8=typeof _0x206039[_0xfc8b('0x1d')]===_0xfc8b('0x1e')&&typeof _0x206039['limit']===_0xfc8b('0x1e');var _0x3e4bc5=_0x1a32a0[_0xfc8b('0x1f')];var _0x49a80f=_0x4bfee8?0x0:_0x206039[_0xfc8b('0x1d')];var _0x3ef7c5=_0x4bfee8?_0x1a32a0['count']:_0x206039[_0xfc8b('0x1d')]+_0x206039[_0xfc8b('0x20')];var _0x36f38a;if(_0x3ef7c5>=_0x3e4bc5){_0x3ef7c5=_0x3e4bc5;_0x36f38a=0xc8;}else{_0x36f38a=0xce;}_0x1c3141[_0xfc8b('0x1b')](_0x36f38a);return _0x1c3141[_0xfc8b('0x21')]('Content-Range',_0x49a80f+'-'+_0x3ef7c5+'/'+_0x3e4bc5)['json'](_0x1a32a0);}return null;};}function patchUpdates(_0x8af353){return function(_0x348b06){try{jsonpatch[_0xfc8b('0x22')](_0x348b06,_0x8af353,!![]);}catch(_0x40bbc3){return BPromise[_0xfc8b('0x23')](_0x40bbc3);}return _0x348b06[_0xfc8b('0x24')]();};}function saveUpdates(_0x1da466,_0x3ad123){return function(_0x50ac51){if(_0x50ac51){return _0x50ac51['update'](_0x1da466)[_0xfc8b('0x25')](function(_0x5f3afd){return _0x5f3afd;});}return null;};}function removeEntity(_0x9ca658,_0x416f04){return function(_0x38add3){if(_0x38add3){return _0x38add3['destroy']()[_0xfc8b('0x25')](function(){_0x9ca658['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50dd73,_0x59b2bf){return function(_0x5345ed){if(!_0x5345ed){_0x50dd73[_0xfc8b('0x19')](0x194);}return _0x5345ed;};}function handleError(_0x29e056,_0x44514c){_0x44514c=_0x44514c||0x1f4;return function(_0x59c0dd){logger[_0xfc8b('0x26')](_0x59c0dd[_0xfc8b('0x27')]);if(_0x59c0dd[_0xfc8b('0x28')]){delete _0x59c0dd[_0xfc8b('0x28')];}_0x29e056['status'](_0x44514c)[_0xfc8b('0x29')](_0x59c0dd);};}exports[_0xfc8b('0x2a')]=function(_0x52b3ba,_0x346578){var _0x2f468c={},_0x5837bb={},_0x75ff72={'count':0x0,'rows':[]};var _0x108d66=_['map'](db['ZendeskField'][_0xfc8b('0x2b')],function(_0x5821e0){return{'name':_0x5821e0[_0xfc8b('0x2c')],'type':_0x5821e0[_0xfc8b('0x2d')][_0xfc8b('0x2e')]};});_0x5837bb[_0xfc8b('0x2f')]=_['map'](_0x108d66,_0xfc8b('0x28'));_0x5837bb['query']=_[_0xfc8b('0x30')](_0x52b3ba[_0xfc8b('0x31')]);_0x5837bb[_0xfc8b('0x32')]=_[_0xfc8b('0x33')](_0x5837bb[_0xfc8b('0x2f')],_0x5837bb[_0xfc8b('0x31')]);_0x2f468c['attributes']=_['intersection'](_0x5837bb[_0xfc8b('0x2f')],qs[_0xfc8b('0x34')](_0x52b3ba['query'][_0xfc8b('0x34')]));_0x2f468c['attributes']=_0x2f468c[_0xfc8b('0x35')]['length']?_0x2f468c[_0xfc8b('0x35')]:_0x5837bb[_0xfc8b('0x2f')];if(!_0x52b3ba[_0xfc8b('0x31')][_0xfc8b('0x36')](_0xfc8b('0x37'))){_0x2f468c[_0xfc8b('0x20')]=qs[_0xfc8b('0x20')](_0x52b3ba[_0xfc8b('0x31')]['limit']);_0x2f468c[_0xfc8b('0x1d')]=qs[_0xfc8b('0x1d')](_0x52b3ba['query'][_0xfc8b('0x1d')]);}_0x2f468c[_0xfc8b('0x38')]=qs[_0xfc8b('0x39')](_0x52b3ba['query']['sort']);_0x2f468c[_0xfc8b('0x3a')]=qs[_0xfc8b('0x32')](_[_0xfc8b('0x3b')](_0x52b3ba['query'],_0x5837bb[_0xfc8b('0x32')]),_0x108d66);if(_0x52b3ba[_0xfc8b('0x31')][_0xfc8b('0x3c')]){_0x2f468c[_0xfc8b('0x3a')]=_['merge'](_0x2f468c[_0xfc8b('0x3a')],{'$or':_[_0xfc8b('0x3d')](_0x108d66,function(_0x2d4b3b){if(_0x2d4b3b[_0xfc8b('0x2d')]!==_0xfc8b('0x3e')){var _0x28d963={};_0x28d963[_0x2d4b3b['name']]={'$like':'%'+_0x52b3ba[_0xfc8b('0x31')]['filter']+'%'};return _0x28d963;}})});}_0x2f468c=_[_0xfc8b('0x3f')]({},_0x2f468c,_0x52b3ba[_0xfc8b('0x40')]);var _0xb5a348={'where':_0x2f468c['where']};return db[_0xfc8b('0x41')]['count'](_0xb5a348)[_0xfc8b('0x25')](function(_0x4ffc3d){_0x75ff72[_0xfc8b('0x1f')]=_0x4ffc3d;if(_0x52b3ba[_0xfc8b('0x31')][_0xfc8b('0x42')]){_0x2f468c['include']=[{'all':!![]}];}return db['ZendeskField'][_0xfc8b('0x43')](_0x2f468c);})[_0xfc8b('0x25')](function(_0x1cbd4e){_0x75ff72[_0xfc8b('0x44')]=_0x1cbd4e;return _0x75ff72;})[_0xfc8b('0x25')](respondWithFilteredResult(_0x346578,_0x2f468c))[_0xfc8b('0x45')](handleError(_0x346578,null));};exports[_0xfc8b('0x46')]=function(_0x52f6a2,_0x475781){var _0x5c9d7d={'raw':!![],'where':{'id':_0x52f6a2[_0xfc8b('0x47')]['id']}},_0x287b2c={};_0x287b2c['model']=_[_0xfc8b('0x30')](db[_0xfc8b('0x41')]['rawAttributes']);_0x287b2c['query']=_[_0xfc8b('0x30')](_0x52f6a2[_0xfc8b('0x31')]);_0x287b2c['filters']=_['intersection'](_0x287b2c[_0xfc8b('0x2f')],_0x287b2c[_0xfc8b('0x31')]);_0x5c9d7d[_0xfc8b('0x35')]=_[_0xfc8b('0x33')](_0x287b2c[_0xfc8b('0x2f')],qs[_0xfc8b('0x34')](_0x52f6a2[_0xfc8b('0x31')][_0xfc8b('0x34')]));_0x5c9d7d['attributes']=_0x5c9d7d[_0xfc8b('0x35')]['length']?_0x5c9d7d[_0xfc8b('0x35')]:_0x287b2c[_0xfc8b('0x2f')];if(_0x52f6a2[_0xfc8b('0x31')][_0xfc8b('0x42')]){_0x5c9d7d[_0xfc8b('0x48')]=[{'all':!![]}];}_0x5c9d7d=_['merge']({},_0x5c9d7d,_0x52f6a2['options']);return db[_0xfc8b('0x41')][_0xfc8b('0x49')](_0x5c9d7d)[_0xfc8b('0x25')](handleEntityNotFound(_0x475781,null))[_0xfc8b('0x25')](respondWithResult(_0x475781,null))['catch'](handleError(_0x475781,null));};exports[_0xfc8b('0x4a')]=function(_0x4916d4,_0x3360cd){return db['ZendeskField'][_0xfc8b('0x4a')](_0x4916d4[_0xfc8b('0x4b')],{})[_0xfc8b('0x25')](respondWithResult(_0x3360cd,0xc9))[_0xfc8b('0x45')](handleError(_0x3360cd,null));};exports[_0xfc8b('0x4c')]=function(_0x19146a,_0x310bbd){if(_0x19146a[_0xfc8b('0x4b')]['id']){delete _0x19146a['body']['id'];}return db['ZendeskField'][_0xfc8b('0x49')]({'where':{'id':_0x19146a[_0xfc8b('0x47')]['id']}})[_0xfc8b('0x25')](handleEntityNotFound(_0x310bbd,null))[_0xfc8b('0x25')](saveUpdates(_0x19146a[_0xfc8b('0x4b')],null))[_0xfc8b('0x25')](respondWithResult(_0x310bbd,null))[_0xfc8b('0x45')](handleError(_0x310bbd,null));};exports[_0xfc8b('0x4d')]=function(_0x5cac2a,_0x20fc8b){return db['ZendeskField'][_0xfc8b('0x49')]({'where':{'id':_0x5cac2a[_0xfc8b('0x47')]['id']}})[_0xfc8b('0x25')](handleEntityNotFound(_0x20fc8b,null))['then'](removeEntity(_0x20fc8b,null))[_0xfc8b('0x45')](handleError(_0x20fc8b,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index e7414a2..07b4b76 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 _0x52a3=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZendeskField','zendesk_unique_index','idField','FieldId','lodash'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x52a3,0x125));var _0x352a=function(_0x6b08b9,_0x3ab1b9){_0x6b08b9=_0x6b08b9-0x0;var _0x385ec4=_0x52a3[_0x6b08b9];return _0x385ec4;};'use strict';var _=require(_0x352a('0x0'));var util=require('util');var logger=require(_0x352a('0x1'))(_0x352a('0x2'));var moment=require('moment');var BPromise=require(_0x352a('0x3'));var rp=require(_0x352a('0x4'));var fs=require('fs');var path=require(_0x352a('0x5'));var rimraf=require(_0x352a('0x6'));var config=require(_0x352a('0x7'));var attributes=require('./intZendeskField.attributes');module[_0x352a('0x8')]=function(_0x5480c2,_0x3df9d5){return _0x5480c2[_0x352a('0x9')](_0x352a('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x352a('0xb'),'fields':[_0x352a('0xc'),_0x352a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x19d9=['zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x19d9,0x113));var _0x919d=function(_0x2055e5,_0x560bf1){_0x2055e5=_0x2055e5-0x0;var _0x3d509c=_0x19d9[_0x2055e5];return _0x3d509c;};'use strict';var _=require(_0x919d('0x0'));var util=require(_0x919d('0x1'));var logger=require(_0x919d('0x2'))(_0x919d('0x3'));var moment=require(_0x919d('0x4'));var BPromise=require(_0x919d('0x5'));var rp=require(_0x919d('0x6'));var fs=require('fs');var path=require(_0x919d('0x7'));var rimraf=require(_0x919d('0x8'));var config=require('../../config/environment');var attributes=require(_0x919d('0x9'));module[_0x919d('0xa')]=function(_0x5ba2aa,_0x35a623){return _0x5ba2aa[_0x919d('0xb')](_0x919d('0xc'),attributes,{'tableName':_0x919d('0xd'),'paranoid':![],'indexes':[{'name':_0x919d('0xe'),'fields':[_0x919d('0xf'),_0x919d('0x10')],'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 381629c..485d603 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 _0x63de=['stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x12d951,_0x249808){var _0x44de17=function(_0x182fd9){while(--_0x182fd9){_0x12d951['push'](_0x12d951['shift']());}};_0x44de17(++_0x249808);}(_0x63de,0x69));var _0xe63d=function(_0x338e75,_0x592261){_0x338e75=_0x338e75-0x0;var _0x42401f=_0x63de[_0x338e75];return _0x42401f;};'use strict';var _=require(_0xe63d('0x0'));var util=require(_0xe63d('0x1'));var moment=require('moment');var BPromise=require(_0xe63d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe63d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe63d('0x4'));var logger=require(_0xe63d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe63d('0x6'));var client=jayson[_0xe63d('0x7')][_0xe63d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5817cb,_0x578e8e,_0x6205f8){return new BPromise(function(_0x37896c,_0x215aab){return client[_0xe63d('0x9')](_0x5817cb,_0x6205f8)[_0xe63d('0xa')](function(_0xddb19a){logger[_0xe63d('0xb')](_0xe63d('0xc'),_0x578e8e,_0xe63d('0xd'));logger[_0xe63d('0xe')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x578e8e,_0xe63d('0xd'),JSON[_0xe63d('0xf')](_0xddb19a));if(_0xddb19a[_0xe63d('0x10')]){if(_0xddb19a[_0xe63d('0x10')][_0xe63d('0x11')]===0x1f4){logger[_0xe63d('0x10')](_0xe63d('0xc'),_0x578e8e,_0xddb19a['error'][_0xe63d('0x12')]);return _0x215aab(_0xddb19a['error']['message']);}logger[_0xe63d('0x10')](_0xe63d('0xc'),_0x578e8e,_0xddb19a[_0xe63d('0x10')][_0xe63d('0x12')]);return _0x37896c(_0xddb19a[_0xe63d('0x10')][_0xe63d('0x12')]);}else{logger[_0xe63d('0xb')](_0xe63d('0xc'),_0x578e8e,_0xe63d('0xd'));_0x37896c(_0xddb19a['result'][_0xe63d('0x12')]);}})[_0xe63d('0x13')](function(_0x20d96f){logger[_0xe63d('0x10')](_0xe63d('0xc'),_0x578e8e,_0x20d96f);_0x215aab(_0x20d96f);});});} \ No newline at end of file +var _0x1cec=['ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x3a4fd1,_0x3a81f8){var _0x51c3fd=function(_0x2c49fe){while(--_0x2c49fe){_0x3a4fd1['push'](_0x3a4fd1['shift']());}};_0x51c3fd(++_0x3a81f8);}(_0x1cec,0x180));var _0xc1ce=function(_0x20401d,_0x2d3125){_0x20401d=_0x20401d-0x0;var _0x2a63c4=_0x1cec[_0x20401d];return _0x2a63c4;};'use strict';var _=require(_0xc1ce('0x0'));var util=require('util');var moment=require(_0xc1ce('0x1'));var BPromise=require('bluebird');var rs=require(_0xc1ce('0x2'));var fs=require('fs');var Redis=require(_0xc1ce('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1ce('0x4'));var logger=require(_0xc1ce('0x5'))(_0xc1ce('0x6'));var config=require(_0xc1ce('0x7'));var jayson=require(_0xc1ce('0x8'));var client=jayson[_0xc1ce('0x9')][_0xc1ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x466c0f,_0x5db52b,_0x2cdda1){return new BPromise(function(_0x7dec61,_0xe2494d){return client[_0xc1ce('0xb')](_0x466c0f,_0x2cdda1)[_0xc1ce('0xc')](function(_0x1e4c35){logger['info'](_0xc1ce('0xd'),_0x5db52b,_0xc1ce('0xe'));logger['debug'](_0xc1ce('0xf'),_0x5db52b,_0xc1ce('0xe'),JSON['stringify'](_0x1e4c35));if(_0x1e4c35[_0xc1ce('0x10')]){if(_0x1e4c35['error'][_0xc1ce('0x11')]===0x1f4){logger[_0xc1ce('0x10')](_0xc1ce('0xd'),_0x5db52b,_0x1e4c35[_0xc1ce('0x10')][_0xc1ce('0x12')]);return _0xe2494d(_0x1e4c35['error'][_0xc1ce('0x12')]);}logger[_0xc1ce('0x10')](_0xc1ce('0xd'),_0x5db52b,_0x1e4c35[_0xc1ce('0x10')][_0xc1ce('0x12')]);return _0x7dec61(_0x1e4c35[_0xc1ce('0x10')]['message']);}else{logger[_0xc1ce('0x13')](_0xc1ce('0xd'),_0x5db52b,'request\x20sent');_0x7dec61(_0x1e4c35['result'][_0xc1ce('0x12')]);}})[_0xc1ce('0x14')](function(_0x36c427){logger[_0xc1ce('0x10')](_0xc1ce('0xd'),_0x5db52b,_0x36c427);_0xe2494d(_0x36c427);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 2a5c855..b54f0b8 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 _0x30bd=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','post','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x1b2262,_0x4bfbc9){var _0x9fdebb=function(_0x32c763){while(--_0x32c763){_0x1b2262['push'](_0x1b2262['shift']());}};_0x9fdebb(++_0x4bfbc9);}(_0x30bd,0x9e));var _0xd30b=function(_0x504934,_0x168b4f){_0x504934=_0x504934-0x0;var _0x32372f=_0x30bd[_0x504934];return _0x32372f;};'use strict';var multer=require('multer');var util=require(_0xd30b('0x0'));var path=require(_0xd30b('0x1'));var timeout=require(_0xd30b('0x2'));var express=require('express');var router=express[_0xd30b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd30b('0x4'));var interaction=require(_0xd30b('0x5'));var config=require(_0xd30b('0x6'));var controller=require(_0xd30b('0x7'));router[_0xd30b('0x8')]('/',auth[_0xd30b('0x9')](),controller[_0xd30b('0xa')]);router['get'](_0xd30b('0xb'),auth[_0xd30b('0x9')](),controller[_0xd30b('0xc')]);router[_0xd30b('0x8')]('/:id/configurations',auth[_0xd30b('0x9')](),controller[_0xd30b('0xd')]);router['get']('/:id/fields',auth[_0xd30b('0x9')](),controller[_0xd30b('0xe')]);router[_0xd30b('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd30b('0xf')](_0xd30b('0x10'),auth[_0xd30b('0x9')](),controller[_0xd30b('0x11')]);router[_0xd30b('0x12')]('/:id',auth[_0xd30b('0x9')](),controller[_0xd30b('0x13')]);router[_0xd30b('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xd30b('0x15')]);module[_0xd30b('0x16')]=router; \ No newline at end of file +var _0xfae1=['../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','exports','multer','util','express','Router','fs-extra'];(function(_0x440319,_0x33e0c1){var _0x377d9d=function(_0x4a684c){while(--_0x4a684c){_0x440319['push'](_0x440319['shift']());}};_0x377d9d(++_0x33e0c1);}(_0xfae1,0x69));var _0x1fae=function(_0x3b264c,_0x45707b){_0x3b264c=_0x3b264c-0x0;var _0x51994e=_0xfae1[_0x3b264c];return _0x51994e;};'use strict';var multer=require(_0x1fae('0x0'));var util=require(_0x1fae('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1fae('0x2'));var router=express[_0x1fae('0x3')]();var fs_extra=require(_0x1fae('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1fae('0x5'));var config=require(_0x1fae('0x6'));var controller=require(_0x1fae('0x7'));router[_0x1fae('0x8')]('/',auth[_0x1fae('0x9')](),controller[_0x1fae('0xa')]);router[_0x1fae('0x8')](_0x1fae('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x1fae('0xc'),auth['isAuthenticated'](),controller[_0x1fae('0xd')]);router[_0x1fae('0x8')](_0x1fae('0xe'),auth[_0x1fae('0x9')](),controller['getFields']);router[_0x1fae('0xf')]('/',auth[_0x1fae('0x9')](),controller[_0x1fae('0x10')]);router[_0x1fae('0xf')](_0x1fae('0xc'),auth[_0x1fae('0x9')](),controller[_0x1fae('0x11')]);router[_0x1fae('0x12')](_0x1fae('0xb'),auth[_0x1fae('0x9')](),controller[_0x1fae('0x13')]);router[_0x1fae('0x14')]('/:id',auth[_0x1fae('0x9')](),controller['destroy']);module[_0x1fae('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 10df9ea..b93c8b6 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 _0xa75b=['sequelize','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa75b,0x170));var _0xba75=function(_0xd5130d,_0x246351){_0xd5130d=_0xd5130d-0x0;var _0x359dad=_0xa75b[_0xd5130d];return _0x359dad;};'use strict';var Sequelize=require(_0xba75('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xba75('0x1')]},'host':{'type':Sequelize[_0xba75('0x1')]},'zone':{'type':Sequelize[_0xba75('0x1')]},'clientId':{'type':Sequelize[_0xba75('0x1')]},'clientSecret':{'type':Sequelize[_0xba75('0x1')]},'serverUrl':{'type':Sequelize[_0xba75('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xba75('0x1')]},'refreshToken':{'type':Sequelize[_0xba75('0x1')]}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING'];(function(_0x3a1cca,_0xf9cf7e){var _0x53b71c=function(_0x56c49f){while(--_0x56c49f){_0x3a1cca['push'](_0x3a1cca['shift']());}};_0x53b71c(++_0xf9cf7e);}(_0x34e8,0x12c));var _0x834e=function(_0x53bb62,_0x138655){_0x53bb62=_0x53bb62-0x0;var _0x455833=_0x34e8[_0x53bb62];return _0x455833;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')]},'description':{'type':Sequelize[_0x834e('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x834e('0x2')]},'clientId':{'type':Sequelize[_0x834e('0x2')]},'clientSecret':{'type':Sequelize[_0x834e('0x2')]},'serverUrl':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x834e('0x2')]},'refreshToken':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index e3c4c19..9a1880f 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 _0x8f87=['channel','Descriptions','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','refreshToken','clientId','clientSecret','access_token','host','serverUrl','code','com','substring','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','api_name','system_mandatory','push','display_label','data_type','picklist','pick_list_values','test','statusCode','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','ZohoAccount','includeAll','include','findAll','catch','fields','find','create','body','params','getConfigurations','findOne','ZohoConfiguration','Subjects'];(function(_0x5ce31a,_0x1a53a8){var _0x49ab70=function(_0x262d81){while(--_0x262d81){_0x5ce31a['push'](_0x5ce31a['shift']());}};_0x49ab70(++_0x1a53a8);}(_0x8f87,0x1a9));var _0x78f8=function(_0x3fd3a3,_0x36c863){_0x3fd3a3=_0x3fd3a3-0x0;var _0xa3e4d5=_0x8f87[_0x3fd3a3];return _0xa3e4d5;};'use strict';var emlformat=require(_0x78f8('0x0'));var rimraf=require(_0x78f8('0x1'));var zipdir=require(_0x78f8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x78f8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x78f8('0x4'));var util=require(_0x78f8('0x5'));var path=require(_0x78f8('0x6'));var sox=require(_0x78f8('0x7'));var csv=require(_0x78f8('0x8'));var ejs=require(_0x78f8('0x9'));var fs=require('fs');var fs_extra=require(_0x78f8('0xa'));var _=require(_0x78f8('0xb'));var squel=require(_0x78f8('0xc'));var crypto=require(_0x78f8('0xd'));var jsforce=require(_0x78f8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x78f8('0x8'));var querystring=require(_0x78f8('0xf'));var Papa=require(_0x78f8('0x10'));var Redis=require(_0x78f8('0x11'));var authService=require(_0x78f8('0x12'));var qs=require(_0x78f8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x78f8('0x14'));var config=require(_0x78f8('0x15'));var licenseUtil=require(_0x78f8('0x16'));var db=require(_0x78f8('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xa04f28,_0x49072c){_0x49072c=_0x49072c||0xcc;return function(_0x26bed7){if(_0x26bed7){return _0xa04f28['sendStatus'](_0x49072c);}return _0xa04f28[_0x78f8('0x18')](_0x49072c)['end']();};}function respondWithResult(_0x2ae2a8,_0x3f88da){_0x3f88da=_0x3f88da||0xc8;return function(_0x87dc16){if(_0x87dc16){return _0x2ae2a8[_0x78f8('0x18')](_0x3f88da)[_0x78f8('0x19')](_0x87dc16);}};}function respondWithFilteredResult(_0x4fa2ab,_0x364b28){return function(_0x344a6e){if(_0x344a6e){var _0x112db3=typeof _0x364b28[_0x78f8('0x1a')]==='undefined'&&typeof _0x364b28[_0x78f8('0x1b')]===_0x78f8('0x1c');var _0x445391=_0x344a6e[_0x78f8('0x1d')];var _0x15579b=_0x112db3?0x0:_0x364b28[_0x78f8('0x1a')];var _0x26f510=_0x112db3?_0x344a6e[_0x78f8('0x1d')]:_0x364b28['offset']+_0x364b28[_0x78f8('0x1b')];var _0x398f14;if(_0x26f510>=_0x445391){_0x26f510=_0x445391;_0x398f14=0xc8;}else{_0x398f14=0xce;}_0x4fa2ab[_0x78f8('0x18')](_0x398f14);return _0x4fa2ab[_0x78f8('0x1e')](_0x78f8('0x1f'),_0x15579b+'-'+_0x26f510+'/'+_0x445391)[_0x78f8('0x19')](_0x344a6e);}return null;};}function patchUpdates(_0x1d592e){return function(_0x272df7){try{jsonpatch[_0x78f8('0x20')](_0x272df7,_0x1d592e,!![]);}catch(_0x319474){return BPromise[_0x78f8('0x21')](_0x319474);}return _0x272df7[_0x78f8('0x22')]();};}function saveUpdates(_0x5734f7,_0x1a4ad2){return function(_0x220a94){if(_0x220a94){return _0x220a94[_0x78f8('0x23')](_0x5734f7)[_0x78f8('0x24')](function(_0x2cccd9){return _0x2cccd9;});}return null;};}function removeEntity(_0x54cb8c,_0x530741){return function(_0x20fe1a){if(_0x20fe1a){return _0x20fe1a[_0x78f8('0x25')]()[_0x78f8('0x24')](function(){_0x54cb8c[_0x78f8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x338ecd,_0x13c9eb){return function(_0x56f9ed){if(!_0x56f9ed){_0x338ecd[_0x78f8('0x26')](0x194);}return _0x56f9ed;};}function handleError(_0x3b64d9,_0x5d9b3d){_0x5d9b3d=_0x5d9b3d||0x1f4;return function(_0x42a39b){logger[_0x78f8('0x27')](_0x42a39b[_0x78f8('0x28')]);if(_0x42a39b['name']){delete _0x42a39b[_0x78f8('0x29')];}_0x3b64d9[_0x78f8('0x18')](_0x5d9b3d)[_0x78f8('0x2a')](_0x42a39b);};}exports[_0x78f8('0x2b')]=function(_0x4406f1,_0x32f5f7){var _0xffee2b={},_0x17fbb3={},_0x4b707c={'count':0x0,'rows':[]};var _0x419ac1=_[_0x78f8('0x2c')](db['ZohoAccount'][_0x78f8('0x2d')],function(_0x47876c){return{'name':_0x47876c[_0x78f8('0x2e')],'type':_0x47876c[_0x78f8('0x2f')][_0x78f8('0x30')]};});_0x17fbb3[_0x78f8('0x31')]=_[_0x78f8('0x2c')](_0x419ac1,_0x78f8('0x29'));_0x17fbb3['query']=_[_0x78f8('0x32')](_0x4406f1[_0x78f8('0x33')]);_0x17fbb3['filters']=_[_0x78f8('0x34')](_0x17fbb3[_0x78f8('0x31')],_0x17fbb3[_0x78f8('0x33')]);_0xffee2b['attributes']=_[_0x78f8('0x34')](_0x17fbb3['model'],qs['fields'](_0x4406f1[_0x78f8('0x33')]['fields']));_0xffee2b['attributes']=_0xffee2b[_0x78f8('0x35')][_0x78f8('0x36')]?_0xffee2b['attributes']:_0x17fbb3[_0x78f8('0x31')];if(!_0x4406f1[_0x78f8('0x33')][_0x78f8('0x37')](_0x78f8('0x38'))){_0xffee2b[_0x78f8('0x1b')]=qs[_0x78f8('0x1b')](_0x4406f1[_0x78f8('0x33')][_0x78f8('0x1b')]);_0xffee2b[_0x78f8('0x1a')]=qs[_0x78f8('0x1a')](_0x4406f1['query']['offset']);}_0xffee2b[_0x78f8('0x39')]=qs[_0x78f8('0x3a')](_0x4406f1[_0x78f8('0x33')][_0x78f8('0x3a')]);_0xffee2b[_0x78f8('0x3b')]=qs[_0x78f8('0x3c')](_[_0x78f8('0x3d')](_0x4406f1[_0x78f8('0x33')],_0x17fbb3[_0x78f8('0x3c')]),_0x419ac1);if(_0x4406f1[_0x78f8('0x33')][_0x78f8('0x3e')]){_0xffee2b['where']=_[_0x78f8('0x3f')](_0xffee2b[_0x78f8('0x3b')],{'$or':_[_0x78f8('0x2c')](_0x419ac1,function(_0x554ab6){if(_0x554ab6['type']!=='VIRTUAL'){var _0x19f6b9={};_0x19f6b9[_0x554ab6[_0x78f8('0x29')]]={'$like':'%'+_0x4406f1['query'][_0x78f8('0x3e')]+'%'};return _0x19f6b9;}})});}_0xffee2b=_['merge']({},_0xffee2b,_0x4406f1[_0x78f8('0x40')]);var _0xdd1fbb={'where':_0xffee2b[_0x78f8('0x3b')]};return db[_0x78f8('0x41')][_0x78f8('0x1d')](_0xdd1fbb)[_0x78f8('0x24')](function(_0x4c7d40){_0x4b707c[_0x78f8('0x1d')]=_0x4c7d40;if(_0x4406f1[_0x78f8('0x33')][_0x78f8('0x42')]){_0xffee2b[_0x78f8('0x43')]=[{'all':!![]}];}return db[_0x78f8('0x41')][_0x78f8('0x44')](_0xffee2b);})[_0x78f8('0x24')](function(_0x329da5){_0x4b707c['rows']=_0x329da5;return _0x4b707c;})[_0x78f8('0x24')](respondWithFilteredResult(_0x32f5f7,_0xffee2b))[_0x78f8('0x45')](handleError(_0x32f5f7,null));};exports['show']=function(_0x249375,_0x2120ee){var _0x2327ce={'raw':![],'where':{'id':_0x249375['params']['id']}},_0x1c7330={};_0x1c7330[_0x78f8('0x31')]=_[_0x78f8('0x32')](db[_0x78f8('0x41')][_0x78f8('0x2d')]);_0x1c7330['query']=_['keys'](_0x249375[_0x78f8('0x33')]);_0x1c7330[_0x78f8('0x3c')]=_[_0x78f8('0x34')](_0x1c7330['model'],_0x1c7330['query']);_0x2327ce[_0x78f8('0x35')]=_['intersection'](_0x1c7330[_0x78f8('0x31')],qs[_0x78f8('0x46')](_0x249375[_0x78f8('0x33')]['fields']));_0x2327ce['attributes']=_0x2327ce[_0x78f8('0x35')][_0x78f8('0x36')]?_0x2327ce[_0x78f8('0x35')]:_0x1c7330['model'];if(_0x249375[_0x78f8('0x33')]['includeAll']){_0x2327ce[_0x78f8('0x43')]=[{'all':!![]}];}_0x2327ce=_[_0x78f8('0x3f')]({},_0x2327ce,_0x249375[_0x78f8('0x40')]);return db[_0x78f8('0x41')][_0x78f8('0x47')](_0x2327ce)[_0x78f8('0x24')](handleEntityNotFound(_0x2120ee,null))[_0x78f8('0x24')](respondWithResult(_0x2120ee,null))[_0x78f8('0x45')](handleError(_0x2120ee,null));};exports[_0x78f8('0x48')]=function(_0x59b868,_0x1d09f7){return db[_0x78f8('0x41')][_0x78f8('0x48')](_0x59b868[_0x78f8('0x49')],{})[_0x78f8('0x24')](respondWithResult(_0x1d09f7,0xc9))[_0x78f8('0x45')](handleError(_0x1d09f7,null));};exports[_0x78f8('0x23')]=function(_0x990b38,_0x26b0ae){if(_0x990b38[_0x78f8('0x49')]['id']){delete _0x990b38['body']['id'];}return db[_0x78f8('0x41')][_0x78f8('0x47')]({'where':{'id':_0x990b38[_0x78f8('0x4a')]['id']}})[_0x78f8('0x24')](handleEntityNotFound(_0x26b0ae,null))[_0x78f8('0x24')](saveUpdates(_0x990b38[_0x78f8('0x49')],null))[_0x78f8('0x24')](respondWithResult(_0x26b0ae,null))['catch'](handleError(_0x26b0ae,null));};exports[_0x78f8('0x25')]=function(_0x42d4dc,_0x435ce3){return db[_0x78f8('0x41')][_0x78f8('0x47')]({'where':{'id':_0x42d4dc['params']['id']}})[_0x78f8('0x24')](handleEntityNotFound(_0x435ce3,null))[_0x78f8('0x24')](removeEntity(_0x435ce3,null))[_0x78f8('0x45')](handleError(_0x435ce3,null));};exports[_0x78f8('0x4b')]=function(_0x47abca,_0x3a2fb8,_0x178767){var _0x1f9f43={};var _0x1c64a0={};var _0x1376c3;var _0x3a8f95;return db[_0x78f8('0x41')][_0x78f8('0x4c')]({'where':{'id':_0x47abca[_0x78f8('0x4a')]['id']}})[_0x78f8('0x24')](handleEntityNotFound(_0x3a2fb8,null))[_0x78f8('0x24')](function(_0x50b47e){if(_0x50b47e){_0x1376c3=_0x50b47e;_0x1c64a0[_0x78f8('0x31')]=_['keys'](db[_0x78f8('0x4d')][_0x78f8('0x2d')]);_0x1c64a0[_0x78f8('0x33')]=_['keys'](_0x47abca['query']);_0x1c64a0[_0x78f8('0x3c')]=_['intersection'](_0x1c64a0[_0x78f8('0x31')],_0x1c64a0[_0x78f8('0x33')]);_0x1f9f43[_0x78f8('0x35')]=_['intersection'](_0x1c64a0['model'],qs[_0x78f8('0x46')](_0x47abca[_0x78f8('0x33')][_0x78f8('0x46')]));_0x1f9f43[_0x78f8('0x35')]=_0x1f9f43[_0x78f8('0x35')]['length']?_0x1f9f43[_0x78f8('0x35')]:_0x1c64a0['model'];_0x1f9f43[_0x78f8('0x39')]=qs['sort'](_0x47abca['query']['sort']);_0x1f9f43[_0x78f8('0x3b')]=qs[_0x78f8('0x3c')](_[_0x78f8('0x3d')](_0x47abca[_0x78f8('0x33')],_0x1c64a0['filters']));if(_0x47abca[_0x78f8('0x33')][_0x78f8('0x3e')]){_0x1f9f43[_0x78f8('0x3b')]=_['merge'](_0x1f9f43[_0x78f8('0x3b')],{'$or':_[_0x78f8('0x2c')](_0x1f9f43[_0x78f8('0x35')],function(_0x50599d){var _0x5d7404={};_0x5d7404[_0x50599d]={'$like':'%'+_0x47abca[_0x78f8('0x33')][_0x78f8('0x3e')]+'%'};return _0x5d7404;})});}_0x1f9f43=_[_0x78f8('0x3f')]({},_0x1f9f43,_0x47abca['options']);return _0x1376c3['getConfigurations'](_0x1f9f43);}})['then'](function(_0x3d8181){if(_0x3d8181){_0x3a8f95=_0x3d8181[_0x78f8('0x36')];if(!_0x47abca[_0x78f8('0x33')][_0x78f8('0x37')](_0x78f8('0x38'))){_0x1f9f43[_0x78f8('0x1b')]=qs[_0x78f8('0x1b')](_0x47abca['query']['limit']);_0x1f9f43[_0x78f8('0x1a')]=qs['offset'](_0x47abca['query'][_0x78f8('0x1a')]);}return _0x1376c3['getConfigurations'](_0x1f9f43);}})[_0x78f8('0x24')](function(_0x3ac90c){if(_0x3ac90c){return _0x3ac90c?{'count':_0x3a8f95,'rows':_0x3ac90c}:null;}})[_0x78f8('0x24')](respondWithResult(_0x3a2fb8,null))[_0x78f8('0x45')](handleError(_0x3a2fb8,null));};exports['addConfiguration']=function(_0x30cd6f,_0x57f886,_0x4157a3){if(_0x30cd6f[_0x78f8('0x49')]['id']){delete _0x30cd6f[_0x78f8('0x49')]['id'];}return db[_0x78f8('0x41')]['findOne']({'where':{'id':_0x30cd6f[_0x78f8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x57f886,null))[_0x78f8('0x24')](function(_0x4f4276){if(_0x4f4276){_0x30cd6f[_0x78f8('0x49')]['AccountId']=_0x4f4276['id'];_0x30cd6f['body'][_0x78f8('0x4e')]=integrations['getSubjects'](_0x30cd6f[_0x78f8('0x49')][_0x78f8('0x4f')],_0x30cd6f[_0x78f8('0x49')][_0x78f8('0x2f')]);_0x30cd6f[_0x78f8('0x49')][_0x78f8('0x50')]=integrations['getDescriptions'](_0x30cd6f[_0x78f8('0x49')]['channel'],_0x30cd6f[_0x78f8('0x49')][_0x78f8('0x2f')]);return db[_0x78f8('0x4d')]['create'](_0x30cd6f[_0x78f8('0x49')],{'include':[{'model':db[_0x78f8('0x51')],'as':_0x78f8('0x4e')},{'model':db[_0x78f8('0x51')],'as':_0x78f8('0x50')}]});}return null;})[_0x78f8('0x24')](respondWithResult(_0x57f886,null))[_0x78f8('0x45')](handleError(_0x57f886,null));};function getAccessToken(_0x2c843a){return new Promise(function(_0x46e22c,_0x4f3faf){var _0x4b040f;switch(_0x2c843a[_0x78f8('0x52')]){case'US':_0x4b040f=_0x78f8('0x53');break;case'AU':_0x4b040f=_0x78f8('0x54');break;case'EU':_0x4b040f=_0x78f8('0x55');break;case'IN':_0x4b040f=_0x78f8('0x56');break;case'CN':_0x4b040f=_0x78f8('0x57');break;default:_0x4b040f='https://accounts.zoho.eu';break;}var _0x14e233={'method':_0x78f8('0x58'),'uri':_0x4b040f+_0x78f8('0x59'),'qs':{'refresh_token':_0x2c843a[_0x78f8('0x5a')],'client_id':_0x2c843a[_0x78f8('0x5b')],'client_secret':_0x2c843a[_0x78f8('0x5c')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x14e233)[_0x78f8('0x24')](function(_0x106c29){if(_0x106c29[_0x78f8('0x5d')]){_0x46e22c(_0x106c29[_0x78f8('0x5d')]);}else{_0x4f3faf('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x78f8('0x45')](function(_0x1be595){_0x4f3faf(_0x1be595);});});}exports['getFields']=function(_0x25e707,_0x2cc270,_0x4e7b40){var _0x379914,_0x33e55b,_0x282981,_0x7da627,_0x468608;return db[_0x78f8('0x41')][_0x78f8('0x4c')]({'where':{'id':_0x25e707[_0x78f8('0x4a')]['id']},'attributes':['id',_0x78f8('0x5e'),_0x78f8('0x52'),_0x78f8('0x5b'),_0x78f8('0x5c'),_0x78f8('0x5f'),_0x78f8('0x60'),_0x78f8('0x5a')]})[_0x78f8('0x24')](handleEntityNotFound(_0x2cc270,null))['then'](function(_0x4e24b2){_0x468608=_0x4e24b2;_0x379914=_0x468608['host'];_0x33e55b=_0x379914==='zoho.eu'?'eu':_0x78f8('0x61');_0x282981=_0x468608[_0x78f8('0x5f')];var _0x19bc02=_0x282981['slice'](-0x1);if(_0x19bc02==='/'||_0x19bc02==='\x5c'||_0x19bc02===':'){_0x282981=_0x282981[_0x78f8('0x62')](0x0,_0x282981[_0x78f8('0x63')](_0x19bc02));}if(!_0x468608['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x468608);})[_0x78f8('0x24')](function(_0x16b173){if(_0x16b173){return rp({'method':_0x78f8('0x64'),'uri':util[_0x78f8('0x65')](_0x78f8('0x66'),_0x33e55b),'qs':{'module':'Calls'},'headers':{'Authorization':_0x78f8('0x67')+_0x16b173},'json':!![]});}})[_0x78f8('0x24')](function(_0x23b067){if(_0x23b067){if(_0x23b067[_0x78f8('0x68')]&&_0x23b067['response'][_0x78f8('0x27')]){throw new Error(_0x23b067[_0x78f8('0x68')]['error'][_0x78f8('0x69')]);}var _0x1296ce=[];var _0x44d96e=[];var _0x1297d1=[_0x78f8('0x6a'),_0x78f8('0x6b'),_0x78f8('0x6c'),_0x78f8('0x6d'),_0x78f8('0x6e'),_0x78f8('0x6f'),_0x78f8('0x70'),_0x78f8('0x71')];_0x44d96e=_[_0x78f8('0x72')](_0x23b067['fields'],function(_0x3cf737){return _0x1297d1['includes'](_0x3cf737[_0x78f8('0x73')]);});for(var _0x452eeb=0x0;_0x452eeb<_0x44d96e[_0x78f8('0x36')];_0x452eeb++){if(_0x44d96e[_0x452eeb][_0x78f8('0x74')]===![]){_0x1296ce[_0x78f8('0x75')]({'id':_0x44d96e[_0x452eeb]['id'],'name':_0x44d96e[_0x452eeb][_0x78f8('0x76')],'custom':_0x44d96e[_0x452eeb]['custom_field'],'options':_0x44d96e[_0x452eeb][_0x78f8('0x77')]===_0x78f8('0x78')&&_0x44d96e[_0x452eeb][_0x78f8('0x79')]['length']>-0x1?_[_0x78f8('0x2c')](_0x44d96e[_0x452eeb][_0x78f8('0x79')],function(_0x3a52dd){return{'name':_0x3a52dd,'value':_0x3a52dd};}):[]});}}return{'count':_0x1296ce['length'],'rows':_0x1296ce};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x2cc270,null))[_0x78f8('0x45')](function(_0x4f1ce4){var _0x49a6b0=_0x25e707[_0x78f8('0x33')][_0x78f8('0x7a')]?0x1f4:_0x4f1ce4[_0x78f8('0x7b')]||0x1f4;logger[_0x78f8('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x78f8('0x7c'),_0x49a6b0,JSON['stringify'](_0x4f1ce4));delete _0x4f1ce4[_0x78f8('0x29')];if(_0x49a6b0===0x191){_0x49a6b0=0x190;}_0x2cc270[_0x78f8('0x18')](_0x49a6b0)[_0x78f8('0x2a')](_0x25e707[_0x78f8('0x33')][_0x78f8('0x7a')]?{'message':_0x78f8('0x7d'),'statusCode':_0x4f1ce4['statusCode']}:_0x4f1ce4);});}; \ No newline at end of file +var _0x6103=['includes','api_name','system_mandatory','push','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','ZohoAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','rawAttributes','fields','include','find','create','body','getConfigurations','ZohoConfiguration','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','clientSecret','host','zoho.eu','com','substring','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Subject','Description','Call_Result','Call_Start_Time','Call_Type'];(function(_0x158733,_0x11c9d6){var _0x4cf0f5=function(_0x181d15){while(--_0x181d15){_0x158733['push'](_0x158733['shift']());}};_0x4cf0f5(++_0x11c9d6);}(_0x6103,0x182));var _0x3610=function(_0x5c725c,_0x2106b5){_0x5c725c=_0x5c725c-0x0;var _0x59a1e2=_0x6103[_0x5c725c];return _0x59a1e2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3610('0x0'));var zipdir=require(_0x3610('0x1'));var jsonpatch=require(_0x3610('0x2'));var rp=require(_0x3610('0x3'));var moment=require(_0x3610('0x4'));var BPromise=require(_0x3610('0x5'));var Mustache=require('mustache');var util=require(_0x3610('0x6'));var path=require(_0x3610('0x7'));var sox=require(_0x3610('0x8'));var csv=require(_0x3610('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3610('0xa'));var _=require('lodash');var squel=require(_0x3610('0xb'));var crypto=require(_0x3610('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3610('0x9'));var querystring=require(_0x3610('0xd'));var Papa=require(_0x3610('0xe'));var Redis=require(_0x3610('0xf'));var authService=require(_0x3610('0x10'));var qs=require(_0x3610('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3610('0x12'));var logger=require(_0x3610('0x13'))(_0x3610('0x14'));var utils=require(_0x3610('0x15'));var config=require(_0x3610('0x16'));var licenseUtil=require(_0x3610('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x575654,_0x34e51a){_0x34e51a=_0x34e51a||0xcc;return function(_0x32d756){if(_0x32d756){return _0x575654[_0x3610('0x18')](_0x34e51a);}return _0x575654['status'](_0x34e51a)['end']();};}function respondWithResult(_0x25beba,_0x318c24){_0x318c24=_0x318c24||0xc8;return function(_0x66db83){if(_0x66db83){return _0x25beba[_0x3610('0x19')](_0x318c24)['json'](_0x66db83);}};}function respondWithFilteredResult(_0x5381cf,_0x396670){return function(_0x1c751a){if(_0x1c751a){var _0x171533=typeof _0x396670[_0x3610('0x1a')]===_0x3610('0x1b')&&typeof _0x396670[_0x3610('0x1c')]===_0x3610('0x1b');var _0x48ea4c=_0x1c751a[_0x3610('0x1d')];var _0x497f4c=_0x171533?0x0:_0x396670[_0x3610('0x1a')];var _0xc14a37=_0x171533?_0x1c751a[_0x3610('0x1d')]:_0x396670[_0x3610('0x1a')]+_0x396670[_0x3610('0x1c')];var _0x24358e;if(_0xc14a37>=_0x48ea4c){_0xc14a37=_0x48ea4c;_0x24358e=0xc8;}else{_0x24358e=0xce;}_0x5381cf[_0x3610('0x19')](_0x24358e);return _0x5381cf[_0x3610('0x1e')](_0x3610('0x1f'),_0x497f4c+'-'+_0xc14a37+'/'+_0x48ea4c)[_0x3610('0x20')](_0x1c751a);}return null;};}function patchUpdates(_0x57622f){return function(_0x328e58){try{jsonpatch[_0x3610('0x21')](_0x328e58,_0x57622f,!![]);}catch(_0x2eab53){return BPromise['reject'](_0x2eab53);}return _0x328e58[_0x3610('0x22')]();};}function saveUpdates(_0x579bf8,_0x4f712c){return function(_0x1d398c){if(_0x1d398c){return _0x1d398c[_0x3610('0x23')](_0x579bf8)[_0x3610('0x24')](function(_0x5d5488){return _0x5d5488;});}return null;};}function removeEntity(_0x589174,_0x5a98a8){return function(_0x1c3695){if(_0x1c3695){return _0x1c3695[_0x3610('0x25')]()[_0x3610('0x24')](function(){_0x589174[_0x3610('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ef6c9,_0x5f5261){return function(_0x4d5d9f){if(!_0x4d5d9f){_0x5ef6c9[_0x3610('0x18')](0x194);}return _0x4d5d9f;};}function handleError(_0x388517,_0x44d98b){_0x44d98b=_0x44d98b||0x1f4;return function(_0x4e6850){logger[_0x3610('0x26')](_0x4e6850[_0x3610('0x27')]);if(_0x4e6850[_0x3610('0x28')]){delete _0x4e6850[_0x3610('0x28')];}_0x388517[_0x3610('0x19')](_0x44d98b)[_0x3610('0x29')](_0x4e6850);};}exports['index']=function(_0xd8cc1,_0x15f3f1){var _0xf880dd={},_0x190d9a={},_0xf2b6b6={'count':0x0,'rows':[]};var _0x19aa4e=_[_0x3610('0x2a')](db[_0x3610('0x2b')]['rawAttributes'],function(_0x2e41c1){return{'name':_0x2e41c1[_0x3610('0x2c')],'type':_0x2e41c1[_0x3610('0x2d')][_0x3610('0x2e')]};});_0x190d9a[_0x3610('0x2f')]=_[_0x3610('0x2a')](_0x19aa4e,_0x3610('0x28'));_0x190d9a[_0x3610('0x30')]=_[_0x3610('0x31')](_0xd8cc1[_0x3610('0x30')]);_0x190d9a[_0x3610('0x32')]=_[_0x3610('0x33')](_0x190d9a[_0x3610('0x2f')],_0x190d9a[_0x3610('0x30')]);_0xf880dd['attributes']=_[_0x3610('0x33')](_0x190d9a['model'],qs['fields'](_0xd8cc1[_0x3610('0x30')]['fields']));_0xf880dd[_0x3610('0x34')]=_0xf880dd[_0x3610('0x34')][_0x3610('0x35')]?_0xf880dd[_0x3610('0x34')]:_0x190d9a[_0x3610('0x2f')];if(!_0xd8cc1[_0x3610('0x30')]['hasOwnProperty'](_0x3610('0x36'))){_0xf880dd['limit']=qs[_0x3610('0x1c')](_0xd8cc1['query'][_0x3610('0x1c')]);_0xf880dd[_0x3610('0x1a')]=qs[_0x3610('0x1a')](_0xd8cc1[_0x3610('0x30')]['offset']);}_0xf880dd[_0x3610('0x37')]=qs[_0x3610('0x38')](_0xd8cc1[_0x3610('0x30')]['sort']);_0xf880dd[_0x3610('0x39')]=qs[_0x3610('0x32')](_[_0x3610('0x3a')](_0xd8cc1[_0x3610('0x30')],_0x190d9a[_0x3610('0x32')]),_0x19aa4e);if(_0xd8cc1[_0x3610('0x30')]['filter']){_0xf880dd[_0x3610('0x39')]=_[_0x3610('0x3b')](_0xf880dd[_0x3610('0x39')],{'$or':_[_0x3610('0x2a')](_0x19aa4e,function(_0x56f504){if(_0x56f504['type']!==_0x3610('0x3c')){var _0x3c441b={};_0x3c441b[_0x56f504[_0x3610('0x28')]]={'$like':'%'+_0xd8cc1[_0x3610('0x30')][_0x3610('0x3d')]+'%'};return _0x3c441b;}})});}_0xf880dd=_[_0x3610('0x3b')]({},_0xf880dd,_0xd8cc1[_0x3610('0x3e')]);var _0x2cfc72={'where':_0xf880dd[_0x3610('0x39')]};return db['ZohoAccount'][_0x3610('0x1d')](_0x2cfc72)[_0x3610('0x24')](function(_0x1ab356){_0xf2b6b6[_0x3610('0x1d')]=_0x1ab356;if(_0xd8cc1[_0x3610('0x30')][_0x3610('0x3f')]){_0xf880dd['include']=[{'all':!![]}];}return db[_0x3610('0x2b')][_0x3610('0x40')](_0xf880dd);})[_0x3610('0x24')](function(_0x166a6e){_0xf2b6b6['rows']=_0x166a6e;return _0xf2b6b6;})['then'](respondWithFilteredResult(_0x15f3f1,_0xf880dd))[_0x3610('0x41')](handleError(_0x15f3f1,null));};exports[_0x3610('0x42')]=function(_0x2122eb,_0x5e6ca3){var _0x300c22={'raw':![],'where':{'id':_0x2122eb[_0x3610('0x43')]['id']}},_0x57965b={};_0x57965b[_0x3610('0x2f')]=_[_0x3610('0x31')](db[_0x3610('0x2b')][_0x3610('0x44')]);_0x57965b[_0x3610('0x30')]=_[_0x3610('0x31')](_0x2122eb['query']);_0x57965b['filters']=_[_0x3610('0x33')](_0x57965b['model'],_0x57965b[_0x3610('0x30')]);_0x300c22[_0x3610('0x34')]=_[_0x3610('0x33')](_0x57965b['model'],qs[_0x3610('0x45')](_0x2122eb[_0x3610('0x30')]['fields']));_0x300c22['attributes']=_0x300c22[_0x3610('0x34')][_0x3610('0x35')]?_0x300c22[_0x3610('0x34')]:_0x57965b[_0x3610('0x2f')];if(_0x2122eb['query'][_0x3610('0x3f')]){_0x300c22[_0x3610('0x46')]=[{'all':!![]}];}_0x300c22=_[_0x3610('0x3b')]({},_0x300c22,_0x2122eb[_0x3610('0x3e')]);return db[_0x3610('0x2b')][_0x3610('0x47')](_0x300c22)[_0x3610('0x24')](handleEntityNotFound(_0x5e6ca3,null))[_0x3610('0x24')](respondWithResult(_0x5e6ca3,null))[_0x3610('0x41')](handleError(_0x5e6ca3,null));};exports[_0x3610('0x48')]=function(_0x33652e,_0x3f8074){return db[_0x3610('0x2b')][_0x3610('0x48')](_0x33652e[_0x3610('0x49')],{})[_0x3610('0x24')](respondWithResult(_0x3f8074,0xc9))[_0x3610('0x41')](handleError(_0x3f8074,null));};exports['update']=function(_0x48ebdf,_0x3722ba){if(_0x48ebdf[_0x3610('0x49')]['id']){delete _0x48ebdf[_0x3610('0x49')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x48ebdf['params']['id']}})[_0x3610('0x24')](handleEntityNotFound(_0x3722ba,null))['then'](saveUpdates(_0x48ebdf[_0x3610('0x49')],null))[_0x3610('0x24')](respondWithResult(_0x3722ba,null))[_0x3610('0x41')](handleError(_0x3722ba,null));};exports['destroy']=function(_0x25d1e7,_0x33c0c6){return db[_0x3610('0x2b')]['find']({'where':{'id':_0x25d1e7[_0x3610('0x43')]['id']}})[_0x3610('0x24')](handleEntityNotFound(_0x33c0c6,null))[_0x3610('0x24')](removeEntity(_0x33c0c6,null))[_0x3610('0x41')](handleError(_0x33c0c6,null));};exports[_0x3610('0x4a')]=function(_0x47c5dd,_0x29ba89,_0x37de40){var _0x1be932={};var _0x4047df={};var _0x2f920c;var _0x4b766b;return db[_0x3610('0x2b')]['findOne']({'where':{'id':_0x47c5dd['params']['id']}})[_0x3610('0x24')](handleEntityNotFound(_0x29ba89,null))[_0x3610('0x24')](function(_0x1cbea3){if(_0x1cbea3){_0x2f920c=_0x1cbea3;_0x4047df[_0x3610('0x2f')]=_[_0x3610('0x31')](db[_0x3610('0x4b')][_0x3610('0x44')]);_0x4047df[_0x3610('0x30')]=_[_0x3610('0x31')](_0x47c5dd[_0x3610('0x30')]);_0x4047df['filters']=_[_0x3610('0x33')](_0x4047df[_0x3610('0x2f')],_0x4047df[_0x3610('0x30')]);_0x1be932[_0x3610('0x34')]=_[_0x3610('0x33')](_0x4047df[_0x3610('0x2f')],qs[_0x3610('0x45')](_0x47c5dd[_0x3610('0x30')][_0x3610('0x45')]));_0x1be932[_0x3610('0x34')]=_0x1be932[_0x3610('0x34')][_0x3610('0x35')]?_0x1be932[_0x3610('0x34')]:_0x4047df[_0x3610('0x2f')];_0x1be932[_0x3610('0x37')]=qs['sort'](_0x47c5dd['query']['sort']);_0x1be932[_0x3610('0x39')]=qs[_0x3610('0x32')](_[_0x3610('0x3a')](_0x47c5dd[_0x3610('0x30')],_0x4047df[_0x3610('0x32')]));if(_0x47c5dd[_0x3610('0x30')][_0x3610('0x3d')]){_0x1be932[_0x3610('0x39')]=_[_0x3610('0x3b')](_0x1be932[_0x3610('0x39')],{'$or':_[_0x3610('0x2a')](_0x1be932[_0x3610('0x34')],function(_0x5a003b){var _0x565a92={};_0x565a92[_0x5a003b]={'$like':'%'+_0x47c5dd['query'][_0x3610('0x3d')]+'%'};return _0x565a92;})});}_0x1be932=_['merge']({},_0x1be932,_0x47c5dd[_0x3610('0x3e')]);return _0x2f920c[_0x3610('0x4a')](_0x1be932);}})['then'](function(_0x487cd9){if(_0x487cd9){_0x4b766b=_0x487cd9['length'];if(!_0x47c5dd['query'][_0x3610('0x4c')](_0x3610('0x36'))){_0x1be932[_0x3610('0x1c')]=qs[_0x3610('0x1c')](_0x47c5dd[_0x3610('0x30')][_0x3610('0x1c')]);_0x1be932[_0x3610('0x1a')]=qs[_0x3610('0x1a')](_0x47c5dd[_0x3610('0x30')][_0x3610('0x1a')]);}return _0x2f920c['getConfigurations'](_0x1be932);}})[_0x3610('0x24')](function(_0x5cebd2){if(_0x5cebd2){return _0x5cebd2?{'count':_0x4b766b,'rows':_0x5cebd2}:null;}})[_0x3610('0x24')](respondWithResult(_0x29ba89,null))[_0x3610('0x41')](handleError(_0x29ba89,null));};exports[_0x3610('0x4d')]=function(_0x5092f3,_0x5dc9d9,_0x254d36){if(_0x5092f3[_0x3610('0x49')]['id']){delete _0x5092f3['body']['id'];}return db[_0x3610('0x2b')]['findOne']({'where':{'id':_0x5092f3['params']['id']}})[_0x3610('0x24')](handleEntityNotFound(_0x5dc9d9,null))[_0x3610('0x24')](function(_0xab7eba){if(_0xab7eba){_0x5092f3['body']['AccountId']=_0xab7eba['id'];_0x5092f3['body'][_0x3610('0x4e')]=integrations[_0x3610('0x4f')](_0x5092f3['body'][_0x3610('0x50')],_0x5092f3['body']['type']);_0x5092f3[_0x3610('0x49')][_0x3610('0x51')]=integrations[_0x3610('0x52')](_0x5092f3[_0x3610('0x49')]['channel'],_0x5092f3[_0x3610('0x49')][_0x3610('0x2d')]);return db['ZohoConfiguration'][_0x3610('0x48')](_0x5092f3[_0x3610('0x49')],{'include':[{'model':db['ZohoField'],'as':_0x3610('0x4e')},{'model':db[_0x3610('0x53')],'as':_0x3610('0x51')}]});}return null;})[_0x3610('0x24')](respondWithResult(_0x5dc9d9,null))[_0x3610('0x41')](handleError(_0x5dc9d9,null));};function getAccessToken(_0x3b8944){return new Promise(function(_0x129d10,_0x57cb11){var _0x125cd1;switch(_0x3b8944[_0x3610('0x54')]){case'US':_0x125cd1='https://accounts.zoho.com';break;case'AU':_0x125cd1=_0x3610('0x55');break;case'EU':_0x125cd1=_0x3610('0x56');break;case'IN':_0x125cd1=_0x3610('0x57');break;case'CN':_0x125cd1='https://accounts.zoho.com.cn';break;default:_0x125cd1='https://accounts.zoho.eu';break;}var _0x25c16c={'method':_0x3610('0x58'),'uri':_0x125cd1+_0x3610('0x59'),'qs':{'refresh_token':_0x3b8944[_0x3610('0x5a')],'client_id':_0x3b8944[_0x3610('0x5b')],'client_secret':_0x3b8944['clientSecret'],'grant_type':_0x3610('0x5c')},'json':!![]};return rp(_0x25c16c)[_0x3610('0x24')](function(_0x2f2ab6){if(_0x2f2ab6[_0x3610('0x5d')]){_0x129d10(_0x2f2ab6['access_token']);}else{_0x57cb11(_0x3610('0x5e'));}})['catch'](function(_0x574c74){_0x57cb11(_0x574c74);});});}exports[_0x3610('0x5f')]=function(_0x51429f,_0x3eeee0,_0x585bdb){var _0x5c44f9,_0x53ce80,_0x36ca43,_0x3faef6,_0x2d6469;return db['ZohoAccount']['findOne']({'where':{'id':_0x51429f[_0x3610('0x43')]['id']},'attributes':['id','host',_0x3610('0x54'),'clientId',_0x3610('0x60'),'serverUrl','code',_0x3610('0x5a')]})['then'](handleEntityNotFound(_0x3eeee0,null))[_0x3610('0x24')](function(_0x1a19ae){_0x2d6469=_0x1a19ae;_0x5c44f9=_0x2d6469[_0x3610('0x61')];_0x53ce80=_0x5c44f9===_0x3610('0x62')?'eu':_0x3610('0x63');_0x36ca43=_0x2d6469['serverUrl'];var _0x2c8d8=_0x36ca43['slice'](-0x1);if(_0x2c8d8==='/'||_0x2c8d8==='\x5c'||_0x2c8d8===':'){_0x36ca43=_0x36ca43[_0x3610('0x64')](0x0,_0x36ca43[_0x3610('0x65')](_0x2c8d8));}if(!_0x2d6469[_0x3610('0x5a')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x2d6469);})[_0x3610('0x24')](function(_0x3d624a){if(_0x3d624a){return rp({'method':_0x3610('0x66'),'uri':util[_0x3610('0x67')](_0x3610('0x68'),_0x53ce80),'qs':{'module':_0x3610('0x69')},'headers':{'Authorization':_0x3610('0x6a')+_0x3d624a},'json':!![]});}})[_0x3610('0x24')](function(_0x520ad5){if(_0x520ad5){if(_0x520ad5[_0x3610('0x6b')]&&_0x520ad5[_0x3610('0x6b')]['error']){throw new Error(_0x520ad5['response'][_0x3610('0x26')][_0x3610('0x6c')]);}var _0x31f24f=[];var _0x4a2d8f=[];var _0x2db672=['Owner',_0x3610('0x6d'),_0x3610('0x6e'),'WhoId','Call_Duration',_0x3610('0x6f'),_0x3610('0x70'),_0x3610('0x71')];_0x4a2d8f=_['remove'](_0x520ad5[_0x3610('0x45')],function(_0x2f992c){return _0x2db672[_0x3610('0x72')](_0x2f992c[_0x3610('0x73')]);});for(var _0x125d52=0x0;_0x125d52<_0x4a2d8f[_0x3610('0x35')];_0x125d52++){if(_0x4a2d8f[_0x125d52][_0x3610('0x74')]===![]){_0x31f24f[_0x3610('0x75')]({'id':_0x4a2d8f[_0x125d52]['id'],'name':_0x4a2d8f[_0x125d52]['display_label'],'custom':_0x4a2d8f[_0x125d52]['custom_field'],'options':_0x4a2d8f[_0x125d52]['data_type']===_0x3610('0x76')&&_0x4a2d8f[_0x125d52][_0x3610('0x77')][_0x3610('0x35')]>-0x1?_[_0x3610('0x2a')](_0x4a2d8f[_0x125d52][_0x3610('0x77')],function(_0xc45c5){return{'name':_0xc45c5,'value':_0xc45c5};}):[]});}}return{'count':_0x31f24f['length'],'rows':_0x31f24f};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x3eeee0,null))['catch'](function(_0x61f97){var _0x382155=_0x51429f[_0x3610('0x30')][_0x3610('0x78')]?0x1f4:_0x61f97[_0x3610('0x79')]||0x1f4;logger[_0x3610('0x26')](_0x3610('0x7a'),'getFields',_0x382155,JSON[_0x3610('0x7b')](_0x61f97));delete _0x61f97['name'];if(_0x382155===0x191){_0x382155=0x190;}_0x3eeee0[_0x3610('0x19')](_0x382155)[_0x3610('0x29')](_0x51429f[_0x3610('0x30')][_0x3610('0x78')]?{'message':_0x3610('0x7c'),'statusCode':_0x61f97[_0x3610('0x79')]}:_0x61f97);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 5a03e9a..0a771b8 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 _0xf5f2=['application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','catch','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','lastIndexOf','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','code','host','serverUrl','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret'];(function(_0x1fe791,_0x3f2a6f){var _0xeecdc3=function(_0x37c087){while(--_0x37c087){_0x1fe791['push'](_0x1fe791['shift']());}};_0xeecdc3(++_0x3f2a6f);}(_0xf5f2,0xea));var _0x2f5f=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xf5f2[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0x2f5f('0x0'));var util=require(_0x2f5f('0x1'));var logger=require('../../config/logger')(_0x2f5f('0x2'));var moment=require(_0x2f5f('0x3'));var BPromise=require(_0x2f5f('0x4'));var rp=require(_0x2f5f('0x5'));var fs=require('fs');var path=require(_0x2f5f('0x6'));var rimraf=require(_0x2f5f('0x7'));var config=require(_0x2f5f('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x2f5f('0x9'));module['exports']=function(_0x776f20,_0x13250b){return _0x776f20[_0x2f5f('0xa')](_0x2f5f('0xb'),attributes,{'tableName':_0x2f5f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3e27f9,_0x507415,_0xc39884){if(_0x3e27f9[_0x2f5f('0xd')](_0x2f5f('0xe'))||_0x3e27f9[_0x2f5f('0xd')]('serverUrl')||_0x3e27f9['changed'](_0x2f5f('0xf'))||_0x3e27f9[_0x2f5f('0xd')]('clientSecret')||_0x3e27f9['changed'](_0x2f5f('0x10'))||_0x3e27f9[_0x2f5f('0xd')](_0x2f5f('0x11'))){var _0x5507c3,_0x4128cb;_0x5507c3=_0x3e27f9[_0x2f5f('0x12')];var _0x1536f4=_0x5507c3[_0x2f5f('0x13')](-0x1);if(_0x1536f4==='/'||_0x1536f4==='\x5c'||_0x1536f4===':'){_0x5507c3=_0x5507c3[_0x2f5f('0x14')](0x0,_0x5507c3['lastIndexOf'](_0x1536f4));}switch(_0x3e27f9['zone']){case'US':_0x4128cb=_0x2f5f('0x15');break;case'AU':_0x4128cb=_0x2f5f('0x16');break;case'IN':_0x4128cb=_0x2f5f('0x17');break;case'CN':_0x4128cb=_0x2f5f('0x18');break;default:_0x4128cb=_0x2f5f('0x19');break;}var _0x23966f={'method':_0x2f5f('0x1a'),'uri':_0x4128cb+_0x2f5f('0x1b'),'form':{'grant_type':_0x2f5f('0x1c'),'client_id':_0x3e27f9['clientId'],'client_secret':_0x3e27f9[_0x2f5f('0x1d')],'redirect_uri':_0x3e27f9[_0x2f5f('0x12')],'code':_0x3e27f9[_0x2f5f('0x10')]},'headers':{'Content-Type':_0x2f5f('0x1e')}};return rp(_0x23966f)[_0x2f5f('0x1f')](function(_0x5dae1d){var _0x12a300=JSON[_0x2f5f('0x20')](_0x5dae1d);if(_0x12a300[_0x2f5f('0x21')]){_0x3e27f9[_0x2f5f('0x22')]=_0x12a300[_0x2f5f('0x21')];logger[_0x2f5f('0x23')](util[_0x2f5f('0x24')](_0x2f5f('0x25'),_0x3e27f9[_0x2f5f('0x26')],_0x3e27f9['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3e27f9[_0x2f5f('0x26')],_0x3e27f9['id']),util['inspect'](_0x12a300,{'showHidden':![],'depth':null}));}return _0xc39884(null,_0x507415);})[_0x2f5f('0x27')](function(_0x1d06c8){logger[_0x2f5f('0x28')](util[_0x2f5f('0x24')](_0x2f5f('0x29'),_0x3e27f9[_0x2f5f('0x26')],_0x3e27f9['id']),util[_0x2f5f('0x2a')](parsedResult,{'showHidden':![],'depth':null}));return _0xc39884(_0x1d06c8);});}else{return _0xc39884(null,_0x507415);}},'beforeUpdate':function(_0x10e278,_0x50ec6d,_0x1cf41a){if(_0x10e278['changed'](_0x2f5f('0xe'))||_0x10e278['changed']('serverUrl')||_0x10e278['changed']('clientId')||_0x10e278['changed']('clientSecret')||_0x10e278[_0x2f5f('0xd')](_0x2f5f('0x10'))||_0x10e278[_0x2f5f('0xd')](_0x2f5f('0x11'))){var _0x5db6e8,_0x21fdee;_0x5db6e8=_0x10e278[_0x2f5f('0x12')];var _0x103d9a=_0x5db6e8[_0x2f5f('0x13')](-0x1);if(_0x103d9a==='/'||_0x103d9a==='\x5c'||_0x103d9a===':'){_0x5db6e8=_0x5db6e8[_0x2f5f('0x14')](0x0,_0x5db6e8[_0x2f5f('0x2b')](_0x103d9a));}switch(_0x10e278[_0x2f5f('0xe')]){case'US':_0x21fdee=_0x2f5f('0x15');break;case'AU':_0x21fdee=_0x2f5f('0x16');break;case'IN':_0x21fdee=_0x2f5f('0x17');break;case'CN':_0x21fdee=_0x2f5f('0x18');break;default:_0x21fdee=_0x2f5f('0x19');break;}var _0x57fe6f={'method':_0x2f5f('0x1a'),'uri':_0x21fdee+'/oauth/v2/token','form':{'grant_type':_0x2f5f('0x1c'),'client_id':_0x10e278[_0x2f5f('0xf')],'client_secret':_0x10e278['clientSecret'],'redirect_uri':_0x10e278[_0x2f5f('0x12')],'code':_0x10e278[_0x2f5f('0x10')]},'headers':{'Content-Type':_0x2f5f('0x1e')}};return rp(_0x57fe6f)['then'](function(_0x1cdd26){var _0x57fa9e=JSON['parse'](_0x1cdd26);if(_0x57fa9e[_0x2f5f('0x21')]){_0x10e278['refreshToken']=_0x57fa9e[_0x2f5f('0x21')];logger[_0x2f5f('0x23')](util[_0x2f5f('0x24')](_0x2f5f('0x25'),_0x10e278['name'],_0x10e278['id']));}else{logger['error'](util[_0x2f5f('0x24')](_0x2f5f('0x29'),_0x10e278['name'],_0x10e278['id']),util[_0x2f5f('0x2a')](_0x57fa9e,{'showHidden':![],'depth':null}));}return _0x1cf41a(null,_0x50ec6d);})[_0x2f5f('0x27')](function(_0x53fd64){logger[_0x2f5f('0x28')](util[_0x2f5f('0x24')](_0x2f5f('0x29'),_0x10e278['name'],_0x10e278['id']),util[_0x2f5f('0x2a')](parsedResult,{'showHidden':![],'depth':null}));return _0x1cf41a(_0x53fd64);});}else{return _0x1cf41a(null,_0x50ec6d);}}}});}; \ No newline at end of file +var _0x19ba=['ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','slice','https://accounts.zoho.com.au','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','clientId','clientSecret','serverUrl','substring','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token','info','format','error'];(function(_0x4ecd76,_0x79f1f3){var _0x240f34=function(_0x563f79){while(--_0x563f79){_0x4ecd76['push'](_0x4ecd76['shift']());}};_0x240f34(++_0x79f1f3);}(_0x19ba,0x150));var _0xa19b=function(_0x1f4a62,_0x24192a){_0x1f4a62=_0x1f4a62-0x0;var _0x2a9fe7=_0x19ba[_0x1f4a62];return _0x2a9fe7;};'use strict';var _=require(_0xa19b('0x0'));var util=require(_0xa19b('0x1'));var logger=require(_0xa19b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa19b('0x3'));var rp=require(_0xa19b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa19b('0x5'));var config=require(_0xa19b('0x6'));var attributes=require(_0xa19b('0x7'));var integrations=require(_0xa19b('0x8'));module[_0xa19b('0x9')]=function(_0xae383,_0x36beee){return _0xae383[_0xa19b('0xa')](_0xa19b('0xb'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1d234c,_0x3cfb59,_0x279c58){if(_0x1d234c[_0xa19b('0xc')](_0xa19b('0xd'))||_0x1d234c[_0xa19b('0xc')]('serverUrl')||_0x1d234c[_0xa19b('0xc')](_0xa19b('0xe'))||_0x1d234c[_0xa19b('0xc')](_0xa19b('0xf'))||_0x1d234c[_0xa19b('0xc')]('code')||_0x1d234c[_0xa19b('0xc')]('host')){var _0x5a16da,_0x346833;_0x5a16da=_0x1d234c[_0xa19b('0x10')];var _0x2325e4=_0x5a16da['slice'](-0x1);if(_0x2325e4==='/'||_0x2325e4==='\x5c'||_0x2325e4===':'){_0x5a16da=_0x5a16da[_0xa19b('0x11')](0x0,_0x5a16da['lastIndexOf'](_0x2325e4));}switch(_0x1d234c[_0xa19b('0xd')]){case'US':_0x346833=_0xa19b('0x12');break;case'AU':_0x346833='https://accounts.zoho.com.au';break;case'IN':_0x346833=_0xa19b('0x13');break;case'CN':_0x346833=_0xa19b('0x14');break;default:_0x346833=_0xa19b('0x15');break;}var _0x2d38fe={'method':_0xa19b('0x16'),'uri':_0x346833+_0xa19b('0x17'),'form':{'grant_type':_0xa19b('0x18'),'client_id':_0x1d234c[_0xa19b('0xe')],'client_secret':_0x1d234c[_0xa19b('0xf')],'redirect_uri':_0x1d234c['serverUrl'],'code':_0x1d234c[_0xa19b('0x19')]},'headers':{'Content-Type':_0xa19b('0x1a')}};return rp(_0x2d38fe)[_0xa19b('0x1b')](function(_0xdfed70){var _0x1b1edc=JSON[_0xa19b('0x1c')](_0xdfed70);if(_0x1b1edc[_0xa19b('0x1d')]){_0x1d234c['refreshToken']=_0x1b1edc[_0xa19b('0x1d')];logger[_0xa19b('0x1e')](util[_0xa19b('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1d234c['name'],_0x1d234c['id']));}else{logger[_0xa19b('0x20')](util[_0xa19b('0x1f')](_0xa19b('0x21'),_0x1d234c['name'],_0x1d234c['id']),util['inspect'](_0x1b1edc,{'showHidden':![],'depth':null}));}return _0x279c58(null,_0x3cfb59);})[_0xa19b('0x22')](function(_0x23ee7b){logger['error'](util[_0xa19b('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1d234c['name'],_0x1d234c['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x279c58(_0x23ee7b);});}else{return _0x279c58(null,_0x3cfb59);}},'beforeUpdate':function(_0x467dc8,_0x5c45ad,_0x8756af){if(_0x467dc8[_0xa19b('0xc')]('zone')||_0x467dc8['changed'](_0xa19b('0x10'))||_0x467dc8['changed'](_0xa19b('0xe'))||_0x467dc8['changed']('clientSecret')||_0x467dc8[_0xa19b('0xc')]('code')||_0x467dc8[_0xa19b('0xc')]('host')){var _0x1385a8,_0x4c01f1;_0x1385a8=_0x467dc8[_0xa19b('0x10')];var _0x26a825=_0x1385a8[_0xa19b('0x23')](-0x1);if(_0x26a825==='/'||_0x26a825==='\x5c'||_0x26a825===':'){_0x1385a8=_0x1385a8[_0xa19b('0x11')](0x0,_0x1385a8['lastIndexOf'](_0x26a825));}switch(_0x467dc8[_0xa19b('0xd')]){case'US':_0x4c01f1=_0xa19b('0x12');break;case'AU':_0x4c01f1=_0xa19b('0x24');break;case'IN':_0x4c01f1='https://accounts.zoho.in';break;case'CN':_0x4c01f1=_0xa19b('0x14');break;default:_0x4c01f1=_0xa19b('0x15');break;}var _0x19a0dd={'method':_0xa19b('0x16'),'uri':_0x4c01f1+'/oauth/v2/token','form':{'grant_type':_0xa19b('0x18'),'client_id':_0x467dc8[_0xa19b('0xe')],'client_secret':_0x467dc8['clientSecret'],'redirect_uri':_0x467dc8['serverUrl'],'code':_0x467dc8['code']},'headers':{'Content-Type':_0xa19b('0x1a')}};return rp(_0x19a0dd)[_0xa19b('0x1b')](function(_0x5e537e){var _0x214ef7=JSON[_0xa19b('0x1c')](_0x5e537e);if(_0x214ef7['refresh_token']){_0x467dc8[_0xa19b('0x25')]=_0x214ef7[_0xa19b('0x1d')];logger[_0xa19b('0x1e')](util[_0xa19b('0x1f')](_0xa19b('0x26'),_0x467dc8[_0xa19b('0x27')],_0x467dc8['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x467dc8[_0xa19b('0x27')],_0x467dc8['id']),util[_0xa19b('0x28')](_0x214ef7,{'showHidden':![],'depth':null}));}return _0x8756af(null,_0x5c45ad);})[_0xa19b('0x22')](function(_0x15eb64){logger[_0xa19b('0x20')](util['format'](_0xa19b('0x21'),_0x467dc8['name'],_0x467dc8['id']),util[_0xa19b('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x8756af(_0x15eb64);});}else{return _0x8756af(null,_0x5c45ad);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 8915dd3..538fbb7 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 _0x4813=['options','where','attributes','limit','include','map','model','find','raw','ShowZohoAccount','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll'];(function(_0x35bd6c,_0x585087){var _0x2f421d=function(_0x42ae70){while(--_0x42ae70){_0x35bd6c['push'](_0x35bd6c['shift']());}};_0x2f421d(++_0x585087);}(_0x4813,0xdc));var _0x3481=function(_0xfd1255,_0x18154c){_0xfd1255=_0xfd1255-0x0;var _0x4633ce=_0x4813[_0xfd1255];return _0x4633ce;};'use strict';var _=require(_0x3481('0x0'));var util=require('util');var moment=require(_0x3481('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3481('0x2'));var db=require(_0x3481('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3481('0x4'))(_0x3481('0x5'));var config=require(_0x3481('0x6'));var jayson=require(_0x3481('0x7'));var client=jayson[_0x3481('0x8')][_0x3481('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x369c3b,_0x54a2c8,_0x4d23ef){return new BPromise(function(_0x41592f,_0x527c3c){return client[_0x3481('0xa')](_0x369c3b,_0x4d23ef)[_0x3481('0xb')](function(_0x39b6c4){logger[_0x3481('0xc')](_0x3481('0xd'),_0x54a2c8,_0x3481('0xe'));logger[_0x3481('0xf')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x54a2c8,'request\x20sent',JSON[_0x3481('0x10')](_0x39b6c4));if(_0x39b6c4[_0x3481('0x11')]){if(_0x39b6c4[_0x3481('0x11')][_0x3481('0x12')]===0x1f4){logger[_0x3481('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x54a2c8,_0x39b6c4[_0x3481('0x11')][_0x3481('0x13')]);return _0x527c3c(_0x39b6c4[_0x3481('0x11')][_0x3481('0x13')]);}logger[_0x3481('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x54a2c8,_0x39b6c4['error'][_0x3481('0x13')]);return _0x41592f(_0x39b6c4[_0x3481('0x11')]['message']);}else{logger[_0x3481('0xc')](_0x3481('0xd'),_0x54a2c8,_0x3481('0xe'));_0x41592f(_0x39b6c4[_0x3481('0x14')][_0x3481('0x13')]);}})[_0x3481('0x15')](function(_0x2a3981){logger['error'](_0x3481('0xd'),_0x54a2c8,_0x2a3981);_0x527c3c(_0x2a3981);});});}exports[_0x3481('0x16')]=function(_0x4d2ceb){var _0x46dc92=this;return new Promise(function(_0x3e6c00,_0x36fa70){return db[_0x3481('0x17')][_0x3481('0x18')]({'raw':_0x4d2ceb['options']?_0x4d2ceb[_0x3481('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4d2ceb[_0x3481('0x19')]?_0x4d2ceb['options'][_0x3481('0x1a')]||null:null,'attributes':_0x4d2ceb[_0x3481('0x19')]?_0x4d2ceb[_0x3481('0x19')][_0x3481('0x1b')]||null:null,'limit':_0x4d2ceb[_0x3481('0x19')]?_0x4d2ceb['options'][_0x3481('0x1c')]||null:null,'include':_0x4d2ceb[_0x3481('0x19')]?_0x4d2ceb[_0x3481('0x19')][_0x3481('0x1d')]?_[_0x3481('0x1e')](_0x4d2ceb['options'][_0x3481('0x1d')],function(_0x3ef2c2){return{'model':db[_0x3ef2c2['model']],'as':_0x3ef2c2['as'],'attributes':_0x3ef2c2[_0x3481('0x1b')],'include':_0x3ef2c2[_0x3481('0x1d')]?_['map'](_0x3ef2c2[_0x3481('0x1d')],function(_0x2bd432){return{'model':db[_0x2bd432[_0x3481('0x1f')]],'as':_0x2bd432['as'],'attributes':_0x2bd432[_0x3481('0x1b')],'include':_0x2bd432[_0x3481('0x1d')]?_[_0x3481('0x1e')](_0x2bd432[_0x3481('0x1d')],function(_0x4e7eca){return{'model':db[_0x4e7eca[_0x3481('0x1f')]],'as':_0x4e7eca['as'],'attributes':_0x4e7eca[_0x3481('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3481('0xb')](function(_0x1588e2){logger[_0x3481('0xc')]('GetZohoAccount',_0x4d2ceb);logger[_0x3481('0xf')](_0x3481('0x16'),_0x4d2ceb,JSON[_0x3481('0x10')](_0x1588e2));_0x3e6c00(_0x1588e2);})[_0x3481('0x15')](function(_0x12e5d6){logger[_0x3481('0x11')]('GetZohoAccount',_0x12e5d6[_0x3481('0x13')],_0x4d2ceb);_0x36fa70(_0x46dc92[_0x3481('0x11')](0x1f4,_0x12e5d6[_0x3481('0x13')]));});});};exports['ShowZohoAccount']=function(_0x5cc9e2){var _0x388105=this;return new Promise(function(_0x3053bb,_0x1ac644){return db[_0x3481('0x17')][_0x3481('0x20')]({'raw':_0x5cc9e2['options']?_0x5cc9e2[_0x3481('0x19')][_0x3481('0x21')]===undefined?!![]:![]:!![],'where':_0x5cc9e2['options']?_0x5cc9e2[_0x3481('0x19')][_0x3481('0x1a')]||null:null,'attributes':_0x5cc9e2[_0x3481('0x19')]?_0x5cc9e2['options']['attributes']||null:null,'include':_0x5cc9e2['options']?_0x5cc9e2[_0x3481('0x19')][_0x3481('0x1d')]?_[_0x3481('0x1e')](_0x5cc9e2['options']['include'],function(_0x5ca7df){return{'model':db[_0x5ca7df[_0x3481('0x1f')]],'as':_0x5ca7df['as'],'attributes':_0x5ca7df['attributes'],'include':_0x5ca7df['include']?_[_0x3481('0x1e')](_0x5ca7df[_0x3481('0x1d')],function(_0x134f42){return{'model':db[_0x134f42[_0x3481('0x1f')]],'as':_0x134f42['as'],'attributes':_0x134f42[_0x3481('0x1b')],'include':_0x134f42['include']?_['map'](_0x134f42[_0x3481('0x1d')],function(_0x17859c){return{'model':db[_0x17859c[_0x3481('0x1f')]],'as':_0x17859c['as'],'attributes':_0x17859c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b1dd4){logger[_0x3481('0xc')](_0x3481('0x22'),_0x5cc9e2);logger[_0x3481('0xf')]('ShowZohoAccount',_0x5cc9e2,JSON[_0x3481('0x10')](_0x5b1dd4));_0x3053bb(_0x5b1dd4);})['catch'](function(_0x15a562){logger[_0x3481('0x11')](_0x3481('0x22'),_0x15a562['message'],_0x5cc9e2);_0x1ac644(_0x388105[_0x3481('0x11')](0x1f4,_0x15a562['message']));});});}; \ No newline at end of file +var _0xb90a=['limit','include','map','model','attributes','debug','find','ShowZohoAccount','lodash','util','bluebird','rpc','../../config/environment','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetZohoAccount','ZohoAccount','options','raw','where'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb90a,0x12a));var _0xab90=function(_0x3ac9c8,_0x1eb17f){_0x3ac9c8=_0x3ac9c8-0x0;var _0xa4e42f=_0xb90a[_0x3ac9c8];return _0xa4e42f;};'use strict';var _=require(_0xab90('0x0'));var util=require(_0xab90('0x1'));var moment=require('moment');var BPromise=require(_0xab90('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xab90('0x3'));var config=require(_0xab90('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0xab90('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x426588,_0x275bf7,_0x4b28a6){return new BPromise(function(_0x2406e1,_0xc5ca04){return client[_0xab90('0x6')](_0x426588,_0x4b28a6)[_0xab90('0x7')](function(_0x93af2f){logger[_0xab90('0x8')](_0xab90('0x9'),_0x275bf7,_0xab90('0xa'));logger['debug'](_0xab90('0xb'),_0x275bf7,_0xab90('0xa'),JSON[_0xab90('0xc')](_0x93af2f));if(_0x93af2f[_0xab90('0xd')]){if(_0x93af2f[_0xab90('0xd')]['code']===0x1f4){logger[_0xab90('0xd')](_0xab90('0x9'),_0x275bf7,_0x93af2f[_0xab90('0xd')][_0xab90('0xe')]);return _0xc5ca04(_0x93af2f[_0xab90('0xd')][_0xab90('0xe')]);}logger[_0xab90('0xd')](_0xab90('0x9'),_0x275bf7,_0x93af2f[_0xab90('0xd')][_0xab90('0xe')]);return _0x2406e1(_0x93af2f[_0xab90('0xd')][_0xab90('0xe')]);}else{logger[_0xab90('0x8')]('ZohoAccount,\x20%s,\x20%s',_0x275bf7,_0xab90('0xa'));_0x2406e1(_0x93af2f['result'][_0xab90('0xe')]);}})[_0xab90('0xf')](function(_0x526bee){logger[_0xab90('0xd')](_0xab90('0x9'),_0x275bf7,_0x526bee);_0xc5ca04(_0x526bee);});});}exports[_0xab90('0x10')]=function(_0x58cc79){var _0x2ab85c=this;return new Promise(function(_0x18323a,_0x1d5222){return db[_0xab90('0x11')]['findAll']({'raw':_0x58cc79[_0xab90('0x12')]?_0x58cc79['options'][_0xab90('0x13')]===undefined?!![]:![]:!![],'where':_0x58cc79['options']?_0x58cc79[_0xab90('0x12')][_0xab90('0x14')]||null:null,'attributes':_0x58cc79[_0xab90('0x12')]?_0x58cc79[_0xab90('0x12')]['attributes']||null:null,'limit':_0x58cc79[_0xab90('0x12')]?_0x58cc79[_0xab90('0x12')][_0xab90('0x15')]||null:null,'include':_0x58cc79[_0xab90('0x12')]?_0x58cc79[_0xab90('0x12')][_0xab90('0x16')]?_[_0xab90('0x17')](_0x58cc79[_0xab90('0x12')][_0xab90('0x16')],function(_0x2cdc7f){return{'model':db[_0x2cdc7f[_0xab90('0x18')]],'as':_0x2cdc7f['as'],'attributes':_0x2cdc7f[_0xab90('0x19')],'include':_0x2cdc7f[_0xab90('0x16')]?_[_0xab90('0x17')](_0x2cdc7f['include'],function(_0x7e141c){return{'model':db[_0x7e141c[_0xab90('0x18')]],'as':_0x7e141c['as'],'attributes':_0x7e141c[_0xab90('0x19')],'include':_0x7e141c[_0xab90('0x16')]?_[_0xab90('0x17')](_0x7e141c[_0xab90('0x16')],function(_0x2cad38){return{'model':db[_0x2cad38[_0xab90('0x18')]],'as':_0x2cad38['as'],'attributes':_0x2cad38[_0xab90('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x38b3ae){logger[_0xab90('0x8')]('GetZohoAccount',_0x58cc79);logger[_0xab90('0x1a')](_0xab90('0x10'),_0x58cc79,JSON[_0xab90('0xc')](_0x38b3ae));_0x18323a(_0x38b3ae);})[_0xab90('0xf')](function(_0x24e562){logger[_0xab90('0xd')](_0xab90('0x10'),_0x24e562[_0xab90('0xe')],_0x58cc79);_0x1d5222(_0x2ab85c[_0xab90('0xd')](0x1f4,_0x24e562[_0xab90('0xe')]));});});};exports['ShowZohoAccount']=function(_0x59ed30){var _0x5671c2=this;return new Promise(function(_0x215c4b,_0x5f1359){return db[_0xab90('0x11')][_0xab90('0x1b')]({'raw':_0x59ed30[_0xab90('0x12')]?_0x59ed30[_0xab90('0x12')]['raw']===undefined?!![]:![]:!![],'where':_0x59ed30[_0xab90('0x12')]?_0x59ed30[_0xab90('0x12')][_0xab90('0x14')]||null:null,'attributes':_0x59ed30['options']?_0x59ed30['options'][_0xab90('0x19')]||null:null,'include':_0x59ed30[_0xab90('0x12')]?_0x59ed30[_0xab90('0x12')][_0xab90('0x16')]?_[_0xab90('0x17')](_0x59ed30[_0xab90('0x12')][_0xab90('0x16')],function(_0x1523bf){return{'model':db[_0x1523bf[_0xab90('0x18')]],'as':_0x1523bf['as'],'attributes':_0x1523bf[_0xab90('0x19')],'include':_0x1523bf[_0xab90('0x16')]?_['map'](_0x1523bf[_0xab90('0x16')],function(_0x1eb4d0){return{'model':db[_0x1eb4d0[_0xab90('0x18')]],'as':_0x1eb4d0['as'],'attributes':_0x1eb4d0[_0xab90('0x19')],'include':_0x1eb4d0[_0xab90('0x16')]?_['map'](_0x1eb4d0[_0xab90('0x16')],function(_0x30cea9){return{'model':db[_0x30cea9[_0xab90('0x18')]],'as':_0x30cea9['as'],'attributes':_0x30cea9['attributes']};}):[]};}):[]};}):[]:[]})[_0xab90('0x7')](function(_0x127d21){logger[_0xab90('0x8')](_0xab90('0x1c'),_0x59ed30);logger[_0xab90('0x1a')](_0xab90('0x1c'),_0x59ed30,JSON['stringify'](_0x127d21));_0x215c4b(_0x127d21);})[_0xab90('0xf')](function(_0x47e71b){logger[_0xab90('0xd')](_0xab90('0x1c'),_0x47e71b['message'],_0x59ed30);_0x5f1359(_0x5671c2[_0xab90('0xd')](0x1f4,_0x47e71b['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 7c01589..0c73ca1 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 _0x9669=['getFields','getSubjects','getDescriptions','post','create','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/fields'];(function(_0x31c931,_0x477129){var _0xda2fc8=function(_0x5521b2){while(--_0x5521b2){_0x31c931['push'](_0x31c931['shift']());}};_0xda2fc8(++_0x477129);}(_0x9669,0x1d5));var _0x9966=function(_0x93baaf,_0x2c8ee9){_0x93baaf=_0x93baaf-0x0;var _0x55bc5f=_0x9669[_0x93baaf];return _0x55bc5f;};'use strict';var multer=require(_0x9966('0x0'));var util=require('util');var path=require(_0x9966('0x1'));var timeout=require(_0x9966('0x2'));var express=require(_0x9966('0x3'));var router=express[_0x9966('0x4')]();var fs_extra=require(_0x9966('0x5'));var auth=require(_0x9966('0x6'));var interaction=require(_0x9966('0x7'));var config=require(_0x9966('0x8'));var controller=require('./intZohoConfiguration.controller');router['get']('/',auth[_0x9966('0x9')](),controller['index']);router[_0x9966('0xa')](_0x9966('0xb'),auth[_0x9966('0x9')](),controller[_0x9966('0xc')]);router[_0x9966('0xa')](_0x9966('0xd'),auth[_0x9966('0x9')](),controller[_0x9966('0xe')]);router['get']('/:id/subjects',auth[_0x9966('0x9')](),controller[_0x9966('0xf')]);router[_0x9966('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x9966('0x10')]);router[_0x9966('0x11')]('/',auth[_0x9966('0x9')](),controller[_0x9966('0x12')]);router['put'](_0x9966('0xb'),auth[_0x9966('0x9')](),controller[_0x9966('0x13')]);router['delete']('/:id',auth[_0x9966('0x9')](),controller['destroy']);module[_0x9966('0x14')]=router; \ No newline at end of file +var _0x508b=['/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields'];(function(_0x52af87,_0x3325da){var _0x33ea01=function(_0x4d83f6){while(--_0x4d83f6){_0x52af87['push'](_0x52af87['shift']());}};_0x33ea01(++_0x3325da);}(_0x508b,0x19a));var _0xb508=function(_0x112147,_0x4e692e){_0x112147=_0x112147-0x0;var _0x3ba744=_0x508b[_0x112147];return _0x3ba744;};'use strict';var multer=require(_0xb508('0x0'));var util=require(_0xb508('0x1'));var path=require(_0xb508('0x2'));var timeout=require(_0xb508('0x3'));var express=require('express');var router=express[_0xb508('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb508('0x5'));var interaction=require(_0xb508('0x6'));var config=require(_0xb508('0x7'));var controller=require(_0xb508('0x8'));router[_0xb508('0x9')]('/',auth[_0xb508('0xa')](),controller[_0xb508('0xb')]);router['get'](_0xb508('0xc'),auth[_0xb508('0xa')](),controller['show']);router['get'](_0xb508('0xd'),auth[_0xb508('0xa')](),controller[_0xb508('0xe')]);router[_0xb508('0x9')](_0xb508('0xf'),auth[_0xb508('0xa')](),controller[_0xb508('0x10')]);router[_0xb508('0x9')](_0xb508('0x11'),auth[_0xb508('0xa')](),controller['getDescriptions']);router[_0xb508('0x12')]('/',auth[_0xb508('0xa')](),controller[_0xb508('0x13')]);router[_0xb508('0x14')](_0xb508('0xc'),auth['isAuthenticated'](),controller[_0xb508('0x15')]);router[_0xb508('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xb508('0x17')]);module[_0xb508('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 4bbc921..2eef262 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 _0xf7d6=['contact','nothing','contact_lead','sequelize','exports','STRING','ENUM','lead'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xf7d6,0x93));var _0x6f7d=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xf7d6[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x6f7d('0x0'));module[_0x6f7d('0x1')]={'name':{'type':Sequelize[_0x6f7d('0x2')]},'moduleCreate':{'type':Sequelize[_0x6f7d('0x3')](_0x6f7d('0x4'),_0x6f7d('0x5'),_0x6f7d('0x6')),'defaultValue':_0x6f7d('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x6f7d('0x7'),'contact',_0x6f7d('0x4')),'defaultValue':_0x6f7d('0x7')},'description':{'type':Sequelize[_0x6f7d('0x2')]}}; \ No newline at end of file +var _0xa9c4=['exports','STRING','nothing','lead','ENUM','contact_lead','contact','sequelize'];(function(_0x50decd,_0x2996a9){var _0x17f379=function(_0x2f72b0){while(--_0x2f72b0){_0x50decd['push'](_0x50decd['shift']());}};_0x17f379(++_0x2996a9);}(_0xa9c4,0x18f));var _0x4a9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9c4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4a9c('0x0'));module[_0x4a9c('0x1')]={'name':{'type':Sequelize[_0x4a9c('0x2')]},'moduleCreate':{'type':Sequelize['ENUM']('lead','contact',_0x4a9c('0x3')),'defaultValue':_0x4a9c('0x4')},'moduleSearch':{'type':Sequelize[_0x4a9c('0x5')](_0x4a9c('0x6'),_0x4a9c('0x7'),'lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 5786b26..0da08d1 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 _0x840e=['../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getFields','findOne','ZohoField','filter','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x840e,0xdd));var _0xe840=function(_0x472378,_0x327f94){_0x472378=_0x472378-0x0;var _0x4c1e48=_0x840e[_0x472378];return _0x4c1e48;};'use strict';var emlformat=require(_0xe840('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe840('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe840('0x2'));var BPromise=require(_0xe840('0x3'));var Mustache=require('mustache');var util=require(_0xe840('0x4'));var path=require(_0xe840('0x5'));var sox=require('sox');var csv=require(_0xe840('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe840('0x7'));var _=require(_0xe840('0x8'));var squel=require(_0xe840('0x9'));var crypto=require('crypto');var jsforce=require(_0xe840('0xa'));var deskjs=require(_0xe840('0xb'));var toCsv=require(_0xe840('0x6'));var querystring=require(_0xe840('0xc'));var Papa=require(_0xe840('0xd'));var Redis=require(_0xe840('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe840('0xf'));var as=require(_0xe840('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe840('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xe840('0x12'));var licenseUtil=require(_0xe840('0x13'));var db=require(_0xe840('0x14'))['db'];function respondWithStatusCode(_0x58835c,_0x385eba){_0x385eba=_0x385eba||0xcc;return function(_0x1bc9c2){if(_0x1bc9c2){return _0x58835c[_0xe840('0x15')](_0x385eba);}return _0x58835c['status'](_0x385eba)[_0xe840('0x16')]();};}function respondWithResult(_0x19af8c,_0x11545f){_0x11545f=_0x11545f||0xc8;return function(_0x581847){if(_0x581847){return _0x19af8c[_0xe840('0x17')](_0x11545f)[_0xe840('0x18')](_0x581847);}};}function respondWithFilteredResult(_0x397034,_0x36be7d){return function(_0x17a1c0){if(_0x17a1c0){var _0x22935c=typeof _0x36be7d[_0xe840('0x19')]===_0xe840('0x1a')&&typeof _0x36be7d[_0xe840('0x1b')]===_0xe840('0x1a');var _0x3a4e1c=_0x17a1c0[_0xe840('0x1c')];var _0x3187ae=_0x22935c?0x0:_0x36be7d[_0xe840('0x19')];var _0x210cbe=_0x22935c?_0x17a1c0[_0xe840('0x1c')]:_0x36be7d[_0xe840('0x19')]+_0x36be7d['limit'];var _0x5d3ac5;if(_0x210cbe>=_0x3a4e1c){_0x210cbe=_0x3a4e1c;_0x5d3ac5=0xc8;}else{_0x5d3ac5=0xce;}_0x397034['status'](_0x5d3ac5);return _0x397034[_0xe840('0x1d')](_0xe840('0x1e'),_0x3187ae+'-'+_0x210cbe+'/'+_0x3a4e1c)['json'](_0x17a1c0);}return null;};}function patchUpdates(_0x409bcc){return function(_0x2315c9){try{jsonpatch[_0xe840('0x1f')](_0x2315c9,_0x409bcc,!![]);}catch(_0x4492a4){return BPromise[_0xe840('0x20')](_0x4492a4);}return _0x2315c9[_0xe840('0x21')]();};}function saveUpdates(_0x3e15bd,_0x358821){return function(_0x13fc45){if(_0x13fc45){return _0x13fc45[_0xe840('0x22')](_0x3e15bd)[_0xe840('0x23')](function(_0x5c09e1){return _0x5c09e1;});}return null;};}function removeEntity(_0x5b75d2,_0x219a65){return function(_0x2d0d2a){if(_0x2d0d2a){return _0x2d0d2a[_0xe840('0x24')]()['then'](function(){_0x5b75d2[_0xe840('0x17')](0xcc)[_0xe840('0x16')]();});}};}function handleEntityNotFound(_0x1d1a45,_0x5b48aa){return function(_0x146d0d){if(!_0x146d0d){_0x1d1a45[_0xe840('0x15')](0x194);}return _0x146d0d;};}function handleError(_0x337624,_0x2ac0a1){_0x2ac0a1=_0x2ac0a1||0x1f4;return function(_0x3461db){logger[_0xe840('0x25')](_0x3461db['stack']);if(_0x3461db[_0xe840('0x26')]){delete _0x3461db[_0xe840('0x26')];}_0x337624[_0xe840('0x17')](_0x2ac0a1)[_0xe840('0x27')](_0x3461db);};}exports[_0xe840('0x28')]=function(_0x1cbc13,_0x15fd5b){var _0x4f6e88={},_0x5aa5b8={},_0x557179={'count':0x0,'rows':[]};var _0x2e678c=_[_0xe840('0x29')](db[_0xe840('0x2a')][_0xe840('0x2b')],function(_0x49a768){return{'name':_0x49a768[_0xe840('0x2c')],'type':_0x49a768['type'][_0xe840('0x2d')]};});_0x5aa5b8[_0xe840('0x2e')]=_[_0xe840('0x29')](_0x2e678c,'name');_0x5aa5b8['query']=_['keys'](_0x1cbc13[_0xe840('0x2f')]);_0x5aa5b8[_0xe840('0x30')]=_[_0xe840('0x31')](_0x5aa5b8[_0xe840('0x2e')],_0x5aa5b8[_0xe840('0x2f')]);_0x4f6e88['attributes']=_[_0xe840('0x31')](_0x5aa5b8[_0xe840('0x2e')],qs['fields'](_0x1cbc13[_0xe840('0x2f')][_0xe840('0x32')]));_0x4f6e88[_0xe840('0x33')]=_0x4f6e88[_0xe840('0x33')][_0xe840('0x34')]?_0x4f6e88[_0xe840('0x33')]:_0x5aa5b8['model'];if(!_0x1cbc13['query']['hasOwnProperty'](_0xe840('0x35'))){_0x4f6e88['limit']=qs[_0xe840('0x1b')](_0x1cbc13[_0xe840('0x2f')][_0xe840('0x1b')]);_0x4f6e88[_0xe840('0x19')]=qs[_0xe840('0x19')](_0x1cbc13[_0xe840('0x2f')]['offset']);}_0x4f6e88[_0xe840('0x36')]=qs[_0xe840('0x37')](_0x1cbc13[_0xe840('0x2f')][_0xe840('0x37')]);_0x4f6e88[_0xe840('0x38')]=qs[_0xe840('0x30')](_[_0xe840('0x39')](_0x1cbc13['query'],_0x5aa5b8['filters']),_0x2e678c);if(_0x1cbc13[_0xe840('0x2f')]['filter']){_0x4f6e88[_0xe840('0x38')]=_[_0xe840('0x3a')](_0x4f6e88[_0xe840('0x38')],{'$or':_[_0xe840('0x29')](_0x2e678c,function(_0x2a235a){if(_0x2a235a['type']!==_0xe840('0x3b')){var _0x36d45b={};_0x36d45b[_0x2a235a[_0xe840('0x26')]]={'$like':'%'+_0x1cbc13['query']['filter']+'%'};return _0x36d45b;}})});}_0x4f6e88=_[_0xe840('0x3a')]({},_0x4f6e88,_0x1cbc13[_0xe840('0x3c')]);var _0x166745={'where':_0x4f6e88[_0xe840('0x38')]};return db[_0xe840('0x2a')][_0xe840('0x1c')](_0x166745)[_0xe840('0x23')](function(_0x942b00){_0x557179[_0xe840('0x1c')]=_0x942b00;if(_0x1cbc13[_0xe840('0x2f')][_0xe840('0x3d')]){_0x4f6e88[_0xe840('0x3e')]=[{'all':!![]}];}return db[_0xe840('0x2a')][_0xe840('0x3f')](_0x4f6e88);})[_0xe840('0x23')](function(_0xc83f85){_0x557179[_0xe840('0x40')]=_0xc83f85;return _0x557179;})[_0xe840('0x23')](respondWithFilteredResult(_0x15fd5b,_0x4f6e88))[_0xe840('0x41')](handleError(_0x15fd5b,null));};exports[_0xe840('0x42')]=function(_0x2e2de6,_0x45411c){var _0x412984={'raw':![],'where':{'id':_0x2e2de6[_0xe840('0x43')]['id']}},_0xf60eec={};_0xf60eec[_0xe840('0x2e')]=_[_0xe840('0x44')](db[_0xe840('0x2a')][_0xe840('0x2b')]);_0xf60eec[_0xe840('0x2f')]=_[_0xe840('0x44')](_0x2e2de6[_0xe840('0x2f')]);_0xf60eec[_0xe840('0x30')]=_[_0xe840('0x31')](_0xf60eec['model'],_0xf60eec['query']);_0x412984[_0xe840('0x33')]=_[_0xe840('0x31')](_0xf60eec[_0xe840('0x2e')],qs[_0xe840('0x32')](_0x2e2de6[_0xe840('0x2f')]['fields']));_0x412984[_0xe840('0x33')]=_0x412984['attributes']['length']?_0x412984[_0xe840('0x33')]:_0xf60eec[_0xe840('0x2e')];if(_0x2e2de6['query'][_0xe840('0x3d')]){_0x412984['include']=[{'all':!![]}];}_0x412984=_[_0xe840('0x3a')]({},_0x412984,_0x2e2de6[_0xe840('0x3c')]);return db[_0xe840('0x2a')][_0xe840('0x45')](_0x412984)[_0xe840('0x23')](handleEntityNotFound(_0x45411c,null))[_0xe840('0x23')](respondWithResult(_0x45411c,null))[_0xe840('0x41')](handleError(_0x45411c,null));};exports[_0xe840('0x46')]=function(_0x48f285,_0x3295bd){return db['ZohoConfiguration'][_0xe840('0x46')](_0x48f285[_0xe840('0x47')],{})['then'](respondWithResult(_0x3295bd,0xc9))[_0xe840('0x41')](handleError(_0x3295bd,null));};exports[_0xe840('0x22')]=function(_0x37da9e,_0xb10248){if(_0x37da9e['body']['id']){delete _0x37da9e[_0xe840('0x47')]['id'];}return db['ZohoConfiguration'][_0xe840('0x45')]({'where':{'id':_0x37da9e[_0xe840('0x43')]['id']}})[_0xe840('0x23')](handleEntityNotFound(_0xb10248,null))['then'](saveUpdates(_0x37da9e[_0xe840('0x47')],null))[_0xe840('0x23')](respondWithResult(_0xb10248,null))[_0xe840('0x41')](handleError(_0xb10248,null));};exports[_0xe840('0x24')]=function(_0x15a245,_0x29639e){return db[_0xe840('0x2a')]['find']({'where':{'id':_0x15a245['params']['id']}})[_0xe840('0x23')](handleEntityNotFound(_0x29639e,null))[_0xe840('0x23')](removeEntity(_0x29639e,null))[_0xe840('0x41')](handleError(_0x29639e,null));};exports[_0xe840('0x48')]=function(_0x26628d,_0x222ef7,_0x10a53c){var _0x2a098b={};var _0x5ed043={};var _0x5d927a;var _0x167a27;return db[_0xe840('0x2a')][_0xe840('0x49')]({'where':{'id':_0x26628d['params']['id']}})[_0xe840('0x23')](handleEntityNotFound(_0x222ef7,null))[_0xe840('0x23')](function(_0x5da04f){if(_0x5da04f){_0x5d927a=_0x5da04f;_0x5ed043[_0xe840('0x2e')]=_[_0xe840('0x44')](db[_0xe840('0x4a')][_0xe840('0x2b')]);_0x5ed043[_0xe840('0x2f')]=_[_0xe840('0x44')](_0x26628d[_0xe840('0x2f')]);_0x5ed043[_0xe840('0x30')]=_[_0xe840('0x31')](_0x5ed043[_0xe840('0x2e')],_0x5ed043[_0xe840('0x2f')]);_0x2a098b[_0xe840('0x33')]=_[_0xe840('0x31')](_0x5ed043[_0xe840('0x2e')],qs[_0xe840('0x32')](_0x26628d[_0xe840('0x2f')]['fields']));_0x2a098b[_0xe840('0x33')]=_0x2a098b[_0xe840('0x33')][_0xe840('0x34')]?_0x2a098b['attributes']:_0x5ed043[_0xe840('0x2e')];_0x2a098b[_0xe840('0x36')]=qs[_0xe840('0x37')](_0x26628d[_0xe840('0x2f')]['sort']);_0x2a098b[_0xe840('0x38')]=qs[_0xe840('0x30')](_[_0xe840('0x39')](_0x26628d[_0xe840('0x2f')],_0x5ed043[_0xe840('0x30')]));if(_0x26628d['query'][_0xe840('0x4b')]){_0x2a098b[_0xe840('0x38')]=_[_0xe840('0x3a')](_0x2a098b[_0xe840('0x38')],{'$or':_[_0xe840('0x29')](_0x2a098b[_0xe840('0x33')],function(_0x3ff502){var _0x2cb7ea={};_0x2cb7ea[_0x3ff502]={'$like':'%'+_0x26628d['query']['filter']+'%'};return _0x2cb7ea;})});}_0x2a098b=_[_0xe840('0x3a')]({},_0x2a098b,_0x26628d[_0xe840('0x3c')]);return _0x5d927a[_0xe840('0x48')](_0x2a098b);}})[_0xe840('0x23')](function(_0x5df5c3){if(_0x5df5c3){_0x167a27=_0x5df5c3[_0xe840('0x34')];if(!_0x26628d[_0xe840('0x2f')][_0xe840('0x4c')]('nolimit')){_0x2a098b['limit']=qs[_0xe840('0x1b')](_0x26628d[_0xe840('0x2f')][_0xe840('0x1b')]);_0x2a098b[_0xe840('0x19')]=qs[_0xe840('0x19')](_0x26628d[_0xe840('0x2f')][_0xe840('0x19')]);}return _0x5d927a['getFields'](_0x2a098b);}})[_0xe840('0x23')](function(_0x8cf102){if(_0x8cf102){return _0x8cf102?{'count':_0x167a27,'rows':_0x8cf102}:null;}})[_0xe840('0x23')](respondWithResult(_0x222ef7,null))[_0xe840('0x41')](handleError(_0x222ef7,null));};exports[_0xe840('0x4d')]=function(_0xadf0c6,_0x5d9c5a,_0x41d745){var _0x133c8d={};var _0x142ba5={};var _0x4c90c4;var _0x41c7d;return db[_0xe840('0x2a')][_0xe840('0x49')]({'where':{'id':_0xadf0c6[_0xe840('0x43')]['id']}})[_0xe840('0x23')](handleEntityNotFound(_0x5d9c5a,null))['then'](function(_0x97b0c8){if(_0x97b0c8){_0x4c90c4=_0x97b0c8;_0x142ba5[_0xe840('0x2e')]=_[_0xe840('0x44')](db[_0xe840('0x4a')]['rawAttributes']);_0x142ba5[_0xe840('0x2f')]=_['keys'](_0xadf0c6[_0xe840('0x2f')]);_0x142ba5['filters']=_['intersection'](_0x142ba5['model'],_0x142ba5[_0xe840('0x2f')]);_0x133c8d[_0xe840('0x33')]=_[_0xe840('0x31')](_0x142ba5[_0xe840('0x2e')],qs[_0xe840('0x32')](_0xadf0c6[_0xe840('0x2f')][_0xe840('0x32')]));_0x133c8d['attributes']=_0x133c8d['attributes']['length']?_0x133c8d[_0xe840('0x33')]:_0x142ba5[_0xe840('0x2e')];_0x133c8d['order']=qs[_0xe840('0x37')](_0xadf0c6[_0xe840('0x2f')][_0xe840('0x37')]);_0x133c8d['where']=qs[_0xe840('0x30')](_[_0xe840('0x39')](_0xadf0c6[_0xe840('0x2f')],_0x142ba5[_0xe840('0x30')]));if(_0xadf0c6[_0xe840('0x2f')][_0xe840('0x4b')]){_0x133c8d[_0xe840('0x38')]=_[_0xe840('0x3a')](_0x133c8d[_0xe840('0x38')],{'$or':_[_0xe840('0x29')](_0x133c8d[_0xe840('0x33')],function(_0x540bc2){var _0x31e4ec={};_0x31e4ec[_0x540bc2]={'$like':'%'+_0xadf0c6['query'][_0xe840('0x4b')]+'%'};return _0x31e4ec;})});}_0x133c8d=_[_0xe840('0x3a')]({},_0x133c8d,_0xadf0c6[_0xe840('0x3c')]);return _0x4c90c4['getSubjects'](_0x133c8d);}})['then'](function(_0x4b6646){if(_0x4b6646){_0x41c7d=_0x4b6646[_0xe840('0x34')];if(!_0xadf0c6['query']['hasOwnProperty'](_0xe840('0x35'))){_0x133c8d[_0xe840('0x1b')]=qs[_0xe840('0x1b')](_0xadf0c6[_0xe840('0x2f')][_0xe840('0x1b')]);_0x133c8d['offset']=qs['offset'](_0xadf0c6[_0xe840('0x2f')][_0xe840('0x19')]);}return _0x4c90c4['getSubjects'](_0x133c8d);}})[_0xe840('0x23')](function(_0x308a19){if(_0x308a19){return _0x308a19?{'count':_0x41c7d,'rows':_0x308a19}:null;}})[_0xe840('0x23')](respondWithResult(_0x5d9c5a,null))[_0xe840('0x41')](handleError(_0x5d9c5a,null));};exports['getDescriptions']=function(_0x53194b,_0x20ed7b,_0x6bad4e){var _0x17f1c0={};var _0x57131f={};var _0x3ffa79;var _0x78ad98;return db[_0xe840('0x2a')][_0xe840('0x49')]({'where':{'id':_0x53194b[_0xe840('0x43')]['id']}})[_0xe840('0x23')](handleEntityNotFound(_0x20ed7b,null))[_0xe840('0x23')](function(_0x4d2a87){if(_0x4d2a87){_0x3ffa79=_0x4d2a87;_0x57131f[_0xe840('0x2e')]=_['keys'](db[_0xe840('0x4a')][_0xe840('0x2b')]);_0x57131f[_0xe840('0x2f')]=_['keys'](_0x53194b[_0xe840('0x2f')]);_0x57131f[_0xe840('0x30')]=_[_0xe840('0x31')](_0x57131f[_0xe840('0x2e')],_0x57131f['query']);_0x17f1c0['attributes']=_[_0xe840('0x31')](_0x57131f[_0xe840('0x2e')],qs[_0xe840('0x32')](_0x53194b['query']['fields']));_0x17f1c0[_0xe840('0x33')]=_0x17f1c0['attributes']['length']?_0x17f1c0[_0xe840('0x33')]:_0x57131f[_0xe840('0x2e')];_0x17f1c0[_0xe840('0x36')]=qs['sort'](_0x53194b['query'][_0xe840('0x37')]);_0x17f1c0[_0xe840('0x38')]=qs[_0xe840('0x30')](_[_0xe840('0x39')](_0x53194b['query'],_0x57131f[_0xe840('0x30')]));if(_0x53194b[_0xe840('0x2f')][_0xe840('0x4b')]){_0x17f1c0[_0xe840('0x38')]=_['merge'](_0x17f1c0[_0xe840('0x38')],{'$or':_['map'](_0x17f1c0[_0xe840('0x33')],function(_0x5933bd){var _0x5f2b2f={};_0x5f2b2f[_0x5933bd]={'$like':'%'+_0x53194b[_0xe840('0x2f')]['filter']+'%'};return _0x5f2b2f;})});}_0x17f1c0=_[_0xe840('0x3a')]({},_0x17f1c0,_0x53194b[_0xe840('0x3c')]);return _0x3ffa79[_0xe840('0x4e')](_0x17f1c0);}})[_0xe840('0x23')](function(_0x321dfd){if(_0x321dfd){_0x78ad98=_0x321dfd[_0xe840('0x34')];if(!_0x53194b[_0xe840('0x2f')]['hasOwnProperty']('nolimit')){_0x17f1c0[_0xe840('0x1b')]=qs['limit'](_0x53194b['query']['limit']);_0x17f1c0['offset']=qs[_0xe840('0x19')](_0x53194b[_0xe840('0x2f')]['offset']);}return _0x3ffa79['getDescriptions'](_0x17f1c0);}})[_0xe840('0x23')](function(_0x271689){if(_0x271689){return _0x271689?{'count':_0x78ad98,'rows':_0x271689}:null;}})['then'](respondWithResult(_0x20ed7b,null))[_0xe840('0x41')](handleError(_0x20ed7b,null));}; \ No newline at end of file +var _0x8a73=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','filter','merge','ZohoConfiguration','includeAll','include','findAll','rows','show','params','options','find','create','body','catch','getFields','ZohoField','sort','nolimit','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv'];(function(_0x4e783c,_0x51a362){var _0x2fbd6d=function(_0x513e00){while(--_0x513e00){_0x4e783c['push'](_0x4e783c['shift']());}};_0x2fbd6d(++_0x51a362);}(_0x8a73,0xe4));var _0x38a7=function(_0x12c5ad,_0x586102){_0x12c5ad=_0x12c5ad-0x0;var _0xf7c02d=_0x8a73[_0x12c5ad];return _0xf7c02d;};'use strict';var emlformat=require(_0x38a7('0x0'));var rimraf=require(_0x38a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x38a7('0x2'));var rp=require('request-promise');var moment=require(_0x38a7('0x3'));var BPromise=require(_0x38a7('0x4'));var Mustache=require('mustache');var util=require(_0x38a7('0x5'));var path=require(_0x38a7('0x6'));var sox=require(_0x38a7('0x7'));var csv=require(_0x38a7('0x8'));var ejs=require(_0x38a7('0x9'));var fs=require('fs');var fs_extra=require(_0x38a7('0xa'));var _=require(_0x38a7('0xb'));var squel=require(_0x38a7('0xc'));var crypto=require('crypto');var jsforce=require(_0x38a7('0xd'));var deskjs=require(_0x38a7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x38a7('0xf'));var Papa=require(_0x38a7('0x10'));var Redis=require(_0x38a7('0x11'));var authService=require(_0x38a7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x38a7('0x13'));var hardwareService=require(_0x38a7('0x14'));var logger=require('../../config/logger')(_0x38a7('0x15'));var utils=require(_0x38a7('0x16'));var config=require(_0x38a7('0x17'));var licenseUtil=require(_0x38a7('0x18'));var db=require(_0x38a7('0x19'))['db'];function respondWithStatusCode(_0x10ad94,_0x272980){_0x272980=_0x272980||0xcc;return function(_0x1e37ea){if(_0x1e37ea){return _0x10ad94['sendStatus'](_0x272980);}return _0x10ad94[_0x38a7('0x1a')](_0x272980)[_0x38a7('0x1b')]();};}function respondWithResult(_0xb4a79b,_0x5f12c5){_0x5f12c5=_0x5f12c5||0xc8;return function(_0x517e2d){if(_0x517e2d){return _0xb4a79b[_0x38a7('0x1a')](_0x5f12c5)[_0x38a7('0x1c')](_0x517e2d);}};}function respondWithFilteredResult(_0x4bb564,_0x23a89a){return function(_0x3b6a7f){if(_0x3b6a7f){var _0xade49e=typeof _0x23a89a[_0x38a7('0x1d')]===_0x38a7('0x1e')&&typeof _0x23a89a[_0x38a7('0x1f')]===_0x38a7('0x1e');var _0x3184bc=_0x3b6a7f[_0x38a7('0x20')];var _0x489456=_0xade49e?0x0:_0x23a89a['offset'];var _0x3b2fea=_0xade49e?_0x3b6a7f[_0x38a7('0x20')]:_0x23a89a[_0x38a7('0x1d')]+_0x23a89a[_0x38a7('0x1f')];var _0x294bb5;if(_0x3b2fea>=_0x3184bc){_0x3b2fea=_0x3184bc;_0x294bb5=0xc8;}else{_0x294bb5=0xce;}_0x4bb564[_0x38a7('0x1a')](_0x294bb5);return _0x4bb564[_0x38a7('0x21')]('Content-Range',_0x489456+'-'+_0x3b2fea+'/'+_0x3184bc)[_0x38a7('0x1c')](_0x3b6a7f);}return null;};}function patchUpdates(_0x3a2fa3){return function(_0x13f8fd){try{jsonpatch[_0x38a7('0x22')](_0x13f8fd,_0x3a2fa3,!![]);}catch(_0x3f75f0){return BPromise['reject'](_0x3f75f0);}return _0x13f8fd[_0x38a7('0x23')]();};}function saveUpdates(_0x2e0919,_0x1d3403){return function(_0x39bdc7){if(_0x39bdc7){return _0x39bdc7[_0x38a7('0x24')](_0x2e0919)[_0x38a7('0x25')](function(_0x41b654){return _0x41b654;});}return null;};}function removeEntity(_0xf9c039,_0x2e9d99){return function(_0xcdf946){if(_0xcdf946){return _0xcdf946[_0x38a7('0x26')]()[_0x38a7('0x25')](function(){_0xf9c039['status'](0xcc)[_0x38a7('0x1b')]();});}};}function handleEntityNotFound(_0x20d95d,_0x1cc275){return function(_0x44730d){if(!_0x44730d){_0x20d95d['sendStatus'](0x194);}return _0x44730d;};}function handleError(_0x267301,_0x5726b8){_0x5726b8=_0x5726b8||0x1f4;return function(_0x38ee9d){logger['error'](_0x38ee9d[_0x38a7('0x27')]);if(_0x38ee9d[_0x38a7('0x28')]){delete _0x38ee9d['name'];}_0x267301[_0x38a7('0x1a')](_0x5726b8)['send'](_0x38ee9d);};}exports[_0x38a7('0x29')]=function(_0x2c1990,_0x1cc6e4){var _0x4038d7={},_0x24173c={},_0x27df0d={'count':0x0,'rows':[]};var _0x4c0669=_[_0x38a7('0x2a')](db['ZohoConfiguration'][_0x38a7('0x2b')],function(_0x555cc1){return{'name':_0x555cc1[_0x38a7('0x2c')],'type':_0x555cc1[_0x38a7('0x2d')]['key']};});_0x24173c[_0x38a7('0x2e')]=_['map'](_0x4c0669,_0x38a7('0x28'));_0x24173c['query']=_[_0x38a7('0x2f')](_0x2c1990[_0x38a7('0x30')]);_0x24173c[_0x38a7('0x31')]=_['intersection'](_0x24173c[_0x38a7('0x2e')],_0x24173c[_0x38a7('0x30')]);_0x4038d7[_0x38a7('0x32')]=_[_0x38a7('0x33')](_0x24173c[_0x38a7('0x2e')],qs['fields'](_0x2c1990[_0x38a7('0x30')][_0x38a7('0x34')]));_0x4038d7[_0x38a7('0x32')]=_0x4038d7[_0x38a7('0x32')][_0x38a7('0x35')]?_0x4038d7[_0x38a7('0x32')]:_0x24173c[_0x38a7('0x2e')];if(!_0x2c1990[_0x38a7('0x30')][_0x38a7('0x36')]('nolimit')){_0x4038d7[_0x38a7('0x1f')]=qs['limit'](_0x2c1990['query'][_0x38a7('0x1f')]);_0x4038d7[_0x38a7('0x1d')]=qs[_0x38a7('0x1d')](_0x2c1990[_0x38a7('0x30')][_0x38a7('0x1d')]);}_0x4038d7[_0x38a7('0x37')]=qs['sort'](_0x2c1990[_0x38a7('0x30')]['sort']);_0x4038d7[_0x38a7('0x38')]=qs[_0x38a7('0x31')](_[_0x38a7('0x39')](_0x2c1990[_0x38a7('0x30')],_0x24173c[_0x38a7('0x31')]),_0x4c0669);if(_0x2c1990[_0x38a7('0x30')][_0x38a7('0x3a')]){_0x4038d7[_0x38a7('0x38')]=_['merge'](_0x4038d7[_0x38a7('0x38')],{'$or':_[_0x38a7('0x2a')](_0x4c0669,function(_0x18b202){if(_0x18b202[_0x38a7('0x2d')]!=='VIRTUAL'){var _0x8bd713={};_0x8bd713[_0x18b202[_0x38a7('0x28')]]={'$like':'%'+_0x2c1990[_0x38a7('0x30')][_0x38a7('0x3a')]+'%'};return _0x8bd713;}})});}_0x4038d7=_[_0x38a7('0x3b')]({},_0x4038d7,_0x2c1990['options']);var _0x277d7c={'where':_0x4038d7[_0x38a7('0x38')]};return db[_0x38a7('0x3c')]['count'](_0x277d7c)['then'](function(_0x12dbbe){_0x27df0d[_0x38a7('0x20')]=_0x12dbbe;if(_0x2c1990[_0x38a7('0x30')][_0x38a7('0x3d')]){_0x4038d7[_0x38a7('0x3e')]=[{'all':!![]}];}return db[_0x38a7('0x3c')][_0x38a7('0x3f')](_0x4038d7);})[_0x38a7('0x25')](function(_0x434481){_0x27df0d[_0x38a7('0x40')]=_0x434481;return _0x27df0d;})[_0x38a7('0x25')](respondWithFilteredResult(_0x1cc6e4,_0x4038d7))['catch'](handleError(_0x1cc6e4,null));};exports[_0x38a7('0x41')]=function(_0xd8bc6f,_0x1802e7){var _0x4f1987={'raw':![],'where':{'id':_0xd8bc6f[_0x38a7('0x42')]['id']}},_0xa1ce66={};_0xa1ce66[_0x38a7('0x2e')]=_[_0x38a7('0x2f')](db[_0x38a7('0x3c')]['rawAttributes']);_0xa1ce66['query']=_[_0x38a7('0x2f')](_0xd8bc6f[_0x38a7('0x30')]);_0xa1ce66['filters']=_['intersection'](_0xa1ce66[_0x38a7('0x2e')],_0xa1ce66[_0x38a7('0x30')]);_0x4f1987['attributes']=_[_0x38a7('0x33')](_0xa1ce66['model'],qs[_0x38a7('0x34')](_0xd8bc6f[_0x38a7('0x30')][_0x38a7('0x34')]));_0x4f1987['attributes']=_0x4f1987[_0x38a7('0x32')][_0x38a7('0x35')]?_0x4f1987[_0x38a7('0x32')]:_0xa1ce66[_0x38a7('0x2e')];if(_0xd8bc6f['query'][_0x38a7('0x3d')]){_0x4f1987['include']=[{'all':!![]}];}_0x4f1987=_['merge']({},_0x4f1987,_0xd8bc6f[_0x38a7('0x43')]);return db['ZohoConfiguration'][_0x38a7('0x44')](_0x4f1987)['then'](handleEntityNotFound(_0x1802e7,null))['then'](respondWithResult(_0x1802e7,null))['catch'](handleError(_0x1802e7,null));};exports[_0x38a7('0x45')]=function(_0x34ff5e,_0x5b6b9c){return db[_0x38a7('0x3c')][_0x38a7('0x45')](_0x34ff5e[_0x38a7('0x46')],{})[_0x38a7('0x25')](respondWithResult(_0x5b6b9c,0xc9))['catch'](handleError(_0x5b6b9c,null));};exports[_0x38a7('0x24')]=function(_0x2dcfee,_0xa56f4b){if(_0x2dcfee['body']['id']){delete _0x2dcfee['body']['id'];}return db[_0x38a7('0x3c')]['find']({'where':{'id':_0x2dcfee[_0x38a7('0x42')]['id']}})['then'](handleEntityNotFound(_0xa56f4b,null))[_0x38a7('0x25')](saveUpdates(_0x2dcfee['body'],null))[_0x38a7('0x25')](respondWithResult(_0xa56f4b,null))[_0x38a7('0x47')](handleError(_0xa56f4b,null));};exports[_0x38a7('0x26')]=function(_0x3be564,_0x844e6e){return db['ZohoConfiguration'][_0x38a7('0x44')]({'where':{'id':_0x3be564[_0x38a7('0x42')]['id']}})[_0x38a7('0x25')](handleEntityNotFound(_0x844e6e,null))[_0x38a7('0x25')](removeEntity(_0x844e6e,null))[_0x38a7('0x47')](handleError(_0x844e6e,null));};exports[_0x38a7('0x48')]=function(_0x140e95,_0x2d72e6,_0x38a62a){var _0x524c79={};var _0x56f939={};var _0x3b02cb;var _0x26e31b;return db[_0x38a7('0x3c')]['findOne']({'where':{'id':_0x140e95[_0x38a7('0x42')]['id']}})[_0x38a7('0x25')](handleEntityNotFound(_0x2d72e6,null))[_0x38a7('0x25')](function(_0x71d74){if(_0x71d74){_0x3b02cb=_0x71d74;_0x56f939[_0x38a7('0x2e')]=_[_0x38a7('0x2f')](db[_0x38a7('0x49')][_0x38a7('0x2b')]);_0x56f939['query']=_[_0x38a7('0x2f')](_0x140e95[_0x38a7('0x30')]);_0x56f939[_0x38a7('0x31')]=_['intersection'](_0x56f939[_0x38a7('0x2e')],_0x56f939['query']);_0x524c79['attributes']=_[_0x38a7('0x33')](_0x56f939['model'],qs[_0x38a7('0x34')](_0x140e95[_0x38a7('0x30')][_0x38a7('0x34')]));_0x524c79[_0x38a7('0x32')]=_0x524c79[_0x38a7('0x32')]['length']?_0x524c79[_0x38a7('0x32')]:_0x56f939[_0x38a7('0x2e')];_0x524c79[_0x38a7('0x37')]=qs[_0x38a7('0x4a')](_0x140e95[_0x38a7('0x30')][_0x38a7('0x4a')]);_0x524c79[_0x38a7('0x38')]=qs[_0x38a7('0x31')](_[_0x38a7('0x39')](_0x140e95[_0x38a7('0x30')],_0x56f939[_0x38a7('0x31')]));if(_0x140e95[_0x38a7('0x30')][_0x38a7('0x3a')]){_0x524c79[_0x38a7('0x38')]=_[_0x38a7('0x3b')](_0x524c79[_0x38a7('0x38')],{'$or':_[_0x38a7('0x2a')](_0x524c79['attributes'],function(_0x5d38cf){var _0x256b9c={};_0x256b9c[_0x5d38cf]={'$like':'%'+_0x140e95[_0x38a7('0x30')][_0x38a7('0x3a')]+'%'};return _0x256b9c;})});}_0x524c79=_[_0x38a7('0x3b')]({},_0x524c79,_0x140e95[_0x38a7('0x43')]);return _0x3b02cb[_0x38a7('0x48')](_0x524c79);}})[_0x38a7('0x25')](function(_0x43aed2){if(_0x43aed2){_0x26e31b=_0x43aed2[_0x38a7('0x35')];if(!_0x140e95[_0x38a7('0x30')][_0x38a7('0x36')](_0x38a7('0x4b'))){_0x524c79[_0x38a7('0x1f')]=qs[_0x38a7('0x1f')](_0x140e95['query'][_0x38a7('0x1f')]);_0x524c79['offset']=qs[_0x38a7('0x1d')](_0x140e95['query'][_0x38a7('0x1d')]);}return _0x3b02cb['getFields'](_0x524c79);}})[_0x38a7('0x25')](function(_0x4be296){if(_0x4be296){return _0x4be296?{'count':_0x26e31b,'rows':_0x4be296}:null;}})[_0x38a7('0x25')](respondWithResult(_0x2d72e6,null))[_0x38a7('0x47')](handleError(_0x2d72e6,null));};exports[_0x38a7('0x4c')]=function(_0x52c33b,_0x28c070,_0x561e5f){var _0x593d3a={};var _0x11cb1b={};var _0x11215b;var _0x2b2c79;return db[_0x38a7('0x3c')][_0x38a7('0x4d')]({'where':{'id':_0x52c33b[_0x38a7('0x42')]['id']}})[_0x38a7('0x25')](handleEntityNotFound(_0x28c070,null))[_0x38a7('0x25')](function(_0xa16431){if(_0xa16431){_0x11215b=_0xa16431;_0x11cb1b[_0x38a7('0x2e')]=_['keys'](db['ZohoField']['rawAttributes']);_0x11cb1b[_0x38a7('0x30')]=_['keys'](_0x52c33b[_0x38a7('0x30')]);_0x11cb1b[_0x38a7('0x31')]=_[_0x38a7('0x33')](_0x11cb1b[_0x38a7('0x2e')],_0x11cb1b[_0x38a7('0x30')]);_0x593d3a[_0x38a7('0x32')]=_[_0x38a7('0x33')](_0x11cb1b['model'],qs[_0x38a7('0x34')](_0x52c33b[_0x38a7('0x30')][_0x38a7('0x34')]));_0x593d3a[_0x38a7('0x32')]=_0x593d3a[_0x38a7('0x32')][_0x38a7('0x35')]?_0x593d3a['attributes']:_0x11cb1b[_0x38a7('0x2e')];_0x593d3a[_0x38a7('0x37')]=qs['sort'](_0x52c33b[_0x38a7('0x30')][_0x38a7('0x4a')]);_0x593d3a[_0x38a7('0x38')]=qs['filters'](_[_0x38a7('0x39')](_0x52c33b['query'],_0x11cb1b['filters']));if(_0x52c33b[_0x38a7('0x30')][_0x38a7('0x3a')]){_0x593d3a['where']=_['merge'](_0x593d3a[_0x38a7('0x38')],{'$or':_['map'](_0x593d3a[_0x38a7('0x32')],function(_0x247aed){var _0x5208bd={};_0x5208bd[_0x247aed]={'$like':'%'+_0x52c33b[_0x38a7('0x30')][_0x38a7('0x3a')]+'%'};return _0x5208bd;})});}_0x593d3a=_['merge']({},_0x593d3a,_0x52c33b[_0x38a7('0x43')]);return _0x11215b[_0x38a7('0x4c')](_0x593d3a);}})[_0x38a7('0x25')](function(_0xbae555){if(_0xbae555){_0x2b2c79=_0xbae555['length'];if(!_0x52c33b[_0x38a7('0x30')][_0x38a7('0x36')]('nolimit')){_0x593d3a[_0x38a7('0x1f')]=qs[_0x38a7('0x1f')](_0x52c33b[_0x38a7('0x30')]['limit']);_0x593d3a[_0x38a7('0x1d')]=qs[_0x38a7('0x1d')](_0x52c33b[_0x38a7('0x30')][_0x38a7('0x1d')]);}return _0x11215b[_0x38a7('0x4c')](_0x593d3a);}})[_0x38a7('0x25')](function(_0x196a50){if(_0x196a50){return _0x196a50?{'count':_0x2b2c79,'rows':_0x196a50}:null;}})[_0x38a7('0x25')](respondWithResult(_0x28c070,null))[_0x38a7('0x47')](handleError(_0x28c070,null));};exports['getDescriptions']=function(_0x3a3009,_0x2152f0,_0x4393df){var _0xc98fc4={};var _0x4cdf6a={};var _0x57520d;var _0x487850;return db[_0x38a7('0x3c')][_0x38a7('0x4d')]({'where':{'id':_0x3a3009[_0x38a7('0x42')]['id']}})[_0x38a7('0x25')](handleEntityNotFound(_0x2152f0,null))[_0x38a7('0x25')](function(_0x4a2a2e){if(_0x4a2a2e){_0x57520d=_0x4a2a2e;_0x4cdf6a[_0x38a7('0x2e')]=_['keys'](db[_0x38a7('0x49')][_0x38a7('0x2b')]);_0x4cdf6a[_0x38a7('0x30')]=_[_0x38a7('0x2f')](_0x3a3009[_0x38a7('0x30')]);_0x4cdf6a[_0x38a7('0x31')]=_[_0x38a7('0x33')](_0x4cdf6a[_0x38a7('0x2e')],_0x4cdf6a[_0x38a7('0x30')]);_0xc98fc4['attributes']=_[_0x38a7('0x33')](_0x4cdf6a[_0x38a7('0x2e')],qs[_0x38a7('0x34')](_0x3a3009['query'][_0x38a7('0x34')]));_0xc98fc4[_0x38a7('0x32')]=_0xc98fc4[_0x38a7('0x32')][_0x38a7('0x35')]?_0xc98fc4[_0x38a7('0x32')]:_0x4cdf6a[_0x38a7('0x2e')];_0xc98fc4['order']=qs[_0x38a7('0x4a')](_0x3a3009[_0x38a7('0x30')][_0x38a7('0x4a')]);_0xc98fc4[_0x38a7('0x38')]=qs[_0x38a7('0x31')](_[_0x38a7('0x39')](_0x3a3009[_0x38a7('0x30')],_0x4cdf6a[_0x38a7('0x31')]));if(_0x3a3009[_0x38a7('0x30')][_0x38a7('0x3a')]){_0xc98fc4['where']=_[_0x38a7('0x3b')](_0xc98fc4[_0x38a7('0x38')],{'$or':_[_0x38a7('0x2a')](_0xc98fc4[_0x38a7('0x32')],function(_0xc6c642){var _0x37150c={};_0x37150c[_0xc6c642]={'$like':'%'+_0x3a3009[_0x38a7('0x30')]['filter']+'%'};return _0x37150c;})});}_0xc98fc4=_[_0x38a7('0x3b')]({},_0xc98fc4,_0x3a3009[_0x38a7('0x43')]);return _0x57520d[_0x38a7('0x4e')](_0xc98fc4);}})[_0x38a7('0x25')](function(_0x3d623b){if(_0x3d623b){_0x487850=_0x3d623b[_0x38a7('0x35')];if(!_0x3a3009[_0x38a7('0x30')]['hasOwnProperty'](_0x38a7('0x4b'))){_0xc98fc4[_0x38a7('0x1f')]=qs[_0x38a7('0x1f')](_0x3a3009[_0x38a7('0x30')]['limit']);_0xc98fc4['offset']=qs[_0x38a7('0x1d')](_0x3a3009[_0x38a7('0x30')]['offset']);}return _0x57520d['getDescriptions'](_0xc98fc4);}})[_0x38a7('0x25')](function(_0x169978){if(_0x169978){return _0x169978?{'count':_0x487850,'rows':_0x169978}:null;}})[_0x38a7('0x25')](respondWithResult(_0x2152f0,null))[_0x38a7('0x47')](handleError(_0x2152f0,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 2a1a291..bb9e665 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 _0x69b8=['path','rimraf','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x47e3d4,_0x5b932c){var _0xad7578=function(_0x5c2b6f){while(--_0x5c2b6f){_0x47e3d4['push'](_0x47e3d4['shift']());}};_0xad7578(++_0x5b932c);}(_0x69b8,0x159));var _0x869b=function(_0x1c167a,_0x5aafd5){_0x1c167a=_0x1c167a-0x0;var _0x50a79d=_0x69b8[_0x1c167a];return _0x50a79d;};'use strict';var _=require(_0x869b('0x0'));var util=require('util');var logger=require(_0x869b('0x1'))(_0x869b('0x2'));var moment=require(_0x869b('0x3'));var BPromise=require(_0x869b('0x4'));var rp=require(_0x869b('0x5'));var fs=require('fs');var path=require(_0x869b('0x6'));var rimraf=require(_0x869b('0x7'));var config=require('../../config/environment');var attributes=require(_0x869b('0x8'));module[_0x869b('0x9')]=function(_0x261288,_0x36df40){return _0x261288[_0x869b('0xa')](_0x869b('0xb'),attributes,{'tableName':_0x869b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcae9=['api','bluebird','path','rimraf','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger'];(function(_0x6ca07c,_0x5cc954){var _0x32f9b7=function(_0x33ab17){while(--_0x33ab17){_0x6ca07c['push'](_0x6ca07c['shift']());}};_0x32f9b7(++_0x5cc954);}(_0xcae9,0xfa));var _0x9cae=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0xcae9[_0xf48cce];return _0x2a5c38;};'use strict';var _=require(_0x9cae('0x0'));var util=require(_0x9cae('0x1'));var logger=require(_0x9cae('0x2'))(_0x9cae('0x3'));var moment=require('moment');var BPromise=require(_0x9cae('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9cae('0x5'));var rimraf=require(_0x9cae('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0x9cae('0x7')]=function(_0x31ea64,_0x334329){return _0x31ea64[_0x9cae('0x8')](_0x9cae('0x9'),attributes,{'tableName':_0x9cae('0xa'),'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 b9a8e7d..3e6ace6 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 _0xc4df=['stringify','error','ZohoConfiguration,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xc4df,0x195));var _0xfc4d=function(_0x21c9cd,_0x4cef28){_0x21c9cd=_0x21c9cd-0x0;var _0x2c37bb=_0xc4df[_0x21c9cd];return _0x2c37bb;};'use strict';var _=require(_0xfc4d('0x0'));var util=require(_0xfc4d('0x1'));var moment=require(_0xfc4d('0x2'));var BPromise=require(_0xfc4d('0x3'));var rs=require(_0xfc4d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfc4d('0x5'));var logger=require(_0xfc4d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfc4d('0x7'));var client=jayson[_0xfc4d('0x8')][_0xfc4d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe2f7ef,_0x5d3942,_0x22fe85){return new BPromise(function(_0x392402,_0x4aaf58){return client[_0xfc4d('0xa')](_0xe2f7ef,_0x22fe85)[_0xfc4d('0xb')](function(_0x38b492){logger[_0xfc4d('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x5d3942,'request\x20sent');logger[_0xfc4d('0xd')](_0xfc4d('0xe'),_0x5d3942,'request\x20sent',JSON[_0xfc4d('0xf')](_0x38b492));if(_0x38b492[_0xfc4d('0x10')]){if(_0x38b492[_0xfc4d('0x10')]['code']===0x1f4){logger['error'](_0xfc4d('0x11'),_0x5d3942,_0x38b492[_0xfc4d('0x10')][_0xfc4d('0x12')]);return _0x4aaf58(_0x38b492[_0xfc4d('0x10')][_0xfc4d('0x12')]);}logger['error'](_0xfc4d('0x11'),_0x5d3942,_0x38b492[_0xfc4d('0x10')][_0xfc4d('0x12')]);return _0x392402(_0x38b492[_0xfc4d('0x10')][_0xfc4d('0x12')]);}else{logger[_0xfc4d('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x5d3942,_0xfc4d('0x13'));_0x392402(_0x38b492[_0xfc4d('0x14')][_0xfc4d('0x12')]);}})['catch'](function(_0x2e112e){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x5d3942,_0x2e112e);_0x4aaf58(_0x2e112e);});});} \ No newline at end of file +var _0xe487=['debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent'];(function(_0x3500c3,_0x398aea){var _0x2e0c59=function(_0x18b718){while(--_0x18b718){_0x3500c3['push'](_0x3500c3['shift']());}};_0x2e0c59(++_0x398aea);}(_0xe487,0xb3));var _0x7e48=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe487[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7e48('0x0'));var util=require(_0x7e48('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7e48('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e48('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7e48('0x4'));var config=require(_0x7e48('0x5'));var jayson=require(_0x7e48('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x394c5b,_0xae5215,_0x25696d){return new BPromise(function(_0x59cc49,_0x3ab4e6){return client[_0x7e48('0x7')](_0x394c5b,_0x25696d)[_0x7e48('0x8')](function(_0x4a60ef){logger[_0x7e48('0x9')]('ZohoConfiguration,\x20%s,\x20%s',_0xae5215,_0x7e48('0xa'));logger[_0x7e48('0xb')](_0x7e48('0xc'),_0xae5215,_0x7e48('0xa'),JSON['stringify'](_0x4a60ef));if(_0x4a60ef[_0x7e48('0xd')]){if(_0x4a60ef['error'][_0x7e48('0xe')]===0x1f4){logger[_0x7e48('0xd')](_0x7e48('0xf'),_0xae5215,_0x4a60ef['error'][_0x7e48('0x10')]);return _0x3ab4e6(_0x4a60ef[_0x7e48('0xd')][_0x7e48('0x10')]);}logger[_0x7e48('0xd')](_0x7e48('0xf'),_0xae5215,_0x4a60ef[_0x7e48('0xd')][_0x7e48('0x10')]);return _0x59cc49(_0x4a60ef[_0x7e48('0xd')][_0x7e48('0x10')]);}else{logger[_0x7e48('0x9')](_0x7e48('0xf'),_0xae5215,_0x7e48('0xa'));_0x59cc49(_0x4a60ef[_0x7e48('0x11')][_0x7e48('0x10')]);}})[_0x7e48('0x12')](function(_0x49ee67){logger[_0x7e48('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0xae5215,_0x49ee67);_0x3ab4e6(_0x49ee67);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 8ff2201..5eeb16e 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 _0xfd23=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','get','show','post','create','put','/:id','update','delete','destroy','exports','express'];(function(_0x30affd,_0x47df28){var _0x97122d=function(_0x282511){while(--_0x282511){_0x30affd['push'](_0x30affd['shift']());}};_0x97122d(++_0x47df28);}(_0xfd23,0x153));var _0x3fd2=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xfd23[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3fd2('0x0'));var router=express[_0x3fd2('0x1')]();var fs_extra=require(_0x3fd2('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x3fd2('0x3'));var config=require(_0x3fd2('0x4'));var controller=require(_0x3fd2('0x5'));router['get']('/',auth[_0x3fd2('0x6')](),controller['index']);router[_0x3fd2('0x7')]('/:id',auth[_0x3fd2('0x6')](),controller[_0x3fd2('0x8')]);router[_0x3fd2('0x9')]('/',auth[_0x3fd2('0x6')](),controller[_0x3fd2('0xa')]);router[_0x3fd2('0xb')](_0x3fd2('0xc'),auth[_0x3fd2('0x6')](),controller[_0x3fd2('0xd')]);router[_0x3fd2('0xe')](_0x3fd2('0xc'),auth[_0x3fd2('0x6')](),controller[_0x3fd2('0xf')]);module[_0x3fd2('0x10')]=router; \ No newline at end of file +var _0xa830=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5212bf,_0x51d007){var _0x1c426c=function(_0x1dc20d){while(--_0x1dc20d){_0x5212bf['push'](_0x5212bf['shift']());}};_0x1c426c(++_0x51d007);}(_0xa830,0xb7));var _0x0a83=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0xa830[_0x2c3255];return _0x282aba;};'use strict';var multer=require(_0x0a83('0x0'));var util=require(_0x0a83('0x1'));var path=require(_0x0a83('0x2'));var timeout=require(_0x0a83('0x3'));var express=require('express');var router=express[_0x0a83('0x4')]();var fs_extra=require(_0x0a83('0x5'));var auth=require(_0x0a83('0x6'));var interaction=require(_0x0a83('0x7'));var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0x0a83('0x8')]('/',auth[_0x0a83('0x9')](),controller[_0x0a83('0xa')]);router[_0x0a83('0x8')](_0x0a83('0xb'),auth[_0x0a83('0x9')](),controller[_0x0a83('0xc')]);router['post']('/',auth[_0x0a83('0x9')](),controller['create']);router[_0x0a83('0xd')](_0x0a83('0xb'),auth[_0x0a83('0x9')](),controller[_0x0a83('0xe')]);router['delete']('/:id',auth[_0x0a83('0x9')](),controller[_0x0a83('0xf')]);module[_0x0a83('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 5e5b30c..9f56b25 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 _0x091d=['string','STRING','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x1c42fd,_0x2588e9){var _0x111bf4=function(_0x396ce4){while(--_0x396ce4){_0x1c42fd['push'](_0x1c42fd['shift']());}};_0x111bf4(++_0x2588e9);}(_0x091d,0xa2));var _0xd091=function(_0x57b09a,_0x14a70f){_0x57b09a=_0x57b09a-0x0;var _0x585080=_0x091d[_0x57b09a];return _0x585080;};'use strict';var Sequelize=require('sequelize');module[_0xd091('0x0')]={'type':{'type':Sequelize[_0xd091('0x1')]('string',_0xd091('0x2'),_0xd091('0x3'),_0xd091('0x4'),_0xd091('0x5')),'defaultValue':_0xd091('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd091('0x7')]},'keyType':{'type':Sequelize[_0xd091('0x1')](_0xd091('0x6'),'variable',_0xd091('0x3'))},'keyContent':{'type':Sequelize[_0xd091('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd091('0x7')]}}; \ No newline at end of file +var _0x47fa=['STRING','ENUM','customVariable','BOOLEAN','sequelize','string','variable','keyValue','picklist'];(function(_0x126cee,_0x218a7c){var _0x5337a2=function(_0x41b22b){while(--_0x41b22b){_0x126cee['push'](_0x126cee['shift']());}};_0x5337a2(++_0x218a7c);}(_0x47fa,0x1ea));var _0xa47f=function(_0x5ca784,_0x28bea2){_0x5ca784=_0x5ca784-0x0;var _0x5aa579=_0x47fa[_0x5ca784];return _0x5aa579;};'use strict';var Sequelize=require(_0xa47f('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xa47f('0x1'),_0xa47f('0x2'),'customVariable',_0xa47f('0x3'),_0xa47f('0x4')),'defaultValue':_0xa47f('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa47f('0x5')]},'keyType':{'type':Sequelize[_0xa47f('0x6')](_0xa47f('0x1'),_0xa47f('0x2'),_0xa47f('0x7'))},'keyContent':{'type':Sequelize[_0xa47f('0x5')]},'idField':{'type':Sequelize[_0xa47f('0x5')]},'nameField':{'type':Sequelize[_0xa47f('0x5')]},'customField':{'type':Sequelize[_0xa47f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa47f('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 20526e1..ed77fa3 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 _0x68ea=['filters','pick','merge','where','filter','include','findAll','rows','catch','params','rawAttributes','length','includeAll','find','create','body','destroy','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../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','then','error','name','send','index','map','ZohoField','fieldName','type','model','query','keys','attributes','intersection','fields','nolimit','order','sort'];(function(_0x4d0662,_0x145963){var _0x6eea6d=function(_0x2def06){while(--_0x2def06){_0x4d0662['push'](_0x4d0662['shift']());}};_0x6eea6d(++_0x145963);}(_0x68ea,0xe9));var _0xa68e=function(_0x118c61,_0x94be5b){_0x118c61=_0x118c61-0x0;var _0x3869ba=_0x68ea[_0x118c61];return _0x3869ba;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa68e('0x0'));var jsonpatch=require(_0xa68e('0x1'));var rp=require(_0xa68e('0x2'));var moment=require('moment');var BPromise=require(_0xa68e('0x3'));var Mustache=require(_0xa68e('0x4'));var util=require(_0xa68e('0x5'));var path=require(_0xa68e('0x6'));var sox=require('sox');var csv=require(_0xa68e('0x7'));var ejs=require(_0xa68e('0x8'));var fs=require('fs');var fs_extra=require(_0xa68e('0x9'));var _=require(_0xa68e('0xa'));var squel=require(_0xa68e('0xb'));var crypto=require('crypto');var jsforce=require(_0xa68e('0xc'));var deskjs=require(_0xa68e('0xd'));var toCsv=require(_0xa68e('0x7'));var querystring=require(_0xa68e('0xe'));var Papa=require('papaparse');var Redis=require(_0xa68e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa68e('0x10'));var hardwareService=require(_0xa68e('0x11'));var logger=require(_0xa68e('0x12'))(_0xa68e('0x13'));var utils=require(_0xa68e('0x14'));var config=require(_0xa68e('0x15'));var licenseUtil=require(_0xa68e('0x16'));var db=require(_0xa68e('0x17'))['db'];function respondWithStatusCode(_0x4fbfa4,_0x3b4ddc){_0x3b4ddc=_0x3b4ddc||0xcc;return function(_0x17cca2){if(_0x17cca2){return _0x4fbfa4['sendStatus'](_0x3b4ddc);}return _0x4fbfa4[_0xa68e('0x18')](_0x3b4ddc)[_0xa68e('0x19')]();};}function respondWithResult(_0x1a99da,_0x483eaa){_0x483eaa=_0x483eaa||0xc8;return function(_0x3ca9a1){if(_0x3ca9a1){return _0x1a99da[_0xa68e('0x18')](_0x483eaa)[_0xa68e('0x1a')](_0x3ca9a1);}};}function respondWithFilteredResult(_0x1cd698,_0x3d6076){return function(_0xb674ae){if(_0xb674ae){var _0x476dbc=typeof _0x3d6076[_0xa68e('0x1b')]===_0xa68e('0x1c')&&typeof _0x3d6076[_0xa68e('0x1d')]===_0xa68e('0x1c');var _0x58c79e=_0xb674ae[_0xa68e('0x1e')];var _0x229482=_0x476dbc?0x0:_0x3d6076[_0xa68e('0x1b')];var _0xa0c893=_0x476dbc?_0xb674ae[_0xa68e('0x1e')]:_0x3d6076[_0xa68e('0x1b')]+_0x3d6076[_0xa68e('0x1d')];var _0x5ba162;if(_0xa0c893>=_0x58c79e){_0xa0c893=_0x58c79e;_0x5ba162=0xc8;}else{_0x5ba162=0xce;}_0x1cd698['status'](_0x5ba162);return _0x1cd698[_0xa68e('0x1f')](_0xa68e('0x20'),_0x229482+'-'+_0xa0c893+'/'+_0x58c79e)['json'](_0xb674ae);}return null;};}function patchUpdates(_0x1abd47){return function(_0x169813){try{jsonpatch[_0xa68e('0x21')](_0x169813,_0x1abd47,!![]);}catch(_0x18c1e4){return BPromise[_0xa68e('0x22')](_0x18c1e4);}return _0x169813[_0xa68e('0x23')]();};}function saveUpdates(_0x49e49f,_0x25059e){return function(_0x328172){if(_0x328172){return _0x328172[_0xa68e('0x24')](_0x49e49f)[_0xa68e('0x25')](function(_0x4fc27e){return _0x4fc27e;});}return null;};}function removeEntity(_0x1484c1,_0x3b5a67){return function(_0x185163){if(_0x185163){return _0x185163['destroy']()[_0xa68e('0x25')](function(){_0x1484c1[_0xa68e('0x18')](0xcc)[_0xa68e('0x19')]();});}};}function handleEntityNotFound(_0x53b2c5,_0x32a03a){return function(_0x49ceaa){if(!_0x49ceaa){_0x53b2c5['sendStatus'](0x194);}return _0x49ceaa;};}function handleError(_0x2f9dbc,_0x351cef){_0x351cef=_0x351cef||0x1f4;return function(_0x2d3d92){logger[_0xa68e('0x26')](_0x2d3d92['stack']);if(_0x2d3d92[_0xa68e('0x27')]){delete _0x2d3d92[_0xa68e('0x27')];}_0x2f9dbc[_0xa68e('0x18')](_0x351cef)[_0xa68e('0x28')](_0x2d3d92);};}exports[_0xa68e('0x29')]=function(_0x2a1c34,_0x768d14){var _0x314ffb={},_0x586f0a={},_0x5cff44={'count':0x0,'rows':[]};var _0x3157ae=_[_0xa68e('0x2a')](db[_0xa68e('0x2b')]['rawAttributes'],function(_0x518b28){return{'name':_0x518b28[_0xa68e('0x2c')],'type':_0x518b28[_0xa68e('0x2d')]['key']};});_0x586f0a[_0xa68e('0x2e')]=_['map'](_0x3157ae,_0xa68e('0x27'));_0x586f0a[_0xa68e('0x2f')]=_[_0xa68e('0x30')](_0x2a1c34[_0xa68e('0x2f')]);_0x586f0a['filters']=_['intersection'](_0x586f0a[_0xa68e('0x2e')],_0x586f0a[_0xa68e('0x2f')]);_0x314ffb[_0xa68e('0x31')]=_[_0xa68e('0x32')](_0x586f0a[_0xa68e('0x2e')],qs[_0xa68e('0x33')](_0x2a1c34['query'][_0xa68e('0x33')]));_0x314ffb['attributes']=_0x314ffb[_0xa68e('0x31')]['length']?_0x314ffb[_0xa68e('0x31')]:_0x586f0a[_0xa68e('0x2e')];if(!_0x2a1c34[_0xa68e('0x2f')]['hasOwnProperty'](_0xa68e('0x34'))){_0x314ffb['limit']=qs[_0xa68e('0x1d')](_0x2a1c34['query'][_0xa68e('0x1d')]);_0x314ffb[_0xa68e('0x1b')]=qs[_0xa68e('0x1b')](_0x2a1c34[_0xa68e('0x2f')]['offset']);}_0x314ffb[_0xa68e('0x35')]=qs[_0xa68e('0x36')](_0x2a1c34[_0xa68e('0x2f')][_0xa68e('0x36')]);_0x314ffb['where']=qs[_0xa68e('0x37')](_[_0xa68e('0x38')](_0x2a1c34[_0xa68e('0x2f')],_0x586f0a[_0xa68e('0x37')]),_0x3157ae);if(_0x2a1c34['query']['filter']){_0x314ffb['where']=_[_0xa68e('0x39')](_0x314ffb[_0xa68e('0x3a')],{'$or':_[_0xa68e('0x2a')](_0x3157ae,function(_0x2e482b){if(_0x2e482b['type']!=='VIRTUAL'){var _0x212b88={};_0x212b88[_0x2e482b['name']]={'$like':'%'+_0x2a1c34[_0xa68e('0x2f')][_0xa68e('0x3b')]+'%'};return _0x212b88;}})});}_0x314ffb=_[_0xa68e('0x39')]({},_0x314ffb,_0x2a1c34['options']);var _0x5b5084={'where':_0x314ffb[_0xa68e('0x3a')]};return db[_0xa68e('0x2b')]['count'](_0x5b5084)['then'](function(_0x52bfa2){_0x5cff44['count']=_0x52bfa2;if(_0x2a1c34[_0xa68e('0x2f')]['includeAll']){_0x314ffb[_0xa68e('0x3c')]=[{'all':!![]}];}return db[_0xa68e('0x2b')][_0xa68e('0x3d')](_0x314ffb);})[_0xa68e('0x25')](function(_0x4d7015){_0x5cff44[_0xa68e('0x3e')]=_0x4d7015;return _0x5cff44;})['then'](respondWithFilteredResult(_0x768d14,_0x314ffb))[_0xa68e('0x3f')](handleError(_0x768d14,null));};exports['show']=function(_0x13da0f,_0x40254b){var _0x24a46a={'raw':!![],'where':{'id':_0x13da0f[_0xa68e('0x40')]['id']}},_0x1727e7={};_0x1727e7['model']=_[_0xa68e('0x30')](db[_0xa68e('0x2b')][_0xa68e('0x41')]);_0x1727e7[_0xa68e('0x2f')]=_[_0xa68e('0x30')](_0x13da0f['query']);_0x1727e7['filters']=_['intersection'](_0x1727e7[_0xa68e('0x2e')],_0x1727e7[_0xa68e('0x2f')]);_0x24a46a['attributes']=_[_0xa68e('0x32')](_0x1727e7[_0xa68e('0x2e')],qs[_0xa68e('0x33')](_0x13da0f[_0xa68e('0x2f')][_0xa68e('0x33')]));_0x24a46a[_0xa68e('0x31')]=_0x24a46a[_0xa68e('0x31')][_0xa68e('0x42')]?_0x24a46a[_0xa68e('0x31')]:_0x1727e7[_0xa68e('0x2e')];if(_0x13da0f[_0xa68e('0x2f')][_0xa68e('0x43')]){_0x24a46a['include']=[{'all':!![]}];}_0x24a46a=_[_0xa68e('0x39')]({},_0x24a46a,_0x13da0f['options']);return db[_0xa68e('0x2b')][_0xa68e('0x44')](_0x24a46a)['then'](handleEntityNotFound(_0x40254b,null))['then'](respondWithResult(_0x40254b,null))[_0xa68e('0x3f')](handleError(_0x40254b,null));};exports[_0xa68e('0x45')]=function(_0x7b58bd,_0xfd33f0){return db[_0xa68e('0x2b')][_0xa68e('0x45')](_0x7b58bd[_0xa68e('0x46')],{})['then'](respondWithResult(_0xfd33f0,0xc9))['catch'](handleError(_0xfd33f0,null));};exports[_0xa68e('0x24')]=function(_0x425270,_0x5b9db6){if(_0x425270['body']['id']){delete _0x425270[_0xa68e('0x46')]['id'];}return db[_0xa68e('0x2b')][_0xa68e('0x44')]({'where':{'id':_0x425270[_0xa68e('0x40')]['id']}})[_0xa68e('0x25')](handleEntityNotFound(_0x5b9db6,null))['then'](saveUpdates(_0x425270[_0xa68e('0x46')],null))[_0xa68e('0x25')](respondWithResult(_0x5b9db6,null))['catch'](handleError(_0x5b9db6,null));};exports[_0xa68e('0x47')]=function(_0x35c9b9,_0x1fe759){return db[_0xa68e('0x2b')][_0xa68e('0x44')]({'where':{'id':_0x35c9b9['params']['id']}})[_0xa68e('0x25')](handleEntityNotFound(_0x1fe759,null))[_0xa68e('0x25')](removeEntity(_0x1fe759,null))[_0xa68e('0x3f')](handleError(_0x1fe759,null));}; \ No newline at end of file +var _0xa44c=['params','rawAttributes','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','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','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','send','index','map','ZohoField','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','show'];(function(_0x3c3e20,_0x50ec3f){var _0x5e43e9=function(_0x169eec){while(--_0x169eec){_0x3c3e20['push'](_0x3c3e20['shift']());}};_0x5e43e9(++_0x50ec3f);}(_0xa44c,0x18d));var _0xca44=function(_0x59b0ba,_0x2a0c73){_0x59b0ba=_0x59b0ba-0x0;var _0x50fa2e=_0xa44c[_0x59b0ba];return _0x50fa2e;};'use strict';var emlformat=require(_0xca44('0x0'));var rimraf=require(_0xca44('0x1'));var zipdir=require(_0xca44('0x2'));var jsonpatch=require(_0xca44('0x3'));var rp=require(_0xca44('0x4'));var moment=require('moment');var BPromise=require(_0xca44('0x5'));var Mustache=require(_0xca44('0x6'));var util=require(_0xca44('0x7'));var path=require(_0xca44('0x8'));var sox=require('sox');var csv=require(_0xca44('0x9'));var ejs=require(_0xca44('0xa'));var fs=require('fs');var fs_extra=require(_0xca44('0xb'));var _=require('lodash');var squel=require(_0xca44('0xc'));var crypto=require(_0xca44('0xd'));var jsforce=require(_0xca44('0xe'));var deskjs=require(_0xca44('0xf'));var toCsv=require(_0xca44('0x9'));var querystring=require(_0xca44('0x10'));var Papa=require(_0xca44('0x11'));var Redis=require(_0xca44('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xca44('0x13'));var as=require(_0xca44('0x14'));var hardwareService=require(_0xca44('0x15'));var logger=require(_0xca44('0x16'))(_0xca44('0x17'));var utils=require(_0xca44('0x18'));var config=require(_0xca44('0x19'));var licenseUtil=require(_0xca44('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa43cfe,_0x4865c6){_0x4865c6=_0x4865c6||0xcc;return function(_0x1dc22f){if(_0x1dc22f){return _0xa43cfe[_0xca44('0x1b')](_0x4865c6);}return _0xa43cfe[_0xca44('0x1c')](_0x4865c6)['end']();};}function respondWithResult(_0x380cce,_0x4c20bd){_0x4c20bd=_0x4c20bd||0xc8;return function(_0xf00ec7){if(_0xf00ec7){return _0x380cce[_0xca44('0x1c')](_0x4c20bd)[_0xca44('0x1d')](_0xf00ec7);}};}function respondWithFilteredResult(_0x1a21a5,_0x2fcb08){return function(_0x5bb0f8){if(_0x5bb0f8){var _0x2c765b=typeof _0x2fcb08[_0xca44('0x1e')]===_0xca44('0x1f')&&typeof _0x2fcb08[_0xca44('0x20')]===_0xca44('0x1f');var _0x46221c=_0x5bb0f8[_0xca44('0x21')];var _0x53e8cc=_0x2c765b?0x0:_0x2fcb08[_0xca44('0x1e')];var _0x222f78=_0x2c765b?_0x5bb0f8['count']:_0x2fcb08[_0xca44('0x1e')]+_0x2fcb08[_0xca44('0x20')];var _0x3f5bb0;if(_0x222f78>=_0x46221c){_0x222f78=_0x46221c;_0x3f5bb0=0xc8;}else{_0x3f5bb0=0xce;}_0x1a21a5[_0xca44('0x1c')](_0x3f5bb0);return _0x1a21a5[_0xca44('0x22')]('Content-Range',_0x53e8cc+'-'+_0x222f78+'/'+_0x46221c)['json'](_0x5bb0f8);}return null;};}function patchUpdates(_0xb49965){return function(_0x48c16a){try{jsonpatch[_0xca44('0x23')](_0x48c16a,_0xb49965,!![]);}catch(_0x533781){return BPromise['reject'](_0x533781);}return _0x48c16a[_0xca44('0x24')]();};}function saveUpdates(_0x201bc3,_0x20a0ef){return function(_0x1b78c8){if(_0x1b78c8){return _0x1b78c8[_0xca44('0x25')](_0x201bc3)[_0xca44('0x26')](function(_0x4e9c95){return _0x4e9c95;});}return null;};}function removeEntity(_0x4d1da0,_0x212af5){return function(_0x18b06c){if(_0x18b06c){return _0x18b06c[_0xca44('0x27')]()[_0xca44('0x26')](function(){_0x4d1da0[_0xca44('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xee0574,_0x45eb27){return function(_0x3612aa){if(!_0x3612aa){_0xee0574['sendStatus'](0x194);}return _0x3612aa;};}function handleError(_0x24a6d7,_0x412a05){_0x412a05=_0x412a05||0x1f4;return function(_0x3f8a71){logger[_0xca44('0x28')](_0x3f8a71[_0xca44('0x29')]);if(_0x3f8a71['name']){delete _0x3f8a71['name'];}_0x24a6d7[_0xca44('0x1c')](_0x412a05)[_0xca44('0x2a')](_0x3f8a71);};}exports[_0xca44('0x2b')]=function(_0x3b3e12,_0xb8a63a){var _0x3513c6={},_0x4d5fad={},_0x1e25dd={'count':0x0,'rows':[]};var _0x89dc66=_[_0xca44('0x2c')](db[_0xca44('0x2d')]['rawAttributes'],function(_0x3e995c){return{'name':_0x3e995c[_0xca44('0x2e')],'type':_0x3e995c[_0xca44('0x2f')][_0xca44('0x30')]};});_0x4d5fad['model']=_[_0xca44('0x2c')](_0x89dc66,_0xca44('0x31'));_0x4d5fad[_0xca44('0x32')]=_[_0xca44('0x33')](_0x3b3e12[_0xca44('0x32')]);_0x4d5fad[_0xca44('0x34')]=_[_0xca44('0x35')](_0x4d5fad[_0xca44('0x36')],_0x4d5fad[_0xca44('0x32')]);_0x3513c6[_0xca44('0x37')]=_[_0xca44('0x35')](_0x4d5fad['model'],qs[_0xca44('0x38')](_0x3b3e12['query']['fields']));_0x3513c6['attributes']=_0x3513c6['attributes']['length']?_0x3513c6[_0xca44('0x37')]:_0x4d5fad[_0xca44('0x36')];if(!_0x3b3e12[_0xca44('0x32')]['hasOwnProperty'](_0xca44('0x39'))){_0x3513c6[_0xca44('0x20')]=qs[_0xca44('0x20')](_0x3b3e12[_0xca44('0x32')]['limit']);_0x3513c6[_0xca44('0x1e')]=qs[_0xca44('0x1e')](_0x3b3e12[_0xca44('0x32')][_0xca44('0x1e')]);}_0x3513c6[_0xca44('0x3a')]=qs[_0xca44('0x3b')](_0x3b3e12[_0xca44('0x32')][_0xca44('0x3b')]);_0x3513c6['where']=qs['filters'](_[_0xca44('0x3c')](_0x3b3e12[_0xca44('0x32')],_0x4d5fad[_0xca44('0x34')]),_0x89dc66);if(_0x3b3e12[_0xca44('0x32')][_0xca44('0x3d')]){_0x3513c6['where']=_[_0xca44('0x3e')](_0x3513c6[_0xca44('0x3f')],{'$or':_[_0xca44('0x2c')](_0x89dc66,function(_0x2d7d24){if(_0x2d7d24[_0xca44('0x2f')]!==_0xca44('0x40')){var _0x4aa32a={};_0x4aa32a[_0x2d7d24[_0xca44('0x31')]]={'$like':'%'+_0x3b3e12[_0xca44('0x32')][_0xca44('0x3d')]+'%'};return _0x4aa32a;}})});}_0x3513c6=_[_0xca44('0x3e')]({},_0x3513c6,_0x3b3e12[_0xca44('0x41')]);var _0x53fdbe={'where':_0x3513c6[_0xca44('0x3f')]};return db['ZohoField'][_0xca44('0x21')](_0x53fdbe)[_0xca44('0x26')](function(_0x163ed1){_0x1e25dd['count']=_0x163ed1;if(_0x3b3e12[_0xca44('0x32')][_0xca44('0x42')]){_0x3513c6[_0xca44('0x43')]=[{'all':!![]}];}return db[_0xca44('0x2d')][_0xca44('0x44')](_0x3513c6);})[_0xca44('0x26')](function(_0x22d2d3){_0x1e25dd[_0xca44('0x45')]=_0x22d2d3;return _0x1e25dd;})[_0xca44('0x26')](respondWithFilteredResult(_0xb8a63a,_0x3513c6))['catch'](handleError(_0xb8a63a,null));};exports[_0xca44('0x46')]=function(_0x3502b2,_0x2cf6b4){var _0x3b3f44={'raw':!![],'where':{'id':_0x3502b2[_0xca44('0x47')]['id']}},_0x2de870={};_0x2de870['model']=_[_0xca44('0x33')](db['ZohoField'][_0xca44('0x48')]);_0x2de870[_0xca44('0x32')]=_[_0xca44('0x33')](_0x3502b2[_0xca44('0x32')]);_0x2de870[_0xca44('0x34')]=_['intersection'](_0x2de870[_0xca44('0x36')],_0x2de870[_0xca44('0x32')]);_0x3b3f44[_0xca44('0x37')]=_[_0xca44('0x35')](_0x2de870[_0xca44('0x36')],qs[_0xca44('0x38')](_0x3502b2[_0xca44('0x32')]['fields']));_0x3b3f44['attributes']=_0x3b3f44[_0xca44('0x37')][_0xca44('0x49')]?_0x3b3f44[_0xca44('0x37')]:_0x2de870[_0xca44('0x36')];if(_0x3502b2[_0xca44('0x32')]['includeAll']){_0x3b3f44[_0xca44('0x43')]=[{'all':!![]}];}_0x3b3f44=_[_0xca44('0x3e')]({},_0x3b3f44,_0x3502b2['options']);return db['ZohoField'][_0xca44('0x4a')](_0x3b3f44)[_0xca44('0x26')](handleEntityNotFound(_0x2cf6b4,null))[_0xca44('0x26')](respondWithResult(_0x2cf6b4,null))[_0xca44('0x4b')](handleError(_0x2cf6b4,null));};exports[_0xca44('0x4c')]=function(_0x43092b,_0x2ba788){return db['ZohoField'][_0xca44('0x4c')](_0x43092b[_0xca44('0x4d')],{})[_0xca44('0x26')](respondWithResult(_0x2ba788,0xc9))[_0xca44('0x4b')](handleError(_0x2ba788,null));};exports[_0xca44('0x25')]=function(_0x8e77ac,_0x1964ec){if(_0x8e77ac[_0xca44('0x4d')]['id']){delete _0x8e77ac[_0xca44('0x4d')]['id'];}return db['ZohoField'][_0xca44('0x4a')]({'where':{'id':_0x8e77ac[_0xca44('0x47')]['id']}})['then'](handleEntityNotFound(_0x1964ec,null))[_0xca44('0x26')](saveUpdates(_0x8e77ac[_0xca44('0x4d')],null))[_0xca44('0x26')](respondWithResult(_0x1964ec,null))['catch'](handleError(_0x1964ec,null));};exports[_0xca44('0x27')]=function(_0x150332,_0x5908dd){return db['ZohoField'][_0xca44('0x4a')]({'where':{'id':_0x150332[_0xca44('0x47')]['id']}})[_0xca44('0x26')](handleEntityNotFound(_0x5908dd,null))['then'](removeEntity(_0x5908dd,null))[_0xca44('0x4b')](handleError(_0x5908dd,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index c2a127f..7c2ca41 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 _0xd046=['util','../../config/logger','api','bluebird','rimraf','./intZohoField.attributes','define','zoho_unique_index','idField'];(function(_0x5a4b24,_0x49c0e6){var _0x41fc92=function(_0x285b76){while(--_0x285b76){_0x5a4b24['push'](_0x5a4b24['shift']());}};_0x41fc92(++_0x49c0e6);}(_0xd046,0x129));var _0x6d04=function(_0x331d25,_0x27ad76){_0x331d25=_0x331d25-0x0;var _0x207db4=_0xd046[_0x331d25];return _0x207db4;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var logger=require(_0x6d04('0x1'))(_0x6d04('0x2'));var moment=require('moment');var BPromise=require(_0x6d04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6d04('0x4'));var config=require('../../config/environment');var attributes=require(_0x6d04('0x5'));module['exports']=function(_0x4bacb1,_0xf3b4e7){return _0x4bacb1[_0x6d04('0x6')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x6d04('0x7'),'fields':[_0x6d04('0x8'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x583c=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./intZohoField.attributes','define','ZohoField','zoho_unique_index','idField','lodash'];(function(_0xa39eb6,_0x54efa2){var _0x130015=function(_0x482304){while(--_0x482304){_0xa39eb6['push'](_0xa39eb6['shift']());}};_0x130015(++_0x54efa2);}(_0x583c,0x12b));var _0xc583=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x583c[_0x5627e1];return _0x2f013f;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var logger=require(_0xc583('0x2'))(_0xc583('0x3'));var moment=require('moment');var BPromise=require(_0xc583('0x4'));var rp=require(_0xc583('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc583('0x6'));var attributes=require(_0xc583('0x7'));module['exports']=function(_0xd3a750,_0x365ed6){return _0xd3a750[_0xc583('0x8')](_0xc583('0x9'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xc583('0xa'),'fields':[_0xc583('0xb'),'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 bd7d021..291edae 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 _0xda53=['error','code','message','ZohoField,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s'];(function(_0x40f610,_0x26a5ef){var _0x4a635d=function(_0x225935){while(--_0x225935){_0x40f610['push'](_0x40f610['shift']());}};_0x4a635d(++_0x26a5ef);}(_0xda53,0xbe));var _0x3da5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda53[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3da5('0x0'));var util=require('util');var moment=require(_0x3da5('0x1'));var BPromise=require(_0x3da5('0x2'));var rs=require(_0x3da5('0x3'));var fs=require('fs');var Redis=require(_0x3da5('0x4'));var db=require(_0x3da5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3da5('0x6'))(_0x3da5('0x7'));var config=require(_0x3da5('0x8'));var jayson=require(_0x3da5('0x9'));var client=jayson[_0x3da5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15f589,_0x32f368,_0x3b8c90){return new BPromise(function(_0x306069,_0x4a4662){return client[_0x3da5('0xb')](_0x15f589,_0x3b8c90)[_0x3da5('0xc')](function(_0x5b6b3e){logger[_0x3da5('0xd')]('ZohoField,\x20%s,\x20%s',_0x32f368,_0x3da5('0xe'));logger[_0x3da5('0xf')](_0x3da5('0x10'),_0x32f368,'request\x20sent',JSON['stringify'](_0x5b6b3e));if(_0x5b6b3e[_0x3da5('0x11')]){if(_0x5b6b3e['error'][_0x3da5('0x12')]===0x1f4){logger[_0x3da5('0x11')]('ZohoField,\x20%s,\x20%s',_0x32f368,_0x5b6b3e[_0x3da5('0x11')][_0x3da5('0x13')]);return _0x4a4662(_0x5b6b3e[_0x3da5('0x11')][_0x3da5('0x13')]);}logger[_0x3da5('0x11')](_0x3da5('0x14'),_0x32f368,_0x5b6b3e[_0x3da5('0x11')][_0x3da5('0x13')]);return _0x306069(_0x5b6b3e['error']['message']);}else{logger['info'](_0x3da5('0x14'),_0x32f368,_0x3da5('0xe'));_0x306069(_0x5b6b3e[_0x3da5('0x15')]['message']);}})[_0x3da5('0x16')](function(_0x4b7c1c){logger[_0x3da5('0x11')](_0x3da5('0x14'),_0x32f368,_0x4b7c1c);_0x4a4662(_0x4b7c1c);});});} \ No newline at end of file +var _0xe176=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x25efdf,_0x521462){var _0x22c495=function(_0x184469){while(--_0x184469){_0x25efdf['push'](_0x25efdf['shift']());}};_0x22c495(++_0x521462);}(_0xe176,0x69));var _0x6e17=function(_0x333798,_0x9f6561){_0x333798=_0x333798-0x0;var _0x389f4e=_0xe176[_0x333798];return _0x389f4e;};'use strict';var _=require(_0x6e17('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6e17('0x1'));var rs=require(_0x6e17('0x2'));var fs=require('fs');var Redis=require(_0x6e17('0x3'));var db=require(_0x6e17('0x4'))['db'];var utils=require(_0x6e17('0x5'));var logger=require(_0x6e17('0x6'))(_0x6e17('0x7'));var config=require('../../config/environment');var jayson=require(_0x6e17('0x8'));var client=jayson[_0x6e17('0x9')][_0x6e17('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x319d3a,_0x165cb2,_0x4a24c1){return new BPromise(function(_0x2f1bc4,_0x3bf14a){return client[_0x6e17('0xb')](_0x319d3a,_0x4a24c1)[_0x6e17('0xc')](function(_0x538636){logger[_0x6e17('0xd')](_0x6e17('0xe'),_0x165cb2,_0x6e17('0xf'));logger[_0x6e17('0x10')](_0x6e17('0x11'),_0x165cb2,'request\x20sent',JSON[_0x6e17('0x12')](_0x538636));if(_0x538636[_0x6e17('0x13')]){if(_0x538636['error']['code']===0x1f4){logger[_0x6e17('0x13')](_0x6e17('0xe'),_0x165cb2,_0x538636[_0x6e17('0x13')][_0x6e17('0x14')]);return _0x3bf14a(_0x538636[_0x6e17('0x13')][_0x6e17('0x14')]);}logger['error'](_0x6e17('0xe'),_0x165cb2,_0x538636['error'][_0x6e17('0x14')]);return _0x2f1bc4(_0x538636[_0x6e17('0x13')]['message']);}else{logger[_0x6e17('0xd')](_0x6e17('0xe'),_0x165cb2,_0x6e17('0xf'));_0x2f1bc4(_0x538636['result'][_0x6e17('0x14')]);}})[_0x6e17('0x15')](function(_0x104e08){logger[_0x6e17('0x13')](_0x6e17('0xe'),_0x165cb2,_0x104e08);_0x3bf14a(_0x104e08);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 86cebda..d4274b1 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x28c094,_0x309f00){var _0x3d8c87=function(_0x5d26d8){while(--_0x5d26d8){_0x28c094['push'](_0x28c094['shift']());}};_0x3d8c87(++_0x309f00);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x33ef8f,_0x559e8e){var _0x164226=function(_0x11691d){while(--_0x11691d){_0x33ef8f['push'](_0x33ef8f['shift']());}};_0x164226(++_0x559e8e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index ed39ca3..b9f1e4e 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 _0xcdac=['STRING','unique_name_and_version','BOOLEAN','state','sequelize','exports'];(function(_0x276c8e,_0x30408d){var _0x57888f=function(_0xc8e6a4){while(--_0xc8e6a4){_0x276c8e['push'](_0x276c8e['shift']());}};_0x57888f(++_0x30408d);}(_0xcdac,0x76));var _0xccda=function(_0x1fc2a7,_0x2410f3){_0x1fc2a7=_0x1fc2a7-0x0;var _0xb75c52=_0xcdac[_0x1fc2a7];return _0xb75c52;};'use strict';var Sequelize=require(_0xccda('0x0'));module[_0xccda('0x1')]={'name':{'type':Sequelize[_0xccda('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xccda('0x2')],'allowNull':![],'unique':_0xccda('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xccda('0x2')]},'type':{'type':Sequelize[_0xccda('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xccda('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xccda('0x2')]},'logo':{'type':Sequelize[_0xccda('0x2')]},'state':{'type':Sequelize[_0xccda('0x2')],'unique':_0xccda('0x5')},'description':{'type':Sequelize[_0xccda('0x2')]},'title':{'type':Sequelize[_0xccda('0x2')]},'remoteUri':{'type':Sequelize[_0xccda('0x2')]},'link':{'type':Sequelize[_0xccda('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xe3db=['sequelize','exports','unique_name_and_version','STRING','app.js','INTEGER','BOOLEAN','state'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xe3db,0xc8));var _0xbe3d=function(_0x1c18b8,_0x205298){_0x1c18b8=_0x1c18b8-0x0;var _0x9f6e8=_0xe3db[_0x1c18b8];return _0x9f6e8;};'use strict';var Sequelize=require(_0xbe3d('0x0'));module[_0xbe3d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbe3d('0x2')},'version':{'type':Sequelize[_0xbe3d('0x3')],'allowNull':![],'unique':_0xbe3d('0x2')},'main':{'type':Sequelize[_0xbe3d('0x3')],'defaultValue':_0xbe3d('0x4')},'filename':{'type':Sequelize[_0xbe3d('0x3')]},'path':{'type':Sequelize[_0xbe3d('0x3')]},'type':{'type':Sequelize[_0xbe3d('0x3')]},'size':{'type':Sequelize[_0xbe3d('0x5')]},'active':{'type':Sequelize[_0xbe3d('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xbe3d('0x3')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xbe3d('0x3')],'unique':_0xbe3d('0x7')},'description':{'type':Sequelize[_0xbe3d('0x3')]},'title':{'type':Sequelize[_0xbe3d('0x3')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xbe3d('0x3')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 5b07b51..6fc4d0d 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 _0x66fa=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','includeAll','include','Integration','findAll','rows','catch','merge','options','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x66fa,0x117));var _0xa66f=function(_0x3583c2,_0x2439ba){_0x3583c2=_0x3583c2-0x0;var _0x305338=_0x66fa[_0x3583c2];return _0x305338;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa66f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x251189,_0x14af70){_0x14af70=_0x14af70||0xcc;return function(_0xca12f8){if(_0xca12f8){return _0x251189['sendStatus'](_0x14af70);}return _0x251189['status'](_0x14af70)[_0xa66f('0x15')]();};}function respondWithResult(_0x4e09cf,_0x528427){_0x528427=_0x528427||0xc8;return function(_0x5a7b16){if(_0x5a7b16){return _0x4e09cf[_0xa66f('0x16')](_0x528427)[_0xa66f('0x17')](_0x5a7b16);}};}function respondWithFilteredResult(_0x267129,_0x236d64){return function(_0xd348f9){if(_0xd348f9){var _0x567d4f=typeof _0x236d64['offset']===_0xa66f('0x18')&&typeof _0x236d64[_0xa66f('0x19')]===_0xa66f('0x18');var _0x403f4d=_0xd348f9['count'];var _0x1cbe64=_0x567d4f?0x0:_0x236d64['offset'];var _0x4a28d4=_0x567d4f?_0xd348f9[_0xa66f('0x1a')]:_0x236d64[_0xa66f('0x1b')]+_0x236d64[_0xa66f('0x19')];var _0x355ddc;if(_0x4a28d4>=_0x403f4d){_0x4a28d4=_0x403f4d;_0x355ddc=0xc8;}else{_0x355ddc=0xce;}_0x267129[_0xa66f('0x16')](_0x355ddc);return _0x267129[_0xa66f('0x1c')](_0xa66f('0x1d'),_0x1cbe64+'-'+_0x4a28d4+'/'+_0x403f4d)[_0xa66f('0x17')](_0xd348f9);}return null;};}function patchUpdates(_0x2033a4){return function(_0x2d9602){try{jsonpatch[_0xa66f('0x1e')](_0x2d9602,_0x2033a4,!![]);}catch(_0xbba376){return BPromise[_0xa66f('0x1f')](_0xbba376);}return _0x2d9602[_0xa66f('0x20')]();};}function saveUpdates(_0x82924d,_0x5cd613){return function(_0x27f570){if(_0x27f570){return _0x27f570[_0xa66f('0x21')](_0x82924d)[_0xa66f('0x22')](function(_0x37ee13){return _0x37ee13;});}return null;};}function removeEntity(_0x5cbd82,_0x337602){return function(_0x473822){if(_0x473822){return _0x473822[_0xa66f('0x23')]()[_0xa66f('0x22')](function(){_0x5cbd82['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xed98b9,_0x598942){return function(_0x3a3e4f){if(!_0x3a3e4f){_0xed98b9[_0xa66f('0x24')](0x194);}return _0x3a3e4f;};}function handleError(_0x384164,_0x57da7f){_0x57da7f=_0x57da7f||0x1f4;return function(_0x4683c7){logger[_0xa66f('0x25')](_0x4683c7[_0xa66f('0x26')]);if(_0x4683c7[_0xa66f('0x27')]){delete _0x4683c7[_0xa66f('0x27')];}_0x384164[_0xa66f('0x16')](_0x57da7f)[_0xa66f('0x28')](_0x4683c7);};}exports[_0xa66f('0x29')]=function(_0x20ee67,_0x117d03){var _0x45f71c={},_0x63650b={},_0x42b966={'count':0x0,'rows':[]};var _0xeeb22e=_['map'](db['Integration'][_0xa66f('0x2a')],function(_0x27ceae){return{'name':_0x27ceae['fieldName'],'type':_0x27ceae[_0xa66f('0x2b')][_0xa66f('0x2c')]};});_0x63650b['model']=_[_0xa66f('0x2d')](_0xeeb22e,_0xa66f('0x27'));_0x63650b[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x20ee67[_0xa66f('0x2e')]);_0x63650b['filters']=_[_0xa66f('0x30')](_0x63650b['model'],_0x63650b[_0xa66f('0x2e')]);_0x45f71c[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x63650b['model'],qs[_0xa66f('0x32')](_0x20ee67[_0xa66f('0x2e')]['fields']));_0x45f71c[_0xa66f('0x31')]=_0x45f71c[_0xa66f('0x31')][_0xa66f('0x33')]?_0x45f71c[_0xa66f('0x31')]:_0x63650b[_0xa66f('0x34')];if(!_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x35')](_0xa66f('0x36'))){_0x45f71c[_0xa66f('0x19')]=qs[_0xa66f('0x19')](_0x20ee67['query'][_0xa66f('0x19')]);_0x45f71c['offset']=qs[_0xa66f('0x1b')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x1b')]);}_0x45f71c[_0xa66f('0x37')]=qs[_0xa66f('0x38')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x38')]);_0x45f71c[_0xa66f('0x39')]=qs['filters'](_[_0xa66f('0x3a')](_0x20ee67['query'],_0x63650b[_0xa66f('0x3b')]),_0xeeb22e);if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3c')]){_0x45f71c['where']=_['merge'](_0x45f71c[_0xa66f('0x39')],{'$or':_[_0xa66f('0x2d')](_0xeeb22e,function(_0x20b07e){if(_0x20b07e[_0xa66f('0x2b')]!==_0xa66f('0x3d')){var _0x581dca={};_0x581dca[_0x20b07e['name']]={'$like':'%'+_0x20ee67['query'][_0xa66f('0x3c')]+'%'};return _0x581dca;}})});}_0x45f71c=_['merge']({},_0x45f71c,_0x20ee67['options']);var _0x5bf856={'where':_0x45f71c[_0xa66f('0x39')]};return db['Integration'][_0xa66f('0x1a')](_0x5bf856)[_0xa66f('0x22')](function(_0x23a546){_0x42b966[_0xa66f('0x1a')]=_0x23a546;if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3e')]){_0x45f71c[_0xa66f('0x3f')]=[{'all':!![]}];}return db[_0xa66f('0x40')][_0xa66f('0x41')](_0x45f71c);})[_0xa66f('0x22')](function(_0x3a7929){_0x42b966[_0xa66f('0x42')]=_0x3a7929;return _0x42b966;})[_0xa66f('0x22')](respondWithFilteredResult(_0x117d03,_0x45f71c))[_0xa66f('0x43')](handleError(_0x117d03,null));};exports['show']=function(_0x36037c,_0x25c2cb){var _0x58c1f2={'raw':![],'where':{'id':_0x36037c['params']['id']}},_0x248587={};_0x248587[_0xa66f('0x34')]=_[_0xa66f('0x2f')](db['Integration'][_0xa66f('0x2a')]);_0x248587[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x36037c['query']);_0x248587[_0xa66f('0x3b')]=_['intersection'](_0x248587[_0xa66f('0x34')],_0x248587[_0xa66f('0x2e')]);_0x58c1f2[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x248587[_0xa66f('0x34')],qs[_0xa66f('0x32')](_0x36037c[_0xa66f('0x2e')]['fields']));_0x58c1f2[_0xa66f('0x31')]=_0x58c1f2[_0xa66f('0x31')][_0xa66f('0x33')]?_0x58c1f2[_0xa66f('0x31')]:_0x248587[_0xa66f('0x34')];if(_0x36037c['query']['includeAll']){_0x58c1f2[_0xa66f('0x3f')]=[{'all':!![]}];}_0x58c1f2=_[_0xa66f('0x44')]({},_0x58c1f2,_0x36037c[_0xa66f('0x45')]);return db[_0xa66f('0x40')][_0xa66f('0x46')](_0x58c1f2)[_0xa66f('0x22')](handleEntityNotFound(_0x25c2cb,null))['then'](respondWithResult(_0x25c2cb,null))[_0xa66f('0x43')](handleError(_0x25c2cb,null));};exports[_0xa66f('0x47')]=function(_0x3f9cdd,_0x5651e9){return db['Integration'][_0xa66f('0x47')](_0x3f9cdd[_0xa66f('0x48')],{})[_0xa66f('0x22')](respondWithResult(_0x5651e9,0xc9))['catch'](handleError(_0x5651e9,null));};exports['update']=function(_0x52054e,_0x19e7ce){if(_0x52054e[_0xa66f('0x48')]['id']){delete _0x52054e[_0xa66f('0x48')]['id'];}return db[_0xa66f('0x40')][_0xa66f('0x46')]({'where':{'id':_0x52054e[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x19e7ce,null))[_0xa66f('0x22')](saveUpdates(_0x52054e['body'],null))[_0xa66f('0x22')](respondWithResult(_0x19e7ce,null))[_0xa66f('0x43')](handleError(_0x19e7ce,null));};exports[_0xa66f('0x23')]=function(_0x393755,_0x11597b){return db[_0xa66f('0x40')]['find']({'where':{'id':_0x393755[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x11597b,null))[_0xa66f('0x22')](removeEntity(_0x11597b,null))[_0xa66f('0x43')](handleError(_0x11597b,null));}; \ No newline at end of file +var _0x2a07=['name','send','index','map','Integration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','create','body','find','destroy','eml-format','rimraf','zip-dir','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','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2a07,0x74));var _0x72a0=function(_0x576d5b,_0x1b8b7b){_0x576d5b=_0x576d5b-0x0;var _0x5b1f5e=_0x2a07[_0x576d5b];return _0x5b1f5e;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['Integration'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['create'](_0x3a669d['body'],{})[_0x72a0('0x28')](respondWithResult(_0x304400,0xc9))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0x3cab6a,_0x35a6ad){if(_0x3cab6a[_0x72a0('0x4c')]['id']){delete _0x3cab6a[_0x72a0('0x4c')]['id'];}return db[_0x72a0('0x2e')][_0x72a0('0x4d')]({'where':{'id':_0x3cab6a[_0x72a0('0x48')]['id']}})['then'](handleEntityNotFound(_0x35a6ad,null))[_0x72a0('0x28')](saveUpdates(_0x3cab6a[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x35a6ad,null))[_0x72a0('0x46')](handleError(_0x35a6ad,null));};exports[_0x72a0('0x4e')]=function(_0x5c1570,_0x143410){return db['Integration']['find']({'where':{'id':_0x5c1570[_0x72a0('0x48')]['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x143410,null))[_0x72a0('0x28')](removeEntity(_0x143410,null))[_0x72a0('0x46')](handleError(_0x143410,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index e367526..a8a3034 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 _0x4443=['rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','util','api','moment','bluebird','request-promise','path'];(function(_0x289215,_0x3b0638){var _0x18c87e=function(_0x18f215){while(--_0x18f215){_0x289215['push'](_0x289215['shift']());}};_0x18c87e(++_0x3b0638);}(_0x4443,0xfe));var _0x3444=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4443[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var util=require(_0x3444('0x0'));var logger=require('../../config/logger')(_0x3444('0x1'));var moment=require(_0x3444('0x2'));var BPromise=require(_0x3444('0x3'));var rp=require(_0x3444('0x4'));var fs=require('fs');var path=require(_0x3444('0x5'));var rimraf=require(_0x3444('0x6'));var config=require(_0x3444('0x7'));var attributes=require(_0x3444('0x8'));module[_0x3444('0x9')]=function(_0x4c1a8e,_0x2eb29d){return _0x4c1a8e[_0x3444('0xa')](_0x3444('0xb'),attributes,{'tableName':_0x3444('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x342d=['Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./integration.attributes','exports','define'];(function(_0x16795f,_0x533662){var _0x328f13=function(_0x5b8e28){while(--_0x5b8e28){_0x16795f['push'](_0x16795f['shift']());}};_0x328f13(++_0x533662);}(_0x342d,0x144));var _0xd342=function(_0x1f3b9d,_0x487f0e){_0x1f3b9d=_0x1f3b9d-0x0;var _0x4440fc=_0x342d[_0x1f3b9d];return _0x4440fc;};'use strict';var _=require(_0xd342('0x0'));var util=require(_0xd342('0x1'));var logger=require(_0xd342('0x2'))(_0xd342('0x3'));var moment=require(_0xd342('0x4'));var BPromise=require(_0xd342('0x5'));var rp=require(_0xd342('0x6'));var fs=require('fs');var path=require(_0xd342('0x7'));var rimraf=require(_0xd342('0x8'));var config=require('../../config/environment');var attributes=require(_0xd342('0x9'));module[_0xd342('0xa')]=function(_0x90618b,_0x27928d){return _0x90618b[_0xd342('0xb')](_0xd342('0xc'),attributes,{'tableName':_0xd342('0xd'),'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 95f1364..a5761c4 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x511bab,_0x2b5425){var _0x2cb16c=function(_0x46b889){while(--_0x46b889){_0x511bab['push'](_0x511bab['shift']());}};_0x2cb16c(++_0x2b5425);}(_0x1a85,0x178));var _0x51a8=function(_0x2e48bf,_0x4bde87){_0x2e48bf=_0x2e48bf-0x0;var _0x2b6b2d=_0x1a85[_0x2e48bf];return _0x2b6b2d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('Integration,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file +var _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Integration,\x20%s,\x20%s','message','catch','lodash'];(function(_0x13c8f6,_0x2cd8db){var _0x233878=function(_0xfac740){while(--_0xfac740){_0x13c8f6['push'](_0x13c8f6['shift']());}};_0x233878(++_0x2cd8db);}(_0x66fa,0x117));var _0xa66f=function(_0x2f25b3,_0x254ccd){_0x2f25b3=_0x2f25b3-0x0;var _0x2d0c41=_0x66fa[_0x2f25b3];return _0x2d0c41;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('Integration,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('Integration,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 755250a..e901a4b 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 _0x7880=['Router','fs-extra','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0xb77988,_0x3066ca){var _0x328e88=function(_0x339863){while(--_0x339863){_0xb77988['push'](_0xb77988['shift']());}};_0x328e88(++_0x3066ca);}(_0x7880,0x1f4));var _0x0788=function(_0x5a7521,_0x2d1d5e){_0x5a7521=_0x5a7521-0x0;var _0x3d6e6a=_0x7880[_0x5a7521];return _0x3d6e6a;};'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['post']('/',auth[_0x0788('0xa')](),controller[_0x0788('0x10')]);router[_0x0788('0x11')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller['update']);router[_0x0788('0x12')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller[_0x0788('0x13')]);module[_0x0788('0x14')]=router; \ No newline at end of file +var _0x2542=['put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0xb9fa7d,_0x124334){var _0xb96b2=function(_0x5c6dbd){while(--_0x5c6dbd){_0xb9fa7d['push'](_0xb9fa7d['shift']());}};_0xb96b2(++_0x124334);}(_0x2542,0x169));var _0x2254=function(_0x32b78e,_0x2e665c){_0x32b78e=_0x32b78e-0x0;var _0x5ac668=_0x2542[_0x32b78e];return _0x5ac668;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x10')]('/',auth[_0x2254('0xc')](),controller['create']);router[_0x2254('0x11')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0x12')]);router['delete']('/:id',auth[_0x2254('0xc')](),controller[_0x2254('0x13')]);module[_0x2254('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 ba6362f..dca11b9 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 _0x5bf8=['DATE','BOOLEAN','TEXT','RECEIVED','FAILED','exports','STRING','INTEGER'];(function(_0x9d7b5a,_0x55b242){var _0x3c7ebf=function(_0x72dc8e){while(--_0x72dc8e){_0x9d7b5a['push'](_0x9d7b5a['shift']());}};_0x3c7ebf(++_0x55b242);}(_0x5bf8,0x65));var _0x85bf=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x5bf8[_0x176329];return _0x31997c;};'use strict';var Sequelize=require('sequelize');module[_0x85bf('0x0')]={'integration':{'type':Sequelize[_0x85bf('0x1')]},'eventChannel':{'type':Sequelize[_0x85bf('0x1')]},'exitStatus':{'type':Sequelize[_0x85bf('0x1')]},'ticketId':{'type':Sequelize[_0x85bf('0x1')]},'integrationId':{'type':Sequelize[_0x85bf('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x85bf('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x85bf('0x1')]},'queue':{'type':Sequelize[_0x85bf('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x85bf('0x3')]},'agentconnectAt':{'type':Sequelize[_0x85bf('0x3')]},'holdtime':{'type':Sequelize[_0x85bf('0x2')]},'agentcomplete':{'type':Sequelize[_0x85bf('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x85bf('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x85bf('0x3')]},'agentdump':{'type':Sequelize[_0x85bf('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x85bf('0x3')]},'lastevent':{'type':Sequelize[_0x85bf('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x85bf('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x85bf('0x1')]},'connectedlinename':{'type':Sequelize[_0x85bf('0x1')]},'language':{'type':Sequelize[_0x85bf('0x1')]},'accountcode':{'type':Sequelize[_0x85bf('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x85bf('0x1')]},'destchannel':{'type':Sequelize[_0x85bf('0x1')]},'destchannelstate':{'type':Sequelize[_0x85bf('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x85bf('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x85bf('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x85bf('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x85bf('0x1')]},'destlanguage':{'type':Sequelize[_0x85bf('0x1')]},'destaccountcode':{'type':Sequelize[_0x85bf('0x1')]},'destcontext':{'type':Sequelize[_0x85bf('0x1')]},'destexten':{'type':Sequelize[_0x85bf('0x1')]},'destpriority':{'type':Sequelize[_0x85bf('0x1')]},'destuniqueid':{'type':Sequelize[_0x85bf('0x1')]},'messageId':{'type':Sequelize[_0x85bf('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x85bf('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x85bf('0x1')]},'cc':{'type':Sequelize[_0x85bf('0x1')]},'attachment':{'type':Sequelize[_0x85bf('0x5')]},'html':{'type':Sequelize[_0x85bf('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM']('SENT','SENDING',_0x85bf('0x6'),_0x85bf('0x7'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x85bf('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2ac1=['FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED'];(function(_0x158cdc,_0x4cd428){var _0x32fe85=function(_0x5da864){while(--_0x5da864){_0x158cdc['push'](_0x158cdc['shift']());}};_0x32fe85(++_0x4cd428);}(_0x2ac1,0x7a));var _0x12ac=function(_0x11c72b,_0x8ca977){_0x11c72b=_0x11c72b-0x0;var _0x488f26=_0x2ac1[_0x11c72b];return _0x488f26;};'use strict';var Sequelize=require(_0x12ac('0x0'));module['exports']={'integration':{'type':Sequelize[_0x12ac('0x1')]},'eventChannel':{'type':Sequelize[_0x12ac('0x1')]},'exitStatus':{'type':Sequelize[_0x12ac('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x12ac('0x2')]},'contacts':{'type':Sequelize[_0x12ac('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x12ac('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x12ac('0x1')]},'membername':{'type':Sequelize[_0x12ac('0x1')]},'agentcalledAt':{'type':Sequelize[_0x12ac('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x12ac('0x2')]},'agentcomplete':{'type':Sequelize[_0x12ac('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x12ac('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x12ac('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x12ac('0x2')]},'reason':{'type':Sequelize[_0x12ac('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x12ac('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x12ac('0x3')]},'agentdump':{'type':Sequelize[_0x12ac('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x12ac('0x1')]},'channel':{'type':Sequelize[_0x12ac('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x12ac('0x1')]},'connectedlinenum':{'type':Sequelize[_0x12ac('0x1')]},'connectedlinename':{'type':Sequelize[_0x12ac('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x12ac('0x1')]},'context':{'type':Sequelize[_0x12ac('0x1')]},'exten':{'type':Sequelize[_0x12ac('0x1')]},'priority':{'type':Sequelize[_0x12ac('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x12ac('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x12ac('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x12ac('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x12ac('0x1')]},'destcontext':{'type':Sequelize[_0x12ac('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x12ac('0x1')]},'destuniqueid':{'type':Sequelize[_0x12ac('0x1')]},'messageId':{'type':Sequelize[_0x12ac('0x1')]},'inReplyTo':{'type':Sequelize[_0x12ac('0x1')]},'subject':{'type':Sequelize[_0x12ac('0x1')]},'from':{'type':Sequelize[_0x12ac('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x12ac('0x1')]},'attachment':{'type':Sequelize[_0x12ac('0x5')]},'html':{'type':Sequelize[_0x12ac('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x12ac('0x6')](_0x12ac('0x7'),_0x12ac('0x8'),_0x12ac('0x9'),_0x12ac('0xa'))},'url':{'type':Sequelize[_0x12ac('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x12ac('0x1')]},'projectId':{'type':Sequelize[_0x12ac('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 556945f..b9dd03a 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 _0x1b31=['destroy','sendStatus','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','key','keys','query','filters','attributes','intersection','model','fields','hasOwnProperty','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','catch','params','length','create','body','update','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then'];(function(_0x30fa1b,_0x44469f){var _0x331dbc=function(_0x41792d){while(--_0x41792d){_0x30fa1b['push'](_0x30fa1b['shift']());}};_0x331dbc(++_0x44469f);}(_0x1b31,0x103));var _0x11b3=function(_0x55be75,_0x37e1ad){_0x55be75=_0x55be75-0x0;var _0xe6bbd8=_0x1b31[_0x55be75];return _0xe6bbd8;};'use strict';var emlformat=require(_0x11b3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x11b3('0x1'));var jsonpatch=require(_0x11b3('0x2'));var rp=require('request-promise');var moment=require(_0x11b3('0x3'));var BPromise=require(_0x11b3('0x4'));var Mustache=require(_0x11b3('0x5'));var util=require(_0x11b3('0x6'));var path=require('path');var sox=require(_0x11b3('0x7'));var csv=require('to-csv');var ejs=require(_0x11b3('0x8'));var fs=require('fs');var fs_extra=require(_0x11b3('0x9'));var _=require(_0x11b3('0xa'));var squel=require(_0x11b3('0xb'));var crypto=require(_0x11b3('0xc'));var jsforce=require(_0x11b3('0xd'));var deskjs=require(_0x11b3('0xe'));var toCsv=require(_0x11b3('0xf'));var querystring=require(_0x11b3('0x10'));var Papa=require(_0x11b3('0x11'));var Redis=require('ioredis');var authService=require(_0x11b3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x11b3('0x13'));var hardwareService=require(_0x11b3('0x14'));var logger=require(_0x11b3('0x15'))('api');var utils=require(_0x11b3('0x16'));var config=require(_0x11b3('0x17'));var licenseUtil=require(_0x11b3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x130740,_0x37bd7a){_0x37bd7a=_0x37bd7a||0xcc;return function(_0x54692d){if(_0x54692d){return _0x130740['sendStatus'](_0x37bd7a);}return _0x130740[_0x11b3('0x19')](_0x37bd7a)[_0x11b3('0x1a')]();};}function respondWithResult(_0x5c53b4,_0x1efe7d){_0x1efe7d=_0x1efe7d||0xc8;return function(_0xb8b5a2){if(_0xb8b5a2){return _0x5c53b4[_0x11b3('0x19')](_0x1efe7d)[_0x11b3('0x1b')](_0xb8b5a2);}};}function respondWithFilteredResult(_0x47fa64,_0x20e960){return function(_0x4e5878){if(_0x4e5878){var _0x47c63e=typeof _0x20e960[_0x11b3('0x1c')]===_0x11b3('0x1d')&&typeof _0x20e960['limit']===_0x11b3('0x1d');var _0x5db283=_0x4e5878[_0x11b3('0x1e')];var _0x3c8ea9=_0x47c63e?0x0:_0x20e960[_0x11b3('0x1c')];var _0x20e32a=_0x47c63e?_0x4e5878[_0x11b3('0x1e')]:_0x20e960[_0x11b3('0x1c')]+_0x20e960[_0x11b3('0x1f')];var _0x438f91;if(_0x20e32a>=_0x5db283){_0x20e32a=_0x5db283;_0x438f91=0xc8;}else{_0x438f91=0xce;}_0x47fa64[_0x11b3('0x19')](_0x438f91);return _0x47fa64[_0x11b3('0x20')](_0x11b3('0x21'),_0x3c8ea9+'-'+_0x20e32a+'/'+_0x5db283)[_0x11b3('0x1b')](_0x4e5878);}return null;};}function patchUpdates(_0x591c70){return function(_0x43134b){try{jsonpatch[_0x11b3('0x22')](_0x43134b,_0x591c70,!![]);}catch(_0x26154c){return BPromise[_0x11b3('0x23')](_0x26154c);}return _0x43134b['save']();};}function saveUpdates(_0x5f1267,_0x28e854){return function(_0xc864dc){if(_0xc864dc){return _0xc864dc['update'](_0x5f1267)[_0x11b3('0x24')](function(_0x3be93b){return _0x3be93b;});}return null;};}function removeEntity(_0x4af5de,_0x4a2a88){return function(_0x58588b){if(_0x58588b){return _0x58588b[_0x11b3('0x25')]()[_0x11b3('0x24')](function(){_0x4af5de[_0x11b3('0x19')](0xcc)[_0x11b3('0x1a')]();});}};}function handleEntityNotFound(_0x215070,_0x1efe1b){return function(_0x33b0f5){if(!_0x33b0f5){_0x215070[_0x11b3('0x26')](0x194);}return _0x33b0f5;};}function handleError(_0x4c1a39,_0x15d15d){_0x15d15d=_0x15d15d||0x1f4;return function(_0x1c53cd){logger[_0x11b3('0x27')](_0x1c53cd[_0x11b3('0x28')]);if(_0x1c53cd[_0x11b3('0x29')]){delete _0x1c53cd[_0x11b3('0x29')];}_0x4c1a39[_0x11b3('0x19')](_0x15d15d)[_0x11b3('0x2a')](_0x1c53cd);};}exports[_0x11b3('0x2b')]=function(_0x1e04b8,_0x41d435){var _0x50f212={},_0x5559e3={},_0x2db46d={'count':0x0,'rows':[]};var _0x2f8b79=_[_0x11b3('0x2c')](db[_0x11b3('0x2d')][_0x11b3('0x2e')],function(_0x504916){return{'name':_0x504916[_0x11b3('0x2f')],'type':_0x504916['type'][_0x11b3('0x30')]};});_0x5559e3['model']=_[_0x11b3('0x2c')](_0x2f8b79,_0x11b3('0x29'));_0x5559e3['query']=_[_0x11b3('0x31')](_0x1e04b8[_0x11b3('0x32')]);_0x5559e3[_0x11b3('0x33')]=_['intersection'](_0x5559e3['model'],_0x5559e3[_0x11b3('0x32')]);_0x50f212[_0x11b3('0x34')]=_[_0x11b3('0x35')](_0x5559e3[_0x11b3('0x36')],qs[_0x11b3('0x37')](_0x1e04b8[_0x11b3('0x32')][_0x11b3('0x37')]));_0x50f212[_0x11b3('0x34')]=_0x50f212[_0x11b3('0x34')]['length']?_0x50f212['attributes']:_0x5559e3[_0x11b3('0x36')];if(!_0x1e04b8[_0x11b3('0x32')][_0x11b3('0x38')]('nolimit')){_0x50f212[_0x11b3('0x1f')]=qs[_0x11b3('0x1f')](_0x1e04b8[_0x11b3('0x32')][_0x11b3('0x1f')]);_0x50f212[_0x11b3('0x1c')]=qs[_0x11b3('0x1c')](_0x1e04b8['query']['offset']);}_0x50f212['order']=qs['sort'](_0x1e04b8[_0x11b3('0x32')][_0x11b3('0x39')]);_0x50f212['where']=qs['filters'](_[_0x11b3('0x3a')](_0x1e04b8[_0x11b3('0x32')],_0x5559e3[_0x11b3('0x33')]),_0x2f8b79);if(_0x1e04b8['query'][_0x11b3('0x3b')]){_0x50f212['where']=_[_0x11b3('0x3c')](_0x50f212[_0x11b3('0x3d')],{'$or':_['map'](_0x2f8b79,function(_0x1762ae){if(_0x1762ae['type']!==_0x11b3('0x3e')){var _0x1e82a8={};_0x1e82a8[_0x1762ae['name']]={'$like':'%'+_0x1e04b8['query'][_0x11b3('0x3b')]+'%'};return _0x1e82a8;}})});}_0x50f212=_['merge']({},_0x50f212,_0x1e04b8[_0x11b3('0x3f')]);var _0x151dd9={'where':_0x50f212[_0x11b3('0x3d')]};return db[_0x11b3('0x2d')]['count'](_0x151dd9)['then'](function(_0x3f906d){_0x2db46d['count']=_0x3f906d;if(_0x1e04b8[_0x11b3('0x32')][_0x11b3('0x40')]){_0x50f212[_0x11b3('0x41')]=[{'all':!![]}];}return db[_0x11b3('0x2d')]['findAll'](_0x50f212);})[_0x11b3('0x24')](function(_0x539f69){_0x2db46d['rows']=_0x539f69;return _0x2db46d;})['then'](respondWithFilteredResult(_0x41d435,_0x50f212))[_0x11b3('0x42')](handleError(_0x41d435,null));};exports['show']=function(_0x296596,_0x1e2862){var _0x312883={'raw':![],'where':{'id':_0x296596[_0x11b3('0x43')]['id']}},_0x55a960={};_0x55a960['model']=_[_0x11b3('0x31')](db['IntegrationReport'][_0x11b3('0x2e')]);_0x55a960['query']=_['keys'](_0x296596[_0x11b3('0x32')]);_0x55a960[_0x11b3('0x33')]=_['intersection'](_0x55a960[_0x11b3('0x36')],_0x55a960[_0x11b3('0x32')]);_0x312883['attributes']=_[_0x11b3('0x35')](_0x55a960[_0x11b3('0x36')],qs[_0x11b3('0x37')](_0x296596[_0x11b3('0x32')][_0x11b3('0x37')]));_0x312883[_0x11b3('0x34')]=_0x312883[_0x11b3('0x34')][_0x11b3('0x44')]?_0x312883[_0x11b3('0x34')]:_0x55a960[_0x11b3('0x36')];if(_0x296596[_0x11b3('0x32')]['includeAll']){_0x312883[_0x11b3('0x41')]=[{'all':!![]}];}_0x312883=_[_0x11b3('0x3c')]({},_0x312883,_0x296596['options']);return db[_0x11b3('0x2d')]['find'](_0x312883)[_0x11b3('0x24')](handleEntityNotFound(_0x1e2862,null))[_0x11b3('0x24')](respondWithResult(_0x1e2862,null))[_0x11b3('0x42')](handleError(_0x1e2862,null));};exports[_0x11b3('0x45')]=function(_0x1a3e1a,_0x316e85){return db[_0x11b3('0x2d')]['create'](_0x1a3e1a[_0x11b3('0x46')],{})[_0x11b3('0x24')](respondWithResult(_0x316e85,0xc9))[_0x11b3('0x42')](handleError(_0x316e85,null));};exports[_0x11b3('0x47')]=function(_0x17cf14,_0x275f6a){if(_0x17cf14[_0x11b3('0x46')]['id']){delete _0x17cf14[_0x11b3('0x46')]['id'];}return db[_0x11b3('0x2d')][_0x11b3('0x48')]({'where':{'id':_0x17cf14[_0x11b3('0x43')]['id']}})[_0x11b3('0x24')](handleEntityNotFound(_0x275f6a,null))['then'](saveUpdates(_0x17cf14[_0x11b3('0x46')],null))[_0x11b3('0x24')](respondWithResult(_0x275f6a,null))[_0x11b3('0x42')](handleError(_0x275f6a,null));};exports[_0x11b3('0x25')]=function(_0x351c05,_0x339fa4){return db['IntegrationReport']['find']({'where':{'id':_0x351c05[_0x11b3('0x43')]['id']}})['then'](handleEntityNotFound(_0x339fa4,null))[_0x11b3('0x24')](removeEntity(_0x339fa4,null))[_0x11b3('0x42')](handleError(_0x339fa4,null));};exports[_0x11b3('0x49')]=function(_0x44c23c,_0x19722f){return db[_0x11b3('0x2d')][_0x11b3('0x49')]()[_0x11b3('0x24')](respondWithResult(_0x19722f,null))['catch'](handleError(_0x19722f,null));}; \ No newline at end of file +var _0xadc9=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','sendStatus','error','stack','name','send','index','map','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','IntegrationReport','then','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','options','find','create','body','update','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service'];(function(_0x368113,_0x244119){var _0x475e26=function(_0x301a02){while(--_0x301a02){_0x368113['push'](_0x368113['shift']());}};_0x475e26(++_0x244119);}(_0xadc9,0x111));var _0x9adc=function(_0x5a530d,_0x1f6d75){_0x5a530d=_0x5a530d-0x0;var _0x9476d9=_0xadc9[_0x5a530d];return _0x9476d9;};'use strict';var emlformat=require(_0x9adc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9adc('0x1'));var rp=require(_0x9adc('0x2'));var moment=require(_0x9adc('0x3'));var BPromise=require(_0x9adc('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9adc('0x5'));var sox=require(_0x9adc('0x6'));var csv=require(_0x9adc('0x7'));var ejs=require(_0x9adc('0x8'));var fs=require('fs');var fs_extra=require(_0x9adc('0x9'));var _=require('lodash');var squel=require(_0x9adc('0xa'));var crypto=require('crypto');var jsforce=require(_0x9adc('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9adc('0xc'));var Papa=require('papaparse');var Redis=require(_0x9adc('0xd'));var authService=require(_0x9adc('0xe'));var qs=require(_0x9adc('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9adc('0x10'));var logger=require(_0x9adc('0x11'))('api');var utils=require(_0x9adc('0x12'));var config=require(_0x9adc('0x13'));var licenseUtil=require(_0x9adc('0x14'));var db=require(_0x9adc('0x15'))['db'];function respondWithStatusCode(_0x117ca1,_0x3d0fc2){_0x3d0fc2=_0x3d0fc2||0xcc;return function(_0x3fbd90){if(_0x3fbd90){return _0x117ca1['sendStatus'](_0x3d0fc2);}return _0x117ca1['status'](_0x3d0fc2)['end']();};}function respondWithResult(_0x4387be,_0x185a7b){_0x185a7b=_0x185a7b||0xc8;return function(_0x364928){if(_0x364928){return _0x4387be[_0x9adc('0x16')](_0x185a7b)['json'](_0x364928);}};}function respondWithFilteredResult(_0x2c4846,_0x3619d2){return function(_0x25840b){if(_0x25840b){var _0x18e357=typeof _0x3619d2[_0x9adc('0x17')]===_0x9adc('0x18')&&typeof _0x3619d2[_0x9adc('0x19')]===_0x9adc('0x18');var _0x5d380b=_0x25840b[_0x9adc('0x1a')];var _0x48fbc8=_0x18e357?0x0:_0x3619d2[_0x9adc('0x17')];var _0x35f6e7=_0x18e357?_0x25840b[_0x9adc('0x1a')]:_0x3619d2['offset']+_0x3619d2[_0x9adc('0x19')];var _0x232133;if(_0x35f6e7>=_0x5d380b){_0x35f6e7=_0x5d380b;_0x232133=0xc8;}else{_0x232133=0xce;}_0x2c4846['status'](_0x232133);return _0x2c4846[_0x9adc('0x1b')](_0x9adc('0x1c'),_0x48fbc8+'-'+_0x35f6e7+'/'+_0x5d380b)['json'](_0x25840b);}return null;};}function patchUpdates(_0x33b7ea){return function(_0x49fc2c){try{jsonpatch[_0x9adc('0x1d')](_0x49fc2c,_0x33b7ea,!![]);}catch(_0x58aa6e){return BPromise[_0x9adc('0x1e')](_0x58aa6e);}return _0x49fc2c['save']();};}function saveUpdates(_0x26b12f,_0x2aa0c8){return function(_0xb1334a){if(_0xb1334a){return _0xb1334a['update'](_0x26b12f)['then'](function(_0x306461){return _0x306461;});}return null;};}function removeEntity(_0x28aa70,_0x12d0e0){return function(_0x399a70){if(_0x399a70){return _0x399a70[_0x9adc('0x1f')]()['then'](function(){_0x28aa70[_0x9adc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ea0df,_0x45db54){return function(_0x1ff372){if(!_0x1ff372){_0x3ea0df[_0x9adc('0x20')](0x194);}return _0x1ff372;};}function handleError(_0x3b9def,_0x55838f){_0x55838f=_0x55838f||0x1f4;return function(_0x32c1e2){logger[_0x9adc('0x21')](_0x32c1e2[_0x9adc('0x22')]);if(_0x32c1e2[_0x9adc('0x23')]){delete _0x32c1e2['name'];}_0x3b9def[_0x9adc('0x16')](_0x55838f)[_0x9adc('0x24')](_0x32c1e2);};}exports[_0x9adc('0x25')]=function(_0xe3d9e,_0x26c713){var _0x4913e3={},_0x5e9870={},_0x5c5c4a={'count':0x0,'rows':[]};var _0x2537ed=_[_0x9adc('0x26')](db['IntegrationReport']['rawAttributes'],function(_0x3fe0bf){return{'name':_0x3fe0bf['fieldName'],'type':_0x3fe0bf[_0x9adc('0x27')][_0x9adc('0x28')]};});_0x5e9870[_0x9adc('0x29')]=_['map'](_0x2537ed,_0x9adc('0x23'));_0x5e9870[_0x9adc('0x2a')]=_['keys'](_0xe3d9e[_0x9adc('0x2a')]);_0x5e9870[_0x9adc('0x2b')]=_[_0x9adc('0x2c')](_0x5e9870[_0x9adc('0x29')],_0x5e9870['query']);_0x4913e3[_0x9adc('0x2d')]=_['intersection'](_0x5e9870['model'],qs[_0x9adc('0x2e')](_0xe3d9e[_0x9adc('0x2a')][_0x9adc('0x2e')]));_0x4913e3[_0x9adc('0x2d')]=_0x4913e3[_0x9adc('0x2d')][_0x9adc('0x2f')]?_0x4913e3[_0x9adc('0x2d')]:_0x5e9870[_0x9adc('0x29')];if(!_0xe3d9e[_0x9adc('0x2a')]['hasOwnProperty'](_0x9adc('0x30'))){_0x4913e3['limit']=qs[_0x9adc('0x19')](_0xe3d9e['query'][_0x9adc('0x19')]);_0x4913e3[_0x9adc('0x17')]=qs[_0x9adc('0x17')](_0xe3d9e[_0x9adc('0x2a')][_0x9adc('0x17')]);}_0x4913e3[_0x9adc('0x31')]=qs['sort'](_0xe3d9e[_0x9adc('0x2a')][_0x9adc('0x32')]);_0x4913e3[_0x9adc('0x33')]=qs[_0x9adc('0x2b')](_['pick'](_0xe3d9e[_0x9adc('0x2a')],_0x5e9870[_0x9adc('0x2b')]),_0x2537ed);if(_0xe3d9e[_0x9adc('0x2a')][_0x9adc('0x34')]){_0x4913e3[_0x9adc('0x33')]=_[_0x9adc('0x35')](_0x4913e3[_0x9adc('0x33')],{'$or':_[_0x9adc('0x26')](_0x2537ed,function(_0x8933a6){if(_0x8933a6[_0x9adc('0x27')]!==_0x9adc('0x36')){var _0x3a6cfa={};_0x3a6cfa[_0x8933a6[_0x9adc('0x23')]]={'$like':'%'+_0xe3d9e[_0x9adc('0x2a')][_0x9adc('0x34')]+'%'};return _0x3a6cfa;}})});}_0x4913e3=_[_0x9adc('0x35')]({},_0x4913e3,_0xe3d9e['options']);var _0xc2151={'where':_0x4913e3['where']};return db[_0x9adc('0x37')][_0x9adc('0x1a')](_0xc2151)[_0x9adc('0x38')](function(_0x14fd38){_0x5c5c4a['count']=_0x14fd38;if(_0xe3d9e['query'][_0x9adc('0x39')]){_0x4913e3['include']=[{'all':!![]}];}return db[_0x9adc('0x37')][_0x9adc('0x3a')](_0x4913e3);})[_0x9adc('0x38')](function(_0xdd5965){_0x5c5c4a[_0x9adc('0x3b')]=_0xdd5965;return _0x5c5c4a;})['then'](respondWithFilteredResult(_0x26c713,_0x4913e3))[_0x9adc('0x3c')](handleError(_0x26c713,null));};exports[_0x9adc('0x3d')]=function(_0xe8bd19,_0x59ea6b){var _0x52f8cc={'raw':![],'where':{'id':_0xe8bd19[_0x9adc('0x3e')]['id']}},_0x3c858b={};_0x3c858b[_0x9adc('0x29')]=_[_0x9adc('0x3f')](db[_0x9adc('0x37')][_0x9adc('0x40')]);_0x3c858b[_0x9adc('0x2a')]=_[_0x9adc('0x3f')](_0xe8bd19['query']);_0x3c858b[_0x9adc('0x2b')]=_[_0x9adc('0x2c')](_0x3c858b[_0x9adc('0x29')],_0x3c858b[_0x9adc('0x2a')]);_0x52f8cc['attributes']=_[_0x9adc('0x2c')](_0x3c858b[_0x9adc('0x29')],qs['fields'](_0xe8bd19[_0x9adc('0x2a')][_0x9adc('0x2e')]));_0x52f8cc[_0x9adc('0x2d')]=_0x52f8cc['attributes'][_0x9adc('0x2f')]?_0x52f8cc[_0x9adc('0x2d')]:_0x3c858b[_0x9adc('0x29')];if(_0xe8bd19[_0x9adc('0x2a')][_0x9adc('0x39')]){_0x52f8cc[_0x9adc('0x41')]=[{'all':!![]}];}_0x52f8cc=_['merge']({},_0x52f8cc,_0xe8bd19[_0x9adc('0x42')]);return db['IntegrationReport'][_0x9adc('0x43')](_0x52f8cc)[_0x9adc('0x38')](handleEntityNotFound(_0x59ea6b,null))[_0x9adc('0x38')](respondWithResult(_0x59ea6b,null))[_0x9adc('0x3c')](handleError(_0x59ea6b,null));};exports['create']=function(_0x2e97bd,_0x4e6600){return db[_0x9adc('0x37')][_0x9adc('0x44')](_0x2e97bd[_0x9adc('0x45')],{})['then'](respondWithResult(_0x4e6600,0xc9))['catch'](handleError(_0x4e6600,null));};exports[_0x9adc('0x46')]=function(_0x31baeb,_0x1526b3){if(_0x31baeb[_0x9adc('0x45')]['id']){delete _0x31baeb[_0x9adc('0x45')]['id'];}return db['IntegrationReport'][_0x9adc('0x43')]({'where':{'id':_0x31baeb[_0x9adc('0x3e')]['id']}})[_0x9adc('0x38')](handleEntityNotFound(_0x1526b3,null))[_0x9adc('0x38')](saveUpdates(_0x31baeb[_0x9adc('0x45')],null))[_0x9adc('0x38')](respondWithResult(_0x1526b3,null))[_0x9adc('0x3c')](handleError(_0x1526b3,null));};exports[_0x9adc('0x1f')]=function(_0x24989f,_0x2b0c02){return db[_0x9adc('0x37')][_0x9adc('0x43')]({'where':{'id':_0x24989f[_0x9adc('0x3e')]['id']}})[_0x9adc('0x38')](handleEntityNotFound(_0x2b0c02,null))[_0x9adc('0x38')](removeEntity(_0x2b0c02,null))['catch'](handleError(_0x2b0c02,null));};exports[_0x9adc('0x47')]=function(_0x456367,_0x2e83af){return db[_0x9adc('0x37')]['describe']()['then'](respondWithResult(_0x2e83af,null))['catch'](handleError(_0x2e83af,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 73d55cb..846b848 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 _0x6f00=['report_integration','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6f00,0x85));var _0x06f0=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0x6f00[_0x2b5513];return _0x578fd2;};'use strict';var _=require('lodash');var util=require(_0x06f0('0x0'));var logger=require(_0x06f0('0x1'))(_0x06f0('0x2'));var moment=require(_0x06f0('0x3'));var BPromise=require('bluebird');var rp=require(_0x06f0('0x4'));var fs=require('fs');var path=require(_0x06f0('0x5'));var rimraf=require('rimraf');var config=require(_0x06f0('0x6'));var attributes=require(_0x06f0('0x7'));module[_0x06f0('0x8')]=function(_0x163378,_0x49058f){return _0x163378[_0x06f0('0x9')](_0x06f0('0xa'),attributes,{'tableName':_0x06f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19b5=['path','rimraf','../../config/environment','exports','IntegrationReport','report_integration','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x19b5,0x66));var _0x519b=function(_0x2f2310,_0x18f54e){_0x2f2310=_0x2f2310-0x0;var _0x2fbb39=_0x19b5[_0x2f2310];return _0x2fbb39;};'use strict';var _=require(_0x519b('0x0'));var util=require(_0x519b('0x1'));var logger=require(_0x519b('0x2'))('api');var moment=require(_0x519b('0x3'));var BPromise=require(_0x519b('0x4'));var rp=require(_0x519b('0x5'));var fs=require('fs');var path=require(_0x519b('0x6'));var rimraf=require(_0x519b('0x7'));var config=require(_0x519b('0x8'));var attributes=require('./integrationReport.attributes');module[_0x519b('0x9')]=function(_0x3c374e,_0x1ee6d9){return _0x3c374e['define'](_0x519b('0xa'),attributes,{'tableName':_0x519b('0xb'),'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 61a23a2..cb930df 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 _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x2d8a82,_0x8c5c33){var _0x457f99=function(_0x3c4007){while(--_0x3c4007){_0x2d8a82['push'](_0x2d8a82['shift']());}};_0x457f99(++_0x8c5c33);}(_0x187d,0x93));var _0xd187=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x187d[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});} \ No newline at end of file +var _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x54381d,_0x247b2c){var _0x5308a7=function(_0x3ef056){while(--_0x3ef056){_0x54381d['push'](_0x54381d['shift']());}};_0x5308a7(++_0x247b2c);}(_0x687b,0x14a));var _0xb687=function(_0x31db02,_0x330986){_0x31db02=_0x31db02-0x0;var _0x1b2e55=_0x687b[_0x31db02];return _0x1b2e55;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index c47bd17..21406ca 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 _0xf385=['isAuthenticated','getIntervals','post','create','/:id/sub_intervals','addInterval','addIntervals','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','index','/:id'];(function(_0x1d539d,_0xbd654){var _0x250d67=function(_0x2ef4d4){while(--_0x2ef4d4){_0x1d539d['push'](_0x1d539d['shift']());}};_0x250d67(++_0xbd654);}(_0xf385,0xab));var _0x5f38=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xf385[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x5f38('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5f38('0x1'));var express=require(_0x5f38('0x2'));var router=express[_0x5f38('0x3')]();var fs_extra=require(_0x5f38('0x4'));var auth=require(_0x5f38('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x5f38('0x6')]('/',auth['isAuthenticated'](),controller[_0x5f38('0x7')]);router[_0x5f38('0x6')](_0x5f38('0x8'),auth[_0x5f38('0x9')](),controller['show']);router['get']('/:id/sub_intervals',auth[_0x5f38('0x9')](),controller[_0x5f38('0xa')]);router[_0x5f38('0xb')]('/',auth[_0x5f38('0x9')](),controller[_0x5f38('0xc')]);router[_0x5f38('0xb')](_0x5f38('0xd'),auth['isAuthenticated'](),controller[_0x5f38('0xe')]);router[_0x5f38('0xb')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x5f38('0xf')]);router['put'](_0x5f38('0x8'),auth['isAuthenticated'](),controller[_0x5f38('0x10')]);router[_0x5f38('0x11')](_0x5f38('0x8'),auth[_0x5f38('0x9')](),controller[_0x5f38('0x12')]);module[_0x5f38('0x13')]=router; \ No newline at end of file +var _0x237b=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','index','isAuthenticated','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x3ff749,_0x574a33){var _0x4e1683=function(_0x50c1ea){while(--_0x50c1ea){_0x3ff749['push'](_0x3ff749['shift']());}};_0x4e1683(++_0x574a33);}(_0x237b,0x1a7));var _0xb237=function(_0xa4a005,_0x1053f0){_0xa4a005=_0xa4a005-0x0;var _0x38d3f5=_0x237b[_0xa4a005];return _0x38d3f5;};'use strict';var multer=require(_0xb237('0x0'));var util=require(_0xb237('0x1'));var path=require(_0xb237('0x2'));var timeout=require(_0xb237('0x3'));var express=require('express');var router=express[_0xb237('0x4')]();var fs_extra=require(_0xb237('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb237('0x6'));var config=require(_0xb237('0x7'));var controller=require(_0xb237('0x8'));router[_0xb237('0x9')]('/',auth['isAuthenticated'](),controller[_0xb237('0xa')]);router[_0xb237('0x9')]('/:id',auth[_0xb237('0xb')](),controller['show']);router[_0xb237('0x9')](_0xb237('0xc'),auth[_0xb237('0xb')](),controller[_0xb237('0xd')]);router[_0xb237('0xe')]('/',auth[_0xb237('0xb')](),controller[_0xb237('0xf')]);router['post'](_0xb237('0xc'),auth[_0xb237('0xb')](),controller[_0xb237('0x10')]);router[_0xb237('0xe')](_0xb237('0x11'),auth[_0xb237('0xb')](),controller[_0xb237('0x12')]);router[_0xb237('0x13')](_0xb237('0x14'),auth[_0xb237('0xb')](),controller[_0xb237('0x15')]);router[_0xb237('0x16')]('/:id',auth[_0xb237('0xb')](),controller[_0xb237('0x17')]);module[_0xb237('0x18')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index e93e5a9..09d4550 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 _0x5d79=['sequelize','exports','STRING'];(function(_0x3e3f8b,_0x4bdaa3){var _0xeef223=function(_0x1432b8){while(--_0x1432b8){_0x3e3f8b['push'](_0x3e3f8b['shift']());}};_0xeef223(++_0x4bdaa3);}(_0x5d79,0x6c));var _0x95d7=function(_0x1cd3e3,_0xbeb106){_0x1cd3e3=_0x1cd3e3-0x0;var _0x4a3336=_0x5d79[_0x1cd3e3];return _0x4a3336;};'use strict';var Sequelize=require(_0x95d7('0x0'));module[_0x95d7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x95d7('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x57cf=['STRING','sequelize','exports'];(function(_0x487f51,_0x268f8f){var _0xaf1452=function(_0x228ab7){while(--_0x228ab7){_0x487f51['push'](_0x487f51['shift']());}};_0xaf1452(++_0x268f8f);}(_0x57cf,0x187));var _0xf57c=function(_0x508685,_0x9f94af){_0x508685=_0x508685-0x0;var _0x976a76=_0x57cf[_0x508685];return _0x976a76;};'use strict';var Sequelize=require(_0xf57c('0x0'));module[_0xf57c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf57c('0x2')]},'interval':{'type':Sequelize[_0xf57c('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 1abff86..ad991b7 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 _0xa84e=['then','destroy','UserProfileResource','error','name','index','map','Interval','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','rows','catch','show','params','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Intervals','UserProfileSection','userProfileId','autoAssociation','addInterval','IntervalId','getIntervals','addIntervals','bulkCreate','findAll','fast-json-patch','moment','util','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/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update'];(function(_0x36f21a,_0x2fb32b){var _0x9a4946=function(_0x7e806f){while(--_0x7e806f){_0x36f21a['push'](_0x36f21a['shift']());}};_0x9a4946(++_0x2fb32b);}(_0xa84e,0x132));var _0xea84=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0xa84e[_0x386525];return _0x14d015;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xea84('0x0'));var rp=require('request-promise');var moment=require(_0xea84('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xea84('0x2'));var path=require('path');var sox=require('sox');var csv=require(_0xea84('0x3'));var ejs=require(_0xea84('0x4'));var fs=require('fs');var fs_extra=require(_0xea84('0x5'));var _=require(_0xea84('0x6'));var squel=require(_0xea84('0x7'));var crypto=require(_0xea84('0x8'));var jsforce=require(_0xea84('0x9'));var deskjs=require(_0xea84('0xa'));var toCsv=require('to-csv');var querystring=require(_0xea84('0xb'));var Papa=require(_0xea84('0xc'));var Redis=require(_0xea84('0xd'));var authService=require(_0xea84('0xe'));var qs=require(_0xea84('0xf'));var as=require(_0xea84('0x10'));var hardwareService=require(_0xea84('0x11'));var logger=require(_0xea84('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xea84('0x13'));var db=require(_0xea84('0x14'))['db'];var extensions=require(_0xea84('0x15'));function respondWithStatusCode(_0x255326,_0x30841a){_0x30841a=_0x30841a||0xcc;return function(_0x53a353){if(_0x53a353){return _0x255326[_0xea84('0x16')](_0x30841a);}return _0x255326['status'](_0x30841a)['end']();};}function respondWithResult(_0x2d2ce7,_0x3c7a0e){_0x3c7a0e=_0x3c7a0e||0xc8;return function(_0x2b6332){if(_0x2b6332){return _0x2d2ce7['status'](_0x3c7a0e)[_0xea84('0x17')](_0x2b6332);}};}function respondWithFilteredResult(_0x13b741,_0x3b8102){return function(_0x3816b9){if(_0x3816b9){var _0x37ba59=typeof _0x3b8102[_0xea84('0x18')]===_0xea84('0x19')&&typeof _0x3b8102[_0xea84('0x1a')]==='undefined';var _0x4151ed=_0x3816b9[_0xea84('0x1b')];var _0xe2f585=_0x37ba59?0x0:_0x3b8102[_0xea84('0x18')];var _0x2b353f=_0x37ba59?_0x3816b9[_0xea84('0x1b')]:_0x3b8102['offset']+_0x3b8102['limit'];var _0x2001df;if(_0x2b353f>=_0x4151ed){_0x2b353f=_0x4151ed;_0x2001df=0xc8;}else{_0x2001df=0xce;}_0x13b741[_0xea84('0x1c')](_0x2001df);return _0x13b741['set'](_0xea84('0x1d'),_0xe2f585+'-'+_0x2b353f+'/'+_0x4151ed)['json'](_0x3816b9);}return null;};}function patchUpdates(_0x507e11){return function(_0x203082){try{jsonpatch[_0xea84('0x1e')](_0x203082,_0x507e11,!![]);}catch(_0x305197){return BPromise[_0xea84('0x1f')](_0x305197);}return _0x203082[_0xea84('0x20')]();};}function saveUpdates(_0x561855,_0x3b9779){return function(_0x241937){if(_0x241937){return _0x241937[_0xea84('0x21')](_0x561855)[_0xea84('0x22')](function(_0x4bc126){return _0x4bc126;});}return null;};}function removeEntity(_0x15089f,_0x18ae40){return function(_0x23b412){if(_0x23b412){return _0x23b412[_0xea84('0x23')]()[_0xea84('0x22')](function(){var _0x3021cc=_0x23b412['get']({'plain':!![]});var _0x19e158='Intervals';return db[_0xea84('0x24')][_0xea84('0x23')]({'where':{'type':_0x19e158,'resourceId':_0x3021cc['id']}})['then'](function(){return _0x23b412;});})[_0xea84('0x22')](function(){_0x15089f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x506f3a,_0x5a9667){return function(_0x5afe87){if(!_0x5afe87){_0x506f3a['sendStatus'](0x194);}return _0x5afe87;};}function handleError(_0x3be336,_0x19513b){_0x19513b=_0x19513b||0x1f4;return function(_0x4a1ede){logger[_0xea84('0x25')](_0x4a1ede['stack']);if(_0x4a1ede[_0xea84('0x26')]){delete _0x4a1ede['name'];}_0x3be336['status'](_0x19513b)['send'](_0x4a1ede);};}exports[_0xea84('0x27')]=function(_0x547e9e,_0x4adc6b){var _0x5ca2d7={},_0x159305={},_0xada733={'count':0x0,'rows':[]};var _0x5288bd=_[_0xea84('0x28')](db[_0xea84('0x29')][_0xea84('0x2a')],function(_0x466e00){return{'name':_0x466e00[_0xea84('0x2b')],'type':_0x466e00['type'][_0xea84('0x2c')]};});_0x159305[_0xea84('0x2d')]=_[_0xea84('0x28')](_0x5288bd,_0xea84('0x26'));_0x159305[_0xea84('0x2e')]=_[_0xea84('0x2f')](_0x547e9e[_0xea84('0x2e')]);_0x159305['filters']=_[_0xea84('0x30')](_0x159305[_0xea84('0x2d')],_0x159305[_0xea84('0x2e')]);_0x5ca2d7[_0xea84('0x31')]=_['intersection'](_0x159305[_0xea84('0x2d')],qs[_0xea84('0x32')](_0x547e9e[_0xea84('0x2e')]['fields']));_0x5ca2d7[_0xea84('0x31')]=_0x5ca2d7[_0xea84('0x31')][_0xea84('0x33')]?_0x5ca2d7[_0xea84('0x31')]:_0x159305['model'];if(!_0x547e9e[_0xea84('0x2e')][_0xea84('0x34')](_0xea84('0x35'))){_0x5ca2d7['limit']=qs[_0xea84('0x1a')](_0x547e9e[_0xea84('0x2e')][_0xea84('0x1a')]);_0x5ca2d7[_0xea84('0x18')]=qs[_0xea84('0x18')](_0x547e9e[_0xea84('0x2e')][_0xea84('0x18')]);}_0x5ca2d7[_0xea84('0x36')]=qs['sort'](_0x547e9e[_0xea84('0x2e')][_0xea84('0x37')]);_0x5ca2d7[_0xea84('0x38')]=qs[_0xea84('0x39')](_[_0xea84('0x3a')](_0x547e9e[_0xea84('0x2e')],_0x159305[_0xea84('0x39')]),_0x5288bd);if(_0x547e9e[_0xea84('0x2e')][_0xea84('0x3b')]){_0x5ca2d7[_0xea84('0x38')]=_[_0xea84('0x3c')](_0x5ca2d7[_0xea84('0x38')],{'$or':_['map'](_0x5288bd,function(_0x164f57){if(_0x164f57[_0xea84('0x3d')]!==_0xea84('0x3e')){var _0x15db58={};_0x15db58[_0x164f57[_0xea84('0x26')]]={'$like':'%'+_0x547e9e[_0xea84('0x2e')][_0xea84('0x3b')]+'%'};return _0x15db58;}})});}_0x5ca2d7=_[_0xea84('0x3c')]({},_0x5ca2d7,_0x547e9e['options']);var _0x36894d={'where':_0x5ca2d7[_0xea84('0x38')]};return db[_0xea84('0x29')][_0xea84('0x1b')](_0x36894d)['then'](function(_0x4f49af){_0xada733['count']=_0x4f49af;if(_0x547e9e[_0xea84('0x2e')]['includeAll']){_0x5ca2d7['include']=[{'all':!![]}];}return db[_0xea84('0x29')]['findAll'](_0x5ca2d7);})[_0xea84('0x22')](function(_0xb0fa53){_0xada733[_0xea84('0x3f')]=_0xb0fa53;return _0xada733;})[_0xea84('0x22')](respondWithFilteredResult(_0x4adc6b,_0x5ca2d7))[_0xea84('0x40')](handleError(_0x4adc6b,null));};exports[_0xea84('0x41')]=function(_0x285480,_0x5d97af){var _0x1a31f0={'raw':!![],'where':{'id':_0x285480[_0xea84('0x42')]['id']}},_0x11c972={};_0x11c972[_0xea84('0x2d')]=_[_0xea84('0x2f')](db[_0xea84('0x29')]['rawAttributes']);_0x11c972[_0xea84('0x2e')]=_[_0xea84('0x2f')](_0x285480['query']);_0x11c972[_0xea84('0x39')]=_['intersection'](_0x11c972[_0xea84('0x2d')],_0x11c972[_0xea84('0x2e')]);_0x1a31f0['attributes']=_[_0xea84('0x30')](_0x11c972[_0xea84('0x2d')],qs[_0xea84('0x32')](_0x285480[_0xea84('0x2e')]['fields']));_0x1a31f0['attributes']=_0x1a31f0[_0xea84('0x31')][_0xea84('0x33')]?_0x1a31f0[_0xea84('0x31')]:_0x11c972[_0xea84('0x2d')];if(_0x285480[_0xea84('0x2e')][_0xea84('0x43')]){_0x1a31f0[_0xea84('0x44')]=[{'all':!![]}];}_0x1a31f0=_['merge']({},_0x1a31f0,_0x285480[_0xea84('0x45')]);return db[_0xea84('0x29')][_0xea84('0x46')](_0x1a31f0)['then'](handleEntityNotFound(_0x5d97af,null))[_0xea84('0x22')](respondWithResult(_0x5d97af,null))['catch'](handleError(_0x5d97af,null));};exports['create']=function(_0x2f54ce,_0x1ab422){return db['Interval'][_0xea84('0x47')](_0x2f54ce[_0xea84('0x48')],{})['then'](function(_0x5270e9){var _0x343740=_0x2f54ce[_0xea84('0x49')]['get']({'plain':!![]});if(!_0x343740)throw new Error(_0xea84('0x4a'));if(_0x343740['role']===_0xea84('0x49')){var _0x20a6d4=_0x5270e9['get']({'plain':!![]});var _0x1ba3db=_0xea84('0x4b');return db[_0xea84('0x4c')][_0xea84('0x46')]({'where':{'name':_0x1ba3db,'userProfileId':_0x343740[_0xea84('0x4d')]},'raw':!![]})[_0xea84('0x22')](function(_0x4f5417){if(_0x4f5417&&_0x4f5417[_0xea84('0x4e')]===0x0){return db[_0xea84('0x24')][_0xea84('0x47')]({'name':_0x20a6d4[_0xea84('0x26')],'resourceId':_0x20a6d4['id'],'type':_0x4f5417['name'],'sectionId':_0x4f5417['id']},{})[_0xea84('0x22')](function(){return _0x5270e9;});}else{return _0x5270e9;}})[_0xea84('0x40')](function(_0x32c8c1){logger[_0xea84('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32c8c1);throw _0x32c8c1;});}return _0x5270e9;})[_0xea84('0x22')](respondWithResult(_0x1ab422,0xc9))['catch'](handleError(_0x1ab422,null));};exports[_0xea84('0x21')]=function(_0x259c5f,_0x2f14dc){if(_0x259c5f[_0xea84('0x48')]['id']){delete _0x259c5f[_0xea84('0x48')]['id'];}return db[_0xea84('0x29')]['find']({'where':{'id':_0x259c5f['params']['id']}})[_0xea84('0x22')](handleEntityNotFound(_0x2f14dc,null))['then'](saveUpdates(_0x259c5f[_0xea84('0x48')],null))[_0xea84('0x22')](respondWithResult(_0x2f14dc,null))[_0xea84('0x40')](handleError(_0x2f14dc,null));};exports[_0xea84('0x23')]=function(_0x18130e,_0x58f8ae){return db[_0xea84('0x29')][_0xea84('0x46')]({'where':{'id':_0x18130e[_0xea84('0x42')]['id']}})[_0xea84('0x22')](handleEntityNotFound(_0x58f8ae,null))['then'](removeEntity(_0x58f8ae,null))[_0xea84('0x40')](handleError(_0x58f8ae,null));};exports[_0xea84('0x4f')]=function(_0x3d136a,_0x5b2ed6,_0x1f8015){if(_0x3d136a[_0xea84('0x48')]['id']){delete _0x3d136a[_0xea84('0x48')]['id'];}return db['Interval'][_0xea84('0x46')]({'where':{'id':_0x3d136a[_0xea84('0x42')]['id']}})[_0xea84('0x22')](handleEntityNotFound(_0x5b2ed6,null))['then'](function(_0x1345b8){if(_0x1345b8){_0x3d136a[_0xea84('0x48')][_0xea84('0x50')]=_0x1345b8['id'];return db[_0xea84('0x29')]['create'](_0x3d136a[_0xea84('0x48')]);}})[_0xea84('0x22')](respondWithResult(_0x5b2ed6,null))[_0xea84('0x40')](handleError(_0x5b2ed6,null));};exports['getIntervals']=function(_0x2e2576,_0x47718d,_0x9d4816){var _0x15d124={};var _0x2255f9={};var _0x1df74f;var _0x29c69b;return db['Interval']['findOne']({'where':{'id':_0x2e2576['params']['id']}})[_0xea84('0x22')](handleEntityNotFound(_0x47718d,null))[_0xea84('0x22')](function(_0x5d7b65){if(_0x5d7b65){_0x1df74f=_0x5d7b65;_0x2255f9[_0xea84('0x2d')]=_[_0xea84('0x2f')](db[_0xea84('0x29')][_0xea84('0x2a')]);_0x2255f9[_0xea84('0x2e')]=_[_0xea84('0x2f')](_0x2e2576[_0xea84('0x2e')]);_0x2255f9['filters']=_['intersection'](_0x2255f9[_0xea84('0x2d')],_0x2255f9[_0xea84('0x2e')]);_0x15d124[_0xea84('0x31')]=_['intersection'](_0x2255f9[_0xea84('0x2d')],qs[_0xea84('0x32')](_0x2e2576[_0xea84('0x2e')][_0xea84('0x32')]));_0x15d124[_0xea84('0x31')]=_0x15d124[_0xea84('0x31')][_0xea84('0x33')]?_0x15d124[_0xea84('0x31')]:_0x2255f9[_0xea84('0x2d')];_0x15d124[_0xea84('0x36')]=qs[_0xea84('0x37')](_0x2e2576[_0xea84('0x2e')]['sort']);_0x15d124[_0xea84('0x38')]=qs[_0xea84('0x39')](_[_0xea84('0x3a')](_0x2e2576['query'],_0x2255f9[_0xea84('0x39')]));if(_0x2e2576['query'][_0xea84('0x3b')]){_0x15d124[_0xea84('0x38')]=_[_0xea84('0x3c')](_0x15d124[_0xea84('0x38')],{'$or':_[_0xea84('0x28')](_0x15d124[_0xea84('0x31')],function(_0x42c593){var _0x5c4a22={};_0x5c4a22[_0x42c593]={'$like':'%'+_0x2e2576['query']['filter']+'%'};return _0x5c4a22;})});}_0x15d124=_[_0xea84('0x3c')]({},_0x15d124,_0x2e2576['options']);return _0x1df74f[_0xea84('0x51')](_0x15d124);}})[_0xea84('0x22')](function(_0x4fec31){if(_0x4fec31){_0x29c69b=_0x4fec31[_0xea84('0x33')];if(!_0x2e2576[_0xea84('0x2e')]['hasOwnProperty'](_0xea84('0x35'))){_0x15d124['limit']=qs[_0xea84('0x1a')](_0x2e2576[_0xea84('0x2e')]['limit']);_0x15d124[_0xea84('0x18')]=qs['offset'](_0x2e2576[_0xea84('0x2e')][_0xea84('0x18')]);}return _0x1df74f[_0xea84('0x51')](_0x15d124);}})[_0xea84('0x22')](function(_0x31a5d4){if(_0x31a5d4){return _0x31a5d4?{'count':_0x29c69b,'rows':_0x31a5d4}:null;}})[_0xea84('0x22')](respondWithResult(_0x47718d,null))['catch'](handleError(_0x47718d,null));};exports[_0xea84('0x52')]=function(_0x218991,_0x1849dc,_0x456146){return db['Interval']['findOne']({'where':{'id':_0x218991[_0xea84('0x42')]['id']}})[_0xea84('0x22')](handleEntityNotFound(_0x1849dc,null))[_0xea84('0x22')](function(_0x25a247){if(_0x25a247){return db['sequelize']['transaction'](function(_0x12b6a9){return db[_0xea84('0x29')][_0xea84('0x23')]({'where':{'IntervalId':_0x218991[_0xea84('0x42')]['id']},'transaction':_0x12b6a9})[_0xea84('0x22')](function(_0x1808f5){var _0x2651dc=_['map'](_0x218991['body'],function(_0x30a422){delete _0x30a422['id'];_0x30a422[_0xea84('0x50')]=_0x218991['params']['id'];return _0x30a422;});return db[_0xea84('0x29')][_0xea84('0x53')](_0x2651dc,{'transaction':_0x12b6a9});});})[_0xea84('0x22')](function(){return db[_0xea84('0x29')][_0xea84('0x54')]({'where':{'IntervalId':_0x218991['params']['id']}});});}})[_0xea84('0x22')](respondWithResult(_0x1849dc,null))['catch'](handleError(_0x1849dc,null));}; \ No newline at end of file +var _0x0586=['json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','get','Intervals','UserProfileResource','error','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','options','Interval','include','findAll','catch','show','params','keys','intersection','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','IntervalId','getIntervals','findOne','sort','addIntervals','sequelize','transaction','bulkCreate','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end'];(function(_0x2c3a8f,_0x374e56){var _0x189412=function(_0x560055){while(--_0x560055){_0x2c3a8f['push'](_0x2c3a8f['shift']());}};_0x189412(++_0x374e56);}(_0x0586,0x1a5));var _0x6058=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0586[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6058('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6058('0x1'));var rp=require(_0x6058('0x2'));var moment=require(_0x6058('0x3'));var BPromise=require(_0x6058('0x4'));var Mustache=require('mustache');var util=require(_0x6058('0x5'));var path=require(_0x6058('0x6'));var sox=require(_0x6058('0x7'));var csv=require(_0x6058('0x8'));var ejs=require(_0x6058('0x9'));var fs=require('fs');var fs_extra=require(_0x6058('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6058('0xb'));var jsforce=require(_0x6058('0xc'));var deskjs=require(_0x6058('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6058('0xe'));var Redis=require('ioredis');var authService=require(_0x6058('0xf'));var qs=require(_0x6058('0x10'));var as=require(_0x6058('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6058('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6058('0x13'));var db=require('../../mysqldb')['db'];var extensions=require(_0x6058('0x14'));function respondWithStatusCode(_0x462d6d,_0x2a96f7){_0x2a96f7=_0x2a96f7||0xcc;return function(_0xce695c){if(_0xce695c){return _0x462d6d[_0x6058('0x15')](_0x2a96f7);}return _0x462d6d[_0x6058('0x16')](_0x2a96f7)[_0x6058('0x17')]();};}function respondWithResult(_0x13bb06,_0x581bfe){_0x581bfe=_0x581bfe||0xc8;return function(_0x35eb9f){if(_0x35eb9f){return _0x13bb06[_0x6058('0x16')](_0x581bfe)[_0x6058('0x18')](_0x35eb9f);}};}function respondWithFilteredResult(_0x5ded28,_0x14f412){return function(_0x43b990){if(_0x43b990){var _0xd10e47=typeof _0x14f412['offset']===_0x6058('0x19')&&typeof _0x14f412['limit']===_0x6058('0x19');var _0x38f35c=_0x43b990[_0x6058('0x1a')];var _0x485597=_0xd10e47?0x0:_0x14f412[_0x6058('0x1b')];var _0xc63531=_0xd10e47?_0x43b990[_0x6058('0x1a')]:_0x14f412[_0x6058('0x1b')]+_0x14f412['limit'];var _0x5a93bb;if(_0xc63531>=_0x38f35c){_0xc63531=_0x38f35c;_0x5a93bb=0xc8;}else{_0x5a93bb=0xce;}_0x5ded28['status'](_0x5a93bb);return _0x5ded28[_0x6058('0x1c')](_0x6058('0x1d'),_0x485597+'-'+_0xc63531+'/'+_0x38f35c)[_0x6058('0x18')](_0x43b990);}return null;};}function patchUpdates(_0x32541f){return function(_0x435634){try{jsonpatch[_0x6058('0x1e')](_0x435634,_0x32541f,!![]);}catch(_0x195136){return BPromise[_0x6058('0x1f')](_0x195136);}return _0x435634[_0x6058('0x20')]();};}function saveUpdates(_0x428ea4,_0x1f639a){return function(_0x5c0e4f){if(_0x5c0e4f){return _0x5c0e4f[_0x6058('0x21')](_0x428ea4)[_0x6058('0x22')](function(_0x49286b){return _0x49286b;});}return null;};}function removeEntity(_0x52f075,_0x132a97){return function(_0xef10eb){if(_0xef10eb){return _0xef10eb['destroy']()[_0x6058('0x22')](function(){var _0x30bcf7=_0xef10eb[_0x6058('0x23')]({'plain':!![]});var _0x6c4b32=_0x6058('0x24');return db[_0x6058('0x25')]['destroy']({'where':{'type':_0x6c4b32,'resourceId':_0x30bcf7['id']}})['then'](function(){return _0xef10eb;});})[_0x6058('0x22')](function(){_0x52f075[_0x6058('0x16')](0xcc)[_0x6058('0x17')]();});}};}function handleEntityNotFound(_0x4a70f0,_0x5a2aca){return function(_0x266654){if(!_0x266654){_0x4a70f0[_0x6058('0x15')](0x194);}return _0x266654;};}function handleError(_0x1afd6b,_0x46c53c){_0x46c53c=_0x46c53c||0x1f4;return function(_0x4d5331){logger[_0x6058('0x26')](_0x4d5331['stack']);if(_0x4d5331['name']){delete _0x4d5331[_0x6058('0x27')];}_0x1afd6b[_0x6058('0x16')](_0x46c53c)[_0x6058('0x28')](_0x4d5331);};}exports['index']=function(_0x2077c3,_0x53bc09){var _0x5ba20f={},_0x2175a4={},_0x144861={'count':0x0,'rows':[]};var _0x18b50a=_['map'](db['Interval'][_0x6058('0x29')],function(_0xff0eee){return{'name':_0xff0eee[_0x6058('0x2a')],'type':_0xff0eee[_0x6058('0x2b')][_0x6058('0x2c')]};});_0x2175a4[_0x6058('0x2d')]=_[_0x6058('0x2e')](_0x18b50a,_0x6058('0x27'));_0x2175a4[_0x6058('0x2f')]=_['keys'](_0x2077c3[_0x6058('0x2f')]);_0x2175a4[_0x6058('0x30')]=_['intersection'](_0x2175a4[_0x6058('0x2d')],_0x2175a4[_0x6058('0x2f')]);_0x5ba20f[_0x6058('0x31')]=_['intersection'](_0x2175a4[_0x6058('0x2d')],qs['fields'](_0x2077c3[_0x6058('0x2f')][_0x6058('0x32')]));_0x5ba20f[_0x6058('0x31')]=_0x5ba20f[_0x6058('0x31')][_0x6058('0x33')]?_0x5ba20f[_0x6058('0x31')]:_0x2175a4[_0x6058('0x2d')];if(!_0x2077c3[_0x6058('0x2f')][_0x6058('0x34')](_0x6058('0x35'))){_0x5ba20f[_0x6058('0x36')]=qs['limit'](_0x2077c3['query'][_0x6058('0x36')]);_0x5ba20f[_0x6058('0x1b')]=qs[_0x6058('0x1b')](_0x2077c3[_0x6058('0x2f')][_0x6058('0x1b')]);}_0x5ba20f[_0x6058('0x37')]=qs['sort'](_0x2077c3[_0x6058('0x2f')]['sort']);_0x5ba20f[_0x6058('0x38')]=qs[_0x6058('0x30')](_[_0x6058('0x39')](_0x2077c3['query'],_0x2175a4['filters']),_0x18b50a);if(_0x2077c3['query']['filter']){_0x5ba20f[_0x6058('0x38')]=_[_0x6058('0x3a')](_0x5ba20f[_0x6058('0x38')],{'$or':_[_0x6058('0x2e')](_0x18b50a,function(_0x58a866){if(_0x58a866[_0x6058('0x2b')]!==_0x6058('0x3b')){var _0x54f002={};_0x54f002[_0x58a866[_0x6058('0x27')]]={'$like':'%'+_0x2077c3['query'][_0x6058('0x3c')]+'%'};return _0x54f002;}})});}_0x5ba20f=_[_0x6058('0x3a')]({},_0x5ba20f,_0x2077c3[_0x6058('0x3d')]);var _0x3cc69f={'where':_0x5ba20f[_0x6058('0x38')]};return db[_0x6058('0x3e')][_0x6058('0x1a')](_0x3cc69f)['then'](function(_0x4678ff){_0x144861[_0x6058('0x1a')]=_0x4678ff;if(_0x2077c3[_0x6058('0x2f')]['includeAll']){_0x5ba20f[_0x6058('0x3f')]=[{'all':!![]}];}return db['Interval'][_0x6058('0x40')](_0x5ba20f);})['then'](function(_0x1503a8){_0x144861['rows']=_0x1503a8;return _0x144861;})[_0x6058('0x22')](respondWithFilteredResult(_0x53bc09,_0x5ba20f))[_0x6058('0x41')](handleError(_0x53bc09,null));};exports[_0x6058('0x42')]=function(_0x413fc1,_0x44c18d){var _0x27e4c5={'raw':!![],'where':{'id':_0x413fc1[_0x6058('0x43')]['id']}},_0x32feea={};_0x32feea['model']=_[_0x6058('0x44')](db['Interval'][_0x6058('0x29')]);_0x32feea[_0x6058('0x2f')]=_['keys'](_0x413fc1['query']);_0x32feea[_0x6058('0x30')]=_[_0x6058('0x45')](_0x32feea[_0x6058('0x2d')],_0x32feea['query']);_0x27e4c5['attributes']=_[_0x6058('0x45')](_0x32feea[_0x6058('0x2d')],qs['fields'](_0x413fc1[_0x6058('0x2f')]['fields']));_0x27e4c5[_0x6058('0x31')]=_0x27e4c5['attributes']['length']?_0x27e4c5[_0x6058('0x31')]:_0x32feea[_0x6058('0x2d')];if(_0x413fc1['query'][_0x6058('0x46')]){_0x27e4c5[_0x6058('0x3f')]=[{'all':!![]}];}_0x27e4c5=_[_0x6058('0x3a')]({},_0x27e4c5,_0x413fc1[_0x6058('0x3d')]);return db[_0x6058('0x3e')][_0x6058('0x47')](_0x27e4c5)[_0x6058('0x22')](handleEntityNotFound(_0x44c18d,null))[_0x6058('0x22')](respondWithResult(_0x44c18d,null))[_0x6058('0x41')](handleError(_0x44c18d,null));};exports['create']=function(_0x140279,_0x31e0e9){return db['Interval'][_0x6058('0x48')](_0x140279[_0x6058('0x49')],{})[_0x6058('0x22')](function(_0x2192b1){var _0x4fd6ef=_0x140279[_0x6058('0x4a')][_0x6058('0x23')]({'plain':!![]});if(!_0x4fd6ef)throw new Error(_0x6058('0x4b'));if(_0x4fd6ef[_0x6058('0x4c')]===_0x6058('0x4a')){var _0x297446=_0x2192b1['get']({'plain':!![]});var _0x2b3609=_0x6058('0x24');return db[_0x6058('0x4d')][_0x6058('0x47')]({'where':{'name':_0x2b3609,'userProfileId':_0x4fd6ef[_0x6058('0x4e')]},'raw':!![]})[_0x6058('0x22')](function(_0x1bc75c){if(_0x1bc75c&&_0x1bc75c['autoAssociation']===0x0){return db[_0x6058('0x25')][_0x6058('0x48')]({'name':_0x297446['name'],'resourceId':_0x297446['id'],'type':_0x1bc75c[_0x6058('0x27')],'sectionId':_0x1bc75c['id']},{})['then'](function(){return _0x2192b1;});}else{return _0x2192b1;}})['catch'](function(_0x36acc){logger['error'](_0x6058('0x4f'),_0x36acc);throw _0x36acc;});}return _0x2192b1;})[_0x6058('0x22')](respondWithResult(_0x31e0e9,0xc9))[_0x6058('0x41')](handleError(_0x31e0e9,null));};exports[_0x6058('0x21')]=function(_0x20790f,_0xeedb43){if(_0x20790f[_0x6058('0x49')]['id']){delete _0x20790f[_0x6058('0x49')]['id'];}return db[_0x6058('0x3e')][_0x6058('0x47')]({'where':{'id':_0x20790f[_0x6058('0x43')]['id']}})['then'](handleEntityNotFound(_0xeedb43,null))[_0x6058('0x22')](saveUpdates(_0x20790f['body'],null))[_0x6058('0x22')](respondWithResult(_0xeedb43,null))[_0x6058('0x41')](handleError(_0xeedb43,null));};exports[_0x6058('0x50')]=function(_0x1864cf,_0xdb392){return db[_0x6058('0x3e')][_0x6058('0x47')]({'where':{'id':_0x1864cf['params']['id']}})[_0x6058('0x22')](handleEntityNotFound(_0xdb392,null))[_0x6058('0x22')](removeEntity(_0xdb392,null))[_0x6058('0x41')](handleError(_0xdb392,null));};exports['addInterval']=function(_0x2a2dd0,_0x4f9b48,_0x5bc91a){if(_0x2a2dd0['body']['id']){delete _0x2a2dd0[_0x6058('0x49')]['id'];}return db['Interval'][_0x6058('0x47')]({'where':{'id':_0x2a2dd0[_0x6058('0x43')]['id']}})[_0x6058('0x22')](handleEntityNotFound(_0x4f9b48,null))['then'](function(_0x3f62c3){if(_0x3f62c3){_0x2a2dd0[_0x6058('0x49')][_0x6058('0x51')]=_0x3f62c3['id'];return db[_0x6058('0x3e')][_0x6058('0x48')](_0x2a2dd0[_0x6058('0x49')]);}})[_0x6058('0x22')](respondWithResult(_0x4f9b48,null))[_0x6058('0x41')](handleError(_0x4f9b48,null));};exports[_0x6058('0x52')]=function(_0x50d998,_0x4456b7,_0x1145b5){var _0x54b822={};var _0x234cda={};var _0x289e45;var _0x59900d;return db[_0x6058('0x3e')][_0x6058('0x53')]({'where':{'id':_0x50d998[_0x6058('0x43')]['id']}})[_0x6058('0x22')](handleEntityNotFound(_0x4456b7,null))[_0x6058('0x22')](function(_0x1bab83){if(_0x1bab83){_0x289e45=_0x1bab83;_0x234cda[_0x6058('0x2d')]=_[_0x6058('0x44')](db[_0x6058('0x3e')][_0x6058('0x29')]);_0x234cda[_0x6058('0x2f')]=_[_0x6058('0x44')](_0x50d998[_0x6058('0x2f')]);_0x234cda[_0x6058('0x30')]=_[_0x6058('0x45')](_0x234cda['model'],_0x234cda[_0x6058('0x2f')]);_0x54b822[_0x6058('0x31')]=_['intersection'](_0x234cda['model'],qs[_0x6058('0x32')](_0x50d998[_0x6058('0x2f')]['fields']));_0x54b822[_0x6058('0x31')]=_0x54b822['attributes'][_0x6058('0x33')]?_0x54b822['attributes']:_0x234cda['model'];_0x54b822[_0x6058('0x37')]=qs[_0x6058('0x54')](_0x50d998['query']['sort']);_0x54b822[_0x6058('0x38')]=qs[_0x6058('0x30')](_['pick'](_0x50d998[_0x6058('0x2f')],_0x234cda['filters']));if(_0x50d998['query'][_0x6058('0x3c')]){_0x54b822[_0x6058('0x38')]=_[_0x6058('0x3a')](_0x54b822[_0x6058('0x38')],{'$or':_['map'](_0x54b822[_0x6058('0x31')],function(_0x10a0ca){var _0x321078={};_0x321078[_0x10a0ca]={'$like':'%'+_0x50d998[_0x6058('0x2f')][_0x6058('0x3c')]+'%'};return _0x321078;})});}_0x54b822=_[_0x6058('0x3a')]({},_0x54b822,_0x50d998[_0x6058('0x3d')]);return _0x289e45[_0x6058('0x52')](_0x54b822);}})[_0x6058('0x22')](function(_0x1bd894){if(_0x1bd894){_0x59900d=_0x1bd894[_0x6058('0x33')];if(!_0x50d998[_0x6058('0x2f')]['hasOwnProperty'](_0x6058('0x35'))){_0x54b822[_0x6058('0x36')]=qs[_0x6058('0x36')](_0x50d998['query'][_0x6058('0x36')]);_0x54b822[_0x6058('0x1b')]=qs['offset'](_0x50d998['query'][_0x6058('0x1b')]);}return _0x289e45[_0x6058('0x52')](_0x54b822);}})[_0x6058('0x22')](function(_0x4d9692){if(_0x4d9692){return _0x4d9692?{'count':_0x59900d,'rows':_0x4d9692}:null;}})[_0x6058('0x22')](respondWithResult(_0x4456b7,null))['catch'](handleError(_0x4456b7,null));};exports[_0x6058('0x55')]=function(_0x5adae4,_0x4596fa,_0x8d8ab5){return db[_0x6058('0x3e')][_0x6058('0x53')]({'where':{'id':_0x5adae4['params']['id']}})[_0x6058('0x22')](handleEntityNotFound(_0x4596fa,null))[_0x6058('0x22')](function(_0x4d431e){if(_0x4d431e){return db[_0x6058('0x56')][_0x6058('0x57')](function(_0x3e7a75){return db[_0x6058('0x3e')]['destroy']({'where':{'IntervalId':_0x5adae4['params']['id']},'transaction':_0x3e7a75})[_0x6058('0x22')](function(_0x49b9f8){var _0x382918=_[_0x6058('0x2e')](_0x5adae4[_0x6058('0x49')],function(_0x33403b){delete _0x33403b['id'];_0x33403b[_0x6058('0x51')]=_0x5adae4[_0x6058('0x43')]['id'];return _0x33403b;});return db['Interval'][_0x6058('0x58')](_0x382918,{'transaction':_0x3e7a75});});})[_0x6058('0x22')](function(){return db[_0x6058('0x3e')][_0x6058('0x40')]({'where':{'IntervalId':_0x5adae4[_0x6058('0x43')]['id']}});});}})[_0x6058('0x22')](respondWithResult(_0x4596fa,null))['catch'](handleError(_0x4596fa,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 50aedcd..f938118 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 _0x05d2=['define','Interval','tools_intervals','rewrite','interval','string','getIntervals','then','map','ifTime','reduce','./interval.attributes','exports'];(function(_0x39758d,_0x346423){var _0x44ac11=function(_0x175008){while(--_0x175008){_0x39758d['push'](_0x39758d['shift']());}};_0x44ac11(++_0x346423);}(_0x05d2,0x150));var _0x205d=function(_0x4d0dcc,_0x15e12d){_0x4d0dcc=_0x4d0dcc-0x0;var _0x5567d3=_0x05d2[_0x4d0dcc];return _0x5567d3;};'use strict';var attributes=require(_0x205d('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require('../../utils/iftime')['iftime'];module[_0x205d('0x1')]=function(_0x2a17c8){return _0x2a17c8[_0x205d('0x2')](_0x205d('0x3'),attributes,{'tableName':_0x205d('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x366abd){extensions[_0x205d('0x5')](_0x2a17c8,_0x366abd);},'afterBulkCreate':function(_0x377fd3,_0x3ba32c,_0x5d86b5){_0x5d86b5();extensions[_0x205d('0x5')](_0x2a17c8,_0x377fd3[0x0]);},'afterUpdate':function(_0x5325e3){extensions[_0x205d('0x5')](_0x2a17c8,_0x5325e3);},'afterDestroy':function(_0x2f8a9e){extensions[_0x205d('0x5')](_0x2a17c8,_0x2f8a9e);}},'instanceMethods':{'ifTime':function(_0x2d1335=undefined,_0x1f5424=new Date()){if(typeof this[_0x205d('0x6')]===_0x205d('0x7')){return iftime(this['interval'],_0x2d1335,_0x1f5424);}else{return this[_0x205d('0x8')]()[_0x205d('0x9')](function(_0x3a7cd7){return Promise['all'](_0x3a7cd7[_0x205d('0xa')](function(_0xcd5865){return _0xcd5865[_0x205d('0xb')](_0x2d1335,_0x1f5424);}));})[_0x205d('0x9')](function(_0x5035c7){return _0x5035c7[_0x205d('0xc')](function(_0x30b0cf,_0x7247cb){return _0x30b0cf||_0x7247cb;},![]);});}}}});}; \ No newline at end of file +var _0x93b8=['interval','getIntervals','all','map','ifTime','reduce','../../components/extensions/rewrite','../../utils/iftime','iftime','define','Interval','rewrite'];(function(_0x15d18f,_0x126b0e){var _0xd12bf7=function(_0x19e661){while(--_0x19e661){_0x15d18f['push'](_0x15d18f['shift']());}};_0xd12bf7(++_0x126b0e);}(_0x93b8,0xde));var _0x893b=function(_0x2206fc,_0x1c184c){_0x2206fc=_0x2206fc-0x0;var _0x1861f1=_0x93b8[_0x2206fc];return _0x1861f1;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x893b('0x0'));var iftime=require(_0x893b('0x1'))[_0x893b('0x2')];module['exports']=function(_0xc4236f){return _0xc4236f[_0x893b('0x3')](_0x893b('0x4'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x174f06){extensions[_0x893b('0x5')](_0xc4236f,_0x174f06);},'afterBulkCreate':function(_0x3817fb,_0x5c6429,_0x47b07c){_0x47b07c();extensions['rewrite'](_0xc4236f,_0x3817fb[0x0]);},'afterUpdate':function(_0xb512cb){extensions['rewrite'](_0xc4236f,_0xb512cb);},'afterDestroy':function(_0x486903){extensions[_0x893b('0x5')](_0xc4236f,_0x486903);}},'instanceMethods':{'ifTime':function(_0x5f3b92=undefined,_0x49de2e=new Date()){if(typeof this[_0x893b('0x6')]==='string'){return iftime(this['interval'],_0x5f3b92,_0x49de2e);}else{return this[_0x893b('0x7')]()['then'](function(_0x147226){return Promise[_0x893b('0x8')](_0x147226[_0x893b('0x9')](function(_0x1d4a37){return _0x1d4a37[_0x893b('0xa')](_0x5f3b92,_0x49de2e);}));})['then'](function(_0x165c82){return _0x165c82[_0x893b('0xb')](function(_0x1737a2,_0x59afdb){return _0x1737a2||_0x59afdb;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index cfde8c7..f37d8b9 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 _0xea9a=['isArray','intervals','string','timezone','length','format','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','lodash','../../utils/iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','catch','error','message','ShowInterval','find','stringify','all','ifTime','reduce','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds'];(function(_0x20288c,_0xc5210d){var _0x55c86e=function(_0x2a0b93){while(--_0x2a0b93){_0x20288c['push'](_0x20288c['shift']());}};_0x55c86e(++_0xc5210d);}(_0xea9a,0xbf));var _0xaea9=function(_0x22e458,_0x405ca7){_0x22e458=_0x22e458-0x0;var _0x38a0ca=_0xea9a[_0x22e458];return _0x38a0ca;};'use strict';var _=require(_0xaea9('0x0'));var util=require('util');var db=require('../../mysqldb')['db'];var iftime=require(_0xaea9('0x1'))['iftime'];var logger=require(_0xaea9('0x2'))(_0xaea9('0x3'));exports[_0xaea9('0x4')]=function(_0xc0b004){var _0x4f6429=this;return new Promise(function(_0x1ea87f,_0x1b2649){return db[_0xaea9('0x5')][_0xaea9('0x6')]({'raw':_0xc0b004[_0xaea9('0x7')]?_0xc0b004[_0xaea9('0x7')][_0xaea9('0x8')]===undefined?!![]:![]:!![],'where':_0xc0b004[_0xaea9('0x7')]?_0xc0b004[_0xaea9('0x7')][_0xaea9('0x9')]||null:null,'attributes':_0xc0b004[_0xaea9('0x7')]?_0xc0b004['options'][_0xaea9('0xa')]||null:null,'limit':_0xc0b004[_0xaea9('0x7')]?_0xc0b004['options'][_0xaea9('0xb')]||null:null,'include':_0xc0b004[_0xaea9('0x7')]?_0xc0b004[_0xaea9('0x7')][_0xaea9('0xc')]?_[_0xaea9('0xd')](_0xc0b004[_0xaea9('0x7')][_0xaea9('0xc')],function(_0x3b8f32){return{'model':db[_0x3b8f32[_0xaea9('0xe')]],'as':_0x3b8f32['as'],'attributes':_0x3b8f32[_0xaea9('0xa')],'include':_0x3b8f32[_0xaea9('0xc')]?_[_0xaea9('0xd')](_0x3b8f32['include'],function(_0x16d65d){return{'model':db[_0x16d65d[_0xaea9('0xe')]],'as':_0x16d65d['as'],'attributes':_0x16d65d[_0xaea9('0xa')],'include':_0x16d65d[_0xaea9('0xc')]?_[_0xaea9('0xd')](_0x16d65d[_0xaea9('0xc')],function(_0x278d2b){return{'model':db[_0x278d2b[_0xaea9('0xe')]],'as':_0x278d2b['as'],'attributes':_0x278d2b[_0xaea9('0xa')]};}):[]};}):[]};}):[]:[]})[_0xaea9('0xf')](function(_0x4ba43b){logger[_0xaea9('0x10')]('GetInterval',_0xc0b004);logger[_0xaea9('0x11')](_0xaea9('0x4'),_0xc0b004,JSON['stringify'](_0x4ba43b));_0x1ea87f(_0x4ba43b);})[_0xaea9('0x12')](function(_0x5428d2){logger[_0xaea9('0x13')](_0xaea9('0x4'),_0x5428d2['message'],_0xc0b004);_0x1b2649(_0x4f6429['error'](0x1f4,_0x5428d2[_0xaea9('0x14')]));});});};exports[_0xaea9('0x15')]=function(_0x51ed03){var _0x7f6c21=this;return new Promise(function(_0x387340,_0x188ef9){return db[_0xaea9('0x5')][_0xaea9('0x16')]({'raw':_0x51ed03['options']?_0x51ed03[_0xaea9('0x7')][_0xaea9('0x8')]===undefined?!![]:![]:!![],'where':_0x51ed03[_0xaea9('0x7')]?_0x51ed03[_0xaea9('0x7')]['where']||null:null,'attributes':_0x51ed03['options']?_0x51ed03[_0xaea9('0x7')]['attributes']||null:null,'include':_0x51ed03['options']?_0x51ed03[_0xaea9('0x7')]['include']?_[_0xaea9('0xd')](_0x51ed03[_0xaea9('0x7')][_0xaea9('0xc')],function(_0x366350){return{'model':db[_0x366350[_0xaea9('0xe')]],'as':_0x366350['as'],'attributes':_0x366350['attributes'],'include':_0x366350['include']?_[_0xaea9('0xd')](_0x366350['include'],function(_0x4aac9e){return{'model':db[_0x4aac9e['model']],'as':_0x4aac9e['as'],'attributes':_0x4aac9e[_0xaea9('0xa')],'include':_0x4aac9e[_0xaea9('0xc')]?_['map'](_0x4aac9e[_0xaea9('0xc')],function(_0x4d32c3){return{'model':db[_0x4d32c3[_0xaea9('0xe')]],'as':_0x4d32c3['as'],'attributes':_0x4d32c3['attributes']};}):[]};}):[]};}):[]:[]})[_0xaea9('0xf')](function(_0x4fda4e){logger[_0xaea9('0x10')](_0xaea9('0x15'),_0x51ed03);logger[_0xaea9('0x11')](_0xaea9('0x15'),_0x51ed03,JSON[_0xaea9('0x17')](_0x4fda4e));_0x387340(_0x4fda4e);})[_0xaea9('0x12')](function(_0x43be9f){logger['error']('ShowInterval',_0x43be9f[_0xaea9('0x14')],_0x51ed03);_0x188ef9(_0x7f6c21[_0xaea9('0x13')](0x1f4,_0x43be9f['message']));});});};function checkArrayOfIntervals(_0x18b5f3,_0x596012){var _0x59f80e=[];return db[_0xaea9('0x5')][_0xaea9('0x6')]({'where':{'id':_0x18b5f3}})[_0xaea9('0xf')](function(_0x3e7c29){_0x59f80e=_0x3e7c29;return Promise[_0xaea9('0x18')](_0x59f80e[_0xaea9('0xd')](function(_0x2bbc8d){return _0x2bbc8d[_0xaea9('0x19')](_0x596012);}));})['then'](function(_0x34abf2){var _0x2c41bc=_0x34abf2[_0xaea9('0x1a')](function(_0x5b6390,_0x13d4a2){return _0x5b6390||_0x13d4a2;},![]);logger[_0xaea9('0x10')](util['format'](_0xaea9('0x1b'),_0x59f80e['map'](function(_0x3350c6){return _0x3350c6[_0xaea9('0x1c')];})[_0xaea9('0x1d')](',\x20'),_0x59f80e['map'](function(_0x549e6b){return _0x549e6b['id'];})['join'](',\x20')));return _0x2c41bc;});}function checkSingleInterval(_0x449fe1,_0x13fe42){return db[_0xaea9('0x5')][_0xaea9('0x1e')](_0x449fe1)['then'](function(_0x29c862){if(_0x29c862){logger[_0xaea9('0x10')](util['format'](_0xaea9('0x1f'),_0x29c862[_0xaea9('0x1c')],_0x29c862['id']));return _0x29c862[_0xaea9('0x19')](_0x13fe42);}});}exports[_0xaea9('0x20')]=function(_0x31d0ad){var _0x1b11bc=_0x31d0ad[_0xaea9('0x21')];var _0x1a0659=Array[_0xaea9('0x22')](_0x31d0ad[_0xaea9('0x23')])?_0x31d0ad[_0xaea9('0x23')]:typeof _0x31d0ad[_0xaea9('0x23')]===_0xaea9('0x24')?[_0x31d0ad[_0xaea9('0x23')]]:[];var _0x1317d3=_0x31d0ad[_0xaea9('0x25')]||undefined;var _0x2b0e8c=![];if(_0x1a0659[_0xaea9('0x26')]){logger[_0xaea9('0x10')](util[_0xaea9('0x27')](_0xaea9('0x28'),_0x1a0659['join'](';\x20')));}if(_0x1317d3){logger[_0xaea9('0x10')](util[_0xaea9('0x27')](_0xaea9('0x29'),_0x1317d3));}logger['debug'](_0xaea9('0x2a'),_0x2b0e8c);logger[_0xaea9('0x2b')]('IntervalIftime',_0x31d0ad);return Promise[_0xaea9('0x2c')]()[_0xaea9('0xf')](function(){if(Array[_0xaea9('0x22')](_0x1b11bc)){return checkArrayOfIntervals(_0x1b11bc,_0x1317d3);}else if(_0x1b11bc){return checkSingleInterval(_0x1b11bc,_0x1317d3);}})[_0xaea9('0xf')](function(_0xdfc7ae){var _0x3ce953=_0x1a0659[_0xaea9('0x1a')](function(_0x3039b2,_0x2c71c4){return _0x3039b2||iftime(_0x2c71c4,_0x1317d3);},![]);_0x2b0e8c=_0xdfc7ae||_0x3ce953;return _0x2b0e8c;})[_0xaea9('0x12')](function(_0x5e2601){logger[_0xaea9('0x13')]('IntervalIftime',_0x31d0ad,_0x5e2601);throw this[_0xaea9('0x13')](0x1f4,_0x5e2601['message']);});}; \ No newline at end of file +var _0x97bf=['format','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','resolve','IntervalIftime','lodash','util','../../mysqldb','iftime','../../config/logger','rpc','Interval','options','where','attributes','include','map','model','then','info','GetInterval','debug','stringify','catch','error','message','ShowInterval','find','raw','all','ifTime','reduce','name','join','findById'];(function(_0x19ecd5,_0x3098f6){var _0x5b8ec5=function(_0x20d35f){while(--_0x20d35f){_0x19ecd5['push'](_0x19ecd5['shift']());}};_0x5b8ec5(++_0x3098f6);}(_0x97bf,0xd8));var _0xf97b=function(_0x322a9e,_0x85f73f){_0x322a9e=_0x322a9e-0x0;var _0x2df1eb=_0x97bf[_0x322a9e];return _0x2df1eb;};'use strict';var _=require(_0xf97b('0x0'));var util=require(_0xf97b('0x1'));var db=require(_0xf97b('0x2'))['db'];var iftime=require('../../utils/iftime')[_0xf97b('0x3')];var logger=require(_0xf97b('0x4'))(_0xf97b('0x5'));exports['GetInterval']=function(_0x1735ab){var _0x63b16a=this;return new Promise(function(_0x3578f3,_0x44eb13){return db[_0xf97b('0x6')]['findAll']({'raw':_0x1735ab[_0xf97b('0x7')]?_0x1735ab[_0xf97b('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x1735ab[_0xf97b('0x7')]?_0x1735ab[_0xf97b('0x7')][_0xf97b('0x8')]||null:null,'attributes':_0x1735ab['options']?_0x1735ab[_0xf97b('0x7')][_0xf97b('0x9')]||null:null,'limit':_0x1735ab[_0xf97b('0x7')]?_0x1735ab[_0xf97b('0x7')]['limit']||null:null,'include':_0x1735ab['options']?_0x1735ab['options'][_0xf97b('0xa')]?_[_0xf97b('0xb')](_0x1735ab[_0xf97b('0x7')][_0xf97b('0xa')],function(_0x1206f7){return{'model':db[_0x1206f7[_0xf97b('0xc')]],'as':_0x1206f7['as'],'attributes':_0x1206f7[_0xf97b('0x9')],'include':_0x1206f7['include']?_[_0xf97b('0xb')](_0x1206f7[_0xf97b('0xa')],function(_0x10ff5d){return{'model':db[_0x10ff5d[_0xf97b('0xc')]],'as':_0x10ff5d['as'],'attributes':_0x10ff5d['attributes'],'include':_0x10ff5d[_0xf97b('0xa')]?_[_0xf97b('0xb')](_0x10ff5d['include'],function(_0x3f3e8b){return{'model':db[_0x3f3e8b[_0xf97b('0xc')]],'as':_0x3f3e8b['as'],'attributes':_0x3f3e8b['attributes']};}):[]};}):[]};}):[]:[]})[_0xf97b('0xd')](function(_0xac703d){logger[_0xf97b('0xe')](_0xf97b('0xf'),_0x1735ab);logger[_0xf97b('0x10')](_0xf97b('0xf'),_0x1735ab,JSON[_0xf97b('0x11')](_0xac703d));_0x3578f3(_0xac703d);})[_0xf97b('0x12')](function(_0xb9e6d9){logger[_0xf97b('0x13')](_0xf97b('0xf'),_0xb9e6d9['message'],_0x1735ab);_0x44eb13(_0x63b16a[_0xf97b('0x13')](0x1f4,_0xb9e6d9[_0xf97b('0x14')]));});});};exports[_0xf97b('0x15')]=function(_0x129f00){var _0x3020a5=this;return new Promise(function(_0x1e97c4,_0x2fc6a8){return db['Interval'][_0xf97b('0x16')]({'raw':_0x129f00[_0xf97b('0x7')]?_0x129f00[_0xf97b('0x7')][_0xf97b('0x17')]===undefined?!![]:![]:!![],'where':_0x129f00[_0xf97b('0x7')]?_0x129f00['options'][_0xf97b('0x8')]||null:null,'attributes':_0x129f00[_0xf97b('0x7')]?_0x129f00[_0xf97b('0x7')][_0xf97b('0x9')]||null:null,'include':_0x129f00[_0xf97b('0x7')]?_0x129f00[_0xf97b('0x7')][_0xf97b('0xa')]?_[_0xf97b('0xb')](_0x129f00['options']['include'],function(_0x5a8199){return{'model':db[_0x5a8199[_0xf97b('0xc')]],'as':_0x5a8199['as'],'attributes':_0x5a8199[_0xf97b('0x9')],'include':_0x5a8199[_0xf97b('0xa')]?_['map'](_0x5a8199[_0xf97b('0xa')],function(_0xc7dc0){return{'model':db[_0xc7dc0['model']],'as':_0xc7dc0['as'],'attributes':_0xc7dc0[_0xf97b('0x9')],'include':_0xc7dc0[_0xf97b('0xa')]?_[_0xf97b('0xb')](_0xc7dc0['include'],function(_0x547a01){return{'model':db[_0x547a01[_0xf97b('0xc')]],'as':_0x547a01['as'],'attributes':_0x547a01['attributes']};}):[]};}):[]};}):[]:[]})[_0xf97b('0xd')](function(_0x41c65d){logger['info'](_0xf97b('0x15'),_0x129f00);logger[_0xf97b('0x10')](_0xf97b('0x15'),_0x129f00,JSON[_0xf97b('0x11')](_0x41c65d));_0x1e97c4(_0x41c65d);})[_0xf97b('0x12')](function(_0x58305e){logger[_0xf97b('0x13')](_0xf97b('0x15'),_0x58305e[_0xf97b('0x14')],_0x129f00);_0x2fc6a8(_0x3020a5[_0xf97b('0x13')](0x1f4,_0x58305e[_0xf97b('0x14')]));});});};function checkArrayOfIntervals(_0x5cbc48,_0x1c341e){var _0x6f6203=[];return db['Interval']['findAll']({'where':{'id':_0x5cbc48}})[_0xf97b('0xd')](function(_0x561db0){_0x6f6203=_0x561db0;return Promise[_0xf97b('0x18')](_0x6f6203['map'](function(_0x22fcd6){return _0x22fcd6[_0xf97b('0x19')](_0x1c341e);}));})['then'](function(_0x13246b){var _0x1ae196=_0x13246b[_0xf97b('0x1a')](function(_0x147fab,_0x5b6b4a){return _0x147fab||_0x5b6b4a;},![]);logger['info'](util['format']('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x6f6203[_0xf97b('0xb')](function(_0x350de6){return _0x350de6[_0xf97b('0x1b')];})[_0xf97b('0x1c')](',\x20'),_0x6f6203[_0xf97b('0xb')](function(_0x1f6316){return _0x1f6316['id'];})[_0xf97b('0x1c')](',\x20')));return _0x1ae196;});}function checkSingleInterval(_0x409406,_0x3bdc43){return db[_0xf97b('0x6')][_0xf97b('0x1d')](_0x409406)[_0xf97b('0xd')](function(_0x1e346c){if(_0x1e346c){logger[_0xf97b('0xe')](util[_0xf97b('0x1e')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x1e346c['name'],_0x1e346c['id']));return _0x1e346c[_0xf97b('0x19')](_0x3bdc43);}});}exports['IntervalIftime']=function(_0x19f072){var _0x22b321=_0x19f072[_0xf97b('0x1f')];var _0x4ff4f3=Array[_0xf97b('0x20')](_0x19f072['intervals'])?_0x19f072[_0xf97b('0x21')]:typeof _0x19f072[_0xf97b('0x21')]===_0xf97b('0x22')?[_0x19f072[_0xf97b('0x21')]]:[];var _0x2c675e=_0x19f072[_0xf97b('0x23')]||undefined;var _0x156f7c=![];if(_0x4ff4f3[_0xf97b('0x24')]){logger[_0xf97b('0xe')](util[_0xf97b('0x1e')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x4ff4f3[_0xf97b('0x1c')](';\x20')));}if(_0x2c675e){logger[_0xf97b('0xe')](util['format'](_0xf97b('0x25'),_0x2c675e));}logger[_0xf97b('0x10')](_0xf97b('0x26'),_0x156f7c);logger['silly']('IntervalIftime',_0x19f072);return Promise[_0xf97b('0x27')]()['then'](function(){if(Array['isArray'](_0x22b321)){return checkArrayOfIntervals(_0x22b321,_0x2c675e);}else if(_0x22b321){return checkSingleInterval(_0x22b321,_0x2c675e);}})['then'](function(_0x4fb6d5){var _0x2fe15d=_0x4ff4f3[_0xf97b('0x1a')](function(_0x1e7c32,_0x5b54fb){return _0x1e7c32||iftime(_0x5b54fb,_0x2c675e);},![]);_0x156f7c=_0x4fb6d5||_0x2fe15d;return _0x156f7c;})[_0xf97b('0x12')](function(_0x1bffec){logger[_0xf97b('0x13')](_0xf97b('0x28'),_0x19f072,_0x1bffec);throw this[_0xf97b('0x13')](0x1f4,_0x1bffec['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 7b75282..05ce37b 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 _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x3beb12,_0x98fdd){var _0x2251b3=function(_0xc445ab){while(--_0xc445ab){_0x3beb12['push'](_0x3beb12['shift']());}};_0x2251b3(++_0x98fdd);}(_0xdb28,0x106));var _0x8db2=function(_0x52f623,_0xfb3019){_0x52f623=_0x52f623-0x0;var _0x386b35=_0xdb28[_0x52f623];return _0x386b35;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index e3c722d..10f7c2c 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 _0xdd22=['newToken','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','toString','request','data','parse','error','status','json','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','connection','remoteAddress','socket','bluebird','https','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','issuetype','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502'];(function(_0x21af3a,_0x386e1d){var _0x268a49=function(_0x41a650){while(--_0x41a650){_0x21af3a['push'](_0x21af3a['shift']());}};_0x268a49(++_0x386e1d);}(_0xdd22,0x115));var _0x2dd2=function(_0x36f344,_0x244f6d){_0x36f344=_0x36f344-0x0;var _0x44efd9=_0xdd22[_0x36f344];return _0x44efd9;};'use strict';var BPromise=require(_0x2dd2('0x0'));var https=require(_0x2dd2('0x1'));var logger=require('../../config/logger')('api');var USERNAME=_0x2dd2('0x2');var PASSWORD=_0x2dd2('0x3');function openIssue(_0x379dac,_0x177176){var _0x5ca99e={'fields':{'project':{'key':_0x379dac[_0x2dd2('0x4')]||'MOTGUI'},'summary':(_0x379dac[_0x2dd2('0x5')]||_0x2dd2('0x6'))+_0x2dd2('0x7')+_0x379dac['ip'],'description':_0x379dac[_0x2dd2('0x8')]||JSON[_0x2dd2('0x9')](_0x379dac),'issuetype':{'name':_0x379dac[_0x2dd2('0xa')]||'Bug'}}};_0x5ca99e[_0x2dd2('0xb')][_0x2dd2('0xc')]=_0x379dac[_0x2dd2('0xd')];_0x5ca99e[_0x2dd2('0xb')][_0x2dd2('0xe')]=_0x379dac[_0x2dd2('0xf')];_0x5ca99e[_0x2dd2('0xb')][_0x2dd2('0x10')]=_0x379dac[_0x2dd2('0x11')];_0x5ca99e[_0x2dd2('0xb')]['customfield_11503']=_0x379dac['name'];_0x5ca99e[_0x2dd2('0xb')][_0x2dd2('0x12')]=_0x379dac[_0x2dd2('0x13')];_0x5ca99e['fields'][_0x2dd2('0x14')]=_0x379dac['ip'];var _0x9db656={'host':_0x2dd2('0x15'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x2dd2('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x2dd2('0x17'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x2dd2('0x18')]('base64')}};var _0x29fc50=JSON[_0x2dd2('0x9')](_0x5ca99e);var _0x31378d=https[_0x2dd2('0x19')](_0x9db656,function(_0x80aff4){_0x80aff4['setEncoding']('utf8');var _0xfa1ceb='';_0x80aff4['on'](_0x2dd2('0x1a'),function(_0x4f1825){_0xfa1ceb+=_0x4f1825;});_0x80aff4['on']('end',function(){if(_0x177176){return _0x177176['status'](_0x80aff4['statusCode'])['json'](JSON[_0x2dd2('0x1b')](_0xfa1ceb));}});});_0x31378d['on'](_0x2dd2('0x1c'),function(_0x377b29){if(_0x177176){return _0x177176[_0x2dd2('0x1d')](0x1f4)[_0x2dd2('0x1e')]({'errors':[{'message':_0x2dd2('0x1f'),'type':_0x2dd2('0x20')}]});}});_0x31378d[_0x2dd2('0x21')](_0x29fc50);_0x31378d['end']();}exports[_0x2dd2('0x22')]=openIssue;exports[_0x2dd2('0x23')]=function(_0x13ec38,_0x51b0e0){_0x13ec38[_0x2dd2('0x24')]['ip']=_0x13ec38[_0x2dd2('0x25')][_0x2dd2('0x26')]||_0x13ec38[_0x2dd2('0x27')][_0x2dd2('0x28')]||_0x13ec38[_0x2dd2('0x29')][_0x2dd2('0x28')]||_0x13ec38[_0x2dd2('0x27')]['socket'][_0x2dd2('0x28')];return openIssue(_0x13ec38[_0x2dd2('0x24')],_0x51b0e0);}; \ No newline at end of file +var _0xdd6b=['fields','customfield_11500','email','oldToken','customfield_11502','customfield_11503','customfield_11504','customfield_10102','POST','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','data','end','status','parse','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','send','headers','x-forwarded-for','remoteAddress','socket','connection','body','https','support','3eAmWpBVP0','summary','\x20from\x20','issuetype','Bug'];(function(_0x58de43,_0xcb8233){var _0x2ec8e4=function(_0x1249f6){while(--_0x1249f6){_0x58de43['push'](_0x58de43['shift']());}};_0x2ec8e4(++_0xcb8233);}(_0xdd6b,0x146));var _0xbdd6=function(_0x3a911e,_0xa48044){_0x3a911e=_0x3a911e-0x0;var _0x42d517=_0xdd6b[_0x3a911e];return _0x42d517;};'use strict';var BPromise=require('bluebird');var https=require(_0xbdd6('0x0'));var logger=require('../../config/logger')('api');var USERNAME=_0xbdd6('0x1');var PASSWORD=_0xbdd6('0x2');function openIssue(_0x4c5c15,_0x4bcd39){var _0x40659d={'fields':{'project':{'key':_0x4c5c15['key']||'MOTGUI'},'summary':(_0x4c5c15[_0xbdd6('0x3')]||'Report')+_0xbdd6('0x4')+_0x4c5c15['ip'],'description':_0x4c5c15['description']||JSON['stringify'](_0x4c5c15),'issuetype':{'name':_0x4c5c15[_0xbdd6('0x5')]||_0xbdd6('0x6')}}};_0x40659d[_0xbdd6('0x7')][_0xbdd6('0x8')]=_0x4c5c15[_0xbdd6('0x9')];_0x40659d[_0xbdd6('0x7')]['customfield_11501']=_0x4c5c15[_0xbdd6('0xa')];_0x40659d[_0xbdd6('0x7')][_0xbdd6('0xb')]=_0x4c5c15['newToken'];_0x40659d['fields'][_0xbdd6('0xc')]=_0x4c5c15['name'];_0x40659d['fields'][_0xbdd6('0xd')]=_0x4c5c15['reason'];_0x40659d[_0xbdd6('0x7')][_0xbdd6('0xe')]=_0x4c5c15['ip'];var _0x58884d={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':_0xbdd6('0xf'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xbdd6('0x10')+new Buffer(USERNAME+':'+PASSWORD)[_0xbdd6('0x11')](_0xbdd6('0x12'))}};var _0x1b86e2=JSON[_0xbdd6('0x13')](_0x40659d);var _0x58ec5a=https[_0xbdd6('0x14')](_0x58884d,function(_0x4be38b){_0x4be38b[_0xbdd6('0x15')](_0xbdd6('0x16'));var _0x1a89d1='';_0x4be38b['on'](_0xbdd6('0x17'),function(_0x4c8a9d){_0x1a89d1+=_0x4c8a9d;});_0x4be38b['on'](_0xbdd6('0x18'),function(){if(_0x4bcd39){return _0x4bcd39[_0xbdd6('0x19')](_0x4be38b['statusCode'])['json'](JSON[_0xbdd6('0x1a')](_0x1a89d1));}});});_0x58ec5a['on']('error',function(_0x1ee476){if(_0x4bcd39){return _0x4bcd39[_0xbdd6('0x19')](0x1f4)[_0xbdd6('0x1b')]({'errors':[{'message':_0xbdd6('0x1c'),'type':_0xbdd6('0x1d')}]});}});_0x58ec5a['write'](_0x1b86e2);_0x58ec5a[_0xbdd6('0x18')]();}exports['openIssue']=openIssue;exports[_0xbdd6('0x1e')]=function(_0x5d912b,_0x2fc00d){_0x5d912b['body']['ip']=_0x5d912b[_0xbdd6('0x1f')][_0xbdd6('0x20')]||_0x5d912b['connection'][_0xbdd6('0x21')]||_0x5d912b[_0xbdd6('0x22')][_0xbdd6('0x21')]||_0x5d912b[_0xbdd6('0x23')]['socket']['remoteAddress'];return openIssue(_0x5d912b[_0xbdd6('0x24')],_0x2fc00d);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 667bc33..cb0d011 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 _0xdace=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x43d942,_0x210b8b){var _0x46cc6e=function(_0x331395){while(--_0x331395){_0x43d942['push'](_0x43d942['shift']());}};_0x46cc6e(++_0x210b8b);}(_0xdace,0xc5));var _0xedac=function(_0x2d3ab3,_0x47d90b){_0x2d3ab3=_0x2d3ab3-0x0;var _0x321f9e=_0xdace[_0x2d3ab3];return _0x321f9e;};'use strict';var multer=require(_0xedac('0x0'));var util=require('util');var path=require(_0xedac('0x1'));var timeout=require(_0xedac('0x2'));var express=require(_0xedac('0x3'));var router=express['Router']();var fs_extra=require(_0xedac('0x4'));var auth=require(_0xedac('0x5'));var interaction=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var controller=require('./jscriptyAnswerReport.controller');router[_0xedac('0x8')]('/',auth[_0xedac('0x9')](),controller[_0xedac('0xa')]);router['get'](_0xedac('0xb'),auth[_0xedac('0x9')](),controller[_0xedac('0xc')]);router['get'](_0xedac('0xd'),auth[_0xedac('0x9')](),controller[_0xedac('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xedac('0xf')]);router[_0xedac('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xedac('0x11')]);router[_0xedac('0x12')]('/:id',auth[_0xedac('0x9')](),controller['destroy']);module[_0xedac('0x13')]=router; \ No newline at end of file +var _0xb58b=['get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./jscriptyAnswerReport.controller'];(function(_0x1c1312,_0x3b96d6){var _0x4a0144=function(_0x1fb411){while(--_0x1fb411){_0x1c1312['push'](_0x1c1312['shift']());}};_0x4a0144(++_0x3b96d6);}(_0xb58b,0x1f1));var _0xbb58=function(_0x169755,_0x3f50fa){_0x169755=_0x169755-0x0;var _0x582cc3=_0xb58b[_0x169755];return _0x582cc3;};'use strict';var multer=require('multer');var util=require(_0xbb58('0x0'));var path=require(_0xbb58('0x1'));var timeout=require(_0xbb58('0x2'));var express=require('express');var router=express[_0xbb58('0x3')]();var fs_extra=require(_0xbb58('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbb58('0x5'));var config=require('../../config/environment');var controller=require(_0xbb58('0x6'));router[_0xbb58('0x7')]('/',auth[_0xbb58('0x8')](),controller['index']);router[_0xbb58('0x7')](_0xbb58('0x9'),auth[_0xbb58('0x8')](),controller[_0xbb58('0xa')]);router[_0xbb58('0x7')](_0xbb58('0xb'),auth[_0xbb58('0x8')](),controller[_0xbb58('0xc')]);router[_0xbb58('0xd')]('/',auth[_0xbb58('0x8')](),controller[_0xbb58('0xe')]);router['put'](_0xbb58('0xb'),auth['isAuthenticated'](),controller[_0xbb58('0xf')]);router[_0xbb58('0x10')](_0xbb58('0xb'),auth[_0xbb58('0x8')](),controller['destroy']);module[_0xbb58('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index ed17750..93788f3 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7a54,0x106));var _0x47a5=function(_0x1fcbce,_0x10e7eb){_0x1fcbce=_0x1fcbce-0x0;var _0x20edb9=_0x7a54[_0x1fcbce];return _0x20edb9;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x7a54,0x106));var _0x47a5=function(_0x932e99,_0x4fc584){_0x932e99=_0x932e99-0x0;var _0x3b1b60=_0x7a54[_0x932e99];return _0x3b1b60;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 0173758..28f66d8 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 _0xa6bb=['nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','catch','params','keys','include','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','Content-Range','apply','reject','update','then','error','stack','name','index','JscriptyAnswerReport','type','model','map','query','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0xa6bb,0x12c));var _0xba6b=function(_0x59857f,_0x33cb70){_0x59857f=_0x59857f-0x0;var _0x5905f9=_0xa6bb[_0x59857f];return _0x5905f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba6b('0x0'));var zipdir=require(_0xba6b('0x1'));var jsonpatch=require(_0xba6b('0x2'));var rp=require(_0xba6b('0x3'));var moment=require(_0xba6b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xba6b('0x5'));var path=require(_0xba6b('0x6'));var sox=require(_0xba6b('0x7'));var csv=require(_0xba6b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xba6b('0x9'));var squel=require(_0xba6b('0xa'));var crypto=require(_0xba6b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xba6b('0x8'));var querystring=require(_0xba6b('0xc'));var Papa=require(_0xba6b('0xd'));var Redis=require(_0xba6b('0xe'));var authService=require(_0xba6b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xba6b('0x10'));var hardwareService=require(_0xba6b('0x11'));var logger=require(_0xba6b('0x12'))('api');var utils=require(_0xba6b('0x13'));var config=require(_0xba6b('0x14'));var licenseUtil=require(_0xba6b('0x15'));var db=require(_0xba6b('0x16'))['db'];function respondWithStatusCode(_0x55b6ab,_0x1e8473){_0x1e8473=_0x1e8473||0xcc;return function(_0x5b1d28){if(_0x5b1d28){return _0x55b6ab[_0xba6b('0x17')](_0x1e8473);}return _0x55b6ab[_0xba6b('0x18')](_0x1e8473)[_0xba6b('0x19')]();};}function respondWithResult(_0x15d4e2,_0x32144e){_0x32144e=_0x32144e||0xc8;return function(_0x53ec00){if(_0x53ec00){return _0x15d4e2[_0xba6b('0x18')](_0x32144e)[_0xba6b('0x1a')](_0x53ec00);}};}function respondWithFilteredResult(_0x50b58a,_0x16c3d0){return function(_0x1d280e){if(_0x1d280e){var _0x52b2ff=typeof _0x16c3d0['offset']===_0xba6b('0x1b')&&typeof _0x16c3d0['limit']==='undefined';var _0x5a553c=_0x1d280e['count'];var _0x4be059=_0x52b2ff?0x0:_0x16c3d0[_0xba6b('0x1c')];var _0x34aa97=_0x52b2ff?_0x1d280e[_0xba6b('0x1d')]:_0x16c3d0[_0xba6b('0x1c')]+_0x16c3d0[_0xba6b('0x1e')];var _0x15d1d2;if(_0x34aa97>=_0x5a553c){_0x34aa97=_0x5a553c;_0x15d1d2=0xc8;}else{_0x15d1d2=0xce;}_0x50b58a[_0xba6b('0x18')](_0x15d1d2);return _0x50b58a['set'](_0xba6b('0x1f'),_0x4be059+'-'+_0x34aa97+'/'+_0x5a553c)['json'](_0x1d280e);}return null;};}function patchUpdates(_0x54a392){return function(_0x13beca){try{jsonpatch[_0xba6b('0x20')](_0x13beca,_0x54a392,!![]);}catch(_0x3905ae){return BPromise[_0xba6b('0x21')](_0x3905ae);}return _0x13beca['save']();};}function saveUpdates(_0xa632cb,_0x436623){return function(_0x548c1b){if(_0x548c1b){return _0x548c1b[_0xba6b('0x22')](_0xa632cb)[_0xba6b('0x23')](function(_0x82b68f){return _0x82b68f;});}return null;};}function removeEntity(_0x12e4e6,_0x426641){return function(_0x5c2845){if(_0x5c2845){return _0x5c2845['destroy']()['then'](function(){_0x12e4e6['status'](0xcc)[_0xba6b('0x19')]();});}};}function handleEntityNotFound(_0x2525f8,_0x2f5343){return function(_0x39f052){if(!_0x39f052){_0x2525f8[_0xba6b('0x17')](0x194);}return _0x39f052;};}function handleError(_0x32375c,_0x591102){_0x591102=_0x591102||0x1f4;return function(_0x876e58){logger[_0xba6b('0x24')](_0x876e58[_0xba6b('0x25')]);if(_0x876e58['name']){delete _0x876e58[_0xba6b('0x26')];}_0x32375c[_0xba6b('0x18')](_0x591102)['send'](_0x876e58);};}exports[_0xba6b('0x27')]=function(_0x25d5e6,_0xea9fbc){var _0x41a0e0={},_0x506f14={},_0x506447={'count':0x0,'rows':[]};var _0x18a4c1=_['map'](db[_0xba6b('0x28')]['rawAttributes'],function(_0x1a6b93){return{'name':_0x1a6b93['fieldName'],'type':_0x1a6b93[_0xba6b('0x29')]['key']};});_0x506f14[_0xba6b('0x2a')]=_[_0xba6b('0x2b')](_0x18a4c1,_0xba6b('0x26'));_0x506f14[_0xba6b('0x2c')]=_['keys'](_0x25d5e6[_0xba6b('0x2c')]);_0x506f14['filters']=_['intersection'](_0x506f14[_0xba6b('0x2a')],_0x506f14[_0xba6b('0x2c')]);_0x41a0e0['attributes']=_[_0xba6b('0x2d')](_0x506f14['model'],qs['fields'](_0x25d5e6[_0xba6b('0x2c')][_0xba6b('0x2e')]));_0x41a0e0[_0xba6b('0x2f')]=_0x41a0e0[_0xba6b('0x2f')][_0xba6b('0x30')]?_0x41a0e0['attributes']:_0x506f14[_0xba6b('0x2a')];if(!_0x25d5e6[_0xba6b('0x2c')][_0xba6b('0x31')](_0xba6b('0x32'))){_0x41a0e0[_0xba6b('0x1e')]=qs[_0xba6b('0x1e')](_0x25d5e6[_0xba6b('0x2c')][_0xba6b('0x1e')]);_0x41a0e0[_0xba6b('0x1c')]=qs['offset'](_0x25d5e6[_0xba6b('0x2c')][_0xba6b('0x1c')]);}_0x41a0e0[_0xba6b('0x33')]=qs[_0xba6b('0x34')](_0x25d5e6['query']['sort']);_0x41a0e0[_0xba6b('0x35')]=qs[_0xba6b('0x36')](_[_0xba6b('0x37')](_0x25d5e6[_0xba6b('0x2c')],_0x506f14['filters']),_0x18a4c1);if(_0x25d5e6[_0xba6b('0x2c')][_0xba6b('0x38')]){_0x41a0e0['where']=_[_0xba6b('0x39')](_0x41a0e0['where'],{'$or':_[_0xba6b('0x2b')](_0x18a4c1,function(_0x36df21){if(_0x36df21[_0xba6b('0x29')]!=='VIRTUAL'){var _0x26c479={};_0x26c479[_0x36df21[_0xba6b('0x26')]]={'$like':'%'+_0x25d5e6['query'][_0xba6b('0x38')]+'%'};return _0x26c479;}})});}_0x41a0e0=_['merge']({},_0x41a0e0,_0x25d5e6[_0xba6b('0x3a')]);var _0x5cc07e={'where':_0x41a0e0[_0xba6b('0x35')]};return db['JscriptyAnswerReport'][_0xba6b('0x1d')](_0x5cc07e)['then'](function(_0x37dcb6){_0x506447[_0xba6b('0x1d')]=_0x37dcb6;if(_0x25d5e6[_0xba6b('0x2c')][_0xba6b('0x3b')]){_0x41a0e0['include']=[{'all':!![]}];}return db[_0xba6b('0x28')][_0xba6b('0x3c')](_0x41a0e0);})[_0xba6b('0x23')](function(_0x31fe5a){_0x506447[_0xba6b('0x3d')]=_0x31fe5a;return _0x506447;})['then'](respondWithFilteredResult(_0xea9fbc,_0x41a0e0))[_0xba6b('0x3e')](handleError(_0xea9fbc,null));};exports['show']=function(_0x1f229b,_0x7cb298){var _0x5b710a={'raw':!![],'where':{'id':_0x1f229b[_0xba6b('0x3f')]['id']}},_0x57e9b5={};_0x57e9b5[_0xba6b('0x2a')]=_[_0xba6b('0x40')](db[_0xba6b('0x28')]['rawAttributes']);_0x57e9b5[_0xba6b('0x2c')]=_[_0xba6b('0x40')](_0x1f229b[_0xba6b('0x2c')]);_0x57e9b5[_0xba6b('0x36')]=_['intersection'](_0x57e9b5[_0xba6b('0x2a')],_0x57e9b5[_0xba6b('0x2c')]);_0x5b710a[_0xba6b('0x2f')]=_[_0xba6b('0x2d')](_0x57e9b5[_0xba6b('0x2a')],qs[_0xba6b('0x2e')](_0x1f229b['query'][_0xba6b('0x2e')]));_0x5b710a[_0xba6b('0x2f')]=_0x5b710a[_0xba6b('0x2f')]['length']?_0x5b710a[_0xba6b('0x2f')]:_0x57e9b5[_0xba6b('0x2a')];if(_0x1f229b[_0xba6b('0x2c')][_0xba6b('0x3b')]){_0x5b710a[_0xba6b('0x41')]=[{'all':!![]}];}_0x5b710a=_[_0xba6b('0x39')]({},_0x5b710a,_0x1f229b[_0xba6b('0x3a')]);return db[_0xba6b('0x28')]['find'](_0x5b710a)[_0xba6b('0x23')](handleEntityNotFound(_0x7cb298,null))[_0xba6b('0x23')](respondWithResult(_0x7cb298,null))[_0xba6b('0x3e')](handleError(_0x7cb298,null));};exports['create']=function(_0x2d231e,_0x37172b){return db[_0xba6b('0x28')][_0xba6b('0x42')](_0x2d231e[_0xba6b('0x43')],{})[_0xba6b('0x23')](respondWithResult(_0x37172b,0xc9))[_0xba6b('0x3e')](handleError(_0x37172b,null));};exports[_0xba6b('0x22')]=function(_0x2dea62,_0x5035b3){if(_0x2dea62[_0xba6b('0x43')]['id']){delete _0x2dea62[_0xba6b('0x43')]['id'];}return db[_0xba6b('0x28')][_0xba6b('0x44')]({'where':{'id':_0x2dea62[_0xba6b('0x3f')]['id']}})[_0xba6b('0x23')](handleEntityNotFound(_0x5035b3,null))[_0xba6b('0x23')](saveUpdates(_0x2dea62[_0xba6b('0x43')],null))[_0xba6b('0x23')](respondWithResult(_0x5035b3,null))[_0xba6b('0x3e')](handleError(_0x5035b3,null));};exports['destroy']=function(_0x40c0ea,_0x36d3db){return db['JscriptyAnswerReport'][_0xba6b('0x44')]({'where':{'id':_0x40c0ea[_0xba6b('0x3f')]['id']}})[_0xba6b('0x23')](handleEntityNotFound(_0x36d3db,null))['then'](removeEntity(_0x36d3db,null))[_0xba6b('0x3e')](handleError(_0x36d3db,null));};exports[_0xba6b('0x45')]=function(_0x2a44de,_0x586255){return db[_0xba6b('0x28')]['describe']()['then'](respondWithResult(_0x586255,null))['catch'](handleError(_0x586255,null));}; \ No newline at end of file +var _0x9505=['save','then','destroy','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0x9505,0x1e5));var _0x5950=function(_0xc1fd9e,_0x238c0c){_0xc1fd9e=_0xc1fd9e-0x0;var _0x122271=_0x9505[_0xc1fd9e];return _0x122271;};'use strict';var emlformat=require(_0x5950('0x0'));var rimraf=require(_0x5950('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5950('0x2'));var rp=require(_0x5950('0x3'));var moment=require(_0x5950('0x4'));var BPromise=require(_0x5950('0x5'));var Mustache=require(_0x5950('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5950('0x7'));var csv=require(_0x5950('0x8'));var ejs=require(_0x5950('0x9'));var fs=require('fs');var fs_extra=require(_0x5950('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5950('0xb'));var jsforce=require(_0x5950('0xc'));var deskjs=require(_0x5950('0xd'));var toCsv=require(_0x5950('0x8'));var querystring=require(_0x5950('0xe'));var Papa=require(_0x5950('0xf'));var Redis=require(_0x5950('0x10'));var authService=require(_0x5950('0x11'));var qs=require(_0x5950('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5950('0x13'));var logger=require(_0x5950('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x5950('0x15'));var licenseUtil=require(_0x5950('0x16'));var db=require(_0x5950('0x17'))['db'];function respondWithStatusCode(_0x5f0e26,_0x1a7df6){_0x1a7df6=_0x1a7df6||0xcc;return function(_0x2bf7ae){if(_0x2bf7ae){return _0x5f0e26[_0x5950('0x18')](_0x1a7df6);}return _0x5f0e26[_0x5950('0x19')](_0x1a7df6)[_0x5950('0x1a')]();};}function respondWithResult(_0x384e80,_0x40fe84){_0x40fe84=_0x40fe84||0xc8;return function(_0x3ace79){if(_0x3ace79){return _0x384e80[_0x5950('0x19')](_0x40fe84)[_0x5950('0x1b')](_0x3ace79);}};}function respondWithFilteredResult(_0x5e9dd5,_0xa6c598){return function(_0x4ad4d8){if(_0x4ad4d8){var _0x3c469d=typeof _0xa6c598[_0x5950('0x1c')]===_0x5950('0x1d')&&typeof _0xa6c598[_0x5950('0x1e')]==='undefined';var _0x5a99e8=_0x4ad4d8[_0x5950('0x1f')];var _0x40f50c=_0x3c469d?0x0:_0xa6c598[_0x5950('0x1c')];var _0x5a9530=_0x3c469d?_0x4ad4d8[_0x5950('0x1f')]:_0xa6c598['offset']+_0xa6c598['limit'];var _0x119f1f;if(_0x5a9530>=_0x5a99e8){_0x5a9530=_0x5a99e8;_0x119f1f=0xc8;}else{_0x119f1f=0xce;}_0x5e9dd5[_0x5950('0x19')](_0x119f1f);return _0x5e9dd5[_0x5950('0x20')]('Content-Range',_0x40f50c+'-'+_0x5a9530+'/'+_0x5a99e8)[_0x5950('0x1b')](_0x4ad4d8);}return null;};}function patchUpdates(_0x3ea879){return function(_0x4aa0c2){try{jsonpatch['apply'](_0x4aa0c2,_0x3ea879,!![]);}catch(_0x53fdfe){return BPromise['reject'](_0x53fdfe);}return _0x4aa0c2[_0x5950('0x21')]();};}function saveUpdates(_0x110a57,_0x66c416){return function(_0x388ad0){if(_0x388ad0){return _0x388ad0['update'](_0x110a57)[_0x5950('0x22')](function(_0x3c58f4){return _0x3c58f4;});}return null;};}function removeEntity(_0x255243,_0x1bd0ad){return function(_0x4757fd){if(_0x4757fd){return _0x4757fd[_0x5950('0x23')]()[_0x5950('0x22')](function(){_0x255243['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b2265,_0x32c197){return function(_0x545354){if(!_0x545354){_0x1b2265[_0x5950('0x18')](0x194);}return _0x545354;};}function handleError(_0x128241,_0x58167b){_0x58167b=_0x58167b||0x1f4;return function(_0x4a7b22){logger['error'](_0x4a7b22[_0x5950('0x24')]);if(_0x4a7b22[_0x5950('0x25')]){delete _0x4a7b22[_0x5950('0x25')];}_0x128241[_0x5950('0x19')](_0x58167b)[_0x5950('0x26')](_0x4a7b22);};}exports[_0x5950('0x27')]=function(_0x2ff8a3,_0x2dfd08){var _0x179b24={},_0x3a3cc0={},_0x24db8b={'count':0x0,'rows':[]};var _0x3ab143=_[_0x5950('0x28')](db[_0x5950('0x29')][_0x5950('0x2a')],function(_0x24fd58){return{'name':_0x24fd58[_0x5950('0x2b')],'type':_0x24fd58[_0x5950('0x2c')][_0x5950('0x2d')]};});_0x3a3cc0[_0x5950('0x2e')]=_[_0x5950('0x28')](_0x3ab143,_0x5950('0x25'));_0x3a3cc0[_0x5950('0x2f')]=_[_0x5950('0x30')](_0x2ff8a3[_0x5950('0x2f')]);_0x3a3cc0[_0x5950('0x31')]=_[_0x5950('0x32')](_0x3a3cc0[_0x5950('0x2e')],_0x3a3cc0['query']);_0x179b24[_0x5950('0x33')]=_[_0x5950('0x32')](_0x3a3cc0[_0x5950('0x2e')],qs[_0x5950('0x34')](_0x2ff8a3[_0x5950('0x2f')]['fields']));_0x179b24['attributes']=_0x179b24[_0x5950('0x33')][_0x5950('0x35')]?_0x179b24['attributes']:_0x3a3cc0[_0x5950('0x2e')];if(!_0x2ff8a3['query'][_0x5950('0x36')](_0x5950('0x37'))){_0x179b24[_0x5950('0x1e')]=qs['limit'](_0x2ff8a3[_0x5950('0x2f')]['limit']);_0x179b24[_0x5950('0x1c')]=qs[_0x5950('0x1c')](_0x2ff8a3[_0x5950('0x2f')][_0x5950('0x1c')]);}_0x179b24['order']=qs[_0x5950('0x38')](_0x2ff8a3[_0x5950('0x2f')][_0x5950('0x38')]);_0x179b24['where']=qs[_0x5950('0x31')](_[_0x5950('0x39')](_0x2ff8a3['query'],_0x3a3cc0['filters']),_0x3ab143);if(_0x2ff8a3['query'][_0x5950('0x3a')]){_0x179b24[_0x5950('0x3b')]=_[_0x5950('0x3c')](_0x179b24[_0x5950('0x3b')],{'$or':_[_0x5950('0x28')](_0x3ab143,function(_0x487f7e){if(_0x487f7e['type']!=='VIRTUAL'){var _0x4b534a={};_0x4b534a[_0x487f7e[_0x5950('0x25')]]={'$like':'%'+_0x2ff8a3[_0x5950('0x2f')][_0x5950('0x3a')]+'%'};return _0x4b534a;}})});}_0x179b24=_[_0x5950('0x3c')]({},_0x179b24,_0x2ff8a3['options']);var _0x3fef7e={'where':_0x179b24[_0x5950('0x3b')]};return db['JscriptyAnswerReport'][_0x5950('0x1f')](_0x3fef7e)[_0x5950('0x22')](function(_0x537141){_0x24db8b[_0x5950('0x1f')]=_0x537141;if(_0x2ff8a3[_0x5950('0x2f')][_0x5950('0x3d')]){_0x179b24[_0x5950('0x3e')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x5950('0x3f')](_0x179b24);})['then'](function(_0x27b4b2){_0x24db8b[_0x5950('0x40')]=_0x27b4b2;return _0x24db8b;})['then'](respondWithFilteredResult(_0x2dfd08,_0x179b24))[_0x5950('0x41')](handleError(_0x2dfd08,null));};exports[_0x5950('0x42')]=function(_0x3540d6,_0x2e9950){var _0x487a98={'raw':!![],'where':{'id':_0x3540d6[_0x5950('0x43')]['id']}},_0x18d31f={};_0x18d31f[_0x5950('0x2e')]=_[_0x5950('0x30')](db['JscriptyAnswerReport'][_0x5950('0x2a')]);_0x18d31f[_0x5950('0x2f')]=_[_0x5950('0x30')](_0x3540d6['query']);_0x18d31f[_0x5950('0x31')]=_['intersection'](_0x18d31f[_0x5950('0x2e')],_0x18d31f[_0x5950('0x2f')]);_0x487a98[_0x5950('0x33')]=_[_0x5950('0x32')](_0x18d31f[_0x5950('0x2e')],qs[_0x5950('0x34')](_0x3540d6[_0x5950('0x2f')]['fields']));_0x487a98[_0x5950('0x33')]=_0x487a98[_0x5950('0x33')][_0x5950('0x35')]?_0x487a98[_0x5950('0x33')]:_0x18d31f[_0x5950('0x2e')];if(_0x3540d6['query']['includeAll']){_0x487a98[_0x5950('0x3e')]=[{'all':!![]}];}_0x487a98=_[_0x5950('0x3c')]({},_0x487a98,_0x3540d6[_0x5950('0x44')]);return db['JscriptyAnswerReport'][_0x5950('0x45')](_0x487a98)[_0x5950('0x22')](handleEntityNotFound(_0x2e9950,null))[_0x5950('0x22')](respondWithResult(_0x2e9950,null))['catch'](handleError(_0x2e9950,null));};exports['create']=function(_0x49f202,_0x19eb55){return db[_0x5950('0x29')][_0x5950('0x46')](_0x49f202[_0x5950('0x47')],{})[_0x5950('0x22')](respondWithResult(_0x19eb55,0xc9))[_0x5950('0x41')](handleError(_0x19eb55,null));};exports[_0x5950('0x48')]=function(_0x18c744,_0x25d749){if(_0x18c744['body']['id']){delete _0x18c744[_0x5950('0x47')]['id'];}return db[_0x5950('0x29')][_0x5950('0x45')]({'where':{'id':_0x18c744[_0x5950('0x43')]['id']}})[_0x5950('0x22')](handleEntityNotFound(_0x25d749,null))[_0x5950('0x22')](saveUpdates(_0x18c744[_0x5950('0x47')],null))[_0x5950('0x22')](respondWithResult(_0x25d749,null))[_0x5950('0x41')](handleError(_0x25d749,null));};exports[_0x5950('0x23')]=function(_0x5a8c22,_0x5aaa8){return db[_0x5950('0x29')][_0x5950('0x45')]({'where':{'id':_0x5a8c22[_0x5950('0x43')]['id']}})['then'](handleEntityNotFound(_0x5aaa8,null))['then'](removeEntity(_0x5aaa8,null))[_0x5950('0x41')](handleError(_0x5aaa8,null));};exports[_0x5950('0x49')]=function(_0x4a40b3,_0x2aff57){return db[_0x5950('0x29')][_0x5950('0x49')]()[_0x5950('0x22')](respondWithResult(_0x2aff57,null))[_0x5950('0x41')](handleError(_0x2aff57,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index f8879c6..beeee7a 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 _0x42d1=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash'];(function(_0x210f01,_0x1a83b5){var _0x1631e9=function(_0x40d63f){while(--_0x40d63f){_0x210f01['push'](_0x210f01['shift']());}};_0x1631e9(++_0x1a83b5);}(_0x42d1,0x187));var _0x142d=function(_0x5ddda9,_0x43e558){_0x5ddda9=_0x5ddda9-0x0;var _0x53a004=_0x42d1[_0x5ddda9];return _0x53a004;};'use strict';var _=require(_0x142d('0x0'));var util=require(_0x142d('0x1'));var logger=require(_0x142d('0x2'))(_0x142d('0x3'));var moment=require(_0x142d('0x4'));var BPromise=require(_0x142d('0x5'));var rp=require(_0x142d('0x6'));var fs=require('fs');var path=require(_0x142d('0x7'));var rimraf=require(_0x142d('0x8'));var config=require(_0x142d('0x9'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x142d('0xa')]=function(_0x496efc,_0x28c1d8){return _0x496efc[_0x142d('0xb')](_0x142d('0xc'),attributes,{'tableName':_0x142d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ab5=['bluebird','path','rimraf','../../config/environment','exports','define','JscriptyAnswerReport','util','../../config/logger','moment'];(function(_0x4818e9,_0x55551f){var _0x1c8338=function(_0x34ce26){while(--_0x34ce26){_0x4818e9['push'](_0x4818e9['shift']());}};_0x1c8338(++_0x55551f);}(_0x3ab5,0x1ab));var _0x53ab=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x3ab5[_0x5b561d];return _0x431060;};'use strict';var _=require('lodash');var util=require(_0x53ab('0x0'));var logger=require(_0x53ab('0x1'))('api');var moment=require(_0x53ab('0x2'));var BPromise=require(_0x53ab('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x53ab('0x4'));var rimraf=require(_0x53ab('0x5'));var config=require(_0x53ab('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x53ab('0x7')]=function(_0x1a9af5,_0x3672af){return _0x1a9af5[_0x53ab('0x8')](_0x53ab('0x9'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 6f34b42..9a78e52 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 _0x15ce=['message','result','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x15ce,0x132));var _0xe15c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x15ce[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe15c('0x0'));var BPromise=require('bluebird');var rs=require(_0xe15c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe15c('0x2'))['db'];var utils=require(_0xe15c('0x3'));var logger=require(_0xe15c('0x4'))(_0xe15c('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe15c('0x6')][_0xe15c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5286e0,_0x29e753,_0x1fc65e){return new BPromise(function(_0x25a710,_0x56448a){return client[_0xe15c('0x8')](_0x5286e0,_0x1fc65e)['then'](function(_0x3467cb){logger[_0xe15c('0x9')](_0xe15c('0xa'),_0x29e753,_0xe15c('0xb'));logger[_0xe15c('0xc')](_0xe15c('0xd'),_0x29e753,_0xe15c('0xb'),JSON[_0xe15c('0xe')](_0x3467cb));if(_0x3467cb['error']){if(_0x3467cb['error'][_0xe15c('0xf')]===0x1f4){logger[_0xe15c('0x10')](_0xe15c('0xa'),_0x29e753,_0x3467cb['error'][_0xe15c('0x11')]);return _0x56448a(_0x3467cb[_0xe15c('0x10')]['message']);}logger[_0xe15c('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x29e753,_0x3467cb[_0xe15c('0x10')][_0xe15c('0x11')]);return _0x25a710(_0x3467cb[_0xe15c('0x10')][_0xe15c('0x11')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x29e753,'request\x20sent');_0x25a710(_0x3467cb[_0xe15c('0x12')][_0xe15c('0x11')]);}})['catch'](function(_0x11abca){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x29e753,_0x11abca);_0x56448a(_0x11abca);});});} \ No newline at end of file +var _0x81f1=['JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','request','info','JscriptyAnswerReport,\x20%s,\x20%s','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x81f1,0x12e));var _0x181f=function(_0x49114c,_0x52691a){_0x49114c=_0x49114c-0x0;var _0x2dc558=_0x81f1[_0x49114c];return _0x2dc558;};'use strict';var _=require(_0x181f('0x0'));var util=require(_0x181f('0x1'));var moment=require(_0x181f('0x2'));var BPromise=require(_0x181f('0x3'));var rs=require(_0x181f('0x4'));var fs=require('fs');var Redis=require(_0x181f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x181f('0x6'));var logger=require('../../config/logger')(_0x181f('0x7'));var config=require(_0x181f('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c7bb2,_0x238223,_0x45efc0){return new BPromise(function(_0x4da494,_0xf99901){return client[_0x181f('0x9')](_0x2c7bb2,_0x45efc0)['then'](function(_0x41d94b){logger[_0x181f('0xa')](_0x181f('0xb'),_0x238223,'request\x20sent');logger[_0x181f('0xc')](_0x181f('0xd'),_0x238223,_0x181f('0xe'),JSON[_0x181f('0xf')](_0x41d94b));if(_0x41d94b['error']){if(_0x41d94b[_0x181f('0x10')][_0x181f('0x11')]===0x1f4){logger[_0x181f('0x10')](_0x181f('0xb'),_0x238223,_0x41d94b['error'][_0x181f('0x12')]);return _0xf99901(_0x41d94b[_0x181f('0x10')][_0x181f('0x12')]);}logger[_0x181f('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x238223,_0x41d94b[_0x181f('0x10')]['message']);return _0x4da494(_0x41d94b['error'][_0x181f('0x12')]);}else{logger['info'](_0x181f('0xb'),_0x238223,_0x181f('0xe'));_0x4da494(_0x41d94b[_0x181f('0x13')]['message']);}})[_0x181f('0x14')](function(_0x371cb2){logger[_0x181f('0x10')](_0x181f('0xb'),_0x238223,_0x371cb2);_0xf99901(_0x371cb2);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index dead7be..fc8b3cc 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 _0xe139=['clone','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','/:id/sessions','getAnswers','post','create'];(function(_0x458ac1,_0x16e20c){var _0x430f0f=function(_0x51fc6f){while(--_0x51fc6f){_0x458ac1['push'](_0x458ac1['shift']());}};_0x430f0f(++_0x16e20c);}(_0xe139,0x163));var _0x9e13=function(_0x4d1a1e,_0x3cf394){_0x4d1a1e=_0x4d1a1e-0x0;var _0x354539=_0xe139[_0x4d1a1e];return _0x354539;};'use strict';var multer=require(_0x9e13('0x0'));var util=require(_0x9e13('0x1'));var path=require(_0x9e13('0x2'));var timeout=require(_0x9e13('0x3'));var express=require(_0x9e13('0x4'));var router=express[_0x9e13('0x5')]();var fs_extra=require(_0x9e13('0x6'));var auth=require(_0x9e13('0x7'));var interaction=require(_0x9e13('0x8'));var config=require(_0x9e13('0x9'));var controller=require(_0x9e13('0xa'));router[_0x9e13('0xb')]('/',auth['isAuthenticated'](),controller[_0x9e13('0xc')]);router[_0x9e13('0xb')](_0x9e13('0xd'),auth[_0x9e13('0xe')](),controller[_0x9e13('0xf')]);router[_0x9e13('0xb')](_0x9e13('0x10'),auth['isAuthenticated'](),controller['getSessions']);router[_0x9e13('0xb')]('/:id/answers',auth[_0x9e13('0xe')](),controller[_0x9e13('0x11')]);router[_0x9e13('0xb')]('/:id/summary',auth[_0x9e13('0xe')](),timeout('30s'),controller['getSummary']);router[_0x9e13('0x12')]('/',auth['isAuthenticated'](),controller[_0x9e13('0x13')]);router[_0x9e13('0x12')]('/:id/clone',auth['isAuthenticated'](),controller[_0x9e13('0x14')]);router[_0x9e13('0x15')](_0x9e13('0xd'),auth[_0x9e13('0xe')](),controller[_0x9e13('0x16')]);router['delete'](_0x9e13('0xd'),auth['isAuthenticated'](),controller[_0x9e13('0x17')]);module[_0x9e13('0x18')]=router; \ No newline at end of file +var _0xeccb=['/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','create','post','/:id/clone','update','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4b0cec,_0x3b1c8b){var _0x15d2c5=function(_0x196651){while(--_0x196651){_0x4b0cec['push'](_0x4b0cec['shift']());}};_0x15d2c5(++_0x3b1c8b);}(_0xeccb,0x175));var _0xbecc=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xeccb[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0xbecc('0x0'));var util=require(_0xbecc('0x1'));var path=require(_0xbecc('0x2'));var timeout=require(_0xbecc('0x3'));var express=require('express');var router=express[_0xbecc('0x4')]();var fs_extra=require(_0xbecc('0x5'));var auth=require(_0xbecc('0x6'));var interaction=require(_0xbecc('0x7'));var config=require(_0xbecc('0x8'));var controller=require('./jscriptyProject.controller');router[_0xbecc('0x9')]('/',auth[_0xbecc('0xa')](),controller['index']);router[_0xbecc('0x9')](_0xbecc('0xb'),auth[_0xbecc('0xa')](),controller[_0xbecc('0xc')]);router[_0xbecc('0x9')](_0xbecc('0xd'),auth['isAuthenticated'](),controller[_0xbecc('0xe')]);router['get'](_0xbecc('0xf'),auth[_0xbecc('0xa')](),controller[_0xbecc('0x10')]);router['get'](_0xbecc('0x11'),auth[_0xbecc('0xa')](),timeout(_0xbecc('0x12')),controller['getSummary']);router['post']('/',auth[_0xbecc('0xa')](),controller[_0xbecc('0x13')]);router[_0xbecc('0x14')](_0xbecc('0x15'),auth[_0xbecc('0xa')](),controller['clone']);router['put'](_0xbecc('0xb'),auth[_0xbecc('0xa')](),controller[_0xbecc('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xbecc('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index dcbc8a7..7524a77 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 _0x7ca9=['exports','STRING','name','long','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','util'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0x7ca9,0x16a));var _0x97ca=function(_0x4d69d9,_0x4c1451){_0x4d69d9=_0x4d69d9-0x0;var _0x4fcf1e=_0x7ca9[_0x4d69d9];return _0x4fcf1e;};'use strict';var Sequelize=require(_0x97ca('0x0'));var _=require('lodash');var util=require(_0x97ca('0x1'));module[_0x97ca('0x2')]={'name':{'type':Sequelize[_0x97ca('0x3')],'unique':_0x97ca('0x4')},'description':{'type':Sequelize[_0x97ca('0x3')]},'formData':{'type':Sequelize['TEXT'](_0x97ca('0x5')),'set':function(_0x2fcdb5){if(_['isObjectLike'](_0x2fcdb5)){this[_0x97ca('0x6')](_0x97ca('0x7'),JSON[_0x97ca('0x8')](_0x2fcdb5));}else if(_[_0x97ca('0x9')](_0x2fcdb5)){this[_0x97ca('0x6')]('formData',_0x2fcdb5);}else{this[_0x97ca('0x6')]('formData',util[_0x97ca('0xa')](_0x97ca('0xb'),this[_0x97ca('0xc')]('name')||'',this[_0x97ca('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x97ca('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x97ca('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0xa2b1=['name','STRING','TEXT','long','isObjectLike','formData','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','util'];(function(_0x3bca95,_0x4c9622){var _0x4225cb=function(_0x19451c){while(--_0x19451c){_0x3bca95['push'](_0x3bca95['shift']());}};_0x4225cb(++_0x4c9622);}(_0xa2b1,0x86));var _0x1a2b=function(_0x37de67,_0x167daa){_0x37de67=_0x37de67-0x0;var _0x5ea429=_0xa2b1[_0x37de67];return _0x5ea429;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0x1a2b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x1a2b('0x1')},'description':{'type':Sequelize[_0x1a2b('0x2')]},'formData':{'type':Sequelize[_0x1a2b('0x3')](_0x1a2b('0x4')),'set':function(_0x5ded77){if(_[_0x1a2b('0x5')](_0x5ded77)){this['setDataValue'](_0x1a2b('0x6'),JSON[_0x1a2b('0x7')](_0x5ded77));}else if(_[_0x1a2b('0x8')](_0x5ded77)){this[_0x1a2b('0x9')](_0x1a2b('0x6'),_0x5ded77);}else{this[_0x1a2b('0x9')](_0x1a2b('0x6'),util[_0x1a2b('0xa')](_0x1a2b('0xb'),this[_0x1a2b('0xc')]('name')||'',this[_0x1a2b('0xc')](_0x1a2b('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x1a2b('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index f6ca22f..cfef04f 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 _0x78e2=['rawAttributes','intersection','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','JscriptySessionReport','pick','ProjectId','include','getAnswers','JscriptyAnswerReport','order','number','toString','indexOf','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','format','Content-type','text/csv','download','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','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','error','stack','name','index','JscriptyProject','type','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params'];(function(_0x675c90,_0x20d7a9){var _0x5c495d=function(_0x377ba){while(--_0x377ba){_0x675c90['push'](_0x675c90['shift']());}};_0x5c495d(++_0x20d7a9);}(_0x78e2,0x1a8));var _0x278e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78e2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x278e('0x0'));var rimraf=require(_0x278e('0x1'));var zipdir=require(_0x278e('0x2'));var jsonpatch=require(_0x278e('0x3'));var rp=require(_0x278e('0x4'));var moment=require('moment');var BPromise=require(_0x278e('0x5'));var Mustache=require('mustache');var util=require(_0x278e('0x6'));var path=require(_0x278e('0x7'));var sox=require(_0x278e('0x8'));var csv=require(_0x278e('0x9'));var ejs=require(_0x278e('0xa'));var fs=require('fs');var fs_extra=require(_0x278e('0xb'));var _=require(_0x278e('0xc'));var squel=require(_0x278e('0xd'));var crypto=require(_0x278e('0xe'));var jsforce=require(_0x278e('0xf'));var deskjs=require(_0x278e('0x10'));var toCsv=require(_0x278e('0x9'));var querystring=require(_0x278e('0x11'));var Papa=require(_0x278e('0x12'));var Redis=require(_0x278e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x278e('0x14'));var as=require(_0x278e('0x15'));var hardwareService=require(_0x278e('0x16'));var logger=require(_0x278e('0x17'))(_0x278e('0x18'));var utils=require(_0x278e('0x19'));var config=require(_0x278e('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x278e('0x1b'))['db'];function respondWithStatusCode(_0x3f2a66,_0x4fe711){_0x4fe711=_0x4fe711||0xcc;return function(_0x2bfe2b){if(_0x2bfe2b){return _0x3f2a66['sendStatus'](_0x4fe711);}return _0x3f2a66[_0x278e('0x1c')](_0x4fe711)['end']();};}function respondWithResult(_0x580b58,_0x4503ba){_0x4503ba=_0x4503ba||0xc8;return function(_0x108ce5){if(_0x108ce5){return _0x580b58['status'](_0x4503ba)['json'](_0x108ce5);}};}function respondWithFilteredResult(_0x43f659,_0x15be55){return function(_0x58f1ec){if(_0x58f1ec){var _0x1b6300=typeof _0x15be55[_0x278e('0x1d')]==='undefined'&&typeof _0x15be55[_0x278e('0x1e')]===_0x278e('0x1f');var _0x2cc807=_0x58f1ec['count'];var _0x381cc9=_0x1b6300?0x0:_0x15be55[_0x278e('0x1d')];var _0x58a511=_0x1b6300?_0x58f1ec[_0x278e('0x20')]:_0x15be55[_0x278e('0x1d')]+_0x15be55[_0x278e('0x1e')];var _0x4b66a9;if(_0x58a511>=_0x2cc807){_0x58a511=_0x2cc807;_0x4b66a9=0xc8;}else{_0x4b66a9=0xce;}_0x43f659[_0x278e('0x1c')](_0x4b66a9);return _0x43f659[_0x278e('0x21')](_0x278e('0x22'),_0x381cc9+'-'+_0x58a511+'/'+_0x2cc807)[_0x278e('0x23')](_0x58f1ec);}return null;};}function patchUpdates(_0x576470){return function(_0x380a10){try{jsonpatch[_0x278e('0x24')](_0x380a10,_0x576470,!![]);}catch(_0x5c0920){return BPromise[_0x278e('0x25')](_0x5c0920);}return _0x380a10[_0x278e('0x26')]();};}function saveUpdates(_0x2f4e73,_0x9562e3){return function(_0x461d37){if(_0x461d37){return _0x461d37[_0x278e('0x27')](_0x2f4e73)[_0x278e('0x28')](function(_0x30262f){return _0x30262f;});}return null;};}function removeEntity(_0x1dbc09,_0x269148){return function(_0x3c5de5){if(_0x3c5de5){return _0x3c5de5[_0x278e('0x29')]()['then'](function(){var _0x57054f=_0x3c5de5['get']({'plain':!![]});var _0x42bccd='Projects';return db[_0x278e('0x2a')][_0x278e('0x29')]({'where':{'type':_0x42bccd,'resourceId':_0x57054f['id']}})[_0x278e('0x28')](function(){return _0x3c5de5;});})[_0x278e('0x28')](function(){_0x1dbc09[_0x278e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b2f0b,_0x15b8e6){return function(_0x14fbc0){if(!_0x14fbc0){_0x2b2f0b[_0x278e('0x2b')](0x194);}return _0x14fbc0;};}function handleError(_0x50cc81,_0x370151){_0x370151=_0x370151||0x1f4;return function(_0x1b91d9){logger[_0x278e('0x2c')](_0x1b91d9[_0x278e('0x2d')]);if(_0x1b91d9[_0x278e('0x2e')]){delete _0x1b91d9[_0x278e('0x2e')];}_0x50cc81[_0x278e('0x1c')](_0x370151)['send'](_0x1b91d9);};}exports[_0x278e('0x2f')]=function(_0x319043,_0x302eec){var _0x3f3c79={},_0x47a14c={},_0x4c5dfd={'count':0x0,'rows':[]};var _0x48b0ad=_['map'](db[_0x278e('0x30')]['rawAttributes'],function(_0x307941){return{'name':_0x307941['fieldName'],'type':_0x307941[_0x278e('0x31')][_0x278e('0x32')]};});_0x47a14c[_0x278e('0x33')]=_[_0x278e('0x34')](_0x48b0ad,'name');_0x47a14c[_0x278e('0x35')]=_[_0x278e('0x36')](_0x319043[_0x278e('0x35')]);_0x47a14c[_0x278e('0x37')]=_['intersection'](_0x47a14c[_0x278e('0x33')],_0x47a14c[_0x278e('0x35')]);_0x3f3c79[_0x278e('0x38')]=_['intersection'](_0x47a14c['model'],qs['fields'](_0x319043[_0x278e('0x35')][_0x278e('0x39')]));_0x3f3c79[_0x278e('0x38')]=_0x3f3c79[_0x278e('0x38')]['length']?_0x3f3c79[_0x278e('0x38')]:_0x47a14c['model'];if(!_0x319043[_0x278e('0x35')][_0x278e('0x3a')](_0x278e('0x3b'))){_0x3f3c79[_0x278e('0x1e')]=qs[_0x278e('0x1e')](_0x319043['query'][_0x278e('0x1e')]);_0x3f3c79[_0x278e('0x1d')]=qs[_0x278e('0x1d')](_0x319043[_0x278e('0x35')][_0x278e('0x1d')]);}_0x3f3c79['order']=qs[_0x278e('0x3c')](_0x319043[_0x278e('0x35')][_0x278e('0x3c')]);_0x3f3c79[_0x278e('0x3d')]=qs[_0x278e('0x37')](_['pick'](_0x319043[_0x278e('0x35')],_0x47a14c[_0x278e('0x37')]),_0x48b0ad);if(_0x319043[_0x278e('0x35')]['filter']){_0x3f3c79[_0x278e('0x3d')]=_['merge'](_0x3f3c79['where'],{'$or':_[_0x278e('0x34')](_0x48b0ad,function(_0x546bda){if(_0x546bda[_0x278e('0x31')]!==_0x278e('0x3e')){var _0x1bb9b9={};_0x1bb9b9[_0x546bda['name']]={'$like':'%'+_0x319043[_0x278e('0x35')][_0x278e('0x3f')]+'%'};return _0x1bb9b9;}})});}_0x3f3c79=_[_0x278e('0x40')]({},_0x3f3c79,_0x319043[_0x278e('0x41')]);var _0x410259={'where':_0x3f3c79['where']};return db['JscriptyProject'][_0x278e('0x20')](_0x410259)['then'](function(_0x34b3ba){_0x4c5dfd['count']=_0x34b3ba;if(_0x319043[_0x278e('0x35')][_0x278e('0x42')]){_0x3f3c79['include']=[{'all':!![]}];}return db[_0x278e('0x30')][_0x278e('0x43')](_0x3f3c79);})[_0x278e('0x28')](function(_0x8d48f5){_0x4c5dfd[_0x278e('0x44')]=_0x8d48f5;return _0x4c5dfd;})[_0x278e('0x28')](respondWithFilteredResult(_0x302eec,_0x3f3c79))[_0x278e('0x45')](handleError(_0x302eec,null));};exports[_0x278e('0x46')]=function(_0x3cde01,_0x1e2d70){var _0x24d696={'raw':![],'where':{'id':_0x3cde01[_0x278e('0x47')]['id']}},_0x285490={};_0x285490[_0x278e('0x33')]=_[_0x278e('0x36')](db[_0x278e('0x30')][_0x278e('0x48')]);_0x285490[_0x278e('0x35')]=_['keys'](_0x3cde01['query']);_0x285490[_0x278e('0x37')]=_['intersection'](_0x285490[_0x278e('0x33')],_0x285490[_0x278e('0x35')]);_0x24d696[_0x278e('0x38')]=_[_0x278e('0x49')](_0x285490[_0x278e('0x33')],qs[_0x278e('0x39')](_0x3cde01[_0x278e('0x35')][_0x278e('0x39')]));_0x24d696[_0x278e('0x38')]=_0x24d696[_0x278e('0x38')][_0x278e('0x4a')]?_0x24d696[_0x278e('0x38')]:_0x285490[_0x278e('0x33')];if(_0x3cde01[_0x278e('0x35')][_0x278e('0x42')]){_0x24d696['include']=[{'all':!![]}];}_0x24d696=_[_0x278e('0x40')]({},_0x24d696,_0x3cde01[_0x278e('0x41')]);return db[_0x278e('0x30')][_0x278e('0x4b')](_0x24d696)[_0x278e('0x28')](handleEntityNotFound(_0x1e2d70,null))[_0x278e('0x28')](respondWithResult(_0x1e2d70,null))[_0x278e('0x45')](handleError(_0x1e2d70,null));};exports[_0x278e('0x4c')]=function(_0x12411f,_0x2e7c86){return db[_0x278e('0x30')][_0x278e('0x4c')](_0x12411f[_0x278e('0x4d')],{})[_0x278e('0x28')](function(_0x37cf1e){var _0x58b996=_0x12411f[_0x278e('0x4e')][_0x278e('0x4f')]({'plain':!![]});if(!_0x58b996)throw new Error(_0x278e('0x50'));if(_0x58b996['role']===_0x278e('0x4e')){var _0xd5a35b=_0x37cf1e[_0x278e('0x4f')]({'plain':!![]});var _0x4c2c43=_0x278e('0x51');return db[_0x278e('0x52')]['find']({'where':{'name':_0x4c2c43,'userProfileId':_0x58b996[_0x278e('0x53')]},'raw':!![]})['then'](function(_0x19d658){if(_0x19d658&&_0x19d658[_0x278e('0x54')]===0x0){return db['UserProfileResource'][_0x278e('0x4c')]({'name':_0xd5a35b['name'],'resourceId':_0xd5a35b['id'],'type':_0x19d658[_0x278e('0x2e')],'sectionId':_0x19d658['id']},{})['then'](function(){return _0x37cf1e;});}else{return _0x37cf1e;}})[_0x278e('0x45')](function(_0x115d7a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x115d7a);throw _0x115d7a;});}return _0x37cf1e;})[_0x278e('0x28')](respondWithResult(_0x2e7c86,0xc9))[_0x278e('0x45')](handleError(_0x2e7c86,null));};exports[_0x278e('0x55')]=function(_0x32b77f,_0x2115dd){var _0x36a696={'where':{'id':_0x32b77f[_0x278e('0x47')]['id']}},_0x9dbc55={};_0x9dbc55['model']=_[_0x278e('0x36')](db[_0x278e('0x30')]['rawAttributes']);_0x36a696[_0x278e('0x38')]=_[_0x278e('0x49')](_0x9dbc55[_0x278e('0x33')],qs['fields'](_0x32b77f['query'][_0x278e('0x39')]));_0x36a696[_0x278e('0x38')]=_0x36a696[_0x278e('0x38')][_0x278e('0x4a')]?_0x36a696['attributes']:_0x9dbc55[_0x278e('0x33')];if(_0x32b77f[_0x278e('0x35')]['includeAll']){_0x36a696['include']=[{'all':!![]}];}_0x36a696=_[_0x278e('0x40')]({},_0x36a696,_0x32b77f[_0x278e('0x41')]);return db[_0x278e('0x30')][_0x278e('0x4b')](_0x36a696)[_0x278e('0x28')](handleEntityNotFound(_0x2115dd,null))[_0x278e('0x28')](function(_0x467bf2){if(_0x467bf2){var _0x292ecc=_0x467bf2[_0x278e('0x4f')]({'plain':!![]});_0x292ecc=qs[_0x278e('0x56')](_0x292ecc,['id',_0x278e('0x57'),'updatedAt']);_0x32b77f['body']=_['omit'](_0x32b77f[_0x278e('0x4d')],['id',_0x278e('0x57'),_0x278e('0x58')]);return db[_0x278e('0x30')][_0x278e('0x4c')](_[_0x278e('0x40')](_0x292ecc,_0x32b77f[_0x278e('0x4d')]),{'include':_0x32b77f[_0x278e('0x35')][_0x278e('0x42')]?[{'all':!![]}]:undefined})[_0x278e('0x28')](function(_0x11c639){var _0x3e6992=_0x32b77f[_0x278e('0x4e')][_0x278e('0x4f')]({'plain':!![]});if(!_0x3e6992)throw new Error(_0x278e('0x50'));if(_0x3e6992[_0x278e('0x59')]===_0x278e('0x4e')){var _0x28bfa3=_0x11c639[_0x278e('0x4f')]({'plain':!![]});var _0xf07224=_0x278e('0x51');return db[_0x278e('0x52')][_0x278e('0x4b')]({'where':{'name':_0xf07224,'userProfileId':_0x3e6992['userProfileId']},'raw':!![]})[_0x278e('0x28')](function(_0x46574a){if(_0x46574a&&_0x46574a['autoAssociation']===0x0){return db[_0x278e('0x2a')]['create']({'name':_0x28bfa3['name'],'resourceId':_0x28bfa3['id'],'type':_0x46574a['name'],'sectionId':_0x46574a['id']},{})[_0x278e('0x28')](function(){return _0x11c639;});}else{return _0x11c639;}})['catch'](function(_0x1152f6){logger[_0x278e('0x2c')](_0x278e('0x5a'),_0x1152f6);throw _0x1152f6;});}return _0x11c639;});}})['then'](respondWithResult(_0x2115dd,0xc9))[_0x278e('0x45')](handleError(_0x2115dd,null));};exports[_0x278e('0x27')]=function(_0x2ab62e,_0xe8e420){if(_0x2ab62e[_0x278e('0x4d')]['id']){delete _0x2ab62e[_0x278e('0x4d')]['id'];}return db[_0x278e('0x30')][_0x278e('0x4b')]({'where':{'id':_0x2ab62e[_0x278e('0x47')]['id']}})['then'](handleEntityNotFound(_0xe8e420,null))[_0x278e('0x28')](saveUpdates(_0x2ab62e[_0x278e('0x4d')],null))[_0x278e('0x28')](respondWithResult(_0xe8e420,null))[_0x278e('0x45')](handleError(_0xe8e420,null));};exports['destroy']=function(_0x9e9199,_0x231437){return db[_0x278e('0x30')][_0x278e('0x4b')]({'where':{'id':_0x9e9199[_0x278e('0x47')]['id']}})[_0x278e('0x28')](handleEntityNotFound(_0x231437,null))[_0x278e('0x28')](removeEntity(_0x231437,null))[_0x278e('0x45')](handleError(_0x231437,null));};exports['getSessions']=function(_0x28cee6,_0x473edf,_0x5d82c8){var _0x51fcd4={'raw':!![],'where':{}};var _0x3fa9b4={};var _0xf82bf6={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x278e('0x5b')]({'where':{'id':_0x28cee6[_0x278e('0x47')]['id']}})[_0x278e('0x28')](handleEntityNotFound(_0x473edf,null))['then'](function(_0x3516b3){if(_0x3516b3){_0x3fa9b4[_0x278e('0x33')]=_[_0x278e('0x36')](db[_0x278e('0x5c')]['rawAttributes']);_0x3fa9b4[_0x278e('0x35')]=_[_0x278e('0x36')](_0x28cee6[_0x278e('0x35')]);_0x3fa9b4[_0x278e('0x37')]=_[_0x278e('0x49')](_0x3fa9b4[_0x278e('0x33')],_0x3fa9b4[_0x278e('0x35')]);_0x51fcd4[_0x278e('0x38')]=_[_0x278e('0x49')](_0x3fa9b4[_0x278e('0x33')],qs['fields'](_0x28cee6['query'][_0x278e('0x39')]));_0x51fcd4[_0x278e('0x38')]=_0x51fcd4[_0x278e('0x38')][_0x278e('0x4a')]?_0x51fcd4['attributes']:_0x3fa9b4['model'];if(!_0x28cee6[_0x278e('0x35')][_0x278e('0x3a')](_0x278e('0x3b'))){_0x51fcd4[_0x278e('0x1e')]=qs[_0x278e('0x1e')](_0x28cee6['query'][_0x278e('0x1e')]);_0x51fcd4[_0x278e('0x1d')]=qs['offset'](_0x28cee6[_0x278e('0x35')][_0x278e('0x1d')]);}_0x51fcd4['order']=qs['sort'](_0x28cee6[_0x278e('0x35')]['sort']);_0x51fcd4[_0x278e('0x3d')]=qs[_0x278e('0x37')](_[_0x278e('0x5d')](_0x28cee6[_0x278e('0x35')],_0x3fa9b4[_0x278e('0x37')]));_0x51fcd4[_0x278e('0x3d')][_0x278e('0x5e')]=_0x3516b3['id'];if(_0x28cee6['query'][_0x278e('0x3f')]){_0x51fcd4[_0x278e('0x3d')]=_[_0x278e('0x40')](_0x51fcd4['where'],{'$or':_[_0x278e('0x34')](_0x51fcd4[_0x278e('0x38')],function(_0x656864){var _0x304639={};_0x304639[_0x656864]={'$like':'%'+_0x28cee6[_0x278e('0x35')]['filter']+'%'};return _0x304639;})});}_0x51fcd4=_[_0x278e('0x40')]({},_0x51fcd4,_0x28cee6[_0x278e('0x41')]);return db[_0x278e('0x5c')][_0x278e('0x20')]({'where':_0x51fcd4[_0x278e('0x3d')]})[_0x278e('0x28')](function(_0x325681){_0xf82bf6[_0x278e('0x20')]=_0x325681;if(_0x28cee6[_0x278e('0x35')][_0x278e('0x42')]){_0x51fcd4[_0x278e('0x5f')]=[{'all':!![]}];}return db[_0x278e('0x5c')]['findAll'](_0x51fcd4);})['then'](function(_0x593b21){_0xf82bf6[_0x278e('0x44')]=_0x593b21;return _0xf82bf6;});}})[_0x278e('0x28')](respondWithFilteredResult(_0x473edf,_0x51fcd4))[_0x278e('0x45')](handleError(_0x473edf,null));};exports[_0x278e('0x60')]=function(_0x492382,_0x29be6f,_0x5a1c56){var _0x3f516a={'raw':!![],'where':{}};var _0x3f176e={};var _0xb3e777={'count':0x0,'rows':[]};return db[_0x278e('0x30')][_0x278e('0x5b')]({'where':{'id':_0x492382[_0x278e('0x47')]['id']}})[_0x278e('0x28')](handleEntityNotFound(_0x29be6f,null))['then'](function(_0x787373){if(_0x787373){_0x3f176e[_0x278e('0x33')]=_[_0x278e('0x36')](db[_0x278e('0x61')][_0x278e('0x48')]);_0x3f176e['query']=_['keys'](_0x492382['query']);_0x3f176e['filters']=_['intersection'](_0x3f176e[_0x278e('0x33')],_0x3f176e[_0x278e('0x35')]);_0x3f516a[_0x278e('0x38')]=_[_0x278e('0x49')](_0x3f176e[_0x278e('0x33')],qs[_0x278e('0x39')](_0x492382['query'][_0x278e('0x39')]));_0x3f516a[_0x278e('0x38')]=_0x3f516a[_0x278e('0x38')]['length']?_0x3f516a[_0x278e('0x38')]:_0x3f176e[_0x278e('0x33')];if(!_0x492382[_0x278e('0x35')][_0x278e('0x3a')](_0x278e('0x3b'))){_0x3f516a['limit']=qs['limit'](_0x492382[_0x278e('0x35')][_0x278e('0x1e')]);_0x3f516a[_0x278e('0x1d')]=qs[_0x278e('0x1d')](_0x492382[_0x278e('0x35')][_0x278e('0x1d')]);}_0x3f516a[_0x278e('0x62')]=qs[_0x278e('0x3c')](_0x492382['query'][_0x278e('0x3c')]);_0x3f516a[_0x278e('0x3d')]=qs['filters'](_[_0x278e('0x5d')](_0x492382['query'],_0x3f176e[_0x278e('0x37')]));_0x3f516a[_0x278e('0x3d')][_0x278e('0x5e')]=_0x787373['id'];if(_0x492382[_0x278e('0x35')]['filter']){_0x3f516a[_0x278e('0x3d')]=_[_0x278e('0x40')](_0x3f516a[_0x278e('0x3d')],{'$or':_[_0x278e('0x34')](_0x3f516a[_0x278e('0x38')],function(_0x17d9ca){var _0x43916d={};_0x43916d[_0x17d9ca]={'$like':'%'+_0x492382[_0x278e('0x35')][_0x278e('0x3f')]+'%'};return _0x43916d;})});}_0x3f516a=_[_0x278e('0x40')]({},_0x3f516a,_0x492382[_0x278e('0x41')]);return db[_0x278e('0x61')][_0x278e('0x20')]({'where':_0x3f516a[_0x278e('0x3d')]})['then'](function(_0x47e97d){_0xb3e777[_0x278e('0x20')]=_0x47e97d;if(_0x492382[_0x278e('0x35')]['includeAll']){_0x3f516a['include']=[{'all':!![]}];}return db[_0x278e('0x61')]['findAll'](_0x3f516a);})[_0x278e('0x28')](function(_0x1bbb9b){_0xb3e777[_0x278e('0x44')]=_0x1bbb9b;return _0xb3e777;});}})[_0x278e('0x28')](respondWithFilteredResult(_0x29be6f,_0x3f516a))[_0x278e('0x45')](handleError(_0x29be6f,null));};function char(_0x92281f){return _0x278e('0x63')===typeof _0x92281f?String['fromCharCode'][_0x278e('0x24')](null,arguments):_0x92281f;}function needsEncapsulation(_0x303287){return!!_0x303287&&(_0x303287[_0x278e('0x64')]()[_0x278e('0x65')](char(0xd))>=0x0||_0x303287[_0x278e('0x64')]()[_0x278e('0x65')](char(0xa))>=0x0||_0x303287[_0x278e('0x64')]()[_0x278e('0x65')](char(0x2c))>=0x0||_0x303287['toString']()[_0x278e('0x65')](char(0x22))>=0x0);}function encapsulate(_0x1e52a4){var _0x3ec15a=char(0x22),_0x13365c='\x5c'+char(0x22),_0x495bdc=_0x1e52a4[_0x278e('0x64')]()['replace'](new RegExp(_0x3ec15a,'g'),_0x13365c);return _0x3ec15a+_0x495bdc+_0x3ec15a;}exports[_0x278e('0x66')]=function(_0x379af8,_0x5f2a95,_0x30d91b){var _0x4bedd3,_0x1ce7e0;var _0x246a86={'where':{'ProjectId':_0x379af8[_0x278e('0x47')]['id']}};if(_0x379af8[_0x278e('0x35')][_0x278e('0x67')]){_0x246a86[_0x278e('0x3d')][_0x278e('0x68')]=JSON[_0x278e('0x69')](_0x379af8['query'][_0x278e('0x67')]);}return db[_0x278e('0x5c')][_0x278e('0x43')](_0x246a86)[_0x278e('0x28')](handleEntityNotFound(_0x5f2a95,null))[_0x278e('0x28')](function(_0x3c5b7e){if(_0x3c5b7e){_0x4bedd3=_0x3c5b7e;return db[_0x278e('0x6a')][_0x278e('0x43')]({'where':{'SessionId':{'$in':_['map'](_0x4bedd3,'id')},'ProjectId':_0x379af8[_0x278e('0x47')]['id']},'order':_0x278e('0x6b')});}})[_0x278e('0x28')](handleEntityNotFound(_0x5f2a95,null))[_0x278e('0x28')](function(_0x39d74c){if(_0x39d74c){_0x1ce7e0=_0x39d74c;var _0xbba205={};for(var _0x4ea066=0x0,_0x1db1b5=_0x1ce7e0[_0x278e('0x4a')];_0x4ea066<_0x1db1b5;_0x4ea066++){if(!_0xbba205[_0x278e('0x3a')](_0x1ce7e0[_0x4ea066][_0x278e('0x6c')])){_0xbba205[_0x1ce7e0[_0x4ea066]['questionId']]=needsEncapsulation(_0x1ce7e0[_0x4ea066][_0x278e('0x6d')])?encapsulate(_0x1ce7e0[_0x4ea066][_0x278e('0x6d')]):_0x1ce7e0[_0x4ea066][_0x278e('0x6d')];}}var _0x210320=[],_0x3ee6df={};for(var _0x919126=0x0,_0x1a41a0=_0x4bedd3[_0x278e('0x4a')];_0x919126<_0x1a41a0;_0x919126++){_0x3ee6df={'ProjectId':_0x379af8[_0x278e('0x47')]['id'],'SessionId':_0x4bedd3[_0x919126]['id'],'StartTime':moment(_0x4bedd3[_0x919126]['starttime'])['format'](_0x278e('0x6e'))};for(var _0x58a3b2=0x0,_0x25fcd2=_0x1ce7e0[_0x278e('0x4a')];_0x58a3b2<_0x25fcd2;_0x58a3b2++){if(_0x1ce7e0[_0x58a3b2][_0x278e('0x6f')]==_0x4bedd3[_0x919126]['id']&&_0xbba205[_0x278e('0x3a')](_0x1ce7e0[_0x58a3b2]['questionId'])){_0x3ee6df[_0xbba205[_0x1ce7e0[_0x58a3b2]['questionId']]]=_0x1ce7e0[_0x58a3b2][_0x278e('0x70')];}}for(var _0x47f567 in _0xbba205){if(!_0x3ee6df[_0x278e('0x3a')](_0xbba205[_0x47f567])){_0x3ee6df[_0xbba205[_0x47f567]]=null;}}_0x210320[_0x278e('0x71')](_0x3ee6df);}return _0x210320;}})[_0x278e('0x28')](function(_0x2386d1){if(!_[_0x278e('0x72')](_0x2386d1)){var _0x2c8768=toCsv(_0x2386d1);var _0x5d87e3=Date[_0x278e('0x73')]();fs[_0x278e('0x74')](util['format'](_0x278e('0x75'),_0x379af8[_0x278e('0x47')]['id'],_0x5d87e3),_0x2c8768);_0x5f2a95[_0x278e('0x76')](_0x278e('0x77'),'attachment;\x20filename='+util[_0x278e('0x78')]('Jscripty_Project_%d_Summary_%s.csv',_0x379af8['params']['id'],_0x5d87e3));_0x5f2a95['setHeader'](_0x278e('0x79'),_0x278e('0x7a'));return _0x5f2a95[_0x278e('0x7b')](util['format'](_0x278e('0x75'),_0x379af8['params']['id'],_0x5d87e3));}else{return _0x5f2a95[_0x278e('0x2b')](0xcc);}})[_0x278e('0x45')](handleError(_0x5f2a95,null));}; \ No newline at end of file +var _0x95af=['SessionId','answer','push','now','format','attachment;\x20filename=','setHeader','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Projects','UserProfileResource','sendStatus','error','name','send','index','map','JscriptyProject','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','clone','updatedAt','body','omit','createdAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getSessions','JscriptySessionReport','where','pick','ProjectId','getAnswers','findOne','JscriptyAnswerReport','length','hasOwnProperty','fromCharCode','toString','indexOf','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x95af,0x173));var _0xf95a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x95af[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xf95a('0x0'));var rimraf=require(_0xf95a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf95a('0x2'));var rp=require(_0xf95a('0x3'));var moment=require(_0xf95a('0x4'));var BPromise=require(_0xf95a('0x5'));var Mustache=require(_0xf95a('0x6'));var util=require(_0xf95a('0x7'));var path=require(_0xf95a('0x8'));var sox=require('sox');var csv=require(_0xf95a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf95a('0xa'));var _=require('lodash');var squel=require(_0xf95a('0xb'));var crypto=require(_0xf95a('0xc'));var jsforce=require(_0xf95a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf95a('0x9'));var querystring=require(_0xf95a('0xe'));var Papa=require('papaparse');var Redis=require(_0xf95a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf95a('0x10'));var as=require(_0xf95a('0x11'));var hardwareService=require(_0xf95a('0x12'));var logger=require(_0xf95a('0x13'))(_0xf95a('0x14'));var utils=require(_0xf95a('0x15'));var config=require(_0xf95a('0x16'));var licenseUtil=require(_0xf95a('0x17'));var db=require(_0xf95a('0x18'))['db'];function respondWithStatusCode(_0xc428f7,_0x2d9d0a){_0x2d9d0a=_0x2d9d0a||0xcc;return function(_0x22e042){if(_0x22e042){return _0xc428f7['sendStatus'](_0x2d9d0a);}return _0xc428f7[_0xf95a('0x19')](_0x2d9d0a)[_0xf95a('0x1a')]();};}function respondWithResult(_0x3b43d1,_0x570be5){_0x570be5=_0x570be5||0xc8;return function(_0x5449a0){if(_0x5449a0){return _0x3b43d1['status'](_0x570be5)[_0xf95a('0x1b')](_0x5449a0);}};}function respondWithFilteredResult(_0x54b9bc,_0x210561){return function(_0x2848b6){if(_0x2848b6){var _0x30fb30=typeof _0x210561['offset']===_0xf95a('0x1c')&&typeof _0x210561[_0xf95a('0x1d')]===_0xf95a('0x1c');var _0x3b47dc=_0x2848b6[_0xf95a('0x1e')];var _0x2991d1=_0x30fb30?0x0:_0x210561[_0xf95a('0x1f')];var _0x2144e4=_0x30fb30?_0x2848b6['count']:_0x210561[_0xf95a('0x1f')]+_0x210561[_0xf95a('0x1d')];var _0x2aefd7;if(_0x2144e4>=_0x3b47dc){_0x2144e4=_0x3b47dc;_0x2aefd7=0xc8;}else{_0x2aefd7=0xce;}_0x54b9bc[_0xf95a('0x19')](_0x2aefd7);return _0x54b9bc[_0xf95a('0x20')](_0xf95a('0x21'),_0x2991d1+'-'+_0x2144e4+'/'+_0x3b47dc)[_0xf95a('0x1b')](_0x2848b6);}return null;};}function patchUpdates(_0x53ffb1){return function(_0x57f0dd){try{jsonpatch[_0xf95a('0x22')](_0x57f0dd,_0x53ffb1,!![]);}catch(_0x3fea2f){return BPromise[_0xf95a('0x23')](_0x3fea2f);}return _0x57f0dd[_0xf95a('0x24')]();};}function saveUpdates(_0xdf912c,_0x3f3e07){return function(_0xc8cf5b){if(_0xc8cf5b){return _0xc8cf5b['update'](_0xdf912c)[_0xf95a('0x25')](function(_0x1c9a37){return _0x1c9a37;});}return null;};}function removeEntity(_0xaa985e,_0x4bbcca){return function(_0x3822f4){if(_0x3822f4){return _0x3822f4[_0xf95a('0x26')]()[_0xf95a('0x25')](function(){var _0x2a3de2=_0x3822f4[_0xf95a('0x27')]({'plain':!![]});var _0x43d3c3=_0xf95a('0x28');return db[_0xf95a('0x29')][_0xf95a('0x26')]({'where':{'type':_0x43d3c3,'resourceId':_0x2a3de2['id']}})[_0xf95a('0x25')](function(){return _0x3822f4;});})[_0xf95a('0x25')](function(){_0xaa985e['status'](0xcc)[_0xf95a('0x1a')]();});}};}function handleEntityNotFound(_0x555ba6,_0x37d4fc){return function(_0x50bdac){if(!_0x50bdac){_0x555ba6[_0xf95a('0x2a')](0x194);}return _0x50bdac;};}function handleError(_0x2cdef2,_0x2b0c26){_0x2b0c26=_0x2b0c26||0x1f4;return function(_0x495f46){logger[_0xf95a('0x2b')](_0x495f46['stack']);if(_0x495f46[_0xf95a('0x2c')]){delete _0x495f46[_0xf95a('0x2c')];}_0x2cdef2[_0xf95a('0x19')](_0x2b0c26)[_0xf95a('0x2d')](_0x495f46);};}exports[_0xf95a('0x2e')]=function(_0x3ff248,_0x1e1bf6){var _0x26f60b={},_0x30254c={},_0x525aca={'count':0x0,'rows':[]};var _0x24cf92=_[_0xf95a('0x2f')](db[_0xf95a('0x30')][_0xf95a('0x31')],function(_0x8269dd){return{'name':_0x8269dd['fieldName'],'type':_0x8269dd[_0xf95a('0x32')][_0xf95a('0x33')]};});_0x30254c[_0xf95a('0x34')]=_[_0xf95a('0x2f')](_0x24cf92,'name');_0x30254c[_0xf95a('0x35')]=_[_0xf95a('0x36')](_0x3ff248[_0xf95a('0x35')]);_0x30254c[_0xf95a('0x37')]=_[_0xf95a('0x38')](_0x30254c[_0xf95a('0x34')],_0x30254c[_0xf95a('0x35')]);_0x26f60b[_0xf95a('0x39')]=_['intersection'](_0x30254c[_0xf95a('0x34')],qs[_0xf95a('0x3a')](_0x3ff248[_0xf95a('0x35')][_0xf95a('0x3a')]));_0x26f60b['attributes']=_0x26f60b[_0xf95a('0x39')]['length']?_0x26f60b[_0xf95a('0x39')]:_0x30254c['model'];if(!_0x3ff248[_0xf95a('0x35')]['hasOwnProperty'](_0xf95a('0x3b'))){_0x26f60b['limit']=qs[_0xf95a('0x1d')](_0x3ff248[_0xf95a('0x35')][_0xf95a('0x1d')]);_0x26f60b[_0xf95a('0x1f')]=qs[_0xf95a('0x1f')](_0x3ff248[_0xf95a('0x35')][_0xf95a('0x1f')]);}_0x26f60b[_0xf95a('0x3c')]=qs[_0xf95a('0x3d')](_0x3ff248[_0xf95a('0x35')]['sort']);_0x26f60b['where']=qs['filters'](_['pick'](_0x3ff248[_0xf95a('0x35')],_0x30254c[_0xf95a('0x37')]),_0x24cf92);if(_0x3ff248[_0xf95a('0x35')][_0xf95a('0x3e')]){_0x26f60b['where']=_[_0xf95a('0x3f')](_0x26f60b['where'],{'$or':_['map'](_0x24cf92,function(_0x5f480c){if(_0x5f480c['type']!=='VIRTUAL'){var _0x55f9cd={};_0x55f9cd[_0x5f480c['name']]={'$like':'%'+_0x3ff248[_0xf95a('0x35')][_0xf95a('0x3e')]+'%'};return _0x55f9cd;}})});}_0x26f60b=_[_0xf95a('0x3f')]({},_0x26f60b,_0x3ff248[_0xf95a('0x40')]);var _0x346c07={'where':_0x26f60b['where']};return db[_0xf95a('0x30')][_0xf95a('0x1e')](_0x346c07)[_0xf95a('0x25')](function(_0x229a43){_0x525aca[_0xf95a('0x1e')]=_0x229a43;if(_0x3ff248[_0xf95a('0x35')][_0xf95a('0x41')]){_0x26f60b[_0xf95a('0x42')]=[{'all':!![]}];}return db[_0xf95a('0x30')][_0xf95a('0x43')](_0x26f60b);})[_0xf95a('0x25')](function(_0x21ac65){_0x525aca[_0xf95a('0x44')]=_0x21ac65;return _0x525aca;})[_0xf95a('0x25')](respondWithFilteredResult(_0x1e1bf6,_0x26f60b))[_0xf95a('0x45')](handleError(_0x1e1bf6,null));};exports[_0xf95a('0x46')]=function(_0x335cdb,_0xae7d03){var _0x161009={'raw':![],'where':{'id':_0x335cdb[_0xf95a('0x47')]['id']}},_0x3fa445={};_0x3fa445['model']=_[_0xf95a('0x36')](db[_0xf95a('0x30')]['rawAttributes']);_0x3fa445[_0xf95a('0x35')]=_[_0xf95a('0x36')](_0x335cdb['query']);_0x3fa445[_0xf95a('0x37')]=_[_0xf95a('0x38')](_0x3fa445[_0xf95a('0x34')],_0x3fa445[_0xf95a('0x35')]);_0x161009[_0xf95a('0x39')]=_[_0xf95a('0x38')](_0x3fa445[_0xf95a('0x34')],qs[_0xf95a('0x3a')](_0x335cdb[_0xf95a('0x35')]['fields']));_0x161009['attributes']=_0x161009[_0xf95a('0x39')]['length']?_0x161009[_0xf95a('0x39')]:_0x3fa445[_0xf95a('0x34')];if(_0x335cdb[_0xf95a('0x35')][_0xf95a('0x41')]){_0x161009[_0xf95a('0x42')]=[{'all':!![]}];}_0x161009=_[_0xf95a('0x3f')]({},_0x161009,_0x335cdb[_0xf95a('0x40')]);return db[_0xf95a('0x30')][_0xf95a('0x48')](_0x161009)[_0xf95a('0x25')](handleEntityNotFound(_0xae7d03,null))[_0xf95a('0x25')](respondWithResult(_0xae7d03,null))['catch'](handleError(_0xae7d03,null));};exports[_0xf95a('0x49')]=function(_0x50fe90,_0x444941){return db[_0xf95a('0x30')][_0xf95a('0x49')](_0x50fe90['body'],{})['then'](function(_0x591b93){var _0x313f00=_0x50fe90['user'][_0xf95a('0x27')]({'plain':!![]});if(!_0x313f00)throw new Error(_0xf95a('0x4a'));if(_0x313f00[_0xf95a('0x4b')]===_0xf95a('0x4c')){var _0x3ee09b=_0x591b93[_0xf95a('0x27')]({'plain':!![]});var _0x333430=_0xf95a('0x28');return db['UserProfileSection'][_0xf95a('0x48')]({'where':{'name':_0x333430,'userProfileId':_0x313f00[_0xf95a('0x4d')]},'raw':!![]})[_0xf95a('0x25')](function(_0x4e21da){if(_0x4e21da&&_0x4e21da[_0xf95a('0x4e')]===0x0){return db['UserProfileResource'][_0xf95a('0x49')]({'name':_0x3ee09b[_0xf95a('0x2c')],'resourceId':_0x3ee09b['id'],'type':_0x4e21da[_0xf95a('0x2c')],'sectionId':_0x4e21da['id']},{})['then'](function(){return _0x591b93;});}else{return _0x591b93;}})['catch'](function(_0x421603){logger[_0xf95a('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x421603);throw _0x421603;});}return _0x591b93;})[_0xf95a('0x25')](respondWithResult(_0x444941,0xc9))[_0xf95a('0x45')](handleError(_0x444941,null));};exports[_0xf95a('0x4f')]=function(_0x4848e3,_0x496e19){var _0x34ee1e={'where':{'id':_0x4848e3[_0xf95a('0x47')]['id']}},_0x4ce528={};_0x4ce528[_0xf95a('0x34')]=_[_0xf95a('0x36')](db[_0xf95a('0x30')]['rawAttributes']);_0x34ee1e[_0xf95a('0x39')]=_[_0xf95a('0x38')](_0x4ce528[_0xf95a('0x34')],qs[_0xf95a('0x3a')](_0x4848e3['query'][_0xf95a('0x3a')]));_0x34ee1e['attributes']=_0x34ee1e[_0xf95a('0x39')]['length']?_0x34ee1e[_0xf95a('0x39')]:_0x4ce528['model'];if(_0x4848e3['query']['includeAll']){_0x34ee1e[_0xf95a('0x42')]=[{'all':!![]}];}_0x34ee1e=_[_0xf95a('0x3f')]({},_0x34ee1e,_0x4848e3[_0xf95a('0x40')]);return db[_0xf95a('0x30')][_0xf95a('0x48')](_0x34ee1e)[_0xf95a('0x25')](handleEntityNotFound(_0x496e19,null))['then'](function(_0x169927){if(_0x169927){var _0x4e742f=_0x169927[_0xf95a('0x27')]({'plain':!![]});_0x4e742f=qs['omit'](_0x4e742f,['id','createdAt',_0xf95a('0x50')]);_0x4848e3[_0xf95a('0x51')]=_[_0xf95a('0x52')](_0x4848e3[_0xf95a('0x51')],['id',_0xf95a('0x53'),_0xf95a('0x50')]);return db[_0xf95a('0x30')]['create'](_[_0xf95a('0x3f')](_0x4e742f,_0x4848e3[_0xf95a('0x51')]),{'include':_0x4848e3['query'][_0xf95a('0x41')]?[{'all':!![]}]:undefined})['then'](function(_0x1bbee1){var _0x5cc442=_0x4848e3[_0xf95a('0x4c')][_0xf95a('0x27')]({'plain':!![]});if(!_0x5cc442)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cc442[_0xf95a('0x4b')]==='user'){var _0x2dc4a0=_0x1bbee1[_0xf95a('0x27')]({'plain':!![]});var _0x4a6d18=_0xf95a('0x28');return db[_0xf95a('0x54')][_0xf95a('0x48')]({'where':{'name':_0x4a6d18,'userProfileId':_0x5cc442[_0xf95a('0x4d')]},'raw':!![]})['then'](function(_0x193d1b){if(_0x193d1b&&_0x193d1b[_0xf95a('0x4e')]===0x0){return db[_0xf95a('0x29')][_0xf95a('0x49')]({'name':_0x2dc4a0[_0xf95a('0x2c')],'resourceId':_0x2dc4a0['id'],'type':_0x193d1b[_0xf95a('0x2c')],'sectionId':_0x193d1b['id']},{})[_0xf95a('0x25')](function(){return _0x1bbee1;});}else{return _0x1bbee1;}})[_0xf95a('0x45')](function(_0x506081){logger[_0xf95a('0x2b')](_0xf95a('0x55'),_0x506081);throw _0x506081;});}return _0x1bbee1;});}})[_0xf95a('0x25')](respondWithResult(_0x496e19,0xc9))['catch'](handleError(_0x496e19,null));};exports[_0xf95a('0x56')]=function(_0x358fcf,_0x1a1c74){if(_0x358fcf[_0xf95a('0x51')]['id']){delete _0x358fcf[_0xf95a('0x51')]['id'];}return db[_0xf95a('0x30')][_0xf95a('0x48')]({'where':{'id':_0x358fcf[_0xf95a('0x47')]['id']}})[_0xf95a('0x25')](handleEntityNotFound(_0x1a1c74,null))['then'](saveUpdates(_0x358fcf[_0xf95a('0x51')],null))[_0xf95a('0x25')](respondWithResult(_0x1a1c74,null))[_0xf95a('0x45')](handleError(_0x1a1c74,null));};exports[_0xf95a('0x26')]=function(_0x350405,_0x57cf44){return db['JscriptyProject']['find']({'where':{'id':_0x350405[_0xf95a('0x47')]['id']}})[_0xf95a('0x25')](handleEntityNotFound(_0x57cf44,null))['then'](removeEntity(_0x57cf44,null))[_0xf95a('0x45')](handleError(_0x57cf44,null));};exports[_0xf95a('0x57')]=function(_0x540280,_0x7dbc40,_0x1a285d){var _0x51b58a={'raw':!![],'where':{}};var _0x537da6={};var _0x5d8ad2={'count':0x0,'rows':[]};return db[_0xf95a('0x30')]['findOne']({'where':{'id':_0x540280[_0xf95a('0x47')]['id']}})[_0xf95a('0x25')](handleEntityNotFound(_0x7dbc40,null))[_0xf95a('0x25')](function(_0x3166b7){if(_0x3166b7){_0x537da6[_0xf95a('0x34')]=_[_0xf95a('0x36')](db[_0xf95a('0x58')][_0xf95a('0x31')]);_0x537da6[_0xf95a('0x35')]=_[_0xf95a('0x36')](_0x540280[_0xf95a('0x35')]);_0x537da6[_0xf95a('0x37')]=_[_0xf95a('0x38')](_0x537da6[_0xf95a('0x34')],_0x537da6[_0xf95a('0x35')]);_0x51b58a['attributes']=_[_0xf95a('0x38')](_0x537da6[_0xf95a('0x34')],qs[_0xf95a('0x3a')](_0x540280['query'][_0xf95a('0x3a')]));_0x51b58a[_0xf95a('0x39')]=_0x51b58a[_0xf95a('0x39')]['length']?_0x51b58a[_0xf95a('0x39')]:_0x537da6['model'];if(!_0x540280['query']['hasOwnProperty'](_0xf95a('0x3b'))){_0x51b58a[_0xf95a('0x1d')]=qs[_0xf95a('0x1d')](_0x540280[_0xf95a('0x35')][_0xf95a('0x1d')]);_0x51b58a[_0xf95a('0x1f')]=qs['offset'](_0x540280[_0xf95a('0x35')][_0xf95a('0x1f')]);}_0x51b58a[_0xf95a('0x3c')]=qs[_0xf95a('0x3d')](_0x540280[_0xf95a('0x35')]['sort']);_0x51b58a[_0xf95a('0x59')]=qs[_0xf95a('0x37')](_[_0xf95a('0x5a')](_0x540280[_0xf95a('0x35')],_0x537da6[_0xf95a('0x37')]));_0x51b58a[_0xf95a('0x59')][_0xf95a('0x5b')]=_0x3166b7['id'];if(_0x540280[_0xf95a('0x35')][_0xf95a('0x3e')]){_0x51b58a[_0xf95a('0x59')]=_[_0xf95a('0x3f')](_0x51b58a[_0xf95a('0x59')],{'$or':_[_0xf95a('0x2f')](_0x51b58a[_0xf95a('0x39')],function(_0x3561b7){var _0x27d81d={};_0x27d81d[_0x3561b7]={'$like':'%'+_0x540280[_0xf95a('0x35')][_0xf95a('0x3e')]+'%'};return _0x27d81d;})});}_0x51b58a=_[_0xf95a('0x3f')]({},_0x51b58a,_0x540280[_0xf95a('0x40')]);return db[_0xf95a('0x58')]['count']({'where':_0x51b58a[_0xf95a('0x59')]})['then'](function(_0x163f7d){_0x5d8ad2[_0xf95a('0x1e')]=_0x163f7d;if(_0x540280[_0xf95a('0x35')][_0xf95a('0x41')]){_0x51b58a[_0xf95a('0x42')]=[{'all':!![]}];}return db[_0xf95a('0x58')][_0xf95a('0x43')](_0x51b58a);})[_0xf95a('0x25')](function(_0x558ba7){_0x5d8ad2[_0xf95a('0x44')]=_0x558ba7;return _0x5d8ad2;});}})['then'](respondWithFilteredResult(_0x7dbc40,_0x51b58a))[_0xf95a('0x45')](handleError(_0x7dbc40,null));};exports[_0xf95a('0x5c')]=function(_0x3783be,_0xce7022,_0xbd0c0a){var _0x3fbc67={'raw':!![],'where':{}};var _0x5cfc5b={};var _0x37f6f8={'count':0x0,'rows':[]};return db[_0xf95a('0x30')][_0xf95a('0x5d')]({'where':{'id':_0x3783be['params']['id']}})[_0xf95a('0x25')](handleEntityNotFound(_0xce7022,null))[_0xf95a('0x25')](function(_0xde4606){if(_0xde4606){_0x5cfc5b['model']=_[_0xf95a('0x36')](db[_0xf95a('0x5e')][_0xf95a('0x31')]);_0x5cfc5b[_0xf95a('0x35')]=_[_0xf95a('0x36')](_0x3783be[_0xf95a('0x35')]);_0x5cfc5b[_0xf95a('0x37')]=_[_0xf95a('0x38')](_0x5cfc5b['model'],_0x5cfc5b[_0xf95a('0x35')]);_0x3fbc67[_0xf95a('0x39')]=_[_0xf95a('0x38')](_0x5cfc5b[_0xf95a('0x34')],qs['fields'](_0x3783be[_0xf95a('0x35')]['fields']));_0x3fbc67[_0xf95a('0x39')]=_0x3fbc67[_0xf95a('0x39')][_0xf95a('0x5f')]?_0x3fbc67['attributes']:_0x5cfc5b[_0xf95a('0x34')];if(!_0x3783be[_0xf95a('0x35')][_0xf95a('0x60')](_0xf95a('0x3b'))){_0x3fbc67[_0xf95a('0x1d')]=qs[_0xf95a('0x1d')](_0x3783be[_0xf95a('0x35')][_0xf95a('0x1d')]);_0x3fbc67[_0xf95a('0x1f')]=qs['offset'](_0x3783be['query'][_0xf95a('0x1f')]);}_0x3fbc67[_0xf95a('0x3c')]=qs['sort'](_0x3783be[_0xf95a('0x35')][_0xf95a('0x3d')]);_0x3fbc67['where']=qs['filters'](_[_0xf95a('0x5a')](_0x3783be['query'],_0x5cfc5b[_0xf95a('0x37')]));_0x3fbc67['where'][_0xf95a('0x5b')]=_0xde4606['id'];if(_0x3783be[_0xf95a('0x35')][_0xf95a('0x3e')]){_0x3fbc67['where']=_[_0xf95a('0x3f')](_0x3fbc67[_0xf95a('0x59')],{'$or':_[_0xf95a('0x2f')](_0x3fbc67[_0xf95a('0x39')],function(_0x34e22c){var _0x30dd29={};_0x30dd29[_0x34e22c]={'$like':'%'+_0x3783be[_0xf95a('0x35')][_0xf95a('0x3e')]+'%'};return _0x30dd29;})});}_0x3fbc67=_[_0xf95a('0x3f')]({},_0x3fbc67,_0x3783be[_0xf95a('0x40')]);return db[_0xf95a('0x5e')]['count']({'where':_0x3fbc67[_0xf95a('0x59')]})[_0xf95a('0x25')](function(_0x377907){_0x37f6f8[_0xf95a('0x1e')]=_0x377907;if(_0x3783be['query']['includeAll']){_0x3fbc67['include']=[{'all':!![]}];}return db[_0xf95a('0x5e')]['findAll'](_0x3fbc67);})[_0xf95a('0x25')](function(_0x328d07){_0x37f6f8[_0xf95a('0x44')]=_0x328d07;return _0x37f6f8;});}})[_0xf95a('0x25')](respondWithFilteredResult(_0xce7022,_0x3fbc67))[_0xf95a('0x45')](handleError(_0xce7022,null));};function char(_0x212a91){return'number'===typeof _0x212a91?String[_0xf95a('0x61')][_0xf95a('0x22')](null,arguments):_0x212a91;}function needsEncapsulation(_0xec0bd6){return!!_0xec0bd6&&(_0xec0bd6[_0xf95a('0x62')]()['indexOf'](char(0xd))>=0x0||_0xec0bd6[_0xf95a('0x62')]()[_0xf95a('0x63')](char(0xa))>=0x0||_0xec0bd6[_0xf95a('0x62')]()[_0xf95a('0x63')](char(0x2c))>=0x0||_0xec0bd6[_0xf95a('0x62')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x434b9e){var _0x58a1fa=char(0x22),_0x3919f8='\x5c'+char(0x22),_0xd218d7=_0x434b9e[_0xf95a('0x62')]()['replace'](new RegExp(_0x58a1fa,'g'),_0x3919f8);return _0x58a1fa+_0xd218d7+_0x58a1fa;}exports[_0xf95a('0x64')]=function(_0x4faf15,_0x16c6b1,_0x2675ad){var _0x17991b,_0x38126f;var _0x5b4954={'where':{'ProjectId':_0x4faf15[_0xf95a('0x47')]['id']}};if(_0x4faf15[_0xf95a('0x35')][_0xf95a('0x65')]){_0x5b4954[_0xf95a('0x59')]['starttime']=JSON[_0xf95a('0x66')](_0x4faf15[_0xf95a('0x35')]['startTime']);}return db['JscriptySessionReport'][_0xf95a('0x43')](_0x5b4954)['then'](handleEntityNotFound(_0x16c6b1,null))[_0xf95a('0x25')](function(_0x8ad125){if(_0x8ad125){_0x17991b=_0x8ad125;return db[_0xf95a('0x67')]['findAll']({'where':{'SessionId':{'$in':_[_0xf95a('0x2f')](_0x17991b,'id')},'ProjectId':_0x4faf15['params']['id']},'order':_0xf95a('0x68')});}})[_0xf95a('0x25')](handleEntityNotFound(_0x16c6b1,null))[_0xf95a('0x25')](function(_0x27aa3e){if(_0x27aa3e){_0x38126f=_0x27aa3e;var _0x580da8={};for(var _0x4cba66=0x0,_0x26b60c=_0x38126f['length'];_0x4cba66<_0x26b60c;_0x4cba66++){if(!_0x580da8['hasOwnProperty'](_0x38126f[_0x4cba66][_0xf95a('0x69')])){_0x580da8[_0x38126f[_0x4cba66][_0xf95a('0x69')]]=needsEncapsulation(_0x38126f[_0x4cba66][_0xf95a('0x6a')])?encapsulate(_0x38126f[_0x4cba66][_0xf95a('0x6a')]):_0x38126f[_0x4cba66]['question'];}}var _0x4aa07d=[],_0x1d68ca={};for(var _0x521e4=0x0,_0x4755d0=_0x17991b[_0xf95a('0x5f')];_0x521e4<_0x4755d0;_0x521e4++){_0x1d68ca={'ProjectId':_0x4faf15[_0xf95a('0x47')]['id'],'SessionId':_0x17991b[_0x521e4]['id'],'StartTime':moment(_0x17991b[_0x521e4][_0xf95a('0x6b')])['format'](_0xf95a('0x6c'))};for(var _0x3b5d66=0x0,_0xf97ddc=_0x38126f[_0xf95a('0x5f')];_0x3b5d66<_0xf97ddc;_0x3b5d66++){if(_0x38126f[_0x3b5d66][_0xf95a('0x6d')]==_0x17991b[_0x521e4]['id']&&_0x580da8[_0xf95a('0x60')](_0x38126f[_0x3b5d66][_0xf95a('0x69')])){_0x1d68ca[_0x580da8[_0x38126f[_0x3b5d66][_0xf95a('0x69')]]]=_0x38126f[_0x3b5d66][_0xf95a('0x6e')];}}for(var _0x554291 in _0x580da8){if(!_0x1d68ca[_0xf95a('0x60')](_0x580da8[_0x554291])){_0x1d68ca[_0x580da8[_0x554291]]=null;}}_0x4aa07d[_0xf95a('0x6f')](_0x1d68ca);}return _0x4aa07d;}})[_0xf95a('0x25')](function(_0x3f7c77){if(!_['isEmpty'](_0x3f7c77)){var _0x2fc802=toCsv(_0x3f7c77);var _0x44c898=Date[_0xf95a('0x70')]();fs['writeFileSync'](util[_0xf95a('0x71')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4faf15[_0xf95a('0x47')]['id'],_0x44c898),_0x2fc802);_0x16c6b1['setHeader']('Content-disposition',_0xf95a('0x72')+util[_0xf95a('0x71')]('Jscripty_Project_%d_Summary_%s.csv',_0x4faf15[_0xf95a('0x47')]['id'],_0x44c898));_0x16c6b1[_0xf95a('0x73')](_0xf95a('0x74'),_0xf95a('0x75'));return _0x16c6b1[_0xf95a('0x76')](util[_0xf95a('0x71')](_0xf95a('0x77'),_0x4faf15[_0xf95a('0x47')]['id'],_0x44c898));}else{return _0x16c6b1['sendStatus'](0xcc);}})[_0xf95a('0x45')](handleError(_0x16c6b1,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 825a377..4272c06 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 _0x008c=['define','jscripty_projects','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports'];(function(_0x5597a0,_0x35c11e){var _0x2fc8d6=function(_0x492dcb){while(--_0x492dcb){_0x5597a0['push'](_0x5597a0['shift']());}};_0x2fc8d6(++_0x35c11e);}(_0x008c,0x188));var _0xc008=function(_0x293274,_0x1f9041){_0x293274=_0x293274-0x0;var _0x21730e=_0x008c[_0x293274];return _0x21730e;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('JscriptyProject',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6379=['exports','define','lodash','util','../../config/logger','api','moment','request-promise','path','./jscriptyProject.attributes'];(function(_0x4046fb,_0x1c2e7b){var _0x8e2d6d=function(_0x1b008f){while(--_0x1b008f){_0x4046fb['push'](_0x4046fb['shift']());}};_0x8e2d6d(++_0x1c2e7b);}(_0x6379,0x84));var _0x9637=function(_0xdb3c1b,_0x2a339b){_0xdb3c1b=_0xdb3c1b-0x0;var _0x3e23e0=_0x6379[_0xdb3c1b];return _0x3e23e0;};'use strict';var _=require(_0x9637('0x0'));var util=require(_0x9637('0x1'));var logger=require(_0x9637('0x2'))(_0x9637('0x3'));var moment=require(_0x9637('0x4'));var BPromise=require('bluebird');var rp=require(_0x9637('0x5'));var fs=require('fs');var path=require(_0x9637('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9637('0x7'));module[_0x9637('0x8')]=function(_0x19f7d0,_0x25087c){return _0x19f7d0[_0x9637('0x9')]('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index ba3fa34..0ec1f2e 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x54dd9f,_0x57ad29){var _0x4efc29=function(_0x40422b){while(--_0x40422b){_0x54dd9f['push'](_0x54dd9f['shift']());}};_0x4efc29(++_0x57ad29);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0xcb91[_0x30cd7e];return _0x462a02;};'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')]('JscriptyProject,\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 +var _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0xbdb7[_0x2d8d69];return _0x39ae22;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 104e457..e96c271 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 _0xe4a6=['/describe','describe','/:id','post','create','put','update','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index'];(function(_0x429660,_0x15e9c5){var _0x382968=function(_0x19d020){while(--_0x19d020){_0x429660['push'](_0x429660['shift']());}};_0x382968(++_0x15e9c5);}(_0xe4a6,0x121));var _0x6e4a=function(_0x462f67,_0x5b91d7){_0x462f67=_0x462f67-0x0;var _0x2d7f1a=_0xe4a6[_0x462f67];return _0x2d7f1a;};'use strict';var multer=require(_0x6e4a('0x0'));var util=require('util');var path=require(_0x6e4a('0x1'));var timeout=require(_0x6e4a('0x2'));var express=require('express');var router=express[_0x6e4a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6e4a('0x4'));var interaction=require(_0x6e4a('0x5'));var config=require(_0x6e4a('0x6'));var controller=require(_0x6e4a('0x7'));router[_0x6e4a('0x8')]('/',auth[_0x6e4a('0x9')](),controller[_0x6e4a('0xa')]);router[_0x6e4a('0x8')](_0x6e4a('0xb'),auth[_0x6e4a('0x9')](),controller[_0x6e4a('0xc')]);router[_0x6e4a('0x8')](_0x6e4a('0xd'),auth[_0x6e4a('0x9')](),controller['show']);router[_0x6e4a('0xe')]('/',auth['isAuthenticated'](),controller[_0x6e4a('0xf')]);router[_0x6e4a('0x10')](_0x6e4a('0xd'),auth[_0x6e4a('0x9')](),controller[_0x6e4a('0x11')]);router[_0x6e4a('0x12')](_0x6e4a('0xd'),auth[_0x6e4a('0x9')](),controller['destroy']);module[_0x6e4a('0x13')]=router; \ No newline at end of file +var _0xa664=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','delete','exports','multer','path'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xa664,0x139));var _0x4a66=function(_0x1b203a,_0x47ea6d){_0x1b203a=_0x1b203a-0x0;var _0x193f17=_0xa664[_0x1b203a];return _0x193f17;};'use strict';var multer=require(_0x4a66('0x0'));var util=require('util');var path=require(_0x4a66('0x1'));var timeout=require(_0x4a66('0x2'));var express=require(_0x4a66('0x3'));var router=express[_0x4a66('0x4')]();var fs_extra=require(_0x4a66('0x5'));var auth=require(_0x4a66('0x6'));var interaction=require(_0x4a66('0x7'));var config=require(_0x4a66('0x8'));var controller=require(_0x4a66('0x9'));router[_0x4a66('0xa')]('/',auth['isAuthenticated'](),controller[_0x4a66('0xb')]);router[_0x4a66('0xa')](_0x4a66('0xc'),auth[_0x4a66('0xd')](),controller[_0x4a66('0xe')]);router[_0x4a66('0xa')](_0x4a66('0xf'),auth[_0x4a66('0xd')](),controller[_0x4a66('0x10')]);router[_0x4a66('0x11')]('/',auth[_0x4a66('0xd')](),controller['create']);router[_0x4a66('0x12')](_0x4a66('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x4a66('0x13')](_0x4a66('0xf'),auth[_0x4a66('0xd')](),controller['destroy']);module[_0x4a66('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 7c5a5bc..ccec549 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x7a54,0x106));var _0x47a5=function(_0x24fc87,_0x3e770c){_0x24fc87=_0x24fc87-0x0;var _0x12f283=_0x7a54[_0x24fc87];return _0x12f283;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x7a54,0x106));var _0x47a5=function(_0x14f4ea,_0x362fae){_0x14f4ea=_0x14f4ea-0x0;var _0x1b9f2a=_0x7a54[_0x14f4ea];return _0x1b9f2a;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 630c190..524e291 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 _0x2e0b=['../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x2e0b,0x1b1));var _0xb2e0=function(_0x310ca4,_0x195e91){_0x310ca4=_0x310ca4-0x0;var _0x303c6f=_0x2e0b[_0x310ca4];return _0x303c6f;};'use strict';var emlformat=require(_0xb2e0('0x0'));var rimraf=require(_0xb2e0('0x1'));var zipdir=require(_0xb2e0('0x2'));var jsonpatch=require(_0xb2e0('0x3'));var rp=require(_0xb2e0('0x4'));var moment=require(_0xb2e0('0x5'));var BPromise=require(_0xb2e0('0x6'));var Mustache=require(_0xb2e0('0x7'));var util=require(_0xb2e0('0x8'));var path=require(_0xb2e0('0x9'));var sox=require(_0xb2e0('0xa'));var csv=require(_0xb2e0('0xb'));var ejs=require(_0xb2e0('0xc'));var fs=require('fs');var fs_extra=require(_0xb2e0('0xd'));var _=require(_0xb2e0('0xe'));var squel=require(_0xb2e0('0xf'));var crypto=require(_0xb2e0('0x10'));var jsforce=require(_0xb2e0('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xb2e0('0xb'));var querystring=require(_0xb2e0('0x12'));var Papa=require(_0xb2e0('0x13'));var Redis=require('ioredis');var authService=require(_0xb2e0('0x14'));var qs=require(_0xb2e0('0x15'));var as=require(_0xb2e0('0x16'));var hardwareService=require(_0xb2e0('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xb2e0('0x18'));var config=require(_0xb2e0('0x19'));var licenseUtil=require(_0xb2e0('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40489d,_0xda5828){_0xda5828=_0xda5828||0xcc;return function(_0xb91420){if(_0xb91420){return _0x40489d[_0xb2e0('0x1b')](_0xda5828);}return _0x40489d[_0xb2e0('0x1c')](_0xda5828)[_0xb2e0('0x1d')]();};}function respondWithResult(_0x5c7c90,_0x1e860f){_0x1e860f=_0x1e860f||0xc8;return function(_0x2598f5){if(_0x2598f5){return _0x5c7c90[_0xb2e0('0x1c')](_0x1e860f)[_0xb2e0('0x1e')](_0x2598f5);}};}function respondWithFilteredResult(_0x45a9fd,_0x177a1e){return function(_0x1f37e4){if(_0x1f37e4){var _0x1968b8=typeof _0x177a1e[_0xb2e0('0x1f')]==='undefined'&&typeof _0x177a1e['limit']==='undefined';var _0x143b91=_0x1f37e4['count'];var _0x121826=_0x1968b8?0x0:_0x177a1e['offset'];var _0x1cd534=_0x1968b8?_0x1f37e4[_0xb2e0('0x20')]:_0x177a1e['offset']+_0x177a1e['limit'];var _0x32e6bf;if(_0x1cd534>=_0x143b91){_0x1cd534=_0x143b91;_0x32e6bf=0xc8;}else{_0x32e6bf=0xce;}_0x45a9fd[_0xb2e0('0x1c')](_0x32e6bf);return _0x45a9fd['set'](_0xb2e0('0x21'),_0x121826+'-'+_0x1cd534+'/'+_0x143b91)[_0xb2e0('0x1e')](_0x1f37e4);}return null;};}function patchUpdates(_0x3ddd60){return function(_0x58fc8c){try{jsonpatch['apply'](_0x58fc8c,_0x3ddd60,!![]);}catch(_0xf1686f){return BPromise[_0xb2e0('0x22')](_0xf1686f);}return _0x58fc8c[_0xb2e0('0x23')]();};}function saveUpdates(_0x5a9feb,_0xe1329b){return function(_0x162223){if(_0x162223){return _0x162223[_0xb2e0('0x24')](_0x5a9feb)[_0xb2e0('0x25')](function(_0x5c0502){return _0x5c0502;});}return null;};}function removeEntity(_0x21ebe3,_0x214421){return function(_0x2d4ac6){if(_0x2d4ac6){return _0x2d4ac6[_0xb2e0('0x26')]()['then'](function(){_0x21ebe3[_0xb2e0('0x1c')](0xcc)[_0xb2e0('0x1d')]();});}};}function handleEntityNotFound(_0x298d22,_0x13af14){return function(_0x44927b){if(!_0x44927b){_0x298d22[_0xb2e0('0x1b')](0x194);}return _0x44927b;};}function handleError(_0x48c4f4,_0x15cb88){_0x15cb88=_0x15cb88||0x1f4;return function(_0x57bcd6){logger[_0xb2e0('0x27')](_0x57bcd6[_0xb2e0('0x28')]);if(_0x57bcd6[_0xb2e0('0x29')]){delete _0x57bcd6[_0xb2e0('0x29')];}_0x48c4f4[_0xb2e0('0x1c')](_0x15cb88)[_0xb2e0('0x2a')](_0x57bcd6);};}exports['index']=function(_0x1a1a0d,_0xc5007e){var _0xcac5df={},_0xbf317d={},_0x32c39c={'count':0x0,'rows':[]};var _0x9a0f61=_[_0xb2e0('0x2b')](db[_0xb2e0('0x2c')][_0xb2e0('0x2d')],function(_0x9fffa4){return{'name':_0x9fffa4[_0xb2e0('0x2e')],'type':_0x9fffa4[_0xb2e0('0x2f')][_0xb2e0('0x30')]};});_0xbf317d[_0xb2e0('0x31')]=_[_0xb2e0('0x2b')](_0x9a0f61,_0xb2e0('0x29'));_0xbf317d[_0xb2e0('0x32')]=_[_0xb2e0('0x33')](_0x1a1a0d['query']);_0xbf317d[_0xb2e0('0x34')]=_[_0xb2e0('0x35')](_0xbf317d[_0xb2e0('0x31')],_0xbf317d[_0xb2e0('0x32')]);_0xcac5df[_0xb2e0('0x36')]=_['intersection'](_0xbf317d['model'],qs[_0xb2e0('0x37')](_0x1a1a0d[_0xb2e0('0x32')]['fields']));_0xcac5df[_0xb2e0('0x36')]=_0xcac5df[_0xb2e0('0x36')][_0xb2e0('0x38')]?_0xcac5df[_0xb2e0('0x36')]:_0xbf317d[_0xb2e0('0x31')];if(!_0x1a1a0d[_0xb2e0('0x32')][_0xb2e0('0x39')]('nolimit')){_0xcac5df['limit']=qs[_0xb2e0('0x3a')](_0x1a1a0d[_0xb2e0('0x32')][_0xb2e0('0x3a')]);_0xcac5df[_0xb2e0('0x1f')]=qs[_0xb2e0('0x1f')](_0x1a1a0d['query'][_0xb2e0('0x1f')]);}_0xcac5df[_0xb2e0('0x3b')]=qs[_0xb2e0('0x3c')](_0x1a1a0d['query'][_0xb2e0('0x3c')]);_0xcac5df[_0xb2e0('0x3d')]=qs[_0xb2e0('0x34')](_[_0xb2e0('0x3e')](_0x1a1a0d[_0xb2e0('0x32')],_0xbf317d[_0xb2e0('0x34')]),_0x9a0f61);if(_0x1a1a0d[_0xb2e0('0x32')]['filter']){_0xcac5df['where']=_[_0xb2e0('0x3f')](_0xcac5df[_0xb2e0('0x3d')],{'$or':_['map'](_0x9a0f61,function(_0x5c2826){if(_0x5c2826[_0xb2e0('0x2f')]!==_0xb2e0('0x40')){var _0x289fa7={};_0x289fa7[_0x5c2826[_0xb2e0('0x29')]]={'$like':'%'+_0x1a1a0d[_0xb2e0('0x32')]['filter']+'%'};return _0x289fa7;}})});}_0xcac5df=_[_0xb2e0('0x3f')]({},_0xcac5df,_0x1a1a0d[_0xb2e0('0x41')]);var _0x1ecb78={'where':_0xcac5df[_0xb2e0('0x3d')]};return db['JscriptyQuestionReport'][_0xb2e0('0x20')](_0x1ecb78)[_0xb2e0('0x25')](function(_0x36d2a8){_0x32c39c[_0xb2e0('0x20')]=_0x36d2a8;if(_0x1a1a0d[_0xb2e0('0x32')][_0xb2e0('0x42')]){_0xcac5df[_0xb2e0('0x43')]=[{'all':!![]}];}return db[_0xb2e0('0x2c')]['findAll'](_0xcac5df);})['then'](function(_0x323331){_0x32c39c[_0xb2e0('0x44')]=_0x323331;return _0x32c39c;})[_0xb2e0('0x25')](respondWithFilteredResult(_0xc5007e,_0xcac5df))[_0xb2e0('0x45')](handleError(_0xc5007e,null));};exports[_0xb2e0('0x46')]=function(_0x56f5df,_0x1c400f){var _0x49645c={'raw':!![],'where':{'id':_0x56f5df['params']['id']}},_0x3212da={};_0x3212da['model']=_[_0xb2e0('0x33')](db[_0xb2e0('0x2c')][_0xb2e0('0x2d')]);_0x3212da['query']=_['keys'](_0x56f5df['query']);_0x3212da['filters']=_[_0xb2e0('0x35')](_0x3212da[_0xb2e0('0x31')],_0x3212da['query']);_0x49645c[_0xb2e0('0x36')]=_[_0xb2e0('0x35')](_0x3212da[_0xb2e0('0x31')],qs[_0xb2e0('0x37')](_0x56f5df[_0xb2e0('0x32')]['fields']));_0x49645c['attributes']=_0x49645c[_0xb2e0('0x36')]['length']?_0x49645c[_0xb2e0('0x36')]:_0x3212da[_0xb2e0('0x31')];if(_0x56f5df[_0xb2e0('0x32')]['includeAll']){_0x49645c['include']=[{'all':!![]}];}_0x49645c=_[_0xb2e0('0x3f')]({},_0x49645c,_0x56f5df[_0xb2e0('0x41')]);return db[_0xb2e0('0x2c')][_0xb2e0('0x47')](_0x49645c)['then'](handleEntityNotFound(_0x1c400f,null))[_0xb2e0('0x25')](respondWithResult(_0x1c400f,null))[_0xb2e0('0x45')](handleError(_0x1c400f,null));};exports[_0xb2e0('0x48')]=function(_0x50f978,_0x352f67){return db[_0xb2e0('0x2c')]['create'](_0x50f978[_0xb2e0('0x49')],{})[_0xb2e0('0x25')](respondWithResult(_0x352f67,0xc9))['catch'](handleError(_0x352f67,null));};exports[_0xb2e0('0x24')]=function(_0x207d22,_0x54e88d){if(_0x207d22['body']['id']){delete _0x207d22[_0xb2e0('0x49')]['id'];}return db[_0xb2e0('0x2c')][_0xb2e0('0x47')]({'where':{'id':_0x207d22['params']['id']}})[_0xb2e0('0x25')](handleEntityNotFound(_0x54e88d,null))[_0xb2e0('0x25')](saveUpdates(_0x207d22['body'],null))[_0xb2e0('0x25')](respondWithResult(_0x54e88d,null))[_0xb2e0('0x45')](handleError(_0x54e88d,null));};exports[_0xb2e0('0x26')]=function(_0xd8af3e,_0x428c40){return db[_0xb2e0('0x2c')][_0xb2e0('0x47')]({'where':{'id':_0xd8af3e[_0xb2e0('0x4a')]['id']}})[_0xb2e0('0x25')](handleEntityNotFound(_0x428c40,null))[_0xb2e0('0x25')](removeEntity(_0x428c40,null))['catch'](handleError(_0x428c40,null));};exports[_0xb2e0('0x4b')]=function(_0x41be7c,_0x4c6330){return db[_0xb2e0('0x2c')][_0xb2e0('0x4b')]()[_0xb2e0('0x25')](respondWithResult(_0x4c6330,null))['catch'](handleError(_0x4c6330,null));}; \ No newline at end of file +var _0xa54e=['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','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','save','then','destroy','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','include','rows','catch','show','params','keys','includeAll','find','create','update','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x33dcc9,_0x1d0476){var _0x455bab=function(_0x27030e){while(--_0x27030e){_0x33dcc9['push'](_0x33dcc9['shift']());}};_0x455bab(++_0x1d0476);}(_0xa54e,0xcd));var _0xea54=function(_0x4fb1b8,_0x32d98d){_0x4fb1b8=_0x4fb1b8-0x0;var _0x146c71=_0xa54e[_0x4fb1b8];return _0x146c71;};'use strict';var emlformat=require(_0xea54('0x0'));var rimraf=require(_0xea54('0x1'));var zipdir=require(_0xea54('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xea54('0x3'));var BPromise=require(_0xea54('0x4'));var Mustache=require(_0xea54('0x5'));var util=require(_0xea54('0x6'));var path=require(_0xea54('0x7'));var sox=require('sox');var csv=require(_0xea54('0x8'));var ejs=require(_0xea54('0x9'));var fs=require('fs');var fs_extra=require(_0xea54('0xa'));var _=require(_0xea54('0xb'));var squel=require(_0xea54('0xc'));var crypto=require('crypto');var jsforce=require(_0xea54('0xd'));var deskjs=require(_0xea54('0xe'));var toCsv=require(_0xea54('0x8'));var querystring=require(_0xea54('0xf'));var Papa=require(_0xea54('0x10'));var Redis=require(_0xea54('0x11'));var authService=require(_0xea54('0x12'));var qs=require(_0xea54('0x13'));var as=require(_0xea54('0x14'));var hardwareService=require(_0xea54('0x15'));var logger=require(_0xea54('0x16'))(_0xea54('0x17'));var utils=require('../../config/utils');var config=require(_0xea54('0x18'));var licenseUtil=require(_0xea54('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x108229,_0x41664c){_0x41664c=_0x41664c||0xcc;return function(_0x39f5fc){if(_0x39f5fc){return _0x108229[_0xea54('0x1a')](_0x41664c);}return _0x108229[_0xea54('0x1b')](_0x41664c)['end']();};}function respondWithResult(_0x472213,_0x5b5c54){_0x5b5c54=_0x5b5c54||0xc8;return function(_0x5789c2){if(_0x5789c2){return _0x472213[_0xea54('0x1b')](_0x5b5c54)[_0xea54('0x1c')](_0x5789c2);}};}function respondWithFilteredResult(_0x4f007f,_0x168d61){return function(_0xb1b4c5){if(_0xb1b4c5){var _0x40204b=typeof _0x168d61[_0xea54('0x1d')]==='undefined'&&typeof _0x168d61[_0xea54('0x1e')]===_0xea54('0x1f');var _0x5b91c7=_0xb1b4c5[_0xea54('0x20')];var _0x5813ad=_0x40204b?0x0:_0x168d61[_0xea54('0x1d')];var _0x5cfb83=_0x40204b?_0xb1b4c5['count']:_0x168d61[_0xea54('0x1d')]+_0x168d61['limit'];var _0x1ce964;if(_0x5cfb83>=_0x5b91c7){_0x5cfb83=_0x5b91c7;_0x1ce964=0xc8;}else{_0x1ce964=0xce;}_0x4f007f[_0xea54('0x1b')](_0x1ce964);return _0x4f007f['set'](_0xea54('0x21'),_0x5813ad+'-'+_0x5cfb83+'/'+_0x5b91c7)['json'](_0xb1b4c5);}return null;};}function patchUpdates(_0x298c2b){return function(_0x342472){try{jsonpatch['apply'](_0x342472,_0x298c2b,!![]);}catch(_0x41f67e){return BPromise[_0xea54('0x22')](_0x41f67e);}return _0x342472[_0xea54('0x23')]();};}function saveUpdates(_0x266c89,_0x2e5a54){return function(_0x421e42){if(_0x421e42){return _0x421e42['update'](_0x266c89)[_0xea54('0x24')](function(_0x4e18bf){return _0x4e18bf;});}return null;};}function removeEntity(_0x22effd,_0x439298){return function(_0x16af8f){if(_0x16af8f){return _0x16af8f[_0xea54('0x25')]()[_0xea54('0x24')](function(){_0x22effd[_0xea54('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ca54a,_0x3b4aa5){return function(_0x111bea){if(!_0x111bea){_0x2ca54a[_0xea54('0x1a')](0x194);}return _0x111bea;};}function handleError(_0x8d3327,_0x2a4f24){_0x2a4f24=_0x2a4f24||0x1f4;return function(_0x330411){logger['error'](_0x330411['stack']);if(_0x330411['name']){delete _0x330411[_0xea54('0x26')];}_0x8d3327[_0xea54('0x1b')](_0x2a4f24)['send'](_0x330411);};}exports[_0xea54('0x27')]=function(_0x20ff2b,_0x15d4ce){var _0x4774c8={},_0x5cc70a={},_0x33a2d3={'count':0x0,'rows':[]};var _0xe51c21=_[_0xea54('0x28')](db[_0xea54('0x29')][_0xea54('0x2a')],function(_0x1b7f5b){return{'name':_0x1b7f5b[_0xea54('0x2b')],'type':_0x1b7f5b[_0xea54('0x2c')][_0xea54('0x2d')]};});_0x5cc70a[_0xea54('0x2e')]=_[_0xea54('0x28')](_0xe51c21,_0xea54('0x26'));_0x5cc70a['query']=_['keys'](_0x20ff2b[_0xea54('0x2f')]);_0x5cc70a[_0xea54('0x30')]=_[_0xea54('0x31')](_0x5cc70a[_0xea54('0x2e')],_0x5cc70a[_0xea54('0x2f')]);_0x4774c8['attributes']=_['intersection'](_0x5cc70a[_0xea54('0x2e')],qs[_0xea54('0x32')](_0x20ff2b[_0xea54('0x2f')][_0xea54('0x32')]));_0x4774c8[_0xea54('0x33')]=_0x4774c8['attributes'][_0xea54('0x34')]?_0x4774c8['attributes']:_0x5cc70a[_0xea54('0x2e')];if(!_0x20ff2b['query'][_0xea54('0x35')](_0xea54('0x36'))){_0x4774c8[_0xea54('0x1e')]=qs[_0xea54('0x1e')](_0x20ff2b[_0xea54('0x2f')]['limit']);_0x4774c8[_0xea54('0x1d')]=qs[_0xea54('0x1d')](_0x20ff2b[_0xea54('0x2f')][_0xea54('0x1d')]);}_0x4774c8['order']=qs[_0xea54('0x37')](_0x20ff2b['query'][_0xea54('0x37')]);_0x4774c8[_0xea54('0x38')]=qs[_0xea54('0x30')](_[_0xea54('0x39')](_0x20ff2b[_0xea54('0x2f')],_0x5cc70a[_0xea54('0x30')]),_0xe51c21);if(_0x20ff2b['query']['filter']){_0x4774c8[_0xea54('0x38')]=_[_0xea54('0x3a')](_0x4774c8[_0xea54('0x38')],{'$or':_[_0xea54('0x28')](_0xe51c21,function(_0x5ddbba){if(_0x5ddbba[_0xea54('0x2c')]!=='VIRTUAL'){var _0x2d69be={};_0x2d69be[_0x5ddbba[_0xea54('0x26')]]={'$like':'%'+_0x20ff2b[_0xea54('0x2f')][_0xea54('0x3b')]+'%'};return _0x2d69be;}})});}_0x4774c8=_[_0xea54('0x3a')]({},_0x4774c8,_0x20ff2b[_0xea54('0x3c')]);var _0x408fb5={'where':_0x4774c8['where']};return db[_0xea54('0x29')][_0xea54('0x20')](_0x408fb5)[_0xea54('0x24')](function(_0x5703e2){_0x33a2d3[_0xea54('0x20')]=_0x5703e2;if(_0x20ff2b['query']['includeAll']){_0x4774c8[_0xea54('0x3d')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x4774c8);})['then'](function(_0x532d93){_0x33a2d3[_0xea54('0x3e')]=_0x532d93;return _0x33a2d3;})[_0xea54('0x24')](respondWithFilteredResult(_0x15d4ce,_0x4774c8))[_0xea54('0x3f')](handleError(_0x15d4ce,null));};exports[_0xea54('0x40')]=function(_0x11766d,_0x26462d){var _0x5757f4={'raw':!![],'where':{'id':_0x11766d[_0xea54('0x41')]['id']}},_0x5f4af8={};_0x5f4af8[_0xea54('0x2e')]=_[_0xea54('0x42')](db[_0xea54('0x29')][_0xea54('0x2a')]);_0x5f4af8[_0xea54('0x2f')]=_[_0xea54('0x42')](_0x11766d[_0xea54('0x2f')]);_0x5f4af8[_0xea54('0x30')]=_[_0xea54('0x31')](_0x5f4af8[_0xea54('0x2e')],_0x5f4af8[_0xea54('0x2f')]);_0x5757f4[_0xea54('0x33')]=_['intersection'](_0x5f4af8[_0xea54('0x2e')],qs[_0xea54('0x32')](_0x11766d[_0xea54('0x2f')][_0xea54('0x32')]));_0x5757f4[_0xea54('0x33')]=_0x5757f4[_0xea54('0x33')][_0xea54('0x34')]?_0x5757f4['attributes']:_0x5f4af8[_0xea54('0x2e')];if(_0x11766d[_0xea54('0x2f')][_0xea54('0x43')]){_0x5757f4[_0xea54('0x3d')]=[{'all':!![]}];}_0x5757f4=_[_0xea54('0x3a')]({},_0x5757f4,_0x11766d[_0xea54('0x3c')]);return db[_0xea54('0x29')][_0xea54('0x44')](_0x5757f4)[_0xea54('0x24')](handleEntityNotFound(_0x26462d,null))[_0xea54('0x24')](respondWithResult(_0x26462d,null))[_0xea54('0x3f')](handleError(_0x26462d,null));};exports[_0xea54('0x45')]=function(_0x52f7f5,_0x157612){return db[_0xea54('0x29')][_0xea54('0x45')](_0x52f7f5['body'],{})[_0xea54('0x24')](respondWithResult(_0x157612,0xc9))[_0xea54('0x3f')](handleError(_0x157612,null));};exports[_0xea54('0x46')]=function(_0xbf5042,_0x16ac27){if(_0xbf5042[_0xea54('0x47')]['id']){delete _0xbf5042[_0xea54('0x47')]['id'];}return db[_0xea54('0x29')]['find']({'where':{'id':_0xbf5042[_0xea54('0x41')]['id']}})['then'](handleEntityNotFound(_0x16ac27,null))['then'](saveUpdates(_0xbf5042[_0xea54('0x47')],null))[_0xea54('0x24')](respondWithResult(_0x16ac27,null))[_0xea54('0x3f')](handleError(_0x16ac27,null));};exports['destroy']=function(_0x42e580,_0x213e2a){return db[_0xea54('0x29')][_0xea54('0x44')]({'where':{'id':_0x42e580[_0xea54('0x41')]['id']}})[_0xea54('0x24')](handleEntityNotFound(_0x213e2a,null))['then'](removeEntity(_0x213e2a,null))[_0xea54('0x3f')](handleError(_0x213e2a,null));};exports[_0xea54('0x48')]=function(_0x233f5e,_0x592edd){return db[_0xea54('0x29')][_0xea54('0x48')]()[_0xea54('0x24')](respondWithResult(_0x592edd,null))[_0xea54('0x3f')](handleError(_0x592edd,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 402912d..7e654d1 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 _0x01bb=['path','rimraf','./jscriptyQuestionReport.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xc31c37,_0x307735){var _0x45ffb2=function(_0x30edaf){while(--_0x30edaf){_0xc31c37['push'](_0xc31c37['shift']());}};_0x45ffb2(++_0x307735);}(_0x01bb,0x119));var _0xb01b=function(_0xf6831e,_0x320df9){_0xf6831e=_0xf6831e-0x0;var _0x4cc332=_0x01bb[_0xf6831e];return _0x4cc332;};'use strict';var _=require(_0xb01b('0x0'));var util=require(_0xb01b('0x1'));var logger=require(_0xb01b('0x2'))(_0xb01b('0x3'));var moment=require(_0xb01b('0x4'));var BPromise=require(_0xb01b('0x5'));var rp=require(_0xb01b('0x6'));var fs=require('fs');var path=require(_0xb01b('0x7'));var rimraf=require(_0xb01b('0x8'));var config=require('../../config/environment');var attributes=require(_0xb01b('0x9'));module[_0xb01b('0xa')]=function(_0x43d6c3,_0x23bc0b){return _0x43d6c3[_0xb01b('0xb')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6eb1=['report_jscripty_questions','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x5a09e9,_0x391256){var _0x5e4735=function(_0x23d780){while(--_0x23d780){_0x5a09e9['push'](_0x5a09e9['shift']());}};_0x5e4735(++_0x391256);}(_0x6eb1,0xc4));var _0x16eb=function(_0x23a8ba,_0xab5848){_0x23a8ba=_0x23a8ba-0x0;var _0x468389=_0x6eb1[_0x23a8ba];return _0x468389;};'use strict';var _=require(_0x16eb('0x0'));var util=require(_0x16eb('0x1'));var logger=require('../../config/logger')(_0x16eb('0x2'));var moment=require('moment');var BPromise=require(_0x16eb('0x3'));var rp=require(_0x16eb('0x4'));var fs=require('fs');var path=require(_0x16eb('0x5'));var rimraf=require(_0x16eb('0x6'));var config=require(_0x16eb('0x7'));var attributes=require(_0x16eb('0x8'));module[_0x16eb('0x9')]=function(_0x336f51,_0x482659){return _0x336f51[_0x16eb('0xa')](_0x16eb('0xb'),attributes,{'tableName':_0x16eb('0xc'),'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 6a21b33..8bf39e3 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 _0x0aeb=['info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x37d3e0,_0x51d1f4){var _0x5512a3=function(_0x496e6b){while(--_0x496e6b){_0x37d3e0['push'](_0x37d3e0['shift']());}};_0x5512a3(++_0x51d1f4);}(_0x0aeb,0x77));var _0xb0ae=function(_0x593b09,_0x52de66){_0x593b09=_0x593b09-0x0;var _0x58f8fa=_0x0aeb[_0x593b09];return _0x58f8fa;};'use strict';var _=require(_0xb0ae('0x0'));var util=require(_0xb0ae('0x1'));var moment=require(_0xb0ae('0x2'));var BPromise=require(_0xb0ae('0x3'));var rs=require(_0xb0ae('0x4'));var fs=require('fs');var Redis=require(_0xb0ae('0x5'));var db=require(_0xb0ae('0x6'))['db'];var utils=require(_0xb0ae('0x7'));var logger=require(_0xb0ae('0x8'))(_0xb0ae('0x9'));var config=require(_0xb0ae('0xa'));var jayson=require(_0xb0ae('0xb'));var client=jayson[_0xb0ae('0xc')][_0xb0ae('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1a75bb,_0x5154e0,_0x363265){return new BPromise(function(_0x5705c5,_0x29f62a){return client[_0xb0ae('0xe')](_0x1a75bb,_0x363265)[_0xb0ae('0xf')](function(_0xb78b7e){logger[_0xb0ae('0x10')](_0xb0ae('0x11'),_0x5154e0,'request\x20sent');logger[_0xb0ae('0x12')](_0xb0ae('0x13'),_0x5154e0,_0xb0ae('0x14'),JSON[_0xb0ae('0x15')](_0xb78b7e));if(_0xb78b7e[_0xb0ae('0x16')]){if(_0xb78b7e[_0xb0ae('0x16')][_0xb0ae('0x17')]===0x1f4){logger['error'](_0xb0ae('0x11'),_0x5154e0,_0xb78b7e[_0xb0ae('0x16')]['message']);return _0x29f62a(_0xb78b7e['error'][_0xb0ae('0x18')]);}logger['error'](_0xb0ae('0x11'),_0x5154e0,_0xb78b7e[_0xb0ae('0x16')]['message']);return _0x5705c5(_0xb78b7e[_0xb0ae('0x16')][_0xb0ae('0x18')]);}else{logger['info'](_0xb0ae('0x11'),_0x5154e0,_0xb0ae('0x14'));_0x5705c5(_0xb78b7e[_0xb0ae('0x19')][_0xb0ae('0x18')]);}})[_0xb0ae('0x1a')](function(_0x3f75a8){logger[_0xb0ae('0x16')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5154e0,_0x3f75a8);_0x29f62a(_0x3f75a8);});});} \ No newline at end of file +var _0xb925=['../../mysqldb','../../config/logger','rpc','http','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash','moment','bluebird','ioredis'];(function(_0x214d8f,_0x4d08fa){var _0x2c22ec=function(_0xcc545c){while(--_0xcc545c){_0x214d8f['push'](_0x214d8f['shift']());}};_0x2c22ec(++_0x4d08fa);}(_0xb925,0xce));var _0x5b92=function(_0x252328,_0x4c22f0){_0x252328=_0x252328-0x0;var _0xaa85b7=_0xb925[_0x252328];return _0xaa85b7;};'use strict';var _=require(_0x5b92('0x0'));var util=require('util');var moment=require(_0x5b92('0x1'));var BPromise=require(_0x5b92('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b92('0x3'));var db=require(_0x5b92('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b92('0x5'))(_0x5b92('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5b92('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1669f1,_0x35ce75,_0x5bf29f){return new BPromise(function(_0x2159eb,_0x10137b){return client['request'](_0x1669f1,_0x5bf29f)['then'](function(_0x2d44d1){logger[_0x5b92('0x8')](_0x5b92('0x9'),_0x35ce75,_0x5b92('0xa'));logger[_0x5b92('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x35ce75,_0x5b92('0xa'),JSON['stringify'](_0x2d44d1));if(_0x2d44d1[_0x5b92('0xc')]){if(_0x2d44d1[_0x5b92('0xc')][_0x5b92('0xd')]===0x1f4){logger[_0x5b92('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x35ce75,_0x2d44d1[_0x5b92('0xc')][_0x5b92('0xe')]);return _0x10137b(_0x2d44d1['error']['message']);}logger[_0x5b92('0xc')](_0x5b92('0x9'),_0x35ce75,_0x2d44d1[_0x5b92('0xc')][_0x5b92('0xe')]);return _0x2159eb(_0x2d44d1['error'][_0x5b92('0xe')]);}else{logger[_0x5b92('0x8')](_0x5b92('0x9'),_0x35ce75,_0x5b92('0xa'));_0x2159eb(_0x2d44d1['result']['message']);}})['catch'](function(_0x22f566){logger[_0x5b92('0xc')](_0x5b92('0x9'),_0x35ce75,_0x22f566);_0x10137b(_0x22f566);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index f50e35c..f6356a3 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 _0x420f=['update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','show','getQuestions','create','put'];(function(_0x49c122,_0xcf102a){var _0x2cd1d1=function(_0xa578a7){while(--_0xa578a7){_0x49c122['push'](_0x49c122['shift']());}};_0x2cd1d1(++_0xcf102a);}(_0x420f,0x164));var _0xf420=function(_0x2b2564,_0x1e1124){_0x2b2564=_0x2b2564-0x0;var _0xa97e01=_0x420f[_0x2b2564];return _0xa97e01;};'use strict';var multer=require('multer');var util=require(_0xf420('0x0'));var path=require(_0xf420('0x1'));var timeout=require(_0xf420('0x2'));var express=require('express');var router=express[_0xf420('0x3')]();var fs_extra=require(_0xf420('0x4'));var auth=require(_0xf420('0x5'));var interaction=require(_0xf420('0x6'));var config=require(_0xf420('0x7'));var controller=require(_0xf420('0x8'));router[_0xf420('0x9')]('/',auth[_0xf420('0xa')](),controller[_0xf420('0xb')]);router[_0xf420('0x9')]('/describe',auth[_0xf420('0xa')](),controller[_0xf420('0xc')]);router[_0xf420('0x9')](_0xf420('0xd'),auth['isAuthenticated'](),controller[_0xf420('0xe')]);router['get']('/:id/questions',auth['isAuthenticated'](),controller[_0xf420('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf420('0x10')]);router[_0xf420('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf420('0x12')]);router[_0xf420('0x13')]('/:id',auth[_0xf420('0xa')](),controller[_0xf420('0x14')]);module[_0xf420('0x15')]=router; \ No newline at end of file +var _0x2be0=['put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/questions','getQuestions','post','create'];(function(_0x269c42,_0xeed101){var _0x4dad76=function(_0x167b87){while(--_0x167b87){_0x269c42['push'](_0x269c42['shift']());}};_0x4dad76(++_0xeed101);}(_0x2be0,0xe9));var _0x02be=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x2be0[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0x02be('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x02be('0x1'));var express=require(_0x02be('0x2'));var router=express[_0x02be('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x02be('0x4'));var config=require(_0x02be('0x5'));var controller=require('./jscriptySessionReport.controller');router[_0x02be('0x6')]('/',auth[_0x02be('0x7')](),controller[_0x02be('0x8')]);router[_0x02be('0x6')]('/describe',auth[_0x02be('0x7')](),controller['describe']);router[_0x02be('0x6')](_0x02be('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x02be('0x6')](_0x02be('0xa'),auth[_0x02be('0x7')](),controller[_0x02be('0xb')]);router[_0x02be('0xc')]('/',auth[_0x02be('0x7')](),controller[_0x02be('0xd')]);router[_0x02be('0xe')](_0x02be('0x9'),auth[_0x02be('0x7')](),controller[_0x02be('0xf')]);router[_0x02be('0x10')]('/:id',auth[_0x02be('0x7')](),controller[_0x02be('0x11')]);module[_0x02be('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 15d1cde..c0f3f50 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 _0xa945=['moment','sequelize','exports','setDataValue','format','DATE','STRING','BOOLEAN'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xa945,0x118));var _0x5a94=function(_0x1f61e2,_0x1b6e0f){_0x1f61e2=_0x1f61e2-0x0;var _0x2276fc=_0xa945[_0x1f61e2];return _0x2276fc;};'use strict';var moment=require(_0x5a94('0x0'));var Sequelize=require(_0x5a94('0x1'));module[_0x5a94('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x48bb92){this[_0x5a94('0x3')]('starttime',_0x48bb92);this[_0x5a94('0x3')]('endtime',moment()[_0x5a94('0x4')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x5a94('0x5')]},'membername':{'type':Sequelize[_0x5a94('0x6')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x5a94('0x6')]},'uniqueid':{'type':Sequelize[_0x5a94('0x6')]},'calleridname':{'type':Sequelize[_0x5a94('0x6')]},'calleridnum':{'type':Sequelize[_0x5a94('0x6')]},'completed':{'type':Sequelize[_0x5a94('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x3fe9=['format','STRING','BOOLEAN','moment','sequelize','DATE','starttime','endtime'];(function(_0x45a2ee,_0x3a2e2b){var _0x5e310e=function(_0x1b52fd){while(--_0x1b52fd){_0x45a2ee['push'](_0x45a2ee['shift']());}};_0x5e310e(++_0x3a2e2b);}(_0x3fe9,0x133));var _0x93fe=function(_0x17db19,_0x5de4f4){_0x17db19=_0x17db19-0x0;var _0x2b5370=_0x3fe9[_0x17db19];return _0x2b5370;};'use strict';var moment=require(_0x93fe('0x0'));var Sequelize=require(_0x93fe('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x93fe('0x2')],'set':function(_0x308158){this['setDataValue'](_0x93fe('0x3'),_0x308158);this['setDataValue'](_0x93fe('0x4'),moment()[_0x93fe('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x93fe('0x2')]},'membername':{'type':Sequelize[_0x93fe('0x6')]},'projectname':{'type':Sequelize[_0x93fe('0x6')]},'queue':{'type':Sequelize[_0x93fe('0x6')]},'uniqueid':{'type':Sequelize[_0x93fe('0x6')]},'calleridname':{'type':Sequelize[_0x93fe('0x6')]},'calleridnum':{'type':Sequelize[_0x93fe('0x6')]},'completed':{'type':Sequelize[_0x93fe('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 6f1040d..9e5c51b 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 _0xa1a3=['send','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','pick','SessionId','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','sendStatus','error','stack','name'];(function(_0x3ffa7a,_0x25b11d){var _0x4b2a13=function(_0x3b1ecd){while(--_0x3b1ecd){_0x3ffa7a['push'](_0x3ffa7a['shift']());}};_0x4b2a13(++_0x25b11d);}(_0xa1a3,0xc6));var _0x3a1a=function(_0x42718a,_0x124920){_0x42718a=_0x42718a-0x0;var _0x12012e=_0xa1a3[_0x42718a];return _0x12012e;};'use strict';var emlformat=require(_0x3a1a('0x0'));var rimraf=require(_0x3a1a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a1a('0x2'));var rp=require(_0x3a1a('0x3'));var moment=require('moment');var BPromise=require(_0x3a1a('0x4'));var Mustache=require(_0x3a1a('0x5'));var util=require(_0x3a1a('0x6'));var path=require('path');var sox=require(_0x3a1a('0x7'));var csv=require(_0x3a1a('0x8'));var ejs=require(_0x3a1a('0x9'));var fs=require('fs');var fs_extra=require(_0x3a1a('0xa'));var _=require(_0x3a1a('0xb'));var squel=require(_0x3a1a('0xc'));var crypto=require('crypto');var jsforce=require(_0x3a1a('0xd'));var deskjs=require(_0x3a1a('0xe'));var toCsv=require(_0x3a1a('0x8'));var querystring=require('querystring');var Papa=require(_0x3a1a('0xf'));var Redis=require('ioredis');var authService=require(_0x3a1a('0x10'));var qs=require(_0x3a1a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3a1a('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3a1a('0x13'));var licenseUtil=require(_0x3a1a('0x14'));var db=require(_0x3a1a('0x15'))['db'];function respondWithStatusCode(_0x474351,_0x3f1c31){_0x3f1c31=_0x3f1c31||0xcc;return function(_0x48e146){if(_0x48e146){return _0x474351['sendStatus'](_0x3f1c31);}return _0x474351[_0x3a1a('0x16')](_0x3f1c31)[_0x3a1a('0x17')]();};}function respondWithResult(_0x238d69,_0x4b4cc6){_0x4b4cc6=_0x4b4cc6||0xc8;return function(_0x1b5d7a){if(_0x1b5d7a){return _0x238d69[_0x3a1a('0x16')](_0x4b4cc6)[_0x3a1a('0x18')](_0x1b5d7a);}};}function respondWithFilteredResult(_0x41a60a,_0x1ba146){return function(_0x37ab18){if(_0x37ab18){var _0x1fff47=typeof _0x1ba146[_0x3a1a('0x19')]===_0x3a1a('0x1a')&&typeof _0x1ba146[_0x3a1a('0x1b')]===_0x3a1a('0x1a');var _0xc49575=_0x37ab18[_0x3a1a('0x1c')];var _0x3b1659=_0x1fff47?0x0:_0x1ba146['offset'];var _0x683338=_0x1fff47?_0x37ab18[_0x3a1a('0x1c')]:_0x1ba146[_0x3a1a('0x19')]+_0x1ba146[_0x3a1a('0x1b')];var _0x54e265;if(_0x683338>=_0xc49575){_0x683338=_0xc49575;_0x54e265=0xc8;}else{_0x54e265=0xce;}_0x41a60a[_0x3a1a('0x16')](_0x54e265);return _0x41a60a['set']('Content-Range',_0x3b1659+'-'+_0x683338+'/'+_0xc49575)[_0x3a1a('0x18')](_0x37ab18);}return null;};}function patchUpdates(_0x1fedda){return function(_0x42bf33){try{jsonpatch[_0x3a1a('0x1d')](_0x42bf33,_0x1fedda,!![]);}catch(_0x59c522){return BPromise[_0x3a1a('0x1e')](_0x59c522);}return _0x42bf33[_0x3a1a('0x1f')]();};}function saveUpdates(_0x5da914,_0x6046e){return function(_0x4901c5){if(_0x4901c5){return _0x4901c5[_0x3a1a('0x20')](_0x5da914)[_0x3a1a('0x21')](function(_0x51115f){return _0x51115f;});}return null;};}function removeEntity(_0x48654e,_0x58657e){return function(_0x406377){if(_0x406377){return _0x406377[_0x3a1a('0x22')]()[_0x3a1a('0x21')](function(){_0x48654e[_0x3a1a('0x16')](0xcc)[_0x3a1a('0x17')]();});}};}function handleEntityNotFound(_0x2d2889,_0x23f141){return function(_0x73e46f){if(!_0x73e46f){_0x2d2889[_0x3a1a('0x23')](0x194);}return _0x73e46f;};}function handleError(_0x588d08,_0xf3a368){_0xf3a368=_0xf3a368||0x1f4;return function(_0x52d79a){logger[_0x3a1a('0x24')](_0x52d79a[_0x3a1a('0x25')]);if(_0x52d79a[_0x3a1a('0x26')]){delete _0x52d79a[_0x3a1a('0x26')];}_0x588d08[_0x3a1a('0x16')](_0xf3a368)[_0x3a1a('0x27')](_0x52d79a);};}exports['index']=function(_0x433000,_0x8d7fe5){var _0x5e884c={},_0x26fec2={},_0x9d81f6={'count':0x0,'rows':[]};var _0x35209f=_['map'](db['JscriptySessionReport'][_0x3a1a('0x28')],function(_0x24c668){return{'name':_0x24c668[_0x3a1a('0x29')],'type':_0x24c668[_0x3a1a('0x2a')][_0x3a1a('0x2b')]};});_0x26fec2[_0x3a1a('0x2c')]=_['map'](_0x35209f,_0x3a1a('0x26'));_0x26fec2[_0x3a1a('0x2d')]=_[_0x3a1a('0x2e')](_0x433000['query']);_0x26fec2[_0x3a1a('0x2f')]=_[_0x3a1a('0x30')](_0x26fec2[_0x3a1a('0x2c')],_0x26fec2[_0x3a1a('0x2d')]);_0x5e884c[_0x3a1a('0x31')]=_[_0x3a1a('0x30')](_0x26fec2[_0x3a1a('0x2c')],qs[_0x3a1a('0x32')](_0x433000[_0x3a1a('0x2d')][_0x3a1a('0x32')]));_0x5e884c['attributes']=_0x5e884c[_0x3a1a('0x31')][_0x3a1a('0x33')]?_0x5e884c['attributes']:_0x26fec2[_0x3a1a('0x2c')];if(!_0x433000[_0x3a1a('0x2d')][_0x3a1a('0x34')](_0x3a1a('0x35'))){_0x5e884c[_0x3a1a('0x1b')]=qs['limit'](_0x433000['query']['limit']);_0x5e884c[_0x3a1a('0x19')]=qs[_0x3a1a('0x19')](_0x433000['query'][_0x3a1a('0x19')]);}_0x5e884c[_0x3a1a('0x36')]=qs[_0x3a1a('0x37')](_0x433000[_0x3a1a('0x2d')]['sort']);_0x5e884c[_0x3a1a('0x38')]=qs[_0x3a1a('0x2f')](_['pick'](_0x433000[_0x3a1a('0x2d')],_0x26fec2[_0x3a1a('0x2f')]),_0x35209f);if(_0x433000[_0x3a1a('0x2d')][_0x3a1a('0x39')]){_0x5e884c['where']=_[_0x3a1a('0x3a')](_0x5e884c[_0x3a1a('0x38')],{'$or':_[_0x3a1a('0x3b')](_0x35209f,function(_0x288901){if(_0x288901[_0x3a1a('0x2a')]!==_0x3a1a('0x3c')){var _0x50219f={};_0x50219f[_0x288901[_0x3a1a('0x26')]]={'$like':'%'+_0x433000[_0x3a1a('0x2d')]['filter']+'%'};return _0x50219f;}})});}_0x5e884c=_[_0x3a1a('0x3a')]({},_0x5e884c,_0x433000[_0x3a1a('0x3d')]);var _0x12de23={'where':_0x5e884c[_0x3a1a('0x38')]};return db[_0x3a1a('0x3e')][_0x3a1a('0x1c')](_0x12de23)['then'](function(_0x19411c){_0x9d81f6[_0x3a1a('0x1c')]=_0x19411c;if(_0x433000['query'][_0x3a1a('0x3f')]){_0x5e884c[_0x3a1a('0x40')]=[{'all':!![]}];}return db[_0x3a1a('0x3e')][_0x3a1a('0x41')](_0x5e884c);})[_0x3a1a('0x21')](function(_0x388d0b){_0x9d81f6[_0x3a1a('0x42')]=_0x388d0b;return _0x9d81f6;})[_0x3a1a('0x21')](respondWithFilteredResult(_0x8d7fe5,_0x5e884c))[_0x3a1a('0x43')](handleError(_0x8d7fe5,null));};exports[_0x3a1a('0x44')]=function(_0x2359fe,_0x1bfb1e){var _0x1e1b7d={'raw':!![],'where':{'id':_0x2359fe[_0x3a1a('0x45')]['id']}},_0x44cf04={};_0x44cf04['model']=_[_0x3a1a('0x2e')](db[_0x3a1a('0x3e')]['rawAttributes']);_0x44cf04['query']=_['keys'](_0x2359fe[_0x3a1a('0x2d')]);_0x44cf04['filters']=_[_0x3a1a('0x30')](_0x44cf04[_0x3a1a('0x2c')],_0x44cf04['query']);_0x1e1b7d[_0x3a1a('0x31')]=_[_0x3a1a('0x30')](_0x44cf04[_0x3a1a('0x2c')],qs['fields'](_0x2359fe['query'][_0x3a1a('0x32')]));_0x1e1b7d['attributes']=_0x1e1b7d['attributes'][_0x3a1a('0x33')]?_0x1e1b7d[_0x3a1a('0x31')]:_0x44cf04[_0x3a1a('0x2c')];if(_0x2359fe[_0x3a1a('0x2d')][_0x3a1a('0x3f')]){_0x1e1b7d[_0x3a1a('0x40')]=[{'all':!![]}];}_0x1e1b7d=_[_0x3a1a('0x3a')]({},_0x1e1b7d,_0x2359fe[_0x3a1a('0x3d')]);return db['JscriptySessionReport'][_0x3a1a('0x46')](_0x1e1b7d)[_0x3a1a('0x21')](handleEntityNotFound(_0x1bfb1e,null))['then'](respondWithResult(_0x1bfb1e,null))[_0x3a1a('0x43')](handleError(_0x1bfb1e,null));};exports[_0x3a1a('0x47')]=function(_0x434966,_0x2810c0){return db[_0x3a1a('0x3e')][_0x3a1a('0x47')](_0x434966[_0x3a1a('0x48')],{})[_0x3a1a('0x21')](respondWithResult(_0x2810c0,0xc9))[_0x3a1a('0x43')](handleError(_0x2810c0,null));};exports[_0x3a1a('0x20')]=function(_0x4d9858,_0x33026a){if(_0x4d9858[_0x3a1a('0x48')]['id']){delete _0x4d9858[_0x3a1a('0x48')]['id'];}return db[_0x3a1a('0x3e')][_0x3a1a('0x46')]({'where':{'id':_0x4d9858[_0x3a1a('0x45')]['id']}})['then'](handleEntityNotFound(_0x33026a,null))[_0x3a1a('0x21')](saveUpdates(_0x4d9858[_0x3a1a('0x48')],null))[_0x3a1a('0x21')](respondWithResult(_0x33026a,null))[_0x3a1a('0x43')](handleError(_0x33026a,null));};exports['destroy']=function(_0x222d66,_0x4a11a8){return db[_0x3a1a('0x3e')][_0x3a1a('0x46')]({'where':{'id':_0x222d66[_0x3a1a('0x45')]['id']}})[_0x3a1a('0x21')](handleEntityNotFound(_0x4a11a8,null))[_0x3a1a('0x21')](removeEntity(_0x4a11a8,null))[_0x3a1a('0x43')](handleError(_0x4a11a8,null));};exports['describe']=function(_0x68b24e,_0x1a9f3d){return db[_0x3a1a('0x3e')][_0x3a1a('0x49')]()[_0x3a1a('0x21')](respondWithResult(_0x1a9f3d,null))['catch'](handleError(_0x1a9f3d,null));};exports[_0x3a1a('0x4a')]=function(_0x196cde,_0x676303,_0x3bdf9d){var _0x60cf7b={'raw':!![],'where':{}};var _0x296c36={};var _0x7b98ee={'count':0x0,'rows':[]};return db[_0x3a1a('0x3e')][_0x3a1a('0x4b')]({'where':{'id':_0x196cde[_0x3a1a('0x45')]['id']}})[_0x3a1a('0x21')](handleEntityNotFound(_0x676303,null))['then'](function(_0x476d29){if(_0x476d29){_0x296c36[_0x3a1a('0x2c')]=_[_0x3a1a('0x2e')](db[_0x3a1a('0x4c')][_0x3a1a('0x28')]);_0x296c36['query']=_[_0x3a1a('0x2e')](_0x196cde[_0x3a1a('0x2d')]);_0x296c36[_0x3a1a('0x2f')]=_[_0x3a1a('0x30')](_0x296c36[_0x3a1a('0x2c')],_0x296c36[_0x3a1a('0x2d')]);_0x60cf7b[_0x3a1a('0x31')]=_[_0x3a1a('0x30')](_0x296c36['model'],qs['fields'](_0x196cde[_0x3a1a('0x2d')][_0x3a1a('0x32')]));_0x60cf7b[_0x3a1a('0x31')]=_0x60cf7b[_0x3a1a('0x31')]['length']?_0x60cf7b[_0x3a1a('0x31')]:_0x296c36[_0x3a1a('0x2c')];if(!_0x196cde[_0x3a1a('0x2d')][_0x3a1a('0x34')](_0x3a1a('0x35'))){_0x60cf7b[_0x3a1a('0x1b')]=qs[_0x3a1a('0x1b')](_0x196cde['query']['limit']);_0x60cf7b[_0x3a1a('0x19')]=qs[_0x3a1a('0x19')](_0x196cde[_0x3a1a('0x2d')][_0x3a1a('0x19')]);}_0x60cf7b[_0x3a1a('0x36')]=qs['sort'](_0x196cde[_0x3a1a('0x2d')]['sort']);_0x60cf7b['where']=qs['filters'](_[_0x3a1a('0x4d')](_0x196cde[_0x3a1a('0x2d')],_0x296c36['filters']));_0x60cf7b['where'][_0x3a1a('0x4e')]=_0x476d29['id'];if(_0x196cde[_0x3a1a('0x2d')][_0x3a1a('0x39')]){_0x60cf7b[_0x3a1a('0x38')]=_[_0x3a1a('0x3a')](_0x60cf7b[_0x3a1a('0x38')],{'$or':_['map'](_0x60cf7b[_0x3a1a('0x31')],function(_0x5858f1){var _0x403c9c={};_0x403c9c[_0x5858f1]={'$like':'%'+_0x196cde[_0x3a1a('0x2d')][_0x3a1a('0x39')]+'%'};return _0x403c9c;})});}_0x60cf7b=_[_0x3a1a('0x3a')]({},_0x60cf7b,_0x196cde[_0x3a1a('0x3d')]);return db['JscriptyQuestionReport'][_0x3a1a('0x1c')]({'where':_0x60cf7b['where']})[_0x3a1a('0x21')](function(_0x339898){_0x7b98ee[_0x3a1a('0x1c')]=_0x339898;if(_0x196cde[_0x3a1a('0x2d')][_0x3a1a('0x3f')]){_0x60cf7b[_0x3a1a('0x40')]=[{'all':!![]}];}return db[_0x3a1a('0x4c')][_0x3a1a('0x41')](_0x60cf7b);})[_0x3a1a('0x21')](function(_0x2c1272){_0x7b98ee[_0x3a1a('0x42')]=_0x2c1272;return _0x7b98ee;});}})[_0x3a1a('0x21')](respondWithFilteredResult(_0x676303,_0x60cf7b))[_0x3a1a('0x43')](handleError(_0x676303,null));}; \ No newline at end of file +var _0xadf1=['bluebird','mustache','path','sox','to-csv','ejs','fs-extra','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','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','name','index','map','rawAttributes','fieldName','query','keys','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','show','params','intersection','length','create','body','find','describe','getQuestions','findOne','SessionId','JscriptyQuestionReport','eml-format','rimraf','fast-json-patch','moment'];(function(_0x4ea427,_0xbd2445){var _0x28cbae=function(_0x562ec5){while(--_0x562ec5){_0x4ea427['push'](_0x4ea427['shift']());}};_0x28cbae(++_0xbd2445);}(_0xadf1,0xf5));var _0x1adf=function(_0x39a1da,_0x2d9008){_0x39a1da=_0x39a1da-0x0;var _0x1cc7e3=_0xadf1[_0x39a1da];return _0x1cc7e3;};'use strict';var emlformat=require(_0x1adf('0x0'));var rimraf=require(_0x1adf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1adf('0x2'));var rp=require('request-promise');var moment=require(_0x1adf('0x3'));var BPromise=require(_0x1adf('0x4'));var Mustache=require(_0x1adf('0x5'));var util=require('util');var path=require(_0x1adf('0x6'));var sox=require(_0x1adf('0x7'));var csv=require(_0x1adf('0x8'));var ejs=require(_0x1adf('0x9'));var fs=require('fs');var fs_extra=require(_0x1adf('0xa'));var _=require('lodash');var squel=require(_0x1adf('0xb'));var crypto=require(_0x1adf('0xc'));var jsforce=require(_0x1adf('0xd'));var deskjs=require(_0x1adf('0xe'));var toCsv=require(_0x1adf('0x8'));var querystring=require(_0x1adf('0xf'));var Papa=require('papaparse');var Redis=require(_0x1adf('0x10'));var authService=require(_0x1adf('0x11'));var qs=require(_0x1adf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1adf('0x13'));var logger=require(_0x1adf('0x14'))(_0x1adf('0x15'));var utils=require(_0x1adf('0x16'));var config=require(_0x1adf('0x17'));var licenseUtil=require(_0x1adf('0x18'));var db=require(_0x1adf('0x19'))['db'];function respondWithStatusCode(_0x38df53,_0x451824){_0x451824=_0x451824||0xcc;return function(_0x3371fb){if(_0x3371fb){return _0x38df53[_0x1adf('0x1a')](_0x451824);}return _0x38df53[_0x1adf('0x1b')](_0x451824)['end']();};}function respondWithResult(_0x4d5ee7,_0x3db0b7){_0x3db0b7=_0x3db0b7||0xc8;return function(_0x10c73d){if(_0x10c73d){return _0x4d5ee7[_0x1adf('0x1b')](_0x3db0b7)['json'](_0x10c73d);}};}function respondWithFilteredResult(_0x261a17,_0x13099c){return function(_0x1e6c17){if(_0x1e6c17){var _0x130f1f=typeof _0x13099c[_0x1adf('0x1c')]==='undefined'&&typeof _0x13099c[_0x1adf('0x1d')]===_0x1adf('0x1e');var _0x5d5297=_0x1e6c17['count'];var _0x14d2ae=_0x130f1f?0x0:_0x13099c[_0x1adf('0x1c')];var _0x1db6e2=_0x130f1f?_0x1e6c17[_0x1adf('0x1f')]:_0x13099c['offset']+_0x13099c[_0x1adf('0x1d')];var _0x3610ef;if(_0x1db6e2>=_0x5d5297){_0x1db6e2=_0x5d5297;_0x3610ef=0xc8;}else{_0x3610ef=0xce;}_0x261a17[_0x1adf('0x1b')](_0x3610ef);return _0x261a17[_0x1adf('0x20')](_0x1adf('0x21'),_0x14d2ae+'-'+_0x1db6e2+'/'+_0x5d5297)[_0x1adf('0x22')](_0x1e6c17);}return null;};}function patchUpdates(_0x5a66f9){return function(_0x197211){try{jsonpatch[_0x1adf('0x23')](_0x197211,_0x5a66f9,!![]);}catch(_0x363ae2){return BPromise[_0x1adf('0x24')](_0x363ae2);}return _0x197211[_0x1adf('0x25')]();};}function saveUpdates(_0x16989a,_0x3fd784){return function(_0x54b62b){if(_0x54b62b){return _0x54b62b[_0x1adf('0x26')](_0x16989a)['then'](function(_0x1a01b7){return _0x1a01b7;});}return null;};}function removeEntity(_0x3ce3b0,_0x5ef823){return function(_0x167d59){if(_0x167d59){return _0x167d59[_0x1adf('0x27')]()[_0x1adf('0x28')](function(){_0x3ce3b0[_0x1adf('0x1b')](0xcc)[_0x1adf('0x29')]();});}};}function handleEntityNotFound(_0x491f78,_0x565191){return function(_0x55cde2){if(!_0x55cde2){_0x491f78[_0x1adf('0x1a')](0x194);}return _0x55cde2;};}function handleError(_0x4615af,_0x5e2dfe){_0x5e2dfe=_0x5e2dfe||0x1f4;return function(_0x43c6ed){logger[_0x1adf('0x2a')](_0x43c6ed['stack']);if(_0x43c6ed[_0x1adf('0x2b')]){delete _0x43c6ed[_0x1adf('0x2b')];}_0x4615af['status'](_0x5e2dfe)['send'](_0x43c6ed);};}exports[_0x1adf('0x2c')]=function(_0x5ac496,_0x22aff1){var _0x45ef06={},_0x15f0fd={},_0x388312={'count':0x0,'rows':[]};var _0xd402a1=_[_0x1adf('0x2d')](db['JscriptySessionReport'][_0x1adf('0x2e')],function(_0x3e167b){return{'name':_0x3e167b[_0x1adf('0x2f')],'type':_0x3e167b['type']['key']};});_0x15f0fd['model']=_[_0x1adf('0x2d')](_0xd402a1,'name');_0x15f0fd[_0x1adf('0x30')]=_[_0x1adf('0x31')](_0x5ac496[_0x1adf('0x30')]);_0x15f0fd[_0x1adf('0x32')]=_['intersection'](_0x15f0fd[_0x1adf('0x33')],_0x15f0fd['query']);_0x45ef06['attributes']=_['intersection'](_0x15f0fd['model'],qs[_0x1adf('0x34')](_0x5ac496['query']['fields']));_0x45ef06[_0x1adf('0x35')]=_0x45ef06[_0x1adf('0x35')]['length']?_0x45ef06[_0x1adf('0x35')]:_0x15f0fd['model'];if(!_0x5ac496[_0x1adf('0x30')][_0x1adf('0x36')](_0x1adf('0x37'))){_0x45ef06[_0x1adf('0x1d')]=qs[_0x1adf('0x1d')](_0x5ac496[_0x1adf('0x30')][_0x1adf('0x1d')]);_0x45ef06[_0x1adf('0x1c')]=qs[_0x1adf('0x1c')](_0x5ac496[_0x1adf('0x30')][_0x1adf('0x1c')]);}_0x45ef06[_0x1adf('0x38')]=qs[_0x1adf('0x39')](_0x5ac496[_0x1adf('0x30')][_0x1adf('0x39')]);_0x45ef06[_0x1adf('0x3a')]=qs[_0x1adf('0x32')](_[_0x1adf('0x3b')](_0x5ac496['query'],_0x15f0fd['filters']),_0xd402a1);if(_0x5ac496[_0x1adf('0x30')][_0x1adf('0x3c')]){_0x45ef06[_0x1adf('0x3a')]=_['merge'](_0x45ef06[_0x1adf('0x3a')],{'$or':_[_0x1adf('0x2d')](_0xd402a1,function(_0x4aefcd){if(_0x4aefcd[_0x1adf('0x3d')]!==_0x1adf('0x3e')){var _0x2b9853={};_0x2b9853[_0x4aefcd[_0x1adf('0x2b')]]={'$like':'%'+_0x5ac496[_0x1adf('0x30')][_0x1adf('0x3c')]+'%'};return _0x2b9853;}})});}_0x45ef06=_[_0x1adf('0x3f')]({},_0x45ef06,_0x5ac496[_0x1adf('0x40')]);var _0x9de5f4={'where':_0x45ef06[_0x1adf('0x3a')]};return db[_0x1adf('0x41')]['count'](_0x9de5f4)[_0x1adf('0x28')](function(_0x57ba61){_0x388312['count']=_0x57ba61;if(_0x5ac496[_0x1adf('0x30')][_0x1adf('0x42')]){_0x45ef06[_0x1adf('0x43')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x1adf('0x44')](_0x45ef06);})[_0x1adf('0x28')](function(_0x3545f8){_0x388312[_0x1adf('0x45')]=_0x3545f8;return _0x388312;})['then'](respondWithFilteredResult(_0x22aff1,_0x45ef06))[_0x1adf('0x46')](handleError(_0x22aff1,null));};exports[_0x1adf('0x47')]=function(_0x8b6149,_0x1c7a59){var _0x215cef={'raw':!![],'where':{'id':_0x8b6149[_0x1adf('0x48')]['id']}},_0x2ca300={};_0x2ca300['model']=_[_0x1adf('0x31')](db[_0x1adf('0x41')][_0x1adf('0x2e')]);_0x2ca300[_0x1adf('0x30')]=_['keys'](_0x8b6149[_0x1adf('0x30')]);_0x2ca300[_0x1adf('0x32')]=_[_0x1adf('0x49')](_0x2ca300[_0x1adf('0x33')],_0x2ca300[_0x1adf('0x30')]);_0x215cef[_0x1adf('0x35')]=_[_0x1adf('0x49')](_0x2ca300['model'],qs[_0x1adf('0x34')](_0x8b6149[_0x1adf('0x30')][_0x1adf('0x34')]));_0x215cef[_0x1adf('0x35')]=_0x215cef['attributes'][_0x1adf('0x4a')]?_0x215cef[_0x1adf('0x35')]:_0x2ca300[_0x1adf('0x33')];if(_0x8b6149['query'][_0x1adf('0x42')]){_0x215cef[_0x1adf('0x43')]=[{'all':!![]}];}_0x215cef=_['merge']({},_0x215cef,_0x8b6149[_0x1adf('0x40')]);return db[_0x1adf('0x41')]['find'](_0x215cef)[_0x1adf('0x28')](handleEntityNotFound(_0x1c7a59,null))[_0x1adf('0x28')](respondWithResult(_0x1c7a59,null))[_0x1adf('0x46')](handleError(_0x1c7a59,null));};exports[_0x1adf('0x4b')]=function(_0x32b0ed,_0x3aa8e9){return db['JscriptySessionReport'][_0x1adf('0x4b')](_0x32b0ed['body'],{})[_0x1adf('0x28')](respondWithResult(_0x3aa8e9,0xc9))['catch'](handleError(_0x3aa8e9,null));};exports[_0x1adf('0x26')]=function(_0x5db005,_0x19f69a){if(_0x5db005[_0x1adf('0x4c')]['id']){delete _0x5db005[_0x1adf('0x4c')]['id'];}return db['JscriptySessionReport'][_0x1adf('0x4d')]({'where':{'id':_0x5db005[_0x1adf('0x48')]['id']}})[_0x1adf('0x28')](handleEntityNotFound(_0x19f69a,null))[_0x1adf('0x28')](saveUpdates(_0x5db005[_0x1adf('0x4c')],null))['then'](respondWithResult(_0x19f69a,null))[_0x1adf('0x46')](handleError(_0x19f69a,null));};exports[_0x1adf('0x27')]=function(_0x4f47e8,_0x3d7905){return db['JscriptySessionReport'][_0x1adf('0x4d')]({'where':{'id':_0x4f47e8[_0x1adf('0x48')]['id']}})[_0x1adf('0x28')](handleEntityNotFound(_0x3d7905,null))[_0x1adf('0x28')](removeEntity(_0x3d7905,null))[_0x1adf('0x46')](handleError(_0x3d7905,null));};exports[_0x1adf('0x4e')]=function(_0x5f5750,_0x288b0e){return db['JscriptySessionReport']['describe']()[_0x1adf('0x28')](respondWithResult(_0x288b0e,null))[_0x1adf('0x46')](handleError(_0x288b0e,null));};exports[_0x1adf('0x4f')]=function(_0x3df99c,_0x335d58,_0x497d80){var _0x465317={'raw':!![],'where':{}};var _0xc3b54e={};var _0x563fcc={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x1adf('0x50')]({'where':{'id':_0x3df99c[_0x1adf('0x48')]['id']}})[_0x1adf('0x28')](handleEntityNotFound(_0x335d58,null))[_0x1adf('0x28')](function(_0x18ee32){if(_0x18ee32){_0xc3b54e[_0x1adf('0x33')]=_[_0x1adf('0x31')](db['JscriptyQuestionReport']['rawAttributes']);_0xc3b54e[_0x1adf('0x30')]=_[_0x1adf('0x31')](_0x3df99c['query']);_0xc3b54e['filters']=_[_0x1adf('0x49')](_0xc3b54e[_0x1adf('0x33')],_0xc3b54e[_0x1adf('0x30')]);_0x465317['attributes']=_[_0x1adf('0x49')](_0xc3b54e[_0x1adf('0x33')],qs['fields'](_0x3df99c[_0x1adf('0x30')][_0x1adf('0x34')]));_0x465317['attributes']=_0x465317[_0x1adf('0x35')]['length']?_0x465317[_0x1adf('0x35')]:_0xc3b54e[_0x1adf('0x33')];if(!_0x3df99c[_0x1adf('0x30')][_0x1adf('0x36')](_0x1adf('0x37'))){_0x465317['limit']=qs['limit'](_0x3df99c[_0x1adf('0x30')]['limit']);_0x465317[_0x1adf('0x1c')]=qs[_0x1adf('0x1c')](_0x3df99c[_0x1adf('0x30')][_0x1adf('0x1c')]);}_0x465317['order']=qs[_0x1adf('0x39')](_0x3df99c['query'][_0x1adf('0x39')]);_0x465317[_0x1adf('0x3a')]=qs[_0x1adf('0x32')](_['pick'](_0x3df99c[_0x1adf('0x30')],_0xc3b54e[_0x1adf('0x32')]));_0x465317[_0x1adf('0x3a')][_0x1adf('0x51')]=_0x18ee32['id'];if(_0x3df99c[_0x1adf('0x30')][_0x1adf('0x3c')]){_0x465317[_0x1adf('0x3a')]=_['merge'](_0x465317[_0x1adf('0x3a')],{'$or':_[_0x1adf('0x2d')](_0x465317[_0x1adf('0x35')],function(_0x473e81){var _0x2ee81={};_0x2ee81[_0x473e81]={'$like':'%'+_0x3df99c[_0x1adf('0x30')][_0x1adf('0x3c')]+'%'};return _0x2ee81;})});}_0x465317=_[_0x1adf('0x3f')]({},_0x465317,_0x3df99c[_0x1adf('0x40')]);return db['JscriptyQuestionReport'][_0x1adf('0x1f')]({'where':_0x465317[_0x1adf('0x3a')]})[_0x1adf('0x28')](function(_0x103d8d){_0x563fcc['count']=_0x103d8d;if(_0x3df99c[_0x1adf('0x30')][_0x1adf('0x42')]){_0x465317[_0x1adf('0x43')]=[{'all':!![]}];}return db[_0x1adf('0x52')][_0x1adf('0x44')](_0x465317);})[_0x1adf('0x28')](function(_0x25f478){_0x563fcc[_0x1adf('0x45')]=_0x25f478;return _0x563fcc;});}})[_0x1adf('0x28')](respondWithFilteredResult(_0x335d58,_0x465317))[_0x1adf('0x46')](handleError(_0x335d58,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 833d01b..e223904 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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','lodash','util'];(function(_0x2acbfd,_0x23abe0){var _0x33bb1f=function(_0x1681ab){while(--_0x1681ab){_0x2acbfd['push'](_0x2acbfd['shift']());}};_0x33bb1f(++_0x23abe0);}(_0x7a54,0x106));var _0x47a5=function(_0x1d8c1e,_0x584bd1){_0x1d8c1e=_0x1d8c1e-0x0;var _0x34bf89=_0x7a54[_0x1d8c1e];return _0x34bf89;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c6=['moment','request-promise','path','rimraf','exports','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x4f4056,_0x28c21c){var _0x17f578=function(_0x46b44e){while(--_0x46b44e){_0x4f4056['push'](_0x4f4056['shift']());}};_0x17f578(++_0x28c21c);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x5ed659,_0x53e8b3){_0x5ed659=_0x5ed659-0x0;var _0x459a1e=_0xc1c6[_0x5ed659];return _0x459a1e;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'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 184ef3e..d58f5f4 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 _0x4991=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x1ca29f,_0x318ac5){var _0x576c3b=function(_0x40caab){while(--_0x40caab){_0x1ca29f['push'](_0x1ca29f['shift']());}};_0x576c3b(++_0x318ac5);}(_0x4991,0xf7));var _0x1499=function(_0x411e93,_0x411945){_0x411e93=_0x411e93-0x0;var _0x526f0e=_0x4991[_0x411e93];return _0x526f0e;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var moment=require(_0x1499('0x1'));var BPromise=require('bluebird');var rs=require(_0x1499('0x2'));var fs=require('fs');var Redis=require(_0x1499('0x3'));var db=require(_0x1499('0x4'))['db'];var utils=require(_0x1499('0x5'));var logger=require(_0x1499('0x6'))(_0x1499('0x7'));var config=require(_0x1499('0x8'));var jayson=require(_0x1499('0x9'));var client=jayson['client'][_0x1499('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c3bd7,_0x1c65c3,_0x33b261){return new BPromise(function(_0x133bae,_0x380e48){return client[_0x1499('0xb')](_0x1c3bd7,_0x33b261)[_0x1499('0xc')](function(_0x48d2ca){logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');logger[_0x1499('0xf')](_0x1499('0x10'),_0x1c65c3,'request\x20sent',JSON[_0x1499('0x11')](_0x48d2ca));if(_0x48d2ca[_0x1499('0x12')]){if(_0x48d2ca['error']['code']===0x1f4){logger['error'](_0x1499('0xe'),_0x1c65c3,_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);return _0x380e48(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x1c65c3,_0x48d2ca[_0x1499('0x12')]['message']);return _0x133bae(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}else{logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');_0x133bae(_0x48d2ca[_0x1499('0x14')][_0x1499('0x13')]);}})['catch'](function(_0x25164c){logger[_0x1499('0x12')](_0x1499('0xe'),_0x1c65c3,_0x25164c);_0x380e48(_0x25164c);});});} \ No newline at end of file +var _0x77e6=['client','request','then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4e1981,_0x17e766){var _0x2d0085=function(_0x3ce7b0){while(--_0x3ce7b0){_0x4e1981['push'](_0x4e1981['shift']());}};_0x2d0085(++_0x17e766);}(_0x77e6,0x1a6));var _0x677e=function(_0x498d20,_0x3458c6){_0x498d20=_0x498d20-0x0;var _0x2e4020=_0x77e6[_0x498d20];return _0x2e4020;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var moment=require(_0x677e('0x2'));var BPromise=require(_0x677e('0x3'));var rs=require(_0x677e('0x4'));var fs=require('fs');var Redis=require(_0x677e('0x5'));var db=require(_0x677e('0x6'))['db'];var utils=require(_0x677e('0x7'));var logger=require('../../config/logger')(_0x677e('0x8'));var config=require(_0x677e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x677e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40d314,_0x4d1a57,_0x5a5dd3){return new BPromise(function(_0x2eb40c,_0x4c519f){return client[_0x677e('0xb')](_0x40d314,_0x5a5dd3)[_0x677e('0xc')](function(_0x552931){logger[_0x677e('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x4d1a57,_0x677e('0xe'));logger[_0x677e('0xf')](_0x677e('0x10'),_0x4d1a57,_0x677e('0xe'),JSON[_0x677e('0x11')](_0x552931));if(_0x552931[_0x677e('0x12')]){if(_0x552931[_0x677e('0x12')][_0x677e('0x13')]===0x1f4){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x552931[_0x677e('0x12')][_0x677e('0x15')]);return _0x4c519f(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x4d1a57,_0x552931['error'][_0x677e('0x15')]);return _0x2eb40c(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}else{logger[_0x677e('0xd')](_0x677e('0x14'),_0x4d1a57,_0x677e('0xe'));_0x2eb40c(_0x552931[_0x677e('0x16')][_0x677e('0x15')]);}})[_0x677e('0x17')](function(_0x32d306){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x32d306);_0x4c519f(_0x32d306);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 64e9455..2d7376d 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 _0x7551=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./license.controller','get','/:id','isAuthenticated','update','/download_log_file','multer','util','path'];(function(_0x47c2b1,_0x4763d4){var _0x556bee=function(_0x13adee){while(--_0x13adee){_0x47c2b1['push'](_0x47c2b1['shift']());}};_0x556bee(++_0x4763d4);}(_0x7551,0x11a));var _0x1755=function(_0x4a9148,_0x4a699e){_0x4a9148=_0x4a9148-0x0;var _0x27057a=_0x7551[_0x4a9148];return _0x27057a;};'use strict';var multer=require(_0x1755('0x0'));var util=require(_0x1755('0x1'));var path=require(_0x1755('0x2'));var timeout=require(_0x1755('0x3'));var express=require(_0x1755('0x4'));var router=express[_0x1755('0x5')]();var fs_extra=require(_0x1755('0x6'));var auth=require(_0x1755('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1755('0x8'));var controller=require(_0x1755('0x9'));router[_0x1755('0xa')]('/',controller['index']);router['put'](_0x1755('0xb'),auth[_0x1755('0xc')](),controller[_0x1755('0xd')]);router[_0x1755('0xa')](_0x1755('0xe'),auth[_0x1755('0xc')](),controller['downloadLogFile']);module['exports']=router; \ No newline at end of file +var _0x5267=['index','put','/:id','update','/download_log_file','isAuthenticated','downloadLogFile','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller','get'];(function(_0x1a8adb,_0x40b6b0){var _0x222790=function(_0x139118){while(--_0x139118){_0x1a8adb['push'](_0x1a8adb['shift']());}};_0x222790(++_0x40b6b0);}(_0x5267,0x8d));var _0x7526=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5267[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7526('0x0'));var util=require(_0x7526('0x1'));var path=require(_0x7526('0x2'));var timeout=require(_0x7526('0x3'));var express=require(_0x7526('0x4'));var router=express[_0x7526('0x5')]();var fs_extra=require(_0x7526('0x6'));var auth=require(_0x7526('0x7'));var interaction=require(_0x7526('0x8'));var config=require('../../config/environment');var controller=require(_0x7526('0x9'));router[_0x7526('0xa')]('/',controller[_0x7526('0xb')]);router[_0x7526('0xc')](_0x7526('0xd'),auth['isAuthenticated'](),controller[_0x7526('0xe')]);router[_0x7526('0xa')](_0x7526('0xf'),auth[_0x7526('0x10')](),controller[_0x7526('0x11')]);module[_0x7526('0x12')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 70fe614..6fecb08 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 _0x1671=['STRING','INTEGER','sequelize','exports'];(function(_0x18c3ba,_0x395b77){var _0x41aae9=function(_0x1454fe){while(--_0x1454fe){_0x18c3ba['push'](_0x18c3ba['shift']());}};_0x41aae9(++_0x395b77);}(_0x1671,0x1ee));var _0x1167=function(_0x501b8f,_0x3719ba){_0x501b8f=_0x501b8f-0x0;var _0x1a1271=_0x1671[_0x501b8f];return _0x1a1271;};'use strict';var Sequelize=require(_0x1167('0x0'));module[_0x1167('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x1167('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x1167('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x367c=['STRING','exports'];(function(_0x3a4549,_0x42524a){var _0x4582ea=function(_0x241887){while(--_0x241887){_0x3a4549['push'](_0x3a4549['shift']());}};_0x4582ea(++_0x42524a);}(_0x367c,0xfd));var _0xc367=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0x367c[_0x25e109];return _0xc0f7d6;};'use strict';var Sequelize=require('sequelize');module[_0xc367('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xc367('0x1')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index d6d887b..1eb1fce 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 _0xaa64=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','keys','License','rawAttributes','query','filters','intersection','model','fields','attributes','length','merge','options','catch','body','get','checkLicense','key','demo','downloadLogFile','join','/var','log','xcally','setHeader','Content-disposition','Content-Type','download','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3240a6,_0x5c42a9){var _0x4da765=function(_0x181b38){while(--_0x181b38){_0x3240a6['push'](_0x3240a6['shift']());}};_0x4da765(++_0x5c42a9);}(_0xaa64,0x1dd));var _0x4aa6=function(_0x580308,_0x569772){_0x580308=_0x580308-0x0;var _0x1e20dc=_0xaa64[_0x580308];return _0x1e20dc;};'use strict';var emlformat=require(_0x4aa6('0x0'));var rimraf=require(_0x4aa6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4aa6('0x2'));var rp=require(_0x4aa6('0x3'));var moment=require(_0x4aa6('0x4'));var BPromise=require(_0x4aa6('0x5'));var Mustache=require(_0x4aa6('0x6'));var util=require(_0x4aa6('0x7'));var path=require('path');var sox=require(_0x4aa6('0x8'));var csv=require(_0x4aa6('0x9'));var ejs=require(_0x4aa6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4aa6('0xb'));var squel=require(_0x4aa6('0xc'));var crypto=require(_0x4aa6('0xd'));var jsforce=require(_0x4aa6('0xe'));var deskjs=require(_0x4aa6('0xf'));var toCsv=require(_0x4aa6('0x9'));var querystring=require('querystring');var Papa=require(_0x4aa6('0x10'));var Redis=require(_0x4aa6('0x11'));var authService=require(_0x4aa6('0x12'));var qs=require(_0x4aa6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4aa6('0x14'))(_0x4aa6('0x15'));var utils=require(_0x4aa6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4aa6('0x17'));var db=require(_0x4aa6('0x18'))['db'];function respondWithStatusCode(_0x46bb00,_0x1694f0){_0x1694f0=_0x1694f0||0xcc;return function(_0x22caf6){if(_0x22caf6){return _0x46bb00[_0x4aa6('0x19')](_0x1694f0);}return _0x46bb00[_0x4aa6('0x1a')](_0x1694f0)[_0x4aa6('0x1b')]();};}function respondWithResult(_0xb92e6d,_0x40719e){_0x40719e=_0x40719e||0xc8;return function(_0x409404){if(_0x409404){return _0xb92e6d['status'](_0x40719e)['json'](_0x409404);}};}function respondWithFilteredResult(_0xb0830c,_0x1e3bf6){return function(_0x5bc86b){if(_0x5bc86b){var _0x40aef3=typeof _0x1e3bf6['offset']===_0x4aa6('0x1c')&&typeof _0x1e3bf6['limit']===_0x4aa6('0x1c');var _0x47611d=_0x5bc86b['count'];var _0x36b772=_0x40aef3?0x0:_0x1e3bf6['offset'];var _0x1c6af5=_0x40aef3?_0x5bc86b[_0x4aa6('0x1d')]:_0x1e3bf6['offset']+_0x1e3bf6[_0x4aa6('0x1e')];var _0x5b8b2a;if(_0x1c6af5>=_0x47611d){_0x1c6af5=_0x47611d;_0x5b8b2a=0xc8;}else{_0x5b8b2a=0xce;}_0xb0830c[_0x4aa6('0x1a')](_0x5b8b2a);return _0xb0830c[_0x4aa6('0x1f')]('Content-Range',_0x36b772+'-'+_0x1c6af5+'/'+_0x47611d)[_0x4aa6('0x20')](_0x5bc86b);}return null;};}function patchUpdates(_0x51c68c){return function(_0x270629){try{jsonpatch[_0x4aa6('0x21')](_0x270629,_0x51c68c,!![]);}catch(_0x2712ea){return BPromise[_0x4aa6('0x22')](_0x2712ea);}return _0x270629[_0x4aa6('0x23')]();};}function saveUpdates(_0x588b18,_0x25d311){return function(_0x5e6197){if(_0x5e6197){return _0x5e6197[_0x4aa6('0x24')](_0x588b18)[_0x4aa6('0x25')](function(_0x23c41b){return _0x23c41b;});}return null;};}function removeEntity(_0x3ff14c,_0x158e7c){return function(_0x5831d4){if(_0x5831d4){return _0x5831d4[_0x4aa6('0x26')]()[_0x4aa6('0x25')](function(){_0x3ff14c['status'](0xcc)[_0x4aa6('0x1b')]();});}};}function handleEntityNotFound(_0x408223,_0xbc36d3){return function(_0x3c3333){if(!_0x3c3333){_0x408223[_0x4aa6('0x19')](0x194);}return _0x3c3333;};}function handleError(_0x3f23d6,_0x52aaa5){_0x52aaa5=_0x52aaa5||0x1f4;return function(_0xd9b034){logger[_0x4aa6('0x27')](_0xd9b034[_0x4aa6('0x28')]);if(_0xd9b034[_0x4aa6('0x29')]){delete _0xd9b034[_0x4aa6('0x29')];}_0x3f23d6['status'](_0x52aaa5)[_0x4aa6('0x2a')](_0xd9b034);};}var utilLicense=require(_0x4aa6('0x17'));exports[_0x4aa6('0x2b')]=function(_0x2e5997,_0x15f14e){var _0x562b99={'raw':!![],'where':{'id':0x1}},_0x2a5df0={};_0x2a5df0['model']=_[_0x4aa6('0x2c')](db[_0x4aa6('0x2d')][_0x4aa6('0x2e')]);_0x2a5df0[_0x4aa6('0x2f')]=_['keys'](_0x2e5997[_0x4aa6('0x2f')]);_0x2a5df0[_0x4aa6('0x30')]=_[_0x4aa6('0x31')](_0x2a5df0[_0x4aa6('0x32')],_0x2a5df0['query']);_0x562b99['attributes']=_[_0x4aa6('0x31')](_0x2a5df0[_0x4aa6('0x32')],qs[_0x4aa6('0x33')](_0x2e5997[_0x4aa6('0x2f')][_0x4aa6('0x33')]));_0x562b99[_0x4aa6('0x34')]=_0x562b99[_0x4aa6('0x34')][_0x4aa6('0x35')]?_0x562b99[_0x4aa6('0x34')]:_0x2a5df0[_0x4aa6('0x32')];_0x562b99=_[_0x4aa6('0x36')]({},_0x562b99,_0x2e5997[_0x4aa6('0x37')]);return utilLicense['getLicense'](_0x562b99)['then'](respondWithResult(_0x15f14e,null))[_0x4aa6('0x38')](handleError(_0x15f14e,null));};exports[_0x4aa6('0x24')]=function(_0x3a86b6,_0x35803b){if(_0x3a86b6[_0x4aa6('0x39')]['id']){delete _0x3a86b6['body']['id'];}return db[_0x4aa6('0x2d')]['find']({'where':{'id':_0x3a86b6['params']['id']}})['then'](handleEntityNotFound(_0x35803b,null))[_0x4aa6('0x25')](function(_0x391533){var _0x14b1af=_0x391533[_0x4aa6('0x3a')]({'plain':!![]});return utilLicense[_0x4aa6('0x3b')](_0x14b1af,_0x3a86b6[_0x4aa6('0x39')][_0x4aa6('0x3c')]);})[_0x4aa6('0x25')](function(_0x15c80f){if(!_0x15c80f[_0x4aa6('0x3d')]){return saveUpdates(_0x3a86b6['body'],null);}return _0x15c80f;})[_0x4aa6('0x25')](respondWithResult(_0x35803b,null))[_0x4aa6('0x38')](handleError(_0x35803b,null));};exports[_0x4aa6('0x3e')]=function(_0x388b6a,_0x5d8eef){var _0x3237e6='license-info.log';var _0x18c2c3=path[_0x4aa6('0x3f')](_0x4aa6('0x40'),_0x4aa6('0x41'),_0x4aa6('0x42'),_0x3237e6);_0x5d8eef[_0x4aa6('0x43')](_0x4aa6('0x44'),'attachment;\x20filename='+_0x3237e6);_0x5d8eef['set'](_0x4aa6('0x45'),'text/plain');_0x5d8eef[_0x4aa6('0x46')](_0x18c2c3);}; \ No newline at end of file +var _0xe6ed=['text/plain','download','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','send','index','model','keys','query','intersection','attributes','fields','merge','options','body','License','find','params','get','checkLicense','key','demo','downloadLogFile','join','/var','log','xcally','setHeader','Content-Type'];(function(_0x344ec5,_0x5c2f51){var _0x2bc076=function(_0x18d638){while(--_0x18d638){_0x344ec5['push'](_0x344ec5['shift']());}};_0x2bc076(++_0x5c2f51);}(_0xe6ed,0xfe));var _0xde6e=function(_0x531ee2,_0x35fe93){_0x531ee2=_0x531ee2-0x0;var _0x50c437=_0xe6ed[_0x531ee2];return _0x50c437;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xde6e('0x0'));var zipdir=require(_0xde6e('0x1'));var jsonpatch=require(_0xde6e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xde6e('0x3'));var Mustache=require(_0xde6e('0x4'));var util=require(_0xde6e('0x5'));var path=require(_0xde6e('0x6'));var sox=require(_0xde6e('0x7'));var csv=require(_0xde6e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde6e('0x9'));var _=require('lodash');var squel=require(_0xde6e('0xa'));var crypto=require(_0xde6e('0xb'));var jsforce=require(_0xde6e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xde6e('0xd'));var Redis=require(_0xde6e('0xe'));var authService=require(_0xde6e('0xf'));var qs=require(_0xde6e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xde6e('0x11'));var logger=require('../../config/logger')(_0xde6e('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x115d9a,_0x454bd7){_0x454bd7=_0x454bd7||0xcc;return function(_0x4cfa26){if(_0x4cfa26){return _0x115d9a[_0xde6e('0x13')](_0x454bd7);}return _0x115d9a[_0xde6e('0x14')](_0x454bd7)[_0xde6e('0x15')]();};}function respondWithResult(_0x5d5345,_0xb2bca2){_0xb2bca2=_0xb2bca2||0xc8;return function(_0x5d6c74){if(_0x5d6c74){return _0x5d5345[_0xde6e('0x14')](_0xb2bca2)[_0xde6e('0x16')](_0x5d6c74);}};}function respondWithFilteredResult(_0x80648e,_0x12474c){return function(_0x571e5f){if(_0x571e5f){var _0x2e4be1=typeof _0x12474c[_0xde6e('0x17')]===_0xde6e('0x18')&&typeof _0x12474c[_0xde6e('0x19')]===_0xde6e('0x18');var _0x1bb450=_0x571e5f[_0xde6e('0x1a')];var _0x5b6533=_0x2e4be1?0x0:_0x12474c[_0xde6e('0x17')];var _0x2bdffb=_0x2e4be1?_0x571e5f[_0xde6e('0x1a')]:_0x12474c[_0xde6e('0x17')]+_0x12474c[_0xde6e('0x19')];var _0x2b0bd6;if(_0x2bdffb>=_0x1bb450){_0x2bdffb=_0x1bb450;_0x2b0bd6=0xc8;}else{_0x2b0bd6=0xce;}_0x80648e[_0xde6e('0x14')](_0x2b0bd6);return _0x80648e[_0xde6e('0x1b')]('Content-Range',_0x5b6533+'-'+_0x2bdffb+'/'+_0x1bb450)[_0xde6e('0x16')](_0x571e5f);}return null;};}function patchUpdates(_0x2e8110){return function(_0x461c38){try{jsonpatch['apply'](_0x461c38,_0x2e8110,!![]);}catch(_0x4b03ee){return BPromise[_0xde6e('0x1c')](_0x4b03ee);}return _0x461c38[_0xde6e('0x1d')]();};}function saveUpdates(_0x278a95,_0x323ac5){return function(_0x51feee){if(_0x51feee){return _0x51feee[_0xde6e('0x1e')](_0x278a95)[_0xde6e('0x1f')](function(_0x5dc570){return _0x5dc570;});}return null;};}function removeEntity(_0xaedeae,_0x273bfb){return function(_0x3776e3){if(_0x3776e3){return _0x3776e3[_0xde6e('0x20')]()[_0xde6e('0x1f')](function(){_0xaedeae['status'](0xcc)[_0xde6e('0x15')]();});}};}function handleEntityNotFound(_0x245932,_0x592bbd){return function(_0xc0f554){if(!_0xc0f554){_0x245932[_0xde6e('0x13')](0x194);}return _0xc0f554;};}function handleError(_0x207b61,_0x451d12){_0x451d12=_0x451d12||0x1f4;return function(_0x25e9ce){logger[_0xde6e('0x21')](_0x25e9ce[_0xde6e('0x22')]);if(_0x25e9ce[_0xde6e('0x23')]){delete _0x25e9ce[_0xde6e('0x23')];}_0x207b61[_0xde6e('0x14')](_0x451d12)[_0xde6e('0x24')](_0x25e9ce);};}var utilLicense=require('../../config/license/util');exports[_0xde6e('0x25')]=function(_0x28ad94,_0x35fac6){var _0x4b554f={'raw':!![],'where':{'id':0x1}},_0x205119={};_0x205119[_0xde6e('0x26')]=_[_0xde6e('0x27')](db['License']['rawAttributes']);_0x205119[_0xde6e('0x28')]=_['keys'](_0x28ad94[_0xde6e('0x28')]);_0x205119['filters']=_[_0xde6e('0x29')](_0x205119['model'],_0x205119[_0xde6e('0x28')]);_0x4b554f[_0xde6e('0x2a')]=_[_0xde6e('0x29')](_0x205119[_0xde6e('0x26')],qs[_0xde6e('0x2b')](_0x28ad94[_0xde6e('0x28')][_0xde6e('0x2b')]));_0x4b554f[_0xde6e('0x2a')]=_0x4b554f[_0xde6e('0x2a')]['length']?_0x4b554f[_0xde6e('0x2a')]:_0x205119['model'];_0x4b554f=_[_0xde6e('0x2c')]({},_0x4b554f,_0x28ad94[_0xde6e('0x2d')]);return utilLicense['getLicense'](_0x4b554f)[_0xde6e('0x1f')](respondWithResult(_0x35fac6,null))['catch'](handleError(_0x35fac6,null));};exports['update']=function(_0x5192d4,_0x473944){if(_0x5192d4[_0xde6e('0x2e')]['id']){delete _0x5192d4['body']['id'];}return db[_0xde6e('0x2f')][_0xde6e('0x30')]({'where':{'id':_0x5192d4[_0xde6e('0x31')]['id']}})[_0xde6e('0x1f')](handleEntityNotFound(_0x473944,null))[_0xde6e('0x1f')](function(_0x4db4fe){var _0x2c0d7b=_0x4db4fe[_0xde6e('0x32')]({'plain':!![]});return utilLicense[_0xde6e('0x33')](_0x2c0d7b,_0x5192d4[_0xde6e('0x2e')][_0xde6e('0x34')]);})['then'](function(_0x1f9fe8){if(!_0x1f9fe8[_0xde6e('0x35')]){return saveUpdates(_0x5192d4['body'],null);}return _0x1f9fe8;})['then'](respondWithResult(_0x473944,null))['catch'](handleError(_0x473944,null));};exports[_0xde6e('0x36')]=function(_0x2885b2,_0x34cdac){var _0x769d8d='license-info.log';var _0x17f415=path[_0xde6e('0x37')](_0xde6e('0x38'),_0xde6e('0x39'),_0xde6e('0x3a'),_0x769d8d);_0x34cdac[_0xde6e('0x3b')]('Content-disposition','attachment;\x20filename='+_0x769d8d);_0x34cdac[_0xde6e('0x1b')](_0xde6e('0x3c'),_0xde6e('0x3d'));_0x34cdac[_0xde6e('0x3e')](_0x17f415);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index e1bc428..95e8535 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 _0x160e=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./license.attributes','define','License','license','lodash'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x160e,0xd0));var _0xe160=function(_0x25f167,_0x35bc7f){_0x25f167=_0x25f167-0x0;var _0x5b2783=_0x160e[_0x25f167];return _0x5b2783;};'use strict';var _=require(_0xe160('0x0'));var util=require('util');var logger=require(_0xe160('0x1'))(_0xe160('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe160('0x3'));var fs=require('fs');var path=require(_0xe160('0x4'));var rimraf=require(_0xe160('0x5'));var config=require(_0xe160('0x6'));var attributes=require(_0xe160('0x7'));module['exports']=function(_0xe7af7e,_0x30b8a2){return _0xe7af7e[_0xe160('0x8')](_0xe160('0x9'),attributes,{'tableName':_0xe160('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa31e=['exports','define','License','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./license.attributes'];(function(_0x194207,_0x14e634){var _0x5791d1=function(_0x39b4c1){while(--_0x39b4c1){_0x194207['push'](_0x194207['shift']());}};_0x5791d1(++_0x14e634);}(_0xa31e,0x1b1));var _0xea31=function(_0x3edf53,_0xfcd5d){_0x3edf53=_0x3edf53-0x0;var _0x4e7f9e=_0xa31e[_0x3edf53];return _0x4e7f9e;};'use strict';var _=require(_0xea31('0x0'));var util=require('util');var logger=require(_0xea31('0x1'))('api');var moment=require(_0xea31('0x2'));var BPromise=require(_0xea31('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xea31('0x4'));var config=require(_0xea31('0x5'));var attributes=require(_0xea31('0x6'));module[_0xea31('0x7')]=function(_0x332e79,_0x937c7a){return _0x332e79[_0xea31('0x8')](_0xea31('0x9'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 2f95e86..6f49630 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 _0xf33e=['client','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','License,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf33e,0xe8));var _0xef33=function(_0x24ea8e,_0x395641){_0x24ea8e=_0x24ea8e-0x0;var _0x37e51d=_0xf33e[_0x24ea8e];return _0x37e51d;};'use strict';var _=require('lodash');var util=require(_0xef33('0x0'));var moment=require(_0xef33('0x1'));var BPromise=require(_0xef33('0x2'));var rs=require(_0xef33('0x3'));var fs=require('fs');var Redis=require(_0xef33('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xef33('0x5'));var logger=require(_0xef33('0x6'))(_0xef33('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xef33('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44ba20,_0x53e672,_0x3f7604){return new BPromise(function(_0x126980,_0x36e4e4){return client['request'](_0x44ba20,_0x3f7604)[_0xef33('0x9')](function(_0x2c8873){logger[_0xef33('0xa')]('License,\x20%s,\x20%s',_0x53e672,_0xef33('0xb'));logger[_0xef33('0xc')](_0xef33('0xd'),_0x53e672,_0xef33('0xb'),JSON[_0xef33('0xe')](_0x2c8873));if(_0x2c8873[_0xef33('0xf')]){if(_0x2c8873[_0xef33('0xf')]['code']===0x1f4){logger[_0xef33('0xf')](_0xef33('0x10'),_0x53e672,_0x2c8873[_0xef33('0xf')][_0xef33('0x11')]);return _0x36e4e4(_0x2c8873[_0xef33('0xf')][_0xef33('0x11')]);}logger[_0xef33('0xf')](_0xef33('0x10'),_0x53e672,_0x2c8873[_0xef33('0xf')]['message']);return _0x126980(_0x2c8873[_0xef33('0xf')][_0xef33('0x11')]);}else{logger[_0xef33('0xa')]('License,\x20%s,\x20%s',_0x53e672,_0xef33('0xb'));_0x126980(_0x2c8873[_0xef33('0x12')]['message']);}})[_0xef33('0x13')](function(_0x23a27c){logger[_0xef33('0xf')](_0xef33('0x10'),_0x53e672,_0x23a27c);_0x36e4e4(_0x23a27c);});});} \ No newline at end of file +var _0x03e4=['http','request','then','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x40ed66,_0x88c5c6){var _0x129952=function(_0x445c7a){while(--_0x445c7a){_0x40ed66['push'](_0x40ed66['shift']());}};_0x129952(++_0x88c5c6);}(_0x03e4,0xfe));var _0x403e=function(_0x21c601,_0x26f456){_0x21c601=_0x21c601-0x0;var _0xd423f=_0x03e4[_0x21c601];return _0xd423f;};'use strict';var _=require(_0x403e('0x0'));var util=require('util');var moment=require(_0x403e('0x1'));var BPromise=require(_0x403e('0x2'));var rs=require(_0x403e('0x3'));var fs=require('fs');var Redis=require(_0x403e('0x4'));var db=require(_0x403e('0x5'))['db'];var utils=require(_0x403e('0x6'));var logger=require(_0x403e('0x7'))('rpc');var config=require(_0x403e('0x8'));var jayson=require(_0x403e('0x9'));var client=jayson['client'][_0x403e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x291e9a,_0x10d43b,_0x81d9f2){return new BPromise(function(_0x4d9cfe,_0x4ca2a8){return client[_0x403e('0xb')](_0x291e9a,_0x81d9f2)[_0x403e('0xc')](function(_0x2833a6){logger['info'](_0x403e('0xd'),_0x10d43b,'request\x20sent');logger[_0x403e('0xe')](_0x403e('0xf'),_0x10d43b,_0x403e('0x10'),JSON[_0x403e('0x11')](_0x2833a6));if(_0x2833a6['error']){if(_0x2833a6['error'][_0x403e('0x12')]===0x1f4){logger[_0x403e('0x13')](_0x403e('0xd'),_0x10d43b,_0x2833a6[_0x403e('0x13')][_0x403e('0x14')]);return _0x4ca2a8(_0x2833a6[_0x403e('0x13')]['message']);}logger['error'](_0x403e('0xd'),_0x10d43b,_0x2833a6[_0x403e('0x13')][_0x403e('0x14')]);return _0x4d9cfe(_0x2833a6[_0x403e('0x13')][_0x403e('0x14')]);}else{logger[_0x403e('0x15')](_0x403e('0xd'),_0x10d43b,_0x403e('0x10'));_0x4d9cfe(_0x2833a6[_0x403e('0x16')]['message']);}})[_0x403e('0x17')](function(_0x2f9c7f){logger['error']('License,\x20%s,\x20%s',_0x10d43b,_0x2f9c7f);_0x4ca2a8(_0x2f9c7f);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 3893c84..2858944 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 _0x1aeb=['index','get','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addInteraction','/:id/applications','/:id/send','addAgents','put','/:id','removeDispositions','delete','removeAnswers','removeImap','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./mailAccount.controller','isAuthenticated'];(function(_0x291e73,_0x240beb){var _0x15a90f=function(_0x4bf236){while(--_0x4bf236){_0x291e73['push'](_0x291e73['shift']());}};_0x15a90f(++_0x240beb);}(_0x1aeb,0x1b9));var _0xb1ae=function(_0x52b398,_0x5b65f2){_0x52b398=_0x52b398-0x0;var _0x265f92=_0x1aeb[_0x52b398];return _0x265f92;};'use strict';var multer=require(_0xb1ae('0x0'));var util=require(_0xb1ae('0x1'));var path=require(_0xb1ae('0x2'));var timeout=require(_0xb1ae('0x3'));var express=require('express');var router=express[_0xb1ae('0x4')]();var fs_extra=require(_0xb1ae('0x5'));var auth=require(_0xb1ae('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb1ae('0x7'));router['get']('/',auth[_0xb1ae('0x8')](),controller[_0xb1ae('0x9')]);router[_0xb1ae('0xa')](_0xb1ae('0xb'),auth['isAuthenticated'](),controller[_0xb1ae('0xc')]);router[_0xb1ae('0xa')]('/:id',auth[_0xb1ae('0x8')](),controller['show']);router[_0xb1ae('0xa')](_0xb1ae('0xd'),auth[_0xb1ae('0x8')](),controller[_0xb1ae('0xe')]);router['get'](_0xb1ae('0xf'),auth[_0xb1ae('0x8')](),controller[_0xb1ae('0x10')]);router[_0xb1ae('0xa')](_0xb1ae('0x11'),auth[_0xb1ae('0x8')](),controller['getImap']);router['get'](_0xb1ae('0x12'),auth[_0xb1ae('0x8')](),controller[_0xb1ae('0x13')]);router[_0xb1ae('0xa')](_0xb1ae('0x14'),auth[_0xb1ae('0x8')](),controller[_0xb1ae('0x15')]);router['get']('/:id/applications',auth[_0xb1ae('0x8')](),controller[_0xb1ae('0x16')]);router[_0xb1ae('0xa')]('/:id/messages',auth[_0xb1ae('0x8')](),controller[_0xb1ae('0x17')]);router[_0xb1ae('0xa')](_0xb1ae('0x18'),auth[_0xb1ae('0x8')](),controller[_0xb1ae('0x19')]);router[_0xb1ae('0xa')](_0xb1ae('0x1a'),auth[_0xb1ae('0x8')](),controller[_0xb1ae('0x1b')]);router[_0xb1ae('0x1c')](_0xb1ae('0xd'),auth[_0xb1ae('0x8')](),controller[_0xb1ae('0x1d')]);router[_0xb1ae('0x1c')](_0xb1ae('0xf'),auth[_0xb1ae('0x8')](),controller[_0xb1ae('0x1e')]);router['post']('/',auth[_0xb1ae('0x8')](),controller[_0xb1ae('0x1f')]);router['post']('/:id/in_servers',auth['isAuthenticated'](),controller[_0xb1ae('0x20')]);router[_0xb1ae('0x1c')](_0xb1ae('0x12'),auth[_0xb1ae('0x8')](),controller['addSmtp']);router[_0xb1ae('0x1c')](_0xb1ae('0x14'),auth[_0xb1ae('0x8')](),controller[_0xb1ae('0x21')]);router[_0xb1ae('0x1c')](_0xb1ae('0x22'),auth[_0xb1ae('0x8')](),controller['addApplications']);router[_0xb1ae('0x1c')](_0xb1ae('0x23'),auth[_0xb1ae('0x8')](),controller['send']);router[_0xb1ae('0x1c')](_0xb1ae('0x1a'),auth[_0xb1ae('0x8')](),controller[_0xb1ae('0x24')]);router[_0xb1ae('0x25')](_0xb1ae('0x26'),auth[_0xb1ae('0x8')](),controller['update']);router['delete'](_0xb1ae('0xd'),auth[_0xb1ae('0x8')](),controller[_0xb1ae('0x27')]);router[_0xb1ae('0x28')](_0xb1ae('0xf'),auth[_0xb1ae('0x8')](),controller[_0xb1ae('0x29')]);router[_0xb1ae('0x28')](_0xb1ae('0x11'),auth[_0xb1ae('0x8')](),controller[_0xb1ae('0x2a')]);router[_0xb1ae('0x28')](_0xb1ae('0x12'),auth[_0xb1ae('0x8')](),controller['removeSmtp']);router[_0xb1ae('0x28')](_0xb1ae('0x26'),auth['isAuthenticated'](),controller['destroy']);router[_0xb1ae('0x28')](_0xb1ae('0x1a'),auth[_0xb1ae('0x8')](),controller[_0xb1ae('0x2b')]);module[_0xb1ae('0x2c')]=router; \ No newline at end of file +var _0x9100=['addDisposition','post','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','send','/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailAccount.controller','isAuthenticated','/describe','get','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','getAgents'];(function(_0xacdd48,_0x5e5120){var _0x49dfb2=function(_0x1927bc){while(--_0x1927bc){_0xacdd48['push'](_0xacdd48['shift']());}};_0x49dfb2(++_0x5e5120);}(_0x9100,0x195));var _0x0910=function(_0x2ab6ee,_0x521774){_0x2ab6ee=_0x2ab6ee-0x0;var _0x2bff37=_0x9100[_0x2ab6ee];return _0x2bff37;};'use strict';var multer=require(_0x0910('0x0'));var util=require(_0x0910('0x1'));var path=require(_0x0910('0x2'));var timeout=require(_0x0910('0x3'));var express=require(_0x0910('0x4'));var router=express[_0x0910('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0910('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0910('0x7'));var controller=require(_0x0910('0x8'));router['get']('/',auth[_0x0910('0x9')](),controller['index']);router['get'](_0x0910('0xa'),auth[_0x0910('0x9')](),controller['describe']);router[_0x0910('0xb')](_0x0910('0xc'),auth[_0x0910('0x9')](),controller[_0x0910('0xd')]);router[_0x0910('0xb')](_0x0910('0xe'),auth[_0x0910('0x9')](),controller['getDispositions']);router[_0x0910('0xb')](_0x0910('0xf'),auth[_0x0910('0x9')](),controller['getAnswers']);router[_0x0910('0xb')](_0x0910('0x10'),auth[_0x0910('0x9')](),controller['getImap']);router[_0x0910('0xb')](_0x0910('0x11'),auth[_0x0910('0x9')](),controller[_0x0910('0x12')]);router[_0x0910('0xb')](_0x0910('0x13'),auth[_0x0910('0x9')](),controller[_0x0910('0x14')]);router[_0x0910('0xb')](_0x0910('0x15'),auth[_0x0910('0x9')](),controller[_0x0910('0x16')]);router[_0x0910('0xb')](_0x0910('0x17'),auth[_0x0910('0x9')](),controller['getMessages']);router[_0x0910('0xb')](_0x0910('0x18'),auth['isAuthenticated'](),controller[_0x0910('0x19')]);router[_0x0910('0xb')]('/:id/users',auth[_0x0910('0x9')](),controller[_0x0910('0x1a')]);router['post']('/:id/dispositions',auth[_0x0910('0x9')](),controller[_0x0910('0x1b')]);router[_0x0910('0x1c')](_0x0910('0xf'),auth[_0x0910('0x9')](),controller[_0x0910('0x1d')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0910('0x1e')]);router['post'](_0x0910('0x10'),auth[_0x0910('0x9')](),controller[_0x0910('0x1f')]);router[_0x0910('0x1c')](_0x0910('0x11'),auth['isAuthenticated'](),controller[_0x0910('0x20')]);router['post'](_0x0910('0x13'),auth[_0x0910('0x9')](),controller[_0x0910('0x21')]);router[_0x0910('0x1c')]('/:id/applications',auth[_0x0910('0x9')](),controller[_0x0910('0x22')]);router['post']('/:id/send',auth[_0x0910('0x9')](),controller[_0x0910('0x23')]);router[_0x0910('0x1c')](_0x0910('0x24'),auth['isAuthenticated'](),controller[_0x0910('0x25')]);router[_0x0910('0x26')](_0x0910('0xc'),auth[_0x0910('0x9')](),controller[_0x0910('0x27')]);router[_0x0910('0x28')](_0x0910('0xe'),auth[_0x0910('0x9')](),controller[_0x0910('0x29')]);router[_0x0910('0x28')](_0x0910('0xf'),auth['isAuthenticated'](),controller[_0x0910('0x2a')]);router['delete'](_0x0910('0x10'),auth[_0x0910('0x9')](),controller[_0x0910('0x2b')]);router[_0x0910('0x28')](_0x0910('0x11'),auth[_0x0910('0x9')](),controller[_0x0910('0x2c')]);router[_0x0910('0x28')](_0x0910('0xc'),auth[_0x0910('0x9')](),controller[_0x0910('0x2d')]);router[_0x0910('0x28')](_0x0910('0x24'),auth[_0x0910('0x9')](),controller[_0x0910('0x2e')]);module[_0x0910('0x2f')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index eaaf79c..40a9be2 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 _0xec7c=['setDataValue','mandatoryDispositionPauseId','gmail','hotmail','yahoo','outlook365','provider','custom','sequelize','exports','STRING','BOOLEAN','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'];(function(_0x2d1eed,_0x2eb85e){var _0x21cfa4=function(_0x24aca6){while(--_0x24aca6){_0x2d1eed['push'](_0x2d1eed['shift']());}};_0x21cfa4(++_0x2eb85e);}(_0xec7c,0x18f));var _0xcec7=function(_0x2d45e9,_0x3713b2){_0x2d45e9=_0x2d45e9-0x0;var _0x13140a=_0xec7c[_0x2d45e9];return _0x13140a;};'use strict';var Sequelize=require(_0xcec7('0x0'));module[_0xcec7('0x1')]={'description':{'type':Sequelize[_0xcec7('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xcec7('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xcec7('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xcec7('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xcec7('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xcec7('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xcec7('0x4')](0x2)[_0xcec7('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xcec7('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcec7('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xcec7('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcec7('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcec7('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcec7('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xcec7('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xcec7('0x8'),'set':function(_0x4b4812){if(!_0x4b4812)this[_0xcec7('0x9')](_0xcec7('0xa'),null);this[_0xcec7('0x9')]('mandatoryDisposition',_0x4b4812);}},'provider':{'type':Sequelize['ENUM'](_0xcec7('0xb'),_0xcec7('0xc'),_0xcec7('0xd'),_0xcec7('0xe')),'defaultValue':null,'get':function(){var _0x46a322=this['getDataValue'](_0xcec7('0xf'));return _0x46a322||_0xcec7('0x10');},'set':function(_0x3493c1){if(_0x3493c1===_0xcec7('0x10')){_0x3493c1=null;}return this[_0xcec7('0x9')](_0xcec7('0xf'),_0x3493c1);}}}; \ No newline at end of file +var _0xdbae=['yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail'];(function(_0x1218a5,_0x3e8923){var _0x524641=function(_0x4267ad){while(--_0x4267ad){_0x1218a5['push'](_0x1218a5['shift']());}};_0x524641(++_0x3e8923);}(_0xdbae,0x15b));var _0xedba=function(_0x5f2e51,_0x5e4a48){_0x5f2e51=_0x5f2e51-0x0;var _0x3f1815=_0xdbae[_0x5f2e51];return _0x3f1815;};'use strict';var Sequelize=require(_0xedba('0x0'));module[_0xedba('0x1')]={'description':{'type':Sequelize[_0xedba('0x2')]},'name':{'type':Sequelize[_0xedba('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xedba('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xedba('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xedba('0x4')]},'markAsUnread':{'type':Sequelize[_0xedba('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xedba('0x2')],'allowNull':![],'defaultValue':_0xedba('0x5')},'fontSize':{'type':Sequelize[_0xedba('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xedba('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xedba('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xedba('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xedba('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xedba('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xedba('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xedba('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xedba('0x3')],'defaultValue':![],'comment':_0xedba('0x7'),'set':function(_0x401269){if(!_0x401269)this[_0xedba('0x8')](_0xedba('0x9'),null);this['setDataValue']('mandatoryDisposition',_0x401269);}},'provider':{'type':Sequelize[_0xedba('0xa')](_0xedba('0xb'),_0xedba('0xc'),_0xedba('0xd'),_0xedba('0xe')),'defaultValue':null,'get':function(){var _0x3e5b83=this[_0xedba('0xf')](_0xedba('0x10'));return _0x3e5b83||_0xedba('0x11');},'set':function(_0x4ec40a){if(_0x4ec40a==='custom'){_0x4ec40a=null;}return this[_0xedba('0x8')]('provider',_0x4ec40a);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 53f0ba9..5a059bd 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 _0x3a8e=['setSmtp','addInteraction','omit','getInteractions','CmContact','Contact','User','fullname','color','tag','MailInteraction','addApplications','sequelize','transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','getMessages','MailMessage','$gte','format','inlineCss','true','CmList','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','attachments','join','root','SendMail','sendMail','List\x20not\x20found','List','ListId','from','subject','out','YYYY-MM-DD\x20HH:mm:ss','messageId','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','MailAccounts','stack','name','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','gmail','smtp.gmail.com','yahoo','smtp-mail.outlook.com','password','modernAuthentication','CloudProviderId','pass','host','port','service','user','username','authentication','Smtp','index','MailServerIn','Imap','MailServerOut','Pause','MailAccount','rawAttributes','type','key','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','show','params','mandatoryDispositionPause','model','include','find','body','provider','secure','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','custom','email','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp'];(function(_0x46fc06,_0x381f20){var _0x5435de=function(_0x26a88c){while(--_0x26a88c){_0x46fc06['push'](_0x46fc06['shift']());}};_0x5435de(++_0x381f20);}(_0x3a8e,0x1c6));var _0xe3a8=function(_0x46800d,_0x588500){_0x46800d=_0x46800d-0x0;var _0x3824cd=_0x3a8e[_0x46800d];return _0x3824cd;};'use strict';var moment=require('moment');var BPromise=require(_0xe3a8('0x0'));var util=require(_0xe3a8('0x1'));var path=require(_0xe3a8('0x2'));var _=require(_0xe3a8('0x3'));var juice=require('juice');var Redis=require(_0xe3a8('0x4'));var qs=require(_0xe3a8('0x5'));var logger=require(_0xe3a8('0x6'))(_0xe3a8('0x7'));var config=require(_0xe3a8('0x8'));var db=require(_0xe3a8('0x9'))['db'];config[_0xe3a8('0xa')]=_[_0xe3a8('0xb')](config['redis'],{'host':_0xe3a8('0xc'),'port':0x18eb});var socket=require(_0xe3a8('0xd'))(new Redis(config['redis']));require(_0xe3a8('0xe'))['register'](socket);var jayson=require(_0xe3a8('0xf'));var client=jayson[_0xe3a8('0x10')][_0xe3a8('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x54870a,_0x3e0751,_0x3d7380,_0x10f27a){return new BPromise(function(_0x5c56f0,_0x40913e){var _0x36a29f=_0x10f27a||client;return _0x36a29f[_0xe3a8('0x12')](_0x54870a,_0x3d7380)['then'](function(_0x5dae8d){logger[_0xe3a8('0x13')](_0xe3a8('0x14'),_0x3e0751,_0xe3a8('0x15'));logger[_0xe3a8('0x16')](_0xe3a8('0x17'),_0x3e0751,_0xe3a8('0x15'),JSON[_0xe3a8('0x18')](_0x5dae8d));if(_0x5dae8d[_0xe3a8('0x19')]){if(_0x5dae8d[_0xe3a8('0x19')]['code']===0x1f4){logger[_0xe3a8('0x19')](_0xe3a8('0x14'),_0x3e0751,_0x5dae8d[_0xe3a8('0x19')][_0xe3a8('0x1a')]);return _0x40913e(_0x5dae8d[_0xe3a8('0x19')][_0xe3a8('0x1a')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x3e0751,_0x5dae8d[_0xe3a8('0x19')][_0xe3a8('0x1a')]);return _0x5c56f0(_0x5dae8d[_0xe3a8('0x19')][_0xe3a8('0x1a')]);}else{logger[_0xe3a8('0x13')](_0xe3a8('0x14'),_0x3e0751,_0xe3a8('0x15'));_0x5c56f0(_0x5dae8d[_0xe3a8('0x1b')][_0xe3a8('0x1a')]);}})[_0xe3a8('0x1c')](function(_0x413598){logger[_0xe3a8('0x19')]('MailAccount,\x20%s,\x20%s',_0x3e0751,_0x413598);_0x40913e(_0x413598);});});}function respondWithStatusCode(_0x4300c9,_0x4f6236){_0x4f6236=_0x4f6236||0xcc;return function(_0x544467){if(_0x544467){return _0x4300c9[_0xe3a8('0x1d')](_0x4f6236);}return _0x4300c9[_0xe3a8('0x1e')](_0x4f6236)[_0xe3a8('0x1f')]();};}function respondWithResult(_0x2c774f,_0x23865d){_0x23865d=_0x23865d||0xc8;return function(_0x505f55){if(_0x505f55){return _0x2c774f[_0xe3a8('0x1e')](_0x23865d)[_0xe3a8('0x20')](_0x505f55);}};}function respondWithFilteredResult(_0x3cf5c7,_0x2e116e){return function(_0xd9ee58){if(_0xd9ee58){var _0x5c7645=typeof _0x2e116e[_0xe3a8('0x21')]===_0xe3a8('0x22')&&typeof _0x2e116e[_0xe3a8('0x23')]===_0xe3a8('0x22');var _0x44b58=_0xd9ee58[_0xe3a8('0x24')];var _0x3d5d06=_0x5c7645?0x0:_0x2e116e[_0xe3a8('0x21')];var _0x24caad=_0x5c7645?_0xd9ee58[_0xe3a8('0x24')]:_0x2e116e[_0xe3a8('0x21')]+_0x2e116e['limit'];var _0x3af14a;if(_0x24caad>=_0x44b58){_0x24caad=_0x44b58;_0x3af14a=0xc8;}else{_0x3af14a=0xce;}_0x3cf5c7[_0xe3a8('0x1e')](_0x3af14a);return _0x3cf5c7[_0xe3a8('0x25')](_0xe3a8('0x26'),_0x3d5d06+'-'+_0x24caad+'/'+_0x44b58)[_0xe3a8('0x20')](_0xd9ee58);}return null;};}function saveUpdates(_0x30fdf8){return function(_0x12c279){if(_0x12c279){return _0x12c279[_0xe3a8('0x27')](_0x30fdf8)[_0xe3a8('0x28')](function(_0x54e02a){return _0x54e02a;});}return null;};}function removeEntity(_0x1c03fc){return function(_0x56f48f){if(_0x56f48f){return _0x56f48f[_0xe3a8('0x29')]()['then'](function(){var _0x5baf22=_0x56f48f[_0xe3a8('0x2a')]({'plain':!![]});var _0x5b971f=_0xe3a8('0x2b');return db['UserProfileResource'][_0xe3a8('0x29')]({'where':{'type':_0x5b971f,'resourceId':_0x5baf22['id']}})[_0xe3a8('0x28')](function(){return _0x56f48f;});})['then'](function(){_0x1c03fc[_0xe3a8('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbefdb5){return function(_0x311075){if(!_0x311075){_0xbefdb5[_0xe3a8('0x1d')](0x194);}return _0x311075;};}function handleError(_0x2ac8eb,_0x5a3e11){_0x5a3e11=_0x5a3e11||0x1f4;return function(_0x3497f2){logger[_0xe3a8('0x19')](_0x3497f2[_0xe3a8('0x2c')]);if(_0x3497f2[_0xe3a8('0x2d')]){delete _0x3497f2[_0xe3a8('0x2d')];}_0x2ac8eb[_0xe3a8('0x1e')](_0x5a3e11)['send'](_0x3497f2);};}function getImapHost(_0xe02826){switch(_0xe02826){case'gmail':return _0xe3a8('0x2e');case'yahoo':return _0xe3a8('0x2f');case _0xe3a8('0x30'):return _0xe3a8('0x31');case _0xe3a8('0x32'):return _0xe3a8('0x33');}throw new Error('Unknown\x20email\x20service\x20provider',_0xe02826);}function getSmtpHost(_0x2cd986){switch(_0x2cd986){case _0xe3a8('0x34'):return _0xe3a8('0x35');case _0xe3a8('0x36'):return'smtp.mail.yahoo.com';case _0xe3a8('0x30'):return _0xe3a8('0x37');case _0xe3a8('0x32'):return'smtp.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x2cd986);}function getAuthenticationOptions(_0x401430,_0x50ac1a){var _0x23eb03={};var _0x51cf41={};if(_0x401430){_0x23eb03['user']=_0x51cf41['user']=_0x50ac1a['username'];_0x23eb03['password']=_0x51cf41['pass']=_0x50ac1a[_0xe3a8('0x38')];if(_0x50ac1a[_0xe3a8('0x39')]){_0x23eb03[_0xe3a8('0x39')]=_0x51cf41[_0xe3a8('0x39')]=!![];_0x23eb03[_0xe3a8('0x3a')]=_0x51cf41[_0xe3a8('0x3a')]=_0x50ac1a['CloudProviderId'];_0x23eb03[_0xe3a8('0x38')]=_0x51cf41[_0xe3a8('0x3b')]=null;}else{_0x23eb03['CloudProviderId']=_0x51cf41[_0xe3a8('0x3a')]=null;}_0x23eb03[_0xe3a8('0x3c')]=getImapHost(_0x401430);_0x23eb03[_0xe3a8('0x3d')]=0x3e1;_0x51cf41[_0xe3a8('0x3c')]=getSmtpHost(_0x401430);_0x51cf41[_0xe3a8('0x3d')]=0x24b;_0x51cf41['secure']=![];_0x23eb03[_0xe3a8('0x3e')]=_0x51cf41['service']=null;}else{if(_0x50ac1a['authentication']){_0x23eb03[_0xe3a8('0x3f')]=_0x51cf41[_0xe3a8('0x3f')]=_0x50ac1a[_0xe3a8('0x40')];_0x23eb03[_0xe3a8('0x38')]=_0x51cf41[_0xe3a8('0x3b')]=_0x50ac1a['password'];}else{_0x23eb03['authentication']=_0x51cf41[_0xe3a8('0x41')]=![];_0x23eb03[_0xe3a8('0x3f')]=_0x51cf41[_0xe3a8('0x3f')]=null;_0x23eb03[_0xe3a8('0x38')]=_0x51cf41[_0xe3a8('0x3b')]=null;}_0x23eb03[_0xe3a8('0x3c')]=_0x50ac1a['Imap'][_0xe3a8('0x3c')];_0x23eb03[_0xe3a8('0x3d')]=_0x50ac1a['Imap'][_0xe3a8('0x3d')];_0x51cf41[_0xe3a8('0x3c')]=_0x50ac1a[_0xe3a8('0x42')][_0xe3a8('0x3c')];_0x51cf41[_0xe3a8('0x3d')]=_0x50ac1a['Smtp'][_0xe3a8('0x3d')];}return{'Imap':_0x23eb03,'Smtp':_0x51cf41};}exports[_0xe3a8('0x43')]=function(_0x582b32,_0x46053f){var _0x4e8722={'include':[{'model':db[_0xe3a8('0x44')],'as':_0xe3a8('0x45')},{'model':db[_0xe3a8('0x46')],'as':_0xe3a8('0x42')},{'model':db[_0xe3a8('0x47')],'as':'mandatoryDispositionPause'}]},_0x97ff7c={},_0x4f3b7f={'count':0x0,'rows':[]};var _0x1f9566=_['map'](db[_0xe3a8('0x48')][_0xe3a8('0x49')],function(_0x30e92b){return{'name':_0x30e92b['fieldName'],'type':_0x30e92b[_0xe3a8('0x4a')][_0xe3a8('0x4b')]};});_0x97ff7c['model']=_['map'](_0x1f9566,'name');_0x97ff7c['query']=_[_0xe3a8('0x4c')](_0x582b32[_0xe3a8('0x4d')]);_0x97ff7c['filters']=_[_0xe3a8('0x4e')](_0x97ff7c['model'],_0x97ff7c[_0xe3a8('0x4d')]);_0x4e8722[_0xe3a8('0x4f')]=_['intersection'](_0x97ff7c['model'],qs[_0xe3a8('0x50')](_0x582b32[_0xe3a8('0x4d')][_0xe3a8('0x50')]));_0x4e8722['attributes']=_0x4e8722[_0xe3a8('0x4f')][_0xe3a8('0x51')]?_0x4e8722[_0xe3a8('0x4f')]:_0x97ff7c['model'];if(!_0x582b32[_0xe3a8('0x4d')][_0xe3a8('0x52')]('nolimit')){_0x4e8722[_0xe3a8('0x23')]=qs['limit'](_0x582b32[_0xe3a8('0x4d')][_0xe3a8('0x23')]);_0x4e8722[_0xe3a8('0x21')]=qs[_0xe3a8('0x21')](_0x582b32[_0xe3a8('0x4d')][_0xe3a8('0x21')]);}_0x4e8722[_0xe3a8('0x53')]=qs['sort'](_0x582b32['query'][_0xe3a8('0x54')]);_0x4e8722[_0xe3a8('0x55')]=qs[_0xe3a8('0x56')](_[_0xe3a8('0x57')](_0x582b32[_0xe3a8('0x4d')],_0x97ff7c['filters']),_0x1f9566);if(_0x582b32[_0xe3a8('0x4d')][_0xe3a8('0x58')]){_0x4e8722[_0xe3a8('0x55')]=_[_0xe3a8('0x59')](_0x4e8722[_0xe3a8('0x55')],{'$or':_[_0xe3a8('0x5a')](_0x1f9566,function(_0x26857c){if(_0x26857c['type']!==_0xe3a8('0x5b')){var _0x14c064={};_0x14c064[_0x26857c[_0xe3a8('0x2d')]]={'$like':'%'+_0x582b32[_0xe3a8('0x4d')][_0xe3a8('0x58')]+'%'};return _0x14c064;}})});}_0x4e8722=_[_0xe3a8('0x59')]({},_0x4e8722,_0x582b32[_0xe3a8('0x5c')]);var _0x5c5079={'where':_0x4e8722[_0xe3a8('0x55')]};return db[_0xe3a8('0x48')]['count'](_0x5c5079)[_0xe3a8('0x28')](function(_0x930368){_0x4f3b7f[_0xe3a8('0x24')]=_0x930368;if(_0x582b32['query'][_0xe3a8('0x5d')]){_0x4e8722['include']=[{'all':!![]}];}return db['MailAccount'][_0xe3a8('0x5e')](_0x4e8722);})[_0xe3a8('0x28')](function(_0x39a3bc){_0x4f3b7f[_0xe3a8('0x5f')]=_0x39a3bc;return _0x4f3b7f;})[_0xe3a8('0x28')](respondWithFilteredResult(_0x46053f,_0x4e8722))[_0xe3a8('0x1c')](handleError(_0x46053f,null));};exports[_0xe3a8('0x60')]=function(_0x402792,_0x1b6f75){var _0x1c7950={'raw':![],'where':{'id':_0x402792[_0xe3a8('0x61')]['id']},'include':[{'model':db[_0xe3a8('0x44')],'as':_0xe3a8('0x45')},{'model':db[_0xe3a8('0x46')],'as':'Smtp'},{'model':db['Pause'],'as':_0xe3a8('0x62')}]},_0x4e4902={};_0x4e4902[_0xe3a8('0x63')]=_[_0xe3a8('0x4c')](db[_0xe3a8('0x48')][_0xe3a8('0x49')]);_0x4e4902[_0xe3a8('0x4d')]=_[_0xe3a8('0x4c')](_0x402792[_0xe3a8('0x4d')]);_0x4e4902[_0xe3a8('0x56')]=_[_0xe3a8('0x4e')](_0x4e4902[_0xe3a8('0x63')],_0x4e4902[_0xe3a8('0x4d')]);_0x1c7950['attributes']=_[_0xe3a8('0x4e')](_0x4e4902[_0xe3a8('0x63')],qs[_0xe3a8('0x50')](_0x402792[_0xe3a8('0x4d')][_0xe3a8('0x50')]));_0x1c7950[_0xe3a8('0x4f')]=_0x1c7950[_0xe3a8('0x4f')][_0xe3a8('0x51')]?_0x1c7950['attributes']:_0x4e4902[_0xe3a8('0x63')];if(_0x402792['query']['includeAll']){_0x1c7950[_0xe3a8('0x64')]=[{'all':!![]}];}_0x1c7950=_[_0xe3a8('0x59')]({},_0x1c7950,_0x402792['options']);return db['MailAccount'][_0xe3a8('0x65')](_0x1c7950)[_0xe3a8('0x28')](handleEntityNotFound(_0x1b6f75,null))[_0xe3a8('0x28')](respondWithResult(_0x1b6f75,null))[_0xe3a8('0x1c')](handleError(_0x1b6f75,null));};exports['update']=function(_0x85da19,_0x596b8e){if(_0x85da19['body']['id']){delete _0x85da19[_0xe3a8('0x66')]['id'];}var _0x15b0c0=_0x85da19[_0xe3a8('0x66')][_0xe3a8('0x67')]==='custom'?null:_0x85da19[_0xe3a8('0x66')][_0xe3a8('0x67')];var _0x3ae384=_0x85da19[_0xe3a8('0x66')]['Imap']||{};var _0x2910fe=_0x85da19['body'][_0xe3a8('0x42')]||{};if(_0x15b0c0){_0x3ae384[_0xe3a8('0x3c')]=getImapHost(_0x15b0c0);_0x3ae384['port']=0x3e1;_0x2910fe['host']=getSmtpHost(_0x15b0c0);_0x2910fe[_0xe3a8('0x3d')]=0x24b;_0x2910fe[_0xe3a8('0x68')]=![];}if(_0x2910fe[_0xe3a8('0x39')]){_0x2910fe[_0xe3a8('0x68')]=![];}else{_0x2910fe[_0xe3a8('0x3a')]=null;}if(!_0x3ae384['modernAuthentication'])_0x3ae384[_0xe3a8('0x3a')]=null;_0x85da19[_0xe3a8('0x66')]['Imap']=_0x3ae384;_0x85da19[_0xe3a8('0x66')][_0xe3a8('0x42')]=_0x2910fe;return db['MailAccount'][_0xe3a8('0x65')]({'where':{'id':_0x85da19['params']['id']},'include':[{'model':db[_0xe3a8('0x44')],'as':_0xe3a8('0x45')},{'model':db[_0xe3a8('0x46')],'as':_0xe3a8('0x42')},{'model':db[_0xe3a8('0x47')],'as':'mandatoryDispositionPause'}]})[_0xe3a8('0x28')](handleEntityNotFound(_0x596b8e,null))[_0xe3a8('0x28')](function(_0x5ea5c3){if(!_0x5ea5c3)throw new Error(_0xe3a8('0x69'));if(_0x5ea5c3[_0xe3a8('0x3e')])delete _0x85da19['body']['Imap'];return _0x5ea5c3;})[_0xe3a8('0x28')](saveUpdates(_0x85da19[_0xe3a8('0x66')],null))[_0xe3a8('0x28')](function(_0x5381d5){if(!_0x85da19[_0xe3a8('0x66')]['Imap'])return _0x5381d5;return db[_0xe3a8('0x44')][_0xe3a8('0x27')](_0x85da19[_0xe3a8('0x66')][_0xe3a8('0x45')],{'where':{'MailAccountId':_0x5381d5['id']}})[_0xe3a8('0x28')](function(){return _0x5381d5;});})['then'](function(_0x458eab){if(!_0x85da19['body']['Smtp'])return _0x458eab;return db[_0xe3a8('0x46')][_0xe3a8('0x27')](_0x85da19[_0xe3a8('0x66')]['Smtp'],{'where':{'MailAccountId':_0x458eab['id']}})[_0xe3a8('0x28')](function(){return _0x458eab;});})['then'](respondWithResult(_0x596b8e,null))['catch'](handleError(_0x596b8e,null));};exports[_0xe3a8('0x6a')]=function(_0x2b0b2e,_0x9db058){return db[_0xe3a8('0x48')][_0xe3a8('0x6a')]()[_0xe3a8('0x28')](respondWithResult(_0x9db058,null))[_0xe3a8('0x1c')](handleError(_0x9db058,null));};exports[_0xe3a8('0x6b')]=function(_0x18be42,_0x552496){if(_0x18be42[_0xe3a8('0x66')]['id']){delete _0x18be42[_0xe3a8('0x66')]['id'];}return db[_0xe3a8('0x48')]['find']({'where':{'id':_0x18be42['params']['id']}})[_0xe3a8('0x28')](handleEntityNotFound(_0x552496,null))[_0xe3a8('0x28')](function(_0x541ea0){if(_0x541ea0){_0x18be42[_0xe3a8('0x66')][_0xe3a8('0x6c')]=_0x541ea0['id'];return db[_0xe3a8('0x6d')]['create'](_0x18be42['body']);}})['then'](respondWithResult(_0x552496,null))[_0xe3a8('0x1c')](handleError(_0x552496,null));};exports[_0xe3a8('0x6e')]=function(_0x3ed596,_0x5d9a0b){var _0x35e5c8={'raw':![],'where':{}};var _0x4ce014={};var _0x2a492d={'count':0x0,'rows':[]};return db[_0xe3a8('0x48')][_0xe3a8('0x6f')]({'where':{'id':_0x3ed596['params']['id']}})[_0xe3a8('0x28')](handleEntityNotFound(_0x5d9a0b,null))[_0xe3a8('0x28')](function(_0x2231d1){if(_0x2231d1){_0x4ce014['model']=_[_0xe3a8('0x4c')](db[_0xe3a8('0x6d')][_0xe3a8('0x49')]);_0x4ce014[_0xe3a8('0x4d')]=_[_0xe3a8('0x4c')](_0x3ed596[_0xe3a8('0x4d')]);_0x4ce014['filters']=_[_0xe3a8('0x4e')](_0x4ce014[_0xe3a8('0x63')],_0x4ce014[_0xe3a8('0x4d')]);_0x35e5c8['attributes']=_[_0xe3a8('0x4e')](_0x4ce014[_0xe3a8('0x63')],qs[_0xe3a8('0x50')](_0x3ed596[_0xe3a8('0x4d')][_0xe3a8('0x50')]));_0x35e5c8[_0xe3a8('0x4f')]=_0x35e5c8['attributes'][_0xe3a8('0x51')]?_0x35e5c8[_0xe3a8('0x4f')]:_0x4ce014[_0xe3a8('0x63')];if(!_0x3ed596['query'][_0xe3a8('0x52')](_0xe3a8('0x70'))){_0x35e5c8[_0xe3a8('0x23')]=qs[_0xe3a8('0x23')](_0x3ed596[_0xe3a8('0x4d')][_0xe3a8('0x23')]);_0x35e5c8[_0xe3a8('0x21')]=qs[_0xe3a8('0x21')](_0x3ed596[_0xe3a8('0x4d')][_0xe3a8('0x21')]);}_0x35e5c8['order']=qs['sort'](_0x3ed596[_0xe3a8('0x4d')][_0xe3a8('0x54')]);_0x35e5c8[_0xe3a8('0x55')]=qs[_0xe3a8('0x56')](_[_0xe3a8('0x57')](_0x3ed596[_0xe3a8('0x4d')],_0x4ce014[_0xe3a8('0x56')]));_0x35e5c8[_0xe3a8('0x55')]['MailAccountId']=_0x2231d1['id'];if(_0x3ed596[_0xe3a8('0x4d')]['filter']){_0x35e5c8[_0xe3a8('0x55')]=_[_0xe3a8('0x59')](_0x35e5c8[_0xe3a8('0x55')],{'$or':_[_0xe3a8('0x5a')](_0x35e5c8[_0xe3a8('0x4f')],function(_0x334380){var _0x5cf1a5={};_0x5cf1a5[_0x334380]={'$like':'%'+_0x3ed596['query'][_0xe3a8('0x58')]+'%'};return _0x5cf1a5;})});}_0x35e5c8=_[_0xe3a8('0x59')]({},_0x35e5c8,_0x3ed596[_0xe3a8('0x5c')]);return db['Disposition'][_0xe3a8('0x24')]({'where':_0x35e5c8[_0xe3a8('0x55')]})['then'](function(_0x30387e){_0x2a492d[_0xe3a8('0x24')]=_0x30387e;if(_0x3ed596['query'][_0xe3a8('0x5d')]){_0x35e5c8[_0xe3a8('0x64')]=[{'all':!![]}];}return db[_0xe3a8('0x6d')][_0xe3a8('0x5e')](_0x35e5c8);})[_0xe3a8('0x28')](function(_0x28fb0d){_0x2a492d[_0xe3a8('0x5f')]=_0x28fb0d;return _0x2a492d;});}})['then'](respondWithFilteredResult(_0x5d9a0b,_0x35e5c8))[_0xe3a8('0x1c')](handleError(_0x5d9a0b,null));};exports[_0xe3a8('0x71')]=function(_0x6fd7fa,_0x44c5c3){return db[_0xe3a8('0x48')][_0xe3a8('0x65')]({'where':{'id':_0x6fd7fa[_0xe3a8('0x61')]['id']}})[_0xe3a8('0x28')](handleEntityNotFound(_0x44c5c3,null))[_0xe3a8('0x28')](function(_0x1f19bb){if(_0x1f19bb){return _0x1f19bb[_0xe3a8('0x71')](_0x6fd7fa[_0xe3a8('0x4d')][_0xe3a8('0x72')]);}})['then'](respondWithStatusCode(_0x44c5c3,null))[_0xe3a8('0x1c')](handleError(_0x44c5c3,null));};exports[_0xe3a8('0x73')]=function(_0xd07a3d,_0x997129){if(_0xd07a3d[_0xe3a8('0x66')]['id']){delete _0xd07a3d[_0xe3a8('0x66')]['id'];}return db[_0xe3a8('0x48')]['find']({'where':{'id':_0xd07a3d[_0xe3a8('0x61')]['id']}})[_0xe3a8('0x28')](handleEntityNotFound(_0x997129,null))[_0xe3a8('0x28')](function(_0x58178e){if(_0x58178e){_0xd07a3d['body']['MailAccountId']=_0x58178e['id'];return db[_0xe3a8('0x74')][_0xe3a8('0x75')](_0xd07a3d[_0xe3a8('0x66')]);}})['then'](respondWithResult(_0x997129,null))[_0xe3a8('0x1c')](handleError(_0x997129,null));};exports[_0xe3a8('0x76')]=function(_0x7ba9ec,_0x4da1f0){var _0x2fd7b2={'raw':![],'where':{}};var _0x9397ad={};var _0x365ba2={'count':0x0,'rows':[]};return db[_0xe3a8('0x48')]['findOne']({'where':{'id':_0x7ba9ec[_0xe3a8('0x61')]['id']}})[_0xe3a8('0x28')](handleEntityNotFound(_0x4da1f0,null))['then'](function(_0x4e7d8f){if(_0x4e7d8f){_0x9397ad[_0xe3a8('0x63')]=_[_0xe3a8('0x4c')](db['CannedAnswer'][_0xe3a8('0x49')]);_0x9397ad[_0xe3a8('0x4d')]=_[_0xe3a8('0x4c')](_0x7ba9ec[_0xe3a8('0x4d')]);_0x9397ad[_0xe3a8('0x56')]=_[_0xe3a8('0x4e')](_0x9397ad[_0xe3a8('0x63')],_0x9397ad[_0xe3a8('0x4d')]);_0x2fd7b2[_0xe3a8('0x4f')]=_[_0xe3a8('0x4e')](_0x9397ad[_0xe3a8('0x63')],qs[_0xe3a8('0x50')](_0x7ba9ec[_0xe3a8('0x4d')][_0xe3a8('0x50')]));_0x2fd7b2['attributes']=_0x2fd7b2[_0xe3a8('0x4f')][_0xe3a8('0x51')]?_0x2fd7b2[_0xe3a8('0x4f')]:_0x9397ad['model'];if(!_0x7ba9ec[_0xe3a8('0x4d')][_0xe3a8('0x52')](_0xe3a8('0x70'))){_0x2fd7b2['limit']=qs[_0xe3a8('0x23')](_0x7ba9ec[_0xe3a8('0x4d')][_0xe3a8('0x23')]);_0x2fd7b2[_0xe3a8('0x21')]=qs[_0xe3a8('0x21')](_0x7ba9ec[_0xe3a8('0x4d')]['offset']);}_0x2fd7b2[_0xe3a8('0x53')]=qs[_0xe3a8('0x54')](_0x7ba9ec[_0xe3a8('0x4d')]['sort']);_0x2fd7b2[_0xe3a8('0x55')]=qs[_0xe3a8('0x56')](_[_0xe3a8('0x57')](_0x7ba9ec[_0xe3a8('0x4d')],_0x9397ad[_0xe3a8('0x56')]));_0x2fd7b2['where'][_0xe3a8('0x6c')]=_0x4e7d8f['id'];if(_0x7ba9ec[_0xe3a8('0x4d')][_0xe3a8('0x58')]){_0x2fd7b2['where']=_[_0xe3a8('0x59')](_0x2fd7b2[_0xe3a8('0x55')],{'$or':_[_0xe3a8('0x5a')](_0x2fd7b2['attributes'],function(_0x24f526){var _0x5761f4={};_0x5761f4[_0x24f526]={'$like':'%'+_0x7ba9ec['query']['filter']+'%'};return _0x5761f4;})});}_0x2fd7b2=_[_0xe3a8('0x59')]({},_0x2fd7b2,_0x7ba9ec['options']);return db[_0xe3a8('0x74')]['count']({'where':_0x2fd7b2['where']})[_0xe3a8('0x28')](function(_0x307409){_0x365ba2[_0xe3a8('0x24')]=_0x307409;if(_0x7ba9ec[_0xe3a8('0x4d')][_0xe3a8('0x5d')]){_0x2fd7b2[_0xe3a8('0x64')]=[{'all':!![]}];}return db['CannedAnswer'][_0xe3a8('0x5e')](_0x2fd7b2);})[_0xe3a8('0x28')](function(_0x1b06f2){_0x365ba2[_0xe3a8('0x5f')]=_0x1b06f2;return _0x365ba2;});}})[_0xe3a8('0x28')](respondWithFilteredResult(_0x4da1f0,_0x2fd7b2))[_0xe3a8('0x1c')](handleError(_0x4da1f0,null));};exports['removeAnswers']=function(_0x4fe6c9,_0x294a32){return db['MailAccount'][_0xe3a8('0x65')]({'where':{'id':_0x4fe6c9[_0xe3a8('0x61')]['id']}})['then'](handleEntityNotFound(_0x294a32,null))['then'](function(_0x2f61a8){if(_0x2f61a8){return _0x2f61a8[_0xe3a8('0x77')](_0x4fe6c9[_0xe3a8('0x4d')][_0xe3a8('0x72')]);}})[_0xe3a8('0x28')](respondWithStatusCode(_0x294a32,null))[_0xe3a8('0x1c')](handleError(_0x294a32,null));};exports['create']=function(_0x7644d0,_0x36cb6d){var _0x12341e={'name':_0x7644d0[_0xe3a8('0x66')]['name'],'key':_0x7644d0[_0xe3a8('0x66')][_0xe3a8('0x4b')],'provider':_0x7644d0[_0xe3a8('0x66')][_0xe3a8('0x67')]===_0xe3a8('0x78')?null:_0x7644d0[_0xe3a8('0x66')][_0xe3a8('0x67')],'email':_0x7644d0[_0xe3a8('0x66')][_0xe3a8('0x79')],'ListId':_0x7644d0['body']['ListId'],'active':!_[_0xe3a8('0x7a')](_0x7644d0[_0xe3a8('0x66')][_0xe3a8('0x7b')])?_0x7644d0[_0xe3a8('0x66')][_0xe3a8('0x7b')]:!![],'description':_0x7644d0[_0xe3a8('0x66')]['description']||null};var _0x3002a6=getAuthenticationOptions(_0x12341e[_0xe3a8('0x67')],_0x7644d0[_0xe3a8('0x66')]);_0x12341e[_0xe3a8('0x45')]=_0x3002a6[_0xe3a8('0x45')];_0x12341e['Smtp']=_0x3002a6['Smtp'];return db[_0xe3a8('0x48')]['create'](_0x12341e,{'include':[{'model':db[_0xe3a8('0x46')],'as':'Smtp'},{'model':db[_0xe3a8('0x44')],'as':_0xe3a8('0x45')}]})[_0xe3a8('0x28')](function(_0x5a5735){var _0x46a7fb=_0x7644d0[_0xe3a8('0x3f')]['get']({'plain':!![]});if(!_0x46a7fb)throw new Error(_0xe3a8('0x7c'));if(_0x46a7fb[_0xe3a8('0x7d')]==='user'){var _0x2ae630=_0x5a5735['get']({'plain':!![]});return db[_0xe3a8('0x7e')]['find']({'where':{'name':_0xe3a8('0x2b'),'userProfileId':_0x46a7fb[_0xe3a8('0x7f')]},'raw':!![]})[_0xe3a8('0x28')](function(_0x5a9c21){if(_0x5a9c21&&_0x5a9c21[_0xe3a8('0x80')]===0x0){return db[_0xe3a8('0x81')][_0xe3a8('0x75')]({'name':_0x2ae630[_0xe3a8('0x2d')],'resourceId':_0x2ae630['id'],'type':_0x5a9c21['name'],'sectionId':_0x5a9c21['id']},{})[_0xe3a8('0x28')](function(){return _0x5a5735;});}else{return _0x5a5735;}})['catch'](function(_0x3b9731){logger['error'](_0xe3a8('0x82'),_0x3b9731);throw _0x3b9731;});}return _0x5a5735;})[_0xe3a8('0x28')](respondWithResult(_0x36cb6d,0xc9))[_0xe3a8('0x1c')](handleError(_0x36cb6d,null));};exports[_0xe3a8('0x83')]=function(_0x382d8b,_0x42aa32){return db['MailAccount'][_0xe3a8('0x6f')]({'where':{'id':_0x382d8b[_0xe3a8('0x61')]['id']}})[_0xe3a8('0x28')](handleEntityNotFound(_0x42aa32,null))[_0xe3a8('0x28')](function(_0x161f23){if(_0x161f23){return _0x161f23['getImap']();}return null;})[_0xe3a8('0x28')](respondWithResult(_0x42aa32,null))[_0xe3a8('0x1c')](handleError(_0x42aa32,null));};exports[_0xe3a8('0x84')]=function(_0x305a06,_0x496637){if(_0x305a06[_0xe3a8('0x66')]['id']){delete _0x305a06[_0xe3a8('0x66')]['id'];}return db[_0xe3a8('0x48')][_0xe3a8('0x65')]({'where':{'id':_0x305a06[_0xe3a8('0x61')]['id']}})['then'](handleEntityNotFound(_0x496637,null))['then'](function(_0x29d6f1){if(_0x29d6f1){_0x305a06['body'][_0xe3a8('0x6c')]=_0x29d6f1['id'];return db[_0xe3a8('0x44')][_0xe3a8('0x75')](_0x305a06[_0xe3a8('0x66')]);}})[_0xe3a8('0x28')](respondWithResult(_0x496637,null))[_0xe3a8('0x1c')](handleError(_0x496637,null));};exports[_0xe3a8('0x85')]=function(_0x4592f4,_0x39b30a){return db[_0xe3a8('0x48')][_0xe3a8('0x6f')]({'where':{'id':_0x4592f4[_0xe3a8('0x61')]['id']}})[_0xe3a8('0x28')](handleEntityNotFound(_0x39b30a,null))[_0xe3a8('0x28')](function(_0x506690){if(_0x506690){return _0x506690['setImap'](null);}return null;})[_0xe3a8('0x28')](respondWithStatusCode(_0x39b30a,null))[_0xe3a8('0x1c')](handleError(_0x39b30a,null));};exports['getSmtp']=function(_0x45afed,_0x270982){return db['MailAccount'][_0xe3a8('0x6f')]({'where':{'id':_0x45afed[_0xe3a8('0x61')]['id']}})[_0xe3a8('0x28')](handleEntityNotFound(_0x270982,null))[_0xe3a8('0x28')](function(_0x116c01){if(_0x116c01){return _0x116c01[_0xe3a8('0x86')]();}return null;})[_0xe3a8('0x28')](respondWithResult(_0x270982,null))[_0xe3a8('0x1c')](handleError(_0x270982,null));};exports[_0xe3a8('0x87')]=function(_0x3095b0,_0x5dbe51){if(_0x3095b0[_0xe3a8('0x66')]['id']){delete _0x3095b0[_0xe3a8('0x66')]['id'];}return db[_0xe3a8('0x48')][_0xe3a8('0x65')]({'where':{'id':_0x3095b0[_0xe3a8('0x61')]['id']}})[_0xe3a8('0x28')](handleEntityNotFound(_0x5dbe51,null))[_0xe3a8('0x28')](function(_0x1cf5c4){if(_0x1cf5c4){_0x3095b0['body'][_0xe3a8('0x6c')]=_0x1cf5c4['id'];return db['MailServerOut'][_0xe3a8('0x75')](_0x3095b0['body']);}})[_0xe3a8('0x28')](respondWithResult(_0x5dbe51,null))['catch'](handleError(_0x5dbe51,null));};exports[_0xe3a8('0x88')]=function(_0x592632,_0x1474ce){return db[_0xe3a8('0x48')][_0xe3a8('0x6f')]({'where':{'id':_0x592632['params']['id']}})[_0xe3a8('0x28')](handleEntityNotFound(_0x1474ce,null))[_0xe3a8('0x28')](function(_0x5646c9){if(_0x5646c9){return _0x5646c9[_0xe3a8('0x89')](null);}return null;})[_0xe3a8('0x28')](respondWithStatusCode(_0x1474ce,null))[_0xe3a8('0x1c')](handleError(_0x1474ce,null));};exports[_0xe3a8('0x8a')]=function(_0x48dc77,_0x34a8dd){return db['MailInteraction'][_0xe3a8('0x65')]({'where':{'id':_0x48dc77[_0xe3a8('0x61')]['id']}})[_0xe3a8('0x28')](handleEntityNotFound(_0x34a8dd,null))[_0xe3a8('0x28')](function(_0x3047e2){if(_0x3047e2){return _0x3047e2[_0xe3a8('0x8a')](_0x48dc77[_0xe3a8('0x66')]['ids'],_[_0xe3a8('0x8b')](_0x48dc77[_0xe3a8('0x66')],['ids','id'])||{});}})[_0xe3a8('0x28')](respondWithResult(_0x34a8dd,null))[_0xe3a8('0x1c')](handleError(_0x34a8dd,null));};exports[_0xe3a8('0x8c')]=function(_0x189de3,_0x495768){var _0x550ee3={'raw':![],'where':{}};var _0x241d00={};var _0x4283e2={'count':0x0,'rows':[]};return db[_0xe3a8('0x48')][_0xe3a8('0x6f')]({'where':{'id':_0x189de3[_0xe3a8('0x61')]['id']}})['then'](handleEntityNotFound(_0x495768,null))[_0xe3a8('0x28')](function(_0x335cbe){if(_0x335cbe){_0x241d00[_0xe3a8('0x63')]=_[_0xe3a8('0x4c')](db['MailInteraction'][_0xe3a8('0x49')]);_0x241d00[_0xe3a8('0x4d')]=_['keys'](_0x189de3[_0xe3a8('0x4d')]);_0x241d00[_0xe3a8('0x56')]=_[_0xe3a8('0x4e')](_0x241d00[_0xe3a8('0x63')],_0x241d00[_0xe3a8('0x4d')]);_0x550ee3[_0xe3a8('0x4f')]=_[_0xe3a8('0x4e')](_0x241d00[_0xe3a8('0x63')],qs[_0xe3a8('0x50')](_0x189de3[_0xe3a8('0x4d')][_0xe3a8('0x50')]));_0x550ee3['attributes']=_0x550ee3[_0xe3a8('0x4f')][_0xe3a8('0x51')]?_0x550ee3['attributes']:_0x241d00[_0xe3a8('0x63')];if(!_0x189de3[_0xe3a8('0x4d')][_0xe3a8('0x52')](_0xe3a8('0x70'))){_0x550ee3[_0xe3a8('0x23')]=qs[_0xe3a8('0x23')](_0x189de3[_0xe3a8('0x4d')][_0xe3a8('0x23')]);_0x550ee3[_0xe3a8('0x21')]=qs[_0xe3a8('0x21')](_0x189de3[_0xe3a8('0x4d')][_0xe3a8('0x21')]);}_0x550ee3['order']=qs[_0xe3a8('0x54')](_0x189de3[_0xe3a8('0x4d')][_0xe3a8('0x54')]);_0x550ee3[_0xe3a8('0x55')]=qs[_0xe3a8('0x56')](_['pick'](_0x189de3[_0xe3a8('0x4d')],_0x241d00[_0xe3a8('0x56')]));_0x550ee3[_0xe3a8('0x55')][_0xe3a8('0x6c')]=_0x335cbe['id'];if(_0x189de3[_0xe3a8('0x4d')]['filter']){_0x550ee3[_0xe3a8('0x55')]=_[_0xe3a8('0x59')](_0x550ee3[_0xe3a8('0x55')],{'$or':_[_0xe3a8('0x5a')](_0x550ee3[_0xe3a8('0x4f')],function(_0x5afeb0){var _0x4bf9ac={};_0x4bf9ac[_0x5afeb0]={'$like':'%'+_0x189de3[_0xe3a8('0x4d')][_0xe3a8('0x58')]+'%'};return _0x4bf9ac;})});}_0x550ee3=_[_0xe3a8('0x59')]({},_0x550ee3,_0x189de3[_0xe3a8('0x5c')]);return db['MailInteraction']['count']({'where':_0x550ee3['where']})[_0xe3a8('0x28')](function(_0x107599){_0x4283e2[_0xe3a8('0x24')]=_0x107599;if(_0x189de3[_0xe3a8('0x4d')]['includeAll']){_0x550ee3['include']=[{'model':db[_0xe3a8('0x8d')],'as':_0xe3a8('0x8e'),'required':![]},{'model':db[_0xe3a8('0x8f')],'as':'Owner','attributes':[_0xe3a8('0x2d'),_0xe3a8('0x90'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xe3a8('0x2d'),_0xe3a8('0x91')],'where':_0x189de3['query'][_0xe3a8('0x92')]?{'id':_0x189de3['query'][_0xe3a8('0x92')]}:undefined,'required':_0x189de3[_0xe3a8('0x4d')][_0xe3a8('0x92')]?!![]:![]}];}return db[_0xe3a8('0x93')][_0xe3a8('0x5e')](_0x550ee3);})['then'](function(_0x4ae53e){_0x4283e2['rows']=_0x4ae53e;return _0x4283e2;});}})['then'](respondWithFilteredResult(_0x495768,_0x550ee3))[_0xe3a8('0x1c')](handleError(_0x495768,null));};exports[_0xe3a8('0x94')]=function addApplications(_0x2a2040,_0x36d456){var _0x3f5396=_0x2a2040['params']['id'];var _0x1e7a14=_0x2a2040[_0xe3a8('0x66')];var _0x42a2f6=0xc8;var _0xad3669=null;return db[_0xe3a8('0x95')][_0xe3a8('0x96')]({'isolationLevel':db[_0xe3a8('0x95')]['Transaction'][_0xe3a8('0x97')]['READ_COMMITTED']},function(_0x34ff87){return db[_0xe3a8('0x48')]['findOne']({'where':{'id':_0x3f5396},'transaction':_0x34ff87})[_0xe3a8('0x28')](function(_0x54f5ba){if(_0x54f5ba){return db[_0xe3a8('0x98')][_0xe3a8('0x29')]({'where':{'MailAccountId':_0x3f5396},'transaction':_0x34ff87})[_0xe3a8('0x28')](function(){var _0xbe736=_['map'](_0x1e7a14,function(_0x448c98){_0x448c98[_0xe3a8('0x6c')]=_0x3f5396;return _0x448c98;});return db[_0xe3a8('0x98')][_0xe3a8('0x99')](_0xbe736,{'transaction':_0x34ff87});});}else{_0x42a2f6=0x194;_0xad3669=[];}});})[_0xe3a8('0x28')](function(){if(_0x42a2f6!==0x194){return db[_0xe3a8('0x98')][_0xe3a8('0x9a')]({'where':{'MailAccountId':_0x3f5396},'order':_0xe3a8('0x9b')})[_0xe3a8('0x28')](function(_0x57c88c){_0xad3669=_0x57c88c;});}})[_0xe3a8('0x1c')](function(_0x38b523){_0x42a2f6=0x1f4;logger['error'](_0x38b523[_0xe3a8('0x2c')]);if(_0x38b523[_0xe3a8('0x2d')]){delete _0x38b523[_0xe3a8('0x2d')];}_0xad3669=_0x38b523;})[_0xe3a8('0x9c')](function(){if(_0xad3669===null){_0x36d456[_0xe3a8('0x1d')](_0x42a2f6);}else{if(_0x42a2f6===0x1f4){_0x36d456['status'](_0x42a2f6)[_0xe3a8('0x9d')](_0xad3669);}else{_0x36d456[_0xe3a8('0x1e')](_0x42a2f6)[_0xe3a8('0x20')](_0xad3669);}}});};exports[_0xe3a8('0x9e')]=function(_0x2667d9,_0x2be840){var _0x4bd2e9={};var _0x380dce={};var _0x5928cd;var _0x4fde21;return db['MailAccount'][_0xe3a8('0x6f')]({'where':{'id':_0x2667d9['params']['id']}})['then'](handleEntityNotFound(_0x2be840,null))['then'](function(_0x5c6b94){if(_0x5c6b94){_0x5928cd=_0x5c6b94;_0x380dce[_0xe3a8('0x63')]=_['keys'](db[_0xe3a8('0x98')][_0xe3a8('0x49')]);_0x380dce[_0xe3a8('0x4d')]=_[_0xe3a8('0x4c')](_0x2667d9[_0xe3a8('0x4d')]);_0x380dce[_0xe3a8('0x56')]=_[_0xe3a8('0x4e')](_0x380dce[_0xe3a8('0x63')],_0x380dce[_0xe3a8('0x4d')]);_0x4bd2e9[_0xe3a8('0x4f')]=_[_0xe3a8('0x4e')](_0x380dce[_0xe3a8('0x63')],qs[_0xe3a8('0x50')](_0x2667d9[_0xe3a8('0x4d')][_0xe3a8('0x50')]));_0x4bd2e9[_0xe3a8('0x4f')]=_0x4bd2e9[_0xe3a8('0x4f')][_0xe3a8('0x51')]?_0x4bd2e9[_0xe3a8('0x4f')]:_0x380dce[_0xe3a8('0x63')];_0x4bd2e9[_0xe3a8('0x53')]=qs['sort'](_0x2667d9['query'][_0xe3a8('0x54')]);_0x4bd2e9['where']=qs[_0xe3a8('0x56')](_['pick'](_0x2667d9[_0xe3a8('0x4d')],_0x380dce[_0xe3a8('0x56')]));if(_0x2667d9[_0xe3a8('0x4d')][_0xe3a8('0x58')]){_0x4bd2e9[_0xe3a8('0x55')]=_[_0xe3a8('0x59')](_0x4bd2e9['where'],{'$or':_[_0xe3a8('0x5a')](_0x4bd2e9[_0xe3a8('0x4f')],function(_0x4098be){var _0x4f36c4={};_0x4f36c4[_0x4098be]={'$like':'%'+_0x2667d9[_0xe3a8('0x4d')][_0xe3a8('0x58')]+'%'};return _0x4f36c4;})});}_0x4bd2e9=_[_0xe3a8('0x59')]({},_0x4bd2e9,_0x2667d9['options']);return _0x5928cd[_0xe3a8('0x9e')](_0x4bd2e9);}})[_0xe3a8('0x28')](function(_0xaad099){if(_0xaad099){_0x4fde21=_0xaad099[_0xe3a8('0x51')];if(!_0x2667d9[_0xe3a8('0x4d')][_0xe3a8('0x52')](_0xe3a8('0x70'))){_0x4bd2e9['limit']=qs['limit'](_0x2667d9['query'][_0xe3a8('0x23')]);_0x4bd2e9[_0xe3a8('0x21')]=qs['offset'](_0x2667d9['query'][_0xe3a8('0x21')]);}return _0x5928cd[_0xe3a8('0x9e')](_0x4bd2e9);}})[_0xe3a8('0x28')](function(_0x128d28){if(_0x128d28){return _0x128d28?{'count':_0x4fde21,'rows':_0x128d28}:null;}})[_0xe3a8('0x28')](respondWithResult(_0x2be840,null))[_0xe3a8('0x1c')](handleError(_0x2be840,null));};exports[_0xe3a8('0x9f')]=function(_0x271c56,_0x19a5b0){var _0x12f05a={'raw':!![],'where':{}};var _0x3e9e62={};var _0xe5c71e={'count':0x0,'rows':[]};return db['MailAccount'][_0xe3a8('0x6f')]({'where':{'id':_0x271c56['params']['id']}})[_0xe3a8('0x28')](handleEntityNotFound(_0x19a5b0,null))['then'](function(_0x6b589e){if(_0x6b589e){_0x3e9e62[_0xe3a8('0x63')]=_[_0xe3a8('0x4c')](db[_0xe3a8('0xa0')][_0xe3a8('0x49')]);_0x3e9e62[_0xe3a8('0x4d')]=_['keys'](_0x271c56[_0xe3a8('0x4d')]);_0x3e9e62[_0xe3a8('0x56')]=_['intersection'](_0x3e9e62[_0xe3a8('0x63')],_0x3e9e62[_0xe3a8('0x4d')]);_0x12f05a[_0xe3a8('0x4f')]=_['intersection'](_0x3e9e62['model'],qs['fields'](_0x271c56[_0xe3a8('0x4d')][_0xe3a8('0x50')]));_0x12f05a[_0xe3a8('0x4f')]=_0x12f05a[_0xe3a8('0x4f')][_0xe3a8('0x51')]?_0x12f05a['attributes']:_0x3e9e62[_0xe3a8('0x63')];if(!_0x271c56[_0xe3a8('0x4d')][_0xe3a8('0x52')](_0xe3a8('0x70'))){_0x12f05a[_0xe3a8('0x23')]=qs[_0xe3a8('0x23')](_0x271c56['query'][_0xe3a8('0x23')]);_0x12f05a[_0xe3a8('0x21')]=qs['offset'](_0x271c56[_0xe3a8('0x4d')][_0xe3a8('0x21')]);}_0x12f05a[_0xe3a8('0x53')]=qs[_0xe3a8('0x54')](_0x271c56['query'][_0xe3a8('0x54')]);_0x12f05a[_0xe3a8('0x55')]=qs[_0xe3a8('0x56')](_[_0xe3a8('0x57')](_0x271c56[_0xe3a8('0x4d')],_0x3e9e62[_0xe3a8('0x56')]));_0x12f05a[_0xe3a8('0x55')][_0xe3a8('0x6c')]=_0x6b589e['id'];if(_0x271c56['query'][_0xe3a8('0x58')]){_0x12f05a[_0xe3a8('0x55')]=_[_0xe3a8('0x59')](_0x12f05a[_0xe3a8('0x55')],{'$or':_[_0xe3a8('0x5a')](_0x12f05a[_0xe3a8('0x4f')],function(_0x39efb7){var _0x2f2510={};_0x2f2510[_0x39efb7]={'$like':'%'+_0x271c56[_0xe3a8('0x4d')]['filter']+'%'};return _0x2f2510;})});}if(_0x271c56[_0xe3a8('0x4d')][_0xe3a8('0xa1')]){var _0x581f4b=_0x271c56[_0xe3a8('0x4d')][_0xe3a8('0xa1')]['split'](',');var _0x4b7426={};_0x4b7426[_0x581f4b[0x0]]={'$gte':moment(_0x581f4b[0x1])[_0xe3a8('0xa2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x12f05a['where']=_[_0xe3a8('0x59')](_0x12f05a[_0xe3a8('0x55')],_0x4b7426);}_0x12f05a=_['merge']({},_0x12f05a,_0x271c56['options']);return db['MailMessage'][_0xe3a8('0x24')]({'where':_0x12f05a[_0xe3a8('0x55')]})[_0xe3a8('0x28')](function(_0x526b6d){_0xe5c71e[_0xe3a8('0x24')]=_0x526b6d;if(_0x271c56['query']['includeAll']){_0x12f05a[_0xe3a8('0x64')]=[{'all':!![]}];}return db[_0xe3a8('0xa0')]['findAll'](_0x12f05a);})['then'](function(_0x20ad5d){if(_0x271c56[_0xe3a8('0x4d')][_0xe3a8('0xa3')]===_0xe3a8('0xa4')){for(var _0x34d4e5=0x0;_0x34d4e5<_0x20ad5d[_0xe3a8('0x51')];_0x34d4e5++){_0x20ad5d[_0x34d4e5][_0xe3a8('0x66')]=juice(_0x20ad5d[_0x34d4e5][_0xe3a8('0x66')]);}}_0xe5c71e['rows']=_0x20ad5d;return _0xe5c71e;});}})['then'](respondWithFilteredResult(_0x19a5b0,_0x12f05a))[_0xe3a8('0x1c')](handleError(_0x19a5b0,null));};exports[_0xe3a8('0x9d')]=function(_0x387bd3,_0x20a71d){var _0x5e62ad,_0x41e82b={},_0x32e13f;if(_0x387bd3[_0xe3a8('0x66')]['to']){_0x32e13f=_0x387bd3[_0xe3a8('0x66')]['to']['split'](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x387bd3[_0xe3a8('0x61')]['id']},'include':[{'model':db[_0xe3a8('0xa5')],'as':'List','include':[{'model':db[_0xe3a8('0x8d')],'as':_0xe3a8('0xa6'),'where':{'email':_0x32e13f},'limit':0x1,'order':[[_0xe3a8('0xa7'),_0xe3a8('0xa8')]]}]},{'model':db[_0xe3a8('0x46')],'as':_0xe3a8('0x42'),'raw':!![],'include':[{'model':db[_0xe3a8('0xa9')],'as':_0xe3a8('0xa9'),'raw':!![]}]}]})[_0xe3a8('0x28')](handleEntityNotFound(_0x20a71d,null))['then'](function(_0x3b548b){if(!_0x3b548b)return;_0x5e62ad=_0x3b548b;if(!_0x3b548b[_0xe3a8('0x42')])throw new Error(_0xe3a8('0xaa'));if(_[_0xe3a8('0x7a')](_0x387bd3['body']['from'])){_0x387bd3[_0xe3a8('0x66')]['from']=util[_0xe3a8('0xa2')]('%s\x20<%s>',_0x3b548b['name'],_0x3b548b[_0xe3a8('0x79')]||_0x3b548b[_0xe3a8('0x42')][_0xe3a8('0x3f')]);}if(_0x387bd3[_0xe3a8('0x66')][_0xe3a8('0xab')]&&_0x387bd3[_0xe3a8('0x66')]['attachments'][_0xe3a8('0x51')]){for(var _0x5d9df6=0x0;_0x5d9df6<_0x387bd3[_0xe3a8('0x66')][_0xe3a8('0xab')]['length'];_0x5d9df6+=0x1){_0x387bd3['body'][_0xe3a8('0xab')][_0x5d9df6]={'filename':_0x387bd3['body']['attachments'][_0x5d9df6][_0xe3a8('0x2d')],'path':path[_0xe3a8('0xac')](config[_0xe3a8('0xad')],'server/files/attachments',_0x387bd3[_0xe3a8('0x66')][_0xe3a8('0xab')][_0x5d9df6]['basename'])};}}var _0x3c3ebe=_0x3b548b['getSmtpOptions']();return respondWithRpcPromise(_0xe3a8('0xae'),_0xe3a8('0xaf'),{'account':_0x3c3ebe,'message':_0x387bd3['body']});})['then'](function(_0x469ada){if(!_0x469ada)return;_0x41e82b=_0x469ada;if(!_0x5e62ad['List'])throw new Error(_0xe3a8('0xb0'));if(_0x5e62ad[_0xe3a8('0xb1')][_0xe3a8('0xa6')][_0xe3a8('0x51')])return _0x5e62ad[_0xe3a8('0xb1')]['Contacts'][0x0];return db[_0xe3a8('0x8d')]['create'](_[_0xe3a8('0xb')](_0x387bd3[_0xe3a8('0x66')],{'firstName':_0x387bd3[_0xe3a8('0x66')]['to'],'email':_0x387bd3[_0xe3a8('0x66')]['to'],'phone':_0x387bd3['body']['to'],'ListId':_0x5e62ad[_0xe3a8('0xb2')]}));})['then'](function(_0x155faf){if(!_0x155faf)return;var _0x2ebb32={'UserId':_0x387bd3[_0xe3a8('0x3f')]['id'],'ContactId':_0x155faf['id'],'MailAccountId':_0x5e62ad['id'],'inReplyTo':_0x41e82b['messageId'],'to':_0x387bd3[_0xe3a8('0x66')][_0xe3a8('0xb3')],'cc':_0x387bd3['body']['cc'],'subject':_0x387bd3[_0xe3a8('0x66')][_0xe3a8('0xb4')],'attach':_0x387bd3[_0xe3a8('0x66')]['attach'],'firstMsgDirection':_0xe3a8('0xb5'),'lastMsgAt':moment()['format'](_0xe3a8('0xb6')),'lastMsgDirection':_0xe3a8('0xb5'),'Messages':[_[_0xe3a8('0x59')](_0x387bd3[_0xe3a8('0x66')],{'messageId':_0x41e82b[_0xe3a8('0xb7')],'sentAt':moment()[_0xe3a8('0xa2')](_0xe3a8('0xb6')),'read':!![],'MailAccountId':_0x5e62ad['id'],'UserId':_0x387bd3[_0xe3a8('0x3f')]['id'],'ContactId':_0x155faf['id']})]};if(_0x387bd3[_0xe3a8('0x66')]['Interaction']){_0x2ebb32=_[_0xe3a8('0x59')](_0x2ebb32,_0x387bd3[_0xe3a8('0x66')][_0xe3a8('0xb8')]);}return db[_0xe3a8('0x93')][_0xe3a8('0x75')](_0x2ebb32,{'include':[{'model':db[_0xe3a8('0xa0')],'as':_0xe3a8('0xb9')}]});})[_0xe3a8('0x28')](respondWithResult(_0x20a71d,null))[_0xe3a8('0x1c')](handleError(_0x20a71d,null));};exports[_0xe3a8('0xba')]=function(_0x5e8ddd,_0x4b8a1f){return db[_0xe3a8('0x48')]['find']({'where':{'id':_0x5e8ddd['params']['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xe3a8('0xa9')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x4b8a1f,null))[_0xe3a8('0x28')](function(_0x49b4dc){if(!_0x49b4dc[_0xe3a8('0x42')])return;var _0x480d75=_0x49b4dc['getSmtpOptions']();return respondWithRpcPromise(_0xe3a8('0xbb'),_0xe3a8('0xba'),{'account':_0x480d75});})[_0xe3a8('0x28')](respondWithResult(_0x4b8a1f,null))['catch'](handleError(_0x4b8a1f,null));};exports['destroy']=function(_0x34be79,_0x4cb696){return db[_0xe3a8('0x48')][_0xe3a8('0x65')]({'where':{'id':_0x34be79['params']['id']}})[_0xe3a8('0x28')](handleEntityNotFound(_0x4cb696,null))[_0xe3a8('0x28')](function(_0x156801){if(_0x156801&&_0x156801[_0xe3a8('0x3e')]){throw new db[(_0xe3a8('0xbc'))][(_0xe3a8('0xbd'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x156801;})[_0xe3a8('0x28')](removeEntity(_0x4cb696,null))[_0xe3a8('0x1c')](handleError(_0x4cb696,null));};exports[_0xe3a8('0xbe')]=function(_0x3a5883,_0x21dcfa){return db['MailAccount'][_0xe3a8('0x65')]({'where':{'id':_0x3a5883[_0xe3a8('0x61')]['id']}})[_0xe3a8('0x28')](handleEntityNotFound(_0x21dcfa,null))[_0xe3a8('0x28')](function(_0x559cc7){if(_0x559cc7){return _0x559cc7[_0xe3a8('0xbe')](_0x3a5883['body']['ids'],_[_0xe3a8('0x8b')](_0x3a5883[_0xe3a8('0x66')],['ids','id'])||{})['spread'](function(_0x2f56d3){for(var _0x440131=0x0;_0x440131<_0x3a5883[_0xe3a8('0x66')][_0xe3a8('0x72')]['length'];_0x440131+=0x1){socket[_0xe3a8('0xbf')](_0xe3a8('0xc0'),{'UserId':Number(_0x3a5883[_0xe3a8('0x66')][_0xe3a8('0x72')][_0x440131]),'MailAccountId':Number(_0x3a5883[_0xe3a8('0x61')]['id'])});}return _0x2f56d3;});}})[_0xe3a8('0x28')](respondWithResult(_0x21dcfa,null))[_0xe3a8('0x1c')](handleError(_0x21dcfa,null));};exports[_0xe3a8('0xc1')]=function(_0x5921c1,_0x140541){return db[_0xe3a8('0x48')][_0xe3a8('0x65')]({'where':{'id':_0x5921c1[_0xe3a8('0x61')]['id']}})[_0xe3a8('0x28')](handleEntityNotFound(_0x140541,null))['then'](function(_0x156d67){if(_0x156d67){return _0x156d67[_0xe3a8('0xc1')](_0x5921c1[_0xe3a8('0x4d')][_0xe3a8('0x72')])[_0xe3a8('0x28')](function(){if(_[_0xe3a8('0xc2')](_0x5921c1[_0xe3a8('0x4d')][_0xe3a8('0x72')])){for(var _0x557b26=0x0;_0x557b26<_0x5921c1[_0xe3a8('0x4d')]['ids'][_0xe3a8('0x51')];_0x557b26+=0x1){socket[_0xe3a8('0xbf')](_0xe3a8('0xc3'),{'UserId':Number(_0x5921c1[_0xe3a8('0x4d')][_0xe3a8('0x72')][_0x557b26]),'MailAccountId':Number(_0x5921c1[_0xe3a8('0x61')]['id'])});}}else{socket['emit'](_0xe3a8('0xc3'),{'UserId':Number(_0x5921c1[_0xe3a8('0x4d')]['ids']),'MailAccountId':Number(_0x5921c1[_0xe3a8('0x61')]['id'])});}});}})[_0xe3a8('0x28')](respondWithStatusCode(_0x140541,null))[_0xe3a8('0x1c')](handleError(_0x140541,null));};exports[_0xe3a8('0xc4')]=function(_0x187810,_0x10f2b2){var _0x4d964d={};var _0x540823={};var _0x3d07e2;var _0x89095d;return db[_0xe3a8('0x48')][_0xe3a8('0x6f')]({'where':{'id':_0x187810['params']['id']}})['then'](handleEntityNotFound(_0x10f2b2,null))[_0xe3a8('0x28')](function(_0x1b1e10){if(_0x1b1e10){_0x3d07e2=_0x1b1e10;_0x540823['model']=_['keys'](db['User'][_0xe3a8('0x49')]);_0x540823['query']=_[_0xe3a8('0x4c')](_0x187810['query']);_0x540823[_0xe3a8('0x56')]=_[_0xe3a8('0x4e')](_0x540823['model'],_0x540823[_0xe3a8('0x4d')]);_0x4d964d[_0xe3a8('0x4f')]=_[_0xe3a8('0x4e')](_0x540823['model'],qs['fields'](_0x187810[_0xe3a8('0x4d')][_0xe3a8('0x50')]));_0x4d964d['attributes']=_0x4d964d['attributes'][_0xe3a8('0x51')]?_0x4d964d[_0xe3a8('0x4f')]:_0x540823[_0xe3a8('0x63')];_0x4d964d[_0xe3a8('0x53')]=qs[_0xe3a8('0x54')](_0x187810[_0xe3a8('0x4d')][_0xe3a8('0x54')]);_0x4d964d['where']=qs[_0xe3a8('0x56')](_['pick'](_0x187810[_0xe3a8('0x4d')],_0x540823[_0xe3a8('0x56')]));if(_0x187810['query'][_0xe3a8('0x58')]){_0x4d964d[_0xe3a8('0x55')]=_['merge'](_0x4d964d['where'],{'$or':_[_0xe3a8('0x5a')](_0x4d964d[_0xe3a8('0x4f')],function(_0x2b9268){var _0x134922={};_0x134922[_0x2b9268]={'$like':'%'+_0x187810[_0xe3a8('0x4d')][_0xe3a8('0x58')]+'%'};return _0x134922;})});}_0x4d964d=_['merge']({},_0x4d964d,_0x187810[_0xe3a8('0x5c')]);return _0x3d07e2[_0xe3a8('0xc4')](_0x4d964d);}})[_0xe3a8('0x28')](function(_0x3236de){if(_0x3236de){_0x89095d=_0x3236de[_0xe3a8('0x51')];if(!_0x187810[_0xe3a8('0x4d')]['hasOwnProperty'](_0xe3a8('0x70'))){_0x4d964d[_0xe3a8('0x23')]=qs[_0xe3a8('0x23')](_0x187810[_0xe3a8('0x4d')][_0xe3a8('0x23')]);_0x4d964d[_0xe3a8('0x21')]=qs['offset'](_0x187810[_0xe3a8('0x4d')][_0xe3a8('0x21')]);}return _0x3d07e2[_0xe3a8('0xc4')](_0x4d964d);}})[_0xe3a8('0x28')](function(_0x5473a6){if(_0x5473a6){return _0x5473a6?{'count':_0x89095d,'rows':_0x5473a6}:null;}})[_0xe3a8('0x28')](respondWithResult(_0x10f2b2,null))[_0xe3a8('0x1c')](handleError(_0x10f2b2,null));}; \ No newline at end of file +var _0x1431=['Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','split','format','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','root','server/files/attachments','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','defaults','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','VerifySmtp','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','destroy','then','get','UserProfileResource','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','MailServerIn','find','update','body','provider','custom','secure','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','autoAssociation','getImap','addImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Tag','Tags','tag','addApplications','transaction'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1431,0x1c6));var _0x1143=function(_0x54a207,_0x447f90){_0x54a207=_0x54a207-0x0;var _0x3b999f=_0x1431[_0x54a207];return _0x3b999f;};'use strict';var moment=require(_0x1143('0x0'));var BPromise=require(_0x1143('0x1'));var util=require(_0x1143('0x2'));var path=require(_0x1143('0x3'));var _=require(_0x1143('0x4'));var juice=require(_0x1143('0x5'));var Redis=require(_0x1143('0x6'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x1143('0x7'));var config=require(_0x1143('0x8'));var db=require(_0x1143('0x9'))['db'];config[_0x1143('0xa')]=_['defaults'](config[_0x1143('0xa')],{'host':_0x1143('0xb'),'port':0x18eb});var socket=require(_0x1143('0xc'))(new Redis(config['redis']));require(_0x1143('0xd'))[_0x1143('0xe')](socket);var jayson=require(_0x1143('0xf'));var client=jayson[_0x1143('0x10')][_0x1143('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x2539a6,_0xf5bbd8,_0x2372c5,_0x1efa31){return new BPromise(function(_0x2a1d37,_0x40d912){var _0x346df6=_0x1efa31||client;return _0x346df6['request'](_0x2539a6,_0x2372c5)['then'](function(_0x16ffda){logger['info'](_0x1143('0x12'),_0xf5bbd8,_0x1143('0x13'));logger[_0x1143('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0xf5bbd8,_0x1143('0x13'),JSON[_0x1143('0x15')](_0x16ffda));if(_0x16ffda[_0x1143('0x16')]){if(_0x16ffda[_0x1143('0x16')][_0x1143('0x17')]===0x1f4){logger[_0x1143('0x16')]('MailAccount,\x20%s,\x20%s',_0xf5bbd8,_0x16ffda[_0x1143('0x16')][_0x1143('0x18')]);return _0x40d912(_0x16ffda[_0x1143('0x16')][_0x1143('0x18')]);}logger[_0x1143('0x16')](_0x1143('0x12'),_0xf5bbd8,_0x16ffda['error'][_0x1143('0x18')]);return _0x2a1d37(_0x16ffda[_0x1143('0x16')][_0x1143('0x18')]);}else{logger['info'](_0x1143('0x12'),_0xf5bbd8,'request\x20sent');_0x2a1d37(_0x16ffda[_0x1143('0x19')][_0x1143('0x18')]);}})[_0x1143('0x1a')](function(_0x25f0ee){logger[_0x1143('0x16')](_0x1143('0x12'),_0xf5bbd8,_0x25f0ee);_0x40d912(_0x25f0ee);});});}function respondWithStatusCode(_0x3d5df1,_0x3befa6){_0x3befa6=_0x3befa6||0xcc;return function(_0x4dd8ab){if(_0x4dd8ab){return _0x3d5df1[_0x1143('0x1b')](_0x3befa6);}return _0x3d5df1[_0x1143('0x1c')](_0x3befa6)[_0x1143('0x1d')]();};}function respondWithResult(_0x23f64d,_0x2d7356){_0x2d7356=_0x2d7356||0xc8;return function(_0x316819){if(_0x316819){return _0x23f64d['status'](_0x2d7356)['json'](_0x316819);}};}function respondWithFilteredResult(_0x1c145f,_0x1af2fa){return function(_0x425653){if(_0x425653){var _0x524a45=typeof _0x1af2fa['offset']===_0x1143('0x1e')&&typeof _0x1af2fa[_0x1143('0x1f')]===_0x1143('0x1e');var _0x29bbd2=_0x425653['count'];var _0x5b1ec9=_0x524a45?0x0:_0x1af2fa['offset'];var _0x527e8d=_0x524a45?_0x425653[_0x1143('0x20')]:_0x1af2fa[_0x1143('0x21')]+_0x1af2fa[_0x1143('0x1f')];var _0x2fb15b;if(_0x527e8d>=_0x29bbd2){_0x527e8d=_0x29bbd2;_0x2fb15b=0xc8;}else{_0x2fb15b=0xce;}_0x1c145f['status'](_0x2fb15b);return _0x1c145f[_0x1143('0x22')](_0x1143('0x23'),_0x5b1ec9+'-'+_0x527e8d+'/'+_0x29bbd2)[_0x1143('0x24')](_0x425653);}return null;};}function saveUpdates(_0x61139e){return function(_0x5f334c){if(_0x5f334c){return _0x5f334c['update'](_0x61139e)['then'](function(_0x2d6e1f){return _0x2d6e1f;});}return null;};}function removeEntity(_0x27c98b){return function(_0x565e01){if(_0x565e01){return _0x565e01[_0x1143('0x25')]()[_0x1143('0x26')](function(){var _0x2fa8c8=_0x565e01[_0x1143('0x27')]({'plain':!![]});var _0x438191='MailAccounts';return db[_0x1143('0x28')][_0x1143('0x25')]({'where':{'type':_0x438191,'resourceId':_0x2fa8c8['id']}})['then'](function(){return _0x565e01;});})[_0x1143('0x26')](function(){_0x27c98b[_0x1143('0x1c')](0xcc)[_0x1143('0x1d')]();});}};}function handleEntityNotFound(_0x5cec4d){return function(_0x13ff01){if(!_0x13ff01){_0x5cec4d['sendStatus'](0x194);}return _0x13ff01;};}function handleError(_0x25f4f5,_0xfe6b91){_0xfe6b91=_0xfe6b91||0x1f4;return function(_0x4c6512){logger[_0x1143('0x16')](_0x4c6512['stack']);if(_0x4c6512['name']){delete _0x4c6512[_0x1143('0x29')];}_0x25f4f5['status'](_0xfe6b91)[_0x1143('0x2a')](_0x4c6512);};}function getImapHost(_0x8ef87){switch(_0x8ef87){case _0x1143('0x2b'):return _0x1143('0x2c');case _0x1143('0x2d'):return _0x1143('0x2e');case _0x1143('0x2f'):return _0x1143('0x30');case _0x1143('0x31'):return _0x1143('0x32');}throw new Error(_0x1143('0x33'),_0x8ef87);}function getSmtpHost(_0x523ac4){switch(_0x523ac4){case _0x1143('0x2b'):return _0x1143('0x34');case'yahoo':return _0x1143('0x35');case _0x1143('0x2f'):return _0x1143('0x36');case _0x1143('0x31'):return _0x1143('0x37');}throw new Error(_0x1143('0x33'),_0x523ac4);}function getAuthenticationOptions(_0x5b06bc,_0x3d5fff){var _0xd34497={};var _0x5f3f9e={};if(_0x5b06bc){_0xd34497[_0x1143('0x38')]=_0x5f3f9e[_0x1143('0x38')]=_0x3d5fff[_0x1143('0x39')];_0xd34497[_0x1143('0x3a')]=_0x5f3f9e[_0x1143('0x3b')]=_0x3d5fff['password'];if(_0x3d5fff[_0x1143('0x3c')]){_0xd34497[_0x1143('0x3c')]=_0x5f3f9e[_0x1143('0x3c')]=!![];_0xd34497[_0x1143('0x3d')]=_0x5f3f9e[_0x1143('0x3d')]=_0x3d5fff[_0x1143('0x3d')];_0xd34497[_0x1143('0x3a')]=_0x5f3f9e[_0x1143('0x3b')]=null;}else{_0xd34497[_0x1143('0x3d')]=_0x5f3f9e['CloudProviderId']=null;}_0xd34497[_0x1143('0x3e')]=getImapHost(_0x5b06bc);_0xd34497[_0x1143('0x3f')]=0x3e1;_0x5f3f9e['host']=getSmtpHost(_0x5b06bc);_0x5f3f9e[_0x1143('0x3f')]=0x24b;_0x5f3f9e['secure']=![];_0xd34497[_0x1143('0x40')]=_0x5f3f9e['service']=null;}else{if(_0x3d5fff[_0x1143('0x41')]){_0xd34497[_0x1143('0x38')]=_0x5f3f9e[_0x1143('0x38')]=_0x3d5fff['username'];_0xd34497['password']=_0x5f3f9e[_0x1143('0x3b')]=_0x3d5fff[_0x1143('0x3a')];}else{_0xd34497[_0x1143('0x41')]=_0x5f3f9e['authentication']=![];_0xd34497[_0x1143('0x38')]=_0x5f3f9e[_0x1143('0x38')]=null;_0xd34497[_0x1143('0x3a')]=_0x5f3f9e[_0x1143('0x3b')]=null;}_0xd34497[_0x1143('0x3e')]=_0x3d5fff['Imap'][_0x1143('0x3e')];_0xd34497[_0x1143('0x3f')]=_0x3d5fff[_0x1143('0x42')]['port'];_0x5f3f9e['host']=_0x3d5fff[_0x1143('0x43')][_0x1143('0x3e')];_0x5f3f9e[_0x1143('0x3f')]=_0x3d5fff[_0x1143('0x43')][_0x1143('0x3f')];}return{'Imap':_0xd34497,'Smtp':_0x5f3f9e};}exports[_0x1143('0x44')]=function(_0x20185c,_0x11a9ce){var _0x9e3146={'include':[{'model':db['MailServerIn'],'as':_0x1143('0x42')},{'model':db[_0x1143('0x45')],'as':'Smtp'},{'model':db[_0x1143('0x46')],'as':_0x1143('0x47')}]},_0x57b5c0={},_0x382ce1={'count':0x0,'rows':[]};var _0x74930a=_['map'](db[_0x1143('0x48')][_0x1143('0x49')],function(_0x427b8c){return{'name':_0x427b8c[_0x1143('0x4a')],'type':_0x427b8c[_0x1143('0x4b')][_0x1143('0x4c')]};});_0x57b5c0[_0x1143('0x4d')]=_[_0x1143('0x4e')](_0x74930a,_0x1143('0x29'));_0x57b5c0['query']=_[_0x1143('0x4f')](_0x20185c[_0x1143('0x50')]);_0x57b5c0[_0x1143('0x51')]=_['intersection'](_0x57b5c0['model'],_0x57b5c0[_0x1143('0x50')]);_0x9e3146['attributes']=_[_0x1143('0x52')](_0x57b5c0['model'],qs[_0x1143('0x53')](_0x20185c[_0x1143('0x50')][_0x1143('0x53')]));_0x9e3146[_0x1143('0x54')]=_0x9e3146[_0x1143('0x54')][_0x1143('0x55')]?_0x9e3146[_0x1143('0x54')]:_0x57b5c0[_0x1143('0x4d')];if(!_0x20185c['query'][_0x1143('0x56')](_0x1143('0x57'))){_0x9e3146[_0x1143('0x1f')]=qs[_0x1143('0x1f')](_0x20185c['query'][_0x1143('0x1f')]);_0x9e3146[_0x1143('0x21')]=qs[_0x1143('0x21')](_0x20185c[_0x1143('0x50')][_0x1143('0x21')]);}_0x9e3146[_0x1143('0x58')]=qs[_0x1143('0x59')](_0x20185c[_0x1143('0x50')][_0x1143('0x59')]);_0x9e3146[_0x1143('0x5a')]=qs[_0x1143('0x51')](_[_0x1143('0x5b')](_0x20185c[_0x1143('0x50')],_0x57b5c0[_0x1143('0x51')]),_0x74930a);if(_0x20185c[_0x1143('0x50')][_0x1143('0x5c')]){_0x9e3146[_0x1143('0x5a')]=_[_0x1143('0x5d')](_0x9e3146[_0x1143('0x5a')],{'$or':_[_0x1143('0x4e')](_0x74930a,function(_0x1ebd0d){if(_0x1ebd0d[_0x1143('0x4b')]!==_0x1143('0x5e')){var _0x443a09={};_0x443a09[_0x1ebd0d['name']]={'$like':'%'+_0x20185c[_0x1143('0x50')]['filter']+'%'};return _0x443a09;}})});}_0x9e3146=_[_0x1143('0x5d')]({},_0x9e3146,_0x20185c[_0x1143('0x5f')]);var _0x115028={'where':_0x9e3146['where']};return db[_0x1143('0x48')]['count'](_0x115028)[_0x1143('0x26')](function(_0xc5a39d){_0x382ce1[_0x1143('0x20')]=_0xc5a39d;if(_0x20185c[_0x1143('0x50')][_0x1143('0x60')]){_0x9e3146[_0x1143('0x61')]=[{'all':!![]}];}return db[_0x1143('0x48')][_0x1143('0x62')](_0x9e3146);})[_0x1143('0x26')](function(_0x2a4fc5){_0x382ce1[_0x1143('0x63')]=_0x2a4fc5;return _0x382ce1;})['then'](respondWithFilteredResult(_0x11a9ce,_0x9e3146))[_0x1143('0x1a')](handleError(_0x11a9ce,null));};exports[_0x1143('0x64')]=function(_0x215b52,_0x49cd29){var _0x1b01c3={'raw':![],'where':{'id':_0x215b52[_0x1143('0x65')]['id']},'include':[{'model':db[_0x1143('0x66')],'as':_0x1143('0x42')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x1143('0x46')],'as':'mandatoryDispositionPause'}]},_0x385b8a={};_0x385b8a[_0x1143('0x4d')]=_[_0x1143('0x4f')](db['MailAccount'][_0x1143('0x49')]);_0x385b8a[_0x1143('0x50')]=_['keys'](_0x215b52['query']);_0x385b8a['filters']=_[_0x1143('0x52')](_0x385b8a[_0x1143('0x4d')],_0x385b8a[_0x1143('0x50')]);_0x1b01c3[_0x1143('0x54')]=_[_0x1143('0x52')](_0x385b8a[_0x1143('0x4d')],qs[_0x1143('0x53')](_0x215b52['query'][_0x1143('0x53')]));_0x1b01c3['attributes']=_0x1b01c3['attributes']['length']?_0x1b01c3[_0x1143('0x54')]:_0x385b8a['model'];if(_0x215b52[_0x1143('0x50')][_0x1143('0x60')]){_0x1b01c3[_0x1143('0x61')]=[{'all':!![]}];}_0x1b01c3=_[_0x1143('0x5d')]({},_0x1b01c3,_0x215b52['options']);return db[_0x1143('0x48')][_0x1143('0x67')](_0x1b01c3)[_0x1143('0x26')](handleEntityNotFound(_0x49cd29,null))[_0x1143('0x26')](respondWithResult(_0x49cd29,null))['catch'](handleError(_0x49cd29,null));};exports[_0x1143('0x68')]=function(_0x30b68e,_0x1ab187){if(_0x30b68e[_0x1143('0x69')]['id']){delete _0x30b68e['body']['id'];}var _0x34d08a=_0x30b68e[_0x1143('0x69')][_0x1143('0x6a')]===_0x1143('0x6b')?null:_0x30b68e['body'][_0x1143('0x6a')];var _0x12a34f=_0x30b68e[_0x1143('0x69')][_0x1143('0x42')]||{};var _0x38ac32=_0x30b68e[_0x1143('0x69')][_0x1143('0x43')]||{};if(_0x34d08a){_0x12a34f['host']=getImapHost(_0x34d08a);_0x12a34f['port']=0x3e1;_0x38ac32['host']=getSmtpHost(_0x34d08a);_0x38ac32[_0x1143('0x3f')]=0x24b;_0x38ac32[_0x1143('0x6c')]=![];}if(_0x38ac32[_0x1143('0x3c')]){_0x38ac32[_0x1143('0x6c')]=![];}else{_0x38ac32[_0x1143('0x3d')]=null;}if(!_0x12a34f[_0x1143('0x3c')])_0x12a34f[_0x1143('0x3d')]=null;_0x30b68e[_0x1143('0x69')][_0x1143('0x42')]=_0x12a34f;_0x30b68e[_0x1143('0x69')][_0x1143('0x43')]=_0x38ac32;return db[_0x1143('0x48')]['find']({'where':{'id':_0x30b68e[_0x1143('0x65')]['id']},'include':[{'model':db[_0x1143('0x66')],'as':_0x1143('0x42')},{'model':db[_0x1143('0x45')],'as':_0x1143('0x43')},{'model':db[_0x1143('0x46')],'as':_0x1143('0x47')}]})['then'](handleEntityNotFound(_0x1ab187,null))[_0x1143('0x26')](function(_0x3fcc28){if(!_0x3fcc28)throw new Error('Mail\x20Account\x20not\x20found');if(_0x3fcc28['service'])delete _0x30b68e[_0x1143('0x69')][_0x1143('0x42')];return _0x3fcc28;})[_0x1143('0x26')](saveUpdates(_0x30b68e[_0x1143('0x69')],null))[_0x1143('0x26')](function(_0x43d7ea){if(!_0x30b68e['body'][_0x1143('0x42')])return _0x43d7ea;return db['MailServerIn'][_0x1143('0x68')](_0x30b68e[_0x1143('0x69')][_0x1143('0x42')],{'where':{'MailAccountId':_0x43d7ea['id']}})[_0x1143('0x26')](function(){return _0x43d7ea;});})[_0x1143('0x26')](function(_0x4ac064){if(!_0x30b68e[_0x1143('0x69')][_0x1143('0x43')])return _0x4ac064;return db[_0x1143('0x45')]['update'](_0x30b68e[_0x1143('0x69')][_0x1143('0x43')],{'where':{'MailAccountId':_0x4ac064['id']}})['then'](function(){return _0x4ac064;});})['then'](respondWithResult(_0x1ab187,null))[_0x1143('0x1a')](handleError(_0x1ab187,null));};exports[_0x1143('0x6d')]=function(_0x24618e,_0x3f0b1f){return db[_0x1143('0x48')][_0x1143('0x6d')]()[_0x1143('0x26')](respondWithResult(_0x3f0b1f,null))[_0x1143('0x1a')](handleError(_0x3f0b1f,null));};exports[_0x1143('0x6e')]=function(_0x55f431,_0x19c41c){if(_0x55f431[_0x1143('0x69')]['id']){delete _0x55f431[_0x1143('0x69')]['id'];}return db['MailAccount'][_0x1143('0x67')]({'where':{'id':_0x55f431['params']['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x19c41c,null))[_0x1143('0x26')](function(_0x3b6caf){if(_0x3b6caf){_0x55f431['body'][_0x1143('0x6f')]=_0x3b6caf['id'];return db[_0x1143('0x70')][_0x1143('0x71')](_0x55f431[_0x1143('0x69')]);}})['then'](respondWithResult(_0x19c41c,null))[_0x1143('0x1a')](handleError(_0x19c41c,null));};exports[_0x1143('0x72')]=function(_0x1b0e31,_0x2bc689){var _0x2a0a0b={'raw':![],'where':{}};var _0x135a1e={};var _0xc4da91={'count':0x0,'rows':[]};return db[_0x1143('0x48')][_0x1143('0x73')]({'where':{'id':_0x1b0e31['params']['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x2bc689,null))[_0x1143('0x26')](function(_0x2480a9){if(_0x2480a9){_0x135a1e['model']=_[_0x1143('0x4f')](db[_0x1143('0x70')]['rawAttributes']);_0x135a1e[_0x1143('0x50')]=_[_0x1143('0x4f')](_0x1b0e31[_0x1143('0x50')]);_0x135a1e[_0x1143('0x51')]=_[_0x1143('0x52')](_0x135a1e[_0x1143('0x4d')],_0x135a1e[_0x1143('0x50')]);_0x2a0a0b[_0x1143('0x54')]=_[_0x1143('0x52')](_0x135a1e[_0x1143('0x4d')],qs[_0x1143('0x53')](_0x1b0e31[_0x1143('0x50')]['fields']));_0x2a0a0b[_0x1143('0x54')]=_0x2a0a0b[_0x1143('0x54')]['length']?_0x2a0a0b[_0x1143('0x54')]:_0x135a1e['model'];if(!_0x1b0e31[_0x1143('0x50')][_0x1143('0x56')](_0x1143('0x57'))){_0x2a0a0b['limit']=qs['limit'](_0x1b0e31['query'][_0x1143('0x1f')]);_0x2a0a0b[_0x1143('0x21')]=qs['offset'](_0x1b0e31[_0x1143('0x50')]['offset']);}_0x2a0a0b[_0x1143('0x58')]=qs['sort'](_0x1b0e31['query']['sort']);_0x2a0a0b[_0x1143('0x5a')]=qs['filters'](_[_0x1143('0x5b')](_0x1b0e31[_0x1143('0x50')],_0x135a1e['filters']));_0x2a0a0b[_0x1143('0x5a')][_0x1143('0x6f')]=_0x2480a9['id'];if(_0x1b0e31[_0x1143('0x50')][_0x1143('0x5c')]){_0x2a0a0b[_0x1143('0x5a')]=_[_0x1143('0x5d')](_0x2a0a0b[_0x1143('0x5a')],{'$or':_[_0x1143('0x4e')](_0x2a0a0b[_0x1143('0x54')],function(_0x5adf84){var _0x1a143e={};_0x1a143e[_0x5adf84]={'$like':'%'+_0x1b0e31[_0x1143('0x50')][_0x1143('0x5c')]+'%'};return _0x1a143e;})});}_0x2a0a0b=_['merge']({},_0x2a0a0b,_0x1b0e31[_0x1143('0x5f')]);return db[_0x1143('0x70')][_0x1143('0x20')]({'where':_0x2a0a0b[_0x1143('0x5a')]})['then'](function(_0x25c8f6){_0xc4da91['count']=_0x25c8f6;if(_0x1b0e31[_0x1143('0x50')][_0x1143('0x60')]){_0x2a0a0b[_0x1143('0x61')]=[{'all':!![]}];}return db[_0x1143('0x70')]['findAll'](_0x2a0a0b);})['then'](function(_0x3f5c9a){_0xc4da91[_0x1143('0x63')]=_0x3f5c9a;return _0xc4da91;});}})[_0x1143('0x26')](respondWithFilteredResult(_0x2bc689,_0x2a0a0b))[_0x1143('0x1a')](handleError(_0x2bc689,null));};exports[_0x1143('0x74')]=function(_0x5ecf97,_0x3b4c2e){return db[_0x1143('0x48')][_0x1143('0x67')]({'where':{'id':_0x5ecf97[_0x1143('0x65')]['id']}})['then'](handleEntityNotFound(_0x3b4c2e,null))[_0x1143('0x26')](function(_0x4defe0){if(_0x4defe0){return _0x4defe0[_0x1143('0x74')](_0x5ecf97[_0x1143('0x50')]['ids']);}})[_0x1143('0x26')](respondWithStatusCode(_0x3b4c2e,null))[_0x1143('0x1a')](handleError(_0x3b4c2e,null));};exports['addAnswer']=function(_0x2b9df,_0x486f5a){if(_0x2b9df['body']['id']){delete _0x2b9df[_0x1143('0x69')]['id'];}return db[_0x1143('0x48')]['find']({'where':{'id':_0x2b9df[_0x1143('0x65')]['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x486f5a,null))['then'](function(_0x517d6f){if(_0x517d6f){_0x2b9df[_0x1143('0x69')][_0x1143('0x6f')]=_0x517d6f['id'];return db[_0x1143('0x75')]['create'](_0x2b9df[_0x1143('0x69')]);}})[_0x1143('0x26')](respondWithResult(_0x486f5a,null))[_0x1143('0x1a')](handleError(_0x486f5a,null));};exports[_0x1143('0x76')]=function(_0x57d745,_0xd3096e){var _0x5af555={'raw':![],'where':{}};var _0x39cf71={};var _0x49e77b={'count':0x0,'rows':[]};return db[_0x1143('0x48')]['findOne']({'where':{'id':_0x57d745[_0x1143('0x65')]['id']}})[_0x1143('0x26')](handleEntityNotFound(_0xd3096e,null))[_0x1143('0x26')](function(_0x41c002){if(_0x41c002){_0x39cf71['model']=_['keys'](db[_0x1143('0x75')][_0x1143('0x49')]);_0x39cf71['query']=_[_0x1143('0x4f')](_0x57d745[_0x1143('0x50')]);_0x39cf71[_0x1143('0x51')]=_[_0x1143('0x52')](_0x39cf71[_0x1143('0x4d')],_0x39cf71[_0x1143('0x50')]);_0x5af555['attributes']=_[_0x1143('0x52')](_0x39cf71['model'],qs['fields'](_0x57d745[_0x1143('0x50')][_0x1143('0x53')]));_0x5af555[_0x1143('0x54')]=_0x5af555[_0x1143('0x54')][_0x1143('0x55')]?_0x5af555[_0x1143('0x54')]:_0x39cf71[_0x1143('0x4d')];if(!_0x57d745[_0x1143('0x50')]['hasOwnProperty'](_0x1143('0x57'))){_0x5af555['limit']=qs[_0x1143('0x1f')](_0x57d745[_0x1143('0x50')][_0x1143('0x1f')]);_0x5af555['offset']=qs[_0x1143('0x21')](_0x57d745[_0x1143('0x50')][_0x1143('0x21')]);}_0x5af555['order']=qs[_0x1143('0x59')](_0x57d745['query'][_0x1143('0x59')]);_0x5af555[_0x1143('0x5a')]=qs[_0x1143('0x51')](_[_0x1143('0x5b')](_0x57d745[_0x1143('0x50')],_0x39cf71[_0x1143('0x51')]));_0x5af555['where'][_0x1143('0x6f')]=_0x41c002['id'];if(_0x57d745[_0x1143('0x50')][_0x1143('0x5c')]){_0x5af555[_0x1143('0x5a')]=_[_0x1143('0x5d')](_0x5af555[_0x1143('0x5a')],{'$or':_[_0x1143('0x4e')](_0x5af555[_0x1143('0x54')],function(_0xdb3607){var _0x58b495={};_0x58b495[_0xdb3607]={'$like':'%'+_0x57d745[_0x1143('0x50')][_0x1143('0x5c')]+'%'};return _0x58b495;})});}_0x5af555=_[_0x1143('0x5d')]({},_0x5af555,_0x57d745[_0x1143('0x5f')]);return db[_0x1143('0x75')][_0x1143('0x20')]({'where':_0x5af555[_0x1143('0x5a')]})[_0x1143('0x26')](function(_0x586ee3){_0x49e77b[_0x1143('0x20')]=_0x586ee3;if(_0x57d745[_0x1143('0x50')]['includeAll']){_0x5af555[_0x1143('0x61')]=[{'all':!![]}];}return db[_0x1143('0x75')][_0x1143('0x62')](_0x5af555);})[_0x1143('0x26')](function(_0x4cbf32){_0x49e77b[_0x1143('0x63')]=_0x4cbf32;return _0x49e77b;});}})[_0x1143('0x26')](respondWithFilteredResult(_0xd3096e,_0x5af555))['catch'](handleError(_0xd3096e,null));};exports[_0x1143('0x77')]=function(_0x278384,_0x56faa3){return db[_0x1143('0x48')][_0x1143('0x67')]({'where':{'id':_0x278384[_0x1143('0x65')]['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x56faa3,null))[_0x1143('0x26')](function(_0x4e5725){if(_0x4e5725){return _0x4e5725[_0x1143('0x77')](_0x278384['query'][_0x1143('0x78')]);}})[_0x1143('0x26')](respondWithStatusCode(_0x56faa3,null))[_0x1143('0x1a')](handleError(_0x56faa3,null));};exports[_0x1143('0x71')]=function(_0x321a70,_0x4d9174){var _0x3e7fdf={'name':_0x321a70['body'][_0x1143('0x29')],'key':_0x321a70[_0x1143('0x69')]['key'],'provider':_0x321a70['body'][_0x1143('0x6a')]===_0x1143('0x6b')?null:_0x321a70['body'][_0x1143('0x6a')],'email':_0x321a70[_0x1143('0x69')][_0x1143('0x79')],'ListId':_0x321a70[_0x1143('0x69')][_0x1143('0x7a')],'active':!_[_0x1143('0x7b')](_0x321a70[_0x1143('0x69')][_0x1143('0x7c')])?_0x321a70[_0x1143('0x69')][_0x1143('0x7c')]:!![],'description':_0x321a70[_0x1143('0x69')][_0x1143('0x7d')]||null};var _0x477bdf=getAuthenticationOptions(_0x3e7fdf[_0x1143('0x6a')],_0x321a70['body']);_0x3e7fdf['Imap']=_0x477bdf[_0x1143('0x42')];_0x3e7fdf['Smtp']=_0x477bdf[_0x1143('0x43')];return db[_0x1143('0x48')][_0x1143('0x71')](_0x3e7fdf,{'include':[{'model':db[_0x1143('0x45')],'as':'Smtp'},{'model':db[_0x1143('0x66')],'as':_0x1143('0x42')}]})['then'](function(_0x58a81f){var _0x4a352b=_0x321a70[_0x1143('0x38')][_0x1143('0x27')]({'plain':!![]});if(!_0x4a352b)throw new Error(_0x1143('0x7e'));if(_0x4a352b[_0x1143('0x7f')]===_0x1143('0x38')){var _0x581725=_0x58a81f[_0x1143('0x27')]({'plain':!![]});return db[_0x1143('0x80')]['find']({'where':{'name':_0x1143('0x81'),'userProfileId':_0x4a352b['userProfileId']},'raw':!![]})[_0x1143('0x26')](function(_0x20ce12){if(_0x20ce12&&_0x20ce12[_0x1143('0x82')]===0x0){return db[_0x1143('0x28')][_0x1143('0x71')]({'name':_0x581725[_0x1143('0x29')],'resourceId':_0x581725['id'],'type':_0x20ce12[_0x1143('0x29')],'sectionId':_0x20ce12['id']},{})[_0x1143('0x26')](function(){return _0x58a81f;});}else{return _0x58a81f;}})['catch'](function(_0x53a8f9){logger[_0x1143('0x16')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53a8f9);throw _0x53a8f9;});}return _0x58a81f;})[_0x1143('0x26')](respondWithResult(_0x4d9174,0xc9))['catch'](handleError(_0x4d9174,null));};exports[_0x1143('0x83')]=function(_0x46533f,_0x2ce9d1){return db[_0x1143('0x48')]['findOne']({'where':{'id':_0x46533f[_0x1143('0x65')]['id']}})['then'](handleEntityNotFound(_0x2ce9d1,null))[_0x1143('0x26')](function(_0x74c172){if(_0x74c172){return _0x74c172['getImap']();}return null;})[_0x1143('0x26')](respondWithResult(_0x2ce9d1,null))[_0x1143('0x1a')](handleError(_0x2ce9d1,null));};exports[_0x1143('0x84')]=function(_0x1d8451,_0x2a98ed){if(_0x1d8451['body']['id']){delete _0x1d8451['body']['id'];}return db[_0x1143('0x48')][_0x1143('0x67')]({'where':{'id':_0x1d8451[_0x1143('0x65')]['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x2a98ed,null))[_0x1143('0x26')](function(_0x20ec5b){if(_0x20ec5b){_0x1d8451[_0x1143('0x69')][_0x1143('0x6f')]=_0x20ec5b['id'];return db[_0x1143('0x66')]['create'](_0x1d8451[_0x1143('0x69')]);}})['then'](respondWithResult(_0x2a98ed,null))[_0x1143('0x1a')](handleError(_0x2a98ed,null));};exports['removeImap']=function(_0x5c6299,_0x26d1ba){return db['MailAccount'][_0x1143('0x73')]({'where':{'id':_0x5c6299['params']['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x26d1ba,null))[_0x1143('0x26')](function(_0xa2686f){if(_0xa2686f){return _0xa2686f['setImap'](null);}return null;})[_0x1143('0x26')](respondWithStatusCode(_0x26d1ba,null))[_0x1143('0x1a')](handleError(_0x26d1ba,null));};exports[_0x1143('0x85')]=function(_0x17e745,_0x3c445a){return db[_0x1143('0x48')][_0x1143('0x73')]({'where':{'id':_0x17e745['params']['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x3c445a,null))[_0x1143('0x26')](function(_0x5a7271){if(_0x5a7271){return _0x5a7271[_0x1143('0x85')]();}return null;})[_0x1143('0x26')](respondWithResult(_0x3c445a,null))[_0x1143('0x1a')](handleError(_0x3c445a,null));};exports[_0x1143('0x86')]=function(_0x1d9316,_0x9dac87){if(_0x1d9316[_0x1143('0x69')]['id']){delete _0x1d9316[_0x1143('0x69')]['id'];}return db[_0x1143('0x48')][_0x1143('0x67')]({'where':{'id':_0x1d9316[_0x1143('0x65')]['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x9dac87,null))[_0x1143('0x26')](function(_0x148baa){if(_0x148baa){_0x1d9316[_0x1143('0x69')]['MailAccountId']=_0x148baa['id'];return db['MailServerOut'][_0x1143('0x71')](_0x1d9316[_0x1143('0x69')]);}})[_0x1143('0x26')](respondWithResult(_0x9dac87,null))[_0x1143('0x1a')](handleError(_0x9dac87,null));};exports[_0x1143('0x87')]=function(_0x289d59,_0x49244e){return db[_0x1143('0x48')]['findOne']({'where':{'id':_0x289d59[_0x1143('0x65')]['id']}})['then'](handleEntityNotFound(_0x49244e,null))[_0x1143('0x26')](function(_0x4fe1dd){if(_0x4fe1dd){return _0x4fe1dd[_0x1143('0x88')](null);}return null;})['then'](respondWithStatusCode(_0x49244e,null))[_0x1143('0x1a')](handleError(_0x49244e,null));};exports[_0x1143('0x89')]=function(_0x171fbc,_0x52d883){return db[_0x1143('0x8a')][_0x1143('0x67')]({'where':{'id':_0x171fbc[_0x1143('0x65')]['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x52d883,null))[_0x1143('0x26')](function(_0x4ebbd6){if(_0x4ebbd6){return _0x4ebbd6[_0x1143('0x89')](_0x171fbc[_0x1143('0x69')]['ids'],_[_0x1143('0x8b')](_0x171fbc[_0x1143('0x69')],[_0x1143('0x78'),'id'])||{});}})['then'](respondWithResult(_0x52d883,null))['catch'](handleError(_0x52d883,null));};exports[_0x1143('0x8c')]=function(_0xae5e2f,_0x388993){var _0x4f7b98={'raw':![],'where':{}};var _0x587170={};var _0x3dabe9={'count':0x0,'rows':[]};return db[_0x1143('0x48')][_0x1143('0x73')]({'where':{'id':_0xae5e2f[_0x1143('0x65')]['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x388993,null))[_0x1143('0x26')](function(_0x29b137){if(_0x29b137){_0x587170[_0x1143('0x4d')]=_['keys'](db[_0x1143('0x8a')][_0x1143('0x49')]);_0x587170[_0x1143('0x50')]=_['keys'](_0xae5e2f[_0x1143('0x50')]);_0x587170[_0x1143('0x51')]=_[_0x1143('0x52')](_0x587170[_0x1143('0x4d')],_0x587170[_0x1143('0x50')]);_0x4f7b98[_0x1143('0x54')]=_[_0x1143('0x52')](_0x587170[_0x1143('0x4d')],qs[_0x1143('0x53')](_0xae5e2f['query']['fields']));_0x4f7b98[_0x1143('0x54')]=_0x4f7b98[_0x1143('0x54')][_0x1143('0x55')]?_0x4f7b98[_0x1143('0x54')]:_0x587170['model'];if(!_0xae5e2f[_0x1143('0x50')]['hasOwnProperty'](_0x1143('0x57'))){_0x4f7b98[_0x1143('0x1f')]=qs[_0x1143('0x1f')](_0xae5e2f[_0x1143('0x50')][_0x1143('0x1f')]);_0x4f7b98['offset']=qs[_0x1143('0x21')](_0xae5e2f[_0x1143('0x50')][_0x1143('0x21')]);}_0x4f7b98[_0x1143('0x58')]=qs['sort'](_0xae5e2f[_0x1143('0x50')][_0x1143('0x59')]);_0x4f7b98[_0x1143('0x5a')]=qs['filters'](_[_0x1143('0x5b')](_0xae5e2f[_0x1143('0x50')],_0x587170['filters']));_0x4f7b98[_0x1143('0x5a')][_0x1143('0x6f')]=_0x29b137['id'];if(_0xae5e2f[_0x1143('0x50')][_0x1143('0x5c')]){_0x4f7b98[_0x1143('0x5a')]=_[_0x1143('0x5d')](_0x4f7b98[_0x1143('0x5a')],{'$or':_[_0x1143('0x4e')](_0x4f7b98['attributes'],function(_0x52556a){var _0x29d329={};_0x29d329[_0x52556a]={'$like':'%'+_0xae5e2f[_0x1143('0x50')][_0x1143('0x5c')]+'%'};return _0x29d329;})});}_0x4f7b98=_['merge']({},_0x4f7b98,_0xae5e2f['options']);return db[_0x1143('0x8a')][_0x1143('0x20')]({'where':_0x4f7b98[_0x1143('0x5a')]})[_0x1143('0x26')](function(_0x1c3375){_0x3dabe9['count']=_0x1c3375;if(_0xae5e2f[_0x1143('0x50')]['includeAll']){_0x4f7b98[_0x1143('0x61')]=[{'model':db[_0x1143('0x8d')],'as':_0x1143('0x8e'),'required':![]},{'model':db[_0x1143('0x8f')],'as':'Owner','attributes':[_0x1143('0x29'),'fullname','internal'],'required':![]},{'model':db[_0x1143('0x90')],'as':_0x1143('0x91'),'attributes':['id',_0x1143('0x29'),'color'],'where':_0xae5e2f[_0x1143('0x50')][_0x1143('0x92')]?{'id':_0xae5e2f[_0x1143('0x50')][_0x1143('0x92')]}:undefined,'required':_0xae5e2f[_0x1143('0x50')][_0x1143('0x92')]?!![]:![]}];}return db[_0x1143('0x8a')][_0x1143('0x62')](_0x4f7b98);})[_0x1143('0x26')](function(_0x11f3bb){_0x3dabe9[_0x1143('0x63')]=_0x11f3bb;return _0x3dabe9;});}})[_0x1143('0x26')](respondWithFilteredResult(_0x388993,_0x4f7b98))['catch'](handleError(_0x388993,null));};exports[_0x1143('0x93')]=function addApplications(_0x495182,_0x5c378d){var _0x7e2f6e=_0x495182[_0x1143('0x65')]['id'];var _0x578d73=_0x495182['body'];var _0x100611=0xc8;var _0x5ec2b2=null;return db['sequelize'][_0x1143('0x94')]({'isolationLevel':db['sequelize'][_0x1143('0x95')][_0x1143('0x96')][_0x1143('0x97')]},function(_0x573652){return db[_0x1143('0x48')]['findOne']({'where':{'id':_0x7e2f6e},'transaction':_0x573652})[_0x1143('0x26')](function(_0x59da8e){if(_0x59da8e){return db[_0x1143('0x98')][_0x1143('0x25')]({'where':{'MailAccountId':_0x7e2f6e},'transaction':_0x573652})['then'](function(){var _0x1851d1=_[_0x1143('0x4e')](_0x578d73,function(_0x456e3e){_0x456e3e[_0x1143('0x6f')]=_0x7e2f6e;return _0x456e3e;});return db[_0x1143('0x98')][_0x1143('0x99')](_0x1851d1,{'transaction':_0x573652});});}else{_0x100611=0x194;_0x5ec2b2=[];}});})[_0x1143('0x26')](function(){if(_0x100611!==0x194){return db[_0x1143('0x98')][_0x1143('0x9a')]({'where':{'MailAccountId':_0x7e2f6e},'order':_0x1143('0x9b')})[_0x1143('0x26')](function(_0x4fef8f){_0x5ec2b2=_0x4fef8f;});}})[_0x1143('0x1a')](function(_0x2181c3){_0x100611=0x1f4;logger[_0x1143('0x16')](_0x2181c3[_0x1143('0x9c')]);if(_0x2181c3[_0x1143('0x29')]){delete _0x2181c3[_0x1143('0x29')];}_0x5ec2b2=_0x2181c3;})[_0x1143('0x9d')](function(){if(_0x5ec2b2===null){_0x5c378d[_0x1143('0x1b')](_0x100611);}else{if(_0x100611===0x1f4){_0x5c378d[_0x1143('0x1c')](_0x100611)[_0x1143('0x2a')](_0x5ec2b2);}else{_0x5c378d[_0x1143('0x1c')](_0x100611)[_0x1143('0x24')](_0x5ec2b2);}}});};exports[_0x1143('0x9e')]=function(_0x320383,_0x202f3f){var _0x2f075e={};var _0xa39cb9={};var _0x33ac46;var _0xee7e57;return db[_0x1143('0x48')][_0x1143('0x73')]({'where':{'id':_0x320383[_0x1143('0x65')]['id']}})['then'](handleEntityNotFound(_0x202f3f,null))[_0x1143('0x26')](function(_0x31aa85){if(_0x31aa85){_0x33ac46=_0x31aa85;_0xa39cb9[_0x1143('0x4d')]=_[_0x1143('0x4f')](db[_0x1143('0x98')][_0x1143('0x49')]);_0xa39cb9[_0x1143('0x50')]=_[_0x1143('0x4f')](_0x320383['query']);_0xa39cb9[_0x1143('0x51')]=_['intersection'](_0xa39cb9[_0x1143('0x4d')],_0xa39cb9[_0x1143('0x50')]);_0x2f075e[_0x1143('0x54')]=_[_0x1143('0x52')](_0xa39cb9['model'],qs['fields'](_0x320383[_0x1143('0x50')][_0x1143('0x53')]));_0x2f075e[_0x1143('0x54')]=_0x2f075e[_0x1143('0x54')][_0x1143('0x55')]?_0x2f075e[_0x1143('0x54')]:_0xa39cb9[_0x1143('0x4d')];_0x2f075e['order']=qs['sort'](_0x320383['query'][_0x1143('0x59')]);_0x2f075e[_0x1143('0x5a')]=qs[_0x1143('0x51')](_[_0x1143('0x5b')](_0x320383[_0x1143('0x50')],_0xa39cb9[_0x1143('0x51')]));if(_0x320383[_0x1143('0x50')][_0x1143('0x5c')]){_0x2f075e[_0x1143('0x5a')]=_[_0x1143('0x5d')](_0x2f075e[_0x1143('0x5a')],{'$or':_[_0x1143('0x4e')](_0x2f075e[_0x1143('0x54')],function(_0x2119a7){var _0x5618ac={};_0x5618ac[_0x2119a7]={'$like':'%'+_0x320383['query'][_0x1143('0x5c')]+'%'};return _0x5618ac;})});}_0x2f075e=_[_0x1143('0x5d')]({},_0x2f075e,_0x320383[_0x1143('0x5f')]);return _0x33ac46[_0x1143('0x9e')](_0x2f075e);}})[_0x1143('0x26')](function(_0x1b8452){if(_0x1b8452){_0xee7e57=_0x1b8452[_0x1143('0x55')];if(!_0x320383[_0x1143('0x50')][_0x1143('0x56')]('nolimit')){_0x2f075e[_0x1143('0x1f')]=qs[_0x1143('0x1f')](_0x320383[_0x1143('0x50')][_0x1143('0x1f')]);_0x2f075e[_0x1143('0x21')]=qs['offset'](_0x320383['query']['offset']);}return _0x33ac46[_0x1143('0x9e')](_0x2f075e);}})[_0x1143('0x26')](function(_0x26ee7e){if(_0x26ee7e){return _0x26ee7e?{'count':_0xee7e57,'rows':_0x26ee7e}:null;}})[_0x1143('0x26')](respondWithResult(_0x202f3f,null))[_0x1143('0x1a')](handleError(_0x202f3f,null));};exports[_0x1143('0x9f')]=function(_0xe06715,_0x48a3c6){var _0x4c8549={'raw':!![],'where':{}};var _0x4d9d15={};var _0x13ee10={'count':0x0,'rows':[]};return db[_0x1143('0x48')][_0x1143('0x73')]({'where':{'id':_0xe06715['params']['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x48a3c6,null))[_0x1143('0x26')](function(_0x432d15){if(_0x432d15){_0x4d9d15[_0x1143('0x4d')]=_[_0x1143('0x4f')](db[_0x1143('0xa0')][_0x1143('0x49')]);_0x4d9d15[_0x1143('0x50')]=_[_0x1143('0x4f')](_0xe06715[_0x1143('0x50')]);_0x4d9d15['filters']=_['intersection'](_0x4d9d15[_0x1143('0x4d')],_0x4d9d15['query']);_0x4c8549[_0x1143('0x54')]=_['intersection'](_0x4d9d15[_0x1143('0x4d')],qs[_0x1143('0x53')](_0xe06715[_0x1143('0x50')][_0x1143('0x53')]));_0x4c8549[_0x1143('0x54')]=_0x4c8549[_0x1143('0x54')]['length']?_0x4c8549[_0x1143('0x54')]:_0x4d9d15[_0x1143('0x4d')];if(!_0xe06715[_0x1143('0x50')][_0x1143('0x56')](_0x1143('0x57'))){_0x4c8549[_0x1143('0x1f')]=qs[_0x1143('0x1f')](_0xe06715[_0x1143('0x50')][_0x1143('0x1f')]);_0x4c8549[_0x1143('0x21')]=qs[_0x1143('0x21')](_0xe06715[_0x1143('0x50')]['offset']);}_0x4c8549[_0x1143('0x58')]=qs[_0x1143('0x59')](_0xe06715[_0x1143('0x50')][_0x1143('0x59')]);_0x4c8549[_0x1143('0x5a')]=qs[_0x1143('0x51')](_[_0x1143('0x5b')](_0xe06715[_0x1143('0x50')],_0x4d9d15['filters']));_0x4c8549[_0x1143('0x5a')][_0x1143('0x6f')]=_0x432d15['id'];if(_0xe06715[_0x1143('0x50')][_0x1143('0x5c')]){_0x4c8549[_0x1143('0x5a')]=_['merge'](_0x4c8549[_0x1143('0x5a')],{'$or':_[_0x1143('0x4e')](_0x4c8549[_0x1143('0x54')],function(_0x5c4e84){var _0x3a19d5={};_0x3a19d5[_0x5c4e84]={'$like':'%'+_0xe06715['query']['filter']+'%'};return _0x3a19d5;})});}if(_0xe06715[_0x1143('0x50')][_0x1143('0xa1')]){var _0x2deccd=_0xe06715[_0x1143('0x50')]['$gte'][_0x1143('0xa2')](',');var _0x3c5cf8={};_0x3c5cf8[_0x2deccd[0x0]]={'$gte':moment(_0x2deccd[0x1])[_0x1143('0xa3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4c8549[_0x1143('0x5a')]=_[_0x1143('0x5d')](_0x4c8549[_0x1143('0x5a')],_0x3c5cf8);}_0x4c8549=_[_0x1143('0x5d')]({},_0x4c8549,_0xe06715['options']);return db[_0x1143('0xa0')][_0x1143('0x20')]({'where':_0x4c8549['where']})['then'](function(_0x21a597){_0x13ee10[_0x1143('0x20')]=_0x21a597;if(_0xe06715[_0x1143('0x50')][_0x1143('0x60')]){_0x4c8549[_0x1143('0x61')]=[{'all':!![]}];}return db[_0x1143('0xa0')][_0x1143('0x62')](_0x4c8549);})[_0x1143('0x26')](function(_0x51cc90){if(_0xe06715[_0x1143('0x50')][_0x1143('0xa4')]===_0x1143('0xa5')){for(var _0x6415d0=0x0;_0x6415d0<_0x51cc90[_0x1143('0x55')];_0x6415d0++){_0x51cc90[_0x6415d0][_0x1143('0x69')]=juice(_0x51cc90[_0x6415d0][_0x1143('0x69')]);}}_0x13ee10['rows']=_0x51cc90;return _0x13ee10;});}})['then'](respondWithFilteredResult(_0x48a3c6,_0x4c8549))[_0x1143('0x1a')](handleError(_0x48a3c6,null));};exports[_0x1143('0x2a')]=function(_0x2d0a28,_0x4e9484){var _0x42e3a6,_0x5dcfe1={},_0x3349d0;if(_0x2d0a28['body']['to']){_0x3349d0=_0x2d0a28[_0x1143('0x69')]['to'][_0x1143('0xa2')](',')[0x0];}return db[_0x1143('0x48')][_0x1143('0x67')]({'where':{'id':_0x2d0a28[_0x1143('0x65')]['id']},'include':[{'model':db[_0x1143('0xa6')],'as':_0x1143('0xa7'),'include':[{'model':db['CmContact'],'as':_0x1143('0xa8'),'where':{'email':_0x3349d0},'limit':0x1,'order':[[_0x1143('0xa9'),_0x1143('0xaa')]]}]},{'model':db['MailServerOut'],'as':_0x1143('0x43'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x1143('0xab'),'raw':!![]}]}]})[_0x1143('0x26')](handleEntityNotFound(_0x4e9484,null))[_0x1143('0x26')](function(_0x5bc856){if(!_0x5bc856)return;_0x42e3a6=_0x5bc856;if(!_0x5bc856['Smtp'])throw new Error(_0x1143('0xac'));if(_[_0x1143('0x7b')](_0x2d0a28['body'][_0x1143('0xad')])){_0x2d0a28[_0x1143('0x69')][_0x1143('0xad')]=util['format'](_0x1143('0xae'),_0x5bc856['name'],_0x5bc856[_0x1143('0x79')]||_0x5bc856[_0x1143('0x43')][_0x1143('0x38')]);}if(_0x2d0a28[_0x1143('0x69')]['attachments']&&_0x2d0a28[_0x1143('0x69')][_0x1143('0xaf')]['length']){for(var _0x33b03d=0x0;_0x33b03d<_0x2d0a28[_0x1143('0x69')][_0x1143('0xaf')][_0x1143('0x55')];_0x33b03d+=0x1){_0x2d0a28[_0x1143('0x69')][_0x1143('0xaf')][_0x33b03d]={'filename':_0x2d0a28['body'][_0x1143('0xaf')][_0x33b03d][_0x1143('0x29')],'path':path['join'](config[_0x1143('0xb0')],_0x1143('0xb1'),_0x2d0a28[_0x1143('0x69')][_0x1143('0xaf')][_0x33b03d]['basename'])};}}var _0x4a29a1=_0x5bc856[_0x1143('0xb2')]();return respondWithRpcPromise(_0x1143('0xb3'),_0x1143('0xb4'),{'account':_0x4a29a1,'message':_0x2d0a28[_0x1143('0x69')]});})[_0x1143('0x26')](function(_0xd4beb5){if(!_0xd4beb5)return;_0x5dcfe1=_0xd4beb5;if(!_0x42e3a6[_0x1143('0xa7')])throw new Error(_0x1143('0xb5'));if(_0x42e3a6[_0x1143('0xa7')]['Contacts'][_0x1143('0x55')])return _0x42e3a6[_0x1143('0xa7')]['Contacts'][0x0];return db[_0x1143('0x8d')][_0x1143('0x71')](_[_0x1143('0xb6')](_0x2d0a28[_0x1143('0x69')],{'firstName':_0x2d0a28[_0x1143('0x69')]['to'],'email':_0x2d0a28[_0x1143('0x69')]['to'],'phone':_0x2d0a28[_0x1143('0x69')]['to'],'ListId':_0x42e3a6[_0x1143('0x7a')]}));})[_0x1143('0x26')](function(_0x49d5c9){if(!_0x49d5c9)return;var _0x50e89f={'UserId':_0x2d0a28[_0x1143('0x38')]['id'],'ContactId':_0x49d5c9['id'],'MailAccountId':_0x42e3a6['id'],'inReplyTo':_0x5dcfe1[_0x1143('0xb7')],'to':_0x2d0a28['body']['from'],'cc':_0x2d0a28[_0x1143('0x69')]['cc'],'subject':_0x2d0a28[_0x1143('0x69')][_0x1143('0xb8')],'attach':_0x2d0a28[_0x1143('0x69')][_0x1143('0xb9')],'firstMsgDirection':_0x1143('0xba'),'lastMsgAt':moment()[_0x1143('0xa3')](_0x1143('0xbb')),'lastMsgDirection':'out','Messages':[_[_0x1143('0x5d')](_0x2d0a28[_0x1143('0x69')],{'messageId':_0x5dcfe1[_0x1143('0xb7')],'sentAt':moment()['format'](_0x1143('0xbb')),'read':!![],'MailAccountId':_0x42e3a6['id'],'UserId':_0x2d0a28[_0x1143('0x38')]['id'],'ContactId':_0x49d5c9['id']})]};if(_0x2d0a28['body'][_0x1143('0xbc')]){_0x50e89f=_['merge'](_0x50e89f,_0x2d0a28[_0x1143('0x69')][_0x1143('0xbc')]);}return db[_0x1143('0x8a')][_0x1143('0x71')](_0x50e89f,{'include':[{'model':db[_0x1143('0xa0')],'as':_0x1143('0xbd')}]});})[_0x1143('0x26')](respondWithResult(_0x4e9484,null))[_0x1143('0x1a')](handleError(_0x4e9484,null));};exports['verifySmtp']=function(_0x5a7ba2,_0x594937){return db['MailAccount'][_0x1143('0x67')]({'where':{'id':_0x5a7ba2[_0x1143('0x65')]['id']},'include':[{'model':db[_0x1143('0x45')],'as':_0x1143('0x43'),'raw':!![],'include':[{'model':db[_0x1143('0xab')],'as':_0x1143('0xab'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x594937,null))['then'](function(_0x1005bd){if(!_0x1005bd['Smtp'])return;var _0x4fdd58=_0x1005bd[_0x1143('0xb2')]();return respondWithRpcPromise(_0x1143('0xbe'),_0x1143('0xbf'),{'account':_0x4fdd58});})[_0x1143('0x26')](respondWithResult(_0x594937,null))['catch'](handleError(_0x594937,null));};exports[_0x1143('0x25')]=function(_0x2c8900,_0x4af50c){return db[_0x1143('0x48')][_0x1143('0x67')]({'where':{'id':_0x2c8900[_0x1143('0x65')]['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x4af50c,null))['then'](function(_0x118f8a){if(_0x118f8a&&_0x118f8a[_0x1143('0x40')]){throw new db['Sequelize'][(_0x1143('0xc0'))](_0x1143('0xc1'));}return _0x118f8a;})[_0x1143('0x26')](removeEntity(_0x4af50c,null))[_0x1143('0x1a')](handleError(_0x4af50c,null));};exports['addAgents']=function(_0x59f4cb,_0x2abf9e){return db[_0x1143('0x48')]['find']({'where':{'id':_0x59f4cb['params']['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x2abf9e,null))[_0x1143('0x26')](function(_0x274a47){if(_0x274a47){return _0x274a47[_0x1143('0xc2')](_0x59f4cb[_0x1143('0x69')][_0x1143('0x78')],_['omit'](_0x59f4cb['body'],[_0x1143('0x78'),'id'])||{})[_0x1143('0xc3')](function(_0x3711ef){for(var _0x191ec2=0x0;_0x191ec2<_0x59f4cb[_0x1143('0x69')][_0x1143('0x78')][_0x1143('0x55')];_0x191ec2+=0x1){socket[_0x1143('0xc4')]('userMailAccount:save',{'UserId':Number(_0x59f4cb[_0x1143('0x69')][_0x1143('0x78')][_0x191ec2]),'MailAccountId':Number(_0x59f4cb[_0x1143('0x65')]['id'])});}return _0x3711ef;});}})[_0x1143('0x26')](respondWithResult(_0x2abf9e,null))[_0x1143('0x1a')](handleError(_0x2abf9e,null));};exports[_0x1143('0xc5')]=function(_0x54dc78,_0x43c845){return db['MailAccount'][_0x1143('0x67')]({'where':{'id':_0x54dc78[_0x1143('0x65')]['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x43c845,null))[_0x1143('0x26')](function(_0x4284a0){if(_0x4284a0){return _0x4284a0[_0x1143('0xc5')](_0x54dc78['query'][_0x1143('0x78')])[_0x1143('0x26')](function(){if(_[_0x1143('0xc6')](_0x54dc78[_0x1143('0x50')]['ids'])){for(var _0x58bfd1=0x0;_0x58bfd1<_0x54dc78[_0x1143('0x50')][_0x1143('0x78')][_0x1143('0x55')];_0x58bfd1+=0x1){socket[_0x1143('0xc4')](_0x1143('0xc7'),{'UserId':Number(_0x54dc78['query'][_0x1143('0x78')][_0x58bfd1]),'MailAccountId':Number(_0x54dc78['params']['id'])});}}else{socket[_0x1143('0xc4')](_0x1143('0xc7'),{'UserId':Number(_0x54dc78['query'][_0x1143('0x78')]),'MailAccountId':Number(_0x54dc78[_0x1143('0x65')]['id'])});}});}})[_0x1143('0x26')](respondWithStatusCode(_0x43c845,null))[_0x1143('0x1a')](handleError(_0x43c845,null));};exports[_0x1143('0xc8')]=function(_0x22a6cd,_0x107a18){var _0x33c0e2={};var _0x1b373f={};var _0x20460f;var _0xa9bbf0;return db[_0x1143('0x48')][_0x1143('0x73')]({'where':{'id':_0x22a6cd[_0x1143('0x65')]['id']}})[_0x1143('0x26')](handleEntityNotFound(_0x107a18,null))['then'](function(_0x544fc6){if(_0x544fc6){_0x20460f=_0x544fc6;_0x1b373f[_0x1143('0x4d')]=_[_0x1143('0x4f')](db[_0x1143('0x8f')]['rawAttributes']);_0x1b373f['query']=_[_0x1143('0x4f')](_0x22a6cd[_0x1143('0x50')]);_0x1b373f[_0x1143('0x51')]=_[_0x1143('0x52')](_0x1b373f[_0x1143('0x4d')],_0x1b373f['query']);_0x33c0e2[_0x1143('0x54')]=_['intersection'](_0x1b373f['model'],qs[_0x1143('0x53')](_0x22a6cd[_0x1143('0x50')][_0x1143('0x53')]));_0x33c0e2[_0x1143('0x54')]=_0x33c0e2[_0x1143('0x54')][_0x1143('0x55')]?_0x33c0e2['attributes']:_0x1b373f[_0x1143('0x4d')];_0x33c0e2['order']=qs[_0x1143('0x59')](_0x22a6cd[_0x1143('0x50')][_0x1143('0x59')]);_0x33c0e2['where']=qs[_0x1143('0x51')](_['pick'](_0x22a6cd[_0x1143('0x50')],_0x1b373f[_0x1143('0x51')]));if(_0x22a6cd[_0x1143('0x50')][_0x1143('0x5c')]){_0x33c0e2[_0x1143('0x5a')]=_[_0x1143('0x5d')](_0x33c0e2[_0x1143('0x5a')],{'$or':_['map'](_0x33c0e2[_0x1143('0x54')],function(_0x405255){var _0x2b9bba={};_0x2b9bba[_0x405255]={'$like':'%'+_0x22a6cd[_0x1143('0x50')][_0x1143('0x5c')]+'%'};return _0x2b9bba;})});}_0x33c0e2=_[_0x1143('0x5d')]({},_0x33c0e2,_0x22a6cd[_0x1143('0x5f')]);return _0x20460f[_0x1143('0xc8')](_0x33c0e2);}})[_0x1143('0x26')](function(_0xeba26d){if(_0xeba26d){_0xa9bbf0=_0xeba26d[_0x1143('0x55')];if(!_0x22a6cd[_0x1143('0x50')][_0x1143('0x56')](_0x1143('0x57'))){_0x33c0e2[_0x1143('0x1f')]=qs[_0x1143('0x1f')](_0x22a6cd['query']['limit']);_0x33c0e2[_0x1143('0x21')]=qs['offset'](_0x22a6cd[_0x1143('0x50')][_0x1143('0x21')]);}return _0x20460f['getAgents'](_0x33c0e2);}})[_0x1143('0x26')](function(_0x3e1c79){if(_0x3e1c79){return _0x3e1c79?{'count':_0xa9bbf0,'rows':_0x3e1c79}:null;}})[_0x1143('0x26')](respondWithResult(_0x107a18,null))['catch'](handleError(_0x107a18,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 6ec99ad..0a53d93 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 _0x4667=['../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x263c87,_0x15742a){var _0x5bb58a=function(_0x347fab){while(--_0x347fab){_0x263c87['push'](_0x263c87['shift']());}};_0x5bb58a(++_0x15742a);}(_0x4667,0x10f));var _0x7466=function(_0x2bf9ae,_0x270fda){_0x2bf9ae=_0x2bf9ae-0x0;var _0x23c251=_0x4667[_0x2bf9ae];return _0x23c251;};'use strict';var EventEmitter=require(_0x7466('0x0'));var MailAccount=require(_0x7466('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7466('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7466('0x3')};function emitEvent(_0x20c421){return function(_0x2206b3,_0x5e4ad4,_0x4155aa){MailAccountEvents[_0x7466('0x4')](_0x20c421+':'+_0x2206b3['id'],_0x2206b3);MailAccountEvents[_0x7466('0x4')](_0x20c421,_0x2206b3);_0x4155aa(null);};}for(var e in events){if(events[_0x7466('0x5')](e)){var event=events[e];MailAccount[_0x7466('0x6')](e,emitEvent(event));}}module[_0x7466('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x2a8e=['update','remove','emit','hasOwnProperty','hook','exports','events','MailAccount','setMaxListeners','save'];(function(_0x2bd20a,_0x53be0d){var _0x199a13=function(_0x58060f){while(--_0x58060f){_0x2bd20a['push'](_0x2bd20a['shift']());}};_0x199a13(++_0x53be0d);}(_0x2a8e,0x132));var _0xe2a8=function(_0x1d2cd5,_0x56dd51){_0x1d2cd5=_0x1d2cd5-0x0;var _0x12d99f=_0x2a8e[_0x1d2cd5];return _0x12d99f;};'use strict';var EventEmitter=require(_0xe2a8('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xe2a8('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xe2a8('0x2')](0x0);var events={'afterCreate':_0xe2a8('0x3'),'afterUpdate':_0xe2a8('0x4'),'afterDestroy':_0xe2a8('0x5')};function emitEvent(_0x23bce4){return function(_0x35d881,_0x3331f3,_0x1baf49){MailAccountEvents['emit'](_0x23bce4+':'+_0x35d881['id'],_0x35d881);MailAccountEvents[_0xe2a8('0x6')](_0x23bce4,_0x35d881);_0x1baf49(null);};}for(var e in events){if(events[_0xe2a8('0x7')](e)){var event=events[e];MailAccount[_0xe2a8('0x8')](e,emitEvent(event));}}module[_0xe2a8('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 2b161cb..cf72489 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 _0x162f=['modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','data5','pass','./mailAccount.attributes','exports','define','MailAccount','provider','custom','host','port','Smtp','secure','authentication'];(function(_0x803ae0,_0x5c5f30){var _0x3c38b1=function(_0x59b091){while(--_0x59b091){_0x803ae0['push'](_0x803ae0['shift']());}};_0x3c38b1(++_0x5c5f30);}(_0x162f,0xe3));var _0xf162=function(_0x232286,_0x20af17){_0x232286=_0x232286-0x0;var _0x3331f6=_0x162f[_0x232286];return _0x3331f6;};'use strict';var attributes=require(_0xf162('0x0'));module[_0xf162('0x1')]=function(_0x6f0d81){return _0x6f0d81[_0xf162('0x2')](_0xf162('0x3'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x296325=this;var _0x16a725={'id':_0x296325['id'],'tls':{'rejectUnauthorized':![]}};if(_0x296325[_0xf162('0x4')]!==_0xf162('0x5')){_0x16a725['service']=_0x296325['provider'];}else{_0x16a725[_0xf162('0x6')]=_0x296325['Smtp'][_0xf162('0x6')];_0x16a725['port']=_0x296325['Smtp'][_0xf162('0x7')];_0x16a725['secure']=_0x296325[_0xf162('0x8')][_0xf162('0x9')];}if(_0x296325[_0xf162('0x8')][_0xf162('0xa')]){if(_0x296325[_0xf162('0x8')][_0xf162('0xb')]){if(!_0x296325[_0xf162('0x8')]['CloudProvider'])throw new Error(_0xf162('0xc'));_0x16a725[_0xf162('0xd')]={'type':'OAuth2','user':_0x296325['Smtp'][_0xf162('0xe')],'accessToken':_0x296325[_0xf162('0x8')]['CloudProvider'][_0xf162('0xf')]};}else{_0x16a725['auth']={'user':_0x296325[_0xf162('0x8')][_0xf162('0xe')],'pass':_0x296325['Smtp'][_0xf162('0x10')]};}}return _0x16a725;}}});}; \ No newline at end of file +var _0x62f9=['Smtp','port','secure','authentication','modernAuthentication','CloudProvider','OAuth2','user','./mailAccount.attributes','exports','define','mail_accounts','provider','service'];(function(_0x1fb99e,_0x6afedb){var _0x4b9b71=function(_0x28ba49){while(--_0x28ba49){_0x1fb99e['push'](_0x1fb99e['shift']());}};_0x4b9b71(++_0x6afedb);}(_0x62f9,0x190));var _0x962f=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0x62f9[_0x511bd1];return _0x4c48ec;};'use strict';var attributes=require(_0x962f('0x0'));module[_0x962f('0x1')]=function(_0x384e89){return _0x384e89[_0x962f('0x2')]('MailAccount',attributes,{'tableName':_0x962f('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x51b8d6=this;var _0x39fc1d={'id':_0x51b8d6['id'],'tls':{'rejectUnauthorized':![]}};if(_0x51b8d6[_0x962f('0x4')]!=='custom'){_0x39fc1d[_0x962f('0x5')]=_0x51b8d6[_0x962f('0x4')];}else{_0x39fc1d['host']=_0x51b8d6[_0x962f('0x6')]['host'];_0x39fc1d[_0x962f('0x7')]=_0x51b8d6[_0x962f('0x6')][_0x962f('0x7')];_0x39fc1d[_0x962f('0x8')]=_0x51b8d6[_0x962f('0x6')][_0x962f('0x8')];}if(_0x51b8d6[_0x962f('0x6')][_0x962f('0x9')]){if(_0x51b8d6[_0x962f('0x6')][_0x962f('0xa')]){if(!_0x51b8d6[_0x962f('0x6')][_0x962f('0xb')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x39fc1d['auth']={'type':_0x962f('0xc'),'user':_0x51b8d6[_0x962f('0x6')][_0x962f('0xd')],'accessToken':_0x51b8d6[_0x962f('0x6')][_0x962f('0xb')]['data5']};}else{_0x39fc1d['auth']={'user':_0x51b8d6['Smtp'][_0x962f('0xd')],'pass':_0x51b8d6[_0x962f('0x6')]['pass']};}}return _0x39fc1d;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 896f9c8..f4a8353 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 _0xaf1b=['mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','CmList','Contacts','DESC','MailApplication','Applications','Smtp','CloudProvider','List','get','account','omit','smtpOptions','getSmtpOptions','applications','list','orderBy','priority','asc','autoclose','push','close','*,*,*,*','length','ListId','List\x20not\x20found','contact','messageId','generate','subject','format','MailInteraction','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','attachments','originCc','bcc','originChannel','Email','Attachments','UserId','name','unshift','MailQueue','queueId','queue','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','attributes','limit','map','include','model','GetMailAccount','stringify','find','where','smtp','setDataValue','ShowMailAccount','NotifyMailAccount','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','body','isNil','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey'];(function(_0x4ccf7f,_0x161ffd){var _0x1953f0=function(_0xfd2ca6){while(--_0xfd2ca6){_0x4ccf7f['push'](_0x4ccf7f['shift']());}};_0x1953f0(++_0x161ffd);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x76e3b1,_0x411cfa){_0x76e3b1=_0x76e3b1-0x0;var _0x47ab46=_0xaf1b[_0x76e3b1];return _0x47ab46;};'use strict';var _=require(_0xbaf1('0x0'));var moment=require(_0xbaf1('0x1'));var BPromise=require(_0xbaf1('0x2'));var rs=require(_0xbaf1('0x3'));var Redis=require(_0xbaf1('0x4'));var db=require(_0xbaf1('0x5'))['db'];var logger=require(_0xbaf1('0x6'))(_0xbaf1('0x7'));var config=require(_0xbaf1('0x8'));var jayson=require(_0xbaf1('0x9'));var client=jayson[_0xbaf1('0xa')][_0xbaf1('0xb')]({'port':0x232c});config[_0xbaf1('0xc')]=_[_0xbaf1('0xd')](config['redis'],{'host':_0xbaf1('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbaf1('0xc')]));require('./mailAccount.socket')[_0xbaf1('0xf')](socket);function respondWithRpcPromise(_0x3723ae,_0x41a0ba,_0x4ece8c){return new BPromise(function(_0x222756,_0x287408){return client['request'](_0x3723ae,_0x4ece8c)[_0xbaf1('0x10')](function(_0x578f20){logger[_0xbaf1('0x11')](_0xbaf1('0x12'),_0x41a0ba,_0xbaf1('0x13'));logger[_0xbaf1('0x14')](_0xbaf1('0x15'),_0x41a0ba,_0xbaf1('0x13'),JSON['stringify'](_0x578f20));if(_0x578f20['error']){if(_0x578f20[_0xbaf1('0x16')][_0xbaf1('0x17')]===0x1f4){logger[_0xbaf1('0x16')](_0xbaf1('0x12'),_0x41a0ba,_0x578f20[_0xbaf1('0x16')][_0xbaf1('0x18')]);return _0x287408(_0x578f20[_0xbaf1('0x16')]['message']);}logger[_0xbaf1('0x16')](_0xbaf1('0x12'),_0x41a0ba,_0x578f20[_0xbaf1('0x16')][_0xbaf1('0x18')]);return _0x222756(_0x578f20[_0xbaf1('0x16')][_0xbaf1('0x18')]);}else{logger[_0xbaf1('0x11')](_0xbaf1('0x12'),_0x41a0ba,'request\x20sent');_0x222756(_0x578f20[_0xbaf1('0x19')]['message']);}})[_0xbaf1('0x1a')](function(_0x3b13b2){logger[_0xbaf1('0x16')](_0xbaf1('0x12'),_0x41a0ba,_0x3b13b2);_0x287408(_0x3b13b2);});});}exports['GetMailAccount']=function(_0x43291c){var _0x52b6da=this;return new Promise(function(_0x2ac412,_0x38de6b){return db['MailAccount'][_0xbaf1('0x1b')]({'raw':_0x43291c[_0xbaf1('0x1c')]?_0x43291c[_0xbaf1('0x1c')][_0xbaf1('0x1d')]===undefined?!![]:![]:!![],'where':_0x43291c[_0xbaf1('0x1c')]?_0x43291c[_0xbaf1('0x1c')]['where']||null:null,'attributes':_0x43291c['options']?_0x43291c[_0xbaf1('0x1c')][_0xbaf1('0x1e')]||null:null,'limit':_0x43291c[_0xbaf1('0x1c')]?_0x43291c['options'][_0xbaf1('0x1f')]||null:null,'include':_0x43291c[_0xbaf1('0x1c')]?_0x43291c[_0xbaf1('0x1c')]['include']?_[_0xbaf1('0x20')](_0x43291c['options'][_0xbaf1('0x21')],function(_0x181c9d){return{'model':db[_0x181c9d[_0xbaf1('0x22')]],'as':_0x181c9d['as'],'attributes':_0x181c9d[_0xbaf1('0x1e')],'include':_0x181c9d[_0xbaf1('0x21')]?_['map'](_0x181c9d['include'],function(_0x1cfbcd){return{'model':db[_0x1cfbcd[_0xbaf1('0x22')]],'as':_0x1cfbcd['as'],'attributes':_0x1cfbcd[_0xbaf1('0x1e')],'include':_0x1cfbcd[_0xbaf1('0x21')]?_['map'](_0x1cfbcd[_0xbaf1('0x21')],function(_0x5959d0){return{'model':db[_0x5959d0[_0xbaf1('0x22')]],'as':_0x5959d0['as'],'attributes':_0x5959d0[_0xbaf1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbaf1('0x10')](function(_0x17f2ea){logger[_0xbaf1('0x11')](_0xbaf1('0x23'),_0x43291c);logger[_0xbaf1('0x14')]('GetMailAccount',_0x43291c,JSON[_0xbaf1('0x24')](_0x17f2ea));_0x2ac412(_0x17f2ea);})[_0xbaf1('0x1a')](function(_0x1a523d){logger[_0xbaf1('0x16')](_0xbaf1('0x23'),_0x1a523d[_0xbaf1('0x18')],_0x43291c);_0x38de6b(_0x52b6da[_0xbaf1('0x16')](0x1f4,_0x1a523d[_0xbaf1('0x18')]));});});};exports['ShowMailAccount']=function(_0x467aca){var _0x16a8de=this;return new Promise(function(_0x1f8118,_0x2673e0){return db['MailAccount'][_0xbaf1('0x25')]({'raw':_0x467aca['options']?_0x467aca[_0xbaf1('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x467aca[_0xbaf1('0x1c')]?_0x467aca[_0xbaf1('0x1c')][_0xbaf1('0x26')]||null:null,'attributes':_0x467aca[_0xbaf1('0x1c')]?_0x467aca['options'][_0xbaf1('0x1e')]||null:null,'include':_0x467aca[_0xbaf1('0x1c')]?_0x467aca[_0xbaf1('0x1c')][_0xbaf1('0x21')]?_[_0xbaf1('0x20')](_0x467aca[_0xbaf1('0x1c')][_0xbaf1('0x21')],function(_0x5a60b7){return{'model':db[_0x5a60b7[_0xbaf1('0x22')]],'as':_0x5a60b7['as'],'attributes':_0x5a60b7[_0xbaf1('0x1e')],'include':_0x5a60b7[_0xbaf1('0x21')]?_[_0xbaf1('0x20')](_0x5a60b7[_0xbaf1('0x21')],function(_0x2aafa8){return{'model':db[_0x2aafa8[_0xbaf1('0x22')]],'as':_0x2aafa8['as'],'attributes':_0x2aafa8['attributes'],'include':_0x2aafa8[_0xbaf1('0x21')]?_['map'](_0x2aafa8[_0xbaf1('0x21')],function(_0xcd28ce){return{'model':db[_0xcd28ce[_0xbaf1('0x22')]],'as':_0xcd28ce['as'],'attributes':_0xcd28ce[_0xbaf1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbaf1('0x10')](function(_0x5c9fd4){if(_0x467aca[_0xbaf1('0x1c')][_0xbaf1('0x27')]===!![])_0x5c9fd4[_0xbaf1('0x28')]('smtpOptions',_0x5c9fd4['getSmtpOptions']());logger['info'](_0xbaf1('0x29'),_0x467aca);logger[_0xbaf1('0x14')]('ShowMailAccount',_0x467aca,JSON[_0xbaf1('0x24')](_0x5c9fd4));_0x1f8118(_0x5c9fd4);})[_0xbaf1('0x1a')](function(_0x31475a){logger['error'](_0xbaf1('0x29'),_0x31475a[_0xbaf1('0x18')],_0x467aca);_0x2673e0(_0x16a8de[_0xbaf1('0x16')](0x1f4,_0x31475a['message']));});});};exports[_0xbaf1('0x2a')]=function(_0x39d196){var _0x52775b=this;return new Promise(function(_0x520ae2,_0x68720f){var _0x4ca174={'body':_0x39d196['body'],'channel':'mail'};var _0x36c6c2=_[_0xbaf1('0x2b')](_[_0xbaf1('0x2c')](db[_0xbaf1('0x2d')][_0xbaf1('0x2e')]),[_0xbaf1('0x2f'),_0xbaf1('0x30'),_0xbaf1('0x31'),'ListId']);var _0x45f0b5=![];if(_0x39d196[_0xbaf1('0x32')]['id']){delete _0x39d196[_0xbaf1('0x32')]['id'];}if(_[_0xbaf1('0x33')](_0x39d196['body'][_0xbaf1('0x34')])){return _0x68720f(_0x52775b['error'](0x1f4,_0xbaf1('0x35')));}if(_[_0xbaf1('0x33')](_0x39d196[_0xbaf1('0x32')]['body'])||_0x39d196[_0xbaf1('0x32')][_0xbaf1('0x32')]===''){return _0x68720f(_0x52775b[_0xbaf1('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xbaf1('0x33')](_0x39d196['body']['mapKey'])){return _0x68720f(_0x52775b['error'](0x1f4,_0xbaf1('0x36')+_0x36c6c2));}if(!_[_0xbaf1('0x37')](_0x36c6c2,_0x39d196[_0xbaf1('0x32')][_0xbaf1('0x38')])){return _0x68720f(_0x52775b[_0xbaf1('0x16')](0x1f4,_0xbaf1('0x39')+_0x36c6c2));}var _0x52bd9a={};_0x52bd9a[_0x39d196[_0xbaf1('0x32')][_0xbaf1('0x38')]]=_0x39d196[_0xbaf1('0x32')][_0xbaf1('0x34')];return db[_0xbaf1('0x3a')][_0xbaf1('0x25')]({'where':{'id':_0x39d196['account']['id']},'include':[{'model':db[_0xbaf1('0x3b')],'as':'List','include':[{'model':db['CmContact'],'as':_0xbaf1('0x3c'),'where':_0x52bd9a,'limit':0x1,'order':[[_0xbaf1('0x30'),_0xbaf1('0x3d')]]}]},{'model':db[_0xbaf1('0x3e')],'as':_0xbaf1('0x3f')},{'model':db['MailServerOut'],'as':_0xbaf1('0x40'),'include':[{'model':db['CloudProvider'],'as':_0xbaf1('0x41')}]}]})[_0xbaf1('0x10')](function(_0xce46bc){if(_0xce46bc&&_0xce46bc[_0xbaf1('0x42')]){var _0x2b1f4a=_0xce46bc[_0xbaf1('0x43')]({'plain':!![]});_0x4ca174[_0xbaf1('0x44')]=_[_0xbaf1('0x45')](_0x2b1f4a,[_0xbaf1('0x3f'),_0xbaf1('0x42')]);_0x4ca174[_0xbaf1('0x44')][_0xbaf1('0x46')]=_0xce46bc[_0xbaf1('0x47')]();_0x4ca174[_0xbaf1('0x48')]=_0x2b1f4a[_0xbaf1('0x3f')];_0x4ca174[_0xbaf1('0x49')]=_0x2b1f4a['List'];_0x4ca174[_0xbaf1('0x48')]=_[_0xbaf1('0x4a')](_0x4ca174[_0xbaf1('0x48')],[_0xbaf1('0x4b')],[_0xbaf1('0x4c')]);if(_0x4ca174[_0xbaf1('0x44')]&&_0x4ca174[_0xbaf1('0x44')][_0xbaf1('0x4d')]){_0x4ca174[_0xbaf1('0x48')][_0xbaf1('0x4e')]({'id':0x0,'priority':_0x4ca174[_0xbaf1('0x48')]['length']+0x1,'app':_0xbaf1('0x4f'),'appdata':_0xbaf1('0x4d'),'interval':_0xbaf1('0x50')});}if(_0x4ca174[_0xbaf1('0x44')][_0xbaf1('0x3f')]){delete _0x4ca174[_0xbaf1('0x44')]['Applications'];}if(_0x4ca174[_0xbaf1('0x44')]['List']){delete _0x4ca174[_0xbaf1('0x44')][_0xbaf1('0x42')];}if(_0x2b1f4a[_0xbaf1('0x42')][_0xbaf1('0x3c')][_0xbaf1('0x51')]){return _0x2b1f4a[_0xbaf1('0x42')][_0xbaf1('0x3c')][0x0];}var _0x35a9a2=_[_0xbaf1('0xd')](_0x39d196[_0xbaf1('0x32')],{'firstName':_0x39d196[_0xbaf1('0x32')]['from'],'ListId':_0x2b1f4a[_0xbaf1('0x52')]});_0x35a9a2[_0x39d196['body']['mapKey']]=_0x39d196['body'][_0xbaf1('0x34')];return db['CmContact']['create'](_0x35a9a2);}else{throw new Error(_0xbaf1('0x53'));}})[_0xbaf1('0x10')](function(_0x4cc1bc){_0x4ca174[_0xbaf1('0x54')]=_0x4cc1bc;if(_0x4cc1bc){if(!_0x39d196[_0xbaf1('0x32')][_0xbaf1('0x18')][_0xbaf1('0x55')]){_0x39d196[_0xbaf1('0x32')][_0xbaf1('0x18')][_0xbaf1('0x55')]=rs[_0xbaf1('0x56')]()+'\x20'+_0x39d196[_0xbaf1('0x32')][_0xbaf1('0x18')]['from'];}var _0x126bd2={'ContactId':_0x4cc1bc['id'],'MailAccountId':_0x39d196['account']['id'],'inReplyTo':_0x39d196[_0xbaf1('0x32')]['message'][_0xbaf1('0x55')],'to':_0x39d196[_0xbaf1('0x32')][_0xbaf1('0x18')][_0xbaf1('0x34')],'cc':_0x39d196[_0xbaf1('0x32')][_0xbaf1('0x18')]['cc'],'subject':_0x39d196[_0xbaf1('0x32')][_0xbaf1('0x18')][_0xbaf1('0x57')],'attach':_0x39d196[_0xbaf1('0x32')][_0xbaf1('0x18')]['attach'],'lastMsgAt':moment()[_0xbaf1('0x58')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0xbaf1('0x59')]['find']({'where':{'closed':![],'MailAccountId':_0x39d196[_0xbaf1('0x44')]['id']},'include':[{'model':db[_0xbaf1('0x5a')],'as':_0xbaf1('0x5b'),'attributes':[_0xbaf1('0x55')],'where':{'messageId':_0x39d196[_0xbaf1('0x32')]['message'][_0xbaf1('0x5c')]}}]})[_0xbaf1('0x10')](function(_0x1e43bd){if(_0x1e43bd){return[_0x1e43bd,![]];}return db['MailInteraction'][_0xbaf1('0x5d')](_0x126bd2)[_0xbaf1('0x10')](function(_0x25a8f){return[_0x25a8f,!![]];});});}else{throw new Error(_0xbaf1('0x5e'));}})[_0xbaf1('0x5f')](function(_0x212789,_0x547b62){if(_0x212789){_0x45f0b5=_0x547b62;if(!_0x547b62){return _0x212789[_0xbaf1('0x60')]({'inReplyTo':_0x39d196[_0xbaf1('0x32')][_0xbaf1('0x18')][_0xbaf1('0x55')],'to':_0x39d196[_0xbaf1('0x32')][_0xbaf1('0x18')]['from'],'cc':_0x39d196[_0xbaf1('0x32')][_0xbaf1('0x18')]['cc'],'subject':_0x39d196[_0xbaf1('0x32')]['message']['subject'],'attach':_0x212789[_0xbaf1('0x61')]?_0x212789[_0xbaf1('0x61')]:_0x39d196[_0xbaf1('0x32')]['message'][_0xbaf1('0x61')],'substatus':null,'substatusAt':moment()[_0xbaf1('0x58')](_0xbaf1('0x62')),'lastMsgAt':moment()[_0xbaf1('0x58')](_0xbaf1('0x62')),'lastMsgDirection':'in'});}else{return _0x212789;}}})['then'](function(_0x3d703b){_0x4ca174[_0xbaf1('0x63')]=_0x3d703b[_0xbaf1('0x43')]({'plain':!![]});_0x4ca174['interaction']['created']=_0x45f0b5;return db[_0xbaf1('0x5a')][_0xbaf1('0x5d')]({'body':_0x39d196[_0xbaf1('0x32')]['body'],'MailAccountId':_0x39d196[_0xbaf1('0x44')]['id'],'MailInteractionId':_0x3d703b['id'],'direction':'in','ContactId':_0x4ca174[_0xbaf1('0x54')]['id'],'messageId':_0x39d196[_0xbaf1('0x32')]['message'][_0xbaf1('0x55')],'from':_0x39d196[_0xbaf1('0x32')]['message']['from'],'to':_0x39d196[_0xbaf1('0x32')][_0xbaf1('0x18')]['to'],'cc':_0x39d196['body']['message']['cc'],'subject':_0x39d196[_0xbaf1('0x32')]['message'][_0xbaf1('0x57')],'attach':_0x39d196[_0xbaf1('0x32')][_0xbaf1('0x18')][_0xbaf1('0x61')],'Attachments':_0x39d196[_0xbaf1('0x32')][_0xbaf1('0x18')][_0xbaf1('0x64')],'originTo':_0x39d196['body']['message']['originTo'],'originCc':_0x39d196[_0xbaf1('0x32')][_0xbaf1('0x18')][_0xbaf1('0x65')],'bcc':_0x39d196['body'][_0xbaf1('0x18')][_0xbaf1('0x66')],'ChatWebsiteId':_0x39d196[_0xbaf1('0x32')][_0xbaf1('0x18')]['ChatWebsiteId']||null,'originChannel':_0x39d196[_0xbaf1('0x32')][_0xbaf1('0x18')][_0xbaf1('0x67')]||_0xbaf1('0x68'),'ChatOfflineMessageId':_0x39d196[_0xbaf1('0x32')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db['Attachment'],'as':_0xbaf1('0x69')}]});})[_0xbaf1('0x10')](function(_0x56feb8){_0x4ca174[_0xbaf1('0x18')]=_0x56feb8;if(!_0x4ca174['interaction'][_0xbaf1('0x6a')]){return;}return db['User'][_0xbaf1('0x25')]({'attributes':['id',_0xbaf1('0x6b')],'where':{'id':_0x4ca174['interaction'][_0xbaf1('0x6a')]}});})[_0xbaf1('0x10')](function(_0x97800){if(_0x97800){_0x4ca174[_0xbaf1('0x48')][_0xbaf1('0x6c')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x97800[_0xbaf1('0x6b')]+','+(_0x4ca174[_0xbaf1('0x44')]['waitForTheAssignedAgent']||0xa),'interval':_0xbaf1('0x50')});}if(!_0x4ca174[_0xbaf1('0x63')]['queueId']){return;}return db[_0xbaf1('0x6d')][_0xbaf1('0x25')]({'attributes':['id',_0xbaf1('0x6b')],'where':{'id':_0x4ca174[_0xbaf1('0x63')][_0xbaf1('0x6e')]}});})[_0xbaf1('0x10')](function(_0x8e0399){if(_0x8e0399){_0x4ca174[_0xbaf1('0x48')][_0xbaf1('0x6c')]({'id':0x0,'priority':0x1,'app':_0xbaf1('0x6f'),'appdata':_0x8e0399[_0xbaf1('0x6b')]+','+(_0x4ca174[_0xbaf1('0x44')]['waitForTheAssignedQueue']||0x12c),'interval':_0xbaf1('0x50')});}return respondWithRpcPromise('Start',_0xbaf1('0x70'),_0x4ca174);})[_0xbaf1('0x10')](function(_0xd937c2){_0x520ae2(_0xd937c2);})[_0xbaf1('0x1a')](function(_0x3467a7){_0x68720f(_0x52775b[_0xbaf1('0x16')](0x1f4,_0x3467a7[_0xbaf1('0x18')]));});});}; \ No newline at end of file +var _0x8958=['Applications','Smtp','CloudProvider','List','get','list','applications','orderBy','priority','asc','autoclose','push','length','*,*,*,*','Contacts','ListId','List\x20not\x20found','generate','messageId','subject','attach','MailInteraction','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','originTo','bcc','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','name','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','startRouting','moment','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailAccount','findAll','options','raw','where','attributes','limit','map','include','model','ShowMailAccount','MailAccount','find','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','CmContact','from','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','account','CmList','DESC','MailApplication'];(function(_0x5bf315,_0x194eaa){var _0x49b222=function(_0x33359c){while(--_0x33359c){_0x5bf315['push'](_0x5bf315['shift']());}};_0x49b222(++_0x194eaa);}(_0x8958,0x93));var _0x8895=function(_0x31aab1,_0x3ad60a){_0x31aab1=_0x31aab1-0x0;var _0x15b9a8=_0x8958[_0x31aab1];return _0x15b9a8;};'use strict';var _=require('lodash');var moment=require(_0x8895('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0x8895('0x1'))('rpc');var config=require(_0x8895('0x2'));var jayson=require(_0x8895('0x3'));var client=jayson[_0x8895('0x4')]['http']({'port':0x232c});config[_0x8895('0x5')]=_[_0x8895('0x6')](config[_0x8895('0x5')],{'host':_0x8895('0x7'),'port':0x18eb});var socket=require(_0x8895('0x8'))(new Redis(config['redis']));require(_0x8895('0x9'))[_0x8895('0xa')](socket);function respondWithRpcPromise(_0x408d4b,_0x24fe49,_0x6eab1e){return new BPromise(function(_0x29c126,_0x22a12b){return client[_0x8895('0xb')](_0x408d4b,_0x6eab1e)[_0x8895('0xc')](function(_0x107d86){logger['info'](_0x8895('0xd'),_0x24fe49,_0x8895('0xe'));logger[_0x8895('0xf')](_0x8895('0x10'),_0x24fe49,_0x8895('0xe'),JSON[_0x8895('0x11')](_0x107d86));if(_0x107d86['error']){if(_0x107d86[_0x8895('0x12')][_0x8895('0x13')]===0x1f4){logger[_0x8895('0x12')]('MailAccount,\x20%s,\x20%s',_0x24fe49,_0x107d86['error'][_0x8895('0x14')]);return _0x22a12b(_0x107d86['error'][_0x8895('0x14')]);}logger[_0x8895('0x12')](_0x8895('0xd'),_0x24fe49,_0x107d86[_0x8895('0x12')][_0x8895('0x14')]);return _0x29c126(_0x107d86['error'][_0x8895('0x14')]);}else{logger[_0x8895('0x15')](_0x8895('0xd'),_0x24fe49,_0x8895('0xe'));_0x29c126(_0x107d86[_0x8895('0x16')][_0x8895('0x14')]);}})[_0x8895('0x17')](function(_0x26cee0){logger[_0x8895('0x12')](_0x8895('0xd'),_0x24fe49,_0x26cee0);_0x22a12b(_0x26cee0);});});}exports[_0x8895('0x18')]=function(_0x6b8a16){var _0x2df795=this;return new Promise(function(_0x54e6d4,_0x522a4e){return db['MailAccount'][_0x8895('0x19')]({'raw':_0x6b8a16[_0x8895('0x1a')]?_0x6b8a16[_0x8895('0x1a')][_0x8895('0x1b')]===undefined?!![]:![]:!![],'where':_0x6b8a16[_0x8895('0x1a')]?_0x6b8a16[_0x8895('0x1a')][_0x8895('0x1c')]||null:null,'attributes':_0x6b8a16[_0x8895('0x1a')]?_0x6b8a16['options'][_0x8895('0x1d')]||null:null,'limit':_0x6b8a16[_0x8895('0x1a')]?_0x6b8a16[_0x8895('0x1a')][_0x8895('0x1e')]||null:null,'include':_0x6b8a16[_0x8895('0x1a')]?_0x6b8a16['options']['include']?_[_0x8895('0x1f')](_0x6b8a16[_0x8895('0x1a')][_0x8895('0x20')],function(_0x24a376){return{'model':db[_0x24a376['model']],'as':_0x24a376['as'],'attributes':_0x24a376[_0x8895('0x1d')],'include':_0x24a376[_0x8895('0x20')]?_[_0x8895('0x1f')](_0x24a376['include'],function(_0x4aee03){return{'model':db[_0x4aee03[_0x8895('0x21')]],'as':_0x4aee03['as'],'attributes':_0x4aee03['attributes'],'include':_0x4aee03[_0x8895('0x20')]?_[_0x8895('0x1f')](_0x4aee03[_0x8895('0x20')],function(_0xf5fb66){return{'model':db[_0xf5fb66[_0x8895('0x21')]],'as':_0xf5fb66['as'],'attributes':_0xf5fb66['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x6e449d){logger[_0x8895('0x15')](_0x8895('0x18'),_0x6b8a16);logger[_0x8895('0xf')](_0x8895('0x18'),_0x6b8a16,JSON['stringify'](_0x6e449d));_0x54e6d4(_0x6e449d);})['catch'](function(_0x46ae32){logger[_0x8895('0x12')](_0x8895('0x18'),_0x46ae32[_0x8895('0x14')],_0x6b8a16);_0x522a4e(_0x2df795[_0x8895('0x12')](0x1f4,_0x46ae32['message']));});});};exports[_0x8895('0x22')]=function(_0x5d2f33){var _0x3f055a=this;return new Promise(function(_0x5b2b19,_0x40ba14){return db[_0x8895('0x23')][_0x8895('0x24')]({'raw':_0x5d2f33[_0x8895('0x1a')]?_0x5d2f33[_0x8895('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5d2f33[_0x8895('0x1a')]?_0x5d2f33[_0x8895('0x1a')][_0x8895('0x1c')]||null:null,'attributes':_0x5d2f33[_0x8895('0x1a')]?_0x5d2f33[_0x8895('0x1a')]['attributes']||null:null,'include':_0x5d2f33[_0x8895('0x1a')]?_0x5d2f33['options'][_0x8895('0x20')]?_['map'](_0x5d2f33[_0x8895('0x1a')][_0x8895('0x20')],function(_0x20907a){return{'model':db[_0x20907a[_0x8895('0x21')]],'as':_0x20907a['as'],'attributes':_0x20907a[_0x8895('0x1d')],'include':_0x20907a['include']?_[_0x8895('0x1f')](_0x20907a['include'],function(_0x57f58a){return{'model':db[_0x57f58a[_0x8895('0x21')]],'as':_0x57f58a['as'],'attributes':_0x57f58a[_0x8895('0x1d')],'include':_0x57f58a[_0x8895('0x20')]?_[_0x8895('0x1f')](_0x57f58a[_0x8895('0x20')],function(_0x4b7fe0){return{'model':db[_0x4b7fe0[_0x8895('0x21')]],'as':_0x4b7fe0['as'],'attributes':_0x4b7fe0[_0x8895('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2557fc){if(_0x5d2f33['options'][_0x8895('0x25')]===!![])_0x2557fc[_0x8895('0x26')]('smtpOptions',_0x2557fc[_0x8895('0x27')]());logger[_0x8895('0x15')]('ShowMailAccount',_0x5d2f33);logger['debug'](_0x8895('0x22'),_0x5d2f33,JSON[_0x8895('0x11')](_0x2557fc));_0x5b2b19(_0x2557fc);})[_0x8895('0x17')](function(_0x331a9e){logger[_0x8895('0x12')]('ShowMailAccount',_0x331a9e[_0x8895('0x14')],_0x5d2f33);_0x40ba14(_0x3f055a[_0x8895('0x12')](0x1f4,_0x331a9e[_0x8895('0x14')]));});});};exports[_0x8895('0x28')]=function(_0x1d9e26){var _0x534876=this;return new Promise(function(_0x4a7e22,_0x174be1){var _0x5ebfc4={'body':_0x1d9e26[_0x8895('0x29')],'channel':_0x8895('0x2a')};var _0x526d90=_[_0x8895('0x2b')](_['keys'](db[_0x8895('0x2c')]['rawAttributes']),['createdAt','updatedAt','CompanyId','ListId']);var _0x47cf10=![];if(_0x1d9e26[_0x8895('0x29')]['id']){delete _0x1d9e26[_0x8895('0x29')]['id'];}if(_['isNil'](_0x1d9e26['body'][_0x8895('0x2d')])){return _0x174be1(_0x534876[_0x8895('0x12')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x8895('0x2e')](_0x1d9e26[_0x8895('0x29')][_0x8895('0x29')])||_0x1d9e26[_0x8895('0x29')][_0x8895('0x29')]===''){return _0x174be1(_0x534876['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x1d9e26[_0x8895('0x29')]['mapKey'])){return _0x174be1(_0x534876[_0x8895('0x12')](0x1f4,_0x8895('0x2f')+_0x526d90));}if(!_[_0x8895('0x30')](_0x526d90,_0x1d9e26[_0x8895('0x29')]['mapKey'])){return _0x174be1(_0x534876[_0x8895('0x12')](0x1f4,_0x8895('0x31')+_0x526d90));}var _0x3413cd={};_0x3413cd[_0x1d9e26[_0x8895('0x29')][_0x8895('0x32')]]=_0x1d9e26[_0x8895('0x29')][_0x8895('0x2d')];return db[_0x8895('0x23')]['find']({'where':{'id':_0x1d9e26[_0x8895('0x33')]['id']},'include':[{'model':db[_0x8895('0x34')],'as':'List','include':[{'model':db[_0x8895('0x2c')],'as':'Contacts','where':_0x3413cd,'limit':0x1,'order':[['updatedAt',_0x8895('0x35')]]}]},{'model':db[_0x8895('0x36')],'as':_0x8895('0x37')},{'model':db['MailServerOut'],'as':_0x8895('0x38'),'include':[{'model':db['CloudProvider'],'as':_0x8895('0x39')}]}]})[_0x8895('0xc')](function(_0xb3ecd6){if(_0xb3ecd6&&_0xb3ecd6[_0x8895('0x3a')]){var _0x2f3bf1=_0xb3ecd6[_0x8895('0x3b')]({'plain':!![]});_0x5ebfc4[_0x8895('0x33')]=_['omit'](_0x2f3bf1,['Applications',_0x8895('0x3a')]);_0x5ebfc4[_0x8895('0x33')]['smtpOptions']=_0xb3ecd6[_0x8895('0x27')]();_0x5ebfc4['applications']=_0x2f3bf1['Applications'];_0x5ebfc4[_0x8895('0x3c')]=_0x2f3bf1['List'];_0x5ebfc4[_0x8895('0x3d')]=_[_0x8895('0x3e')](_0x5ebfc4[_0x8895('0x3d')],[_0x8895('0x3f')],[_0x8895('0x40')]);if(_0x5ebfc4[_0x8895('0x33')]&&_0x5ebfc4[_0x8895('0x33')][_0x8895('0x41')]){_0x5ebfc4['applications'][_0x8895('0x42')]({'id':0x0,'priority':_0x5ebfc4[_0x8895('0x3d')][_0x8895('0x43')]+0x1,'app':'close','appdata':_0x8895('0x41'),'interval':_0x8895('0x44')});}if(_0x5ebfc4[_0x8895('0x33')][_0x8895('0x37')]){delete _0x5ebfc4[_0x8895('0x33')][_0x8895('0x37')];}if(_0x5ebfc4[_0x8895('0x33')][_0x8895('0x3a')]){delete _0x5ebfc4[_0x8895('0x33')][_0x8895('0x3a')];}if(_0x2f3bf1['List'][_0x8895('0x45')][_0x8895('0x43')]){return _0x2f3bf1[_0x8895('0x3a')][_0x8895('0x45')][0x0];}var _0x3c8a97=_['defaults'](_0x1d9e26[_0x8895('0x29')],{'firstName':_0x1d9e26[_0x8895('0x29')][_0x8895('0x2d')],'ListId':_0x2f3bf1[_0x8895('0x46')]});_0x3c8a97[_0x1d9e26[_0x8895('0x29')]['mapKey']]=_0x1d9e26[_0x8895('0x29')][_0x8895('0x2d')];return db[_0x8895('0x2c')]['create'](_0x3c8a97);}else{throw new Error(_0x8895('0x47'));}})[_0x8895('0xc')](function(_0x2c777b){_0x5ebfc4['contact']=_0x2c777b;if(_0x2c777b){if(!_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')]['messageId']){_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')]['messageId']=rs[_0x8895('0x48')]()+'\x20'+_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x2d')];}var _0x545f13={'ContactId':_0x2c777b['id'],'MailAccountId':_0x1d9e26['account']['id'],'inReplyTo':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x49')],'to':_0x1d9e26['body'][_0x8895('0x14')][_0x8895('0x2d')],'cc':_0x1d9e26['body'][_0x8895('0x14')]['cc'],'subject':_0x1d9e26['body'][_0x8895('0x14')][_0x8895('0x4a')],'attach':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x4b')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x8895('0x4c')][_0x8895('0x24')]({'where':{'closed':![],'MailAccountId':_0x1d9e26['account']['id']},'include':[{'model':db[_0x8895('0x4d')],'as':_0x8895('0x4e'),'attributes':[_0x8895('0x49')],'where':{'messageId':_0x1d9e26[_0x8895('0x29')]['message'][_0x8895('0x4f')]}}]})[_0x8895('0xc')](function(_0x1b1bc0){if(_0x1b1bc0){return[_0x1b1bc0,![]];}return db[_0x8895('0x4c')][_0x8895('0x50')](_0x545f13)[_0x8895('0xc')](function(_0x261d4b){return[_0x261d4b,!![]];});});}else{throw new Error(_0x8895('0x51'));}})[_0x8895('0x52')](function(_0x21c7bb,_0xb903d8){if(_0x21c7bb){_0x47cf10=_0xb903d8;if(!_0xb903d8){return _0x21c7bb[_0x8895('0x53')]({'inReplyTo':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x49')],'to':_0x1d9e26['body']['message']['from'],'cc':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')]['cc'],'subject':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x4a')],'attach':_0x21c7bb['attach']?_0x21c7bb[_0x8895('0x4b')]:_0x1d9e26[_0x8895('0x29')]['message'][_0x8895('0x4b')],'substatus':null,'substatusAt':moment()[_0x8895('0x54')](_0x8895('0x55')),'lastMsgAt':moment()[_0x8895('0x54')](_0x8895('0x55')),'lastMsgDirection':'in'});}else{return _0x21c7bb;}}})['then'](function(_0x6440ea){_0x5ebfc4[_0x8895('0x56')]=_0x6440ea[_0x8895('0x3b')]({'plain':!![]});_0x5ebfc4[_0x8895('0x56')][_0x8895('0x57')]=_0x47cf10;return db[_0x8895('0x4d')][_0x8895('0x50')]({'body':_0x1d9e26['body'][_0x8895('0x29')],'MailAccountId':_0x1d9e26[_0x8895('0x33')]['id'],'MailInteractionId':_0x6440ea['id'],'direction':'in','ContactId':_0x5ebfc4['contact']['id'],'messageId':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x49')],'from':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')]['from'],'to':_0x1d9e26[_0x8895('0x29')]['message']['to'],'cc':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')]['cc'],'subject':_0x1d9e26['body'][_0x8895('0x14')][_0x8895('0x4a')],'attach':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')]['attach'],'Attachments':_0x1d9e26[_0x8895('0x29')]['message']['attachments'],'originTo':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x58')],'originCc':_0x1d9e26['body'][_0x8895('0x14')]['originCc'],'bcc':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')][_0x8895('0x59')],'ChatWebsiteId':_0x1d9e26[_0x8895('0x29')][_0x8895('0x14')]['ChatWebsiteId']||null,'originChannel':_0x1d9e26['body'][_0x8895('0x14')]['originChannel']||_0x8895('0x5a'),'ChatOfflineMessageId':_0x1d9e26[_0x8895('0x29')]['message'][_0x8895('0x5b')]||null},{'include':[{'model':db[_0x8895('0x5c')],'as':_0x8895('0x5d')}]});})[_0x8895('0xc')](function(_0x166e9a){_0x5ebfc4['message']=_0x166e9a;if(!_0x5ebfc4[_0x8895('0x56')]['UserId']){return;}return db['User'][_0x8895('0x24')]({'attributes':['id','name'],'where':{'id':_0x5ebfc4[_0x8895('0x56')][_0x8895('0x5e')]}});})[_0x8895('0xc')](function(_0x39f5e5){if(_0x39f5e5){_0x5ebfc4['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x39f5e5[_0x8895('0x5f')]+','+(_0x5ebfc4[_0x8895('0x33')][_0x8895('0x60')]||0xa),'interval':_0x8895('0x44')});}if(!_0x5ebfc4[_0x8895('0x56')][_0x8895('0x61')]){return;}return db['MailQueue'][_0x8895('0x24')]({'attributes':['id',_0x8895('0x5f')],'where':{'id':_0x5ebfc4[_0x8895('0x56')]['queueId']}});})[_0x8895('0xc')](function(_0x565bb8){if(_0x565bb8){_0x5ebfc4[_0x8895('0x3d')]['unshift']({'id':0x0,'priority':0x1,'app':_0x8895('0x62'),'appdata':_0x565bb8[_0x8895('0x5f')]+','+(_0x5ebfc4['account'][_0x8895('0x63')]||0x12c),'interval':_0x8895('0x44')});}return respondWithRpcPromise('Start',_0x8895('0x64'),_0x5ebfc4);})[_0x8895('0xc')](function(_0x2af98f){_0x4a7e22(_0x2af98f);})[_0x8895('0x17')](function(_0x214730){_0x174be1(_0x534876[_0x8895('0x12')](0x1f4,_0x214730[_0x8895('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 3d09226..34c5083 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 _0x6ca1=['register','length','mailAccount:','./mailAccount.events','save','remove','update','emit','removeListener'];(function(_0x1fda37,_0x35b945){var _0x123c3c=function(_0x257e8e){while(--_0x257e8e){_0x1fda37['push'](_0x1fda37['shift']());}};_0x123c3c(++_0x35b945);}(_0x6ca1,0x150));var _0x16ca=function(_0x139e52,_0x4e7433){_0x139e52=_0x139e52-0x0;var _0x860a5e=_0x6ca1[_0x139e52];return _0x860a5e;};'use strict';var MailAccountEvents=require(_0x16ca('0x0'));var events=[_0x16ca('0x1'),_0x16ca('0x2'),_0x16ca('0x3')];function createListener(_0x3d731d,_0x25a3e9){return function(_0x5a7b08){_0x25a3e9[_0x16ca('0x4')](_0x3d731d,_0x5a7b08);};}function removeListener(_0x52b413,_0x33fb6d){return function(){MailAccountEvents[_0x16ca('0x5')](_0x52b413,_0x33fb6d);};}exports[_0x16ca('0x6')]=function(_0x58ed76){for(var _0x3331b1=0x0,_0x28adaf=events[_0x16ca('0x7')];_0x3331b1<_0x28adaf;_0x3331b1++){var _0x49ca6f=events[_0x3331b1];var _0xb1407f=createListener(_0x16ca('0x8')+_0x49ca6f,_0x58ed76);MailAccountEvents['on'](_0x49ca6f,_0xb1407f);}}; \ No newline at end of file +var _0xa849=['register','mailAccount:','./mailAccount.events','save','remove','emit','removeListener'];(function(_0x107eae,_0x1fe7bf){var _0x4851f5=function(_0x3840b3){while(--_0x3840b3){_0x107eae['push'](_0x107eae['shift']());}};_0x4851f5(++_0x1fe7bf);}(_0xa849,0x175));var _0x9a84=function(_0x22a95e,_0x535e9d){_0x22a95e=_0x22a95e-0x0;var _0x271f14=_0xa849[_0x22a95e];return _0x271f14;};'use strict';var MailAccountEvents=require(_0x9a84('0x0'));var events=[_0x9a84('0x1'),_0x9a84('0x2'),'update'];function createListener(_0x10b62e,_0x413198){return function(_0x538ea3){_0x413198[_0x9a84('0x3')](_0x10b62e,_0x538ea3);};}function removeListener(_0x43ebb8,_0x229601){return function(){MailAccountEvents[_0x9a84('0x4')](_0x43ebb8,_0x229601);};}exports[_0x9a84('0x5')]=function(_0x2ba3b2){for(var _0x15bea3=0x0,_0x2f5685=events['length'];_0x15bea3<_0x2f5685;_0x15bea3++){var _0x305fdb=events[_0x15bea3];var _0x9e4193=createListener(_0x9a84('0x6')+_0x305fdb,_0x2ba3b2);MailAccountEvents['on'](_0x305fdb,_0x9e4193);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 0baeac5..f164ef7 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 _0x89ca=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller','isAuthenticated','show','put','/:id','update','delete','destroy','exports','util'];(function(_0x48b8fd,_0x53695d){var _0x52c16e=function(_0x57e03a){while(--_0x57e03a){_0x48b8fd['push'](_0x48b8fd['shift']());}};_0x52c16e(++_0x53695d);}(_0x89ca,0x1cf));var _0xa89c=function(_0x48b848,_0x3137f3){_0x48b848=_0x48b848-0x0;var _0x44a96b=_0x89ca[_0x48b848];return _0x44a96b;};'use strict';var multer=require('multer');var util=require(_0xa89c('0x0'));var path=require(_0xa89c('0x1'));var timeout=require(_0xa89c('0x2'));var express=require(_0xa89c('0x3'));var router=express['Router']();var fs_extra=require(_0xa89c('0x4'));var auth=require(_0xa89c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa89c('0x6'));var controller=require(_0xa89c('0x7'));router['get']('/:id',auth[_0xa89c('0x8')](),controller[_0xa89c('0x9')]);router[_0xa89c('0xa')](_0xa89c('0xb'),auth[_0xa89c('0x8')](),controller[_0xa89c('0xc')]);router[_0xa89c('0xd')](_0xa89c('0xb'),auth[_0xa89c('0x8')](),controller[_0xa89c('0xe')]);module[_0xa89c('0xf')]=router; \ No newline at end of file +var _0x332b=['put','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show'];(function(_0x373a71,_0x2fafb4){var _0x2990fc=function(_0xee820a){while(--_0xee820a){_0x373a71['push'](_0x373a71['shift']());}};_0x2990fc(++_0x2fafb4);}(_0x332b,0x111));var _0xb332=function(_0xbc1061,_0x4df02e){_0xbc1061=_0xbc1061-0x0;var _0x2e5a0b=_0x332b[_0xbc1061];return _0x2e5a0b;};'use strict';var multer=require(_0xb332('0x0'));var util=require('util');var path=require(_0xb332('0x1'));var timeout=require('connect-timeout');var express=require(_0xb332('0x2'));var router=express[_0xb332('0x3')]();var fs_extra=require(_0xb332('0x4'));var auth=require(_0xb332('0x5'));var interaction=require(_0xb332('0x6'));var config=require(_0xb332('0x7'));var controller=require('./mailApplication.controller');router[_0xb332('0x8')](_0xb332('0x9'),auth[_0xb332('0xa')](),controller[_0xb332('0xb')]);router[_0xb332('0xc')](_0xb332('0x9'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xb332('0xa')](),controller[_0xb332('0xd')]);module[_0xb332('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 0f91423..6808bcb 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 _0xf3b7=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x2c5db3,_0x1c05bf){var _0x47b828=function(_0xa745d0){while(--_0xa745d0){_0x2c5db3['push'](_0x2c5db3['shift']());}};_0x47b828(++_0x1c05bf);}(_0xf3b7,0x96));var _0x7f3b=function(_0x1d1c1b,_0x40fea1){_0x1d1c1b=_0x1d1c1b-0x0;var _0x44b577=_0xf3b7[_0x1d1c1b];return _0x44b577;};'use strict';var Sequelize=require(_0x7f3b('0x0'));module[_0x7f3b('0x1')]={'priority':{'type':Sequelize[_0x7f3b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7f3b('0x3')],'allowNull':![],'defaultValue':_0x7f3b('0x4')},'appdata':{'type':Sequelize[_0x7f3b('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7f3b('0x3')],'defaultValue':_0x7f3b('0x6')}}; \ No newline at end of file +var _0x9ccb=['exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x9ccb,0xf5));var _0xb9cc=function(_0x49e734,_0xc04f4f){_0x49e734=_0x49e734-0x0;var _0x2a2d42=_0x9ccb[_0x49e734];return _0x2a2d42;};'use strict';var Sequelize=require('sequelize');module[_0xb9cc('0x0')]={'priority':{'type':Sequelize[_0xb9cc('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb9cc('0x2')],'allowNull':![],'defaultValue':_0xb9cc('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xb9cc('0x2')]},'interval':{'type':Sequelize[_0xb9cc('0x2')],'defaultValue':_0xb9cc('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 76b9d96..ad3aa88 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 _0xa9e0=['includeAll','merge','options','find','catch','body','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','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x5844ee,_0x5ba6b8){var _0x512e77=function(_0x47743c){while(--_0x47743c){_0x5844ee['push'](_0x5844ee['shift']());}};_0x512e77(++_0x5ba6b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file +var _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','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','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x564cc6,_0x4cec54){var _0x2679f2=function(_0x1ce7e5){while(--_0x1ce7e5){_0x564cc6['push'](_0x564cc6['shift']());}};_0x2679f2(++_0x4cec54);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3b0912,_0x39d739){_0x3b0912=_0x3b0912-0x0;var _0xa8f339=_0xcb91[_0x3b0912];return _0xa8f339;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}exports[_0x1cb9('0x28')]=function(_0xb644b3,_0x41e5c2){var _0x9de64b={'raw':!![],'where':{'id':_0xb644b3[_0x1cb9('0x29')]['id']}},_0x48888d={};_0x48888d['model']=_[_0x1cb9('0x2a')](db['MailApplication'][_0x1cb9('0x2b')]);_0x48888d[_0x1cb9('0x2c')]=_[_0x1cb9('0x2a')](_0xb644b3[_0x1cb9('0x2c')]);_0x48888d['filters']=_[_0x1cb9('0x2d')](_0x48888d['model'],_0x48888d[_0x1cb9('0x2c')]);_0x9de64b[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x48888d['model'],qs[_0x1cb9('0x2f')](_0xb644b3['query'][_0x1cb9('0x2f')]));_0x9de64b['attributes']=_0x9de64b[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x9de64b[_0x1cb9('0x2e')]:_0x48888d[_0x1cb9('0x31')];if(_0xb644b3['query'][_0x1cb9('0x32')]){_0x9de64b[_0x1cb9('0x33')]=[{'all':!![]}];}_0x9de64b=_[_0x1cb9('0x34')]({},_0x9de64b,_0xb644b3[_0x1cb9('0x35')]);return db[_0x1cb9('0x36')][_0x1cb9('0x37')](_0x9de64b)[_0x1cb9('0x22')](handleEntityNotFound(_0x41e5c2,null))[_0x1cb9('0x22')](respondWithResult(_0x41e5c2,null))[_0x1cb9('0x38')](handleError(_0x41e5c2,null));};exports[_0x1cb9('0x21')]=function(_0x294eec,_0x26b950){if(_0x294eec[_0x1cb9('0x39')]['id']){delete _0x294eec['body']['id'];}return db['MailApplication'][_0x1cb9('0x37')]({'where':{'id':_0x294eec[_0x1cb9('0x29')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x26b950,null))[_0x1cb9('0x22')](saveUpdates(_0x294eec[_0x1cb9('0x39')],null))[_0x1cb9('0x22')](respondWithResult(_0x26b950,null))[_0x1cb9('0x38')](handleError(_0x26b950,null));};exports[_0x1cb9('0x23')]=function(_0x4d3e39,_0x2aa59b){return db[_0x1cb9('0x36')][_0x1cb9('0x37')]({'where':{'id':_0x4d3e39['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2aa59b,null))['then'](removeEntity(_0x2aa59b,null))[_0x1cb9('0x38')](handleError(_0x2aa59b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index b84315e..171ef1c 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 _0x7406=['./mailApplication.attributes','exports','define','mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x36360f,_0x2f5789){var _0x5950a8=function(_0x44a908){while(--_0x44a908){_0x36360f['push'](_0x36360f['shift']());}};_0x5950a8(++_0x2f5789);}(_0x7406,0xc9));var _0x6740=function(_0x28fcdc,_0x17e930){_0x28fcdc=_0x28fcdc-0x0;var _0x80bd4c=_0x7406[_0x28fcdc];return _0x80bd4c;};'use strict';var _=require(_0x6740('0x0'));var util=require(_0x6740('0x1'));var logger=require(_0x6740('0x2'))(_0x6740('0x3'));var moment=require(_0x6740('0x4'));var BPromise=require(_0x6740('0x5'));var rp=require(_0x6740('0x6'));var fs=require('fs');var path=require(_0x6740('0x7'));var rimraf=require(_0x6740('0x8'));var config=require('../../config/environment');var attributes=require(_0x6740('0x9'));module[_0x6740('0xa')]=function(_0x423b58,_0x2ce027){return _0x423b58[_0x6740('0xb')]('MailApplication',attributes,{'tableName':_0x6740('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6740('0xd')});}; \ No newline at end of file +var _0x7d42=['path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x303984,_0x2bacfc){var _0x4a07fe=function(_0x1fc900){while(--_0x1fc900){_0x303984['push'](_0x303984['shift']());}};_0x4a07fe(++_0x2bacfc);}(_0x7d42,0x129));var _0x27d4=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x7d42[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x27d4('0x0'));var util=require(_0x27d4('0x1'));var logger=require(_0x27d4('0x2'))(_0x27d4('0x3'));var moment=require(_0x27d4('0x4'));var BPromise=require(_0x27d4('0x5'));var rp=require(_0x27d4('0x6'));var fs=require('fs');var path=require(_0x27d4('0x7'));var rimraf=require(_0x27d4('0x8'));var config=require(_0x27d4('0x9'));var attributes=require(_0x27d4('0xa'));module[_0x27d4('0xb')]=function(_0x566ec7,_0x3407fb){return _0x566ec7[_0x27d4('0xc')](_0x27d4('0xd'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x27d4('0xe'),'collate':_0x27d4('0xf')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index dabea12..81b6a8a 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 _0x33a5=['request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4602de,_0x1ee766){var _0x4c6ff9=function(_0x31570b){while(--_0x31570b){_0x4602de['push'](_0x4602de['shift']());}};_0x4c6ff9(++_0x1ee766);}(_0x33a5,0x125));var _0x533a=function(_0x18cf2d,_0x303fe){_0x18cf2d=_0x18cf2d-0x0;var _0x4767d5=_0x33a5[_0x18cf2d];return _0x4767d5;};'use strict';var _=require(_0x533a('0x0'));var util=require(_0x533a('0x1'));var moment=require(_0x533a('0x2'));var BPromise=require(_0x533a('0x3'));var rs=require(_0x533a('0x4'));var fs=require('fs');var Redis=require(_0x533a('0x5'));var db=require(_0x533a('0x6'))['db'];var utils=require(_0x533a('0x7'));var logger=require(_0x533a('0x8'))(_0x533a('0x9'));var config=require(_0x533a('0xa'));var jayson=require(_0x533a('0xb'));var client=jayson[_0x533a('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd0159b,_0x159a80,_0x3afe7f){return new BPromise(function(_0x4d3c5d,_0x545b92){return client[_0x533a('0xd')](_0xd0159b,_0x3afe7f)[_0x533a('0xe')](function(_0x3a082e){logger['info'](_0x533a('0xf'),_0x159a80,_0x533a('0x10'));logger[_0x533a('0x11')](_0x533a('0x12'),_0x159a80,_0x533a('0x10'),JSON[_0x533a('0x13')](_0x3a082e));if(_0x3a082e[_0x533a('0x14')]){if(_0x3a082e[_0x533a('0x14')][_0x533a('0x15')]===0x1f4){logger[_0x533a('0x14')]('MailApplication,\x20%s,\x20%s',_0x159a80,_0x3a082e[_0x533a('0x14')]['message']);return _0x545b92(_0x3a082e[_0x533a('0x14')]['message']);}logger[_0x533a('0x14')](_0x533a('0xf'),_0x159a80,_0x3a082e[_0x533a('0x14')][_0x533a('0x16')]);return _0x4d3c5d(_0x3a082e['error']['message']);}else{logger[_0x533a('0x17')](_0x533a('0xf'),_0x159a80,'request\x20sent');_0x4d3c5d(_0x3a082e[_0x533a('0x18')][_0x533a('0x16')]);}})[_0x533a('0x19')](function(_0x59636a){logger[_0x533a('0x14')](_0x533a('0xf'),_0x159a80,_0x59636a);_0x545b92(_0x59636a);});});}exports[_0x533a('0x1a')]=function(_0x2cd24d){var _0x508031=this;return new Promise(function(_0x2576ed,_0x24e6e0){return db[_0x533a('0x1b')][_0x533a('0x1c')](_0x2cd24d[_0x533a('0x1d')],{'raw':_0x2cd24d['options']?_0x2cd24d[_0x533a('0x1e')][_0x533a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cd24d[_0x533a('0x1e')]?_0x2cd24d[_0x533a('0x1e')][_0x533a('0x20')]||null:null,'attributes':_0x2cd24d[_0x533a('0x1e')]?_0x2cd24d[_0x533a('0x1e')]['attributes']||null:null,'limit':_0x2cd24d[_0x533a('0x1e')]?_0x2cd24d[_0x533a('0x1e')][_0x533a('0x21')]||null:null})[_0x533a('0xe')](function(_0xa1db7b){logger[_0x533a('0x17')](_0x533a('0x1a'),_0x2cd24d);logger[_0x533a('0x11')]('UpdateMailApplication',_0x2cd24d,JSON[_0x533a('0x13')](_0xa1db7b));_0x2576ed(_0xa1db7b);})[_0x533a('0x19')](function(_0x58bc81){logger['error'](_0x533a('0x1a'),_0x58bc81[_0x533a('0x16')],_0x2cd24d);_0x24e6e0(_0x508031[_0x533a('0x14')](0x1f4,_0x58bc81[_0x533a('0x16')]));});});}; \ No newline at end of file +var _0xc0b1=['request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateMailApplication','options','raw','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','MailApplication,\x20%s,\x20%s'];(function(_0x253113,_0x278426){var _0x578c99=function(_0x2d73dd){while(--_0x2d73dd){_0x253113['push'](_0x253113['shift']());}};_0x578c99(++_0x278426);}(_0xc0b1,0x1b3));var _0x1c0b=function(_0x3e3f27,_0x2c2ecf){_0x3e3f27=_0x3e3f27-0x0;var _0x15c868=_0xc0b1[_0x3e3f27];return _0x15c868;};'use strict';var _=require('lodash');var util=require(_0x1c0b('0x0'));var moment=require(_0x1c0b('0x1'));var BPromise=require(_0x1c0b('0x2'));var rs=require(_0x1c0b('0x3'));var fs=require('fs');var Redis=require(_0x1c0b('0x4'));var db=require(_0x1c0b('0x5'))['db'];var utils=require(_0x1c0b('0x6'));var logger=require('../../config/logger')(_0x1c0b('0x7'));var config=require(_0x1c0b('0x8'));var jayson=require(_0x1c0b('0x9'));var client=jayson[_0x1c0b('0xa')][_0x1c0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48debe,_0x48e0ff,_0x1208a5){return new BPromise(function(_0x547e49,_0x4072be){return client[_0x1c0b('0xc')](_0x48debe,_0x1208a5)[_0x1c0b('0xd')](function(_0x725e6){logger['info'](_0x1c0b('0xe'),_0x48e0ff,_0x1c0b('0xf'));logger[_0x1c0b('0x10')](_0x1c0b('0x11'),_0x48e0ff,_0x1c0b('0xf'),JSON[_0x1c0b('0x12')](_0x725e6));if(_0x725e6['error']){if(_0x725e6['error']['code']===0x1f4){logger[_0x1c0b('0x13')](_0x1c0b('0xe'),_0x48e0ff,_0x725e6['error'][_0x1c0b('0x14')]);return _0x4072be(_0x725e6['error'][_0x1c0b('0x14')]);}logger[_0x1c0b('0x13')](_0x1c0b('0xe'),_0x48e0ff,_0x725e6[_0x1c0b('0x13')][_0x1c0b('0x14')]);return _0x547e49(_0x725e6[_0x1c0b('0x13')][_0x1c0b('0x14')]);}else{logger[_0x1c0b('0x15')](_0x1c0b('0xe'),_0x48e0ff,'request\x20sent');_0x547e49(_0x725e6[_0x1c0b('0x16')][_0x1c0b('0x14')]);}})[_0x1c0b('0x17')](function(_0x22353e){logger[_0x1c0b('0x13')]('MailApplication,\x20%s,\x20%s',_0x48e0ff,_0x22353e);_0x4072be(_0x22353e);});});}exports[_0x1c0b('0x18')]=function(_0x4245d3){var _0x3374d9=this;return new Promise(function(_0x3849dc,_0x3f831a){return db['MailApplication']['update'](_0x4245d3['body'],{'raw':_0x4245d3['options']?_0x4245d3[_0x1c0b('0x19')][_0x1c0b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4245d3[_0x1c0b('0x19')]?_0x4245d3['options'][_0x1c0b('0x1b')]||null:null,'attributes':_0x4245d3[_0x1c0b('0x19')]?_0x4245d3['options'][_0x1c0b('0x1c')]||null:null,'limit':_0x4245d3[_0x1c0b('0x19')]?_0x4245d3[_0x1c0b('0x19')][_0x1c0b('0x1d')]||null:null})['then'](function(_0x43be13){logger[_0x1c0b('0x15')](_0x1c0b('0x18'),_0x4245d3);logger['debug'](_0x1c0b('0x18'),_0x4245d3,JSON['stringify'](_0x43be13));_0x3849dc(_0x43be13);})['catch'](function(_0x384df5){logger['error'](_0x1c0b('0x18'),_0x384df5[_0x1c0b('0x14')],_0x4245d3);_0x3f831a(_0x3374d9[_0x1c0b('0x13')](0x1f4,_0x384df5[_0x1c0b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 46de756..69e4460 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 _0xd8da=['/:id','tracked','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','get','show','/:id/messages','/:id/download','post','create','/:id/tags','mail'];(function(_0x2b434e,_0x12102e){var _0x39aaa9=function(_0x1f3abf){while(--_0x1f3abf){_0x2b434e['push'](_0x2b434e['shift']());}};_0x39aaa9(++_0x12102e);}(_0xd8da,0x168));var _0xad8d=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xd8da[_0x122096];return _0x3d1966;};'use strict';var express=require(_0xad8d('0x0'));var router=express[_0xad8d('0x1')]();var auth=require(_0xad8d('0x2'));var interaction=require(_0xad8d('0x3'));var controller=require(_0xad8d('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xad8d('0x5')](),controller['describe']);router[_0xad8d('0x6')]('/:id',auth[_0xad8d('0x5')](),controller[_0xad8d('0x7')]);router[_0xad8d('0x6')](_0xad8d('0x8'),auth[_0xad8d('0x5')](),controller['getMessages']);router['get'](_0xad8d('0x9'),auth[_0xad8d('0x5')](),controller['download']);router[_0xad8d('0xa')]('/',auth['isAuthenticated'](),controller[_0xad8d('0xb')]);router['post'](_0xad8d('0x8'),auth['isAuthenticated'](),controller['addMessage']);router['post'](_0xad8d('0xc'),auth[_0xad8d('0x5')](),interaction['tracked'](_0xad8d('0xd'),'mailinteraction:addtags'),controller['addTags']);router['put'](_0xad8d('0xe'),auth[_0xad8d('0x5')](),interaction[_0xad8d('0xf')]('mail',_0xad8d('0x10')),controller[_0xad8d('0x11')]);router[_0xad8d('0x12')](_0xad8d('0xe'),auth['isAuthenticated'](),interaction['tracked'](_0xad8d('0xd'),_0xad8d('0x13')),controller['destroy']);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0xad8d('0x14')]);module[_0xad8d('0x15')]=router; \ No newline at end of file +var _0xd187=['update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','addMessage','post','/:id/tags','tracked','mail','addTags'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xd187,0x8d));var _0x7d18=function(_0x90e575,_0x48c2ec){_0x90e575=_0x90e575-0x0;var _0x1aae60=_0xd187[_0x90e575];return _0x1aae60;};'use strict';var express=require(_0x7d18('0x0'));var router=express['Router']();var auth=require(_0x7d18('0x1'));var interaction=require(_0x7d18('0x2'));var controller=require(_0x7d18('0x3'));router[_0x7d18('0x4')]('/',auth[_0x7d18('0x5')](),controller[_0x7d18('0x6')]);router['get'](_0x7d18('0x7'),auth[_0x7d18('0x5')](),controller[_0x7d18('0x8')]);router[_0x7d18('0x4')](_0x7d18('0x9'),auth[_0x7d18('0x5')](),controller[_0x7d18('0xa')]);router[_0x7d18('0x4')](_0x7d18('0xb'),auth['isAuthenticated'](),controller[_0x7d18('0xc')]);router[_0x7d18('0x4')](_0x7d18('0xd'),auth[_0x7d18('0x5')](),controller[_0x7d18('0xe')]);router['post']('/',auth[_0x7d18('0x5')](),controller['create']);router['post'](_0x7d18('0xb'),auth[_0x7d18('0x5')](),controller[_0x7d18('0xf')]);router[_0x7d18('0x10')](_0x7d18('0x11'),auth[_0x7d18('0x5')](),interaction[_0x7d18('0x12')](_0x7d18('0x13'),'mailinteraction:addtags'),controller[_0x7d18('0x14')]);router['put'](_0x7d18('0x9'),auth[_0x7d18('0x5')](),interaction[_0x7d18('0x12')](_0x7d18('0x13'),'mailinteraction:update'),controller[_0x7d18('0x15')]);router[_0x7d18('0x16')](_0x7d18('0x9'),auth[_0x7d18('0x5')](),interaction['tracked'](_0x7d18('0x13'),_0x7d18('0x17')),controller[_0x7d18('0x18')]);router[_0x7d18('0x16')](_0x7d18('0x11'),auth['isAuthenticated'](),controller[_0x7d18('0x19')]);module[_0x7d18('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 4337759..72ba6e0 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 _0x1683=['TEXT','long','ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x152584,_0x21a52f){var _0x3afadc=function(_0x5e797e){while(--_0x5e797e){_0x152584['push'](_0x152584['shift']());}};_0x3afadc(++_0x21a52f);}(_0x1683,0x136));var _0x3168=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x1683[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x3168('0x0'));var iconv=require('iconv');module[_0x3168('0x1')]={'closed':{'type':Sequelize[_0x3168('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3168('0x3')]},'disposition':{'type':Sequelize[_0x3168('0x4')]},'secondDisposition':{'type':Sequelize[_0x3168('0x4')]},'thirdDisposition':{'type':Sequelize[_0x3168('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x3168('0x4')](0x1fe)},'to':{'type':Sequelize[_0x3168('0x4')]},'cc':{'type':Sequelize[_0x3168('0x5')](_0x3168('0x6'))},'subject':{'type':Sequelize[_0x3168('0x5')]()},'attach':{'type':Sequelize[_0x3168('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x3168('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x3168('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3168('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x3168('0x7')]('in',_0x3168('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3168('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x35cf=['INTEGER','sequelize','exports','STRING','TEXT','BOOLEAN','DATE','ENUM'];(function(_0x1654da,_0x29b4f7){var _0x3220ca=function(_0x550fb7){while(--_0x550fb7){_0x1654da['push'](_0x1654da['shift']());}};_0x3220ca(++_0x29b4f7);}(_0x35cf,0xe9));var _0xf35c=function(_0x2ecb8b,_0x4d2942){_0x2ecb8b=_0x2ecb8b-0x0;var _0x4769c5=_0x35cf[_0x2ecb8b];return _0x4769c5;};'use strict';var Sequelize=require(_0xf35c('0x0'));var iconv=require('iconv');module[_0xf35c('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xf35c('0x2')]},'secondDisposition':{'type':Sequelize[_0xf35c('0x2')]},'thirdDisposition':{'type':Sequelize[_0xf35c('0x2')]},'note':{'type':Sequelize[_0xf35c('0x2')]},'inReplyTo':{'type':Sequelize[_0xf35c('0x2')](0x1fe)},'to':{'type':Sequelize[_0xf35c('0x2')]},'cc':{'type':Sequelize[_0xf35c('0x3')]('long')},'subject':{'type':Sequelize[_0xf35c('0x3')]()},'attach':{'type':Sequelize[_0xf35c('0x4')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xf35c('0x5')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xf35c('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xf35c('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf35c('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xf35c('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf35c('0x4')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xf35c('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 9e5c36c..86d5813 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 _0x09ea=['defaults','localhost','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','name','send','index','MailInteraction','rawAttributes','fieldName','key','findAll','mail','query','user','params','model','keys','intersection','attributes','fields','length','include','merge','options','find','catch','create','body','describe','MailMessage','ids','omit','getMessages','filters','hasOwnProperty','nolimit','order','sort','where','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','rows','addTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','transcript-%d-%s.zip','attachments','push','Attachment','Attachments','Messages','from','bcc','createdAt','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','type','readFileSync','build','unlinkSync','eml-format','rimraf','zip-dir','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../config/logger','api','html-entities','redis'];(function(_0x2cacc8,_0x2777b7){var _0x1d4099=function(_0x45d7f1){while(--_0x45d7f1){_0x2cacc8['push'](_0x2cacc8['shift']());}};_0x1d4099(++_0x2777b7);}(_0x09ea,0x136));var _0xa09e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x09ea[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa09e('0x0'));var rimraf=require(_0xa09e('0x1'));var zipdir=require(_0xa09e('0x2'));var moment=require('moment');var BPromise=require(_0xa09e('0x3'));var util=require(_0xa09e('0x4'));var path=require(_0xa09e('0x5'));var fs=require('fs');var _=require(_0xa09e('0x6'));var juice=require(_0xa09e('0x7'));var Redis=require(_0xa09e('0x8'));var interaction=require(_0xa09e('0x9'));var qs=require('../../components/parsers/qs');var logger=require(_0xa09e('0xa'))(_0xa09e('0xb'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xa09e('0xc'));config[_0xa09e('0xd')]=_[_0xa09e('0xe')](config[_0xa09e('0xd')],{'host':_0xa09e('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa09e('0xd')]));require(_0xa09e('0x10'))[_0xa09e('0x11')](socket);function respondWithStatusCode(_0x20279d,_0x57b3eb){_0x57b3eb=_0x57b3eb||0xcc;return function(_0x1d78fa){if(_0x1d78fa){return _0x20279d[_0xa09e('0x12')](_0x57b3eb);}return _0x20279d[_0xa09e('0x13')](_0x57b3eb)[_0xa09e('0x14')]();};}function respondWithResult(_0x8f0b38,_0x100a41){_0x100a41=_0x100a41||0xc8;return function(_0x282947){if(_0x282947){return _0x8f0b38[_0xa09e('0x13')](_0x100a41)[_0xa09e('0x15')](_0x282947);}};}function respondWithFilteredResult(_0x5cf330,_0x2a48d3){return function(_0x5b7920){if(_0x5b7920){var _0x567cf3=typeof _0x2a48d3[_0xa09e('0x16')]===_0xa09e('0x17')&&typeof _0x2a48d3[_0xa09e('0x18')]==='undefined';var _0x1d55c6=_0x5b7920[_0xa09e('0x19')];var _0x4fea70=_0x567cf3?0x0:_0x2a48d3[_0xa09e('0x16')];var _0x4ed14d=_0x567cf3?_0x5b7920[_0xa09e('0x19')]:_0x2a48d3[_0xa09e('0x16')]+_0x2a48d3[_0xa09e('0x18')];var _0x132767;if(_0x4ed14d>=_0x1d55c6){_0x4ed14d=_0x1d55c6;_0x132767=0xc8;}else{_0x132767=0xce;}_0x5cf330[_0xa09e('0x13')](_0x132767);return _0x5cf330[_0xa09e('0x1a')](_0xa09e('0x1b'),_0x4fea70+'-'+_0x4ed14d+'/'+_0x1d55c6)[_0xa09e('0x15')](_0x5b7920);}return null;};}function saveUpdates(_0x12e5dd){return function(_0x3389f3){if(_0x3389f3){return _0x3389f3[_0xa09e('0x1c')](_0x12e5dd)['then'](function(_0x22bcc8){return _0x22bcc8;});}return null;};}function removeEntity(_0x189507){return function(_0x17b8a9){if(_0x17b8a9){return _0x17b8a9[_0xa09e('0x1d')]()[_0xa09e('0x1e')](function(){_0x189507[_0xa09e('0x13')](0xcc)[_0xa09e('0x14')]();});}};}function handleEntityNotFound(_0x406df0){return function(_0x59252b){if(!_0x59252b){_0x406df0[_0xa09e('0x12')](0x194);}return _0x59252b;};}function handleError(_0x2f0d81,_0x2e26ff){_0x2e26ff=_0x2e26ff||0x1f4;return function(_0x5a3670){logger[_0xa09e('0x1f')](_0x5a3670['stack']);if(_0x5a3670[_0xa09e('0x20')]){delete _0x5a3670[_0xa09e('0x20')];}_0x2f0d81['status'](_0x2e26ff)[_0xa09e('0x21')](_0x5a3670);};}exports[_0xa09e('0x22')]=function(_0x1032eb,_0x4bbda3){var _0x44617c={};var _0x1deae0=_['map'](db[_0xa09e('0x23')][_0xa09e('0x24')],function(_0x36fef2){return{'name':_0x36fef2[_0xa09e('0x25')],'type':_0x36fef2['type'][_0xa09e('0x26')]};});_0x44617c=qs['getOptions'](_0x1deae0,_0x1032eb);return interaction[_0xa09e('0x27')](_0xa09e('0x28'),_0x1032eb[_0xa09e('0x29')],_0x1032eb[_0xa09e('0x2a')],_0x44617c,_0x1deae0)[_0xa09e('0x1e')](respondWithFilteredResult(_0x4bbda3,_0x44617c))['catch'](handleError(_0x4bbda3,null));};exports['show']=function(_0x52a1bb,_0x47295b){var _0x17d6a5={'raw':![],'where':{'id':_0x52a1bb[_0xa09e('0x2b')]['id']}},_0x32c37d={};_0x32c37d[_0xa09e('0x2c')]=_[_0xa09e('0x2d')](db[_0xa09e('0x23')][_0xa09e('0x24')]);_0x32c37d['query']=_[_0xa09e('0x2d')](_0x52a1bb[_0xa09e('0x29')]);_0x32c37d['filters']=_[_0xa09e('0x2e')](_0x32c37d[_0xa09e('0x2c')],_0x32c37d[_0xa09e('0x29')]);_0x17d6a5[_0xa09e('0x2f')]=_[_0xa09e('0x2e')](_0x32c37d[_0xa09e('0x2c')],qs[_0xa09e('0x30')](_0x52a1bb[_0xa09e('0x29')][_0xa09e('0x30')]));_0x17d6a5[_0xa09e('0x2f')]=_0x17d6a5['attributes'][_0xa09e('0x31')]?_0x17d6a5['attributes']:_0x32c37d[_0xa09e('0x2c')];if(_0x52a1bb['query']['includeAll']){_0x17d6a5[_0xa09e('0x32')]=[{'all':!![]}];}_0x17d6a5=_[_0xa09e('0x33')]({},_0x17d6a5,_0x52a1bb[_0xa09e('0x34')]);return db[_0xa09e('0x23')][_0xa09e('0x35')](_0x17d6a5)[_0xa09e('0x1e')](handleEntityNotFound(_0x47295b,null))['then'](respondWithResult(_0x47295b,null))[_0xa09e('0x36')](handleError(_0x47295b,null));};exports['create']=function(_0x825f1c,_0x25ace5){return db[_0xa09e('0x23')][_0xa09e('0x37')](_0x825f1c['body'],{})[_0xa09e('0x1e')](respondWithResult(_0x25ace5,0xc9))['catch'](handleError(_0x25ace5,null));};exports[_0xa09e('0x1c')]=function(_0x234338,_0x5701d9){if(_0x234338[_0xa09e('0x38')]['id']){delete _0x234338[_0xa09e('0x38')]['id'];}return db[_0xa09e('0x23')][_0xa09e('0x35')]({'where':{'id':_0x234338[_0xa09e('0x2b')]['id']}})[_0xa09e('0x1e')](handleEntityNotFound(_0x5701d9,null))[_0xa09e('0x1e')](saveUpdates(_0x234338['body'],null))[_0xa09e('0x1e')](respondWithResult(_0x5701d9,null))['catch'](handleError(_0x5701d9,null));};exports[_0xa09e('0x1d')]=function(_0x45a919,_0x42ff4a){return db[_0xa09e('0x23')][_0xa09e('0x35')]({'where':{'id':_0x45a919[_0xa09e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x42ff4a,null))[_0xa09e('0x1e')](removeEntity(_0x42ff4a,null))[_0xa09e('0x36')](handleError(_0x42ff4a,null));};exports['describe']=function(_0x2ba954,_0x44a789){return db['MailInteraction'][_0xa09e('0x39')]()['then'](respondWithResult(_0x44a789,null))[_0xa09e('0x36')](handleError(_0x44a789,null));};exports['addMessage']=function(_0x1e4da7,_0x45519d){return db[_0xa09e('0x3a')]['find']({'where':{'id':_0x1e4da7['params']['id']}})[_0xa09e('0x1e')](handleEntityNotFound(_0x45519d,null))[_0xa09e('0x1e')](function(_0x3a5148){if(_0x3a5148){return _0x3a5148['addMessage'](_0x1e4da7[_0xa09e('0x38')][_0xa09e('0x3b')],_[_0xa09e('0x3c')](_0x1e4da7[_0xa09e('0x38')],[_0xa09e('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x45519d,null))[_0xa09e('0x36')](handleError(_0x45519d,null));};exports[_0xa09e('0x3d')]=function(_0x13e2e7,_0x3ac052){var _0x4a4c4c={'raw':![],'where':{}};var _0x3ab5e2={};var _0x167b30={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x13e2e7[_0xa09e('0x2b')]['id']}})[_0xa09e('0x1e')](handleEntityNotFound(_0x3ac052,null))['then'](function(_0x2d4dd4){if(_0x2d4dd4){_0x3ab5e2[_0xa09e('0x2c')]=_[_0xa09e('0x2d')](db[_0xa09e('0x3a')][_0xa09e('0x24')]);_0x3ab5e2['query']=_[_0xa09e('0x2d')](_0x13e2e7[_0xa09e('0x29')]);_0x3ab5e2[_0xa09e('0x3e')]=_['intersection'](_0x3ab5e2[_0xa09e('0x2c')],_0x3ab5e2[_0xa09e('0x29')]);_0x4a4c4c[_0xa09e('0x2f')]=_[_0xa09e('0x2e')](_0x3ab5e2[_0xa09e('0x2c')],qs['fields'](_0x13e2e7['query'][_0xa09e('0x30')]));_0x4a4c4c[_0xa09e('0x2f')]=_0x4a4c4c[_0xa09e('0x2f')]['length']?_0x4a4c4c['attributes']:_0x3ab5e2[_0xa09e('0x2c')];if(!_0x13e2e7[_0xa09e('0x29')][_0xa09e('0x3f')](_0xa09e('0x40'))){_0x4a4c4c[_0xa09e('0x18')]=qs[_0xa09e('0x18')](_0x13e2e7[_0xa09e('0x29')][_0xa09e('0x18')]);_0x4a4c4c[_0xa09e('0x16')]=qs[_0xa09e('0x16')](_0x13e2e7['query']['offset']);}_0x4a4c4c[_0xa09e('0x41')]=qs[_0xa09e('0x42')](_0x13e2e7[_0xa09e('0x29')][_0xa09e('0x42')]);_0x4a4c4c['where']=qs[_0xa09e('0x3e')](_['pick'](_0x13e2e7['query'],_0x3ab5e2[_0xa09e('0x3e')]));_0x4a4c4c[_0xa09e('0x43')]['MailInteractionId']=_0x2d4dd4['id'];if(_0x13e2e7['query'][_0xa09e('0x44')]){_0x4a4c4c[_0xa09e('0x43')]=_[_0xa09e('0x33')](_0x4a4c4c[_0xa09e('0x43')],{'$or':_[_0xa09e('0x45')](_0x4a4c4c[_0xa09e('0x2f')],function(_0x59e92a){var _0x104700={};_0x104700[_0x59e92a]={'$like':'%'+_0x13e2e7[_0xa09e('0x29')][_0xa09e('0x44')]+'%'};return _0x104700;})});}if(_0x13e2e7[_0xa09e('0x29')][_0xa09e('0x46')]){var _0xba3f8c=_0x13e2e7[_0xa09e('0x29')][_0xa09e('0x46')][_0xa09e('0x47')](',');var _0x1f6158={};_0x1f6158[_0xba3f8c[0x0]]={'$gte':moment(_0xba3f8c[0x1])[_0xa09e('0x48')](_0xa09e('0x49'))};_0x4a4c4c[_0xa09e('0x43')]=_['merge'](_0x4a4c4c[_0xa09e('0x43')],_0x1f6158);}_0x4a4c4c=_[_0xa09e('0x33')]({},_0x4a4c4c,_0x13e2e7[_0xa09e('0x34')]);return db[_0xa09e('0x3a')]['count']({'where':_0x4a4c4c[_0xa09e('0x43')]})[_0xa09e('0x1e')](function(_0x5c0d04){_0x167b30[_0xa09e('0x19')]=_0x5c0d04;if(_0x13e2e7['query']['includeAll']){_0x4a4c4c[_0xa09e('0x32')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x4a4c4c);})[_0xa09e('0x1e')](function(_0x3f0c23){if(_0x13e2e7[_0xa09e('0x29')][_0xa09e('0x4a')]==='true'){for(var _0x3768b9=0x0;_0x3768b9<_0x3f0c23['length'];_0x3768b9++){_0x3f0c23[_0x3768b9][_0xa09e('0x38')]=juice(_0x3f0c23[_0x3768b9]['body']);}}_0x167b30[_0xa09e('0x4b')]=_0x3f0c23;return _0x167b30;});}})[_0xa09e('0x1e')](respondWithFilteredResult(_0x3ac052,_0x4a4c4c))['catch'](handleError(_0x3ac052,null));};exports[_0xa09e('0x4c')]=function(_0x4f5ec8,_0x3458a0){return db[_0xa09e('0x23')]['find']({'where':{'id':_0x4f5ec8[_0xa09e('0x2b')]['id']}})[_0xa09e('0x1e')](handleEntityNotFound(_0x3458a0,null))[_0xa09e('0x1e')](function(_0x46dc2d){if(_0x46dc2d){return _0x46dc2d['setTags'](_0x4f5ec8['body'][_0xa09e('0x3b')],_[_0xa09e('0x3c')](_0x4f5ec8['body'],[_0xa09e('0x3b'),'id'])||{})[_0xa09e('0x4d')](function(){return db[_0xa09e('0x4e')][_0xa09e('0x27')]({'attributes':['id',_0xa09e('0x20'),_0xa09e('0x4f')],'where':{'id':_0x4f5ec8[_0xa09e('0x38')][_0xa09e('0x3b')]}});})[_0xa09e('0x1e')](function(_0xe14776){socket[_0xa09e('0x50')](_0xa09e('0x51'),{'id':Number(_0x4f5ec8[_0xa09e('0x2b')]['id']),'tags':_0xe14776||[]});return{'id':Number(_0x4f5ec8[_0xa09e('0x2b')]['id']),'tags':_0xe14776||[]};});}})[_0xa09e('0x1e')](respondWithResult(_0x3458a0,null))[_0xa09e('0x36')](handleError(_0x3458a0,null));};exports['removeTags']=function(_0x460ae9,_0x1cb5ff){return db[_0xa09e('0x23')]['find']({'where':{'id':_0x460ae9['params']['id']}})[_0xa09e('0x1e')](handleEntityNotFound(_0x1cb5ff,null))[_0xa09e('0x1e')](function(_0x29cf78){if(_0x29cf78){return _0x29cf78[_0xa09e('0x52')](_0x460ae9['query'][_0xa09e('0x3b')]);}})['then'](respondWithStatusCode(_0x1cb5ff,null))[_0xa09e('0x36')](handleError(_0x1cb5ff,null));};exports[_0xa09e('0x53')]=function(_0x4a26cb,_0x2310c7){var _0x4946cb=moment()[_0xa09e('0x54')]()['toString']();var _0x4217ad=path[_0xa09e('0x55')](config['root'],_0xa09e('0x56'),_0xa09e('0x57'),_0xa09e('0x58'));var _0x39a99d=path[_0xa09e('0x55')](config[_0xa09e('0x59')],_0xa09e('0x56'),_0xa09e('0x57'),'attachments');var _0x1d334e=path['join'](_0x4217ad,_0x4946cb);var _0x5880c2=util[_0xa09e('0x48')](_0xa09e('0x5a'),_0x4a26cb[_0xa09e('0x2b')]['id'],_0x4946cb);var _0x488ab8=path['join'](_0x4217ad,_0x5880c2);var _0x2c0b64=[];if(_0x4a26cb['query'][_0xa09e('0x5b')]){_0x2c0b64[_0xa09e('0x5c')]({'model':db[_0xa09e('0x5d')],'as':_0xa09e('0x5e'),'raw':!![]});}var _0x4d6b6a=[{'model':db[_0xa09e('0x3a')],'as':_0xa09e('0x5f'),'attributes':['id',_0xa09e('0x38'),_0xa09e('0x60'),'to','cc',_0xa09e('0x61'),'subject',_0xa09e('0x62')],'where':{'secret':![]},'order':qs[_0xa09e('0x42')]('id'),'include':_0x2c0b64}];return db[_0xa09e('0x23')][_0xa09e('0x35')]({'where':{'id':_0x4a26cb[_0xa09e('0x2b')]['id']},'include':_0x4d6b6a})[_0xa09e('0x1e')](handleEntityNotFound(_0x2310c7,null))[_0xa09e('0x1e')](function(_0x4829bb){if(_0x4829bb&&_0x4829bb['Messages']){var _0x20e0d3=_0x4829bb['get']({'plain':!![]});fs['mkdirSync'](_0x1d334e);return BPromise['each'](_0x20e0d3['Messages'],function(_0xacd055,_0x65ee4d){var _0x1018d8={'from':_0xacd055[_0xa09e('0x60')],'to':_0xacd055['to']||'missing.recipient@your.company.com','subject':_0xacd055[_0xa09e('0x63')],'html':htmlEntities['decode'](_0xacd055[_0xa09e('0x38')]),'headers':{'Date':moment(_0xacd055['createdAt'])[_0xa09e('0x48')](_0xa09e('0x64'))},'attachments':[]};if(_0xacd055['cc']){_0x1018d8[_0xa09e('0x65')]['Cc']=_0xacd055['cc'];}if(_0xacd055[_0xa09e('0x61')]){_0x1018d8[_0xa09e('0x65')][_0xa09e('0x66')]=_0xacd055[_0xa09e('0x61')];}return new BPromise(function(_0x1ac107,_0x175981){if(_0xacd055['Attachments']){for(var _0x4201d8=0x0;_0x4201d8<_0xacd055[_0xa09e('0x5e')][_0xa09e('0x31')];_0x4201d8++){var _0x308b3c=_0xacd055[_0xa09e('0x5e')][_0x4201d8];var _0x168425=path[_0xa09e('0x55')](_0x39a99d,_0x308b3c[_0xa09e('0x67')]);if(fs['existsSync'](_0x168425)){_0x1018d8['attachments'][_0xa09e('0x5c')]({'name':_0x308b3c[_0xa09e('0x20')],'contentType':_0x308b3c[_0xa09e('0x68')],'data':fs[_0xa09e('0x69')](_0x168425)});}}}emlformat[_0xa09e('0x6a')](_0x1018d8,function(_0x1952da,_0x9cb97a){if(_0x1952da)return _0x175981(_0x1952da);fs['writeFileSync'](path[_0xa09e('0x55')](_0x1d334e,util['format']('message%d.eml',_0x65ee4d)),_0x9cb97a);return _0x1ac107(_0x9cb97a);});});})[_0xa09e('0x1e')](function(){return new BPromise(function(_0x14eb27,_0xe62df5){zipdir(_0x1d334e,{'saveTo':_0x488ab8},function(_0x5b8a58,_0x4d9dcb){if(_0x5b8a58)return _0xe62df5(_0x5b8a58);return _0x14eb27(_0x4d9dcb);});})[_0xa09e('0x1e')](function(){return new BPromise(function(_0x5d473d,_0x259902){rimraf(_0x1d334e,function(_0x49c3f4){if(_0x49c3f4)_0x259902(_0x49c3f4);return _0x5d473d();});});})[_0xa09e('0x1e')](function(){return _0x2310c7[_0xa09e('0x53')](_0x488ab8,_0x5880c2,function(_0x52a6e7){if(!_0x52a6e7)fs[_0xa09e('0x6b')](_0x488ab8);});});});}else{return _0x2310c7[_0xa09e('0x12')](0xc8);}})[_0xa09e('0x36')](handleError(_0x2310c7,null));}; \ No newline at end of file +var _0x1270=['inlineCss','rows','addTags','setTags','spread','color','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','bcc','get','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','sendStatus','eml-format','rimraf','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','html-entities','redis','localhost','socket.io-emitter','./mailInteraction.socket','status','end','json','offset','undefined','count','set','update','destroy','then','error','name','index','map','MailInteraction','fieldName','type','key','getOptions','findAll','query','user','catch','show','params','keys','rawAttributes','filters','model','attributes','fields','length','merge','options','find','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','intersection','hasOwnProperty','nolimit','limit','sort','where','pick','MailInteractionId','filter','$gte','split','includeAll','include'];(function(_0x5a8e24,_0x2dc21f){var _0x235660=function(_0x56e529){while(--_0x56e529){_0x5a8e24['push'](_0x5a8e24['shift']());}};_0x235660(++_0x2dc21f);}(_0x1270,0x178));var _0x0127=function(_0x47e424,_0x49c0ed){_0x47e424=_0x47e424-0x0;var _0x4122a9=_0x1270[_0x47e424];return _0x4122a9;};'use strict';var emlformat=require(_0x0127('0x0'));var rimraf=require(_0x0127('0x1'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0127('0x2'));var path=require(_0x0127('0x3'));var fs=require('fs');var _=require(_0x0127('0x4'));var juice=require(_0x0127('0x5'));var Redis=require(_0x0127('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x0127('0x7'));var logger=require(_0x0127('0x8'))('api');var config=require(_0x0127('0x9'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x0127('0xa'));config[_0x0127('0xb')]=_['defaults'](config['redis'],{'host':_0x0127('0xc'),'port':0x18eb});var socket=require(_0x0127('0xd'))(new Redis(config[_0x0127('0xb')]));require(_0x0127('0xe'))['register'](socket);function respondWithStatusCode(_0x2ad8e5,_0x3ab444){_0x3ab444=_0x3ab444||0xcc;return function(_0x130432){if(_0x130432){return _0x2ad8e5['sendStatus'](_0x3ab444);}return _0x2ad8e5[_0x0127('0xf')](_0x3ab444)[_0x0127('0x10')]();};}function respondWithResult(_0xef14e3,_0x4f8130){_0x4f8130=_0x4f8130||0xc8;return function(_0xc006e){if(_0xc006e){return _0xef14e3['status'](_0x4f8130)[_0x0127('0x11')](_0xc006e);}};}function respondWithFilteredResult(_0x1b4b0e,_0x2f7cea){return function(_0x3d7fae){if(_0x3d7fae){var _0x31066f=typeof _0x2f7cea[_0x0127('0x12')]===_0x0127('0x13')&&typeof _0x2f7cea['limit']==='undefined';var _0x5b8757=_0x3d7fae[_0x0127('0x14')];var _0x5e721a=_0x31066f?0x0:_0x2f7cea[_0x0127('0x12')];var _0x169cdc=_0x31066f?_0x3d7fae[_0x0127('0x14')]:_0x2f7cea['offset']+_0x2f7cea['limit'];var _0xad66dd;if(_0x169cdc>=_0x5b8757){_0x169cdc=_0x5b8757;_0xad66dd=0xc8;}else{_0xad66dd=0xce;}_0x1b4b0e[_0x0127('0xf')](_0xad66dd);return _0x1b4b0e[_0x0127('0x15')]('Content-Range',_0x5e721a+'-'+_0x169cdc+'/'+_0x5b8757)['json'](_0x3d7fae);}return null;};}function saveUpdates(_0x4992db){return function(_0x37b672){if(_0x37b672){return _0x37b672[_0x0127('0x16')](_0x4992db)['then'](function(_0x457cde){return _0x457cde;});}return null;};}function removeEntity(_0x1c3a81){return function(_0xb7a797){if(_0xb7a797){return _0xb7a797[_0x0127('0x17')]()[_0x0127('0x18')](function(){_0x1c3a81[_0x0127('0xf')](0xcc)[_0x0127('0x10')]();});}};}function handleEntityNotFound(_0x21e717){return function(_0x44f6c5){if(!_0x44f6c5){_0x21e717['sendStatus'](0x194);}return _0x44f6c5;};}function handleError(_0x161bfb,_0x106c08){_0x106c08=_0x106c08||0x1f4;return function(_0x4fa670){logger[_0x0127('0x19')](_0x4fa670['stack']);if(_0x4fa670[_0x0127('0x1a')]){delete _0x4fa670[_0x0127('0x1a')];}_0x161bfb[_0x0127('0xf')](_0x106c08)['send'](_0x4fa670);};}exports[_0x0127('0x1b')]=function(_0x81c591,_0x325c99){var _0x3766d3={};var _0x281cbc=_[_0x0127('0x1c')](db[_0x0127('0x1d')]['rawAttributes'],function(_0xd3fbab){return{'name':_0xd3fbab[_0x0127('0x1e')],'type':_0xd3fbab[_0x0127('0x1f')][_0x0127('0x20')]};});_0x3766d3=qs[_0x0127('0x21')](_0x281cbc,_0x81c591);return interaction[_0x0127('0x22')]('mail',_0x81c591[_0x0127('0x23')],_0x81c591[_0x0127('0x24')],_0x3766d3,_0x281cbc)[_0x0127('0x18')](respondWithFilteredResult(_0x325c99,_0x3766d3))[_0x0127('0x25')](handleError(_0x325c99,null));};exports[_0x0127('0x26')]=function(_0x192cbf,_0x5363ba){var _0x547cd4={'raw':![],'where':{'id':_0x192cbf[_0x0127('0x27')]['id']}},_0x3c6bc8={};_0x3c6bc8['model']=_[_0x0127('0x28')](db['MailInteraction'][_0x0127('0x29')]);_0x3c6bc8['query']=_[_0x0127('0x28')](_0x192cbf[_0x0127('0x23')]);_0x3c6bc8[_0x0127('0x2a')]=_['intersection'](_0x3c6bc8[_0x0127('0x2b')],_0x3c6bc8[_0x0127('0x23')]);_0x547cd4[_0x0127('0x2c')]=_['intersection'](_0x3c6bc8[_0x0127('0x2b')],qs[_0x0127('0x2d')](_0x192cbf['query'][_0x0127('0x2d')]));_0x547cd4['attributes']=_0x547cd4[_0x0127('0x2c')][_0x0127('0x2e')]?_0x547cd4[_0x0127('0x2c')]:_0x3c6bc8[_0x0127('0x2b')];if(_0x192cbf[_0x0127('0x23')]['includeAll']){_0x547cd4['include']=[{'all':!![]}];}_0x547cd4=_[_0x0127('0x2f')]({},_0x547cd4,_0x192cbf[_0x0127('0x30')]);return db[_0x0127('0x1d')][_0x0127('0x31')](_0x547cd4)[_0x0127('0x18')](handleEntityNotFound(_0x5363ba,null))[_0x0127('0x18')](respondWithResult(_0x5363ba,null))[_0x0127('0x25')](handleError(_0x5363ba,null));};exports[_0x0127('0x32')]=function(_0x1bff6a,_0x33f6f7){return db[_0x0127('0x1d')][_0x0127('0x32')](_0x1bff6a['body'],{})[_0x0127('0x18')](respondWithResult(_0x33f6f7,0xc9))[_0x0127('0x25')](handleError(_0x33f6f7,null));};exports[_0x0127('0x16')]=function(_0x447f3c,_0x2addb7){if(_0x447f3c[_0x0127('0x33')]['id']){delete _0x447f3c[_0x0127('0x33')]['id'];}return db['MailInteraction'][_0x0127('0x31')]({'where':{'id':_0x447f3c[_0x0127('0x27')]['id']}})['then'](handleEntityNotFound(_0x2addb7,null))[_0x0127('0x18')](saveUpdates(_0x447f3c[_0x0127('0x33')],null))[_0x0127('0x18')](respondWithResult(_0x2addb7,null))[_0x0127('0x25')](handleError(_0x2addb7,null));};exports['destroy']=function(_0x58b069,_0x4bccce){return db[_0x0127('0x1d')][_0x0127('0x31')]({'where':{'id':_0x58b069['params']['id']}})[_0x0127('0x18')](handleEntityNotFound(_0x4bccce,null))['then'](removeEntity(_0x4bccce,null))[_0x0127('0x25')](handleError(_0x4bccce,null));};exports[_0x0127('0x34')]=function(_0x355f89,_0x1e3970){return db[_0x0127('0x1d')][_0x0127('0x34')]()[_0x0127('0x18')](respondWithResult(_0x1e3970,null))[_0x0127('0x25')](handleError(_0x1e3970,null));};exports[_0x0127('0x35')]=function(_0x544773,_0x4d365a){return db[_0x0127('0x36')][_0x0127('0x31')]({'where':{'id':_0x544773['params']['id']}})[_0x0127('0x18')](handleEntityNotFound(_0x4d365a,null))[_0x0127('0x18')](function(_0xb12400){if(_0xb12400){return _0xb12400['addMessage'](_0x544773[_0x0127('0x33')][_0x0127('0x37')],_[_0x0127('0x38')](_0x544773[_0x0127('0x33')],['ids','id'])||{});}})['then'](respondWithResult(_0x4d365a,null))[_0x0127('0x25')](handleError(_0x4d365a,null));};exports[_0x0127('0x39')]=function(_0x5c88ed,_0x903565){var _0x3064d9={'raw':![],'where':{}};var _0x9cd874={};var _0x437b37={'count':0x0,'rows':[]};return db[_0x0127('0x1d')][_0x0127('0x3a')]({'where':{'id':_0x5c88ed[_0x0127('0x27')]['id']}})[_0x0127('0x18')](handleEntityNotFound(_0x903565,null))[_0x0127('0x18')](function(_0x594db7){if(_0x594db7){_0x9cd874[_0x0127('0x2b')]=_['keys'](db[_0x0127('0x36')][_0x0127('0x29')]);_0x9cd874['query']=_[_0x0127('0x28')](_0x5c88ed[_0x0127('0x23')]);_0x9cd874[_0x0127('0x2a')]=_['intersection'](_0x9cd874[_0x0127('0x2b')],_0x9cd874[_0x0127('0x23')]);_0x3064d9[_0x0127('0x2c')]=_[_0x0127('0x3b')](_0x9cd874[_0x0127('0x2b')],qs['fields'](_0x5c88ed[_0x0127('0x23')][_0x0127('0x2d')]));_0x3064d9[_0x0127('0x2c')]=_0x3064d9[_0x0127('0x2c')][_0x0127('0x2e')]?_0x3064d9[_0x0127('0x2c')]:_0x9cd874[_0x0127('0x2b')];if(!_0x5c88ed[_0x0127('0x23')][_0x0127('0x3c')](_0x0127('0x3d'))){_0x3064d9[_0x0127('0x3e')]=qs['limit'](_0x5c88ed[_0x0127('0x23')][_0x0127('0x3e')]);_0x3064d9[_0x0127('0x12')]=qs['offset'](_0x5c88ed[_0x0127('0x23')][_0x0127('0x12')]);}_0x3064d9['order']=qs[_0x0127('0x3f')](_0x5c88ed[_0x0127('0x23')][_0x0127('0x3f')]);_0x3064d9[_0x0127('0x40')]=qs[_0x0127('0x2a')](_[_0x0127('0x41')](_0x5c88ed[_0x0127('0x23')],_0x9cd874['filters']));_0x3064d9[_0x0127('0x40')][_0x0127('0x42')]=_0x594db7['id'];if(_0x5c88ed[_0x0127('0x23')][_0x0127('0x43')]){_0x3064d9[_0x0127('0x40')]=_[_0x0127('0x2f')](_0x3064d9[_0x0127('0x40')],{'$or':_['map'](_0x3064d9[_0x0127('0x2c')],function(_0xc39cb6){var _0x4d38b3={};_0x4d38b3[_0xc39cb6]={'$like':'%'+_0x5c88ed[_0x0127('0x23')][_0x0127('0x43')]+'%'};return _0x4d38b3;})});}if(_0x5c88ed[_0x0127('0x23')]['$gte']){var _0xdb1798=_0x5c88ed['query'][_0x0127('0x44')][_0x0127('0x45')](',');var _0x25b5cb={};_0x25b5cb[_0xdb1798[0x0]]={'$gte':moment(_0xdb1798[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3064d9[_0x0127('0x40')]=_[_0x0127('0x2f')](_0x3064d9[_0x0127('0x40')],_0x25b5cb);}_0x3064d9=_['merge']({},_0x3064d9,_0x5c88ed[_0x0127('0x30')]);return db['MailMessage']['count']({'where':_0x3064d9[_0x0127('0x40')]})['then'](function(_0x38ff03){_0x437b37[_0x0127('0x14')]=_0x38ff03;if(_0x5c88ed['query'][_0x0127('0x46')]){_0x3064d9[_0x0127('0x47')]=[{'all':!![]}];}return db['MailMessage'][_0x0127('0x22')](_0x3064d9);})[_0x0127('0x18')](function(_0x5e3050){if(_0x5c88ed[_0x0127('0x23')][_0x0127('0x48')]==='true'){for(var _0x22f146=0x0;_0x22f146<_0x5e3050[_0x0127('0x2e')];_0x22f146++){_0x5e3050[_0x22f146][_0x0127('0x33')]=juice(_0x5e3050[_0x22f146]['body']);}}_0x437b37[_0x0127('0x49')]=_0x5e3050;return _0x437b37;});}})[_0x0127('0x18')](respondWithFilteredResult(_0x903565,_0x3064d9))[_0x0127('0x25')](handleError(_0x903565,null));};exports[_0x0127('0x4a')]=function(_0x531a53,_0x3ce89c){return db[_0x0127('0x1d')][_0x0127('0x31')]({'where':{'id':_0x531a53[_0x0127('0x27')]['id']}})['then'](handleEntityNotFound(_0x3ce89c,null))[_0x0127('0x18')](function(_0x1b5841){if(_0x1b5841){return _0x1b5841[_0x0127('0x4b')](_0x531a53[_0x0127('0x33')][_0x0127('0x37')],_[_0x0127('0x38')](_0x531a53['body'],['ids','id'])||{})[_0x0127('0x4c')](function(){return db['Tag'][_0x0127('0x22')]({'attributes':['id',_0x0127('0x1a'),_0x0127('0x4d')],'where':{'id':_0x531a53[_0x0127('0x33')][_0x0127('0x37')]}});})[_0x0127('0x18')](function(_0x6bd62e){socket['emit'](_0x0127('0x4e'),{'id':Number(_0x531a53[_0x0127('0x27')]['id']),'tags':_0x6bd62e||[]});return{'id':Number(_0x531a53[_0x0127('0x27')]['id']),'tags':_0x6bd62e||[]};});}})['then'](respondWithResult(_0x3ce89c,null))[_0x0127('0x25')](handleError(_0x3ce89c,null));};exports[_0x0127('0x4f')]=function(_0x75b868,_0x5dd04d){return db[_0x0127('0x1d')][_0x0127('0x31')]({'where':{'id':_0x75b868[_0x0127('0x27')]['id']}})['then'](handleEntityNotFound(_0x5dd04d,null))[_0x0127('0x18')](function(_0x1010ed){if(_0x1010ed){return _0x1010ed[_0x0127('0x4f')](_0x75b868[_0x0127('0x23')][_0x0127('0x37')]);}})['then'](respondWithStatusCode(_0x5dd04d,null))[_0x0127('0x25')](handleError(_0x5dd04d,null));};exports[_0x0127('0x50')]=function(_0x2e19df,_0x176592){var _0x3a46a0=moment()[_0x0127('0x51')]()[_0x0127('0x52')]();var _0x3c90ac=path[_0x0127('0x53')](config[_0x0127('0x54')],_0x0127('0x55'),_0x0127('0x56'),_0x0127('0x57'));var _0x44d865=path[_0x0127('0x53')](config[_0x0127('0x54')],_0x0127('0x55'),_0x0127('0x56'),_0x0127('0x58'));var _0x20525d=path[_0x0127('0x53')](_0x3c90ac,_0x3a46a0);var _0x9b4b38=util[_0x0127('0x59')](_0x0127('0x5a'),_0x2e19df['params']['id'],_0x3a46a0);var _0x1e7e8b=path[_0x0127('0x53')](_0x3c90ac,_0x9b4b38);var _0x11a99d=[];if(_0x2e19df[_0x0127('0x23')][_0x0127('0x58')]){_0x11a99d[_0x0127('0x5b')]({'model':db[_0x0127('0x5c')],'as':_0x0127('0x5d'),'raw':!![]});}var _0x26999d=[{'model':db['MailMessage'],'as':_0x0127('0x5e'),'attributes':['id',_0x0127('0x33'),_0x0127('0x5f'),'to','cc',_0x0127('0x60'),'subject','createdAt'],'where':{'secret':![]},'order':qs[_0x0127('0x3f')]('id'),'include':_0x11a99d}];return db['MailInteraction'][_0x0127('0x31')]({'where':{'id':_0x2e19df['params']['id']},'include':_0x26999d})[_0x0127('0x18')](handleEntityNotFound(_0x176592,null))[_0x0127('0x18')](function(_0x401b6c){if(_0x401b6c&&_0x401b6c['Messages']){var _0xb7cd46=_0x401b6c[_0x0127('0x61')]({'plain':!![]});fs[_0x0127('0x62')](_0x20525d);return BPromise[_0x0127('0x63')](_0xb7cd46[_0x0127('0x5e')],function(_0xbbc960,_0x45f7ca){var _0xa0169d={'from':_0xbbc960[_0x0127('0x5f')],'to':_0xbbc960['to']||_0x0127('0x64'),'subject':_0xbbc960['subject'],'html':htmlEntities[_0x0127('0x65')](_0xbbc960[_0x0127('0x33')]),'headers':{'Date':moment(_0xbbc960['createdAt'])['format'](_0x0127('0x66'))},'attachments':[]};if(_0xbbc960['cc']){_0xa0169d[_0x0127('0x67')]['Cc']=_0xbbc960['cc'];}if(_0xbbc960['bcc']){_0xa0169d[_0x0127('0x67')][_0x0127('0x68')]=_0xbbc960[_0x0127('0x60')];}return new BPromise(function(_0x449b92,_0x45c607){if(_0xbbc960[_0x0127('0x5d')]){for(var _0x5d45e1=0x0;_0x5d45e1<_0xbbc960['Attachments']['length'];_0x5d45e1++){var _0x44ee49=_0xbbc960[_0x0127('0x5d')][_0x5d45e1];var _0x56a9f9=path[_0x0127('0x53')](_0x44d865,_0x44ee49[_0x0127('0x69')]);if(fs[_0x0127('0x6a')](_0x56a9f9)){_0xa0169d[_0x0127('0x58')][_0x0127('0x5b')]({'name':_0x44ee49['name'],'contentType':_0x44ee49[_0x0127('0x1f')],'data':fs[_0x0127('0x6b')](_0x56a9f9)});}}}emlformat[_0x0127('0x6c')](_0xa0169d,function(_0x5cbf6d,_0x45be9e){if(_0x5cbf6d)return _0x45c607(_0x5cbf6d);fs[_0x0127('0x6d')](path[_0x0127('0x53')](_0x20525d,util['format'](_0x0127('0x6e'),_0x45f7ca)),_0x45be9e);return _0x449b92(_0x45be9e);});});})[_0x0127('0x18')](function(){return new BPromise(function(_0x45fcca,_0x586773){zipdir(_0x20525d,{'saveTo':_0x1e7e8b},function(_0x1d1d09,_0x223dcd){if(_0x1d1d09)return _0x586773(_0x1d1d09);return _0x45fcca(_0x223dcd);});})[_0x0127('0x18')](function(){return new BPromise(function(_0x399ce4,_0xf0d2af){rimraf(_0x20525d,function(_0x29e2ee){if(_0x29e2ee)_0xf0d2af(_0x29e2ee);return _0x399ce4();});});})[_0x0127('0x18')](function(){return _0x176592[_0x0127('0x50')](_0x1e7e8b,_0x9b4b38,function(_0x23fe4b){if(!_0x23fe4b)fs['unlinkSync'](_0x1e7e8b);});});});}else{return _0x176592[_0x0127('0x6f')](0xc8);}})[_0x0127('0x25')](handleError(_0x176592,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 0af58c8..101f83a 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 _0xce84=['then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','MailInteraction','../../mysqldb','setMaxListeners','save','update','remove','getUsers'];(function(_0x2927ba,_0x1e4773){var _0x41911c=function(_0x4580fb){while(--_0x4580fb){_0x2927ba['push'](_0x2927ba['shift']());}};_0x41911c(++_0x1e4773);}(_0xce84,0x19a));var _0x4ce8=function(_0x40d55f,_0x262319){_0x40d55f=_0x40d55f-0x0;var _0x702672=_0xce84[_0x40d55f];return _0x702672;};'use strict';var EventEmitter=require(_0x4ce8('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x4ce8('0x1')];var MailMessage=require(_0x4ce8('0x2'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x4ce8('0x3')](0x0);var events={'afterCreate':_0x4ce8('0x4'),'afterUpdate':_0x4ce8('0x5'),'afterDestroy':_0x4ce8('0x6')};function emitEvent(_0x26c82a){return function(_0x4d4482,_0x3e71b5,_0x4ec2f2){_0x4d4482[_0x4ce8('0x7')]({'attributes':['id'],'raw':!![]})[_0x4ce8('0x8')](function(_0x2c2668){_0x4d4482[_0x4ce8('0x9')](_0x4ce8('0xa'),_0x2c2668[_0x4ce8('0xb')](function(_0x175fb1){return{'id':_0x175fb1['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x4d4482['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x39ac6c){_0x4d4482['setDataValue'](_0x4ce8('0xc'),_0x39ac6c[_0x4ce8('0xd')]);MailInteractionEvents['emit'](_0x26c82a+':'+_0x4d4482['id'],_0x4d4482);MailInteractionEvents[_0x4ce8('0xe')](_0x26c82a,_0x4d4482);_0x4ec2f2(null);})[_0x4ce8('0xf')](_0x4ec2f2(null));};}for(var e in events){if(events[_0x4ce8('0x10')](e)){var event=events[e];MailInteraction[_0x4ce8('0x11')](e,emitEvent(event));}}module[_0x4ce8('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0x1907=['../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x1907,0x155));var _0x7190=function(_0x3da684,_0x12a556){_0x3da684=_0x3da684-0x0;var _0x273bb4=_0x1907[_0x3da684];return _0x273bb4;};'use strict';var EventEmitter=require(_0x7190('0x0'));var MailInteraction=require(_0x7190('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x7190('0x1'))['db'][_0x7190('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x7190('0x3')](0x0);var events={'afterCreate':_0x7190('0x4'),'afterUpdate':_0x7190('0x5'),'afterDestroy':_0x7190('0x6')};function emitEvent(_0x3a9074){return function(_0x569bc8,_0x5ed958,_0x1751d0){_0x569bc8[_0x7190('0x7')]({'attributes':['id'],'raw':!![]})[_0x7190('0x8')](function(_0x2bf621){_0x569bc8[_0x7190('0x9')](_0x7190('0xa'),_0x2bf621['map'](function(_0x46d382){return{'id':_0x46d382['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x569bc8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x50641a){_0x569bc8[_0x7190('0x9')](_0x7190('0xb'),_0x50641a[_0x7190('0xc')]);MailInteractionEvents[_0x7190('0xd')](_0x3a9074+':'+_0x569bc8['id'],_0x569bc8);MailInteractionEvents[_0x7190('0xd')](_0x3a9074,_0x569bc8);_0x1751d0(null);})[_0x7190('0xe')](_0x1751d0(null));};}for(var e in events){if(events[_0x7190('0xf')](e)){var event=events[e];MailInteraction[_0x7190('0x10')](e,emitEvent(event));}}module[_0x7190('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 4c53d9a..d08019e 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 _0x1854=['exports','mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','substatus','closed','MailMessage','update','then','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes'];(function(_0x2db0da,_0xc78f39){var _0x2fd6ab=function(_0x3570b2){while(--_0x3570b2){_0x2db0da['push'](_0x2db0da['shift']());}};_0x2fd6ab(++_0xc78f39);}(_0x1854,0x18e));var _0x4185=function(_0x1b8bda,_0x43ad31){_0x1b8bda=_0x1b8bda-0x0;var _0x1f7050=_0x1854[_0x1b8bda];return _0x1f7050;};'use strict';var _=require(_0x4185('0x0'));var util=require(_0x4185('0x1'));var logger=require(_0x4185('0x2'))(_0x4185('0x3'));var moment=require('moment');var BPromise=require(_0x4185('0x4'));var rp=require(_0x4185('0x5'));var fs=require('fs');var path=require(_0x4185('0x6'));var rimraf=require(_0x4185('0x7'));var config=require(_0x4185('0x8'));var attributes=require(_0x4185('0x9'));module[_0x4185('0xa')]=function(_0x38a59b,_0x56cdf3){return _0x38a59b['define']('MailInteraction',attributes,{'tableName':_0x4185('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x4185('0xc'),'to'],'type':_0x4185('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3bc6c9,_0xdae852,_0x10ca80){if(_0x3bc6c9['substatus']){_0x3bc6c9[_0x4185('0xe')]=moment()[_0x4185('0xf')](_0x4185('0x10'));}if(_0x3bc6c9['closed']){_0x3bc6c9[_0x4185('0x11')]=moment()['format'](_0x4185('0x10'));}_0x10ca80(null,_0xdae852);},'beforeUpdate':function(_0x48dbf0,_0x3f59b4,_0x51b696){if(_0x48dbf0['changed'](_0x4185('0x12'))){_0x48dbf0[_0x4185('0xe')]=_0x48dbf0[_0x4185('0x12')]?moment()[_0x4185('0xf')](_0x4185('0x10')):null;}if(_0x48dbf0['changed'](_0x4185('0x13'))){_0x48dbf0[_0x4185('0x11')]=moment()[_0x4185('0xf')](_0x4185('0x10'));_0x48dbf0['substatus']=null;_0x48dbf0[_0x4185('0xe')]=null;}_0x51b696(null,_0x48dbf0);},'afterUpdate':function(_0x4c7f64,_0x2a7a09,_0x232ba3){var _0x59b86d=_0x38a59b['models'];var _0x46d176=_0x4c7f64['get']({'plain':!![]});if(_0x46d176[_0x4185('0x13')]){return _0x59b86d[_0x4185('0x14')][_0x4185('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x46d176['id']}})[_0x4185('0x16')](function(){_0x232ba3();})['catch'](function(_0x26b3b9){_0x232ba3(_0x26b3b9);});}else{_0x232ba3();}}},'charset':'utf8mb4','collate':_0x4185('0x17')});}; \ No newline at end of file +var _0x1924=['MailInteraction','fti_mail_interactions','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','substatus','substatusAt','models','get','MailMessage','update','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x49c854,_0x387d1a){var _0x111a10=function(_0x432c67){while(--_0x432c67){_0x49c854['push'](_0x49c854['shift']());}};_0x111a10(++_0x387d1a);}(_0x1924,0x13b));var _0x4192=function(_0x461fd6,_0x1db38c){_0x461fd6=_0x461fd6-0x0;var _0x4e7a9c=_0x1924[_0x461fd6];return _0x4e7a9c;};'use strict';var _=require(_0x4192('0x0'));var util=require(_0x4192('0x1'));var logger=require(_0x4192('0x2'))(_0x4192('0x3'));var moment=require(_0x4192('0x4'));var BPromise=require(_0x4192('0x5'));var rp=require(_0x4192('0x6'));var fs=require('fs');var path=require(_0x4192('0x7'));var rimraf=require('rimraf');var config=require(_0x4192('0x8'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x1c0030,_0x2f0be5){return _0x1c0030[_0x4192('0x9')](_0x4192('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x4192('0xb'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x31ace1,_0x1d0daf,_0x618a51){if(_0x31ace1['substatus']){_0x31ace1['substatusAt']=moment()[_0x4192('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x31ace1[_0x4192('0xd')]){_0x31ace1[_0x4192('0xe')]=moment()[_0x4192('0xc')](_0x4192('0xf'));}_0x618a51(null,_0x1d0daf);},'beforeUpdate':function(_0x4298bb,_0x3c2f0f,_0x2a6110){if(_0x4298bb[_0x4192('0x10')](_0x4192('0x11'))){_0x4298bb['substatusAt']=_0x4298bb[_0x4192('0x11')]?moment()[_0x4192('0xc')](_0x4192('0xf')):null;}if(_0x4298bb[_0x4192('0x10')]('closed')){_0x4298bb[_0x4192('0xe')]=moment()[_0x4192('0xc')](_0x4192('0xf'));_0x4298bb[_0x4192('0x11')]=null;_0x4298bb[_0x4192('0x12')]=null;}_0x2a6110(null,_0x4298bb);},'afterUpdate':function(_0x4ffe07,_0x35997d,_0x100125){var _0x2e00e6=_0x1c0030[_0x4192('0x13')];var _0x38f2fd=_0x4ffe07[_0x4192('0x14')]({'plain':!![]});if(_0x38f2fd[_0x4192('0xd')]){return _0x2e00e6[_0x4192('0x15')][_0x4192('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x38f2fd['id']}})['then'](function(){_0x100125();})['catch'](function(_0x4323b8){_0x100125(_0x4323b8);});}else{_0x100125();}}},'charset':_0x4192('0x17'),'collate':_0x4192('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 91edf48..799e9b4 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 _0x15c5=['redis','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','options','raw','where','limit','AddTagsToMailInteraction','find','addTags','omit','body','ids','AddTags','lodash','randomstring','ioredis','../../mysqldb','../../config/environment','defaults'];(function(_0x1a9e69,_0x44215e){var _0x5035a4=function(_0x490d40){while(--_0x490d40){_0x1a9e69['push'](_0x1a9e69['shift']());}};_0x5035a4(++_0x44215e);}(_0x15c5,0x192));var _0x515c=function(_0x385eb1,_0x497a94){_0x385eb1=_0x385eb1-0x0;var _0x5d40eb=_0x15c5[_0x385eb1];return _0x5d40eb;};'use strict';var _=require(_0x515c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x515c('0x1'));var fs=require('fs');var Redis=require(_0x515c('0x2'));var db=require(_0x515c('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x515c('0x4'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x515c('0x5')](config[_0x515c('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x515c('0x6')]));require('./mailInteraction.socket')[_0x515c('0x7')](socket);function respondWithRpcPromise(_0x394519,_0x33752c,_0x203eec){return new BPromise(function(_0x51a0a7,_0x21c7ab){return client[_0x515c('0x8')](_0x394519,_0x203eec)[_0x515c('0x9')](function(_0x23410e){logger[_0x515c('0xa')](_0x515c('0xb'),_0x33752c,_0x515c('0xc'));logger[_0x515c('0xd')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x33752c,_0x515c('0xc'),JSON[_0x515c('0xe')](_0x23410e));if(_0x23410e[_0x515c('0xf')]){if(_0x23410e[_0x515c('0xf')][_0x515c('0x10')]===0x1f4){logger[_0x515c('0xf')](_0x515c('0xb'),_0x33752c,_0x23410e[_0x515c('0xf')][_0x515c('0x11')]);return _0x21c7ab(_0x23410e[_0x515c('0xf')]['message']);}logger['error'](_0x515c('0xb'),_0x33752c,_0x23410e[_0x515c('0xf')][_0x515c('0x11')]);return _0x51a0a7(_0x23410e[_0x515c('0xf')][_0x515c('0x11')]);}else{logger['info'](_0x515c('0xb'),_0x33752c,'request\x20sent');_0x51a0a7(_0x23410e[_0x515c('0x12')]['message']);}})[_0x515c('0x13')](function(_0x1151b9){logger['error'](_0x515c('0xb'),_0x33752c,_0x1151b9);_0x21c7ab(_0x1151b9);});});}exports[_0x515c('0x14')]=function(_0x68b9e2){var _0x4b4b6d=this;return new Promise(function(_0x599f19,_0x13dda3){return db[_0x515c('0x15')][_0x515c('0x16')](_0x68b9e2['body'],{'raw':_0x68b9e2[_0x515c('0x17')]?_0x68b9e2['options'][_0x515c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x68b9e2[_0x515c('0x17')]?_0x68b9e2[_0x515c('0x17')][_0x515c('0x19')]||null:null,'attributes':_0x68b9e2['options']?_0x68b9e2['options']['attributes']||null:null,'limit':_0x68b9e2[_0x515c('0x17')]?_0x68b9e2[_0x515c('0x17')][_0x515c('0x1a')]||null:null})[_0x515c('0x9')](function(_0x9999f8){logger[_0x515c('0xa')](_0x515c('0x14'),_0x68b9e2);logger['debug']('UpdateMailInteraction',_0x68b9e2,JSON['stringify'](_0x9999f8));_0x599f19(_0x9999f8);})['catch'](function(_0x4c8d6b){logger[_0x515c('0xf')](_0x515c('0x14'),_0x4c8d6b[_0x515c('0x11')],_0x68b9e2);_0x13dda3(_0x4b4b6d[_0x515c('0xf')](0x1f4,_0x4c8d6b[_0x515c('0x11')]));});});};exports[_0x515c('0x1b')]=function(_0x142e6f){return new Promise(function(_0x465e82,_0x254398){return db[_0x515c('0x15')][_0x515c('0x1c')]({'where':_0x142e6f[_0x515c('0x17')]?_0x142e6f[_0x515c('0x17')][_0x515c('0x19')]||null:null})['then'](function(_0x5764f8){if(_0x5764f8){return _0x5764f8[_0x515c('0x1d')](_0x142e6f['body']['ids'],_[_0x515c('0x1e')](_0x142e6f[_0x515c('0x1f')],[_0x515c('0x20'),'id'])||{});}})['spread'](function(_0x1146f5){logger['info'](_0x515c('0x21'),_0x142e6f);logger[_0x515c('0xd')](_0x515c('0x21'),_0x142e6f,JSON[_0x515c('0xe')](_0x1146f5));_0x465e82(_0x1146f5);})[_0x515c('0x13')](function(_0x558f08){logger['error'](_0x515c('0x21'),_0x558f08[_0x515c('0x11')],_0x142e6f);_0x254398(_this[_0x515c('0xf')](0x1f4,_0x558f08['message']));});});}; \ No newline at end of file +var _0xb0d7=['debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','MailInteraction','body','options','where','UpdateMailInteraction','stringify','catch','AddTagsToMailInteraction','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s'];(function(_0x21cd36,_0x2aa6b2){var _0x3ff267=function(_0x2eb8c9){while(--_0x2eb8c9){_0x21cd36['push'](_0x21cd36['shift']());}};_0x3ff267(++_0x2aa6b2);}(_0xb0d7,0xb0));var _0x7b0d=function(_0x2e0475,_0x1eca9a){_0x2e0475=_0x2e0475-0x0;var _0x40cd05=_0xb0d7[_0x2e0475];return _0x40cd05;};'use strict';var _=require(_0x7b0d('0x0'));var util=require('util');var moment=require(_0x7b0d('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b0d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b0d('0x3'))['db'];var utils=require(_0x7b0d('0x4'));var logger=require(_0x7b0d('0x5'))(_0x7b0d('0x6'));var config=require(_0x7b0d('0x7'));var jayson=require(_0x7b0d('0x8'));var client=jayson[_0x7b0d('0x9')]['http']({'port':0x232a});config[_0x7b0d('0xa')]=_[_0x7b0d('0xb')](config[_0x7b0d('0xa')],{'host':_0x7b0d('0xc'),'port':0x18eb});var socket=require(_0x7b0d('0xd'))(new Redis(config[_0x7b0d('0xa')]));require('./mailInteraction.socket')[_0x7b0d('0xe')](socket);function respondWithRpcPromise(_0x2bde34,_0x428aff,_0x169d4f){return new BPromise(function(_0x36c26e,_0x4d344f){return client[_0x7b0d('0xf')](_0x2bde34,_0x169d4f)[_0x7b0d('0x10')](function(_0x5daf6a){logger[_0x7b0d('0x11')](_0x7b0d('0x12'),_0x428aff,'request\x20sent');logger[_0x7b0d('0x13')](_0x7b0d('0x14'),_0x428aff,_0x7b0d('0x15'),JSON['stringify'](_0x5daf6a));if(_0x5daf6a[_0x7b0d('0x16')]){if(_0x5daf6a['error'][_0x7b0d('0x17')]===0x1f4){logger[_0x7b0d('0x16')](_0x7b0d('0x12'),_0x428aff,_0x5daf6a[_0x7b0d('0x16')][_0x7b0d('0x18')]);return _0x4d344f(_0x5daf6a[_0x7b0d('0x16')][_0x7b0d('0x18')]);}logger[_0x7b0d('0x16')]('MailInteraction,\x20%s,\x20%s',_0x428aff,_0x5daf6a[_0x7b0d('0x16')][_0x7b0d('0x18')]);return _0x36c26e(_0x5daf6a[_0x7b0d('0x16')]['message']);}else{logger[_0x7b0d('0x11')](_0x7b0d('0x12'),_0x428aff,_0x7b0d('0x15'));_0x36c26e(_0x5daf6a[_0x7b0d('0x19')][_0x7b0d('0x18')]);}})['catch'](function(_0xff406){logger['error'](_0x7b0d('0x12'),_0x428aff,_0xff406);_0x4d344f(_0xff406);});});}exports['UpdateMailInteraction']=function(_0x58d2a7){var _0x59b9d3=this;return new Promise(function(_0xf4b040,_0x4cf1ff){return db[_0x7b0d('0x1a')]['update'](_0x58d2a7[_0x7b0d('0x1b')],{'raw':_0x58d2a7[_0x7b0d('0x1c')]?_0x58d2a7[_0x7b0d('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58d2a7[_0x7b0d('0x1c')]?_0x58d2a7[_0x7b0d('0x1c')][_0x7b0d('0x1d')]||null:null,'attributes':_0x58d2a7[_0x7b0d('0x1c')]?_0x58d2a7[_0x7b0d('0x1c')]['attributes']||null:null,'limit':_0x58d2a7[_0x7b0d('0x1c')]?_0x58d2a7[_0x7b0d('0x1c')]['limit']||null:null})[_0x7b0d('0x10')](function(_0x4d2d6d){logger['info'](_0x7b0d('0x1e'),_0x58d2a7);logger['debug']('UpdateMailInteraction',_0x58d2a7,JSON[_0x7b0d('0x1f')](_0x4d2d6d));_0xf4b040(_0x4d2d6d);})[_0x7b0d('0x20')](function(_0x2d3a98){logger['error'](_0x7b0d('0x1e'),_0x2d3a98[_0x7b0d('0x18')],_0x58d2a7);_0x4cf1ff(_0x59b9d3[_0x7b0d('0x16')](0x1f4,_0x2d3a98[_0x7b0d('0x18')]));});});};exports[_0x7b0d('0x21')]=function(_0xb4bd06){return new Promise(function(_0x3b4e,_0x4a0870){return db[_0x7b0d('0x1a')]['find']({'where':_0xb4bd06[_0x7b0d('0x1c')]?_0xb4bd06[_0x7b0d('0x1c')]['where']||null:null})[_0x7b0d('0x10')](function(_0x577845){if(_0x577845){return _0x577845[_0x7b0d('0x22')](_0xb4bd06['body'][_0x7b0d('0x23')],_[_0x7b0d('0x24')](_0xb4bd06[_0x7b0d('0x1b')],[_0x7b0d('0x23'),'id'])||{});}})[_0x7b0d('0x25')](function(_0x22d751){logger[_0x7b0d('0x11')](_0x7b0d('0x26'),_0xb4bd06);logger[_0x7b0d('0x13')](_0x7b0d('0x26'),_0xb4bd06,JSON['stringify'](_0x22d751));_0x3b4e(_0x22d751);})[_0x7b0d('0x20')](function(_0x1bebd9){logger['error']('AddTags',_0x1bebd9[_0x7b0d('0x18')],_0xb4bd06);_0x4a0870(_this[_0x7b0d('0x16')](0x1f4,_0x1bebd9[_0x7b0d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index a55bd08..05f9763 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 _0xf654=['mailInteraction:','./mailInteraction.events','save','emit','removeListener','register','length'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xf654,0x94));var _0x4f65=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf654[_0x20a584];return _0x4b41a8;};'use strict';var MailInteractionEvents=require(_0x4f65('0x0'));var events=[_0x4f65('0x1'),'remove','update'];function createListener(_0x553ab9,_0x21d4bb){return function(_0x4e63d0){_0x21d4bb[_0x4f65('0x2')](_0x553ab9,_0x4e63d0);};}function removeListener(_0x5a6621,_0xfaf6b9){return function(){MailInteractionEvents[_0x4f65('0x3')](_0x5a6621,_0xfaf6b9);};}exports[_0x4f65('0x4')]=function(_0x4e4890){for(var _0x312b0e=0x0,_0x5e924c=events[_0x4f65('0x5')];_0x312b0e<_0x5e924c;_0x312b0e++){var _0x4c796c=events[_0x312b0e];var _0x2dbdd6=createListener(_0x4f65('0x6')+_0x4c796c,_0x4e4890);MailInteractionEvents['on'](_0x4c796c,_0x2dbdd6);}}; \ No newline at end of file +var _0x350b=['update','emit','register','length','mailInteraction:','./mailInteraction.events'];(function(_0xcc1266,_0x27ba6d){var _0x34e46a=function(_0x623c34){while(--_0x623c34){_0xcc1266['push'](_0xcc1266['shift']());}};_0x34e46a(++_0x27ba6d);}(_0x350b,0x14f));var _0xb350=function(_0x1783f4,_0x122040){_0x1783f4=_0x1783f4-0x0;var _0x5c97af=_0x350b[_0x1783f4];return _0x5c97af;};'use strict';var MailInteractionEvents=require(_0xb350('0x0'));var events=['save','remove',_0xb350('0x1')];function createListener(_0x3901a1,_0x48c025){return function(_0x3c2ecf){_0x48c025[_0xb350('0x2')](_0x3901a1,_0x3c2ecf);};}function removeListener(_0x9952c,_0x57b4c1){return function(){MailInteractionEvents['removeListener'](_0x9952c,_0x57b4c1);};}exports[_0xb350('0x3')]=function(_0x30375b){for(var _0x48a7c8=0x0,_0x4adb06=events[_0xb350('0x4')];_0x48a7c8<_0x4adb06;_0x48a7c8++){var _0x454514=events[_0x48a7c8];var _0x1606a5=createListener(_0xb350('0x5')+_0x454514,_0x30375b);MailInteractionEvents['on'](_0x454514,_0x1606a5);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 3a8a202..9bc88db 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x524e=['../../components/auth/service','./mailInteractionHasTag.controller','get','/describe','isAuthenticated','describe','exports'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x524e,0x15e));var _0xe524=function(_0x4f5acd,_0x497ec9){_0x4f5acd=_0x4f5acd-0x0;var _0x487ecb=_0x524e[_0x4f5acd];return _0x487ecb;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xe524('0x0'));var controller=require(_0xe524('0x1'));router[_0xe524('0x2')](_0xe524('0x3'),auth[_0xe524('0x4')](),controller[_0xe524('0x5')]);module[_0xe524('0x6')]=router; \ No newline at end of file +var _0x4473=['/describe','isAuthenticated','describe'];(function(_0x2f469b,_0x3dffd9){var _0xe6e9b9=function(_0x45e1a7){while(--_0x45e1a7){_0x2f469b['push'](_0x2f469b['shift']());}};_0xe6e9b9(++_0x3dffd9);}(_0x4473,0x15c));var _0x3447=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x4473[_0x5608a3];return _0x1ed50a;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./mailInteractionHasTag.controller');router['get'](_0x3447('0x0'),auth[_0x3447('0x1')](),controller[_0x3447('0x2')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 8d27359..c4c0a3a 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x13711f,_0x22f874){var _0x555bae=function(_0xcd269a){while(--_0xcd269a){_0x13711f['push'](_0x13711f['shift']());}};_0x555bae(++_0x22f874);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x393dee,_0x5ed5cc){var _0x5cdba3=function(_0x440d64){while(--_0x440d64){_0x393dee['push'](_0x393dee['shift']());}};_0x5cdba3(++_0x5ed5cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index fbe05cc..f2ee348 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c29=['INTEGER','sequelize','exports'];(function(_0x42c542,_0x242029){var _0x240d6e=function(_0x1a7079){while(--_0x1a7079){_0x42c542['push'](_0x42c542['shift']());}};_0x240d6e(++_0x242029);}(_0x4c29,0x16c));var _0x94c2=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x4c29[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0x94c2('0x0'));module[_0x94c2('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x94c2('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x70ce=['sequelize','exports','INTEGER'];(function(_0x483102,_0x54e93d){var _0x5cc885=function(_0x54931c){while(--_0x54931c){_0x483102['push'](_0x483102['shift']());}};_0x5cc885(++_0x54e93d);}(_0x70ce,0x1d7));var _0xe70c=function(_0x5d9999,_0x3f0321){_0x5d9999=_0x5d9999-0x0;var _0x1d15ed=_0x70ce[_0x5d9999];return _0x1d15ed;};'use strict';var Sequelize=require(_0xe70c('0x0'));module[_0xe70c('0x1')]={'MailInteractionId':{'type':Sequelize[_0xe70c('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xe70c('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index d35fe24..e6b7a14 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x405f=['mail_interaction_has_tags','exports','define','MailInteractionHasTag'];(function(_0x309929,_0x39fd80){var _0xf9bb49=function(_0x11087c){while(--_0x11087c){_0x309929['push'](_0x309929['shift']());}};_0xf9bb49(++_0x39fd80);}(_0x405f,0x1c9));var _0xf405=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x405f[_0x4b2436];return _0x4f5ab2;};'use strict';var attributes=require('./mailInteractionHasTag');module[_0xf405('0x0')]=function(_0xdb37fc){return _0xdb37fc[_0xf405('0x1')](_0xf405('0x2'),attributes,{'tableName':_0xf405('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3090=['mail_interaction_has_tags','./mailInteractionHasTag','exports','define'];(function(_0xe01b5,_0x1787bd){var _0x3113dc=function(_0x56029d){while(--_0x56029d){_0xe01b5['push'](_0xe01b5['shift']());}};_0x3113dc(++_0x1787bd);}(_0x3090,0xf1));var _0x0309=function(_0x2e9c1f,_0x19c688){_0x2e9c1f=_0x2e9c1f-0x0;var _0xcecc3e=_0x3090[_0x2e9c1f];return _0xcecc3e;};'use strict';var attributes=require(_0x0309('0x0'));module[_0x0309('0x1')]=function(_0x3d761d){return _0x3d761d[_0x0309('0x2')]('MailInteractionHasTag',attributes,{'tableName':_0x0309('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 3444aa4..b199a29 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 _0x6ce9=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','describe','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','/:id','update','/:id/accept','accept','put','/:id/reject','reject','delete','destroy','exports','multer','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6ce9,0x76));var _0x96ce=function(_0x5b4bbb,_0x4159fd){_0x5b4bbb=_0x5b4bbb-0x0;var _0x10e399=_0x6ce9[_0x5b4bbb];return _0x10e399;};'use strict';var multer=require(_0x96ce('0x0'));var util=require(_0x96ce('0x1'));var path=require(_0x96ce('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x96ce('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x96ce('0x4'));var interaction=require(_0x96ce('0x5'));var config=require(_0x96ce('0x6'));var controller=require(_0x96ce('0x7'));router['get']('/',auth[_0x96ce('0x8')](),controller[_0x96ce('0x9')]);router[_0x96ce('0xa')]('/describe',auth[_0x96ce('0x8')](),controller[_0x96ce('0xb')]);router[_0x96ce('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x96ce('0xc')]);router[_0x96ce('0xa')](_0x96ce('0xd'),auth[_0x96ce('0x8')](),controller[_0x96ce('0xe')]);router[_0x96ce('0xf')]('/',auth[_0x96ce('0x8')](),interaction[_0x96ce('0x10')](_0x96ce('0x11'),_0x96ce('0x12')),controller[_0x96ce('0x13')]);router['put'](_0x96ce('0x14'),auth[_0x96ce('0x8')](),controller[_0x96ce('0x15')]);router['put'](_0x96ce('0x16'),auth[_0x96ce('0x8')](),controller[_0x96ce('0x17')]);router[_0x96ce('0x18')](_0x96ce('0x19'),auth[_0x96ce('0x8')](),controller[_0x96ce('0x1a')]);router[_0x96ce('0x1b')](_0x96ce('0x14'),auth[_0x96ce('0x8')](),controller[_0x96ce('0x1c')]);module[_0x96ce('0x1d')]=router; \ No newline at end of file +var _0x6de9=['express','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','post','mail','mailmessage:create','put','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x6de9,0xe6));var _0x96de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6de9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x96de('0x0'));var util=require(_0x96de('0x1'));var path=require(_0x96de('0x2'));var timeout=require(_0x96de('0x3'));var express=require(_0x96de('0x4'));var router=express['Router']();var fs_extra=require(_0x96de('0x5'));var auth=require(_0x96de('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x96de('0x7'));var controller=require(_0x96de('0x8'));router['get']('/',auth[_0x96de('0x9')](),controller[_0x96de('0xa')]);router[_0x96de('0xb')](_0x96de('0xc'),auth['isAuthenticated'](),controller[_0x96de('0xd')]);router[_0x96de('0xb')](_0x96de('0xe'),auth['isAuthenticated'](),controller[_0x96de('0xf')]);router[_0x96de('0xb')](_0x96de('0x10'),auth['isAuthenticated'](),controller['download']);router[_0x96de('0x11')]('/',auth[_0x96de('0x9')](),interaction['tracked'](_0x96de('0x12'),_0x96de('0x13')),controller['create']);router['put'](_0x96de('0xe'),auth[_0x96de('0x9')](),controller['update']);router[_0x96de('0x14')]('/:id/accept',auth['isAuthenticated'](),controller[_0x96de('0x15')]);router[_0x96de('0x14')](_0x96de('0x16'),auth[_0x96de('0x9')](),controller[_0x96de('0x17')]);router['delete'](_0x96de('0xe'),auth[_0x96de('0x9')](),controller[_0x96de('0x18')]);module[_0x96de('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 2425131..91278c8 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 _0xce56=['long','INTEGER','Email','sequelize','lodash','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0xe6ae41,_0x3e7df1){var _0x468ab1=function(_0x4e43a9){while(--_0x4e43a9){_0xe6ae41['push'](_0xe6ae41['shift']());}};_0x468ab1(++_0x3e7df1);}(_0xce56,0x12f));var _0x6ce5=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0xce56[_0x3b96cf];return _0x2e315a;};'use strict';var Sequelize=require(_0x6ce5('0x0'));var _=require(_0x6ce5('0x1'));module[_0x6ce5('0x2')]={'body':{'type':Sequelize[_0x6ce5('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x6ce5('0x3')](_0x6ce5('0x4'))},'read':{'type':Sequelize[_0x6ce5('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6ce5('0x6')]('in',_0x6ce5('0x7')),'defaultValue':_0x6ce5('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x6ce5('0x8')](0x1fe)},'from':{'type':Sequelize[_0x6ce5('0x8')]},'to':{'type':Sequelize[_0x6ce5('0x3')](_0x6ce5('0x9'))},'cc':{'type':Sequelize[_0x6ce5('0x3')](_0x6ce5('0x9'))},'bcc':{'type':Sequelize[_0x6ce5('0x3')]('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x6ce5('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x6ce5('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x6ce5('0x3')](_0x6ce5('0x9'))},'originCc':{'type':Sequelize[_0x6ce5('0x3')](_0x6ce5('0x9'))},'originChannel':{'type':Sequelize['ENUM'](_0x6ce5('0xb'),'Chat'),'defaultValue':_0x6ce5('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x35f9=['DATE','Email','Chat','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','long'];(function(_0x563e94,_0x469aa0){var _0x433ec5=function(_0x5b2124){while(--_0x5b2124){_0x563e94['push'](_0x563e94['shift']());}};_0x433ec5(++_0x469aa0);}(_0x35f9,0x1d7));var _0x935f=function(_0x2be3b5,_0x2833f4){_0x2be3b5=_0x2be3b5-0x0;var _0x18a076=_0x35f9[_0x2be3b5];return _0x18a076;};'use strict';var Sequelize=require(_0x935f('0x0'));var _=require('lodash');module[_0x935f('0x1')]={'body':{'type':Sequelize[_0x935f('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x935f('0x2')](_0x935f('0x3'))},'read':{'type':Sequelize[_0x935f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x935f('0x5')]('in',_0x935f('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x935f('0x7')](0x1fe)},'from':{'type':Sequelize[_0x935f('0x7')]},'to':{'type':Sequelize[_0x935f('0x2')]('long')},'cc':{'type':Sequelize[_0x935f('0x2')](_0x935f('0x8'))},'bcc':{'type':Sequelize['TEXT'](_0x935f('0x8'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x935f('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x935f('0x9')]},'originTo':{'type':Sequelize[_0x935f('0x2')]('long')},'originCc':{'type':Sequelize[_0x935f('0x2')](_0x935f('0x8'))},'originChannel':{'type':Sequelize[_0x935f('0x5')](_0x935f('0xa'),_0x935f('0xb')),'defaultValue':_0x935f('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index b84ad1e..09cef06 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 _0x7d70=['email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','download','unix','join','server','files','message-%s.eml','bcc','subject','createdAt','Attachment','Attachments','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/interaction/service','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','socket.io-emitter','./mailMessage.socket','jayson/promise','http','client','request','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','name','send','index','map','MailMessage','rawAttributes','fieldName','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','show','params','body','find','describe','create','out','secret','MailAccount','findOne','MailAccountId','List','CmContact','Contacts','DESC','MailServerOut','Smtp','CloudProvider','attachments','root','server/files/attachments','defaults','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','acceptMessage','reject','agent','UserId','MailInteraction','MailInteractionId','interaction','get','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname'];(function(_0x4807bd,_0x20e039){var _0x4adca8=function(_0x5d2dcb){while(--_0x5d2dcb){_0x4807bd['push'](_0x4807bd['shift']());}};_0x4adca8(++_0x20e039);}(_0x7d70,0xba));var _0x07d7=function(_0x526a33,_0x1fd1ff){_0x526a33=_0x526a33-0x0;var _0x242f21=_0x7d70[_0x526a33];return _0x242f21;};'use strict';var emlformat=require(_0x07d7('0x0'));var moment=require(_0x07d7('0x1'));var util=require(_0x07d7('0x2'));var path=require(_0x07d7('0x3'));var fs=require('fs');var _=require(_0x07d7('0x4'));var Redis=require(_0x07d7('0x5'));var htmlToText=require(_0x07d7('0x6'));var interactionService=require(_0x07d7('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x07d7('0x8'))(_0x07d7('0x9'));var interaction_log=require(_0x07d7('0x8'))(_0x07d7('0xa'));var config=require(_0x07d7('0xb'));var db=require(_0x07d7('0xc'))['db'];config['redis']=_['defaults'](config[_0x07d7('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x07d7('0xe'))(new Redis(config[_0x07d7('0xd')]));var htmlEntities=require('html-entities');require(_0x07d7('0xf'))['register'](socket);var jayson=require(_0x07d7('0x10'));var client=jayson['client'][_0x07d7('0x11')]({'port':0x232c});var client9003=jayson[_0x07d7('0x12')][_0x07d7('0x11')]({'port':0x232b});var client9002=jayson[_0x07d7('0x12')][_0x07d7('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x48b03f,_0x167526,_0x28b674,_0x28fcc2){return new Promise(function(_0x279bbe,_0x2ddde2){var _0x213ed4=_0x28fcc2||client;return _0x213ed4[_0x07d7('0x13')](_0x48b03f,_0x28b674)['then'](function(_0x4e002d){logger['info'](_0x07d7('0x14'),_0x167526,_0x07d7('0x15'));logger[_0x07d7('0x16')](_0x07d7('0x17'),_0x167526,_0x07d7('0x15'),JSON[_0x07d7('0x18')](_0x4e002d));if(_0x4e002d[_0x07d7('0x19')]){if(_0x4e002d[_0x07d7('0x19')][_0x07d7('0x1a')]===0x1f4){logger[_0x07d7('0x19')](_0x07d7('0x14'),_0x167526,_0x4e002d[_0x07d7('0x19')][_0x07d7('0x1b')]);return _0x2ddde2(_0x4e002d['error'][_0x07d7('0x1b')]);}logger[_0x07d7('0x19')]('MailMessage,\x20%s,\x20%s',_0x167526,_0x4e002d['error']['message']);return _0x279bbe(_0x4e002d[_0x07d7('0x19')][_0x07d7('0x1b')]);}else{logger[_0x07d7('0x1c')](_0x07d7('0x14'),_0x167526,_0x07d7('0x15'));_0x279bbe(_0x4e002d['result'][_0x07d7('0x1b')]);}})[_0x07d7('0x1d')](function(_0x304620){logger[_0x07d7('0x19')](_0x07d7('0x14'),_0x167526,_0x304620);_0x2ddde2(_0x304620);});});}function respondWithResult(_0x18f50d,_0x5a2bbe){_0x5a2bbe=_0x5a2bbe||0xc8;return function(_0x1d5971){if(_0x1d5971){return _0x18f50d[_0x07d7('0x1e')](_0x5a2bbe)[_0x07d7('0x1f')](_0x1d5971);}};}function respondWithFilteredResult(_0x1a1089,_0x180446){return function(_0x95edda){if(_0x95edda){var _0x47a792=typeof _0x180446[_0x07d7('0x20')]===_0x07d7('0x21')&&typeof _0x180446[_0x07d7('0x22')]===_0x07d7('0x21');var _0x5e1790=_0x95edda['count'];var _0x2bc6a9=_0x47a792?0x0:_0x180446[_0x07d7('0x20')];var _0x3b1c02=_0x47a792?_0x95edda[_0x07d7('0x23')]:_0x180446[_0x07d7('0x20')]+_0x180446[_0x07d7('0x22')];var _0x22f3f7;if(_0x3b1c02>=_0x5e1790){_0x3b1c02=_0x5e1790;_0x22f3f7=0xc8;}else{_0x22f3f7=0xce;}_0x1a1089[_0x07d7('0x1e')](_0x22f3f7);return _0x1a1089[_0x07d7('0x24')](_0x07d7('0x25'),_0x2bc6a9+'-'+_0x3b1c02+'/'+_0x5e1790)[_0x07d7('0x1f')](_0x95edda);}return null;};}function saveUpdates(_0x19299f){return function(_0x49cd4b){if(_0x49cd4b){return _0x49cd4b[_0x07d7('0x26')](_0x19299f)[_0x07d7('0x27')](function(_0x35374a){return _0x35374a;});}return null;};}function removeEntity(_0x2eb84e){return function(_0xd33aaa){if(_0xd33aaa){return _0xd33aaa[_0x07d7('0x28')]()[_0x07d7('0x27')](function(){_0x2eb84e[_0x07d7('0x1e')](0xcc)[_0x07d7('0x29')]();});}};}function handleEntityNotFound(_0x244e87){return function(_0x45f865){if(!_0x45f865){_0x244e87[_0x07d7('0x2a')](0x194);}return _0x45f865;};}function handleError(_0x238ad5,_0x5db6fe){_0x5db6fe=_0x5db6fe||0x1f4;return function(_0x2fbc0e){logger['error'](_0x2fbc0e['stack']);if(_0x2fbc0e[_0x07d7('0x2b')]){delete _0x2fbc0e[_0x07d7('0x2b')];}_0x238ad5[_0x07d7('0x1e')](_0x5db6fe)[_0x07d7('0x2c')](_0x2fbc0e);};}exports[_0x07d7('0x2d')]=function(_0x33579a,_0x178d4e){var _0x3c663e={},_0x1102a1={},_0x23e073={'count':0x0,'rows':[]};var _0x2f6d30=_[_0x07d7('0x2e')](db[_0x07d7('0x2f')][_0x07d7('0x30')],function(_0xb5bb77){return{'name':_0xb5bb77[_0x07d7('0x31')],'type':_0xb5bb77['type'][_0x07d7('0x32')]};});_0x1102a1['model']=_['map'](_0x2f6d30,_0x07d7('0x2b'));_0x1102a1['query']=_[_0x07d7('0x33')](_0x33579a['query']);_0x1102a1[_0x07d7('0x34')]=_[_0x07d7('0x35')](_0x1102a1[_0x07d7('0x36')],_0x1102a1[_0x07d7('0x37')]);_0x3c663e[_0x07d7('0x38')]=_['intersection'](_0x1102a1['model'],qs[_0x07d7('0x39')](_0x33579a[_0x07d7('0x37')][_0x07d7('0x39')]));_0x3c663e[_0x07d7('0x38')]=_0x3c663e[_0x07d7('0x38')][_0x07d7('0x3a')]?_0x3c663e[_0x07d7('0x38')]:_0x1102a1[_0x07d7('0x36')];if(!_0x33579a[_0x07d7('0x37')][_0x07d7('0x3b')](_0x07d7('0x3c'))){_0x3c663e[_0x07d7('0x22')]=qs[_0x07d7('0x22')](_0x33579a[_0x07d7('0x37')]['limit']);_0x3c663e[_0x07d7('0x20')]=qs[_0x07d7('0x20')](_0x33579a[_0x07d7('0x37')][_0x07d7('0x20')]);}_0x3c663e[_0x07d7('0x3d')]=qs[_0x07d7('0x3e')](_0x33579a['query'][_0x07d7('0x3e')]);_0x3c663e[_0x07d7('0x3f')]=qs[_0x07d7('0x34')](_[_0x07d7('0x40')](_0x33579a[_0x07d7('0x37')],_0x1102a1['filters']),_0x2f6d30);if(_0x33579a[_0x07d7('0x37')][_0x07d7('0x41')]){_0x3c663e[_0x07d7('0x3f')]=_[_0x07d7('0x42')](_0x3c663e[_0x07d7('0x3f')],{'$or':_[_0x07d7('0x2e')](_0x2f6d30,function(_0x4d6a7e){if(_0x4d6a7e[_0x07d7('0x43')]!==_0x07d7('0x44')){var _0x4c3127={};_0x4c3127[_0x4d6a7e[_0x07d7('0x2b')]]={'$like':'%'+_0x33579a[_0x07d7('0x37')][_0x07d7('0x41')]+'%'};return _0x4c3127;}})});}_0x3c663e=_[_0x07d7('0x42')]({},_0x3c663e,_0x33579a['options']);var _0x7a77db={'where':_0x3c663e[_0x07d7('0x3f')]};return db[_0x07d7('0x2f')][_0x07d7('0x23')](_0x7a77db)[_0x07d7('0x27')](function(_0x48b03c){_0x23e073[_0x07d7('0x23')]=_0x48b03c;if(_0x33579a[_0x07d7('0x37')][_0x07d7('0x45')]){_0x3c663e[_0x07d7('0x46')]=[{'all':!![]}];}return db[_0x07d7('0x2f')]['findAll'](_0x3c663e);})[_0x07d7('0x27')](function(_0x4a8e2c){_0x23e073[_0x07d7('0x47')]=_0x4a8e2c;return _0x23e073;})[_0x07d7('0x27')](respondWithFilteredResult(_0x178d4e,_0x3c663e))[_0x07d7('0x1d')](handleError(_0x178d4e,null));};exports[_0x07d7('0x48')]=function(_0x298549,_0x149070){var _0x5deaa0={'raw':!![],'where':{'id':_0x298549[_0x07d7('0x49')]['id']}},_0x6da2f={};_0x6da2f[_0x07d7('0x36')]=_[_0x07d7('0x33')](db[_0x07d7('0x2f')]['rawAttributes']);_0x6da2f[_0x07d7('0x37')]=_[_0x07d7('0x33')](_0x298549[_0x07d7('0x37')]);_0x6da2f[_0x07d7('0x34')]=_[_0x07d7('0x35')](_0x6da2f[_0x07d7('0x36')],_0x6da2f[_0x07d7('0x37')]);_0x5deaa0['attributes']=_['intersection'](_0x6da2f[_0x07d7('0x36')],qs[_0x07d7('0x39')](_0x298549[_0x07d7('0x37')][_0x07d7('0x39')]));_0x5deaa0[_0x07d7('0x38')]=_0x5deaa0[_0x07d7('0x38')][_0x07d7('0x3a')]?_0x5deaa0['attributes']:_0x6da2f[_0x07d7('0x36')];if(_0x298549[_0x07d7('0x37')][_0x07d7('0x45')]){_0x5deaa0['include']=[{'all':!![]}];}_0x5deaa0=_[_0x07d7('0x42')]({},_0x5deaa0,_0x298549['options']);return db[_0x07d7('0x2f')]['find'](_0x5deaa0)[_0x07d7('0x27')](handleEntityNotFound(_0x149070,null))[_0x07d7('0x27')](respondWithResult(_0x149070,null))['catch'](handleError(_0x149070,null));};exports[_0x07d7('0x26')]=function(_0x2834c6,_0x2484b0){if(_0x2834c6['body']['id']){delete _0x2834c6[_0x07d7('0x4a')]['id'];}return db['MailMessage'][_0x07d7('0x4b')]({'where':{'id':_0x2834c6['params']['id']}})['then'](handleEntityNotFound(_0x2484b0,null))[_0x07d7('0x27')](saveUpdates(_0x2834c6[_0x07d7('0x4a')],null))[_0x07d7('0x27')](respondWithResult(_0x2484b0,null))['catch'](handleError(_0x2484b0,null));};exports[_0x07d7('0x28')]=function(_0x4344ad,_0x5332d0){return db[_0x07d7('0x2f')][_0x07d7('0x4b')]({'where':{'id':_0x4344ad[_0x07d7('0x49')]['id']}})['then'](handleEntityNotFound(_0x5332d0,null))[_0x07d7('0x27')](removeEntity(_0x5332d0,null))[_0x07d7('0x1d')](handleError(_0x5332d0,null));};exports[_0x07d7('0x4c')]=function(_0x1d54c2,_0xf0db46){return db[_0x07d7('0x2f')][_0x07d7('0x4c')]()[_0x07d7('0x27')](respondWithResult(_0xf0db46,null))[_0x07d7('0x1d')](handleError(_0xf0db46,null));};exports[_0x07d7('0x4d')]=function(_0x2fb57b,_0x1c76de){return db[_0x07d7('0x2f')]['create'](_0x2fb57b[_0x07d7('0x4a')])[_0x07d7('0x27')](function(_0x39d3a4){if(_0x39d3a4){if(_0x39d3a4['direction']===_0x07d7('0x4e')&&!_0x39d3a4[_0x07d7('0x4f')]){var _0x89d28d,_0x391f6f,_0x4760b2;if(_0x2fb57b[_0x07d7('0x4a')]['to']){_0x391f6f=_0x2fb57b[_0x07d7('0x4a')]['to']['split'](',')[0x0];}return db[_0x07d7('0x50')][_0x07d7('0x51')]({'where':{'id':_0x39d3a4[_0x07d7('0x52')]},'include':[{'model':db['CmList'],'as':_0x07d7('0x53'),'include':[{'model':db[_0x07d7('0x54')],'as':_0x07d7('0x55'),'where':{'email':_0x391f6f},'limit':0x1,'order':[['updatedAt',_0x07d7('0x56')]]}]},{'model':db[_0x07d7('0x57')],'as':_0x07d7('0x58'),'raw':!![],'include':[{'model':db[_0x07d7('0x59')],'as':_0x07d7('0x59'),'raw':!![]}]}]})['then'](function(_0x595742){_0x89d28d=_0x595742;if(!_0x89d28d||!_0x89d28d[_0x07d7('0x58')])return;var _0x6dd1f=_0x89d28d['getSmtpOptions']();if(_0x2fb57b[_0x07d7('0x4a')]['attachments']&&_0x2fb57b[_0x07d7('0x4a')]['attachments'][_0x07d7('0x3a')]){for(var _0x30d28b=0x0;_0x30d28b<_0x2fb57b[_0x07d7('0x4a')][_0x07d7('0x5a')][_0x07d7('0x3a')];_0x30d28b+=0x1){_0x2fb57b[_0x07d7('0x4a')][_0x07d7('0x5a')][_0x30d28b]={'filename':_0x2fb57b[_0x07d7('0x4a')][_0x07d7('0x5a')][_0x30d28b]['name'],'path':path['join'](config[_0x07d7('0x5b')],_0x07d7('0x5c'),_0x2fb57b['body']['attachments'][_0x30d28b]['basename'])};}}_0x4760b2={'account':_0x6dd1f,'message':_0x2fb57b[_0x07d7('0x4a')]};return;})[_0x07d7('0x27')](function(){if(_0x89d28d[_0x07d7('0x53')]){if(_0x89d28d[_0x07d7('0x53')][_0x07d7('0x55')]['length']){return _0x89d28d[_0x07d7('0x53')][_0x07d7('0x55')][0x0];}else{return db[_0x07d7('0x54')][_0x07d7('0x4d')](_[_0x07d7('0x5d')](_0x2fb57b[_0x07d7('0x4a')],{'firstName':_0x2fb57b['body']['to'],'email':_0x2fb57b[_0x07d7('0x4a')]['to'],'phone':_0x2fb57b[_0x07d7('0x4a')]['to'],'ListId':_0x89d28d[_0x07d7('0x5e')]}));}}else{throw new Error(_0x07d7('0x5f'));}})[_0x07d7('0x27')](function(){if(_0x4760b2){return respondWithRpcPromise(_0x07d7('0x60'),_0x07d7('0x61'),_0x4760b2,client9003)[_0x07d7('0x27')](function(_0x415349){return _0x39d3a4[_0x07d7('0x26')]({'read':!![],'messageId':_0x415349[_0x07d7('0x62')],'sentAt':moment()[_0x07d7('0x63')](_0x07d7('0x64'))});})[_0x07d7('0x1d')](function(_0x5a1fae){logger[_0x07d7('0x19')]('%s',JSON['stringify'](_0x5a1fae));return _0x39d3a4;});}return _0x39d3a4;});}return _0x39d3a4;}})['then'](respondWithResult(_0x1c76de,0xc9))['catch'](handleError(_0x1c76de,null));};exports[_0x07d7('0x65')]=function(_0x5607a4,_0x414b4e){var _0x3398e9=_0x07d7('0x66');return interactionService[_0x07d7('0x67')](_0x5607a4,_0x3398e9)[_0x07d7('0x27')](respondWithResult(_0x414b4e,null))[_0x07d7('0x1d')](handleError(_0x414b4e,null));};exports[_0x07d7('0x68')]=function(_0x24cc9e,_0x5f2d7c){var _0x4d0fe2={'agent':{},'channel':_0x07d7('0x66')};if(_0x24cc9e[_0x07d7('0x4a')]['id']){delete _0x24cc9e[_0x07d7('0x4a')]['id'];}_0x24cc9e[_0x07d7('0x4a')]['UserId']=_0x24cc9e[_0x07d7('0x4a')]['UserId']||_0x24cc9e['user']['id'];_0x4d0fe2[_0x07d7('0x69')]['id']=_0x24cc9e[_0x07d7('0x4a')][_0x07d7('0x6a')];return db[_0x07d7('0x2f')]['find']({'where':{'id':_0x24cc9e[_0x07d7('0x49')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5f2d7c,null))[_0x07d7('0x27')](function(_0xa7e2b7){if(_0xa7e2b7){_0x4d0fe2[_0x07d7('0x1b')]=_0xa7e2b7['get']({'plain':!![]});return db[_0x07d7('0x6b')][_0x07d7('0x4b')]({'where':{'id':_0xa7e2b7[_0x07d7('0x6c')]}});}return null;})['then'](handleEntityNotFound(_0x5f2d7c,null))['then'](function(_0x132781){if(_0x132781){_0x4d0fe2[_0x07d7('0x6d')]=_0x132781[_0x07d7('0x6e')]({'plain':!![]});interaction_log[_0x07d7('0x1c')](_0x07d7('0x6f'),_0x24cc9e[_0x07d7('0x70')]['id'],_0x24cc9e[_0x07d7('0x70')][_0x07d7('0x2b')],_0x24cc9e[_0x07d7('0x70')][_0x07d7('0x71')],_0x4d0fe2['interaction']['id'],_0x24cc9e['body']?JSON[_0x07d7('0x18')](_0x24cc9e[_0x07d7('0x4a')]):_0x07d7('0x72'));return respondWithRpcPromise('RejectMessage',_0x07d7('0x73'),_0x4d0fe2);}return null;})[_0x07d7('0x27')](function(_0x5344eb){var _0x3bea90=_0x07d7('0x74')+_0x5344eb[_0x07d7('0x1b')][_0x07d7('0x75')];return db['sequelize']['query'](_0x3bea90,{'type':db[_0x07d7('0x76')][_0x07d7('0x77')][_0x07d7('0x78')],'raw':!![]})[_0x07d7('0x27')](function(_0x496672){return _0x496672;});})[_0x07d7('0x27')](function(_0x4ddbab){if(_0x4ddbab){_0x4d0fe2[_0x07d7('0x1b')][_0x07d7('0x79')]=_0x4ddbab[0x0];if(!_0x24cc9e[_0x07d7('0x4a')][_0x07d7('0x6a')])return;return db[_0x07d7('0x7a')]['find']({'where':{'id':_0x24cc9e[_0x07d7('0x4a')]['UserId'],'role':_0x07d7('0x69')},'attributes':['id',_0x07d7('0x2b'),_0x07d7('0x7b'),_0x07d7('0x7c'),_0x07d7('0x7d')],'raw':!![]});}return null;})[_0x07d7('0x27')](function(_0xfdca44){if(!_0xfdca44)return null;_0x4d0fe2['message'][_0x07d7('0x69')]=_0xfdca44;return _0x4d0fe2;})[_0x07d7('0x27')](function(_0x28fd96){if(_0x28fd96){_0x28fd96[_0x07d7('0x1b')][_0x07d7('0x7e')]=util['format'](_0x07d7('0x7f'),_0x24cc9e[_0x07d7('0x70')][_0x07d7('0x2b')]);_0x28fd96[_0x07d7('0x1b')][_0x07d7('0x80')]=_0x4d0fe2['channel'];_0x28fd96['message'][_0x07d7('0x81')]=_0x4d0fe2[_0x07d7('0x80')];_0x28fd96[_0x07d7('0x1b')][_0x07d7('0x82')]=_0x07d7('0x68');_0x28fd96[_0x07d7('0x1b')]['body']=htmlToText['fromString'](_0x4d0fe2['message']['body']);respondWithRpcPromise(_0x07d7('0x83'),'EventManager',{'event':_0x07d7('0x84'),'message':_0x28fd96['message']},client9002);return _0x4d0fe2;}return null;})['then'](respondWithResult(_0x5f2d7c,null))[_0x07d7('0x1d')](handleError(_0x5f2d7c,null));};exports[_0x07d7('0x85')]=function(_0x1bc2c5,_0xb7da94){var _0x169277=moment()[_0x07d7('0x86')]()['toString']();var _0x4253ae=path[_0x07d7('0x87')](config[_0x07d7('0x5b')],_0x07d7('0x88'),_0x07d7('0x89'),'tmp');var _0xf2c505=path['join'](config[_0x07d7('0x5b')],_0x07d7('0x88'),_0x07d7('0x89'),_0x07d7('0x5a'));var _0x556395=util[_0x07d7('0x63')](_0x07d7('0x8a'),_0x169277);return db[_0x07d7('0x2f')][_0x07d7('0x4b')]({'where':{'id':_0x1bc2c5['params']['id']},'attributes':['id',_0x07d7('0x4a'),'from','to','cc',_0x07d7('0x8b'),_0x07d7('0x8c'),_0x07d7('0x8d')],'include':_0x1bc2c5[_0x07d7('0x37')][_0x07d7('0x5a')]?[{'model':db[_0x07d7('0x8e')],'as':_0x07d7('0x8f')}]:undefined})[_0x07d7('0x27')](handleEntityNotFound(_0xb7da94,null))['then'](function(_0x3c4c42){if(_0x3c4c42){var _0x3c6233=_0x3c4c42;var _0x2b06d5={'from':_0x3c6233[_0x07d7('0x90')],'to':_0x3c6233['to'],'subject':_0x3c6233[_0x07d7('0x8c')],'html':htmlEntities[_0x07d7('0x91')](_0x3c6233[_0x07d7('0x4a')]),'headers':{'Date':moment(_0x3c6233[_0x07d7('0x8d')])['format'](_0x07d7('0x92'))},'attachments':[]};if(_0x3c4c42['cc']){_0x2b06d5[_0x07d7('0x93')]['Cc']=_0x3c4c42['cc'];}if(_0x3c4c42[_0x07d7('0x8b')]){_0x2b06d5[_0x07d7('0x93')][_0x07d7('0x94')]=_0x3c4c42['bcc'];}return new Promise(function(_0x582678,_0x2dda9f){if(_0x3c4c42[_0x07d7('0x8f')]){for(var _0x95a78=0x0;_0x95a78<_0x3c4c42[_0x07d7('0x8f')][_0x07d7('0x3a')];_0x95a78++){var _0x5dae5f=_0x3c4c42[_0x07d7('0x8f')][_0x95a78];var _0x2e1626=path[_0x07d7('0x87')](_0xf2c505,_0x5dae5f[_0x07d7('0x95')]);if(fs['existsSync'](_0x2e1626)){_0x2b06d5[_0x07d7('0x5a')][_0x07d7('0x96')]({'name':_0x5dae5f['name'],'contentType':_0x5dae5f[_0x07d7('0x43')],'data':fs[_0x07d7('0x97')](_0x2e1626)});}}}emlformat[_0x07d7('0x98')](_0x2b06d5,function(_0x3b134c,_0x55c6e8){if(_0x3b134c)return _0x2dda9f(_0x3b134c);fs[_0x07d7('0x99')](path[_0x07d7('0x87')](_0x4253ae,_0x556395),_0x55c6e8);return _0x582678(_0x55c6e8);});});}})['then'](function(_0x1ff770){if(_0x1ff770){return _0xb7da94[_0x07d7('0x85')](path[_0x07d7('0x87')](_0x4253ae,_0x556395),_0x556395,function(_0x576d0e){if(!_0x576d0e)fs[_0x07d7('0x9a')](path[_0x07d7('0x87')](_0x4253ae,_0x556395));});}})[_0x07d7('0x1d')](handleError(_0xb7da94,null));}; \ No newline at end of file +var _0xa256=['find','params','describe','create','direction','out','secret','split','MailAccount','MailAccountId','CmList','List','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','root','basename','CmContact','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','acceptMessage','UserId','user','agent','get','MailInteraction','interaction','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','reject','fromString','EventManager','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','Attachment','Attachments','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','build','join','unlinkSync','moment','lodash','ioredis','html-to-text','../../components/interaction/service','../../config/logger','api','../../config/environment','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','http','client','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailMessage,\x20%s,\x20%s','result','status','offset','undefined','limit','count','set','Content-Range','json','destroy','end','name','send','index','map','MailMessage','rawAttributes','fieldName','type','model','query','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','intersection','includeAll','include','update','body'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xa256,0xe1));var _0x6a25=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xa256[_0x3826ad];return _0x17b900;};'use strict';var emlformat=require('eml-format');var moment=require(_0x6a25('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x6a25('0x1'));var Redis=require(_0x6a25('0x2'));var htmlToText=require(_0x6a25('0x3'));var interactionService=require(_0x6a25('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x6a25('0x5'))(_0x6a25('0x6'));var interaction_log=require(_0x6a25('0x5'))('mail-interactions');var config=require(_0x6a25('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x6a25('0x8'),'port':0x18eb});var socket=require(_0x6a25('0x9'))(new Redis(config['redis']));var htmlEntities=require(_0x6a25('0xa'));require(_0x6a25('0xb'))[_0x6a25('0xc')](socket);var jayson=require(_0x6a25('0xd'));var client=jayson['client'][_0x6a25('0xe')]({'port':0x232c});var client9003=jayson[_0x6a25('0xf')][_0x6a25('0xe')]({'port':0x232b});var client9002=jayson[_0x6a25('0xf')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f1bb9,_0x3fd6b4,_0x389d5a,_0x51e915){return new Promise(function(_0x36f8df,_0x57f5d7){var _0xede72c=_0x51e915||client;return _0xede72c['request'](_0x4f1bb9,_0x389d5a)[_0x6a25('0x10')](function(_0x2f3601){logger[_0x6a25('0x11')]('MailMessage,\x20%s,\x20%s',_0x3fd6b4,_0x6a25('0x12'));logger[_0x6a25('0x13')](_0x6a25('0x14'),_0x3fd6b4,_0x6a25('0x12'),JSON[_0x6a25('0x15')](_0x2f3601));if(_0x2f3601[_0x6a25('0x16')]){if(_0x2f3601[_0x6a25('0x16')][_0x6a25('0x17')]===0x1f4){logger[_0x6a25('0x16')]('MailMessage,\x20%s,\x20%s',_0x3fd6b4,_0x2f3601[_0x6a25('0x16')][_0x6a25('0x18')]);return _0x57f5d7(_0x2f3601['error'][_0x6a25('0x18')]);}logger[_0x6a25('0x16')](_0x6a25('0x19'),_0x3fd6b4,_0x2f3601[_0x6a25('0x16')][_0x6a25('0x18')]);return _0x36f8df(_0x2f3601[_0x6a25('0x16')]['message']);}else{logger['info'](_0x6a25('0x19'),_0x3fd6b4,'request\x20sent');_0x36f8df(_0x2f3601[_0x6a25('0x1a')][_0x6a25('0x18')]);}})['catch'](function(_0x2e48a7){logger[_0x6a25('0x16')]('MailMessage,\x20%s,\x20%s',_0x3fd6b4,_0x2e48a7);_0x57f5d7(_0x2e48a7);});});}function respondWithResult(_0x238cea,_0x22b004){_0x22b004=_0x22b004||0xc8;return function(_0x2ce37f){if(_0x2ce37f){return _0x238cea[_0x6a25('0x1b')](_0x22b004)['json'](_0x2ce37f);}};}function respondWithFilteredResult(_0xcca4b5,_0x552faf){return function(_0x2dbaaf){if(_0x2dbaaf){var _0x4b1490=typeof _0x552faf[_0x6a25('0x1c')]===_0x6a25('0x1d')&&typeof _0x552faf[_0x6a25('0x1e')]===_0x6a25('0x1d');var _0x28ecc6=_0x2dbaaf[_0x6a25('0x1f')];var _0x21bab8=_0x4b1490?0x0:_0x552faf[_0x6a25('0x1c')];var _0xe32cff=_0x4b1490?_0x2dbaaf[_0x6a25('0x1f')]:_0x552faf['offset']+_0x552faf[_0x6a25('0x1e')];var _0x215efa;if(_0xe32cff>=_0x28ecc6){_0xe32cff=_0x28ecc6;_0x215efa=0xc8;}else{_0x215efa=0xce;}_0xcca4b5['status'](_0x215efa);return _0xcca4b5[_0x6a25('0x20')](_0x6a25('0x21'),_0x21bab8+'-'+_0xe32cff+'/'+_0x28ecc6)[_0x6a25('0x22')](_0x2dbaaf);}return null;};}function saveUpdates(_0x29db29){return function(_0x38ea62){if(_0x38ea62){return _0x38ea62['update'](_0x29db29)[_0x6a25('0x10')](function(_0x1ee137){return _0x1ee137;});}return null;};}function removeEntity(_0x34e9f1){return function(_0x4058bf){if(_0x4058bf){return _0x4058bf[_0x6a25('0x23')]()[_0x6a25('0x10')](function(){_0x34e9f1[_0x6a25('0x1b')](0xcc)[_0x6a25('0x24')]();});}};}function handleEntityNotFound(_0x150f11){return function(_0x577388){if(!_0x577388){_0x150f11['sendStatus'](0x194);}return _0x577388;};}function handleError(_0x510648,_0xdf86c5){_0xdf86c5=_0xdf86c5||0x1f4;return function(_0x33467a){logger[_0x6a25('0x16')](_0x33467a['stack']);if(_0x33467a['name']){delete _0x33467a[_0x6a25('0x25')];}_0x510648[_0x6a25('0x1b')](_0xdf86c5)[_0x6a25('0x26')](_0x33467a);};}exports[_0x6a25('0x27')]=function(_0xf2fa36,_0x2a3939){var _0x2bdb04={},_0xf8c721={},_0x591328={'count':0x0,'rows':[]};var _0x2abdd2=_[_0x6a25('0x28')](db[_0x6a25('0x29')][_0x6a25('0x2a')],function(_0x3c9daa){return{'name':_0x3c9daa[_0x6a25('0x2b')],'type':_0x3c9daa[_0x6a25('0x2c')]['key']};});_0xf8c721[_0x6a25('0x2d')]=_['map'](_0x2abdd2,_0x6a25('0x25'));_0xf8c721[_0x6a25('0x2e')]=_['keys'](_0xf2fa36['query']);_0xf8c721[_0x6a25('0x2f')]=_['intersection'](_0xf8c721[_0x6a25('0x2d')],_0xf8c721[_0x6a25('0x2e')]);_0x2bdb04['attributes']=_['intersection'](_0xf8c721['model'],qs[_0x6a25('0x30')](_0xf2fa36[_0x6a25('0x2e')]['fields']));_0x2bdb04[_0x6a25('0x31')]=_0x2bdb04[_0x6a25('0x31')][_0x6a25('0x32')]?_0x2bdb04['attributes']:_0xf8c721[_0x6a25('0x2d')];if(!_0xf2fa36[_0x6a25('0x2e')][_0x6a25('0x33')]('nolimit')){_0x2bdb04[_0x6a25('0x1e')]=qs['limit'](_0xf2fa36[_0x6a25('0x2e')][_0x6a25('0x1e')]);_0x2bdb04[_0x6a25('0x1c')]=qs['offset'](_0xf2fa36[_0x6a25('0x2e')]['offset']);}_0x2bdb04[_0x6a25('0x34')]=qs[_0x6a25('0x35')](_0xf2fa36[_0x6a25('0x2e')][_0x6a25('0x35')]);_0x2bdb04[_0x6a25('0x36')]=qs[_0x6a25('0x2f')](_[_0x6a25('0x37')](_0xf2fa36[_0x6a25('0x2e')],_0xf8c721[_0x6a25('0x2f')]),_0x2abdd2);if(_0xf2fa36[_0x6a25('0x2e')][_0x6a25('0x38')]){_0x2bdb04[_0x6a25('0x36')]=_[_0x6a25('0x39')](_0x2bdb04['where'],{'$or':_[_0x6a25('0x28')](_0x2abdd2,function(_0x3d6062){if(_0x3d6062[_0x6a25('0x2c')]!==_0x6a25('0x3a')){var _0x50487f={};_0x50487f[_0x3d6062['name']]={'$like':'%'+_0xf2fa36[_0x6a25('0x2e')][_0x6a25('0x38')]+'%'};return _0x50487f;}})});}_0x2bdb04=_['merge']({},_0x2bdb04,_0xf2fa36[_0x6a25('0x3b')]);var _0x26da39={'where':_0x2bdb04[_0x6a25('0x36')]};return db[_0x6a25('0x29')][_0x6a25('0x1f')](_0x26da39)[_0x6a25('0x10')](function(_0x4d584d){_0x591328[_0x6a25('0x1f')]=_0x4d584d;if(_0xf2fa36[_0x6a25('0x2e')]['includeAll']){_0x2bdb04['include']=[{'all':!![]}];}return db[_0x6a25('0x29')][_0x6a25('0x3c')](_0x2bdb04);})[_0x6a25('0x10')](function(_0x1feaf4){_0x591328[_0x6a25('0x3d')]=_0x1feaf4;return _0x591328;})[_0x6a25('0x10')](respondWithFilteredResult(_0x2a3939,_0x2bdb04))[_0x6a25('0x3e')](handleError(_0x2a3939,null));};exports[_0x6a25('0x3f')]=function(_0xe61e03,_0x220254){var _0x5c05a3={'raw':!![],'where':{'id':_0xe61e03['params']['id']}},_0x2c88ac={};_0x2c88ac['model']=_['keys'](db['MailMessage']['rawAttributes']);_0x2c88ac[_0x6a25('0x2e')]=_['keys'](_0xe61e03[_0x6a25('0x2e')]);_0x2c88ac[_0x6a25('0x2f')]=_[_0x6a25('0x40')](_0x2c88ac[_0x6a25('0x2d')],_0x2c88ac[_0x6a25('0x2e')]);_0x5c05a3['attributes']=_[_0x6a25('0x40')](_0x2c88ac[_0x6a25('0x2d')],qs['fields'](_0xe61e03[_0x6a25('0x2e')]['fields']));_0x5c05a3['attributes']=_0x5c05a3[_0x6a25('0x31')][_0x6a25('0x32')]?_0x5c05a3[_0x6a25('0x31')]:_0x2c88ac[_0x6a25('0x2d')];if(_0xe61e03[_0x6a25('0x2e')][_0x6a25('0x41')]){_0x5c05a3[_0x6a25('0x42')]=[{'all':!![]}];}_0x5c05a3=_[_0x6a25('0x39')]({},_0x5c05a3,_0xe61e03[_0x6a25('0x3b')]);return db[_0x6a25('0x29')]['find'](_0x5c05a3)[_0x6a25('0x10')](handleEntityNotFound(_0x220254,null))[_0x6a25('0x10')](respondWithResult(_0x220254,null))[_0x6a25('0x3e')](handleError(_0x220254,null));};exports[_0x6a25('0x43')]=function(_0x17e431,_0x2762e0){if(_0x17e431['body']['id']){delete _0x17e431[_0x6a25('0x44')]['id'];}return db[_0x6a25('0x29')][_0x6a25('0x45')]({'where':{'id':_0x17e431[_0x6a25('0x46')]['id']}})[_0x6a25('0x10')](handleEntityNotFound(_0x2762e0,null))[_0x6a25('0x10')](saveUpdates(_0x17e431['body'],null))['then'](respondWithResult(_0x2762e0,null))[_0x6a25('0x3e')](handleError(_0x2762e0,null));};exports[_0x6a25('0x23')]=function(_0x26e053,_0x8fd620){return db['MailMessage']['find']({'where':{'id':_0x26e053[_0x6a25('0x46')]['id']}})['then'](handleEntityNotFound(_0x8fd620,null))['then'](removeEntity(_0x8fd620,null))[_0x6a25('0x3e')](handleError(_0x8fd620,null));};exports[_0x6a25('0x47')]=function(_0x521789,_0x1af5f6){return db[_0x6a25('0x29')][_0x6a25('0x47')]()[_0x6a25('0x10')](respondWithResult(_0x1af5f6,null))[_0x6a25('0x3e')](handleError(_0x1af5f6,null));};exports[_0x6a25('0x48')]=function(_0xd4618e,_0x9c3556){return db[_0x6a25('0x29')]['create'](_0xd4618e[_0x6a25('0x44')])[_0x6a25('0x10')](function(_0x142fd9){if(_0x142fd9){if(_0x142fd9[_0x6a25('0x49')]===_0x6a25('0x4a')&&!_0x142fd9[_0x6a25('0x4b')]){var _0xc6da7a,_0x5bd60a,_0x4950ed;if(_0xd4618e[_0x6a25('0x44')]['to']){_0x5bd60a=_0xd4618e[_0x6a25('0x44')]['to'][_0x6a25('0x4c')](',')[0x0];}return db[_0x6a25('0x4d')]['findOne']({'where':{'id':_0x142fd9[_0x6a25('0x4e')]},'include':[{'model':db[_0x6a25('0x4f')],'as':_0x6a25('0x50'),'include':[{'model':db['CmContact'],'as':_0x6a25('0x51'),'where':{'email':_0x5bd60a},'limit':0x1,'order':[[_0x6a25('0x52'),'DESC']]}]},{'model':db[_0x6a25('0x53')],'as':_0x6a25('0x54'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x6a25('0x55'),'raw':!![]}]}]})[_0x6a25('0x10')](function(_0x9e91e7){_0xc6da7a=_0x9e91e7;if(!_0xc6da7a||!_0xc6da7a['Smtp'])return;var _0x4ef13d=_0xc6da7a[_0x6a25('0x56')]();if(_0xd4618e[_0x6a25('0x44')][_0x6a25('0x57')]&&_0xd4618e['body'][_0x6a25('0x57')][_0x6a25('0x32')]){for(var _0x344913=0x0;_0x344913<_0xd4618e[_0x6a25('0x44')][_0x6a25('0x57')][_0x6a25('0x32')];_0x344913+=0x1){_0xd4618e[_0x6a25('0x44')][_0x6a25('0x57')][_0x344913]={'filename':_0xd4618e[_0x6a25('0x44')][_0x6a25('0x57')][_0x344913][_0x6a25('0x25')],'path':path['join'](config[_0x6a25('0x58')],'server/files/attachments',_0xd4618e[_0x6a25('0x44')][_0x6a25('0x57')][_0x344913][_0x6a25('0x59')])};}}_0x4950ed={'account':_0x4ef13d,'message':_0xd4618e[_0x6a25('0x44')]};return;})[_0x6a25('0x10')](function(){if(_0xc6da7a[_0x6a25('0x50')]){if(_0xc6da7a[_0x6a25('0x50')][_0x6a25('0x51')][_0x6a25('0x32')]){return _0xc6da7a[_0x6a25('0x50')][_0x6a25('0x51')][0x0];}else{return db[_0x6a25('0x5a')][_0x6a25('0x48')](_['defaults'](_0xd4618e['body'],{'firstName':_0xd4618e[_0x6a25('0x44')]['to'],'email':_0xd4618e[_0x6a25('0x44')]['to'],'phone':_0xd4618e[_0x6a25('0x44')]['to'],'ListId':_0xc6da7a['ListId']}));}}else{throw new Error('List\x20not\x20found');}})[_0x6a25('0x10')](function(){if(_0x4950ed){return respondWithRpcPromise(_0x6a25('0x5b'),_0x6a25('0x5c'),_0x4950ed,client9003)[_0x6a25('0x10')](function(_0x339635){return _0x142fd9[_0x6a25('0x43')]({'read':!![],'messageId':_0x339635[_0x6a25('0x5d')],'sentAt':moment()[_0x6a25('0x5e')](_0x6a25('0x5f'))});})[_0x6a25('0x3e')](function(_0x366147){logger[_0x6a25('0x16')]('%s',JSON[_0x6a25('0x15')](_0x366147));return _0x142fd9;});}return _0x142fd9;});}return _0x142fd9;}})[_0x6a25('0x10')](respondWithResult(_0x9c3556,0xc9))[_0x6a25('0x3e')](handleError(_0x9c3556,null));};exports[_0x6a25('0x60')]=function(_0x200e11,_0xee414b){var _0x4b5c78=_0x6a25('0x61');return interactionService[_0x6a25('0x62')](_0x200e11,_0x4b5c78)[_0x6a25('0x10')](respondWithResult(_0xee414b,null))[_0x6a25('0x3e')](handleError(_0xee414b,null));};exports['reject']=function(_0x37fa81,_0x5231cb){var _0xc679d9={'agent':{},'channel':'mail'};if(_0x37fa81[_0x6a25('0x44')]['id']){delete _0x37fa81[_0x6a25('0x44')]['id'];}_0x37fa81[_0x6a25('0x44')][_0x6a25('0x63')]=_0x37fa81[_0x6a25('0x44')][_0x6a25('0x63')]||_0x37fa81[_0x6a25('0x64')]['id'];_0xc679d9[_0x6a25('0x65')]['id']=_0x37fa81['body'][_0x6a25('0x63')];return db['MailMessage']['find']({'where':{'id':_0x37fa81[_0x6a25('0x46')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5231cb,null))[_0x6a25('0x10')](function(_0x2c39ad){if(_0x2c39ad){_0xc679d9[_0x6a25('0x18')]=_0x2c39ad[_0x6a25('0x66')]({'plain':!![]});return db[_0x6a25('0x67')]['find']({'where':{'id':_0x2c39ad['MailInteractionId']}});}return null;})[_0x6a25('0x10')](handleEntityNotFound(_0x5231cb,null))['then'](function(_0x43accf){if(_0x43accf){_0xc679d9['interaction']=_0x43accf[_0x6a25('0x66')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x37fa81[_0x6a25('0x64')]['id'],_0x37fa81[_0x6a25('0x64')][_0x6a25('0x25')],_0x37fa81[_0x6a25('0x64')]['role'],_0xc679d9[_0x6a25('0x68')]['id'],_0x37fa81[_0x6a25('0x44')]?JSON[_0x6a25('0x15')](_0x37fa81['body']):_0x6a25('0x69'));return respondWithRpcPromise(_0x6a25('0x6a'),'rejectMessage',_0xc679d9);}return null;})[_0x6a25('0x10')](function(_0x31920a){var _0x262737=_0x6a25('0x6b')+_0x31920a['message'][_0x6a25('0x6c')];return db['sequelize'][_0x6a25('0x2e')](_0x262737,{'type':db[_0x6a25('0x6d')][_0x6a25('0x6e')][_0x6a25('0x6f')],'raw':!![]})[_0x6a25('0x10')](function(_0x285be7){return _0x285be7;});})[_0x6a25('0x10')](function(_0x47df32){if(_0x47df32){_0xc679d9[_0x6a25('0x18')][_0x6a25('0x70')]=_0x47df32[0x0];if(!_0x37fa81['body'][_0x6a25('0x63')])return;return db[_0x6a25('0x71')][_0x6a25('0x45')]({'where':{'id':_0x37fa81['body'][_0x6a25('0x63')],'role':_0x6a25('0x65')},'attributes':['id',_0x6a25('0x25'),_0x6a25('0x72'),_0x6a25('0x73'),_0x6a25('0x74')],'raw':!![]});}return null;})[_0x6a25('0x10')](function(_0x170bd1){if(!_0x170bd1)return null;_0xc679d9[_0x6a25('0x18')]['agent']=_0x170bd1;return _0xc679d9;})[_0x6a25('0x10')](function(_0x49dfac){if(_0x49dfac){_0x49dfac[_0x6a25('0x18')][_0x6a25('0x75')]=util[_0x6a25('0x5e')](_0x6a25('0x76'),_0x37fa81[_0x6a25('0x64')][_0x6a25('0x25')]);_0x49dfac[_0x6a25('0x18')]['channel']=_0xc679d9[_0x6a25('0x77')];_0x49dfac['message'][_0x6a25('0x78')]=_0xc679d9[_0x6a25('0x77')];_0x49dfac['message'][_0x6a25('0x79')]=_0x6a25('0x7a');_0x49dfac['message'][_0x6a25('0x44')]=htmlToText[_0x6a25('0x7b')](_0xc679d9[_0x6a25('0x18')][_0x6a25('0x44')]);respondWithRpcPromise(_0x6a25('0x7c'),_0x6a25('0x7c'),{'event':'rejectmessage','message':_0x49dfac[_0x6a25('0x18')]},client9002);return _0xc679d9;}return null;})[_0x6a25('0x10')](respondWithResult(_0x5231cb,null))[_0x6a25('0x3e')](handleError(_0x5231cb,null));};exports[_0x6a25('0x7d')]=function(_0x21f7ae,_0xcf4725){var _0x50d3f9=moment()[_0x6a25('0x7e')]()[_0x6a25('0x7f')]();var _0x201c6f=path['join'](config['root'],_0x6a25('0x80'),_0x6a25('0x81'),_0x6a25('0x82'));var _0x189317=path['join'](config[_0x6a25('0x58')],_0x6a25('0x80'),'files',_0x6a25('0x57'));var _0x4d0c98=util[_0x6a25('0x5e')](_0x6a25('0x83'),_0x50d3f9);return db[_0x6a25('0x29')][_0x6a25('0x45')]({'where':{'id':_0x21f7ae[_0x6a25('0x46')]['id']},'attributes':['id',_0x6a25('0x44'),_0x6a25('0x84'),'to','cc',_0x6a25('0x85'),_0x6a25('0x86'),'createdAt'],'include':_0x21f7ae[_0x6a25('0x2e')]['attachments']?[{'model':db[_0x6a25('0x87')],'as':_0x6a25('0x88')}]:undefined})[_0x6a25('0x10')](handleEntityNotFound(_0xcf4725,null))[_0x6a25('0x10')](function(_0x173ef1){if(_0x173ef1){var _0x17cd8c=_0x173ef1;var _0x47d585={'from':_0x17cd8c[_0x6a25('0x84')],'to':_0x17cd8c['to'],'subject':_0x17cd8c[_0x6a25('0x86')],'html':htmlEntities[_0x6a25('0x89')](_0x17cd8c[_0x6a25('0x44')]),'headers':{'Date':moment(_0x17cd8c[_0x6a25('0x8a')])[_0x6a25('0x5e')](_0x6a25('0x8b'))},'attachments':[]};if(_0x173ef1['cc']){_0x47d585[_0x6a25('0x8c')]['Cc']=_0x173ef1['cc'];}if(_0x173ef1['bcc']){_0x47d585[_0x6a25('0x8c')][_0x6a25('0x8d')]=_0x173ef1[_0x6a25('0x85')];}return new Promise(function(_0x4ec0bb,_0x298a0e){if(_0x173ef1[_0x6a25('0x88')]){for(var _0x321e0e=0x0;_0x321e0e<_0x173ef1['Attachments'][_0x6a25('0x32')];_0x321e0e++){var _0xf72c75=_0x173ef1['Attachments'][_0x321e0e];var _0x6aabe6=path['join'](_0x189317,_0xf72c75['basename']);if(fs[_0x6a25('0x8e')](_0x6aabe6)){_0x47d585[_0x6a25('0x57')][_0x6a25('0x8f')]({'name':_0xf72c75[_0x6a25('0x25')],'contentType':_0xf72c75[_0x6a25('0x2c')],'data':fs['readFileSync'](_0x6aabe6)});}}}emlformat[_0x6a25('0x90')](_0x47d585,function(_0x12d9bf,_0x29c4f9){if(_0x12d9bf)return _0x298a0e(_0x12d9bf);fs['writeFileSync'](path[_0x6a25('0x91')](_0x201c6f,_0x4d0c98),_0x29c4f9);return _0x4ec0bb(_0x29c4f9);});});}})['then'](function(_0x47b604){if(_0x47b604){return _0xcf4725['download'](path['join'](_0x201c6f,_0x4d0c98),_0x4d0c98,function(_0x7b0d2a){if(!_0x7b0d2a)fs[_0x6a25('0x92')](path['join'](_0x201c6f,_0x4d0c98));});}})['catch'](handleError(_0xcf4725,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 8f42885..95eb4f9 100644 --- a/server/api/mailMessage/mailMessage.events.js +++ b/server/api/mailMessage/mailMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc7da=['hasOwnProperty','hook','events','../../mysqldb','MailMessage','update','remove','emit'];(function(_0x1cc5fe,_0x1dbdb8){var _0x4b27a4=function(_0x353b53){while(--_0x353b53){_0x1cc5fe['push'](_0x1cc5fe['shift']());}};_0x4b27a4(++_0x1dbdb8);}(_0xc7da,0x142));var _0xac7d=function(_0x5428d5,_0x13d28b){_0x5428d5=_0x5428d5-0x0;var _0xb29f9b=_0xc7da[_0x5428d5];return _0xb29f9b;};'use strict';var EventEmitter=require(_0xac7d('0x0'));var MailMessage=require(_0xac7d('0x1'))['db'][_0xac7d('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xac7d('0x3'),'afterDestroy':_0xac7d('0x4')};function emitEvent(_0x33dd16){return function(_0x11b047,_0x463c51,_0x589622){MailMessageEvents[_0xac7d('0x5')](_0x33dd16+':'+_0x11b047['id'],_0x11b047);MailMessageEvents[_0xac7d('0x5')](_0x33dd16,_0x11b047);_0x589622(null);};}for(var e in events){if(events[_0xac7d('0x6')](e)){var event=events[e];MailMessage[_0xac7d('0x7')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xb454=['events','MailMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x403225,_0x2bc476){var _0x40b322=function(_0x3742af){while(--_0x3742af){_0x403225['push'](_0x403225['shift']());}};_0x40b322(++_0x2bc476);}(_0xb454,0x1b0));var _0x4b45=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0xb454[_0x15ca1a];return _0x507626;};'use strict';var EventEmitter=require(_0x4b45('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x4b45('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x4b45('0x2')](0x0);var events={'afterCreate':_0x4b45('0x3'),'afterUpdate':_0x4b45('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3e6729){return function(_0x5474c3,_0x42a02e,_0xb8b254){MailMessageEvents['emit'](_0x3e6729+':'+_0x5474c3['id'],_0x5474c3);MailMessageEvents[_0x4b45('0x5')](_0x3e6729,_0x5474c3);_0xb8b254(null);};}for(var e in events){if(events[_0x4b45('0x6')](e)){var event=events[e];MailMessage[_0x4b45('0x7')](e,emitEvent(event));}}module[_0x4b45('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 6b6f37f..9984a95 100644 --- a/server/api/mailMessage/mailMessage.model.js +++ b/server/api/mailMessage/mailMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf974=['update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','request-promise','html-to-text','path','rimraf','../../config/environment','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','body','models','direction','toLowerCase','out','isNil','UserId','MailInteraction','findOne','MailInteractionId','then'];(function(_0x106ee4,_0x172ca9){var _0x397b09=function(_0x51f517){while(--_0x51f517){_0x106ee4['push'](_0x106ee4['shift']());}};_0x397b09(++_0x172ca9);}(_0xf974,0x141));var _0x4f97=function(_0x13a86a,_0xf387d2){_0x13a86a=_0x13a86a-0x0;var _0xc56502=_0xf974[_0x13a86a];return _0xc56502;};'use strict';var _=require('lodash');var util=require(_0x4f97('0x0'));var logger=require(_0x4f97('0x1'))(_0x4f97('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4f97('0x3'));var htmlToText=require(_0x4f97('0x4'));var fs=require('fs');var path=require(_0x4f97('0x5'));var rimraf=require(_0x4f97('0x6'));var config=require(_0x4f97('0x7'));var attributes=require('./mailMessage.attributes');module[_0x4f97('0x8')]=function(_0xf8d2a7,_0x1fd5c1){return _0xf8d2a7[_0x4f97('0x9')](_0x4f97('0xa'),attributes,{'tableName':_0x4f97('0xb'),'paranoid':![],'indexes':[{'name':_0x4f97('0xc'),'fields':[_0x4f97('0xc')]},{'name':_0x4f97('0xd'),'fields':[_0x4f97('0xe'),_0x4f97('0xf')],'type':_0x4f97('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x477724,_0x481a32,_0x8cde84){if(_0x477724['body']){_0x477724['plainBody']=htmlToText[_0x4f97('0x11')](_0x477724[_0x4f97('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x8cde84(null,_0x481a32);},'afterCreate':function(_0x443a98,_0x43ca50,_0x3cbf1d){var _0x4b8784=_0xf8d2a7[_0x4f97('0x13')];var _0x2f53c5=_0x443a98['get']({'plain':!![]});if(_0x2f53c5[_0x4f97('0x14')]['toLowerCase']()==='in'||_0x2f53c5[_0x4f97('0x14')][_0x4f97('0x15')]()===_0x4f97('0x16')&&!_0x2f53c5['secret']&&!_[_0x4f97('0x17')](_0x2f53c5[_0x4f97('0x18')])){_0x4b8784[_0x4f97('0x19')][_0x4f97('0x1a')]({'where':{'id':_0x2f53c5[_0x4f97('0x1b')]}})[_0x4f97('0x1c')](function(_0x389812){if(_0x389812){_0x389812[_0x4f97('0x1d')]({'lastMsgAt':_0x2f53c5[_0x4f97('0x1e')],'lastMsgDirection':_0x2f53c5[_0x4f97('0x14')][_0x4f97('0x15')]()});}})[_0x4f97('0x1f')](function(_0x50f7b3){console[_0x4f97('0x20')](_0x50f7b3);});}_0x3cbf1d();}},'charset':_0x4f97('0x21'),'collate':_0x4f97('0x22')});}; \ No newline at end of file +var _0x9ef9=['models','toLowerCase','out','secret','UserId','MailInteraction','findOne','MailInteractionId','then','update','direction','catch','error','lodash','util','../../config/logger','api','moment','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','body','plainBody','fromString'];(function(_0x322719,_0x16b381){var _0x30cb6f=function(_0x1e5698){while(--_0x1e5698){_0x322719['push'](_0x322719['shift']());}};_0x30cb6f(++_0x16b381);}(_0x9ef9,0x115));var _0x99ef=function(_0x5a2d1a,_0x24af9f){_0x5a2d1a=_0x5a2d1a-0x0;var _0xab3bab=_0x9ef9[_0x5a2d1a];return _0xab3bab;};'use strict';var _=require(_0x99ef('0x0'));var util=require(_0x99ef('0x1'));var logger=require(_0x99ef('0x2'))(_0x99ef('0x3'));var moment=require(_0x99ef('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0x99ef('0x5'));var fs=require('fs');var path=require(_0x99ef('0x6'));var rimraf=require(_0x99ef('0x7'));var config=require(_0x99ef('0x8'));var attributes=require(_0x99ef('0x9'));module[_0x99ef('0xa')]=function(_0x54e897,_0x1736f4){return _0x54e897[_0x99ef('0xb')](_0x99ef('0xc'),attributes,{'tableName':_0x99ef('0xd'),'paranoid':![],'indexes':[{'name':_0x99ef('0xe'),'fields':['messageId']},{'name':_0x99ef('0xf'),'fields':['plainBody',_0x99ef('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x481994,_0x3ad8d7,_0x23d794){if(_0x481994[_0x99ef('0x11')]){_0x481994[_0x99ef('0x12')]=htmlToText[_0x99ef('0x13')](_0x481994['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x23d794(null,_0x3ad8d7);},'afterCreate':function(_0x4874bb,_0xe1fc9b,_0x66f2f8){var _0x568502=_0x54e897[_0x99ef('0x14')];var _0x2280e6=_0x4874bb['get']({'plain':!![]});if(_0x2280e6['direction'][_0x99ef('0x15')]()==='in'||_0x2280e6['direction'][_0x99ef('0x15')]()===_0x99ef('0x16')&&!_0x2280e6[_0x99ef('0x17')]&&!_['isNil'](_0x2280e6[_0x99ef('0x18')])){_0x568502[_0x99ef('0x19')][_0x99ef('0x1a')]({'where':{'id':_0x2280e6[_0x99ef('0x1b')]}})[_0x99ef('0x1c')](function(_0xefc85a){if(_0xefc85a){_0xefc85a[_0x99ef('0x1d')]({'lastMsgAt':_0x2280e6['createdAt'],'lastMsgDirection':_0x2280e6[_0x99ef('0x1e')][_0x99ef('0x15')]()});}})[_0x99ef('0x1f')](function(_0xaa3d55){console[_0x99ef('0x20')](_0xaa3d55);});}_0x66f2f8();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 431e10e..763d9a4 100644 --- a/server/api/mailMessage/mailMessage.rpc.js +++ b/server/api/mailMessage/mailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefda=['redis','defaults','socket.io-emitter','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','body','options','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0xefda,0x96));var _0xaefd=function(_0x3b0209,_0x29d212){_0x3b0209=_0x3b0209-0x0;var _0x581f6e=_0xefda[_0x3b0209];return _0x581f6e;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaefd('0x1'));var rs=require(_0xaefd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaefd('0x3'))['db'];var utils=require(_0xaefd('0x4'));var logger=require(_0xaefd('0x5'))(_0xaefd('0x6'));var config=require(_0xaefd('0x7'));var jayson=require(_0xaefd('0x8'));var client=jayson['client'][_0xaefd('0x9')]({'port':0x232a});config[_0xaefd('0xa')]=_[_0xaefd('0xb')](config[_0xaefd('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xaefd('0xc'))(new Redis(config[_0xaefd('0xa')]));require(_0xaefd('0xd'))['register'](socket);function respondWithRpcPromise(_0x48a255,_0x54a3b1,_0xa6239d){return new BPromise(function(_0x16b36e,_0x20135c){return client[_0xaefd('0xe')](_0x48a255,_0xa6239d)[_0xaefd('0xf')](function(_0x1e00fb){logger[_0xaefd('0x10')](_0xaefd('0x11'),_0x54a3b1,_0xaefd('0x12'));logger[_0xaefd('0x13')](_0xaefd('0x14'),_0x54a3b1,'request\x20sent',JSON[_0xaefd('0x15')](_0x1e00fb));if(_0x1e00fb['error']){if(_0x1e00fb[_0xaefd('0x16')][_0xaefd('0x17')]===0x1f4){logger[_0xaefd('0x16')](_0xaefd('0x11'),_0x54a3b1,_0x1e00fb['error'][_0xaefd('0x18')]);return _0x20135c(_0x1e00fb[_0xaefd('0x16')][_0xaefd('0x18')]);}logger[_0xaefd('0x16')](_0xaefd('0x11'),_0x54a3b1,_0x1e00fb[_0xaefd('0x16')][_0xaefd('0x18')]);return _0x16b36e(_0x1e00fb[_0xaefd('0x16')]['message']);}else{logger[_0xaefd('0x10')](_0xaefd('0x11'),_0x54a3b1,_0xaefd('0x12'));_0x16b36e(_0x1e00fb[_0xaefd('0x19')][_0xaefd('0x18')]);}})[_0xaefd('0x1a')](function(_0x516e84){logger[_0xaefd('0x16')](_0xaefd('0x11'),_0x54a3b1,_0x516e84);_0x20135c(_0x516e84);});});}exports[_0xaefd('0x1b')]=function(_0x1260dd){var _0x45ebf2=this;return new Promise(function(_0x1f302c,_0x5282ed){return db[_0xaefd('0x1c')][_0xaefd('0x1d')](_0x1260dd[_0xaefd('0x1e')],{'raw':_0x1260dd[_0xaefd('0x1f')]?_0x1260dd[_0xaefd('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5b9967){logger[_0xaefd('0x10')](_0xaefd('0x1b'),_0x1260dd);logger[_0xaefd('0x13')]('CreateMailMessage',_0x1260dd,JSON[_0xaefd('0x15')](_0x5b9967));_0x1f302c(_0x5b9967);})['catch'](function(_0x3deec8){logger[_0xaefd('0x16')](_0xaefd('0x1b'),_0x3deec8['message'],_0x1260dd);_0x5282ed(_0x45ebf2[_0xaefd('0x16')](0x1f4,_0x3deec8[_0xaefd('0x18')]));});});}; \ No newline at end of file +var _0x28f2=['CreateMailMessage','MailMessage','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./mailMessage.socket','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x3049d9,_0x26afc1){var _0x52aabc=function(_0x2ea189){while(--_0x2ea189){_0x3049d9['push'](_0x3049d9['shift']());}};_0x52aabc(++_0x26afc1);}(_0x28f2,0x193));var _0x228f=function(_0x3aa817,_0x178311){_0x3aa817=_0x3aa817-0x0;var _0x4f88a6=_0x28f2[_0x3aa817];return _0x4f88a6;};'use strict';var _=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var moment=require(_0x228f('0x2'));var BPromise=require(_0x228f('0x3'));var rs=require(_0x228f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x228f('0x5'))['db'];var utils=require(_0x228f('0x6'));var logger=require(_0x228f('0x7'))(_0x228f('0x8'));var config=require(_0x228f('0x9'));var jayson=require(_0x228f('0xa'));var client=jayson[_0x228f('0xb')]['http']({'port':0x232a});config[_0x228f('0xc')]=_['defaults'](config[_0x228f('0xc')],{'host':_0x228f('0xd'),'port':0x18eb});var socket=require(_0x228f('0xe'))(new Redis(config['redis']));require(_0x228f('0xf'))['register'](socket);function respondWithRpcPromise(_0x212c90,_0x2dfd07,_0x4e26fe){return new BPromise(function(_0x3884c6,_0x40aca5){return client[_0x228f('0x10')](_0x212c90,_0x4e26fe)[_0x228f('0x11')](function(_0x3aa9bf){logger['info'](_0x228f('0x12'),_0x2dfd07,_0x228f('0x13'));logger[_0x228f('0x14')](_0x228f('0x15'),_0x2dfd07,_0x228f('0x13'),JSON[_0x228f('0x16')](_0x3aa9bf));if(_0x3aa9bf[_0x228f('0x17')]){if(_0x3aa9bf[_0x228f('0x17')]['code']===0x1f4){logger[_0x228f('0x17')](_0x228f('0x12'),_0x2dfd07,_0x3aa9bf[_0x228f('0x17')][_0x228f('0x18')]);return _0x40aca5(_0x3aa9bf[_0x228f('0x17')][_0x228f('0x18')]);}logger[_0x228f('0x17')]('MailMessage,\x20%s,\x20%s',_0x2dfd07,_0x3aa9bf[_0x228f('0x17')]['message']);return _0x3884c6(_0x3aa9bf[_0x228f('0x17')][_0x228f('0x18')]);}else{logger[_0x228f('0x19')]('MailMessage,\x20%s,\x20%s',_0x2dfd07,_0x228f('0x13'));_0x3884c6(_0x3aa9bf['result'][_0x228f('0x18')]);}})['catch'](function(_0x30cbc2){logger['error']('MailMessage,\x20%s,\x20%s',_0x2dfd07,_0x30cbc2);_0x40aca5(_0x30cbc2);});});}exports[_0x228f('0x1a')]=function(_0x52da36){var _0x302d54=this;return new Promise(function(_0x139373,_0x1294a8){return db[_0x228f('0x1b')][_0x228f('0x1c')](_0x52da36[_0x228f('0x1d')],{'raw':_0x52da36[_0x228f('0x1e')]?_0x52da36[_0x228f('0x1e')][_0x228f('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x1e96d4){logger[_0x228f('0x19')](_0x228f('0x1a'),_0x52da36);logger[_0x228f('0x14')](_0x228f('0x1a'),_0x52da36,JSON[_0x228f('0x16')](_0x1e96d4));_0x139373(_0x1e96d4);})[_0x228f('0x20')](function(_0x20c111){logger[_0x228f('0x17')]('CreateMailMessage',_0x20c111[_0x228f('0x18')],_0x52da36);_0x1294a8(_0x302d54[_0x228f('0x17')](0x1f4,_0x20c111[_0x228f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 7eace5a..9fd18c6 100644 --- a/server/api/mailMessage/mailMessage.socket.js +++ b/server/api/mailMessage/mailMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf5f9=['update','emit','removeListener','length','./mailMessage.events','save'];(function(_0x2e650f,_0x1daa80){var _0x2dafa1=function(_0x46e113){while(--_0x46e113){_0x2e650f['push'](_0x2e650f['shift']());}};_0x2dafa1(++_0x1daa80);}(_0xf5f9,0x6a));var _0x9f5f=function(_0x3ca08f,_0x47d44d){_0x3ca08f=_0x3ca08f-0x0;var _0xdd4afb=_0xf5f9[_0x3ca08f];return _0xdd4afb;};'use strict';var MailMessageEvents=require(_0x9f5f('0x0'));var events=[_0x9f5f('0x1'),'remove',_0x9f5f('0x2')];function createListener(_0x1d4fa5,_0x2ad3e8){return function(_0x49ccbd){_0x2ad3e8[_0x9f5f('0x3')](_0x1d4fa5,_0x49ccbd);};}function removeListener(_0x2dd50e,_0x26f637){return function(){MailMessageEvents[_0x9f5f('0x4')](_0x2dd50e,_0x26f637);};}exports['register']=function(_0x1992f6){for(var _0x3a4855=0x0,_0x5870e9=events[_0x9f5f('0x5')];_0x3a4855<_0x5870e9;_0x3a4855++){var _0x3c48a7=events[_0x3a4855];var _0x29a7e7=createListener('mailMessage:'+_0x3c48a7,_0x1992f6);MailMessageEvents['on'](_0x3c48a7,_0x29a7e7);}}; \ No newline at end of file +var _0x951a=['emit','removeListener','register','length','mailMessage:','./mailMessage.events','save','remove','update'];(function(_0x2f89c4,_0x5eaa33){var _0x21c5cc=function(_0x5dad44){while(--_0x5dad44){_0x2f89c4['push'](_0x2f89c4['shift']());}};_0x21c5cc(++_0x5eaa33);}(_0x951a,0x101));var _0xa951=function(_0x1dd9b0,_0x5cafc6){_0x1dd9b0=_0x1dd9b0-0x0;var _0x1d2c46=_0x951a[_0x1dd9b0];return _0x1d2c46;};'use strict';var MailMessageEvents=require(_0xa951('0x0'));var events=[_0xa951('0x1'),_0xa951('0x2'),_0xa951('0x3')];function createListener(_0x2064c4,_0x4c37bc){return function(_0x30eeeb){_0x4c37bc[_0xa951('0x4')](_0x2064c4,_0x30eeeb);};}function removeListener(_0x30212e,_0x3ee75f){return function(){MailMessageEvents[_0xa951('0x5')](_0x30212e,_0x3ee75f);};}exports[_0xa951('0x6')]=function(_0x534b24){for(var _0x3b9deb=0x0,_0x50444b=events[_0xa951('0x7')];_0x3b9deb<_0x50444b;_0x3b9deb++){var _0x2b67d6=events[_0x3b9deb];var _0x5daaba=createListener(_0xa951('0x8')+_0x2b67d6,_0x534b24);MailMessageEvents['on'](_0x2b67d6,_0x5daaba);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index fff08c1..dfe15d9 100644 --- a/server/api/mailQueue/index.js +++ b/server/api/mailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fdc=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path'];(function(_0x278eec,_0xf13922){var _0x4da955=function(_0x11ea08){while(--_0x11ea08){_0x278eec['push'](_0x278eec['shift']());}};_0x4da955(++_0xf13922);}(_0x5fdc,0x10b));var _0xc5fd=function(_0x2961fe,_0x59f0be){_0x2961fe=_0x2961fe-0x0;var _0x52897f=_0x5fdc[_0x2961fe];return _0x52897f;};'use strict';var multer=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var path=require(_0xc5fd('0x2'));var timeout=require(_0xc5fd('0x3'));var express=require('express');var router=express[_0xc5fd('0x4')]();var fs_extra=require(_0xc5fd('0x5'));var auth=require(_0xc5fd('0x6'));var interaction=require(_0xc5fd('0x7'));var config=require('../../config/environment');var controller=require(_0xc5fd('0x8'));router[_0xc5fd('0x9')]('/',auth['isAuthenticated'](),controller[_0xc5fd('0xa')]);router[_0xc5fd('0x9')](_0xc5fd('0xb'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0xd')]);router[_0xc5fd('0x9')](_0xc5fd('0xe'),auth[_0xc5fd('0xc')](),controller['show']);router[_0xc5fd('0x9')](_0xc5fd('0xf'),auth[_0xc5fd('0xc')](),controller['getMembers']);router[_0xc5fd('0x9')](_0xc5fd('0x10'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x11')]);router[_0xc5fd('0x9')](_0xc5fd('0x12'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x13')]);router['post']('/',auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x14')]);router[_0xc5fd('0x15')]('/:id/teams',auth[_0xc5fd('0xc')](),controller['addTeams']);router[_0xc5fd('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0xc5fd('0x16')]);router[_0xc5fd('0x17')](_0xc5fd('0xe'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x18')]);router['delete'](_0xc5fd('0xe'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x19')]);router[_0xc5fd('0x1a')](_0xc5fd('0x10'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x1b')]);router[_0xc5fd('0x1a')](_0xc5fd('0x12'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x1c')]);module[_0xc5fd('0x1d')]=router; \ No newline at end of file +var _0xb9de=['index','/describe','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','update','delete','destroy','removeTeams','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get'];(function(_0x253b13,_0x247a2f){var _0x396bcc=function(_0x152c32){while(--_0x152c32){_0x253b13['push'](_0x253b13['shift']());}};_0x396bcc(++_0x247a2f);}(_0xb9de,0x18d));var _0xeb9d=function(_0x125bf0,_0x279b96){_0x125bf0=_0x125bf0-0x0;var _0x25f0bf=_0xb9de[_0x125bf0];return _0x25f0bf;};'use strict';var multer=require(_0xeb9d('0x0'));var util=require(_0xeb9d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xeb9d('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeb9d('0x3'));var interaction=require(_0xeb9d('0x4'));var config=require(_0xeb9d('0x5'));var controller=require(_0xeb9d('0x6'));router[_0xeb9d('0x7')]('/',auth['isAuthenticated'](),controller[_0xeb9d('0x8')]);router[_0xeb9d('0x7')](_0xeb9d('0x9'),auth[_0xeb9d('0xa')](),controller[_0xeb9d('0xb')]);router['get'](_0xeb9d('0xc'),auth[_0xeb9d('0xa')](),controller[_0xeb9d('0xd')]);router[_0xeb9d('0x7')](_0xeb9d('0xe'),auth[_0xeb9d('0xa')](),controller['getMembers']);router[_0xeb9d('0x7')](_0xeb9d('0xf'),auth[_0xeb9d('0xa')](),controller[_0xeb9d('0x10')]);router[_0xeb9d('0x7')](_0xeb9d('0x11'),auth[_0xeb9d('0xa')](),controller[_0xeb9d('0x12')]);router[_0xeb9d('0x13')]('/',auth[_0xeb9d('0xa')](),controller[_0xeb9d('0x14')]);router[_0xeb9d('0x13')](_0xeb9d('0xf'),auth[_0xeb9d('0xa')](),controller['addTeams']);router[_0xeb9d('0x13')]('/:id/users',auth[_0xeb9d('0xa')](),controller[_0xeb9d('0x15')]);router['put'](_0xeb9d('0xc'),auth[_0xeb9d('0xa')](),controller[_0xeb9d('0x16')]);router[_0xeb9d('0x17')](_0xeb9d('0xc'),auth['isAuthenticated'](),controller[_0xeb9d('0x18')]);router['delete'](_0xeb9d('0xf'),auth[_0xeb9d('0xa')](),controller[_0xeb9d('0x19')]);router[_0xeb9d('0x17')](_0xeb9d('0x11'),auth[_0xeb9d('0xa')](),controller['removeAgents']);module[_0xeb9d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 8cc0793..8716e87 100644 --- a/server/api/mailQueue/mailQueue.attributes.js +++ b/server/api/mailQueue/mailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x63c6=['ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x5c92a5,_0x5862a9){var _0x2428c1=function(_0x3032e7){while(--_0x3032e7){_0x5c92a5['push'](_0x5c92a5['shift']());}};_0x2428c1(++_0x5862a9);}(_0x63c6,0x141));var _0x663c=function(_0x1c389c,_0x20d10b){_0x1c389c=_0x1c389c-0x0;var _0x3621d2=_0x63c6[_0x1c389c];return _0x3621d2;};'use strict';var Sequelize=require(_0x663c('0x0'));module[_0x663c('0x1')]={'name':{'type':Sequelize[_0x663c('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x663c('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x663c('0x3')](_0x663c('0x4'),_0x663c('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x8a40=['exports','name','STRING','ENUM','beepall','roundrobin','sequelize'];(function(_0x3c2024,_0x4c2148){var _0x2a838c=function(_0x2da3ce){while(--_0x2da3ce){_0x3c2024['push'](_0x3c2024['shift']());}};_0x2a838c(++_0x4c2148);}(_0x8a40,0xfb));var _0x08a4=function(_0x4254d1,_0x5121c6){_0x4254d1=_0x4254d1-0x0;var _0x1292ff=_0x8a40[_0x4254d1];return _0x1292ff;};'use strict';var Sequelize=require(_0x08a4('0x0'));module[_0x08a4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x08a4('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x08a4('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x08a4('0x4')]('rrmemory',_0x08a4('0x5'),_0x08a4('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 53a4f79..5abe73b 100644 --- a/server/api/mailQueue/mailQueue.controller.js +++ b/server/api/mailQueue/mailQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c8b=['transaction','each','findOrCreate','forEach','emit','removeTeams','Team','select','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','value','isEmpty','removeAgents','addAgents','omit','userMailQueue:save','isArray','userMailQueue:remove','getAgents','filter','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','MailQueues','UserProfileResource','error','stack','name','send','map','MailQueue','rawAttributes','fieldName','key','getOptions','where','include','findAll','rows','catch','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserMailQueue','nolimit','sort','pick','MailQueueId','findAndCountAll','UserId','agent','createdAt','%s/%s','mailPause','getTeams','order','hasOwnProperty','ids','User','Agents','online','voicePause','interface','flatMap'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x3c8b,0x9a));var _0xb3c8=function(_0x583f3b,_0x46c491){_0x583f3b=_0x583f3b-0x0;var _0x3c1699=_0x3c8b[_0x583f3b];return _0x3c1699;};'use strict';var BPromise=require('bluebird');var util=require(_0xb3c8('0x0'));var _=require(_0xb3c8('0x1'));var squel=require(_0xb3c8('0x2'));var Redis=require(_0xb3c8('0x3'));var qs=require(_0xb3c8('0x4'));var logger=require('../../config/logger')(_0xb3c8('0x5'));var config=require(_0xb3c8('0x6'));var db=require(_0xb3c8('0x7'))['db'];config[_0xb3c8('0x8')]=_[_0xb3c8('0x9')](config[_0xb3c8('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xb3c8('0xa'))(new Redis(config['redis']));require(_0xb3c8('0xb'))['register'](socket);function respondWithStatusCode(_0x3301c7,_0x450f4e){_0x450f4e=_0x450f4e||0xcc;return function(_0x5549c1){if(_0x5549c1){return _0x3301c7[_0xb3c8('0xc')](_0x450f4e);}return _0x3301c7[_0xb3c8('0xd')](_0x450f4e)[_0xb3c8('0xe')]();};}function respondWithResult(_0x11fd93,_0x2c9e6d){_0x2c9e6d=_0x2c9e6d||0xc8;return function(_0xc4e56a){if(_0xc4e56a){return _0x11fd93[_0xb3c8('0xd')](_0x2c9e6d)[_0xb3c8('0xf')](_0xc4e56a);}};}function respondWithFilteredResult(_0x5e3a84,_0x302572){return function(_0x1e6373){if(_0x1e6373){var _0x4ac7de=typeof _0x302572[_0xb3c8('0x10')]==='undefined'&&typeof _0x302572[_0xb3c8('0x11')]===_0xb3c8('0x12');var _0x392cd3=_0x1e6373[_0xb3c8('0x13')];var _0x465383=_0x4ac7de?0x0:_0x302572[_0xb3c8('0x10')];var _0x4ed4f1=_0x4ac7de?_0x1e6373['count']:_0x302572[_0xb3c8('0x10')]+_0x302572[_0xb3c8('0x11')];var _0xebb2d8;if(_0x4ed4f1>=_0x392cd3){_0x4ed4f1=_0x392cd3;_0xebb2d8=0xc8;}else{_0xebb2d8=0xce;}_0x5e3a84[_0xb3c8('0xd')](_0xebb2d8);return _0x5e3a84[_0xb3c8('0x14')](_0xb3c8('0x15'),_0x465383+'-'+_0x4ed4f1+'/'+_0x392cd3)[_0xb3c8('0xf')](_0x1e6373);}return null;};}function saveUpdates(_0x288bcc){return function(_0x315e24){if(_0x315e24){return _0x315e24[_0xb3c8('0x16')](_0x288bcc)[_0xb3c8('0x17')](function(_0x581f6a){return _0x581f6a;});}return null;};}function removeEntity(_0xcf249f){return function(_0x44ba8f){if(_0x44ba8f){return _0x44ba8f[_0xb3c8('0x18')]()[_0xb3c8('0x17')](function(){var _0x528dd0=_0x44ba8f['get']({'plain':!![]});var _0x35f532=_0xb3c8('0x19');return db[_0xb3c8('0x1a')][_0xb3c8('0x18')]({'where':{'type':_0x35f532,'resourceId':_0x528dd0['id']}})['then'](function(){return _0x44ba8f;});})[_0xb3c8('0x17')](function(){_0xcf249f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x499444){return function(_0x1840e7){if(!_0x1840e7){_0x499444[_0xb3c8('0xc')](0x194);}return _0x1840e7;};}function handleError(_0x526cb3,_0x482234){_0x482234=_0x482234||0x1f4;return function(_0x382211){logger[_0xb3c8('0x1b')](_0x382211[_0xb3c8('0x1c')]);if(_0x382211[_0xb3c8('0x1d')]){delete _0x382211['name'];}_0x526cb3[_0xb3c8('0xd')](_0x482234)[_0xb3c8('0x1e')](_0x382211);};}exports['index']=function(_0x2ec839,_0x2e4429){var _0x2ffb72={};var _0x18e6cf={'count':0x0,'rows':[]};var _0x36bd85=_[_0xb3c8('0x1f')](db[_0xb3c8('0x20')][_0xb3c8('0x21')],function(_0x579553){return{'name':_0x579553[_0xb3c8('0x22')],'type':_0x579553['type'][_0xb3c8('0x23')]};});_0x2ffb72=qs[_0xb3c8('0x24')](_0x36bd85,_0x2ec839);var _0x29842a={'where':_0x2ffb72[_0xb3c8('0x25')]};return db[_0xb3c8('0x20')]['count'](_0x29842a)[_0xb3c8('0x17')](function(_0x2aa29e){_0x18e6cf['count']=_0x2aa29e;_0x2ffb72[_0xb3c8('0x26')]=qs[_0xb3c8('0x26')](_0x2ec839['query']);return db[_0xb3c8('0x20')][_0xb3c8('0x27')](_0x2ffb72);})[_0xb3c8('0x17')](function(_0x490515){_0x18e6cf[_0xb3c8('0x28')]=_0x490515;return _0x18e6cf;})['then'](respondWithFilteredResult(_0x2e4429,_0x2ffb72))[_0xb3c8('0x29')](handleError(_0x2e4429,null));};exports[_0xb3c8('0x2a')]=function(_0x23a5fd,_0x28aa5a){var _0x2d80f6={'raw':!![],'where':{'id':_0x23a5fd['params']['id']}},_0x4527a9={};_0x4527a9['model']=_[_0xb3c8('0x2b')](db[_0xb3c8('0x20')][_0xb3c8('0x21')]);_0x4527a9[_0xb3c8('0x2c')]=_['keys'](_0x23a5fd[_0xb3c8('0x2c')]);_0x4527a9[_0xb3c8('0x2d')]=_[_0xb3c8('0x2e')](_0x4527a9[_0xb3c8('0x2f')],_0x4527a9[_0xb3c8('0x2c')]);_0x2d80f6[_0xb3c8('0x30')]=_[_0xb3c8('0x2e')](_0x4527a9[_0xb3c8('0x2f')],qs[_0xb3c8('0x31')](_0x23a5fd[_0xb3c8('0x2c')][_0xb3c8('0x31')]));_0x2d80f6[_0xb3c8('0x30')]=_0x2d80f6[_0xb3c8('0x30')][_0xb3c8('0x32')]?_0x2d80f6['attributes']:_0x4527a9[_0xb3c8('0x2f')];if(_0x23a5fd[_0xb3c8('0x2c')][_0xb3c8('0x33')]){_0x2d80f6[_0xb3c8('0x26')]=[{'all':!![]}];}_0x2d80f6=_[_0xb3c8('0x34')]({},_0x2d80f6,_0x23a5fd[_0xb3c8('0x35')]);return db['MailQueue']['find'](_0x2d80f6)[_0xb3c8('0x17')](handleEntityNotFound(_0x28aa5a,null))[_0xb3c8('0x17')](respondWithResult(_0x28aa5a,null))['catch'](handleError(_0x28aa5a,null));};exports['create']=function(_0x5ef7bc,_0x27c420){return db[_0xb3c8('0x20')]['create'](_0x5ef7bc[_0xb3c8('0x36')],{})[_0xb3c8('0x17')](function(_0x23e70a){var _0x396f95=_0x5ef7bc[_0xb3c8('0x37')][_0xb3c8('0x38')]({'plain':!![]});if(!_0x396f95)throw new Error(_0xb3c8('0x39'));if(_0x396f95[_0xb3c8('0x3a')]===_0xb3c8('0x37')){var _0x123b47=_0x23e70a['get']({'plain':!![]});var _0x726d71='MailQueues';return db[_0xb3c8('0x3b')][_0xb3c8('0x3c')]({'where':{'name':_0x726d71,'userProfileId':_0x396f95[_0xb3c8('0x3d')]},'raw':!![]})[_0xb3c8('0x17')](function(_0x5ef677){if(_0x5ef677&&_0x5ef677[_0xb3c8('0x3e')]===0x0){return db[_0xb3c8('0x1a')][_0xb3c8('0x3f')]({'name':_0x123b47[_0xb3c8('0x1d')],'resourceId':_0x123b47['id'],'type':_0x5ef677[_0xb3c8('0x1d')],'sectionId':_0x5ef677['id']},{})[_0xb3c8('0x17')](function(){return _0x23e70a;});}else{return _0x23e70a;}})[_0xb3c8('0x29')](function(_0xf866ab){logger[_0xb3c8('0x1b')](_0xb3c8('0x40'),_0xf866ab);throw _0xf866ab;});}return _0x23e70a;})[_0xb3c8('0x17')](respondWithResult(_0x27c420,0xc9))[_0xb3c8('0x29')](handleError(_0x27c420,null));};exports[_0xb3c8('0x16')]=function(_0x5c5c7c,_0x53e315){if(_0x5c5c7c['body']['id']){delete _0x5c5c7c[_0xb3c8('0x36')]['id'];}return db[_0xb3c8('0x20')][_0xb3c8('0x3c')]({'where':{'id':_0x5c5c7c[_0xb3c8('0x41')]['id']}})[_0xb3c8('0x17')](handleEntityNotFound(_0x53e315,null))['then'](saveUpdates(_0x5c5c7c[_0xb3c8('0x36')],null))[_0xb3c8('0x17')](respondWithResult(_0x53e315,null))[_0xb3c8('0x29')](handleError(_0x53e315,null));};exports[_0xb3c8('0x18')]=function(_0x3e13bb,_0x3e437a){return db[_0xb3c8('0x20')][_0xb3c8('0x3c')]({'where':{'id':_0x3e13bb[_0xb3c8('0x41')]['id']}})[_0xb3c8('0x17')](handleEntityNotFound(_0x3e437a,null))['then'](removeEntity(_0x3e437a,null))[_0xb3c8('0x29')](handleError(_0x3e437a,null));};exports[_0xb3c8('0x42')]=function(_0xab9fb6,_0x4bb189){return db[_0xb3c8('0x20')]['describe']()[_0xb3c8('0x17')](respondWithResult(_0x4bb189,null))[_0xb3c8('0x29')](handleError(_0x4bb189,null));};exports[_0xb3c8('0x43')]=function(_0x1da204,_0x5e7a3b){var _0x461f62={'raw':!![],'where':{}},_0xd20afa={},_0x490362;return db[_0xb3c8('0x20')][_0xb3c8('0x44')]({'where':{'id':_0x1da204[_0xb3c8('0x41')]['id']}})['then'](handleEntityNotFound(_0x5e7a3b,null))[_0xb3c8('0x17')](function(_0x4d7e54){if(_0x4d7e54){_0x490362=_0x4d7e54[_0xb3c8('0x38')]({'plain':!![]});_0xd20afa[_0xb3c8('0x2f')]=_['keys'](db[_0xb3c8('0x45')][_0xb3c8('0x21')]);_0xd20afa[_0xb3c8('0x2c')]=_[_0xb3c8('0x2b')](_0x1da204[_0xb3c8('0x2c')]);_0xd20afa[_0xb3c8('0x2d')]=_[_0xb3c8('0x2e')](_0xd20afa[_0xb3c8('0x2f')],_0xd20afa[_0xb3c8('0x2c')]);_0x461f62[_0xb3c8('0x30')]=_[_0xb3c8('0x2e')](_0xd20afa[_0xb3c8('0x2f')],qs[_0xb3c8('0x31')](_0x1da204[_0xb3c8('0x2c')]['fields']));_0x461f62['attributes']=_0x461f62[_0xb3c8('0x30')][_0xb3c8('0x32')]?_0x461f62[_0xb3c8('0x30')]:_0xd20afa['model'];if(!_0x1da204[_0xb3c8('0x2c')]['hasOwnProperty'](_0xb3c8('0x46'))){_0x461f62[_0xb3c8('0x11')]=qs[_0xb3c8('0x11')](_0x1da204[_0xb3c8('0x2c')][_0xb3c8('0x11')]);_0x461f62[_0xb3c8('0x10')]=qs[_0xb3c8('0x10')](_0x1da204[_0xb3c8('0x2c')][_0xb3c8('0x10')]);}_0x461f62['order']=qs[_0xb3c8('0x47')](_0x1da204[_0xb3c8('0x2c')]['sort']);_0x461f62['where']=qs[_0xb3c8('0x2d')](_[_0xb3c8('0x48')](_0x1da204[_0xb3c8('0x2c')],_0xd20afa[_0xb3c8('0x2d')]));_0x461f62[_0xb3c8('0x25')][_0xb3c8('0x49')]=_0x4d7e54['id'];if(_0x1da204['query']['filter']){_0x461f62[_0xb3c8('0x25')]=_[_0xb3c8('0x34')](_0x461f62[_0xb3c8('0x25')],{'$or':_[_0xb3c8('0x1f')](_0x461f62[_0xb3c8('0x30')],function(_0x2aed1a){var _0x15e9fc={};_0x15e9fc[_0x2aed1a]={'$like':'%'+_0x1da204[_0xb3c8('0x2c')]['filter']+'%'};return _0x15e9fc;})});}_0x461f62=_[_0xb3c8('0x34')]({},_0x461f62,_0x1da204[_0xb3c8('0x35')]);return db[_0xb3c8('0x45')][_0xb3c8('0x27')](_0x461f62);}})[_0xb3c8('0x17')](function(_0x25de6c){if(_0x25de6c){return db['User'][_0xb3c8('0x4a')]({'where':{'id':_[_0xb3c8('0x1f')](_0x25de6c,_0xb3c8('0x4b')),'role':_0xb3c8('0x4c')},'attributes':['id',_0xb3c8('0x1d'),'mailPause','updatedAt',_0xb3c8('0x4d')]});}})['then'](function(_0x5e9f29){if(_0x5e9f29){return{'count':_0x5e9f29['count'],'rows':_['map'](_0x5e9f29[_0xb3c8('0x28')],function(_0x456c63){return{'membername':_0x456c63[_0xb3c8('0x1d')],'UserId':_0x456c63['id'],'queue_name':_0x490362['name'],'MailQueueId':_0x490362['id'],'interface':util['format'](_0xb3c8('0x4e'),'SIP',_0x456c63[_0xb3c8('0x1d')]),'penalty':0x0,'paused':_0x456c63[_0xb3c8('0x4f')],'createdAt':_0x456c63[_0xb3c8('0x4d')],'updatedAt':_0x456c63['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xb3c8('0x17')](respondWithFilteredResult(_0x5e7a3b,_0x461f62))[_0xb3c8('0x29')](handleError(_0x5e7a3b,null));};exports[_0xb3c8('0x50')]=function(_0x5cdd97,_0x45cc67){var _0x1b8245={};var _0xdc1b={};var _0x200976;var _0x538b27;return db[_0xb3c8('0x20')][_0xb3c8('0x44')]({'where':{'id':_0x5cdd97[_0xb3c8('0x41')]['id']}})[_0xb3c8('0x17')](handleEntityNotFound(_0x45cc67,null))['then'](function(_0x4451e3){if(_0x4451e3){_0x200976=_0x4451e3;_0xdc1b['model']=_[_0xb3c8('0x2b')](db['Team'][_0xb3c8('0x21')]);_0xdc1b[_0xb3c8('0x2c')]=_['keys'](_0x5cdd97['query']);_0xdc1b['filters']=_[_0xb3c8('0x2e')](_0xdc1b[_0xb3c8('0x2f')],_0xdc1b[_0xb3c8('0x2c')]);_0x1b8245['attributes']=_['intersection'](_0xdc1b[_0xb3c8('0x2f')],qs[_0xb3c8('0x31')](_0x5cdd97[_0xb3c8('0x2c')][_0xb3c8('0x31')]));_0x1b8245[_0xb3c8('0x30')]=_0x1b8245['attributes'][_0xb3c8('0x32')]?_0x1b8245[_0xb3c8('0x30')]:_0xdc1b[_0xb3c8('0x2f')];_0x1b8245[_0xb3c8('0x51')]=qs[_0xb3c8('0x47')](_0x5cdd97[_0xb3c8('0x2c')]['sort']);_0x1b8245[_0xb3c8('0x25')]=qs[_0xb3c8('0x2d')](_['pick'](_0x5cdd97[_0xb3c8('0x2c')],_0xdc1b['filters']));if(_0x5cdd97[_0xb3c8('0x2c')]['filter']){_0x1b8245[_0xb3c8('0x25')]=_[_0xb3c8('0x34')](_0x1b8245['where'],{'$or':_['map'](_0x1b8245[_0xb3c8('0x30')],function(_0x4182b9){var _0x3d9f84={};_0x3d9f84[_0x4182b9]={'$like':'%'+_0x5cdd97['query']['filter']+'%'};return _0x3d9f84;})});}_0x1b8245=_[_0xb3c8('0x34')]({},_0x1b8245,_0x5cdd97[_0xb3c8('0x35')]);return _0x200976[_0xb3c8('0x50')](_0x1b8245);}})['then'](function(_0x56e015){if(_0x56e015){_0x538b27=_0x56e015[_0xb3c8('0x32')];if(!_0x5cdd97[_0xb3c8('0x2c')][_0xb3c8('0x52')](_0xb3c8('0x46'))){_0x1b8245[_0xb3c8('0x11')]=qs[_0xb3c8('0x11')](_0x5cdd97['query']['limit']);_0x1b8245[_0xb3c8('0x10')]=qs[_0xb3c8('0x10')](_0x5cdd97[_0xb3c8('0x2c')][_0xb3c8('0x10')]);}return _0x200976[_0xb3c8('0x50')](_0x1b8245);}})[_0xb3c8('0x17')](function(_0x4e6417){if(_0x4e6417){return _0x4e6417?{'count':_0x538b27,'rows':_0x4e6417}:null;}})[_0xb3c8('0x17')](respondWithResult(_0x45cc67,null))[_0xb3c8('0x29')](handleError(_0x45cc67,null));};exports['addTeams']=function(_0x43c15e,_0x18f9dc){var _0x407444=_0x43c15e['body'][_0xb3c8('0x53')];return db['Team'][_0xb3c8('0x27')]({'where':{'id':_0x407444},'attributes':['id'],'include':[{'model':db[_0xb3c8('0x54')],'as':_0xb3c8('0x55'),'attributes':['id','name',_0xb3c8('0x56'),_0xb3c8('0x57'),_0xb3c8('0x58')],'raw':!![]}]})[_0xb3c8('0x17')](function(_0x4b8209){if(_0x4b8209){var _0x12c83b=_[_0xb3c8('0x59')](_0x4b8209,function(_0x1a6353){var _0x291a78=_0x1a6353[_0xb3c8('0x38')]({'plain':!![]});return _0x291a78[_0xb3c8('0x55')];});return db[_0xb3c8('0x20')][_0xb3c8('0x3c')]({'where':{'id':_0x43c15e['params']['id']}})['then'](function(_0x257ad8){return db['sequelize'][_0xb3c8('0x5a')](function(_0x40daba){return _0x257ad8['addTeams'](_0x407444,{'transaction':_0x40daba})[_0xb3c8('0x17')](function(){return BPromise[_0xb3c8('0x5b')](_0x12c83b,function(_0x4bc4a9){return db['UserMailQueue'][_0xb3c8('0x5c')]({'where':{'UserId':_0x4bc4a9['id'],'MailQueueId':_0x43c15e[_0xb3c8('0x41')]['id']},'transaction':_0x40daba});});})[_0xb3c8('0x17')](function(){_0x12c83b[_0xb3c8('0x5d')](function(_0x10b323){socket[_0xb3c8('0x5e')]('userMailQueue:save',{'UserId':_0x10b323['id'],'MailQueueId':_0x257ad8['id']});});});});});}})[_0xb3c8('0x17')](respondWithStatusCode(_0x18f9dc,null))[_0xb3c8('0x29')](handleError(_0x18f9dc,null));};exports[_0xb3c8('0x5f')]=function(_0x9f7613,_0x1832ef){return db[_0xb3c8('0x60')][_0xb3c8('0x27')]({'where':{'id':_0x9f7613[_0xb3c8('0x2c')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb3c8('0x54')],'as':_0xb3c8('0x55'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1832ef,null))[_0xb3c8('0x17')](function(_0x496c6e){var _0x32cd6c=_['map'](_0x496c6e,'id');var _0x42535d=[];var _0x2300f9=[];var _0x5bdc72=squel[_0xb3c8('0x61')]();_0x5bdc72['field']('tq.TeamId')[_0xb3c8('0x62')](_0xb3c8('0x63'),'tq')['join'](_0xb3c8('0x64'),'ut',_0xb3c8('0x65'))['where'](_0xb3c8('0x66'),_0x9f7613[_0xb3c8('0x41')]['id']);for(var _0x112a94=0x0;_0x112a94<_0x496c6e[_0xb3c8('0x32')];_0x112a94+=0x1){let _0x45f07a=_0x496c6e[_0x112a94];for(var _0x418308=0x0;_0x418308<_0x45f07a['Agents']['length'];_0x418308+=0x1){let _0x3b34c2=_0x45f07a['Agents'][_0x418308];var _0x2ddc61=_0x5bdc72[_0xb3c8('0x67')]();_0x2ddc61[_0xb3c8('0x25')](_0xb3c8('0x68'),_0x3b34c2['id']);_0x2300f9[_0xb3c8('0x69')](db[_0xb3c8('0x6a')][_0xb3c8('0x2c')](_0x2ddc61[_0xb3c8('0x6b')](),{'type':db[_0xb3c8('0x6a')][_0xb3c8('0x6c')][_0xb3c8('0x6d')]})[_0xb3c8('0x17')](function(_0x5b725e){if(_0x5b725e[_0xb3c8('0x32')]===0x1){return _0x3b34c2['id'];}else{var _0x13a6fe=_['every'](_[_0xb3c8('0x1f')](_0x5b725e,_0xb3c8('0x6e')),function(_0x2feff9){return _[_0xb3c8('0x6f')](_0x32cd6c,_0x2feff9);});if(_0x13a6fe){return _0x3b34c2['id'];}}}));}}return BPromise['all'](_0x2300f9)[_0xb3c8('0x17')](function(_0x1e131d){_0x42535d=_(_0x42535d)['union'](_0x1e131d)['compact']()[_0xb3c8('0x70')]();return db['MailQueue'][_0xb3c8('0x3c')]({'where':{'id':_0x9f7613[_0xb3c8('0x41')]['id']}})[_0xb3c8('0x17')](function(_0x5a2b36){return db['sequelize']['transaction'](function(_0x37b02c){return _0x5a2b36[_0xb3c8('0x5f')](_0x9f7613[_0xb3c8('0x2c')][_0xb3c8('0x53')],{'transaction':_0x37b02c})['then'](function(){if(!_[_0xb3c8('0x71')](_0x42535d)){return _0x5a2b36[_0xb3c8('0x72')](_0x42535d,{'transaction':_0x37b02c});}})[_0xb3c8('0x17')](function(){_0x42535d[_0xb3c8('0x5d')](function(_0x23f011){socket[_0xb3c8('0x5e')]('userMailQueue:remove',{'UserId':_0x23f011,'MailQueueId':_0x5a2b36['id']});});});});});});})[_0xb3c8('0x17')](respondWithStatusCode(_0x1832ef,null))[_0xb3c8('0x29')](handleError(_0x1832ef,null));};exports[_0xb3c8('0x73')]=function(_0x12c706,_0x321a68){return db[_0xb3c8('0x20')][_0xb3c8('0x3c')]({'where':{'id':_0x12c706[_0xb3c8('0x41')]['id']}})[_0xb3c8('0x17')](handleEntityNotFound(_0x321a68,null))['then'](function(_0x4e2922){if(_0x4e2922){return _0x4e2922[_0xb3c8('0x73')](_0x12c706[_0xb3c8('0x36')]['ids'],_[_0xb3c8('0x74')](_0x12c706['body'],[_0xb3c8('0x53'),'id'])||{})['spread'](function(_0x34fe7c){for(var _0x14f169=0x0;_0x14f169<_0x12c706[_0xb3c8('0x36')]['ids'][_0xb3c8('0x32')];_0x14f169+=0x1){socket[_0xb3c8('0x5e')](_0xb3c8('0x75'),{'UserId':Number(_0x12c706[_0xb3c8('0x36')]['ids'][_0x14f169]),'MailQueueId':Number(_0x12c706[_0xb3c8('0x41')]['id'])});}return _0x34fe7c;});}})[_0xb3c8('0x17')](respondWithResult(_0x321a68,null))[_0xb3c8('0x29')](handleError(_0x321a68,null));};exports[_0xb3c8('0x72')]=function(_0x5eff1f,_0x4df0a3){return db[_0xb3c8('0x20')][_0xb3c8('0x3c')]({'where':{'id':_0x5eff1f[_0xb3c8('0x41')]['id']}})[_0xb3c8('0x17')](handleEntityNotFound(_0x4df0a3,null))[_0xb3c8('0x17')](function(_0x3de983){if(_0x3de983){return _0x3de983[_0xb3c8('0x72')](_0x5eff1f[_0xb3c8('0x2c')][_0xb3c8('0x53')])['then'](function(){if(_[_0xb3c8('0x76')](_0x5eff1f[_0xb3c8('0x2c')]['ids'])){for(var _0x3c0c76=0x0;_0x3c0c76<_0x5eff1f[_0xb3c8('0x2c')][_0xb3c8('0x53')][_0xb3c8('0x32')];_0x3c0c76+=0x1){socket[_0xb3c8('0x5e')](_0xb3c8('0x77'),{'UserId':Number(_0x5eff1f[_0xb3c8('0x2c')][_0xb3c8('0x53')][_0x3c0c76]),'MailQueueId':Number(_0x5eff1f['params']['id'])});}}else{socket[_0xb3c8('0x5e')](_0xb3c8('0x77'),{'UserId':Number(_0x5eff1f[_0xb3c8('0x2c')][_0xb3c8('0x53')]),'MailQueueId':Number(_0x5eff1f[_0xb3c8('0x41')]['id'])});}});}})['then'](respondWithStatusCode(_0x4df0a3,null))[_0xb3c8('0x29')](handleError(_0x4df0a3,null));};exports[_0xb3c8('0x78')]=function(_0x41491c,_0x3caf89){var _0x2d34a2={};var _0x14f6aa={};var _0x28ffac;var _0x45f32f;return db[_0xb3c8('0x20')]['findOne']({'where':{'id':_0x41491c['params']['id']}})[_0xb3c8('0x17')](handleEntityNotFound(_0x3caf89,null))[_0xb3c8('0x17')](function(_0x531060){if(_0x531060){_0x28ffac=_0x531060;_0x14f6aa[_0xb3c8('0x2f')]=_[_0xb3c8('0x2b')](db[_0xb3c8('0x54')][_0xb3c8('0x21')]);_0x14f6aa['query']=_[_0xb3c8('0x2b')](_0x41491c['query']);_0x14f6aa[_0xb3c8('0x2d')]=_[_0xb3c8('0x2e')](_0x14f6aa[_0xb3c8('0x2f')],_0x14f6aa[_0xb3c8('0x2c')]);_0x2d34a2[_0xb3c8('0x30')]=_[_0xb3c8('0x2e')](_0x14f6aa[_0xb3c8('0x2f')],qs['fields'](_0x41491c[_0xb3c8('0x2c')][_0xb3c8('0x31')]));_0x2d34a2[_0xb3c8('0x30')]=_0x2d34a2[_0xb3c8('0x30')][_0xb3c8('0x32')]?_0x2d34a2[_0xb3c8('0x30')]:_0x14f6aa[_0xb3c8('0x2f')];_0x2d34a2[_0xb3c8('0x51')]=qs[_0xb3c8('0x47')](_0x41491c[_0xb3c8('0x2c')][_0xb3c8('0x47')]);_0x2d34a2['where']=qs[_0xb3c8('0x2d')](_[_0xb3c8('0x48')](_0x41491c[_0xb3c8('0x2c')],_0x14f6aa[_0xb3c8('0x2d')]));if(_0x41491c[_0xb3c8('0x2c')][_0xb3c8('0x79')]){_0x2d34a2[_0xb3c8('0x25')]=_[_0xb3c8('0x34')](_0x2d34a2[_0xb3c8('0x25')],{'$or':_['map'](_0x2d34a2[_0xb3c8('0x30')],function(_0x65219e){var _0xefa530={};_0xefa530[_0x65219e]={'$like':'%'+_0x41491c[_0xb3c8('0x2c')][_0xb3c8('0x79')]+'%'};return _0xefa530;})});}_0x2d34a2=_[_0xb3c8('0x34')]({},_0x2d34a2,_0x41491c['options']);return _0x28ffac[_0xb3c8('0x78')](_0x2d34a2);}})[_0xb3c8('0x17')](function(_0x9f93d5){if(_0x9f93d5){_0x45f32f=_0x9f93d5['length'];if(!_0x41491c[_0xb3c8('0x2c')][_0xb3c8('0x52')]('nolimit')){_0x2d34a2['limit']=qs[_0xb3c8('0x11')](_0x41491c['query'][_0xb3c8('0x11')]);_0x2d34a2['offset']=qs['offset'](_0x41491c['query'][_0xb3c8('0x10')]);}return _0x28ffac[_0xb3c8('0x78')](_0x2d34a2);}})[_0xb3c8('0x17')](function(_0x2db825){if(_0x2db825){return _0x2db825?{'count':_0x45f32f,'rows':_0x2db825}:null;}})[_0xb3c8('0x17')](respondWithResult(_0x3caf89,null))[_0xb3c8('0x29')](handleError(_0x3caf89,null));}; \ No newline at end of file +var _0x4407=['join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','all','union','compact','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','isArray','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','Content-Range','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','MailQueue','rawAttributes','key','getOptions','count','include','query','findAll','show','params','model','filters','intersection','attributes','fields','merge','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserMailQueue','length','hasOwnProperty','order','sort','where','pick','MailQueueId','filter','User','findAndCountAll','agent','mailPause','createdAt','rows','format','%s/%s','updatedAt','getTeams','findOne','keys','Team','nolimit','addTeams','ids','voicePause','interface','flatMap','Agents','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','select','field','tq.TeamId','from','team_has_mail_queues'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0x4407,0x107));var _0x7440=function(_0x78b582,_0x112a8f){_0x78b582=_0x78b582-0x0;var _0x59ee7e=_0x4407[_0x78b582];return _0x59ee7e;};'use strict';var BPromise=require(_0x7440('0x0'));var util=require(_0x7440('0x1'));var _=require(_0x7440('0x2'));var squel=require(_0x7440('0x3'));var Redis=require(_0x7440('0x4'));var qs=require(_0x7440('0x5'));var logger=require(_0x7440('0x6'))('api');var config=require(_0x7440('0x7'));var db=require(_0x7440('0x8'))['db'];config[_0x7440('0x9')]=_['defaults'](config[_0x7440('0x9')],{'host':_0x7440('0xa'),'port':0x18eb});var socket=require(_0x7440('0xb'))(new Redis(config[_0x7440('0x9')]));require('./mailQueue.socket')[_0x7440('0xc')](socket);function respondWithStatusCode(_0xac62b4,_0x463c17){_0x463c17=_0x463c17||0xcc;return function(_0x1ea6ff){if(_0x1ea6ff){return _0xac62b4[_0x7440('0xd')](_0x463c17);}return _0xac62b4[_0x7440('0xe')](_0x463c17)[_0x7440('0xf')]();};}function respondWithResult(_0x298144,_0x4ccb75){_0x4ccb75=_0x4ccb75||0xc8;return function(_0x102852){if(_0x102852){return _0x298144[_0x7440('0xe')](_0x4ccb75)[_0x7440('0x10')](_0x102852);}};}function respondWithFilteredResult(_0x17ea7c,_0x34716c){return function(_0x26f993){if(_0x26f993){var _0xfa554f=typeof _0x34716c[_0x7440('0x11')]==='undefined'&&typeof _0x34716c[_0x7440('0x12')]===_0x7440('0x13');var _0x50988a=_0x26f993['count'];var _0x5f3ff0=_0xfa554f?0x0:_0x34716c[_0x7440('0x11')];var _0x2721c8=_0xfa554f?_0x26f993['count']:_0x34716c[_0x7440('0x11')]+_0x34716c[_0x7440('0x12')];var _0xc7b7f6;if(_0x2721c8>=_0x50988a){_0x2721c8=_0x50988a;_0xc7b7f6=0xc8;}else{_0xc7b7f6=0xce;}_0x17ea7c['status'](_0xc7b7f6);return _0x17ea7c['set'](_0x7440('0x14'),_0x5f3ff0+'-'+_0x2721c8+'/'+_0x50988a)[_0x7440('0x10')](_0x26f993);}return null;};}function saveUpdates(_0x10c089){return function(_0x1b8e08){if(_0x1b8e08){return _0x1b8e08[_0x7440('0x15')](_0x10c089)[_0x7440('0x16')](function(_0x4a7858){return _0x4a7858;});}return null;};}function removeEntity(_0x34d517){return function(_0x32a6a6){if(_0x32a6a6){return _0x32a6a6[_0x7440('0x17')]()['then'](function(){var _0x49e986=_0x32a6a6[_0x7440('0x18')]({'plain':!![]});var _0x3e1cdf='MailQueues';return db[_0x7440('0x19')]['destroy']({'where':{'type':_0x3e1cdf,'resourceId':_0x49e986['id']}})['then'](function(){return _0x32a6a6;});})[_0x7440('0x16')](function(){_0x34d517[_0x7440('0xe')](0xcc)[_0x7440('0xf')]();});}};}function handleEntityNotFound(_0x180873){return function(_0x3f0295){if(!_0x3f0295){_0x180873['sendStatus'](0x194);}return _0x3f0295;};}function handleError(_0x11a6a1,_0x4adebd){_0x4adebd=_0x4adebd||0x1f4;return function(_0x14bc3e){logger[_0x7440('0x1a')](_0x14bc3e[_0x7440('0x1b')]);if(_0x14bc3e[_0x7440('0x1c')]){delete _0x14bc3e['name'];}_0x11a6a1[_0x7440('0xe')](_0x4adebd)['send'](_0x14bc3e);};}exports[_0x7440('0x1d')]=function(_0x41db42,_0x1a04b4){var _0x3eaa7c={};var _0x1db4b5={'count':0x0,'rows':[]};var _0x212b83=_[_0x7440('0x1e')](db[_0x7440('0x1f')][_0x7440('0x20')],function(_0x774a17){return{'name':_0x774a17['fieldName'],'type':_0x774a17['type'][_0x7440('0x21')]};});_0x3eaa7c=qs[_0x7440('0x22')](_0x212b83,_0x41db42);var _0x2713b1={'where':_0x3eaa7c['where']};return db['MailQueue'][_0x7440('0x23')](_0x2713b1)[_0x7440('0x16')](function(_0x3ab8d1){_0x1db4b5[_0x7440('0x23')]=_0x3ab8d1;_0x3eaa7c[_0x7440('0x24')]=qs[_0x7440('0x24')](_0x41db42[_0x7440('0x25')]);return db[_0x7440('0x1f')][_0x7440('0x26')](_0x3eaa7c);})[_0x7440('0x16')](function(_0x3b265c){_0x1db4b5['rows']=_0x3b265c;return _0x1db4b5;})[_0x7440('0x16')](respondWithFilteredResult(_0x1a04b4,_0x3eaa7c))['catch'](handleError(_0x1a04b4,null));};exports[_0x7440('0x27')]=function(_0x1066fa,_0xc3b859){var _0x35d376={'raw':!![],'where':{'id':_0x1066fa[_0x7440('0x28')]['id']}},_0x3af16a={};_0x3af16a[_0x7440('0x29')]=_['keys'](db[_0x7440('0x1f')][_0x7440('0x20')]);_0x3af16a[_0x7440('0x25')]=_['keys'](_0x1066fa[_0x7440('0x25')]);_0x3af16a[_0x7440('0x2a')]=_[_0x7440('0x2b')](_0x3af16a[_0x7440('0x29')],_0x3af16a[_0x7440('0x25')]);_0x35d376[_0x7440('0x2c')]=_[_0x7440('0x2b')](_0x3af16a[_0x7440('0x29')],qs[_0x7440('0x2d')](_0x1066fa[_0x7440('0x25')][_0x7440('0x2d')]));_0x35d376['attributes']=_0x35d376[_0x7440('0x2c')]['length']?_0x35d376[_0x7440('0x2c')]:_0x3af16a[_0x7440('0x29')];if(_0x1066fa['query']['includeAll']){_0x35d376[_0x7440('0x24')]=[{'all':!![]}];}_0x35d376=_[_0x7440('0x2e')]({},_0x35d376,_0x1066fa[_0x7440('0x2f')]);return db[_0x7440('0x1f')][_0x7440('0x30')](_0x35d376)['then'](handleEntityNotFound(_0xc3b859,null))[_0x7440('0x16')](respondWithResult(_0xc3b859,null))[_0x7440('0x31')](handleError(_0xc3b859,null));};exports[_0x7440('0x32')]=function(_0x7dc5ec,_0x28a4ae){return db['MailQueue'][_0x7440('0x32')](_0x7dc5ec['body'],{})[_0x7440('0x16')](function(_0x4dbdea){var _0x463e7f=_0x7dc5ec[_0x7440('0x33')][_0x7440('0x18')]({'plain':!![]});if(!_0x463e7f)throw new Error(_0x7440('0x34'));if(_0x463e7f[_0x7440('0x35')]==='user'){var _0xbbf1e9=_0x4dbdea['get']({'plain':!![]});var _0x825a49='MailQueues';return db[_0x7440('0x36')][_0x7440('0x30')]({'where':{'name':_0x825a49,'userProfileId':_0x463e7f[_0x7440('0x37')]},'raw':!![]})['then'](function(_0x25110c){if(_0x25110c&&_0x25110c['autoAssociation']===0x0){return db[_0x7440('0x19')][_0x7440('0x32')]({'name':_0xbbf1e9[_0x7440('0x1c')],'resourceId':_0xbbf1e9['id'],'type':_0x25110c[_0x7440('0x1c')],'sectionId':_0x25110c['id']},{})[_0x7440('0x16')](function(){return _0x4dbdea;});}else{return _0x4dbdea;}})['catch'](function(_0xff56ac){logger['error'](_0x7440('0x38'),_0xff56ac);throw _0xff56ac;});}return _0x4dbdea;})[_0x7440('0x16')](respondWithResult(_0x28a4ae,0xc9))[_0x7440('0x31')](handleError(_0x28a4ae,null));};exports['update']=function(_0x354ab7,_0x4b4134){if(_0x354ab7['body']['id']){delete _0x354ab7['body']['id'];}return db[_0x7440('0x1f')][_0x7440('0x30')]({'where':{'id':_0x354ab7['params']['id']}})['then'](handleEntityNotFound(_0x4b4134,null))['then'](saveUpdates(_0x354ab7[_0x7440('0x39')],null))[_0x7440('0x16')](respondWithResult(_0x4b4134,null))[_0x7440('0x31')](handleError(_0x4b4134,null));};exports[_0x7440('0x17')]=function(_0x3d21fc,_0x1a29d0){return db[_0x7440('0x1f')][_0x7440('0x30')]({'where':{'id':_0x3d21fc['params']['id']}})[_0x7440('0x16')](handleEntityNotFound(_0x1a29d0,null))['then'](removeEntity(_0x1a29d0,null))[_0x7440('0x31')](handleError(_0x1a29d0,null));};exports[_0x7440('0x3a')]=function(_0x13079d,_0x2371f4){return db['MailQueue']['describe']()['then'](respondWithResult(_0x2371f4,null))['catch'](handleError(_0x2371f4,null));};exports[_0x7440('0x3b')]=function(_0x12026c,_0x4d0979){var _0x31708e={'raw':!![],'where':{}},_0x363ce2={},_0x5b6a4d;return db[_0x7440('0x1f')]['findOne']({'where':{'id':_0x12026c[_0x7440('0x28')]['id']}})[_0x7440('0x16')](handleEntityNotFound(_0x4d0979,null))[_0x7440('0x16')](function(_0x210d8e){if(_0x210d8e){_0x5b6a4d=_0x210d8e[_0x7440('0x18')]({'plain':!![]});_0x363ce2[_0x7440('0x29')]=_['keys'](db[_0x7440('0x3c')][_0x7440('0x20')]);_0x363ce2[_0x7440('0x25')]=_['keys'](_0x12026c[_0x7440('0x25')]);_0x363ce2[_0x7440('0x2a')]=_[_0x7440('0x2b')](_0x363ce2[_0x7440('0x29')],_0x363ce2[_0x7440('0x25')]);_0x31708e['attributes']=_[_0x7440('0x2b')](_0x363ce2[_0x7440('0x29')],qs[_0x7440('0x2d')](_0x12026c[_0x7440('0x25')]['fields']));_0x31708e['attributes']=_0x31708e['attributes'][_0x7440('0x3d')]?_0x31708e[_0x7440('0x2c')]:_0x363ce2[_0x7440('0x29')];if(!_0x12026c['query'][_0x7440('0x3e')]('nolimit')){_0x31708e[_0x7440('0x12')]=qs['limit'](_0x12026c[_0x7440('0x25')][_0x7440('0x12')]);_0x31708e[_0x7440('0x11')]=qs['offset'](_0x12026c[_0x7440('0x25')]['offset']);}_0x31708e[_0x7440('0x3f')]=qs[_0x7440('0x40')](_0x12026c[_0x7440('0x25')]['sort']);_0x31708e[_0x7440('0x41')]=qs[_0x7440('0x2a')](_[_0x7440('0x42')](_0x12026c['query'],_0x363ce2['filters']));_0x31708e[_0x7440('0x41')][_0x7440('0x43')]=_0x210d8e['id'];if(_0x12026c['query'][_0x7440('0x44')]){_0x31708e[_0x7440('0x41')]=_[_0x7440('0x2e')](_0x31708e['where'],{'$or':_['map'](_0x31708e[_0x7440('0x2c')],function(_0x2d3894){var _0x27c78e={};_0x27c78e[_0x2d3894]={'$like':'%'+_0x12026c[_0x7440('0x25')][_0x7440('0x44')]+'%'};return _0x27c78e;})});}_0x31708e=_['merge']({},_0x31708e,_0x12026c[_0x7440('0x2f')]);return db[_0x7440('0x3c')][_0x7440('0x26')](_0x31708e);}})[_0x7440('0x16')](function(_0x4a00cb){if(_0x4a00cb){return db[_0x7440('0x45')][_0x7440('0x46')]({'where':{'id':_['map'](_0x4a00cb,'UserId'),'role':_0x7440('0x47')},'attributes':['id',_0x7440('0x1c'),_0x7440('0x48'),'updatedAt',_0x7440('0x49')]});}})[_0x7440('0x16')](function(_0xa7c828){if(_0xa7c828){return{'count':_0xa7c828[_0x7440('0x23')],'rows':_['map'](_0xa7c828[_0x7440('0x4a')],function(_0x2b34fd){return{'membername':_0x2b34fd[_0x7440('0x1c')],'UserId':_0x2b34fd['id'],'queue_name':_0x5b6a4d[_0x7440('0x1c')],'MailQueueId':_0x5b6a4d['id'],'interface':util[_0x7440('0x4b')](_0x7440('0x4c'),'SIP',_0x2b34fd[_0x7440('0x1c')]),'penalty':0x0,'paused':_0x2b34fd[_0x7440('0x48')],'createdAt':_0x2b34fd['createdAt'],'updatedAt':_0x2b34fd[_0x7440('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4d0979,_0x31708e))[_0x7440('0x31')](handleError(_0x4d0979,null));};exports[_0x7440('0x4e')]=function(_0x3cb25f,_0x25f103){var _0x57a609={};var _0x2c18fc={};var _0x22d890;var _0x10bab0;return db[_0x7440('0x1f')][_0x7440('0x4f')]({'where':{'id':_0x3cb25f[_0x7440('0x28')]['id']}})[_0x7440('0x16')](handleEntityNotFound(_0x25f103,null))[_0x7440('0x16')](function(_0x55459c){if(_0x55459c){_0x22d890=_0x55459c;_0x2c18fc[_0x7440('0x29')]=_[_0x7440('0x50')](db[_0x7440('0x51')][_0x7440('0x20')]);_0x2c18fc[_0x7440('0x25')]=_[_0x7440('0x50')](_0x3cb25f['query']);_0x2c18fc[_0x7440('0x2a')]=_[_0x7440('0x2b')](_0x2c18fc['model'],_0x2c18fc[_0x7440('0x25')]);_0x57a609[_0x7440('0x2c')]=_[_0x7440('0x2b')](_0x2c18fc[_0x7440('0x29')],qs['fields'](_0x3cb25f[_0x7440('0x25')][_0x7440('0x2d')]));_0x57a609[_0x7440('0x2c')]=_0x57a609[_0x7440('0x2c')][_0x7440('0x3d')]?_0x57a609[_0x7440('0x2c')]:_0x2c18fc[_0x7440('0x29')];_0x57a609[_0x7440('0x3f')]=qs[_0x7440('0x40')](_0x3cb25f['query'][_0x7440('0x40')]);_0x57a609[_0x7440('0x41')]=qs[_0x7440('0x2a')](_[_0x7440('0x42')](_0x3cb25f[_0x7440('0x25')],_0x2c18fc['filters']));if(_0x3cb25f[_0x7440('0x25')][_0x7440('0x44')]){_0x57a609[_0x7440('0x41')]=_[_0x7440('0x2e')](_0x57a609[_0x7440('0x41')],{'$or':_['map'](_0x57a609['attributes'],function(_0x1f3143){var _0x350e91={};_0x350e91[_0x1f3143]={'$like':'%'+_0x3cb25f[_0x7440('0x25')][_0x7440('0x44')]+'%'};return _0x350e91;})});}_0x57a609=_[_0x7440('0x2e')]({},_0x57a609,_0x3cb25f[_0x7440('0x2f')]);return _0x22d890[_0x7440('0x4e')](_0x57a609);}})[_0x7440('0x16')](function(_0x268865){if(_0x268865){_0x10bab0=_0x268865[_0x7440('0x3d')];if(!_0x3cb25f['query'][_0x7440('0x3e')](_0x7440('0x52'))){_0x57a609[_0x7440('0x12')]=qs[_0x7440('0x12')](_0x3cb25f[_0x7440('0x25')][_0x7440('0x12')]);_0x57a609[_0x7440('0x11')]=qs[_0x7440('0x11')](_0x3cb25f['query'][_0x7440('0x11')]);}return _0x22d890['getTeams'](_0x57a609);}})[_0x7440('0x16')](function(_0x24c73e){if(_0x24c73e){return _0x24c73e?{'count':_0x10bab0,'rows':_0x24c73e}:null;}})[_0x7440('0x16')](respondWithResult(_0x25f103,null))['catch'](handleError(_0x25f103,null));};exports[_0x7440('0x53')]=function(_0x54e587,_0x2ce8c6){var _0x6e198c=_0x54e587[_0x7440('0x39')][_0x7440('0x54')];return db[_0x7440('0x51')][_0x7440('0x26')]({'where':{'id':_0x6e198c},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online',_0x7440('0x55'),_0x7440('0x56')],'raw':!![]}]})['then'](function(_0x1ef833){if(_0x1ef833){var _0x83aa2e=_[_0x7440('0x57')](_0x1ef833,function(_0x254c61){var _0x1984c7=_0x254c61['get']({'plain':!![]});return _0x1984c7[_0x7440('0x58')];});return db[_0x7440('0x1f')][_0x7440('0x30')]({'where':{'id':_0x54e587[_0x7440('0x28')]['id']}})[_0x7440('0x16')](function(_0x5103b9){return db['sequelize'][_0x7440('0x59')](function(_0x1f0999){return _0x5103b9[_0x7440('0x53')](_0x6e198c,{'transaction':_0x1f0999})[_0x7440('0x16')](function(){return BPromise[_0x7440('0x5a')](_0x83aa2e,function(_0x122e6b){return db[_0x7440('0x3c')][_0x7440('0x5b')]({'where':{'UserId':_0x122e6b['id'],'MailQueueId':_0x54e587[_0x7440('0x28')]['id']},'transaction':_0x1f0999});});})['then'](function(){_0x83aa2e[_0x7440('0x5c')](function(_0x505e41){socket[_0x7440('0x5d')](_0x7440('0x5e'),{'UserId':_0x505e41['id'],'MailQueueId':_0x5103b9['id']});});});});});}})['then'](respondWithStatusCode(_0x2ce8c6,null))[_0x7440('0x31')](handleError(_0x2ce8c6,null));};exports['removeTeams']=function(_0x1ba9d8,_0x1f0fea){return db['Team'][_0x7440('0x26')]({'where':{'id':_0x1ba9d8[_0x7440('0x25')][_0x7440('0x54')]},'attributes':['id'],'include':[{'model':db[_0x7440('0x45')],'as':_0x7440('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1f0fea,null))[_0x7440('0x16')](function(_0x17ce71){var _0x4b3d1d=_[_0x7440('0x1e')](_0x17ce71,'id');var _0x36442c=[];var _0x229e05=[];var _0x519590=squel[_0x7440('0x5f')]();_0x519590[_0x7440('0x60')](_0x7440('0x61'))[_0x7440('0x62')](_0x7440('0x63'),'tq')[_0x7440('0x64')](_0x7440('0x65'),'ut',_0x7440('0x66'))[_0x7440('0x41')](_0x7440('0x67'),_0x1ba9d8['params']['id']);for(var _0x282a3b=0x0;_0x282a3b<_0x17ce71[_0x7440('0x3d')];_0x282a3b+=0x1){let _0x61c34b=_0x17ce71[_0x282a3b];for(var _0x21870e=0x0;_0x21870e<_0x61c34b[_0x7440('0x58')][_0x7440('0x3d')];_0x21870e+=0x1){let _0x5ad5d8=_0x61c34b[_0x7440('0x58')][_0x21870e];var _0x136a53=_0x519590[_0x7440('0x68')]();_0x136a53[_0x7440('0x41')](_0x7440('0x69'),_0x5ad5d8['id']);_0x229e05[_0x7440('0x6a')](db['sequelize'][_0x7440('0x25')](_0x136a53['toString'](),{'type':db[_0x7440('0x6b')][_0x7440('0x6c')][_0x7440('0x6d')]})['then'](function(_0x21cf34){if(_0x21cf34[_0x7440('0x3d')]===0x1){return _0x5ad5d8['id'];}else{var _0x5b7ac1=_[_0x7440('0x6e')](_[_0x7440('0x1e')](_0x21cf34,'TeamId'),function(_0x5848d7){return _['includes'](_0x4b3d1d,_0x5848d7);});if(_0x5b7ac1){return _0x5ad5d8['id'];}}}));}}return BPromise[_0x7440('0x6f')](_0x229e05)['then'](function(_0xdcf356){_0x36442c=_(_0x36442c)[_0x7440('0x70')](_0xdcf356)[_0x7440('0x71')]()['value']();return db[_0x7440('0x1f')]['find']({'where':{'id':_0x1ba9d8[_0x7440('0x28')]['id']}})[_0x7440('0x16')](function(_0x1a359f){return db[_0x7440('0x6b')]['transaction'](function(_0x1f9b20){return _0x1a359f[_0x7440('0x72')](_0x1ba9d8[_0x7440('0x25')][_0x7440('0x54')],{'transaction':_0x1f9b20})['then'](function(){if(!_[_0x7440('0x73')](_0x36442c)){return _0x1a359f[_0x7440('0x74')](_0x36442c,{'transaction':_0x1f9b20});}})['then'](function(){_0x36442c['forEach'](function(_0x3e33d9){socket[_0x7440('0x5d')](_0x7440('0x75'),{'UserId':_0x3e33d9,'MailQueueId':_0x1a359f['id']});});});});});});})[_0x7440('0x16')](respondWithStatusCode(_0x1f0fea,null))[_0x7440('0x31')](handleError(_0x1f0fea,null));};exports[_0x7440('0x76')]=function(_0x149743,_0x125d6e){return db[_0x7440('0x1f')]['find']({'where':{'id':_0x149743['params']['id']}})[_0x7440('0x16')](handleEntityNotFound(_0x125d6e,null))[_0x7440('0x16')](function(_0x2f2efd){if(_0x2f2efd){return _0x2f2efd[_0x7440('0x76')](_0x149743[_0x7440('0x39')][_0x7440('0x54')],_['omit'](_0x149743[_0x7440('0x39')],[_0x7440('0x54'),'id'])||{})[_0x7440('0x77')](function(_0x1625e2){for(var _0x468d72=0x0;_0x468d72<_0x149743[_0x7440('0x39')]['ids'][_0x7440('0x3d')];_0x468d72+=0x1){socket['emit']('userMailQueue:save',{'UserId':Number(_0x149743[_0x7440('0x39')][_0x7440('0x54')][_0x468d72]),'MailQueueId':Number(_0x149743[_0x7440('0x28')]['id'])});}return _0x1625e2;});}})[_0x7440('0x16')](respondWithResult(_0x125d6e,null))[_0x7440('0x31')](handleError(_0x125d6e,null));};exports[_0x7440('0x74')]=function(_0x5498fc,_0x394f69){return db['MailQueue']['find']({'where':{'id':_0x5498fc[_0x7440('0x28')]['id']}})[_0x7440('0x16')](handleEntityNotFound(_0x394f69,null))[_0x7440('0x16')](function(_0x2390f5){if(_0x2390f5){return _0x2390f5[_0x7440('0x74')](_0x5498fc['query'][_0x7440('0x54')])['then'](function(){if(_[_0x7440('0x78')](_0x5498fc[_0x7440('0x25')]['ids'])){for(var _0x4fbeff=0x0;_0x4fbeff<_0x5498fc[_0x7440('0x25')][_0x7440('0x54')][_0x7440('0x3d')];_0x4fbeff+=0x1){socket['emit'](_0x7440('0x75'),{'UserId':Number(_0x5498fc[_0x7440('0x25')][_0x7440('0x54')][_0x4fbeff]),'MailQueueId':Number(_0x5498fc['params']['id'])});}}else{socket[_0x7440('0x5d')](_0x7440('0x75'),{'UserId':Number(_0x5498fc['query'][_0x7440('0x54')]),'MailQueueId':Number(_0x5498fc[_0x7440('0x28')]['id'])});}});}})[_0x7440('0x16')](respondWithStatusCode(_0x394f69,null))[_0x7440('0x31')](handleError(_0x394f69,null));};exports['getAgents']=function(_0x512e17,_0x482c65){var _0x5e185d={};var _0x816d9e={};var _0x550f0c;var _0x1fe074;return db[_0x7440('0x1f')][_0x7440('0x4f')]({'where':{'id':_0x512e17['params']['id']}})[_0x7440('0x16')](handleEntityNotFound(_0x482c65,null))['then'](function(_0x17c4c9){if(_0x17c4c9){_0x550f0c=_0x17c4c9;_0x816d9e[_0x7440('0x29')]=_[_0x7440('0x50')](db[_0x7440('0x45')][_0x7440('0x20')]);_0x816d9e[_0x7440('0x25')]=_[_0x7440('0x50')](_0x512e17['query']);_0x816d9e[_0x7440('0x2a')]=_[_0x7440('0x2b')](_0x816d9e[_0x7440('0x29')],_0x816d9e['query']);_0x5e185d[_0x7440('0x2c')]=_[_0x7440('0x2b')](_0x816d9e[_0x7440('0x29')],qs['fields'](_0x512e17[_0x7440('0x25')][_0x7440('0x2d')]));_0x5e185d[_0x7440('0x2c')]=_0x5e185d['attributes'][_0x7440('0x3d')]?_0x5e185d[_0x7440('0x2c')]:_0x816d9e[_0x7440('0x29')];_0x5e185d[_0x7440('0x3f')]=qs[_0x7440('0x40')](_0x512e17[_0x7440('0x25')][_0x7440('0x40')]);_0x5e185d[_0x7440('0x41')]=qs[_0x7440('0x2a')](_[_0x7440('0x42')](_0x512e17[_0x7440('0x25')],_0x816d9e[_0x7440('0x2a')]));if(_0x512e17[_0x7440('0x25')][_0x7440('0x44')]){_0x5e185d[_0x7440('0x41')]=_[_0x7440('0x2e')](_0x5e185d[_0x7440('0x41')],{'$or':_[_0x7440('0x1e')](_0x5e185d[_0x7440('0x2c')],function(_0x18a157){var _0x560a82={};_0x560a82[_0x18a157]={'$like':'%'+_0x512e17[_0x7440('0x25')]['filter']+'%'};return _0x560a82;})});}_0x5e185d=_[_0x7440('0x2e')]({},_0x5e185d,_0x512e17[_0x7440('0x2f')]);return _0x550f0c['getAgents'](_0x5e185d);}})['then'](function(_0x139705){if(_0x139705){_0x1fe074=_0x139705[_0x7440('0x3d')];if(!_0x512e17[_0x7440('0x25')][_0x7440('0x3e')]('nolimit')){_0x5e185d['limit']=qs['limit'](_0x512e17[_0x7440('0x25')][_0x7440('0x12')]);_0x5e185d[_0x7440('0x11')]=qs[_0x7440('0x11')](_0x512e17[_0x7440('0x25')][_0x7440('0x11')]);}return _0x550f0c['getAgents'](_0x5e185d);}})[_0x7440('0x16')](function(_0x48284c){if(_0x48284c){return _0x48284c?{'count':_0x1fe074,'rows':_0x48284c}:null;}})['then'](respondWithResult(_0x482c65,null))[_0x7440('0x31')](handleError(_0x482c65,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 2a17890..fa8d594 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 _0x1608=['emit','hasOwnProperty','events','../../mysqldb','MailQueue','save','update','remove'];(function(_0x398fcb,_0x5a5ccd){var _0x5a83d9=function(_0x2a49f7){while(--_0x2a49f7){_0x398fcb['push'](_0x398fcb['shift']());}};_0x5a83d9(++_0x5a5ccd);}(_0x1608,0x16a));var _0x8160=function(_0x361036,_0x1fdf0a){_0x361036=_0x361036-0x0;var _0x1324b=_0x1608[_0x361036];return _0x1324b;};'use strict';var EventEmitter=require(_0x8160('0x0'));var MailQueue=require(_0x8160('0x1'))['db'][_0x8160('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8160('0x3'),'afterUpdate':_0x8160('0x4'),'afterDestroy':_0x8160('0x5')};function emitEvent(_0x138d60){return function(_0x222494,_0x17a547,_0x51d0b4){MailQueueEvents[_0x8160('0x6')](_0x138d60+':'+_0x222494['id'],_0x222494);MailQueueEvents[_0x8160('0x6')](_0x138d60,_0x222494);_0x51d0b4(null);};}for(var e in events){if(events[_0x8160('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x7f6d=['remove','emit','hasOwnProperty','exports','events','setMaxListeners'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x7f6d,0xa6));var _0xd7f6=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x7f6d[_0x209941];return _0x1e8729;};'use strict';var EventEmitter=require(_0xd7f6('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xd7f6('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd7f6('0x2')};function emitEvent(_0x1d5cf6){return function(_0x160a0b,_0x5ca51b,_0x19057e){MailQueueEvents['emit'](_0x1d5cf6+':'+_0x160a0b['id'],_0x160a0b);MailQueueEvents[_0xd7f6('0x3')](_0x1d5cf6,_0x160a0b);_0x19057e(null);};}for(var e in events){if(events[_0xd7f6('0x4')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xd7f6('0x5')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index efe81bd..62a64b6 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 _0xce04=['MailQueue','mail_queues','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x1225a1,_0x53e6db){var _0xfe12de=function(_0x8896e){while(--_0x8896e){_0x1225a1['push'](_0x1225a1['shift']());}};_0xfe12de(++_0x53e6db);}(_0xce04,0xca));var _0x4ce0=function(_0x456b4d,_0xeaa7f){_0x456b4d=_0x456b4d-0x0;var _0x3d597a=_0xce04[_0x456b4d];return _0x3d597a;};'use strict';var _=require('lodash');var util=require(_0x4ce0('0x0'));var logger=require(_0x4ce0('0x1'))(_0x4ce0('0x2'));var moment=require('moment');var BPromise=require(_0x4ce0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ce0('0x4'));var rimraf=require(_0x4ce0('0x5'));var config=require(_0x4ce0('0x6'));var attributes=require('./mailQueue.attributes');module[_0x4ce0('0x7')]=function(_0x141d7e,_0x437536){return _0x141d7e['define'](_0x4ce0('0x8'),attributes,{'tableName':_0x4ce0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3527=['exports','define','mail_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x16de68,_0x33d7ff){var _0x1c277e=function(_0x1d8549){while(--_0x1d8549){_0x16de68['push'](_0x16de68['shift']());}};_0x1c277e(++_0x33d7ff);}(_0x3527,0x9f));var _0x7352=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0x3527[_0xfedc72];return _0x2c7c78;};'use strict';var _=require(_0x7352('0x0'));var util=require(_0x7352('0x1'));var logger=require(_0x7352('0x2'))(_0x7352('0x3'));var moment=require(_0x7352('0x4'));var BPromise=require('bluebird');var rp=require(_0x7352('0x5'));var fs=require('fs');var path=require(_0x7352('0x6'));var rimraf=require(_0x7352('0x7'));var config=require(_0x7352('0x8'));var attributes=require('./mailQueue.attributes');module[_0x7352('0x9')]=function(_0x2408d3,_0x461b7e){return _0x2408d3[_0x7352('0xa')]('MailQueue',attributes,{'tableName':_0x7352('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 563bbf7..23118c5 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 _0xd506=['catch','GetMailQueue','findAll','options','limit','include','map','model','attributes','ShowMailQueue','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x1e909d,_0x4a8f3d){var _0x4762cd=function(_0x30cc4e){while(--_0x30cc4e){_0x1e909d['push'](_0x1e909d['shift']());}};_0x4762cd(++_0x4a8f3d);}(_0xd506,0x7a));var _0x6d50=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xd506[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0x6d50('0x0'));var util=require(_0x6d50('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6d50('0x2'));var fs=require('fs');var Redis=require(_0x6d50('0x3'));var db=require(_0x6d50('0x4'))['db'];var utils=require(_0x6d50('0x5'));var logger=require(_0x6d50('0x6'))(_0x6d50('0x7'));var config=require(_0x6d50('0x8'));var jayson=require(_0x6d50('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x6d50('0xa')]=_[_0x6d50('0xb')](config['redis'],{'host':_0x6d50('0xc'),'port':0x18eb});var socket=require(_0x6d50('0xd'))(new Redis(config['redis']));require(_0x6d50('0xe'))[_0x6d50('0xf')](socket);function respondWithRpcPromise(_0xc5030,_0x577f10,_0x245d36){return new BPromise(function(_0x3b5bca,_0x1c471a){return client[_0x6d50('0x10')](_0xc5030,_0x245d36)[_0x6d50('0x11')](function(_0x34e756){logger[_0x6d50('0x12')](_0x6d50('0x13'),_0x577f10,_0x6d50('0x14'));logger[_0x6d50('0x15')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x577f10,'request\x20sent',JSON[_0x6d50('0x16')](_0x34e756));if(_0x34e756['error']){if(_0x34e756[_0x6d50('0x17')]['code']===0x1f4){logger[_0x6d50('0x17')](_0x6d50('0x13'),_0x577f10,_0x34e756[_0x6d50('0x17')][_0x6d50('0x18')]);return _0x1c471a(_0x34e756[_0x6d50('0x17')][_0x6d50('0x18')]);}logger[_0x6d50('0x17')](_0x6d50('0x13'),_0x577f10,_0x34e756[_0x6d50('0x17')]['message']);return _0x3b5bca(_0x34e756[_0x6d50('0x17')][_0x6d50('0x18')]);}else{logger[_0x6d50('0x12')](_0x6d50('0x13'),_0x577f10,'request\x20sent');_0x3b5bca(_0x34e756[_0x6d50('0x19')][_0x6d50('0x18')]);}})[_0x6d50('0x1a')](function(_0x39fafb){logger[_0x6d50('0x17')](_0x6d50('0x13'),_0x577f10,_0x39fafb);_0x1c471a(_0x39fafb);});});}exports[_0x6d50('0x1b')]=function(_0x49da8a){var _0x4f2423=this;return new Promise(function(_0x17cb78,_0xbb26ef){return db['MailQueue'][_0x6d50('0x1c')]({'raw':_0x49da8a[_0x6d50('0x1d')]?_0x49da8a[_0x6d50('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x49da8a[_0x6d50('0x1d')]?_0x49da8a[_0x6d50('0x1d')]['where']||null:null,'attributes':_0x49da8a[_0x6d50('0x1d')]?_0x49da8a[_0x6d50('0x1d')]['attributes']||null:null,'limit':_0x49da8a[_0x6d50('0x1d')]?_0x49da8a['options'][_0x6d50('0x1e')]||null:null,'include':_0x49da8a[_0x6d50('0x1d')]?_0x49da8a[_0x6d50('0x1d')][_0x6d50('0x1f')]?_[_0x6d50('0x20')](_0x49da8a[_0x6d50('0x1d')][_0x6d50('0x1f')],function(_0x2986ce){return{'model':db[_0x2986ce[_0x6d50('0x21')]],'as':_0x2986ce['as'],'attributes':_0x2986ce[_0x6d50('0x22')],'include':_0x2986ce['include']?_['map'](_0x2986ce[_0x6d50('0x1f')],function(_0x382845){return{'model':db[_0x382845[_0x6d50('0x21')]],'as':_0x382845['as'],'attributes':_0x382845['attributes'],'include':_0x382845['include']?_[_0x6d50('0x20')](_0x382845[_0x6d50('0x1f')],function(_0x572706){return{'model':db[_0x572706[_0x6d50('0x21')]],'as':_0x572706['as'],'attributes':_0x572706['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d50('0x11')](function(_0x401201){logger[_0x6d50('0x12')](_0x6d50('0x1b'),_0x49da8a);logger[_0x6d50('0x15')](_0x6d50('0x1b'),_0x49da8a,JSON['stringify'](_0x401201));_0x17cb78(_0x401201);})[_0x6d50('0x1a')](function(_0x2cd546){logger['error']('GetMailQueue',_0x2cd546[_0x6d50('0x18')],_0x49da8a);_0xbb26ef(_0x4f2423[_0x6d50('0x17')](0x1f4,_0x2cd546['message']));});});};exports[_0x6d50('0x23')]=function(_0x41f0b3){var _0x274153=this;return new Promise(function(_0x573583,_0x28e123){return db['MailQueue']['find']({'raw':_0x41f0b3['options']?_0x41f0b3[_0x6d50('0x1d')][_0x6d50('0x24')]===undefined?!![]:![]:!![],'where':_0x41f0b3[_0x6d50('0x1d')]?_0x41f0b3['options']['where']||null:null,'attributes':_0x41f0b3['options']?_0x41f0b3[_0x6d50('0x1d')][_0x6d50('0x22')]||null:null,'include':_0x41f0b3[_0x6d50('0x1d')]?_0x41f0b3[_0x6d50('0x1d')][_0x6d50('0x1f')]?_[_0x6d50('0x20')](_0x41f0b3[_0x6d50('0x1d')][_0x6d50('0x1f')],function(_0x4f1b30){return{'model':db[_0x4f1b30['model']],'as':_0x4f1b30['as'],'attributes':_0x4f1b30[_0x6d50('0x22')],'include':_0x4f1b30[_0x6d50('0x1f')]?_[_0x6d50('0x20')](_0x4f1b30['include'],function(_0x45c3a0){return{'model':db[_0x45c3a0[_0x6d50('0x21')]],'as':_0x45c3a0['as'],'attributes':_0x45c3a0[_0x6d50('0x22')],'include':_0x45c3a0['include']?_['map'](_0x45c3a0[_0x6d50('0x1f')],function(_0x59ddfd){return{'model':db[_0x59ddfd['model']],'as':_0x59ddfd['as'],'attributes':_0x59ddfd[_0x6d50('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xaa1b58){logger[_0x6d50('0x12')](_0x6d50('0x23'),_0x41f0b3);logger[_0x6d50('0x15')](_0x6d50('0x23'),_0x41f0b3,JSON['stringify'](_0xaa1b58));_0x573583(_0xaa1b58);})[_0x6d50('0x1a')](function(_0x5c67d7){logger['error'](_0x6d50('0x23'),_0x5c67d7[_0x6d50('0x18')],_0x41f0b3);_0x28e123(_0x274153[_0x6d50('0x17')](0x1f4,_0x5c67d7[_0x6d50('0x18')]));});});}; \ No newline at end of file +var _0xf9b6=['../../config/utils','../../config/logger','rpc','defaults','localhost','socket.io-emitter','redis','./mailQueue.socket','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','attributes','map','include','model','ShowMailQueue','find','util','moment','randomstring','../../mysqldb'];(function(_0x2c6db2,_0x58d932){var _0x2a3516=function(_0x431eee){while(--_0x431eee){_0x2c6db2['push'](_0x2c6db2['shift']());}};_0x2a3516(++_0x58d932);}(_0xf9b6,0x114));var _0x6f9b=function(_0x54bc96,_0x20cb68){_0x54bc96=_0x54bc96-0x0;var _0x4685b9=_0xf9b6[_0x54bc96];return _0x4685b9;};'use strict';var _=require('lodash');var util=require(_0x6f9b('0x0'));var moment=require(_0x6f9b('0x1'));var BPromise=require('bluebird');var rs=require(_0x6f9b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f9b('0x3'))['db'];var utils=require(_0x6f9b('0x4'));var logger=require(_0x6f9b('0x5'))(_0x6f9b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x6f9b('0x7')](config['redis'],{'host':_0x6f9b('0x8'),'port':0x18eb});var socket=require(_0x6f9b('0x9'))(new Redis(config[_0x6f9b('0xa')]));require(_0x6f9b('0xb'))['register'](socket);function respondWithRpcPromise(_0x511174,_0x237dd9,_0x337bba){return new BPromise(function(_0x1450ff,_0x38903e){return client['request'](_0x511174,_0x337bba)[_0x6f9b('0xc')](function(_0xd85e13){logger[_0x6f9b('0xd')]('MailQueue,\x20%s,\x20%s',_0x237dd9,_0x6f9b('0xe'));logger[_0x6f9b('0xf')](_0x6f9b('0x10'),_0x237dd9,_0x6f9b('0xe'),JSON[_0x6f9b('0x11')](_0xd85e13));if(_0xd85e13['error']){if(_0xd85e13[_0x6f9b('0x12')][_0x6f9b('0x13')]===0x1f4){logger[_0x6f9b('0x12')](_0x6f9b('0x14'),_0x237dd9,_0xd85e13['error'][_0x6f9b('0x15')]);return _0x38903e(_0xd85e13[_0x6f9b('0x12')][_0x6f9b('0x15')]);}logger[_0x6f9b('0x12')](_0x6f9b('0x14'),_0x237dd9,_0xd85e13[_0x6f9b('0x12')][_0x6f9b('0x15')]);return _0x1450ff(_0xd85e13[_0x6f9b('0x12')]['message']);}else{logger[_0x6f9b('0xd')]('MailQueue,\x20%s,\x20%s',_0x237dd9,_0x6f9b('0xe'));_0x1450ff(_0xd85e13[_0x6f9b('0x16')][_0x6f9b('0x15')]);}})[_0x6f9b('0x17')](function(_0x2d1bf3){logger['error']('MailQueue,\x20%s,\x20%s',_0x237dd9,_0x2d1bf3);_0x38903e(_0x2d1bf3);});});}exports[_0x6f9b('0x18')]=function(_0x3ae9ea){var _0x3df88c=this;return new Promise(function(_0x3037d8,_0x323807){return db[_0x6f9b('0x19')][_0x6f9b('0x1a')]({'raw':_0x3ae9ea['options']?_0x3ae9ea[_0x6f9b('0x1b')][_0x6f9b('0x1c')]===undefined?!![]:![]:!![],'where':_0x3ae9ea['options']?_0x3ae9ea[_0x6f9b('0x1b')]['where']||null:null,'attributes':_0x3ae9ea['options']?_0x3ae9ea[_0x6f9b('0x1b')][_0x6f9b('0x1d')]||null:null,'limit':_0x3ae9ea['options']?_0x3ae9ea[_0x6f9b('0x1b')]['limit']||null:null,'include':_0x3ae9ea['options']?_0x3ae9ea[_0x6f9b('0x1b')]['include']?_[_0x6f9b('0x1e')](_0x3ae9ea[_0x6f9b('0x1b')][_0x6f9b('0x1f')],function(_0x308a35){return{'model':db[_0x308a35[_0x6f9b('0x20')]],'as':_0x308a35['as'],'attributes':_0x308a35[_0x6f9b('0x1d')],'include':_0x308a35[_0x6f9b('0x1f')]?_[_0x6f9b('0x1e')](_0x308a35[_0x6f9b('0x1f')],function(_0x6e163a){return{'model':db[_0x6e163a[_0x6f9b('0x20')]],'as':_0x6e163a['as'],'attributes':_0x6e163a['attributes'],'include':_0x6e163a[_0x6f9b('0x1f')]?_[_0x6f9b('0x1e')](_0x6e163a[_0x6f9b('0x1f')],function(_0x51b667){return{'model':db[_0x51b667['model']],'as':_0x51b667['as'],'attributes':_0x51b667[_0x6f9b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6f9b('0xc')](function(_0x22ddfc){logger['info'](_0x6f9b('0x18'),_0x3ae9ea);logger[_0x6f9b('0xf')]('GetMailQueue',_0x3ae9ea,JSON['stringify'](_0x22ddfc));_0x3037d8(_0x22ddfc);})[_0x6f9b('0x17')](function(_0x23df54){logger[_0x6f9b('0x12')]('GetMailQueue',_0x23df54[_0x6f9b('0x15')],_0x3ae9ea);_0x323807(_0x3df88c[_0x6f9b('0x12')](0x1f4,_0x23df54[_0x6f9b('0x15')]));});});};exports[_0x6f9b('0x21')]=function(_0x460227){var _0x2470e1=this;return new Promise(function(_0x3a8f17,_0x2c98fa){return db[_0x6f9b('0x19')][_0x6f9b('0x22')]({'raw':_0x460227['options']?_0x460227[_0x6f9b('0x1b')][_0x6f9b('0x1c')]===undefined?!![]:![]:!![],'where':_0x460227[_0x6f9b('0x1b')]?_0x460227[_0x6f9b('0x1b')]['where']||null:null,'attributes':_0x460227[_0x6f9b('0x1b')]?_0x460227[_0x6f9b('0x1b')]['attributes']||null:null,'include':_0x460227['options']?_0x460227[_0x6f9b('0x1b')][_0x6f9b('0x1f')]?_['map'](_0x460227[_0x6f9b('0x1b')][_0x6f9b('0x1f')],function(_0x1cb962){return{'model':db[_0x1cb962['model']],'as':_0x1cb962['as'],'attributes':_0x1cb962[_0x6f9b('0x1d')],'include':_0x1cb962['include']?_[_0x6f9b('0x1e')](_0x1cb962[_0x6f9b('0x1f')],function(_0x3d46e8){return{'model':db[_0x3d46e8[_0x6f9b('0x20')]],'as':_0x3d46e8['as'],'attributes':_0x3d46e8['attributes'],'include':_0x3d46e8[_0x6f9b('0x1f')]?_[_0x6f9b('0x1e')](_0x3d46e8['include'],function(_0x3b370f){return{'model':db[_0x3b370f[_0x6f9b('0x20')]],'as':_0x3b370f['as'],'attributes':_0x3b370f[_0x6f9b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6f9b('0xc')](function(_0x23be72){logger['info']('ShowMailQueue',_0x460227);logger['debug']('ShowMailQueue',_0x460227,JSON[_0x6f9b('0x11')](_0x23be72));_0x3a8f17(_0x23be72);})[_0x6f9b('0x17')](function(_0x102961){logger[_0x6f9b('0x12')](_0x6f9b('0x21'),_0x102961[_0x6f9b('0x15')],_0x460227);_0x2c98fa(_0x2470e1[_0x6f9b('0x12')](0x1f4,_0x102961[_0x6f9b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 5fa487f..f79c1b5 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 _0x1abc=['register','length','mailQueue:','./mailQueue.events','save','emit','removeListener'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x1abc,0x1ae));var _0xc1ab=function(_0x495d48,_0x52939a){_0x495d48=_0x495d48-0x0;var _0xa49f40=_0x1abc[_0x495d48];return _0xa49f40;};'use strict';var MailQueueEvents=require(_0xc1ab('0x0'));var events=[_0xc1ab('0x1'),'remove','update'];function createListener(_0x5e2f4c,_0x4a126f){return function(_0x1543fc){_0x4a126f[_0xc1ab('0x2')](_0x5e2f4c,_0x1543fc);};}function removeListener(_0x2b7e9e,_0x888120){return function(){MailQueueEvents[_0xc1ab('0x3')](_0x2b7e9e,_0x888120);};}exports[_0xc1ab('0x4')]=function(_0x384fb0){for(var _0x522d0c=0x0,_0x573acd=events[_0xc1ab('0x5')];_0x522d0c<_0x573acd;_0x522d0c++){var _0x1d2d45=events[_0x522d0c];var _0x278e41=createListener(_0xc1ab('0x6')+_0x1d2d45,_0x384fb0);MailQueueEvents['on'](_0x1d2d45,_0x278e41);}}; \ No newline at end of file +var _0xf93d=['emit','removeListener','save','remove','update'];(function(_0x5460aa,_0x48b3c3){var _0x66394d=function(_0x133e60){while(--_0x133e60){_0x5460aa['push'](_0x5460aa['shift']());}};_0x66394d(++_0x48b3c3);}(_0xf93d,0x11f));var _0xdf93=function(_0x2b3c95,_0x373430){_0x2b3c95=_0x2b3c95-0x0;var _0xa293e4=_0xf93d[_0x2b3c95];return _0xa293e4;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xdf93('0x0'),_0xdf93('0x1'),_0xdf93('0x2')];function createListener(_0x1367e4,_0x832bda){return function(_0x316298){_0x832bda[_0xdf93('0x3')](_0x1367e4,_0x316298);};}function removeListener(_0x537180,_0x4777cc){return function(){MailQueueEvents[_0xdf93('0x4')](_0x537180,_0x4777cc);};}exports['register']=function(_0x5194ad){for(var _0x378b83=0x0,_0x4d356e=events['length'];_0x378b83<_0x4d356e;_0x378b83++){var _0x3cb77b=events[_0x378b83];var _0x3cbd61=createListener('mailQueue:'+_0x3cb77b,_0x5194ad);MailQueueEvents['on'](_0x3cb77b,_0x3cbd61);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 95c8cfe..8ef6578 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 _0xaf53=['fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','index','get','/describe','isAuthenticated','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x314c1f,_0x53f85d){var _0x49bcca=function(_0x462004){while(--_0x462004){_0x314c1f['push'](_0x314c1f['shift']());}};_0x49bcca(++_0x53f85d);}(_0xaf53,0x14f));var _0x3af5=function(_0x4fd28d,_0x3f0fbb){_0x4fd28d=_0x4fd28d-0x0;var _0x104b37=_0xaf53[_0x4fd28d];return _0x104b37;};'use strict';var multer=require(_0x3af5('0x0'));var util=require(_0x3af5('0x1'));var path=require(_0x3af5('0x2'));var timeout=require(_0x3af5('0x3'));var express=require(_0x3af5('0x4'));var router=express['Router']();var fs_extra=require(_0x3af5('0x5'));var auth=require(_0x3af5('0x6'));var interaction=require(_0x3af5('0x7'));var config=require('../../config/environment');var controller=require(_0x3af5('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3af5('0x9')]);router[_0x3af5('0xa')](_0x3af5('0xb'),auth[_0x3af5('0xc')](),controller['describe']);router[_0x3af5('0xa')](_0x3af5('0xd'),auth[_0x3af5('0xc')](),controller[_0x3af5('0xe')]);router[_0x3af5('0xf')]('/',auth[_0x3af5('0xc')](),controller['create']);router['put'](_0x3af5('0xd'),auth[_0x3af5('0xc')](),controller[_0x3af5('0x10')]);router[_0x3af5('0x11')](_0x3af5('0xd'),auth[_0x3af5('0xc')](),controller[_0x3af5('0x12')]);module[_0x3af5('0x13')]=router; \ No newline at end of file +var _0xa741=['Router','../../components/auth/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','describe','get','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x35a016,_0x4ea8e5){var _0x42bb4e=function(_0x650e0){while(--_0x650e0){_0x35a016['push'](_0x35a016['shift']());}};_0x42bb4e(++_0x4ea8e5);}(_0xa741,0x100));var _0x1a74=function(_0x1bbcdb,_0x12ce8f){_0x1bbcdb=_0x1bbcdb-0x0;var _0x3c9c4a=_0xa741[_0x1bbcdb];return _0x3c9c4a;};'use strict';var multer=require(_0x1a74('0x0'));var util=require(_0x1a74('0x1'));var path=require('path');var timeout=require(_0x1a74('0x2'));var express=require(_0x1a74('0x3'));var router=express[_0x1a74('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1a74('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1a74('0x6'));var controller=require(_0x1a74('0x7'));router['get']('/',auth[_0x1a74('0x8')](),controller[_0x1a74('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x1a74('0xa')]);router[_0x1a74('0xb')](_0x1a74('0xc'),auth[_0x1a74('0x8')](),controller[_0x1a74('0xd')]);router['post']('/',auth[_0x1a74('0x8')](),controller[_0x1a74('0xe')]);router[_0x1a74('0xf')](_0x1a74('0xc'),auth['isAuthenticated'](),controller[_0x1a74('0x10')]);router[_0x1a74('0x11')]('/:id',auth[_0x1a74('0x8')](),controller[_0x1a74('0x12')]);module[_0x1a74('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 93aadb6..84af9d6 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 _0x6aa9=['STRING','DATE','moment','sequelize','exports'];(function(_0x4ff710,_0x37235e){var _0x1837f9=function(_0x5f35b3){while(--_0x5f35b3){_0x4ff710['push'](_0x4ff710['shift']());}};_0x1837f9(++_0x37235e);}(_0x6aa9,0x66));var _0x96aa=function(_0x3d3860,_0x2d4f89){_0x3d3860=_0x3d3860-0x0;var _0x28e60a=_0x6aa9[_0x3d3860];return _0x28e60a;};'use strict';var moment=require(_0x96aa('0x0'));var Sequelize=require(_0x96aa('0x1'));module[_0x96aa('0x2')]={'uniqueid':{'type':Sequelize[_0x96aa('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x96aa('0x3')]},'joinAt':{'type':Sequelize[_0x96aa('0x4')]},'leaveAt':{'type':Sequelize[_0x96aa('0x4')]},'acceptAt':{'type':Sequelize[_0x96aa('0x4')]},'exitAt':{'type':Sequelize[_0x96aa('0x4')]},'reason':{'type':Sequelize[_0x96aa('0x3')]}}; \ No newline at end of file +var _0x1c6e=['DATE','moment','sequelize','exports','STRING'];(function(_0x326bbb,_0x2a807b){var _0x1ba652=function(_0x1fd76d){while(--_0x1fd76d){_0x326bbb['push'](_0x326bbb['shift']());}};_0x1ba652(++_0x2a807b);}(_0x1c6e,0x79));var _0xe1c6=function(_0x1ca4c3,_0x554126){_0x1ca4c3=_0x1ca4c3-0x0;var _0x4426a6=_0x1c6e[_0x1ca4c3];return _0x4426a6;};'use strict';var moment=require(_0xe1c6('0x0'));var Sequelize=require(_0xe1c6('0x1'));module[_0xe1c6('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xe1c6('0x3')]},'joinAt':{'type':Sequelize[_0xe1c6('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe1c6('0x4')]},'exitAt':{'type':Sequelize[_0xe1c6('0x4')]},'reason':{'type':Sequelize[_0xe1c6('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 2bdfec2..9fdccfa 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 _0x4991=['hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','MailQueueReport','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x517e91,_0x133d62){var _0x153268=function(_0x543644){while(--_0x543644){_0x517e91['push'](_0x517e91['shift']());}};_0x153268(++_0x133d62);}(_0x4991,0xf7));var _0x1499=function(_0x5d2831,_0x42e3ad){_0x5d2831=_0x5d2831-0x0;var _0x377601=_0x4991[_0x5d2831];return _0x377601;};'use strict';var emlformat=require(_0x1499('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1499('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1499('0x2'));var moment=require(_0x1499('0x3'));var BPromise=require(_0x1499('0x4'));var Mustache=require(_0x1499('0x5'));var util=require(_0x1499('0x6'));var path=require(_0x1499('0x7'));var sox=require(_0x1499('0x8'));var csv=require(_0x1499('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1499('0xa'));var _=require(_0x1499('0xb'));var squel=require(_0x1499('0xc'));var crypto=require(_0x1499('0xd'));var jsforce=require(_0x1499('0xe'));var deskjs=require(_0x1499('0xf'));var toCsv=require(_0x1499('0x9'));var querystring=require(_0x1499('0x10'));var Papa=require('papaparse');var Redis=require(_0x1499('0x11'));var authService=require(_0x1499('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1499('0x13'));var hardwareService=require(_0x1499('0x14'));var logger=require('../../config/logger')(_0x1499('0x15'));var utils=require(_0x1499('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3039ce,_0x274bc1){_0x274bc1=_0x274bc1||0xcc;return function(_0x34a928){if(_0x34a928){return _0x3039ce[_0x1499('0x17')](_0x274bc1);}return _0x3039ce[_0x1499('0x18')](_0x274bc1)['end']();};}function respondWithResult(_0x5f34f2,_0x308177){_0x308177=_0x308177||0xc8;return function(_0x4e5195){if(_0x4e5195){return _0x5f34f2[_0x1499('0x18')](_0x308177)[_0x1499('0x19')](_0x4e5195);}};}function respondWithFilteredResult(_0x308318,_0x3ab605){return function(_0x48f654){if(_0x48f654){var _0x1ed43b=typeof _0x3ab605[_0x1499('0x1a')]==='undefined'&&typeof _0x3ab605[_0x1499('0x1b')]===_0x1499('0x1c');var _0x46b364=_0x48f654[_0x1499('0x1d')];var _0x1e45a9=_0x1ed43b?0x0:_0x3ab605[_0x1499('0x1a')];var _0x5b9859=_0x1ed43b?_0x48f654['count']:_0x3ab605['offset']+_0x3ab605[_0x1499('0x1b')];var _0xad534b;if(_0x5b9859>=_0x46b364){_0x5b9859=_0x46b364;_0xad534b=0xc8;}else{_0xad534b=0xce;}_0x308318['status'](_0xad534b);return _0x308318[_0x1499('0x1e')](_0x1499('0x1f'),_0x1e45a9+'-'+_0x5b9859+'/'+_0x46b364)[_0x1499('0x19')](_0x48f654);}return null;};}function patchUpdates(_0x18e4a6){return function(_0x21e887){try{jsonpatch[_0x1499('0x20')](_0x21e887,_0x18e4a6,!![]);}catch(_0x2b0458){return BPromise[_0x1499('0x21')](_0x2b0458);}return _0x21e887[_0x1499('0x22')]();};}function saveUpdates(_0x15bcd4,_0x2bb71f){return function(_0x836081){if(_0x836081){return _0x836081[_0x1499('0x23')](_0x15bcd4)[_0x1499('0x24')](function(_0x4ec57a){return _0x4ec57a;});}return null;};}function removeEntity(_0x1e2c51,_0x2c7f57){return function(_0x5615b4){if(_0x5615b4){return _0x5615b4[_0x1499('0x25')]()[_0x1499('0x24')](function(){_0x1e2c51[_0x1499('0x18')](0xcc)[_0x1499('0x26')]();});}};}function handleEntityNotFound(_0x3968e0,_0x16d036){return function(_0x54f3c2){if(!_0x54f3c2){_0x3968e0['sendStatus'](0x194);}return _0x54f3c2;};}function handleError(_0x12739b,_0x3c9aca){_0x3c9aca=_0x3c9aca||0x1f4;return function(_0x3b9259){logger[_0x1499('0x27')](_0x3b9259[_0x1499('0x28')]);if(_0x3b9259['name']){delete _0x3b9259[_0x1499('0x29')];}_0x12739b['status'](_0x3c9aca)['send'](_0x3b9259);};}exports['index']=function(_0x21d204,_0x103efa){var _0x40932a={},_0x1b460b={},_0x3dad86={'count':0x0,'rows':[]};var _0x388513=_[_0x1499('0x2a')](db['MailQueueReport'][_0x1499('0x2b')],function(_0x1a2c99){return{'name':_0x1a2c99[_0x1499('0x2c')],'type':_0x1a2c99['type'][_0x1499('0x2d')]};});_0x1b460b[_0x1499('0x2e')]=_['map'](_0x388513,_0x1499('0x29'));_0x1b460b[_0x1499('0x2f')]=_['keys'](_0x21d204[_0x1499('0x2f')]);_0x1b460b[_0x1499('0x30')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],_0x1b460b[_0x1499('0x2f')]);_0x40932a[_0x1499('0x32')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x21d204[_0x1499('0x2f')][_0x1499('0x33')]));_0x40932a[_0x1499('0x32')]=_0x40932a[_0x1499('0x32')][_0x1499('0x34')]?_0x40932a[_0x1499('0x32')]:_0x1b460b[_0x1499('0x2e')];if(!_0x21d204[_0x1499('0x2f')][_0x1499('0x35')](_0x1499('0x36'))){_0x40932a[_0x1499('0x1b')]=qs['limit'](_0x21d204[_0x1499('0x2f')][_0x1499('0x1b')]);_0x40932a[_0x1499('0x1a')]=qs[_0x1499('0x1a')](_0x21d204[_0x1499('0x2f')][_0x1499('0x1a')]);}_0x40932a[_0x1499('0x37')]=qs[_0x1499('0x38')](_0x21d204[_0x1499('0x2f')][_0x1499('0x38')]);_0x40932a[_0x1499('0x39')]=qs['filters'](_['pick'](_0x21d204[_0x1499('0x2f')],_0x1b460b['filters']),_0x388513);if(_0x21d204[_0x1499('0x2f')]['filter']){_0x40932a[_0x1499('0x39')]=_[_0x1499('0x3a')](_0x40932a[_0x1499('0x39')],{'$or':_[_0x1499('0x2a')](_0x388513,function(_0x531933){if(_0x531933[_0x1499('0x3b')]!=='VIRTUAL'){var _0x2f9c59={};_0x2f9c59[_0x531933[_0x1499('0x29')]]={'$like':'%'+_0x21d204[_0x1499('0x2f')][_0x1499('0x3c')]+'%'};return _0x2f9c59;}})});}_0x40932a=_['merge']({},_0x40932a,_0x21d204[_0x1499('0x3d')]);var _0x815a99={'where':_0x40932a[_0x1499('0x39')]};return db[_0x1499('0x3e')]['count'](_0x815a99)[_0x1499('0x24')](function(_0x4cc411){_0x3dad86[_0x1499('0x1d')]=_0x4cc411;if(_0x21d204[_0x1499('0x2f')][_0x1499('0x3f')]){_0x40932a[_0x1499('0x40')]=[{'all':!![]}];}return db[_0x1499('0x3e')][_0x1499('0x41')](_0x40932a);})[_0x1499('0x24')](function(_0xcb85eb){_0x3dad86[_0x1499('0x42')]=_0xcb85eb;return _0x3dad86;})[_0x1499('0x24')](respondWithFilteredResult(_0x103efa,_0x40932a))['catch'](handleError(_0x103efa,null));};exports[_0x1499('0x43')]=function(_0x5dd36c,_0x2cfdaf){var _0x1af1a1={'raw':!![],'where':{'id':_0x5dd36c[_0x1499('0x44')]['id']}},_0x5646cf={};_0x5646cf[_0x1499('0x2e')]=_[_0x1499('0x45')](db[_0x1499('0x3e')][_0x1499('0x2b')]);_0x5646cf['query']=_['keys'](_0x5dd36c[_0x1499('0x2f')]);_0x5646cf[_0x1499('0x30')]=_['intersection'](_0x5646cf[_0x1499('0x2e')],_0x5646cf[_0x1499('0x2f')]);_0x1af1a1['attributes']=_['intersection'](_0x5646cf[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x5dd36c[_0x1499('0x2f')]['fields']));_0x1af1a1[_0x1499('0x32')]=_0x1af1a1[_0x1499('0x32')][_0x1499('0x34')]?_0x1af1a1[_0x1499('0x32')]:_0x5646cf['model'];if(_0x5dd36c[_0x1499('0x2f')][_0x1499('0x3f')]){_0x1af1a1[_0x1499('0x40')]=[{'all':!![]}];}_0x1af1a1=_[_0x1499('0x3a')]({},_0x1af1a1,_0x5dd36c['options']);return db[_0x1499('0x3e')][_0x1499('0x46')](_0x1af1a1)[_0x1499('0x24')](handleEntityNotFound(_0x2cfdaf,null))['then'](respondWithResult(_0x2cfdaf,null))['catch'](handleError(_0x2cfdaf,null));};exports[_0x1499('0x47')]=function(_0x491777,_0x7fa101){return db[_0x1499('0x3e')][_0x1499('0x47')](_0x491777[_0x1499('0x48')],{})[_0x1499('0x24')](respondWithResult(_0x7fa101,0xc9))[_0x1499('0x49')](handleError(_0x7fa101,null));};exports[_0x1499('0x23')]=function(_0x591aa8,_0x420d16){if(_0x591aa8['body']['id']){delete _0x591aa8[_0x1499('0x48')]['id'];}return db[_0x1499('0x3e')]['find']({'where':{'id':_0x591aa8[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x420d16,null))[_0x1499('0x24')](saveUpdates(_0x591aa8['body'],null))[_0x1499('0x24')](respondWithResult(_0x420d16,null))[_0x1499('0x49')](handleError(_0x420d16,null));};exports[_0x1499('0x25')]=function(_0x29ac0f,_0x305599){return db[_0x1499('0x3e')][_0x1499('0x46')]({'where':{'id':_0x29ac0f[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x305599,null))[_0x1499('0x24')](removeEntity(_0x305599,null))['catch'](handleError(_0x305599,null));};exports[_0x1499('0x4a')]=function(_0x9f0520,_0x278178){return db['MailQueueReport'][_0x1499('0x4a')]()[_0x1499('0x24')](respondWithResult(_0x278178,null))['catch'](handleError(_0x278178,null));}; \ No newline at end of file +var _0x5c3c=['findAll','rows','params','merge','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','limit','count','offset','Content-Range','json','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','MailQueueReport','includeAll','include'];(function(_0x14af49,_0x4eaf2d){var _0x33b9e6=function(_0x12eb0b){while(--_0x12eb0b){_0x14af49['push'](_0x14af49['shift']());}};_0x33b9e6(++_0x4eaf2d);}(_0x5c3c,0x132));var _0xc5c3=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x5c3c[_0x4e6ae6];return _0x23c108;};'use strict';var emlformat=require(_0xc5c3('0x0'));var rimraf=require(_0xc5c3('0x1'));var zipdir=require(_0xc5c3('0x2'));var jsonpatch=require(_0xc5c3('0x3'));var rp=require('request-promise');var moment=require(_0xc5c3('0x4'));var BPromise=require(_0xc5c3('0x5'));var Mustache=require(_0xc5c3('0x6'));var util=require(_0xc5c3('0x7'));var path=require(_0xc5c3('0x8'));var sox=require(_0xc5c3('0x9'));var csv=require(_0xc5c3('0xa'));var ejs=require(_0xc5c3('0xb'));var fs=require('fs');var fs_extra=require(_0xc5c3('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc5c3('0xd'));var deskjs=require(_0xc5c3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc5c3('0xf'));var Papa=require(_0xc5c3('0x10'));var Redis=require('ioredis');var authService=require(_0xc5c3('0x11'));var qs=require(_0xc5c3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5c3('0x13'));var logger=require(_0xc5c3('0x14'))(_0xc5c3('0x15'));var utils=require('../../config/utils');var config=require(_0xc5c3('0x16'));var licenseUtil=require(_0xc5c3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b56e6,_0x44d2b9){_0x44d2b9=_0x44d2b9||0xcc;return function(_0x3f0f45){if(_0x3f0f45){return _0x2b56e6['sendStatus'](_0x44d2b9);}return _0x2b56e6[_0xc5c3('0x18')](_0x44d2b9)[_0xc5c3('0x19')]();};}function respondWithResult(_0x1488ab,_0x13a740){_0x13a740=_0x13a740||0xc8;return function(_0xc8a636){if(_0xc8a636){return _0x1488ab['status'](_0x13a740)['json'](_0xc8a636);}};}function respondWithFilteredResult(_0x4445ea,_0x577e1a){return function(_0x1bae87){if(_0x1bae87){var _0xef8b21=typeof _0x577e1a['offset']==='undefined'&&typeof _0x577e1a[_0xc5c3('0x1a')]==='undefined';var _0xa9bc84=_0x1bae87[_0xc5c3('0x1b')];var _0x2ff158=_0xef8b21?0x0:_0x577e1a[_0xc5c3('0x1c')];var _0x28bae6=_0xef8b21?_0x1bae87['count']:_0x577e1a[_0xc5c3('0x1c')]+_0x577e1a[_0xc5c3('0x1a')];var _0x123dba;if(_0x28bae6>=_0xa9bc84){_0x28bae6=_0xa9bc84;_0x123dba=0xc8;}else{_0x123dba=0xce;}_0x4445ea[_0xc5c3('0x18')](_0x123dba);return _0x4445ea['set'](_0xc5c3('0x1d'),_0x2ff158+'-'+_0x28bae6+'/'+_0xa9bc84)[_0xc5c3('0x1e')](_0x1bae87);}return null;};}function patchUpdates(_0x3cc612){return function(_0x3ca20a){try{jsonpatch[_0xc5c3('0x1f')](_0x3ca20a,_0x3cc612,!![]);}catch(_0x564815){return BPromise[_0xc5c3('0x20')](_0x564815);}return _0x3ca20a[_0xc5c3('0x21')]();};}function saveUpdates(_0x370254,_0x2de266){return function(_0x1c5793){if(_0x1c5793){return _0x1c5793[_0xc5c3('0x22')](_0x370254)[_0xc5c3('0x23')](function(_0x5996a0){return _0x5996a0;});}return null;};}function removeEntity(_0x52d638,_0x45affe){return function(_0x38dd9e){if(_0x38dd9e){return _0x38dd9e['destroy']()['then'](function(){_0x52d638[_0xc5c3('0x18')](0xcc)[_0xc5c3('0x19')]();});}};}function handleEntityNotFound(_0x38a3df,_0x52e54a){return function(_0x4af067){if(!_0x4af067){_0x38a3df[_0xc5c3('0x24')](0x194);}return _0x4af067;};}function handleError(_0x22f607,_0x20c506){_0x20c506=_0x20c506||0x1f4;return function(_0x29791c){logger['error'](_0x29791c[_0xc5c3('0x25')]);if(_0x29791c['name']){delete _0x29791c[_0xc5c3('0x26')];}_0x22f607['status'](_0x20c506)[_0xc5c3('0x27')](_0x29791c);};}exports[_0xc5c3('0x28')]=function(_0x4269eb,_0x4773c5){var _0x15361c={},_0x2d07e1={},_0x35a397={'count':0x0,'rows':[]};var _0x4b5a0c=_[_0xc5c3('0x29')](db['MailQueueReport'][_0xc5c3('0x2a')],function(_0x43ebfc){return{'name':_0x43ebfc['fieldName'],'type':_0x43ebfc['type'][_0xc5c3('0x2b')]};});_0x2d07e1[_0xc5c3('0x2c')]=_[_0xc5c3('0x29')](_0x4b5a0c,_0xc5c3('0x26'));_0x2d07e1['query']=_[_0xc5c3('0x2d')](_0x4269eb[_0xc5c3('0x2e')]);_0x2d07e1[_0xc5c3('0x2f')]=_[_0xc5c3('0x30')](_0x2d07e1[_0xc5c3('0x2c')],_0x2d07e1[_0xc5c3('0x2e')]);_0x15361c[_0xc5c3('0x31')]=_[_0xc5c3('0x30')](_0x2d07e1[_0xc5c3('0x2c')],qs['fields'](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x32')]));_0x15361c[_0xc5c3('0x31')]=_0x15361c[_0xc5c3('0x31')][_0xc5c3('0x33')]?_0x15361c[_0xc5c3('0x31')]:_0x2d07e1[_0xc5c3('0x2c')];if(!_0x4269eb['query']['hasOwnProperty'](_0xc5c3('0x34'))){_0x15361c['limit']=qs[_0xc5c3('0x1a')](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x1a')]);_0x15361c[_0xc5c3('0x1c')]=qs[_0xc5c3('0x1c')](_0x4269eb['query'][_0xc5c3('0x1c')]);}_0x15361c[_0xc5c3('0x35')]=qs['sort'](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x36')]);_0x15361c[_0xc5c3('0x37')]=qs[_0xc5c3('0x2f')](_[_0xc5c3('0x38')](_0x4269eb[_0xc5c3('0x2e')],_0x2d07e1[_0xc5c3('0x2f')]),_0x4b5a0c);if(_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x39')]){_0x15361c[_0xc5c3('0x37')]=_['merge'](_0x15361c[_0xc5c3('0x37')],{'$or':_['map'](_0x4b5a0c,function(_0x4fdbe6){if(_0x4fdbe6[_0xc5c3('0x3a')]!==_0xc5c3('0x3b')){var _0x1b546e={};_0x1b546e[_0x4fdbe6[_0xc5c3('0x26')]]={'$like':'%'+_0x4269eb[_0xc5c3('0x2e')]['filter']+'%'};return _0x1b546e;}})});}_0x15361c=_['merge']({},_0x15361c,_0x4269eb[_0xc5c3('0x3c')]);var _0xa7cb91={'where':_0x15361c['where']};return db[_0xc5c3('0x3d')]['count'](_0xa7cb91)[_0xc5c3('0x23')](function(_0x2dfd19){_0x35a397[_0xc5c3('0x1b')]=_0x2dfd19;if(_0x4269eb['query'][_0xc5c3('0x3e')]){_0x15361c[_0xc5c3('0x3f')]=[{'all':!![]}];}return db['MailQueueReport'][_0xc5c3('0x40')](_0x15361c);})['then'](function(_0x33936c){_0x35a397[_0xc5c3('0x41')]=_0x33936c;return _0x35a397;})['then'](respondWithFilteredResult(_0x4773c5,_0x15361c))['catch'](handleError(_0x4773c5,null));};exports['show']=function(_0xfb64bb,_0x2f02ab){var _0x49b1fc={'raw':!![],'where':{'id':_0xfb64bb[_0xc5c3('0x42')]['id']}},_0x1a8490={};_0x1a8490[_0xc5c3('0x2c')]=_[_0xc5c3('0x2d')](db['MailQueueReport'][_0xc5c3('0x2a')]);_0x1a8490['query']=_['keys'](_0xfb64bb[_0xc5c3('0x2e')]);_0x1a8490[_0xc5c3('0x2f')]=_['intersection'](_0x1a8490[_0xc5c3('0x2c')],_0x1a8490[_0xc5c3('0x2e')]);_0x49b1fc['attributes']=_[_0xc5c3('0x30')](_0x1a8490['model'],qs[_0xc5c3('0x32')](_0xfb64bb[_0xc5c3('0x2e')]['fields']));_0x49b1fc[_0xc5c3('0x31')]=_0x49b1fc['attributes'][_0xc5c3('0x33')]?_0x49b1fc[_0xc5c3('0x31')]:_0x1a8490['model'];if(_0xfb64bb[_0xc5c3('0x2e')][_0xc5c3('0x3e')]){_0x49b1fc[_0xc5c3('0x3f')]=[{'all':!![]}];}_0x49b1fc=_[_0xc5c3('0x43')]({},_0x49b1fc,_0xfb64bb[_0xc5c3('0x3c')]);return db[_0xc5c3('0x3d')]['find'](_0x49b1fc)[_0xc5c3('0x23')](handleEntityNotFound(_0x2f02ab,null))[_0xc5c3('0x23')](respondWithResult(_0x2f02ab,null))[_0xc5c3('0x44')](handleError(_0x2f02ab,null));};exports[_0xc5c3('0x45')]=function(_0x23002b,_0x4a7330){return db['MailQueueReport'][_0xc5c3('0x45')](_0x23002b[_0xc5c3('0x46')],{})[_0xc5c3('0x23')](respondWithResult(_0x4a7330,0xc9))['catch'](handleError(_0x4a7330,null));};exports[_0xc5c3('0x22')]=function(_0x65f720,_0x3a901f){if(_0x65f720[_0xc5c3('0x46')]['id']){delete _0x65f720[_0xc5c3('0x46')]['id'];}return db[_0xc5c3('0x3d')][_0xc5c3('0x47')]({'where':{'id':_0x65f720['params']['id']}})[_0xc5c3('0x23')](handleEntityNotFound(_0x3a901f,null))[_0xc5c3('0x23')](saveUpdates(_0x65f720[_0xc5c3('0x46')],null))['then'](respondWithResult(_0x3a901f,null))[_0xc5c3('0x44')](handleError(_0x3a901f,null));};exports[_0xc5c3('0x48')]=function(_0x3b1bc2,_0x103bde){return db[_0xc5c3('0x3d')]['find']({'where':{'id':_0x3b1bc2[_0xc5c3('0x42')]['id']}})['then'](handleEntityNotFound(_0x103bde,null))[_0xc5c3('0x23')](removeEntity(_0x103bde,null))['catch'](handleError(_0x103bde,null));};exports[_0xc5c3('0x49')]=function(_0x34a2c3,_0x4add6b){return db[_0xc5c3('0x3d')][_0xc5c3('0x49')]()['then'](respondWithResult(_0x4add6b,null))[_0xc5c3('0x44')](handleError(_0x4add6b,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 7e7f204..b14ac05 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 _0x336e=['path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','../../config/logger','moment','request-promise'];(function(_0x4b3413,_0x58c416){var _0x3b01ba=function(_0xb25f43){while(--_0xb25f43){_0x4b3413['push'](_0x4b3413['shift']());}};_0x3b01ba(++_0x58c416);}(_0x336e,0xad));var _0xe336=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x336e[_0x3070dc];return _0x431489;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe336('0x0'))('api');var moment=require(_0xe336('0x1'));var BPromise=require('bluebird');var rp=require(_0xe336('0x2'));var fs=require('fs');var path=require(_0xe336('0x3'));var rimraf=require(_0xe336('0x4'));var config=require(_0xe336('0x5'));var attributes=require(_0xe336('0x6'));module[_0xe336('0x7')]=function(_0x2274c0,_0x3cdde1){return _0x2274c0[_0xe336('0x8')](_0xe336('0x9'),attributes,{'tableName':_0xe336('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdded=['MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define'];(function(_0x1125cd,_0x523546){var _0x15b496=function(_0xc1a381){while(--_0xc1a381){_0x1125cd['push'](_0x1125cd['shift']());}};_0x15b496(++_0x523546);}(_0xdded,0x17a));var _0xddde=function(_0x24d771,_0x49e7bb){_0x24d771=_0x24d771-0x0;var _0x2c6bd7=_0xdded[_0x24d771];return _0x2c6bd7;};'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':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 1bd4da3..f3dbb2e 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 _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x2cdd8a,_0x4c4537){var _0x228286=function(_0x2f4b89){while(--_0x2f4b89){_0x2cdd8a['push'](_0x2cdd8a['shift']());}};_0x228286(++_0x4c4537);}(_0xadb5,0xad));var _0x5adb=function(_0x44e95c,_0x471072){_0x44e95c=_0x44e95c-0x0;var _0x2f538b=_0xadb5[_0x44e95c];return _0x2f538b;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x51f7a9,_0x1f24e3){var _0xf735ee=function(_0x34b9fe){while(--_0x34b9fe){_0x51f7a9['push'](_0x51f7a9['shift']());}};_0xf735ee(++_0x1f24e3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x220b13,_0x53f16e){_0x220b13=_0x220b13-0x0;var _0x57ff0a=_0x5f2f[_0x220b13];return _0x57ff0a;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 85eee99..7b1d510 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2def85,_0x39b650){var _0x12ce04=function(_0x150aa1){while(--_0x150aa1){_0x2def85['push'](_0x2def85['shift']());}};_0x12ce04(++_0x39b650);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x163cdc,_0x2a275b){var _0x3c554f=function(_0xa73124){while(--_0xa73124){_0x163cdc['push'](_0x163cdc['shift']());}};_0x3c554f(++_0x2a275b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0xcb91[_0x622035];return _0x326cf2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 3c25708..dc92b4b 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 _0x077b=['INTEGER','INBOX','sequelize','STRING','BOOLEAN'];(function(_0x5573e9,_0x54f198){var _0x1bb08f=function(_0x1ccfb2){while(--_0x1ccfb2){_0x5573e9['push'](_0x5573e9['shift']());}};_0x1bb08f(++_0x54f198);}(_0x077b,0xc0));var _0xb077=function(_0x497d54,_0x2f97c8){_0x497d54=_0x497d54-0x0;var _0xb08b15=_0x077b[_0x497d54];return _0xb08b15;};'use strict';var Sequelize=require(_0xb077('0x0'));module['exports']={'description':{'type':Sequelize[_0xb077('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xb077('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xb077('0x1')]},'password':{'type':Sequelize[_0xb077('0x1')]},'port':{'type':Sequelize[_0xb077('0x3')]},'tls':{'type':Sequelize[_0xb077('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xb077('0x1')],'defaultValue':_0xb077('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xb077('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xb077('0x1')]},'modernAuthentication':{'type':Sequelize[_0xb077('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x68a1=['BOOLEAN','INTEGER','INBOX','sequelize','STRING'];(function(_0x12849e,_0x3f9cce){var _0xaec77b=function(_0x35ccb4){while(--_0x35ccb4){_0x12849e['push'](_0x12849e['shift']());}};_0xaec77b(++_0x3f9cce);}(_0x68a1,0x17f));var _0x168a=function(_0x1c6785,_0x363d90){_0x1c6785=_0x1c6785-0x0;var _0x534e7b=_0x68a1[_0x1c6785];return _0x534e7b;};'use strict';var Sequelize=require(_0x168a('0x0'));module['exports']={'description':{'type':Sequelize[_0x168a('0x1')]},'host':{'type':Sequelize[_0x168a('0x1')]},'authentication':{'type':Sequelize[_0x168a('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x168a('0x3')]},'tls':{'type':Sequelize[_0x168a('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x168a('0x1')],'defaultValue':_0x168a('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x168a('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index cf41677..9c47fea 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 _0x811f=['define','MailServerIn','mail_servers_in','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x4226d6,_0x3864ca){var _0x19655b=function(_0x1d43a1){while(--_0x1d43a1){_0x4226d6['push'](_0x4226d6['shift']());}};_0x19655b(++_0x3864ca);}(_0x811f,0x193));var _0xf811=function(_0x2c73c6,_0x28332b){_0x2c73c6=_0x2c73c6-0x0;var _0x2e203c=_0x811f[_0x2c73c6];return _0x2e203c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf811('0x0'));var moment=require(_0xf811('0x1'));var BPromise=require(_0xf811('0x2'));var rp=require(_0xf811('0x3'));var fs=require('fs');var path=require(_0xf811('0x4'));var rimraf=require('rimraf');var config=require(_0xf811('0x5'));var attributes=require('./mailServerIn.attributes');module[_0xf811('0x6')]=function(_0x3971c5,_0x1c48cb){return _0x3971c5[_0xf811('0x7')](_0xf811('0x8'),attributes,{'tableName':_0xf811('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3689=['rimraf','../../config/environment','define','MailServerIn','mail_servers_in','lodash','api','moment','bluebird','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3689,0x14f));var _0x9368=function(_0x3fcbd3,_0x535070){_0x3fcbd3=_0x3fcbd3-0x0;var _0x1ebf0b=_0x3689[_0x3fcbd3];return _0x1ebf0b;};'use strict';var _=require(_0x9368('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9368('0x1'));var moment=require(_0x9368('0x2'));var BPromise=require(_0x9368('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9368('0x4'));var rimraf=require(_0x9368('0x5'));var config=require(_0x9368('0x6'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x5d067f,_0x5a910c){return _0x5d067f[_0x9368('0x7')](_0x9368('0x8'),attributes,{'tableName':_0x9368('0x9'),'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 c1df3e6..2abf41f 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 _0xe975=['stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xe975,0x1da));var _0x5e97=function(_0x25c828,_0x371be9){_0x25c828=_0x25c828-0x0;var _0x14faf=_0xe975[_0x25c828];return _0x14faf;};'use strict';var _=require('lodash');var util=require(_0x5e97('0x0'));var moment=require(_0x5e97('0x1'));var BPromise=require(_0x5e97('0x2'));var rs=require(_0x5e97('0x3'));var fs=require('fs');var Redis=require(_0x5e97('0x4'));var db=require(_0x5e97('0x5'))['db'];var utils=require(_0x5e97('0x6'));var logger=require('../../config/logger')(_0x5e97('0x7'));var config=require(_0x5e97('0x8'));var jayson=require(_0x5e97('0x9'));var client=jayson[_0x5e97('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f40a7,_0x44080d,_0x9f8fce){return new BPromise(function(_0x4b36f8,_0x45250e){return client[_0x5e97('0xb')](_0x1f40a7,_0x9f8fce)['then'](function(_0x655176){logger[_0x5e97('0xc')](_0x5e97('0xd'),_0x44080d,_0x5e97('0xe'));logger['debug'](_0x5e97('0xf'),_0x44080d,_0x5e97('0xe'),JSON[_0x5e97('0x10')](_0x655176));if(_0x655176['error']){if(_0x655176[_0x5e97('0x11')][_0x5e97('0x12')]===0x1f4){logger['error'](_0x5e97('0xd'),_0x44080d,_0x655176[_0x5e97('0x11')][_0x5e97('0x13')]);return _0x45250e(_0x655176['error'][_0x5e97('0x13')]);}logger['error'](_0x5e97('0xd'),_0x44080d,_0x655176[_0x5e97('0x11')][_0x5e97('0x13')]);return _0x4b36f8(_0x655176[_0x5e97('0x11')]['message']);}else{logger[_0x5e97('0xc')]('MailServerIn,\x20%s,\x20%s',_0x44080d,_0x5e97('0xe'));_0x4b36f8(_0x655176[_0x5e97('0x14')][_0x5e97('0x13')]);}})[_0x5e97('0x15')](function(_0x49e58a){logger[_0x5e97('0x11')]('MailServerIn,\x20%s,\x20%s',_0x44080d,_0x49e58a);_0x45250e(_0x49e58a);});});}exports[_0x5e97('0x16')]=function(_0x5a9baf){var _0x5273ec=this;return new Promise(function(_0x1d9224,_0x4ff28a){return db[_0x5e97('0x17')][_0x5e97('0x18')]({'raw':_0x5a9baf[_0x5e97('0x19')]?_0x5a9baf[_0x5e97('0x19')][_0x5e97('0x1a')]===undefined?!![]:![]:!![],'where':_0x5a9baf[_0x5e97('0x19')]?_0x5a9baf[_0x5e97('0x19')][_0x5e97('0x1b')]||null:null,'attributes':_0x5a9baf[_0x5e97('0x19')]?_0x5a9baf[_0x5e97('0x19')][_0x5e97('0x1c')]||null:null,'limit':_0x5a9baf[_0x5e97('0x19')]?_0x5a9baf[_0x5e97('0x19')][_0x5e97('0x1d')]||null:null,'include':_0x5a9baf[_0x5e97('0x19')]?_0x5a9baf['options'][_0x5e97('0x1e')]?_[_0x5e97('0x1f')](_0x5a9baf[_0x5e97('0x19')][_0x5e97('0x1e')],function(_0x5836c6){return{'model':db[_0x5836c6['model']],'as':_0x5836c6['as'],'attributes':_0x5836c6[_0x5e97('0x1c')],'include':_0x5836c6[_0x5e97('0x1e')]?_[_0x5e97('0x1f')](_0x5836c6['include'],function(_0x270f8d){return{'model':db[_0x270f8d[_0x5e97('0x20')]],'as':_0x270f8d['as'],'attributes':_0x270f8d[_0x5e97('0x1c')],'include':_0x270f8d[_0x5e97('0x1e')]?_[_0x5e97('0x1f')](_0x270f8d[_0x5e97('0x1e')],function(_0x4f0d8c){return{'model':db[_0x4f0d8c['model']],'as':_0x4f0d8c['as'],'attributes':_0x4f0d8c[_0x5e97('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5e97('0x21')](function(_0x3045a4){logger['info'](_0x5e97('0x16'),_0x5a9baf);logger[_0x5e97('0x22')]('GetMailServerIn',_0x5a9baf,JSON[_0x5e97('0x10')](_0x3045a4));_0x1d9224(_0x3045a4);})[_0x5e97('0x15')](function(_0x482517){logger[_0x5e97('0x11')](_0x5e97('0x16'),_0x482517[_0x5e97('0x13')],_0x5a9baf);_0x4ff28a(_0x5273ec['error'](0x1f4,_0x482517[_0x5e97('0x13')]));});});}; \ No newline at end of file +var _0xc112=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','MailServerIn','options','raw','where','limit','include','model','attributes','map','GetMailServerIn','stringify','lodash','util'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0xc112,0xec));var _0x2c11=function(_0x1c32f6,_0x1bc453){_0x1c32f6=_0x1c32f6-0x0;var _0x2903bb=_0xc112[_0x1c32f6];return _0x2903bb;};'use strict';var _=require(_0x2c11('0x0'));var util=require(_0x2c11('0x1'));var moment=require(_0x2c11('0x2'));var BPromise=require('bluebird');var rs=require(_0x2c11('0x3'));var fs=require('fs');var Redis=require(_0x2c11('0x4'));var db=require(_0x2c11('0x5'))['db'];var utils=require(_0x2c11('0x6'));var logger=require(_0x2c11('0x7'))(_0x2c11('0x8'));var config=require(_0x2c11('0x9'));var jayson=require(_0x2c11('0xa'));var client=jayson[_0x2c11('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c2399,_0x39c244,_0x1fada4){return new BPromise(function(_0x29dfcf,_0x43c1f5){return client['request'](_0x5c2399,_0x1fada4)[_0x2c11('0xc')](function(_0x1e0381){logger['info'](_0x2c11('0xd'),_0x39c244,_0x2c11('0xe'));logger[_0x2c11('0xf')](_0x2c11('0x10'),_0x39c244,_0x2c11('0xe'),JSON['stringify'](_0x1e0381));if(_0x1e0381[_0x2c11('0x11')]){if(_0x1e0381[_0x2c11('0x11')][_0x2c11('0x12')]===0x1f4){logger[_0x2c11('0x11')](_0x2c11('0xd'),_0x39c244,_0x1e0381[_0x2c11('0x11')][_0x2c11('0x13')]);return _0x43c1f5(_0x1e0381['error'][_0x2c11('0x13')]);}logger[_0x2c11('0x11')](_0x2c11('0xd'),_0x39c244,_0x1e0381[_0x2c11('0x11')][_0x2c11('0x13')]);return _0x29dfcf(_0x1e0381[_0x2c11('0x11')][_0x2c11('0x13')]);}else{logger[_0x2c11('0x14')](_0x2c11('0xd'),_0x39c244,_0x2c11('0xe'));_0x29dfcf(_0x1e0381[_0x2c11('0x15')]['message']);}})[_0x2c11('0x16')](function(_0x3c31e4){logger[_0x2c11('0x11')]('MailServerIn,\x20%s,\x20%s',_0x39c244,_0x3c31e4);_0x43c1f5(_0x3c31e4);});});}exports['GetMailServerIn']=function(_0x89a56){var _0x12ce46=this;return new Promise(function(_0x3988d7,_0x49304f){return db[_0x2c11('0x17')]['findAll']({'raw':_0x89a56[_0x2c11('0x18')]?_0x89a56[_0x2c11('0x18')][_0x2c11('0x19')]===undefined?!![]:![]:!![],'where':_0x89a56[_0x2c11('0x18')]?_0x89a56[_0x2c11('0x18')][_0x2c11('0x1a')]||null:null,'attributes':_0x89a56['options']?_0x89a56['options']['attributes']||null:null,'limit':_0x89a56[_0x2c11('0x18')]?_0x89a56[_0x2c11('0x18')][_0x2c11('0x1b')]||null:null,'include':_0x89a56[_0x2c11('0x18')]?_0x89a56[_0x2c11('0x18')][_0x2c11('0x1c')]?_['map'](_0x89a56[_0x2c11('0x18')][_0x2c11('0x1c')],function(_0x45b96f){return{'model':db[_0x45b96f[_0x2c11('0x1d')]],'as':_0x45b96f['as'],'attributes':_0x45b96f[_0x2c11('0x1e')],'include':_0x45b96f[_0x2c11('0x1c')]?_[_0x2c11('0x1f')](_0x45b96f[_0x2c11('0x1c')],function(_0x107983){return{'model':db[_0x107983[_0x2c11('0x1d')]],'as':_0x107983['as'],'attributes':_0x107983['attributes'],'include':_0x107983[_0x2c11('0x1c')]?_[_0x2c11('0x1f')](_0x107983[_0x2c11('0x1c')],function(_0x308da8){return{'model':db[_0x308da8[_0x2c11('0x1d')]],'as':_0x308da8['as'],'attributes':_0x308da8[_0x2c11('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51af52){logger[_0x2c11('0x14')](_0x2c11('0x20'),_0x89a56);logger[_0x2c11('0xf')](_0x2c11('0x20'),_0x89a56,JSON[_0x2c11('0x21')](_0x51af52));_0x3988d7(_0x51af52);})[_0x2c11('0x16')](function(_0x2a494f){logger['error'](_0x2c11('0x20'),_0x2a494f[_0x2c11('0x13')],_0x89a56);_0x49304f(_0x12ce46[_0x2c11('0x11')](0x1f4,_0x2a494f[_0x2c11('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 0e78395..38ac2ff 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x7a54,0x106));var _0x47a5=function(_0x4a93f2,_0xe7ba48){_0x4a93f2=_0x4a93f2-0x0;var _0x267e00=_0x7a54[_0x4a93f2];return _0x267e00;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x7a54,0x106));var _0x47a5=function(_0xbd57e9,_0x25395a){_0xbd57e9=_0xbd57e9-0x0;var _0x3af7ad=_0x7a54[_0xbd57e9];return _0x3af7ad;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index c823a5b..f560776 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 _0x9c00=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3a9123,_0x31ff89){var _0x1d28db=function(_0x36a0ef){while(--_0x36a0ef){_0x3a9123['push'](_0x3a9123['shift']());}};_0x1d28db(++_0x31ff89);}(_0x9c00,0x1a0));var _0x09c0=function(_0x6376b0,_0x52d8c1){_0x6376b0=_0x6376b0-0x0;var _0x47ac71=_0x9c00[_0x6376b0];return _0x47ac71;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x09c0('0x2')]},'pass':{'type':Sequelize[_0x09c0('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x09c0('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x09c0('0x2')]},'authentication':{'type':Sequelize[_0x09c0('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x09c0('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe2cf=['BOOLEAN','exports','STRING','INTEGER'];(function(_0x1fe57c,_0x27f637){var _0x5eb6f4=function(_0x2deedf){while(--_0x2deedf){_0x1fe57c['push'](_0x1fe57c['shift']());}};_0x5eb6f4(++_0x27f637);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x4b14bb,_0xe7b4d3){_0x4b14bb=_0x4b14bb-0x0;var _0x285200=_0xe2cf[_0x4b14bb];return _0x285200;};'use strict';var Sequelize=require('sequelize');module[_0xfe2c('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xfe2c('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xfe2c('0x1')]},'port':{'type':Sequelize[_0xfe2c('0x2')]},'secure':{'type':Sequelize[_0xfe2c('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xfe2c('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xfe2c('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 fb7caef..a4d1b84 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 _0x4674=['reject','save','then','destroy','error','name','send','index','map','MailServerOut','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','find','create','body','params','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','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','offset','undefined','limit','count','set','json','apply'];(function(_0x321d29,_0x45875e){var _0x110306=function(_0xceb352){while(--_0xceb352){_0x321d29['push'](_0x321d29['shift']());}};_0x110306(++_0x45875e);}(_0x4674,0xb2));var _0x4467=function(_0x1b0505,_0x49dc08){_0x1b0505=_0x1b0505-0x0;var _0x1ff7e5=_0x4674[_0x1b0505];return _0x1ff7e5;};'use strict';var emlformat=require(_0x4467('0x0'));var rimraf=require(_0x4467('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4467('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4467('0x3'));var Mustache=require('mustache');var util=require(_0x4467('0x4'));var path=require(_0x4467('0x5'));var sox=require(_0x4467('0x6'));var csv=require(_0x4467('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4467('0x8'));var _=require(_0x4467('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4467('0xa'));var deskjs=require(_0x4467('0xb'));var toCsv=require(_0x4467('0x7'));var querystring=require(_0x4467('0xc'));var Papa=require('papaparse');var Redis=require(_0x4467('0xd'));var authService=require(_0x4467('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4467('0xf'));var hardwareService=require(_0x4467('0x10'));var logger=require(_0x4467('0x11'))(_0x4467('0x12'));var utils=require(_0x4467('0x13'));var config=require(_0x4467('0x14'));var licenseUtil=require(_0x4467('0x15'));var db=require(_0x4467('0x16'))['db'];function respondWithStatusCode(_0x1f246d,_0x49b313){_0x49b313=_0x49b313||0xcc;return function(_0x23f681){if(_0x23f681){return _0x1f246d[_0x4467('0x17')](_0x49b313);}return _0x1f246d[_0x4467('0x18')](_0x49b313)['end']();};}function respondWithResult(_0x17d1a3,_0x24597f){_0x24597f=_0x24597f||0xc8;return function(_0x54d871){if(_0x54d871){return _0x17d1a3[_0x4467('0x18')](_0x24597f)['json'](_0x54d871);}};}function respondWithFilteredResult(_0x4abaf6,_0x2e7d78){return function(_0x21f550){if(_0x21f550){var _0x252eaa=typeof _0x2e7d78[_0x4467('0x19')]===_0x4467('0x1a')&&typeof _0x2e7d78[_0x4467('0x1b')]===_0x4467('0x1a');var _0x56f255=_0x21f550[_0x4467('0x1c')];var _0x59502f=_0x252eaa?0x0:_0x2e7d78['offset'];var _0x238b2b=_0x252eaa?_0x21f550[_0x4467('0x1c')]:_0x2e7d78['offset']+_0x2e7d78[_0x4467('0x1b')];var _0xad29cc;if(_0x238b2b>=_0x56f255){_0x238b2b=_0x56f255;_0xad29cc=0xc8;}else{_0xad29cc=0xce;}_0x4abaf6[_0x4467('0x18')](_0xad29cc);return _0x4abaf6[_0x4467('0x1d')]('Content-Range',_0x59502f+'-'+_0x238b2b+'/'+_0x56f255)[_0x4467('0x1e')](_0x21f550);}return null;};}function patchUpdates(_0x3220da){return function(_0x3a8df8){try{jsonpatch[_0x4467('0x1f')](_0x3a8df8,_0x3220da,!![]);}catch(_0x8a3cc3){return BPromise[_0x4467('0x20')](_0x8a3cc3);}return _0x3a8df8[_0x4467('0x21')]();};}function saveUpdates(_0x4b5ed6,_0x4d8be6){return function(_0x1940ad){if(_0x1940ad){return _0x1940ad['update'](_0x4b5ed6)[_0x4467('0x22')](function(_0x195539){return _0x195539;});}return null;};}function removeEntity(_0x54ccf2,_0x4fb7dd){return function(_0x4dc1fc){if(_0x4dc1fc){return _0x4dc1fc[_0x4467('0x23')]()[_0x4467('0x22')](function(){_0x54ccf2[_0x4467('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1176d9,_0x48386f){return function(_0x5eb3c3){if(!_0x5eb3c3){_0x1176d9[_0x4467('0x17')](0x194);}return _0x5eb3c3;};}function handleError(_0x24fe34,_0x1fb456){_0x1fb456=_0x1fb456||0x1f4;return function(_0x166cd2){logger[_0x4467('0x24')](_0x166cd2['stack']);if(_0x166cd2[_0x4467('0x25')]){delete _0x166cd2[_0x4467('0x25')];}_0x24fe34[_0x4467('0x18')](_0x1fb456)[_0x4467('0x26')](_0x166cd2);};}exports[_0x4467('0x27')]=function(_0x12bbfd,_0x1c4249){var _0x73d776={},_0xfe968c={},_0xe34df0={'count':0x0,'rows':[]};var _0x357fe9=_[_0x4467('0x28')](db[_0x4467('0x29')]['rawAttributes'],function(_0x58e9f2){return{'name':_0x58e9f2[_0x4467('0x2a')],'type':_0x58e9f2[_0x4467('0x2b')][_0x4467('0x2c')]};});_0xfe968c[_0x4467('0x2d')]=_[_0x4467('0x28')](_0x357fe9,'name');_0xfe968c[_0x4467('0x2e')]=_[_0x4467('0x2f')](_0x12bbfd[_0x4467('0x2e')]);_0xfe968c[_0x4467('0x30')]=_['intersection'](_0xfe968c['model'],_0xfe968c['query']);_0x73d776['attributes']=_[_0x4467('0x31')](_0xfe968c[_0x4467('0x2d')],qs[_0x4467('0x32')](_0x12bbfd[_0x4467('0x2e')][_0x4467('0x32')]));_0x73d776[_0x4467('0x33')]=_0x73d776[_0x4467('0x33')][_0x4467('0x34')]?_0x73d776[_0x4467('0x33')]:_0xfe968c[_0x4467('0x2d')];if(!_0x12bbfd[_0x4467('0x2e')][_0x4467('0x35')](_0x4467('0x36'))){_0x73d776[_0x4467('0x1b')]=qs[_0x4467('0x1b')](_0x12bbfd[_0x4467('0x2e')][_0x4467('0x1b')]);_0x73d776[_0x4467('0x19')]=qs['offset'](_0x12bbfd['query']['offset']);}_0x73d776['order']=qs[_0x4467('0x37')](_0x12bbfd[_0x4467('0x2e')][_0x4467('0x37')]);_0x73d776[_0x4467('0x38')]=qs['filters'](_[_0x4467('0x39')](_0x12bbfd['query'],_0xfe968c['filters']),_0x357fe9);if(_0x12bbfd[_0x4467('0x2e')][_0x4467('0x3a')]){_0x73d776[_0x4467('0x38')]=_[_0x4467('0x3b')](_0x73d776['where'],{'$or':_[_0x4467('0x28')](_0x357fe9,function(_0x2d654f){if(_0x2d654f[_0x4467('0x2b')]!==_0x4467('0x3c')){var _0x2c468a={};_0x2c468a[_0x2d654f[_0x4467('0x25')]]={'$like':'%'+_0x12bbfd[_0x4467('0x2e')][_0x4467('0x3a')]+'%'};return _0x2c468a;}})});}_0x73d776=_[_0x4467('0x3b')]({},_0x73d776,_0x12bbfd[_0x4467('0x3d')]);var _0x4fc471={'where':_0x73d776['where']};return db['MailServerOut'][_0x4467('0x1c')](_0x4fc471)['then'](function(_0x570718){_0xe34df0[_0x4467('0x1c')]=_0x570718;if(_0x12bbfd['query'][_0x4467('0x3e')]){_0x73d776['include']=[{'all':!![]}];}return db[_0x4467('0x29')]['findAll'](_0x73d776);})['then'](function(_0x346161){_0xe34df0[_0x4467('0x3f')]=_0x346161;return _0xe34df0;})[_0x4467('0x22')](respondWithFilteredResult(_0x1c4249,_0x73d776))[_0x4467('0x40')](handleError(_0x1c4249,null));};exports[_0x4467('0x41')]=function(_0x20575f,_0x52d5e0){var _0x5088d2={'raw':!![],'where':{'id':_0x20575f['params']['id']}},_0x142b3d={};_0x142b3d[_0x4467('0x2d')]=_[_0x4467('0x2f')](db[_0x4467('0x29')]['rawAttributes']);_0x142b3d[_0x4467('0x2e')]=_[_0x4467('0x2f')](_0x20575f[_0x4467('0x2e')]);_0x142b3d[_0x4467('0x30')]=_['intersection'](_0x142b3d['model'],_0x142b3d[_0x4467('0x2e')]);_0x5088d2[_0x4467('0x33')]=_[_0x4467('0x31')](_0x142b3d[_0x4467('0x2d')],qs['fields'](_0x20575f['query'][_0x4467('0x32')]));_0x5088d2[_0x4467('0x33')]=_0x5088d2[_0x4467('0x33')][_0x4467('0x34')]?_0x5088d2['attributes']:_0x142b3d[_0x4467('0x2d')];if(_0x20575f[_0x4467('0x2e')][_0x4467('0x3e')]){_0x5088d2['include']=[{'all':!![]}];}_0x5088d2=_[_0x4467('0x3b')]({},_0x5088d2,_0x20575f[_0x4467('0x3d')]);return db[_0x4467('0x29')][_0x4467('0x42')](_0x5088d2)[_0x4467('0x22')](handleEntityNotFound(_0x52d5e0,null))[_0x4467('0x22')](respondWithResult(_0x52d5e0,null))[_0x4467('0x40')](handleError(_0x52d5e0,null));};exports[_0x4467('0x43')]=function(_0x4117d2,_0x1c30b0){return db[_0x4467('0x29')]['create'](_0x4117d2[_0x4467('0x44')],{})[_0x4467('0x22')](respondWithResult(_0x1c30b0,0xc9))[_0x4467('0x40')](handleError(_0x1c30b0,null));};exports['update']=function(_0xefc398,_0xa5a57e){if(_0xefc398[_0x4467('0x44')]['id']){delete _0xefc398[_0x4467('0x44')]['id'];}return db['MailServerOut'][_0x4467('0x42')]({'where':{'id':_0xefc398['params']['id']}})[_0x4467('0x22')](handleEntityNotFound(_0xa5a57e,null))['then'](saveUpdates(_0xefc398[_0x4467('0x44')],null))[_0x4467('0x22')](respondWithResult(_0xa5a57e,null))[_0x4467('0x40')](handleError(_0xa5a57e,null));};exports[_0x4467('0x23')]=function(_0x1bebbe,_0x277e23){return db['MailServerOut']['find']({'where':{'id':_0x1bebbe[_0x4467('0x45')]['id']}})[_0x4467('0x22')](handleEntityNotFound(_0x277e23,null))['then'](removeEntity(_0x277e23,null))['catch'](handleError(_0x277e23,null));}; \ No newline at end of file +var _0x5a11=['attributes','intersection','length','hasOwnProperty','nolimit','sort','pick','merge','type','filter','options','where','includeAll','include','MailServerOut','findAll','rows','catch','show','params','fields','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters'];(function(_0x2ee3a2,_0xfd0935){var _0x191057=function(_0x350463){while(--_0x350463){_0x2ee3a2['push'](_0x2ee3a2['shift']());}};_0x191057(++_0xfd0935);}(_0x5a11,0xb0));var _0x15a1=function(_0x1ec989,_0x33838c){_0x1ec989=_0x1ec989-0x0;var _0x1af2c8=_0x5a11[_0x1ec989];return _0x1af2c8;};'use strict';var emlformat=require(_0x15a1('0x0'));var rimraf=require(_0x15a1('0x1'));var zipdir=require(_0x15a1('0x2'));var jsonpatch=require(_0x15a1('0x3'));var rp=require('request-promise');var moment=require(_0x15a1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x15a1('0x5'));var util=require(_0x15a1('0x6'));var path=require(_0x15a1('0x7'));var sox=require(_0x15a1('0x8'));var csv=require(_0x15a1('0x9'));var ejs=require(_0x15a1('0xa'));var fs=require('fs');var fs_extra=require(_0x15a1('0xb'));var _=require(_0x15a1('0xc'));var squel=require(_0x15a1('0xd'));var crypto=require('crypto');var jsforce=require(_0x15a1('0xe'));var deskjs=require(_0x15a1('0xf'));var toCsv=require(_0x15a1('0x9'));var querystring=require(_0x15a1('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x15a1('0x11'));var qs=require(_0x15a1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15a1('0x13'));var logger=require(_0x15a1('0x14'))(_0x15a1('0x15'));var utils=require(_0x15a1('0x16'));var config=require(_0x15a1('0x17'));var licenseUtil=require(_0x15a1('0x18'));var db=require(_0x15a1('0x19'))['db'];function respondWithStatusCode(_0x5b8452,_0x2298cc){_0x2298cc=_0x2298cc||0xcc;return function(_0x2af9c0){if(_0x2af9c0){return _0x5b8452[_0x15a1('0x1a')](_0x2298cc);}return _0x5b8452[_0x15a1('0x1b')](_0x2298cc)['end']();};}function respondWithResult(_0x20fdd3,_0x47e853){_0x47e853=_0x47e853||0xc8;return function(_0x578fec){if(_0x578fec){return _0x20fdd3['status'](_0x47e853)[_0x15a1('0x1c')](_0x578fec);}};}function respondWithFilteredResult(_0x58b7f2,_0x163bb2){return function(_0x6ddbe7){if(_0x6ddbe7){var _0x85f2ed=typeof _0x163bb2[_0x15a1('0x1d')]===_0x15a1('0x1e')&&typeof _0x163bb2[_0x15a1('0x1f')]==='undefined';var _0x5d32d5=_0x6ddbe7['count'];var _0x117e48=_0x85f2ed?0x0:_0x163bb2[_0x15a1('0x1d')];var _0x26c5a5=_0x85f2ed?_0x6ddbe7[_0x15a1('0x20')]:_0x163bb2[_0x15a1('0x1d')]+_0x163bb2['limit'];var _0x27c4f7;if(_0x26c5a5>=_0x5d32d5){_0x26c5a5=_0x5d32d5;_0x27c4f7=0xc8;}else{_0x27c4f7=0xce;}_0x58b7f2[_0x15a1('0x1b')](_0x27c4f7);return _0x58b7f2['set'](_0x15a1('0x21'),_0x117e48+'-'+_0x26c5a5+'/'+_0x5d32d5)[_0x15a1('0x1c')](_0x6ddbe7);}return null;};}function patchUpdates(_0x4f61a1){return function(_0x427678){try{jsonpatch[_0x15a1('0x22')](_0x427678,_0x4f61a1,!![]);}catch(_0x4898b5){return BPromise['reject'](_0x4898b5);}return _0x427678[_0x15a1('0x23')]();};}function saveUpdates(_0x460451,_0x5dd00a){return function(_0x52b8ed){if(_0x52b8ed){return _0x52b8ed['update'](_0x460451)[_0x15a1('0x24')](function(_0x265bbb){return _0x265bbb;});}return null;};}function removeEntity(_0x1e75c2,_0xf3bbd1){return function(_0x2ea3cf){if(_0x2ea3cf){return _0x2ea3cf[_0x15a1('0x25')]()[_0x15a1('0x24')](function(){_0x1e75c2[_0x15a1('0x1b')](0xcc)[_0x15a1('0x26')]();});}};}function handleEntityNotFound(_0xcb03db,_0x5d0640){return function(_0xf3a3db){if(!_0xf3a3db){_0xcb03db[_0x15a1('0x1a')](0x194);}return _0xf3a3db;};}function handleError(_0x5d6050,_0x1388c5){_0x1388c5=_0x1388c5||0x1f4;return function(_0x50ae38){logger[_0x15a1('0x27')](_0x50ae38[_0x15a1('0x28')]);if(_0x50ae38['name']){delete _0x50ae38[_0x15a1('0x29')];}_0x5d6050[_0x15a1('0x1b')](_0x1388c5)[_0x15a1('0x2a')](_0x50ae38);};}exports[_0x15a1('0x2b')]=function(_0x12c706,_0x3dab75){var _0x55de02={},_0x41c578={},_0x5b9232={'count':0x0,'rows':[]};var _0x55c559=_[_0x15a1('0x2c')](db['MailServerOut'][_0x15a1('0x2d')],function(_0x547d33){return{'name':_0x547d33[_0x15a1('0x2e')],'type':_0x547d33['type'][_0x15a1('0x2f')]};});_0x41c578[_0x15a1('0x30')]=_[_0x15a1('0x2c')](_0x55c559,_0x15a1('0x29'));_0x41c578[_0x15a1('0x31')]=_[_0x15a1('0x32')](_0x12c706['query']);_0x41c578[_0x15a1('0x33')]=_['intersection'](_0x41c578['model'],_0x41c578[_0x15a1('0x31')]);_0x55de02[_0x15a1('0x34')]=_[_0x15a1('0x35')](_0x41c578[_0x15a1('0x30')],qs['fields'](_0x12c706[_0x15a1('0x31')]['fields']));_0x55de02[_0x15a1('0x34')]=_0x55de02[_0x15a1('0x34')][_0x15a1('0x36')]?_0x55de02[_0x15a1('0x34')]:_0x41c578[_0x15a1('0x30')];if(!_0x12c706[_0x15a1('0x31')][_0x15a1('0x37')](_0x15a1('0x38'))){_0x55de02['limit']=qs[_0x15a1('0x1f')](_0x12c706[_0x15a1('0x31')][_0x15a1('0x1f')]);_0x55de02[_0x15a1('0x1d')]=qs['offset'](_0x12c706[_0x15a1('0x31')][_0x15a1('0x1d')]);}_0x55de02['order']=qs['sort'](_0x12c706['query'][_0x15a1('0x39')]);_0x55de02['where']=qs[_0x15a1('0x33')](_[_0x15a1('0x3a')](_0x12c706[_0x15a1('0x31')],_0x41c578['filters']),_0x55c559);if(_0x12c706[_0x15a1('0x31')]['filter']){_0x55de02['where']=_[_0x15a1('0x3b')](_0x55de02['where'],{'$or':_[_0x15a1('0x2c')](_0x55c559,function(_0x1740dd){if(_0x1740dd[_0x15a1('0x3c')]!=='VIRTUAL'){var _0x428b5a={};_0x428b5a[_0x1740dd[_0x15a1('0x29')]]={'$like':'%'+_0x12c706[_0x15a1('0x31')][_0x15a1('0x3d')]+'%'};return _0x428b5a;}})});}_0x55de02=_['merge']({},_0x55de02,_0x12c706[_0x15a1('0x3e')]);var _0xc45e63={'where':_0x55de02[_0x15a1('0x3f')]};return db['MailServerOut']['count'](_0xc45e63)[_0x15a1('0x24')](function(_0xd2c0b8){_0x5b9232[_0x15a1('0x20')]=_0xd2c0b8;if(_0x12c706[_0x15a1('0x31')][_0x15a1('0x40')]){_0x55de02[_0x15a1('0x41')]=[{'all':!![]}];}return db[_0x15a1('0x42')][_0x15a1('0x43')](_0x55de02);})[_0x15a1('0x24')](function(_0x174319){_0x5b9232[_0x15a1('0x44')]=_0x174319;return _0x5b9232;})['then'](respondWithFilteredResult(_0x3dab75,_0x55de02))[_0x15a1('0x45')](handleError(_0x3dab75,null));};exports[_0x15a1('0x46')]=function(_0x2dd1fd,_0x4f21e6){var _0xb644aa={'raw':!![],'where':{'id':_0x2dd1fd[_0x15a1('0x47')]['id']}},_0x584622={};_0x584622['model']=_[_0x15a1('0x32')](db['MailServerOut'][_0x15a1('0x2d')]);_0x584622['query']=_[_0x15a1('0x32')](_0x2dd1fd[_0x15a1('0x31')]);_0x584622[_0x15a1('0x33')]=_['intersection'](_0x584622['model'],_0x584622[_0x15a1('0x31')]);_0xb644aa[_0x15a1('0x34')]=_[_0x15a1('0x35')](_0x584622['model'],qs[_0x15a1('0x48')](_0x2dd1fd[_0x15a1('0x31')]['fields']));_0xb644aa[_0x15a1('0x34')]=_0xb644aa[_0x15a1('0x34')][_0x15a1('0x36')]?_0xb644aa['attributes']:_0x584622[_0x15a1('0x30')];if(_0x2dd1fd[_0x15a1('0x31')][_0x15a1('0x40')]){_0xb644aa[_0x15a1('0x41')]=[{'all':!![]}];}_0xb644aa=_[_0x15a1('0x3b')]({},_0xb644aa,_0x2dd1fd[_0x15a1('0x3e')]);return db[_0x15a1('0x42')][_0x15a1('0x49')](_0xb644aa)['then'](handleEntityNotFound(_0x4f21e6,null))[_0x15a1('0x24')](respondWithResult(_0x4f21e6,null))[_0x15a1('0x45')](handleError(_0x4f21e6,null));};exports['create']=function(_0x208e01,_0x56f204){return db[_0x15a1('0x42')][_0x15a1('0x4a')](_0x208e01['body'],{})['then'](respondWithResult(_0x56f204,0xc9))[_0x15a1('0x45')](handleError(_0x56f204,null));};exports['update']=function(_0x2aba41,_0x4c3c8b){if(_0x2aba41['body']['id']){delete _0x2aba41[_0x15a1('0x4b')]['id'];}return db[_0x15a1('0x42')]['find']({'where':{'id':_0x2aba41[_0x15a1('0x47')]['id']}})['then'](handleEntityNotFound(_0x4c3c8b,null))['then'](saveUpdates(_0x2aba41[_0x15a1('0x4b')],null))[_0x15a1('0x24')](respondWithResult(_0x4c3c8b,null))[_0x15a1('0x45')](handleError(_0x4c3c8b,null));};exports[_0x15a1('0x25')]=function(_0x19f4df,_0x1bf0d0){return db['MailServerOut'][_0x15a1('0x49')]({'where':{'id':_0x19f4df[_0x15a1('0x47')]['id']}})[_0x15a1('0x24')](handleEntityNotFound(_0x1bf0d0,null))[_0x15a1('0x24')](removeEntity(_0x1bf0d0,null))['catch'](handleError(_0x1bf0d0,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index e8da4fb..9184629 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 _0x6b48=['moment','bluebird','request-promise','../../config/environment','exports','define','MailServerOut','lodash','../../config/logger','api'];(function(_0x36da11,_0x143011){var _0x1c67ba=function(_0x211711){while(--_0x211711){_0x36da11['push'](_0x36da11['shift']());}};_0x1c67ba(++_0x143011);}(_0x6b48,0x7f));var _0x86b4=function(_0x32378d,_0x288c3d){_0x32378d=_0x32378d-0x0;var _0x5d4bf7=_0x6b48[_0x32378d];return _0x5d4bf7;};'use strict';var _=require(_0x86b4('0x0'));var util=require('util');var logger=require(_0x86b4('0x1'))(_0x86b4('0x2'));var moment=require(_0x86b4('0x3'));var BPromise=require(_0x86b4('0x4'));var rp=require(_0x86b4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x86b4('0x6'));var attributes=require('./mailServerOut.attributes');module[_0x86b4('0x7')]=function(_0x597277,_0xd76beb){return _0x597277[_0x86b4('0x8')](_0x86b4('0x9'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea50=['mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0xea50,0x1b4));var _0x0ea5=function(_0x49fc26,_0x56e2a9){_0x49fc26=_0x49fc26-0x0;var _0x9423a7=_0xea50[_0x49fc26];return _0x9423a7;};'use strict';var _=require(_0x0ea5('0x0'));var util=require(_0x0ea5('0x1'));var logger=require(_0x0ea5('0x2'))(_0x0ea5('0x3'));var moment=require(_0x0ea5('0x4'));var BPromise=require(_0x0ea5('0x5'));var rp=require(_0x0ea5('0x6'));var fs=require('fs');var path=require(_0x0ea5('0x7'));var rimraf=require(_0x0ea5('0x8'));var config=require(_0x0ea5('0x9'));var attributes=require(_0x0ea5('0xa'));module[_0x0ea5('0xb')]=function(_0x5b51ee,_0x255d3e){return _0x5b51ee[_0x0ea5('0xc')](_0x0ea5('0xd'),attributes,{'tableName':_0x0ea5('0xe'),'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 221bdf2..c7c92c1 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x1838e1,_0x791615){var _0x49a5bb=function(_0x27a669){while(--_0x27a669){_0x1838e1['push'](_0x1838e1['shift']());}};_0x49a5bb(++_0x791615);}(_0x2ef3,0xba));var _0x32ef=function(_0x10da5b,_0x3c3087){_0x10da5b=_0x10da5b-0x0;var _0x15690f=_0x2ef3[_0x10da5b];return _0x15690f;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x4b30dd,_0x4d5f63){_0x4b30dd=_0x4b30dd-0x0;var _0x57bbcf=_0x7a54[_0x4b30dd];return _0x57bbcf;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index fb30348..488c13a 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 _0x4da1=['multer','util','path','express','Router','fs-extra','../../components/auth/service','isAuthenticated','get','/describe','describe','show','create','/:id','update','delete'];(function(_0x44172e,_0x26a5e6){var _0x5d5a48=function(_0x3cdf26){while(--_0x3cdf26){_0x44172e['push'](_0x44172e['shift']());}};_0x5d5a48(++_0x26a5e6);}(_0x4da1,0x1b0));var _0x14da=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4da1[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x14da('0x0'));var util=require(_0x14da('0x1'));var path=require(_0x14da('0x2'));var timeout=require('connect-timeout');var express=require(_0x14da('0x3'));var router=express[_0x14da('0x4')]();var fs_extra=require(_0x14da('0x5'));var auth=require(_0x14da('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x14da('0x7')](),controller['index']);router[_0x14da('0x8')](_0x14da('0x9'),auth['isAuthenticated'](),controller[_0x14da('0xa')]);router['get']('/:id',auth[_0x14da('0x7')](),controller[_0x14da('0xb')]);router['post']('/',auth[_0x14da('0x7')](),controller[_0x14da('0xc')]);router['put'](_0x14da('0xd'),auth[_0x14da('0x7')](),controller[_0x14da('0xe')]);router[_0x14da('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5f2f=['put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','describe','/:id','post','create'];(function(_0x3890f8,_0x1b39df){var _0x40713e=function(_0x4f7f3b){while(--_0x4f7f3b){_0x3890f8['push'](_0x3890f8['shift']());}};_0x40713e(++_0x1b39df);}(_0x5f2f,0x10d));var _0xf5f2=function(_0x5374cb,_0x5d7b89){_0x5374cb=_0x5374cb-0x0;var _0x2d1581=_0x5f2f[_0x5374cb];return _0x2d1581;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf5f2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf5f2('0x7'));var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0x9')](_0xf5f2('0xd'),auth[_0xf5f2('0xa')](),controller['show']);router[_0xf5f2('0xe')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/:id',auth[_0xf5f2('0xa')](),controller['update']);router['delete'](_0xf5f2('0xd'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 0b0a8b8..fcb5fa6 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 _0x53ec=['STRING','name','sequelize','exports'];(function(_0x53ec59,_0x1c5f45){var _0x5e1265=function(_0x5856cb){while(--_0x5856cb){_0x53ec59['push'](_0x53ec59['shift']());}};_0x5e1265(++_0x1c5f45);}(_0x53ec,0x192));var _0xc53e=function(_0x389fb1,_0x431673){_0x389fb1=_0x389fb1-0x0;var _0x3d3520=_0x53ec[_0x389fb1];return _0x3d3520;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'name':{'type':Sequelize[_0xc53e('0x2')],'unique':_0xc53e('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc53e('0x2')]}}; \ No newline at end of file +var _0x9206=['STRING','name','sequelize','exports'];(function(_0x5397f4,_0x3f2c05){var _0x4cba07=function(_0x20b72d){while(--_0x20b72d){_0x5397f4['push'](_0x5397f4['shift']());}};_0x4cba07(++_0x3f2c05);}(_0x9206,0x176));var _0x6920=function(_0x926bc4,_0x3ecd5b){_0x926bc4=_0x926bc4-0x0;var _0x520988=_0x9206[_0x926bc4];return _0x520988;};'use strict';var Sequelize=require(_0x6920('0x0'));module[_0x6920('0x1')]={'name':{'type':Sequelize[_0x6920('0x2')],'unique':_0x6920('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6920('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index d928016..b50a839 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 _0x40f9=['querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','MailSubstatus','count','findAll','rows','catch','show','intersection','includeAll','include','merge','options','body','params','find','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x2ee71f,_0x35b42e){var _0xf95c54=function(_0x478b6a){while(--_0x478b6a){_0x2ee71f['push'](_0x2ee71f['shift']());}};_0xf95c54(++_0x35b42e);}(_0x40f9,0xd1));var _0x940f=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x40f9[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x940f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x940f('0x1'));var rp=require(_0x940f('0x2'));var moment=require('moment');var BPromise=require(_0x940f('0x3'));var Mustache=require(_0x940f('0x4'));var util=require(_0x940f('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x940f('0x6'));var ejs=require(_0x940f('0x7'));var fs=require('fs');var fs_extra=require(_0x940f('0x8'));var _=require(_0x940f('0x9'));var squel=require(_0x940f('0xa'));var crypto=require(_0x940f('0xb'));var jsforce=require(_0x940f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x940f('0x6'));var querystring=require(_0x940f('0xd'));var Papa=require(_0x940f('0xe'));var Redis=require('ioredis');var authService=require(_0x940f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x940f('0x10'));var hardwareService=require(_0x940f('0x11'));var logger=require('../../config/logger')(_0x940f('0x12'));var utils=require(_0x940f('0x13'));var config=require(_0x940f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x940f('0x15'))['db'];function respondWithStatusCode(_0x5c144b,_0x2e7d75){_0x2e7d75=_0x2e7d75||0xcc;return function(_0x317f63){if(_0x317f63){return _0x5c144b['sendStatus'](_0x2e7d75);}return _0x5c144b[_0x940f('0x16')](_0x2e7d75)[_0x940f('0x17')]();};}function respondWithResult(_0x4cabe2,_0x482538){_0x482538=_0x482538||0xc8;return function(_0x51d641){if(_0x51d641){return _0x4cabe2['status'](_0x482538)['json'](_0x51d641);}};}function respondWithFilteredResult(_0x36c976,_0x2c27cb){return function(_0x474263){if(_0x474263){var _0x49a0f5=typeof _0x2c27cb[_0x940f('0x18')]===_0x940f('0x19')&&typeof _0x2c27cb['limit']===_0x940f('0x19');var _0x38a724=_0x474263['count'];var _0xd0bf72=_0x49a0f5?0x0:_0x2c27cb['offset'];var _0x1c5caf=_0x49a0f5?_0x474263['count']:_0x2c27cb[_0x940f('0x18')]+_0x2c27cb['limit'];var _0x37ccc8;if(_0x1c5caf>=_0x38a724){_0x1c5caf=_0x38a724;_0x37ccc8=0xc8;}else{_0x37ccc8=0xce;}_0x36c976[_0x940f('0x16')](_0x37ccc8);return _0x36c976[_0x940f('0x1a')](_0x940f('0x1b'),_0xd0bf72+'-'+_0x1c5caf+'/'+_0x38a724)[_0x940f('0x1c')](_0x474263);}return null;};}function patchUpdates(_0x3d9f22){return function(_0xc1d1de){try{jsonpatch[_0x940f('0x1d')](_0xc1d1de,_0x3d9f22,!![]);}catch(_0x568888){return BPromise[_0x940f('0x1e')](_0x568888);}return _0xc1d1de['save']();};}function saveUpdates(_0x264bd0,_0x2c1965){return function(_0x543dd2){if(_0x543dd2){return _0x543dd2[_0x940f('0x1f')](_0x264bd0)[_0x940f('0x20')](function(_0x23a571){return _0x23a571;});}return null;};}function removeEntity(_0x2c04d2,_0x30e941){return function(_0x22e993){if(_0x22e993){return _0x22e993[_0x940f('0x21')]()[_0x940f('0x20')](function(){_0x2c04d2[_0x940f('0x16')](0xcc)[_0x940f('0x17')]();});}};}function handleEntityNotFound(_0xa717bb,_0x58b9c8){return function(_0x4eaf9b){if(!_0x4eaf9b){_0xa717bb['sendStatus'](0x194);}return _0x4eaf9b;};}function handleError(_0x22aed9,_0x1a8c21){_0x1a8c21=_0x1a8c21||0x1f4;return function(_0x127df6){logger[_0x940f('0x22')](_0x127df6[_0x940f('0x23')]);if(_0x127df6['name']){delete _0x127df6[_0x940f('0x24')];}_0x22aed9[_0x940f('0x16')](_0x1a8c21)[_0x940f('0x25')](_0x127df6);};}exports[_0x940f('0x26')]=function(_0x468659,_0xe501c6){var _0x142957={},_0x1496e2={},_0x4589be={'count':0x0,'rows':[]};var _0x4ee4db=_[_0x940f('0x27')](db['MailSubstatus'][_0x940f('0x28')],function(_0x2f556e){return{'name':_0x2f556e[_0x940f('0x29')],'type':_0x2f556e[_0x940f('0x2a')]['key']};});_0x1496e2['model']=_[_0x940f('0x27')](_0x4ee4db,'name');_0x1496e2[_0x940f('0x2b')]=_[_0x940f('0x2c')](_0x468659[_0x940f('0x2b')]);_0x1496e2[_0x940f('0x2d')]=_['intersection'](_0x1496e2[_0x940f('0x2e')],_0x1496e2[_0x940f('0x2b')]);_0x142957['attributes']=_['intersection'](_0x1496e2[_0x940f('0x2e')],qs[_0x940f('0x2f')](_0x468659[_0x940f('0x2b')][_0x940f('0x2f')]));_0x142957['attributes']=_0x142957[_0x940f('0x30')][_0x940f('0x31')]?_0x142957[_0x940f('0x30')]:_0x1496e2[_0x940f('0x2e')];if(!_0x468659[_0x940f('0x2b')][_0x940f('0x32')](_0x940f('0x33'))){_0x142957['limit']=qs[_0x940f('0x34')](_0x468659[_0x940f('0x2b')][_0x940f('0x34')]);_0x142957[_0x940f('0x18')]=qs[_0x940f('0x18')](_0x468659[_0x940f('0x2b')]['offset']);}_0x142957[_0x940f('0x35')]=qs[_0x940f('0x36')](_0x468659['query'][_0x940f('0x36')]);_0x142957[_0x940f('0x37')]=qs[_0x940f('0x2d')](_[_0x940f('0x38')](_0x468659['query'],_0x1496e2[_0x940f('0x2d')]),_0x4ee4db);if(_0x468659[_0x940f('0x2b')][_0x940f('0x39')]){_0x142957[_0x940f('0x37')]=_['merge'](_0x142957['where'],{'$or':_[_0x940f('0x27')](_0x4ee4db,function(_0x7cb1f0){if(_0x7cb1f0[_0x940f('0x2a')]!==_0x940f('0x3a')){var _0x3e1d81={};_0x3e1d81[_0x7cb1f0[_0x940f('0x24')]]={'$like':'%'+_0x468659['query'][_0x940f('0x39')]+'%'};return _0x3e1d81;}})});}_0x142957=_['merge']({},_0x142957,_0x468659['options']);var _0x4c25cb={'where':_0x142957[_0x940f('0x37')]};return db[_0x940f('0x3b')]['count'](_0x4c25cb)['then'](function(_0x285d16){_0x4589be[_0x940f('0x3c')]=_0x285d16;if(_0x468659[_0x940f('0x2b')]['includeAll']){_0x142957['include']=[{'all':!![]}];}return db[_0x940f('0x3b')][_0x940f('0x3d')](_0x142957);})[_0x940f('0x20')](function(_0x5b10e7){_0x4589be[_0x940f('0x3e')]=_0x5b10e7;return _0x4589be;})['then'](respondWithFilteredResult(_0xe501c6,_0x142957))[_0x940f('0x3f')](handleError(_0xe501c6,null));};exports[_0x940f('0x40')]=function(_0x64c02d,_0x1b9cfd){var _0xc3b6f6={'raw':!![],'where':{'id':_0x64c02d['params']['id']}},_0x5b3d72={};_0x5b3d72[_0x940f('0x2e')]=_[_0x940f('0x2c')](db['MailSubstatus'][_0x940f('0x28')]);_0x5b3d72[_0x940f('0x2b')]=_[_0x940f('0x2c')](_0x64c02d[_0x940f('0x2b')]);_0x5b3d72[_0x940f('0x2d')]=_[_0x940f('0x41')](_0x5b3d72['model'],_0x5b3d72[_0x940f('0x2b')]);_0xc3b6f6[_0x940f('0x30')]=_[_0x940f('0x41')](_0x5b3d72[_0x940f('0x2e')],qs[_0x940f('0x2f')](_0x64c02d[_0x940f('0x2b')][_0x940f('0x2f')]));_0xc3b6f6[_0x940f('0x30')]=_0xc3b6f6[_0x940f('0x30')][_0x940f('0x31')]?_0xc3b6f6[_0x940f('0x30')]:_0x5b3d72[_0x940f('0x2e')];if(_0x64c02d['query'][_0x940f('0x42')]){_0xc3b6f6[_0x940f('0x43')]=[{'all':!![]}];}_0xc3b6f6=_[_0x940f('0x44')]({},_0xc3b6f6,_0x64c02d[_0x940f('0x45')]);return db[_0x940f('0x3b')]['find'](_0xc3b6f6)[_0x940f('0x20')](handleEntityNotFound(_0x1b9cfd,null))[_0x940f('0x20')](respondWithResult(_0x1b9cfd,null))['catch'](handleError(_0x1b9cfd,null));};exports['create']=function(_0x57fc6f,_0x15d7e2){return db[_0x940f('0x3b')]['create'](_0x57fc6f[_0x940f('0x46')],{})[_0x940f('0x20')](respondWithResult(_0x15d7e2,0xc9))[_0x940f('0x3f')](handleError(_0x15d7e2,null));};exports[_0x940f('0x1f')]=function(_0x62394e,_0x48c598){if(_0x62394e[_0x940f('0x46')]['id']){delete _0x62394e['body']['id'];}return db[_0x940f('0x3b')]['find']({'where':{'id':_0x62394e[_0x940f('0x47')]['id']}})[_0x940f('0x20')](handleEntityNotFound(_0x48c598,null))[_0x940f('0x20')](saveUpdates(_0x62394e['body'],null))[_0x940f('0x20')](respondWithResult(_0x48c598,null))[_0x940f('0x3f')](handleError(_0x48c598,null));};exports[_0x940f('0x21')]=function(_0x451f86,_0x3450ac){return db[_0x940f('0x3b')][_0x940f('0x48')]({'where':{'id':_0x451f86[_0x940f('0x47')]['id']}})['then'](handleEntityNotFound(_0x3450ac,null))[_0x940f('0x20')](removeEntity(_0x3450ac,null))['catch'](handleError(_0x3450ac,null));};exports[_0x940f('0x49')]=function(_0xa3494a,_0x3693f7){return db[_0x940f('0x3b')][_0x940f('0x49')]()[_0x940f('0x20')](respondWithResult(_0x3693f7,null))[_0x940f('0x3f')](handleError(_0x3693f7,null));}; \ No newline at end of file +var _0x3d08=['catch','create','body','describe','zip-dir','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','sort','pick','where','merge','options','includeAll','show','params','include','find'];(function(_0x243bba,_0x1ea69f){var _0x12e696=function(_0x5d3ab5){while(--_0x5d3ab5){_0x243bba['push'](_0x243bba['shift']());}};_0x12e696(++_0x1ea69f);}(_0x3d08,0x1ee));var _0x83d0=function(_0x3c9a7f,_0x2b6593){_0x3c9a7f=_0x3c9a7f-0x0;var _0x115aaf=_0x3d08[_0x3c9a7f];return _0x115aaf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x83d0('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x83d0('0x1'));var moment=require(_0x83d0('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x83d0('0x3'));var path=require(_0x83d0('0x4'));var sox=require(_0x83d0('0x5'));var csv=require(_0x83d0('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x83d0('0x7'));var _=require(_0x83d0('0x8'));var squel=require(_0x83d0('0x9'));var crypto=require(_0x83d0('0xa'));var jsforce=require(_0x83d0('0xb'));var deskjs=require(_0x83d0('0xc'));var toCsv=require(_0x83d0('0x6'));var querystring=require('querystring');var Papa=require(_0x83d0('0xd'));var Redis=require(_0x83d0('0xe'));var authService=require(_0x83d0('0xf'));var qs=require(_0x83d0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x83d0('0x11'));var logger=require(_0x83d0('0x12'))(_0x83d0('0x13'));var utils=require(_0x83d0('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x83d0('0x15'))['db'];function respondWithStatusCode(_0x5baed6,_0x106d26){_0x106d26=_0x106d26||0xcc;return function(_0x16d47c){if(_0x16d47c){return _0x5baed6[_0x83d0('0x16')](_0x106d26);}return _0x5baed6[_0x83d0('0x17')](_0x106d26)[_0x83d0('0x18')]();};}function respondWithResult(_0x47d900,_0x34b7c7){_0x34b7c7=_0x34b7c7||0xc8;return function(_0x30ffb3){if(_0x30ffb3){return _0x47d900[_0x83d0('0x17')](_0x34b7c7)[_0x83d0('0x19')](_0x30ffb3);}};}function respondWithFilteredResult(_0x997090,_0x4703a6){return function(_0x1ea7a3){if(_0x1ea7a3){var _0x36933d=typeof _0x4703a6[_0x83d0('0x1a')]===_0x83d0('0x1b')&&typeof _0x4703a6[_0x83d0('0x1c')]===_0x83d0('0x1b');var _0x561b5d=_0x1ea7a3[_0x83d0('0x1d')];var _0x20ea75=_0x36933d?0x0:_0x4703a6[_0x83d0('0x1a')];var _0x1784f3=_0x36933d?_0x1ea7a3['count']:_0x4703a6[_0x83d0('0x1a')]+_0x4703a6[_0x83d0('0x1c')];var _0x5997bc;if(_0x1784f3>=_0x561b5d){_0x1784f3=_0x561b5d;_0x5997bc=0xc8;}else{_0x5997bc=0xce;}_0x997090[_0x83d0('0x17')](_0x5997bc);return _0x997090[_0x83d0('0x1e')](_0x83d0('0x1f'),_0x20ea75+'-'+_0x1784f3+'/'+_0x561b5d)[_0x83d0('0x19')](_0x1ea7a3);}return null;};}function patchUpdates(_0x73ea0f){return function(_0x41c54c){try{jsonpatch[_0x83d0('0x20')](_0x41c54c,_0x73ea0f,!![]);}catch(_0x35fddf){return BPromise[_0x83d0('0x21')](_0x35fddf);}return _0x41c54c['save']();};}function saveUpdates(_0x4cee9d,_0x2bad13){return function(_0x3de1db){if(_0x3de1db){return _0x3de1db[_0x83d0('0x22')](_0x4cee9d)[_0x83d0('0x23')](function(_0x25053c){return _0x25053c;});}return null;};}function removeEntity(_0x43e30d,_0xcce35){return function(_0x1edddc){if(_0x1edddc){return _0x1edddc[_0x83d0('0x24')]()['then'](function(){_0x43e30d[_0x83d0('0x17')](0xcc)[_0x83d0('0x18')]();});}};}function handleEntityNotFound(_0x32cc31,_0x4e31ed){return function(_0x1d967c){if(!_0x1d967c){_0x32cc31['sendStatus'](0x194);}return _0x1d967c;};}function handleError(_0x2665b8,_0xd2dfd6){_0xd2dfd6=_0xd2dfd6||0x1f4;return function(_0x7eda1d){logger[_0x83d0('0x25')](_0x7eda1d[_0x83d0('0x26')]);if(_0x7eda1d[_0x83d0('0x27')]){delete _0x7eda1d[_0x83d0('0x27')];}_0x2665b8[_0x83d0('0x17')](_0xd2dfd6)[_0x83d0('0x28')](_0x7eda1d);};}exports[_0x83d0('0x29')]=function(_0x1d8d9e,_0x2379c1){var _0x1ad6d2={},_0x15ceff={},_0x5c33b9={'count':0x0,'rows':[]};var _0x550428=_['map'](db[_0x83d0('0x2a')][_0x83d0('0x2b')],function(_0x3fa18c){return{'name':_0x3fa18c[_0x83d0('0x2c')],'type':_0x3fa18c[_0x83d0('0x2d')][_0x83d0('0x2e')]};});_0x15ceff[_0x83d0('0x2f')]=_[_0x83d0('0x30')](_0x550428,_0x83d0('0x27'));_0x15ceff[_0x83d0('0x31')]=_[_0x83d0('0x32')](_0x1d8d9e[_0x83d0('0x31')]);_0x15ceff[_0x83d0('0x33')]=_[_0x83d0('0x34')](_0x15ceff[_0x83d0('0x2f')],_0x15ceff['query']);_0x1ad6d2[_0x83d0('0x35')]=_[_0x83d0('0x34')](_0x15ceff[_0x83d0('0x2f')],qs[_0x83d0('0x36')](_0x1d8d9e[_0x83d0('0x31')][_0x83d0('0x36')]));_0x1ad6d2[_0x83d0('0x35')]=_0x1ad6d2[_0x83d0('0x35')][_0x83d0('0x37')]?_0x1ad6d2[_0x83d0('0x35')]:_0x15ceff[_0x83d0('0x2f')];if(!_0x1d8d9e[_0x83d0('0x31')]['hasOwnProperty']('nolimit')){_0x1ad6d2[_0x83d0('0x1c')]=qs[_0x83d0('0x1c')](_0x1d8d9e['query']['limit']);_0x1ad6d2[_0x83d0('0x1a')]=qs['offset'](_0x1d8d9e[_0x83d0('0x31')][_0x83d0('0x1a')]);}_0x1ad6d2['order']=qs[_0x83d0('0x38')](_0x1d8d9e[_0x83d0('0x31')][_0x83d0('0x38')]);_0x1ad6d2['where']=qs[_0x83d0('0x33')](_[_0x83d0('0x39')](_0x1d8d9e[_0x83d0('0x31')],_0x15ceff['filters']),_0x550428);if(_0x1d8d9e[_0x83d0('0x31')]['filter']){_0x1ad6d2[_0x83d0('0x3a')]=_[_0x83d0('0x3b')](_0x1ad6d2['where'],{'$or':_[_0x83d0('0x30')](_0x550428,function(_0x4c18cf){if(_0x4c18cf['type']!=='VIRTUAL'){var _0x21b086={};_0x21b086[_0x4c18cf[_0x83d0('0x27')]]={'$like':'%'+_0x1d8d9e[_0x83d0('0x31')]['filter']+'%'};return _0x21b086;}})});}_0x1ad6d2=_[_0x83d0('0x3b')]({},_0x1ad6d2,_0x1d8d9e[_0x83d0('0x3c')]);var _0x3ecde3={'where':_0x1ad6d2['where']};return db['MailSubstatus'][_0x83d0('0x1d')](_0x3ecde3)['then'](function(_0xfb45d4){_0x5c33b9[_0x83d0('0x1d')]=_0xfb45d4;if(_0x1d8d9e[_0x83d0('0x31')][_0x83d0('0x3d')]){_0x1ad6d2['include']=[{'all':!![]}];}return db[_0x83d0('0x2a')]['findAll'](_0x1ad6d2);})['then'](function(_0x2612a8){_0x5c33b9['rows']=_0x2612a8;return _0x5c33b9;})[_0x83d0('0x23')](respondWithFilteredResult(_0x2379c1,_0x1ad6d2))['catch'](handleError(_0x2379c1,null));};exports[_0x83d0('0x3e')]=function(_0x5e24c8,_0xf558a2){var _0x2148fd={'raw':!![],'where':{'id':_0x5e24c8[_0x83d0('0x3f')]['id']}},_0x336388={};_0x336388[_0x83d0('0x2f')]=_['keys'](db[_0x83d0('0x2a')][_0x83d0('0x2b')]);_0x336388['query']=_[_0x83d0('0x32')](_0x5e24c8[_0x83d0('0x31')]);_0x336388[_0x83d0('0x33')]=_[_0x83d0('0x34')](_0x336388['model'],_0x336388[_0x83d0('0x31')]);_0x2148fd['attributes']=_[_0x83d0('0x34')](_0x336388[_0x83d0('0x2f')],qs[_0x83d0('0x36')](_0x5e24c8[_0x83d0('0x31')]['fields']));_0x2148fd['attributes']=_0x2148fd[_0x83d0('0x35')][_0x83d0('0x37')]?_0x2148fd[_0x83d0('0x35')]:_0x336388['model'];if(_0x5e24c8[_0x83d0('0x31')][_0x83d0('0x3d')]){_0x2148fd[_0x83d0('0x40')]=[{'all':!![]}];}_0x2148fd=_['merge']({},_0x2148fd,_0x5e24c8[_0x83d0('0x3c')]);return db[_0x83d0('0x2a')][_0x83d0('0x41')](_0x2148fd)[_0x83d0('0x23')](handleEntityNotFound(_0xf558a2,null))[_0x83d0('0x23')](respondWithResult(_0xf558a2,null))[_0x83d0('0x42')](handleError(_0xf558a2,null));};exports[_0x83d0('0x43')]=function(_0x559018,_0x3ec098){return db[_0x83d0('0x2a')][_0x83d0('0x43')](_0x559018['body'],{})[_0x83d0('0x23')](respondWithResult(_0x3ec098,0xc9))[_0x83d0('0x42')](handleError(_0x3ec098,null));};exports[_0x83d0('0x22')]=function(_0x48cdb5,_0x1d5c4d){if(_0x48cdb5[_0x83d0('0x44')]['id']){delete _0x48cdb5[_0x83d0('0x44')]['id'];}return db['MailSubstatus'][_0x83d0('0x41')]({'where':{'id':_0x48cdb5['params']['id']}})[_0x83d0('0x23')](handleEntityNotFound(_0x1d5c4d,null))[_0x83d0('0x23')](saveUpdates(_0x48cdb5[_0x83d0('0x44')],null))['then'](respondWithResult(_0x1d5c4d,null))[_0x83d0('0x42')](handleError(_0x1d5c4d,null));};exports[_0x83d0('0x24')]=function(_0x5836ea,_0x5ec144){return db['MailSubstatus'][_0x83d0('0x41')]({'where':{'id':_0x5836ea[_0x83d0('0x3f')]['id']}})[_0x83d0('0x23')](handleEntityNotFound(_0x5ec144,null))['then'](removeEntity(_0x5ec144,null))[_0x83d0('0x42')](handleError(_0x5ec144,null));};exports[_0x83d0('0x45')]=function(_0x17f8ce,_0x2e8f1e){return db[_0x83d0('0x2a')]['describe']()[_0x83d0('0x23')](respondWithResult(_0x2e8f1e,null))[_0x83d0('0x42')](handleError(_0x2e8f1e,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index bc8cc30..92eb500 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7345=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','update'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x7345,0xac));var _0x5734=function(_0x3c910d,_0x4be696){_0x3c910d=_0x3c910d-0x0;var _0x307af9=_0x7345[_0x3c910d];return _0x307af9;};'use strict';var EventEmitter=require(_0x5734('0x0'));var MailSubstatus=require('../../mysqldb')['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x5734('0x1')](0x0);var events={'afterUpdate':_0x5734('0x2')};function emitEvent(_0x3a8e59){return function(_0x1adc0e,_0xbdcd43,_0x47a1a7){MailSubstatusEvents[_0x5734('0x3')](_0x3a8e59+':'+_0x1adc0e['id'],_0x1adc0e);MailSubstatusEvents['emit'](_0x3a8e59,_0x1adc0e);_0x47a1a7(null);};}for(var e in events){if(events[_0x5734('0x4')](e)){var event=events[e];MailSubstatus[_0x5734('0x5')](e,emitEvent(event));}}module[_0x5734('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0xcc1e=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus'];(function(_0x47ae80,_0x716165){var _0x528263=function(_0x284553){while(--_0x284553){_0x47ae80['push'](_0x47ae80['shift']());}};_0x528263(++_0x716165);}(_0xcc1e,0x19b));var _0xecc1=function(_0x59a3ce,_0x23ef83){_0x59a3ce=_0x59a3ce-0x0;var _0x924618=_0xcc1e[_0x59a3ce];return _0x924618;};'use strict';var EventEmitter=require(_0xecc1('0x0'));var MailSubstatus=require(_0xecc1('0x1'))['db'][_0xecc1('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xecc1('0x3')](0x0);var events={'afterUpdate':_0xecc1('0x4')};function emitEvent(_0x5b29ae){return function(_0x4dfb14,_0x2ee313,_0x1c10ca){MailSubstatusEvents[_0xecc1('0x5')](_0x5b29ae+':'+_0x4dfb14['id'],_0x4dfb14);MailSubstatusEvents[_0xecc1('0x5')](_0x5b29ae,_0x4dfb14);_0x1c10ca(null);};}for(var e in events){if(events[_0xecc1('0x6')](e)){var event=events[e];MailSubstatus[_0xecc1('0x7')](e,emitEvent(event));}}module[_0xecc1('0x8')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 3350bf4..084bd64 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 _0xbb68=['_previousDataValues','then','catch','./mailSubstatus.attributes','exports','models','define','mail_substatuses','Condition','update','name'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0xbb68,0xd4));var _0x8bb6=function(_0x42da4e,_0x347452){_0x42da4e=_0x42da4e-0x0;var _0x25fad5=_0xbb68[_0x42da4e];return _0x25fad5;};'use strict';var attributes=require(_0x8bb6('0x0'));module[_0x8bb6('0x1')]=function(_0x2f8829){var _0x5905f4=_0x2f8829[_0x8bb6('0x2')];return _0x2f8829[_0x8bb6('0x3')]('MailSubstatus',attributes,{'tableName':_0x8bb6('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2f056d,_0x355cc1,_0xdb1b1e){return _0x5905f4[_0x8bb6('0x5')][_0x8bb6('0x6')]({'value':_0x2f056d[_0x8bb6('0x7')]},{'where':{'field':'mailSubstatus','value':_0x2f056d[_0x8bb6('0x8')][_0x8bb6('0x7')]}})[_0x8bb6('0x9')](function(){_0xdb1b1e();})[_0x8bb6('0xa')](function(_0x2aa3f3){_0xdb1b1e(_0x2aa3f3);});}}});}; \ No newline at end of file +var _0x2263=['MailSubstatus','mail_substatuses','Condition','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','define'];(function(_0x35f570,_0xd00776){var _0x4ade60=function(_0x5bb126){while(--_0x5bb126){_0x35f570['push'](_0x35f570['shift']());}};_0x4ade60(++_0xd00776);}(_0x2263,0x194));var _0x3226=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x2263[_0x2f1762];return _0x8ab21;};'use strict';var attributes=require(_0x3226('0x0'));module[_0x3226('0x1')]=function(_0x21dd1f){var _0x7c845a=_0x21dd1f['models'];return _0x21dd1f[_0x3226('0x2')](_0x3226('0x3'),attributes,{'tableName':_0x3226('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5ed34f,_0x5d3d0b,_0x335f36){return _0x7c845a[_0x3226('0x5')]['update']({'value':_0x5ed34f[_0x3226('0x6')]},{'where':{'field':_0x3226('0x7'),'value':_0x5ed34f[_0x3226('0x8')][_0x3226('0x6')]}})[_0x3226('0x9')](function(){_0x335f36();})[_0x3226('0xa')](function(_0x4ab934){_0x335f36(_0x4ab934);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 727345f..c52c6d5 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 _0xc40d=['request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x57222a,_0x133df1){var _0x1897d8=function(_0x2513d5){while(--_0x2513d5){_0x57222a['push'](_0x57222a['shift']());}};_0x1897d8(++_0x133df1);}(_0xc40d,0x1b5));var _0xdc40=function(_0xe2c135,_0x5d4895){_0xe2c135=_0xe2c135-0x0;var _0x2e48e8=_0xc40d[_0xe2c135];return _0x2e48e8;};'use strict';var _=require(_0xdc40('0x0'));var util=require(_0xdc40('0x1'));var moment=require(_0xdc40('0x2'));var BPromise=require(_0xdc40('0x3'));var rs=require(_0xdc40('0x4'));var fs=require('fs');var Redis=require(_0xdc40('0x5'));var db=require(_0xdc40('0x6'))['db'];var utils=require(_0xdc40('0x7'));var logger=require(_0xdc40('0x8'))(_0xdc40('0x9'));var config=require('../../config/environment');var jayson=require(_0xdc40('0xa'));var client=jayson[_0xdc40('0xb')][_0xdc40('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41a9be,_0x29e183,_0x5872a2){return new BPromise(function(_0x3ce9ae,_0x110df2){return client[_0xdc40('0xd')](_0x41a9be,_0x5872a2)['then'](function(_0x1de006){logger[_0xdc40('0xe')](_0xdc40('0xf'),_0x29e183,_0xdc40('0x10'));logger[_0xdc40('0x11')](_0xdc40('0x12'),_0x29e183,_0xdc40('0x10'),JSON[_0xdc40('0x13')](_0x1de006));if(_0x1de006[_0xdc40('0x14')]){if(_0x1de006[_0xdc40('0x14')][_0xdc40('0x15')]===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x29e183,_0x1de006[_0xdc40('0x14')][_0xdc40('0x16')]);return _0x110df2(_0x1de006[_0xdc40('0x14')][_0xdc40('0x16')]);}logger[_0xdc40('0x14')](_0xdc40('0xf'),_0x29e183,_0x1de006[_0xdc40('0x14')]['message']);return _0x3ce9ae(_0x1de006['error'][_0xdc40('0x16')]);}else{logger[_0xdc40('0xe')](_0xdc40('0xf'),_0x29e183,'request\x20sent');_0x3ce9ae(_0x1de006[_0xdc40('0x17')][_0xdc40('0x16')]);}})[_0xdc40('0x18')](function(_0xf746a){logger['error'](_0xdc40('0xf'),_0x29e183,_0xf746a);_0x110df2(_0xf746a);});});} \ No newline at end of file +var _0x047e=['../../mysqldb','../../config/logger','client','http','request','then','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x207db1,_0x19c38c){var _0x3744e1=function(_0x1cd678){while(--_0x1cd678){_0x207db1['push'](_0x207db1['shift']());}};_0x3744e1(++_0x19c38c);}(_0x047e,0x121));var _0xe047=function(_0x2fa99a,_0x5c2c61){_0x2fa99a=_0x2fa99a-0x0;var _0x3635ff=_0x047e[_0x2fa99a];return _0x3635ff;};'use strict';var _=require(_0xe047('0x0'));var util=require('util');var moment=require(_0xe047('0x1'));var BPromise=require(_0xe047('0x2'));var rs=require(_0xe047('0x3'));var fs=require('fs');var Redis=require(_0xe047('0x4'));var db=require(_0xe047('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe047('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe047('0x7')][_0xe047('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a0e18,_0x402fa8,_0x16e2e1){return new BPromise(function(_0x243e93,_0x182c95){return client[_0xe047('0x9')](_0x4a0e18,_0x16e2e1)[_0xe047('0xa')](function(_0x99e42a){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x402fa8,'request\x20sent');logger[_0xe047('0xb')](_0xe047('0xc'),_0x402fa8,_0xe047('0xd'),JSON[_0xe047('0xe')](_0x99e42a));if(_0x99e42a[_0xe047('0xf')]){if(_0x99e42a['error'][_0xe047('0x10')]===0x1f4){logger[_0xe047('0xf')](_0xe047('0x11'),_0x402fa8,_0x99e42a[_0xe047('0xf')]['message']);return _0x182c95(_0x99e42a[_0xe047('0xf')]['message']);}logger[_0xe047('0xf')](_0xe047('0x11'),_0x402fa8,_0x99e42a[_0xe047('0xf')][_0xe047('0x12')]);return _0x243e93(_0x99e42a['error'][_0xe047('0x12')]);}else{logger[_0xe047('0x13')](_0xe047('0x11'),_0x402fa8,_0xe047('0xd'));_0x243e93(_0x99e42a['result'][_0xe047('0x12')]);}})[_0xe047('0x14')](function(_0x310440){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x402fa8,_0x310440);_0x182c95(_0x310440);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 02bb14f..62f773a 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 _0x61b0=['describe','/:id','show','post','update','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','isAuthenticated','index','get','/describe'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x61b0,0x181));var _0x061b=function(_0x538463,_0x313c0c){_0x538463=_0x538463-0x0;var _0xfa244f=_0x61b0[_0x538463];return _0xfa244f;};'use strict';var multer=require(_0x061b('0x0'));var util=require(_0x061b('0x1'));var path=require('path');var timeout=require(_0x061b('0x2'));var express=require('express');var router=express[_0x061b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x061b('0x4'));var interaction=require(_0x061b('0x5'));var config=require('../../config/environment');var controller=require(_0x061b('0x6'));router['get']('/',auth[_0x061b('0x7')](),controller[_0x061b('0x8')]);router[_0x061b('0x9')](_0x061b('0xa'),auth[_0x061b('0x7')](),controller[_0x061b('0xb')]);router[_0x061b('0x9')](_0x061b('0xc'),auth['isAuthenticated'](),controller[_0x061b('0xd')]);router[_0x061b('0xe')]('/',auth[_0x061b('0x7')](),controller['create']);router['put'](_0x061b('0xc'),auth['isAuthenticated'](),controller[_0x061b('0xf')]);router[_0x061b('0x10')](_0x061b('0xc'),auth[_0x061b('0x7')](),controller[_0x061b('0x11')]);module['exports']=router; \ No newline at end of file +var _0xf182=['isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','describe','/:id','post','create','put'];(function(_0x1d76ff,_0x4432a5){var _0x225544=function(_0x2830fd){while(--_0x2830fd){_0x1d76ff['push'](_0x1d76ff['shift']());}};_0x225544(++_0x4432a5);}(_0xf182,0x1a3));var _0x2f18=function(_0x355089,_0x3dc542){_0x355089=_0x355089-0x0;var _0x5df525=_0xf182[_0x355089];return _0x5df525;};'use strict';var multer=require(_0x2f18('0x0'));var util=require(_0x2f18('0x1'));var path=require('path');var timeout=require(_0x2f18('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2f18('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2f18('0x4'));var config=require(_0x2f18('0x5'));var controller=require(_0x2f18('0x6'));router[_0x2f18('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2f18('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x2f18('0x8')]);router[_0x2f18('0x7')](_0x2f18('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x2f18('0xa')]('/',auth['isAuthenticated'](),controller[_0x2f18('0xb')]);router[_0x2f18('0xc')]('/:id',auth[_0x2f18('0xd')](),controller[_0x2f18('0xe')]);router[_0x2f18('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2f18('0x10')]);module[_0x2f18('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index bf2862b..e3f8d5b 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x8eb9d,_0x320ee6){var _0x28c28=function(_0xda49b9){while(--_0xda49b9){_0x8eb9d['push'](_0x8eb9d['shift']());}};_0x28c28(++_0x320ee6);}(_0x54ef,0x112));var _0xf54e=function(_0x1a00ab,_0x169dfc){_0x1a00ab=_0x1a00ab-0x0;var _0x2ac5d8=_0x54ef[_0x1a00ab];return _0x2ac5d8;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0xb43b,0x1b2));var _0xbb43=function(_0xdda602,_0x41e4f3){_0xdda602=_0xdda602-0x0;var _0x5c0da9=_0xb43b[_0xdda602];return _0x5c0da9;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 0f5b377..cf35325 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 _0x0bb8=['include','findAll','rows','keys','find','catch','create','body','update','destroy','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','end','error','name','send','index','map','MailTransferReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll'];(function(_0x4fe35d,_0x21fee1){var _0x5bb28e=function(_0x214051){while(--_0x214051){_0x4fe35d['push'](_0x4fe35d['shift']());}};_0x5bb28e(++_0x21fee1);}(_0x0bb8,0x140));var _0x80bb=function(_0x1a72a4,_0x4c7103){_0x1a72a4=_0x1a72a4-0x0;var _0xdc1034=_0x0bb8[_0x1a72a4];return _0xdc1034;};'use strict';var emlformat=require(_0x80bb('0x0'));var rimraf=require(_0x80bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x80bb('0x2'));var rp=require(_0x80bb('0x3'));var moment=require(_0x80bb('0x4'));var BPromise=require(_0x80bb('0x5'));var Mustache=require('mustache');var util=require(_0x80bb('0x6'));var path=require(_0x80bb('0x7'));var sox=require('sox');var csv=require(_0x80bb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x80bb('0x9'));var _=require(_0x80bb('0xa'));var squel=require(_0x80bb('0xb'));var crypto=require(_0x80bb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x80bb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x80bb('0xe'));var Redis=require(_0x80bb('0xf'));var authService=require(_0x80bb('0x10'));var qs=require(_0x80bb('0x11'));var as=require(_0x80bb('0x12'));var hardwareService=require(_0x80bb('0x13'));var logger=require(_0x80bb('0x14'))(_0x80bb('0x15'));var utils=require(_0x80bb('0x16'));var config=require(_0x80bb('0x17'));var licenseUtil=require(_0x80bb('0x18'));var db=require(_0x80bb('0x19'))['db'];function respondWithStatusCode(_0x4fe0fe,_0x15a1f4){_0x15a1f4=_0x15a1f4||0xcc;return function(_0x3024a3){if(_0x3024a3){return _0x4fe0fe[_0x80bb('0x1a')](_0x15a1f4);}return _0x4fe0fe[_0x80bb('0x1b')](_0x15a1f4)['end']();};}function respondWithResult(_0x3366a2,_0x1f9cb6){_0x1f9cb6=_0x1f9cb6||0xc8;return function(_0x33606c){if(_0x33606c){return _0x3366a2['status'](_0x1f9cb6)[_0x80bb('0x1c')](_0x33606c);}};}function respondWithFilteredResult(_0x36488a,_0x2aecf2){return function(_0xffd058){if(_0xffd058){var _0x1bc487=typeof _0x2aecf2[_0x80bb('0x1d')]===_0x80bb('0x1e')&&typeof _0x2aecf2[_0x80bb('0x1f')]===_0x80bb('0x1e');var _0x46dd1e=_0xffd058[_0x80bb('0x20')];var _0x3cbff2=_0x1bc487?0x0:_0x2aecf2[_0x80bb('0x1d')];var _0x2fe966=_0x1bc487?_0xffd058[_0x80bb('0x20')]:_0x2aecf2[_0x80bb('0x1d')]+_0x2aecf2[_0x80bb('0x1f')];var _0x4f099e;if(_0x2fe966>=_0x46dd1e){_0x2fe966=_0x46dd1e;_0x4f099e=0xc8;}else{_0x4f099e=0xce;}_0x36488a['status'](_0x4f099e);return _0x36488a['set'](_0x80bb('0x21'),_0x3cbff2+'-'+_0x2fe966+'/'+_0x46dd1e)[_0x80bb('0x1c')](_0xffd058);}return null;};}function patchUpdates(_0x4d0806){return function(_0x5a154f){try{jsonpatch[_0x80bb('0x22')](_0x5a154f,_0x4d0806,!![]);}catch(_0x92f1ae){return BPromise[_0x80bb('0x23')](_0x92f1ae);}return _0x5a154f[_0x80bb('0x24')]();};}function saveUpdates(_0x25506c,_0x5ec262){return function(_0x10d84d){if(_0x10d84d){return _0x10d84d['update'](_0x25506c)[_0x80bb('0x25')](function(_0x5a6a6d){return _0x5a6a6d;});}return null;};}function removeEntity(_0x50fab0,_0x4313b2){return function(_0x5d0c5e){if(_0x5d0c5e){return _0x5d0c5e['destroy']()[_0x80bb('0x25')](function(){_0x50fab0[_0x80bb('0x1b')](0xcc)[_0x80bb('0x26')]();});}};}function handleEntityNotFound(_0x1c3097,_0x178f48){return function(_0x3e69d2){if(!_0x3e69d2){_0x1c3097[_0x80bb('0x1a')](0x194);}return _0x3e69d2;};}function handleError(_0x3b0fc4,_0x256989){_0x256989=_0x256989||0x1f4;return function(_0x4d2470){logger[_0x80bb('0x27')](_0x4d2470['stack']);if(_0x4d2470[_0x80bb('0x28')]){delete _0x4d2470['name'];}_0x3b0fc4[_0x80bb('0x1b')](_0x256989)[_0x80bb('0x29')](_0x4d2470);};}exports[_0x80bb('0x2a')]=function(_0x3492db,_0x5c3858){var _0x3685e7={},_0x384f3e={},_0x552cf6={'count':0x0,'rows':[]};var _0x5df536=_[_0x80bb('0x2b')](db[_0x80bb('0x2c')][_0x80bb('0x2d')],function(_0x19e2d9){return{'name':_0x19e2d9[_0x80bb('0x2e')],'type':_0x19e2d9['type'][_0x80bb('0x2f')]};});_0x384f3e[_0x80bb('0x30')]=_['map'](_0x5df536,_0x80bb('0x28'));_0x384f3e[_0x80bb('0x31')]=_['keys'](_0x3492db[_0x80bb('0x31')]);_0x384f3e[_0x80bb('0x32')]=_[_0x80bb('0x33')](_0x384f3e[_0x80bb('0x30')],_0x384f3e['query']);_0x3685e7[_0x80bb('0x34')]=_['intersection'](_0x384f3e[_0x80bb('0x30')],qs['fields'](_0x3492db[_0x80bb('0x31')][_0x80bb('0x35')]));_0x3685e7[_0x80bb('0x34')]=_0x3685e7['attributes'][_0x80bb('0x36')]?_0x3685e7['attributes']:_0x384f3e['model'];if(!_0x3492db['query']['hasOwnProperty']('nolimit')){_0x3685e7['limit']=qs['limit'](_0x3492db['query']['limit']);_0x3685e7[_0x80bb('0x1d')]=qs[_0x80bb('0x1d')](_0x3492db[_0x80bb('0x31')][_0x80bb('0x1d')]);}_0x3685e7[_0x80bb('0x37')]=qs[_0x80bb('0x38')](_0x3492db[_0x80bb('0x31')][_0x80bb('0x38')]);_0x3685e7[_0x80bb('0x39')]=qs['filters'](_[_0x80bb('0x3a')](_0x3492db[_0x80bb('0x31')],_0x384f3e[_0x80bb('0x32')]),_0x5df536);if(_0x3492db[_0x80bb('0x31')][_0x80bb('0x3b')]){_0x3685e7[_0x80bb('0x39')]=_[_0x80bb('0x3c')](_0x3685e7[_0x80bb('0x39')],{'$or':_[_0x80bb('0x2b')](_0x5df536,function(_0x99d21f){if(_0x99d21f[_0x80bb('0x3d')]!==_0x80bb('0x3e')){var _0x44c2a6={};_0x44c2a6[_0x99d21f[_0x80bb('0x28')]]={'$like':'%'+_0x3492db['query'][_0x80bb('0x3b')]+'%'};return _0x44c2a6;}})});}_0x3685e7=_['merge']({},_0x3685e7,_0x3492db[_0x80bb('0x3f')]);var _0x25f317={'where':_0x3685e7[_0x80bb('0x39')]};return db[_0x80bb('0x2c')][_0x80bb('0x20')](_0x25f317)[_0x80bb('0x25')](function(_0x1be67a){_0x552cf6[_0x80bb('0x20')]=_0x1be67a;if(_0x3492db[_0x80bb('0x31')][_0x80bb('0x40')]){_0x3685e7[_0x80bb('0x41')]=[{'all':!![]}];}return db[_0x80bb('0x2c')][_0x80bb('0x42')](_0x3685e7);})[_0x80bb('0x25')](function(_0x4b2822){_0x552cf6[_0x80bb('0x43')]=_0x4b2822;return _0x552cf6;})[_0x80bb('0x25')](respondWithFilteredResult(_0x5c3858,_0x3685e7))['catch'](handleError(_0x5c3858,null));};exports['show']=function(_0x36304c,_0x10b527){var _0x4fe321={'raw':!![],'where':{'id':_0x36304c['params']['id']}},_0x1aed30={};_0x1aed30[_0x80bb('0x30')]=_[_0x80bb('0x44')](db[_0x80bb('0x2c')][_0x80bb('0x2d')]);_0x1aed30[_0x80bb('0x31')]=_[_0x80bb('0x44')](_0x36304c[_0x80bb('0x31')]);_0x1aed30[_0x80bb('0x32')]=_[_0x80bb('0x33')](_0x1aed30['model'],_0x1aed30[_0x80bb('0x31')]);_0x4fe321[_0x80bb('0x34')]=_[_0x80bb('0x33')](_0x1aed30[_0x80bb('0x30')],qs[_0x80bb('0x35')](_0x36304c[_0x80bb('0x31')][_0x80bb('0x35')]));_0x4fe321[_0x80bb('0x34')]=_0x4fe321[_0x80bb('0x34')]['length']?_0x4fe321[_0x80bb('0x34')]:_0x1aed30['model'];if(_0x36304c[_0x80bb('0x31')]['includeAll']){_0x4fe321[_0x80bb('0x41')]=[{'all':!![]}];}_0x4fe321=_[_0x80bb('0x3c')]({},_0x4fe321,_0x36304c['options']);return db[_0x80bb('0x2c')][_0x80bb('0x45')](_0x4fe321)[_0x80bb('0x25')](handleEntityNotFound(_0x10b527,null))[_0x80bb('0x25')](respondWithResult(_0x10b527,null))[_0x80bb('0x46')](handleError(_0x10b527,null));};exports[_0x80bb('0x47')]=function(_0xb3b11a,_0x56ba9c){return db[_0x80bb('0x2c')][_0x80bb('0x47')](_0xb3b11a[_0x80bb('0x48')],{})[_0x80bb('0x25')](respondWithResult(_0x56ba9c,0xc9))[_0x80bb('0x46')](handleError(_0x56ba9c,null));};exports[_0x80bb('0x49')]=function(_0x5590ac,_0x5b2fa0){if(_0x5590ac[_0x80bb('0x48')]['id']){delete _0x5590ac['body']['id'];}return db['MailTransferReport'][_0x80bb('0x45')]({'where':{'id':_0x5590ac['params']['id']}})[_0x80bb('0x25')](handleEntityNotFound(_0x5b2fa0,null))[_0x80bb('0x25')](saveUpdates(_0x5590ac['body'],null))['then'](respondWithResult(_0x5b2fa0,null))[_0x80bb('0x46')](handleError(_0x5b2fa0,null));};exports[_0x80bb('0x4a')]=function(_0x3732a5,_0x242d4c){return db[_0x80bb('0x2c')][_0x80bb('0x45')]({'where':{'id':_0x3732a5[_0x80bb('0x4b')]['id']}})[_0x80bb('0x25')](handleEntityNotFound(_0x242d4c,null))['then'](removeEntity(_0x242d4c,null))[_0x80bb('0x46')](handleError(_0x242d4c,null));};exports[_0x80bb('0x4c')]=function(_0x39b2a6,_0x10eb39){return db['MailTransferReport'][_0x80bb('0x4c')]()[_0x80bb('0x25')](respondWithResult(_0x10eb39,null))['catch'](handleError(_0x10eb39,null));}; \ No newline at end of file +var _0xea11=['findAll','rows','params','keys','rawAttributes','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','MailTransferReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll'];(function(_0x2b4c10,_0x2241d3){var _0x46968=function(_0x2361f4){while(--_0x2361f4){_0x2b4c10['push'](_0x2b4c10['shift']());}};_0x46968(++_0x2241d3);}(_0xea11,0x101));var _0x1ea1=function(_0x55dcc6,_0x5f3de0){_0x55dcc6=_0x55dcc6-0x0;var _0x2b2e02=_0xea11[_0x55dcc6];return _0x2b2e02;};'use strict';var emlformat=require(_0x1ea1('0x0'));var rimraf=require(_0x1ea1('0x1'));var zipdir=require(_0x1ea1('0x2'));var jsonpatch=require(_0x1ea1('0x3'));var rp=require('request-promise');var moment=require(_0x1ea1('0x4'));var BPromise=require(_0x1ea1('0x5'));var Mustache=require(_0x1ea1('0x6'));var util=require(_0x1ea1('0x7'));var path=require(_0x1ea1('0x8'));var sox=require(_0x1ea1('0x9'));var csv=require(_0x1ea1('0xa'));var ejs=require(_0x1ea1('0xb'));var fs=require('fs');var fs_extra=require(_0x1ea1('0xc'));var _=require(_0x1ea1('0xd'));var squel=require('squel');var crypto=require(_0x1ea1('0xe'));var jsforce=require(_0x1ea1('0xf'));var deskjs=require(_0x1ea1('0x10'));var toCsv=require(_0x1ea1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1ea1('0x11'));var authService=require(_0x1ea1('0x12'));var qs=require(_0x1ea1('0x13'));var as=require(_0x1ea1('0x14'));var hardwareService=require(_0x1ea1('0x15'));var logger=require(_0x1ea1('0x16'))(_0x1ea1('0x17'));var utils=require(_0x1ea1('0x18'));var config=require(_0x1ea1('0x19'));var licenseUtil=require(_0x1ea1('0x1a'));var db=require(_0x1ea1('0x1b'))['db'];function respondWithStatusCode(_0x28534c,_0x2a06a5){_0x2a06a5=_0x2a06a5||0xcc;return function(_0x2b799c){if(_0x2b799c){return _0x28534c[_0x1ea1('0x1c')](_0x2a06a5);}return _0x28534c[_0x1ea1('0x1d')](_0x2a06a5)[_0x1ea1('0x1e')]();};}function respondWithResult(_0x521da7,_0x492a2a){_0x492a2a=_0x492a2a||0xc8;return function(_0x245ad3){if(_0x245ad3){return _0x521da7['status'](_0x492a2a)[_0x1ea1('0x1f')](_0x245ad3);}};}function respondWithFilteredResult(_0x3e19e0,_0x342fd7){return function(_0x365544){if(_0x365544){var _0x27a890=typeof _0x342fd7['offset']===_0x1ea1('0x20')&&typeof _0x342fd7[_0x1ea1('0x21')]==='undefined';var _0x214f63=_0x365544[_0x1ea1('0x22')];var _0x4e3812=_0x27a890?0x0:_0x342fd7[_0x1ea1('0x23')];var _0x300c1e=_0x27a890?_0x365544[_0x1ea1('0x22')]:_0x342fd7[_0x1ea1('0x23')]+_0x342fd7[_0x1ea1('0x21')];var _0x1cb81b;if(_0x300c1e>=_0x214f63){_0x300c1e=_0x214f63;_0x1cb81b=0xc8;}else{_0x1cb81b=0xce;}_0x3e19e0['status'](_0x1cb81b);return _0x3e19e0[_0x1ea1('0x24')](_0x1ea1('0x25'),_0x4e3812+'-'+_0x300c1e+'/'+_0x214f63)['json'](_0x365544);}return null;};}function patchUpdates(_0x2b3707){return function(_0x2531c9){try{jsonpatch[_0x1ea1('0x26')](_0x2531c9,_0x2b3707,!![]);}catch(_0x13b348){return BPromise[_0x1ea1('0x27')](_0x13b348);}return _0x2531c9[_0x1ea1('0x28')]();};}function saveUpdates(_0x3013f9,_0x29b86b){return function(_0x1d3edd){if(_0x1d3edd){return _0x1d3edd[_0x1ea1('0x29')](_0x3013f9)['then'](function(_0x173d73){return _0x173d73;});}return null;};}function removeEntity(_0x3f8baf,_0x3d8abd){return function(_0x4342ee){if(_0x4342ee){return _0x4342ee[_0x1ea1('0x2a')]()[_0x1ea1('0x2b')](function(){_0x3f8baf[_0x1ea1('0x1d')](0xcc)[_0x1ea1('0x1e')]();});}};}function handleEntityNotFound(_0x164442,_0x2390da){return function(_0x3b9ae3){if(!_0x3b9ae3){_0x164442['sendStatus'](0x194);}return _0x3b9ae3;};}function handleError(_0x5b4106,_0x497b97){_0x497b97=_0x497b97||0x1f4;return function(_0x56f14e){logger[_0x1ea1('0x2c')](_0x56f14e[_0x1ea1('0x2d')]);if(_0x56f14e[_0x1ea1('0x2e')]){delete _0x56f14e[_0x1ea1('0x2e')];}_0x5b4106['status'](_0x497b97)[_0x1ea1('0x2f')](_0x56f14e);};}exports[_0x1ea1('0x30')]=function(_0xec7945,_0x578b7d){var _0x1b9b2a={},_0x2ab43a={},_0x5d904a={'count':0x0,'rows':[]};var _0xc976c0=_[_0x1ea1('0x31')](db[_0x1ea1('0x32')]['rawAttributes'],function(_0x4aff0e){return{'name':_0x4aff0e[_0x1ea1('0x33')],'type':_0x4aff0e[_0x1ea1('0x34')][_0x1ea1('0x35')]};});_0x2ab43a[_0x1ea1('0x36')]=_['map'](_0xc976c0,_0x1ea1('0x2e'));_0x2ab43a['query']=_['keys'](_0xec7945[_0x1ea1('0x37')]);_0x2ab43a[_0x1ea1('0x38')]=_[_0x1ea1('0x39')](_0x2ab43a[_0x1ea1('0x36')],_0x2ab43a[_0x1ea1('0x37')]);_0x1b9b2a[_0x1ea1('0x3a')]=_[_0x1ea1('0x39')](_0x2ab43a[_0x1ea1('0x36')],qs[_0x1ea1('0x3b')](_0xec7945[_0x1ea1('0x37')]['fields']));_0x1b9b2a[_0x1ea1('0x3a')]=_0x1b9b2a[_0x1ea1('0x3a')][_0x1ea1('0x3c')]?_0x1b9b2a['attributes']:_0x2ab43a[_0x1ea1('0x36')];if(!_0xec7945[_0x1ea1('0x37')][_0x1ea1('0x3d')](_0x1ea1('0x3e'))){_0x1b9b2a[_0x1ea1('0x21')]=qs['limit'](_0xec7945[_0x1ea1('0x37')]['limit']);_0x1b9b2a[_0x1ea1('0x23')]=qs[_0x1ea1('0x23')](_0xec7945[_0x1ea1('0x37')]['offset']);}_0x1b9b2a[_0x1ea1('0x3f')]=qs['sort'](_0xec7945[_0x1ea1('0x37')][_0x1ea1('0x40')]);_0x1b9b2a[_0x1ea1('0x41')]=qs[_0x1ea1('0x38')](_[_0x1ea1('0x42')](_0xec7945[_0x1ea1('0x37')],_0x2ab43a[_0x1ea1('0x38')]),_0xc976c0);if(_0xec7945[_0x1ea1('0x37')][_0x1ea1('0x43')]){_0x1b9b2a[_0x1ea1('0x41')]=_[_0x1ea1('0x44')](_0x1b9b2a[_0x1ea1('0x41')],{'$or':_['map'](_0xc976c0,function(_0x125508){if(_0x125508[_0x1ea1('0x34')]!==_0x1ea1('0x45')){var _0x2b99d6={};_0x2b99d6[_0x125508[_0x1ea1('0x2e')]]={'$like':'%'+_0xec7945[_0x1ea1('0x37')][_0x1ea1('0x43')]+'%'};return _0x2b99d6;}})});}_0x1b9b2a=_[_0x1ea1('0x44')]({},_0x1b9b2a,_0xec7945['options']);var _0x5825ea={'where':_0x1b9b2a[_0x1ea1('0x41')]};return db['MailTransferReport'][_0x1ea1('0x22')](_0x5825ea)[_0x1ea1('0x2b')](function(_0x23d8a5){_0x5d904a[_0x1ea1('0x22')]=_0x23d8a5;if(_0xec7945[_0x1ea1('0x37')][_0x1ea1('0x46')]){_0x1b9b2a['include']=[{'all':!![]}];}return db['MailTransferReport'][_0x1ea1('0x47')](_0x1b9b2a);})['then'](function(_0x10b396){_0x5d904a[_0x1ea1('0x48')]=_0x10b396;return _0x5d904a;})[_0x1ea1('0x2b')](respondWithFilteredResult(_0x578b7d,_0x1b9b2a))['catch'](handleError(_0x578b7d,null));};exports['show']=function(_0x372aa3,_0x4b7752){var _0x2fb28a={'raw':!![],'where':{'id':_0x372aa3[_0x1ea1('0x49')]['id']}},_0x4487ee={};_0x4487ee[_0x1ea1('0x36')]=_[_0x1ea1('0x4a')](db[_0x1ea1('0x32')][_0x1ea1('0x4b')]);_0x4487ee[_0x1ea1('0x37')]=_[_0x1ea1('0x4a')](_0x372aa3[_0x1ea1('0x37')]);_0x4487ee['filters']=_[_0x1ea1('0x39')](_0x4487ee[_0x1ea1('0x36')],_0x4487ee[_0x1ea1('0x37')]);_0x2fb28a[_0x1ea1('0x3a')]=_[_0x1ea1('0x39')](_0x4487ee[_0x1ea1('0x36')],qs[_0x1ea1('0x3b')](_0x372aa3[_0x1ea1('0x37')][_0x1ea1('0x3b')]));_0x2fb28a[_0x1ea1('0x3a')]=_0x2fb28a['attributes'][_0x1ea1('0x3c')]?_0x2fb28a[_0x1ea1('0x3a')]:_0x4487ee[_0x1ea1('0x36')];if(_0x372aa3[_0x1ea1('0x37')][_0x1ea1('0x46')]){_0x2fb28a['include']=[{'all':!![]}];}_0x2fb28a=_[_0x1ea1('0x44')]({},_0x2fb28a,_0x372aa3[_0x1ea1('0x4c')]);return db[_0x1ea1('0x32')][_0x1ea1('0x4d')](_0x2fb28a)[_0x1ea1('0x2b')](handleEntityNotFound(_0x4b7752,null))[_0x1ea1('0x2b')](respondWithResult(_0x4b7752,null))[_0x1ea1('0x4e')](handleError(_0x4b7752,null));};exports[_0x1ea1('0x4f')]=function(_0x4f46fd,_0x353e4f){return db['MailTransferReport'][_0x1ea1('0x4f')](_0x4f46fd[_0x1ea1('0x50')],{})[_0x1ea1('0x2b')](respondWithResult(_0x353e4f,0xc9))[_0x1ea1('0x4e')](handleError(_0x353e4f,null));};exports['update']=function(_0x20a195,_0x280229){if(_0x20a195[_0x1ea1('0x50')]['id']){delete _0x20a195[_0x1ea1('0x50')]['id'];}return db[_0x1ea1('0x32')]['find']({'where':{'id':_0x20a195[_0x1ea1('0x49')]['id']}})['then'](handleEntityNotFound(_0x280229,null))[_0x1ea1('0x2b')](saveUpdates(_0x20a195[_0x1ea1('0x50')],null))[_0x1ea1('0x2b')](respondWithResult(_0x280229,null))[_0x1ea1('0x4e')](handleError(_0x280229,null));};exports[_0x1ea1('0x2a')]=function(_0x3671af,_0x3646ad){return db[_0x1ea1('0x32')][_0x1ea1('0x4d')]({'where':{'id':_0x3671af['params']['id']}})['then'](handleEntityNotFound(_0x3646ad,null))[_0x1ea1('0x2b')](removeEntity(_0x3646ad,null))[_0x1ea1('0x4e')](handleError(_0x3646ad,null));};exports[_0x1ea1('0x51')]=function(_0x570262,_0x56a7fb){return db['MailTransferReport']['describe']()[_0x1ea1('0x2b')](respondWithResult(_0x56a7fb,null))['catch'](handleError(_0x56a7fb,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 5714fa8..e1f75a1 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 _0x8251=['bluebird','path','rimraf','../../config/environment','exports','define','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x3e5fe4,_0x51c576){var _0x497f07=function(_0x4339a6){while(--_0x4339a6){_0x3e5fe4['push'](_0x3e5fe4['shift']());}};_0x497f07(++_0x51c576);}(_0x8251,0x1cf));var _0x1825=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8251[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x1825('0x0'));var util=require(_0x1825('0x1'));var logger=require(_0x1825('0x2'))(_0x1825('0x3'));var moment=require(_0x1825('0x4'));var BPromise=require(_0x1825('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1825('0x6'));var rimraf=require(_0x1825('0x7'));var config=require(_0x1825('0x8'));var attributes=require('./mailTransferReport.attributes');module[_0x1825('0x9')]=function(_0x3be5a3,_0x20c8a2){return _0x3be5a3[_0x1825('0xa')]('MailTransferReport',attributes,{'tableName':_0x1825('0xb'),'paranoid':![],'indexes':[{'name':_0x1825('0xc'),'fields':[_0x1825('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5977=['path','../../config/environment','exports','report_mail_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x127783,_0x258715){var _0x14f298=function(_0x32090e){while(--_0x32090e){_0x127783['push'](_0x127783['shift']());}};_0x14f298(++_0x258715);}(_0x5977,0xeb));var _0x7597=function(_0x570c8b,_0x1a69f1){_0x570c8b=_0x570c8b-0x0;var _0x4c9d7=_0x5977[_0x570c8b];return _0x4c9d7;};'use strict';var _=require(_0x7597('0x0'));var util=require(_0x7597('0x1'));var logger=require(_0x7597('0x2'))('api');var moment=require(_0x7597('0x3'));var BPromise=require(_0x7597('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7597('0x5'));var rimraf=require('rimraf');var config=require(_0x7597('0x6'));var attributes=require('./mailTransferReport.attributes');module[_0x7597('0x7')]=function(_0x3875e1,_0x5302c6){return _0x3875e1['define']('MailTransferReport',attributes,{'tableName':_0x7597('0x8'),'paranoid':![],'indexes':[{'name':_0x7597('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 156f3ec..4282493 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 _0x0af1=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x12a60d,_0x1f776b){var _0x4dabd2=function(_0x38ab3e){while(--_0x38ab3e){_0x12a60d['push'](_0x12a60d['shift']());}};_0x4dabd2(++_0x1f776b);}(_0x0af1,0x1a4));var _0x10af=function(_0x5d3db9,_0x5c654f){_0x5d3db9=_0x5d3db9-0x0;var _0x5691ca=_0x0af1[_0x5d3db9];return _0x5691ca;};'use strict';var _=require(_0x10af('0x0'));var util=require('util');var moment=require(_0x10af('0x1'));var BPromise=require(_0x10af('0x2'));var rs=require(_0x10af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x10af('0x4'))['db'];var utils=require(_0x10af('0x5'));var logger=require('../../config/logger')(_0x10af('0x6'));var config=require(_0x10af('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x10af('0x8')][_0x10af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50fdcc,_0x6d6432,_0x36f842){return new BPromise(function(_0x476fa0,_0x4c55b5){return client[_0x10af('0xa')](_0x50fdcc,_0x36f842)[_0x10af('0xb')](function(_0x112357){logger[_0x10af('0xc')](_0x10af('0xd'),_0x6d6432,_0x10af('0xe'));logger[_0x10af('0xf')](_0x10af('0x10'),_0x6d6432,_0x10af('0xe'),JSON[_0x10af('0x11')](_0x112357));if(_0x112357['error']){if(_0x112357[_0x10af('0x12')]['code']===0x1f4){logger[_0x10af('0x12')](_0x10af('0xd'),_0x6d6432,_0x112357[_0x10af('0x12')]['message']);return _0x4c55b5(_0x112357['error'][_0x10af('0x13')]);}logger['error'](_0x10af('0xd'),_0x6d6432,_0x112357[_0x10af('0x12')][_0x10af('0x13')]);return _0x476fa0(_0x112357['error'][_0x10af('0x13')]);}else{logger[_0x10af('0xc')](_0x10af('0xd'),_0x6d6432,'request\x20sent');_0x476fa0(_0x112357[_0x10af('0x14')][_0x10af('0x13')]);}})[_0x10af('0x15')](function(_0x378a73){logger[_0x10af('0x12')](_0x10af('0xd'),_0x6d6432,_0x378a73);_0x4c55b5(_0x378a73);});});} \ No newline at end of file +var _0x4906=['request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','MailTransferReport,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4906,0xda));var _0x6490=function(_0x3493aa,_0x24d21c){_0x3493aa=_0x3493aa-0x0;var _0x18aff5=_0x4906[_0x3493aa];return _0x18aff5;};'use strict';var _=require(_0x6490('0x0'));var util=require(_0x6490('0x1'));var moment=require(_0x6490('0x2'));var BPromise=require('bluebird');var rs=require(_0x6490('0x3'));var fs=require('fs');var Redis=require(_0x6490('0x4'));var db=require(_0x6490('0x5'))['db'];var utils=require(_0x6490('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6490('0x7'));var jayson=require(_0x6490('0x8'));var client=jayson[_0x6490('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e2fae,_0x2f1230,_0x5c76ed){return new BPromise(function(_0x241b6f,_0x539ad9){return client[_0x6490('0xa')](_0x4e2fae,_0x5c76ed)[_0x6490('0xb')](function(_0x505533){logger['info'](_0x6490('0xc'),_0x2f1230,_0x6490('0xd'));logger[_0x6490('0xe')](_0x6490('0xf'),_0x2f1230,_0x6490('0xd'),JSON['stringify'](_0x505533));if(_0x505533[_0x6490('0x10')]){if(_0x505533[_0x6490('0x10')]['code']===0x1f4){logger['error'](_0x6490('0xc'),_0x2f1230,_0x505533[_0x6490('0x10')][_0x6490('0x11')]);return _0x539ad9(_0x505533[_0x6490('0x10')][_0x6490('0x11')]);}logger[_0x6490('0x10')](_0x6490('0xc'),_0x2f1230,_0x505533[_0x6490('0x10')]['message']);return _0x241b6f(_0x505533[_0x6490('0x10')][_0x6490('0x11')]);}else{logger[_0x6490('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x2f1230,_0x6490('0xd'));_0x241b6f(_0x505533[_0x6490('0x13')]['message']);}})[_0x6490('0x14')](function(_0x445fe2){logger[_0x6490('0x10')](_0x6490('0xc'),_0x2f1230,_0x445fe2);_0x539ad9(_0x445fe2);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index e390e15..a793dcb 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 _0x9b81=['get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller'];(function(_0x485bcd,_0x124c22){var _0x411e9a=function(_0x34982b){while(--_0x34982b){_0x485bcd['push'](_0x485bcd['shift']());}};_0x411e9a(++_0x124c22);}(_0x9b81,0x76));var _0x19b8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9b81[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x19b8('0x0'));var util=require(_0x19b8('0x1'));var path=require(_0x19b8('0x2'));var timeout=require('connect-timeout');var express=require(_0x19b8('0x3'));var router=express['Router']();var fs_extra=require(_0x19b8('0x4'));var auth=require(_0x19b8('0x5'));var interaction=require(_0x19b8('0x6'));var config=require('../../config/environment');var controller=require(_0x19b8('0x7'));router[_0x19b8('0x8')]('/',auth['isAuthenticated'](),controller[_0x19b8('0x9')]);router['get'](_0x19b8('0xa'),auth[_0x19b8('0xb')](),controller['describe']);router[_0x19b8('0x8')](_0x19b8('0xc'),auth[_0x19b8('0xb')](),controller[_0x19b8('0xd')]);router[_0x19b8('0xe')]('/',auth[_0x19b8('0xb')](),controller[_0x19b8('0xf')]);router[_0x19b8('0x10')]('/:id',auth[_0x19b8('0xb')](),controller[_0x19b8('0x11')]);router[_0x19b8('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x19b8('0x13')]);module[_0x19b8('0x14')]=router; \ No newline at end of file +var _0x53ae=['express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x1c4fd7,_0x4cc31e){var _0x4b4e54=function(_0x593d06){while(--_0x593d06){_0x1c4fd7['push'](_0x1c4fd7['shift']());}};_0x4b4e54(++_0x4cc31e);}(_0x53ae,0x18d));var _0xe53a=function(_0x183fb8,_0x1a3918){_0x183fb8=_0x183fb8-0x0;var _0xa5d821=_0x53ae[_0x183fb8];return _0xa5d821;};'use strict';var multer=require(_0xe53a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe53a('0x1'));var express=require(_0xe53a('0x2'));var router=express['Router']();var fs_extra=require(_0xe53a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe53a('0x4'));var config=require(_0xe53a('0x5'));var controller=require('./memberReport.controller');router[_0xe53a('0x6')]('/',auth[_0xe53a('0x7')](),controller[_0xe53a('0x8')]);router[_0xe53a('0x6')](_0xe53a('0x9'),auth['isAuthenticated'](),controller[_0xe53a('0xa')]);router[_0xe53a('0x6')](_0xe53a('0xb'),auth[_0xe53a('0x7')](),controller['show']);router[_0xe53a('0xc')]('/',auth[_0xe53a('0x7')](),controller[_0xe53a('0xd')]);router[_0xe53a('0xe')](_0xe53a('0xb'),auth[_0xe53a('0x7')](),controller[_0xe53a('0xf')]);router[_0xe53a('0x10')]('/:id',auth[_0xe53a('0x7')](),controller[_0xe53a('0x11')]);module[_0xe53a('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 bb40407..914485e 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 _0x99de=['DATE','getDataValue','diff','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','sequelize','exports','STRING','DEFAULT\x20PAUSE','INTEGER'];(function(_0xb71076,_0x504a41){var _0x5dd6a6=function(_0x218a76){while(--_0x218a76){_0xb71076['push'](_0xb71076['shift']());}};_0x5dd6a6(++_0x504a41);}(_0x99de,0x8a));var _0xe99d=function(_0xbb14db,_0x3ee8c6){_0xbb14db=_0xbb14db-0x0;var _0x36bed7=_0x99de[_0xbb14db];return _0x36bed7;};'use strict';var Sequelize=require(_0xe99d('0x0'));var moment=require('moment');module[_0xe99d('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xe99d('0x2')]},'interface':{'type':Sequelize[_0xe99d('0x2')]},'type':{'type':Sequelize[_0xe99d('0x2')],'defaultValue':_0xe99d('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xe99d('0x4')]},'enterAt':{'type':Sequelize[_0xe99d('0x5')]},'exitAt':{'type':Sequelize[_0xe99d('0x5')],'set':function(_0x56c005){var _0x241d7f=moment(_0x56c005);var _0x243e47=moment(this[_0xe99d('0x6')]('enterAt'));var _0x124b20=_0x241d7f[_0xe99d('0x7')](_0x243e47,'seconds');this[_0xe99d('0x8')](_0xe99d('0x9'),_0x56c005);this[_0xe99d('0x8')]('duration',_0x124b20>=0x0?_0x124b20:null);}},'data1':{'type':Sequelize[_0xe99d('0x2')],'comment':_0xe99d('0xa')},'data2':{'type':Sequelize[_0xe99d('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xe99d('0x2')],'comment':_0xe99d('0xb')},'data4':{'type':Sequelize['STRING'],'comment':_0xe99d('0xc')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xe99d('0x2')]},'internal':{'type':Sequelize[_0xe99d('0x4')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7345=['enterAt','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue'];(function(_0x124c75,_0x332013){var _0x5c5471=function(_0x2fd3eb){while(--_0x2fd3eb){_0x124c75['push'](_0x124c75['shift']());}};_0x5c5471(++_0x332013);}(_0x7345,0x1ba));var _0x5734=function(_0x44b04e,_0x3bbf02){_0x44b04e=_0x44b04e-0x0;var _0x1cb884=_0x7345[_0x44b04e];return _0x1cb884;};'use strict';var Sequelize=require(_0x5734('0x0'));var moment=require(_0x5734('0x1'));module[_0x5734('0x2')]={'channel':{'type':Sequelize[_0x5734('0x3')]},'membername':{'type':Sequelize[_0x5734('0x3')]},'interface':{'type':Sequelize[_0x5734('0x3')]},'type':{'type':Sequelize[_0x5734('0x3')],'defaultValue':_0x5734('0x4'),'comment':_0x5734('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x5734('0x6')]},'exitAt':{'type':Sequelize[_0x5734('0x6')],'set':function(_0x1c7072){var _0x5c220a=moment(_0x1c7072);var _0xec897d=moment(this[_0x5734('0x7')](_0x5734('0x8')));var _0x30a17b=_0x5c220a['diff'](_0xec897d,_0x5734('0x9'));this[_0x5734('0xa')](_0x5734('0xb'),_0x1c7072);this[_0x5734('0xa')](_0x5734('0xc'),_0x30a17b>=0x0?_0x30a17b:null);}},'data1':{'type':Sequelize[_0x5734('0x3')],'comment':_0x5734('0xd')},'data2':{'type':Sequelize[_0x5734('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x5734('0x3')],'comment':_0x5734('0xe')},'data4':{'type':Sequelize[_0x5734('0x3')],'comment':_0x5734('0xf')},'data5':{'type':Sequelize[_0x5734('0x3')],'comment':_0x5734('0x10')},'role':{'type':Sequelize[_0x5734('0x3')]},'internal':{'type':Sequelize[_0x5734('0x11')]},'uniqueid':{'type':Sequelize[_0x5734('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index aa187ee..838654d 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 _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x2ced53,_0x2b613a){var _0x51d8bc=function(_0xc4daf7){while(--_0xc4daf7){_0x2ced53['push'](_0x2ced53['shift']());}};_0x51d8bc(++_0x2b613a);}(_0x3e74,0x175));var _0x43e7=function(_0x46eeaa,_0x1690f2){_0x46eeaa=_0x46eeaa-0x0;var _0x4a6992=_0x3e74[_0x46eeaa];return _0x4a6992;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x595154,_0x89e3ed){var _0x4ad97a=function(_0x1643d3){while(--_0x1643d3){_0x595154['push'](_0x595154['shift']());}};_0x4ad97a(++_0x89e3ed);}(_0x3e74,0x175));var _0x43e7=function(_0x3d270e,_0xf196f1){_0x3d270e=_0x3d270e-0x0;var _0x131496=_0x3e74[_0x3d270e];return _0x131496;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 87d306c..2628bc3 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 _0xcb1c=['rimraf','./memberReport.attributes','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x81725b,_0x392b58){var _0x521261=function(_0x3ec883){while(--_0x3ec883){_0x81725b['push'](_0x81725b['shift']());}};_0x521261(++_0x392b58);}(_0xcb1c,0x17e));var _0xccb1=function(_0x36b29a,_0x57550e){_0x36b29a=_0x36b29a-0x0;var _0x259807=_0xcb1c[_0x36b29a];return _0x259807;};'use strict';var _=require(_0xccb1('0x0'));var util=require(_0xccb1('0x1'));var logger=require(_0xccb1('0x2'))(_0xccb1('0x3'));var moment=require(_0xccb1('0x4'));var BPromise=require(_0xccb1('0x5'));var rp=require(_0xccb1('0x6'));var fs=require('fs');var path=require(_0xccb1('0x7'));var rimraf=require(_0xccb1('0x8'));var config=require('../../config/environment');var attributes=require(_0xccb1('0x9'));module['exports']=function(_0x27d30c,_0x1e3360){return _0x27d30c['define'](_0xccb1('0xa'),attributes,{'tableName':_0xccb1('0xb'),'paranoid':![],'indexes':[{'name':_0xccb1('0xc'),'fields':[_0xccb1('0xd'),_0xccb1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xebf4=['exports','membername','interface','lodash','moment','bluebird','path','rimraf'];(function(_0x1751f1,_0xcbc4e9){var _0x198340=function(_0xa4c816){while(--_0xa4c816){_0x1751f1['push'](_0x1751f1['shift']());}};_0x198340(++_0xcbc4e9);}(_0xebf4,0xe3));var _0x4ebf=function(_0x7e64ae,_0xe3f464){_0x7e64ae=_0x7e64ae-0x0;var _0x1390ac=_0xebf4[_0x7e64ae];return _0x1390ac;};'use strict';var _=require(_0x4ebf('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4ebf('0x1'));var BPromise=require(_0x4ebf('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ebf('0x3'));var rimraf=require(_0x4ebf('0x4'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0x4ebf('0x5')]=function(_0x557e84,_0x32f022){return _0x557e84['define']('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x4ebf('0x6'),_0x4ebf('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 5fdcc2c..d3fe142 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 _0x720b=['client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','map','include','model','CreateMemberReport','create','body','update','UpdateMemberReport','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x720b,0x1d8));var _0xb720=function(_0x16108c,_0x43fdbe){_0x16108c=_0x16108c-0x0;var _0xdc8b8=_0x720b[_0x16108c];return _0xdc8b8;};'use strict';var _=require(_0xb720('0x0'));var util=require(_0xb720('0x1'));var moment=require(_0xb720('0x2'));var BPromise=require('bluebird');var rs=require(_0xb720('0x3'));var fs=require('fs');var Redis=require(_0xb720('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb720('0x5'));var logger=require(_0xb720('0x6'))(_0xb720('0x7'));var config=require('../../config/environment');var jayson=require(_0xb720('0x8'));var client=jayson[_0xb720('0x9')][_0xb720('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19d0ba,_0x2b319a,_0x4c327c){return new BPromise(function(_0x5a97b8,_0x259266){return client[_0xb720('0xb')](_0x19d0ba,_0x4c327c)[_0xb720('0xc')](function(_0x16fbb0){logger[_0xb720('0xd')](_0xb720('0xe'),_0x2b319a,_0xb720('0xf'));logger[_0xb720('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x2b319a,_0xb720('0xf'),JSON[_0xb720('0x11')](_0x16fbb0));if(_0x16fbb0['error']){if(_0x16fbb0[_0xb720('0x12')]['code']===0x1f4){logger[_0xb720('0x12')]('MemberReport,\x20%s,\x20%s',_0x2b319a,_0x16fbb0[_0xb720('0x12')][_0xb720('0x13')]);return _0x259266(_0x16fbb0[_0xb720('0x12')][_0xb720('0x13')]);}logger[_0xb720('0x12')](_0xb720('0xe'),_0x2b319a,_0x16fbb0[_0xb720('0x12')][_0xb720('0x13')]);return _0x5a97b8(_0x16fbb0['error'][_0xb720('0x13')]);}else{logger[_0xb720('0xd')](_0xb720('0xe'),_0x2b319a,'request\x20sent');_0x5a97b8(_0x16fbb0['result'][_0xb720('0x13')]);}})[_0xb720('0x14')](function(_0x373303){logger['error'](_0xb720('0xe'),_0x2b319a,_0x373303);_0x259266(_0x373303);});});}exports[_0xb720('0x15')]=function(_0x453c43){var _0x2cf456=this;return new Promise(function(_0x395d6a,_0x730e0f){return db[_0xb720('0x16')][_0xb720('0x17')]({'raw':_0x453c43[_0xb720('0x18')]?_0x453c43[_0xb720('0x18')][_0xb720('0x19')]===undefined?!![]:![]:!![],'where':_0x453c43[_0xb720('0x18')]?_0x453c43[_0xb720('0x18')][_0xb720('0x1a')]||null:null,'attributes':_0x453c43[_0xb720('0x18')]?_0x453c43[_0xb720('0x18')][_0xb720('0x1b')]||null:null,'limit':_0x453c43[_0xb720('0x18')]?_0x453c43[_0xb720('0x18')][_0xb720('0x1c')]||null:null,'include':_0x453c43['options']?_0x453c43['options']['include']?_[_0xb720('0x1d')](_0x453c43['options'][_0xb720('0x1e')],function(_0x20bec1){return{'model':db[_0x20bec1[_0xb720('0x1f')]],'as':_0x20bec1['as'],'attributes':_0x20bec1[_0xb720('0x1b')],'include':_0x20bec1[_0xb720('0x1e')]?_[_0xb720('0x1d')](_0x20bec1['include'],function(_0x498860){return{'model':db[_0x498860['model']],'as':_0x498860['as'],'attributes':_0x498860[_0xb720('0x1b')],'include':_0x498860[_0xb720('0x1e')]?_['map'](_0x498860['include'],function(_0x1c3805){return{'model':db[_0x1c3805['model']],'as':_0x1c3805['as'],'attributes':_0x1c3805[_0xb720('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e436f){logger[_0xb720('0xd')](_0xb720('0x15'),_0x453c43);logger[_0xb720('0x10')](_0xb720('0x15'),_0x453c43,JSON[_0xb720('0x11')](_0x4e436f));_0x395d6a(_0x4e436f);})[_0xb720('0x14')](function(_0x732423){logger[_0xb720('0x12')]('GetMemberReport',_0x732423['message'],_0x453c43);_0x730e0f(_0x2cf456['error'](0x1f4,_0x732423[_0xb720('0x13')]));});});};exports[_0xb720('0x20')]=function(_0x49b6ae){var _0x1f7979=this;return new Promise(function(_0x558bbe,_0x2b6445){return db[_0xb720('0x16')][_0xb720('0x21')](_0x49b6ae[_0xb720('0x22')],{'raw':_0x49b6ae[_0xb720('0x18')]?_0x49b6ae[_0xb720('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xb720('0xc')](function(_0x40752a){logger[_0xb720('0xd')]('CreateMemberReport',_0x49b6ae);logger[_0xb720('0x10')](_0xb720('0x20'),_0x49b6ae,JSON['stringify'](_0x40752a));_0x558bbe(_0x40752a);})['catch'](function(_0x29e540){logger['error'](_0xb720('0x20'),_0x29e540[_0xb720('0x13')],_0x49b6ae);_0x2b6445(_0x1f7979[_0xb720('0x12')](0x1f4,_0x29e540[_0xb720('0x13')]));});});};exports['UpdateMemberReport']=function(_0x591b0e){var _0x259a71=this;return new Promise(function(_0x9d5954,_0x21e561){return db[_0xb720('0x16')][_0xb720('0x23')](_0x591b0e['body'],{'raw':_0x591b0e['options']?_0x591b0e[_0xb720('0x18')][_0xb720('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x591b0e[_0xb720('0x18')]?_0x591b0e[_0xb720('0x18')][_0xb720('0x1a')]||null:null,'attributes':_0x591b0e[_0xb720('0x18')]?_0x591b0e[_0xb720('0x18')][_0xb720('0x1b')]||null:null,'limit':_0x591b0e[_0xb720('0x18')]?_0x591b0e['options']['limit']||null:null})[_0xb720('0xc')](function(_0x221d39){logger[_0xb720('0xd')](_0xb720('0x24'),_0x591b0e);logger[_0xb720('0x10')](_0xb720('0x24'),_0x591b0e,JSON[_0xb720('0x11')](_0x221d39));_0x9d5954(_0x221d39);})[_0xb720('0x14')](function(_0xad5038){logger[_0xb720('0x12')](_0xb720('0x24'),_0xad5038[_0xb720('0x13')],_0x591b0e);_0x21e561(_0x259a71[_0xb720('0x12')](0x1f4,_0xad5038[_0xb720('0x13')]));});});}; \ No newline at end of file +var _0x687b=['limit','include','map','model','CreateMemberReport','create','body','raw','update','UpdateMemberReport','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','where','attributes'];(function(_0x9e9c31,_0xbcd6a2){var _0x1f21a8=function(_0x3c8cd8){while(--_0x3c8cd8){_0x9e9c31['push'](_0x9e9c31['shift']());}};_0x1f21a8(++_0xbcd6a2);}(_0x687b,0x14a));var _0xb687=function(_0x92b4dc,_0x20f18a){_0x92b4dc=_0x92b4dc-0x0;var _0xe68d92=_0x687b[_0x92b4dc];return _0xe68d92;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});}exports[_0xb687('0x18')]=function(_0x30d370){var _0x5eb9b9=this;return new Promise(function(_0x48958d,_0x12eff1){return db[_0xb687('0x19')][_0xb687('0x1a')]({'raw':_0x30d370['options']?_0x30d370[_0xb687('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x30d370[_0xb687('0x1b')]?_0x30d370[_0xb687('0x1b')][_0xb687('0x1c')]||null:null,'attributes':_0x30d370[_0xb687('0x1b')]?_0x30d370['options'][_0xb687('0x1d')]||null:null,'limit':_0x30d370['options']?_0x30d370[_0xb687('0x1b')][_0xb687('0x1e')]||null:null,'include':_0x30d370[_0xb687('0x1b')]?_0x30d370['options'][_0xb687('0x1f')]?_[_0xb687('0x20')](_0x30d370[_0xb687('0x1b')][_0xb687('0x1f')],function(_0xbf6c58){return{'model':db[_0xbf6c58[_0xb687('0x21')]],'as':_0xbf6c58['as'],'attributes':_0xbf6c58[_0xb687('0x1d')],'include':_0xbf6c58[_0xb687('0x1f')]?_['map'](_0xbf6c58[_0xb687('0x1f')],function(_0x129347){return{'model':db[_0x129347[_0xb687('0x21')]],'as':_0x129347['as'],'attributes':_0x129347[_0xb687('0x1d')],'include':_0x129347[_0xb687('0x1f')]?_[_0xb687('0x20')](_0x129347[_0xb687('0x1f')],function(_0x3cb2f2){return{'model':db[_0x3cb2f2[_0xb687('0x21')]],'as':_0x3cb2f2['as'],'attributes':_0x3cb2f2[_0xb687('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3712cf){logger[_0xb687('0xd')](_0xb687('0x18'),_0x30d370);logger[_0xb687('0x10')](_0xb687('0x18'),_0x30d370,JSON[_0xb687('0x12')](_0x3712cf));_0x48958d(_0x3712cf);})['catch'](function(_0x28b69a){logger['error'](_0xb687('0x18'),_0x28b69a[_0xb687('0x15')],_0x30d370);_0x12eff1(_0x5eb9b9[_0xb687('0x13')](0x1f4,_0x28b69a[_0xb687('0x15')]));});});};exports[_0xb687('0x22')]=function(_0x43d20d){var _0xf1f0dd=this;return new Promise(function(_0x556815,_0x3da2be){return db[_0xb687('0x19')][_0xb687('0x23')](_0x43d20d[_0xb687('0x24')],{'raw':_0x43d20d[_0xb687('0x1b')]?_0x43d20d[_0xb687('0x1b')][_0xb687('0x25')]===undefined?!![]:![]:!![]})[_0xb687('0xc')](function(_0x3551df){logger[_0xb687('0xd')](_0xb687('0x22'),_0x43d20d);logger['debug']('CreateMemberReport',_0x43d20d,JSON[_0xb687('0x12')](_0x3551df));_0x556815(_0x3551df);})[_0xb687('0x17')](function(_0x24c418){logger[_0xb687('0x13')]('CreateMemberReport',_0x24c418['message'],_0x43d20d);_0x3da2be(_0xf1f0dd[_0xb687('0x13')](0x1f4,_0x24c418[_0xb687('0x15')]));});});};exports['UpdateMemberReport']=function(_0x23dc96){var _0x449074=this;return new Promise(function(_0x548b83,_0x387448){return db['MemberReport'][_0xb687('0x26')](_0x23dc96[_0xb687('0x24')],{'raw':_0x23dc96[_0xb687('0x1b')]?_0x23dc96[_0xb687('0x1b')][_0xb687('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23dc96[_0xb687('0x1b')]?_0x23dc96['options'][_0xb687('0x1c')]||null:null,'attributes':_0x23dc96[_0xb687('0x1b')]?_0x23dc96[_0xb687('0x1b')][_0xb687('0x1d')]||null:null,'limit':_0x23dc96['options']?_0x23dc96[_0xb687('0x1b')][_0xb687('0x1e')]||null:null})[_0xb687('0xc')](function(_0xce9624){logger[_0xb687('0xd')]('UpdateMemberReport',_0x23dc96);logger[_0xb687('0x10')](_0xb687('0x27'),_0x23dc96,JSON[_0xb687('0x12')](_0xce9624));_0x548b83(_0xce9624);})[_0xb687('0x17')](function(_0x24b785){logger[_0xb687('0x13')]('UpdateMemberReport',_0x24b785['message'],_0x23dc96);_0x387448(_0x449074[_0xb687('0x13')](0x1f4,_0x24b785['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index d252ef0..d81c037 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 _0xd406=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index','exports'];(function(_0x219235,_0x257431){var _0x57c3d1=function(_0x550a39){while(--_0x550a39){_0x219235['push'](_0x219235['shift']());}};_0x57c3d1(++_0x257431);}(_0xd406,0x90));var _0x6d40=function(_0x349a17,_0x258d81){_0x349a17=_0x349a17-0x0;var _0x52d662=_0xd406[_0x349a17];return _0x52d662;};'use strict';var multer=require(_0x6d40('0x0'));var util=require(_0x6d40('0x1'));var path=require(_0x6d40('0x2'));var timeout=require('connect-timeout');var express=require(_0x6d40('0x3'));var router=express[_0x6d40('0x4')]();var fs_extra=require(_0x6d40('0x5'));var auth=require(_0x6d40('0x6'));var interaction=require(_0x6d40('0x7'));var config=require('../../config/environment');var controller=require(_0x6d40('0x8'));router[_0x6d40('0x9')]('/',controller[_0x6d40('0xa')]);module[_0x6d40('0xb')]=router; \ No newline at end of file +var _0x8c79=['multer','express','fs-extra','../../components/auth/service','../../config/environment','exports'];(function(_0x54b062,_0x264bb5){var _0x255e41=function(_0x3c7e6f){while(--_0x3c7e6f){_0x54b062['push'](_0x54b062['shift']());}};_0x255e41(++_0x264bb5);}(_0x8c79,0xa8));var _0x98c7=function(_0x37870d,_0x356e02){_0x37870d=_0x37870d-0x0;var _0x1ae695=_0x8c79[_0x37870d];return _0x1ae695;};'use strict';var multer=require(_0x98c7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x98c7('0x1'));var router=express['Router']();var fs_extra=require(_0x98c7('0x2'));var auth=require(_0x98c7('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x98c7('0x4'));var controller=require('./migration.controller');router['get']('/',controller['index']);module[_0x98c7('0x5')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 91d9665..9ed7720 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 _0xb0ae=['version','exports','STRING'];(function(_0x15f22a,_0x447960){var _0x45360a=function(_0x469eb8){while(--_0x469eb8){_0x15f22a['push'](_0x15f22a['shift']());}};_0x45360a(++_0x447960);}(_0xb0ae,0x181));var _0xeb0a=function(_0x3ece4f,_0x2568d0){_0x3ece4f=_0x3ece4f-0x0;var _0x2aaff4=_0xb0ae[_0x3ece4f];return _0x2aaff4;};'use strict';var Sequelize=require('sequelize');module[_0xeb0a('0x0')]={'version':{'type':Sequelize[_0xeb0a('0x1')],'unique':_0xeb0a('0x2')}}; \ No newline at end of file +var _0x5cc9=['exports','STRING','version'];(function(_0x49c57b,_0x5bface){var _0x34a689=function(_0x657741){while(--_0x657741){_0x49c57b['push'](_0x49c57b['shift']());}};_0x34a689(++_0x5bface);}(_0x5cc9,0xf9));var _0x95cc=function(_0x3be144,_0x4705cc){_0x3be144=_0x3be144-0x0;var _0x58e325=_0x5cc9[_0x3be144];return _0x58e325;};'use strict';var Sequelize=require('sequelize');module[_0x95cc('0x0')]={'version':{'type':Sequelize[_0x95cc('0x1')],'unique':_0x95cc('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index c57ed16..2f39454 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 _0xbfb7=['count','set','Content-Range','apply','update','then','destroy','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','Migration','includeAll','include','findAll','rows','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbfb7,0xf4));var _0x7bfb=function(_0x2375e1,_0x3d125a){_0x2375e1=_0x2375e1-0x0;var _0x2ccc7d=_0xbfb7[_0x2375e1];return _0x2ccc7d;};'use strict';var emlformat=require(_0x7bfb('0x0'));var rimraf=require(_0x7bfb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7bfb('0x2'));var rp=require(_0x7bfb('0x3'));var moment=require(_0x7bfb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7bfb('0x5'));var util=require(_0x7bfb('0x6'));var path=require('path');var sox=require(_0x7bfb('0x7'));var csv=require(_0x7bfb('0x8'));var ejs=require(_0x7bfb('0x9'));var fs=require('fs');var fs_extra=require(_0x7bfb('0xa'));var _=require(_0x7bfb('0xb'));var squel=require(_0x7bfb('0xc'));var crypto=require(_0x7bfb('0xd'));var jsforce=require(_0x7bfb('0xe'));var deskjs=require(_0x7bfb('0xf'));var toCsv=require(_0x7bfb('0x8'));var querystring=require(_0x7bfb('0x10'));var Papa=require(_0x7bfb('0x11'));var Redis=require(_0x7bfb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7bfb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7bfb('0x14'))(_0x7bfb('0x15'));var utils=require(_0x7bfb('0x16'));var config=require(_0x7bfb('0x17'));var licenseUtil=require(_0x7bfb('0x18'));var db=require(_0x7bfb('0x19'))['db'];function respondWithStatusCode(_0x35d96a,_0x1109e6){_0x1109e6=_0x1109e6||0xcc;return function(_0xd892af){if(_0xd892af){return _0x35d96a[_0x7bfb('0x1a')](_0x1109e6);}return _0x35d96a[_0x7bfb('0x1b')](_0x1109e6)[_0x7bfb('0x1c')]();};}function respondWithResult(_0x2e70aa,_0xb4db20){_0xb4db20=_0xb4db20||0xc8;return function(_0x2ac19f){if(_0x2ac19f){return _0x2e70aa[_0x7bfb('0x1b')](_0xb4db20)[_0x7bfb('0x1d')](_0x2ac19f);}};}function respondWithFilteredResult(_0x2cc929,_0xc43f8d){return function(_0x4a03f1){if(_0x4a03f1){var _0x3e5152=typeof _0xc43f8d[_0x7bfb('0x1e')]==='undefined'&&typeof _0xc43f8d[_0x7bfb('0x1f')]==='undefined';var _0x5e15f5=_0x4a03f1[_0x7bfb('0x20')];var _0x52f36b=_0x3e5152?0x0:_0xc43f8d[_0x7bfb('0x1e')];var _0x522370=_0x3e5152?_0x4a03f1[_0x7bfb('0x20')]:_0xc43f8d[_0x7bfb('0x1e')]+_0xc43f8d['limit'];var _0x4a73b3;if(_0x522370>=_0x5e15f5){_0x522370=_0x5e15f5;_0x4a73b3=0xc8;}else{_0x4a73b3=0xce;}_0x2cc929[_0x7bfb('0x1b')](_0x4a73b3);return _0x2cc929[_0x7bfb('0x21')](_0x7bfb('0x22'),_0x52f36b+'-'+_0x522370+'/'+_0x5e15f5)[_0x7bfb('0x1d')](_0x4a03f1);}return null;};}function patchUpdates(_0x24302a){return function(_0xfe6f6e){try{jsonpatch[_0x7bfb('0x23')](_0xfe6f6e,_0x24302a,!![]);}catch(_0x2104b4){return BPromise['reject'](_0x2104b4);}return _0xfe6f6e['save']();};}function saveUpdates(_0x1b85f2,_0x5035bb){return function(_0x37649e){if(_0x37649e){return _0x37649e[_0x7bfb('0x24')](_0x1b85f2)[_0x7bfb('0x25')](function(_0x35c4b6){return _0x35c4b6;});}return null;};}function removeEntity(_0x52e581,_0x4bfc51){return function(_0xb25565){if(_0xb25565){return _0xb25565[_0x7bfb('0x26')]()[_0x7bfb('0x25')](function(){_0x52e581['status'](0xcc)[_0x7bfb('0x1c')]();});}};}function handleEntityNotFound(_0x191e9c,_0x75f345){return function(_0x240cc8){if(!_0x240cc8){_0x191e9c[_0x7bfb('0x1a')](0x194);}return _0x240cc8;};}function handleError(_0x4e1a04,_0xb2c31c){_0xb2c31c=_0xb2c31c||0x1f4;return function(_0x289ced){logger['error'](_0x289ced[_0x7bfb('0x27')]);if(_0x289ced[_0x7bfb('0x28')]){delete _0x289ced[_0x7bfb('0x28')];}_0x4e1a04[_0x7bfb('0x1b')](_0xb2c31c)[_0x7bfb('0x29')](_0x289ced);};}exports[_0x7bfb('0x2a')]=function(_0x15464c,_0x26d662){var _0x5c4282={},_0x3efe86={},_0x316aca={'count':0x0,'rows':[]};var _0x14edcf=_[_0x7bfb('0x2b')](db['Migration']['rawAttributes'],function(_0xf16002){return{'name':_0xf16002[_0x7bfb('0x2c')],'type':_0xf16002[_0x7bfb('0x2d')][_0x7bfb('0x2e')]};});_0x3efe86['model']=_[_0x7bfb('0x2b')](_0x14edcf,'name');_0x3efe86[_0x7bfb('0x2f')]=_[_0x7bfb('0x30')](_0x15464c['query']);_0x3efe86[_0x7bfb('0x31')]=_[_0x7bfb('0x32')](_0x3efe86['model'],_0x3efe86['query']);_0x5c4282[_0x7bfb('0x33')]=_['intersection'](_0x3efe86[_0x7bfb('0x34')],qs['fields'](_0x15464c['query'][_0x7bfb('0x35')]));_0x5c4282[_0x7bfb('0x33')]=_0x5c4282['attributes'][_0x7bfb('0x36')]?_0x5c4282[_0x7bfb('0x33')]:_0x3efe86[_0x7bfb('0x34')];if(!_0x15464c[_0x7bfb('0x2f')][_0x7bfb('0x37')]('nolimit')){_0x5c4282[_0x7bfb('0x1f')]=qs[_0x7bfb('0x1f')](_0x15464c[_0x7bfb('0x2f')]['limit']);_0x5c4282['offset']=qs[_0x7bfb('0x1e')](_0x15464c[_0x7bfb('0x2f')]['offset']);}_0x5c4282[_0x7bfb('0x38')]=qs[_0x7bfb('0x39')](_0x15464c['query'][_0x7bfb('0x39')]);_0x5c4282[_0x7bfb('0x3a')]=qs[_0x7bfb('0x31')](_['pick'](_0x15464c['query'],_0x3efe86[_0x7bfb('0x31')]),_0x14edcf);if(_0x15464c[_0x7bfb('0x2f')][_0x7bfb('0x3b')]){_0x5c4282['where']=_[_0x7bfb('0x3c')](_0x5c4282[_0x7bfb('0x3a')],{'$or':_[_0x7bfb('0x2b')](_0x14edcf,function(_0xc2c801){if(_0xc2c801[_0x7bfb('0x2d')]!==_0x7bfb('0x3d')){var _0x5b8f16={};_0x5b8f16[_0xc2c801[_0x7bfb('0x28')]]={'$like':'%'+_0x15464c[_0x7bfb('0x2f')][_0x7bfb('0x3b')]+'%'};return _0x5b8f16;}})});}_0x5c4282=_[_0x7bfb('0x3c')]({},_0x5c4282,_0x15464c[_0x7bfb('0x3e')]);var _0x5d9932={'where':_0x5c4282['where']};return db[_0x7bfb('0x3f')][_0x7bfb('0x20')](_0x5d9932)[_0x7bfb('0x25')](function(_0x25aa75){_0x316aca[_0x7bfb('0x20')]=_0x25aa75;if(_0x15464c[_0x7bfb('0x2f')][_0x7bfb('0x40')]){_0x5c4282[_0x7bfb('0x41')]=[{'all':!![]}];}return db[_0x7bfb('0x3f')][_0x7bfb('0x42')](_0x5c4282);})['then'](function(_0xab5974){_0x316aca[_0x7bfb('0x43')]=_0xab5974;return _0x316aca;})[_0x7bfb('0x25')](respondWithFilteredResult(_0x26d662,_0x5c4282))[_0x7bfb('0x44')](handleError(_0x26d662,null));}; \ No newline at end of file +var _0x0c9d=['request-promise','mustache','util','path','ejs','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','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','eml-format','zip-dir','fast-json-patch'];(function(_0x36bd17,_0x2f7a84){var _0xeff03c=function(_0x1b391d){while(--_0x1b391d){_0x36bd17['push'](_0x36bd17['shift']());}};_0xeff03c(++_0x2f7a84);}(_0x0c9d,0x1ad));var _0xd0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd0c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd0c9('0x1'));var jsonpatch=require(_0xd0c9('0x2'));var rp=require(_0xd0c9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd0c9('0x4'));var util=require(_0xd0c9('0x5'));var path=require(_0xd0c9('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd0c9('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd0c9('0x8'));var squel=require(_0xd0c9('0x9'));var crypto=require('crypto');var jsforce=require(_0xd0c9('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd0c9('0xb'));var Papa=require(_0xd0c9('0xc'));var Redis=require(_0xd0c9('0xd'));var authService=require(_0xd0c9('0xe'));var qs=require(_0xd0c9('0xf'));var as=require(_0xd0c9('0x10'));var hardwareService=require(_0xd0c9('0x11'));var logger=require(_0xd0c9('0x12'))(_0xd0c9('0x13'));var utils=require(_0xd0c9('0x14'));var config=require(_0xd0c9('0x15'));var licenseUtil=require(_0xd0c9('0x16'));var db=require(_0xd0c9('0x17'))['db'];function respondWithStatusCode(_0x3a1946,_0x59912f){_0x59912f=_0x59912f||0xcc;return function(_0x320ef4){if(_0x320ef4){return _0x3a1946[_0xd0c9('0x18')](_0x59912f);}return _0x3a1946[_0xd0c9('0x19')](_0x59912f)['end']();};}function respondWithResult(_0x4e15bf,_0x380d07){_0x380d07=_0x380d07||0xc8;return function(_0x334e0e){if(_0x334e0e){return _0x4e15bf[_0xd0c9('0x19')](_0x380d07)['json'](_0x334e0e);}};}function respondWithFilteredResult(_0x3cb7de,_0x428254){return function(_0x1e71b8){if(_0x1e71b8){var _0x2b475e=typeof _0x428254['offset']===_0xd0c9('0x1a')&&typeof _0x428254[_0xd0c9('0x1b')]===_0xd0c9('0x1a');var _0x4d64fa=_0x1e71b8[_0xd0c9('0x1c')];var _0xe06cbe=_0x2b475e?0x0:_0x428254['offset'];var _0x12b21e=_0x2b475e?_0x1e71b8['count']:_0x428254[_0xd0c9('0x1d')]+_0x428254[_0xd0c9('0x1b')];var _0x3c4ade;if(_0x12b21e>=_0x4d64fa){_0x12b21e=_0x4d64fa;_0x3c4ade=0xc8;}else{_0x3c4ade=0xce;}_0x3cb7de[_0xd0c9('0x19')](_0x3c4ade);return _0x3cb7de[_0xd0c9('0x1e')](_0xd0c9('0x1f'),_0xe06cbe+'-'+_0x12b21e+'/'+_0x4d64fa)[_0xd0c9('0x20')](_0x1e71b8);}return null;};}function patchUpdates(_0x8d857d){return function(_0x52cfa8){try{jsonpatch[_0xd0c9('0x21')](_0x52cfa8,_0x8d857d,!![]);}catch(_0xa446a7){return BPromise[_0xd0c9('0x22')](_0xa446a7);}return _0x52cfa8[_0xd0c9('0x23')]();};}function saveUpdates(_0x53eea0,_0x5e0097){return function(_0x59aec0){if(_0x59aec0){return _0x59aec0[_0xd0c9('0x24')](_0x53eea0)[_0xd0c9('0x25')](function(_0xcd5083){return _0xcd5083;});}return null;};}function removeEntity(_0x49167a,_0x2dbf34){return function(_0x4324c8){if(_0x4324c8){return _0x4324c8[_0xd0c9('0x26')]()[_0xd0c9('0x25')](function(){_0x49167a[_0xd0c9('0x19')](0xcc)[_0xd0c9('0x27')]();});}};}function handleEntityNotFound(_0xba9c3d,_0x463b83){return function(_0x4c3f55){if(!_0x4c3f55){_0xba9c3d[_0xd0c9('0x18')](0x194);}return _0x4c3f55;};}function handleError(_0x1ab16f,_0x19f767){_0x19f767=_0x19f767||0x1f4;return function(_0x1e6de4){logger[_0xd0c9('0x28')](_0x1e6de4[_0xd0c9('0x29')]);if(_0x1e6de4[_0xd0c9('0x2a')]){delete _0x1e6de4[_0xd0c9('0x2a')];}_0x1ab16f[_0xd0c9('0x19')](_0x19f767)[_0xd0c9('0x2b')](_0x1e6de4);};}exports[_0xd0c9('0x2c')]=function(_0x17c2cb,_0x7990a8){var _0x83eace={},_0x27b03d={},_0x2459ac={'count':0x0,'rows':[]};var _0x2da111=_[_0xd0c9('0x2d')](db[_0xd0c9('0x2e')][_0xd0c9('0x2f')],function(_0x1a5d80){return{'name':_0x1a5d80[_0xd0c9('0x30')],'type':_0x1a5d80[_0xd0c9('0x31')][_0xd0c9('0x32')]};});_0x27b03d[_0xd0c9('0x33')]=_['map'](_0x2da111,_0xd0c9('0x2a'));_0x27b03d[_0xd0c9('0x34')]=_[_0xd0c9('0x35')](_0x17c2cb[_0xd0c9('0x34')]);_0x27b03d['filters']=_['intersection'](_0x27b03d[_0xd0c9('0x33')],_0x27b03d[_0xd0c9('0x34')]);_0x83eace[_0xd0c9('0x36')]=_[_0xd0c9('0x37')](_0x27b03d[_0xd0c9('0x33')],qs[_0xd0c9('0x38')](_0x17c2cb['query'][_0xd0c9('0x38')]));_0x83eace[_0xd0c9('0x36')]=_0x83eace[_0xd0c9('0x36')][_0xd0c9('0x39')]?_0x83eace[_0xd0c9('0x36')]:_0x27b03d[_0xd0c9('0x33')];if(!_0x17c2cb[_0xd0c9('0x34')][_0xd0c9('0x3a')](_0xd0c9('0x3b'))){_0x83eace['limit']=qs[_0xd0c9('0x1b')](_0x17c2cb[_0xd0c9('0x34')][_0xd0c9('0x1b')]);_0x83eace[_0xd0c9('0x1d')]=qs[_0xd0c9('0x1d')](_0x17c2cb['query'][_0xd0c9('0x1d')]);}_0x83eace[_0xd0c9('0x3c')]=qs[_0xd0c9('0x3d')](_0x17c2cb[_0xd0c9('0x34')][_0xd0c9('0x3d')]);_0x83eace[_0xd0c9('0x3e')]=qs[_0xd0c9('0x3f')](_[_0xd0c9('0x40')](_0x17c2cb[_0xd0c9('0x34')],_0x27b03d[_0xd0c9('0x3f')]),_0x2da111);if(_0x17c2cb[_0xd0c9('0x34')][_0xd0c9('0x41')]){_0x83eace[_0xd0c9('0x3e')]=_[_0xd0c9('0x42')](_0x83eace[_0xd0c9('0x3e')],{'$or':_[_0xd0c9('0x2d')](_0x2da111,function(_0x3247dd){if(_0x3247dd['type']!==_0xd0c9('0x43')){var _0x5f53a0={};_0x5f53a0[_0x3247dd['name']]={'$like':'%'+_0x17c2cb[_0xd0c9('0x34')][_0xd0c9('0x41')]+'%'};return _0x5f53a0;}})});}_0x83eace=_[_0xd0c9('0x42')]({},_0x83eace,_0x17c2cb['options']);var _0x467bec={'where':_0x83eace[_0xd0c9('0x3e')]};return db[_0xd0c9('0x2e')][_0xd0c9('0x1c')](_0x467bec)[_0xd0c9('0x25')](function(_0x32cf95){_0x2459ac[_0xd0c9('0x1c')]=_0x32cf95;if(_0x17c2cb[_0xd0c9('0x34')][_0xd0c9('0x44')]){_0x83eace[_0xd0c9('0x45')]=[{'all':!![]}];}return db['Migration'][_0xd0c9('0x46')](_0x83eace);})['then'](function(_0x5652c8){_0x2459ac[_0xd0c9('0x47')]=_0x5652c8;return _0x2459ac;})['then'](respondWithFilteredResult(_0x7990a8,_0x83eace))['catch'](handleError(_0x7990a8,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index aed0dcd..da76fc2 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 _0x91e9=['path','../../config/environment','./migration.attributes','exports','Migration','migrations','util','../../config/logger','api','moment','request-promise'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x91e9,0xed));var _0x991e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x91e9[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x991e('0x0'));var logger=require(_0x991e('0x1'))(_0x991e('0x2'));var moment=require(_0x991e('0x3'));var BPromise=require('bluebird');var rp=require(_0x991e('0x4'));var fs=require('fs');var path=require(_0x991e('0x5'));var rimraf=require('rimraf');var config=require(_0x991e('0x6'));var attributes=require(_0x991e('0x7'));module[_0x991e('0x8')]=function(_0x1cc7db,_0x4511bc){return _0x1cc7db['define'](_0x991e('0x9'),attributes,{'tableName':_0x991e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bdb=['rimraf','../../config/environment','define','migrations'];(function(_0x2e8508,_0xbb9b7c){var _0x2daa31=function(_0x133acc){while(--_0x133acc){_0x2e8508['push'](_0x2e8508['shift']());}};_0x2daa31(++_0xbb9b7c);}(_0x9bdb,0xec));var _0xb9bd=function(_0x33e6fa,_0x1643f2){_0x33e6fa=_0x33e6fa-0x0;var _0x1ae7a6=_0x9bdb[_0x33e6fa];return _0x1ae7a6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb9bd('0x0'));var config=require(_0xb9bd('0x1'));var attributes=require('./migration.attributes');module['exports']=function(_0x18e01e,_0x3494eb){return _0x18e01e[_0xb9bd('0x2')]('Migration',attributes,{'tableName':_0xb9bd('0x3'),'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 a04cf90..ee41401 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 _0xac72=['request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xac72,0x1eb));var _0x2ac7=function(_0x4ea5c3,_0x317631){_0x4ea5c3=_0x4ea5c3-0x0;var _0x28dbaf=_0xac72[_0x4ea5c3];return _0x28dbaf;};'use strict';var _=require(_0x2ac7('0x0'));var util=require(_0x2ac7('0x1'));var moment=require(_0x2ac7('0x2'));var BPromise=require('bluebird');var rs=require(_0x2ac7('0x3'));var fs=require('fs');var Redis=require(_0x2ac7('0x4'));var db=require(_0x2ac7('0x5'))['db'];var utils=require(_0x2ac7('0x6'));var logger=require(_0x2ac7('0x7'))(_0x2ac7('0x8'));var config=require(_0x2ac7('0x9'));var jayson=require(_0x2ac7('0xa'));var client=jayson[_0x2ac7('0xb')][_0x2ac7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e11a4,_0x19d2f0,_0xf836e2){return new BPromise(function(_0x5055f1,_0x2bcc25){return client[_0x2ac7('0xd')](_0x4e11a4,_0xf836e2)['then'](function(_0x2679e5){logger[_0x2ac7('0xe')](_0x2ac7('0xf'),_0x19d2f0,_0x2ac7('0x10'));logger[_0x2ac7('0x11')](_0x2ac7('0x12'),_0x19d2f0,_0x2ac7('0x10'),JSON['stringify'](_0x2679e5));if(_0x2679e5[_0x2ac7('0x13')]){if(_0x2679e5['error'][_0x2ac7('0x14')]===0x1f4){logger['error'](_0x2ac7('0xf'),_0x19d2f0,_0x2679e5[_0x2ac7('0x13')]['message']);return _0x2bcc25(_0x2679e5['error'][_0x2ac7('0x15')]);}logger[_0x2ac7('0x13')](_0x2ac7('0xf'),_0x19d2f0,_0x2679e5[_0x2ac7('0x13')][_0x2ac7('0x15')]);return _0x5055f1(_0x2679e5['error'][_0x2ac7('0x15')]);}else{logger[_0x2ac7('0xe')]('Migration,\x20%s,\x20%s',_0x19d2f0,'request\x20sent');_0x5055f1(_0x2679e5[_0x2ac7('0x16')][_0x2ac7('0x15')]);}})[_0x2ac7('0x17')](function(_0x10911d){logger['error'](_0x2ac7('0xf'),_0x19d2f0,_0x10911d);_0x2bcc25(_0x10911d);});});} \ No newline at end of file +var _0x74f0=['message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x74f0,0xf3));var _0x074f=function(_0x17b0d4,_0x377add){_0x17b0d4=_0x17b0d4-0x0;var _0x2d02c7=_0x74f0[_0x17b0d4];return _0x2d02c7;};'use strict';var _=require('lodash');var util=require(_0x074f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x074f('0x1'));var fs=require('fs');var Redis=require(_0x074f('0x2'));var db=require(_0x074f('0x3'))['db'];var utils=require(_0x074f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x074f('0x5'));var jayson=require(_0x074f('0x6'));var client=jayson[_0x074f('0x7')][_0x074f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10b244,_0x395b3c,_0x3dd440){return new BPromise(function(_0x547297,_0x7108e1){return client[_0x074f('0x9')](_0x10b244,_0x3dd440)['then'](function(_0x252a2e){logger[_0x074f('0xa')](_0x074f('0xb'),_0x395b3c,_0x074f('0xc'));logger[_0x074f('0xd')]('Migration,\x20%s,\x20%s,\x20%s',_0x395b3c,'request\x20sent',JSON[_0x074f('0xe')](_0x252a2e));if(_0x252a2e[_0x074f('0xf')]){if(_0x252a2e[_0x074f('0xf')][_0x074f('0x10')]===0x1f4){logger[_0x074f('0xf')](_0x074f('0xb'),_0x395b3c,_0x252a2e[_0x074f('0xf')][_0x074f('0x11')]);return _0x7108e1(_0x252a2e[_0x074f('0xf')]['message']);}logger[_0x074f('0xf')]('Migration,\x20%s,\x20%s',_0x395b3c,_0x252a2e[_0x074f('0xf')][_0x074f('0x11')]);return _0x547297(_0x252a2e[_0x074f('0xf')][_0x074f('0x11')]);}else{logger[_0x074f('0xa')](_0x074f('0xb'),_0x395b3c,_0x074f('0xc'));_0x547297(_0x252a2e[_0x074f('0x12')][_0x074f('0x11')]);}})[_0x074f('0x13')](function(_0x40fd10){logger['error'](_0x074f('0xb'),_0x395b3c,_0x40fd10);_0x7108e1(_0x40fd10);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index fbcaa38..a43827a 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 _0xbb8d=['delete','destroy','exports','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated','index','get','/:id','show','create','update'];(function(_0x508ff4,_0x544fbf){var _0x4433ad=function(_0x148a21){while(--_0x148a21){_0x508ff4['push'](_0x508ff4['shift']());}};_0x4433ad(++_0x544fbf);}(_0xbb8d,0x146));var _0xdbb8=function(_0x2ea096,_0x137c41){_0x2ea096=_0x2ea096-0x0;var _0x43698d=_0xbb8d[_0x2ea096];return _0x43698d;};'use strict';var multer=require(_0xdbb8('0x0'));var util=require('util');var path=require(_0xdbb8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xdbb8('0x2'));var auth=require(_0xdbb8('0x3'));var interaction=require(_0xdbb8('0x4'));var config=require(_0xdbb8('0x5'));var controller=require(_0xdbb8('0x6'));router['get']('/',auth[_0xdbb8('0x7')](),controller[_0xdbb8('0x8')]);router[_0xdbb8('0x9')](_0xdbb8('0xa'),auth['isAuthenticated'](),controller[_0xdbb8('0xb')]);router['post']('/',auth[_0xdbb8('0x7')](),controller[_0xdbb8('0xc')]);router['put'](_0xdbb8('0xa'),auth[_0xdbb8('0x7')](),controller[_0xdbb8('0xd')]);router[_0xdbb8('0xe')](_0xdbb8('0xa'),auth[_0xdbb8('0x7')](),controller[_0xdbb8('0xf')]);module[_0xdbb8('0x10')]=router; \ No newline at end of file +var _0xac35=['../../config/environment','./network.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(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xac35,0x141));var _0x5ac3=function(_0x11b28e,_0x3cf207){_0x11b28e=_0x11b28e-0x0;var _0x5502a5=_0xac35[_0x11b28e];return _0x5502a5;};'use strict';var multer=require(_0x5ac3('0x0'));var util=require(_0x5ac3('0x1'));var path=require(_0x5ac3('0x2'));var timeout=require(_0x5ac3('0x3'));var express=require(_0x5ac3('0x4'));var router=express[_0x5ac3('0x5')]();var fs_extra=require(_0x5ac3('0x6'));var auth=require(_0x5ac3('0x7'));var interaction=require(_0x5ac3('0x8'));var config=require(_0x5ac3('0x9'));var controller=require(_0x5ac3('0xa'));router[_0x5ac3('0xb')]('/',auth[_0x5ac3('0xc')](),controller[_0x5ac3('0xd')]);router['get'](_0x5ac3('0xe'),auth['isAuthenticated'](),controller[_0x5ac3('0xf')]);router[_0x5ac3('0x10')]('/',auth[_0x5ac3('0xc')](),controller[_0x5ac3('0x11')]);router[_0x5ac3('0x12')](_0x5ac3('0xe'),auth['isAuthenticated'](),controller[_0x5ac3('0x13')]);router['delete'](_0x5ac3('0xe'),auth[_0x5ac3('0xc')](),controller[_0x5ac3('0x14')]);module[_0x5ac3('0x15')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 7e90d4a..2b6550e 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 _0x982d=['exports','ENUM','externip','stun','STRING','sequelize'];(function(_0x41eb00,_0x4083ab){var _0x480aad=function(_0x24cf2b){while(--_0x24cf2b){_0x41eb00['push'](_0x41eb00['shift']());}};_0x480aad(++_0x4083ab);}(_0x982d,0x137));var _0xd982=function(_0x50a73a,_0x41a8d3){_0x50a73a=_0x50a73a-0x0;var _0x4012d5=_0x982d[_0x50a73a];return _0x4012d5;};'use strict';var Sequelize=require(_0xd982('0x0'));module[_0xd982('0x1')]={'type':{'type':Sequelize[_0xd982('0x2')]('localnet',_0xd982('0x3'),_0xd982('0x4'),'turn')},'value':{'type':Sequelize[_0xd982('0x5')]},'username':{'type':Sequelize[_0xd982('0x5')]},'password':{'type':Sequelize[_0xd982('0x5')]}}; \ No newline at end of file +var _0x4631=['externip','turn','STRING','sequelize','exports','ENUM','localnet'];(function(_0x4a94b1,_0x4f2518){var _0x20949f=function(_0x1c4aa6){while(--_0x1c4aa6){_0x4a94b1['push'](_0x4a94b1['shift']());}};_0x20949f(++_0x4f2518);}(_0x4631,0xe3));var _0x1463=function(_0xe8129c,_0x2fb03c){_0xe8129c=_0xe8129c-0x0;var _0x709fc5=_0x4631[_0xe8129c];return _0x709fc5;};'use strict';var Sequelize=require(_0x1463('0x0'));module[_0x1463('0x1')]={'type':{'type':Sequelize[_0x1463('0x2')](_0x1463('0x3'),_0x1463('0x4'),'stun',_0x1463('0x5'))},'value':{'type':Sequelize[_0x1463('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x1463('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index bdcb4e5..28f15ae 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 _0xe3a0=['rows','length','options','find','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','params','format','chan_sip.so','util','path','ejs','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','client','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','offset','undefined','limit','count','status','set','Content-Range','json','update','destroy','end','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','Network','findAll'];(function(_0x495f68,_0x338243){var _0x3ccc93=function(_0x33311f){while(--_0x33311f){_0x495f68['push'](_0x495f68['shift']());}};_0x3ccc93(++_0x338243);}(_0xe3a0,0x11a));var _0x0e3a=function(_0x492377,_0x19c615){_0x492377=_0x492377-0x0;var _0x1c5b09=_0xe3a0[_0x492377];return _0x1c5b09;};'use strict';var util=require(_0x0e3a('0x0'));var path=require(_0x0e3a('0x1'));var ejs=require(_0x0e3a('0x2'));var fs=require('fs');var _=require(_0x0e3a('0x3'));var qs=require(_0x0e3a('0x4'));var logger=require('../../config/logger')(_0x0e3a('0x5'));var config=require(_0x0e3a('0x6'));var db=require(_0x0e3a('0x7'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x0e3a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x462dce,_0x4b40fd,_0x12f4f4,_0x2bcfb6){return new Promise(function(_0x4fac2e,_0x3bff80){var _0x41acea=_0x2bcfb6||client;return _0x41acea[_0x0e3a('0x9')](_0x462dce,_0x12f4f4)[_0x0e3a('0xa')](function(_0x5b0435){logger['info'](_0x0e3a('0xb'),_0x4b40fd,_0x0e3a('0xc'));logger[_0x0e3a('0xd')](_0x0e3a('0xe'),_0x4b40fd,'request\x20sent',JSON[_0x0e3a('0xf')](_0x5b0435));if(_0x5b0435[_0x0e3a('0x10')]){if(_0x5b0435[_0x0e3a('0x10')]['code']===0x1f4){logger[_0x0e3a('0x10')]('Network,\x20%s,\x20%s',_0x4b40fd,_0x5b0435['error'][_0x0e3a('0x11')]);return _0x3bff80(_0x5b0435[_0x0e3a('0x10')][_0x0e3a('0x11')]);}logger[_0x0e3a('0x10')](_0x0e3a('0xb'),_0x4b40fd,_0x5b0435['error'][_0x0e3a('0x11')]);return _0x4fac2e(_0x5b0435[_0x0e3a('0x10')][_0x0e3a('0x11')]);}else{logger[_0x0e3a('0x12')](_0x0e3a('0xb'),_0x4b40fd,_0x0e3a('0xc'));_0x4fac2e(_0x5b0435[_0x0e3a('0x13')][_0x0e3a('0x11')]);}})[_0x0e3a('0x14')](function(_0x46c548){logger[_0x0e3a('0x10')](_0x0e3a('0xb'),_0x4b40fd,_0x46c548);_0x3bff80(_0x46c548);});});}function respondWithResult(_0x4d40f9,_0x324846){_0x324846=_0x324846||0xc8;return function(_0x446956){if(_0x446956){return _0x4d40f9['status'](_0x324846)['json'](_0x446956);}};}function respondWithFilteredResult(_0x48f608,_0x59f342){return function(_0x875b39){if(_0x875b39){var _0x587649=typeof _0x59f342[_0x0e3a('0x15')]===_0x0e3a('0x16')&&typeof _0x59f342[_0x0e3a('0x17')]===_0x0e3a('0x16');var _0xed9b16=_0x875b39[_0x0e3a('0x18')];var _0x1c6249=_0x587649?0x0:_0x59f342[_0x0e3a('0x15')];var _0x189bd0=_0x587649?_0x875b39['count']:_0x59f342[_0x0e3a('0x15')]+_0x59f342['limit'];var _0x2706a6;if(_0x189bd0>=_0xed9b16){_0x189bd0=_0xed9b16;_0x2706a6=0xc8;}else{_0x2706a6=0xce;}_0x48f608[_0x0e3a('0x19')](_0x2706a6);return _0x48f608[_0x0e3a('0x1a')](_0x0e3a('0x1b'),_0x1c6249+'-'+_0x189bd0+'/'+_0xed9b16)[_0x0e3a('0x1c')](_0x875b39);}return null;};}function saveUpdates(_0x4f5af1){return function(_0x2254fe){if(_0x2254fe){return _0x2254fe[_0x0e3a('0x1d')](_0x4f5af1)[_0x0e3a('0xa')](function(_0x589cc7){return _0x589cc7;});}return null;};}function removeEntity(_0x1b7487){return function(_0x469c42){if(_0x469c42){return _0x469c42[_0x0e3a('0x1e')]()[_0x0e3a('0xa')](function(){_0x1b7487[_0x0e3a('0x19')](0xcc)[_0x0e3a('0x1f')]();});}};}function handleEntityNotFound(_0x5a2abd){return function(_0x3f6a90){if(!_0x3f6a90){_0x5a2abd[_0x0e3a('0x20')](0x194);}return _0x3f6a90;};}function handleError(_0x102895,_0x4d3bbe){_0x4d3bbe=_0x4d3bbe||0x1f4;return function(_0x4f6a2b){logger['error'](_0x4f6a2b[_0x0e3a('0x21')]);if(_0x4f6a2b[_0x0e3a('0x22')]){delete _0x4f6a2b[_0x0e3a('0x22')];}_0x102895['status'](_0x4d3bbe)[_0x0e3a('0x23')](_0x4f6a2b);};}exports['index']=function(_0x4c064f,_0x5d2a37){var _0x2096cf={},_0x49ae4e={},_0x571875={'count':0x0,'rows':[]};var _0x11b7b5=_[_0x0e3a('0x24')](db['Network'][_0x0e3a('0x25')],function(_0x2d1847){return{'name':_0x2d1847[_0x0e3a('0x26')],'type':_0x2d1847[_0x0e3a('0x27')]['key']};});_0x49ae4e[_0x0e3a('0x28')]=_[_0x0e3a('0x24')](_0x11b7b5,_0x0e3a('0x22'));_0x49ae4e[_0x0e3a('0x29')]=_[_0x0e3a('0x2a')](_0x4c064f[_0x0e3a('0x29')]);_0x49ae4e[_0x0e3a('0x2b')]=_[_0x0e3a('0x2c')](_0x49ae4e[_0x0e3a('0x28')],_0x49ae4e['query']);_0x2096cf['attributes']=_[_0x0e3a('0x2c')](_0x49ae4e[_0x0e3a('0x28')],qs['fields'](_0x4c064f['query'][_0x0e3a('0x2d')]));_0x2096cf[_0x0e3a('0x2e')]=_0x2096cf[_0x0e3a('0x2e')]['length']?_0x2096cf[_0x0e3a('0x2e')]:_0x49ae4e[_0x0e3a('0x28')];if(!_0x4c064f[_0x0e3a('0x29')][_0x0e3a('0x2f')](_0x0e3a('0x30'))){_0x2096cf[_0x0e3a('0x17')]=qs[_0x0e3a('0x17')](_0x4c064f[_0x0e3a('0x29')][_0x0e3a('0x17')]);_0x2096cf[_0x0e3a('0x15')]=qs[_0x0e3a('0x15')](_0x4c064f[_0x0e3a('0x29')]['offset']);}_0x2096cf[_0x0e3a('0x31')]=qs['sort'](_0x4c064f[_0x0e3a('0x29')][_0x0e3a('0x32')]);_0x2096cf[_0x0e3a('0x33')]=qs[_0x0e3a('0x2b')](_['pick'](_0x4c064f['query'],_0x49ae4e[_0x0e3a('0x2b')]),_0x11b7b5);if(_0x4c064f['query'][_0x0e3a('0x34')]){_0x2096cf[_0x0e3a('0x33')]=_[_0x0e3a('0x35')](_0x2096cf['where'],{'$or':_[_0x0e3a('0x24')](_0x11b7b5,function(_0x1b16f2){if(_0x1b16f2[_0x0e3a('0x27')]!=='VIRTUAL'){var _0x144386={};_0x144386[_0x1b16f2[_0x0e3a('0x22')]]={'$like':'%'+_0x4c064f[_0x0e3a('0x29')][_0x0e3a('0x34')]+'%'};return _0x144386;}})});}_0x2096cf=_[_0x0e3a('0x35')]({},_0x2096cf,_0x4c064f['options']);var _0x3a1747={'where':_0x2096cf[_0x0e3a('0x33')]};return db['Network']['count'](_0x3a1747)['then'](function(_0x41d456){_0x571875[_0x0e3a('0x18')]=_0x41d456;if(_0x4c064f[_0x0e3a('0x29')][_0x0e3a('0x36')]){_0x2096cf[_0x0e3a('0x37')]=[{'all':!![]}];}return db[_0x0e3a('0x38')][_0x0e3a('0x39')](_0x2096cf);})['then'](function(_0x4cbd99){_0x571875[_0x0e3a('0x3a')]=_0x4cbd99;return _0x571875;})[_0x0e3a('0xa')](respondWithFilteredResult(_0x5d2a37,_0x2096cf))['catch'](handleError(_0x5d2a37,null));};exports['show']=function(_0x3622fa,_0x45776a){var _0x1f81a7={'raw':!![],'where':{'id':_0x3622fa['params']['id']}},_0x11b34f={};_0x11b34f[_0x0e3a('0x28')]=_[_0x0e3a('0x2a')](db['Network'][_0x0e3a('0x25')]);_0x11b34f[_0x0e3a('0x29')]=_['keys'](_0x3622fa[_0x0e3a('0x29')]);_0x11b34f[_0x0e3a('0x2b')]=_[_0x0e3a('0x2c')](_0x11b34f[_0x0e3a('0x28')],_0x11b34f[_0x0e3a('0x29')]);_0x1f81a7[_0x0e3a('0x2e')]=_['intersection'](_0x11b34f[_0x0e3a('0x28')],qs['fields'](_0x3622fa[_0x0e3a('0x29')][_0x0e3a('0x2d')]));_0x1f81a7['attributes']=_0x1f81a7[_0x0e3a('0x2e')][_0x0e3a('0x3b')]?_0x1f81a7[_0x0e3a('0x2e')]:_0x11b34f[_0x0e3a('0x28')];if(_0x3622fa['query'][_0x0e3a('0x36')]){_0x1f81a7[_0x0e3a('0x37')]=[{'all':!![]}];}_0x1f81a7=_['merge']({},_0x1f81a7,_0x3622fa[_0x0e3a('0x3c')]);return db[_0x0e3a('0x38')][_0x0e3a('0x3d')](_0x1f81a7)[_0x0e3a('0xa')](handleEntityNotFound(_0x45776a,null))[_0x0e3a('0xa')](respondWithResult(_0x45776a,null))[_0x0e3a('0x14')](handleError(_0x45776a,null));};exports['create']=function(_0x997fe0,_0x1d357a){var _0x3c5cbe;return db['Network'][_0x0e3a('0x3e')](_0x997fe0[_0x0e3a('0x3f')],{'raw':!![]})[_0x0e3a('0xa')](function(_0x1c34f4){_0x3c5cbe=_0x1c34f4;return db[_0x0e3a('0x38')]['findAll']({'where':{'type':_0x997fe0['body'][_0x0e3a('0x27')]},'raw':!![]});})[_0x0e3a('0xa')](function(_0x4edf8a){if(_0x3c5cbe[_0x0e3a('0x27')][_0x0e3a('0x40')]()==_0x0e3a('0x41')){var _0x1036f4=fs[_0x0e3a('0x42')](path[_0x0e3a('0x43')](config[_0x0e3a('0x44')],_0x0e3a('0x45')),_0x0e3a('0x46'));var _0x4e94d6=ejs[_0x0e3a('0x47')](_0x1036f4,{'networks':_0x4edf8a||[]});fs[_0x0e3a('0x48')](_0x0e3a('0x49'),_0x4e94d6);return respondWithRpcPromise(_0x0e3a('0x4a'),_0x0e3a('0x3e'),{'module':'res_stun_monitor.so'});}else if(_0x3c5cbe[_0x0e3a('0x27')][_0x0e3a('0x40')]()==_0x0e3a('0x4b')){var _0x3e5124=fs[_0x0e3a('0x42')](path[_0x0e3a('0x43')](config[_0x0e3a('0x44')],_0x0e3a('0x4c')),_0x0e3a('0x46'));var _0x4bd42f=ejs[_0x0e3a('0x47')](_0x3e5124,{'networks':_0x4edf8a||[]});fs[_0x0e3a('0x48')](_0x0e3a('0x4d'),_0x4bd42f);return respondWithRpcPromise(_0x0e3a('0x4a'),'create',{'module':_0x0e3a('0x4e')});}else{var _0xadacae=fs[_0x0e3a('0x42')](path[_0x0e3a('0x43')](config[_0x0e3a('0x44')],_0x0e3a('0x4f')),'utf8');var _0x5385b1=ejs['render'](_0xadacae,{'networks':_0x4edf8a||[]});fs[_0x0e3a('0x48')](util['format'](_0x0e3a('0x50'),_0x997fe0[_0x0e3a('0x3f')][_0x0e3a('0x27')][_0x0e3a('0x51')]()),_0x5385b1);return respondWithRpcPromise(_0x0e3a('0x4a'),_0x0e3a('0x3e'),{'module':'chan_sip.so'});}})[_0x0e3a('0xa')](function(){return _0x3c5cbe;})[_0x0e3a('0xa')](respondWithResult(_0x1d357a,0xc9))[_0x0e3a('0x14')](handleError(_0x1d357a,null));};exports[_0x0e3a('0x1d')]=function(_0x3f7847,_0x589a11){var _0x3e8453;return db['Network'][_0x0e3a('0x3d')]({'where':{'id':_0x3f7847[_0x0e3a('0x52')]['id']}})['then'](handleEntityNotFound(_0x589a11,null))[_0x0e3a('0xa')](saveUpdates(_0x3f7847[_0x0e3a('0x3f')],null))[_0x0e3a('0xa')](function(_0x4d847c){if(_0x4d847c){_0x3e8453=_0x4d847c;return db['Network']['findAll']({'where':{'type':_0x3e8453[_0x0e3a('0x27')]},'raw':!![]});}return null;})[_0x0e3a('0xa')](function(_0x26ae89){if(_0x3e8453[_0x0e3a('0x27')]['toUpperCase']()==_0x0e3a('0x41')){var _0x567fd7=fs[_0x0e3a('0x42')](path[_0x0e3a('0x43')](config[_0x0e3a('0x44')],_0x0e3a('0x45')),'utf8');var _0x5a8d75=ejs[_0x0e3a('0x47')](_0x567fd7,{'networks':_0x26ae89||[]});fs[_0x0e3a('0x48')](_0x0e3a('0x49'),_0x5a8d75);return respondWithRpcPromise(_0x0e3a('0x4a'),_0x0e3a('0x1d'),{'module':'res_stun_monitor.so'});}else if(_0x3e8453[_0x0e3a('0x27')][_0x0e3a('0x40')]()=='TURN'){var _0x5af49f=fs['readFileSync'](path[_0x0e3a('0x43')](config[_0x0e3a('0x44')],'server/files/templates/turn_multiple.ejs'),_0x0e3a('0x46'));var _0x548962=ejs[_0x0e3a('0x47')](_0x5af49f,{'networks':_0x26ae89||[]});fs[_0x0e3a('0x48')]('/etc/asterisk/turn_xcally.conf',_0x548962);return respondWithRpcPromise(_0x0e3a('0x4a'),_0x0e3a('0x1d'),{'module':'res_stun_monitor.so'});}else{var _0x11d812=fs['readFileSync'](path[_0x0e3a('0x43')](config['root'],_0x0e3a('0x4f')),'utf8');var _0x448ded=ejs[_0x0e3a('0x47')](_0x11d812,{'networks':_0x26ae89||[]});fs[_0x0e3a('0x48')](util[_0x0e3a('0x53')](_0x0e3a('0x50'),_0x3f7847[_0x0e3a('0x3f')][_0x0e3a('0x27')]['toLowerCase']()),_0x448ded);return respondWithRpcPromise('Reload',_0x0e3a('0x1d'),{'module':_0x0e3a('0x54')});}})[_0x0e3a('0xa')](function(_0x30813f){if(_0x30813f){return _0x3e8453;}return null;})[_0x0e3a('0xa')](respondWithResult(_0x589a11,null))[_0x0e3a('0x14')](handleError(_0x589a11,null));};exports[_0x0e3a('0x1e')]=function(_0x2f67dd,_0x15bd13){var _0x3d269a;return db[_0x0e3a('0x38')][_0x0e3a('0x3d')]({'where':{'id':_0x2f67dd['params']['id']}})[_0x0e3a('0xa')](function(_0x3ed23d){_0x3d269a=_0x3ed23d;return _0x3ed23d;})[_0x0e3a('0xa')](handleEntityNotFound(_0x15bd13,null))['then'](removeEntity(_0x15bd13,null))[_0x0e3a('0xa')](function(){if(_0x3d269a){return db[_0x0e3a('0x38')][_0x0e3a('0x39')]({'where':{'type':_0x3d269a['type']},'raw':!![]});}})[_0x0e3a('0xa')](function(_0x427e91){if(_0x3d269a[_0x0e3a('0x27')]['toUpperCase']()=='STUN'){var _0x1cbf0d=fs['readFileSync'](path[_0x0e3a('0x43')](config['root'],_0x0e3a('0x45')),_0x0e3a('0x46'));var _0x4070e8=ejs[_0x0e3a('0x47')](_0x1cbf0d,{'networks':_0x427e91||[]});fs['writeFileSync'](_0x0e3a('0x49'),_0x4070e8);return respondWithRpcPromise(_0x0e3a('0x4a'),_0x0e3a('0x1e'),{'module':_0x0e3a('0x4e')});}else if(_0x3d269a[_0x0e3a('0x27')][_0x0e3a('0x40')]()==_0x0e3a('0x4b')){var _0x2ed571=fs[_0x0e3a('0x42')](path[_0x0e3a('0x43')](config[_0x0e3a('0x44')],_0x0e3a('0x4c')),_0x0e3a('0x46'));var _0x28a0a3=ejs[_0x0e3a('0x47')](_0x2ed571,{'networks':_0x427e91||[]});fs[_0x0e3a('0x48')](_0x0e3a('0x4d'),_0x28a0a3);return respondWithRpcPromise(_0x0e3a('0x4a'),_0x0e3a('0x1e'),{'module':'res_stun_monitor.so'});}else{var _0x1924e7=fs['readFileSync'](path[_0x0e3a('0x43')](config[_0x0e3a('0x44')],'server/files/templates/network.ejs'),_0x0e3a('0x46'));var _0x318618=ejs[_0x0e3a('0x47')](_0x1924e7,{'networks':_0x427e91||[]});fs[_0x0e3a('0x48')](util[_0x0e3a('0x53')](_0x0e3a('0x50'),_0x3d269a[_0x0e3a('0x27')][_0x0e3a('0x51')]()),_0x318618);return respondWithRpcPromise(_0x0e3a('0x4a'),_0x0e3a('0x1e'),{'module':_0x0e3a('0x54')});}})['catch'](handleError(_0x15bd13,null));}; \ No newline at end of file +var _0xed64=['undefined','limit','count','set','Content-Range','update','end','sendStatus','name','send','index','map','Network','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','show','params','length','options','find','create','body','toUpperCase','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','server/files/templates/turn_multiple.ejs','res_stun_monitor.so','format','toLowerCase','STUN','server/files/templates/stun_multiple.ejs','server/files/templates/network.ejs','chan_sip.so','destroy','/etc/asterisk/turn_xcally.conf','/etc/asterisk/sip_xcally_%s.conf','util','path','ejs','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','client','http','request','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','offset'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0xed64,0xee));var _0x4ed6=function(_0x16dbfd,_0x2f9431){_0x16dbfd=_0x16dbfd-0x0;var _0x382254=_0xed64[_0x16dbfd];return _0x382254;};'use strict';var util=require(_0x4ed6('0x0'));var path=require(_0x4ed6('0x1'));var ejs=require(_0x4ed6('0x2'));var fs=require('fs');var _=require('lodash');var qs=require(_0x4ed6('0x3'));var logger=require(_0x4ed6('0x4'))(_0x4ed6('0x5'));var config=require(_0x4ed6('0x6'));var db=require(_0x4ed6('0x7'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x4ed6('0x8')][_0x4ed6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e10e0,_0xdde4a3,_0x533ba3,_0x5a4f3f){return new Promise(function(_0x13a8b8,_0x387a38){var _0x33887e=_0x5a4f3f||client;return _0x33887e[_0x4ed6('0xa')](_0x4e10e0,_0x533ba3)[_0x4ed6('0xb')](function(_0x52eee9){logger[_0x4ed6('0xc')](_0x4ed6('0xd'),_0xdde4a3,'request\x20sent');logger[_0x4ed6('0xe')](_0x4ed6('0xf'),_0xdde4a3,_0x4ed6('0x10'),JSON[_0x4ed6('0x11')](_0x52eee9));if(_0x52eee9[_0x4ed6('0x12')]){if(_0x52eee9[_0x4ed6('0x12')][_0x4ed6('0x13')]===0x1f4){logger[_0x4ed6('0x12')](_0x4ed6('0xd'),_0xdde4a3,_0x52eee9['error']['message']);return _0x387a38(_0x52eee9[_0x4ed6('0x12')][_0x4ed6('0x14')]);}logger['error'](_0x4ed6('0xd'),_0xdde4a3,_0x52eee9[_0x4ed6('0x12')][_0x4ed6('0x14')]);return _0x13a8b8(_0x52eee9[_0x4ed6('0x12')]['message']);}else{logger['info'](_0x4ed6('0xd'),_0xdde4a3,_0x4ed6('0x10'));_0x13a8b8(_0x52eee9[_0x4ed6('0x15')][_0x4ed6('0x14')]);}})[_0x4ed6('0x16')](function(_0x17af6d){logger[_0x4ed6('0x12')](_0x4ed6('0xd'),_0xdde4a3,_0x17af6d);_0x387a38(_0x17af6d);});});}function respondWithResult(_0x42e9a5,_0x411ede){_0x411ede=_0x411ede||0xc8;return function(_0x3de309){if(_0x3de309){return _0x42e9a5[_0x4ed6('0x17')](_0x411ede)[_0x4ed6('0x18')](_0x3de309);}};}function respondWithFilteredResult(_0x5d4097,_0x5dc9c0){return function(_0x1170e0){if(_0x1170e0){var _0x41dbec=typeof _0x5dc9c0[_0x4ed6('0x19')]===_0x4ed6('0x1a')&&typeof _0x5dc9c0[_0x4ed6('0x1b')]===_0x4ed6('0x1a');var _0x488eac=_0x1170e0[_0x4ed6('0x1c')];var _0xabbf1a=_0x41dbec?0x0:_0x5dc9c0['offset'];var _0x24e869=_0x41dbec?_0x1170e0[_0x4ed6('0x1c')]:_0x5dc9c0['offset']+_0x5dc9c0[_0x4ed6('0x1b')];var _0x5b5dbf;if(_0x24e869>=_0x488eac){_0x24e869=_0x488eac;_0x5b5dbf=0xc8;}else{_0x5b5dbf=0xce;}_0x5d4097['status'](_0x5b5dbf);return _0x5d4097[_0x4ed6('0x1d')](_0x4ed6('0x1e'),_0xabbf1a+'-'+_0x24e869+'/'+_0x488eac)[_0x4ed6('0x18')](_0x1170e0);}return null;};}function saveUpdates(_0x182eb9){return function(_0x1b871b){if(_0x1b871b){return _0x1b871b[_0x4ed6('0x1f')](_0x182eb9)[_0x4ed6('0xb')](function(_0x1855ca){return _0x1855ca;});}return null;};}function removeEntity(_0x3789c4){return function(_0x3f9dd8){if(_0x3f9dd8){return _0x3f9dd8['destroy']()[_0x4ed6('0xb')](function(){_0x3789c4[_0x4ed6('0x17')](0xcc)[_0x4ed6('0x20')]();});}};}function handleEntityNotFound(_0xc6860c){return function(_0x38e1b8){if(!_0x38e1b8){_0xc6860c[_0x4ed6('0x21')](0x194);}return _0x38e1b8;};}function handleError(_0x4eac80,_0x47a911){_0x47a911=_0x47a911||0x1f4;return function(_0x21e285){logger['error'](_0x21e285['stack']);if(_0x21e285[_0x4ed6('0x22')]){delete _0x21e285[_0x4ed6('0x22')];}_0x4eac80[_0x4ed6('0x17')](_0x47a911)[_0x4ed6('0x23')](_0x21e285);};}exports[_0x4ed6('0x24')]=function(_0x2b89a2,_0x404cb4){var _0x1fa7b3={},_0x52da9c={},_0x41bf5e={'count':0x0,'rows':[]};var _0x26d427=_[_0x4ed6('0x25')](db[_0x4ed6('0x26')][_0x4ed6('0x27')],function(_0x3640f7){return{'name':_0x3640f7[_0x4ed6('0x28')],'type':_0x3640f7[_0x4ed6('0x29')]['key']};});_0x52da9c[_0x4ed6('0x2a')]=_[_0x4ed6('0x25')](_0x26d427,'name');_0x52da9c[_0x4ed6('0x2b')]=_[_0x4ed6('0x2c')](_0x2b89a2[_0x4ed6('0x2b')]);_0x52da9c[_0x4ed6('0x2d')]=_[_0x4ed6('0x2e')](_0x52da9c[_0x4ed6('0x2a')],_0x52da9c[_0x4ed6('0x2b')]);_0x1fa7b3[_0x4ed6('0x2f')]=_[_0x4ed6('0x2e')](_0x52da9c[_0x4ed6('0x2a')],qs[_0x4ed6('0x30')](_0x2b89a2[_0x4ed6('0x2b')][_0x4ed6('0x30')]));_0x1fa7b3[_0x4ed6('0x2f')]=_0x1fa7b3['attributes']['length']?_0x1fa7b3[_0x4ed6('0x2f')]:_0x52da9c[_0x4ed6('0x2a')];if(!_0x2b89a2[_0x4ed6('0x2b')][_0x4ed6('0x31')](_0x4ed6('0x32'))){_0x1fa7b3[_0x4ed6('0x1b')]=qs[_0x4ed6('0x1b')](_0x2b89a2[_0x4ed6('0x2b')][_0x4ed6('0x1b')]);_0x1fa7b3['offset']=qs[_0x4ed6('0x19')](_0x2b89a2[_0x4ed6('0x2b')][_0x4ed6('0x19')]);}_0x1fa7b3[_0x4ed6('0x33')]=qs['sort'](_0x2b89a2[_0x4ed6('0x2b')][_0x4ed6('0x34')]);_0x1fa7b3[_0x4ed6('0x35')]=qs[_0x4ed6('0x2d')](_['pick'](_0x2b89a2[_0x4ed6('0x2b')],_0x52da9c[_0x4ed6('0x2d')]),_0x26d427);if(_0x2b89a2[_0x4ed6('0x2b')][_0x4ed6('0x36')]){_0x1fa7b3['where']=_[_0x4ed6('0x37')](_0x1fa7b3[_0x4ed6('0x35')],{'$or':_[_0x4ed6('0x25')](_0x26d427,function(_0x3c2b70){if(_0x3c2b70[_0x4ed6('0x29')]!=='VIRTUAL'){var _0xa54887={};_0xa54887[_0x3c2b70[_0x4ed6('0x22')]]={'$like':'%'+_0x2b89a2[_0x4ed6('0x2b')][_0x4ed6('0x36')]+'%'};return _0xa54887;}})});}_0x1fa7b3=_[_0x4ed6('0x37')]({},_0x1fa7b3,_0x2b89a2['options']);var _0x43b1c8={'where':_0x1fa7b3[_0x4ed6('0x35')]};return db[_0x4ed6('0x26')][_0x4ed6('0x1c')](_0x43b1c8)['then'](function(_0x1da9b6){_0x41bf5e[_0x4ed6('0x1c')]=_0x1da9b6;if(_0x2b89a2[_0x4ed6('0x2b')][_0x4ed6('0x38')]){_0x1fa7b3[_0x4ed6('0x39')]=[{'all':!![]}];}return db[_0x4ed6('0x26')][_0x4ed6('0x3a')](_0x1fa7b3);})[_0x4ed6('0xb')](function(_0x43351b){_0x41bf5e[_0x4ed6('0x3b')]=_0x43351b;return _0x41bf5e;})[_0x4ed6('0xb')](respondWithFilteredResult(_0x404cb4,_0x1fa7b3))[_0x4ed6('0x16')](handleError(_0x404cb4,null));};exports[_0x4ed6('0x3c')]=function(_0x4bcf6a,_0x12ff5f){var _0x3d1b3b={'raw':!![],'where':{'id':_0x4bcf6a[_0x4ed6('0x3d')]['id']}},_0x1b4bd1={};_0x1b4bd1[_0x4ed6('0x2a')]=_['keys'](db[_0x4ed6('0x26')][_0x4ed6('0x27')]);_0x1b4bd1['query']=_[_0x4ed6('0x2c')](_0x4bcf6a[_0x4ed6('0x2b')]);_0x1b4bd1[_0x4ed6('0x2d')]=_[_0x4ed6('0x2e')](_0x1b4bd1[_0x4ed6('0x2a')],_0x1b4bd1['query']);_0x3d1b3b[_0x4ed6('0x2f')]=_[_0x4ed6('0x2e')](_0x1b4bd1['model'],qs[_0x4ed6('0x30')](_0x4bcf6a['query'][_0x4ed6('0x30')]));_0x3d1b3b['attributes']=_0x3d1b3b[_0x4ed6('0x2f')][_0x4ed6('0x3e')]?_0x3d1b3b[_0x4ed6('0x2f')]:_0x1b4bd1['model'];if(_0x4bcf6a['query']['includeAll']){_0x3d1b3b[_0x4ed6('0x39')]=[{'all':!![]}];}_0x3d1b3b=_[_0x4ed6('0x37')]({},_0x3d1b3b,_0x4bcf6a[_0x4ed6('0x3f')]);return db[_0x4ed6('0x26')][_0x4ed6('0x40')](_0x3d1b3b)[_0x4ed6('0xb')](handleEntityNotFound(_0x12ff5f,null))['then'](respondWithResult(_0x12ff5f,null))[_0x4ed6('0x16')](handleError(_0x12ff5f,null));};exports[_0x4ed6('0x41')]=function(_0x1cb00d,_0x19044c){var _0x3201bc;return db['Network'][_0x4ed6('0x41')](_0x1cb00d[_0x4ed6('0x42')],{'raw':!![]})['then'](function(_0x59c0a8){_0x3201bc=_0x59c0a8;return db[_0x4ed6('0x26')][_0x4ed6('0x3a')]({'where':{'type':_0x1cb00d[_0x4ed6('0x42')][_0x4ed6('0x29')]},'raw':!![]});})['then'](function(_0x5028e8){if(_0x3201bc[_0x4ed6('0x29')][_0x4ed6('0x43')]()=='STUN'){var _0x24ade7=fs[_0x4ed6('0x44')](path[_0x4ed6('0x45')](config[_0x4ed6('0x46')],'server/files/templates/stun_multiple.ejs'),_0x4ed6('0x47'));var _0x16d6dc=ejs[_0x4ed6('0x48')](_0x24ade7,{'networks':_0x5028e8||[]});fs[_0x4ed6('0x49')](_0x4ed6('0x4a'),_0x16d6dc);return respondWithRpcPromise(_0x4ed6('0x4b'),_0x4ed6('0x41'),{'module':'res_stun_monitor.so'});}else if(_0x3201bc[_0x4ed6('0x29')][_0x4ed6('0x43')]()==_0x4ed6('0x4c')){var _0x523040=fs[_0x4ed6('0x44')](path['join'](config[_0x4ed6('0x46')],_0x4ed6('0x4d')),_0x4ed6('0x47'));var _0x19533b=ejs['render'](_0x523040,{'networks':_0x5028e8||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x19533b);return respondWithRpcPromise('Reload',_0x4ed6('0x41'),{'module':_0x4ed6('0x4e')});}else{var _0x562c9d=fs[_0x4ed6('0x44')](path[_0x4ed6('0x45')](config[_0x4ed6('0x46')],'server/files/templates/network.ejs'),'utf8');var _0x56fe86=ejs[_0x4ed6('0x48')](_0x562c9d,{'networks':_0x5028e8||[]});fs[_0x4ed6('0x49')](util[_0x4ed6('0x4f')]('/etc/asterisk/sip_xcally_%s.conf',_0x1cb00d[_0x4ed6('0x42')]['type'][_0x4ed6('0x50')]()),_0x56fe86);return respondWithRpcPromise(_0x4ed6('0x4b'),_0x4ed6('0x41'),{'module':'chan_sip.so'});}})[_0x4ed6('0xb')](function(){return _0x3201bc;})['then'](respondWithResult(_0x19044c,0xc9))['catch'](handleError(_0x19044c,null));};exports[_0x4ed6('0x1f')]=function(_0x3debc7,_0xa715ec){var _0x226ab3;return db[_0x4ed6('0x26')][_0x4ed6('0x40')]({'where':{'id':_0x3debc7[_0x4ed6('0x3d')]['id']}})[_0x4ed6('0xb')](handleEntityNotFound(_0xa715ec,null))[_0x4ed6('0xb')](saveUpdates(_0x3debc7[_0x4ed6('0x42')],null))[_0x4ed6('0xb')](function(_0xa33047){if(_0xa33047){_0x226ab3=_0xa33047;return db[_0x4ed6('0x26')][_0x4ed6('0x3a')]({'where':{'type':_0x226ab3['type']},'raw':!![]});}return null;})[_0x4ed6('0xb')](function(_0x4dcfab){if(_0x226ab3['type'][_0x4ed6('0x43')]()==_0x4ed6('0x51')){var _0x4248fa=fs['readFileSync'](path[_0x4ed6('0x45')](config['root'],_0x4ed6('0x52')),'utf8');var _0x554ef1=ejs[_0x4ed6('0x48')](_0x4248fa,{'networks':_0x4dcfab||[]});fs['writeFileSync'](_0x4ed6('0x4a'),_0x554ef1);return respondWithRpcPromise(_0x4ed6('0x4b'),_0x4ed6('0x1f'),{'module':'res_stun_monitor.so'});}else if(_0x226ab3[_0x4ed6('0x29')][_0x4ed6('0x43')]()==_0x4ed6('0x4c')){var _0x2d5b46=fs[_0x4ed6('0x44')](path[_0x4ed6('0x45')](config['root'],_0x4ed6('0x4d')),_0x4ed6('0x47'));var _0x5545c2=ejs[_0x4ed6('0x48')](_0x2d5b46,{'networks':_0x4dcfab||[]});fs[_0x4ed6('0x49')]('/etc/asterisk/turn_xcally.conf',_0x5545c2);return respondWithRpcPromise(_0x4ed6('0x4b'),_0x4ed6('0x1f'),{'module':_0x4ed6('0x4e')});}else{var _0x59f59f=fs['readFileSync'](path[_0x4ed6('0x45')](config['root'],_0x4ed6('0x53')),_0x4ed6('0x47'));var _0x578814=ejs[_0x4ed6('0x48')](_0x59f59f,{'networks':_0x4dcfab||[]});fs['writeFileSync'](util[_0x4ed6('0x4f')]('/etc/asterisk/sip_xcally_%s.conf',_0x3debc7[_0x4ed6('0x42')][_0x4ed6('0x29')][_0x4ed6('0x50')]()),_0x578814);return respondWithRpcPromise('Reload',_0x4ed6('0x1f'),{'module':_0x4ed6('0x54')});}})[_0x4ed6('0xb')](function(_0x5627be){if(_0x5627be){return _0x226ab3;}return null;})['then'](respondWithResult(_0xa715ec,null))[_0x4ed6('0x16')](handleError(_0xa715ec,null));};exports[_0x4ed6('0x55')]=function(_0x452abc,_0x49b94c){var _0x54fb64;return db['Network'][_0x4ed6('0x40')]({'where':{'id':_0x452abc[_0x4ed6('0x3d')]['id']}})[_0x4ed6('0xb')](function(_0x3d8614){_0x54fb64=_0x3d8614;return _0x3d8614;})[_0x4ed6('0xb')](handleEntityNotFound(_0x49b94c,null))[_0x4ed6('0xb')](removeEntity(_0x49b94c,null))[_0x4ed6('0xb')](function(){if(_0x54fb64){return db[_0x4ed6('0x26')][_0x4ed6('0x3a')]({'where':{'type':_0x54fb64[_0x4ed6('0x29')]},'raw':!![]});}})[_0x4ed6('0xb')](function(_0x2fa4a5){if(_0x54fb64['type']['toUpperCase']()==_0x4ed6('0x51')){var _0x1143d1=fs[_0x4ed6('0x44')](path['join'](config[_0x4ed6('0x46')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x25b8bf=ejs[_0x4ed6('0x48')](_0x1143d1,{'networks':_0x2fa4a5||[]});fs[_0x4ed6('0x49')](_0x4ed6('0x4a'),_0x25b8bf);return respondWithRpcPromise(_0x4ed6('0x4b'),'destroy',{'module':_0x4ed6('0x4e')});}else if(_0x54fb64[_0x4ed6('0x29')]['toUpperCase']()==_0x4ed6('0x4c')){var _0x199203=fs['readFileSync'](path['join'](config['root'],_0x4ed6('0x4d')),_0x4ed6('0x47'));var _0x570d39=ejs['render'](_0x199203,{'networks':_0x2fa4a5||[]});fs[_0x4ed6('0x49')](_0x4ed6('0x56'),_0x570d39);return respondWithRpcPromise(_0x4ed6('0x4b'),_0x4ed6('0x55'),{'module':_0x4ed6('0x4e')});}else{var _0x501a46=fs['readFileSync'](path['join'](config[_0x4ed6('0x46')],'server/files/templates/network.ejs'),_0x4ed6('0x47'));var _0x34bf13=ejs[_0x4ed6('0x48')](_0x501a46,{'networks':_0x2fa4a5||[]});fs[_0x4ed6('0x49')](util['format'](_0x4ed6('0x57'),_0x54fb64[_0x4ed6('0x29')][_0x4ed6('0x50')]()),_0x34bf13);return respondWithRpcPromise('Reload','destroy',{'module':_0x4ed6('0x54')});}})[_0x4ed6('0x16')](handleError(_0x49b94c,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 01fa63b..2946355 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 _0x402f=['exports','define','Network','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x3b6fd3,_0x164f8f){var _0x3cdcbb=function(_0x40cd0e){while(--_0x40cd0e){_0x3b6fd3['push'](_0x3b6fd3['shift']());}};_0x3cdcbb(++_0x164f8f);}(_0x402f,0x6f));var _0xf402=function(_0x208fa4,_0xa1f93){_0x208fa4=_0x208fa4-0x0;var _0x2ee03e=_0x402f[_0x208fa4];return _0x2ee03e;};'use strict';var _=require(_0xf402('0x0'));var util=require('util');var logger=require(_0xf402('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf402('0x2'));var rp=require(_0xf402('0x3'));var fs=require('fs');var path=require(_0xf402('0x4'));var rimraf=require('rimraf');var config=require(_0xf402('0x5'));var attributes=require('./network.attributes');module[_0xf402('0x6')]=function(_0x270766,_0x3a1d11){return _0x270766[_0xf402('0x7')](_0xf402('0x8'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a12=['util','bluebird','path','rimraf','../../config/environment','./network.attributes','exports','network'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0a12,0xb8));var _0x20a1=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x0a12[_0x39d544];return _0x5a5ff2;};'use strict';var _=require('lodash');var util=require(_0x20a1('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x20a1('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20a1('0x2'));var rimraf=require(_0x20a1('0x3'));var config=require(_0x20a1('0x4'));var attributes=require(_0x20a1('0x5'));module[_0x20a1('0x6')]=function(_0x2e0ad3,_0x1fedd2){return _0x2e0ad3['define']('Network',attributes,{'tableName':_0x20a1('0x7'),'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 6caca44..c98d38d 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x2de5b6,_0x5c5a0a){_0x2de5b6=_0x2de5b6-0x0;var _0x316a7f=_0x7a54[_0x2de5b6];return _0x316a7f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','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','stringify','error','code'];(function(_0x442c23,_0x410d14){var _0x5f2153=function(_0x42c295){while(--_0x42c295){_0x442c23['push'](_0x442c23['shift']());}};_0x5f2153(++_0x410d14);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index a6a3ba7..3334b10 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 _0x77e6=['../../components/auth/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','get','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/users','addAgents','/:id/send','send','put','update','delete','removeDispositions','removeAnswers','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x48114e,_0x53de0b){var _0x2e0366=function(_0x3fcf8a){while(--_0x3fcf8a){_0x48114e['push'](_0x48114e['shift']());}};_0x2e0366(++_0x53de0b);}(_0x77e6,0x1a6));var _0x677e=function(_0x1291c9,_0x11d00d){_0x1291c9=_0x1291c9-0x0;var _0xf8ed7b=_0x77e6[_0x1291c9];return _0xf8ed7b;};'use strict';var multer=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var path=require(_0x677e('0x2'));var timeout=require(_0x677e('0x3'));var express=require(_0x677e('0x4'));var router=express[_0x677e('0x5')]();var fs_extra=require(_0x677e('0x6'));var auth=require(_0x677e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x677e('0x8'));var controller=require(_0x677e('0x9'));router['get']('/',auth[_0x677e('0xa')](),controller['index']);router[_0x677e('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x677e('0xc')]);router[_0x677e('0xb')](_0x677e('0xd'),auth[_0x677e('0xa')](),controller['show']);router[_0x677e('0xb')]('/:id/dispositions',auth[_0x677e('0xa')](),controller[_0x677e('0xe')]);router[_0x677e('0xb')](_0x677e('0xf'),auth[_0x677e('0xa')](),controller[_0x677e('0x10')]);router[_0x677e('0xb')](_0x677e('0x11'),auth[_0x677e('0xa')](),controller[_0x677e('0x12')]);router[_0x677e('0xb')](_0x677e('0x13'),auth[_0x677e('0xa')](),controller[_0x677e('0x14')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x677e('0x15')]);router[_0x677e('0x16')]('/',auth[_0x677e('0xa')](),controller[_0x677e('0x17')]);router[_0x677e('0x16')](_0x677e('0x18'),auth[_0x677e('0xa')](),controller[_0x677e('0x19')]);router[_0x677e('0x16')](_0x677e('0xf'),auth[_0x677e('0xa')](),controller[_0x677e('0x1a')]);router['post'](_0x677e('0x1b'),controller[_0x677e('0x1c')]);router[_0x677e('0x16')](_0x677e('0x11'),auth[_0x677e('0xa')](),controller[_0x677e('0x1d')]);router['post'](_0x677e('0x1e'),auth['isAuthenticated'](),controller[_0x677e('0x1f')]);router[_0x677e('0x16')](_0x677e('0x20'),auth['isAuthenticated'](),controller[_0x677e('0x21')]);router[_0x677e('0x22')](_0x677e('0xd'),auth[_0x677e('0xa')](),controller[_0x677e('0x23')]);router[_0x677e('0x24')](_0x677e('0xd'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x677e('0x18'),auth[_0x677e('0xa')](),controller[_0x677e('0x25')]);router[_0x677e('0x24')](_0x677e('0xf'),auth[_0x677e('0xa')](),controller[_0x677e('0x26')]);router[_0x677e('0x24')](_0x677e('0x1e'),auth[_0x677e('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x3423=['/:id/dispositions','getAnswers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','put','update','destroy','delete','removeDispositions','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3f4989,_0x5e7a88){var _0x3294bd=function(_0x29f15){while(--_0x29f15){_0x3f4989['push'](_0x3f4989['shift']());}};_0x3294bd(++_0x5e7a88);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var fs_extra=require(_0x3342('0x4'));var auth=require(_0x3342('0x5'));var interaction=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var controller=require(_0x3342('0x8'));router[_0x3342('0x9')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xb')]);router[_0x3342('0x9')](_0x3342('0xc'),auth[_0x3342('0xa')](),controller[_0x3342('0xd')]);router[_0x3342('0x9')](_0x3342('0xe'),auth[_0x3342('0xa')](),controller['show']);router['get'](_0x3342('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x3342('0xa')](),controller[_0x3342('0x10')]);router['get'](_0x3342('0x11'),auth['isAuthenticated'](),controller[_0x3342('0x12')]);router[_0x3342('0x9')]('/:id/interactions',auth[_0x3342('0xa')](),controller[_0x3342('0x13')]);router[_0x3342('0x9')](_0x3342('0x14'),auth[_0x3342('0xa')](),controller[_0x3342('0x15')]);router[_0x3342('0x16')]('/',auth['isAuthenticated'](),controller[_0x3342('0x17')]);router[_0x3342('0x16')]('/:id/dispositions',auth[_0x3342('0xa')](),controller[_0x3342('0x18')]);router['post']('/:id/canned_answers',auth[_0x3342('0xa')](),controller[_0x3342('0x19')]);router[_0x3342('0x16')](_0x3342('0x1a'),controller[_0x3342('0x1b')]);router[_0x3342('0x16')](_0x3342('0x11'),auth[_0x3342('0xa')](),controller[_0x3342('0x1c')]);router['post'](_0x3342('0x14'),auth[_0x3342('0xa')](),controller[_0x3342('0x1d')]);router['post'](_0x3342('0x1e'),auth[_0x3342('0xa')](),controller['send']);router[_0x3342('0x1f')](_0x3342('0xe'),auth['isAuthenticated'](),controller[_0x3342('0x20')]);router['delete'](_0x3342('0xe'),auth[_0x3342('0xa')](),controller[_0x3342('0x21')]);router[_0x3342('0x22')](_0x3342('0xf'),auth[_0x3342('0xa')](),controller[_0x3342('0x23')]);router[_0x3342('0x22')]('/:id/canned_answers',auth[_0x3342('0xa')](),controller['removeAnswers']);router['delete'](_0x3342('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x3342('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 858fa8d..c298512 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 _0xbde6=['mandatoryDisposition','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','mandatoryDispositionPauseId'];(function(_0x4c0d68,_0x8ffe56){var _0x1d37d2=function(_0x55e8da){while(--_0x55e8da){_0x4c0d68['push'](_0x4c0d68['shift']());}};_0x1d37d2(++_0x8ffe56);}(_0xbde6,0x9d));var _0x6bde=function(_0x946edd,_0x513719){_0x946edd=_0x946edd-0x0;var _0x1b6458=_0xbde6[_0x946edd];return _0x1b6458;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6bde('0x0'));module[_0x6bde('0x1')]={'name':{'type':Sequelize[_0x6bde('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x6bde('0x2')],'defaultValue':function(){return rs[_0x6bde('0x3')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x6bde('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6bde('0x4')],'defaultValue':function(){return _0x6bde('0x5');}},'notificationSound':{'type':Sequelize[_0x6bde('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6bde('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6bde('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6bde('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x6bde('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6bde('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6bde('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6bde('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x6bde('0x6')],'defaultValue':![],'comment':_0x6bde('0x8'),'set':function(_0xfeb039){if(!_0xfeb039)this[_0x6bde('0x9')](_0x6bde('0xa'),null);this[_0x6bde('0x9')](_0x6bde('0xb'),_0xfeb039);}}}; \ No newline at end of file +var _0xcda9=['name','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','exports','STRING'];(function(_0x34b7b6,_0x5a84bf){var _0x30915e=function(_0x48e460){while(--_0x48e460){_0x34b7b6['push'](_0x34b7b6['shift']());}};_0x30915e(++_0x5a84bf);}(_0xcda9,0x189));var _0x9cda=function(_0x37a4ca,_0x4532e4){_0x37a4ca=_0x37a4ca-0x0;var _0x63aa6=_0xcda9[_0x37a4ca];return _0x63aa6;};'use strict';var Sequelize=require(_0x9cda('0x0'));var rs=require('randomstring');module[_0x9cda('0x1')]={'name':{'type':Sequelize[_0x9cda('0x2')],'unique':_0x9cda('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9cda('0x2')]},'token':{'type':Sequelize[_0x9cda('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x9cda('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x9cda('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9cda('0x4')],'defaultValue':function(){return _0x9cda('0x5');}},'notificationSound':{'type':Sequelize[_0x9cda('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9cda('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9cda('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9cda('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x9cda('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9cda('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9cda('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9cda('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9cda('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x9cda('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9cda('0x9'),'set':function(_0x473bdb){if(!_0x473bdb)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x9cda('0xa')](_0x9cda('0xb'),_0x473bdb);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 527830b..d92aec7 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 _0x7fbe=['userProfileId','autoAssociation','body','describe','addDisposition','getDispositions','findOne','Disposition','pick','merge','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','getAnswers','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','updatedAt','OpenchannelApplication','List','applications','Applications','list','orderBy','priority','asc','account','Contacts','threadId','OpenchannelInteraction','externalUrl','ContactId','firstName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','contact','UserId','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','unshift','queue','waitForTheAssignedQueue','Start','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findAndCountAll','finally','getApplications','getInteractions','User','Owner','fullname','internal','tag','addAgents','omit','spread','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','DESC','out','dataValues','Messages','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','OpenchannelAccount','count','include','findAll','rows','params','length','includeAll','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4ccbe2,_0x11eacf){_0x4ccbe2=_0x4ccbe2-0x0;var _0x134525=_0x7fbe[_0x4ccbe2];return _0x134525;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];config[_0xe7fb('0x1b')]=_[_0xe7fb('0x1c')](config[_0xe7fb('0x1b')],{'host':_0xe7fb('0x1d'),'port':0x18eb});var socket=require(_0xe7fb('0x1e'))(new Redis(config['redis']));require(_0xe7fb('0x1f'))[_0xe7fb('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe7fb('0x21')][_0xe7fb('0x22')]({'port':0x232c});var client9002=jayson['client'][_0xe7fb('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x559129,_0x12fff6,_0x18d23c,_0x12603d){return new BPromise(function(_0x17e8a8,_0x562262){var _0x892b0f=_0x12603d||client;return _0x892b0f['request'](_0x559129,_0x18d23c)[_0xe7fb('0x23')](function(_0x546463){logger[_0xe7fb('0x24')](_0xe7fb('0x25'),_0x12fff6,_0xe7fb('0x26'));logger[_0xe7fb('0x27')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x12fff6,_0xe7fb('0x26'),JSON['stringify'](_0x546463));if(_0x546463[_0xe7fb('0x28')]){if(_0x546463['error'][_0xe7fb('0x29')]===0x1f4){logger['error'](_0xe7fb('0x25'),_0x12fff6,_0x546463[_0xe7fb('0x28')]['message']);return _0x562262(_0x546463[_0xe7fb('0x28')][_0xe7fb('0x2a')]);}logger[_0xe7fb('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x12fff6,_0x546463[_0xe7fb('0x28')][_0xe7fb('0x2a')]);return _0x17e8a8(_0x546463['error']['message']);}else{logger['info'](_0xe7fb('0x25'),_0x12fff6,'request\x20sent');_0x17e8a8(_0x546463['result'][_0xe7fb('0x2a')]);}})[_0xe7fb('0x2b')](function(_0x2996ae){logger['error'](_0xe7fb('0x25'),_0x12fff6,_0x2996ae);_0x562262(_0x2996ae);});});}function respondWithStatusCode(_0x2b69c4,_0x390f32){_0x390f32=_0x390f32||0xcc;return function(_0x1ceed8){if(_0x1ceed8){return _0x2b69c4[_0xe7fb('0x2c')](_0x390f32);}return _0x2b69c4[_0xe7fb('0x2d')](_0x390f32)[_0xe7fb('0x2e')]();};}function respondWithResult(_0x59e015,_0x5df9f2){_0x5df9f2=_0x5df9f2||0xc8;return function(_0x1086e6){if(_0x1086e6){return _0x59e015[_0xe7fb('0x2d')](_0x5df9f2)[_0xe7fb('0x2f')](_0x1086e6);}};}function respondWithFilteredResult(_0x4fd290,_0xb1f2f4){return function(_0x251807){if(_0x251807){var _0xd3fffe=typeof _0xb1f2f4[_0xe7fb('0x30')]===_0xe7fb('0x31')&&typeof _0xb1f2f4[_0xe7fb('0x32')]===_0xe7fb('0x31');var _0x3dd0be=_0x251807['count'];var _0x3d1fb5=_0xd3fffe?0x0:_0xb1f2f4[_0xe7fb('0x30')];var _0x29d1ca=_0xd3fffe?_0x251807['count']:_0xb1f2f4['offset']+_0xb1f2f4[_0xe7fb('0x32')];var _0x4a9fea;if(_0x29d1ca>=_0x3dd0be){_0x29d1ca=_0x3dd0be;_0x4a9fea=0xc8;}else{_0x4a9fea=0xce;}_0x4fd290[_0xe7fb('0x2d')](_0x4a9fea);return _0x4fd290[_0xe7fb('0x33')](_0xe7fb('0x34'),_0x3d1fb5+'-'+_0x29d1ca+'/'+_0x3dd0be)[_0xe7fb('0x2f')](_0x251807);}return null;};}function patchUpdates(_0x556368){return function(_0x1af472){try{jsonpatch[_0xe7fb('0x35')](_0x1af472,_0x556368,!![]);}catch(_0x18ed83){return BPromise[_0xe7fb('0x36')](_0x18ed83);}return _0x1af472[_0xe7fb('0x37')]();};}function saveUpdates(_0x480819,_0x256694){return function(_0x121d19){if(_0x121d19){return _0x121d19[_0xe7fb('0x38')](_0x480819)[_0xe7fb('0x23')](function(_0x46f430){return _0x46f430;});}return null;};}function removeEntity(_0x25e925,_0x1bc72d){return function(_0x147eb1){if(_0x147eb1){return _0x147eb1[_0xe7fb('0x39')]()['then'](function(){var _0x44d8cf=_0x147eb1[_0xe7fb('0x3a')]({'plain':!![]});var _0x2593e3='OpenchannelAccounts';return db[_0xe7fb('0x3b')][_0xe7fb('0x39')]({'where':{'type':_0x2593e3,'resourceId':_0x44d8cf['id']}})[_0xe7fb('0x23')](function(){return _0x147eb1;});})[_0xe7fb('0x23')](function(){_0x25e925[_0xe7fb('0x2d')](0xcc)[_0xe7fb('0x2e')]();});}};}function handleEntityNotFound(_0xfeefb1,_0xc4e271){return function(_0x195c35){if(!_0x195c35){_0xfeefb1[_0xe7fb('0x2c')](0x194);}return _0x195c35;};}function handleError(_0x29c34a,_0x3c4f4b){_0x3c4f4b=_0x3c4f4b||0x1f4;return function(_0x1544f2){logger[_0xe7fb('0x28')](_0x1544f2[_0xe7fb('0x3c')]);if(_0x1544f2[_0xe7fb('0x3d')]){delete _0x1544f2[_0xe7fb('0x3d')];}_0x29c34a[_0xe7fb('0x2d')](_0x3c4f4b)[_0xe7fb('0x3e')](_0x1544f2);};}exports['index']=function(_0x261ec5,_0x23f9f9){var _0x3f3207={'include':[{'model':db[_0xe7fb('0x3f')],'as':_0xe7fb('0x40')}]},_0x444f98={},_0x50d952={'count':0x0,'rows':[]};var _0xd472d=_[_0xe7fb('0x41')](db['OpenchannelAccount'][_0xe7fb('0x42')],function(_0x451a6c){return{'name':_0x451a6c[_0xe7fb('0x43')],'type':_0x451a6c[_0xe7fb('0x44')][_0xe7fb('0x45')]};});_0x444f98[_0xe7fb('0x46')]=_['map'](_0xd472d,_0xe7fb('0x3d'));_0x444f98[_0xe7fb('0x47')]=_[_0xe7fb('0x48')](_0x261ec5['query']);_0x444f98[_0xe7fb('0x49')]=_[_0xe7fb('0x4a')](_0x444f98['model'],_0x444f98['query']);_0x3f3207['attributes']=_['intersection'](_0x444f98['model'],qs[_0xe7fb('0x4b')](_0x261ec5[_0xe7fb('0x47')][_0xe7fb('0x4b')]));_0x3f3207['attributes']=_0x3f3207[_0xe7fb('0x4c')]['length']?_0x3f3207[_0xe7fb('0x4c')]:_0x444f98[_0xe7fb('0x46')];if(!_0x261ec5['query'][_0xe7fb('0x4d')](_0xe7fb('0x4e'))){_0x3f3207[_0xe7fb('0x32')]=qs[_0xe7fb('0x32')](_0x261ec5['query'][_0xe7fb('0x32')]);_0x3f3207[_0xe7fb('0x30')]=qs[_0xe7fb('0x30')](_0x261ec5['query'][_0xe7fb('0x30')]);}_0x3f3207[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x261ec5[_0xe7fb('0x47')][_0xe7fb('0x50')]);_0x3f3207['where']=qs[_0xe7fb('0x49')](_['pick'](_0x261ec5[_0xe7fb('0x47')],_0x444f98[_0xe7fb('0x49')]),_0xd472d);if(_0x261ec5[_0xe7fb('0x47')][_0xe7fb('0x51')]){_0x3f3207[_0xe7fb('0x52')]=_['merge'](_0x3f3207[_0xe7fb('0x52')],{'$or':_['map'](_0xd472d,function(_0x511759){if(_0x511759[_0xe7fb('0x44')]!==_0xe7fb('0x53')){var _0x16327f={};_0x16327f[_0x511759['name']]={'$like':'%'+_0x261ec5[_0xe7fb('0x47')][_0xe7fb('0x51')]+'%'};return _0x16327f;}})});}_0x3f3207=_['merge']({},_0x3f3207,_0x261ec5['options']);var _0x284bcb={'where':_0x3f3207[_0xe7fb('0x52')]};return db[_0xe7fb('0x54')][_0xe7fb('0x55')](_0x284bcb)[_0xe7fb('0x23')](function(_0x1f0533){_0x50d952[_0xe7fb('0x55')]=_0x1f0533;if(_0x261ec5[_0xe7fb('0x47')]['includeAll']){_0x3f3207[_0xe7fb('0x56')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xe7fb('0x57')](_0x3f3207);})[_0xe7fb('0x23')](function(_0x5cedfb){_0x50d952[_0xe7fb('0x58')]=_0x5cedfb;return _0x50d952;})['then'](respondWithFilteredResult(_0x23f9f9,_0x3f3207))[_0xe7fb('0x2b')](handleError(_0x23f9f9,null));};exports['show']=function(_0x68e723,_0x533e91){var _0x467c5a={'raw':![],'where':{'id':_0x68e723[_0xe7fb('0x59')]['id']},'include':[{'model':db[_0xe7fb('0x3f')],'as':_0xe7fb('0x40')}]},_0x59158c={};_0x59158c[_0xe7fb('0x46')]=_[_0xe7fb('0x48')](db[_0xe7fb('0x54')][_0xe7fb('0x42')]);_0x59158c['query']=_['keys'](_0x68e723[_0xe7fb('0x47')]);_0x59158c['filters']=_['intersection'](_0x59158c['model'],_0x59158c['query']);_0x467c5a['attributes']=_[_0xe7fb('0x4a')](_0x59158c[_0xe7fb('0x46')],qs[_0xe7fb('0x4b')](_0x68e723[_0xe7fb('0x47')]['fields']));_0x467c5a[_0xe7fb('0x4c')]=_0x467c5a[_0xe7fb('0x4c')][_0xe7fb('0x5a')]?_0x467c5a['attributes']:_0x59158c['model'];if(_0x68e723[_0xe7fb('0x47')][_0xe7fb('0x5b')]){_0x467c5a[_0xe7fb('0x56')]=[{'all':!![]}];}_0x467c5a=_['merge']({},_0x467c5a,_0x68e723[_0xe7fb('0x5c')]);return db[_0xe7fb('0x54')][_0xe7fb('0x5d')](_0x467c5a)[_0xe7fb('0x23')](handleEntityNotFound(_0x533e91,null))['then'](respondWithResult(_0x533e91,null))['catch'](handleError(_0x533e91,null));};exports[_0xe7fb('0x5e')]=function(_0x3104c2,_0x1f16b2){return db[_0xe7fb('0x54')][_0xe7fb('0x5e')](_0x3104c2['body'],{})[_0xe7fb('0x23')](function(_0x349a2a){var _0x23755b=_0x3104c2['user']['get']({'plain':!![]});if(!_0x23755b)throw new Error(_0xe7fb('0x5f'));if(_0x23755b[_0xe7fb('0x60')]===_0xe7fb('0x61')){var _0x1c4035=_0x349a2a[_0xe7fb('0x3a')]({'plain':!![]});var _0x3385e2='OpenchannelAccounts';return db[_0xe7fb('0x62')][_0xe7fb('0x5d')]({'where':{'name':_0x3385e2,'userProfileId':_0x23755b[_0xe7fb('0x63')]},'raw':!![]})[_0xe7fb('0x23')](function(_0x66b78c){if(_0x66b78c&&_0x66b78c[_0xe7fb('0x64')]===0x0){return db['UserProfileResource'][_0xe7fb('0x5e')]({'name':_0x1c4035['name'],'resourceId':_0x1c4035['id'],'type':_0x66b78c[_0xe7fb('0x3d')],'sectionId':_0x66b78c['id']},{})[_0xe7fb('0x23')](function(){return _0x349a2a;});}else{return _0x349a2a;}})[_0xe7fb('0x2b')](function(_0x1b24fd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b24fd);throw _0x1b24fd;});}return _0x349a2a;})[_0xe7fb('0x23')](respondWithResult(_0x1f16b2,0xc9))[_0xe7fb('0x2b')](handleError(_0x1f16b2,null));};exports[_0xe7fb('0x38')]=function(_0x1d5355,_0x197166){if(_0x1d5355['body']['id']){delete _0x1d5355[_0xe7fb('0x65')]['id'];}return db['OpenchannelAccount'][_0xe7fb('0x5d')]({'where':{'id':_0x1d5355['params']['id']},'include':[{'model':db['Pause'],'as':_0xe7fb('0x40')}]})[_0xe7fb('0x23')](handleEntityNotFound(_0x197166,null))[_0xe7fb('0x23')](saveUpdates(_0x1d5355['body'],null))[_0xe7fb('0x23')](respondWithResult(_0x197166,null))[_0xe7fb('0x2b')](handleError(_0x197166,null));};exports[_0xe7fb('0x39')]=function(_0x23b3c8,_0x275e11){return db['OpenchannelAccount'][_0xe7fb('0x5d')]({'where':{'id':_0x23b3c8[_0xe7fb('0x59')]['id']}})['then'](handleEntityNotFound(_0x275e11,null))[_0xe7fb('0x23')](removeEntity(_0x275e11,null))[_0xe7fb('0x2b')](handleError(_0x275e11,null));};exports['describe']=function(_0x21ccac,_0x4c04e1){return db[_0xe7fb('0x54')][_0xe7fb('0x66')]()[_0xe7fb('0x23')](respondWithResult(_0x4c04e1,null))['catch'](handleError(_0x4c04e1,null));};exports[_0xe7fb('0x67')]=function(_0x3a1f16,_0x2c558a,_0xa13f42){if(_0x3a1f16[_0xe7fb('0x65')]['id']){delete _0x3a1f16[_0xe7fb('0x65')]['id'];}return db[_0xe7fb('0x54')][_0xe7fb('0x5d')]({'where':{'id':_0x3a1f16['params']['id']}})['then'](handleEntityNotFound(_0x2c558a,null))[_0xe7fb('0x23')](function(_0x3a674e){if(_0x3a674e){_0x3a1f16[_0xe7fb('0x65')]['OpenchannelAccountId']=_0x3a674e['id'];return db['Disposition'][_0xe7fb('0x5e')](_0x3a1f16[_0xe7fb('0x65')]);}})[_0xe7fb('0x23')](respondWithResult(_0x2c558a,null))[_0xe7fb('0x2b')](handleError(_0x2c558a,null));};exports[_0xe7fb('0x68')]=function(_0x336fd3,_0x188e57,_0x3f11f1){var _0xb06693={'raw':![],'where':{}};var _0x3691a6={};var _0x1ff5e7={'count':0x0,'rows':[]};return db[_0xe7fb('0x54')][_0xe7fb('0x69')]({'where':{'id':_0x336fd3['params']['id']}})['then'](handleEntityNotFound(_0x188e57,null))[_0xe7fb('0x23')](function(_0x392dc3){if(_0x392dc3){_0x3691a6[_0xe7fb('0x46')]=_[_0xe7fb('0x48')](db[_0xe7fb('0x6a')]['rawAttributes']);_0x3691a6[_0xe7fb('0x47')]=_[_0xe7fb('0x48')](_0x336fd3[_0xe7fb('0x47')]);_0x3691a6[_0xe7fb('0x49')]=_[_0xe7fb('0x4a')](_0x3691a6[_0xe7fb('0x46')],_0x3691a6[_0xe7fb('0x47')]);_0xb06693[_0xe7fb('0x4c')]=_[_0xe7fb('0x4a')](_0x3691a6['model'],qs[_0xe7fb('0x4b')](_0x336fd3['query'][_0xe7fb('0x4b')]));_0xb06693[_0xe7fb('0x4c')]=_0xb06693[_0xe7fb('0x4c')][_0xe7fb('0x5a')]?_0xb06693[_0xe7fb('0x4c')]:_0x3691a6['model'];if(!_0x336fd3[_0xe7fb('0x47')][_0xe7fb('0x4d')](_0xe7fb('0x4e'))){_0xb06693[_0xe7fb('0x32')]=qs[_0xe7fb('0x32')](_0x336fd3[_0xe7fb('0x47')][_0xe7fb('0x32')]);_0xb06693[_0xe7fb('0x30')]=qs[_0xe7fb('0x30')](_0x336fd3[_0xe7fb('0x47')][_0xe7fb('0x30')]);}_0xb06693[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x336fd3[_0xe7fb('0x47')]['sort']);_0xb06693['where']=qs['filters'](_[_0xe7fb('0x6b')](_0x336fd3[_0xe7fb('0x47')],_0x3691a6[_0xe7fb('0x49')]));_0xb06693[_0xe7fb('0x52')]['OpenchannelAccountId']=_0x392dc3['id'];if(_0x336fd3[_0xe7fb('0x47')][_0xe7fb('0x51')]){_0xb06693[_0xe7fb('0x52')]=_[_0xe7fb('0x6c')](_0xb06693['where'],{'$or':_[_0xe7fb('0x41')](_0xb06693['attributes'],function(_0x1d1f19){var _0x325c51={};_0x325c51[_0x1d1f19]={'$like':'%'+_0x336fd3[_0xe7fb('0x47')][_0xe7fb('0x51')]+'%'};return _0x325c51;})});}_0xb06693=_[_0xe7fb('0x6c')]({},_0xb06693,_0x336fd3['options']);return db[_0xe7fb('0x6a')]['count']({'where':_0xb06693[_0xe7fb('0x52')]})['then'](function(_0x2aeeed){_0x1ff5e7[_0xe7fb('0x55')]=_0x2aeeed;if(_0x336fd3['query'][_0xe7fb('0x5b')]){_0xb06693[_0xe7fb('0x56')]=[{'all':!![]}];}return db[_0xe7fb('0x6a')][_0xe7fb('0x57')](_0xb06693);})['then'](function(_0x82866a){_0x1ff5e7[_0xe7fb('0x58')]=_0x82866a;return _0x1ff5e7;});}})[_0xe7fb('0x23')](respondWithFilteredResult(_0x188e57,_0xb06693))['catch'](handleError(_0x188e57,null));};exports[_0xe7fb('0x6d')]=function(_0x4b2cc4,_0x5b1e28,_0x511bdc){return db[_0xe7fb('0x54')][_0xe7fb('0x5d')]({'where':{'id':_0x4b2cc4['params']['id']}})[_0xe7fb('0x23')](handleEntityNotFound(_0x5b1e28,null))[_0xe7fb('0x23')](function(_0x424399){if(_0x424399){return _0x424399[_0xe7fb('0x6d')](_0x4b2cc4[_0xe7fb('0x47')][_0xe7fb('0x6e')]);}})[_0xe7fb('0x23')](respondWithStatusCode(_0x5b1e28,null))[_0xe7fb('0x2b')](handleError(_0x5b1e28,null));};exports[_0xe7fb('0x6f')]=function(_0x13c779,_0x4071fb,_0x195d8b){if(_0x13c779[_0xe7fb('0x65')]['id']){delete _0x13c779[_0xe7fb('0x65')]['id'];}return db[_0xe7fb('0x54')][_0xe7fb('0x5d')]({'where':{'id':_0x13c779[_0xe7fb('0x59')]['id']}})[_0xe7fb('0x23')](handleEntityNotFound(_0x4071fb,null))[_0xe7fb('0x23')](function(_0x3af3b2){if(_0x3af3b2){_0x13c779['body'][_0xe7fb('0x70')]=_0x3af3b2['id'];return db[_0xe7fb('0x71')][_0xe7fb('0x5e')](_0x13c779[_0xe7fb('0x65')]);}})[_0xe7fb('0x23')](respondWithResult(_0x4071fb,null))[_0xe7fb('0x2b')](handleError(_0x4071fb,null));};exports[_0xe7fb('0x72')]=function(_0x50fc26,_0x4c0e3e,_0x172704){var _0x4e1865={'raw':![],'where':{}};var _0x2f486={};var _0x496205={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xe7fb('0x69')]({'where':{'id':_0x50fc26[_0xe7fb('0x59')]['id']}})[_0xe7fb('0x23')](handleEntityNotFound(_0x4c0e3e,null))[_0xe7fb('0x23')](function(_0x1f5687){if(_0x1f5687){_0x2f486[_0xe7fb('0x46')]=_['keys'](db[_0xe7fb('0x71')][_0xe7fb('0x42')]);_0x2f486[_0xe7fb('0x47')]=_[_0xe7fb('0x48')](_0x50fc26[_0xe7fb('0x47')]);_0x2f486[_0xe7fb('0x49')]=_['intersection'](_0x2f486['model'],_0x2f486['query']);_0x4e1865[_0xe7fb('0x4c')]=_[_0xe7fb('0x4a')](_0x2f486[_0xe7fb('0x46')],qs['fields'](_0x50fc26[_0xe7fb('0x47')]['fields']));_0x4e1865[_0xe7fb('0x4c')]=_0x4e1865[_0xe7fb('0x4c')][_0xe7fb('0x5a')]?_0x4e1865[_0xe7fb('0x4c')]:_0x2f486['model'];if(!_0x50fc26[_0xe7fb('0x47')][_0xe7fb('0x4d')](_0xe7fb('0x4e'))){_0x4e1865[_0xe7fb('0x32')]=qs[_0xe7fb('0x32')](_0x50fc26[_0xe7fb('0x47')][_0xe7fb('0x32')]);_0x4e1865[_0xe7fb('0x30')]=qs['offset'](_0x50fc26['query'][_0xe7fb('0x30')]);}_0x4e1865['order']=qs[_0xe7fb('0x50')](_0x50fc26[_0xe7fb('0x47')][_0xe7fb('0x50')]);_0x4e1865[_0xe7fb('0x52')]=qs['filters'](_['pick'](_0x50fc26[_0xe7fb('0x47')],_0x2f486[_0xe7fb('0x49')]));_0x4e1865['where'][_0xe7fb('0x70')]=_0x1f5687['id'];if(_0x50fc26[_0xe7fb('0x47')][_0xe7fb('0x51')]){_0x4e1865[_0xe7fb('0x52')]=_[_0xe7fb('0x6c')](_0x4e1865[_0xe7fb('0x52')],{'$or':_['map'](_0x4e1865[_0xe7fb('0x4c')],function(_0x1e2cc3){var _0x198956={};_0x198956[_0x1e2cc3]={'$like':'%'+_0x50fc26[_0xe7fb('0x47')][_0xe7fb('0x51')]+'%'};return _0x198956;})});}_0x4e1865=_[_0xe7fb('0x6c')]({},_0x4e1865,_0x50fc26[_0xe7fb('0x5c')]);return db[_0xe7fb('0x71')][_0xe7fb('0x55')]({'where':_0x4e1865[_0xe7fb('0x52')]})[_0xe7fb('0x23')](function(_0x3b1a90){_0x496205[_0xe7fb('0x55')]=_0x3b1a90;if(_0x50fc26[_0xe7fb('0x47')][_0xe7fb('0x5b')]){_0x4e1865[_0xe7fb('0x56')]=[{'all':!![]}];}return db[_0xe7fb('0x71')][_0xe7fb('0x57')](_0x4e1865);})['then'](function(_0x173d85){_0x496205[_0xe7fb('0x58')]=_0x173d85;return _0x496205;});}})[_0xe7fb('0x23')](respondWithFilteredResult(_0x4c0e3e,_0x4e1865))[_0xe7fb('0x2b')](handleError(_0x4c0e3e,null));};exports['removeAnswers']=function(_0x3a7a8c,_0x3649c6,_0x4ca09c){return db[_0xe7fb('0x54')][_0xe7fb('0x5d')]({'where':{'id':_0x3a7a8c[_0xe7fb('0x59')]['id']}})['then'](handleEntityNotFound(_0x3649c6,null))[_0xe7fb('0x23')](function(_0x150dc5){if(_0x150dc5){return _0x150dc5['removeAnswers'](_0x3a7a8c['query'][_0xe7fb('0x6e')]);}})[_0xe7fb('0x23')](respondWithStatusCode(_0x3649c6,null))[_0xe7fb('0x2b')](handleError(_0x3649c6,null));};exports[_0xe7fb('0x73')]=function(_0x31bff7,_0x21e02e,_0x4ef602){var _0x12937e={'body':_0x31bff7[_0xe7fb('0x65')],'channel':_0xe7fb('0x74')};var _0x5f410d=[];var _0x13e9d4=[];var _0x21d4e5={};var _0x465615=![];return db[_0xe7fb('0x75')]['describe']()[_0xe7fb('0x23')](function(_0x1e880d){if(!_0x1e880d){throw new db[(_0xe7fb('0x76'))]['ValidationError'](_0xe7fb('0x77'));}_0x5f410d=_[_0xe7fb('0x78')](_[_0xe7fb('0x48')](_0x1e880d),[_0xe7fb('0x79'),'updatedAt']);_0x13e9d4=_[_0xe7fb('0x78')](_['keys'](_0x1e880d),[_0xe7fb('0x79'),'updatedAt',_0xe7fb('0x7a'),_0xe7fb('0x7b')]);if(_0x31bff7['body']['id']){delete _0x31bff7['body']['id'];}if(_[_0xe7fb('0x7c')](_0x31bff7['body'][_0xe7fb('0x7d')])){throw new db[(_0xe7fb('0x76'))][(_0xe7fb('0x7e'))](_0xe7fb('0x7f'));}if(_['isNil'](_0x31bff7[_0xe7fb('0x65')][_0xe7fb('0x65')])||_0x31bff7[_0xe7fb('0x65')][_0xe7fb('0x65')]===''){throw new db['Sequelize'][(_0xe7fb('0x7e'))](_0xe7fb('0x80'));}if(_[_0xe7fb('0x7c')](_0x31bff7[_0xe7fb('0x65')][_0xe7fb('0x81')])){throw new db['Sequelize'][(_0xe7fb('0x7e'))](_0xe7fb('0x82')+_0x13e9d4);}if(!_[_0xe7fb('0x83')](_0x13e9d4,_0x31bff7[_0xe7fb('0x65')][_0xe7fb('0x81')])){throw new db[(_0xe7fb('0x76'))][(_0xe7fb('0x7e'))](_0xe7fb('0x84')+_0x13e9d4);}_0x21d4e5[_0x31bff7[_0xe7fb('0x65')]['mapKey']]=_0x31bff7[_0xe7fb('0x65')][_0xe7fb('0x7d')];})[_0xe7fb('0x23')](function(){return db[_0xe7fb('0x54')][_0xe7fb('0x5d')]({'where':{'id':_0x31bff7[_0xe7fb('0x59')]['id']},'include':[{'model':db[_0xe7fb('0x85')],'as':'List','include':[{'model':db[_0xe7fb('0x75')],'as':'Contacts','where':_0x21d4e5,'limit':0x1,'order':[[_0xe7fb('0x86'),'DESC']]}]},{'model':db[_0xe7fb('0x87')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x21e02e,null))[_0xe7fb('0x23')](function(_0x5bd869){if(_0x5bd869&&_0x5bd869[_0xe7fb('0x88')]){_0x12937e['account']=_0x5bd869;_0x12937e[_0xe7fb('0x89')]=_0x5bd869[_0xe7fb('0x8a')];_0x12937e[_0xe7fb('0x8b')]=_0x5bd869[_0xe7fb('0x88')];_0x12937e[_0xe7fb('0x89')]=_[_0xe7fb('0x8c')](_0x12937e['applications'],[_0xe7fb('0x8d')],[_0xe7fb('0x8e')]);if(_0x12937e[_0xe7fb('0x8f')][_0xe7fb('0x8a')]){delete _0x12937e[_0xe7fb('0x8f')][_0xe7fb('0x8a')];}if(_0x12937e[_0xe7fb('0x8f')]['List']&&_0x12937e[_0xe7fb('0x8f')][_0xe7fb('0x88')][_0xe7fb('0x90')][_0xe7fb('0x5a')]){return _0x12937e['account'][_0xe7fb('0x88')][_0xe7fb('0x90')][0x0];}var _0x3871d8=_[_0xe7fb('0x1c')](_0x31bff7[_0xe7fb('0x65')],{'firstName':_0x31bff7[_0xe7fb('0x65')][_0xe7fb('0x7d')],'ListId':_0x5bd869['ListId']});_0x3871d8[_0x31bff7['body'][_0xe7fb('0x81')]]=_0x31bff7[_0xe7fb('0x65')]['from'];return db[_0xe7fb('0x75')]['create'](_0x3871d8,{'fields':_0x5f410d,'raw':!![]});}})[_0xe7fb('0x23')](handleEntityNotFound(_0x21e02e,null))[_0xe7fb('0x23')](function(_0x220d72){_0x12937e['contact']=_0x220d72;if(_0x220d72){var _0x53fa3f={'ContactId':_0x220d72['id'],'OpenchannelAccountId':_0x31bff7[_0xe7fb('0x59')]['id'],'from':(_0x220d72['firstName']||'')+'\x20'+(_0x220d72['lastName']||'')};var _0x38fc8b={'OpenchannelAccountId':_0x31bff7[_0xe7fb('0x59')]['id'],'closed':![]};if(_0x31bff7[_0xe7fb('0x65')][_0xe7fb('0x91')]){_0x38fc8b[_0xe7fb('0x91')]=_0x31bff7[_0xe7fb('0x65')][_0xe7fb('0x91')];return db[_0xe7fb('0x92')][_0xe7fb('0x5d')]({'where':_0x38fc8b})[_0xe7fb('0x23')](function(_0x1c9783){if(_0x1c9783){return[_0x1c9783,![]];}_0x53fa3f[_0xe7fb('0x91')]=_0x31bff7[_0xe7fb('0x65')][_0xe7fb('0x91')];_0x53fa3f[_0xe7fb('0x93')]=_0x31bff7[_0xe7fb('0x65')][_0xe7fb('0x93')];return db[_0xe7fb('0x92')][_0xe7fb('0x5e')](_0x53fa3f)['then'](function(_0x405c1b){return[_0x405c1b,!![]];});});}else{_0x38fc8b[_0xe7fb('0x91')]=null;}_0x38fc8b[_0xe7fb('0x94')]=_0x220d72['id'];return db[_0xe7fb('0x92')]['find']({'where':_0x38fc8b})[_0xe7fb('0x23')](function(_0x21ee89){if(_0x21ee89){return[_0x21ee89,![]];}return db[_0xe7fb('0x92')][_0xe7fb('0x5e')](_0x53fa3f)[_0xe7fb('0x23')](function(_0x5549c0){return[_0x5549c0,!![]];});});}})['spread'](function(_0x19e1c2,_0x5322fd){if(_0x19e1c2){_0x465615=_0x5322fd;if(!_0x5322fd){var _0x53c21b={'from':(_0x12937e['contact'][_0xe7fb('0x95')]||'')+'\x20'+(_0x12937e['contact']['lastName']||'')};if(_0x31bff7['body'][_0xe7fb('0x91')]&&_0x31bff7[_0xe7fb('0x65')][_0xe7fb('0x96')]&&_0x31bff7[_0xe7fb('0x65')][_0xe7fb('0x91')]!=_0x31bff7[_0xe7fb('0x65')]['messageId']){_0x53c21b['threadId']=_0x31bff7[_0xe7fb('0x65')]['messageId'];}return _0x19e1c2[_0xe7fb('0x38')](_0x53c21b);}else{return _0x19e1c2;}}})[_0xe7fb('0x23')](function(_0x143b58){_0x12937e[_0xe7fb('0x97')]=_0x143b58[_0xe7fb('0x3a')]({'plain':!![]});_0x12937e[_0xe7fb('0x97')]['created']=_0x465615;if(_0x12937e['interaction'][_0xe7fb('0x98')]){if(_0x12937e[_0xe7fb('0x8f')][_0xe7fb('0x99')]){_0x12937e[_0xe7fb('0x89')][_0xe7fb('0x9a')]({'id':0x0,'priority':_0x12937e[_0xe7fb('0x89')]['length']+0x1,'app':_0xe7fb('0x9b'),'appdata':_0xe7fb('0x9c'),'interval':_0xe7fb('0x9d')});}}return db[_0xe7fb('0x9e')][_0xe7fb('0x5e')]({'body':_0x31bff7['body'][_0xe7fb('0x65')],'OpenchannelAccountId':_0x31bff7[_0xe7fb('0x59')]['id'],'OpenchannelInteractionId':_0x143b58['id'],'direction':'in','ContactId':_0x12937e[_0xe7fb('0x9f')]['id'],'AttachmentId':_0x31bff7['body']['AttachmentId']});})['then'](function(_0x3cae24){_0x12937e['message']=_0x3cae24;if(!_0x12937e['interaction'][_0xe7fb('0xa0')])return;return db['User'][_0xe7fb('0x5d')]({'attributes':['id',_0xe7fb('0x3d')],'where':{'id':_0x12937e[_0xe7fb('0x97')][_0xe7fb('0xa0')]}});})[_0xe7fb('0x23')](function(_0x21951e){if(_0x21951e){_0x12937e[_0xe7fb('0x89')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe7fb('0xa1'),'appdata':_0x21951e[_0xe7fb('0x3d')]+','+(_0x12937e['account'][_0xe7fb('0xa2')]||0xa),'interval':_0xe7fb('0x9d')});}if(!_0x12937e[_0xe7fb('0x97')][_0xe7fb('0xa3')])return;return db[_0xe7fb('0xa4')][_0xe7fb('0x5d')]({'attributes':['id','name'],'where':{'id':_0x12937e[_0xe7fb('0x97')][_0xe7fb('0xa3')]}});})[_0xe7fb('0x23')](function(_0x432bf5){if(_0x432bf5){_0x12937e['applications'][_0xe7fb('0xa5')]({'id':0x0,'priority':0x1,'app':_0xe7fb('0xa6'),'appdata':_0x432bf5[_0xe7fb('0x3d')]+','+(_0x12937e['account'][_0xe7fb('0xa7')]||0x12c),'interval':_0xe7fb('0x9d')});}return respondWithRpcPromise(_0xe7fb('0xa8'),'startRouting',_0x12937e);})[_0xe7fb('0x23')](function(_0xabb003){respondWithRpcPromise('EventManager',_0xe7fb('0xa9'),{'event':_0xe7fb('0x73'),'message':_0xabb003},client9002);return _0xabb003;})['then'](respondWithResult(_0x21e02e,null))[_0xe7fb('0x2b')](handleError(_0x21e02e,null));};exports[_0xe7fb('0xaa')]=function(_0x1fc31b,_0x33ff74){var _0x10bddf=_0x1fc31b['params']['id'];var _0x4faf4f=_0x1fc31b[_0xe7fb('0x65')];var _0x23ec12=0xc8;var _0x3791e2=null;return db[_0xe7fb('0xab')][_0xe7fb('0xac')]({'isolationLevel':db['sequelize'][_0xe7fb('0xad')][_0xe7fb('0xae')]['READ_COMMITTED']},function(_0x49864d){return db[_0xe7fb('0x54')][_0xe7fb('0x69')]({'where':{'id':_0x10bddf},'transaction':_0x49864d})[_0xe7fb('0x23')](function(_0xfd5211){if(_0xfd5211){return db[_0xe7fb('0x87')]['destroy']({'where':{'OpenchannelAccountId':_0x10bddf},'transaction':_0x49864d})[_0xe7fb('0x23')](function(){var _0x157781=_[_0xe7fb('0x41')](_0x4faf4f,function(_0x4841c0){_0x4841c0[_0xe7fb('0x70')]=_0x10bddf;return _0x4841c0;});return db[_0xe7fb('0x87')]['bulkCreate'](_0x157781,{'transaction':_0x49864d});});}else{_0x23ec12=0x194;_0x3791e2=[];}});})[_0xe7fb('0x23')](function(){if(_0x23ec12!==0x194){return db[_0xe7fb('0x87')][_0xe7fb('0xaf')]({'where':{'OpenchannelAccountId':_0x10bddf},'order':_0xe7fb('0x8d')})['then'](function(_0x4ed327){_0x3791e2=_0x4ed327;});}})[_0xe7fb('0x2b')](function(_0x15cb30){_0x23ec12=0x1f4;logger[_0xe7fb('0x28')](_0x15cb30['stack']);if(_0x15cb30[_0xe7fb('0x3d')]){delete _0x15cb30[_0xe7fb('0x3d')];}_0x3791e2=_0x15cb30;})[_0xe7fb('0xb0')](function(){if(_0x3791e2===null){_0x33ff74['sendStatus'](_0x23ec12);}else{if(_0x23ec12===0x1f4){_0x33ff74[_0xe7fb('0x2d')](_0x23ec12)[_0xe7fb('0x3e')](_0x3791e2);}else{_0x33ff74[_0xe7fb('0x2d')](_0x23ec12)['json'](_0x3791e2);}}});};exports[_0xe7fb('0xb1')]=function(_0x186c71,_0x1fc561,_0x15c318){var _0x9295a6={};var _0x208452={};var _0x3c30da;var _0x35ca2c;return db['OpenchannelAccount'][_0xe7fb('0x69')]({'where':{'id':_0x186c71[_0xe7fb('0x59')]['id']}})['then'](handleEntityNotFound(_0x1fc561,null))['then'](function(_0x36b3cd){if(_0x36b3cd){_0x3c30da=_0x36b3cd;_0x208452[_0xe7fb('0x46')]=_[_0xe7fb('0x48')](db[_0xe7fb('0x87')][_0xe7fb('0x42')]);_0x208452[_0xe7fb('0x47')]=_[_0xe7fb('0x48')](_0x186c71['query']);_0x208452[_0xe7fb('0x49')]=_[_0xe7fb('0x4a')](_0x208452[_0xe7fb('0x46')],_0x208452[_0xe7fb('0x47')]);_0x9295a6[_0xe7fb('0x4c')]=_[_0xe7fb('0x4a')](_0x208452[_0xe7fb('0x46')],qs['fields'](_0x186c71[_0xe7fb('0x47')]['fields']));_0x9295a6[_0xe7fb('0x4c')]=_0x9295a6['attributes']['length']?_0x9295a6[_0xe7fb('0x4c')]:_0x208452[_0xe7fb('0x46')];_0x9295a6[_0xe7fb('0x4f')]=qs[_0xe7fb('0x50')](_0x186c71[_0xe7fb('0x47')][_0xe7fb('0x50')]);_0x9295a6[_0xe7fb('0x52')]=qs['filters'](_[_0xe7fb('0x6b')](_0x186c71[_0xe7fb('0x47')],_0x208452[_0xe7fb('0x49')]));if(_0x186c71[_0xe7fb('0x47')][_0xe7fb('0x51')]){_0x9295a6[_0xe7fb('0x52')]=_[_0xe7fb('0x6c')](_0x9295a6['where'],{'$or':_[_0xe7fb('0x41')](_0x9295a6[_0xe7fb('0x4c')],function(_0x353f35){var _0x5b53a5={};_0x5b53a5[_0x353f35]={'$like':'%'+_0x186c71[_0xe7fb('0x47')]['filter']+'%'};return _0x5b53a5;})});}_0x9295a6=_['merge']({},_0x9295a6,_0x186c71['options']);return _0x3c30da[_0xe7fb('0xb1')](_0x9295a6);}})[_0xe7fb('0x23')](function(_0x534ace){if(_0x534ace){_0x35ca2c=_0x534ace[_0xe7fb('0x5a')];if(!_0x186c71[_0xe7fb('0x47')]['hasOwnProperty']('nolimit')){_0x9295a6[_0xe7fb('0x32')]=qs[_0xe7fb('0x32')](_0x186c71[_0xe7fb('0x47')]['limit']);_0x9295a6[_0xe7fb('0x30')]=qs[_0xe7fb('0x30')](_0x186c71['query']['offset']);}return _0x3c30da[_0xe7fb('0xb1')](_0x9295a6);}})['then'](function(_0x51c581){if(_0x51c581){return _0x51c581?{'count':_0x35ca2c,'rows':_0x51c581}:null;}})['then'](respondWithResult(_0x1fc561,null))[_0xe7fb('0x2b')](handleError(_0x1fc561,null));};exports[_0xe7fb('0xb2')]=function(_0x4a7449,_0x35b5ad,_0x55c935){var _0x30de79={'raw':![],'where':{}};var _0x108ffa={};var _0x1f1c2c={'count':0x0,'rows':[]};return db[_0xe7fb('0x54')][_0xe7fb('0x69')]({'where':{'id':_0x4a7449[_0xe7fb('0x59')]['id']}})[_0xe7fb('0x23')](handleEntityNotFound(_0x35b5ad,null))[_0xe7fb('0x23')](function(_0x1672d2){if(_0x1672d2){_0x108ffa[_0xe7fb('0x46')]=_[_0xe7fb('0x48')](db[_0xe7fb('0x92')][_0xe7fb('0x42')]);_0x108ffa['query']=_[_0xe7fb('0x48')](_0x4a7449[_0xe7fb('0x47')]);_0x108ffa['filters']=_['intersection'](_0x108ffa[_0xe7fb('0x46')],_0x108ffa['query']);_0x30de79[_0xe7fb('0x4c')]=_[_0xe7fb('0x4a')](_0x108ffa[_0xe7fb('0x46')],qs[_0xe7fb('0x4b')](_0x4a7449[_0xe7fb('0x47')]['fields']));_0x30de79['attributes']=_0x30de79[_0xe7fb('0x4c')][_0xe7fb('0x5a')]?_0x30de79[_0xe7fb('0x4c')]:_0x108ffa[_0xe7fb('0x46')];if(!_0x4a7449[_0xe7fb('0x47')]['hasOwnProperty'](_0xe7fb('0x4e'))){_0x30de79['limit']=qs[_0xe7fb('0x32')](_0x4a7449[_0xe7fb('0x47')]['limit']);_0x30de79['offset']=qs['offset'](_0x4a7449[_0xe7fb('0x47')][_0xe7fb('0x30')]);}_0x30de79['order']=qs['sort'](_0x4a7449[_0xe7fb('0x47')][_0xe7fb('0x50')]);_0x30de79['where']=qs['filters'](_[_0xe7fb('0x6b')](_0x4a7449[_0xe7fb('0x47')],_0x108ffa[_0xe7fb('0x49')]));_0x30de79[_0xe7fb('0x52')]['OpenchannelAccountId']=_0x1672d2['id'];if(_0x4a7449[_0xe7fb('0x47')][_0xe7fb('0x51')]){_0x30de79[_0xe7fb('0x52')]=_[_0xe7fb('0x6c')](_0x30de79[_0xe7fb('0x52')],{'$or':_['map'](_0x30de79['attributes'],function(_0x14c767){var _0x3723a1={};_0x3723a1[_0x14c767]={'$like':'%'+_0x4a7449[_0xe7fb('0x47')][_0xe7fb('0x51')]+'%'};return _0x3723a1;})});}_0x30de79=_[_0xe7fb('0x6c')]({},_0x30de79,_0x4a7449['options']);return db[_0xe7fb('0x92')]['count']({'where':_0x30de79['where']})[_0xe7fb('0x23')](function(_0xfa7f16){_0x1f1c2c[_0xe7fb('0x55')]=_0xfa7f16;if(_0x4a7449[_0xe7fb('0x47')]['includeAll']){_0x30de79[_0xe7fb('0x56')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xe7fb('0xb3')],'as':_0xe7fb('0xb4'),'attributes':[_0xe7fb('0x3d'),_0xe7fb('0xb5'),_0xe7fb('0xb6')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xe7fb('0x3d'),'color'],'where':_0x4a7449['query'][_0xe7fb('0xb7')]?{'id':_0x4a7449['query']['tag']}:undefined,'required':_0x4a7449[_0xe7fb('0x47')][_0xe7fb('0xb7')]?!![]:![]}];}return db[_0xe7fb('0x92')][_0xe7fb('0x57')](_0x30de79);})[_0xe7fb('0x23')](function(_0x4df837){_0x1f1c2c[_0xe7fb('0x58')]=_0x4df837;return _0x1f1c2c;});}})['then'](respondWithFilteredResult(_0x35b5ad,_0x30de79))['catch'](handleError(_0x35b5ad,null));};exports[_0xe7fb('0xb8')]=function(_0x28274b,_0x414e72,_0x16fc08){return db[_0xe7fb('0x54')][_0xe7fb('0x5d')]({'where':{'id':_0x28274b[_0xe7fb('0x59')]['id']}})['then'](handleEntityNotFound(_0x414e72,null))['then'](function(_0xf2bdf7){if(_0xf2bdf7){return _0xf2bdf7['addAgents'](_0x28274b[_0xe7fb('0x65')]['ids'],_[_0xe7fb('0xb9')](_0x28274b['body'],[_0xe7fb('0x6e'),'id'])||{})[_0xe7fb('0xba')](function(_0x56869b){for(var _0x2139e3=0x0;_0x2139e3<_0x28274b[_0xe7fb('0x65')][_0xe7fb('0x6e')][_0xe7fb('0x5a')];_0x2139e3+=0x1){socket['emit'](_0xe7fb('0xbb'),{'UserId':Number(_0x28274b[_0xe7fb('0x65')][_0xe7fb('0x6e')][_0x2139e3]),'OpenchannelAccountId':Number(_0x28274b[_0xe7fb('0x59')]['id'])});}return _0x56869b;});}})[_0xe7fb('0x23')](respondWithResult(_0x414e72,null))['catch'](handleError(_0x414e72,null));};exports[_0xe7fb('0xbc')]=function(_0x40e8fc,_0x243756,_0x2c62bb){return db[_0xe7fb('0x54')][_0xe7fb('0x5d')]({'where':{'id':_0x40e8fc[_0xe7fb('0x59')]['id']}})[_0xe7fb('0x23')](handleEntityNotFound(_0x243756,null))[_0xe7fb('0x23')](function(_0x3edf30){if(_0x3edf30){return _0x3edf30[_0xe7fb('0xbc')](_0x40e8fc[_0xe7fb('0x47')][_0xe7fb('0x6e')])[_0xe7fb('0x23')](function(){if(_[_0xe7fb('0xbd')](_0x40e8fc['query']['ids'])){for(var _0x3f4ea8=0x0;_0x3f4ea8<_0x40e8fc[_0xe7fb('0x47')][_0xe7fb('0x6e')][_0xe7fb('0x5a')];_0x3f4ea8+=0x1){socket[_0xe7fb('0xbe')](_0xe7fb('0xbf'),{'UserId':Number(_0x40e8fc[_0xe7fb('0x47')][_0xe7fb('0x6e')][_0x3f4ea8]),'OpenchannelAccountId':Number(_0x40e8fc['params']['id'])});}}else{socket[_0xe7fb('0xbe')](_0xe7fb('0xbf'),{'UserId':Number(_0x40e8fc[_0xe7fb('0x47')][_0xe7fb('0x6e')]),'OpenchannelAccountId':Number(_0x40e8fc[_0xe7fb('0x59')]['id'])});}});}})[_0xe7fb('0x23')](respondWithStatusCode(_0x243756,null))['catch'](handleError(_0x243756,null));};exports[_0xe7fb('0xc0')]=function(_0x2583d0,_0x520871,_0x4046bc){var _0x5dde83={};var _0x21d86e={};var _0x50dbd3;var _0x8bd885;return db[_0xe7fb('0x54')]['findOne']({'where':{'id':_0x2583d0[_0xe7fb('0x59')]['id']}})[_0xe7fb('0x23')](handleEntityNotFound(_0x520871,null))['then'](function(_0x487f44){if(_0x487f44){_0x50dbd3=_0x487f44;_0x21d86e['model']=_['keys'](db[_0xe7fb('0xb3')][_0xe7fb('0x42')]);_0x21d86e[_0xe7fb('0x47')]=_[_0xe7fb('0x48')](_0x2583d0[_0xe7fb('0x47')]);_0x21d86e[_0xe7fb('0x49')]=_['intersection'](_0x21d86e[_0xe7fb('0x46')],_0x21d86e[_0xe7fb('0x47')]);_0x5dde83[_0xe7fb('0x4c')]=_['intersection'](_0x21d86e[_0xe7fb('0x46')],qs['fields'](_0x2583d0[_0xe7fb('0x47')]['fields']));_0x5dde83['attributes']=_0x5dde83[_0xe7fb('0x4c')][_0xe7fb('0x5a')]?_0x5dde83[_0xe7fb('0x4c')]:_0x21d86e[_0xe7fb('0x46')];_0x5dde83['order']=qs[_0xe7fb('0x50')](_0x2583d0[_0xe7fb('0x47')][_0xe7fb('0x50')]);_0x5dde83[_0xe7fb('0x52')]=qs[_0xe7fb('0x49')](_[_0xe7fb('0x6b')](_0x2583d0[_0xe7fb('0x47')],_0x21d86e[_0xe7fb('0x49')]));if(_0x2583d0[_0xe7fb('0x47')][_0xe7fb('0x51')]){_0x5dde83[_0xe7fb('0x52')]=_[_0xe7fb('0x6c')](_0x5dde83[_0xe7fb('0x52')],{'$or':_[_0xe7fb('0x41')](_0x5dde83[_0xe7fb('0x4c')],function(_0x22447e){var _0x3991d6={};_0x3991d6[_0x22447e]={'$like':'%'+_0x2583d0['query'][_0xe7fb('0x51')]+'%'};return _0x3991d6;})});}_0x5dde83=_[_0xe7fb('0x6c')]({},_0x5dde83,_0x2583d0['options']);return _0x50dbd3[_0xe7fb('0xc0')](_0x5dde83);}})[_0xe7fb('0x23')](function(_0x212562){if(_0x212562){_0x8bd885=_0x212562['length'];if(!_0x2583d0[_0xe7fb('0x47')][_0xe7fb('0x4d')](_0xe7fb('0x4e'))){_0x5dde83[_0xe7fb('0x32')]=qs[_0xe7fb('0x32')](_0x2583d0[_0xe7fb('0x47')]['limit']);_0x5dde83[_0xe7fb('0x30')]=qs[_0xe7fb('0x30')](_0x2583d0[_0xe7fb('0x47')]['offset']);}return _0x50dbd3[_0xe7fb('0xc0')](_0x5dde83);}})[_0xe7fb('0x23')](function(_0x268270){if(_0x268270){return _0x268270?{'count':_0x8bd885,'rows':_0x268270}:null;}})[_0xe7fb('0x23')](respondWithResult(_0x520871,null))['catch'](handleError(_0x520871,null));};exports[_0xe7fb('0x3e')]=function(_0x17ade0,_0x46ddc4,_0x39ffed){var _0x47e833,_0x527617,_0x6690b2;if(_[_0xe7fb('0x7c')](_0x17ade0[_0xe7fb('0x65')][_0xe7fb('0x65')])||_0x17ade0['body']['body']===''){throw new db[(_0xe7fb('0x76'))]['ValidationError'](_0xe7fb('0x80'));}if(_['isNil'](_0x17ade0[_0xe7fb('0x65')]['to'])){}_0x47e833=_0x17ade0[_0xe7fb('0x65')]['to'];return db[_0xe7fb('0x54')][_0xe7fb('0x69')]({'where':{'id':_0x17ade0[_0xe7fb('0x59')]['id']}})[_0xe7fb('0x23')](handleEntityNotFound(_0x46ddc4,null))[_0xe7fb('0x23')](function(_0x377cd0){if(_0x377cd0){return db[_0xe7fb('0x54')][_0xe7fb('0x5d')]({'where':{'id':_0x377cd0['id']},'include':[{'model':db[_0xe7fb('0x85')],'as':_0xe7fb('0x88'),'include':[{'model':db[_0xe7fb('0x75')],'as':_0xe7fb('0x90'),'where':{[_0x377cd0['mapKey']]:_0x47e833},'limit':0x1,'order':[[_0xe7fb('0x86'),_0xe7fb('0xc1')]]}]}]})[_0xe7fb('0x23')](handleEntityNotFound(_0x46ddc4,null))[_0xe7fb('0x23')](function(_0x582862){if(_0x582862&&_0x582862['List']){_0x527617=_0x582862[_0xe7fb('0x3a')]({'plain':!![]});if(_0x527617[_0xe7fb('0x88')]&&_0x527617[_0xe7fb('0x88')][_0xe7fb('0x90')]['length']){return _0x527617['List'][_0xe7fb('0x90')][0x0];}return db[_0xe7fb('0x75')][_0xe7fb('0x5e')](_[_0xe7fb('0x1c')](_0x17ade0[_0xe7fb('0x65')],{'firstName':_0x47e833,[_0x582862[_0xe7fb('0x81')]]:_0x47e833,'phone':_0x47e833,'ListId':_0x527617[_0xe7fb('0x7b')]}));}})[_0xe7fb('0x23')](handleEntityNotFound(_0x46ddc4,null))[_0xe7fb('0x23')](function(_0xc8055f){if(_0xc8055f){_0x6690b2=_0xc8055f;return db[_0xe7fb('0x92')]['find']({'where':{'ContactId':_0x6690b2['id'],'closed':![],'OpenchannelAccountId':_0x527617['id']}})[_0xe7fb('0x23')](function(_0x3381a8){if(_0x3381a8){return[_0x3381a8,![]];}return db[_0xe7fb('0x92')][_0xe7fb('0x5e')]({'UserId':_0x17ade0[_0xe7fb('0x61')]['id'],'ContactId':_0x6690b2['id'],'OpenchannelAccountId':_0x527617['id'],'lastMsgDirection':_0xe7fb('0xc2'),'firstMsgDirection':_0xe7fb('0xc2'),'Messages':[_[_0xe7fb('0x6c')](_0x17ade0['body'],{'read':![],'body':_0x17ade0[_0xe7fb('0x65')][_0xe7fb('0x65')],'OpenchannelAccountId':_0x527617['id'],'UserId':_0x17ade0[_0xe7fb('0x61')]['id'],'ContactId':_0x6690b2['id']})]},{'include':[{'model':db[_0xe7fb('0x9e')],'as':'Messages'}]})[_0xe7fb('0x23')](function(_0x43debb){return[_0x43debb,!![]];});});}})[_0xe7fb('0xba')](function(_0x3d4bb1,_0x9e86b7){if(_0x9e86b7){return _0x3d4bb1;}return db[_0xe7fb('0x9e')][_0xe7fb('0x5e')](_[_0xe7fb('0x6c')](_0x17ade0['body'],{'read':![],'body':_0x17ade0[_0xe7fb('0x65')][_0xe7fb('0x65')],'OpenchannelAccountId':_0x527617['id'],'OpenchannelInteractionId':_0x3d4bb1['id'],'UserId':_0x17ade0[_0xe7fb('0x61')]['id'],'ContactId':_0x6690b2['id']}))[_0xe7fb('0x23')](function(_0x5e98b1){_0x3d4bb1[_0xe7fb('0xc3')][_0xe7fb('0xc4')]=[];_0x3d4bb1[_0xe7fb('0xc3')][_0xe7fb('0xc4')][_0xe7fb('0x9a')](_0x5e98b1[_0xe7fb('0xc3')]);return _0x3d4bb1;});});}})[_0xe7fb('0x23')](respondWithResult(_0x46ddc4,null))['catch'](handleError(_0x46ddc4,null));}; \ No newline at end of file +var _0xa423=['socket.io-emitter','./openchannelAccount.socket','register','client','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','index','Pause','rawAttributes','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','where','pick','filter','map','type','VIRTUAL','merge','options','OpenchannelAccount','includeAll','include','findAll','rows','show','mandatoryDispositionPause','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','Disposition','findOne','nolimit','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','OpenchannelApplication','List','applications','Applications','asc','account','Contacts','defaults','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','spread','messageId','interaction','created','autoclose','push','close','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queue','waitForTheAssignedQueue','EventManager','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','finally','send','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost'];(function(_0xf945c7,_0x298d9a){var _0x3ef75c=function(_0x252670){while(--_0x252670){_0xf945c7['push'](_0xf945c7['shift']());}};_0x3ef75c(++_0x298d9a);}(_0xa423,0x16c));var _0x3a42=function(_0x35e083,_0x2a67b7){_0x35e083=_0x35e083-0x0;var _0x4c1d88=_0xa423[_0x35e083];return _0x4c1d88;};'use strict';var emlformat=require(_0x3a42('0x0'));var rimraf=require(_0x3a42('0x1'));var zipdir=require(_0x3a42('0x2'));var jsonpatch=require(_0x3a42('0x3'));var rp=require(_0x3a42('0x4'));var moment=require('moment');var BPromise=require(_0x3a42('0x5'));var Mustache=require(_0x3a42('0x6'));var util=require('util');var path=require(_0x3a42('0x7'));var sox=require(_0x3a42('0x8'));var csv=require(_0x3a42('0x9'));var ejs=require(_0x3a42('0xa'));var fs=require('fs');var fs_extra=require(_0x3a42('0xb'));var _=require('lodash');var squel=require(_0x3a42('0xc'));var crypto=require(_0x3a42('0xd'));var jsforce=require(_0x3a42('0xe'));var deskjs=require(_0x3a42('0xf'));var toCsv=require(_0x3a42('0x9'));var querystring=require(_0x3a42('0x10'));var Papa=require(_0x3a42('0x11'));var Redis=require(_0x3a42('0x12'));var authService=require(_0x3a42('0x13'));var qs=require(_0x3a42('0x14'));var as=require(_0x3a42('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a42('0x16'))(_0x3a42('0x17'));var utils=require(_0x3a42('0x18'));var config=require(_0x3a42('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3a42('0x1a')]=_['defaults'](config[_0x3a42('0x1a')],{'host':_0x3a42('0x1b'),'port':0x18eb});var socket=require(_0x3a42('0x1c'))(new Redis(config[_0x3a42('0x1a')]));require(_0x3a42('0x1d'))[_0x3a42('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3a42('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x3a42('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e5d77,_0x5895a8,_0x46ef1e,_0x4edcf5){return new BPromise(function(_0x486c74,_0x4eae89){var _0x26c844=_0x4edcf5||client;return _0x26c844[_0x3a42('0x20')](_0x3e5d77,_0x46ef1e)[_0x3a42('0x21')](function(_0x39e620){logger[_0x3a42('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x5895a8,_0x3a42('0x23'));logger[_0x3a42('0x24')](_0x3a42('0x25'),_0x5895a8,_0x3a42('0x23'),JSON[_0x3a42('0x26')](_0x39e620));if(_0x39e620[_0x3a42('0x27')]){if(_0x39e620['error'][_0x3a42('0x28')]===0x1f4){logger[_0x3a42('0x27')](_0x3a42('0x29'),_0x5895a8,_0x39e620[_0x3a42('0x27')][_0x3a42('0x2a')]);return _0x4eae89(_0x39e620['error'][_0x3a42('0x2a')]);}logger[_0x3a42('0x27')](_0x3a42('0x29'),_0x5895a8,_0x39e620[_0x3a42('0x27')][_0x3a42('0x2a')]);return _0x486c74(_0x39e620['error'][_0x3a42('0x2a')]);}else{logger[_0x3a42('0x22')](_0x3a42('0x29'),_0x5895a8,_0x3a42('0x23'));_0x486c74(_0x39e620[_0x3a42('0x2b')][_0x3a42('0x2a')]);}})[_0x3a42('0x2c')](function(_0x434044){logger[_0x3a42('0x27')](_0x3a42('0x29'),_0x5895a8,_0x434044);_0x4eae89(_0x434044);});});}function respondWithStatusCode(_0x29a4d0,_0x510c93){_0x510c93=_0x510c93||0xcc;return function(_0x222f88){if(_0x222f88){return _0x29a4d0[_0x3a42('0x2d')](_0x510c93);}return _0x29a4d0['status'](_0x510c93)[_0x3a42('0x2e')]();};}function respondWithResult(_0x5b5897,_0x462a56){_0x462a56=_0x462a56||0xc8;return function(_0x2a4878){if(_0x2a4878){return _0x5b5897[_0x3a42('0x2f')](_0x462a56)[_0x3a42('0x30')](_0x2a4878);}};}function respondWithFilteredResult(_0x1559cd,_0xaf28ad){return function(_0x4b8fe7){if(_0x4b8fe7){var _0x175fc4=typeof _0xaf28ad[_0x3a42('0x31')]===_0x3a42('0x32')&&typeof _0xaf28ad[_0x3a42('0x33')]===_0x3a42('0x32');var _0x44ef39=_0x4b8fe7[_0x3a42('0x34')];var _0x56ee5d=_0x175fc4?0x0:_0xaf28ad[_0x3a42('0x31')];var _0x3e7442=_0x175fc4?_0x4b8fe7[_0x3a42('0x34')]:_0xaf28ad[_0x3a42('0x31')]+_0xaf28ad[_0x3a42('0x33')];var _0x50ece0;if(_0x3e7442>=_0x44ef39){_0x3e7442=_0x44ef39;_0x50ece0=0xc8;}else{_0x50ece0=0xce;}_0x1559cd['status'](_0x50ece0);return _0x1559cd[_0x3a42('0x35')]('Content-Range',_0x56ee5d+'-'+_0x3e7442+'/'+_0x44ef39)[_0x3a42('0x30')](_0x4b8fe7);}return null;};}function patchUpdates(_0x2e6fb3){return function(_0x2bbfe4){try{jsonpatch[_0x3a42('0x36')](_0x2bbfe4,_0x2e6fb3,!![]);}catch(_0x37defa){return BPromise[_0x3a42('0x37')](_0x37defa);}return _0x2bbfe4['save']();};}function saveUpdates(_0x1935cf,_0x1c92e2){return function(_0x412d65){if(_0x412d65){return _0x412d65['update'](_0x1935cf)['then'](function(_0x41df56){return _0x41df56;});}return null;};}function removeEntity(_0x3f21ed,_0xb2f1d3){return function(_0xe51e6){if(_0xe51e6){return _0xe51e6[_0x3a42('0x38')]()['then'](function(){var _0x528cce=_0xe51e6[_0x3a42('0x39')]({'plain':!![]});var _0x153801=_0x3a42('0x3a');return db[_0x3a42('0x3b')]['destroy']({'where':{'type':_0x153801,'resourceId':_0x528cce['id']}})[_0x3a42('0x21')](function(){return _0xe51e6;});})[_0x3a42('0x21')](function(){_0x3f21ed['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5079a4,_0x199a39){return function(_0x4ca6a9){if(!_0x4ca6a9){_0x5079a4[_0x3a42('0x2d')](0x194);}return _0x4ca6a9;};}function handleError(_0x14ebbe,_0x29312e){_0x29312e=_0x29312e||0x1f4;return function(_0x1fcbcb){logger[_0x3a42('0x27')](_0x1fcbcb[_0x3a42('0x3c')]);if(_0x1fcbcb[_0x3a42('0x3d')]){delete _0x1fcbcb[_0x3a42('0x3d')];}_0x14ebbe[_0x3a42('0x2f')](_0x29312e)['send'](_0x1fcbcb);};}exports[_0x3a42('0x3e')]=function(_0x3a33f3,_0x2541db){var _0xd3ee22={'include':[{'model':db[_0x3a42('0x3f')],'as':'mandatoryDispositionPause'}]},_0x38e3fe={},_0x567043={'count':0x0,'rows':[]};var _0x4e9224=_['map'](db['OpenchannelAccount'][_0x3a42('0x40')],function(_0x47dbb7){return{'name':_0x47dbb7['fieldName'],'type':_0x47dbb7['type'][_0x3a42('0x41')]};});_0x38e3fe['model']=_['map'](_0x4e9224,_0x3a42('0x3d'));_0x38e3fe[_0x3a42('0x42')]=_[_0x3a42('0x43')](_0x3a33f3[_0x3a42('0x42')]);_0x38e3fe[_0x3a42('0x44')]=_[_0x3a42('0x45')](_0x38e3fe['model'],_0x38e3fe[_0x3a42('0x42')]);_0xd3ee22[_0x3a42('0x46')]=_[_0x3a42('0x45')](_0x38e3fe['model'],qs[_0x3a42('0x47')](_0x3a33f3[_0x3a42('0x42')]['fields']));_0xd3ee22[_0x3a42('0x46')]=_0xd3ee22[_0x3a42('0x46')][_0x3a42('0x48')]?_0xd3ee22[_0x3a42('0x46')]:_0x38e3fe[_0x3a42('0x49')];if(!_0x3a33f3[_0x3a42('0x42')][_0x3a42('0x4a')]('nolimit')){_0xd3ee22[_0x3a42('0x33')]=qs[_0x3a42('0x33')](_0x3a33f3[_0x3a42('0x42')][_0x3a42('0x33')]);_0xd3ee22[_0x3a42('0x31')]=qs['offset'](_0x3a33f3[_0x3a42('0x42')][_0x3a42('0x31')]);}_0xd3ee22[_0x3a42('0x4b')]=qs['sort'](_0x3a33f3[_0x3a42('0x42')][_0x3a42('0x4c')]);_0xd3ee22[_0x3a42('0x4d')]=qs[_0x3a42('0x44')](_[_0x3a42('0x4e')](_0x3a33f3['query'],_0x38e3fe[_0x3a42('0x44')]),_0x4e9224);if(_0x3a33f3[_0x3a42('0x42')][_0x3a42('0x4f')]){_0xd3ee22[_0x3a42('0x4d')]=_['merge'](_0xd3ee22[_0x3a42('0x4d')],{'$or':_[_0x3a42('0x50')](_0x4e9224,function(_0x3d4897){if(_0x3d4897[_0x3a42('0x51')]!==_0x3a42('0x52')){var _0x9799a={};_0x9799a[_0x3d4897[_0x3a42('0x3d')]]={'$like':'%'+_0x3a33f3['query'][_0x3a42('0x4f')]+'%'};return _0x9799a;}})});}_0xd3ee22=_[_0x3a42('0x53')]({},_0xd3ee22,_0x3a33f3[_0x3a42('0x54')]);var _0x1f9912={'where':_0xd3ee22[_0x3a42('0x4d')]};return db[_0x3a42('0x55')]['count'](_0x1f9912)[_0x3a42('0x21')](function(_0x5e5af8){_0x567043[_0x3a42('0x34')]=_0x5e5af8;if(_0x3a33f3[_0x3a42('0x42')][_0x3a42('0x56')]){_0xd3ee22[_0x3a42('0x57')]=[{'all':!![]}];}return db[_0x3a42('0x55')][_0x3a42('0x58')](_0xd3ee22);})[_0x3a42('0x21')](function(_0x36dbb3){_0x567043[_0x3a42('0x59')]=_0x36dbb3;return _0x567043;})['then'](respondWithFilteredResult(_0x2541db,_0xd3ee22))[_0x3a42('0x2c')](handleError(_0x2541db,null));};exports[_0x3a42('0x5a')]=function(_0x55eceb,_0x583029){var _0x1019db={'raw':![],'where':{'id':_0x55eceb['params']['id']},'include':[{'model':db[_0x3a42('0x3f')],'as':_0x3a42('0x5b')}]},_0xb752a5={};_0xb752a5[_0x3a42('0x49')]=_['keys'](db[_0x3a42('0x55')][_0x3a42('0x40')]);_0xb752a5['query']=_[_0x3a42('0x43')](_0x55eceb['query']);_0xb752a5[_0x3a42('0x44')]=_[_0x3a42('0x45')](_0xb752a5['model'],_0xb752a5[_0x3a42('0x42')]);_0x1019db[_0x3a42('0x46')]=_[_0x3a42('0x45')](_0xb752a5[_0x3a42('0x49')],qs[_0x3a42('0x47')](_0x55eceb[_0x3a42('0x42')][_0x3a42('0x47')]));_0x1019db[_0x3a42('0x46')]=_0x1019db[_0x3a42('0x46')][_0x3a42('0x48')]?_0x1019db['attributes']:_0xb752a5[_0x3a42('0x49')];if(_0x55eceb[_0x3a42('0x42')][_0x3a42('0x56')]){_0x1019db[_0x3a42('0x57')]=[{'all':!![]}];}_0x1019db=_[_0x3a42('0x53')]({},_0x1019db,_0x55eceb['options']);return db[_0x3a42('0x55')][_0x3a42('0x5c')](_0x1019db)[_0x3a42('0x21')](handleEntityNotFound(_0x583029,null))['then'](respondWithResult(_0x583029,null))[_0x3a42('0x2c')](handleError(_0x583029,null));};exports[_0x3a42('0x5d')]=function(_0x596e9e,_0x190563){return db[_0x3a42('0x55')][_0x3a42('0x5d')](_0x596e9e[_0x3a42('0x5e')],{})[_0x3a42('0x21')](function(_0x1b74c7){var _0x52c6af=_0x596e9e['user']['get']({'plain':!![]});if(!_0x52c6af)throw new Error(_0x3a42('0x5f'));if(_0x52c6af[_0x3a42('0x60')]===_0x3a42('0x61')){var _0x46cd72=_0x1b74c7['get']({'plain':!![]});var _0x376aa0=_0x3a42('0x3a');return db[_0x3a42('0x62')]['find']({'where':{'name':_0x376aa0,'userProfileId':_0x52c6af[_0x3a42('0x63')]},'raw':!![]})[_0x3a42('0x21')](function(_0x5abb21){if(_0x5abb21&&_0x5abb21[_0x3a42('0x64')]===0x0){return db[_0x3a42('0x3b')][_0x3a42('0x5d')]({'name':_0x46cd72[_0x3a42('0x3d')],'resourceId':_0x46cd72['id'],'type':_0x5abb21[_0x3a42('0x3d')],'sectionId':_0x5abb21['id']},{})[_0x3a42('0x21')](function(){return _0x1b74c7;});}else{return _0x1b74c7;}})[_0x3a42('0x2c')](function(_0x3fbf45){logger[_0x3a42('0x27')](_0x3a42('0x65'),_0x3fbf45);throw _0x3fbf45;});}return _0x1b74c7;})[_0x3a42('0x21')](respondWithResult(_0x190563,0xc9))[_0x3a42('0x2c')](handleError(_0x190563,null));};exports[_0x3a42('0x66')]=function(_0xaf2a8,_0xb6b0a){if(_0xaf2a8[_0x3a42('0x5e')]['id']){delete _0xaf2a8[_0x3a42('0x5e')]['id'];}return db[_0x3a42('0x55')]['find']({'where':{'id':_0xaf2a8[_0x3a42('0x67')]['id']},'include':[{'model':db[_0x3a42('0x3f')],'as':_0x3a42('0x5b')}]})['then'](handleEntityNotFound(_0xb6b0a,null))['then'](saveUpdates(_0xaf2a8['body'],null))[_0x3a42('0x21')](respondWithResult(_0xb6b0a,null))[_0x3a42('0x2c')](handleError(_0xb6b0a,null));};exports[_0x3a42('0x38')]=function(_0x1e665a,_0x20008b){return db[_0x3a42('0x55')][_0x3a42('0x5c')]({'where':{'id':_0x1e665a['params']['id']}})[_0x3a42('0x21')](handleEntityNotFound(_0x20008b,null))[_0x3a42('0x21')](removeEntity(_0x20008b,null))['catch'](handleError(_0x20008b,null));};exports[_0x3a42('0x68')]=function(_0x209493,_0x531dbc){return db[_0x3a42('0x55')]['describe']()[_0x3a42('0x21')](respondWithResult(_0x531dbc,null))['catch'](handleError(_0x531dbc,null));};exports[_0x3a42('0x69')]=function(_0xfb5739,_0xfbd35a,_0x9621ee){if(_0xfb5739[_0x3a42('0x5e')]['id']){delete _0xfb5739[_0x3a42('0x5e')]['id'];}return db[_0x3a42('0x55')]['find']({'where':{'id':_0xfb5739[_0x3a42('0x67')]['id']}})[_0x3a42('0x21')](handleEntityNotFound(_0xfbd35a,null))['then'](function(_0x9c3224){if(_0x9c3224){_0xfb5739[_0x3a42('0x5e')]['OpenchannelAccountId']=_0x9c3224['id'];return db[_0x3a42('0x6a')][_0x3a42('0x5d')](_0xfb5739[_0x3a42('0x5e')]);}})[_0x3a42('0x21')](respondWithResult(_0xfbd35a,null))[_0x3a42('0x2c')](handleError(_0xfbd35a,null));};exports['getDispositions']=function(_0x5cfdaa,_0x78d77f,_0x248bb9){var _0x12e3f1={'raw':![],'where':{}};var _0x55f4df={};var _0x4c2025={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x3a42('0x6b')]({'where':{'id':_0x5cfdaa['params']['id']}})[_0x3a42('0x21')](handleEntityNotFound(_0x78d77f,null))['then'](function(_0x698e0){if(_0x698e0){_0x55f4df['model']=_['keys'](db[_0x3a42('0x6a')]['rawAttributes']);_0x55f4df[_0x3a42('0x42')]=_['keys'](_0x5cfdaa['query']);_0x55f4df[_0x3a42('0x44')]=_[_0x3a42('0x45')](_0x55f4df[_0x3a42('0x49')],_0x55f4df[_0x3a42('0x42')]);_0x12e3f1['attributes']=_[_0x3a42('0x45')](_0x55f4df[_0x3a42('0x49')],qs[_0x3a42('0x47')](_0x5cfdaa['query'][_0x3a42('0x47')]));_0x12e3f1[_0x3a42('0x46')]=_0x12e3f1['attributes'][_0x3a42('0x48')]?_0x12e3f1[_0x3a42('0x46')]:_0x55f4df[_0x3a42('0x49')];if(!_0x5cfdaa[_0x3a42('0x42')][_0x3a42('0x4a')](_0x3a42('0x6c'))){_0x12e3f1['limit']=qs[_0x3a42('0x33')](_0x5cfdaa['query'][_0x3a42('0x33')]);_0x12e3f1[_0x3a42('0x31')]=qs['offset'](_0x5cfdaa[_0x3a42('0x42')]['offset']);}_0x12e3f1[_0x3a42('0x4b')]=qs[_0x3a42('0x4c')](_0x5cfdaa[_0x3a42('0x42')][_0x3a42('0x4c')]);_0x12e3f1['where']=qs[_0x3a42('0x44')](_[_0x3a42('0x4e')](_0x5cfdaa[_0x3a42('0x42')],_0x55f4df['filters']));_0x12e3f1[_0x3a42('0x4d')][_0x3a42('0x6d')]=_0x698e0['id'];if(_0x5cfdaa[_0x3a42('0x42')][_0x3a42('0x4f')]){_0x12e3f1[_0x3a42('0x4d')]=_[_0x3a42('0x53')](_0x12e3f1['where'],{'$or':_[_0x3a42('0x50')](_0x12e3f1[_0x3a42('0x46')],function(_0x541a15){var _0x75de0e={};_0x75de0e[_0x541a15]={'$like':'%'+_0x5cfdaa[_0x3a42('0x42')][_0x3a42('0x4f')]+'%'};return _0x75de0e;})});}_0x12e3f1=_[_0x3a42('0x53')]({},_0x12e3f1,_0x5cfdaa['options']);return db[_0x3a42('0x6a')][_0x3a42('0x34')]({'where':_0x12e3f1[_0x3a42('0x4d')]})[_0x3a42('0x21')](function(_0x997202){_0x4c2025[_0x3a42('0x34')]=_0x997202;if(_0x5cfdaa[_0x3a42('0x42')][_0x3a42('0x56')]){_0x12e3f1[_0x3a42('0x57')]=[{'all':!![]}];}return db[_0x3a42('0x6a')]['findAll'](_0x12e3f1);})[_0x3a42('0x21')](function(_0x5725aa){_0x4c2025[_0x3a42('0x59')]=_0x5725aa;return _0x4c2025;});}})['then'](respondWithFilteredResult(_0x78d77f,_0x12e3f1))[_0x3a42('0x2c')](handleError(_0x78d77f,null));};exports[_0x3a42('0x6e')]=function(_0x39a9e7,_0x596911,_0x176cb4){return db[_0x3a42('0x55')][_0x3a42('0x5c')]({'where':{'id':_0x39a9e7[_0x3a42('0x67')]['id']}})[_0x3a42('0x21')](handleEntityNotFound(_0x596911,null))[_0x3a42('0x21')](function(_0x8bcc02){if(_0x8bcc02){return _0x8bcc02['removeDispositions'](_0x39a9e7[_0x3a42('0x42')][_0x3a42('0x6f')]);}})['then'](respondWithStatusCode(_0x596911,null))[_0x3a42('0x2c')](handleError(_0x596911,null));};exports[_0x3a42('0x70')]=function(_0x36c223,_0x5a8ecd,_0x1ea0b3){if(_0x36c223[_0x3a42('0x5e')]['id']){delete _0x36c223[_0x3a42('0x5e')]['id'];}return db[_0x3a42('0x55')]['find']({'where':{'id':_0x36c223[_0x3a42('0x67')]['id']}})[_0x3a42('0x21')](handleEntityNotFound(_0x5a8ecd,null))[_0x3a42('0x21')](function(_0x118d23){if(_0x118d23){_0x36c223['body'][_0x3a42('0x6d')]=_0x118d23['id'];return db[_0x3a42('0x71')][_0x3a42('0x5d')](_0x36c223[_0x3a42('0x5e')]);}})[_0x3a42('0x21')](respondWithResult(_0x5a8ecd,null))[_0x3a42('0x2c')](handleError(_0x5a8ecd,null));};exports[_0x3a42('0x72')]=function(_0x1337e1,_0x31bd65,_0x1c3e87){var _0x400d0f={'raw':![],'where':{}};var _0x103188={};var _0x1cff88={'count':0x0,'rows':[]};return db[_0x3a42('0x55')]['findOne']({'where':{'id':_0x1337e1[_0x3a42('0x67')]['id']}})['then'](handleEntityNotFound(_0x31bd65,null))[_0x3a42('0x21')](function(_0x432d68){if(_0x432d68){_0x103188[_0x3a42('0x49')]=_['keys'](db['CannedAnswer'][_0x3a42('0x40')]);_0x103188['query']=_[_0x3a42('0x43')](_0x1337e1[_0x3a42('0x42')]);_0x103188[_0x3a42('0x44')]=_['intersection'](_0x103188[_0x3a42('0x49')],_0x103188[_0x3a42('0x42')]);_0x400d0f['attributes']=_[_0x3a42('0x45')](_0x103188['model'],qs[_0x3a42('0x47')](_0x1337e1[_0x3a42('0x42')][_0x3a42('0x47')]));_0x400d0f[_0x3a42('0x46')]=_0x400d0f[_0x3a42('0x46')][_0x3a42('0x48')]?_0x400d0f['attributes']:_0x103188['model'];if(!_0x1337e1[_0x3a42('0x42')]['hasOwnProperty'](_0x3a42('0x6c'))){_0x400d0f['limit']=qs['limit'](_0x1337e1[_0x3a42('0x42')]['limit']);_0x400d0f['offset']=qs[_0x3a42('0x31')](_0x1337e1[_0x3a42('0x42')][_0x3a42('0x31')]);}_0x400d0f[_0x3a42('0x4b')]=qs['sort'](_0x1337e1['query'][_0x3a42('0x4c')]);_0x400d0f[_0x3a42('0x4d')]=qs['filters'](_['pick'](_0x1337e1[_0x3a42('0x42')],_0x103188[_0x3a42('0x44')]));_0x400d0f[_0x3a42('0x4d')][_0x3a42('0x6d')]=_0x432d68['id'];if(_0x1337e1[_0x3a42('0x42')][_0x3a42('0x4f')]){_0x400d0f['where']=_['merge'](_0x400d0f[_0x3a42('0x4d')],{'$or':_[_0x3a42('0x50')](_0x400d0f[_0x3a42('0x46')],function(_0xd6b5ae){var _0x4c76ec={};_0x4c76ec[_0xd6b5ae]={'$like':'%'+_0x1337e1[_0x3a42('0x42')][_0x3a42('0x4f')]+'%'};return _0x4c76ec;})});}_0x400d0f=_['merge']({},_0x400d0f,_0x1337e1[_0x3a42('0x54')]);return db[_0x3a42('0x71')][_0x3a42('0x34')]({'where':_0x400d0f[_0x3a42('0x4d')]})['then'](function(_0x1294a1){_0x1cff88[_0x3a42('0x34')]=_0x1294a1;if(_0x1337e1[_0x3a42('0x42')]['includeAll']){_0x400d0f[_0x3a42('0x57')]=[{'all':!![]}];}return db[_0x3a42('0x71')]['findAll'](_0x400d0f);})[_0x3a42('0x21')](function(_0x182ad5){_0x1cff88[_0x3a42('0x59')]=_0x182ad5;return _0x1cff88;});}})['then'](respondWithFilteredResult(_0x31bd65,_0x400d0f))[_0x3a42('0x2c')](handleError(_0x31bd65,null));};exports['removeAnswers']=function(_0x35b712,_0xcce2d1,_0x6dfb47){return db[_0x3a42('0x55')][_0x3a42('0x5c')]({'where':{'id':_0x35b712[_0x3a42('0x67')]['id']}})[_0x3a42('0x21')](handleEntityNotFound(_0xcce2d1,null))[_0x3a42('0x21')](function(_0x1ad654){if(_0x1ad654){return _0x1ad654[_0x3a42('0x73')](_0x35b712[_0x3a42('0x42')][_0x3a42('0x6f')]);}})[_0x3a42('0x21')](respondWithStatusCode(_0xcce2d1,null))[_0x3a42('0x2c')](handleError(_0xcce2d1,null));};exports[_0x3a42('0x74')]=function(_0x42fd75,_0x5654c1,_0x5737ba){var _0x48fd7f={'body':_0x42fd75[_0x3a42('0x5e')],'channel':_0x3a42('0x75')};var _0x2efcea=[];var _0x298b0c=[];var _0x17a01e={};var _0x69f054=![];return db[_0x3a42('0x76')][_0x3a42('0x68')]()[_0x3a42('0x21')](function(_0x45bbae){if(!_0x45bbae){throw new db[(_0x3a42('0x77'))][(_0x3a42('0x78'))](_0x3a42('0x79'));}_0x2efcea=_[_0x3a42('0x7a')](_[_0x3a42('0x43')](_0x45bbae),[_0x3a42('0x7b'),'updatedAt']);_0x298b0c=_[_0x3a42('0x7a')](_[_0x3a42('0x43')](_0x45bbae),[_0x3a42('0x7b'),_0x3a42('0x7c'),_0x3a42('0x7d'),_0x3a42('0x7e')]);if(_0x42fd75['body']['id']){delete _0x42fd75[_0x3a42('0x5e')]['id'];}if(_[_0x3a42('0x7f')](_0x42fd75[_0x3a42('0x5e')][_0x3a42('0x80')])){throw new db[(_0x3a42('0x77'))][(_0x3a42('0x78'))](_0x3a42('0x81'));}if(_[_0x3a42('0x7f')](_0x42fd75[_0x3a42('0x5e')]['body'])||_0x42fd75[_0x3a42('0x5e')][_0x3a42('0x5e')]===''){throw new db[(_0x3a42('0x77'))][(_0x3a42('0x78'))](_0x3a42('0x82'));}if(_['isNil'](_0x42fd75[_0x3a42('0x5e')][_0x3a42('0x83')])){throw new db[(_0x3a42('0x77'))][(_0x3a42('0x78'))](_0x3a42('0x84')+_0x298b0c);}if(!_[_0x3a42('0x85')](_0x298b0c,_0x42fd75[_0x3a42('0x5e')]['mapKey'])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x298b0c);}_0x17a01e[_0x42fd75[_0x3a42('0x5e')]['mapKey']]=_0x42fd75[_0x3a42('0x5e')][_0x3a42('0x80')];})[_0x3a42('0x21')](function(){return db['OpenchannelAccount'][_0x3a42('0x5c')]({'where':{'id':_0x42fd75[_0x3a42('0x67')]['id']},'include':[{'model':db[_0x3a42('0x86')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x17a01e,'limit':0x1,'order':[[_0x3a42('0x7c'),'DESC']]}]},{'model':db[_0x3a42('0x87')],'as':'Applications'}]});})[_0x3a42('0x21')](handleEntityNotFound(_0x5654c1,null))[_0x3a42('0x21')](function(_0x115ec5){if(_0x115ec5&&_0x115ec5[_0x3a42('0x88')]){_0x48fd7f['account']=_0x115ec5;_0x48fd7f[_0x3a42('0x89')]=_0x115ec5[_0x3a42('0x8a')];_0x48fd7f['list']=_0x115ec5[_0x3a42('0x88')];_0x48fd7f[_0x3a42('0x89')]=_['orderBy'](_0x48fd7f[_0x3a42('0x89')],['priority'],[_0x3a42('0x8b')]);if(_0x48fd7f['account']['Applications']){delete _0x48fd7f[_0x3a42('0x8c')][_0x3a42('0x8a')];}if(_0x48fd7f[_0x3a42('0x8c')][_0x3a42('0x88')]&&_0x48fd7f['account'][_0x3a42('0x88')][_0x3a42('0x8d')]['length']){return _0x48fd7f[_0x3a42('0x8c')]['List'][_0x3a42('0x8d')][0x0];}var _0x7c1459=_[_0x3a42('0x8e')](_0x42fd75[_0x3a42('0x5e')],{'firstName':_0x42fd75['body'][_0x3a42('0x80')],'ListId':_0x115ec5[_0x3a42('0x7e')]});_0x7c1459[_0x42fd75['body'][_0x3a42('0x83')]]=_0x42fd75['body'][_0x3a42('0x80')];return db[_0x3a42('0x76')][_0x3a42('0x5d')](_0x7c1459,{'fields':_0x2efcea,'raw':!![]});}})['then'](handleEntityNotFound(_0x5654c1,null))['then'](function(_0x3dfa0f){_0x48fd7f[_0x3a42('0x8f')]=_0x3dfa0f;if(_0x3dfa0f){var _0x5b5062={'ContactId':_0x3dfa0f['id'],'OpenchannelAccountId':_0x42fd75[_0x3a42('0x67')]['id'],'from':(_0x3dfa0f[_0x3a42('0x90')]||'')+'\x20'+(_0x3dfa0f[_0x3a42('0x91')]||'')};var _0x4f4dc6={'OpenchannelAccountId':_0x42fd75[_0x3a42('0x67')]['id'],'closed':![]};if(_0x42fd75[_0x3a42('0x5e')][_0x3a42('0x92')]){_0x4f4dc6['threadId']=_0x42fd75[_0x3a42('0x5e')]['threadId'];return db['OpenchannelInteraction'][_0x3a42('0x5c')]({'where':_0x4f4dc6})['then'](function(_0x1e6038){if(_0x1e6038){return[_0x1e6038,![]];}_0x5b5062['threadId']=_0x42fd75[_0x3a42('0x5e')][_0x3a42('0x92')];_0x5b5062[_0x3a42('0x93')]=_0x42fd75[_0x3a42('0x5e')][_0x3a42('0x93')];return db[_0x3a42('0x94')][_0x3a42('0x5d')](_0x5b5062)[_0x3a42('0x21')](function(_0x44afb2){return[_0x44afb2,!![]];});});}else{_0x4f4dc6['threadId']=null;}_0x4f4dc6['ContactId']=_0x3dfa0f['id'];return db[_0x3a42('0x94')][_0x3a42('0x5c')]({'where':_0x4f4dc6})[_0x3a42('0x21')](function(_0x553047){if(_0x553047){return[_0x553047,![]];}return db[_0x3a42('0x94')][_0x3a42('0x5d')](_0x5b5062)[_0x3a42('0x21')](function(_0x949b84){return[_0x949b84,!![]];});});}})[_0x3a42('0x95')](function(_0x2a4d1c,_0x47cb21){if(_0x2a4d1c){_0x69f054=_0x47cb21;if(!_0x47cb21){var _0x16f9a4={'from':(_0x48fd7f['contact'][_0x3a42('0x90')]||'')+'\x20'+(_0x48fd7f['contact'][_0x3a42('0x91')]||'')};if(_0x42fd75[_0x3a42('0x5e')][_0x3a42('0x92')]&&_0x42fd75[_0x3a42('0x5e')][_0x3a42('0x96')]&&_0x42fd75[_0x3a42('0x5e')][_0x3a42('0x92')]!=_0x42fd75[_0x3a42('0x5e')][_0x3a42('0x96')]){_0x16f9a4[_0x3a42('0x92')]=_0x42fd75['body']['messageId'];}return _0x2a4d1c[_0x3a42('0x66')](_0x16f9a4);}else{return _0x2a4d1c;}}})[_0x3a42('0x21')](function(_0x82c7f3){_0x48fd7f[_0x3a42('0x97')]=_0x82c7f3[_0x3a42('0x39')]({'plain':!![]});_0x48fd7f['interaction'][_0x3a42('0x98')]=_0x69f054;if(_0x48fd7f[_0x3a42('0x97')]['created']){if(_0x48fd7f[_0x3a42('0x8c')][_0x3a42('0x99')]){_0x48fd7f['applications'][_0x3a42('0x9a')]({'id':0x0,'priority':_0x48fd7f[_0x3a42('0x89')][_0x3a42('0x48')]+0x1,'app':_0x3a42('0x9b'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x3a42('0x9c')][_0x3a42('0x5d')]({'body':_0x42fd75['body']['body'],'OpenchannelAccountId':_0x42fd75['params']['id'],'OpenchannelInteractionId':_0x82c7f3['id'],'direction':'in','ContactId':_0x48fd7f['contact']['id'],'AttachmentId':_0x42fd75['body'][_0x3a42('0x9d')]});})[_0x3a42('0x21')](function(_0x385b16){_0x48fd7f[_0x3a42('0x2a')]=_0x385b16;if(!_0x48fd7f[_0x3a42('0x97')][_0x3a42('0x9e')])return;return db[_0x3a42('0x9f')][_0x3a42('0x5c')]({'attributes':['id',_0x3a42('0x3d')],'where':{'id':_0x48fd7f[_0x3a42('0x97')][_0x3a42('0x9e')]}});})[_0x3a42('0x21')](function(_0x30a696){if(_0x30a696){_0x48fd7f[_0x3a42('0x89')][_0x3a42('0xa0')]({'id':0x0,'priority':0x0,'app':_0x3a42('0xa1'),'appdata':_0x30a696[_0x3a42('0x3d')]+','+(_0x48fd7f[_0x3a42('0x8c')][_0x3a42('0xa2')]||0xa),'interval':_0x3a42('0xa3')});}if(!_0x48fd7f[_0x3a42('0x97')]['queueId'])return;return db['OpenchannelQueue'][_0x3a42('0x5c')]({'attributes':['id',_0x3a42('0x3d')],'where':{'id':_0x48fd7f[_0x3a42('0x97')]['queueId']}});})[_0x3a42('0x21')](function(_0x22cd74){if(_0x22cd74){_0x48fd7f['applications'][_0x3a42('0xa0')]({'id':0x0,'priority':0x1,'app':_0x3a42('0xa4'),'appdata':_0x22cd74[_0x3a42('0x3d')]+','+(_0x48fd7f[_0x3a42('0x8c')][_0x3a42('0xa5')]||0x12c),'interval':_0x3a42('0xa3')});}return respondWithRpcPromise('Start','startRouting',_0x48fd7f);})[_0x3a42('0x21')](function(_0x1a0144){respondWithRpcPromise(_0x3a42('0xa6'),_0x3a42('0xa6'),{'event':_0x3a42('0x74'),'message':_0x1a0144},client9002);return _0x1a0144;})[_0x3a42('0x21')](respondWithResult(_0x5654c1,null))['catch'](handleError(_0x5654c1,null));};exports['addApplications']=function(_0x2968a2,_0x2adb8c){var _0x48d90c=_0x2968a2['params']['id'];var _0x53c806=_0x2968a2[_0x3a42('0x5e')];var _0x2f0372=0xc8;var _0x2a0340=null;return db[_0x3a42('0xa7')][_0x3a42('0xa8')]({'isolationLevel':db[_0x3a42('0xa7')]['Transaction'][_0x3a42('0xa9')][_0x3a42('0xaa')]},function(_0x620c72){return db[_0x3a42('0x55')][_0x3a42('0x6b')]({'where':{'id':_0x48d90c},'transaction':_0x620c72})[_0x3a42('0x21')](function(_0x3588ea){if(_0x3588ea){return db[_0x3a42('0x87')]['destroy']({'where':{'OpenchannelAccountId':_0x48d90c},'transaction':_0x620c72})[_0x3a42('0x21')](function(){var _0x1810a8=_[_0x3a42('0x50')](_0x53c806,function(_0x5c7a1d){_0x5c7a1d[_0x3a42('0x6d')]=_0x48d90c;return _0x5c7a1d;});return db[_0x3a42('0x87')][_0x3a42('0xab')](_0x1810a8,{'transaction':_0x620c72});});}else{_0x2f0372=0x194;_0x2a0340=[];}});})[_0x3a42('0x21')](function(){if(_0x2f0372!==0x194){return db[_0x3a42('0x87')][_0x3a42('0xac')]({'where':{'OpenchannelAccountId':_0x48d90c},'order':_0x3a42('0xad')})[_0x3a42('0x21')](function(_0x553b3c){_0x2a0340=_0x553b3c;});}})[_0x3a42('0x2c')](function(_0x1e08eb){_0x2f0372=0x1f4;logger[_0x3a42('0x27')](_0x1e08eb[_0x3a42('0x3c')]);if(_0x1e08eb['name']){delete _0x1e08eb[_0x3a42('0x3d')];}_0x2a0340=_0x1e08eb;})[_0x3a42('0xae')](function(){if(_0x2a0340===null){_0x2adb8c[_0x3a42('0x2d')](_0x2f0372);}else{if(_0x2f0372===0x1f4){_0x2adb8c[_0x3a42('0x2f')](_0x2f0372)[_0x3a42('0xaf')](_0x2a0340);}else{_0x2adb8c[_0x3a42('0x2f')](_0x2f0372)[_0x3a42('0x30')](_0x2a0340);}}});};exports[_0x3a42('0xb0')]=function(_0x3d7480,_0x47d5ed,_0x29d35a){var _0x33b68c={};var _0x57984d={};var _0x1cb329;var _0x3333f8;return db[_0x3a42('0x55')][_0x3a42('0x6b')]({'where':{'id':_0x3d7480[_0x3a42('0x67')]['id']}})['then'](handleEntityNotFound(_0x47d5ed,null))[_0x3a42('0x21')](function(_0x180da0){if(_0x180da0){_0x1cb329=_0x180da0;_0x57984d[_0x3a42('0x49')]=_[_0x3a42('0x43')](db[_0x3a42('0x87')][_0x3a42('0x40')]);_0x57984d[_0x3a42('0x42')]=_[_0x3a42('0x43')](_0x3d7480['query']);_0x57984d['filters']=_[_0x3a42('0x45')](_0x57984d[_0x3a42('0x49')],_0x57984d[_0x3a42('0x42')]);_0x33b68c['attributes']=_[_0x3a42('0x45')](_0x57984d[_0x3a42('0x49')],qs[_0x3a42('0x47')](_0x3d7480[_0x3a42('0x42')]['fields']));_0x33b68c[_0x3a42('0x46')]=_0x33b68c['attributes'][_0x3a42('0x48')]?_0x33b68c[_0x3a42('0x46')]:_0x57984d[_0x3a42('0x49')];_0x33b68c['order']=qs[_0x3a42('0x4c')](_0x3d7480[_0x3a42('0x42')][_0x3a42('0x4c')]);_0x33b68c[_0x3a42('0x4d')]=qs['filters'](_['pick'](_0x3d7480[_0x3a42('0x42')],_0x57984d[_0x3a42('0x44')]));if(_0x3d7480[_0x3a42('0x42')][_0x3a42('0x4f')]){_0x33b68c[_0x3a42('0x4d')]=_['merge'](_0x33b68c[_0x3a42('0x4d')],{'$or':_['map'](_0x33b68c[_0x3a42('0x46')],function(_0x25744e){var _0x5457d1={};_0x5457d1[_0x25744e]={'$like':'%'+_0x3d7480[_0x3a42('0x42')][_0x3a42('0x4f')]+'%'};return _0x5457d1;})});}_0x33b68c=_[_0x3a42('0x53')]({},_0x33b68c,_0x3d7480[_0x3a42('0x54')]);return _0x1cb329[_0x3a42('0xb0')](_0x33b68c);}})['then'](function(_0x479c7d){if(_0x479c7d){_0x3333f8=_0x479c7d[_0x3a42('0x48')];if(!_0x3d7480['query']['hasOwnProperty']('nolimit')){_0x33b68c[_0x3a42('0x33')]=qs['limit'](_0x3d7480[_0x3a42('0x42')][_0x3a42('0x33')]);_0x33b68c[_0x3a42('0x31')]=qs[_0x3a42('0x31')](_0x3d7480[_0x3a42('0x42')]['offset']);}return _0x1cb329[_0x3a42('0xb0')](_0x33b68c);}})[_0x3a42('0x21')](function(_0x18388c){if(_0x18388c){return _0x18388c?{'count':_0x3333f8,'rows':_0x18388c}:null;}})[_0x3a42('0x21')](respondWithResult(_0x47d5ed,null))[_0x3a42('0x2c')](handleError(_0x47d5ed,null));};exports[_0x3a42('0xb1')]=function(_0x334fd3,_0x1cd28f,_0x168e97){var _0x5d9503={'raw':![],'where':{}};var _0x9d843d={};var _0x2f5183={'count':0x0,'rows':[]};return db[_0x3a42('0x55')][_0x3a42('0x6b')]({'where':{'id':_0x334fd3['params']['id']}})[_0x3a42('0x21')](handleEntityNotFound(_0x1cd28f,null))['then'](function(_0x13d076){if(_0x13d076){_0x9d843d[_0x3a42('0x49')]=_[_0x3a42('0x43')](db[_0x3a42('0x94')][_0x3a42('0x40')]);_0x9d843d[_0x3a42('0x42')]=_[_0x3a42('0x43')](_0x334fd3[_0x3a42('0x42')]);_0x9d843d[_0x3a42('0x44')]=_[_0x3a42('0x45')](_0x9d843d[_0x3a42('0x49')],_0x9d843d[_0x3a42('0x42')]);_0x5d9503[_0x3a42('0x46')]=_[_0x3a42('0x45')](_0x9d843d[_0x3a42('0x49')],qs['fields'](_0x334fd3[_0x3a42('0x42')][_0x3a42('0x47')]));_0x5d9503[_0x3a42('0x46')]=_0x5d9503[_0x3a42('0x46')][_0x3a42('0x48')]?_0x5d9503['attributes']:_0x9d843d[_0x3a42('0x49')];if(!_0x334fd3[_0x3a42('0x42')][_0x3a42('0x4a')](_0x3a42('0x6c'))){_0x5d9503['limit']=qs[_0x3a42('0x33')](_0x334fd3[_0x3a42('0x42')][_0x3a42('0x33')]);_0x5d9503['offset']=qs['offset'](_0x334fd3[_0x3a42('0x42')][_0x3a42('0x31')]);}_0x5d9503[_0x3a42('0x4b')]=qs[_0x3a42('0x4c')](_0x334fd3[_0x3a42('0x42')]['sort']);_0x5d9503[_0x3a42('0x4d')]=qs[_0x3a42('0x44')](_['pick'](_0x334fd3[_0x3a42('0x42')],_0x9d843d['filters']));_0x5d9503[_0x3a42('0x4d')][_0x3a42('0x6d')]=_0x13d076['id'];if(_0x334fd3['query'][_0x3a42('0x4f')]){_0x5d9503[_0x3a42('0x4d')]=_[_0x3a42('0x53')](_0x5d9503[_0x3a42('0x4d')],{'$or':_[_0x3a42('0x50')](_0x5d9503[_0x3a42('0x46')],function(_0x9211){var _0x3c4f6b={};_0x3c4f6b[_0x9211]={'$like':'%'+_0x334fd3[_0x3a42('0x42')][_0x3a42('0x4f')]+'%'};return _0x3c4f6b;})});}_0x5d9503=_['merge']({},_0x5d9503,_0x334fd3[_0x3a42('0x54')]);return db[_0x3a42('0x94')][_0x3a42('0x34')]({'where':_0x5d9503[_0x3a42('0x4d')]})[_0x3a42('0x21')](function(_0x113bfc){_0x2f5183[_0x3a42('0x34')]=_0x113bfc;if(_0x334fd3[_0x3a42('0x42')][_0x3a42('0x56')]){_0x5d9503[_0x3a42('0x57')]=[{'model':db[_0x3a42('0x76')],'as':_0x3a42('0xb2'),'required':![]},{'model':db[_0x3a42('0x9f')],'as':_0x3a42('0xb3'),'attributes':[_0x3a42('0x3d'),_0x3a42('0xb4'),'internal'],'required':![]},{'model':db[_0x3a42('0xb5')],'as':_0x3a42('0xb6'),'attributes':['id',_0x3a42('0x3d'),'color'],'where':_0x334fd3[_0x3a42('0x42')][_0x3a42('0xb7')]?{'id':_0x334fd3[_0x3a42('0x42')][_0x3a42('0xb7')]}:undefined,'required':_0x334fd3[_0x3a42('0x42')][_0x3a42('0xb7')]?!![]:![]}];}return db[_0x3a42('0x94')][_0x3a42('0x58')](_0x5d9503);})[_0x3a42('0x21')](function(_0xe62af3){_0x2f5183['rows']=_0xe62af3;return _0x2f5183;});}})['then'](respondWithFilteredResult(_0x1cd28f,_0x5d9503))[_0x3a42('0x2c')](handleError(_0x1cd28f,null));};exports[_0x3a42('0xb8')]=function(_0x152354,_0x1cb326,_0x3f460a){return db[_0x3a42('0x55')][_0x3a42('0x5c')]({'where':{'id':_0x152354['params']['id']}})[_0x3a42('0x21')](handleEntityNotFound(_0x1cb326,null))[_0x3a42('0x21')](function(_0x3b75f5){if(_0x3b75f5){return _0x3b75f5[_0x3a42('0xb8')](_0x152354['body'][_0x3a42('0x6f')],_[_0x3a42('0xb9')](_0x152354['body'],[_0x3a42('0x6f'),'id'])||{})[_0x3a42('0x95')](function(_0x4264b9){for(var _0x22082b=0x0;_0x22082b<_0x152354['body']['ids']['length'];_0x22082b+=0x1){socket[_0x3a42('0xba')](_0x3a42('0xbb'),{'UserId':Number(_0x152354[_0x3a42('0x5e')][_0x3a42('0x6f')][_0x22082b]),'OpenchannelAccountId':Number(_0x152354[_0x3a42('0x67')]['id'])});}return _0x4264b9;});}})[_0x3a42('0x21')](respondWithResult(_0x1cb326,null))[_0x3a42('0x2c')](handleError(_0x1cb326,null));};exports[_0x3a42('0xbc')]=function(_0x372f61,_0x355de9,_0x1fbffe){return db[_0x3a42('0x55')][_0x3a42('0x5c')]({'where':{'id':_0x372f61[_0x3a42('0x67')]['id']}})[_0x3a42('0x21')](handleEntityNotFound(_0x355de9,null))['then'](function(_0x5a076d){if(_0x5a076d){return _0x5a076d[_0x3a42('0xbc')](_0x372f61['query'][_0x3a42('0x6f')])['then'](function(){if(_[_0x3a42('0xbd')](_0x372f61[_0x3a42('0x42')][_0x3a42('0x6f')])){for(var _0x2f2902=0x0;_0x2f2902<_0x372f61[_0x3a42('0x42')][_0x3a42('0x6f')][_0x3a42('0x48')];_0x2f2902+=0x1){socket['emit'](_0x3a42('0xbe'),{'UserId':Number(_0x372f61[_0x3a42('0x42')]['ids'][_0x2f2902]),'OpenchannelAccountId':Number(_0x372f61[_0x3a42('0x67')]['id'])});}}else{socket[_0x3a42('0xba')](_0x3a42('0xbe'),{'UserId':Number(_0x372f61['query'][_0x3a42('0x6f')]),'OpenchannelAccountId':Number(_0x372f61['params']['id'])});}});}})[_0x3a42('0x21')](respondWithStatusCode(_0x355de9,null))[_0x3a42('0x2c')](handleError(_0x355de9,null));};exports['getAgents']=function(_0x58b777,_0x5815e5,_0x348df3){var _0x172ae2={};var _0x478936={};var _0x5b09cf;var _0xfd5dd9;return db[_0x3a42('0x55')][_0x3a42('0x6b')]({'where':{'id':_0x58b777[_0x3a42('0x67')]['id']}})[_0x3a42('0x21')](handleEntityNotFound(_0x5815e5,null))['then'](function(_0x372c70){if(_0x372c70){_0x5b09cf=_0x372c70;_0x478936[_0x3a42('0x49')]=_[_0x3a42('0x43')](db[_0x3a42('0x9f')][_0x3a42('0x40')]);_0x478936['query']=_['keys'](_0x58b777[_0x3a42('0x42')]);_0x478936[_0x3a42('0x44')]=_[_0x3a42('0x45')](_0x478936[_0x3a42('0x49')],_0x478936['query']);_0x172ae2[_0x3a42('0x46')]=_[_0x3a42('0x45')](_0x478936['model'],qs[_0x3a42('0x47')](_0x58b777[_0x3a42('0x42')]['fields']));_0x172ae2['attributes']=_0x172ae2['attributes'][_0x3a42('0x48')]?_0x172ae2[_0x3a42('0x46')]:_0x478936['model'];_0x172ae2[_0x3a42('0x4b')]=qs[_0x3a42('0x4c')](_0x58b777[_0x3a42('0x42')][_0x3a42('0x4c')]);_0x172ae2['where']=qs[_0x3a42('0x44')](_['pick'](_0x58b777['query'],_0x478936[_0x3a42('0x44')]));if(_0x58b777['query'][_0x3a42('0x4f')]){_0x172ae2[_0x3a42('0x4d')]=_[_0x3a42('0x53')](_0x172ae2[_0x3a42('0x4d')],{'$or':_[_0x3a42('0x50')](_0x172ae2[_0x3a42('0x46')],function(_0x1c2f79){var _0x5029d1={};_0x5029d1[_0x1c2f79]={'$like':'%'+_0x58b777[_0x3a42('0x42')][_0x3a42('0x4f')]+'%'};return _0x5029d1;})});}_0x172ae2=_['merge']({},_0x172ae2,_0x58b777[_0x3a42('0x54')]);return _0x5b09cf[_0x3a42('0xbf')](_0x172ae2);}})[_0x3a42('0x21')](function(_0x5ec9d2){if(_0x5ec9d2){_0xfd5dd9=_0x5ec9d2[_0x3a42('0x48')];if(!_0x58b777[_0x3a42('0x42')][_0x3a42('0x4a')]('nolimit')){_0x172ae2[_0x3a42('0x33')]=qs[_0x3a42('0x33')](_0x58b777[_0x3a42('0x42')][_0x3a42('0x33')]);_0x172ae2[_0x3a42('0x31')]=qs['offset'](_0x58b777['query'][_0x3a42('0x31')]);}return _0x5b09cf[_0x3a42('0xbf')](_0x172ae2);}})[_0x3a42('0x21')](function(_0x177728){if(_0x177728){return _0x177728?{'count':_0xfd5dd9,'rows':_0x177728}:null;}})[_0x3a42('0x21')](respondWithResult(_0x5815e5,null))[_0x3a42('0x2c')](handleError(_0x5815e5,null));};exports[_0x3a42('0xaf')]=function(_0x4edfd2,_0x5300ad,_0x14b1c2){var _0x164807,_0x61ee94,_0x3b83af;if(_[_0x3a42('0x7f')](_0x4edfd2[_0x3a42('0x5e')][_0x3a42('0x5e')])||_0x4edfd2[_0x3a42('0x5e')]['body']===''){throw new db[(_0x3a42('0x77'))][(_0x3a42('0x78'))](_0x3a42('0x82'));}if(_[_0x3a42('0x7f')](_0x4edfd2[_0x3a42('0x5e')]['to'])){}_0x164807=_0x4edfd2[_0x3a42('0x5e')]['to'];return db[_0x3a42('0x55')][_0x3a42('0x6b')]({'where':{'id':_0x4edfd2[_0x3a42('0x67')]['id']}})['then'](handleEntityNotFound(_0x5300ad,null))[_0x3a42('0x21')](function(_0x22175f){if(_0x22175f){return db[_0x3a42('0x55')][_0x3a42('0x5c')]({'where':{'id':_0x22175f['id']},'include':[{'model':db[_0x3a42('0x86')],'as':_0x3a42('0x88'),'include':[{'model':db[_0x3a42('0x76')],'as':_0x3a42('0x8d'),'where':{[_0x22175f[_0x3a42('0x83')]]:_0x164807},'limit':0x1,'order':[[_0x3a42('0x7c'),_0x3a42('0xc0')]]}]}]})[_0x3a42('0x21')](handleEntityNotFound(_0x5300ad,null))[_0x3a42('0x21')](function(_0x3c0e05){if(_0x3c0e05&&_0x3c0e05[_0x3a42('0x88')]){_0x61ee94=_0x3c0e05['get']({'plain':!![]});if(_0x61ee94[_0x3a42('0x88')]&&_0x61ee94[_0x3a42('0x88')][_0x3a42('0x8d')][_0x3a42('0x48')]){return _0x61ee94[_0x3a42('0x88')]['Contacts'][0x0];}return db[_0x3a42('0x76')][_0x3a42('0x5d')](_[_0x3a42('0x8e')](_0x4edfd2['body'],{'firstName':_0x164807,[_0x3c0e05[_0x3a42('0x83')]]:_0x164807,'phone':_0x164807,'ListId':_0x61ee94[_0x3a42('0x7e')]}));}})[_0x3a42('0x21')](handleEntityNotFound(_0x5300ad,null))[_0x3a42('0x21')](function(_0x55a346){if(_0x55a346){_0x3b83af=_0x55a346;return db[_0x3a42('0x94')][_0x3a42('0x5c')]({'where':{'ContactId':_0x3b83af['id'],'closed':![],'OpenchannelAccountId':_0x61ee94['id']}})['then'](function(_0x206acd){if(_0x206acd){return[_0x206acd,![]];}return db[_0x3a42('0x94')][_0x3a42('0x5d')]({'UserId':_0x4edfd2['user']['id'],'ContactId':_0x3b83af['id'],'OpenchannelAccountId':_0x61ee94['id'],'lastMsgDirection':_0x3a42('0xc1'),'firstMsgDirection':'out','Messages':[_['merge'](_0x4edfd2['body'],{'read':![],'body':_0x4edfd2[_0x3a42('0x5e')][_0x3a42('0x5e')],'OpenchannelAccountId':_0x61ee94['id'],'UserId':_0x4edfd2[_0x3a42('0x61')]['id'],'ContactId':_0x3b83af['id']})]},{'include':[{'model':db[_0x3a42('0x9c')],'as':'Messages'}]})[_0x3a42('0x21')](function(_0x331c29){return[_0x331c29,!![]];});});}})[_0x3a42('0x95')](function(_0x3acec4,_0x200d8e){if(_0x200d8e){return _0x3acec4;}return db[_0x3a42('0x9c')][_0x3a42('0x5d')](_['merge'](_0x4edfd2[_0x3a42('0x5e')],{'read':![],'body':_0x4edfd2[_0x3a42('0x5e')][_0x3a42('0x5e')],'OpenchannelAccountId':_0x61ee94['id'],'OpenchannelInteractionId':_0x3acec4['id'],'UserId':_0x4edfd2['user']['id'],'ContactId':_0x3b83af['id']}))[_0x3a42('0x21')](function(_0x2322be){_0x3acec4[_0x3a42('0xc2')][_0x3a42('0xc3')]=[];_0x3acec4[_0x3a42('0xc2')][_0x3a42('0xc3')][_0x3a42('0x9a')](_0x2322be['dataValues']);return _0x3acec4;});});}})[_0x3a42('0x21')](respondWithResult(_0x5300ad,null))[_0x3a42('0x2c')](handleError(_0x5300ad,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index dee5a68..7a814c2 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 _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','OpenchannelAccount','setMaxListeners'];(function(_0x4690ca,_0x43955a){var _0x4904fa=function(_0x3d6123){while(--_0x3d6123){_0x4690ca['push'](_0x4690ca['shift']());}};_0x4904fa(++_0x43955a);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x49c4('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){OpenchannelAccountEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);OpenchannelAccountEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];OpenchannelAccount[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x1339=['update','remove','emit','hasOwnProperty','exports','OpenchannelAccount','setMaxListeners','save'];(function(_0x994d25,_0x1b1fb2){var _0x50d5b3=function(_0x82b231){while(--_0x82b231){_0x994d25['push'](_0x994d25['shift']());}};_0x50d5b3(++_0x1b1fb2);}(_0x1339,0x1ed));var _0x9133=function(_0x44f728,_0x102cb1){_0x44f728=_0x44f728-0x0;var _0x4f91d6=_0x1339[_0x44f728];return _0x4f91d6;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x9133('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x9133('0x1')](0x0);var events={'afterCreate':_0x9133('0x2'),'afterUpdate':_0x9133('0x3'),'afterDestroy':_0x9133('0x4')};function emitEvent(_0x192d48){return function(_0x176e80,_0x110c51,_0x558345){OpenchannelAccountEvents[_0x9133('0x5')](_0x192d48+':'+_0x176e80['id'],_0x176e80);OpenchannelAccountEvents[_0x9133('0x5')](_0x192d48,_0x176e80);_0x558345(null);};}for(var e in events){if(events[_0x9133('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x9133('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 7daf049..9907b96 100644 --- a/server/api/openchannelAccount/openchannelAccount.model.js +++ b/server/api/openchannelAccount/openchannelAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1c7a71,_0x4e4554){var _0x5858fe=function(_0x2e004f){while(--_0x2e004f){_0x1c7a71['push'](_0x1c7a71['shift']());}};_0x5858fe(++_0x4e4554);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x435bf1,_0x3276ab){var _0x271fa6=function(_0x3dc2f3){while(--_0x3dc2f3){_0x435bf1['push'](_0x435bf1['shift']());}};_0x271fa6(++_0x3276ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index ef026b1..bcf6fd1 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 _0xc2da=['code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2da,0x124));var _0xac2d=function(_0x317d6f,_0x18463f){_0x317d6f=_0x317d6f-0x0;var _0x4a5911=_0xc2da[_0x317d6f];return _0x4a5911;};'use strict';var _=require(_0xac2d('0x0'));var util=require('util');var moment=require(_0xac2d('0x1'));var BPromise=require('bluebird');var rs=require(_0xac2d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac2d('0x3'))['db'];var utils=require(_0xac2d('0x4'));var logger=require(_0xac2d('0x5'))(_0xac2d('0x6'));var config=require(_0xac2d('0x7'));var jayson=require(_0xac2d('0x8'));var client=jayson[_0xac2d('0x9')][_0xac2d('0xa')]({'port':0x232a});config[_0xac2d('0xb')]=_[_0xac2d('0xc')](config[_0xac2d('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac2d('0xb')]));require('./openchannelAccount.socket')[_0xac2d('0xd')](socket);function respondWithRpcPromise(_0x254c5c,_0x42aad8,_0x11ac79){return new BPromise(function(_0x9a01cd,_0xe5d74a){return client['request'](_0x254c5c,_0x11ac79)['then'](function(_0x2c895b){logger[_0xac2d('0xe')](_0xac2d('0xf'),_0x42aad8,_0xac2d('0x10'));logger['debug'](_0xac2d('0x11'),_0x42aad8,_0xac2d('0x10'),JSON[_0xac2d('0x12')](_0x2c895b));if(_0x2c895b[_0xac2d('0x13')]){if(_0x2c895b[_0xac2d('0x13')][_0xac2d('0x14')]===0x1f4){logger[_0xac2d('0x13')](_0xac2d('0xf'),_0x42aad8,_0x2c895b[_0xac2d('0x13')][_0xac2d('0x15')]);return _0xe5d74a(_0x2c895b[_0xac2d('0x13')][_0xac2d('0x15')]);}logger[_0xac2d('0x13')](_0xac2d('0xf'),_0x42aad8,_0x2c895b[_0xac2d('0x13')]['message']);return _0x9a01cd(_0x2c895b[_0xac2d('0x13')][_0xac2d('0x15')]);}else{logger['info'](_0xac2d('0xf'),_0x42aad8,_0xac2d('0x10'));_0x9a01cd(_0x2c895b[_0xac2d('0x16')]['message']);}})[_0xac2d('0x17')](function(_0x5da81c){logger[_0xac2d('0x13')](_0xac2d('0xf'),_0x42aad8,_0x5da81c);_0xe5d74a(_0x5da81c);});});} \ No newline at end of file +var _0x5eb1=['redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x5eb1,0x7c));var _0x15eb=function(_0x2c93a2,_0x1c1e3b){_0x2c93a2=_0x2c93a2-0x0;var _0x5bde6c=_0x5eb1[_0x2c93a2];return _0x5bde6c;};'use strict';var _=require('lodash');var util=require(_0x15eb('0x0'));var moment=require(_0x15eb('0x1'));var BPromise=require(_0x15eb('0x2'));var rs=require(_0x15eb('0x3'));var fs=require('fs');var Redis=require(_0x15eb('0x4'));var db=require(_0x15eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x15eb('0x6'))(_0x15eb('0x7'));var config=require(_0x15eb('0x8'));var jayson=require(_0x15eb('0x9'));var client=jayson['client'][_0x15eb('0xa')]({'port':0x232a});config[_0x15eb('0xb')]=_['defaults'](config[_0x15eb('0xb')],{'host':_0x15eb('0xc'),'port':0x18eb});var socket=require(_0x15eb('0xd'))(new Redis(config[_0x15eb('0xb')]));require(_0x15eb('0xe'))[_0x15eb('0xf')](socket);function respondWithRpcPromise(_0x412db6,_0x1481ae,_0x295e45){return new BPromise(function(_0x31e040,_0x3f08c1){return client[_0x15eb('0x10')](_0x412db6,_0x295e45)[_0x15eb('0x11')](function(_0x56c25c){logger[_0x15eb('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x1481ae,'request\x20sent');logger['debug'](_0x15eb('0x13'),_0x1481ae,_0x15eb('0x14'),JSON[_0x15eb('0x15')](_0x56c25c));if(_0x56c25c[_0x15eb('0x16')]){if(_0x56c25c['error'][_0x15eb('0x17')]===0x1f4){logger[_0x15eb('0x16')](_0x15eb('0x18'),_0x1481ae,_0x56c25c[_0x15eb('0x16')]['message']);return _0x3f08c1(_0x56c25c['error']['message']);}logger['error'](_0x15eb('0x18'),_0x1481ae,_0x56c25c['error']['message']);return _0x31e040(_0x56c25c[_0x15eb('0x16')]['message']);}else{logger[_0x15eb('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x1481ae,_0x15eb('0x14'));_0x31e040(_0x56c25c['result'][_0x15eb('0x19')]);}})[_0x15eb('0x1a')](function(_0x5cc4b1){logger[_0x15eb('0x16')](_0x15eb('0x18'),_0x1481ae,_0x5cc4b1);_0x3f08c1(_0x5cc4b1);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 0708cde..cba30da 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 _0xee4f=['length','./openchannelAccount.events','update','emit'];(function(_0x569d5d,_0x4f7c49){var _0x3f6192=function(_0xad386d){while(--_0xad386d){_0x569d5d['push'](_0x569d5d['shift']());}};_0x3f6192(++_0x4f7c49);}(_0xee4f,0xad));var _0xfee4=function(_0x50f84f,_0x4b60d3){_0x50f84f=_0x50f84f-0x0;var _0x4d8060=_0xee4f[_0x50f84f];return _0x4d8060;};'use strict';var OpenchannelAccountEvents=require(_0xfee4('0x0'));var events=['save','remove',_0xfee4('0x1')];function createListener(_0x41b170,_0xf1acd6){return function(_0x5a03c9){_0xf1acd6[_0xfee4('0x2')](_0x41b170,_0x5a03c9);};}function removeListener(_0x5b9149,_0x27874a){return function(){OpenchannelAccountEvents['removeListener'](_0x5b9149,_0x27874a);};}exports['register']=function(_0x1c39b1){for(var _0x498647=0x0,_0x52fb6b=events[_0xfee4('0x3')];_0x498647<_0x52fb6b;_0x498647++){var _0x16cc9a=events[_0x498647];var _0x34908a=createListener('openchannelAccount:'+_0x16cc9a,_0x1c39b1);OpenchannelAccountEvents['on'](_0x16cc9a,_0x34908a);}}; \ No newline at end of file +var _0xa101=['openchannelAccount:','./openchannelAccount.events','save','update','emit','removeListener','register'];(function(_0x7b53a5,_0x3a4bf1){var _0x21af7a=function(_0x1aa8dc){while(--_0x1aa8dc){_0x7b53a5['push'](_0x7b53a5['shift']());}};_0x21af7a(++_0x3a4bf1);}(_0xa101,0x15f));var _0x1a10=function(_0x19f9e6,_0x4f59a6){_0x19f9e6=_0x19f9e6-0x0;var _0x45c862=_0xa101[_0x19f9e6];return _0x45c862;};'use strict';var OpenchannelAccountEvents=require(_0x1a10('0x0'));var events=[_0x1a10('0x1'),'remove',_0x1a10('0x2')];function createListener(_0x1c42d9,_0x522253){return function(_0x9e0102){_0x522253[_0x1a10('0x3')](_0x1c42d9,_0x9e0102);};}function removeListener(_0x51baf6,_0x205faf){return function(){OpenchannelAccountEvents[_0x1a10('0x4')](_0x51baf6,_0x205faf);};}exports[_0x1a10('0x5')]=function(_0x1a9d22){for(var _0x2eb3c8=0x0,_0x2b95f3=events['length'];_0x2eb3c8<_0x2b95f3;_0x2eb3c8++){var _0x4f0cd4=events[_0x2eb3c8];var _0x3c90fa=createListener(_0x1a10('0x6')+_0x4f0cd4,_0x1a9d22);OpenchannelAccountEvents['on'](_0x4f0cd4,_0x3c90fa);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index adb1dcb..32b1b6f 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 _0x3cc6=['delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','/:id','post','isAuthenticated','create','put','update'];(function(_0x2085c0,_0x221f4f){var _0x173d4a=function(_0x20819d){while(--_0x20819d){_0x2085c0['push'](_0x2085c0['shift']());}};_0x173d4a(++_0x221f4f);}(_0x3cc6,0x1dd));var _0x63cc=function(_0x22ee86,_0x34e915){_0x22ee86=_0x22ee86-0x0;var _0x139fcc=_0x3cc6[_0x22ee86];return _0x139fcc;};'use strict';var multer=require(_0x63cc('0x0'));var util=require(_0x63cc('0x1'));var path=require(_0x63cc('0x2'));var timeout=require('connect-timeout');var express=require(_0x63cc('0x3'));var router=express[_0x63cc('0x4')]();var fs_extra=require(_0x63cc('0x5'));var auth=require(_0x63cc('0x6'));var interaction=require(_0x63cc('0x7'));var config=require(_0x63cc('0x8'));var controller=require(_0x63cc('0x9'));router[_0x63cc('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x63cc('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x63cc('0xc')]('/',auth[_0x63cc('0xd')](),controller[_0x63cc('0xe')]);router[_0x63cc('0xf')](_0x63cc('0xb'),auth['isAuthenticated'](),controller[_0x63cc('0x10')]);router[_0x63cc('0x11')]('/:id',auth[_0x63cc('0xd')](),controller[_0x63cc('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa642=['../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x443caa,_0x247042){var _0x3dff1c=function(_0x98f43c){while(--_0x98f43c){_0x443caa['push'](_0x443caa['shift']());}};_0x3dff1c(++_0x247042);}(_0xa642,0x1d9));var _0x2a64=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0xa642[_0x585d81];return _0x1aca0d;};'use strict';var multer=require(_0x2a64('0x0'));var util=require(_0x2a64('0x1'));var path=require(_0x2a64('0x2'));var timeout=require(_0x2a64('0x3'));var express=require(_0x2a64('0x4'));var router=express['Router']();var fs_extra=require(_0x2a64('0x5'));var auth=require(_0x2a64('0x6'));var interaction=require(_0x2a64('0x7'));var config=require(_0x2a64('0x8'));var controller=require(_0x2a64('0x9'));router['get']('/',auth[_0x2a64('0xa')](),controller[_0x2a64('0xb')]);router['get'](_0x2a64('0xc'),auth[_0x2a64('0xa')](),controller[_0x2a64('0xd')]);router[_0x2a64('0xe')]('/',auth[_0x2a64('0xa')](),controller['create']);router[_0x2a64('0xf')](_0x2a64('0xc'),auth[_0x2a64('0xa')](),controller[_0x2a64('0x10')]);router[_0x2a64('0x11')](_0x2a64('0xc'),auth[_0x2a64('0xa')](),controller[_0x2a64('0x12')]);module[_0x2a64('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 23b8cde..5685929 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 _0x972b=['exports','noop','STRING','*,*,*,*','sequelize'];(function(_0x5df61d,_0x158640){var _0x24cc4c=function(_0x2de006){while(--_0x2de006){_0x5df61d['push'](_0x5df61d['shift']());}};_0x24cc4c(++_0x158640);}(_0x972b,0x72));var _0xb972=function(_0x3c74ad,_0xba6279){_0x3c74ad=_0x3c74ad-0x0;var _0x4c19f5=_0x972b[_0x3c74ad];return _0x4c19f5;};'use strict';var Sequelize=require(_0xb972('0x0'));module[_0xb972('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb972('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xb972('0x3')]},'interval':{'type':Sequelize[_0xb972('0x3')],'defaultValue':_0xb972('0x4')}}; \ No newline at end of file +var _0xf650=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x499bd2,_0x3667fd){var _0x5decdd=function(_0x4a3505){while(--_0x4a3505){_0x499bd2['push'](_0x499bd2['shift']());}};_0x5decdd(++_0x3667fd);}(_0xf650,0x155));var _0x0f65=function(_0x355f39,_0x325eb6){_0x355f39=_0x355f39-0x0;var _0x42538b=_0xf650[_0x355f39];return _0x42538b;};'use strict';var Sequelize=require(_0x0f65('0x0'));module[_0x0f65('0x1')]={'priority':{'type':Sequelize[_0x0f65('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0f65('0x3')],'allowNull':![],'defaultValue':_0x0f65('0x4')},'appdata':{'type':Sequelize[_0x0f65('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0f65('0x3')],'defaultValue':_0x0f65('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 1c997a0..95c4629 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 _0x6976=['send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','OpenchannelApplication','then','includeAll','include','findAll','rows','catch','show','params','create','body','find','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','error','name'];(function(_0xef8803,_0x34c4dc){var _0x41b265=function(_0x488d26){while(--_0x488d26){_0xef8803['push'](_0xef8803['shift']());}};_0x41b265(++_0x34c4dc);}(_0x6976,0x14d));var _0x6697=function(_0xf06556,_0x31b906){_0xf06556=_0xf06556-0x0;var _0x33c18b=_0x6976[_0xf06556];return _0x33c18b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6697('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6697('0x1'));var moment=require('moment');var BPromise=require(_0x6697('0x2'));var Mustache=require(_0x6697('0x3'));var util=require(_0x6697('0x4'));var path=require(_0x6697('0x5'));var sox=require(_0x6697('0x6'));var csv=require(_0x6697('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6697('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6697('0x9'));var jsforce=require(_0x6697('0xa'));var deskjs=require(_0x6697('0xb'));var toCsv=require(_0x6697('0x7'));var querystring=require(_0x6697('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6697('0xd'));var qs=require(_0x6697('0xe'));var as=require(_0x6697('0xf'));var hardwareService=require(_0x6697('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x6697('0x11'));var config=require(_0x6697('0x12'));var licenseUtil=require(_0x6697('0x13'));var db=require(_0x6697('0x14'))['db'];function respondWithStatusCode(_0x143052,_0x51b054){_0x51b054=_0x51b054||0xcc;return function(_0x4384d4){if(_0x4384d4){return _0x143052[_0x6697('0x15')](_0x51b054);}return _0x143052[_0x6697('0x16')](_0x51b054)[_0x6697('0x17')]();};}function respondWithResult(_0x28c795,_0x212953){_0x212953=_0x212953||0xc8;return function(_0x1dd560){if(_0x1dd560){return _0x28c795['status'](_0x212953)[_0x6697('0x18')](_0x1dd560);}};}function respondWithFilteredResult(_0x2f67cd,_0x4b4ef7){return function(_0x2cab1e){if(_0x2cab1e){var _0x4d9fdd=typeof _0x4b4ef7[_0x6697('0x19')]==='undefined'&&typeof _0x4b4ef7['limit']===_0x6697('0x1a');var _0x3c1c84=_0x2cab1e[_0x6697('0x1b')];var _0x41370f=_0x4d9fdd?0x0:_0x4b4ef7[_0x6697('0x19')];var _0x12f5ca=_0x4d9fdd?_0x2cab1e[_0x6697('0x1b')]:_0x4b4ef7[_0x6697('0x19')]+_0x4b4ef7[_0x6697('0x1c')];var _0x3a1848;if(_0x12f5ca>=_0x3c1c84){_0x12f5ca=_0x3c1c84;_0x3a1848=0xc8;}else{_0x3a1848=0xce;}_0x2f67cd['status'](_0x3a1848);return _0x2f67cd[_0x6697('0x1d')]('Content-Range',_0x41370f+'-'+_0x12f5ca+'/'+_0x3c1c84)['json'](_0x2cab1e);}return null;};}function patchUpdates(_0x385836){return function(_0x23e3f5){try{jsonpatch[_0x6697('0x1e')](_0x23e3f5,_0x385836,!![]);}catch(_0x3689cb){return BPromise[_0x6697('0x1f')](_0x3689cb);}return _0x23e3f5[_0x6697('0x20')]();};}function saveUpdates(_0x456aff,_0x9efe3a){return function(_0x18ea3f){if(_0x18ea3f){return _0x18ea3f[_0x6697('0x21')](_0x456aff)['then'](function(_0x5d8bb8){return _0x5d8bb8;});}return null;};}function removeEntity(_0x421fac,_0x55016d){return function(_0x58f1ea){if(_0x58f1ea){return _0x58f1ea[_0x6697('0x22')]()['then'](function(){_0x421fac['status'](0xcc)[_0x6697('0x17')]();});}};}function handleEntityNotFound(_0x3fa31c,_0x50d5ff){return function(_0x1143a4){if(!_0x1143a4){_0x3fa31c[_0x6697('0x15')](0x194);}return _0x1143a4;};}function handleError(_0x3b7856,_0x4868e0){_0x4868e0=_0x4868e0||0x1f4;return function(_0x5cee43){logger[_0x6697('0x23')](_0x5cee43['stack']);if(_0x5cee43['name']){delete _0x5cee43[_0x6697('0x24')];}_0x3b7856['status'](_0x4868e0)[_0x6697('0x25')](_0x5cee43);};}exports[_0x6697('0x26')]=function(_0x1cb8a6,_0xf3fd8c){var _0x59fadb={},_0x56f11b={},_0x19e349={'count':0x0,'rows':[]};var _0x489ffd=_[_0x6697('0x27')](db['OpenchannelApplication'][_0x6697('0x28')],function(_0x3ecb15){return{'name':_0x3ecb15[_0x6697('0x29')],'type':_0x3ecb15['type'][_0x6697('0x2a')]};});_0x56f11b[_0x6697('0x2b')]=_[_0x6697('0x27')](_0x489ffd,_0x6697('0x24'));_0x56f11b[_0x6697('0x2c')]=_[_0x6697('0x2d')](_0x1cb8a6[_0x6697('0x2c')]);_0x56f11b[_0x6697('0x2e')]=_[_0x6697('0x2f')](_0x56f11b[_0x6697('0x2b')],_0x56f11b['query']);_0x59fadb[_0x6697('0x30')]=_[_0x6697('0x2f')](_0x56f11b['model'],qs[_0x6697('0x31')](_0x1cb8a6[_0x6697('0x2c')][_0x6697('0x31')]));_0x59fadb[_0x6697('0x30')]=_0x59fadb[_0x6697('0x30')][_0x6697('0x32')]?_0x59fadb[_0x6697('0x30')]:_0x56f11b[_0x6697('0x2b')];if(!_0x1cb8a6[_0x6697('0x2c')][_0x6697('0x33')](_0x6697('0x34'))){_0x59fadb['limit']=qs[_0x6697('0x1c')](_0x1cb8a6[_0x6697('0x2c')]['limit']);_0x59fadb[_0x6697('0x19')]=qs['offset'](_0x1cb8a6[_0x6697('0x2c')][_0x6697('0x19')]);}_0x59fadb[_0x6697('0x35')]=qs[_0x6697('0x36')](_0x1cb8a6['query'][_0x6697('0x36')]);_0x59fadb[_0x6697('0x37')]=qs[_0x6697('0x2e')](_[_0x6697('0x38')](_0x1cb8a6[_0x6697('0x2c')],_0x56f11b[_0x6697('0x2e')]),_0x489ffd);if(_0x1cb8a6['query']['filter']){_0x59fadb[_0x6697('0x37')]=_[_0x6697('0x39')](_0x59fadb[_0x6697('0x37')],{'$or':_[_0x6697('0x27')](_0x489ffd,function(_0x404a98){if(_0x404a98[_0x6697('0x3a')]!==_0x6697('0x3b')){var _0x404f26={};_0x404f26[_0x404a98[_0x6697('0x24')]]={'$like':'%'+_0x1cb8a6[_0x6697('0x2c')][_0x6697('0x3c')]+'%'};return _0x404f26;}})});}_0x59fadb=_[_0x6697('0x39')]({},_0x59fadb,_0x1cb8a6[_0x6697('0x3d')]);var _0x45fef8={'where':_0x59fadb['where']};return db[_0x6697('0x3e')][_0x6697('0x1b')](_0x45fef8)[_0x6697('0x3f')](function(_0x220a27){_0x19e349[_0x6697('0x1b')]=_0x220a27;if(_0x1cb8a6['query'][_0x6697('0x40')]){_0x59fadb[_0x6697('0x41')]=[{'all':!![]}];}return db[_0x6697('0x3e')][_0x6697('0x42')](_0x59fadb);})[_0x6697('0x3f')](function(_0x5f584d){_0x19e349[_0x6697('0x43')]=_0x5f584d;return _0x19e349;})[_0x6697('0x3f')](respondWithFilteredResult(_0xf3fd8c,_0x59fadb))[_0x6697('0x44')](handleError(_0xf3fd8c,null));};exports[_0x6697('0x45')]=function(_0x170359,_0x44ccac){var _0x4b370d={'raw':!![],'where':{'id':_0x170359[_0x6697('0x46')]['id']}},_0xda6ffb={};_0xda6ffb[_0x6697('0x2b')]=_[_0x6697('0x2d')](db[_0x6697('0x3e')]['rawAttributes']);_0xda6ffb[_0x6697('0x2c')]=_['keys'](_0x170359[_0x6697('0x2c')]);_0xda6ffb[_0x6697('0x2e')]=_[_0x6697('0x2f')](_0xda6ffb[_0x6697('0x2b')],_0xda6ffb[_0x6697('0x2c')]);_0x4b370d['attributes']=_[_0x6697('0x2f')](_0xda6ffb[_0x6697('0x2b')],qs[_0x6697('0x31')](_0x170359[_0x6697('0x2c')][_0x6697('0x31')]));_0x4b370d[_0x6697('0x30')]=_0x4b370d[_0x6697('0x30')]['length']?_0x4b370d[_0x6697('0x30')]:_0xda6ffb['model'];if(_0x170359[_0x6697('0x2c')][_0x6697('0x40')]){_0x4b370d['include']=[{'all':!![]}];}_0x4b370d=_[_0x6697('0x39')]({},_0x4b370d,_0x170359['options']);return db['OpenchannelApplication']['find'](_0x4b370d)[_0x6697('0x3f')](handleEntityNotFound(_0x44ccac,null))[_0x6697('0x3f')](respondWithResult(_0x44ccac,null))[_0x6697('0x44')](handleError(_0x44ccac,null));};exports[_0x6697('0x47')]=function(_0x982579,_0x16c066){return db[_0x6697('0x3e')][_0x6697('0x47')](_0x982579[_0x6697('0x48')],{})[_0x6697('0x3f')](respondWithResult(_0x16c066,0xc9))[_0x6697('0x44')](handleError(_0x16c066,null));};exports[_0x6697('0x21')]=function(_0x130025,_0x9c5ffa){if(_0x130025[_0x6697('0x48')]['id']){delete _0x130025[_0x6697('0x48')]['id'];}return db[_0x6697('0x3e')][_0x6697('0x49')]({'where':{'id':_0x130025[_0x6697('0x46')]['id']}})[_0x6697('0x3f')](handleEntityNotFound(_0x9c5ffa,null))[_0x6697('0x3f')](saveUpdates(_0x130025[_0x6697('0x48')],null))[_0x6697('0x3f')](respondWithResult(_0x9c5ffa,null))[_0x6697('0x44')](handleError(_0x9c5ffa,null));};exports[_0x6697('0x22')]=function(_0xe7451,_0x20cf45){return db['OpenchannelApplication'][_0x6697('0x49')]({'where':{'id':_0xe7451[_0x6697('0x46')]['id']}})[_0x6697('0x3f')](handleEntityNotFound(_0x20cf45,null))[_0x6697('0x3f')](removeEntity(_0x20cf45,null))[_0x6697('0x44')](handleError(_0x20cf45,null));}; \ No newline at end of file +var _0x39e9=['model','attributes','fields','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','end','error','name','send','OpenchannelApplication','fieldName','type','key','map','query','keys','filters','intersection'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x39e9,0x183));var _0x939e=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x39e9[_0x1d9aa0];return _0x226868;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x939e('0x0'));var zipdir=require(_0x939e('0x1'));var jsonpatch=require(_0x939e('0x2'));var rp=require(_0x939e('0x3'));var moment=require('moment');var BPromise=require(_0x939e('0x4'));var Mustache=require('mustache');var util=require(_0x939e('0x5'));var path=require(_0x939e('0x6'));var sox=require(_0x939e('0x7'));var csv=require(_0x939e('0x8'));var ejs=require(_0x939e('0x9'));var fs=require('fs');var fs_extra=require(_0x939e('0xa'));var _=require('lodash');var squel=require(_0x939e('0xb'));var crypto=require(_0x939e('0xc'));var jsforce=require(_0x939e('0xd'));var deskjs=require(_0x939e('0xe'));var toCsv=require(_0x939e('0x8'));var querystring=require(_0x939e('0xf'));var Papa=require(_0x939e('0x10'));var Redis=require(_0x939e('0x11'));var authService=require(_0x939e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x939e('0x13'));var hardwareService=require(_0x939e('0x14'));var logger=require(_0x939e('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x939e('0x16'));var licenseUtil=require(_0x939e('0x17'));var db=require(_0x939e('0x18'))['db'];function respondWithStatusCode(_0x2e6ad7,_0x5ce4fd){_0x5ce4fd=_0x5ce4fd||0xcc;return function(_0x3fdf1c){if(_0x3fdf1c){return _0x2e6ad7[_0x939e('0x19')](_0x5ce4fd);}return _0x2e6ad7[_0x939e('0x1a')](_0x5ce4fd)['end']();};}function respondWithResult(_0x331282,_0x3f695b){_0x3f695b=_0x3f695b||0xc8;return function(_0x537699){if(_0x537699){return _0x331282[_0x939e('0x1a')](_0x3f695b)[_0x939e('0x1b')](_0x537699);}};}function respondWithFilteredResult(_0xa6e435,_0x1090a3){return function(_0x50aa34){if(_0x50aa34){var _0x3c6d52=typeof _0x1090a3['offset']===_0x939e('0x1c')&&typeof _0x1090a3[_0x939e('0x1d')]==='undefined';var _0x1022f5=_0x50aa34[_0x939e('0x1e')];var _0x1dad74=_0x3c6d52?0x0:_0x1090a3[_0x939e('0x1f')];var _0x5d079a=_0x3c6d52?_0x50aa34['count']:_0x1090a3[_0x939e('0x1f')]+_0x1090a3['limit'];var _0x5b4f3a;if(_0x5d079a>=_0x1022f5){_0x5d079a=_0x1022f5;_0x5b4f3a=0xc8;}else{_0x5b4f3a=0xce;}_0xa6e435[_0x939e('0x1a')](_0x5b4f3a);return _0xa6e435[_0x939e('0x20')](_0x939e('0x21'),_0x1dad74+'-'+_0x5d079a+'/'+_0x1022f5)[_0x939e('0x1b')](_0x50aa34);}return null;};}function patchUpdates(_0x1f7341){return function(_0x19c113){try{jsonpatch['apply'](_0x19c113,_0x1f7341,!![]);}catch(_0x197b6f){return BPromise[_0x939e('0x22')](_0x197b6f);}return _0x19c113[_0x939e('0x23')]();};}function saveUpdates(_0x23a4d8,_0x5950d7){return function(_0x17d9d6){if(_0x17d9d6){return _0x17d9d6['update'](_0x23a4d8)[_0x939e('0x24')](function(_0x28afca){return _0x28afca;});}return null;};}function removeEntity(_0xa6ea7e,_0x4bf230){return function(_0x27f347){if(_0x27f347){return _0x27f347[_0x939e('0x25')]()[_0x939e('0x24')](function(){_0xa6ea7e[_0x939e('0x1a')](0xcc)[_0x939e('0x26')]();});}};}function handleEntityNotFound(_0x34b699,_0x5c5832){return function(_0x5bcd66){if(!_0x5bcd66){_0x34b699[_0x939e('0x19')](0x194);}return _0x5bcd66;};}function handleError(_0x1b9421,_0x2a0095){_0x2a0095=_0x2a0095||0x1f4;return function(_0x4cdde0){logger[_0x939e('0x27')](_0x4cdde0['stack']);if(_0x4cdde0[_0x939e('0x28')]){delete _0x4cdde0[_0x939e('0x28')];}_0x1b9421['status'](_0x2a0095)[_0x939e('0x29')](_0x4cdde0);};}exports['index']=function(_0x19e946,_0x2332f5){var _0x7918d0={},_0x450d32={},_0x4138d4={'count':0x0,'rows':[]};var _0x2d4b11=_['map'](db[_0x939e('0x2a')]['rawAttributes'],function(_0xcda9f7){return{'name':_0xcda9f7[_0x939e('0x2b')],'type':_0xcda9f7[_0x939e('0x2c')][_0x939e('0x2d')]};});_0x450d32['model']=_[_0x939e('0x2e')](_0x2d4b11,'name');_0x450d32[_0x939e('0x2f')]=_[_0x939e('0x30')](_0x19e946[_0x939e('0x2f')]);_0x450d32[_0x939e('0x31')]=_[_0x939e('0x32')](_0x450d32[_0x939e('0x33')],_0x450d32[_0x939e('0x2f')]);_0x7918d0[_0x939e('0x34')]=_[_0x939e('0x32')](_0x450d32[_0x939e('0x33')],qs[_0x939e('0x35')](_0x19e946[_0x939e('0x2f')][_0x939e('0x35')]));_0x7918d0['attributes']=_0x7918d0[_0x939e('0x34')]['length']?_0x7918d0['attributes']:_0x450d32['model'];if(!_0x19e946['query']['hasOwnProperty'](_0x939e('0x36'))){_0x7918d0[_0x939e('0x1d')]=qs['limit'](_0x19e946[_0x939e('0x2f')][_0x939e('0x1d')]);_0x7918d0[_0x939e('0x1f')]=qs['offset'](_0x19e946[_0x939e('0x2f')][_0x939e('0x1f')]);}_0x7918d0[_0x939e('0x37')]=qs[_0x939e('0x38')](_0x19e946[_0x939e('0x2f')]['sort']);_0x7918d0['where']=qs[_0x939e('0x31')](_[_0x939e('0x39')](_0x19e946[_0x939e('0x2f')],_0x450d32[_0x939e('0x31')]),_0x2d4b11);if(_0x19e946['query'][_0x939e('0x3a')]){_0x7918d0[_0x939e('0x3b')]=_['merge'](_0x7918d0[_0x939e('0x3b')],{'$or':_['map'](_0x2d4b11,function(_0x21424c){if(_0x21424c[_0x939e('0x2c')]!==_0x939e('0x3c')){var _0x2c8187={};_0x2c8187[_0x21424c[_0x939e('0x28')]]={'$like':'%'+_0x19e946[_0x939e('0x2f')][_0x939e('0x3a')]+'%'};return _0x2c8187;}})});}_0x7918d0=_[_0x939e('0x3d')]({},_0x7918d0,_0x19e946[_0x939e('0x3e')]);var _0x5db37f={'where':_0x7918d0[_0x939e('0x3b')]};return db[_0x939e('0x2a')][_0x939e('0x1e')](_0x5db37f)['then'](function(_0xa3968f){_0x4138d4[_0x939e('0x1e')]=_0xa3968f;if(_0x19e946['query'][_0x939e('0x3f')]){_0x7918d0[_0x939e('0x40')]=[{'all':!![]}];}return db[_0x939e('0x2a')][_0x939e('0x41')](_0x7918d0);})[_0x939e('0x24')](function(_0x213176){_0x4138d4['rows']=_0x213176;return _0x4138d4;})[_0x939e('0x24')](respondWithFilteredResult(_0x2332f5,_0x7918d0))[_0x939e('0x42')](handleError(_0x2332f5,null));};exports[_0x939e('0x43')]=function(_0x38bdce,_0x388413){var _0x258a93={'raw':!![],'where':{'id':_0x38bdce[_0x939e('0x44')]['id']}},_0x5328eb={};_0x5328eb[_0x939e('0x33')]=_[_0x939e('0x30')](db[_0x939e('0x2a')][_0x939e('0x45')]);_0x5328eb[_0x939e('0x2f')]=_[_0x939e('0x30')](_0x38bdce['query']);_0x5328eb[_0x939e('0x31')]=_[_0x939e('0x32')](_0x5328eb[_0x939e('0x33')],_0x5328eb[_0x939e('0x2f')]);_0x258a93['attributes']=_['intersection'](_0x5328eb[_0x939e('0x33')],qs[_0x939e('0x35')](_0x38bdce[_0x939e('0x2f')][_0x939e('0x35')]));_0x258a93['attributes']=_0x258a93[_0x939e('0x34')]['length']?_0x258a93['attributes']:_0x5328eb[_0x939e('0x33')];if(_0x38bdce[_0x939e('0x2f')][_0x939e('0x3f')]){_0x258a93[_0x939e('0x40')]=[{'all':!![]}];}_0x258a93=_[_0x939e('0x3d')]({},_0x258a93,_0x38bdce[_0x939e('0x3e')]);return db['OpenchannelApplication'][_0x939e('0x46')](_0x258a93)[_0x939e('0x24')](handleEntityNotFound(_0x388413,null))[_0x939e('0x24')](respondWithResult(_0x388413,null))['catch'](handleError(_0x388413,null));};exports[_0x939e('0x47')]=function(_0x1896ec,_0x3f6bc4){return db['OpenchannelApplication']['create'](_0x1896ec['body'],{})[_0x939e('0x24')](respondWithResult(_0x3f6bc4,0xc9))['catch'](handleError(_0x3f6bc4,null));};exports['update']=function(_0xb97569,_0x5509e4){if(_0xb97569[_0x939e('0x48')]['id']){delete _0xb97569[_0x939e('0x48')]['id'];}return db[_0x939e('0x2a')][_0x939e('0x46')]({'where':{'id':_0xb97569[_0x939e('0x44')]['id']}})[_0x939e('0x24')](handleEntityNotFound(_0x5509e4,null))[_0x939e('0x24')](saveUpdates(_0xb97569['body'],null))[_0x939e('0x24')](respondWithResult(_0x5509e4,null))[_0x939e('0x42')](handleError(_0x5509e4,null));};exports[_0x939e('0x25')]=function(_0x57c320,_0x15185e){return db[_0x939e('0x2a')][_0x939e('0x46')]({'where':{'id':_0x57c320[_0x939e('0x44')]['id']}})[_0x939e('0x24')](handleEntityNotFound(_0x15185e,null))[_0x939e('0x24')](removeEntity(_0x15185e,null))[_0x939e('0x42')](handleError(_0x15185e,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 8ebe391..c7d1638 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 _0x34e5=['./openchannelApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xac1808,_0x268e35){var _0x51def4=function(_0x3ef580){while(--_0x3ef580){_0xac1808['push'](_0xac1808['shift']());}};_0x51def4(++_0x268e35);}(_0x34e5,0x87));var _0x534e=function(_0x5477dd,_0x4656de){_0x5477dd=_0x5477dd-0x0;var _0x29a0eb=_0x34e5[_0x5477dd];return _0x29a0eb;};'use strict';var _=require(_0x534e('0x0'));var util=require('util');var logger=require(_0x534e('0x1'))(_0x534e('0x2'));var moment=require(_0x534e('0x3'));var BPromise=require('bluebird');var rp=require(_0x534e('0x4'));var fs=require('fs');var path=require(_0x534e('0x5'));var rimraf=require(_0x534e('0x6'));var config=require(_0x534e('0x7'));var attributes=require(_0x534e('0x8'));module[_0x534e('0x9')]=function(_0x3c5749,_0x4f7883){return _0x3c5749[_0x534e('0xa')]('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x534e('0xb'),'collate':_0x534e('0xc')});}; \ No newline at end of file +var _0xf58f=['rimraf','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','utf8mb4','util','../../config/logger','moment','request-promise','path'];(function(_0xe1b102,_0x542a72){var _0xed6dcc=function(_0x3191a6){while(--_0x3191a6){_0xe1b102['push'](_0xe1b102['shift']());}};_0xed6dcc(++_0x542a72);}(_0xf58f,0x69));var _0xff58=function(_0x45951d,_0x5afec6){_0x45951d=_0x45951d-0x0;var _0x1ad3c6=_0xf58f[_0x45951d];return _0x1ad3c6;};'use strict';var _=require('lodash');var util=require(_0xff58('0x0'));var logger=require(_0xff58('0x1'))('api');var moment=require(_0xff58('0x2'));var BPromise=require('bluebird');var rp=require(_0xff58('0x3'));var fs=require('fs');var path=require(_0xff58('0x4'));var rimraf=require(_0xff58('0x5'));var config=require(_0xff58('0x6'));var attributes=require(_0xff58('0x7'));module[_0xff58('0x8')]=function(_0x4ad273,_0x282c8f){return _0x4ad273['define'](_0xff58('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xff58('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index cb5ded1..d903e58 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 _0x4054=['rpc','../../config/environment','jayson/promise','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateOpenchannelApplication','update','body','options','raw','attributes','catch','lodash','util','ioredis','../../config/utils'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4054,0x173));var _0x4405=function(_0x569354,_0x31cec7){_0x569354=_0x569354-0x0;var _0x49fdb4=_0x4054[_0x569354];return _0x49fdb4;};'use strict';var _=require(_0x4405('0x0'));var util=require(_0x4405('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4405('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4405('0x3'));var logger=require('../../config/logger')(_0x4405('0x4'));var config=require(_0x4405('0x5'));var jayson=require(_0x4405('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4244f0,_0x58eff2,_0x5abdd1){return new BPromise(function(_0x4b965b,_0x48f250){return client[_0x4405('0x7')](_0x4244f0,_0x5abdd1)[_0x4405('0x8')](function(_0x4caa51){logger[_0x4405('0x9')](_0x4405('0xa'),_0x58eff2,_0x4405('0xb'));logger[_0x4405('0xc')](_0x4405('0xd'),_0x58eff2,'request\x20sent',JSON[_0x4405('0xe')](_0x4caa51));if(_0x4caa51[_0x4405('0xf')]){if(_0x4caa51['error'][_0x4405('0x10')]===0x1f4){logger[_0x4405('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x58eff2,_0x4caa51[_0x4405('0xf')][_0x4405('0x11')]);return _0x48f250(_0x4caa51[_0x4405('0xf')][_0x4405('0x11')]);}logger[_0x4405('0xf')](_0x4405('0xa'),_0x58eff2,_0x4caa51[_0x4405('0xf')]['message']);return _0x4b965b(_0x4caa51[_0x4405('0xf')][_0x4405('0x11')]);}else{logger[_0x4405('0x9')]('OpenchannelApplication,\x20%s,\x20%s',_0x58eff2,'request\x20sent');_0x4b965b(_0x4caa51['result'][_0x4405('0x11')]);}})['catch'](function(_0x3c26a9){logger[_0x4405('0xf')](_0x4405('0xa'),_0x58eff2,_0x3c26a9);_0x48f250(_0x3c26a9);});});}exports[_0x4405('0x12')]=function(_0xc429f7){var _0x1b5a0f=this;return new Promise(function(_0x418076,_0x256ee0){return db['OpenchannelApplication'][_0x4405('0x13')](_0xc429f7[_0x4405('0x14')],{'raw':_0xc429f7[_0x4405('0x15')]?_0xc429f7[_0x4405('0x15')][_0x4405('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc429f7[_0x4405('0x15')]?_0xc429f7['options']['where']||null:null,'attributes':_0xc429f7[_0x4405('0x15')]?_0xc429f7['options'][_0x4405('0x17')]||null:null,'limit':_0xc429f7['options']?_0xc429f7[_0x4405('0x15')]['limit']||null:null})['then'](function(_0x131a55){logger[_0x4405('0x9')](_0x4405('0x12'),_0xc429f7);logger[_0x4405('0xc')]('UpdateOpenchannelApplication',_0xc429f7,JSON[_0x4405('0xe')](_0x131a55));_0x418076(_0x131a55);})[_0x4405('0x18')](function(_0x29c7bd){logger[_0x4405('0xf')]('UpdateOpenchannelApplication',_0x29c7bd[_0x4405('0x11')],_0xc429f7);_0x256ee0(_0x1b5a0f[_0x4405('0xf')](0x1f4,_0x29c7bd[_0x4405('0x11')]));});});}; \ No newline at end of file +var _0x2d11=['update','body','options','raw','where','attributes','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','UpdateOpenchannelApplication','OpenchannelApplication'];(function(_0x3f74b2,_0x16df31){var _0x51136f=function(_0x3659ea){while(--_0x3659ea){_0x3f74b2['push'](_0x3f74b2['shift']());}};_0x51136f(++_0x16df31);}(_0x2d11,0xb5));var _0x12d1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2d11[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x12d1('0x0'));var util=require(_0x12d1('0x1'));var moment=require('moment');var BPromise=require(_0x12d1('0x2'));var rs=require(_0x12d1('0x3'));var fs=require('fs');var Redis=require(_0x12d1('0x4'));var db=require(_0x12d1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x12d1('0x6'))(_0x12d1('0x7'));var config=require(_0x12d1('0x8'));var jayson=require(_0x12d1('0x9'));var client=jayson[_0x12d1('0xa')][_0x12d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3454e7,_0x454f61,_0x39cdd9){return new BPromise(function(_0x2e8c54,_0x195b0b){return client['request'](_0x3454e7,_0x39cdd9)[_0x12d1('0xc')](function(_0x20bc6f){logger['info'](_0x12d1('0xd'),_0x454f61,_0x12d1('0xe'));logger[_0x12d1('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x454f61,_0x12d1('0xe'),JSON[_0x12d1('0x10')](_0x20bc6f));if(_0x20bc6f[_0x12d1('0x11')]){if(_0x20bc6f[_0x12d1('0x11')]['code']===0x1f4){logger[_0x12d1('0x11')](_0x12d1('0xd'),_0x454f61,_0x20bc6f[_0x12d1('0x11')][_0x12d1('0x12')]);return _0x195b0b(_0x20bc6f['error'][_0x12d1('0x12')]);}logger[_0x12d1('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x454f61,_0x20bc6f['error'][_0x12d1('0x12')]);return _0x2e8c54(_0x20bc6f[_0x12d1('0x11')]['message']);}else{logger['info'](_0x12d1('0xd'),_0x454f61,'request\x20sent');_0x2e8c54(_0x20bc6f['result'][_0x12d1('0x12')]);}})[_0x12d1('0x13')](function(_0xc12a32){logger[_0x12d1('0x11')](_0x12d1('0xd'),_0x454f61,_0xc12a32);_0x195b0b(_0xc12a32);});});}exports[_0x12d1('0x14')]=function(_0x4a40c4){var _0x58e54b=this;return new Promise(function(_0x46dc4f,_0x318c4d){return db[_0x12d1('0x15')][_0x12d1('0x16')](_0x4a40c4[_0x12d1('0x17')],{'raw':_0x4a40c4[_0x12d1('0x18')]?_0x4a40c4[_0x12d1('0x18')][_0x12d1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a40c4['options']?_0x4a40c4[_0x12d1('0x18')][_0x12d1('0x1a')]||null:null,'attributes':_0x4a40c4[_0x12d1('0x18')]?_0x4a40c4[_0x12d1('0x18')][_0x12d1('0x1b')]||null:null,'limit':_0x4a40c4[_0x12d1('0x18')]?_0x4a40c4[_0x12d1('0x18')]['limit']||null:null})['then'](function(_0x1ca4bc){logger[_0x12d1('0x1c')](_0x12d1('0x14'),_0x4a40c4);logger[_0x12d1('0xf')](_0x12d1('0x14'),_0x4a40c4,JSON[_0x12d1('0x10')](_0x1ca4bc));_0x46dc4f(_0x1ca4bc);})[_0x12d1('0x13')](function(_0x3bc32f){logger[_0x12d1('0x11')](_0x12d1('0x14'),_0x3bc32f['message'],_0x4a40c4);_0x318c4d(_0x58e54b['error'](0x1f4,_0x3bc32f[_0x12d1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 363a753..ca88fa1 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 _0x1595=['show','download','post','/:id/messages','addMessage','/:id/tags','openchannel','addTags','put','tracked','openchannelinteraction:update','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id'];(function(_0x53d6ab,_0x4d926e){var _0x50f495=function(_0x31a6ed){while(--_0x31a6ed){_0x53d6ab['push'](_0x53d6ab['shift']());}};_0x50f495(++_0x4d926e);}(_0x1595,0x1bf));var _0x5159=function(_0x3f95f9,_0xd70c18){_0x3f95f9=_0x3f95f9-0x0;var _0x3857de=_0x1595[_0x3f95f9];return _0x3857de;};'use strict';var multer=require(_0x5159('0x0'));var util=require(_0x5159('0x1'));var path=require(_0x5159('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5159('0x3')]();var fs_extra=require(_0x5159('0x4'));var auth=require(_0x5159('0x5'));var interaction=require(_0x5159('0x6'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0x5159('0x7')]('/',auth[_0x5159('0x8')](),controller[_0x5159('0x9')]);router[_0x5159('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x5159('0xa')]);router[_0x5159('0x7')](_0x5159('0xb'),auth[_0x5159('0x8')](),controller[_0x5159('0xc')]);router[_0x5159('0x7')]('/:id/messages',auth[_0x5159('0x8')](),controller['getMessages']);router[_0x5159('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x5159('0xd')]);router[_0x5159('0xe')]('/',auth[_0x5159('0x8')](),controller['create']);router[_0x5159('0xe')](_0x5159('0xf'),auth[_0x5159('0x8')](),controller[_0x5159('0x10')]);router['post'](_0x5159('0x11'),auth[_0x5159('0x8')](),interaction['tracked'](_0x5159('0x12'),'openchannelinteraction:addtags'),controller[_0x5159('0x13')]);router[_0x5159('0x14')](_0x5159('0xb'),auth[_0x5159('0x8')](),interaction[_0x5159('0x15')](_0x5159('0x12'),_0x5159('0x16')),controller[_0x5159('0x17')]);router[_0x5159('0x18')](_0x5159('0xb'),auth[_0x5159('0x8')](),interaction[_0x5159('0x15')]('openchannel','openchannelinteraction:destroy'),controller[_0x5159('0x19')]);router[_0x5159('0x18')](_0x5159('0x11'),auth['isAuthenticated'](),controller['removeTags']);module[_0x5159('0x1a')]=router; \ No newline at end of file +var _0x2d27=['tracked','openchannelinteraction:addtags','put','openchannel','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags'];(function(_0x47ccec,_0x613352){var _0x4224fd=function(_0x52ff22){while(--_0x52ff22){_0x47ccec['push'](_0x47ccec['shift']());}};_0x4224fd(++_0x613352);}(_0x2d27,0x8e));var _0x72d2=function(_0xf432a2,_0x2d1f98){_0xf432a2=_0xf432a2-0x0;var _0x4f5fad=_0x2d27[_0xf432a2];return _0x4f5fad;};'use strict';var multer=require('multer');var util=require(_0x72d2('0x0'));var path=require(_0x72d2('0x1'));var timeout=require(_0x72d2('0x2'));var express=require(_0x72d2('0x3'));var router=express[_0x72d2('0x4')]();var fs_extra=require(_0x72d2('0x5'));var auth=require(_0x72d2('0x6'));var interaction=require(_0x72d2('0x7'));var config=require(_0x72d2('0x8'));var controller=require('./openchannelInteraction.controller');router[_0x72d2('0x9')]('/',auth[_0x72d2('0xa')](),controller[_0x72d2('0xb')]);router[_0x72d2('0x9')](_0x72d2('0xc'),auth[_0x72d2('0xa')](),controller[_0x72d2('0xd')]);router[_0x72d2('0x9')](_0x72d2('0xe'),auth['isAuthenticated'](),controller[_0x72d2('0xf')]);router[_0x72d2('0x9')](_0x72d2('0x10'),auth[_0x72d2('0xa')](),controller[_0x72d2('0x11')]);router[_0x72d2('0x9')](_0x72d2('0x12'),auth[_0x72d2('0xa')](),controller['download']);router[_0x72d2('0x13')]('/',auth[_0x72d2('0xa')](),controller[_0x72d2('0x14')]);router[_0x72d2('0x13')](_0x72d2('0x10'),auth[_0x72d2('0xa')](),controller[_0x72d2('0x15')]);router[_0x72d2('0x13')](_0x72d2('0x16'),auth[_0x72d2('0xa')](),interaction[_0x72d2('0x17')]('openchannel',_0x72d2('0x18')),controller['addTags']);router[_0x72d2('0x19')](_0x72d2('0xe'),auth[_0x72d2('0xa')](),interaction[_0x72d2('0x17')](_0x72d2('0x1a'),'openchannelinteraction:update'),controller[_0x72d2('0x1b')]);router[_0x72d2('0x1c')](_0x72d2('0xe'),auth['isAuthenticated'](),interaction[_0x72d2('0x17')](_0x72d2('0x1a'),_0x72d2('0x1d')),controller[_0x72d2('0x1e')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x72d2('0x1f')]);module[_0x72d2('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 145bb58..953694e 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 _0xae87=['STRING','DATE','ENUM','out','BOOLEAN','INTEGER'];(function(_0x5b6abe,_0x27f2e5){var _0x79b775=function(_0x2a3046){while(--_0x2a3046){_0x5b6abe['push'](_0x5b6abe['shift']());}};_0x79b775(++_0x27f2e5);}(_0xae87,0x1ce));var _0x7ae8=function(_0x4ab99,_0x219ed2){_0x4ab99=_0x4ab99-0x0;var _0x29e39c=_0xae87[_0x4ab99];return _0x29e39c;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7ae8('0x0')]},'secondDisposition':{'type':Sequelize[_0x7ae8('0x0')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7ae8('0x0')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x7ae8('0x0')]},'lastMsgAt':{'type':Sequelize[_0x7ae8('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x7ae8('0x2')]('in',_0x7ae8('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7ae8('0x3')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x7ae8('0x0')]},'autoreplyExecuted':{'type':Sequelize[_0x7ae8('0x4')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7ae8('0x5')]}}; \ No newline at end of file +var _0x0de3=['DATE','STRING','ENUM','INTEGER','sequelize','exports'];(function(_0x38a6c6,_0x4062ca){var _0x142f0a=function(_0x1531ce){while(--_0x1531ce){_0x38a6c6['push'](_0x38a6c6['shift']());}};_0x142f0a(++_0x4062ca);}(_0x0de3,0x184));var _0x30de=function(_0x122701,_0x15dfea){_0x122701=_0x122701-0x0;var _0x18f1a2=_0x0de3[_0x122701];return _0x18f1a2;};'use strict';var Sequelize=require(_0x30de('0x0'));module[_0x30de('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x30de('0x2')]},'disposition':{'type':Sequelize[_0x30de('0x3')]},'secondDisposition':{'type':Sequelize[_0x30de('0x3')]},'thirdDisposition':{'type':Sequelize[_0x30de('0x3')]},'note':{'type':Sequelize[_0x30de('0x3')]},'read1stAt':{'type':Sequelize[_0x30de('0x2')]},'threadId':{'type':Sequelize[_0x30de('0x3')]},'externalUrl':{'type':Sequelize[_0x30de('0x3')]},'lastMsgAt':{'type':Sequelize[_0x30de('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x30de('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x30de('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 37b4d70..55343a9 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 _0xe3cd=['count','offset','set','json','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','openchannel','query','user','catch','show','from','params','model','keys','OpenchannelInteraction','filters','intersection','attributes','fields','includeAll','merge','options','create','body','find','addMessage','OpenchannelMessage','omit','findOne','hasOwnProperty','nolimit','order','sort','pick','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','rows','setTags','ids','spread','Tag','color','emit','removeTags','download','unix','join','files','root','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','attachments','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','mkdirSync','Openchannel','N.A.','toString','disposition','threadId','Public','Private','basename','createReadStream','pipe','createWriteStream','out','lastName','renderFile','server','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','rimraf','zip-dir','moment','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','undefined','limit'];(function(_0x89cb3a,_0x385fd1){var _0x407cf1=function(_0x61fa77){while(--_0x61fa77){_0x89cb3a['push'](_0x89cb3a['shift']());}};_0x407cf1(++_0x385fd1);}(_0xe3cd,0x1e0));var _0xde3c=function(_0x38d1eb,_0xb7aa0a){_0x38d1eb=_0x38d1eb-0x0;var _0x489aed=_0xe3cd[_0x38d1eb];return _0x489aed;};'use strict';var rimraf=require(_0xde3c('0x0'));var zipdir=require(_0xde3c('0x1'));var moment=require(_0xde3c('0x2'));var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0xde3c('0x3'));var Redis=require(_0xde3c('0x4'));var interaction=require(_0xde3c('0x5'));var qs=require(_0xde3c('0x6'));var pdf=require(_0xde3c('0x7'));var logger=require('../../config/logger')(_0xde3c('0x8'));var config=require(_0xde3c('0x9'));var db=require('../../mysqldb')['db'];config[_0xde3c('0xa')]=_['defaults'](config[_0xde3c('0xa')],{'host':_0xde3c('0xb'),'port':0x18eb});var socket=require(_0xde3c('0xc'))(new Redis(config['redis']));require(_0xde3c('0xd'))[_0xde3c('0xe')](socket);function respondWithStatusCode(_0x338c46,_0x5cd5b6){_0x5cd5b6=_0x5cd5b6||0xcc;return function(_0x209310){if(_0x209310){return _0x338c46[_0xde3c('0xf')](_0x5cd5b6);}return _0x338c46[_0xde3c('0x10')](_0x5cd5b6)[_0xde3c('0x11')]();};}function respondWithResult(_0x3efd1a,_0x1ac2c5){_0x1ac2c5=_0x1ac2c5||0xc8;return function(_0x4cbff2){if(_0x4cbff2){return _0x3efd1a[_0xde3c('0x10')](_0x1ac2c5)['json'](_0x4cbff2);}};}function respondWithFilteredResult(_0x37201b,_0x32e646){return function(_0x521b90){if(_0x521b90){var _0x349a40=typeof _0x32e646['offset']===_0xde3c('0x12')&&typeof _0x32e646[_0xde3c('0x13')]===_0xde3c('0x12');var _0x12606e=_0x521b90[_0xde3c('0x14')];var _0x5d1a60=_0x349a40?0x0:_0x32e646[_0xde3c('0x15')];var _0x3ebac4=_0x349a40?_0x521b90['count']:_0x32e646['offset']+_0x32e646[_0xde3c('0x13')];var _0x2c9cc1;if(_0x3ebac4>=_0x12606e){_0x3ebac4=_0x12606e;_0x2c9cc1=0xc8;}else{_0x2c9cc1=0xce;}_0x37201b[_0xde3c('0x10')](_0x2c9cc1);return _0x37201b[_0xde3c('0x16')]('Content-Range',_0x5d1a60+'-'+_0x3ebac4+'/'+_0x12606e)[_0xde3c('0x17')](_0x521b90);}return null;};}function saveUpdates(_0x592950){return function(_0x549f49){if(_0x549f49){return _0x549f49[_0xde3c('0x18')](_0x592950)[_0xde3c('0x19')](function(_0x5d531f){return _0x5d531f;});}return null;};}function removeEntity(_0x164789){return function(_0x1cc91a){if(_0x1cc91a){return _0x1cc91a[_0xde3c('0x1a')]()[_0xde3c('0x19')](function(){_0x164789[_0xde3c('0x10')](0xcc)[_0xde3c('0x11')]();});}};}function handleEntityNotFound(_0x4a6dd0){return function(_0x2f67c7){if(!_0x2f67c7){_0x4a6dd0[_0xde3c('0xf')](0x194);}return _0x2f67c7;};}function handleError(_0x6afde9,_0x3882ae){_0x3882ae=_0x3882ae||0x1f4;return function(_0x1ea87e){logger[_0xde3c('0x1b')](_0x1ea87e[_0xde3c('0x1c')]);if(_0x1ea87e[_0xde3c('0x1d')]){delete _0x1ea87e[_0xde3c('0x1d')];}_0x6afde9[_0xde3c('0x10')](_0x3882ae)[_0xde3c('0x1e')](_0x1ea87e);};}exports[_0xde3c('0x1f')]=function(_0x5a6ef2,_0x1366b5){var _0x4f96b0={};var _0x5c094b=_[_0xde3c('0x20')](db['OpenchannelInteraction'][_0xde3c('0x21')],function(_0x2ff8c7){return{'name':_0x2ff8c7[_0xde3c('0x22')],'type':_0x2ff8c7[_0xde3c('0x23')][_0xde3c('0x24')]};});_0x4f96b0=qs[_0xde3c('0x25')](_0x5c094b,_0x5a6ef2);return interaction['findAll'](_0xde3c('0x26'),_0x5a6ef2[_0xde3c('0x27')],_0x5a6ef2[_0xde3c('0x28')],_0x4f96b0,_0x5c094b)[_0xde3c('0x19')](respondWithFilteredResult(_0x1366b5,_0x4f96b0))[_0xde3c('0x29')](handleError(_0x1366b5,null));};exports[_0xde3c('0x2a')]=function(_0x3b491c,_0x47854d){var _0x364830={};if(_0x3b491c['query'][_0xde3c('0x23')]&&_0x3b491c[_0xde3c('0x27')]['type']===_0xde3c('0x2b')){_0x364830[_0xde3c('0x2b')]=_0x3b491c['params']['id'];}else{_0x364830['id']=_0x3b491c[_0xde3c('0x2c')]['id'];}var _0x5307ad={'raw':![],'where':_0x364830},_0x48f6ad={};_0x48f6ad[_0xde3c('0x2d')]=_[_0xde3c('0x2e')](db[_0xde3c('0x2f')][_0xde3c('0x21')]);_0x48f6ad[_0xde3c('0x27')]=_['keys'](_0x3b491c[_0xde3c('0x27')]);_0x48f6ad[_0xde3c('0x30')]=_[_0xde3c('0x31')](_0x48f6ad['model'],_0x48f6ad[_0xde3c('0x27')]);_0x5307ad[_0xde3c('0x32')]=_[_0xde3c('0x31')](_0x48f6ad[_0xde3c('0x2d')],qs[_0xde3c('0x33')](_0x3b491c['query'][_0xde3c('0x33')]));_0x5307ad[_0xde3c('0x32')]=_0x5307ad[_0xde3c('0x32')]['length']?_0x5307ad['attributes']:_0x48f6ad['model'];if(_0x3b491c['query'][_0xde3c('0x34')]){_0x5307ad['include']=[{'all':!![]}];}_0x5307ad=_[_0xde3c('0x35')]({},_0x5307ad,_0x3b491c[_0xde3c('0x36')]);return db[_0xde3c('0x2f')]['find'](_0x5307ad)['then'](handleEntityNotFound(_0x47854d,null))[_0xde3c('0x19')](respondWithResult(_0x47854d,null))[_0xde3c('0x29')](handleError(_0x47854d,null));};exports['create']=function(_0x460757,_0x20eed7){return db[_0xde3c('0x2f')][_0xde3c('0x37')](_0x460757[_0xde3c('0x38')],{})[_0xde3c('0x19')](respondWithResult(_0x20eed7,0xc9))[_0xde3c('0x29')](handleError(_0x20eed7,null));};exports['update']=function(_0x1bd6ec,_0x26f080){if(_0x1bd6ec['body']['id']){delete _0x1bd6ec[_0xde3c('0x38')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x1bd6ec[_0xde3c('0x2c')]['id']}})[_0xde3c('0x19')](handleEntityNotFound(_0x26f080,null))['then'](saveUpdates(_0x1bd6ec[_0xde3c('0x38')],null))[_0xde3c('0x19')](respondWithResult(_0x26f080,null))['catch'](handleError(_0x26f080,null));};exports[_0xde3c('0x1a')]=function(_0x4233ed,_0x4cbad9){return db[_0xde3c('0x2f')][_0xde3c('0x39')]({'where':{'id':_0x4233ed[_0xde3c('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4cbad9,null))[_0xde3c('0x19')](removeEntity(_0x4cbad9,null))[_0xde3c('0x29')](handleError(_0x4cbad9,null));};exports['describe']=function(_0x1775b5,_0x3cf8a5){return db[_0xde3c('0x2f')]['describe']()[_0xde3c('0x19')](respondWithResult(_0x3cf8a5,null))[_0xde3c('0x29')](handleError(_0x3cf8a5,null));};exports[_0xde3c('0x3a')]=function(_0x578c74,_0x19693c){return db[_0xde3c('0x3b')][_0xde3c('0x39')]({'where':{'id':_0x578c74[_0xde3c('0x2c')]['id']}})[_0xde3c('0x19')](handleEntityNotFound(_0x19693c,null))[_0xde3c('0x19')](function(_0x5c3292){if(_0x5c3292){return _0x5c3292[_0xde3c('0x3a')](_0x578c74[_0xde3c('0x38')]['ids'],_[_0xde3c('0x3c')](_0x578c74[_0xde3c('0x38')],['ids','id'])||{});}})[_0xde3c('0x19')](respondWithResult(_0x19693c,null))[_0xde3c('0x29')](handleError(_0x19693c,null));};exports['getMessages']=function(_0x4d6b2d,_0x4669b0){var _0x96fce6={'raw':![],'where':{}};var _0x2faf83={};var _0x3c1fac={'count':0x0,'rows':[]};return db[_0xde3c('0x2f')][_0xde3c('0x3d')]({'where':{'id':_0x4d6b2d['params']['id']}})[_0xde3c('0x19')](handleEntityNotFound(_0x4669b0,null))[_0xde3c('0x19')](function(_0x5c0674){if(_0x5c0674){_0x2faf83[_0xde3c('0x2d')]=_[_0xde3c('0x2e')](db['OpenchannelMessage'][_0xde3c('0x21')]);_0x2faf83['query']=_[_0xde3c('0x2e')](_0x4d6b2d[_0xde3c('0x27')]);_0x2faf83['filters']=_['intersection'](_0x2faf83[_0xde3c('0x2d')],_0x2faf83[_0xde3c('0x27')]);_0x96fce6[_0xde3c('0x32')]=_[_0xde3c('0x31')](_0x2faf83[_0xde3c('0x2d')],qs['fields'](_0x4d6b2d[_0xde3c('0x27')]['fields']));_0x96fce6['attributes']=_0x96fce6[_0xde3c('0x32')]['length']?_0x96fce6[_0xde3c('0x32')]:_0x2faf83[_0xde3c('0x2d')];if(!_0x4d6b2d[_0xde3c('0x27')][_0xde3c('0x3e')](_0xde3c('0x3f'))){_0x96fce6[_0xde3c('0x13')]=qs[_0xde3c('0x13')](_0x4d6b2d[_0xde3c('0x27')]['limit']);_0x96fce6[_0xde3c('0x15')]=qs[_0xde3c('0x15')](_0x4d6b2d[_0xde3c('0x27')][_0xde3c('0x15')]);}_0x96fce6[_0xde3c('0x40')]=qs['sort'](_0x4d6b2d['query'][_0xde3c('0x41')]);_0x96fce6['where']=qs['filters'](_[_0xde3c('0x42')](_0x4d6b2d[_0xde3c('0x27')],_0x2faf83[_0xde3c('0x30')]));_0x96fce6[_0xde3c('0x43')]['OpenchannelInteractionId']=_0x5c0674['id'];if(_0x4d6b2d[_0xde3c('0x27')][_0xde3c('0x44')]){_0x96fce6[_0xde3c('0x43')]=_['merge'](_0x96fce6[_0xde3c('0x43')],{'$or':_['map'](_0x96fce6[_0xde3c('0x32')],function(_0x1bbadc){var _0x1881e2={};_0x1881e2[_0x1bbadc]={'$like':'%'+_0x4d6b2d[_0xde3c('0x27')]['filter']+'%'};return _0x1881e2;})});}if(_0x4d6b2d[_0xde3c('0x27')][_0xde3c('0x45')]){var _0x49f5d6=_0x4d6b2d['query']['$gte'][_0xde3c('0x46')](',');var _0x2fa967={};_0x2fa967[_0x49f5d6[0x0]]={'$gte':moment(_0x49f5d6[0x1])[_0xde3c('0x47')](_0xde3c('0x48'))};_0x96fce6[_0xde3c('0x43')]=_[_0xde3c('0x35')](_0x96fce6[_0xde3c('0x43')],_0x2fa967);}_0x96fce6=_[_0xde3c('0x35')]({},_0x96fce6,_0x4d6b2d[_0xde3c('0x36')]);return db[_0xde3c('0x3b')][_0xde3c('0x14')]({'where':_0x96fce6[_0xde3c('0x43')]})[_0xde3c('0x19')](function(_0x2b2be0){_0x3c1fac[_0xde3c('0x14')]=_0x2b2be0;if(_0x4d6b2d[_0xde3c('0x27')][_0xde3c('0x34')]){_0x96fce6[_0xde3c('0x49')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xde3c('0x4a')](_0x96fce6);})[_0xde3c('0x19')](function(_0x1661fb){_0x3c1fac[_0xde3c('0x4b')]=_0x1661fb;return _0x3c1fac;});}})[_0xde3c('0x19')](respondWithFilteredResult(_0x4669b0,_0x96fce6))[_0xde3c('0x29')](handleError(_0x4669b0,null));};exports['addTags']=function(_0x410fa1,_0x107a0d){return db['OpenchannelInteraction'][_0xde3c('0x39')]({'where':{'id':_0x410fa1['params']['id']}})[_0xde3c('0x19')](handleEntityNotFound(_0x107a0d,null))[_0xde3c('0x19')](function(_0x45299d){if(_0x45299d){return _0x45299d[_0xde3c('0x4c')](_0x410fa1[_0xde3c('0x38')][_0xde3c('0x4d')],_['omit'](_0x410fa1[_0xde3c('0x38')],[_0xde3c('0x4d'),'id'])||{})[_0xde3c('0x4e')](function(){return db[_0xde3c('0x4f')][_0xde3c('0x4a')]({'attributes':['id',_0xde3c('0x1d'),_0xde3c('0x50')],'where':{'id':_0x410fa1[_0xde3c('0x38')][_0xde3c('0x4d')]}});})[_0xde3c('0x19')](function(_0x566894){socket[_0xde3c('0x51')]('openchannelInteractionTags:save',{'id':Number(_0x410fa1['params']['id']),'tags':_0x566894||[]});return{'id':Number(_0x410fa1['params']['id']),'tags':_0x566894||[]};});}})[_0xde3c('0x19')](respondWithResult(_0x107a0d,null))['catch'](handleError(_0x107a0d,null));};exports['removeTags']=function(_0x35229e,_0x25a469){return db[_0xde3c('0x2f')][_0xde3c('0x39')]({'where':{'id':_0x35229e['params']['id']}})[_0xde3c('0x19')](handleEntityNotFound(_0x25a469,null))[_0xde3c('0x19')](function(_0x27b0f5){if(_0x27b0f5){return _0x27b0f5[_0xde3c('0x52')](_0x35229e[_0xde3c('0x27')][_0xde3c('0x4d')]);}})[_0xde3c('0x19')](respondWithStatusCode(_0x25a469,null))[_0xde3c('0x29')](handleError(_0x25a469,null));};exports[_0xde3c('0x53')]=function(_0xba7941,_0x5c50f7){var _0x3614b1=moment()[_0xde3c('0x54')]()['toString']();var _0x5dcde8=path[_0xde3c('0x55')](config['root'],'server',_0xde3c('0x56'),'tmp');var _0x7a5e22=path['join'](config[_0xde3c('0x57')],'server',_0xde3c('0x56'),'attachments');var _0x16ec80=path[_0xde3c('0x55')](_0x5dcde8,_0x3614b1);var _0x3ddb3f=util[_0xde3c('0x47')](_0xde3c('0x58'),_0xba7941[_0xde3c('0x2c')]['id'],_0x3614b1);var _0x52008f=path[_0xde3c('0x55')](_0x5dcde8,_0x3ddb3f);var _0x49bb1e=[];_0x49bb1e[_0xde3c('0x59')]({'model':db[_0xde3c('0x5a')],'as':_0xde3c('0x5a'),'attributes':['id',_0xde3c('0x5b')],'raw':!![]});_0x49bb1e['push']({'model':db['CmContact'],'as':_0xde3c('0x5c'),'attributes':['id',_0xde3c('0x5d'),'lastName'],'raw':!![]});if(_0xba7941['query'][_0xde3c('0x5e')]){_0x49bb1e[_0xde3c('0x59')]({'model':db[_0xde3c('0x5f')],'as':_0xde3c('0x5f'),'raw':!![]});}var _0x53ca38=[{'model':db[_0xde3c('0x3b')],'as':_0xde3c('0x60'),'attributes':['id',_0xde3c('0x38'),_0xde3c('0x61'),_0xde3c('0x62'),_0xde3c('0x63'),_0xde3c('0x64')],'include':_0x49bb1e}];_0x53ca38[_0xde3c('0x59')]({'model':db[_0xde3c('0x65')],'as':_0xde3c('0x66'),'attributes':['id',_0xde3c('0x1d')]});_0x53ca38[_0xde3c('0x59')]({'model':db['User'],'as':_0xde3c('0x67'),'attributes':['id',_0xde3c('0x5b')]});return db[_0xde3c('0x2f')][_0xde3c('0x39')]({'where':{'id':_0xba7941[_0xde3c('0x2c')]['id']},'include':_0x53ca38})[_0xde3c('0x19')](handleEntityNotFound(_0x5c50f7,null))['then'](function(_0x1369ec){if(_0x1369ec){var _0x489316=_0x1369ec['get']({'plain':!![]});fs[_0xde3c('0x68')](_0x16ec80);var _0x5275a9={'channel':_0xde3c('0x69'),'account':_0x489316[_0xde3c('0x66')][_0xde3c('0x1d')],'agent':_0x489316[_0xde3c('0x67')]?_0x489316[_0xde3c('0x67')][_0xde3c('0x5b')]:_0xde3c('0x6a'),'createdAt':moment(_0x489316['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x489316['closed']?moment(_0x489316['closedAt'])[_0xde3c('0x47')](_0xde3c('0x48'))[_0xde3c('0x6b')]():'','disposition':_0x489316[_0xde3c('0x6c')],'visibility':_0x489316[_0xde3c('0x6d')]?_0xde3c('0x6e'):_0xde3c('0x6f'),'messages':_(_0x489316[_0xde3c('0x60')])[_0xde3c('0x44')]({'secret':![]})[_0xde3c('0x20')](function(_0xe82a8f){if(_0xe82a8f[_0xde3c('0x5f')]){var _0xaa1db=path[_0xde3c('0x55')](_0x7a5e22,_0xe82a8f['Attachment'][_0xde3c('0x70')]);if(fs['existsSync'](_0xaa1db)){fs[_0xde3c('0x71')](_0xaa1db)[_0xde3c('0x72')](fs[_0xde3c('0x73')](path[_0xde3c('0x55')](_0x16ec80,_0xe82a8f[_0xde3c('0x5f')][_0xde3c('0x70')])));}}return{'date':moment(_0xe82a8f['createdAt'])[_0xde3c('0x47')](_0xde3c('0x48'))[_0xde3c('0x6b')](),'sender':_0xe82a8f[_0xde3c('0x62')]===_0xde3c('0x74')?_0xe82a8f[_0xde3c('0x5a')]?_0xe82a8f[_0xde3c('0x5a')]['fullname']:'System':_0xe82a8f[_0xde3c('0x5c')][_0xde3c('0x5d')]+(_0xe82a8f[_0xde3c('0x5c')][_0xde3c('0x75')]?'\x20'+_0xe82a8f['Contact'][_0xde3c('0x75')]:''),'body':_0xe82a8f['Attachment']?_0xe82a8f['Attachment']['basename']:_0xe82a8f[_0xde3c('0x38')],'direction':_0xe82a8f[_0xde3c('0x62')]==='out'?'A':'C','secret':_0xe82a8f[_0xde3c('0x63')],'read':_0xe82a8f[_0xde3c('0x64')],'attachment':_0xe82a8f[_0xde3c('0x5f')]};})['value']()};return ejs[_0xde3c('0x76')](path[_0xde3c('0x55')](config[_0xde3c('0x57')],_0xde3c('0x77'),_0xde3c('0x78'),_0xde3c('0x79')),{'interaction':_0x5275a9})[_0xde3c('0x19')](function(_0x225c7c){var _0x11c589=path[_0xde3c('0x55')](_0x16ec80,_0xde3c('0x7a')+_0x489316['id']+'-'+_0x3614b1+_0xde3c('0x7b'));var _0x5003a0={'path':_0x11c589,'channel':_0xde3c('0x69'),'interactionId':_0x489316['id']};return pdf[_0xde3c('0x7c')](_0x225c7c,_0x5003a0);})['then'](function(){return new Promise(function(_0x1b178c,_0x4a407c){zipdir(_0x16ec80,{'saveTo':_0x52008f},function(_0xc918cb,_0x59f8fd){if(_0xc918cb)return _0x4a407c(_0xc918cb);return _0x1b178c(_0x59f8fd);});})[_0xde3c('0x19')](function(){return new Promise(function(_0x543980,_0x281f57){rimraf(_0x16ec80,function(_0x2c14fe){if(_0x2c14fe)_0x281f57(_0x2c14fe);return _0x543980();});});})[_0xde3c('0x19')](function(){return _0x5c50f7[_0xde3c('0x53')](_0x52008f,_0x3ddb3f,function(_0x217280){if(_0x217280){logger[_0xde3c('0x1b')]('Unable\x20to\x20delete\x20zip\x20file',_0x217280);}else{fs['unlinkSync'](_0x52008f);}});});});}else{return _0x5c50f7[_0xde3c('0xf')](0xc8);}})[_0xde3c('0x29')](handleError(_0x5c50f7,null));}; \ No newline at end of file +var _0x7b41=['length','includeAll','include','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','omit','getMessages','findOne','hasOwnProperty','order','where','pick','OpenchannelInteractionId','filter','map','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','ids','Tag','findAll','emit','openchannelInteractionTags:save','removeTags','download','toString','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','push','fullname','CmContact','firstName','Attachment','Messages','createdAt','direction','read','OpenchannelAccount','Account','User','Owner','Openchannel','N.A.','closedAt','disposition','threadId','Public','Private','basename','createReadStream','pipe','createWriteStream','out','Contact','lastName','secret','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','ejs','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','end','error','stack','name','index','OpenchannelInteraction','rawAttributes','fieldName','key','getOptions','openchannel','query','user','catch','type','from','params','model','keys','filters','intersection','attributes','fields'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x7b41,0x1d4));var _0x17b4=function(_0x2d2582,_0x37836b){_0x2d2582=_0x2d2582-0x0;var _0x2cad94=_0x7b41[_0x2d2582];return _0x2cad94;};'use strict';var rimraf=require(_0x17b4('0x0'));var zipdir=require(_0x17b4('0x1'));var moment=require(_0x17b4('0x2'));var util=require(_0x17b4('0x3'));var path=require('path');var ejs=require(_0x17b4('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x17b4('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0x17b4('0x6'));var pdf=require(_0x17b4('0x7'));var logger=require(_0x17b4('0x8'))(_0x17b4('0x9'));var config=require(_0x17b4('0xa'));var db=require(_0x17b4('0xb'))['db'];config[_0x17b4('0xc')]=_[_0x17b4('0xd')](config[_0x17b4('0xc')],{'host':_0x17b4('0xe'),'port':0x18eb});var socket=require(_0x17b4('0xf'))(new Redis(config[_0x17b4('0xc')]));require(_0x17b4('0x10'))[_0x17b4('0x11')](socket);function respondWithStatusCode(_0x318a4e,_0x4483cb){_0x4483cb=_0x4483cb||0xcc;return function(_0x504bc5){if(_0x504bc5){return _0x318a4e[_0x17b4('0x12')](_0x4483cb);}return _0x318a4e[_0x17b4('0x13')](_0x4483cb)['end']();};}function respondWithResult(_0x53c93e,_0x59172f){_0x59172f=_0x59172f||0xc8;return function(_0x1bcb0f){if(_0x1bcb0f){return _0x53c93e[_0x17b4('0x13')](_0x59172f)[_0x17b4('0x14')](_0x1bcb0f);}};}function respondWithFilteredResult(_0x2f59a3,_0x5f417d){return function(_0x1af89e){if(_0x1af89e){var _0x3047ba=typeof _0x5f417d[_0x17b4('0x15')]===_0x17b4('0x16')&&typeof _0x5f417d[_0x17b4('0x17')]==='undefined';var _0x6cfbcc=_0x1af89e[_0x17b4('0x18')];var _0x2ccecc=_0x3047ba?0x0:_0x5f417d[_0x17b4('0x15')];var _0x55508e=_0x3047ba?_0x1af89e[_0x17b4('0x18')]:_0x5f417d[_0x17b4('0x15')]+_0x5f417d[_0x17b4('0x17')];var _0x31cd2e;if(_0x55508e>=_0x6cfbcc){_0x55508e=_0x6cfbcc;_0x31cd2e=0xc8;}else{_0x31cd2e=0xce;}_0x2f59a3[_0x17b4('0x13')](_0x31cd2e);return _0x2f59a3['set'](_0x17b4('0x19'),_0x2ccecc+'-'+_0x55508e+'/'+_0x6cfbcc)[_0x17b4('0x14')](_0x1af89e);}return null;};}function saveUpdates(_0x233095){return function(_0x1cfd85){if(_0x1cfd85){return _0x1cfd85[_0x17b4('0x1a')](_0x233095)[_0x17b4('0x1b')](function(_0x368a56){return _0x368a56;});}return null;};}function removeEntity(_0x88a9c6){return function(_0xd77dc5){if(_0xd77dc5){return _0xd77dc5[_0x17b4('0x1c')]()[_0x17b4('0x1b')](function(){_0x88a9c6[_0x17b4('0x13')](0xcc)[_0x17b4('0x1d')]();});}};}function handleEntityNotFound(_0x4f1e81){return function(_0x208a89){if(!_0x208a89){_0x4f1e81[_0x17b4('0x12')](0x194);}return _0x208a89;};}function handleError(_0x527fd5,_0x2fa1a7){_0x2fa1a7=_0x2fa1a7||0x1f4;return function(_0x493076){logger[_0x17b4('0x1e')](_0x493076[_0x17b4('0x1f')]);if(_0x493076[_0x17b4('0x20')]){delete _0x493076['name'];}_0x527fd5[_0x17b4('0x13')](_0x2fa1a7)['send'](_0x493076);};}exports[_0x17b4('0x21')]=function(_0x122ed8,_0x2f6e79){var _0x2ff384={};var _0x48e168=_['map'](db[_0x17b4('0x22')][_0x17b4('0x23')],function(_0x35c216){return{'name':_0x35c216[_0x17b4('0x24')],'type':_0x35c216['type'][_0x17b4('0x25')]};});_0x2ff384=qs[_0x17b4('0x26')](_0x48e168,_0x122ed8);return interaction['findAll'](_0x17b4('0x27'),_0x122ed8[_0x17b4('0x28')],_0x122ed8[_0x17b4('0x29')],_0x2ff384,_0x48e168)[_0x17b4('0x1b')](respondWithFilteredResult(_0x2f6e79,_0x2ff384))[_0x17b4('0x2a')](handleError(_0x2f6e79,null));};exports['show']=function(_0x120c5e,_0xbe2699){var _0x46ce85={};if(_0x120c5e[_0x17b4('0x28')][_0x17b4('0x2b')]&&_0x120c5e[_0x17b4('0x28')][_0x17b4('0x2b')]===_0x17b4('0x2c')){_0x46ce85[_0x17b4('0x2c')]=_0x120c5e[_0x17b4('0x2d')]['id'];}else{_0x46ce85['id']=_0x120c5e[_0x17b4('0x2d')]['id'];}var _0x1c26c6={'raw':![],'where':_0x46ce85},_0x5f1326={};_0x5f1326[_0x17b4('0x2e')]=_['keys'](db['OpenchannelInteraction'][_0x17b4('0x23')]);_0x5f1326[_0x17b4('0x28')]=_[_0x17b4('0x2f')](_0x120c5e[_0x17b4('0x28')]);_0x5f1326[_0x17b4('0x30')]=_[_0x17b4('0x31')](_0x5f1326['model'],_0x5f1326[_0x17b4('0x28')]);_0x1c26c6[_0x17b4('0x32')]=_['intersection'](_0x5f1326['model'],qs[_0x17b4('0x33')](_0x120c5e['query']['fields']));_0x1c26c6[_0x17b4('0x32')]=_0x1c26c6['attributes'][_0x17b4('0x34')]?_0x1c26c6[_0x17b4('0x32')]:_0x5f1326[_0x17b4('0x2e')];if(_0x120c5e[_0x17b4('0x28')][_0x17b4('0x35')]){_0x1c26c6[_0x17b4('0x36')]=[{'all':!![]}];}_0x1c26c6=_[_0x17b4('0x37')]({},_0x1c26c6,_0x120c5e[_0x17b4('0x38')]);return db[_0x17b4('0x22')][_0x17b4('0x39')](_0x1c26c6)[_0x17b4('0x1b')](handleEntityNotFound(_0xbe2699,null))[_0x17b4('0x1b')](respondWithResult(_0xbe2699,null))[_0x17b4('0x2a')](handleError(_0xbe2699,null));};exports[_0x17b4('0x3a')]=function(_0x549cc9,_0x24fb41){return db[_0x17b4('0x22')][_0x17b4('0x3a')](_0x549cc9[_0x17b4('0x3b')],{})[_0x17b4('0x1b')](respondWithResult(_0x24fb41,0xc9))[_0x17b4('0x2a')](handleError(_0x24fb41,null));};exports['update']=function(_0x2f97c4,_0x8b2cd2){if(_0x2f97c4['body']['id']){delete _0x2f97c4[_0x17b4('0x3b')]['id'];}return db['OpenchannelInteraction'][_0x17b4('0x39')]({'where':{'id':_0x2f97c4[_0x17b4('0x2d')]['id']}})[_0x17b4('0x1b')](handleEntityNotFound(_0x8b2cd2,null))[_0x17b4('0x1b')](saveUpdates(_0x2f97c4[_0x17b4('0x3b')],null))[_0x17b4('0x1b')](respondWithResult(_0x8b2cd2,null))['catch'](handleError(_0x8b2cd2,null));};exports['destroy']=function(_0x4bd989,_0x170c23){return db[_0x17b4('0x22')][_0x17b4('0x39')]({'where':{'id':_0x4bd989[_0x17b4('0x2d')]['id']}})[_0x17b4('0x1b')](handleEntityNotFound(_0x170c23,null))[_0x17b4('0x1b')](removeEntity(_0x170c23,null))['catch'](handleError(_0x170c23,null));};exports[_0x17b4('0x3c')]=function(_0x4dcf01,_0x56c155){return db[_0x17b4('0x22')][_0x17b4('0x3c')]()[_0x17b4('0x1b')](respondWithResult(_0x56c155,null))['catch'](handleError(_0x56c155,null));};exports[_0x17b4('0x3d')]=function(_0x2ecade,_0x472b5f){return db[_0x17b4('0x3e')][_0x17b4('0x39')]({'where':{'id':_0x2ecade['params']['id']}})[_0x17b4('0x1b')](handleEntityNotFound(_0x472b5f,null))['then'](function(_0x2dfc4a){if(_0x2dfc4a){return _0x2dfc4a[_0x17b4('0x3d')](_0x2ecade[_0x17b4('0x3b')]['ids'],_[_0x17b4('0x3f')](_0x2ecade['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x472b5f,null))[_0x17b4('0x2a')](handleError(_0x472b5f,null));};exports[_0x17b4('0x40')]=function(_0x5af9cd,_0x3ee17e){var _0x5f0ce1={'raw':![],'where':{}};var _0x14be52={};var _0x39e819={'count':0x0,'rows':[]};return db[_0x17b4('0x22')][_0x17b4('0x41')]({'where':{'id':_0x5af9cd[_0x17b4('0x2d')]['id']}})[_0x17b4('0x1b')](handleEntityNotFound(_0x3ee17e,null))[_0x17b4('0x1b')](function(_0x2fcd0c){if(_0x2fcd0c){_0x14be52['model']=_[_0x17b4('0x2f')](db[_0x17b4('0x3e')][_0x17b4('0x23')]);_0x14be52[_0x17b4('0x28')]=_[_0x17b4('0x2f')](_0x5af9cd[_0x17b4('0x28')]);_0x14be52[_0x17b4('0x30')]=_[_0x17b4('0x31')](_0x14be52['model'],_0x14be52[_0x17b4('0x28')]);_0x5f0ce1[_0x17b4('0x32')]=_['intersection'](_0x14be52[_0x17b4('0x2e')],qs[_0x17b4('0x33')](_0x5af9cd[_0x17b4('0x28')]['fields']));_0x5f0ce1[_0x17b4('0x32')]=_0x5f0ce1[_0x17b4('0x32')][_0x17b4('0x34')]?_0x5f0ce1[_0x17b4('0x32')]:_0x14be52[_0x17b4('0x2e')];if(!_0x5af9cd[_0x17b4('0x28')][_0x17b4('0x42')]('nolimit')){_0x5f0ce1[_0x17b4('0x17')]=qs[_0x17b4('0x17')](_0x5af9cd['query'][_0x17b4('0x17')]);_0x5f0ce1[_0x17b4('0x15')]=qs['offset'](_0x5af9cd[_0x17b4('0x28')][_0x17b4('0x15')]);}_0x5f0ce1[_0x17b4('0x43')]=qs['sort'](_0x5af9cd[_0x17b4('0x28')]['sort']);_0x5f0ce1[_0x17b4('0x44')]=qs['filters'](_[_0x17b4('0x45')](_0x5af9cd[_0x17b4('0x28')],_0x14be52[_0x17b4('0x30')]));_0x5f0ce1[_0x17b4('0x44')][_0x17b4('0x46')]=_0x2fcd0c['id'];if(_0x5af9cd[_0x17b4('0x28')][_0x17b4('0x47')]){_0x5f0ce1[_0x17b4('0x44')]=_[_0x17b4('0x37')](_0x5f0ce1[_0x17b4('0x44')],{'$or':_[_0x17b4('0x48')](_0x5f0ce1['attributes'],function(_0x1493b5){var _0x14ce65={};_0x14ce65[_0x1493b5]={'$like':'%'+_0x5af9cd[_0x17b4('0x28')][_0x17b4('0x47')]+'%'};return _0x14ce65;})});}if(_0x5af9cd[_0x17b4('0x28')]['$gte']){var _0x16ab22=_0x5af9cd[_0x17b4('0x28')]['$gte'][_0x17b4('0x49')](',');var _0x5ef3cf={};_0x5ef3cf[_0x16ab22[0x0]]={'$gte':moment(_0x16ab22[0x1])[_0x17b4('0x4a')](_0x17b4('0x4b'))};_0x5f0ce1[_0x17b4('0x44')]=_[_0x17b4('0x37')](_0x5f0ce1[_0x17b4('0x44')],_0x5ef3cf);}_0x5f0ce1=_[_0x17b4('0x37')]({},_0x5f0ce1,_0x5af9cd[_0x17b4('0x38')]);return db[_0x17b4('0x3e')][_0x17b4('0x18')]({'where':_0x5f0ce1[_0x17b4('0x44')]})[_0x17b4('0x1b')](function(_0x4e08ab){_0x39e819[_0x17b4('0x18')]=_0x4e08ab;if(_0x5af9cd['query'][_0x17b4('0x35')]){_0x5f0ce1[_0x17b4('0x36')]=[{'all':!![]}];}return db[_0x17b4('0x3e')]['findAll'](_0x5f0ce1);})['then'](function(_0x168d6c){_0x39e819[_0x17b4('0x4c')]=_0x168d6c;return _0x39e819;});}})['then'](respondWithFilteredResult(_0x3ee17e,_0x5f0ce1))[_0x17b4('0x2a')](handleError(_0x3ee17e,null));};exports['addTags']=function(_0x20c8d0,_0x113c4e){return db[_0x17b4('0x22')][_0x17b4('0x39')]({'where':{'id':_0x20c8d0['params']['id']}})['then'](handleEntityNotFound(_0x113c4e,null))[_0x17b4('0x1b')](function(_0x4359b6){if(_0x4359b6){return _0x4359b6[_0x17b4('0x4d')](_0x20c8d0[_0x17b4('0x3b')][_0x17b4('0x4e')],_[_0x17b4('0x3f')](_0x20c8d0[_0x17b4('0x3b')],['ids','id'])||{})['spread'](function(){return db[_0x17b4('0x4f')][_0x17b4('0x50')]({'attributes':['id',_0x17b4('0x20'),'color'],'where':{'id':_0x20c8d0[_0x17b4('0x3b')][_0x17b4('0x4e')]}});})[_0x17b4('0x1b')](function(_0x42229c){socket[_0x17b4('0x51')](_0x17b4('0x52'),{'id':Number(_0x20c8d0[_0x17b4('0x2d')]['id']),'tags':_0x42229c||[]});return{'id':Number(_0x20c8d0[_0x17b4('0x2d')]['id']),'tags':_0x42229c||[]};});}})['then'](respondWithResult(_0x113c4e,null))['catch'](handleError(_0x113c4e,null));};exports[_0x17b4('0x53')]=function(_0x50f7b8,_0x162fc0){return db[_0x17b4('0x22')][_0x17b4('0x39')]({'where':{'id':_0x50f7b8[_0x17b4('0x2d')]['id']}})[_0x17b4('0x1b')](handleEntityNotFound(_0x162fc0,null))[_0x17b4('0x1b')](function(_0x2b8339){if(_0x2b8339){return _0x2b8339[_0x17b4('0x53')](_0x50f7b8[_0x17b4('0x28')][_0x17b4('0x4e')]);}})[_0x17b4('0x1b')](respondWithStatusCode(_0x162fc0,null))[_0x17b4('0x2a')](handleError(_0x162fc0,null));};exports[_0x17b4('0x54')]=function(_0x5f0316,_0x44a7e4){var _0x4c6a5e=moment()['unix']()[_0x17b4('0x55')]();var _0x42b732=path[_0x17b4('0x56')](config['root'],_0x17b4('0x57'),_0x17b4('0x58'),_0x17b4('0x59'));var _0x53dd45=path[_0x17b4('0x56')](config[_0x17b4('0x5a')],_0x17b4('0x57'),_0x17b4('0x58'),_0x17b4('0x5b'));var _0x471344=path[_0x17b4('0x56')](_0x42b732,_0x4c6a5e);var _0x223a8e=util[_0x17b4('0x4a')](_0x17b4('0x5c'),_0x5f0316[_0x17b4('0x2d')]['id'],_0x4c6a5e);var _0x44dbdc=path[_0x17b4('0x56')](_0x42b732,_0x223a8e);var _0x5bbf06=[];_0x5bbf06[_0x17b4('0x5d')]({'model':db['User'],'as':'User','attributes':['id',_0x17b4('0x5e')],'raw':!![]});_0x5bbf06[_0x17b4('0x5d')]({'model':db[_0x17b4('0x5f')],'as':'Contact','attributes':['id',_0x17b4('0x60'),'lastName'],'raw':!![]});if(_0x5f0316['query'][_0x17b4('0x5b')]){_0x5bbf06['push']({'model':db[_0x17b4('0x61')],'as':_0x17b4('0x61'),'raw':!![]});}var _0x47b6b6=[{'model':db[_0x17b4('0x3e')],'as':_0x17b4('0x62'),'attributes':['id','body',_0x17b4('0x63'),_0x17b4('0x64'),'secret',_0x17b4('0x65')],'include':_0x5bbf06}];_0x47b6b6[_0x17b4('0x5d')]({'model':db[_0x17b4('0x66')],'as':_0x17b4('0x67'),'attributes':['id',_0x17b4('0x20')]});_0x47b6b6['push']({'model':db[_0x17b4('0x68')],'as':_0x17b4('0x69'),'attributes':['id',_0x17b4('0x5e')]});return db['OpenchannelInteraction'][_0x17b4('0x39')]({'where':{'id':_0x5f0316[_0x17b4('0x2d')]['id']},'include':_0x47b6b6})['then'](handleEntityNotFound(_0x44a7e4,null))[_0x17b4('0x1b')](function(_0x643383){if(_0x643383){var _0x1b0909=_0x643383['get']({'plain':!![]});fs['mkdirSync'](_0x471344);var _0x4b16f4={'channel':_0x17b4('0x6a'),'account':_0x1b0909[_0x17b4('0x67')][_0x17b4('0x20')],'agent':_0x1b0909[_0x17b4('0x69')]?_0x1b0909[_0x17b4('0x69')][_0x17b4('0x5e')]:_0x17b4('0x6b'),'createdAt':moment(_0x1b0909[_0x17b4('0x63')])[_0x17b4('0x4a')](_0x17b4('0x4b'))['toString'](),'closedAt':_0x1b0909['closed']?moment(_0x1b0909[_0x17b4('0x6c')])[_0x17b4('0x4a')](_0x17b4('0x4b'))['toString']():'','disposition':_0x1b0909[_0x17b4('0x6d')],'visibility':_0x1b0909[_0x17b4('0x6e')]?_0x17b4('0x6f'):_0x17b4('0x70'),'messages':_(_0x1b0909['Messages'])[_0x17b4('0x47')]({'secret':![]})[_0x17b4('0x48')](function(_0x4179c7){if(_0x4179c7[_0x17b4('0x61')]){var _0x2f37c8=path[_0x17b4('0x56')](_0x53dd45,_0x4179c7[_0x17b4('0x61')][_0x17b4('0x71')]);if(fs['existsSync'](_0x2f37c8)){fs[_0x17b4('0x72')](_0x2f37c8)[_0x17b4('0x73')](fs[_0x17b4('0x74')](path['join'](_0x471344,_0x4179c7[_0x17b4('0x61')]['basename'])));}}return{'date':moment(_0x4179c7[_0x17b4('0x63')])[_0x17b4('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0x17b4('0x55')](),'sender':_0x4179c7[_0x17b4('0x64')]===_0x17b4('0x75')?_0x4179c7[_0x17b4('0x68')]?_0x4179c7[_0x17b4('0x68')]['fullname']:'System':_0x4179c7['Contact'][_0x17b4('0x60')]+(_0x4179c7[_0x17b4('0x76')][_0x17b4('0x77')]?'\x20'+_0x4179c7[_0x17b4('0x76')][_0x17b4('0x77')]:''),'body':_0x4179c7[_0x17b4('0x61')]?_0x4179c7[_0x17b4('0x61')][_0x17b4('0x71')]:_0x4179c7[_0x17b4('0x3b')],'direction':_0x4179c7[_0x17b4('0x64')]==='out'?'A':'C','secret':_0x4179c7[_0x17b4('0x78')],'read':_0x4179c7['read'],'attachment':_0x4179c7[_0x17b4('0x61')]};})[_0x17b4('0x79')]()};return ejs[_0x17b4('0x7a')](path[_0x17b4('0x56')](config[_0x17b4('0x5a')],_0x17b4('0x57'),_0x17b4('0x7b'),_0x17b4('0x7c')),{'interaction':_0x4b16f4})['then'](function(_0x2b68ba){var _0x3d1e35=path['join'](_0x471344,_0x17b4('0x7d')+_0x1b0909['id']+'-'+_0x4c6a5e+_0x17b4('0x7e'));var _0x12bbe6={'path':_0x3d1e35,'channel':_0x17b4('0x6a'),'interactionId':_0x1b0909['id']};return pdf[_0x17b4('0x7f')](_0x2b68ba,_0x12bbe6);})[_0x17b4('0x1b')](function(){return new Promise(function(_0x25da4c,_0x4674d3){zipdir(_0x471344,{'saveTo':_0x44dbdc},function(_0x46f85e,_0x4ed0b3){if(_0x46f85e)return _0x4674d3(_0x46f85e);return _0x25da4c(_0x4ed0b3);});})['then'](function(){return new Promise(function(_0x137934,_0x59d108){rimraf(_0x471344,function(_0x47b8dc){if(_0x47b8dc)_0x59d108(_0x47b8dc);return _0x137934();});});})['then'](function(){return _0x44a7e4['download'](_0x44dbdc,_0x223a8e,function(_0x3393e1){if(_0x3393e1){logger['error'](_0x17b4('0x80'),_0x3393e1);}else{fs[_0x17b4('0x81')](_0x44dbdc);}});});});}else{return _0x44a7e4[_0x17b4('0x12')](0xc8);}})[_0x17b4('0x2a')](handleError(_0x44a7e4,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 02bcd0a..96f5bff 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 _0x4a01=['Users','map','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','remove','then','setDataValue'];(function(_0x38d64b,_0x56a8ac){var _0x58868c=function(_0x4a06e0){while(--_0x4a06e0){_0x38d64b['push'](_0x38d64b['shift']());}};_0x58868c(++_0x56a8ac);}(_0x4a01,0xa1));var _0x14a0=function(_0x17d4fd,_0x1132b7){_0x17d4fd=_0x17d4fd-0x0;var _0x18490e=_0x4a01[_0x17d4fd];return _0x18490e;};'use strict';var EventEmitter=require(_0x14a0('0x0'));var OpenchannelInteraction=require(_0x14a0('0x1'))['db'][_0x14a0('0x2')];var OpenchannelMessage=require(_0x14a0('0x1'))['db'][_0x14a0('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x14a0('0x4')](0x0);var events={'afterCreate':_0x14a0('0x5'),'afterUpdate':'update','afterDestroy':_0x14a0('0x6')};function emitEvent(_0x7c8108){return function(_0x27bc58,_0x684037,_0x43fbd9){_0x27bc58['getUsers']({'attributes':['id'],'raw':!![]})[_0x14a0('0x7')](function(_0x25e2e2){_0x27bc58[_0x14a0('0x8')](_0x14a0('0x9'),_0x25e2e2[_0x14a0('0xa')](function(_0x70ff86){return{'id':_0x70ff86['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x27bc58['id'],'direction':'in','read':![]},'raw':!![]});})[_0x14a0('0x7')](function(_0x478344){_0x27bc58[_0x14a0('0x8')]('unreadMessages',_0x478344[_0x14a0('0xb')]);OpenchannelInteractionEvents['emit'](_0x7c8108+':'+_0x27bc58['id'],_0x27bc58);OpenchannelInteractionEvents[_0x14a0('0xc')](_0x7c8108,_0x27bc58);_0x43fbd9(null);})[_0x14a0('0xd')](_0x43fbd9(null));};}for(var e in events){if(events[_0x14a0('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x14a0('0xf')](e,emitEvent(event));}}module[_0x14a0('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x8dcc=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','length','emit','catch','hasOwnProperty','hook'];(function(_0x304ac5,_0x365c84){var _0xee8d41=function(_0x17a814){while(--_0x17a814){_0x304ac5['push'](_0x304ac5['shift']());}};_0xee8d41(++_0x365c84);}(_0x8dcc,0x151));var _0xc8dc=function(_0x4cf8e4,_0x2a2f2f){_0x4cf8e4=_0x4cf8e4-0x0;var _0x49d46c=_0x8dcc[_0x4cf8e4];return _0x49d46c;};'use strict';var EventEmitter=require(_0xc8dc('0x0'));var OpenchannelInteraction=require(_0xc8dc('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xc8dc('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xc8dc('0x2')](0x0);var events={'afterCreate':_0xc8dc('0x3'),'afterUpdate':_0xc8dc('0x4'),'afterDestroy':_0xc8dc('0x5')};function emitEvent(_0x5c439b){return function(_0x97dbc9,_0x55c43f,_0x2b56bf){_0x97dbc9[_0xc8dc('0x6')]({'attributes':['id'],'raw':!![]})[_0xc8dc('0x7')](function(_0x515a9b){_0x97dbc9[_0xc8dc('0x8')](_0xc8dc('0x9'),_0x515a9b['map'](function(_0x390381){return{'id':_0x390381['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x97dbc9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc8dc('0x7')](function(_0x391253){_0x97dbc9[_0xc8dc('0x8')]('unreadMessages',_0x391253[_0xc8dc('0xa')]);OpenchannelInteractionEvents[_0xc8dc('0xb')](_0x5c439b+':'+_0x97dbc9['id'],_0x97dbc9);OpenchannelInteractionEvents[_0xc8dc('0xb')](_0x5c439b,_0x97dbc9);_0x2b56bf(null);})[_0xc8dc('0xc')](_0x2b56bf(null));};}for(var e in events){if(events[_0xc8dc('0xd')](e)){var event=events[e];OpenchannelInteraction[_0xc8dc('0xe')](e,emitEvent(event));}}module[_0xc8dc('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 0f58990..7e99ada 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 _0x38e7=['changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2e50a1,_0x53a022){var _0x2a0448=function(_0x2e9cb1){while(--_0x2e9cb1){_0x2e50a1['push'](_0x2e50a1['shift']());}};_0x2a0448(++_0x53a022);}(_0x38e7,0x124));var _0x738e=function(_0x242a4f,_0x369c57){_0x242a4f=_0x242a4f-0x0;var _0x122117=_0x38e7[_0x242a4f];return _0x122117;};'use strict';var _=require('lodash');var util=require(_0x738e('0x0'));var logger=require('../../config/logger')(_0x738e('0x1'));var moment=require(_0x738e('0x2'));var BPromise=require(_0x738e('0x3'));var rp=require(_0x738e('0x4'));var fs=require('fs');var path=require(_0x738e('0x5'));var rimraf=require(_0x738e('0x6'));var config=require(_0x738e('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0x738e('0x8')]=function(_0x32f7e8,_0x29a8dd){return _0x32f7e8[_0x738e('0x9')](_0x738e('0xa'),attributes,{'tableName':_0x738e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x738e('0xc'),'collate':_0x738e('0xd'),'hooks':{'beforeUpdate':function(_0x3e4e6a,_0x4c5929,_0x511191){if(_0x3e4e6a[_0x738e('0xe')](_0x738e('0xf'))){_0x3e4e6a['closedAt']=moment()[_0x738e('0x10')](_0x738e('0x11'));}_0x511191(null,_0x3e4e6a);}}});}; \ No newline at end of file +var _0x9e71=['OpenchannelInteraction','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','path','../../config/environment','./openchannelInteraction.attributes','exports','define'];(function(_0x39f8ea,_0x35a0e4){var _0x3d9f95=function(_0x1b1aa9){while(--_0x1b1aa9){_0x39f8ea['push'](_0x39f8ea['shift']());}};_0x3d9f95(++_0x35a0e4);}(_0x9e71,0x1a8));var _0x19e7=function(_0x13508e,_0x273e9b){_0x13508e=_0x13508e-0x0;var _0x5ddb20=_0x9e71[_0x13508e];return _0x5ddb20;};'use strict';var _=require(_0x19e7('0x0'));var util=require(_0x19e7('0x1'));var logger=require('../../config/logger')(_0x19e7('0x2'));var moment=require(_0x19e7('0x3'));var BPromise=require(_0x19e7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x19e7('0x5'));var rimraf=require('rimraf');var config=require(_0x19e7('0x6'));var attributes=require(_0x19e7('0x7'));module[_0x19e7('0x8')]=function(_0x4aab99,_0xe99d98){return _0x4aab99[_0x19e7('0x9')](_0x19e7('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x54bcae,_0x5333af,_0x267df3){if(_0x54bcae['changed'](_0x19e7('0xb'))){_0x54bcae['closedAt']=moment()[_0x19e7('0xc')](_0x19e7('0xd'));}_0x267df3(null,_0x54bcae);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 225e427..5a8116b 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 _0x469c=['OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','attributes','limit','AddTagsToOpenchannelInteraction','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','then','info','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x4d8738,_0x16866a){var _0x2e3cd0=function(_0x48c0a4){while(--_0x48c0a4){_0x4d8738['push'](_0x4d8738['shift']());}};_0x2e3cd0(++_0x16866a);}(_0x469c,0x146));var _0xc469=function(_0x423549,_0x242e63){_0x423549=_0x423549-0x0;var _0xdcb104=_0x469c[_0x423549];return _0xdcb104;};'use strict';var _=require(_0xc469('0x0'));var util=require('util');var moment=require(_0xc469('0x1'));var BPromise=require('bluebird');var rs=require(_0xc469('0x2'));var fs=require('fs');var Redis=require(_0xc469('0x3'));var db=require(_0xc469('0x4'))['db'];var utils=require(_0xc469('0x5'));var logger=require(_0xc469('0x6'))(_0xc469('0x7'));var config=require(_0xc469('0x8'));var jayson=require(_0xc469('0x9'));var client=jayson[_0xc469('0xa')][_0xc469('0xb')]({'port':0x232a});config[_0xc469('0xc')]=_[_0xc469('0xd')](config[_0xc469('0xc')],{'host':_0xc469('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc469('0xc')]));require(_0xc469('0xf'))[_0xc469('0x10')](socket);function respondWithRpcPromise(_0x5ec35a,_0x458602,_0x16dca5){return new BPromise(function(_0x304bbf,_0x66e948){return client[_0xc469('0x11')](_0x5ec35a,_0x16dca5)[_0xc469('0x12')](function(_0x51f767){logger[_0xc469('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x458602,'request\x20sent');logger[_0xc469('0x14')](_0xc469('0x15'),_0x458602,_0xc469('0x16'),JSON[_0xc469('0x17')](_0x51f767));if(_0x51f767['error']){if(_0x51f767[_0xc469('0x18')][_0xc469('0x19')]===0x1f4){logger['error'](_0xc469('0x1a'),_0x458602,_0x51f767['error'][_0xc469('0x1b')]);return _0x66e948(_0x51f767[_0xc469('0x18')]['message']);}logger[_0xc469('0x18')](_0xc469('0x1a'),_0x458602,_0x51f767[_0xc469('0x18')]['message']);return _0x304bbf(_0x51f767[_0xc469('0x18')][_0xc469('0x1b')]);}else{logger[_0xc469('0x13')](_0xc469('0x1a'),_0x458602,_0xc469('0x16'));_0x304bbf(_0x51f767[_0xc469('0x1c')][_0xc469('0x1b')]);}})[_0xc469('0x1d')](function(_0x47da42){logger[_0xc469('0x18')](_0xc469('0x1a'),_0x458602,_0x47da42);_0x66e948(_0x47da42);});});}exports[_0xc469('0x1e')]=function(_0x27aab7){var _0x242aac=this;return new Promise(function(_0x53d3ee,_0x423549){return db[_0xc469('0x1f')][_0xc469('0x20')](_0x27aab7[_0xc469('0x21')],{'raw':_0x27aab7[_0xc469('0x22')]?_0x27aab7[_0xc469('0x22')][_0xc469('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27aab7[_0xc469('0x22')]?_0x27aab7[_0xc469('0x22')]['where']||null:null,'attributes':_0x27aab7[_0xc469('0x22')]?_0x27aab7[_0xc469('0x22')][_0xc469('0x24')]||null:null,'limit':_0x27aab7[_0xc469('0x22')]?_0x27aab7[_0xc469('0x22')][_0xc469('0x25')]||null:null})[_0xc469('0x12')](function(_0x4401ee){logger[_0xc469('0x13')]('UpdateOpenchannelInteraction',_0x27aab7);logger[_0xc469('0x14')](_0xc469('0x1e'),_0x27aab7,JSON['stringify'](_0x4401ee));_0x53d3ee(_0x4401ee);})[_0xc469('0x1d')](function(_0x3590ab){logger[_0xc469('0x18')]('UpdateOpenchannelInteraction',_0x3590ab[_0xc469('0x1b')],_0x27aab7);_0x423549(_0x242aac['error'](0x1f4,_0x3590ab[_0xc469('0x1b')]));});});};exports[_0xc469('0x26')]=function(_0xcfb10b){return new Promise(function(_0x22153c,_0x4a56fc){return db[_0xc469('0x1f')]['find']({'where':_0xcfb10b[_0xc469('0x22')]?_0xcfb10b[_0xc469('0x22')]['where']||null:null})[_0xc469('0x12')](function(_0x5d9f2e){if(_0x5d9f2e){return _0x5d9f2e[_0xc469('0x27')](_0xcfb10b[_0xc469('0x21')][_0xc469('0x28')],_[_0xc469('0x29')](_0xcfb10b[_0xc469('0x21')],[_0xc469('0x28'),'id'])||{});}})[_0xc469('0x2a')](function(_0x347707){logger[_0xc469('0x13')](_0xc469('0x2b'),_0xcfb10b);logger[_0xc469('0x14')](_0xc469('0x2b'),_0xcfb10b,JSON[_0xc469('0x17')](_0x347707));_0x22153c(_0x347707);})['catch'](function(_0x2e118e){logger['error'](_0xc469('0x2b'),_0x2e118e[_0xc469('0x1b')],_0xcfb10b);_0x4a56fc(_this[_0xc469('0x18')](0x1f4,_0x2e118e['message']));});});}; \ No newline at end of file +var _0x67ad=['then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','limit','stringify','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request'];(function(_0x1abbd1,_0x26581f){var _0x41a7f2=function(_0x3e8820){while(--_0x3e8820){_0x1abbd1['push'](_0x1abbd1['shift']());}};_0x41a7f2(++_0x26581f);}(_0x67ad,0x6e));var _0xd67a=function(_0x356669,_0x418104){_0x356669=_0x356669-0x0;var _0x382d80=_0x67ad[_0x356669];return _0x382d80;};'use strict';var _=require(_0xd67a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd67a('0x1'));var rs=require(_0xd67a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd67a('0x3'));var logger=require(_0xd67a('0x4'))(_0xd67a('0x5'));var config=require('../../config/environment');var jayson=require(_0xd67a('0x6'));var client=jayson[_0xd67a('0x7')][_0xd67a('0x8')]({'port':0x232a});config[_0xd67a('0x9')]=_[_0xd67a('0xa')](config[_0xd67a('0x9')],{'host':_0xd67a('0xb'),'port':0x18eb});var socket=require(_0xd67a('0xc'))(new Redis(config['redis']));require(_0xd67a('0xd'))[_0xd67a('0xe')](socket);function respondWithRpcPromise(_0xeaa26b,_0x35536f,_0x1e7ac7){return new BPromise(function(_0x72b605,_0x3735b5){return client[_0xd67a('0xf')](_0xeaa26b,_0x1e7ac7)[_0xd67a('0x10')](function(_0x3ab968){logger['info'](_0xd67a('0x11'),_0x35536f,_0xd67a('0x12'));logger[_0xd67a('0x13')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x35536f,_0xd67a('0x12'),JSON['stringify'](_0x3ab968));if(_0x3ab968[_0xd67a('0x14')]){if(_0x3ab968[_0xd67a('0x14')][_0xd67a('0x15')]===0x1f4){logger[_0xd67a('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x35536f,_0x3ab968['error'][_0xd67a('0x16')]);return _0x3735b5(_0x3ab968[_0xd67a('0x14')][_0xd67a('0x16')]);}logger['error'](_0xd67a('0x11'),_0x35536f,_0x3ab968[_0xd67a('0x14')][_0xd67a('0x16')]);return _0x72b605(_0x3ab968[_0xd67a('0x14')][_0xd67a('0x16')]);}else{logger[_0xd67a('0x17')](_0xd67a('0x11'),_0x35536f,_0xd67a('0x12'));_0x72b605(_0x3ab968[_0xd67a('0x18')][_0xd67a('0x16')]);}})[_0xd67a('0x19')](function(_0x12f52f){logger[_0xd67a('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x35536f,_0x12f52f);_0x3735b5(_0x12f52f);});});}exports[_0xd67a('0x1a')]=function(_0x2c68dc){var _0x3a03b6=this;return new Promise(function(_0x3facbb,_0x109b81){return db[_0xd67a('0x1b')][_0xd67a('0x1c')](_0x2c68dc[_0xd67a('0x1d')],{'raw':_0x2c68dc['options']?_0x2c68dc[_0xd67a('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c68dc[_0xd67a('0x1e')]?_0x2c68dc[_0xd67a('0x1e')][_0xd67a('0x1f')]||null:null,'attributes':_0x2c68dc[_0xd67a('0x1e')]?_0x2c68dc[_0xd67a('0x1e')][_0xd67a('0x20')]||null:null,'limit':_0x2c68dc[_0xd67a('0x1e')]?_0x2c68dc[_0xd67a('0x1e')][_0xd67a('0x21')]||null:null})['then'](function(_0x31a78a){logger[_0xd67a('0x17')](_0xd67a('0x1a'),_0x2c68dc);logger[_0xd67a('0x13')]('UpdateOpenchannelInteraction',_0x2c68dc,JSON[_0xd67a('0x22')](_0x31a78a));_0x3facbb(_0x31a78a);})['catch'](function(_0x5d2ca4){logger[_0xd67a('0x14')](_0xd67a('0x1a'),_0x5d2ca4[_0xd67a('0x16')],_0x2c68dc);_0x109b81(_0x3a03b6[_0xd67a('0x14')](0x1f4,_0x5d2ca4['message']));});});};exports[_0xd67a('0x23')]=function(_0x8c837b){return new Promise(function(_0x113076,_0x50cf88){return db[_0xd67a('0x1b')][_0xd67a('0x24')]({'where':_0x8c837b[_0xd67a('0x1e')]?_0x8c837b[_0xd67a('0x1e')][_0xd67a('0x1f')]||null:null})[_0xd67a('0x10')](function(_0x23aacd){if(_0x23aacd){return _0x23aacd[_0xd67a('0x25')](_0x8c837b[_0xd67a('0x1d')][_0xd67a('0x26')],_[_0xd67a('0x27')](_0x8c837b[_0xd67a('0x1d')],[_0xd67a('0x26'),'id'])||{});}})[_0xd67a('0x28')](function(_0x304552){logger[_0xd67a('0x17')](_0xd67a('0x29'),_0x8c837b);logger[_0xd67a('0x13')](_0xd67a('0x29'),_0x8c837b,JSON[_0xd67a('0x22')](_0x304552));_0x113076(_0x304552);})['catch'](function(_0x488c0e){logger[_0xd67a('0x14')](_0xd67a('0x29'),_0x488c0e[_0xd67a('0x16')],_0x8c837b);_0x50cf88(_this['error'](0x1f4,_0x488c0e[_0xd67a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 73ce617..becdc69 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 _0x2767=['removeListener','register','length','save','remove','update'];(function(_0x576905,_0x4c63f1){var _0x5ae6fa=function(_0x409f6b){while(--_0x409f6b){_0x576905['push'](_0x576905['shift']());}};_0x5ae6fa(++_0x4c63f1);}(_0x2767,0xe7));var _0x7276=function(_0x228e98,_0x285505){_0x228e98=_0x228e98-0x0;var _0x2454e4=_0x2767[_0x228e98];return _0x2454e4;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x7276('0x0'),_0x7276('0x1'),_0x7276('0x2')];function createListener(_0x1d1ebf,_0x7bd11a){return function(_0x39d8e7){_0x7bd11a['emit'](_0x1d1ebf,_0x39d8e7);};}function removeListener(_0x199234,_0x3149de){return function(){OpenchannelInteractionEvents[_0x7276('0x3')](_0x199234,_0x3149de);};}exports[_0x7276('0x4')]=function(_0xb446f3){for(var _0x336110=0x0,_0x271eef=events[_0x7276('0x5')];_0x336110<_0x271eef;_0x336110++){var _0x25bbfc=events[_0x336110];var _0x2b8970=createListener('openchannelInteraction:'+_0x25bbfc,_0xb446f3);OpenchannelInteractionEvents['on'](_0x25bbfc,_0x2b8970);}}; \ No newline at end of file +var _0xf2e3=['length','openchannelInteraction:','save','update','emit','removeListener','register'];(function(_0x30b2be,_0x2e9fae){var _0x2fd24e=function(_0x18ddbf){while(--_0x18ddbf){_0x30b2be['push'](_0x30b2be['shift']());}};_0x2fd24e(++_0x2e9fae);}(_0xf2e3,0x80));var _0x3f2e=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xf2e3[_0x3070dc];return _0x431489;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x3f2e('0x0'),'remove',_0x3f2e('0x1')];function createListener(_0x5d7754,_0x579ad7){return function(_0x3bd415){_0x579ad7[_0x3f2e('0x2')](_0x5d7754,_0x3bd415);};}function removeListener(_0x445e74,_0x2a213d){return function(){OpenchannelInteractionEvents[_0x3f2e('0x3')](_0x445e74,_0x2a213d);};}exports[_0x3f2e('0x4')]=function(_0x4fbc34){for(var _0x1dda7c=0x0,_0x473f1c=events[_0x3f2e('0x5')];_0x1dda7c<_0x473f1c;_0x1dda7c++){var _0x41eebf=events[_0x1dda7c];var _0x268fc6=createListener(_0x3f2e('0x6')+_0x41eebf,_0x4fbc34);OpenchannelInteractionEvents['on'](_0x41eebf,_0x268fc6);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 060942f..cf15ace 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 _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x5b682f,_0x3befac){var _0x47f01b=function(_0xe2c7be){while(--_0xe2c7be){_0x5b682f['push'](_0x5b682f['shift']());}};_0x47f01b(++_0x3befac);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x2da811,_0x4a0a42){_0x2da811=_0x2da811-0x0;var _0xeb2f0c=_0x70e0[_0x2da811];return _0xeb2f0c;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index b0c80ba..7edfba0 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 _0x9c00=['DATE','STRING','TEXT','sequelize','exports','BOOLEAN','out'];(function(_0x11b3bf,_0xca12c){var _0x2eeb8b=function(_0x47a388){while(--_0x47a388){_0x11b3bf['push'](_0x11b3bf['shift']());}};_0x2eeb8b(++_0xca12c);}(_0x9c00,0x1a0));var _0x09c0=function(_0xb819a5,_0x40af38){_0xb819a5=_0xb819a5-0x0;var _0x27a3a0=_0x9c00[_0xb819a5];return _0x27a3a0;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x09c0('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x09c0('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x09c0('0x3')),'defaultValue':_0x09c0('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x09c0('0x4')]},'providerName':{'type':Sequelize[_0x09c0('0x5')]},'providerResponse':{'type':Sequelize[_0x09c0('0x6')]}}; \ No newline at end of file +var _0x5eef=['TEXT','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5eef,0x9c));var _0xf5ee=function(_0x3cf004,_0x4c7c4f){_0x3cf004=_0x3cf004-0x0;var _0x1eab5a=_0x5eef[_0x3cf004];return _0x1eab5a;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xf5ee('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf5ee('0x1')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf5ee('0x2')]('in',_0xf5ee('0x3')),'defaultValue':_0xf5ee('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf5ee('0x4')]},'providerName':{'type':Sequelize[_0xf5ee('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 08cd656..38fff05 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 _0x19a4=['where','pick','filter','VIRTUAL','merge','OpenchannelMessage','includeAll','rows','show','params','find','create','body','accept','openchannel','acceptMessage','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','format','channel','motionChannel','event','reject','EventManager','rejectmessage','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','client','http','openchannel-interactions','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelMessage,\x20%s,\x20%s','result','catch','status','json','undefined','count','offset','limit','set','Content-Range','update','destroy','end','sendStatus','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x19a4,0x100));var _0x419a=function(_0x50c532,_0x14cbe5){_0x50c532=_0x50c532-0x0;var _0x2d255f=_0x19a4[_0x50c532];return _0x2d255f;};'use strict';var util=require(_0x419a('0x0'));var _=require(_0x419a('0x1'));var Redis=require(_0x419a('0x2'));var interactionService=require(_0x419a('0x3'));var qs=require(_0x419a('0x4'));var logger=require(_0x419a('0x5'))(_0x419a('0x6'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x419a('0x7')]=_['defaults'](config['redis'],{'host':_0x419a('0x8'),'port':0x18eb});var socket=require(_0x419a('0x9'))(new Redis(config['redis']));require(_0x419a('0xa'))[_0x419a('0xb')](socket);var jayson=require('jayson/promise');var client=jayson[_0x419a('0xc')][_0x419a('0xd')]({'port':0x232c});var client9002=jayson[_0x419a('0xc')][_0x419a('0xd')]({'port':0x232a});var interaction_log=require('../../config/logger')(_0x419a('0xe'));function respondWithRpcPromise(_0x35881c,_0x488ec9,_0x53ef92,_0x2c3900){return new Promise(function(_0x35c70e,_0x847072){var _0x2f25a9=_0x2c3900||client;return _0x2f25a9[_0x419a('0xf')](_0x35881c,_0x53ef92)[_0x419a('0x10')](function(_0x417e47){logger[_0x419a('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x488ec9,_0x419a('0x12'));logger[_0x419a('0x13')](_0x419a('0x14'),_0x488ec9,_0x419a('0x12'),JSON[_0x419a('0x15')](_0x417e47));if(_0x417e47[_0x419a('0x16')]){if(_0x417e47[_0x419a('0x16')]['code']===0x1f4){logger[_0x419a('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x488ec9,_0x417e47[_0x419a('0x16')][_0x419a('0x17')]);return _0x847072(_0x417e47[_0x419a('0x16')][_0x419a('0x17')]);}logger[_0x419a('0x16')](_0x419a('0x18'),_0x488ec9,_0x417e47[_0x419a('0x16')][_0x419a('0x17')]);return _0x35c70e(_0x417e47[_0x419a('0x16')][_0x419a('0x17')]);}else{logger[_0x419a('0x11')](_0x419a('0x18'),_0x488ec9,_0x419a('0x12'));_0x35c70e(_0x417e47[_0x419a('0x19')][_0x419a('0x17')]);}})[_0x419a('0x1a')](function(_0x1d2f30){logger[_0x419a('0x16')](_0x419a('0x18'),_0x488ec9,_0x1d2f30);_0x847072(_0x1d2f30);});});}function respondWithResult(_0x4fdfc0,_0x480d24){_0x480d24=_0x480d24||0xc8;return function(_0x4d0676){if(_0x4d0676){return _0x4fdfc0[_0x419a('0x1b')](_0x480d24)[_0x419a('0x1c')](_0x4d0676);}};}function respondWithFilteredResult(_0x2fb7da,_0x4ed6bc){return function(_0x1f6201){if(_0x1f6201){var _0x3cb86b=typeof _0x4ed6bc['offset']===_0x419a('0x1d')&&typeof _0x4ed6bc['limit']===_0x419a('0x1d');var _0x1e10f7=_0x1f6201[_0x419a('0x1e')];var _0x51c644=_0x3cb86b?0x0:_0x4ed6bc['offset'];var _0xe89359=_0x3cb86b?_0x1f6201[_0x419a('0x1e')]:_0x4ed6bc[_0x419a('0x1f')]+_0x4ed6bc[_0x419a('0x20')];var _0x9a4781;if(_0xe89359>=_0x1e10f7){_0xe89359=_0x1e10f7;_0x9a4781=0xc8;}else{_0x9a4781=0xce;}_0x2fb7da['status'](_0x9a4781);return _0x2fb7da[_0x419a('0x21')](_0x419a('0x22'),_0x51c644+'-'+_0xe89359+'/'+_0x1e10f7)[_0x419a('0x1c')](_0x1f6201);}return null;};}function saveUpdates(_0x281a19){return function(_0xf85f56){if(_0xf85f56){return _0xf85f56[_0x419a('0x23')](_0x281a19)[_0x419a('0x10')](function(_0x572d64){return _0x572d64;});}return null;};}function removeEntity(_0x3bee4d){return function(_0x54d5a8){if(_0x54d5a8){return _0x54d5a8[_0x419a('0x24')]()[_0x419a('0x10')](function(){_0x3bee4d[_0x419a('0x1b')](0xcc)[_0x419a('0x25')]();});}};}function handleEntityNotFound(_0x16cd1b){return function(_0x211d3f){if(!_0x211d3f){_0x16cd1b[_0x419a('0x26')](0x194);}return _0x211d3f;};}function handleError(_0x3cdc33,_0x449fe3){_0x449fe3=_0x449fe3||0x1f4;return function(_0x3a7987){logger[_0x419a('0x16')](_0x3a7987['stack']);if(_0x3a7987[_0x419a('0x27')]){delete _0x3a7987[_0x419a('0x27')];}_0x3cdc33[_0x419a('0x1b')](_0x449fe3)[_0x419a('0x28')](_0x3a7987);};}exports[_0x419a('0x29')]=function(_0x5dd5d0,_0x5d27a8){var _0xbbfadb={},_0x1d597f={},_0x27f471={'count':0x0,'rows':[]};var _0x2d119d=_['map'](db['OpenchannelMessage'][_0x419a('0x2a')],function(_0x1a7d84){return{'name':_0x1a7d84[_0x419a('0x2b')],'type':_0x1a7d84[_0x419a('0x2c')][_0x419a('0x2d')]};});_0x1d597f[_0x419a('0x2e')]=_[_0x419a('0x2f')](_0x2d119d,_0x419a('0x27'));_0x1d597f[_0x419a('0x30')]=_[_0x419a('0x31')](_0x5dd5d0[_0x419a('0x30')]);_0x1d597f[_0x419a('0x32')]=_[_0x419a('0x33')](_0x1d597f[_0x419a('0x2e')],_0x1d597f['query']);_0xbbfadb[_0x419a('0x34')]=_[_0x419a('0x33')](_0x1d597f[_0x419a('0x2e')],qs[_0x419a('0x35')](_0x5dd5d0[_0x419a('0x30')][_0x419a('0x35')]));_0xbbfadb[_0x419a('0x34')]=_0xbbfadb[_0x419a('0x34')][_0x419a('0x36')]?_0xbbfadb[_0x419a('0x34')]:_0x1d597f[_0x419a('0x2e')];if(!_0x5dd5d0[_0x419a('0x30')][_0x419a('0x37')](_0x419a('0x38'))){_0xbbfadb[_0x419a('0x20')]=qs['limit'](_0x5dd5d0[_0x419a('0x30')][_0x419a('0x20')]);_0xbbfadb[_0x419a('0x1f')]=qs[_0x419a('0x1f')](_0x5dd5d0['query'][_0x419a('0x1f')]);}_0xbbfadb[_0x419a('0x39')]=qs[_0x419a('0x3a')](_0x5dd5d0['query'][_0x419a('0x3a')]);_0xbbfadb[_0x419a('0x3b')]=qs[_0x419a('0x32')](_[_0x419a('0x3c')](_0x5dd5d0[_0x419a('0x30')],_0x1d597f[_0x419a('0x32')]),_0x2d119d);if(_0x5dd5d0[_0x419a('0x30')][_0x419a('0x3d')]){_0xbbfadb[_0x419a('0x3b')]=_['merge'](_0xbbfadb['where'],{'$or':_[_0x419a('0x2f')](_0x2d119d,function(_0x469d35){if(_0x469d35[_0x419a('0x2c')]!==_0x419a('0x3e')){var _0x58cfb5={};_0x58cfb5[_0x469d35['name']]={'$like':'%'+_0x5dd5d0[_0x419a('0x30')][_0x419a('0x3d')]+'%'};return _0x58cfb5;}})});}_0xbbfadb=_[_0x419a('0x3f')]({},_0xbbfadb,_0x5dd5d0['options']);var _0x2f9e16={'where':_0xbbfadb[_0x419a('0x3b')]};return db[_0x419a('0x40')]['count'](_0x2f9e16)[_0x419a('0x10')](function(_0x3af458){_0x27f471[_0x419a('0x1e')]=_0x3af458;if(_0x5dd5d0[_0x419a('0x30')][_0x419a('0x41')]){_0xbbfadb['include']=[{'all':!![]}];}return db[_0x419a('0x40')]['findAll'](_0xbbfadb);})[_0x419a('0x10')](function(_0x2d83da){_0x27f471[_0x419a('0x42')]=_0x2d83da;return _0x27f471;})[_0x419a('0x10')](respondWithFilteredResult(_0x5d27a8,_0xbbfadb))[_0x419a('0x1a')](handleError(_0x5d27a8,null));};exports[_0x419a('0x43')]=function(_0x914fac,_0x33f1d1){var _0x13129f={'raw':!![],'where':{'id':_0x914fac[_0x419a('0x44')]['id']}},_0x257129={};_0x257129[_0x419a('0x2e')]=_['keys'](db[_0x419a('0x40')][_0x419a('0x2a')]);_0x257129[_0x419a('0x30')]=_['keys'](_0x914fac[_0x419a('0x30')]);_0x257129[_0x419a('0x32')]=_[_0x419a('0x33')](_0x257129['model'],_0x257129[_0x419a('0x30')]);_0x13129f[_0x419a('0x34')]=_[_0x419a('0x33')](_0x257129[_0x419a('0x2e')],qs['fields'](_0x914fac[_0x419a('0x30')]['fields']));_0x13129f['attributes']=_0x13129f['attributes'][_0x419a('0x36')]?_0x13129f['attributes']:_0x257129[_0x419a('0x2e')];if(_0x914fac[_0x419a('0x30')][_0x419a('0x41')]){_0x13129f['include']=[{'all':!![]}];}_0x13129f=_[_0x419a('0x3f')]({},_0x13129f,_0x914fac['options']);return db[_0x419a('0x40')][_0x419a('0x45')](_0x13129f)[_0x419a('0x10')](handleEntityNotFound(_0x33f1d1,null))['then'](respondWithResult(_0x33f1d1,null))[_0x419a('0x1a')](handleError(_0x33f1d1,null));};exports[_0x419a('0x46')]=function(_0x927ad4,_0x52a2f2){return db[_0x419a('0x40')]['create'](_0x927ad4[_0x419a('0x47')],{})[_0x419a('0x10')](respondWithResult(_0x52a2f2,0xc9))[_0x419a('0x1a')](handleError(_0x52a2f2,null));};exports['update']=function(_0x48ed7d,_0x35f0de){if(_0x48ed7d['body']['id']){delete _0x48ed7d[_0x419a('0x47')]['id'];}return db['OpenchannelMessage'][_0x419a('0x45')]({'where':{'id':_0x48ed7d[_0x419a('0x44')]['id']}})[_0x419a('0x10')](handleEntityNotFound(_0x35f0de,null))[_0x419a('0x10')](saveUpdates(_0x48ed7d[_0x419a('0x47')],null))['then'](respondWithResult(_0x35f0de,null))[_0x419a('0x1a')](handleError(_0x35f0de,null));};exports[_0x419a('0x24')]=function(_0x5e8b27,_0x1a6dc1){return db[_0x419a('0x40')][_0x419a('0x45')]({'where':{'id':_0x5e8b27['params']['id']}})[_0x419a('0x10')](handleEntityNotFound(_0x1a6dc1,null))['then'](removeEntity(_0x1a6dc1,null))[_0x419a('0x1a')](handleError(_0x1a6dc1,null));};exports['describe']=function(_0x444ca1,_0x561356){return db['OpenchannelMessage']['describe']()[_0x419a('0x10')](respondWithResult(_0x561356,null))[_0x419a('0x1a')](handleError(_0x561356,null));};exports[_0x419a('0x48')]=function(_0x278cd0,_0x115dc0){var _0x243f08=_0x419a('0x49');return interactionService[_0x419a('0x4a')](_0x278cd0,_0x243f08)['then'](respondWithResult(_0x115dc0,null))[_0x419a('0x1a')](handleError(_0x115dc0,null));};exports['reject']=function(_0x387e45,_0x25c289){var _0x14b4e5={'agent':{},'channel':_0x419a('0x49')};if(_0x387e45['body']['id']){delete _0x387e45[_0x419a('0x47')]['id'];}_0x387e45[_0x419a('0x47')][_0x419a('0x4b')]=_0x387e45[_0x419a('0x47')][_0x419a('0x4b')]||_0x387e45['user']['id'];_0x14b4e5[_0x419a('0x4c')]['id']=_0x387e45[_0x419a('0x47')][_0x419a('0x4b')];return db[_0x419a('0x40')]['find']({'where':{'id':_0x387e45[_0x419a('0x44')]['id'],'UserId':null}})[_0x419a('0x10')](handleEntityNotFound(_0x25c289,null))['then'](function(_0xd02380){if(_0xd02380){_0x14b4e5[_0x419a('0x17')]=_0xd02380[_0x419a('0x4d')]({'plain':!![]});return db[_0x419a('0x4e')][_0x419a('0x45')]({'where':{'id':_0xd02380[_0x419a('0x4f')]}});}return null;})[_0x419a('0x10')](handleEntityNotFound(_0x25c289,null))['then'](function(_0x2ae304){if(_0x2ae304){_0x14b4e5[_0x419a('0x50')]=_0x2ae304[_0x419a('0x4d')]({'plain':!![]});interaction_log[_0x419a('0x11')](_0x419a('0x51'),_0x387e45[_0x419a('0x52')]['id'],_0x387e45[_0x419a('0x52')][_0x419a('0x27')],_0x387e45[_0x419a('0x52')][_0x419a('0x53')],_0x14b4e5[_0x419a('0x50')]['id'],_0x387e45[_0x419a('0x47')]?JSON[_0x419a('0x15')](_0x387e45['body']):_0x419a('0x54'));return respondWithRpcPromise(_0x419a('0x55'),_0x419a('0x56'),_0x14b4e5);}return null;})[_0x419a('0x10')](function(_0x3a0ca6){var _0xea20c7=_0x419a('0x57')+_0x3a0ca6[_0x419a('0x17')][_0x419a('0x58')];return db[_0x419a('0x59')]['query'](_0xea20c7,{'type':db['Sequelize'][_0x419a('0x5a')][_0x419a('0x5b')],'raw':!![]})[_0x419a('0x10')](function(_0x34a773){return _0x34a773;});})[_0x419a('0x10')](function(_0x5cfd8e){if(_0x5cfd8e){_0x14b4e5[_0x419a('0x17')][_0x419a('0x5c')]=_0x5cfd8e[0x0];if(!_0x387e45[_0x419a('0x47')]['UserId'])return;return db[_0x419a('0x5d')][_0x419a('0x45')]({'where':{'id':_0x387e45['body'][_0x419a('0x4b')],'role':'agent'},'attributes':['id','name',_0x419a('0x5e'),_0x419a('0x5f'),_0x419a('0x60')],'raw':!![]});}return null;})[_0x419a('0x10')](function(_0x31cfdb){if(!_0x31cfdb)return null;_0x14b4e5[_0x419a('0x17')][_0x419a('0x4c')]=_0x31cfdb;return _0x14b4e5;})[_0x419a('0x10')](function(_0x1814fa){if(_0x1814fa){_0x1814fa[_0x419a('0x17')][_0x419a('0x61')]=util[_0x419a('0x62')]('SIP/%s',_0x387e45[_0x419a('0x52')]['name']);_0x1814fa[_0x419a('0x17')][_0x419a('0x63')]=_0x14b4e5[_0x419a('0x63')];_0x1814fa[_0x419a('0x17')][_0x419a('0x64')]=_0x14b4e5['channel'];_0x1814fa[_0x419a('0x17')][_0x419a('0x65')]=_0x419a('0x66');respondWithRpcPromise('EventManager',_0x419a('0x67'),{'event':_0x419a('0x68'),'message':_0x1814fa['message']},client9002);return _0x14b4e5;}return null;})[_0x419a('0x10')](respondWithResult(_0x25c289,null))[_0x419a('0x1a')](handleError(_0x25c289,null));}; \ No newline at end of file +var _0xf683=['util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','offset','undefined','count','limit','status','set','Content-Range','update','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','includeAll','include','OpenchannelMessage','findAll','show','params','keys','options','find','body','describe','accept','openchannel','acceptMessage','UserId','agent','get','OpenchannelInteractionId','user','role','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','interface','SIP/%s','channel','event','reject','EventManager','rejectmessage'];(function(_0x275240,_0x54de1e){var _0x370f4d=function(_0x3bac00){while(--_0x3bac00){_0x275240['push'](_0x275240['shift']());}};_0x370f4d(++_0x54de1e);}(_0xf683,0x120));var _0x3f68=function(_0x251077,_0x360a45){_0x251077=_0x251077-0x0;var _0x4943f4=_0xf683[_0x251077];return _0x4943f4;};'use strict';var util=require(_0x3f68('0x0'));var _=require(_0x3f68('0x1'));var Redis=require(_0x3f68('0x2'));var interactionService=require(_0x3f68('0x3'));var qs=require(_0x3f68('0x4'));var logger=require(_0x3f68('0x5'))(_0x3f68('0x6'));var config=require(_0x3f68('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x3f68('0x8')],{'host':_0x3f68('0x9'),'port':0x18eb});var socket=require(_0x3f68('0xa'))(new Redis(config[_0x3f68('0x8')]));require(_0x3f68('0xb'))[_0x3f68('0xc')](socket);var jayson=require(_0x3f68('0xd'));var client=jayson[_0x3f68('0xe')][_0x3f68('0xf')]({'port':0x232c});var client9002=jayson[_0x3f68('0xe')]['http']({'port':0x232a});var interaction_log=require(_0x3f68('0x5'))('openchannel-interactions');function respondWithRpcPromise(_0x1bf751,_0x1f746e,_0xe332e8,_0x28eced){return new Promise(function(_0xc41df6,_0x5e92d0){var _0x3260d8=_0x28eced||client;return _0x3260d8['request'](_0x1bf751,_0xe332e8)[_0x3f68('0x10')](function(_0xf4b885){logger[_0x3f68('0x11')](_0x3f68('0x12'),_0x1f746e,_0x3f68('0x13'));logger[_0x3f68('0x14')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x1f746e,_0x3f68('0x13'),JSON[_0x3f68('0x15')](_0xf4b885));if(_0xf4b885[_0x3f68('0x16')]){if(_0xf4b885[_0x3f68('0x16')][_0x3f68('0x17')]===0x1f4){logger[_0x3f68('0x16')](_0x3f68('0x12'),_0x1f746e,_0xf4b885[_0x3f68('0x16')][_0x3f68('0x18')]);return _0x5e92d0(_0xf4b885[_0x3f68('0x16')][_0x3f68('0x18')]);}logger[_0x3f68('0x16')](_0x3f68('0x12'),_0x1f746e,_0xf4b885['error'][_0x3f68('0x18')]);return _0xc41df6(_0xf4b885[_0x3f68('0x16')]['message']);}else{logger['info'](_0x3f68('0x12'),_0x1f746e,_0x3f68('0x13'));_0xc41df6(_0xf4b885[_0x3f68('0x19')][_0x3f68('0x18')]);}})[_0x3f68('0x1a')](function(_0x3bff31){logger[_0x3f68('0x16')](_0x3f68('0x12'),_0x1f746e,_0x3bff31);_0x5e92d0(_0x3bff31);});});}function respondWithResult(_0xa0e29b,_0x4bf719){_0x4bf719=_0x4bf719||0xc8;return function(_0x327794){if(_0x327794){return _0xa0e29b['status'](_0x4bf719)['json'](_0x327794);}};}function respondWithFilteredResult(_0x5c164e,_0x14d825){return function(_0x100e02){if(_0x100e02){var _0x15a833=typeof _0x14d825[_0x3f68('0x1b')]==='undefined'&&typeof _0x14d825['limit']===_0x3f68('0x1c');var _0x137414=_0x100e02[_0x3f68('0x1d')];var _0x338ae1=_0x15a833?0x0:_0x14d825[_0x3f68('0x1b')];var _0x4c6e87=_0x15a833?_0x100e02['count']:_0x14d825['offset']+_0x14d825[_0x3f68('0x1e')];var _0x57a912;if(_0x4c6e87>=_0x137414){_0x4c6e87=_0x137414;_0x57a912=0xc8;}else{_0x57a912=0xce;}_0x5c164e[_0x3f68('0x1f')](_0x57a912);return _0x5c164e[_0x3f68('0x20')](_0x3f68('0x21'),_0x338ae1+'-'+_0x4c6e87+'/'+_0x137414)['json'](_0x100e02);}return null;};}function saveUpdates(_0x2849ef){return function(_0x196ed3){if(_0x196ed3){return _0x196ed3[_0x3f68('0x22')](_0x2849ef)[_0x3f68('0x10')](function(_0x4a879f){return _0x4a879f;});}return null;};}function removeEntity(_0x42335c){return function(_0x59e7fe){if(_0x59e7fe){return _0x59e7fe[_0x3f68('0x23')]()[_0x3f68('0x10')](function(){_0x42335c[_0x3f68('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1712d6){return function(_0x5ccf35){if(!_0x5ccf35){_0x1712d6['sendStatus'](0x194);}return _0x5ccf35;};}function handleError(_0x2d3c1b,_0x31d89b){_0x31d89b=_0x31d89b||0x1f4;return function(_0x57884d){logger[_0x3f68('0x16')](_0x57884d['stack']);if(_0x57884d['name']){delete _0x57884d[_0x3f68('0x24')];}_0x2d3c1b[_0x3f68('0x1f')](_0x31d89b)[_0x3f68('0x25')](_0x57884d);};}exports[_0x3f68('0x26')]=function(_0x20665b,_0xa707d5){var _0x9132ec={},_0x467c8f={},_0x237846={'count':0x0,'rows':[]};var _0x9bdf89=_[_0x3f68('0x27')](db['OpenchannelMessage'][_0x3f68('0x28')],function(_0x2f6592){return{'name':_0x2f6592[_0x3f68('0x29')],'type':_0x2f6592[_0x3f68('0x2a')][_0x3f68('0x2b')]};});_0x467c8f[_0x3f68('0x2c')]=_[_0x3f68('0x27')](_0x9bdf89,_0x3f68('0x24'));_0x467c8f['query']=_['keys'](_0x20665b[_0x3f68('0x2d')]);_0x467c8f['filters']=_[_0x3f68('0x2e')](_0x467c8f[_0x3f68('0x2c')],_0x467c8f[_0x3f68('0x2d')]);_0x9132ec['attributes']=_[_0x3f68('0x2e')](_0x467c8f[_0x3f68('0x2c')],qs[_0x3f68('0x2f')](_0x20665b['query'][_0x3f68('0x2f')]));_0x9132ec[_0x3f68('0x30')]=_0x9132ec[_0x3f68('0x30')][_0x3f68('0x31')]?_0x9132ec['attributes']:_0x467c8f[_0x3f68('0x2c')];if(!_0x20665b[_0x3f68('0x2d')]['hasOwnProperty'](_0x3f68('0x32'))){_0x9132ec['limit']=qs[_0x3f68('0x1e')](_0x20665b[_0x3f68('0x2d')][_0x3f68('0x1e')]);_0x9132ec['offset']=qs[_0x3f68('0x1b')](_0x20665b[_0x3f68('0x2d')][_0x3f68('0x1b')]);}_0x9132ec[_0x3f68('0x33')]=qs[_0x3f68('0x34')](_0x20665b['query'][_0x3f68('0x34')]);_0x9132ec[_0x3f68('0x35')]=qs[_0x3f68('0x36')](_['pick'](_0x20665b[_0x3f68('0x2d')],_0x467c8f[_0x3f68('0x36')]),_0x9bdf89);if(_0x20665b[_0x3f68('0x2d')][_0x3f68('0x37')]){_0x9132ec['where']=_['merge'](_0x9132ec['where'],{'$or':_[_0x3f68('0x27')](_0x9bdf89,function(_0x37e595){if(_0x37e595[_0x3f68('0x2a')]!=='VIRTUAL'){var _0x3c4799={};_0x3c4799[_0x37e595[_0x3f68('0x24')]]={'$like':'%'+_0x20665b[_0x3f68('0x2d')][_0x3f68('0x37')]+'%'};return _0x3c4799;}})});}_0x9132ec=_[_0x3f68('0x38')]({},_0x9132ec,_0x20665b['options']);var _0x27a203={'where':_0x9132ec['where']};return db['OpenchannelMessage']['count'](_0x27a203)[_0x3f68('0x10')](function(_0x1f2bd5){_0x237846[_0x3f68('0x1d')]=_0x1f2bd5;if(_0x20665b['query'][_0x3f68('0x39')]){_0x9132ec[_0x3f68('0x3a')]=[{'all':!![]}];}return db[_0x3f68('0x3b')][_0x3f68('0x3c')](_0x9132ec);})[_0x3f68('0x10')](function(_0x3606bf){_0x237846['rows']=_0x3606bf;return _0x237846;})[_0x3f68('0x10')](respondWithFilteredResult(_0xa707d5,_0x9132ec))[_0x3f68('0x1a')](handleError(_0xa707d5,null));};exports[_0x3f68('0x3d')]=function(_0x2f8263,_0x53ab46){var _0x348e54={'raw':!![],'where':{'id':_0x2f8263[_0x3f68('0x3e')]['id']}},_0x18b0c9={};_0x18b0c9['model']=_[_0x3f68('0x3f')](db[_0x3f68('0x3b')][_0x3f68('0x28')]);_0x18b0c9[_0x3f68('0x2d')]=_[_0x3f68('0x3f')](_0x2f8263['query']);_0x18b0c9['filters']=_[_0x3f68('0x2e')](_0x18b0c9['model'],_0x18b0c9[_0x3f68('0x2d')]);_0x348e54[_0x3f68('0x30')]=_[_0x3f68('0x2e')](_0x18b0c9['model'],qs[_0x3f68('0x2f')](_0x2f8263[_0x3f68('0x2d')][_0x3f68('0x2f')]));_0x348e54[_0x3f68('0x30')]=_0x348e54[_0x3f68('0x30')][_0x3f68('0x31')]?_0x348e54['attributes']:_0x18b0c9[_0x3f68('0x2c')];if(_0x2f8263[_0x3f68('0x2d')]['includeAll']){_0x348e54[_0x3f68('0x3a')]=[{'all':!![]}];}_0x348e54=_['merge']({},_0x348e54,_0x2f8263[_0x3f68('0x40')]);return db['OpenchannelMessage'][_0x3f68('0x41')](_0x348e54)[_0x3f68('0x10')](handleEntityNotFound(_0x53ab46,null))[_0x3f68('0x10')](respondWithResult(_0x53ab46,null))[_0x3f68('0x1a')](handleError(_0x53ab46,null));};exports['create']=function(_0x44de51,_0x3af5a7){return db[_0x3f68('0x3b')]['create'](_0x44de51[_0x3f68('0x42')],{})[_0x3f68('0x10')](respondWithResult(_0x3af5a7,0xc9))['catch'](handleError(_0x3af5a7,null));};exports[_0x3f68('0x22')]=function(_0x472a33,_0x54761d){if(_0x472a33[_0x3f68('0x42')]['id']){delete _0x472a33['body']['id'];}return db['OpenchannelMessage'][_0x3f68('0x41')]({'where':{'id':_0x472a33[_0x3f68('0x3e')]['id']}})[_0x3f68('0x10')](handleEntityNotFound(_0x54761d,null))[_0x3f68('0x10')](saveUpdates(_0x472a33[_0x3f68('0x42')],null))[_0x3f68('0x10')](respondWithResult(_0x54761d,null))['catch'](handleError(_0x54761d,null));};exports[_0x3f68('0x23')]=function(_0x1c9d28,_0xf0b22c){return db[_0x3f68('0x3b')][_0x3f68('0x41')]({'where':{'id':_0x1c9d28[_0x3f68('0x3e')]['id']}})[_0x3f68('0x10')](handleEntityNotFound(_0xf0b22c,null))[_0x3f68('0x10')](removeEntity(_0xf0b22c,null))[_0x3f68('0x1a')](handleError(_0xf0b22c,null));};exports[_0x3f68('0x43')]=function(_0x402ad9,_0x5b947b){return db[_0x3f68('0x3b')][_0x3f68('0x43')]()['then'](respondWithResult(_0x5b947b,null))['catch'](handleError(_0x5b947b,null));};exports[_0x3f68('0x44')]=function(_0x66bb88,_0x3c7f32){var _0x38cd4f=_0x3f68('0x45');return interactionService[_0x3f68('0x46')](_0x66bb88,_0x38cd4f)['then'](respondWithResult(_0x3c7f32,null))['catch'](handleError(_0x3c7f32,null));};exports['reject']=function(_0xa15d74,_0x19b5f0){var _0x592d3d={'agent':{},'channel':'openchannel'};if(_0xa15d74[_0x3f68('0x42')]['id']){delete _0xa15d74[_0x3f68('0x42')]['id'];}_0xa15d74['body']['UserId']=_0xa15d74[_0x3f68('0x42')][_0x3f68('0x47')]||_0xa15d74['user']['id'];_0x592d3d[_0x3f68('0x48')]['id']=_0xa15d74['body'][_0x3f68('0x47')];return db['OpenchannelMessage'][_0x3f68('0x41')]({'where':{'id':_0xa15d74[_0x3f68('0x3e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x19b5f0,null))[_0x3f68('0x10')](function(_0x1a3e3e){if(_0x1a3e3e){_0x592d3d[_0x3f68('0x18')]=_0x1a3e3e[_0x3f68('0x49')]({'plain':!![]});return db['OpenchannelInteraction'][_0x3f68('0x41')]({'where':{'id':_0x1a3e3e[_0x3f68('0x4a')]}});}return null;})['then'](handleEntityNotFound(_0x19b5f0,null))[_0x3f68('0x10')](function(_0x58fe63){if(_0x58fe63){_0x592d3d['interaction']=_0x58fe63[_0x3f68('0x49')]({'plain':!![]});interaction_log[_0x3f68('0x11')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xa15d74[_0x3f68('0x4b')]['id'],_0xa15d74[_0x3f68('0x4b')][_0x3f68('0x24')],_0xa15d74[_0x3f68('0x4b')][_0x3f68('0x4c')],_0x592d3d['interaction']['id'],_0xa15d74[_0x3f68('0x42')]?JSON[_0x3f68('0x15')](_0xa15d74[_0x3f68('0x42')]):_0x3f68('0x4d'));return respondWithRpcPromise(_0x3f68('0x4e'),'rejectMessage',_0x592d3d);}return null;})[_0x3f68('0x10')](function(_0x1d8c6f){var _0x72e6a7=_0x3f68('0x4f')+_0x1d8c6f[_0x3f68('0x18')][_0x3f68('0x50')];return db[_0x3f68('0x51')][_0x3f68('0x2d')](_0x72e6a7,{'type':db[_0x3f68('0x52')][_0x3f68('0x53')][_0x3f68('0x54')],'raw':!![]})['then'](function(_0x224e08){return _0x224e08;});})[_0x3f68('0x10')](function(_0x34c203){if(_0x34c203){_0x592d3d[_0x3f68('0x18')][_0x3f68('0x55')]=_0x34c203[0x0];if(!_0xa15d74['body']['UserId'])return;return db[_0x3f68('0x56')]['find']({'where':{'id':_0xa15d74['body'][_0x3f68('0x47')],'role':'agent'},'attributes':['id',_0x3f68('0x24'),_0x3f68('0x57'),'email',_0x3f68('0x58')],'raw':!![]});}return null;})[_0x3f68('0x10')](function(_0x6e82){if(!_0x6e82)return null;_0x592d3d[_0x3f68('0x18')][_0x3f68('0x48')]=_0x6e82;return _0x592d3d;})[_0x3f68('0x10')](function(_0x2b8144){if(_0x2b8144){_0x2b8144[_0x3f68('0x18')][_0x3f68('0x59')]=util['format'](_0x3f68('0x5a'),_0xa15d74[_0x3f68('0x4b')][_0x3f68('0x24')]);_0x2b8144['message'][_0x3f68('0x5b')]=_0x592d3d[_0x3f68('0x5b')];_0x2b8144[_0x3f68('0x18')]['motionChannel']=_0x592d3d[_0x3f68('0x5b')];_0x2b8144['message'][_0x3f68('0x5c')]=_0x3f68('0x5d');respondWithRpcPromise(_0x3f68('0x5e'),_0x3f68('0x5e'),{'event':_0x3f68('0x5f'),'message':_0x2b8144[_0x3f68('0x18')]},client9002);return _0x592d3d;}return null;})[_0x3f68('0x10')](respondWithResult(_0x19b5f0,null))[_0x3f68('0x1a')](handleError(_0x19b5f0,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index e3155ef..cc5b13b 100644 --- a/server/api/openchannelMessage/openchannelMessage.events.js +++ b/server/api/openchannelMessage/openchannelMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4900=['exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x4900,0xe2));var _0x0490=function(_0x231422,_0xeff1fb){_0x231422=_0x231422-0x0;var _0x43d11f=_0x4900[_0x231422];return _0x43d11f;};'use strict';var EventEmitter=require(_0x0490('0x0'));var OpenchannelMessage=require(_0x0490('0x1'))['db'][_0x0490('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x0490('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0490('0x4'),'afterDestroy':'remove'};function emitEvent(_0x34a734){return function(_0xfa6a51,_0x7a6b88,_0x1e6b50){OpenchannelMessageEvents[_0x0490('0x5')](_0x34a734+':'+_0xfa6a51['id'],_0xfa6a51);OpenchannelMessageEvents['emit'](_0x34a734,_0xfa6a51);_0x1e6b50(null);};}for(var e in events){if(events[_0x0490('0x6')](e)){var event=events[e];OpenchannelMessage[_0x0490('0x7')](e,emitEvent(event));}}module[_0x0490('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x42a3=['events','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3fd026,_0x244702){var _0x4b7eb4=function(_0xb94089){while(--_0xb94089){_0x3fd026['push'](_0x3fd026['shift']());}};_0x4b7eb4(++_0x244702);}(_0x42a3,0x1d6));var _0x342a=function(_0x29db8b,_0x2913e2){_0x29db8b=_0x29db8b-0x0;var _0x2eb005=_0x42a3[_0x29db8b];return _0x2eb005;};'use strict';var EventEmitter=require(_0x342a('0x0'));var OpenchannelMessage=require(_0x342a('0x1'))['db'][_0x342a('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x342a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x342a('0x4'),'afterDestroy':_0x342a('0x5')};function emitEvent(_0x20f4de){return function(_0x2e5725,_0x4cb811,_0x20c8fb){OpenchannelMessageEvents[_0x342a('0x6')](_0x20f4de+':'+_0x2e5725['id'],_0x2e5725);OpenchannelMessageEvents[_0x342a('0x6')](_0x20f4de,_0x2e5725);_0x20c8fb(null);};}for(var e in events){if(events[_0x342a('0x7')](e)){var event=events[e];OpenchannelMessage[_0x342a('0x8')](e,emitEvent(event));}}module[_0x342a('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 6e9c1f9..bdbd571 100644 --- a/server/api/openchannelMessage/openchannelMessage.model.js +++ b/server/api/openchannelMessage/openchannelMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa426=['OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','error','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','method','GET','POST','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','catch','inspect','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes','define'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xa426,0x176));var _0x6a42=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xa426[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0x6a42('0x0'));var util=require(_0x6a42('0x1'));var logger=require(_0x6a42('0x2'))(_0x6a42('0x3'));var moment=require(_0x6a42('0x4'));var BPromise=require(_0x6a42('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a42('0x6'));var rimraf=require(_0x6a42('0x7'));var config=require(_0x6a42('0x8'));var attributes=require(_0x6a42('0x9'));module['exports']=function(_0x3c1ac2,_0x1b814c){return _0x3c1ac2[_0x6a42('0xa')](_0x6a42('0xb'),attributes,{'tableName':_0x6a42('0xc'),'paranoid':![],'indexes':[{'name':_0x6a42('0xd'),'fields':[_0x6a42('0xe')],'type':_0x6a42('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x40fefe,_0x53b1bc,_0x4bafad){var _0x5b1fe6=_0x3c1ac2[_0x6a42('0x10')];var _0x46c742=_0x40fefe[_0x6a42('0x11')]({'plain':!![]});if(_0x46c742[_0x6a42('0x12')][_0x6a42('0x13')]()==='in'||_0x46c742['direction'][_0x6a42('0x13')]()===_0x6a42('0x14')&&!_0x46c742['secret']&&!_[_0x6a42('0x15')](_0x46c742['UserId'])){_0x5b1fe6[_0x6a42('0x16')][_0x6a42('0x17')]({'where':{'id':_0x46c742[_0x6a42('0x18')]}})[_0x6a42('0x19')](function(_0x20bdee){if(_0x20bdee){_0x20bdee[_0x6a42('0x1a')]({'lastMsgAt':_0x46c742['createdAt'],'lastMsgDirection':_0x46c742['direction'][_0x6a42('0x13')]()});}})['catch'](function(_0x58f55a){console[_0x6a42('0x1b')](_0x58f55a);});}if(_0x46c742[_0x6a42('0x12')]==='out'&&!_0x46c742[_0x6a42('0x1c')]){var _0x4167b3;_0x5b1fe6[_0x6a42('0x1d')][_0x6a42('0x1e')]()[_0x6a42('0x19')](function(_0x14d4c3){return _0x5b1fe6[_0x6a42('0x1f')][_0x6a42('0x20')]({'where':{'id':_0x46c742[_0x6a42('0x21')]},'include':[{'model':_0x5b1fe6['OpenchannelInteraction'],'as':_0x6a42('0x22'),'where':{'id':_0x46c742[_0x6a42('0x18')]},'limit':0x1,'include':[{'model':_0x5b1fe6[_0x6a42('0x1d')],'as':_0x6a42('0x23'),'attributes':_[_0x6a42('0x24')](_0x14d4c3)}]}]});})[_0x6a42('0x19')](function(_0x1cde7c){_0x4167b3=_0x1cde7c['get']({'plain':!![]});if(_0x4167b3&&_0x4167b3[_0x6a42('0x25')]){logger[_0x6a42('0x26')](_0x6a42('0x27'),'afterCreate',util[_0x6a42('0x28')](_0x6a42('0x29'),_0x46c742['id'],_0x4167b3['replyUri']));if(_0x4167b3['Interactions']&&_0x4167b3['Interactions'][_0x6a42('0x2a')]){_0x46c742['Interaction']=_[_0x6a42('0x2b')](_0x4167b3[_0x6a42('0x22')][0x0],_0x6a42('0x23'));_0x46c742[_0x6a42('0x23')]=_0x4167b3['Interactions'][0x0][_0x6a42('0x23')];}var _0x53b1bc={'method':'POST','uri':encodeURI(_0x4167b3[_0x6a42('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x53b1bc[_0x6a42('0x2c')]){case _0x6a42('0x2d'):_0x53b1bc['qs']=_0x46c742;break;case _0x6a42('0x2e'):_0x53b1bc[_0x6a42('0xe')]=_0x46c742;break;}return rp(_0x53b1bc)['then'](function(_0x39b791){logger[_0x6a42('0x26')](_0x6a42('0x27'),_0x6a42('0x2f'),util['format'](_0x6a42('0x30'),_0x46c742['id'],_0x4167b3[_0x6a42('0x25')]));if(_0x39b791['body'][_0x6a42('0x31')]&&_0x39b791[_0x6a42('0xe')]['threadId']!=_0x46c742[_0x6a42('0x32')][_0x6a42('0x31')]){return _0x5b1fe6['OpenchannelInteraction'][_0x6a42('0x1a')]({'threadId':_0x39b791[_0x6a42('0xe')][_0x6a42('0x31')]},{'where':{'id':_0x46c742[_0x6a42('0x32')]['id']}});}else{return;}})[_0x6a42('0x19')](function(){return _0x40fefe['update']({'read':!![]});})[_0x6a42('0x33')](function(_0x3eb703){logger[_0x6a42('0x1b')]('OpenchannelMessage,\x20%s,\x20%s',_0x6a42('0x2f'),util[_0x6a42('0x34')](_0x3eb703,{'showHidden':![],'depth':null}));_0x4bafad();});}else{_0x4bafad();}})[_0x6a42('0x35')](function(){_0x4bafad();});}else{_0x4bafad();}}},'charset':_0x6a42('0x36'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5edd=['Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./openchannelMessage.attributes','exports','define','fti_openchannel_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','Interactions','Contact','keys','then','replyUri','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','POST','method','GET','body','info','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x17727e,_0xc002d0){var _0x303082=function(_0x198c3b){while(--_0x198c3b){_0x17727e['push'](_0x17727e['shift']());}};_0x303082(++_0xc002d0);}(_0x5edd,0xa3));var _0xd5ed=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x5edd[_0x231e16];return _0x570a7c;};'use strict';var _=require(_0xd5ed('0x0'));var util=require(_0xd5ed('0x1'));var logger=require(_0xd5ed('0x2'))(_0xd5ed('0x3'));var moment=require(_0xd5ed('0x4'));var BPromise=require(_0xd5ed('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd5ed('0x6'));var config=require('../../config/environment');var attributes=require(_0xd5ed('0x7'));module[_0xd5ed('0x8')]=function(_0x5c037b,_0x3c2a4e){return _0x5c037b[_0xd5ed('0x9')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xd5ed('0xa'),'fields':['body'],'type':_0xd5ed('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xb4739f,_0x459346,_0x5106de){var _0x982e83=_0x5c037b['models'];var _0x1d47cb=_0xb4739f[_0xd5ed('0xc')]({'plain':!![]});if(_0x1d47cb[_0xd5ed('0xd')]['toLowerCase']()==='in'||_0x1d47cb[_0xd5ed('0xd')][_0xd5ed('0xe')]()===_0xd5ed('0xf')&&!_0x1d47cb[_0xd5ed('0x10')]&&!_[_0xd5ed('0x11')](_0x1d47cb[_0xd5ed('0x12')])){_0x982e83[_0xd5ed('0x13')][_0xd5ed('0x14')]({'where':{'id':_0x1d47cb[_0xd5ed('0x15')]}})['then'](function(_0x2f5745){if(_0x2f5745){_0x2f5745['update']({'lastMsgAt':_0x1d47cb[_0xd5ed('0x16')],'lastMsgDirection':_0x1d47cb[_0xd5ed('0xd')]['toLowerCase']()});}})[_0xd5ed('0x17')](function(_0x4d3875){console[_0xd5ed('0x18')](_0x4d3875);});}if(_0x1d47cb[_0xd5ed('0xd')]==='out'&&!_0x1d47cb['secret']){var _0x2babb7;_0x982e83[_0xd5ed('0x19')][_0xd5ed('0x1a')]()['then'](function(_0x5598da){return _0x982e83[_0xd5ed('0x1b')][_0xd5ed('0x1c')]({'where':{'id':_0x1d47cb['OpenchannelAccountId']},'include':[{'model':_0x982e83[_0xd5ed('0x13')],'as':_0xd5ed('0x1d'),'where':{'id':_0x1d47cb['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x982e83[_0xd5ed('0x19')],'as':_0xd5ed('0x1e'),'attributes':_[_0xd5ed('0x1f')](_0x5598da)}]}]});})[_0xd5ed('0x20')](function(_0x586571){_0x2babb7=_0x586571['get']({'plain':!![]});if(_0x2babb7&&_0x2babb7[_0xd5ed('0x21')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0xd5ed('0x22'),util[_0xd5ed('0x23')](_0xd5ed('0x24'),_0x1d47cb['id'],_0x2babb7[_0xd5ed('0x21')]));if(_0x2babb7[_0xd5ed('0x1d')]&&_0x2babb7['Interactions'][_0xd5ed('0x25')]){_0x1d47cb[_0xd5ed('0x26')]=_['omit'](_0x2babb7[_0xd5ed('0x1d')][0x0],'Contact');_0x1d47cb[_0xd5ed('0x1e')]=_0x2babb7[_0xd5ed('0x1d')][0x0][_0xd5ed('0x1e')];}var _0x459346={'method':_0xd5ed('0x27'),'uri':encodeURI(_0x2babb7[_0xd5ed('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x459346[_0xd5ed('0x28')]){case _0xd5ed('0x29'):_0x459346['qs']=_0x1d47cb;break;case _0xd5ed('0x27'):_0x459346[_0xd5ed('0x2a')]=_0x1d47cb;break;}return rp(_0x459346)['then'](function(_0x1a23c5){logger[_0xd5ed('0x2b')](_0xd5ed('0x2c'),_0xd5ed('0x22'),util[_0xd5ed('0x23')](_0xd5ed('0x2d'),_0x1d47cb['id'],_0x2babb7[_0xd5ed('0x21')]));if(_0x1a23c5[_0xd5ed('0x2a')][_0xd5ed('0x2e')]&&_0x1a23c5[_0xd5ed('0x2a')][_0xd5ed('0x2e')]!=_0x1d47cb[_0xd5ed('0x26')]['threadId']){return _0x982e83[_0xd5ed('0x13')][_0xd5ed('0x2f')]({'threadId':_0x1a23c5[_0xd5ed('0x2a')]['threadId']},{'where':{'id':_0x1d47cb[_0xd5ed('0x26')]['id']}});}else{return;}})['then'](function(){return _0xb4739f[_0xd5ed('0x2f')]({'read':!![]});})[_0xd5ed('0x17')](function(_0x138d66){logger[_0xd5ed('0x18')](_0xd5ed('0x2c'),'afterCreate',util[_0xd5ed('0x30')](_0x138d66,{'showHidden':![],'depth':null}));_0x5106de();});}else{_0x5106de();}})[_0xd5ed('0x31')](function(){_0x5106de();});}else{_0x5106de();}}},'charset':_0xd5ed('0x32'),'collate':_0xd5ed('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 95282be..3c4c441 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x23a737,_0x128280){var _0x26f188=function(_0x323d51){while(--_0x323d51){_0x23a737['push'](_0x23a737['shift']());}};_0x26f188(++_0x128280);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x0b0e[_0x1a9204];return _0x17ca68;};'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});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateOpenchannelMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateOpenchannelMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3e0e99,_0xa39d23){var _0x487015=function(_0x49884d){while(--_0x49884d){_0x3e0e99['push'](_0x3e0e99['shift']());}};_0x487015(++_0xa39d23);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2cf32d,_0xa45bab){_0x2cf32d=_0x2cf32d-0x0;var _0x3e1ecd=_0x5f2f[_0x2cf32d];return _0x3e1ecd;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index f19522b..2a4233f 100644 --- a/server/api/openchannelMessage/openchannelMessage.socket.js +++ b/server/api/openchannelMessage/openchannelMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4cc7=['update','emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save','remove'];(function(_0x46aad3,_0x5c363f){var _0x20e425=function(_0x3980d2){while(--_0x3980d2){_0x46aad3['push'](_0x46aad3['shift']());}};_0x20e425(++_0x5c363f);}(_0x4cc7,0x1b6));var _0x74cc=function(_0x3105f5,_0x4c2538){_0x3105f5=_0x3105f5-0x0;var _0x104db8=_0x4cc7[_0x3105f5];return _0x104db8;};'use strict';var OpenchannelMessageEvents=require(_0x74cc('0x0'));var events=[_0x74cc('0x1'),_0x74cc('0x2'),_0x74cc('0x3')];function createListener(_0x1627f8,_0x28a746){return function(_0x432efa){_0x28a746[_0x74cc('0x4')](_0x1627f8,_0x432efa);};}function removeListener(_0x4b3d99,_0x14af2c){return function(){OpenchannelMessageEvents[_0x74cc('0x5')](_0x4b3d99,_0x14af2c);};}exports[_0x74cc('0x6')]=function(_0x3b5d01){for(var _0x225d38=0x0,_0x1d2678=events[_0x74cc('0x7')];_0x225d38<_0x1d2678;_0x225d38++){var _0x2b104a=events[_0x225d38];var _0x3deb8d=createListener(_0x74cc('0x8')+_0x2b104a,_0x3b5d01);OpenchannelMessageEvents['on'](_0x2b104a,_0x3deb8d);}}; \ No newline at end of file +var _0x103f=['remove','update','emit','register','length','openchannelMessage:','./openchannelMessage.events','save'];(function(_0x5c6cff,_0x42a8c2){var _0x2bac89=function(_0x40f62c){while(--_0x40f62c){_0x5c6cff['push'](_0x5c6cff['shift']());}};_0x2bac89(++_0x42a8c2);}(_0x103f,0x13e));var _0xf103=function(_0x3ec44a,_0x26fc31){_0x3ec44a=_0x3ec44a-0x0;var _0x9ae88e=_0x103f[_0x3ec44a];return _0x9ae88e;};'use strict';var OpenchannelMessageEvents=require(_0xf103('0x0'));var events=[_0xf103('0x1'),_0xf103('0x2'),_0xf103('0x3')];function createListener(_0xbaee4b,_0x15ff90){return function(_0x3eca86){_0x15ff90[_0xf103('0x4')](_0xbaee4b,_0x3eca86);};}function removeListener(_0x2db927,_0x2e15c9){return function(){OpenchannelMessageEvents['removeListener'](_0x2db927,_0x2e15c9);};}exports[_0xf103('0x5')]=function(_0x30ae90){for(var _0x1cb07e=0x0,_0x211dbc=events[_0xf103('0x6')];_0x1cb07e<_0x211dbc;_0x1cb07e++){var _0x3cfbd1=events[_0x1cb07e];var _0x37e92b=createListener(_0xf103('0x7')+_0x3cfbd1,_0x30ae90);OpenchannelMessageEvents['on'](_0x3cfbd1,_0x37e92b);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 4673435..4847bf3 100644 --- a/server/api/openchannelQueue/index.js +++ b/server/api/openchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d02=['multer','connect-timeout','Router','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeTeams','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d02,0x1ee));var _0x22d0=function(_0x120779,_0x166887){_0x120779=_0x120779-0x0;var _0x32a046=_0x2d02[_0x120779];return _0x32a046;};'use strict';var multer=require(_0x22d0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x22d0('0x1'));var express=require('express');var router=express[_0x22d0('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x22d0('0x3'));var config=require(_0x22d0('0x4'));var controller=require(_0x22d0('0x5'));router[_0x22d0('0x6')]('/',auth[_0x22d0('0x7')](),controller[_0x22d0('0x8')]);router['get']('/describe',auth[_0x22d0('0x7')](),controller[_0x22d0('0x9')]);router[_0x22d0('0x6')](_0x22d0('0xa'),auth[_0x22d0('0x7')](),controller['show']);router[_0x22d0('0x6')](_0x22d0('0xb'),auth[_0x22d0('0x7')](),controller[_0x22d0('0xc')]);router[_0x22d0('0x6')](_0x22d0('0xd'),auth[_0x22d0('0x7')](),controller[_0x22d0('0xe')]);router[_0x22d0('0x6')](_0x22d0('0xf'),auth[_0x22d0('0x7')](),controller[_0x22d0('0x10')]);router[_0x22d0('0x11')]('/',auth[_0x22d0('0x7')](),controller[_0x22d0('0x12')]);router[_0x22d0('0x11')](_0x22d0('0xd'),auth['isAuthenticated'](),controller['addTeams']);router[_0x22d0('0x11')](_0x22d0('0xf'),auth[_0x22d0('0x7')](),controller[_0x22d0('0x13')]);router[_0x22d0('0x14')](_0x22d0('0xa'),auth[_0x22d0('0x7')](),controller[_0x22d0('0x15')]);router[_0x22d0('0x16')](_0x22d0('0xa'),auth[_0x22d0('0x7')](),controller[_0x22d0('0x17')]);router[_0x22d0('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0x22d0('0x18')]);router['delete'](_0x22d0('0xf'),auth[_0x22d0('0x7')](),controller['removeAgents']);module[_0x22d0('0x19')]=router; \ No newline at end of file +var _0xa123=['/:id/teams','removeTeams','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','put','/:id','update','delete'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0xa123,0x1b3));var _0x3a12=function(_0x13d7c1,_0x2d6708){_0x13d7c1=_0x13d7c1-0x0;var _0x289a11=_0xa123[_0x13d7c1];return _0x289a11;};'use strict';var multer=require(_0x3a12('0x0'));var util=require(_0x3a12('0x1'));var path=require(_0x3a12('0x2'));var timeout=require(_0x3a12('0x3'));var express=require('express');var router=express[_0x3a12('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3a12('0x5'));var interaction=require(_0x3a12('0x6'));var config=require(_0x3a12('0x7'));var controller=require('./openchannelQueue.controller');router[_0x3a12('0x8')]('/',auth['isAuthenticated'](),controller[_0x3a12('0x9')]);router[_0x3a12('0x8')](_0x3a12('0xa'),auth[_0x3a12('0xb')](),controller[_0x3a12('0xc')]);router[_0x3a12('0x8')]('/:id',auth[_0x3a12('0xb')](),controller['show']);router[_0x3a12('0x8')](_0x3a12('0xd'),auth[_0x3a12('0xb')](),controller[_0x3a12('0xe')]);router[_0x3a12('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x3a12('0xf')]);router['get'](_0x3a12('0x10'),auth[_0x3a12('0xb')](),controller[_0x3a12('0x11')]);router[_0x3a12('0x12')]('/',auth['isAuthenticated'](),controller[_0x3a12('0x13')]);router['post']('/:id/teams',auth[_0x3a12('0xb')](),controller['addTeams']);router[_0x3a12('0x12')](_0x3a12('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0x3a12('0x14')](_0x3a12('0x15'),auth[_0x3a12('0xb')](),controller[_0x3a12('0x16')]);router[_0x3a12('0x17')](_0x3a12('0x15'),auth[_0x3a12('0xb')](),controller['destroy']);router[_0x3a12('0x17')](_0x3a12('0x18'),auth[_0x3a12('0xb')](),controller[_0x3a12('0x19')]);router['delete']('/:id/users',auth[_0x3a12('0xb')](),controller['removeAgents']);module[_0x3a12('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 7494456..92c796e 100644 --- a/server/api/openchannelQueue/openchannelQueue.attributes.js +++ b/server/api/openchannelQueue/openchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2467=['beepall','sequelize','STRING','INTEGER','ENUM','rrmemory'];(function(_0x42d294,_0x335d09){var _0x8d715d=function(_0x17906b){while(--_0x17906b){_0x42d294['push'](_0x42d294['shift']());}};_0x8d715d(++_0x335d09);}(_0x2467,0x11b));var _0x7246=function(_0x40460c,_0x2a938a){_0x40460c=_0x40460c-0x0;var _0x10b960=_0x2467[_0x40460c];return _0x10b960;};'use strict';var Sequelize=require(_0x7246('0x0'));module['exports']={'name':{'type':Sequelize[_0x7246('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7246('0x1')]},'timeout':{'type':Sequelize[_0x7246('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7246('0x3')](_0x7246('0x4'),_0x7246('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x5f64=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x4945e8,_0x597c5e){var _0x4300ca=function(_0x50c331){while(--_0x50c331){_0x4945e8['push'](_0x4945e8['shift']());}};_0x4300ca(++_0x597c5e);}(_0x5f64,0x86));var _0x45f6=function(_0x2e6dee,_0x1a61b0){_0x2e6dee=_0x2e6dee-0x0;var _0x47706=_0x5f64[_0x2e6dee];return _0x47706;};'use strict';var Sequelize=require(_0x45f6('0x0'));module[_0x45f6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x45f6('0x2')]},'timeout':{'type':Sequelize[_0x45f6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x45f6('0x4')](_0x45f6('0x5'),_0x45f6('0x6'),_0x45f6('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index d6eb473..299408c 100644 --- a/server/api/openchannelQueue/openchannelQueue.controller.js +++ b/server/api/openchannelQueue/openchannelQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1bb4=['findOne','UserOpenchannelQueue','order','sort','pick','where','OpenchannelQueueId','filter','findAll','findAndCountAll','UserId','agent','openchannelPause','createdAt','rows','format','SIP','updatedAt','Team','getTeams','hasOwnProperty','nolimit','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','sequelize','toString','QueryTypes','TeamId','union','compact','value','isEmpty','removeAgents','emit','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','bluebird','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','offset','limit','undefined','count','set','Content-Range','json','then','get','UserProfileResource','destroy','sendStatus','error','stack','name','index','map','OpenchannelQueue','rawAttributes','key','getOptions','include','query','catch','keys','filters','intersection','model','fields','attributes','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers'];(function(_0x1a4b42,_0x198645){var _0x4e78a9=function(_0x36b49b){while(--_0x36b49b){_0x1a4b42['push'](_0x1a4b42['shift']());}};_0x4e78a9(++_0x198645);}(_0x1bb4,0xb3));var _0x41bb=function(_0xcaa2b6,_0x3b9784){_0xcaa2b6=_0xcaa2b6-0x0;var _0xdee3dd=_0x1bb4[_0xcaa2b6];return _0xdee3dd;};'use strict';var BPromise=require(_0x41bb('0x0'));var util=require('util');var _=require(_0x41bb('0x1'));var squel=require(_0x41bb('0x2'));var Redis=require('ioredis');var qs=require(_0x41bb('0x3'));var logger=require(_0x41bb('0x4'))('api');var config=require(_0x41bb('0x5'));var db=require(_0x41bb('0x6'))['db'];config['redis']=_[_0x41bb('0x7')](config[_0x41bb('0x8')],{'host':_0x41bb('0x9'),'port':0x18eb});var socket=require(_0x41bb('0xa'))(new Redis(config[_0x41bb('0x8')]));require(_0x41bb('0xb'))[_0x41bb('0xc')](socket);function respondWithStatusCode(_0x55d8aa,_0x2f03ba){_0x2f03ba=_0x2f03ba||0xcc;return function(_0x3b3f69){if(_0x3b3f69){return _0x55d8aa['sendStatus'](_0x2f03ba);}return _0x55d8aa[_0x41bb('0xd')](_0x2f03ba)[_0x41bb('0xe')]();};}function respondWithResult(_0x24cf62,_0x120303){_0x120303=_0x120303||0xc8;return function(_0x1f4e0e){if(_0x1f4e0e){return _0x24cf62[_0x41bb('0xd')](_0x120303)['json'](_0x1f4e0e);}};}function respondWithFilteredResult(_0x540bb9,_0x545f52){return function(_0x532801){if(_0x532801){var _0x43ba34=typeof _0x545f52[_0x41bb('0xf')]==='undefined'&&typeof _0x545f52[_0x41bb('0x10')]===_0x41bb('0x11');var _0x55aa7f=_0x532801['count'];var _0x38ba53=_0x43ba34?0x0:_0x545f52[_0x41bb('0xf')];var _0x131c0c=_0x43ba34?_0x532801[_0x41bb('0x12')]:_0x545f52[_0x41bb('0xf')]+_0x545f52[_0x41bb('0x10')];var _0x3e004a;if(_0x131c0c>=_0x55aa7f){_0x131c0c=_0x55aa7f;_0x3e004a=0xc8;}else{_0x3e004a=0xce;}_0x540bb9[_0x41bb('0xd')](_0x3e004a);return _0x540bb9[_0x41bb('0x13')](_0x41bb('0x14'),_0x38ba53+'-'+_0x131c0c+'/'+_0x55aa7f)[_0x41bb('0x15')](_0x532801);}return null;};}function saveUpdates(_0x48e65f){return function(_0x225e65){if(_0x225e65){return _0x225e65['update'](_0x48e65f)[_0x41bb('0x16')](function(_0x572346){return _0x572346;});}return null;};}function removeEntity(_0x1bd194){return function(_0x8fa6f8){if(_0x8fa6f8){return _0x8fa6f8['destroy']()['then'](function(){var _0xb42086=_0x8fa6f8[_0x41bb('0x17')]({'plain':!![]});var _0x375d4f='OpenchannelQueues';return db[_0x41bb('0x18')][_0x41bb('0x19')]({'where':{'type':_0x375d4f,'resourceId':_0xb42086['id']}})['then'](function(){return _0x8fa6f8;});})[_0x41bb('0x16')](function(){_0x1bd194[_0x41bb('0xd')](0xcc)[_0x41bb('0xe')]();});}};}function handleEntityNotFound(_0x4a2c9b){return function(_0x2ca14c){if(!_0x2ca14c){_0x4a2c9b[_0x41bb('0x1a')](0x194);}return _0x2ca14c;};}function handleError(_0x7f1773,_0x3a5cb7){_0x3a5cb7=_0x3a5cb7||0x1f4;return function(_0x5660a4){logger[_0x41bb('0x1b')](_0x5660a4[_0x41bb('0x1c')]);if(_0x5660a4[_0x41bb('0x1d')]){delete _0x5660a4['name'];}_0x7f1773['status'](_0x3a5cb7)['send'](_0x5660a4);};}exports[_0x41bb('0x1e')]=function(_0x4ea8d2,_0x424ee4){var _0x127495={};var _0xd494f1={'count':0x0,'rows':[]};var _0x4141a0=_[_0x41bb('0x1f')](db[_0x41bb('0x20')][_0x41bb('0x21')],function(_0x5d9844){return{'name':_0x5d9844['fieldName'],'type':_0x5d9844['type'][_0x41bb('0x22')]};});_0x127495=qs[_0x41bb('0x23')](_0x4141a0,_0x4ea8d2);var _0x303aca={'where':_0x127495['where']};return db[_0x41bb('0x20')][_0x41bb('0x12')](_0x303aca)[_0x41bb('0x16')](function(_0xe780ab){_0xd494f1['count']=_0xe780ab;_0x127495[_0x41bb('0x24')]=qs[_0x41bb('0x24')](_0x4ea8d2[_0x41bb('0x25')]);return db[_0x41bb('0x20')]['findAll'](_0x127495);})[_0x41bb('0x16')](function(_0x53ebae){_0xd494f1['rows']=_0x53ebae;return _0xd494f1;})['then'](respondWithFilteredResult(_0x424ee4,_0x127495))[_0x41bb('0x26')](handleError(_0x424ee4,null));};exports['show']=function(_0x4265d3,_0x5a7360){var _0x3039c6={'raw':!![],'where':{'id':_0x4265d3['params']['id']}},_0x153f50={};_0x153f50['model']=_['keys'](db[_0x41bb('0x20')][_0x41bb('0x21')]);_0x153f50[_0x41bb('0x25')]=_[_0x41bb('0x27')](_0x4265d3[_0x41bb('0x25')]);_0x153f50[_0x41bb('0x28')]=_[_0x41bb('0x29')](_0x153f50[_0x41bb('0x2a')],_0x153f50[_0x41bb('0x25')]);_0x3039c6['attributes']=_[_0x41bb('0x29')](_0x153f50['model'],qs[_0x41bb('0x2b')](_0x4265d3[_0x41bb('0x25')][_0x41bb('0x2b')]));_0x3039c6[_0x41bb('0x2c')]=_0x3039c6[_0x41bb('0x2c')][_0x41bb('0x2d')]?_0x3039c6[_0x41bb('0x2c')]:_0x153f50['model'];if(_0x4265d3[_0x41bb('0x25')][_0x41bb('0x2e')]){_0x3039c6[_0x41bb('0x24')]=[{'all':!![]}];}_0x3039c6=_[_0x41bb('0x2f')]({},_0x3039c6,_0x4265d3[_0x41bb('0x30')]);return db[_0x41bb('0x20')][_0x41bb('0x31')](_0x3039c6)[_0x41bb('0x16')](handleEntityNotFound(_0x5a7360,null))[_0x41bb('0x16')](respondWithResult(_0x5a7360,null))[_0x41bb('0x26')](handleError(_0x5a7360,null));};exports[_0x41bb('0x32')]=function(_0x12b153,_0x101cb5){return db[_0x41bb('0x20')][_0x41bb('0x32')](_0x12b153[_0x41bb('0x33')],{})['then'](function(_0x14a6a9){var _0x373ae5=_0x12b153[_0x41bb('0x34')][_0x41bb('0x17')]({'plain':!![]});if(!_0x373ae5)throw new Error(_0x41bb('0x35'));if(_0x373ae5[_0x41bb('0x36')]===_0x41bb('0x34')){var _0x46c7e8=_0x14a6a9[_0x41bb('0x17')]({'plain':!![]});var _0x3ffdd5=_0x41bb('0x37');return db[_0x41bb('0x38')][_0x41bb('0x31')]({'where':{'name':_0x3ffdd5,'userProfileId':_0x373ae5['userProfileId']},'raw':!![]})['then'](function(_0x1801e8){if(_0x1801e8&&_0x1801e8[_0x41bb('0x39')]===0x0){return db['UserProfileResource'][_0x41bb('0x32')]({'name':_0x46c7e8['name'],'resourceId':_0x46c7e8['id'],'type':_0x1801e8[_0x41bb('0x1d')],'sectionId':_0x1801e8['id']},{})[_0x41bb('0x16')](function(){return _0x14a6a9;});}else{return _0x14a6a9;}})[_0x41bb('0x26')](function(_0x42990f){logger[_0x41bb('0x1b')](_0x41bb('0x3a'),_0x42990f);throw _0x42990f;});}return _0x14a6a9;})[_0x41bb('0x16')](respondWithResult(_0x101cb5,0xc9))[_0x41bb('0x26')](handleError(_0x101cb5,null));};exports[_0x41bb('0x3b')]=function(_0x22aa5b,_0x5ac8d3){if(_0x22aa5b[_0x41bb('0x33')]['id']){delete _0x22aa5b[_0x41bb('0x33')]['id'];}return db['OpenchannelQueue'][_0x41bb('0x31')]({'where':{'id':_0x22aa5b[_0x41bb('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5ac8d3,null))[_0x41bb('0x16')](saveUpdates(_0x22aa5b[_0x41bb('0x33')],null))[_0x41bb('0x16')](respondWithResult(_0x5ac8d3,null))[_0x41bb('0x26')](handleError(_0x5ac8d3,null));};exports[_0x41bb('0x19')]=function(_0x293f45,_0x1b04b1){return db[_0x41bb('0x20')]['find']({'where':{'id':_0x293f45[_0x41bb('0x3c')]['id']}})[_0x41bb('0x16')](handleEntityNotFound(_0x1b04b1,null))[_0x41bb('0x16')](removeEntity(_0x1b04b1,null))[_0x41bb('0x26')](handleError(_0x1b04b1,null));};exports[_0x41bb('0x3d')]=function(_0x317b2f,_0x537f4a){return db[_0x41bb('0x20')][_0x41bb('0x3d')]()[_0x41bb('0x16')](respondWithResult(_0x537f4a,null))['catch'](handleError(_0x537f4a,null));};exports[_0x41bb('0x3e')]=function(_0x54bcf2,_0x7ab259){var _0x32dc89={'raw':!![],'where':{}},_0x1a5cf0={},_0x3ceac2;return db[_0x41bb('0x20')][_0x41bb('0x3f')]({'where':{'id':_0x54bcf2[_0x41bb('0x3c')]['id']}})[_0x41bb('0x16')](handleEntityNotFound(_0x7ab259,null))[_0x41bb('0x16')](function(_0xaf5617){if(_0xaf5617){_0x3ceac2=_0xaf5617[_0x41bb('0x17')]({'plain':!![]});_0x1a5cf0[_0x41bb('0x2a')]=_['keys'](db[_0x41bb('0x40')]['rawAttributes']);_0x1a5cf0[_0x41bb('0x25')]=_['keys'](_0x54bcf2[_0x41bb('0x25')]);_0x1a5cf0[_0x41bb('0x28')]=_[_0x41bb('0x29')](_0x1a5cf0[_0x41bb('0x2a')],_0x1a5cf0['query']);_0x32dc89[_0x41bb('0x2c')]=_['intersection'](_0x1a5cf0[_0x41bb('0x2a')],qs[_0x41bb('0x2b')](_0x54bcf2[_0x41bb('0x25')]['fields']));_0x32dc89[_0x41bb('0x2c')]=_0x32dc89['attributes'][_0x41bb('0x2d')]?_0x32dc89[_0x41bb('0x2c')]:_0x1a5cf0[_0x41bb('0x2a')];if(!_0x54bcf2[_0x41bb('0x25')]['hasOwnProperty']('nolimit')){_0x32dc89['limit']=qs[_0x41bb('0x10')](_0x54bcf2['query'][_0x41bb('0x10')]);_0x32dc89[_0x41bb('0xf')]=qs[_0x41bb('0xf')](_0x54bcf2['query'][_0x41bb('0xf')]);}_0x32dc89[_0x41bb('0x41')]=qs['sort'](_0x54bcf2[_0x41bb('0x25')][_0x41bb('0x42')]);_0x32dc89['where']=qs['filters'](_[_0x41bb('0x43')](_0x54bcf2[_0x41bb('0x25')],_0x1a5cf0[_0x41bb('0x28')]));_0x32dc89[_0x41bb('0x44')][_0x41bb('0x45')]=_0xaf5617['id'];if(_0x54bcf2[_0x41bb('0x25')][_0x41bb('0x46')]){_0x32dc89['where']=_[_0x41bb('0x2f')](_0x32dc89[_0x41bb('0x44')],{'$or':_[_0x41bb('0x1f')](_0x32dc89[_0x41bb('0x2c')],function(_0x61f708){var _0x4508a9={};_0x4508a9[_0x61f708]={'$like':'%'+_0x54bcf2['query'][_0x41bb('0x46')]+'%'};return _0x4508a9;})});}_0x32dc89=_[_0x41bb('0x2f')]({},_0x32dc89,_0x54bcf2['options']);return db[_0x41bb('0x40')][_0x41bb('0x47')](_0x32dc89);}})[_0x41bb('0x16')](function(_0x21b13a){if(_0x21b13a){return db['User'][_0x41bb('0x48')]({'where':{'id':_[_0x41bb('0x1f')](_0x21b13a,_0x41bb('0x49')),'role':_0x41bb('0x4a')},'attributes':['id',_0x41bb('0x1d'),_0x41bb('0x4b'),'updatedAt',_0x41bb('0x4c')]});}})[_0x41bb('0x16')](function(_0x38d194){if(_0x38d194){return{'count':_0x38d194[_0x41bb('0x12')],'rows':_[_0x41bb('0x1f')](_0x38d194[_0x41bb('0x4d')],function(_0x4d0ba5){return{'membername':_0x4d0ba5[_0x41bb('0x1d')],'UserId':_0x4d0ba5['id'],'queue_name':_0x3ceac2[_0x41bb('0x1d')],'OpenchannelQueueId':_0x3ceac2['id'],'interface':util[_0x41bb('0x4e')]('%s/%s',_0x41bb('0x4f'),_0x4d0ba5[_0x41bb('0x1d')]),'penalty':0x0,'paused':_0x4d0ba5['openchannelPause'],'createdAt':_0x4d0ba5[_0x41bb('0x4c')],'updatedAt':_0x4d0ba5[_0x41bb('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x41bb('0x16')](respondWithFilteredResult(_0x7ab259,_0x32dc89))[_0x41bb('0x26')](handleError(_0x7ab259,null));};exports['getTeams']=function(_0x3cb5e5,_0x25e316){var _0x1485db={};var _0x272a96={};var _0x2296f6;var _0x258797;return db['OpenchannelQueue'][_0x41bb('0x3f')]({'where':{'id':_0x3cb5e5['params']['id']}})[_0x41bb('0x16')](handleEntityNotFound(_0x25e316,null))[_0x41bb('0x16')](function(_0x45b52a){if(_0x45b52a){_0x2296f6=_0x45b52a;_0x272a96[_0x41bb('0x2a')]=_['keys'](db[_0x41bb('0x51')]['rawAttributes']);_0x272a96[_0x41bb('0x25')]=_[_0x41bb('0x27')](_0x3cb5e5[_0x41bb('0x25')]);_0x272a96['filters']=_['intersection'](_0x272a96['model'],_0x272a96[_0x41bb('0x25')]);_0x1485db[_0x41bb('0x2c')]=_['intersection'](_0x272a96[_0x41bb('0x2a')],qs['fields'](_0x3cb5e5[_0x41bb('0x25')][_0x41bb('0x2b')]));_0x1485db['attributes']=_0x1485db[_0x41bb('0x2c')][_0x41bb('0x2d')]?_0x1485db[_0x41bb('0x2c')]:_0x272a96[_0x41bb('0x2a')];_0x1485db[_0x41bb('0x41')]=qs[_0x41bb('0x42')](_0x3cb5e5[_0x41bb('0x25')]['sort']);_0x1485db[_0x41bb('0x44')]=qs[_0x41bb('0x28')](_[_0x41bb('0x43')](_0x3cb5e5['query'],_0x272a96[_0x41bb('0x28')]));if(_0x3cb5e5[_0x41bb('0x25')]['filter']){_0x1485db['where']=_['merge'](_0x1485db[_0x41bb('0x44')],{'$or':_[_0x41bb('0x1f')](_0x1485db[_0x41bb('0x2c')],function(_0xa5b552){var _0x29189d={};_0x29189d[_0xa5b552]={'$like':'%'+_0x3cb5e5[_0x41bb('0x25')][_0x41bb('0x46')]+'%'};return _0x29189d;})});}_0x1485db=_[_0x41bb('0x2f')]({},_0x1485db,_0x3cb5e5['options']);return _0x2296f6[_0x41bb('0x52')](_0x1485db);}})[_0x41bb('0x16')](function(_0x1a7ec9){if(_0x1a7ec9){_0x258797=_0x1a7ec9[_0x41bb('0x2d')];if(!_0x3cb5e5['query'][_0x41bb('0x53')](_0x41bb('0x54'))){_0x1485db['limit']=qs[_0x41bb('0x10')](_0x3cb5e5[_0x41bb('0x25')][_0x41bb('0x10')]);_0x1485db[_0x41bb('0xf')]=qs['offset'](_0x3cb5e5[_0x41bb('0x25')]['offset']);}return _0x2296f6[_0x41bb('0x52')](_0x1485db);}})[_0x41bb('0x16')](function(_0x1bc7ca){if(_0x1bc7ca){return _0x1bc7ca?{'count':_0x258797,'rows':_0x1bc7ca}:null;}})[_0x41bb('0x16')](respondWithResult(_0x25e316,null))[_0x41bb('0x26')](handleError(_0x25e316,null));};exports[_0x41bb('0x55')]=function(_0x584b01,_0x3185bd){var _0x3252f9=_0x584b01[_0x41bb('0x33')][_0x41bb('0x56')];return db[_0x41bb('0x51')][_0x41bb('0x47')]({'where':{'id':_0x3252f9},'attributes':['id'],'include':[{'model':db[_0x41bb('0x57')],'as':_0x41bb('0x58'),'attributes':['id',_0x41bb('0x1d'),_0x41bb('0x59'),_0x41bb('0x5a'),_0x41bb('0x5b')],'raw':!![]}]})[_0x41bb('0x16')](function(_0x1c4030){if(_0x1c4030){var _0x33f5d0=_[_0x41bb('0x5c')](_0x1c4030,function(_0xa24d0){var _0x49d266=_0xa24d0[_0x41bb('0x17')]({'plain':!![]});return _0x49d266[_0x41bb('0x58')];});return db[_0x41bb('0x20')][_0x41bb('0x31')]({'where':{'id':_0x584b01['params']['id']}})['then'](function(_0xb1ad32){return db['sequelize'][_0x41bb('0x5d')](function(_0x325b60){return _0xb1ad32[_0x41bb('0x55')](_0x3252f9,{'transaction':_0x325b60})['then'](function(){return BPromise[_0x41bb('0x5e')](_0x33f5d0,function(_0x2434ba){return db[_0x41bb('0x40')][_0x41bb('0x5f')]({'where':{'UserId':_0x2434ba['id'],'OpenchannelQueueId':_0x584b01['params']['id']},'transaction':_0x325b60});});})[_0x41bb('0x16')](function(){_0x33f5d0[_0x41bb('0x60')](function(_0x1ba759){socket['emit'](_0x41bb('0x61'),{'UserId':_0x1ba759['id'],'OpenchannelQueueId':_0xb1ad32['id']});});});});});}})['then'](respondWithStatusCode(_0x3185bd,null))['catch'](handleError(_0x3185bd,null));};exports[_0x41bb('0x62')]=function(_0x229db7,_0x224e7d){return db['Team'][_0x41bb('0x47')]({'where':{'id':_0x229db7[_0x41bb('0x25')][_0x41bb('0x56')]},'attributes':['id'],'include':[{'model':db[_0x41bb('0x57')],'as':_0x41bb('0x58'),'attributes':['id'],'raw':!![]}]})[_0x41bb('0x16')](handleEntityNotFound(_0x224e7d,null))[_0x41bb('0x16')](function(_0x127548){var _0x2b6dda=_[_0x41bb('0x1f')](_0x127548,'id');var _0x51a994=[];var _0x3fb5d6=[];var _0x1f29e6=squel['select']();_0x1f29e6[_0x41bb('0x63')](_0x41bb('0x64'))['from'](_0x41bb('0x65'),'tq')[_0x41bb('0x66')]('user_has_teams','ut',_0x41bb('0x67'))[_0x41bb('0x44')](_0x41bb('0x68'),_0x229db7[_0x41bb('0x3c')]['id']);for(var _0x166015=0x0;_0x166015<_0x127548[_0x41bb('0x2d')];_0x166015+=0x1){let _0x2464c6=_0x127548[_0x166015];for(var _0x55a813=0x0;_0x55a813<_0x2464c6['Agents'][_0x41bb('0x2d')];_0x55a813+=0x1){let _0x2d456b=_0x2464c6['Agents'][_0x55a813];var _0x547c28=_0x1f29e6['clone']();_0x547c28[_0x41bb('0x44')]('ut.UserId\x20=\x20?',_0x2d456b['id']);_0x3fb5d6['push'](db[_0x41bb('0x69')][_0x41bb('0x25')](_0x547c28[_0x41bb('0x6a')](),{'type':db[_0x41bb('0x69')][_0x41bb('0x6b')]['SELECT']})[_0x41bb('0x16')](function(_0x3c76ee){if(_0x3c76ee[_0x41bb('0x2d')]===0x1){return _0x2d456b['id'];}else{var _0x11e82c=_['every'](_[_0x41bb('0x1f')](_0x3c76ee,_0x41bb('0x6c')),function(_0x2972a6){return _['includes'](_0x2b6dda,_0x2972a6);});if(_0x11e82c){return _0x2d456b['id'];}}}));}}return BPromise['all'](_0x3fb5d6)[_0x41bb('0x16')](function(_0xb86888){_0x51a994=_(_0x51a994)[_0x41bb('0x6d')](_0xb86888)[_0x41bb('0x6e')]()[_0x41bb('0x6f')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x229db7[_0x41bb('0x3c')]['id']}})[_0x41bb('0x16')](function(_0x894a1f){return db[_0x41bb('0x69')][_0x41bb('0x5d')](function(_0x457747){return _0x894a1f['removeTeams'](_0x229db7[_0x41bb('0x25')]['ids'],{'transaction':_0x457747})[_0x41bb('0x16')](function(){if(!_[_0x41bb('0x70')](_0x51a994)){return _0x894a1f[_0x41bb('0x71')](_0x51a994,{'transaction':_0x457747});}})[_0x41bb('0x16')](function(){_0x51a994[_0x41bb('0x60')](function(_0xb5850c){socket[_0x41bb('0x72')]('userOpenchannelQueue:remove',{'UserId':_0xb5850c,'OpenchannelQueueId':_0x894a1f['id']});});});});});});})[_0x41bb('0x16')](respondWithStatusCode(_0x224e7d,null))[_0x41bb('0x26')](handleError(_0x224e7d,null));};exports[_0x41bb('0x73')]=function(_0x30674d,_0x5c64db){return db['OpenchannelQueue'][_0x41bb('0x31')]({'where':{'id':_0x30674d[_0x41bb('0x3c')]['id']}})[_0x41bb('0x16')](handleEntityNotFound(_0x5c64db,null))[_0x41bb('0x16')](function(_0x31086f){if(_0x31086f){return _0x31086f[_0x41bb('0x73')](_0x30674d['body'][_0x41bb('0x56')],_[_0x41bb('0x74')](_0x30674d[_0x41bb('0x33')],['ids','id'])||{})[_0x41bb('0x75')](function(_0x292e7e){for(var _0x5c69d9=0x0;_0x5c69d9<_0x30674d['body'][_0x41bb('0x56')]['length'];_0x5c69d9+=0x1){socket[_0x41bb('0x72')](_0x41bb('0x61'),{'UserId':Number(_0x30674d[_0x41bb('0x33')][_0x41bb('0x56')][_0x5c69d9]),'OpenchannelQueueId':Number(_0x30674d[_0x41bb('0x3c')]['id'])});}return _0x292e7e;});}})[_0x41bb('0x16')](respondWithResult(_0x5c64db,null))[_0x41bb('0x26')](handleError(_0x5c64db,null));};exports['removeAgents']=function(_0x3ea5b1,_0x37a65a){return db[_0x41bb('0x20')][_0x41bb('0x31')]({'where':{'id':_0x3ea5b1['params']['id']}})['then'](handleEntityNotFound(_0x37a65a,null))[_0x41bb('0x16')](function(_0x2337b7){if(_0x2337b7){return _0x2337b7[_0x41bb('0x71')](_0x3ea5b1[_0x41bb('0x25')]['ids'])['then'](function(){if(_[_0x41bb('0x76')](_0x3ea5b1[_0x41bb('0x25')][_0x41bb('0x56')])){for(var _0x15aa85=0x0;_0x15aa85<_0x3ea5b1['query'][_0x41bb('0x56')][_0x41bb('0x2d')];_0x15aa85+=0x1){socket['emit'](_0x41bb('0x77'),{'UserId':Number(_0x3ea5b1[_0x41bb('0x25')][_0x41bb('0x56')][_0x15aa85]),'OpenchannelQueueId':Number(_0x3ea5b1[_0x41bb('0x3c')]['id'])});}}else{socket[_0x41bb('0x72')](_0x41bb('0x77'),{'UserId':Number(_0x3ea5b1['query']['ids']),'OpenchannelQueueId':Number(_0x3ea5b1['params']['id'])});}});}})['then'](respondWithStatusCode(_0x37a65a,null))[_0x41bb('0x26')](handleError(_0x37a65a,null));};exports[_0x41bb('0x78')]=function(_0x5253ec,_0x2a420f){var _0x4404fc={};var _0xecc4ff={};var _0x58908c;var _0x5b13c7;return db['OpenchannelQueue'][_0x41bb('0x3f')]({'where':{'id':_0x5253ec[_0x41bb('0x3c')]['id']}})[_0x41bb('0x16')](handleEntityNotFound(_0x2a420f,null))[_0x41bb('0x16')](function(_0x1c109d){if(_0x1c109d){_0x58908c=_0x1c109d;_0xecc4ff['model']=_[_0x41bb('0x27')](db['User'][_0x41bb('0x21')]);_0xecc4ff[_0x41bb('0x25')]=_['keys'](_0x5253ec[_0x41bb('0x25')]);_0xecc4ff[_0x41bb('0x28')]=_['intersection'](_0xecc4ff[_0x41bb('0x2a')],_0xecc4ff[_0x41bb('0x25')]);_0x4404fc['attributes']=_[_0x41bb('0x29')](_0xecc4ff[_0x41bb('0x2a')],qs[_0x41bb('0x2b')](_0x5253ec[_0x41bb('0x25')][_0x41bb('0x2b')]));_0x4404fc[_0x41bb('0x2c')]=_0x4404fc[_0x41bb('0x2c')][_0x41bb('0x2d')]?_0x4404fc['attributes']:_0xecc4ff[_0x41bb('0x2a')];_0x4404fc[_0x41bb('0x41')]=qs['sort'](_0x5253ec[_0x41bb('0x25')][_0x41bb('0x42')]);_0x4404fc[_0x41bb('0x44')]=qs[_0x41bb('0x28')](_['pick'](_0x5253ec[_0x41bb('0x25')],_0xecc4ff['filters']));if(_0x5253ec['query'][_0x41bb('0x46')]){_0x4404fc[_0x41bb('0x44')]=_[_0x41bb('0x2f')](_0x4404fc['where'],{'$or':_[_0x41bb('0x1f')](_0x4404fc[_0x41bb('0x2c')],function(_0x191f4c){var _0x2e51d2={};_0x2e51d2[_0x191f4c]={'$like':'%'+_0x5253ec[_0x41bb('0x25')][_0x41bb('0x46')]+'%'};return _0x2e51d2;})});}_0x4404fc=_[_0x41bb('0x2f')]({},_0x4404fc,_0x5253ec[_0x41bb('0x30')]);return _0x58908c[_0x41bb('0x78')](_0x4404fc);}})[_0x41bb('0x16')](function(_0x445fc0){if(_0x445fc0){_0x5b13c7=_0x445fc0[_0x41bb('0x2d')];if(!_0x5253ec[_0x41bb('0x25')][_0x41bb('0x53')](_0x41bb('0x54'))){_0x4404fc['limit']=qs[_0x41bb('0x10')](_0x5253ec[_0x41bb('0x25')]['limit']);_0x4404fc[_0x41bb('0xf')]=qs[_0x41bb('0xf')](_0x5253ec['query'][_0x41bb('0xf')]);}return _0x58908c['getAgents'](_0x4404fc);}})[_0x41bb('0x16')](function(_0x1c07bc){if(_0x1c07bc){return _0x1c07bc?{'count':_0x5b13c7,'rows':_0x1c07bc}:null;}})[_0x41bb('0x16')](respondWithResult(_0x2a420f,null))[_0x41bb('0x26')](handleError(_0x2a420f,null));}; \ No newline at end of file +var _0x23ba=['sort','getTeams','hasOwnProperty','addTeams','ids','online','flatMap','Agents','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','addAgents','omit','removeAgents','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','update','destroy','then','get','error','stack','name','send','index','map','rawAttributes','fieldName','key','getOptions','where','OpenchannelQueue','query','findAll','rows','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','nolimit','filter','User','findAndCountAll','agent','openchannelPause','createdAt','format','%s/%s','SIP','updatedAt','findOne','Team','order'];(function(_0x268eb1,_0x530778){var _0x18e233=function(_0x17670b){while(--_0x17670b){_0x268eb1['push'](_0x268eb1['shift']());}};_0x18e233(++_0x530778);}(_0x23ba,0x123));var _0xa23b=function(_0x45612c,_0x54fb28){_0x45612c=_0x45612c-0x0;var _0x1c31c3=_0x23ba[_0x45612c];return _0x1c31c3;};'use strict';var BPromise=require(_0xa23b('0x0'));var util=require(_0xa23b('0x1'));var _=require('lodash');var squel=require(_0xa23b('0x2'));var Redis=require(_0xa23b('0x3'));var qs=require(_0xa23b('0x4'));var logger=require(_0xa23b('0x5'))(_0xa23b('0x6'));var config=require(_0xa23b('0x7'));var db=require(_0xa23b('0x8'))['db'];config[_0xa23b('0x9')]=_[_0xa23b('0xa')](config[_0xa23b('0x9')],{'host':_0xa23b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa23b('0x9')]));require(_0xa23b('0xc'))[_0xa23b('0xd')](socket);function respondWithStatusCode(_0x36f930,_0xbc228d){_0xbc228d=_0xbc228d||0xcc;return function(_0x11cf70){if(_0x11cf70){return _0x36f930[_0xa23b('0xe')](_0xbc228d);}return _0x36f930['status'](_0xbc228d)[_0xa23b('0xf')]();};}function respondWithResult(_0x30c054,_0x1a60fa){_0x1a60fa=_0x1a60fa||0xc8;return function(_0x231cae){if(_0x231cae){return _0x30c054[_0xa23b('0x10')](_0x1a60fa)['json'](_0x231cae);}};}function respondWithFilteredResult(_0x20cb8c,_0x2223eb){return function(_0x123dc1){if(_0x123dc1){var _0x455afa=typeof _0x2223eb[_0xa23b('0x11')]===_0xa23b('0x12')&&typeof _0x2223eb[_0xa23b('0x13')]===_0xa23b('0x12');var _0xf89910=_0x123dc1['count'];var _0x5cd9a6=_0x455afa?0x0:_0x2223eb[_0xa23b('0x11')];var _0x44ab3a=_0x455afa?_0x123dc1[_0xa23b('0x14')]:_0x2223eb['offset']+_0x2223eb[_0xa23b('0x13')];var _0x424c1e;if(_0x44ab3a>=_0xf89910){_0x44ab3a=_0xf89910;_0x424c1e=0xc8;}else{_0x424c1e=0xce;}_0x20cb8c[_0xa23b('0x10')](_0x424c1e);return _0x20cb8c[_0xa23b('0x15')](_0xa23b('0x16'),_0x5cd9a6+'-'+_0x44ab3a+'/'+_0xf89910)['json'](_0x123dc1);}return null;};}function saveUpdates(_0x188351){return function(_0x5241d4){if(_0x5241d4){return _0x5241d4[_0xa23b('0x17')](_0x188351)['then'](function(_0x46db96){return _0x46db96;});}return null;};}function removeEntity(_0x555295){return function(_0x178bab){if(_0x178bab){return _0x178bab[_0xa23b('0x18')]()[_0xa23b('0x19')](function(){var _0x3c545d=_0x178bab[_0xa23b('0x1a')]({'plain':!![]});var _0x31f446='OpenchannelQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x31f446,'resourceId':_0x3c545d['id']}})[_0xa23b('0x19')](function(){return _0x178bab;});})[_0xa23b('0x19')](function(){_0x555295[_0xa23b('0x10')](0xcc)[_0xa23b('0xf')]();});}};}function handleEntityNotFound(_0x48933e){return function(_0x4a5727){if(!_0x4a5727){_0x48933e[_0xa23b('0xe')](0x194);}return _0x4a5727;};}function handleError(_0x59c6b1,_0x4afa0a){_0x4afa0a=_0x4afa0a||0x1f4;return function(_0x10b5f8){logger[_0xa23b('0x1b')](_0x10b5f8[_0xa23b('0x1c')]);if(_0x10b5f8['name']){delete _0x10b5f8[_0xa23b('0x1d')];}_0x59c6b1['status'](_0x4afa0a)[_0xa23b('0x1e')](_0x10b5f8);};}exports[_0xa23b('0x1f')]=function(_0x5ae442,_0x15c327){var _0x5ee798={};var _0x343875={'count':0x0,'rows':[]};var _0x5c35eb=_[_0xa23b('0x20')](db['OpenchannelQueue'][_0xa23b('0x21')],function(_0x4a96ac){return{'name':_0x4a96ac[_0xa23b('0x22')],'type':_0x4a96ac['type'][_0xa23b('0x23')]};});_0x5ee798=qs[_0xa23b('0x24')](_0x5c35eb,_0x5ae442);var _0x185378={'where':_0x5ee798[_0xa23b('0x25')]};return db[_0xa23b('0x26')][_0xa23b('0x14')](_0x185378)[_0xa23b('0x19')](function(_0xdd6f06){_0x343875[_0xa23b('0x14')]=_0xdd6f06;_0x5ee798['include']=qs['include'](_0x5ae442[_0xa23b('0x27')]);return db[_0xa23b('0x26')][_0xa23b('0x28')](_0x5ee798);})[_0xa23b('0x19')](function(_0x412271){_0x343875[_0xa23b('0x29')]=_0x412271;return _0x343875;})['then'](respondWithFilteredResult(_0x15c327,_0x5ee798))['catch'](handleError(_0x15c327,null));};exports['show']=function(_0x2a7082,_0x3a6a15){var _0x4143e4={'raw':!![],'where':{'id':_0x2a7082[_0xa23b('0x2a')]['id']}},_0x29421f={};_0x29421f[_0xa23b('0x2b')]=_[_0xa23b('0x2c')](db[_0xa23b('0x26')][_0xa23b('0x21')]);_0x29421f[_0xa23b('0x27')]=_[_0xa23b('0x2c')](_0x2a7082[_0xa23b('0x27')]);_0x29421f[_0xa23b('0x2d')]=_[_0xa23b('0x2e')](_0x29421f[_0xa23b('0x2b')],_0x29421f['query']);_0x4143e4[_0xa23b('0x2f')]=_[_0xa23b('0x2e')](_0x29421f[_0xa23b('0x2b')],qs[_0xa23b('0x30')](_0x2a7082[_0xa23b('0x27')][_0xa23b('0x30')]));_0x4143e4['attributes']=_0x4143e4[_0xa23b('0x2f')][_0xa23b('0x31')]?_0x4143e4[_0xa23b('0x2f')]:_0x29421f[_0xa23b('0x2b')];if(_0x2a7082['query'][_0xa23b('0x32')]){_0x4143e4[_0xa23b('0x33')]=[{'all':!![]}];}_0x4143e4=_[_0xa23b('0x34')]({},_0x4143e4,_0x2a7082[_0xa23b('0x35')]);return db[_0xa23b('0x26')]['find'](_0x4143e4)[_0xa23b('0x19')](handleEntityNotFound(_0x3a6a15,null))[_0xa23b('0x19')](respondWithResult(_0x3a6a15,null))[_0xa23b('0x36')](handleError(_0x3a6a15,null));};exports['create']=function(_0x23ac71,_0x24f343){return db['OpenchannelQueue']['create'](_0x23ac71[_0xa23b('0x37')],{})['then'](function(_0x357ca1){var _0x23b37f=_0x23ac71[_0xa23b('0x38')]['get']({'plain':!![]});if(!_0x23b37f)throw new Error(_0xa23b('0x39'));if(_0x23b37f[_0xa23b('0x3a')]===_0xa23b('0x38')){var _0x55b1fa=_0x357ca1[_0xa23b('0x1a')]({'plain':!![]});var _0x21700a=_0xa23b('0x3b');return db[_0xa23b('0x3c')][_0xa23b('0x3d')]({'where':{'name':_0x21700a,'userProfileId':_0x23b37f[_0xa23b('0x3e')]},'raw':!![]})[_0xa23b('0x19')](function(_0x45e2fe){if(_0x45e2fe&&_0x45e2fe[_0xa23b('0x3f')]===0x0){return db[_0xa23b('0x40')][_0xa23b('0x41')]({'name':_0x55b1fa[_0xa23b('0x1d')],'resourceId':_0x55b1fa['id'],'type':_0x45e2fe[_0xa23b('0x1d')],'sectionId':_0x45e2fe['id']},{})[_0xa23b('0x19')](function(){return _0x357ca1;});}else{return _0x357ca1;}})['catch'](function(_0x136440){logger[_0xa23b('0x1b')](_0xa23b('0x42'),_0x136440);throw _0x136440;});}return _0x357ca1;})[_0xa23b('0x19')](respondWithResult(_0x24f343,0xc9))[_0xa23b('0x36')](handleError(_0x24f343,null));};exports[_0xa23b('0x17')]=function(_0x31fb48,_0x51d71e){if(_0x31fb48['body']['id']){delete _0x31fb48[_0xa23b('0x37')]['id'];}return db[_0xa23b('0x26')][_0xa23b('0x3d')]({'where':{'id':_0x31fb48[_0xa23b('0x2a')]['id']}})[_0xa23b('0x19')](handleEntityNotFound(_0x51d71e,null))['then'](saveUpdates(_0x31fb48[_0xa23b('0x37')],null))[_0xa23b('0x19')](respondWithResult(_0x51d71e,null))['catch'](handleError(_0x51d71e,null));};exports[_0xa23b('0x18')]=function(_0x406b6e,_0x458d06){return db[_0xa23b('0x26')][_0xa23b('0x3d')]({'where':{'id':_0x406b6e[_0xa23b('0x2a')]['id']}})[_0xa23b('0x19')](handleEntityNotFound(_0x458d06,null))[_0xa23b('0x19')](removeEntity(_0x458d06,null))[_0xa23b('0x36')](handleError(_0x458d06,null));};exports[_0xa23b('0x43')]=function(_0x18e41d,_0x25d061){return db[_0xa23b('0x26')]['describe']()[_0xa23b('0x19')](respondWithResult(_0x25d061,null))[_0xa23b('0x36')](handleError(_0x25d061,null));};exports[_0xa23b('0x44')]=function(_0x1e4333,_0x4258e1){var _0x4ba061={'raw':!![],'where':{}},_0x32dc08={},_0xfe00d0;return db[_0xa23b('0x26')]['findOne']({'where':{'id':_0x1e4333[_0xa23b('0x2a')]['id']}})[_0xa23b('0x19')](handleEntityNotFound(_0x4258e1,null))[_0xa23b('0x19')](function(_0x85c559){if(_0x85c559){_0xfe00d0=_0x85c559[_0xa23b('0x1a')]({'plain':!![]});_0x32dc08[_0xa23b('0x2b')]=_[_0xa23b('0x2c')](db[_0xa23b('0x45')][_0xa23b('0x21')]);_0x32dc08[_0xa23b('0x27')]=_[_0xa23b('0x2c')](_0x1e4333['query']);_0x32dc08[_0xa23b('0x2d')]=_['intersection'](_0x32dc08[_0xa23b('0x2b')],_0x32dc08[_0xa23b('0x27')]);_0x4ba061[_0xa23b('0x2f')]=_[_0xa23b('0x2e')](_0x32dc08[_0xa23b('0x2b')],qs[_0xa23b('0x30')](_0x1e4333[_0xa23b('0x27')][_0xa23b('0x30')]));_0x4ba061[_0xa23b('0x2f')]=_0x4ba061['attributes'][_0xa23b('0x31')]?_0x4ba061[_0xa23b('0x2f')]:_0x32dc08[_0xa23b('0x2b')];if(!_0x1e4333[_0xa23b('0x27')]['hasOwnProperty'](_0xa23b('0x46'))){_0x4ba061['limit']=qs[_0xa23b('0x13')](_0x1e4333[_0xa23b('0x27')][_0xa23b('0x13')]);_0x4ba061['offset']=qs[_0xa23b('0x11')](_0x1e4333['query'][_0xa23b('0x11')]);}_0x4ba061['order']=qs['sort'](_0x1e4333[_0xa23b('0x27')]['sort']);_0x4ba061[_0xa23b('0x25')]=qs['filters'](_['pick'](_0x1e4333[_0xa23b('0x27')],_0x32dc08[_0xa23b('0x2d')]));_0x4ba061[_0xa23b('0x25')]['OpenchannelQueueId']=_0x85c559['id'];if(_0x1e4333[_0xa23b('0x27')][_0xa23b('0x47')]){_0x4ba061['where']=_[_0xa23b('0x34')](_0x4ba061[_0xa23b('0x25')],{'$or':_['map'](_0x4ba061['attributes'],function(_0x171325){var _0x1e6577={};_0x1e6577[_0x171325]={'$like':'%'+_0x1e4333[_0xa23b('0x27')][_0xa23b('0x47')]+'%'};return _0x1e6577;})});}_0x4ba061=_[_0xa23b('0x34')]({},_0x4ba061,_0x1e4333[_0xa23b('0x35')]);return db[_0xa23b('0x45')][_0xa23b('0x28')](_0x4ba061);}})['then'](function(_0x456290){if(_0x456290){return db[_0xa23b('0x48')][_0xa23b('0x49')]({'where':{'id':_[_0xa23b('0x20')](_0x456290,'UserId'),'role':_0xa23b('0x4a')},'attributes':['id',_0xa23b('0x1d'),_0xa23b('0x4b'),'updatedAt',_0xa23b('0x4c')]});}})[_0xa23b('0x19')](function(_0x19dfd1){if(_0x19dfd1){return{'count':_0x19dfd1[_0xa23b('0x14')],'rows':_['map'](_0x19dfd1[_0xa23b('0x29')],function(_0x198b22){return{'membername':_0x198b22[_0xa23b('0x1d')],'UserId':_0x198b22['id'],'queue_name':_0xfe00d0[_0xa23b('0x1d')],'OpenchannelQueueId':_0xfe00d0['id'],'interface':util[_0xa23b('0x4d')](_0xa23b('0x4e'),_0xa23b('0x4f'),_0x198b22[_0xa23b('0x1d')]),'penalty':0x0,'paused':_0x198b22[_0xa23b('0x4b')],'createdAt':_0x198b22[_0xa23b('0x4c')],'updatedAt':_0x198b22[_0xa23b('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa23b('0x19')](respondWithFilteredResult(_0x4258e1,_0x4ba061))[_0xa23b('0x36')](handleError(_0x4258e1,null));};exports['getTeams']=function(_0x12f46f,_0x593bd0){var _0x56b5ec={};var _0x20fb66={};var _0x973762;var _0x2f37b5;return db[_0xa23b('0x26')][_0xa23b('0x51')]({'where':{'id':_0x12f46f['params']['id']}})[_0xa23b('0x19')](handleEntityNotFound(_0x593bd0,null))['then'](function(_0x36be7d){if(_0x36be7d){_0x973762=_0x36be7d;_0x20fb66[_0xa23b('0x2b')]=_['keys'](db[_0xa23b('0x52')][_0xa23b('0x21')]);_0x20fb66[_0xa23b('0x27')]=_[_0xa23b('0x2c')](_0x12f46f[_0xa23b('0x27')]);_0x20fb66[_0xa23b('0x2d')]=_[_0xa23b('0x2e')](_0x20fb66[_0xa23b('0x2b')],_0x20fb66['query']);_0x56b5ec[_0xa23b('0x2f')]=_[_0xa23b('0x2e')](_0x20fb66[_0xa23b('0x2b')],qs[_0xa23b('0x30')](_0x12f46f[_0xa23b('0x27')][_0xa23b('0x30')]));_0x56b5ec[_0xa23b('0x2f')]=_0x56b5ec[_0xa23b('0x2f')][_0xa23b('0x31')]?_0x56b5ec[_0xa23b('0x2f')]:_0x20fb66[_0xa23b('0x2b')];_0x56b5ec[_0xa23b('0x53')]=qs[_0xa23b('0x54')](_0x12f46f[_0xa23b('0x27')][_0xa23b('0x54')]);_0x56b5ec[_0xa23b('0x25')]=qs[_0xa23b('0x2d')](_['pick'](_0x12f46f[_0xa23b('0x27')],_0x20fb66[_0xa23b('0x2d')]));if(_0x12f46f[_0xa23b('0x27')][_0xa23b('0x47')]){_0x56b5ec['where']=_['merge'](_0x56b5ec[_0xa23b('0x25')],{'$or':_['map'](_0x56b5ec[_0xa23b('0x2f')],function(_0x108239){var _0x2f7cd5={};_0x2f7cd5[_0x108239]={'$like':'%'+_0x12f46f[_0xa23b('0x27')][_0xa23b('0x47')]+'%'};return _0x2f7cd5;})});}_0x56b5ec=_[_0xa23b('0x34')]({},_0x56b5ec,_0x12f46f[_0xa23b('0x35')]);return _0x973762[_0xa23b('0x55')](_0x56b5ec);}})[_0xa23b('0x19')](function(_0x36f31a){if(_0x36f31a){_0x2f37b5=_0x36f31a[_0xa23b('0x31')];if(!_0x12f46f[_0xa23b('0x27')][_0xa23b('0x56')]('nolimit')){_0x56b5ec[_0xa23b('0x13')]=qs['limit'](_0x12f46f[_0xa23b('0x27')][_0xa23b('0x13')]);_0x56b5ec['offset']=qs[_0xa23b('0x11')](_0x12f46f['query'][_0xa23b('0x11')]);}return _0x973762[_0xa23b('0x55')](_0x56b5ec);}})[_0xa23b('0x19')](function(_0x326487){if(_0x326487){return _0x326487?{'count':_0x2f37b5,'rows':_0x326487}:null;}})[_0xa23b('0x19')](respondWithResult(_0x593bd0,null))['catch'](handleError(_0x593bd0,null));};exports[_0xa23b('0x57')]=function(_0x43f802,_0x5dd08){var _0x3daab5=_0x43f802[_0xa23b('0x37')][_0xa23b('0x58')];return db[_0xa23b('0x52')]['findAll']({'where':{'id':_0x3daab5},'attributes':['id'],'include':[{'model':db[_0xa23b('0x48')],'as':'Agents','attributes':['id',_0xa23b('0x1d'),_0xa23b('0x59'),'voicePause','interface'],'raw':!![]}]})[_0xa23b('0x19')](function(_0x19764d){if(_0x19764d){var _0x4f55c6=_[_0xa23b('0x5a')](_0x19764d,function(_0x28f20c){var _0x19f364=_0x28f20c[_0xa23b('0x1a')]({'plain':!![]});return _0x19f364[_0xa23b('0x5b')];});return db[_0xa23b('0x26')][_0xa23b('0x3d')]({'where':{'id':_0x43f802['params']['id']}})[_0xa23b('0x19')](function(_0x53a679){return db['sequelize'][_0xa23b('0x5c')](function(_0x283b64){return _0x53a679[_0xa23b('0x57')](_0x3daab5,{'transaction':_0x283b64})[_0xa23b('0x19')](function(){return BPromise[_0xa23b('0x5d')](_0x4f55c6,function(_0x201e49){return db[_0xa23b('0x45')][_0xa23b('0x5e')]({'where':{'UserId':_0x201e49['id'],'OpenchannelQueueId':_0x43f802[_0xa23b('0x2a')]['id']},'transaction':_0x283b64});});})[_0xa23b('0x19')](function(){_0x4f55c6[_0xa23b('0x5f')](function(_0x22511a){socket[_0xa23b('0x60')](_0xa23b('0x61'),{'UserId':_0x22511a['id'],'OpenchannelQueueId':_0x53a679['id']});});});});});}})[_0xa23b('0x19')](respondWithStatusCode(_0x5dd08,null))[_0xa23b('0x36')](handleError(_0x5dd08,null));};exports[_0xa23b('0x62')]=function(_0x373dba,_0x21a208){return db[_0xa23b('0x52')][_0xa23b('0x28')]({'where':{'id':_0x373dba[_0xa23b('0x27')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa23b('0x48')],'as':_0xa23b('0x5b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x21a208,null))['then'](function(_0x16f4dc){var _0x25e89c=_[_0xa23b('0x20')](_0x16f4dc,'id');var _0x231ebc=[];var _0x1821b4=[];var _0x2e2be2=squel[_0xa23b('0x63')]();_0x2e2be2[_0xa23b('0x64')](_0xa23b('0x65'))[_0xa23b('0x66')](_0xa23b('0x67'),'tq')[_0xa23b('0x68')]('user_has_teams','ut',_0xa23b('0x69'))[_0xa23b('0x25')](_0xa23b('0x6a'),_0x373dba[_0xa23b('0x2a')]['id']);for(var _0x61da7f=0x0;_0x61da7f<_0x16f4dc[_0xa23b('0x31')];_0x61da7f+=0x1){let _0x1cf77e=_0x16f4dc[_0x61da7f];for(var _0x1d0071=0x0;_0x1d0071<_0x1cf77e[_0xa23b('0x5b')][_0xa23b('0x31')];_0x1d0071+=0x1){let _0x1c8d3c=_0x1cf77e[_0xa23b('0x5b')][_0x1d0071];var _0x17fa80=_0x2e2be2[_0xa23b('0x6b')]();_0x17fa80[_0xa23b('0x25')]('ut.UserId\x20=\x20?',_0x1c8d3c['id']);_0x1821b4['push'](db[_0xa23b('0x6c')][_0xa23b('0x27')](_0x17fa80[_0xa23b('0x6d')](),{'type':db[_0xa23b('0x6c')][_0xa23b('0x6e')][_0xa23b('0x6f')]})[_0xa23b('0x19')](function(_0x72e1d7){if(_0x72e1d7['length']===0x1){return _0x1c8d3c['id'];}else{var _0x2f286e=_[_0xa23b('0x70')](_[_0xa23b('0x20')](_0x72e1d7,_0xa23b('0x71')),function(_0x3c7fc7){return _[_0xa23b('0x72')](_0x25e89c,_0x3c7fc7);});if(_0x2f286e){return _0x1c8d3c['id'];}}}));}}return BPromise[_0xa23b('0x73')](_0x1821b4)[_0xa23b('0x19')](function(_0xe61644){_0x231ebc=_(_0x231ebc)[_0xa23b('0x74')](_0xe61644)[_0xa23b('0x75')]()[_0xa23b('0x76')]();return db[_0xa23b('0x26')][_0xa23b('0x3d')]({'where':{'id':_0x373dba[_0xa23b('0x2a')]['id']}})[_0xa23b('0x19')](function(_0x32db01){return db[_0xa23b('0x6c')][_0xa23b('0x5c')](function(_0x570e6a){return _0x32db01[_0xa23b('0x62')](_0x373dba[_0xa23b('0x27')][_0xa23b('0x58')],{'transaction':_0x570e6a})[_0xa23b('0x19')](function(){if(!_[_0xa23b('0x77')](_0x231ebc)){return _0x32db01['removeAgents'](_0x231ebc,{'transaction':_0x570e6a});}})[_0xa23b('0x19')](function(){_0x231ebc['forEach'](function(_0x48a671){socket[_0xa23b('0x60')]('userOpenchannelQueue:remove',{'UserId':_0x48a671,'OpenchannelQueueId':_0x32db01['id']});});});});});});})[_0xa23b('0x19')](respondWithStatusCode(_0x21a208,null))[_0xa23b('0x36')](handleError(_0x21a208,null));};exports[_0xa23b('0x78')]=function(_0x8947d7,_0x5affb3){return db['OpenchannelQueue'][_0xa23b('0x3d')]({'where':{'id':_0x8947d7[_0xa23b('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5affb3,null))[_0xa23b('0x19')](function(_0x17f7e7){if(_0x17f7e7){return _0x17f7e7[_0xa23b('0x78')](_0x8947d7[_0xa23b('0x37')][_0xa23b('0x58')],_[_0xa23b('0x79')](_0x8947d7[_0xa23b('0x37')],['ids','id'])||{})['spread'](function(_0x4faf21){for(var _0x4b4ec2=0x0;_0x4b4ec2<_0x8947d7[_0xa23b('0x37')][_0xa23b('0x58')][_0xa23b('0x31')];_0x4b4ec2+=0x1){socket[_0xa23b('0x60')](_0xa23b('0x61'),{'UserId':Number(_0x8947d7[_0xa23b('0x37')][_0xa23b('0x58')][_0x4b4ec2]),'OpenchannelQueueId':Number(_0x8947d7[_0xa23b('0x2a')]['id'])});}return _0x4faf21;});}})[_0xa23b('0x19')](respondWithResult(_0x5affb3,null))[_0xa23b('0x36')](handleError(_0x5affb3,null));};exports[_0xa23b('0x7a')]=function(_0xd3512b,_0x65676c){return db[_0xa23b('0x26')][_0xa23b('0x3d')]({'where':{'id':_0xd3512b['params']['id']}})[_0xa23b('0x19')](handleEntityNotFound(_0x65676c,null))[_0xa23b('0x19')](function(_0x3f8231){if(_0x3f8231){return _0x3f8231[_0xa23b('0x7a')](_0xd3512b[_0xa23b('0x27')][_0xa23b('0x58')])[_0xa23b('0x19')](function(){if(_[_0xa23b('0x7b')](_0xd3512b[_0xa23b('0x27')]['ids'])){for(var _0x575c6c=0x0;_0x575c6c<_0xd3512b[_0xa23b('0x27')][_0xa23b('0x58')][_0xa23b('0x31')];_0x575c6c+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0xd3512b['query'][_0xa23b('0x58')][_0x575c6c]),'OpenchannelQueueId':Number(_0xd3512b[_0xa23b('0x2a')]['id'])});}}else{socket[_0xa23b('0x60')]('userOpenchannelQueue:remove',{'UserId':Number(_0xd3512b[_0xa23b('0x27')][_0xa23b('0x58')]),'OpenchannelQueueId':Number(_0xd3512b[_0xa23b('0x2a')]['id'])});}});}})[_0xa23b('0x19')](respondWithStatusCode(_0x65676c,null))[_0xa23b('0x36')](handleError(_0x65676c,null));};exports['getAgents']=function(_0x36be0c,_0x5b966d){var _0xc2edfd={};var _0x3071f7={};var _0x1c3da2;var _0x12ada9;return db[_0xa23b('0x26')][_0xa23b('0x51')]({'where':{'id':_0x36be0c[_0xa23b('0x2a')]['id']}})[_0xa23b('0x19')](handleEntityNotFound(_0x5b966d,null))[_0xa23b('0x19')](function(_0x306e0f){if(_0x306e0f){_0x1c3da2=_0x306e0f;_0x3071f7[_0xa23b('0x2b')]=_['keys'](db[_0xa23b('0x48')][_0xa23b('0x21')]);_0x3071f7[_0xa23b('0x27')]=_[_0xa23b('0x2c')](_0x36be0c['query']);_0x3071f7['filters']=_[_0xa23b('0x2e')](_0x3071f7[_0xa23b('0x2b')],_0x3071f7[_0xa23b('0x27')]);_0xc2edfd['attributes']=_['intersection'](_0x3071f7[_0xa23b('0x2b')],qs[_0xa23b('0x30')](_0x36be0c[_0xa23b('0x27')]['fields']));_0xc2edfd[_0xa23b('0x2f')]=_0xc2edfd[_0xa23b('0x2f')][_0xa23b('0x31')]?_0xc2edfd[_0xa23b('0x2f')]:_0x3071f7[_0xa23b('0x2b')];_0xc2edfd[_0xa23b('0x53')]=qs[_0xa23b('0x54')](_0x36be0c[_0xa23b('0x27')][_0xa23b('0x54')]);_0xc2edfd[_0xa23b('0x25')]=qs['filters'](_['pick'](_0x36be0c[_0xa23b('0x27')],_0x3071f7[_0xa23b('0x2d')]));if(_0x36be0c[_0xa23b('0x27')][_0xa23b('0x47')]){_0xc2edfd[_0xa23b('0x25')]=_['merge'](_0xc2edfd[_0xa23b('0x25')],{'$or':_[_0xa23b('0x20')](_0xc2edfd[_0xa23b('0x2f')],function(_0x1b83f3){var _0x429bcd={};_0x429bcd[_0x1b83f3]={'$like':'%'+_0x36be0c[_0xa23b('0x27')][_0xa23b('0x47')]+'%'};return _0x429bcd;})});}_0xc2edfd=_[_0xa23b('0x34')]({},_0xc2edfd,_0x36be0c[_0xa23b('0x35')]);return _0x1c3da2[_0xa23b('0x7c')](_0xc2edfd);}})[_0xa23b('0x19')](function(_0x381f16){if(_0x381f16){_0x12ada9=_0x381f16[_0xa23b('0x31')];if(!_0x36be0c['query']['hasOwnProperty'](_0xa23b('0x46'))){_0xc2edfd[_0xa23b('0x13')]=qs['limit'](_0x36be0c['query'][_0xa23b('0x13')]);_0xc2edfd[_0xa23b('0x11')]=qs[_0xa23b('0x11')](_0x36be0c[_0xa23b('0x27')]['offset']);}return _0x1c3da2[_0xa23b('0x7c')](_0xc2edfd);}})[_0xa23b('0x19')](function(_0x2c756c){if(_0x2c756c){return _0x2c756c?{'count':_0x12ada9,'rows':_0x2c756c}:null;}})[_0xa23b('0x19')](respondWithResult(_0x5b966d,null))['catch'](handleError(_0x5b966d,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 9eb17de..d0193ac 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 _0x822f=['OpenchannelQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x822f,0x152));var _0xf822=function(_0x3c73d2,_0x4a9046){_0x3c73d2=_0x3c73d2-0x0;var _0x193c1d=_0x822f[_0x3c73d2];return _0x193c1d;};'use strict';var EventEmitter=require(_0xf822('0x0'));var OpenchannelQueue=require(_0xf822('0x1'))['db'][_0xf822('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xf822('0x3')](0x0);var events={'afterCreate':_0xf822('0x4'),'afterUpdate':_0xf822('0x5'),'afterDestroy':'remove'};function emitEvent(_0x973728){return function(_0x285090,_0x194479,_0x17258d){OpenchannelQueueEvents[_0xf822('0x6')](_0x973728+':'+_0x285090['id'],_0x285090);OpenchannelQueueEvents[_0xf822('0x6')](_0x973728,_0x285090);_0x17258d(null);};}for(var e in events){if(events[_0xf822('0x7')](e)){var event=events[e];OpenchannelQueue[_0xf822('0x8')](e,emitEvent(event));}}module[_0xf822('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xa74d=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x11ba32,_0x5a7ba6){var _0x296558=function(_0x53d575){while(--_0x53d575){_0x11ba32['push'](_0x11ba32['shift']());}};_0x296558(++_0x5a7ba6);}(_0xa74d,0x154));var _0xda74=function(_0x46d355,_0x1db95f){_0x46d355=_0x46d355-0x0;var _0x37b75f=_0xa74d[_0x46d355];return _0x37b75f;};'use strict';var EventEmitter=require(_0xda74('0x0'));var OpenchannelQueue=require(_0xda74('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xda74('0x2')](0x0);var events={'afterCreate':_0xda74('0x3'),'afterUpdate':_0xda74('0x4'),'afterDestroy':_0xda74('0x5')};function emitEvent(_0x395c6d){return function(_0x6b5778,_0x5c8a67,_0xcf795c){OpenchannelQueueEvents[_0xda74('0x6')](_0x395c6d+':'+_0x6b5778['id'],_0x6b5778);OpenchannelQueueEvents['emit'](_0x395c6d,_0x6b5778);_0xcf795c(null);};}for(var e in events){if(events[_0xda74('0x7')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xda74('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 5c47226..beaa6a6 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 _0x9081=['./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x13626e,_0x1c647b){var _0x2357c8=function(_0x2b3016){while(--_0x2b3016){_0x13626e['push'](_0x13626e['shift']());}};_0x2357c8(++_0x1c647b);}(_0x9081,0xad));var _0x1908=function(_0x4cd5b5,_0x42967b){_0x4cd5b5=_0x4cd5b5-0x0;var _0x1fb2e9=_0x9081[_0x4cd5b5];return _0x1fb2e9;};'use strict';var _=require(_0x1908('0x0'));var util=require(_0x1908('0x1'));var logger=require(_0x1908('0x2'))(_0x1908('0x3'));var moment=require(_0x1908('0x4'));var BPromise=require('bluebird');var rp=require(_0x1908('0x5'));var fs=require('fs');var path=require(_0x1908('0x6'));var rimraf=require(_0x1908('0x7'));var config=require(_0x1908('0x8'));var attributes=require(_0x1908('0x9'));module[_0x1908('0xa')]=function(_0x3ca041,_0x27a679){return _0x3ca041[_0x1908('0xb')](_0x1908('0xc'),attributes,{'tableName':_0x1908('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad7d=['util','../../config/logger','api','bluebird','path','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash'];(function(_0xcb483f,_0x4afa66){var _0x138ca3=function(_0x55c9bb){while(--_0x55c9bb){_0xcb483f['push'](_0xcb483f['shift']());}};_0x138ca3(++_0x4afa66);}(_0xad7d,0x154));var _0xdad7=function(_0x17633a,_0x5ebbbd){_0x17633a=_0x17633a-0x0;var _0xa3c776=_0xad7d[_0x17633a];return _0xa3c776;};'use strict';var _=require(_0xdad7('0x0'));var util=require(_0xdad7('0x1'));var logger=require(_0xdad7('0x2'))(_0xdad7('0x3'));var moment=require('moment');var BPromise=require(_0xdad7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdad7('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdad7('0x6'));module[_0xdad7('0x7')]=function(_0x14a445,_0xc1a7b6){return _0x14a445[_0xdad7('0x8')](_0xdad7('0x9'),attributes,{'tableName':_0xdad7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 692412c..88c0a32 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 _0x6915=['GetOpenchannelQueue','stringify','ShowOpenchannelQueue','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','OpenchannelQueue','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x49bf59,_0x10b975){var _0x4ee9e5=function(_0x59db31){while(--_0x59db31){_0x49bf59['push'](_0x49bf59['shift']());}};_0x4ee9e5(++_0x10b975);}(_0x6915,0xfa));var _0x5691=function(_0xa4cd0,_0x33eb3c){_0xa4cd0=_0xa4cd0-0x0;var _0x3b00d7=_0x6915[_0xa4cd0];return _0x3b00d7;};'use strict';var _=require(_0x5691('0x0'));var util=require('util');var moment=require(_0x5691('0x1'));var BPromise=require(_0x5691('0x2'));var rs=require(_0x5691('0x3'));var fs=require('fs');var Redis=require(_0x5691('0x4'));var db=require(_0x5691('0x5'))['db'];var utils=require(_0x5691('0x6'));var logger=require(_0x5691('0x7'))(_0x5691('0x8'));var config=require(_0x5691('0x9'));var jayson=require(_0x5691('0xa'));var client=jayson['client'][_0x5691('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5691('0xc')],{'host':_0x5691('0xd'),'port':0x18eb});var socket=require(_0x5691('0xe'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x5691('0xf')](socket);function respondWithRpcPromise(_0x2c2fd1,_0x12e466,_0x2b125c){return new BPromise(function(_0x414975,_0x20aab7){return client[_0x5691('0x10')](_0x2c2fd1,_0x2b125c)[_0x5691('0x11')](function(_0x3e8b46){logger[_0x5691('0x12')](_0x5691('0x13'),_0x12e466,_0x5691('0x14'));logger[_0x5691('0x15')](_0x5691('0x16'),_0x12e466,_0x5691('0x14'),JSON['stringify'](_0x3e8b46));if(_0x3e8b46['error']){if(_0x3e8b46['error'][_0x5691('0x17')]===0x1f4){logger['error'](_0x5691('0x13'),_0x12e466,_0x3e8b46['error']['message']);return _0x20aab7(_0x3e8b46[_0x5691('0x18')][_0x5691('0x19')]);}logger[_0x5691('0x18')](_0x5691('0x13'),_0x12e466,_0x3e8b46[_0x5691('0x18')][_0x5691('0x19')]);return _0x414975(_0x3e8b46[_0x5691('0x18')]['message']);}else{logger[_0x5691('0x12')](_0x5691('0x13'),_0x12e466,'request\x20sent');_0x414975(_0x3e8b46[_0x5691('0x1a')][_0x5691('0x19')]);}})[_0x5691('0x1b')](function(_0x891e1d){logger[_0x5691('0x18')](_0x5691('0x13'),_0x12e466,_0x891e1d);_0x20aab7(_0x891e1d);});});}exports['GetOpenchannelQueue']=function(_0x35304d){var _0x542b7a=this;return new Promise(function(_0x2c3104,_0x549c22){return db[_0x5691('0x1c')][_0x5691('0x1d')]({'raw':_0x35304d[_0x5691('0x1e')]?_0x35304d[_0x5691('0x1e')][_0x5691('0x1f')]===undefined?!![]:![]:!![],'where':_0x35304d[_0x5691('0x1e')]?_0x35304d[_0x5691('0x1e')]['where']||null:null,'attributes':_0x35304d[_0x5691('0x1e')]?_0x35304d['options'][_0x5691('0x20')]||null:null,'limit':_0x35304d['options']?_0x35304d[_0x5691('0x1e')][_0x5691('0x21')]||null:null,'include':_0x35304d['options']?_0x35304d['options'][_0x5691('0x22')]?_[_0x5691('0x23')](_0x35304d[_0x5691('0x1e')][_0x5691('0x22')],function(_0x54136f){return{'model':db[_0x54136f[_0x5691('0x24')]],'as':_0x54136f['as'],'attributes':_0x54136f['attributes'],'include':_0x54136f[_0x5691('0x22')]?_[_0x5691('0x23')](_0x54136f[_0x5691('0x22')],function(_0x1d1abb){return{'model':db[_0x1d1abb[_0x5691('0x24')]],'as':_0x1d1abb['as'],'attributes':_0x1d1abb['attributes'],'include':_0x1d1abb[_0x5691('0x22')]?_['map'](_0x1d1abb[_0x5691('0x22')],function(_0xaa674){return{'model':db[_0xaa674[_0x5691('0x24')]],'as':_0xaa674['as'],'attributes':_0xaa674[_0x5691('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5691('0x11')](function(_0xf5abe4){logger[_0x5691('0x12')](_0x5691('0x25'),_0x35304d);logger[_0x5691('0x15')](_0x5691('0x25'),_0x35304d,JSON[_0x5691('0x26')](_0xf5abe4));_0x2c3104(_0xf5abe4);})[_0x5691('0x1b')](function(_0x2b7fd4){logger[_0x5691('0x18')](_0x5691('0x25'),_0x2b7fd4[_0x5691('0x19')],_0x35304d);_0x549c22(_0x542b7a['error'](0x1f4,_0x2b7fd4[_0x5691('0x19')]));});});};exports[_0x5691('0x27')]=function(_0x59104f){var _0x139df9=this;return new Promise(function(_0x2dd14f,_0x20ea9a){return db['OpenchannelQueue']['find']({'raw':_0x59104f[_0x5691('0x1e')]?_0x59104f[_0x5691('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x59104f[_0x5691('0x1e')]?_0x59104f['options'][_0x5691('0x28')]||null:null,'attributes':_0x59104f[_0x5691('0x1e')]?_0x59104f['options'][_0x5691('0x20')]||null:null,'include':_0x59104f[_0x5691('0x1e')]?_0x59104f['options'][_0x5691('0x22')]?_['map'](_0x59104f[_0x5691('0x1e')][_0x5691('0x22')],function(_0x4c232a){return{'model':db[_0x4c232a[_0x5691('0x24')]],'as':_0x4c232a['as'],'attributes':_0x4c232a[_0x5691('0x20')],'include':_0x4c232a[_0x5691('0x22')]?_[_0x5691('0x23')](_0x4c232a[_0x5691('0x22')],function(_0x4b2271){return{'model':db[_0x4b2271[_0x5691('0x24')]],'as':_0x4b2271['as'],'attributes':_0x4b2271[_0x5691('0x20')],'include':_0x4b2271[_0x5691('0x22')]?_['map'](_0x4b2271[_0x5691('0x22')],function(_0x341cbd){return{'model':db[_0x341cbd[_0x5691('0x24')]],'as':_0x341cbd['as'],'attributes':_0x341cbd[_0x5691('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5691('0x11')](function(_0x3fbf0d){logger[_0x5691('0x12')]('ShowOpenchannelQueue',_0x59104f);logger[_0x5691('0x15')](_0x5691('0x27'),_0x59104f,JSON['stringify'](_0x3fbf0d));_0x2dd14f(_0x3fbf0d);})['catch'](function(_0x3a0c44){logger['error']('ShowOpenchannelQueue',_0x3a0c44[_0x5691('0x19')],_0x59104f);_0x20ea9a(_0x139df9[_0x5691('0x18')](0x1f4,_0x3a0c44['message']));});});}; \ No newline at end of file +var _0xfad9=['result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','model','attributes','include','ShowOpenchannelQueue','find','where','map','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueue,\x20%s,\x20%s','message'];(function(_0x4c1222,_0x3362f3){var _0x5e9a17=function(_0x23ba79){while(--_0x23ba79){_0x4c1222['push'](_0x4c1222['shift']());}};_0x5e9a17(++_0x3362f3);}(_0xfad9,0xd6));var _0x9fad=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0xfad9[_0x1780f8];return _0x33a410;};'use strict';var _=require('lodash');var util=require(_0x9fad('0x0'));var moment=require(_0x9fad('0x1'));var BPromise=require(_0x9fad('0x2'));var rs=require(_0x9fad('0x3'));var fs=require('fs');var Redis=require(_0x9fad('0x4'));var db=require(_0x9fad('0x5'))['db'];var utils=require(_0x9fad('0x6'));var logger=require(_0x9fad('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9fad('0x8'));var client=jayson[_0x9fad('0x9')][_0x9fad('0xa')]({'port':0x232a});config['redis']=_[_0x9fad('0xb')](config[_0x9fad('0xc')],{'host':_0x9fad('0xd'),'port':0x18eb});var socket=require(_0x9fad('0xe'))(new Redis(config[_0x9fad('0xc')]));require(_0x9fad('0xf'))['register'](socket);function respondWithRpcPromise(_0xf13c0c,_0x3308a7,_0x352a4b){return new BPromise(function(_0x5cd50f,_0x1b777a){return client[_0x9fad('0x10')](_0xf13c0c,_0x352a4b)[_0x9fad('0x11')](function(_0x51489e){logger[_0x9fad('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x3308a7,_0x9fad('0x13'));logger[_0x9fad('0x14')](_0x9fad('0x15'),_0x3308a7,'request\x20sent',JSON[_0x9fad('0x16')](_0x51489e));if(_0x51489e[_0x9fad('0x17')]){if(_0x51489e['error']['code']===0x1f4){logger['error'](_0x9fad('0x18'),_0x3308a7,_0x51489e[_0x9fad('0x17')]['message']);return _0x1b777a(_0x51489e[_0x9fad('0x17')][_0x9fad('0x19')]);}logger['error'](_0x9fad('0x18'),_0x3308a7,_0x51489e[_0x9fad('0x17')][_0x9fad('0x19')]);return _0x5cd50f(_0x51489e['error'][_0x9fad('0x19')]);}else{logger[_0x9fad('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x3308a7,'request\x20sent');_0x5cd50f(_0x51489e[_0x9fad('0x1a')][_0x9fad('0x19')]);}})[_0x9fad('0x1b')](function(_0x50d8a8){logger[_0x9fad('0x17')](_0x9fad('0x18'),_0x3308a7,_0x50d8a8);_0x1b777a(_0x50d8a8);});});}exports[_0x9fad('0x1c')]=function(_0x3b7075){var _0x489dc1=this;return new Promise(function(_0xf707b3,_0x3c7f1d){return db[_0x9fad('0x1d')][_0x9fad('0x1e')]({'raw':_0x3b7075[_0x9fad('0x1f')]?_0x3b7075['options'][_0x9fad('0x20')]===undefined?!![]:![]:!![],'where':_0x3b7075['options']?_0x3b7075[_0x9fad('0x1f')]['where']||null:null,'attributes':_0x3b7075['options']?_0x3b7075[_0x9fad('0x1f')]['attributes']||null:null,'limit':_0x3b7075['options']?_0x3b7075[_0x9fad('0x1f')]['limit']||null:null,'include':_0x3b7075[_0x9fad('0x1f')]?_0x3b7075[_0x9fad('0x1f')]['include']?_['map'](_0x3b7075['options']['include'],function(_0x555a58){return{'model':db[_0x555a58[_0x9fad('0x21')]],'as':_0x555a58['as'],'attributes':_0x555a58[_0x9fad('0x22')],'include':_0x555a58[_0x9fad('0x23')]?_['map'](_0x555a58['include'],function(_0x14620a){return{'model':db[_0x14620a[_0x9fad('0x21')]],'as':_0x14620a['as'],'attributes':_0x14620a[_0x9fad('0x22')],'include':_0x14620a[_0x9fad('0x23')]?_['map'](_0x14620a[_0x9fad('0x23')],function(_0x42ebf1){return{'model':db[_0x42ebf1['model']],'as':_0x42ebf1['as'],'attributes':_0x42ebf1[_0x9fad('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9fad('0x11')](function(_0x54b231){logger[_0x9fad('0x12')]('GetOpenchannelQueue',_0x3b7075);logger[_0x9fad('0x14')](_0x9fad('0x1c'),_0x3b7075,JSON[_0x9fad('0x16')](_0x54b231));_0xf707b3(_0x54b231);})[_0x9fad('0x1b')](function(_0x3bf378){logger['error'](_0x9fad('0x1c'),_0x3bf378['message'],_0x3b7075);_0x3c7f1d(_0x489dc1['error'](0x1f4,_0x3bf378[_0x9fad('0x19')]));});});};exports[_0x9fad('0x24')]=function(_0x1db9fd){var _0x3132a6=this;return new Promise(function(_0x98cf3d,_0x354f37){return db[_0x9fad('0x1d')][_0x9fad('0x25')]({'raw':_0x1db9fd[_0x9fad('0x1f')]?_0x1db9fd[_0x9fad('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x1db9fd[_0x9fad('0x1f')]?_0x1db9fd[_0x9fad('0x1f')][_0x9fad('0x26')]||null:null,'attributes':_0x1db9fd[_0x9fad('0x1f')]?_0x1db9fd[_0x9fad('0x1f')][_0x9fad('0x22')]||null:null,'include':_0x1db9fd[_0x9fad('0x1f')]?_0x1db9fd[_0x9fad('0x1f')]['include']?_[_0x9fad('0x27')](_0x1db9fd[_0x9fad('0x1f')][_0x9fad('0x23')],function(_0x2ee974){return{'model':db[_0x2ee974['model']],'as':_0x2ee974['as'],'attributes':_0x2ee974[_0x9fad('0x22')],'include':_0x2ee974['include']?_[_0x9fad('0x27')](_0x2ee974['include'],function(_0x41d68c){return{'model':db[_0x41d68c[_0x9fad('0x21')]],'as':_0x41d68c['as'],'attributes':_0x41d68c[_0x9fad('0x22')],'include':_0x41d68c[_0x9fad('0x23')]?_[_0x9fad('0x27')](_0x41d68c[_0x9fad('0x23')],function(_0x410f97){return{'model':db[_0x410f97['model']],'as':_0x410f97['as'],'attributes':_0x410f97[_0x9fad('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9fad('0x11')](function(_0x3058d9){logger[_0x9fad('0x12')](_0x9fad('0x24'),_0x1db9fd);logger[_0x9fad('0x14')](_0x9fad('0x24'),_0x1db9fd,JSON['stringify'](_0x3058d9));_0x98cf3d(_0x3058d9);})[_0x9fad('0x1b')](function(_0x1526c2){logger['error'](_0x9fad('0x24'),_0x1526c2['message'],_0x1db9fd);_0x354f37(_0x3132a6[_0x9fad('0x17')](0x1f4,_0x1526c2[_0x9fad('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 0664cb3..248bbde 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 _0xe235=['emit','register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update'];(function(_0x5079c3,_0x37179c){var _0x49c93f=function(_0x316a66){while(--_0x316a66){_0x5079c3['push'](_0x5079c3['shift']());}};_0x49c93f(++_0x37179c);}(_0xe235,0xe4));var _0x5e23=function(_0x487d0a,_0x1b7cb4){_0x487d0a=_0x487d0a-0x0;var _0x3d740c=_0xe235[_0x487d0a];return _0x3d740c;};'use strict';var OpenchannelQueueEvents=require(_0x5e23('0x0'));var events=[_0x5e23('0x1'),_0x5e23('0x2'),_0x5e23('0x3')];function createListener(_0x49fc1b,_0x57e9e8){return function(_0x31faa4){_0x57e9e8[_0x5e23('0x4')](_0x49fc1b,_0x31faa4);};}function removeListener(_0x14eee2,_0x5ba17a){return function(){OpenchannelQueueEvents['removeListener'](_0x14eee2,_0x5ba17a);};}exports[_0x5e23('0x5')]=function(_0x37c8a7){for(var _0x1b49b2=0x0,_0x1c9b2b=events[_0x5e23('0x6')];_0x1b49b2<_0x1c9b2b;_0x1b49b2++){var _0xd7f262=events[_0x1b49b2];var _0x1f0008=createListener(_0x5e23('0x7')+_0xd7f262,_0x37c8a7);OpenchannelQueueEvents['on'](_0xd7f262,_0x1f0008);}}; \ No newline at end of file +var _0x3865=['save','remove','update','emit','register','openchannelQueue:','./openchannelQueue.events'];(function(_0x3fa3b6,_0x57804d){var _0x2e1825=function(_0x308f9c){while(--_0x308f9c){_0x3fa3b6['push'](_0x3fa3b6['shift']());}};_0x2e1825(++_0x57804d);}(_0x3865,0x13a));var _0x5386=function(_0x4f4c77,_0x11f842){_0x4f4c77=_0x4f4c77-0x0;var _0x555cb3=_0x3865[_0x4f4c77];return _0x555cb3;};'use strict';var OpenchannelQueueEvents=require(_0x5386('0x0'));var events=[_0x5386('0x1'),_0x5386('0x2'),_0x5386('0x3')];function createListener(_0xc23910,_0x285b0a){return function(_0x13108d){_0x285b0a[_0x5386('0x4')](_0xc23910,_0x13108d);};}function removeListener(_0xd4c1eb,_0x59e83c){return function(){OpenchannelQueueEvents['removeListener'](_0xd4c1eb,_0x59e83c);};}exports[_0x5386('0x5')]=function(_0xf1a138){for(var _0x51babe=0x0,_0x939c81=events['length'];_0x51babe<_0x939c81;_0x51babe++){var _0x2b4d2b=events[_0x51babe];var _0x2f9ae8=createListener(_0x5386('0x6')+_0x2b4d2b,_0xf1a138);OpenchannelQueueEvents['on'](_0x2b4d2b,_0x2f9ae8);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index fbbfb8a..16f5f4d 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 _0x5701=['./openchannelQueueReport.controller','index','get','/describe','isAuthenticated','show','post','create','/:id','update','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x7aedef,_0x3aadd8){var _0x34ea60=function(_0x5773c9){while(--_0x5773c9){_0x7aedef['push'](_0x7aedef['shift']());}};_0x34ea60(++_0x3aadd8);}(_0x5701,0x1a2));var _0x1570=function(_0x362a6f,_0x4660eb){_0x362a6f=_0x362a6f-0x0;var _0x9274fd=_0x5701[_0x362a6f];return _0x9274fd;};'use strict';var multer=require('multer');var util=require(_0x1570('0x0'));var path=require(_0x1570('0x1'));var timeout=require(_0x1570('0x2'));var express=require(_0x1570('0x3'));var router=express[_0x1570('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1570('0x5'));var interaction=require(_0x1570('0x6'));var config=require('../../config/environment');var controller=require(_0x1570('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1570('0x8')]);router[_0x1570('0x9')](_0x1570('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x1570('0x9')]('/:id',auth[_0x1570('0xb')](),controller[_0x1570('0xc')]);router[_0x1570('0xd')]('/',auth[_0x1570('0xb')](),controller[_0x1570('0xe')]);router['put'](_0x1570('0xf'),auth['isAuthenticated'](),controller[_0x1570('0x10')]);router['delete'](_0x1570('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfb33=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','get','describe','/:id','show','post','create','update','delete','destroy'];(function(_0x111327,_0x1e340b){var _0x5eca7a=function(_0x546550){while(--_0x546550){_0x111327['push'](_0x111327['shift']());}};_0x5eca7a(++_0x1e340b);}(_0xfb33,0x90));var _0x3fb3=function(_0x48e1ec,_0x35f468){_0x48e1ec=_0x48e1ec-0x0;var _0x3b33eb=_0xfb33[_0x48e1ec];return _0x3b33eb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3fb3('0x0'));var timeout=require(_0x3fb3('0x1'));var express=require(_0x3fb3('0x2'));var router=express[_0x3fb3('0x3')]();var fs_extra=require(_0x3fb3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3fb3('0x5'));var config=require(_0x3fb3('0x6'));var controller=require(_0x3fb3('0x7'));router['get']('/',auth[_0x3fb3('0x8')](),controller['index']);router[_0x3fb3('0x9')]('/describe',auth[_0x3fb3('0x8')](),controller[_0x3fb3('0xa')]);router['get'](_0x3fb3('0xb'),auth['isAuthenticated'](),controller[_0x3fb3('0xc')]);router[_0x3fb3('0xd')]('/',auth['isAuthenticated'](),controller[_0x3fb3('0xe')]);router['put'](_0x3fb3('0xb'),auth['isAuthenticated'](),controller[_0x3fb3('0xf')]);router[_0x3fb3('0x10')](_0x3fb3('0xb'),auth[_0x3fb3('0x8')](),controller[_0x3fb3('0x11')]);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 f15bda4..5cc70e1 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 _0xfe5b=['STRING','DATE','moment','sequelize'];(function(_0x20a47a,_0x3e4132){var _0x5e8d75=function(_0x5c1df6){while(--_0x5c1df6){_0x20a47a['push'](_0x20a47a['shift']());}};_0x5e8d75(++_0x3e4132);}(_0xfe5b,0x16a));var _0xbfe5=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0xfe5b[_0x4bb66f];return _0xf2772f;};'use strict';var moment=require(_0xbfe5('0x0'));var Sequelize=require(_0xbfe5('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xbfe5('0x2')]},'joinAt':{'type':Sequelize[_0xbfe5('0x3')]},'leaveAt':{'type':Sequelize[_0xbfe5('0x3')]},'acceptAt':{'type':Sequelize[_0xbfe5('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6fc3=['sequelize','exports','STRING','DATE','moment'];(function(_0x329cd9,_0x351296){var _0x4ebe34=function(_0x586c9d){while(--_0x586c9d){_0x329cd9['push'](_0x329cd9['shift']());}};_0x4ebe34(++_0x351296);}(_0x6fc3,0x117));var _0x36fc=function(_0x11b42e,_0x21fe54){_0x11b42e=_0x11b42e-0x0;var _0x3c8641=_0x6fc3[_0x11b42e];return _0x3c8641;};'use strict';var moment=require(_0x36fc('0x0'));var Sequelize=require(_0x36fc('0x1'));module[_0x36fc('0x2')]={'uniqueid':{'type':Sequelize[_0x36fc('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x36fc('0x3')]},'joinAt':{'type':Sequelize[_0x36fc('0x4')]},'leaveAt':{'type':Sequelize[_0x36fc('0x4')]},'acceptAt':{'type':Sequelize[_0x36fc('0x4')]},'exitAt':{'type':Sequelize[_0x36fc('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 292bdaa..8178520 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 _0x55fb=['options','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','rawAttributes','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','show'];(function(_0x1969e2,_0x3c8157){var _0x269bd0=function(_0x54c39f){while(--_0x54c39f){_0x1969e2['push'](_0x1969e2['shift']());}};_0x269bd0(++_0x3c8157);}(_0x55fb,0x139));var _0xb55f=function(_0x3e2f3a,_0x327781){_0x3e2f3a=_0x3e2f3a-0x0;var _0x24fb46=_0x55fb[_0x3e2f3a];return _0x24fb46;};'use strict';var emlformat=require(_0xb55f('0x0'));var rimraf=require(_0xb55f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb55f('0x2'));var rp=require(_0xb55f('0x3'));var moment=require(_0xb55f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb55f('0x5'));var util=require(_0xb55f('0x6'));var path=require(_0xb55f('0x7'));var sox=require(_0xb55f('0x8'));var csv=require(_0xb55f('0x9'));var ejs=require(_0xb55f('0xa'));var fs=require('fs');var fs_extra=require(_0xb55f('0xb'));var _=require(_0xb55f('0xc'));var squel=require(_0xb55f('0xd'));var crypto=require(_0xb55f('0xe'));var jsforce=require(_0xb55f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb55f('0x9'));var querystring=require('querystring');var Papa=require(_0xb55f('0x10'));var Redis=require(_0xb55f('0x11'));var authService=require(_0xb55f('0x12'));var qs=require(_0xb55f('0x13'));var as=require(_0xb55f('0x14'));var hardwareService=require(_0xb55f('0x15'));var logger=require(_0xb55f('0x16'))(_0xb55f('0x17'));var utils=require(_0xb55f('0x18'));var config=require(_0xb55f('0x19'));var licenseUtil=require(_0xb55f('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42d479,_0x3ae226){_0x3ae226=_0x3ae226||0xcc;return function(_0x3d7863){if(_0x3d7863){return _0x42d479[_0xb55f('0x1b')](_0x3ae226);}return _0x42d479[_0xb55f('0x1c')](_0x3ae226)[_0xb55f('0x1d')]();};}function respondWithResult(_0x5d5478,_0x30223f){_0x30223f=_0x30223f||0xc8;return function(_0x2b7b7c){if(_0x2b7b7c){return _0x5d5478['status'](_0x30223f)['json'](_0x2b7b7c);}};}function respondWithFilteredResult(_0x39c74e,_0x4ab698){return function(_0x58ab7a){if(_0x58ab7a){var _0x1075a2=typeof _0x4ab698[_0xb55f('0x1e')]===_0xb55f('0x1f')&&typeof _0x4ab698['limit']===_0xb55f('0x1f');var _0x53fb16=_0x58ab7a[_0xb55f('0x20')];var _0x5ce225=_0x1075a2?0x0:_0x4ab698[_0xb55f('0x1e')];var _0x3f6636=_0x1075a2?_0x58ab7a[_0xb55f('0x20')]:_0x4ab698[_0xb55f('0x1e')]+_0x4ab698[_0xb55f('0x21')];var _0x3fa6f1;if(_0x3f6636>=_0x53fb16){_0x3f6636=_0x53fb16;_0x3fa6f1=0xc8;}else{_0x3fa6f1=0xce;}_0x39c74e[_0xb55f('0x1c')](_0x3fa6f1);return _0x39c74e[_0xb55f('0x22')](_0xb55f('0x23'),_0x5ce225+'-'+_0x3f6636+'/'+_0x53fb16)[_0xb55f('0x24')](_0x58ab7a);}return null;};}function patchUpdates(_0x1cd4b6){return function(_0x2a2479){try{jsonpatch[_0xb55f('0x25')](_0x2a2479,_0x1cd4b6,!![]);}catch(_0x53b3ff){return BPromise[_0xb55f('0x26')](_0x53b3ff);}return _0x2a2479[_0xb55f('0x27')]();};}function saveUpdates(_0xc94c75,_0x27ad9a){return function(_0x3cb6ec){if(_0x3cb6ec){return _0x3cb6ec[_0xb55f('0x28')](_0xc94c75)['then'](function(_0x3ed214){return _0x3ed214;});}return null;};}function removeEntity(_0x30b4d0,_0x2e2358){return function(_0xa7ff51){if(_0xa7ff51){return _0xa7ff51['destroy']()[_0xb55f('0x29')](function(){_0x30b4d0['status'](0xcc)[_0xb55f('0x1d')]();});}};}function handleEntityNotFound(_0x3150cd,_0x45330e){return function(_0x13f0c8){if(!_0x13f0c8){_0x3150cd[_0xb55f('0x1b')](0x194);}return _0x13f0c8;};}function handleError(_0x428971,_0x458ddd){_0x458ddd=_0x458ddd||0x1f4;return function(_0x39291c){logger[_0xb55f('0x2a')](_0x39291c[_0xb55f('0x2b')]);if(_0x39291c[_0xb55f('0x2c')]){delete _0x39291c[_0xb55f('0x2c')];}_0x428971[_0xb55f('0x1c')](_0x458ddd)[_0xb55f('0x2d')](_0x39291c);};}exports['index']=function(_0x44e2df,_0x18f3c5){var _0x2b8b2b={},_0x3ca477={},_0x785930={'count':0x0,'rows':[]};var _0x146ec7=_['map'](db['OpenchannelQueueReport'][_0xb55f('0x2e')],function(_0x2eb3a0){return{'name':_0x2eb3a0['fieldName'],'type':_0x2eb3a0['type']['key']};});_0x3ca477['model']=_[_0xb55f('0x2f')](_0x146ec7,'name');_0x3ca477[_0xb55f('0x30')]=_[_0xb55f('0x31')](_0x44e2df[_0xb55f('0x30')]);_0x3ca477['filters']=_[_0xb55f('0x32')](_0x3ca477[_0xb55f('0x33')],_0x3ca477['query']);_0x2b8b2b['attributes']=_['intersection'](_0x3ca477[_0xb55f('0x33')],qs[_0xb55f('0x34')](_0x44e2df[_0xb55f('0x30')]['fields']));_0x2b8b2b[_0xb55f('0x35')]=_0x2b8b2b[_0xb55f('0x35')][_0xb55f('0x36')]?_0x2b8b2b['attributes']:_0x3ca477[_0xb55f('0x33')];if(!_0x44e2df[_0xb55f('0x30')][_0xb55f('0x37')](_0xb55f('0x38'))){_0x2b8b2b[_0xb55f('0x21')]=qs[_0xb55f('0x21')](_0x44e2df[_0xb55f('0x30')][_0xb55f('0x21')]);_0x2b8b2b[_0xb55f('0x1e')]=qs[_0xb55f('0x1e')](_0x44e2df[_0xb55f('0x30')][_0xb55f('0x1e')]);}_0x2b8b2b[_0xb55f('0x39')]=qs[_0xb55f('0x3a')](_0x44e2df[_0xb55f('0x30')][_0xb55f('0x3a')]);_0x2b8b2b['where']=qs[_0xb55f('0x3b')](_[_0xb55f('0x3c')](_0x44e2df[_0xb55f('0x30')],_0x3ca477[_0xb55f('0x3b')]),_0x146ec7);if(_0x44e2df[_0xb55f('0x30')][_0xb55f('0x3d')]){_0x2b8b2b[_0xb55f('0x3e')]=_[_0xb55f('0x3f')](_0x2b8b2b[_0xb55f('0x3e')],{'$or':_[_0xb55f('0x2f')](_0x146ec7,function(_0x408cf3){if(_0x408cf3['type']!==_0xb55f('0x40')){var _0x4e5ccc={};_0x4e5ccc[_0x408cf3[_0xb55f('0x2c')]]={'$like':'%'+_0x44e2df[_0xb55f('0x30')][_0xb55f('0x3d')]+'%'};return _0x4e5ccc;}})});}_0x2b8b2b=_[_0xb55f('0x3f')]({},_0x2b8b2b,_0x44e2df['options']);var _0x541316={'where':_0x2b8b2b[_0xb55f('0x3e')]};return db[_0xb55f('0x41')][_0xb55f('0x20')](_0x541316)[_0xb55f('0x29')](function(_0xf8d0){_0x785930[_0xb55f('0x20')]=_0xf8d0;if(_0x44e2df[_0xb55f('0x30')][_0xb55f('0x42')]){_0x2b8b2b[_0xb55f('0x43')]=[{'all':!![]}];}return db[_0xb55f('0x41')][_0xb55f('0x44')](_0x2b8b2b);})['then'](function(_0x42818e){_0x785930[_0xb55f('0x45')]=_0x42818e;return _0x785930;})[_0xb55f('0x29')](respondWithFilteredResult(_0x18f3c5,_0x2b8b2b))[_0xb55f('0x46')](handleError(_0x18f3c5,null));};exports[_0xb55f('0x47')]=function(_0x3d229a,_0x31fa11){var _0x4faad2={'raw':!![],'where':{'id':_0x3d229a['params']['id']}},_0x8f9800={};_0x8f9800[_0xb55f('0x33')]=_[_0xb55f('0x31')](db[_0xb55f('0x41')][_0xb55f('0x2e')]);_0x8f9800[_0xb55f('0x30')]=_[_0xb55f('0x31')](_0x3d229a[_0xb55f('0x30')]);_0x8f9800[_0xb55f('0x3b')]=_[_0xb55f('0x32')](_0x8f9800['model'],_0x8f9800['query']);_0x4faad2[_0xb55f('0x35')]=_[_0xb55f('0x32')](_0x8f9800[_0xb55f('0x33')],qs[_0xb55f('0x34')](_0x3d229a[_0xb55f('0x30')][_0xb55f('0x34')]));_0x4faad2['attributes']=_0x4faad2[_0xb55f('0x35')][_0xb55f('0x36')]?_0x4faad2[_0xb55f('0x35')]:_0x8f9800['model'];if(_0x3d229a[_0xb55f('0x30')][_0xb55f('0x42')]){_0x4faad2[_0xb55f('0x43')]=[{'all':!![]}];}_0x4faad2=_[_0xb55f('0x3f')]({},_0x4faad2,_0x3d229a[_0xb55f('0x48')]);return db['OpenchannelQueueReport'][_0xb55f('0x49')](_0x4faad2)['then'](handleEntityNotFound(_0x31fa11,null))[_0xb55f('0x29')](respondWithResult(_0x31fa11,null))[_0xb55f('0x46')](handleError(_0x31fa11,null));};exports[_0xb55f('0x4a')]=function(_0x12fbd7,_0x2e98da){return db[_0xb55f('0x41')][_0xb55f('0x4a')](_0x12fbd7[_0xb55f('0x4b')],{})[_0xb55f('0x29')](respondWithResult(_0x2e98da,0xc9))[_0xb55f('0x46')](handleError(_0x2e98da,null));};exports['update']=function(_0x2dc19d,_0x3befb8){if(_0x2dc19d['body']['id']){delete _0x2dc19d[_0xb55f('0x4b')]['id'];}return db[_0xb55f('0x41')][_0xb55f('0x49')]({'where':{'id':_0x2dc19d[_0xb55f('0x4c')]['id']}})[_0xb55f('0x29')](handleEntityNotFound(_0x3befb8,null))[_0xb55f('0x29')](saveUpdates(_0x2dc19d[_0xb55f('0x4b')],null))[_0xb55f('0x29')](respondWithResult(_0x3befb8,null))[_0xb55f('0x46')](handleError(_0x3befb8,null));};exports['destroy']=function(_0x139f97,_0x15a4a9){return db[_0xb55f('0x41')]['find']({'where':{'id':_0x139f97[_0xb55f('0x4c')]['id']}})[_0xb55f('0x29')](handleEntityNotFound(_0x15a4a9,null))[_0xb55f('0x29')](removeEntity(_0x15a4a9,null))[_0xb55f('0x46')](handleError(_0x15a4a9,null));};exports['describe']=function(_0x17f900,_0x481f41){return db[_0xb55f('0x41')]['describe']()[_0xb55f('0x29')](respondWithResult(_0x481f41,null))[_0xb55f('0x46')](handleError(_0x481f41,null));}; \ No newline at end of file +var _0x039e=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x283d4f,_0x27fd9b){var _0x3085cf=function(_0x1efdf6){while(--_0x1efdf6){_0x283d4f['push'](_0x283d4f['shift']());}};_0x3085cf(++_0x27fd9b);}(_0x039e,0xe2));var _0xe039=function(_0x2ac16c,_0xf6b95e){_0x2ac16c=_0x2ac16c-0x0;var _0x29507a=_0x039e[_0x2ac16c];return _0x29507a;};'use strict';var emlformat=require(_0xe039('0x0'));var rimraf=require(_0xe039('0x1'));var zipdir=require(_0xe039('0x2'));var jsonpatch=require(_0xe039('0x3'));var rp=require(_0xe039('0x4'));var moment=require('moment');var BPromise=require(_0xe039('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe039('0x6'));var sox=require(_0xe039('0x7'));var csv=require(_0xe039('0x8'));var ejs=require(_0xe039('0x9'));var fs=require('fs');var fs_extra=require(_0xe039('0xa'));var _=require('lodash');var squel=require(_0xe039('0xb'));var crypto=require(_0xe039('0xc'));var jsforce=require(_0xe039('0xd'));var deskjs=require(_0xe039('0xe'));var toCsv=require(_0xe039('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe039('0xf'));var authService=require(_0xe039('0x10'));var qs=require(_0xe039('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe039('0x12'));var logger=require(_0xe039('0x13'))(_0xe039('0x14'));var utils=require(_0xe039('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe039('0x16'));var db=require(_0xe039('0x17'))['db'];function respondWithStatusCode(_0x2d0804,_0x2ce8dd){_0x2ce8dd=_0x2ce8dd||0xcc;return function(_0x1f47ee){if(_0x1f47ee){return _0x2d0804['sendStatus'](_0x2ce8dd);}return _0x2d0804['status'](_0x2ce8dd)[_0xe039('0x18')]();};}function respondWithResult(_0x3c8da9,_0x2c7edb){_0x2c7edb=_0x2c7edb||0xc8;return function(_0x6c835){if(_0x6c835){return _0x3c8da9[_0xe039('0x19')](_0x2c7edb)[_0xe039('0x1a')](_0x6c835);}};}function respondWithFilteredResult(_0x489650,_0x3b786c){return function(_0x23b3cc){if(_0x23b3cc){var _0x43fdf2=typeof _0x3b786c[_0xe039('0x1b')]===_0xe039('0x1c')&&typeof _0x3b786c[_0xe039('0x1d')]==='undefined';var _0x41771e=_0x23b3cc[_0xe039('0x1e')];var _0x204160=_0x43fdf2?0x0:_0x3b786c[_0xe039('0x1b')];var _0x20536a=_0x43fdf2?_0x23b3cc[_0xe039('0x1e')]:_0x3b786c[_0xe039('0x1b')]+_0x3b786c[_0xe039('0x1d')];var _0x2f0b7a;if(_0x20536a>=_0x41771e){_0x20536a=_0x41771e;_0x2f0b7a=0xc8;}else{_0x2f0b7a=0xce;}_0x489650['status'](_0x2f0b7a);return _0x489650[_0xe039('0x1f')]('Content-Range',_0x204160+'-'+_0x20536a+'/'+_0x41771e)[_0xe039('0x1a')](_0x23b3cc);}return null;};}function patchUpdates(_0x26a496){return function(_0x4918cd){try{jsonpatch[_0xe039('0x20')](_0x4918cd,_0x26a496,!![]);}catch(_0x2e931c){return BPromise['reject'](_0x2e931c);}return _0x4918cd['save']();};}function saveUpdates(_0x4d0f11,_0x4a33ed){return function(_0x425d8a){if(_0x425d8a){return _0x425d8a[_0xe039('0x21')](_0x4d0f11)[_0xe039('0x22')](function(_0x1384da){return _0x1384da;});}return null;};}function removeEntity(_0x1f8041,_0x5803b1){return function(_0x3f27c4){if(_0x3f27c4){return _0x3f27c4[_0xe039('0x23')]()[_0xe039('0x22')](function(){_0x1f8041[_0xe039('0x19')](0xcc)[_0xe039('0x18')]();});}};}function handleEntityNotFound(_0x57c0b2,_0x55b5f2){return function(_0x53953e){if(!_0x53953e){_0x57c0b2[_0xe039('0x24')](0x194);}return _0x53953e;};}function handleError(_0x40634a,_0x151d4f){_0x151d4f=_0x151d4f||0x1f4;return function(_0x4d455f){logger['error'](_0x4d455f[_0xe039('0x25')]);if(_0x4d455f['name']){delete _0x4d455f[_0xe039('0x26')];}_0x40634a[_0xe039('0x19')](_0x151d4f)[_0xe039('0x27')](_0x4d455f);};}exports[_0xe039('0x28')]=function(_0x11d689,_0x36b604){var _0x126135={},_0x489490={},_0x40df64={'count':0x0,'rows':[]};var _0x9787b2=_[_0xe039('0x29')](db['OpenchannelQueueReport'][_0xe039('0x2a')],function(_0x22f094){return{'name':_0x22f094[_0xe039('0x2b')],'type':_0x22f094[_0xe039('0x2c')][_0xe039('0x2d')]};});_0x489490[_0xe039('0x2e')]=_[_0xe039('0x29')](_0x9787b2,_0xe039('0x26'));_0x489490[_0xe039('0x2f')]=_[_0xe039('0x30')](_0x11d689[_0xe039('0x2f')]);_0x489490['filters']=_[_0xe039('0x31')](_0x489490[_0xe039('0x2e')],_0x489490[_0xe039('0x2f')]);_0x126135['attributes']=_[_0xe039('0x31')](_0x489490[_0xe039('0x2e')],qs[_0xe039('0x32')](_0x11d689[_0xe039('0x2f')][_0xe039('0x32')]));_0x126135[_0xe039('0x33')]=_0x126135[_0xe039('0x33')][_0xe039('0x34')]?_0x126135[_0xe039('0x33')]:_0x489490[_0xe039('0x2e')];if(!_0x11d689[_0xe039('0x2f')][_0xe039('0x35')](_0xe039('0x36'))){_0x126135[_0xe039('0x1d')]=qs['limit'](_0x11d689[_0xe039('0x2f')]['limit']);_0x126135[_0xe039('0x1b')]=qs[_0xe039('0x1b')](_0x11d689['query'][_0xe039('0x1b')]);}_0x126135['order']=qs[_0xe039('0x37')](_0x11d689[_0xe039('0x2f')][_0xe039('0x37')]);_0x126135[_0xe039('0x38')]=qs[_0xe039('0x39')](_[_0xe039('0x3a')](_0x11d689[_0xe039('0x2f')],_0x489490[_0xe039('0x39')]),_0x9787b2);if(_0x11d689[_0xe039('0x2f')]['filter']){_0x126135[_0xe039('0x38')]=_[_0xe039('0x3b')](_0x126135['where'],{'$or':_[_0xe039('0x29')](_0x9787b2,function(_0x571515){if(_0x571515[_0xe039('0x2c')]!==_0xe039('0x3c')){var _0x24479d={};_0x24479d[_0x571515[_0xe039('0x26')]]={'$like':'%'+_0x11d689[_0xe039('0x2f')][_0xe039('0x3d')]+'%'};return _0x24479d;}})});}_0x126135=_[_0xe039('0x3b')]({},_0x126135,_0x11d689[_0xe039('0x3e')]);var _0x28f6a0={'where':_0x126135[_0xe039('0x38')]};return db[_0xe039('0x3f')][_0xe039('0x1e')](_0x28f6a0)[_0xe039('0x22')](function(_0x5e3839){_0x40df64[_0xe039('0x1e')]=_0x5e3839;if(_0x11d689['query'][_0xe039('0x40')]){_0x126135[_0xe039('0x41')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xe039('0x42')](_0x126135);})['then'](function(_0x22d9a4){_0x40df64[_0xe039('0x43')]=_0x22d9a4;return _0x40df64;})[_0xe039('0x22')](respondWithFilteredResult(_0x36b604,_0x126135))[_0xe039('0x44')](handleError(_0x36b604,null));};exports[_0xe039('0x45')]=function(_0xc18719,_0x5d7ec4){var _0x95a32c={'raw':!![],'where':{'id':_0xc18719[_0xe039('0x46')]['id']}},_0x1e44a2={};_0x1e44a2[_0xe039('0x2e')]=_[_0xe039('0x30')](db['OpenchannelQueueReport'][_0xe039('0x2a')]);_0x1e44a2['query']=_['keys'](_0xc18719[_0xe039('0x2f')]);_0x1e44a2[_0xe039('0x39')]=_[_0xe039('0x31')](_0x1e44a2[_0xe039('0x2e')],_0x1e44a2[_0xe039('0x2f')]);_0x95a32c[_0xe039('0x33')]=_[_0xe039('0x31')](_0x1e44a2[_0xe039('0x2e')],qs['fields'](_0xc18719[_0xe039('0x2f')][_0xe039('0x32')]));_0x95a32c['attributes']=_0x95a32c[_0xe039('0x33')][_0xe039('0x34')]?_0x95a32c[_0xe039('0x33')]:_0x1e44a2[_0xe039('0x2e')];if(_0xc18719[_0xe039('0x2f')][_0xe039('0x40')]){_0x95a32c[_0xe039('0x41')]=[{'all':!![]}];}_0x95a32c=_[_0xe039('0x3b')]({},_0x95a32c,_0xc18719[_0xe039('0x3e')]);return db[_0xe039('0x3f')][_0xe039('0x47')](_0x95a32c)[_0xe039('0x22')](handleEntityNotFound(_0x5d7ec4,null))[_0xe039('0x22')](respondWithResult(_0x5d7ec4,null))[_0xe039('0x44')](handleError(_0x5d7ec4,null));};exports['create']=function(_0x70da08,_0x1127b7){return db[_0xe039('0x3f')][_0xe039('0x48')](_0x70da08['body'],{})[_0xe039('0x22')](respondWithResult(_0x1127b7,0xc9))[_0xe039('0x44')](handleError(_0x1127b7,null));};exports[_0xe039('0x21')]=function(_0x177f27,_0x34533d){if(_0x177f27[_0xe039('0x49')]['id']){delete _0x177f27[_0xe039('0x49')]['id'];}return db['OpenchannelQueueReport'][_0xe039('0x47')]({'where':{'id':_0x177f27[_0xe039('0x46')]['id']}})[_0xe039('0x22')](handleEntityNotFound(_0x34533d,null))[_0xe039('0x22')](saveUpdates(_0x177f27[_0xe039('0x49')],null))[_0xe039('0x22')](respondWithResult(_0x34533d,null))[_0xe039('0x44')](handleError(_0x34533d,null));};exports['destroy']=function(_0x450f8d,_0xc7dd4){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x450f8d[_0xe039('0x46')]['id']}})[_0xe039('0x22')](handleEntityNotFound(_0xc7dd4,null))[_0xe039('0x22')](removeEntity(_0xc7dd4,null))[_0xe039('0x44')](handleError(_0xc7dd4,null));};exports['describe']=function(_0x866aa,_0x4e1534){return db[_0xe039('0x3f')][_0xe039('0x4a')]()[_0xe039('0x22')](respondWithResult(_0x4e1534,null))[_0xe039('0x44')](handleError(_0x4e1534,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 71c765e..e56537e 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x320d63,_0x26763f){var _0x3c3b5f=function(_0x2b81e9){while(--_0x2b81e9){_0x320d63['push'](_0x320d63['shift']());}};_0x3c3b5f(++_0x26763f);}(_0x1261,0x144));var _0x1126=function(_0xd6a568,_0x4d39e9){_0xd6a568=_0xd6a568-0x0;var _0x56e5ab=_0x1261[_0xd6a568];return _0x56e5ab;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x4ef248,_0xe582f2){var _0x81599e=function(_0x94981){while(--_0x94981){_0x4ef248['push'](_0x4ef248['shift']());}};_0x81599e(++_0xe582f2);}(_0x326f,0xd1));var _0xf326=function(_0x2059cb,_0x19e1c8){_0x2059cb=_0x2059cb-0x0;var _0x8b914c=_0x326f[_0x2059cb];return _0x8b914c;};'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':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 79af351..6b52d42 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 _0xb8a0=['update','where','attributes','limit','moment','bluebird','ioredis','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport'];(function(_0x11bda6,_0x22bfdb){var _0x3c06c3=function(_0x26dc09){while(--_0x26dc09){_0x11bda6['push'](_0x11bda6['shift']());}};_0x3c06c3(++_0x22bfdb);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0x225639,_0x8348e2){_0x225639=_0x225639-0x0;var _0x118346=_0xb8a0[_0x225639];return _0x118346;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0b8a('0x0'));var BPromise=require(_0x0b8a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b8a('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0b8a('0x3'));var jayson=require(_0x0b8a('0x4'));var client=jayson[_0x0b8a('0x5')][_0x0b8a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3527dd,_0x4039c2,_0x33a5bd){return new BPromise(function(_0x463015,_0x29ebdc){return client[_0x0b8a('0x7')](_0x3527dd,_0x33a5bd)[_0x0b8a('0x8')](function(_0x478492){logger[_0x0b8a('0x9')](_0x0b8a('0xa'),_0x4039c2,_0x0b8a('0xb'));logger[_0x0b8a('0xc')](_0x0b8a('0xd'),_0x4039c2,_0x0b8a('0xb'),JSON[_0x0b8a('0xe')](_0x478492));if(_0x478492[_0x0b8a('0xf')]){if(_0x478492[_0x0b8a('0xf')][_0x0b8a('0x10')]===0x1f4){logger['error'](_0x0b8a('0xa'),_0x4039c2,_0x478492[_0x0b8a('0xf')][_0x0b8a('0x11')]);return _0x29ebdc(_0x478492[_0x0b8a('0xf')][_0x0b8a('0x11')]);}logger[_0x0b8a('0xf')](_0x0b8a('0xa'),_0x4039c2,_0x478492[_0x0b8a('0xf')][_0x0b8a('0x11')]);return _0x463015(_0x478492['error'][_0x0b8a('0x11')]);}else{logger[_0x0b8a('0x9')](_0x0b8a('0xa'),_0x4039c2,'request\x20sent');_0x463015(_0x478492[_0x0b8a('0x12')][_0x0b8a('0x11')]);}})[_0x0b8a('0x13')](function(_0x5a2623){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x4039c2,_0x5a2623);_0x29ebdc(_0x5a2623);});});}exports[_0x0b8a('0x14')]=function(_0x51d28e){var _0x1a1d6b=this;return new Promise(function(_0x3c80c3,_0x12428e){return db[_0x0b8a('0x15')][_0x0b8a('0x16')](_0x51d28e[_0x0b8a('0x17')],{'raw':_0x51d28e[_0x0b8a('0x18')]?_0x51d28e[_0x0b8a('0x18')][_0x0b8a('0x19')]===undefined?!![]:![]:!![]})[_0x0b8a('0x8')](function(_0x313612){logger['info'](_0x0b8a('0x14'),_0x51d28e);logger[_0x0b8a('0xc')]('CreateOpenchannelQueueReport',_0x51d28e,JSON[_0x0b8a('0xe')](_0x313612));_0x3c80c3(_0x313612);})[_0x0b8a('0x13')](function(_0xba351e){logger[_0x0b8a('0xf')]('CreateOpenchannelQueueReport',_0xba351e[_0x0b8a('0x11')],_0x51d28e);_0x12428e(_0x1a1d6b['error'](0x1f4,_0xba351e[_0x0b8a('0x11')]));});});};exports[_0x0b8a('0x1a')]=function(_0x5afa76){var _0x3f8caf=this;return new Promise(function(_0xd3c097,_0x346390){return db['OpenchannelQueueReport'][_0x0b8a('0x1b')](_0x5afa76[_0x0b8a('0x17')],{'raw':_0x5afa76[_0x0b8a('0x18')]?_0x5afa76['options'][_0x0b8a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5afa76['options']?_0x5afa76[_0x0b8a('0x18')][_0x0b8a('0x1c')]||null:null,'attributes':_0x5afa76[_0x0b8a('0x18')]?_0x5afa76[_0x0b8a('0x18')][_0x0b8a('0x1d')]||null:null,'limit':_0x5afa76[_0x0b8a('0x18')]?_0x5afa76[_0x0b8a('0x18')][_0x0b8a('0x1e')]||null:null})[_0x0b8a('0x8')](function(_0xc94471){logger[_0x0b8a('0x9')](_0x0b8a('0x1a'),_0x5afa76);logger['debug'](_0x0b8a('0x1a'),_0x5afa76,JSON[_0x0b8a('0xe')](_0xc94471));_0xd3c097(_0xc94471);})[_0x0b8a('0x13')](function(_0x22ef59){logger[_0x0b8a('0xf')]('UpdateOpenchannelQueueReport',_0x22ef59[_0x0b8a('0x11')],_0x5afa76);_0x346390(_0x3f8caf[_0x0b8a('0xf')](0x1f4,_0x22ef59['message']));});});}; \ No newline at end of file +var _0xdd6e=['UpdateOpenchannelQueueReport','update','where','attributes','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','then'];(function(_0x33c06c,_0x37c957){var _0x49e3f3=function(_0x383d79){while(--_0x383d79){_0x33c06c['push'](_0x33c06c['shift']());}};_0x49e3f3(++_0x37c957);}(_0xdd6e,0xa5));var _0xedd6=function(_0x499042,_0xc8ef6d){_0x499042=_0x499042-0x0;var _0x3cc561=_0xdd6e[_0x499042];return _0x3cc561;};'use strict';var _=require(_0xedd6('0x0'));var util=require(_0xedd6('0x1'));var moment=require(_0xedd6('0x2'));var BPromise=require(_0xedd6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xedd6('0x4'));var db=require(_0xedd6('0x5'))['db'];var utils=require(_0xedd6('0x6'));var logger=require(_0xedd6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xedd6('0x8')][_0xedd6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5300a5,_0x135950,_0x30d933){return new BPromise(function(_0x15f317,_0x29743a){return client[_0xedd6('0xa')](_0x5300a5,_0x30d933)['then'](function(_0x4c282c){logger[_0xedd6('0xb')](_0xedd6('0xc'),_0x135950,'request\x20sent');logger[_0xedd6('0xd')](_0xedd6('0xe'),_0x135950,_0xedd6('0xf'),JSON[_0xedd6('0x10')](_0x4c282c));if(_0x4c282c['error']){if(_0x4c282c[_0xedd6('0x11')]['code']===0x1f4){logger[_0xedd6('0x11')](_0xedd6('0xc'),_0x135950,_0x4c282c[_0xedd6('0x11')][_0xedd6('0x12')]);return _0x29743a(_0x4c282c['error'][_0xedd6('0x12')]);}logger[_0xedd6('0x11')](_0xedd6('0xc'),_0x135950,_0x4c282c[_0xedd6('0x11')][_0xedd6('0x12')]);return _0x15f317(_0x4c282c[_0xedd6('0x11')][_0xedd6('0x12')]);}else{logger[_0xedd6('0xb')](_0xedd6('0xc'),_0x135950,_0xedd6('0xf'));_0x15f317(_0x4c282c[_0xedd6('0x13')][_0xedd6('0x12')]);}})['catch'](function(_0x278c18){logger[_0xedd6('0x11')](_0xedd6('0xc'),_0x135950,_0x278c18);_0x29743a(_0x278c18);});});}exports[_0xedd6('0x14')]=function(_0x4c0411){var _0x57f7d9=this;return new Promise(function(_0x129e82,_0x48e054){return db[_0xedd6('0x15')][_0xedd6('0x16')](_0x4c0411[_0xedd6('0x17')],{'raw':_0x4c0411[_0xedd6('0x18')]?_0x4c0411[_0xedd6('0x18')][_0xedd6('0x19')]===undefined?!![]:![]:!![]})[_0xedd6('0x1a')](function(_0x3440c4){logger['info'](_0xedd6('0x14'),_0x4c0411);logger[_0xedd6('0xd')]('CreateOpenchannelQueueReport',_0x4c0411,JSON[_0xedd6('0x10')](_0x3440c4));_0x129e82(_0x3440c4);})['catch'](function(_0x22073a){logger[_0xedd6('0x11')](_0xedd6('0x14'),_0x22073a['message'],_0x4c0411);_0x48e054(_0x57f7d9[_0xedd6('0x11')](0x1f4,_0x22073a[_0xedd6('0x12')]));});});};exports[_0xedd6('0x1b')]=function(_0x3f86ab){var _0x59b3b1=this;return new Promise(function(_0x200b78,_0x248c39){return db[_0xedd6('0x15')][_0xedd6('0x1c')](_0x3f86ab['body'],{'raw':_0x3f86ab['options']?_0x3f86ab['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f86ab[_0xedd6('0x18')]?_0x3f86ab[_0xedd6('0x18')][_0xedd6('0x1d')]||null:null,'attributes':_0x3f86ab[_0xedd6('0x18')]?_0x3f86ab[_0xedd6('0x18')][_0xedd6('0x1e')]||null:null,'limit':_0x3f86ab[_0xedd6('0x18')]?_0x3f86ab[_0xedd6('0x18')]['limit']||null:null})[_0xedd6('0x1a')](function(_0x25e146){logger['info'](_0xedd6('0x1b'),_0x3f86ab);logger[_0xedd6('0xd')](_0xedd6('0x1b'),_0x3f86ab,JSON[_0xedd6('0x10')](_0x25e146));_0x200b78(_0x25e146);})[_0xedd6('0x1f')](function(_0x2f7afa){logger[_0xedd6('0x11')](_0xedd6('0x1b'),_0x2f7afa[_0xedd6('0x12')],_0x3f86ab);_0x248c39(_0x59b3b1[_0xedd6('0x11')](0x1f4,_0x2f7afa[_0xedd6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 25dfaaa..ff0c1b8 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 _0xfb9c=['describe','show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated'];(function(_0x2a17ab,_0xcd62bb){var _0x25c918=function(_0x26ebec){while(--_0x26ebec){_0x2a17ab['push'](_0x2a17ab['shift']());}};_0x25c918(++_0xcd62bb);}(_0xfb9c,0x6e));var _0xcfb9=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0xfb9c[_0x2abc3d];return _0x252745;};'use strict';var multer=require('multer');var util=require(_0xcfb9('0x0'));var path=require(_0xcfb9('0x1'));var timeout=require(_0xcfb9('0x2'));var express=require('express');var router=express[_0xcfb9('0x3')]();var fs_extra=require(_0xcfb9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcfb9('0x5'));var config=require(_0xcfb9('0x6'));var controller=require(_0xcfb9('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xcfb9('0x8')]('/describe',auth[_0xcfb9('0x9')](),controller[_0xcfb9('0xa')]);router[_0xcfb9('0x8')]('/:id',auth[_0xcfb9('0x9')](),controller[_0xcfb9('0xb')]);router[_0xcfb9('0xc')]('/',auth[_0xcfb9('0x9')](),controller[_0xcfb9('0xd')]);router[_0xcfb9('0xe')](_0xcfb9('0xf'),auth[_0xcfb9('0x9')](),controller[_0xcfb9('0x10')]);router[_0xcfb9('0x11')](_0xcfb9('0xf'),auth[_0xcfb9('0x9')](),controller[_0xcfb9('0x12')]);module[_0xcfb9('0x13')]=router; \ No newline at end of file +var _0x62d1=['/:id','show','post','create','put','update','delete','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index'];(function(_0x3c7056,_0x4fc530){var _0x4f9b36=function(_0x108f78){while(--_0x108f78){_0x3c7056['push'](_0x3c7056['shift']());}};_0x4f9b36(++_0x4fc530);}(_0x62d1,0x67));var _0x162d=function(_0x5dfb47,_0x5b158c){_0x5dfb47=_0x5dfb47-0x0;var _0x48c85a=_0x62d1[_0x5dfb47];return _0x48c85a;};'use strict';var multer=require(_0x162d('0x0'));var util=require(_0x162d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x162d('0x2')]();var fs_extra=require(_0x162d('0x3'));var auth=require(_0x162d('0x4'));var interaction=require(_0x162d('0x5'));var config=require(_0x162d('0x6'));var controller=require(_0x162d('0x7'));router[_0x162d('0x8')]('/',auth[_0x162d('0x9')](),controller[_0x162d('0xa')]);router[_0x162d('0x8')]('/describe',auth[_0x162d('0x9')](),controller['describe']);router[_0x162d('0x8')](_0x162d('0xb'),auth[_0x162d('0x9')](),controller[_0x162d('0xc')]);router[_0x162d('0xd')]('/',auth[_0x162d('0x9')](),controller[_0x162d('0xe')]);router[_0x162d('0xf')](_0x162d('0xb'),auth[_0x162d('0x9')](),controller[_0x162d('0x10')]);router[_0x162d('0x11')](_0x162d('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x162d('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index a9ea893..8137582 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x2f3794,_0x3c3bec){var _0x1c9fbe=function(_0x2d2eac){while(--_0x2d2eac){_0x2f3794['push'](_0x2f3794['shift']());}};_0x1c9fbe(++_0x3c3bec);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1756ad,_0x165373){_0x1756ad=_0x1756ad-0x0;var _0x54a55c=_0x9bde[_0x1756ad];return _0x54a55c;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x4387c0,_0x3d4559){var _0x4593e6=function(_0x377472){while(--_0x377472){_0x4387c0['push'](_0x4387c0['shift']());}};_0x4593e6(++_0x3d4559);}(_0x70e0,0x17b));var _0x070e=function(_0x1f0e53,_0xfb3632){_0x1f0e53=_0x1f0e53-0x0;var _0x41dcdc=_0x70e0[_0x1f0e53];return _0x41dcdc;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index a86ffa2..aad8102 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 _0xc2bd=['../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','then','error','stack','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','name','filter','includeAll','include','findAll','rows','catch','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service'];(function(_0x256d32,_0x361b29){var _0x24bfec=function(_0x3fc606){while(--_0x3fc606){_0x256d32['push'](_0x256d32['shift']());}};_0x24bfec(++_0x361b29);}(_0xc2bd,0x161));var _0xdc2b=function(_0x3bda58,_0x25bd78){_0x3bda58=_0x3bda58-0x0;var _0x1a7bf8=_0xc2bd[_0x3bda58];return _0x1a7bf8;};'use strict';var emlformat=require(_0xdc2b('0x0'));var rimraf=require(_0xdc2b('0x1'));var zipdir=require(_0xdc2b('0x2'));var jsonpatch=require(_0xdc2b('0x3'));var rp=require(_0xdc2b('0x4'));var moment=require('moment');var BPromise=require(_0xdc2b('0x5'));var Mustache=require('mustache');var util=require(_0xdc2b('0x6'));var path=require('path');var sox=require(_0xdc2b('0x7'));var csv=require(_0xdc2b('0x8'));var ejs=require(_0xdc2b('0x9'));var fs=require('fs');var fs_extra=require(_0xdc2b('0xa'));var _=require(_0xdc2b('0xb'));var squel=require('squel');var crypto=require(_0xdc2b('0xc'));var jsforce=require(_0xdc2b('0xd'));var deskjs=require(_0xdc2b('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdc2b('0xf'));var Redis=require('ioredis');var authService=require(_0xdc2b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xdc2b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdc2b('0x12'));var utils=require(_0xdc2b('0x13'));var config=require(_0xdc2b('0x14'));var licenseUtil=require(_0xdc2b('0x15'));var db=require(_0xdc2b('0x16'))['db'];function respondWithStatusCode(_0x14256f,_0x4da516){_0x4da516=_0x4da516||0xcc;return function(_0x58f126){if(_0x58f126){return _0x14256f[_0xdc2b('0x17')](_0x4da516);}return _0x14256f[_0xdc2b('0x18')](_0x4da516)[_0xdc2b('0x19')]();};}function respondWithResult(_0x310ece,_0x47d12e){_0x47d12e=_0x47d12e||0xc8;return function(_0x51624c){if(_0x51624c){return _0x310ece[_0xdc2b('0x18')](_0x47d12e)[_0xdc2b('0x1a')](_0x51624c);}};}function respondWithFilteredResult(_0x380936,_0x1b3b02){return function(_0x55ab9e){if(_0x55ab9e){var _0x81fbc4=typeof _0x1b3b02[_0xdc2b('0x1b')]===_0xdc2b('0x1c')&&typeof _0x1b3b02[_0xdc2b('0x1d')]===_0xdc2b('0x1c');var _0x5c6c6f=_0x55ab9e[_0xdc2b('0x1e')];var _0x233d02=_0x81fbc4?0x0:_0x1b3b02[_0xdc2b('0x1b')];var _0x2b2624=_0x81fbc4?_0x55ab9e['count']:_0x1b3b02[_0xdc2b('0x1b')]+_0x1b3b02[_0xdc2b('0x1d')];var _0x15c9ad;if(_0x2b2624>=_0x5c6c6f){_0x2b2624=_0x5c6c6f;_0x15c9ad=0xc8;}else{_0x15c9ad=0xce;}_0x380936['status'](_0x15c9ad);return _0x380936[_0xdc2b('0x1f')](_0xdc2b('0x20'),_0x233d02+'-'+_0x2b2624+'/'+_0x5c6c6f)['json'](_0x55ab9e);}return null;};}function patchUpdates(_0x24cc0f){return function(_0x28288a){try{jsonpatch[_0xdc2b('0x21')](_0x28288a,_0x24cc0f,!![]);}catch(_0x848cd1){return BPromise['reject'](_0x848cd1);}return _0x28288a['save']();};}function saveUpdates(_0x5f2d4e,_0x25577d){return function(_0x2c8c59){if(_0x2c8c59){return _0x2c8c59['update'](_0x5f2d4e)['then'](function(_0x4f71a1){return _0x4f71a1;});}return null;};}function removeEntity(_0x3059f8,_0x5b4356){return function(_0x38aefb){if(_0x38aefb){return _0x38aefb[_0xdc2b('0x22')]()[_0xdc2b('0x23')](function(){_0x3059f8[_0xdc2b('0x18')](0xcc)[_0xdc2b('0x19')]();});}};}function handleEntityNotFound(_0x495e6f,_0x280764){return function(_0x228228){if(!_0x228228){_0x495e6f['sendStatus'](0x194);}return _0x228228;};}function handleError(_0x32f266,_0x173fe9){_0x173fe9=_0x173fe9||0x1f4;return function(_0x304108){logger[_0xdc2b('0x24')](_0x304108[_0xdc2b('0x25')]);if(_0x304108['name']){delete _0x304108['name'];}_0x32f266[_0xdc2b('0x18')](_0x173fe9)[_0xdc2b('0x26')](_0x304108);};}exports[_0xdc2b('0x27')]=function(_0x455e21,_0xa5d65f){var _0x5f0f86={},_0x4e8676={},_0x57c258={'count':0x0,'rows':[]};var _0x1928c6=_[_0xdc2b('0x28')](db[_0xdc2b('0x29')][_0xdc2b('0x2a')],function(_0x6ee71e){return{'name':_0x6ee71e[_0xdc2b('0x2b')],'type':_0x6ee71e[_0xdc2b('0x2c')][_0xdc2b('0x2d')]};});_0x4e8676[_0xdc2b('0x2e')]=_[_0xdc2b('0x28')](_0x1928c6,'name');_0x4e8676[_0xdc2b('0x2f')]=_['keys'](_0x455e21['query']);_0x4e8676['filters']=_[_0xdc2b('0x30')](_0x4e8676['model'],_0x4e8676[_0xdc2b('0x2f')]);_0x5f0f86['attributes']=_[_0xdc2b('0x30')](_0x4e8676[_0xdc2b('0x2e')],qs[_0xdc2b('0x31')](_0x455e21['query'][_0xdc2b('0x31')]));_0x5f0f86[_0xdc2b('0x32')]=_0x5f0f86[_0xdc2b('0x32')][_0xdc2b('0x33')]?_0x5f0f86[_0xdc2b('0x32')]:_0x4e8676[_0xdc2b('0x2e')];if(!_0x455e21['query'][_0xdc2b('0x34')](_0xdc2b('0x35'))){_0x5f0f86[_0xdc2b('0x1d')]=qs[_0xdc2b('0x1d')](_0x455e21[_0xdc2b('0x2f')]['limit']);_0x5f0f86[_0xdc2b('0x1b')]=qs[_0xdc2b('0x1b')](_0x455e21[_0xdc2b('0x2f')]['offset']);}_0x5f0f86[_0xdc2b('0x36')]=qs['sort'](_0x455e21[_0xdc2b('0x2f')][_0xdc2b('0x37')]);_0x5f0f86[_0xdc2b('0x38')]=qs[_0xdc2b('0x39')](_[_0xdc2b('0x3a')](_0x455e21['query'],_0x4e8676[_0xdc2b('0x39')]),_0x1928c6);if(_0x455e21['query']['filter']){_0x5f0f86['where']=_[_0xdc2b('0x3b')](_0x5f0f86[_0xdc2b('0x38')],{'$or':_[_0xdc2b('0x28')](_0x1928c6,function(_0x3ebc35){if(_0x3ebc35[_0xdc2b('0x2c')]!==_0xdc2b('0x3c')){var _0x43e52a={};_0x43e52a[_0x3ebc35[_0xdc2b('0x3d')]]={'$like':'%'+_0x455e21[_0xdc2b('0x2f')][_0xdc2b('0x3e')]+'%'};return _0x43e52a;}})});}_0x5f0f86=_[_0xdc2b('0x3b')]({},_0x5f0f86,_0x455e21['options']);var _0x22da68={'where':_0x5f0f86['where']};return db[_0xdc2b('0x29')]['count'](_0x22da68)[_0xdc2b('0x23')](function(_0x5a7429){_0x57c258['count']=_0x5a7429;if(_0x455e21[_0xdc2b('0x2f')][_0xdc2b('0x3f')]){_0x5f0f86[_0xdc2b('0x40')]=[{'all':!![]}];}return db[_0xdc2b('0x29')][_0xdc2b('0x41')](_0x5f0f86);})['then'](function(_0x1bb49b){_0x57c258[_0xdc2b('0x42')]=_0x1bb49b;return _0x57c258;})['then'](respondWithFilteredResult(_0xa5d65f,_0x5f0f86))[_0xdc2b('0x43')](handleError(_0xa5d65f,null));};exports['show']=function(_0x534b0b,_0xbb4092){var _0x202460={'raw':!![],'where':{'id':_0x534b0b[_0xdc2b('0x44')]['id']}},_0x55ff63={};_0x55ff63[_0xdc2b('0x2e')]=_[_0xdc2b('0x45')](db[_0xdc2b('0x29')]['rawAttributes']);_0x55ff63[_0xdc2b('0x2f')]=_[_0xdc2b('0x45')](_0x534b0b[_0xdc2b('0x2f')]);_0x55ff63[_0xdc2b('0x39')]=_['intersection'](_0x55ff63['model'],_0x55ff63['query']);_0x202460[_0xdc2b('0x32')]=_[_0xdc2b('0x30')](_0x55ff63['model'],qs['fields'](_0x534b0b[_0xdc2b('0x2f')][_0xdc2b('0x31')]));_0x202460[_0xdc2b('0x32')]=_0x202460[_0xdc2b('0x32')][_0xdc2b('0x33')]?_0x202460[_0xdc2b('0x32')]:_0x55ff63['model'];if(_0x534b0b[_0xdc2b('0x2f')][_0xdc2b('0x3f')]){_0x202460[_0xdc2b('0x40')]=[{'all':!![]}];}_0x202460=_[_0xdc2b('0x3b')]({},_0x202460,_0x534b0b['options']);return db[_0xdc2b('0x29')][_0xdc2b('0x46')](_0x202460)[_0xdc2b('0x23')](handleEntityNotFound(_0xbb4092,null))[_0xdc2b('0x23')](respondWithResult(_0xbb4092,null))[_0xdc2b('0x43')](handleError(_0xbb4092,null));};exports[_0xdc2b('0x47')]=function(_0x5cd106,_0x46dd94){return db[_0xdc2b('0x29')][_0xdc2b('0x47')](_0x5cd106[_0xdc2b('0x48')],{})[_0xdc2b('0x23')](respondWithResult(_0x46dd94,0xc9))[_0xdc2b('0x43')](handleError(_0x46dd94,null));};exports['update']=function(_0x5477df,_0x1500f2){if(_0x5477df[_0xdc2b('0x48')]['id']){delete _0x5477df[_0xdc2b('0x48')]['id'];}return db[_0xdc2b('0x29')][_0xdc2b('0x46')]({'where':{'id':_0x5477df[_0xdc2b('0x44')]['id']}})[_0xdc2b('0x23')](handleEntityNotFound(_0x1500f2,null))[_0xdc2b('0x23')](saveUpdates(_0x5477df[_0xdc2b('0x48')],null))[_0xdc2b('0x23')](respondWithResult(_0x1500f2,null))[_0xdc2b('0x43')](handleError(_0x1500f2,null));};exports[_0xdc2b('0x22')]=function(_0x53c1f9,_0x444935){return db[_0xdc2b('0x29')][_0xdc2b('0x46')]({'where':{'id':_0x53c1f9[_0xdc2b('0x44')]['id']}})['then'](handleEntityNotFound(_0x444935,null))[_0xdc2b('0x23')](removeEntity(_0x444935,null))[_0xdc2b('0x43')](handleError(_0x444935,null));};exports['describe']=function(_0x18502f,_0x5e20fc){return db[_0xdc2b('0x29')][_0xdc2b('0x49')]()[_0xdc2b('0x23')](respondWithResult(_0x5e20fc,null))[_0xdc2b('0x43')](handleError(_0x5e20fc,null));}; \ No newline at end of file +var _0x99e7=['merge','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','OpenchannelTransferReport','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where'];(function(_0x8d996,_0x1ed83f){var _0x4258e1=function(_0x4b79c1){while(--_0x4b79c1){_0x8d996['push'](_0x8d996['shift']());}};_0x4258e1(++_0x1ed83f);}(_0x99e7,0xa8));var _0x799e=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0x99e7[_0x18a436];return _0x5c2cf8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x799e('0x0'));var zipdir=require(_0x799e('0x1'));var jsonpatch=require(_0x799e('0x2'));var rp=require(_0x799e('0x3'));var moment=require(_0x799e('0x4'));var BPromise=require(_0x799e('0x5'));var Mustache=require(_0x799e('0x6'));var util=require(_0x799e('0x7'));var path=require(_0x799e('0x8'));var sox=require(_0x799e('0x9'));var csv=require('to-csv');var ejs=require(_0x799e('0xa'));var fs=require('fs');var fs_extra=require(_0x799e('0xb'));var _=require('lodash');var squel=require(_0x799e('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x799e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x799e('0xe'));var Papa=require(_0x799e('0xf'));var Redis=require(_0x799e('0x10'));var authService=require(_0x799e('0x11'));var qs=require(_0x799e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x799e('0x13'));var logger=require(_0x799e('0x14'))(_0x799e('0x15'));var utils=require(_0x799e('0x16'));var config=require(_0x799e('0x17'));var licenseUtil=require(_0x799e('0x18'));var db=require(_0x799e('0x19'))['db'];function respondWithStatusCode(_0x54983c,_0x40f4e0){_0x40f4e0=_0x40f4e0||0xcc;return function(_0x398402){if(_0x398402){return _0x54983c['sendStatus'](_0x40f4e0);}return _0x54983c[_0x799e('0x1a')](_0x40f4e0)[_0x799e('0x1b')]();};}function respondWithResult(_0x1c7fcd,_0x4439c5){_0x4439c5=_0x4439c5||0xc8;return function(_0x3cb60b){if(_0x3cb60b){return _0x1c7fcd[_0x799e('0x1a')](_0x4439c5)[_0x799e('0x1c')](_0x3cb60b);}};}function respondWithFilteredResult(_0x29d3f7,_0x24eec4){return function(_0x47c46d){if(_0x47c46d){var _0x2d3ef2=typeof _0x24eec4[_0x799e('0x1d')]===_0x799e('0x1e')&&typeof _0x24eec4['limit']==='undefined';var _0x4f068e=_0x47c46d[_0x799e('0x1f')];var _0x476272=_0x2d3ef2?0x0:_0x24eec4['offset'];var _0xf7eb77=_0x2d3ef2?_0x47c46d[_0x799e('0x1f')]:_0x24eec4['offset']+_0x24eec4[_0x799e('0x20')];var _0x1e8630;if(_0xf7eb77>=_0x4f068e){_0xf7eb77=_0x4f068e;_0x1e8630=0xc8;}else{_0x1e8630=0xce;}_0x29d3f7[_0x799e('0x1a')](_0x1e8630);return _0x29d3f7[_0x799e('0x21')](_0x799e('0x22'),_0x476272+'-'+_0xf7eb77+'/'+_0x4f068e)[_0x799e('0x1c')](_0x47c46d);}return null;};}function patchUpdates(_0x1d1078){return function(_0x624364){try{jsonpatch[_0x799e('0x23')](_0x624364,_0x1d1078,!![]);}catch(_0x45b63b){return BPromise[_0x799e('0x24')](_0x45b63b);}return _0x624364[_0x799e('0x25')]();};}function saveUpdates(_0x4ca947,_0x3c61fa){return function(_0x545e56){if(_0x545e56){return _0x545e56[_0x799e('0x26')](_0x4ca947)['then'](function(_0x3f573d){return _0x3f573d;});}return null;};}function removeEntity(_0x8bb92,_0x435fda){return function(_0x635d18){if(_0x635d18){return _0x635d18[_0x799e('0x27')]()[_0x799e('0x28')](function(){_0x8bb92[_0x799e('0x1a')](0xcc)[_0x799e('0x1b')]();});}};}function handleEntityNotFound(_0x1c9560,_0x26a9ea){return function(_0x390e41){if(!_0x390e41){_0x1c9560[_0x799e('0x29')](0x194);}return _0x390e41;};}function handleError(_0x4f70e2,_0x43ced0){_0x43ced0=_0x43ced0||0x1f4;return function(_0x7705de){logger[_0x799e('0x2a')](_0x7705de[_0x799e('0x2b')]);if(_0x7705de[_0x799e('0x2c')]){delete _0x7705de[_0x799e('0x2c')];}_0x4f70e2['status'](_0x43ced0)[_0x799e('0x2d')](_0x7705de);};}exports['index']=function(_0xd02e85,_0x1c4b24){var _0x2fff59={},_0x194d81={},_0x3f5789={'count':0x0,'rows':[]};var _0x4fb1e1=_[_0x799e('0x2e')](db[_0x799e('0x2f')][_0x799e('0x30')],function(_0x4fd0e5){return{'name':_0x4fd0e5['fieldName'],'type':_0x4fd0e5[_0x799e('0x31')][_0x799e('0x32')]};});_0x194d81[_0x799e('0x33')]=_[_0x799e('0x2e')](_0x4fb1e1,_0x799e('0x2c'));_0x194d81[_0x799e('0x34')]=_['keys'](_0xd02e85[_0x799e('0x34')]);_0x194d81[_0x799e('0x35')]=_[_0x799e('0x36')](_0x194d81[_0x799e('0x33')],_0x194d81[_0x799e('0x34')]);_0x2fff59['attributes']=_[_0x799e('0x36')](_0x194d81['model'],qs['fields'](_0xd02e85[_0x799e('0x34')][_0x799e('0x37')]));_0x2fff59['attributes']=_0x2fff59[_0x799e('0x38')][_0x799e('0x39')]?_0x2fff59['attributes']:_0x194d81[_0x799e('0x33')];if(!_0xd02e85[_0x799e('0x34')][_0x799e('0x3a')](_0x799e('0x3b'))){_0x2fff59[_0x799e('0x20')]=qs[_0x799e('0x20')](_0xd02e85['query'][_0x799e('0x20')]);_0x2fff59[_0x799e('0x1d')]=qs[_0x799e('0x1d')](_0xd02e85[_0x799e('0x34')][_0x799e('0x1d')]);}_0x2fff59['order']=qs[_0x799e('0x3c')](_0xd02e85[_0x799e('0x34')]['sort']);_0x2fff59['where']=qs[_0x799e('0x35')](_[_0x799e('0x3d')](_0xd02e85[_0x799e('0x34')],_0x194d81[_0x799e('0x35')]),_0x4fb1e1);if(_0xd02e85['query']['filter']){_0x2fff59[_0x799e('0x3e')]=_[_0x799e('0x3f')](_0x2fff59[_0x799e('0x3e')],{'$or':_[_0x799e('0x2e')](_0x4fb1e1,function(_0x1ac833){if(_0x1ac833[_0x799e('0x31')]!=='VIRTUAL'){var _0x170785={};_0x170785[_0x1ac833[_0x799e('0x2c')]]={'$like':'%'+_0xd02e85[_0x799e('0x34')][_0x799e('0x40')]+'%'};return _0x170785;}})});}_0x2fff59=_[_0x799e('0x3f')]({},_0x2fff59,_0xd02e85[_0x799e('0x41')]);var _0x5c8451={'where':_0x2fff59['where']};return db[_0x799e('0x2f')]['count'](_0x5c8451)[_0x799e('0x28')](function(_0x27018f){_0x3f5789[_0x799e('0x1f')]=_0x27018f;if(_0xd02e85['query'][_0x799e('0x42')]){_0x2fff59[_0x799e('0x43')]=[{'all':!![]}];}return db[_0x799e('0x2f')][_0x799e('0x44')](_0x2fff59);})[_0x799e('0x28')](function(_0x5cbcd2){_0x3f5789[_0x799e('0x45')]=_0x5cbcd2;return _0x3f5789;})[_0x799e('0x28')](respondWithFilteredResult(_0x1c4b24,_0x2fff59))[_0x799e('0x46')](handleError(_0x1c4b24,null));};exports[_0x799e('0x47')]=function(_0x4901c2,_0x392dc9){var _0x54acdb={'raw':!![],'where':{'id':_0x4901c2[_0x799e('0x48')]['id']}},_0x55526d={};_0x55526d[_0x799e('0x33')]=_[_0x799e('0x49')](db['OpenchannelTransferReport'][_0x799e('0x30')]);_0x55526d['query']=_[_0x799e('0x49')](_0x4901c2[_0x799e('0x34')]);_0x55526d[_0x799e('0x35')]=_[_0x799e('0x36')](_0x55526d[_0x799e('0x33')],_0x55526d[_0x799e('0x34')]);_0x54acdb[_0x799e('0x38')]=_[_0x799e('0x36')](_0x55526d[_0x799e('0x33')],qs[_0x799e('0x37')](_0x4901c2['query'][_0x799e('0x37')]));_0x54acdb[_0x799e('0x38')]=_0x54acdb[_0x799e('0x38')]['length']?_0x54acdb[_0x799e('0x38')]:_0x55526d[_0x799e('0x33')];if(_0x4901c2[_0x799e('0x34')][_0x799e('0x42')]){_0x54acdb['include']=[{'all':!![]}];}_0x54acdb=_['merge']({},_0x54acdb,_0x4901c2[_0x799e('0x41')]);return db[_0x799e('0x2f')][_0x799e('0x4a')](_0x54acdb)[_0x799e('0x28')](handleEntityNotFound(_0x392dc9,null))[_0x799e('0x28')](respondWithResult(_0x392dc9,null))['catch'](handleError(_0x392dc9,null));};exports[_0x799e('0x4b')]=function(_0x227f52,_0x2ac136){return db['OpenchannelTransferReport'][_0x799e('0x4b')](_0x227f52[_0x799e('0x4c')],{})[_0x799e('0x28')](respondWithResult(_0x2ac136,0xc9))['catch'](handleError(_0x2ac136,null));};exports[_0x799e('0x26')]=function(_0x61ebac,_0x24680c){if(_0x61ebac['body']['id']){delete _0x61ebac['body']['id'];}return db[_0x799e('0x2f')][_0x799e('0x4a')]({'where':{'id':_0x61ebac['params']['id']}})['then'](handleEntityNotFound(_0x24680c,null))['then'](saveUpdates(_0x61ebac['body'],null))[_0x799e('0x28')](respondWithResult(_0x24680c,null))['catch'](handleError(_0x24680c,null));};exports[_0x799e('0x27')]=function(_0x17c54c,_0x293cee){return db[_0x799e('0x2f')][_0x799e('0x4a')]({'where':{'id':_0x17c54c[_0x799e('0x48')]['id']}})['then'](handleEntityNotFound(_0x293cee,null))[_0x799e('0x28')](removeEntity(_0x293cee,null))[_0x799e('0x46')](handleError(_0x293cee,null));};exports['describe']=function(_0x19eaa1,_0xd82ca7){return db['OpenchannelTransferReport']['describe']()[_0x799e('0x28')](respondWithResult(_0xd82ca7,null))[_0x799e('0x46')](handleError(_0xd82ca7,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 7300439..ed2db18 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 _0xc707=['./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x1d1638,_0x4cc560){var _0x40ec8c=function(_0x311335){while(--_0x311335){_0x1d1638['push'](_0x1d1638['shift']());}};_0x40ec8c(++_0x4cc560);}(_0xc707,0x87));var _0x7c70=function(_0xfec4f2,_0x27b2aa){_0xfec4f2=_0xfec4f2-0x0;var _0x4ee052=_0xc707[_0xfec4f2];return _0x4ee052;};'use strict';var _=require(_0x7c70('0x0'));var util=require('util');var logger=require(_0x7c70('0x1'))(_0x7c70('0x2'));var moment=require(_0x7c70('0x3'));var BPromise=require(_0x7c70('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c70('0x5'));var rimraf=require(_0x7c70('0x6'));var config=require(_0x7c70('0x7'));var attributes=require(_0x7c70('0x8'));module['exports']=function(_0x5f3270,_0x89017b){return _0x5f3270[_0x7c70('0x9')](_0x7c70('0xa'),attributes,{'tableName':_0x7c70('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7c70('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x167f=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x5eed59,_0x25b8f0){var _0x5e8dca=function(_0x3f24ad){while(--_0x3f24ad){_0x5eed59['push'](_0x5eed59['shift']());}};_0x5e8dca(++_0x25b8f0);}(_0x167f,0xe6));var _0xf167=function(_0x427352,_0x1bce61){_0x427352=_0x427352-0x0;var _0x23e0e6=_0x167f[_0x427352];return _0x23e0e6;};'use strict';var _=require(_0xf167('0x0'));var util=require(_0xf167('0x1'));var logger=require(_0xf167('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf167('0x3'));var rp=require(_0xf167('0x4'));var fs=require('fs');var path=require(_0xf167('0x5'));var rimraf=require(_0xf167('0x6'));var config=require(_0xf167('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0xf167('0x8')]=function(_0x57b041,_0x3bceec){return _0x57b041[_0xf167('0x9')]('OpenchannelTransferReport',attributes,{'tableName':_0xf167('0xa'),'paranoid':![],'indexes':[{'name':_0xf167('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 66ba515..56b8694 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 _0x64f5=['result','catch','lodash','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x64f5,0x17e));var _0x564f=function(_0x3a58cd,_0x1cbeed){_0x3a58cd=_0x3a58cd-0x0;var _0x3d06c0=_0x64f5[_0x3a58cd];return _0x3d06c0;};'use strict';var _=require(_0x564f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x564f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x564f('0x2'))['db'];var utils=require(_0x564f('0x3'));var logger=require('../../config/logger')(_0x564f('0x4'));var config=require(_0x564f('0x5'));var jayson=require(_0x564f('0x6'));var client=jayson[_0x564f('0x7')][_0x564f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d3dae,_0x26f14e,_0x28db5a){return new BPromise(function(_0x275bd6,_0x26fd74){return client[_0x564f('0x9')](_0x4d3dae,_0x28db5a)[_0x564f('0xa')](function(_0x2e2b5c){logger[_0x564f('0xb')](_0x564f('0xc'),_0x26f14e,_0x564f('0xd'));logger[_0x564f('0xe')](_0x564f('0xf'),_0x26f14e,_0x564f('0xd'),JSON['stringify'](_0x2e2b5c));if(_0x2e2b5c['error']){if(_0x2e2b5c[_0x564f('0x10')]['code']===0x1f4){logger[_0x564f('0x10')](_0x564f('0xc'),_0x26f14e,_0x2e2b5c[_0x564f('0x10')]['message']);return _0x26fd74(_0x2e2b5c[_0x564f('0x10')][_0x564f('0x11')]);}logger[_0x564f('0x10')](_0x564f('0xc'),_0x26f14e,_0x2e2b5c[_0x564f('0x10')]['message']);return _0x275bd6(_0x2e2b5c['error'][_0x564f('0x11')]);}else{logger[_0x564f('0xb')](_0x564f('0xc'),_0x26f14e,_0x564f('0xd'));_0x275bd6(_0x2e2b5c[_0x564f('0x12')][_0x564f('0x11')]);}})[_0x564f('0x13')](function(_0x15d9d7){logger[_0x564f('0x10')](_0x564f('0xc'),_0x26f14e,_0x15d9d7);_0x26fd74(_0x15d9d7);});});} \ No newline at end of file +var _0x6657=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash'];(function(_0x47087a,_0x2a007e){var _0xc933e7=function(_0x445589){while(--_0x445589){_0x47087a['push'](_0x47087a['shift']());}};_0xc933e7(++_0x2a007e);}(_0x6657,0x17f));var _0x7665=function(_0xcfd89f,_0x106e8f){_0xcfd89f=_0xcfd89f-0x0;var _0x59acd4=_0x6657[_0xcfd89f];return _0x59acd4;};'use strict';var _=require(_0x7665('0x0'));var util=require('util');var moment=require(_0x7665('0x1'));var BPromise=require(_0x7665('0x2'));var rs=require(_0x7665('0x3'));var fs=require('fs');var Redis=require(_0x7665('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7665('0x5'));var logger=require(_0x7665('0x6'))(_0x7665('0x7'));var config=require(_0x7665('0x8'));var jayson=require(_0x7665('0x9'));var client=jayson[_0x7665('0xa')][_0x7665('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3387d8,_0x4c0b5c,_0x31da89){return new BPromise(function(_0x464ec1,_0x24e6aa){return client[_0x7665('0xc')](_0x3387d8,_0x31da89)[_0x7665('0xd')](function(_0x3f3a65){logger[_0x7665('0xe')](_0x7665('0xf'),_0x4c0b5c,'request\x20sent');logger[_0x7665('0x10')](_0x7665('0x11'),_0x4c0b5c,_0x7665('0x12'),JSON['stringify'](_0x3f3a65));if(_0x3f3a65[_0x7665('0x13')]){if(_0x3f3a65['error'][_0x7665('0x14')]===0x1f4){logger[_0x7665('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4c0b5c,_0x3f3a65[_0x7665('0x13')][_0x7665('0x15')]);return _0x24e6aa(_0x3f3a65['error'][_0x7665('0x15')]);}logger[_0x7665('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4c0b5c,_0x3f3a65[_0x7665('0x13')][_0x7665('0x15')]);return _0x464ec1(_0x3f3a65[_0x7665('0x13')][_0x7665('0x15')]);}else{logger[_0x7665('0xe')](_0x7665('0xf'),_0x4c0b5c,_0x7665('0x12'));_0x464ec1(_0x3f3a65[_0x7665('0x16')][_0x7665('0x15')]);}})[_0x7665('0x17')](function(_0x365469){logger[_0x7665('0x13')](_0x7665('0xf'),_0x4c0b5c,_0x365469);_0x24e6aa(_0x365469);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 0036517..4ba4e6d 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 _0x2ff7=['index','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x2c9367,_0x291f5c){var _0x583827=function(_0x109077){while(--_0x109077){_0x2c9367['push'](_0x2c9367['shift']());}};_0x583827(++_0x291f5c);}(_0x2ff7,0xc8));var _0x72ff=function(_0x5086d1,_0x13c9d9){_0x5086d1=_0x5086d1-0x0;var _0x54cefd=_0x2ff7[_0x5086d1];return _0x54cefd;};'use strict';var multer=require(_0x72ff('0x0'));var util=require(_0x72ff('0x1'));var path=require(_0x72ff('0x2'));var timeout=require(_0x72ff('0x3'));var express=require('express');var router=express[_0x72ff('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x72ff('0x5'));var config=require(_0x72ff('0x6'));var controller=require('./pause.controller');router['get']('/',auth[_0x72ff('0x7')](),controller[_0x72ff('0x8')]);router['get']('/:id',auth[_0x72ff('0x7')](),controller[_0x72ff('0x9')]);router[_0x72ff('0xa')]('/',auth[_0x72ff('0x7')](),controller[_0x72ff('0xb')]);router[_0x72ff('0xc')]('/:id',auth[_0x72ff('0x7')](),controller[_0x72ff('0xd')]);router[_0x72ff('0xe')]('/:id',auth[_0x72ff('0x7')](),controller['destroy']);module[_0x72ff('0xf')]=router; \ No newline at end of file +var _0x45b8=['get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x45b8,0x74));var _0x845b=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x45b8[_0x122096];return _0x3d1966;};'use strict';var multer=require(_0x845b('0x0'));var util=require(_0x845b('0x1'));var path=require('path');var timeout=require(_0x845b('0x2'));var express=require(_0x845b('0x3'));var router=express[_0x845b('0x4')]();var fs_extra=require(_0x845b('0x5'));var auth=require(_0x845b('0x6'));var interaction=require(_0x845b('0x7'));var config=require(_0x845b('0x8'));var controller=require(_0x845b('0x9'));router[_0x845b('0xa')]('/',auth['isAuthenticated'](),controller[_0x845b('0xb')]);router[_0x845b('0xa')](_0x845b('0xc'),auth[_0x845b('0xd')](),controller[_0x845b('0xe')]);router[_0x845b('0xf')]('/',auth['isAuthenticated'](),controller[_0x845b('0x10')]);router[_0x845b('0x11')](_0x845b('0xc'),auth[_0x845b('0xd')](),controller[_0x845b('0x12')]);router['delete'](_0x845b('0xc'),auth['isAuthenticated'](),controller[_0x845b('0x13')]);module[_0x845b('0x14')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 542090e..94323c3 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 _0xf7e9=['STRING','sequelize','exports'];(function(_0x5167a4,_0x4ac437){var _0xba0081=function(_0xad262a){while(--_0xad262a){_0x5167a4['push'](_0x5167a4['shift']());}};_0xba0081(++_0x4ac437);}(_0xf7e9,0x139));var _0x9f7e=function(_0x4358f5,_0x5b1ac6){_0x4358f5=_0x4358f5-0x0;var _0x4d8104=_0xf7e9[_0x4358f5];return _0x4d8104;};'use strict';var Sequelize=require(_0x9f7e('0x0'));module[_0x9f7e('0x1')]={'name':{'type':Sequelize[_0x9f7e('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd4bf=['name','sequelize','exports','STRING'];(function(_0x48d013,_0x2c50a0){var _0x577422=function(_0x43bc84){while(--_0x43bc84){_0x48d013['push'](_0x48d013['shift']());}};_0x577422(++_0x2c50a0);}(_0xd4bf,0x141));var _0xfd4b=function(_0x32f1ed,_0x9c6ba4){_0x32f1ed=_0x32f1ed-0x0;var _0x16eac9=_0xd4bf[_0x32f1ed];return _0x16eac9;};'use strict';var Sequelize=require(_0xfd4b('0x0'));module[_0xfd4b('0x1')]={'name':{'type':Sequelize[_0xfd4b('0x2')],'unique':_0xfd4b('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xfd4b('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 896943b..83e05c1 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 _0x57be=['apply','reject','save','update','then','get','Pauses','UserProfileResource','destroy','stack','name','index','map','Pause','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json'];(function(_0x4e7da3,_0x370232){var _0x52aae2=function(_0x39d8e7){while(--_0x39d8e7){_0x4e7da3['push'](_0x4e7da3['shift']());}};_0x52aae2(++_0x370232);}(_0x57be,0x175));var _0xe57b=function(_0xcad357,_0x33f984){_0xcad357=_0xcad357-0x0;var _0x2b45a5=_0x57be[_0xcad357];return _0x2b45a5;};'use strict';var emlformat=require(_0xe57b('0x0'));var rimraf=require(_0xe57b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe57b('0x2'));var moment=require('moment');var BPromise=require(_0xe57b('0x3'));var Mustache=require(_0xe57b('0x4'));var util=require(_0xe57b('0x5'));var path=require(_0xe57b('0x6'));var sox=require(_0xe57b('0x7'));var csv=require(_0xe57b('0x8'));var ejs=require(_0xe57b('0x9'));var fs=require('fs');var fs_extra=require(_0xe57b('0xa'));var _=require('lodash');var squel=require(_0xe57b('0xb'));var crypto=require('crypto');var jsforce=require(_0xe57b('0xc'));var deskjs=require(_0xe57b('0xd'));var toCsv=require(_0xe57b('0x8'));var querystring=require(_0xe57b('0xe'));var Papa=require(_0xe57b('0xf'));var Redis=require('ioredis');var authService=require(_0xe57b('0x10'));var qs=require(_0xe57b('0x11'));var as=require(_0xe57b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe57b('0x13'))('api');var utils=require(_0xe57b('0x14'));var config=require(_0xe57b('0x15'));var licenseUtil=require(_0xe57b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c3dba,_0x23aaca){_0x23aaca=_0x23aaca||0xcc;return function(_0x2a50af){if(_0x2a50af){return _0x3c3dba[_0xe57b('0x17')](_0x23aaca);}return _0x3c3dba[_0xe57b('0x18')](_0x23aaca)['end']();};}function respondWithResult(_0x179af2,_0x1ff724){_0x1ff724=_0x1ff724||0xc8;return function(_0x4c8f20){if(_0x4c8f20){return _0x179af2['status'](_0x1ff724)['json'](_0x4c8f20);}};}function respondWithFilteredResult(_0xed6c85,_0x55290f){return function(_0x971690){if(_0x971690){var _0xd905c7=typeof _0x55290f[_0xe57b('0x19')]===_0xe57b('0x1a')&&typeof _0x55290f[_0xe57b('0x1b')]===_0xe57b('0x1a');var _0xae99cd=_0x971690[_0xe57b('0x1c')];var _0x1c4058=_0xd905c7?0x0:_0x55290f[_0xe57b('0x19')];var _0x108289=_0xd905c7?_0x971690[_0xe57b('0x1c')]:_0x55290f[_0xe57b('0x19')]+_0x55290f[_0xe57b('0x1b')];var _0x2b9fa9;if(_0x108289>=_0xae99cd){_0x108289=_0xae99cd;_0x2b9fa9=0xc8;}else{_0x2b9fa9=0xce;}_0xed6c85[_0xe57b('0x18')](_0x2b9fa9);return _0xed6c85[_0xe57b('0x1d')](_0xe57b('0x1e'),_0x1c4058+'-'+_0x108289+'/'+_0xae99cd)[_0xe57b('0x1f')](_0x971690);}return null;};}function patchUpdates(_0x5d7727){return function(_0x57c03b){try{jsonpatch[_0xe57b('0x20')](_0x57c03b,_0x5d7727,!![]);}catch(_0x13db9e){return BPromise[_0xe57b('0x21')](_0x13db9e);}return _0x57c03b[_0xe57b('0x22')]();};}function saveUpdates(_0x3f587a,_0x4ee555){return function(_0x1a0437){if(_0x1a0437){return _0x1a0437[_0xe57b('0x23')](_0x3f587a)['then'](function(_0x5a5ff0){return _0x5a5ff0;});}return null;};}function removeEntity(_0x2dda97,_0x186cf8){return function(_0x590f22){if(_0x590f22){return _0x590f22['destroy']()[_0xe57b('0x24')](function(){var _0x48237b=_0x590f22[_0xe57b('0x25')]({'plain':!![]});var _0x47c8bf=_0xe57b('0x26');return db[_0xe57b('0x27')][_0xe57b('0x28')]({'where':{'type':_0x47c8bf,'resourceId':_0x48237b['id']}})['then'](function(){return _0x590f22;});})[_0xe57b('0x24')](function(){_0x2dda97[_0xe57b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x441f78,_0x2e6293){return function(_0x312cdc){if(!_0x312cdc){_0x441f78[_0xe57b('0x17')](0x194);}return _0x312cdc;};}function handleError(_0xf3737,_0x2cccd3){_0x2cccd3=_0x2cccd3||0x1f4;return function(_0x5659b1){logger['error'](_0x5659b1[_0xe57b('0x29')]);if(_0x5659b1[_0xe57b('0x2a')]){delete _0x5659b1['name'];}_0xf3737[_0xe57b('0x18')](_0x2cccd3)['send'](_0x5659b1);};}exports[_0xe57b('0x2b')]=function(_0x4b2e40,_0x362553){var _0x108921={},_0x5c30c0={},_0x572bc2={'count':0x0,'rows':[]};var _0x965694=_[_0xe57b('0x2c')](db[_0xe57b('0x2d')][_0xe57b('0x2e')],function(_0x126e25){return{'name':_0x126e25[_0xe57b('0x2f')],'type':_0x126e25[_0xe57b('0x30')][_0xe57b('0x31')]};});_0x5c30c0[_0xe57b('0x32')]=_[_0xe57b('0x2c')](_0x965694,_0xe57b('0x2a'));_0x5c30c0['query']=_[_0xe57b('0x33')](_0x4b2e40[_0xe57b('0x34')]);_0x5c30c0[_0xe57b('0x35')]=_[_0xe57b('0x36')](_0x5c30c0['model'],_0x5c30c0[_0xe57b('0x34')]);_0x108921[_0xe57b('0x37')]=_[_0xe57b('0x36')](_0x5c30c0[_0xe57b('0x32')],qs[_0xe57b('0x38')](_0x4b2e40[_0xe57b('0x34')][_0xe57b('0x38')]));_0x108921['attributes']=_0x108921[_0xe57b('0x37')][_0xe57b('0x39')]?_0x108921[_0xe57b('0x37')]:_0x5c30c0[_0xe57b('0x32')];if(!_0x4b2e40[_0xe57b('0x34')]['hasOwnProperty'](_0xe57b('0x3a'))){_0x108921[_0xe57b('0x1b')]=qs[_0xe57b('0x1b')](_0x4b2e40[_0xe57b('0x34')][_0xe57b('0x1b')]);_0x108921['offset']=qs[_0xe57b('0x19')](_0x4b2e40[_0xe57b('0x34')][_0xe57b('0x19')]);}_0x108921[_0xe57b('0x3b')]=qs[_0xe57b('0x3c')](_0x4b2e40[_0xe57b('0x34')][_0xe57b('0x3c')]);_0x108921[_0xe57b('0x3d')]=qs[_0xe57b('0x35')](_[_0xe57b('0x3e')](_0x4b2e40[_0xe57b('0x34')],_0x5c30c0[_0xe57b('0x35')]),_0x965694);if(_0x4b2e40[_0xe57b('0x34')][_0xe57b('0x3f')]){_0x108921['where']=_[_0xe57b('0x40')](_0x108921[_0xe57b('0x3d')],{'$or':_[_0xe57b('0x2c')](_0x965694,function(_0x5ded){if(_0x5ded[_0xe57b('0x30')]!=='VIRTUAL'){var _0x1782a6={};_0x1782a6[_0x5ded[_0xe57b('0x2a')]]={'$like':'%'+_0x4b2e40[_0xe57b('0x34')]['filter']+'%'};return _0x1782a6;}})});}_0x108921=_[_0xe57b('0x40')]({},_0x108921,_0x4b2e40[_0xe57b('0x41')]);var _0x32cea3={'where':_0x108921[_0xe57b('0x3d')]};return db['Pause']['count'](_0x32cea3)[_0xe57b('0x24')](function(_0x498de6){_0x572bc2[_0xe57b('0x1c')]=_0x498de6;if(_0x4b2e40[_0xe57b('0x34')][_0xe57b('0x42')]){_0x108921[_0xe57b('0x43')]=[{'all':!![]}];}return db[_0xe57b('0x2d')][_0xe57b('0x44')](_0x108921);})['then'](function(_0x281faa){_0x572bc2['rows']=_0x281faa;return _0x572bc2;})[_0xe57b('0x24')](respondWithFilteredResult(_0x362553,_0x108921))[_0xe57b('0x45')](handleError(_0x362553,null));};exports['show']=function(_0x2baa63,_0x3628b4){var _0x467350={'raw':!![],'where':{'id':_0x2baa63['params']['id']}},_0x11da80={};_0x11da80['model']=_['keys'](db[_0xe57b('0x2d')]['rawAttributes']);_0x11da80[_0xe57b('0x34')]=_['keys'](_0x2baa63[_0xe57b('0x34')]);_0x11da80['filters']=_[_0xe57b('0x36')](_0x11da80['model'],_0x11da80[_0xe57b('0x34')]);_0x467350['attributes']=_['intersection'](_0x11da80[_0xe57b('0x32')],qs['fields'](_0x2baa63[_0xe57b('0x34')]['fields']));_0x467350[_0xe57b('0x37')]=_0x467350[_0xe57b('0x37')][_0xe57b('0x39')]?_0x467350[_0xe57b('0x37')]:_0x11da80[_0xe57b('0x32')];if(_0x2baa63[_0xe57b('0x34')][_0xe57b('0x42')]){_0x467350[_0xe57b('0x43')]=[{'all':!![]}];}_0x467350=_[_0xe57b('0x40')]({},_0x467350,_0x2baa63[_0xe57b('0x41')]);return db[_0xe57b('0x2d')][_0xe57b('0x46')](_0x467350)[_0xe57b('0x24')](handleEntityNotFound(_0x3628b4,null))[_0xe57b('0x24')](respondWithResult(_0x3628b4,null))[_0xe57b('0x45')](handleError(_0x3628b4,null));};exports[_0xe57b('0x47')]=function(_0xa122e2,_0x142bf0){return db[_0xe57b('0x2d')][_0xe57b('0x47')](_0xa122e2[_0xe57b('0x48')],{})[_0xe57b('0x24')](function(_0x4b8632){var _0x149fa4=_0xa122e2['user']['get']({'plain':!![]});if(!_0x149fa4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x149fa4[_0xe57b('0x49')]===_0xe57b('0x4a')){var _0x4e66ec=_0x4b8632[_0xe57b('0x25')]({'plain':!![]});var _0x4d85f1=_0xe57b('0x26');return db[_0xe57b('0x4b')][_0xe57b('0x46')]({'where':{'name':_0x4d85f1,'userProfileId':_0x149fa4[_0xe57b('0x4c')]},'raw':!![]})['then'](function(_0x319541){if(_0x319541&&_0x319541[_0xe57b('0x4d')]===0x0){return db['UserProfileResource'][_0xe57b('0x47')]({'name':_0x4e66ec[_0xe57b('0x2a')],'resourceId':_0x4e66ec['id'],'type':_0x319541[_0xe57b('0x2a')],'sectionId':_0x319541['id']},{})[_0xe57b('0x24')](function(){return _0x4b8632;});}else{return _0x4b8632;}})['catch'](function(_0x24af83){logger[_0xe57b('0x4e')](_0xe57b('0x4f'),_0x24af83);throw _0x24af83;});}return _0x4b8632;})[_0xe57b('0x24')](respondWithResult(_0x142bf0,0xc9))['catch'](handleError(_0x142bf0,null));};exports[_0xe57b('0x23')]=function(_0x5ac50c,_0x24441a){if(_0x5ac50c[_0xe57b('0x48')]['id']){delete _0x5ac50c['body']['id'];}return db['Pause'][_0xe57b('0x46')]({'where':{'id':_0x5ac50c[_0xe57b('0x50')]['id']}})[_0xe57b('0x24')](handleEntityNotFound(_0x24441a,null))[_0xe57b('0x24')](saveUpdates(_0x5ac50c[_0xe57b('0x48')],null))['then'](respondWithResult(_0x24441a,null))['catch'](handleError(_0x24441a,null));};exports['destroy']=function(_0x409d9b,_0x4603d2){return db['Pause']['find']({'where':{'id':_0x409d9b[_0xe57b('0x50')]['id']}})[_0xe57b('0x24')](handleEntityNotFound(_0x4603d2,null))[_0xe57b('0x24')](removeEntity(_0x4603d2,null))[_0xe57b('0x45')](handleError(_0x4603d2,null));}; \ No newline at end of file +var _0xbba0=['create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','find','userProfileId','autoAssociation','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Pauses','UserProfileResource','error','name','map','Pause','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','rows','catch','show','keys'];(function(_0x4118d9,_0x3389e6){var _0x306d08=function(_0x5f5c0b){while(--_0x5f5c0b){_0x4118d9['push'](_0x4118d9['shift']());}};_0x306d08(++_0x3389e6);}(_0xbba0,0x144));var _0x0bba=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xbba0[_0x2e4e19];return _0x9ba20b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0bba('0x0'));var zipdir=require(_0x0bba('0x1'));var jsonpatch=require(_0x0bba('0x2'));var rp=require(_0x0bba('0x3'));var moment=require(_0x0bba('0x4'));var BPromise=require(_0x0bba('0x5'));var Mustache=require('mustache');var util=require(_0x0bba('0x6'));var path=require(_0x0bba('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0bba('0x8'));var fs=require('fs');var fs_extra=require(_0x0bba('0x9'));var _=require(_0x0bba('0xa'));var squel=require(_0x0bba('0xb'));var crypto=require('crypto');var jsforce=require(_0x0bba('0xc'));var deskjs=require(_0x0bba('0xd'));var toCsv=require(_0x0bba('0xe'));var querystring=require(_0x0bba('0xf'));var Papa=require(_0x0bba('0x10'));var Redis=require('ioredis');var authService=require(_0x0bba('0x11'));var qs=require(_0x0bba('0x12'));var as=require(_0x0bba('0x13'));var hardwareService=require(_0x0bba('0x14'));var logger=require('../../config/logger')(_0x0bba('0x15'));var utils=require(_0x0bba('0x16'));var config=require(_0x0bba('0x17'));var licenseUtil=require(_0x0bba('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fce01,_0x6bc2f9){_0x6bc2f9=_0x6bc2f9||0xcc;return function(_0x4bfe30){if(_0x4bfe30){return _0x2fce01['sendStatus'](_0x6bc2f9);}return _0x2fce01[_0x0bba('0x19')](_0x6bc2f9)[_0x0bba('0x1a')]();};}function respondWithResult(_0x4b9852,_0x471504){_0x471504=_0x471504||0xc8;return function(_0x3270dd){if(_0x3270dd){return _0x4b9852[_0x0bba('0x19')](_0x471504)[_0x0bba('0x1b')](_0x3270dd);}};}function respondWithFilteredResult(_0xe3ce55,_0x268432){return function(_0x38b1ef){if(_0x38b1ef){var _0x9ec955=typeof _0x268432[_0x0bba('0x1c')]===_0x0bba('0x1d')&&typeof _0x268432[_0x0bba('0x1e')]===_0x0bba('0x1d');var _0x41b81c=_0x38b1ef[_0x0bba('0x1f')];var _0x5dd9b2=_0x9ec955?0x0:_0x268432['offset'];var _0x29a3fa=_0x9ec955?_0x38b1ef[_0x0bba('0x1f')]:_0x268432[_0x0bba('0x1c')]+_0x268432[_0x0bba('0x1e')];var _0x1df1af;if(_0x29a3fa>=_0x41b81c){_0x29a3fa=_0x41b81c;_0x1df1af=0xc8;}else{_0x1df1af=0xce;}_0xe3ce55['status'](_0x1df1af);return _0xe3ce55[_0x0bba('0x20')](_0x0bba('0x21'),_0x5dd9b2+'-'+_0x29a3fa+'/'+_0x41b81c)[_0x0bba('0x1b')](_0x38b1ef);}return null;};}function patchUpdates(_0x16970c){return function(_0xdd96c8){try{jsonpatch[_0x0bba('0x22')](_0xdd96c8,_0x16970c,!![]);}catch(_0x19191e){return BPromise[_0x0bba('0x23')](_0x19191e);}return _0xdd96c8['save']();};}function saveUpdates(_0x1a7142,_0x2dfe00){return function(_0xb93dd){if(_0xb93dd){return _0xb93dd[_0x0bba('0x24')](_0x1a7142)[_0x0bba('0x25')](function(_0x156ed2){return _0x156ed2;});}return null;};}function removeEntity(_0x5aa10b,_0x5ea4f0){return function(_0x5e202f){if(_0x5e202f){return _0x5e202f[_0x0bba('0x26')]()[_0x0bba('0x25')](function(){var _0x5e5eda=_0x5e202f[_0x0bba('0x27')]({'plain':!![]});var _0x988162=_0x0bba('0x28');return db[_0x0bba('0x29')][_0x0bba('0x26')]({'where':{'type':_0x988162,'resourceId':_0x5e5eda['id']}})[_0x0bba('0x25')](function(){return _0x5e202f;});})[_0x0bba('0x25')](function(){_0x5aa10b[_0x0bba('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x434217,_0x41542e){return function(_0x3f4d8d){if(!_0x3f4d8d){_0x434217['sendStatus'](0x194);}return _0x3f4d8d;};}function handleError(_0x527a6a,_0x14a314){_0x14a314=_0x14a314||0x1f4;return function(_0x51837d){logger[_0x0bba('0x2a')](_0x51837d['stack']);if(_0x51837d[_0x0bba('0x2b')]){delete _0x51837d[_0x0bba('0x2b')];}_0x527a6a[_0x0bba('0x19')](_0x14a314)['send'](_0x51837d);};}exports['index']=function(_0x5225ef,_0x5195b2){var _0x2842a9={},_0x5ef530={},_0x161f3f={'count':0x0,'rows':[]};var _0x2e87d2=_[_0x0bba('0x2c')](db[_0x0bba('0x2d')][_0x0bba('0x2e')],function(_0x145b2d){return{'name':_0x145b2d[_0x0bba('0x2f')],'type':_0x145b2d[_0x0bba('0x30')][_0x0bba('0x31')]};});_0x5ef530[_0x0bba('0x32')]=_[_0x0bba('0x2c')](_0x2e87d2,'name');_0x5ef530['query']=_['keys'](_0x5225ef[_0x0bba('0x33')]);_0x5ef530['filters']=_['intersection'](_0x5ef530[_0x0bba('0x32')],_0x5ef530['query']);_0x2842a9['attributes']=_[_0x0bba('0x34')](_0x5ef530[_0x0bba('0x32')],qs[_0x0bba('0x35')](_0x5225ef[_0x0bba('0x33')][_0x0bba('0x35')]));_0x2842a9[_0x0bba('0x36')]=_0x2842a9['attributes'][_0x0bba('0x37')]?_0x2842a9[_0x0bba('0x36')]:_0x5ef530[_0x0bba('0x32')];if(!_0x5225ef[_0x0bba('0x33')][_0x0bba('0x38')](_0x0bba('0x39'))){_0x2842a9[_0x0bba('0x1e')]=qs[_0x0bba('0x1e')](_0x5225ef[_0x0bba('0x33')]['limit']);_0x2842a9['offset']=qs[_0x0bba('0x1c')](_0x5225ef[_0x0bba('0x33')][_0x0bba('0x1c')]);}_0x2842a9[_0x0bba('0x3a')]=qs[_0x0bba('0x3b')](_0x5225ef[_0x0bba('0x33')][_0x0bba('0x3b')]);_0x2842a9[_0x0bba('0x3c')]=qs[_0x0bba('0x3d')](_['pick'](_0x5225ef['query'],_0x5ef530[_0x0bba('0x3d')]),_0x2e87d2);if(_0x5225ef[_0x0bba('0x33')]['filter']){_0x2842a9[_0x0bba('0x3c')]=_['merge'](_0x2842a9['where'],{'$or':_[_0x0bba('0x2c')](_0x2e87d2,function(_0xb9c6ef){if(_0xb9c6ef[_0x0bba('0x30')]!=='VIRTUAL'){var _0x9d4a0b={};_0x9d4a0b[_0xb9c6ef['name']]={'$like':'%'+_0x5225ef[_0x0bba('0x33')][_0x0bba('0x3e')]+'%'};return _0x9d4a0b;}})});}_0x2842a9=_[_0x0bba('0x3f')]({},_0x2842a9,_0x5225ef[_0x0bba('0x40')]);var _0x2d846b={'where':_0x2842a9['where']};return db[_0x0bba('0x2d')][_0x0bba('0x1f')](_0x2d846b)[_0x0bba('0x25')](function(_0x5c4eec){_0x161f3f['count']=_0x5c4eec;if(_0x5225ef[_0x0bba('0x33')][_0x0bba('0x41')]){_0x2842a9[_0x0bba('0x42')]=[{'all':!![]}];}return db[_0x0bba('0x2d')]['findAll'](_0x2842a9);})[_0x0bba('0x25')](function(_0x129b72){_0x161f3f[_0x0bba('0x43')]=_0x129b72;return _0x161f3f;})['then'](respondWithFilteredResult(_0x5195b2,_0x2842a9))[_0x0bba('0x44')](handleError(_0x5195b2,null));};exports[_0x0bba('0x45')]=function(_0x252138,_0x4fc77d){var _0x217f0d={'raw':!![],'where':{'id':_0x252138['params']['id']}},_0x3f4a74={};_0x3f4a74[_0x0bba('0x32')]=_[_0x0bba('0x46')](db[_0x0bba('0x2d')][_0x0bba('0x2e')]);_0x3f4a74[_0x0bba('0x33')]=_['keys'](_0x252138[_0x0bba('0x33')]);_0x3f4a74[_0x0bba('0x3d')]=_[_0x0bba('0x34')](_0x3f4a74[_0x0bba('0x32')],_0x3f4a74[_0x0bba('0x33')]);_0x217f0d[_0x0bba('0x36')]=_[_0x0bba('0x34')](_0x3f4a74['model'],qs[_0x0bba('0x35')](_0x252138['query']['fields']));_0x217f0d[_0x0bba('0x36')]=_0x217f0d[_0x0bba('0x36')][_0x0bba('0x37')]?_0x217f0d[_0x0bba('0x36')]:_0x3f4a74[_0x0bba('0x32')];if(_0x252138[_0x0bba('0x33')][_0x0bba('0x41')]){_0x217f0d[_0x0bba('0x42')]=[{'all':!![]}];}_0x217f0d=_[_0x0bba('0x3f')]({},_0x217f0d,_0x252138[_0x0bba('0x40')]);return db['Pause']['find'](_0x217f0d)[_0x0bba('0x25')](handleEntityNotFound(_0x4fc77d,null))['then'](respondWithResult(_0x4fc77d,null))[_0x0bba('0x44')](handleError(_0x4fc77d,null));};exports[_0x0bba('0x47')]=function(_0x37a68c,_0xaf2dda){return db[_0x0bba('0x2d')]['create'](_0x37a68c[_0x0bba('0x48')],{})[_0x0bba('0x25')](function(_0x32c7ef){var _0x301b35=_0x37a68c['user'][_0x0bba('0x27')]({'plain':!![]});if(!_0x301b35)throw new Error(_0x0bba('0x49'));if(_0x301b35['role']===_0x0bba('0x4a')){var _0x4139c9=_0x32c7ef[_0x0bba('0x27')]({'plain':!![]});var _0x18fffc='Pauses';return db['UserProfileSection'][_0x0bba('0x4b')]({'where':{'name':_0x18fffc,'userProfileId':_0x301b35[_0x0bba('0x4c')]},'raw':!![]})[_0x0bba('0x25')](function(_0x32590c){if(_0x32590c&&_0x32590c[_0x0bba('0x4d')]===0x0){return db[_0x0bba('0x29')][_0x0bba('0x47')]({'name':_0x4139c9['name'],'resourceId':_0x4139c9['id'],'type':_0x32590c[_0x0bba('0x2b')],'sectionId':_0x32590c['id']},{})[_0x0bba('0x25')](function(){return _0x32c7ef;});}else{return _0x32c7ef;}})[_0x0bba('0x44')](function(_0x234d8f){logger[_0x0bba('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x234d8f);throw _0x234d8f;});}return _0x32c7ef;})['then'](respondWithResult(_0xaf2dda,0xc9))[_0x0bba('0x44')](handleError(_0xaf2dda,null));};exports[_0x0bba('0x24')]=function(_0x5c0171,_0x328197){if(_0x5c0171[_0x0bba('0x48')]['id']){delete _0x5c0171[_0x0bba('0x48')]['id'];}return db['Pause'][_0x0bba('0x4b')]({'where':{'id':_0x5c0171[_0x0bba('0x4e')]['id']}})[_0x0bba('0x25')](handleEntityNotFound(_0x328197,null))[_0x0bba('0x25')](saveUpdates(_0x5c0171['body'],null))[_0x0bba('0x25')](respondWithResult(_0x328197,null))[_0x0bba('0x44')](handleError(_0x328197,null));};exports['destroy']=function(_0x338e42,_0x25fb27){return db[_0x0bba('0x2d')]['find']({'where':{'id':_0x338e42['params']['id']}})['then'](handleEntityNotFound(_0x25fb27,null))[_0x0bba('0x25')](removeEntity(_0x25fb27,null))['catch'](handleError(_0x25fb27,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index bcc19d4..d79d15e 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x328441,_0x18e515){var _0x5885c6=function(_0x1ec579){while(--_0x1ec579){_0x328441['push'](_0x328441['shift']());}};_0x5885c6(++_0x18e515);}(_0x53ec,0x192));var _0xc53e=function(_0x52c907,_0x5bb5cb){_0x52c907=_0x52c907-0x0;var _0x568c5a=_0x53ec[_0x52c907];return _0x568c5a;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 5493cf4..7ed882d 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x574109,_0x457421){var _0x1e605a=function(_0x585123){while(--_0x585123){_0x574109['push'](_0x574109['shift']());}};_0x1e605a(++_0x457421);}(_0xb10b,0x12a));var _0xbb10=function(_0x5912a0,_0x1f366f){_0x5912a0=_0x5912a0-0x0;var _0x1b69ea=_0xb10b[_0x5912a0];return _0x1b69ea;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x571433,_0x28da0c){var _0x12bc56=function(_0x5ec56a){while(--_0x5ec56a){_0x571433['push'](_0x571433['shift']());}};_0x12bc56(++_0x28da0c);}(_0xb10b,0x12a));var _0xbb10=function(_0x2c5eac,_0x319ede){_0x2c5eac=_0x2c5eac-0x0;var _0x13773d=_0xb10b[_0x2c5eac];return _0x13773d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index b762747..34c3645 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 _0xbd50=['extname','post','single','upload','webhookPost','put','/:id','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/webhook','webhookGet','show','download','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename'];(function(_0x333195,_0x366608){var _0x2e44de=function(_0x5c1dd7){while(--_0x5c1dd7){_0x333195['push'](_0x333195['shift']());}};_0x2e44de(++_0x366608);}(_0xbd50,0x196));var _0x0bd5=function(_0x1dc697,_0x443268){_0x1dc697=_0x1dc697-0x0;var _0xc24af4=_0xbd50[_0x1dc697];return _0xc24af4;};'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('./plugin.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),controller[_0x0bd5('0xc')]);router['get']('/:id',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router[_0x0bd5('0xa')]('/:id/download',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x210f45,_0x7db86e,_0x4d7d17){_0x4d7d17(null,path[_0x0bd5('0xf')](config[_0x0bd5('0x10')],_0x0bd5('0x11')));},'filename':function(_0x5f49ee,_0x2f7a0c,_0x23982f){_0x2f7a0c[_0x0bd5('0x12')]=_0x2f7a0c[_0x0bd5('0x12')][_0x0bd5('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x23982f(null,util[_0x0bd5('0x14')](_0x0bd5('0x15'),path[_0x0bd5('0x16')](_0x2f7a0c['originalname'],path[_0x0bd5('0x17')](_0x2f7a0c[_0x0bd5('0x12')])),Date['now'](),path[_0x0bd5('0x17')](_0x2f7a0c[_0x0bd5('0x12')])));}})});router[_0x0bd5('0x18')]('/',upload[_0x0bd5('0x19')]('file'),controller[_0x0bd5('0x1a')]);router[_0x0bd5('0x18')](_0x0bd5('0xb'),controller[_0x0bd5('0x1b')]);router[_0x0bd5('0x1c')](_0x0bd5('0x1d'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x1e')]);router[_0x0bd5('0x1f')](_0x0bd5('0x1d'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x1f')]);module[_0x0bd5('0x20')]=router; \ No newline at end of file +var _0x72b1=['./plugin.controller','get','isAuthenticated','index','/webhook','show','/:id/download','download','diskStorage','join','root','originalname','format','%s-%s%s','extname','now','post','single','file','upload','webhookPost','put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3ec5ab,_0x17b398){var _0x39e35e=function(_0x30d8a5){while(--_0x30d8a5){_0x3ec5ab['push'](_0x3ec5ab['shift']());}};_0x39e35e(++_0x17b398);}(_0x72b1,0x16e));var _0x172b=function(_0x27b97a,_0x3d93cd){_0x27b97a=_0x27b97a-0x0;var _0x10bee1=_0x72b1[_0x27b97a];return _0x10bee1;};'use strict';var multer=require(_0x172b('0x0'));var util=require('util');var path=require(_0x172b('0x1'));var timeout=require(_0x172b('0x2'));var express=require(_0x172b('0x3'));var router=express[_0x172b('0x4')]();var fs_extra=require(_0x172b('0x5'));var auth=require(_0x172b('0x6'));var interaction=require(_0x172b('0x7'));var config=require('../../config/environment');var controller=require(_0x172b('0x8'));router[_0x172b('0x9')]('/',auth[_0x172b('0xa')](),controller[_0x172b('0xb')]);router['get'](_0x172b('0xc'),controller['webhookGet']);router[_0x172b('0x9')]('/:id',auth[_0x172b('0xa')](),controller[_0x172b('0xd')]);router[_0x172b('0x9')](_0x172b('0xe'),auth['isAuthenticated'](),controller[_0x172b('0xf')]);var upload=multer({'storage':multer[_0x172b('0x10')]({'destination':function(_0x28aaad,_0x161c7c,_0xa4ada9){_0xa4ada9(null,path[_0x172b('0x11')](config[_0x172b('0x12')],'server/files/plugins'));},'filename':function(_0x13d285,_0x82727f,_0xdf832e){_0x82727f['originalname']=_0x82727f[_0x172b('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xdf832e(null,util[_0x172b('0x14')](_0x172b('0x15'),path['basename'](_0x82727f[_0x172b('0x13')],path[_0x172b('0x16')](_0x82727f[_0x172b('0x13')])),Date[_0x172b('0x17')](),path['extname'](_0x82727f['originalname'])));}})});router[_0x172b('0x18')]('/',upload[_0x172b('0x19')](_0x172b('0x1a')),controller[_0x172b('0x1b')]);router['post']('/webhook',controller[_0x172b('0x1c')]);router[_0x172b('0x1d')](_0x172b('0x1e'),auth[_0x172b('0xa')](),controller[_0x172b('0x1f')]);router['delete'](_0x172b('0x1e'),auth[_0x172b('0xa')](),controller[_0x172b('0x20')]);module[_0x172b('0x21')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index a469449..bc27b40 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 _0x213b=['agentOnly','always','sequelize','exports','ENUM','html','script','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x3c4f1f,_0x20d3ec){var _0x19cb69=function(_0x2e04bc){while(--_0x2e04bc){_0x3c4f1f['push'](_0x3c4f1f['shift']());}};_0x19cb69(++_0x20d3ec);}(_0x213b,0xd3));var _0xb213=function(_0x41a804,_0xcde371){_0x41a804=_0x41a804-0x0;var _0x26870d=_0x213b[_0x41a804];return _0x26870d;};'use strict';var Sequelize=require(_0xb213('0x0'));module[_0xb213('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb213('0x2')](_0xb213('0x3'),_0xb213('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xb213('0x5')],'comment':_0xb213('0x6')},'active':{'type':Sequelize[_0xb213('0x7')],'defaultValue':0x0,'comment':_0xb213('0x8')},'sidebar':{'type':Sequelize[_0xb213('0x2')]('adminOnly',_0xb213('0x9'),_0xb213('0xa'),'never'),'defaultValue':_0xb213('0xa'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xb213('0x5')]},'agentUrl':{'type':Sequelize[_0xb213('0x5')]},'scriptName':{'type':Sequelize[_0xb213('0x5')]},'scriptPath':{'type':Sequelize[_0xb213('0x5')]}}; \ No newline at end of file +var _0x592b=['always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','exports','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','never'];(function(_0x13188a,_0x2f635f){var _0x2f5716=function(_0x40d1b4){while(--_0x40d1b4){_0x13188a['push'](_0x13188a['shift']());}};_0x2f5716(++_0x2f635f);}(_0x592b,0x87));var _0xb592=function(_0x73ad2,_0x3c36a0){_0x73ad2=_0x73ad2-0x0;var _0x56c214=_0x592b[_0x73ad2];return _0x56c214;};'use strict';var Sequelize=require('sequelize');module[_0xb592('0x0')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb592('0x1')]('html',_0xb592('0x2'))},'description':{'type':Sequelize[_0xb592('0x3')]},'version':{'type':Sequelize[_0xb592('0x3')]},'path':{'type':Sequelize['STRING'],'comment':_0xb592('0x4')},'active':{'type':Sequelize[_0xb592('0x5')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xb592('0x1')](_0xb592('0x6'),_0xb592('0x7'),'always',_0xb592('0x8')),'defaultValue':_0xb592('0x9'),'comment':_0xb592('0xa')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xb592('0xb')]},'scriptPath':{'type':Sequelize[_0xb592('0xb')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index b9b8be6..1ed09b3 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 _0x400c=['key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','find','download','join','root','server/files/plugins','format','%s.zip','zip','code','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','pipe','glob','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','script','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','eml-format','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./plugin.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','then','get','Plugins','UserProfileResource','destroy','error','name','index','map','Plugin','rawAttributes','fieldName'];(function(_0x32d632,_0x12e78b){var _0x212157=function(_0x27f16e){while(--_0x27f16e){_0x32d632['push'](_0x32d632['shift']());}};_0x212157(++_0x12e78b);}(_0x400c,0x77));var _0xc400=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x400c[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0xc400('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc400('0x1'));var jsonpatch=require(_0xc400('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc400('0x3'));var util=require(_0xc400('0x4'));var path=require(_0xc400('0x5'));var sox=require('sox');var csv=require(_0xc400('0x6'));var ejs=require(_0xc400('0x7'));var fs=require('fs');var fs_extra=require(_0xc400('0x8'));var _=require('lodash');var squel=require(_0xc400('0x9'));var crypto=require(_0xc400('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc400('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc400('0xc'));var extract=require(_0xc400('0xd'));var rimraf=require('rimraf');var archiver=require(_0xc400('0xe'));var Redis=require(_0xc400('0xf'));var authService=require(_0xc400('0x10'));var qs=require(_0xc400('0x11'));var as=require(_0xc400('0x12'));var hardwareService=require(_0xc400('0x13'));var logger=require(_0xc400('0x14'))(_0xc400('0x15'));var utils=require(_0xc400('0x16'));var config=require(_0xc400('0x17'));var licenseUtil=require(_0xc400('0x18'));var db=require(_0xc400('0x19'))['db'];config[_0xc400('0x1a')]=_[_0xc400('0x1b')](config['redis'],{'host':_0xc400('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc400('0x1a')]));require(_0xc400('0x1d'))['register'](socket);function respondWithStatusCode(_0x1b98a8,_0x40da2b){_0x40da2b=_0x40da2b||0xcc;return function(_0x5bff4f){if(_0x5bff4f){return _0x1b98a8[_0xc400('0x1e')](_0x40da2b);}return _0x1b98a8[_0xc400('0x1f')](_0x40da2b)[_0xc400('0x20')]();};}function respondWithResult(_0x5309d7,_0x3386d2){_0x3386d2=_0x3386d2||0xc8;return function(_0x53d1b9){if(_0x53d1b9){return _0x5309d7[_0xc400('0x1f')](_0x3386d2)[_0xc400('0x21')](_0x53d1b9);}};}function respondWithFilteredResult(_0x139abb,_0x16cbd4){return function(_0x263205){if(_0x263205){var _0x8c5378=typeof _0x16cbd4[_0xc400('0x22')]===_0xc400('0x23')&&typeof _0x16cbd4[_0xc400('0x24')]===_0xc400('0x23');var _0x5040b3=_0x263205[_0xc400('0x25')];var _0x1ee0bc=_0x8c5378?0x0:_0x16cbd4[_0xc400('0x22')];var _0xedb740=_0x8c5378?_0x263205[_0xc400('0x25')]:_0x16cbd4[_0xc400('0x22')]+_0x16cbd4['limit'];var _0x39bbdd;if(_0xedb740>=_0x5040b3){_0xedb740=_0x5040b3;_0x39bbdd=0xc8;}else{_0x39bbdd=0xce;}_0x139abb[_0xc400('0x1f')](_0x39bbdd);return _0x139abb[_0xc400('0x26')]('Content-Range',_0x1ee0bc+'-'+_0xedb740+'/'+_0x5040b3)[_0xc400('0x21')](_0x263205);}return null;};}function patchUpdates(_0x1685bc){return function(_0x2acddb){try{jsonpatch['apply'](_0x2acddb,_0x1685bc,!![]);}catch(_0x1f8f8d){return BPromise[_0xc400('0x27')](_0x1f8f8d);}return _0x2acddb['save']();};}function saveUpdates(_0x38d3e7,_0x2fe949){return function(_0x1aa16d){if(_0x1aa16d){return _0x1aa16d['update'](_0x38d3e7)[_0xc400('0x28')](function(_0x387828){return _0x387828;});}return null;};}function removeEntity(_0x307487,_0xf1646b){return function(_0x54242d){if(_0x54242d){return _0x54242d['destroy']()[_0xc400('0x28')](function(){var _0x37000b=_0x54242d[_0xc400('0x29')]({'plain':!![]});var _0x4841da=_0xc400('0x2a');return db[_0xc400('0x2b')][_0xc400('0x2c')]({'where':{'type':_0x4841da,'resourceId':_0x37000b['id']}})[_0xc400('0x28')](function(){return _0x54242d;});})[_0xc400('0x28')](function(){_0x307487[_0xc400('0x1f')](0xcc)[_0xc400('0x20')]();});}};}function handleEntityNotFound(_0x39e492,_0x43c1e6){return function(_0x361a4e){if(!_0x361a4e){_0x39e492['sendStatus'](0x194);}return _0x361a4e;};}function handleError(_0x1e4f71,_0x38db3c){_0x38db3c=_0x38db3c||0x1f4;return function(_0x552a4b){logger[_0xc400('0x2d')](_0x552a4b['stack']);if(_0x552a4b[_0xc400('0x2e')]){delete _0x552a4b['name'];}_0x1e4f71['status'](_0x38db3c)['send'](_0x552a4b);};}exports[_0xc400('0x2f')]=function(_0x88c119,_0x59365c){var _0x165a85={},_0x7da130={},_0x464cd4={'count':0x0,'rows':[]};var _0x49181d=_[_0xc400('0x30')](db[_0xc400('0x31')][_0xc400('0x32')],function(_0x3f2504){return{'name':_0x3f2504[_0xc400('0x33')],'type':_0x3f2504['type'][_0xc400('0x34')]};});_0x7da130[_0xc400('0x35')]=_[_0xc400('0x30')](_0x49181d,_0xc400('0x2e'));_0x7da130[_0xc400('0x36')]=_[_0xc400('0x37')](_0x88c119[_0xc400('0x36')]);_0x7da130[_0xc400('0x38')]=_[_0xc400('0x39')](_0x7da130['model'],_0x7da130[_0xc400('0x36')]);_0x165a85['attributes']=_[_0xc400('0x39')](_0x7da130[_0xc400('0x35')],qs[_0xc400('0x3a')](_0x88c119[_0xc400('0x36')]['fields']));_0x165a85[_0xc400('0x3b')]=_0x165a85[_0xc400('0x3b')][_0xc400('0x3c')]?_0x165a85[_0xc400('0x3b')]:_0x7da130[_0xc400('0x35')];if(!_0x88c119['query'][_0xc400('0x3d')]('nolimit')){_0x165a85[_0xc400('0x24')]=qs[_0xc400('0x24')](_0x88c119[_0xc400('0x36')][_0xc400('0x24')]);_0x165a85[_0xc400('0x22')]=qs[_0xc400('0x22')](_0x88c119[_0xc400('0x36')][_0xc400('0x22')]);}_0x165a85[_0xc400('0x3e')]=qs['sort'](_0x88c119['query']['sort']);_0x165a85[_0xc400('0x3f')]=qs[_0xc400('0x38')](_[_0xc400('0x40')](_0x88c119['query'],_0x7da130[_0xc400('0x38')]),_0x49181d);if(_0x88c119[_0xc400('0x36')][_0xc400('0x41')]){_0x165a85['where']=_[_0xc400('0x42')](_0x165a85[_0xc400('0x3f')],{'$or':_['map'](_0x49181d,function(_0x7821e5){if(_0x7821e5[_0xc400('0x43')]!==_0xc400('0x44')){var _0x542560={};_0x542560[_0x7821e5[_0xc400('0x2e')]]={'$like':'%'+_0x88c119[_0xc400('0x36')][_0xc400('0x41')]+'%'};return _0x542560;}})});}_0x165a85=_[_0xc400('0x42')]({},_0x165a85,_0x88c119[_0xc400('0x45')]);var _0xbc2b0f={'where':_0x165a85[_0xc400('0x3f')]};return db[_0xc400('0x31')][_0xc400('0x25')](_0xbc2b0f)[_0xc400('0x28')](function(_0xa95ec2){_0x464cd4['count']=_0xa95ec2;if(_0x88c119[_0xc400('0x36')]['includeAll']){_0x165a85[_0xc400('0x46')]=[{'all':!![]}];}return db[_0xc400('0x31')][_0xc400('0x47')](_0x165a85);})[_0xc400('0x28')](function(_0xf041f){_0x464cd4[_0xc400('0x48')]=_0xf041f;return _0x464cd4;})[_0xc400('0x28')](respondWithFilteredResult(_0x59365c,_0x165a85))[_0xc400('0x49')](handleError(_0x59365c,null));};exports[_0xc400('0x4a')]=function(_0x4416b3,_0xe63096){var _0x1aad90={'raw':!![],'where':{'id':_0x4416b3[_0xc400('0x4b')]['id']}},_0x405543={};_0x405543[_0xc400('0x35')]=_[_0xc400('0x37')](db[_0xc400('0x31')]['rawAttributes']);_0x405543['query']=_[_0xc400('0x37')](_0x4416b3[_0xc400('0x36')]);_0x405543[_0xc400('0x38')]=_[_0xc400('0x39')](_0x405543[_0xc400('0x35')],_0x405543[_0xc400('0x36')]);_0x1aad90[_0xc400('0x3b')]=_[_0xc400('0x39')](_0x405543['model'],qs[_0xc400('0x3a')](_0x4416b3['query'][_0xc400('0x3a')]));_0x1aad90[_0xc400('0x3b')]=_0x1aad90[_0xc400('0x3b')][_0xc400('0x3c')]?_0x1aad90['attributes']:_0x405543[_0xc400('0x35')];if(_0x4416b3[_0xc400('0x36')]['includeAll']){_0x1aad90[_0xc400('0x46')]=[{'all':!![]}];}_0x1aad90=_[_0xc400('0x42')]({},_0x1aad90,_0x4416b3['options']);return db[_0xc400('0x31')][_0xc400('0x4c')](_0x1aad90)[_0xc400('0x28')](handleEntityNotFound(_0xe63096,null))[_0xc400('0x28')](respondWithResult(_0xe63096,null))[_0xc400('0x49')](handleError(_0xe63096,null));};exports[_0xc400('0x4d')]=function(_0x5b04b7,_0x22fcf0,_0x18a338){return db[_0xc400('0x31')]['find']({'where':{'id':_0x5b04b7[_0xc400('0x4b')]['id']},'attributes':[_0xc400('0x2e'),_0xc400('0x5')],'raw':!![]})[_0xc400('0x28')](handleEntityNotFound(_0x22fcf0,null))[_0xc400('0x28')](function(_0x3736ae){if(_0x3736ae){var _0x5147a5=path[_0xc400('0x4e')](config[_0xc400('0x4f')],_0xc400('0x50'),util[_0xc400('0x51')](_0xc400('0x52'),path['basename'](_0x3736ae['path'])));var _0x10121f=fs['createWriteStream'](_0x5147a5);var _0x3b6cd0=archiver(_0xc400('0x53'),{'zlib':{'level':0x9}});_0x3b6cd0['on']('warning',function(_0xec226){if(_0xec226[_0xc400('0x54')]==='ENOENT'){logger[_0xc400('0x2d')](_0xec226);}else{throw new db['Sequelize']['Error'](_0xc400('0x55'));}});_0x3b6cd0['on']('error',function(_0x1b6ff2){throw new db[(_0xc400('0x56'))][(_0xc400('0x57'))](_0xc400('0x55'));});_0x3b6cd0[_0xc400('0x58')](_0x10121f);_0x3b6cd0[_0xc400('0x59')]('**/*',{'cwd':path[_0xc400('0x4e')](config[_0xc400('0x4f')],_0xc400('0x50'),path[_0xc400('0x5a')](_0x3736ae[_0xc400('0x5')])),'ignore':[path[_0xc400('0x4e')](path[_0xc400('0x5b')](_0x3736ae[_0xc400('0x5')]),_0xc400('0x5c')),path[_0xc400('0x4e')](path[_0xc400('0x5b')](_0x3736ae[_0xc400('0x5')]),_0xc400('0x5d'))],'nodir':!![]})[_0xc400('0x5e')]();_0x10121f['on'](_0xc400('0x5f'),function(){if(!fs['existsSync'](_0x5147a5)){throw new db[(_0xc400('0x56'))][(_0xc400('0x57'))](_0xc400('0x60'));}return _0x22fcf0[_0xc400('0x4d')](_0x5147a5,util['format'](_0xc400('0x52'),path[_0xc400('0x5b')](_0x3736ae[_0xc400('0x5')])),function(_0x507f23){if(_0x507f23){throw new db['Sequelize'][(_0xc400('0x57'))](_0xc400('0x61'));}fs['unlinkSync'](_0x5147a5);logger[_0xc400('0x62')](_0xc400('0x63'));logger[_0xc400('0x62')](_0xc400('0x64'));});});}return null;})[_0xc400('0x49')](handleError(_0x22fcf0,null));};exports[_0xc400('0x65')]=function(_0x365d84,_0x59f1fc,_0x6d433c){var _0x4eb1d6=path[_0xc400('0x5b')](_0x365d84[_0xc400('0x66')][_0xc400('0x67')],path[_0xc400('0x68')](_0x365d84['file'][_0xc400('0x67')]));var _0x2b3c73=path['join'](config['root'],_0xc400('0x50'),_0x365d84[_0xc400('0x66')]['filename']);var _0x1870ca=path[_0xc400('0x4e')](config[_0xc400('0x4f')],_0xc400('0x50'),_0x4eb1d6);logger['info'](_0xc400('0x69'),_0x2b3c73);logger[_0xc400('0x62')](_0xc400('0x6a'),_0x1870ca);try{fs['chmodSync'](_0x2b3c73,parseInt('0777',0x8));extract(_0x2b3c73,{'dir':_0x1870ca},function(_0x24fbf2){if(_0x24fbf2){logger[_0xc400('0x2d')](_0x24fbf2);handleError(_0x24fbf2,!![]);};var _0x2b6d21=fs[_0xc400('0x6b')](_0x1870ca);if(_0x2b6d21[_0xc400('0x3c')]>0x1){removeReferences(_0x2b3c73,_0x1870ca);logger[_0xc400('0x2d')](_0xc400('0x6c'));return _0x6d433c(new Error(_0xc400('0x6c')));}var _0x269665=fs[_0xc400('0x6d')](path[_0xc400('0x4e')](_0x1870ca,_0x2b6d21[0x0]));if(_0x269665[_0xc400('0x6e')]()){removeReferences(_0x2b3c73,_0x1870ca);logger[_0xc400('0x2d')](_0xc400('0x6c'));return _0x6d433c(new Error(_0xc400('0x6c')));}if(_0x269665[_0xc400('0x6f')]()){var _0x3bc555=fs['readdirSync'](path['join'](_0x1870ca,_0x2b6d21[0x0]));if(_0x3bc555['length']===0x0){removeReferences(_0x2b3c73,_0x1870ca);logger['error'](_0xc400('0x6c'));return _0x6d433c(new Error(_0xc400('0x6c')));}var _0x94f5=_0x3bc555[_0xc400('0x70')](function(_0x308c94){return _0x308c94==='manifest.json';});if(!_0x94f5){return _0x6d433c(new Error(_0xc400('0x71')));}var _0x4eaa16=fs[_0xc400('0x72')](path[_0xc400('0x4e')](_0x1870ca,_0x2b6d21[0x0],_0xc400('0x73')));var _0x18562f=JSON[_0xc400('0x74')](_0x4eaa16);if('undefined'==typeof _0x18562f[_0xc400('0x2e')]){return _0x6d433c(new Error(_0xc400('0x75')));}if(_0xc400('0x23')==typeof _0x18562f['type']){return _0x6d433c(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xc400('0x23')==typeof _0x18562f[_0xc400('0x76')]){return _0x6d433c(new Error(_0xc400('0x77')));}if('undefined'==typeof _0x18562f[_0xc400('0x78')]){return _0x6d433c(new Error(_0xc400('0x79')));}if(_0x18562f['type']===_0xc400('0x7a')){if('undefined'==typeof _0x18562f[_0xc400('0x78')][_0xc400('0x7b')]){return _0x6d433c(new Error(_0xc400('0x7c')));}if('undefined'==typeof _0x18562f['parameters'][_0xc400('0x7b')][_0xc400('0x7d')]&&'undefined'==typeof _0x18562f[_0xc400('0x78')]['views'][_0xc400('0x7e')]){return _0x6d433c(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x18562f[_0xc400('0x43')]==='script'){if('undefined'==typeof _0x18562f['parameters'][_0xc400('0x7f')]){return _0x6d433c(new Error(_0xc400('0x80')));}if(_0xc400('0x23')==typeof _0x18562f['parameters'][_0xc400('0x81')]){return _0x6d433c(new Error(_0xc400('0x82')));}}else{return _0x6d433c(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x2dc549=_0x18562f[_0xc400('0x2e')];var _0x1b73be=_0x18562f[_0xc400('0x83')];var _0x385eea=_0x18562f[_0xc400('0x43')];var _0x51c409=_0x18562f[_0xc400('0x84')]?_0x18562f[_0xc400('0x84')]:_0xc400('0x85');var _0xded081=_0x18562f['icon']?_0x18562f[_0xc400('0x86')]:_0xc400('0x87');var _0x51ed2e='';var _0x1e9be5='';var _0x1fdd58='';var _0x5f3ea9='';var _0x141843=_0x18562f[_0xc400('0x76')];if(_0x385eea===_0xc400('0x7a')){if(_0xc400('0x23')!=typeof _0x18562f['parameters'][_0xc400('0x7b')][_0xc400('0x7d')]){var _0x5087bf=_0x18562f[_0xc400('0x78')][_0xc400('0x7b')][_0xc400('0x7d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x5087bf)){_0x51ed2e=path['join'](_0xc400('0x88'),_0x4eb1d6,_0x2b6d21[0x0],_0x5087bf);}else{_0x51ed2e=_0x5087bf;}}else{logger[_0xc400('0x62')](_0xc400('0x89'));}if(_0xc400('0x23')!=typeof _0x18562f['parameters'][_0xc400('0x7b')][_0xc400('0x7e')]){var _0x157fca=_0x18562f['parameters']['views'][_0xc400('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xc400('0x8a')](_0x157fca)){_0x1e9be5=path[_0xc400('0x4e')](_0xc400('0x88'),_0x4eb1d6,_0x2b6d21[0x0],_0x157fca);}else{_0x1e9be5=_0x157fca;}}else{logger[_0xc400('0x62')](_0xc400('0x8b'));}}else if(_0x385eea===_0xc400('0x8c')){_0x1fdd58=_0x18562f[_0xc400('0x78')][_0xc400('0x7f')];_0x5f3ea9=_0x18562f[_0xc400('0x78')]['scriptPath'];if(_0xc400('0x23')!=typeof _0x18562f[_0xc400('0x78')][_0xc400('0x7b')]){if(_0xc400('0x23')!=typeof _0x18562f[_0xc400('0x78')][_0xc400('0x7b')][_0xc400('0x7d')]){var _0x5087bf=_0x18562f[_0xc400('0x78')]['views'][_0xc400('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xc400('0x8a')](_0x5087bf)){_0x51ed2e=path[_0xc400('0x4e')]('plugins',_0x4eb1d6,_0x2b6d21[0x0],_0x5087bf);}else{_0x51ed2e=_0x5087bf;}}if(_0xc400('0x23')!=typeof _0x18562f['parameters']['views'][_0xc400('0x7e')]){var _0x157fca=_0x18562f[_0xc400('0x78')][_0xc400('0x7b')][_0xc400('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xc400('0x8a')](_0x157fca)){_0x1e9be5=path[_0xc400('0x4e')](_0xc400('0x88'),_0x4eb1d6,_0x2b6d21[0x0],_0x157fca);}else{_0x1e9be5=_0x157fca;}}}}var _0x5d3c62={'name':_0x2dc549,'description':_0x1b73be,'path':path[_0xc400('0x4e')](_0x4eb1d6,_0x2b6d21[0x0]),'type':_0x385eea,'sidebar':_0x51c409,'icon':_0xded081,'adminUrl':_0x51ed2e,'agentUrl':_0x1e9be5,'scriptName':_0x1fdd58,'scriptPath':_0x5f3ea9,'version':_0x141843};removeReferences(_0x2b3c73,null);return db['Plugin'][_0xc400('0x8d')](_0x5d3c62)[_0xc400('0x28')](function(_0x1f157f){var _0x4cd38a={'role':_0x365d84['body']['role'],'userProfileId':_0x365d84[_0xc400('0x8e')][_0xc400('0x8f')]};if(!_0x4cd38a)throw new Error(_0xc400('0x90'));if(_0x4cd38a[_0xc400('0x91')]===_0xc400('0x92')){var _0x4f5f73=_0x1f157f['get']({'plain':!![]});return db[_0xc400('0x93')][_0xc400('0x4c')]({'where':{'name':_0xc400('0x2a'),'userProfileId':_0x4cd38a[_0xc400('0x8f')]},'raw':!![]})['then'](function(_0x38c38a){if(_0x38c38a&&_0x38c38a[_0xc400('0x94')]===0x0){return db['UserProfileResource'][_0xc400('0x8d')]({'name':_0x4f5f73[_0xc400('0x2e')],'resourceId':_0x4f5f73['id'],'type':_0x38c38a[_0xc400('0x2e')],'sectionId':_0x38c38a['id']},{})['then'](function(){return _0x1f157f;});}else{return _0x1f157f;}})[_0xc400('0x49')](function(_0x52e001){logger[_0xc400('0x2d')](_0xc400('0x95'),_0x52e001);throw _0x52e001;});}return _0x1f157f;})[_0xc400('0x28')](respondWithResult(_0x59f1fc,null))['catch'](handleError(_0x59f1fc,null));}});}catch(_0x5d4c43){_0x59f1fc[_0xc400('0x1f')](0x1f4)[_0xc400('0x96')](_0x5d4c43);}};function removeReferences(_0x1e51af,_0x4305d6){try{if(_0x1e51af){fs[_0xc400('0x97')](_0x1e51af);logger['info'](_0xc400('0x98'));}if(_0x4305d6){rimraf(_0x4305d6,function(){});logger[_0xc400('0x62')](_0xc400('0x99'));}}catch(_0x1923b2){logger['error'](_0x1923b2);}}exports[_0xc400('0x9a')]=function(_0x5b15bd,_0xf1fc1c,_0x4ee8c8){return db['Plugin'][_0xc400('0x4c')]({'where':{'id':_0x5b15bd[_0xc400('0x4b')]['id']}})[_0xc400('0x28')](handleEntityNotFound(_0xf1fc1c,null))[_0xc400('0x28')](saveUpdates(_0x5b15bd[_0xc400('0x8e')],null))[_0xc400('0x28')](respondWithResult(_0xf1fc1c,null))[_0xc400('0x49')](handleError(_0xf1fc1c,null));};exports[_0xc400('0x9b')]=function(_0x507e58,_0x5bbae9,_0x1d7d3a){return db[_0xc400('0x31')][_0xc400('0x4c')]({'where':{'id':_0x507e58[_0xc400('0x4b')]['id']}})[_0xc400('0x28')](function(_0x5cdd53){if(_0x5cdd53){return _0x5cdd53[_0xc400('0x2c')]();}})['then'](function(_0x5d21be){rimraf(path[_0xc400('0x4e')](config['root'],_0xc400('0x50'),path[_0xc400('0x5a')](_0x5d21be[_0xc400('0x5')])),function(){});return _0x5d21be;})[_0xc400('0x28')](handleEntityNotFound(_0x5bbae9,null))[_0xc400('0x28')](respondWithStatusCode(_0x5bbae9,null))[_0xc400('0x49')](handleError(_0x5bbae9,null));};exports[_0xc400('0x9c')]=function(_0x212068,_0x4427a7,_0x571fa0){return BPromise[_0xc400('0x9d')]()['then'](function(){if(!_0x212068[_0xc400('0x36')][_0xc400('0x5')]){throw new Error(_0xc400('0x9e'));}if(!_0x212068[_0xc400('0x36')][_0xc400('0x9f')]){throw new Error(_0xc400('0xa0'));}var _0x308cfe=_0x212068[_0xc400('0x36')][_0xc400('0xa1')]?_0x212068[_0xc400('0x36')]['hostname']+':'+_0x212068[_0xc400('0x36')][_0xc400('0x9f')]:_0xc400('0xa2')+_0x212068['query'][_0xc400('0x9f')];var _0x4d046=_0x212068[_0xc400('0x36')][_0xc400('0x21')]?_0x212068[_0xc400('0x36')][_0xc400('0x21')]:!![];var _0x325f9d=_0x212068[_0xc400('0x36')][_0xc400('0xa3')]?_0x212068[_0xc400('0x36')]['encoding']:null;var _0x12e677={'method':_0x212068[_0xc400('0xa4')],'uri':util[_0xc400('0x51')](_0xc400('0xa5'),_0x308cfe,_0x212068[_0xc400('0x36')][_0xc400('0x5')]),'json':_0x4d046,'resolveWithFullResponse':!![],'encoding':_0x325f9d,'qs':_0x212068[_0xc400('0x36')]};if(_0x212068['headers']){_0x12e677[_0xc400('0xa6')]=_0x212068[_0xc400('0xa6')];if(_0x12e677['headers']['content-length']){delete _0x12e677[_0xc400('0xa6')][_0xc400('0xa7')];}}if(_0x12e677[_0xc400('0xa6')][_0xc400('0xa8')]){delete _0x12e677['headers'][_0xc400('0xa8')];}return rp(_0x12e677);})[_0xc400('0x28')](function(_0x24508f){if(_0x24508f){_0x4427a7[_0xc400('0x26')](_0x24508f[_0xc400('0xa6')]);logger[_0xc400('0x62')](_0x24508f[_0xc400('0x8e')]);if(_[_0xc400('0xa9')](_0x212068['query'][_0xc400('0x5')],'download')&&_0x24508f[_0xc400('0xaa')]==0x1f4){return _0x4427a7['sendStatus'](_0x24508f['statusCode']);}else{return _0x4427a7['status'](_0x24508f[_0xc400('0xaa')])['send'](_0x24508f[_0xc400('0x8e')]);}}else{return _0x4427a7[_0xc400('0x1e')](0xc8);}})[_0xc400('0x49')](handleError(_0x4427a7,null));};exports['webhookPost']=function(_0x229380,_0x5460f8,_0xcaae2){return BPromise['resolve']()[_0xc400('0x28')](function(){if(!_0x229380[_0xc400('0x36')]['path']){throw new Error(_0xc400('0x9e'));}if(!_0x229380[_0xc400('0x36')]['port']){throw new Error(_0xc400('0xa0'));}var _0x1c16bd=_0x229380[_0xc400('0x36')][_0xc400('0xa1')]?_0x229380[_0xc400('0x36')][_0xc400('0xa1')]+':'+_0x229380[_0xc400('0x36')][_0xc400('0x9f')]:_0xc400('0xa2')+_0x229380['query'][_0xc400('0x9f')];var _0x516795=_0x229380[_0xc400('0x36')][_0xc400('0x21')]?_0x229380[_0xc400('0x36')][_0xc400('0x21')]:!![];var _0x565fb8=_0x229380['query']['encoding']?_0x229380[_0xc400('0x36')]['encoding']:null;var _0x10cc6d={'method':_0x229380[_0xc400('0xa4')],'uri':util[_0xc400('0x51')](_0xc400('0xa5'),_0x1c16bd,_0x229380[_0xc400('0x36')][_0xc400('0x5')]),'json':_0x516795,'resolveWithFullResponse':!![],'encoding':_0x565fb8,'body':_0x229380[_0xc400('0x8e')]};if(_0x229380[_0xc400('0xa6')]){_0x10cc6d[_0xc400('0xa6')]=_0x229380['headers'];if(_0x10cc6d[_0xc400('0xa6')][_0xc400('0xa7')]){delete _0x10cc6d[_0xc400('0xa6')][_0xc400('0xa7')];}}if(_0x10cc6d['headers'][_0xc400('0xa8')]){delete _0x10cc6d['headers']['content-type'];}return rp(_0x10cc6d);})[_0xc400('0x28')](function(_0x465515){if(_0x465515){_0x5460f8['set'](_0x465515['headers']);logger['info'](_0x465515[_0xc400('0x8e')]);return _0x5460f8[_0xc400('0x1f')](_0x465515['statusCode'])[_0xc400('0x96')](_0x465515[_0xc400('0x8e')]);}else{return _0x5460f8['sendStatus'](0xc8);}})[_0xc400('0x49')](handleError(_0x5460f8,null));}; \ No newline at end of file +var _0x7b6d=['end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','Plugin','rawAttributes','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','catch','params','length','includeAll','find','download','join','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','dirname','node_modules/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','format','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status'];(function(_0x49f24a,_0x3f8da0){var _0x41ae25=function(_0xb08e2a){while(--_0xb08e2a){_0x49f24a['push'](_0x49f24a['shift']());}};_0x41ae25(++_0x3f8da0);}(_0x7b6d,0x138));var _0xd7b6=function(_0x26fc89,_0x5f06cd){_0x26fc89=_0x26fc89-0x0;var _0x3d27a9=_0x7b6d[_0x26fc89];return _0x3d27a9;};'use strict';var emlformat=require(_0xd7b6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd7b6('0x1'));var jsonpatch=require(_0xd7b6('0x2'));var rp=require(_0xd7b6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd7b6('0x4'));var util=require('util');var path=require(_0xd7b6('0x5'));var sox=require(_0xd7b6('0x6'));var csv=require('to-csv');var ejs=require(_0xd7b6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd7b6('0x8'));var squel=require(_0xd7b6('0x9'));var crypto=require(_0xd7b6('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd7b6('0xb'));var querystring=require(_0xd7b6('0xc'));var Papa=require(_0xd7b6('0xd'));var extract=require('extract-zip');var rimraf=require(_0xd7b6('0xe'));var archiver=require(_0xd7b6('0xf'));var Redis=require(_0xd7b6('0x10'));var authService=require(_0xd7b6('0x11'));var qs=require(_0xd7b6('0x12'));var as=require(_0xd7b6('0x13'));var hardwareService=require(_0xd7b6('0x14'));var logger=require('../../config/logger')(_0xd7b6('0x15'));var utils=require(_0xd7b6('0x16'));var config=require(_0xd7b6('0x17'));var licenseUtil=require(_0xd7b6('0x18'));var db=require(_0xd7b6('0x19'))['db'];config[_0xd7b6('0x1a')]=_[_0xd7b6('0x1b')](config[_0xd7b6('0x1a')],{'host':_0xd7b6('0x1c'),'port':0x18eb});var socket=require(_0xd7b6('0x1d'))(new Redis(config[_0xd7b6('0x1a')]));require(_0xd7b6('0x1e'))[_0xd7b6('0x1f')](socket);function respondWithStatusCode(_0x424f98,_0x2182d3){_0x2182d3=_0x2182d3||0xcc;return function(_0x29b4b4){if(_0x29b4b4){return _0x424f98[_0xd7b6('0x20')](_0x2182d3);}return _0x424f98[_0xd7b6('0x21')](_0x2182d3)[_0xd7b6('0x22')]();};}function respondWithResult(_0x431c9d,_0x3f39c2){_0x3f39c2=_0x3f39c2||0xc8;return function(_0x377957){if(_0x377957){return _0x431c9d['status'](_0x3f39c2)[_0xd7b6('0x23')](_0x377957);}};}function respondWithFilteredResult(_0x44cac3,_0x2f76ab){return function(_0x25b7e0){if(_0x25b7e0){var _0x35b1ee=typeof _0x2f76ab[_0xd7b6('0x24')]===_0xd7b6('0x25')&&typeof _0x2f76ab[_0xd7b6('0x26')]===_0xd7b6('0x25');var _0x5e7b16=_0x25b7e0[_0xd7b6('0x27')];var _0x55a94b=_0x35b1ee?0x0:_0x2f76ab[_0xd7b6('0x24')];var _0x1002cd=_0x35b1ee?_0x25b7e0[_0xd7b6('0x27')]:_0x2f76ab[_0xd7b6('0x24')]+_0x2f76ab[_0xd7b6('0x26')];var _0x2d3a22;if(_0x1002cd>=_0x5e7b16){_0x1002cd=_0x5e7b16;_0x2d3a22=0xc8;}else{_0x2d3a22=0xce;}_0x44cac3[_0xd7b6('0x21')](_0x2d3a22);return _0x44cac3[_0xd7b6('0x28')]('Content-Range',_0x55a94b+'-'+_0x1002cd+'/'+_0x5e7b16)[_0xd7b6('0x23')](_0x25b7e0);}return null;};}function patchUpdates(_0x388dce){return function(_0x5cb82a){try{jsonpatch['apply'](_0x5cb82a,_0x388dce,!![]);}catch(_0x3d9453){return BPromise[_0xd7b6('0x29')](_0x3d9453);}return _0x5cb82a[_0xd7b6('0x2a')]();};}function saveUpdates(_0x52bb62,_0x4e2886){return function(_0x5224c2){if(_0x5224c2){return _0x5224c2[_0xd7b6('0x2b')](_0x52bb62)[_0xd7b6('0x2c')](function(_0x10d802){return _0x10d802;});}return null;};}function removeEntity(_0x34f4ca,_0x142377){return function(_0x33bd70){if(_0x33bd70){return _0x33bd70[_0xd7b6('0x2d')]()['then'](function(){var _0x274b77=_0x33bd70[_0xd7b6('0x2e')]({'plain':!![]});var _0x51973d=_0xd7b6('0x2f');return db[_0xd7b6('0x30')][_0xd7b6('0x2d')]({'where':{'type':_0x51973d,'resourceId':_0x274b77['id']}})[_0xd7b6('0x2c')](function(){return _0x33bd70;});})['then'](function(){_0x34f4ca['status'](0xcc)[_0xd7b6('0x22')]();});}};}function handleEntityNotFound(_0x13775f,_0x58a4b5){return function(_0x2883c1){if(!_0x2883c1){_0x13775f[_0xd7b6('0x20')](0x194);}return _0x2883c1;};}function handleError(_0x3f66e3,_0x5d382c){_0x5d382c=_0x5d382c||0x1f4;return function(_0x331051){logger[_0xd7b6('0x31')](_0x331051[_0xd7b6('0x32')]);if(_0x331051[_0xd7b6('0x33')]){delete _0x331051['name'];}_0x3f66e3[_0xd7b6('0x21')](_0x5d382c)[_0xd7b6('0x34')](_0x331051);};}exports[_0xd7b6('0x35')]=function(_0x230cb0,_0x1060ec){var _0x265dd5={},_0x277858={},_0x531631={'count':0x0,'rows':[]};var _0x1e8bd4=_['map'](db[_0xd7b6('0x36')][_0xd7b6('0x37')],function(_0x5696a0){return{'name':_0x5696a0['fieldName'],'type':_0x5696a0['type'][_0xd7b6('0x38')]};});_0x277858[_0xd7b6('0x39')]=_[_0xd7b6('0x3a')](_0x1e8bd4,_0xd7b6('0x33'));_0x277858[_0xd7b6('0x3b')]=_[_0xd7b6('0x3c')](_0x230cb0[_0xd7b6('0x3b')]);_0x277858[_0xd7b6('0x3d')]=_[_0xd7b6('0x3e')](_0x277858[_0xd7b6('0x39')],_0x277858[_0xd7b6('0x3b')]);_0x265dd5['attributes']=_[_0xd7b6('0x3e')](_0x277858[_0xd7b6('0x39')],qs['fields'](_0x230cb0[_0xd7b6('0x3b')][_0xd7b6('0x3f')]));_0x265dd5[_0xd7b6('0x40')]=_0x265dd5[_0xd7b6('0x40')]['length']?_0x265dd5[_0xd7b6('0x40')]:_0x277858['model'];if(!_0x230cb0[_0xd7b6('0x3b')][_0xd7b6('0x41')]('nolimit')){_0x265dd5['limit']=qs[_0xd7b6('0x26')](_0x230cb0[_0xd7b6('0x3b')]['limit']);_0x265dd5[_0xd7b6('0x24')]=qs[_0xd7b6('0x24')](_0x230cb0[_0xd7b6('0x3b')]['offset']);}_0x265dd5[_0xd7b6('0x42')]=qs[_0xd7b6('0x43')](_0x230cb0[_0xd7b6('0x3b')][_0xd7b6('0x43')]);_0x265dd5[_0xd7b6('0x44')]=qs[_0xd7b6('0x3d')](_[_0xd7b6('0x45')](_0x230cb0[_0xd7b6('0x3b')],_0x277858[_0xd7b6('0x3d')]),_0x1e8bd4);if(_0x230cb0['query'][_0xd7b6('0x46')]){_0x265dd5[_0xd7b6('0x44')]=_[_0xd7b6('0x47')](_0x265dd5[_0xd7b6('0x44')],{'$or':_[_0xd7b6('0x3a')](_0x1e8bd4,function(_0x5c0acc){if(_0x5c0acc[_0xd7b6('0x48')]!==_0xd7b6('0x49')){var _0x1804a1={};_0x1804a1[_0x5c0acc[_0xd7b6('0x33')]]={'$like':'%'+_0x230cb0['query'][_0xd7b6('0x46')]+'%'};return _0x1804a1;}})});}_0x265dd5=_[_0xd7b6('0x47')]({},_0x265dd5,_0x230cb0[_0xd7b6('0x4a')]);var _0xbd2c98={'where':_0x265dd5[_0xd7b6('0x44')]};return db[_0xd7b6('0x36')][_0xd7b6('0x27')](_0xbd2c98)[_0xd7b6('0x2c')](function(_0xe8d696){_0x531631[_0xd7b6('0x27')]=_0xe8d696;if(_0x230cb0[_0xd7b6('0x3b')]['includeAll']){_0x265dd5[_0xd7b6('0x4b')]=[{'all':!![]}];}return db[_0xd7b6('0x36')]['findAll'](_0x265dd5);})['then'](function(_0x51f529){_0x531631[_0xd7b6('0x4c')]=_0x51f529;return _0x531631;})['then'](respondWithFilteredResult(_0x1060ec,_0x265dd5))[_0xd7b6('0x4d')](handleError(_0x1060ec,null));};exports['show']=function(_0x57fd37,_0x3ebcb2){var _0x1a79e2={'raw':!![],'where':{'id':_0x57fd37[_0xd7b6('0x4e')]['id']}},_0x111163={};_0x111163[_0xd7b6('0x39')]=_['keys'](db[_0xd7b6('0x36')][_0xd7b6('0x37')]);_0x111163[_0xd7b6('0x3b')]=_[_0xd7b6('0x3c')](_0x57fd37[_0xd7b6('0x3b')]);_0x111163[_0xd7b6('0x3d')]=_[_0xd7b6('0x3e')](_0x111163['model'],_0x111163[_0xd7b6('0x3b')]);_0x1a79e2['attributes']=_[_0xd7b6('0x3e')](_0x111163['model'],qs[_0xd7b6('0x3f')](_0x57fd37[_0xd7b6('0x3b')]['fields']));_0x1a79e2[_0xd7b6('0x40')]=_0x1a79e2[_0xd7b6('0x40')][_0xd7b6('0x4f')]?_0x1a79e2[_0xd7b6('0x40')]:_0x111163['model'];if(_0x57fd37[_0xd7b6('0x3b')][_0xd7b6('0x50')]){_0x1a79e2[_0xd7b6('0x4b')]=[{'all':!![]}];}_0x1a79e2=_[_0xd7b6('0x47')]({},_0x1a79e2,_0x57fd37['options']);return db['Plugin'][_0xd7b6('0x51')](_0x1a79e2)[_0xd7b6('0x2c')](handleEntityNotFound(_0x3ebcb2,null))[_0xd7b6('0x2c')](respondWithResult(_0x3ebcb2,null))[_0xd7b6('0x4d')](handleError(_0x3ebcb2,null));};exports[_0xd7b6('0x52')]=function(_0x181fef,_0x321180,_0xbd3bb2){return db['Plugin'][_0xd7b6('0x51')]({'where':{'id':_0x181fef[_0xd7b6('0x4e')]['id']},'attributes':['name',_0xd7b6('0x5')],'raw':!![]})['then'](handleEntityNotFound(_0x321180,null))[_0xd7b6('0x2c')](function(_0x17273e){if(_0x17273e){var _0x278740=path[_0xd7b6('0x53')](config[_0xd7b6('0x54')],_0xd7b6('0x55'),util['format'](_0xd7b6('0x56'),path[_0xd7b6('0x57')](_0x17273e[_0xd7b6('0x5')])));var _0x622a39=fs[_0xd7b6('0x58')](_0x278740);var _0x582962=archiver(_0xd7b6('0x59'),{'zlib':{'level':0x9}});_0x582962['on']('warning',function(_0x5d20c7){if(_0x5d20c7[_0xd7b6('0x5a')]===_0xd7b6('0x5b')){logger[_0xd7b6('0x31')](_0x5d20c7);}else{throw new db[(_0xd7b6('0x5c'))][(_0xd7b6('0x5d'))](_0xd7b6('0x5e'));}});_0x582962['on']('error',function(_0x2e6994){throw new db[(_0xd7b6('0x5c'))][(_0xd7b6('0x5d'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x582962['pipe'](_0x622a39);_0x582962[_0xd7b6('0x5f')](_0xd7b6('0x60'),{'cwd':path[_0xd7b6('0x53')](config[_0xd7b6('0x54')],_0xd7b6('0x55'),path[_0xd7b6('0x61')](_0x17273e[_0xd7b6('0x5')])),'ignore':[path[_0xd7b6('0x53')](path[_0xd7b6('0x57')](_0x17273e[_0xd7b6('0x5')]),_0xd7b6('0x62')),path[_0xd7b6('0x53')](path['basename'](_0x17273e[_0xd7b6('0x5')]),'attachments/**/*')],'nodir':!![]})[_0xd7b6('0x63')]();_0x622a39['on']('close',function(){if(!fs[_0xd7b6('0x64')](_0x278740)){throw new db[(_0xd7b6('0x5c'))][(_0xd7b6('0x5d'))](_0xd7b6('0x65'));}return _0x321180[_0xd7b6('0x52')](_0x278740,util['format'](_0xd7b6('0x56'),path[_0xd7b6('0x57')](_0x17273e['path'])),function(_0x2ce578){if(_0x2ce578){throw new db[(_0xd7b6('0x5c'))]['Error'](_0xd7b6('0x66'));}fs[_0xd7b6('0x67')](_0x278740);logger['info'](_0xd7b6('0x68'));logger[_0xd7b6('0x69')](_0xd7b6('0x6a'));});});}return null;})[_0xd7b6('0x4d')](handleError(_0x321180,null));};exports[_0xd7b6('0x6b')]=function(_0x55f7a3,_0xebc1a,_0x69b23e){var _0x53e9ce=path[_0xd7b6('0x57')](_0x55f7a3[_0xd7b6('0x6c')][_0xd7b6('0x6d')],path[_0xd7b6('0x6e')](_0x55f7a3[_0xd7b6('0x6c')]['filename']));var _0x2d83d=path[_0xd7b6('0x53')](config[_0xd7b6('0x54')],_0xd7b6('0x55'),_0x55f7a3[_0xd7b6('0x6c')][_0xd7b6('0x6d')]);var _0x3c73a1=path[_0xd7b6('0x53')](config[_0xd7b6('0x54')],_0xd7b6('0x55'),_0x53e9ce);logger[_0xd7b6('0x69')](_0xd7b6('0x6f'),_0x2d83d);logger[_0xd7b6('0x69')](_0xd7b6('0x70'),_0x3c73a1);try{fs['chmodSync'](_0x2d83d,parseInt(_0xd7b6('0x71'),0x8));extract(_0x2d83d,{'dir':_0x3c73a1},function(_0xb13427){if(_0xb13427){logger[_0xd7b6('0x31')](_0xb13427);handleError(_0xb13427,!![]);};var _0x28cf8a=fs[_0xd7b6('0x72')](_0x3c73a1);if(_0x28cf8a[_0xd7b6('0x4f')]>0x1){removeReferences(_0x2d83d,_0x3c73a1);logger[_0xd7b6('0x31')](_0xd7b6('0x73'));return _0x69b23e(new Error(_0xd7b6('0x73')));}var _0x5cb0d4=fs[_0xd7b6('0x74')](path['join'](_0x3c73a1,_0x28cf8a[0x0]));if(_0x5cb0d4[_0xd7b6('0x75')]()){removeReferences(_0x2d83d,_0x3c73a1);logger[_0xd7b6('0x31')](_0xd7b6('0x73'));return _0x69b23e(new Error(_0xd7b6('0x73')));}if(_0x5cb0d4['isDirectory']()){var _0x1371a7=fs['readdirSync'](path[_0xd7b6('0x53')](_0x3c73a1,_0x28cf8a[0x0]));if(_0x1371a7[_0xd7b6('0x4f')]===0x0){removeReferences(_0x2d83d,_0x3c73a1);logger[_0xd7b6('0x31')]('Invalid\x20plugin\x20structure');return _0x69b23e(new Error(_0xd7b6('0x73')));}var _0x189bfe=_0x1371a7['some'](function(_0x5d3c3b){return _0x5d3c3b===_0xd7b6('0x76');});if(!_0x189bfe){return _0x69b23e(new Error(_0xd7b6('0x77')));}var _0x4d38cf=fs[_0xd7b6('0x78')](path[_0xd7b6('0x53')](_0x3c73a1,_0x28cf8a[0x0],_0xd7b6('0x76')));var _0x845832=JSON[_0xd7b6('0x79')](_0x4d38cf);if(_0xd7b6('0x25')==typeof _0x845832[_0xd7b6('0x33')]){return _0x69b23e(new Error(_0xd7b6('0x7a')));}if(_0xd7b6('0x25')==typeof _0x845832[_0xd7b6('0x48')]){return _0x69b23e(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xd7b6('0x25')==typeof _0x845832[_0xd7b6('0x7b')]){return _0x69b23e(new Error(_0xd7b6('0x7c')));}if(_0xd7b6('0x25')==typeof _0x845832[_0xd7b6('0x7d')]){return _0x69b23e(new Error(_0xd7b6('0x7e')));}if(_0x845832[_0xd7b6('0x48')]===_0xd7b6('0x7f')){if(_0xd7b6('0x25')==typeof _0x845832[_0xd7b6('0x7d')][_0xd7b6('0x80')]){return _0x69b23e(new Error(_0xd7b6('0x81')));}if(_0xd7b6('0x25')==typeof _0x845832[_0xd7b6('0x7d')][_0xd7b6('0x80')][_0xd7b6('0x82')]&&_0xd7b6('0x25')==typeof _0x845832[_0xd7b6('0x7d')][_0xd7b6('0x80')]['agent']){return _0x69b23e(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x845832[_0xd7b6('0x48')]===_0xd7b6('0x83')){if(_0xd7b6('0x25')==typeof _0x845832['parameters'][_0xd7b6('0x84')]){return _0x69b23e(new Error(_0xd7b6('0x85')));}if(_0xd7b6('0x25')==typeof _0x845832[_0xd7b6('0x7d')]['scriptPath']){return _0x69b23e(new Error(_0xd7b6('0x86')));}}else{return _0x69b23e(new Error(_0xd7b6('0x87')));}var _0x2bd8b1=_0x845832[_0xd7b6('0x33')];var _0x190a74=_0x845832[_0xd7b6('0x88')];var _0x478641=_0x845832[_0xd7b6('0x48')];var _0x399ff6=_0x845832['sidebar']?_0x845832['sidebar']:_0xd7b6('0x89');var _0x4da6b4=_0x845832[_0xd7b6('0x8a')]?_0x845832[_0xd7b6('0x8a')]:_0xd7b6('0x8b');var _0x79792d='';var _0x214028='';var _0x1e6a22='';var _0x49d973='';var _0xad9765=_0x845832[_0xd7b6('0x7b')];if(_0x478641===_0xd7b6('0x7f')){if(_0xd7b6('0x25')!=typeof _0x845832[_0xd7b6('0x7d')][_0xd7b6('0x80')][_0xd7b6('0x82')]){var _0x261244=_0x845832[_0xd7b6('0x7d')][_0xd7b6('0x80')][_0xd7b6('0x82')];if(!/^(f|ht)tps?:\/\//i[_0xd7b6('0x8c')](_0x261244)){_0x79792d=path['join'](_0xd7b6('0x8d'),_0x53e9ce,_0x28cf8a[0x0],_0x261244);}else{_0x79792d=_0x261244;}}else{logger[_0xd7b6('0x69')](_0xd7b6('0x8e'));}if(_0xd7b6('0x25')!=typeof _0x845832[_0xd7b6('0x7d')][_0xd7b6('0x80')]['agent']){var _0x2ea6cc=_0x845832[_0xd7b6('0x7d')][_0xd7b6('0x80')][_0xd7b6('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0xd7b6('0x8c')](_0x2ea6cc)){_0x214028=path[_0xd7b6('0x53')](_0xd7b6('0x8d'),_0x53e9ce,_0x28cf8a[0x0],_0x2ea6cc);}else{_0x214028=_0x2ea6cc;}}else{logger[_0xd7b6('0x69')](_0xd7b6('0x90'));}}else if(_0x478641===_0xd7b6('0x83')){_0x1e6a22=_0x845832[_0xd7b6('0x7d')]['scriptName'];_0x49d973=_0x845832[_0xd7b6('0x7d')][_0xd7b6('0x91')];if(_0xd7b6('0x25')!=typeof _0x845832[_0xd7b6('0x7d')][_0xd7b6('0x80')]){if(_0xd7b6('0x25')!=typeof _0x845832[_0xd7b6('0x7d')]['views']['admin']){var _0x261244=_0x845832[_0xd7b6('0x7d')][_0xd7b6('0x80')][_0xd7b6('0x82')];if(!/^(f|ht)tps?:\/\//i[_0xd7b6('0x8c')](_0x261244)){_0x79792d=path[_0xd7b6('0x53')](_0xd7b6('0x8d'),_0x53e9ce,_0x28cf8a[0x0],_0x261244);}else{_0x79792d=_0x261244;}}if(_0xd7b6('0x25')!=typeof _0x845832[_0xd7b6('0x7d')][_0xd7b6('0x80')][_0xd7b6('0x8f')]){var _0x2ea6cc=_0x845832[_0xd7b6('0x7d')][_0xd7b6('0x80')][_0xd7b6('0x8f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2ea6cc)){_0x214028=path[_0xd7b6('0x53')](_0xd7b6('0x8d'),_0x53e9ce,_0x28cf8a[0x0],_0x2ea6cc);}else{_0x214028=_0x2ea6cc;}}}}var _0x4ffd37={'name':_0x2bd8b1,'description':_0x190a74,'path':path[_0xd7b6('0x53')](_0x53e9ce,_0x28cf8a[0x0]),'type':_0x478641,'sidebar':_0x399ff6,'icon':_0x4da6b4,'adminUrl':_0x79792d,'agentUrl':_0x214028,'scriptName':_0x1e6a22,'scriptPath':_0x49d973,'version':_0xad9765};removeReferences(_0x2d83d,null);return db[_0xd7b6('0x36')][_0xd7b6('0x92')](_0x4ffd37)[_0xd7b6('0x2c')](function(_0x16e007){var _0x3dccb7={'role':_0x55f7a3[_0xd7b6('0x93')][_0xd7b6('0x94')],'userProfileId':_0x55f7a3[_0xd7b6('0x93')]['userProfileId']};if(!_0x3dccb7)throw new Error(_0xd7b6('0x95'));if(_0x3dccb7[_0xd7b6('0x94')]===_0xd7b6('0x96')){var _0x539f87=_0x16e007[_0xd7b6('0x2e')]({'plain':!![]});return db[_0xd7b6('0x97')][_0xd7b6('0x51')]({'where':{'name':'Plugins','userProfileId':_0x3dccb7[_0xd7b6('0x98')]},'raw':!![]})[_0xd7b6('0x2c')](function(_0x35a10f){if(_0x35a10f&&_0x35a10f[_0xd7b6('0x99')]===0x0){return db[_0xd7b6('0x30')][_0xd7b6('0x92')]({'name':_0x539f87[_0xd7b6('0x33')],'resourceId':_0x539f87['id'],'type':_0x35a10f[_0xd7b6('0x33')],'sectionId':_0x35a10f['id']},{})[_0xd7b6('0x2c')](function(){return _0x16e007;});}else{return _0x16e007;}})[_0xd7b6('0x4d')](function(_0xa3b7af){logger['error'](_0xd7b6('0x9a'),_0xa3b7af);throw _0xa3b7af;});}return _0x16e007;})['then'](respondWithResult(_0xebc1a,null))[_0xd7b6('0x4d')](handleError(_0xebc1a,null));}});}catch(_0x59c377){_0xebc1a[_0xd7b6('0x21')](0x1f4)[_0xd7b6('0x34')](_0x59c377);}};function removeReferences(_0x312f1e,_0x46c1e3){try{if(_0x312f1e){fs['unlinkSync'](_0x312f1e);logger[_0xd7b6('0x69')]('Zip\x20archive\x20removed');}if(_0x46c1e3){rimraf(_0x46c1e3,function(){});logger[_0xd7b6('0x69')](_0xd7b6('0x9b'));}}catch(_0xe70859){logger[_0xd7b6('0x31')](_0xe70859);}}exports[_0xd7b6('0x2b')]=function(_0x32f327,_0x1cac59,_0x58105a){return db['Plugin'][_0xd7b6('0x51')]({'where':{'id':_0x32f327['params']['id']}})[_0xd7b6('0x2c')](handleEntityNotFound(_0x1cac59,null))[_0xd7b6('0x2c')](saveUpdates(_0x32f327[_0xd7b6('0x93')],null))[_0xd7b6('0x2c')](respondWithResult(_0x1cac59,null))[_0xd7b6('0x4d')](handleError(_0x1cac59,null));};exports['delete']=function(_0x560f40,_0x56cc3d,_0x30aab4){return db[_0xd7b6('0x36')][_0xd7b6('0x51')]({'where':{'id':_0x560f40[_0xd7b6('0x4e')]['id']}})[_0xd7b6('0x2c')](function(_0x30deb3){if(_0x30deb3){return _0x30deb3[_0xd7b6('0x2d')]();}})[_0xd7b6('0x2c')](function(_0x3dc78f){rimraf(path[_0xd7b6('0x53')](config[_0xd7b6('0x54')],_0xd7b6('0x55'),path[_0xd7b6('0x61')](_0x3dc78f[_0xd7b6('0x5')])),function(){});return _0x3dc78f;})['then'](handleEntityNotFound(_0x56cc3d,null))[_0xd7b6('0x2c')](respondWithStatusCode(_0x56cc3d,null))[_0xd7b6('0x4d')](handleError(_0x56cc3d,null));};exports[_0xd7b6('0x9c')]=function(_0x299042,_0x307ac7,_0x4195d3){return BPromise['resolve']()['then'](function(){if(!_0x299042[_0xd7b6('0x3b')]['path']){throw new Error(_0xd7b6('0x9d'));}if(!_0x299042['query'][_0xd7b6('0x9e')]){throw new Error(_0xd7b6('0x9f'));}var _0x113e4b=_0x299042[_0xd7b6('0x3b')][_0xd7b6('0xa0')]?_0x299042['query']['hostname']+':'+_0x299042['query']['port']:_0xd7b6('0xa1')+_0x299042['query']['port'];var _0x1c7aeb=_0x299042['query'][_0xd7b6('0x23')]?_0x299042[_0xd7b6('0x3b')][_0xd7b6('0x23')]:!![];var _0x472667=_0x299042['query'][_0xd7b6('0xa2')]?_0x299042[_0xd7b6('0x3b')][_0xd7b6('0xa2')]:null;var _0x1d0d7d={'method':_0x299042[_0xd7b6('0xa3')],'uri':util[_0xd7b6('0xa4')](_0xd7b6('0xa5'),_0x113e4b,_0x299042[_0xd7b6('0x3b')][_0xd7b6('0x5')]),'json':_0x1c7aeb,'resolveWithFullResponse':!![],'encoding':_0x472667,'qs':_0x299042['query']};if(_0x299042[_0xd7b6('0xa6')]){_0x1d0d7d['headers']=_0x299042[_0xd7b6('0xa6')];if(_0x1d0d7d[_0xd7b6('0xa6')][_0xd7b6('0xa7')]){delete _0x1d0d7d[_0xd7b6('0xa6')][_0xd7b6('0xa7')];}}if(_0x1d0d7d[_0xd7b6('0xa6')][_0xd7b6('0xa8')]){delete _0x1d0d7d[_0xd7b6('0xa6')][_0xd7b6('0xa8')];}return rp(_0x1d0d7d);})['then'](function(_0x4e569f){if(_0x4e569f){_0x307ac7[_0xd7b6('0x28')](_0x4e569f[_0xd7b6('0xa6')]);logger[_0xd7b6('0x69')](_0x4e569f[_0xd7b6('0x93')]);if(_[_0xd7b6('0xa9')](_0x299042[_0xd7b6('0x3b')][_0xd7b6('0x5')],_0xd7b6('0x52'))&&_0x4e569f[_0xd7b6('0xaa')]==0x1f4){return _0x307ac7[_0xd7b6('0x20')](_0x4e569f['statusCode']);}else{return _0x307ac7['status'](_0x4e569f[_0xd7b6('0xaa')])[_0xd7b6('0x34')](_0x4e569f[_0xd7b6('0x93')]);}}else{return _0x307ac7[_0xd7b6('0x20')](0xc8);}})['catch'](handleError(_0x307ac7,null));};exports[_0xd7b6('0xab')]=function(_0x221852,_0x4704b9,_0x251396){return BPromise[_0xd7b6('0xac')]()[_0xd7b6('0x2c')](function(){if(!_0x221852[_0xd7b6('0x3b')][_0xd7b6('0x5')]){throw new Error(_0xd7b6('0x9d'));}if(!_0x221852[_0xd7b6('0x3b')][_0xd7b6('0x9e')]){throw new Error(_0xd7b6('0x9f'));}var _0x37757d=_0x221852[_0xd7b6('0x3b')][_0xd7b6('0xa0')]?_0x221852[_0xd7b6('0x3b')][_0xd7b6('0xa0')]+':'+_0x221852['query'][_0xd7b6('0x9e')]:_0xd7b6('0xa1')+_0x221852[_0xd7b6('0x3b')][_0xd7b6('0x9e')];var _0x5e933d=_0x221852[_0xd7b6('0x3b')]['json']?_0x221852[_0xd7b6('0x3b')]['json']:!![];var _0x3a9e4e=_0x221852[_0xd7b6('0x3b')][_0xd7b6('0xa2')]?_0x221852[_0xd7b6('0x3b')]['encoding']:null;var _0xadf780={'method':_0x221852['method'],'uri':util[_0xd7b6('0xa4')](_0xd7b6('0xa5'),_0x37757d,_0x221852[_0xd7b6('0x3b')][_0xd7b6('0x5')]),'json':_0x5e933d,'resolveWithFullResponse':!![],'encoding':_0x3a9e4e,'body':_0x221852[_0xd7b6('0x93')]};if(_0x221852[_0xd7b6('0xa6')]){_0xadf780[_0xd7b6('0xa6')]=_0x221852['headers'];if(_0xadf780[_0xd7b6('0xa6')][_0xd7b6('0xa7')]){delete _0xadf780[_0xd7b6('0xa6')][_0xd7b6('0xa7')];}}if(_0xadf780['headers']['content-type']){delete _0xadf780[_0xd7b6('0xa6')]['content-type'];}return rp(_0xadf780);})[_0xd7b6('0x2c')](function(_0xcc15){if(_0xcc15){_0x4704b9[_0xd7b6('0x28')](_0xcc15[_0xd7b6('0xa6')]);logger[_0xd7b6('0x69')](_0xcc15[_0xd7b6('0x93')]);return _0x4704b9['status'](_0xcc15[_0xd7b6('0xaa')])['send'](_0xcc15[_0xd7b6('0x93')]);}else{return _0x4704b9['sendStatus'](0xc8);}})[_0xd7b6('0x4d')](handleError(_0x4704b9,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index ea03dc5..ff2ddd3 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 _0x4d49=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x3fa0c1,_0x5d1a7d){var _0x557c02=function(_0x312824){while(--_0x312824){_0x3fa0c1['push'](_0x3fa0c1['shift']());}};_0x557c02(++_0x5d1a7d);}(_0x4d49,0x141));var _0x94d4=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4d49[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x94d4('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x94d4('0x1')](0x0);var events={'afterCreate':_0x94d4('0x2'),'afterUpdate':_0x94d4('0x3'),'afterDestroy':_0x94d4('0x4')};function emitEvent(_0xa6775f){return function(_0x95b780,_0x422546,_0x122abc){PluginEvents[_0x94d4('0x5')](_0xa6775f+':'+_0x95b780['id'],_0x95b780);PluginEvents['emit'](_0xa6775f,_0x95b780);_0x122abc(null);};}for(var e in events){if(events[_0x94d4('0x6')](e)){var event=events[e];Plugin[_0x94d4('0x7')](e,emitEvent(event));}}module[_0x94d4('0x8')]=PluginEvents; \ No newline at end of file +var _0xb5dd=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin'];(function(_0x495019,_0x3f7cff){var _0x40b37f=function(_0x45f07e){while(--_0x45f07e){_0x495019['push'](_0x495019['shift']());}};_0x40b37f(++_0x3f7cff);}(_0xb5dd,0xd9));var _0xdb5d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb5dd[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xdb5d('0x0'));var Plugin=require(_0xdb5d('0x1'))['db'][_0xdb5d('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xdb5d('0x3')](0x0);var events={'afterCreate':_0xdb5d('0x4'),'afterUpdate':'update','afterDestroy':_0xdb5d('0x5')};function emitEvent(_0x15a072){return function(_0x292af1,_0x5ba1dd,_0x477651){PluginEvents[_0xdb5d('0x6')](_0x15a072+':'+_0x292af1['id'],_0x292af1);PluginEvents[_0xdb5d('0x6')](_0x15a072,_0x292af1);_0x477651(null);};}for(var e in events){if(events[_0xdb5d('0x7')](e)){var event=events[e];Plugin[_0xdb5d('0x8')](e,emitEvent(event));}}module[_0xdb5d('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 e37eff4..0c23711 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 _0xd7a3=['request-promise','path','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xd7a3,0x6a));var _0x3d7a=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xd7a3[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0x3d7a('0x0'));var util=require(_0x3d7a('0x1'));var logger=require(_0x3d7a('0x2'))(_0x3d7a('0x3'));var moment=require(_0x3d7a('0x4'));var BPromise=require(_0x3d7a('0x5'));var rp=require(_0x3d7a('0x6'));var fs=require('fs');var path=require(_0x3d7a('0x7'));var rimraf=require('rimraf');var config=require(_0x3d7a('0x8'));var attributes=require(_0x3d7a('0x9'));module[_0x3d7a('0xa')]=function(_0x19b731,_0x4dcd7a){return _0x19b731[_0x3d7a('0xb')](_0x3d7a('0xc'),attributes,{'tableName':_0x3d7a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb205=['rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','../../config/logger','moment','path'];(function(_0x337bee,_0x53cbca){var _0x24c37d=function(_0x535b06){while(--_0x535b06){_0x337bee['push'](_0x337bee['shift']());}};_0x24c37d(++_0x53cbca);}(_0xb205,0x1bf));var _0x5b20=function(_0x253e76,_0x31c78f){_0x253e76=_0x253e76-0x0;var _0x26bacf=_0xb205[_0x253e76];return _0x26bacf;};'use strict';var _=require(_0x5b20('0x0'));var util=require('util');var logger=require(_0x5b20('0x1'))('api');var moment=require(_0x5b20('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b20('0x3'));var rimraf=require(_0x5b20('0x4'));var config=require(_0x5b20('0x5'));var attributes=require(_0x5b20('0x6'));module[_0x5b20('0x7')]=function(_0x240a92,_0x438b51){return _0x240a92[_0x5b20('0x8')](_0x5b20('0x9'),attributes,{'tableName':_0x5b20('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index d9e97b4..a3e6e70 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 _0x86af=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','catch','CreatePlugin','create','options','lodash'];(function(_0x6e165e,_0x169958){var _0x1901ea=function(_0x746298){while(--_0x746298){_0x6e165e['push'](_0x6e165e['shift']());}};_0x1901ea(++_0x169958);}(_0x86af,0xff));var _0xf86a=function(_0x3177e4,_0xad7cb7){_0x3177e4=_0x3177e4-0x0;var _0x397201=_0x86af[_0x3177e4];return _0x397201;};'use strict';var _=require(_0xf86a('0x0'));var util=require(_0xf86a('0x1'));var moment=require(_0xf86a('0x2'));var BPromise=require(_0xf86a('0x3'));var rs=require(_0xf86a('0x4'));var fs=require('fs');var Redis=require(_0xf86a('0x5'));var db=require(_0xf86a('0x6'))['db'];var utils=require(_0xf86a('0x7'));var logger=require(_0xf86a('0x8'))(_0xf86a('0x9'));var config=require(_0xf86a('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf86a('0xb')]({'port':0x232a});config['redis']=_[_0xf86a('0xc')](config['redis'],{'host':_0xf86a('0xd'),'port':0x18eb});var socket=require(_0xf86a('0xe'))(new Redis(config['redis']));require(_0xf86a('0xf'))[_0xf86a('0x10')](socket);function respondWithRpcPromise(_0x22e803,_0xb28f68,_0x1e65e7){return new BPromise(function(_0x19a1b8,_0x9a185b){return client[_0xf86a('0x11')](_0x22e803,_0x1e65e7)[_0xf86a('0x12')](function(_0x5a5468){logger['info'](_0xf86a('0x13'),_0xb28f68,_0xf86a('0x14'));logger[_0xf86a('0x15')]('Plugin,\x20%s,\x20%s,\x20%s',_0xb28f68,'request\x20sent',JSON[_0xf86a('0x16')](_0x5a5468));if(_0x5a5468['error']){if(_0x5a5468['error'][_0xf86a('0x17')]===0x1f4){logger[_0xf86a('0x18')](_0xf86a('0x13'),_0xb28f68,_0x5a5468[_0xf86a('0x18')][_0xf86a('0x19')]);return _0x9a185b(_0x5a5468[_0xf86a('0x18')][_0xf86a('0x19')]);}logger[_0xf86a('0x18')]('Plugin,\x20%s,\x20%s',_0xb28f68,_0x5a5468[_0xf86a('0x18')][_0xf86a('0x19')]);return _0x19a1b8(_0x5a5468[_0xf86a('0x18')][_0xf86a('0x19')]);}else{logger[_0xf86a('0x1a')](_0xf86a('0x13'),_0xb28f68,_0xf86a('0x14'));_0x19a1b8(_0x5a5468[_0xf86a('0x1b')]['message']);}})[_0xf86a('0x1c')](function(_0x140551){logger[_0xf86a('0x18')](_0xf86a('0x13'),_0xb28f68,_0x140551);_0x9a185b(_0x140551);});});}exports[_0xf86a('0x1d')]=function(_0x1efe14){var _0x27f477=this;return new Promise(function(_0x4db98d,_0x22cad0){return db['Plugin'][_0xf86a('0x1e')](_0x1efe14['body'],{'raw':_0x1efe14[_0xf86a('0x1f')]?_0x1efe14[_0xf86a('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x109d87){logger[_0xf86a('0x1a')](_0xf86a('0x1d'),_0x1efe14);logger[_0xf86a('0x15')](_0xf86a('0x1d'),_0x1efe14,JSON[_0xf86a('0x16')](_0x109d87));_0x4db98d(_0x109d87);})[_0xf86a('0x1c')](function(_0x313d40){logger[_0xf86a('0x18')](_0xf86a('0x1d'),_0x313d40['message'],_0x1efe14);_0x22cad0(_0x27f477[_0xf86a('0x18')](0x1f4,_0x313d40['message']));});});}; \ No newline at end of file +var _0x39ce=['create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreatePlugin'];(function(_0x3af583,_0x42d9c8){var _0x4049a3=function(_0x49e4e3){while(--_0x49e4e3){_0x3af583['push'](_0x3af583['shift']());}};_0x4049a3(++_0x42d9c8);}(_0x39ce,0x162));var _0xe39c=function(_0x2ec43a,_0x41d3f7){_0x2ec43a=_0x2ec43a-0x0;var _0x2a0b8b=_0x39ce[_0x2ec43a];return _0x2a0b8b;};'use strict';var _=require('lodash');var util=require(_0xe39c('0x0'));var moment=require(_0xe39c('0x1'));var BPromise=require(_0xe39c('0x2'));var rs=require(_0xe39c('0x3'));var fs=require('fs');var Redis=require(_0xe39c('0x4'));var db=require(_0xe39c('0x5'))['db'];var utils=require(_0xe39c('0x6'));var logger=require(_0xe39c('0x7'))(_0xe39c('0x8'));var config=require(_0xe39c('0x9'));var jayson=require(_0xe39c('0xa'));var client=jayson[_0xe39c('0xb')][_0xe39c('0xc')]({'port':0x232a});config[_0xe39c('0xd')]=_[_0xe39c('0xe')](config[_0xe39c('0xd')],{'host':_0xe39c('0xf'),'port':0x18eb});var socket=require(_0xe39c('0x10'))(new Redis(config['redis']));require(_0xe39c('0x11'))[_0xe39c('0x12')](socket);function respondWithRpcPromise(_0x35834c,_0x312003,_0x5333ab){return new BPromise(function(_0x1baba5,_0x215630){return client[_0xe39c('0x13')](_0x35834c,_0x5333ab)[_0xe39c('0x14')](function(_0x4dccc7){logger[_0xe39c('0x15')](_0xe39c('0x16'),_0x312003,_0xe39c('0x17'));logger[_0xe39c('0x18')]('Plugin,\x20%s,\x20%s,\x20%s',_0x312003,'request\x20sent',JSON[_0xe39c('0x19')](_0x4dccc7));if(_0x4dccc7[_0xe39c('0x1a')]){if(_0x4dccc7[_0xe39c('0x1a')][_0xe39c('0x1b')]===0x1f4){logger[_0xe39c('0x1a')]('Plugin,\x20%s,\x20%s',_0x312003,_0x4dccc7[_0xe39c('0x1a')][_0xe39c('0x1c')]);return _0x215630(_0x4dccc7['error'][_0xe39c('0x1c')]);}logger[_0xe39c('0x1a')](_0xe39c('0x16'),_0x312003,_0x4dccc7[_0xe39c('0x1a')]['message']);return _0x1baba5(_0x4dccc7[_0xe39c('0x1a')][_0xe39c('0x1c')]);}else{logger[_0xe39c('0x15')](_0xe39c('0x16'),_0x312003,_0xe39c('0x17'));_0x1baba5(_0x4dccc7['result']['message']);}})[_0xe39c('0x1d')](function(_0x1b9793){logger[_0xe39c('0x1a')](_0xe39c('0x16'),_0x312003,_0x1b9793);_0x215630(_0x1b9793);});});}exports[_0xe39c('0x1e')]=function(_0x284688){var _0xae96d6=this;return new Promise(function(_0x1695fd,_0x1cd959){return db['Plugin'][_0xe39c('0x1f')](_0x284688[_0xe39c('0x20')],{'raw':_0x284688[_0xe39c('0x21')]?_0x284688['options'][_0xe39c('0x22')]===undefined?!![]:![]:!![]})[_0xe39c('0x14')](function(_0x4ab0d5){logger['info'](_0xe39c('0x1e'),_0x284688);logger[_0xe39c('0x18')](_0xe39c('0x1e'),_0x284688,JSON[_0xe39c('0x19')](_0x4ab0d5));_0x1695fd(_0x4ab0d5);})[_0xe39c('0x1d')](function(_0x49a004){logger[_0xe39c('0x1a')](_0xe39c('0x1e'),_0x49a004[_0xe39c('0x1c')],_0x284688);_0x1cd959(_0xae96d6[_0xe39c('0x1a')](0x1f4,_0x49a004[_0xe39c('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index bff10dd..4476f65 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 _0x9bb7=['plugin:','./plugin.events','remove','update','removeListener','register','length'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9bb7,0x143));var _0x79bb=function(_0x1af8d3,_0x544d86){_0x1af8d3=_0x1af8d3-0x0;var _0x3a50c5=_0x9bb7[_0x1af8d3];return _0x3a50c5;};'use strict';var PluginEvents=require(_0x79bb('0x0'));var events=['save',_0x79bb('0x1'),_0x79bb('0x2')];function createListener(_0x40c2bc,_0x31b04e){return function(_0x2e9439){_0x31b04e['emit'](_0x40c2bc,_0x2e9439);};}function removeListener(_0x20b119,_0x40fd93){return function(){PluginEvents[_0x79bb('0x3')](_0x20b119,_0x40fd93);};}exports[_0x79bb('0x4')]=function(_0x46fe33){for(var _0x2e1a70=0x0,_0x58ca3f=events[_0x79bb('0x5')];_0x2e1a70<_0x58ca3f;_0x2e1a70++){var _0x15ad76=events[_0x2e1a70];var _0x2e8885=createListener(_0x79bb('0x6')+_0x15ad76,_0x46fe33);PluginEvents['on'](_0x15ad76,_0x2e8885);}}; \ No newline at end of file +var _0xea07=['save','remove','update','emit','register','length','plugin:'];(function(_0x309b15,_0x47068a){var _0xdab7b0=function(_0x3f75e3){while(--_0x3f75e3){_0x309b15['push'](_0x309b15['shift']());}};_0xdab7b0(++_0x47068a);}(_0xea07,0x70));var _0x7ea0=function(_0x516307,_0x14fcd4){_0x516307=_0x516307-0x0;var _0x444430=_0xea07[_0x516307];return _0x444430;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x7ea0('0x0'),_0x7ea0('0x1'),_0x7ea0('0x2')];function createListener(_0x404586,_0x42d52f){return function(_0xfcf2de){_0x42d52f[_0x7ea0('0x3')](_0x404586,_0xfcf2de);};}function removeListener(_0x437514,_0x18cf8a){return function(){PluginEvents['removeListener'](_0x437514,_0x18cf8a);};}exports[_0x7ea0('0x4')]=function(_0x657783){for(var _0x278441=0x0,_0xc06ed5=events[_0x7ea0('0x5')];_0x278441<_0xc06ed5;_0x278441++){var _0x13b11c=events[_0x278441];var _0x55501f=createListener(_0x7ea0('0x6')+_0x13b11c,_0x657783);PluginEvents['on'](_0x13b11c,_0x55501f);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index a29f67b..082ba58 100644 --- a/server/api/pm2/index.js +++ b/server/api/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x59cb2d,_0x1bf8ab){var _0x629077=function(_0x2cbb62){while(--_0x2cbb62){_0x59cb2d['push'](_0x59cb2d['shift']());}};_0x629077(++_0x1bf8ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x139f6a,_0x2e6f1e){var _0x8f32c0=function(_0x18e274){while(--_0x18e274){_0x139f6a['push'](_0x139f6a['shift']());}};_0x8f32c0(++_0x2e6f1e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index cdc5887..071d1ab 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 _0xbf6e=['start','dump','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','Unknown\x20status','delete','Unknown\x20id','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','index','list','then','motion2','length','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname'];(function(_0x66b16d,_0x3abe15){var _0x13c221=function(_0x460b09){while(--_0x460b09){_0x66b16d['push'](_0x66b16d['shift']());}};_0x13c221(++_0x3abe15);}(_0xbf6e,0x149));var _0xebf6=function(_0x1ddcec,_0x41a08a){_0x1ddcec=_0x1ddcec-0x0;var _0x5e2966=_0xbf6e[_0x1ddcec];return _0x5e2966;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0xebf6('0x0'))(_0xebf6('0x1'));var path=require(_0xebf6('0x2'));var exec=require(_0xebf6('0x3'))[_0xebf6('0x4')];var BPromise=require(_0xebf6('0x5'));function handleEntityNotFound(_0x5c2323,_0x49de28){return function(_0x2b0c61){if(!_0x2b0c61){_0x5c2323[_0xebf6('0x6')](0x194);;}return _0x2b0c61;};}function respondWithResult(_0x3b2bb6,_0x1e15cf){_0x1e15cf=_0x1e15cf||0xc8;return function(_0x143344){if(_0x143344){return _0x3b2bb6[_0xebf6('0x7')](_0x1e15cf)[_0xebf6('0x8')](_0x143344);}return null;};}function handleError(_0x548e9e,_0x1d8035){_0x1d8035=_0x1d8035||0x1f4;return function(_0x40b28a){logger[_0xebf6('0x9')](_0x40b28a['stack']);if(_0x40b28a[_0xebf6('0xa')]){delete _0x40b28a[_0xebf6('0xa')];}_0x548e9e['status'](_0x1d8035)[_0xebf6('0xb')](_0x40b28a);};}function execChildProcess(){return new BPromise(function(_0x231d6b,_0x474dbe){exec(_0xebf6('0xc'),function(_0x1bd481,_0x36f588,_0x47ee12){logger[_0xebf6('0xd')](_0x36f588);logger[_0xebf6('0xd')](_0x47ee12);if(_0x1bd481){logger['error'](_0x1bd481);return _0x474dbe(_0x1bd481);}return _0x231d6b(_0x36f588);});});}exports[_0xebf6('0xe')]=function(_0x101a6c,_0x20c9ce){return pm2[_0xebf6('0xf')]()[_0xebf6('0x10')](function(_0x4dbf51){if(_0x4dbf51){var _0x4c01f4=_['reject'](_0x4dbf51,function(_0x4cecbc){return _0x4cecbc[_0xebf6('0xa')]==='express'||_0x4cecbc[_0xebf6('0xa')]===_0xebf6('0x11');});return{'rows':_0x4c01f4,'count':_0x4c01f4[_0xebf6('0x12')]};}return null;})[_0xebf6('0x10')](respondWithResult(_0x20c9ce,null))[_0xebf6('0x13')](handleError(_0x20c9ce,null));};exports[_0xebf6('0x14')]=function(_0x219621,_0x2dc96f){return pm2[_0xebf6('0x15')](_0x219621[_0xebf6('0x16')]['id'])['then'](respondWithResult(_0x2dc96f,null))['then'](handleEntityNotFound(_0x2dc96f,null))[_0xebf6('0x13')](handleError(_0x2dc96f,null));};exports[_0xebf6('0x17')]=function(_0x10051e,_0x410f06){if(_0x10051e[_0xebf6('0x18')][_0xebf6('0xa')]&&_0x10051e[_0xebf6('0x18')][_0xebf6('0x19')]){var _0x4fb497=path[_0xebf6('0x1a')](__dirname,_0xebf6('0x1b'),_0x10051e[_0xebf6('0x18')][_0xebf6('0x19')]);var _0x6303ac=process[_0xebf6('0x1c')]();process[_0xebf6('0x1d')](path[_0xebf6('0x1e')](_0x4fb497));return execChildProcess()[_0xebf6('0x10')](function(_0x2e32c6){process[_0xebf6('0x1d')](_0x6303ac);return pm2[_0xebf6('0x1f')]({'name':_0x10051e[_0xebf6('0x18')][_0xebf6('0xa')],'script':_0x4fb497});})[_0xebf6('0x10')](function(_0x1d0078){pm2[_0xebf6('0x20')]();return _0x1d0078[0x0];})[_0xebf6('0x10')](respondWithResult(_0x410f06,0xc9))[_0xebf6('0x13')](handleError(_0x410f06,null));}else{return _0x410f06['status'](0x1f4)['send']({'message':_0xebf6('0x21')});}};exports['update']=function(_0x230d84,_0x430eb7){if(_0x230d84['body']['id']){delete _0x230d84['body']['id'];}var _0x37950c={'online':_0xebf6('0x22'),'stopped':_0xebf6('0x23')};if(_0x37950c[_0xebf6('0x24')](_0x230d84[_0xebf6('0x18')][_0xebf6('0x7')])){return pm2[_0x37950c[_0x230d84[_0xebf6('0x18')][_0xebf6('0x7')]]](_0x230d84['params']['id'])[_0xebf6('0x10')](respondWithResult(_0x430eb7,0xc8))[_0xebf6('0x13')](handleError(_0x430eb7,null));}else{return _0x430eb7['status'](0x1f4)[_0xebf6('0xb')]({'message':_0xebf6('0x25')});}};exports['destroy']=function(_0x2901fc,_0x1fa407){if(_0x2901fc[_0xebf6('0x18')]['id']){delete _0x2901fc[_0xebf6('0x18')]['id'];}if(_0x2901fc[_0xebf6('0x16')]['id']){return pm2[_0xebf6('0x26')](_0x2901fc['params']['id'])[_0xebf6('0x10')](function(_0x34cc38){pm2['dump']();return _0x34cc38[0x0];})['then'](respondWithResult(_0x1fa407,null))[_0xebf6('0x13')](handleError(_0x1fa407,null));}else{return _0x1fa407[_0xebf6('0x7')](0x1f4)['send']({'message':_0xebf6('0x27')});}}; \ No newline at end of file +var _0xc874=['Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/logger','api','exec','bluebird','sendStatus','status','json','stack','name','send','npm\x20install','info','error','list','then','reject','express','motion2','length','show','params','catch','create','body','script','join','../../files/plugins','cwd','dirname','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty'];(function(_0x15dfcd,_0xb5cdb7){var _0x906363=function(_0x34d43b){while(--_0x34d43b){_0x15dfcd['push'](_0x15dfcd['shift']());}};_0x906363(++_0xb5cdb7);}(_0xc874,0x154));var _0x4c87=function(_0x11155f,_0x57b687){_0x11155f=_0x11155f-0x0;var _0xd07e48=_0xc874[_0x11155f];return _0xd07e48;};'use strict';var _=require(_0x4c87('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x4c87('0x1'))(_0x4c87('0x2'));var path=require('path');var exec=require('child_process')[_0x4c87('0x3')];var BPromise=require(_0x4c87('0x4'));function handleEntityNotFound(_0x1c3dbc,_0x575a7c){return function(_0x3fbf14){if(!_0x3fbf14){_0x1c3dbc[_0x4c87('0x5')](0x194);;}return _0x3fbf14;};}function respondWithResult(_0x5d63ae,_0x46e0f5){_0x46e0f5=_0x46e0f5||0xc8;return function(_0x3dafe0){if(_0x3dafe0){return _0x5d63ae[_0x4c87('0x6')](_0x46e0f5)[_0x4c87('0x7')](_0x3dafe0);}return null;};}function handleError(_0x116649,_0x5b7720){_0x5b7720=_0x5b7720||0x1f4;return function(_0x1e0897){logger['error'](_0x1e0897[_0x4c87('0x8')]);if(_0x1e0897[_0x4c87('0x9')]){delete _0x1e0897[_0x4c87('0x9')];}_0x116649[_0x4c87('0x6')](_0x5b7720)[_0x4c87('0xa')](_0x1e0897);};}function execChildProcess(){return new BPromise(function(_0x548e1a,_0x1fcc99){exec(_0x4c87('0xb'),function(_0x527917,_0x20240a,_0x19bcbf){logger[_0x4c87('0xc')](_0x20240a);logger[_0x4c87('0xc')](_0x19bcbf);if(_0x527917){logger[_0x4c87('0xd')](_0x527917);return _0x1fcc99(_0x527917);}return _0x548e1a(_0x20240a);});});}exports['index']=function(_0x50c90c,_0x4826cb){return pm2[_0x4c87('0xe')]()[_0x4c87('0xf')](function(_0x2c66bc){if(_0x2c66bc){var _0x3f1cc5=_[_0x4c87('0x10')](_0x2c66bc,function(_0x453274){return _0x453274[_0x4c87('0x9')]===_0x4c87('0x11')||_0x453274['name']===_0x4c87('0x12');});return{'rows':_0x3f1cc5,'count':_0x3f1cc5[_0x4c87('0x13')]};}return null;})['then'](respondWithResult(_0x4826cb,null))['catch'](handleError(_0x4826cb,null));};exports[_0x4c87('0x14')]=function(_0x8cebb9,_0x2b55fa){return pm2['describe'](_0x8cebb9[_0x4c87('0x15')]['id'])['then'](respondWithResult(_0x2b55fa,null))[_0x4c87('0xf')](handleEntityNotFound(_0x2b55fa,null))[_0x4c87('0x16')](handleError(_0x2b55fa,null));};exports[_0x4c87('0x17')]=function(_0x22f775,_0x4f6514){if(_0x22f775[_0x4c87('0x18')][_0x4c87('0x9')]&&_0x22f775[_0x4c87('0x18')][_0x4c87('0x19')]){var _0xa4baa7=path[_0x4c87('0x1a')](__dirname,_0x4c87('0x1b'),_0x22f775[_0x4c87('0x18')]['script']);var _0x353ac9=process[_0x4c87('0x1c')]();process['chdir'](path[_0x4c87('0x1d')](_0xa4baa7));return execChildProcess()[_0x4c87('0xf')](function(_0x5a9496){process[_0x4c87('0x1e')](_0x353ac9);return pm2[_0x4c87('0x1f')]({'name':_0x22f775[_0x4c87('0x18')][_0x4c87('0x9')],'script':_0xa4baa7});})['then'](function(_0x4735f2){pm2[_0x4c87('0x20')]();return _0x4735f2[0x0];})[_0x4c87('0xf')](respondWithResult(_0x4f6514,0xc9))[_0x4c87('0x16')](handleError(_0x4f6514,null));}else{return _0x4f6514[_0x4c87('0x6')](0x1f4)[_0x4c87('0xa')]({'message':_0x4c87('0x21')});}};exports[_0x4c87('0x22')]=function(_0x4ca5fb,_0x4ecad3){if(_0x4ca5fb['body']['id']){delete _0x4ca5fb[_0x4c87('0x18')]['id'];}var _0x381af7={'online':_0x4c87('0x23'),'stopped':_0x4c87('0x24')};if(_0x381af7[_0x4c87('0x25')](_0x4ca5fb[_0x4c87('0x18')]['status'])){return pm2[_0x381af7[_0x4ca5fb[_0x4c87('0x18')][_0x4c87('0x6')]]](_0x4ca5fb[_0x4c87('0x15')]['id'])[_0x4c87('0xf')](respondWithResult(_0x4ecad3,0xc8))[_0x4c87('0x16')](handleError(_0x4ecad3,null));}else{return _0x4ecad3[_0x4c87('0x6')](0x1f4)[_0x4c87('0xa')]({'message':_0x4c87('0x26')});}};exports[_0x4c87('0x27')]=function(_0x2de21a,_0x41468f){if(_0x2de21a[_0x4c87('0x18')]['id']){delete _0x2de21a[_0x4c87('0x18')]['id'];}if(_0x2de21a[_0x4c87('0x15')]['id']){return pm2[_0x4c87('0x28')](_0x2de21a[_0x4c87('0x15')]['id'])['then'](function(_0xd4a2af){pm2['dump']();return _0xd4a2af[0x0];})[_0x4c87('0xf')](respondWithResult(_0x41468f,null))['catch'](handleError(_0x41468f,null));}else{return _0x41468f[_0x4c87('0x6')](0x1f4)[_0x4c87('0xa')]({'message':_0x4c87('0x29')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 960f2b2..d75bcee 100644 --- a/server/api/realtime/index.js +++ b/server/api/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28e0=['getAgents','/queues','exports','express','Router','../../components/auth/service','./realtime.controller','get','isAuthenticated'];(function(_0xb729d2,_0x131a0e){var _0x181500=function(_0x38cdec){while(--_0x38cdec){_0xb729d2['push'](_0xb729d2['shift']());}};_0x181500(++_0x131a0e);}(_0x28e0,0xe4));var _0x028e=function(_0x64fa65,_0x395060){_0x64fa65=_0x64fa65-0x0;var _0x4395ef=_0x28e0[_0x64fa65];return _0x4395ef;};'use strict';var express=require(_0x028e('0x0'));var router=express[_0x028e('0x1')]();var auth=require(_0x028e('0x2'));var controller=require(_0x028e('0x3'));router[_0x028e('0x4')]('/agents',auth[_0x028e('0x5')](),controller[_0x028e('0x6')]);router[_0x028e('0x4')](_0x028e('0x7'),auth[_0x028e('0x5')](),controller['getQueues']);module[_0x028e('0x8')]=router; \ No newline at end of file +var _0xe2e5=['getAgents','isAuthenticated','getQueues','exports','Router','../../components/auth/service','get','/agents'];(function(_0x41c203,_0x158a40){var _0x2f3eb5=function(_0x47f4bd){while(--_0x47f4bd){_0x41c203['push'](_0x41c203['shift']());}};_0x2f3eb5(++_0x158a40);}(_0xe2e5,0x1ac));var _0x5e2e=function(_0x46b85e,_0x4be12a){_0x46b85e=_0x46b85e-0x0;var _0x467dc1=_0xe2e5[_0x46b85e];return _0x467dc1;};'use strict';var express=require('express');var router=express[_0x5e2e('0x0')]();var auth=require(_0x5e2e('0x1'));var controller=require('./realtime.controller');router[_0x5e2e('0x2')](_0x5e2e('0x3'),auth['isAuthenticated'](),controller[_0x5e2e('0x4')]);router[_0x5e2e('0x2')]('/queues',auth[_0x5e2e('0x5')](),controller[_0x5e2e('0x6')]);module[_0x5e2e('0x7')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index f7e8cd1..c67a209 100644 --- a/server/api/realtime/realtime.controller.js +++ b/server/api/realtime/realtime.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7590=['count','status','set','Content-Range','json','getAgents','getChannels','query','pause','*pause','then','isValidChannel','format','channel','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','fieldName','type','key','role','agent','getOptions','push','literal','FIELD(id,','forEach','Pause','merge','where','user','userProfileId','Agents','online','assign','omit','UserProfile','getResources','findAndCountAll','find','getAgentStatus','voice','voiceStatus','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','Channel\x20parameter\x20%s\x20is\x20invalid','startCase','rawAttributes','outbound','dialActive','dialMethod','QueueCampaigns','Queues','name','getRealtimeQueues','initializeQueues','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','APIBadRequestError','handleError','offset','undefined','limit'];(function(_0x36e5c6,_0x220dba){var _0x2eaaa4=function(_0xca7ebb){while(--_0xca7ebb){_0x36e5c6['push'](_0x36e5c6['shift']());}};_0x2eaaa4(++_0x220dba);}(_0x7590,0x1e7));var _0x0759=function(_0x3142b1,_0x3cf732){_0x3142b1=_0x3142b1-0x0;var _0x35c702=_0x7590[_0x3142b1];return _0x35c702;};'use strict';var _=require('lodash');var util=require(_0x0759('0x0'));var rta=require(_0x0759('0x1'));var rtq=require(_0x0759('0x2'));var qs=require(_0x0759('0x3'));var utils=require(_0x0759('0x4'));var db=require(_0x0759('0x5'))['db'];var APIBadRequestError=require('../../errors/api')[_0x0759('0x6')];var APIHandleError=require('../../errors/api')[_0x0759('0x7')];function respondWithFilteredResult(_0x2b61b0,_0x3d93aa){return function(_0x3c075e){if(_0x3c075e){var _0x1deb6e=typeof _0x3d93aa[_0x0759('0x8')]===_0x0759('0x9')&&typeof _0x3d93aa[_0x0759('0xa')]===_0x0759('0x9');var _0x4bfdf7=_0x3c075e[_0x0759('0xb')];var _0x37a38b=_0x1deb6e?0x0:_0x3d93aa[_0x0759('0x8')];var _0x1ddf28=_0x1deb6e?_0x3c075e[_0x0759('0xb')]:_0x3d93aa[_0x0759('0x8')]+_0x3d93aa['limit'];var _0xdd68c0;if(_0x1ddf28>=_0x4bfdf7){_0x1ddf28=_0x4bfdf7;_0xdd68c0=0xc8;}else{_0xdd68c0=0xce;}_0x2b61b0[_0x0759('0xc')](_0xdd68c0);return _0x2b61b0[_0x0759('0xd')](_0x0759('0xe'),_0x37a38b+'-'+_0x1ddf28+'/'+_0x4bfdf7)[_0x0759('0xf')](_0x3c075e);}return null;};}exports[_0x0759('0x10')]=function(_0x3e9942,_0x2034f4){var _0x465ef2={'count':0x0,'rows':[]};var _0x23b8c6={};var _0x36c71f;var _0x521e38=utils[_0x0759('0x11')]();var _0x32ccee;var _0x25e94a;var _0x17f0b2=_0x3e9942['query']['globalQueueFilter'];var _0x4c2f90=_0x3e9942[_0x0759('0x12')]['globalStatusFilter'];var _0x457b9b=_0x3e9942['query']['pauseTypeFilter'];var _0x351056=_0x4c2f90===_0x0759('0x13')||_0x4c2f90===_0x0759('0x14')?!![]:![];var _0x3dacb1=[];var _0x3ffe24;var _0x477ef8;Promise['resolve']()[_0x0759('0x15')](function(){if(_0x3e9942[_0x0759('0x12')]['channel']){if(!utils[_0x0759('0x16')](_0x3e9942['query']['channel'])){throw new APIBadRequestError(util[_0x0759('0x17')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3e9942[_0x0759('0x12')][_0x0759('0x18')]));}_0x36c71f=_0x3e9942[_0x0759('0x12')][_0x0759('0x18')][_0x0759('0x19')]();}if(!_0x3e9942[_0x0759('0x12')][_0x0759('0x1a')]||!_0x3e9942[_0x0759('0x12')][_0x0759('0x1a')][_0x0759('0x1b')](_0x0759('0x1c'))){_0x3e9942[_0x0759('0x12')][_0x0759('0x1a')]=rta[_0x0759('0x1d')](_0x3e9942['query'][_0x0759('0x1a')]);return;}var _0x4765fc=rta[_0x0759('0x1e')](_0x3e9942[_0x0759('0x12')][_0x0759('0x1a')]);_0x3e9942[_0x0759('0x12')][_0x0759('0x1a')]=_0x4765fc[_0x0759('0x1f')][_0x0759('0x20')](',');_0x3ffe24=_0x4765fc[_0x0759('0x21')];})[_0x0759('0x15')](function(){if(!_0x17f0b2){return[];}return rta['getAgentIdsByQueues'](_0x17f0b2,_0x36c71f);})[_0x0759('0x15')](function(_0x1369c7){_0x3dacb1=_0x1369c7;return rta[_0x0759('0x22')]();})[_0x0759('0x15')](function(_0x3d8db8){_0x25e94a=_0x3d8db8[_0x0759('0x23')];if((!_0x4c2f90||_0x351056)&&!_0x3ffe24){return _0x3dacb1;}if(_0x3ffe24&&!_0x4c2f90){return rta[_0x0759('0x24')](_0x25e94a,_0x3dacb1,_0x3ffe24);}else{return rta[_0x0759('0x25')](_0x25e94a,_0x3dacb1,_0x4c2f90);}})[_0x0759('0x15')](function(_0x3627e9){_0x3dacb1=_0x3627e9;var _0x2e8fb1=![];if(_0x3dacb1[_0x0759('0x26')]===0x0){if(_0x17f0b2||_0x4c2f90){_0x2e8fb1=!![];}if(_0x351056){_0x2e8fb1=![];}}if(_0x2e8fb1){return _0x465ef2;}var _0x5de7fc=_[_0x0759('0x27')](db[_0x0759('0x28')]['rawAttributes'],function(_0x10a409){return{'name':_0x10a409[_0x0759('0x29')],'type':_0x10a409[_0x0759('0x2a')][_0x0759('0x2b')]};});_0x3e9942[_0x0759('0x12')][_0x0759('0x2c')]=_0x0759('0x2d');_0x23b8c6=qs[_0x0759('0x2e')](_0x5de7fc,_0x3e9942);_0x23b8c6['raw']=!![];var _0x414fd4=[];if(_0x3dacb1[_0x0759('0x26')]>0x0){_0x414fd4[_0x0759('0x2f')]({'id':{'$in':_0x3dacb1}});if(_0x3ffe24&&!_0x4c2f90){_0x477ef8=[db['sequelize'][_0x0759('0x30')](_0x0759('0x31')+_0x3dacb1+')')];_0x23b8c6[_0x0759('0x21')]=_0x477ef8;}}if(_0x351056){_0x521e38[_0x0759('0x32')](function(_0x32a966){var _0x50836b=!![];if(_0x4c2f90===_0x0759('0x14')&&_0x36c71f!==_0x32a966){_0x50836b=![];}_0x414fd4['push']({[_0x32a966+'Pause']:_0x50836b});});if(_0x457b9b){_0x414fd4['push']({'pauseType':_0x457b9b});}}else if(_0x4c2f90){_0x521e38[_0x0759('0x32')](function(_0x3d97bb){_0x414fd4['push']({[_0x3d97bb+_0x0759('0x33')]:![]});});}_0x23b8c6['where']=_[_0x0759('0x34')](_0x23b8c6[_0x0759('0x35')],{'$and':_0x414fd4});if(_0x3e9942['user']['role']==='user'){var _0x514b6f={'params':{'id':_0x3e9942[_0x0759('0x36')][_0x0759('0x37')]},'query':{'section':_0x0759('0x38'),'role':_0x0759('0x2d'),'raw':!![],'ids':_0x3dacb1,'customSorting':_0x477ef8}};if(_0x3e9942['query'][_0x0759('0x39')]){_0x514b6f[_0x0759('0x12')][_0x0759('0x39')]=!![];}if(_0x351056){_0x514b6f[_0x0759('0x12')]['extraQueryConditions']=_0x414fd4;}_0x514b6f[_0x0759('0x12')]=Object[_0x0759('0x3a')](_0x514b6f[_0x0759('0x12')],_[_0x0759('0x3b')](_0x3e9942[_0x0759('0x12')],'id'));return db[_0x0759('0x3c')][_0x0759('0x3d')](_0x514b6f);}return db[_0x0759('0x28')][_0x0759('0x3e')](_0x23b8c6);})[_0x0759('0x15')](function(_0x2cd8a4){_0x465ef2[_0x0759('0xb')]=_0x2cd8a4['count'];_0x32ccee=_0x2cd8a4[_0x0759('0x23')];return _0x32ccee[_0x0759('0x27')](function(_0x23cef0){var _0x35b935=_[_0x0759('0x3f')](_0x25e94a,['id',_0x23cef0['id']]);if(_0x35b935){var _0x360e22=rta['filterAgentAttributes'](_0x35b935);_['merge'](_0x23cef0,_0x360e22);}_0x23cef0['globalStatus']=rta[_0x0759('0x40')](_0x23cef0);if(_0x23cef0[_0x0759('0x1c')]['includes'](_0x0759('0x13'))){_0x521e38['forEach'](function(_0x1f173a){if(_0x23cef0[_0x1f173a+_0x0759('0x33')]){if(_0x1f173a===_0x0759('0x41')){if(_0x23cef0[_0x0759('0x42')]!=='talking'){_0x23cef0['voiceStatus']=_0x0759('0x13');}}else{_0x23cef0[_0x1f173a+'Status']=_0x0759('0x13');}}});}return _0x23cef0;});})[_0x0759('0x15')](function(_0x37a6ce){if(!_0x3ffe24||_0x477ef8){return _0x37a6ce;}return rta[_0x0759('0x43')](_0x37a6ce,_0x3ffe24);})[_0x0759('0x15')](function(_0x52dbb6){var _0x34bf83=rta[_0x0759('0x44')]();_0x465ef2[_0x0759('0x23')]=_0x52dbb6[_0x0759('0x27')](function(_0x2824a0){return _[_0x0759('0x45')](_0x2824a0,_0x34bf83);});return _0x465ef2;})[_0x0759('0x15')](respondWithFilteredResult(_0x2034f4,_0x23b8c6))[_0x0759('0x46')](APIHandleError(_0x2034f4));};exports[_0x0759('0x47')]=function(_0x4d9e60,_0x3a5756){var _0x43b8af={'count':0x0,'rows':[]};var _0x2f1471={};var _0x5049f0;var _0x30aae4;var _0x520f0c;Promise['resolve']()[_0x0759('0x15')](function(){if(_0x4d9e60['query']['channel']){if(!utils[_0x0759('0x16')](_0x4d9e60[_0x0759('0x12')][_0x0759('0x18')])){throw new APIBadRequestError(util[_0x0759('0x17')](_0x0759('0x48'),_0x4d9e60['query'][_0x0759('0x18')]));}_0x5049f0=_0x4d9e60['query'][_0x0759('0x18')][_0x0759('0x19')]();}var _0x5e1872=_[_0x0759('0x49')](_0x5049f0)+'Queue';var _0x3c4aea=_['map'](db[_0x5e1872][_0x0759('0x4a')],function(_0x16f7c8){return{'name':_0x16f7c8[_0x0759('0x29')],'type':_0x16f7c8[_0x0759('0x2a')]['key']};});if(!_0x4d9e60[_0x0759('0x12')][_0x0759('0x1f')]){var _0x54260a=['id','name'];if(_0x5049f0===_0x0759('0x41')){_0x54260a[_0x0759('0x2f')](_0x0759('0x2a'));if(_0x4d9e60[_0x0759('0x12')]['type']===_0x0759('0x4b')){_0x54260a[_0x0759('0x2f')]([_0x0759('0x4c'),_0x0759('0x4d')]);}}_0x4d9e60[_0x0759('0x12')][_0x0759('0x1f')]=_0x54260a[_0x0759('0x20')](',');}_0x2f1471=qs[_0x0759('0x2e')](_0x3c4aea,_0x4d9e60);if(_0x4d9e60[_0x0759('0x36')][_0x0759('0x2c')]===_0x0759('0x36')){var _0x42b9f6={'params':{'id':_0x4d9e60[_0x0759('0x36')][_0x0759('0x37')]},'query':{'section':_0x5049f0===_0x0759('0x41')&&_0x4d9e60[_0x0759('0x12')][_0x0759('0x2a')]===_0x0759('0x4b')?_0x0759('0x4e'):_['startCase'](_0x5049f0)+_0x0759('0x4f'),'type':_0x4d9e60['query'][_0x0759('0x2a')],'nolimit':!![],'sort':_0x0759('0x50'),'filter':_0x4d9e60['query']['filter']}};_0x42b9f6[_0x0759('0x12')]=Object[_0x0759('0x3a')](_0x42b9f6[_0x0759('0x12')],_0x4d9e60['query']);delete _0x42b9f6[_0x0759('0x12')]['id'];return db[_0x0759('0x3c')][_0x0759('0x3d')](_0x42b9f6);}return db[_0x5e1872][_0x0759('0x3e')](_0x2f1471);})[_0x0759('0x15')](function(_0x37673d){_0x43b8af[_0x0759('0xb')]=_0x37673d[_0x0759('0xb')];_0x30aae4=_0x37673d['rows'];return rtq[_0x0759('0x51')](_0x4d9e60,_0x5049f0);})[_0x0759('0x15')](function(_0x1630ed){_0x520f0c=_0x1630ed[_0x0759('0x23')];return rtq[_0x0759('0x52')](_0x30aae4,_0x520f0c,_0x5049f0,_0x4d9e60['query'][_0x0759('0x2a')]);})[_0x0759('0x15')](function(_0x517cb1){_0x43b8af['rows']=_0x517cb1;return _0x43b8af;})[_0x0759('0x15')](respondWithFilteredResult(_0x3a5756,_0x2f1471))['catch'](APIHandleError(_0x3a5756));}; \ No newline at end of file +var _0x2528=['set','Content-Range','json','getChannels','query','globalStatusFilter','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','getAgentIdsByQueues','getRealtimeAgents','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','key','role','agent','getOptions','raw','push','sequelize','FIELD(id,','order','Pause','forEach','where','merge','user','Agents','online','extraQueryConditions','assign','omit','UserProfile','getResources','findAndCountAll','rows','find','filterAgentAttributes','getAgentStatus','pause','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','getQueues','startCase','Queue','name','voice','type','outbound','dialActive','dialMethod','fields','join','userProfileId','QueueCampaigns','Queues','filter','getRealtimeQueues','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','limit','undefined','count','status'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x2528,0xfb));var _0x8252=function(_0x4aa5a6,_0xade936){_0x4aa5a6=_0x4aa5a6-0x0;var _0x16f091=_0x2528[_0x4aa5a6];return _0x16f091;};'use strict';var _=require('lodash');var util=require(_0x8252('0x0'));var rta=require(_0x8252('0x1'));var rtq=require(_0x8252('0x2'));var qs=require(_0x8252('0x3'));var utils=require(_0x8252('0x4'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x8252('0x5'))[_0x8252('0x6')];var APIHandleError=require('../../errors/api')[_0x8252('0x7')];function respondWithFilteredResult(_0xe76807,_0x5ddd69){return function(_0x3cb827){if(_0x3cb827){var _0x2bf57e=typeof _0x5ddd69[_0x8252('0x8')]==='undefined'&&typeof _0x5ddd69[_0x8252('0x9')]===_0x8252('0xa');var _0x293232=_0x3cb827[_0x8252('0xb')];var _0x157069=_0x2bf57e?0x0:_0x5ddd69[_0x8252('0x8')];var _0x3b89d3=_0x2bf57e?_0x3cb827[_0x8252('0xb')]:_0x5ddd69[_0x8252('0x8')]+_0x5ddd69[_0x8252('0x9')];var _0x1def7a;if(_0x3b89d3>=_0x293232){_0x3b89d3=_0x293232;_0x1def7a=0xc8;}else{_0x1def7a=0xce;}_0xe76807[_0x8252('0xc')](_0x1def7a);return _0xe76807[_0x8252('0xd')](_0x8252('0xe'),_0x157069+'-'+_0x3b89d3+'/'+_0x293232)[_0x8252('0xf')](_0x3cb827);}return null;};}exports['getAgents']=function(_0x205e33,_0x13810a){var _0x5b9179={'count':0x0,'rows':[]};var _0x3d27f2={};var _0x59143b;var _0x1dfa18=utils[_0x8252('0x10')]();var _0x421740;var _0x5ce04f;var _0x2d0164=_0x205e33[_0x8252('0x11')]['globalQueueFilter'];var _0x37a2b1=_0x205e33[_0x8252('0x11')][_0x8252('0x12')];var _0x433412=_0x205e33[_0x8252('0x11')]['pauseTypeFilter'];var _0x4e8772=_0x37a2b1==='pause'||_0x37a2b1===_0x8252('0x13')?!![]:![];var _0x5557c9=[];var _0x308ad0;var _0x24ee8f;Promise[_0x8252('0x14')]()[_0x8252('0x15')](function(){if(_0x205e33['query'][_0x8252('0x16')]){if(!utils[_0x8252('0x17')](_0x205e33['query'][_0x8252('0x16')])){throw new APIBadRequestError(util[_0x8252('0x18')](_0x8252('0x19'),_0x205e33[_0x8252('0x11')][_0x8252('0x16')]));}_0x59143b=_0x205e33[_0x8252('0x11')][_0x8252('0x16')][_0x8252('0x1a')]();}if(!_0x205e33[_0x8252('0x11')][_0x8252('0x1b')]||!_0x205e33[_0x8252('0x11')][_0x8252('0x1b')][_0x8252('0x1c')](_0x8252('0x1d'))){_0x205e33[_0x8252('0x11')][_0x8252('0x1b')]=rta[_0x8252('0x1e')](_0x205e33[_0x8252('0x11')]['sort']);return;}var _0x3a98ad=rta[_0x8252('0x1f')](_0x205e33[_0x8252('0x11')][_0x8252('0x1b')]);_0x205e33['query'][_0x8252('0x1b')]=_0x3a98ad['fields']['join'](',');_0x308ad0=_0x3a98ad['order'];})[_0x8252('0x15')](function(){if(!_0x2d0164){return[];}return rta[_0x8252('0x20')](_0x2d0164,_0x59143b);})[_0x8252('0x15')](function(_0x374409){_0x5557c9=_0x374409;return rta[_0x8252('0x21')]();})[_0x8252('0x15')](function(_0x231bc9){_0x5ce04f=_0x231bc9['rows'];if((!_0x37a2b1||_0x4e8772)&&!_0x308ad0){return _0x5557c9;}if(_0x308ad0&&!_0x37a2b1){return rta['getSortedAgentsIdsByStatus'](_0x5ce04f,_0x5557c9,_0x308ad0);}else{return rta[_0x8252('0x22')](_0x5ce04f,_0x5557c9,_0x37a2b1);}})[_0x8252('0x15')](function(_0xd3d389){_0x5557c9=_0xd3d389;var _0x53541a=![];if(_0x5557c9[_0x8252('0x23')]===0x0){if(_0x2d0164||_0x37a2b1){_0x53541a=!![];}if(_0x4e8772){_0x53541a=![];}}if(_0x53541a){return _0x5b9179;}var _0x2615b9=_[_0x8252('0x24')](db[_0x8252('0x25')][_0x8252('0x26')],function(_0x552e4c){return{'name':_0x552e4c[_0x8252('0x27')],'type':_0x552e4c['type'][_0x8252('0x28')]};});_0x205e33[_0x8252('0x11')][_0x8252('0x29')]=_0x8252('0x2a');_0x3d27f2=qs[_0x8252('0x2b')](_0x2615b9,_0x205e33);_0x3d27f2[_0x8252('0x2c')]=!![];var _0x2ca8ea=[];if(_0x5557c9[_0x8252('0x23')]>0x0){_0x2ca8ea[_0x8252('0x2d')]({'id':{'$in':_0x5557c9}});if(_0x308ad0&&!_0x37a2b1){_0x24ee8f=[db[_0x8252('0x2e')]['literal'](_0x8252('0x2f')+_0x5557c9+')')];_0x3d27f2[_0x8252('0x30')]=_0x24ee8f;}}if(_0x4e8772){_0x1dfa18['forEach'](function(_0x24e373){var _0x419353=!![];if(_0x37a2b1===_0x8252('0x13')&&_0x59143b!==_0x24e373){_0x419353=![];}_0x2ca8ea[_0x8252('0x2d')]({[_0x24e373+_0x8252('0x31')]:_0x419353});});if(_0x433412){_0x2ca8ea[_0x8252('0x2d')]({'pauseType':_0x433412});}}else if(_0x37a2b1){_0x1dfa18[_0x8252('0x32')](function(_0xcde7e7){_0x2ca8ea[_0x8252('0x2d')]({[_0xcde7e7+_0x8252('0x31')]:![]});});}_0x3d27f2[_0x8252('0x33')]=_[_0x8252('0x34')](_0x3d27f2[_0x8252('0x33')],{'$and':_0x2ca8ea});if(_0x205e33[_0x8252('0x35')][_0x8252('0x29')]===_0x8252('0x35')){var _0x34243a={'params':{'id':_0x205e33[_0x8252('0x35')]['userProfileId']},'query':{'section':_0x8252('0x36'),'role':_0x8252('0x2a'),'raw':!![],'ids':_0x5557c9,'customSorting':_0x24ee8f}};if(_0x205e33['query'][_0x8252('0x37')]){_0x34243a[_0x8252('0x11')][_0x8252('0x37')]=!![];}if(_0x4e8772){_0x34243a[_0x8252('0x11')][_0x8252('0x38')]=_0x2ca8ea;}_0x34243a[_0x8252('0x11')]=Object[_0x8252('0x39')](_0x34243a[_0x8252('0x11')],_[_0x8252('0x3a')](_0x205e33[_0x8252('0x11')],'id'));return db[_0x8252('0x3b')][_0x8252('0x3c')](_0x34243a);}return db['User'][_0x8252('0x3d')](_0x3d27f2);})['then'](function(_0x24a2ee){_0x5b9179[_0x8252('0xb')]=_0x24a2ee[_0x8252('0xb')];_0x421740=_0x24a2ee[_0x8252('0x3e')];return _0x421740[_0x8252('0x24')](function(_0x1a876d){var _0xad0822=_[_0x8252('0x3f')](_0x5ce04f,['id',_0x1a876d['id']]);if(_0xad0822){var _0x9fe76d=rta[_0x8252('0x40')](_0xad0822);_[_0x8252('0x34')](_0x1a876d,_0x9fe76d);}_0x1a876d[_0x8252('0x1d')]=rta[_0x8252('0x41')](_0x1a876d);if(_0x1a876d[_0x8252('0x1d')][_0x8252('0x1c')](_0x8252('0x42'))){_0x1dfa18[_0x8252('0x32')](function(_0x1ca513){if(_0x1a876d[_0x1ca513+_0x8252('0x31')]){if(_0x1ca513==='voice'){if(_0x1a876d[_0x8252('0x43')]!==_0x8252('0x44')){_0x1a876d['voiceStatus']='pause';}}else{_0x1a876d[_0x1ca513+_0x8252('0x45')]=_0x8252('0x42');}}});}return _0x1a876d;});})['then'](function(_0x3fd6db){if(!_0x308ad0||_0x24ee8f){return _0x3fd6db;}return rta[_0x8252('0x46')](_0x3fd6db,_0x308ad0);})[_0x8252('0x15')](function(_0x36d34f){var _0x21a3c8=rta[_0x8252('0x47')]();_0x5b9179['rows']=_0x36d34f['map'](function(_0xa73d00){return _['pick'](_0xa73d00,_0x21a3c8);});return _0x5b9179;})[_0x8252('0x15')](respondWithFilteredResult(_0x13810a,_0x3d27f2))['catch'](APIHandleError(_0x13810a));};exports[_0x8252('0x48')]=function(_0x33b9cc,_0xb1e127){var _0x3e89c9={'count':0x0,'rows':[]};var _0x21d27d={};var _0x560259;var _0xfd849e;var _0x14a67d;Promise['resolve']()[_0x8252('0x15')](function(){if(_0x33b9cc[_0x8252('0x11')][_0x8252('0x16')]){if(!utils['isValidChannel'](_0x33b9cc[_0x8252('0x11')][_0x8252('0x16')])){throw new APIBadRequestError(util[_0x8252('0x18')](_0x8252('0x19'),_0x33b9cc['query'][_0x8252('0x16')]));}_0x560259=_0x33b9cc['query'][_0x8252('0x16')]['toLowerCase']();}var _0x22cd22=_[_0x8252('0x49')](_0x560259)+_0x8252('0x4a');var _0x2a070a=_[_0x8252('0x24')](db[_0x22cd22]['rawAttributes'],function(_0x20cb91){return{'name':_0x20cb91[_0x8252('0x27')],'type':_0x20cb91['type'][_0x8252('0x28')]};});if(!_0x33b9cc[_0x8252('0x11')]['fields']){var _0x4a8fd5=['id',_0x8252('0x4b')];if(_0x560259===_0x8252('0x4c')){_0x4a8fd5[_0x8252('0x2d')](_0x8252('0x4d'));if(_0x33b9cc[_0x8252('0x11')][_0x8252('0x4d')]===_0x8252('0x4e')){_0x4a8fd5['push']([_0x8252('0x4f'),_0x8252('0x50')]);}}_0x33b9cc['query'][_0x8252('0x51')]=_0x4a8fd5[_0x8252('0x52')](',');}_0x21d27d=qs[_0x8252('0x2b')](_0x2a070a,_0x33b9cc);if(_0x33b9cc[_0x8252('0x35')]['role']===_0x8252('0x35')){var _0x2b4824={'params':{'id':_0x33b9cc[_0x8252('0x35')][_0x8252('0x53')]},'query':{'section':_0x560259==='voice'&&_0x33b9cc[_0x8252('0x11')][_0x8252('0x4d')]===_0x8252('0x4e')?_0x8252('0x54'):_[_0x8252('0x49')](_0x560259)+_0x8252('0x55'),'type':_0x33b9cc[_0x8252('0x11')][_0x8252('0x4d')],'nolimit':!![],'sort':_0x8252('0x4b'),'filter':_0x33b9cc['query'][_0x8252('0x56')]}};_0x2b4824[_0x8252('0x11')]=Object[_0x8252('0x39')](_0x2b4824['query'],_0x33b9cc[_0x8252('0x11')]);delete _0x2b4824[_0x8252('0x11')]['id'];return db[_0x8252('0x3b')]['getResources'](_0x2b4824);}return db[_0x22cd22]['findAndCountAll'](_0x21d27d);})[_0x8252('0x15')](function(_0xf3d73){_0x3e89c9[_0x8252('0xb')]=_0xf3d73[_0x8252('0xb')];_0xfd849e=_0xf3d73[_0x8252('0x3e')];return rtq[_0x8252('0x57')](_0x33b9cc,_0x560259);})[_0x8252('0x15')](function(_0x408921){_0x14a67d=_0x408921['rows'];return rtq['initializeQueues'](_0xfd849e,_0x14a67d,_0x560259,_0x33b9cc[_0x8252('0x11')]['type']);})['then'](function(_0x53689f){_0x3e89c9[_0x8252('0x3e')]=_0x53689f;return _0x3e89c9;})[_0x8252('0x15')](respondWithFilteredResult(_0xb1e127,_0x21d27d))['catch'](APIHandleError(_0xb1e127));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index c63c60b..a88f25c 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4fda88,_0x1a4d19){var _0xe37511=function(_0x51f461){while(--_0x51f461){_0x4fda88['push'](_0x4fda88['shift']());}};_0xe37511(++_0x1a4d19);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1135e8,_0x23f07b){var _0x24fad6=function(_0x5363fe){while(--_0x5363fe){_0x1135e8['push'](_0x1135e8['shift']());}};_0x24fad6(++_0x23f07b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index cef80c9..25d6221 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 _0x8784=['STRING','DATE','sequelize','exports'];(function(_0x95397d,_0x15bedf){var _0xf062da=function(_0x9ae4af){while(--_0x9ae4af){_0x95397d['push'](_0x95397d['shift']());}};_0xf062da(++_0x15bedf);}(_0x8784,0x172));var _0x4878=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0x8784[_0x3207aa];return _0x51758f;};'use strict';var Sequelize=require(_0x4878('0x0'));module[_0x4878('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x4878('0x2')]},'scheduledat':{'type':Sequelize[_0x4878('0x3')]},'uniqueid':{'type':Sequelize[_0x4878('0x2')]},'starttime':{'type':Sequelize[_0x4878('0x3')]},'responsetime':{'type':Sequelize[_0x4878('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x4878('0x2')]},'membername':{'type':Sequelize[_0x4878('0x2')]}}; \ No newline at end of file +var _0x7ebb=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x1bcd61,_0x3a7907){var _0x1d0881=function(_0x4fe510){while(--_0x4fe510){_0x1bcd61['push'](_0x1bcd61['shift']());}};_0x1d0881(++_0x3a7907);}(_0x7ebb,0x161));var _0xb7eb=function(_0x4ae2a1,_0x453065){_0x4ae2a1=_0x4ae2a1-0x0;var _0x49b5b7=_0x7ebb[_0x4ae2a1];return _0x49b5b7;};'use strict';var Sequelize=require(_0xb7eb('0x0'));module[_0xb7eb('0x1')]={'state':{'type':Sequelize[_0xb7eb('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xb7eb('0x3')]},'scheduledat':{'type':Sequelize[_0xb7eb('0x4')]},'uniqueid':{'type':Sequelize[_0xb7eb('0x3')]},'starttime':{'type':Sequelize[_0xb7eb('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xb7eb('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xb7eb('0x3')]},'campaigntype':{'type':Sequelize[_0xb7eb('0x3')]},'membername':{'type':Sequelize[_0xb7eb('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 838a94a..741b82e 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 _0x993c=['./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','api','moment','request-promise','path','../../config/environment'];(function(_0x2d843d,_0x4bc9df){var _0x3f7407=function(_0x53a3f1){while(--_0x53a3f1){_0x2d843d['push'](_0x2d843d['shift']());}};_0x3f7407(++_0x4bc9df);}(_0x993c,0xe9));var _0xc993=function(_0x210f13,_0x2bf0b1){_0x210f13=_0x210f13-0x0;var _0x7872cd=_0x993c[_0x210f13];return _0x7872cd;};'use strict';var _=require(_0xc993('0x0'));var util=require(_0xc993('0x1'));var logger=require('../../config/logger')(_0xc993('0x2'));var moment=require(_0xc993('0x3'));var BPromise=require('bluebird');var rp=require(_0xc993('0x4'));var fs=require('fs');var path=require(_0xc993('0x5'));var rimraf=require('rimraf');var config=require(_0xc993('0x6'));var attributes=require(_0xc993('0x7'));module[_0xc993('0x8')]=function(_0x30fd50,_0x3fab78){return _0x30fd50[_0xc993('0x9')](_0xc993('0xa'),attributes,{'tableName':_0xc993('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e8b=['bluebird','path','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api'];(function(_0xd95342,_0xb75bf6){var _0x54d694=function(_0x1190c1){while(--_0x1190c1){_0xd95342['push'](_0xd95342['shift']());}};_0x54d694(++_0xb75bf6);}(_0x3e8b,0xce));var _0xb3e8=function(_0x43505e,_0xa95348){_0x43505e=_0x43505e-0x0;var _0x1786c1=_0x3e8b[_0x43505e];return _0x1786c1;};'use strict';var _=require(_0xb3e8('0x0'));var util=require(_0xb3e8('0x1'));var logger=require(_0xb3e8('0x2'))(_0xb3e8('0x3'));var moment=require('moment');var BPromise=require(_0xb3e8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb3e8('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb3e8('0x6'));module[_0xb3e8('0x7')]=function(_0x229774,_0x145f73){return _0x229774['define'](_0xb3e8('0x8'),attributes,{'tableName':_0xb3e8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 871aaf2..6bd2955 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 _0xfe42=['request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateReportAgentPreview','create','body','options','raw','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s'];(function(_0x5e7408,_0x319884){var _0x1879d6=function(_0x262eda){while(--_0x262eda){_0x5e7408['push'](_0x5e7408['shift']());}};_0x1879d6(++_0x319884);}(_0xfe42,0x101));var _0x2fe4=function(_0x24de4d,_0x513fba){_0x24de4d=_0x24de4d-0x0;var _0x7e9e31=_0xfe42[_0x24de4d];return _0x7e9e31;};'use strict';var _=require(_0x2fe4('0x0'));var util=require(_0x2fe4('0x1'));var moment=require(_0x2fe4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2fe4('0x3'))['db'];var utils=require(_0x2fe4('0x4'));var logger=require(_0x2fe4('0x5'))(_0x2fe4('0x6'));var config=require(_0x2fe4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2fe4('0x8')][_0x2fe4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1006bd,_0x496e71,_0x365768){return new BPromise(function(_0x281a49,_0x2f8a37){return client['request'](_0x1006bd,_0x365768)[_0x2fe4('0xa')](function(_0x2a1346){logger[_0x2fe4('0xb')](_0x2fe4('0xc'),_0x496e71,_0x2fe4('0xd'));logger[_0x2fe4('0xe')](_0x2fe4('0xf'),_0x496e71,_0x2fe4('0xd'),JSON[_0x2fe4('0x10')](_0x2a1346));if(_0x2a1346[_0x2fe4('0x11')]){if(_0x2a1346[_0x2fe4('0x11')][_0x2fe4('0x12')]===0x1f4){logger['error'](_0x2fe4('0xc'),_0x496e71,_0x2a1346[_0x2fe4('0x11')][_0x2fe4('0x13')]);return _0x2f8a37(_0x2a1346[_0x2fe4('0x11')][_0x2fe4('0x13')]);}logger[_0x2fe4('0x11')](_0x2fe4('0xc'),_0x496e71,_0x2a1346[_0x2fe4('0x11')][_0x2fe4('0x13')]);return _0x281a49(_0x2a1346[_0x2fe4('0x11')]['message']);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x496e71,'request\x20sent');_0x281a49(_0x2a1346[_0x2fe4('0x14')][_0x2fe4('0x13')]);}})['catch'](function(_0x4e3356){logger['error'](_0x2fe4('0xc'),_0x496e71,_0x4e3356);_0x2f8a37(_0x4e3356);});});}exports[_0x2fe4('0x15')]=function(_0x1b04ad){var _0x2a2b6a=this;return new Promise(function(_0x3b4e26,_0x2d4931){return db['ReportAgentPreview'][_0x2fe4('0x16')](_0x1b04ad[_0x2fe4('0x17')],{'raw':_0x1b04ad[_0x2fe4('0x18')]?_0x1b04ad['options'][_0x2fe4('0x19')]===undefined?!![]:![]:!![]})[_0x2fe4('0xa')](function(_0x1cb676){logger[_0x2fe4('0xb')]('CreateReportAgentPreview',_0x1b04ad);logger[_0x2fe4('0xe')](_0x2fe4('0x15'),_0x1b04ad,JSON[_0x2fe4('0x10')](_0x1cb676));_0x3b4e26(_0x1cb676);})[_0x2fe4('0x1a')](function(_0x932bc4){logger[_0x2fe4('0x11')](_0x2fe4('0x15'),_0x932bc4['message'],_0x1b04ad);_0x2d4931(_0x2a2b6a[_0x2fe4('0x11')](0x1f4,_0x932bc4[_0x2fe4('0x13')]));});});}; \ No newline at end of file +var _0xaf11=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','catch','lodash','util','bluebird'];(function(_0x3a99f4,_0x2a81c1){var _0xea0b42=function(_0x41f533){while(--_0x41f533){_0x3a99f4['push'](_0x3a99f4['shift']());}};_0xea0b42(++_0x2a81c1);}(_0xaf11,0x190));var _0x1af1=function(_0x43df4e,_0x23718d){_0x43df4e=_0x43df4e-0x0;var _0x868c68=_0xaf11[_0x43df4e];return _0x868c68;};'use strict';var _=require(_0x1af1('0x0'));var util=require(_0x1af1('0x1'));var moment=require('moment');var BPromise=require(_0x1af1('0x2'));var rs=require(_0x1af1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1af1('0x4'))['db'];var utils=require(_0x1af1('0x5'));var logger=require(_0x1af1('0x6'))(_0x1af1('0x7'));var config=require(_0x1af1('0x8'));var jayson=require(_0x1af1('0x9'));var client=jayson[_0x1af1('0xa')][_0x1af1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x562949,_0x63410c,_0x20a736){return new BPromise(function(_0x19398e,_0x1f7336){return client[_0x1af1('0xc')](_0x562949,_0x20a736)[_0x1af1('0xd')](function(_0x329b9b){logger[_0x1af1('0xe')](_0x1af1('0xf'),_0x63410c,'request\x20sent');logger[_0x1af1('0x10')](_0x1af1('0x11'),_0x63410c,_0x1af1('0x12'),JSON[_0x1af1('0x13')](_0x329b9b));if(_0x329b9b[_0x1af1('0x14')]){if(_0x329b9b['error'][_0x1af1('0x15')]===0x1f4){logger[_0x1af1('0x14')](_0x1af1('0xf'),_0x63410c,_0x329b9b['error'][_0x1af1('0x16')]);return _0x1f7336(_0x329b9b[_0x1af1('0x14')]['message']);}logger['error'](_0x1af1('0xf'),_0x63410c,_0x329b9b[_0x1af1('0x14')][_0x1af1('0x16')]);return _0x19398e(_0x329b9b['error'][_0x1af1('0x16')]);}else{logger[_0x1af1('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x63410c,_0x1af1('0x12'));_0x19398e(_0x329b9b[_0x1af1('0x17')][_0x1af1('0x16')]);}})['catch'](function(_0xb43a2d){logger[_0x1af1('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x63410c,_0xb43a2d);_0x1f7336(_0xb43a2d);});});}exports[_0x1af1('0x18')]=function(_0x155df8){var _0x452c5e=this;return new Promise(function(_0x555a6a,_0x510ba1){return db[_0x1af1('0x19')][_0x1af1('0x1a')](_0x155df8[_0x1af1('0x1b')],{'raw':_0x155df8[_0x1af1('0x1c')]?_0x155df8[_0x1af1('0x1c')][_0x1af1('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3d4402){logger['info'](_0x1af1('0x18'),_0x155df8);logger[_0x1af1('0x10')](_0x1af1('0x18'),_0x155df8,JSON[_0x1af1('0x13')](_0x3d4402));_0x555a6a(_0x3d4402);})[_0x1af1('0x1e')](function(_0x4e1c6d){logger[_0x1af1('0x14')]('CreateReportAgentPreview',_0x4e1c6d[_0x1af1('0x16')],_0x155df8);_0x510ba1(_0x452c5e[_0x1af1('0x14')](0x1f4,_0x4e1c6d[_0x1af1('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 2802dfc..b972f09 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 _0x0c55=['/agents','/agents/:id/capacity','agentCapacity','telephones','/campaigns','campaigns','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','updateVoiceQueue','outbound','/outbound/channels','outboundChannels'];(function(_0x2e4828,_0x9ebfd8){var _0x2e86c0=function(_0x461734){while(--_0x461734){_0x2e4828['push'](_0x2e4828['shift']());}};_0x2e86c0(++_0x9ebfd8);}(_0x0c55,0xd0));var _0x50c5=function(_0x18e7fb,_0x4b64b8){_0x18e7fb=_0x18e7fb-0x0;var _0x13a9cb=_0x0c55[_0x18e7fb];return _0x13a9cb;};'use strict';var multer=require(_0x50c5('0x0'));var util=require(_0x50c5('0x1'));var path=require(_0x50c5('0x2'));var express=require('express');var router=express[_0x50c5('0x3')]();var auth=require(_0x50c5('0x4'));var controller=require(_0x50c5('0x5'));router[_0x50c5('0x6')](_0x50c5('0x7'),auth[_0x50c5('0x8')](),controller[_0x50c5('0x9')]);router[_0x50c5('0x6')](_0x50c5('0xa'),auth[_0x50c5('0x8')](),controller['voiceChannelMixMonitor']);router['get'](_0x50c5('0xb'),auth[_0x50c5('0x8')](),controller['voiceChannelStopMixMonitor']);router[_0x50c5('0x6')](_0x50c5('0xc'),auth['isAuthenticated'](),controller[_0x50c5('0xd')]);router[_0x50c5('0x6')](_0x50c5('0xe'),auth[_0x50c5('0x8')](),controller[_0x50c5('0xf')]);router[_0x50c5('0x6')](_0x50c5('0x10'),auth[_0x50c5('0x8')](),controller[_0x50c5('0x11')]);router['get']('/mail/accounts',auth['isAuthenticated'](),controller[_0x50c5('0x12')]);router[_0x50c5('0x6')](_0x50c5('0x13'),auth[_0x50c5('0x8')](),controller[_0x50c5('0x14')]);router[_0x50c5('0x6')](_0x50c5('0x15'),auth[_0x50c5('0x8')](),controller[_0x50c5('0x16')]);router[_0x50c5('0x6')](_0x50c5('0x17'),auth[_0x50c5('0x8')](),controller[_0x50c5('0x18')]);router['get'](_0x50c5('0x19'),auth[_0x50c5('0x8')](),controller[_0x50c5('0x1a')]);router[_0x50c5('0x6')](_0x50c5('0x1b'),auth['isAuthenticated'](),controller[_0x50c5('0x1c')]);router[_0x50c5('0x6')]('/voice/queues/channels',auth[_0x50c5('0x8')](),controller[_0x50c5('0x1d')]);router['get'](_0x50c5('0x1e'),auth[_0x50c5('0x8')](),controller[_0x50c5('0x1f')]);router[_0x50c5('0x6')](_0x50c5('0x20'),auth['isAuthenticated'](),controller[_0x50c5('0x21')]);router[_0x50c5('0x6')](_0x50c5('0x22'),auth['isAuthenticated'](),controller[_0x50c5('0x23')]);router['get'](_0x50c5('0x24'),auth[_0x50c5('0x8')](),controller['showVoiceQueues']);router['put']('/voice/queues/:id',auth[_0x50c5('0x8')](),controller[_0x50c5('0x25')]);router[_0x50c5('0x6')]('/outbound',auth[_0x50c5('0x8')](),controller[_0x50c5('0x26')]);router[_0x50c5('0x6')](_0x50c5('0x27'),auth['isAuthenticated'](),controller[_0x50c5('0x28')]);router[_0x50c5('0x6')](_0x50c5('0x29'),auth[_0x50c5('0x8')](),controller['agents']);router['put'](_0x50c5('0x2a'),auth['isAuthenticated'](),controller[_0x50c5('0x2b')]);router[_0x50c5('0x6')]('/telephones',auth[_0x50c5('0x8')](),controller[_0x50c5('0x2c')]);router[_0x50c5('0x6')]('/trunks',auth[_0x50c5('0x8')](),controller['trunks']);router[_0x50c5('0x6')](_0x50c5('0x2d'),auth[_0x50c5('0x8')](),controller[_0x50c5('0x2e')]);router[_0x50c5('0x6')]('/fax/accounts',auth[_0x50c5('0x8')](),controller[_0x50c5('0x2f')]);router[_0x50c5('0x6')]('/chat/queues/waitinginteractions',auth[_0x50c5('0x8')](),controller[_0x50c5('0x30')]);router[_0x50c5('0x6')](_0x50c5('0x31'),auth[_0x50c5('0x8')](),controller['mailQueuesWaitingInteractions']);router[_0x50c5('0x6')](_0x50c5('0x32'),auth[_0x50c5('0x8')](),controller[_0x50c5('0x33')]);router['get'](_0x50c5('0x34'),auth[_0x50c5('0x8')](),controller[_0x50c5('0x35')]);router['get'](_0x50c5('0x36'),auth[_0x50c5('0x8')](),controller[_0x50c5('0x37')]);router[_0x50c5('0x6')]('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x50c5('0x38')]);router[_0x50c5('0x6')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0x50c5('0x39')](_0x50c5('0x3a'),auth['isAuthenticated'](),controller[_0x50c5('0x3b')](_0x50c5('0x3c')));router[_0x50c5('0x6')](_0x50c5('0x3d'),auth[_0x50c5('0x8')](),controller[_0x50c5('0x3e')]);router[_0x50c5('0x39')]('/chat/queues/:id/notify',auth[_0x50c5('0x8')](),controller[_0x50c5('0x3b')](_0x50c5('0x3f')));router['get'](_0x50c5('0x40'),auth[_0x50c5('0x8')](),controller[_0x50c5('0x41')]);router['post'](_0x50c5('0x42'),auth[_0x50c5('0x8')](),controller['queueNotify'](_0x50c5('0x43')));router[_0x50c5('0x6')](_0x50c5('0x44'),auth[_0x50c5('0x8')](),controller[_0x50c5('0x45')]);router[_0x50c5('0x39')]('/openchannel/queues/:id/notify',auth[_0x50c5('0x8')](),controller[_0x50c5('0x3b')](_0x50c5('0x46')));router['get'](_0x50c5('0x47'),auth[_0x50c5('0x8')](),controller[_0x50c5('0x48')]);router['post'](_0x50c5('0x49'),auth[_0x50c5('0x8')](),controller[_0x50c5('0x3b')](_0x50c5('0x4a')));router[_0x50c5('0x39')](_0x50c5('0x4b'),auth[_0x50c5('0x8')](),controller[_0x50c5('0x3b')](_0x50c5('0x4c')));router[_0x50c5('0x6')](_0x50c5('0x4d'),auth['isAuthenticated'](),controller[_0x50c5('0x4e')]);router['get'](_0x50c5('0x4f'),auth[_0x50c5('0x8')](),controller[_0x50c5('0x50')]);router[_0x50c5('0x39')](_0x50c5('0x51'),auth[_0x50c5('0x8')](),controller[_0x50c5('0x52')]);module['exports']=router; \ No newline at end of file +var _0x6615=['agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity'];(function(_0x42ab43,_0xb38833){var _0xf1ca33=function(_0x10b5e9){while(--_0x10b5e9){_0x42ab43['push'](_0x42ab43['shift']());}};_0xf1ca33(++_0xb38833);}(_0x6615,0x171));var _0x5661=function(_0xa4f636,_0xaca1b6){_0xa4f636=_0xa4f636-0x0;var _0x37e02a=_0x6615[_0xa4f636];return _0x37e02a;};'use strict';var multer=require(_0x5661('0x0'));var util=require(_0x5661('0x1'));var path=require(_0x5661('0x2'));var express=require(_0x5661('0x3'));var router=express[_0x5661('0x4')]();var auth=require(_0x5661('0x5'));var controller=require(_0x5661('0x6'));router[_0x5661('0x7')](_0x5661('0x8'),auth[_0x5661('0x9')](),controller[_0x5661('0xa')]);router[_0x5661('0x7')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x5661('0x9')](),controller['voiceChannelMixMonitor']);router[_0x5661('0x7')](_0x5661('0xb'),auth[_0x5661('0x9')](),controller[_0x5661('0xc')]);router[_0x5661('0x7')]('/voice/queues',auth[_0x5661('0x9')](),controller[_0x5661('0xd')]);router[_0x5661('0x7')]('/chat/queues',auth[_0x5661('0x9')](),controller['chatQueues']);router[_0x5661('0x7')]('/mail/queues',auth[_0x5661('0x9')](),controller[_0x5661('0xe')]);router[_0x5661('0x7')](_0x5661('0xf'),auth[_0x5661('0x9')](),controller[_0x5661('0x10')]);router['get']('/openchannel/queues',auth[_0x5661('0x9')](),controller[_0x5661('0x11')]);router[_0x5661('0x7')]('/sms/queues',auth[_0x5661('0x9')](),controller[_0x5661('0x12')]);router['get'](_0x5661('0x13'),auth[_0x5661('0x9')](),controller[_0x5661('0x14')]);router[_0x5661('0x7')]('/fax/queues',auth[_0x5661('0x9')](),controller[_0x5661('0x15')]);router['get'](_0x5661('0x16'),auth[_0x5661('0x9')](),controller[_0x5661('0x17')]);router[_0x5661('0x7')](_0x5661('0x18'),auth[_0x5661('0x9')](),controller[_0x5661('0x19')]);router[_0x5661('0x7')]('/voice/queues/channels/:uniqueid',auth[_0x5661('0x9')](),controller[_0x5661('0x1a')]);router[_0x5661('0x7')](_0x5661('0x1b'),auth[_0x5661('0x9')](),controller[_0x5661('0x1c')]);router[_0x5661('0x7')](_0x5661('0x1d'),auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router[_0x5661('0x7')]('/voice/queues/:id',auth[_0x5661('0x9')](),controller[_0x5661('0x1e')]);router[_0x5661('0x1f')](_0x5661('0x20'),auth[_0x5661('0x9')](),controller[_0x5661('0x21')]);router[_0x5661('0x7')](_0x5661('0x22'),auth[_0x5661('0x9')](),controller[_0x5661('0x23')]);router[_0x5661('0x7')](_0x5661('0x24'),auth['isAuthenticated'](),controller[_0x5661('0x25')]);router[_0x5661('0x7')](_0x5661('0x26'),auth[_0x5661('0x9')](),controller[_0x5661('0x27')]);router['put'](_0x5661('0x28'),auth[_0x5661('0x9')](),controller[_0x5661('0x29')]);router[_0x5661('0x7')](_0x5661('0x2a'),auth[_0x5661('0x9')](),controller['telephones']);router[_0x5661('0x7')](_0x5661('0x2b'),auth[_0x5661('0x9')](),controller[_0x5661('0x2c')]);router[_0x5661('0x7')](_0x5661('0x2d'),auth[_0x5661('0x9')](),controller[_0x5661('0x2e')]);router[_0x5661('0x7')](_0x5661('0x2f'),auth['isAuthenticated'](),controller[_0x5661('0x30')]);router[_0x5661('0x7')](_0x5661('0x31'),auth['isAuthenticated'](),controller[_0x5661('0x32')]);router[_0x5661('0x7')](_0x5661('0x33'),auth[_0x5661('0x9')](),controller[_0x5661('0x34')]);router[_0x5661('0x7')](_0x5661('0x35'),auth['isAuthenticated'](),controller[_0x5661('0x36')]);router[_0x5661('0x7')]('/openchannel/queues/:id/waitinginteractions',auth[_0x5661('0x9')](),controller[_0x5661('0x37')]);router[_0x5661('0x7')](_0x5661('0x38'),auth[_0x5661('0x9')](),controller[_0x5661('0x39')]);router[_0x5661('0x7')](_0x5661('0x3a'),auth[_0x5661('0x9')](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0x5661('0x3b'),auth[_0x5661('0x9')](),controller['faxQueuesWaitingInteractions']);router[_0x5661('0x3c')](_0x5661('0x3d'),auth[_0x5661('0x9')](),controller[_0x5661('0x3e')](_0x5661('0x3f')));router[_0x5661('0x7')]('/mail/queues/:id',auth[_0x5661('0x9')](),controller[_0x5661('0x40')]);router['post'](_0x5661('0x41'),auth[_0x5661('0x9')](),controller[_0x5661('0x3e')](_0x5661('0x42')));router['get']('/chat/queues/:id',auth[_0x5661('0x9')](),controller[_0x5661('0x43')]);router[_0x5661('0x3c')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify']('fax'));router['get'](_0x5661('0x44'),auth[_0x5661('0x9')](),controller['showFaxQueues']);router[_0x5661('0x3c')]('/openchannel/queues/:id/notify',auth[_0x5661('0x9')](),controller[_0x5661('0x3e')](_0x5661('0x45')));router[_0x5661('0x7')](_0x5661('0x46'),auth[_0x5661('0x9')](),controller[_0x5661('0x47')]);router[_0x5661('0x3c')](_0x5661('0x48'),auth['isAuthenticated'](),controller[_0x5661('0x3e')]('sms'));router[_0x5661('0x3c')](_0x5661('0x49'),auth[_0x5661('0x9')](),controller[_0x5661('0x3e')](_0x5661('0x4a')));router[_0x5661('0x7')](_0x5661('0x4b'),auth[_0x5661('0x9')](),controller[_0x5661('0x4c')]);router[_0x5661('0x7')](_0x5661('0x4d'),auth['isAuthenticated'](),controller[_0x5661('0x4e')]);router[_0x5661('0x3c')](_0x5661('0x4f'),auth[_0x5661('0x9')](),controller[_0x5661('0x50')]);module[_0x5661('0x51')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 26b63d7..5b88493 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 _0xa9e0=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','User','messageId','update','bluebird','moment','lodash','../../config/logger','jayson/promise','client','http','then','error','code','catch','status','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','Trunks','campaigns','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var BPromise=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0a9e('0x3'))('api');var jayson=require(_0x0a9e('0x4'));var amiClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232a});var mailClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x0a9e('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){var _0x56465b=_0x5f41ea?_0x5f41ea:amiClient;return _0x56465b['request'](_0x441e3a,_0x2cc193)[_0x0a9e('0x7')](function(_0xf81284){if(_0xf81284[_0x0a9e('0x8')]){if(_0xf81284[_0x0a9e('0x8')][_0x0a9e('0x9')]===0x1f4){return _0xe42b77(_0xf81284[_0x0a9e('0x8')]['message']);}return _0x503809(_0xf81284['error']['message']);}else{_0x503809(_0xf81284['result']);}})[_0x0a9e('0xa')](function(_0x36471c){_0xe42b77(_0x36471c);});});}function respondWithResult(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xc8;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0xb')](_0x26d672)['json'](_0x32d742);}return _0xd5b662[_0x0a9e('0xc')](0x194);};}function handleError(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0x1f4;return function(_0x281129){logger[_0x0a9e('0x8')](_0x281129[_0x0a9e('0xd')]);if(_0x281129['name']){delete _0x281129[_0x0a9e('0xe')];}_0x239b12['status'](_0x2b4227)[_0x0a9e('0xf')](_0x281129);};}function findById(_0x519dfd){return function(_0x16033c){if(!_[_0x0a9e('0x10')](_0x519dfd)&&!_['isNil'](_0x16033c)&&!_[_0x0a9e('0x10')](_0x16033c['rows'])){return _[_0x0a9e('0x11')](_0x16033c[_0x0a9e('0x12')],function(_0x106033){return _0x106033['id']==_0x519dfd;});}return null;};}exports[_0x0a9e('0x13')]=function(_0x31b1ca,_0x2eb11f){return respondWithRpcPromise(_0x0a9e('0x14'),_0x31b1ca[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x2eb11f,null))[_0x0a9e('0xa')](handleError(_0x2eb11f,null));};exports[_0x0a9e('0x16')]=function(_0x105080,_0x4bb1e3){return respondWithRpcPromise(_0x0a9e('0x17'),_[_0x0a9e('0x18')](_0x105080['query'],_0x105080[_0x0a9e('0x19')]))['then'](respondWithResult(_0x4bb1e3,null))['catch'](handleError(_0x4bb1e3,null));};exports[_0x0a9e('0x1a')]=function(_0x432e56,_0x38e7c4){return respondWithRpcPromise(_0x0a9e('0x1b'),_['merge'](_0x432e56[_0x0a9e('0x15')],_0x432e56[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x38e7c4,null))[_0x0a9e('0xa')](handleError(_0x38e7c4,null));};exports[_0x0a9e('0x1c')]=function(_0x42ac8f,_0x16b1ca){return respondWithRpcPromise('VoiceQueues',_0x42ac8f['query'])[_0x0a9e('0x7')](respondWithResult(_0x16b1ca,null))[_0x0a9e('0xa')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x1d')]=function(_0x33161b,_0x526cf3){return respondWithRpcPromise(_0x0a9e('0x1e'),_0x33161b['query'])[_0x0a9e('0x7')](findById(_0x33161b['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x526cf3,null))[_0x0a9e('0xa')](handleError(_0x526cf3,null));};exports[_0x0a9e('0x1f')]=function(_0x14433c,_0x140511){return respondWithRpcPromise(_0x0a9e('0x20'),_[_0x0a9e('0x18')](_0x14433c[_0x0a9e('0x21')],_0x14433c['params']))[_0x0a9e('0x7')](respondWithResult(_0x140511,null))[_0x0a9e('0xa')](handleError(_0x140511,null));};exports[_0x0a9e('0x22')]=function(_0x2ec755,_0x5c877d){return respondWithRpcPromise(_0x0a9e('0x23'),_[_0x0a9e('0x18')](_0x2ec755[_0x0a9e('0x15')],_0x2ec755[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x5c877d,null))[_0x0a9e('0xa')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x24')]=function(_0x2e8759,_0x1dbde2){return respondWithRpcPromise('VoiceQueuesChannels',_0x2e8759[_0x0a9e('0x15')])['then'](respondWithResult(_0x1dbde2,null))[_0x0a9e('0xa')](handleError(_0x1dbde2,null));};exports[_0x0a9e('0x25')]=function(_0x1122db,_0x33bdb7){return respondWithRpcPromise(_0x0a9e('0x26'),_['merge'](_0x1122db[_0x0a9e('0x15')],_0x1122db[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x33bdb7,null))[_0x0a9e('0xa')](handleError(_0x33bdb7,null));};exports[_0x0a9e('0x27')]=function(_0x409319,_0x332d35){return respondWithRpcPromise(_0x0a9e('0x28'),_['merge'](_0x409319[_0x0a9e('0x15')],_0x409319['params']))[_0x0a9e('0x7')](respondWithResult(_0x332d35,null))[_0x0a9e('0xa')](handleError(_0x332d35,null));};exports[_0x0a9e('0x29')]=function(_0x3f3d41,_0x567193){return respondWithRpcPromise(_0x0a9e('0x2a'),_[_0x0a9e('0x18')](_0x3f3d41[_0x0a9e('0x15')],_0x3f3d41[_0x0a9e('0x19')]))['then'](respondWithResult(_0x567193,null))['catch'](handleError(_0x567193,null));};exports[_0x0a9e('0x2b')]=function(_0x5640eb,_0x24936a){return respondWithRpcPromise(_0x0a9e('0x2c'),_0x5640eb[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x24936a,null))['catch'](handleError(_0x24936a,null));};exports[_0x0a9e('0x2d')]=function(_0x3bfce8,_0x3cae){return respondWithRpcPromise('OutboundChannels',_0x3bfce8[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x3cae,null))[_0x0a9e('0xa')](handleError(_0x3cae,null));};exports['agents']=function(_0x546ef8,_0x11b61d){var _0x40d766;return respondWithRpcPromise('Agents',_0x546ef8[_0x0a9e('0x15')])[_0x0a9e('0x7')](function(_0x2e1b3a){_0x40d766=_0x2e1b3a;return respondWithRpcPromise(_0x0a9e('0x2e'),_0x546ef8['query'],routingClient);})['then'](function(_0x15e37d){return _[_0x0a9e('0x18')]({},_0x15e37d,_0x40d766);})['then'](respondWithResult(_0x11b61d,null))[_0x0a9e('0xa')](handleError(_0x11b61d,null));};exports[_0x0a9e('0x2f')]=function(_0x1459bb,_0x5b4f5e){if(_0x1459bb[_0x0a9e('0x21')]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]&&_0x1459bb[_0x0a9e('0x31')]&&_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0xe')]){for(var _0x2881b3 in _0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]){if(_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x0a9e('0x32')](_0x2881b3)){db[_0x0a9e('0x33')][_0x0a9e('0x34')]({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')]?{'$notIn':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]}:{'$ne':null}}})[_0x0a9e('0x7')](function(_0x432fcc){var _0x25c6e6=moment()[_0x0a9e('0x36')](_0x0a9e('0x37'));for(var _0x5026aa=0x0,_0x117c99=_0x432fcc[_0x0a9e('0x35')];_0x5026aa<_0x117c99;_0x5026aa+=0x1){_0x432fcc[_0x5026aa][_0x0a9e('0x38')]({'exitAt':_0x25c6e6});}});for(var _0xfbd5ad=0x0;_0xfbd5ad<_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')];_0xfbd5ad+=0x1){db[_0x0a9e('0x33')]['findOrCreate']({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':_0x0a9e('0x39'),'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0xfbd5ad],'exitAt':null},'defaults':{'channel':_0x2881b3,'membername':_0x1459bb['user'][_0x0a9e('0xe')],'interface':_[_0x0a9e('0x10')](_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')])?util[_0x0a9e('0x36')](_0x0a9e('0x3b'),_0x1459bb[_0x0a9e('0x31')]['name']):_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')],'type':_0x0a9e('0x39'),'enterAt':moment()[_0x0a9e('0x36')](_0x0a9e('0x37')),'role':_0x0a9e('0x3c'),'internal':_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3d')],'uniqueid':_0x1459bb[_0x0a9e('0x21')]['interaction'][_0x2881b3][_0xfbd5ad]}});}}}}return respondWithRpcPromise(_0x0a9e('0x3e'),{'id':_0x1459bb[_0x0a9e('0x19')]['id'],'capacity':_0x1459bb['body']['capacity']},routingClient)['then'](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0xa')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x3f')]=function(_0x37edaa,_0x11545a){return respondWithRpcPromise(_0x0a9e('0x40'),_0x37edaa[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x11545a,null))[_0x0a9e('0xa')](handleError(_0x11545a,null));};exports['trunks']=function(_0x4b1b9f,_0x53975a){return respondWithRpcPromise(_0x0a9e('0x41'),_0x4b1b9f[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x53975a,null))['catch'](handleError(_0x53975a,null));};exports[_0x0a9e('0x42')]=function(_0x161aa7,_0x53d113){return respondWithRpcPromise('Campaigns',_0x161aa7[_0x0a9e('0x15')])['then'](respondWithResult(_0x53d113,null))[_0x0a9e('0xa')](handleError(_0x53d113,null));};exports['chatQueues']=function(_0x2e5e62,_0x3c20b2){return respondWithRpcPromise(_0x0a9e('0x43'),_0x2e5e62['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x3c20b2,null))[_0x0a9e('0xa')](handleError(_0x3c20b2,null));};exports['showChatQueues']=function(_0x50f687,_0x128aa6){return respondWithRpcPromise(_0x0a9e('0x43'),_0x50f687['query'],routingClient)[_0x0a9e('0x7')](findById(_0x50f687['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x44')]=function(_0x4a6deb,_0x5da27d){return respondWithRpcPromise('MailQueues',_0x4a6deb[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x5da27d,null))[_0x0a9e('0xa')](handleError(_0x5da27d,null));};exports[_0x0a9e('0x45')]=function(_0x3cfd00,_0x19b4df){return respondWithRpcPromise(_0x0a9e('0x46'),_0x3cfd00[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x3cfd00[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x19b4df,null))[_0x0a9e('0xa')](handleError(_0x19b4df,null));};exports[_0x0a9e('0x47')]=function(_0x2642bb,_0x30c491){return respondWithRpcPromise(_0x0a9e('0x48'),_0x2642bb[_0x0a9e('0x15')],mailClient)['then'](respondWithResult(_0x30c491,null))[_0x0a9e('0xa')](handleError(_0x30c491,null));};exports[_0x0a9e('0x49')]=function(_0x5239ef,_0x3649cc){return respondWithRpcPromise('OpenchannelQueues',_0x5239ef[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x3649cc,null))['catch'](handleError(_0x3649cc,null));};exports['showOpenchannelQueues']=function(_0x273cb5,_0x49d231){return respondWithRpcPromise(_0x0a9e('0x4a'),_0x273cb5[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x273cb5[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x49d231,null))[_0x0a9e('0xa')](handleError(_0x49d231,null));};exports['smsQueues']=function(_0x1627a7,_0x5854cc){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x1627a7[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5854cc,null))['catch'](handleError(_0x5854cc,null));};exports[_0x0a9e('0x4c')]=function(_0x156f1c,_0x119677){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x156f1c['query'],routingClient)[_0x0a9e('0x7')](findById(_0x156f1c[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x119677,null))[_0x0a9e('0xa')](handleError(_0x119677,null));};exports[_0x0a9e('0x4d')]=function(_0x88dcbf,_0x409b29){return respondWithRpcPromise(_0x0a9e('0x4e'),_0x88dcbf['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x409b29,null))[_0x0a9e('0xa')](handleError(_0x409b29,null));};exports[_0x0a9e('0x4f')]=function(_0x47bb43,_0x3528b7){return respondWithRpcPromise('WhatsappQueues',_0x47bb43['query'],routingClient)[_0x0a9e('0x7')](findById(_0x47bb43[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x3528b7,null))[_0x0a9e('0xa')](handleError(_0x3528b7,null));};exports[_0x0a9e('0x50')]=function(_0xc8c264,_0x387489){return respondWithRpcPromise(_0x0a9e('0x51'),_0xc8c264[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x387489,null))[_0x0a9e('0xa')](handleError(_0x387489,null));};exports[_0x0a9e('0x52')]=function(_0x2bbb86,_0x2b8192){return respondWithRpcPromise(_0x0a9e('0x51'),_0x2bbb86[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x2bbb86[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x2b8192,null))[_0x0a9e('0xa')](handleError(_0x2b8192,null));};exports[_0x0a9e('0x53')]=function(_0x243d12,_0x4edbb0){return respondWithRpcPromise(_0x0a9e('0x54'),_0x243d12[_0x0a9e('0x15')])['then'](respondWithResult(_0x4edbb0,null))[_0x0a9e('0xa')](handleError(_0x4edbb0,null));};exports[_0x0a9e('0x55')]=function(_0x3ef315,_0x427946){return respondWithRpcPromise(_0x0a9e('0x56'),_0x3ef315['query'],routingClient)['then'](respondWithResult(_0x427946,null))['catch'](handleError(_0x427946,null));};exports[_0x0a9e('0x57')]=function(_0x18bf5d,_0x1104ad){return respondWithRpcPromise(_0x0a9e('0x58'),_0x18bf5d[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x1104ad,null))[_0x0a9e('0xa')](handleError(_0x1104ad,null));};exports[_0x0a9e('0x59')]=function(_0x5512d1,_0x235f8f){return respondWithRpcPromise(_0x0a9e('0x5a'),_0x5512d1[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x235f8f,null))[_0x0a9e('0xa')](handleError(_0x235f8f,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4437ff,_0x44351d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4437ff[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](function(_0x2cc7a7){if(_0x4437ff[_0x0a9e('0x15')]['type']!==undefined){var _0x1d442c=_(_0x2cc7a7[_0x0a9e('0x12')])[_0x0a9e('0x5b')]([_0x4437ff[_0x0a9e('0x15')]['type'],_0x4437ff[_0x0a9e('0x19')]['id']])[_0x0a9e('0x5c')](_0x0a9e('0x5d'))[_0x0a9e('0x5e')]()['value']();return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x30a4c7){return _0x1d442c[_0x0a9e('0x5f')](_0x30a4c7[_0x0a9e('0x5d')])>-0x1;});}else{return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x3df0e3){return _0x3df0e3[_0x0a9e('0x5d')]===parseInt(_0x4437ff[_0x0a9e('0x19')]['id']);});}})[_0x0a9e('0x7')](respondWithResult(_0x44351d,null))[_0x0a9e('0xa')](handleError(_0x44351d,null));};exports[_0x0a9e('0x60')]=function(_0xe0749e,_0x5b35db){return respondWithRpcPromise(_0x0a9e('0x61'),_0xe0749e[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5b35db,null))['catch'](handleError(_0x5b35db,null));};exports[_0x0a9e('0x62')]=function(_0x33dda0,_0x8cea96){return respondWithRpcPromise(_0x0a9e('0x63'),_0x33dda0['query'],routingClient)['then'](respondWithResult(_0x8cea96,null))[_0x0a9e('0xa')](handleError(_0x8cea96,null));};exports[_0x0a9e('0x64')]=function(_0x4c54fa,_0x45108c){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x4c54fa[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x45108c,null))['catch'](handleError(_0x45108c,null));};exports[_0x0a9e('0x65')]=function(_0x41cf12){return function(_0x2d2286,_0x42b959){var _0x3755fe,_0x1f42a0;var _0x444f1f=_['capitalize'](_0x41cf12);var _0x2973d3=_0x41cf12===_0x0a9e('0x66')?_0x0a9e('0x67'):_0x0a9e('0x68');return db[_0x444f1f+'Queue'][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2d2286[_0x0a9e('0x19')]['id']}})['then'](function(_0x1d6834){if(_['isNil'](_0x1d6834)){throw new Error(_0x444f1f+_0x0a9e('0x6a'));}_0x3755fe=_0x1d6834;return db[_0x444f1f+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2d2286[_0x0a9e('0x21')]['messageId']},'include':[{'model':db[_0x444f1f+'Interaction'],'as':_0x0a9e('0x6c')},{'model':db[_0x444f1f+_0x2973d3],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x5ac73d){if(_[_0x0a9e('0x10')](_0x5ac73d)){throw new Error(_0x444f1f+_0x0a9e('0x6d'));}_0x1f42a0=_0x5ac73d;return _0x5ac73d['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xf0a802={'uniqueid':_0x41cf12+'.'+_0x1f42a0['id']+'.'+_0x1f42a0['Interaction']['id'],'FromUserId':_0x2d2286['user']['id'],'type':'queue'};_0xf0a802[_0x444f1f+_0x0a9e('0x6e')]=_0x1f42a0['id'];_0xf0a802[_0x444f1f+_0x0a9e('0x6f')]=_0x1f42a0[_0x0a9e('0x6c')]['id'];_0xf0a802[_0x0a9e('0x70')+_0x444f1f+_0x2973d3+'Id']=_0x1f42a0[_0x0a9e('0x68')]['id'];_0xf0a802['To'+_0x444f1f+_0x0a9e('0x71')]=_0x3755fe['id'];return db[_0x444f1f+'TransferReport'][_0x0a9e('0x72')](_0xf0a802);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x41cf12,'interaction':_0x1f42a0[_0x0a9e('0x6c')],'message':_0x1f42a0,'account':_0x1f42a0[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x74'),'appdata':_0x3755fe['name']+','+(_0x1f42a0[_0x0a9e('0x68')][_0x0a9e('0x75')]||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x42b959,null))[_0x0a9e('0xa')](handleError(_0x42b959,null));};};exports[_0x0a9e('0x77')]=function(_0x2a563d,_0x22063c){var _0x255e49,_0x1910bf;if(_[_0x0a9e('0x10')](_0x2a563d[_0x0a9e('0x21')]['channel'])){throw new Error(_0x0a9e('0x78'));}var _0x3325c5=_0x2a563d['body'][_0x0a9e('0x79')];var _0x982340=_[_0x0a9e('0x7a')](_0x3325c5);var _0x5a26c8=_0x3325c5===_0x0a9e('0x66')?'Website':_0x0a9e('0x68');return db[_0x0a9e('0x7b')][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2a563d[_0x0a9e('0x19')]['id'],'role':_0x0a9e('0x3c')}})[_0x0a9e('0x7')](function(_0x16a039){if(_[_0x0a9e('0x10')](_0x16a039)){throw new Error('Agent\x20not\x20found');}_0x255e49=_0x16a039;return db[_0x982340+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2a563d[_0x0a9e('0x21')][_0x0a9e('0x7c')]},'include':[{'model':db[_0x982340+_0x0a9e('0x6c')],'as':_0x0a9e('0x6c')},{'model':db[_0x982340+_0x5a26c8],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x1808ba){if(_[_0x0a9e('0x10')](_0x1808ba)){throw new Error(_0x982340+_0x0a9e('0x6d'));}_0x1910bf=_0x1808ba;return _0x1808ba[_0x0a9e('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0a9e('0x7')](function(){var _0x4989f9={'uniqueid':_0x3325c5+'.'+_0x1910bf['id']+'.'+_0x1910bf[_0x0a9e('0x6c')]['id'],'FromUserId':_0x2a563d[_0x0a9e('0x31')]['id'],'type':_0x0a9e('0x3c'),'ToUserId':_0x255e49['id']};_0x4989f9[_0x982340+_0x0a9e('0x6e')]=_0x1910bf['id'];_0x4989f9[_0x982340+_0x0a9e('0x6f')]=_0x1910bf['Interaction']['id'];_0x4989f9[_0x0a9e('0x70')+_0x982340+_0x5a26c8+'Id']=_0x1910bf[_0x0a9e('0x68')]['id'];return db[_0x982340+'TransferReport'][_0x0a9e('0x72')](_0x4989f9);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x3325c5,'interaction':_0x1910bf[_0x0a9e('0x6c')],'message':_0x1910bf,'account':_0x1910bf[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x3c'),'appdata':_0x255e49['name']+','+(_0x1910bf[_0x0a9e('0x68')]['agentTransferTimeout']||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})[_0x0a9e('0x7')](respondWithResult(_0x22063c,null))['catch'](handleError(_0x22063c,null));}; \ No newline at end of file +var _0xa9e0=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','User','messageId','update','bluebird','moment','lodash','../../config/logger','jayson/promise','client','http','then','error','code','catch','status','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','Trunks','campaigns','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var BPromise=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0a9e('0x3'))('api');var jayson=require(_0x0a9e('0x4'));var amiClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232a});var mailClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x0a9e('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){var _0x56465b=_0x5f41ea?_0x5f41ea:amiClient;return _0x56465b['request'](_0x441e3a,_0x2cc193)[_0x0a9e('0x7')](function(_0xf81284){if(_0xf81284[_0x0a9e('0x8')]){if(_0xf81284[_0x0a9e('0x8')][_0x0a9e('0x9')]===0x1f4){return _0xe42b77(_0xf81284[_0x0a9e('0x8')]['message']);}return _0x503809(_0xf81284['error']['message']);}else{_0x503809(_0xf81284['result']);}})[_0x0a9e('0xa')](function(_0x36471c){_0xe42b77(_0x36471c);});});}function respondWithResult(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xc8;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0xb')](_0x26d672)['json'](_0x32d742);}return _0xd5b662[_0x0a9e('0xc')](0x194);};}function handleError(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0x1f4;return function(_0x281129){logger[_0x0a9e('0x8')](_0x281129[_0x0a9e('0xd')]);if(_0x281129['name']){delete _0x281129[_0x0a9e('0xe')];}_0x239b12['status'](_0x2b4227)[_0x0a9e('0xf')](_0x281129);};}function findById(_0x519dfd){return function(_0x16033c){if(!_[_0x0a9e('0x10')](_0x519dfd)&&!_['isNil'](_0x16033c)&&!_[_0x0a9e('0x10')](_0x16033c['rows'])){return _[_0x0a9e('0x11')](_0x16033c[_0x0a9e('0x12')],function(_0x106033){return _0x106033['id']==_0x519dfd;});}return null;};}exports[_0x0a9e('0x13')]=function(_0x31b1ca,_0x2eb11f){return respondWithRpcPromise(_0x0a9e('0x14'),_0x31b1ca[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x2eb11f,null))[_0x0a9e('0xa')](handleError(_0x2eb11f,null));};exports[_0x0a9e('0x16')]=function(_0x105080,_0x4bb1e3){return respondWithRpcPromise(_0x0a9e('0x17'),_[_0x0a9e('0x18')](_0x105080['query'],_0x105080[_0x0a9e('0x19')]))['then'](respondWithResult(_0x4bb1e3,null))['catch'](handleError(_0x4bb1e3,null));};exports[_0x0a9e('0x1a')]=function(_0x432e56,_0x38e7c4){return respondWithRpcPromise(_0x0a9e('0x1b'),_['merge'](_0x432e56[_0x0a9e('0x15')],_0x432e56[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x38e7c4,null))[_0x0a9e('0xa')](handleError(_0x38e7c4,null));};exports[_0x0a9e('0x1c')]=function(_0x42ac8f,_0x16b1ca){return respondWithRpcPromise('VoiceQueues',_0x42ac8f['query'])[_0x0a9e('0x7')](respondWithResult(_0x16b1ca,null))[_0x0a9e('0xa')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x1d')]=function(_0x33161b,_0x526cf3){return respondWithRpcPromise(_0x0a9e('0x1e'),_0x33161b['query'])[_0x0a9e('0x7')](findById(_0x33161b['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x526cf3,null))[_0x0a9e('0xa')](handleError(_0x526cf3,null));};exports[_0x0a9e('0x1f')]=function(_0x14433c,_0x140511){return respondWithRpcPromise(_0x0a9e('0x20'),_[_0x0a9e('0x18')](_0x14433c[_0x0a9e('0x21')],_0x14433c['params']))[_0x0a9e('0x7')](respondWithResult(_0x140511,null))[_0x0a9e('0xa')](handleError(_0x140511,null));};exports[_0x0a9e('0x22')]=function(_0x2ec755,_0x5c877d){return respondWithRpcPromise(_0x0a9e('0x23'),_[_0x0a9e('0x18')](_0x2ec755[_0x0a9e('0x15')],_0x2ec755[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x5c877d,null))[_0x0a9e('0xa')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x24')]=function(_0x2e8759,_0x1dbde2){return respondWithRpcPromise('VoiceQueuesChannels',_0x2e8759[_0x0a9e('0x15')])['then'](respondWithResult(_0x1dbde2,null))[_0x0a9e('0xa')](handleError(_0x1dbde2,null));};exports[_0x0a9e('0x25')]=function(_0x1122db,_0x33bdb7){return respondWithRpcPromise(_0x0a9e('0x26'),_['merge'](_0x1122db[_0x0a9e('0x15')],_0x1122db[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x33bdb7,null))[_0x0a9e('0xa')](handleError(_0x33bdb7,null));};exports[_0x0a9e('0x27')]=function(_0x409319,_0x332d35){return respondWithRpcPromise(_0x0a9e('0x28'),_['merge'](_0x409319[_0x0a9e('0x15')],_0x409319['params']))[_0x0a9e('0x7')](respondWithResult(_0x332d35,null))[_0x0a9e('0xa')](handleError(_0x332d35,null));};exports[_0x0a9e('0x29')]=function(_0x3f3d41,_0x567193){return respondWithRpcPromise(_0x0a9e('0x2a'),_[_0x0a9e('0x18')](_0x3f3d41[_0x0a9e('0x15')],_0x3f3d41[_0x0a9e('0x19')]))['then'](respondWithResult(_0x567193,null))['catch'](handleError(_0x567193,null));};exports[_0x0a9e('0x2b')]=function(_0x5640eb,_0x24936a){return respondWithRpcPromise(_0x0a9e('0x2c'),_0x5640eb[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x24936a,null))['catch'](handleError(_0x24936a,null));};exports[_0x0a9e('0x2d')]=function(_0x3bfce8,_0x3cae){return respondWithRpcPromise('OutboundChannels',_0x3bfce8[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x3cae,null))[_0x0a9e('0xa')](handleError(_0x3cae,null));};exports['agents']=function(_0x546ef8,_0x11b61d){var _0x40d766;return respondWithRpcPromise('Agents',_0x546ef8[_0x0a9e('0x15')])[_0x0a9e('0x7')](function(_0x2e1b3a){_0x40d766=_0x2e1b3a;return respondWithRpcPromise(_0x0a9e('0x2e'),_0x546ef8['query'],routingClient);})['then'](function(_0x15e37d){return _[_0x0a9e('0x18')]({},_0x15e37d,_0x40d766);})['then'](respondWithResult(_0x11b61d,null))[_0x0a9e('0xa')](handleError(_0x11b61d,null));};exports[_0x0a9e('0x2f')]=function(_0x1459bb,_0x5b4f5e){if(_0x1459bb[_0x0a9e('0x21')]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]&&_0x1459bb[_0x0a9e('0x31')]&&_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0xe')]){for(var _0x2881b3 in _0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]){if(_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x0a9e('0x32')](_0x2881b3)){db[_0x0a9e('0x33')][_0x0a9e('0x34')]({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')]?{'$notIn':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]}:{'$ne':null}}})[_0x0a9e('0x7')](function(_0x432fcc){var _0x25c6e6=moment()[_0x0a9e('0x36')](_0x0a9e('0x37'));for(var _0x5026aa=0x0,_0x117c99=_0x432fcc[_0x0a9e('0x35')];_0x5026aa<_0x117c99;_0x5026aa+=0x1){_0x432fcc[_0x5026aa][_0x0a9e('0x38')]({'exitAt':_0x25c6e6});}});for(var _0xfbd5ad=0x0;_0xfbd5ad<_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')];_0xfbd5ad+=0x1){db[_0x0a9e('0x33')]['findOrCreate']({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':_0x0a9e('0x39'),'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0xfbd5ad],'exitAt':null},'defaults':{'channel':_0x2881b3,'membername':_0x1459bb['user'][_0x0a9e('0xe')],'interface':_[_0x0a9e('0x10')](_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')])?util[_0x0a9e('0x36')](_0x0a9e('0x3b'),_0x1459bb[_0x0a9e('0x31')]['name']):_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')],'type':_0x0a9e('0x39'),'enterAt':moment()[_0x0a9e('0x36')](_0x0a9e('0x37')),'role':_0x0a9e('0x3c'),'internal':_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3d')],'uniqueid':_0x1459bb[_0x0a9e('0x21')]['interaction'][_0x2881b3][_0xfbd5ad]}});}}}}return respondWithRpcPromise(_0x0a9e('0x3e'),{'id':_0x1459bb[_0x0a9e('0x19')]['id'],'capacity':_0x1459bb['body']['capacity']},routingClient)['then'](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0xa')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x3f')]=function(_0x37edaa,_0x11545a){return respondWithRpcPromise(_0x0a9e('0x40'),_0x37edaa[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x11545a,null))[_0x0a9e('0xa')](handleError(_0x11545a,null));};exports['trunks']=function(_0x4b1b9f,_0x53975a){return respondWithRpcPromise(_0x0a9e('0x41'),_0x4b1b9f[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x53975a,null))['catch'](handleError(_0x53975a,null));};exports[_0x0a9e('0x42')]=function(_0x161aa7,_0x53d113){return respondWithRpcPromise('Campaigns',_0x161aa7[_0x0a9e('0x15')])['then'](respondWithResult(_0x53d113,null))[_0x0a9e('0xa')](handleError(_0x53d113,null));};exports['chatQueues']=function(_0x2e5e62,_0x3c20b2){return respondWithRpcPromise(_0x0a9e('0x43'),_0x2e5e62['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x3c20b2,null))[_0x0a9e('0xa')](handleError(_0x3c20b2,null));};exports['showChatQueues']=function(_0x50f687,_0x128aa6){return respondWithRpcPromise(_0x0a9e('0x43'),_0x50f687['query'],routingClient)[_0x0a9e('0x7')](findById(_0x50f687['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x44')]=function(_0x4a6deb,_0x5da27d){return respondWithRpcPromise('MailQueues',_0x4a6deb[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x5da27d,null))[_0x0a9e('0xa')](handleError(_0x5da27d,null));};exports[_0x0a9e('0x45')]=function(_0x3cfd00,_0x19b4df){return respondWithRpcPromise(_0x0a9e('0x46'),_0x3cfd00[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x3cfd00[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x19b4df,null))[_0x0a9e('0xa')](handleError(_0x19b4df,null));};exports[_0x0a9e('0x47')]=function(_0x2642bb,_0x30c491){return respondWithRpcPromise(_0x0a9e('0x48'),_0x2642bb[_0x0a9e('0x15')],mailClient)['then'](respondWithResult(_0x30c491,null))[_0x0a9e('0xa')](handleError(_0x30c491,null));};exports[_0x0a9e('0x49')]=function(_0x5239ef,_0x3649cc){return respondWithRpcPromise('OpenchannelQueues',_0x5239ef[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x3649cc,null))['catch'](handleError(_0x3649cc,null));};exports['showOpenchannelQueues']=function(_0x273cb5,_0x49d231){return respondWithRpcPromise(_0x0a9e('0x4a'),_0x273cb5[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x273cb5[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x49d231,null))[_0x0a9e('0xa')](handleError(_0x49d231,null));};exports['smsQueues']=function(_0x1627a7,_0x5854cc){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x1627a7[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5854cc,null))['catch'](handleError(_0x5854cc,null));};exports[_0x0a9e('0x4c')]=function(_0x156f1c,_0x119677){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x156f1c['query'],routingClient)[_0x0a9e('0x7')](findById(_0x156f1c[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x119677,null))[_0x0a9e('0xa')](handleError(_0x119677,null));};exports[_0x0a9e('0x4d')]=function(_0x88dcbf,_0x409b29){return respondWithRpcPromise(_0x0a9e('0x4e'),_0x88dcbf['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x409b29,null))[_0x0a9e('0xa')](handleError(_0x409b29,null));};exports[_0x0a9e('0x4f')]=function(_0x47bb43,_0x3528b7){return respondWithRpcPromise('WhatsappQueues',_0x47bb43['query'],routingClient)[_0x0a9e('0x7')](findById(_0x47bb43[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x3528b7,null))[_0x0a9e('0xa')](handleError(_0x3528b7,null));};exports[_0x0a9e('0x50')]=function(_0xc8c264,_0x387489){return respondWithRpcPromise(_0x0a9e('0x51'),_0xc8c264[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x387489,null))[_0x0a9e('0xa')](handleError(_0x387489,null));};exports[_0x0a9e('0x52')]=function(_0x2bbb86,_0x2b8192){return respondWithRpcPromise(_0x0a9e('0x51'),_0x2bbb86[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x2bbb86[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x2b8192,null))[_0x0a9e('0xa')](handleError(_0x2b8192,null));};exports[_0x0a9e('0x53')]=function(_0x243d12,_0x4edbb0){return respondWithRpcPromise(_0x0a9e('0x54'),_0x243d12[_0x0a9e('0x15')])['then'](respondWithResult(_0x4edbb0,null))[_0x0a9e('0xa')](handleError(_0x4edbb0,null));};exports[_0x0a9e('0x55')]=function(_0x3ef315,_0x427946){return respondWithRpcPromise(_0x0a9e('0x56'),_0x3ef315['query'],routingClient)['then'](respondWithResult(_0x427946,null))['catch'](handleError(_0x427946,null));};exports[_0x0a9e('0x57')]=function(_0x18bf5d,_0x1104ad){return respondWithRpcPromise(_0x0a9e('0x58'),_0x18bf5d[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x1104ad,null))[_0x0a9e('0xa')](handleError(_0x1104ad,null));};exports[_0x0a9e('0x59')]=function(_0x5512d1,_0x235f8f){return respondWithRpcPromise(_0x0a9e('0x5a'),_0x5512d1[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x235f8f,null))[_0x0a9e('0xa')](handleError(_0x235f8f,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4437ff,_0x44351d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4437ff[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](function(_0x2cc7a7){if(_0x4437ff[_0x0a9e('0x15')]['type']!==undefined){var _0x1d442c=_(_0x2cc7a7[_0x0a9e('0x12')])[_0x0a9e('0x5b')]([_0x4437ff[_0x0a9e('0x15')]['type'],_0x4437ff[_0x0a9e('0x19')]['id']])[_0x0a9e('0x5c')](_0x0a9e('0x5d'))[_0x0a9e('0x5e')]()['value']();return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x30a4c7){return _0x1d442c[_0x0a9e('0x5f')](_0x30a4c7[_0x0a9e('0x5d')])>-0x1;});}else{return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x3df0e3){return _0x3df0e3[_0x0a9e('0x5d')]===parseInt(_0x4437ff[_0x0a9e('0x19')]['id']);});}})[_0x0a9e('0x7')](respondWithResult(_0x44351d,null))[_0x0a9e('0xa')](handleError(_0x44351d,null));};exports[_0x0a9e('0x60')]=function(_0xe0749e,_0x5b35db){return respondWithRpcPromise(_0x0a9e('0x61'),_0xe0749e[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5b35db,null))['catch'](handleError(_0x5b35db,null));};exports[_0x0a9e('0x62')]=function(_0x33dda0,_0x8cea96){return respondWithRpcPromise(_0x0a9e('0x63'),_0x33dda0['query'],routingClient)['then'](respondWithResult(_0x8cea96,null))[_0x0a9e('0xa')](handleError(_0x8cea96,null));};exports[_0x0a9e('0x64')]=function(_0x4c54fa,_0x45108c){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x4c54fa[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x45108c,null))['catch'](handleError(_0x45108c,null));};exports[_0x0a9e('0x65')]=function(_0x41cf12){return function(_0x2d2286,_0x42b959){var _0x3755fe,_0x1f42a0;var _0x444f1f=_['capitalize'](_0x41cf12);var _0x2973d3=_0x41cf12===_0x0a9e('0x66')?_0x0a9e('0x67'):_0x0a9e('0x68');return db[_0x444f1f+'Queue'][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2d2286[_0x0a9e('0x19')]['id']}})['then'](function(_0x1d6834){if(_['isNil'](_0x1d6834)){throw new Error(_0x444f1f+_0x0a9e('0x6a'));}_0x3755fe=_0x1d6834;return db[_0x444f1f+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2d2286[_0x0a9e('0x21')]['messageId']},'include':[{'model':db[_0x444f1f+'Interaction'],'as':_0x0a9e('0x6c')},{'model':db[_0x444f1f+_0x2973d3],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x5ac73d){if(_[_0x0a9e('0x10')](_0x5ac73d)){throw new Error(_0x444f1f+_0x0a9e('0x6d'));}_0x1f42a0=_0x5ac73d;return _0x5ac73d['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xf0a802={'uniqueid':_0x41cf12+'.'+_0x1f42a0['id']+'.'+_0x1f42a0['Interaction']['id'],'FromUserId':_0x2d2286['user']['id'],'type':'queue'};_0xf0a802[_0x444f1f+_0x0a9e('0x6e')]=_0x1f42a0['id'];_0xf0a802[_0x444f1f+_0x0a9e('0x6f')]=_0x1f42a0[_0x0a9e('0x6c')]['id'];_0xf0a802[_0x0a9e('0x70')+_0x444f1f+_0x2973d3+'Id']=_0x1f42a0[_0x0a9e('0x68')]['id'];_0xf0a802['To'+_0x444f1f+_0x0a9e('0x71')]=_0x3755fe['id'];return db[_0x444f1f+'TransferReport'][_0x0a9e('0x72')](_0xf0a802);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x41cf12,'interaction':_0x1f42a0[_0x0a9e('0x6c')],'message':_0x1f42a0,'account':_0x1f42a0[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x74'),'appdata':_0x3755fe['name']+','+(_0x1f42a0[_0x0a9e('0x68')][_0x0a9e('0x75')]||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x42b959,null))[_0x0a9e('0xa')](handleError(_0x42b959,null));};};exports[_0x0a9e('0x77')]=function(_0x2a563d,_0x22063c){var _0x255e49,_0x1910bf;if(_[_0x0a9e('0x10')](_0x2a563d[_0x0a9e('0x21')]['channel'])){throw new Error(_0x0a9e('0x78'));}var _0x3325c5=_0x2a563d['body'][_0x0a9e('0x79')];var _0x982340=_[_0x0a9e('0x7a')](_0x3325c5);var _0x5a26c8=_0x3325c5===_0x0a9e('0x66')?'Website':_0x0a9e('0x68');return db[_0x0a9e('0x7b')][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2a563d[_0x0a9e('0x19')]['id'],'role':_0x0a9e('0x3c')}})[_0x0a9e('0x7')](function(_0x16a039){if(_[_0x0a9e('0x10')](_0x16a039)){throw new Error('Agent\x20not\x20found');}_0x255e49=_0x16a039;return db[_0x982340+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2a563d[_0x0a9e('0x21')][_0x0a9e('0x7c')]},'include':[{'model':db[_0x982340+_0x0a9e('0x6c')],'as':_0x0a9e('0x6c')},{'model':db[_0x982340+_0x5a26c8],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x1808ba){if(_[_0x0a9e('0x10')](_0x1808ba)){throw new Error(_0x982340+_0x0a9e('0x6d'));}_0x1910bf=_0x1808ba;return _0x1808ba[_0x0a9e('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0a9e('0x7')](function(){var _0x4989f9={'uniqueid':_0x3325c5+'.'+_0x1910bf['id']+'.'+_0x1910bf[_0x0a9e('0x6c')]['id'],'FromUserId':_0x2a563d[_0x0a9e('0x31')]['id'],'type':_0x0a9e('0x3c'),'ToUserId':_0x255e49['id']};_0x4989f9[_0x982340+_0x0a9e('0x6e')]=_0x1910bf['id'];_0x4989f9[_0x982340+_0x0a9e('0x6f')]=_0x1910bf['Interaction']['id'];_0x4989f9[_0x0a9e('0x70')+_0x982340+_0x5a26c8+'Id']=_0x1910bf[_0x0a9e('0x68')]['id'];return db[_0x982340+'TransferReport'][_0x0a9e('0x72')](_0x4989f9);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x3325c5,'interaction':_0x1910bf[_0x0a9e('0x6c')],'message':_0x1910bf,'account':_0x1910bf[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x3c'),'appdata':_0x255e49['name']+','+(_0x1910bf[_0x0a9e('0x68')]['agentTransferTimeout']||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})[_0x0a9e('0x7')](respondWithResult(_0x22063c,null))['catch'](handleError(_0x22063c,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index e4ab92d..8382d79 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 _0xdc84=['../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','show','/:id/run','create','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5f21b3,_0x2b8667){var _0x324f1=function(_0x4c8145){while(--_0x4c8145){_0x5f21b3['push'](_0x5f21b3['shift']());}};_0x324f1(++_0x2b8667);}(_0xdc84,0x117));var _0x4dc8=function(_0xae282f,_0x2d9368){_0xae282f=_0xae282f-0x0;var _0x5f46d4=_0xdc84[_0xae282f];return _0x5f46d4;};'use strict';var multer=require(_0x4dc8('0x0'));var util=require('util');var path=require(_0x4dc8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4dc8('0x2')]();var fs_extra=require(_0x4dc8('0x3'));var auth=require(_0x4dc8('0x4'));var interaction=require(_0x4dc8('0x5'));var config=require(_0x4dc8('0x6'));var controller=require(_0x4dc8('0x7'));router['get']('/',auth[_0x4dc8('0x8')](),controller[_0x4dc8('0x9')]);router[_0x4dc8('0xa')](_0x4dc8('0xb'),auth[_0x4dc8('0x8')](),controller[_0x4dc8('0xc')]);router['get'](_0x4dc8('0xd'),auth[_0x4dc8('0x8')](),controller['run']);router['post']('/',auth[_0x4dc8('0x8')](),controller[_0x4dc8('0xe')]);router['put']('/:id',auth[_0x4dc8('0x8')](),controller[_0x4dc8('0xf')]);router[_0x4dc8('0x10')]('/:id',auth[_0x4dc8('0x8')](),controller[_0x4dc8('0x11')]);module[_0x4dc8('0x12')]=router; \ No newline at end of file +var _0xb1a2=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','run','post','put'];(function(_0x5b3e5d,_0x474610){var _0x302097=function(_0x4ec20b){while(--_0x4ec20b){_0x5b3e5d['push'](_0x5b3e5d['shift']());}};_0x302097(++_0x474610);}(_0xb1a2,0x193));var _0x2b1a=function(_0xa34dac,_0x3a89db){_0xa34dac=_0xa34dac-0x0;var _0x47a16c=_0xb1a2[_0xa34dac];return _0x47a16c;};'use strict';var multer=require(_0x2b1a('0x0'));var util=require(_0x2b1a('0x1'));var path=require(_0x2b1a('0x2'));var timeout=require(_0x2b1a('0x3'));var express=require(_0x2b1a('0x4'));var router=express[_0x2b1a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2b1a('0x6'));var interaction=require(_0x2b1a('0x7'));var config=require(_0x2b1a('0x8'));var controller=require('./schedule.controller');router['get']('/',auth[_0x2b1a('0x9')](),controller[_0x2b1a('0xa')]);router[_0x2b1a('0xb')](_0x2b1a('0xc'),auth[_0x2b1a('0x9')](),controller[_0x2b1a('0xd')]);router[_0x2b1a('0xb')]('/:id/run',auth['isAuthenticated'](),controller[_0x2b1a('0xe')]);router[_0x2b1a('0xf')]('/',auth[_0x2b1a('0x9')](),controller['create']);router[_0x2b1a('0x10')](_0x2b1a('0xc'),auth[_0x2b1a('0x9')](),controller[_0x2b1a('0x11')]);router[_0x2b1a('0x12')]('/:id',auth[_0x2b1a('0x9')](),controller[_0x2b1a('0x13')]);module[_0x2b1a('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 0370459..bc56428 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 _0x4cd9=['custom','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','ENUM','years','quarters','months','weeks','days','hours','minutes','csv','pdf','xlsx'];(function(_0x2a91ad,_0xbb9a3b){var _0x992f21=function(_0x5c1d1e){while(--_0x5c1d1e){_0x2a91ad['push'](_0x2a91ad['shift']());}};_0x992f21(++_0xbb9a3b);}(_0x4cd9,0x1e8));var _0x94cd=function(_0x1a58b3,_0x2e191e){_0x1a58b3=_0x1a58b3-0x0;var _0xc153b3=_0x4cd9[_0x1a58b3];return _0xc153b3;};'use strict';var Sequelize=require(_0x94cd('0x0'));module[_0x94cd('0x1')]={'name':{'type':Sequelize[_0x94cd('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x94cd('0x2')]},'active':{'type':Sequelize[_0x94cd('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x94cd('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x94cd('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x94cd('0x5')](_0x94cd('0x6'),_0x94cd('0x7'),_0x94cd('0x8'),_0x94cd('0x9'),_0x94cd('0xa'),_0x94cd('0xb'),_0x94cd('0xc')),'allowNull':![],'defaultValue':_0x94cd('0xa')},'output':{'type':Sequelize[_0x94cd('0x5')](_0x94cd('0xd'),_0x94cd('0xe'),_0x94cd('0xf')),'allowNull':![],'defaultValue':_0x94cd('0xd')},'type':{'type':Sequelize['ENUM'](_0x94cd('0x10'),'default'),'allowNull':![],'defaultValue':_0x94cd('0x10')},'sendMail':{'type':Sequelize[_0x94cd('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x94cd('0x2')]},'cc':{'type':Sequelize[_0x94cd('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xb11d=['BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','weeks','days','minutes','ENUM','csv','xlsx','custom','TEXT','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb11d,0x10c));var _0xdb11=function(_0x2258a6,_0x3e1e9c){_0x2258a6=_0x2258a6-0x0;var _0x31c75f=_0xb11d[_0x2258a6];return _0x31c75f;};'use strict';var Sequelize=require('sequelize');module[_0xdb11('0x0')]={'name':{'type':Sequelize[_0xdb11('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xdb11('0x1')]},'active':{'type':Sequelize[_0xdb11('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdb11('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xdb11('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xdb11('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xdb11('0x6'),'quarters','months',_0xdb11('0x7'),_0xdb11('0x8'),'hours',_0xdb11('0x9')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xdb11('0xa')](_0xdb11('0xb'),'pdf',_0xdb11('0xc')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xdb11('0xa')](_0xdb11('0xd'),'default'),'allowNull':![],'defaultValue':_0xdb11('0xd')},'sendMail':{'type':Sequelize[_0xdb11('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xdb11('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xdb11('0xe')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 4b355fb..97efc60 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 _0x9a3c=['limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Scheduler','UserProfileResource','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','intersection','length','includeAll','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','run','../../config/schedule','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count'];(function(_0x13f0e3,_0x16662a){var _0x4aa552=function(_0x138937){while(--_0x138937){_0x13f0e3['push'](_0x13f0e3['shift']());}};_0x4aa552(++_0x16662a);}(_0x9a3c,0x89));var _0xc9a3=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x9a3c[_0x5e3b04];return _0x1fc44d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc9a3('0x0'));var jsonpatch=require(_0xc9a3('0x1'));var rp=require(_0xc9a3('0x2'));var moment=require('moment');var BPromise=require(_0xc9a3('0x3'));var Mustache=require(_0xc9a3('0x4'));var util=require(_0xc9a3('0x5'));var path=require(_0xc9a3('0x6'));var sox=require(_0xc9a3('0x7'));var csv=require(_0xc9a3('0x8'));var ejs=require(_0xc9a3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc9a3('0xa'));var squel=require(_0xc9a3('0xb'));var crypto=require('crypto');var jsforce=require(_0xc9a3('0xc'));var deskjs=require(_0xc9a3('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc9a3('0xe'));var Redis=require(_0xc9a3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc9a3('0x10'));var as=require(_0xc9a3('0x11'));var hardwareService=require(_0xc9a3('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xc9a3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc9a3('0x14'));var db=require(_0xc9a3('0x15'))['db'];function respondWithStatusCode(_0x3f8551,_0x332a44){_0x332a44=_0x332a44||0xcc;return function(_0x4b0351){if(_0x4b0351){return _0x3f8551[_0xc9a3('0x16')](_0x332a44);}return _0x3f8551[_0xc9a3('0x17')](_0x332a44)[_0xc9a3('0x18')]();};}function respondWithResult(_0x18ba30,_0x4faab3){_0x4faab3=_0x4faab3||0xc8;return function(_0x2bedd7){if(_0x2bedd7){return _0x18ba30[_0xc9a3('0x17')](_0x4faab3)[_0xc9a3('0x19')](_0x2bedd7);}};}function respondWithFilteredResult(_0x342796,_0x59111b){return function(_0x289edb){if(_0x289edb){var _0x17bbcb=typeof _0x59111b[_0xc9a3('0x1a')]===_0xc9a3('0x1b')&&typeof _0x59111b['limit']===_0xc9a3('0x1b');var _0x2c0393=_0x289edb['count'];var _0x1a893a=_0x17bbcb?0x0:_0x59111b[_0xc9a3('0x1a')];var _0x9f15ed=_0x17bbcb?_0x289edb[_0xc9a3('0x1c')]:_0x59111b[_0xc9a3('0x1a')]+_0x59111b[_0xc9a3('0x1d')];var _0x442504;if(_0x9f15ed>=_0x2c0393){_0x9f15ed=_0x2c0393;_0x442504=0xc8;}else{_0x442504=0xce;}_0x342796['status'](_0x442504);return _0x342796[_0xc9a3('0x1e')](_0xc9a3('0x1f'),_0x1a893a+'-'+_0x9f15ed+'/'+_0x2c0393)['json'](_0x289edb);}return null;};}function patchUpdates(_0x2b12f8){return function(_0x28bd47){try{jsonpatch[_0xc9a3('0x20')](_0x28bd47,_0x2b12f8,!![]);}catch(_0x284597){return BPromise[_0xc9a3('0x21')](_0x284597);}return _0x28bd47[_0xc9a3('0x22')]();};}function saveUpdates(_0x346f92,_0x1de41c){return function(_0x17a3fd){if(_0x17a3fd){return _0x17a3fd[_0xc9a3('0x23')](_0x346f92)['then'](function(_0x30b9eb){return _0x30b9eb;});}return null;};}function removeEntity(_0x4fe05c,_0x5c3db3){return function(_0x5f1117){if(_0x5f1117){return _0x5f1117[_0xc9a3('0x24')]()[_0xc9a3('0x25')](function(){var _0x1e5215=_0x5f1117[_0xc9a3('0x26')]({'plain':!![]});var _0x2404f9=_0xc9a3('0x27');return db[_0xc9a3('0x28')][_0xc9a3('0x24')]({'where':{'type':_0x2404f9,'resourceId':_0x1e5215['id']}})[_0xc9a3('0x25')](function(){return _0x5f1117;});})['then'](function(){_0x4fe05c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x27de66,_0x49a509){return function(_0xa2043b){if(!_0xa2043b){_0x27de66[_0xc9a3('0x16')](0x194);}return _0xa2043b;};}function handleError(_0x3c92ef,_0x5b5786){_0x5b5786=_0x5b5786||0x1f4;return function(_0x54e634){logger[_0xc9a3('0x29')](_0x54e634[_0xc9a3('0x2a')]);if(_0x54e634[_0xc9a3('0x2b')]){delete _0x54e634[_0xc9a3('0x2b')];}_0x3c92ef['status'](_0x5b5786)[_0xc9a3('0x2c')](_0x54e634);};}exports[_0xc9a3('0x2d')]=function(_0x38516d,_0x34bc9c){var _0x1f6a52={},_0x43c2f1={},_0x162d3e={'count':0x0,'rows':[]};var _0x228cb5=_[_0xc9a3('0x2e')](db[_0xc9a3('0x2f')][_0xc9a3('0x30')],function(_0x4221c2){return{'name':_0x4221c2[_0xc9a3('0x31')],'type':_0x4221c2[_0xc9a3('0x32')][_0xc9a3('0x33')]};});_0x43c2f1[_0xc9a3('0x34')]=_[_0xc9a3('0x2e')](_0x228cb5,_0xc9a3('0x2b'));_0x43c2f1[_0xc9a3('0x35')]=_[_0xc9a3('0x36')](_0x38516d[_0xc9a3('0x35')]);_0x43c2f1[_0xc9a3('0x37')]=_['intersection'](_0x43c2f1[_0xc9a3('0x34')],_0x43c2f1[_0xc9a3('0x35')]);_0x1f6a52['attributes']=_['intersection'](_0x43c2f1[_0xc9a3('0x34')],qs[_0xc9a3('0x38')](_0x38516d[_0xc9a3('0x35')]['fields']));_0x1f6a52[_0xc9a3('0x39')]=_0x1f6a52['attributes']['length']?_0x1f6a52[_0xc9a3('0x39')]:_0x43c2f1[_0xc9a3('0x34')];if(!_0x38516d[_0xc9a3('0x35')][_0xc9a3('0x3a')](_0xc9a3('0x3b'))){_0x1f6a52[_0xc9a3('0x1d')]=qs[_0xc9a3('0x1d')](_0x38516d[_0xc9a3('0x35')][_0xc9a3('0x1d')]);_0x1f6a52[_0xc9a3('0x1a')]=qs[_0xc9a3('0x1a')](_0x38516d[_0xc9a3('0x35')][_0xc9a3('0x1a')]);}_0x1f6a52[_0xc9a3('0x3c')]=qs[_0xc9a3('0x3d')](_0x38516d['query'][_0xc9a3('0x3d')]);_0x1f6a52[_0xc9a3('0x3e')]=qs[_0xc9a3('0x37')](_[_0xc9a3('0x3f')](_0x38516d['query'],_0x43c2f1[_0xc9a3('0x37')]),_0x228cb5);if(_0x38516d[_0xc9a3('0x35')][_0xc9a3('0x40')]){_0x1f6a52[_0xc9a3('0x3e')]=_[_0xc9a3('0x41')](_0x1f6a52[_0xc9a3('0x3e')],{'$or':_[_0xc9a3('0x2e')](_0x228cb5,function(_0x71400c){if(_0x71400c['type']!=='VIRTUAL'){var _0x1a40c1={};_0x1a40c1[_0x71400c[_0xc9a3('0x2b')]]={'$like':'%'+_0x38516d[_0xc9a3('0x35')][_0xc9a3('0x40')]+'%'};return _0x1a40c1;}})});}_0x1f6a52=_[_0xc9a3('0x41')]({},_0x1f6a52,_0x38516d[_0xc9a3('0x42')]);var _0x166f05={'where':_0x1f6a52['where']};return db[_0xc9a3('0x2f')][_0xc9a3('0x1c')](_0x166f05)[_0xc9a3('0x25')](function(_0x48feac){_0x162d3e['count']=_0x48feac;if(_0x38516d['query']['includeAll']){_0x1f6a52[_0xc9a3('0x43')]=[{'all':!![]}];}return db[_0xc9a3('0x2f')][_0xc9a3('0x44')](_0x1f6a52);})[_0xc9a3('0x25')](function(_0x4d6862){_0x162d3e[_0xc9a3('0x45')]=_0x4d6862;return _0x162d3e;})['then'](respondWithFilteredResult(_0x34bc9c,_0x1f6a52))[_0xc9a3('0x46')](handleError(_0x34bc9c,null));};exports[_0xc9a3('0x47')]=function(_0x53d836,_0x46ab05){var _0x55d804={'raw':![],'where':{'id':_0x53d836[_0xc9a3('0x48')]['id']}},_0x163a0c={};_0x163a0c['model']=_[_0xc9a3('0x36')](db[_0xc9a3('0x2f')][_0xc9a3('0x30')]);_0x163a0c[_0xc9a3('0x35')]=_['keys'](_0x53d836[_0xc9a3('0x35')]);_0x163a0c[_0xc9a3('0x37')]=_[_0xc9a3('0x49')](_0x163a0c[_0xc9a3('0x34')],_0x163a0c['query']);_0x55d804[_0xc9a3('0x39')]=_['intersection'](_0x163a0c[_0xc9a3('0x34')],qs['fields'](_0x53d836[_0xc9a3('0x35')][_0xc9a3('0x38')]));_0x55d804[_0xc9a3('0x39')]=_0x55d804['attributes'][_0xc9a3('0x4a')]?_0x55d804[_0xc9a3('0x39')]:_0x163a0c[_0xc9a3('0x34')];if(_0x53d836[_0xc9a3('0x35')][_0xc9a3('0x4b')]){_0x55d804['include']=[{'all':!![]}];}_0x55d804=_[_0xc9a3('0x41')]({},_0x55d804,_0x53d836[_0xc9a3('0x42')]);return db[_0xc9a3('0x2f')]['find'](_0x55d804)['then'](handleEntityNotFound(_0x46ab05,null))['then'](respondWithResult(_0x46ab05,null))['catch'](handleError(_0x46ab05,null));};exports['create']=function(_0x4d0a31,_0x5903b5){return db[_0xc9a3('0x2f')]['create'](_0x4d0a31[_0xc9a3('0x4c')],{})[_0xc9a3('0x25')](function(_0x46aa7e){var _0x5c9df7=_0x4d0a31[_0xc9a3('0x4d')][_0xc9a3('0x26')]({'plain':!![]});if(!_0x5c9df7)throw new Error(_0xc9a3('0x4e'));if(_0x5c9df7['role']===_0xc9a3('0x4d')){var _0x222462=_0x46aa7e[_0xc9a3('0x26')]({'plain':!![]});var _0x433414=_0xc9a3('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x433414,'userProfileId':_0x5c9df7['userProfileId']},'raw':!![]})[_0xc9a3('0x25')](function(_0xe2b317){if(_0xe2b317&&_0xe2b317['autoAssociation']===0x0){return db[_0xc9a3('0x28')]['create']({'name':_0x222462[_0xc9a3('0x2b')],'resourceId':_0x222462['id'],'type':_0xe2b317[_0xc9a3('0x2b')],'sectionId':_0xe2b317['id']},{})[_0xc9a3('0x25')](function(){return _0x46aa7e;});}else{return _0x46aa7e;}})[_0xc9a3('0x46')](function(_0x355baf){logger['error'](_0xc9a3('0x4f'),_0x355baf);throw _0x355baf;});}return _0x46aa7e;})[_0xc9a3('0x25')](respondWithResult(_0x5903b5,0xc9))[_0xc9a3('0x46')](handleError(_0x5903b5,null));};exports[_0xc9a3('0x23')]=function(_0x43ac18,_0x177a08){if(_0x43ac18[_0xc9a3('0x4c')]['id']){delete _0x43ac18[_0xc9a3('0x4c')]['id'];}return db[_0xc9a3('0x2f')][_0xc9a3('0x50')]({'where':{'id':_0x43ac18[_0xc9a3('0x48')]['id']}})[_0xc9a3('0x25')](handleEntityNotFound(_0x177a08,null))['then'](saveUpdates(_0x43ac18[_0xc9a3('0x4c')],null))[_0xc9a3('0x25')](respondWithResult(_0x177a08,null))[_0xc9a3('0x46')](handleError(_0x177a08,null));};exports['destroy']=function(_0x1c53b8,_0x304426){return db[_0xc9a3('0x2f')]['find']({'where':{'id':_0x1c53b8[_0xc9a3('0x48')]['id']}})[_0xc9a3('0x25')](handleEntityNotFound(_0x304426,null))[_0xc9a3('0x25')](removeEntity(_0x304426,null))[_0xc9a3('0x46')](handleError(_0x304426,null));};exports[_0xc9a3('0x51')]=function(_0x25ac73,_0x3edf6b,_0x15be70){var _0x1c2306=require(_0xc9a3('0x52'));return db['Schedule'][_0xc9a3('0x50')]({'where':{'id':_0x25ac73['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3edf6b,null))[_0xc9a3('0x25')](function(){_0x1c2306[_0xc9a3('0x51')](_0x25ac73[_0xc9a3('0x48')]['id']);})[_0xc9a3('0x25')](respondWithStatusCode(_0x3edf6b,null))['catch'](handleError(_0x3edf6b,null));}; \ No newline at end of file +var _0xff7f=['type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','catch','show','params','find','create','body','user','role','Scheduler','UserProfileSection','userProfileId','run','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','map','Schedule','rawAttributes','fieldName'];(function(_0x15165e,_0x47648c){var _0x3383e3=function(_0x250cb0){while(--_0x250cb0){_0x15165e['push'](_0x15165e['shift']());}};_0x3383e3(++_0x47648c);}(_0xff7f,0x111));var _0xfff7=function(_0x4d9cab,_0x488b32){_0x4d9cab=_0x4d9cab-0x0;var _0x4a1609=_0xff7f[_0x4d9cab];return _0x4a1609;};'use strict';var emlformat=require(_0xfff7('0x0'));var rimraf=require(_0xfff7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfff7('0x2'));var rp=require(_0xfff7('0x3'));var moment=require(_0xfff7('0x4'));var BPromise=require(_0xfff7('0x5'));var Mustache=require(_0xfff7('0x6'));var util=require(_0xfff7('0x7'));var path=require('path');var sox=require(_0xfff7('0x8'));var csv=require(_0xfff7('0x9'));var ejs=require(_0xfff7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfff7('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfff7('0xc'));var deskjs=require(_0xfff7('0xd'));var toCsv=require(_0xfff7('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfff7('0xe'));var qs=require(_0xfff7('0xf'));var as=require(_0xfff7('0x10'));var hardwareService=require(_0xfff7('0x11'));var logger=require(_0xfff7('0x12'))(_0xfff7('0x13'));var utils=require(_0xfff7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfff7('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x203996,_0xb0c657){_0xb0c657=_0xb0c657||0xcc;return function(_0x3098f1){if(_0x3098f1){return _0x203996['sendStatus'](_0xb0c657);}return _0x203996[_0xfff7('0x16')](_0xb0c657)['end']();};}function respondWithResult(_0x109149,_0x4dc74f){_0x4dc74f=_0x4dc74f||0xc8;return function(_0x41abd4){if(_0x41abd4){return _0x109149[_0xfff7('0x16')](_0x4dc74f)[_0xfff7('0x17')](_0x41abd4);}};}function respondWithFilteredResult(_0x54a3bc,_0x2d0fb1){return function(_0x5377da){if(_0x5377da){var _0x28ec0e=typeof _0x2d0fb1[_0xfff7('0x18')]===_0xfff7('0x19')&&typeof _0x2d0fb1[_0xfff7('0x1a')]===_0xfff7('0x19');var _0x22d5bd=_0x5377da[_0xfff7('0x1b')];var _0x5740a7=_0x28ec0e?0x0:_0x2d0fb1[_0xfff7('0x18')];var _0x303c22=_0x28ec0e?_0x5377da[_0xfff7('0x1b')]:_0x2d0fb1['offset']+_0x2d0fb1[_0xfff7('0x1a')];var _0x3afc23;if(_0x303c22>=_0x22d5bd){_0x303c22=_0x22d5bd;_0x3afc23=0xc8;}else{_0x3afc23=0xce;}_0x54a3bc['status'](_0x3afc23);return _0x54a3bc[_0xfff7('0x1c')](_0xfff7('0x1d'),_0x5740a7+'-'+_0x303c22+'/'+_0x22d5bd)[_0xfff7('0x17')](_0x5377da);}return null;};}function patchUpdates(_0x455fc4){return function(_0x2452d2){try{jsonpatch[_0xfff7('0x1e')](_0x2452d2,_0x455fc4,!![]);}catch(_0x50dbac){return BPromise[_0xfff7('0x1f')](_0x50dbac);}return _0x2452d2[_0xfff7('0x20')]();};}function saveUpdates(_0x2ffcd3,_0x399c94){return function(_0x4a17f2){if(_0x4a17f2){return _0x4a17f2[_0xfff7('0x21')](_0x2ffcd3)[_0xfff7('0x22')](function(_0x302be3){return _0x302be3;});}return null;};}function removeEntity(_0x5d9642,_0x6cb62d){return function(_0x5d4274){if(_0x5d4274){return _0x5d4274[_0xfff7('0x23')]()[_0xfff7('0x22')](function(){var _0x26095f=_0x5d4274[_0xfff7('0x24')]({'plain':!![]});var _0xa424b7='Scheduler';return db[_0xfff7('0x25')][_0xfff7('0x23')]({'where':{'type':_0xa424b7,'resourceId':_0x26095f['id']}})[_0xfff7('0x22')](function(){return _0x5d4274;});})[_0xfff7('0x22')](function(){_0x5d9642[_0xfff7('0x16')](0xcc)[_0xfff7('0x26')]();});}};}function handleEntityNotFound(_0x40b138,_0x580fb1){return function(_0xec3513){if(!_0xec3513){_0x40b138['sendStatus'](0x194);}return _0xec3513;};}function handleError(_0x133650,_0x39cb80){_0x39cb80=_0x39cb80||0x1f4;return function(_0x1b3869){logger[_0xfff7('0x27')](_0x1b3869[_0xfff7('0x28')]);if(_0x1b3869['name']){delete _0x1b3869[_0xfff7('0x29')];}_0x133650[_0xfff7('0x16')](_0x39cb80)[_0xfff7('0x2a')](_0x1b3869);};}exports['index']=function(_0xf5a9ad,_0x26d66a){var _0x4edfaa={},_0x459957={},_0x5d4c9d={'count':0x0,'rows':[]};var _0x52cf37=_[_0xfff7('0x2b')](db[_0xfff7('0x2c')][_0xfff7('0x2d')],function(_0x54dc54){return{'name':_0x54dc54[_0xfff7('0x2e')],'type':_0x54dc54[_0xfff7('0x2f')][_0xfff7('0x30')]};});_0x459957['model']=_[_0xfff7('0x2b')](_0x52cf37,'name');_0x459957[_0xfff7('0x31')]=_[_0xfff7('0x32')](_0xf5a9ad[_0xfff7('0x31')]);_0x459957[_0xfff7('0x33')]=_[_0xfff7('0x34')](_0x459957[_0xfff7('0x35')],_0x459957[_0xfff7('0x31')]);_0x4edfaa['attributes']=_[_0xfff7('0x34')](_0x459957['model'],qs[_0xfff7('0x36')](_0xf5a9ad[_0xfff7('0x31')][_0xfff7('0x36')]));_0x4edfaa[_0xfff7('0x37')]=_0x4edfaa[_0xfff7('0x37')][_0xfff7('0x38')]?_0x4edfaa[_0xfff7('0x37')]:_0x459957[_0xfff7('0x35')];if(!_0xf5a9ad['query']['hasOwnProperty'](_0xfff7('0x39'))){_0x4edfaa[_0xfff7('0x1a')]=qs[_0xfff7('0x1a')](_0xf5a9ad[_0xfff7('0x31')][_0xfff7('0x1a')]);_0x4edfaa[_0xfff7('0x18')]=qs[_0xfff7('0x18')](_0xf5a9ad[_0xfff7('0x31')][_0xfff7('0x18')]);}_0x4edfaa[_0xfff7('0x3a')]=qs[_0xfff7('0x3b')](_0xf5a9ad[_0xfff7('0x31')][_0xfff7('0x3b')]);_0x4edfaa[_0xfff7('0x3c')]=qs['filters'](_[_0xfff7('0x3d')](_0xf5a9ad['query'],_0x459957[_0xfff7('0x33')]),_0x52cf37);if(_0xf5a9ad[_0xfff7('0x31')]['filter']){_0x4edfaa['where']=_['merge'](_0x4edfaa[_0xfff7('0x3c')],{'$or':_[_0xfff7('0x2b')](_0x52cf37,function(_0x31f765){if(_0x31f765[_0xfff7('0x2f')]!==_0xfff7('0x3e')){var _0x59f471={};_0x59f471[_0x31f765[_0xfff7('0x29')]]={'$like':'%'+_0xf5a9ad[_0xfff7('0x31')]['filter']+'%'};return _0x59f471;}})});}_0x4edfaa=_[_0xfff7('0x3f')]({},_0x4edfaa,_0xf5a9ad[_0xfff7('0x40')]);var _0x5cd21a={'where':_0x4edfaa[_0xfff7('0x3c')]};return db['Schedule']['count'](_0x5cd21a)[_0xfff7('0x22')](function(_0x2b07f1){_0x5d4c9d[_0xfff7('0x1b')]=_0x2b07f1;if(_0xf5a9ad['query'][_0xfff7('0x41')]){_0x4edfaa[_0xfff7('0x42')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x4edfaa);})['then'](function(_0x1579c3){_0x5d4c9d['rows']=_0x1579c3;return _0x5d4c9d;})['then'](respondWithFilteredResult(_0x26d66a,_0x4edfaa))[_0xfff7('0x43')](handleError(_0x26d66a,null));};exports[_0xfff7('0x44')]=function(_0xa10e,_0x432f49){var _0x524585={'raw':![],'where':{'id':_0xa10e[_0xfff7('0x45')]['id']}},_0x2e4eba={};_0x2e4eba[_0xfff7('0x35')]=_[_0xfff7('0x32')](db[_0xfff7('0x2c')][_0xfff7('0x2d')]);_0x2e4eba['query']=_[_0xfff7('0x32')](_0xa10e[_0xfff7('0x31')]);_0x2e4eba[_0xfff7('0x33')]=_[_0xfff7('0x34')](_0x2e4eba[_0xfff7('0x35')],_0x2e4eba[_0xfff7('0x31')]);_0x524585[_0xfff7('0x37')]=_[_0xfff7('0x34')](_0x2e4eba['model'],qs['fields'](_0xa10e[_0xfff7('0x31')][_0xfff7('0x36')]));_0x524585[_0xfff7('0x37')]=_0x524585[_0xfff7('0x37')][_0xfff7('0x38')]?_0x524585[_0xfff7('0x37')]:_0x2e4eba[_0xfff7('0x35')];if(_0xa10e[_0xfff7('0x31')]['includeAll']){_0x524585['include']=[{'all':!![]}];}_0x524585=_[_0xfff7('0x3f')]({},_0x524585,_0xa10e[_0xfff7('0x40')]);return db[_0xfff7('0x2c')][_0xfff7('0x46')](_0x524585)['then'](handleEntityNotFound(_0x432f49,null))[_0xfff7('0x22')](respondWithResult(_0x432f49,null))[_0xfff7('0x43')](handleError(_0x432f49,null));};exports[_0xfff7('0x47')]=function(_0x2c0306,_0x393013){return db[_0xfff7('0x2c')]['create'](_0x2c0306[_0xfff7('0x48')],{})['then'](function(_0x48afdf){var _0x20cbb2=_0x2c0306[_0xfff7('0x49')][_0xfff7('0x24')]({'plain':!![]});if(!_0x20cbb2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20cbb2[_0xfff7('0x4a')]==='user'){var _0x204b53=_0x48afdf[_0xfff7('0x24')]({'plain':!![]});var _0x30b442=_0xfff7('0x4b');return db[_0xfff7('0x4c')]['find']({'where':{'name':_0x30b442,'userProfileId':_0x20cbb2[_0xfff7('0x4d')]},'raw':!![]})['then'](function(_0x508161){if(_0x508161&&_0x508161['autoAssociation']===0x0){return db[_0xfff7('0x25')][_0xfff7('0x47')]({'name':_0x204b53[_0xfff7('0x29')],'resourceId':_0x204b53['id'],'type':_0x508161[_0xfff7('0x29')],'sectionId':_0x508161['id']},{})['then'](function(){return _0x48afdf;});}else{return _0x48afdf;}})[_0xfff7('0x43')](function(_0xee5b67){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xee5b67);throw _0xee5b67;});}return _0x48afdf;})[_0xfff7('0x22')](respondWithResult(_0x393013,0xc9))[_0xfff7('0x43')](handleError(_0x393013,null));};exports[_0xfff7('0x21')]=function(_0x45d243,_0x3b423b){if(_0x45d243[_0xfff7('0x48')]['id']){delete _0x45d243[_0xfff7('0x48')]['id'];}return db[_0xfff7('0x2c')][_0xfff7('0x46')]({'where':{'id':_0x45d243[_0xfff7('0x45')]['id']}})[_0xfff7('0x22')](handleEntityNotFound(_0x3b423b,null))[_0xfff7('0x22')](saveUpdates(_0x45d243[_0xfff7('0x48')],null))[_0xfff7('0x22')](respondWithResult(_0x3b423b,null))[_0xfff7('0x43')](handleError(_0x3b423b,null));};exports[_0xfff7('0x23')]=function(_0x2546ad,_0x353b61){return db[_0xfff7('0x2c')]['find']({'where':{'id':_0x2546ad['params']['id']}})[_0xfff7('0x22')](handleEntityNotFound(_0x353b61,null))['then'](removeEntity(_0x353b61,null))[_0xfff7('0x43')](handleError(_0x353b61,null));};exports[_0xfff7('0x4e')]=function(_0x12f649,_0xd370b3,_0x5ac54b){var _0x329bb0=require(_0xfff7('0x4f'));return db['Schedule']['find']({'where':{'id':_0x12f649[_0xfff7('0x45')]['id']},'raw':!![]})[_0xfff7('0x22')](handleEntityNotFound(_0xd370b3,null))[_0xfff7('0x22')](function(){_0x329bb0[_0xfff7('0x4e')](_0x12f649[_0xfff7('0x45')]['id']);})[_0xfff7('0x22')](respondWithStatusCode(_0xd370b3,null))[_0xfff7('0x43')](handleError(_0xd370b3,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index eb63c38..ebc9101 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 _0x039c=['path','rimraf','./schedule.attributes','exports','define','Schedule','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x039c,0xa2));var _0xc039=function(_0x37ae42,_0x3a5b69){_0x37ae42=_0x37ae42-0x0;var _0x34850b=_0x039c[_0x37ae42];return _0x34850b;};'use strict';var _=require(_0xc039('0x0'));var util=require(_0xc039('0x1'));var logger=require(_0xc039('0x2'))('api');var moment=require(_0xc039('0x3'));var BPromise=require(_0xc039('0x4'));var rp=require(_0xc039('0x5'));var fs=require('fs');var path=require(_0xc039('0x6'));var rimraf=require(_0xc039('0x7'));var config=require('../../config/environment');var attributes=require(_0xc039('0x8'));module[_0xc039('0x9')]=function(_0x5eef16,_0x3a9ab6){return _0x5eef16[_0xc039('0xa')](_0xc039('0xb'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5b1=['api','moment','request-promise','rimraf','../../config/environment','./schedule.attributes','exports','Schedule','lodash','util','../../config/logger'];(function(_0x3c240d,_0x398533){var _0x2081fa=function(_0x296e27){while(--_0x296e27){_0x3c240d['push'](_0x3c240d['shift']());}};_0x2081fa(++_0x398533);}(_0xf5b1,0x19f));var _0x1f5b=function(_0x4f58a0,_0xb4fb09){_0x4f58a0=_0x4f58a0-0x0;var _0x5ebf29=_0xf5b1[_0x4f58a0];return _0x5ebf29;};'use strict';var _=require(_0x1f5b('0x0'));var util=require(_0x1f5b('0x1'));var logger=require(_0x1f5b('0x2'))(_0x1f5b('0x3'));var moment=require(_0x1f5b('0x4'));var BPromise=require('bluebird');var rp=require(_0x1f5b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f5b('0x6'));var config=require(_0x1f5b('0x7'));var attributes=require(_0x1f5b('0x8'));module[_0x1f5b('0x9')]=function(_0x477a01,_0x4845ba){return _0x477a01['define'](_0x1f5b('0xa'),attributes,{'tableName':'tools_schedules','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 89284bc..caf6d9e 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 _0xa136=['../../config/environment','jayson/promise','client','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x41860c,_0xdb1d11){var _0x20cb7c=function(_0x320ddf){while(--_0x320ddf){_0x41860c['push'](_0x41860c['shift']());}};_0x20cb7c(++_0xdb1d11);}(_0xa136,0x149));var _0x6a13=function(_0x1bcd54,_0x19f631){_0x1bcd54=_0x1bcd54-0x0;var _0x170e4f=_0xa136[_0x1bcd54];return _0x170e4f;};'use strict';var _=require(_0x6a13('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6a13('0x1'));var rs=require(_0x6a13('0x2'));var fs=require('fs');var Redis=require(_0x6a13('0x3'));var db=require(_0x6a13('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a13('0x5'))(_0x6a13('0x6'));var config=require(_0x6a13('0x7'));var jayson=require(_0x6a13('0x8'));var client=jayson[_0x6a13('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e73e2,_0x5128b5,_0x4f875d){return new BPromise(function(_0x588e73,_0x4f1d90){return client['request'](_0x5e73e2,_0x4f875d)[_0x6a13('0xa')](function(_0x366f73){logger[_0x6a13('0xb')](_0x6a13('0xc'),_0x5128b5,_0x6a13('0xd'));logger[_0x6a13('0xe')]('Schedule,\x20%s,\x20%s,\x20%s',_0x5128b5,_0x6a13('0xd'),JSON[_0x6a13('0xf')](_0x366f73));if(_0x366f73[_0x6a13('0x10')]){if(_0x366f73['error'][_0x6a13('0x11')]===0x1f4){logger[_0x6a13('0x10')](_0x6a13('0xc'),_0x5128b5,_0x366f73[_0x6a13('0x10')][_0x6a13('0x12')]);return _0x4f1d90(_0x366f73[_0x6a13('0x10')][_0x6a13('0x12')]);}logger[_0x6a13('0x10')]('Schedule,\x20%s,\x20%s',_0x5128b5,_0x366f73[_0x6a13('0x10')][_0x6a13('0x12')]);return _0x588e73(_0x366f73['error'][_0x6a13('0x12')]);}else{logger['info'](_0x6a13('0xc'),_0x5128b5,'request\x20sent');_0x588e73(_0x366f73[_0x6a13('0x13')][_0x6a13('0x12')]);}})[_0x6a13('0x14')](function(_0x3e8cab){logger[_0x6a13('0x10')](_0x6a13('0xc'),_0x5128b5,_0x3e8cab);_0x4f1d90(_0x3e8cab);});});} \ No newline at end of file +var _0x537b=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','error'];(function(_0x476c7,_0x298ee0){var _0x47ae56=function(_0x4acf5a){while(--_0x4acf5a){_0x476c7['push'](_0x476c7['shift']());}};_0x47ae56(++_0x298ee0);}(_0x537b,0x1a2));var _0xb537=function(_0x241ebe,_0x4fc0d4){_0x241ebe=_0x241ebe-0x0;var _0x4ec09a=_0x537b[_0x241ebe];return _0x4ec09a;};'use strict';var _=require(_0xb537('0x0'));var util=require(_0xb537('0x1'));var moment=require(_0xb537('0x2'));var BPromise=require(_0xb537('0x3'));var rs=require(_0xb537('0x4'));var fs=require('fs');var Redis=require(_0xb537('0x5'));var db=require(_0xb537('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb537('0x7'))(_0xb537('0x8'));var config=require('../../config/environment');var jayson=require(_0xb537('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46094d,_0x4286b1,_0x321100){return new BPromise(function(_0x240804,_0x39f063){return client['request'](_0x46094d,_0x321100)['then'](function(_0x3b2ed2){logger['info'](_0xb537('0xa'),_0x4286b1,_0xb537('0xb'));logger['debug'](_0xb537('0xc'),_0x4286b1,_0xb537('0xb'),JSON['stringify'](_0x3b2ed2));if(_0x3b2ed2[_0xb537('0xd')]){if(_0x3b2ed2['error']['code']===0x1f4){logger[_0xb537('0xd')](_0xb537('0xa'),_0x4286b1,_0x3b2ed2[_0xb537('0xd')]['message']);return _0x39f063(_0x3b2ed2[_0xb537('0xd')]['message']);}logger[_0xb537('0xd')]('Schedule,\x20%s,\x20%s',_0x4286b1,_0x3b2ed2[_0xb537('0xd')][_0xb537('0xe')]);return _0x240804(_0x3b2ed2[_0xb537('0xd')][_0xb537('0xe')]);}else{logger[_0xb537('0xf')](_0xb537('0xa'),_0x4286b1,_0xb537('0xb'));_0x240804(_0x3b2ed2[_0xb537('0x10')][_0xb537('0xe')]);}})[_0xb537('0x11')](function(_0x4c02d8){logger['error'](_0xb537('0xa'),_0x4286b1,_0x4c02d8);_0x39f063(_0x4c02d8);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 7a59c4a..10834ca 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 _0x14b4=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download'];(function(_0x355c57,_0x3b4117){var _0x33d3b5=function(_0x1e5f27){while(--_0x1e5f27){_0x355c57['push'](_0x355c57['shift']());}};_0x33d3b5(++_0x3b4117);}(_0x14b4,0x165));var _0x414b=function(_0x1af2ef,_0x292578){_0x1af2ef=_0x1af2ef-0x0;var _0x55fbc2=_0x14b4[_0x1af2ef];return _0x55fbc2;};'use strict';var multer=require(_0x414b('0x0'));var util=require(_0x414b('0x1'));var path=require(_0x414b('0x2'));var timeout=require(_0x414b('0x3'));var express=require(_0x414b('0x4'));var router=express[_0x414b('0x5')]();var fs_extra=require(_0x414b('0x6'));var auth=require(_0x414b('0x7'));var interaction=require(_0x414b('0x8'));var config=require('../../config/environment');var controller=require(_0x414b('0x9'));router[_0x414b('0xa')]('/',auth[_0x414b('0xb')](),controller[_0x414b('0xc')]);router['get'](_0x414b('0xd'),auth[_0x414b('0xb')](),controller[_0x414b('0xe')]);router[_0x414b('0xa')](_0x414b('0xf'),auth['isAuthenticated'](),controller[_0x414b('0x10')]);router['get']('/:id/download',auth[_0x414b('0xb')](),controller[_0x414b('0x11')]);router[_0x414b('0x12')]('/',auth['isAuthenticated'](),controller[_0x414b('0x13')]);router[_0x414b('0x14')](_0x414b('0xf'),auth[_0x414b('0xb')](),controller[_0x414b('0x15')]);router[_0x414b('0x16')](_0x414b('0xf'),auth['isAuthenticated'](),controller[_0x414b('0x17')]);module[_0x414b('0x18')]=router; \ No newline at end of file +var _0xf3e6=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','download'];(function(_0x8121fa,_0x395cdf){var _0x37ebd5=function(_0x2fb41e){while(--_0x2fb41e){_0x8121fa['push'](_0x8121fa['shift']());}};_0x37ebd5(++_0x395cdf);}(_0xf3e6,0x10f));var _0x6f3e=function(_0x4224e2,_0x340a2b){_0x4224e2=_0x4224e2-0x0;var _0x309e5d=_0xf3e6[_0x4224e2];return _0x309e5d;};'use strict';var multer=require(_0x6f3e('0x0'));var util=require(_0x6f3e('0x1'));var path=require(_0x6f3e('0x2'));var timeout=require(_0x6f3e('0x3'));var express=require(_0x6f3e('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6f3e('0x5'));var interaction=require(_0x6f3e('0x6'));var config=require(_0x6f3e('0x7'));var controller=require('./screenRecording.controller');router[_0x6f3e('0x8')]('/',auth[_0x6f3e('0x9')](),controller['index']);router[_0x6f3e('0x8')](_0x6f3e('0xa'),auth[_0x6f3e('0x9')](),controller[_0x6f3e('0xb')]);router['get'](_0x6f3e('0xc'),auth[_0x6f3e('0x9')](),controller[_0x6f3e('0xd')]);router[_0x6f3e('0x8')]('/:id/download',auth[_0x6f3e('0x9')](),controller[_0x6f3e('0xe')]);router[_0x6f3e('0xf')]('/',auth[_0x6f3e('0x9')](),controller[_0x6f3e('0x10')]);router[_0x6f3e('0x11')]('/:id',auth[_0x6f3e('0x9')](),controller[_0x6f3e('0x12')]);router[_0x6f3e('0x13')](_0x6f3e('0xc'),auth[_0x6f3e('0x9')](),controller[_0x6f3e('0x14')]);module[_0x6f3e('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 4dd86c3..7fadcfd 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 _0x13b6=['setDataValue','INTEGER','startedAt','subtract','DATE','format','MM-DD-YYYY\x20HH:mm','toString','closedAt','createdAt','updatedAt','sequelize','path','../../config/environment','exports','VIRTUAL','value','extname','getDataValue','STRING'];(function(_0xb1174e,_0x1e68a7){var _0x285bac=function(_0x32c505){while(--_0x32c505){_0xb1174e['push'](_0xb1174e['shift']());}};_0x285bac(++_0x1e68a7);}(_0x13b6,0x97));var _0x613b=function(_0x5e00d0,_0x1afc13){_0x5e00d0=_0x5e00d0-0x0;var _0x5b9e9e=_0x13b6[_0x5e00d0];return _0x5b9e9e;};'use strict';var Sequelize=require(_0x613b('0x0'));var moment=require('moment');var path=require(_0x613b('0x1'));var config=require(_0x613b('0x2'));module[_0x613b('0x3')]={'format':{'type':Sequelize[_0x613b('0x4')],'get':function(){return this['getDataValue'](_0x613b('0x5'))?path[_0x613b('0x6')](this[_0x613b('0x7')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x613b('0x8')]},'channel':{'type':Sequelize[_0x613b('0x8')]},'value':{'type':Sequelize[_0x613b('0x8')],'set':function(_0x593a18){var _0x31a96f=_0x593a18['replace'](/\\/g,'/');this[_0x613b('0x9')]('value',_0x31a96f);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x613b('0xa')],'set':function(_0x37dbc7){this[_0x613b('0x9')](_0x613b('0xb'),moment()[_0x613b('0xc')](_0x37dbc7,'ms'));this['setDataValue']('closedAt',moment());this[_0x613b('0x9')]('duration',_0x37dbc7);}},'startedAt':{'type':Sequelize[_0x613b('0xd')],'get':function(){return moment(this['getDataValue']('startedAt'))[_0x613b('0xe')](_0x613b('0xf'))[_0x613b('0x10')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x613b('0x7')](_0x613b('0x11')))[_0x613b('0xe')](_0x613b('0xf'))[_0x613b('0x10')]();}},'createdAt':{'type':Sequelize[_0x613b('0xd')],'get':function(){return moment(this[_0x613b('0x7')](_0x613b('0x12')))[_0x613b('0xe')](_0x613b('0xf'))['toString']();}},'updatedAt':{'type':Sequelize[_0x613b('0xd')],'get':function(){return moment(this[_0x613b('0x7')](_0x613b('0x13')))['format']('MM-DD-YYYY\x20HH:mm')[_0x613b('0x10')]();}}}; \ No newline at end of file +var _0x119c=['getDataValue','STRING','replace','setDataValue','INTEGER','startedAt','subtract','DATE','format','MM-DD-YYYY\x20HH:mm','toString','closedAt','createdAt','updatedAt','moment','../../config/environment','exports','VIRTUAL','value','extname'];(function(_0x8faedc,_0x2198a7){var _0xbeba54=function(_0x27232a){while(--_0x27232a){_0x8faedc['push'](_0x8faedc['shift']());}};_0xbeba54(++_0x2198a7);}(_0x119c,0xea));var _0xc119=function(_0x258257,_0x32042d){_0x258257=_0x258257-0x0;var _0xafb58a=_0x119c[_0x258257];return _0xafb58a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc119('0x0'));var path=require('path');var config=require(_0xc119('0x1'));module[_0xc119('0x2')]={'format':{'type':Sequelize[_0xc119('0x3')],'get':function(){return this['getDataValue'](_0xc119('0x4'))?path[_0xc119('0x5')](this[_0xc119('0x6')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xc119('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xc119('0x7')],'set':function(_0x57bc8a){var _0x16b3d2=_0x57bc8a[_0xc119('0x8')](/\\/g,'/');this[_0xc119('0x9')](_0xc119('0x4'),_0x16b3d2);}},'rating':{'type':Sequelize[_0xc119('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xc119('0xa')],'set':function(_0x367745){this[_0xc119('0x9')](_0xc119('0xb'),moment()[_0xc119('0xc')](_0x367745,'ms'));this[_0xc119('0x9')]('closedAt',moment());this[_0xc119('0x9')]('duration',_0x367745);}},'startedAt':{'type':Sequelize[_0xc119('0xd')],'get':function(){return moment(this[_0xc119('0x6')](_0xc119('0xb')))[_0xc119('0xe')](_0xc119('0xf'))[_0xc119('0x10')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xc119('0x11')))[_0xc119('0xe')](_0xc119('0xf'))[_0xc119('0x10')]();}},'createdAt':{'type':Sequelize[_0xc119('0xd')],'get':function(){return moment(this['getDataValue'](_0xc119('0x12')))['format'](_0xc119('0xf'))[_0xc119('0x10')]();}},'updatedAt':{'type':Sequelize[_0xc119('0xd')],'get':function(){return moment(this[_0xc119('0x6')](_0xc119('0x13')))[_0xc119('0xe')](_0xc119('0xf'))[_0xc119('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 2f34b10..de3d73c 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 _0xd0bb=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','fieldName','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','duration','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x115fc9,_0x22021c){_0x115fc9=_0x115fc9-0x0;var _0x2d4bc2=_0xd0bb[_0x115fc9];return _0x2d4bc2;};'use strict';var emlformat=require(_0xbd0b('0x0'));var rimraf=require(_0xbd0b('0x1'));var zipdir=require(_0xbd0b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd0b('0x3'));var moment=require('moment');var BPromise=require(_0xbd0b('0x4'));var Mustache=require(_0xbd0b('0x5'));var util=require('util');var path=require(_0xbd0b('0x6'));var sox=require('sox');var csv=require(_0xbd0b('0x7'));var ejs=require(_0xbd0b('0x8'));var fs=require('fs');var fs_extra=require(_0xbd0b('0x9'));var _=require(_0xbd0b('0xa'));var squel=require(_0xbd0b('0xb'));var crypto=require('crypto');var jsforce=require(_0xbd0b('0xc'));var deskjs=require(_0xbd0b('0xd'));var toCsv=require(_0xbd0b('0x7'));var querystring=require(_0xbd0b('0xe'));var Papa=require(_0xbd0b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbd0b('0x10'));var as=require(_0xbd0b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd0b('0x12'))(_0xbd0b('0x13'));var utils=require('../../config/utils');var config=require(_0xbd0b('0x14'));var licenseUtil=require(_0xbd0b('0x15'));var db=require(_0xbd0b('0x16'))['db'];function respondWithStatusCode(_0x315ed9,_0x2621bf){_0x2621bf=_0x2621bf||0xcc;return function(_0x42a96b){if(_0x42a96b){return _0x315ed9[_0xbd0b('0x17')](_0x2621bf);}return _0x315ed9[_0xbd0b('0x18')](_0x2621bf)[_0xbd0b('0x19')]();};}function respondWithResult(_0x1c10c1,_0x2d4664){_0x2d4664=_0x2d4664||0xc8;return function(_0x57077a){if(_0x57077a){return _0x1c10c1[_0xbd0b('0x18')](_0x2d4664)['json'](_0x57077a);}};}function respondWithFilteredResult(_0x4a8014,_0x36d1ca){return function(_0x4c0e52){if(_0x4c0e52){var _0x3183cf=typeof _0x36d1ca[_0xbd0b('0x1a')]===_0xbd0b('0x1b')&&typeof _0x36d1ca['limit']==='undefined';var _0x2136ef=_0x4c0e52[_0xbd0b('0x1c')];var _0x1f2a6e=_0x3183cf?0x0:_0x36d1ca[_0xbd0b('0x1a')];var _0x1c0a7c=_0x3183cf?_0x4c0e52[_0xbd0b('0x1c')]:_0x36d1ca['offset']+_0x36d1ca[_0xbd0b('0x1d')];var _0x49499f;if(_0x1c0a7c>=_0x2136ef){_0x1c0a7c=_0x2136ef;_0x49499f=0xc8;}else{_0x49499f=0xce;}_0x4a8014[_0xbd0b('0x18')](_0x49499f);return _0x4a8014[_0xbd0b('0x1e')](_0xbd0b('0x1f'),_0x1f2a6e+'-'+_0x1c0a7c+'/'+_0x2136ef)[_0xbd0b('0x20')](_0x4c0e52);}return null;};}function patchUpdates(_0x4b312d){return function(_0x403c91){try{jsonpatch[_0xbd0b('0x21')](_0x403c91,_0x4b312d,!![]);}catch(_0x40b021){return BPromise['reject'](_0x40b021);}return _0x403c91[_0xbd0b('0x22')]();};}function saveUpdates(_0x560db4,_0xc66b8){return function(_0x3c4938){if(_0x3c4938){return _0x3c4938[_0xbd0b('0x23')](_0x560db4)[_0xbd0b('0x24')](function(_0x297c85){return _0x297c85;});}return null;};}function removeEntity(_0x539359,_0x75909f){return function(_0x58a721){if(_0x58a721){return _0x58a721[_0xbd0b('0x25')]()[_0xbd0b('0x24')](function(){_0x539359[_0xbd0b('0x18')](0xcc)[_0xbd0b('0x19')]();});}};}function handleEntityNotFound(_0xfd9f82,_0xb06342){return function(_0x4fe9ed){if(!_0x4fe9ed){_0xfd9f82[_0xbd0b('0x17')](0x194);}return _0x4fe9ed;};}function handleError(_0x1b46a3,_0x33b752){_0x33b752=_0x33b752||0x1f4;return function(_0x1b5a00){logger[_0xbd0b('0x26')](_0x1b5a00[_0xbd0b('0x27')]);if(_0x1b5a00['name']){delete _0x1b5a00[_0xbd0b('0x28')];}_0x1b46a3[_0xbd0b('0x18')](_0x33b752)[_0xbd0b('0x29')](_0x1b5a00);};}exports['index']=function(_0x4dfe76,_0x2187a5){var _0x684b09={},_0x14e5a3={},_0xf4ba04={'count':0x0,'rows':[]};var _0x4e2149=_[_0xbd0b('0x2a')](db[_0xbd0b('0x2b')]['rawAttributes'],function(_0x45f7d6){return{'name':_0x45f7d6[_0xbd0b('0x2c')],'type':_0x45f7d6['type']['key']};});_0x14e5a3[_0xbd0b('0x2d')]=_[_0xbd0b('0x2e')](_['map'](_0x4e2149,_0xbd0b('0x28')),[_0xbd0b('0x2f')]);_0x14e5a3[_0xbd0b('0x30')]=_[_0xbd0b('0x31')](_0x4dfe76[_0xbd0b('0x30')]);_0x14e5a3[_0xbd0b('0x32')]=_['intersection'](_0x14e5a3[_0xbd0b('0x2d')],_0x14e5a3[_0xbd0b('0x30')]);_0x684b09[_0xbd0b('0x33')]=_[_0xbd0b('0x34')](_0x14e5a3[_0xbd0b('0x2d')],qs[_0xbd0b('0x35')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x35')]));_0x684b09[_0xbd0b('0x33')]=_0x684b09[_0xbd0b('0x33')][_0xbd0b('0x36')]?_0x684b09[_0xbd0b('0x33')]:_0x14e5a3[_0xbd0b('0x2d')];if(!_0x4dfe76[_0xbd0b('0x30')]['hasOwnProperty'](_0xbd0b('0x37'))){_0x684b09[_0xbd0b('0x1d')]=qs['limit'](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x1d')]);_0x684b09[_0xbd0b('0x1a')]=qs[_0xbd0b('0x1a')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x1a')]);}_0x684b09['order']=qs[_0xbd0b('0x38')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x38')]);_0x684b09[_0xbd0b('0x39')]=qs[_0xbd0b('0x32')](_['pick'](_0x4dfe76['query'],_0x14e5a3[_0xbd0b('0x32')]),_0x4e2149);if(_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3a')]){_0x684b09[_0xbd0b('0x39')]=_['merge'](_0x684b09['where'],{'$or':_[_0xbd0b('0x2a')](_0x4e2149,function(_0x4d8237){if(_0x4d8237[_0xbd0b('0x3b')]!==_0xbd0b('0x3c')){var _0x3f34dc={};_0x3f34dc[_0x4d8237[_0xbd0b('0x28')]]={'$like':'%'+_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3a')]+'%'};return _0x3f34dc;}})});}_0x684b09=_[_0xbd0b('0x3d')]({},_0x684b09,_0x4dfe76[_0xbd0b('0x3e')]);var _0x2acc9f={'where':_0x684b09[_0xbd0b('0x39')]};return db[_0xbd0b('0x2b')][_0xbd0b('0x1c')](_0x2acc9f)[_0xbd0b('0x24')](function(_0x425c8a){_0xf4ba04[_0xbd0b('0x1c')]=_0x425c8a;if(_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3f')]){_0x684b09[_0xbd0b('0x40')]=[{'all':!![]}];}return db['ScreenRecording'][_0xbd0b('0x41')](_0x684b09);})[_0xbd0b('0x24')](function(_0x89b5ea){_0xf4ba04[_0xbd0b('0x42')]=_0x89b5ea;return _0xf4ba04;})[_0xbd0b('0x24')](respondWithFilteredResult(_0x2187a5,_0x684b09))[_0xbd0b('0x43')](handleError(_0x2187a5,null));};exports[_0xbd0b('0x44')]=function(_0x1b4497,_0x2a1a1d){var _0x4d72f={'raw':![],'where':{'id':_0x1b4497[_0xbd0b('0x45')]['id']}},_0xa252a2={};_0xa252a2['model']=_[_0xbd0b('0x31')](db['ScreenRecording']['rawAttributes']);_0xa252a2[_0xbd0b('0x30')]=_[_0xbd0b('0x31')](_0x1b4497[_0xbd0b('0x30')]);_0xa252a2['filters']=_[_0xbd0b('0x34')](_0xa252a2[_0xbd0b('0x2d')],_0xa252a2[_0xbd0b('0x30')]);_0x4d72f[_0xbd0b('0x33')]=_[_0xbd0b('0x34')](_0xa252a2['model'],qs[_0xbd0b('0x35')](_0x1b4497[_0xbd0b('0x30')][_0xbd0b('0x35')]));_0x4d72f[_0xbd0b('0x33')]=_0x4d72f[_0xbd0b('0x33')][_0xbd0b('0x36')]?_0x4d72f['attributes']:_0xa252a2[_0xbd0b('0x2d')];if(_0x1b4497[_0xbd0b('0x30')][_0xbd0b('0x3f')]){_0x4d72f[_0xbd0b('0x40')]=[{'all':!![]}];}_0x4d72f=_[_0xbd0b('0x3d')]({},_0x4d72f,_0x1b4497[_0xbd0b('0x3e')]);return db[_0xbd0b('0x2b')][_0xbd0b('0x46')](_0x4d72f)[_0xbd0b('0x24')](handleEntityNotFound(_0x2a1a1d,null))[_0xbd0b('0x24')](respondWithResult(_0x2a1a1d,null))[_0xbd0b('0x43')](handleError(_0x2a1a1d,null));};exports[_0xbd0b('0x47')]=function(_0x222ee1,_0x30f77e){return db[_0xbd0b('0x2b')][_0xbd0b('0x47')](_0x222ee1[_0xbd0b('0x48')],{})[_0xbd0b('0x24')](respondWithResult(_0x30f77e,0xc9))[_0xbd0b('0x43')](handleError(_0x30f77e,null));};exports[_0xbd0b('0x23')]=function(_0x3cfb52,_0xbd64e2){if(_0x3cfb52[_0xbd0b('0x48')]['id']){delete _0x3cfb52['body']['id'];}delete _0x3cfb52[_0xbd0b('0x48')][_0xbd0b('0x49')];delete _0x3cfb52['body']['createdAt'];delete _0x3cfb52['body'][_0xbd0b('0x4a')];delete _0x3cfb52['body'][_0xbd0b('0x4b')];return db[_0xbd0b('0x2b')][_0xbd0b('0x46')]({'where':{'id':_0x3cfb52[_0xbd0b('0x45')]['id']}})['then'](handleEntityNotFound(_0xbd64e2,null))[_0xbd0b('0x24')](saveUpdates(_0x3cfb52['body'],null))[_0xbd0b('0x24')](respondWithResult(_0xbd64e2,null))['catch'](handleError(_0xbd64e2,null));};exports['describe']=function(_0x80d89a,_0x22f741){return db[_0xbd0b('0x2b')][_0xbd0b('0x4c')]()[_0xbd0b('0x24')](respondWithResult(_0x22f741,null))[_0xbd0b('0x43')](handleError(_0x22f741,null));};exports[_0xbd0b('0x4d')]=function(_0x2a7252,_0x4cc013,_0x48a78c){var _0x2d13fd=require(_0xbd0b('0x4e'));var _0x5094bd=![];var _0x514985={};if(_0x2a7252[_0xbd0b('0x30')][_0xbd0b('0x3b')]&&_0x2a7252[_0xbd0b('0x30')][_0xbd0b('0x3b')]==='uniqueid'){_0x514985[_0xbd0b('0x4f')]=_0x2a7252[_0xbd0b('0x45')]['id'];}else{_0x514985['id']=_0x2a7252[_0xbd0b('0x45')]['id'];}return db[_0xbd0b('0x2b')]['find']({'where':_0x514985,'attributes':['id',_0xbd0b('0x4b')],'raw':!![]})[_0xbd0b('0x24')](handleEntityNotFound(_0x4cc013,null))['then'](function(_0x122a19){if(_0x122a19){var _0x1ea443=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],_0xbd0b('0x52'),_0x122a19[_0xbd0b('0x4b')]);var _0x3a526a=util[_0xbd0b('0x2f')]('%s.cypher',_0x1ea443);if(fs[_0xbd0b('0x53')](_0x3a526a)){_0x5094bd=!![];return _0x2d13fd[_0xbd0b('0x54')](_0x3a526a,_0x1ea443,config[_0xbd0b('0x55')][_0xbd0b('0x56')])[_0xbd0b('0x24')](function(){return _0x122a19;});}return _0x122a19;}})[_0xbd0b('0x24')](function(_0x49b7a6){if(_0x49b7a6){var _0x570648=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],'server/files/screen_recordings',_0x49b7a6[_0xbd0b('0x4b')]);if(!fs[_0xbd0b('0x53')](_0x570648)){throw new db[(_0xbd0b('0x57'))][(_0xbd0b('0x58'))](_0xbd0b('0x59'));}if(_0x49b7a6['filename']){return _0x4cc013[_0xbd0b('0x4d')](_0x570648,_0x49b7a6[_0xbd0b('0x5a')]+path[_0xbd0b('0x5b')](_0x570648),function(){if(_0x5094bd){fs[_0xbd0b('0x5c')](_0x570648);}});}else{return _0x4cc013[_0xbd0b('0x4d')](_0x570648,function(_0xa08f72){if(_0x5094bd){fs[_0xbd0b('0x5c')](_0x570648);}});}}})[_0xbd0b('0x43')](function(_0x429534){if(_0x429534[_0xbd0b('0x5d')]===_0xbd0b('0x59')){_0x4cc013[_0xbd0b('0x18')](0x194)[_0xbd0b('0x29')](_0xbd0b('0x5e'));}else{return handleError(_0x4cc013,null);}});};exports[_0xbd0b('0x25')]=function(_0x1fefd5,_0x1e0beb){return db['ScreenRecording'][_0xbd0b('0x46')]({'where':{'id':_0x1fefd5[_0xbd0b('0x45')]['id']}})[_0xbd0b('0x24')](function(_0x2c935c){if(_['isNil'](_0x2c935c)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2c935c;})[_0xbd0b('0x24')](function(_0x45c6b5){var _0x4317f0=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],'server/files/screen_recordings',_0x45c6b5[_0xbd0b('0x4b')]);logger['info'](_0xbd0b('0x5f'),_0x4317f0);if(!_[_0xbd0b('0x60')](_0x45c6b5[_0xbd0b('0x4b')])&&fs[_0xbd0b('0x53')](_0x4317f0)){logger[_0xbd0b('0x61')](_0xbd0b('0x62')+_0x4317f0+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xbd0b('0x63')](_0x4317f0);}_0x4317f0=_0x4317f0+_0xbd0b('0x64');if(!_[_0xbd0b('0x60')](_0x45c6b5[_0xbd0b('0x4b')])&&fs['existsSync'](_0x4317f0)){logger[_0xbd0b('0x61')](_0xbd0b('0x62')+_0x4317f0+_0xbd0b('0x65'));fs[_0xbd0b('0x63')](_0x4317f0);}return _0x45c6b5;})[_0xbd0b('0x24')](function(_0x4df3df){if(!_0x4df3df)throw new InternalError();return _0x4df3df['destroy']();})[_0xbd0b('0x24')](function(){_0x1e0beb['status'](0xcc)[_0xbd0b('0x19')]();})[_0xbd0b('0x43')](handleError(_0x1e0beb,null));}; \ No newline at end of file +var _0x7dfd=['../../components/encryptor','uniqueid','join','%s.cypher','existsSync','decryptFile','secrets','root','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','stack','name','send','index','ScreenRecording','fieldName','key','model','map','format','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','length','catch','create','body','duration','createdAt','closedAt','value','find','describe','download'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd7df('0x0'));var rimraf=require(_0xd7df('0x1'));var zipdir=require(_0xd7df('0x2'));var jsonpatch=require(_0xd7df('0x3'));var rp=require(_0xd7df('0x4'));var moment=require(_0xd7df('0x5'));var BPromise=require(_0xd7df('0x6'));var Mustache=require(_0xd7df('0x7'));var util=require(_0xd7df('0x8'));var path=require(_0xd7df('0x9'));var sox=require(_0xd7df('0xa'));var csv=require(_0xd7df('0xb'));var ejs=require(_0xd7df('0xc'));var fs=require('fs');var fs_extra=require(_0xd7df('0xd'));var _=require(_0xd7df('0xe'));var squel=require(_0xd7df('0xf'));var crypto=require(_0xd7df('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xd7df('0x11'));var toCsv=require(_0xd7df('0xb'));var querystring=require(_0xd7df('0x12'));var Papa=require(_0xd7df('0x13'));var Redis=require('ioredis');var authService=require(_0xd7df('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd7df('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7df('0x16'))(_0xd7df('0x17'));var utils=require(_0xd7df('0x18'));var config=require(_0xd7df('0x19'));var licenseUtil=require(_0xd7df('0x1a'));var db=require(_0xd7df('0x1b'))['db'];function respondWithStatusCode(_0x2e8187,_0x3da618){_0x3da618=_0x3da618||0xcc;return function(_0x7ba3c){if(_0x7ba3c){return _0x2e8187[_0xd7df('0x1c')](_0x3da618);}return _0x2e8187[_0xd7df('0x1d')](_0x3da618)[_0xd7df('0x1e')]();};}function respondWithResult(_0xe1595f,_0x196632){_0x196632=_0x196632||0xc8;return function(_0x3b2559){if(_0x3b2559){return _0xe1595f[_0xd7df('0x1d')](_0x196632)[_0xd7df('0x1f')](_0x3b2559);}};}function respondWithFilteredResult(_0x57b8be,_0x4c5cf){return function(_0x23cdbc){if(_0x23cdbc){var _0x513b13=typeof _0x4c5cf[_0xd7df('0x20')]===_0xd7df('0x21')&&typeof _0x4c5cf['limit']===_0xd7df('0x21');var _0x30ee65=_0x23cdbc[_0xd7df('0x22')];var _0x5210e5=_0x513b13?0x0:_0x4c5cf[_0xd7df('0x20')];var _0x471621=_0x513b13?_0x23cdbc[_0xd7df('0x22')]:_0x4c5cf['offset']+_0x4c5cf[_0xd7df('0x23')];var _0x20dc3e;if(_0x471621>=_0x30ee65){_0x471621=_0x30ee65;_0x20dc3e=0xc8;}else{_0x20dc3e=0xce;}_0x57b8be[_0xd7df('0x1d')](_0x20dc3e);return _0x57b8be['set'](_0xd7df('0x24'),_0x5210e5+'-'+_0x471621+'/'+_0x30ee65)['json'](_0x23cdbc);}return null;};}function patchUpdates(_0x225e33){return function(_0x5ab737){try{jsonpatch[_0xd7df('0x25')](_0x5ab737,_0x225e33,!![]);}catch(_0x342b54){return BPromise[_0xd7df('0x26')](_0x342b54);}return _0x5ab737['save']();};}function saveUpdates(_0xc50077,_0x502ae8){return function(_0x44079b){if(_0x44079b){return _0x44079b[_0xd7df('0x27')](_0xc50077)[_0xd7df('0x28')](function(_0x29f354){return _0x29f354;});}return null;};}function removeEntity(_0x1c774b,_0xa80cbf){return function(_0x1e3bf3){if(_0x1e3bf3){return _0x1e3bf3['destroy']()['then'](function(){_0x1c774b[_0xd7df('0x1d')](0xcc)[_0xd7df('0x1e')]();});}};}function handleEntityNotFound(_0x26047f,_0x459f11){return function(_0x13f190){if(!_0x13f190){_0x26047f[_0xd7df('0x1c')](0x194);}return _0x13f190;};}function handleError(_0x373359,_0x2b6fde){_0x2b6fde=_0x2b6fde||0x1f4;return function(_0x163904){logger['error'](_0x163904[_0xd7df('0x29')]);if(_0x163904[_0xd7df('0x2a')]){delete _0x163904[_0xd7df('0x2a')];}_0x373359[_0xd7df('0x1d')](_0x2b6fde)[_0xd7df('0x2b')](_0x163904);};}exports[_0xd7df('0x2c')]=function(_0x3f78fa,_0x36de76){var _0x5195cf={},_0x4ba779={},_0x52b56a={'count':0x0,'rows':[]};var _0x58584d=_['map'](db[_0xd7df('0x2d')]['rawAttributes'],function(_0xd366b){return{'name':_0xd366b[_0xd7df('0x2e')],'type':_0xd366b['type'][_0xd7df('0x2f')]};});_0x4ba779[_0xd7df('0x30')]=_['differenceBy'](_[_0xd7df('0x31')](_0x58584d,_0xd7df('0x2a')),[_0xd7df('0x32')]);_0x4ba779[_0xd7df('0x33')]=_[_0xd7df('0x34')](_0x3f78fa[_0xd7df('0x33')]);_0x4ba779['filters']=_[_0xd7df('0x35')](_0x4ba779[_0xd7df('0x30')],_0x4ba779[_0xd7df('0x33')]);_0x5195cf[_0xd7df('0x36')]=_[_0xd7df('0x35')](_0x4ba779[_0xd7df('0x30')],qs[_0xd7df('0x37')](_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x37')]));_0x5195cf[_0xd7df('0x36')]=_0x5195cf[_0xd7df('0x36')]['length']?_0x5195cf['attributes']:_0x4ba779[_0xd7df('0x30')];if(!_0x3f78fa['query'][_0xd7df('0x38')](_0xd7df('0x39'))){_0x5195cf[_0xd7df('0x23')]=qs[_0xd7df('0x23')](_0x3f78fa['query']['limit']);_0x5195cf['offset']=qs[_0xd7df('0x20')](_0x3f78fa[_0xd7df('0x33')]['offset']);}_0x5195cf[_0xd7df('0x3a')]=qs[_0xd7df('0x3b')](_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x3b')]);_0x5195cf['where']=qs[_0xd7df('0x3c')](_[_0xd7df('0x3d')](_0x3f78fa['query'],_0x4ba779[_0xd7df('0x3c')]),_0x58584d);if(_0x3f78fa['query'][_0xd7df('0x3e')]){_0x5195cf[_0xd7df('0x3f')]=_[_0xd7df('0x40')](_0x5195cf['where'],{'$or':_[_0xd7df('0x31')](_0x58584d,function(_0x2a7252){if(_0x2a7252[_0xd7df('0x41')]!==_0xd7df('0x42')){var _0x54ea42={};_0x54ea42[_0x2a7252[_0xd7df('0x2a')]]={'$like':'%'+_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x3e')]+'%'};return _0x54ea42;}})});}_0x5195cf=_['merge']({},_0x5195cf,_0x3f78fa[_0xd7df('0x43')]);var _0x207852={'where':_0x5195cf[_0xd7df('0x3f')]};return db['ScreenRecording'][_0xd7df('0x22')](_0x207852)[_0xd7df('0x28')](function(_0x4910cb){_0x52b56a['count']=_0x4910cb;if(_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x44')]){_0x5195cf[_0xd7df('0x45')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x5195cf);})[_0xd7df('0x28')](function(_0x4ebdbe){_0x52b56a[_0xd7df('0x46')]=_0x4ebdbe;return _0x52b56a;})['then'](respondWithFilteredResult(_0x36de76,_0x5195cf))['catch'](handleError(_0x36de76,null));};exports[_0xd7df('0x47')]=function(_0x579d0f,_0x18ef10){var _0x5302f4={'raw':![],'where':{'id':_0x579d0f[_0xd7df('0x48')]['id']}},_0xad2d69={};_0xad2d69[_0xd7df('0x30')]=_[_0xd7df('0x34')](db[_0xd7df('0x2d')][_0xd7df('0x49')]);_0xad2d69[_0xd7df('0x33')]=_['keys'](_0x579d0f[_0xd7df('0x33')]);_0xad2d69['filters']=_[_0xd7df('0x35')](_0xad2d69[_0xd7df('0x30')],_0xad2d69[_0xd7df('0x33')]);_0x5302f4[_0xd7df('0x36')]=_[_0xd7df('0x35')](_0xad2d69[_0xd7df('0x30')],qs[_0xd7df('0x37')](_0x579d0f[_0xd7df('0x33')][_0xd7df('0x37')]));_0x5302f4['attributes']=_0x5302f4[_0xd7df('0x36')][_0xd7df('0x4a')]?_0x5302f4['attributes']:_0xad2d69['model'];if(_0x579d0f[_0xd7df('0x33')][_0xd7df('0x44')]){_0x5302f4[_0xd7df('0x45')]=[{'all':!![]}];}_0x5302f4=_['merge']({},_0x5302f4,_0x579d0f['options']);return db[_0xd7df('0x2d')]['find'](_0x5302f4)[_0xd7df('0x28')](handleEntityNotFound(_0x18ef10,null))[_0xd7df('0x28')](respondWithResult(_0x18ef10,null))[_0xd7df('0x4b')](handleError(_0x18ef10,null));};exports[_0xd7df('0x4c')]=function(_0x1838aa,_0x28c13f){return db[_0xd7df('0x2d')][_0xd7df('0x4c')](_0x1838aa[_0xd7df('0x4d')],{})[_0xd7df('0x28')](respondWithResult(_0x28c13f,0xc9))[_0xd7df('0x4b')](handleError(_0x28c13f,null));};exports[_0xd7df('0x27')]=function(_0x54222c,_0x1f2f99){if(_0x54222c[_0xd7df('0x4d')]['id']){delete _0x54222c[_0xd7df('0x4d')]['id'];}delete _0x54222c[_0xd7df('0x4d')][_0xd7df('0x4e')];delete _0x54222c['body'][_0xd7df('0x4f')];delete _0x54222c[_0xd7df('0x4d')][_0xd7df('0x50')];delete _0x54222c['body'][_0xd7df('0x51')];return db['ScreenRecording'][_0xd7df('0x52')]({'where':{'id':_0x54222c[_0xd7df('0x48')]['id']}})[_0xd7df('0x28')](handleEntityNotFound(_0x1f2f99,null))[_0xd7df('0x28')](saveUpdates(_0x54222c[_0xd7df('0x4d')],null))['then'](respondWithResult(_0x1f2f99,null))['catch'](handleError(_0x1f2f99,null));};exports['describe']=function(_0xe4b221,_0x4a6cf5){return db[_0xd7df('0x2d')][_0xd7df('0x53')]()[_0xd7df('0x28')](respondWithResult(_0x4a6cf5,null))[_0xd7df('0x4b')](handleError(_0x4a6cf5,null));};exports[_0xd7df('0x54')]=function(_0x418da,_0xf72803,_0xb054d7){var _0x453876=require(_0xd7df('0x55'));var _0x382d11=![];var _0x327365={};if(_0x418da[_0xd7df('0x33')][_0xd7df('0x41')]&&_0x418da[_0xd7df('0x33')][_0xd7df('0x41')]==='uniqueid'){_0x327365[_0xd7df('0x56')]=_0x418da[_0xd7df('0x48')]['id'];}else{_0x327365['id']=_0x418da['params']['id'];}return db['ScreenRecording'][_0xd7df('0x52')]({'where':_0x327365,'attributes':['id','value'],'raw':!![]})[_0xd7df('0x28')](handleEntityNotFound(_0xf72803,null))['then'](function(_0x1f34c2){if(_0x1f34c2){var _0x28151a=path[_0xd7df('0x57')](config['root'],'server/files/screen_recordings',_0x1f34c2['value']);var _0x3666ba=util[_0xd7df('0x32')](_0xd7df('0x58'),_0x28151a);if(fs[_0xd7df('0x59')](_0x3666ba)){_0x382d11=!![];return _0x453876[_0xd7df('0x5a')](_0x3666ba,_0x28151a,config[_0xd7df('0x5b')]['recording'])[_0xd7df('0x28')](function(){return _0x1f34c2;});}return _0x1f34c2;}})[_0xd7df('0x28')](function(_0x35204f){if(_0x35204f){var _0x25d187=path[_0xd7df('0x57')](config[_0xd7df('0x5c')],_0xd7df('0x5d'),_0x35204f[_0xd7df('0x51')]);if(!fs[_0xd7df('0x59')](_0x25d187)){throw new db[(_0xd7df('0x5e'))][(_0xd7df('0x5f'))](_0xd7df('0x60'));}if(_0x35204f[_0xd7df('0x61')]){return _0xf72803[_0xd7df('0x54')](_0x25d187,_0x35204f[_0xd7df('0x61')]+path[_0xd7df('0x62')](_0x25d187),function(){if(_0x382d11){fs[_0xd7df('0x63')](_0x25d187);}});}else{return _0xf72803[_0xd7df('0x54')](_0x25d187,function(_0x3f2775){if(_0x382d11){fs[_0xd7df('0x63')](_0x25d187);}});}}})[_0xd7df('0x4b')](function(_0x393a3a){if(_0x393a3a[_0xd7df('0x64')]===_0xd7df('0x60')){_0xf72803[_0xd7df('0x1d')](0x194)[_0xd7df('0x2b')]('Not\x20found');}else{return handleError(_0xf72803,null);}});};exports['destroy']=function(_0x327402,_0x28f550){return db[_0xd7df('0x2d')]['find']({'where':{'id':_0x327402[_0xd7df('0x48')]['id']}})[_0xd7df('0x28')](function(_0x1e87aa){if(_[_0xd7df('0x65')](_0x1e87aa)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1e87aa;})[_0xd7df('0x28')](function(_0x20ad50){var _0xb06a56=path[_0xd7df('0x57')](config[_0xd7df('0x5c')],_0xd7df('0x5d'),_0x20ad50[_0xd7df('0x51')]);logger[_0xd7df('0x66')]('cancellazione\x20fisica\x20documento\x20%s',_0xb06a56);if(!_[_0xd7df('0x65')](_0x20ad50[_0xd7df('0x51')])&&fs['existsSync'](_0xb06a56)){logger['info']('File:\x20\x22'+_0xb06a56+_0xd7df('0x67'));fs[_0xd7df('0x68')](_0xb06a56);}_0xb06a56=_0xb06a56+_0xd7df('0x69');if(!_[_0xd7df('0x65')](_0x20ad50['value'])&&fs[_0xd7df('0x59')](_0xb06a56)){logger[_0xd7df('0x66')](_0xd7df('0x6a')+_0xb06a56+_0xd7df('0x67'));fs[_0xd7df('0x68')](_0xb06a56);}return _0x20ad50;})[_0xd7df('0x28')](function(_0x4124b8){if(!_0x4124b8)throw new InternalError();return _0x4124b8['destroy']();})['then'](function(){_0x28f550[_0xd7df('0x1d')](0xcc)['end']();})[_0xd7df('0x4b')](handleError(_0x28f550,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index ca99b6d..3a35a87 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 _0x6464=['exports','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1b4df7,_0x259f9a){var _0x478963=function(_0x57afd8){while(--_0x57afd8){_0x1b4df7['push'](_0x1b4df7['shift']());}};_0x478963(++_0x259f9a);}(_0x6464,0x82));var _0x4646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6464[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4646('0x0'));var util=require(_0x4646('0x1'));var logger=require(_0x4646('0x2'))(_0x4646('0x3'));var moment=require(_0x4646('0x4'));var BPromise=require(_0x4646('0x5'));var rp=require(_0x4646('0x6'));var fs=require('fs');var path=require(_0x4646('0x7'));var rimraf=require(_0x4646('0x8'));var config=require(_0x4646('0x9'));var attributes=require('./screenRecording.attributes');module[_0x4646('0xa')]=function(_0x4b0fbb,_0x1e7f85){return _0x4b0fbb['define'](_0x4646('0xb'),attributes,{'tableName':_0x4646('0xc'),'paranoid':![],'indexes':[{'name':_0x4646('0xd'),'fields':[_0x4646('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6fc3=['screen_recordings','interactionid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x257495,_0x18269b){var _0x3849aa=function(_0x1ca94e){while(--_0x1ca94e){_0x257495['push'](_0x257495['shift']());}};_0x3849aa(++_0x18269b);}(_0x6fc3,0xaa));var _0x36fc=function(_0x3fa3a6,_0x172624){_0x3fa3a6=_0x3fa3a6-0x0;var _0x1b3500=_0x6fc3[_0x3fa3a6];return _0x1b3500;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x36fc('0x0'))(_0x36fc('0x1'));var moment=require(_0x36fc('0x2'));var BPromise=require(_0x36fc('0x3'));var rp=require(_0x36fc('0x4'));var fs=require('fs');var path=require(_0x36fc('0x5'));var rimraf=require(_0x36fc('0x6'));var config=require(_0x36fc('0x7'));var attributes=require(_0x36fc('0x8'));module[_0x36fc('0x9')]=function(_0x1e5f4f,_0x4547f7){return _0x1e5f4f[_0x36fc('0xa')](_0x36fc('0xb'),attributes,{'tableName':_0x36fc('0xc'),'paranoid':![],'indexes':[{'name':_0x36fc('0xd'),'fields':[_0x36fc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 580ea73..dd82a89 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 _0xf99f=['moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','request\x20sent','debug','stringify','error','code','message','ScreenRecording,\x20%s,\x20%s','catch','lodash','util'];(function(_0x4e00f3,_0x4e7ccc){var _0x2e3471=function(_0x485126){while(--_0x485126){_0x4e00f3['push'](_0x4e00f3['shift']());}};_0x2e3471(++_0x4e7ccc);}(_0xf99f,0x178));var _0xff99=function(_0xb4cc12,_0x41436e){_0xb4cc12=_0xb4cc12-0x0;var _0x8593b5=_0xf99f[_0xb4cc12];return _0x8593b5;};'use strict';var _=require(_0xff99('0x0'));var util=require(_0xff99('0x1'));var moment=require(_0xff99('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff99('0x3'))['db'];var utils=require(_0xff99('0x4'));var logger=require(_0xff99('0x5'))(_0xff99('0x6'));var config=require('../../config/environment');var jayson=require(_0xff99('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x385620,_0x616ad2,_0x5d4d7f){return new BPromise(function(_0x4a8a69,_0x3c55db){return client[_0xff99('0x8')](_0x385620,_0x5d4d7f)['then'](function(_0x25f6e2){logger[_0xff99('0x9')]('ScreenRecording,\x20%s,\x20%s',_0x616ad2,_0xff99('0xa'));logger[_0xff99('0xb')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x616ad2,'request\x20sent',JSON[_0xff99('0xc')](_0x25f6e2));if(_0x25f6e2['error']){if(_0x25f6e2[_0xff99('0xd')][_0xff99('0xe')]===0x1f4){logger[_0xff99('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x616ad2,_0x25f6e2['error'][_0xff99('0xf')]);return _0x3c55db(_0x25f6e2[_0xff99('0xd')][_0xff99('0xf')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x616ad2,_0x25f6e2[_0xff99('0xd')][_0xff99('0xf')]);return _0x4a8a69(_0x25f6e2[_0xff99('0xd')][_0xff99('0xf')]);}else{logger[_0xff99('0x9')](_0xff99('0x10'),_0x616ad2,_0xff99('0xa'));_0x4a8a69(_0x25f6e2['result'][_0xff99('0xf')]);}})[_0xff99('0x11')](function(_0x8d7e73){logger[_0xff99('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x616ad2,_0x8d7e73);_0x3c55db(_0x8d7e73);});});} \ No newline at end of file +var _0xbf92=['ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x4a86d0,_0x3fa6ab){var _0x26dd24=function(_0x375512){while(--_0x375512){_0x4a86d0['push'](_0x4a86d0['shift']());}};_0x26dd24(++_0x3fa6ab);}(_0xbf92,0x9e));var _0x2bf9=function(_0x50e747,_0x3e9e9d){_0x50e747=_0x50e747-0x0;var _0x1957d5=_0xbf92[_0x50e747];return _0x1957d5;};'use strict';var _=require(_0x2bf9('0x0'));var util=require(_0x2bf9('0x1'));var moment=require(_0x2bf9('0x2'));var BPromise=require(_0x2bf9('0x3'));var rs=require(_0x2bf9('0x4'));var fs=require('fs');var Redis=require(_0x2bf9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2bf9('0x6'));var logger=require(_0x2bf9('0x7'))(_0x2bf9('0x8'));var config=require(_0x2bf9('0x9'));var jayson=require(_0x2bf9('0xa'));var client=jayson[_0x2bf9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ed521,_0x4a118f,_0x2b8bef){return new BPromise(function(_0x33508a,_0x459fc7){return client[_0x2bf9('0xc')](_0x2ed521,_0x2b8bef)['then'](function(_0xbe3eea){logger[_0x2bf9('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x4a118f,'request\x20sent');logger['debug'](_0x2bf9('0xe'),_0x4a118f,_0x2bf9('0xf'),JSON['stringify'](_0xbe3eea));if(_0xbe3eea[_0x2bf9('0x10')]){if(_0xbe3eea['error'][_0x2bf9('0x11')]===0x1f4){logger[_0x2bf9('0x10')](_0x2bf9('0x12'),_0x4a118f,_0xbe3eea[_0x2bf9('0x10')][_0x2bf9('0x13')]);return _0x459fc7(_0xbe3eea[_0x2bf9('0x10')][_0x2bf9('0x13')]);}logger['error'](_0x2bf9('0x12'),_0x4a118f,_0xbe3eea['error'][_0x2bf9('0x13')]);return _0x33508a(_0xbe3eea[_0x2bf9('0x10')][_0x2bf9('0x13')]);}else{logger[_0x2bf9('0xd')](_0x2bf9('0x12'),_0x4a118f,_0x2bf9('0xf'));_0x33508a(_0xbe3eea[_0x2bf9('0x14')][_0x2bf9('0x13')]);}})[_0x2bf9('0x15')](function(_0x37db8f){logger['error'](_0x2bf9('0x12'),_0x4a118f,_0x37db8f);_0x459fc7(_0x37db8f);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index e1ad101..2b6dc6c 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 _0xc8de=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','getLogo','/:id/logo_login','/:id/gdpr','gdpr','getPreferred','/:id/favicon','getFavicon','join','root','format','%s%s','logo','extname','post','single','file','addLogo','diskStorage','server/files/images/logos/','logologin','originalname','addPreferred','addFavicon','put','update','exports','multer'];(function(_0x33f345,_0x20394e){var _0x2646df=function(_0x32ba4a){while(--_0x32ba4a){_0x33f345['push'](_0x33f345['shift']());}};_0x2646df(++_0x20394e);}(_0xc8de,0xa7));var _0xec8d=function(_0x86d79b,_0x18264a){_0x86d79b=_0x86d79b-0x0;var _0x351c16=_0xc8de[_0x86d79b];return _0x351c16;};'use strict';var multer=require(_0xec8d('0x0'));var util=require(_0xec8d('0x1'));var path=require(_0xec8d('0x2'));var timeout=require('connect-timeout');var express=require(_0xec8d('0x3'));var router=express[_0xec8d('0x4')]();var fs_extra=require(_0xec8d('0x5'));var auth=require(_0xec8d('0x6'));var interaction=require(_0xec8d('0x7'));var config=require(_0xec8d('0x8'));var controller=require(_0xec8d('0x9'));router[_0xec8d('0xa')]('/',auth[_0xec8d('0xb')](),controller[_0xec8d('0xc')]);router[_0xec8d('0xa')](_0xec8d('0xd'),controller[_0xec8d('0xe')]);router[_0xec8d('0xa')](_0xec8d('0xf'),controller['show']);router['get']('/:id/logo',controller[_0xec8d('0x10')]);router[_0xec8d('0xa')](_0xec8d('0x11'),controller['getLogoLogin']);router[_0xec8d('0xa')](_0xec8d('0x12'),controller[_0xec8d('0x13')]);router[_0xec8d('0xa')]('/:id/preferred',controller[_0xec8d('0x14')]);router[_0xec8d('0xa')](_0xec8d('0x15'),controller[_0xec8d('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2e512c,_0x195707,_0x5079e4){_0x5079e4(null,path[_0xec8d('0x17')](config[_0xec8d('0x18')],'server/files/images/logos/'));},'filename':function(_0x5d04cf,_0x5273f9,_0x532a7d){_0x532a7d(null,util[_0xec8d('0x19')](_0xec8d('0x1a'),_0xec8d('0x1b'),path[_0xec8d('0x1c')](_0x5273f9['originalname'])));}})});router[_0xec8d('0x1d')]('/:id/logo',upload[_0xec8d('0x1e')](_0xec8d('0x1f')),controller[_0xec8d('0x20')]);var upload=multer({'storage':multer[_0xec8d('0x21')]({'destination':function(_0x16c085,_0x2aff2e,_0x457fad){_0x457fad(null,path[_0xec8d('0x17')](config[_0xec8d('0x18')],_0xec8d('0x22')));},'filename':function(_0x2cbe62,_0xfc68b5,_0x350702){_0x350702(null,util['format'](_0xec8d('0x1a'),_0xec8d('0x23'),path[_0xec8d('0x1c')](_0xfc68b5[_0xec8d('0x24')])));}})});router[_0xec8d('0x1d')](_0xec8d('0x11'),upload[_0xec8d('0x1e')](_0xec8d('0x1f')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xec8d('0x21')]({'destination':function(_0x4a5dc5,_0x5aa4d2,_0x35bcc6){_0x35bcc6(null,path[_0xec8d('0x17')](config['root'],'server/files/images/logos/'));},'filename':function(_0x4435cf,_0x39dbbf,_0x519348){_0x519348(null,util[_0xec8d('0x19')](_0xec8d('0x1a'),'preferred',path[_0xec8d('0x1c')](_0x39dbbf[_0xec8d('0x24')])));}})});router[_0xec8d('0x1d')]('/:id/preferred',upload[_0xec8d('0x1e')]('file'),controller[_0xec8d('0x25')]);var upload=multer({'storage':multer[_0xec8d('0x21')]({'destination':function(_0x1bb83c,_0x273930,_0x4e4f71){_0x4e4f71(null,path['join'](config['root'],_0xec8d('0x22')));},'filename':function(_0x5729d5,_0x2a5496,_0x15fe62){_0x15fe62(null,util[_0xec8d('0x19')](_0xec8d('0x1a'),'favicon',path['extname'](_0x2a5496[_0xec8d('0x24')])));}})});router[_0xec8d('0x1d')](_0xec8d('0x15'),upload[_0xec8d('0x1e')]('file'),controller[_0xec8d('0x26')]);router[_0xec8d('0x27')](_0xec8d('0xf'),auth['isAuthenticated'](),controller[_0xec8d('0x28')]);module[_0xec8d('0x29')]=router; \ No newline at end of file +var _0x26e8=['single','addLogoLogin','preferred','/:id/preferred','addPreferred','diskStorage','favicon','addFavicon','put','/:id','update','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','getPreferred','/:id/favicon','getFavicon','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','file','join','root'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x26e8,0x114));var _0x826e=function(_0x2ac3cf,_0x465bb6){_0x2ac3cf=_0x2ac3cf-0x0;var _0x27dcca=_0x26e8[_0x2ac3cf];return _0x27dcca;};'use strict';var multer=require('multer');var util=require(_0x826e('0x0'));var path=require('path');var timeout=require(_0x826e('0x1'));var express=require(_0x826e('0x2'));var router=express[_0x826e('0x3')]();var fs_extra=require(_0x826e('0x4'));var auth=require(_0x826e('0x5'));var interaction=require(_0x826e('0x6'));var config=require(_0x826e('0x7'));var controller=require(_0x826e('0x8'));router[_0x826e('0x9')]('/',auth[_0x826e('0xa')](),controller[_0x826e('0xb')]);router['get'](_0x826e('0xc'),controller[_0x826e('0xd')]);router[_0x826e('0x9')]('/:id',controller[_0x826e('0xe')]);router[_0x826e('0x9')](_0x826e('0xf'),controller['getLogo']);router[_0x826e('0x9')](_0x826e('0x10'),controller[_0x826e('0x11')]);router[_0x826e('0x9')](_0x826e('0x12'),controller['gdpr']);router[_0x826e('0x9')]('/:id/preferred',controller[_0x826e('0x13')]);router[_0x826e('0x9')](_0x826e('0x14'),controller[_0x826e('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x46264b,_0x4e2374,_0x10c42a){_0x10c42a(null,path['join'](config['root'],_0x826e('0x16')));},'filename':function(_0x536cdb,_0x162fef,_0x55c6ae){_0x55c6ae(null,util[_0x826e('0x17')](_0x826e('0x18'),_0x826e('0x19'),path[_0x826e('0x1a')](_0x162fef[_0x826e('0x1b')])));}})});router[_0x826e('0x1c')](_0x826e('0xf'),upload['single'](_0x826e('0x1d')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x22d81c,_0x11c678,_0x26cc9a){_0x26cc9a(null,path[_0x826e('0x1e')](config[_0x826e('0x1f')],_0x826e('0x16')));},'filename':function(_0x17b479,_0x248689,_0x10e92e){_0x10e92e(null,util[_0x826e('0x17')](_0x826e('0x18'),'logologin',path['extname'](_0x248689[_0x826e('0x1b')])));}})});router[_0x826e('0x1c')](_0x826e('0x10'),upload[_0x826e('0x20')](_0x826e('0x1d')),controller[_0x826e('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x27d246,_0x34c8f4,_0x421e48){_0x421e48(null,path[_0x826e('0x1e')](config[_0x826e('0x1f')],_0x826e('0x16')));},'filename':function(_0x52e237,_0x12280f,_0x2ae529){_0x2ae529(null,util[_0x826e('0x17')](_0x826e('0x18'),_0x826e('0x22'),path['extname'](_0x12280f[_0x826e('0x1b')])));}})});router['post'](_0x826e('0x23'),upload[_0x826e('0x20')](_0x826e('0x1d')),controller[_0x826e('0x24')]);var upload=multer({'storage':multer[_0x826e('0x25')]({'destination':function(_0x12a2e8,_0xfb8398,_0x1f20ad){_0x1f20ad(null,path[_0x826e('0x1e')](config[_0x826e('0x1f')],_0x826e('0x16')));},'filename':function(_0x3b4494,_0x1e20ce,_0x4d3ed2){_0x4d3ed2(null,util[_0x826e('0x17')](_0x826e('0x18'),_0x826e('0x26'),path['extname'](_0x1e20ce['originalname'])));}})});router[_0x826e('0x1c')](_0x826e('0x14'),upload[_0x826e('0x20')](_0x826e('0x1d')),controller[_0x826e('0x27')]);router[_0x826e('0x28')](_0x826e('0x29'),auth[_0x826e('0xa')](),controller[_0x826e('0x2a')]);module[_0x826e('0x2b')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 6f0206a..507e4c4 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 _0x5a9c=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x5a9c,0x17d));var _0xc5a9=function(_0x287e5c,_0x3a92fc){_0x287e5c=_0x287e5c-0x0;var _0x575b1b=_0x5a9c[_0x287e5c];return _0x575b1b;};'use strict';var Sequelize=require(_0xc5a9('0x0'));module[_0xc5a9('0x1')]={'min_internal':{'type':Sequelize[_0xc5a9('0x2')](0xb),'unique':_0xc5a9('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xc5a9('0x2')](0xb),'unique':_0xc5a9('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xc5a9('0x5')],'defaultValue':_0xc5a9('0x6')},'logo':{'type':Sequelize[_0xc5a9('0x5')]},'defaultLogo':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xc5a9('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xc5a9('0x5')]},'turnusername':{'type':Sequelize[_0xc5a9('0x5')]},'turnpassword':{'type':Sequelize[_0xc5a9('0x5')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xc5a9('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xc5a9('0x5')],'defaultValue':_0xc5a9('0x8')},'enableEmailPreview':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xc5a9('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xc5a9('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xc5a9('0x5')],'defaultValue':_0xc5a9('0x9')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xc5a9('0x5')]},'defaultPreferred':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0xc5a9('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xc5a9('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xc5a9('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xc5a9('0x2')]},'sentimentRegion':{'type':Sequelize[_0xc5a9('0x5')]},'language':{'type':Sequelize[_0xc5a9('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xc5a9('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xc5a9('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xc5a9('0x2')](0x2)[_0xc5a9('0xa')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xc5a9('0x2')](0x2)[_0xc5a9('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xc5a9('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xc5a9('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xc5a9('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xc5a9('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xc5a9('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0xc5a9('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x6f63=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED','exports','INTEGER','min_mailbox','STRING'];(function(_0x5c7a52,_0x3179d4){var _0x6b524d=function(_0x784ff5){while(--_0x784ff5){_0x5c7a52['push'](_0x5c7a52['shift']());}};_0x6b524d(++_0x3179d4);}(_0x6f63,0x16c));var _0x36f6=function(_0xb85b8a,_0x26cdc6){_0xb85b8a=_0xb85b8a-0x0;var _0x815317=_0x6f63[_0xb85b8a];return _0x815317;};'use strict';var Sequelize=require('sequelize');module[_0x36f6('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x36f6('0x1')](0xb),'unique':_0x36f6('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x36f6('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x36f6('0x3')],'defaultValue':_0x36f6('0x4')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x36f6('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x36f6('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x36f6('0x3')]},'turnaddr':{'type':Sequelize[_0x36f6('0x3')]},'turnusername':{'type':Sequelize[_0x36f6('0x3')]},'turnpassword':{'type':Sequelize[_0x36f6('0x3')]},'pageTitle':{'type':Sequelize[_0x36f6('0x3')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x36f6('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x36f6('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x36f6('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x36f6('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x36f6('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x36f6('0x6')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x36f6('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0x36f6('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x36f6('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x36f6('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x36f6('0x1')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x36f6('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x36f6('0x3')]},'bucket':{'type':Sequelize[_0x36f6('0x3')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x36f6('0x1')](0x2)[_0x36f6('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x36f6('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x36f6('0x1')](0x2)[_0x36f6('0x7')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x36f6('0x1')](0x2)[_0x36f6('0x7')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x36f6('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x36f6('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x36f6('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x36f6('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x36f6('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x36f6('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index ada4f36..b929148 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 _0xc772=['default_loginLogo.svg','gdpr','securePassword','getPreferred','default_preferred.png','custom','addFavicon','getFavicon','getLicense','default_favicon.ico','getDate','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','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','jayson/promise','client','http','request','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','stack','name','index','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','Setting','findAll','body','params','addLogo','file','logo','addLogoLogin','filename','find','server/files/images/logos','loginLogo','preferred','favicon','defaultLoginLogo','defaultPreferred','join','root','toLower','default_logo.svg','default','upperFirst','existsSync','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultLogo','defaultFavicon'];(function(_0x1b7ac6,_0x525edb){var _0x28e6bb=function(_0x57f054){while(--_0x57f054){_0x1b7ac6['push'](_0x1b7ac6['shift']());}};_0x28e6bb(++_0x525edb);}(_0xc772,0x108));var _0x2c77=function(_0x4610d3,_0xd13f2e){_0x4610d3=_0x4610d3-0x0;var _0x5d5ff4=_0xc772[_0x4610d3];return _0x5d5ff4;};'use strict';var emlformat=require(_0x2c77('0x0'));var rimraf=require(_0x2c77('0x1'));var zipdir=require(_0x2c77('0x2'));var jsonpatch=require(_0x2c77('0x3'));var rp=require(_0x2c77('0x4'));var moment=require(_0x2c77('0x5'));var BPromise=require(_0x2c77('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2c77('0x7'));var sox=require('sox');var csv=require(_0x2c77('0x8'));var ejs=require(_0x2c77('0x9'));var fs=require('fs');var fs_extra=require(_0x2c77('0xa'));var _=require(_0x2c77('0xb'));var squel=require(_0x2c77('0xc'));var crypto=require(_0x2c77('0xd'));var jsforce=require(_0x2c77('0xe'));var deskjs=require(_0x2c77('0xf'));var toCsv=require(_0x2c77('0x8'));var querystring=require('querystring');var Papa=require(_0x2c77('0x10'));var Redis=require(_0x2c77('0x11'));var authService=require(_0x2c77('0x12'));var qs=require(_0x2c77('0x13'));var as=require(_0x2c77('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2c77('0x15'))(_0x2c77('0x16'));var utils=require(_0x2c77('0x17'));var config=require(_0x2c77('0x18'));var licenseUtil=require(_0x2c77('0x19'));var db=require(_0x2c77('0x1a'))['db'];var jayson=require(_0x2c77('0x1b'));var client=jayson[_0x2c77('0x1c')][_0x2c77('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x245001,_0x2b904c,_0x32ae7a,_0x38b439){return new BPromise(function(_0x3dd0f3,_0x95a63d){var _0x5726dc=_0x38b439||client;return _0x5726dc[_0x2c77('0x1e')](_0x245001,_0x32ae7a)[_0x2c77('0x1f')](function(_0x1b4043){logger[_0x2c77('0x20')]('Setting,\x20%s,\x20%s',_0x2b904c,_0x2c77('0x21'));logger['debug'](_0x2c77('0x22'),_0x2b904c,_0x2c77('0x21'),JSON[_0x2c77('0x23')](_0x1b4043));if(_0x1b4043[_0x2c77('0x24')]){if(_0x1b4043[_0x2c77('0x24')][_0x2c77('0x25')]===0x1f4){logger[_0x2c77('0x24')](_0x2c77('0x26'),_0x2b904c,_0x1b4043['error'][_0x2c77('0x27')]);return _0x95a63d(_0x1b4043[_0x2c77('0x24')]['message']);}logger[_0x2c77('0x24')](_0x2c77('0x26'),_0x2b904c,_0x1b4043[_0x2c77('0x24')][_0x2c77('0x27')]);return _0x3dd0f3(_0x1b4043['error']['message']);}else{logger[_0x2c77('0x20')](_0x2c77('0x26'),_0x2b904c,_0x2c77('0x21'));_0x3dd0f3(_0x1b4043[_0x2c77('0x28')][_0x2c77('0x27')]);}})[_0x2c77('0x29')](function(_0x12ae45){logger[_0x2c77('0x24')](_0x2c77('0x26'),_0x2b904c,_0x12ae45);_0x95a63d(_0x12ae45);});});}function respondWithStatusCode(_0x2ebf8d,_0x3652fb){_0x3652fb=_0x3652fb||0xcc;return function(_0x20eb5a){if(_0x20eb5a){return _0x2ebf8d[_0x2c77('0x2a')](_0x3652fb);}return _0x2ebf8d[_0x2c77('0x2b')](_0x3652fb)[_0x2c77('0x2c')]();};}function respondWithResult(_0xcf5e60,_0x4b1e58){_0x4b1e58=_0x4b1e58||0xc8;return function(_0x1968c4){if(_0x1968c4){return _0xcf5e60['status'](_0x4b1e58)[_0x2c77('0x2d')](_0x1968c4);}};}function respondWithFilteredResult(_0x48f1e3,_0x3b7f3b){return function(_0x33f62c){if(_0x33f62c){var _0xb829dd=typeof _0x3b7f3b[_0x2c77('0x2e')]===_0x2c77('0x2f')&&typeof _0x3b7f3b[_0x2c77('0x30')]===_0x2c77('0x2f');var _0x4c63e1=_0x33f62c[_0x2c77('0x31')];var _0x5c1942=_0xb829dd?0x0:_0x3b7f3b[_0x2c77('0x2e')];var _0x1e4193=_0xb829dd?_0x33f62c[_0x2c77('0x31')]:_0x3b7f3b['offset']+_0x3b7f3b[_0x2c77('0x30')];var _0x28691b;if(_0x1e4193>=_0x4c63e1){_0x1e4193=_0x4c63e1;_0x28691b=0xc8;}else{_0x28691b=0xce;}_0x48f1e3[_0x2c77('0x2b')](_0x28691b);return _0x48f1e3[_0x2c77('0x32')](_0x2c77('0x33'),_0x5c1942+'-'+_0x1e4193+'/'+_0x4c63e1)[_0x2c77('0x2d')](_0x33f62c);}return null;};}function patchUpdates(_0x269ca8){return function(_0x557679){try{jsonpatch[_0x2c77('0x34')](_0x557679,_0x269ca8,!![]);}catch(_0x4aa440){return BPromise[_0x2c77('0x35')](_0x4aa440);}return _0x557679['save']();};}function saveUpdates(_0x56f502,_0x1d5870){return function(_0x190c8e){if(_0x190c8e){return _0x190c8e[_0x2c77('0x36')](_0x56f502)[_0x2c77('0x1f')](function(_0x3b4b90){return _0x3b4b90;});}return null;};}function removeEntity(_0x14428e,_0xc8c3a0){return function(_0x23a010){if(_0x23a010){return _0x23a010['destroy']()[_0x2c77('0x1f')](function(){_0x14428e[_0x2c77('0x2b')](0xcc)[_0x2c77('0x2c')]();});}};}function handleEntityNotFound(_0x42adec,_0x18111d){return function(_0x2601c8){if(!_0x2601c8){_0x42adec['sendStatus'](0x194);}return _0x2601c8;};}function handleError(_0x16cb2a,_0x2387c6){_0x2387c6=_0x2387c6||0x1f4;return function(_0x5f58b8){logger['error'](_0x5f58b8[_0x2c77('0x37')]);if(_0x5f58b8[_0x2c77('0x38')]){delete _0x5f58b8[_0x2c77('0x38')];}_0x16cb2a['status'](_0x2387c6)['send'](_0x5f58b8);};}exports[_0x2c77('0x39')]=function(_0x3f9706,_0x4b221c){var _0x8acb9e={},_0x595501={},_0x23acbb={'count':0x0,'rows':[]};var _0x7ecf2a=_[_0x2c77('0x3a')](db['Setting'][_0x2c77('0x3b')],function(_0x486f7e){return{'name':_0x486f7e['fieldName'],'type':_0x486f7e[_0x2c77('0x3c')][_0x2c77('0x3d')]};});_0x595501[_0x2c77('0x3e')]=_[_0x2c77('0x3a')](_0x7ecf2a,_0x2c77('0x38'));_0x595501[_0x2c77('0x3f')]=_[_0x2c77('0x40')](_0x3f9706[_0x2c77('0x3f')]);_0x595501['filters']=_[_0x2c77('0x41')](_0x595501[_0x2c77('0x3e')],_0x595501[_0x2c77('0x3f')]);_0x8acb9e['attributes']=_[_0x2c77('0x41')](_0x595501[_0x2c77('0x3e')],qs[_0x2c77('0x42')](_0x3f9706[_0x2c77('0x3f')]['fields']));_0x8acb9e[_0x2c77('0x43')]=_0x8acb9e[_0x2c77('0x43')][_0x2c77('0x44')]?_0x8acb9e[_0x2c77('0x43')]:_0x595501[_0x2c77('0x3e')];if(!_0x3f9706[_0x2c77('0x3f')][_0x2c77('0x45')](_0x2c77('0x46'))){_0x8acb9e['limit']=qs[_0x2c77('0x30')](_0x3f9706[_0x2c77('0x3f')]['limit']);_0x8acb9e[_0x2c77('0x2e')]=qs[_0x2c77('0x2e')](_0x3f9706['query'][_0x2c77('0x2e')]);}_0x8acb9e[_0x2c77('0x47')]=qs[_0x2c77('0x48')](_0x3f9706[_0x2c77('0x3f')]['sort']);_0x8acb9e[_0x2c77('0x49')]=qs['filters'](_['pick'](_0x3f9706[_0x2c77('0x3f')],_0x595501[_0x2c77('0x4a')]),_0x7ecf2a);if(_0x3f9706[_0x2c77('0x3f')][_0x2c77('0x4b')]){_0x8acb9e[_0x2c77('0x49')]=_[_0x2c77('0x4c')](_0x8acb9e[_0x2c77('0x49')],{'$or':_[_0x2c77('0x3a')](_0x7ecf2a,function(_0x30d455){if(_0x30d455['type']!==_0x2c77('0x4d')){var _0x39dbd4={};_0x39dbd4[_0x30d455[_0x2c77('0x38')]]={'$like':'%'+_0x3f9706[_0x2c77('0x3f')][_0x2c77('0x4b')]+'%'};return _0x39dbd4;}})});}_0x8acb9e=_[_0x2c77('0x4c')]({},_0x8acb9e,_0x3f9706[_0x2c77('0x4e')]);var _0x22fe9c={'where':_0x8acb9e['where']};return db['Setting'][_0x2c77('0x31')](_0x22fe9c)[_0x2c77('0x1f')](function(_0x198ad0){_0x23acbb['count']=_0x198ad0;if(_0x3f9706[_0x2c77('0x3f')][_0x2c77('0x4f')]){_0x8acb9e[_0x2c77('0x50')]=[{'all':!![]}];}return db[_0x2c77('0x51')][_0x2c77('0x52')](_0x8acb9e);})[_0x2c77('0x1f')](function(_0x2686e5){_0x23acbb['rows']=_0x2686e5;return _0x23acbb;})[_0x2c77('0x1f')](respondWithFilteredResult(_0x4b221c,_0x8acb9e))[_0x2c77('0x29')](handleError(_0x4b221c,null));};exports['show']=function(_0x29a8af,_0x51b7e4){var _0x2bf4f2={'raw':![],'where':{'id':_0x29a8af['params']['id']}},_0x242ed8={};_0x242ed8[_0x2c77('0x3e')]=_[_0x2c77('0x40')](db[_0x2c77('0x51')]['rawAttributes']);_0x242ed8[_0x2c77('0x3f')]=_[_0x2c77('0x40')](_0x29a8af[_0x2c77('0x3f')]);_0x242ed8['filters']=_['intersection'](_0x242ed8[_0x2c77('0x3e')],_0x242ed8[_0x2c77('0x3f')]);_0x2bf4f2['attributes']=_['intersection'](_0x242ed8['model'],qs['fields'](_0x29a8af[_0x2c77('0x3f')][_0x2c77('0x42')]));_0x2bf4f2['attributes']=_0x2bf4f2[_0x2c77('0x43')][_0x2c77('0x44')]?_0x2bf4f2[_0x2c77('0x43')]:_0x242ed8[_0x2c77('0x3e')];if(_0x29a8af[_0x2c77('0x3f')][_0x2c77('0x4f')]){_0x2bf4f2['include']=[{'all':!![]}];}_0x2bf4f2=_[_0x2c77('0x4c')]({},_0x2bf4f2,_0x29a8af['options']);return db[_0x2c77('0x51')]['find'](_0x2bf4f2)['then'](handleEntityNotFound(_0x51b7e4,null))['then'](respondWithResult(_0x51b7e4,null))['catch'](handleError(_0x51b7e4,null));};exports[_0x2c77('0x36')]=function(_0x3ac251,_0x1f6b4){if(_0x3ac251[_0x2c77('0x53')]['id']){delete _0x3ac251[_0x2c77('0x53')]['id'];}return db['Setting']['find']({'where':{'id':_0x3ac251[_0x2c77('0x54')]['id']}})[_0x2c77('0x1f')](handleEntityNotFound(_0x1f6b4,null))[_0x2c77('0x1f')](saveUpdates(_0x3ac251['body'],null))['then'](respondWithResult(_0x1f6b4,null))[_0x2c77('0x29')](handleError(_0x1f6b4,null));};exports[_0x2c77('0x55')]=function(_0x5baed8,_0x1cb9d9,_0x4ea454){if(_0x5baed8[_0x2c77('0x56')]&&_0x5baed8[_0x2c77('0x56')]['filename']){_0x5baed8[_0x2c77('0x53')][_0x2c77('0x57')]=_0x5baed8[_0x2c77('0x56')]['filename'];}return db[_0x2c77('0x51')]['find']({'where':{'id':_0x5baed8[_0x2c77('0x54')]['id']}})[_0x2c77('0x1f')](handleEntityNotFound(_0x1cb9d9,null))[_0x2c77('0x1f')](saveUpdates(_0x5baed8[_0x2c77('0x53')],null))['then'](respondWithResult(_0x1cb9d9,null))[_0x2c77('0x29')](handleError(_0x1cb9d9,null));};exports[_0x2c77('0x58')]=function(_0x528bb2,_0x34e969,_0x58b704){if(_0x528bb2[_0x2c77('0x56')]&&_0x528bb2['file']['filename']){_0x528bb2[_0x2c77('0x53')]['loginLogo']=_0x528bb2[_0x2c77('0x56')][_0x2c77('0x59')];}return db[_0x2c77('0x51')][_0x2c77('0x5a')]({'where':{'id':_0x528bb2[_0x2c77('0x54')]['id']}})[_0x2c77('0x1f')](handleEntityNotFound(_0x34e969,null))[_0x2c77('0x1f')](saveUpdates(_0x528bb2[_0x2c77('0x53')],null))['then'](respondWithResult(_0x34e969,null))[_0x2c77('0x29')](handleError(_0x34e969,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x4c9f30,_0x5f40a0,_0x5287bf){var _0x4fb0bc=_0x2c77('0x5b');var _0x281967={'custom':![]};return utilLicense['getLicense']()[_0x2c77('0x1f')](function(_0xbb0c5c){if(_0xbb0c5c){_0x281967=_0xbb0c5c;}return db[_0x2c77('0x51')][_0x2c77('0x5a')]({'where':{'id':_0x4c9f30[_0x2c77('0x54')]['id']},'attributes':[_0x2c77('0x57'),_0x2c77('0x5c'),_0x2c77('0x5d'),_0x2c77('0x5e'),'defaultLogo',_0x2c77('0x5f'),_0x2c77('0x60'),'defaultFavicon'],'raw':!![]});})[_0x2c77('0x1f')](handleEntityNotFound(_0x5f40a0,null))[_0x2c77('0x1f')](function(_0x4184e6){if(_0x4184e6){var _0x5943b3=_0x4184e6[_0x2c77('0x57')]&&fs['existsSync'](path[_0x2c77('0x61')](config[_0x2c77('0x62')],_0x4fb0bc,_[_0x2c77('0x63')](_0x4184e6['logo'])))?path[_0x2c77('0x61')](config[_0x2c77('0x62')],_0x4fb0bc,_[_0x2c77('0x63')](_0x4184e6[_0x2c77('0x57')])):path[_0x2c77('0x61')](config[_0x2c77('0x62')],_0x4fb0bc,_[_0x2c77('0x63')](_0x2c77('0x64')));var _0x28f323=_0x2c77('0x65')+_[_0x2c77('0x66')](_0x2c77('0x57'));if(_0x4184e6[_0x28f323]||!_0x281967['custom']){_0x5943b3=path[_0x2c77('0x61')](config[_0x2c77('0x62')],_0x4fb0bc,_[_0x2c77('0x63')]('default_logo.svg'));}if(!fs[_0x2c77('0x67')](_0x5943b3)){throw new db[(_0x2c77('0x68'))][(_0x2c77('0x69'))](_[_0x2c77('0x66')]('logo')+_0x2c77('0x6a'));}return _0x5f40a0[_0x2c77('0x6b')](_0x5943b3);}})['catch'](handleError(_0x5f40a0,null));};var utilLicense=require(_0x2c77('0x19'));exports[_0x2c77('0x6c')]=function(_0x173c53,_0x552c6a,_0x5deacf){var _0x525ef3=_0x2c77('0x5b');var _0x229e54={'custom':![]};return utilLicense['getLicense']()[_0x2c77('0x1f')](function(_0x516e04){if(_0x516e04){_0x229e54=_0x516e04;}return db[_0x2c77('0x51')]['find']({'where':{'id':_0x173c53[_0x2c77('0x54')]['id']},'attributes':['logo',_0x2c77('0x5c'),'preferred',_0x2c77('0x5e'),_0x2c77('0x6d'),_0x2c77('0x5f'),_0x2c77('0x60'),_0x2c77('0x6e')],'raw':!![]});})[_0x2c77('0x1f')](handleEntityNotFound(_0x552c6a,null))[_0x2c77('0x1f')](function(_0x4cda24){if(_0x4cda24){var _0x53352e=_0x4cda24[_0x2c77('0x5c')]&&fs[_0x2c77('0x67')](path[_0x2c77('0x61')](config['root'],_0x525ef3,_[_0x2c77('0x63')](_0x4cda24[_0x2c77('0x5c')])))?path[_0x2c77('0x61')](config[_0x2c77('0x62')],_0x525ef3,_[_0x2c77('0x63')](_0x4cda24[_0x2c77('0x5c')])):path[_0x2c77('0x61')](config[_0x2c77('0x62')],_0x525ef3,_[_0x2c77('0x63')](_0x2c77('0x6f')));var _0x40807f=_0x2c77('0x65')+_[_0x2c77('0x66')](_0x2c77('0x5c'));if(_0x4cda24[_0x40807f]||!_0x229e54['custom']){_0x53352e=path[_0x2c77('0x61')](config[_0x2c77('0x62')],_0x525ef3,_[_0x2c77('0x63')]('default_loginLogo.svg'));}if(!fs[_0x2c77('0x67')](_0x53352e)){throw new db[(_0x2c77('0x68'))][(_0x2c77('0x69'))](_[_0x2c77('0x66')](_0x2c77('0x5c'))+_0x2c77('0x6a'));}return _0x552c6a[_0x2c77('0x6b')](_0x53352e);}})[_0x2c77('0x29')](handleError(_0x552c6a,null));};exports[_0x2c77('0x70')]=function(_0x19d58a,_0x1b08b2){return db[_0x2c77('0x51')][_0x2c77('0x5a')]({'where':{'id':_0x19d58a['params']['id']},'attributes':[_0x2c77('0x71')]})['then'](respondWithResult(_0x1b08b2,null))[_0x2c77('0x29')](handleError(_0x1b08b2,null));};exports['addPreferred']=function(_0x4cc678,_0x294371,_0x553c5b){if(_0x4cc678[_0x2c77('0x56')]&&_0x4cc678[_0x2c77('0x56')]['filename']){_0x4cc678['body'][_0x2c77('0x5d')]=_0x4cc678[_0x2c77('0x56')]['filename'];}return db['Setting'][_0x2c77('0x5a')]({'where':{'id':_0x4cc678[_0x2c77('0x54')]['id']}})[_0x2c77('0x1f')](handleEntityNotFound(_0x294371,null))['then'](saveUpdates(_0x4cc678['body'],null))[_0x2c77('0x1f')](respondWithResult(_0x294371,null))[_0x2c77('0x29')](handleError(_0x294371,null));};var utilLicense=require(_0x2c77('0x19'));exports[_0x2c77('0x72')]=function(_0x5d4875,_0xaea97,_0x534d6e){var _0x599533=_0x2c77('0x5b');var _0x52b269={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x5c3b25){if(_0x5c3b25){_0x52b269=_0x5c3b25;}return db[_0x2c77('0x51')]['find']({'where':{'id':_0x5d4875[_0x2c77('0x54')]['id']},'attributes':[_0x2c77('0x57'),_0x2c77('0x5c'),_0x2c77('0x5d'),_0x2c77('0x5e'),_0x2c77('0x6d'),_0x2c77('0x5f'),_0x2c77('0x60'),_0x2c77('0x6e')],'raw':!![]});})[_0x2c77('0x1f')](handleEntityNotFound(_0xaea97,null))[_0x2c77('0x1f')](function(_0x41a826){if(_0x41a826){var _0x36e4eb=_0x41a826['preferred']&&fs[_0x2c77('0x67')](path['join'](config['root'],_0x599533,_[_0x2c77('0x63')](_0x41a826['preferred'])))?path['join'](config[_0x2c77('0x62')],_0x599533,_[_0x2c77('0x63')](_0x41a826['preferred'])):path[_0x2c77('0x61')](config['root'],_0x599533,_[_0x2c77('0x63')](_0x2c77('0x73')));var _0x18f376=_0x2c77('0x65')+_['upperFirst']('preferred');if(_0x41a826[_0x18f376]||!_0x52b269[_0x2c77('0x74')]||!_0x52b269['preferred']){_0x36e4eb=path[_0x2c77('0x61')](config[_0x2c77('0x62')],_0x599533,_[_0x2c77('0x63')](_0x2c77('0x73')));}if(!fs[_0x2c77('0x67')](_0x36e4eb)){throw new db['Sequelize'][(_0x2c77('0x69'))](_[_0x2c77('0x66')](_0x2c77('0x5d'))+_0x2c77('0x6a'));}return _0xaea97[_0x2c77('0x6b')](_0x36e4eb);}})[_0x2c77('0x29')](handleError(_0xaea97,null));};exports[_0x2c77('0x75')]=function(_0x3b11ff,_0x48de9f,_0x54ec1b){if(_0x3b11ff['file']&&_0x3b11ff[_0x2c77('0x56')][_0x2c77('0x59')]){_0x3b11ff[_0x2c77('0x53')][_0x2c77('0x5e')]=_0x3b11ff['file'][_0x2c77('0x59')];}return db['Setting'][_0x2c77('0x5a')]({'where':{'id':_0x3b11ff[_0x2c77('0x54')]['id']}})[_0x2c77('0x1f')](handleEntityNotFound(_0x48de9f,null))[_0x2c77('0x1f')](saveUpdates(_0x3b11ff[_0x2c77('0x53')],null))[_0x2c77('0x1f')](respondWithResult(_0x48de9f,null))[_0x2c77('0x29')](handleError(_0x48de9f,null));};var utilLicense=require('../../config/license/util');exports[_0x2c77('0x76')]=function(_0x49f826,_0x78d9d2,_0x39f233){var _0x2350c5='server/files/images/logos';var _0x1ac083={'custom':![]};return utilLicense[_0x2c77('0x77')]()['then'](function(_0x3bacfa){if(_0x3bacfa){_0x1ac083=_0x3bacfa;}return db[_0x2c77('0x51')][_0x2c77('0x5a')]({'where':{'id':_0x49f826['params']['id']},'attributes':[_0x2c77('0x57'),_0x2c77('0x5c'),_0x2c77('0x5d'),_0x2c77('0x5e'),_0x2c77('0x6d'),_0x2c77('0x5f'),_0x2c77('0x60'),_0x2c77('0x6e')],'raw':!![]});})[_0x2c77('0x1f')](handleEntityNotFound(_0x78d9d2,null))['then'](function(_0x5a18a5){if(_0x5a18a5){var _0x5eb86d=_0x5a18a5[_0x2c77('0x5e')]&&fs[_0x2c77('0x67')](path[_0x2c77('0x61')](config[_0x2c77('0x62')],_0x2350c5,_['toLower'](_0x5a18a5[_0x2c77('0x5e')])))?path[_0x2c77('0x61')](config[_0x2c77('0x62')],_0x2350c5,_[_0x2c77('0x63')](_0x5a18a5[_0x2c77('0x5e')])):path[_0x2c77('0x61')](config['root'],_0x2350c5,_[_0x2c77('0x63')](_0x2c77('0x78')));var _0xd481d0=_0x2c77('0x65')+_['upperFirst']('favicon');if(_0x5a18a5[_0xd481d0]||!_0x1ac083[_0x2c77('0x74')]){_0x5eb86d=path[_0x2c77('0x61')](config[_0x2c77('0x62')],_0x2350c5,_[_0x2c77('0x63')]('default_favicon.ico'));}if(!fs[_0x2c77('0x67')](_0x5eb86d)){throw new db[(_0x2c77('0x68'))][(_0x2c77('0x69'))](_[_0x2c77('0x66')](_0x2c77('0x5e'))+_0x2c77('0x6a'));}return _0x78d9d2[_0x2c77('0x6b')](_0x5eb86d);}})[_0x2c77('0x29')](handleError(_0x78d9d2,null));};exports[_0x2c77('0x79')]=function(_0x1ed1d8,_0x16bc4f){var _0x190d89={'offset':moment()[_0x2c77('0x7a')]()};_0x190d89['now']=moment()[_0x2c77('0x7a')](_0x190d89[_0x2c77('0x2e')])['format'](_0x2c77('0x7b'));return _0x16bc4f['status'](0xc8)[_0x2c77('0x7c')](_0x190d89);}; \ No newline at end of file +var _0xa234=['Content-Range','apply','save','update','then','destroy','end','stack','name','send','index','map','Setting','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','find','addLogo','file','filename','body','logo','addLogoLogin','loginLogo','server/files/images/logos','favicon','defaultLoginLogo','defaultPreferred','join','root','toLower','default_logo.svg','default','upperFirst','custom','existsSync','ValidationError','\x20not\x20found','download','getLogoLogin','getLicense','preferred','defaultLogo','default_loginLogo.svg','Sequelize','securePassword','getPreferred','defaultFavicon','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa234,0x142));var _0x4a23=function(_0x5f31f7,_0x2cc8d8){_0x5f31f7=_0x5f31f7-0x0;var _0x40377d=_0xa234[_0x5f31f7];return _0x40377d;};'use strict';var emlformat=require(_0x4a23('0x0'));var rimraf=require(_0x4a23('0x1'));var zipdir=require(_0x4a23('0x2'));var jsonpatch=require(_0x4a23('0x3'));var rp=require(_0x4a23('0x4'));var moment=require('moment');var BPromise=require(_0x4a23('0x5'));var Mustache=require('mustache');var util=require(_0x4a23('0x6'));var path=require('path');var sox=require(_0x4a23('0x7'));var csv=require(_0x4a23('0x8'));var ejs=require(_0x4a23('0x9'));var fs=require('fs');var fs_extra=require(_0x4a23('0xa'));var _=require(_0x4a23('0xb'));var squel=require(_0x4a23('0xc'));var crypto=require('crypto');var jsforce=require(_0x4a23('0xd'));var deskjs=require(_0x4a23('0xe'));var toCsv=require(_0x4a23('0x8'));var querystring=require(_0x4a23('0xf'));var Papa=require(_0x4a23('0x10'));var Redis=require(_0x4a23('0x11'));var authService=require(_0x4a23('0x12'));var qs=require(_0x4a23('0x13'));var as=require(_0x4a23('0x14'));var hardwareService=require(_0x4a23('0x15'));var logger=require(_0x4a23('0x16'))('api');var utils=require(_0x4a23('0x17'));var config=require(_0x4a23('0x18'));var licenseUtil=require(_0x4a23('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4a23('0x1a'));var client=jayson[_0x4a23('0x1b')][_0x4a23('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xeab648,_0x5a4922,_0x1e36b2,_0x207026){return new BPromise(function(_0x838369,_0x2b16ad){var _0x562e1a=_0x207026||client;return _0x562e1a['request'](_0xeab648,_0x1e36b2)['then'](function(_0x4abba6){logger['info'](_0x4a23('0x1d'),_0x5a4922,_0x4a23('0x1e'));logger[_0x4a23('0x1f')](_0x4a23('0x20'),_0x5a4922,'request\x20sent',JSON[_0x4a23('0x21')](_0x4abba6));if(_0x4abba6['error']){if(_0x4abba6[_0x4a23('0x22')][_0x4a23('0x23')]===0x1f4){logger[_0x4a23('0x22')](_0x4a23('0x1d'),_0x5a4922,_0x4abba6[_0x4a23('0x22')][_0x4a23('0x24')]);return _0x2b16ad(_0x4abba6['error'][_0x4a23('0x24')]);}logger['error'](_0x4a23('0x1d'),_0x5a4922,_0x4abba6[_0x4a23('0x22')][_0x4a23('0x24')]);return _0x838369(_0x4abba6[_0x4a23('0x22')][_0x4a23('0x24')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x5a4922,_0x4a23('0x1e'));_0x838369(_0x4abba6[_0x4a23('0x25')][_0x4a23('0x24')]);}})[_0x4a23('0x26')](function(_0x4d7885){logger[_0x4a23('0x22')](_0x4a23('0x1d'),_0x5a4922,_0x4d7885);_0x2b16ad(_0x4d7885);});});}function respondWithStatusCode(_0x16ce94,_0x194e88){_0x194e88=_0x194e88||0xcc;return function(_0x11b8b8){if(_0x11b8b8){return _0x16ce94[_0x4a23('0x27')](_0x194e88);}return _0x16ce94[_0x4a23('0x28')](_0x194e88)['end']();};}function respondWithResult(_0x1be912,_0x5c6c76){_0x5c6c76=_0x5c6c76||0xc8;return function(_0x3bea8c){if(_0x3bea8c){return _0x1be912['status'](_0x5c6c76)[_0x4a23('0x29')](_0x3bea8c);}};}function respondWithFilteredResult(_0x3690fc,_0x3c3184){return function(_0x305546){if(_0x305546){var _0x11d418=typeof _0x3c3184[_0x4a23('0x2a')]===_0x4a23('0x2b')&&typeof _0x3c3184[_0x4a23('0x2c')]==='undefined';var _0x3a94b6=_0x305546[_0x4a23('0x2d')];var _0x430c34=_0x11d418?0x0:_0x3c3184['offset'];var _0x39976d=_0x11d418?_0x305546['count']:_0x3c3184[_0x4a23('0x2a')]+_0x3c3184[_0x4a23('0x2c')];var _0x10058f;if(_0x39976d>=_0x3a94b6){_0x39976d=_0x3a94b6;_0x10058f=0xc8;}else{_0x10058f=0xce;}_0x3690fc[_0x4a23('0x28')](_0x10058f);return _0x3690fc[_0x4a23('0x2e')](_0x4a23('0x2f'),_0x430c34+'-'+_0x39976d+'/'+_0x3a94b6)[_0x4a23('0x29')](_0x305546);}return null;};}function patchUpdates(_0x261cea){return function(_0x1e2494){try{jsonpatch[_0x4a23('0x30')](_0x1e2494,_0x261cea,!![]);}catch(_0x1c500f){return BPromise['reject'](_0x1c500f);}return _0x1e2494[_0x4a23('0x31')]();};}function saveUpdates(_0x4153e3,_0x3133f3){return function(_0xaa6861){if(_0xaa6861){return _0xaa6861[_0x4a23('0x32')](_0x4153e3)[_0x4a23('0x33')](function(_0x1e2fe1){return _0x1e2fe1;});}return null;};}function removeEntity(_0x59e43d,_0xbba98a){return function(_0x2c1c5f){if(_0x2c1c5f){return _0x2c1c5f[_0x4a23('0x34')]()[_0x4a23('0x33')](function(){_0x59e43d[_0x4a23('0x28')](0xcc)[_0x4a23('0x35')]();});}};}function handleEntityNotFound(_0x378a3e,_0x443ee6){return function(_0x4ca06f){if(!_0x4ca06f){_0x378a3e[_0x4a23('0x27')](0x194);}return _0x4ca06f;};}function handleError(_0x368417,_0x1aaca4){_0x1aaca4=_0x1aaca4||0x1f4;return function(_0xb4fa84){logger[_0x4a23('0x22')](_0xb4fa84[_0x4a23('0x36')]);if(_0xb4fa84[_0x4a23('0x37')]){delete _0xb4fa84[_0x4a23('0x37')];}_0x368417[_0x4a23('0x28')](_0x1aaca4)[_0x4a23('0x38')](_0xb4fa84);};}exports[_0x4a23('0x39')]=function(_0x4edd5c,_0x355f8a){var _0x5369a5={},_0x45e13a={},_0x3d2cf9={'count':0x0,'rows':[]};var _0x53d419=_[_0x4a23('0x3a')](db[_0x4a23('0x3b')][_0x4a23('0x3c')],function(_0x1ae2f8){return{'name':_0x1ae2f8['fieldName'],'type':_0x1ae2f8[_0x4a23('0x3d')][_0x4a23('0x3e')]};});_0x45e13a[_0x4a23('0x3f')]=_['map'](_0x53d419,'name');_0x45e13a[_0x4a23('0x40')]=_[_0x4a23('0x41')](_0x4edd5c[_0x4a23('0x40')]);_0x45e13a[_0x4a23('0x42')]=_[_0x4a23('0x43')](_0x45e13a[_0x4a23('0x3f')],_0x45e13a[_0x4a23('0x40')]);_0x5369a5[_0x4a23('0x44')]=_[_0x4a23('0x43')](_0x45e13a['model'],qs[_0x4a23('0x45')](_0x4edd5c[_0x4a23('0x40')][_0x4a23('0x45')]));_0x5369a5['attributes']=_0x5369a5[_0x4a23('0x44')][_0x4a23('0x46')]?_0x5369a5[_0x4a23('0x44')]:_0x45e13a[_0x4a23('0x3f')];if(!_0x4edd5c[_0x4a23('0x40')]['hasOwnProperty']('nolimit')){_0x5369a5[_0x4a23('0x2c')]=qs['limit'](_0x4edd5c['query']['limit']);_0x5369a5['offset']=qs[_0x4a23('0x2a')](_0x4edd5c[_0x4a23('0x40')][_0x4a23('0x2a')]);}_0x5369a5['order']=qs[_0x4a23('0x47')](_0x4edd5c[_0x4a23('0x40')][_0x4a23('0x47')]);_0x5369a5[_0x4a23('0x48')]=qs[_0x4a23('0x42')](_['pick'](_0x4edd5c[_0x4a23('0x40')],_0x45e13a['filters']),_0x53d419);if(_0x4edd5c['query'][_0x4a23('0x49')]){_0x5369a5[_0x4a23('0x48')]=_['merge'](_0x5369a5[_0x4a23('0x48')],{'$or':_['map'](_0x53d419,function(_0x4edbc7){if(_0x4edbc7[_0x4a23('0x3d')]!==_0x4a23('0x4a')){var _0x6585b3={};_0x6585b3[_0x4edbc7[_0x4a23('0x37')]]={'$like':'%'+_0x4edd5c[_0x4a23('0x40')][_0x4a23('0x49')]+'%'};return _0x6585b3;}})});}_0x5369a5=_[_0x4a23('0x4b')]({},_0x5369a5,_0x4edd5c[_0x4a23('0x4c')]);var _0x41f3ac={'where':_0x5369a5[_0x4a23('0x48')]};return db[_0x4a23('0x3b')][_0x4a23('0x2d')](_0x41f3ac)[_0x4a23('0x33')](function(_0x348305){_0x3d2cf9[_0x4a23('0x2d')]=_0x348305;if(_0x4edd5c['query'][_0x4a23('0x4d')]){_0x5369a5[_0x4a23('0x4e')]=[{'all':!![]}];}return db['Setting'][_0x4a23('0x4f')](_0x5369a5);})['then'](function(_0x47e5c4){_0x3d2cf9[_0x4a23('0x50')]=_0x47e5c4;return _0x3d2cf9;})['then'](respondWithFilteredResult(_0x355f8a,_0x5369a5))[_0x4a23('0x26')](handleError(_0x355f8a,null));};exports['show']=function(_0x241fab,_0x9a1181){var _0x147fbd={'raw':![],'where':{'id':_0x241fab[_0x4a23('0x51')]['id']}},_0x5b8b6e={};_0x5b8b6e[_0x4a23('0x3f')]=_[_0x4a23('0x41')](db['Setting']['rawAttributes']);_0x5b8b6e['query']=_[_0x4a23('0x41')](_0x241fab[_0x4a23('0x40')]);_0x5b8b6e[_0x4a23('0x42')]=_[_0x4a23('0x43')](_0x5b8b6e[_0x4a23('0x3f')],_0x5b8b6e['query']);_0x147fbd[_0x4a23('0x44')]=_['intersection'](_0x5b8b6e[_0x4a23('0x3f')],qs[_0x4a23('0x45')](_0x241fab['query'][_0x4a23('0x45')]));_0x147fbd[_0x4a23('0x44')]=_0x147fbd[_0x4a23('0x44')][_0x4a23('0x46')]?_0x147fbd[_0x4a23('0x44')]:_0x5b8b6e['model'];if(_0x241fab[_0x4a23('0x40')]['includeAll']){_0x147fbd['include']=[{'all':!![]}];}_0x147fbd=_[_0x4a23('0x4b')]({},_0x147fbd,_0x241fab[_0x4a23('0x4c')]);return db[_0x4a23('0x3b')][_0x4a23('0x52')](_0x147fbd)[_0x4a23('0x33')](handleEntityNotFound(_0x9a1181,null))[_0x4a23('0x33')](respondWithResult(_0x9a1181,null))['catch'](handleError(_0x9a1181,null));};exports[_0x4a23('0x32')]=function(_0x299328,_0x286f26){if(_0x299328['body']['id']){delete _0x299328['body']['id'];}return db[_0x4a23('0x3b')][_0x4a23('0x52')]({'where':{'id':_0x299328['params']['id']}})[_0x4a23('0x33')](handleEntityNotFound(_0x286f26,null))[_0x4a23('0x33')](saveUpdates(_0x299328['body'],null))['then'](respondWithResult(_0x286f26,null))[_0x4a23('0x26')](handleError(_0x286f26,null));};exports[_0x4a23('0x53')]=function(_0x45f517,_0x26a450,_0x1efcd8){if(_0x45f517[_0x4a23('0x54')]&&_0x45f517[_0x4a23('0x54')][_0x4a23('0x55')]){_0x45f517[_0x4a23('0x56')][_0x4a23('0x57')]=_0x45f517[_0x4a23('0x54')][_0x4a23('0x55')];}return db[_0x4a23('0x3b')][_0x4a23('0x52')]({'where':{'id':_0x45f517[_0x4a23('0x51')]['id']}})[_0x4a23('0x33')](handleEntityNotFound(_0x26a450,null))[_0x4a23('0x33')](saveUpdates(_0x45f517[_0x4a23('0x56')],null))['then'](respondWithResult(_0x26a450,null))['catch'](handleError(_0x26a450,null));};exports[_0x4a23('0x58')]=function(_0x2b598d,_0x1ce621,_0x1edb80){if(_0x2b598d[_0x4a23('0x54')]&&_0x2b598d['file'][_0x4a23('0x55')]){_0x2b598d[_0x4a23('0x56')][_0x4a23('0x59')]=_0x2b598d['file'][_0x4a23('0x55')];}return db[_0x4a23('0x3b')][_0x4a23('0x52')]({'where':{'id':_0x2b598d['params']['id']}})['then'](handleEntityNotFound(_0x1ce621,null))['then'](saveUpdates(_0x2b598d[_0x4a23('0x56')],null))['then'](respondWithResult(_0x1ce621,null))[_0x4a23('0x26')](handleError(_0x1ce621,null));};var utilLicense=require(_0x4a23('0x19'));exports['getLogo']=function(_0x3c7c13,_0x3e4a01,_0x2da36f){var _0x4190f4=_0x4a23('0x5a');var _0x45c081={'custom':![]};return utilLicense['getLicense']()[_0x4a23('0x33')](function(_0x2f2d2f){if(_0x2f2d2f){_0x45c081=_0x2f2d2f;}return db['Setting']['find']({'where':{'id':_0x3c7c13['params']['id']},'attributes':[_0x4a23('0x57'),_0x4a23('0x59'),'preferred',_0x4a23('0x5b'),'defaultLogo',_0x4a23('0x5c'),_0x4a23('0x5d'),'defaultFavicon'],'raw':!![]});})[_0x4a23('0x33')](handleEntityNotFound(_0x3e4a01,null))[_0x4a23('0x33')](function(_0x1b08b8){if(_0x1b08b8){var _0x16b89f=_0x1b08b8['logo']&&fs['existsSync'](path[_0x4a23('0x5e')](config[_0x4a23('0x5f')],_0x4190f4,_[_0x4a23('0x60')](_0x1b08b8[_0x4a23('0x57')])))?path[_0x4a23('0x5e')](config['root'],_0x4190f4,_['toLower'](_0x1b08b8[_0x4a23('0x57')])):path[_0x4a23('0x5e')](config[_0x4a23('0x5f')],_0x4190f4,_[_0x4a23('0x60')](_0x4a23('0x61')));var _0x546f03=_0x4a23('0x62')+_[_0x4a23('0x63')]('logo');if(_0x1b08b8[_0x546f03]||!_0x45c081[_0x4a23('0x64')]){_0x16b89f=path['join'](config[_0x4a23('0x5f')],_0x4190f4,_[_0x4a23('0x60')](_0x4a23('0x61')));}if(!fs[_0x4a23('0x65')](_0x16b89f)){throw new db['Sequelize'][(_0x4a23('0x66'))](_[_0x4a23('0x63')](_0x4a23('0x57'))+_0x4a23('0x67'));}return _0x3e4a01[_0x4a23('0x68')](_0x16b89f);}})[_0x4a23('0x26')](handleError(_0x3e4a01,null));};var utilLicense=require(_0x4a23('0x19'));exports[_0x4a23('0x69')]=function(_0x239097,_0x5d03e1,_0x21f500){var _0x5c9bfc='server/files/images/logos';var _0x3a45d5={'custom':![]};return utilLicense[_0x4a23('0x6a')]()['then'](function(_0x3c3af9){if(_0x3c3af9){_0x3a45d5=_0x3c3af9;}return db[_0x4a23('0x3b')][_0x4a23('0x52')]({'where':{'id':_0x239097[_0x4a23('0x51')]['id']},'attributes':['logo',_0x4a23('0x59'),_0x4a23('0x6b'),'favicon',_0x4a23('0x6c'),_0x4a23('0x5c'),_0x4a23('0x5d'),'defaultFavicon'],'raw':!![]});})[_0x4a23('0x33')](handleEntityNotFound(_0x5d03e1,null))[_0x4a23('0x33')](function(_0x514119){if(_0x514119){var _0x58ae03=_0x514119[_0x4a23('0x59')]&&fs['existsSync'](path[_0x4a23('0x5e')](config['root'],_0x5c9bfc,_[_0x4a23('0x60')](_0x514119[_0x4a23('0x59')])))?path[_0x4a23('0x5e')](config[_0x4a23('0x5f')],_0x5c9bfc,_['toLower'](_0x514119[_0x4a23('0x59')])):path['join'](config[_0x4a23('0x5f')],_0x5c9bfc,_[_0x4a23('0x60')](_0x4a23('0x6d')));var _0x194b8='default'+_[_0x4a23('0x63')](_0x4a23('0x59'));if(_0x514119[_0x194b8]||!_0x3a45d5['custom']){_0x58ae03=path[_0x4a23('0x5e')](config['root'],_0x5c9bfc,_[_0x4a23('0x60')](_0x4a23('0x6d')));}if(!fs['existsSync'](_0x58ae03)){throw new db[(_0x4a23('0x6e'))][(_0x4a23('0x66'))](_[_0x4a23('0x63')](_0x4a23('0x59'))+'\x20not\x20found');}return _0x5d03e1['download'](_0x58ae03);}})[_0x4a23('0x26')](handleError(_0x5d03e1,null));};exports['gdpr']=function(_0x422b66,_0x37ae30){return db[_0x4a23('0x3b')][_0x4a23('0x52')]({'where':{'id':_0x422b66[_0x4a23('0x51')]['id']},'attributes':[_0x4a23('0x6f')]})[_0x4a23('0x33')](respondWithResult(_0x37ae30,null))[_0x4a23('0x26')](handleError(_0x37ae30,null));};exports['addPreferred']=function(_0x4476a8,_0x27b720,_0x2c9de1){if(_0x4476a8['file']&&_0x4476a8[_0x4a23('0x54')][_0x4a23('0x55')]){_0x4476a8[_0x4a23('0x56')]['preferred']=_0x4476a8['file']['filename'];}return db['Setting'][_0x4a23('0x52')]({'where':{'id':_0x4476a8[_0x4a23('0x51')]['id']}})[_0x4a23('0x33')](handleEntityNotFound(_0x27b720,null))[_0x4a23('0x33')](saveUpdates(_0x4476a8[_0x4a23('0x56')],null))[_0x4a23('0x33')](respondWithResult(_0x27b720,null))['catch'](handleError(_0x27b720,null));};var utilLicense=require('../../config/license/util');exports[_0x4a23('0x70')]=function(_0x22bfef,_0x40e1ab,_0xb3a02f){var _0x27ee4='server/files/images/logos';var _0x5c403b={'custom':![]};return utilLicense[_0x4a23('0x6a')]()[_0x4a23('0x33')](function(_0x53892d){if(_0x53892d){_0x5c403b=_0x53892d;}return db[_0x4a23('0x3b')][_0x4a23('0x52')]({'where':{'id':_0x22bfef[_0x4a23('0x51')]['id']},'attributes':['logo',_0x4a23('0x59'),_0x4a23('0x6b'),'favicon',_0x4a23('0x6c'),'defaultLoginLogo',_0x4a23('0x5d'),_0x4a23('0x71')],'raw':!![]});})[_0x4a23('0x33')](handleEntityNotFound(_0x40e1ab,null))[_0x4a23('0x33')](function(_0x54b058){if(_0x54b058){var _0x34ca8e=_0x54b058[_0x4a23('0x6b')]&&fs[_0x4a23('0x65')](path[_0x4a23('0x5e')](config['root'],_0x27ee4,_['toLower'](_0x54b058[_0x4a23('0x6b')])))?path[_0x4a23('0x5e')](config['root'],_0x27ee4,_[_0x4a23('0x60')](_0x54b058[_0x4a23('0x6b')])):path['join'](config[_0x4a23('0x5f')],_0x27ee4,_[_0x4a23('0x60')](_0x4a23('0x72')));var _0x1f73e4=_0x4a23('0x62')+_['upperFirst'](_0x4a23('0x6b'));if(_0x54b058[_0x1f73e4]||!_0x5c403b[_0x4a23('0x64')]||!_0x5c403b['preferred']){_0x34ca8e=path[_0x4a23('0x5e')](config['root'],_0x27ee4,_[_0x4a23('0x60')]('default_preferred.png'));}if(!fs[_0x4a23('0x65')](_0x34ca8e)){throw new db[(_0x4a23('0x6e'))][(_0x4a23('0x66'))](_[_0x4a23('0x63')]('preferred')+_0x4a23('0x67'));}return _0x40e1ab[_0x4a23('0x68')](_0x34ca8e);}})[_0x4a23('0x26')](handleError(_0x40e1ab,null));};exports[_0x4a23('0x73')]=function(_0x431d55,_0x3c15ef,_0x5291a8){if(_0x431d55['file']&&_0x431d55[_0x4a23('0x54')][_0x4a23('0x55')]){_0x431d55[_0x4a23('0x56')][_0x4a23('0x5b')]=_0x431d55[_0x4a23('0x54')][_0x4a23('0x55')];}return db[_0x4a23('0x3b')][_0x4a23('0x52')]({'where':{'id':_0x431d55[_0x4a23('0x51')]['id']}})[_0x4a23('0x33')](handleEntityNotFound(_0x3c15ef,null))[_0x4a23('0x33')](saveUpdates(_0x431d55[_0x4a23('0x56')],null))[_0x4a23('0x33')](respondWithResult(_0x3c15ef,null))[_0x4a23('0x26')](handleError(_0x3c15ef,null));};var utilLicense=require('../../config/license/util');exports[_0x4a23('0x74')]=function(_0x390c5d,_0x51515f,_0x151afa){var _0x3b47e7=_0x4a23('0x5a');var _0x51e4f5={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x36f998){if(_0x36f998){_0x51e4f5=_0x36f998;}return db[_0x4a23('0x3b')][_0x4a23('0x52')]({'where':{'id':_0x390c5d[_0x4a23('0x51')]['id']},'attributes':[_0x4a23('0x57'),_0x4a23('0x59'),_0x4a23('0x6b'),_0x4a23('0x5b'),'defaultLogo',_0x4a23('0x5c'),_0x4a23('0x5d'),_0x4a23('0x71')],'raw':!![]});})[_0x4a23('0x33')](handleEntityNotFound(_0x51515f,null))['then'](function(_0x3ce20d){if(_0x3ce20d){var _0x325984=_0x3ce20d['favicon']&&fs[_0x4a23('0x65')](path[_0x4a23('0x5e')](config[_0x4a23('0x5f')],_0x3b47e7,_['toLower'](_0x3ce20d[_0x4a23('0x5b')])))?path[_0x4a23('0x5e')](config['root'],_0x3b47e7,_[_0x4a23('0x60')](_0x3ce20d[_0x4a23('0x5b')])):path['join'](config['root'],_0x3b47e7,_[_0x4a23('0x60')](_0x4a23('0x75')));var _0xc34568=_0x4a23('0x62')+_['upperFirst'](_0x4a23('0x5b'));if(_0x3ce20d[_0xc34568]||!_0x51e4f5['custom']){_0x325984=path['join'](config[_0x4a23('0x5f')],_0x3b47e7,_['toLower'](_0x4a23('0x75')));}if(!fs['existsSync'](_0x325984)){throw new db[(_0x4a23('0x6e'))]['ValidationError'](_[_0x4a23('0x63')](_0x4a23('0x5b'))+_0x4a23('0x67'));}return _0x51515f['download'](_0x325984);}})['catch'](handleError(_0x51515f,null));};exports[_0x4a23('0x76')]=function(_0x318343,_0x3d5ae4){var _0x4a8f72={'offset':moment()[_0x4a23('0x77')]()};_0x4a8f72[_0x4a23('0x78')]=moment()[_0x4a23('0x77')](_0x4a8f72[_0x4a23('0x2a')])[_0x4a23('0x79')](_0x4a23('0x7a'));return _0x3d5ae4[_0x4a23('0x28')](0xc8)[_0x4a23('0x38')](_0x4a8f72);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 8f72fb1..34ec869 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 _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0x7217,0x19e));var _0x7721=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x7217[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0x55ca,0x126));var _0xa55c=function(_0x4733d3,_0x454290){_0x4733d3=_0x4733d3-0x0;var _0x1b9a44=_0x55ca[_0x4733d3];return _0x1b9a44;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index e9e4a5a..93fd860 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 _0x017e=['../../config/environment','client','http','request','then','debug','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','ShowSetting','find','options','raw','attributes','include','model','map','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x4d692a,_0x5c1506){var _0x9ef565=function(_0x2e17c8){while(--_0x2e17c8){_0x4d692a['push'](_0x4d692a['shift']());}};_0x9ef565(++_0x5c1506);}(_0x017e,0x11b));var _0xe017=function(_0x2e1058,_0x535e8c){_0x2e1058=_0x2e1058-0x0;var _0x3b9d5b=_0x017e[_0x2e1058];return _0x3b9d5b;};'use strict';var _=require(_0xe017('0x0'));var util=require('util');var moment=require(_0xe017('0x1'));var BPromise=require(_0xe017('0x2'));var rs=require(_0xe017('0x3'));var fs=require('fs');var Redis=require(_0xe017('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe017('0x5'))(_0xe017('0x6'));var config=require(_0xe017('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe017('0x8')][_0xe017('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c5677,_0x3a33f9,_0x35f580){return new BPromise(function(_0x4273ff,_0x53dce5){return client[_0xe017('0xa')](_0x1c5677,_0x35f580)[_0xe017('0xb')](function(_0x2b1f87){logger['info']('Setting,\x20%s,\x20%s',_0x3a33f9,'request\x20sent');logger[_0xe017('0xc')]('Setting,\x20%s,\x20%s,\x20%s',_0x3a33f9,_0xe017('0xd'),JSON[_0xe017('0xe')](_0x2b1f87));if(_0x2b1f87[_0xe017('0xf')]){if(_0x2b1f87[_0xe017('0xf')][_0xe017('0x10')]===0x1f4){logger['error'](_0xe017('0x11'),_0x3a33f9,_0x2b1f87[_0xe017('0xf')][_0xe017('0x12')]);return _0x53dce5(_0x2b1f87[_0xe017('0xf')][_0xe017('0x12')]);}logger[_0xe017('0xf')](_0xe017('0x11'),_0x3a33f9,_0x2b1f87[_0xe017('0xf')][_0xe017('0x12')]);return _0x4273ff(_0x2b1f87[_0xe017('0xf')][_0xe017('0x12')]);}else{logger['info'](_0xe017('0x11'),_0x3a33f9,_0xe017('0xd'));_0x4273ff(_0x2b1f87[_0xe017('0x13')][_0xe017('0x12')]);}})[_0xe017('0x14')](function(_0x1e748b){logger[_0xe017('0xf')](_0xe017('0x11'),_0x3a33f9,_0x1e748b);_0x53dce5(_0x1e748b);});});}exports[_0xe017('0x15')]=function(_0xcd8c24){var _0x1a80fb=this;return new Promise(function(_0x20dc2e,_0x4251a9){return db['Setting'][_0xe017('0x16')]({'raw':_0xcd8c24[_0xe017('0x17')]?_0xcd8c24[_0xe017('0x17')][_0xe017('0x18')]===undefined?!![]:![]:!![],'where':_0xcd8c24[_0xe017('0x17')]?_0xcd8c24[_0xe017('0x17')]['where']||null:null,'attributes':_0xcd8c24['options']?_0xcd8c24[_0xe017('0x17')][_0xe017('0x19')]||null:null,'include':_0xcd8c24[_0xe017('0x17')]?_0xcd8c24['options'][_0xe017('0x1a')]?_['map'](_0xcd8c24[_0xe017('0x17')]['include'],function(_0x5b636c){return{'model':db[_0x5b636c[_0xe017('0x1b')]],'as':_0x5b636c['as'],'attributes':_0x5b636c[_0xe017('0x19')],'include':_0x5b636c[_0xe017('0x1a')]?_[_0xe017('0x1c')](_0x5b636c['include'],function(_0x23525c){return{'model':db[_0x23525c[_0xe017('0x1b')]],'as':_0x23525c['as'],'attributes':_0x23525c['attributes'],'include':_0x23525c['include']?_['map'](_0x23525c[_0xe017('0x1a')],function(_0x41fdb4){return{'model':db[_0x41fdb4[_0xe017('0x1b')]],'as':_0x41fdb4['as'],'attributes':_0x41fdb4[_0xe017('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x312b13){logger['info'](_0xe017('0x15'),_0xcd8c24);logger['debug']('ShowSetting',_0xcd8c24,JSON[_0xe017('0xe')](_0x312b13));_0x20dc2e(_0x312b13);})[_0xe017('0x14')](function(_0x3da400){logger[_0xe017('0xf')]('ShowSetting',_0x3da400['message'],_0xcd8c24);_0x4251a9(_0x1a80fb['error'](0x1f4,_0x3da400[_0xe017('0x12')]));});});}; \ No newline at end of file +var _0x6a3e=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Setting','options','raw','include','model','map','attributes','ShowSetting','debug','catch','lodash','moment','randomstring','ioredis'];(function(_0x2c4a6e,_0x21b837){var _0x28e4fd=function(_0x1047c3){while(--_0x1047c3){_0x2c4a6e['push'](_0x2c4a6e['shift']());}};_0x28e4fd(++_0x21b837);}(_0x6a3e,0x7c));var _0xe6a3=function(_0x348b66,_0x5bc38c){_0x348b66=_0x348b66-0x0;var _0xf63c2=_0x6a3e[_0x348b66];return _0xf63c2;};'use strict';var _=require(_0xe6a3('0x0'));var util=require('util');var moment=require(_0xe6a3('0x1'));var BPromise=require('bluebird');var rs=require(_0xe6a3('0x2'));var fs=require('fs');var Redis=require(_0xe6a3('0x3'));var db=require(_0xe6a3('0x4'))['db'];var utils=require(_0xe6a3('0x5'));var logger=require(_0xe6a3('0x6'))('rpc');var config=require(_0xe6a3('0x7'));var jayson=require(_0xe6a3('0x8'));var client=jayson[_0xe6a3('0x9')][_0xe6a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34206d,_0x599c86,_0x34dfb3){return new BPromise(function(_0x28e9cf,_0x590f83){return client[_0xe6a3('0xb')](_0x34206d,_0x34dfb3)[_0xe6a3('0xc')](function(_0xc9e8e0){logger[_0xe6a3('0xd')](_0xe6a3('0xe'),_0x599c86,_0xe6a3('0xf'));logger['debug'](_0xe6a3('0x10'),_0x599c86,_0xe6a3('0xf'),JSON[_0xe6a3('0x11')](_0xc9e8e0));if(_0xc9e8e0['error']){if(_0xc9e8e0[_0xe6a3('0x12')][_0xe6a3('0x13')]===0x1f4){logger[_0xe6a3('0x12')](_0xe6a3('0xe'),_0x599c86,_0xc9e8e0[_0xe6a3('0x12')][_0xe6a3('0x14')]);return _0x590f83(_0xc9e8e0[_0xe6a3('0x12')]['message']);}logger[_0xe6a3('0x12')](_0xe6a3('0xe'),_0x599c86,_0xc9e8e0['error'][_0xe6a3('0x14')]);return _0x28e9cf(_0xc9e8e0[_0xe6a3('0x12')]['message']);}else{logger[_0xe6a3('0xd')](_0xe6a3('0xe'),_0x599c86,'request\x20sent');_0x28e9cf(_0xc9e8e0[_0xe6a3('0x15')][_0xe6a3('0x14')]);}})['catch'](function(_0x479ce0){logger[_0xe6a3('0x12')](_0xe6a3('0xe'),_0x599c86,_0x479ce0);_0x590f83(_0x479ce0);});});}exports['ShowSetting']=function(_0x9f2b68){var _0x574936=this;return new Promise(function(_0x154392,_0x1de1c7){return db[_0xe6a3('0x16')]['find']({'raw':_0x9f2b68[_0xe6a3('0x17')]?_0x9f2b68[_0xe6a3('0x17')][_0xe6a3('0x18')]===undefined?!![]:![]:!![],'where':_0x9f2b68[_0xe6a3('0x17')]?_0x9f2b68[_0xe6a3('0x17')]['where']||null:null,'attributes':_0x9f2b68[_0xe6a3('0x17')]?_0x9f2b68[_0xe6a3('0x17')]['attributes']||null:null,'include':_0x9f2b68[_0xe6a3('0x17')]?_0x9f2b68[_0xe6a3('0x17')][_0xe6a3('0x19')]?_['map'](_0x9f2b68[_0xe6a3('0x17')][_0xe6a3('0x19')],function(_0xa58b5b){return{'model':db[_0xa58b5b[_0xe6a3('0x1a')]],'as':_0xa58b5b['as'],'attributes':_0xa58b5b['attributes'],'include':_0xa58b5b[_0xe6a3('0x19')]?_[_0xe6a3('0x1b')](_0xa58b5b[_0xe6a3('0x19')],function(_0x3ab7d1){return{'model':db[_0x3ab7d1['model']],'as':_0x3ab7d1['as'],'attributes':_0x3ab7d1[_0xe6a3('0x1c')],'include':_0x3ab7d1['include']?_[_0xe6a3('0x1b')](_0x3ab7d1['include'],function(_0x157577){return{'model':db[_0x157577[_0xe6a3('0x1a')]],'as':_0x157577['as'],'attributes':_0x157577['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x92a19d){logger[_0xe6a3('0xd')](_0xe6a3('0x1d'),_0x9f2b68);logger[_0xe6a3('0x1e')]('ShowSetting',_0x9f2b68,JSON['stringify'](_0x92a19d));_0x154392(_0x92a19d);})[_0xe6a3('0x1f')](function(_0x52df1a){logger[_0xe6a3('0x12')](_0xe6a3('0x1d'),_0x52df1a['message'],_0x9f2b68);_0x1de1c7(_0x574936[_0xe6a3('0x12')](0x1f4,_0x52df1a[_0xe6a3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 6e053f6..c94e38b 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 _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x12d79d,_0x3c4f12){var _0x5cbe01=function(_0x51cab0){while(--_0x51cab0){_0x12d79d['push'](_0x12d79d['shift']());}};_0x5cbe01(++_0x3c4f12);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x2d42b2,_0x15586b){var _0x474ad5=function(_0xa1094b){while(--_0xa1094b){_0x2d42b2['push'](_0x2d42b2['shift']());}};_0x474ad5(++_0x15586b);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index dc68a7a..9312892 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 _0x3791=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','twilio','connectel','clicksend','clickatell','bandwidth','csc','infobip','intelepeer','ENUM','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x10f3dc,_0x14263e){var _0x5a1356=function(_0x36ce82){while(--_0x36ce82){_0x10f3dc['push'](_0x10f3dc['shift']());}};_0x5a1356(++_0x14263e);}(_0x3791,0x1bb));var _0x1379=function(_0x302aeb,_0x1509f7){_0x302aeb=_0x302aeb-0x0;var _0x526089=_0x3791[_0x302aeb];return _0x526089;};'use strict';var Sequelize=require(_0x1379('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x1379('0x1')],'unique':_0x1379('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x1379('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x1379('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x1379('0x1')]},'type':{'type':Sequelize['ENUM'](_0x1379('0x3'),'skebby',_0x1379('0x4'),_0x1379('0x5'),'plivo',_0x1379('0x6'),_0x1379('0x7'),_0x1379('0x8'),_0x1379('0x9'),_0x1379('0xa'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x1379('0x1')]},'smsMethod':{'type':Sequelize[_0x1379('0xb')]('SI','TI','GP')},'username':{'type':Sequelize[_0x1379('0x1')]},'password':{'type':Sequelize[_0x1379('0x1')]},'apiKey':{'type':Sequelize[_0x1379('0x1')]},'applicationId':{'type':Sequelize[_0x1379('0x1')]},'accountId':{'type':Sequelize[_0x1379('0x1')]},'senderString':{'type':Sequelize[_0x1379('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x1379('0xc');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1379('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1379('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1379('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x1379('0xe')},'mandatoryDisposition':{'type':Sequelize[_0x1379('0xf')],'defaultValue':![],'comment':_0x1379('0x10'),'set':function(_0x23c2db){if(!_0x23c2db)this[_0x1379('0x11')](_0x1379('0x12'),null);this[_0x1379('0x11')](_0x1379('0x13'),_0x23c2db);}}}; \ No newline at end of file +var _0xbaa1=['exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','csc','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x43d25c,_0xcafbc7){var _0x1a378c=function(_0x59c1ce){while(--_0x59c1ce){_0x43d25c['push'](_0x43d25c['shift']());}};_0x1a378c(++_0xcafbc7);}(_0xbaa1,0x1a3));var _0x1baa=function(_0x21a8ed,_0x54d122){_0x21a8ed=_0x21a8ed-0x0;var _0x641ed9=_0xbaa1[_0x21a8ed];return _0x641ed9;};'use strict';var Sequelize=require(_0x1baa('0x0'));var rs=require('randomstring');module[_0x1baa('0x1')]={'name':{'type':Sequelize[_0x1baa('0x2')],'unique':_0x1baa('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x1baa('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x1baa('0x2')],'defaultValue':function(){return rs[_0x1baa('0x4')]();}},'phone':{'type':Sequelize[_0x1baa('0x2')]},'type':{'type':Sequelize[_0x1baa('0x5')](_0x1baa('0x6'),_0x1baa('0x7'),_0x1baa('0x8'),_0x1baa('0x9'),_0x1baa('0xa'),_0x1baa('0xb'),'bandwidth',_0x1baa('0xc'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x1baa('0x2')]},'authId':{'type':Sequelize[_0x1baa('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x1baa('0x2')]},'apiKey':{'type':Sequelize[_0x1baa('0x2')]},'applicationId':{'type':Sequelize[_0x1baa('0x2')]},'accountId':{'type':Sequelize[_0x1baa('0x2')]},'senderString':{'type':Sequelize[_0x1baa('0x2')]},'deliveryReport':{'type':Sequelize[_0x1baa('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x1baa('0x2')]},'notificationTemplate':{'type':Sequelize[_0x1baa('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1baa('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1baa('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1baa('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1baa('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1baa('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1baa('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1baa('0xf')],'comment':_0x1baa('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x1baa('0xd')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1264e1){if(!_0x1264e1)this[_0x1baa('0x11')](_0x1baa('0x12'),null);this[_0x1baa('0x11')](_0x1baa('0x13'),_0x1264e1);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index ea3ab3f..8df6ecb 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 _0xd5f3=['Messages','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','groupName','DELIVERED','bandwidth','redif','error_code','infobip','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./smsAccount.socket','register','client','http','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','get','SmsAccounts','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','catch','show','include','merge','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','findAll','removeDispositions','ids','addAnswer','params','CannedAnswer','getAnswers','rows','removeAnswers','notify','sms','SmsApplication','account','applications','Applications','priority','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','twilio','from','From','MessageSid','skebby','connectel','messageId','message_id','plivo','Text','MessageUUID','results','text','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','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','Contacts','list','omit','SmsInteraction','spread','interaction','created','autoclose','push','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','waitForTheAssignedQueue','Start','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','send','\x0a','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','Contact','Owner','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','CmList','List','defaults','ListId','out','dataValues'];(function(_0x398e06,_0x3e52ba){var _0xed51=function(_0x5dadd0){while(--_0x5dadd0){_0x398e06['push'](_0x398e06['shift']());}};_0xed51(++_0x3e52ba);}(_0xd5f3,0x105));var _0x3d5f=function(_0x31e089,_0xff0a85){_0x31e089=_0x31e089-0x0;var _0x1a3e21=_0xd5f3[_0x31e089];return _0x1a3e21;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3d5f('0x0'));var zipdir=require(_0x3d5f('0x1'));var jsonpatch=require(_0x3d5f('0x2'));var rp=require(_0x3d5f('0x3'));var moment=require(_0x3d5f('0x4'));var BPromise=require(_0x3d5f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3d5f('0x6'));var sox=require(_0x3d5f('0x7'));var csv=require(_0x3d5f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3d5f('0x9'));var squel=require(_0x3d5f('0xa'));var crypto=require('crypto');var jsforce=require(_0x3d5f('0xb'));var deskjs=require(_0x3d5f('0xc'));var toCsv=require(_0x3d5f('0x8'));var querystring=require(_0x3d5f('0xd'));var Papa=require(_0x3d5f('0xe'));var Redis=require(_0x3d5f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3d5f('0x10'));var as=require(_0x3d5f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3d5f('0x12'));var utils=require('../../config/utils');var config=require(_0x3d5f('0x13'));var licenseUtil=require(_0x3d5f('0x14'));var db=require(_0x3d5f('0x15'))['db'];config[_0x3d5f('0x16')]=_['defaults'](config[_0x3d5f('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d5f('0x17'))(new Redis(config[_0x3d5f('0x16')]));require(_0x3d5f('0x18'))[_0x3d5f('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3d5f('0x1a')][_0x3d5f('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x55a3b7,_0x49ffd1,_0x25b60b,_0x28550b){return new BPromise(function(_0x4cd776,_0x583f8d){var _0x44478d=_0x28550b||client;return _0x44478d['request'](_0x55a3b7,_0x25b60b)[_0x3d5f('0x1c')](function(_0x49d760){logger['info'](_0x3d5f('0x1d'),_0x49ffd1,_0x3d5f('0x1e'));logger['debug'](_0x3d5f('0x1f'),_0x49ffd1,_0x3d5f('0x1e'),JSON['stringify'](_0x49d760));if(_0x49d760[_0x3d5f('0x20')]){if(_0x49d760[_0x3d5f('0x20')][_0x3d5f('0x21')]===0x1f4){logger[_0x3d5f('0x20')](_0x3d5f('0x1d'),_0x49ffd1,_0x49d760[_0x3d5f('0x20')][_0x3d5f('0x22')]);return _0x583f8d(_0x49d760[_0x3d5f('0x20')][_0x3d5f('0x22')]);}logger['error'](_0x3d5f('0x1d'),_0x49ffd1,_0x49d760['error'][_0x3d5f('0x22')]);return _0x4cd776(_0x49d760[_0x3d5f('0x20')]['message']);}else{logger[_0x3d5f('0x23')]('SmsAccount,\x20%s,\x20%s',_0x49ffd1,'request\x20sent');_0x4cd776(_0x49d760[_0x3d5f('0x24')][_0x3d5f('0x22')]);}})['catch'](function(_0x5ccc59){logger[_0x3d5f('0x20')](_0x3d5f('0x1d'),_0x49ffd1,_0x5ccc59);_0x583f8d(_0x5ccc59);});});}function respondWithStatusCode(_0x25a41e,_0x49858f){_0x49858f=_0x49858f||0xcc;return function(_0x5b916f){if(_0x5b916f){return _0x25a41e[_0x3d5f('0x25')](_0x49858f);}return _0x25a41e[_0x3d5f('0x26')](_0x49858f)[_0x3d5f('0x27')]();};}function respondWithResult(_0x30ae10,_0x3942b8){_0x3942b8=_0x3942b8||0xc8;return function(_0x8c76d6){if(_0x8c76d6){return _0x30ae10[_0x3d5f('0x26')](_0x3942b8)[_0x3d5f('0x28')](_0x8c76d6);}};}function respondWithFilteredResult(_0x24ccf7,_0x573e2e){return function(_0x57a381){if(_0x57a381){var _0x461575=typeof _0x573e2e['offset']===_0x3d5f('0x29')&&typeof _0x573e2e[_0x3d5f('0x2a')]===_0x3d5f('0x29');var _0x588108=_0x57a381[_0x3d5f('0x2b')];var _0x3bfc45=_0x461575?0x0:_0x573e2e[_0x3d5f('0x2c')];var _0x1a72ad=_0x461575?_0x57a381[_0x3d5f('0x2b')]:_0x573e2e['offset']+_0x573e2e[_0x3d5f('0x2a')];var _0x2f3c88;if(_0x1a72ad>=_0x588108){_0x1a72ad=_0x588108;_0x2f3c88=0xc8;}else{_0x2f3c88=0xce;}_0x24ccf7[_0x3d5f('0x26')](_0x2f3c88);return _0x24ccf7[_0x3d5f('0x2d')](_0x3d5f('0x2e'),_0x3bfc45+'-'+_0x1a72ad+'/'+_0x588108)[_0x3d5f('0x28')](_0x57a381);}return null;};}function patchUpdates(_0x32c8a0){return function(_0x4938e9){try{jsonpatch[_0x3d5f('0x2f')](_0x4938e9,_0x32c8a0,!![]);}catch(_0x298f4f){return BPromise[_0x3d5f('0x30')](_0x298f4f);}return _0x4938e9[_0x3d5f('0x31')]();};}function saveUpdates(_0xdab7b1,_0x22fb9e){return function(_0x41c329){if(_0x41c329){return _0x41c329[_0x3d5f('0x32')](_0xdab7b1)[_0x3d5f('0x1c')](function(_0x3b5952){return _0x3b5952;});}return null;};}function removeEntity(_0xfdf35d,_0x2e2db3){return function(_0x429974){if(_0x429974){return _0x429974['destroy']()[_0x3d5f('0x1c')](function(){var _0x3d1426=_0x429974[_0x3d5f('0x33')]({'plain':!![]});var _0x5adec9=_0x3d5f('0x34');return db['UserProfileResource'][_0x3d5f('0x35')]({'where':{'type':_0x5adec9,'resourceId':_0x3d1426['id']}})[_0x3d5f('0x1c')](function(){return _0x429974;});})['then'](function(){_0xfdf35d[_0x3d5f('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27f253,_0x12d0d0){return function(_0x41843b){if(!_0x41843b){_0x27f253[_0x3d5f('0x25')](0x194);}return _0x41843b;};}function handleError(_0x5657ad,_0x37ace4){_0x37ace4=_0x37ace4||0x1f4;return function(_0x400bb4){logger[_0x3d5f('0x20')](_0x400bb4[_0x3d5f('0x36')]);if(_0x400bb4[_0x3d5f('0x37')]){delete _0x400bb4[_0x3d5f('0x37')];}_0x5657ad[_0x3d5f('0x26')](_0x37ace4)['send'](_0x400bb4);};}exports[_0x3d5f('0x38')]=function(_0x32ac71,_0x420168){var _0x11f7e5={'include':[{'model':db[_0x3d5f('0x39')],'as':_0x3d5f('0x3a')}]},_0x13dfd8={},_0x338be7={'count':0x0,'rows':[]};var _0x3b265f=_[_0x3d5f('0x3b')](db[_0x3d5f('0x3c')][_0x3d5f('0x3d')],function(_0x3ae6c5){return{'name':_0x3ae6c5[_0x3d5f('0x3e')],'type':_0x3ae6c5[_0x3d5f('0x3f')][_0x3d5f('0x40')]};});_0x13dfd8[_0x3d5f('0x41')]=_['map'](_0x3b265f,_0x3d5f('0x37'));_0x13dfd8[_0x3d5f('0x42')]=_[_0x3d5f('0x43')](_0x32ac71[_0x3d5f('0x42')]);_0x13dfd8[_0x3d5f('0x44')]=_[_0x3d5f('0x45')](_0x13dfd8[_0x3d5f('0x41')],_0x13dfd8[_0x3d5f('0x42')]);_0x11f7e5[_0x3d5f('0x46')]=_[_0x3d5f('0x45')](_0x13dfd8[_0x3d5f('0x41')],qs[_0x3d5f('0x47')](_0x32ac71[_0x3d5f('0x42')]['fields']));_0x11f7e5['attributes']=_0x11f7e5[_0x3d5f('0x46')][_0x3d5f('0x48')]?_0x11f7e5[_0x3d5f('0x46')]:_0x13dfd8[_0x3d5f('0x41')];if(!_0x32ac71[_0x3d5f('0x42')][_0x3d5f('0x49')]('nolimit')){_0x11f7e5[_0x3d5f('0x2a')]=qs[_0x3d5f('0x2a')](_0x32ac71[_0x3d5f('0x42')][_0x3d5f('0x2a')]);_0x11f7e5['offset']=qs[_0x3d5f('0x2c')](_0x32ac71['query'][_0x3d5f('0x2c')]);}_0x11f7e5[_0x3d5f('0x4a')]=qs['sort'](_0x32ac71[_0x3d5f('0x42')][_0x3d5f('0x4b')]);_0x11f7e5['where']=qs[_0x3d5f('0x44')](_[_0x3d5f('0x4c')](_0x32ac71[_0x3d5f('0x42')],_0x13dfd8[_0x3d5f('0x44')]),_0x3b265f);if(_0x32ac71['query'][_0x3d5f('0x4d')]){_0x11f7e5['where']=_['merge'](_0x11f7e5[_0x3d5f('0x4e')],{'$or':_[_0x3d5f('0x3b')](_0x3b265f,function(_0x54a1dc){if(_0x54a1dc['type']!==_0x3d5f('0x4f')){var _0x59f63d={};_0x59f63d[_0x54a1dc[_0x3d5f('0x37')]]={'$like':'%'+_0x32ac71[_0x3d5f('0x42')][_0x3d5f('0x4d')]+'%'};return _0x59f63d;}})});}_0x11f7e5=_['merge']({},_0x11f7e5,_0x32ac71[_0x3d5f('0x50')]);var _0x5cbb84={'where':_0x11f7e5[_0x3d5f('0x4e')]};return db['SmsAccount']['count'](_0x5cbb84)[_0x3d5f('0x1c')](function(_0x17634d){_0x338be7[_0x3d5f('0x2b')]=_0x17634d;if(_0x32ac71['query'][_0x3d5f('0x51')]){_0x11f7e5['include']=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x11f7e5);})[_0x3d5f('0x1c')](function(_0x4f774a){_0x338be7['rows']=_0x4f774a;return _0x338be7;})[_0x3d5f('0x1c')](respondWithFilteredResult(_0x420168,_0x11f7e5))[_0x3d5f('0x52')](handleError(_0x420168,null));};exports[_0x3d5f('0x53')]=function(_0x5c2869,_0x50fe27){var _0x203f64={'raw':![],'where':{'id':_0x5c2869['params']['id']},'include':[{'model':db['Pause'],'as':_0x3d5f('0x3a')}]},_0x27427b={};_0x27427b[_0x3d5f('0x41')]=_[_0x3d5f('0x43')](db[_0x3d5f('0x3c')][_0x3d5f('0x3d')]);_0x27427b[_0x3d5f('0x42')]=_['keys'](_0x5c2869[_0x3d5f('0x42')]);_0x27427b[_0x3d5f('0x44')]=_[_0x3d5f('0x45')](_0x27427b[_0x3d5f('0x41')],_0x27427b[_0x3d5f('0x42')]);_0x203f64['attributes']=_['intersection'](_0x27427b[_0x3d5f('0x41')],qs[_0x3d5f('0x47')](_0x5c2869[_0x3d5f('0x42')][_0x3d5f('0x47')]));_0x203f64[_0x3d5f('0x46')]=_0x203f64['attributes'][_0x3d5f('0x48')]?_0x203f64[_0x3d5f('0x46')]:_0x27427b[_0x3d5f('0x41')];if(_0x5c2869[_0x3d5f('0x42')][_0x3d5f('0x51')]){_0x203f64[_0x3d5f('0x54')]=[{'all':!![]}];}_0x203f64=_[_0x3d5f('0x55')]({},_0x203f64,_0x5c2869['options']);return db[_0x3d5f('0x3c')][_0x3d5f('0x56')](_0x203f64)['then'](handleEntityNotFound(_0x50fe27,null))[_0x3d5f('0x1c')](respondWithResult(_0x50fe27,null))[_0x3d5f('0x52')](handleError(_0x50fe27,null));};exports[_0x3d5f('0x57')]=function(_0x112ad7,_0xca7bad){return db[_0x3d5f('0x3c')][_0x3d5f('0x57')](_0x112ad7['body'],{})[_0x3d5f('0x1c')](function(_0x72f9fc){var _0x4ec82f=_0x112ad7['user'][_0x3d5f('0x33')]({'plain':!![]});if(!_0x4ec82f)throw new Error(_0x3d5f('0x58'));if(_0x4ec82f[_0x3d5f('0x59')]===_0x3d5f('0x5a')){var _0x187107=_0x72f9fc['get']({'plain':!![]});var _0x1528bb='SmsAccounts';return db[_0x3d5f('0x5b')]['find']({'where':{'name':_0x1528bb,'userProfileId':_0x4ec82f[_0x3d5f('0x5c')]},'raw':!![]})[_0x3d5f('0x1c')](function(_0x3ebcfb){if(_0x3ebcfb&&_0x3ebcfb[_0x3d5f('0x5d')]===0x0){return db[_0x3d5f('0x5e')][_0x3d5f('0x57')]({'name':_0x187107[_0x3d5f('0x37')],'resourceId':_0x187107['id'],'type':_0x3ebcfb[_0x3d5f('0x37')],'sectionId':_0x3ebcfb['id']},{})[_0x3d5f('0x1c')](function(){return _0x72f9fc;});}else{return _0x72f9fc;}})[_0x3d5f('0x52')](function(_0x4fffaf){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fffaf);throw _0x4fffaf;});}return _0x72f9fc;})['then'](respondWithResult(_0xca7bad,0xc9))[_0x3d5f('0x52')](handleError(_0xca7bad,null));};exports['update']=function(_0x1c2782,_0x220774){if(_0x1c2782[_0x3d5f('0x5f')]['id']){delete _0x1c2782[_0x3d5f('0x5f')]['id'];}return db[_0x3d5f('0x3c')]['find']({'where':{'id':_0x1c2782['params']['id']},'include':[{'model':db[_0x3d5f('0x39')],'as':_0x3d5f('0x3a')}]})[_0x3d5f('0x1c')](handleEntityNotFound(_0x220774,null))[_0x3d5f('0x1c')](saveUpdates(_0x1c2782[_0x3d5f('0x5f')],null))['then'](respondWithResult(_0x220774,null))[_0x3d5f('0x52')](handleError(_0x220774,null));};exports[_0x3d5f('0x35')]=function(_0x501e2c,_0x4dbba6){return db['SmsAccount'][_0x3d5f('0x56')]({'where':{'id':_0x501e2c['params']['id']}})['then'](handleEntityNotFound(_0x4dbba6,null))[_0x3d5f('0x1c')](removeEntity(_0x4dbba6,null))[_0x3d5f('0x52')](handleError(_0x4dbba6,null));};exports['describe']=function(_0xfac2c9,_0x4d0745){return db[_0x3d5f('0x3c')][_0x3d5f('0x60')]()[_0x3d5f('0x1c')](respondWithResult(_0x4d0745,null))['catch'](handleError(_0x4d0745,null));};exports[_0x3d5f('0x61')]=function(_0x57ed21,_0x45e43c,_0x478e40){if(_0x57ed21[_0x3d5f('0x5f')]['id']){delete _0x57ed21[_0x3d5f('0x5f')]['id'];}return db['SmsAccount'][_0x3d5f('0x56')]({'where':{'id':_0x57ed21['params']['id']}})[_0x3d5f('0x1c')](handleEntityNotFound(_0x45e43c,null))[_0x3d5f('0x1c')](function(_0x160122){if(_0x160122){_0x57ed21[_0x3d5f('0x5f')][_0x3d5f('0x62')]=_0x160122['id'];return db[_0x3d5f('0x63')][_0x3d5f('0x57')](_0x57ed21['body']);}})['then'](respondWithResult(_0x45e43c,null))['catch'](handleError(_0x45e43c,null));};exports[_0x3d5f('0x64')]=function(_0xb56915,_0x3d2c5a,_0x5e8bba){var _0x2894cc={'raw':![],'where':{}};var _0x827354={};var _0x5e7555={'count':0x0,'rows':[]};return db['SmsAccount'][_0x3d5f('0x65')]({'where':{'id':_0xb56915['params']['id']}})[_0x3d5f('0x1c')](handleEntityNotFound(_0x3d2c5a,null))[_0x3d5f('0x1c')](function(_0x203f98){if(_0x203f98){_0x827354[_0x3d5f('0x41')]=_[_0x3d5f('0x43')](db[_0x3d5f('0x63')][_0x3d5f('0x3d')]);_0x827354[_0x3d5f('0x42')]=_[_0x3d5f('0x43')](_0xb56915[_0x3d5f('0x42')]);_0x827354[_0x3d5f('0x44')]=_[_0x3d5f('0x45')](_0x827354[_0x3d5f('0x41')],_0x827354[_0x3d5f('0x42')]);_0x2894cc[_0x3d5f('0x46')]=_[_0x3d5f('0x45')](_0x827354['model'],qs['fields'](_0xb56915[_0x3d5f('0x42')][_0x3d5f('0x47')]));_0x2894cc['attributes']=_0x2894cc['attributes']['length']?_0x2894cc[_0x3d5f('0x46')]:_0x827354[_0x3d5f('0x41')];if(!_0xb56915[_0x3d5f('0x42')][_0x3d5f('0x49')](_0x3d5f('0x66'))){_0x2894cc[_0x3d5f('0x2a')]=qs[_0x3d5f('0x2a')](_0xb56915['query']['limit']);_0x2894cc[_0x3d5f('0x2c')]=qs[_0x3d5f('0x2c')](_0xb56915[_0x3d5f('0x42')]['offset']);}_0x2894cc[_0x3d5f('0x4a')]=qs['sort'](_0xb56915[_0x3d5f('0x42')]['sort']);_0x2894cc[_0x3d5f('0x4e')]=qs[_0x3d5f('0x44')](_[_0x3d5f('0x4c')](_0xb56915[_0x3d5f('0x42')],_0x827354['filters']));_0x2894cc[_0x3d5f('0x4e')]['SmsAccountId']=_0x203f98['id'];if(_0xb56915[_0x3d5f('0x42')]['filter']){_0x2894cc['where']=_[_0x3d5f('0x55')](_0x2894cc['where'],{'$or':_['map'](_0x2894cc[_0x3d5f('0x46')],function(_0x214844){var _0x47357b={};_0x47357b[_0x214844]={'$like':'%'+_0xb56915[_0x3d5f('0x42')][_0x3d5f('0x4d')]+'%'};return _0x47357b;})});}_0x2894cc=_[_0x3d5f('0x55')]({},_0x2894cc,_0xb56915[_0x3d5f('0x50')]);return db[_0x3d5f('0x63')][_0x3d5f('0x2b')]({'where':_0x2894cc[_0x3d5f('0x4e')]})[_0x3d5f('0x1c')](function(_0x3ad9c4){_0x5e7555['count']=_0x3ad9c4;if(_0xb56915[_0x3d5f('0x42')][_0x3d5f('0x51')]){_0x2894cc[_0x3d5f('0x54')]=[{'all':!![]}];}return db[_0x3d5f('0x63')][_0x3d5f('0x67')](_0x2894cc);})[_0x3d5f('0x1c')](function(_0xef57e8){_0x5e7555['rows']=_0xef57e8;return _0x5e7555;});}})[_0x3d5f('0x1c')](respondWithFilteredResult(_0x3d2c5a,_0x2894cc))[_0x3d5f('0x52')](handleError(_0x3d2c5a,null));};exports[_0x3d5f('0x68')]=function(_0x448668,_0x58d041,_0x1a8c6e){return db[_0x3d5f('0x3c')]['find']({'where':{'id':_0x448668['params']['id']}})[_0x3d5f('0x1c')](handleEntityNotFound(_0x58d041,null))[_0x3d5f('0x1c')](function(_0x551be5){if(_0x551be5){return _0x551be5['removeDispositions'](_0x448668[_0x3d5f('0x42')][_0x3d5f('0x69')]);}})[_0x3d5f('0x1c')](respondWithStatusCode(_0x58d041,null))[_0x3d5f('0x52')](handleError(_0x58d041,null));};exports[_0x3d5f('0x6a')]=function(_0x5edb4d,_0x5ad1e6,_0x26fff4){if(_0x5edb4d[_0x3d5f('0x5f')]['id']){delete _0x5edb4d[_0x3d5f('0x5f')]['id'];}return db[_0x3d5f('0x3c')]['find']({'where':{'id':_0x5edb4d[_0x3d5f('0x6b')]['id']}})[_0x3d5f('0x1c')](handleEntityNotFound(_0x5ad1e6,null))[_0x3d5f('0x1c')](function(_0x134dee){if(_0x134dee){_0x5edb4d[_0x3d5f('0x5f')][_0x3d5f('0x62')]=_0x134dee['id'];return db[_0x3d5f('0x6c')][_0x3d5f('0x57')](_0x5edb4d[_0x3d5f('0x5f')]);}})[_0x3d5f('0x1c')](respondWithResult(_0x5ad1e6,null))['catch'](handleError(_0x5ad1e6,null));};exports[_0x3d5f('0x6d')]=function(_0x15ad5d,_0x64d1ca,_0x5d49ba){var _0x4fc134={'raw':![],'where':{}};var _0x2bcff9={};var _0x5880e0={'count':0x0,'rows':[]};return db[_0x3d5f('0x3c')][_0x3d5f('0x65')]({'where':{'id':_0x15ad5d[_0x3d5f('0x6b')]['id']}})['then'](handleEntityNotFound(_0x64d1ca,null))[_0x3d5f('0x1c')](function(_0x5ac84e){if(_0x5ac84e){_0x2bcff9[_0x3d5f('0x41')]=_[_0x3d5f('0x43')](db[_0x3d5f('0x6c')]['rawAttributes']);_0x2bcff9[_0x3d5f('0x42')]=_[_0x3d5f('0x43')](_0x15ad5d['query']);_0x2bcff9[_0x3d5f('0x44')]=_[_0x3d5f('0x45')](_0x2bcff9[_0x3d5f('0x41')],_0x2bcff9[_0x3d5f('0x42')]);_0x4fc134['attributes']=_[_0x3d5f('0x45')](_0x2bcff9['model'],qs[_0x3d5f('0x47')](_0x15ad5d[_0x3d5f('0x42')][_0x3d5f('0x47')]));_0x4fc134['attributes']=_0x4fc134['attributes']['length']?_0x4fc134[_0x3d5f('0x46')]:_0x2bcff9[_0x3d5f('0x41')];if(!_0x15ad5d[_0x3d5f('0x42')][_0x3d5f('0x49')](_0x3d5f('0x66'))){_0x4fc134[_0x3d5f('0x2a')]=qs[_0x3d5f('0x2a')](_0x15ad5d['query']['limit']);_0x4fc134[_0x3d5f('0x2c')]=qs[_0x3d5f('0x2c')](_0x15ad5d[_0x3d5f('0x42')][_0x3d5f('0x2c')]);}_0x4fc134[_0x3d5f('0x4a')]=qs[_0x3d5f('0x4b')](_0x15ad5d['query']['sort']);_0x4fc134[_0x3d5f('0x4e')]=qs['filters'](_[_0x3d5f('0x4c')](_0x15ad5d[_0x3d5f('0x42')],_0x2bcff9[_0x3d5f('0x44')]));_0x4fc134[_0x3d5f('0x4e')][_0x3d5f('0x62')]=_0x5ac84e['id'];if(_0x15ad5d[_0x3d5f('0x42')][_0x3d5f('0x4d')]){_0x4fc134[_0x3d5f('0x4e')]=_[_0x3d5f('0x55')](_0x4fc134[_0x3d5f('0x4e')],{'$or':_[_0x3d5f('0x3b')](_0x4fc134[_0x3d5f('0x46')],function(_0x362757){var _0x42e70b={};_0x42e70b[_0x362757]={'$like':'%'+_0x15ad5d[_0x3d5f('0x42')]['filter']+'%'};return _0x42e70b;})});}_0x4fc134=_[_0x3d5f('0x55')]({},_0x4fc134,_0x15ad5d[_0x3d5f('0x50')]);return db[_0x3d5f('0x6c')][_0x3d5f('0x2b')]({'where':_0x4fc134[_0x3d5f('0x4e')]})[_0x3d5f('0x1c')](function(_0x441740){_0x5880e0[_0x3d5f('0x2b')]=_0x441740;if(_0x15ad5d[_0x3d5f('0x42')][_0x3d5f('0x51')]){_0x4fc134['include']=[{'all':!![]}];}return db[_0x3d5f('0x6c')][_0x3d5f('0x67')](_0x4fc134);})['then'](function(_0x2b6dea){_0x5880e0[_0x3d5f('0x6e')]=_0x2b6dea;return _0x5880e0;});}})[_0x3d5f('0x1c')](respondWithFilteredResult(_0x64d1ca,_0x4fc134))[_0x3d5f('0x52')](handleError(_0x64d1ca,null));};exports[_0x3d5f('0x6f')]=function(_0x482a84,_0x547478,_0x3bd59e){return db[_0x3d5f('0x3c')][_0x3d5f('0x56')]({'where':{'id':_0x482a84[_0x3d5f('0x6b')]['id']}})[_0x3d5f('0x1c')](handleEntityNotFound(_0x547478,null))['then'](function(_0x542cdd){if(_0x542cdd){return _0x542cdd[_0x3d5f('0x6f')](_0x482a84[_0x3d5f('0x42')][_0x3d5f('0x69')]);}})[_0x3d5f('0x1c')](respondWithStatusCode(_0x547478,null))[_0x3d5f('0x52')](handleError(_0x547478,null));};exports[_0x3d5f('0x70')]=function(_0x1b107a,_0x5ea7b9,_0x369c21){var _0x166a92={'channel':_0x3d5f('0x71')};var _0x4d7daf=[];var _0x39b25e=[];var _0x2b2e01={};return db['SmsAccount']['find']({'where':{'id':_0x1b107a[_0x3d5f('0x6b')]['id']},'include':[{'model':db[_0x3d5f('0x72')],'as':'Applications'}]})[_0x3d5f('0x1c')](handleEntityNotFound(_0x5ea7b9,null))['then'](function(_0x3929dc){_0x166a92[_0x3d5f('0x73')]=_0x3929dc;_0x166a92[_0x3d5f('0x74')]=_['orderBy'](_0x3929dc[_0x3d5f('0x75')],[_0x3d5f('0x76')],[_0x3d5f('0x77')]);if(_0x166a92[_0x3d5f('0x73')][_0x3d5f('0x75')]){delete _0x166a92['account'][_0x3d5f('0x75')];}return db[_0x3d5f('0x78')][_0x3d5f('0x60')]();})[_0x3d5f('0x1c')](function(_0x3ec8d3){if(!_0x3ec8d3){throw new db[(_0x3d5f('0x79'))][(_0x3d5f('0x7a'))]('no\x20available\x20attributes');}_0x4d7daf=_[_0x3d5f('0x7b')](_[_0x3d5f('0x43')](_0x3ec8d3),[_0x3d5f('0x7c'),'updatedAt']);_0x39b25e=_[_0x3d5f('0x7b')](_['keys'](_0x3ec8d3),[_0x3d5f('0x7c'),_0x3d5f('0x7d'),_0x3d5f('0x7e'),'ListId']);_0x166a92[_0x3d5f('0x5f')]={'mapKey':'mobile'};if(_0x166a92['account'][_0x3d5f('0x3f')]){switch(_0x166a92[_0x3d5f('0x73')][_0x3d5f('0x3f')]){case _0x3d5f('0x7f'):_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x80')]=_0x1b107a[_0x3d5f('0x5f')][_0x3d5f('0x81')];_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x5f')]=_0x1b107a['body']['Body'];_0x166a92[_0x3d5f('0x5f')]['messageId']=_0x1b107a[_0x3d5f('0x5f')][_0x3d5f('0x82')];break;case _0x3d5f('0x83'):_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x80')]='+'+_0x1b107a['body']['sender'];_0x166a92['body'][_0x3d5f('0x5f')]=_0x1b107a[_0x3d5f('0x5f')]['text'];break;case _0x3d5f('0x84'):_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x80')]=_0x1b107a[_0x3d5f('0x5f')][_0x3d5f('0x80')];_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x5f')]=_0x1b107a['body'][_0x3d5f('0x22')];break;case'clicksend':_0x166a92[_0x3d5f('0x5f')]['from']=_0x1b107a[_0x3d5f('0x5f')][_0x3d5f('0x80')];_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x5f')]=_0x1b107a[_0x3d5f('0x5f')][_0x3d5f('0x5f')];_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x85')]=_0x1b107a[_0x3d5f('0x5f')][_0x3d5f('0x86')];break;case _0x3d5f('0x87'):_0x166a92[_0x3d5f('0x5f')]['from']=_0x1b107a['body'][_0x3d5f('0x81')];_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x5f')]=_0x1b107a['body'][_0x3d5f('0x88')];_0x166a92['body']['messageId']=_0x1b107a['body'][_0x3d5f('0x89')];break;case'infobip':_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x80')]='+'+_0x1b107a[_0x3d5f('0x5f')][_0x3d5f('0x8a')][0x0][_0x3d5f('0x80')];_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x5f')]=_0x1b107a[_0x3d5f('0x5f')][_0x3d5f('0x8a')][0x0][_0x3d5f('0x8b')];_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x85')]=_0x1b107a[_0x3d5f('0x5f')][_0x3d5f('0x8a')][0x0][_0x3d5f('0x85')];break;case _0x3d5f('0x8c'):_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x80')]=_0x1b107a['body']['originatingAddress'];_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x5f')]=_0x1b107a['body'][_0x3d5f('0x8d')][_0x3d5f('0x22')];break;case _0x3d5f('0x8e'):_0x166a92['body']['from']=_0x1b107a[_0x3d5f('0x5f')][_0x3d5f('0x8f')];_0x166a92[_0x3d5f('0x5f')]['body']=_0x1b107a[_0x3d5f('0x5f')]['text'];_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x85')]=_0x1b107a[_0x3d5f('0x5f')][_0x3d5f('0x90')];break;case'bandwidth':_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x85')]=_0x1b107a['body'][0x0][_0x3d5f('0x22')]['id'];_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x80')]=_0x1b107a[_0x3d5f('0x5f')][0x0][_0x3d5f('0x22')][_0x3d5f('0x80')];_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x5f')]=_0x1b107a['body'][0x0]['message'][_0x3d5f('0x8b')];break;case _0x3d5f('0x91'):_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x80')]=_0x1b107a[_0x3d5f('0x5f')][_0x3d5f('0x80')];_0x166a92['body'][_0x3d5f('0x5f')]=_0x1b107a[_0x3d5f('0x5f')][_0x3d5f('0x22')];_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x85')]=_0x1b107a[_0x3d5f('0x5f')][_0x3d5f('0x92')];break;}}if(_0x166a92['body']['id']){delete _0x166a92['body']['id'];}if(_[_0x3d5f('0x93')](_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x80')])){throw new db[(_0x3d5f('0x79'))][(_0x3d5f('0x7a'))](_0x3d5f('0x94'));}if(_[_0x3d5f('0x93')](_0x166a92['body'][_0x3d5f('0x5f')])||_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x5f')]===''){throw new db['Sequelize'][(_0x3d5f('0x7a'))](_0x3d5f('0x95'));}if(_[_0x3d5f('0x93')](_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x96')])){throw new db['Sequelize'][(_0x3d5f('0x7a'))](_0x3d5f('0x97')+_0x39b25e);}if(!_['includes'](_0x39b25e,_0x166a92['body'][_0x3d5f('0x96')])){throw new db[(_0x3d5f('0x79'))][(_0x3d5f('0x7a'))](_0x3d5f('0x98')+_0x39b25e);}_0x2b2e01[_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x96')]]=_0x166a92[_0x3d5f('0x5f')]['from'];return db['CmList'][_0x3d5f('0x56')]({'where':{'id':_0x166a92[_0x3d5f('0x73')]['ListId']},'include':[{'model':db[_0x3d5f('0x78')],'as':_0x3d5f('0x99'),'where':_0x2b2e01,'limit':0x1,'order':[[_0x3d5f('0x7d'),'DESC']]}]});})[_0x3d5f('0x1c')](handleEntityNotFound(_0x5ea7b9,null))[_0x3d5f('0x1c')](function(_0x241863){if(_0x241863){_0x166a92[_0x3d5f('0x9a')]=_[_0x3d5f('0x9b')](_0x241863,[_0x3d5f('0x99')]);if(_0x241863[_0x3d5f('0x99')]['length']){return _0x241863[_0x3d5f('0x99')][0x0];}var _0x50df24=_['defaults'](_0x166a92[_0x3d5f('0x5f')],{'firstName':_0x166a92[_0x3d5f('0x5f')]['from'],'ListId':_0x241863['id']});_0x50df24[_0x166a92['body'][_0x3d5f('0x96')]]=_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x80')];return db[_0x3d5f('0x78')][_0x3d5f('0x57')](_0x50df24,{'fields':_0x4d7daf,'raw':!![]});}})[_0x3d5f('0x1c')](handleEntityNotFound(_0x5ea7b9,null))['then'](function(_0x2fef34){if(_0x2fef34){_0x166a92['contact']=_0x2fef34;var _0x464284={'ContactId':_0x2fef34['id'],'phone':_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x80')],'SmsAccountId':_0x1b107a[_0x3d5f('0x6b')]['id']};var _0x49ee6c={'ContactId':_0x2fef34['id'],'SmsAccountId':_0x1b107a['params']['id'],'closed':![]};return db[_0x3d5f('0x9c')]['find']({'where':_0x49ee6c})[_0x3d5f('0x1c')](function(_0x16daf7){if(_0x16daf7){return[_0x16daf7,![]];}return db['SmsInteraction'][_0x3d5f('0x57')](_0x464284)[_0x3d5f('0x1c')](function(_0x3cf893){return[_0x3cf893,!![]];});});}})[_0x3d5f('0x9d')](function(_0x4dc0c3,_0x15b2ac){_0x166a92[_0x3d5f('0x9e')]=_0x4dc0c3['get']({'plain':!![]});_0x166a92[_0x3d5f('0x9e')][_0x3d5f('0x9f')]=![];if(_0x15b2ac){if(_0x166a92[_0x3d5f('0x73')][_0x3d5f('0xa0')]){_0x166a92[_0x3d5f('0x74')][_0x3d5f('0xa1')]({'id':0x0,'priority':_0x166a92[_0x3d5f('0x74')][_0x3d5f('0x48')]+0x1,'app':_0x3d5f('0xa2'),'appdata':'unmanaged','interval':_0x3d5f('0xa3')});}_0x166a92[_0x3d5f('0x9e')][_0x3d5f('0x9f')]=!![];}return db[_0x3d5f('0xa4')]['create']({'phone':_0x166a92[_0x3d5f('0x5f')][_0x3d5f('0x80')],'messageId':_0x166a92[_0x3d5f('0x5f')]['messageId'],'body':_0x166a92[_0x3d5f('0x5f')]['body'],'SmsAccountId':_0x1b107a['params']['id'],'SmsInteractionId':_0x4dc0c3['id'],'direction':'in','ContactId':_0x4dc0c3[_0x3d5f('0xa5')],'AttachmentId':_0x166a92['body'][_0x3d5f('0xa6')]});})[_0x3d5f('0x1c')](function(_0x4af1a1){_0x166a92[_0x3d5f('0x22')]=_0x4af1a1;if(!_0x166a92[_0x3d5f('0x9e')]['UserId'])return;return db[_0x3d5f('0xa7')][_0x3d5f('0x56')]({'attributes':['id',_0x3d5f('0x37')],'where':{'id':_0x166a92[_0x3d5f('0x9e')]['UserId']}});})[_0x3d5f('0x1c')](function(_0x5da632){if(_0x5da632){_0x166a92[_0x3d5f('0x74')][_0x3d5f('0xa8')]({'id':0x0,'priority':0x0,'app':_0x3d5f('0xa9'),'appdata':_0x5da632[_0x3d5f('0x37')]+','+(_0x166a92[_0x3d5f('0x73')][_0x3d5f('0xaa')]||0xa),'interval':_0x3d5f('0xa3')});}if(!_0x166a92[_0x3d5f('0x9e')][_0x3d5f('0xab')])return;return db[_0x3d5f('0xac')]['find']({'attributes':['id','name'],'where':{'id':_0x166a92[_0x3d5f('0x9e')][_0x3d5f('0xab')]}});})[_0x3d5f('0x1c')](function(_0x598a87){if(_0x598a87){_0x166a92[_0x3d5f('0x74')][_0x3d5f('0xa8')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x598a87[_0x3d5f('0x37')]+','+(_0x166a92['account'][_0x3d5f('0xad')]||0x12c),'interval':_0x3d5f('0xa3')});}return respondWithRpcPromise(_0x3d5f('0xae'),'startRouting',_0x166a92);})[_0x3d5f('0x1c')](function(_0x54b2e9){if(_0x54b2e9){var _0xe43f7e=0xc8;var _0x3844f5=_0x3d5f('0xaf');logger[_0x3d5f('0x23')](_0x3d5f('0x1f'),_0x3844f5,_0xe43f7e,_0x3d5f('0xb0'));logger[_0x3d5f('0xb1')](_0x3d5f('0xb2'),_0x3844f5,_0xe43f7e,_0x3d5f('0xb0'),JSON[_0x3d5f('0xb3')](_0x54b2e9));if(_0x166a92[_0x3d5f('0x73')][_0x3d5f('0x3f')]===_0x3d5f('0x7f')){return _0x5ea7b9[_0x3d5f('0x26')](_0xe43f7e)[_0x3d5f('0x2d')](_0x3d5f('0xb4'),'text/xml')[_0x3d5f('0xb5')](_0x3d5f('0xb6'));}else{return _0x5ea7b9[_0x3d5f('0x26')](_0xe43f7e)[_0x3d5f('0x28')](_0x54b2e9);}}})[_0x3d5f('0x52')](handleError(_0x5ea7b9,null));};exports['addApplications']=function(_0x4f2e11,_0x57ce3a){var _0x55bfbb=_0x4f2e11['params']['id'];var _0x59594f=_0x4f2e11[_0x3d5f('0x5f')];var _0x2c270f=0xc8;var _0x1d6a93=null;return db[_0x3d5f('0xb7')][_0x3d5f('0xb8')]({'isolationLevel':db[_0x3d5f('0xb7')][_0x3d5f('0xb9')]['ISOLATION_LEVELS'][_0x3d5f('0xba')]},function(_0x1fa9de){return db[_0x3d5f('0x3c')]['findOne']({'where':{'id':_0x55bfbb},'transaction':_0x1fa9de})[_0x3d5f('0x1c')](function(_0x653ebc){if(_0x653ebc){return db[_0x3d5f('0x72')][_0x3d5f('0x35')]({'where':{'SmsAccountId':_0x55bfbb},'transaction':_0x1fa9de})[_0x3d5f('0x1c')](function(){var _0x8246f7=_[_0x3d5f('0x3b')](_0x59594f,function(_0x5d5024){_0x5d5024['SmsAccountId']=_0x55bfbb;return _0x5d5024;});return db[_0x3d5f('0x72')][_0x3d5f('0xbb')](_0x8246f7,{'transaction':_0x1fa9de});});}else{_0x2c270f=0x194;_0x1d6a93=[];}});})[_0x3d5f('0x1c')](function(){if(_0x2c270f!==0x194){return db[_0x3d5f('0x72')][_0x3d5f('0xbc')]({'where':{'SmsAccountId':_0x55bfbb},'order':_0x3d5f('0x76')})[_0x3d5f('0x1c')](function(_0x1b9cbe){_0x1d6a93=_0x1b9cbe;});}})[_0x3d5f('0x52')](function(_0xd40ffe){_0x2c270f=0x1f4;logger[_0x3d5f('0x20')](_0xd40ffe[_0x3d5f('0x36')]);if(_0xd40ffe[_0x3d5f('0x37')]){delete _0xd40ffe[_0x3d5f('0x37')];}_0x1d6a93=_0xd40ffe;})[_0x3d5f('0xbd')](function(){if(_0x1d6a93===null){_0x57ce3a[_0x3d5f('0x25')](_0x2c270f);}else{if(_0x2c270f===0x1f4){_0x57ce3a['status'](_0x2c270f)[_0x3d5f('0xb5')](_0x1d6a93);}else{_0x57ce3a['status'](_0x2c270f)[_0x3d5f('0x28')](_0x1d6a93);}}});};exports['getApplications']=function(_0x5a8fd4,_0x1a3300,_0x26a7f9){var _0x5c5227={};var _0x50dbf4={};var _0x3407fa;var _0x463245;return db[_0x3d5f('0x3c')][_0x3d5f('0x65')]({'where':{'id':_0x5a8fd4[_0x3d5f('0x6b')]['id']}})['then'](handleEntityNotFound(_0x1a3300,null))[_0x3d5f('0x1c')](function(_0xa3e5){if(_0xa3e5){_0x3407fa=_0xa3e5;_0x50dbf4[_0x3d5f('0x41')]=_[_0x3d5f('0x43')](db[_0x3d5f('0x72')]['rawAttributes']);_0x50dbf4[_0x3d5f('0x42')]=_[_0x3d5f('0x43')](_0x5a8fd4['query']);_0x50dbf4[_0x3d5f('0x44')]=_['intersection'](_0x50dbf4[_0x3d5f('0x41')],_0x50dbf4[_0x3d5f('0x42')]);_0x5c5227[_0x3d5f('0x46')]=_[_0x3d5f('0x45')](_0x50dbf4['model'],qs['fields'](_0x5a8fd4['query'][_0x3d5f('0x47')]));_0x5c5227[_0x3d5f('0x46')]=_0x5c5227[_0x3d5f('0x46')][_0x3d5f('0x48')]?_0x5c5227[_0x3d5f('0x46')]:_0x50dbf4[_0x3d5f('0x41')];_0x5c5227[_0x3d5f('0x4a')]=qs['sort'](_0x5a8fd4[_0x3d5f('0x42')][_0x3d5f('0x4b')]);_0x5c5227[_0x3d5f('0x4e')]=qs[_0x3d5f('0x44')](_[_0x3d5f('0x4c')](_0x5a8fd4[_0x3d5f('0x42')],_0x50dbf4[_0x3d5f('0x44')]));if(_0x5a8fd4[_0x3d5f('0x42')][_0x3d5f('0x4d')]){_0x5c5227['where']=_['merge'](_0x5c5227[_0x3d5f('0x4e')],{'$or':_[_0x3d5f('0x3b')](_0x5c5227[_0x3d5f('0x46')],function(_0x250f32){var _0x548780={};_0x548780[_0x250f32]={'$like':'%'+_0x5a8fd4[_0x3d5f('0x42')][_0x3d5f('0x4d')]+'%'};return _0x548780;})});}_0x5c5227=_[_0x3d5f('0x55')]({},_0x5c5227,_0x5a8fd4['options']);return _0x3407fa[_0x3d5f('0xbe')](_0x5c5227);}})[_0x3d5f('0x1c')](function(_0x3f47b2){if(_0x3f47b2){_0x463245=_0x3f47b2['length'];if(!_0x5a8fd4[_0x3d5f('0x42')][_0x3d5f('0x49')](_0x3d5f('0x66'))){_0x5c5227[_0x3d5f('0x2a')]=qs[_0x3d5f('0x2a')](_0x5a8fd4[_0x3d5f('0x42')][_0x3d5f('0x2a')]);_0x5c5227[_0x3d5f('0x2c')]=qs['offset'](_0x5a8fd4['query']['offset']);}return _0x3407fa[_0x3d5f('0xbe')](_0x5c5227);}})[_0x3d5f('0x1c')](function(_0x4253d0){if(_0x4253d0){return _0x4253d0?{'count':_0x463245,'rows':_0x4253d0}:null;}})[_0x3d5f('0x1c')](respondWithResult(_0x1a3300,null))['catch'](handleError(_0x1a3300,null));};exports['getInteractions']=function(_0x500075,_0x56aac1,_0x67f6d){var _0x33d601={'raw':![],'where':{}};var _0x6306ee={};var _0x19afa8={'count':0x0,'rows':[]};return db[_0x3d5f('0x3c')][_0x3d5f('0x65')]({'where':{'id':_0x500075[_0x3d5f('0x6b')]['id']}})[_0x3d5f('0x1c')](handleEntityNotFound(_0x56aac1,null))['then'](function(_0x9ea93c){if(_0x9ea93c){_0x6306ee[_0x3d5f('0x41')]=_['keys'](db[_0x3d5f('0x9c')][_0x3d5f('0x3d')]);_0x6306ee[_0x3d5f('0x42')]=_[_0x3d5f('0x43')](_0x500075[_0x3d5f('0x42')]);_0x6306ee[_0x3d5f('0x44')]=_[_0x3d5f('0x45')](_0x6306ee[_0x3d5f('0x41')],_0x6306ee[_0x3d5f('0x42')]);_0x33d601[_0x3d5f('0x46')]=_[_0x3d5f('0x45')](_0x6306ee[_0x3d5f('0x41')],qs[_0x3d5f('0x47')](_0x500075[_0x3d5f('0x42')][_0x3d5f('0x47')]));_0x33d601[_0x3d5f('0x46')]=_0x33d601[_0x3d5f('0x46')][_0x3d5f('0x48')]?_0x33d601[_0x3d5f('0x46')]:_0x6306ee['model'];if(!_0x500075[_0x3d5f('0x42')][_0x3d5f('0x49')](_0x3d5f('0x66'))){_0x33d601[_0x3d5f('0x2a')]=qs[_0x3d5f('0x2a')](_0x500075[_0x3d5f('0x42')][_0x3d5f('0x2a')]);_0x33d601[_0x3d5f('0x2c')]=qs[_0x3d5f('0x2c')](_0x500075[_0x3d5f('0x42')][_0x3d5f('0x2c')]);}_0x33d601[_0x3d5f('0x4a')]=qs[_0x3d5f('0x4b')](_0x500075[_0x3d5f('0x42')][_0x3d5f('0x4b')]);_0x33d601['where']=qs[_0x3d5f('0x44')](_['pick'](_0x500075['query'],_0x6306ee[_0x3d5f('0x44')]));_0x33d601[_0x3d5f('0x4e')][_0x3d5f('0x62')]=_0x9ea93c['id'];if(_0x500075[_0x3d5f('0x42')][_0x3d5f('0x4d')]){_0x33d601[_0x3d5f('0x4e')]=_[_0x3d5f('0x55')](_0x33d601[_0x3d5f('0x4e')],{'$or':_[_0x3d5f('0x3b')](_0x33d601[_0x3d5f('0x46')],function(_0x402922){var _0x3806d9={};_0x3806d9[_0x402922]={'$like':'%'+_0x500075[_0x3d5f('0x42')]['filter']+'%'};return _0x3806d9;})});}_0x33d601=_[_0x3d5f('0x55')]({},_0x33d601,_0x500075[_0x3d5f('0x50')]);return db[_0x3d5f('0x9c')][_0x3d5f('0x2b')]({'where':_0x33d601[_0x3d5f('0x4e')]})[_0x3d5f('0x1c')](function(_0x64966f){_0x19afa8[_0x3d5f('0x2b')]=_0x64966f;if(_0x500075[_0x3d5f('0x42')][_0x3d5f('0x51')]){_0x33d601[_0x3d5f('0x54')]=[{'model':db[_0x3d5f('0x78')],'as':_0x3d5f('0xbf'),'required':![]},{'model':db['User'],'as':_0x3d5f('0xc0'),'attributes':[_0x3d5f('0x37'),'fullname',_0x3d5f('0xc1')],'required':![]},{'model':db[_0x3d5f('0xc2')],'as':_0x3d5f('0xc3'),'attributes':['id','name',_0x3d5f('0xc4')],'where':_0x500075['query'][_0x3d5f('0xc5')]?{'id':_0x500075[_0x3d5f('0x42')]['tag']}:undefined,'required':_0x500075[_0x3d5f('0x42')][_0x3d5f('0xc5')]?!![]:![]}];}return db[_0x3d5f('0x9c')][_0x3d5f('0x67')](_0x33d601);})[_0x3d5f('0x1c')](function(_0x1cd7c7){_0x19afa8[_0x3d5f('0x6e')]=_0x1cd7c7;return _0x19afa8;});}})[_0x3d5f('0x1c')](respondWithFilteredResult(_0x56aac1,_0x33d601))[_0x3d5f('0x52')](handleError(_0x56aac1,null));};exports['send']=function(_0x21639a,_0x4a3cd2,_0x3610f0){var _0x463e8c,_0x580b44,_0x49ec14;if(_[_0x3d5f('0x93')](_0x21639a['body'][_0x3d5f('0x5f')])||_0x21639a['body'][_0x3d5f('0x5f')]===''){throw new db[(_0x3d5f('0x79'))][(_0x3d5f('0x7a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3d5f('0x93')](_0x21639a[_0x3d5f('0x5f')]['to'])){throw new db['Sequelize'][(_0x3d5f('0x7a'))](_0x3d5f('0xc6'));}_0x463e8c=_0x21639a[_0x3d5f('0x5f')]['to'];return db[_0x3d5f('0x3c')]['find']({'where':{'id':_0x21639a[_0x3d5f('0x6b')]['id']},'include':[{'model':db[_0x3d5f('0xc7')],'as':_0x3d5f('0xc8'),'include':[{'model':db['CmContact'],'as':_0x3d5f('0x99'),'where':{'mobile':_0x463e8c},'limit':0x1,'order':[[_0x3d5f('0x7d'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x4a3cd2,null))['then'](function(_0x1734fd){if(_0x1734fd&&_0x1734fd[_0x3d5f('0xc8')]){_0x580b44=_0x1734fd[_0x3d5f('0x33')]({'plain':!![]});if(_0x580b44['List']&&_0x580b44['List']['Contacts'][_0x3d5f('0x48')]){return _0x580b44[_0x3d5f('0xc8')][_0x3d5f('0x99')][0x0];}return db[_0x3d5f('0x78')][_0x3d5f('0x57')](_[_0x3d5f('0xc9')](_0x21639a[_0x3d5f('0x5f')],{'firstName':_0x463e8c,'mobile':_0x463e8c,'phone':_0x463e8c,'ListId':_0x580b44[_0x3d5f('0xca')]}));}})['then'](handleEntityNotFound(_0x4a3cd2,null))[_0x3d5f('0x1c')](function(_0x5b7953){if(_0x5b7953){_0x49ec14=_0x5b7953;return db[_0x3d5f('0x9c')][_0x3d5f('0x56')]({'where':{'ContactId':_0x49ec14['id'],'closed':![],'SmsAccountId':_0x580b44['id']}})['then'](function(_0x3a307c){if(_0x3a307c){return[_0x3a307c,![]];}return db[_0x3d5f('0x9c')][_0x3d5f('0x57')]({'UserId':_0x21639a['user']['id'],'ContactId':_0x49ec14['id'],'SmsAccountId':_0x580b44['id'],'phone':_0x463e8c,'firstMsgDirection':_0x3d5f('0xcb'),'Messages':[_['merge'](_0x21639a[_0x3d5f('0x5f')],{'read':![],'body':_0x21639a[_0x3d5f('0x5f')][_0x3d5f('0x5f')],'phone':_0x463e8c,'SmsAccountId':_0x580b44['id'],'UserId':_0x21639a[_0x3d5f('0x5a')]['id'],'ContactId':_0x49ec14['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x3d5f('0x1c')](function(_0x4ce320){return[_0x4ce320,!![]];});});}})['spread'](function(_0x331ea5,_0x5596d6){if(_0x5596d6){return _0x331ea5;}return db[_0x3d5f('0xa4')][_0x3d5f('0x57')](_[_0x3d5f('0x55')](_0x21639a[_0x3d5f('0x5f')],{'read':![],'body':_0x21639a[_0x3d5f('0x5f')][_0x3d5f('0x5f')],'phone':_0x463e8c,'SmsAccountId':_0x580b44['id'],'SmsInteractionId':_0x331ea5['id'],'UserId':_0x21639a['user']['id'],'ContactId':_0x49ec14['id']}))[_0x3d5f('0x1c')](function(_0x1388f0){_0x331ea5[_0x3d5f('0xcc')][_0x3d5f('0xcd')]=[];_0x331ea5['dataValues'][_0x3d5f('0xcd')][_0x3d5f('0xa1')](_0x1388f0[_0x3d5f('0xcc')]);return _0x331ea5;});})[_0x3d5f('0x1c')](respondWithResult(_0x4a3cd2,null))['catch'](handleError(_0x4a3cd2,null));};exports[_0x3d5f('0x26')]=function(_0x14b4c7,_0x451b3c,_0x2f930c){if(_0x14b4c7[_0x3d5f('0x5f')]['id']){delete _0x14b4c7[_0x3d5f('0x5f')]['id'];}var _0x3b4d73,_0x3d3cd8,_0x40ce9d;return db[_0x3d5f('0x3c')][_0x3d5f('0x56')]({'where':{'id':_0x14b4c7[_0x3d5f('0x6b')]['id']}})[_0x3d5f('0x1c')](handleEntityNotFound(_0x451b3c,null))['then'](function(_0x4f6dd0){if(_0x4f6dd0){_0x40ce9d=_0x4f6dd0;logger[_0x3d5f('0xb1')](_0x3d5f('0x1f'),_0x3d5f('0x26'),_0x3d5f('0xce'),_0x4f6dd0['type'],util[_0x3d5f('0xcf')](_0x14b4c7[_0x3d5f('0x5f')],{'showHidden':![],'depth':null}));switch(_0x4f6dd0[_0x3d5f('0x3f')]){case'skebby':if(_0x14b4c7[_0x3d5f('0x5f')][_0x3d5f('0xd0')]&&_0x14b4c7[_0x3d5f('0x5f')][_0x3d5f('0x26')]){_0x3d3cd8=_0x14b4c7['body'][_0x3d5f('0x26')];return db[_0x3d5f('0xa4')]['find']({'where':{'messageId':_0x14b4c7[_0x3d5f('0x5f')]['skebby_dispatch_id']}});}break;case _0x3d5f('0x84'):if(_0x14b4c7[_0x3d5f('0x5f')][_0x3d5f('0xd1')]&&_0x14b4c7['body'][_0x3d5f('0xd2')]){_0x3d3cd8=_0x14b4c7[_0x3d5f('0x5f')][_0x3d5f('0xd2')];return db[_0x3d5f('0xa4')][_0x3d5f('0x56')]({'where':{'messageId':_0x14b4c7[_0x3d5f('0x5f')][_0x3d5f('0xd1')]}});}break;case _0x3d5f('0xd3'):if(_0x14b4c7[_0x3d5f('0x5f')][_0x3d5f('0x86')]&&_0x14b4c7[_0x3d5f('0x5f')][_0x3d5f('0xd4')]){_0x3d3cd8=_0x14b4c7[_0x3d5f('0x5f')]['status_code'];return db[_0x3d5f('0xa4')][_0x3d5f('0x56')]({'where':{'messageId':_0x14b4c7[_0x3d5f('0x5f')]['message_id']}});}break;case'infobip':var _0x46802f=_0x14b4c7[_0x3d5f('0x5f')][_0x3d5f('0x8a')][0x0];if(_0x46802f['messageId']&&_0x46802f[_0x3d5f('0x26')][_0x3d5f('0xd5')]===_0x3d5f('0xd6')){_0x3d3cd8=_0x46802f[_0x3d5f('0x26')][_0x3d5f('0xd5')];return db[_0x3d5f('0xa4')][_0x3d5f('0x56')]({'where':{'messageId':_0x46802f[_0x3d5f('0x85')]}});}break;case'clickatell':if(_0x14b4c7[_0x3d5f('0x5f')][_0x3d5f('0x85')]&&_0x14b4c7['body']['status']){_0x3d3cd8=_0x14b4c7[_0x3d5f('0x5f')][_0x3d5f('0x26')];return db[_0x3d5f('0xa4')][_0x3d5f('0x56')]({'where':{'messageId':_0x14b4c7[_0x3d5f('0x5f')][_0x3d5f('0x85')]}});}break;case _0x3d5f('0xd7'):if(_0x14b4c7[_0x3d5f('0x5f')][0x0][_0x3d5f('0x22')]['id']){_0x3d3cd8=_0x14b4c7[_0x3d5f('0x5f')][0x0][_0x3d5f('0x3f')];return db['SmsMessage'][_0x3d5f('0x56')]({'where':{'messageId':_0x14b4c7[_0x3d5f('0x5f')][0x0][_0x3d5f('0x22')]['id']}});}break;case _0x3d5f('0x91'):if(_0x14b4c7[_0x3d5f('0x5f')][_0x3d5f('0xd8')]&&_0x14b4c7[_0x3d5f('0x5f')]['status']){_0x3d3cd8=_0x14b4c7[_0x3d5f('0x5f')]['status'];return db[_0x3d5f('0xa4')][_0x3d5f('0x56')]({'where':{'messageId':_0x14b4c7[_0x3d5f('0x5f')][_0x3d5f('0xd8')]}});}break;}}})[_0x3d5f('0x1c')](handleEntityNotFound(_0x451b3c,null))['then'](function(_0x32e7ac){if(_0x32e7ac){_0x3b4d73=_0x32e7ac;switch(_0x40ce9d[_0x3d5f('0x3f')]){case _0x3d5f('0x83'):if(_0x3d3cd8===_0x3d5f('0xd6')){return _0x3b4d73['update']({'read':!![]});}else{logger['error'](_0x3d5f('0x1f'),'status',_0x3d5f('0x83'),util[_0x3d5f('0xcf')](_0x14b4c7['body'],{'showHidden':![],'depth':null}));}break;case _0x3d5f('0x84'):if(_0x3d3cd8==='1'){return _0x3b4d73[_0x3d5f('0x32')]({'read':!![]});}else{logger[_0x3d5f('0x20')](_0x3d5f('0x1f'),_0x3d5f('0x26'),_0x3d5f('0x83'),util[_0x3d5f('0xcf')](_0x14b4c7[_0x3d5f('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x3d5f('0xd3'):if(!_0x14b4c7[_0x3d5f('0x5f')][_0x3d5f('0xd9')]&&_0x3d3cd8>=0xc8&&_0x3d3cd8<=0xce){return _0x3b4d73['update']({'read':!![]});}else{logger[_0x3d5f('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3d5f('0x26'),'clicksend',util[_0x3d5f('0xcf')](_0x14b4c7[_0x3d5f('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x3d5f('0xda'):var _0x43101a=_0x14b4c7[_0x3d5f('0x5f')][_0x3d5f('0x8a')][0x0];if(_0x43101a[_0x3d5f('0x26')][_0x3d5f('0xd5')]===_0x3d5f('0xd6')){return _0x3b4d73[_0x3d5f('0x32')]({'read':!![]});}else{logger[_0x3d5f('0x20')](_0x3d5f('0x1f'),_0x3d5f('0x26'),'infobip',util['inspect'](_0x14b4c7[_0x3d5f('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x3d5f('0x8e'):if(_0x3d3cd8==_0x3d5f('0xdb')||_0x3d3cd8==_0x3d5f('0xdc')){return _0x3b4d73[_0x3d5f('0x32')]({'read':!![]});}else{logger[_0x3d5f('0x20')](_0x3d5f('0x1f'),_0x3d5f('0x26'),_0x3d5f('0x8e'),util[_0x3d5f('0xcf')](_0x14b4c7[_0x3d5f('0x5f')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x3d3cd8==_0x3d5f('0xdd')){return _0x3b4d73[_0x3d5f('0x32')]({'read':!![]});}else{logger[_0x3d5f('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3d5f('0x26'),_0x3d5f('0xd7'),util[_0x3d5f('0xcf')](_0x14b4c7[_0x3d5f('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x3d5f('0x91'):if(_0x3d3cd8===_0x3d5f('0xde')||_0x3d3cd8===_0x3d5f('0xdf')){return _0x3b4d73['update']({'read':!![]});}else{logger[_0x3d5f('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3d5f('0x26'),'intelepeer',util[_0x3d5f('0xcf')](_0x14b4c7['body'],{'showHidden':![],'depth':null}));}break;}return _0x3b4d73;}})[_0x3d5f('0x1c')](respondWithResult(_0x451b3c,null))[_0x3d5f('0x52')](handleError(_0x451b3c,null));};exports[_0x3d5f('0xe0')]=function(_0x30e16c,_0x4d1e6c,_0x8227ef){var _0x25fe64,_0xab4c,_0x3c3abf;return db['SmsAccount'][_0x3d5f('0x56')]({'where':{'id':_0x30e16c[_0x3d5f('0x6b')]['id']}})[_0x3d5f('0x1c')](handleEntityNotFound(_0x4d1e6c,null))['then'](function(_0x1f24b6){if(_0x1f24b6){_0x3c3abf=_0x1f24b6;logger['debug'](_0x3d5f('0x1f'),'status',_0x3d5f('0xce'),_0x1f24b6[_0x3d5f('0x3f')],util[_0x3d5f('0xcf')](_0x30e16c[_0x3d5f('0x42')],{'showHidden':![],'depth':null}));switch(_0x1f24b6[_0x3d5f('0x3f')]){case'csc':if(_0x30e16c[_0x3d5f('0x42')][_0x3d5f('0xe1')]&&_0x30e16c[_0x3d5f('0x42')][_0x3d5f('0xe2')]){_0xab4c=_0x30e16c[_0x3d5f('0x42')]['state'];return db[_0x3d5f('0xa4')][_0x3d5f('0x56')]({'where':{'messageId':_0x30e16c['query']['message-id']}});}break;}}})[_0x3d5f('0x1c')](handleEntityNotFound(_0x4d1e6c,null))[_0x3d5f('0x1c')](function(_0x477fe4){if(_0x477fe4){_0x25fe64=_0x477fe4;switch(_0x3c3abf[_0x3d5f('0x3f')]){case'csc':if(_0xab4c==='2'||_0xab4c==='6'){return _0x25fe64[_0x3d5f('0x32')]({'read':!![]});}else{logger['error'](_0x3d5f('0x1f'),_0x3d5f('0x26'),'csc',util[_0x3d5f('0xcf')](_0x30e16c[_0x3d5f('0x42')],{'showHidden':![],'depth':null}));};break;}return _0x25fe64;}})[_0x3d5f('0x1c')](respondWithResult(_0x4d1e6c,null))[_0x3d5f('0x52')](handleError(_0x4d1e6c,null));};exports[_0x3d5f('0xe3')]=function(_0x1c6c57,_0x5d4294,_0x470308){return db[_0x3d5f('0x3c')][_0x3d5f('0x56')]({'where':{'id':_0x1c6c57['params']['id']}})[_0x3d5f('0x1c')](handleEntityNotFound(_0x5d4294,null))[_0x3d5f('0x1c')](function(_0x5315dc){if(_0x5315dc){return _0x5315dc['addAgents'](_0x1c6c57[_0x3d5f('0x5f')][_0x3d5f('0x69')],_['omit'](_0x1c6c57[_0x3d5f('0x5f')],[_0x3d5f('0x69'),'id'])||{})[_0x3d5f('0x9d')](function(_0x376505){for(var _0x394c54=0x0;_0x394c54<_0x1c6c57[_0x3d5f('0x5f')][_0x3d5f('0x69')][_0x3d5f('0x48')];_0x394c54+=0x1){socket[_0x3d5f('0xe4')](_0x3d5f('0xe5'),{'UserId':Number(_0x1c6c57[_0x3d5f('0x5f')][_0x3d5f('0x69')][_0x394c54]),'SmsAccountId':Number(_0x1c6c57[_0x3d5f('0x6b')]['id'])});}return _0x376505;});}})[_0x3d5f('0x1c')](respondWithResult(_0x5d4294,null))[_0x3d5f('0x52')](handleError(_0x5d4294,null));};exports[_0x3d5f('0xe6')]=function(_0x50dd68,_0x12950e,_0x2a955a){return db[_0x3d5f('0x3c')][_0x3d5f('0x56')]({'where':{'id':_0x50dd68[_0x3d5f('0x6b')]['id']}})[_0x3d5f('0x1c')](handleEntityNotFound(_0x12950e,null))['then'](function(_0x96b30){if(_0x96b30){return _0x96b30[_0x3d5f('0xe6')](_0x50dd68[_0x3d5f('0x42')][_0x3d5f('0x69')])[_0x3d5f('0x1c')](function(){if(_[_0x3d5f('0xe7')](_0x50dd68[_0x3d5f('0x42')]['ids'])){for(var _0x4dd456=0x0;_0x4dd456<_0x50dd68['query'][_0x3d5f('0x69')]['length'];_0x4dd456+=0x1){socket[_0x3d5f('0xe4')]('userSmsAccount:remove',{'UserId':Number(_0x50dd68[_0x3d5f('0x42')][_0x3d5f('0x69')][_0x4dd456]),'SmsAccountId':Number(_0x50dd68['params']['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x50dd68[_0x3d5f('0x42')][_0x3d5f('0x69')]),'SmsAccountId':Number(_0x50dd68[_0x3d5f('0x6b')]['id'])});}});}})[_0x3d5f('0x1c')](respondWithStatusCode(_0x12950e,null))['catch'](handleError(_0x12950e,null));};exports[_0x3d5f('0xe8')]=function(_0x3fd22a,_0x515d2a,_0x7364b0){var _0x5a375f={};var _0x11d0d1={};var _0x2d15b2;var _0x1e2377;return db[_0x3d5f('0x3c')][_0x3d5f('0x65')]({'where':{'id':_0x3fd22a[_0x3d5f('0x6b')]['id']}})[_0x3d5f('0x1c')](handleEntityNotFound(_0x515d2a,null))[_0x3d5f('0x1c')](function(_0xfcb178){if(_0xfcb178){_0x2d15b2=_0xfcb178;_0x11d0d1[_0x3d5f('0x41')]=_[_0x3d5f('0x43')](db['User'][_0x3d5f('0x3d')]);_0x11d0d1[_0x3d5f('0x42')]=_[_0x3d5f('0x43')](_0x3fd22a[_0x3d5f('0x42')]);_0x11d0d1[_0x3d5f('0x44')]=_[_0x3d5f('0x45')](_0x11d0d1[_0x3d5f('0x41')],_0x11d0d1[_0x3d5f('0x42')]);_0x5a375f[_0x3d5f('0x46')]=_[_0x3d5f('0x45')](_0x11d0d1[_0x3d5f('0x41')],qs[_0x3d5f('0x47')](_0x3fd22a[_0x3d5f('0x42')]['fields']));_0x5a375f[_0x3d5f('0x46')]=_0x5a375f[_0x3d5f('0x46')][_0x3d5f('0x48')]?_0x5a375f[_0x3d5f('0x46')]:_0x11d0d1[_0x3d5f('0x41')];_0x5a375f['order']=qs[_0x3d5f('0x4b')](_0x3fd22a[_0x3d5f('0x42')]['sort']);_0x5a375f[_0x3d5f('0x4e')]=qs[_0x3d5f('0x44')](_[_0x3d5f('0x4c')](_0x3fd22a[_0x3d5f('0x42')],_0x11d0d1[_0x3d5f('0x44')]));if(_0x3fd22a['query'][_0x3d5f('0x4d')]){_0x5a375f['where']=_[_0x3d5f('0x55')](_0x5a375f[_0x3d5f('0x4e')],{'$or':_['map'](_0x5a375f[_0x3d5f('0x46')],function(_0x307452){var _0x45dced={};_0x45dced[_0x307452]={'$like':'%'+_0x3fd22a[_0x3d5f('0x42')][_0x3d5f('0x4d')]+'%'};return _0x45dced;})});}_0x5a375f=_[_0x3d5f('0x55')]({},_0x5a375f,_0x3fd22a[_0x3d5f('0x50')]);return _0x2d15b2[_0x3d5f('0xe8')](_0x5a375f);}})[_0x3d5f('0x1c')](function(_0x3abbe8){if(_0x3abbe8){_0x1e2377=_0x3abbe8[_0x3d5f('0x48')];if(!_0x3fd22a['query'][_0x3d5f('0x49')](_0x3d5f('0x66'))){_0x5a375f[_0x3d5f('0x2a')]=qs[_0x3d5f('0x2a')](_0x3fd22a[_0x3d5f('0x42')]['limit']);_0x5a375f[_0x3d5f('0x2c')]=qs[_0x3d5f('0x2c')](_0x3fd22a['query']['offset']);}return _0x2d15b2[_0x3d5f('0xe8')](_0x5a375f);}})[_0x3d5f('0x1c')](function(_0x250622){if(_0x250622){return _0x250622?{'count':_0x1e2377,'rows':_0x250622}:null;}})[_0x3d5f('0x1c')](respondWithResult(_0x515d2a,null))[_0x3d5f('0x52')](handleError(_0x515d2a,null));}; \ No newline at end of file +var _0xca28=['mustache','util','to-csv','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','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','request','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','info','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','SmsAccounts','end','stack','name','send','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','map','VIRTUAL','includeAll','include','rows','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','options','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','order','findAll','removeAnswers','sms','SmsApplication','Applications','account','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','omit','contact','SmsInteraction','spread','interaction','created','autoclose','applications','close','*,*,*,*','SmsMessage','ContactId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','text/xml','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','ListId','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','groupName','redif','error_code','DELIVERED','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','moment'];(function(_0x3ca5a5,_0x1e0f40){var _0x27021d=function(_0x496778){while(--_0x496778){_0x3ca5a5['push'](_0x3ca5a5['shift']());}};_0x27021d(++_0x1e0f40);}(_0xca28,0xe8));var _0x8ca2=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xca28[_0x1694f5];return _0x5b4321;};'use strict';var emlformat=require(_0x8ca2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ca2('0x1'));var jsonpatch=require(_0x8ca2('0x2'));var rp=require('request-promise');var moment=require(_0x8ca2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8ca2('0x4'));var util=require(_0x8ca2('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8ca2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8ca2('0x7'));var crypto=require(_0x8ca2('0x8'));var jsforce=require(_0x8ca2('0x9'));var deskjs=require(_0x8ca2('0xa'));var toCsv=require(_0x8ca2('0x6'));var querystring=require(_0x8ca2('0xb'));var Papa=require(_0x8ca2('0xc'));var Redis=require(_0x8ca2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x8ca2('0xe'));var as=require(_0x8ca2('0xf'));var hardwareService=require(_0x8ca2('0x10'));var logger=require(_0x8ca2('0x11'))('api');var utils=require(_0x8ca2('0x12'));var config=require(_0x8ca2('0x13'));var licenseUtil=require(_0x8ca2('0x14'));var db=require(_0x8ca2('0x15'))['db'];config[_0x8ca2('0x16')]=_[_0x8ca2('0x17')](config[_0x8ca2('0x16')],{'host':_0x8ca2('0x18'),'port':0x18eb});var socket=require(_0x8ca2('0x19'))(new Redis(config[_0x8ca2('0x16')]));require(_0x8ca2('0x1a'))[_0x8ca2('0x1b')](socket);var jayson=require(_0x8ca2('0x1c'));var client=jayson[_0x8ca2('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x425aa8,_0x4af740,_0x1e462d,_0x1fda32){return new BPromise(function(_0x564d12,_0x46b98d){var _0x12846b=_0x1fda32||client;return _0x12846b[_0x8ca2('0x1e')](_0x425aa8,_0x1e462d)['then'](function(_0x1d4d0e){logger['info']('SmsAccount,\x20%s,\x20%s',_0x4af740,_0x8ca2('0x1f'));logger[_0x8ca2('0x20')](_0x8ca2('0x21'),_0x4af740,_0x8ca2('0x1f'),JSON[_0x8ca2('0x22')](_0x1d4d0e));if(_0x1d4d0e[_0x8ca2('0x23')]){if(_0x1d4d0e['error'][_0x8ca2('0x24')]===0x1f4){logger[_0x8ca2('0x23')]('SmsAccount,\x20%s,\x20%s',_0x4af740,_0x1d4d0e['error'][_0x8ca2('0x25')]);return _0x46b98d(_0x1d4d0e[_0x8ca2('0x23')][_0x8ca2('0x25')]);}logger['error'](_0x8ca2('0x26'),_0x4af740,_0x1d4d0e['error']['message']);return _0x564d12(_0x1d4d0e[_0x8ca2('0x23')][_0x8ca2('0x25')]);}else{logger[_0x8ca2('0x27')]('SmsAccount,\x20%s,\x20%s',_0x4af740,_0x8ca2('0x1f'));_0x564d12(_0x1d4d0e[_0x8ca2('0x28')]['message']);}})[_0x8ca2('0x29')](function(_0x303ea7){logger[_0x8ca2('0x23')]('SmsAccount,\x20%s,\x20%s',_0x4af740,_0x303ea7);_0x46b98d(_0x303ea7);});});}function respondWithStatusCode(_0x14d3dd,_0x423901){_0x423901=_0x423901||0xcc;return function(_0xa66079){if(_0xa66079){return _0x14d3dd[_0x8ca2('0x2a')](_0x423901);}return _0x14d3dd[_0x8ca2('0x2b')](_0x423901)['end']();};}function respondWithResult(_0x38ff17,_0x48f13c){_0x48f13c=_0x48f13c||0xc8;return function(_0x25368b){if(_0x25368b){return _0x38ff17[_0x8ca2('0x2b')](_0x48f13c)[_0x8ca2('0x2c')](_0x25368b);}};}function respondWithFilteredResult(_0x1d38ef,_0x188d38){return function(_0x2e29f2){if(_0x2e29f2){var _0x238692=typeof _0x188d38['offset']==='undefined'&&typeof _0x188d38['limit']===_0x8ca2('0x2d');var _0x1712de=_0x2e29f2[_0x8ca2('0x2e')];var _0x738c35=_0x238692?0x0:_0x188d38[_0x8ca2('0x2f')];var _0x494ec9=_0x238692?_0x2e29f2[_0x8ca2('0x2e')]:_0x188d38['offset']+_0x188d38[_0x8ca2('0x30')];var _0x1ba627;if(_0x494ec9>=_0x1712de){_0x494ec9=_0x1712de;_0x1ba627=0xc8;}else{_0x1ba627=0xce;}_0x1d38ef[_0x8ca2('0x2b')](_0x1ba627);return _0x1d38ef[_0x8ca2('0x31')](_0x8ca2('0x32'),_0x738c35+'-'+_0x494ec9+'/'+_0x1712de)['json'](_0x2e29f2);}return null;};}function patchUpdates(_0x475a00){return function(_0x1b6221){try{jsonpatch[_0x8ca2('0x33')](_0x1b6221,_0x475a00,!![]);}catch(_0x158d5d){return BPromise[_0x8ca2('0x34')](_0x158d5d);}return _0x1b6221[_0x8ca2('0x35')]();};}function saveUpdates(_0x1fc1b4,_0x118f59){return function(_0x7a2068){if(_0x7a2068){return _0x7a2068[_0x8ca2('0x36')](_0x1fc1b4)[_0x8ca2('0x37')](function(_0x2ce7d6){return _0x2ce7d6;});}return null;};}function removeEntity(_0x2ad4c8,_0x6b9e7b){return function(_0x2d574d){if(_0x2d574d){return _0x2d574d[_0x8ca2('0x38')]()[_0x8ca2('0x37')](function(){var _0x18a2f3=_0x2d574d['get']({'plain':!![]});var _0x3e98dc=_0x8ca2('0x39');return db['UserProfileResource'][_0x8ca2('0x38')]({'where':{'type':_0x3e98dc,'resourceId':_0x18a2f3['id']}})[_0x8ca2('0x37')](function(){return _0x2d574d;});})[_0x8ca2('0x37')](function(){_0x2ad4c8['status'](0xcc)[_0x8ca2('0x3a')]();});}};}function handleEntityNotFound(_0x3f8887,_0x4d7a12){return function(_0x524ee4){if(!_0x524ee4){_0x3f8887[_0x8ca2('0x2a')](0x194);}return _0x524ee4;};}function handleError(_0x5de5fc,_0x229f15){_0x229f15=_0x229f15||0x1f4;return function(_0x5098dd){logger[_0x8ca2('0x23')](_0x5098dd[_0x8ca2('0x3b')]);if(_0x5098dd[_0x8ca2('0x3c')]){delete _0x5098dd[_0x8ca2('0x3c')];}_0x5de5fc[_0x8ca2('0x2b')](_0x229f15)[_0x8ca2('0x3d')](_0x5098dd);};}exports['index']=function(_0x438720,_0x539439){var _0x1d849d={'include':[{'model':db[_0x8ca2('0x3e')],'as':_0x8ca2('0x3f')}]},_0x1d7d8e={},_0x265b99={'count':0x0,'rows':[]};var _0x29e987=_['map'](db[_0x8ca2('0x40')][_0x8ca2('0x41')],function(_0x92d983){return{'name':_0x92d983[_0x8ca2('0x42')],'type':_0x92d983[_0x8ca2('0x43')][_0x8ca2('0x44')]};});_0x1d7d8e[_0x8ca2('0x45')]=_['map'](_0x29e987,'name');_0x1d7d8e['query']=_[_0x8ca2('0x46')](_0x438720[_0x8ca2('0x47')]);_0x1d7d8e['filters']=_[_0x8ca2('0x48')](_0x1d7d8e[_0x8ca2('0x45')],_0x1d7d8e[_0x8ca2('0x47')]);_0x1d849d[_0x8ca2('0x49')]=_[_0x8ca2('0x48')](_0x1d7d8e[_0x8ca2('0x45')],qs[_0x8ca2('0x4a')](_0x438720[_0x8ca2('0x47')][_0x8ca2('0x4a')]));_0x1d849d[_0x8ca2('0x49')]=_0x1d849d[_0x8ca2('0x49')][_0x8ca2('0x4b')]?_0x1d849d['attributes']:_0x1d7d8e['model'];if(!_0x438720['query'][_0x8ca2('0x4c')]('nolimit')){_0x1d849d[_0x8ca2('0x30')]=qs[_0x8ca2('0x30')](_0x438720[_0x8ca2('0x47')][_0x8ca2('0x30')]);_0x1d849d[_0x8ca2('0x2f')]=qs['offset'](_0x438720['query'][_0x8ca2('0x2f')]);}_0x1d849d['order']=qs[_0x8ca2('0x4d')](_0x438720[_0x8ca2('0x47')]['sort']);_0x1d849d[_0x8ca2('0x4e')]=qs[_0x8ca2('0x4f')](_[_0x8ca2('0x50')](_0x438720[_0x8ca2('0x47')],_0x1d7d8e[_0x8ca2('0x4f')]),_0x29e987);if(_0x438720[_0x8ca2('0x47')][_0x8ca2('0x51')]){_0x1d849d[_0x8ca2('0x4e')]=_[_0x8ca2('0x52')](_0x1d849d[_0x8ca2('0x4e')],{'$or':_[_0x8ca2('0x53')](_0x29e987,function(_0x439d4f){if(_0x439d4f[_0x8ca2('0x43')]!==_0x8ca2('0x54')){var _0x572550={};_0x572550[_0x439d4f[_0x8ca2('0x3c')]]={'$like':'%'+_0x438720[_0x8ca2('0x47')][_0x8ca2('0x51')]+'%'};return _0x572550;}})});}_0x1d849d=_[_0x8ca2('0x52')]({},_0x1d849d,_0x438720['options']);var _0x444fba={'where':_0x1d849d['where']};return db[_0x8ca2('0x40')][_0x8ca2('0x2e')](_0x444fba)[_0x8ca2('0x37')](function(_0x316bc8){_0x265b99[_0x8ca2('0x2e')]=_0x316bc8;if(_0x438720['query'][_0x8ca2('0x55')]){_0x1d849d[_0x8ca2('0x56')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x1d849d);})['then'](function(_0x52a8d2){_0x265b99[_0x8ca2('0x57')]=_0x52a8d2;return _0x265b99;})[_0x8ca2('0x37')](respondWithFilteredResult(_0x539439,_0x1d849d))[_0x8ca2('0x29')](handleError(_0x539439,null));};exports[_0x8ca2('0x58')]=function(_0x1db00b,_0x11a9aa){var _0x129191={'raw':![],'where':{'id':_0x1db00b[_0x8ca2('0x59')]['id']},'include':[{'model':db[_0x8ca2('0x3e')],'as':'mandatoryDispositionPause'}]},_0x5202fd={};_0x5202fd[_0x8ca2('0x45')]=_[_0x8ca2('0x46')](db[_0x8ca2('0x40')][_0x8ca2('0x41')]);_0x5202fd['query']=_[_0x8ca2('0x46')](_0x1db00b[_0x8ca2('0x47')]);_0x5202fd['filters']=_['intersection'](_0x5202fd[_0x8ca2('0x45')],_0x5202fd[_0x8ca2('0x47')]);_0x129191[_0x8ca2('0x49')]=_[_0x8ca2('0x48')](_0x5202fd[_0x8ca2('0x45')],qs[_0x8ca2('0x4a')](_0x1db00b[_0x8ca2('0x47')]['fields']));_0x129191[_0x8ca2('0x49')]=_0x129191[_0x8ca2('0x49')][_0x8ca2('0x4b')]?_0x129191[_0x8ca2('0x49')]:_0x5202fd[_0x8ca2('0x45')];if(_0x1db00b[_0x8ca2('0x47')][_0x8ca2('0x55')]){_0x129191[_0x8ca2('0x56')]=[{'all':!![]}];}_0x129191=_[_0x8ca2('0x52')]({},_0x129191,_0x1db00b['options']);return db[_0x8ca2('0x40')]['find'](_0x129191)[_0x8ca2('0x37')](handleEntityNotFound(_0x11a9aa,null))[_0x8ca2('0x37')](respondWithResult(_0x11a9aa,null))[_0x8ca2('0x29')](handleError(_0x11a9aa,null));};exports[_0x8ca2('0x5a')]=function(_0x5395c8,_0x30448a){return db[_0x8ca2('0x40')][_0x8ca2('0x5a')](_0x5395c8[_0x8ca2('0x5b')],{})[_0x8ca2('0x37')](function(_0x3f64d4){var _0x1f778e=_0x5395c8[_0x8ca2('0x5c')]['get']({'plain':!![]});if(!_0x1f778e)throw new Error(_0x8ca2('0x5d'));if(_0x1f778e[_0x8ca2('0x5e')]==='user'){var _0x3a64c4=_0x3f64d4[_0x8ca2('0x5f')]({'plain':!![]});var _0x23a89a=_0x8ca2('0x39');return db['UserProfileSection'][_0x8ca2('0x60')]({'where':{'name':_0x23a89a,'userProfileId':_0x1f778e[_0x8ca2('0x61')]},'raw':!![]})[_0x8ca2('0x37')](function(_0x58fda9){if(_0x58fda9&&_0x58fda9[_0x8ca2('0x62')]===0x0){return db[_0x8ca2('0x63')][_0x8ca2('0x5a')]({'name':_0x3a64c4[_0x8ca2('0x3c')],'resourceId':_0x3a64c4['id'],'type':_0x58fda9['name'],'sectionId':_0x58fda9['id']},{})[_0x8ca2('0x37')](function(){return _0x3f64d4;});}else{return _0x3f64d4;}})['catch'](function(_0x3cb99e){logger['error'](_0x8ca2('0x64'),_0x3cb99e);throw _0x3cb99e;});}return _0x3f64d4;})[_0x8ca2('0x37')](respondWithResult(_0x30448a,0xc9))[_0x8ca2('0x29')](handleError(_0x30448a,null));};exports[_0x8ca2('0x36')]=function(_0x2497d8,_0x311f9c){if(_0x2497d8[_0x8ca2('0x5b')]['id']){delete _0x2497d8[_0x8ca2('0x5b')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x2497d8['params']['id']},'include':[{'model':db[_0x8ca2('0x3e')],'as':'mandatoryDispositionPause'}]})[_0x8ca2('0x37')](handleEntityNotFound(_0x311f9c,null))[_0x8ca2('0x37')](saveUpdates(_0x2497d8[_0x8ca2('0x5b')],null))[_0x8ca2('0x37')](respondWithResult(_0x311f9c,null))[_0x8ca2('0x29')](handleError(_0x311f9c,null));};exports['destroy']=function(_0xad63e5,_0x4790e2){return db[_0x8ca2('0x40')]['find']({'where':{'id':_0xad63e5[_0x8ca2('0x59')]['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x4790e2,null))[_0x8ca2('0x37')](removeEntity(_0x4790e2,null))[_0x8ca2('0x29')](handleError(_0x4790e2,null));};exports['describe']=function(_0x2d7f9d,_0x265de9){return db[_0x8ca2('0x40')][_0x8ca2('0x65')]()[_0x8ca2('0x37')](respondWithResult(_0x265de9,null))[_0x8ca2('0x29')](handleError(_0x265de9,null));};exports[_0x8ca2('0x66')]=function(_0x29102a,_0x40dbe1,_0x4f6f57){if(_0x29102a[_0x8ca2('0x5b')]['id']){delete _0x29102a[_0x8ca2('0x5b')]['id'];}return db[_0x8ca2('0x40')][_0x8ca2('0x60')]({'where':{'id':_0x29102a[_0x8ca2('0x59')]['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x40dbe1,null))[_0x8ca2('0x37')](function(_0x35b8fd){if(_0x35b8fd){_0x29102a[_0x8ca2('0x5b')][_0x8ca2('0x67')]=_0x35b8fd['id'];return db[_0x8ca2('0x68')][_0x8ca2('0x5a')](_0x29102a[_0x8ca2('0x5b')]);}})[_0x8ca2('0x37')](respondWithResult(_0x40dbe1,null))[_0x8ca2('0x29')](handleError(_0x40dbe1,null));};exports[_0x8ca2('0x69')]=function(_0x115982,_0x2bd766,_0x209e37){var _0x5964f4={'raw':![],'where':{}};var _0xe6034b={};var _0x2fc7c4={'count':0x0,'rows':[]};return db[_0x8ca2('0x40')][_0x8ca2('0x6a')]({'where':{'id':_0x115982[_0x8ca2('0x59')]['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x2bd766,null))['then'](function(_0x3f2bd7){if(_0x3f2bd7){_0xe6034b[_0x8ca2('0x45')]=_[_0x8ca2('0x46')](db[_0x8ca2('0x68')][_0x8ca2('0x41')]);_0xe6034b[_0x8ca2('0x47')]=_['keys'](_0x115982[_0x8ca2('0x47')]);_0xe6034b[_0x8ca2('0x4f')]=_[_0x8ca2('0x48')](_0xe6034b[_0x8ca2('0x45')],_0xe6034b[_0x8ca2('0x47')]);_0x5964f4[_0x8ca2('0x49')]=_[_0x8ca2('0x48')](_0xe6034b['model'],qs[_0x8ca2('0x4a')](_0x115982['query'][_0x8ca2('0x4a')]));_0x5964f4['attributes']=_0x5964f4['attributes']['length']?_0x5964f4['attributes']:_0xe6034b[_0x8ca2('0x45')];if(!_0x115982[_0x8ca2('0x47')]['hasOwnProperty']('nolimit')){_0x5964f4['limit']=qs[_0x8ca2('0x30')](_0x115982['query'][_0x8ca2('0x30')]);_0x5964f4[_0x8ca2('0x2f')]=qs[_0x8ca2('0x2f')](_0x115982[_0x8ca2('0x47')][_0x8ca2('0x2f')]);}_0x5964f4['order']=qs[_0x8ca2('0x4d')](_0x115982[_0x8ca2('0x47')][_0x8ca2('0x4d')]);_0x5964f4[_0x8ca2('0x4e')]=qs[_0x8ca2('0x4f')](_[_0x8ca2('0x50')](_0x115982[_0x8ca2('0x47')],_0xe6034b[_0x8ca2('0x4f')]));_0x5964f4[_0x8ca2('0x4e')][_0x8ca2('0x67')]=_0x3f2bd7['id'];if(_0x115982['query'][_0x8ca2('0x51')]){_0x5964f4[_0x8ca2('0x4e')]=_[_0x8ca2('0x52')](_0x5964f4[_0x8ca2('0x4e')],{'$or':_['map'](_0x5964f4['attributes'],function(_0x345880){var _0x2444ac={};_0x2444ac[_0x345880]={'$like':'%'+_0x115982['query'][_0x8ca2('0x51')]+'%'};return _0x2444ac;})});}_0x5964f4=_[_0x8ca2('0x52')]({},_0x5964f4,_0x115982[_0x8ca2('0x6b')]);return db[_0x8ca2('0x68')]['count']({'where':_0x5964f4['where']})[_0x8ca2('0x37')](function(_0x4f297d){_0x2fc7c4[_0x8ca2('0x2e')]=_0x4f297d;if(_0x115982[_0x8ca2('0x47')][_0x8ca2('0x55')]){_0x5964f4[_0x8ca2('0x56')]=[{'all':!![]}];}return db[_0x8ca2('0x68')]['findAll'](_0x5964f4);})[_0x8ca2('0x37')](function(_0x5f14ed){_0x2fc7c4[_0x8ca2('0x57')]=_0x5f14ed;return _0x2fc7c4;});}})[_0x8ca2('0x37')](respondWithFilteredResult(_0x2bd766,_0x5964f4))[_0x8ca2('0x29')](handleError(_0x2bd766,null));};exports[_0x8ca2('0x6c')]=function(_0x57cc97,_0x128893,_0x31e70c){return db['SmsAccount'][_0x8ca2('0x60')]({'where':{'id':_0x57cc97['params']['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x128893,null))['then'](function(_0x2ab8ed){if(_0x2ab8ed){return _0x2ab8ed['removeDispositions'](_0x57cc97['query'][_0x8ca2('0x6d')]);}})['then'](respondWithStatusCode(_0x128893,null))[_0x8ca2('0x29')](handleError(_0x128893,null));};exports[_0x8ca2('0x6e')]=function(_0x3e6766,_0x3bbaa8,_0x46e1fc){if(_0x3e6766[_0x8ca2('0x5b')]['id']){delete _0x3e6766['body']['id'];}return db[_0x8ca2('0x40')]['find']({'where':{'id':_0x3e6766[_0x8ca2('0x59')]['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x3bbaa8,null))[_0x8ca2('0x37')](function(_0x25ae23){if(_0x25ae23){_0x3e6766[_0x8ca2('0x5b')][_0x8ca2('0x67')]=_0x25ae23['id'];return db[_0x8ca2('0x6f')][_0x8ca2('0x5a')](_0x3e6766[_0x8ca2('0x5b')]);}})[_0x8ca2('0x37')](respondWithResult(_0x3bbaa8,null))[_0x8ca2('0x29')](handleError(_0x3bbaa8,null));};exports[_0x8ca2('0x70')]=function(_0x266cef,_0x489ebd,_0x4b8fa7){var _0x5cd0d8={'raw':![],'where':{}};var _0x32f2aa={};var _0x159725={'count':0x0,'rows':[]};return db[_0x8ca2('0x40')][_0x8ca2('0x6a')]({'where':{'id':_0x266cef[_0x8ca2('0x59')]['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x489ebd,null))['then'](function(_0x1fc4d6){if(_0x1fc4d6){_0x32f2aa[_0x8ca2('0x45')]=_['keys'](db[_0x8ca2('0x6f')][_0x8ca2('0x41')]);_0x32f2aa['query']=_['keys'](_0x266cef[_0x8ca2('0x47')]);_0x32f2aa[_0x8ca2('0x4f')]=_['intersection'](_0x32f2aa[_0x8ca2('0x45')],_0x32f2aa[_0x8ca2('0x47')]);_0x5cd0d8[_0x8ca2('0x49')]=_['intersection'](_0x32f2aa[_0x8ca2('0x45')],qs[_0x8ca2('0x4a')](_0x266cef[_0x8ca2('0x47')][_0x8ca2('0x4a')]));_0x5cd0d8['attributes']=_0x5cd0d8[_0x8ca2('0x49')][_0x8ca2('0x4b')]?_0x5cd0d8[_0x8ca2('0x49')]:_0x32f2aa[_0x8ca2('0x45')];if(!_0x266cef[_0x8ca2('0x47')][_0x8ca2('0x4c')](_0x8ca2('0x71'))){_0x5cd0d8['limit']=qs['limit'](_0x266cef[_0x8ca2('0x47')][_0x8ca2('0x30')]);_0x5cd0d8['offset']=qs['offset'](_0x266cef[_0x8ca2('0x47')]['offset']);}_0x5cd0d8[_0x8ca2('0x72')]=qs[_0x8ca2('0x4d')](_0x266cef[_0x8ca2('0x47')]['sort']);_0x5cd0d8[_0x8ca2('0x4e')]=qs['filters'](_[_0x8ca2('0x50')](_0x266cef['query'],_0x32f2aa[_0x8ca2('0x4f')]));_0x5cd0d8['where'][_0x8ca2('0x67')]=_0x1fc4d6['id'];if(_0x266cef['query']['filter']){_0x5cd0d8[_0x8ca2('0x4e')]=_[_0x8ca2('0x52')](_0x5cd0d8[_0x8ca2('0x4e')],{'$or':_[_0x8ca2('0x53')](_0x5cd0d8[_0x8ca2('0x49')],function(_0x3de323){var _0x2b4618={};_0x2b4618[_0x3de323]={'$like':'%'+_0x266cef[_0x8ca2('0x47')]['filter']+'%'};return _0x2b4618;})});}_0x5cd0d8=_[_0x8ca2('0x52')]({},_0x5cd0d8,_0x266cef[_0x8ca2('0x6b')]);return db['CannedAnswer'][_0x8ca2('0x2e')]({'where':_0x5cd0d8[_0x8ca2('0x4e')]})[_0x8ca2('0x37')](function(_0x72f57d){_0x159725[_0x8ca2('0x2e')]=_0x72f57d;if(_0x266cef[_0x8ca2('0x47')][_0x8ca2('0x55')]){_0x5cd0d8[_0x8ca2('0x56')]=[{'all':!![]}];}return db[_0x8ca2('0x6f')][_0x8ca2('0x73')](_0x5cd0d8);})[_0x8ca2('0x37')](function(_0xc93d9c){_0x159725[_0x8ca2('0x57')]=_0xc93d9c;return _0x159725;});}})[_0x8ca2('0x37')](respondWithFilteredResult(_0x489ebd,_0x5cd0d8))[_0x8ca2('0x29')](handleError(_0x489ebd,null));};exports['removeAnswers']=function(_0x5ac62c,_0x589680,_0x354998){return db[_0x8ca2('0x40')][_0x8ca2('0x60')]({'where':{'id':_0x5ac62c[_0x8ca2('0x59')]['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x589680,null))[_0x8ca2('0x37')](function(_0x5205e7){if(_0x5205e7){return _0x5205e7[_0x8ca2('0x74')](_0x5ac62c[_0x8ca2('0x47')][_0x8ca2('0x6d')]);}})['then'](respondWithStatusCode(_0x589680,null))[_0x8ca2('0x29')](handleError(_0x589680,null));};exports['notify']=function(_0x110c8b,_0x553a5f,_0x467b7f){var _0x1e7a15={'channel':_0x8ca2('0x75')};var _0x17b46f=[];var _0x49b86b=[];var _0x366bf7={};return db['SmsAccount']['find']({'where':{'id':_0x110c8b[_0x8ca2('0x59')]['id']},'include':[{'model':db[_0x8ca2('0x76')],'as':_0x8ca2('0x77')}]})['then'](handleEntityNotFound(_0x553a5f,null))[_0x8ca2('0x37')](function(_0x2a9494){_0x1e7a15[_0x8ca2('0x78')]=_0x2a9494;_0x1e7a15['applications']=_['orderBy'](_0x2a9494[_0x8ca2('0x77')],[_0x8ca2('0x79')],[_0x8ca2('0x7a')]);if(_0x1e7a15['account'][_0x8ca2('0x77')]){delete _0x1e7a15[_0x8ca2('0x78')][_0x8ca2('0x77')];}return db[_0x8ca2('0x7b')][_0x8ca2('0x65')]();})[_0x8ca2('0x37')](function(_0x52d9fc){if(!_0x52d9fc){throw new db[(_0x8ca2('0x7c'))][(_0x8ca2('0x7d'))](_0x8ca2('0x7e'));}_0x17b46f=_['difference'](_[_0x8ca2('0x46')](_0x52d9fc),[_0x8ca2('0x7f'),_0x8ca2('0x80')]);_0x49b86b=_[_0x8ca2('0x81')](_[_0x8ca2('0x46')](_0x52d9fc),['createdAt',_0x8ca2('0x80'),_0x8ca2('0x82'),'ListId']);_0x1e7a15[_0x8ca2('0x5b')]={'mapKey':'mobile'};if(_0x1e7a15[_0x8ca2('0x78')][_0x8ca2('0x43')]){switch(_0x1e7a15[_0x8ca2('0x78')]['type']){case _0x8ca2('0x83'):_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x84')]=_0x110c8b['body'][_0x8ca2('0x85')];_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x5b')]=_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x86')];_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x87')]=_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x88')];break;case _0x8ca2('0x89'):_0x1e7a15[_0x8ca2('0x5b')]['from']='+'+_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x8a')];_0x1e7a15[_0x8ca2('0x5b')]['body']=_0x110c8b['body'][_0x8ca2('0x8b')];break;case _0x8ca2('0x8c'):_0x1e7a15[_0x8ca2('0x5b')]['from']=_0x110c8b[_0x8ca2('0x5b')]['from'];_0x1e7a15[_0x8ca2('0x5b')]['body']=_0x110c8b[_0x8ca2('0x5b')]['message'];break;case _0x8ca2('0x8d'):_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x84')]=_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x84')];_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x5b')]=_0x110c8b[_0x8ca2('0x5b')]['body'];_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x87')]=_0x110c8b[_0x8ca2('0x5b')]['message_id'];break;case _0x8ca2('0x8e'):_0x1e7a15[_0x8ca2('0x5b')]['from']=_0x110c8b['body'][_0x8ca2('0x85')];_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x5b')]=_0x110c8b['body'][_0x8ca2('0x8f')];_0x1e7a15['body'][_0x8ca2('0x87')]=_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x90')];break;case _0x8ca2('0x91'):_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x84')]='+'+_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x92')][0x0][_0x8ca2('0x84')];_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x5b')]=_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x92')][0x0]['text'];_0x1e7a15[_0x8ca2('0x5b')]['messageId']=_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x92')][0x0][_0x8ca2('0x87')];break;case _0x8ca2('0x93'):_0x1e7a15['body'][_0x8ca2('0x84')]=_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x94')];_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x5b')]=_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x95')][_0x8ca2('0x25')];break;case _0x8ca2('0x96'):_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x84')]=_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x97')];_0x1e7a15['body'][_0x8ca2('0x5b')]=_0x110c8b[_0x8ca2('0x5b')]['text'];_0x1e7a15[_0x8ca2('0x5b')]['messageId']=_0x110c8b[_0x8ca2('0x5b')]['replyMessageId'];break;case _0x8ca2('0x98'):_0x1e7a15['body']['messageId']=_0x110c8b[_0x8ca2('0x5b')][0x0][_0x8ca2('0x25')]['id'];_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x84')]=_0x110c8b['body'][0x0][_0x8ca2('0x25')][_0x8ca2('0x84')];_0x1e7a15[_0x8ca2('0x5b')]['body']=_0x110c8b[_0x8ca2('0x5b')][0x0]['message']['text'];break;case _0x8ca2('0x99'):_0x1e7a15['body'][_0x8ca2('0x84')]=_0x110c8b['body'][_0x8ca2('0x84')];_0x1e7a15[_0x8ca2('0x5b')]['body']=_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x25')];_0x1e7a15['body'][_0x8ca2('0x87')]=_0x110c8b[_0x8ca2('0x5b')][_0x8ca2('0x9a')];break;}}if(_0x1e7a15[_0x8ca2('0x5b')]['id']){delete _0x1e7a15[_0x8ca2('0x5b')]['id'];}if(_[_0x8ca2('0x9b')](_0x1e7a15[_0x8ca2('0x5b')]['from'])){throw new db[(_0x8ca2('0x7c'))][(_0x8ca2('0x7d'))](_0x8ca2('0x9c'));}if(_[_0x8ca2('0x9b')](_0x1e7a15[_0x8ca2('0x5b')]['body'])||_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x5b')]===''){throw new db[(_0x8ca2('0x7c'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x9d')])){throw new db[(_0x8ca2('0x7c'))][(_0x8ca2('0x7d'))](_0x8ca2('0x9e')+_0x49b86b);}if(!_[_0x8ca2('0x9f')](_0x49b86b,_0x1e7a15['body']['mapKey'])){throw new db[(_0x8ca2('0x7c'))][(_0x8ca2('0x7d'))](_0x8ca2('0xa0')+_0x49b86b);}_0x366bf7[_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x9d')]]=_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x84')];return db[_0x8ca2('0xa1')]['find']({'where':{'id':_0x1e7a15[_0x8ca2('0x78')]['ListId']},'include':[{'model':db[_0x8ca2('0x7b')],'as':_0x8ca2('0xa2'),'where':_0x366bf7,'limit':0x1,'order':[[_0x8ca2('0x80'),_0x8ca2('0xa3')]]}]});})[_0x8ca2('0x37')](handleEntityNotFound(_0x553a5f,null))[_0x8ca2('0x37')](function(_0x249937){if(_0x249937){_0x1e7a15['list']=_[_0x8ca2('0xa4')](_0x249937,['Contacts']);if(_0x249937[_0x8ca2('0xa2')]['length']){return _0x249937['Contacts'][0x0];}var _0x4c7d3a=_[_0x8ca2('0x17')](_0x1e7a15[_0x8ca2('0x5b')],{'firstName':_0x1e7a15['body'][_0x8ca2('0x84')],'ListId':_0x249937['id']});_0x4c7d3a[_0x1e7a15[_0x8ca2('0x5b')]['mapKey']]=_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x84')];return db[_0x8ca2('0x7b')]['create'](_0x4c7d3a,{'fields':_0x17b46f,'raw':!![]});}})[_0x8ca2('0x37')](handleEntityNotFound(_0x553a5f,null))[_0x8ca2('0x37')](function(_0x282bf9){if(_0x282bf9){_0x1e7a15[_0x8ca2('0xa5')]=_0x282bf9;var _0x5ad495={'ContactId':_0x282bf9['id'],'phone':_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x84')],'SmsAccountId':_0x110c8b[_0x8ca2('0x59')]['id']};var _0x1f69ad={'ContactId':_0x282bf9['id'],'SmsAccountId':_0x110c8b[_0x8ca2('0x59')]['id'],'closed':![]};return db[_0x8ca2('0xa6')][_0x8ca2('0x60')]({'where':_0x1f69ad})[_0x8ca2('0x37')](function(_0x2aae8b){if(_0x2aae8b){return[_0x2aae8b,![]];}return db[_0x8ca2('0xa6')][_0x8ca2('0x5a')](_0x5ad495)[_0x8ca2('0x37')](function(_0x1cfaa3){return[_0x1cfaa3,!![]];});});}})[_0x8ca2('0xa7')](function(_0x186eff,_0x474933){_0x1e7a15[_0x8ca2('0xa8')]=_0x186eff['get']({'plain':!![]});_0x1e7a15[_0x8ca2('0xa8')][_0x8ca2('0xa9')]=![];if(_0x474933){if(_0x1e7a15[_0x8ca2('0x78')][_0x8ca2('0xaa')]){_0x1e7a15[_0x8ca2('0xab')]['push']({'id':0x0,'priority':_0x1e7a15[_0x8ca2('0xab')][_0x8ca2('0x4b')]+0x1,'app':_0x8ca2('0xac'),'appdata':'unmanaged','interval':_0x8ca2('0xad')});}_0x1e7a15[_0x8ca2('0xa8')][_0x8ca2('0xa9')]=!![];}return db[_0x8ca2('0xae')]['create']({'phone':_0x1e7a15['body']['from'],'messageId':_0x1e7a15[_0x8ca2('0x5b')]['messageId'],'body':_0x1e7a15[_0x8ca2('0x5b')][_0x8ca2('0x5b')],'SmsAccountId':_0x110c8b[_0x8ca2('0x59')]['id'],'SmsInteractionId':_0x186eff['id'],'direction':'in','ContactId':_0x186eff[_0x8ca2('0xaf')],'AttachmentId':_0x1e7a15[_0x8ca2('0x5b')]['AttachmentId']});})['then'](function(_0x4f2776){_0x1e7a15['message']=_0x4f2776;if(!_0x1e7a15[_0x8ca2('0xa8')]['UserId'])return;return db[_0x8ca2('0xb0')][_0x8ca2('0x60')]({'attributes':['id',_0x8ca2('0x3c')],'where':{'id':_0x1e7a15['interaction']['UserId']}});})[_0x8ca2('0x37')](function(_0x6d5707){if(_0x6d5707){_0x1e7a15['applications'][_0x8ca2('0xb1')]({'id':0x0,'priority':0x0,'app':_0x8ca2('0xb2'),'appdata':_0x6d5707['name']+','+(_0x1e7a15[_0x8ca2('0x78')][_0x8ca2('0xb3')]||0xa),'interval':'*,*,*,*'});}if(!_0x1e7a15['interaction'][_0x8ca2('0xb4')])return;return db[_0x8ca2('0xb5')][_0x8ca2('0x60')]({'attributes':['id','name'],'where':{'id':_0x1e7a15[_0x8ca2('0xa8')]['queueId']}});})[_0x8ca2('0x37')](function(_0x543cfd){if(_0x543cfd){_0x1e7a15[_0x8ca2('0xab')][_0x8ca2('0xb1')]({'id':0x0,'priority':0x1,'app':_0x8ca2('0xb6'),'appdata':_0x543cfd['name']+','+(_0x1e7a15[_0x8ca2('0x78')][_0x8ca2('0xb7')]||0x12c),'interval':_0x8ca2('0xad')});}return respondWithRpcPromise(_0x8ca2('0xb8'),_0x8ca2('0xb9'),_0x1e7a15);})[_0x8ca2('0x37')](function(_0x4c5c3e){if(_0x4c5c3e){var _0x43eb1c=0xc8;var _0x43ab35=_0x8ca2('0xba');logger[_0x8ca2('0x27')](_0x8ca2('0x21'),_0x43ab35,_0x43eb1c,_0x8ca2('0xbb'));logger[_0x8ca2('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x43ab35,_0x43eb1c,'entity\x20found',JSON[_0x8ca2('0x22')](_0x4c5c3e));if(_0x1e7a15['account'][_0x8ca2('0x43')]===_0x8ca2('0x83')){return _0x553a5f[_0x8ca2('0x2b')](_0x43eb1c)[_0x8ca2('0x31')]('Content-Type',_0x8ca2('0xbc'))[_0x8ca2('0x3d')]('\x0a');}else{return _0x553a5f[_0x8ca2('0x2b')](_0x43eb1c)[_0x8ca2('0x2c')](_0x4c5c3e);}}})[_0x8ca2('0x29')](handleError(_0x553a5f,null));};exports[_0x8ca2('0xbd')]=function(_0x2ebbf2,_0x1c5816){var _0x3ccafe=_0x2ebbf2[_0x8ca2('0x59')]['id'];var _0x5000bf=_0x2ebbf2['body'];var _0x153d2b=0xc8;var _0x53cea6=null;return db[_0x8ca2('0xbe')][_0x8ca2('0xbf')]({'isolationLevel':db['sequelize']['Transaction'][_0x8ca2('0xc0')][_0x8ca2('0xc1')]},function(_0xbc7590){return db['SmsAccount'][_0x8ca2('0x6a')]({'where':{'id':_0x3ccafe},'transaction':_0xbc7590})['then'](function(_0x454a78){if(_0x454a78){return db[_0x8ca2('0x76')][_0x8ca2('0x38')]({'where':{'SmsAccountId':_0x3ccafe},'transaction':_0xbc7590})[_0x8ca2('0x37')](function(){var _0x114065=_[_0x8ca2('0x53')](_0x5000bf,function(_0x27b4f9){_0x27b4f9[_0x8ca2('0x67')]=_0x3ccafe;return _0x27b4f9;});return db[_0x8ca2('0x76')][_0x8ca2('0xc2')](_0x114065,{'transaction':_0xbc7590});});}else{_0x153d2b=0x194;_0x53cea6=[];}});})['then'](function(){if(_0x153d2b!==0x194){return db[_0x8ca2('0x76')]['findAndCountAll']({'where':{'SmsAccountId':_0x3ccafe},'order':'priority'})[_0x8ca2('0x37')](function(_0x496ad5){_0x53cea6=_0x496ad5;});}})['catch'](function(_0x9c808f){_0x153d2b=0x1f4;logger[_0x8ca2('0x23')](_0x9c808f[_0x8ca2('0x3b')]);if(_0x9c808f['name']){delete _0x9c808f[_0x8ca2('0x3c')];}_0x53cea6=_0x9c808f;})['finally'](function(){if(_0x53cea6===null){_0x1c5816[_0x8ca2('0x2a')](_0x153d2b);}else{if(_0x153d2b===0x1f4){_0x1c5816[_0x8ca2('0x2b')](_0x153d2b)[_0x8ca2('0x3d')](_0x53cea6);}else{_0x1c5816[_0x8ca2('0x2b')](_0x153d2b)[_0x8ca2('0x2c')](_0x53cea6);}}});};exports['getApplications']=function(_0x57892e,_0x54901c,_0x145a5c){var _0x5f37a2={};var _0x2f38e9={};var _0x3724c0;var _0x29c594;return db[_0x8ca2('0x40')]['findOne']({'where':{'id':_0x57892e[_0x8ca2('0x59')]['id']}})['then'](handleEntityNotFound(_0x54901c,null))[_0x8ca2('0x37')](function(_0x8eb9f2){if(_0x8eb9f2){_0x3724c0=_0x8eb9f2;_0x2f38e9['model']=_[_0x8ca2('0x46')](db[_0x8ca2('0x76')][_0x8ca2('0x41')]);_0x2f38e9[_0x8ca2('0x47')]=_['keys'](_0x57892e['query']);_0x2f38e9[_0x8ca2('0x4f')]=_[_0x8ca2('0x48')](_0x2f38e9[_0x8ca2('0x45')],_0x2f38e9['query']);_0x5f37a2[_0x8ca2('0x49')]=_[_0x8ca2('0x48')](_0x2f38e9[_0x8ca2('0x45')],qs[_0x8ca2('0x4a')](_0x57892e[_0x8ca2('0x47')]['fields']));_0x5f37a2[_0x8ca2('0x49')]=_0x5f37a2[_0x8ca2('0x49')][_0x8ca2('0x4b')]?_0x5f37a2[_0x8ca2('0x49')]:_0x2f38e9[_0x8ca2('0x45')];_0x5f37a2['order']=qs[_0x8ca2('0x4d')](_0x57892e[_0x8ca2('0x47')][_0x8ca2('0x4d')]);_0x5f37a2[_0x8ca2('0x4e')]=qs[_0x8ca2('0x4f')](_['pick'](_0x57892e['query'],_0x2f38e9[_0x8ca2('0x4f')]));if(_0x57892e['query'][_0x8ca2('0x51')]){_0x5f37a2['where']=_[_0x8ca2('0x52')](_0x5f37a2[_0x8ca2('0x4e')],{'$or':_[_0x8ca2('0x53')](_0x5f37a2['attributes'],function(_0x2fee00){var _0x51fdeb={};_0x51fdeb[_0x2fee00]={'$like':'%'+_0x57892e[_0x8ca2('0x47')][_0x8ca2('0x51')]+'%'};return _0x51fdeb;})});}_0x5f37a2=_[_0x8ca2('0x52')]({},_0x5f37a2,_0x57892e[_0x8ca2('0x6b')]);return _0x3724c0[_0x8ca2('0xc3')](_0x5f37a2);}})[_0x8ca2('0x37')](function(_0x1b4390){if(_0x1b4390){_0x29c594=_0x1b4390[_0x8ca2('0x4b')];if(!_0x57892e[_0x8ca2('0x47')][_0x8ca2('0x4c')](_0x8ca2('0x71'))){_0x5f37a2[_0x8ca2('0x30')]=qs[_0x8ca2('0x30')](_0x57892e[_0x8ca2('0x47')][_0x8ca2('0x30')]);_0x5f37a2['offset']=qs[_0x8ca2('0x2f')](_0x57892e['query'][_0x8ca2('0x2f')]);}return _0x3724c0[_0x8ca2('0xc3')](_0x5f37a2);}})[_0x8ca2('0x37')](function(_0x356418){if(_0x356418){return _0x356418?{'count':_0x29c594,'rows':_0x356418}:null;}})[_0x8ca2('0x37')](respondWithResult(_0x54901c,null))['catch'](handleError(_0x54901c,null));};exports[_0x8ca2('0xc4')]=function(_0x2140f9,_0x16ec03,_0x181024){var _0x8752ad={'raw':![],'where':{}};var _0x1d693a={};var _0x5bdd44={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x2140f9[_0x8ca2('0x59')]['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x16ec03,null))[_0x8ca2('0x37')](function(_0x48eca8){if(_0x48eca8){_0x1d693a[_0x8ca2('0x45')]=_[_0x8ca2('0x46')](db['SmsInteraction'][_0x8ca2('0x41')]);_0x1d693a[_0x8ca2('0x47')]=_[_0x8ca2('0x46')](_0x2140f9['query']);_0x1d693a[_0x8ca2('0x4f')]=_[_0x8ca2('0x48')](_0x1d693a['model'],_0x1d693a['query']);_0x8752ad[_0x8ca2('0x49')]=_[_0x8ca2('0x48')](_0x1d693a[_0x8ca2('0x45')],qs[_0x8ca2('0x4a')](_0x2140f9['query']['fields']));_0x8752ad[_0x8ca2('0x49')]=_0x8752ad[_0x8ca2('0x49')][_0x8ca2('0x4b')]?_0x8752ad[_0x8ca2('0x49')]:_0x1d693a[_0x8ca2('0x45')];if(!_0x2140f9[_0x8ca2('0x47')][_0x8ca2('0x4c')](_0x8ca2('0x71'))){_0x8752ad[_0x8ca2('0x30')]=qs[_0x8ca2('0x30')](_0x2140f9[_0x8ca2('0x47')][_0x8ca2('0x30')]);_0x8752ad['offset']=qs[_0x8ca2('0x2f')](_0x2140f9[_0x8ca2('0x47')]['offset']);}_0x8752ad[_0x8ca2('0x72')]=qs[_0x8ca2('0x4d')](_0x2140f9['query'][_0x8ca2('0x4d')]);_0x8752ad[_0x8ca2('0x4e')]=qs[_0x8ca2('0x4f')](_[_0x8ca2('0x50')](_0x2140f9[_0x8ca2('0x47')],_0x1d693a[_0x8ca2('0x4f')]));_0x8752ad[_0x8ca2('0x4e')][_0x8ca2('0x67')]=_0x48eca8['id'];if(_0x2140f9['query']['filter']){_0x8752ad[_0x8ca2('0x4e')]=_[_0x8ca2('0x52')](_0x8752ad[_0x8ca2('0x4e')],{'$or':_['map'](_0x8752ad[_0x8ca2('0x49')],function(_0xa02b8){var _0x1b6bd4={};_0x1b6bd4[_0xa02b8]={'$like':'%'+_0x2140f9[_0x8ca2('0x47')]['filter']+'%'};return _0x1b6bd4;})});}_0x8752ad=_['merge']({},_0x8752ad,_0x2140f9[_0x8ca2('0x6b')]);return db[_0x8ca2('0xa6')][_0x8ca2('0x2e')]({'where':_0x8752ad[_0x8ca2('0x4e')]})['then'](function(_0x2926d8){_0x5bdd44[_0x8ca2('0x2e')]=_0x2926d8;if(_0x2140f9[_0x8ca2('0x47')][_0x8ca2('0x55')]){_0x8752ad[_0x8ca2('0x56')]=[{'model':db[_0x8ca2('0x7b')],'as':'Contact','required':![]},{'model':db[_0x8ca2('0xb0')],'as':_0x8ca2('0xc5'),'attributes':[_0x8ca2('0x3c'),_0x8ca2('0xc6'),_0x8ca2('0xc7')],'required':![]},{'model':db[_0x8ca2('0xc8')],'as':_0x8ca2('0xc9'),'attributes':['id',_0x8ca2('0x3c'),_0x8ca2('0xca')],'where':_0x2140f9[_0x8ca2('0x47')][_0x8ca2('0xcb')]?{'id':_0x2140f9[_0x8ca2('0x47')][_0x8ca2('0xcb')]}:undefined,'required':_0x2140f9[_0x8ca2('0x47')][_0x8ca2('0xcb')]?!![]:![]}];}return db[_0x8ca2('0xa6')][_0x8ca2('0x73')](_0x8752ad);})[_0x8ca2('0x37')](function(_0x43ff87){_0x5bdd44[_0x8ca2('0x57')]=_0x43ff87;return _0x5bdd44;});}})[_0x8ca2('0x37')](respondWithFilteredResult(_0x16ec03,_0x8752ad))[_0x8ca2('0x29')](handleError(_0x16ec03,null));};exports['send']=function(_0x516eba,_0x52a49a,_0x4ecfc6){var _0x3c4eb8,_0x482cc2,_0x261a11;if(_[_0x8ca2('0x9b')](_0x516eba[_0x8ca2('0x5b')][_0x8ca2('0x5b')])||_0x516eba[_0x8ca2('0x5b')][_0x8ca2('0x5b')]===''){throw new db['Sequelize'][(_0x8ca2('0x7d'))](_0x8ca2('0xcc'));}if(_[_0x8ca2('0x9b')](_0x516eba['body']['to'])){throw new db[(_0x8ca2('0x7c'))][(_0x8ca2('0x7d'))](_0x8ca2('0xcd'));}_0x3c4eb8=_0x516eba[_0x8ca2('0x5b')]['to'];return db[_0x8ca2('0x40')]['find']({'where':{'id':_0x516eba[_0x8ca2('0x59')]['id']},'include':[{'model':db[_0x8ca2('0xa1')],'as':_0x8ca2('0xce'),'include':[{'model':db[_0x8ca2('0x7b')],'as':_0x8ca2('0xa2'),'where':{'mobile':_0x3c4eb8},'limit':0x1,'order':[[_0x8ca2('0x80'),_0x8ca2('0xa3')]]}]}]})[_0x8ca2('0x37')](handleEntityNotFound(_0x52a49a,null))[_0x8ca2('0x37')](function(_0x21c6f5){if(_0x21c6f5&&_0x21c6f5[_0x8ca2('0xce')]){_0x482cc2=_0x21c6f5[_0x8ca2('0x5f')]({'plain':!![]});if(_0x482cc2[_0x8ca2('0xce')]&&_0x482cc2[_0x8ca2('0xce')][_0x8ca2('0xa2')]['length']){return _0x482cc2[_0x8ca2('0xce')][_0x8ca2('0xa2')][0x0];}return db[_0x8ca2('0x7b')][_0x8ca2('0x5a')](_[_0x8ca2('0x17')](_0x516eba[_0x8ca2('0x5b')],{'firstName':_0x3c4eb8,'mobile':_0x3c4eb8,'phone':_0x3c4eb8,'ListId':_0x482cc2[_0x8ca2('0xcf')]}));}})['then'](handleEntityNotFound(_0x52a49a,null))[_0x8ca2('0x37')](function(_0x305304){if(_0x305304){_0x261a11=_0x305304;return db[_0x8ca2('0xa6')][_0x8ca2('0x60')]({'where':{'ContactId':_0x261a11['id'],'closed':![],'SmsAccountId':_0x482cc2['id']}})['then'](function(_0x3ab1b6){if(_0x3ab1b6){return[_0x3ab1b6,![]];}return db['SmsInteraction']['create']({'UserId':_0x516eba[_0x8ca2('0x5c')]['id'],'ContactId':_0x261a11['id'],'SmsAccountId':_0x482cc2['id'],'phone':_0x3c4eb8,'firstMsgDirection':'out','Messages':[_[_0x8ca2('0x52')](_0x516eba[_0x8ca2('0x5b')],{'read':![],'body':_0x516eba[_0x8ca2('0x5b')][_0x8ca2('0x5b')],'phone':_0x3c4eb8,'SmsAccountId':_0x482cc2['id'],'UserId':_0x516eba[_0x8ca2('0x5c')]['id'],'ContactId':_0x261a11['id']})]},{'include':[{'model':db[_0x8ca2('0xae')],'as':_0x8ca2('0xd0')}]})[_0x8ca2('0x37')](function(_0x419c0e){return[_0x419c0e,!![]];});});}})[_0x8ca2('0xa7')](function(_0x2832c6,_0x1bd8bd){if(_0x1bd8bd){return _0x2832c6;}return db[_0x8ca2('0xae')][_0x8ca2('0x5a')](_['merge'](_0x516eba[_0x8ca2('0x5b')],{'read':![],'body':_0x516eba[_0x8ca2('0x5b')][_0x8ca2('0x5b')],'phone':_0x3c4eb8,'SmsAccountId':_0x482cc2['id'],'SmsInteractionId':_0x2832c6['id'],'UserId':_0x516eba[_0x8ca2('0x5c')]['id'],'ContactId':_0x261a11['id']}))[_0x8ca2('0x37')](function(_0x1f6020){_0x2832c6['dataValues']['Messages']=[];_0x2832c6[_0x8ca2('0xd1')]['Messages'][_0x8ca2('0xd2')](_0x1f6020[_0x8ca2('0xd1')]);return _0x2832c6;});})[_0x8ca2('0x37')](respondWithResult(_0x52a49a,null))[_0x8ca2('0x29')](handleError(_0x52a49a,null));};exports['status']=function(_0x1d7435,_0x226cd1,_0x5b0477){if(_0x1d7435[_0x8ca2('0x5b')]['id']){delete _0x1d7435[_0x8ca2('0x5b')]['id'];}var _0x13e31f,_0x215fd1,_0x1ad8fa;return db['SmsAccount'][_0x8ca2('0x60')]({'where':{'id':_0x1d7435[_0x8ca2('0x59')]['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x226cd1,null))[_0x8ca2('0x37')](function(_0x5d5b47){if(_0x5d5b47){_0x1ad8fa=_0x5d5b47;logger['debug'](_0x8ca2('0x21'),_0x8ca2('0x2b'),_0x8ca2('0xd3'),_0x5d5b47[_0x8ca2('0x43')],util[_0x8ca2('0xd4')](_0x1d7435[_0x8ca2('0x5b')],{'showHidden':![],'depth':null}));switch(_0x5d5b47[_0x8ca2('0x43')]){case'skebby':if(_0x1d7435['body']['skebby_dispatch_id']&&_0x1d7435[_0x8ca2('0x5b')][_0x8ca2('0x2b')]){_0x215fd1=_0x1d7435[_0x8ca2('0x5b')]['status'];return db['SmsMessage']['find']({'where':{'messageId':_0x1d7435['body'][_0x8ca2('0xd5')]}});}break;case _0x8ca2('0x8c'):if(_0x1d7435[_0x8ca2('0x5b')][_0x8ca2('0xd6')]&&_0x1d7435[_0x8ca2('0x5b')][_0x8ca2('0xd7')]){_0x215fd1=_0x1d7435['body'][_0x8ca2('0xd7')];return db[_0x8ca2('0xae')]['find']({'where':{'messageId':_0x1d7435[_0x8ca2('0x5b')][_0x8ca2('0xd6')]}});}break;case _0x8ca2('0x8d'):if(_0x1d7435[_0x8ca2('0x5b')][_0x8ca2('0xd8')]&&_0x1d7435['body'][_0x8ca2('0xd9')]){_0x215fd1=_0x1d7435[_0x8ca2('0x5b')][_0x8ca2('0xd9')];return db[_0x8ca2('0xae')][_0x8ca2('0x60')]({'where':{'messageId':_0x1d7435[_0x8ca2('0x5b')]['message_id']}});}break;case _0x8ca2('0x91'):var _0x11b486=_0x1d7435[_0x8ca2('0x5b')][_0x8ca2('0x92')][0x0];if(_0x11b486[_0x8ca2('0x87')]&&_0x11b486['status'][_0x8ca2('0xda')]==='DELIVERED'){_0x215fd1=_0x11b486[_0x8ca2('0x2b')]['groupName'];return db['SmsMessage'][_0x8ca2('0x60')]({'where':{'messageId':_0x11b486[_0x8ca2('0x87')]}});}break;case _0x8ca2('0x96'):if(_0x1d7435[_0x8ca2('0x5b')][_0x8ca2('0x87')]&&_0x1d7435[_0x8ca2('0x5b')]['status']){_0x215fd1=_0x1d7435[_0x8ca2('0x5b')]['status'];return db[_0x8ca2('0xae')][_0x8ca2('0x60')]({'where':{'messageId':_0x1d7435[_0x8ca2('0x5b')]['messageId']}});}break;case _0x8ca2('0x98'):if(_0x1d7435[_0x8ca2('0x5b')][0x0][_0x8ca2('0x25')]['id']){_0x215fd1=_0x1d7435[_0x8ca2('0x5b')][0x0][_0x8ca2('0x43')];return db[_0x8ca2('0xae')][_0x8ca2('0x60')]({'where':{'messageId':_0x1d7435['body'][0x0][_0x8ca2('0x25')]['id']}});}break;case _0x8ca2('0x99'):if(_0x1d7435[_0x8ca2('0x5b')][_0x8ca2('0xdb')]&&_0x1d7435[_0x8ca2('0x5b')][_0x8ca2('0x2b')]){_0x215fd1=_0x1d7435[_0x8ca2('0x5b')]['status'];return db[_0x8ca2('0xae')][_0x8ca2('0x60')]({'where':{'messageId':_0x1d7435['body'][_0x8ca2('0xdb')]}});}break;}}})[_0x8ca2('0x37')](handleEntityNotFound(_0x226cd1,null))[_0x8ca2('0x37')](function(_0x2bdf21){if(_0x2bdf21){_0x13e31f=_0x2bdf21;switch(_0x1ad8fa['type']){case _0x8ca2('0x89'):if(_0x215fd1==='DELIVERED'){return _0x13e31f[_0x8ca2('0x36')]({'read':!![]});}else{logger[_0x8ca2('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x8ca2('0x89'),util[_0x8ca2('0xd4')](_0x1d7435[_0x8ca2('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x8ca2('0x8c'):if(_0x215fd1==='1'){return _0x13e31f[_0x8ca2('0x36')]({'read':!![]});}else{logger[_0x8ca2('0x23')](_0x8ca2('0x21'),'status',_0x8ca2('0x89'),util[_0x8ca2('0xd4')](_0x1d7435[_0x8ca2('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x8ca2('0x8d'):if(!_0x1d7435['body'][_0x8ca2('0xdc')]&&_0x215fd1>=0xc8&&_0x215fd1<=0xce){return _0x13e31f[_0x8ca2('0x36')]({'read':!![]});}else{logger[_0x8ca2('0x23')](_0x8ca2('0x21'),_0x8ca2('0x2b'),_0x8ca2('0x8d'),util['inspect'](_0x1d7435[_0x8ca2('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x8ca2('0x91'):var _0x3163db=_0x1d7435['body']['results'][0x0];if(_0x3163db[_0x8ca2('0x2b')][_0x8ca2('0xda')]===_0x8ca2('0xdd')){return _0x13e31f[_0x8ca2('0x36')]({'read':!![]});}else{logger[_0x8ca2('0x23')](_0x8ca2('0x21'),_0x8ca2('0x2b'),'infobip',util[_0x8ca2('0xd4')](_0x1d7435[_0x8ca2('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x8ca2('0x96'):if(_0x215fd1==_0x8ca2('0xde')||_0x215fd1=='RECEIVED_BY_RECIPIENT'){return _0x13e31f['update']({'read':!![]});}else{logger[_0x8ca2('0x23')](_0x8ca2('0x21'),_0x8ca2('0x2b'),'clickatell',util[_0x8ca2('0xd4')](_0x1d7435[_0x8ca2('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x8ca2('0x98'):if(_0x215fd1==_0x8ca2('0xdf')){return _0x13e31f[_0x8ca2('0x36')]({'read':!![]});}else{logger[_0x8ca2('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8ca2('0x2b'),'bandwidth',util['inspect'](_0x1d7435[_0x8ca2('0x5b')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x215fd1===_0x8ca2('0xe0')||_0x215fd1===_0x8ca2('0xe1')){return _0x13e31f['update']({'read':!![]});}else{logger[_0x8ca2('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8ca2('0x2b'),_0x8ca2('0x99'),util[_0x8ca2('0xd4')](_0x1d7435['body'],{'showHidden':![],'depth':null}));}break;}return _0x13e31f;}})[_0x8ca2('0x37')](respondWithResult(_0x226cd1,null))[_0x8ca2('0x29')](handleError(_0x226cd1,null));};exports[_0x8ca2('0xe2')]=function(_0x25e5fc,_0x4f2d64,_0x26575c){var _0x31263f,_0x2375f0,_0x4f7396;return db[_0x8ca2('0x40')][_0x8ca2('0x60')]({'where':{'id':_0x25e5fc[_0x8ca2('0x59')]['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x4f2d64,null))[_0x8ca2('0x37')](function(_0x2f36f6){if(_0x2f36f6){_0x4f7396=_0x2f36f6;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8ca2('0x2b'),_0x8ca2('0xd3'),_0x2f36f6[_0x8ca2('0x43')],util['inspect'](_0x25e5fc[_0x8ca2('0x47')],{'showHidden':![],'depth':null}));switch(_0x2f36f6[_0x8ca2('0x43')]){case'csc':if(_0x25e5fc[_0x8ca2('0x47')][_0x8ca2('0xe3')]&&_0x25e5fc[_0x8ca2('0x47')][_0x8ca2('0xe4')]){_0x2375f0=_0x25e5fc[_0x8ca2('0x47')][_0x8ca2('0xe4')];return db[_0x8ca2('0xae')][_0x8ca2('0x60')]({'where':{'messageId':_0x25e5fc[_0x8ca2('0x47')][_0x8ca2('0xe3')]}});}break;}}})['then'](handleEntityNotFound(_0x4f2d64,null))[_0x8ca2('0x37')](function(_0xf5a252){if(_0xf5a252){_0x31263f=_0xf5a252;switch(_0x4f7396[_0x8ca2('0x43')]){case _0x8ca2('0x93'):if(_0x2375f0==='2'||_0x2375f0==='6'){return _0x31263f[_0x8ca2('0x36')]({'read':!![]});}else{logger[_0x8ca2('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8ca2('0x2b'),_0x8ca2('0x93'),util[_0x8ca2('0xd4')](_0x25e5fc[_0x8ca2('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x31263f;}})[_0x8ca2('0x37')](respondWithResult(_0x4f2d64,null))[_0x8ca2('0x29')](handleError(_0x4f2d64,null));};exports[_0x8ca2('0xe5')]=function(_0x236d4d,_0x1de3e2,_0x30fd4c){return db[_0x8ca2('0x40')][_0x8ca2('0x60')]({'where':{'id':_0x236d4d['params']['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x1de3e2,null))['then'](function(_0x104906){if(_0x104906){return _0x104906[_0x8ca2('0xe5')](_0x236d4d[_0x8ca2('0x5b')]['ids'],_[_0x8ca2('0xa4')](_0x236d4d[_0x8ca2('0x5b')],['ids','id'])||{})['spread'](function(_0x1c3743){for(var _0x46bf34=0x0;_0x46bf34<_0x236d4d[_0x8ca2('0x5b')][_0x8ca2('0x6d')][_0x8ca2('0x4b')];_0x46bf34+=0x1){socket[_0x8ca2('0xe6')](_0x8ca2('0xe7'),{'UserId':Number(_0x236d4d[_0x8ca2('0x5b')][_0x8ca2('0x6d')][_0x46bf34]),'SmsAccountId':Number(_0x236d4d[_0x8ca2('0x59')]['id'])});}return _0x1c3743;});}})['then'](respondWithResult(_0x1de3e2,null))[_0x8ca2('0x29')](handleError(_0x1de3e2,null));};exports['removeAgents']=function(_0xd91f10,_0x140187,_0x19b0f1){return db['SmsAccount'][_0x8ca2('0x60')]({'where':{'id':_0xd91f10[_0x8ca2('0x59')]['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x140187,null))[_0x8ca2('0x37')](function(_0xb177f6){if(_0xb177f6){return _0xb177f6[_0x8ca2('0xe8')](_0xd91f10[_0x8ca2('0x47')][_0x8ca2('0x6d')])[_0x8ca2('0x37')](function(){if(_[_0x8ca2('0xe9')](_0xd91f10[_0x8ca2('0x47')]['ids'])){for(var _0xca10dc=0x0;_0xca10dc<_0xd91f10[_0x8ca2('0x47')][_0x8ca2('0x6d')][_0x8ca2('0x4b')];_0xca10dc+=0x1){socket[_0x8ca2('0xe6')]('userSmsAccount:remove',{'UserId':Number(_0xd91f10[_0x8ca2('0x47')]['ids'][_0xca10dc]),'SmsAccountId':Number(_0xd91f10[_0x8ca2('0x59')]['id'])});}}else{socket[_0x8ca2('0xe6')](_0x8ca2('0xea'),{'UserId':Number(_0xd91f10[_0x8ca2('0x47')][_0x8ca2('0x6d')]),'SmsAccountId':Number(_0xd91f10[_0x8ca2('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x140187,null))['catch'](handleError(_0x140187,null));};exports[_0x8ca2('0xeb')]=function(_0xb8e9d5,_0x40482b,_0x3fbd2c){var _0x4fb684={};var _0x187638={};var _0x2979fd;var _0x160691;return db[_0x8ca2('0x40')][_0x8ca2('0x6a')]({'where':{'id':_0xb8e9d5[_0x8ca2('0x59')]['id']}})[_0x8ca2('0x37')](handleEntityNotFound(_0x40482b,null))[_0x8ca2('0x37')](function(_0x2feeae){if(_0x2feeae){_0x2979fd=_0x2feeae;_0x187638[_0x8ca2('0x45')]=_['keys'](db['User']['rawAttributes']);_0x187638[_0x8ca2('0x47')]=_[_0x8ca2('0x46')](_0xb8e9d5[_0x8ca2('0x47')]);_0x187638[_0x8ca2('0x4f')]=_[_0x8ca2('0x48')](_0x187638['model'],_0x187638[_0x8ca2('0x47')]);_0x4fb684[_0x8ca2('0x49')]=_[_0x8ca2('0x48')](_0x187638[_0x8ca2('0x45')],qs['fields'](_0xb8e9d5[_0x8ca2('0x47')][_0x8ca2('0x4a')]));_0x4fb684[_0x8ca2('0x49')]=_0x4fb684[_0x8ca2('0x49')][_0x8ca2('0x4b')]?_0x4fb684[_0x8ca2('0x49')]:_0x187638[_0x8ca2('0x45')];_0x4fb684[_0x8ca2('0x72')]=qs[_0x8ca2('0x4d')](_0xb8e9d5[_0x8ca2('0x47')][_0x8ca2('0x4d')]);_0x4fb684[_0x8ca2('0x4e')]=qs['filters'](_[_0x8ca2('0x50')](_0xb8e9d5[_0x8ca2('0x47')],_0x187638[_0x8ca2('0x4f')]));if(_0xb8e9d5[_0x8ca2('0x47')][_0x8ca2('0x51')]){_0x4fb684[_0x8ca2('0x4e')]=_[_0x8ca2('0x52')](_0x4fb684['where'],{'$or':_[_0x8ca2('0x53')](_0x4fb684[_0x8ca2('0x49')],function(_0x2efcfc){var _0x34b504={};_0x34b504[_0x2efcfc]={'$like':'%'+_0xb8e9d5[_0x8ca2('0x47')][_0x8ca2('0x51')]+'%'};return _0x34b504;})});}_0x4fb684=_['merge']({},_0x4fb684,_0xb8e9d5[_0x8ca2('0x6b')]);return _0x2979fd[_0x8ca2('0xeb')](_0x4fb684);}})[_0x8ca2('0x37')](function(_0x2f9adb){if(_0x2f9adb){_0x160691=_0x2f9adb[_0x8ca2('0x4b')];if(!_0xb8e9d5[_0x8ca2('0x47')][_0x8ca2('0x4c')](_0x8ca2('0x71'))){_0x4fb684[_0x8ca2('0x30')]=qs[_0x8ca2('0x30')](_0xb8e9d5[_0x8ca2('0x47')]['limit']);_0x4fb684[_0x8ca2('0x2f')]=qs[_0x8ca2('0x2f')](_0xb8e9d5[_0x8ca2('0x47')]['offset']);}return _0x2979fd[_0x8ca2('0xeb')](_0x4fb684);}})[_0x8ca2('0x37')](function(_0x321e9b){if(_0x321e9b){return _0x321e9b?{'count':_0x160691,'rows':_0x321e9b}:null;}})[_0x8ca2('0x37')](respondWithResult(_0x40482b,null))[_0x8ca2('0x29')](handleError(_0x40482b,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 8003b38..c693031 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 _0xba9a=['hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x281e5e,_0xf320e2){var _0x5a22d2=function(_0x405ff9){while(--_0x405ff9){_0x281e5e['push'](_0x281e5e['shift']());}};_0x5a22d2(++_0xf320e2);}(_0xba9a,0x84));var _0xaba9=function(_0x32e33c,_0x2c4cf7){_0x32e33c=_0x32e33c-0x0;var _0x1805a2=_0xba9a[_0x32e33c];return _0x1805a2;};'use strict';var EventEmitter=require(_0xaba9('0x0'));var SmsAccount=require(_0xaba9('0x1'))['db'][_0xaba9('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xaba9('0x3')](0x0);var events={'afterCreate':_0xaba9('0x4'),'afterUpdate':_0xaba9('0x5'),'afterDestroy':_0xaba9('0x6')};function emitEvent(_0x31c8f0){return function(_0x5015ee,_0x434db9,_0x535d8a){SmsAccountEvents['emit'](_0x31c8f0+':'+_0x5015ee['id'],_0x5015ee);SmsAccountEvents['emit'](_0x31c8f0,_0x5015ee);_0x535d8a(null);};}for(var e in events){if(events[_0xaba9('0x7')](e)){var event=events[e];SmsAccount[_0xaba9('0x8')](e,emitEvent(event));}}module[_0xaba9('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0xdff8=['SmsAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x383dbb,_0x17d41b){var _0x6e8bde=function(_0x2740f1){while(--_0x2740f1){_0x383dbb['push'](_0x383dbb['shift']());}};_0x6e8bde(++_0x17d41b);}(_0xdff8,0xa8));var _0x8dff=function(_0x4ebf6a,_0xfd0a40){_0x4ebf6a=_0x4ebf6a-0x0;var _0x1e7a72=_0xdff8[_0x4ebf6a];return _0x1e7a72;};'use strict';var EventEmitter=require(_0x8dff('0x0'));var SmsAccount=require(_0x8dff('0x1'))['db'][_0x8dff('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x8dff('0x3')](0x0);var events={'afterCreate':_0x8dff('0x4'),'afterUpdate':'update','afterDestroy':_0x8dff('0x5')};function emitEvent(_0x2ec831){return function(_0x1a2387,_0x4fb36d,_0x47803f){SmsAccountEvents[_0x8dff('0x6')](_0x2ec831+':'+_0x1a2387['id'],_0x1a2387);SmsAccountEvents[_0x8dff('0x6')](_0x2ec831,_0x1a2387);_0x47803f(null);};}for(var e in events){if(events[_0x8dff('0x7')](e)){var event=events[e];SmsAccount[_0x8dff('0x8')](e,emitEvent(event));}}module[_0x8dff('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 3411a11..3f644e7 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 _0x29e7=['sms_accounts','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define'];(function(_0xfc315c,_0x41519a){var _0x1c1203=function(_0x3eeef0){while(--_0x3eeef0){_0xfc315c['push'](_0xfc315c['shift']());}};_0x1c1203(++_0x41519a);}(_0x29e7,0x169));var _0x729e=function(_0x42b789,_0x46d8d4){_0x42b789=_0x42b789-0x0;var _0x3dee14=_0x29e7[_0x42b789];return _0x3dee14;};'use strict';var _=require(_0x729e('0x0'));var util=require(_0x729e('0x1'));var logger=require('../../config/logger')(_0x729e('0x2'));var moment=require('moment');var BPromise=require(_0x729e('0x3'));var rp=require(_0x729e('0x4'));var fs=require('fs');var path=require(_0x729e('0x5'));var rimraf=require(_0x729e('0x6'));var config=require(_0x729e('0x7'));var attributes=require(_0x729e('0x8'));module[_0x729e('0x9')]=function(_0x11201b,_0x3291f0){return _0x11201b[_0x729e('0xa')]('SmsAccount',attributes,{'tableName':_0x729e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9a3=['SmsAccount','sms_accounts','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./smsAccount.attributes','exports','define'];(function(_0x2163b0,_0x4a8ca6){var _0x17e53f=function(_0x490310){while(--_0x490310){_0x2163b0['push'](_0x2163b0['shift']());}};_0x17e53f(++_0x4a8ca6);}(_0xf9a3,0xd3));var _0x3f9a=function(_0x4caf99,_0x4e7f46){_0x4caf99=_0x4caf99-0x0;var _0x878f4b=_0xf9a3[_0x4caf99];return _0x878f4b;};'use strict';var _=require(_0x3f9a('0x0'));var util=require('util');var logger=require(_0x3f9a('0x1'))('api');var moment=require(_0x3f9a('0x2'));var BPromise=require(_0x3f9a('0x3'));var rp=require(_0x3f9a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3f9a('0x5'));var config=require('../../config/environment');var attributes=require(_0x3f9a('0x6'));module[_0x3f9a('0x7')]=function(_0x13b16c,_0x5e9c59){return _0x13b16c[_0x3f9a('0x8')](_0x3f9a('0x9'),attributes,{'tableName':_0x3f9a('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 5b725c9..f4d4784 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 _0xfe18=['error','code','message','request\x20sent','result','catch','ShowSmsAccount','SmsAccount','options','where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xf0c7f6,_0xc41ece){var _0x3fb728=function(_0x3aadbf){while(--_0x3aadbf){_0xf0c7f6['push'](_0xf0c7f6['shift']());}};_0x3fb728(++_0xc41ece);}(_0xfe18,0x10b));var _0x8fe1=function(_0x484e24,_0x28111d){_0x484e24=_0x484e24-0x0;var _0xc7d3b1=_0xfe18[_0x484e24];return _0xc7d3b1;};'use strict';var _=require(_0x8fe1('0x0'));var util=require(_0x8fe1('0x1'));var moment=require(_0x8fe1('0x2'));var BPromise=require('bluebird');var rs=require(_0x8fe1('0x3'));var fs=require('fs');var Redis=require(_0x8fe1('0x4'));var db=require(_0x8fe1('0x5'))['db'];var utils=require(_0x8fe1('0x6'));var logger=require(_0x8fe1('0x7'))(_0x8fe1('0x8'));var config=require(_0x8fe1('0x9'));var jayson=require(_0x8fe1('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x8fe1('0xb')]=_['defaults'](config['redis'],{'host':_0x8fe1('0xc'),'port':0x18eb});var socket=require(_0x8fe1('0xd'))(new Redis(config[_0x8fe1('0xb')]));require(_0x8fe1('0xe'))[_0x8fe1('0xf')](socket);function respondWithRpcPromise(_0x3ec2cd,_0x20476d,_0x28f736){return new BPromise(function(_0x1fe12c,_0x417e95){return client['request'](_0x3ec2cd,_0x28f736)[_0x8fe1('0x10')](function(_0x148d8e){logger[_0x8fe1('0x11')](_0x8fe1('0x12'),_0x20476d,'request\x20sent');logger['debug'](_0x8fe1('0x13'),_0x20476d,'request\x20sent',JSON[_0x8fe1('0x14')](_0x148d8e));if(_0x148d8e['error']){if(_0x148d8e[_0x8fe1('0x15')][_0x8fe1('0x16')]===0x1f4){logger[_0x8fe1('0x15')](_0x8fe1('0x12'),_0x20476d,_0x148d8e[_0x8fe1('0x15')][_0x8fe1('0x17')]);return _0x417e95(_0x148d8e[_0x8fe1('0x15')]['message']);}logger[_0x8fe1('0x15')](_0x8fe1('0x12'),_0x20476d,_0x148d8e[_0x8fe1('0x15')][_0x8fe1('0x17')]);return _0x1fe12c(_0x148d8e[_0x8fe1('0x15')][_0x8fe1('0x17')]);}else{logger['info'](_0x8fe1('0x12'),_0x20476d,_0x8fe1('0x18'));_0x1fe12c(_0x148d8e[_0x8fe1('0x19')]['message']);}})[_0x8fe1('0x1a')](function(_0x919f6a){logger[_0x8fe1('0x15')]('SmsAccount,\x20%s,\x20%s',_0x20476d,_0x919f6a);_0x417e95(_0x919f6a);});});}exports[_0x8fe1('0x1b')]=function(_0x4040a0){var _0x22e351=this;return new Promise(function(_0x1a311c,_0x486a2d){return db[_0x8fe1('0x1c')]['find']({'raw':_0x4040a0[_0x8fe1('0x1d')]?_0x4040a0['options']['raw']===undefined?!![]:![]:!![],'where':_0x4040a0[_0x8fe1('0x1d')]?_0x4040a0[_0x8fe1('0x1d')][_0x8fe1('0x1e')]||null:null,'attributes':_0x4040a0[_0x8fe1('0x1d')]?_0x4040a0[_0x8fe1('0x1d')][_0x8fe1('0x1f')]||null:null,'include':_0x4040a0[_0x8fe1('0x1d')]?_0x4040a0[_0x8fe1('0x1d')][_0x8fe1('0x20')]?_[_0x8fe1('0x21')](_0x4040a0[_0x8fe1('0x1d')][_0x8fe1('0x20')],function(_0x3f7ef4){return{'model':db[_0x3f7ef4[_0x8fe1('0x22')]],'as':_0x3f7ef4['as'],'attributes':_0x3f7ef4['attributes'],'include':_0x3f7ef4[_0x8fe1('0x20')]?_[_0x8fe1('0x21')](_0x3f7ef4['include'],function(_0x528f3a){return{'model':db[_0x528f3a[_0x8fe1('0x22')]],'as':_0x528f3a['as'],'attributes':_0x528f3a[_0x8fe1('0x1f')],'include':_0x528f3a[_0x8fe1('0x20')]?_[_0x8fe1('0x21')](_0x528f3a[_0x8fe1('0x20')],function(_0x306747){return{'model':db[_0x306747[_0x8fe1('0x22')]],'as':_0x306747['as'],'attributes':_0x306747[_0x8fe1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8fe1('0x10')](function(_0x39559c){logger[_0x8fe1('0x11')]('ShowSmsAccount',_0x4040a0);logger[_0x8fe1('0x23')](_0x8fe1('0x1b'),_0x4040a0,JSON[_0x8fe1('0x14')](_0x39559c));_0x1a311c(_0x39559c);})[_0x8fe1('0x1a')](function(_0x534941){logger['error']('ShowSmsAccount',_0x534941['message'],_0x4040a0);_0x486a2d(_0x22e351[_0x8fe1('0x15')](0x1f4,_0x534941[_0x8fe1('0x17')]));});});}; \ No newline at end of file +var _0x71e2=['model','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map'];(function(_0x562cc9,_0x1cb01e){var _0x5ddbf8=function(_0x48cb40){while(--_0x48cb40){_0x562cc9['push'](_0x562cc9['shift']());}};_0x5ddbf8(++_0x1cb01e);}(_0x71e2,0x104));var _0x271e=function(_0x5c621c,_0x4d1fa6){_0x5c621c=_0x5c621c-0x0;var _0x6bf538=_0x71e2[_0x5c621c];return _0x6bf538;};'use strict';var _=require(_0x271e('0x0'));var util=require(_0x271e('0x1'));var moment=require('moment');var BPromise=require(_0x271e('0x2'));var rs=require(_0x271e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x271e('0x4'))['db'];var utils=require(_0x271e('0x5'));var logger=require(_0x271e('0x6'))(_0x271e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x271e('0x8')][_0x271e('0x9')]({'port':0x232a});config[_0x271e('0xa')]=_['defaults'](config[_0x271e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x271e('0xb'))(new Redis(config[_0x271e('0xa')]));require(_0x271e('0xc'))[_0x271e('0xd')](socket);function respondWithRpcPromise(_0x312bd3,_0x19e7e9,_0x441fa9){return new BPromise(function(_0x3629c7,_0x464475){return client[_0x271e('0xe')](_0x312bd3,_0x441fa9)[_0x271e('0xf')](function(_0x27bff7){logger[_0x271e('0x10')](_0x271e('0x11'),_0x19e7e9,_0x271e('0x12'));logger[_0x271e('0x13')](_0x271e('0x14'),_0x19e7e9,_0x271e('0x12'),JSON[_0x271e('0x15')](_0x27bff7));if(_0x27bff7['error']){if(_0x27bff7[_0x271e('0x16')][_0x271e('0x17')]===0x1f4){logger[_0x271e('0x16')](_0x271e('0x11'),_0x19e7e9,_0x27bff7[_0x271e('0x16')][_0x271e('0x18')]);return _0x464475(_0x27bff7[_0x271e('0x16')][_0x271e('0x18')]);}logger[_0x271e('0x16')](_0x271e('0x11'),_0x19e7e9,_0x27bff7[_0x271e('0x16')][_0x271e('0x18')]);return _0x3629c7(_0x27bff7[_0x271e('0x16')][_0x271e('0x18')]);}else{logger[_0x271e('0x10')](_0x271e('0x11'),_0x19e7e9,_0x271e('0x12'));_0x3629c7(_0x27bff7[_0x271e('0x19')][_0x271e('0x18')]);}})[_0x271e('0x1a')](function(_0x173bc4){logger['error'](_0x271e('0x11'),_0x19e7e9,_0x173bc4);_0x464475(_0x173bc4);});});}exports[_0x271e('0x1b')]=function(_0x41965d){var _0x144052=this;return new Promise(function(_0xd510ba,_0x5e6c35){return db[_0x271e('0x1c')][_0x271e('0x1d')]({'raw':_0x41965d[_0x271e('0x1e')]?_0x41965d[_0x271e('0x1e')][_0x271e('0x1f')]===undefined?!![]:![]:!![],'where':_0x41965d[_0x271e('0x1e')]?_0x41965d['options'][_0x271e('0x20')]||null:null,'attributes':_0x41965d['options']?_0x41965d[_0x271e('0x1e')][_0x271e('0x21')]||null:null,'include':_0x41965d['options']?_0x41965d[_0x271e('0x1e')][_0x271e('0x22')]?_[_0x271e('0x23')](_0x41965d[_0x271e('0x1e')][_0x271e('0x22')],function(_0x4d96fc){return{'model':db[_0x4d96fc['model']],'as':_0x4d96fc['as'],'attributes':_0x4d96fc['attributes'],'include':_0x4d96fc[_0x271e('0x22')]?_[_0x271e('0x23')](_0x4d96fc['include'],function(_0x450c15){return{'model':db[_0x450c15[_0x271e('0x24')]],'as':_0x450c15['as'],'attributes':_0x450c15[_0x271e('0x21')],'include':_0x450c15['include']?_[_0x271e('0x23')](_0x450c15[_0x271e('0x22')],function(_0x510719){return{'model':db[_0x510719[_0x271e('0x24')]],'as':_0x510719['as'],'attributes':_0x510719[_0x271e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x271e('0xf')](function(_0x25743f){logger['info'](_0x271e('0x1b'),_0x41965d);logger[_0x271e('0x13')](_0x271e('0x1b'),_0x41965d,JSON[_0x271e('0x15')](_0x25743f));_0xd510ba(_0x25743f);})['catch'](function(_0x3d81e8){logger[_0x271e('0x16')]('ShowSmsAccount',_0x3d81e8[_0x271e('0x18')],_0x41965d);_0x5e6c35(_0x144052['error'](0x1f4,_0x3d81e8['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 2f553c1..2fd3231 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 58b9dd9..1100d7b 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 _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x1ada2a,_0x4471b6){var _0x35e0f4=function(_0x20381f){while(--_0x20381f){_0x1ada2a['push'](_0x1ada2a['shift']());}};_0x35e0f4(++_0x4471b6);}(_0x008c,0x188));var _0xc008=function(_0x21d0e6,_0x5a7aa6){_0x21d0e6=_0x21d0e6-0x0;var _0x1cc2d1=_0x008c[_0x21d0e6];return _0x1cc2d1;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index c1b6aff..0750750 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 _0x4663=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x279dec,_0x1b4bd3){var _0x4ede3e=function(_0xa4a77e){while(--_0xa4a77e){_0x279dec['push'](_0x279dec['shift']());}};_0x4ede3e(++_0x1b4bd3);}(_0x4663,0x136));var _0x3466=function(_0x58ff7a,_0x340568){_0x58ff7a=_0x58ff7a-0x0;var _0x7437ab=_0x4663[_0x58ff7a];return _0x7437ab;};'use strict';var Sequelize=require('sequelize');module[_0x3466('0x0')]={'priority':{'type':Sequelize[_0x3466('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3466('0x2')],'allowNull':![],'defaultValue':_0x3466('0x3')},'appdata':{'type':Sequelize[_0x3466('0x4')]()},'description':{'type':Sequelize[_0x3466('0x2')]},'interval':{'type':Sequelize[_0x3466('0x2')],'defaultValue':_0x3466('0x5')}}; \ No newline at end of file +var _0x4801=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x5c4183,_0x19172a){var _0x59ad2f=function(_0x1f1418){while(--_0x1f1418){_0x5c4183['push'](_0x5c4183['shift']());}};_0x59ad2f(++_0x19172a);}(_0x4801,0x95));var _0x1480=function(_0x537281,_0x3e2849){_0x537281=_0x537281-0x0;var _0x58a6b3=_0x4801[_0x537281];return _0x58a6b3;};'use strict';var Sequelize=require(_0x1480('0x0'));module[_0x1480('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x1480('0x2')],'allowNull':![],'defaultValue':_0x1480('0x3')},'appdata':{'type':Sequelize[_0x1480('0x4')]()},'description':{'type':Sequelize[_0x1480('0x2')]},'interval':{'type':Sequelize[_0x1480('0x2')],'defaultValue':_0x1480('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index fe48f18..9307916 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 _0x3cad=['fast-json-patch','moment','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','stack','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','SmsApplication','rows','catch','show','length','options','find','create','body','destroy','params','eml-format','rimraf'];(function(_0x4e4088,_0x14df21){var _0x573fd9=function(_0x55663c){while(--_0x55663c){_0x4e4088['push'](_0x4e4088['shift']());}};_0x573fd9(++_0x14df21);}(_0x3cad,0x116));var _0xd3ca=function(_0x5c8c0c,_0x5b65fc){_0x5c8c0c=_0x5c8c0c-0x0;var _0x44da32=_0x3cad[_0x5c8c0c];return _0x44da32;};'use strict';var emlformat=require(_0xd3ca('0x0'));var rimraf=require(_0xd3ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd3ca('0x2'));var rp=require('request-promise');var moment=require(_0xd3ca('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd3ca('0x4'));var path=require('path');var sox=require(_0xd3ca('0x5'));var csv=require('to-csv');var ejs=require(_0xd3ca('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd3ca('0x7'));var squel=require(_0xd3ca('0x8'));var crypto=require('crypto');var jsforce=require(_0xd3ca('0x9'));var deskjs=require(_0xd3ca('0xa'));var toCsv=require(_0xd3ca('0xb'));var querystring=require(_0xd3ca('0xc'));var Papa=require(_0xd3ca('0xd'));var Redis=require(_0xd3ca('0xe'));var authService=require(_0xd3ca('0xf'));var qs=require(_0xd3ca('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3ca('0x11'));var logger=require(_0xd3ca('0x12'))(_0xd3ca('0x13'));var utils=require(_0xd3ca('0x14'));var config=require(_0xd3ca('0x15'));var licenseUtil=require(_0xd3ca('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5974fa,_0x2669e3){_0x2669e3=_0x2669e3||0xcc;return function(_0x14434c){if(_0x14434c){return _0x5974fa['sendStatus'](_0x2669e3);}return _0x5974fa[_0xd3ca('0x17')](_0x2669e3)['end']();};}function respondWithResult(_0x3499af,_0x1de870){_0x1de870=_0x1de870||0xc8;return function(_0x2216ae){if(_0x2216ae){return _0x3499af[_0xd3ca('0x17')](_0x1de870)[_0xd3ca('0x18')](_0x2216ae);}};}function respondWithFilteredResult(_0x578583,_0x3b589e){return function(_0x18df3e){if(_0x18df3e){var _0x32cca0=typeof _0x3b589e['offset']===_0xd3ca('0x19')&&typeof _0x3b589e[_0xd3ca('0x1a')]===_0xd3ca('0x19');var _0x278363=_0x18df3e[_0xd3ca('0x1b')];var _0xf1b799=_0x32cca0?0x0:_0x3b589e[_0xd3ca('0x1c')];var _0x32d451=_0x32cca0?_0x18df3e['count']:_0x3b589e[_0xd3ca('0x1c')]+_0x3b589e[_0xd3ca('0x1a')];var _0x5ea2cd;if(_0x32d451>=_0x278363){_0x32d451=_0x278363;_0x5ea2cd=0xc8;}else{_0x5ea2cd=0xce;}_0x578583[_0xd3ca('0x17')](_0x5ea2cd);return _0x578583[_0xd3ca('0x1d')](_0xd3ca('0x1e'),_0xf1b799+'-'+_0x32d451+'/'+_0x278363)['json'](_0x18df3e);}return null;};}function patchUpdates(_0x5cf4c3){return function(_0x4ef1e6){try{jsonpatch['apply'](_0x4ef1e6,_0x5cf4c3,!![]);}catch(_0x3bda53){return BPromise[_0xd3ca('0x1f')](_0x3bda53);}return _0x4ef1e6[_0xd3ca('0x20')]();};}function saveUpdates(_0x234350,_0x433a2d){return function(_0x433218){if(_0x433218){return _0x433218['update'](_0x234350)['then'](function(_0x5aa8a2){return _0x5aa8a2;});}return null;};}function removeEntity(_0x5d211a,_0x595516){return function(_0xdf3619){if(_0xdf3619){return _0xdf3619['destroy']()[_0xd3ca('0x21')](function(){_0x5d211a[_0xd3ca('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a0837,_0x438aa7){return function(_0x33010e){if(!_0x33010e){_0x3a0837['sendStatus'](0x194);}return _0x33010e;};}function handleError(_0x389631,_0x4411de){_0x4411de=_0x4411de||0x1f4;return function(_0xdbd26c){logger['error'](_0xdbd26c[_0xd3ca('0x22')]);if(_0xdbd26c['name']){delete _0xdbd26c['name'];}_0x389631[_0xd3ca('0x17')](_0x4411de)['send'](_0xdbd26c);};}exports[_0xd3ca('0x23')]=function(_0x1b4694,_0x354b23){var _0x129e85={},_0x25d0dc={},_0x902a19={'count':0x0,'rows':[]};var _0x1c238d=_[_0xd3ca('0x24')](db['SmsApplication'][_0xd3ca('0x25')],function(_0x8e1c29){return{'name':_0x8e1c29[_0xd3ca('0x26')],'type':_0x8e1c29[_0xd3ca('0x27')][_0xd3ca('0x28')]};});_0x25d0dc[_0xd3ca('0x29')]=_[_0xd3ca('0x24')](_0x1c238d,_0xd3ca('0x2a'));_0x25d0dc[_0xd3ca('0x2b')]=_[_0xd3ca('0x2c')](_0x1b4694[_0xd3ca('0x2b')]);_0x25d0dc[_0xd3ca('0x2d')]=_[_0xd3ca('0x2e')](_0x25d0dc[_0xd3ca('0x29')],_0x25d0dc['query']);_0x129e85[_0xd3ca('0x2f')]=_['intersection'](_0x25d0dc[_0xd3ca('0x29')],qs['fields'](_0x1b4694[_0xd3ca('0x2b')][_0xd3ca('0x30')]));_0x129e85['attributes']=_0x129e85[_0xd3ca('0x2f')]['length']?_0x129e85[_0xd3ca('0x2f')]:_0x25d0dc['model'];if(!_0x1b4694[_0xd3ca('0x2b')][_0xd3ca('0x31')](_0xd3ca('0x32'))){_0x129e85[_0xd3ca('0x1a')]=qs[_0xd3ca('0x1a')](_0x1b4694['query']['limit']);_0x129e85['offset']=qs['offset'](_0x1b4694[_0xd3ca('0x2b')][_0xd3ca('0x1c')]);}_0x129e85[_0xd3ca('0x33')]=qs[_0xd3ca('0x34')](_0x1b4694[_0xd3ca('0x2b')]['sort']);_0x129e85[_0xd3ca('0x35')]=qs[_0xd3ca('0x2d')](_[_0xd3ca('0x36')](_0x1b4694['query'],_0x25d0dc[_0xd3ca('0x2d')]),_0x1c238d);if(_0x1b4694[_0xd3ca('0x2b')]['filter']){_0x129e85[_0xd3ca('0x35')]=_[_0xd3ca('0x37')](_0x129e85[_0xd3ca('0x35')],{'$or':_[_0xd3ca('0x24')](_0x1c238d,function(_0x2a3540){if(_0x2a3540['type']!=='VIRTUAL'){var _0x3074c0={};_0x3074c0[_0x2a3540['name']]={'$like':'%'+_0x1b4694[_0xd3ca('0x2b')][_0xd3ca('0x38')]+'%'};return _0x3074c0;}})});}_0x129e85=_[_0xd3ca('0x37')]({},_0x129e85,_0x1b4694['options']);var _0x5986ed={'where':_0x129e85['where']};return db['SmsApplication'][_0xd3ca('0x1b')](_0x5986ed)['then'](function(_0x585d47){_0x902a19[_0xd3ca('0x1b')]=_0x585d47;if(_0x1b4694['query'][_0xd3ca('0x39')]){_0x129e85[_0xd3ca('0x3a')]=[{'all':!![]}];}return db[_0xd3ca('0x3b')]['findAll'](_0x129e85);})[_0xd3ca('0x21')](function(_0x29e4da){_0x902a19[_0xd3ca('0x3c')]=_0x29e4da;return _0x902a19;})['then'](respondWithFilteredResult(_0x354b23,_0x129e85))[_0xd3ca('0x3d')](handleError(_0x354b23,null));};exports[_0xd3ca('0x3e')]=function(_0x264f97,_0x1e8e49){var _0x167deb={'raw':!![],'where':{'id':_0x264f97['params']['id']}},_0x437bee={};_0x437bee[_0xd3ca('0x29')]=_['keys'](db[_0xd3ca('0x3b')][_0xd3ca('0x25')]);_0x437bee[_0xd3ca('0x2b')]=_['keys'](_0x264f97[_0xd3ca('0x2b')]);_0x437bee[_0xd3ca('0x2d')]=_[_0xd3ca('0x2e')](_0x437bee['model'],_0x437bee[_0xd3ca('0x2b')]);_0x167deb[_0xd3ca('0x2f')]=_['intersection'](_0x437bee['model'],qs[_0xd3ca('0x30')](_0x264f97[_0xd3ca('0x2b')]['fields']));_0x167deb[_0xd3ca('0x2f')]=_0x167deb[_0xd3ca('0x2f')][_0xd3ca('0x3f')]?_0x167deb['attributes']:_0x437bee[_0xd3ca('0x29')];if(_0x264f97[_0xd3ca('0x2b')]['includeAll']){_0x167deb[_0xd3ca('0x3a')]=[{'all':!![]}];}_0x167deb=_['merge']({},_0x167deb,_0x264f97[_0xd3ca('0x40')]);return db['SmsApplication'][_0xd3ca('0x41')](_0x167deb)['then'](handleEntityNotFound(_0x1e8e49,null))[_0xd3ca('0x21')](respondWithResult(_0x1e8e49,null))[_0xd3ca('0x3d')](handleError(_0x1e8e49,null));};exports[_0xd3ca('0x42')]=function(_0x3f5f92,_0x29219a){return db[_0xd3ca('0x3b')]['create'](_0x3f5f92[_0xd3ca('0x43')],{})['then'](respondWithResult(_0x29219a,0xc9))['catch'](handleError(_0x29219a,null));};exports['update']=function(_0x355b21,_0x4e97c3){if(_0x355b21[_0xd3ca('0x43')]['id']){delete _0x355b21[_0xd3ca('0x43')]['id'];}return db[_0xd3ca('0x3b')][_0xd3ca('0x41')]({'where':{'id':_0x355b21['params']['id']}})[_0xd3ca('0x21')](handleEntityNotFound(_0x4e97c3,null))['then'](saveUpdates(_0x355b21[_0xd3ca('0x43')],null))[_0xd3ca('0x21')](respondWithResult(_0x4e97c3,null))[_0xd3ca('0x3d')](handleError(_0x4e97c3,null));};exports[_0xd3ca('0x44')]=function(_0x4c9827,_0x5e146a){return db[_0xd3ca('0x3b')][_0xd3ca('0x41')]({'where':{'id':_0x4c9827[_0xd3ca('0x45')]['id']}})[_0xd3ca('0x21')](handleEntityNotFound(_0x5e146a,null))[_0xd3ca('0x21')](removeEntity(_0x5e146a,null))[_0xd3ca('0x3d')](handleError(_0x5e146a,null));}; \ No newline at end of file +var _0x800b=['fields','length','nolimit','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','params','rimraf','zip-dir','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','update','then','destroy','error','stack','send','index','SmsApplication','rawAttributes','type','model','map','name','query','keys','intersection','attributes'];(function(_0x236afd,_0x1f519b){var _0x2b0b11=function(_0x3ae148){while(--_0x3ae148){_0x236afd['push'](_0x236afd['shift']());}};_0x2b0b11(++_0x1f519b);}(_0x800b,0x186));var _0xb800=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x800b[_0x26f702];return _0x11417d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb800('0x0'));var zipdir=require(_0xb800('0x1'));var jsonpatch=require(_0xb800('0x2'));var rp=require(_0xb800('0x3'));var moment=require('moment');var BPromise=require(_0xb800('0x4'));var Mustache=require(_0xb800('0x5'));var util=require(_0xb800('0x6'));var path=require(_0xb800('0x7'));var sox=require(_0xb800('0x8'));var csv=require(_0xb800('0x9'));var ejs=require(_0xb800('0xa'));var fs=require('fs');var fs_extra=require(_0xb800('0xb'));var _=require(_0xb800('0xc'));var squel=require(_0xb800('0xd'));var crypto=require(_0xb800('0xe'));var jsforce=require(_0xb800('0xf'));var deskjs=require(_0xb800('0x10'));var toCsv=require(_0xb800('0x9'));var querystring=require(_0xb800('0x11'));var Papa=require(_0xb800('0x12'));var Redis=require('ioredis');var authService=require(_0xb800('0x13'));var qs=require(_0xb800('0x14'));var as=require(_0xb800('0x15'));var hardwareService=require(_0xb800('0x16'));var logger=require(_0xb800('0x17'))(_0xb800('0x18'));var utils=require('../../config/utils');var config=require(_0xb800('0x19'));var licenseUtil=require(_0xb800('0x1a'));var db=require(_0xb800('0x1b'))['db'];function respondWithStatusCode(_0x46a9e9,_0x229c48){_0x229c48=_0x229c48||0xcc;return function(_0x1769e7){if(_0x1769e7){return _0x46a9e9[_0xb800('0x1c')](_0x229c48);}return _0x46a9e9[_0xb800('0x1d')](_0x229c48)[_0xb800('0x1e')]();};}function respondWithResult(_0x1a09b3,_0x3656b6){_0x3656b6=_0x3656b6||0xc8;return function(_0x114a74){if(_0x114a74){return _0x1a09b3[_0xb800('0x1d')](_0x3656b6)[_0xb800('0x1f')](_0x114a74);}};}function respondWithFilteredResult(_0x3b2faa,_0x35edea){return function(_0x117bb8){if(_0x117bb8){var _0x54e84e=typeof _0x35edea[_0xb800('0x20')]==='undefined'&&typeof _0x35edea[_0xb800('0x21')]===_0xb800('0x22');var _0x5b6bc3=_0x117bb8[_0xb800('0x23')];var _0x321c3f=_0x54e84e?0x0:_0x35edea[_0xb800('0x20')];var _0x23db43=_0x54e84e?_0x117bb8['count']:_0x35edea['offset']+_0x35edea[_0xb800('0x21')];var _0x3a3446;if(_0x23db43>=_0x5b6bc3){_0x23db43=_0x5b6bc3;_0x3a3446=0xc8;}else{_0x3a3446=0xce;}_0x3b2faa[_0xb800('0x1d')](_0x3a3446);return _0x3b2faa['set']('Content-Range',_0x321c3f+'-'+_0x23db43+'/'+_0x5b6bc3)[_0xb800('0x1f')](_0x117bb8);}return null;};}function patchUpdates(_0x5864c1){return function(_0x1280b7){try{jsonpatch[_0xb800('0x24')](_0x1280b7,_0x5864c1,!![]);}catch(_0x3b4727){return BPromise['reject'](_0x3b4727);}return _0x1280b7['save']();};}function saveUpdates(_0xcaa322,_0x442d35){return function(_0x50d467){if(_0x50d467){return _0x50d467[_0xb800('0x25')](_0xcaa322)[_0xb800('0x26')](function(_0x3fe623){return _0x3fe623;});}return null;};}function removeEntity(_0x318a8e,_0x37995c){return function(_0x568556){if(_0x568556){return _0x568556[_0xb800('0x27')]()[_0xb800('0x26')](function(){_0x318a8e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3af299,_0x470780){return function(_0x267b7b){if(!_0x267b7b){_0x3af299[_0xb800('0x1c')](0x194);}return _0x267b7b;};}function handleError(_0x2ee2cd,_0x1658a0){_0x1658a0=_0x1658a0||0x1f4;return function(_0x334dc7){logger[_0xb800('0x28')](_0x334dc7[_0xb800('0x29')]);if(_0x334dc7['name']){delete _0x334dc7['name'];}_0x2ee2cd[_0xb800('0x1d')](_0x1658a0)[_0xb800('0x2a')](_0x334dc7);};}exports[_0xb800('0x2b')]=function(_0x331cd1,_0x2bed33){var _0x80c37a={},_0x4b2414={},_0x59c407={'count':0x0,'rows':[]};var _0x1edb4b=_['map'](db[_0xb800('0x2c')][_0xb800('0x2d')],function(_0x37ffed){return{'name':_0x37ffed['fieldName'],'type':_0x37ffed[_0xb800('0x2e')]['key']};});_0x4b2414[_0xb800('0x2f')]=_[_0xb800('0x30')](_0x1edb4b,_0xb800('0x31'));_0x4b2414[_0xb800('0x32')]=_[_0xb800('0x33')](_0x331cd1[_0xb800('0x32')]);_0x4b2414['filters']=_[_0xb800('0x34')](_0x4b2414[_0xb800('0x2f')],_0x4b2414[_0xb800('0x32')]);_0x80c37a[_0xb800('0x35')]=_[_0xb800('0x34')](_0x4b2414['model'],qs[_0xb800('0x36')](_0x331cd1[_0xb800('0x32')]['fields']));_0x80c37a[_0xb800('0x35')]=_0x80c37a[_0xb800('0x35')][_0xb800('0x37')]?_0x80c37a[_0xb800('0x35')]:_0x4b2414[_0xb800('0x2f')];if(!_0x331cd1[_0xb800('0x32')]['hasOwnProperty'](_0xb800('0x38'))){_0x80c37a[_0xb800('0x21')]=qs['limit'](_0x331cd1[_0xb800('0x32')]['limit']);_0x80c37a[_0xb800('0x20')]=qs[_0xb800('0x20')](_0x331cd1['query'][_0xb800('0x20')]);}_0x80c37a['order']=qs[_0xb800('0x39')](_0x331cd1[_0xb800('0x32')][_0xb800('0x39')]);_0x80c37a['where']=qs['filters'](_[_0xb800('0x3a')](_0x331cd1['query'],_0x4b2414[_0xb800('0x3b')]),_0x1edb4b);if(_0x331cd1['query'][_0xb800('0x3c')]){_0x80c37a[_0xb800('0x3d')]=_[_0xb800('0x3e')](_0x80c37a['where'],{'$or':_[_0xb800('0x30')](_0x1edb4b,function(_0x3b67ab){if(_0x3b67ab['type']!==_0xb800('0x3f')){var _0x204717={};_0x204717[_0x3b67ab[_0xb800('0x31')]]={'$like':'%'+_0x331cd1[_0xb800('0x32')][_0xb800('0x3c')]+'%'};return _0x204717;}})});}_0x80c37a=_[_0xb800('0x3e')]({},_0x80c37a,_0x331cd1[_0xb800('0x40')]);var _0x5361c4={'where':_0x80c37a[_0xb800('0x3d')]};return db['SmsApplication'][_0xb800('0x23')](_0x5361c4)[_0xb800('0x26')](function(_0x896643){_0x59c407[_0xb800('0x23')]=_0x896643;if(_0x331cd1['query'][_0xb800('0x41')]){_0x80c37a[_0xb800('0x42')]=[{'all':!![]}];}return db['SmsApplication'][_0xb800('0x43')](_0x80c37a);})[_0xb800('0x26')](function(_0x29fad1){_0x59c407['rows']=_0x29fad1;return _0x59c407;})[_0xb800('0x26')](respondWithFilteredResult(_0x2bed33,_0x80c37a))[_0xb800('0x44')](handleError(_0x2bed33,null));};exports[_0xb800('0x45')]=function(_0x1afdf7,_0x49fcd9){var _0x2099d1={'raw':!![],'where':{'id':_0x1afdf7['params']['id']}},_0x16fea7={};_0x16fea7[_0xb800('0x2f')]=_[_0xb800('0x33')](db[_0xb800('0x2c')][_0xb800('0x2d')]);_0x16fea7[_0xb800('0x32')]=_[_0xb800('0x33')](_0x1afdf7['query']);_0x16fea7['filters']=_[_0xb800('0x34')](_0x16fea7['model'],_0x16fea7[_0xb800('0x32')]);_0x2099d1[_0xb800('0x35')]=_['intersection'](_0x16fea7['model'],qs[_0xb800('0x36')](_0x1afdf7[_0xb800('0x32')][_0xb800('0x36')]));_0x2099d1[_0xb800('0x35')]=_0x2099d1[_0xb800('0x35')][_0xb800('0x37')]?_0x2099d1[_0xb800('0x35')]:_0x16fea7[_0xb800('0x2f')];if(_0x1afdf7[_0xb800('0x32')][_0xb800('0x41')]){_0x2099d1[_0xb800('0x42')]=[{'all':!![]}];}_0x2099d1=_[_0xb800('0x3e')]({},_0x2099d1,_0x1afdf7[_0xb800('0x40')]);return db[_0xb800('0x2c')][_0xb800('0x46')](_0x2099d1)[_0xb800('0x26')](handleEntityNotFound(_0x49fcd9,null))[_0xb800('0x26')](respondWithResult(_0x49fcd9,null))[_0xb800('0x44')](handleError(_0x49fcd9,null));};exports[_0xb800('0x47')]=function(_0xebf195,_0x4b1b4a){return db[_0xb800('0x2c')][_0xb800('0x47')](_0xebf195[_0xb800('0x48')],{})[_0xb800('0x26')](respondWithResult(_0x4b1b4a,0xc9))[_0xb800('0x44')](handleError(_0x4b1b4a,null));};exports[_0xb800('0x25')]=function(_0x398d55,_0x29a3c0){if(_0x398d55[_0xb800('0x48')]['id']){delete _0x398d55[_0xb800('0x48')]['id'];}return db[_0xb800('0x2c')][_0xb800('0x46')]({'where':{'id':_0x398d55[_0xb800('0x49')]['id']}})[_0xb800('0x26')](handleEntityNotFound(_0x29a3c0,null))[_0xb800('0x26')](saveUpdates(_0x398d55['body'],null))[_0xb800('0x26')](respondWithResult(_0x29a3c0,null))[_0xb800('0x44')](handleError(_0x29a3c0,null));};exports[_0xb800('0x27')]=function(_0x1123f5,_0x54068a){return db[_0xb800('0x2c')][_0xb800('0x46')]({'where':{'id':_0x1123f5['params']['id']}})[_0xb800('0x26')](handleEntityNotFound(_0x54068a,null))[_0xb800('0x26')](removeEntity(_0x54068a,null))[_0xb800('0x44')](handleError(_0x54068a,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 7f75cb0..a37f732 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 _0x25f3=['./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x21a84c,_0xa71138){var _0x26eeca=function(_0x29bc84){while(--_0x29bc84){_0x21a84c['push'](_0x21a84c['shift']());}};_0x26eeca(++_0xa71138);}(_0x25f3,0xd8));var _0x325f=function(_0x25d862,_0x4bd277){_0x25d862=_0x25d862-0x0;var _0x43621c=_0x25f3[_0x25d862];return _0x43621c;};'use strict';var _=require('lodash');var util=require(_0x325f('0x0'));var logger=require(_0x325f('0x1'))(_0x325f('0x2'));var moment=require(_0x325f('0x3'));var BPromise=require(_0x325f('0x4'));var rp=require(_0x325f('0x5'));var fs=require('fs');var path=require(_0x325f('0x6'));var rimraf=require('rimraf');var config=require(_0x325f('0x7'));var attributes=require(_0x325f('0x8'));module[_0x325f('0x9')]=function(_0x49bf12,_0x2ce46a){return _0x49bf12['define'](_0x325f('0xa'),attributes,{'tableName':_0x325f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x325f('0xc'),'collate':_0x325f('0xd')});}; \ No newline at end of file +var _0x802c=['request-promise','path','../../config/environment','./smsApplication.attributes','exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird'];(function(_0x1c8dce,_0x2fe0cc){var _0x31a1c1=function(_0x4a60f2){while(--_0x4a60f2){_0x1c8dce['push'](_0x1c8dce['shift']());}};_0x31a1c1(++_0x2fe0cc);}(_0x802c,0x1dd));var _0xc802=function(_0x15318c,_0x2e50e4){_0x15318c=_0x15318c-0x0;var _0x10d3ce=_0x802c[_0x15318c];return _0x10d3ce;};'use strict';var _=require(_0xc802('0x0'));var util=require(_0xc802('0x1'));var logger=require(_0xc802('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc802('0x3'));var rp=require(_0xc802('0x4'));var fs=require('fs');var path=require(_0xc802('0x5'));var rimraf=require('rimraf');var config=require(_0xc802('0x6'));var attributes=require(_0xc802('0x7'));module[_0xc802('0x8')]=function(_0x4157c5,_0x399225){return _0x4157c5[_0xc802('0x9')]('SmsApplication',attributes,{'tableName':_0xc802('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc802('0xb'),'collate':_0xc802('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index fa59fa0..c7131bf 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 _0x8ba6=['ioredis','../../mysqldb','../../config/utils','../../config/environment','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','lodash','moment','randomstring'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8ba6,0x11b));var _0x68ba=function(_0xe04d4a,_0x2f3333){_0xe04d4a=_0xe04d4a-0x0;var _0x1d4b1c=_0x8ba6[_0xe04d4a];return _0x1d4b1c;};'use strict';var _=require(_0x68ba('0x0'));var util=require('util');var moment=require(_0x68ba('0x1'));var BPromise=require('bluebird');var rs=require(_0x68ba('0x2'));var fs=require('fs');var Redis=require(_0x68ba('0x3'));var db=require(_0x68ba('0x4'))['db'];var utils=require(_0x68ba('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x68ba('0x6'));var jayson=require(_0x68ba('0x7'));var client=jayson[_0x68ba('0x8')][_0x68ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ad848,_0x1ba7fa,_0x97b7a){return new BPromise(function(_0xc67bf0,_0x5aa5bd){return client[_0x68ba('0xa')](_0x2ad848,_0x97b7a)[_0x68ba('0xb')](function(_0x1ec922){logger[_0x68ba('0xc')](_0x68ba('0xd'),_0x1ba7fa,_0x68ba('0xe'));logger[_0x68ba('0xf')](_0x68ba('0x10'),_0x1ba7fa,_0x68ba('0xe'),JSON[_0x68ba('0x11')](_0x1ec922));if(_0x1ec922['error']){if(_0x1ec922[_0x68ba('0x12')][_0x68ba('0x13')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x1ba7fa,_0x1ec922[_0x68ba('0x12')]['message']);return _0x5aa5bd(_0x1ec922[_0x68ba('0x12')][_0x68ba('0x14')]);}logger[_0x68ba('0x12')](_0x68ba('0xd'),_0x1ba7fa,_0x1ec922[_0x68ba('0x12')][_0x68ba('0x14')]);return _0xc67bf0(_0x1ec922[_0x68ba('0x12')]['message']);}else{logger[_0x68ba('0xc')](_0x68ba('0xd'),_0x1ba7fa,_0x68ba('0xe'));_0xc67bf0(_0x1ec922[_0x68ba('0x15')][_0x68ba('0x14')]);}})['catch'](function(_0x2babf4){logger[_0x68ba('0x12')]('SmsApplication,\x20%s,\x20%s',_0x1ba7fa,_0x2babf4);_0x5aa5bd(_0x2babf4);});});} \ No newline at end of file +var _0xb2af=['../../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','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb2af,0xd2));var _0xfb2a=function(_0x32334d,_0x28a839){_0x32334d=_0x32334d-0x0;var _0x33b0f6=_0xb2af[_0x32334d];return _0x33b0f6;};'use strict';var _=require(_0xfb2a('0x0'));var util=require(_0xfb2a('0x1'));var moment=require(_0xfb2a('0x2'));var BPromise=require(_0xfb2a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb2a('0x4'));var db=require(_0xfb2a('0x5'))['db'];var utils=require(_0xfb2a('0x6'));var logger=require(_0xfb2a('0x7'))(_0xfb2a('0x8'));var config=require('../../config/environment');var jayson=require(_0xfb2a('0x9'));var client=jayson[_0xfb2a('0xa')][_0xfb2a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55cf25,_0x715404,_0x3e20de){return new BPromise(function(_0x1f3315,_0x55bb4e){return client[_0xfb2a('0xc')](_0x55cf25,_0x3e20de)[_0xfb2a('0xd')](function(_0x3d3333){logger[_0xfb2a('0xe')](_0xfb2a('0xf'),_0x715404,_0xfb2a('0x10'));logger[_0xfb2a('0x11')](_0xfb2a('0x12'),_0x715404,_0xfb2a('0x10'),JSON[_0xfb2a('0x13')](_0x3d3333));if(_0x3d3333[_0xfb2a('0x14')]){if(_0x3d3333[_0xfb2a('0x14')]['code']===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x715404,_0x3d3333[_0xfb2a('0x14')][_0xfb2a('0x15')]);return _0x55bb4e(_0x3d3333[_0xfb2a('0x14')][_0xfb2a('0x15')]);}logger['error'](_0xfb2a('0xf'),_0x715404,_0x3d3333['error']['message']);return _0x1f3315(_0x3d3333[_0xfb2a('0x14')]['message']);}else{logger['info'](_0xfb2a('0xf'),_0x715404,_0xfb2a('0x10'));_0x1f3315(_0x3d3333[_0xfb2a('0x16')][_0xfb2a('0x15')]);}})[_0xfb2a('0x17')](function(_0xc85abf){logger[_0xfb2a('0x14')](_0xfb2a('0xf'),_0x715404,_0xc85abf);_0x55bb4e(_0xc85abf);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 0a4888c..41c5dae 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 _0xefda=['../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','/:id','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','sms','addTags','put','smsinteraction:update','update','smsinteraction:destroy','destroy','removeTags','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3a15c2,_0x1ee6b3){var _0x39aa74=function(_0x55dcc9){while(--_0x55dcc9){_0x3a15c2['push'](_0x3a15c2['shift']());}};_0x39aa74(++_0x1ee6b3);}(_0xefda,0x96));var _0xaefd=function(_0x14e0bd,_0x506b0e){_0x14e0bd=_0x14e0bd-0x0;var _0x3b01dc=_0xefda[_0x14e0bd];return _0x3b01dc;};'use strict';var multer=require(_0xaefd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaefd('0x1'));var express=require(_0xaefd('0x2'));var router=express['Router']();var fs_extra=require(_0xaefd('0x3'));var auth=require(_0xaefd('0x4'));var interaction=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var controller=require(_0xaefd('0x7'));router[_0xaefd('0x8')]('/',auth['isAuthenticated'](),controller[_0xaefd('0x9')]);router[_0xaefd('0x8')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller['describe']);router[_0xaefd('0x8')](_0xaefd('0xc'),auth[_0xaefd('0xb')](),controller['show']);router['get']('/:id/messages',auth[_0xaefd('0xb')](),controller[_0xaefd('0xd')]);router[_0xaefd('0x8')](_0xaefd('0xe'),auth[_0xaefd('0xb')](),controller[_0xaefd('0xf')]);router[_0xaefd('0x10')]('/',auth[_0xaefd('0xb')](),controller[_0xaefd('0x11')]);router[_0xaefd('0x10')](_0xaefd('0x12'),auth['isAuthenticated'](),controller[_0xaefd('0x13')]);router['post'](_0xaefd('0x14'),auth[_0xaefd('0xb')](),interaction[_0xaefd('0x15')](_0xaefd('0x16'),'smsinteraction:addtags'),controller[_0xaefd('0x17')]);router[_0xaefd('0x18')](_0xaefd('0xc'),auth[_0xaefd('0xb')](),interaction[_0xaefd('0x15')](_0xaefd('0x16'),_0xaefd('0x19')),controller[_0xaefd('0x1a')]);router['delete'](_0xaefd('0xc'),auth[_0xaefd('0xb')](),interaction[_0xaefd('0x15')](_0xaefd('0x16'),_0xaefd('0x1b')),controller[_0xaefd('0x1c')]);router['delete'](_0xaefd('0x14'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x1d')]);module[_0xaefd('0x1e')]=router; \ No newline at end of file +var _0xe605=['./smsInteraction.controller','get','isAuthenticated','index','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','/:id','update','delete','smsinteraction:destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5553a7,_0x3a8ee5){var _0x20c966=function(_0x356a6b){while(--_0x356a6b){_0x5553a7['push'](_0x5553a7['shift']());}};_0x20c966(++_0x3a8ee5);}(_0xe605,0x92));var _0x5e60=function(_0x2d2542,_0x36bfbe){_0x2d2542=_0x2d2542-0x0;var _0x332e1c=_0xe605[_0x2d2542];return _0x332e1c;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var fs_extra=require(_0x5e60('0x5'));var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')]('/describe',auth[_0x5e60('0xb')](),controller['describe']);router['get']('/:id',auth[_0x5e60('0xb')](),controller[_0x5e60('0xd')]);router[_0x5e60('0xa')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0xf')]);router['get'](_0x5e60('0x10'),auth['isAuthenticated'](),controller[_0x5e60('0x11')]);router[_0x5e60('0x12')]('/',auth[_0x5e60('0xb')](),controller['create']);router[_0x5e60('0x12')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x13')]);router[_0x5e60('0x12')](_0x5e60('0x14'),auth['isAuthenticated'](),interaction[_0x5e60('0x15')](_0x5e60('0x16'),_0x5e60('0x17')),controller[_0x5e60('0x18')]);router['put'](_0x5e60('0x19'),auth['isAuthenticated'](),interaction[_0x5e60('0x15')](_0x5e60('0x16'),'smsinteraction:update'),controller[_0x5e60('0x1a')]);router[_0x5e60('0x1b')](_0x5e60('0x19'),auth[_0x5e60('0xb')](),interaction['tracked'](_0x5e60('0x16'),_0x5e60('0x1c')),controller['destroy']);router[_0x5e60('0x1b')](_0x5e60('0x14'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x1d')]);module[_0x5e60('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 87fd0a7..bb9fedf 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 _0x2250=['exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize','moment'];(function(_0xffa246,_0x2b5b62){var _0x35d446=function(_0x363e73){while(--_0x363e73){_0xffa246['push'](_0xffa246['shift']());}};_0x35d446(++_0x2b5b62);}(_0x2250,0x178));var _0x0225=function(_0xfab345,_0x43fc6e){_0xfab345=_0xfab345-0x0;var _0x1a60fd=_0x2250[_0xfab345];return _0x1a60fd;};'use strict';var Sequelize=require(_0x0225('0x0'));var moment=require(_0x0225('0x1'));module[_0x0225('0x2')]={'closed':{'type':Sequelize[_0x0225('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0225('0x4')]},'disposition':{'type':Sequelize[_0x0225('0x5')]},'secondDisposition':{'type':Sequelize[_0x0225('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0225('0x5')]},'phone':{'type':Sequelize[_0x0225('0x5')]},'read1stAt':{'type':Sequelize[_0x0225('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x0225('0x6')]('in',_0x0225('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0225('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x0225('0x6')]('in',_0x0225('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x0225('0x8')]}}; \ No newline at end of file +var _0x2da6=['sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER'];(function(_0x17b883,_0xe20c9){var _0x9dabb0=function(_0x3f2d02){while(--_0x3f2d02){_0x17b883['push'](_0x17b883['shift']());}};_0x9dabb0(++_0xe20c9);}(_0x2da6,0x1dd));var _0x62da=function(_0xa122d7,_0x18afa3){_0xa122d7=_0xa122d7-0x0;var _0x51452a=_0x2da6[_0xa122d7];return _0x51452a;};'use strict';var Sequelize=require(_0x62da('0x0'));var moment=require(_0x62da('0x1'));module[_0x62da('0x2')]={'closed':{'type':Sequelize[_0x62da('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x62da('0x4')]},'disposition':{'type':Sequelize[_0x62da('0x5')]},'secondDisposition':{'type':Sequelize[_0x62da('0x5')]},'thirdDisposition':{'type':Sequelize[_0x62da('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x62da('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x62da('0x6')]('in',_0x62da('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x62da('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x62da('0x6')]('in',_0x62da('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x62da('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x62da('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 22e3870..c285124 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 _0xc5ca=['direction','out','System','firstName','lastName','value','renderFile','views','transcript-','createPdfFromHTML','log','zip-dir','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','status','end','json','offset','limit','undefined','count','update','then','destroy','sendStatus','error','stack','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','user','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','options','find','create','body','describe','addMessage','SmsMessage','ids','omit','findOne','hasOwnProperty','order','sort','where','pick','SmsInteractionId','filter','merge','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','root','server','format','join','push','User','fullname','CmContact','Contact','Messages','secret','read','Account','name','Owner','get','Sms','N.A.','createdAt','closed','closedAt','disposition'];(function(_0x21f931,_0x598b2d){var _0x3f083c=function(_0x1c7c49){while(--_0x1c7c49){_0x21f931['push'](_0x21f931['shift']());}};_0x3f083c(++_0x598b2d);}(_0xc5ca,0x1d7));var _0xac5c=function(_0x4c4624,_0x888a3b){_0x4c4624=_0x4c4624-0x0;var _0x57ee00=_0xc5ca[_0x4c4624];return _0x57ee00;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xac5c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xac5c('0x1'));var path=require('path');var ejs=require(_0xac5c('0x2'));var fs=require('fs');var _=require(_0xac5c('0x3'));var Redis=require(_0xac5c('0x4'));var interaction=require(_0xac5c('0x5'));var qs=require(_0xac5c('0x6'));var pdf=require(_0xac5c('0x7'));var logger=require(_0xac5c('0x8'))(_0xac5c('0x9'));var config=require(_0xac5c('0xa'));var db=require(_0xac5c('0xb'))['db'];config[_0xac5c('0xc')]=_[_0xac5c('0xd')](config[_0xac5c('0xc')],{'host':_0xac5c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac5c('0xc')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x2d1ce3,_0x52c84e){_0x52c84e=_0x52c84e||0xcc;return function(_0x389892){if(_0x389892){return _0x2d1ce3['sendStatus'](_0x52c84e);}return _0x2d1ce3[_0xac5c('0xf')](_0x52c84e)[_0xac5c('0x10')]();};}function respondWithResult(_0x2e2b21,_0x5e472b){_0x5e472b=_0x5e472b||0xc8;return function(_0x5f8f5d){if(_0x5f8f5d){return _0x2e2b21[_0xac5c('0xf')](_0x5e472b)[_0xac5c('0x11')](_0x5f8f5d);}};}function respondWithFilteredResult(_0x1dbba3,_0x2f0c02){return function(_0x8fa94b){if(_0x8fa94b){var _0x2f4204=typeof _0x2f0c02[_0xac5c('0x12')]==='undefined'&&typeof _0x2f0c02[_0xac5c('0x13')]===_0xac5c('0x14');var _0x2df80c=_0x8fa94b['count'];var _0xf6b95d=_0x2f4204?0x0:_0x2f0c02[_0xac5c('0x12')];var _0x458f09=_0x2f4204?_0x8fa94b[_0xac5c('0x15')]:_0x2f0c02['offset']+_0x2f0c02[_0xac5c('0x13')];var _0x470cb3;if(_0x458f09>=_0x2df80c){_0x458f09=_0x2df80c;_0x470cb3=0xc8;}else{_0x470cb3=0xce;}_0x1dbba3['status'](_0x470cb3);return _0x1dbba3['set']('Content-Range',_0xf6b95d+'-'+_0x458f09+'/'+_0x2df80c)['json'](_0x8fa94b);}return null;};}function saveUpdates(_0x5b8a78){return function(_0x524116){if(_0x524116){return _0x524116[_0xac5c('0x16')](_0x5b8a78)[_0xac5c('0x17')](function(_0x5b24a0){return _0x5b24a0;});}return null;};}function removeEntity(_0x4403e1){return function(_0x4cd7ee){if(_0x4cd7ee){return _0x4cd7ee[_0xac5c('0x18')]()[_0xac5c('0x17')](function(){_0x4403e1[_0xac5c('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59a078){return function(_0x48c2de){if(!_0x48c2de){_0x59a078[_0xac5c('0x19')](0x194);}return _0x48c2de;};}function handleError(_0xd1d1c4,_0x120c44){_0x120c44=_0x120c44||0x1f4;return function(_0x25e9ab){logger[_0xac5c('0x1a')](_0x25e9ab[_0xac5c('0x1b')]);if(_0x25e9ab['name']){delete _0x25e9ab['name'];}_0xd1d1c4[_0xac5c('0xf')](_0x120c44)['send'](_0x25e9ab);};}exports[_0xac5c('0x1c')]=function(_0x4dbb6f,_0xf5a3){var _0x48086d={};var _0x351668=_[_0xac5c('0x1d')](db[_0xac5c('0x1e')][_0xac5c('0x1f')],function(_0x584989){return{'name':_0x584989[_0xac5c('0x20')],'type':_0x584989[_0xac5c('0x21')][_0xac5c('0x22')]};});_0x48086d=qs[_0xac5c('0x23')](_0x351668,_0x4dbb6f);return interaction[_0xac5c('0x24')](_0xac5c('0x25'),_0x4dbb6f[_0xac5c('0x26')],_0x4dbb6f[_0xac5c('0x27')],_0x48086d,_0x351668)[_0xac5c('0x17')](respondWithFilteredResult(_0xf5a3,_0x48086d))[_0xac5c('0x28')](handleError(_0xf5a3,null));};exports[_0xac5c('0x29')]=function(_0xd47f10,_0x5baae6){var _0x49f4de={'raw':![],'where':{'id':_0xd47f10[_0xac5c('0x2a')]['id']}},_0x694be0={};_0x694be0[_0xac5c('0x2b')]=_[_0xac5c('0x2c')](db['SmsInteraction'][_0xac5c('0x1f')]);_0x694be0[_0xac5c('0x26')]=_[_0xac5c('0x2c')](_0xd47f10[_0xac5c('0x26')]);_0x694be0[_0xac5c('0x2d')]=_[_0xac5c('0x2e')](_0x694be0[_0xac5c('0x2b')],_0x694be0['query']);_0x49f4de['attributes']=_[_0xac5c('0x2e')](_0x694be0[_0xac5c('0x2b')],qs['fields'](_0xd47f10[_0xac5c('0x26')][_0xac5c('0x2f')]));_0x49f4de[_0xac5c('0x30')]=_0x49f4de[_0xac5c('0x30')][_0xac5c('0x31')]?_0x49f4de[_0xac5c('0x30')]:_0x694be0[_0xac5c('0x2b')];if(_0xd47f10[_0xac5c('0x26')][_0xac5c('0x32')]){_0x49f4de[_0xac5c('0x33')]=[{'all':!![]}];}_0x49f4de=_['merge']({},_0x49f4de,_0xd47f10[_0xac5c('0x34')]);return db[_0xac5c('0x1e')][_0xac5c('0x35')](_0x49f4de)[_0xac5c('0x17')](handleEntityNotFound(_0x5baae6,null))[_0xac5c('0x17')](respondWithResult(_0x5baae6,null))[_0xac5c('0x28')](handleError(_0x5baae6,null));};exports[_0xac5c('0x36')]=function(_0x401d24,_0x15dfcf){return db[_0xac5c('0x1e')][_0xac5c('0x36')](_0x401d24[_0xac5c('0x37')],{})[_0xac5c('0x17')](respondWithResult(_0x15dfcf,0xc9))[_0xac5c('0x28')](handleError(_0x15dfcf,null));};exports[_0xac5c('0x16')]=function(_0x3baba5,_0x22d43){if(_0x3baba5[_0xac5c('0x37')]['id']){delete _0x3baba5[_0xac5c('0x37')]['id'];}return db[_0xac5c('0x1e')]['find']({'where':{'id':_0x3baba5['params']['id']}})[_0xac5c('0x17')](handleEntityNotFound(_0x22d43,null))[_0xac5c('0x17')](saveUpdates(_0x3baba5[_0xac5c('0x37')],null))[_0xac5c('0x17')](respondWithResult(_0x22d43,null))[_0xac5c('0x28')](handleError(_0x22d43,null));};exports[_0xac5c('0x18')]=function(_0x5ac1c9,_0x41d63d){return db['SmsInteraction'][_0xac5c('0x35')]({'where':{'id':_0x5ac1c9[_0xac5c('0x2a')]['id']}})[_0xac5c('0x17')](handleEntityNotFound(_0x41d63d,null))[_0xac5c('0x17')](removeEntity(_0x41d63d,null))['catch'](handleError(_0x41d63d,null));};exports[_0xac5c('0x38')]=function(_0xd546f5,_0x39a757){return db[_0xac5c('0x1e')]['describe']()['then'](respondWithResult(_0x39a757,null))[_0xac5c('0x28')](handleError(_0x39a757,null));};exports[_0xac5c('0x39')]=function(_0x71ba5e,_0x5a172b){return db[_0xac5c('0x3a')]['find']({'where':{'id':_0x71ba5e[_0xac5c('0x2a')]['id']}})[_0xac5c('0x17')](handleEntityNotFound(_0x5a172b,null))[_0xac5c('0x17')](function(_0x4c8c82){if(_0x4c8c82){return _0x4c8c82[_0xac5c('0x39')](_0x71ba5e[_0xac5c('0x37')][_0xac5c('0x3b')],_[_0xac5c('0x3c')](_0x71ba5e[_0xac5c('0x37')],[_0xac5c('0x3b'),'id'])||{});}})[_0xac5c('0x17')](respondWithResult(_0x5a172b,null))[_0xac5c('0x28')](handleError(_0x5a172b,null));};exports['getMessages']=function(_0x38e6df,_0x4db638){var _0x20d8da={'raw':![],'where':{}};var _0x181330={};var _0x5665d6={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xac5c('0x3d')]({'where':{'id':_0x38e6df[_0xac5c('0x2a')]['id']}})[_0xac5c('0x17')](handleEntityNotFound(_0x4db638,null))[_0xac5c('0x17')](function(_0x18ad8a){if(_0x18ad8a){_0x181330['model']=_['keys'](db[_0xac5c('0x3a')][_0xac5c('0x1f')]);_0x181330[_0xac5c('0x26')]=_['keys'](_0x38e6df['query']);_0x181330[_0xac5c('0x2d')]=_[_0xac5c('0x2e')](_0x181330[_0xac5c('0x2b')],_0x181330[_0xac5c('0x26')]);_0x20d8da[_0xac5c('0x30')]=_[_0xac5c('0x2e')](_0x181330[_0xac5c('0x2b')],qs[_0xac5c('0x2f')](_0x38e6df[_0xac5c('0x26')][_0xac5c('0x2f')]));_0x20d8da[_0xac5c('0x30')]=_0x20d8da[_0xac5c('0x30')][_0xac5c('0x31')]?_0x20d8da['attributes']:_0x181330[_0xac5c('0x2b')];if(!_0x38e6df['query'][_0xac5c('0x3e')]('nolimit')){_0x20d8da[_0xac5c('0x13')]=qs[_0xac5c('0x13')](_0x38e6df[_0xac5c('0x26')][_0xac5c('0x13')]);_0x20d8da[_0xac5c('0x12')]=qs['offset'](_0x38e6df[_0xac5c('0x26')][_0xac5c('0x12')]);}_0x20d8da[_0xac5c('0x3f')]=qs[_0xac5c('0x40')](_0x38e6df[_0xac5c('0x26')]['sort']);_0x20d8da[_0xac5c('0x41')]=qs[_0xac5c('0x2d')](_[_0xac5c('0x42')](_0x38e6df[_0xac5c('0x26')],_0x181330[_0xac5c('0x2d')]));_0x20d8da['where'][_0xac5c('0x43')]=_0x18ad8a['id'];if(_0x38e6df['query'][_0xac5c('0x44')]){_0x20d8da[_0xac5c('0x41')]=_[_0xac5c('0x45')](_0x20d8da[_0xac5c('0x41')],{'$or':_[_0xac5c('0x1d')](_0x20d8da[_0xac5c('0x30')],function(_0x58c75e){var _0x38744c={};_0x38744c[_0x58c75e]={'$like':'%'+_0x38e6df[_0xac5c('0x26')][_0xac5c('0x44')]+'%'};return _0x38744c;})});}if(_0x38e6df[_0xac5c('0x26')][_0xac5c('0x46')]){var _0x203499=_0x38e6df[_0xac5c('0x26')]['$gte']['split'](',');var _0x128b1e={};_0x128b1e[_0x203499[0x0]]={'$gte':moment(_0x203499[0x1])['format'](_0xac5c('0x47'))};_0x20d8da[_0xac5c('0x41')]=_[_0xac5c('0x45')](_0x20d8da[_0xac5c('0x41')],_0x128b1e);}_0x20d8da=_['merge']({},_0x20d8da,_0x38e6df['options']);return db['SmsMessage'][_0xac5c('0x15')]({'where':_0x20d8da[_0xac5c('0x41')]})[_0xac5c('0x17')](function(_0x526d47){_0x5665d6[_0xac5c('0x15')]=_0x526d47;if(_0x38e6df[_0xac5c('0x26')][_0xac5c('0x32')]){_0x20d8da['include']=[{'all':!![]}];}return db[_0xac5c('0x3a')][_0xac5c('0x24')](_0x20d8da);})[_0xac5c('0x17')](function(_0x50c912){_0x5665d6[_0xac5c('0x48')]=_0x50c912;return _0x5665d6;});}})['then'](respondWithFilteredResult(_0x4db638,_0x20d8da))[_0xac5c('0x28')](handleError(_0x4db638,null));};exports['addTags']=function(_0x4f6ced,_0x40213e){return db['SmsInteraction'][_0xac5c('0x35')]({'where':{'id':_0x4f6ced[_0xac5c('0x2a')]['id']}})[_0xac5c('0x17')](handleEntityNotFound(_0x40213e,null))[_0xac5c('0x17')](function(_0x214a4e){if(_0x214a4e){return _0x214a4e['setTags'](_0x4f6ced['body'][_0xac5c('0x3b')],_[_0xac5c('0x3c')](_0x4f6ced[_0xac5c('0x37')],[_0xac5c('0x3b'),'id'])||{})[_0xac5c('0x49')](function(){return db[_0xac5c('0x4a')]['findAll']({'attributes':['id','name',_0xac5c('0x4b')],'where':{'id':_0x4f6ced[_0xac5c('0x37')]['ids']}});})['then'](function(_0x21addc){socket[_0xac5c('0x4c')](_0xac5c('0x4d'),{'id':Number(_0x4f6ced[_0xac5c('0x2a')]['id']),'tags':_0x21addc||[]});return{'id':Number(_0x4f6ced['params']['id']),'tags':_0x21addc||[]};});}})[_0xac5c('0x17')](respondWithResult(_0x40213e,null))[_0xac5c('0x28')](handleError(_0x40213e,null));};exports[_0xac5c('0x4e')]=function(_0x580aaf,_0xb6ee9f){return db['SmsInteraction'][_0xac5c('0x35')]({'where':{'id':_0x580aaf['params']['id']}})[_0xac5c('0x17')](handleEntityNotFound(_0xb6ee9f,null))[_0xac5c('0x17')](function(_0xd087c3){if(_0xd087c3){return _0xd087c3[_0xac5c('0x4e')](_0x580aaf[_0xac5c('0x26')][_0xac5c('0x3b')]);}})[_0xac5c('0x17')](respondWithStatusCode(_0xb6ee9f,null))[_0xac5c('0x28')](handleError(_0xb6ee9f,null));};exports[_0xac5c('0x4f')]=function(_0x222ae8,_0x44170f){var _0x423d3e=moment()[_0xac5c('0x50')]()[_0xac5c('0x51')]();var _0x229208=path['join'](config[_0xac5c('0x52')],_0xac5c('0x53'),'files','tmp');var _0x42a9dd=path['join'](_0x229208,_0x423d3e);var _0xfc257e=util[_0xac5c('0x54')]('transcript-%d-%s.zip',_0x222ae8[_0xac5c('0x2a')]['id'],_0x423d3e);var _0xc9c9bc=path[_0xac5c('0x55')](_0x229208,_0xfc257e);var _0x14d45f=[];_0x14d45f[_0xac5c('0x56')]({'model':db['User'],'as':_0xac5c('0x57'),'attributes':['id',_0xac5c('0x58')],'raw':!![]});_0x14d45f[_0xac5c('0x56')]({'model':db[_0xac5c('0x59')],'as':_0xac5c('0x5a'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x48e47d=[{'model':db[_0xac5c('0x3a')],'as':_0xac5c('0x5b'),'attributes':['id',_0xac5c('0x37'),'createdAt','direction',_0xac5c('0x5c'),_0xac5c('0x5d')],'include':_0x14d45f}];_0x48e47d[_0xac5c('0x56')]({'model':db['SmsAccount'],'as':_0xac5c('0x5e'),'attributes':['id',_0xac5c('0x5f')]});_0x48e47d[_0xac5c('0x56')]({'model':db[_0xac5c('0x57')],'as':_0xac5c('0x60'),'attributes':['id',_0xac5c('0x58')]});return db[_0xac5c('0x1e')][_0xac5c('0x35')]({'where':{'id':_0x222ae8[_0xac5c('0x2a')]['id']},'include':_0x48e47d})[_0xac5c('0x17')](handleEntityNotFound(_0x44170f,null))[_0xac5c('0x17')](function(_0x5769aa){if(_0x5769aa){var _0x2ae7d5=_0x5769aa[_0xac5c('0x61')]({'plain':!![]});fs['mkdirSync'](_0x42a9dd);var _0x48be6c={'channel':_0xac5c('0x62'),'account':_0x2ae7d5['Account'][_0xac5c('0x5f')],'agent':_0x2ae7d5['Owner']?_0x2ae7d5[_0xac5c('0x60')][_0xac5c('0x58')]:_0xac5c('0x63'),'createdAt':moment(_0x2ae7d5[_0xac5c('0x64')])[_0xac5c('0x54')](_0xac5c('0x47'))['toString'](),'closedAt':_0x2ae7d5[_0xac5c('0x65')]?moment(_0x2ae7d5[_0xac5c('0x66')])['format'](_0xac5c('0x47'))[_0xac5c('0x51')]():'','disposition':_0x2ae7d5[_0xac5c('0x67')],'messages':_(_0x2ae7d5['Messages'])['filter']({'secret':![]})[_0xac5c('0x1d')](function(_0x4392dc){return{'date':moment(_0x4392dc['createdAt'])[_0xac5c('0x54')](_0xac5c('0x47'))[_0xac5c('0x51')](),'sender':_0x4392dc[_0xac5c('0x68')]===_0xac5c('0x69')?_0x4392dc[_0xac5c('0x57')]?_0x4392dc[_0xac5c('0x57')][_0xac5c('0x58')]:_0xac5c('0x6a'):_0x4392dc[_0xac5c('0x5a')][_0xac5c('0x6b')]+(_0x4392dc['Contact'][_0xac5c('0x6c')]?'\x20'+_0x4392dc[_0xac5c('0x5a')][_0xac5c('0x6c')]:''),'body':_0x4392dc['body'],'direction':_0x4392dc[_0xac5c('0x68')]==='out'?'A':'C','secret':_0x4392dc[_0xac5c('0x5c')],'read':_0x4392dc['read']};})[_0xac5c('0x6d')]()};return ejs[_0xac5c('0x6e')](path[_0xac5c('0x55')](config['root'],_0xac5c('0x53'),_0xac5c('0x6f'),'downloadInteraction.ejs'),{'interaction':_0x48be6c})[_0xac5c('0x17')](function(_0x46e765){var _0x1ae25c=path[_0xac5c('0x55')](_0x42a9dd,_0xac5c('0x70')+_0x2ae7d5['id']+'-'+_0x423d3e+'.pdf');var _0x5acf33={'path':_0x1ae25c,'channel':_0xac5c('0x62'),'interactionId':_0x2ae7d5['id']};return pdf[_0xac5c('0x71')](_0x46e765,_0x5acf33);})[_0xac5c('0x17')](function(){return new BPromise(function(_0x2efdf5,_0x16ddc0){zipdir(_0x42a9dd,{'saveTo':_0xc9c9bc},function(_0x4cdca2,_0x5296df){if(_0x4cdca2)return _0x16ddc0(_0x4cdca2);return _0x2efdf5(_0x5296df);});})[_0xac5c('0x17')](function(){return new BPromise(function(_0x40e854,_0xb76408){rimraf(_0x42a9dd,function(_0xaff7e1){if(_0xaff7e1)_0xb76408(_0xaff7e1);return _0x40e854();});});})[_0xac5c('0x17')](function(){return _0x44170f[_0xac5c('0x4f')](_0xc9c9bc,_0xfc257e,function(_0x2c4815){if(_0x2c4815){console[_0xac5c('0x72')]('err',_0x2c4815);}else{fs['unlinkSync'](_0xc9c9bc);}});});});}else{return _0x44170f[_0xac5c('0x19')](0xc8);}})[_0xac5c('0x28')](handleError(_0x44170f,null));}; \ No newline at end of file +var _0xaf07=['Contact','value','renderFile','server','views','.pdf','createPdfFromHTML','log','err','unlinkSync','sendStatus','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','defaults','redis','localhost','./smsInteraction.socket','register','status','end','json','offset','undefined','count','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','getOptions','findAll','sms','query','catch','show','model','SmsInteraction','keys','filters','intersection','fields','attributes','length','include','merge','options','find','create','body','params','describe','addMessage','omit','getMessages','findOne','SmsMessage','hasOwnProperty','nolimit','limit','order','sort','pick','SmsInteractionId','filter','where','map','split','format','includeAll','rows','addTags','setTags','ids','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','toString','join','root','tmp','transcript-%d-%s.zip','User','fullname','push','CmContact','firstName','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Account','Owner','mkdirSync','Sms','N.A.','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','out'];(function(_0x3aa329,_0x4e4e46){var _0x32ec90=function(_0x2062d8){while(--_0x2062d8){_0x3aa329['push'](_0x3aa329['shift']());}};_0x32ec90(++_0x4e4e46);}(_0xaf07,0x1df));var _0x7af0=function(_0x355a91,_0x103e84){_0x355a91=_0x355a91-0x0;var _0x40b0e2=_0xaf07[_0x355a91];return _0x40b0e2;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x7af0('0x0'));var moment=require(_0x7af0('0x1'));var BPromise=require(_0x7af0('0x2'));var util=require(_0x7af0('0x3'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7af0('0x4'));var Redis=require(_0x7af0('0x5'));var interaction=require(_0x7af0('0x6'));var qs=require(_0x7af0('0x7'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x7af0('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x7af0('0x9')](config[_0x7af0('0xa')],{'host':_0x7af0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7af0('0xa')]));require(_0x7af0('0xc'))[_0x7af0('0xd')](socket);function respondWithStatusCode(_0x231edf,_0x36044e){_0x36044e=_0x36044e||0xcc;return function(_0xc48dca){if(_0xc48dca){return _0x231edf['sendStatus'](_0x36044e);}return _0x231edf[_0x7af0('0xe')](_0x36044e)[_0x7af0('0xf')]();};}function respondWithResult(_0x1c5fff,_0x3a18f9){_0x3a18f9=_0x3a18f9||0xc8;return function(_0x200676){if(_0x200676){return _0x1c5fff[_0x7af0('0xe')](_0x3a18f9)[_0x7af0('0x10')](_0x200676);}};}function respondWithFilteredResult(_0x5aa8d3,_0x1e0812){return function(_0x55e16d){if(_0x55e16d){var _0x2c6a35=typeof _0x1e0812[_0x7af0('0x11')]===_0x7af0('0x12')&&typeof _0x1e0812['limit']===_0x7af0('0x12');var _0x458492=_0x55e16d[_0x7af0('0x13')];var _0x2c9c0b=_0x2c6a35?0x0:_0x1e0812[_0x7af0('0x11')];var _0x10bf59=_0x2c6a35?_0x55e16d['count']:_0x1e0812[_0x7af0('0x11')]+_0x1e0812['limit'];var _0x489058;if(_0x10bf59>=_0x458492){_0x10bf59=_0x458492;_0x489058=0xc8;}else{_0x489058=0xce;}_0x5aa8d3['status'](_0x489058);return _0x5aa8d3['set']('Content-Range',_0x2c9c0b+'-'+_0x10bf59+'/'+_0x458492)[_0x7af0('0x10')](_0x55e16d);}return null;};}function saveUpdates(_0x1dd923){return function(_0xedd929){if(_0xedd929){return _0xedd929['update'](_0x1dd923)[_0x7af0('0x14')](function(_0x34abf7){return _0x34abf7;});}return null;};}function removeEntity(_0x235647){return function(_0x5def40){if(_0x5def40){return _0x5def40[_0x7af0('0x15')]()['then'](function(){_0x235647[_0x7af0('0xe')](0xcc)[_0x7af0('0xf')]();});}};}function handleEntityNotFound(_0x39b2a9){return function(_0x478242){if(!_0x478242){_0x39b2a9['sendStatus'](0x194);}return _0x478242;};}function handleError(_0x46a0b5,_0x5206a8){_0x5206a8=_0x5206a8||0x1f4;return function(_0x5555bf){logger['error'](_0x5555bf[_0x7af0('0x16')]);if(_0x5555bf[_0x7af0('0x17')]){delete _0x5555bf[_0x7af0('0x17')];}_0x46a0b5[_0x7af0('0xe')](_0x5206a8)[_0x7af0('0x18')](_0x5555bf);};}exports[_0x7af0('0x19')]=function(_0x1c72ce,_0x415b78){var _0x2b70a7={};var _0x2371f8=_['map'](db['SmsInteraction'][_0x7af0('0x1a')],function(_0x1b15cf){return{'name':_0x1b15cf[_0x7af0('0x1b')],'type':_0x1b15cf[_0x7af0('0x1c')]['key']};});_0x2b70a7=qs[_0x7af0('0x1d')](_0x2371f8,_0x1c72ce);return interaction[_0x7af0('0x1e')](_0x7af0('0x1f'),_0x1c72ce[_0x7af0('0x20')],_0x1c72ce['user'],_0x2b70a7,_0x2371f8)[_0x7af0('0x14')](respondWithFilteredResult(_0x415b78,_0x2b70a7))[_0x7af0('0x21')](handleError(_0x415b78,null));};exports[_0x7af0('0x22')]=function(_0x1c0bfd,_0x3b6670){var _0x22a42d={'raw':![],'where':{'id':_0x1c0bfd['params']['id']}},_0x462176={};_0x462176[_0x7af0('0x23')]=_['keys'](db[_0x7af0('0x24')][_0x7af0('0x1a')]);_0x462176[_0x7af0('0x20')]=_[_0x7af0('0x25')](_0x1c0bfd['query']);_0x462176[_0x7af0('0x26')]=_[_0x7af0('0x27')](_0x462176['model'],_0x462176[_0x7af0('0x20')]);_0x22a42d['attributes']=_[_0x7af0('0x27')](_0x462176[_0x7af0('0x23')],qs['fields'](_0x1c0bfd[_0x7af0('0x20')][_0x7af0('0x28')]));_0x22a42d[_0x7af0('0x29')]=_0x22a42d[_0x7af0('0x29')][_0x7af0('0x2a')]?_0x22a42d[_0x7af0('0x29')]:_0x462176[_0x7af0('0x23')];if(_0x1c0bfd['query']['includeAll']){_0x22a42d[_0x7af0('0x2b')]=[{'all':!![]}];}_0x22a42d=_[_0x7af0('0x2c')]({},_0x22a42d,_0x1c0bfd[_0x7af0('0x2d')]);return db[_0x7af0('0x24')][_0x7af0('0x2e')](_0x22a42d)[_0x7af0('0x14')](handleEntityNotFound(_0x3b6670,null))[_0x7af0('0x14')](respondWithResult(_0x3b6670,null))[_0x7af0('0x21')](handleError(_0x3b6670,null));};exports[_0x7af0('0x2f')]=function(_0x1694ce,_0x44e30e){return db[_0x7af0('0x24')]['create'](_0x1694ce[_0x7af0('0x30')],{})[_0x7af0('0x14')](respondWithResult(_0x44e30e,0xc9))[_0x7af0('0x21')](handleError(_0x44e30e,null));};exports['update']=function(_0xaa40aa,_0x518830){if(_0xaa40aa[_0x7af0('0x30')]['id']){delete _0xaa40aa[_0x7af0('0x30')]['id'];}return db[_0x7af0('0x24')]['find']({'where':{'id':_0xaa40aa[_0x7af0('0x31')]['id']}})[_0x7af0('0x14')](handleEntityNotFound(_0x518830,null))['then'](saveUpdates(_0xaa40aa[_0x7af0('0x30')],null))[_0x7af0('0x14')](respondWithResult(_0x518830,null))['catch'](handleError(_0x518830,null));};exports[_0x7af0('0x15')]=function(_0x24053f,_0x26f85a){return db[_0x7af0('0x24')][_0x7af0('0x2e')]({'where':{'id':_0x24053f['params']['id']}})['then'](handleEntityNotFound(_0x26f85a,null))[_0x7af0('0x14')](removeEntity(_0x26f85a,null))[_0x7af0('0x21')](handleError(_0x26f85a,null));};exports[_0x7af0('0x32')]=function(_0x14fc74,_0x24fe93){return db[_0x7af0('0x24')][_0x7af0('0x32')]()['then'](respondWithResult(_0x24fe93,null))[_0x7af0('0x21')](handleError(_0x24fe93,null));};exports[_0x7af0('0x33')]=function(_0x239617,_0x2181b7){return db['SmsMessage'][_0x7af0('0x2e')]({'where':{'id':_0x239617[_0x7af0('0x31')]['id']}})['then'](handleEntityNotFound(_0x2181b7,null))[_0x7af0('0x14')](function(_0x2e1a94){if(_0x2e1a94){return _0x2e1a94['addMessage'](_0x239617[_0x7af0('0x30')]['ids'],_[_0x7af0('0x34')](_0x239617['body'],['ids','id'])||{});}})[_0x7af0('0x14')](respondWithResult(_0x2181b7,null))[_0x7af0('0x21')](handleError(_0x2181b7,null));};exports[_0x7af0('0x35')]=function(_0x57859a,_0x1c8d4b){var _0x23fb57={'raw':![],'where':{}};var _0x1412a3={};var _0x506f1d={'count':0x0,'rows':[]};return db[_0x7af0('0x24')][_0x7af0('0x36')]({'where':{'id':_0x57859a[_0x7af0('0x31')]['id']}})[_0x7af0('0x14')](handleEntityNotFound(_0x1c8d4b,null))[_0x7af0('0x14')](function(_0x58abab){if(_0x58abab){_0x1412a3[_0x7af0('0x23')]=_['keys'](db[_0x7af0('0x37')][_0x7af0('0x1a')]);_0x1412a3['query']=_[_0x7af0('0x25')](_0x57859a[_0x7af0('0x20')]);_0x1412a3[_0x7af0('0x26')]=_['intersection'](_0x1412a3['model'],_0x1412a3[_0x7af0('0x20')]);_0x23fb57[_0x7af0('0x29')]=_[_0x7af0('0x27')](_0x1412a3['model'],qs['fields'](_0x57859a[_0x7af0('0x20')]['fields']));_0x23fb57['attributes']=_0x23fb57[_0x7af0('0x29')][_0x7af0('0x2a')]?_0x23fb57[_0x7af0('0x29')]:_0x1412a3[_0x7af0('0x23')];if(!_0x57859a['query'][_0x7af0('0x38')](_0x7af0('0x39'))){_0x23fb57['limit']=qs[_0x7af0('0x3a')](_0x57859a[_0x7af0('0x20')][_0x7af0('0x3a')]);_0x23fb57[_0x7af0('0x11')]=qs['offset'](_0x57859a['query']['offset']);}_0x23fb57[_0x7af0('0x3b')]=qs['sort'](_0x57859a[_0x7af0('0x20')][_0x7af0('0x3c')]);_0x23fb57['where']=qs[_0x7af0('0x26')](_[_0x7af0('0x3d')](_0x57859a[_0x7af0('0x20')],_0x1412a3[_0x7af0('0x26')]));_0x23fb57['where'][_0x7af0('0x3e')]=_0x58abab['id'];if(_0x57859a['query'][_0x7af0('0x3f')]){_0x23fb57[_0x7af0('0x40')]=_[_0x7af0('0x2c')](_0x23fb57[_0x7af0('0x40')],{'$or':_[_0x7af0('0x41')](_0x23fb57[_0x7af0('0x29')],function(_0x1a8f54){var _0x281570={};_0x281570[_0x1a8f54]={'$like':'%'+_0x57859a['query'][_0x7af0('0x3f')]+'%'};return _0x281570;})});}if(_0x57859a['query']['$gte']){var _0x1614d2=_0x57859a[_0x7af0('0x20')]['$gte'][_0x7af0('0x42')](',');var _0x358275={};_0x358275[_0x1614d2[0x0]]={'$gte':moment(_0x1614d2[0x1])[_0x7af0('0x43')]('YYYY-MM-DD\x20HH:mm:ss')};_0x23fb57[_0x7af0('0x40')]=_['merge'](_0x23fb57[_0x7af0('0x40')],_0x358275);}_0x23fb57=_[_0x7af0('0x2c')]({},_0x23fb57,_0x57859a[_0x7af0('0x2d')]);return db['SmsMessage'][_0x7af0('0x13')]({'where':_0x23fb57[_0x7af0('0x40')]})[_0x7af0('0x14')](function(_0x4bb90e){_0x506f1d[_0x7af0('0x13')]=_0x4bb90e;if(_0x57859a[_0x7af0('0x20')][_0x7af0('0x44')]){_0x23fb57['include']=[{'all':!![]}];}return db[_0x7af0('0x37')][_0x7af0('0x1e')](_0x23fb57);})[_0x7af0('0x14')](function(_0x4348b0){_0x506f1d[_0x7af0('0x45')]=_0x4348b0;return _0x506f1d;});}})[_0x7af0('0x14')](respondWithFilteredResult(_0x1c8d4b,_0x23fb57))[_0x7af0('0x21')](handleError(_0x1c8d4b,null));};exports[_0x7af0('0x46')]=function(_0x408e71,_0x5ec2eb){return db[_0x7af0('0x24')]['find']({'where':{'id':_0x408e71[_0x7af0('0x31')]['id']}})[_0x7af0('0x14')](handleEntityNotFound(_0x5ec2eb,null))['then'](function(_0x94ded5){if(_0x94ded5){return _0x94ded5[_0x7af0('0x47')](_0x408e71['body'][_0x7af0('0x48')],_[_0x7af0('0x34')](_0x408e71['body'],[_0x7af0('0x48'),'id'])||{})[_0x7af0('0x49')](function(){return db[_0x7af0('0x4a')]['findAll']({'attributes':['id',_0x7af0('0x17'),_0x7af0('0x4b')],'where':{'id':_0x408e71[_0x7af0('0x30')][_0x7af0('0x48')]}});})['then'](function(_0x477783){socket[_0x7af0('0x4c')](_0x7af0('0x4d'),{'id':Number(_0x408e71[_0x7af0('0x31')]['id']),'tags':_0x477783||[]});return{'id':Number(_0x408e71[_0x7af0('0x31')]['id']),'tags':_0x477783||[]};});}})[_0x7af0('0x14')](respondWithResult(_0x5ec2eb,null))[_0x7af0('0x21')](handleError(_0x5ec2eb,null));};exports[_0x7af0('0x4e')]=function(_0xab4c2c,_0x2e66d7){return db[_0x7af0('0x24')][_0x7af0('0x2e')]({'where':{'id':_0xab4c2c[_0x7af0('0x31')]['id']}})[_0x7af0('0x14')](handleEntityNotFound(_0x2e66d7,null))['then'](function(_0x1032f4){if(_0x1032f4){return _0x1032f4[_0x7af0('0x4e')](_0xab4c2c[_0x7af0('0x20')]['ids']);}})[_0x7af0('0x14')](respondWithStatusCode(_0x2e66d7,null))['catch'](handleError(_0x2e66d7,null));};exports[_0x7af0('0x4f')]=function(_0x5affe8,_0x19c231){var _0x17514e=moment()['unix']()[_0x7af0('0x50')]();var _0x35f4b1=path[_0x7af0('0x51')](config[_0x7af0('0x52')],'server','files',_0x7af0('0x53'));var _0x10c809=path[_0x7af0('0x51')](_0x35f4b1,_0x17514e);var _0x191319=util[_0x7af0('0x43')](_0x7af0('0x54'),_0x5affe8['params']['id'],_0x17514e);var _0x11d1c2=path[_0x7af0('0x51')](_0x35f4b1,_0x191319);var _0x6d22d7=[];_0x6d22d7['push']({'model':db['User'],'as':_0x7af0('0x55'),'attributes':['id',_0x7af0('0x56')],'raw':!![]});_0x6d22d7[_0x7af0('0x57')]({'model':db[_0x7af0('0x58')],'as':'Contact','attributes':['id',_0x7af0('0x59'),_0x7af0('0x5a')],'raw':!![]});var _0x54ddcc=[{'model':db[_0x7af0('0x37')],'as':_0x7af0('0x5b'),'attributes':['id',_0x7af0('0x30'),_0x7af0('0x5c'),_0x7af0('0x5d'),_0x7af0('0x5e'),_0x7af0('0x5f')],'include':_0x6d22d7}];_0x54ddcc['push']({'model':db[_0x7af0('0x60')],'as':_0x7af0('0x61'),'attributes':['id',_0x7af0('0x17')]});_0x54ddcc[_0x7af0('0x57')]({'model':db[_0x7af0('0x55')],'as':_0x7af0('0x62'),'attributes':['id',_0x7af0('0x56')]});return db[_0x7af0('0x24')]['find']({'where':{'id':_0x5affe8[_0x7af0('0x31')]['id']},'include':_0x54ddcc})[_0x7af0('0x14')](handleEntityNotFound(_0x19c231,null))[_0x7af0('0x14')](function(_0x5ba6ea){if(_0x5ba6ea){var _0x11b028=_0x5ba6ea['get']({'plain':!![]});fs[_0x7af0('0x63')](_0x10c809);var _0x37fddd={'channel':_0x7af0('0x64'),'account':_0x11b028['Account'][_0x7af0('0x17')],'agent':_0x11b028['Owner']?_0x11b028['Owner'][_0x7af0('0x56')]:_0x7af0('0x65'),'createdAt':moment(_0x11b028[_0x7af0('0x5c')])[_0x7af0('0x43')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7af0('0x50')](),'closedAt':_0x11b028['closed']?moment(_0x11b028[_0x7af0('0x66')])[_0x7af0('0x43')](_0x7af0('0x67'))[_0x7af0('0x50')]():'','disposition':_0x11b028[_0x7af0('0x68')],'messages':_(_0x11b028[_0x7af0('0x5b')])[_0x7af0('0x3f')]({'secret':![]})[_0x7af0('0x41')](function(_0x30eb83){return{'date':moment(_0x30eb83[_0x7af0('0x5c')])['format'](_0x7af0('0x67'))[_0x7af0('0x50')](),'sender':_0x30eb83[_0x7af0('0x5d')]===_0x7af0('0x69')?_0x30eb83[_0x7af0('0x55')]?_0x30eb83[_0x7af0('0x55')][_0x7af0('0x56')]:'System':_0x30eb83[_0x7af0('0x6a')][_0x7af0('0x59')]+(_0x30eb83[_0x7af0('0x6a')][_0x7af0('0x5a')]?'\x20'+_0x30eb83[_0x7af0('0x6a')][_0x7af0('0x5a')]:''),'body':_0x30eb83[_0x7af0('0x30')],'direction':_0x30eb83[_0x7af0('0x5d')]==='out'?'A':'C','secret':_0x30eb83[_0x7af0('0x5e')],'read':_0x30eb83[_0x7af0('0x5f')]};})[_0x7af0('0x6b')]()};return ejs[_0x7af0('0x6c')](path[_0x7af0('0x51')](config[_0x7af0('0x52')],_0x7af0('0x6d'),_0x7af0('0x6e'),'downloadInteraction.ejs'),{'interaction':_0x37fddd})[_0x7af0('0x14')](function(_0x5422b9){var _0x163e76=path[_0x7af0('0x51')](_0x10c809,'transcript-'+_0x11b028['id']+'-'+_0x17514e+_0x7af0('0x6f'));var _0x1eb412={'path':_0x163e76,'channel':'Sms','interactionId':_0x11b028['id']};return pdf[_0x7af0('0x70')](_0x5422b9,_0x1eb412);})[_0x7af0('0x14')](function(){return new BPromise(function(_0x1cef39,_0x4856c5){zipdir(_0x10c809,{'saveTo':_0x11d1c2},function(_0x4e0223,_0x41907f){if(_0x4e0223)return _0x4856c5(_0x4e0223);return _0x1cef39(_0x41907f);});})[_0x7af0('0x14')](function(){return new BPromise(function(_0x2ed121,_0x37e433){rimraf(_0x10c809,function(_0x174b49){if(_0x174b49)_0x37e433(_0x174b49);return _0x2ed121();});});})[_0x7af0('0x14')](function(){return _0x19c231[_0x7af0('0x4f')](_0x11d1c2,_0x191319,function(_0x38d383){if(_0x38d383){console[_0x7af0('0x71')](_0x7af0('0x72'),_0x38d383);}else{fs[_0x7af0('0x73')](_0x11d1c2);}});});});}else{return _0x19c231[_0x7af0('0x74')](0xc8);}})[_0x7af0('0x21')](handleError(_0x19c231,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index a7b864a..1e41208 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 _0x1a85=['then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','SmsInteraction','../../mysqldb','SmsMessage','update','remove','getUsers','setDataValue','map'];(function(_0x162004,_0x39da7a){var _0x581394=function(_0x29000d){while(--_0x29000d){_0x162004['push'](_0x162004['shift']());}};_0x581394(++_0x39da7a);}(_0x1a85,0x178));var _0x51a8=function(_0x19af2b,_0x274ecc){_0x19af2b=_0x19af2b-0x0;var _0x1d7b79=_0x1a85[_0x19af2b];return _0x1d7b79;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0x51a8('0x0')];var SmsMessage=require(_0x51a8('0x1'))['db'][_0x51a8('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x51a8('0x3'),'afterDestroy':_0x51a8('0x4')};function emitEvent(_0x99e371){return function(_0x48a21b,_0xaac0bf,_0x4b76a8){_0x48a21b[_0x51a8('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x331117){_0x48a21b[_0x51a8('0x6')]('Users',_0x331117[_0x51a8('0x7')](function(_0x513685){return{'id':_0x513685['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x48a21b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x51a8('0x8')](function(_0x2f276b){_0x48a21b[_0x51a8('0x6')](_0x51a8('0x9'),_0x2f276b[_0x51a8('0xa')]);SmsInteractionEvents[_0x51a8('0xb')](_0x99e371+':'+_0x48a21b['id'],_0x48a21b);SmsInteractionEvents[_0x51a8('0xb')](_0x99e371,_0x48a21b);_0x4b76a8(null);})[_0x51a8('0xc')](_0x4b76a8(null));};}for(var e in events){if(events[_0x51a8('0xd')](e)){var event=events[e];SmsInteraction[_0x51a8('0xe')](e,emitEvent(event));}}module[_0x51a8('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x5eb8=['SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','then','unreadMessages','length','emit','hasOwnProperty','hook'];(function(_0x182292,_0x14f0ef){var _0xdd798d=function(_0x4f08e2){while(--_0x4f08e2){_0x182292['push'](_0x182292['shift']());}};_0xdd798d(++_0x14f0ef);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3f70cd,_0x6bf4ed){_0x3f70cd=_0x3f70cd-0x0;var _0x3feb93=_0x5eb8[_0x3f70cd];return _0x3feb93;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0x85eb('0x0')];var SmsMessage=require(_0x85eb('0x1'))['db'][_0x85eb('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x85eb('0x3')](0x0);var events={'afterCreate':_0x85eb('0x4'),'afterUpdate':_0x85eb('0x5'),'afterDestroy':_0x85eb('0x6')};function emitEvent(_0x44e313){return function(_0x3c5798,_0x1fde1a,_0x2bf83c){_0x3c5798[_0x85eb('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x16d7b9){_0x3c5798[_0x85eb('0x8')](_0x85eb('0x9'),_0x16d7b9['map'](function(_0x2da3b0){return{'id':_0x2da3b0['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x3c5798['id'],'direction':'in','read':![]},'raw':!![]});})[_0x85eb('0xa')](function(_0x40d6b6){_0x3c5798[_0x85eb('0x8')](_0x85eb('0xb'),_0x40d6b6[_0x85eb('0xc')]);SmsInteractionEvents[_0x85eb('0xd')](_0x44e313+':'+_0x3c5798['id'],_0x3c5798);SmsInteractionEvents[_0x85eb('0xd')](_0x44e313,_0x3c5798);_0x2bf83c(null);})['catch'](_0x2bf83c(null));};}for(var e in events){if(events[_0x85eb('0xe')](e)){var event=events[e];SmsInteraction[_0x85eb('0xf')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index a77564b..1178437 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 _0x070d=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x070d,0xbf));var _0xd070=function(_0x70f588,_0x5b85c3){_0x70f588=_0x70f588-0x0;var _0x53ce67=_0x070d[_0x70f588];return _0x53ce67;};'use strict';var _=require(_0xd070('0x0'));var util=require('util');var logger=require(_0xd070('0x1'))(_0xd070('0x2'));var moment=require(_0xd070('0x3'));var BPromise=require(_0xd070('0x4'));var rp=require(_0xd070('0x5'));var fs=require('fs');var path=require(_0xd070('0x6'));var rimraf=require(_0xd070('0x7'));var config=require(_0xd070('0x8'));var attributes=require(_0xd070('0x9'));module[_0xd070('0xa')]=function(_0x523a7d,_0x4568c3){return _0x523a7d['define'](_0xd070('0xb'),attributes,{'tableName':_0xd070('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x163eac,_0x39ce2f,_0x1551e6){if(_0x163eac['changed'](_0xd070('0xd'))){_0x163eac[_0xd070('0xe')]=moment()[_0xd070('0xf')](_0xd070('0x10'));}_0x1551e6(null,_0x163eac);}}});}; \ No newline at end of file +var _0x08a5=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x3f3eda,_0x3885f0){var _0xd4278e=function(_0xdebb9e){while(--_0xdebb9e){_0x3f3eda['push'](_0x3f3eda['shift']());}};_0xd4278e(++_0x3885f0);}(_0x08a5,0x18c));var _0x508a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x08a5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x508a('0x0'));var util=require(_0x508a('0x1'));var logger=require(_0x508a('0x2'))(_0x508a('0x3'));var moment=require(_0x508a('0x4'));var BPromise=require(_0x508a('0x5'));var rp=require(_0x508a('0x6'));var fs=require('fs');var path=require(_0x508a('0x7'));var rimraf=require(_0x508a('0x8'));var config=require(_0x508a('0x9'));var attributes=require(_0x508a('0xa'));module['exports']=function(_0x54a145,_0x164dda){return _0x54a145[_0x508a('0xb')](_0x508a('0xc'),attributes,{'tableName':_0x508a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5840e9,_0x19fe22,_0x5e374e){if(_0x5840e9[_0x508a('0xe')](_0x508a('0xf'))){_0x5840e9[_0x508a('0x10')]=moment()[_0x508a('0x11')](_0x508a('0x12'));}_0x5e374e(null,_0x5840e9);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index c4f87e0..178351b 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 _0x8f9b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','catch','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','../../config/utils'];(function(_0x1f9899,_0x418798){var _0x119015=function(_0x44a283){while(--_0x44a283){_0x1f9899['push'](_0x1f9899['shift']());}};_0x119015(++_0x418798);}(_0x8f9b,0x143));var _0xb8f9=function(_0x9509bc,_0x55b276){_0x9509bc=_0x9509bc-0x0;var _0xe1a8ea=_0x8f9b[_0x9509bc];return _0xe1a8ea;};'use strict';var _=require(_0xb8f9('0x0'));var util=require(_0xb8f9('0x1'));var moment=require(_0xb8f9('0x2'));var BPromise=require(_0xb8f9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb8f9('0x4'));var logger=require(_0xb8f9('0x5'))(_0xb8f9('0x6'));var config=require(_0xb8f9('0x7'));var jayson=require(_0xb8f9('0x8'));var client=jayson[_0xb8f9('0x9')][_0xb8f9('0xa')]({'port':0x232a});config['redis']=_[_0xb8f9('0xb')](config[_0xb8f9('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb8f9('0xc')]));require(_0xb8f9('0xd'))['register'](socket);function respondWithRpcPromise(_0x58125d,_0x40859b,_0x4bab0e){return new BPromise(function(_0x2a4556,_0x753764){return client[_0xb8f9('0xe')](_0x58125d,_0x4bab0e)[_0xb8f9('0xf')](function(_0x30eb53){logger[_0xb8f9('0x10')](_0xb8f9('0x11'),_0x40859b,'request\x20sent');logger[_0xb8f9('0x12')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x40859b,_0xb8f9('0x13'),JSON[_0xb8f9('0x14')](_0x30eb53));if(_0x30eb53[_0xb8f9('0x15')]){if(_0x30eb53[_0xb8f9('0x15')][_0xb8f9('0x16')]===0x1f4){logger['error'](_0xb8f9('0x11'),_0x40859b,_0x30eb53['error']['message']);return _0x753764(_0x30eb53[_0xb8f9('0x15')]['message']);}logger[_0xb8f9('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x40859b,_0x30eb53[_0xb8f9('0x15')]['message']);return _0x2a4556(_0x30eb53[_0xb8f9('0x15')][_0xb8f9('0x17')]);}else{logger[_0xb8f9('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x40859b,'request\x20sent');_0x2a4556(_0x30eb53[_0xb8f9('0x18')][_0xb8f9('0x17')]);}})['catch'](function(_0x2fa5d3){logger[_0xb8f9('0x15')](_0xb8f9('0x11'),_0x40859b,_0x2fa5d3);_0x753764(_0x2fa5d3);});});}exports[_0xb8f9('0x19')]=function(_0x1c10e2){var _0x363ea9=this;return new Promise(function(_0x211aa4,_0x1afd8f){return db[_0xb8f9('0x1a')][_0xb8f9('0x1b')](_0x1c10e2[_0xb8f9('0x1c')],{'raw':_0x1c10e2[_0xb8f9('0x1d')]?_0x1c10e2[_0xb8f9('0x1d')][_0xb8f9('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c10e2[_0xb8f9('0x1d')]?_0x1c10e2[_0xb8f9('0x1d')][_0xb8f9('0x1f')]||null:null,'attributes':_0x1c10e2[_0xb8f9('0x1d')]?_0x1c10e2[_0xb8f9('0x1d')][_0xb8f9('0x20')]||null:null,'limit':_0x1c10e2[_0xb8f9('0x1d')]?_0x1c10e2[_0xb8f9('0x1d')]['limit']||null:null})[_0xb8f9('0xf')](function(_0x28081f){logger[_0xb8f9('0x10')](_0xb8f9('0x19'),_0x1c10e2);logger[_0xb8f9('0x12')](_0xb8f9('0x19'),_0x1c10e2,JSON['stringify'](_0x28081f));_0x211aa4(_0x28081f);})[_0xb8f9('0x21')](function(_0x20b03d){logger[_0xb8f9('0x15')](_0xb8f9('0x19'),_0x20b03d[_0xb8f9('0x17')],_0x1c10e2);_0x1afd8f(_0x363ea9['error'](0x1f4,_0x20b03d[_0xb8f9('0x17')]));});});};exports[_0xb8f9('0x22')]=function(_0x43f1fd){return new Promise(function(_0x59fd86,_0x42b430){return db['SmsInteraction'][_0xb8f9('0x23')]({'where':_0x43f1fd[_0xb8f9('0x1d')]?_0x43f1fd[_0xb8f9('0x1d')][_0xb8f9('0x1f')]||null:null})[_0xb8f9('0xf')](function(_0x381428){if(_0x381428){return _0x381428[_0xb8f9('0x24')](_0x43f1fd[_0xb8f9('0x1c')][_0xb8f9('0x25')],_[_0xb8f9('0x26')](_0x43f1fd[_0xb8f9('0x1c')],[_0xb8f9('0x25'),'id'])||{});}})[_0xb8f9('0x27')](function(_0x4f8814){logger[_0xb8f9('0x10')](_0xb8f9('0x28'),_0x43f1fd);logger[_0xb8f9('0x12')](_0xb8f9('0x28'),_0x43f1fd,JSON[_0xb8f9('0x14')](_0x4f8814));_0x59fd86(_0x4f8814);})[_0xb8f9('0x21')](function(_0x1d4fe0){logger[_0xb8f9('0x15')](_0xb8f9('0x28'),_0x1d4fe0[_0xb8f9('0x17')],_0x43f1fd);_0x42b430(_this[_0xb8f9('0x15')](0x1f4,_0x1d4fe0[_0xb8f9('0x17')]));});});}; \ No newline at end of file +var _0x4709=['stringify','error','code','message','catch','SmsInteraction','update','body','options','raw','where','attributes','limit','then','UpdateSmsInteraction','AddTagsToSmsInteraction','find','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','redis','socket.io-emitter','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x4709,0x13c));var _0x9470=function(_0x2a24bc,_0x3a167d){_0x2a24bc=_0x2a24bc-0x0;var _0x429e50=_0x4709[_0x2a24bc];return _0x429e50;};'use strict';var _=require(_0x9470('0x0'));var util=require('util');var moment=require(_0x9470('0x1'));var BPromise=require(_0x9470('0x2'));var rs=require(_0x9470('0x3'));var fs=require('fs');var Redis=require(_0x9470('0x4'));var db=require(_0x9470('0x5'))['db'];var utils=require(_0x9470('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9470('0x7'));var client=jayson['client'][_0x9470('0x8')]({'port':0x232a});config[_0x9470('0x9')]=_['defaults'](config[_0x9470('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x9470('0xa'))(new Redis(config[_0x9470('0x9')]));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x1e8080,_0x8f14a3,_0x1495d9){return new BPromise(function(_0x31a67a,_0x354636){return client[_0x9470('0xb')](_0x1e8080,_0x1495d9)['then'](function(_0x203305){logger[_0x9470('0xc')](_0x9470('0xd'),_0x8f14a3,_0x9470('0xe'));logger[_0x9470('0xf')](_0x9470('0x10'),_0x8f14a3,_0x9470('0xe'),JSON[_0x9470('0x11')](_0x203305));if(_0x203305['error']){if(_0x203305[_0x9470('0x12')][_0x9470('0x13')]===0x1f4){logger[_0x9470('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x8f14a3,_0x203305[_0x9470('0x12')][_0x9470('0x14')]);return _0x354636(_0x203305[_0x9470('0x12')]['message']);}logger['error'](_0x9470('0xd'),_0x8f14a3,_0x203305[_0x9470('0x12')][_0x9470('0x14')]);return _0x31a67a(_0x203305[_0x9470('0x12')][_0x9470('0x14')]);}else{logger['info'](_0x9470('0xd'),_0x8f14a3,'request\x20sent');_0x31a67a(_0x203305['result']['message']);}})[_0x9470('0x15')](function(_0x158637){logger[_0x9470('0x12')](_0x9470('0xd'),_0x8f14a3,_0x158637);_0x354636(_0x158637);});});}exports['UpdateSmsInteraction']=function(_0x2d371d){var _0x2c3ce2=this;return new Promise(function(_0x1bb35a,_0x584fd8){return db[_0x9470('0x16')][_0x9470('0x17')](_0x2d371d[_0x9470('0x18')],{'raw':_0x2d371d[_0x9470('0x19')]?_0x2d371d[_0x9470('0x19')][_0x9470('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d371d['options']?_0x2d371d[_0x9470('0x19')][_0x9470('0x1b')]||null:null,'attributes':_0x2d371d[_0x9470('0x19')]?_0x2d371d[_0x9470('0x19')][_0x9470('0x1c')]||null:null,'limit':_0x2d371d[_0x9470('0x19')]?_0x2d371d[_0x9470('0x19')][_0x9470('0x1d')]||null:null})[_0x9470('0x1e')](function(_0x34d52e){logger[_0x9470('0xc')]('UpdateSmsInteraction',_0x2d371d);logger[_0x9470('0xf')]('UpdateSmsInteraction',_0x2d371d,JSON[_0x9470('0x11')](_0x34d52e));_0x1bb35a(_0x34d52e);})[_0x9470('0x15')](function(_0x300585){logger[_0x9470('0x12')](_0x9470('0x1f'),_0x300585[_0x9470('0x14')],_0x2d371d);_0x584fd8(_0x2c3ce2[_0x9470('0x12')](0x1f4,_0x300585[_0x9470('0x14')]));});});};exports[_0x9470('0x20')]=function(_0x5a821c){return new Promise(function(_0xe89481,_0x3501d3){return db[_0x9470('0x16')][_0x9470('0x21')]({'where':_0x5a821c[_0x9470('0x19')]?_0x5a821c['options']['where']||null:null})[_0x9470('0x1e')](function(_0x29d390){if(_0x29d390){return _0x29d390['addTags'](_0x5a821c['body']['ids'],_['omit'](_0x5a821c[_0x9470('0x18')],[_0x9470('0x22'),'id'])||{});}})[_0x9470('0x23')](function(_0x3acc28){logger[_0x9470('0xc')](_0x9470('0x24'),_0x5a821c);logger[_0x9470('0xf')](_0x9470('0x24'),_0x5a821c,JSON['stringify'](_0x3acc28));_0xe89481(_0x3acc28);})[_0x9470('0x15')](function(_0xc36ad){logger[_0x9470('0x12')](_0x9470('0x24'),_0xc36ad['message'],_0x5a821c);_0x3501d3(_this[_0x9470('0x12')](0x1f4,_0xc36ad[_0x9470('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 2556924..62d9096 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 _0xfabb=['save','emit','removeListener','smsInteraction:','./smsInteraction.events'];(function(_0x5e5ad9,_0x18845f){var _0x396036=function(_0x337699){while(--_0x337699){_0x5e5ad9['push'](_0x5e5ad9['shift']());}};_0x396036(++_0x18845f);}(_0xfabb,0x16c));var _0xbfab=function(_0x2e9948,_0x27a272){_0x2e9948=_0x2e9948-0x0;var _0x1167ca=_0xfabb[_0x2e9948];return _0x1167ca;};'use strict';var SmsInteractionEvents=require(_0xbfab('0x0'));var events=[_0xbfab('0x1'),'remove','update'];function createListener(_0x379b35,_0x3d3d9e){return function(_0x2fb934){_0x3d3d9e[_0xbfab('0x2')](_0x379b35,_0x2fb934);};}function removeListener(_0x2e5793,_0x270523){return function(){SmsInteractionEvents[_0xbfab('0x3')](_0x2e5793,_0x270523);};}exports['register']=function(_0x2f6cea){for(var _0xd9dd48=0x0,_0x2b521a=events['length'];_0xd9dd48<_0x2b521a;_0xd9dd48++){var _0xcc0b79=events[_0xd9dd48];var _0x3a095b=createListener(_0xbfab('0x4')+_0xcc0b79,_0x2f6cea);SmsInteractionEvents['on'](_0xcc0b79,_0x3a095b);}}; \ No newline at end of file +var _0xc5b6=['emit','removeListener','./smsInteraction.events','save','remove'];(function(_0x54fe4e,_0x153ebc){var _0x21ceae=function(_0x2d907b){while(--_0x2d907b){_0x54fe4e['push'](_0x54fe4e['shift']());}};_0x21ceae(++_0x153ebc);}(_0xc5b6,0x192));var _0x6c5b=function(_0x204d83,_0x4cd7ac){_0x204d83=_0x204d83-0x0;var _0x20a662=_0xc5b6[_0x204d83];return _0x20a662;};'use strict';var SmsInteractionEvents=require(_0x6c5b('0x0'));var events=[_0x6c5b('0x1'),_0x6c5b('0x2'),'update'];function createListener(_0x48ebe9,_0x83a4dd){return function(_0x417bc3){_0x83a4dd[_0x6c5b('0x3')](_0x48ebe9,_0x417bc3);};}function removeListener(_0x689296,_0x3f033d){return function(){SmsInteractionEvents[_0x6c5b('0x4')](_0x689296,_0x3f033d);};}exports['register']=function(_0x5c841f){for(var _0x49e926=0x0,_0x586800=events['length'];_0x49e926<_0x586800;_0x49e926++){var _0x304157=events[_0x49e926];var _0x547bc8=createListener('smsInteraction:'+_0x304157,_0x5c841f);SmsInteractionEvents['on'](_0x304157,_0x547bc8);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 997f153..12a00f9 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 _0x33a3=['describe','show','tracked','sms','smsmessage:create','create','post','status','put','/:id','update','/:id/accept','accept','reject','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x30faec,_0x18940b){var _0x29484f=function(_0x169ae8){while(--_0x169ae8){_0x30faec['push'](_0x30faec['shift']());}};_0x29484f(++_0x18940b);}(_0x33a3,0xbf));var _0x333a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x33a3[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x333a('0x0'));var util=require('util');var path=require(_0x333a('0x1'));var timeout=require('connect-timeout');var express=require(_0x333a('0x2'));var router=express[_0x333a('0x3')]();var fs_extra=require(_0x333a('0x4'));var auth=require(_0x333a('0x5'));var interaction=require(_0x333a('0x6'));var config=require('../../config/environment');var controller=require(_0x333a('0x7'));router[_0x333a('0x8')]('/',auth[_0x333a('0x9')](),controller[_0x333a('0xa')]);router[_0x333a('0x8')](_0x333a('0xb'),auth[_0x333a('0x9')](),controller[_0x333a('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x333a('0xd')]);router['post']('/',auth[_0x333a('0x9')](),interaction[_0x333a('0xe')](_0x333a('0xf'),_0x333a('0x10')),controller[_0x333a('0x11')]);router[_0x333a('0x12')]('/:id/status',controller[_0x333a('0x13')]);router[_0x333a('0x14')](_0x333a('0x15'),auth[_0x333a('0x9')](),controller[_0x333a('0x16')]);router[_0x333a('0x14')](_0x333a('0x17'),auth['isAuthenticated'](),controller[_0x333a('0x18')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x333a('0x19')]);router[_0x333a('0x1a')](_0x333a('0x15'),auth['isAuthenticated'](),controller[_0x333a('0x1b')]);module[_0x333a('0x1c')]=router; \ No newline at end of file +var _0x5ed0=['status','put','accept','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','tracked','sms','create','/:id/status'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0x5ed0,0xcb));var _0x05ed=function(_0x277ad0,_0x35306c){_0x277ad0=_0x277ad0-0x0;var _0x3d1b66=_0x5ed0[_0x277ad0];return _0x3d1b66;};'use strict';var multer=require('multer');var util=require(_0x05ed('0x0'));var path=require(_0x05ed('0x1'));var timeout=require(_0x05ed('0x2'));var express=require(_0x05ed('0x3'));var router=express[_0x05ed('0x4')]();var fs_extra=require(_0x05ed('0x5'));var auth=require(_0x05ed('0x6'));var interaction=require(_0x05ed('0x7'));var config=require('../../config/environment');var controller=require(_0x05ed('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x05ed('0x9')]);router[_0x05ed('0xa')](_0x05ed('0xb'),auth[_0x05ed('0xc')](),controller[_0x05ed('0xd')]);router['get'](_0x05ed('0xe'),auth['isAuthenticated'](),controller[_0x05ed('0xf')]);router[_0x05ed('0x10')]('/',auth['isAuthenticated'](),interaction[_0x05ed('0x11')](_0x05ed('0x12'),'smsmessage:create'),controller[_0x05ed('0x13')]);router[_0x05ed('0x10')](_0x05ed('0x14'),controller[_0x05ed('0x15')]);router[_0x05ed('0x16')](_0x05ed('0xe'),auth[_0x05ed('0xc')](),controller['update']);router['put']('/:id/accept',auth[_0x05ed('0xc')](),controller[_0x05ed('0x17')]);router[_0x05ed('0x16')]('/:id/reject',auth[_0x05ed('0xc')](),controller[_0x05ed('0x18')]);router[_0x05ed('0x19')](_0x05ed('0xe'),auth['isAuthenticated'](),controller[_0x05ed('0x1a')]);module[_0x05ed('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 b00d854..53feb02 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 _0x5e00=['sequelize','medium','BOOLEAN','ENUM','out','STRING','DATE','TEXT'];(function(_0x55ada9,_0xb6450e){var _0x59e19c=function(_0x35b5b7){while(--_0x35b5b7){_0x55ada9['push'](_0x55ada9['shift']());}};_0x59e19c(++_0xb6450e);}(_0x5e00,0xd0));var _0x05e0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5e00[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x05e0('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x05e0('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x05e0('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x05e0('0x3')]('in',_0x05e0('0x4')),'defaultValue':_0x05e0('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x05e0('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x05e0('0x6')]},'secret':{'type':Sequelize[_0x05e0('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x05e0('0x7')]}}; \ No newline at end of file +var _0xde0f=['DATE','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x5be7aa,_0x5de661){var _0x215408=function(_0x353715){while(--_0x353715){_0x5be7aa['push'](_0x5be7aa['shift']());}};_0x215408(++_0x5de661);}(_0xde0f,0xa2));var _0xfde0=function(_0x41a20f,_0x42086b){_0x41a20f=_0x41a20f-0x0;var _0x334c0c=_0xde0f[_0x41a20f];return _0x334c0c;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xfde0('0x0')](_0xfde0('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xfde0('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfde0('0x3')]('in',_0xfde0('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xfde0('0x5')](0xbe)},'phone':{'type':Sequelize[_0xfde0('0x5')]},'readAt':{'type':Sequelize[_0xfde0('0x6')]},'secret':{'type':Sequelize[_0xfde0('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xfde0('0x5')]},'providerResponse':{'type':Sequelize[_0xfde0('0x0')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 266222b..8b138c5 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 _0x4eb3=['client','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','sendStatus','name','send','index','map','SmsMessage','rawAttributes','fieldName','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','count','findAll','rows','show','params','keys','intersection','includeAll','include','find','create','body','update','destroy','describe','accept','sms','acceptMessage','reject','UserId','agent','SmsInteractionId','interaction','user','role','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','interface','channel','motionChannel','EventManager','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','Status','infobip','results','groupName','DELIVERED','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register'];(function(_0x5c59fb,_0x238e9b){var _0x6e949a=function(_0xb84bdf){while(--_0xb84bdf){_0x5c59fb['push'](_0x5c59fb['shift']());}};_0x6e949a(++_0x238e9b);}(_0x4eb3,0x147));var _0x34eb=function(_0x201211,_0x2e2788){_0x201211=_0x201211-0x0;var _0x3641da=_0x4eb3[_0x201211];return _0x3641da;};'use strict';var util=require(_0x34eb('0x0'));var _=require(_0x34eb('0x1'));var Redis=require(_0x34eb('0x2'));var interactionService=require(_0x34eb('0x3'));var qs=require(_0x34eb('0x4'));var logger=require(_0x34eb('0x5'))(_0x34eb('0x6'));var config=require(_0x34eb('0x7'));var db=require(_0x34eb('0x8'))['db'];config[_0x34eb('0x9')]=_[_0x34eb('0xa')](config[_0x34eb('0x9')],{'host':_0x34eb('0xb'),'port':0x18eb});var socket=require(_0x34eb('0xc'))(new Redis(config[_0x34eb('0x9')]));require(_0x34eb('0xd'))[_0x34eb('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0x34eb('0xf')]['http']({'port':0x232c});var client9002=jayson[_0x34eb('0xf')]['http']({'port':0x232a});var interaction_log=require(_0x34eb('0x5'))('sms-interactions');function respondWithRpcPromise(_0x5d3eaa,_0x7a8dab,_0x488aae,_0x286d68){return new Promise(function(_0x3da47e,_0x25a10b){var _0x3c8844=_0x286d68||client;return _0x3c8844['request'](_0x5d3eaa,_0x488aae)[_0x34eb('0x10')](function(_0x71adaa){logger[_0x34eb('0x11')](_0x34eb('0x12'),_0x7a8dab,_0x34eb('0x13'));logger[_0x34eb('0x14')](_0x34eb('0x15'),_0x7a8dab,_0x34eb('0x13'),JSON[_0x34eb('0x16')](_0x71adaa));if(_0x71adaa[_0x34eb('0x17')]){if(_0x71adaa['error'][_0x34eb('0x18')]===0x1f4){logger['error'](_0x34eb('0x12'),_0x7a8dab,_0x71adaa[_0x34eb('0x17')][_0x34eb('0x19')]);return _0x25a10b(_0x71adaa[_0x34eb('0x17')][_0x34eb('0x19')]);}logger[_0x34eb('0x17')](_0x34eb('0x12'),_0x7a8dab,_0x71adaa[_0x34eb('0x17')][_0x34eb('0x19')]);return _0x3da47e(_0x71adaa['error'][_0x34eb('0x19')]);}else{logger['info'](_0x34eb('0x12'),_0x7a8dab,_0x34eb('0x13'));_0x3da47e(_0x71adaa[_0x34eb('0x1a')][_0x34eb('0x19')]);}})[_0x34eb('0x1b')](function(_0x96ad97){logger[_0x34eb('0x17')]('SmsMessage,\x20%s,\x20%s',_0x7a8dab,_0x96ad97);_0x25a10b(_0x96ad97);});});}function respondWithResult(_0x414bfc,_0x29b9cb){_0x29b9cb=_0x29b9cb||0xc8;return function(_0x35309d){if(_0x35309d){return _0x414bfc[_0x34eb('0x1c')](_0x29b9cb)[_0x34eb('0x1d')](_0x35309d);}};}function respondWithFilteredResult(_0x687c1,_0x4a9b8e){return function(_0x120590){if(_0x120590){var _0x398980=typeof _0x4a9b8e[_0x34eb('0x1e')]===_0x34eb('0x1f')&&typeof _0x4a9b8e[_0x34eb('0x20')]===_0x34eb('0x1f');var _0x4afae0=_0x120590['count'];var _0xf00191=_0x398980?0x0:_0x4a9b8e['offset'];var _0x38a44b=_0x398980?_0x120590['count']:_0x4a9b8e[_0x34eb('0x1e')]+_0x4a9b8e['limit'];var _0x3f5d06;if(_0x38a44b>=_0x4afae0){_0x38a44b=_0x4afae0;_0x3f5d06=0xc8;}else{_0x3f5d06=0xce;}_0x687c1[_0x34eb('0x1c')](_0x3f5d06);return _0x687c1['set']('Content-Range',_0xf00191+'-'+_0x38a44b+'/'+_0x4afae0)[_0x34eb('0x1d')](_0x120590);}return null;};}function saveUpdates(_0x1868ab){return function(_0x3c3a7c){if(_0x3c3a7c){return _0x3c3a7c['update'](_0x1868ab)[_0x34eb('0x10')](function(_0x52f594){return _0x52f594;});}return null;};}function removeEntity(_0x21e558){return function(_0x355c26){if(_0x355c26){return _0x355c26['destroy']()[_0x34eb('0x10')](function(){_0x21e558[_0x34eb('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x74e1e1){return function(_0x8bfb37){if(!_0x8bfb37){_0x74e1e1[_0x34eb('0x21')](0x194);}return _0x8bfb37;};}function handleError(_0x159c6b,_0xa40819){_0xa40819=_0xa40819||0x1f4;return function(_0x281911){logger['error'](_0x281911['stack']);if(_0x281911[_0x34eb('0x22')]){delete _0x281911[_0x34eb('0x22')];}_0x159c6b[_0x34eb('0x1c')](_0xa40819)[_0x34eb('0x23')](_0x281911);};}exports[_0x34eb('0x24')]=function(_0x13b8af,_0x18845e){var _0x222d04={},_0x2b05cc={},_0x47930a={'count':0x0,'rows':[]};var _0x216114=_[_0x34eb('0x25')](db[_0x34eb('0x26')][_0x34eb('0x27')],function(_0x2f5c94){return{'name':_0x2f5c94[_0x34eb('0x28')],'type':_0x2f5c94['type'][_0x34eb('0x29')]};});_0x2b05cc[_0x34eb('0x2a')]=_[_0x34eb('0x25')](_0x216114,_0x34eb('0x22'));_0x2b05cc['query']=_['keys'](_0x13b8af[_0x34eb('0x2b')]);_0x2b05cc[_0x34eb('0x2c')]=_['intersection'](_0x2b05cc[_0x34eb('0x2a')],_0x2b05cc['query']);_0x222d04['attributes']=_['intersection'](_0x2b05cc[_0x34eb('0x2a')],qs[_0x34eb('0x2d')](_0x13b8af['query'][_0x34eb('0x2d')]));_0x222d04[_0x34eb('0x2e')]=_0x222d04[_0x34eb('0x2e')][_0x34eb('0x2f')]?_0x222d04[_0x34eb('0x2e')]:_0x2b05cc['model'];if(!_0x13b8af[_0x34eb('0x2b')][_0x34eb('0x30')](_0x34eb('0x31'))){_0x222d04[_0x34eb('0x20')]=qs[_0x34eb('0x20')](_0x13b8af[_0x34eb('0x2b')][_0x34eb('0x20')]);_0x222d04[_0x34eb('0x1e')]=qs[_0x34eb('0x1e')](_0x13b8af[_0x34eb('0x2b')][_0x34eb('0x1e')]);}_0x222d04[_0x34eb('0x32')]=qs[_0x34eb('0x33')](_0x13b8af['query']['sort']);_0x222d04['where']=qs[_0x34eb('0x2c')](_[_0x34eb('0x34')](_0x13b8af['query'],_0x2b05cc[_0x34eb('0x2c')]),_0x216114);if(_0x13b8af[_0x34eb('0x2b')][_0x34eb('0x35')]){_0x222d04['where']=_[_0x34eb('0x36')](_0x222d04[_0x34eb('0x37')],{'$or':_[_0x34eb('0x25')](_0x216114,function(_0x1c5bae){if(_0x1c5bae['type']!==_0x34eb('0x38')){var _0x3626ef={};_0x3626ef[_0x1c5bae['name']]={'$like':'%'+_0x13b8af[_0x34eb('0x2b')][_0x34eb('0x35')]+'%'};return _0x3626ef;}})});}_0x222d04=_[_0x34eb('0x36')]({},_0x222d04,_0x13b8af[_0x34eb('0x39')]);var _0x2fa1f4={'where':_0x222d04[_0x34eb('0x37')]};return db[_0x34eb('0x26')][_0x34eb('0x3a')](_0x2fa1f4)[_0x34eb('0x10')](function(_0x29e35c){_0x47930a['count']=_0x29e35c;if(_0x13b8af[_0x34eb('0x2b')]['includeAll']){_0x222d04['include']=[{'all':!![]}];}return db['SmsMessage'][_0x34eb('0x3b')](_0x222d04);})[_0x34eb('0x10')](function(_0x432e14){_0x47930a[_0x34eb('0x3c')]=_0x432e14;return _0x47930a;})[_0x34eb('0x10')](respondWithFilteredResult(_0x18845e,_0x222d04))[_0x34eb('0x1b')](handleError(_0x18845e,null));};exports[_0x34eb('0x3d')]=function(_0x294ba1,_0xcd8124){var _0x463c9d={'raw':!![],'where':{'id':_0x294ba1[_0x34eb('0x3e')]['id']}},_0xd4dbaa={};_0xd4dbaa[_0x34eb('0x2a')]=_['keys'](db['SmsMessage'][_0x34eb('0x27')]);_0xd4dbaa['query']=_[_0x34eb('0x3f')](_0x294ba1['query']);_0xd4dbaa[_0x34eb('0x2c')]=_[_0x34eb('0x40')](_0xd4dbaa[_0x34eb('0x2a')],_0xd4dbaa['query']);_0x463c9d['attributes']=_[_0x34eb('0x40')](_0xd4dbaa[_0x34eb('0x2a')],qs['fields'](_0x294ba1[_0x34eb('0x2b')]['fields']));_0x463c9d[_0x34eb('0x2e')]=_0x463c9d[_0x34eb('0x2e')][_0x34eb('0x2f')]?_0x463c9d[_0x34eb('0x2e')]:_0xd4dbaa[_0x34eb('0x2a')];if(_0x294ba1[_0x34eb('0x2b')][_0x34eb('0x41')]){_0x463c9d[_0x34eb('0x42')]=[{'all':!![]}];}_0x463c9d=_[_0x34eb('0x36')]({},_0x463c9d,_0x294ba1['options']);return db['SmsMessage'][_0x34eb('0x43')](_0x463c9d)['then'](handleEntityNotFound(_0xcd8124,null))[_0x34eb('0x10')](respondWithResult(_0xcd8124,null))[_0x34eb('0x1b')](handleError(_0xcd8124,null));};exports[_0x34eb('0x44')]=function(_0x4afc37,_0x3052c5){return db[_0x34eb('0x26')][_0x34eb('0x44')](_0x4afc37[_0x34eb('0x45')],{})[_0x34eb('0x10')](respondWithResult(_0x3052c5,0xc9))[_0x34eb('0x1b')](handleError(_0x3052c5,null));};exports[_0x34eb('0x46')]=function(_0x52693e,_0x4f030f){if(_0x52693e[_0x34eb('0x45')]['id']){delete _0x52693e[_0x34eb('0x45')]['id'];}return db[_0x34eb('0x26')]['find']({'where':{'id':_0x52693e[_0x34eb('0x3e')]['id']}})[_0x34eb('0x10')](handleEntityNotFound(_0x4f030f,null))['then'](saveUpdates(_0x52693e[_0x34eb('0x45')],null))[_0x34eb('0x10')](respondWithResult(_0x4f030f,null))[_0x34eb('0x1b')](handleError(_0x4f030f,null));};exports[_0x34eb('0x47')]=function(_0x5a33f0,_0x24fc70){return db[_0x34eb('0x26')]['find']({'where':{'id':_0x5a33f0[_0x34eb('0x3e')]['id']}})[_0x34eb('0x10')](handleEntityNotFound(_0x24fc70,null))['then'](removeEntity(_0x24fc70,null))[_0x34eb('0x1b')](handleError(_0x24fc70,null));};exports['describe']=function(_0x1c5bb2,_0xf55789){return db[_0x34eb('0x26')][_0x34eb('0x48')]()[_0x34eb('0x10')](respondWithResult(_0xf55789,null))[_0x34eb('0x1b')](handleError(_0xf55789,null));};exports[_0x34eb('0x49')]=function(_0xae6d1b,_0x181b3b){var _0x212bf4=_0x34eb('0x4a');return interactionService[_0x34eb('0x4b')](_0xae6d1b,_0x212bf4)[_0x34eb('0x10')](respondWithResult(_0x181b3b,null))[_0x34eb('0x1b')](handleError(_0x181b3b,null));};exports[_0x34eb('0x4c')]=function(_0x55052c,_0x1606e1){var _0x5368c3={'agent':{},'channel':'sms'};if(_0x55052c[_0x34eb('0x45')]['id']){delete _0x55052c[_0x34eb('0x45')]['id'];}_0x55052c['body'][_0x34eb('0x4d')]=_0x55052c['body'][_0x34eb('0x4d')]||_0x55052c['user']['id'];_0x5368c3[_0x34eb('0x4e')]['id']=_0x55052c[_0x34eb('0x45')]['UserId'];return db['SmsMessage'][_0x34eb('0x43')]({'where':{'id':_0x55052c['params']['id'],'UserId':null}})[_0x34eb('0x10')](handleEntityNotFound(_0x1606e1,null))[_0x34eb('0x10')](function(_0x3bb8ae){if(_0x3bb8ae){_0x5368c3[_0x34eb('0x19')]=_0x3bb8ae['get']({'plain':!![]});return db['SmsInteraction'][_0x34eb('0x43')]({'where':{'id':_0x3bb8ae[_0x34eb('0x4f')]}});}return null;})[_0x34eb('0x10')](handleEntityNotFound(_0x1606e1,null))[_0x34eb('0x10')](function(_0x42541e){if(_0x42541e){_0x5368c3[_0x34eb('0x50')]=_0x42541e['get']({'plain':!![]});interaction_log[_0x34eb('0x11')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x55052c['user']['id'],_0x55052c[_0x34eb('0x51')][_0x34eb('0x22')],_0x55052c['user'][_0x34eb('0x52')],_0x5368c3[_0x34eb('0x50')]['id'],_0x55052c['body']?JSON[_0x34eb('0x16')](_0x55052c[_0x34eb('0x45')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x5368c3);}return null;})[_0x34eb('0x10')](function(_0x1ae55c){var _0x1605d3=_0x34eb('0x53')+_0x1ae55c[_0x34eb('0x19')][_0x34eb('0x54')];return db[_0x34eb('0x55')][_0x34eb('0x2b')](_0x1605d3,{'type':db[_0x34eb('0x56')][_0x34eb('0x57')][_0x34eb('0x58')],'raw':!![]})[_0x34eb('0x10')](function(_0x5b3f16){return _0x5b3f16;});})[_0x34eb('0x10')](function(_0x480dec){if(_0x480dec){_0x5368c3[_0x34eb('0x19')][_0x34eb('0x59')]=_0x480dec[0x0];if(!_0x55052c[_0x34eb('0x45')][_0x34eb('0x4d')])return;return db[_0x34eb('0x5a')][_0x34eb('0x43')]({'where':{'id':_0x55052c[_0x34eb('0x45')]['UserId'],'role':'agent'},'attributes':['id',_0x34eb('0x22'),'fullname',_0x34eb('0x5b'),_0x34eb('0x5c')],'raw':!![]});}return null;})[_0x34eb('0x10')](function(_0x4caa21){if(!_0x4caa21)return null;_0x5368c3[_0x34eb('0x19')][_0x34eb('0x4e')]=_0x4caa21;return _0x5368c3;})['then'](function(_0x240e63){if(_0x240e63){_0x240e63[_0x34eb('0x19')][_0x34eb('0x5d')]=util['format']('SIP/%s',_0x55052c[_0x34eb('0x51')][_0x34eb('0x22')]);_0x240e63[_0x34eb('0x19')][_0x34eb('0x5e')]=_0x5368c3['channel'];_0x240e63['message'][_0x34eb('0x5f')]=_0x5368c3[_0x34eb('0x5e')];_0x240e63[_0x34eb('0x19')]['event']='reject';respondWithRpcPromise(_0x34eb('0x60'),'EventManager',{'event':_0x34eb('0x61'),'message':_0x240e63[_0x34eb('0x19')]},client9002);return _0x5368c3;}return null;})[_0x34eb('0x10')](respondWithResult(_0x1606e1,null))[_0x34eb('0x1b')](handleError(_0x1606e1,null));};exports[_0x34eb('0x1c')]=function(_0x51b084,_0x216fde){if(_0x51b084[_0x34eb('0x45')]['id']){delete _0x51b084[_0x34eb('0x45')]['id'];}var _0x954deb;return db[_0x34eb('0x26')]['find']({'where':{'id':_0x51b084['params']['id']}})[_0x34eb('0x10')](handleEntityNotFound(_0x216fde,null))[_0x34eb('0x10')](function(_0x58af57){if(_0x58af57){_0x954deb=_0x58af57;return db['SmsAccount'][_0x34eb('0x43')]({'where':{'id':_0x58af57[_0x34eb('0x62')]}});}})[_0x34eb('0x10')](handleEntityNotFound(_0x216fde,null))[_0x34eb('0x10')](function(_0x6cf7c){if(_0x6cf7c){logger[_0x34eb('0x14')](_0x34eb('0x15'),'status',_0x34eb('0x63'),_0x6cf7c[_0x34eb('0x64')],util[_0x34eb('0x65')](_0x51b084[_0x34eb('0x45')],{'showHidden':![],'depth':null}));switch(_0x6cf7c[_0x34eb('0x64')]){case _0x34eb('0x66'):if(_0x51b084[_0x34eb('0x45')][_0x34eb('0x67')]&&_0x51b084[_0x34eb('0x45')]['MessageSid']===_0x954deb[_0x34eb('0x68')]){return _0x954deb[_0x34eb('0x46')]({'read':!![]});}else{logger[_0x34eb('0x17')](_0x34eb('0x69'),_0x34eb('0x1c'),'twilio',util[_0x34eb('0x65')](_0x51b084[_0x34eb('0x45')],{'showHidden':![],'depth':null}));}break;case _0x34eb('0x6a'):if(_0x51b084[_0x34eb('0x45')][_0x34eb('0x6b')]&&_0x51b084[_0x34eb('0x45')][_0x34eb('0x6b')]===_0x954deb[_0x34eb('0x68')]&&_['indexOf']([_0x34eb('0x6c'),'delivered'],_0x51b084[_0x34eb('0x45')][_0x34eb('0x6d')])>=0x0){return _0x954deb[_0x34eb('0x46')]({'read':!![]});}else{logger['error'](_0x34eb('0x69'),_0x34eb('0x1c'),'plivio',util[_0x34eb('0x65')](_0x51b084[_0x34eb('0x45')],{'showHidden':![],'depth':null}));}break;case _0x34eb('0x6e'):var _0x11d0f7=_0x51b084[_0x34eb('0x45')][_0x34eb('0x6f')][0x0];if(_0x11d0f7[_0x34eb('0x1c')][_0x34eb('0x70')]===_0x34eb('0x71')){return _0x954deb[_0x34eb('0x46')]({'read':!![]});}else{logger[_0x34eb('0x17')](_0x34eb('0x69'),_0x34eb('0x1c'),_0x34eb('0x6e'),util[_0x34eb('0x65')](_0x51b084[_0x34eb('0x45')],{'showHidden':![],'depth':null}));}break;}return _0x954deb;}})[_0x34eb('0x10')](respondWithResult(_0x216fde,null))['catch'](handleError(_0x216fde,null));}; \ No newline at end of file +var _0xc7b8=['create','body','find','describe','accept','acceptMessage','reject','sms','UserId','user','SmsInteraction','SmsInteractionId','interaction','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','format','channel','motionChannel','event','EventManager','rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','Status','infobip','results','groupName','util','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','json','undefined','count','offset','Content-Range','update','destroy','end','name','send','map','SmsMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','include','rows','params','includeAll','merge'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xc7b8,0x119));var _0x8c7b=function(_0x215994,_0x55825c){_0x215994=_0x215994-0x0;var _0x249ed7=_0xc7b8[_0x215994];return _0x249ed7;};'use strict';var util=require(_0x8c7b('0x0'));var _=require(_0x8c7b('0x1'));var Redis=require('ioredis');var interactionService=require(_0x8c7b('0x2'));var qs=require(_0x8c7b('0x3'));var logger=require(_0x8c7b('0x4'))(_0x8c7b('0x5'));var config=require(_0x8c7b('0x6'));var db=require(_0x8c7b('0x7'))['db'];config['redis']=_[_0x8c7b('0x8')](config[_0x8c7b('0x9')],{'host':_0x8c7b('0xa'),'port':0x18eb});var socket=require(_0x8c7b('0xb'))(new Redis(config[_0x8c7b('0x9')]));require(_0x8c7b('0xc'))[_0x8c7b('0xd')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8c7b('0xe')][_0x8c7b('0xf')]({'port':0x232c});var client9002=jayson['client'][_0x8c7b('0xf')]({'port':0x232a});var interaction_log=require('../../config/logger')('sms-interactions');function respondWithRpcPromise(_0x551b3f,_0x3f3fb6,_0x59424a,_0x33e618){return new Promise(function(_0x41a96c,_0x38fd55){var _0x4e3716=_0x33e618||client;return _0x4e3716['request'](_0x551b3f,_0x59424a)[_0x8c7b('0x10')](function(_0x32a153){logger[_0x8c7b('0x11')](_0x8c7b('0x12'),_0x3f3fb6,_0x8c7b('0x13'));logger['debug'](_0x8c7b('0x14'),_0x3f3fb6,_0x8c7b('0x13'),JSON[_0x8c7b('0x15')](_0x32a153));if(_0x32a153[_0x8c7b('0x16')]){if(_0x32a153[_0x8c7b('0x16')]['code']===0x1f4){logger[_0x8c7b('0x16')](_0x8c7b('0x12'),_0x3f3fb6,_0x32a153[_0x8c7b('0x16')][_0x8c7b('0x17')]);return _0x38fd55(_0x32a153[_0x8c7b('0x16')]['message']);}logger[_0x8c7b('0x16')](_0x8c7b('0x12'),_0x3f3fb6,_0x32a153['error']['message']);return _0x41a96c(_0x32a153[_0x8c7b('0x16')][_0x8c7b('0x17')]);}else{logger[_0x8c7b('0x11')](_0x8c7b('0x12'),_0x3f3fb6,_0x8c7b('0x13'));_0x41a96c(_0x32a153['result'][_0x8c7b('0x17')]);}})[_0x8c7b('0x18')](function(_0x3eb1e1){logger['error'](_0x8c7b('0x12'),_0x3f3fb6,_0x3eb1e1);_0x38fd55(_0x3eb1e1);});});}function respondWithResult(_0x2bf9e2,_0x404db9){_0x404db9=_0x404db9||0xc8;return function(_0x11d8a5){if(_0x11d8a5){return _0x2bf9e2[_0x8c7b('0x19')](_0x404db9)[_0x8c7b('0x1a')](_0x11d8a5);}};}function respondWithFilteredResult(_0x5859c3,_0x1ff17a){return function(_0x5e95c2){if(_0x5e95c2){var _0x29b571=typeof _0x1ff17a['offset']===_0x8c7b('0x1b')&&typeof _0x1ff17a['limit']===_0x8c7b('0x1b');var _0x21dad6=_0x5e95c2[_0x8c7b('0x1c')];var _0x3bafb2=_0x29b571?0x0:_0x1ff17a[_0x8c7b('0x1d')];var _0x25e28a=_0x29b571?_0x5e95c2['count']:_0x1ff17a[_0x8c7b('0x1d')]+_0x1ff17a['limit'];var _0x5ebcaf;if(_0x25e28a>=_0x21dad6){_0x25e28a=_0x21dad6;_0x5ebcaf=0xc8;}else{_0x5ebcaf=0xce;}_0x5859c3[_0x8c7b('0x19')](_0x5ebcaf);return _0x5859c3['set'](_0x8c7b('0x1e'),_0x3bafb2+'-'+_0x25e28a+'/'+_0x21dad6)[_0x8c7b('0x1a')](_0x5e95c2);}return null;};}function saveUpdates(_0x5cdfab){return function(_0x34b019){if(_0x34b019){return _0x34b019[_0x8c7b('0x1f')](_0x5cdfab)[_0x8c7b('0x10')](function(_0x4b76b2){return _0x4b76b2;});}return null;};}function removeEntity(_0x54a8a8){return function(_0x5935ed){if(_0x5935ed){return _0x5935ed[_0x8c7b('0x20')]()[_0x8c7b('0x10')](function(){_0x54a8a8['status'](0xcc)[_0x8c7b('0x21')]();});}};}function handleEntityNotFound(_0x11c286){return function(_0x510beb){if(!_0x510beb){_0x11c286['sendStatus'](0x194);}return _0x510beb;};}function handleError(_0x3ea981,_0xed7447){_0xed7447=_0xed7447||0x1f4;return function(_0x26da68){logger[_0x8c7b('0x16')](_0x26da68['stack']);if(_0x26da68[_0x8c7b('0x22')]){delete _0x26da68[_0x8c7b('0x22')];}_0x3ea981[_0x8c7b('0x19')](_0xed7447)[_0x8c7b('0x23')](_0x26da68);};}exports['index']=function(_0x1be946,_0x8eb29d){var _0x435412={},_0x9f40d3={},_0x793f94={'count':0x0,'rows':[]};var _0x5ac23e=_[_0x8c7b('0x24')](db[_0x8c7b('0x25')][_0x8c7b('0x26')],function(_0x2d0c75){return{'name':_0x2d0c75['fieldName'],'type':_0x2d0c75[_0x8c7b('0x27')][_0x8c7b('0x28')]};});_0x9f40d3[_0x8c7b('0x29')]=_['map'](_0x5ac23e,'name');_0x9f40d3[_0x8c7b('0x2a')]=_[_0x8c7b('0x2b')](_0x1be946[_0x8c7b('0x2a')]);_0x9f40d3[_0x8c7b('0x2c')]=_[_0x8c7b('0x2d')](_0x9f40d3['model'],_0x9f40d3['query']);_0x435412[_0x8c7b('0x2e')]=_[_0x8c7b('0x2d')](_0x9f40d3[_0x8c7b('0x29')],qs['fields'](_0x1be946[_0x8c7b('0x2a')][_0x8c7b('0x2f')]));_0x435412[_0x8c7b('0x2e')]=_0x435412[_0x8c7b('0x2e')][_0x8c7b('0x30')]?_0x435412[_0x8c7b('0x2e')]:_0x9f40d3[_0x8c7b('0x29')];if(!_0x1be946[_0x8c7b('0x2a')][_0x8c7b('0x31')](_0x8c7b('0x32'))){_0x435412['limit']=qs[_0x8c7b('0x33')](_0x1be946[_0x8c7b('0x2a')][_0x8c7b('0x33')]);_0x435412[_0x8c7b('0x1d')]=qs[_0x8c7b('0x1d')](_0x1be946[_0x8c7b('0x2a')][_0x8c7b('0x1d')]);}_0x435412[_0x8c7b('0x34')]=qs[_0x8c7b('0x35')](_0x1be946[_0x8c7b('0x2a')][_0x8c7b('0x35')]);_0x435412[_0x8c7b('0x36')]=qs[_0x8c7b('0x2c')](_[_0x8c7b('0x37')](_0x1be946[_0x8c7b('0x2a')],_0x9f40d3[_0x8c7b('0x2c')]),_0x5ac23e);if(_0x1be946[_0x8c7b('0x2a')][_0x8c7b('0x38')]){_0x435412[_0x8c7b('0x36')]=_['merge'](_0x435412[_0x8c7b('0x36')],{'$or':_[_0x8c7b('0x24')](_0x5ac23e,function(_0x1e7ffa){if(_0x1e7ffa[_0x8c7b('0x27')]!==_0x8c7b('0x39')){var _0x489bd0={};_0x489bd0[_0x1e7ffa[_0x8c7b('0x22')]]={'$like':'%'+_0x1be946[_0x8c7b('0x2a')][_0x8c7b('0x38')]+'%'};return _0x489bd0;}})});}_0x435412=_['merge']({},_0x435412,_0x1be946[_0x8c7b('0x3a')]);var _0x383740={'where':_0x435412[_0x8c7b('0x36')]};return db[_0x8c7b('0x25')][_0x8c7b('0x1c')](_0x383740)[_0x8c7b('0x10')](function(_0x29f1b7){_0x793f94['count']=_0x29f1b7;if(_0x1be946[_0x8c7b('0x2a')]['includeAll']){_0x435412[_0x8c7b('0x3b')]=[{'all':!![]}];}return db[_0x8c7b('0x25')]['findAll'](_0x435412);})[_0x8c7b('0x10')](function(_0x14fa55){_0x793f94[_0x8c7b('0x3c')]=_0x14fa55;return _0x793f94;})['then'](respondWithFilteredResult(_0x8eb29d,_0x435412))[_0x8c7b('0x18')](handleError(_0x8eb29d,null));};exports['show']=function(_0x216e22,_0x10a526){var _0xdee425={'raw':!![],'where':{'id':_0x216e22[_0x8c7b('0x3d')]['id']}},_0xe7cd37={};_0xe7cd37[_0x8c7b('0x29')]=_[_0x8c7b('0x2b')](db[_0x8c7b('0x25')][_0x8c7b('0x26')]);_0xe7cd37['query']=_['keys'](_0x216e22[_0x8c7b('0x2a')]);_0xe7cd37[_0x8c7b('0x2c')]=_['intersection'](_0xe7cd37[_0x8c7b('0x29')],_0xe7cd37[_0x8c7b('0x2a')]);_0xdee425[_0x8c7b('0x2e')]=_['intersection'](_0xe7cd37[_0x8c7b('0x29')],qs[_0x8c7b('0x2f')](_0x216e22[_0x8c7b('0x2a')]['fields']));_0xdee425[_0x8c7b('0x2e')]=_0xdee425[_0x8c7b('0x2e')]['length']?_0xdee425[_0x8c7b('0x2e')]:_0xe7cd37[_0x8c7b('0x29')];if(_0x216e22[_0x8c7b('0x2a')][_0x8c7b('0x3e')]){_0xdee425[_0x8c7b('0x3b')]=[{'all':!![]}];}_0xdee425=_[_0x8c7b('0x3f')]({},_0xdee425,_0x216e22[_0x8c7b('0x3a')]);return db[_0x8c7b('0x25')]['find'](_0xdee425)[_0x8c7b('0x10')](handleEntityNotFound(_0x10a526,null))['then'](respondWithResult(_0x10a526,null))[_0x8c7b('0x18')](handleError(_0x10a526,null));};exports[_0x8c7b('0x40')]=function(_0x395843,_0x163450){return db['SmsMessage'][_0x8c7b('0x40')](_0x395843[_0x8c7b('0x41')],{})[_0x8c7b('0x10')](respondWithResult(_0x163450,0xc9))[_0x8c7b('0x18')](handleError(_0x163450,null));};exports['update']=function(_0x4147a1,_0x3ed8b6){if(_0x4147a1[_0x8c7b('0x41')]['id']){delete _0x4147a1[_0x8c7b('0x41')]['id'];}return db['SmsMessage'][_0x8c7b('0x42')]({'where':{'id':_0x4147a1[_0x8c7b('0x3d')]['id']}})[_0x8c7b('0x10')](handleEntityNotFound(_0x3ed8b6,null))[_0x8c7b('0x10')](saveUpdates(_0x4147a1[_0x8c7b('0x41')],null))[_0x8c7b('0x10')](respondWithResult(_0x3ed8b6,null))[_0x8c7b('0x18')](handleError(_0x3ed8b6,null));};exports['destroy']=function(_0x5e52cf,_0x544122){return db[_0x8c7b('0x25')][_0x8c7b('0x42')]({'where':{'id':_0x5e52cf['params']['id']}})['then'](handleEntityNotFound(_0x544122,null))['then'](removeEntity(_0x544122,null))['catch'](handleError(_0x544122,null));};exports[_0x8c7b('0x43')]=function(_0x3e3ee6,_0x4c29b6){return db[_0x8c7b('0x25')][_0x8c7b('0x43')]()['then'](respondWithResult(_0x4c29b6,null))[_0x8c7b('0x18')](handleError(_0x4c29b6,null));};exports[_0x8c7b('0x44')]=function(_0x3083b7,_0x451915){var _0x5156a1='sms';return interactionService[_0x8c7b('0x45')](_0x3083b7,_0x5156a1)[_0x8c7b('0x10')](respondWithResult(_0x451915,null))[_0x8c7b('0x18')](handleError(_0x451915,null));};exports[_0x8c7b('0x46')]=function(_0x1c520c,_0x1a5eb8){var _0x46ed8f={'agent':{},'channel':_0x8c7b('0x47')};if(_0x1c520c[_0x8c7b('0x41')]['id']){delete _0x1c520c[_0x8c7b('0x41')]['id'];}_0x1c520c['body'][_0x8c7b('0x48')]=_0x1c520c[_0x8c7b('0x41')][_0x8c7b('0x48')]||_0x1c520c[_0x8c7b('0x49')]['id'];_0x46ed8f['agent']['id']=_0x1c520c[_0x8c7b('0x41')][_0x8c7b('0x48')];return db[_0x8c7b('0x25')][_0x8c7b('0x42')]({'where':{'id':_0x1c520c['params']['id'],'UserId':null}})[_0x8c7b('0x10')](handleEntityNotFound(_0x1a5eb8,null))['then'](function(_0x374793){if(_0x374793){_0x46ed8f[_0x8c7b('0x17')]=_0x374793['get']({'plain':!![]});return db[_0x8c7b('0x4a')][_0x8c7b('0x42')]({'where':{'id':_0x374793[_0x8c7b('0x4b')]}});}return null;})[_0x8c7b('0x10')](handleEntityNotFound(_0x1a5eb8,null))[_0x8c7b('0x10')](function(_0x35ba66){if(_0x35ba66){_0x46ed8f[_0x8c7b('0x4c')]=_0x35ba66[_0x8c7b('0x4d')]({'plain':!![]});interaction_log[_0x8c7b('0x11')](_0x8c7b('0x4e'),_0x1c520c[_0x8c7b('0x49')]['id'],_0x1c520c['user']['name'],_0x1c520c[_0x8c7b('0x49')][_0x8c7b('0x4f')],_0x46ed8f[_0x8c7b('0x4c')]['id'],_0x1c520c['body']?JSON['stringify'](_0x1c520c[_0x8c7b('0x41')]):_0x8c7b('0x50'));return respondWithRpcPromise('RejectMessage',_0x8c7b('0x51'),_0x46ed8f);}return null;})[_0x8c7b('0x10')](function(_0x45af38){var _0x274aae=_0x8c7b('0x52')+_0x45af38['message'][_0x8c7b('0x53')];return db[_0x8c7b('0x54')]['query'](_0x274aae,{'type':db[_0x8c7b('0x55')][_0x8c7b('0x56')][_0x8c7b('0x57')],'raw':!![]})[_0x8c7b('0x10')](function(_0x49aaad){return _0x49aaad;});})['then'](function(_0x42184c){if(_0x42184c){_0x46ed8f[_0x8c7b('0x17')][_0x8c7b('0x58')]=_0x42184c[0x0];if(!_0x1c520c['body'][_0x8c7b('0x48')])return;return db[_0x8c7b('0x59')][_0x8c7b('0x42')]({'where':{'id':_0x1c520c[_0x8c7b('0x41')][_0x8c7b('0x48')],'role':_0x8c7b('0x5a')},'attributes':['id','name',_0x8c7b('0x5b'),'email',_0x8c7b('0x5c')],'raw':!![]});}return null;})[_0x8c7b('0x10')](function(_0x167be2){if(!_0x167be2)return null;_0x46ed8f[_0x8c7b('0x17')][_0x8c7b('0x5a')]=_0x167be2;return _0x46ed8f;})[_0x8c7b('0x10')](function(_0x21047f){if(_0x21047f){_0x21047f[_0x8c7b('0x17')]['interface']=util[_0x8c7b('0x5d')]('SIP/%s',_0x1c520c[_0x8c7b('0x49')]['name']);_0x21047f[_0x8c7b('0x17')][_0x8c7b('0x5e')]=_0x46ed8f[_0x8c7b('0x5e')];_0x21047f[_0x8c7b('0x17')][_0x8c7b('0x5f')]=_0x46ed8f[_0x8c7b('0x5e')];_0x21047f[_0x8c7b('0x17')][_0x8c7b('0x60')]=_0x8c7b('0x46');respondWithRpcPromise(_0x8c7b('0x61'),'EventManager',{'event':_0x8c7b('0x62'),'message':_0x21047f[_0x8c7b('0x17')]},client9002);return _0x46ed8f;}return null;})[_0x8c7b('0x10')](respondWithResult(_0x1a5eb8,null))[_0x8c7b('0x18')](handleError(_0x1a5eb8,null));};exports['status']=function(_0x5711ab,_0x490175){if(_0x5711ab['body']['id']){delete _0x5711ab['body']['id'];}var _0x2653c2;return db[_0x8c7b('0x25')][_0x8c7b('0x42')]({'where':{'id':_0x5711ab[_0x8c7b('0x3d')]['id']}})[_0x8c7b('0x10')](handleEntityNotFound(_0x490175,null))['then'](function(_0x3fc40a){if(_0x3fc40a){_0x2653c2=_0x3fc40a;return db[_0x8c7b('0x63')][_0x8c7b('0x42')]({'where':{'id':_0x3fc40a[_0x8c7b('0x64')]}});}})[_0x8c7b('0x10')](handleEntityNotFound(_0x490175,null))[_0x8c7b('0x10')](function(_0x3ca429){if(_0x3ca429){logger[_0x8c7b('0x65')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8c7b('0x19'),_0x8c7b('0x66'),_0x3ca429[_0x8c7b('0x27')],util[_0x8c7b('0x67')](_0x5711ab[_0x8c7b('0x41')],{'showHidden':![],'depth':null}));switch(_0x3ca429[_0x8c7b('0x27')]){case _0x8c7b('0x68'):if(_0x5711ab['body'][_0x8c7b('0x69')]&&_0x5711ab[_0x8c7b('0x41')][_0x8c7b('0x69')]===_0x2653c2[_0x8c7b('0x6a')]){return _0x2653c2[_0x8c7b('0x1f')]({'read':!![]});}else{logger['error'](_0x8c7b('0x6b'),_0x8c7b('0x19'),_0x8c7b('0x68'),util[_0x8c7b('0x67')](_0x5711ab['body'],{'showHidden':![],'depth':null}));}break;case _0x8c7b('0x6c'):if(_0x5711ab[_0x8c7b('0x41')][_0x8c7b('0x6d')]&&_0x5711ab[_0x8c7b('0x41')][_0x8c7b('0x6d')]===_0x2653c2[_0x8c7b('0x6a')]&&_[_0x8c7b('0x6e')](['sent','delivered'],_0x5711ab[_0x8c7b('0x41')][_0x8c7b('0x6f')])>=0x0){return _0x2653c2[_0x8c7b('0x1f')]({'read':!![]});}else{logger[_0x8c7b('0x16')](_0x8c7b('0x6b'),_0x8c7b('0x19'),'plivio',util[_0x8c7b('0x67')](_0x5711ab['body'],{'showHidden':![],'depth':null}));}break;case _0x8c7b('0x70'):var _0x1a8dec=_0x5711ab['body'][_0x8c7b('0x71')][0x0];if(_0x1a8dec[_0x8c7b('0x19')][_0x8c7b('0x72')]==='DELIVERED'){return _0x2653c2[_0x8c7b('0x1f')]({'read':!![]});}else{logger[_0x8c7b('0x16')](_0x8c7b('0x6b'),_0x8c7b('0x19'),'infobip',util[_0x8c7b('0x67')](_0x5711ab['body'],{'showHidden':![],'depth':null}));}break;}return _0x2653c2;}})[_0x8c7b('0x10')](respondWithResult(_0x490175,null))[_0x8c7b('0x18')](handleError(_0x490175,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 06fca9c..011ffd8 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 _0x72d2=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x72d2,0x116));var _0x272d=function(_0x274509,_0x1353f7){_0x274509=_0x274509-0x0;var _0x47298c=_0x72d2[_0x274509];return _0x47298c;};'use strict';var EventEmitter=require(_0x272d('0x0'));var SmsMessage=require(_0x272d('0x1'))['db'][_0x272d('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x272d('0x3')](0x0);var events={'afterCreate':_0x272d('0x4'),'afterUpdate':_0x272d('0x5'),'afterDestroy':_0x272d('0x6')};function emitEvent(_0xb03b06){return function(_0xd39cd5,_0x50ebd0,_0x43b7b9){SmsMessageEvents['emit'](_0xb03b06+':'+_0xd39cd5['id'],_0xd39cd5);SmsMessageEvents[_0x272d('0x7')](_0xb03b06,_0xd39cd5);_0x43b7b9(null);};}for(var e in events){if(events[_0x272d('0x8')](e)){var event=events[e];SmsMessage[_0x272d('0x9')](e,emitEvent(event));}}module[_0x272d('0xa')]=SmsMessageEvents; \ No newline at end of file +var _0x0dc1=['remove','emit','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0dc1,0x67));var _0x10dc=function(_0xa3177e,_0x98f16f){_0xa3177e=_0xa3177e-0x0;var _0x6c195e=_0x0dc1[_0xa3177e];return _0x6c195e;};'use strict';var EventEmitter=require(_0x10dc('0x0'));var SmsMessage=require(_0x10dc('0x1'))['db'][_0x10dc('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x10dc('0x3')](0x0);var events={'afterCreate':_0x10dc('0x4'),'afterUpdate':'update','afterDestroy':_0x10dc('0x5')};function emitEvent(_0x12f952){return function(_0x37b618,_0x2e6217,_0x582b48){SmsMessageEvents[_0x10dc('0x6')](_0x12f952+':'+_0x37b618['id'],_0x37b618);SmsMessageEvents['emit'](_0x12f952,_0x37b618);_0x582b48(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x10dc('0x7')](e,emitEvent(event));}}module[_0x10dc('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index f5b27fe..0e7cc22 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 _0xfcf5=['sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','./smsMessage.attributes','exports','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','error','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','/api/sms/messages/','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','sms','user_key','session_key','total_sent','internal_order_id','read','catch','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','POST','Basic\x20%s','toString','base64','data','message_id','clickSend','plivo','authId','remote','token','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','csc','crypto','apiKey','login','text','timestamp','keys'];(function(_0x1f7d6c,_0x512583){var _0x5e0321=function(_0x40cfb9){while(--_0x40cfb9){_0x1f7d6c['push'](_0x1f7d6c['shift']());}};_0x5e0321(++_0x512583);}(_0xfcf5,0x9c));var _0x5fcf=function(_0x14548d,_0x3691dd){_0x14548d=_0x14548d-0x0;var _0x4f1cea=_0xfcf5[_0x14548d];return _0x4f1cea;};'use strict';var _=require(_0x5fcf('0x0'));var util=require('util');var logger=require(_0x5fcf('0x1'))(_0x5fcf('0x2'));var moment=require(_0x5fcf('0x3'));var BPromise=require('bluebird');var rp=require(_0x5fcf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5fcf('0x5'));module[_0x5fcf('0x6')]=function(_0xa473d6,_0x1d8d08){return _0xa473d6['define']('SmsMessage',attributes,{'tableName':_0x5fcf('0x7'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x5fcf('0x8')]},{'name':_0x5fcf('0x9'),'fields':['body'],'type':_0x5fcf('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4deb08,_0x525b7c,_0xc39d4b){var _0x32b7d7=_0xa473d6[_0x5fcf('0xb')];var _0xc70c01=_0x4deb08[_0x5fcf('0xc')]({'plain':!![]});if(_0xc70c01[_0x5fcf('0xd')]['toLowerCase']()==='in'||_0xc70c01[_0x5fcf('0xd')][_0x5fcf('0xe')]()===_0x5fcf('0xf')&&!_0xc70c01[_0x5fcf('0x10')]&&!_[_0x5fcf('0x11')](_0xc70c01[_0x5fcf('0x12')])&&!_[_0x5fcf('0x11')](_0xc70c01['SmsInteractionId'])){_0x32b7d7[_0x5fcf('0x13')][_0x5fcf('0x14')]({'where':{'id':_0xc70c01[_0x5fcf('0x15')]}})[_0x5fcf('0x16')](function(_0x49231b){if(_0x49231b){_0x49231b[_0x5fcf('0x17')]({'lastMsgAt':_0xc70c01[_0x5fcf('0x18')],'lastMsgDirection':_0xc70c01['direction'][_0x5fcf('0xe')]()});}})['catch'](function(_0x4c7c0a){console[_0x5fcf('0x19')](_0x4c7c0a);});}if(_0xc70c01[_0x5fcf('0xd')]===_0x5fcf('0xf')&&!_0xc70c01[_0x5fcf('0x10')]){var _0x2c8f3b;_0x32b7d7[_0x5fcf('0x1a')]['find']({'where':{'id':_0xc70c01[_0x5fcf('0x1b')]},'raw':!![]})['then'](function(_0x238cf7){_0x2c8f3b=_0x238cf7;if(_0x2c8f3b&&_0x2c8f3b[_0x5fcf('0x1c')]){switch(_0x2c8f3b['type']){case _0x5fcf('0x1d'):var _0x2f7a4a=require(_0x5fcf('0x1d'));if(_0x2c8f3b[_0x5fcf('0x1e')]&&_0x2c8f3b[_0x5fcf('0x1f')]&&_0x2c8f3b[_0x5fcf('0x20')]){var _0x1db659=new _0x2f7a4a(_0x2c8f3b['accountSid'],_0x2c8f3b['authToken']);_0x1db659[_0x5fcf('0x21')][_0x5fcf('0x22')]({'body':_0xc70c01[_0x5fcf('0x23')],'to':_0xc70c01['phone'],'from':_0x2c8f3b['phone'],'statusCallback':_0x2c8f3b['remote']+_0x5fcf('0x24')+_0xc70c01['id']+_0x5fcf('0x25')+_0x2c8f3b['token']})['then'](function(_0x20f2a0){if(_0x20f2a0[_0x5fcf('0x26')]){return _0x4deb08[_0x5fcf('0x17')]({'messageId':_0x20f2a0['sid']});}})['catch'](function(_0x102b37){logger[_0x5fcf('0x19')](_0x5fcf('0x27'),_0x5fcf('0x28'),_0x5fcf('0x1d'),util[_0x5fcf('0x29')](_0x102b37,{'showHidden':![],'depth':null}));});}else{logger[_0x5fcf('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5fcf('0x28'),_0x5fcf('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x5fcf('0x2a'):var _0x4856e1=_0x5fcf('0x2b');if(_0x2c8f3b[_0x5fcf('0x2c')]&&_0x2c8f3b[_0x5fcf('0x2d')]){var _0x5a7f96={'recipient':[_0xc70c01[_0x5fcf('0x20')]],'message':_0xc70c01[_0x5fcf('0x23')],'message_type':_0x2c8f3b[_0x5fcf('0x2e')]};if(_0x2c8f3b[_0x5fcf('0x2e')]&&_0x2c8f3b['smsMethod']!=='SI'){_0x5a7f96[_0x5fcf('0x2f')]=_0x2c8f3b['phone'];}var _0xae83a9={'url':_0x4856e1+'login?username='+_0x2c8f3b[_0x5fcf('0x2c')]+_0x5fcf('0x30')+_0x2c8f3b[_0x5fcf('0x2d')],'method':_0x5fcf('0x31')};rp(_0xae83a9)['then'](function(_0x3815aa){var _0x429ec3=_0x3815aa[_0x5fcf('0x32')](';');var _0x145fab={'user_key':_0x429ec3[0x0],'session_key':_0x429ec3[0x1]};_0xae83a9={'url':_0x4856e1+_0x5fcf('0x33'),'method':'POST','headers':{'user_key':_0x145fab[_0x5fcf('0x34')],'Session_key':_0x145fab[_0x5fcf('0x35')]},'json':!![],'body':_0x5a7f96};return rp(_0xae83a9);})[_0x5fcf('0x16')](function(_0x301fff){if(_0x301fff[_0x5fcf('0x36')]>=0x1){var _0x14d1ac={'messageId':_0x301fff[_0x5fcf('0x37')]};if(_0x2c8f3b['smsMethod']!=='GP'||!_0x2c8f3b['deliveryReport']){_0x14d1ac[_0x5fcf('0x38')]=!![];}return _0x4deb08[_0x5fcf('0x17')](_0x14d1ac);}else{return logger[_0x5fcf('0x19')](_0x5fcf('0x27'),_0x5fcf('0x28'),_0x5fcf('0x2a'),util['inspect'](_0x301fff,{'showHidden':![],'depth':null}));}})[_0x5fcf('0x39')](function(_0x38df10){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5fcf('0x28'),_0x5fcf('0x2a'),util[_0x5fcf('0x29')](_0x38df10,{'showHidden':![],'depth':null}));});}else{logger[_0x5fcf('0x19')](_0x5fcf('0x27'),_0x5fcf('0x28'),_0x5fcf('0x2a'),_0x5fcf('0x3a'));}break;case _0x5fcf('0x3b'):if(_0x2c8f3b['authToken']){var _0x5bfbb2={'recipient':_0xc70c01[_0x5fcf('0x20')],'message':_0xc70c01[_0x5fcf('0x23')],'sender':_0x2c8f3b[_0x5fcf('0x3c')]||_0x2c8f3b[_0x5fcf('0x20')],'authorization':_0x2c8f3b[_0x5fcf('0x1f')]};var _0x525b7c={'method':'POST','uri':_0x5fcf('0x3d'),'body':_0x5bfbb2,'json':!![]};rp(_0x525b7c)[_0x5fcf('0x16')](function(_0x4d0a2a){var _0x261f64={'messageId':_0x4d0a2a[_0x5fcf('0x3e')]};if(!_0x2c8f3b[_0x5fcf('0x3f')]){_0x261f64[_0x5fcf('0x38')]=!![];}return _0x4deb08[_0x5fcf('0x17')](_0x261f64);})[_0x5fcf('0x39')](function(_0x546a53){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','connectel',util[_0x5fcf('0x29')](_0x546a53,{'showHidden':![],'depth':null}));});}else{logger[_0x5fcf('0x19')](_0x5fcf('0x27'),'afterCreate',_0x5fcf('0x3b'),_0x5fcf('0x40'));}break;case _0x5fcf('0x41'):if(_0x2c8f3b[_0x5fcf('0x2c')]&&_0x2c8f3b['password']){var _0x5bfbb2={'messages':[{'source':_0x5fcf('0x42'),'to':_0xc70c01[_0x5fcf('0x20')],'body':_0xc70c01[_0x5fcf('0x23')],'from':_0x2c8f3b[_0x5fcf('0x3c')]||_0x2c8f3b[_0x5fcf('0x20')]}]};var _0x44d8a9=util[_0x5fcf('0x43')](_0x5fcf('0x44'),_0x2c8f3b[_0x5fcf('0x2c')],_0x2c8f3b[_0x5fcf('0x2d')]);var _0x525b7c={'method':_0x5fcf('0x45'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x5bfbb2,'headers':{'Authorization':util['format'](_0x5fcf('0x46'),new Buffer(_0x44d8a9)[_0x5fcf('0x47')](_0x5fcf('0x48')))},'json':!![]};rp(_0x525b7c)[_0x5fcf('0x16')](function(_0x3549b5){if(_0x3549b5['http_code']>=0xc8&&_0x3549b5['http_code']<=0xce){if(_0x3549b5[_0x5fcf('0x49')]&&_0x3549b5['data']['queued_count']>0x0){var _0x1e97ea=_['head'](_0x3549b5['data']['messages']);var _0x34f7c5={'messageId':_0x1e97ea[_0x5fcf('0x4a')]};if(!_0x2c8f3b[_0x5fcf('0x3f')]){_0x34f7c5[_0x5fcf('0x38')]=!![];}return _0x4deb08['update'](_0x34f7c5);}else{logger[_0x5fcf('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5fcf('0x28'),_0x5fcf('0x4b'),util[_0x5fcf('0x29')](_0x3549b5,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5fcf('0x28'),_0x5fcf('0x4b'),util[_0x5fcf('0x29')](_0x3549b5,{'showHidden':![],'depth':null}));}})[_0x5fcf('0x39')](function(_0x1afddc){logger[_0x5fcf('0x19')](_0x5fcf('0x27'),'afterCreate',_0x5fcf('0x4b'),util[_0x5fcf('0x29')](_0x1afddc,{'showHidden':![],'depth':null}));});}else{logger[_0x5fcf('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',_0x5fcf('0x3a'));}break;case _0x5fcf('0x4c'):if(_0x2c8f3b[_0x5fcf('0x4d')]&&_0x2c8f3b[_0x5fcf('0x1f')]){var _0x5bfbb2={'dst':_0xc70c01[_0x5fcf('0x20')],'text':_0xc70c01['body'],'src':_0x2c8f3b[_0x5fcf('0x3c')]||_0x2c8f3b[_0x5fcf('0x20')],'url':_0x2c8f3b[_0x5fcf('0x4e')]+_0x5fcf('0x24')+_0xc70c01['id']+_0x5fcf('0x25')+_0x2c8f3b[_0x5fcf('0x4f')]};var _0x44d8a9=util[_0x5fcf('0x43')](_0x5fcf('0x44'),_0x2c8f3b[_0x5fcf('0x4d')],_0x2c8f3b['authToken']);var _0x525b7c={'method':_0x5fcf('0x45'),'uri':util[_0x5fcf('0x43')](_0x5fcf('0x50'),_0x2c8f3b['authId']),'body':_0x5bfbb2,'headers':{'Authorization':util[_0x5fcf('0x43')]('Basic\x20%s',new Buffer(_0x44d8a9)['toString'](_0x5fcf('0x48')))},'json':!![]};rp(_0x525b7c)[_0x5fcf('0x16')](function(_0x644953){var _0x1e13f5={'messageId':_0x644953['message_uuid'][0x0]};return _0x4deb08[_0x5fcf('0x17')](_0x1e13f5);})['catch'](function(_0x5e5d40){logger[_0x5fcf('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5fcf('0x28'),'plivo',util[_0x5fcf('0x29')](_0x5e5d40,{'showHidden':![],'depth':null}));});}else{logger[_0x5fcf('0x19')](_0x5fcf('0x27'),_0x5fcf('0x28'),'plivo',_0x5fcf('0x51'));}break;case _0x5fcf('0x52'):if(_0x2c8f3b[_0x5fcf('0x2c')]&&_0x2c8f3b[_0x5fcf('0x2d')]){if(_0x2c8f3b[_0x5fcf('0x53')]){var _0x546688={'method':'POST','uri':_0x2c8f3b[_0x5fcf('0x53')]+_0x5fcf('0x54'),'body':{'username':_0x2c8f3b[_0x5fcf('0x2c')],'password':_0x2c8f3b['password']},'json':!![]};return rp(_0x546688)['then'](function(_0x430ac3){var _0x351a3c={'method':_0x5fcf('0x45'),'uri':_0x2c8f3b['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x2c8f3b['phone'],'destinations':[{'to':_0xc70c01['phone']}],'text':_0xc70c01['body'],'notifyUrl':_0x2c8f3b[_0x5fcf('0x4e')]+_0x5fcf('0x24')+_0xc70c01['id']+'/status?token='+_0x2c8f3b[_0x5fcf('0x4f')],'notifyContentType':_0x5fcf('0x55'),'callbackData':_0x2c8f3b[_0x5fcf('0x20')]+';'+_0xc70c01[_0x5fcf('0x23')]}]},'headers':{'Authorization':_0x5fcf('0x56')+_0x430ac3[_0x5fcf('0x4f')]},'json':!![]};return rp(_0x351a3c)['then'](function(_0x5073b7){if(_0x5073b7[_0x5fcf('0x21')]){var _0x30a5a2={'messageId':_0x5073b7[_0x5fcf('0x21')][0x0][_0x5fcf('0x8')]};if(!_0x2c8f3b[_0x5fcf('0x3f')]){_0x30a5a2[_0x5fcf('0x38')]=!![];}return _0x4deb08[_0x5fcf('0x17')](_0x30a5a2);}else{return logger['error'](_0x5fcf('0x27'),'afterCreate',_0x5fcf('0x52'),util['inspect'](_0x5073b7,{'showHidden':![],'depth':null}));}});})[_0x5fcf('0x39')](function(_0x5673bb){return logger[_0x5fcf('0x19')](_0x5fcf('0x27'),_0x5fcf('0x28'),_0x5fcf('0x52'),util['inspect'](_0x5673bb,{'showHidden':![],'depth':null}));});}else{logger[_0x5fcf('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5fcf('0x28'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0x5fcf('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5fcf('0x28'),_0x5fcf('0x52'),_0x5fcf('0x3a'));}break;case _0x5fcf('0x57'):var _0x5e8134=require(_0x5fcf('0x58'));if(_0x2c8f3b[_0x5fcf('0x59')]){var _0x5e2824={};_0x5e2824[_0x5fcf('0x5a')]=_0x2c8f3b[_0x5fcf('0x2c')];_0x5e2824[_0x5fcf('0x20')]=_0xc70c01[_0x5fcf('0x20')];_0x5e2824['sender']=_0x2c8f3b['phone'];_0x5e2824[_0x5fcf('0x5b')]=_0xc70c01['body'];_0x5e2824[_0x5fcf('0x5c')]=+new Date();var _0x417dd3='';var _0x24fb0b='';var _0x29454b=Object[_0x5fcf('0x5d')](_0x5e2824);_0x29454b[_0x5fcf('0x5e')]();for(var _0x265ad9=0x0;_0x265ad9<_0x29454b[_0x5fcf('0x5f')];_0x265ad9++){if(_0x417dd3!=''){_0x417dd3+='&';}_0x417dd3+=_0x29454b[_0x265ad9]+'='+encodeURIComponent(_0x5e2824[_0x29454b[_0x265ad9]]);_0x24fb0b+=_0x5e2824[_0x29454b[_0x265ad9]];}_0x24fb0b+=_0x2c8f3b[_0x5fcf('0x59')];_0x24fb0b=_0x5e8134[_0x5fcf('0x60')](_0x5fcf('0x61'))[_0x5fcf('0x17')](_0x24fb0b)[_0x5fcf('0x62')](_0x5fcf('0x63'));if(_0x417dd3!==''){_0x417dd3+='&';}_0x417dd3+=_0x5fcf('0x64')+_0x24fb0b;var _0xae83a9={'method':_0x5fcf('0x31'),'uri':_0x2c8f3b[_0x5fcf('0x53')]+_0x5fcf('0x65')+_0x417dd3,'json':!![]};return rp(_0xae83a9)['then'](function(_0x4970d0){var _0x162a70=Object['keys'](_0x4970d0);if(_0x4970d0[_0x162a70[0x0]]['error']&&parseInt(_0x4970d0[_0x162a70[0x0]]['error'])===0x0){var _0x37a554={'messageId':_0x4970d0[_0x162a70[0x0]][_0x5fcf('0x66')]};if(!_0x2c8f3b[_0x5fcf('0x3f')]){_0x37a554[_0x5fcf('0x38')]=!![];}return _0x4deb08[_0x5fcf('0x17')](_0x37a554);}else{return logger[_0x5fcf('0x19')](_0x5fcf('0x27'),_0x5fcf('0x28'),_0x5fcf('0x57'),util['inspect'](_0x4970d0['error'],{'showHidden':![],'depth':null}));}})[_0x5fcf('0x39')](function(_0x5aedfb){return logger[_0x5fcf('0x19')](_0x5fcf('0x27'),_0x5fcf('0x28'),_0x5fcf('0x57'),util['inspect'](_0x5aedfb,{'showHidden':![],'depth':null}));});}else{logger[_0x5fcf('0x19')](_0x5fcf('0x27'),_0x5fcf('0x28'),_0x5fcf('0x57'),_0x5fcf('0x67'));}break;case _0x5fcf('0x68'):if(_0x2c8f3b['apiKey']){var _0x5d9e0b={'method':_0x5fcf('0x45'),'uri':_0x5fcf('0x69'),'headers':{'Authorization':_0x2c8f3b[_0x5fcf('0x59')]},'body':{'content':_0xc70c01[_0x5fcf('0x23')],'to':[_0xc70c01[_0x5fcf('0x20')]],'from':_0x2c8f3b[_0x5fcf('0x20')],'binary':![],'clientMessageId':_0x5fcf('0x6a'),'charset':_0x5fcf('0x6b')},'json':!![]};rp(_0x5d9e0b)[_0x5fcf('0x16')](function(_0x4f8321){if(!_0x4f8321[_0x5fcf('0x19')]){var _0x7bc092={'messageId':_0x4f8321['messages'][0x0][_0x5fcf('0x6c')]};if(!_0x2c8f3b[_0x5fcf('0x3f')]){_0x7bc092[_0x5fcf('0x38')]=!![];}return _0x4deb08['update'](_0x7bc092);}else{return logger[_0x5fcf('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5fcf('0x68'),util[_0x5fcf('0x29')](_0x4f8321['error'],{'showHidden':![],'depth':null}));}})[_0x5fcf('0x39')](function(_0x27ee71){return logger['error'](_0x5fcf('0x27'),_0x5fcf('0x28'),_0x5fcf('0x68'),util[_0x5fcf('0x29')](_0x27ee71,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5fcf('0x27'),_0x5fcf('0x28'),_0x5fcf('0x68'),'Missing\x20parameters:\x20apiKey');}break;case _0x5fcf('0x6d'):if(_0x2c8f3b[_0x5fcf('0x2c')]&&_0x2c8f3b[_0x5fcf('0x2d')]){var _0x44d8a9=util[_0x5fcf('0x43')](_0x5fcf('0x44'),_0x2c8f3b[_0x5fcf('0x2c')],_0x2c8f3b[_0x5fcf('0x2d')]);var _0x525b7c={'method':'POST','uri':_0x5fcf('0x6e')+_0x2c8f3b[_0x5fcf('0x6f')]+_0x5fcf('0x70'),'body':{'to':[_0xc70c01[_0x5fcf('0x20')]],'text':_0xc70c01['body'],'from':_0x2c8f3b[_0x5fcf('0x20')],'applicationId':_0x2c8f3b[_0x5fcf('0x71')]},'headers':{'Authorization':util[_0x5fcf('0x43')](_0x5fcf('0x46'),new Buffer(_0x44d8a9)[_0x5fcf('0x47')]('base64'))},'json':!![]};rp(_0x525b7c)['then'](function(_0x13e089){if(_0x13e089['id']){var _0x39c916={'messageId':_0x13e089['id']};return _0x4deb08['update'](_0x39c916);}else{logger[_0x5fcf('0x19')](_0x5fcf('0x27'),'afterCreate',_0x5fcf('0x6d'),util['inspect'](_0x13e089,{'showHidden':![],'depth':null}));}})[_0x5fcf('0x39')](function(_0x4f5de0){logger[_0x5fcf('0x19')](_0x5fcf('0x27'),_0x5fcf('0x28'),'bandwidth',util[_0x5fcf('0x29')](_0x4f5de0,{'showHidden':![],'depth':null}));});}else{logger[_0x5fcf('0x19')](_0x5fcf('0x27'),_0x5fcf('0x28'),'bandwidth',_0x5fcf('0x3a'));}break;case'intelepeer':if(_0x2c8f3b[_0x5fcf('0x59')]){var _0x5f3553={};var _0xae83a9={'method':'POST','uri':_0x5fcf('0x72'),'headers':{'Authorization':_0x5fcf('0x73')+_0x2c8f3b[_0x5fcf('0x59')],'Content-Type':_0x5fcf('0x55')},'body':{'from':_0x2c8f3b[_0x5fcf('0x20')],'to':_0xc70c01[_0x5fcf('0x20')],'text':_0xc70c01[_0x5fcf('0x23')]},'json':!![]};return rp(_0xae83a9)['then'](function(_0x408094){if(_0x408094[_0x5fcf('0x74')]==0xca){_0x5f3553['message']=_0x408094;var _0x4d5494={'method':_0x5fcf('0x45'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x5fcf('0x73')+_0x2c8f3b['apiKey'],'Content-Type':_0x5fcf('0x55')},'body':{'refid':_0x5f3553[_0x5fcf('0x75')][_0x5fcf('0x76')]},'json':!![]};return rp(_0x4d5494)[_0x5fcf('0x16')](function(_0x3be094){_0x5f3553[_0x5fcf('0x77')]=_0x3be094;var _0x55cc1b={'messageId':_0x5f3553[_0x5fcf('0x75')][_0x5fcf('0x76')],'read':!![]};return _0x4deb08[_0x5fcf('0x17')](_0x55cc1b);});}else{return logger[_0x5fcf('0x19')](_0x5fcf('0x27'),'afterCreate',_0x5fcf('0x78'),util[_0x5fcf('0x29')](_0x408094,{'showHidden':![],'depth':null}));}})['catch'](function(_0x43076d){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5fcf('0x28'),_0x5fcf('0x78'),util[_0x5fcf('0x29')](_0x43076d,{'showHidden':![],'depth':null}));});}else{return logger[_0x5fcf('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5fcf('0x78'),_0x5fcf('0x79'));}break;}}})[_0x5fcf('0x7a')](function(){_0xc39d4b();});}else{_0xc39d4b();}}},'charset':_0x5fcf('0x7b'),'collate':_0x5fcf('0x7c')});}; \ No newline at end of file +var _0xa776=['remote','/api/sms/messages/','/status?token=','token','sid','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','smsMethod','sender','&password=','password','split','sms','user_key','total_sent','internal_order_id','read','skebby','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','%s:%s','POST','format','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','csc','crypto','apiKey','login','text','keys','sort','length','createHash','md5','digest','hex','GET','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','intelepeer','Bearer\x20','code','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','./smsMessage.attributes','SmsMessage','sms_messages','messageId','body','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','SmsAccount','type','twilio','accountSid','authToken','phone','messages'];(function(_0x3400cd,_0x3b62d9){var _0x248697=function(_0x32b47c){while(--_0x32b47c){_0x3400cd['push'](_0x3400cd['shift']());}};_0x248697(++_0x3b62d9);}(_0xa776,0x1c0));var _0x6a77=function(_0x2bfadc,_0x31136d){_0x2bfadc=_0x2bfadc-0x0;var _0x58c47a=_0xa776[_0x2bfadc];return _0x58c47a;};'use strict';var _=require(_0x6a77('0x0'));var util=require(_0x6a77('0x1'));var logger=require(_0x6a77('0x2'))(_0x6a77('0x3'));var moment=require('moment');var BPromise=require(_0x6a77('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a77('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6a77('0x6'));module['exports']=function(_0x379e70,_0x3eae5e){return _0x379e70['define'](_0x6a77('0x7'),attributes,{'tableName':_0x6a77('0x8'),'paranoid':![],'indexes':[{'name':_0x6a77('0x9'),'fields':['messageId']},{'name':'fti_sms_messages','fields':[_0x6a77('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xce5858,_0x308808,_0x23ef5b){var _0x3dc8d0=_0x379e70[_0x6a77('0xb')];var _0x3ab470=_0xce5858[_0x6a77('0xc')]({'plain':!![]});if(_0x3ab470[_0x6a77('0xd')][_0x6a77('0xe')]()==='in'||_0x3ab470[_0x6a77('0xd')][_0x6a77('0xe')]()===_0x6a77('0xf')&&!_0x3ab470['secret']&&!_[_0x6a77('0x10')](_0x3ab470[_0x6a77('0x11')])&&!_[_0x6a77('0x10')](_0x3ab470['SmsInteractionId'])){_0x3dc8d0[_0x6a77('0x12')][_0x6a77('0x13')]({'where':{'id':_0x3ab470[_0x6a77('0x14')]}})[_0x6a77('0x15')](function(_0x42afc1){if(_0x42afc1){_0x42afc1[_0x6a77('0x16')]({'lastMsgAt':_0x3ab470[_0x6a77('0x17')],'lastMsgDirection':_0x3ab470[_0x6a77('0xd')][_0x6a77('0xe')]()});}})[_0x6a77('0x18')](function(_0x34c14a){console['error'](_0x34c14a);});}if(_0x3ab470[_0x6a77('0xd')]===_0x6a77('0xf')&&!_0x3ab470['secret']){var _0x54d94d;_0x3dc8d0[_0x6a77('0x19')]['find']({'where':{'id':_0x3ab470['SmsAccountId']},'raw':!![]})['then'](function(_0xc128de){_0x54d94d=_0xc128de;if(_0x54d94d&&_0x54d94d['type']){switch(_0x54d94d[_0x6a77('0x1a')]){case _0x6a77('0x1b'):var _0x1398ba=require(_0x6a77('0x1b'));if(_0x54d94d[_0x6a77('0x1c')]&&_0x54d94d[_0x6a77('0x1d')]&&_0x54d94d[_0x6a77('0x1e')]){var _0x451f4d=new _0x1398ba(_0x54d94d['accountSid'],_0x54d94d[_0x6a77('0x1d')]);_0x451f4d[_0x6a77('0x1f')]['create']({'body':_0x3ab470[_0x6a77('0xa')],'to':_0x3ab470[_0x6a77('0x1e')],'from':_0x54d94d[_0x6a77('0x1e')],'statusCallback':_0x54d94d[_0x6a77('0x20')]+_0x6a77('0x21')+_0x3ab470['id']+_0x6a77('0x22')+_0x54d94d[_0x6a77('0x23')]})[_0x6a77('0x15')](function(_0x25d950){if(_0x25d950[_0x6a77('0x24')]){return _0xce5858[_0x6a77('0x16')]({'messageId':_0x25d950[_0x6a77('0x24')]});}})['catch'](function(_0x4332aa){logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),'twilio',util[_0x6a77('0x28')](_0x4332aa,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a77('0x27'),_0x6a77('0x1b'),_0x6a77('0x29'));}break;case'skebby':var _0x3066bd=_0x6a77('0x2a');if(_0x54d94d[_0x6a77('0x2b')]&&_0x54d94d['password']){var _0x4803c8={'recipient':[_0x3ab470[_0x6a77('0x1e')]],'message':_0x3ab470[_0x6a77('0xa')],'message_type':_0x54d94d[_0x6a77('0x2c')]};if(_0x54d94d[_0x6a77('0x2c')]&&_0x54d94d[_0x6a77('0x2c')]!=='SI'){_0x4803c8[_0x6a77('0x2d')]=_0x54d94d[_0x6a77('0x1e')];}var _0x1321fa={'url':_0x3066bd+'login?username='+_0x54d94d['username']+_0x6a77('0x2e')+_0x54d94d[_0x6a77('0x2f')],'method':'GET'};rp(_0x1321fa)[_0x6a77('0x15')](function(_0x6640d){var _0x2abafa=_0x6640d[_0x6a77('0x30')](';');var _0x166823={'user_key':_0x2abafa[0x0],'session_key':_0x2abafa[0x1]};_0x1321fa={'url':_0x3066bd+_0x6a77('0x31'),'method':'POST','headers':{'user_key':_0x166823[_0x6a77('0x32')],'Session_key':_0x166823['session_key']},'json':!![],'body':_0x4803c8};return rp(_0x1321fa);})['then'](function(_0x54845b){if(_0x54845b[_0x6a77('0x33')]>=0x1){var _0x50091b={'messageId':_0x54845b[_0x6a77('0x34')]};if(_0x54d94d[_0x6a77('0x2c')]!=='GP'||!_0x54d94d['deliveryReport']){_0x50091b[_0x6a77('0x35')]=!![];}return _0xce5858['update'](_0x50091b);}else{return logger['error'](_0x6a77('0x26'),_0x6a77('0x27'),'skebby',util['inspect'](_0x54845b,{'showHidden':![],'depth':null}));}})[_0x6a77('0x18')](function(_0x3ae398){return logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),_0x6a77('0x36'),util[_0x6a77('0x28')](_0x3ae398,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6a77('0x26'),_0x6a77('0x27'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0x6a77('0x37'):if(_0x54d94d[_0x6a77('0x1d')]){var _0x588d41={'recipient':_0x3ab470[_0x6a77('0x1e')],'message':_0x3ab470[_0x6a77('0xa')],'sender':_0x54d94d['senderString']||_0x54d94d[_0x6a77('0x1e')],'authorization':_0x54d94d[_0x6a77('0x1d')]};var _0x308808={'method':'POST','uri':_0x6a77('0x38'),'body':_0x588d41,'json':!![]};rp(_0x308808)['then'](function(_0x4edc8a){var _0x129188={'messageId':_0x4edc8a[_0x6a77('0x39')]};if(!_0x54d94d[_0x6a77('0x3a')]){_0x129188[_0x6a77('0x35')]=!![];}return _0xce5858[_0x6a77('0x16')](_0x129188);})['catch'](function(_0x3c9fb0){logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),_0x6a77('0x37'),util[_0x6a77('0x28')](_0x3c9fb0,{'showHidden':![],'depth':null}));});}else{logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),'connectel',_0x6a77('0x3b'));}break;case _0x6a77('0x3c'):if(_0x54d94d[_0x6a77('0x2b')]&&_0x54d94d[_0x6a77('0x2f')]){var _0x588d41={'messages':[{'source':_0x6a77('0x3d'),'to':_0x3ab470[_0x6a77('0x1e')],'body':_0x3ab470[_0x6a77('0xa')],'from':_0x54d94d[_0x6a77('0x3e')]||_0x54d94d[_0x6a77('0x1e')]}]};var _0x526a6c=util['format'](_0x6a77('0x3f'),_0x54d94d[_0x6a77('0x2b')],_0x54d94d[_0x6a77('0x2f')]);var _0x308808={'method':_0x6a77('0x40'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x588d41,'headers':{'Authorization':util[_0x6a77('0x41')](_0x6a77('0x42'),new Buffer(_0x526a6c)[_0x6a77('0x43')](_0x6a77('0x44')))},'json':!![]};rp(_0x308808)[_0x6a77('0x15')](function(_0x408419){if(_0x408419[_0x6a77('0x45')]>=0xc8&&_0x408419[_0x6a77('0x45')]<=0xce){if(_0x408419[_0x6a77('0x46')]&&_0x408419[_0x6a77('0x46')][_0x6a77('0x47')]>0x0){var _0x2ce950=_[_0x6a77('0x48')](_0x408419[_0x6a77('0x46')][_0x6a77('0x1f')]);var _0x4894f9={'messageId':_0x2ce950[_0x6a77('0x49')]};if(!_0x54d94d['deliveryReport']){_0x4894f9[_0x6a77('0x35')]=!![];}return _0xce5858[_0x6a77('0x16')](_0x4894f9);}else{logger['error'](_0x6a77('0x26'),_0x6a77('0x27'),_0x6a77('0x4a'),util[_0x6a77('0x28')](_0x408419,{'showHidden':![],'depth':null}));}}else{logger[_0x6a77('0x25')](_0x6a77('0x26'),'afterCreate',_0x6a77('0x4a'),util['inspect'](_0x408419,{'showHidden':![],'depth':null}));}})[_0x6a77('0x18')](function(_0x56a34f){logger[_0x6a77('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a77('0x27'),'clickSend',util[_0x6a77('0x28')](_0x56a34f,{'showHidden':![],'depth':null}));});}else{logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),_0x6a77('0x4a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x6a77('0x4b'):if(_0x54d94d[_0x6a77('0x4c')]&&_0x54d94d[_0x6a77('0x1d')]){var _0x588d41={'dst':_0x3ab470[_0x6a77('0x1e')],'text':_0x3ab470[_0x6a77('0xa')],'src':_0x54d94d[_0x6a77('0x3e')]||_0x54d94d['phone'],'url':_0x54d94d[_0x6a77('0x20')]+_0x6a77('0x21')+_0x3ab470['id']+_0x6a77('0x22')+_0x54d94d['token']};var _0x526a6c=util['format'](_0x6a77('0x3f'),_0x54d94d['authId'],_0x54d94d['authToken']);var _0x308808={'method':_0x6a77('0x40'),'uri':util[_0x6a77('0x41')]('https://api.plivo.com/v1/Account/%s/Message/',_0x54d94d[_0x6a77('0x4c')]),'body':_0x588d41,'headers':{'Authorization':util[_0x6a77('0x41')](_0x6a77('0x42'),new Buffer(_0x526a6c)[_0x6a77('0x43')](_0x6a77('0x44')))},'json':!![]};rp(_0x308808)[_0x6a77('0x15')](function(_0xe88da0){var _0x50f293={'messageId':_0xe88da0[_0x6a77('0x4d')][0x0]};return _0xce5858[_0x6a77('0x16')](_0x50f293);})[_0x6a77('0x18')](function(_0x46c3d2){logger[_0x6a77('0x25')](_0x6a77('0x26'),'afterCreate',_0x6a77('0x4b'),util[_0x6a77('0x28')](_0x46c3d2,{'showHidden':![],'depth':null}));});}else{logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),'plivo',_0x6a77('0x4e'));}break;case'infobip':if(_0x54d94d[_0x6a77('0x2b')]&&_0x54d94d[_0x6a77('0x2f')]){if(_0x54d94d['baseUrl']){var _0x4d4f5b={'method':_0x6a77('0x40'),'uri':_0x54d94d[_0x6a77('0x4f')]+_0x6a77('0x50'),'body':{'username':_0x54d94d['username'],'password':_0x54d94d[_0x6a77('0x2f')]},'json':!![]};return rp(_0x4d4f5b)[_0x6a77('0x15')](function(_0x44890e){var _0x2ddf94={'method':_0x6a77('0x40'),'uri':_0x54d94d['baseUrl']+_0x6a77('0x51'),'body':{'messages':[{'from':_0x54d94d[_0x6a77('0x1e')],'destinations':[{'to':_0x3ab470[_0x6a77('0x1e')]}],'text':_0x3ab470['body'],'notifyUrl':_0x54d94d[_0x6a77('0x20')]+_0x6a77('0x21')+_0x3ab470['id']+_0x6a77('0x22')+_0x54d94d[_0x6a77('0x23')],'notifyContentType':_0x6a77('0x52'),'callbackData':_0x54d94d[_0x6a77('0x1e')]+';'+_0x3ab470['body']}]},'headers':{'Authorization':_0x6a77('0x53')+_0x44890e[_0x6a77('0x23')]},'json':!![]};return rp(_0x2ddf94)[_0x6a77('0x15')](function(_0x1bdac0){if(_0x1bdac0['messages']){var _0x9771b9={'messageId':_0x1bdac0[_0x6a77('0x1f')][0x0][_0x6a77('0x9')]};if(!_0x54d94d['deliveryReport']){_0x9771b9[_0x6a77('0x35')]=!![];}return _0xce5858[_0x6a77('0x16')](_0x9771b9);}else{return logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),_0x6a77('0x54'),util[_0x6a77('0x28')](_0x1bdac0,{'showHidden':![],'depth':null}));}});})[_0x6a77('0x18')](function(_0x49bb77){return logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),_0x6a77('0x54'),util[_0x6a77('0x28')](_0x49bb77,{'showHidden':![],'depth':null}));});}else{logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),'infobip',_0x6a77('0x55'));}}else{logger[_0x6a77('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a77('0x27'),'infobip',_0x6a77('0x56'));}break;case _0x6a77('0x57'):var _0x5d0c18=require(_0x6a77('0x58'));if(_0x54d94d[_0x6a77('0x59')]){var _0x2fdeab={};_0x2fdeab[_0x6a77('0x5a')]=_0x54d94d['username'];_0x2fdeab['phone']=_0x3ab470[_0x6a77('0x1e')];_0x2fdeab[_0x6a77('0x2d')]=_0x54d94d['phone'];_0x2fdeab[_0x6a77('0x5b')]=_0x3ab470[_0x6a77('0xa')];_0x2fdeab['timestamp']=+new Date();var _0x3485b4='';var _0x915fd7='';var _0x29fc50=Object[_0x6a77('0x5c')](_0x2fdeab);_0x29fc50[_0x6a77('0x5d')]();for(var _0x191f47=0x0;_0x191f47<_0x29fc50[_0x6a77('0x5e')];_0x191f47++){if(_0x3485b4!=''){_0x3485b4+='&';}_0x3485b4+=_0x29fc50[_0x191f47]+'='+encodeURIComponent(_0x2fdeab[_0x29fc50[_0x191f47]]);_0x915fd7+=_0x2fdeab[_0x29fc50[_0x191f47]];}_0x915fd7+=_0x54d94d[_0x6a77('0x59')];_0x915fd7=_0x5d0c18[_0x6a77('0x5f')](_0x6a77('0x60'))[_0x6a77('0x16')](_0x915fd7)[_0x6a77('0x61')](_0x6a77('0x62'));if(_0x3485b4!==''){_0x3485b4+='&';}_0x3485b4+='signature='+_0x915fd7;var _0x1321fa={'method':_0x6a77('0x63'),'uri':_0x54d94d['baseUrl']+'/external/get/send.php?'+_0x3485b4,'json':!![]};return rp(_0x1321fa)[_0x6a77('0x15')](function(_0x2b9e15){var _0x49b865=Object[_0x6a77('0x5c')](_0x2b9e15);if(_0x2b9e15[_0x49b865[0x0]][_0x6a77('0x25')]&&parseInt(_0x2b9e15[_0x49b865[0x0]]['error'])===0x0){var _0x3b4197={'messageId':_0x2b9e15[_0x49b865[0x0]][_0x6a77('0x64')]};if(!_0x54d94d['deliveryReport']){_0x3b4197[_0x6a77('0x35')]=!![];}return _0xce5858[_0x6a77('0x16')](_0x3b4197);}else{return logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),'csc',util[_0x6a77('0x28')](_0x2b9e15[_0x6a77('0x25')],{'showHidden':![],'depth':null}));}})[_0x6a77('0x18')](function(_0x55f7dd){return logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),_0x6a77('0x57'),util['inspect'](_0x55f7dd,{'showHidden':![],'depth':null}));});}else{logger[_0x6a77('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a77('0x27'),'csc',_0x6a77('0x65'));}break;case _0x6a77('0x66'):if(_0x54d94d[_0x6a77('0x59')]){var _0x46263e={'method':'POST','uri':_0x6a77('0x67'),'headers':{'Authorization':_0x54d94d[_0x6a77('0x59')]},'body':{'content':_0x3ab470['body'],'to':[_0x3ab470['phone']],'from':_0x54d94d[_0x6a77('0x1e')],'binary':![],'clientMessageId':_0x6a77('0x68'),'charset':_0x6a77('0x69')},'json':!![]};rp(_0x46263e)['then'](function(_0x4e11ff){if(!_0x4e11ff[_0x6a77('0x25')]){var _0x10c3c7={'messageId':_0x4e11ff[_0x6a77('0x1f')][0x0][_0x6a77('0x6a')]};if(!_0x54d94d[_0x6a77('0x3a')]){_0x10c3c7[_0x6a77('0x35')]=!![];}return _0xce5858['update'](_0x10c3c7);}else{return logger[_0x6a77('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a77('0x27'),_0x6a77('0x66'),util[_0x6a77('0x28')](_0x4e11ff[_0x6a77('0x25')],{'showHidden':![],'depth':null}));}})[_0x6a77('0x18')](function(_0xf221cc){return logger[_0x6a77('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a77('0x27'),_0x6a77('0x66'),util[_0x6a77('0x28')](_0xf221cc,{'showHidden':![],'depth':null}));});}else{logger[_0x6a77('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6a77('0x66'),'Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x54d94d[_0x6a77('0x2b')]&&_0x54d94d['password']){var _0x526a6c=util[_0x6a77('0x41')](_0x6a77('0x3f'),_0x54d94d[_0x6a77('0x2b')],_0x54d94d['password']);var _0x308808={'method':_0x6a77('0x40'),'uri':_0x6a77('0x6b')+_0x54d94d[_0x6a77('0x6c')]+_0x6a77('0x6d'),'body':{'to':[_0x3ab470[_0x6a77('0x1e')]],'text':_0x3ab470[_0x6a77('0xa')],'from':_0x54d94d[_0x6a77('0x1e')],'applicationId':_0x54d94d[_0x6a77('0x6e')]},'headers':{'Authorization':util[_0x6a77('0x41')](_0x6a77('0x42'),new Buffer(_0x526a6c)[_0x6a77('0x43')]('base64'))},'json':!![]};rp(_0x308808)['then'](function(_0xfc9b73){if(_0xfc9b73['id']){var _0x652fdf={'messageId':_0xfc9b73['id']};return _0xce5858['update'](_0x652fdf);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6a77('0x6f'),util['inspect'](_0xfc9b73,{'showHidden':![],'depth':null}));}})[_0x6a77('0x18')](function(_0x53932f){logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),'bandwidth',util['inspect'](_0x53932f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6a77('0x26'),_0x6a77('0x27'),'bandwidth',_0x6a77('0x56'));}break;case _0x6a77('0x70'):if(_0x54d94d['apiKey']){var _0x15a6fe={};var _0x1321fa={'method':_0x6a77('0x40'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x6a77('0x71')+_0x54d94d['apiKey'],'Content-Type':_0x6a77('0x52')},'body':{'from':_0x54d94d[_0x6a77('0x1e')],'to':_0x3ab470['phone'],'text':_0x3ab470['body']},'json':!![]};return rp(_0x1321fa)[_0x6a77('0x15')](function(_0x1c4624){if(_0x1c4624[_0x6a77('0x72')]==0xca){_0x15a6fe['message']=_0x1c4624;var _0x3fea56={'method':_0x6a77('0x40'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x6a77('0x71')+_0x54d94d['apiKey'],'Content-Type':_0x6a77('0x52')},'body':{'refid':_0x15a6fe['message'][_0x6a77('0x73')]},'json':!![]};return rp(_0x3fea56)['then'](function(_0x3239de){_0x15a6fe[_0x6a77('0x74')]=_0x3239de;var _0x3239d0={'messageId':_0x15a6fe['message'][_0x6a77('0x73')],'read':!![]};return _0xce5858[_0x6a77('0x16')](_0x3239d0);});}else{return logger[_0x6a77('0x25')](_0x6a77('0x26'),_0x6a77('0x27'),_0x6a77('0x70'),util['inspect'](_0x1c4624,{'showHidden':![],'depth':null}));}})[_0x6a77('0x18')](function(_0x3413a2){return logger[_0x6a77('0x25')](_0x6a77('0x26'),'afterCreate',_0x6a77('0x70'),util[_0x6a77('0x28')](_0x3413a2,{'showHidden':![],'depth':null}));});}else{return logger[_0x6a77('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6a77('0x70'),'Token\x20not\x20received');}break;}}})[_0x6a77('0x75')](function(){_0x23ef5b();});}else{_0x23ef5b();}}},'charset':_0x6a77('0x76'),'collate':_0x6a77('0x77')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 07288e2..007cd8e 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 _0xb67a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','CreateSmsMessage','SmsMessage','create','body','options','debug','stringify','util','bluebird'];(function(_0xb1bc0e,_0x2cdfd1){var _0x1cdb3a=function(_0x2cd246){while(--_0x2cd246){_0xb1bc0e['push'](_0xb1bc0e['shift']());}};_0x1cdb3a(++_0x2cdfd1);}(_0xb67a,0xc9));var _0xab67=function(_0x245728,_0x1e8ca4){_0x245728=_0x245728-0x0;var _0x1be470=_0xb67a[_0x245728];return _0x1be470;};'use strict';var _=require('lodash');var util=require(_0xab67('0x0'));var moment=require('moment');var BPromise=require(_0xab67('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab67('0x2'))['db'];var utils=require(_0xab67('0x3'));var logger=require(_0xab67('0x4'))(_0xab67('0x5'));var config=require(_0xab67('0x6'));var jayson=require(_0xab67('0x7'));var client=jayson[_0xab67('0x8')]['http']({'port':0x232a});config[_0xab67('0x9')]=_[_0xab67('0xa')](config[_0xab67('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xab67('0xb'))(new Redis(config['redis']));require('./smsMessage.socket')[_0xab67('0xc')](socket);function respondWithRpcPromise(_0x29dce7,_0x1f7894,_0x4fe942){return new BPromise(function(_0x1ef313,_0xecade0){return client[_0xab67('0xd')](_0x29dce7,_0x4fe942)[_0xab67('0xe')](function(_0x1ef04a){logger[_0xab67('0xf')](_0xab67('0x10'),_0x1f7894,_0xab67('0x11'));logger['debug'](_0xab67('0x12'),_0x1f7894,_0xab67('0x11'),JSON['stringify'](_0x1ef04a));if(_0x1ef04a[_0xab67('0x13')]){if(_0x1ef04a[_0xab67('0x13')][_0xab67('0x14')]===0x1f4){logger[_0xab67('0x13')](_0xab67('0x10'),_0x1f7894,_0x1ef04a[_0xab67('0x13')][_0xab67('0x15')]);return _0xecade0(_0x1ef04a[_0xab67('0x13')][_0xab67('0x15')]);}logger['error'](_0xab67('0x10'),_0x1f7894,_0x1ef04a[_0xab67('0x13')]['message']);return _0x1ef313(_0x1ef04a[_0xab67('0x13')]['message']);}else{logger[_0xab67('0xf')](_0xab67('0x10'),_0x1f7894,_0xab67('0x11'));_0x1ef313(_0x1ef04a['result']['message']);}})['catch'](function(_0x5c0a63){logger[_0xab67('0x13')]('SmsMessage,\x20%s,\x20%s',_0x1f7894,_0x5c0a63);_0xecade0(_0x5c0a63);});});}exports[_0xab67('0x16')]=function(_0x3bad01){var _0x448f87=this;return new Promise(function(_0x46b310,_0x31638f){return db[_0xab67('0x17')][_0xab67('0x18')](_0x3bad01[_0xab67('0x19')],{'raw':_0x3bad01[_0xab67('0x1a')]?_0x3bad01['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5c3b56){logger[_0xab67('0xf')](_0xab67('0x16'),_0x3bad01);logger[_0xab67('0x1b')](_0xab67('0x16'),_0x3bad01,JSON[_0xab67('0x1c')](_0x5c3b56));_0x46b310(_0x5c3b56);})['catch'](function(_0xd9da90){logger[_0xab67('0x13')](_0xab67('0x16'),_0xd9da90[_0xab67('0x15')],_0x3bad01);_0x31638f(_0x448f87[_0xab67('0x13')](0x1f4,_0xd9da90['message']));});});}; \ No newline at end of file +var _0x141c=['then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsMessage','options','debug','CreateSmsMessage','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./smsMessage.socket','register','request'];(function(_0x56ce1f,_0x2afb82){var _0x3d1aba=function(_0x168a19){while(--_0x168a19){_0x56ce1f['push'](_0x56ce1f['shift']());}};_0x3d1aba(++_0x2afb82);}(_0x141c,0x1cf));var _0xc141=function(_0x55bc03,_0x469709){_0x55bc03=_0x55bc03-0x0;var _0xc8941a=_0x141c[_0x55bc03];return _0xc8941a;};'use strict';var _=require('lodash');var util=require(_0xc141('0x0'));var moment=require(_0xc141('0x1'));var BPromise=require('bluebird');var rs=require(_0xc141('0x2'));var fs=require('fs');var Redis=require(_0xc141('0x3'));var db=require(_0xc141('0x4'))['db'];var utils=require(_0xc141('0x5'));var logger=require(_0xc141('0x6'))(_0xc141('0x7'));var config=require(_0xc141('0x8'));var jayson=require(_0xc141('0x9'));var client=jayson['client'][_0xc141('0xa')]({'port':0x232a});config[_0xc141('0xb')]=_[_0xc141('0xc')](config[_0xc141('0xb')],{'host':_0xc141('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc141('0xe'))[_0xc141('0xf')](socket);function respondWithRpcPromise(_0x148d78,_0x1e9156,_0x321371){return new BPromise(function(_0x27d498,_0x17b98e){return client[_0xc141('0x10')](_0x148d78,_0x321371)[_0xc141('0x11')](function(_0x5b47f8){logger[_0xc141('0x12')](_0xc141('0x13'),_0x1e9156,_0xc141('0x14'));logger['debug'](_0xc141('0x15'),_0x1e9156,'request\x20sent',JSON['stringify'](_0x5b47f8));if(_0x5b47f8[_0xc141('0x16')]){if(_0x5b47f8[_0xc141('0x16')][_0xc141('0x17')]===0x1f4){logger[_0xc141('0x16')](_0xc141('0x13'),_0x1e9156,_0x5b47f8[_0xc141('0x16')][_0xc141('0x18')]);return _0x17b98e(_0x5b47f8[_0xc141('0x16')][_0xc141('0x18')]);}logger[_0xc141('0x16')](_0xc141('0x13'),_0x1e9156,_0x5b47f8[_0xc141('0x16')]['message']);return _0x27d498(_0x5b47f8[_0xc141('0x16')][_0xc141('0x18')]);}else{logger[_0xc141('0x12')](_0xc141('0x13'),_0x1e9156,_0xc141('0x14'));_0x27d498(_0x5b47f8[_0xc141('0x19')][_0xc141('0x18')]);}})[_0xc141('0x1a')](function(_0x133093){logger['error']('SmsMessage,\x20%s,\x20%s',_0x1e9156,_0x133093);_0x17b98e(_0x133093);});});}exports['CreateSmsMessage']=function(_0x274e0f){var _0x152e0b=this;return new Promise(function(_0x3dca30,_0x457554){return db[_0xc141('0x1b')]['create'](_0x274e0f['body'],{'raw':_0x274e0f[_0xc141('0x1c')]?_0x274e0f[_0xc141('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xc141('0x11')](function(_0x6f3a7a){logger[_0xc141('0x12')]('CreateSmsMessage',_0x274e0f);logger[_0xc141('0x1d')](_0xc141('0x1e'),_0x274e0f,JSON[_0xc141('0x1f')](_0x6f3a7a));_0x3dca30(_0x6f3a7a);})[_0xc141('0x1a')](function(_0x141910){logger[_0xc141('0x16')]('CreateSmsMessage',_0x141910['message'],_0x274e0f);_0x457554(_0x152e0b[_0xc141('0x16')](0x1f4,_0x141910[_0xc141('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 87be828..77b1aec 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 _0x1032=['removeListener','register','length','smsMessage:','./smsMessage.events','save','remove','update','emit'];(function(_0x5b2db0,_0xe0d07d){var _0x9dd41f=function(_0x57545a){while(--_0x57545a){_0x5b2db0['push'](_0x5b2db0['shift']());}};_0x9dd41f(++_0xe0d07d);}(_0x1032,0xf7));var _0x2103=function(_0x2e7a2b,_0x29cd32){_0x2e7a2b=_0x2e7a2b-0x0;var _0x455779=_0x1032[_0x2e7a2b];return _0x455779;};'use strict';var SmsMessageEvents=require(_0x2103('0x0'));var events=[_0x2103('0x1'),_0x2103('0x2'),_0x2103('0x3')];function createListener(_0xdf2129,_0x56a032){return function(_0x1ab664){_0x56a032[_0x2103('0x4')](_0xdf2129,_0x1ab664);};}function removeListener(_0x24007e,_0x27fb1e){return function(){SmsMessageEvents[_0x2103('0x5')](_0x24007e,_0x27fb1e);};}exports[_0x2103('0x6')]=function(_0x117d81){for(var _0x2d28ea=0x0,_0x170911=events[_0x2103('0x7')];_0x2d28ea<_0x170911;_0x2d28ea++){var _0x4ff224=events[_0x2d28ea];var _0x1ae9b7=createListener(_0x2103('0x8')+_0x4ff224,_0x117d81);SmsMessageEvents['on'](_0x4ff224,_0x1ae9b7);}}; \ No newline at end of file +var _0xde05=['length','./smsMessage.events','remove','update','emit','removeListener'];(function(_0x552c92,_0x193099){var _0x439bc6=function(_0x201235){while(--_0x201235){_0x552c92['push'](_0x552c92['shift']());}};_0x439bc6(++_0x193099);}(_0xde05,0x1f3));var _0x5de0=function(_0x330786,_0x579ea1){_0x330786=_0x330786-0x0;var _0x31e5c1=_0xde05[_0x330786];return _0x31e5c1;};'use strict';var SmsMessageEvents=require(_0x5de0('0x0'));var events=['save',_0x5de0('0x1'),_0x5de0('0x2')];function createListener(_0x5c99a3,_0x35fe3d){return function(_0x510c46){_0x35fe3d[_0x5de0('0x3')](_0x5c99a3,_0x510c46);};}function removeListener(_0x260fbf,_0x4050b9){return function(){SmsMessageEvents[_0x5de0('0x4')](_0x260fbf,_0x4050b9);};}exports['register']=function(_0x5109c3){for(var _0x1568ff=0x0,_0x2d42d5=events[_0x5de0('0x5')];_0x1568ff<_0x2d42d5;_0x1568ff++){var _0xda0463=events[_0x1568ff];var _0x644fe1=createListener('smsMessage:'+_0xda0463,_0x5109c3);SmsMessageEvents['on'](_0xda0463,_0x644fe1);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 429896b..a030ef2 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 _0xd347=['/:id/members','getMembers','/:id/teams','post','create','addTeams','addAgents','update','destroy','delete','removeTeams','/:id/users','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x1273d0,_0x16d2dd){var _0x4caaac=function(_0xd8b6ff){while(--_0xd8b6ff){_0x1273d0['push'](_0x1273d0['shift']());}};_0x4caaac(++_0x16d2dd);}(_0xd347,0x16a));var _0x7d34=function(_0x42b7a5,_0x436841){_0x42b7a5=_0x42b7a5-0x0;var _0x425bab=_0xd347[_0x42b7a5];return _0x425bab;};'use strict';var multer=require(_0x7d34('0x0'));var util=require(_0x7d34('0x1'));var path=require(_0x7d34('0x2'));var timeout=require('connect-timeout');var express=require(_0x7d34('0x3'));var router=express[_0x7d34('0x4')]();var fs_extra=require(_0x7d34('0x5'));var auth=require(_0x7d34('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7d34('0x7'));var controller=require(_0x7d34('0x8'));router[_0x7d34('0x9')]('/',auth[_0x7d34('0xa')](),controller[_0x7d34('0xb')]);router[_0x7d34('0x9')](_0x7d34('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x7d34('0x9')](_0x7d34('0xd'),auth['isAuthenticated'](),controller[_0x7d34('0xe')]);router[_0x7d34('0x9')](_0x7d34('0xf'),auth[_0x7d34('0xa')](),controller[_0x7d34('0x10')]);router[_0x7d34('0x9')](_0x7d34('0x11'),auth[_0x7d34('0xa')](),controller['getTeams']);router[_0x7d34('0x9')]('/:id/users',auth[_0x7d34('0xa')](),controller['getAgents']);router[_0x7d34('0x12')]('/',auth[_0x7d34('0xa')](),controller[_0x7d34('0x13')]);router['post'](_0x7d34('0x11'),auth[_0x7d34('0xa')](),controller[_0x7d34('0x14')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x7d34('0x15')]);router['put'](_0x7d34('0xd'),auth[_0x7d34('0xa')](),controller[_0x7d34('0x16')]);router['delete'](_0x7d34('0xd'),auth[_0x7d34('0xa')](),controller[_0x7d34('0x17')]);router[_0x7d34('0x18')](_0x7d34('0x11'),auth[_0x7d34('0xa')](),controller[_0x7d34('0x19')]);router[_0x7d34('0x18')](_0x7d34('0x1a'),auth[_0x7d34('0xa')](),controller[_0x7d34('0x1b')]);module[_0x7d34('0x1c')]=router; \ No newline at end of file +var _0x5892=['create','addTeams','/:id/users','put','update','delete','destroy','removeTeams','removeAgents','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','describe','/:id','getMembers','/:id/teams','post'];(function(_0x46e940,_0x59e2f0){var _0x460a6e=function(_0x24afef){while(--_0x24afef){_0x46e940['push'](_0x46e940['shift']());}};_0x460a6e(++_0x59e2f0);}(_0x5892,0xfa));var _0x2589=function(_0x5b2c8d,_0x118bf4){_0x5b2c8d=_0x5b2c8d-0x0;var _0x5a1b30=_0x5892[_0x5b2c8d];return _0x5a1b30;};'use strict';var multer=require('multer');var util=require(_0x2589('0x0'));var path=require(_0x2589('0x1'));var timeout=require('connect-timeout');var express=require(_0x2589('0x2'));var router=express[_0x2589('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2589('0x4'));var config=require(_0x2589('0x5'));var controller=require(_0x2589('0x6'));router[_0x2589('0x7')]('/',auth[_0x2589('0x8')](),controller['index']);router[_0x2589('0x7')]('/describe',auth[_0x2589('0x8')](),controller[_0x2589('0x9')]);router[_0x2589('0x7')](_0x2589('0xa'),auth[_0x2589('0x8')](),controller['show']);router[_0x2589('0x7')]('/:id/members',auth[_0x2589('0x8')](),controller[_0x2589('0xb')]);router['get'](_0x2589('0xc'),auth[_0x2589('0x8')](),controller['getTeams']);router['get']('/:id/users',auth[_0x2589('0x8')](),controller['getAgents']);router[_0x2589('0xd')]('/',auth[_0x2589('0x8')](),controller[_0x2589('0xe')]);router['post'](_0x2589('0xc'),auth[_0x2589('0x8')](),controller[_0x2589('0xf')]);router[_0x2589('0xd')](_0x2589('0x10'),auth[_0x2589('0x8')](),controller['addAgents']);router[_0x2589('0x11')](_0x2589('0xa'),auth[_0x2589('0x8')](),controller[_0x2589('0x12')]);router[_0x2589('0x13')](_0x2589('0xa'),auth[_0x2589('0x8')](),controller[_0x2589('0x14')]);router[_0x2589('0x13')]('/:id/teams',auth[_0x2589('0x8')](),controller[_0x2589('0x15')]);router[_0x2589('0x13')](_0x2589('0x10'),auth[_0x2589('0x8')](),controller[_0x2589('0x16')]);module[_0x2589('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 990dbcd..5b216f6 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 _0x6061=['roundrobin','sequelize','exports','STRING','ENUM','rrmemory','beepall'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6061,0x1d6));var _0x1606=function(_0x530a24,_0xeebd46){_0x530a24=_0x530a24-0x0;var _0x403fbc=_0x6061[_0x530a24];return _0x403fbc;};'use strict';var Sequelize=require(_0x1606('0x0'));module[_0x1606('0x1')]={'name':{'type':Sequelize[_0x1606('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1606('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1606('0x3')](_0x1606('0x4'),_0x1606('0x5'),_0x1606('0x6'))}}; \ No newline at end of file +var _0xe473=['INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0xe473,0x94));var _0x3e47=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xe473[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x3e47('0x0'));module[_0x3e47('0x1')]={'name':{'type':Sequelize[_0x3e47('0x2')],'unique':_0x3e47('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3e47('0x2')]},'timeout':{'type':Sequelize[_0x3e47('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3e47('0x5'),_0x3e47('0x6'),_0x3e47('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 2b3fd03..2055f50 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 _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x29eecd,_0xbde67c){var _0x5fc879=function(_0x243de8){while(--_0x243de8){_0x29eecd['push'](_0x29eecd['shift']());}};_0x5fc879(++_0xbde67c);}(_0x2ef3,0xba));var _0x32ef=function(_0x1aea6a,_0x1ee1a5){_0x1aea6a=_0x1aea6a-0x0;var _0x22e2ac=_0x2ef3[_0x1aea6a];return _0x22e2ac;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file +var _0x2032=['offset','limit','set','Content-Range','json','update','then','get','SmsQueues','UserProfileResource','destroy','error','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','getOptions','where','include','query','rows','show','keys','filters','intersection','attributes','model','fields','options','find','catch','body','user','UserProfileSection','autoAssociation','params','describe','findOne','UserSmsQueue','hasOwnProperty','order','sort','SmsQueueId','filter','merge','findAll','User','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','pick','nolimit','addTeams','Agents','online','voicePause','interface','sequelize','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','length','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','transaction','isEmpty','emit','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','count'];(function(_0x207d2f,_0x44400f){var _0x3c3498=function(_0x57fdfb){while(--_0x57fdfb){_0x207d2f['push'](_0x207d2f['shift']());}};_0x3c3498(++_0x44400f);}(_0x2032,0xd9));var _0x2203=function(_0xb429b0,_0x5e2c91){_0xb429b0=_0xb429b0-0x0;var _0x47b017=_0x2032[_0xb429b0];return _0x47b017;};'use strict';var BPromise=require('bluebird');var util=require(_0x2203('0x0'));var _=require(_0x2203('0x1'));var squel=require(_0x2203('0x2'));var Redis=require('ioredis');var qs=require(_0x2203('0x3'));var logger=require(_0x2203('0x4'))('api');var config=require(_0x2203('0x5'));var db=require(_0x2203('0x6'))['db'];config[_0x2203('0x7')]=_[_0x2203('0x8')](config[_0x2203('0x7')],{'host':_0x2203('0x9'),'port':0x18eb});var socket=require(_0x2203('0xa'))(new Redis(config[_0x2203('0x7')]));require(_0x2203('0xb'))[_0x2203('0xc')](socket);function respondWithStatusCode(_0x2999ed,_0x5ecf9e){_0x5ecf9e=_0x5ecf9e||0xcc;return function(_0x526ae0){if(_0x526ae0){return _0x2999ed[_0x2203('0xd')](_0x5ecf9e);}return _0x2999ed['status'](_0x5ecf9e)[_0x2203('0xe')]();};}function respondWithResult(_0x2972f3,_0x6339c4){_0x6339c4=_0x6339c4||0xc8;return function(_0x5b19df){if(_0x5b19df){return _0x2972f3[_0x2203('0xf')](_0x6339c4)['json'](_0x5b19df);}};}function respondWithFilteredResult(_0x3f690a,_0x4b73be){return function(_0x297459){if(_0x297459){var _0x1abb51=typeof _0x4b73be['offset']==='undefined'&&typeof _0x4b73be['limit']==='undefined';var _0x4bad7c=_0x297459[_0x2203('0x10')];var _0x538b30=_0x1abb51?0x0:_0x4b73be['offset'];var _0x21a3af=_0x1abb51?_0x297459[_0x2203('0x10')]:_0x4b73be[_0x2203('0x11')]+_0x4b73be[_0x2203('0x12')];var _0x226209;if(_0x21a3af>=_0x4bad7c){_0x21a3af=_0x4bad7c;_0x226209=0xc8;}else{_0x226209=0xce;}_0x3f690a[_0x2203('0xf')](_0x226209);return _0x3f690a[_0x2203('0x13')](_0x2203('0x14'),_0x538b30+'-'+_0x21a3af+'/'+_0x4bad7c)[_0x2203('0x15')](_0x297459);}return null;};}function saveUpdates(_0x3053f3){return function(_0x5129fb){if(_0x5129fb){return _0x5129fb[_0x2203('0x16')](_0x3053f3)[_0x2203('0x17')](function(_0x4893ff){return _0x4893ff;});}return null;};}function removeEntity(_0x3f9ef6){return function(_0x8906e1){if(_0x8906e1){return _0x8906e1['destroy']()[_0x2203('0x17')](function(){var _0x5ee83c=_0x8906e1[_0x2203('0x18')]({'plain':!![]});var _0x310b8c=_0x2203('0x19');return db[_0x2203('0x1a')][_0x2203('0x1b')]({'where':{'type':_0x310b8c,'resourceId':_0x5ee83c['id']}})[_0x2203('0x17')](function(){return _0x8906e1;});})['then'](function(){_0x3f9ef6[_0x2203('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ac866){return function(_0x15f543){if(!_0x15f543){_0x5ac866['sendStatus'](0x194);}return _0x15f543;};}function handleError(_0x3b8ef9,_0x5bfe61){_0x5bfe61=_0x5bfe61||0x1f4;return function(_0x5d4c4e){logger[_0x2203('0x1c')](_0x5d4c4e['stack']);if(_0x5d4c4e['name']){delete _0x5d4c4e[_0x2203('0x1d')];}_0x3b8ef9[_0x2203('0xf')](_0x5bfe61)[_0x2203('0x1e')](_0x5d4c4e);};}exports[_0x2203('0x1f')]=function(_0x1244f4,_0x3114ef){var _0x49c12={};var _0x250349={'count':0x0,'rows':[]};var _0x576378=_[_0x2203('0x20')](db[_0x2203('0x21')][_0x2203('0x22')],function(_0x5f11bf){return{'name':_0x5f11bf[_0x2203('0x23')],'type':_0x5f11bf[_0x2203('0x24')]['key']};});_0x49c12=qs[_0x2203('0x25')](_0x576378,_0x1244f4);var _0xd91f5d={'where':_0x49c12[_0x2203('0x26')]};return db[_0x2203('0x21')][_0x2203('0x10')](_0xd91f5d)[_0x2203('0x17')](function(_0x9c53f){_0x250349['count']=_0x9c53f;_0x49c12[_0x2203('0x27')]=qs[_0x2203('0x27')](_0x1244f4[_0x2203('0x28')]);return db[_0x2203('0x21')]['findAll'](_0x49c12);})[_0x2203('0x17')](function(_0x21ff0d){_0x250349[_0x2203('0x29')]=_0x21ff0d;return _0x250349;})[_0x2203('0x17')](respondWithFilteredResult(_0x3114ef,_0x49c12))['catch'](handleError(_0x3114ef,null));};exports[_0x2203('0x2a')]=function(_0x50aa17,_0x5e6560){var _0x5c0157={'raw':!![],'where':{'id':_0x50aa17['params']['id']}},_0x1d5f74={};_0x1d5f74['model']=_[_0x2203('0x2b')](db[_0x2203('0x21')][_0x2203('0x22')]);_0x1d5f74[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x50aa17['query']);_0x1d5f74[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x1d5f74['model'],_0x1d5f74[_0x2203('0x28')]);_0x5c0157[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0x1d5f74[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x50aa17[_0x2203('0x28')][_0x2203('0x30')]));_0x5c0157[_0x2203('0x2e')]=_0x5c0157[_0x2203('0x2e')]['length']?_0x5c0157[_0x2203('0x2e')]:_0x1d5f74[_0x2203('0x2f')];if(_0x50aa17['query']['includeAll']){_0x5c0157[_0x2203('0x27')]=[{'all':!![]}];}_0x5c0157=_['merge']({},_0x5c0157,_0x50aa17[_0x2203('0x31')]);return db[_0x2203('0x21')][_0x2203('0x32')](_0x5c0157)['then'](handleEntityNotFound(_0x5e6560,null))['then'](respondWithResult(_0x5e6560,null))[_0x2203('0x33')](handleError(_0x5e6560,null));};exports['create']=function(_0x2d0365,_0x5cfe5e){return db[_0x2203('0x21')]['create'](_0x2d0365[_0x2203('0x34')],{})[_0x2203('0x17')](function(_0x4311d1){var _0x40a793=_0x2d0365[_0x2203('0x35')]['get']({'plain':!![]});if(!_0x40a793)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40a793['role']===_0x2203('0x35')){var _0x25a2dc=_0x4311d1[_0x2203('0x18')]({'plain':!![]});var _0x3b0c7a=_0x2203('0x19');return db[_0x2203('0x36')][_0x2203('0x32')]({'where':{'name':_0x3b0c7a,'userProfileId':_0x40a793['userProfileId']},'raw':!![]})[_0x2203('0x17')](function(_0x1b12c3){if(_0x1b12c3&&_0x1b12c3[_0x2203('0x37')]===0x0){return db[_0x2203('0x1a')]['create']({'name':_0x25a2dc['name'],'resourceId':_0x25a2dc['id'],'type':_0x1b12c3[_0x2203('0x1d')],'sectionId':_0x1b12c3['id']},{})['then'](function(){return _0x4311d1;});}else{return _0x4311d1;}})[_0x2203('0x33')](function(_0x446209){logger[_0x2203('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x446209);throw _0x446209;});}return _0x4311d1;})['then'](respondWithResult(_0x5cfe5e,0xc9))[_0x2203('0x33')](handleError(_0x5cfe5e,null));};exports[_0x2203('0x16')]=function(_0x368444,_0x1e09f3){if(_0x368444[_0x2203('0x34')]['id']){delete _0x368444[_0x2203('0x34')]['id'];}return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x368444[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e09f3,null))[_0x2203('0x17')](saveUpdates(_0x368444[_0x2203('0x34')],null))[_0x2203('0x17')](respondWithResult(_0x1e09f3,null))[_0x2203('0x33')](handleError(_0x1e09f3,null));};exports[_0x2203('0x1b')]=function(_0x36b8e4,_0x1e34a0){return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x36b8e4[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e34a0,null))[_0x2203('0x17')](removeEntity(_0x1e34a0,null))['catch'](handleError(_0x1e34a0,null));};exports['describe']=function(_0x1c6661,_0x48129c){return db[_0x2203('0x21')][_0x2203('0x39')]()[_0x2203('0x17')](respondWithResult(_0x48129c,null))[_0x2203('0x33')](handleError(_0x48129c,null));};exports['getMembers']=function(_0x289146,_0x102803){var _0x5cd8c6={'raw':!![],'where':{}},_0x29bd91={},_0x381b3e;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x289146['params']['id']}})['then'](handleEntityNotFound(_0x102803,null))[_0x2203('0x17')](function(_0x5707c8){if(_0x5707c8){_0x381b3e=_0x5707c8['get']({'plain':!![]});_0x29bd91[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x3b')]['rawAttributes']);_0x29bd91['query']=_[_0x2203('0x2b')](_0x289146[_0x2203('0x28')]);_0x29bd91[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x29bd91[_0x2203('0x2f')],_0x29bd91[_0x2203('0x28')]);_0x5cd8c6['attributes']=_[_0x2203('0x2d')](_0x29bd91['model'],qs[_0x2203('0x30')](_0x289146[_0x2203('0x28')][_0x2203('0x30')]));_0x5cd8c6[_0x2203('0x2e')]=_0x5cd8c6['attributes']['length']?_0x5cd8c6[_0x2203('0x2e')]:_0x29bd91[_0x2203('0x2f')];if(!_0x289146[_0x2203('0x28')][_0x2203('0x3c')]('nolimit')){_0x5cd8c6['limit']=qs['limit'](_0x289146[_0x2203('0x28')][_0x2203('0x12')]);_0x5cd8c6['offset']=qs[_0x2203('0x11')](_0x289146[_0x2203('0x28')]['offset']);}_0x5cd8c6[_0x2203('0x3d')]=qs[_0x2203('0x3e')](_0x289146[_0x2203('0x28')][_0x2203('0x3e')]);_0x5cd8c6['where']=qs[_0x2203('0x2c')](_['pick'](_0x289146[_0x2203('0x28')],_0x29bd91[_0x2203('0x2c')]));_0x5cd8c6['where'][_0x2203('0x3f')]=_0x5707c8['id'];if(_0x289146[_0x2203('0x28')][_0x2203('0x40')]){_0x5cd8c6[_0x2203('0x26')]=_[_0x2203('0x41')](_0x5cd8c6[_0x2203('0x26')],{'$or':_['map'](_0x5cd8c6['attributes'],function(_0x2f2537){var _0x524356={};_0x524356[_0x2f2537]={'$like':'%'+_0x289146['query'][_0x2203('0x40')]+'%'};return _0x524356;})});}_0x5cd8c6=_[_0x2203('0x41')]({},_0x5cd8c6,_0x289146[_0x2203('0x31')]);return db['UserSmsQueue'][_0x2203('0x42')](_0x5cd8c6);}})['then'](function(_0x5ddf9e){if(_0x5ddf9e){return db[_0x2203('0x43')]['findAndCountAll']({'where':{'id':_['map'](_0x5ddf9e,'UserId'),'role':_0x2203('0x44')},'attributes':['id',_0x2203('0x1d'),_0x2203('0x45'),_0x2203('0x46'),_0x2203('0x47')]});}})[_0x2203('0x17')](function(_0x2baea2){if(_0x2baea2){return{'count':_0x2baea2[_0x2203('0x10')],'rows':_[_0x2203('0x20')](_0x2baea2[_0x2203('0x29')],function(_0x384a59){return{'membername':_0x384a59[_0x2203('0x1d')],'UserId':_0x384a59['id'],'queue_name':_0x381b3e['name'],'SmsQueueId':_0x381b3e['id'],'interface':util['format'](_0x2203('0x48'),_0x2203('0x49'),_0x384a59[_0x2203('0x1d')]),'penalty':0x0,'paused':_0x384a59[_0x2203('0x45')],'createdAt':_0x384a59[_0x2203('0x47')],'updatedAt':_0x384a59[_0x2203('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x102803,_0x5cd8c6))['catch'](handleError(_0x102803,null));};exports[_0x2203('0x4a')]=function(_0x34358e,_0x21ee59){var _0x1e6d21={};var _0xcab922={};var _0x7b0b9c;var _0x133d22;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x34358e[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x21ee59,null))['then'](function(_0x1ea97a){if(_0x1ea97a){_0x7b0b9c=_0x1ea97a;_0xcab922[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x4b')][_0x2203('0x22')]);_0xcab922[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x34358e[_0x2203('0x28')]);_0xcab922[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],_0xcab922[_0x2203('0x28')]);_0x1e6d21[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x34358e[_0x2203('0x28')][_0x2203('0x30')]));_0x1e6d21[_0x2203('0x2e')]=_0x1e6d21[_0x2203('0x2e')]['length']?_0x1e6d21[_0x2203('0x2e')]:_0xcab922[_0x2203('0x2f')];_0x1e6d21[_0x2203('0x3d')]=qs['sort'](_0x34358e[_0x2203('0x28')][_0x2203('0x3e')]);_0x1e6d21[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x34358e['query'],_0xcab922[_0x2203('0x2c')]));if(_0x34358e[_0x2203('0x28')][_0x2203('0x40')]){_0x1e6d21['where']=_['merge'](_0x1e6d21['where'],{'$or':_['map'](_0x1e6d21['attributes'],function(_0x418d48){var _0xbc9f88={};_0xbc9f88[_0x418d48]={'$like':'%'+_0x34358e[_0x2203('0x28')][_0x2203('0x40')]+'%'};return _0xbc9f88;})});}_0x1e6d21=_[_0x2203('0x41')]({},_0x1e6d21,_0x34358e[_0x2203('0x31')]);return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0x56dcbe){if(_0x56dcbe){_0x133d22=_0x56dcbe['length'];if(!_0x34358e[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x1e6d21[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x34358e[_0x2203('0x28')][_0x2203('0x12')]);_0x1e6d21[_0x2203('0x11')]=qs[_0x2203('0x11')](_0x34358e[_0x2203('0x28')][_0x2203('0x11')]);}return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0xae45a5){if(_0xae45a5){return _0xae45a5?{'count':_0x133d22,'rows':_0xae45a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x21ee59,null))[_0x2203('0x33')](handleError(_0x21ee59,null));};exports[_0x2203('0x4e')]=function(_0x173ac1,_0xa15021){var _0x4b2e4f=_0x173ac1[_0x2203('0x34')]['ids'];return db[_0x2203('0x4b')]['findAll']({'where':{'id':_0x4b2e4f},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':_0x2203('0x4f'),'attributes':['id',_0x2203('0x1d'),_0x2203('0x50'),_0x2203('0x51'),_0x2203('0x52')],'raw':!![]}]})[_0x2203('0x17')](function(_0x2eab08){if(_0x2eab08){var _0x4e9a01=_['flatMap'](_0x2eab08,function(_0x38903b){var _0x34593a=_0x38903b[_0x2203('0x18')]({'plain':!![]});return _0x34593a['Agents'];});return db['SmsQueue']['find']({'where':{'id':_0x173ac1[_0x2203('0x38')]['id']}})[_0x2203('0x17')](function(_0x20385b){return db[_0x2203('0x53')]['transaction'](function(_0x2f7850){return _0x20385b['addTeams'](_0x4b2e4f,{'transaction':_0x2f7850})[_0x2203('0x17')](function(){return BPromise[_0x2203('0x54')](_0x4e9a01,function(_0xe3bee5){return db[_0x2203('0x3b')][_0x2203('0x55')]({'where':{'UserId':_0xe3bee5['id'],'SmsQueueId':_0x173ac1['params']['id']},'transaction':_0x2f7850});});})[_0x2203('0x17')](function(){_0x4e9a01[_0x2203('0x56')](function(_0x18663f){socket['emit'](_0x2203('0x57'),{'UserId':_0x18663f['id'],'SmsQueueId':_0x20385b['id']});});});});});}})[_0x2203('0x17')](respondWithStatusCode(_0xa15021,null))[_0x2203('0x33')](handleError(_0xa15021,null));};exports[_0x2203('0x58')]=function(_0x1c65f9,_0x4356fe){return db[_0x2203('0x4b')][_0x2203('0x42')]({'where':{'id':_0x1c65f9[_0x2203('0x28')][_0x2203('0x59')]},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2203('0x17')](handleEntityNotFound(_0x4356fe,null))[_0x2203('0x17')](function(_0x21b755){var _0x2da37c=_[_0x2203('0x20')](_0x21b755,'id');var _0x52c35e=[];var _0x23f7b1=[];var _0x2a5a4b=squel[_0x2203('0x5a')]();_0x2a5a4b[_0x2203('0x5b')](_0x2203('0x5c'))[_0x2203('0x5d')]('team_has_sms_queues','tq')['join'](_0x2203('0x5e'),'ut',_0x2203('0x5f'))[_0x2203('0x26')](_0x2203('0x60'),_0x1c65f9[_0x2203('0x38')]['id']);for(var _0x4fd029=0x0;_0x4fd029<_0x21b755[_0x2203('0x61')];_0x4fd029+=0x1){let _0x3cb792=_0x21b755[_0x4fd029];for(var _0x4e539b=0x0;_0x4e539b<_0x3cb792['Agents']['length'];_0x4e539b+=0x1){let _0x4fc51a=_0x3cb792['Agents'][_0x4e539b];var _0x2952fc=_0x2a5a4b[_0x2203('0x62')]();_0x2952fc[_0x2203('0x26')]('ut.UserId\x20=\x20?',_0x4fc51a['id']);_0x23f7b1['push'](db['sequelize'][_0x2203('0x28')](_0x2952fc[_0x2203('0x63')](),{'type':db[_0x2203('0x53')][_0x2203('0x64')][_0x2203('0x65')]})[_0x2203('0x17')](function(_0x3d1797){if(_0x3d1797['length']===0x1){return _0x4fc51a['id'];}else{var _0x3bf2c9=_[_0x2203('0x66')](_[_0x2203('0x20')](_0x3d1797,_0x2203('0x67')),function(_0x35ff6b){return _[_0x2203('0x68')](_0x2da37c,_0x35ff6b);});if(_0x3bf2c9){return _0x4fc51a['id'];}}}));}}return BPromise[_0x2203('0x69')](_0x23f7b1)['then'](function(_0x188722){_0x52c35e=_(_0x52c35e)['union'](_0x188722)['compact']()[_0x2203('0x6a')]();return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x1c65f9[_0x2203('0x38')]['id']}})['then'](function(_0x29d545){return db[_0x2203('0x53')][_0x2203('0x6b')](function(_0x461f90){return _0x29d545[_0x2203('0x58')](_0x1c65f9[_0x2203('0x28')]['ids'],{'transaction':_0x461f90})[_0x2203('0x17')](function(){if(!_[_0x2203('0x6c')](_0x52c35e)){return _0x29d545['removeAgents'](_0x52c35e,{'transaction':_0x461f90});}})['then'](function(){_0x52c35e[_0x2203('0x56')](function(_0x3fe71b){socket[_0x2203('0x6d')](_0x2203('0x6e'),{'UserId':_0x3fe71b,'SmsQueueId':_0x29d545['id']});});});});});});})[_0x2203('0x17')](respondWithStatusCode(_0x4356fe,null))[_0x2203('0x33')](handleError(_0x4356fe,null));};exports[_0x2203('0x6f')]=function(_0x3c41bf,_0x4749df){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x3c41bf[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x4749df,null))[_0x2203('0x17')](function(_0x7589a7){if(_0x7589a7){return _0x7589a7[_0x2203('0x6f')](_0x3c41bf['body']['ids'],_[_0x2203('0x70')](_0x3c41bf[_0x2203('0x34')],['ids','id'])||{})[_0x2203('0x71')](function(_0x447a95){for(var _0x5b5e95=0x0;_0x5b5e95<_0x3c41bf[_0x2203('0x34')][_0x2203('0x59')]['length'];_0x5b5e95+=0x1){socket[_0x2203('0x6d')](_0x2203('0x57'),{'UserId':Number(_0x3c41bf['body'][_0x2203('0x59')][_0x5b5e95]),'SmsQueueId':Number(_0x3c41bf[_0x2203('0x38')]['id'])});}return _0x447a95;});}})[_0x2203('0x17')](respondWithResult(_0x4749df,null))[_0x2203('0x33')](handleError(_0x4749df,null));};exports['removeAgents']=function(_0x511c66,_0x2df837){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x511c66['params']['id']}})['then'](handleEntityNotFound(_0x2df837,null))[_0x2203('0x17')](function(_0x199bec){if(_0x199bec){return _0x199bec[_0x2203('0x72')](_0x511c66['query']['ids'])[_0x2203('0x17')](function(){if(_[_0x2203('0x73')](_0x511c66['query'][_0x2203('0x59')])){for(var _0x2de64d=0x0;_0x2de64d<_0x511c66['query'][_0x2203('0x59')]['length'];_0x2de64d+=0x1){socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66['query']['ids'][_0x2de64d]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}}else{socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66[_0x2203('0x28')][_0x2203('0x59')]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}});}})['then'](respondWithStatusCode(_0x2df837,null))[_0x2203('0x33')](handleError(_0x2df837,null));};exports['getAgents']=function(_0x3f31e0,_0x3edb38){var _0x486563={};var _0x4358c1={};var _0x4096f4;var _0x5bd4e4;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x3f31e0[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x3edb38,null))[_0x2203('0x17')](function(_0x5d73a7){if(_0x5d73a7){_0x4096f4=_0x5d73a7;_0x4358c1[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x43')][_0x2203('0x22')]);_0x4358c1[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x3f31e0['query']);_0x4358c1[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x4358c1['model'],_0x4358c1[_0x2203('0x28')]);_0x486563['attributes']=_[_0x2203('0x2d')](_0x4358c1[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x3f31e0['query'][_0x2203('0x30')]));_0x486563[_0x2203('0x2e')]=_0x486563[_0x2203('0x2e')][_0x2203('0x61')]?_0x486563[_0x2203('0x2e')]:_0x4358c1[_0x2203('0x2f')];_0x486563[_0x2203('0x3d')]=qs['sort'](_0x3f31e0['query'][_0x2203('0x3e')]);_0x486563[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x3f31e0[_0x2203('0x28')],_0x4358c1[_0x2203('0x2c')]));if(_0x3f31e0[_0x2203('0x28')]['filter']){_0x486563[_0x2203('0x26')]=_[_0x2203('0x41')](_0x486563['where'],{'$or':_[_0x2203('0x20')](_0x486563['attributes'],function(_0xc3dac5){var _0xbd1866={};_0xbd1866[_0xc3dac5]={'$like':'%'+_0x3f31e0['query'][_0x2203('0x40')]+'%'};return _0xbd1866;})});}_0x486563=_[_0x2203('0x41')]({},_0x486563,_0x3f31e0[_0x2203('0x31')]);return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x36ab7f){if(_0x36ab7f){_0x5bd4e4=_0x36ab7f[_0x2203('0x61')];if(!_0x3f31e0[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x486563[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x3f31e0['query'][_0x2203('0x12')]);_0x486563['offset']=qs[_0x2203('0x11')](_0x3f31e0[_0x2203('0x28')][_0x2203('0x11')]);}return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x2159a5){if(_0x2159a5){return _0x2159a5?{'count':_0x5bd4e4,'rows':_0x2159a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x3edb38,null))[_0x2203('0x33')](handleError(_0x3edb38,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 31aad24..37db387 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 _0xc018=['emit','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xc018,0x1c5));var _0x8c01=function(_0x379004,_0x6c5699){_0x379004=_0x379004-0x0;var _0x2de93e=_0xc018[_0x379004];return _0x2de93e;};'use strict';var EventEmitter=require(_0x8c01('0x0'));var SmsQueue=require(_0x8c01('0x1'))['db'][_0x8c01('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x8c01('0x3')](0x0);var events={'afterCreate':_0x8c01('0x4'),'afterUpdate':_0x8c01('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5505fa){return function(_0x1bff24,_0x4e6811,_0x2de9d9){SmsQueueEvents[_0x8c01('0x6')](_0x5505fa+':'+_0x1bff24['id'],_0x1bff24);SmsQueueEvents[_0x8c01('0x6')](_0x5505fa,_0x1bff24);_0x2de9d9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x8c01('0x7')](e,emitEvent(event));}}module[_0x8c01('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x9044=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x179fe7,_0x3aa54d){var _0x4d1903=function(_0x57add0){while(--_0x57add0){_0x179fe7['push'](_0x179fe7['shift']());}};_0x4d1903(++_0x3aa54d);}(_0x9044,0xa0));var _0x4904=function(_0x199c44,_0x26e52d){_0x199c44=_0x199c44-0x0;var _0x5325de=_0x9044[_0x199c44];return _0x5325de;};'use strict';var EventEmitter=require(_0x4904('0x0'));var SmsQueue=require(_0x4904('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x4904('0x2')](0x0);var events={'afterCreate':_0x4904('0x3'),'afterUpdate':_0x4904('0x4'),'afterDestroy':_0x4904('0x5')};function emitEvent(_0x4e10ac){return function(_0x28df25,_0x506db9,_0x180fd8){SmsQueueEvents['emit'](_0x4e10ac+':'+_0x28df25['id'],_0x28df25);SmsQueueEvents[_0x4904('0x6')](_0x4e10ac,_0x28df25);_0x180fd8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x4904('0x7')](e,emitEvent(event));}}module[_0x4904('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 18ca27b..bc1157e 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 _0x9f12=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueue.attributes','define','SmsQueue','lodash','util'];(function(_0xe9f61,_0x489bb3){var _0x3f492f=function(_0x33516b){while(--_0x33516b){_0xe9f61['push'](_0xe9f61['shift']());}};_0x3f492f(++_0x489bb3);}(_0x9f12,0x14e));var _0x29f1=function(_0x4b33ff,_0x34193c){_0x4b33ff=_0x4b33ff-0x0;var _0x24c2f7=_0x9f12[_0x4b33ff];return _0x24c2f7;};'use strict';var _=require(_0x29f1('0x0'));var util=require(_0x29f1('0x1'));var logger=require(_0x29f1('0x2'))(_0x29f1('0x3'));var moment=require(_0x29f1('0x4'));var BPromise=require(_0x29f1('0x5'));var rp=require(_0x29f1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x29f1('0x7'));var config=require(_0x29f1('0x8'));var attributes=require(_0x29f1('0x9'));module['exports']=function(_0x4b9bf2,_0x1d288d){return _0x4b9bf2[_0x29f1('0xa')](_0x29f1('0xb'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c52=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x5c52,0x144));var _0x25c5=function(_0x5a1c83,_0xe777ca){_0x5a1c83=_0x5a1c83-0x0;var _0x393c43=_0x5c52[_0x5a1c83];return _0x393c43;};'use strict';var _=require(_0x25c5('0x0'));var util=require(_0x25c5('0x1'));var logger=require('../../config/logger')(_0x25c5('0x2'));var moment=require(_0x25c5('0x3'));var BPromise=require(_0x25c5('0x4'));var rp=require(_0x25c5('0x5'));var fs=require('fs');var path=require(_0x25c5('0x6'));var rimraf=require(_0x25c5('0x7'));var config=require(_0x25c5('0x8'));var attributes=require(_0x25c5('0x9'));module['exports']=function(_0x57912b,_0x5d2421){return _0x57912b[_0x25c5('0xa')](_0x25c5('0xb'),attributes,{'tableName':_0x25c5('0xc'),'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 ae46221..8c3d680 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 _0x29e7=['limit','map','include','model','GetSmsQueue','ShowSmsQueue','SmsQueue','find','raw','where','info','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','http','redis','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll','options','attributes'];(function(_0xdeac17,_0x19ad66){var _0x33aabd=function(_0x558a9e){while(--_0x558a9e){_0xdeac17['push'](_0xdeac17['shift']());}};_0x33aabd(++_0x19ad66);}(_0x29e7,0xe3));var _0x729e=function(_0x5209b9,_0x2a34e9){_0x5209b9=_0x5209b9-0x0;var _0x4effeb=_0x29e7[_0x5209b9];return _0x4effeb;};'use strict';var _=require(_0x729e('0x0'));var util=require(_0x729e('0x1'));var moment=require('moment');var BPromise=require(_0x729e('0x2'));var rs=require(_0x729e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x729e('0x4'));var logger=require('../../config/logger')(_0x729e('0x5'));var config=require(_0x729e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x729e('0x7')]({'port':0x232a});config[_0x729e('0x8')]=_['defaults'](config[_0x729e('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x729e('0x8')]));require(_0x729e('0x9'))[_0x729e('0xa')](socket);function respondWithRpcPromise(_0x3a4626,_0x4ebdda,_0x559255){return new BPromise(function(_0x1cc5a2,_0x51ccce){return client[_0x729e('0xb')](_0x3a4626,_0x559255)[_0x729e('0xc')](function(_0x564255){logger['info'](_0x729e('0xd'),_0x4ebdda,_0x729e('0xe'));logger[_0x729e('0xf')](_0x729e('0x10'),_0x4ebdda,'request\x20sent',JSON[_0x729e('0x11')](_0x564255));if(_0x564255[_0x729e('0x12')]){if(_0x564255['error']['code']===0x1f4){logger[_0x729e('0x12')](_0x729e('0xd'),_0x4ebdda,_0x564255['error'][_0x729e('0x13')]);return _0x51ccce(_0x564255[_0x729e('0x12')][_0x729e('0x13')]);}logger[_0x729e('0x12')](_0x729e('0xd'),_0x4ebdda,_0x564255['error']['message']);return _0x1cc5a2(_0x564255[_0x729e('0x12')][_0x729e('0x13')]);}else{logger['info'](_0x729e('0xd'),_0x4ebdda,_0x729e('0xe'));_0x1cc5a2(_0x564255[_0x729e('0x14')][_0x729e('0x13')]);}})[_0x729e('0x15')](function(_0x359b85){logger[_0x729e('0x12')](_0x729e('0xd'),_0x4ebdda,_0x359b85);_0x51ccce(_0x359b85);});});}exports['GetSmsQueue']=function(_0x5c90a5){var _0xf71439=this;return new Promise(function(_0x460ddf,_0x1189db){return db['SmsQueue'][_0x729e('0x16')]({'raw':_0x5c90a5[_0x729e('0x17')]?_0x5c90a5[_0x729e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5c90a5['options']?_0x5c90a5[_0x729e('0x17')]['where']||null:null,'attributes':_0x5c90a5[_0x729e('0x17')]?_0x5c90a5['options'][_0x729e('0x18')]||null:null,'limit':_0x5c90a5[_0x729e('0x17')]?_0x5c90a5[_0x729e('0x17')][_0x729e('0x19')]||null:null,'include':_0x5c90a5[_0x729e('0x17')]?_0x5c90a5[_0x729e('0x17')]['include']?_[_0x729e('0x1a')](_0x5c90a5['options'][_0x729e('0x1b')],function(_0x1b116b){return{'model':db[_0x1b116b[_0x729e('0x1c')]],'as':_0x1b116b['as'],'attributes':_0x1b116b[_0x729e('0x18')],'include':_0x1b116b['include']?_[_0x729e('0x1a')](_0x1b116b[_0x729e('0x1b')],function(_0x3d42b4){return{'model':db[_0x3d42b4[_0x729e('0x1c')]],'as':_0x3d42b4['as'],'attributes':_0x3d42b4[_0x729e('0x18')],'include':_0x3d42b4[_0x729e('0x1b')]?_[_0x729e('0x1a')](_0x3d42b4[_0x729e('0x1b')],function(_0x37547f){return{'model':db[_0x37547f[_0x729e('0x1c')]],'as':_0x37547f['as'],'attributes':_0x37547f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x18cbb7){logger['info'](_0x729e('0x1d'),_0x5c90a5);logger[_0x729e('0xf')](_0x729e('0x1d'),_0x5c90a5,JSON[_0x729e('0x11')](_0x18cbb7));_0x460ddf(_0x18cbb7);})[_0x729e('0x15')](function(_0x7e76ec){logger['error'](_0x729e('0x1d'),_0x7e76ec[_0x729e('0x13')],_0x5c90a5);_0x1189db(_0xf71439[_0x729e('0x12')](0x1f4,_0x7e76ec[_0x729e('0x13')]));});});};exports[_0x729e('0x1e')]=function(_0x53b6d8){var _0x475294=this;return new Promise(function(_0x49d787,_0x2dd6e3){return db[_0x729e('0x1f')][_0x729e('0x20')]({'raw':_0x53b6d8[_0x729e('0x17')]?_0x53b6d8[_0x729e('0x17')][_0x729e('0x21')]===undefined?!![]:![]:!![],'where':_0x53b6d8[_0x729e('0x17')]?_0x53b6d8[_0x729e('0x17')][_0x729e('0x22')]||null:null,'attributes':_0x53b6d8['options']?_0x53b6d8[_0x729e('0x17')][_0x729e('0x18')]||null:null,'include':_0x53b6d8[_0x729e('0x17')]?_0x53b6d8[_0x729e('0x17')][_0x729e('0x1b')]?_[_0x729e('0x1a')](_0x53b6d8[_0x729e('0x17')][_0x729e('0x1b')],function(_0x241dd2){return{'model':db[_0x241dd2[_0x729e('0x1c')]],'as':_0x241dd2['as'],'attributes':_0x241dd2[_0x729e('0x18')],'include':_0x241dd2[_0x729e('0x1b')]?_[_0x729e('0x1a')](_0x241dd2['include'],function(_0xca9d53){return{'model':db[_0xca9d53[_0x729e('0x1c')]],'as':_0xca9d53['as'],'attributes':_0xca9d53['attributes'],'include':_0xca9d53[_0x729e('0x1b')]?_[_0x729e('0x1a')](_0xca9d53['include'],function(_0x3f0951){return{'model':db[_0x3f0951[_0x729e('0x1c')]],'as':_0x3f0951['as'],'attributes':_0x3f0951[_0x729e('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20cb30){logger[_0x729e('0x23')]('ShowSmsQueue',_0x53b6d8);logger[_0x729e('0xf')](_0x729e('0x1e'),_0x53b6d8,JSON['stringify'](_0x20cb30));_0x49d787(_0x20cb30);})[_0x729e('0x15')](function(_0x457a8d){logger[_0x729e('0x12')](_0x729e('0x1e'),_0x457a8d[_0x729e('0x13')],_0x53b6d8);_0x2dd6e3(_0x475294[_0x729e('0x12')](0x1f4,_0x457a8d[_0x729e('0x13')]));});});}; \ No newline at end of file +var _0x3df6=['defaults','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsQueue','options','raw','attributes','limit','include','map','model','GetSmsQueue','debug','ShowSmsQueue','find','where','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis'];(function(_0xbe259,_0x3099c1){var _0x35cdf2=function(_0x147ad5){while(--_0x147ad5){_0xbe259['push'](_0xbe259['shift']());}};_0x35cdf2(++_0x3099c1);}(_0x3df6,0x1f1));var _0x63df=function(_0x1c1d78,_0x7c8495){_0x1c1d78=_0x1c1d78-0x0;var _0x4e369e=_0x3df6[_0x1c1d78];return _0x4e369e;};'use strict';var _=require(_0x63df('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x63df('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x63df('0x2'));var db=require(_0x63df('0x3'))['db'];var utils=require(_0x63df('0x4'));var logger=require(_0x63df('0x5'))(_0x63df('0x6'));var config=require(_0x63df('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x63df('0x8')]['http']({'port':0x232a});config[_0x63df('0x9')]=_[_0x63df('0xa')](config[_0x63df('0x9')],{'host':_0x63df('0xb'),'port':0x18eb});var socket=require(_0x63df('0xc'))(new Redis(config[_0x63df('0x9')]));require('./smsQueue.socket')[_0x63df('0xd')](socket);function respondWithRpcPromise(_0x201c81,_0x29058f,_0x1c24bb){return new BPromise(function(_0x5059b2,_0x29acaf){return client[_0x63df('0xe')](_0x201c81,_0x1c24bb)[_0x63df('0xf')](function(_0x2d50f9){logger[_0x63df('0x10')](_0x63df('0x11'),_0x29058f,_0x63df('0x12'));logger['debug'](_0x63df('0x13'),_0x29058f,_0x63df('0x12'),JSON[_0x63df('0x14')](_0x2d50f9));if(_0x2d50f9['error']){if(_0x2d50f9[_0x63df('0x15')][_0x63df('0x16')]===0x1f4){logger[_0x63df('0x15')](_0x63df('0x11'),_0x29058f,_0x2d50f9[_0x63df('0x15')][_0x63df('0x17')]);return _0x29acaf(_0x2d50f9['error']['message']);}logger[_0x63df('0x15')](_0x63df('0x11'),_0x29058f,_0x2d50f9['error']['message']);return _0x5059b2(_0x2d50f9['error'][_0x63df('0x17')]);}else{logger[_0x63df('0x10')](_0x63df('0x11'),_0x29058f,_0x63df('0x12'));_0x5059b2(_0x2d50f9[_0x63df('0x18')][_0x63df('0x17')]);}})[_0x63df('0x19')](function(_0x28aba1){logger[_0x63df('0x15')](_0x63df('0x11'),_0x29058f,_0x28aba1);_0x29acaf(_0x28aba1);});});}exports['GetSmsQueue']=function(_0x3c6e0b){var _0x17af00=this;return new Promise(function(_0x315d28,_0x5d54dd){return db[_0x63df('0x1a')]['findAll']({'raw':_0x3c6e0b[_0x63df('0x1b')]?_0x3c6e0b[_0x63df('0x1b')][_0x63df('0x1c')]===undefined?!![]:![]:!![],'where':_0x3c6e0b[_0x63df('0x1b')]?_0x3c6e0b[_0x63df('0x1b')]['where']||null:null,'attributes':_0x3c6e0b['options']?_0x3c6e0b[_0x63df('0x1b')][_0x63df('0x1d')]||null:null,'limit':_0x3c6e0b[_0x63df('0x1b')]?_0x3c6e0b[_0x63df('0x1b')][_0x63df('0x1e')]||null:null,'include':_0x3c6e0b['options']?_0x3c6e0b[_0x63df('0x1b')][_0x63df('0x1f')]?_[_0x63df('0x20')](_0x3c6e0b[_0x63df('0x1b')][_0x63df('0x1f')],function(_0x59dd20){return{'model':db[_0x59dd20[_0x63df('0x21')]],'as':_0x59dd20['as'],'attributes':_0x59dd20[_0x63df('0x1d')],'include':_0x59dd20[_0x63df('0x1f')]?_['map'](_0x59dd20[_0x63df('0x1f')],function(_0x3e5973){return{'model':db[_0x3e5973['model']],'as':_0x3e5973['as'],'attributes':_0x3e5973[_0x63df('0x1d')],'include':_0x3e5973[_0x63df('0x1f')]?_['map'](_0x3e5973[_0x63df('0x1f')],function(_0x509bff){return{'model':db[_0x509bff['model']],'as':_0x509bff['as'],'attributes':_0x509bff[_0x63df('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x63df('0xf')](function(_0x361f35){logger[_0x63df('0x10')](_0x63df('0x22'),_0x3c6e0b);logger[_0x63df('0x23')](_0x63df('0x22'),_0x3c6e0b,JSON[_0x63df('0x14')](_0x361f35));_0x315d28(_0x361f35);})[_0x63df('0x19')](function(_0x4f5e20){logger[_0x63df('0x15')](_0x63df('0x22'),_0x4f5e20[_0x63df('0x17')],_0x3c6e0b);_0x5d54dd(_0x17af00['error'](0x1f4,_0x4f5e20[_0x63df('0x17')]));});});};exports[_0x63df('0x24')]=function(_0x188845){var _0x3d6b02=this;return new Promise(function(_0x476c81,_0x128cbf){return db[_0x63df('0x1a')][_0x63df('0x25')]({'raw':_0x188845[_0x63df('0x1b')]?_0x188845['options'][_0x63df('0x1c')]===undefined?!![]:![]:!![],'where':_0x188845[_0x63df('0x1b')]?_0x188845[_0x63df('0x1b')][_0x63df('0x26')]||null:null,'attributes':_0x188845[_0x63df('0x1b')]?_0x188845[_0x63df('0x1b')]['attributes']||null:null,'include':_0x188845['options']?_0x188845[_0x63df('0x1b')]['include']?_[_0x63df('0x20')](_0x188845[_0x63df('0x1b')][_0x63df('0x1f')],function(_0x4dfc6a){return{'model':db[_0x4dfc6a[_0x63df('0x21')]],'as':_0x4dfc6a['as'],'attributes':_0x4dfc6a[_0x63df('0x1d')],'include':_0x4dfc6a[_0x63df('0x1f')]?_[_0x63df('0x20')](_0x4dfc6a[_0x63df('0x1f')],function(_0x1dc77a){return{'model':db[_0x1dc77a[_0x63df('0x21')]],'as':_0x1dc77a['as'],'attributes':_0x1dc77a['attributes'],'include':_0x1dc77a['include']?_[_0x63df('0x20')](_0x1dc77a[_0x63df('0x1f')],function(_0x43672b){return{'model':db[_0x43672b[_0x63df('0x21')]],'as':_0x43672b['as'],'attributes':_0x43672b['attributes']};}):[]};}):[]};}):[]:[]})[_0x63df('0xf')](function(_0x951705){logger[_0x63df('0x10')]('ShowSmsQueue',_0x188845);logger[_0x63df('0x23')](_0x63df('0x24'),_0x188845,JSON[_0x63df('0x14')](_0x951705));_0x476c81(_0x951705);})['catch'](function(_0x226fb6){logger[_0x63df('0x15')](_0x63df('0x24'),_0x226fb6['message'],_0x188845);_0x128cbf(_0x3d6b02[_0x63df('0x15')](0x1f4,_0x226fb6['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index ac51151..382bcd6 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 _0x71e0=['update','emit','removeListener','register','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0xd3c768,_0x4dbae3){var _0x47c550=function(_0x2d0bdd){while(--_0x2d0bdd){_0xd3c768['push'](_0xd3c768['shift']());}};_0x47c550(++_0x4dbae3);}(_0x71e0,0x114));var _0x071e=function(_0x163513,_0x500220){_0x163513=_0x163513-0x0;var _0x1439c7=_0x71e0[_0x163513];return _0x1439c7;};'use strict';var SmsQueueEvents=require(_0x071e('0x0'));var events=[_0x071e('0x1'),_0x071e('0x2'),_0x071e('0x3')];function createListener(_0x2dd02f,_0x32e23e){return function(_0x5d9682){_0x32e23e[_0x071e('0x4')](_0x2dd02f,_0x5d9682);};}function removeListener(_0x157d52,_0x12b566){return function(){SmsQueueEvents[_0x071e('0x5')](_0x157d52,_0x12b566);};}exports[_0x071e('0x6')]=function(_0x1572fd){for(var _0x5e9c03=0x0,_0x333b5f=events[_0x071e('0x7')];_0x5e9c03<_0x333b5f;_0x5e9c03++){var _0x3b66f9=events[_0x5e9c03];var _0x3b91e5=createListener(_0x071e('0x8')+_0x3b66f9,_0x1572fd);SmsQueueEvents['on'](_0x3b66f9,_0x3b91e5);}}; \ No newline at end of file +var _0x4b9f=['./smsQueue.events','save','remove','register','smsQueue:'];(function(_0x5c10f7,_0x1f47fc){var _0x2427fd=function(_0x166203){while(--_0x166203){_0x5c10f7['push'](_0x5c10f7['shift']());}};_0x2427fd(++_0x1f47fc);}(_0x4b9f,0xaf));var _0xf4b9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4b9f[_0x17d9e3];return _0x14192d;};'use strict';var SmsQueueEvents=require(_0xf4b9('0x0'));var events=[_0xf4b9('0x1'),_0xf4b9('0x2'),'update'];function createListener(_0x2ac036,_0x5a4067){return function(_0x35e75e){_0x5a4067['emit'](_0x2ac036,_0x35e75e);};}function removeListener(_0x55c66d,_0x2bcf9c){return function(){SmsQueueEvents['removeListener'](_0x55c66d,_0x2bcf9c);};}exports[_0xf4b9('0x3')]=function(_0x5e3d53){for(var _0x529f67=0x0,_0x433598=events['length'];_0x529f67<_0x433598;_0x529f67++){var _0xb63866=events[_0x529f67];var _0x3eedf3=createListener(_0xf4b9('0x4')+_0xb63866,_0x5e3d53);SmsQueueEvents['on'](_0xb63866,_0x3eedf3);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 65f4d0f..63ed9cc 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 _0xb2cb=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x4e0359,_0x205155){var _0x450f0a=function(_0x2056c6){while(--_0x2056c6){_0x4e0359['push'](_0x4e0359['shift']());}};_0x450f0a(++_0x205155);}(_0xb2cb,0x8a));var _0xbb2c=function(_0x56c70f,_0x4e4493){_0x56c70f=_0x56c70f-0x0;var _0x3812ed=_0xb2cb[_0x56c70f];return _0x3812ed;};'use strict';var multer=require(_0xbb2c('0x0'));var util=require(_0xbb2c('0x1'));var path=require(_0xbb2c('0x2'));var timeout=require(_0xbb2c('0x3'));var express=require('express');var router=express[_0xbb2c('0x4')]();var fs_extra=require(_0xbb2c('0x5'));var auth=require(_0xbb2c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbb2c('0x7'));var controller=require(_0xbb2c('0x8'));router[_0xbb2c('0x9')]('/',auth[_0xbb2c('0xa')](),controller['index']);router[_0xbb2c('0x9')](_0xbb2c('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xbb2c('0x9')](_0xbb2c('0xc'),auth[_0xbb2c('0xa')](),controller[_0xbb2c('0xd')]);router[_0xbb2c('0xe')]('/',auth[_0xbb2c('0xa')](),controller[_0xbb2c('0xf')]);router[_0xbb2c('0x10')](_0xbb2c('0xc'),auth[_0xbb2c('0xa')](),controller[_0xbb2c('0x11')]);router['delete'](_0xbb2c('0xc'),auth[_0xbb2c('0xa')](),controller[_0xbb2c('0x12')]);module[_0xbb2c('0x13')]=router; \ No newline at end of file +var _0x048f=['show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4c3070,_0xc2fb4c){var _0x536a44=function(_0x1412a5){while(--_0x1412a5){_0x4c3070['push'](_0x4c3070['shift']());}};_0x536a44(++_0xc2fb4c);}(_0x048f,0xcd));var _0xf048=function(_0x532356,_0x418194){_0x532356=_0x532356-0x0;var _0x24e437=_0x048f[_0x532356];return _0x24e437;};'use strict';var multer=require(_0xf048('0x0'));var util=require(_0xf048('0x1'));var path=require(_0xf048('0x2'));var timeout=require(_0xf048('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf048('0x4'));var auth=require(_0xf048('0x5'));var interaction=require(_0xf048('0x6'));var config=require(_0xf048('0x7'));var controller=require(_0xf048('0x8'));router[_0xf048('0x9')]('/',auth[_0xf048('0xa')](),controller[_0xf048('0xb')]);router[_0xf048('0x9')](_0xf048('0xc'),auth[_0xf048('0xa')](),controller[_0xf048('0xd')]);router['get'](_0xf048('0xe'),auth['isAuthenticated'](),controller[_0xf048('0xf')]);router[_0xf048('0x10')]('/',auth[_0xf048('0xa')](),controller[_0xf048('0x11')]);router[_0xf048('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xf048('0x13')]);router[_0xf048('0x14')](_0xf048('0xe'),auth[_0xf048('0xa')](),controller['destroy']);module[_0xf048('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index d368b25..f0f09a1 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 _0x6334=['sequelize','exports','DATE','moment'];(function(_0x55bdfe,_0x5c951d){var _0x4f3b93=function(_0x27ec51){while(--_0x27ec51){_0x55bdfe['push'](_0x55bdfe['shift']());}};_0x4f3b93(++_0x5c951d);}(_0x6334,0x7f));var _0x4633=function(_0x3f2ecf,_0x4ccad6){_0x3f2ecf=_0x3f2ecf-0x0;var _0xa6dd7e=_0x6334[_0x3f2ecf];return _0xa6dd7e;};'use strict';var moment=require(_0x4633('0x0'));var Sequelize=require(_0x4633('0x1'));module[_0x4633('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4633('0x3')]},'leaveAt':{'type':Sequelize[_0x4633('0x3')]},'acceptAt':{'type':Sequelize[_0x4633('0x3')]},'exitAt':{'type':Sequelize[_0x4633('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6ac8=['STRING','DATE','sequelize'];(function(_0x42bffc,_0x29eaee){var _0x1e4d17=function(_0x2aaa4b){while(--_0x2aaa4b){_0x42bffc['push'](_0x42bffc['shift']());}};_0x1e4d17(++_0x29eaee);}(_0x6ac8,0x83));var _0x86ac=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x6ac8[_0x387777];return _0x3f84c0;};'use strict';var moment=require('moment');var Sequelize=require(_0x86ac('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x86ac('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x86ac('0x2')]},'leaveAt':{'type':Sequelize[_0x86ac('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x86ac('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 860a90b..a9b8b5a 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 _0xc1b3=['merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','SmsQueueReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL'];(function(_0x3bf086,_0x81c045){var _0x3d36bb=function(_0x357af2){while(--_0x357af2){_0x3bf086['push'](_0x3bf086['shift']());}};_0x3d36bb(++_0x81c045);}(_0xc1b3,0xa1));var _0x3c1b=function(_0x22f339,_0x5b71fc){_0x22f339=_0x22f339-0x0;var _0x453efa=_0xc1b3[_0x22f339];return _0x453efa;};'use strict';var emlformat=require(_0x3c1b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3c1b('0x1'));var jsonpatch=require(_0x3c1b('0x2'));var rp=require(_0x3c1b('0x3'));var moment=require(_0x3c1b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3c1b('0x5'));var util=require(_0x3c1b('0x6'));var path=require(_0x3c1b('0x7'));var sox=require(_0x3c1b('0x8'));var csv=require(_0x3c1b('0x9'));var ejs=require(_0x3c1b('0xa'));var fs=require('fs');var fs_extra=require(_0x3c1b('0xb'));var _=require(_0x3c1b('0xc'));var squel=require('squel');var crypto=require(_0x3c1b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3c1b('0xe'));var Papa=require(_0x3c1b('0xf'));var Redis=require('ioredis');var authService=require(_0x3c1b('0x10'));var qs=require(_0x3c1b('0x11'));var as=require(_0x3c1b('0x12'));var hardwareService=require(_0x3c1b('0x13'));var logger=require(_0x3c1b('0x14'))('api');var utils=require(_0x3c1b('0x15'));var config=require(_0x3c1b('0x16'));var licenseUtil=require(_0x3c1b('0x17'));var db=require(_0x3c1b('0x18'))['db'];function respondWithStatusCode(_0x2b7c68,_0x398e2b){_0x398e2b=_0x398e2b||0xcc;return function(_0x38cfac){if(_0x38cfac){return _0x2b7c68['sendStatus'](_0x398e2b);}return _0x2b7c68[_0x3c1b('0x19')](_0x398e2b)[_0x3c1b('0x1a')]();};}function respondWithResult(_0x294479,_0x50f053){_0x50f053=_0x50f053||0xc8;return function(_0x1701d6){if(_0x1701d6){return _0x294479[_0x3c1b('0x19')](_0x50f053)[_0x3c1b('0x1b')](_0x1701d6);}};}function respondWithFilteredResult(_0x1f5afa,_0x387aa3){return function(_0xb6baf2){if(_0xb6baf2){var _0x4b8d5d=typeof _0x387aa3[_0x3c1b('0x1c')]==='undefined'&&typeof _0x387aa3[_0x3c1b('0x1d')]===_0x3c1b('0x1e');var _0x377e8d=_0xb6baf2[_0x3c1b('0x1f')];var _0x18ef75=_0x4b8d5d?0x0:_0x387aa3[_0x3c1b('0x1c')];var _0x4498b4=_0x4b8d5d?_0xb6baf2[_0x3c1b('0x1f')]:_0x387aa3['offset']+_0x387aa3[_0x3c1b('0x1d')];var _0x38dccb;if(_0x4498b4>=_0x377e8d){_0x4498b4=_0x377e8d;_0x38dccb=0xc8;}else{_0x38dccb=0xce;}_0x1f5afa[_0x3c1b('0x19')](_0x38dccb);return _0x1f5afa[_0x3c1b('0x20')]('Content-Range',_0x18ef75+'-'+_0x4498b4+'/'+_0x377e8d)[_0x3c1b('0x1b')](_0xb6baf2);}return null;};}function patchUpdates(_0x512647){return function(_0x1ee411){try{jsonpatch[_0x3c1b('0x21')](_0x1ee411,_0x512647,!![]);}catch(_0x56b6ef){return BPromise['reject'](_0x56b6ef);}return _0x1ee411[_0x3c1b('0x22')]();};}function saveUpdates(_0x5ddca4,_0x36dc78){return function(_0xe56daa){if(_0xe56daa){return _0xe56daa[_0x3c1b('0x23')](_0x5ddca4)[_0x3c1b('0x24')](function(_0x4da83d){return _0x4da83d;});}return null;};}function removeEntity(_0x43fc00,_0x568ba3){return function(_0x18d033){if(_0x18d033){return _0x18d033[_0x3c1b('0x25')]()['then'](function(){_0x43fc00[_0x3c1b('0x19')](0xcc)[_0x3c1b('0x1a')]();});}};}function handleEntityNotFound(_0x42a7a7,_0x5cdc52){return function(_0x40b2d3){if(!_0x40b2d3){_0x42a7a7[_0x3c1b('0x26')](0x194);}return _0x40b2d3;};}function handleError(_0x39945b,_0x1f777d){_0x1f777d=_0x1f777d||0x1f4;return function(_0x578a56){logger[_0x3c1b('0x27')](_0x578a56['stack']);if(_0x578a56[_0x3c1b('0x28')]){delete _0x578a56[_0x3c1b('0x28')];}_0x39945b[_0x3c1b('0x19')](_0x1f777d)[_0x3c1b('0x29')](_0x578a56);};}exports[_0x3c1b('0x2a')]=function(_0x57f65b,_0x11c243){var _0x30c211={},_0xdac2af={},_0x34c28c={'count':0x0,'rows':[]};var _0x9bde08=_[_0x3c1b('0x2b')](db[_0x3c1b('0x2c')]['rawAttributes'],function(_0x4c238c){return{'name':_0x4c238c[_0x3c1b('0x2d')],'type':_0x4c238c[_0x3c1b('0x2e')][_0x3c1b('0x2f')]};});_0xdac2af[_0x3c1b('0x30')]=_[_0x3c1b('0x2b')](_0x9bde08,_0x3c1b('0x28'));_0xdac2af[_0x3c1b('0x31')]=_[_0x3c1b('0x32')](_0x57f65b[_0x3c1b('0x31')]);_0xdac2af[_0x3c1b('0x33')]=_[_0x3c1b('0x34')](_0xdac2af['model'],_0xdac2af[_0x3c1b('0x31')]);_0x30c211[_0x3c1b('0x35')]=_[_0x3c1b('0x34')](_0xdac2af[_0x3c1b('0x30')],qs['fields'](_0x57f65b[_0x3c1b('0x31')]['fields']));_0x30c211[_0x3c1b('0x35')]=_0x30c211[_0x3c1b('0x35')][_0x3c1b('0x36')]?_0x30c211[_0x3c1b('0x35')]:_0xdac2af[_0x3c1b('0x30')];if(!_0x57f65b['query'][_0x3c1b('0x37')](_0x3c1b('0x38'))){_0x30c211['limit']=qs[_0x3c1b('0x1d')](_0x57f65b[_0x3c1b('0x31')][_0x3c1b('0x1d')]);_0x30c211[_0x3c1b('0x1c')]=qs[_0x3c1b('0x1c')](_0x57f65b[_0x3c1b('0x31')][_0x3c1b('0x1c')]);}_0x30c211[_0x3c1b('0x39')]=qs[_0x3c1b('0x3a')](_0x57f65b[_0x3c1b('0x31')][_0x3c1b('0x3a')]);_0x30c211[_0x3c1b('0x3b')]=qs[_0x3c1b('0x33')](_['pick'](_0x57f65b[_0x3c1b('0x31')],_0xdac2af[_0x3c1b('0x33')]),_0x9bde08);if(_0x57f65b[_0x3c1b('0x31')]['filter']){_0x30c211[_0x3c1b('0x3b')]=_['merge'](_0x30c211['where'],{'$or':_[_0x3c1b('0x2b')](_0x9bde08,function(_0x238f84){if(_0x238f84[_0x3c1b('0x2e')]!==_0x3c1b('0x3c')){var _0x157806={};_0x157806[_0x238f84[_0x3c1b('0x28')]]={'$like':'%'+_0x57f65b[_0x3c1b('0x31')]['filter']+'%'};return _0x157806;}})});}_0x30c211=_[_0x3c1b('0x3d')]({},_0x30c211,_0x57f65b[_0x3c1b('0x3e')]);var _0xb97388={'where':_0x30c211[_0x3c1b('0x3b')]};return db[_0x3c1b('0x2c')][_0x3c1b('0x1f')](_0xb97388)[_0x3c1b('0x24')](function(_0x3c4608){_0x34c28c[_0x3c1b('0x1f')]=_0x3c4608;if(_0x57f65b['query'][_0x3c1b('0x3f')]){_0x30c211[_0x3c1b('0x40')]=[{'all':!![]}];}return db[_0x3c1b('0x2c')][_0x3c1b('0x41')](_0x30c211);})[_0x3c1b('0x24')](function(_0x3fc878){_0x34c28c['rows']=_0x3fc878;return _0x34c28c;})[_0x3c1b('0x24')](respondWithFilteredResult(_0x11c243,_0x30c211))[_0x3c1b('0x42')](handleError(_0x11c243,null));};exports[_0x3c1b('0x43')]=function(_0x1db523,_0x1196e0){var _0x527f83={'raw':!![],'where':{'id':_0x1db523[_0x3c1b('0x44')]['id']}},_0x393147={};_0x393147['model']=_[_0x3c1b('0x32')](db[_0x3c1b('0x2c')][_0x3c1b('0x45')]);_0x393147[_0x3c1b('0x31')]=_['keys'](_0x1db523[_0x3c1b('0x31')]);_0x393147['filters']=_[_0x3c1b('0x34')](_0x393147[_0x3c1b('0x30')],_0x393147[_0x3c1b('0x31')]);_0x527f83[_0x3c1b('0x35')]=_[_0x3c1b('0x34')](_0x393147[_0x3c1b('0x30')],qs['fields'](_0x1db523[_0x3c1b('0x31')]['fields']));_0x527f83['attributes']=_0x527f83[_0x3c1b('0x35')]['length']?_0x527f83[_0x3c1b('0x35')]:_0x393147[_0x3c1b('0x30')];if(_0x1db523['query'][_0x3c1b('0x3f')]){_0x527f83[_0x3c1b('0x40')]=[{'all':!![]}];}_0x527f83=_[_0x3c1b('0x3d')]({},_0x527f83,_0x1db523['options']);return db[_0x3c1b('0x2c')][_0x3c1b('0x46')](_0x527f83)[_0x3c1b('0x24')](handleEntityNotFound(_0x1196e0,null))[_0x3c1b('0x24')](respondWithResult(_0x1196e0,null))[_0x3c1b('0x42')](handleError(_0x1196e0,null));};exports[_0x3c1b('0x47')]=function(_0x31cffa,_0x29d6c4){return db[_0x3c1b('0x2c')][_0x3c1b('0x47')](_0x31cffa[_0x3c1b('0x48')],{})[_0x3c1b('0x24')](respondWithResult(_0x29d6c4,0xc9))[_0x3c1b('0x42')](handleError(_0x29d6c4,null));};exports[_0x3c1b('0x23')]=function(_0x19cb06,_0x310af1){if(_0x19cb06[_0x3c1b('0x48')]['id']){delete _0x19cb06[_0x3c1b('0x48')]['id'];}return db['SmsQueueReport'][_0x3c1b('0x46')]({'where':{'id':_0x19cb06[_0x3c1b('0x44')]['id']}})[_0x3c1b('0x24')](handleEntityNotFound(_0x310af1,null))[_0x3c1b('0x24')](saveUpdates(_0x19cb06[_0x3c1b('0x48')],null))['then'](respondWithResult(_0x310af1,null))[_0x3c1b('0x42')](handleError(_0x310af1,null));};exports[_0x3c1b('0x25')]=function(_0xadad08,_0x32c863){return db[_0x3c1b('0x2c')][_0x3c1b('0x46')]({'where':{'id':_0xadad08[_0x3c1b('0x44')]['id']}})['then'](handleEntityNotFound(_0x32c863,null))[_0x3c1b('0x24')](removeEntity(_0x32c863,null))['catch'](handleError(_0x32c863,null));};exports[_0x3c1b('0x49')]=function(_0x1de0ee,_0x77e8d4){return db[_0x3c1b('0x2c')][_0x3c1b('0x49')]()['then'](respondWithResult(_0x77e8d4,null))[_0x3c1b('0x42')](handleError(_0x77e8d4,null));}; \ No newline at end of file +var _0x1f00=['update','then','destroy','end','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','query','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options','create','catch','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','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','sendStatus','status','json','limit','undefined','offset','count','Content-Range','reject','save'];(function(_0x11b6d6,_0xe371ec){var _0x2710df=function(_0x3c6fdc){while(--_0x3c6fdc){_0x11b6d6['push'](_0x11b6d6['shift']());}};_0x2710df(++_0xe371ec);}(_0x1f00,0x15a));var _0x01f0=function(_0x1aa797,_0xf1b372){_0x1aa797=_0x1aa797-0x0;var _0x4c89d9=_0x1f00[_0x1aa797];return _0x4c89d9;};'use strict';var emlformat=require(_0x01f0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x01f0('0x1'));var jsonpatch=require(_0x01f0('0x2'));var rp=require('request-promise');var moment=require(_0x01f0('0x3'));var BPromise=require(_0x01f0('0x4'));var Mustache=require('mustache');var util=require(_0x01f0('0x5'));var path=require('path');var sox=require(_0x01f0('0x6'));var csv=require(_0x01f0('0x7'));var ejs=require(_0x01f0('0x8'));var fs=require('fs');var fs_extra=require(_0x01f0('0x9'));var _=require('lodash');var squel=require(_0x01f0('0xa'));var crypto=require('crypto');var jsforce=require(_0x01f0('0xb'));var deskjs=require(_0x01f0('0xc'));var toCsv=require(_0x01f0('0x7'));var querystring=require(_0x01f0('0xd'));var Papa=require('papaparse');var Redis=require(_0x01f0('0xe'));var authService=require(_0x01f0('0xf'));var qs=require(_0x01f0('0x10'));var as=require(_0x01f0('0x11'));var hardwareService=require(_0x01f0('0x12'));var logger=require(_0x01f0('0x13'))(_0x01f0('0x14'));var utils=require(_0x01f0('0x15'));var config=require(_0x01f0('0x16'));var licenseUtil=require(_0x01f0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbda5c2,_0x12179d){_0x12179d=_0x12179d||0xcc;return function(_0x2e7096){if(_0x2e7096){return _0xbda5c2[_0x01f0('0x18')](_0x12179d);}return _0xbda5c2[_0x01f0('0x19')](_0x12179d)['end']();};}function respondWithResult(_0x39b415,_0x4b3c68){_0x4b3c68=_0x4b3c68||0xc8;return function(_0x5307d4){if(_0x5307d4){return _0x39b415[_0x01f0('0x19')](_0x4b3c68)[_0x01f0('0x1a')](_0x5307d4);}};}function respondWithFilteredResult(_0x2194b2,_0x2ee895){return function(_0x588c26){if(_0x588c26){var _0x14a056=typeof _0x2ee895['offset']==='undefined'&&typeof _0x2ee895[_0x01f0('0x1b')]===_0x01f0('0x1c');var _0x227e25=_0x588c26['count'];var _0x622f89=_0x14a056?0x0:_0x2ee895[_0x01f0('0x1d')];var _0x1e7b87=_0x14a056?_0x588c26[_0x01f0('0x1e')]:_0x2ee895[_0x01f0('0x1d')]+_0x2ee895[_0x01f0('0x1b')];var _0x25e7f5;if(_0x1e7b87>=_0x227e25){_0x1e7b87=_0x227e25;_0x25e7f5=0xc8;}else{_0x25e7f5=0xce;}_0x2194b2[_0x01f0('0x19')](_0x25e7f5);return _0x2194b2['set'](_0x01f0('0x1f'),_0x622f89+'-'+_0x1e7b87+'/'+_0x227e25)[_0x01f0('0x1a')](_0x588c26);}return null;};}function patchUpdates(_0x1f01b3){return function(_0x5ccb7b){try{jsonpatch['apply'](_0x5ccb7b,_0x1f01b3,!![]);}catch(_0x30e61a){return BPromise[_0x01f0('0x20')](_0x30e61a);}return _0x5ccb7b[_0x01f0('0x21')]();};}function saveUpdates(_0x4b5082,_0x49ef30){return function(_0x3f6c0d){if(_0x3f6c0d){return _0x3f6c0d[_0x01f0('0x22')](_0x4b5082)[_0x01f0('0x23')](function(_0x3f67a8){return _0x3f67a8;});}return null;};}function removeEntity(_0x2d05ba,_0x15f74b){return function(_0x1e9757){if(_0x1e9757){return _0x1e9757[_0x01f0('0x24')]()['then'](function(){_0x2d05ba[_0x01f0('0x19')](0xcc)[_0x01f0('0x25')]();});}};}function handleEntityNotFound(_0xd18a77,_0x4d5692){return function(_0x3375ba){if(!_0x3375ba){_0xd18a77[_0x01f0('0x18')](0x194);}return _0x3375ba;};}function handleError(_0x1e75c6,_0xe615b5){_0xe615b5=_0xe615b5||0x1f4;return function(_0x46d4df){logger[_0x01f0('0x26')](_0x46d4df[_0x01f0('0x27')]);if(_0x46d4df['name']){delete _0x46d4df[_0x01f0('0x28')];}_0x1e75c6[_0x01f0('0x19')](_0xe615b5)[_0x01f0('0x29')](_0x46d4df);};}exports[_0x01f0('0x2a')]=function(_0xac796d,_0x1ae9f7){var _0x95f7c6={},_0x14a298={},_0x1b99f8={'count':0x0,'rows':[]};var _0x1f68b4=_[_0x01f0('0x2b')](db[_0x01f0('0x2c')][_0x01f0('0x2d')],function(_0x5ae2d6){return{'name':_0x5ae2d6[_0x01f0('0x2e')],'type':_0x5ae2d6[_0x01f0('0x2f')]['key']};});_0x14a298[_0x01f0('0x30')]=_[_0x01f0('0x2b')](_0x1f68b4,_0x01f0('0x28'));_0x14a298['query']=_['keys'](_0xac796d['query']);_0x14a298['filters']=_[_0x01f0('0x31')](_0x14a298[_0x01f0('0x30')],_0x14a298['query']);_0x95f7c6['attributes']=_[_0x01f0('0x31')](_0x14a298[_0x01f0('0x30')],qs[_0x01f0('0x32')](_0xac796d['query'][_0x01f0('0x32')]));_0x95f7c6['attributes']=_0x95f7c6[_0x01f0('0x33')][_0x01f0('0x34')]?_0x95f7c6[_0x01f0('0x33')]:_0x14a298[_0x01f0('0x30')];if(!_0xac796d['query'][_0x01f0('0x35')](_0x01f0('0x36'))){_0x95f7c6[_0x01f0('0x1b')]=qs[_0x01f0('0x1b')](_0xac796d[_0x01f0('0x37')]['limit']);_0x95f7c6['offset']=qs[_0x01f0('0x1d')](_0xac796d[_0x01f0('0x37')][_0x01f0('0x1d')]);}_0x95f7c6['order']=qs[_0x01f0('0x38')](_0xac796d['query'][_0x01f0('0x38')]);_0x95f7c6[_0x01f0('0x39')]=qs[_0x01f0('0x3a')](_[_0x01f0('0x3b')](_0xac796d[_0x01f0('0x37')],_0x14a298[_0x01f0('0x3a')]),_0x1f68b4);if(_0xac796d[_0x01f0('0x37')][_0x01f0('0x3c')]){_0x95f7c6[_0x01f0('0x39')]=_[_0x01f0('0x3d')](_0x95f7c6['where'],{'$or':_[_0x01f0('0x2b')](_0x1f68b4,function(_0x41930b){if(_0x41930b[_0x01f0('0x2f')]!==_0x01f0('0x3e')){var _0x127739={};_0x127739[_0x41930b['name']]={'$like':'%'+_0xac796d[_0x01f0('0x37')][_0x01f0('0x3c')]+'%'};return _0x127739;}})});}_0x95f7c6=_[_0x01f0('0x3d')]({},_0x95f7c6,_0xac796d['options']);var _0x2ae3a5={'where':_0x95f7c6[_0x01f0('0x39')]};return db[_0x01f0('0x2c')]['count'](_0x2ae3a5)[_0x01f0('0x23')](function(_0x39b7d1){_0x1b99f8[_0x01f0('0x1e')]=_0x39b7d1;if(_0xac796d['query'][_0x01f0('0x3f')]){_0x95f7c6[_0x01f0('0x40')]=[{'all':!![]}];}return db[_0x01f0('0x2c')][_0x01f0('0x41')](_0x95f7c6);})['then'](function(_0x5bc1eb){_0x1b99f8[_0x01f0('0x42')]=_0x5bc1eb;return _0x1b99f8;})[_0x01f0('0x23')](respondWithFilteredResult(_0x1ae9f7,_0x95f7c6))['catch'](handleError(_0x1ae9f7,null));};exports[_0x01f0('0x43')]=function(_0x196c49,_0x564f26){var _0x52d422={'raw':!![],'where':{'id':_0x196c49[_0x01f0('0x44')]['id']}},_0x19c94b={};_0x19c94b[_0x01f0('0x30')]=_[_0x01f0('0x45')](db['SmsQueueReport'][_0x01f0('0x2d')]);_0x19c94b[_0x01f0('0x37')]=_[_0x01f0('0x45')](_0x196c49['query']);_0x19c94b[_0x01f0('0x3a')]=_[_0x01f0('0x31')](_0x19c94b[_0x01f0('0x30')],_0x19c94b[_0x01f0('0x37')]);_0x52d422[_0x01f0('0x33')]=_[_0x01f0('0x31')](_0x19c94b[_0x01f0('0x30')],qs[_0x01f0('0x32')](_0x196c49[_0x01f0('0x37')][_0x01f0('0x32')]));_0x52d422[_0x01f0('0x33')]=_0x52d422[_0x01f0('0x33')][_0x01f0('0x34')]?_0x52d422['attributes']:_0x19c94b['model'];if(_0x196c49[_0x01f0('0x37')][_0x01f0('0x3f')]){_0x52d422['include']=[{'all':!![]}];}_0x52d422=_[_0x01f0('0x3d')]({},_0x52d422,_0x196c49[_0x01f0('0x46')]);return db[_0x01f0('0x2c')]['find'](_0x52d422)[_0x01f0('0x23')](handleEntityNotFound(_0x564f26,null))[_0x01f0('0x23')](respondWithResult(_0x564f26,null))['catch'](handleError(_0x564f26,null));};exports[_0x01f0('0x47')]=function(_0x207d0b,_0x3038b9){return db[_0x01f0('0x2c')][_0x01f0('0x47')](_0x207d0b['body'],{})[_0x01f0('0x23')](respondWithResult(_0x3038b9,0xc9))[_0x01f0('0x48')](handleError(_0x3038b9,null));};exports[_0x01f0('0x22')]=function(_0x31c548,_0x15a9f1){if(_0x31c548[_0x01f0('0x49')]['id']){delete _0x31c548['body']['id'];}return db[_0x01f0('0x2c')][_0x01f0('0x4a')]({'where':{'id':_0x31c548[_0x01f0('0x44')]['id']}})['then'](handleEntityNotFound(_0x15a9f1,null))['then'](saveUpdates(_0x31c548[_0x01f0('0x49')],null))[_0x01f0('0x23')](respondWithResult(_0x15a9f1,null))['catch'](handleError(_0x15a9f1,null));};exports['destroy']=function(_0x3e93ee,_0x3bbac3){return db[_0x01f0('0x2c')][_0x01f0('0x4a')]({'where':{'id':_0x3e93ee['params']['id']}})['then'](handleEntityNotFound(_0x3bbac3,null))[_0x01f0('0x23')](removeEntity(_0x3bbac3,null))['catch'](handleError(_0x3bbac3,null));};exports[_0x01f0('0x4b')]=function(_0x6b1d73,_0x457d1c){return db[_0x01f0('0x2c')][_0x01f0('0x4b')]()[_0x01f0('0x23')](respondWithResult(_0x457d1c,null))[_0x01f0('0x48')](handleError(_0x457d1c,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 1a8186d..ea8279c 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x208729,_0x5a1e0d){var _0x4f54db=function(_0x3c7e70){while(--_0x3c7e70){_0x208729['push'](_0x208729['shift']());}};_0x4f54db(++_0x5a1e0d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xb7e7[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2e19dd,_0x4973e2){var _0x2e334e=function(_0x5c5f0e){while(--_0x5c5f0e){_0x2e19dd['push'](_0x2e19dd['shift']());}};_0x2e334e(++_0x4973e2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 49c2cbb..4e8a7fd 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 _0xdf4c=['catch','UpdateSmsQueueReport','body','attributes','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','CreateSmsQueueReport','options','raw'];(function(_0x5db0ef,_0x5a6459){var _0x514e1e=function(_0x3da188){while(--_0x3da188){_0x5db0ef['push'](_0x5db0ef['shift']());}};_0x514e1e(++_0x5a6459);}(_0xdf4c,0x154));var _0xcdf4=function(_0x4d94db,_0x5a2d71){_0x4d94db=_0x4d94db-0x0;var _0x41d157=_0xdf4c[_0x4d94db];return _0x41d157;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcdf4('0x0'));var BPromise=require('bluebird');var rs=require(_0xcdf4('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcdf4('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xcdf4('0x3'))(_0xcdf4('0x4'));var config=require(_0xcdf4('0x5'));var jayson=require(_0xcdf4('0x6'));var client=jayson[_0xcdf4('0x7')][_0xcdf4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31b985,_0x373dfe,_0xa3ad98){return new BPromise(function(_0x52b54c,_0x294aca){return client[_0xcdf4('0x9')](_0x31b985,_0xa3ad98)[_0xcdf4('0xa')](function(_0x56a7c4){logger[_0xcdf4('0xb')](_0xcdf4('0xc'),_0x373dfe,_0xcdf4('0xd'));logger[_0xcdf4('0xe')](_0xcdf4('0xf'),_0x373dfe,_0xcdf4('0xd'),JSON[_0xcdf4('0x10')](_0x56a7c4));if(_0x56a7c4['error']){if(_0x56a7c4['error'][_0xcdf4('0x11')]===0x1f4){logger['error'](_0xcdf4('0xc'),_0x373dfe,_0x56a7c4[_0xcdf4('0x12')]['message']);return _0x294aca(_0x56a7c4[_0xcdf4('0x12')][_0xcdf4('0x13')]);}logger[_0xcdf4('0x12')](_0xcdf4('0xc'),_0x373dfe,_0x56a7c4[_0xcdf4('0x12')][_0xcdf4('0x13')]);return _0x52b54c(_0x56a7c4['error'][_0xcdf4('0x13')]);}else{logger[_0xcdf4('0xb')](_0xcdf4('0xc'),_0x373dfe,_0xcdf4('0xd'));_0x52b54c(_0x56a7c4[_0xcdf4('0x14')][_0xcdf4('0x13')]);}})['catch'](function(_0x41dcc8){logger[_0xcdf4('0x12')](_0xcdf4('0xc'),_0x373dfe,_0x41dcc8);_0x294aca(_0x41dcc8);});});}exports[_0xcdf4('0x15')]=function(_0x3c3323){var _0x5b0752=this;return new Promise(function(_0x5c0210,_0x2b9212){return db['SmsQueueReport']['create'](_0x3c3323['body'],{'raw':_0x3c3323[_0xcdf4('0x16')]?_0x3c3323[_0xcdf4('0x16')][_0xcdf4('0x17')]===undefined?!![]:![]:!![]})[_0xcdf4('0xa')](function(_0x52e2da){logger[_0xcdf4('0xb')](_0xcdf4('0x15'),_0x3c3323);logger[_0xcdf4('0xe')](_0xcdf4('0x15'),_0x3c3323,JSON[_0xcdf4('0x10')](_0x52e2da));_0x5c0210(_0x52e2da);})[_0xcdf4('0x18')](function(_0x5690d7){logger[_0xcdf4('0x12')](_0xcdf4('0x15'),_0x5690d7[_0xcdf4('0x13')],_0x3c3323);_0x2b9212(_0x5b0752[_0xcdf4('0x12')](0x1f4,_0x5690d7[_0xcdf4('0x13')]));});});};exports[_0xcdf4('0x19')]=function(_0x5c8878){var _0x568c10=this;return new Promise(function(_0x31f6bb,_0x336cb0){return db['SmsQueueReport']['update'](_0x5c8878[_0xcdf4('0x1a')],{'raw':_0x5c8878[_0xcdf4('0x16')]?_0x5c8878[_0xcdf4('0x16')][_0xcdf4('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c8878['options']?_0x5c8878['options']['where']||null:null,'attributes':_0x5c8878['options']?_0x5c8878[_0xcdf4('0x16')][_0xcdf4('0x1b')]||null:null,'limit':_0x5c8878[_0xcdf4('0x16')]?_0x5c8878[_0xcdf4('0x16')]['limit']||null:null})[_0xcdf4('0xa')](function(_0xe38eaf){logger['info']('UpdateSmsQueueReport',_0x5c8878);logger[_0xcdf4('0xe')](_0xcdf4('0x19'),_0x5c8878,JSON[_0xcdf4('0x10')](_0xe38eaf));_0x31f6bb(_0xe38eaf);})[_0xcdf4('0x18')](function(_0x47f0af){logger['error'](_0xcdf4('0x19'),_0x47f0af[_0xcdf4('0x13')],_0x5c8878);_0x336cb0(_0x568c10[_0xcdf4('0x12')](0x1f4,_0x47f0af[_0xcdf4('0x13')]));});});}; \ No newline at end of file +var _0xc99f=['../../mysqldb','rpc','jayson/promise','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsQueueReport,\x20%s,\x20%s','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','then','UpdateSmsQueueReport','body','attributes','limit','util','moment','bluebird','randomstring','ioredis'];(function(_0x5ee3d3,_0x537c30){var _0x4b272f=function(_0x3dc277){while(--_0x3dc277){_0x5ee3d3['push'](_0x5ee3d3['shift']());}};_0x4b272f(++_0x537c30);}(_0xc99f,0x15a));var _0xfc99=function(_0x3e3064,_0x3dd6f5){_0x3e3064=_0x3e3064-0x0;var _0x4547e1=_0xc99f[_0x3e3064];return _0x4547e1;};'use strict';var _=require('lodash');var util=require(_0xfc99('0x0'));var moment=require(_0xfc99('0x1'));var BPromise=require(_0xfc99('0x2'));var rs=require(_0xfc99('0x3'));var fs=require('fs');var Redis=require(_0xfc99('0x4'));var db=require(_0xfc99('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfc99('0x6'));var config=require('../../config/environment');var jayson=require(_0xfc99('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x37cc79,_0xdc674a,_0x1028ac){return new BPromise(function(_0x353132,_0x117a5d){return client['request'](_0x37cc79,_0x1028ac)['then'](function(_0x824ef7){logger[_0xfc99('0x8')]('SmsQueueReport,\x20%s,\x20%s',_0xdc674a,_0xfc99('0x9'));logger[_0xfc99('0xa')](_0xfc99('0xb'),_0xdc674a,_0xfc99('0x9'),JSON[_0xfc99('0xc')](_0x824ef7));if(_0x824ef7[_0xfc99('0xd')]){if(_0x824ef7[_0xfc99('0xd')]['code']===0x1f4){logger[_0xfc99('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0xdc674a,_0x824ef7[_0xfc99('0xd')][_0xfc99('0xe')]);return _0x117a5d(_0x824ef7[_0xfc99('0xd')][_0xfc99('0xe')]);}logger[_0xfc99('0xd')](_0xfc99('0xf'),_0xdc674a,_0x824ef7[_0xfc99('0xd')][_0xfc99('0xe')]);return _0x353132(_0x824ef7[_0xfc99('0xd')][_0xfc99('0xe')]);}else{logger[_0xfc99('0x8')](_0xfc99('0xf'),_0xdc674a,_0xfc99('0x9'));_0x353132(_0x824ef7['result']['message']);}})[_0xfc99('0x10')](function(_0x4020f6){logger[_0xfc99('0xd')](_0xfc99('0xf'),_0xdc674a,_0x4020f6);_0x117a5d(_0x4020f6);});});}exports[_0xfc99('0x11')]=function(_0x1797ad){var _0xaa8ab8=this;return new Promise(function(_0x1a0d73,_0x47199c){return db[_0xfc99('0x12')][_0xfc99('0x13')](_0x1797ad['body'],{'raw':_0x1797ad[_0xfc99('0x14')]?_0x1797ad[_0xfc99('0x14')][_0xfc99('0x15')]===undefined?!![]:![]:!![]})[_0xfc99('0x16')](function(_0x414b88){logger[_0xfc99('0x8')]('CreateSmsQueueReport',_0x1797ad);logger[_0xfc99('0xa')](_0xfc99('0x11'),_0x1797ad,JSON[_0xfc99('0xc')](_0x414b88));_0x1a0d73(_0x414b88);})['catch'](function(_0x1905e9){logger[_0xfc99('0xd')]('CreateSmsQueueReport',_0x1905e9[_0xfc99('0xe')],_0x1797ad);_0x47199c(_0xaa8ab8[_0xfc99('0xd')](0x1f4,_0x1905e9['message']));});});};exports[_0xfc99('0x17')]=function(_0x2485ff){var _0x4e30ee=this;return new Promise(function(_0x567b79,_0x40b264){return db[_0xfc99('0x12')]['update'](_0x2485ff[_0xfc99('0x18')],{'raw':_0x2485ff[_0xfc99('0x14')]?_0x2485ff['options'][_0xfc99('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2485ff['options']?_0x2485ff['options']['where']||null:null,'attributes':_0x2485ff[_0xfc99('0x14')]?_0x2485ff[_0xfc99('0x14')][_0xfc99('0x19')]||null:null,'limit':_0x2485ff[_0xfc99('0x14')]?_0x2485ff[_0xfc99('0x14')][_0xfc99('0x1a')]||null:null})['then'](function(_0x5b2e3c){logger['info'](_0xfc99('0x17'),_0x2485ff);logger[_0xfc99('0xa')](_0xfc99('0x17'),_0x2485ff,JSON[_0xfc99('0xc')](_0x5b2e3c));_0x567b79(_0x5b2e3c);})[_0xfc99('0x10')](function(_0x487ba7){logger[_0xfc99('0xd')]('UpdateSmsQueueReport',_0x487ba7['message'],_0x2485ff);_0x40b264(_0x4e30ee['error'](0x1f4,_0x487ba7[_0xfc99('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index d9adcfe..2c3af60 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 _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x497402,_0x169fa9){var _0x308635=function(_0x5c6e3b){while(--_0x5c6e3b){_0x497402['push'](_0x497402['shift']());}};_0x308635(++_0x169fa9);}(_0xabce,0x103));var _0xeabc=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xabce[_0x5ddb1c];return _0x354adc;};'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('./smsTransferReport.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('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file +var _0x2494=['express','Router','fs-extra','../../components/auth/service','./smsTransferReport.controller','isAuthenticated','index','get','describe','show','post','create','put','/:id','destroy','exports','multer','path','connect-timeout'];(function(_0x544b54,_0x449462){var _0x3f68dc=function(_0x49a7fb){while(--_0x49a7fb){_0x544b54['push'](_0x544b54['shift']());}};_0x3f68dc(++_0x449462);}(_0x2494,0x82));var _0x4249=function(_0x3da28f,_0x1c62fc){_0x3da28f=_0x3da28f-0x0;var _0x3240c7=_0x2494[_0x3da28f];return _0x3240c7;};'use strict';var multer=require(_0x4249('0x0'));var util=require('util');var path=require(_0x4249('0x1'));var timeout=require(_0x4249('0x2'));var express=require(_0x4249('0x3'));var router=express[_0x4249('0x4')]();var fs_extra=require(_0x4249('0x5'));var auth=require(_0x4249('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4249('0x7'));router['get']('/',auth[_0x4249('0x8')](),controller[_0x4249('0x9')]);router[_0x4249('0xa')]('/describe',auth[_0x4249('0x8')](),controller[_0x4249('0xb')]);router[_0x4249('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4249('0xc')]);router[_0x4249('0xd')]('/',auth[_0x4249('0x8')](),controller[_0x4249('0xe')]);router[_0x4249('0xf')](_0x4249('0x10'),auth[_0x4249('0x8')](),controller['update']);router['delete'](_0x4249('0x10'),auth['isAuthenticated'](),controller[_0x4249('0x11')]);module[_0x4249('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index a50f520..8500071 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0xbfdd7d,_0xd68c66){var _0x11e4f6=function(_0x3f1260){while(--_0x3f1260){_0xbfdd7d['push'](_0xbfdd7d['shift']());}};_0x11e4f6(++_0xd68c66);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x00bb[_0x1facfa];return _0x9ec701;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x348ba6,_0x1aa82f){var _0xc80ec5=function(_0xfe3852){while(--_0xfe3852){_0x348ba6['push'](_0x348ba6['shift']());}};_0xc80ec5(++_0x1aa82f);}(_0x70e0,0x17b));var _0x070e=function(_0x50ca9b,_0x2de110){_0x50ca9b=_0x50ca9b-0x0;var _0x44e413=_0x70e0[_0x50ca9b];return _0x44e413;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index f8e3305..431fa85 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 _0xcc4b=['request-promise','moment','mustache','path','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/environment','../../config/license/util','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','find','catch','create','body','params','describe','rimraf','zip-dir','fast-json-patch'];(function(_0x3b0265,_0x54c4b6){var _0x4d6215=function(_0x431a45){while(--_0x431a45){_0x3b0265['push'](_0x3b0265['shift']());}};_0x4d6215(++_0x54c4b6);}(_0xcc4b,0x16f));var _0xbcc4=function(_0x40b723,_0x118b22){_0x40b723=_0x40b723-0x0;var _0x1981ad=_0xcc4b[_0x40b723];return _0x1981ad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbcc4('0x0'));var zipdir=require(_0xbcc4('0x1'));var jsonpatch=require(_0xbcc4('0x2'));var rp=require(_0xbcc4('0x3'));var moment=require(_0xbcc4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbcc4('0x5'));var util=require('util');var path=require(_0xbcc4('0x6'));var sox=require(_0xbcc4('0x7'));var csv=require(_0xbcc4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbcc4('0x9'));var _=require(_0xbcc4('0xa'));var squel=require(_0xbcc4('0xb'));var crypto=require(_0xbcc4('0xc'));var jsforce=require(_0xbcc4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbcc4('0x8'));var querystring=require(_0xbcc4('0xe'));var Papa=require(_0xbcc4('0xf'));var Redis=require(_0xbcc4('0x10'));var authService=require(_0xbcc4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbcc4('0x12'));var hardwareService=require(_0xbcc4('0x13'));var logger=require(_0xbcc4('0x14'))(_0xbcc4('0x15'));var utils=require('../../config/utils');var config=require(_0xbcc4('0x16'));var licenseUtil=require(_0xbcc4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39f0a9,_0x2b5722){_0x2b5722=_0x2b5722||0xcc;return function(_0x144860){if(_0x144860){return _0x39f0a9['sendStatus'](_0x2b5722);}return _0x39f0a9[_0xbcc4('0x18')](_0x2b5722)[_0xbcc4('0x19')]();};}function respondWithResult(_0x44aa5a,_0x47a785){_0x47a785=_0x47a785||0xc8;return function(_0xe3301e){if(_0xe3301e){return _0x44aa5a[_0xbcc4('0x18')](_0x47a785)['json'](_0xe3301e);}};}function respondWithFilteredResult(_0x2e282e,_0x58b938){return function(_0x1594d6){if(_0x1594d6){var _0x177826=typeof _0x58b938[_0xbcc4('0x1a')]===_0xbcc4('0x1b')&&typeof _0x58b938[_0xbcc4('0x1c')]===_0xbcc4('0x1b');var _0x5a4070=_0x1594d6[_0xbcc4('0x1d')];var _0x404bdb=_0x177826?0x0:_0x58b938['offset'];var _0x378fe6=_0x177826?_0x1594d6['count']:_0x58b938[_0xbcc4('0x1a')]+_0x58b938[_0xbcc4('0x1c')];var _0x52b771;if(_0x378fe6>=_0x5a4070){_0x378fe6=_0x5a4070;_0x52b771=0xc8;}else{_0x52b771=0xce;}_0x2e282e[_0xbcc4('0x18')](_0x52b771);return _0x2e282e['set'](_0xbcc4('0x1e'),_0x404bdb+'-'+_0x378fe6+'/'+_0x5a4070)[_0xbcc4('0x1f')](_0x1594d6);}return null;};}function patchUpdates(_0x28ae79){return function(_0x16a420){try{jsonpatch[_0xbcc4('0x20')](_0x16a420,_0x28ae79,!![]);}catch(_0x367ced){return BPromise[_0xbcc4('0x21')](_0x367ced);}return _0x16a420[_0xbcc4('0x22')]();};}function saveUpdates(_0x229e8c,_0x100f94){return function(_0x2e8f52){if(_0x2e8f52){return _0x2e8f52['update'](_0x229e8c)[_0xbcc4('0x23')](function(_0x280019){return _0x280019;});}return null;};}function removeEntity(_0x2571db,_0x36e368){return function(_0x7329b){if(_0x7329b){return _0x7329b[_0xbcc4('0x24')]()[_0xbcc4('0x23')](function(){_0x2571db[_0xbcc4('0x18')](0xcc)[_0xbcc4('0x19')]();});}};}function handleEntityNotFound(_0xcf743c,_0x4eeada){return function(_0x5d066c){if(!_0x5d066c){_0xcf743c['sendStatus'](0x194);}return _0x5d066c;};}function handleError(_0x13549c,_0x42033d){_0x42033d=_0x42033d||0x1f4;return function(_0x1bc74d){logger[_0xbcc4('0x25')](_0x1bc74d[_0xbcc4('0x26')]);if(_0x1bc74d[_0xbcc4('0x27')]){delete _0x1bc74d[_0xbcc4('0x27')];}_0x13549c[_0xbcc4('0x18')](_0x42033d)[_0xbcc4('0x28')](_0x1bc74d);};}exports[_0xbcc4('0x29')]=function(_0x479a86,_0x16d146){var _0x3e0c2f={},_0x44b029={},_0x196255={'count':0x0,'rows':[]};var _0x43edab=_[_0xbcc4('0x2a')](db[_0xbcc4('0x2b')][_0xbcc4('0x2c')],function(_0x49d311){return{'name':_0x49d311[_0xbcc4('0x2d')],'type':_0x49d311[_0xbcc4('0x2e')][_0xbcc4('0x2f')]};});_0x44b029[_0xbcc4('0x30')]=_[_0xbcc4('0x2a')](_0x43edab,_0xbcc4('0x27'));_0x44b029[_0xbcc4('0x31')]=_[_0xbcc4('0x32')](_0x479a86[_0xbcc4('0x31')]);_0x44b029[_0xbcc4('0x33')]=_[_0xbcc4('0x34')](_0x44b029[_0xbcc4('0x30')],_0x44b029['query']);_0x3e0c2f[_0xbcc4('0x35')]=_['intersection'](_0x44b029[_0xbcc4('0x30')],qs[_0xbcc4('0x36')](_0x479a86['query']['fields']));_0x3e0c2f[_0xbcc4('0x35')]=_0x3e0c2f['attributes'][_0xbcc4('0x37')]?_0x3e0c2f[_0xbcc4('0x35')]:_0x44b029[_0xbcc4('0x30')];if(!_0x479a86['query'][_0xbcc4('0x38')](_0xbcc4('0x39'))){_0x3e0c2f['limit']=qs[_0xbcc4('0x1c')](_0x479a86[_0xbcc4('0x31')][_0xbcc4('0x1c')]);_0x3e0c2f[_0xbcc4('0x1a')]=qs[_0xbcc4('0x1a')](_0x479a86[_0xbcc4('0x31')][_0xbcc4('0x1a')]);}_0x3e0c2f['order']=qs[_0xbcc4('0x3a')](_0x479a86[_0xbcc4('0x31')][_0xbcc4('0x3a')]);_0x3e0c2f[_0xbcc4('0x3b')]=qs['filters'](_[_0xbcc4('0x3c')](_0x479a86['query'],_0x44b029[_0xbcc4('0x33')]),_0x43edab);if(_0x479a86[_0xbcc4('0x31')][_0xbcc4('0x3d')]){_0x3e0c2f[_0xbcc4('0x3b')]=_[_0xbcc4('0x3e')](_0x3e0c2f[_0xbcc4('0x3b')],{'$or':_[_0xbcc4('0x2a')](_0x43edab,function(_0x35ec02){if(_0x35ec02[_0xbcc4('0x2e')]!==_0xbcc4('0x3f')){var _0x3cf501={};_0x3cf501[_0x35ec02['name']]={'$like':'%'+_0x479a86[_0xbcc4('0x31')][_0xbcc4('0x3d')]+'%'};return _0x3cf501;}})});}_0x3e0c2f=_[_0xbcc4('0x3e')]({},_0x3e0c2f,_0x479a86[_0xbcc4('0x40')]);var _0x17f385={'where':_0x3e0c2f['where']};return db[_0xbcc4('0x2b')][_0xbcc4('0x1d')](_0x17f385)['then'](function(_0xdc60be){_0x196255[_0xbcc4('0x1d')]=_0xdc60be;if(_0x479a86[_0xbcc4('0x31')][_0xbcc4('0x41')]){_0x3e0c2f[_0xbcc4('0x42')]=[{'all':!![]}];}return db['SmsTransferReport']['findAll'](_0x3e0c2f);})[_0xbcc4('0x23')](function(_0xe4d800){_0x196255[_0xbcc4('0x43')]=_0xe4d800;return _0x196255;})[_0xbcc4('0x23')](respondWithFilteredResult(_0x16d146,_0x3e0c2f))['catch'](handleError(_0x16d146,null));};exports['show']=function(_0x197796,_0x1244cc){var _0x2131bc={'raw':!![],'where':{'id':_0x197796['params']['id']}},_0x457cc6={};_0x457cc6[_0xbcc4('0x30')]=_[_0xbcc4('0x32')](db[_0xbcc4('0x2b')]['rawAttributes']);_0x457cc6[_0xbcc4('0x31')]=_[_0xbcc4('0x32')](_0x197796[_0xbcc4('0x31')]);_0x457cc6[_0xbcc4('0x33')]=_[_0xbcc4('0x34')](_0x457cc6[_0xbcc4('0x30')],_0x457cc6['query']);_0x2131bc[_0xbcc4('0x35')]=_[_0xbcc4('0x34')](_0x457cc6[_0xbcc4('0x30')],qs[_0xbcc4('0x36')](_0x197796[_0xbcc4('0x31')][_0xbcc4('0x36')]));_0x2131bc[_0xbcc4('0x35')]=_0x2131bc[_0xbcc4('0x35')][_0xbcc4('0x37')]?_0x2131bc[_0xbcc4('0x35')]:_0x457cc6[_0xbcc4('0x30')];if(_0x197796[_0xbcc4('0x31')][_0xbcc4('0x41')]){_0x2131bc[_0xbcc4('0x42')]=[{'all':!![]}];}_0x2131bc=_['merge']({},_0x2131bc,_0x197796[_0xbcc4('0x40')]);return db[_0xbcc4('0x2b')][_0xbcc4('0x44')](_0x2131bc)[_0xbcc4('0x23')](handleEntityNotFound(_0x1244cc,null))['then'](respondWithResult(_0x1244cc,null))[_0xbcc4('0x45')](handleError(_0x1244cc,null));};exports[_0xbcc4('0x46')]=function(_0xad5710,_0x1e1d48){return db[_0xbcc4('0x2b')]['create'](_0xad5710[_0xbcc4('0x47')],{})['then'](respondWithResult(_0x1e1d48,0xc9))[_0xbcc4('0x45')](handleError(_0x1e1d48,null));};exports['update']=function(_0x12fe03,_0x78d19d){if(_0x12fe03[_0xbcc4('0x47')]['id']){delete _0x12fe03[_0xbcc4('0x47')]['id'];}return db['SmsTransferReport'][_0xbcc4('0x44')]({'where':{'id':_0x12fe03[_0xbcc4('0x48')]['id']}})[_0xbcc4('0x23')](handleEntityNotFound(_0x78d19d,null))['then'](saveUpdates(_0x12fe03[_0xbcc4('0x47')],null))[_0xbcc4('0x23')](respondWithResult(_0x78d19d,null))[_0xbcc4('0x45')](handleError(_0x78d19d,null));};exports[_0xbcc4('0x24')]=function(_0x50119d,_0x25dc06){return db[_0xbcc4('0x2b')][_0xbcc4('0x44')]({'where':{'id':_0x50119d[_0xbcc4('0x48')]['id']}})[_0xbcc4('0x23')](handleEntityNotFound(_0x25dc06,null))['then'](removeEntity(_0x25dc06,null))[_0xbcc4('0x45')](handleError(_0x25dc06,null));};exports['describe']=function(_0x466865,_0x5b08cb){return db[_0xbcc4('0x2b')][_0xbcc4('0x49')]()['then'](respondWithResult(_0x5b08cb,null))[_0xbcc4('0x45')](handleError(_0x5b08cb,null));}; \ No newline at end of file +var _0xe234=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','destroy','then','error','stack','name','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','filter','where','merge','options','includeAll','include','findAll','catch','show','params','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x233e92,_0x5557db){var _0x2752e5=function(_0x7ce74e){while(--_0x7ce74e){_0x233e92['push'](_0x233e92['shift']());}};_0x2752e5(++_0x5557db);}(_0xe234,0x191));var _0x4e23=function(_0x1fb74b,_0x882c58){_0x1fb74b=_0x1fb74b-0x0;var _0x4482b1=_0xe234[_0x1fb74b];return _0x4482b1;};'use strict';var emlformat=require(_0x4e23('0x0'));var rimraf=require(_0x4e23('0x1'));var zipdir=require(_0x4e23('0x2'));var jsonpatch=require(_0x4e23('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4e23('0x4'));var Mustache=require(_0x4e23('0x5'));var util=require('util');var path=require(_0x4e23('0x6'));var sox=require(_0x4e23('0x7'));var csv=require(_0x4e23('0x8'));var ejs=require(_0x4e23('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4e23('0xa'));var squel=require('squel');var crypto=require(_0x4e23('0xb'));var jsforce=require(_0x4e23('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4e23('0x8'));var querystring=require(_0x4e23('0xd'));var Papa=require(_0x4e23('0xe'));var Redis=require(_0x4e23('0xf'));var authService=require(_0x4e23('0x10'));var qs=require(_0x4e23('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e23('0x12'));var logger=require(_0x4e23('0x13'))(_0x4e23('0x14'));var utils=require(_0x4e23('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4e23('0x16'));var db=require(_0x4e23('0x17'))['db'];function respondWithStatusCode(_0x1c3783,_0x434b4d){_0x434b4d=_0x434b4d||0xcc;return function(_0x591aee){if(_0x591aee){return _0x1c3783[_0x4e23('0x18')](_0x434b4d);}return _0x1c3783[_0x4e23('0x19')](_0x434b4d)[_0x4e23('0x1a')]();};}function respondWithResult(_0x5c6a8f,_0x5358cb){_0x5358cb=_0x5358cb||0xc8;return function(_0x25191d){if(_0x25191d){return _0x5c6a8f['status'](_0x5358cb)[_0x4e23('0x1b')](_0x25191d);}};}function respondWithFilteredResult(_0x11e57d,_0x20a823){return function(_0x41038a){if(_0x41038a){var _0x1a4de6=typeof _0x20a823[_0x4e23('0x1c')]==='undefined'&&typeof _0x20a823[_0x4e23('0x1d')]===_0x4e23('0x1e');var _0x564bcf=_0x41038a[_0x4e23('0x1f')];var _0x203ac8=_0x1a4de6?0x0:_0x20a823[_0x4e23('0x1c')];var _0x5b3859=_0x1a4de6?_0x41038a['count']:_0x20a823[_0x4e23('0x1c')]+_0x20a823['limit'];var _0x528a28;if(_0x5b3859>=_0x564bcf){_0x5b3859=_0x564bcf;_0x528a28=0xc8;}else{_0x528a28=0xce;}_0x11e57d[_0x4e23('0x19')](_0x528a28);return _0x11e57d[_0x4e23('0x20')]('Content-Range',_0x203ac8+'-'+_0x5b3859+'/'+_0x564bcf)[_0x4e23('0x1b')](_0x41038a);}return null;};}function patchUpdates(_0x1aa3b3){return function(_0x53517c){try{jsonpatch['apply'](_0x53517c,_0x1aa3b3,!![]);}catch(_0x37e90){return BPromise[_0x4e23('0x21')](_0x37e90);}return _0x53517c[_0x4e23('0x22')]();};}function saveUpdates(_0x14b944,_0xa4fb0f){return function(_0x55566d){if(_0x55566d){return _0x55566d[_0x4e23('0x23')](_0x14b944)['then'](function(_0x419ab2){return _0x419ab2;});}return null;};}function removeEntity(_0x25b118,_0x2951aa){return function(_0x2cdc13){if(_0x2cdc13){return _0x2cdc13[_0x4e23('0x24')]()[_0x4e23('0x25')](function(){_0x25b118[_0x4e23('0x19')](0xcc)[_0x4e23('0x1a')]();});}};}function handleEntityNotFound(_0xde2c04,_0x429d63){return function(_0x1b42ca){if(!_0x1b42ca){_0xde2c04['sendStatus'](0x194);}return _0x1b42ca;};}function handleError(_0x518214,_0x44134d){_0x44134d=_0x44134d||0x1f4;return function(_0x811dc2){logger[_0x4e23('0x26')](_0x811dc2[_0x4e23('0x27')]);if(_0x811dc2[_0x4e23('0x28')]){delete _0x811dc2['name'];}_0x518214[_0x4e23('0x19')](_0x44134d)['send'](_0x811dc2);};}exports[_0x4e23('0x29')]=function(_0xcc533d,_0x350a86){var _0x383a00={},_0x5457f3={},_0x2e50ec={'count':0x0,'rows':[]};var _0x315af=_[_0x4e23('0x2a')](db[_0x4e23('0x2b')][_0x4e23('0x2c')],function(_0x351d2f){return{'name':_0x351d2f[_0x4e23('0x2d')],'type':_0x351d2f[_0x4e23('0x2e')][_0x4e23('0x2f')]};});_0x5457f3[_0x4e23('0x30')]=_[_0x4e23('0x2a')](_0x315af,_0x4e23('0x28'));_0x5457f3[_0x4e23('0x31')]=_[_0x4e23('0x32')](_0xcc533d['query']);_0x5457f3[_0x4e23('0x33')]=_[_0x4e23('0x34')](_0x5457f3[_0x4e23('0x30')],_0x5457f3[_0x4e23('0x31')]);_0x383a00[_0x4e23('0x35')]=_['intersection'](_0x5457f3[_0x4e23('0x30')],qs[_0x4e23('0x36')](_0xcc533d[_0x4e23('0x31')][_0x4e23('0x36')]));_0x383a00[_0x4e23('0x35')]=_0x383a00[_0x4e23('0x35')][_0x4e23('0x37')]?_0x383a00[_0x4e23('0x35')]:_0x5457f3[_0x4e23('0x30')];if(!_0xcc533d[_0x4e23('0x31')]['hasOwnProperty']('nolimit')){_0x383a00['limit']=qs['limit'](_0xcc533d['query'][_0x4e23('0x1d')]);_0x383a00[_0x4e23('0x1c')]=qs[_0x4e23('0x1c')](_0xcc533d['query'][_0x4e23('0x1c')]);}_0x383a00['order']=qs['sort'](_0xcc533d[_0x4e23('0x31')][_0x4e23('0x38')]);_0x383a00['where']=qs['filters'](_['pick'](_0xcc533d[_0x4e23('0x31')],_0x5457f3[_0x4e23('0x33')]),_0x315af);if(_0xcc533d[_0x4e23('0x31')][_0x4e23('0x39')]){_0x383a00[_0x4e23('0x3a')]=_[_0x4e23('0x3b')](_0x383a00[_0x4e23('0x3a')],{'$or':_[_0x4e23('0x2a')](_0x315af,function(_0x2bd7e1){if(_0x2bd7e1['type']!=='VIRTUAL'){var _0x187f2d={};_0x187f2d[_0x2bd7e1['name']]={'$like':'%'+_0xcc533d[_0x4e23('0x31')][_0x4e23('0x39')]+'%'};return _0x187f2d;}})});}_0x383a00=_['merge']({},_0x383a00,_0xcc533d[_0x4e23('0x3c')]);var _0xb7a230={'where':_0x383a00[_0x4e23('0x3a')]};return db[_0x4e23('0x2b')][_0x4e23('0x1f')](_0xb7a230)['then'](function(_0x2e0e6b){_0x2e50ec[_0x4e23('0x1f')]=_0x2e0e6b;if(_0xcc533d[_0x4e23('0x31')][_0x4e23('0x3d')]){_0x383a00[_0x4e23('0x3e')]=[{'all':!![]}];}return db[_0x4e23('0x2b')][_0x4e23('0x3f')](_0x383a00);})[_0x4e23('0x25')](function(_0xb9ea2c){_0x2e50ec['rows']=_0xb9ea2c;return _0x2e50ec;})[_0x4e23('0x25')](respondWithFilteredResult(_0x350a86,_0x383a00))[_0x4e23('0x40')](handleError(_0x350a86,null));};exports[_0x4e23('0x41')]=function(_0x212936,_0x116ff8){var _0x19f4a3={'raw':!![],'where':{'id':_0x212936[_0x4e23('0x42')]['id']}},_0x4ab3b0={};_0x4ab3b0[_0x4e23('0x30')]=_[_0x4e23('0x32')](db[_0x4e23('0x2b')][_0x4e23('0x2c')]);_0x4ab3b0['query']=_[_0x4e23('0x32')](_0x212936['query']);_0x4ab3b0['filters']=_[_0x4e23('0x34')](_0x4ab3b0['model'],_0x4ab3b0['query']);_0x19f4a3[_0x4e23('0x35')]=_[_0x4e23('0x34')](_0x4ab3b0[_0x4e23('0x30')],qs[_0x4e23('0x36')](_0x212936['query'][_0x4e23('0x36')]));_0x19f4a3['attributes']=_0x19f4a3['attributes']['length']?_0x19f4a3['attributes']:_0x4ab3b0[_0x4e23('0x30')];if(_0x212936[_0x4e23('0x31')]['includeAll']){_0x19f4a3['include']=[{'all':!![]}];}_0x19f4a3=_['merge']({},_0x19f4a3,_0x212936[_0x4e23('0x3c')]);return db[_0x4e23('0x2b')]['find'](_0x19f4a3)[_0x4e23('0x25')](handleEntityNotFound(_0x116ff8,null))[_0x4e23('0x25')](respondWithResult(_0x116ff8,null))[_0x4e23('0x40')](handleError(_0x116ff8,null));};exports['create']=function(_0x5b63e4,_0x99d25d){return db['SmsTransferReport']['create'](_0x5b63e4[_0x4e23('0x43')],{})[_0x4e23('0x25')](respondWithResult(_0x99d25d,0xc9))[_0x4e23('0x40')](handleError(_0x99d25d,null));};exports[_0x4e23('0x23')]=function(_0x12037a,_0x169209){if(_0x12037a[_0x4e23('0x43')]['id']){delete _0x12037a[_0x4e23('0x43')]['id'];}return db['SmsTransferReport'][_0x4e23('0x44')]({'where':{'id':_0x12037a[_0x4e23('0x42')]['id']}})['then'](handleEntityNotFound(_0x169209,null))[_0x4e23('0x25')](saveUpdates(_0x12037a[_0x4e23('0x43')],null))[_0x4e23('0x25')](respondWithResult(_0x169209,null))[_0x4e23('0x40')](handleError(_0x169209,null));};exports[_0x4e23('0x24')]=function(_0x49a395,_0x8d0531){return db[_0x4e23('0x2b')][_0x4e23('0x44')]({'where':{'id':_0x49a395[_0x4e23('0x42')]['id']}})[_0x4e23('0x25')](handleEntityNotFound(_0x8d0531,null))[_0x4e23('0x25')](removeEntity(_0x8d0531,null))[_0x4e23('0x40')](handleError(_0x8d0531,null));};exports[_0x4e23('0x45')]=function(_0x3a942b,_0x36ca60){return db[_0x4e23('0x2b')]['describe']()[_0x4e23('0x25')](respondWithResult(_0x36ca60,null))[_0x4e23('0x40')](handleError(_0x36ca60,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 0bc8bcf..36eb0fd 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 _0x4858=['uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer'];(function(_0x9c3b8,_0x210d56){var _0xedd4b3=function(_0x175796){while(--_0x175796){_0x9c3b8['push'](_0x9c3b8['shift']());}};_0xedd4b3(++_0x210d56);}(_0x4858,0x12c));var _0x8485=function(_0xe3ddd7,_0x13b62b){_0xe3ddd7=_0xe3ddd7-0x0;var _0x3dea0f=_0x4858[_0xe3ddd7];return _0x3dea0f;};'use strict';var _=require(_0x8485('0x0'));var util=require(_0x8485('0x1'));var logger=require(_0x8485('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8485('0x3'));var rp=require(_0x8485('0x4'));var fs=require('fs');var path=require(_0x8485('0x5'));var rimraf=require(_0x8485('0x6'));var config=require(_0x8485('0x7'));var attributes=require(_0x8485('0x8'));module[_0x8485('0x9')]=function(_0x3a86c4,_0x50a990){return _0x3a86c4[_0x8485('0xa')]('SmsTransferReport',attributes,{'tableName':_0x8485('0xb'),'paranoid':![],'indexes':[{'name':_0x8485('0xc'),'fields':[_0x8485('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x106f=['../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','util','api','moment','request-promise','rimraf'];(function(_0x463683,_0x403c60){var _0x1c7fa1=function(_0x224c11){while(--_0x224c11){_0x463683['push'](_0x463683['shift']());}};_0x1c7fa1(++_0x403c60);}(_0x106f,0x162));var _0xf106=function(_0x6d87a2,_0x401de3){_0x6d87a2=_0x6d87a2-0x0;var _0x27ea10=_0x106f[_0x6d87a2];return _0x27ea10;};'use strict';var _=require(_0xf106('0x0'));var util=require(_0xf106('0x1'));var logger=require('../../config/logger')(_0xf106('0x2'));var moment=require(_0xf106('0x3'));var BPromise=require('bluebird');var rp=require(_0xf106('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf106('0x5'));var config=require(_0xf106('0x6'));var attributes=require(_0xf106('0x7'));module[_0xf106('0x8')]=function(_0x253f6d,_0x282fd4){return _0x253f6d[_0xf106('0x9')]('SmsTransferReport',attributes,{'tableName':_0xf106('0xa'),'paranoid':![],'indexes':[{'name':_0xf106('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 53800a0..289b54d 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 _0x82f5=['http','request','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x82f5,0x15d));var _0x582f=function(_0x745445,_0x499141){_0x745445=_0x745445-0x0;var _0x2dfa91=_0x82f5[_0x745445];return _0x2dfa91;};'use strict';var _=require(_0x582f('0x0'));var util=require(_0x582f('0x1'));var moment=require(_0x582f('0x2'));var BPromise=require(_0x582f('0x3'));var rs=require(_0x582f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x582f('0x5'));var logger=require(_0x582f('0x6'))(_0x582f('0x7'));var config=require(_0x582f('0x8'));var jayson=require(_0x582f('0x9'));var client=jayson[_0x582f('0xa')][_0x582f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x506655,_0x20d976,_0x5d4e30){return new BPromise(function(_0x2cb791,_0x3d5bdd){return client[_0x582f('0xc')](_0x506655,_0x5d4e30)['then'](function(_0x2dd742){logger[_0x582f('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x20d976,_0x582f('0xe'));logger[_0x582f('0xf')](_0x582f('0x10'),_0x20d976,_0x582f('0xe'),JSON[_0x582f('0x11')](_0x2dd742));if(_0x2dd742['error']){if(_0x2dd742['error'][_0x582f('0x12')]===0x1f4){logger[_0x582f('0x13')](_0x582f('0x14'),_0x20d976,_0x2dd742[_0x582f('0x13')][_0x582f('0x15')]);return _0x3d5bdd(_0x2dd742['error'][_0x582f('0x15')]);}logger[_0x582f('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x20d976,_0x2dd742[_0x582f('0x13')][_0x582f('0x15')]);return _0x2cb791(_0x2dd742[_0x582f('0x13')][_0x582f('0x15')]);}else{logger[_0x582f('0xd')](_0x582f('0x14'),_0x20d976,_0x582f('0xe'));_0x2cb791(_0x2dd742[_0x582f('0x16')][_0x582f('0x15')]);}})[_0x582f('0x17')](function(_0x21a30d){logger['error'](_0x582f('0x14'),_0x20d976,_0x21a30d);_0x3d5bdd(_0x21a30d);});});} \ No newline at end of file +var _0xac4f=['SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info'];(function(_0x55c787,_0x30ea48){var _0x78c063=function(_0x23375a){while(--_0x23375a){_0x55c787['push'](_0x55c787['shift']());}};_0x78c063(++_0x30ea48);}(_0xac4f,0x122));var _0xfac4=function(_0x254c9e,_0xab8a1b){_0x254c9e=_0x254c9e-0x0;var _0x2d4cb6=_0xac4f[_0x254c9e];return _0x2d4cb6;};'use strict';var _=require(_0xfac4('0x0'));var util=require('util');var moment=require(_0xfac4('0x1'));var BPromise=require('bluebird');var rs=require(_0xfac4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfac4('0x3'));var logger=require(_0xfac4('0x4'))('rpc');var config=require(_0xfac4('0x5'));var jayson=require(_0xfac4('0x6'));var client=jayson[_0xfac4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x342b8c,_0x8599e2,_0xdd64ea){return new BPromise(function(_0x2ad59f,_0x2e7774){return client[_0xfac4('0x8')](_0x342b8c,_0xdd64ea)['then'](function(_0x6c46e8){logger[_0xfac4('0x9')](_0xfac4('0xa'),_0x8599e2,_0xfac4('0xb'));logger[_0xfac4('0xc')](_0xfac4('0xd'),_0x8599e2,_0xfac4('0xb'),JSON[_0xfac4('0xe')](_0x6c46e8));if(_0x6c46e8[_0xfac4('0xf')]){if(_0x6c46e8[_0xfac4('0xf')][_0xfac4('0x10')]===0x1f4){logger[_0xfac4('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x8599e2,_0x6c46e8[_0xfac4('0xf')]['message']);return _0x2e7774(_0x6c46e8[_0xfac4('0xf')][_0xfac4('0x11')]);}logger[_0xfac4('0xf')](_0xfac4('0xa'),_0x8599e2,_0x6c46e8[_0xfac4('0xf')][_0xfac4('0x11')]);return _0x2ad59f(_0x6c46e8[_0xfac4('0xf')][_0xfac4('0x11')]);}else{logger['info'](_0xfac4('0xa'),_0x8599e2,_0xfac4('0xb'));_0x2ad59f(_0x6c46e8[_0xfac4('0x12')][_0xfac4('0x11')]);}})[_0xfac4('0x13')](function(_0x3ce345){logger[_0xfac4('0xf')](_0xfac4('0xa'),_0x8599e2,_0x3ce345);_0x2e7774(_0x3ce345);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index c9fc3a3..b656120 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 _0xf76f=['./sound.controller','index','get','/:id','/:id/download','isAuthenticated','download','server/files/sounds/original/','originalname','replace','format','basename','now','post','single','file','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x32a81f,_0x4eee66){var _0x5b67a2=function(_0x35d368){while(--_0x35d368){_0x32a81f['push'](_0x32a81f['shift']());}};_0x5b67a2(++_0x4eee66);}(_0xf76f,0x19b));var _0xff76=function(_0x339b92,_0x30a76a){_0x339b92=_0x339b92-0x0;var _0x385718=_0xf76f[_0x339b92];return _0x385718;};'use strict';var multer=require(_0xff76('0x0'));var util=require('util');var path=require(_0xff76('0x1'));var timeout=require(_0xff76('0x2'));var express=require(_0xff76('0x3'));var router=express[_0xff76('0x4')]();var fs_extra=require(_0xff76('0x5'));var auth=require(_0xff76('0x6'));var interaction=require(_0xff76('0x7'));var config=require(_0xff76('0x8'));var controller=require(_0xff76('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xff76('0xa')]);router[_0xff76('0xb')](_0xff76('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xff76('0xd'),auth[_0xff76('0xe')](),controller[_0xff76('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x146175,_0x4fd42c,_0x4b6390){_0x4b6390(null,path['join'](config['root'],_0xff76('0x10')));},'filename':function(_0x41fead,_0x23eeba,_0x589ff3){_0x23eeba[_0xff76('0x11')]=_0x23eeba[_0xff76('0x11')][_0xff76('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x589ff3(null,util[_0xff76('0x13')]('%s-%s%s',path[_0xff76('0x14')](_0x23eeba[_0xff76('0x11')],path['extname'](_0x23eeba['originalname'])),Date[_0xff76('0x15')](),path['extname'](_0x23eeba[_0xff76('0x11')])));}})});router[_0xff76('0x16')]('/',upload[_0xff76('0x17')](_0xff76('0x18')),controller['create']);router['put'](_0xff76('0xc'),auth['isAuthenticated'](),controller[_0xff76('0x19')]);router[_0xff76('0x1a')]('/:id',auth[_0xff76('0xe')](),controller['delete']);module[_0xff76('0x1b')]=router; \ No newline at end of file +var _0xfabc=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','get','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','format','%s-%s%s','extname','single','file','create','put','update','delete','/:id','exports','multer'];(function(_0x4ed1ad,_0x2a8b17){var _0x35a5e1=function(_0x4bab88){while(--_0x4bab88){_0x4ed1ad['push'](_0x4ed1ad['shift']());}};_0x35a5e1(++_0x2a8b17);}(_0xfabc,0xa7));var _0xcfab=function(_0x454c9b,_0x5711a9){_0x454c9b=_0x454c9b-0x0;var _0x2254af=_0xfabc[_0x454c9b];return _0x2254af;};'use strict';var multer=require(_0xcfab('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcfab('0x1'));var router=express[_0xcfab('0x2')]();var fs_extra=require(_0xcfab('0x3'));var auth=require(_0xcfab('0x4'));var interaction=require(_0xcfab('0x5'));var config=require(_0xcfab('0x6'));var controller=require(_0xcfab('0x7'));router['get']('/',auth[_0xcfab('0x8')](),controller['index']);router[_0xcfab('0x9')]('/:id',auth[_0xcfab('0x8')](),controller['show']);router['get'](_0xcfab('0xa'),auth['isAuthenticated'](),controller[_0xcfab('0xb')]);var upload=multer({'storage':multer[_0xcfab('0xc')]({'destination':function(_0x673c44,_0x2edb1d,_0x5ce4ed){_0x5ce4ed(null,path[_0xcfab('0xd')](config[_0xcfab('0xe')],_0xcfab('0xf')));},'filename':function(_0x8bb198,_0x3fb81f,_0x715ac6){_0x3fb81f[_0xcfab('0x10')]=_0x3fb81f[_0xcfab('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x715ac6(null,util[_0xcfab('0x11')](_0xcfab('0x12'),path['basename'](_0x3fb81f[_0xcfab('0x10')],path['extname'](_0x3fb81f['originalname'])),Date['now'](),path[_0xcfab('0x13')](_0x3fb81f[_0xcfab('0x10')])));}})});router['post']('/',upload[_0xcfab('0x14')](_0xcfab('0x15')),controller[_0xcfab('0x16')]);router[_0xcfab('0x17')]('/:id',auth[_0xcfab('0x8')](),controller[_0xcfab('0x18')]);router[_0xcfab('0x19')](_0xcfab('0x1a'),auth[_0xcfab('0x8')](),controller[_0xcfab('0x19')]);module[_0xcfab('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 75c88cf..f0de855 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 _0x75ff=['BIGINT','sequelize','STRING','FLOAT','INTEGER'];(function(_0x525972,_0x411fca){var _0x27b70a=function(_0x5f24d2){while(--_0x5f24d2){_0x525972['push'](_0x525972['shift']());}};_0x27b70a(++_0x411fca);}(_0x75ff,0x1e1));var _0xf75f=function(_0x2931e6,_0x4b79a2){_0x2931e6=_0x2931e6-0x0;var _0x1b1208=_0x75ff[_0x2931e6];return _0x1b1208;};'use strict';var Sequelize=require(_0xf75f('0x0'));module['exports']={'name':{'type':Sequelize[_0xf75f('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xf75f('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xf75f('0x1')]},'original_format':{'type':Sequelize[_0xf75f('0x1')]},'original_duration':{'type':Sequelize[_0xf75f('0x2')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xf75f('0x3')]},'converted_format':{'type':Sequelize[_0xf75f('0x1')]},'converted_duration':{'type':Sequelize[_0xf75f('0x2')]},'converted_sampleCount':{'type':Sequelize[_0xf75f('0x4')]},'converted_channelCount':{'type':Sequelize[_0xf75f('0x3')]},'converted_bitRate':{'type':Sequelize[_0xf75f('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xf75f('0x3')]}}; \ No newline at end of file +var _0x1983=['sequelize','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x20c726,_0x711a9c){var _0x4ff397=function(_0x226b07){while(--_0x226b07){_0x20c726['push'](_0x20c726['shift']());}};_0x4ff397(++_0x711a9c);}(_0x1983,0x14f));var _0x3198=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x1983[_0x59c301];return _0x3866b9;};'use strict';var Sequelize=require(_0x3198('0x0'));module['exports']={'name':{'type':Sequelize[_0x3198('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x3198('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x3198('0x1')]},'original_duration':{'type':Sequelize[_0x3198('0x2')]},'original_sampleCount':{'type':Sequelize[_0x3198('0x3')]},'original_channelCount':{'type':Sequelize[_0x3198('0x4')]},'original_bitRate':{'type':Sequelize[_0x3198('0x3')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x3198('0x1')]},'converted_duration':{'type':Sequelize[_0x3198('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x3198('0x3')]},'converted_channelCount':{'type':Sequelize[_0x3198('0x4')]},'converted_bitRate':{'type':Sequelize[_0x3198('0x3')]},'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 54e630c..687eaf4 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 _0x01c1=['original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','create','body','role','userProfileId','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','sendStatus','error','stack','name','send','index','map','Sound','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','catch','params','keys','include','find','download','save_name','converted_format','existsSync','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','join','root','format','%s.%s','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','transcode','unlinkSync','src'];(function(_0x290c31,_0x534b8a){var _0x2eb0ac=function(_0x54bd7){while(--_0x54bd7){_0x290c31['push'](_0x290c31['shift']());}};_0x2eb0ac(++_0x534b8a);}(_0x01c1,0x98));var _0x101c=function(_0x39c90a,_0x4d9fd9){_0x39c90a=_0x39c90a-0x0;var _0x3a66f9=_0x01c1[_0x39c90a];return _0x3a66f9;};'use strict';var emlformat=require(_0x101c('0x0'));var rimraf=require(_0x101c('0x1'));var zipdir=require(_0x101c('0x2'));var jsonpatch=require(_0x101c('0x3'));var rp=require(_0x101c('0x4'));var moment=require('moment');var BPromise=require(_0x101c('0x5'));var Mustache=require(_0x101c('0x6'));var util=require(_0x101c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x101c('0x8'));var ejs=require(_0x101c('0x9'));var fs=require('fs');var fs_extra=require(_0x101c('0xa'));var _=require(_0x101c('0xb'));var squel=require(_0x101c('0xc'));var crypto=require('crypto');var jsforce=require(_0x101c('0xd'));var deskjs=require(_0x101c('0xe'));var toCsv=require(_0x101c('0x8'));var querystring=require(_0x101c('0xf'));var Papa=require(_0x101c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x101c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x101c('0x12'));var logger=require('../../config/logger')(_0x101c('0x13'));var utils=require(_0x101c('0x14'));var config=require(_0x101c('0x15'));var licenseUtil=require(_0x101c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x318ff4,_0x1d153b){_0x1d153b=_0x1d153b||0xcc;return function(_0x4629b3){if(_0x4629b3){return _0x318ff4['sendStatus'](_0x1d153b);}return _0x318ff4[_0x101c('0x17')](_0x1d153b)[_0x101c('0x18')]();};}function respondWithResult(_0x3a9980,_0x3f9bb6){_0x3f9bb6=_0x3f9bb6||0xc8;return function(_0x2f998e){if(_0x2f998e){return _0x3a9980[_0x101c('0x17')](_0x3f9bb6)[_0x101c('0x19')](_0x2f998e);}};}function respondWithFilteredResult(_0x5da883,_0x5c106a){return function(_0x1b28e4){if(_0x1b28e4){var _0x2f4c26=typeof _0x5c106a['offset']===_0x101c('0x1a')&&typeof _0x5c106a['limit']===_0x101c('0x1a');var _0x2ded08=_0x1b28e4[_0x101c('0x1b')];var _0x41cbe2=_0x2f4c26?0x0:_0x5c106a[_0x101c('0x1c')];var _0x592528=_0x2f4c26?_0x1b28e4[_0x101c('0x1b')]:_0x5c106a[_0x101c('0x1c')]+_0x5c106a[_0x101c('0x1d')];var _0x585bff;if(_0x592528>=_0x2ded08){_0x592528=_0x2ded08;_0x585bff=0xc8;}else{_0x585bff=0xce;}_0x5da883[_0x101c('0x17')](_0x585bff);return _0x5da883[_0x101c('0x1e')](_0x101c('0x1f'),_0x41cbe2+'-'+_0x592528+'/'+_0x2ded08)[_0x101c('0x19')](_0x1b28e4);}return null;};}function patchUpdates(_0x51d264){return function(_0x12340e){try{jsonpatch[_0x101c('0x20')](_0x12340e,_0x51d264,!![]);}catch(_0x409930){return BPromise[_0x101c('0x21')](_0x409930);}return _0x12340e[_0x101c('0x22')]();};}function saveUpdates(_0x14b6eb,_0x317b15){return function(_0x3d470b){if(_0x3d470b){return _0x3d470b[_0x101c('0x23')](_0x14b6eb)[_0x101c('0x24')](function(_0x2f4e6b){return _0x2f4e6b;});}return null;};}function removeEntity(_0x321411,_0x509c2f){return function(_0x265a58){if(_0x265a58){return _0x265a58[_0x101c('0x25')]()[_0x101c('0x24')](function(){var _0x2c1ccc=_0x265a58[_0x101c('0x26')]({'plain':!![]});var _0x15151f=_0x101c('0x27');return db[_0x101c('0x28')][_0x101c('0x25')]({'where':{'type':_0x15151f,'resourceId':_0x2c1ccc['id']}})['then'](function(){return _0x265a58;});})[_0x101c('0x24')](function(){_0x321411[_0x101c('0x17')](0xcc)[_0x101c('0x18')]();});}};}function handleEntityNotFound(_0x10a578,_0x4f3e88){return function(_0x4912a5){if(!_0x4912a5){_0x10a578[_0x101c('0x29')](0x194);}return _0x4912a5;};}function handleError(_0x2f7667,_0x3176d1){_0x3176d1=_0x3176d1||0x1f4;return function(_0x215945){logger[_0x101c('0x2a')](_0x215945[_0x101c('0x2b')]);if(_0x215945[_0x101c('0x2c')]){delete _0x215945[_0x101c('0x2c')];}_0x2f7667[_0x101c('0x17')](_0x3176d1)[_0x101c('0x2d')](_0x215945);};}exports[_0x101c('0x2e')]=function(_0x344745,_0x5c5032){var _0x537168={},_0x1d9906={},_0x441f88={'count':0x0,'rows':[]};var _0x4db94a=_[_0x101c('0x2f')](db[_0x101c('0x30')][_0x101c('0x31')],function(_0x2fef41){return{'name':_0x2fef41['fieldName'],'type':_0x2fef41[_0x101c('0x32')][_0x101c('0x33')]};});_0x1d9906[_0x101c('0x34')]=_[_0x101c('0x2f')](_0x4db94a,_0x101c('0x2c'));_0x1d9906[_0x101c('0x35')]=_['keys'](_0x344745[_0x101c('0x35')]);_0x1d9906[_0x101c('0x36')]=_[_0x101c('0x37')](_0x1d9906[_0x101c('0x34')],_0x1d9906[_0x101c('0x35')]);_0x537168[_0x101c('0x38')]=_['intersection'](_0x1d9906[_0x101c('0x34')],qs[_0x101c('0x39')](_0x344745[_0x101c('0x35')][_0x101c('0x39')]));_0x537168['attributes']=_0x537168[_0x101c('0x38')][_0x101c('0x3a')]?_0x537168[_0x101c('0x38')]:_0x1d9906['model'];if(!_0x344745[_0x101c('0x35')][_0x101c('0x3b')](_0x101c('0x3c'))){_0x537168[_0x101c('0x1d')]=qs[_0x101c('0x1d')](_0x344745[_0x101c('0x35')][_0x101c('0x1d')]);_0x537168[_0x101c('0x1c')]=qs['offset'](_0x344745[_0x101c('0x35')][_0x101c('0x1c')]);}_0x537168[_0x101c('0x3d')]=qs['sort'](_0x344745[_0x101c('0x35')][_0x101c('0x3e')]);_0x537168[_0x101c('0x3f')]=qs[_0x101c('0x36')](_[_0x101c('0x40')](_0x344745[_0x101c('0x35')],_0x1d9906['filters']),_0x4db94a);if(_0x344745['query']['filter']){_0x537168['where']=_['merge'](_0x537168[_0x101c('0x3f')],{'$or':_[_0x101c('0x2f')](_0x4db94a,function(_0x20de34){if(_0x20de34[_0x101c('0x32')]!==_0x101c('0x41')){var _0x44fcb7={};_0x44fcb7[_0x20de34[_0x101c('0x2c')]]={'$like':'%'+_0x344745[_0x101c('0x35')][_0x101c('0x42')]+'%'};return _0x44fcb7;}})});}_0x537168=_[_0x101c('0x43')]({},_0x537168,_0x344745[_0x101c('0x44')]);var _0x54b298={'where':_0x537168[_0x101c('0x3f')]};return db['Sound'][_0x101c('0x1b')](_0x54b298)[_0x101c('0x24')](function(_0x216962){_0x441f88[_0x101c('0x1b')]=_0x216962;if(_0x344745[_0x101c('0x35')][_0x101c('0x45')]){_0x537168['include']=[{'all':!![]}];}return db['Sound'][_0x101c('0x46')](_0x537168);})[_0x101c('0x24')](function(_0x38f84e){_0x441f88['rows']=_0x38f84e;return _0x441f88;})['then'](respondWithFilteredResult(_0x5c5032,_0x537168))[_0x101c('0x47')](handleError(_0x5c5032,null));};exports['show']=function(_0x828604,_0x98ae62){var _0x773175={'raw':!![],'where':{'id':_0x828604[_0x101c('0x48')]['id']}},_0x51692d={};_0x51692d[_0x101c('0x34')]=_[_0x101c('0x49')](db['Sound'][_0x101c('0x31')]);_0x51692d[_0x101c('0x35')]=_[_0x101c('0x49')](_0x828604[_0x101c('0x35')]);_0x51692d[_0x101c('0x36')]=_['intersection'](_0x51692d[_0x101c('0x34')],_0x51692d[_0x101c('0x35')]);_0x773175[_0x101c('0x38')]=_[_0x101c('0x37')](_0x51692d[_0x101c('0x34')],qs[_0x101c('0x39')](_0x828604['query'][_0x101c('0x39')]));_0x773175[_0x101c('0x38')]=_0x773175[_0x101c('0x38')][_0x101c('0x3a')]?_0x773175[_0x101c('0x38')]:_0x51692d[_0x101c('0x34')];if(_0x828604[_0x101c('0x35')]['includeAll']){_0x773175[_0x101c('0x4a')]=[{'all':!![]}];}_0x773175=_[_0x101c('0x43')]({},_0x773175,_0x828604[_0x101c('0x44')]);return db['Sound'][_0x101c('0x4b')](_0x773175)[_0x101c('0x24')](handleEntityNotFound(_0x98ae62,null))['then'](respondWithResult(_0x98ae62,null))[_0x101c('0x47')](handleError(_0x98ae62,null));};exports[_0x101c('0x4c')]=function(_0x2ffe5b,_0x2ac507,_0x4b2d81){return db[_0x101c('0x30')][_0x101c('0x4b')]({'where':{'id':_0x2ffe5b['params']['id']},'attributes':[_0x101c('0x2c'),_0x101c('0x4d'),_0x101c('0x4e')],'raw':!![]})[_0x101c('0x24')](handleEntityNotFound(_0x2ac507,null))[_0x101c('0x24')](function(_0x54fedf){if(_0x54fedf){if(!fs[_0x101c('0x4f')](path['join'](config['root'],_0x101c('0x50'),_0x54fedf['save_name']+'.'+_0x54fedf[_0x101c('0x4e')]))){throw new db['Sequelize'][(_0x101c('0x51'))](_0x101c('0x52'));}return _0x2ac507[_0x101c('0x4c')](path[_0x101c('0x53')](config[_0x101c('0x54')],'server/files/sounds/converted',util[_0x101c('0x55')](_0x101c('0x56'),_0x54fedf[_0x101c('0x4d')],_0x54fedf[_0x101c('0x4e')])),util[_0x101c('0x55')](_0x101c('0x56'),_0x54fedf[_0x101c('0x2c')],_0x54fedf[_0x101c('0x4e')]));}return null;})[_0x101c('0x47')](handleError(_0x2ac507,null));};exports['create']=function(_0x5a7fcd,_0x89893a,_0x1128dc){var _0x53dc8a={'name':path[_0x101c('0x57')](_0x5a7fcd[_0x101c('0x58')][_0x101c('0x59')],path[_0x101c('0x5a')](_0x5a7fcd[_0x101c('0x58')][_0x101c('0x59')])),'save_name':path[_0x101c('0x57')](_0x5a7fcd[_0x101c('0x58')][_0x101c('0x5b')],path['extname'](_0x5a7fcd[_0x101c('0x58')]['filename'])),'original_format':path[_0x101c('0x5a')](_0x5a7fcd['file'][_0x101c('0x59')])[_0x101c('0x5c')](0x1),'converted_format':_0x101c('0x5d')};var _0x6030c=path[_0x101c('0x53')](config['root'],_0x101c('0x5e'),_0x5a7fcd['file'][_0x101c('0x5b')]);var _0x625a60=path[_0x101c('0x53')](config[_0x101c('0x54')],_0x101c('0x50'),util[_0x101c('0x55')](_0x101c('0x56'),path[_0x101c('0x57')](_0x5a7fcd[_0x101c('0x58')][_0x101c('0x5b')],path[_0x101c('0x5a')](_0x5a7fcd[_0x101c('0x58')]['filename'])),_0x53dc8a['converted_format']));logger[_0x101c('0x5f')](_0x101c('0x60'),_0x6030c);logger['info'](_0x101c('0x61'),_0x625a60);try{fs['chmodSync'](_0x6030c,parseInt(_0x101c('0x62'),0x8));var _0x370e63=sox[_0x101c('0x63')](_0x6030c,_0x625a60,{'sampleRate':0x1f40,'format':_0x101c('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x370e63['on']('error',function(_0x1572bf){fs[_0x101c('0x64')](_0x6030c);_0x89893a['status'](0x1f4)[_0x101c('0x2d')](_0x1572bf);});_0x370e63['on'](_0x101c('0x65'),function(_0x1bbc53){_0x53dc8a[_0x101c('0x66')]=isNaN(_0x1bbc53[_0x101c('0x67')])?null:_0x1bbc53[_0x101c('0x67')]*0x3e8;_0x53dc8a[_0x101c('0x68')]=isNaN(_0x1bbc53[_0x101c('0x69')])?null:_0x1bbc53['sampleCount'];_0x53dc8a[_0x101c('0x6a')]=isNaN(_0x1bbc53[_0x101c('0x6b')])?null:_0x1bbc53['channelCount'];_0x53dc8a['original_bitRate']=isNaN(_0x1bbc53[_0x101c('0x6c')])?null:_0x1bbc53['bitRate'];_0x53dc8a[_0x101c('0x6d')]=isNaN(_0x1bbc53[_0x101c('0x6e')])?null:_0x1bbc53[_0x101c('0x6e')];});_0x370e63['on'](_0x101c('0x6f'),function(_0x32bacb){_0x53dc8a[_0x101c('0x70')]=isNaN(_0x32bacb[_0x101c('0x67')])?null:_0x32bacb['duration']*0x3e8;_0x53dc8a[_0x101c('0x71')]=isNaN(_0x32bacb[_0x101c('0x69')])?null:_0x32bacb[_0x101c('0x69')];_0x53dc8a[_0x101c('0x72')]=isNaN(_0x32bacb['channelCount'])?null:_0x32bacb[_0x101c('0x6b')];_0x53dc8a[_0x101c('0x73')]=isNaN(_0x32bacb[_0x101c('0x6c')])?null:_0x32bacb[_0x101c('0x6c')];_0x53dc8a[_0x101c('0x74')]=isNaN(_0x32bacb[_0x101c('0x6e')])?null:_0x32bacb[_0x101c('0x6e')];});_0x370e63['on'](_0x101c('0x18'),function(){fs[_0x101c('0x75')](_0x625a60,parseInt(_0x101c('0x62'),0x8));return db[_0x101c('0x30')][_0x101c('0x76')](_0x53dc8a)[_0x101c('0x24')](function(_0xabf0c3){var _0x4c64c3={'role':_0x5a7fcd[_0x101c('0x77')][_0x101c('0x78')],'userProfileId':_0x5a7fcd[_0x101c('0x77')][_0x101c('0x79')]};if(!_0x4c64c3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c64c3['role']==='user'){var _0xc85ad1=_0xabf0c3['get']({'plain':!![]});return db[_0x101c('0x7a')][_0x101c('0x4b')]({'where':{'name':_0x101c('0x27'),'userProfileId':_0x4c64c3[_0x101c('0x79')]},'raw':!![]})[_0x101c('0x24')](function(_0x3cd659){if(_0x3cd659&&_0x3cd659[_0x101c('0x7b')]===0x0){return db[_0x101c('0x28')]['create']({'name':_0xc85ad1[_0x101c('0x2c')],'resourceId':_0xc85ad1['id'],'type':_0x3cd659[_0x101c('0x2c')],'sectionId':_0x3cd659['id']},{})[_0x101c('0x24')](function(){return _0xabf0c3;});}else{return _0xabf0c3;}})['catch'](function(_0x5ed472){logger[_0x101c('0x2a')](_0x101c('0x7c'),_0x5ed472);throw _0x5ed472;});}return _0xabf0c3;})[_0x101c('0x24')](respondWithResult(_0x89893a,null))['catch'](handleError(_0x89893a,null));});_0x370e63[_0x101c('0x7d')]();}catch(_0x3fe3c5){_0x89893a['status'](0x1f4)[_0x101c('0x2d')](_0x3fe3c5);}};exports[_0x101c('0x23')]=function(_0x5412d8,_0x49cf21,_0xe01c4a){return db[_0x101c('0x30')][_0x101c('0x4b')]({'where':{'id':_0x5412d8[_0x101c('0x48')]['id']}})['then'](handleEntityNotFound(_0x49cf21,null))[_0x101c('0x24')](saveUpdates(_['pick'](_0x5412d8[_0x101c('0x77')],[_0x101c('0x2c'),'description']),null))[_0x101c('0x24')](respondWithResult(_0x49cf21,null))['catch'](handleError(_0x49cf21,null));};exports['delete']=function(_0x27f5e4,_0x222cd7,_0x4f85d4){return db['Sound']['find']({'where':{'id':_0x27f5e4['params']['id']}})[_0x101c('0x24')](function(_0x313301){if(_0x313301){return _0x313301[_0x101c('0x25')]();}})[_0x101c('0x24')](function(_0x6cfd5d){var _0xa8a98=path[_0x101c('0x53')](config['root'],_0x101c('0x5e'),util[_0x101c('0x55')](_0x101c('0x56'),_0x6cfd5d[_0x101c('0x4d')],_0x6cfd5d[_0x101c('0x7e')]));var _0x355102=path['join'](config[_0x101c('0x54')],_0x101c('0x50'),util['format']('%s.%s',_0x6cfd5d['save_name'],_0x6cfd5d[_0x101c('0x4e')]));fs['unlinkSync'](_0xa8a98);fs[_0x101c('0x64')](_0x355102);return _0x6cfd5d;})[_0x101c('0x24')](function(_0x57a8a7){if(_0x57a8a7){return _0x222cd7[_0x101c('0x17')](0xcc)['end']();}})[_0x101c('0x24')](handleEntityNotFound(_0x222cd7,null))[_0x101c('0x47')](handleError(_0x222cd7,null));}; \ No newline at end of file +var _0x0faf=['rawAttributes','includeAll','find','catch','save_name','join','root','server/files/sounds/converted','converted_format','ValidationError','Sound\x20not\x20found','download','format','basename','file','originalname','filename','substring','wav','info','chmodSync','transcode','unlinkSync','src','original_duration','duration','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','0777','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','delete','server/files/sounds/original','%s.%s','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','UserProfileResource','error','name','send','Sound','fieldName','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','filter','options','include','findAll','rows','show','params','keys'];(function(_0xcf5d4f,_0x2b4ed1){var _0x3a9d1a=function(_0x46c4ae){while(--_0x46c4ae){_0xcf5d4f['push'](_0xcf5d4f['shift']());}};_0x3a9d1a(++_0x2b4ed1);}(_0x0faf,0xb0));var _0xf0fa=function(_0x474035,_0x41e639){_0x474035=_0x474035-0x0;var _0x1b58e0=_0x0faf[_0x474035];return _0x1b58e0;};'use strict';var emlformat=require(_0xf0fa('0x0'));var rimraf=require(_0xf0fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf0fa('0x2'));var moment=require(_0xf0fa('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf0fa('0x4'));var util=require(_0xf0fa('0x5'));var path=require(_0xf0fa('0x6'));var sox=require(_0xf0fa('0x7'));var csv=require(_0xf0fa('0x8'));var ejs=require(_0xf0fa('0x9'));var fs=require('fs');var fs_extra=require(_0xf0fa('0xa'));var _=require(_0xf0fa('0xb'));var squel=require('squel');var crypto=require(_0xf0fa('0xc'));var jsforce=require(_0xf0fa('0xd'));var deskjs=require(_0xf0fa('0xe'));var toCsv=require(_0xf0fa('0x8'));var querystring=require('querystring');var Papa=require(_0xf0fa('0xf'));var Redis=require(_0xf0fa('0x10'));var authService=require(_0xf0fa('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf0fa('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf0fa('0x13'));var utils=require(_0xf0fa('0x14'));var config=require(_0xf0fa('0x15'));var licenseUtil=require(_0xf0fa('0x16'));var db=require(_0xf0fa('0x17'))['db'];function respondWithStatusCode(_0x5dfba0,_0x23d09d){_0x23d09d=_0x23d09d||0xcc;return function(_0x552893){if(_0x552893){return _0x5dfba0[_0xf0fa('0x18')](_0x23d09d);}return _0x5dfba0[_0xf0fa('0x19')](_0x23d09d)[_0xf0fa('0x1a')]();};}function respondWithResult(_0x531eca,_0x562bc3){_0x562bc3=_0x562bc3||0xc8;return function(_0x316ee6){if(_0x316ee6){return _0x531eca[_0xf0fa('0x19')](_0x562bc3)[_0xf0fa('0x1b')](_0x316ee6);}};}function respondWithFilteredResult(_0x51c308,_0x544786){return function(_0x5b883c){if(_0x5b883c){var _0x23c563=typeof _0x544786[_0xf0fa('0x1c')]===_0xf0fa('0x1d')&&typeof _0x544786[_0xf0fa('0x1e')]===_0xf0fa('0x1d');var _0x21f520=_0x5b883c[_0xf0fa('0x1f')];var _0x1064e4=_0x23c563?0x0:_0x544786[_0xf0fa('0x1c')];var _0x73bf7f=_0x23c563?_0x5b883c[_0xf0fa('0x1f')]:_0x544786['offset']+_0x544786[_0xf0fa('0x1e')];var _0x430425;if(_0x73bf7f>=_0x21f520){_0x73bf7f=_0x21f520;_0x430425=0xc8;}else{_0x430425=0xce;}_0x51c308['status'](_0x430425);return _0x51c308[_0xf0fa('0x20')](_0xf0fa('0x21'),_0x1064e4+'-'+_0x73bf7f+'/'+_0x21f520)['json'](_0x5b883c);}return null;};}function patchUpdates(_0x45e613){return function(_0x5ad9fc){try{jsonpatch[_0xf0fa('0x22')](_0x5ad9fc,_0x45e613,!![]);}catch(_0x1fe4d9){return BPromise['reject'](_0x1fe4d9);}return _0x5ad9fc[_0xf0fa('0x23')]();};}function saveUpdates(_0x5aa3d9,_0x1686a2){return function(_0x3e2520){if(_0x3e2520){return _0x3e2520['update'](_0x5aa3d9)[_0xf0fa('0x24')](function(_0x3fc369){return _0x3fc369;});}return null;};}function removeEntity(_0x130c9f,_0x1e1087){return function(_0x198762){if(_0x198762){return _0x198762[_0xf0fa('0x25')]()['then'](function(){var _0x5a6f82=_0x198762[_0xf0fa('0x26')]({'plain':!![]});var _0xa732e4='Sounds';return db[_0xf0fa('0x27')]['destroy']({'where':{'type':_0xa732e4,'resourceId':_0x5a6f82['id']}})['then'](function(){return _0x198762;});})[_0xf0fa('0x24')](function(){_0x130c9f['status'](0xcc)[_0xf0fa('0x1a')]();});}};}function handleEntityNotFound(_0x36fd04,_0x21decd){return function(_0x299695){if(!_0x299695){_0x36fd04[_0xf0fa('0x18')](0x194);}return _0x299695;};}function handleError(_0x5c72f3,_0x5e2387){_0x5e2387=_0x5e2387||0x1f4;return function(_0x2bbc3b){logger[_0xf0fa('0x28')](_0x2bbc3b['stack']);if(_0x2bbc3b['name']){delete _0x2bbc3b[_0xf0fa('0x29')];}_0x5c72f3[_0xf0fa('0x19')](_0x5e2387)[_0xf0fa('0x2a')](_0x2bbc3b);};}exports['index']=function(_0x4d70a9,_0x349eed){var _0xfb8387={},_0xfc455c={},_0x378f50={'count':0x0,'rows':[]};var _0x384787=_['map'](db[_0xf0fa('0x2b')]['rawAttributes'],function(_0x362d80){return{'name':_0x362d80[_0xf0fa('0x2c')],'type':_0x362d80['type'][_0xf0fa('0x2d')]};});_0xfc455c[_0xf0fa('0x2e')]=_[_0xf0fa('0x2f')](_0x384787,_0xf0fa('0x29'));_0xfc455c[_0xf0fa('0x30')]=_['keys'](_0x4d70a9[_0xf0fa('0x30')]);_0xfc455c['filters']=_['intersection'](_0xfc455c[_0xf0fa('0x2e')],_0xfc455c[_0xf0fa('0x30')]);_0xfb8387[_0xf0fa('0x31')]=_[_0xf0fa('0x32')](_0xfc455c[_0xf0fa('0x2e')],qs['fields'](_0x4d70a9[_0xf0fa('0x30')][_0xf0fa('0x33')]));_0xfb8387[_0xf0fa('0x31')]=_0xfb8387[_0xf0fa('0x31')][_0xf0fa('0x34')]?_0xfb8387[_0xf0fa('0x31')]:_0xfc455c[_0xf0fa('0x2e')];if(!_0x4d70a9['query'][_0xf0fa('0x35')](_0xf0fa('0x36'))){_0xfb8387[_0xf0fa('0x1e')]=qs[_0xf0fa('0x1e')](_0x4d70a9[_0xf0fa('0x30')][_0xf0fa('0x1e')]);_0xfb8387[_0xf0fa('0x1c')]=qs[_0xf0fa('0x1c')](_0x4d70a9[_0xf0fa('0x30')][_0xf0fa('0x1c')]);}_0xfb8387[_0xf0fa('0x37')]=qs[_0xf0fa('0x38')](_0x4d70a9[_0xf0fa('0x30')]['sort']);_0xfb8387['where']=qs[_0xf0fa('0x39')](_[_0xf0fa('0x3a')](_0x4d70a9['query'],_0xfc455c['filters']),_0x384787);if(_0x4d70a9[_0xf0fa('0x30')]['filter']){_0xfb8387[_0xf0fa('0x3b')]=_[_0xf0fa('0x3c')](_0xfb8387[_0xf0fa('0x3b')],{'$or':_[_0xf0fa('0x2f')](_0x384787,function(_0x2077fe){if(_0x2077fe[_0xf0fa('0x3d')]!=='VIRTUAL'){var _0x1e5f64={};_0x1e5f64[_0x2077fe[_0xf0fa('0x29')]]={'$like':'%'+_0x4d70a9[_0xf0fa('0x30')][_0xf0fa('0x3e')]+'%'};return _0x1e5f64;}})});}_0xfb8387=_['merge']({},_0xfb8387,_0x4d70a9[_0xf0fa('0x3f')]);var _0x34b1d2={'where':_0xfb8387['where']};return db[_0xf0fa('0x2b')][_0xf0fa('0x1f')](_0x34b1d2)[_0xf0fa('0x24')](function(_0xbbf6c4){_0x378f50[_0xf0fa('0x1f')]=_0xbbf6c4;if(_0x4d70a9[_0xf0fa('0x30')]['includeAll']){_0xfb8387[_0xf0fa('0x40')]=[{'all':!![]}];}return db['Sound'][_0xf0fa('0x41')](_0xfb8387);})[_0xf0fa('0x24')](function(_0x14be99){_0x378f50[_0xf0fa('0x42')]=_0x14be99;return _0x378f50;})[_0xf0fa('0x24')](respondWithFilteredResult(_0x349eed,_0xfb8387))['catch'](handleError(_0x349eed,null));};exports[_0xf0fa('0x43')]=function(_0x2c0a3c,_0x5bf16c){var _0x1dd946={'raw':!![],'where':{'id':_0x2c0a3c[_0xf0fa('0x44')]['id']}},_0x1b3c16={};_0x1b3c16[_0xf0fa('0x2e')]=_[_0xf0fa('0x45')](db[_0xf0fa('0x2b')][_0xf0fa('0x46')]);_0x1b3c16[_0xf0fa('0x30')]=_['keys'](_0x2c0a3c[_0xf0fa('0x30')]);_0x1b3c16['filters']=_[_0xf0fa('0x32')](_0x1b3c16[_0xf0fa('0x2e')],_0x1b3c16['query']);_0x1dd946[_0xf0fa('0x31')]=_['intersection'](_0x1b3c16[_0xf0fa('0x2e')],qs[_0xf0fa('0x33')](_0x2c0a3c[_0xf0fa('0x30')]['fields']));_0x1dd946[_0xf0fa('0x31')]=_0x1dd946[_0xf0fa('0x31')][_0xf0fa('0x34')]?_0x1dd946[_0xf0fa('0x31')]:_0x1b3c16['model'];if(_0x2c0a3c[_0xf0fa('0x30')][_0xf0fa('0x47')]){_0x1dd946[_0xf0fa('0x40')]=[{'all':!![]}];}_0x1dd946=_[_0xf0fa('0x3c')]({},_0x1dd946,_0x2c0a3c[_0xf0fa('0x3f')]);return db[_0xf0fa('0x2b')][_0xf0fa('0x48')](_0x1dd946)[_0xf0fa('0x24')](handleEntityNotFound(_0x5bf16c,null))[_0xf0fa('0x24')](respondWithResult(_0x5bf16c,null))[_0xf0fa('0x49')](handleError(_0x5bf16c,null));};exports['download']=function(_0x4d0ae2,_0x4e72bb,_0x1eae77){return db[_0xf0fa('0x2b')]['find']({'where':{'id':_0x4d0ae2[_0xf0fa('0x44')]['id']},'attributes':[_0xf0fa('0x29'),_0xf0fa('0x4a'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x4e72bb,null))[_0xf0fa('0x24')](function(_0x2766bd){if(_0x2766bd){if(!fs['existsSync'](path[_0xf0fa('0x4b')](config[_0xf0fa('0x4c')],_0xf0fa('0x4d'),_0x2766bd[_0xf0fa('0x4a')]+'.'+_0x2766bd[_0xf0fa('0x4e')]))){throw new db['Sequelize'][(_0xf0fa('0x4f'))](_0xf0fa('0x50'));}return _0x4e72bb[_0xf0fa('0x51')](path['join'](config[_0xf0fa('0x4c')],_0xf0fa('0x4d'),util[_0xf0fa('0x52')]('%s.%s',_0x2766bd[_0xf0fa('0x4a')],_0x2766bd[_0xf0fa('0x4e')])),util[_0xf0fa('0x52')]('%s.%s',_0x2766bd[_0xf0fa('0x29')],_0x2766bd['converted_format']));}return null;})['catch'](handleError(_0x4e72bb,null));};exports['create']=function(_0x1155ab,_0xe190c3,_0x191bb1){var _0x3f6831={'name':path[_0xf0fa('0x53')](_0x1155ab[_0xf0fa('0x54')][_0xf0fa('0x55')],path['extname'](_0x1155ab[_0xf0fa('0x54')]['originalname'])),'save_name':path[_0xf0fa('0x53')](_0x1155ab['file'][_0xf0fa('0x56')],path['extname'](_0x1155ab[_0xf0fa('0x54')][_0xf0fa('0x56')])),'original_format':path['extname'](_0x1155ab['file'][_0xf0fa('0x55')])[_0xf0fa('0x57')](0x1),'converted_format':_0xf0fa('0x58')};var _0x56282c=path[_0xf0fa('0x4b')](config[_0xf0fa('0x4c')],'server/files/sounds/original',_0x1155ab[_0xf0fa('0x54')][_0xf0fa('0x56')]);var _0x19254a=path['join'](config[_0xf0fa('0x4c')],_0xf0fa('0x4d'),util[_0xf0fa('0x52')]('%s.%s',path[_0xf0fa('0x53')](_0x1155ab['file'][_0xf0fa('0x56')],path['extname'](_0x1155ab[_0xf0fa('0x54')]['filename'])),_0x3f6831[_0xf0fa('0x4e')]));logger[_0xf0fa('0x59')]('Sound\x20upload\x20filepath:\x20%s',_0x56282c);logger[_0xf0fa('0x59')]('Sound\x20upload\x20destination:\x20%s',_0x19254a);try{fs[_0xf0fa('0x5a')](_0x56282c,parseInt('0777',0x8));var _0xe263d3=sox[_0xf0fa('0x5b')](_0x56282c,_0x19254a,{'sampleRate':0x1f40,'format':_0xf0fa('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xe263d3['on'](_0xf0fa('0x28'),function(_0x36deaa){fs[_0xf0fa('0x5c')](_0x56282c);_0xe190c3['status'](0x1f4)['send'](_0x36deaa);});_0xe263d3['on'](_0xf0fa('0x5d'),function(_0x33f99b){_0x3f6831[_0xf0fa('0x5e')]=isNaN(_0x33f99b[_0xf0fa('0x5f')])?null:_0x33f99b[_0xf0fa('0x5f')]*0x3e8;_0x3f6831['original_sampleCount']=isNaN(_0x33f99b[_0xf0fa('0x60')])?null:_0x33f99b[_0xf0fa('0x60')];_0x3f6831['original_channelCount']=isNaN(_0x33f99b[_0xf0fa('0x61')])?null:_0x33f99b[_0xf0fa('0x61')];_0x3f6831[_0xf0fa('0x62')]=isNaN(_0x33f99b['bitRate'])?null:_0x33f99b[_0xf0fa('0x63')];_0x3f6831[_0xf0fa('0x64')]=isNaN(_0x33f99b[_0xf0fa('0x65')])?null:_0x33f99b[_0xf0fa('0x65')];});_0xe263d3['on'](_0xf0fa('0x66'),function(_0x847b5c){_0x3f6831[_0xf0fa('0x67')]=isNaN(_0x847b5c[_0xf0fa('0x5f')])?null:_0x847b5c[_0xf0fa('0x5f')]*0x3e8;_0x3f6831[_0xf0fa('0x68')]=isNaN(_0x847b5c[_0xf0fa('0x60')])?null:_0x847b5c[_0xf0fa('0x60')];_0x3f6831['converted_channelCount']=isNaN(_0x847b5c[_0xf0fa('0x61')])?null:_0x847b5c[_0xf0fa('0x61')];_0x3f6831[_0xf0fa('0x69')]=isNaN(_0x847b5c[_0xf0fa('0x63')])?null:_0x847b5c['bitRate'];_0x3f6831[_0xf0fa('0x6a')]=isNaN(_0x847b5c['sampleRate'])?null:_0x847b5c[_0xf0fa('0x65')];});_0xe263d3['on']('end',function(){fs['chmodSync'](_0x19254a,parseInt(_0xf0fa('0x6b'),0x8));return db[_0xf0fa('0x2b')][_0xf0fa('0x6c')](_0x3f6831)[_0xf0fa('0x24')](function(_0x2f8930){var _0x29d896={'role':_0x1155ab[_0xf0fa('0x6d')]['role'],'userProfileId':_0x1155ab['body'][_0xf0fa('0x6e')]};if(!_0x29d896)throw new Error(_0xf0fa('0x6f'));if(_0x29d896[_0xf0fa('0x70')]===_0xf0fa('0x71')){var _0x24bc67=_0x2f8930[_0xf0fa('0x26')]({'plain':!![]});return db[_0xf0fa('0x72')]['find']({'where':{'name':_0xf0fa('0x73'),'userProfileId':_0x29d896[_0xf0fa('0x6e')]},'raw':!![]})[_0xf0fa('0x24')](function(_0x51a17d){if(_0x51a17d&&_0x51a17d[_0xf0fa('0x74')]===0x0){return db['UserProfileResource'][_0xf0fa('0x6c')]({'name':_0x24bc67['name'],'resourceId':_0x24bc67['id'],'type':_0x51a17d['name'],'sectionId':_0x51a17d['id']},{})['then'](function(){return _0x2f8930;});}else{return _0x2f8930;}})['catch'](function(_0x16b528){logger['error'](_0xf0fa('0x75'),_0x16b528);throw _0x16b528;});}return _0x2f8930;})[_0xf0fa('0x24')](respondWithResult(_0xe190c3,null))[_0xf0fa('0x49')](handleError(_0xe190c3,null));});_0xe263d3[_0xf0fa('0x76')]();}catch(_0x242f8f){_0xe190c3['status'](0x1f4)[_0xf0fa('0x2a')](_0x242f8f);}};exports[_0xf0fa('0x77')]=function(_0x3fbaf2,_0x26e925,_0x120fdd){return db[_0xf0fa('0x2b')]['find']({'where':{'id':_0x3fbaf2[_0xf0fa('0x44')]['id']}})[_0xf0fa('0x24')](handleEntityNotFound(_0x26e925,null))['then'](saveUpdates(_[_0xf0fa('0x3a')](_0x3fbaf2[_0xf0fa('0x6d')],['name','description']),null))[_0xf0fa('0x24')](respondWithResult(_0x26e925,null))[_0xf0fa('0x49')](handleError(_0x26e925,null));};exports[_0xf0fa('0x78')]=function(_0x4bcf78,_0x31c0aa,_0x22ead5){return db['Sound'][_0xf0fa('0x48')]({'where':{'id':_0x4bcf78['params']['id']}})[_0xf0fa('0x24')](function(_0x1fde29){if(_0x1fde29){return _0x1fde29[_0xf0fa('0x25')]();}})[_0xf0fa('0x24')](function(_0x2d2799){var _0x1bcade=path[_0xf0fa('0x4b')](config[_0xf0fa('0x4c')],_0xf0fa('0x79'),util[_0xf0fa('0x52')]('%s.%s',_0x2d2799[_0xf0fa('0x4a')],_0x2d2799['original_format']));var _0x1f219e=path[_0xf0fa('0x4b')](config[_0xf0fa('0x4c')],_0xf0fa('0x4d'),util[_0xf0fa('0x52')](_0xf0fa('0x7a'),_0x2d2799[_0xf0fa('0x4a')],_0x2d2799[_0xf0fa('0x4e')]));fs['unlinkSync'](_0x1bcade);fs[_0xf0fa('0x5c')](_0x1f219e);return _0x2d2799;})[_0xf0fa('0x24')](function(_0xbf0430){if(_0xbf0430){return _0x31c0aa[_0xf0fa('0x19')](0xcc)[_0xf0fa('0x1a')]();}})[_0xf0fa('0x24')](handleEntityNotFound(_0x31c0aa,null))[_0xf0fa('0x49')](handleError(_0x31c0aa,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index a6191e4..f9771c7 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 _0xc8cf=['moment','request-promise','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','util','../../config/logger'];(function(_0xf7ed4b,_0x4e4717){var _0x28550d=function(_0x31ea47){while(--_0x31ea47){_0xf7ed4b['push'](_0xf7ed4b['shift']());}};_0x28550d(++_0x4e4717);}(_0xc8cf,0x127));var _0xfc8c=function(_0x3be3a2,_0x15b39b){_0x3be3a2=_0x3be3a2-0x0;var _0x585929=_0xc8cf[_0x3be3a2];return _0x585929;};'use strict';var _=require('lodash');var util=require(_0xfc8c('0x0'));var logger=require(_0xfc8c('0x1'))('api');var moment=require(_0xfc8c('0x2'));var BPromise=require('bluebird');var rp=require(_0xfc8c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc8c('0x4'));var config=require(_0xfc8c('0x5'));var attributes=require(_0xfc8c('0x6'));module[_0xfc8c('0x7')]=function(_0x4eeb17,_0x3dc230){return _0x4eeb17[_0xfc8c('0x8')](_0xfc8c('0x9'),attributes,{'tableName':_0xfc8c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a5e=['exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api','bluebird','request-promise','path','./sound.attributes'];(function(_0x406d10,_0x2064f8){var _0x40e684=function(_0x1b9bd6){while(--_0x1b9bd6){_0x406d10['push'](_0x406d10['shift']());}};_0x40e684(++_0x2064f8);}(_0x7a5e,0xac));var _0xe7a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a5e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe7a5('0x0'));var util=require(_0xe7a5('0x1'));var logger=require(_0xe7a5('0x2'))(_0xe7a5('0x3'));var moment=require('moment');var BPromise=require(_0xe7a5('0x4'));var rp=require(_0xe7a5('0x5'));var fs=require('fs');var path=require(_0xe7a5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe7a5('0x7'));module[_0xe7a5('0x8')]=function(_0x2a87d1,_0x1cb360){return _0x2a87d1[_0xe7a5('0x9')](_0xe7a5('0xa'),attributes,{'tableName':_0xe7a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 1bcb406..fdb2de4 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 _0x0eb7=['options','raw','where','attributes','include','map','model','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSound','Sound','find'];(function(_0x58523e,_0x18730f){var _0x375d0b=function(_0x52c756){while(--_0x52c756){_0x58523e['push'](_0x58523e['shift']());}};_0x375d0b(++_0x18730f);}(_0x0eb7,0x187));var _0x70eb=function(_0xb71e6b,_0x3b4ea5){_0xb71e6b=_0xb71e6b-0x0;var _0x414196=_0x0eb7[_0xb71e6b];return _0x414196;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x70eb('0x0'));var BPromise=require(_0x70eb('0x1'));var rs=require(_0x70eb('0x2'));var fs=require('fs');var Redis=require(_0x70eb('0x3'));var db=require(_0x70eb('0x4'))['db'];var utils=require(_0x70eb('0x5'));var logger=require(_0x70eb('0x6'))(_0x70eb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x70eb('0x8')][_0x70eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13d8c3,_0x30ae5e,_0x27b807){return new BPromise(function(_0x3a3903,_0x5ed0ab){return client[_0x70eb('0xa')](_0x13d8c3,_0x27b807)[_0x70eb('0xb')](function(_0x4f3cfc){logger[_0x70eb('0xc')](_0x70eb('0xd'),_0x30ae5e,_0x70eb('0xe'));logger[_0x70eb('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x30ae5e,_0x70eb('0xe'),JSON[_0x70eb('0x10')](_0x4f3cfc));if(_0x4f3cfc[_0x70eb('0x11')]){if(_0x4f3cfc['error'][_0x70eb('0x12')]===0x1f4){logger[_0x70eb('0x11')](_0x70eb('0xd'),_0x30ae5e,_0x4f3cfc[_0x70eb('0x11')][_0x70eb('0x13')]);return _0x5ed0ab(_0x4f3cfc[_0x70eb('0x11')][_0x70eb('0x13')]);}logger['error'](_0x70eb('0xd'),_0x30ae5e,_0x4f3cfc[_0x70eb('0x11')][_0x70eb('0x13')]);return _0x3a3903(_0x4f3cfc[_0x70eb('0x11')]['message']);}else{logger[_0x70eb('0xc')](_0x70eb('0xd'),_0x30ae5e,'request\x20sent');_0x3a3903(_0x4f3cfc[_0x70eb('0x14')]['message']);}})[_0x70eb('0x15')](function(_0x1069ad){logger[_0x70eb('0x11')](_0x70eb('0xd'),_0x30ae5e,_0x1069ad);_0x5ed0ab(_0x1069ad);});});}exports[_0x70eb('0x16')]=function(_0x3e3e76){var _0x4f71f6=this;return new Promise(function(_0x4bd7a1,_0x35692c){return db[_0x70eb('0x17')][_0x70eb('0x18')]({'raw':_0x3e3e76[_0x70eb('0x19')]?_0x3e3e76[_0x70eb('0x19')][_0x70eb('0x1a')]===undefined?!![]:![]:!![],'where':_0x3e3e76[_0x70eb('0x19')]?_0x3e3e76[_0x70eb('0x19')][_0x70eb('0x1b')]||null:null,'attributes':_0x3e3e76[_0x70eb('0x19')]?_0x3e3e76[_0x70eb('0x19')][_0x70eb('0x1c')]||null:null,'include':_0x3e3e76[_0x70eb('0x19')]?_0x3e3e76['options'][_0x70eb('0x1d')]?_[_0x70eb('0x1e')](_0x3e3e76['options']['include'],function(_0x351c40){return{'model':db[_0x351c40[_0x70eb('0x1f')]],'as':_0x351c40['as'],'attributes':_0x351c40['attributes'],'include':_0x351c40[_0x70eb('0x1d')]?_[_0x70eb('0x1e')](_0x351c40[_0x70eb('0x1d')],function(_0x5046b4){return{'model':db[_0x5046b4[_0x70eb('0x1f')]],'as':_0x5046b4['as'],'attributes':_0x5046b4[_0x70eb('0x1c')],'include':_0x5046b4['include']?_[_0x70eb('0x1e')](_0x5046b4[_0x70eb('0x1d')],function(_0x6af5a2){return{'model':db[_0x6af5a2['model']],'as':_0x6af5a2['as'],'attributes':_0x6af5a2[_0x70eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x70eb('0xb')](function(_0xfb0d1c){logger[_0x70eb('0xc')](_0x70eb('0x16'),_0x3e3e76);logger[_0x70eb('0xf')]('ShowSound',_0x3e3e76,JSON[_0x70eb('0x10')](_0xfb0d1c));_0x4bd7a1(_0xfb0d1c);})[_0x70eb('0x15')](function(_0x5ba6bc){logger[_0x70eb('0x11')]('ShowSound',_0x5ba6bc[_0x70eb('0x13')],_0x3e3e76);_0x35692c(_0x4f71f6[_0x70eb('0x11')](0x1f4,_0x5ba6bc['message']));});});}; \ No newline at end of file +var _0xfb15=['../../config/environment','client','http','request','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowSound','Sound','options','raw','where','include','attributes','map','model','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x176539,_0x24dd37){var _0x439468=function(_0x2a5d15){while(--_0x2a5d15){_0x176539['push'](_0x176539['shift']());}};_0x439468(++_0x24dd37);}(_0xfb15,0x75));var _0x5fb1=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xfb15[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x5fb1('0x0'));var moment=require('moment');var BPromise=require(_0x5fb1('0x1'));var rs=require(_0x5fb1('0x2'));var fs=require('fs');var Redis=require(_0x5fb1('0x3'));var db=require(_0x5fb1('0x4'))['db'];var utils=require(_0x5fb1('0x5'));var logger=require(_0x5fb1('0x6'))('rpc');var config=require(_0x5fb1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5fb1('0x8')][_0x5fb1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13932e,_0x19e21b,_0x371a2d){return new BPromise(function(_0x673e0f,_0x925208){return client[_0x5fb1('0xa')](_0x13932e,_0x371a2d)[_0x5fb1('0xb')](function(_0x10dd25){logger[_0x5fb1('0xc')](_0x5fb1('0xd'),_0x19e21b,'request\x20sent');logger[_0x5fb1('0xe')](_0x5fb1('0xf'),_0x19e21b,_0x5fb1('0x10'),JSON[_0x5fb1('0x11')](_0x10dd25));if(_0x10dd25[_0x5fb1('0x12')]){if(_0x10dd25[_0x5fb1('0x12')]['code']===0x1f4){logger[_0x5fb1('0x12')]('Sound,\x20%s,\x20%s',_0x19e21b,_0x10dd25[_0x5fb1('0x12')][_0x5fb1('0x13')]);return _0x925208(_0x10dd25[_0x5fb1('0x12')][_0x5fb1('0x13')]);}logger[_0x5fb1('0x12')](_0x5fb1('0xd'),_0x19e21b,_0x10dd25['error']['message']);return _0x673e0f(_0x10dd25[_0x5fb1('0x12')][_0x5fb1('0x13')]);}else{logger[_0x5fb1('0xc')]('Sound,\x20%s,\x20%s',_0x19e21b,'request\x20sent');_0x673e0f(_0x10dd25[_0x5fb1('0x14')]['message']);}})['catch'](function(_0x34e150){logger[_0x5fb1('0x12')]('Sound,\x20%s,\x20%s',_0x19e21b,_0x34e150);_0x925208(_0x34e150);});});}exports[_0x5fb1('0x15')]=function(_0x5c0aa4){var _0xebb0f6=this;return new Promise(function(_0x5eca76,_0x4b39bf){return db[_0x5fb1('0x16')]['find']({'raw':_0x5c0aa4[_0x5fb1('0x17')]?_0x5c0aa4[_0x5fb1('0x17')][_0x5fb1('0x18')]===undefined?!![]:![]:!![],'where':_0x5c0aa4[_0x5fb1('0x17')]?_0x5c0aa4[_0x5fb1('0x17')][_0x5fb1('0x19')]||null:null,'attributes':_0x5c0aa4[_0x5fb1('0x17')]?_0x5c0aa4[_0x5fb1('0x17')]['attributes']||null:null,'include':_0x5c0aa4[_0x5fb1('0x17')]?_0x5c0aa4['options'][_0x5fb1('0x1a')]?_['map'](_0x5c0aa4[_0x5fb1('0x17')][_0x5fb1('0x1a')],function(_0x169bc4){return{'model':db[_0x169bc4['model']],'as':_0x169bc4['as'],'attributes':_0x169bc4[_0x5fb1('0x1b')],'include':_0x169bc4[_0x5fb1('0x1a')]?_[_0x5fb1('0x1c')](_0x169bc4[_0x5fb1('0x1a')],function(_0x772998){return{'model':db[_0x772998[_0x5fb1('0x1d')]],'as':_0x772998['as'],'attributes':_0x772998[_0x5fb1('0x1b')],'include':_0x772998[_0x5fb1('0x1a')]?_[_0x5fb1('0x1c')](_0x772998['include'],function(_0x372d08){return{'model':db[_0x372d08[_0x5fb1('0x1d')]],'as':_0x372d08['as'],'attributes':_0x372d08[_0x5fb1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5fb1('0xb')](function(_0x44bd23){logger[_0x5fb1('0xc')](_0x5fb1('0x15'),_0x5c0aa4);logger[_0x5fb1('0xe')](_0x5fb1('0x15'),_0x5c0aa4,JSON['stringify'](_0x44bd23));_0x5eca76(_0x44bd23);})[_0x5fb1('0x1e')](function(_0x3b23c4){logger['error']('ShowSound',_0x3b23c4['message'],_0x5c0aa4);_0x4b39bf(_0xebb0f6[_0x5fb1('0x12')](0x1f4,_0x3b23c4[_0x5fb1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index c509983..cad7e7a 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 _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x218e9b,_0x2042b0){var _0x38a91f=function(_0x2f9b11){while(--_0x2f9b11){_0x218e9b['push'](_0x218e9b['shift']());}};_0x38a91f(++_0x2042b0);}(_0xb7e7,0x121));var _0x7b7e=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xb7e7[_0x424a9a];return _0xa7831c;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file +var _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x441ea2,_0x19bbaa){var _0x316bea=function(_0x3e48e3){while(--_0x3e48e3){_0x441ea2['push'](_0x441ea2['shift']());}};_0x316bea(++_0x19bbaa);}(_0x5eb8,0xb0));var _0x85eb=function(_0xf7f60a,_0x15f736){_0xf7f60a=_0xf7f60a-0x0;var _0x2567ad=_0x5eb8[_0xf7f60a];return _0x2567ad;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 9d741f1..b2ad3d2 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 _0x17d2=['STRING','TEXT','medium','ENUM','out','sequelize'];(function(_0x34381c,_0x27741d){var _0x4d35c6=function(_0x20ae6c){while(--_0x20ae6c){_0x34381c['push'](_0x34381c['shift']());}};_0x4d35c6(++_0x27741d);}(_0x17d2,0x1bb));var _0x217d=function(_0x41582b,_0x2b6541){_0x41582b=_0x41582b-0x0;var _0x58ad4b=_0x17d2[_0x41582b];return _0x58ad4b;};'use strict';var Sequelize=require(_0x217d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x217d('0x1')]},'body':{'type':Sequelize[_0x217d('0x2')](_0x217d('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x217d('0x4')]('in',_0x217d('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x217d('0x1')]},'providerResponse':{'type':Sequelize[_0x217d('0x2')]}}; \ No newline at end of file +var _0x6638=['medium','ENUM','STRING','TEXT','sequelize','exports'];(function(_0x36198b,_0x3584d9){var _0x3c51c1=function(_0x3292dd){while(--_0x3292dd){_0x36198b['push'](_0x36198b['shift']());}};_0x3c51c1(++_0x3584d9);}(_0x6638,0x1ae));var _0x8663=function(_0x2b7355,_0x4ad54b){_0x2b7355=_0x2b7355-0x0;var _0x2ca8d3=_0x6638[_0x2b7355];return _0x2ca8d3;};'use strict';var Sequelize=require(_0x8663('0x0'));module[_0x8663('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0x8663('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x8663('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x8663('0x4')]},'providerResponse':{'type':Sequelize[_0x8663('0x5')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 664add0..f2ea447 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 _0x6635=['undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','SquareMessage','include','rows','catch','show','params','includeAll','create','body','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset'];(function(_0x3c23a4,_0x42c507){var _0x3f34b=function(_0x1e9a71){while(--_0x1e9a71){_0x3c23a4['push'](_0x3c23a4['shift']());}};_0x3f34b(++_0x42c507);}(_0x6635,0x10d));var _0x5663=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x6635[_0x486f4a];return _0x135d99;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5663('0x0'));var jsonpatch=require(_0x5663('0x1'));var rp=require(_0x5663('0x2'));var moment=require(_0x5663('0x3'));var BPromise=require(_0x5663('0x4'));var Mustache=require('mustache');var util=require(_0x5663('0x5'));var path=require(_0x5663('0x6'));var sox=require(_0x5663('0x7'));var csv=require(_0x5663('0x8'));var ejs=require(_0x5663('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5663('0xa'));var squel=require(_0x5663('0xb'));var crypto=require(_0x5663('0xc'));var jsforce=require(_0x5663('0xd'));var deskjs=require(_0x5663('0xe'));var toCsv=require(_0x5663('0x8'));var querystring=require(_0x5663('0xf'));var Papa=require(_0x5663('0x10'));var Redis=require(_0x5663('0x11'));var authService=require(_0x5663('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5663('0x13'));var hardwareService=require(_0x5663('0x14'));var logger=require(_0x5663('0x15'))(_0x5663('0x16'));var utils=require(_0x5663('0x17'));var config=require(_0x5663('0x18'));var licenseUtil=require(_0x5663('0x19'));var db=require(_0x5663('0x1a'))['db'];function respondWithStatusCode(_0x295cf8,_0x41921d){_0x41921d=_0x41921d||0xcc;return function(_0x1c01db){if(_0x1c01db){return _0x295cf8[_0x5663('0x1b')](_0x41921d);}return _0x295cf8[_0x5663('0x1c')](_0x41921d)[_0x5663('0x1d')]();};}function respondWithResult(_0x19bb8a,_0x1f2aa0){_0x1f2aa0=_0x1f2aa0||0xc8;return function(_0x473c89){if(_0x473c89){return _0x19bb8a[_0x5663('0x1c')](_0x1f2aa0)['json'](_0x473c89);}};}function respondWithFilteredResult(_0x2514e0,_0x5f16fd){return function(_0xc02d5a){if(_0xc02d5a){var _0x2b8e77=typeof _0x5f16fd[_0x5663('0x1e')]===_0x5663('0x1f')&&typeof _0x5f16fd[_0x5663('0x20')]==='undefined';var _0x2c7b70=_0xc02d5a[_0x5663('0x21')];var _0x409bcb=_0x2b8e77?0x0:_0x5f16fd['offset'];var _0xd2677e=_0x2b8e77?_0xc02d5a[_0x5663('0x21')]:_0x5f16fd[_0x5663('0x1e')]+_0x5f16fd['limit'];var _0x1a1505;if(_0xd2677e>=_0x2c7b70){_0xd2677e=_0x2c7b70;_0x1a1505=0xc8;}else{_0x1a1505=0xce;}_0x2514e0[_0x5663('0x1c')](_0x1a1505);return _0x2514e0[_0x5663('0x22')](_0x5663('0x23'),_0x409bcb+'-'+_0xd2677e+'/'+_0x2c7b70)[_0x5663('0x24')](_0xc02d5a);}return null;};}function patchUpdates(_0x475e05){return function(_0x3b91e1){try{jsonpatch['apply'](_0x3b91e1,_0x475e05,!![]);}catch(_0xebc6dc){return BPromise[_0x5663('0x25')](_0xebc6dc);}return _0x3b91e1[_0x5663('0x26')]();};}function saveUpdates(_0x26274c,_0x5772b8){return function(_0xdced22){if(_0xdced22){return _0xdced22[_0x5663('0x27')](_0x26274c)[_0x5663('0x28')](function(_0x326da0){return _0x326da0;});}return null;};}function removeEntity(_0x114229,_0xabba00){return function(_0x172047){if(_0x172047){return _0x172047[_0x5663('0x29')]()[_0x5663('0x28')](function(){_0x114229[_0x5663('0x1c')](0xcc)[_0x5663('0x1d')]();});}};}function handleEntityNotFound(_0x19f382,_0x5c8513){return function(_0x3e7c62){if(!_0x3e7c62){_0x19f382[_0x5663('0x1b')](0x194);}return _0x3e7c62;};}function handleError(_0x2a63c5,_0x305781){_0x305781=_0x305781||0x1f4;return function(_0xdbed91){logger[_0x5663('0x2a')](_0xdbed91['stack']);if(_0xdbed91[_0x5663('0x2b')]){delete _0xdbed91[_0x5663('0x2b')];}_0x2a63c5[_0x5663('0x1c')](_0x305781)[_0x5663('0x2c')](_0xdbed91);};}exports[_0x5663('0x2d')]=function(_0x474899,_0x51c49a){var _0x27c5dd={},_0x3c427c={},_0xfaceed={'count':0x0,'rows':[]};var _0x502d6d=_[_0x5663('0x2e')](db['SquareMessage'][_0x5663('0x2f')],function(_0x17831e){return{'name':_0x17831e[_0x5663('0x30')],'type':_0x17831e[_0x5663('0x31')]['key']};});_0x3c427c['model']=_[_0x5663('0x2e')](_0x502d6d,_0x5663('0x2b'));_0x3c427c[_0x5663('0x32')]=_[_0x5663('0x33')](_0x474899['query']);_0x3c427c[_0x5663('0x34')]=_['intersection'](_0x3c427c[_0x5663('0x35')],_0x3c427c[_0x5663('0x32')]);_0x27c5dd[_0x5663('0x36')]=_[_0x5663('0x37')](_0x3c427c[_0x5663('0x35')],qs[_0x5663('0x38')](_0x474899[_0x5663('0x32')]['fields']));_0x27c5dd['attributes']=_0x27c5dd[_0x5663('0x36')]['length']?_0x27c5dd[_0x5663('0x36')]:_0x3c427c[_0x5663('0x35')];if(!_0x474899[_0x5663('0x32')]['hasOwnProperty'](_0x5663('0x39'))){_0x27c5dd[_0x5663('0x20')]=qs[_0x5663('0x20')](_0x474899['query'][_0x5663('0x20')]);_0x27c5dd[_0x5663('0x1e')]=qs[_0x5663('0x1e')](_0x474899['query']['offset']);}_0x27c5dd['order']=qs[_0x5663('0x3a')](_0x474899[_0x5663('0x32')][_0x5663('0x3a')]);_0x27c5dd['where']=qs[_0x5663('0x34')](_[_0x5663('0x3b')](_0x474899[_0x5663('0x32')],_0x3c427c[_0x5663('0x34')]),_0x502d6d);if(_0x474899['query'][_0x5663('0x3c')]){_0x27c5dd[_0x5663('0x3d')]=_[_0x5663('0x3e')](_0x27c5dd[_0x5663('0x3d')],{'$or':_['map'](_0x502d6d,function(_0x8fbea){if(_0x8fbea[_0x5663('0x31')]!==_0x5663('0x3f')){var _0x30133e={};_0x30133e[_0x8fbea[_0x5663('0x2b')]]={'$like':'%'+_0x474899[_0x5663('0x32')]['filter']+'%'};return _0x30133e;}})});}_0x27c5dd=_['merge']({},_0x27c5dd,_0x474899[_0x5663('0x40')]);var _0x437c37={'where':_0x27c5dd[_0x5663('0x3d')]};return db[_0x5663('0x41')]['count'](_0x437c37)[_0x5663('0x28')](function(_0x71139c){_0xfaceed['count']=_0x71139c;if(_0x474899[_0x5663('0x32')]['includeAll']){_0x27c5dd[_0x5663('0x42')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x27c5dd);})[_0x5663('0x28')](function(_0x3b4c21){_0xfaceed[_0x5663('0x43')]=_0x3b4c21;return _0xfaceed;})['then'](respondWithFilteredResult(_0x51c49a,_0x27c5dd))[_0x5663('0x44')](handleError(_0x51c49a,null));};exports[_0x5663('0x45')]=function(_0x405d3b,_0x181331){var _0x3764ab={'raw':!![],'where':{'id':_0x405d3b[_0x5663('0x46')]['id']}},_0x207678={};_0x207678[_0x5663('0x35')]=_[_0x5663('0x33')](db[_0x5663('0x41')][_0x5663('0x2f')]);_0x207678[_0x5663('0x32')]=_[_0x5663('0x33')](_0x405d3b['query']);_0x207678[_0x5663('0x34')]=_[_0x5663('0x37')](_0x207678[_0x5663('0x35')],_0x207678[_0x5663('0x32')]);_0x3764ab['attributes']=_[_0x5663('0x37')](_0x207678[_0x5663('0x35')],qs['fields'](_0x405d3b['query']['fields']));_0x3764ab['attributes']=_0x3764ab[_0x5663('0x36')]['length']?_0x3764ab[_0x5663('0x36')]:_0x207678['model'];if(_0x405d3b['query'][_0x5663('0x47')]){_0x3764ab[_0x5663('0x42')]=[{'all':!![]}];}_0x3764ab=_[_0x5663('0x3e')]({},_0x3764ab,_0x405d3b[_0x5663('0x40')]);return db[_0x5663('0x41')]['find'](_0x3764ab)['then'](handleEntityNotFound(_0x181331,null))[_0x5663('0x28')](respondWithResult(_0x181331,null))['catch'](handleError(_0x181331,null));};exports[_0x5663('0x48')]=function(_0x7f3878,_0x2128fd){return db[_0x5663('0x41')][_0x5663('0x48')](_0x7f3878[_0x5663('0x49')],{})[_0x5663('0x28')](respondWithResult(_0x2128fd,0xc9))[_0x5663('0x44')](handleError(_0x2128fd,null));};exports[_0x5663('0x27')]=function(_0x229be4,_0x21d77d){if(_0x229be4['body']['id']){delete _0x229be4['body']['id'];}return db[_0x5663('0x41')][_0x5663('0x4a')]({'where':{'id':_0x229be4[_0x5663('0x46')]['id']}})[_0x5663('0x28')](handleEntityNotFound(_0x21d77d,null))[_0x5663('0x28')](saveUpdates(_0x229be4[_0x5663('0x49')],null))[_0x5663('0x28')](respondWithResult(_0x21d77d,null))[_0x5663('0x44')](handleError(_0x21d77d,null));};exports['destroy']=function(_0x5873e3,_0x544e04){return db[_0x5663('0x41')][_0x5663('0x4a')]({'where':{'id':_0x5873e3[_0x5663('0x46')]['id']}})[_0x5663('0x28')](handleEntityNotFound(_0x544e04,null))[_0x5663('0x28')](removeEntity(_0x544e04,null))[_0x5663('0x44')](handleError(_0x544e04,null));}; \ No newline at end of file +var _0xfaeb=['save','update','then','destroy','end','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','options','includeAll','include','findAll','show','params','SquareMessage','length','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x45dbe2,_0x3e0483){var _0x50fbdd=function(_0x5008a0){while(--_0x5008a0){_0x45dbe2['push'](_0x45dbe2['shift']());}};_0x50fbdd(++_0x3e0483);}(_0xfaeb,0x1a4));var _0xbfae=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0xfaeb[_0x30cd7e];return _0x462a02;};'use strict';var emlformat=require(_0xbfae('0x0'));var rimraf=require(_0xbfae('0x1'));var zipdir=require(_0xbfae('0x2'));var jsonpatch=require(_0xbfae('0x3'));var rp=require(_0xbfae('0x4'));var moment=require(_0xbfae('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbfae('0x6'));var util=require(_0xbfae('0x7'));var path=require(_0xbfae('0x8'));var sox=require(_0xbfae('0x9'));var csv=require(_0xbfae('0xa'));var ejs=require(_0xbfae('0xb'));var fs=require('fs');var fs_extra=require(_0xbfae('0xc'));var _=require(_0xbfae('0xd'));var squel=require(_0xbfae('0xe'));var crypto=require(_0xbfae('0xf'));var jsforce=require(_0xbfae('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbfae('0x11'));var Redis=require(_0xbfae('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xbfae('0x13'));var as=require(_0xbfae('0x14'));var hardwareService=require(_0xbfae('0x15'));var logger=require(_0xbfae('0x16'))(_0xbfae('0x17'));var utils=require(_0xbfae('0x18'));var config=require(_0xbfae('0x19'));var licenseUtil=require(_0xbfae('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c73bb,_0x485c46){_0x485c46=_0x485c46||0xcc;return function(_0x66bb25){if(_0x66bb25){return _0x3c73bb['sendStatus'](_0x485c46);}return _0x3c73bb[_0xbfae('0x1b')](_0x485c46)['end']();};}function respondWithResult(_0x17aefb,_0x2d5b1d){_0x2d5b1d=_0x2d5b1d||0xc8;return function(_0x50d10a){if(_0x50d10a){return _0x17aefb['status'](_0x2d5b1d)[_0xbfae('0x1c')](_0x50d10a);}};}function respondWithFilteredResult(_0x40cb25,_0x210b56){return function(_0x4613ac){if(_0x4613ac){var _0x4bc9dd=typeof _0x210b56[_0xbfae('0x1d')]===_0xbfae('0x1e')&&typeof _0x210b56['limit']===_0xbfae('0x1e');var _0x377251=_0x4613ac['count'];var _0x4945c7=_0x4bc9dd?0x0:_0x210b56[_0xbfae('0x1d')];var _0xd908ea=_0x4bc9dd?_0x4613ac[_0xbfae('0x1f')]:_0x210b56[_0xbfae('0x1d')]+_0x210b56[_0xbfae('0x20')];var _0xbed1f9;if(_0xd908ea>=_0x377251){_0xd908ea=_0x377251;_0xbed1f9=0xc8;}else{_0xbed1f9=0xce;}_0x40cb25[_0xbfae('0x1b')](_0xbed1f9);return _0x40cb25[_0xbfae('0x21')](_0xbfae('0x22'),_0x4945c7+'-'+_0xd908ea+'/'+_0x377251)['json'](_0x4613ac);}return null;};}function patchUpdates(_0x5ccbf4){return function(_0x54c808){try{jsonpatch[_0xbfae('0x23')](_0x54c808,_0x5ccbf4,!![]);}catch(_0x47ec45){return BPromise['reject'](_0x47ec45);}return _0x54c808[_0xbfae('0x24')]();};}function saveUpdates(_0x56c607,_0x258bcb){return function(_0x38112a){if(_0x38112a){return _0x38112a[_0xbfae('0x25')](_0x56c607)[_0xbfae('0x26')](function(_0xc7eb69){return _0xc7eb69;});}return null;};}function removeEntity(_0x1007ff,_0x2edb2f){return function(_0x119f5c){if(_0x119f5c){return _0x119f5c[_0xbfae('0x27')]()[_0xbfae('0x26')](function(){_0x1007ff[_0xbfae('0x1b')](0xcc)[_0xbfae('0x28')]();});}};}function handleEntityNotFound(_0x47c482,_0x198029){return function(_0x16af47){if(!_0x16af47){_0x47c482[_0xbfae('0x29')](0x194);}return _0x16af47;};}function handleError(_0x5a1be9,_0x444db4){_0x444db4=_0x444db4||0x1f4;return function(_0x230f21){logger[_0xbfae('0x2a')](_0x230f21['stack']);if(_0x230f21[_0xbfae('0x2b')]){delete _0x230f21['name'];}_0x5a1be9[_0xbfae('0x1b')](_0x444db4)[_0xbfae('0x2c')](_0x230f21);};}exports[_0xbfae('0x2d')]=function(_0x1d6f59,_0x22c800){var _0x4158ed={},_0x46eb68={},_0x46e525={'count':0x0,'rows':[]};var _0x5b1956=_[_0xbfae('0x2e')](db['SquareMessage'][_0xbfae('0x2f')],function(_0x29661a){return{'name':_0x29661a[_0xbfae('0x30')],'type':_0x29661a[_0xbfae('0x31')][_0xbfae('0x32')]};});_0x46eb68[_0xbfae('0x33')]=_[_0xbfae('0x2e')](_0x5b1956,_0xbfae('0x2b'));_0x46eb68[_0xbfae('0x34')]=_[_0xbfae('0x35')](_0x1d6f59[_0xbfae('0x34')]);_0x46eb68['filters']=_[_0xbfae('0x36')](_0x46eb68[_0xbfae('0x33')],_0x46eb68[_0xbfae('0x34')]);_0x4158ed['attributes']=_['intersection'](_0x46eb68[_0xbfae('0x33')],qs[_0xbfae('0x37')](_0x1d6f59[_0xbfae('0x34')]['fields']));_0x4158ed[_0xbfae('0x38')]=_0x4158ed['attributes']['length']?_0x4158ed[_0xbfae('0x38')]:_0x46eb68['model'];if(!_0x1d6f59[_0xbfae('0x34')][_0xbfae('0x39')](_0xbfae('0x3a'))){_0x4158ed[_0xbfae('0x20')]=qs[_0xbfae('0x20')](_0x1d6f59['query'][_0xbfae('0x20')]);_0x4158ed['offset']=qs[_0xbfae('0x1d')](_0x1d6f59[_0xbfae('0x34')][_0xbfae('0x1d')]);}_0x4158ed[_0xbfae('0x3b')]=qs[_0xbfae('0x3c')](_0x1d6f59[_0xbfae('0x34')]['sort']);_0x4158ed['where']=qs[_0xbfae('0x3d')](_['pick'](_0x1d6f59['query'],_0x46eb68[_0xbfae('0x3d')]),_0x5b1956);if(_0x1d6f59[_0xbfae('0x34')][_0xbfae('0x3e')]){_0x4158ed['where']=_[_0xbfae('0x3f')](_0x4158ed[_0xbfae('0x40')],{'$or':_[_0xbfae('0x2e')](_0x5b1956,function(_0x2a8e48){if(_0x2a8e48['type']!=='VIRTUAL'){var _0x4d9da3={};_0x4d9da3[_0x2a8e48[_0xbfae('0x2b')]]={'$like':'%'+_0x1d6f59['query'][_0xbfae('0x3e')]+'%'};return _0x4d9da3;}})});}_0x4158ed=_[_0xbfae('0x3f')]({},_0x4158ed,_0x1d6f59[_0xbfae('0x41')]);var _0x56728b={'where':_0x4158ed[_0xbfae('0x40')]};return db['SquareMessage'][_0xbfae('0x1f')](_0x56728b)[_0xbfae('0x26')](function(_0x300786){_0x46e525['count']=_0x300786;if(_0x1d6f59[_0xbfae('0x34')][_0xbfae('0x42')]){_0x4158ed[_0xbfae('0x43')]=[{'all':!![]}];}return db['SquareMessage'][_0xbfae('0x44')](_0x4158ed);})[_0xbfae('0x26')](function(_0x20c928){_0x46e525['rows']=_0x20c928;return _0x46e525;})[_0xbfae('0x26')](respondWithFilteredResult(_0x22c800,_0x4158ed))['catch'](handleError(_0x22c800,null));};exports[_0xbfae('0x45')]=function(_0x2c50d9,_0x49a2e7){var _0x54ae0f={'raw':!![],'where':{'id':_0x2c50d9[_0xbfae('0x46')]['id']}},_0x467b12={};_0x467b12[_0xbfae('0x33')]=_[_0xbfae('0x35')](db[_0xbfae('0x47')][_0xbfae('0x2f')]);_0x467b12[_0xbfae('0x34')]=_[_0xbfae('0x35')](_0x2c50d9[_0xbfae('0x34')]);_0x467b12['filters']=_[_0xbfae('0x36')](_0x467b12['model'],_0x467b12[_0xbfae('0x34')]);_0x54ae0f[_0xbfae('0x38')]=_[_0xbfae('0x36')](_0x467b12[_0xbfae('0x33')],qs[_0xbfae('0x37')](_0x2c50d9['query']['fields']));_0x54ae0f['attributes']=_0x54ae0f['attributes'][_0xbfae('0x48')]?_0x54ae0f[_0xbfae('0x38')]:_0x467b12[_0xbfae('0x33')];if(_0x2c50d9['query'][_0xbfae('0x42')]){_0x54ae0f[_0xbfae('0x43')]=[{'all':!![]}];}_0x54ae0f=_[_0xbfae('0x3f')]({},_0x54ae0f,_0x2c50d9[_0xbfae('0x41')]);return db[_0xbfae('0x47')]['find'](_0x54ae0f)[_0xbfae('0x26')](handleEntityNotFound(_0x49a2e7,null))[_0xbfae('0x26')](respondWithResult(_0x49a2e7,null))[_0xbfae('0x49')](handleError(_0x49a2e7,null));};exports['create']=function(_0x4bae4e,_0x456c41){return db['SquareMessage'][_0xbfae('0x4a')](_0x4bae4e[_0xbfae('0x4b')],{})[_0xbfae('0x26')](respondWithResult(_0x456c41,0xc9))[_0xbfae('0x49')](handleError(_0x456c41,null));};exports[_0xbfae('0x25')]=function(_0x1845d0,_0x1c928c){if(_0x1845d0[_0xbfae('0x4b')]['id']){delete _0x1845d0['body']['id'];}return db[_0xbfae('0x47')]['find']({'where':{'id':_0x1845d0['params']['id']}})[_0xbfae('0x26')](handleEntityNotFound(_0x1c928c,null))[_0xbfae('0x26')](saveUpdates(_0x1845d0[_0xbfae('0x4b')],null))[_0xbfae('0x26')](respondWithResult(_0x1c928c,null))[_0xbfae('0x49')](handleError(_0x1c928c,null));};exports['destroy']=function(_0x464394,_0x551def){return db[_0xbfae('0x47')]['find']({'where':{'id':_0x464394[_0xbfae('0x46')]['id']}})[_0xbfae('0x26')](handleEntityNotFound(_0x551def,null))[_0xbfae('0x26')](removeEntity(_0x551def,null))[_0xbfae('0x49')](handleError(_0x551def,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 81693a5..44801ae 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 _0xf4c3=['../../config/logger','moment','bluebird','path','exports','define','SquareMessage','square_messages'];(function(_0x472a18,_0x5a6f15){var _0x4f7084=function(_0x67cceb){while(--_0x67cceb){_0x472a18['push'](_0x472a18['shift']());}};_0x4f7084(++_0x5a6f15);}(_0xf4c3,0x88));var _0x3f4c=function(_0x2ccaaf,_0x298ca2){_0x2ccaaf=_0x2ccaaf-0x0;var _0x5d80e7=_0xf4c3[_0x2ccaaf];return _0x5d80e7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3f4c('0x0'))('api');var moment=require(_0x3f4c('0x1'));var BPromise=require(_0x3f4c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f4c('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0x3f4c('0x4')]=function(_0x45ce2d,_0x16762c){return _0x45ce2d[_0x3f4c('0x5')](_0x3f4c('0x6'),attributes,{'tableName':_0x3f4c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x936e=['./squareMessage.attributes','define','SquareMessage','square_messages','lodash','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x59b1ed,_0x48c04c){var _0x492b47=function(_0x3985dc){while(--_0x3985dc){_0x59b1ed['push'](_0x59b1ed['shift']());}};_0x492b47(++_0x48c04c);}(_0x936e,0xf4));var _0xe936=function(_0xb31b62,_0x309405){_0xb31b62=_0xb31b62-0x0;var _0x3928ed=_0x936e[_0xb31b62];return _0x3928ed;};'use strict';var _=require(_0xe936('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe936('0x1'));var moment=require('moment');var BPromise=require(_0xe936('0x2'));var rp=require(_0xe936('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe936('0x4'));var config=require(_0xe936('0x5'));var attributes=require(_0xe936('0x6'));module['exports']=function(_0x2bea84,_0x39d6b5){return _0x2bea84[_0xe936('0x7')](_0xe936('0x8'),attributes,{'tableName':_0xe936('0x9'),'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 d15d284..a96601a 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 _0xc395=['error','message','info','result','catch','CreateSquareMessage','SquareMessage','options','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code'];(function(_0x35c506,_0x18351c){var _0x4d025c=function(_0x4f8b02){while(--_0x4f8b02){_0x35c506['push'](_0x35c506['shift']());}};_0x4d025c(++_0x18351c);}(_0xc395,0x1d4));var _0x5c39=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0xc395[_0x3da832];return _0xe602f2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5c39('0x0'));var BPromise=require(_0x5c39('0x1'));var rs=require(_0x5c39('0x2'));var fs=require('fs');var Redis=require(_0x5c39('0x3'));var db=require(_0x5c39('0x4'))['db'];var utils=require(_0x5c39('0x5'));var logger=require('../../config/logger')(_0x5c39('0x6'));var config=require(_0x5c39('0x7'));var jayson=require(_0x5c39('0x8'));var client=jayson[_0x5c39('0x9')][_0x5c39('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x432643,_0x194310,_0x58ed5f){return new BPromise(function(_0x2eeb01,_0x21e9a5){return client[_0x5c39('0xb')](_0x432643,_0x58ed5f)[_0x5c39('0xc')](function(_0x520f29){logger['info'](_0x5c39('0xd'),_0x194310,_0x5c39('0xe'));logger[_0x5c39('0xf')](_0x5c39('0x10'),_0x194310,_0x5c39('0xe'),JSON['stringify'](_0x520f29));if(_0x520f29['error']){if(_0x520f29['error'][_0x5c39('0x11')]===0x1f4){logger['error'](_0x5c39('0xd'),_0x194310,_0x520f29[_0x5c39('0x12')]['message']);return _0x21e9a5(_0x520f29[_0x5c39('0x12')][_0x5c39('0x13')]);}logger[_0x5c39('0x12')](_0x5c39('0xd'),_0x194310,_0x520f29[_0x5c39('0x12')][_0x5c39('0x13')]);return _0x2eeb01(_0x520f29['error'][_0x5c39('0x13')]);}else{logger[_0x5c39('0x14')](_0x5c39('0xd'),_0x194310,_0x5c39('0xe'));_0x2eeb01(_0x520f29[_0x5c39('0x15')][_0x5c39('0x13')]);}})[_0x5c39('0x16')](function(_0x292eca){logger[_0x5c39('0x12')](_0x5c39('0xd'),_0x194310,_0x292eca);_0x21e9a5(_0x292eca);});});}exports[_0x5c39('0x17')]=function(_0x316d99){var _0x13a156=this;return new Promise(function(_0xc97464,_0x59b9b1){return db[_0x5c39('0x18')]['create'](_0x316d99['body'],{'raw':_0x316d99[_0x5c39('0x19')]?_0x316d99['options']['raw']===undefined?!![]:![]:!![]})[_0x5c39('0xc')](function(_0x3d1d3f){logger[_0x5c39('0x14')]('CreateSquareMessage',_0x316d99);logger[_0x5c39('0xf')](_0x5c39('0x17'),_0x316d99,JSON[_0x5c39('0x1a')](_0x3d1d3f));_0xc97464(_0x3d1d3f);})['catch'](function(_0x1b40a2){logger['error'](_0x5c39('0x17'),_0x1b40a2[_0x5c39('0x13')],_0x316d99);_0x59b9b1(_0x13a156[_0x5c39('0x12')](0x1f4,_0x1b40a2[_0x5c39('0x13')]));});});}; \ No newline at end of file +var _0xff03=['SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','raw','then','CreateSquareMessage','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','info'];(function(_0x4a2cc2,_0x1fbafa){var _0x3f5f5c=function(_0x1e2583){while(--_0x1e2583){_0x4a2cc2['push'](_0x4a2cc2['shift']());}};_0x3f5f5c(++_0x1fbafa);}(_0xff03,0xbe));var _0x3ff0=function(_0x207281,_0x25ea3d){_0x207281=_0x207281-0x0;var _0xfc0baa=_0xff03[_0x207281];return _0xfc0baa;};'use strict';var _=require(_0x3ff0('0x0'));var util=require(_0x3ff0('0x1'));var moment=require(_0x3ff0('0x2'));var BPromise=require(_0x3ff0('0x3'));var rs=require(_0x3ff0('0x4'));var fs=require('fs');var Redis=require(_0x3ff0('0x5'));var db=require(_0x3ff0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3ff0('0x7'))('rpc');var config=require(_0x3ff0('0x8'));var jayson=require(_0x3ff0('0x9'));var client=jayson[_0x3ff0('0xa')][_0x3ff0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28de30,_0x3decf8,_0x405d14){return new BPromise(function(_0x10d9ab,_0x4f8604){return client['request'](_0x28de30,_0x405d14)['then'](function(_0x51dd30){logger[_0x3ff0('0xc')](_0x3ff0('0xd'),_0x3decf8,_0x3ff0('0xe'));logger['debug'](_0x3ff0('0xf'),_0x3decf8,_0x3ff0('0xe'),JSON[_0x3ff0('0x10')](_0x51dd30));if(_0x51dd30[_0x3ff0('0x11')]){if(_0x51dd30[_0x3ff0('0x11')][_0x3ff0('0x12')]===0x1f4){logger['error'](_0x3ff0('0xd'),_0x3decf8,_0x51dd30[_0x3ff0('0x11')][_0x3ff0('0x13')]);return _0x4f8604(_0x51dd30[_0x3ff0('0x11')][_0x3ff0('0x13')]);}logger['error'](_0x3ff0('0xd'),_0x3decf8,_0x51dd30[_0x3ff0('0x11')][_0x3ff0('0x13')]);return _0x10d9ab(_0x51dd30[_0x3ff0('0x11')]['message']);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x3decf8,_0x3ff0('0xe'));_0x10d9ab(_0x51dd30[_0x3ff0('0x14')][_0x3ff0('0x13')]);}})[_0x3ff0('0x15')](function(_0x1c3b2c){logger[_0x3ff0('0x11')](_0x3ff0('0xd'),_0x3decf8,_0x1c3b2c);_0x4f8604(_0x1c3b2c);});});}exports['CreateSquareMessage']=function(_0x44dadb){var _0x5639b7=this;return new Promise(function(_0x540836,_0xdac3e4){return db['SquareMessage'][_0x3ff0('0x16')](_0x44dadb[_0x3ff0('0x17')],{'raw':_0x44dadb['options']?_0x44dadb[_0x3ff0('0x18')][_0x3ff0('0x19')]===undefined?!![]:![]:!![]})[_0x3ff0('0x1a')](function(_0x516602){logger[_0x3ff0('0xc')](_0x3ff0('0x1b'),_0x44dadb);logger[_0x3ff0('0x1c')]('CreateSquareMessage',_0x44dadb,JSON[_0x3ff0('0x10')](_0x516602));_0x540836(_0x516602);})['catch'](function(_0x2e020c){logger[_0x3ff0('0x11')](_0x3ff0('0x1b'),_0x2e020c[_0x3ff0('0x13')],_0x44dadb);_0xdac3e4(_0x5639b7[_0x3ff0('0x11')](0x1f4,_0x2e020c[_0x3ff0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index ff2c1cd..b577b2c 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 _0xf476=['/:id/test','test','post','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','/:id','show'];(function(_0x32da18,_0x4c6e69){var _0x4010f8=function(_0x7584e7){while(--_0x7584e7){_0x32da18['push'](_0x32da18['shift']());}};_0x4010f8(++_0x4c6e69);}(_0xf476,0x180));var _0x6f47=function(_0x491e20,_0x1163aa){_0x491e20=_0x491e20-0x0;var _0x2d19ab=_0xf476[_0x491e20];return _0x2d19ab;};'use strict';var multer=require(_0x6f47('0x0'));var util=require(_0x6f47('0x1'));var path=require(_0x6f47('0x2'));var timeout=require(_0x6f47('0x3'));var express=require(_0x6f47('0x4'));var router=express[_0x6f47('0x5')]();var fs_extra=require(_0x6f47('0x6'));var auth=require(_0x6f47('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6f47('0x8'));var controller=require(_0x6f47('0x9'));router['get']('/',auth[_0x6f47('0xa')](),controller[_0x6f47('0xb')]);router[_0x6f47('0xc')](_0x6f47('0xd'),auth[_0x6f47('0xa')](),controller[_0x6f47('0xe')]);router['get'](_0x6f47('0xf'),auth[_0x6f47('0xa')](),timeout('15s'),controller[_0x6f47('0x10')]);router[_0x6f47('0x11')]('/',auth[_0x6f47('0xa')](),controller['create']);router[_0x6f47('0x12')](_0x6f47('0xd'),auth[_0x6f47('0xa')](),controller[_0x6f47('0x13')]);router['delete'](_0x6f47('0xd'),auth[_0x6f47('0xa')](),controller['destroy']);module[_0x6f47('0x14')]=router; \ No newline at end of file +var _0xdbb3=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','create','put','update','delete','destroy','exports','multer'];(function(_0x5323f6,_0x5c3994){var _0x4e027b=function(_0x1f80bd){while(--_0x1f80bd){_0x5323f6['push'](_0x5323f6['shift']());}};_0x4e027b(++_0x5c3994);}(_0xdbb3,0x18b));var _0x3dbb=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xdbb3[_0x550d12];return _0x12103d;};'use strict';var multer=require(_0x3dbb('0x0'));var util=require(_0x3dbb('0x1'));var path=require(_0x3dbb('0x2'));var timeout=require(_0x3dbb('0x3'));var express=require('express');var router=express[_0x3dbb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3dbb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3dbb('0x6'));var controller=require(_0x3dbb('0x7'));router[_0x3dbb('0x8')]('/',auth[_0x3dbb('0x9')](),controller[_0x3dbb('0xa')]);router['get'](_0x3dbb('0xb'),auth['isAuthenticated'](),controller[_0x3dbb('0xc')]);router[_0x3dbb('0x8')](_0x3dbb('0xd'),auth[_0x3dbb('0x9')](),timeout(_0x3dbb('0xe')),controller[_0x3dbb('0xf')]);router['post']('/',auth[_0x3dbb('0x9')](),controller[_0x3dbb('0x10')]);router[_0x3dbb('0x11')](_0x3dbb('0xb'),auth[_0x3dbb('0x9')](),controller[_0x3dbb('0x12')]);router[_0x3dbb('0x13')](_0x3dbb('0xb'),auth[_0x3dbb('0x9')](),controller[_0x3dbb('0x14')]);module[_0x3dbb('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 97a1638..a98b6ed 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 _0x9fef=['exports','STRING','sequelize'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9fef,0x107));var _0xf9fe=function(_0x599798,_0x2cbe80){_0x599798=_0x599798-0x0;var _0x592116=_0x9fef[_0x599798];return _0x592116;};'use strict';var Sequelize=require(_0xf9fe('0x0'));module[_0xf9fe('0x1')]={'name':{'type':Sequelize[_0xf9fe('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xf9fe('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x342f=['sequelize','exports','STRING'];(function(_0x2f3d29,_0x150e7b){var _0x53d69d=function(_0x45f6ec){while(--_0x45f6ec){_0x2f3d29['push'](_0x2f3d29['shift']());}};_0x53d69d(++_0x150e7b);}(_0x342f,0xf3));var _0xf342=function(_0x6e5ca9,_0x581255){_0x6e5ca9=_0x6e5ca9-0x0;var _0x39ecf8=_0x342f[_0x6e5ca9];return _0x39ecf8;};'use strict';var Sequelize=require(_0xf342('0x0'));module[_0xf342('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xf342('0x2')]},'description':{'type':Sequelize[_0xf342('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 5033d79..e2834fe 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 _0xd0a5=['params','dsn','odbc','openSync','closeSync','eml-format','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','end','status','json','limit','undefined','offset','count','set','Content-Range','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','type','VIRTUAL','merge','includeAll','include','catch','show','options','create','body','user','ODBC','find','userProfileId'];(function(_0x3300ee,_0xed60a9){var _0x714154=function(_0x1229c1){while(--_0x1229c1){_0x3300ee['push'](_0x3300ee['shift']());}};_0x714154(++_0xed60a9);}(_0xd0a5,0x181));var _0x5d0a=function(_0x51160c,_0x374b59){_0x51160c=_0x51160c-0x0;var _0x15a3fb=_0xd0a5[_0x51160c];return _0x15a3fb;};'use strict';var emlformat=require(_0x5d0a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5d0a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5d0a('0x2'));var util=require('util');var path=require(_0x5d0a('0x3'));var sox=require(_0x5d0a('0x4'));var csv=require(_0x5d0a('0x5'));var ejs=require(_0x5d0a('0x6'));var fs=require('fs');var fs_extra=require(_0x5d0a('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5d0a('0x8'));var jsforce=require(_0x5d0a('0x9'));var deskjs=require(_0x5d0a('0xa'));var toCsv=require('to-csv');var querystring=require(_0x5d0a('0xb'));var Papa=require('papaparse');var Redis=require(_0x5d0a('0xc'));var authService=require(_0x5d0a('0xd'));var qs=require(_0x5d0a('0xe'));var as=require(_0x5d0a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5d0a('0x10'));var utils=require(_0x5d0a('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2cfaaa,_0x2294e4){_0x2294e4=_0x2294e4||0xcc;return function(_0x424fa4){if(_0x424fa4){return _0x2cfaaa[_0x5d0a('0x12')](_0x2294e4);}return _0x2cfaaa['status'](_0x2294e4)[_0x5d0a('0x13')]();};}function respondWithResult(_0x1cf85f,_0x502da9){_0x502da9=_0x502da9||0xc8;return function(_0x2920a0){if(_0x2920a0){return _0x1cf85f[_0x5d0a('0x14')](_0x502da9)[_0x5d0a('0x15')](_0x2920a0);}};}function respondWithFilteredResult(_0x5afe55,_0x35e371){return function(_0x2e827c){if(_0x2e827c){var _0x132ffd=typeof _0x35e371['offset']==='undefined'&&typeof _0x35e371[_0x5d0a('0x16')]===_0x5d0a('0x17');var _0x418146=_0x2e827c['count'];var _0x58ff04=_0x132ffd?0x0:_0x35e371[_0x5d0a('0x18')];var _0x33c4b7=_0x132ffd?_0x2e827c[_0x5d0a('0x19')]:_0x35e371[_0x5d0a('0x18')]+_0x35e371[_0x5d0a('0x16')];var _0x2fdfbb;if(_0x33c4b7>=_0x418146){_0x33c4b7=_0x418146;_0x2fdfbb=0xc8;}else{_0x2fdfbb=0xce;}_0x5afe55['status'](_0x2fdfbb);return _0x5afe55[_0x5d0a('0x1a')](_0x5d0a('0x1b'),_0x58ff04+'-'+_0x33c4b7+'/'+_0x418146)[_0x5d0a('0x15')](_0x2e827c);}return null;};}function patchUpdates(_0x4ad91c){return function(_0x4f00b8){try{jsonpatch['apply'](_0x4f00b8,_0x4ad91c,!![]);}catch(_0x3e9ee4){return BPromise[_0x5d0a('0x1c')](_0x3e9ee4);}return _0x4f00b8['save']();};}function saveUpdates(_0x88b67a,_0x6d0cfb){return function(_0x11fec6){if(_0x11fec6){return _0x11fec6[_0x5d0a('0x1d')](_0x88b67a)[_0x5d0a('0x1e')](function(_0x498cb7){return _0x498cb7;});}return null;};}function removeEntity(_0x42e135,_0x5d0cd0){return function(_0x3cc978){if(_0x3cc978){return _0x3cc978[_0x5d0a('0x1f')]()[_0x5d0a('0x1e')](function(){var _0x3430c0=_0x3cc978[_0x5d0a('0x20')]({'plain':!![]});var _0x2d85f2='ODBC';return db[_0x5d0a('0x21')][_0x5d0a('0x1f')]({'where':{'type':_0x2d85f2,'resourceId':_0x3430c0['id']}})[_0x5d0a('0x1e')](function(){return _0x3cc978;});})[_0x5d0a('0x1e')](function(){_0x42e135['status'](0xcc)[_0x5d0a('0x13')]();});}};}function handleEntityNotFound(_0x3af04e,_0x143cc9){return function(_0x1f5c84){if(!_0x1f5c84){_0x3af04e['sendStatus'](0x194);}return _0x1f5c84;};}function handleError(_0x345534,_0x1ccbb8){_0x1ccbb8=_0x1ccbb8||0x1f4;return function(_0x402ae5){logger[_0x5d0a('0x22')](_0x402ae5[_0x5d0a('0x23')]);if(_0x402ae5[_0x5d0a('0x24')]){delete _0x402ae5[_0x5d0a('0x24')];}_0x345534[_0x5d0a('0x14')](_0x1ccbb8)[_0x5d0a('0x25')](_0x402ae5);};}exports['index']=function(_0x2f981d,_0x4ddabb){var _0x30350d={},_0x1b81f1={},_0x17c00c={'count':0x0,'rows':[]};var _0x2a5a07=_[_0x5d0a('0x26')](db[_0x5d0a('0x27')][_0x5d0a('0x28')],function(_0x58db6f){return{'name':_0x58db6f[_0x5d0a('0x29')],'type':_0x58db6f['type'][_0x5d0a('0x2a')]};});_0x1b81f1['model']=_[_0x5d0a('0x26')](_0x2a5a07,_0x5d0a('0x24'));_0x1b81f1[_0x5d0a('0x2b')]=_[_0x5d0a('0x2c')](_0x2f981d[_0x5d0a('0x2b')]);_0x1b81f1['filters']=_[_0x5d0a('0x2d')](_0x1b81f1[_0x5d0a('0x2e')],_0x1b81f1['query']);_0x30350d['attributes']=_['intersection'](_0x1b81f1[_0x5d0a('0x2e')],qs[_0x5d0a('0x2f')](_0x2f981d[_0x5d0a('0x2b')]['fields']));_0x30350d[_0x5d0a('0x30')]=_0x30350d[_0x5d0a('0x30')][_0x5d0a('0x31')]?_0x30350d[_0x5d0a('0x30')]:_0x1b81f1[_0x5d0a('0x2e')];if(!_0x2f981d[_0x5d0a('0x2b')][_0x5d0a('0x32')](_0x5d0a('0x33'))){_0x30350d[_0x5d0a('0x16')]=qs['limit'](_0x2f981d['query'][_0x5d0a('0x16')]);_0x30350d[_0x5d0a('0x18')]=qs[_0x5d0a('0x18')](_0x2f981d[_0x5d0a('0x2b')][_0x5d0a('0x18')]);}_0x30350d[_0x5d0a('0x34')]=qs['sort'](_0x2f981d[_0x5d0a('0x2b')][_0x5d0a('0x35')]);_0x30350d['where']=qs[_0x5d0a('0x36')](_['pick'](_0x2f981d[_0x5d0a('0x2b')],_0x1b81f1['filters']),_0x2a5a07);if(_0x2f981d[_0x5d0a('0x2b')][_0x5d0a('0x37')]){_0x30350d[_0x5d0a('0x38')]=_['merge'](_0x30350d['where'],{'$or':_[_0x5d0a('0x26')](_0x2a5a07,function(_0x137185){if(_0x137185[_0x5d0a('0x39')]!==_0x5d0a('0x3a')){var _0xef8f8f={};_0xef8f8f[_0x137185[_0x5d0a('0x24')]]={'$like':'%'+_0x2f981d[_0x5d0a('0x2b')][_0x5d0a('0x37')]+'%'};return _0xef8f8f;}})});}_0x30350d=_[_0x5d0a('0x3b')]({},_0x30350d,_0x2f981d['options']);var _0x32c944={'where':_0x30350d[_0x5d0a('0x38')]};return db[_0x5d0a('0x27')]['count'](_0x32c944)[_0x5d0a('0x1e')](function(_0x5b3727){_0x17c00c['count']=_0x5b3727;if(_0x2f981d[_0x5d0a('0x2b')][_0x5d0a('0x3c')]){_0x30350d[_0x5d0a('0x3d')]=[{'all':!![]}];}return db[_0x5d0a('0x27')]['findAll'](_0x30350d);})[_0x5d0a('0x1e')](function(_0x4a68e9){_0x17c00c['rows']=_0x4a68e9;return _0x17c00c;})[_0x5d0a('0x1e')](respondWithFilteredResult(_0x4ddabb,_0x30350d))[_0x5d0a('0x3e')](handleError(_0x4ddabb,null));};exports[_0x5d0a('0x3f')]=function(_0x5128bc,_0xa72c5e){var _0x14df9b={'raw':!![],'where':{'id':_0x5128bc['params']['id']}},_0x4054e9={};_0x4054e9[_0x5d0a('0x2e')]=_[_0x5d0a('0x2c')](db['SquareOdbc'][_0x5d0a('0x28')]);_0x4054e9[_0x5d0a('0x2b')]=_[_0x5d0a('0x2c')](_0x5128bc['query']);_0x4054e9[_0x5d0a('0x36')]=_[_0x5d0a('0x2d')](_0x4054e9[_0x5d0a('0x2e')],_0x4054e9[_0x5d0a('0x2b')]);_0x14df9b['attributes']=_['intersection'](_0x4054e9['model'],qs[_0x5d0a('0x2f')](_0x5128bc[_0x5d0a('0x2b')][_0x5d0a('0x2f')]));_0x14df9b[_0x5d0a('0x30')]=_0x14df9b[_0x5d0a('0x30')]['length']?_0x14df9b[_0x5d0a('0x30')]:_0x4054e9[_0x5d0a('0x2e')];if(_0x5128bc['query'][_0x5d0a('0x3c')]){_0x14df9b[_0x5d0a('0x3d')]=[{'all':!![]}];}_0x14df9b=_[_0x5d0a('0x3b')]({},_0x14df9b,_0x5128bc[_0x5d0a('0x40')]);return db[_0x5d0a('0x27')]['find'](_0x14df9b)[_0x5d0a('0x1e')](handleEntityNotFound(_0xa72c5e,null))[_0x5d0a('0x1e')](respondWithResult(_0xa72c5e,null))[_0x5d0a('0x3e')](handleError(_0xa72c5e,null));};exports[_0x5d0a('0x41')]=function(_0x3f4b60,_0x46d859){return db[_0x5d0a('0x27')][_0x5d0a('0x41')](_0x3f4b60[_0x5d0a('0x42')],{})[_0x5d0a('0x1e')](function(_0x55ed3d){var _0x444ca2=_0x3f4b60['user'][_0x5d0a('0x20')]({'plain':!![]});if(!_0x444ca2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x444ca2['role']===_0x5d0a('0x43')){var _0x43a439=_0x55ed3d[_0x5d0a('0x20')]({'plain':!![]});var _0xea88a4=_0x5d0a('0x44');return db['UserProfileSection'][_0x5d0a('0x45')]({'where':{'name':_0xea88a4,'userProfileId':_0x444ca2[_0x5d0a('0x46')]},'raw':!![]})[_0x5d0a('0x1e')](function(_0x2a34f3){if(_0x2a34f3&&_0x2a34f3['autoAssociation']===0x0){return db[_0x5d0a('0x21')][_0x5d0a('0x41')]({'name':_0x43a439['name'],'resourceId':_0x43a439['id'],'type':_0x2a34f3[_0x5d0a('0x24')],'sectionId':_0x2a34f3['id']},{})[_0x5d0a('0x1e')](function(){return _0x55ed3d;});}else{return _0x55ed3d;}})[_0x5d0a('0x3e')](function(_0x3a36f7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a36f7);throw _0x3a36f7;});}return _0x55ed3d;})[_0x5d0a('0x1e')](respondWithResult(_0x46d859,0xc9))[_0x5d0a('0x3e')](handleError(_0x46d859,null));};exports[_0x5d0a('0x1d')]=function(_0x479419,_0x4b4261){if(_0x479419[_0x5d0a('0x42')]['id']){delete _0x479419[_0x5d0a('0x42')]['id'];}return db[_0x5d0a('0x27')][_0x5d0a('0x45')]({'where':{'id':_0x479419[_0x5d0a('0x47')]['id']}})[_0x5d0a('0x1e')](handleEntityNotFound(_0x4b4261,null))['then'](saveUpdates(_0x479419['body'],null))[_0x5d0a('0x1e')](respondWithResult(_0x4b4261,null))[_0x5d0a('0x3e')](handleError(_0x4b4261,null));};exports[_0x5d0a('0x1f')]=function(_0xc93457,_0x124039){return db[_0x5d0a('0x27')][_0x5d0a('0x45')]({'where':{'id':_0xc93457[_0x5d0a('0x47')]['id']}})[_0x5d0a('0x1e')](handleEntityNotFound(_0x124039,null))[_0x5d0a('0x1e')](removeEntity(_0x124039,null))[_0x5d0a('0x3e')](handleError(_0x124039,null));};exports['test']=function(_0x2030b7,_0xfeaab5,_0x2d42ac){var _0x3d871c;return db[_0x5d0a('0x27')][_0x5d0a('0x45')]({'where':{'id':_0x2030b7[_0x5d0a('0x47')]['id']},'attributes':['id',_0x5d0a('0x48')]})[_0x5d0a('0x1e')](handleEntityNotFound(_0xfeaab5,null))[_0x5d0a('0x1e')](function(_0x8ba048){if(_0x8ba048){var _0x453d04=require(_0x5d0a('0x49'))();_0x453d04[_0x5d0a('0x4a')](_0x8ba048[_0x5d0a('0x48')]);_0x453d04[_0x5d0a('0x4b')]();return _0x8ba048;}})['then'](respondWithResult(_0xfeaab5,null))[_0x5d0a('0x3e')](handleError(_0xfeaab5,null));}; \ No newline at end of file +var _0xffa8=['keys','options','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','json','update','then','destroy','get','ODBC','error','name','send','index','map','SquareOdbc','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','type','VIRTUAL','includeAll','include','params'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xffa8,0xae));var _0x8ffa=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xffa8[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x8ffa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ffa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ffa('0x2'));var moment=require(_0x8ffa('0x3'));var BPromise=require(_0x8ffa('0x4'));var Mustache=require(_0x8ffa('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8ffa('0x6'));var ejs=require(_0x8ffa('0x7'));var fs=require('fs');var fs_extra=require(_0x8ffa('0x8'));var _=require(_0x8ffa('0x9'));var squel=require(_0x8ffa('0xa'));var crypto=require('crypto');var jsforce=require(_0x8ffa('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8ffa('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8ffa('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x8ffa('0xd'));var as=require(_0x8ffa('0xe'));var hardwareService=require(_0x8ffa('0xf'));var logger=require(_0x8ffa('0x10'))(_0x8ffa('0x11'));var utils=require(_0x8ffa('0x12'));var config=require(_0x8ffa('0x13'));var licenseUtil=require(_0x8ffa('0x14'));var db=require(_0x8ffa('0x15'))['db'];function respondWithStatusCode(_0x118a70,_0x21d40e){_0x21d40e=_0x21d40e||0xcc;return function(_0x37f3ca){if(_0x37f3ca){return _0x118a70[_0x8ffa('0x16')](_0x21d40e);}return _0x118a70['status'](_0x21d40e)[_0x8ffa('0x17')]();};}function respondWithResult(_0x787497,_0x2a0a0d){_0x2a0a0d=_0x2a0a0d||0xc8;return function(_0x271db3){if(_0x271db3){return _0x787497[_0x8ffa('0x18')](_0x2a0a0d)['json'](_0x271db3);}};}function respondWithFilteredResult(_0xc99792,_0xce32b5){return function(_0x412db2){if(_0x412db2){var _0x4debf6=typeof _0xce32b5[_0x8ffa('0x19')]===_0x8ffa('0x1a')&&typeof _0xce32b5[_0x8ffa('0x1b')]===_0x8ffa('0x1a');var _0x1f107b=_0x412db2['count'];var _0x41d338=_0x4debf6?0x0:_0xce32b5['offset'];var _0xc5a0da=_0x4debf6?_0x412db2[_0x8ffa('0x1c')]:_0xce32b5[_0x8ffa('0x19')]+_0xce32b5[_0x8ffa('0x1b')];var _0x55a09e;if(_0xc5a0da>=_0x1f107b){_0xc5a0da=_0x1f107b;_0x55a09e=0xc8;}else{_0x55a09e=0xce;}_0xc99792[_0x8ffa('0x18')](_0x55a09e);return _0xc99792['set']('Content-Range',_0x41d338+'-'+_0xc5a0da+'/'+_0x1f107b)[_0x8ffa('0x1d')](_0x412db2);}return null;};}function patchUpdates(_0x443b20){return function(_0x25b2dc){try{jsonpatch['apply'](_0x25b2dc,_0x443b20,!![]);}catch(_0xfda1a8){return BPromise['reject'](_0xfda1a8);}return _0x25b2dc['save']();};}function saveUpdates(_0x4cadf4,_0x3593ea){return function(_0x5d5766){if(_0x5d5766){return _0x5d5766[_0x8ffa('0x1e')](_0x4cadf4)[_0x8ffa('0x1f')](function(_0x25ce0e){return _0x25ce0e;});}return null;};}function removeEntity(_0x386d8b,_0x2b903f){return function(_0x499940){if(_0x499940){return _0x499940[_0x8ffa('0x20')]()['then'](function(){var _0x4eb9e9=_0x499940[_0x8ffa('0x21')]({'plain':!![]});var _0x307375=_0x8ffa('0x22');return db['UserProfileResource'][_0x8ffa('0x20')]({'where':{'type':_0x307375,'resourceId':_0x4eb9e9['id']}})['then'](function(){return _0x499940;});})['then'](function(){_0x386d8b[_0x8ffa('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46b902,_0x2304b9){return function(_0x1ed6f8){if(!_0x1ed6f8){_0x46b902['sendStatus'](0x194);}return _0x1ed6f8;};}function handleError(_0x4b03f7,_0x1a054d){_0x1a054d=_0x1a054d||0x1f4;return function(_0x1d1b6e){logger[_0x8ffa('0x23')](_0x1d1b6e['stack']);if(_0x1d1b6e['name']){delete _0x1d1b6e[_0x8ffa('0x24')];}_0x4b03f7[_0x8ffa('0x18')](_0x1a054d)[_0x8ffa('0x25')](_0x1d1b6e);};}exports[_0x8ffa('0x26')]=function(_0x52c6fb,_0x5e0c21){var _0x3a1702={},_0x592e30={},_0xfc4e2e={'count':0x0,'rows':[]};var _0xc24d86=_[_0x8ffa('0x27')](db[_0x8ffa('0x28')]['rawAttributes'],function(_0x26559e){return{'name':_0x26559e['fieldName'],'type':_0x26559e['type']['key']};});_0x592e30[_0x8ffa('0x29')]=_['map'](_0xc24d86,'name');_0x592e30['query']=_['keys'](_0x52c6fb[_0x8ffa('0x2a')]);_0x592e30['filters']=_['intersection'](_0x592e30[_0x8ffa('0x29')],_0x592e30[_0x8ffa('0x2a')]);_0x3a1702['attributes']=_[_0x8ffa('0x2b')](_0x592e30[_0x8ffa('0x29')],qs['fields'](_0x52c6fb['query'][_0x8ffa('0x2c')]));_0x3a1702[_0x8ffa('0x2d')]=_0x3a1702['attributes'][_0x8ffa('0x2e')]?_0x3a1702['attributes']:_0x592e30[_0x8ffa('0x29')];if(!_0x52c6fb[_0x8ffa('0x2a')][_0x8ffa('0x2f')](_0x8ffa('0x30'))){_0x3a1702[_0x8ffa('0x1b')]=qs[_0x8ffa('0x1b')](_0x52c6fb[_0x8ffa('0x2a')][_0x8ffa('0x1b')]);_0x3a1702[_0x8ffa('0x19')]=qs[_0x8ffa('0x19')](_0x52c6fb['query'][_0x8ffa('0x19')]);}_0x3a1702[_0x8ffa('0x31')]=qs[_0x8ffa('0x32')](_0x52c6fb[_0x8ffa('0x2a')][_0x8ffa('0x32')]);_0x3a1702['where']=qs[_0x8ffa('0x33')](_[_0x8ffa('0x34')](_0x52c6fb[_0x8ffa('0x2a')],_0x592e30[_0x8ffa('0x33')]),_0xc24d86);if(_0x52c6fb[_0x8ffa('0x2a')]['filter']){_0x3a1702['where']=_[_0x8ffa('0x35')](_0x3a1702[_0x8ffa('0x36')],{'$or':_['map'](_0xc24d86,function(_0x1438b8){if(_0x1438b8[_0x8ffa('0x37')]!==_0x8ffa('0x38')){var _0x530101={};_0x530101[_0x1438b8[_0x8ffa('0x24')]]={'$like':'%'+_0x52c6fb[_0x8ffa('0x2a')]['filter']+'%'};return _0x530101;}})});}_0x3a1702=_[_0x8ffa('0x35')]({},_0x3a1702,_0x52c6fb['options']);var _0x135296={'where':_0x3a1702[_0x8ffa('0x36')]};return db['SquareOdbc'][_0x8ffa('0x1c')](_0x135296)[_0x8ffa('0x1f')](function(_0x49f0c9){_0xfc4e2e[_0x8ffa('0x1c')]=_0x49f0c9;if(_0x52c6fb[_0x8ffa('0x2a')][_0x8ffa('0x39')]){_0x3a1702[_0x8ffa('0x3a')]=[{'all':!![]}];}return db[_0x8ffa('0x28')]['findAll'](_0x3a1702);})[_0x8ffa('0x1f')](function(_0x2b2f8f){_0xfc4e2e['rows']=_0x2b2f8f;return _0xfc4e2e;})[_0x8ffa('0x1f')](respondWithFilteredResult(_0x5e0c21,_0x3a1702))['catch'](handleError(_0x5e0c21,null));};exports['show']=function(_0x3d5c85,_0x5f1784){var _0x5b6ec2={'raw':!![],'where':{'id':_0x3d5c85[_0x8ffa('0x3b')]['id']}},_0x44d766={};_0x44d766[_0x8ffa('0x29')]=_[_0x8ffa('0x3c')](db[_0x8ffa('0x28')]['rawAttributes']);_0x44d766[_0x8ffa('0x2a')]=_[_0x8ffa('0x3c')](_0x3d5c85[_0x8ffa('0x2a')]);_0x44d766[_0x8ffa('0x33')]=_[_0x8ffa('0x2b')](_0x44d766[_0x8ffa('0x29')],_0x44d766[_0x8ffa('0x2a')]);_0x5b6ec2[_0x8ffa('0x2d')]=_[_0x8ffa('0x2b')](_0x44d766[_0x8ffa('0x29')],qs[_0x8ffa('0x2c')](_0x3d5c85[_0x8ffa('0x2a')]['fields']));_0x5b6ec2['attributes']=_0x5b6ec2['attributes'][_0x8ffa('0x2e')]?_0x5b6ec2['attributes']:_0x44d766[_0x8ffa('0x29')];if(_0x3d5c85[_0x8ffa('0x2a')]['includeAll']){_0x5b6ec2[_0x8ffa('0x3a')]=[{'all':!![]}];}_0x5b6ec2=_[_0x8ffa('0x35')]({},_0x5b6ec2,_0x3d5c85[_0x8ffa('0x3d')]);return db[_0x8ffa('0x28')]['find'](_0x5b6ec2)[_0x8ffa('0x1f')](handleEntityNotFound(_0x5f1784,null))[_0x8ffa('0x1f')](respondWithResult(_0x5f1784,null))[_0x8ffa('0x3e')](handleError(_0x5f1784,null));};exports[_0x8ffa('0x3f')]=function(_0x495cde,_0x3e79b8){return db[_0x8ffa('0x28')][_0x8ffa('0x3f')](_0x495cde[_0x8ffa('0x40')],{})[_0x8ffa('0x1f')](function(_0x1bf03d){var _0x328bc3=_0x495cde['user'][_0x8ffa('0x21')]({'plain':!![]});if(!_0x328bc3)throw new Error(_0x8ffa('0x41'));if(_0x328bc3[_0x8ffa('0x42')]===_0x8ffa('0x43')){var _0x19b49c=_0x1bf03d[_0x8ffa('0x21')]({'plain':!![]});var _0x5d2133=_0x8ffa('0x22');return db[_0x8ffa('0x44')][_0x8ffa('0x45')]({'where':{'name':_0x5d2133,'userProfileId':_0x328bc3[_0x8ffa('0x46')]},'raw':!![]})[_0x8ffa('0x1f')](function(_0x1bbc86){if(_0x1bbc86&&_0x1bbc86[_0x8ffa('0x47')]===0x0){return db['UserProfileResource']['create']({'name':_0x19b49c['name'],'resourceId':_0x19b49c['id'],'type':_0x1bbc86[_0x8ffa('0x24')],'sectionId':_0x1bbc86['id']},{})['then'](function(){return _0x1bf03d;});}else{return _0x1bf03d;}})['catch'](function(_0xd58067){logger[_0x8ffa('0x23')](_0x8ffa('0x48'),_0xd58067);throw _0xd58067;});}return _0x1bf03d;})[_0x8ffa('0x1f')](respondWithResult(_0x3e79b8,0xc9))['catch'](handleError(_0x3e79b8,null));};exports[_0x8ffa('0x1e')]=function(_0x1ef301,_0x47045c){if(_0x1ef301[_0x8ffa('0x40')]['id']){delete _0x1ef301[_0x8ffa('0x40')]['id'];}return db[_0x8ffa('0x28')]['find']({'where':{'id':_0x1ef301[_0x8ffa('0x3b')]['id']}})['then'](handleEntityNotFound(_0x47045c,null))[_0x8ffa('0x1f')](saveUpdates(_0x1ef301[_0x8ffa('0x40')],null))[_0x8ffa('0x1f')](respondWithResult(_0x47045c,null))[_0x8ffa('0x3e')](handleError(_0x47045c,null));};exports[_0x8ffa('0x20')]=function(_0x2e9bc0,_0x43baa9){return db[_0x8ffa('0x28')][_0x8ffa('0x45')]({'where':{'id':_0x2e9bc0[_0x8ffa('0x3b')]['id']}})[_0x8ffa('0x1f')](handleEntityNotFound(_0x43baa9,null))['then'](removeEntity(_0x43baa9,null))['catch'](handleError(_0x43baa9,null));};exports[_0x8ffa('0x49')]=function(_0x13c009,_0x191580,_0xa107eb){var _0x1daf22;return db['SquareOdbc']['find']({'where':{'id':_0x13c009[_0x8ffa('0x3b')]['id']},'attributes':['id',_0x8ffa('0x4a')]})[_0x8ffa('0x1f')](handleEntityNotFound(_0x191580,null))[_0x8ffa('0x1f')](function(_0x2871fe){if(_0x2871fe){var _0x2c0590=require(_0x8ffa('0x4b'))();_0x2c0590[_0x8ffa('0x4c')](_0x2871fe[_0x8ffa('0x4a')]);_0x2c0590[_0x8ffa('0x4d')]();return _0x2871fe;}})[_0x8ffa('0x1f')](respondWithResult(_0x191580,null))[_0x8ffa('0x3e')](handleError(_0x191580,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 3f6c620..75ce09e 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 _0xda52=['define','SquareOdbc','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes'];(function(_0x23c6d1,_0x5d6da2){var _0x516589=function(_0x276e8d){while(--_0x276e8d){_0x23c6d1['push'](_0x23c6d1['shift']());}};_0x516589(++_0x5d6da2);}(_0xda52,0x124));var _0x2da5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda52[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2da5('0x0'));var logger=require(_0x2da5('0x1'))('api');var moment=require(_0x2da5('0x2'));var BPromise=require(_0x2da5('0x3'));var rp=require(_0x2da5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2da5('0x5'));var config=require(_0x2da5('0x6'));var attributes=require(_0x2da5('0x7'));module['exports']=function(_0x2a5bfd,_0x2cb4e8){return _0x2a5bfd[_0x2da5('0x8')](_0x2da5('0x9'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4156=['path','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x361078,_0x283dcb){var _0x22d9e8=function(_0x140b4b){while(--_0x140b4b){_0x361078['push'](_0x361078['shift']());}};_0x22d9e8(++_0x283dcb);}(_0x4156,0x11a));var _0x6415=function(_0x2d43a7,_0x457b94){_0x2d43a7=_0x2d43a7-0x0;var _0x296918=_0x4156[_0x2d43a7];return _0x296918;};'use strict';var _=require('lodash');var util=require(_0x6415('0x0'));var logger=require(_0x6415('0x1'))(_0x6415('0x2'));var moment=require(_0x6415('0x3'));var BPromise=require(_0x6415('0x4'));var rp=require(_0x6415('0x5'));var fs=require('fs');var path=require(_0x6415('0x6'));var rimraf=require('rimraf');var config=require(_0x6415('0x7'));var attributes=require(_0x6415('0x8'));module[_0x6415('0x9')]=function(_0x5b58ce,_0x3dcc45){return _0x5b58ce[_0x6415('0xa')]('SquareOdbc',attributes,{'tableName':_0x6415('0xb'),'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 40f559f..bd6c498 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 _0xf782=['catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model','util','moment','bluebird','rpc','jayson/promise','http','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x21661b,_0x5d2077){var _0x28a841=function(_0x5f1f12){while(--_0x5f1f12){_0x21661b['push'](_0x21661b['shift']());}};_0x28a841(++_0x5d2077);}(_0xf782,0x1a0));var _0x2f78=function(_0x4289ed,_0x2c7b8f){_0x4289ed=_0x4289ed-0x0;var _0x2f5317=_0xf782[_0x4289ed];return _0x2f5317;};'use strict';var _=require('lodash');var util=require(_0x2f78('0x0'));var moment=require(_0x2f78('0x1'));var BPromise=require(_0x2f78('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2f78('0x3'));var config=require('../../config/environment');var jayson=require(_0x2f78('0x4'));var client=jayson['client'][_0x2f78('0x5')]({'port':0x232a});function respondWithRpcPromise(_0xfc2aa2,_0x57af42,_0x46aa54){return new BPromise(function(_0x2517de,_0x56e3a7){return client['request'](_0xfc2aa2,_0x46aa54)[_0x2f78('0x6')](function(_0x167758){logger['info'](_0x2f78('0x7'),_0x57af42,_0x2f78('0x8'));logger[_0x2f78('0x9')](_0x2f78('0xa'),_0x57af42,_0x2f78('0x8'),JSON[_0x2f78('0xb')](_0x167758));if(_0x167758['error']){if(_0x167758[_0x2f78('0xc')][_0x2f78('0xd')]===0x1f4){logger[_0x2f78('0xc')](_0x2f78('0x7'),_0x57af42,_0x167758[_0x2f78('0xc')][_0x2f78('0xe')]);return _0x56e3a7(_0x167758[_0x2f78('0xc')][_0x2f78('0xe')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x57af42,_0x167758['error'][_0x2f78('0xe')]);return _0x2517de(_0x167758[_0x2f78('0xc')][_0x2f78('0xe')]);}else{logger[_0x2f78('0xf')](_0x2f78('0x7'),_0x57af42,_0x2f78('0x8'));_0x2517de(_0x167758['result'][_0x2f78('0xe')]);}})[_0x2f78('0x10')](function(_0x274332){logger[_0x2f78('0xc')](_0x2f78('0x7'),_0x57af42,_0x274332);_0x56e3a7(_0x274332);});});}exports[_0x2f78('0x11')]=function(_0x53eba9){var _0x5e51c0=this;return new Promise(function(_0x1ad43a,_0x5097fb){return db[_0x2f78('0x12')][_0x2f78('0x13')]({'raw':_0x53eba9[_0x2f78('0x14')]?_0x53eba9[_0x2f78('0x14')][_0x2f78('0x15')]===undefined?!![]:![]:!![],'where':_0x53eba9[_0x2f78('0x14')]?_0x53eba9[_0x2f78('0x14')][_0x2f78('0x16')]||null:null,'attributes':_0x53eba9[_0x2f78('0x14')]?_0x53eba9[_0x2f78('0x14')][_0x2f78('0x17')]||null:null,'include':_0x53eba9[_0x2f78('0x14')]?_0x53eba9[_0x2f78('0x14')][_0x2f78('0x18')]?_[_0x2f78('0x19')](_0x53eba9[_0x2f78('0x14')][_0x2f78('0x18')],function(_0x3c415a){return{'model':db[_0x3c415a[_0x2f78('0x1a')]],'as':_0x3c415a['as'],'attributes':_0x3c415a[_0x2f78('0x17')],'include':_0x3c415a[_0x2f78('0x18')]?_[_0x2f78('0x19')](_0x3c415a[_0x2f78('0x18')],function(_0x1ff5cb){return{'model':db[_0x1ff5cb['model']],'as':_0x1ff5cb['as'],'attributes':_0x1ff5cb[_0x2f78('0x17')],'include':_0x1ff5cb[_0x2f78('0x18')]?_[_0x2f78('0x19')](_0x1ff5cb[_0x2f78('0x18')],function(_0x41d343){return{'model':db[_0x41d343['model']],'as':_0x41d343['as'],'attributes':_0x41d343[_0x2f78('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2690e6){logger['info'](_0x2f78('0x11'),_0x53eba9);logger[_0x2f78('0x9')]('ShowSquareOdbc',_0x53eba9,JSON[_0x2f78('0xb')](_0x2690e6));_0x1ad43a(_0x2690e6);})[_0x2f78('0x10')](function(_0x41d338){logger[_0x2f78('0xc')]('ShowSquareOdbc',_0x41d338['message'],_0x53eba9);_0x5097fb(_0x5e51c0['error'](0x1f4,_0x41d338[_0x2f78('0xe')]));});});}; \ No newline at end of file +var _0x789d=['http','request','SquareOdbc,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','ShowSquareOdbc','SquareOdbc','find','options','attributes','map','include','model','then','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x7f1331,_0x5bc140){var _0x4baff4=function(_0xc91a8c){while(--_0xc91a8c){_0x7f1331['push'](_0x7f1331['shift']());}};_0x4baff4(++_0x5bc140);}(_0x789d,0x118));var _0xd789=function(_0x2462a8,_0xd03f92){_0x2462a8=_0x2462a8-0x0;var _0x1b2a98=_0x789d[_0x2462a8];return _0x1b2a98;};'use strict';var _=require(_0xd789('0x0'));var util=require(_0xd789('0x1'));var moment=require(_0xd789('0x2'));var BPromise=require(_0xd789('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd789('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd789('0x5'))(_0xd789('0x6'));var config=require(_0xd789('0x7'));var jayson=require(_0xd789('0x8'));var client=jayson[_0xd789('0x9')][_0xd789('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4316f0,_0x228664,_0x620b2e){return new BPromise(function(_0x37f243,_0x384807){return client[_0xd789('0xb')](_0x4316f0,_0x620b2e)['then'](function(_0x517434){logger['info'](_0xd789('0xc'),_0x228664,_0xd789('0xd'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x228664,_0xd789('0xd'),JSON[_0xd789('0xe')](_0x517434));if(_0x517434[_0xd789('0xf')]){if(_0x517434[_0xd789('0xf')][_0xd789('0x10')]===0x1f4){logger[_0xd789('0xf')](_0xd789('0xc'),_0x228664,_0x517434['error']['message']);return _0x384807(_0x517434['error'][_0xd789('0x11')]);}logger[_0xd789('0xf')](_0xd789('0xc'),_0x228664,_0x517434[_0xd789('0xf')][_0xd789('0x11')]);return _0x37f243(_0x517434['error'][_0xd789('0x11')]);}else{logger[_0xd789('0x12')](_0xd789('0xc'),_0x228664,_0xd789('0xd'));_0x37f243(_0x517434['result']['message']);}})[_0xd789('0x13')](function(_0x797edd){logger[_0xd789('0xf')](_0xd789('0xc'),_0x228664,_0x797edd);_0x384807(_0x797edd);});});}exports[_0xd789('0x14')]=function(_0x11fa1a){var _0x1355cf=this;return new Promise(function(_0x4772ae,_0x11c39c){return db[_0xd789('0x15')][_0xd789('0x16')]({'raw':_0x11fa1a[_0xd789('0x17')]?_0x11fa1a['options']['raw']===undefined?!![]:![]:!![],'where':_0x11fa1a[_0xd789('0x17')]?_0x11fa1a[_0xd789('0x17')]['where']||null:null,'attributes':_0x11fa1a[_0xd789('0x17')]?_0x11fa1a[_0xd789('0x17')][_0xd789('0x18')]||null:null,'include':_0x11fa1a[_0xd789('0x17')]?_0x11fa1a[_0xd789('0x17')]['include']?_[_0xd789('0x19')](_0x11fa1a['options'][_0xd789('0x1a')],function(_0xc7db1d){return{'model':db[_0xc7db1d['model']],'as':_0xc7db1d['as'],'attributes':_0xc7db1d[_0xd789('0x18')],'include':_0xc7db1d[_0xd789('0x1a')]?_[_0xd789('0x19')](_0xc7db1d['include'],function(_0x333e4e){return{'model':db[_0x333e4e[_0xd789('0x1b')]],'as':_0x333e4e['as'],'attributes':_0x333e4e[_0xd789('0x18')],'include':_0x333e4e['include']?_[_0xd789('0x19')](_0x333e4e[_0xd789('0x1a')],function(_0x3fdcef){return{'model':db[_0x3fdcef[_0xd789('0x1b')]],'as':_0x3fdcef['as'],'attributes':_0x3fdcef[_0xd789('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd789('0x1c')](function(_0x5a8018){logger[_0xd789('0x12')](_0xd789('0x14'),_0x11fa1a);logger['debug']('ShowSquareOdbc',_0x11fa1a,JSON[_0xd789('0xe')](_0x5a8018));_0x4772ae(_0x5a8018);})[_0xd789('0x13')](function(_0x52f098){logger[_0xd789('0xf')](_0xd789('0x14'),_0x52f098['message'],_0x11fa1a);_0x11c39c(_0x1355cf[_0xd789('0xf')](0x1f4,_0x52f098[_0xd789('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index deaee41..5fcf616 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 _0xc46e=['../../components/interaction/service','../../config/environment','./squareProject.controller','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x26174f,_0x530118){var _0x3e860c=function(_0x32559f){while(--_0x32559f){_0x26174f['push'](_0x26174f['shift']());}};_0x3e860c(++_0x530118);}(_0xc46e,0x176));var _0xec46=function(_0x1b95a1,_0x529852){_0x1b95a1=_0x1b95a1-0x0;var _0x57aef1=_0xc46e[_0x1b95a1];return _0x57aef1;};'use strict';var multer=require(_0xec46('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xec46('0x1'));var express=require(_0xec46('0x2'));var router=express[_0xec46('0x3')]();var fs_extra=require(_0xec46('0x4'));var auth=require(_0xec46('0x5'));var interaction=require(_0xec46('0x6'));var config=require(_0xec46('0x7'));var controller=require(_0xec46('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xec46('0x9')]);router['get']('/:id',auth[_0xec46('0xa')](),controller[_0xec46('0xb')]);router[_0xec46('0xc')]('/',auth[_0xec46('0xa')](),controller[_0xec46('0xd')]);router[_0xec46('0xe')](_0xec46('0xf'),auth[_0xec46('0xa')](),controller[_0xec46('0x10')]);router[_0xec46('0x11')](_0xec46('0xf'),auth[_0xec46('0xa')](),controller[_0xec46('0x12')]);module[_0xec46('0x13')]=router; \ No newline at end of file +var _0x8b3e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','path','connect-timeout'];(function(_0x4aed02,_0x3f757d){var _0x15c0b4=function(_0x3c8271){while(--_0x3c8271){_0x4aed02['push'](_0x4aed02['shift']());}};_0x15c0b4(++_0x3f757d);}(_0x8b3e,0x1b5));var _0xe8b3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b3e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe8b3('0x0'));var util=require('util');var path=require(_0xe8b3('0x1'));var timeout=require(_0xe8b3('0x2'));var express=require(_0xe8b3('0x3'));var router=express[_0xe8b3('0x4')]();var fs_extra=require(_0xe8b3('0x5'));var auth=require(_0xe8b3('0x6'));var interaction=require(_0xe8b3('0x7'));var config=require(_0xe8b3('0x8'));var controller=require(_0xe8b3('0x9'));router[_0xe8b3('0xa')]('/',auth[_0xe8b3('0xb')](),controller[_0xe8b3('0xc')]);router['get'](_0xe8b3('0xd'),auth[_0xe8b3('0xb')](),controller[_0xe8b3('0xe')]);router[_0xe8b3('0xf')]('/',auth[_0xe8b3('0xb')](),controller[_0xe8b3('0x10')]);router[_0xe8b3('0x11')]('/:id',auth[_0xe8b3('0xb')](),controller[_0xe8b3('0x12')]);router['delete'](_0xe8b3('0xd'),auth[_0xe8b3('0xb')](),controller[_0xe8b3('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 95b8af6..3a79643 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 _0x1760=['getDataValue','preproduction','utf8','production','toString','DATE','sequelize','STRING','name','TEXT','BLOB','long'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x1760,0x11a));var _0x0176=function(_0x190c17,_0x2da507){_0x190c17=_0x190c17-0x0;var _0x3642d0=_0x1760[_0x190c17];return _0x3642d0;};'use strict';var Sequelize=require(_0x0176('0x0'));module['exports']={'name':{'type':Sequelize[_0x0176('0x1')],'unique':_0x0176('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x0176('0x1')]},'notes':{'type':Sequelize[_0x0176('0x3')]},'preproduction':{'type':Sequelize[_0x0176('0x4')](_0x0176('0x5')),'get':function(){if(this[_0x0176('0x6')](_0x0176('0x7'))){return this[_0x0176('0x6')](_0x0176('0x7'))['toString'](_0x0176('0x8'));}}},'production':{'type':Sequelize[_0x0176('0x4')](_0x0176('0x5')),'get':function(){if(this[_0x0176('0x6')]('production')){return this[_0x0176('0x6')](_0x0176('0x9'))[_0x0176('0xa')](_0x0176('0x8'));}}},'savedAt':{'type':Sequelize[_0x0176('0xb')]},'publishedAt':{'type':Sequelize[_0x0176('0xb')]}}; \ No newline at end of file +var _0x40df=['DATE','sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','production'];(function(_0x348cce,_0x3676ba){var _0x2f31d5=function(_0x53b366){while(--_0x53b366){_0x348cce['push'](_0x348cce['shift']());}};_0x2f31d5(++_0x3676ba);}(_0x40df,0x1c9));var _0xf40d=function(_0x2d9c2c,_0x2881fd){_0x2d9c2c=_0x2d9c2c-0x0;var _0x2e7d25=_0x40df[_0x2d9c2c];return _0x2e7d25;};'use strict';var Sequelize=require(_0xf40d('0x0'));module[_0xf40d('0x1')]={'name':{'type':Sequelize[_0xf40d('0x2')],'unique':_0xf40d('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xf40d('0x2')]},'notes':{'type':Sequelize[_0xf40d('0x4')]},'preproduction':{'type':Sequelize[_0xf40d('0x5')](_0xf40d('0x6')),'get':function(){if(this[_0xf40d('0x7')](_0xf40d('0x8'))){return this[_0xf40d('0x7')](_0xf40d('0x8'))[_0xf40d('0x9')]('utf8');}}},'production':{'type':Sequelize[_0xf40d('0x5')](_0xf40d('0x6')),'get':function(){if(this[_0xf40d('0x7')]('production')){return this[_0xf40d('0x7')](_0xf40d('0xa'))[_0xf40d('0x9')]('utf8');}}},'savedAt':{'type':Sequelize[_0xf40d('0xb')]},'publishedAt':{'type':Sequelize[_0xf40d('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 169fb02..37abd30 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 _0x2334=['catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','production','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','limit','undefined','Content-Range','update','then','destroy','get','SquareProjects','publish','stringify','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','show','SquareProject','find'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2334,0xd4));var _0x4233=function(_0x49fa22,_0x3a8ccb){_0x49fa22=_0x49fa22-0x0;var _0x4af7a1=_0x2334[_0x49fa22];return _0x4af7a1;};'use strict';var _=require('lodash');var Redis=require(_0x4233('0x0'));var qs=require(_0x4233('0x1'));var logger=require(_0x4233('0x2'))('api');var config=require(_0x4233('0x3'));var db=require('../../mysqldb')['db'];config[_0x4233('0x4')]=_[_0x4233('0x5')](config[_0x4233('0x4')],{'host':_0x4233('0x6'),'port':0x18eb});var socket=require(_0x4233('0x7'))(new Redis(config[_0x4233('0x4')]));require(_0x4233('0x8'))[_0x4233('0x9')](socket);function respondWithResult(_0x4fc562,_0x206e36){_0x206e36=_0x206e36||0xc8;return function(_0x10193a){if(_0x10193a){return _0x4fc562[_0x4233('0xa')](_0x206e36)[_0x4233('0xb')](_0x10193a);}};}function respondWithFilteredResult(_0x5eeda5,_0xc1c898){return function(_0x1b2f5f){if(_0x1b2f5f){var _0x2c16a1=typeof _0xc1c898[_0x4233('0xc')]==='undefined'&&typeof _0xc1c898[_0x4233('0xd')]===_0x4233('0xe');var _0x5eeece=_0x1b2f5f['count'];var _0x272913=_0x2c16a1?0x0:_0xc1c898[_0x4233('0xc')];var _0x21a9e7=_0x2c16a1?_0x1b2f5f['count']:_0xc1c898[_0x4233('0xc')]+_0xc1c898[_0x4233('0xd')];var _0x5c3543;if(_0x21a9e7>=_0x5eeece){_0x21a9e7=_0x5eeece;_0x5c3543=0xc8;}else{_0x5c3543=0xce;}_0x5eeda5['status'](_0x5c3543);return _0x5eeda5['set'](_0x4233('0xf'),_0x272913+'-'+_0x21a9e7+'/'+_0x5eeece)[_0x4233('0xb')](_0x1b2f5f);}return null;};}function saveUpdates(_0x43aede){return function(_0x245331){if(_0x245331){return _0x245331[_0x4233('0x10')](_0x43aede)[_0x4233('0x11')](function(_0x28daed){return _0x28daed;});}return null;};}function removeEntity(_0xdcd8fd){return function(_0x33cdc3){if(_0x33cdc3){return _0x33cdc3[_0x4233('0x12')]()['then'](function(){var _0x598049=_0x33cdc3[_0x4233('0x13')]({'plain':!![]});var _0x25b9e8=_0x4233('0x14');return db['UserProfileResource']['destroy']({'where':{'type':_0x25b9e8,'resourceId':_0x598049['id']}})[_0x4233('0x11')](function(){return _0x33cdc3;});})[_0x4233('0x11')](function(){var _0x126053=new Redis(config[_0x4233('0x4')]);_0x126053[_0x4233('0x15')]('agi',JSON[_0x4233('0x16')]({'id':_0x33cdc3['id'],'deleted':!![]}));})[_0x4233('0x11')](function(){_0xdcd8fd[_0x4233('0xa')](0xcc)[_0x4233('0x17')]();});}};}function handleEntityNotFound(_0x98dd95){return function(_0x27388b){if(!_0x27388b){_0x98dd95[_0x4233('0x18')](0x194);}return _0x27388b;};}function handleError(_0x428265,_0x29b049){_0x29b049=_0x29b049||0x1f4;return function(_0x74bbeb){logger[_0x4233('0x19')](_0x74bbeb[_0x4233('0x1a')]);if(_0x74bbeb['name']){delete _0x74bbeb[_0x4233('0x1b')];}_0x428265[_0x4233('0xa')](_0x29b049)[_0x4233('0x1c')](_0x74bbeb);};}exports[_0x4233('0x1d')]=function(_0x13f111,_0x22f559){var _0x1a5e94={},_0x2ef7cb={},_0x412a77={'count':0x0,'rows':[]};var _0x2c78cf=_[_0x4233('0x1e')](db['SquareProject'][_0x4233('0x1f')],function(_0x68e8a5){return{'name':_0x68e8a5[_0x4233('0x20')],'type':_0x68e8a5[_0x4233('0x21')]['key']};});_0x2ef7cb['model']=_[_0x4233('0x1e')](_0x2c78cf,_0x4233('0x1b'));_0x2ef7cb[_0x4233('0x22')]=_[_0x4233('0x23')](_0x13f111['query']);_0x2ef7cb[_0x4233('0x24')]=_['intersection'](_0x2ef7cb[_0x4233('0x25')],_0x2ef7cb[_0x4233('0x22')]);_0x1a5e94[_0x4233('0x26')]=_[_0x4233('0x27')](_0x2ef7cb[_0x4233('0x25')],qs[_0x4233('0x28')](_0x13f111[_0x4233('0x22')][_0x4233('0x28')]));_0x1a5e94[_0x4233('0x26')]=_0x1a5e94[_0x4233('0x26')][_0x4233('0x29')]?_0x1a5e94[_0x4233('0x26')]:_0x2ef7cb[_0x4233('0x25')];if(!_0x13f111[_0x4233('0x22')][_0x4233('0x2a')](_0x4233('0x2b'))){_0x1a5e94[_0x4233('0xd')]=qs[_0x4233('0xd')](_0x13f111[_0x4233('0x22')][_0x4233('0xd')]);_0x1a5e94[_0x4233('0xc')]=qs[_0x4233('0xc')](_0x13f111[_0x4233('0x22')]['offset']);}_0x1a5e94['order']=qs['sort'](_0x13f111['query']['sort']);_0x1a5e94[_0x4233('0x2c')]=qs[_0x4233('0x24')](_[_0x4233('0x2d')](_0x13f111[_0x4233('0x22')],_0x2ef7cb[_0x4233('0x24')]),_0x2c78cf);if(_0x13f111[_0x4233('0x22')][_0x4233('0x2e')]){_0x1a5e94['where']=_[_0x4233('0x2f')](_0x1a5e94['where'],{'$or':_['map'](_0x2c78cf,function(_0x53d0f4){if(_0x53d0f4[_0x4233('0x21')]!==_0x4233('0x30')){var _0x599dd1={};_0x599dd1[_0x53d0f4[_0x4233('0x1b')]]={'$like':'%'+_0x13f111[_0x4233('0x22')][_0x4233('0x2e')]+'%'};return _0x599dd1;}})});}_0x1a5e94=_['merge']({},_0x1a5e94,_0x13f111[_0x4233('0x31')]);var _0x32234e={'where':_0x1a5e94['where']};return db['SquareProject'][_0x4233('0x32')](_0x32234e)[_0x4233('0x11')](function(_0x328a6b){_0x412a77[_0x4233('0x32')]=_0x328a6b;if(_0x13f111[_0x4233('0x22')][_0x4233('0x33')]){_0x1a5e94[_0x4233('0x34')]=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x1a5e94);})['then'](function(_0x316b4f){_0x412a77['rows']=_0x316b4f;return _0x412a77;})[_0x4233('0x11')](respondWithFilteredResult(_0x22f559,_0x1a5e94))['catch'](handleError(_0x22f559,null));};exports[_0x4233('0x35')]=function(_0x27f403,_0x4e8b62){var _0x40c4ad={'raw':![],'where':{'id':_0x27f403['params']['id']}},_0x2034db={};_0x2034db[_0x4233('0x25')]=_[_0x4233('0x23')](db[_0x4233('0x36')]['rawAttributes']);_0x2034db['query']=_[_0x4233('0x23')](_0x27f403[_0x4233('0x22')]);_0x2034db['filters']=_['intersection'](_0x2034db['model'],_0x2034db['query']);_0x40c4ad[_0x4233('0x26')]=_[_0x4233('0x27')](_0x2034db[_0x4233('0x25')],qs[_0x4233('0x28')](_0x27f403['query']['fields']));_0x40c4ad['attributes']=_0x40c4ad[_0x4233('0x26')][_0x4233('0x29')]?_0x40c4ad[_0x4233('0x26')]:_0x2034db[_0x4233('0x25')];if(_0x27f403['query'][_0x4233('0x33')]){_0x40c4ad[_0x4233('0x34')]=[{'all':!![]}];}_0x40c4ad=_[_0x4233('0x2f')]({},_0x40c4ad,_0x27f403[_0x4233('0x31')]);return db[_0x4233('0x36')][_0x4233('0x37')](_0x40c4ad)[_0x4233('0x11')](handleEntityNotFound(_0x4e8b62,null))[_0x4233('0x11')](respondWithResult(_0x4e8b62,null))[_0x4233('0x38')](handleError(_0x4e8b62,null));};exports['create']=function(_0x135991,_0x394db3){return db['SquareProject']['create'](_0x135991[_0x4233('0x39')],{})[_0x4233('0x11')](function(_0x108fc3){var _0x26c2fb=_0x135991[_0x4233('0x3a')][_0x4233('0x13')]({'plain':!![]});if(!_0x26c2fb)throw new Error(_0x4233('0x3b'));if(_0x26c2fb[_0x4233('0x3c')]===_0x4233('0x3a')){var _0x2ecc5b=_0x108fc3['get']({'plain':!![]});var _0x5b45e1=_0x4233('0x14');return db['UserProfileSection'][_0x4233('0x37')]({'where':{'name':_0x5b45e1,'userProfileId':_0x26c2fb[_0x4233('0x3d')]},'raw':!![]})['then'](function(_0x2eb983){if(_0x2eb983&&_0x2eb983[_0x4233('0x3e')]===0x0){return db[_0x4233('0x3f')]['create']({'name':_0x2ecc5b[_0x4233('0x1b')],'resourceId':_0x2ecc5b['id'],'type':_0x2eb983[_0x4233('0x1b')],'sectionId':_0x2eb983['id']},{})[_0x4233('0x11')](function(){return _0x108fc3;});}else{return _0x108fc3;}})[_0x4233('0x38')](function(_0x3b5aaa){logger[_0x4233('0x19')](_0x4233('0x40'),_0x3b5aaa);throw _0x3b5aaa;});}return _0x108fc3;})[_0x4233('0x11')](respondWithResult(_0x394db3,0xc9))[_0x4233('0x38')](handleError(_0x394db3,null));};exports[_0x4233('0x10')]=function(_0x5c66bd,_0x205525){if(_0x5c66bd[_0x4233('0x39')]['id']){delete _0x5c66bd[_0x4233('0x39')]['id'];}return db['SquareProject'][_0x4233('0x37')]({'where':{'id':_0x5c66bd[_0x4233('0x41')]['id']}})[_0x4233('0x11')](handleEntityNotFound(_0x205525,null))[_0x4233('0x11')](saveUpdates(_0x5c66bd['body'],null))[_0x4233('0x11')](function(_0x168145){if(!_0x168145)return;var _0x4f90cc=_0x168145[_0x4233('0x13')]({'plain':!![]});return _0x4f90cc;})['then'](function(_0x5d118f){var _0x3da905=new Redis(config[_0x4233('0x4')]);_0x3da905[_0x4233('0x15')]('agi',JSON['stringify'](_[_0x4233('0x2d')](_0x5d118f,['id',_0x4233('0x1b'),_0x4233('0x42')])));return _0x5d118f;})[_0x4233('0x11')](respondWithResult(_0x205525,null))['catch'](handleError(_0x205525,null));};exports[_0x4233('0x12')]=function(_0x4a16a8,_0x1d6764){return db['SquareProject'][_0x4233('0x37')]({'where':{'id':_0x4a16a8['params']['id']}})[_0x4233('0x11')](handleEntityNotFound(_0x1d6764,null))['then'](removeEntity(_0x1d6764,null))['catch'](handleError(_0x1d6764,null));}; \ No newline at end of file +var _0x8107=['status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','get','SquareProjects','UserProfileResource','publish','stringify','end','name','send','index','map','SquareProject','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','catch','show','rawAttributes','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','params','pick','lodash','ioredis','../../config/logger','api','redis','defaults','socket.io-emitter','./squareProject.socket','register'];(function(_0x57c9a9,_0x48c040){var _0x19a608=function(_0x671481){while(--_0x671481){_0x57c9a9['push'](_0x57c9a9['shift']());}};_0x19a608(++_0x48c040);}(_0x8107,0xbd));var _0x7810=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0x8107[_0x236c89];return _0x3b2a15;};'use strict';var _=require(_0x7810('0x0'));var Redis=require(_0x7810('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x7810('0x2'))(_0x7810('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x7810('0x4')]=_[_0x7810('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7810('0x6'))(new Redis(config[_0x7810('0x4')]));require(_0x7810('0x7'))[_0x7810('0x8')](socket);function respondWithResult(_0x5acdb3,_0x527222){_0x527222=_0x527222||0xc8;return function(_0x4528ca){if(_0x4528ca){return _0x5acdb3[_0x7810('0x9')](_0x527222)['json'](_0x4528ca);}};}function respondWithFilteredResult(_0x2fae83,_0x10114f){return function(_0x58ca4e){if(_0x58ca4e){var _0x19b234=typeof _0x10114f[_0x7810('0xa')]===_0x7810('0xb')&&typeof _0x10114f[_0x7810('0xc')]===_0x7810('0xb');var _0x33a7bd=_0x58ca4e[_0x7810('0xd')];var _0x2535a3=_0x19b234?0x0:_0x10114f['offset'];var _0xf09584=_0x19b234?_0x58ca4e[_0x7810('0xd')]:_0x10114f[_0x7810('0xa')]+_0x10114f[_0x7810('0xc')];var _0x1277c0;if(_0xf09584>=_0x33a7bd){_0xf09584=_0x33a7bd;_0x1277c0=0xc8;}else{_0x1277c0=0xce;}_0x2fae83[_0x7810('0x9')](_0x1277c0);return _0x2fae83[_0x7810('0xe')](_0x7810('0xf'),_0x2535a3+'-'+_0xf09584+'/'+_0x33a7bd)[_0x7810('0x10')](_0x58ca4e);}return null;};}function saveUpdates(_0x5eac77){return function(_0xa3140b){if(_0xa3140b){return _0xa3140b[_0x7810('0x11')](_0x5eac77)[_0x7810('0x12')](function(_0x6cfd2f){return _0x6cfd2f;});}return null;};}function removeEntity(_0x4f7509){return function(_0x259fd5){if(_0x259fd5){return _0x259fd5[_0x7810('0x13')]()['then'](function(){var _0x2095b9=_0x259fd5[_0x7810('0x14')]({'plain':!![]});var _0xd9baf=_0x7810('0x15');return db[_0x7810('0x16')]['destroy']({'where':{'type':_0xd9baf,'resourceId':_0x2095b9['id']}})[_0x7810('0x12')](function(){return _0x259fd5;});})[_0x7810('0x12')](function(){var _0x4a777d=new Redis(config[_0x7810('0x4')]);_0x4a777d[_0x7810('0x17')]('agi',JSON[_0x7810('0x18')]({'id':_0x259fd5['id'],'deleted':!![]}));})[_0x7810('0x12')](function(){_0x4f7509['status'](0xcc)[_0x7810('0x19')]();});}};}function handleEntityNotFound(_0x1a6a58){return function(_0x3df913){if(!_0x3df913){_0x1a6a58['sendStatus'](0x194);}return _0x3df913;};}function handleError(_0x3306a5,_0x21a453){_0x21a453=_0x21a453||0x1f4;return function(_0xfa640b){logger['error'](_0xfa640b['stack']);if(_0xfa640b[_0x7810('0x1a')]){delete _0xfa640b[_0x7810('0x1a')];}_0x3306a5[_0x7810('0x9')](_0x21a453)[_0x7810('0x1b')](_0xfa640b);};}exports[_0x7810('0x1c')]=function(_0x21b73b,_0x303750){var _0x509802={},_0x23a5c3={},_0x501246={'count':0x0,'rows':[]};var _0x5ec614=_[_0x7810('0x1d')](db[_0x7810('0x1e')]['rawAttributes'],function(_0x5423b7){return{'name':_0x5423b7['fieldName'],'type':_0x5423b7['type'][_0x7810('0x1f')]};});_0x23a5c3[_0x7810('0x20')]=_['map'](_0x5ec614,_0x7810('0x1a'));_0x23a5c3[_0x7810('0x21')]=_[_0x7810('0x22')](_0x21b73b[_0x7810('0x21')]);_0x23a5c3[_0x7810('0x23')]=_[_0x7810('0x24')](_0x23a5c3[_0x7810('0x20')],_0x23a5c3['query']);_0x509802[_0x7810('0x25')]=_['intersection'](_0x23a5c3[_0x7810('0x20')],qs[_0x7810('0x26')](_0x21b73b[_0x7810('0x21')][_0x7810('0x26')]));_0x509802['attributes']=_0x509802[_0x7810('0x25')]['length']?_0x509802[_0x7810('0x25')]:_0x23a5c3['model'];if(!_0x21b73b[_0x7810('0x21')][_0x7810('0x27')](_0x7810('0x28'))){_0x509802[_0x7810('0xc')]=qs[_0x7810('0xc')](_0x21b73b[_0x7810('0x21')][_0x7810('0xc')]);_0x509802[_0x7810('0xa')]=qs[_0x7810('0xa')](_0x21b73b[_0x7810('0x21')]['offset']);}_0x509802[_0x7810('0x29')]=qs[_0x7810('0x2a')](_0x21b73b[_0x7810('0x21')][_0x7810('0x2a')]);_0x509802[_0x7810('0x2b')]=qs[_0x7810('0x23')](_['pick'](_0x21b73b['query'],_0x23a5c3[_0x7810('0x23')]),_0x5ec614);if(_0x21b73b[_0x7810('0x21')][_0x7810('0x2c')]){_0x509802['where']=_[_0x7810('0x2d')](_0x509802['where'],{'$or':_[_0x7810('0x1d')](_0x5ec614,function(_0x5efee6){if(_0x5efee6[_0x7810('0x2e')]!==_0x7810('0x2f')){var _0x17ca39={};_0x17ca39[_0x5efee6['name']]={'$like':'%'+_0x21b73b['query'][_0x7810('0x2c')]+'%'};return _0x17ca39;}})});}_0x509802=_[_0x7810('0x2d')]({},_0x509802,_0x21b73b[_0x7810('0x30')]);var _0x176ebe={'where':_0x509802[_0x7810('0x2b')]};return db[_0x7810('0x1e')]['count'](_0x176ebe)[_0x7810('0x12')](function(_0x2cc0e9){_0x501246[_0x7810('0xd')]=_0x2cc0e9;if(_0x21b73b[_0x7810('0x21')][_0x7810('0x31')]){_0x509802['include']=[{'all':!![]}];}return db[_0x7810('0x1e')]['findAll'](_0x509802);})[_0x7810('0x12')](function(_0x2d82ff){_0x501246['rows']=_0x2d82ff;return _0x501246;})[_0x7810('0x12')](respondWithFilteredResult(_0x303750,_0x509802))[_0x7810('0x32')](handleError(_0x303750,null));};exports[_0x7810('0x33')]=function(_0x67fd9a,_0x49884c){var _0xa47b72={'raw':![],'where':{'id':_0x67fd9a['params']['id']}},_0x2d62e0={};_0x2d62e0[_0x7810('0x20')]=_[_0x7810('0x22')](db[_0x7810('0x1e')][_0x7810('0x34')]);_0x2d62e0[_0x7810('0x21')]=_[_0x7810('0x22')](_0x67fd9a['query']);_0x2d62e0[_0x7810('0x23')]=_['intersection'](_0x2d62e0[_0x7810('0x20')],_0x2d62e0['query']);_0xa47b72[_0x7810('0x25')]=_[_0x7810('0x24')](_0x2d62e0['model'],qs['fields'](_0x67fd9a[_0x7810('0x21')]['fields']));_0xa47b72['attributes']=_0xa47b72['attributes']['length']?_0xa47b72[_0x7810('0x25')]:_0x2d62e0['model'];if(_0x67fd9a[_0x7810('0x21')][_0x7810('0x31')]){_0xa47b72[_0x7810('0x35')]=[{'all':!![]}];}_0xa47b72=_[_0x7810('0x2d')]({},_0xa47b72,_0x67fd9a[_0x7810('0x30')]);return db[_0x7810('0x1e')]['find'](_0xa47b72)['then'](handleEntityNotFound(_0x49884c,null))[_0x7810('0x12')](respondWithResult(_0x49884c,null))[_0x7810('0x32')](handleError(_0x49884c,null));};exports[_0x7810('0x36')]=function(_0x2e0362,_0x269fd5){return db['SquareProject']['create'](_0x2e0362[_0x7810('0x37')],{})[_0x7810('0x12')](function(_0xafdff5){var _0x16f2ee=_0x2e0362[_0x7810('0x38')]['get']({'plain':!![]});if(!_0x16f2ee)throw new Error(_0x7810('0x39'));if(_0x16f2ee[_0x7810('0x3a')]===_0x7810('0x38')){var _0x3090d0=_0xafdff5[_0x7810('0x14')]({'plain':!![]});var _0x6daa93=_0x7810('0x15');return db[_0x7810('0x3b')][_0x7810('0x3c')]({'where':{'name':_0x6daa93,'userProfileId':_0x16f2ee[_0x7810('0x3d')]},'raw':!![]})[_0x7810('0x12')](function(_0x595904){if(_0x595904&&_0x595904[_0x7810('0x3e')]===0x0){return db[_0x7810('0x16')][_0x7810('0x36')]({'name':_0x3090d0[_0x7810('0x1a')],'resourceId':_0x3090d0['id'],'type':_0x595904[_0x7810('0x1a')],'sectionId':_0x595904['id']},{})[_0x7810('0x12')](function(){return _0xafdff5;});}else{return _0xafdff5;}})[_0x7810('0x32')](function(_0x147b95){logger[_0x7810('0x3f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x147b95);throw _0x147b95;});}return _0xafdff5;})[_0x7810('0x12')](respondWithResult(_0x269fd5,0xc9))['catch'](handleError(_0x269fd5,null));};exports[_0x7810('0x11')]=function(_0x4e9b80,_0xd76ba2){if(_0x4e9b80['body']['id']){delete _0x4e9b80[_0x7810('0x37')]['id'];}return db['SquareProject'][_0x7810('0x3c')]({'where':{'id':_0x4e9b80[_0x7810('0x40')]['id']}})[_0x7810('0x12')](handleEntityNotFound(_0xd76ba2,null))[_0x7810('0x12')](saveUpdates(_0x4e9b80[_0x7810('0x37')],null))[_0x7810('0x12')](function(_0x484958){if(!_0x484958)return;var _0x4a4586=_0x484958[_0x7810('0x14')]({'plain':!![]});return _0x4a4586;})[_0x7810('0x12')](function(_0x407c8c){var _0x2e638f=new Redis(config[_0x7810('0x4')]);_0x2e638f[_0x7810('0x17')]('agi',JSON['stringify'](_[_0x7810('0x41')](_0x407c8c,['id','name','production'])));return _0x407c8c;})[_0x7810('0x12')](respondWithResult(_0xd76ba2,null))[_0x7810('0x32')](handleError(_0xd76ba2,null));};exports['destroy']=function(_0x5dc5f9,_0x58c97c){return db['SquareProject'][_0x7810('0x3c')]({'where':{'id':_0x5dc5f9[_0x7810('0x40')]['id']}})[_0x7810('0x12')](handleEntityNotFound(_0x58c97c,null))[_0x7810('0x12')](removeEntity(_0x58c97c,null))[_0x7810('0x32')](handleError(_0x58c97c,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 1c75122..e99cc24 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 _0x3eff=['update','remove','emit','hasOwnProperty','events','../../mysqldb','SquareProject','save'];(function(_0x76fe56,_0x5b5954){var _0x6174e7=function(_0x4caaec){while(--_0x4caaec){_0x76fe56['push'](_0x76fe56['shift']());}};_0x6174e7(++_0x5b5954);}(_0x3eff,0x74));var _0xf3ef=function(_0x5660d5,_0x235c27){_0x5660d5=_0x5660d5-0x0;var _0x2a144d=_0x3eff[_0x5660d5];return _0x2a144d;};'use strict';var EventEmitter=require(_0xf3ef('0x0'));var SquareProject=require(_0xf3ef('0x1'))['db'][_0xf3ef('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf3ef('0x3'),'afterUpdate':_0xf3ef('0x4'),'afterDestroy':_0xf3ef('0x5')};function emitEvent(_0x24440d){return function(_0x3cc581,_0x42a9c5,_0x5eb3fd){SquareProjectEvents[_0xf3ef('0x6')](_0x24440d+':'+_0x3cc581['id'],_0x3cc581);SquareProjectEvents['emit'](_0x24440d,_0x3cc581);_0x5eb3fd(null);};}for(var e in events){if(events[_0xf3ef('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x4a45=['emit','hasOwnProperty','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove'];(function(_0x94f5f7,_0x7fc74d){var _0x5cc1d8=function(_0x2a2043){while(--_0x2a2043){_0x94f5f7['push'](_0x94f5f7['shift']());}};_0x5cc1d8(++_0x7fc74d);}(_0x4a45,0x189));var _0x54a4=function(_0x3e3be4,_0x4fa051){_0x3e3be4=_0x3e3be4-0x0;var _0x5807f8=_0x4a45[_0x3e3be4];return _0x5807f8;};'use strict';var EventEmitter=require(_0x54a4('0x0'));var SquareProject=require(_0x54a4('0x1'))['db'][_0x54a4('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x54a4('0x3')](0x0);var events={'afterCreate':_0x54a4('0x4'),'afterUpdate':_0x54a4('0x5'),'afterDestroy':_0x54a4('0x6')};function emitEvent(_0x4b4850){return function(_0x31241e,_0x73bd6a,_0x32e834){SquareProjectEvents[_0x54a4('0x7')](_0x4b4850+':'+_0x31241e['id'],_0x31241e);SquareProjectEvents[_0x54a4('0x7')](_0x4b4850,_0x31241e);_0x32e834(null);};}for(var e in events){if(events[_0x54a4('0x8')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x54a4('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 5e6c29b..558b0d0 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 _0x1a49=['define','SquareProject','square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./squareProject.attributes'];(function(_0x2d7adf,_0x2336b8){var _0xa42709=function(_0x2ed619){while(--_0x2ed619){_0x2d7adf['push'](_0x2d7adf['shift']());}};_0xa42709(++_0x2336b8);}(_0x1a49,0xf5));var _0x91a4=function(_0x12e69b,_0x56ac6b){_0x12e69b=_0x12e69b-0x0;var _0xfd0c0c=_0x1a49[_0x12e69b];return _0xfd0c0c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x91a4('0x0'))('api');var moment=require(_0x91a4('0x1'));var BPromise=require(_0x91a4('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91a4('0x3'));var rimraf=require(_0x91a4('0x4'));var config=require(_0x91a4('0x5'));var attributes=require(_0x91a4('0x6'));module['exports']=function(_0x1f20d0,_0x3b50bf){return _0x1f20d0[_0x91a4('0x7')](_0x91a4('0x8'),attributes,{'tableName':_0x91a4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3c80c3,_0x2d63c1,_0x12b746){if(_0x3c80c3[_0x91a4('0xa')]('preproduction')){_0x3c80c3[_0x91a4('0xb')]=moment()[_0x91a4('0xc')](_0x91a4('0xd'));}if(_0x3c80c3[_0x91a4('0xa')]('production')){_0x3c80c3['publishedAt']=moment()[_0x91a4('0xc')](_0x91a4('0xd'));}_0x12b746(null,_0x3c80c3);}}});}; \ No newline at end of file +var _0x01f4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','changed','preproduction','production','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x1c6856,_0x8786ba){var _0x310ca5=function(_0x5d32b6){while(--_0x5d32b6){_0x1c6856['push'](_0x1c6856['shift']());}};_0x310ca5(++_0x8786ba);}(_0x01f4,0x1be));var _0x401f=function(_0x2ddffe,_0x34ee64){_0x2ddffe=_0x2ddffe-0x0;var _0x7a7604=_0x01f4[_0x2ddffe];return _0x7a7604;};'use strict';var _=require(_0x401f('0x0'));var util=require(_0x401f('0x1'));var logger=require(_0x401f('0x2'))(_0x401f('0x3'));var moment=require(_0x401f('0x4'));var BPromise=require(_0x401f('0x5'));var rp=require(_0x401f('0x6'));var fs=require('fs');var path=require(_0x401f('0x7'));var rimraf=require(_0x401f('0x8'));var config=require(_0x401f('0x9'));var attributes=require(_0x401f('0xa'));module[_0x401f('0xb')]=function(_0xf89202,_0x1c1816){return _0xf89202[_0x401f('0xc')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1dc3e7,_0xb49140,_0x2ec333){if(_0x1dc3e7[_0x401f('0xd')](_0x401f('0xe'))){_0x1dc3e7['savedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1dc3e7[_0x401f('0xd')](_0x401f('0xf'))){_0x1dc3e7['publishedAt']=moment()[_0x401f('0x10')](_0x401f('0x11'));}_0x2ec333(null,_0x1dc3e7);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 14524ae..4c814aa 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 _0xc9a7=['stringify','catch','error','message','find','then','ShowSquareProject','debug','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','GetSquareProjects','SquareProject','findAll','options','raw','where','limit','map','attributes','include','model','info'];(function(_0x158b4f,_0x1cd927){var _0x175036=function(_0x4ea028){while(--_0x4ea028){_0x158b4f['push'](_0x158b4f['shift']());}};_0x175036(++_0x1cd927);}(_0xc9a7,0x19e));var _0x7c9a=function(_0x1c4867,_0x55af32){_0x1c4867=_0x1c4867-0x0;var _0x347e34=_0xc9a7[_0x1c4867];return _0x347e34;};'use strict';var _=require(_0x7c9a('0x0'));var Redis=require(_0x7c9a('0x1'));var db=require(_0x7c9a('0x2'))['db'];var logger=require(_0x7c9a('0x3'))('rpc');var config=require(_0x7c9a('0x4'));config[_0x7c9a('0x5')]=_[_0x7c9a('0x6')](config[_0x7c9a('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x7c9a('0x7'))(new Redis(config[_0x7c9a('0x5')]));require(_0x7c9a('0x8'))['register'](socket);exports[_0x7c9a('0x9')]=function(_0x4c094b){var _0x5be938=this;return new Promise(function(_0x46108b,_0x576c96){return db[_0x7c9a('0xa')][_0x7c9a('0xb')]({'raw':_0x4c094b[_0x7c9a('0xc')]?_0x4c094b[_0x7c9a('0xc')][_0x7c9a('0xd')]===undefined?!![]:![]:!![],'where':_0x4c094b[_0x7c9a('0xc')]?_0x4c094b[_0x7c9a('0xc')][_0x7c9a('0xe')]||null:null,'attributes':_0x4c094b[_0x7c9a('0xc')]?_0x4c094b[_0x7c9a('0xc')]['attributes']||null:null,'limit':_0x4c094b[_0x7c9a('0xc')]?_0x4c094b[_0x7c9a('0xc')][_0x7c9a('0xf')]||null:null,'include':_0x4c094b[_0x7c9a('0xc')]?_0x4c094b['options']['include']?_[_0x7c9a('0x10')](_0x4c094b[_0x7c9a('0xc')]['include'],function(_0xa0e130){return{'model':db[_0xa0e130['model']],'as':_0xa0e130['as'],'attributes':_0xa0e130[_0x7c9a('0x11')],'include':_0xa0e130[_0x7c9a('0x12')]?_['map'](_0xa0e130[_0x7c9a('0x12')],function(_0x4860c8){return{'model':db[_0x4860c8[_0x7c9a('0x13')]],'as':_0x4860c8['as'],'attributes':_0x4860c8[_0x7c9a('0x11')],'include':_0x4860c8[_0x7c9a('0x12')]?_[_0x7c9a('0x10')](_0x4860c8['include'],function(_0xe5d328){return{'model':db[_0xe5d328[_0x7c9a('0x13')]],'as':_0xe5d328['as'],'attributes':_0xe5d328[_0x7c9a('0x11')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c4b10){logger[_0x7c9a('0x14')](_0x7c9a('0x9'),_0x4c094b);logger['debug'](_0x7c9a('0x9'),_0x4c094b,JSON[_0x7c9a('0x15')](_0x1c4b10));_0x46108b(_0x1c4b10);})[_0x7c9a('0x16')](function(_0x1ee367){logger[_0x7c9a('0x17')](_0x7c9a('0x9'),_0x1ee367[_0x7c9a('0x18')],_0x4c094b);_0x576c96(_0x5be938[_0x7c9a('0x17')](0x1f4,_0x1ee367[_0x7c9a('0x18')]));});});};exports['ShowSquareProject']=function(_0x1fa1cf){var _0x37af58=this;return new Promise(function(_0x3c59a8,_0x44473f){return db[_0x7c9a('0xa')][_0x7c9a('0x19')]({'raw':_0x1fa1cf[_0x7c9a('0xc')]?_0x1fa1cf[_0x7c9a('0xc')][_0x7c9a('0xd')]===undefined?!![]:![]:!![],'where':_0x1fa1cf[_0x7c9a('0xc')]?_0x1fa1cf[_0x7c9a('0xc')][_0x7c9a('0xe')]||null:null,'attributes':_0x1fa1cf[_0x7c9a('0xc')]?_0x1fa1cf[_0x7c9a('0xc')][_0x7c9a('0x11')]||null:null,'include':_0x1fa1cf[_0x7c9a('0xc')]?_0x1fa1cf['options'][_0x7c9a('0x12')]?_[_0x7c9a('0x10')](_0x1fa1cf['options'][_0x7c9a('0x12')],function(_0x35af3a){return{'model':db[_0x35af3a[_0x7c9a('0x13')]],'as':_0x35af3a['as'],'attributes':_0x35af3a[_0x7c9a('0x11')],'include':_0x35af3a[_0x7c9a('0x12')]?_[_0x7c9a('0x10')](_0x35af3a[_0x7c9a('0x12')],function(_0x3c2be2){return{'model':db[_0x3c2be2[_0x7c9a('0x13')]],'as':_0x3c2be2['as'],'attributes':_0x3c2be2['attributes'],'include':_0x3c2be2[_0x7c9a('0x12')]?_[_0x7c9a('0x10')](_0x3c2be2[_0x7c9a('0x12')],function(_0x5cf83c){return{'model':db[_0x5cf83c[_0x7c9a('0x13')]],'as':_0x5cf83c['as'],'attributes':_0x5cf83c[_0x7c9a('0x11')]};}):[]};}):[]};}):[]:[]})[_0x7c9a('0x1a')](function(_0x14a8ef){logger[_0x7c9a('0x14')](_0x7c9a('0x1b'),_0x1fa1cf);logger[_0x7c9a('0x1c')](_0x7c9a('0x1b'),_0x1fa1cf,JSON[_0x7c9a('0x15')](_0x14a8ef));_0x3c59a8(_0x14a8ef);})['catch'](function(_0x3bd407){logger[_0x7c9a('0x17')](_0x7c9a('0x1b'),_0x3bd407[_0x7c9a('0x18')],_0x1fa1cf);_0x44473f(_0x37af58[_0x7c9a('0x17')](0x1f4,_0x3bd407[_0x7c9a('0x18')]));});});}; \ No newline at end of file +var _0x7df7=['raw','where','limit','include','map','attributes','model','then','info','debug','stringify','catch','error','message','ShowSquareProject','lodash','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','options'];(function(_0x3616a4,_0x2b89fa){var _0x539472=function(_0x250f5e){while(--_0x250f5e){_0x3616a4['push'](_0x3616a4['shift']());}};_0x539472(++_0x2b89fa);}(_0x7df7,0x66));var _0x77df=function(_0x485c80,_0x12da03){_0x485c80=_0x485c80-0x0;var _0x371437=_0x7df7[_0x485c80];return _0x371437;};'use strict';var _=require(_0x77df('0x0'));var Redis=require('ioredis');var db=require(_0x77df('0x1'))['db'];var logger=require(_0x77df('0x2'))(_0x77df('0x3'));var config=require(_0x77df('0x4'));config[_0x77df('0x5')]=_[_0x77df('0x6')](config[_0x77df('0x5')],{'host':_0x77df('0x7'),'port':0x18eb});var socket=require(_0x77df('0x8'))(new Redis(config[_0x77df('0x5')]));require(_0x77df('0x9'))[_0x77df('0xa')](socket);exports[_0x77df('0xb')]=function(_0x1b2f10){var _0x867786=this;return new Promise(function(_0xb0e429,_0x41d9a4){return db[_0x77df('0xc')]['findAll']({'raw':_0x1b2f10[_0x77df('0xd')]?_0x1b2f10[_0x77df('0xd')][_0x77df('0xe')]===undefined?!![]:![]:!![],'where':_0x1b2f10[_0x77df('0xd')]?_0x1b2f10[_0x77df('0xd')][_0x77df('0xf')]||null:null,'attributes':_0x1b2f10[_0x77df('0xd')]?_0x1b2f10[_0x77df('0xd')]['attributes']||null:null,'limit':_0x1b2f10[_0x77df('0xd')]?_0x1b2f10[_0x77df('0xd')][_0x77df('0x10')]||null:null,'include':_0x1b2f10['options']?_0x1b2f10['options'][_0x77df('0x11')]?_[_0x77df('0x12')](_0x1b2f10[_0x77df('0xd')][_0x77df('0x11')],function(_0x21ed7c){return{'model':db[_0x21ed7c['model']],'as':_0x21ed7c['as'],'attributes':_0x21ed7c[_0x77df('0x13')],'include':_0x21ed7c[_0x77df('0x11')]?_[_0x77df('0x12')](_0x21ed7c[_0x77df('0x11')],function(_0x49cb85){return{'model':db[_0x49cb85['model']],'as':_0x49cb85['as'],'attributes':_0x49cb85[_0x77df('0x13')],'include':_0x49cb85[_0x77df('0x11')]?_['map'](_0x49cb85[_0x77df('0x11')],function(_0x4cb8cf){return{'model':db[_0x4cb8cf[_0x77df('0x14')]],'as':_0x4cb8cf['as'],'attributes':_0x4cb8cf[_0x77df('0x13')]};}):[]};}):[]};}):[]:[]})[_0x77df('0x15')](function(_0x3e629b){logger[_0x77df('0x16')](_0x77df('0xb'),_0x1b2f10);logger[_0x77df('0x17')](_0x77df('0xb'),_0x1b2f10,JSON[_0x77df('0x18')](_0x3e629b));_0xb0e429(_0x3e629b);})[_0x77df('0x19')](function(_0x3864d6){logger[_0x77df('0x1a')](_0x77df('0xb'),_0x3864d6[_0x77df('0x1b')],_0x1b2f10);_0x41d9a4(_0x867786[_0x77df('0x1a')](0x1f4,_0x3864d6[_0x77df('0x1b')]));});});};exports[_0x77df('0x1c')]=function(_0x2bb0bb){var _0x466103=this;return new Promise(function(_0x2798f4,_0x383800){return db['SquareProject']['find']({'raw':_0x2bb0bb['options']?_0x2bb0bb[_0x77df('0xd')][_0x77df('0xe')]===undefined?!![]:![]:!![],'where':_0x2bb0bb['options']?_0x2bb0bb[_0x77df('0xd')][_0x77df('0xf')]||null:null,'attributes':_0x2bb0bb[_0x77df('0xd')]?_0x2bb0bb[_0x77df('0xd')][_0x77df('0x13')]||null:null,'include':_0x2bb0bb[_0x77df('0xd')]?_0x2bb0bb['options'][_0x77df('0x11')]?_['map'](_0x2bb0bb['options'][_0x77df('0x11')],function(_0x2b6600){return{'model':db[_0x2b6600[_0x77df('0x14')]],'as':_0x2b6600['as'],'attributes':_0x2b6600[_0x77df('0x13')],'include':_0x2b6600[_0x77df('0x11')]?_['map'](_0x2b6600[_0x77df('0x11')],function(_0x293f4a){return{'model':db[_0x293f4a[_0x77df('0x14')]],'as':_0x293f4a['as'],'attributes':_0x293f4a[_0x77df('0x13')],'include':_0x293f4a[_0x77df('0x11')]?_['map'](_0x293f4a[_0x77df('0x11')],function(_0x5710c4){return{'model':db[_0x5710c4['model']],'as':_0x5710c4['as'],'attributes':_0x5710c4[_0x77df('0x13')]};}):[]};}):[]};}):[]:[]})[_0x77df('0x15')](function(_0xdcd643){logger[_0x77df('0x16')](_0x77df('0x1c'),_0x2bb0bb);logger[_0x77df('0x17')](_0x77df('0x1c'),_0x2bb0bb,JSON['stringify'](_0xdcd643));_0x2798f4(_0xdcd643);})['catch'](function(_0x416969){logger['error'](_0x77df('0x1c'),_0x416969['message'],_0x2bb0bb);_0x383800(_0x466103['error'](0x1f4,_0x416969['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 134b92b..097b64b 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 _0x8098=['register','length','./squareProject.events','save','update','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8098,0x16a));var _0x8809=function(_0x55d8f2,_0x3196a9){_0x55d8f2=_0x55d8f2-0x0;var _0x29683e=_0x8098[_0x55d8f2];return _0x29683e;};'use strict';var SquareProjectEvents=require(_0x8809('0x0'));var events=[_0x8809('0x1'),'remove',_0x8809('0x2')];function createListener(_0x4f46d7,_0xd02475){return function(_0x1f7098){_0xd02475[_0x8809('0x3')](_0x4f46d7,_0x1f7098);};}function removeListener(_0x3158fd,_0x664ead){return function(){SquareProjectEvents['removeListener'](_0x3158fd,_0x664ead);};}exports[_0x8809('0x4')]=function(_0x4db67c){for(var _0x184d7e=0x0,_0xb2e1ab=events[_0x8809('0x5')];_0x184d7e<_0xb2e1ab;_0x184d7e++){var _0x249029=events[_0x184d7e];var _0x11cf7a=createListener('squareProject:'+_0x249029,_0x4db67c);SquareProjectEvents['on'](_0x249029,_0x11cf7a);}}; \ No newline at end of file +var _0x4cc6=['removeListener','register','./squareProject.events','save','remove','update','emit'];(function(_0x9935f1,_0xfe5642){var _0x2e88c6=function(_0x497651){while(--_0x497651){_0x9935f1['push'](_0x9935f1['shift']());}};_0x2e88c6(++_0xfe5642);}(_0x4cc6,0xd4));var _0x64cc=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x4cc6[_0x1969a7];return _0x3d665f;};'use strict';var SquareProjectEvents=require(_0x64cc('0x0'));var events=[_0x64cc('0x1'),_0x64cc('0x2'),_0x64cc('0x3')];function createListener(_0x55f3db,_0x4764df){return function(_0x3e2684){_0x4764df[_0x64cc('0x4')](_0x55f3db,_0x3e2684);};}function removeListener(_0x317e44,_0x4682db){return function(){SquareProjectEvents[_0x64cc('0x5')](_0x317e44,_0x4682db);};}exports[_0x64cc('0x6')]=function(_0x4b12c3){for(var _0x40778d=0x0,_0x309c7f=events['length'];_0x40778d<_0x309c7f;_0x40778d++){var _0x2ffcb2=events[_0x40778d];var _0x57b196=createListener('squareProject:'+_0x2ffcb2,_0x4b12c3);SquareProjectEvents['on'](_0x2ffcb2,_0x57b196);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index d83b891..d261bc4 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 _0x0295=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0295,0x1f0));var _0x5029=function(_0x90e575,_0x48c2ec){_0x90e575=_0x90e575-0x0;var _0x1aae60=_0x0295[_0x90e575];return _0x1aae60;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5029('0x7')]('/:id/download',auth[_0x5029('0x8')](),controller['download']);router[_0x5029('0xa')]('/',auth['isAuthenticated'](),controller[_0x5029('0xb')]);router[_0x5029('0xc')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router; \ No newline at end of file +var _0xe14b=['Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','download','post','delete','destroy','exports','multer','util','express'];(function(_0x2823aa,_0x99aa49){var _0x5abe99=function(_0xffae65){while(--_0xffae65){_0x2823aa['push'](_0x2823aa['shift']());}};_0x5abe99(++_0x99aa49);}(_0xe14b,0x93));var _0xbe14=function(_0x5ad742,_0x54cf91){_0x5ad742=_0x5ad742-0x0;var _0x483ee1=_0xe14b[_0x5ad742];return _0x483ee1;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['get']('/:id/download',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xc')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xd')]);module[_0xbe14('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index f973237..ec90824 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 _0xeff8=['STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','exports'];(function(_0x1cb56b,_0x5cbfbc){var _0x462fdf=function(_0xb23d26){while(--_0xb23d26){_0x1cb56b['push'](_0x1cb56b['shift']());}};_0x462fdf(++_0x5cbfbc);}(_0xeff8,0x186));var _0x8eff=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xeff8[_0x138f59];return _0x3d114d;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x8eff('0x2')]},'calleridname':{'type':Sequelize[_0x8eff('0x2')]},'context':{'type':Sequelize[_0x8eff('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x8eff('0x2')]},'accountcode':{'type':Sequelize[_0x8eff('0x2')]},'dnid':{'type':Sequelize[_0x8eff('0x2')]},'projectName':{'type':Sequelize[_0x8eff('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x8eff('0x2')]},'savePath':{'type':Sequelize[_0x8eff('0x2')]},'format':{'type':Sequelize[_0x8eff('0x3')],'get':function(){var _0x323b2='';var _0x491f01=this[_0x8eff('0x4')](_0x8eff('0x5'));if(_0x491f01){_0x323b2=_0x491f01[_0x8eff('0x6')](_0x491f01[_0x8eff('0x7')]('.'));}return _0x323b2;}}}; \ No newline at end of file +var _0xf494=['STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','exports'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0xf494,0x1c6));var _0x4f49=function(_0x506d35,_0x4b5aaa){_0x506d35=_0x506d35-0x0;var _0x842728=_0xf494[_0x506d35];return _0x842728;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'uniqueid':{'type':Sequelize[_0x4f49('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4f49('0x2')]},'context':{'type':Sequelize[_0x4f49('0x2')]},'extension':{'type':Sequelize[_0x4f49('0x2')]},'priority':{'type':Sequelize[_0x4f49('0x2')]},'accountcode':{'type':Sequelize[_0x4f49('0x2')]},'dnid':{'type':Sequelize[_0x4f49('0x2')]},'projectName':{'type':Sequelize[_0x4f49('0x2')]},'saveName':{'type':Sequelize[_0x4f49('0x2')]},'filename':{'type':Sequelize[_0x4f49('0x2')]},'savePath':{'type':Sequelize[_0x4f49('0x2')]},'format':{'type':Sequelize[_0x4f49('0x3')],'get':function(){var _0x5eb186='';var _0x58e9a0=this[_0x4f49('0x4')](_0x4f49('0x5'));if(_0x58e9a0){_0x5eb186=_0x58e9a0[_0x4f49('0x6')](_0x58e9a0[_0x4f49('0x7')]('.'));}return _0x5eb186;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index a79e943..d59e836 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 _0x51bd=['ValidationError','SquareRecording\x20not\x20found','extname','unlink','destroy','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','end','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','SquareRecording','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize'];(function(_0x20f6e6,_0xae970){var _0x319291=function(_0x4f61be){while(--_0x4f61be){_0x20f6e6['push'](_0x20f6e6['shift']());}};_0x319291(++_0xae970);}(_0x51bd,0x1f2));var _0xd51b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x51bd[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd51b('0x0'));var rp=require(_0xd51b('0x1'));var moment=require(_0xd51b('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd51b('0x3'));var path=require(_0xd51b('0x4'));var sox=require(_0xd51b('0x5'));var csv=require(_0xd51b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd51b('0x7'));var _=require(_0xd51b('0x8'));var squel=require(_0xd51b('0x9'));var crypto=require('crypto');var jsforce=require(_0xd51b('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd51b('0xb'));var Papa=require(_0xd51b('0xc'));var Redis=require('ioredis');var authService=require(_0xd51b('0xd'));var qs=require(_0xd51b('0xe'));var as=require(_0xd51b('0xf'));var hardwareService=require(_0xd51b('0x10'));var logger=require('../../config/logger')(_0xd51b('0x11'));var utils=require(_0xd51b('0x12'));var config=require(_0xd51b('0x13'));var licenseUtil=require(_0xd51b('0x14'));var db=require(_0xd51b('0x15'))['db'];function respondWithStatusCode(_0x461ef2,_0x1c2ae3){_0x1c2ae3=_0x1c2ae3||0xcc;return function(_0x1e9cc5){if(_0x1e9cc5){return _0x461ef2['sendStatus'](_0x1c2ae3);}return _0x461ef2[_0xd51b('0x16')](_0x1c2ae3)['end']();};}function respondWithResult(_0x4e56b4,_0x9cda10){_0x9cda10=_0x9cda10||0xc8;return function(_0x153153){if(_0x153153){return _0x4e56b4['status'](_0x9cda10)['json'](_0x153153);}};}function respondWithFilteredResult(_0x4e10a6,_0x310a32){return function(_0x54b1c4){if(_0x54b1c4){var _0x4a6dea=typeof _0x310a32['offset']===_0xd51b('0x17')&&typeof _0x310a32['limit']===_0xd51b('0x17');var _0x6969da=_0x54b1c4[_0xd51b('0x18')];var _0x2f4081=_0x4a6dea?0x0:_0x310a32[_0xd51b('0x19')];var _0x274673=_0x4a6dea?_0x54b1c4[_0xd51b('0x18')]:_0x310a32[_0xd51b('0x19')]+_0x310a32[_0xd51b('0x1a')];var _0x16637f;if(_0x274673>=_0x6969da){_0x274673=_0x6969da;_0x16637f=0xc8;}else{_0x16637f=0xce;}_0x4e10a6[_0xd51b('0x16')](_0x16637f);return _0x4e10a6[_0xd51b('0x1b')](_0xd51b('0x1c'),_0x2f4081+'-'+_0x274673+'/'+_0x6969da)[_0xd51b('0x1d')](_0x54b1c4);}return null;};}function patchUpdates(_0x160908){return function(_0x34eacb){try{jsonpatch[_0xd51b('0x1e')](_0x34eacb,_0x160908,!![]);}catch(_0x214c6e){return BPromise[_0xd51b('0x1f')](_0x214c6e);}return _0x34eacb[_0xd51b('0x20')]();};}function saveUpdates(_0xd1ba1b,_0x2c0245){return function(_0x33837a){if(_0x33837a){return _0x33837a[_0xd51b('0x21')](_0xd1ba1b)[_0xd51b('0x22')](function(_0x1c1f21){return _0x1c1f21;});}return null;};}function removeEntity(_0x497c2e,_0x1bfd07){return function(_0x4b0973){if(_0x4b0973){return _0x4b0973['destroy']()['then'](function(){_0x497c2e[_0xd51b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18a8cb,_0x2f7ee0){return function(_0x295e61){if(!_0x295e61){_0x18a8cb[_0xd51b('0x23')](0x194);}return _0x295e61;};}function handleError(_0x5f2d8d,_0x30c43e){_0x30c43e=_0x30c43e||0x1f4;return function(_0x289b76){logger[_0xd51b('0x24')](_0x289b76[_0xd51b('0x25')]);if(_0x289b76[_0xd51b('0x26')]){delete _0x289b76[_0xd51b('0x26')];}_0x5f2d8d[_0xd51b('0x16')](_0x30c43e)[_0xd51b('0x27')](_0x289b76);};}exports[_0xd51b('0x28')]=function(_0x10bec8,_0x11d097){var _0x362823={},_0x3f9dde={},_0x1a3df7={'count':0x0,'rows':[]};var _0x196fa5=_['map'](db[_0xd51b('0x29')][_0xd51b('0x2a')],function(_0x309e22){return{'name':_0x309e22[_0xd51b('0x2b')],'type':_0x309e22[_0xd51b('0x2c')][_0xd51b('0x2d')]};});_0x3f9dde[_0xd51b('0x2e')]=_[_0xd51b('0x2f')](_0x196fa5,'name');_0x3f9dde[_0xd51b('0x30')]=_[_0xd51b('0x31')](_0x10bec8[_0xd51b('0x30')]);_0x3f9dde[_0xd51b('0x32')]=_['intersection'](_0x3f9dde[_0xd51b('0x2e')],_0x3f9dde[_0xd51b('0x30')]);_0x362823[_0xd51b('0x33')]=_[_0xd51b('0x34')](_0x3f9dde[_0xd51b('0x2e')],qs['fields'](_0x10bec8[_0xd51b('0x30')][_0xd51b('0x35')]));_0x362823[_0xd51b('0x33')]=_0x362823[_0xd51b('0x33')]['length']?_0x362823[_0xd51b('0x33')]:_0x3f9dde[_0xd51b('0x2e')];if(!_0x10bec8[_0xd51b('0x30')]['hasOwnProperty'](_0xd51b('0x36'))){_0x362823['limit']=qs[_0xd51b('0x1a')](_0x10bec8['query'][_0xd51b('0x1a')]);_0x362823[_0xd51b('0x19')]=qs[_0xd51b('0x19')](_0x10bec8[_0xd51b('0x30')][_0xd51b('0x19')]);}_0x362823[_0xd51b('0x37')]=qs[_0xd51b('0x38')](_0x10bec8[_0xd51b('0x30')][_0xd51b('0x38')]);_0x362823[_0xd51b('0x39')]=qs[_0xd51b('0x32')](_[_0xd51b('0x3a')](_0x10bec8[_0xd51b('0x30')],_0x3f9dde[_0xd51b('0x32')]),_0x196fa5);if(_0x10bec8[_0xd51b('0x30')][_0xd51b('0x3b')]){_0x362823[_0xd51b('0x39')]=_['merge'](_0x362823[_0xd51b('0x39')],{'$or':_[_0xd51b('0x2f')](_0x196fa5,function(_0x536929){if(_0x536929['type']!=='VIRTUAL'){var _0x345f51={};_0x345f51[_0x536929[_0xd51b('0x26')]]={'$like':'%'+_0x10bec8[_0xd51b('0x30')][_0xd51b('0x3b')]+'%'};return _0x345f51;}})});}_0x362823=_[_0xd51b('0x3c')]({},_0x362823,_0x10bec8[_0xd51b('0x3d')]);var _0x57ef29={'where':_0x362823[_0xd51b('0x39')]};return db[_0xd51b('0x29')][_0xd51b('0x18')](_0x57ef29)[_0xd51b('0x22')](function(_0x3915e6){_0x1a3df7[_0xd51b('0x18')]=_0x3915e6;if(_0x10bec8[_0xd51b('0x30')][_0xd51b('0x3e')]){_0x362823[_0xd51b('0x3f')]=[{'all':!![]}];}return db['SquareRecording'][_0xd51b('0x40')](_0x362823);})['then'](function(_0x5acab8){_0x1a3df7[_0xd51b('0x41')]=_0x5acab8;return _0x1a3df7;})[_0xd51b('0x22')](respondWithFilteredResult(_0x11d097,_0x362823))[_0xd51b('0x42')](handleError(_0x11d097,null));};exports[_0xd51b('0x43')]=function(_0x1d3765,_0x741c56){var _0x570569={'raw':!![],'where':{'id':_0x1d3765[_0xd51b('0x44')]['id']}},_0x3f52a9={};_0x3f52a9[_0xd51b('0x2e')]=_[_0xd51b('0x31')](db[_0xd51b('0x29')][_0xd51b('0x2a')]);_0x3f52a9['query']=_['keys'](_0x1d3765['query']);_0x3f52a9[_0xd51b('0x32')]=_[_0xd51b('0x34')](_0x3f52a9[_0xd51b('0x2e')],_0x3f52a9['query']);_0x570569[_0xd51b('0x33')]=_[_0xd51b('0x34')](_0x3f52a9[_0xd51b('0x2e')],qs[_0xd51b('0x35')](_0x1d3765[_0xd51b('0x30')][_0xd51b('0x35')]));_0x570569[_0xd51b('0x33')]=_0x570569[_0xd51b('0x33')][_0xd51b('0x45')]?_0x570569[_0xd51b('0x33')]:_0x3f52a9['model'];if(_0x1d3765[_0xd51b('0x30')][_0xd51b('0x3e')]){_0x570569[_0xd51b('0x3f')]=[{'all':!![]}];}_0x570569=_['merge']({},_0x570569,_0x1d3765['options']);return db[_0xd51b('0x29')]['find'](_0x570569)['then'](handleEntityNotFound(_0x741c56,null))[_0xd51b('0x22')](respondWithResult(_0x741c56,null))[_0xd51b('0x42')](handleError(_0x741c56,null));};exports[_0xd51b('0x46')]=function(_0x455d0d,_0x2ab7c9){return db[_0xd51b('0x29')][_0xd51b('0x46')](_0x455d0d[_0xd51b('0x47')],{})[_0xd51b('0x22')](respondWithResult(_0x2ab7c9,0xc9))[_0xd51b('0x42')](handleError(_0x2ab7c9,null));};exports[_0xd51b('0x21')]=function(_0x3d7905,_0x5f2d95){if(_0x3d7905[_0xd51b('0x47')]['id']){delete _0x3d7905[_0xd51b('0x47')]['id'];}return db[_0xd51b('0x29')][_0xd51b('0x48')]({'where':{'id':_0x3d7905[_0xd51b('0x44')]['id']}})[_0xd51b('0x22')](handleEntityNotFound(_0x5f2d95,null))[_0xd51b('0x22')](saveUpdates(_0x3d7905['body'],null))[_0xd51b('0x22')](respondWithResult(_0x5f2d95,null))[_0xd51b('0x42')](handleError(_0x5f2d95,null));};exports[_0xd51b('0x49')]=function(_0x26d2ae,_0x50fd99,_0x39e958){var _0x563dab=require(_0xd51b('0x4a'));var _0x181dbb=![];var _0x2e5c3a={};if(_0x26d2ae['query'][_0xd51b('0x2c')]&&_0x26d2ae['query'][_0xd51b('0x2c')]===_0xd51b('0x4b')){_0x2e5c3a['uniqueid']=_0x26d2ae['params']['id'];}else{_0x2e5c3a['id']=_0x26d2ae[_0xd51b('0x44')]['id'];}return db[_0xd51b('0x29')]['find']({'where':_0x2e5c3a,'attributes':['id',_0xd51b('0x4c'),_0xd51b('0x4d')],'raw':!![]})[_0xd51b('0x22')](handleEntityNotFound(_0x50fd99,null))[_0xd51b('0x22')](function(_0x1e1693){if(_0x1e1693){var _0xf7c776=_0x1e1693[_0xd51b('0x4c')];var _0x2d5210=util['format'](_0xd51b('0x4e'),_0xf7c776);if(fs[_0xd51b('0x4f')](_0x2d5210)){_0x181dbb=!![];return _0x563dab[_0xd51b('0x50')](_0x2d5210,_0xf7c776,config[_0xd51b('0x51')][_0xd51b('0x52')])['then'](function(){return _0x1e1693;});}return _0x1e1693;}})['then'](function(_0x18d7b6){if(_0x18d7b6){var _0x10f5a8=_0x18d7b6['savePath'];if(!fs['existsSync'](_0x10f5a8)){throw new db[(_0xd51b('0x53'))][(_0xd51b('0x54'))](_0xd51b('0x55'));}if(_0x18d7b6[_0xd51b('0x4d')]){return _0x50fd99[_0xd51b('0x49')](_0x10f5a8,_0x18d7b6[_0xd51b('0x4d')]+path[_0xd51b('0x56')](_0x10f5a8),function(){if(_0x181dbb){fs['unlink'](_0x10f5a8);}});}else{return _0x50fd99[_0xd51b('0x49')](_0x10f5a8,function(_0x53d868){if(_0x181dbb){fs[_0xd51b('0x57')](_0x10f5a8);}});}}})[_0xd51b('0x42')](function(_0x433c9e){if(_0x433c9e['message']==='SquareRecording\x20not\x20found'){_0x50fd99[_0xd51b('0x16')](0x194)[_0xd51b('0x27')]('Not\x20found');}else{return handleError(_0x50fd99,null);}});};exports[_0xd51b('0x58')]=function(_0x46fbf2,_0x303b82){return db[_0xd51b('0x29')][_0xd51b('0x48')]({'where':{'id':_0x46fbf2[_0xd51b('0x44')]['id']}})['then'](function(_0x547cdb){if(_[_0xd51b('0x59')](_0x547cdb)){throw new ReferenceError(_0xd51b('0x5a'));}return _0x547cdb;})['then'](function(_0x300176){var _0x501405=_0x300176[_0xd51b('0x4c')];logger[_0xd51b('0x5b')]('cancellazione\x20fisica\x20documento\x20%s',_0x501405);if(!_[_0xd51b('0x59')](_0x300176['savePath'])&&fs['existsSync'](_0x501405)){logger['info'](_0xd51b('0x5c')+_0x501405+_0xd51b('0x5d'));fs[_0xd51b('0x5e')](_0x501405);}_0x501405=_0x501405+_0xd51b('0x5f');if(!_['isNil'](_0x300176[_0xd51b('0x4c')])&&fs[_0xd51b('0x4f')](_0x501405)){logger[_0xd51b('0x5b')]('File:\x20\x22'+_0x501405+_0xd51b('0x5d'));fs[_0xd51b('0x5e')](_0x501405);}return _0x300176;})[_0xd51b('0x22')](function(_0x3dc06b){if(!_0x3dc06b)throw new InternalError();return _0x3dc06b[_0xd51b('0x58')]();})[_0xd51b('0x22')](function(){_0x303b82['status'](0xcc)[_0xd51b('0x60')]();})['catch'](handleError(_0x303b82,null));}; \ No newline at end of file +var _0xe55e=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','options','find','create','body','params','download','uniqueid','savePath','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','stack','name','send','index','map','SquareRecording','rawAttributes','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe55e,0x1ad));var _0xee55=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xe55e[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xee55('0x0'));var zipdir=require(_0xee55('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee55('0x2'));var moment=require(_0xee55('0x3'));var BPromise=require(_0xee55('0x4'));var Mustache=require(_0xee55('0x5'));var util=require(_0xee55('0x6'));var path=require(_0xee55('0x7'));var sox=require(_0xee55('0x8'));var csv=require(_0xee55('0x9'));var ejs=require(_0xee55('0xa'));var fs=require('fs');var fs_extra=require(_0xee55('0xb'));var _=require(_0xee55('0xc'));var squel=require(_0xee55('0xd'));var crypto=require(_0xee55('0xe'));var jsforce=require(_0xee55('0xf'));var deskjs=require(_0xee55('0x10'));var toCsv=require(_0xee55('0x9'));var querystring=require(_0xee55('0x11'));var Papa=require(_0xee55('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xee55('0x13'));var hardwareService=require(_0xee55('0x14'));var logger=require('../../config/logger')(_0xee55('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee55('0x16'))['db'];function respondWithStatusCode(_0x5788b,_0x1c17cb){_0x1c17cb=_0x1c17cb||0xcc;return function(_0x1fa28b){if(_0x1fa28b){return _0x5788b[_0xee55('0x17')](_0x1c17cb);}return _0x5788b[_0xee55('0x18')](_0x1c17cb)[_0xee55('0x19')]();};}function respondWithResult(_0x22b8fc,_0x1afd01){_0x1afd01=_0x1afd01||0xc8;return function(_0x1084a7){if(_0x1084a7){return _0x22b8fc[_0xee55('0x18')](_0x1afd01)['json'](_0x1084a7);}};}function respondWithFilteredResult(_0x353ed5,_0x3f312d){return function(_0x5402b0){if(_0x5402b0){var _0x2b08a3=typeof _0x3f312d[_0xee55('0x1a')]==='undefined'&&typeof _0x3f312d['limit']===_0xee55('0x1b');var _0xb5f0ab=_0x5402b0['count'];var _0x562aee=_0x2b08a3?0x0:_0x3f312d[_0xee55('0x1a')];var _0xf94b37=_0x2b08a3?_0x5402b0[_0xee55('0x1c')]:_0x3f312d[_0xee55('0x1a')]+_0x3f312d[_0xee55('0x1d')];var _0x56f9b7;if(_0xf94b37>=_0xb5f0ab){_0xf94b37=_0xb5f0ab;_0x56f9b7=0xc8;}else{_0x56f9b7=0xce;}_0x353ed5[_0xee55('0x18')](_0x56f9b7);return _0x353ed5[_0xee55('0x1e')](_0xee55('0x1f'),_0x562aee+'-'+_0xf94b37+'/'+_0xb5f0ab)[_0xee55('0x20')](_0x5402b0);}return null;};}function patchUpdates(_0x526de3){return function(_0x4a8473){try{jsonpatch[_0xee55('0x21')](_0x4a8473,_0x526de3,!![]);}catch(_0x2f9f9d){return BPromise[_0xee55('0x22')](_0x2f9f9d);}return _0x4a8473[_0xee55('0x23')]();};}function saveUpdates(_0x3cf7c0,_0x188c90){return function(_0xd8d6c5){if(_0xd8d6c5){return _0xd8d6c5[_0xee55('0x24')](_0x3cf7c0)[_0xee55('0x25')](function(_0x5b1022){return _0x5b1022;});}return null;};}function removeEntity(_0x48b3a8,_0x23ee95){return function(_0x5ab92d){if(_0x5ab92d){return _0x5ab92d['destroy']()[_0xee55('0x25')](function(){_0x48b3a8['status'](0xcc)[_0xee55('0x19')]();});}};}function handleEntityNotFound(_0x4bcb3b,_0x1e3e0e){return function(_0x35cb69){if(!_0x35cb69){_0x4bcb3b[_0xee55('0x17')](0x194);}return _0x35cb69;};}function handleError(_0x52eeda,_0x110861){_0x110861=_0x110861||0x1f4;return function(_0x4a9f9b){logger['error'](_0x4a9f9b[_0xee55('0x26')]);if(_0x4a9f9b[_0xee55('0x27')]){delete _0x4a9f9b[_0xee55('0x27')];}_0x52eeda[_0xee55('0x18')](_0x110861)[_0xee55('0x28')](_0x4a9f9b);};}exports[_0xee55('0x29')]=function(_0x204d64,_0x3609a5){var _0x34371e={},_0x2108aa={},_0x341adb={'count':0x0,'rows':[]};var _0x21585c=_[_0xee55('0x2a')](db[_0xee55('0x2b')][_0xee55('0x2c')],function(_0xfbf6f8){return{'name':_0xfbf6f8['fieldName'],'type':_0xfbf6f8[_0xee55('0x2d')]['key']};});_0x2108aa[_0xee55('0x2e')]=_['map'](_0x21585c,_0xee55('0x27'));_0x2108aa[_0xee55('0x2f')]=_[_0xee55('0x30')](_0x204d64[_0xee55('0x2f')]);_0x2108aa[_0xee55('0x31')]=_[_0xee55('0x32')](_0x2108aa[_0xee55('0x2e')],_0x2108aa[_0xee55('0x2f')]);_0x34371e[_0xee55('0x33')]=_[_0xee55('0x32')](_0x2108aa[_0xee55('0x2e')],qs['fields'](_0x204d64[_0xee55('0x2f')][_0xee55('0x34')]));_0x34371e[_0xee55('0x33')]=_0x34371e['attributes'][_0xee55('0x35')]?_0x34371e[_0xee55('0x33')]:_0x2108aa[_0xee55('0x2e')];if(!_0x204d64[_0xee55('0x2f')][_0xee55('0x36')]('nolimit')){_0x34371e['limit']=qs[_0xee55('0x1d')](_0x204d64[_0xee55('0x2f')][_0xee55('0x1d')]);_0x34371e[_0xee55('0x1a')]=qs['offset'](_0x204d64[_0xee55('0x2f')][_0xee55('0x1a')]);}_0x34371e[_0xee55('0x37')]=qs[_0xee55('0x38')](_0x204d64[_0xee55('0x2f')]['sort']);_0x34371e[_0xee55('0x39')]=qs['filters'](_[_0xee55('0x3a')](_0x204d64['query'],_0x2108aa[_0xee55('0x31')]),_0x21585c);if(_0x204d64[_0xee55('0x2f')][_0xee55('0x3b')]){_0x34371e['where']=_[_0xee55('0x3c')](_0x34371e[_0xee55('0x39')],{'$or':_['map'](_0x21585c,function(_0x2e97a0){if(_0x2e97a0['type']!==_0xee55('0x3d')){var _0x51af6d={};_0x51af6d[_0x2e97a0[_0xee55('0x27')]]={'$like':'%'+_0x204d64[_0xee55('0x2f')][_0xee55('0x3b')]+'%'};return _0x51af6d;}})});}_0x34371e=_[_0xee55('0x3c')]({},_0x34371e,_0x204d64['options']);var _0xacdbeb={'where':_0x34371e[_0xee55('0x39')]};return db['SquareRecording'][_0xee55('0x1c')](_0xacdbeb)[_0xee55('0x25')](function(_0xa7b021){_0x341adb[_0xee55('0x1c')]=_0xa7b021;if(_0x204d64[_0xee55('0x2f')][_0xee55('0x3e')]){_0x34371e[_0xee55('0x3f')]=[{'all':!![]}];}return db[_0xee55('0x2b')]['findAll'](_0x34371e);})[_0xee55('0x25')](function(_0x21cd45){_0x341adb[_0xee55('0x40')]=_0x21cd45;return _0x341adb;})['then'](respondWithFilteredResult(_0x3609a5,_0x34371e))[_0xee55('0x41')](handleError(_0x3609a5,null));};exports[_0xee55('0x42')]=function(_0x4e59b6,_0x48bd0e){var _0x123b98={'raw':!![],'where':{'id':_0x4e59b6['params']['id']}},_0x250294={};_0x250294[_0xee55('0x2e')]=_['keys'](db[_0xee55('0x2b')][_0xee55('0x2c')]);_0x250294[_0xee55('0x2f')]=_[_0xee55('0x30')](_0x4e59b6[_0xee55('0x2f')]);_0x250294[_0xee55('0x31')]=_[_0xee55('0x32')](_0x250294[_0xee55('0x2e')],_0x250294[_0xee55('0x2f')]);_0x123b98[_0xee55('0x33')]=_[_0xee55('0x32')](_0x250294['model'],qs['fields'](_0x4e59b6[_0xee55('0x2f')][_0xee55('0x34')]));_0x123b98['attributes']=_0x123b98['attributes'][_0xee55('0x35')]?_0x123b98[_0xee55('0x33')]:_0x250294['model'];if(_0x4e59b6[_0xee55('0x2f')][_0xee55('0x3e')]){_0x123b98['include']=[{'all':!![]}];}_0x123b98=_[_0xee55('0x3c')]({},_0x123b98,_0x4e59b6[_0xee55('0x43')]);return db[_0xee55('0x2b')][_0xee55('0x44')](_0x123b98)[_0xee55('0x25')](handleEntityNotFound(_0x48bd0e,null))['then'](respondWithResult(_0x48bd0e,null))[_0xee55('0x41')](handleError(_0x48bd0e,null));};exports[_0xee55('0x45')]=function(_0x4c2492,_0x530f4e){return db[_0xee55('0x2b')]['create'](_0x4c2492[_0xee55('0x46')],{})[_0xee55('0x25')](respondWithResult(_0x530f4e,0xc9))[_0xee55('0x41')](handleError(_0x530f4e,null));};exports[_0xee55('0x24')]=function(_0x4f7e80,_0x89e064){if(_0x4f7e80[_0xee55('0x46')]['id']){delete _0x4f7e80['body']['id'];}return db[_0xee55('0x2b')]['find']({'where':{'id':_0x4f7e80[_0xee55('0x47')]['id']}})[_0xee55('0x25')](handleEntityNotFound(_0x89e064,null))['then'](saveUpdates(_0x4f7e80[_0xee55('0x46')],null))[_0xee55('0x25')](respondWithResult(_0x89e064,null))[_0xee55('0x41')](handleError(_0x89e064,null));};exports[_0xee55('0x48')]=function(_0x554c96,_0x384b33,_0x4f4bd5){var _0x1370d3=require('../../components/encryptor');var _0x3f0601=![];var _0x4667c2={};if(_0x554c96['query'][_0xee55('0x2d')]&&_0x554c96[_0xee55('0x2f')]['type']==='uniqueid'){_0x4667c2[_0xee55('0x49')]=_0x554c96[_0xee55('0x47')]['id'];}else{_0x4667c2['id']=_0x554c96[_0xee55('0x47')]['id'];}return db[_0xee55('0x2b')][_0xee55('0x44')]({'where':_0x4667c2,'attributes':['id',_0xee55('0x4a'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0x384b33,null))[_0xee55('0x25')](function(_0x5b6338){if(_0x5b6338){var _0x4949da=_0x5b6338['savePath'];var _0x51bafe=util[_0xee55('0x4b')](_0xee55('0x4c'),_0x4949da);if(fs['existsSync'](_0x51bafe)){_0x3f0601=!![];return _0x1370d3[_0xee55('0x4d')](_0x51bafe,_0x4949da,config[_0xee55('0x4e')][_0xee55('0x4f')])[_0xee55('0x25')](function(){return _0x5b6338;});}return _0x5b6338;}})['then'](function(_0x828f4c){if(_0x828f4c){var _0x2fb973=_0x828f4c['savePath'];if(!fs[_0xee55('0x50')](_0x2fb973)){throw new db[(_0xee55('0x51'))]['ValidationError'](_0xee55('0x52'));}if(_0x828f4c['filename']){return _0x384b33[_0xee55('0x48')](_0x2fb973,_0x828f4c['filename']+path[_0xee55('0x53')](_0x2fb973),function(){if(_0x3f0601){fs['unlink'](_0x2fb973);}});}else{return _0x384b33[_0xee55('0x48')](_0x2fb973,function(_0x9b49c6){if(_0x3f0601){fs[_0xee55('0x54')](_0x2fb973);}});}}})[_0xee55('0x41')](function(_0x2350da){if(_0x2350da[_0xee55('0x55')]===_0xee55('0x52')){_0x384b33['status'](0x194)[_0xee55('0x28')](_0xee55('0x56'));}else{return handleError(_0x384b33,null);}});};exports[_0xee55('0x57')]=function(_0x29e188,_0x38a4f2){return db[_0xee55('0x2b')]['find']({'where':{'id':_0x29e188[_0xee55('0x47')]['id']}})[_0xee55('0x25')](function(_0x13d287){if(_[_0xee55('0x58')](_0x13d287)){throw new ReferenceError(_0xee55('0x59'));}return _0x13d287;})['then'](function(_0x2d39b9){var _0x29abae=_0x2d39b9[_0xee55('0x4a')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x29abae);if(!_[_0xee55('0x58')](_0x2d39b9['savePath'])&&fs[_0xee55('0x50')](_0x29abae)){logger[_0xee55('0x5a')](_0xee55('0x5b')+_0x29abae+_0xee55('0x5c'));fs[_0xee55('0x5d')](_0x29abae);}_0x29abae=_0x29abae+_0xee55('0x5e');if(!_[_0xee55('0x58')](_0x2d39b9[_0xee55('0x4a')])&&fs['existsSync'](_0x29abae)){logger[_0xee55('0x5a')]('File:\x20\x22'+_0x29abae+_0xee55('0x5c'));fs[_0xee55('0x5d')](_0x29abae);}return _0x2d39b9;})[_0xee55('0x25')](function(_0x27be4d){if(!_0x27be4d)throw new InternalError();return _0x27be4d[_0xee55('0x57')]();})['then'](function(){_0x38a4f2[_0xee55('0x18')](0xcc)['end']();})['catch'](handleError(_0x38a4f2,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index ae46515..3bd0994 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 _0x8ce1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings'];(function(_0x5ba8e3,_0x4b297e){var _0x576996=function(_0x29ec6f){while(--_0x29ec6f){_0x5ba8e3['push'](_0x5ba8e3['shift']());}};_0x576996(++_0x4b297e);}(_0x8ce1,0x152));var _0x18ce=function(_0x43816c,_0x4e296c){_0x43816c=_0x43816c-0x0;var _0x16c988=_0x8ce1[_0x43816c];return _0x16c988;};'use strict';var _=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var logger=require(_0x18ce('0x2'))(_0x18ce('0x3'));var moment=require(_0x18ce('0x4'));var BPromise=require(_0x18ce('0x5'));var rp=require(_0x18ce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18ce('0x7'));var config=require(_0x18ce('0x8'));var attributes=require(_0x18ce('0x9'));module[_0x18ce('0xa')]=function(_0x532604,_0x17d12a){return _0x532604[_0x18ce('0xb')]('SquareRecording',attributes,{'tableName':_0x18ce('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x975b=['define','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports'];(function(_0x261dfb,_0xaff1a1){var _0x317e5a=function(_0x20c9e4){while(--_0x20c9e4){_0x261dfb['push'](_0x261dfb['shift']());}};_0x317e5a(++_0xaff1a1);}(_0x975b,0x1c9));var _0xb975=function(_0x3dec0f,_0x6075ea){_0x3dec0f=_0x3dec0f-0x0;var _0x4e5a17=_0x975b[_0x3dec0f];return _0x4e5a17;};'use strict';var _=require(_0xb975('0x0'));var util=require(_0xb975('0x1'));var logger=require(_0xb975('0x2'))(_0xb975('0x3'));var moment=require(_0xb975('0x4'));var BPromise=require(_0xb975('0x5'));var rp=require(_0xb975('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb975('0x7'));var config=require(_0xb975('0x8'));var attributes=require(_0xb975('0x9'));module[_0xb975('0xa')]=function(_0x599d95,_0x1729fe){return _0x599d95[_0xb975('0xb')]('SquareRecording',attributes,{'tableName':_0xb975('0xc'),'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 86c017e..48da84e 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 _0xfe63=['catch','CreateSquareRecording','SquareRecording','options','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','SquareRecording,\x20%s,\x20%s','message'];(function(_0x171c49,_0xf95121){var _0x3891f8=function(_0x18950b){while(--_0x18950b){_0x171c49['push'](_0x171c49['shift']());}};_0x3891f8(++_0xf95121);}(_0xfe63,0x1ae));var _0x3fe6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xfe63[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x3fe6('0x0'));var util=require(_0x3fe6('0x1'));var moment=require(_0x3fe6('0x2'));var BPromise=require(_0x3fe6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3fe6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fe6('0x5'));var logger=require(_0x3fe6('0x6'))('rpc');var config=require(_0x3fe6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3fe6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd9d150,_0x19263b,_0x3678f5){return new BPromise(function(_0x3813b9,_0x41a770){return client[_0x3fe6('0x9')](_0xd9d150,_0x3678f5)[_0x3fe6('0xa')](function(_0x931d0f){logger[_0x3fe6('0xb')]('SquareRecording,\x20%s,\x20%s',_0x19263b,_0x3fe6('0xc'));logger[_0x3fe6('0xd')](_0x3fe6('0xe'),_0x19263b,_0x3fe6('0xc'),JSON[_0x3fe6('0xf')](_0x931d0f));if(_0x931d0f['error']){if(_0x931d0f['error'][_0x3fe6('0x10')]===0x1f4){logger[_0x3fe6('0x11')](_0x3fe6('0x12'),_0x19263b,_0x931d0f[_0x3fe6('0x11')][_0x3fe6('0x13')]);return _0x41a770(_0x931d0f[_0x3fe6('0x11')][_0x3fe6('0x13')]);}logger[_0x3fe6('0x11')](_0x3fe6('0x12'),_0x19263b,_0x931d0f['error'][_0x3fe6('0x13')]);return _0x3813b9(_0x931d0f[_0x3fe6('0x11')][_0x3fe6('0x13')]);}else{logger[_0x3fe6('0xb')]('SquareRecording,\x20%s,\x20%s',_0x19263b,_0x3fe6('0xc'));_0x3813b9(_0x931d0f['result']['message']);}})[_0x3fe6('0x14')](function(_0x3c8093){logger['error'](_0x3fe6('0x12'),_0x19263b,_0x3c8093);_0x41a770(_0x3c8093);});});}exports[_0x3fe6('0x15')]=function(_0x3f38a3){var _0x13f308=this;return new Promise(function(_0x34cc5b,_0x262d6a){return db[_0x3fe6('0x16')]['create'](_0x3f38a3['body'],{'raw':_0x3f38a3[_0x3fe6('0x17')]?_0x3f38a3[_0x3fe6('0x17')][_0x3fe6('0x18')]===undefined?!![]:![]:!![]})[_0x3fe6('0xa')](function(_0x10aee6){logger['info'](_0x3fe6('0x15'),_0x3f38a3);logger[_0x3fe6('0xd')](_0x3fe6('0x15'),_0x3f38a3,JSON['stringify'](_0x10aee6));_0x34cc5b(_0x10aee6);})[_0x3fe6('0x14')](function(_0x5af43a){logger['error'](_0x3fe6('0x15'),_0x5af43a[_0x3fe6('0x13')],_0x3f38a3);_0x262d6a(_0x13f308[_0x3fe6('0x11')](0x1f4,_0x5af43a[_0x3fe6('0x13')]));});});}; \ No newline at end of file +var _0xfc3e=['SquareRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateSquareRecording','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x48a96f,_0x530059){var _0x3ff3ef=function(_0x286059){while(--_0x286059){_0x48a96f['push'](_0x48a96f['shift']());}};_0x3ff3ef(++_0x530059);}(_0xfc3e,0x1cc));var _0xefc3=function(_0x316677,_0xd3c665){_0x316677=_0x316677-0x0;var _0x1121bd=_0xfc3e[_0x316677];return _0x1121bd;};'use strict';var _=require(_0xefc3('0x0'));var util=require(_0xefc3('0x1'));var moment=require(_0xefc3('0x2'));var BPromise=require(_0xefc3('0x3'));var rs=require(_0xefc3('0x4'));var fs=require('fs');var Redis=require(_0xefc3('0x5'));var db=require(_0xefc3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xefc3('0x7'))(_0xefc3('0x8'));var config=require(_0xefc3('0x9'));var jayson=require(_0xefc3('0xa'));var client=jayson[_0xefc3('0xb')][_0xefc3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a132,_0x51bb3b,_0x3724d7){return new BPromise(function(_0x3fcc51,_0x1bdc61){return client[_0xefc3('0xd')](_0x1a132,_0x3724d7)[_0xefc3('0xe')](function(_0xdcacc3){logger[_0xefc3('0xf')](_0xefc3('0x10'),_0x51bb3b,'request\x20sent');logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x51bb3b,_0xefc3('0x11'),JSON[_0xefc3('0x12')](_0xdcacc3));if(_0xdcacc3['error']){if(_0xdcacc3[_0xefc3('0x13')][_0xefc3('0x14')]===0x1f4){logger[_0xefc3('0x13')](_0xefc3('0x10'),_0x51bb3b,_0xdcacc3['error']['message']);return _0x1bdc61(_0xdcacc3[_0xefc3('0x13')][_0xefc3('0x15')]);}logger[_0xefc3('0x13')]('SquareRecording,\x20%s,\x20%s',_0x51bb3b,_0xdcacc3['error']['message']);return _0x3fcc51(_0xdcacc3[_0xefc3('0x13')]['message']);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x51bb3b,_0xefc3('0x11'));_0x3fcc51(_0xdcacc3[_0xefc3('0x16')][_0xefc3('0x15')]);}})['catch'](function(_0x58ddd8){logger[_0xefc3('0x13')](_0xefc3('0x10'),_0x51bb3b,_0x58ddd8);_0x1bdc61(_0x58ddd8);});});}exports[_0xefc3('0x17')]=function(_0x55d7ea){var _0x1c2037=this;return new Promise(function(_0x55a42b,_0x38ab42){return db['SquareRecording'][_0xefc3('0x18')](_0x55d7ea[_0xefc3('0x19')],{'raw':_0x55d7ea['options']?_0x55d7ea[_0xefc3('0x1a')][_0xefc3('0x1b')]===undefined?!![]:![]:!![]})[_0xefc3('0xe')](function(_0x287b9b){logger[_0xefc3('0xf')](_0xefc3('0x17'),_0x55d7ea);logger['debug'](_0xefc3('0x17'),_0x55d7ea,JSON[_0xefc3('0x12')](_0x287b9b));_0x55a42b(_0x287b9b);})['catch'](function(_0x3ba74c){logger[_0xefc3('0x13')](_0xefc3('0x17'),_0x3ba74c['message'],_0x55d7ea);_0x38ab42(_0x1c2037[_0xefc3('0x13')](0x1f4,_0x3ba74c[_0xefc3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index bfae53f..ed10ee2 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0xc4d818,_0x1d80dc){var _0x47bc25=function(_0x2530a3){while(--_0x2530a3){_0xc4d818['push'](_0xc4d818['shift']());}};_0x47bc25(++_0x1d80dc);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x24dbad,_0x38302c){var _0x8624ac=function(_0x532198){while(--_0x532198){_0x24dbad['push'](_0x24dbad['shift']());}};_0x8624ac(++_0x38302c);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 3904423..b76f6b3 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 _0x854f=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x854f,0x8d));var _0xf854=function(_0x2e8435,_0x411c7e){_0x2e8435=_0x2e8435-0x0;var _0x674171=_0x854f[_0x2e8435];return _0x674171;};'use strict';var Sequelize=require(_0xf854('0x0'));module[_0xf854('0x1')]={'network':{'type':Sequelize[_0xf854('0x2')]},'network_script':{'type':Sequelize[_0xf854('0x2')]},'request':{'type':Sequelize[_0xf854('0x2')]},'channel':{'type':Sequelize[_0xf854('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf854('0x2')]},'uniqueid':{'type':Sequelize[_0xf854('0x2')]},'version':{'type':Sequelize[_0xf854('0x2')]},'callerid':{'type':Sequelize[_0xf854('0x2')]},'calleridname':{'type':Sequelize[_0xf854('0x2')]},'callingpres':{'type':Sequelize[_0xf854('0x2')]},'callingani2':{'type':Sequelize[_0xf854('0x2')]},'callington':{'type':Sequelize[_0xf854('0x2')]},'callingtns':{'type':Sequelize[_0xf854('0x2')]},'dnid':{'type':Sequelize[_0xf854('0x2')]},'rdnis':{'type':Sequelize[_0xf854('0x2')]},'context':{'type':Sequelize[_0xf854('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xf854('0x2')]},'enhanced':{'type':Sequelize[_0xf854('0x2')]},'accountcode':{'type':Sequelize[_0xf854('0x2')]},'threadid':{'type':Sequelize[_0xf854('0x2')]},'project_name':{'type':Sequelize[_0xf854('0x2')]},'joinAt':{'type':Sequelize[_0xf854('0x3')]},'leaveAt':{'type':Sequelize[_0xf854('0x3')]},'bot':{'type':Sequelize[_0xf854('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xc24c=['DATE','exports','STRING'];(function(_0x47a83c,_0xd7b5fc){var _0x121d6b=function(_0xb56d6e){while(--_0xb56d6e){_0x47a83c['push'](_0x47a83c['shift']());}};_0x121d6b(++_0xd7b5fc);}(_0xc24c,0x1ed));var _0xcc24=function(_0x1a4160,_0x442aa4){_0x1a4160=_0x1a4160-0x0;var _0x3300e=_0xc24c[_0x1a4160];return _0x3300e;};'use strict';var Sequelize=require('sequelize');module[_0xcc24('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xcc24('0x1')]},'request':{'type':Sequelize[_0xcc24('0x1')]},'channel':{'type':Sequelize[_0xcc24('0x1')]},'language':{'type':Sequelize[_0xcc24('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xcc24('0x1')]},'version':{'type':Sequelize[_0xcc24('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xcc24('0x1')]},'callingpres':{'type':Sequelize[_0xcc24('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xcc24('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xcc24('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xcc24('0x1')]},'enhanced':{'type':Sequelize[_0xcc24('0x1')]},'accountcode':{'type':Sequelize[_0xcc24('0x1')]},'threadid':{'type':Sequelize[_0xcc24('0x1')]},'project_name':{'type':Sequelize[_0xcc24('0x1')]},'joinAt':{'type':Sequelize[_0xcc24('0x2')]},'leaveAt':{'type':Sequelize[_0xcc24('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 73d41ca..2c5742a 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 _0x5f62=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','error','stack','name','send','map','SquareReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','find','create','body','catch','params','destroy','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1e1ffa,_0x461e07){var _0x505323=function(_0x427f0e){while(--_0x427f0e){_0x1e1ffa['push'](_0x1e1ffa['shift']());}};_0x505323(++_0x461e07);}(_0x5f62,0x101));var _0x25f6=function(_0xf61129,_0x523668){_0xf61129=_0xf61129-0x0;var _0xefa38a=_0x5f62[_0xf61129];return _0xefa38a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x25f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x25f6('0x1'));var rp=require(_0x25f6('0x2'));var moment=require(_0x25f6('0x3'));var BPromise=require(_0x25f6('0x4'));var Mustache=require('mustache');var util=require(_0x25f6('0x5'));var path=require(_0x25f6('0x6'));var sox=require(_0x25f6('0x7'));var csv=require(_0x25f6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x25f6('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x25f6('0xa'));var deskjs=require(_0x25f6('0xb'));var toCsv=require('to-csv');var querystring=require(_0x25f6('0xc'));var Papa=require(_0x25f6('0xd'));var Redis=require(_0x25f6('0xe'));var authService=require(_0x25f6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x25f6('0x10'));var hardwareService=require(_0x25f6('0x11'));var logger=require(_0x25f6('0x12'))(_0x25f6('0x13'));var utils=require('../../config/utils');var config=require(_0x25f6('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c8c7d,_0x45fcd1){_0x45fcd1=_0x45fcd1||0xcc;return function(_0x33961a){if(_0x33961a){return _0x5c8c7d[_0x25f6('0x15')](_0x45fcd1);}return _0x5c8c7d[_0x25f6('0x16')](_0x45fcd1)[_0x25f6('0x17')]();};}function respondWithResult(_0x3909c9,_0xfc968a){_0xfc968a=_0xfc968a||0xc8;return function(_0x2f6f22){if(_0x2f6f22){return _0x3909c9[_0x25f6('0x16')](_0xfc968a)[_0x25f6('0x18')](_0x2f6f22);}};}function respondWithFilteredResult(_0x4733d1,_0x16f48a){return function(_0x4f5537){if(_0x4f5537){var _0x10658e=typeof _0x16f48a[_0x25f6('0x19')]===_0x25f6('0x1a')&&typeof _0x16f48a[_0x25f6('0x1b')]===_0x25f6('0x1a');var _0x3dd8dd=_0x4f5537[_0x25f6('0x1c')];var _0x5ef490=_0x10658e?0x0:_0x16f48a['offset'];var _0x14eaaf=_0x10658e?_0x4f5537['count']:_0x16f48a[_0x25f6('0x19')]+_0x16f48a[_0x25f6('0x1b')];var _0x2d7fb8;if(_0x14eaaf>=_0x3dd8dd){_0x14eaaf=_0x3dd8dd;_0x2d7fb8=0xc8;}else{_0x2d7fb8=0xce;}_0x4733d1[_0x25f6('0x16')](_0x2d7fb8);return _0x4733d1[_0x25f6('0x1d')]('Content-Range',_0x5ef490+'-'+_0x14eaaf+'/'+_0x3dd8dd)['json'](_0x4f5537);}return null;};}function patchUpdates(_0x2856da){return function(_0x4f44fc){try{jsonpatch['apply'](_0x4f44fc,_0x2856da,!![]);}catch(_0x5b5f27){return BPromise['reject'](_0x5b5f27);}return _0x4f44fc['save']();};}function saveUpdates(_0x532182,_0x3968db){return function(_0x4d1493){if(_0x4d1493){return _0x4d1493[_0x25f6('0x1e')](_0x532182)[_0x25f6('0x1f')](function(_0xf6c11d){return _0xf6c11d;});}return null;};}function removeEntity(_0x167a12,_0xd62c38){return function(_0x5affd1){if(_0x5affd1){return _0x5affd1['destroy']()[_0x25f6('0x1f')](function(){_0x167a12[_0x25f6('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x529bca,_0x48db33){return function(_0x956efb){if(!_0x956efb){_0x529bca[_0x25f6('0x15')](0x194);}return _0x956efb;};}function handleError(_0x462b3c,_0x504d81){_0x504d81=_0x504d81||0x1f4;return function(_0x401076){logger[_0x25f6('0x20')](_0x401076[_0x25f6('0x21')]);if(_0x401076[_0x25f6('0x22')]){delete _0x401076[_0x25f6('0x22')];}_0x462b3c[_0x25f6('0x16')](_0x504d81)[_0x25f6('0x23')](_0x401076);};}exports['index']=function(_0x3bffd8,_0x351f8d){var _0x544c66={},_0x22aac9={},_0x520f1a={'count':0x0,'rows':[]};var _0x1322bf=_[_0x25f6('0x24')](db[_0x25f6('0x25')][_0x25f6('0x26')],function(_0x416dbb){return{'name':_0x416dbb[_0x25f6('0x27')],'type':_0x416dbb[_0x25f6('0x28')]['key']};});_0x22aac9[_0x25f6('0x29')]=_['map'](_0x1322bf,'name');_0x22aac9[_0x25f6('0x2a')]=_[_0x25f6('0x2b')](_0x3bffd8[_0x25f6('0x2a')]);_0x22aac9['filters']=_[_0x25f6('0x2c')](_0x22aac9['model'],_0x22aac9[_0x25f6('0x2a')]);_0x544c66[_0x25f6('0x2d')]=_[_0x25f6('0x2c')](_0x22aac9[_0x25f6('0x29')],qs[_0x25f6('0x2e')](_0x3bffd8[_0x25f6('0x2a')][_0x25f6('0x2e')]));_0x544c66[_0x25f6('0x2d')]=_0x544c66[_0x25f6('0x2d')]['length']?_0x544c66[_0x25f6('0x2d')]:_0x22aac9['model'];if(!_0x3bffd8['query'][_0x25f6('0x2f')]('nolimit')){_0x544c66[_0x25f6('0x1b')]=qs[_0x25f6('0x1b')](_0x3bffd8['query'][_0x25f6('0x1b')]);_0x544c66[_0x25f6('0x19')]=qs['offset'](_0x3bffd8['query'][_0x25f6('0x19')]);}_0x544c66[_0x25f6('0x30')]=qs[_0x25f6('0x31')](_0x3bffd8[_0x25f6('0x2a')][_0x25f6('0x31')]);_0x544c66['where']=qs[_0x25f6('0x32')](_['pick'](_0x3bffd8[_0x25f6('0x2a')],_0x22aac9[_0x25f6('0x32')]),_0x1322bf);if(_0x3bffd8[_0x25f6('0x2a')][_0x25f6('0x33')]){_0x544c66[_0x25f6('0x34')]=_[_0x25f6('0x35')](_0x544c66[_0x25f6('0x34')],{'$or':_[_0x25f6('0x24')](_0x1322bf,function(_0x19d829){if(_0x19d829[_0x25f6('0x28')]!==_0x25f6('0x36')){var _0x603455={};_0x603455[_0x19d829[_0x25f6('0x22')]]={'$like':'%'+_0x3bffd8[_0x25f6('0x2a')][_0x25f6('0x33')]+'%'};return _0x603455;}})});}_0x544c66=_[_0x25f6('0x35')]({},_0x544c66,_0x3bffd8[_0x25f6('0x37')]);var _0x5e8e52={'where':_0x544c66[_0x25f6('0x34')]};return db['SquareReport'][_0x25f6('0x1c')](_0x5e8e52)[_0x25f6('0x1f')](function(_0x143e52){_0x520f1a[_0x25f6('0x1c')]=_0x143e52;if(_0x3bffd8[_0x25f6('0x2a')][_0x25f6('0x38')]){_0x544c66['include']=[{'all':!![]}];}return db[_0x25f6('0x25')][_0x25f6('0x39')](_0x544c66);})[_0x25f6('0x1f')](function(_0x566fb6){_0x520f1a[_0x25f6('0x3a')]=_0x566fb6;return _0x520f1a;})[_0x25f6('0x1f')](respondWithFilteredResult(_0x351f8d,_0x544c66))['catch'](handleError(_0x351f8d,null));};exports[_0x25f6('0x3b')]=function(_0x227eec,_0x29812f){var _0x4cdded={'raw':!![],'where':{'id':_0x227eec['params']['id']}},_0x343b55={};_0x343b55[_0x25f6('0x29')]=_[_0x25f6('0x2b')](db[_0x25f6('0x25')]['rawAttributes']);_0x343b55[_0x25f6('0x2a')]=_[_0x25f6('0x2b')](_0x227eec['query']);_0x343b55[_0x25f6('0x32')]=_[_0x25f6('0x2c')](_0x343b55['model'],_0x343b55['query']);_0x4cdded[_0x25f6('0x2d')]=_[_0x25f6('0x2c')](_0x343b55[_0x25f6('0x29')],qs[_0x25f6('0x2e')](_0x227eec['query'][_0x25f6('0x2e')]));_0x4cdded[_0x25f6('0x2d')]=_0x4cdded[_0x25f6('0x2d')]['length']?_0x4cdded[_0x25f6('0x2d')]:_0x343b55[_0x25f6('0x29')];if(_0x227eec['query'][_0x25f6('0x38')]){_0x4cdded[_0x25f6('0x3c')]=[{'all':!![]}];}_0x4cdded=_[_0x25f6('0x35')]({},_0x4cdded,_0x227eec['options']);return db['SquareReport'][_0x25f6('0x3d')](_0x4cdded)[_0x25f6('0x1f')](handleEntityNotFound(_0x29812f,null))[_0x25f6('0x1f')](respondWithResult(_0x29812f,null))['catch'](handleError(_0x29812f,null));};exports[_0x25f6('0x3e')]=function(_0x229bfc,_0xc363c){return db[_0x25f6('0x25')][_0x25f6('0x3e')](_0x229bfc[_0x25f6('0x3f')],{})[_0x25f6('0x1f')](respondWithResult(_0xc363c,0xc9))[_0x25f6('0x40')](handleError(_0xc363c,null));};exports[_0x25f6('0x1e')]=function(_0x4e7543,_0xb71813){if(_0x4e7543[_0x25f6('0x3f')]['id']){delete _0x4e7543[_0x25f6('0x3f')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x4e7543[_0x25f6('0x41')]['id']}})['then'](handleEntityNotFound(_0xb71813,null))[_0x25f6('0x1f')](saveUpdates(_0x4e7543[_0x25f6('0x3f')],null))[_0x25f6('0x1f')](respondWithResult(_0xb71813,null))[_0x25f6('0x40')](handleError(_0xb71813,null));};exports[_0x25f6('0x42')]=function(_0x2fd79b,_0x237a44){return db[_0x25f6('0x25')]['find']({'where':{'id':_0x2fd79b[_0x25f6('0x41')]['id']}})[_0x25f6('0x1f')](handleEntityNotFound(_0x237a44,null))[_0x25f6('0x1f')](removeEntity(_0x237a44,null))[_0x25f6('0x40')](handleError(_0x237a44,null));};exports[_0x25f6('0x43')]=function(_0x30f793,_0x3b52a1){return db[_0x25f6('0x25')]['describe']()[_0x25f6('0x1f')](respondWithResult(_0x3b52a1,null))[_0x25f6('0x40')](handleError(_0x3b52a1,null));}; \ No newline at end of file +var _0xa9fd=['type','model','keys','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SquareReport'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xa9fd,0x67));var _0xda9f=function(_0x352e87,_0x2d10ab){_0x352e87=_0x352e87-0x0;var _0x32ed18=_0xa9fd[_0x352e87];return _0x32ed18;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda9f('0x0'));var zipdir=require(_0xda9f('0x1'));var jsonpatch=require(_0xda9f('0x2'));var rp=require(_0xda9f('0x3'));var moment=require(_0xda9f('0x4'));var BPromise=require(_0xda9f('0x5'));var Mustache=require(_0xda9f('0x6'));var util=require(_0xda9f('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xda9f('0x8'));var ejs=require(_0xda9f('0x9'));var fs=require('fs');var fs_extra=require(_0xda9f('0xa'));var _=require(_0xda9f('0xb'));var squel=require(_0xda9f('0xc'));var crypto=require('crypto');var jsforce=require(_0xda9f('0xd'));var deskjs=require(_0xda9f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xda9f('0xf'));var Papa=require(_0xda9f('0x10'));var Redis=require('ioredis');var authService=require(_0xda9f('0x11'));var qs=require(_0xda9f('0x12'));var as=require(_0xda9f('0x13'));var hardwareService=require(_0xda9f('0x14'));var logger=require('../../config/logger')(_0xda9f('0x15'));var utils=require(_0xda9f('0x16'));var config=require(_0xda9f('0x17'));var licenseUtil=require(_0xda9f('0x18'));var db=require(_0xda9f('0x19'))['db'];function respondWithStatusCode(_0x4e6651,_0xffc005){_0xffc005=_0xffc005||0xcc;return function(_0x1613b8){if(_0x1613b8){return _0x4e6651[_0xda9f('0x1a')](_0xffc005);}return _0x4e6651[_0xda9f('0x1b')](_0xffc005)['end']();};}function respondWithResult(_0x2a2778,_0x59664b){_0x59664b=_0x59664b||0xc8;return function(_0x44fb35){if(_0x44fb35){return _0x2a2778[_0xda9f('0x1b')](_0x59664b)['json'](_0x44fb35);}};}function respondWithFilteredResult(_0x34a44c,_0x56633f){return function(_0x220534){if(_0x220534){var _0x11d342=typeof _0x56633f['offset']==='undefined'&&typeof _0x56633f['limit']===_0xda9f('0x1c');var _0x34e55f=_0x220534[_0xda9f('0x1d')];var _0x3ac442=_0x11d342?0x0:_0x56633f[_0xda9f('0x1e')];var _0x59d3e2=_0x11d342?_0x220534[_0xda9f('0x1d')]:_0x56633f[_0xda9f('0x1e')]+_0x56633f[_0xda9f('0x1f')];var _0x4bc9e7;if(_0x59d3e2>=_0x34e55f){_0x59d3e2=_0x34e55f;_0x4bc9e7=0xc8;}else{_0x4bc9e7=0xce;}_0x34a44c[_0xda9f('0x1b')](_0x4bc9e7);return _0x34a44c[_0xda9f('0x20')]('Content-Range',_0x3ac442+'-'+_0x59d3e2+'/'+_0x34e55f)[_0xda9f('0x21')](_0x220534);}return null;};}function patchUpdates(_0x1ec26b){return function(_0x361279){try{jsonpatch[_0xda9f('0x22')](_0x361279,_0x1ec26b,!![]);}catch(_0x4ea724){return BPromise[_0xda9f('0x23')](_0x4ea724);}return _0x361279[_0xda9f('0x24')]();};}function saveUpdates(_0x37380d,_0x58414f){return function(_0x238645){if(_0x238645){return _0x238645[_0xda9f('0x25')](_0x37380d)['then'](function(_0x3ceacb){return _0x3ceacb;});}return null;};}function removeEntity(_0x4e608d,_0x332481){return function(_0x2a65d0){if(_0x2a65d0){return _0x2a65d0[_0xda9f('0x26')]()[_0xda9f('0x27')](function(){_0x4e608d[_0xda9f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1223c3,_0x4a9a75){return function(_0x4c9d68){if(!_0x4c9d68){_0x1223c3[_0xda9f('0x1a')](0x194);}return _0x4c9d68;};}function handleError(_0x2e2e28,_0x37e2ea){_0x37e2ea=_0x37e2ea||0x1f4;return function(_0x49962c){logger[_0xda9f('0x28')](_0x49962c[_0xda9f('0x29')]);if(_0x49962c[_0xda9f('0x2a')]){delete _0x49962c[_0xda9f('0x2a')];}_0x2e2e28[_0xda9f('0x1b')](_0x37e2ea)[_0xda9f('0x2b')](_0x49962c);};}exports[_0xda9f('0x2c')]=function(_0x24469d,_0x5e9fb0){var _0x2bc564={},_0x46a6bd={},_0x7f6227={'count':0x0,'rows':[]};var _0x3c0f5a=_[_0xda9f('0x2d')](db[_0xda9f('0x2e')]['rawAttributes'],function(_0x5c57b7){return{'name':_0x5c57b7['fieldName'],'type':_0x5c57b7[_0xda9f('0x2f')]['key']};});_0x46a6bd[_0xda9f('0x30')]=_[_0xda9f('0x2d')](_0x3c0f5a,'name');_0x46a6bd['query']=_[_0xda9f('0x31')](_0x24469d['query']);_0x46a6bd['filters']=_[_0xda9f('0x32')](_0x46a6bd[_0xda9f('0x30')],_0x46a6bd['query']);_0x2bc564[_0xda9f('0x33')]=_['intersection'](_0x46a6bd[_0xda9f('0x30')],qs[_0xda9f('0x34')](_0x24469d[_0xda9f('0x35')][_0xda9f('0x34')]));_0x2bc564[_0xda9f('0x33')]=_0x2bc564['attributes'][_0xda9f('0x36')]?_0x2bc564[_0xda9f('0x33')]:_0x46a6bd[_0xda9f('0x30')];if(!_0x24469d[_0xda9f('0x35')][_0xda9f('0x37')]('nolimit')){_0x2bc564[_0xda9f('0x1f')]=qs[_0xda9f('0x1f')](_0x24469d[_0xda9f('0x35')]['limit']);_0x2bc564[_0xda9f('0x1e')]=qs[_0xda9f('0x1e')](_0x24469d['query'][_0xda9f('0x1e')]);}_0x2bc564[_0xda9f('0x38')]=qs[_0xda9f('0x39')](_0x24469d['query']['sort']);_0x2bc564[_0xda9f('0x3a')]=qs['filters'](_[_0xda9f('0x3b')](_0x24469d['query'],_0x46a6bd[_0xda9f('0x3c')]),_0x3c0f5a);if(_0x24469d['query'][_0xda9f('0x3d')]){_0x2bc564['where']=_[_0xda9f('0x3e')](_0x2bc564['where'],{'$or':_[_0xda9f('0x2d')](_0x3c0f5a,function(_0x12a675){if(_0x12a675['type']!==_0xda9f('0x3f')){var _0x39c23d={};_0x39c23d[_0x12a675[_0xda9f('0x2a')]]={'$like':'%'+_0x24469d[_0xda9f('0x35')][_0xda9f('0x3d')]+'%'};return _0x39c23d;}})});}_0x2bc564=_[_0xda9f('0x3e')]({},_0x2bc564,_0x24469d[_0xda9f('0x40')]);var _0x43ea97={'where':_0x2bc564[_0xda9f('0x3a')]};return db[_0xda9f('0x2e')][_0xda9f('0x1d')](_0x43ea97)[_0xda9f('0x27')](function(_0x4f584b){_0x7f6227[_0xda9f('0x1d')]=_0x4f584b;if(_0x24469d[_0xda9f('0x35')][_0xda9f('0x41')]){_0x2bc564[_0xda9f('0x42')]=[{'all':!![]}];}return db['SquareReport'][_0xda9f('0x43')](_0x2bc564);})[_0xda9f('0x27')](function(_0x182c0f){_0x7f6227[_0xda9f('0x44')]=_0x182c0f;return _0x7f6227;})[_0xda9f('0x27')](respondWithFilteredResult(_0x5e9fb0,_0x2bc564))[_0xda9f('0x45')](handleError(_0x5e9fb0,null));};exports['show']=function(_0x363dfa,_0x46f93d){var _0x5f2b5a={'raw':!![],'where':{'id':_0x363dfa['params']['id']}},_0x2f5ae7={};_0x2f5ae7['model']=_[_0xda9f('0x31')](db['SquareReport']['rawAttributes']);_0x2f5ae7[_0xda9f('0x35')]=_[_0xda9f('0x31')](_0x363dfa[_0xda9f('0x35')]);_0x2f5ae7[_0xda9f('0x3c')]=_[_0xda9f('0x32')](_0x2f5ae7[_0xda9f('0x30')],_0x2f5ae7[_0xda9f('0x35')]);_0x5f2b5a[_0xda9f('0x33')]=_[_0xda9f('0x32')](_0x2f5ae7[_0xda9f('0x30')],qs[_0xda9f('0x34')](_0x363dfa[_0xda9f('0x35')][_0xda9f('0x34')]));_0x5f2b5a[_0xda9f('0x33')]=_0x5f2b5a[_0xda9f('0x33')]['length']?_0x5f2b5a['attributes']:_0x2f5ae7[_0xda9f('0x30')];if(_0x363dfa['query'][_0xda9f('0x41')]){_0x5f2b5a[_0xda9f('0x42')]=[{'all':!![]}];}_0x5f2b5a=_['merge']({},_0x5f2b5a,_0x363dfa[_0xda9f('0x40')]);return db['SquareReport']['find'](_0x5f2b5a)['then'](handleEntityNotFound(_0x46f93d,null))[_0xda9f('0x27')](respondWithResult(_0x46f93d,null))[_0xda9f('0x45')](handleError(_0x46f93d,null));};exports['create']=function(_0x2dffe5,_0x282811){return db[_0xda9f('0x2e')][_0xda9f('0x46')](_0x2dffe5[_0xda9f('0x47')],{})['then'](respondWithResult(_0x282811,0xc9))[_0xda9f('0x45')](handleError(_0x282811,null));};exports[_0xda9f('0x25')]=function(_0x2939df,_0x1a433f){if(_0x2939df['body']['id']){delete _0x2939df[_0xda9f('0x47')]['id'];}return db[_0xda9f('0x2e')][_0xda9f('0x48')]({'where':{'id':_0x2939df['params']['id']}})[_0xda9f('0x27')](handleEntityNotFound(_0x1a433f,null))['then'](saveUpdates(_0x2939df[_0xda9f('0x47')],null))['then'](respondWithResult(_0x1a433f,null))[_0xda9f('0x45')](handleError(_0x1a433f,null));};exports['destroy']=function(_0x2842f7,_0x5932ab){return db[_0xda9f('0x2e')]['find']({'where':{'id':_0x2842f7[_0xda9f('0x49')]['id']}})[_0xda9f('0x27')](handleEntityNotFound(_0x5932ab,null))[_0xda9f('0x27')](removeEntity(_0x5932ab,null))[_0xda9f('0x45')](handleError(_0x5932ab,null));};exports[_0xda9f('0x4a')]=function(_0x155c57,_0x3a0154){return db[_0xda9f('0x2e')][_0xda9f('0x4a')]()[_0xda9f('0x27')](respondWithResult(_0x3a0154,null))[_0xda9f('0x45')](handleError(_0x3a0154,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 8d25a74..4f5c8fc 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 _0xc453=['SquareReport','report_square','uniqueid','leaveAt','util','api','moment','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','exports'];(function(_0x2c9362,_0x3dff1e){var _0x58aba8=function(_0x41e340){while(--_0x41e340){_0x2c9362['push'](_0x2c9362['shift']());}};_0x58aba8(++_0x3dff1e);}(_0xc453,0x1d8));var _0x3c45=function(_0x1d0856,_0x49e164){_0x1d0856=_0x1d0856-0x0;var _0x598328=_0xc453[_0x1d0856];return _0x598328;};'use strict';var _=require('lodash');var util=require(_0x3c45('0x0'));var logger=require('../../config/logger')(_0x3c45('0x1'));var moment=require(_0x3c45('0x2'));var BPromise=require(_0x3c45('0x3'));var rp=require(_0x3c45('0x4'));var fs=require('fs');var path=require(_0x3c45('0x5'));var rimraf=require('rimraf');var config=require(_0x3c45('0x6'));var attributes=require(_0x3c45('0x7'));module[_0x3c45('0x8')]=function(_0x14476b,_0x58487d){return _0x14476b['define'](_0x3c45('0x9'),attributes,{'tableName':_0x3c45('0xa'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x3c45('0xb'),'project_name']},{'name':_0x3c45('0xc'),'fields':[_0x3c45('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfda9=['uid_pname','uniqueid','project_name','leaveAt','lodash','../../config/logger','bluebird','rimraf','./squareReport.attributes','exports','define','SquareReport','report_square'];(function(_0x20d9f0,_0x453415){var _0x195dda=function(_0x58d8e8){while(--_0x58d8e8){_0x20d9f0['push'](_0x20d9f0['shift']());}};_0x195dda(++_0x453415);}(_0xfda9,0x17d));var _0x9fda=function(_0x58594c,_0x5f05d1){_0x58594c=_0x58594c-0x0;var _0x440377=_0xfda9[_0x58594c];return _0x440377;};'use strict';var _=require(_0x9fda('0x0'));var util=require('util');var logger=require(_0x9fda('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9fda('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9fda('0x3'));var config=require('../../config/environment');var attributes=require(_0x9fda('0x4'));module[_0x9fda('0x5')]=function(_0x1f6979,_0x15b218){return _0x1f6979[_0x9fda('0x6')](_0x9fda('0x7'),attributes,{'tableName':_0x9fda('0x8'),'paranoid':![],'indexes':[{'name':_0x9fda('0x9'),'fields':[_0x9fda('0xa'),_0x9fda('0xb')]},{'name':_0x9fda('0xc'),'fields':[_0x9fda('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 1b0ebf1..d87b8db 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 _0xb798=['SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareReport','SquareReport','create','body','options','info','catch','UpdateSquareReport','raw','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x254c82,_0x2cbbf7){var _0x597c7e=function(_0x219714){while(--_0x219714){_0x254c82['push'](_0x254c82['shift']());}};_0x597c7e(++_0x2cbbf7);}(_0xb798,0xd9));var _0x8b79=function(_0x165a9d,_0x2556ad){_0x165a9d=_0x165a9d-0x0;var _0x332765=_0xb798[_0x165a9d];return _0x332765;};'use strict';var _=require('lodash');var util=require(_0x8b79('0x0'));var moment=require(_0x8b79('0x1'));var BPromise=require(_0x8b79('0x2'));var rs=require(_0x8b79('0x3'));var fs=require('fs');var Redis=require(_0x8b79('0x4'));var db=require(_0x8b79('0x5'))['db'];var utils=require(_0x8b79('0x6'));var logger=require('../../config/logger')(_0x8b79('0x7'));var config=require(_0x8b79('0x8'));var jayson=require(_0x8b79('0x9'));var client=jayson[_0x8b79('0xa')][_0x8b79('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2aceed,_0x328159,_0x14f9aa){return new BPromise(function(_0x589251,_0x337873){return client[_0x8b79('0xc')](_0x2aceed,_0x14f9aa)[_0x8b79('0xd')](function(_0x117e11){logger['info'](_0x8b79('0xe'),_0x328159,_0x8b79('0xf'));logger[_0x8b79('0x10')](_0x8b79('0x11'),_0x328159,_0x8b79('0xf'),JSON[_0x8b79('0x12')](_0x117e11));if(_0x117e11[_0x8b79('0x13')]){if(_0x117e11[_0x8b79('0x13')][_0x8b79('0x14')]===0x1f4){logger['error'](_0x8b79('0xe'),_0x328159,_0x117e11[_0x8b79('0x13')][_0x8b79('0x15')]);return _0x337873(_0x117e11[_0x8b79('0x13')][_0x8b79('0x15')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0x328159,_0x117e11['error'][_0x8b79('0x15')]);return _0x589251(_0x117e11[_0x8b79('0x13')]['message']);}else{logger['info'](_0x8b79('0xe'),_0x328159,_0x8b79('0xf'));_0x589251(_0x117e11[_0x8b79('0x16')][_0x8b79('0x15')]);}})['catch'](function(_0x3bb3af){logger[_0x8b79('0x13')](_0x8b79('0xe'),_0x328159,_0x3bb3af);_0x337873(_0x3bb3af);});});}exports[_0x8b79('0x17')]=function(_0x3be049){var _0x879cc3=this;return new Promise(function(_0x3ec1b3,_0xfbbb4c){return db[_0x8b79('0x18')][_0x8b79('0x19')](_0x3be049[_0x8b79('0x1a')],{'raw':_0x3be049[_0x8b79('0x1b')]?_0x3be049[_0x8b79('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x8b79('0xd')](function(_0x579221){logger[_0x8b79('0x1c')](_0x8b79('0x17'),_0x3be049);logger[_0x8b79('0x10')]('CreateSquareReport',_0x3be049,JSON[_0x8b79('0x12')](_0x579221));_0x3ec1b3(_0x579221);})[_0x8b79('0x1d')](function(_0x2e81e4){logger[_0x8b79('0x13')](_0x8b79('0x17'),_0x2e81e4[_0x8b79('0x15')],_0x3be049);_0xfbbb4c(_0x879cc3['error'](0x1f4,_0x2e81e4['message']));});});};exports[_0x8b79('0x1e')]=function(_0x3a392a){var _0x5407f2=this;return new Promise(function(_0x44b600,_0x463433){return db[_0x8b79('0x18')]['update'](_0x3a392a[_0x8b79('0x1a')],{'raw':_0x3a392a[_0x8b79('0x1b')]?_0x3a392a[_0x8b79('0x1b')][_0x8b79('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a392a['options']?_0x3a392a[_0x8b79('0x1b')]['where']||null:null,'attributes':_0x3a392a['options']?_0x3a392a[_0x8b79('0x1b')][_0x8b79('0x20')]||null:null,'limit':_0x3a392a['options']?_0x3a392a[_0x8b79('0x1b')]['limit']||null:null})[_0x8b79('0xd')](function(_0x365cea){logger['info']('UpdateSquareReport',_0x3a392a);logger['debug'](_0x8b79('0x1e'),_0x3a392a,JSON[_0x8b79('0x12')](_0x365cea));_0x44b600(_0x365cea);})[_0x8b79('0x1d')](function(_0x386083){logger['error'](_0x8b79('0x1e'),_0x386083[_0x8b79('0x15')],_0x3a392a);_0x463433(_0x5407f2['error'](0x1f4,_0x386083['message']));});});}; \ No newline at end of file +var _0x0855=['attributes','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','client','http','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareReport','SquareReport','create','body','options','UpdateSquareReport','update','raw'];(function(_0x413b4f,_0x2d104a){var _0x5a372f=function(_0x5b697c){while(--_0x5b697c){_0x413b4f['push'](_0x413b4f['shift']());}};_0x5a372f(++_0x2d104a);}(_0x0855,0xf1));var _0x5085=function(_0x35069a,_0x4bcd1b){_0x35069a=_0x35069a-0x0;var _0x5bdba6=_0x0855[_0x35069a];return _0x5bdba6;};'use strict';var _=require(_0x5085('0x0'));var util=require(_0x5085('0x1'));var moment=require('moment');var BPromise=require(_0x5085('0x2'));var rs=require(_0x5085('0x3'));var fs=require('fs');var Redis=require(_0x5085('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5085('0x5'));var logger=require('../../config/logger')(_0x5085('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5085('0x7')][_0x5085('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e2ce0,_0x54dd37,_0x124f4c){return new BPromise(function(_0x77142d,_0x8e12e){return client['request'](_0x2e2ce0,_0x124f4c)[_0x5085('0x9')](function(_0x1177a2){logger['info'](_0x5085('0xa'),_0x54dd37,_0x5085('0xb'));logger[_0x5085('0xc')](_0x5085('0xd'),_0x54dd37,'request\x20sent',JSON[_0x5085('0xe')](_0x1177a2));if(_0x1177a2['error']){if(_0x1177a2[_0x5085('0xf')][_0x5085('0x10')]===0x1f4){logger['error'](_0x5085('0xa'),_0x54dd37,_0x1177a2[_0x5085('0xf')][_0x5085('0x11')]);return _0x8e12e(_0x1177a2[_0x5085('0xf')][_0x5085('0x11')]);}logger[_0x5085('0xf')](_0x5085('0xa'),_0x54dd37,_0x1177a2['error'][_0x5085('0x11')]);return _0x77142d(_0x1177a2['error'][_0x5085('0x11')]);}else{logger[_0x5085('0x12')](_0x5085('0xa'),_0x54dd37,_0x5085('0xb'));_0x77142d(_0x1177a2[_0x5085('0x13')][_0x5085('0x11')]);}})[_0x5085('0x14')](function(_0x4248c2){logger[_0x5085('0xf')](_0x5085('0xa'),_0x54dd37,_0x4248c2);_0x8e12e(_0x4248c2);});});}exports[_0x5085('0x15')]=function(_0x1402c0){var _0x5bd786=this;return new Promise(function(_0x3ba48d,_0x516867){return db[_0x5085('0x16')][_0x5085('0x17')](_0x1402c0[_0x5085('0x18')],{'raw':_0x1402c0[_0x5085('0x19')]?_0x1402c0[_0x5085('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x5085('0x9')](function(_0x129efa){logger[_0x5085('0x12')](_0x5085('0x15'),_0x1402c0);logger['debug']('CreateSquareReport',_0x1402c0,JSON[_0x5085('0xe')](_0x129efa));_0x3ba48d(_0x129efa);})['catch'](function(_0x33ad54){logger[_0x5085('0xf')]('CreateSquareReport',_0x33ad54[_0x5085('0x11')],_0x1402c0);_0x516867(_0x5bd786['error'](0x1f4,_0x33ad54[_0x5085('0x11')]));});});};exports[_0x5085('0x1a')]=function(_0x286b1f){var _0x3da0a9=this;return new Promise(function(_0xf0df71,_0x3a294c){return db[_0x5085('0x16')][_0x5085('0x1b')](_0x286b1f['body'],{'raw':_0x286b1f[_0x5085('0x19')]?_0x286b1f[_0x5085('0x19')][_0x5085('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x286b1f['options']?_0x286b1f[_0x5085('0x19')]['where']||null:null,'attributes':_0x286b1f[_0x5085('0x19')]?_0x286b1f[_0x5085('0x19')][_0x5085('0x1d')]||null:null,'limit':_0x286b1f[_0x5085('0x19')]?_0x286b1f['options']['limit']||null:null})[_0x5085('0x9')](function(_0x182861){logger[_0x5085('0x12')](_0x5085('0x1a'),_0x286b1f);logger[_0x5085('0xc')]('UpdateSquareReport',_0x286b1f,JSON[_0x5085('0xe')](_0x182861));_0xf0df71(_0x182861);})[_0x5085('0x14')](function(_0x54851b){logger['error'](_0x5085('0x1a'),_0x54851b[_0x5085('0x11')],_0x286b1f);_0x3a294c(_0x3da0a9['error'](0x1f4,_0x54851b[_0x5085('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 7cc596a..0263bc3 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 _0x6b1d=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put'];(function(_0x1983c9,_0x218d03){var _0x131f55=function(_0x83684a){while(--_0x83684a){_0x1983c9['push'](_0x1983c9['shift']());}};_0x131f55(++_0x218d03);}(_0x6b1d,0xca));var _0xd6b1=function(_0x42b902,_0x3c49fd){_0x42b902=_0x42b902-0x0;var _0x2d9d68=_0x6b1d[_0x42b902];return _0x2d9d68;};'use strict';var multer=require(_0xd6b1('0x0'));var util=require(_0xd6b1('0x1'));var path=require(_0xd6b1('0x2'));var timeout=require(_0xd6b1('0x3'));var express=require(_0xd6b1('0x4'));var router=express['Router']();var fs_extra=require(_0xd6b1('0x5'));var auth=require(_0xd6b1('0x6'));var interaction=require(_0xd6b1('0x7'));var config=require('../../config/environment');var controller=require(_0xd6b1('0x8'));router[_0xd6b1('0x9')]('/',auth['isAuthenticated'](),controller[_0xd6b1('0xa')]);router[_0xd6b1('0x9')](_0xd6b1('0xb'),auth[_0xd6b1('0xc')](),controller[_0xd6b1('0xd')]);router['get'](_0xd6b1('0xe'),auth['isAuthenticated'](),controller[_0xd6b1('0xf')]);router[_0xd6b1('0x10')]('/',auth[_0xd6b1('0xc')](),controller['create']);router[_0xd6b1('0x11')](_0xd6b1('0xe'),auth['isAuthenticated'](),controller[_0xd6b1('0x12')]);router[_0xd6b1('0x13')]('/:id',auth[_0xd6b1('0xc')](),controller[_0xd6b1('0x14')]);module[_0xd6b1('0x15')]=router; \ No newline at end of file +var _0x7805=['put','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','index','/describe','/:id','post','isAuthenticated'];(function(_0x1a6a25,_0x2394f6){var _0x592ccb=function(_0x4f6994){while(--_0x4f6994){_0x1a6a25['push'](_0x1a6a25['shift']());}};_0x592ccb(++_0x2394f6);}(_0x7805,0x124));var _0x5780=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x7805[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x5780('0x0'));var util=require(_0x5780('0x1'));var path=require('path');var timeout=require(_0x5780('0x2'));var express=require(_0x5780('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5780('0x4'));var interaction=require(_0x5780('0x5'));var config=require(_0x5780('0x6'));var controller=require(_0x5780('0x7'));router[_0x5780('0x8')]('/',auth['isAuthenticated'](),controller[_0x5780('0x9')]);router['get'](_0x5780('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x5780('0x8')](_0x5780('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x5780('0xc')]('/',auth[_0x5780('0xd')](),controller['create']);router[_0x5780('0xe')](_0x5780('0xb'),auth[_0x5780('0xd')](),controller['update']);router[_0x5780('0xf')]('/:id',auth[_0x5780('0xd')](),controller[_0x5780('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 2d788ff..f037a29 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 _0x6df1=['exports','STRING','TEXT'];(function(_0x349785,_0x4d47d7){var _0x53ca67=function(_0x512ce5){while(--_0x512ce5){_0x349785['push'](_0x349785['shift']());}};_0x53ca67(++_0x4d47d7);}(_0x6df1,0x90));var _0x16df=function(_0x5ad0d7,_0x2645f8){_0x5ad0d7=_0x5ad0d7-0x0;var _0xd83bd=_0x6df1[_0x5ad0d7];return _0xd83bd;};'use strict';var Sequelize=require('sequelize');module[_0x16df('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x16df('0x1')]},'application':{'type':Sequelize[_0x16df('0x1')]},'data':{'type':Sequelize[_0x16df('0x2')]},'project_name':{'type':Sequelize[_0x16df('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xce63=['STRING','TEXT'];(function(_0x332fc5,_0x28b7dd){var _0x3e6352=function(_0x484dac){while(--_0x484dac){_0x332fc5['push'](_0x332fc5['shift']());}};_0x3e6352(++_0x28b7dd);}(_0xce63,0xf0));var _0x3ce6=function(_0x3cc05d,_0x4b8f88){_0x3cc05d=_0x3cc05d-0x0;var _0x28b736=_0xce63[_0x3cc05d];return _0x28b736;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x3ce6('0x0')]},'node':{'type':Sequelize[_0x3ce6('0x0')]},'application':{'type':Sequelize[_0x3ce6('0x0')]},'data':{'type':Sequelize[_0x3ce6('0x1')]},'project_name':{'type':Sequelize[_0x3ce6('0x0')]},'callerid':{'type':Sequelize[_0x3ce6('0x0')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 4d573d5..11503bb 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 _0xcc63=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','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','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','stack','name','send','map','rawAttributes','type','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','SquareDetailsReport','findAll','rows','catch','show','params','keys','find','create','update','body','describe','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x570ce1,_0x16c01d){var _0x3cca80=function(_0x4caf6e){while(--_0x4caf6e){_0x570ce1['push'](_0x570ce1['shift']());}};_0x3cca80(++_0x16c01d);}(_0xcc63,0xda));var _0x3cc6=function(_0x3e21b3,_0x4d760b){_0x3e21b3=_0x3e21b3-0x0;var _0x315625=_0xcc63[_0x3e21b3];return _0x315625;};'use strict';var emlformat=require(_0x3cc6('0x0'));var rimraf=require(_0x3cc6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3cc6('0x2'));var rp=require(_0x3cc6('0x3'));var moment=require(_0x3cc6('0x4'));var BPromise=require(_0x3cc6('0x5'));var Mustache=require(_0x3cc6('0x6'));var util=require(_0x3cc6('0x7'));var path=require(_0x3cc6('0x8'));var sox=require(_0x3cc6('0x9'));var csv=require(_0x3cc6('0xa'));var ejs=require(_0x3cc6('0xb'));var fs=require('fs');var fs_extra=require(_0x3cc6('0xc'));var _=require(_0x3cc6('0xd'));var squel=require('squel');var crypto=require(_0x3cc6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3cc6('0xf'));var toCsv=require(_0x3cc6('0xa'));var querystring=require(_0x3cc6('0x10'));var Papa=require(_0x3cc6('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3cc6('0x12'));var as=require(_0x3cc6('0x13'));var hardwareService=require(_0x3cc6('0x14'));var logger=require(_0x3cc6('0x15'))('api');var utils=require(_0x3cc6('0x16'));var config=require(_0x3cc6('0x17'));var licenseUtil=require(_0x3cc6('0x18'));var db=require(_0x3cc6('0x19'))['db'];function respondWithStatusCode(_0x5a6613,_0x36f1de){_0x36f1de=_0x36f1de||0xcc;return function(_0x329bc3){if(_0x329bc3){return _0x5a6613[_0x3cc6('0x1a')](_0x36f1de);}return _0x5a6613[_0x3cc6('0x1b')](_0x36f1de)[_0x3cc6('0x1c')]();};}function respondWithResult(_0x1fe6fe,_0xb65b76){_0xb65b76=_0xb65b76||0xc8;return function(_0x1dcf02){if(_0x1dcf02){return _0x1fe6fe[_0x3cc6('0x1b')](_0xb65b76)[_0x3cc6('0x1d')](_0x1dcf02);}};}function respondWithFilteredResult(_0x1293bb,_0x115a9d){return function(_0x581f6d){if(_0x581f6d){var _0x38decb=typeof _0x115a9d[_0x3cc6('0x1e')]===_0x3cc6('0x1f')&&typeof _0x115a9d[_0x3cc6('0x20')]==='undefined';var _0x34248a=_0x581f6d[_0x3cc6('0x21')];var _0x45e883=_0x38decb?0x0:_0x115a9d[_0x3cc6('0x1e')];var _0x13171d=_0x38decb?_0x581f6d[_0x3cc6('0x21')]:_0x115a9d['offset']+_0x115a9d['limit'];var _0x150d49;if(_0x13171d>=_0x34248a){_0x13171d=_0x34248a;_0x150d49=0xc8;}else{_0x150d49=0xce;}_0x1293bb[_0x3cc6('0x1b')](_0x150d49);return _0x1293bb['set'](_0x3cc6('0x22'),_0x45e883+'-'+_0x13171d+'/'+_0x34248a)[_0x3cc6('0x1d')](_0x581f6d);}return null;};}function patchUpdates(_0xefbbaa){return function(_0x4e0520){try{jsonpatch['apply'](_0x4e0520,_0xefbbaa,!![]);}catch(_0x2ade3d){return BPromise[_0x3cc6('0x23')](_0x2ade3d);}return _0x4e0520[_0x3cc6('0x24')]();};}function saveUpdates(_0xa170e5,_0x291811){return function(_0x49fe05){if(_0x49fe05){return _0x49fe05['update'](_0xa170e5)[_0x3cc6('0x25')](function(_0xf71546){return _0xf71546;});}return null;};}function removeEntity(_0x30fbbf,_0x553ef6){return function(_0x3e9414){if(_0x3e9414){return _0x3e9414[_0x3cc6('0x26')]()[_0x3cc6('0x25')](function(){_0x30fbbf[_0x3cc6('0x1b')](0xcc)[_0x3cc6('0x1c')]();});}};}function handleEntityNotFound(_0x15c3f5,_0x52903f){return function(_0x4ac361){if(!_0x4ac361){_0x15c3f5[_0x3cc6('0x1a')](0x194);}return _0x4ac361;};}function handleError(_0x486865,_0x495515){_0x495515=_0x495515||0x1f4;return function(_0xf9979b){logger['error'](_0xf9979b[_0x3cc6('0x27')]);if(_0xf9979b[_0x3cc6('0x28')]){delete _0xf9979b['name'];}_0x486865[_0x3cc6('0x1b')](_0x495515)[_0x3cc6('0x29')](_0xf9979b);};}exports['index']=function(_0xbe4249,_0x4813d5){var _0x346473={},_0x4fca2d={},_0x558a01={'count':0x0,'rows':[]};var _0x545d3f=_[_0x3cc6('0x2a')](db['SquareDetailsReport'][_0x3cc6('0x2b')],function(_0x266793){return{'name':_0x266793['fieldName'],'type':_0x266793[_0x3cc6('0x2c')]['key']};});_0x4fca2d['model']=_[_0x3cc6('0x2a')](_0x545d3f,_0x3cc6('0x28'));_0x4fca2d[_0x3cc6('0x2d')]=_['keys'](_0xbe4249['query']);_0x4fca2d[_0x3cc6('0x2e')]=_['intersection'](_0x4fca2d[_0x3cc6('0x2f')],_0x4fca2d['query']);_0x346473['attributes']=_['intersection'](_0x4fca2d['model'],qs[_0x3cc6('0x30')](_0xbe4249[_0x3cc6('0x2d')][_0x3cc6('0x30')]));_0x346473[_0x3cc6('0x31')]=_0x346473['attributes'][_0x3cc6('0x32')]?_0x346473[_0x3cc6('0x31')]:_0x4fca2d[_0x3cc6('0x2f')];if(!_0xbe4249[_0x3cc6('0x2d')][_0x3cc6('0x33')](_0x3cc6('0x34'))){_0x346473['limit']=qs['limit'](_0xbe4249['query'][_0x3cc6('0x20')]);_0x346473[_0x3cc6('0x1e')]=qs[_0x3cc6('0x1e')](_0xbe4249[_0x3cc6('0x2d')][_0x3cc6('0x1e')]);}_0x346473[_0x3cc6('0x35')]=qs[_0x3cc6('0x36')](_0xbe4249[_0x3cc6('0x2d')][_0x3cc6('0x36')]);_0x346473[_0x3cc6('0x37')]=qs[_0x3cc6('0x2e')](_[_0x3cc6('0x38')](_0xbe4249['query'],_0x4fca2d[_0x3cc6('0x2e')]),_0x545d3f);if(_0xbe4249[_0x3cc6('0x2d')][_0x3cc6('0x39')]){_0x346473[_0x3cc6('0x37')]=_[_0x3cc6('0x3a')](_0x346473[_0x3cc6('0x37')],{'$or':_[_0x3cc6('0x2a')](_0x545d3f,function(_0x2fc04d){if(_0x2fc04d[_0x3cc6('0x2c')]!=='VIRTUAL'){var _0x137e50={};_0x137e50[_0x2fc04d['name']]={'$like':'%'+_0xbe4249[_0x3cc6('0x2d')][_0x3cc6('0x39')]+'%'};return _0x137e50;}})});}_0x346473=_[_0x3cc6('0x3a')]({},_0x346473,_0xbe4249[_0x3cc6('0x3b')]);var _0x519e72={'where':_0x346473[_0x3cc6('0x37')]};return db['SquareDetailsReport']['count'](_0x519e72)[_0x3cc6('0x25')](function(_0x561ff1){_0x558a01[_0x3cc6('0x21')]=_0x561ff1;if(_0xbe4249['query'][_0x3cc6('0x3c')]){_0x346473[_0x3cc6('0x3d')]=[{'all':!![]}];}return db[_0x3cc6('0x3e')][_0x3cc6('0x3f')](_0x346473);})['then'](function(_0x16a333){_0x558a01[_0x3cc6('0x40')]=_0x16a333;return _0x558a01;})[_0x3cc6('0x25')](respondWithFilteredResult(_0x4813d5,_0x346473))[_0x3cc6('0x41')](handleError(_0x4813d5,null));};exports[_0x3cc6('0x42')]=function(_0x37f211,_0x5325b5){var _0x573f89={'raw':!![],'where':{'id':_0x37f211[_0x3cc6('0x43')]['id']}},_0x438032={};_0x438032['model']=_[_0x3cc6('0x44')](db['SquareDetailsReport'][_0x3cc6('0x2b')]);_0x438032[_0x3cc6('0x2d')]=_['keys'](_0x37f211['query']);_0x438032[_0x3cc6('0x2e')]=_['intersection'](_0x438032['model'],_0x438032[_0x3cc6('0x2d')]);_0x573f89[_0x3cc6('0x31')]=_['intersection'](_0x438032[_0x3cc6('0x2f')],qs[_0x3cc6('0x30')](_0x37f211['query'][_0x3cc6('0x30')]));_0x573f89['attributes']=_0x573f89['attributes'][_0x3cc6('0x32')]?_0x573f89[_0x3cc6('0x31')]:_0x438032[_0x3cc6('0x2f')];if(_0x37f211[_0x3cc6('0x2d')][_0x3cc6('0x3c')]){_0x573f89[_0x3cc6('0x3d')]=[{'all':!![]}];}_0x573f89=_[_0x3cc6('0x3a')]({},_0x573f89,_0x37f211[_0x3cc6('0x3b')]);return db[_0x3cc6('0x3e')][_0x3cc6('0x45')](_0x573f89)['then'](handleEntityNotFound(_0x5325b5,null))['then'](respondWithResult(_0x5325b5,null))[_0x3cc6('0x41')](handleError(_0x5325b5,null));};exports[_0x3cc6('0x46')]=function(_0xddeac0,_0x2067da){return db[_0x3cc6('0x3e')][_0x3cc6('0x46')](_0xddeac0['body'],{})[_0x3cc6('0x25')](respondWithResult(_0x2067da,0xc9))['catch'](handleError(_0x2067da,null));};exports[_0x3cc6('0x47')]=function(_0x2e834b,_0x31d1ba){if(_0x2e834b[_0x3cc6('0x48')]['id']){delete _0x2e834b[_0x3cc6('0x48')]['id'];}return db['SquareDetailsReport'][_0x3cc6('0x45')]({'where':{'id':_0x2e834b['params']['id']}})[_0x3cc6('0x25')](handleEntityNotFound(_0x31d1ba,null))[_0x3cc6('0x25')](saveUpdates(_0x2e834b[_0x3cc6('0x48')],null))['then'](respondWithResult(_0x31d1ba,null))['catch'](handleError(_0x31d1ba,null));};exports[_0x3cc6('0x26')]=function(_0x435a33,_0x6f5aea){return db[_0x3cc6('0x3e')][_0x3cc6('0x45')]({'where':{'id':_0x435a33['params']['id']}})['then'](handleEntityNotFound(_0x6f5aea,null))['then'](removeEntity(_0x6f5aea,null))[_0x3cc6('0x41')](handleError(_0x6f5aea,null));};exports[_0x3cc6('0x49')]=function(_0x4029ef,_0x400a4e){return db['SquareDetailsReport'][_0x3cc6('0x49')]()[_0x3cc6('0x25')](respondWithResult(_0x400a4e,null))[_0x3cc6('0x41')](handleError(_0x400a4e,null));}; \ No newline at end of file +var _0x85ac=['rows','show','params','find','catch','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include'];(function(_0x2f1f93,_0x55b2b7){var _0x3b2e8e=function(_0x4c5766){while(--_0x4c5766){_0x2f1f93['push'](_0x2f1f93['shift']());}};_0x3b2e8e(++_0x55b2b7);}(_0x85ac,0x9c));var _0xc85a=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x85ac[_0x28947d];return _0x12d2ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc85a('0x0'));var zipdir=require(_0xc85a('0x1'));var jsonpatch=require(_0xc85a('0x2'));var rp=require(_0xc85a('0x3'));var moment=require(_0xc85a('0x4'));var BPromise=require(_0xc85a('0x5'));var Mustache=require('mustache');var util=require(_0xc85a('0x6'));var path=require(_0xc85a('0x7'));var sox=require('sox');var csv=require(_0xc85a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc85a('0x9'));var _=require('lodash');var squel=require(_0xc85a('0xa'));var crypto=require(_0xc85a('0xb'));var jsforce=require(_0xc85a('0xc'));var deskjs=require(_0xc85a('0xd'));var toCsv=require(_0xc85a('0x8'));var querystring=require('querystring');var Papa=require(_0xc85a('0xe'));var Redis=require('ioredis');var authService=require(_0xc85a('0xf'));var qs=require(_0xc85a('0x10'));var as=require(_0xc85a('0x11'));var hardwareService=require(_0xc85a('0x12'));var logger=require(_0xc85a('0x13'))(_0xc85a('0x14'));var utils=require(_0xc85a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc85a('0x16'));var db=require(_0xc85a('0x17'))['db'];function respondWithStatusCode(_0xa77062,_0x1f7025){_0x1f7025=_0x1f7025||0xcc;return function(_0x4d748d){if(_0x4d748d){return _0xa77062[_0xc85a('0x18')](_0x1f7025);}return _0xa77062['status'](_0x1f7025)[_0xc85a('0x19')]();};}function respondWithResult(_0x53f310,_0x32c601){_0x32c601=_0x32c601||0xc8;return function(_0x516963){if(_0x516963){return _0x53f310[_0xc85a('0x1a')](_0x32c601)[_0xc85a('0x1b')](_0x516963);}};}function respondWithFilteredResult(_0x59cc87,_0x70d33c){return function(_0x2be340){if(_0x2be340){var _0x51401e=typeof _0x70d33c['offset']===_0xc85a('0x1c')&&typeof _0x70d33c[_0xc85a('0x1d')]===_0xc85a('0x1c');var _0x316988=_0x2be340[_0xc85a('0x1e')];var _0x467fd4=_0x51401e?0x0:_0x70d33c[_0xc85a('0x1f')];var _0x122c4c=_0x51401e?_0x2be340[_0xc85a('0x1e')]:_0x70d33c[_0xc85a('0x1f')]+_0x70d33c['limit'];var _0x4f4248;if(_0x122c4c>=_0x316988){_0x122c4c=_0x316988;_0x4f4248=0xc8;}else{_0x4f4248=0xce;}_0x59cc87[_0xc85a('0x1a')](_0x4f4248);return _0x59cc87[_0xc85a('0x20')](_0xc85a('0x21'),_0x467fd4+'-'+_0x122c4c+'/'+_0x316988)['json'](_0x2be340);}return null;};}function patchUpdates(_0x97fbd9){return function(_0x354b3d){try{jsonpatch[_0xc85a('0x22')](_0x354b3d,_0x97fbd9,!![]);}catch(_0x2d1f6b){return BPromise[_0xc85a('0x23')](_0x2d1f6b);}return _0x354b3d[_0xc85a('0x24')]();};}function saveUpdates(_0x24a9c3,_0x294590){return function(_0x3eb443){if(_0x3eb443){return _0x3eb443[_0xc85a('0x25')](_0x24a9c3)[_0xc85a('0x26')](function(_0x4251b0){return _0x4251b0;});}return null;};}function removeEntity(_0x1e9ec8,_0x4e71da){return function(_0x33c091){if(_0x33c091){return _0x33c091['destroy']()['then'](function(){_0x1e9ec8[_0xc85a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c0cd6,_0xcdda84){return function(_0x331030){if(!_0x331030){_0x3c0cd6[_0xc85a('0x18')](0x194);}return _0x331030;};}function handleError(_0xe3ea41,_0x5dbeaf){_0x5dbeaf=_0x5dbeaf||0x1f4;return function(_0x235319){logger['error'](_0x235319[_0xc85a('0x27')]);if(_0x235319[_0xc85a('0x28')]){delete _0x235319[_0xc85a('0x28')];}_0xe3ea41[_0xc85a('0x1a')](_0x5dbeaf)[_0xc85a('0x29')](_0x235319);};}exports[_0xc85a('0x2a')]=function(_0x2588f0,_0x56f248){var _0x3fc8e3={},_0x3feefb={},_0x489eea={'count':0x0,'rows':[]};var _0xf9f488=_[_0xc85a('0x2b')](db[_0xc85a('0x2c')][_0xc85a('0x2d')],function(_0x2fd96e){return{'name':_0x2fd96e[_0xc85a('0x2e')],'type':_0x2fd96e[_0xc85a('0x2f')][_0xc85a('0x30')]};});_0x3feefb['model']=_[_0xc85a('0x2b')](_0xf9f488,_0xc85a('0x28'));_0x3feefb[_0xc85a('0x31')]=_[_0xc85a('0x32')](_0x2588f0['query']);_0x3feefb[_0xc85a('0x33')]=_[_0xc85a('0x34')](_0x3feefb[_0xc85a('0x35')],_0x3feefb[_0xc85a('0x31')]);_0x3fc8e3[_0xc85a('0x36')]=_[_0xc85a('0x34')](_0x3feefb['model'],qs[_0xc85a('0x37')](_0x2588f0['query'][_0xc85a('0x37')]));_0x3fc8e3[_0xc85a('0x36')]=_0x3fc8e3[_0xc85a('0x36')][_0xc85a('0x38')]?_0x3fc8e3[_0xc85a('0x36')]:_0x3feefb[_0xc85a('0x35')];if(!_0x2588f0[_0xc85a('0x31')][_0xc85a('0x39')]('nolimit')){_0x3fc8e3[_0xc85a('0x1d')]=qs[_0xc85a('0x1d')](_0x2588f0[_0xc85a('0x31')]['limit']);_0x3fc8e3[_0xc85a('0x1f')]=qs['offset'](_0x2588f0['query'][_0xc85a('0x1f')]);}_0x3fc8e3[_0xc85a('0x3a')]=qs['sort'](_0x2588f0[_0xc85a('0x31')][_0xc85a('0x3b')]);_0x3fc8e3[_0xc85a('0x3c')]=qs['filters'](_['pick'](_0x2588f0['query'],_0x3feefb[_0xc85a('0x33')]),_0xf9f488);if(_0x2588f0[_0xc85a('0x31')][_0xc85a('0x3d')]){_0x3fc8e3[_0xc85a('0x3c')]=_[_0xc85a('0x3e')](_0x3fc8e3[_0xc85a('0x3c')],{'$or':_['map'](_0xf9f488,function(_0x110b84){if(_0x110b84[_0xc85a('0x2f')]!=='VIRTUAL'){var _0x43e1cf={};_0x43e1cf[_0x110b84[_0xc85a('0x28')]]={'$like':'%'+_0x2588f0[_0xc85a('0x31')][_0xc85a('0x3d')]+'%'};return _0x43e1cf;}})});}_0x3fc8e3=_[_0xc85a('0x3e')]({},_0x3fc8e3,_0x2588f0[_0xc85a('0x3f')]);var _0x4896ba={'where':_0x3fc8e3[_0xc85a('0x3c')]};return db['SquareDetailsReport'][_0xc85a('0x1e')](_0x4896ba)[_0xc85a('0x26')](function(_0xd59ed){_0x489eea[_0xc85a('0x1e')]=_0xd59ed;if(_0x2588f0[_0xc85a('0x31')][_0xc85a('0x40')]){_0x3fc8e3[_0xc85a('0x41')]=[{'all':!![]}];}return db[_0xc85a('0x2c')]['findAll'](_0x3fc8e3);})[_0xc85a('0x26')](function(_0xf5cc32){_0x489eea[_0xc85a('0x42')]=_0xf5cc32;return _0x489eea;})['then'](respondWithFilteredResult(_0x56f248,_0x3fc8e3))['catch'](handleError(_0x56f248,null));};exports[_0xc85a('0x43')]=function(_0x311054,_0x4c9323){var _0x6861de={'raw':!![],'where':{'id':_0x311054[_0xc85a('0x44')]['id']}},_0x538aa0={};_0x538aa0['model']=_[_0xc85a('0x32')](db['SquareDetailsReport'][_0xc85a('0x2d')]);_0x538aa0[_0xc85a('0x31')]=_[_0xc85a('0x32')](_0x311054[_0xc85a('0x31')]);_0x538aa0['filters']=_['intersection'](_0x538aa0[_0xc85a('0x35')],_0x538aa0['query']);_0x6861de['attributes']=_['intersection'](_0x538aa0[_0xc85a('0x35')],qs[_0xc85a('0x37')](_0x311054[_0xc85a('0x31')]['fields']));_0x6861de[_0xc85a('0x36')]=_0x6861de[_0xc85a('0x36')][_0xc85a('0x38')]?_0x6861de[_0xc85a('0x36')]:_0x538aa0[_0xc85a('0x35')];if(_0x311054['query'][_0xc85a('0x40')]){_0x6861de[_0xc85a('0x41')]=[{'all':!![]}];}_0x6861de=_['merge']({},_0x6861de,_0x311054[_0xc85a('0x3f')]);return db[_0xc85a('0x2c')][_0xc85a('0x45')](_0x6861de)['then'](handleEntityNotFound(_0x4c9323,null))[_0xc85a('0x26')](respondWithResult(_0x4c9323,null))[_0xc85a('0x46')](handleError(_0x4c9323,null));};exports['create']=function(_0x2bad2e,_0x369172){return db['SquareDetailsReport']['create'](_0x2bad2e[_0xc85a('0x47')],{})[_0xc85a('0x26')](respondWithResult(_0x369172,0xc9))['catch'](handleError(_0x369172,null));};exports[_0xc85a('0x25')]=function(_0x29e8ee,_0x2ac023){if(_0x29e8ee[_0xc85a('0x47')]['id']){delete _0x29e8ee[_0xc85a('0x47')]['id'];}return db[_0xc85a('0x2c')][_0xc85a('0x45')]({'where':{'id':_0x29e8ee[_0xc85a('0x44')]['id']}})[_0xc85a('0x26')](handleEntityNotFound(_0x2ac023,null))[_0xc85a('0x26')](saveUpdates(_0x29e8ee[_0xc85a('0x47')],null))['then'](respondWithResult(_0x2ac023,null))[_0xc85a('0x46')](handleError(_0x2ac023,null));};exports[_0xc85a('0x48')]=function(_0x46be18,_0x2372f3){return db['SquareDetailsReport'][_0xc85a('0x45')]({'where':{'id':_0x46be18[_0xc85a('0x44')]['id']}})['then'](handleEntityNotFound(_0x2372f3,null))[_0xc85a('0x26')](removeEntity(_0x2372f3,null))[_0xc85a('0x46')](handleError(_0x2372f3,null));};exports[_0xc85a('0x49')]=function(_0x1ec7f5,_0x5c027f){return db[_0xc85a('0x2c')][_0xc85a('0x49')]()[_0xc85a('0x26')](respondWithResult(_0x5c027f,null))[_0xc85a('0x46')](handleError(_0x5c027f,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index ee38aef..0c3066b 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 _0x0362=['../../config/logger','api','moment','bluebird','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','lodash','util'];(function(_0x2e9556,_0x5d18fb){var _0x1d4a1f=function(_0x46d452){while(--_0x46d452){_0x2e9556['push'](_0x2e9556['shift']());}};_0x1d4a1f(++_0x5d18fb);}(_0x0362,0x1ed));var _0x2036=function(_0x39fad1,_0x3394bf){_0x39fad1=_0x39fad1-0x0;var _0x4c30b3=_0x0362[_0x39fad1];return _0x4c30b3;};'use strict';var _=require(_0x2036('0x0'));var util=require(_0x2036('0x1'));var logger=require(_0x2036('0x2'))(_0x2036('0x3'));var moment=require(_0x2036('0x4'));var BPromise=require(_0x2036('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2036('0x6'));var config=require('../../config/environment');var attributes=require(_0x2036('0x7'));module[_0x2036('0x8')]=function(_0x38468e,_0x209250){return _0x38468e[_0x2036('0x9')](_0x2036('0xa'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbebb=['bluebird','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','lodash','util','../../config/logger','moment'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xbebb,0x110));var _0xbbeb=function(_0xb11217,_0x4645a8){_0xb11217=_0xb11217-0x0;var _0x30dcd2=_0xbebb[_0xb11217];return _0x30dcd2;};'use strict';var _=require(_0xbbeb('0x0'));var util=require(_0xbbeb('0x1'));var logger=require(_0xbbeb('0x2'))('api');var moment=require(_0xbbeb('0x3'));var BPromise=require(_0xbbeb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbbeb('0x5'));var rimraf=require(_0xbbeb('0x6'));var config=require(_0xbbeb('0x7'));var attributes=require(_0xbbeb('0x8'));module[_0xbbeb('0x9')]=function(_0x99702c,_0x5b9146){return _0x99702c[_0xbbeb('0xa')](_0xbbeb('0xb'),attributes,{'tableName':'report_square_details','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 d0099da..78f37a6 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 _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','util','moment'];(function(_0x4551f6,_0x48151b){var _0x581dc2=function(_0x1842af){while(--_0x1842af){_0x4551f6['push'](_0x4551f6['shift']());}};_0x581dc2(++_0x48151b);}(_0xda2d,0x102));var _0xdda2=function(_0x1d9d67,_0x5d884b){_0x1d9d67=_0x1d9d67-0x0;var _0x5897f8=_0xda2d[_0x1d9d67];return _0x5897f8;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});}exports[_0xdda2('0x14')]=function(_0x1a3b35){var _0x335fb5=this;return new Promise(function(_0x2b6ee8,_0x8d44b7){return db[_0xdda2('0x15')][_0xdda2('0x16')](_0x1a3b35[_0xdda2('0x17')],{'raw':_0x1a3b35[_0xdda2('0x18')]?_0x1a3b35[_0xdda2('0x18')][_0xdda2('0x19')]===undefined?!![]:![]:!![]})[_0xdda2('0xa')](function(_0x4eed30){logger[_0xdda2('0x12')]('CreateSquareDetailsReport',_0x1a3b35);logger[_0xdda2('0xd')](_0xdda2('0x14'),_0x1a3b35,JSON[_0xdda2('0xf')](_0x4eed30));_0x2b6ee8(_0x4eed30);})['catch'](function(_0x347ee6){logger['error'](_0xdda2('0x14'),_0x347ee6[_0xdda2('0x11')],_0x1a3b35);_0x8d44b7(_0x335fb5['error'](0x1f4,_0x347ee6[_0xdda2('0x11')]));});});}; \ No newline at end of file +var _0xfcbb=['code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x1f5cea,_0x418ae0){_0x1f5cea=_0x1f5cea-0x0;var _0x4875bc=_0xfcbb[_0x1f5cea];return _0x4875bc;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfcb('0x3'));var db=require(_0xbfcb('0x4'))['db'];var utils=require(_0xbfcb('0x5'));var logger=require(_0xbfcb('0x6'))(_0xbfcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfcb('0x8')][_0xbfcb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d4e6a,_0x2df839,_0x288ee5){return new BPromise(function(_0x2f875c,_0x49717b){return client['request'](_0x8d4e6a,_0x288ee5)[_0xbfcb('0xa')](function(_0x331173){logger[_0xbfcb('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x2df839,_0xbfcb('0xc'));logger[_0xbfcb('0xd')](_0xbfcb('0xe'),_0x2df839,_0xbfcb('0xc'),JSON[_0xbfcb('0xf')](_0x331173));if(_0x331173[_0xbfcb('0x10')]){if(_0x331173['error'][_0xbfcb('0x11')]===0x1f4){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')]['message']);return _0x49717b(_0x331173[_0xbfcb('0x10')]['message']);}logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);return _0x2f875c(_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);}else{logger[_0xbfcb('0xb')](_0xbfcb('0x12'),_0x2df839,_0xbfcb('0xc'));_0x2f875c(_0x331173[_0xbfcb('0x14')][_0xbfcb('0x13')]);}})[_0xbfcb('0x15')](function(_0x26f335){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x26f335);_0x49717b(_0x26f335);});});}exports[_0xbfcb('0x16')]=function(_0xba1d6){var _0x38689e=this;return new Promise(function(_0x3404aa,_0x46b8d2){return db[_0xbfcb('0x17')][_0xbfcb('0x18')](_0xba1d6['body'],{'raw':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xbfcb('0xa')](function(_0x1a7225){logger['info']('CreateSquareDetailsReport',_0xba1d6);logger[_0xbfcb('0xd')](_0xbfcb('0x16'),_0xba1d6,JSON[_0xbfcb('0xf')](_0x1a7225));_0x3404aa(_0x1a7225);})[_0xbfcb('0x15')](function(_0x1c5924){logger['error'](_0xbfcb('0x16'),_0x1c5924[_0xbfcb('0x13')],_0xba1d6);_0x46b8d2(_0x38689e[_0xbfcb('0x10')](0x1f4,_0x1c5924[_0xbfcb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 71b78be..2acda70 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 _0x71a8=['exports','express','Router','../../components/auth/service','./system.controller','get','index','killProcess'];(function(_0x2c2e31,_0x31c640){var _0x111ca0=function(_0x98b776){while(--_0x98b776){_0x2c2e31['push'](_0x2c2e31['shift']());}};_0x111ca0(++_0x31c640);}(_0x71a8,0x189));var _0x871a=function(_0x17101a,_0x2c0ff0){_0x17101a=_0x17101a-0x0;var _0x3b027f=_0x71a8[_0x17101a];return _0x3b027f;};'use strict';var express=require(_0x871a('0x0'));var router=express[_0x871a('0x1')]();var auth=require(_0x871a('0x2'));var controller=require(_0x871a('0x3'));router[_0x871a('0x4')]('/',auth['isAuthenticated'](),controller[_0x871a('0x5')]);router['get']('/process/:pid/kill',auth['isAuthenticated'](),controller[_0x871a('0x6')]);module[_0x871a('0x7')]=router; \ No newline at end of file +var _0xb443=['index','/process/:pid/kill','isAuthenticated','killProcess','exports','express','Router','../../components/auth/service','./system.controller','get'];(function(_0x354100,_0x561c4a){var _0x1b35e2=function(_0x3ac028){while(--_0x3ac028){_0x354100['push'](_0x354100['shift']());}};_0x1b35e2(++_0x561c4a);}(_0xb443,0x1a9));var _0x3b44=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xb443[_0x35da42];return _0x370035;};'use strict';var express=require(_0x3b44('0x0'));var router=express[_0x3b44('0x1')]();var auth=require(_0x3b44('0x2'));var controller=require(_0x3b44('0x3'));router[_0x3b44('0x4')]('/',auth['isAuthenticated'](),controller[_0x3b44('0x5')]);router[_0x3b44('0x4')](_0x3b44('0x6'),auth[_0x3b44('0x7')](),controller[_0x3b44('0x8')]);module[_0x3b44('0x9')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 8fcb168..f8f1fe7 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 _0xd4a8=['json','catch','killProcess','components/import/cm','params','pid','split','length','indexOf','format','kill','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','getAllData','then'];(function(_0x5d107c,_0x1f204d){var _0x53bd5a=function(_0x451b17){while(--_0x451b17){_0x5d107c['push'](_0x5d107c['shift']());}};_0x53bd5a(++_0x1f204d);}(_0xd4a8,0x8d));var _0x8d4a=function(_0xc9bc0f,_0x12e2ac){_0xc9bc0f=_0xc9bc0f-0x0;var _0x4aacbc=_0xd4a8[_0xc9bc0f];return _0x4aacbc;};'use strict';var info=require(_0x8d4a('0x0'));var exec=require(_0x8d4a('0x1'))[_0x8d4a('0x2')];var logger=require(_0x8d4a('0x3'))(_0x8d4a('0x4'));var util=require(_0x8d4a('0x5'));var BPromise=require(_0x8d4a('0x6'));var _=require('lodash');function handleError(_0x1a3db2,_0x130209,_0x472c6a){_0x130209=_0x130209||0x1f4;return function(_0x32520a){logger[_0x8d4a('0x7')](_0x8d4a('0x8'),_0x472c6a,_0x130209,util['inspect'](_0x32520a,{'showHidden':![],'depth':null}));delete _0x32520a[_0x8d4a('0x9')];_0x1a3db2[_0x8d4a('0xa')](_0x130209)[_0x8d4a('0xb')](_0x32520a);};}exports[_0x8d4a('0xc')]=function(_0x1a40e0,_0x13c342){return info[_0x8d4a('0xd')]()[_0x8d4a('0xe')](function(_0x5602c2){return _0x13c342['status'](0xc8)[_0x8d4a('0xf')](_0x5602c2);})[_0x8d4a('0x10')](function(_0x1eff97){return _0x13c342[_0x8d4a('0xa')](0x1f4)['json'](_0x1eff97);});};exports[_0x8d4a('0x11')]=function(_0xf75981,_0x3c1a5b){var _0x5272a2=[_0x8d4a('0x12')];return new BPromise(function(_0x5ef72b,_0x2348b6){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0xf75981[_0x8d4a('0x13')][_0x8d4a('0x14')]),function(_0xbe019f,_0x1cfeb2,_0x36120c){if(_0xbe019f){return _0x2348b6(_0xbe019f);}return _0x5ef72b(_0x1cfeb2);});})[_0x8d4a('0xe')](function(_0x299832){var _0x33334e=![];var _0x4bc115=_0x299832[_0x8d4a('0x15')](/\n/);for(var _0x422c6e=0x0,_0x1f5972=_0x5272a2[_0x8d4a('0x16')];_0x422c6e<_0x1f5972,_0x33334e===![];_0x422c6e+=0x1){if(_0x299832[_0x8d4a('0x17')](_0x5272a2[_0x422c6e])>=0x0){_0x33334e=!![];}}if(!_0x33334e){throw new Error(util[_0x8d4a('0x18')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0xf75981[_0x8d4a('0x13')][_0x8d4a('0x14')]));}process[_0x8d4a('0x19')](_0xf75981[_0x8d4a('0x13')]['pid'],'SIGINT');return _0x3c1a5b[_0x8d4a('0xa')](0xc8)[_0x8d4a('0xf')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0xf75981['params'][_0x8d4a('0x14')])});})['catch'](handleError(_0x3c1a5b,null,'killProcess'));}; \ No newline at end of file +var _0x6741=['components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','util','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','getAllData','json','catch','killProcess'];(function(_0x38f8e9,_0x36eede){var _0x269e6a=function(_0x120dda){while(--_0x120dda){_0x38f8e9['push'](_0x38f8e9['shift']());}};_0x269e6a(++_0x36eede);}(_0x6741,0x136));var _0x1674=function(_0x4d0456,_0x382073){_0x4d0456=_0x4d0456-0x0;var _0x2c7b54=_0x6741[_0x4d0456];return _0x2c7b54;};'use strict';var info=require('systeminformation');var exec=require(_0x1674('0x0'))[_0x1674('0x1')];var logger=require(_0x1674('0x2'))(_0x1674('0x3'));var util=require(_0x1674('0x4'));var BPromise=require('bluebird');var _=require(_0x1674('0x5'));function handleError(_0x3f5470,_0x3bce75,_0x6a9f57){_0x3bce75=_0x3bce75||0x1f4;return function(_0xd3f837){logger['error'](_0x1674('0x6'),_0x6a9f57,_0x3bce75,util['inspect'](_0xd3f837,{'showHidden':![],'depth':null}));delete _0xd3f837[_0x1674('0x7')];_0x3f5470[_0x1674('0x8')](_0x3bce75)[_0x1674('0x9')](_0xd3f837);};}exports[_0x1674('0xa')]=function(_0x1d8aed,_0x3884d2){return info[_0x1674('0xb')]()['then'](function(_0x414976){return _0x3884d2[_0x1674('0x8')](0xc8)[_0x1674('0xc')](_0x414976);})[_0x1674('0xd')](function(_0x1b2edc){return _0x3884d2[_0x1674('0x8')](0x1f4)[_0x1674('0xc')](_0x1b2edc);});};exports[_0x1674('0xe')]=function(_0x46926b,_0x4d3b40){var _0x3f5e61=[_0x1674('0xf')];return new BPromise(function(_0x3896fc,_0x57de88){return exec(util[_0x1674('0x10')](_0x1674('0x11'),_0x46926b[_0x1674('0x12')][_0x1674('0x13')]),function(_0x1d7169,_0x2f2fe4,_0x23892f){if(_0x1d7169){return _0x57de88(_0x1d7169);}return _0x3896fc(_0x2f2fe4);});})['then'](function(_0x11e22e){var _0x1c7b51=![];var _0x5d3fb1=_0x11e22e[_0x1674('0x14')](/\n/);for(var _0x353247=0x0,_0x2557b3=_0x3f5e61[_0x1674('0x15')];_0x353247<_0x2557b3,_0x1c7b51===![];_0x353247+=0x1){if(_0x11e22e[_0x1674('0x16')](_0x3f5e61[_0x353247])>=0x0){_0x1c7b51=!![];}}if(!_0x1c7b51){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x46926b[_0x1674('0x12')][_0x1674('0x13')]));}process[_0x1674('0x17')](_0x46926b[_0x1674('0x12')][_0x1674('0x13')],'SIGINT');return _0x4d3b40[_0x1674('0x8')](0xc8)[_0x1674('0xc')]({'message':util[_0x1674('0x10')](_0x1674('0x18'),_0x46926b['params'][_0x1674('0x13')])});})[_0x1674('0xd')](handleError(_0x4d3b40,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 8d45790..1bd60ae 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 _0x00bb=['express','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x377d60,_0x36134){var _0x7a37dc=function(_0x4da72c){while(--_0x4da72c){_0x377d60['push'](_0x377d60['shift']());}};_0x7a37dc(++_0x36134);}(_0x00bb,0x1d8));var _0xb00b=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x00bb[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var path=require(_0xb00b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb00b('0x3'));var router=express['Router']();var fs_extra=require(_0xb00b('0x4'));var auth=require(_0xb00b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb00b('0x6'));var controller=require(_0xb00b('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb00b('0x8')](_0xb00b('0x9'),auth[_0xb00b('0xa')](),controller[_0xb00b('0xb')]);router[_0xb00b('0x8')](_0xb00b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb00b('0xd')]('/',auth[_0xb00b('0xa')](),controller[_0xb00b('0xe')]);router[_0xb00b('0xf')](_0xb00b('0xc'),auth['isAuthenticated'](),controller[_0xb00b('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb00b('0x11')]);module[_0xb00b('0x12')]=router; \ No newline at end of file +var _0xdace=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','exports','multer','path','connect-timeout'];(function(_0xf4724a,_0x5dbfd9){var _0x3fe34f=function(_0x53508e){while(--_0x53508e){_0xf4724a['push'](_0xf4724a['shift']());}};_0x3fe34f(++_0x5dbfd9);}(_0xdace,0xc5));var _0xedac=function(_0x37756b,_0x24db76){_0x37756b=_0x37756b-0x0;var _0x46efec=_0xdace[_0x37756b];return _0x46efec;};'use strict';var multer=require(_0xedac('0x0'));var util=require('util');var path=require(_0xedac('0x1'));var timeout=require(_0xedac('0x2'));var express=require(_0xedac('0x3'));var router=express['Router']();var fs_extra=require(_0xedac('0x4'));var auth=require(_0xedac('0x5'));var interaction=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var controller=require('./tag.controller');router[_0xedac('0x8')]('/',auth[_0xedac('0x9')](),controller[_0xedac('0xa')]);router['get'](_0xedac('0xb'),auth[_0xedac('0x9')](),controller[_0xedac('0xc')]);router['get'](_0xedac('0xd'),auth[_0xedac('0x9')](),controller[_0xedac('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xedac('0xf')]);router[_0xedac('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xedac('0x11')]);router[_0xedac('0x12')]('/:id',auth[_0xedac('0x9')](),controller['destroy']);module[_0xedac('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 58b1322..3c19eb5 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 _0xd403=['exports','STRING','name','#0091EA','sequelize'];(function(_0x5d01c0,_0x414808){var _0x36dc0c=function(_0x51986b){while(--_0x51986b){_0x5d01c0['push'](_0x5d01c0['shift']());}};_0x36dc0c(++_0x414808);}(_0xd403,0x1d5));var _0x3d40=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xd403[_0x1beef3];return _0x5af964;};'use strict';var Sequelize=require(_0x3d40('0x0'));module[_0x3d40('0x1')]={'name':{'type':Sequelize[_0x3d40('0x2')],'unique':_0x3d40('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x3d40('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf089=['exports','STRING','#0091EA'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0xf089,0xba));var _0x9f08=function(_0x15d41a,_0x21d81b){_0x15d41a=_0x15d41a-0x0;var _0x245954=_0xf089[_0x15d41a];return _0x245954;};'use strict';var Sequelize=require('sequelize');module[_0x9f08('0x0')]={'name':{'type':Sequelize[_0x9f08('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x9f08('0x1')],'defaultValue':_0x9f08('0x2')},'description':{'type':Sequelize[_0x9f08('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index d1511f1..419b6c0 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 _0xaf36=['fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','count','includeAll','findAll','rows','catch','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','set','reject','save','update','then','get','Tags','UserProfileResource','sendStatus','error','stack','name','map','Tag','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x343e5a,_0x438aa6){var _0x37e87f=function(_0x5308a7){while(--_0x5308a7){_0x343e5a['push'](_0x343e5a['shift']());}};_0x37e87f(++_0x438aa6);}(_0xaf36,0x101));var _0x6af3=function(_0x388b47,_0x5cdac5){_0x388b47=_0x388b47-0x0;var _0x4859df=_0xaf36[_0x388b47];return _0x4859df;};'use strict';var emlformat=require(_0x6af3('0x0'));var rimraf=require(_0x6af3('0x1'));var zipdir=require(_0x6af3('0x2'));var jsonpatch=require(_0x6af3('0x3'));var rp=require('request-promise');var moment=require(_0x6af3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6af3('0x5'));var util=require(_0x6af3('0x6'));var path=require(_0x6af3('0x7'));var sox=require('sox');var csv=require(_0x6af3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6af3('0x9'));var _=require(_0x6af3('0xa'));var squel=require(_0x6af3('0xb'));var crypto=require(_0x6af3('0xc'));var jsforce=require(_0x6af3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6af3('0x8'));var querystring=require('querystring');var Papa=require(_0x6af3('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6af3('0xf'));var hardwareService=require(_0x6af3('0x10'));var logger=require(_0x6af3('0x11'))(_0x6af3('0x12'));var utils=require(_0x6af3('0x13'));var config=require(_0x6af3('0x14'));var licenseUtil=require(_0x6af3('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b9468,_0xb26299){_0xb26299=_0xb26299||0xcc;return function(_0x234c73){if(_0x234c73){return _0x5b9468['sendStatus'](_0xb26299);}return _0x5b9468[_0x6af3('0x16')](_0xb26299)[_0x6af3('0x17')]();};}function respondWithResult(_0x328c52,_0x2876f7){_0x2876f7=_0x2876f7||0xc8;return function(_0x419f8e){if(_0x419f8e){return _0x328c52[_0x6af3('0x16')](_0x2876f7)[_0x6af3('0x18')](_0x419f8e);}};}function respondWithFilteredResult(_0x5b4b9a,_0xddb106){return function(_0x37886f){if(_0x37886f){var _0x4e61cc=typeof _0xddb106[_0x6af3('0x19')]===_0x6af3('0x1a')&&typeof _0xddb106[_0x6af3('0x1b')]===_0x6af3('0x1a');var _0x4fba14=_0x37886f['count'];var _0x123adf=_0x4e61cc?0x0:_0xddb106['offset'];var _0x469ef7=_0x4e61cc?_0x37886f['count']:_0xddb106[_0x6af3('0x19')]+_0xddb106['limit'];var _0xbe172c;if(_0x469ef7>=_0x4fba14){_0x469ef7=_0x4fba14;_0xbe172c=0xc8;}else{_0xbe172c=0xce;}_0x5b4b9a[_0x6af3('0x16')](_0xbe172c);return _0x5b4b9a[_0x6af3('0x1c')]('Content-Range',_0x123adf+'-'+_0x469ef7+'/'+_0x4fba14)[_0x6af3('0x18')](_0x37886f);}return null;};}function patchUpdates(_0x1ba38b){return function(_0x46d584){try{jsonpatch['apply'](_0x46d584,_0x1ba38b,!![]);}catch(_0x520f27){return BPromise[_0x6af3('0x1d')](_0x520f27);}return _0x46d584[_0x6af3('0x1e')]();};}function saveUpdates(_0x4cfaeb,_0x2ffb1d){return function(_0x2bcb2a){if(_0x2bcb2a){return _0x2bcb2a[_0x6af3('0x1f')](_0x4cfaeb)[_0x6af3('0x20')](function(_0x23713b){return _0x23713b;});}return null;};}function removeEntity(_0x48b60f,_0x21c2ab){return function(_0x17f515){if(_0x17f515){return _0x17f515['destroy']()['then'](function(){var _0x550a46=_0x17f515[_0x6af3('0x21')]({'plain':!![]});var _0x476df9=_0x6af3('0x22');return db[_0x6af3('0x23')]['destroy']({'where':{'type':_0x476df9,'resourceId':_0x550a46['id']}})['then'](function(){return _0x17f515;});})[_0x6af3('0x20')](function(){_0x48b60f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x174d84,_0x34114a){return function(_0x5e2aba){if(!_0x5e2aba){_0x174d84[_0x6af3('0x24')](0x194);}return _0x5e2aba;};}function handleError(_0x452eb5,_0x2e3104){_0x2e3104=_0x2e3104||0x1f4;return function(_0x3fcb7a){logger[_0x6af3('0x25')](_0x3fcb7a[_0x6af3('0x26')]);if(_0x3fcb7a[_0x6af3('0x27')]){delete _0x3fcb7a[_0x6af3('0x27')];}_0x452eb5[_0x6af3('0x16')](_0x2e3104)['send'](_0x3fcb7a);};}exports['index']=function(_0x3dfddd,_0x5d9b9b){var _0x59917b={},_0x11ac55={},_0x443b25={'count':0x0,'rows':[]};var _0xba81b=_[_0x6af3('0x28')](db[_0x6af3('0x29')]['rawAttributes'],function(_0xfe8076){return{'name':_0xfe8076[_0x6af3('0x2a')],'type':_0xfe8076[_0x6af3('0x2b')][_0x6af3('0x2c')]};});_0x11ac55[_0x6af3('0x2d')]=_[_0x6af3('0x28')](_0xba81b,_0x6af3('0x27'));_0x11ac55[_0x6af3('0x2e')]=_[_0x6af3('0x2f')](_0x3dfddd[_0x6af3('0x2e')]);_0x11ac55[_0x6af3('0x30')]=_[_0x6af3('0x31')](_0x11ac55[_0x6af3('0x2d')],_0x11ac55[_0x6af3('0x2e')]);_0x59917b[_0x6af3('0x32')]=_[_0x6af3('0x31')](_0x11ac55['model'],qs[_0x6af3('0x33')](_0x3dfddd[_0x6af3('0x2e')]['fields']));_0x59917b[_0x6af3('0x32')]=_0x59917b[_0x6af3('0x32')]['length']?_0x59917b[_0x6af3('0x32')]:_0x11ac55[_0x6af3('0x2d')];if(!_0x3dfddd[_0x6af3('0x2e')][_0x6af3('0x34')](_0x6af3('0x35'))){_0x59917b[_0x6af3('0x1b')]=qs[_0x6af3('0x1b')](_0x3dfddd[_0x6af3('0x2e')]['limit']);_0x59917b[_0x6af3('0x19')]=qs[_0x6af3('0x19')](_0x3dfddd[_0x6af3('0x2e')][_0x6af3('0x19')]);}_0x59917b[_0x6af3('0x36')]=qs[_0x6af3('0x37')](_0x3dfddd[_0x6af3('0x2e')][_0x6af3('0x37')]);_0x59917b[_0x6af3('0x38')]=qs[_0x6af3('0x30')](_['pick'](_0x3dfddd[_0x6af3('0x2e')],_0x11ac55[_0x6af3('0x30')]),_0xba81b);if(_0x3dfddd[_0x6af3('0x2e')][_0x6af3('0x39')]){_0x59917b[_0x6af3('0x38')]=_['merge'](_0x59917b[_0x6af3('0x38')],{'$or':_[_0x6af3('0x28')](_0xba81b,function(_0x2f6680){if(_0x2f6680[_0x6af3('0x2b')]!=='VIRTUAL'){var _0x1f8181={};_0x1f8181[_0x2f6680['name']]={'$like':'%'+_0x3dfddd['query'][_0x6af3('0x39')]+'%'};return _0x1f8181;}})});}_0x59917b=_[_0x6af3('0x3a')]({},_0x59917b,_0x3dfddd['options']);var _0x4bb0dd={'where':_0x59917b[_0x6af3('0x38')]};return db[_0x6af3('0x29')][_0x6af3('0x3b')](_0x4bb0dd)[_0x6af3('0x20')](function(_0x2126e1){_0x443b25[_0x6af3('0x3b')]=_0x2126e1;if(_0x3dfddd[_0x6af3('0x2e')][_0x6af3('0x3c')]){_0x59917b['include']=[{'all':!![]}];}return db[_0x6af3('0x29')][_0x6af3('0x3d')](_0x59917b);})[_0x6af3('0x20')](function(_0x576e26){_0x443b25[_0x6af3('0x3e')]=_0x576e26;return _0x443b25;})[_0x6af3('0x20')](respondWithFilteredResult(_0x5d9b9b,_0x59917b))[_0x6af3('0x3f')](handleError(_0x5d9b9b,null));};exports['show']=function(_0x31dbb5,_0x19cf59){var _0x4f969a={'raw':!![],'where':{'id':_0x31dbb5['params']['id']}},_0x58c81b={};_0x58c81b[_0x6af3('0x2d')]=_[_0x6af3('0x2f')](db[_0x6af3('0x29')]['rawAttributes']);_0x58c81b[_0x6af3('0x2e')]=_[_0x6af3('0x2f')](_0x31dbb5['query']);_0x58c81b[_0x6af3('0x30')]=_[_0x6af3('0x31')](_0x58c81b['model'],_0x58c81b[_0x6af3('0x2e')]);_0x4f969a['attributes']=_['intersection'](_0x58c81b['model'],qs[_0x6af3('0x33')](_0x31dbb5['query'][_0x6af3('0x33')]));_0x4f969a[_0x6af3('0x32')]=_0x4f969a[_0x6af3('0x32')]['length']?_0x4f969a['attributes']:_0x58c81b['model'];if(_0x31dbb5[_0x6af3('0x2e')]['includeAll']){_0x4f969a[_0x6af3('0x40')]=[{'all':!![]}];}_0x4f969a=_[_0x6af3('0x3a')]({},_0x4f969a,_0x31dbb5['options']);return db[_0x6af3('0x29')]['find'](_0x4f969a)[_0x6af3('0x20')](handleEntityNotFound(_0x19cf59,null))['then'](respondWithResult(_0x19cf59,null))['catch'](handleError(_0x19cf59,null));};exports[_0x6af3('0x41')]=function(_0x5d20ab,_0x155aec){return db[_0x6af3('0x29')][_0x6af3('0x41')](_0x5d20ab['body'],{})[_0x6af3('0x20')](function(_0x8850e2){var _0x1d5d24=_0x5d20ab['user'][_0x6af3('0x21')]({'plain':!![]});if(!_0x1d5d24)throw new Error(_0x6af3('0x42'));if(_0x1d5d24[_0x6af3('0x43')]===_0x6af3('0x44')){var _0x4ee452=_0x8850e2['get']({'plain':!![]});var _0x5b9407=_0x6af3('0x22');return db['UserProfileSection'][_0x6af3('0x45')]({'where':{'name':_0x5b9407,'userProfileId':_0x1d5d24[_0x6af3('0x46')]},'raw':!![]})[_0x6af3('0x20')](function(_0x243f05){if(_0x243f05&&_0x243f05[_0x6af3('0x47')]===0x0){return db[_0x6af3('0x23')][_0x6af3('0x41')]({'name':_0x4ee452[_0x6af3('0x27')],'resourceId':_0x4ee452['id'],'type':_0x243f05['name'],'sectionId':_0x243f05['id']},{})[_0x6af3('0x20')](function(){return _0x8850e2;});}else{return _0x8850e2;}})['catch'](function(_0x5c630e){logger['error'](_0x6af3('0x48'),_0x5c630e);throw _0x5c630e;});}return _0x8850e2;})[_0x6af3('0x20')](respondWithResult(_0x155aec,0xc9))[_0x6af3('0x3f')](handleError(_0x155aec,null));};exports[_0x6af3('0x1f')]=function(_0x678731,_0x335cb7){if(_0x678731[_0x6af3('0x49')]['id']){delete _0x678731[_0x6af3('0x49')]['id'];}return db['Tag'][_0x6af3('0x45')]({'where':{'id':_0x678731[_0x6af3('0x4a')]['id']}})[_0x6af3('0x20')](handleEntityNotFound(_0x335cb7,null))[_0x6af3('0x20')](saveUpdates(_0x678731[_0x6af3('0x49')],null))[_0x6af3('0x20')](respondWithResult(_0x335cb7,null))[_0x6af3('0x3f')](handleError(_0x335cb7,null));};exports[_0x6af3('0x4b')]=function(_0x57a055,_0x5ba3c7){return db['Tag']['find']({'where':{'id':_0x57a055[_0x6af3('0x4a')]['id']}})[_0x6af3('0x20')](handleEntityNotFound(_0x5ba3c7,null))[_0x6af3('0x20')](removeEntity(_0x5ba3c7,null))[_0x6af3('0x3f')](handleError(_0x5ba3c7,null));};exports['describe']=function(_0x1e3cac,_0x17deb5){return db[_0x6af3('0x29')][_0x6af3('0x4c')]()[_0x6af3('0x20')](respondWithResult(_0x17deb5,null))[_0x6af3('0x3f')](handleError(_0x17deb5,null));}; \ No newline at end of file +var _0x1327=['Content-Range','apply','reject','save','update','then','get','Tags','UserProfileResource','destroy','error','stack','name','map','Tag','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x22631c,_0x221fe8){var _0x679176=function(_0x1b7c47){while(--_0x1b7c47){_0x22631c['push'](_0x22631c['shift']());}};_0x679176(++_0x221fe8);}(_0x1327,0x85));var _0x7132=function(_0x5a62ee,_0x324ff8){_0x5a62ee=_0x5a62ee-0x0;var _0x47b49e=_0x1327[_0x5a62ee];return _0x47b49e;};'use strict';var emlformat=require(_0x7132('0x0'));var rimraf=require(_0x7132('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7132('0x2'));var rp=require(_0x7132('0x3'));var moment=require('moment');var BPromise=require(_0x7132('0x4'));var Mustache=require('mustache');var util=require(_0x7132('0x5'));var path=require(_0x7132('0x6'));var sox=require(_0x7132('0x7'));var csv=require(_0x7132('0x8'));var ejs=require(_0x7132('0x9'));var fs=require('fs');var fs_extra=require(_0x7132('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7132('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7132('0xc'));var toCsv=require(_0x7132('0x8'));var querystring=require('querystring');var Papa=require(_0x7132('0xd'));var Redis=require(_0x7132('0xe'));var authService=require(_0x7132('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7132('0x10'));var hardwareService=require(_0x7132('0x11'));var logger=require(_0x7132('0x12'))(_0x7132('0x13'));var utils=require(_0x7132('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7132('0x15'));var db=require(_0x7132('0x16'))['db'];function respondWithStatusCode(_0x5a81b1,_0x28c07f){_0x28c07f=_0x28c07f||0xcc;return function(_0x42af16){if(_0x42af16){return _0x5a81b1['sendStatus'](_0x28c07f);}return _0x5a81b1[_0x7132('0x17')](_0x28c07f)[_0x7132('0x18')]();};}function respondWithResult(_0x50a414,_0x5d247c){_0x5d247c=_0x5d247c||0xc8;return function(_0x47eaf6){if(_0x47eaf6){return _0x50a414['status'](_0x5d247c)[_0x7132('0x19')](_0x47eaf6);}};}function respondWithFilteredResult(_0xf05e3d,_0x53aa4a){return function(_0x75bba6){if(_0x75bba6){var _0x1c423a=typeof _0x53aa4a[_0x7132('0x1a')]===_0x7132('0x1b')&&typeof _0x53aa4a[_0x7132('0x1c')]===_0x7132('0x1b');var _0x2d11bf=_0x75bba6[_0x7132('0x1d')];var _0x148b9b=_0x1c423a?0x0:_0x53aa4a['offset'];var _0x4f7496=_0x1c423a?_0x75bba6[_0x7132('0x1d')]:_0x53aa4a[_0x7132('0x1a')]+_0x53aa4a[_0x7132('0x1c')];var _0x629e57;if(_0x4f7496>=_0x2d11bf){_0x4f7496=_0x2d11bf;_0x629e57=0xc8;}else{_0x629e57=0xce;}_0xf05e3d[_0x7132('0x17')](_0x629e57);return _0xf05e3d[_0x7132('0x1e')](_0x7132('0x1f'),_0x148b9b+'-'+_0x4f7496+'/'+_0x2d11bf)[_0x7132('0x19')](_0x75bba6);}return null;};}function patchUpdates(_0x57329e){return function(_0x408dcb){try{jsonpatch[_0x7132('0x20')](_0x408dcb,_0x57329e,!![]);}catch(_0x2ecb14){return BPromise[_0x7132('0x21')](_0x2ecb14);}return _0x408dcb[_0x7132('0x22')]();};}function saveUpdates(_0x4381d2,_0xf6375c){return function(_0x4ad880){if(_0x4ad880){return _0x4ad880[_0x7132('0x23')](_0x4381d2)[_0x7132('0x24')](function(_0x3d3530){return _0x3d3530;});}return null;};}function removeEntity(_0x1d44aa,_0x29f010){return function(_0x19855d){if(_0x19855d){return _0x19855d['destroy']()[_0x7132('0x24')](function(){var _0x561ec7=_0x19855d[_0x7132('0x25')]({'plain':!![]});var _0x561825=_0x7132('0x26');return db[_0x7132('0x27')][_0x7132('0x28')]({'where':{'type':_0x561825,'resourceId':_0x561ec7['id']}})[_0x7132('0x24')](function(){return _0x19855d;});})[_0x7132('0x24')](function(){_0x1d44aa['status'](0xcc)[_0x7132('0x18')]();});}};}function handleEntityNotFound(_0x394671,_0x5db0cc){return function(_0x477409){if(!_0x477409){_0x394671['sendStatus'](0x194);}return _0x477409;};}function handleError(_0xd3285,_0x117435){_0x117435=_0x117435||0x1f4;return function(_0x4be753){logger[_0x7132('0x29')](_0x4be753[_0x7132('0x2a')]);if(_0x4be753[_0x7132('0x2b')]){delete _0x4be753[_0x7132('0x2b')];}_0xd3285[_0x7132('0x17')](_0x117435)['send'](_0x4be753);};}exports['index']=function(_0x109dbf,_0x492200){var _0x76f596={},_0x21a8e1={},_0x1add96={'count':0x0,'rows':[]};var _0x5afad1=_[_0x7132('0x2c')](db[_0x7132('0x2d')][_0x7132('0x2e')],function(_0x26fc6){return{'name':_0x26fc6[_0x7132('0x2f')],'type':_0x26fc6[_0x7132('0x30')][_0x7132('0x31')]};});_0x21a8e1[_0x7132('0x32')]=_[_0x7132('0x2c')](_0x5afad1,_0x7132('0x2b'));_0x21a8e1['query']=_[_0x7132('0x33')](_0x109dbf[_0x7132('0x34')]);_0x21a8e1[_0x7132('0x35')]=_['intersection'](_0x21a8e1['model'],_0x21a8e1[_0x7132('0x34')]);_0x76f596[_0x7132('0x36')]=_[_0x7132('0x37')](_0x21a8e1[_0x7132('0x32')],qs[_0x7132('0x38')](_0x109dbf[_0x7132('0x34')][_0x7132('0x38')]));_0x76f596[_0x7132('0x36')]=_0x76f596[_0x7132('0x36')][_0x7132('0x39')]?_0x76f596['attributes']:_0x21a8e1[_0x7132('0x32')];if(!_0x109dbf['query'][_0x7132('0x3a')](_0x7132('0x3b'))){_0x76f596[_0x7132('0x1c')]=qs[_0x7132('0x1c')](_0x109dbf[_0x7132('0x34')][_0x7132('0x1c')]);_0x76f596['offset']=qs['offset'](_0x109dbf[_0x7132('0x34')][_0x7132('0x1a')]);}_0x76f596['order']=qs[_0x7132('0x3c')](_0x109dbf['query'][_0x7132('0x3c')]);_0x76f596[_0x7132('0x3d')]=qs[_0x7132('0x35')](_[_0x7132('0x3e')](_0x109dbf[_0x7132('0x34')],_0x21a8e1[_0x7132('0x35')]),_0x5afad1);if(_0x109dbf[_0x7132('0x34')][_0x7132('0x3f')]){_0x76f596[_0x7132('0x3d')]=_[_0x7132('0x40')](_0x76f596[_0x7132('0x3d')],{'$or':_['map'](_0x5afad1,function(_0x5e1642){if(_0x5e1642[_0x7132('0x30')]!==_0x7132('0x41')){var _0x4790bf={};_0x4790bf[_0x5e1642['name']]={'$like':'%'+_0x109dbf['query'][_0x7132('0x3f')]+'%'};return _0x4790bf;}})});}_0x76f596=_[_0x7132('0x40')]({},_0x76f596,_0x109dbf['options']);var _0x2c2934={'where':_0x76f596['where']};return db[_0x7132('0x2d')][_0x7132('0x1d')](_0x2c2934)[_0x7132('0x24')](function(_0x1bb738){_0x1add96[_0x7132('0x1d')]=_0x1bb738;if(_0x109dbf[_0x7132('0x34')]['includeAll']){_0x76f596[_0x7132('0x42')]=[{'all':!![]}];}return db[_0x7132('0x2d')][_0x7132('0x43')](_0x76f596);})['then'](function(_0x13d0b3){_0x1add96['rows']=_0x13d0b3;return _0x1add96;})[_0x7132('0x24')](respondWithFilteredResult(_0x492200,_0x76f596))['catch'](handleError(_0x492200,null));};exports[_0x7132('0x44')]=function(_0x1c7320,_0x7c9c84){var _0x5a5f4d={'raw':!![],'where':{'id':_0x1c7320[_0x7132('0x45')]['id']}},_0x2740ac={};_0x2740ac[_0x7132('0x32')]=_['keys'](db[_0x7132('0x2d')]['rawAttributes']);_0x2740ac[_0x7132('0x34')]=_[_0x7132('0x33')](_0x1c7320['query']);_0x2740ac[_0x7132('0x35')]=_[_0x7132('0x37')](_0x2740ac[_0x7132('0x32')],_0x2740ac[_0x7132('0x34')]);_0x5a5f4d[_0x7132('0x36')]=_['intersection'](_0x2740ac[_0x7132('0x32')],qs['fields'](_0x1c7320[_0x7132('0x34')][_0x7132('0x38')]));_0x5a5f4d['attributes']=_0x5a5f4d[_0x7132('0x36')]['length']?_0x5a5f4d[_0x7132('0x36')]:_0x2740ac[_0x7132('0x32')];if(_0x1c7320['query'][_0x7132('0x46')]){_0x5a5f4d['include']=[{'all':!![]}];}_0x5a5f4d=_[_0x7132('0x40')]({},_0x5a5f4d,_0x1c7320[_0x7132('0x47')]);return db[_0x7132('0x2d')]['find'](_0x5a5f4d)[_0x7132('0x24')](handleEntityNotFound(_0x7c9c84,null))['then'](respondWithResult(_0x7c9c84,null))['catch'](handleError(_0x7c9c84,null));};exports['create']=function(_0x5bd5b0,_0x484a4e){return db[_0x7132('0x2d')][_0x7132('0x48')](_0x5bd5b0['body'],{})[_0x7132('0x24')](function(_0xcceca6){var _0x5098d4=_0x5bd5b0[_0x7132('0x49')][_0x7132('0x25')]({'plain':!![]});if(!_0x5098d4)throw new Error(_0x7132('0x4a'));if(_0x5098d4[_0x7132('0x4b')]===_0x7132('0x49')){var _0x21bdcd=_0xcceca6[_0x7132('0x25')]({'plain':!![]});var _0x3e8a83=_0x7132('0x26');return db['UserProfileSection'][_0x7132('0x4c')]({'where':{'name':_0x3e8a83,'userProfileId':_0x5098d4[_0x7132('0x4d')]},'raw':!![]})['then'](function(_0x1ac333){if(_0x1ac333&&_0x1ac333['autoAssociation']===0x0){return db[_0x7132('0x27')]['create']({'name':_0x21bdcd[_0x7132('0x2b')],'resourceId':_0x21bdcd['id'],'type':_0x1ac333[_0x7132('0x2b')],'sectionId':_0x1ac333['id']},{})[_0x7132('0x24')](function(){return _0xcceca6;});}else{return _0xcceca6;}})[_0x7132('0x4e')](function(_0x5ae7e9){logger['error'](_0x7132('0x4f'),_0x5ae7e9);throw _0x5ae7e9;});}return _0xcceca6;})[_0x7132('0x24')](respondWithResult(_0x484a4e,0xc9))[_0x7132('0x4e')](handleError(_0x484a4e,null));};exports[_0x7132('0x23')]=function(_0x476adc,_0x9f47f3){if(_0x476adc['body']['id']){delete _0x476adc[_0x7132('0x50')]['id'];}return db[_0x7132('0x2d')][_0x7132('0x4c')]({'where':{'id':_0x476adc[_0x7132('0x45')]['id']}})['then'](handleEntityNotFound(_0x9f47f3,null))[_0x7132('0x24')](saveUpdates(_0x476adc[_0x7132('0x50')],null))[_0x7132('0x24')](respondWithResult(_0x9f47f3,null))[_0x7132('0x4e')](handleError(_0x9f47f3,null));};exports[_0x7132('0x28')]=function(_0x4a7cec,_0x185c30){return db['Tag'][_0x7132('0x4c')]({'where':{'id':_0x4a7cec['params']['id']}})[_0x7132('0x24')](handleEntityNotFound(_0x185c30,null))['then'](removeEntity(_0x185c30,null))['catch'](handleError(_0x185c30,null));};exports[_0x7132('0x51')]=function(_0x427e2a,_0x2708a3){return db[_0x7132('0x2d')]['describe']()['then'](respondWithResult(_0x2708a3,null))['catch'](handleError(_0x2708a3,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index ac0d911..043c251 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 _0x7d32=['exports','define','Tag','tools_tags','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes'];(function(_0x405171,_0x1279c9){var _0x489608=function(_0x2054ce){while(--_0x2054ce){_0x405171['push'](_0x405171['shift']());}};_0x489608(++_0x1279c9);}(_0x7d32,0x1c0));var _0x27d3=function(_0x1c982f,_0x32e0ee){_0x1c982f=_0x1c982f-0x0;var _0x9d0fd5=_0x7d32[_0x1c982f];return _0x9d0fd5;};'use strict';var _=require(_0x27d3('0x0'));var util=require('util');var logger=require(_0x27d3('0x1'))(_0x27d3('0x2'));var moment=require('moment');var BPromise=require(_0x27d3('0x3'));var rp=require(_0x27d3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x27d3('0x5'));var config=require(_0x27d3('0x6'));var attributes=require(_0x27d3('0x7'));module[_0x27d3('0x8')]=function(_0x4fc61d,_0x15da16){return _0x4fc61d[_0x27d3('0x9')](_0x27d3('0xa'),attributes,{'tableName':_0x27d3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80bd=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','Tag','tools_tags'];(function(_0xa0038e,_0x5cc604){var _0x3c3866=function(_0x293f20){while(--_0x293f20){_0xa0038e['push'](_0xa0038e['shift']());}};_0x3c3866(++_0x5cc604);}(_0x80bd,0x78));var _0xd80b=function(_0x3607c0,_0x4c5878){_0x3607c0=_0x3607c0-0x0;var _0x2865a0=_0x80bd[_0x3607c0];return _0x2865a0;};'use strict';var _=require(_0xd80b('0x0'));var util=require(_0xd80b('0x1'));var logger=require(_0xd80b('0x2'))('api');var moment=require(_0xd80b('0x3'));var BPromise=require(_0xd80b('0x4'));var rp=require(_0xd80b('0x5'));var fs=require('fs');var path=require(_0xd80b('0x6'));var rimraf=require('rimraf');var config=require(_0xd80b('0x7'));var attributes=require('./tag.attributes');module[_0xd80b('0x8')]=function(_0x5c8404,_0x1c0569){return _0x5c8404[_0xd80b('0x9')](_0xd80b('0xa'),attributes,{'tableName':_0xd80b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 566f420..8aefa1d 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 _0xbd50=['Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbd50,0x196));var _0x0bd5=function(_0x2faa47,_0x6dc486){_0x2faa47=_0x2faa47-0x0;var _0x8dca9f=_0xbd50[_0x2faa47];return _0x8dca9f;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var moment=require(_0x0bd5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd5('0x3'));var fs=require('fs');var Redis=require(_0x0bd5('0x4'));var db=require(_0x0bd5('0x5'))['db'];var utils=require(_0x0bd5('0x6'));var logger=require(_0x0bd5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bd5('0x8')][_0x0bd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcc6cfa,_0x2c0db1,_0x1b99f3){return new BPromise(function(_0x5ebe64,_0x47e78d){return client[_0x0bd5('0xa')](_0xcc6cfa,_0x1b99f3)[_0x0bd5('0xb')](function(_0x259f4c){logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));logger['debug'](_0x0bd5('0xe'),_0x2c0db1,_0x0bd5('0xd'),JSON['stringify'](_0x259f4c));if(_0x259f4c[_0x0bd5('0xf')]){if(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x10')]===0x1f4){logger['error'](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);return _0x47e78d(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')]['message']);return _0x5ebe64(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}else{logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));_0x5ebe64(_0x259f4c[_0x0bd5('0x12')][_0x0bd5('0x11')]);}})['catch'](function(_0x14f32c){logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x14f32c);_0x47e78d(_0x14f32c);});});} \ No newline at end of file +var _0xb66c=['../../config/environment','jayson/promise','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x6c8eae,_0x5a0c5f){var _0x2d8b91=function(_0x1853d4){while(--_0x1853d4){_0x6c8eae['push'](_0x6c8eae['shift']());}};_0x2d8b91(++_0x5a0c5f);}(_0xb66c,0x175));var _0xcb66=function(_0x514185,_0x410206){_0x514185=_0x514185-0x0;var _0xcbbd23=_0xb66c[_0x514185];return _0xcbbd23;};'use strict';var _=require(_0xcb66('0x0'));var util=require('util');var moment=require(_0xcb66('0x1'));var BPromise=require('bluebird');var rs=require(_0xcb66('0x2'));var fs=require('fs');var Redis=require(_0xcb66('0x3'));var db=require(_0xcb66('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb66('0x5'))(_0xcb66('0x6'));var config=require(_0xcb66('0x7'));var jayson=require(_0xcb66('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19adf5,_0x1b6852,_0xa3993){return new BPromise(function(_0x439f3d,_0xf7bc39){return client['request'](_0x19adf5,_0xa3993)[_0xcb66('0x9')](function(_0x3047f7){logger[_0xcb66('0xa')](_0xcb66('0xb'),_0x1b6852,_0xcb66('0xc'));logger['debug'](_0xcb66('0xd'),_0x1b6852,_0xcb66('0xc'),JSON[_0xcb66('0xe')](_0x3047f7));if(_0x3047f7[_0xcb66('0xf')]){if(_0x3047f7['error'][_0xcb66('0x10')]===0x1f4){logger[_0xcb66('0xf')](_0xcb66('0xb'),_0x1b6852,_0x3047f7[_0xcb66('0xf')]['message']);return _0xf7bc39(_0x3047f7[_0xcb66('0xf')][_0xcb66('0x11')]);}logger[_0xcb66('0xf')](_0xcb66('0xb'),_0x1b6852,_0x3047f7['error'][_0xcb66('0x11')]);return _0x439f3d(_0x3047f7['error'][_0xcb66('0x11')]);}else{logger['info'](_0xcb66('0xb'),_0x1b6852,'request\x20sent');_0x439f3d(_0x3047f7['result'][_0xcb66('0x11')]);}})[_0xcb66('0x12')](function(_0x681ce3){logger[_0xcb66('0xf')]('Tag,\x20%s,\x20%s',_0x1b6852,_0x681ce3);_0xf7bc39(_0x681ce3);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index dc74b8b..fd11711 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 175ecaf..7fa684c 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 _0x0713=['STRING','name'];(function(_0x4c4f7b,_0x58ce91){var _0x1b299d=function(_0x2b7703){while(--_0x2b7703){_0x4c4f7b['push'](_0x4c4f7b['shift']());}};_0x1b299d(++_0x58ce91);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x2c0e96,_0x46bb2a){var _0x461aed=function(_0x5de840){while(--_0x5de840){_0x2c0e96['push'](_0x2c0e96['shift']());}};_0x461aed(++_0x46bb2a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'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 1917ee2..4cea56b 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 _0xa17b=['UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','getQueues','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','sort','addQueues','findOne','toLowerCase','Queues','ids','removeQueues','remove','addAgents','Voice','Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User','Queue','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','UserVoicePrefix','VoicePrefixId','isArray','Chat','transaction','removeAgents','Queue:remove','getAgents','length','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','end','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','stack','name','send','index','map','Team','rawAttributes','type','filters','intersection','model','query','attributes','fields','nolimit','order','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','Sequelize','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','MailQueueId','UserMailQueue','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId'];(function(_0x588b43,_0x49e254){var _0x559bd0=function(_0x25aaec){while(--_0x25aaec){_0x588b43['push'](_0x588b43['shift']());}};_0x559bd0(++_0x49e254);}(_0xa17b,0xd3));var _0xba17=function(_0x4a4d0b,_0x3170ad){_0x4a4d0b=_0x4a4d0b-0x0;var _0x2cf2f7=_0xa17b[_0x4a4d0b];return _0x2cf2f7;};'use strict';var emlformat=require(_0xba17('0x0'));var rimraf=require(_0xba17('0x1'));var zipdir=require(_0xba17('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba17('0x3'));var moment=require(_0xba17('0x4'));var BPromise=require(_0xba17('0x5'));var Mustache=require(_0xba17('0x6'));var util=require(_0xba17('0x7'));var path=require(_0xba17('0x8'));var sox=require(_0xba17('0x9'));var csv=require(_0xba17('0xa'));var ejs=require(_0xba17('0xb'));var fs=require('fs');var fs_extra=require(_0xba17('0xc'));var _=require(_0xba17('0xd'));var squel=require(_0xba17('0xe'));var crypto=require('crypto');var jsforce=require(_0xba17('0xf'));var deskjs=require(_0xba17('0x10'));var toCsv=require('to-csv');var querystring=require(_0xba17('0x11'));var Papa=require(_0xba17('0x12'));var Redis=require('ioredis');var authService=require(_0xba17('0x13'));var qs=require(_0xba17('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba17('0x15'));var logger=require(_0xba17('0x16'))(_0xba17('0x17'));var utils=require(_0xba17('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xba17('0x19'));var db=require(_0xba17('0x1a'))['db'];config[_0xba17('0x1b')]=_[_0xba17('0x1c')](config[_0xba17('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xba17('0x1d'))(new Redis(config[_0xba17('0x1b')]));require(_0xba17('0x1e'))[_0xba17('0x1f')](socket);function respondWithStatusCode(_0xc4bd0e,_0x5611d6){_0x5611d6=_0x5611d6||0xcc;return function(_0x434a5c){if(_0x434a5c){return _0xc4bd0e[_0xba17('0x20')](_0x5611d6);}return _0xc4bd0e['status'](_0x5611d6)[_0xba17('0x21')]();};}function respondWithResult(_0x49405d,_0x3ff85d){_0x3ff85d=_0x3ff85d||0xc8;return function(_0x35cc36){if(_0x35cc36){return _0x49405d[_0xba17('0x22')](_0x3ff85d)[_0xba17('0x23')](_0x35cc36);}};}function respondWithFilteredResult(_0x127561,_0x596aa9){return function(_0x200481){if(_0x200481){var _0x2171fd=typeof _0x596aa9[_0xba17('0x24')]==='undefined'&&typeof _0x596aa9[_0xba17('0x25')]==='undefined';var _0x41c269=_0x200481[_0xba17('0x26')];var _0x8de4e2=_0x2171fd?0x0:_0x596aa9['offset'];var _0x14ffbb=_0x2171fd?_0x200481[_0xba17('0x26')]:_0x596aa9[_0xba17('0x24')]+_0x596aa9[_0xba17('0x25')];var _0x187ced;if(_0x14ffbb>=_0x41c269){_0x14ffbb=_0x41c269;_0x187ced=0xc8;}else{_0x187ced=0xce;}_0x127561[_0xba17('0x22')](_0x187ced);return _0x127561[_0xba17('0x27')](_0xba17('0x28'),_0x8de4e2+'-'+_0x14ffbb+'/'+_0x41c269)[_0xba17('0x23')](_0x200481);}return null;};}function patchUpdates(_0x5b936d){return function(_0x31092a){try{jsonpatch['apply'](_0x31092a,_0x5b936d,!![]);}catch(_0x3cd2a1){return BPromise[_0xba17('0x29')](_0x3cd2a1);}return _0x31092a[_0xba17('0x2a')]();};}function saveUpdates(_0x26321d,_0x1a9158){return function(_0x53e7a7){if(_0x53e7a7){return _0x53e7a7[_0xba17('0x2b')](_0x26321d)[_0xba17('0x2c')](function(_0x314d82){return _0x314d82;});}return null;};}function handleEntityNotFound(_0x265618,_0x4d9b3c){return function(_0x5ee97f){if(!_0x5ee97f){_0x265618['sendStatus'](0x194);}return _0x5ee97f;};}function handleError(_0x4d7312,_0x5219ce){_0x5219ce=_0x5219ce||0x1f4;return function(_0x4e102b){logger['error'](_0x4e102b[_0xba17('0x2d')]);if(_0x4e102b[_0xba17('0x2e')]){delete _0x4e102b[_0xba17('0x2e')];}_0x4d7312[_0xba17('0x22')](_0x5219ce)[_0xba17('0x2f')](_0x4e102b);};}exports[_0xba17('0x30')]=function(_0x3d44ee,_0x2ca6f1){var _0x3a0388={},_0x52e8cb={},_0x5b7a8d={'count':0x0,'rows':[]};var _0x21f857=_[_0xba17('0x31')](db[_0xba17('0x32')][_0xba17('0x33')],function(_0xac4f57){return{'name':_0xac4f57['fieldName'],'type':_0xac4f57[_0xba17('0x34')]['key']};});_0x52e8cb['model']=_['map'](_0x21f857,_0xba17('0x2e'));_0x52e8cb['query']=_['keys'](_0x3d44ee['query']);_0x52e8cb[_0xba17('0x35')]=_[_0xba17('0x36')](_0x52e8cb[_0xba17('0x37')],_0x52e8cb[_0xba17('0x38')]);_0x3a0388[_0xba17('0x39')]=_['intersection'](_0x52e8cb[_0xba17('0x37')],qs[_0xba17('0x3a')](_0x3d44ee[_0xba17('0x38')][_0xba17('0x3a')]));_0x3a0388[_0xba17('0x39')]=_0x3a0388[_0xba17('0x39')]['length']?_0x3a0388[_0xba17('0x39')]:_0x52e8cb[_0xba17('0x37')];if(!_0x3d44ee['query']['hasOwnProperty'](_0xba17('0x3b'))){_0x3a0388[_0xba17('0x25')]=qs['limit'](_0x3d44ee['query'][_0xba17('0x25')]);_0x3a0388[_0xba17('0x24')]=qs['offset'](_0x3d44ee['query'][_0xba17('0x24')]);}_0x3a0388[_0xba17('0x3c')]=qs['sort'](_0x3d44ee[_0xba17('0x38')]['sort']);_0x3a0388[_0xba17('0x3d')]=qs[_0xba17('0x35')](_[_0xba17('0x3e')](_0x3d44ee[_0xba17('0x38')],_0x52e8cb[_0xba17('0x35')]),_0x21f857);if(_0x3d44ee['query']['filter']){_0x3a0388['where']=_[_0xba17('0x3f')](_0x3a0388[_0xba17('0x3d')],{'$or':_[_0xba17('0x31')](_0x21f857,function(_0x258d95){if(_0x258d95[_0xba17('0x34')]!==_0xba17('0x40')){var _0x299720={};_0x299720[_0x258d95[_0xba17('0x2e')]]={'$like':'%'+_0x3d44ee['query'][_0xba17('0x41')]+'%'};return _0x299720;}})});}_0x3a0388=_[_0xba17('0x3f')]({},_0x3a0388,_0x3d44ee[_0xba17('0x42')]);var _0x59602e={'where':_0x3a0388[_0xba17('0x3d')]};return db[_0xba17('0x32')][_0xba17('0x26')](_0x59602e)['then'](function(_0x4cd8ed){_0x5b7a8d[_0xba17('0x26')]=_0x4cd8ed;if(_0x3d44ee[_0xba17('0x38')]['includeAll']){_0x3a0388[_0xba17('0x43')]=[{'all':!![]}];}return db['Team'][_0xba17('0x44')](_0x3a0388);})[_0xba17('0x2c')](function(_0xf18bd2){_0x5b7a8d[_0xba17('0x45')]=_0xf18bd2;return _0x5b7a8d;})['then'](respondWithFilteredResult(_0x2ca6f1,_0x3a0388))[_0xba17('0x46')](handleError(_0x2ca6f1,null));};exports[_0xba17('0x47')]=function(_0x4aafc3,_0x2db6ba){var _0x9496cc={'raw':![],'where':{'id':_0x4aafc3[_0xba17('0x48')]['id']}},_0x23cfa5={};_0x23cfa5[_0xba17('0x37')]=_[_0xba17('0x49')](db['Team'][_0xba17('0x33')]);_0x23cfa5[_0xba17('0x38')]=_['keys'](_0x4aafc3[_0xba17('0x38')]);_0x23cfa5[_0xba17('0x35')]=_['intersection'](_0x23cfa5['model'],_0x23cfa5[_0xba17('0x38')]);_0x9496cc[_0xba17('0x39')]=_[_0xba17('0x36')](_0x23cfa5[_0xba17('0x37')],qs[_0xba17('0x3a')](_0x4aafc3[_0xba17('0x38')][_0xba17('0x3a')]));_0x9496cc['attributes']=_0x9496cc[_0xba17('0x39')]['length']?_0x9496cc[_0xba17('0x39')]:_0x23cfa5['model'];if(_0x4aafc3[_0xba17('0x38')][_0xba17('0x4a')]){_0x9496cc[_0xba17('0x43')]=[{'all':!![]}];}_0x9496cc=_[_0xba17('0x3f')]({},_0x9496cc,_0x4aafc3['options']);return db[_0xba17('0x32')][_0xba17('0x4b')](_0x9496cc)[_0xba17('0x2c')](handleEntityNotFound(_0x2db6ba,null))[_0xba17('0x2c')](respondWithResult(_0x2db6ba,null))['catch'](handleError(_0x2db6ba,null));};exports['create']=function(_0x593438,_0x17c1bf){return db[_0xba17('0x32')][_0xba17('0x4c')](_0x593438['body'],{})[_0xba17('0x2c')](function(_0x1f9ce2){var _0x2e1a3f=_0x593438['user'][_0xba17('0x4d')]({'plain':!![]});if(!_0x2e1a3f)throw new Error(_0xba17('0x4e'));if(_0x2e1a3f[_0xba17('0x4f')]===_0xba17('0x50')){var _0x5603c0=_0x1f9ce2['get']({'plain':!![]});var _0x516d66=_0xba17('0x51');return db[_0xba17('0x52')][_0xba17('0x4b')]({'where':{'name':_0x516d66,'userProfileId':_0x2e1a3f[_0xba17('0x53')]},'raw':!![]})[_0xba17('0x2c')](function(_0x58f90a){if(_0x58f90a&&_0x58f90a['autoAssociation']===0x0){return db[_0xba17('0x54')][_0xba17('0x4c')]({'name':_0x5603c0[_0xba17('0x2e')],'resourceId':_0x5603c0['id'],'type':_0x58f90a[_0xba17('0x2e')],'sectionId':_0x58f90a['id']},{})[_0xba17('0x2c')](function(){return _0x1f9ce2;});}else{return _0x1f9ce2;}})['catch'](function(_0x3463e0){logger[_0xba17('0x55')](_0xba17('0x56'),_0x3463e0);throw _0x3463e0;});}return _0x1f9ce2;})[_0xba17('0x2c')](respondWithResult(_0x17c1bf,0xc9))['catch'](handleError(_0x17c1bf,null));};exports[_0xba17('0x2b')]=function(_0xd45bb6,_0x2b77b1){if(_0xd45bb6[_0xba17('0x57')]['id']){delete _0xd45bb6[_0xba17('0x57')]['id'];}return db[_0xba17('0x32')][_0xba17('0x4b')]({'where':{'id':_0xd45bb6[_0xba17('0x48')]['id']}})[_0xba17('0x2c')](handleEntityNotFound(_0x2b77b1,null))[_0xba17('0x2c')](saveUpdates(_0xd45bb6[_0xba17('0x57')],null))[_0xba17('0x2c')](respondWithResult(_0x2b77b1,null))[_0xba17('0x46')](handleError(_0x2b77b1,null));};exports[_0xba17('0x58')]=function(_0x354d84,_0x4055f3){var _0x428cfb=_0x354d84[_0xba17('0x48')]['id'];var _0x25f883=[];return db[_0xba17('0x59')]['transaction'](function(_0x1d66bb){var _0x456579='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x428cfb;return db[_0xba17('0x59')][_0xba17('0x38')](_0x456579,{'type':db[_0xba17('0x5a')]['QueryTypes'][_0xba17('0x5b')],'raw':!![],'transaction':_0x1d66bb})[_0xba17('0x2c')](function(_0x503b9b){_0x25f883=_[_0xba17('0x31')](_0x503b9b,function(_0x175f49){return Number(_0x175f49['UserId']);});})[_0xba17('0x2c')](function(){var _0x5c9bd5=_0xba17('0x5c')+_0x428cfb;return db['sequelize'][_0xba17('0x38')](_0x5c9bd5,{'type':db[_0xba17('0x5a')][_0xba17('0x5d')]['SELECT'],'raw':!![],'transaction':_0x1d66bb});})[_0xba17('0x2c')](function(_0x2c6689){var _0x1d8da9=_['map'](_0x2c6689,function(_0x260ad5){return Number(_0x260ad5[_0xba17('0x5e')]);});return db['UserVoiceQueue'][_0xba17('0x58')]({'where':{'UserId':{'$in':_0x25f883},'VoiceQueueId':{'$in':_0x1d8da9}},'transaction':_0x1d66bb});})[_0xba17('0x2c')](function(){var _0x5a2dc3='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x428cfb;return db['sequelize'][_0xba17('0x38')](_0x5a2dc3,{'type':db[_0xba17('0x5a')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x1d66bb});})['then'](function(_0x408785){var _0x508b67=_['map'](_0x408785,function(_0x3a4e55){return Number(_0x3a4e55[_0xba17('0x5f')]);});return db[_0xba17('0x60')]['destroy']({'where':{'UserId':{'$in':_0x25f883},'MailQueueId':{'$in':_0x508b67}},'transaction':_0x1d66bb});})[_0xba17('0x2c')](function(){var _0x458a9b='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x428cfb;return db[_0xba17('0x59')][_0xba17('0x38')](_0x458a9b,{'type':db['Sequelize'][_0xba17('0x5d')][_0xba17('0x5b')],'raw':!![],'transaction':_0x1d66bb});})[_0xba17('0x2c')](function(_0x42fd41){var _0x6cc4e0=_[_0xba17('0x31')](_0x42fd41,function(_0x15d0a0){return Number(_0x15d0a0[_0xba17('0x61')]);});return db[_0xba17('0x62')]['destroy']({'where':{'UserId':{'$in':_0x25f883},'SmsQueueId':{'$in':_0x6cc4e0}},'transaction':_0x1d66bb});})[_0xba17('0x2c')](function(){var _0x2c65a1=_0xba17('0x63')+_0x428cfb;return db[_0xba17('0x59')][_0xba17('0x38')](_0x2c65a1,{'type':db[_0xba17('0x5a')]['QueryTypes'][_0xba17('0x5b')],'raw':!![],'transaction':_0x1d66bb});})[_0xba17('0x2c')](function(_0xd64222){var _0x4ca249=_['map'](_0xd64222,function(_0x44b16f){return Number(_0x44b16f[_0xba17('0x64')]);});return db['UserChatQueue'][_0xba17('0x58')]({'where':{'UserId':{'$in':_0x25f883},'ChatQueueId':{'$in':_0x4ca249}},'transaction':_0x1d66bb});})[_0xba17('0x2c')](function(){var _0x125cf1=_0xba17('0x65')+_0x428cfb;return db[_0xba17('0x59')][_0xba17('0x38')](_0x125cf1,{'type':db[_0xba17('0x5a')][_0xba17('0x5d')][_0xba17('0x5b')],'raw':!![],'transaction':_0x1d66bb});})[_0xba17('0x2c')](function(_0x51030e){var _0x4a57c0=_[_0xba17('0x31')](_0x51030e,function(_0x2602fb){return Number(_0x2602fb[_0xba17('0x66')]);});return db['UserFaxQueue'][_0xba17('0x58')]({'where':{'UserId':{'$in':_0x25f883},'FaxQueueId':{'$in':_0x4a57c0}},'transaction':_0x1d66bb});})[_0xba17('0x2c')](function(){var _0x294d1e=_0xba17('0x67')+_0x428cfb;return db['sequelize']['query'](_0x294d1e,{'type':db[_0xba17('0x5a')][_0xba17('0x5d')]['SELECT'],'raw':!![],'transaction':_0x1d66bb});})['then'](function(_0x52202c){var _0x3e505d=_[_0xba17('0x31')](_0x52202c,function(_0x19c0f8){return Number(_0x19c0f8[_0xba17('0x68')]);});return db[_0xba17('0x69')][_0xba17('0x58')]({'where':{'UserId':{'$in':_0x25f883},'OpenchannelQueueId':{'$in':_0x3e505d}},'transaction':_0x1d66bb});})[_0xba17('0x2c')](function(){var _0x2276f3=_0xba17('0x6a')+_0x428cfb;return db['sequelize'][_0xba17('0x38')](_0x2276f3,{'type':db[_0xba17('0x5a')][_0xba17('0x5d')][_0xba17('0x5b')],'raw':!![],'transaction':_0x1d66bb});})[_0xba17('0x2c')](function(_0x32425f){var _0xef9172=_[_0xba17('0x31')](_0x32425f,function(_0x4d5a27){return Number(_0x4d5a27[_0xba17('0x6b')]);});return db[_0xba17('0x6c')][_0xba17('0x58')]({'where':{'UserId':{'$in':_0x25f883},'WhatsappQueueId':{'$in':_0xef9172}},'transaction':_0x1d66bb});})['then'](function(){return db[_0xba17('0x6d')][_0xba17('0x4b')]({'where':{'TeamId':_0x428cfb}});})['then'](function(_0x3f878a){if(_0x3f878a===null){return;}return db['UserVoicePrefix']['destroy']({'where':{'UserId':{'$in':_0x25f883},'VoicePrefixId':_0x3f878a['VoicePrefixId']},'transaction':_0x1d66bb});})['then'](function(){return db['Team'][_0xba17('0x58')]({'where':{'id':_0x428cfb},'cascade':!![],'transaction':_0x1d66bb});})['then'](function(_0x8a324d){if(_0x8a324d===0x0){_0x4055f3['sendStatus'](0x194);}else{return db[_0xba17('0x54')][_0xba17('0x58')]({'where':{'type':'Teams','resourceId':_0x428cfb},'cascade':!![],'transaction':_0x1d66bb})[_0xba17('0x2c')](function(){_0x4055f3[_0xba17('0x22')](0xcc)['end']();});}})[_0xba17('0x46')](function(_0x1cf27e){_0x4055f3[_0xba17('0x22')](0x1f4)[_0xba17('0x2f')](_0x1cf27e);});});};exports[_0xba17('0x6e')]=function(_0x24b0ed,_0x13adf0,_0x29ded0){return db['Team']['findOne']({'where':{'id':_0x24b0ed['params']['id']}})['then'](handleEntityNotFound(_0x13adf0,null))['then'](function(_0x49b98c){if(!_0x24b0ed['query']['channel']||!utils[_0xba17('0x6f')](_0x24b0ed[_0xba17('0x38')][_0xba17('0x70')])){throw new db[(_0xba17('0x5a'))][(_0xba17('0x71'))](_0xba17('0x72'));}var _0x410419={};var _0x1776bd={};_0x1776bd[_0xba17('0x37')]=_[_0xba17('0x49')](db[_[_0xba17('0x73')](_0x24b0ed[_0xba17('0x38')][_0xba17('0x70')]['toLowerCase']())+'Queue'][_0xba17('0x33')]);_0x1776bd[_0xba17('0x38')]=_[_0xba17('0x49')](_0x24b0ed[_0xba17('0x38')]);_0x1776bd[_0xba17('0x35')]=_[_0xba17('0x36')](_0x1776bd[_0xba17('0x37')],_0x1776bd[_0xba17('0x38')]);_0x410419[_0xba17('0x39')]=_[_0xba17('0x36')](_0x1776bd[_0xba17('0x37')],qs['fields'](_0x24b0ed['query'][_0xba17('0x3a')]));_0x410419[_0xba17('0x39')]=_0x410419[_0xba17('0x39')]['length']?_0x410419[_0xba17('0x39')]:_0x1776bd['model'];_0x410419['limit']=qs['limit'](_0x24b0ed['query'][_0xba17('0x25')]);_0x410419[_0xba17('0x24')]=qs[_0xba17('0x24')](_0x24b0ed[_0xba17('0x38')][_0xba17('0x24')]);_0x410419['order']=qs[_0xba17('0x74')](_0x24b0ed[_0xba17('0x38')][_0xba17('0x74')]);_0x410419[_0xba17('0x3d')]=qs[_0xba17('0x35')](_[_0xba17('0x3e')](_0x24b0ed[_0xba17('0x38')],_0x1776bd[_0xba17('0x35')]));_0x410419=_[_0xba17('0x3f')]({},_0x410419,_0x24b0ed[_0xba17('0x42')]);return _0x49b98c[_0xba17('0x4d')+_['capitalize'](_0x24b0ed['query']['channel']['toLowerCase']())+'Queues'](_0x410419);})[_0xba17('0x2c')](respondWithResult(_0x13adf0,null))[_0xba17('0x46')](handleError(_0x13adf0,null));};exports[_0xba17('0x75')]=function(_0x1c3f6e,_0x40f6bf,_0x3f1536){return db[_0xba17('0x32')][_0xba17('0x76')]({'where':{'id':_0x1c3f6e[_0xba17('0x48')]['id']}})[_0xba17('0x2c')](function(_0x243ad2){if(_0x243ad2){if(!_0x1c3f6e[_0xba17('0x57')][_0xba17('0x70')]||!utils[_0xba17('0x6f')](_0x1c3f6e[_0xba17('0x57')][_0xba17('0x70')])){throw new db[(_0xba17('0x5a'))][(_0xba17('0x71'))](_0xba17('0x72'));}return _0x243ad2['add'+_[_0xba17('0x73')](_0x1c3f6e[_0xba17('0x57')][_0xba17('0x70')][_0xba17('0x77')]())+_0xba17('0x78')](_0x1c3f6e[_0xba17('0x57')][_0xba17('0x79')]);}return null;})[_0xba17('0x2c')](handleEntityNotFound(_0x40f6bf,null))[_0xba17('0x2c')](respondWithStatusCode(_0x40f6bf,null))[_0xba17('0x46')](handleError(_0x40f6bf,null));};exports[_0xba17('0x7a')]=function(_0x317ad2,_0x47f27b,_0x3d2019){return db[_0xba17('0x32')][_0xba17('0x76')]({'where':{'id':_0x317ad2['params']['id']}})[_0xba17('0x2c')](function(_0x234e16){if(_0x234e16){if(!_0x317ad2['query']['channel']||!utils[_0xba17('0x6f')](_0x317ad2[_0xba17('0x38')][_0xba17('0x70')])){throw new db['Sequelize']['ValidationError'](_0xba17('0x72'));}return _0x234e16[_0xba17('0x7b')+_[_0xba17('0x73')](_0x317ad2[_0xba17('0x38')][_0xba17('0x70')][_0xba17('0x77')]())+_0xba17('0x78')](_0x317ad2[_0xba17('0x38')][_0xba17('0x79')]);}return null;})['then'](handleEntityNotFound(_0x47f27b,null))[_0xba17('0x2c')](respondWithStatusCode(_0x47f27b,null))[_0xba17('0x46')](handleError(_0x47f27b,null));};exports[_0xba17('0x7c')]=function(_0x562836,_0x1c3c53){var _0x307a00=_['isArray'](_0x562836[_0xba17('0x57')][_0xba17('0x79')])?_0x562836[_0xba17('0x57')][_0xba17('0x79')]:[_0x562836['body'][_0xba17('0x79')]];var _0x464054=_0x562836[_0xba17('0x48')]['id'];return db[_0xba17('0x32')][_0xba17('0x4b')]({'where':{'id':_0x464054}})['then'](handleEntityNotFound(_0x1c3c53,null))[_0xba17('0x2c')](function(_0x3fd8b5){if(_0x3fd8b5){var _0x191dce=[_0xba17('0x7d'),'Chat',_0xba17('0x7e'),_0xba17('0x7f'),_0xba17('0x80'),_0xba17('0x81'),_0xba17('0x82')];return db['sequelize']['transaction'](function(_0x590c9b){var _0x1a446e=_[_0xba17('0x31')](_0x191dce,function(_0x5e533a){var _0x1a6bbf={'attributes':['id',_0xba17('0x2e')]};if(_0x5e533a===_0xba17('0x7d')){_0x1a6bbf[_0xba17('0x83')]={'attributes':[_0xba17('0x84')]};}return _0x3fd8b5[_0xba17('0x4d')+_0x5e533a+_0xba17('0x78')](_0x1a6bbf)[_0xba17('0x2c')](function(_0x429457){var _0x338dba=_[_0xba17('0x31')](_0x429457,function(_0x4e203c){var _0x22293e=_[_0xba17('0x31')](_0x307a00,function(_0xdf53d3){var _0x434be6={'where':{'UserId':_0xdf53d3,[_0x5e533a+_0xba17('0x85')]:_0x4e203c['id']},'transaction':_0x590c9b};if(_0x5e533a===_0xba17('0x7d')){_0x434be6[_0xba17('0x1c')]={'penalty':_0x4e203c[_0xba17('0x86')][_0xba17('0x84')]};}return db[_0xba17('0x87')+_0x5e533a+_0xba17('0x88')]['findOrCreate'](_0x434be6)[_0xba17('0x2c')](function(){socket[_0xba17('0x89')](_0xba17('0x50')+_0x5e533a+_0xba17('0x8a'),{'UserId':_0xdf53d3,[_0x5e533a+'QueueId']:_0x4e203c['id']});if(_0x5e533a!==_0xba17('0x7d')){return;}return db['User'][_0xba17('0x44')]({'where':{'id':_0x307a00,'online':0x1},'attributes':['id',_0xba17('0x2e'),_0xba17('0x8b'),_0xba17('0x8c'),_0xba17('0x8d')],'raw':!![]})[_0xba17('0x2c')](function(_0x4a9bd4){var _0x37aa22=_[_0xba17('0x31')](_0x4a9bd4,function(_0xa2fbb3){return db[_0xba17('0x8e')][_0xba17('0x8f')]({'membername':_0xa2fbb3[_0xba17('0x2e')],'UserId':_0xa2fbb3['id'],'queue_name':_0x4e203c[_0xba17('0x2e')],'VoiceQueueId':_0x4e203c['id'],'interface':_[_0xba17('0x90')](_0xa2fbb3[_0xba17('0x8d')])?util[_0xba17('0x91')](_0xba17('0x92'),_0xa2fbb3[_0xba17('0x2e')]):_0xa2fbb3[_0xba17('0x8d')],'paused':_0xa2fbb3[_0xba17('0x8c')]||![],'penalty':_0x4e203c['TeamVoiceQueue'][_0xba17('0x84')]},{'transaction':_0x590c9b});});return Promise[_0xba17('0x93')](_0x37aa22);});});});return Promise[_0xba17('0x93')](_0x22293e);});return Promise[_0xba17('0x93')](_0x338dba);})['then'](function(){return db[_0xba17('0x6d')][_0xba17('0x76')]({'where':{'teamId':_0x464054}})[_0xba17('0x2c')](function(_0x379f31){if(_0x379f31){var _0x19ede5=_['map'](_0x307a00,function(_0x12ebbb){db[_0xba17('0x94')][_0xba17('0x8f')]({'UserId':_0x12ebbb,'VoicePrefixId':_0x379f31[_0xba17('0x95')]});});return Promise[_0xba17('0x93')](_0x19ede5);}});});});return Promise['all'](_0x1a446e)[_0xba17('0x2c')](function(){return _0x3fd8b5[_0xba17('0x7c')](_0x307a00,{'transaction':_0x590c9b})['spread'](function(_0x258ffe){return _0x258ffe;});});});}})[_0xba17('0x2c')](respondWithResult(_0x1c3c53,null))[_0xba17('0x46')](handleError(_0x1c3c53,null));};exports['removeAgents']=function(_0x53cf3d,_0x358a86){var _0x9b972d=_[_0xba17('0x96')](_0x53cf3d[_0xba17('0x38')][_0xba17('0x79')])?_0x53cf3d['query']['ids']:[_0x53cf3d[_0xba17('0x38')][_0xba17('0x79')]];var _0x9062b6=_0x53cf3d[_0xba17('0x48')]['id'];return db[_0xba17('0x32')][_0xba17('0x4b')]({'where':{'id':_0x9062b6}})['then'](handleEntityNotFound(_0x358a86,null))['then'](function(_0x35a770){if(_0x35a770){var _0x415918=[_0xba17('0x7d'),_0xba17('0x97'),'Mail','Sms',_0xba17('0x80'),_0xba17('0x81'),'Whatsapp'];return db[_0xba17('0x59')][_0xba17('0x98')](function(_0x1e4a68){var _0x2c6bff=_[_0xba17('0x31')](_0x415918,function(_0x24c27e){var _0x17ffb9={'attributes':['id',_0xba17('0x2e')]};return _0x35a770['get'+_0x24c27e+'Queues'](_0x17ffb9)['then'](function(_0x5b0626){var _0x168099=_[_0xba17('0x31')](_0x5b0626,function(_0x3a8f42){return _0x3a8f42[_0xba17('0x99')](_0x9b972d,{'transaction':_0x1e4a68})[_0xba17('0x2c')](function(){var _0x2d3fbb=_['map'](_0x9b972d,function(_0x17b113){socket['emit']('user'+_0x24c27e+_0xba17('0x9a'),{'UserId':Number(_0x17b113),[_0x24c27e+_0xba17('0x85')]:_0x3a8f42['id']});if(_0x24c27e!=='Voice'){return;}return db['UserVoiceQueueRt'][_0xba17('0x58')]({'where':{'VoiceQueueId':_0x3a8f42['id'],'UserId':_0x17b113},'transaction':_0x1e4a68});});return Promise[_0xba17('0x93')](_0x2d3fbb);});});return Promise[_0xba17('0x93')](_0x168099);});});return Promise['all'](_0x2c6bff)[_0xba17('0x2c')](function(){return _0x35a770[_0xba17('0x99')](_0x9b972d,{'transaction':_0x1e4a68});})[_0xba17('0x2c')](function(){return db['TeamVoicePrefix'][_0xba17('0x76')]({'where':{'teamId':_0x9062b6}})['then'](function(_0x2055c8){if(_0x2055c8){var _0x3a374a=_[_0xba17('0x31')](_0x9b972d,function(_0x2e67fc){db[_0xba17('0x94')][_0xba17('0x58')]({'where':{'UserId':_0x2e67fc,'VoicePrefixId':_0x2055c8[_0xba17('0x95')]}});});return Promise[_0xba17('0x93')](_0x3a374a);}});});});}})[_0xba17('0x2c')](respondWithStatusCode(_0x358a86,null))[_0xba17('0x46')](handleError(_0x358a86,null));};exports[_0xba17('0x9b')]=function(_0x28f93d,_0x2948fa,_0x4608be){var _0x1dc400={};var _0x131845={};var _0xe2069d;var _0x579403;return db[_0xba17('0x32')][_0xba17('0x76')]({'where':{'id':_0x28f93d[_0xba17('0x48')]['id']}})[_0xba17('0x2c')](handleEntityNotFound(_0x2948fa,null))[_0xba17('0x2c')](function(_0x5dfb97){if(_0x5dfb97){_0xe2069d=_0x5dfb97;_0x131845[_0xba17('0x37')]=_[_0xba17('0x49')](db['User']['rawAttributes']);_0x131845[_0xba17('0x38')]=_[_0xba17('0x49')](_0x28f93d[_0xba17('0x38')]);_0x131845['filters']=_['intersection'](_0x131845[_0xba17('0x37')],_0x131845['query']);_0x1dc400[_0xba17('0x39')]=_['intersection'](_0x131845[_0xba17('0x37')],qs['fields'](_0x28f93d[_0xba17('0x38')][_0xba17('0x3a')]));_0x1dc400[_0xba17('0x39')]=_0x1dc400[_0xba17('0x39')]['length']?_0x1dc400[_0xba17('0x39')]:_0x131845['model'];_0x1dc400[_0xba17('0x3c')]=qs[_0xba17('0x74')](_0x28f93d[_0xba17('0x38')][_0xba17('0x74')]);_0x1dc400[_0xba17('0x3d')]=qs[_0xba17('0x35')](_[_0xba17('0x3e')](_0x28f93d[_0xba17('0x38')],_0x131845[_0xba17('0x35')]));if(_0x28f93d[_0xba17('0x38')][_0xba17('0x41')]){_0x1dc400['where']=_[_0xba17('0x3f')](_0x1dc400['where'],{'$or':_[_0xba17('0x31')](_0x1dc400[_0xba17('0x39')],function(_0x1e7893){var _0x4af03c={};_0x4af03c[_0x1e7893]={'$like':'%'+_0x28f93d[_0xba17('0x38')][_0xba17('0x41')]+'%'};return _0x4af03c;})});}_0x1dc400=_[_0xba17('0x3f')]({},_0x1dc400,_0x28f93d[_0xba17('0x42')]);return _0xe2069d[_0xba17('0x9b')](_0x1dc400);}})[_0xba17('0x2c')](function(_0x5eedd9){if(_0x5eedd9){_0x579403=_0x5eedd9[_0xba17('0x9c')];if(!_0x28f93d['query'][_0xba17('0x9d')](_0xba17('0x3b'))){_0x1dc400[_0xba17('0x25')]=qs[_0xba17('0x25')](_0x28f93d[_0xba17('0x38')]['limit']);_0x1dc400[_0xba17('0x24')]=qs[_0xba17('0x24')](_0x28f93d['query'][_0xba17('0x24')]);}return _0xe2069d[_0xba17('0x9b')](_0x1dc400);}})[_0xba17('0x2c')](function(_0x5f1779){if(_0x5f1779){return _0x5f1779?{'count':_0x579403,'rows':_0x5f1779}:null;}})[_0xba17('0x2c')](respondWithResult(_0x2948fa,null))[_0xba17('0x46')](handleError(_0x2948fa,null));}; \ No newline at end of file +var _0xd897=['ValidationError','Unknown\x20channel','removeQueues','remove','ids','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Whatsapp','through','penalty','TeamVoiceQueue','emit','Queue:save','QueueId','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','all','upsert','spread','removeAgents','Queue:remove','getAgents','User','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','apply','reject','update','then','error','stack','send','index','map','Team','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','transaction','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','sequelize','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','end','findOne','channel','capitalize','toLowerCase','Queue','rawAttributes','pick','Queues','addQueues','isValidChannel','body'];(function(_0x739d41,_0x253297){var _0x1c340c=function(_0x476918){while(--_0x476918){_0x739d41['push'](_0x739d41['shift']());}};_0x1c340c(++_0x253297);}(_0xd897,0x1f2));var _0x7d89=function(_0x10c2d9,_0x1b31bd){_0x10c2d9=_0x10c2d9-0x0;var _0x5f500e=_0xd897[_0x10c2d9];return _0x5f500e;};'use strict';var emlformat=require(_0x7d89('0x0'));var rimraf=require(_0x7d89('0x1'));var zipdir=require(_0x7d89('0x2'));var jsonpatch=require(_0x7d89('0x3'));var rp=require(_0x7d89('0x4'));var moment=require(_0x7d89('0x5'));var BPromise=require(_0x7d89('0x6'));var Mustache=require(_0x7d89('0x7'));var util=require(_0x7d89('0x8'));var path=require(_0x7d89('0x9'));var sox=require(_0x7d89('0xa'));var csv=require('to-csv');var ejs=require(_0x7d89('0xb'));var fs=require('fs');var fs_extra=require(_0x7d89('0xc'));var _=require(_0x7d89('0xd'));var squel=require('squel');var crypto=require(_0x7d89('0xe'));var jsforce=require(_0x7d89('0xf'));var deskjs=require(_0x7d89('0x10'));var toCsv=require(_0x7d89('0x11'));var querystring=require(_0x7d89('0x12'));var Papa=require(_0x7d89('0x13'));var Redis=require('ioredis');var authService=require(_0x7d89('0x14'));var qs=require(_0x7d89('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d89('0x16'));var logger=require(_0x7d89('0x17'))(_0x7d89('0x18'));var utils=require(_0x7d89('0x19'));var config=require(_0x7d89('0x1a'));var licenseUtil=require(_0x7d89('0x1b'));var db=require(_0x7d89('0x1c'))['db'];config[_0x7d89('0x1d')]=_[_0x7d89('0x1e')](config[_0x7d89('0x1d')],{'host':_0x7d89('0x1f'),'port':0x18eb});var socket=require(_0x7d89('0x20'))(new Redis(config['redis']));require('./team.socket')[_0x7d89('0x21')](socket);function respondWithStatusCode(_0x3ee8e1,_0x1944e4){_0x1944e4=_0x1944e4||0xcc;return function(_0x39105c){if(_0x39105c){return _0x3ee8e1[_0x7d89('0x22')](_0x1944e4);}return _0x3ee8e1[_0x7d89('0x23')](_0x1944e4)['end']();};}function respondWithResult(_0x493848,_0x18bf7a){_0x18bf7a=_0x18bf7a||0xc8;return function(_0x180600){if(_0x180600){return _0x493848[_0x7d89('0x23')](_0x18bf7a)[_0x7d89('0x24')](_0x180600);}};}function respondWithFilteredResult(_0x1832d0,_0x31a12d){return function(_0x2c00c9){if(_0x2c00c9){var _0x51762f=typeof _0x31a12d[_0x7d89('0x25')]===_0x7d89('0x26')&&typeof _0x31a12d[_0x7d89('0x27')]===_0x7d89('0x26');var _0x167a54=_0x2c00c9[_0x7d89('0x28')];var _0x46aca3=_0x51762f?0x0:_0x31a12d[_0x7d89('0x25')];var _0xd7e706=_0x51762f?_0x2c00c9[_0x7d89('0x28')]:_0x31a12d[_0x7d89('0x25')]+_0x31a12d[_0x7d89('0x27')];var _0x14af68;if(_0xd7e706>=_0x167a54){_0xd7e706=_0x167a54;_0x14af68=0xc8;}else{_0x14af68=0xce;}_0x1832d0[_0x7d89('0x23')](_0x14af68);return _0x1832d0['set']('Content-Range',_0x46aca3+'-'+_0xd7e706+'/'+_0x167a54)[_0x7d89('0x24')](_0x2c00c9);}return null;};}function patchUpdates(_0x16d9bd){return function(_0x52c9e7){try{jsonpatch[_0x7d89('0x29')](_0x52c9e7,_0x16d9bd,!![]);}catch(_0x27d509){return BPromise[_0x7d89('0x2a')](_0x27d509);}return _0x52c9e7['save']();};}function saveUpdates(_0x15a6c7,_0x304715){return function(_0xcb2c3f){if(_0xcb2c3f){return _0xcb2c3f[_0x7d89('0x2b')](_0x15a6c7)[_0x7d89('0x2c')](function(_0xc4df06){return _0xc4df06;});}return null;};}function handleEntityNotFound(_0x277bef,_0x5c246d){return function(_0x1c1cd8){if(!_0x1c1cd8){_0x277bef[_0x7d89('0x22')](0x194);}return _0x1c1cd8;};}function handleError(_0x4bed21,_0x1e1ea6){_0x1e1ea6=_0x1e1ea6||0x1f4;return function(_0x58bc77){logger[_0x7d89('0x2d')](_0x58bc77[_0x7d89('0x2e')]);if(_0x58bc77['name']){delete _0x58bc77['name'];}_0x4bed21[_0x7d89('0x23')](_0x1e1ea6)[_0x7d89('0x2f')](_0x58bc77);};}exports[_0x7d89('0x30')]=function(_0x36be2a,_0x20791d){var _0x3fe280={},_0x160d9e={},_0x590fc4={'count':0x0,'rows':[]};var _0x468463=_[_0x7d89('0x31')](db[_0x7d89('0x32')]['rawAttributes'],function(_0x150581){return{'name':_0x150581[_0x7d89('0x33')],'type':_0x150581[_0x7d89('0x34')][_0x7d89('0x35')]};});_0x160d9e[_0x7d89('0x36')]=_[_0x7d89('0x31')](_0x468463,_0x7d89('0x37'));_0x160d9e[_0x7d89('0x38')]=_[_0x7d89('0x39')](_0x36be2a[_0x7d89('0x38')]);_0x160d9e[_0x7d89('0x3a')]=_['intersection'](_0x160d9e[_0x7d89('0x36')],_0x160d9e[_0x7d89('0x38')]);_0x3fe280[_0x7d89('0x3b')]=_[_0x7d89('0x3c')](_0x160d9e[_0x7d89('0x36')],qs[_0x7d89('0x3d')](_0x36be2a[_0x7d89('0x38')][_0x7d89('0x3d')]));_0x3fe280[_0x7d89('0x3b')]=_0x3fe280[_0x7d89('0x3b')]['length']?_0x3fe280[_0x7d89('0x3b')]:_0x160d9e[_0x7d89('0x36')];if(!_0x36be2a[_0x7d89('0x38')]['hasOwnProperty'](_0x7d89('0x3e'))){_0x3fe280[_0x7d89('0x27')]=qs[_0x7d89('0x27')](_0x36be2a[_0x7d89('0x38')][_0x7d89('0x27')]);_0x3fe280[_0x7d89('0x25')]=qs[_0x7d89('0x25')](_0x36be2a[_0x7d89('0x38')]['offset']);}_0x3fe280[_0x7d89('0x3f')]=qs['sort'](_0x36be2a['query'][_0x7d89('0x40')]);_0x3fe280[_0x7d89('0x41')]=qs['filters'](_['pick'](_0x36be2a[_0x7d89('0x38')],_0x160d9e['filters']),_0x468463);if(_0x36be2a[_0x7d89('0x38')][_0x7d89('0x42')]){_0x3fe280[_0x7d89('0x41')]=_[_0x7d89('0x43')](_0x3fe280['where'],{'$or':_[_0x7d89('0x31')](_0x468463,function(_0x4d5a04){if(_0x4d5a04[_0x7d89('0x34')]!==_0x7d89('0x44')){var _0x236528={};_0x236528[_0x4d5a04[_0x7d89('0x37')]]={'$like':'%'+_0x36be2a[_0x7d89('0x38')][_0x7d89('0x42')]+'%'};return _0x236528;}})});}_0x3fe280=_[_0x7d89('0x43')]({},_0x3fe280,_0x36be2a[_0x7d89('0x45')]);var _0x1439ee={'where':_0x3fe280[_0x7d89('0x41')]};return db[_0x7d89('0x32')][_0x7d89('0x28')](_0x1439ee)[_0x7d89('0x2c')](function(_0x152bd6){_0x590fc4['count']=_0x152bd6;if(_0x36be2a[_0x7d89('0x38')]['includeAll']){_0x3fe280[_0x7d89('0x46')]=[{'all':!![]}];}return db[_0x7d89('0x32')][_0x7d89('0x47')](_0x3fe280);})[_0x7d89('0x2c')](function(_0x58a810){_0x590fc4[_0x7d89('0x48')]=_0x58a810;return _0x590fc4;})[_0x7d89('0x2c')](respondWithFilteredResult(_0x20791d,_0x3fe280))[_0x7d89('0x49')](handleError(_0x20791d,null));};exports['show']=function(_0x4f8539,_0x5e18a8){var _0x2bedfa={'raw':![],'where':{'id':_0x4f8539[_0x7d89('0x4a')]['id']}},_0x264034={};_0x264034[_0x7d89('0x36')]=_[_0x7d89('0x39')](db[_0x7d89('0x32')]['rawAttributes']);_0x264034[_0x7d89('0x38')]=_[_0x7d89('0x39')](_0x4f8539['query']);_0x264034[_0x7d89('0x3a')]=_[_0x7d89('0x3c')](_0x264034['model'],_0x264034[_0x7d89('0x38')]);_0x2bedfa[_0x7d89('0x3b')]=_['intersection'](_0x264034[_0x7d89('0x36')],qs['fields'](_0x4f8539['query']['fields']));_0x2bedfa[_0x7d89('0x3b')]=_0x2bedfa[_0x7d89('0x3b')][_0x7d89('0x4b')]?_0x2bedfa['attributes']:_0x264034[_0x7d89('0x36')];if(_0x4f8539[_0x7d89('0x38')]['includeAll']){_0x2bedfa[_0x7d89('0x46')]=[{'all':!![]}];}_0x2bedfa=_[_0x7d89('0x43')]({},_0x2bedfa,_0x4f8539['options']);return db[_0x7d89('0x32')][_0x7d89('0x4c')](_0x2bedfa)[_0x7d89('0x2c')](handleEntityNotFound(_0x5e18a8,null))[_0x7d89('0x2c')](respondWithResult(_0x5e18a8,null))[_0x7d89('0x49')](handleError(_0x5e18a8,null));};exports[_0x7d89('0x4d')]=function(_0x12e4ea,_0x49394e){return db[_0x7d89('0x32')][_0x7d89('0x4d')](_0x12e4ea['body'],{})[_0x7d89('0x2c')](function(_0x9fa1ec){var _0x5c31ab=_0x12e4ea[_0x7d89('0x4e')][_0x7d89('0x4f')]({'plain':!![]});if(!_0x5c31ab)throw new Error(_0x7d89('0x50'));if(_0x5c31ab[_0x7d89('0x51')]===_0x7d89('0x4e')){var _0x11dc70=_0x9fa1ec['get']({'plain':!![]});var _0x4cb6a1=_0x7d89('0x52');return db[_0x7d89('0x53')][_0x7d89('0x4c')]({'where':{'name':_0x4cb6a1,'userProfileId':_0x5c31ab[_0x7d89('0x54')]},'raw':!![]})[_0x7d89('0x2c')](function(_0x10002b){if(_0x10002b&&_0x10002b[_0x7d89('0x55')]===0x0){return db[_0x7d89('0x56')]['create']({'name':_0x11dc70['name'],'resourceId':_0x11dc70['id'],'type':_0x10002b[_0x7d89('0x37')],'sectionId':_0x10002b['id']},{})[_0x7d89('0x2c')](function(){return _0x9fa1ec;});}else{return _0x9fa1ec;}})['catch'](function(_0x596379){logger['error'](_0x7d89('0x57'),_0x596379);throw _0x596379;});}return _0x9fa1ec;})[_0x7d89('0x2c')](respondWithResult(_0x49394e,0xc9))['catch'](handleError(_0x49394e,null));};exports[_0x7d89('0x2b')]=function(_0x26f54a,_0x27cd06){if(_0x26f54a['body']['id']){delete _0x26f54a['body']['id'];}return db[_0x7d89('0x32')]['find']({'where':{'id':_0x26f54a[_0x7d89('0x4a')]['id']}})[_0x7d89('0x2c')](handleEntityNotFound(_0x27cd06,null))['then'](saveUpdates(_0x26f54a['body'],null))[_0x7d89('0x2c')](respondWithResult(_0x27cd06,null))[_0x7d89('0x49')](handleError(_0x27cd06,null));};exports[_0x7d89('0x58')]=function(_0x42cdab,_0x347dca){var _0x1bcafa=_0x42cdab['params']['id'];var _0x1c20d8=[];return db['sequelize'][_0x7d89('0x59')](function(_0x734d97){var _0x2f7409='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x1bcafa;return db['sequelize'][_0x7d89('0x38')](_0x2f7409,{'type':db[_0x7d89('0x5a')][_0x7d89('0x5b')][_0x7d89('0x5c')],'raw':!![],'transaction':_0x734d97})[_0x7d89('0x2c')](function(_0x568390){_0x1c20d8=_[_0x7d89('0x31')](_0x568390,function(_0x329d04){return Number(_0x329d04['UserId']);});})[_0x7d89('0x2c')](function(){var _0x4ad1b8=_0x7d89('0x5d')+_0x1bcafa;return db[_0x7d89('0x5e')][_0x7d89('0x38')](_0x4ad1b8,{'type':db['Sequelize']['QueryTypes'][_0x7d89('0x5c')],'raw':!![],'transaction':_0x734d97});})[_0x7d89('0x2c')](function(_0x294814){var _0x27b1ed=_['map'](_0x294814,function(_0x47a68d){return Number(_0x47a68d[_0x7d89('0x5f')]);});return db[_0x7d89('0x60')]['destroy']({'where':{'UserId':{'$in':_0x1c20d8},'VoiceQueueId':{'$in':_0x27b1ed}},'transaction':_0x734d97});})[_0x7d89('0x2c')](function(){var _0x5bd361=_0x7d89('0x61')+_0x1bcafa;return db['sequelize']['query'](_0x5bd361,{'type':db[_0x7d89('0x5a')][_0x7d89('0x5b')][_0x7d89('0x5c')],'raw':!![],'transaction':_0x734d97});})[_0x7d89('0x2c')](function(_0x517435){var _0x325330=_['map'](_0x517435,function(_0x47f370){return Number(_0x47f370[_0x7d89('0x62')]);});return db['UserMailQueue'][_0x7d89('0x58')]({'where':{'UserId':{'$in':_0x1c20d8},'MailQueueId':{'$in':_0x325330}},'transaction':_0x734d97});})['then'](function(){var _0x8eb86a=_0x7d89('0x63')+_0x1bcafa;return db[_0x7d89('0x5e')]['query'](_0x8eb86a,{'type':db[_0x7d89('0x5a')][_0x7d89('0x5b')]['SELECT'],'raw':!![],'transaction':_0x734d97});})[_0x7d89('0x2c')](function(_0x17a0c4){var _0xe53bfe=_[_0x7d89('0x31')](_0x17a0c4,function(_0x57def9){return Number(_0x57def9['SmsQueueId']);});return db[_0x7d89('0x64')][_0x7d89('0x58')]({'where':{'UserId':{'$in':_0x1c20d8},'SmsQueueId':{'$in':_0xe53bfe}},'transaction':_0x734d97});})[_0x7d89('0x2c')](function(){var _0xe59c7a=_0x7d89('0x65')+_0x1bcafa;return db[_0x7d89('0x5e')]['query'](_0xe59c7a,{'type':db[_0x7d89('0x5a')][_0x7d89('0x5b')][_0x7d89('0x5c')],'raw':!![],'transaction':_0x734d97});})[_0x7d89('0x2c')](function(_0xe8f953){var _0x47d17f=_[_0x7d89('0x31')](_0xe8f953,function(_0x5aa161){return Number(_0x5aa161['ChatQueueId']);});return db['UserChatQueue']['destroy']({'where':{'UserId':{'$in':_0x1c20d8},'ChatQueueId':{'$in':_0x47d17f}},'transaction':_0x734d97});})['then'](function(){var _0x442f44=_0x7d89('0x66')+_0x1bcafa;return db[_0x7d89('0x5e')][_0x7d89('0x38')](_0x442f44,{'type':db[_0x7d89('0x5a')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x734d97});})[_0x7d89('0x2c')](function(_0x1030e6){var _0x107956=_[_0x7d89('0x31')](_0x1030e6,function(_0xbc3751){return Number(_0xbc3751[_0x7d89('0x67')]);});return db['UserFaxQueue'][_0x7d89('0x58')]({'where':{'UserId':{'$in':_0x1c20d8},'FaxQueueId':{'$in':_0x107956}},'transaction':_0x734d97});})[_0x7d89('0x2c')](function(){var _0x174ae5=_0x7d89('0x68')+_0x1bcafa;return db[_0x7d89('0x5e')][_0x7d89('0x38')](_0x174ae5,{'type':db[_0x7d89('0x5a')][_0x7d89('0x5b')][_0x7d89('0x5c')],'raw':!![],'transaction':_0x734d97});})[_0x7d89('0x2c')](function(_0x2ff7ec){var _0x28ad2a=_[_0x7d89('0x31')](_0x2ff7ec,function(_0x191718){return Number(_0x191718[_0x7d89('0x69')]);});return db['UserOpenchannelQueue'][_0x7d89('0x58')]({'where':{'UserId':{'$in':_0x1c20d8},'OpenchannelQueueId':{'$in':_0x28ad2a}},'transaction':_0x734d97});})[_0x7d89('0x2c')](function(){var _0x1ecad4='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1bcafa;return db[_0x7d89('0x5e')][_0x7d89('0x38')](_0x1ecad4,{'type':db['Sequelize'][_0x7d89('0x5b')][_0x7d89('0x5c')],'raw':!![],'transaction':_0x734d97});})[_0x7d89('0x2c')](function(_0x4dc5f5){var _0xe1dfd8=_[_0x7d89('0x31')](_0x4dc5f5,function(_0x16fd87){return Number(_0x16fd87['WhatsappQueueId']);});return db[_0x7d89('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x1c20d8},'WhatsappQueueId':{'$in':_0xe1dfd8}},'transaction':_0x734d97});})[_0x7d89('0x2c')](function(){return db[_0x7d89('0x6b')][_0x7d89('0x4c')]({'where':{'TeamId':_0x1bcafa}});})[_0x7d89('0x2c')](function(_0x1df764){if(_0x1df764===null){return;}return db[_0x7d89('0x6c')][_0x7d89('0x58')]({'where':{'UserId':{'$in':_0x1c20d8},'VoicePrefixId':_0x1df764[_0x7d89('0x6d')]},'transaction':_0x734d97});})[_0x7d89('0x2c')](function(){return db[_0x7d89('0x32')][_0x7d89('0x58')]({'where':{'id':_0x1bcafa},'cascade':!![],'transaction':_0x734d97});})[_0x7d89('0x2c')](function(_0x54ce2a){if(_0x54ce2a===0x0){_0x347dca[_0x7d89('0x22')](0x194);}else{return db['UserProfileResource'][_0x7d89('0x58')]({'where':{'type':'Teams','resourceId':_0x1bcafa},'cascade':!![],'transaction':_0x734d97})[_0x7d89('0x2c')](function(){_0x347dca[_0x7d89('0x23')](0xcc)[_0x7d89('0x6e')]();});}})['catch'](function(_0x31f8c1){_0x347dca[_0x7d89('0x23')](0x1f4)['send'](_0x31f8c1);});});};exports['getQueues']=function(_0x1259a2,_0x310962,_0x36da91){return db[_0x7d89('0x32')][_0x7d89('0x6f')]({'where':{'id':_0x1259a2[_0x7d89('0x4a')]['id']}})[_0x7d89('0x2c')](handleEntityNotFound(_0x310962,null))[_0x7d89('0x2c')](function(_0x3df876){if(!_0x1259a2[_0x7d89('0x38')][_0x7d89('0x70')]||!utils['isValidChannel'](_0x1259a2[_0x7d89('0x38')][_0x7d89('0x70')])){throw new db[(_0x7d89('0x5a'))]['ValidationError']('Unknown\x20channel');}var _0x217800={};var _0x135928={};_0x135928[_0x7d89('0x36')]=_['keys'](db[_[_0x7d89('0x71')](_0x1259a2[_0x7d89('0x38')][_0x7d89('0x70')][_0x7d89('0x72')]())+_0x7d89('0x73')][_0x7d89('0x74')]);_0x135928[_0x7d89('0x38')]=_[_0x7d89('0x39')](_0x1259a2[_0x7d89('0x38')]);_0x135928[_0x7d89('0x3a')]=_[_0x7d89('0x3c')](_0x135928['model'],_0x135928[_0x7d89('0x38')]);_0x217800[_0x7d89('0x3b')]=_[_0x7d89('0x3c')](_0x135928[_0x7d89('0x36')],qs[_0x7d89('0x3d')](_0x1259a2['query'][_0x7d89('0x3d')]));_0x217800[_0x7d89('0x3b')]=_0x217800[_0x7d89('0x3b')][_0x7d89('0x4b')]?_0x217800[_0x7d89('0x3b')]:_0x135928['model'];_0x217800[_0x7d89('0x27')]=qs[_0x7d89('0x27')](_0x1259a2[_0x7d89('0x38')]['limit']);_0x217800['offset']=qs[_0x7d89('0x25')](_0x1259a2[_0x7d89('0x38')][_0x7d89('0x25')]);_0x217800[_0x7d89('0x3f')]=qs[_0x7d89('0x40')](_0x1259a2[_0x7d89('0x38')][_0x7d89('0x40')]);_0x217800['where']=qs['filters'](_[_0x7d89('0x75')](_0x1259a2[_0x7d89('0x38')],_0x135928[_0x7d89('0x3a')]));_0x217800=_['merge']({},_0x217800,_0x1259a2['options']);return _0x3df876['get'+_[_0x7d89('0x71')](_0x1259a2[_0x7d89('0x38')][_0x7d89('0x70')]['toLowerCase']())+_0x7d89('0x76')](_0x217800);})[_0x7d89('0x2c')](respondWithResult(_0x310962,null))['catch'](handleError(_0x310962,null));};exports[_0x7d89('0x77')]=function(_0x6e3e7a,_0x3071ac,_0x46de9e){return db['Team'][_0x7d89('0x6f')]({'where':{'id':_0x6e3e7a[_0x7d89('0x4a')]['id']}})[_0x7d89('0x2c')](function(_0x401ced){if(_0x401ced){if(!_0x6e3e7a['body'][_0x7d89('0x70')]||!utils[_0x7d89('0x78')](_0x6e3e7a[_0x7d89('0x79')][_0x7d89('0x70')])){throw new db[(_0x7d89('0x5a'))][(_0x7d89('0x7a'))](_0x7d89('0x7b'));}return _0x401ced['add'+_['capitalize'](_0x6e3e7a[_0x7d89('0x79')][_0x7d89('0x70')][_0x7d89('0x72')]())+_0x7d89('0x76')](_0x6e3e7a[_0x7d89('0x79')]['ids']);}return null;})[_0x7d89('0x2c')](handleEntityNotFound(_0x3071ac,null))[_0x7d89('0x2c')](respondWithStatusCode(_0x3071ac,null))[_0x7d89('0x49')](handleError(_0x3071ac,null));};exports[_0x7d89('0x7c')]=function(_0x3785b1,_0x446b8e,_0x393809){return db['Team'][_0x7d89('0x6f')]({'where':{'id':_0x3785b1[_0x7d89('0x4a')]['id']}})[_0x7d89('0x2c')](function(_0x307e00){if(_0x307e00){if(!_0x3785b1['query'][_0x7d89('0x70')]||!utils[_0x7d89('0x78')](_0x3785b1['query']['channel'])){throw new db['Sequelize']['ValidationError'](_0x7d89('0x7b'));}return _0x307e00[_0x7d89('0x7d')+_[_0x7d89('0x71')](_0x3785b1['query'][_0x7d89('0x70')][_0x7d89('0x72')]())+_0x7d89('0x76')](_0x3785b1['query'][_0x7d89('0x7e')]);}return null;})['then'](handleEntityNotFound(_0x446b8e,null))[_0x7d89('0x2c')](respondWithStatusCode(_0x446b8e,null))[_0x7d89('0x49')](handleError(_0x446b8e,null));};exports[_0x7d89('0x7f')]=function(_0x4b2f20,_0x57abd2){var _0x169b49=_[_0x7d89('0x80')](_0x4b2f20[_0x7d89('0x79')][_0x7d89('0x7e')])?_0x4b2f20[_0x7d89('0x79')]['ids']:[_0x4b2f20[_0x7d89('0x79')][_0x7d89('0x7e')]];var _0x4017fd=_0x4b2f20[_0x7d89('0x4a')]['id'];return db['Team'][_0x7d89('0x4c')]({'where':{'id':_0x4017fd}})[_0x7d89('0x2c')](handleEntityNotFound(_0x57abd2,null))[_0x7d89('0x2c')](function(_0x54ac26){if(_0x54ac26){var _0x43d44a=[_0x7d89('0x81'),_0x7d89('0x82'),_0x7d89('0x83'),_0x7d89('0x84'),_0x7d89('0x85'),'Openchannel',_0x7d89('0x86')];return db[_0x7d89('0x5e')][_0x7d89('0x59')](function(_0x1eff6b){var _0x5ddeb2=_[_0x7d89('0x31')](_0x43d44a,function(_0x5dde90){var _0x506ee9={'attributes':['id',_0x7d89('0x37')]};if(_0x5dde90===_0x7d89('0x81')){_0x506ee9[_0x7d89('0x87')]={'attributes':[_0x7d89('0x88')]};}return _0x54ac26[_0x7d89('0x4f')+_0x5dde90+_0x7d89('0x76')](_0x506ee9)[_0x7d89('0x2c')](function(_0x4484bf){var _0x145cb4=_[_0x7d89('0x31')](_0x4484bf,function(_0x4cf00f){var _0x15287d=_[_0x7d89('0x31')](_0x169b49,function(_0xef8e0d){var _0x5562d5={'where':{'UserId':_0xef8e0d,[_0x5dde90+'QueueId']:_0x4cf00f['id']},'transaction':_0x1eff6b};if(_0x5dde90===_0x7d89('0x81')){_0x5562d5['defaults']={'penalty':_0x4cf00f[_0x7d89('0x89')]['penalty']};}return db['User'+_0x5dde90+_0x7d89('0x73')]['findOrCreate'](_0x5562d5)['then'](function(){socket[_0x7d89('0x8a')](_0x7d89('0x4e')+_0x5dde90+_0x7d89('0x8b'),{'UserId':_0xef8e0d,[_0x5dde90+_0x7d89('0x8c')]:_0x4cf00f['id']});if(_0x5dde90!==_0x7d89('0x81')){return;}return db['User'][_0x7d89('0x47')]({'where':{'id':_0x169b49,'online':0x1},'attributes':['id',_0x7d89('0x37'),'online',_0x7d89('0x8d'),_0x7d89('0x8e')],'raw':!![]})[_0x7d89('0x2c')](function(_0x26a227){var _0x58b5b5=_[_0x7d89('0x31')](_0x26a227,function(_0x296c57){return db[_0x7d89('0x8f')]['upsert']({'membername':_0x296c57[_0x7d89('0x37')],'UserId':_0x296c57['id'],'queue_name':_0x4cf00f['name'],'VoiceQueueId':_0x4cf00f['id'],'interface':_[_0x7d89('0x90')](_0x296c57[_0x7d89('0x8e')])?util[_0x7d89('0x91')](_0x7d89('0x92'),_0x296c57[_0x7d89('0x37')]):_0x296c57[_0x7d89('0x8e')],'paused':_0x296c57[_0x7d89('0x8d')]||![],'penalty':_0x4cf00f['TeamVoiceQueue'][_0x7d89('0x88')]},{'transaction':_0x1eff6b});});return Promise[_0x7d89('0x93')](_0x58b5b5);});});});return Promise['all'](_0x15287d);});return Promise[_0x7d89('0x93')](_0x145cb4);})[_0x7d89('0x2c')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x4017fd}})[_0x7d89('0x2c')](function(_0x34b622){if(_0x34b622){var _0x15ccdc=_[_0x7d89('0x31')](_0x169b49,function(_0x8a2dd1){db[_0x7d89('0x6c')][_0x7d89('0x94')]({'UserId':_0x8a2dd1,'VoicePrefixId':_0x34b622[_0x7d89('0x6d')]});});return Promise[_0x7d89('0x93')](_0x15ccdc);}});});});return Promise[_0x7d89('0x93')](_0x5ddeb2)[_0x7d89('0x2c')](function(){return _0x54ac26['addAgents'](_0x169b49,{'transaction':_0x1eff6b})[_0x7d89('0x95')](function(_0x10962b){return _0x10962b;});});});}})[_0x7d89('0x2c')](respondWithResult(_0x57abd2,null))[_0x7d89('0x49')](handleError(_0x57abd2,null));};exports[_0x7d89('0x96')]=function(_0x3a09ef,_0x2ca5d2){var _0xe79cd9=_[_0x7d89('0x80')](_0x3a09ef[_0x7d89('0x38')][_0x7d89('0x7e')])?_0x3a09ef['query'][_0x7d89('0x7e')]:[_0x3a09ef['query']['ids']];var _0x21174f=_0x3a09ef['params']['id'];return db['Team'][_0x7d89('0x4c')]({'where':{'id':_0x21174f}})[_0x7d89('0x2c')](handleEntityNotFound(_0x2ca5d2,null))[_0x7d89('0x2c')](function(_0x494ac6){if(_0x494ac6){var _0x409c14=[_0x7d89('0x81'),'Chat',_0x7d89('0x83'),_0x7d89('0x84'),_0x7d89('0x85'),'Openchannel',_0x7d89('0x86')];return db[_0x7d89('0x5e')][_0x7d89('0x59')](function(_0x5188f0){var _0x17a2fe=_[_0x7d89('0x31')](_0x409c14,function(_0x50e3ad){var _0x59646f={'attributes':['id','name']};return _0x494ac6[_0x7d89('0x4f')+_0x50e3ad+_0x7d89('0x76')](_0x59646f)[_0x7d89('0x2c')](function(_0x46183a){var _0x3ebbc6=_[_0x7d89('0x31')](_0x46183a,function(_0x3a8714){return _0x3a8714[_0x7d89('0x96')](_0xe79cd9,{'transaction':_0x5188f0})[_0x7d89('0x2c')](function(){var _0x2c662f=_[_0x7d89('0x31')](_0xe79cd9,function(_0x57112d){socket[_0x7d89('0x8a')]('user'+_0x50e3ad+_0x7d89('0x97'),{'UserId':Number(_0x57112d),[_0x50e3ad+'QueueId']:_0x3a8714['id']});if(_0x50e3ad!==_0x7d89('0x81')){return;}return db[_0x7d89('0x8f')][_0x7d89('0x58')]({'where':{'VoiceQueueId':_0x3a8714['id'],'UserId':_0x57112d},'transaction':_0x5188f0});});return Promise[_0x7d89('0x93')](_0x2c662f);});});return Promise[_0x7d89('0x93')](_0x3ebbc6);});});return Promise[_0x7d89('0x93')](_0x17a2fe)['then'](function(){return _0x494ac6[_0x7d89('0x96')](_0xe79cd9,{'transaction':_0x5188f0});})[_0x7d89('0x2c')](function(){return db[_0x7d89('0x6b')][_0x7d89('0x6f')]({'where':{'teamId':_0x21174f}})[_0x7d89('0x2c')](function(_0x5aba62){if(_0x5aba62){var _0x253bdd=_[_0x7d89('0x31')](_0xe79cd9,function(_0x80b15e){db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x80b15e,'VoicePrefixId':_0x5aba62['VoicePrefixId']}});});return Promise['all'](_0x253bdd);}});});});}})['then'](respondWithStatusCode(_0x2ca5d2,null))[_0x7d89('0x49')](handleError(_0x2ca5d2,null));};exports[_0x7d89('0x98')]=function(_0x40ad14,_0x154f19,_0x584b4f){var _0x547ac2={};var _0x1bdc43={};var _0x5dcec3;var _0x33c1b7;return db[_0x7d89('0x32')][_0x7d89('0x6f')]({'where':{'id':_0x40ad14[_0x7d89('0x4a')]['id']}})[_0x7d89('0x2c')](handleEntityNotFound(_0x154f19,null))[_0x7d89('0x2c')](function(_0xbd7448){if(_0xbd7448){_0x5dcec3=_0xbd7448;_0x1bdc43[_0x7d89('0x36')]=_[_0x7d89('0x39')](db[_0x7d89('0x99')][_0x7d89('0x74')]);_0x1bdc43['query']=_['keys'](_0x40ad14['query']);_0x1bdc43[_0x7d89('0x3a')]=_[_0x7d89('0x3c')](_0x1bdc43[_0x7d89('0x36')],_0x1bdc43['query']);_0x547ac2[_0x7d89('0x3b')]=_[_0x7d89('0x3c')](_0x1bdc43[_0x7d89('0x36')],qs[_0x7d89('0x3d')](_0x40ad14[_0x7d89('0x38')][_0x7d89('0x3d')]));_0x547ac2[_0x7d89('0x3b')]=_0x547ac2[_0x7d89('0x3b')][_0x7d89('0x4b')]?_0x547ac2['attributes']:_0x1bdc43['model'];_0x547ac2[_0x7d89('0x3f')]=qs[_0x7d89('0x40')](_0x40ad14[_0x7d89('0x38')][_0x7d89('0x40')]);_0x547ac2[_0x7d89('0x41')]=qs['filters'](_['pick'](_0x40ad14[_0x7d89('0x38')],_0x1bdc43['filters']));if(_0x40ad14[_0x7d89('0x38')][_0x7d89('0x42')]){_0x547ac2[_0x7d89('0x41')]=_['merge'](_0x547ac2[_0x7d89('0x41')],{'$or':_[_0x7d89('0x31')](_0x547ac2[_0x7d89('0x3b')],function(_0x295465){var _0x83c6cc={};_0x83c6cc[_0x295465]={'$like':'%'+_0x40ad14['query'][_0x7d89('0x42')]+'%'};return _0x83c6cc;})});}_0x547ac2=_[_0x7d89('0x43')]({},_0x547ac2,_0x40ad14['options']);return _0x5dcec3[_0x7d89('0x98')](_0x547ac2);}})[_0x7d89('0x2c')](function(_0x4d5b1e){if(_0x4d5b1e){_0x33c1b7=_0x4d5b1e[_0x7d89('0x4b')];if(!_0x40ad14[_0x7d89('0x38')][_0x7d89('0x9a')]('nolimit')){_0x547ac2['limit']=qs[_0x7d89('0x27')](_0x40ad14[_0x7d89('0x38')][_0x7d89('0x27')]);_0x547ac2['offset']=qs['offset'](_0x40ad14[_0x7d89('0x38')]['offset']);}return _0x5dcec3[_0x7d89('0x98')](_0x547ac2);}})[_0x7d89('0x2c')](function(_0x4950f5){if(_0x4950f5){return _0x4950f5?{'count':_0x33c1b7,'rows':_0x4950f5}:null;}})['then'](respondWithResult(_0x154f19,null))[_0x7d89('0x49')](handleError(_0x154f19,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 4fbd71f..8f968b1 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 _0x6ff3=['exports','events','../../mysqldb','Team','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x3928a7,_0x2aa0af){var _0x222b67=function(_0x4c8753){while(--_0x4c8753){_0x3928a7['push'](_0x3928a7['shift']());}};_0x222b67(++_0x2aa0af);}(_0x6ff3,0x9a));var _0x36ff=function(_0x1e3d82,_0x21ee26){_0x1e3d82=_0x1e3d82-0x0;var _0x155ddb=_0x6ff3[_0x1e3d82];return _0x155ddb;};'use strict';var EventEmitter=require(_0x36ff('0x0'));var Team=require(_0x36ff('0x1'))['db'][_0x36ff('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x36ff('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x36ff('0x4'),'afterDestroy':_0x36ff('0x5')};function emitEvent(_0x29bee5){return function(_0x41e656,_0x11b772,_0xb3592b){TeamEvents[_0x36ff('0x6')](_0x29bee5+':'+_0x41e656['id'],_0x41e656);TeamEvents[_0x36ff('0x6')](_0x29bee5,_0x41e656);_0xb3592b(null);};}for(var e in events){if(events[_0x36ff('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x36ff('0x8')]=TeamEvents; \ No newline at end of file +var _0x590a=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0x590a,0x9d));var _0xa590=function(_0x470e21,_0x3932d8){_0x470e21=_0x470e21-0x0;var _0xfc4788=_0x590a[_0x470e21];return _0xfc4788;};'use strict';var EventEmitter=require(_0xa590('0x0'));var Team=require(_0xa590('0x1'))['db'][_0xa590('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xa590('0x3')](0x0);var events={'afterCreate':_0xa590('0x4'),'afterUpdate':'update','afterDestroy':_0xa590('0x5')};function emitEvent(_0x4da4e4){return function(_0x35b6c5,_0x3741eb,_0x47db44){TeamEvents[_0xa590('0x6')](_0x4da4e4+':'+_0x35b6c5['id'],_0x35b6c5);TeamEvents[_0xa590('0x6')](_0x4da4e4,_0x35b6c5);_0x47db44(null);};}for(var e in events){if(events[_0xa590('0x7')](e)){var event=events[e];Team[_0xa590('0x8')](e,emitEvent(event));}}module[_0xa590('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 21fde5d..c1413cc 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 _0xbf59=['teams','Chat','Fax','Mail','Openchannel','Sms','Voice','resolve','all','lodash','./team.attributes','get','Queues','then','map','setDataValue','channel','catch','define','Team'];(function(_0x142c55,_0x1b7132){var _0x58c332=function(_0x45adc2){while(--_0x45adc2){_0x142c55['push'](_0x142c55['shift']());}};_0x58c332(++_0x1b7132);}(_0xbf59,0x1d5));var _0x9bf5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf59[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9bf5('0x0'));var attributes=require(_0x9bf5('0x1'));function getQueuesByChannel(_0x2e2bb2,_0x401294){var _0x4955d8=_0x9bf5('0x2')+_0x401294+_0x9bf5('0x3');return _0x2e2bb2[_0x4955d8]()[_0x9bf5('0x4')](function(_0x4d7dc8){return _[_0x9bf5('0x5')](_0x4d7dc8,function(_0x297f41){_0x297f41[_0x9bf5('0x6')](_0x9bf5('0x7'),_0x401294);return _0x297f41;});})[_0x9bf5('0x8')](function(_0x20e9b8){throw _0x20e9b8;});}module['exports']=function(_0x4e3c6e){return _0x4e3c6e[_0x9bf5('0x9')](_0x9bf5('0xa'),attributes,{'tableName':_0x9bf5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x10a5bd=this;var _0x11ae37=[_0x9bf5('0xc'),_0x9bf5('0xd'),_0x9bf5('0xe'),_0x9bf5('0xf'),_0x9bf5('0x10'),_0x9bf5('0x11'),'Whatsapp'];return Promise[_0x9bf5('0x12')]()[_0x9bf5('0x4')](function(){var _0x44f812=_['map'](_0x11ae37,function(_0x4de173){return getQueuesByChannel(_0x10a5bd,_0x4de173);});return Promise[_0x9bf5('0x13')](_0x44f812);})[_0x9bf5('0x8')](function(_0x790885){throw _0x790885;});}}});}; \ No newline at end of file +var _0x2677=['then','map','catch','define','Team','Chat','Mail','Sms','all','lodash','./team.attributes','get','Queues'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x2677,0x1b6));var _0x7267=function(_0x4a917d,_0x18c5fb){_0x4a917d=_0x4a917d-0x0;var _0x465333=_0x2677[_0x4a917d];return _0x465333;};'use strict';var _=require(_0x7267('0x0'));var attributes=require(_0x7267('0x1'));function getQueuesByChannel(_0x2b81fa,_0x47556a){var _0x2960a9=_0x7267('0x2')+_0x47556a+_0x7267('0x3');return _0x2b81fa[_0x2960a9]()[_0x7267('0x4')](function(_0x51b884){return _[_0x7267('0x5')](_0x51b884,function(_0xafec16){_0xafec16['setDataValue']('channel',_0x47556a);return _0xafec16;});})[_0x7267('0x6')](function(_0x46fc9e){throw _0x46fc9e;});}module['exports']=function(_0xb00817){return _0xb00817[_0x7267('0x7')](_0x7267('0x8'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x16e554=this;var _0x178234=[_0x7267('0x9'),'Fax',_0x7267('0xa'),'Openchannel',_0x7267('0xb'),'Voice','Whatsapp'];return Promise['resolve']()[_0x7267('0x4')](function(){var _0x207cbc=_[_0x7267('0x5')](_0x178234,function(_0x1f5b47){return getQueuesByChannel(_0x16e554,_0x1f5b47);});return Promise[_0x7267('0xc')](_0x207cbc);})[_0x7267('0x6')](function(_0x5c0332){throw _0x5c0332;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 5f1344c..7d88a65 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 _0xa545=['stringify','error','code','message','info','result','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','then','Team,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x44d4c4,_0x56ef8b){var _0x44ee0b=function(_0x3b3016){while(--_0x3b3016){_0x44d4c4['push'](_0x44d4c4['shift']());}};_0x44ee0b(++_0x56ef8b);}(_0xa545,0x14a));var _0x5a54=function(_0x1634bf,_0xda08a7){_0x1634bf=_0x1634bf-0x0;var _0x32643d=_0xa545[_0x1634bf];return _0x32643d;};'use strict';var _=require('lodash');var util=require(_0x5a54('0x0'));var moment=require('moment');var BPromise=require(_0x5a54('0x1'));var rs=require(_0x5a54('0x2'));var fs=require('fs');var Redis=require(_0x5a54('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5a54('0x4'));var logger=require(_0x5a54('0x5'))(_0x5a54('0x6'));var config=require(_0x5a54('0x7'));var jayson=require(_0x5a54('0x8'));var client=jayson[_0x5a54('0x9')][_0x5a54('0xa')]({'port':0x232a});config[_0x5a54('0xb')]=_[_0x5a54('0xc')](config['redis'],{'host':_0x5a54('0xd'),'port':0x18eb});var socket=require(_0x5a54('0xe'))(new Redis(config[_0x5a54('0xb')]));require(_0x5a54('0xf'))[_0x5a54('0x10')](socket);function respondWithRpcPromise(_0x4dd676,_0x27480e,_0x2d9f7a){return new BPromise(function(_0x3169e5,_0x2cd2d3){return client['request'](_0x4dd676,_0x2d9f7a)[_0x5a54('0x11')](function(_0x333b6d){logger['info'](_0x5a54('0x12'),_0x27480e,_0x5a54('0x13'));logger[_0x5a54('0x14')]('Team,\x20%s,\x20%s,\x20%s',_0x27480e,_0x5a54('0x13'),JSON[_0x5a54('0x15')](_0x333b6d));if(_0x333b6d[_0x5a54('0x16')]){if(_0x333b6d['error'][_0x5a54('0x17')]===0x1f4){logger[_0x5a54('0x16')](_0x5a54('0x12'),_0x27480e,_0x333b6d[_0x5a54('0x16')][_0x5a54('0x18')]);return _0x2cd2d3(_0x333b6d[_0x5a54('0x16')][_0x5a54('0x18')]);}logger[_0x5a54('0x16')](_0x5a54('0x12'),_0x27480e,_0x333b6d[_0x5a54('0x16')]['message']);return _0x3169e5(_0x333b6d[_0x5a54('0x16')][_0x5a54('0x18')]);}else{logger[_0x5a54('0x19')](_0x5a54('0x12'),_0x27480e,_0x5a54('0x13'));_0x3169e5(_0x333b6d[_0x5a54('0x1a')]['message']);}})['catch'](function(_0x301501){logger['error']('Team,\x20%s,\x20%s',_0x27480e,_0x301501);_0x2cd2d3(_0x301501);});});} \ No newline at end of file +var _0x39ef=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x3ad93b,_0x284c95){var _0x4ef96b=function(_0x576f6b){while(--_0x576f6b){_0x3ad93b['push'](_0x3ad93b['shift']());}};_0x4ef96b(++_0x284c95);}(_0x39ef,0x1dc));var _0xf39e=function(_0x40db09,_0x377c60){_0x40db09=_0x40db09-0x0;var _0x13c04c=_0x39ef[_0x40db09];return _0x13c04c;};'use strict';var _=require(_0xf39e('0x0'));var util=require('util');var moment=require(_0xf39e('0x1'));var BPromise=require('bluebird');var rs=require(_0xf39e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf39e('0x3'))['db'];var utils=require(_0xf39e('0x4'));var logger=require(_0xf39e('0x5'))(_0xf39e('0x6'));var config=require('../../config/environment');var jayson=require(_0xf39e('0x7'));var client=jayson[_0xf39e('0x8')][_0xf39e('0x9')]({'port':0x232a});config[_0xf39e('0xa')]=_[_0xf39e('0xb')](config[_0xf39e('0xa')],{'host':_0xf39e('0xc'),'port':0x18eb});var socket=require(_0xf39e('0xd'))(new Redis(config[_0xf39e('0xa')]));require('./team.socket')[_0xf39e('0xe')](socket);function respondWithRpcPromise(_0x3b8b51,_0x3a73f6,_0xa04807){return new BPromise(function(_0x356492,_0x22eadf){return client[_0xf39e('0xf')](_0x3b8b51,_0xa04807)[_0xf39e('0x10')](function(_0x213e58){logger[_0xf39e('0x11')](_0xf39e('0x12'),_0x3a73f6,_0xf39e('0x13'));logger[_0xf39e('0x14')](_0xf39e('0x15'),_0x3a73f6,'request\x20sent',JSON[_0xf39e('0x16')](_0x213e58));if(_0x213e58[_0xf39e('0x17')]){if(_0x213e58['error'][_0xf39e('0x18')]===0x1f4){logger[_0xf39e('0x17')](_0xf39e('0x12'),_0x3a73f6,_0x213e58[_0xf39e('0x17')][_0xf39e('0x19')]);return _0x22eadf(_0x213e58[_0xf39e('0x17')][_0xf39e('0x19')]);}logger['error'](_0xf39e('0x12'),_0x3a73f6,_0x213e58[_0xf39e('0x17')]['message']);return _0x356492(_0x213e58['error']['message']);}else{logger[_0xf39e('0x11')](_0xf39e('0x12'),_0x3a73f6,'request\x20sent');_0x356492(_0x213e58[_0xf39e('0x1a')][_0xf39e('0x19')]);}})['catch'](function(_0x3e0e3f){logger['error'](_0xf39e('0x12'),_0x3a73f6,_0x3e0e3f);_0x22eadf(_0x3e0e3f);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index a61caa2..10e0ba8 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 _0xcdce=['length','team:','save','remove','update','emit','removeListener','register'];(function(_0x4b118e,_0x5eec3d){var _0x1d34b1=function(_0x5cacba){while(--_0x5cacba){_0x4b118e['push'](_0x4b118e['shift']());}};_0x1d34b1(++_0x5eec3d);}(_0xcdce,0x15a));var _0xecdc=function(_0x4dc752,_0x2210f9){_0x4dc752=_0x4dc752-0x0;var _0xcc5d96=_0xcdce[_0x4dc752];return _0xcc5d96;};'use strict';var TeamEvents=require('./team.events');var events=[_0xecdc('0x0'),_0xecdc('0x1'),_0xecdc('0x2')];function createListener(_0x29a04a,_0x36fcca){return function(_0x214f5b){_0x36fcca[_0xecdc('0x3')](_0x29a04a,_0x214f5b);};}function removeListener(_0x4b0f5f,_0x1c2471){return function(){TeamEvents[_0xecdc('0x4')](_0x4b0f5f,_0x1c2471);};}exports[_0xecdc('0x5')]=function(_0x1ba963){for(var _0x50161c=0x0,_0x2d7c6c=events[_0xecdc('0x6')];_0x50161c<_0x2d7c6c;_0x50161c++){var _0x53b028=events[_0x50161c];var _0x28bcc4=createListener(_0xecdc('0x7')+_0x53b028,_0x1ba963);TeamEvents['on'](_0x53b028,_0x28bcc4);}}; \ No newline at end of file +var _0xc00a=['length','team:','./team.events','save','update','emit','removeListener'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0xc00a,0x1f3));var _0xac00=function(_0xcc26d2,_0x20c921){_0xcc26d2=_0xcc26d2-0x0;var _0x3841e2=_0xc00a[_0xcc26d2];return _0x3841e2;};'use strict';var TeamEvents=require(_0xac00('0x0'));var events=[_0xac00('0x1'),'remove',_0xac00('0x2')];function createListener(_0x40cb98,_0x2875f6){return function(_0x4b1e68){_0x2875f6[_0xac00('0x3')](_0x40cb98,_0x4b1e68);};}function removeListener(_0x4ede0a,_0x17f0cf){return function(){TeamEvents[_0xac00('0x4')](_0x4ede0a,_0x17f0cf);};}exports['register']=function(_0x1487dd){for(var _0x1344d0=0x0,_0x22d1c8=events[_0xac00('0x5')];_0x1344d0<_0x22d1c8;_0x1344d0++){var _0x552147=events[_0x1344d0];var _0x45950e=createListener(_0xac00('0x6')+_0x552147,_0x1487dd);TeamEvents['on'](_0x552147,_0x45950e);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 0a63e68..6be305c 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fef=['INTEGER','sequelize','exports'];(function(_0x3ee1fe,_0x59f2a1){var _0x1ae57a=function(_0x1ef0c4){while(--_0x1ef0c4){_0x3ee1fe['push'](_0x3ee1fe['shift']());}};_0x1ae57a(++_0x59f2a1);}(_0x4fef,0x10f));var _0xf4fe=function(_0x56a93c,_0x239eef){_0x56a93c=_0x56a93c-0x0;var _0x24d1cc=_0x4fef[_0x56a93c];return _0x24d1cc;};'use strict';var Sequelize=require(_0xf4fe('0x0'));module[_0xf4fe('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xf4fe('0x2')]}}; \ No newline at end of file +var _0x542b=['exports','INTEGER','sequelize'];(function(_0x27e8d8,_0x2c0baa){var _0x6f7eda=function(_0x14d347){while(--_0x14d347){_0x27e8d8['push'](_0x27e8d8['shift']());}};_0x6f7eda(++_0x2c0baa);}(_0x542b,0xec));var _0xb542=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x542b[_0x2261ce];return _0x524640;};'use strict';var Sequelize=require(_0xb542('0x0'));module[_0xb542('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xb542('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 6d58006..9d7a004 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.model.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4849=['path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','team_has_voice_prefixes','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x4cf0b7,_0x560029){var _0x545f10=function(_0x993533){while(--_0x993533){_0x4cf0b7['push'](_0x4cf0b7['shift']());}};_0x545f10(++_0x560029);}(_0x4849,0xf8));var _0x9484=function(_0x3f4aae,_0x17d5f3){_0x3f4aae=_0x3f4aae-0x0;var _0x9a96bc=_0x4849[_0x3f4aae];return _0x9a96bc;};'use strict';var _=require(_0x9484('0x0'));var util=require(_0x9484('0x1'));var logger=require(_0x9484('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9484('0x3'));var rp=require(_0x9484('0x4'));var fs=require('fs');var path=require(_0x9484('0x5'));var rimraf=require(_0x9484('0x6'));var config=require(_0x9484('0x7'));var attributes=require(_0x9484('0x8'));module[_0x9484('0x9')]=function(_0x94e9bd,_0xc4337e){return _0x94e9bd['define']('TeamVoicePrefix',attributes,{'tableName':_0x9484('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9805=['define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x2d8f6c,_0x44db4c){var _0x3a00f6=function(_0x1b16ea){while(--_0x1b16ea){_0x2d8f6c['push'](_0x2d8f6c['shift']());}};_0x3a00f6(++_0x44db4c);}(_0x9805,0x18f));var _0x5980=function(_0x27405c,_0xfb3b33){_0x27405c=_0x27405c-0x0;var _0x5d3a09=_0x9805[_0x27405c];return _0x5d3a09;};'use strict';var _=require(_0x5980('0x0'));var util=require(_0x5980('0x1'));var logger=require(_0x5980('0x2'))(_0x5980('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5980('0x4'));var fs=require('fs');var path=require(_0x5980('0x5'));var rimraf=require(_0x5980('0x6'));var config=require(_0x5980('0x7'));var attributes=require('./teamVoicePrefix.attributes');module['exports']=function(_0x1b1c8d,_0x255321){return _0x1b1c8d[_0x5980('0x8')](_0x5980('0x9'),attributes,{'tableName':_0x5980('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 3f38d9e..91a2615 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x8e2d4d,_0x310930){var _0x5e3047=function(_0x4665e4){while(--_0x4665e4){_0x8e2d4d['push'](_0x8e2d4d['shift']());}};_0x5e3047(++_0x310930);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3813ad,_0x2eff01){var _0x16ed55=function(_0x406204){while(--_0x406204){_0x3813ad['push'](_0x3813ad['shift']());}};_0x16ed55(++_0x2eff01);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 2eccb60..0f6de0e 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 _0x4be6=['INTEGER','exports'];(function(_0xf2d998,_0x3f10c4){var _0x5dd2eb=function(_0x387216){while(--_0x387216){_0xf2d998['push'](_0xf2d998['shift']());}};_0x5dd2eb(++_0x3f10c4);}(_0x4be6,0xb5));var _0x64be=function(_0x3fc726,_0x3bb2d3){_0x3fc726=_0x3fc726-0x0;var _0x4ca942=_0x4be6[_0x3fc726];return _0x4ca942;};'use strict';var Sequelize=require('sequelize');module[_0x64be('0x0')]={'penalty':{'type':Sequelize[_0x64be('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdb79=['INTEGER','sequelize','exports'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0xdb79,0x9a));var _0x9db7=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xdb79[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require(_0x9db7('0x0'));module[_0x9db7('0x1')]={'penalty':{'type':Sequelize[_0x9db7('0x2')],'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 1947bcb..616a4dc 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 _0x23d3=['../../config/environment','exports','define','team_has_voice_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x23d3,0xe8));var _0x323d=function(_0x4d49d3,_0x247a2f){_0x4d49d3=_0x4d49d3-0x0;var _0x4b1c17=_0x23d3[_0x4d49d3];return _0x4b1c17;};'use strict';var _=require(_0x323d('0x0'));var util=require(_0x323d('0x1'));var logger=require(_0x323d('0x2'))('api');var moment=require(_0x323d('0x3'));var BPromise=require(_0x323d('0x4'));var rp=require(_0x323d('0x5'));var fs=require('fs');var path=require(_0x323d('0x6'));var rimraf=require(_0x323d('0x7'));var config=require(_0x323d('0x8'));var attributes=require('./teamVoiceQueue.attributes');module[_0x323d('0x9')]=function(_0x34f513,_0x160a18){return _0x34f513[_0x323d('0xa')]('TeamVoiceQueue',attributes,{'tableName':_0x323d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90ae=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash'];(function(_0x2406b4,_0x2f9771){var _0x7f3752=function(_0x583971){while(--_0x583971){_0x2406b4['push'](_0x2406b4['shift']());}};_0x7f3752(++_0x2f9771);}(_0x90ae,0x195));var _0xe90a=function(_0x5af955,_0x1b7e3c){_0x5af955=_0x5af955-0x0;var _0x7e04be=_0x90ae[_0x5af955];return _0x7e04be;};'use strict';var _=require(_0xe90a('0x0'));var util=require(_0xe90a('0x1'));var logger=require(_0xe90a('0x2'))('api');var moment=require(_0xe90a('0x3'));var BPromise=require(_0xe90a('0x4'));var rp=require(_0xe90a('0x5'));var fs=require('fs');var path=require(_0xe90a('0x6'));var rimraf=require(_0xe90a('0x7'));var config=require(_0xe90a('0x8'));var attributes=require(_0xe90a('0x9'));module[_0xe90a('0xa')]=function(_0x30cb7b,_0x5c3573){return _0x30cb7b[_0xe90a('0xb')](_0xe90a('0xc'),attributes,{'tableName':_0xe90a('0xd'),'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 523d028..6086852 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 _0xe20e=['TeamVoiceQueue,\x20%s,\x20%s','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x346312,_0x1310e8){var _0x2f05d3=function(_0x10e545){while(--_0x10e545){_0x346312['push'](_0x346312['shift']());}};_0x2f05d3(++_0x1310e8);}(_0xe20e,0x195));var _0xee20=function(_0x419ffd,_0x10bdfe){_0x419ffd=_0x419ffd-0x0;var _0xb0b19d=_0xe20e[_0x419ffd];return _0xb0b19d;};'use strict';var _=require(_0xee20('0x0'));var util=require(_0xee20('0x1'));var moment=require('moment');var BPromise=require(_0xee20('0x2'));var rs=require(_0xee20('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xee20('0x4'));var logger=require('../../config/logger')(_0xee20('0x5'));var config=require(_0xee20('0x6'));var jayson=require(_0xee20('0x7'));var client=jayson[_0xee20('0x8')][_0xee20('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd8d1e,_0x3ba270,_0x15f380){return new BPromise(function(_0x34f82d,_0x120622){return client[_0xee20('0xa')](_0xd8d1e,_0x15f380)[_0xee20('0xb')](function(_0x50ed9b){logger[_0xee20('0xc')](_0xee20('0xd'),_0x3ba270,'request\x20sent');logger['debug'](_0xee20('0xe'),_0x3ba270,_0xee20('0xf'),JSON[_0xee20('0x10')](_0x50ed9b));if(_0x50ed9b[_0xee20('0x11')]){if(_0x50ed9b['error'][_0xee20('0x12')]===0x1f4){logger[_0xee20('0x11')](_0xee20('0xd'),_0x3ba270,_0x50ed9b[_0xee20('0x11')][_0xee20('0x13')]);return _0x120622(_0x50ed9b[_0xee20('0x11')][_0xee20('0x13')]);}logger['error'](_0xee20('0xd'),_0x3ba270,_0x50ed9b['error'][_0xee20('0x13')]);return _0x34f82d(_0x50ed9b[_0xee20('0x11')][_0xee20('0x13')]);}else{logger['info'](_0xee20('0xd'),_0x3ba270,_0xee20('0xf'));_0x34f82d(_0x50ed9b[_0xee20('0x14')][_0xee20('0x13')]);}})[_0xee20('0x15')](function(_0x5bc2a0){logger[_0xee20('0x11')](_0xee20('0xd'),_0x3ba270,_0x5bc2a0);_0x120622(_0x5bc2a0);});});} \ No newline at end of file +var _0xea63=['code','message','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5369e1,_0x2ceb72){var _0x3738ec=function(_0x33955c){while(--_0x33955c){_0x5369e1['push'](_0x5369e1['shift']());}};_0x3738ec(++_0x2ceb72);}(_0xea63,0x1d6));var _0x3ea6=function(_0x38849a,_0x2ab000){_0x38849a=_0x38849a-0x0;var _0x632b99=_0xea63[_0x38849a];return _0x632b99;};'use strict';var _=require('lodash');var util=require(_0x3ea6('0x0'));var moment=require(_0x3ea6('0x1'));var BPromise=require(_0x3ea6('0x2'));var rs=require(_0x3ea6('0x3'));var fs=require('fs');var Redis=require(_0x3ea6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3ea6('0x5'))(_0x3ea6('0x6'));var config=require(_0x3ea6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3ea6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf5312a,_0xf47979,_0x398b02){return new BPromise(function(_0x383a4c,_0x13be48){return client['request'](_0xf5312a,_0x398b02)[_0x3ea6('0x9')](function(_0x10cd0b){logger['info'](_0x3ea6('0xa'),_0xf47979,_0x3ea6('0xb'));logger[_0x3ea6('0xc')](_0x3ea6('0xd'),_0xf47979,'request\x20sent',JSON[_0x3ea6('0xe')](_0x10cd0b));if(_0x10cd0b['error']){if(_0x10cd0b[_0x3ea6('0xf')][_0x3ea6('0x10')]===0x1f4){logger['error'](_0x3ea6('0xa'),_0xf47979,_0x10cd0b[_0x3ea6('0xf')]['message']);return _0x13be48(_0x10cd0b[_0x3ea6('0xf')][_0x3ea6('0x11')]);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0xf47979,_0x10cd0b['error'][_0x3ea6('0x11')]);return _0x383a4c(_0x10cd0b[_0x3ea6('0xf')][_0x3ea6('0x11')]);}else{logger['info'](_0x3ea6('0xa'),_0xf47979,_0x3ea6('0xb'));_0x383a4c(_0x10cd0b['result'][_0x3ea6('0x11')]);}})['catch'](function(_0x2f5d9){logger['error'](_0x3ea6('0xa'),_0xf47979,_0x2f5d9);_0x13be48(_0x2f5d9);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 8757813..f38edd1 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 _0xbb8d=['delete','destroy','exports','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated','index','get','/:id','show','create','update'];(function(_0x462cee,_0x3a48a3){var _0x4d95cc=function(_0x26510a){while(--_0x26510a){_0x462cee['push'](_0x462cee['shift']());}};_0x4d95cc(++_0x3a48a3);}(_0xbb8d,0x146));var _0xdbb8=function(_0x26f56b,_0x2959ba){_0x26f56b=_0x26f56b-0x0;var _0x19c4b5=_0xbb8d[_0x26f56b];return _0x19c4b5;};'use strict';var multer=require(_0xdbb8('0x0'));var util=require('util');var path=require(_0xdbb8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xdbb8('0x2'));var auth=require(_0xdbb8('0x3'));var interaction=require(_0xdbb8('0x4'));var config=require(_0xdbb8('0x5'));var controller=require(_0xdbb8('0x6'));router['get']('/',auth[_0xdbb8('0x7')](),controller[_0xdbb8('0x8')]);router[_0xdbb8('0x9')](_0xdbb8('0xa'),auth['isAuthenticated'](),controller[_0xdbb8('0xb')]);router['post']('/',auth[_0xdbb8('0x7')](),controller[_0xdbb8('0xc')]);router['put'](_0xdbb8('0xa'),auth[_0xdbb8('0x7')](),controller[_0xdbb8('0xd')]);router[_0xdbb8('0xe')](_0xdbb8('0xa'),auth[_0xdbb8('0x7')](),controller[_0xdbb8('0xf')]);module[_0xdbb8('0x10')]=router; \ No newline at end of file +var _0x6fad=['multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./template.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','exports'];(function(_0x11fbb1,_0x2fc380){var _0x29988f=function(_0x415b82){while(--_0x415b82){_0x11fbb1['push'](_0x11fbb1['shift']());}};_0x29988f(++_0x2fc380);}(_0x6fad,0x17a));var _0xd6fa=function(_0x5cbfed,_0x2b8ba5){_0x5cbfed=_0x5cbfed-0x0;var _0x462d98=_0x6fad[_0x5cbfed];return _0x462d98;};'use strict';var multer=require(_0xd6fa('0x0'));var util=require(_0xd6fa('0x1'));var path=require(_0xd6fa('0x2'));var timeout=require(_0xd6fa('0x3'));var express=require(_0xd6fa('0x4'));var router=express['Router']();var fs_extra=require(_0xd6fa('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd6fa('0x6'));var config=require('../../config/environment');var controller=require(_0xd6fa('0x7'));router['get']('/',auth[_0xd6fa('0x8')](),controller[_0xd6fa('0x9')]);router[_0xd6fa('0xa')](_0xd6fa('0xb'),auth[_0xd6fa('0x8')](),controller[_0xd6fa('0xc')]);router[_0xd6fa('0xd')]('/',auth['isAuthenticated'](),controller[_0xd6fa('0xe')]);router['put'](_0xd6fa('0xb'),auth[_0xd6fa('0x8')](),controller[_0xd6fa('0xf')]);router[_0xd6fa('0x10')](_0xd6fa('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xd6fa('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 0c83555..90e4cab 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 _0x80e0=['STRING','TEXT','sequelize','exports'];(function(_0x879adf,_0x2cabc2){var _0x555764=function(_0x363a90){while(--_0x363a90){_0x879adf['push'](_0x879adf['shift']());}};_0x555764(++_0x2cabc2);}(_0x80e0,0xc6));var _0x080e=function(_0x2c8701,_0x2a77c2){_0x2c8701=_0x2c8701-0x0;var _0x2eb819=_0x80e0[_0x2c8701];return _0x2eb819;};'use strict';var Sequelize=require(_0x080e('0x0'));module[_0x080e('0x1')]={'name':{'type':Sequelize[_0x080e('0x2')]},'description':{'type':Sequelize[_0x080e('0x2')]},'html':{'type':Sequelize[_0x080e('0x3')]}}; \ No newline at end of file +var _0xe38c=['sequelize','STRING','TEXT'];(function(_0x5ab1c3,_0x4e98cd){var _0x9b30ec=function(_0x56049a){while(--_0x56049a){_0x5ab1c3['push'](_0x5ab1c3['shift']());}};_0x9b30ec(++_0x4e98cd);}(_0xe38c,0x117));var _0xce38=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe38c[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xce38('0x0'));module['exports']={'name':{'type':Sequelize[_0xce38('0x1')]},'description':{'type':Sequelize[_0xce38('0x1')]},'html':{'type':Sequelize[_0xce38('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 6c25305..e7531da 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 _0xd2ae=['../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','save','update','then','destroy','get','Templates','UserProfileResource','error','name','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x4ec1ed,_0xcd8e65){var _0x28d025=function(_0x24be47){while(--_0x24be47){_0x4ec1ed['push'](_0x4ec1ed['shift']());}};_0x28d025(++_0xcd8e65);}(_0xd2ae,0x1e3));var _0xed2a=function(_0x4390f7,_0x38b36f){_0x4390f7=_0x4390f7-0x0;var _0x322888=_0xd2ae[_0x4390f7];return _0x322888;};'use strict';var emlformat=require(_0xed2a('0x0'));var rimraf=require(_0xed2a('0x1'));var zipdir=require(_0xed2a('0x2'));var jsonpatch=require(_0xed2a('0x3'));var rp=require(_0xed2a('0x4'));var moment=require(_0xed2a('0x5'));var BPromise=require(_0xed2a('0x6'));var Mustache=require(_0xed2a('0x7'));var util=require(_0xed2a('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xed2a('0x9'));var ejs=require(_0xed2a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed2a('0xb'));var squel=require(_0xed2a('0xc'));var crypto=require(_0xed2a('0xd'));var jsforce=require(_0xed2a('0xe'));var deskjs=require(_0xed2a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xed2a('0x10'));var Papa=require(_0xed2a('0x11'));var Redis=require(_0xed2a('0x12'));var authService=require(_0xed2a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xed2a('0x14'));var hardwareService=require(_0xed2a('0x15'));var logger=require(_0xed2a('0x16'))(_0xed2a('0x17'));var utils=require(_0xed2a('0x18'));var config=require(_0xed2a('0x19'));var licenseUtil=require(_0xed2a('0x1a'));var db=require(_0xed2a('0x1b'))['db'];function respondWithStatusCode(_0x5f3779,_0x3b6be4){_0x3b6be4=_0x3b6be4||0xcc;return function(_0x5b9f09){if(_0x5b9f09){return _0x5f3779[_0xed2a('0x1c')](_0x3b6be4);}return _0x5f3779['status'](_0x3b6be4)[_0xed2a('0x1d')]();};}function respondWithResult(_0x27a9d0,_0x13e33c){_0x13e33c=_0x13e33c||0xc8;return function(_0x498599){if(_0x498599){return _0x27a9d0[_0xed2a('0x1e')](_0x13e33c)[_0xed2a('0x1f')](_0x498599);}};}function respondWithFilteredResult(_0x565e09,_0x50ea05){return function(_0x5a48fd){if(_0x5a48fd){var _0x1ca3d1=typeof _0x50ea05[_0xed2a('0x20')]===_0xed2a('0x21')&&typeof _0x50ea05[_0xed2a('0x22')]===_0xed2a('0x21');var _0x3d1f74=_0x5a48fd[_0xed2a('0x23')];var _0x1aab2e=_0x1ca3d1?0x0:_0x50ea05[_0xed2a('0x20')];var _0x5ccb42=_0x1ca3d1?_0x5a48fd[_0xed2a('0x23')]:_0x50ea05[_0xed2a('0x20')]+_0x50ea05[_0xed2a('0x22')];var _0x4a2bd1;if(_0x5ccb42>=_0x3d1f74){_0x5ccb42=_0x3d1f74;_0x4a2bd1=0xc8;}else{_0x4a2bd1=0xce;}_0x565e09[_0xed2a('0x1e')](_0x4a2bd1);return _0x565e09['set']('Content-Range',_0x1aab2e+'-'+_0x5ccb42+'/'+_0x3d1f74)[_0xed2a('0x1f')](_0x5a48fd);}return null;};}function patchUpdates(_0x2605af){return function(_0x52df2b){try{jsonpatch[_0xed2a('0x24')](_0x52df2b,_0x2605af,!![]);}catch(_0x2afc66){return BPromise['reject'](_0x2afc66);}return _0x52df2b[_0xed2a('0x25')]();};}function saveUpdates(_0x33133a,_0x8359ca){return function(_0x1ad03e){if(_0x1ad03e){return _0x1ad03e[_0xed2a('0x26')](_0x33133a)[_0xed2a('0x27')](function(_0x4816b8){return _0x4816b8;});}return null;};}function removeEntity(_0x34d019,_0x146951){return function(_0x32e339){if(_0x32e339){return _0x32e339[_0xed2a('0x28')]()[_0xed2a('0x27')](function(){var _0x190ea1=_0x32e339[_0xed2a('0x29')]({'plain':!![]});var _0x359e97=_0xed2a('0x2a');return db[_0xed2a('0x2b')][_0xed2a('0x28')]({'where':{'type':_0x359e97,'resourceId':_0x190ea1['id']}})['then'](function(){return _0x32e339;});})[_0xed2a('0x27')](function(){_0x34d019[_0xed2a('0x1e')](0xcc)[_0xed2a('0x1d')]();});}};}function handleEntityNotFound(_0x53af1d,_0x30c58a){return function(_0x3630c6){if(!_0x3630c6){_0x53af1d['sendStatus'](0x194);}return _0x3630c6;};}function handleError(_0x560994,_0x2bb620){_0x2bb620=_0x2bb620||0x1f4;return function(_0x3b81f9){logger[_0xed2a('0x2c')](_0x3b81f9['stack']);if(_0x3b81f9[_0xed2a('0x2d')]){delete _0x3b81f9[_0xed2a('0x2d')];}_0x560994[_0xed2a('0x1e')](_0x2bb620)['send'](_0x3b81f9);};}exports[_0xed2a('0x2e')]=function(_0x555108,_0xad0d8){var _0x52fae8={},_0x44901f={},_0x57de00={'count':0x0,'rows':[]};var _0x198242=_[_0xed2a('0x2f')](db[_0xed2a('0x30')][_0xed2a('0x31')],function(_0x13524c){return{'name':_0x13524c[_0xed2a('0x32')],'type':_0x13524c[_0xed2a('0x33')][_0xed2a('0x34')]};});_0x44901f[_0xed2a('0x35')]=_['map'](_0x198242,'name');_0x44901f[_0xed2a('0x36')]=_[_0xed2a('0x37')](_0x555108[_0xed2a('0x36')]);_0x44901f[_0xed2a('0x38')]=_[_0xed2a('0x39')](_0x44901f['model'],_0x44901f[_0xed2a('0x36')]);_0x52fae8['attributes']=_[_0xed2a('0x39')](_0x44901f[_0xed2a('0x35')],qs[_0xed2a('0x3a')](_0x555108[_0xed2a('0x36')][_0xed2a('0x3a')]));_0x52fae8[_0xed2a('0x3b')]=_0x52fae8[_0xed2a('0x3b')]['length']?_0x52fae8['attributes']:_0x44901f['model'];if(!_0x555108[_0xed2a('0x36')][_0xed2a('0x3c')](_0xed2a('0x3d'))){_0x52fae8[_0xed2a('0x22')]=qs['limit'](_0x555108[_0xed2a('0x36')][_0xed2a('0x22')]);_0x52fae8[_0xed2a('0x20')]=qs[_0xed2a('0x20')](_0x555108[_0xed2a('0x36')]['offset']);}_0x52fae8[_0xed2a('0x3e')]=qs[_0xed2a('0x3f')](_0x555108[_0xed2a('0x36')][_0xed2a('0x3f')]);_0x52fae8[_0xed2a('0x40')]=qs[_0xed2a('0x38')](_['pick'](_0x555108[_0xed2a('0x36')],_0x44901f[_0xed2a('0x38')]),_0x198242);if(_0x555108[_0xed2a('0x36')][_0xed2a('0x41')]){_0x52fae8['where']=_[_0xed2a('0x42')](_0x52fae8['where'],{'$or':_['map'](_0x198242,function(_0x50a830){if(_0x50a830[_0xed2a('0x33')]!==_0xed2a('0x43')){var _0x3d19e5={};_0x3d19e5[_0x50a830[_0xed2a('0x2d')]]={'$like':'%'+_0x555108[_0xed2a('0x36')][_0xed2a('0x41')]+'%'};return _0x3d19e5;}})});}_0x52fae8=_[_0xed2a('0x42')]({},_0x52fae8,_0x555108[_0xed2a('0x44')]);var _0x132602={'where':_0x52fae8[_0xed2a('0x40')]};return db[_0xed2a('0x30')][_0xed2a('0x23')](_0x132602)[_0xed2a('0x27')](function(_0x4e8e37){_0x57de00[_0xed2a('0x23')]=_0x4e8e37;if(_0x555108[_0xed2a('0x36')]['includeAll']){_0x52fae8[_0xed2a('0x45')]=[{'all':!![]}];}return db[_0xed2a('0x30')][_0xed2a('0x46')](_0x52fae8);})[_0xed2a('0x27')](function(_0x5b571c){_0x57de00[_0xed2a('0x47')]=_0x5b571c;return _0x57de00;})[_0xed2a('0x27')](respondWithFilteredResult(_0xad0d8,_0x52fae8))[_0xed2a('0x48')](handleError(_0xad0d8,null));};exports[_0xed2a('0x49')]=function(_0x280230,_0x58b53c){var _0x48ead4={'raw':!![],'where':{'id':_0x280230[_0xed2a('0x4a')]['id']}},_0x527849={};_0x527849[_0xed2a('0x35')]=_[_0xed2a('0x37')](db[_0xed2a('0x30')]['rawAttributes']);_0x527849[_0xed2a('0x36')]=_['keys'](_0x280230[_0xed2a('0x36')]);_0x527849[_0xed2a('0x38')]=_[_0xed2a('0x39')](_0x527849['model'],_0x527849[_0xed2a('0x36')]);_0x48ead4['attributes']=_[_0xed2a('0x39')](_0x527849[_0xed2a('0x35')],qs[_0xed2a('0x3a')](_0x280230['query'][_0xed2a('0x3a')]));_0x48ead4[_0xed2a('0x3b')]=_0x48ead4[_0xed2a('0x3b')][_0xed2a('0x4b')]?_0x48ead4[_0xed2a('0x3b')]:_0x527849[_0xed2a('0x35')];if(_0x280230['query']['includeAll']){_0x48ead4[_0xed2a('0x45')]=[{'all':!![]}];}_0x48ead4=_[_0xed2a('0x42')]({},_0x48ead4,_0x280230[_0xed2a('0x44')]);return db['Template'][_0xed2a('0x4c')](_0x48ead4)['then'](handleEntityNotFound(_0x58b53c,null))[_0xed2a('0x27')](respondWithResult(_0x58b53c,null))['catch'](handleError(_0x58b53c,null));};exports[_0xed2a('0x4d')]=function(_0x3e4e98,_0x42c31f){return db[_0xed2a('0x30')][_0xed2a('0x4d')](_0x3e4e98['body'],{})[_0xed2a('0x27')](function(_0x570a7e){var _0x198e66=_0x3e4e98[_0xed2a('0x4e')]['get']({'plain':!![]});if(!_0x198e66)throw new Error(_0xed2a('0x4f'));if(_0x198e66[_0xed2a('0x50')]===_0xed2a('0x4e')){var _0x915bec=_0x570a7e['get']({'plain':!![]});var _0x490b73='Templates';return db[_0xed2a('0x51')]['find']({'where':{'name':_0x490b73,'userProfileId':_0x198e66['userProfileId']},'raw':!![]})[_0xed2a('0x27')](function(_0x1fd17a){if(_0x1fd17a&&_0x1fd17a[_0xed2a('0x52')]===0x0){return db[_0xed2a('0x2b')]['create']({'name':_0x915bec[_0xed2a('0x2d')],'resourceId':_0x915bec['id'],'type':_0x1fd17a[_0xed2a('0x2d')],'sectionId':_0x1fd17a['id']},{})[_0xed2a('0x27')](function(){return _0x570a7e;});}else{return _0x570a7e;}})[_0xed2a('0x48')](function(_0x4cf4b6){logger['error'](_0xed2a('0x53'),_0x4cf4b6);throw _0x4cf4b6;});}return _0x570a7e;})['then'](respondWithResult(_0x42c31f,0xc9))[_0xed2a('0x48')](handleError(_0x42c31f,null));};exports[_0xed2a('0x26')]=function(_0x3ecfed,_0x5b4da8){if(_0x3ecfed[_0xed2a('0x54')]['id']){delete _0x3ecfed[_0xed2a('0x54')]['id'];}return db['Template'][_0xed2a('0x4c')]({'where':{'id':_0x3ecfed[_0xed2a('0x4a')]['id']}})[_0xed2a('0x27')](handleEntityNotFound(_0x5b4da8,null))[_0xed2a('0x27')](saveUpdates(_0x3ecfed[_0xed2a('0x54')],null))[_0xed2a('0x27')](respondWithResult(_0x5b4da8,null))[_0xed2a('0x48')](handleError(_0x5b4da8,null));};exports[_0xed2a('0x28')]=function(_0x4d91a0,_0x21ab4b){return db['Template'][_0xed2a('0x4c')]({'where':{'id':_0x4d91a0[_0xed2a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x21ab4b,null))[_0xed2a('0x27')](removeEntity(_0x21ab4b,null))[_0xed2a('0x48')](handleError(_0x21ab4b,null));}; \ No newline at end of file +var _0x6af7=['fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','catch','show','params','intersection','length','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','end','sendStatus','stack','name','send','index','Template','rawAttributes'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x6af7,0x16b));var _0x76af=function(_0x24e1df,_0x6dcb19){_0x24e1df=_0x24e1df-0x0;var _0x514f79=_0x6af7[_0x24e1df];return _0x514f79;};'use strict';var emlformat=require(_0x76af('0x0'));var rimraf=require(_0x76af('0x1'));var zipdir=require(_0x76af('0x2'));var jsonpatch=require(_0x76af('0x3'));var rp=require(_0x76af('0x4'));var moment=require(_0x76af('0x5'));var BPromise=require(_0x76af('0x6'));var Mustache=require(_0x76af('0x7'));var util=require(_0x76af('0x8'));var path=require(_0x76af('0x9'));var sox=require(_0x76af('0xa'));var csv=require('to-csv');var ejs=require(_0x76af('0xb'));var fs=require('fs');var fs_extra=require(_0x76af('0xc'));var _=require(_0x76af('0xd'));var squel=require(_0x76af('0xe'));var crypto=require(_0x76af('0xf'));var jsforce=require(_0x76af('0x10'));var deskjs=require(_0x76af('0x11'));var toCsv=require(_0x76af('0x12'));var querystring=require(_0x76af('0x13'));var Papa=require(_0x76af('0x14'));var Redis=require(_0x76af('0x15'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x76af('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x76af('0x17'));var utils=require(_0x76af('0x18'));var config=require(_0x76af('0x19'));var licenseUtil=require(_0x76af('0x1a'));var db=require(_0x76af('0x1b'))['db'];function respondWithStatusCode(_0x40b186,_0x208d59){_0x208d59=_0x208d59||0xcc;return function(_0x3fe878){if(_0x3fe878){return _0x40b186['sendStatus'](_0x208d59);}return _0x40b186[_0x76af('0x1c')](_0x208d59)['end']();};}function respondWithResult(_0x45d7df,_0x4ce90c){_0x4ce90c=_0x4ce90c||0xc8;return function(_0x782174){if(_0x782174){return _0x45d7df['status'](_0x4ce90c)[_0x76af('0x1d')](_0x782174);}};}function respondWithFilteredResult(_0x50fb87,_0x42cf17){return function(_0x4c4de0){if(_0x4c4de0){var _0x415ce9=typeof _0x42cf17[_0x76af('0x1e')]===_0x76af('0x1f')&&typeof _0x42cf17[_0x76af('0x20')]===_0x76af('0x1f');var _0x2d5155=_0x4c4de0[_0x76af('0x21')];var _0x185903=_0x415ce9?0x0:_0x42cf17[_0x76af('0x1e')];var _0x101e53=_0x415ce9?_0x4c4de0[_0x76af('0x21')]:_0x42cf17['offset']+_0x42cf17[_0x76af('0x20')];var _0x12078e;if(_0x101e53>=_0x2d5155){_0x101e53=_0x2d5155;_0x12078e=0xc8;}else{_0x12078e=0xce;}_0x50fb87['status'](_0x12078e);return _0x50fb87[_0x76af('0x22')](_0x76af('0x23'),_0x185903+'-'+_0x101e53+'/'+_0x2d5155)['json'](_0x4c4de0);}return null;};}function patchUpdates(_0xc25cee){return function(_0x4c8fba){try{jsonpatch[_0x76af('0x24')](_0x4c8fba,_0xc25cee,!![]);}catch(_0x4a2831){return BPromise[_0x76af('0x25')](_0x4a2831);}return _0x4c8fba[_0x76af('0x26')]();};}function saveUpdates(_0x3efe7b,_0x44a81b){return function(_0x2aded7){if(_0x2aded7){return _0x2aded7[_0x76af('0x27')](_0x3efe7b)[_0x76af('0x28')](function(_0x1b5997){return _0x1b5997;});}return null;};}function removeEntity(_0x4e830e,_0x1ae41f){return function(_0x154388){if(_0x154388){return _0x154388[_0x76af('0x29')]()[_0x76af('0x28')](function(){var _0x443172=_0x154388[_0x76af('0x2a')]({'plain':!![]});var _0x47128d=_0x76af('0x2b');return db['UserProfileResource'][_0x76af('0x29')]({'where':{'type':_0x47128d,'resourceId':_0x443172['id']}})[_0x76af('0x28')](function(){return _0x154388;});})[_0x76af('0x28')](function(){_0x4e830e[_0x76af('0x1c')](0xcc)[_0x76af('0x2c')]();});}};}function handleEntityNotFound(_0x2a8aaa,_0x3e3b6b){return function(_0x364518){if(!_0x364518){_0x2a8aaa[_0x76af('0x2d')](0x194);}return _0x364518;};}function handleError(_0x32d1ee,_0x36ecc7){_0x36ecc7=_0x36ecc7||0x1f4;return function(_0x269255){logger['error'](_0x269255[_0x76af('0x2e')]);if(_0x269255[_0x76af('0x2f')]){delete _0x269255[_0x76af('0x2f')];}_0x32d1ee[_0x76af('0x1c')](_0x36ecc7)[_0x76af('0x30')](_0x269255);};}exports[_0x76af('0x31')]=function(_0x40fd6c,_0x4e83ce){var _0x48a695={},_0x3f49c6={},_0x6335ec={'count':0x0,'rows':[]};var _0x16002a=_['map'](db[_0x76af('0x32')][_0x76af('0x33')],function(_0x4c581e){return{'name':_0x4c581e[_0x76af('0x34')],'type':_0x4c581e[_0x76af('0x35')][_0x76af('0x36')]};});_0x3f49c6[_0x76af('0x37')]=_['map'](_0x16002a,'name');_0x3f49c6[_0x76af('0x38')]=_[_0x76af('0x39')](_0x40fd6c['query']);_0x3f49c6[_0x76af('0x3a')]=_['intersection'](_0x3f49c6[_0x76af('0x37')],_0x3f49c6[_0x76af('0x38')]);_0x48a695[_0x76af('0x3b')]=_['intersection'](_0x3f49c6[_0x76af('0x37')],qs[_0x76af('0x3c')](_0x40fd6c[_0x76af('0x38')][_0x76af('0x3c')]));_0x48a695[_0x76af('0x3b')]=_0x48a695[_0x76af('0x3b')]['length']?_0x48a695['attributes']:_0x3f49c6[_0x76af('0x37')];if(!_0x40fd6c['query'][_0x76af('0x3d')](_0x76af('0x3e'))){_0x48a695[_0x76af('0x20')]=qs[_0x76af('0x20')](_0x40fd6c[_0x76af('0x38')][_0x76af('0x20')]);_0x48a695[_0x76af('0x1e')]=qs[_0x76af('0x1e')](_0x40fd6c[_0x76af('0x38')]['offset']);}_0x48a695[_0x76af('0x3f')]=qs[_0x76af('0x40')](_0x40fd6c[_0x76af('0x38')][_0x76af('0x40')]);_0x48a695[_0x76af('0x41')]=qs[_0x76af('0x3a')](_['pick'](_0x40fd6c[_0x76af('0x38')],_0x3f49c6[_0x76af('0x3a')]),_0x16002a);if(_0x40fd6c[_0x76af('0x38')][_0x76af('0x42')]){_0x48a695['where']=_[_0x76af('0x43')](_0x48a695['where'],{'$or':_[_0x76af('0x44')](_0x16002a,function(_0x309159){if(_0x309159[_0x76af('0x35')]!==_0x76af('0x45')){var _0x11a1ec={};_0x11a1ec[_0x309159[_0x76af('0x2f')]]={'$like':'%'+_0x40fd6c[_0x76af('0x38')][_0x76af('0x42')]+'%'};return _0x11a1ec;}})});}_0x48a695=_['merge']({},_0x48a695,_0x40fd6c[_0x76af('0x46')]);var _0x462a8a={'where':_0x48a695[_0x76af('0x41')]};return db[_0x76af('0x32')][_0x76af('0x21')](_0x462a8a)['then'](function(_0x4d53e0){_0x6335ec[_0x76af('0x21')]=_0x4d53e0;if(_0x40fd6c[_0x76af('0x38')][_0x76af('0x47')]){_0x48a695['include']=[{'all':!![]}];}return db[_0x76af('0x32')]['findAll'](_0x48a695);})[_0x76af('0x28')](function(_0x518fc3){_0x6335ec['rows']=_0x518fc3;return _0x6335ec;})['then'](respondWithFilteredResult(_0x4e83ce,_0x48a695))[_0x76af('0x48')](handleError(_0x4e83ce,null));};exports[_0x76af('0x49')]=function(_0x26d855,_0x117aa2){var _0x276360={'raw':!![],'where':{'id':_0x26d855[_0x76af('0x4a')]['id']}},_0x3ffb51={};_0x3ffb51['model']=_[_0x76af('0x39')](db['Template'][_0x76af('0x33')]);_0x3ffb51[_0x76af('0x38')]=_[_0x76af('0x39')](_0x26d855[_0x76af('0x38')]);_0x3ffb51[_0x76af('0x3a')]=_['intersection'](_0x3ffb51[_0x76af('0x37')],_0x3ffb51[_0x76af('0x38')]);_0x276360['attributes']=_[_0x76af('0x4b')](_0x3ffb51[_0x76af('0x37')],qs['fields'](_0x26d855[_0x76af('0x38')][_0x76af('0x3c')]));_0x276360[_0x76af('0x3b')]=_0x276360[_0x76af('0x3b')][_0x76af('0x4c')]?_0x276360[_0x76af('0x3b')]:_0x3ffb51[_0x76af('0x37')];if(_0x26d855[_0x76af('0x38')]['includeAll']){_0x276360['include']=[{'all':!![]}];}_0x276360=_['merge']({},_0x276360,_0x26d855[_0x76af('0x46')]);return db['Template']['find'](_0x276360)[_0x76af('0x28')](handleEntityNotFound(_0x117aa2,null))[_0x76af('0x28')](respondWithResult(_0x117aa2,null))[_0x76af('0x48')](handleError(_0x117aa2,null));};exports['create']=function(_0x87cdc,_0x55da6a){return db[_0x76af('0x32')]['create'](_0x87cdc[_0x76af('0x4d')],{})['then'](function(_0x2b7e01){var _0x2f8493=_0x87cdc[_0x76af('0x4e')][_0x76af('0x2a')]({'plain':!![]});if(!_0x2f8493)throw new Error(_0x76af('0x4f'));if(_0x2f8493['role']===_0x76af('0x4e')){var _0x120340=_0x2b7e01['get']({'plain':!![]});var _0x2ed9a1=_0x76af('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x2ed9a1,'userProfileId':_0x2f8493['userProfileId']},'raw':!![]})[_0x76af('0x28')](function(_0x22911a){if(_0x22911a&&_0x22911a[_0x76af('0x50')]===0x0){return db['UserProfileResource'][_0x76af('0x51')]({'name':_0x120340[_0x76af('0x2f')],'resourceId':_0x120340['id'],'type':_0x22911a[_0x76af('0x2f')],'sectionId':_0x22911a['id']},{})[_0x76af('0x28')](function(){return _0x2b7e01;});}else{return _0x2b7e01;}})[_0x76af('0x48')](function(_0x427c98){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x427c98);throw _0x427c98;});}return _0x2b7e01;})[_0x76af('0x28')](respondWithResult(_0x55da6a,0xc9))[_0x76af('0x48')](handleError(_0x55da6a,null));};exports[_0x76af('0x27')]=function(_0x58b641,_0x1378cf){if(_0x58b641[_0x76af('0x4d')]['id']){delete _0x58b641[_0x76af('0x4d')]['id'];}return db['Template'][_0x76af('0x52')]({'where':{'id':_0x58b641[_0x76af('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1378cf,null))[_0x76af('0x28')](saveUpdates(_0x58b641[_0x76af('0x4d')],null))[_0x76af('0x28')](respondWithResult(_0x1378cf,null))['catch'](handleError(_0x1378cf,null));};exports[_0x76af('0x29')]=function(_0x55791a,_0x5d6813){return db['Template'][_0x76af('0x52')]({'where':{'id':_0x55791a[_0x76af('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5d6813,null))['then'](removeEntity(_0x5d6813,null))[_0x76af('0x48')](handleError(_0x5d6813,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 086aa9e..102630a 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 _0x7b61=['bluebird','request-promise','rimraf','exports','define','Template','api','moment'];(function(_0x178ee0,_0x5aaf37){var _0x810fbc=function(_0x4531b5){while(--_0x4531b5){_0x178ee0['push'](_0x178ee0['shift']());}};_0x810fbc(++_0x5aaf37);}(_0x7b61,0x19e));var _0x17b6=function(_0x47ea5c,_0x102c93){_0x47ea5c=_0x47ea5c-0x0;var _0x343984=_0x7b61[_0x47ea5c];return _0x343984;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x17b6('0x0'));var moment=require(_0x17b6('0x1'));var BPromise=require(_0x17b6('0x2'));var rp=require(_0x17b6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17b6('0x4'));var config=require('../../config/environment');var attributes=require('./template.attributes');module[_0x17b6('0x5')]=function(_0x4eeec9,_0x48eef2){return _0x4eeec9[_0x17b6('0x6')](_0x17b6('0x7'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87a8=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','Template','tools_templates'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x87a8,0x190));var _0x887a=function(_0x997222,_0x5c0bd8){_0x997222=_0x997222-0x0;var _0x4b8869=_0x87a8[_0x997222];return _0x4b8869;};'use strict';var _=require('lodash');var util=require(_0x887a('0x0'));var logger=require(_0x887a('0x1'))(_0x887a('0x2'));var moment=require(_0x887a('0x3'));var BPromise=require(_0x887a('0x4'));var rp=require(_0x887a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x887a('0x6'));var config=require('../../config/environment');var attributes=require('./template.attributes');module[_0x887a('0x7')]=function(_0x27049d,_0x4412b7){return _0x27049d['define'](_0x887a('0x8'),attributes,{'tableName':_0x887a('0x9'),'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 87c2327..0033dfc 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 _0xcb8e=['Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetTemplate','findAll','options','raw','include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x490e61,_0x7f848e){var _0x169bc6=function(_0x1c70bf){while(--_0x1c70bf){_0x490e61['push'](_0x490e61['shift']());}};_0x169bc6(++_0x7f848e);}(_0xcb8e,0x1f3));var _0xecb8=function(_0x357698,_0x44b336){_0x357698=_0x357698-0x0;var _0x39d121=_0xcb8e[_0x357698];return _0x39d121;};'use strict';var _=require(_0xecb8('0x0'));var util=require('util');var moment=require(_0xecb8('0x1'));var BPromise=require(_0xecb8('0x2'));var rs=require(_0xecb8('0x3'));var fs=require('fs');var Redis=require(_0xecb8('0x4'));var db=require(_0xecb8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xecb8('0x6'))(_0xecb8('0x7'));var config=require('../../config/environment');var jayson=require(_0xecb8('0x8'));var client=jayson[_0xecb8('0x9')][_0xecb8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2875a9,_0x1a2c13,_0x17afab){return new BPromise(function(_0x48d1d4,_0x518b8f){return client[_0xecb8('0xb')](_0x2875a9,_0x17afab)[_0xecb8('0xc')](function(_0x5740d0){logger['info'](_0xecb8('0xd'),_0x1a2c13,_0xecb8('0xe'));logger[_0xecb8('0xf')](_0xecb8('0x10'),_0x1a2c13,_0xecb8('0xe'),JSON[_0xecb8('0x11')](_0x5740d0));if(_0x5740d0[_0xecb8('0x12')]){if(_0x5740d0[_0xecb8('0x12')][_0xecb8('0x13')]===0x1f4){logger[_0xecb8('0x12')]('Template,\x20%s,\x20%s',_0x1a2c13,_0x5740d0[_0xecb8('0x12')][_0xecb8('0x14')]);return _0x518b8f(_0x5740d0[_0xecb8('0x12')]['message']);}logger['error'](_0xecb8('0xd'),_0x1a2c13,_0x5740d0['error'][_0xecb8('0x14')]);return _0x48d1d4(_0x5740d0[_0xecb8('0x12')][_0xecb8('0x14')]);}else{logger[_0xecb8('0x15')](_0xecb8('0xd'),_0x1a2c13,'request\x20sent');_0x48d1d4(_0x5740d0[_0xecb8('0x16')][_0xecb8('0x14')]);}})[_0xecb8('0x17')](function(_0x412362){logger[_0xecb8('0x12')](_0xecb8('0xd'),_0x1a2c13,_0x412362);_0x518b8f(_0x412362);});});}exports[_0xecb8('0x18')]=function(_0xea478a){var _0x5988e6=this;return new Promise(function(_0x163ca3,_0x5d4911){return db['Template'][_0xecb8('0x19')]({'raw':_0xea478a[_0xecb8('0x1a')]?_0xea478a['options'][_0xecb8('0x1b')]===undefined?!![]:![]:!![],'where':_0xea478a['options']?_0xea478a[_0xecb8('0x1a')]['where']||null:null,'attributes':_0xea478a[_0xecb8('0x1a')]?_0xea478a['options']['attributes']||null:null,'limit':_0xea478a['options']?_0xea478a[_0xecb8('0x1a')]['limit']||null:null,'include':_0xea478a[_0xecb8('0x1a')]?_0xea478a[_0xecb8('0x1a')]['include']?_['map'](_0xea478a[_0xecb8('0x1a')][_0xecb8('0x1c')],function(_0xf32cbc){return{'model':db[_0xf32cbc[_0xecb8('0x1d')]],'as':_0xf32cbc['as'],'attributes':_0xf32cbc['attributes'],'include':_0xf32cbc[_0xecb8('0x1c')]?_['map'](_0xf32cbc['include'],function(_0x23b4ca){return{'model':db[_0x23b4ca[_0xecb8('0x1d')]],'as':_0x23b4ca['as'],'attributes':_0x23b4ca[_0xecb8('0x1e')],'include':_0x23b4ca['include']?_[_0xecb8('0x1f')](_0x23b4ca[_0xecb8('0x1c')],function(_0xade894){return{'model':db[_0xade894[_0xecb8('0x1d')]],'as':_0xade894['as'],'attributes':_0xade894['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x538227){logger[_0xecb8('0x15')](_0xecb8('0x18'),_0xea478a);logger[_0xecb8('0xf')](_0xecb8('0x18'),_0xea478a,JSON[_0xecb8('0x11')](_0x538227));_0x163ca3(_0x538227);})[_0xecb8('0x17')](function(_0x42c5ee){logger[_0xecb8('0x12')](_0xecb8('0x18'),_0x42c5ee[_0xecb8('0x14')],_0xea478a);_0x5d4911(_0x5988e6[_0xecb8('0x12')](0x1f4,_0x42c5ee[_0xecb8('0x14')]));});});}; \ No newline at end of file +var _0xc0a6=['attributes','include','map','debug','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','error','code','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','Template','findAll','options','raw','limit','model'];(function(_0x14911e,_0x578e33){var _0x46ed87=function(_0x315ad6){while(--_0x315ad6){_0x14911e['push'](_0x14911e['shift']());}};_0x46ed87(++_0x578e33);}(_0xc0a6,0xcb));var _0x6c0a=function(_0x3f9a09,_0x59befb){_0x3f9a09=_0x3f9a09-0x0;var _0xe1b0c1=_0xc0a6[_0x3f9a09];return _0xe1b0c1;};'use strict';var _=require(_0x6c0a('0x0'));var util=require(_0x6c0a('0x1'));var moment=require('moment');var BPromise=require(_0x6c0a('0x2'));var rs=require(_0x6c0a('0x3'));var fs=require('fs');var Redis=require(_0x6c0a('0x4'));var db=require(_0x6c0a('0x5'))['db'];var utils=require(_0x6c0a('0x6'));var logger=require(_0x6c0a('0x7'))(_0x6c0a('0x8'));var config=require(_0x6c0a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6c0a('0xa')][_0x6c0a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x416ceb,_0x415ded,_0x48695b){return new BPromise(function(_0x344873,_0x40098b){return client['request'](_0x416ceb,_0x48695b)[_0x6c0a('0xc')](function(_0x4f133c){logger[_0x6c0a('0xd')]('Template,\x20%s,\x20%s',_0x415ded,'request\x20sent');logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x415ded,_0x6c0a('0xe'),JSON['stringify'](_0x4f133c));if(_0x4f133c[_0x6c0a('0xf')]){if(_0x4f133c[_0x6c0a('0xf')][_0x6c0a('0x10')]===0x1f4){logger['error'](_0x6c0a('0x11'),_0x415ded,_0x4f133c[_0x6c0a('0xf')][_0x6c0a('0x12')]);return _0x40098b(_0x4f133c[_0x6c0a('0xf')][_0x6c0a('0x12')]);}logger[_0x6c0a('0xf')]('Template,\x20%s,\x20%s',_0x415ded,_0x4f133c[_0x6c0a('0xf')][_0x6c0a('0x12')]);return _0x344873(_0x4f133c[_0x6c0a('0xf')][_0x6c0a('0x12')]);}else{logger[_0x6c0a('0xd')](_0x6c0a('0x11'),_0x415ded,_0x6c0a('0xe'));_0x344873(_0x4f133c[_0x6c0a('0x13')][_0x6c0a('0x12')]);}})[_0x6c0a('0x14')](function(_0x140803){logger[_0x6c0a('0xf')]('Template,\x20%s,\x20%s',_0x415ded,_0x140803);_0x40098b(_0x140803);});});}exports[_0x6c0a('0x15')]=function(_0x373988){var _0x394b67=this;return new Promise(function(_0x3038d8,_0x20c261){return db[_0x6c0a('0x16')][_0x6c0a('0x17')]({'raw':_0x373988[_0x6c0a('0x18')]?_0x373988['options'][_0x6c0a('0x19')]===undefined?!![]:![]:!![],'where':_0x373988[_0x6c0a('0x18')]?_0x373988['options']['where']||null:null,'attributes':_0x373988[_0x6c0a('0x18')]?_0x373988[_0x6c0a('0x18')]['attributes']||null:null,'limit':_0x373988['options']?_0x373988[_0x6c0a('0x18')][_0x6c0a('0x1a')]||null:null,'include':_0x373988[_0x6c0a('0x18')]?_0x373988[_0x6c0a('0x18')]['include']?_['map'](_0x373988[_0x6c0a('0x18')]['include'],function(_0x307fbb){return{'model':db[_0x307fbb[_0x6c0a('0x1b')]],'as':_0x307fbb['as'],'attributes':_0x307fbb[_0x6c0a('0x1c')],'include':_0x307fbb[_0x6c0a('0x1d')]?_[_0x6c0a('0x1e')](_0x307fbb[_0x6c0a('0x1d')],function(_0x39745b){return{'model':db[_0x39745b[_0x6c0a('0x1b')]],'as':_0x39745b['as'],'attributes':_0x39745b[_0x6c0a('0x1c')],'include':_0x39745b['include']?_[_0x6c0a('0x1e')](_0x39745b[_0x6c0a('0x1d')],function(_0xb8170b){return{'model':db[_0xb8170b[_0x6c0a('0x1b')]],'as':_0xb8170b['as'],'attributes':_0xb8170b[_0x6c0a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6c0a('0xc')](function(_0x3b27be){logger[_0x6c0a('0xd')](_0x6c0a('0x15'),_0x373988);logger[_0x6c0a('0x1f')](_0x6c0a('0x15'),_0x373988,JSON[_0x6c0a('0x20')](_0x3b27be));_0x3038d8(_0x3b27be);})[_0x6c0a('0x14')](function(_0x25e860){logger[_0x6c0a('0xf')]('GetTemplate',_0x25e860['message'],_0x373988);_0x20c261(_0x394b67['error'](0x1f4,_0x25e860[_0x6c0a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index c4b911c..c5d5b6d 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 _0xf164=['getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','put','/:id','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id/all_conditions','getAllConditions','/:id/actions'];(function(_0x48fd96,_0x1c93fc){var _0x46fd68=function(_0x594286){while(--_0x594286){_0x48fd96['push'](_0x48fd96['shift']());}};_0x46fd68(++_0x1c93fc);}(_0xf164,0xcb));var _0x4f16=function(_0x3a5df2,_0x2b5517){_0x3a5df2=_0x3a5df2-0x0;var _0x3a65b6=_0xf164[_0x3a5df2];return _0x3a65b6;};'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('./trigger.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/any_conditions',auth['isAuthenticated'](),controller['getAnyConditions']);router[_0x4f16('0x7')](_0x4f16('0xc'),auth['isAuthenticated'](),controller[_0x4f16('0xd')]);router[_0x4f16('0xe')]('/',auth[_0x4f16('0x8')](),controller[_0x4f16('0xf')]);router['post']('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x4f16('0x10')]);router['post'](_0x4f16('0x11'),auth['isAuthenticated'](),controller[_0x4f16('0x12')]);router[_0x4f16('0xe')]('/:id/actions',auth['isAuthenticated'](),controller[_0x4f16('0x13')]);router[_0x4f16('0x14')](_0x4f16('0x15'),auth['isAuthenticated'](),controller[_0x4f16('0x16')]);router['delete'](_0x4f16('0x15'),auth[_0x4f16('0x8')](),controller['destroy']);module[_0x4f16('0x17')]=router; \ No newline at end of file +var _0x7d26=['delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','getAnyConditions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','/:id/actions','addAction','put'];(function(_0x256f90,_0x2187a6){var _0x415016=function(_0x43fcd6){while(--_0x43fcd6){_0x256f90['push'](_0x256f90['shift']());}};_0x415016(++_0x2187a6);}(_0x7d26,0x16f));var _0x67d2=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7d26[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require(_0x67d2('0x0'));var path=require('path');var timeout=require(_0x67d2('0x1'));var express=require(_0x67d2('0x2'));var router=express[_0x67d2('0x3')]();var fs_extra=require(_0x67d2('0x4'));var auth=require(_0x67d2('0x5'));var interaction=require(_0x67d2('0x6'));var config=require(_0x67d2('0x7'));var controller=require(_0x67d2('0x8'));router[_0x67d2('0x9')]('/',auth[_0x67d2('0xa')](),controller['index']);router[_0x67d2('0x9')](_0x67d2('0xb'),auth[_0x67d2('0xa')](),controller[_0x67d2('0xc')]);router[_0x67d2('0x9')](_0x67d2('0xd'),auth[_0x67d2('0xa')](),controller[_0x67d2('0xe')]);router[_0x67d2('0x9')]('/:id/any_conditions',auth[_0x67d2('0xa')](),controller[_0x67d2('0xf')]);router['get']('/:id/actions',auth[_0x67d2('0xa')](),controller[_0x67d2('0x10')]);router[_0x67d2('0x11')]('/',auth['isAuthenticated'](),controller[_0x67d2('0x12')]);router[_0x67d2('0x11')](_0x67d2('0xd'),auth[_0x67d2('0xa')](),controller[_0x67d2('0x13')]);router[_0x67d2('0x11')](_0x67d2('0x14'),auth[_0x67d2('0xa')](),controller[_0x67d2('0x15')]);router['post'](_0x67d2('0x16'),auth[_0x67d2('0xa')](),controller[_0x67d2('0x17')]);router[_0x67d2('0x18')](_0x67d2('0xb'),auth[_0x67d2('0xa')](),controller['update']);router[_0x67d2('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x67d2('0x1a')]);module[_0x67d2('0x1b')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index df2330d..1f74c1b 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 _0x104c=['STRING','BOOLEAN','sequelize','exports'];(function(_0x2a3e1f,_0x5043bf){var _0x11a940=function(_0x11c08c){while(--_0x11c08c){_0x2a3e1f['push'](_0x2a3e1f['shift']());}};_0x11a940(++_0x5043bf);}(_0x104c,0x1c2));var _0xc104=function(_0x1b1a36,_0x1254d9){_0x1b1a36=_0x1b1a36-0x0;var _0x18b5fd=_0x104c[_0x1b1a36];return _0x18b5fd;};'use strict';var Sequelize=require(_0xc104('0x0'));module[_0xc104('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc104('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xc104('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd4dd=['sequelize','exports','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd4dd,0x1b9));var _0xdd4d=function(_0x308100,_0xb8369c){_0x308100=_0x308100-0x0;var _0x3f0f1c=_0xd4dd[_0x308100];return _0x3f0f1c;};'use strict';var Sequelize=require(_0xdd4d('0x0'));module[_0xdd4d('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xdd4d('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index cb4c8f5..04124df 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 _0x8d28=['TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','Action','eml-format','rimraf','zip-dir','fast-json-patch','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','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','UserProfileResource','destroy','then','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','catch','show','params','keys','options','create','body','user','Triggers','find','autoAssociation','error','addAllCondition'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x8d28,0x10f));var _0x88d2=function(_0x2b626c,_0x5a00e2){_0x2b626c=_0x2b626c-0x0;var _0x4e61e8=_0x8d28[_0x2b626c];return _0x4e61e8;};'use strict';var emlformat=require(_0x88d2('0x0'));var rimraf=require(_0x88d2('0x1'));var zipdir=require(_0x88d2('0x2'));var jsonpatch=require(_0x88d2('0x3'));var rp=require('request-promise');var moment=require(_0x88d2('0x4'));var BPromise=require(_0x88d2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x88d2('0x6'));var sox=require(_0x88d2('0x7'));var csv=require(_0x88d2('0x8'));var ejs=require(_0x88d2('0x9'));var fs=require('fs');var fs_extra=require(_0x88d2('0xa'));var _=require('lodash');var squel=require(_0x88d2('0xb'));var crypto=require(_0x88d2('0xc'));var jsforce=require(_0x88d2('0xd'));var deskjs=require(_0x88d2('0xe'));var toCsv=require(_0x88d2('0x8'));var querystring=require(_0x88d2('0xf'));var Papa=require(_0x88d2('0x10'));var Redis=require(_0x88d2('0x11'));var authService=require(_0x88d2('0x12'));var qs=require(_0x88d2('0x13'));var as=require(_0x88d2('0x14'));var hardwareService=require(_0x88d2('0x15'));var logger=require(_0x88d2('0x16'))('api');var utils=require(_0x88d2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x88d2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6cbc19,_0x3f7b8a){_0x3f7b8a=_0x3f7b8a||0xcc;return function(_0x247360){if(_0x247360){return _0x6cbc19[_0x88d2('0x19')](_0x3f7b8a);}return _0x6cbc19[_0x88d2('0x1a')](_0x3f7b8a)[_0x88d2('0x1b')]();};}function respondWithResult(_0x17bb6f,_0xd805c8){_0xd805c8=_0xd805c8||0xc8;return function(_0x37dd8e){if(_0x37dd8e){return _0x17bb6f['status'](_0xd805c8)[_0x88d2('0x1c')](_0x37dd8e);}};}function respondWithFilteredResult(_0x2802b7,_0x5c69f2){return function(_0x1ef3dc){if(_0x1ef3dc){var _0x269bfb=typeof _0x5c69f2[_0x88d2('0x1d')]==='undefined'&&typeof _0x5c69f2['limit']===_0x88d2('0x1e');var _0x3452f6=_0x1ef3dc[_0x88d2('0x1f')];var _0x5c3464=_0x269bfb?0x0:_0x5c69f2[_0x88d2('0x1d')];var _0x1ee4ce=_0x269bfb?_0x1ef3dc['count']:_0x5c69f2['offset']+_0x5c69f2[_0x88d2('0x20')];var _0x485ee7;if(_0x1ee4ce>=_0x3452f6){_0x1ee4ce=_0x3452f6;_0x485ee7=0xc8;}else{_0x485ee7=0xce;}_0x2802b7[_0x88d2('0x1a')](_0x485ee7);return _0x2802b7[_0x88d2('0x21')](_0x88d2('0x22'),_0x5c3464+'-'+_0x1ee4ce+'/'+_0x3452f6)[_0x88d2('0x1c')](_0x1ef3dc);}return null;};}function patchUpdates(_0x22f2b4){return function(_0x5610e5){try{jsonpatch[_0x88d2('0x23')](_0x5610e5,_0x22f2b4,!![]);}catch(_0x14dbc3){return BPromise[_0x88d2('0x24')](_0x14dbc3);}return _0x5610e5['save']();};}function saveUpdates(_0x1dbeb6,_0x2c60b6){return function(_0x27c85d){if(_0x27c85d){return _0x27c85d[_0x88d2('0x25')](_0x1dbeb6)['then'](function(_0x1cfd80){return _0x1cfd80;});}return null;};}function removeEntity(_0x13e428,_0x1bcd00){return function(_0x11885b){if(_0x11885b){return _0x11885b['destroy']()['then'](function(){var _0x595ae0=_0x11885b['get']({'plain':!![]});var _0x16bf16='Triggers';return db[_0x88d2('0x26')][_0x88d2('0x27')]({'where':{'type':_0x16bf16,'resourceId':_0x595ae0['id']}})['then'](function(){return _0x11885b;});})[_0x88d2('0x28')](function(){_0x13e428[_0x88d2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19794a,_0x1e996b){return function(_0x55173d){if(!_0x55173d){_0x19794a[_0x88d2('0x19')](0x194);}return _0x55173d;};}function handleError(_0x1dbc14,_0x8e0fea){_0x8e0fea=_0x8e0fea||0x1f4;return function(_0x5b3ddb){logger['error'](_0x5b3ddb[_0x88d2('0x29')]);if(_0x5b3ddb[_0x88d2('0x2a')]){delete _0x5b3ddb[_0x88d2('0x2a')];}_0x1dbc14[_0x88d2('0x1a')](_0x8e0fea)[_0x88d2('0x2b')](_0x5b3ddb);};}exports[_0x88d2('0x2c')]=function(_0x271fde,_0x134989){var _0x4664a6={},_0x25867c={},_0x1e527a={'count':0x0,'rows':[]};var _0x21b4bf=_[_0x88d2('0x2d')](db[_0x88d2('0x2e')][_0x88d2('0x2f')],function(_0x22877a){return{'name':_0x22877a[_0x88d2('0x30')],'type':_0x22877a[_0x88d2('0x31')][_0x88d2('0x32')]};});_0x25867c['model']=_[_0x88d2('0x2d')](_0x21b4bf,_0x88d2('0x2a'));_0x25867c['query']=_['keys'](_0x271fde[_0x88d2('0x33')]);_0x25867c[_0x88d2('0x34')]=_['intersection'](_0x25867c['model'],_0x25867c['query']);_0x4664a6[_0x88d2('0x35')]=_[_0x88d2('0x36')](_0x25867c[_0x88d2('0x37')],qs[_0x88d2('0x38')](_0x271fde[_0x88d2('0x33')][_0x88d2('0x38')]));_0x4664a6[_0x88d2('0x35')]=_0x4664a6[_0x88d2('0x35')][_0x88d2('0x39')]?_0x4664a6[_0x88d2('0x35')]:_0x25867c[_0x88d2('0x37')];if(!_0x271fde[_0x88d2('0x33')][_0x88d2('0x3a')](_0x88d2('0x3b'))){_0x4664a6['limit']=qs[_0x88d2('0x20')](_0x271fde[_0x88d2('0x33')][_0x88d2('0x20')]);_0x4664a6['offset']=qs['offset'](_0x271fde[_0x88d2('0x33')][_0x88d2('0x1d')]);}_0x4664a6[_0x88d2('0x3c')]=qs['sort'](_0x271fde['query'][_0x88d2('0x3d')]);_0x4664a6[_0x88d2('0x3e')]=qs[_0x88d2('0x34')](_[_0x88d2('0x3f')](_0x271fde['query'],_0x25867c[_0x88d2('0x34')]),_0x21b4bf);if(_0x271fde[_0x88d2('0x33')][_0x88d2('0x40')]){_0x4664a6['where']=_[_0x88d2('0x41')](_0x4664a6['where'],{'$or':_[_0x88d2('0x2d')](_0x21b4bf,function(_0x2dcf92){if(_0x2dcf92['type']!==_0x88d2('0x42')){var _0x2aaa43={};_0x2aaa43[_0x2dcf92[_0x88d2('0x2a')]]={'$like':'%'+_0x271fde['query'][_0x88d2('0x40')]+'%'};return _0x2aaa43;}})});}_0x4664a6=_[_0x88d2('0x41')]({},_0x4664a6,_0x271fde['options']);var _0x206dc0={'where':_0x4664a6[_0x88d2('0x3e')]};return db[_0x88d2('0x2e')][_0x88d2('0x1f')](_0x206dc0)[_0x88d2('0x28')](function(_0x5e12e4){_0x1e527a[_0x88d2('0x1f')]=_0x5e12e4;if(_0x271fde[_0x88d2('0x33')][_0x88d2('0x43')]){_0x4664a6['include']=[{'all':!![]}];}return db[_0x88d2('0x2e')]['findAll'](_0x4664a6);})[_0x88d2('0x28')](function(_0x2396f4){_0x1e527a['rows']=_0x2396f4;return _0x1e527a;})[_0x88d2('0x28')](respondWithFilteredResult(_0x134989,_0x4664a6))[_0x88d2('0x44')](handleError(_0x134989,null));};exports[_0x88d2('0x45')]=function(_0x2b70d4,_0x1708e1){var _0x421bdd={'raw':![],'where':{'id':_0x2b70d4[_0x88d2('0x46')]['id']}},_0x158c35={};_0x158c35[_0x88d2('0x37')]=_[_0x88d2('0x47')](db[_0x88d2('0x2e')]['rawAttributes']);_0x158c35['query']=_[_0x88d2('0x47')](_0x2b70d4[_0x88d2('0x33')]);_0x158c35[_0x88d2('0x34')]=_[_0x88d2('0x36')](_0x158c35[_0x88d2('0x37')],_0x158c35['query']);_0x421bdd[_0x88d2('0x35')]=_[_0x88d2('0x36')](_0x158c35['model'],qs['fields'](_0x2b70d4[_0x88d2('0x33')][_0x88d2('0x38')]));_0x421bdd['attributes']=_0x421bdd[_0x88d2('0x35')][_0x88d2('0x39')]?_0x421bdd[_0x88d2('0x35')]:_0x158c35[_0x88d2('0x37')];if(_0x2b70d4[_0x88d2('0x33')][_0x88d2('0x43')]){_0x421bdd['include']=[{'all':!![]}];}_0x421bdd=_[_0x88d2('0x41')]({},_0x421bdd,_0x2b70d4[_0x88d2('0x48')]);return db[_0x88d2('0x2e')]['find'](_0x421bdd)[_0x88d2('0x28')](handleEntityNotFound(_0x1708e1,null))[_0x88d2('0x28')](respondWithResult(_0x1708e1,null))[_0x88d2('0x44')](handleError(_0x1708e1,null));};exports[_0x88d2('0x49')]=function(_0xcbf518,_0x4943ba){return db['Trigger'][_0x88d2('0x49')](_0xcbf518[_0x88d2('0x4a')],{})[_0x88d2('0x28')](function(_0x3fdc76){var _0x822485=_0xcbf518[_0x88d2('0x4b')]['get']({'plain':!![]});if(!_0x822485)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x822485['role']===_0x88d2('0x4b')){var _0x29b421=_0x3fdc76['get']({'plain':!![]});var _0x58ac13=_0x88d2('0x4c');return db['UserProfileSection'][_0x88d2('0x4d')]({'where':{'name':_0x58ac13,'userProfileId':_0x822485['userProfileId']},'raw':!![]})[_0x88d2('0x28')](function(_0x153e17){if(_0x153e17&&_0x153e17[_0x88d2('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x29b421[_0x88d2('0x2a')],'resourceId':_0x29b421['id'],'type':_0x153e17[_0x88d2('0x2a')],'sectionId':_0x153e17['id']},{})[_0x88d2('0x28')](function(){return _0x3fdc76;});}else{return _0x3fdc76;}})['catch'](function(_0xf38814){logger[_0x88d2('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf38814);throw _0xf38814;});}return _0x3fdc76;})[_0x88d2('0x28')](respondWithResult(_0x4943ba,0xc9))[_0x88d2('0x44')](handleError(_0x4943ba,null));};exports['update']=function(_0x16fb83,_0xc7cfbe){if(_0x16fb83[_0x88d2('0x4a')]['id']){delete _0x16fb83['body']['id'];}return db['Trigger'][_0x88d2('0x4d')]({'where':{'id':_0x16fb83[_0x88d2('0x46')]['id']}})[_0x88d2('0x28')](handleEntityNotFound(_0xc7cfbe,null))[_0x88d2('0x28')](saveUpdates(_0x16fb83[_0x88d2('0x4a')],null))['then'](respondWithResult(_0xc7cfbe,null))['catch'](handleError(_0xc7cfbe,null));};exports[_0x88d2('0x27')]=function(_0x43f37e,_0x2e4c8f){return db['Trigger']['find']({'where':{'id':_0x43f37e['params']['id']}})[_0x88d2('0x28')](handleEntityNotFound(_0x2e4c8f,null))[_0x88d2('0x28')](removeEntity(_0x2e4c8f,null))[_0x88d2('0x44')](handleError(_0x2e4c8f,null));};exports[_0x88d2('0x50')]=function(_0x2c689c,_0x457f3d,_0x17e859){if(_0x2c689c['body']['id']){delete _0x2c689c['body']['id'];}return db[_0x88d2('0x2e')][_0x88d2('0x4d')]({'where':{'id':_0x2c689c[_0x88d2('0x46')]['id']}})[_0x88d2('0x28')](handleEntityNotFound(_0x457f3d,null))[_0x88d2('0x28')](function(_0x209182){if(_0x209182){_0x2c689c[_0x88d2('0x4a')][_0x88d2('0x51')]=_0x209182['id'];return db[_0x88d2('0x52')][_0x88d2('0x49')](_0x2c689c['body']);}})[_0x88d2('0x28')](respondWithResult(_0x457f3d,null))[_0x88d2('0x44')](handleError(_0x457f3d,null));};exports['addAnyCondition']=function(_0x289165,_0x34b17d,_0x4d5562){if(_0x289165[_0x88d2('0x4a')]['id']){delete _0x289165[_0x88d2('0x4a')]['id'];}return db[_0x88d2('0x2e')][_0x88d2('0x4d')]({'where':{'id':_0x289165['params']['id']}})['then'](handleEntityNotFound(_0x34b17d,null))[_0x88d2('0x28')](function(_0x188355){if(_0x188355){_0x289165[_0x88d2('0x4a')][_0x88d2('0x53')]=_0x188355['id'];return db[_0x88d2('0x52')][_0x88d2('0x49')](_0x289165[_0x88d2('0x4a')]);}})[_0x88d2('0x28')](respondWithResult(_0x34b17d,null))[_0x88d2('0x44')](handleError(_0x34b17d,null));};exports[_0x88d2('0x54')]=function(_0x551fa7,_0x2065d8,_0x579c53){var _0x2487cb={};var _0x57cc2c={};var _0x43bb29;var _0x255f02;return db[_0x88d2('0x2e')][_0x88d2('0x55')]({'where':{'id':_0x551fa7[_0x88d2('0x46')]['id']}})[_0x88d2('0x28')](handleEntityNotFound(_0x2065d8,null))['then'](function(_0x165b4e){if(_0x165b4e){_0x43bb29=_0x165b4e;_0x57cc2c[_0x88d2('0x37')]=_['keys'](db[_0x88d2('0x52')][_0x88d2('0x2f')]);_0x57cc2c[_0x88d2('0x33')]=_[_0x88d2('0x47')](_0x551fa7['query']);_0x57cc2c[_0x88d2('0x34')]=_[_0x88d2('0x36')](_0x57cc2c[_0x88d2('0x37')],_0x57cc2c[_0x88d2('0x33')]);_0x2487cb[_0x88d2('0x35')]=_['intersection'](_0x57cc2c[_0x88d2('0x37')],qs[_0x88d2('0x38')](_0x551fa7[_0x88d2('0x33')]['fields']));_0x2487cb['attributes']=_0x2487cb['attributes'][_0x88d2('0x39')]?_0x2487cb[_0x88d2('0x35')]:_0x57cc2c[_0x88d2('0x37')];_0x2487cb[_0x88d2('0x3c')]=qs[_0x88d2('0x3d')](_0x551fa7[_0x88d2('0x33')]['sort']);_0x2487cb[_0x88d2('0x3e')]=qs[_0x88d2('0x34')](_[_0x88d2('0x3f')](_0x551fa7[_0x88d2('0x33')],_0x57cc2c[_0x88d2('0x34')]));if(_0x551fa7[_0x88d2('0x33')]['filter']){_0x2487cb[_0x88d2('0x3e')]=_['merge'](_0x2487cb[_0x88d2('0x3e')],{'$or':_[_0x88d2('0x2d')](_0x2487cb[_0x88d2('0x35')],function(_0x13397c){var _0x429f07={};_0x429f07[_0x13397c]={'$like':'%'+_0x551fa7['query'][_0x88d2('0x40')]+'%'};return _0x429f07;})});}_0x2487cb=_['merge']({},_0x2487cb,_0x551fa7[_0x88d2('0x48')]);return _0x43bb29[_0x88d2('0x54')](_0x2487cb);}})[_0x88d2('0x28')](function(_0x3c3510){if(_0x3c3510){_0x255f02=_0x3c3510[_0x88d2('0x39')];if(!_0x551fa7[_0x88d2('0x33')][_0x88d2('0x3a')](_0x88d2('0x3b'))){_0x2487cb[_0x88d2('0x20')]=qs[_0x88d2('0x20')](_0x551fa7[_0x88d2('0x33')][_0x88d2('0x20')]);_0x2487cb['offset']=qs['offset'](_0x551fa7[_0x88d2('0x33')][_0x88d2('0x1d')]);}return _0x43bb29['getAllConditions'](_0x2487cb);}})[_0x88d2('0x28')](function(_0x31c8ca){if(_0x31c8ca){return _0x31c8ca?{'count':_0x255f02,'rows':_0x31c8ca}:null;}})[_0x88d2('0x28')](respondWithResult(_0x2065d8,null))[_0x88d2('0x44')](handleError(_0x2065d8,null));};exports['getAnyConditions']=function(_0x20dca5,_0x7610eb,_0xc1df6a){var _0x3a5e83={};var _0x32e8ea={};var _0x3415dd;var _0x360d6f;return db[_0x88d2('0x2e')]['findOne']({'where':{'id':_0x20dca5['params']['id']}})[_0x88d2('0x28')](handleEntityNotFound(_0x7610eb,null))['then'](function(_0x202f5a){if(_0x202f5a){_0x3415dd=_0x202f5a;_0x32e8ea[_0x88d2('0x37')]=_[_0x88d2('0x47')](db[_0x88d2('0x52')][_0x88d2('0x2f')]);_0x32e8ea[_0x88d2('0x33')]=_[_0x88d2('0x47')](_0x20dca5[_0x88d2('0x33')]);_0x32e8ea['filters']=_[_0x88d2('0x36')](_0x32e8ea[_0x88d2('0x37')],_0x32e8ea[_0x88d2('0x33')]);_0x3a5e83[_0x88d2('0x35')]=_[_0x88d2('0x36')](_0x32e8ea[_0x88d2('0x37')],qs[_0x88d2('0x38')](_0x20dca5[_0x88d2('0x33')][_0x88d2('0x38')]));_0x3a5e83[_0x88d2('0x35')]=_0x3a5e83[_0x88d2('0x35')][_0x88d2('0x39')]?_0x3a5e83[_0x88d2('0x35')]:_0x32e8ea[_0x88d2('0x37')];_0x3a5e83[_0x88d2('0x3c')]=qs[_0x88d2('0x3d')](_0x20dca5[_0x88d2('0x33')][_0x88d2('0x3d')]);_0x3a5e83[_0x88d2('0x3e')]=qs[_0x88d2('0x34')](_[_0x88d2('0x3f')](_0x20dca5[_0x88d2('0x33')],_0x32e8ea[_0x88d2('0x34')]));if(_0x20dca5[_0x88d2('0x33')]['filter']){_0x3a5e83['where']=_['merge'](_0x3a5e83['where'],{'$or':_[_0x88d2('0x2d')](_0x3a5e83[_0x88d2('0x35')],function(_0x35bda7){var _0x574121={};_0x574121[_0x35bda7]={'$like':'%'+_0x20dca5[_0x88d2('0x33')][_0x88d2('0x40')]+'%'};return _0x574121;})});}_0x3a5e83=_[_0x88d2('0x41')]({},_0x3a5e83,_0x20dca5[_0x88d2('0x48')]);return _0x3415dd['getAnyConditions'](_0x3a5e83);}})[_0x88d2('0x28')](function(_0x1efe8b){if(_0x1efe8b){_0x360d6f=_0x1efe8b['length'];if(!_0x20dca5['query'][_0x88d2('0x3a')]('nolimit')){_0x3a5e83[_0x88d2('0x20')]=qs[_0x88d2('0x20')](_0x20dca5[_0x88d2('0x33')][_0x88d2('0x20')]);_0x3a5e83['offset']=qs['offset'](_0x20dca5[_0x88d2('0x33')][_0x88d2('0x1d')]);}return _0x3415dd[_0x88d2('0x56')](_0x3a5e83);}})[_0x88d2('0x28')](function(_0x49e168){if(_0x49e168){return _0x49e168?{'count':_0x360d6f,'rows':_0x49e168}:null;}})['then'](respondWithResult(_0x7610eb,null))[_0x88d2('0x44')](handleError(_0x7610eb,null));};exports['addAction']=function(_0x2757d4,_0xaeaad8,_0x5f00e0){if(_0x2757d4['body']['id']){delete _0x2757d4[_0x88d2('0x4a')]['id'];}return db['Trigger'][_0x88d2('0x4d')]({'where':{'id':_0x2757d4[_0x88d2('0x46')]['id']}})[_0x88d2('0x28')](handleEntityNotFound(_0xaeaad8,null))[_0x88d2('0x28')](function(_0x24afb5){if(_0x24afb5){_0x2757d4[_0x88d2('0x4a')]['TriggerId']=_0x24afb5['id'];return db[_0x88d2('0x57')][_0x88d2('0x49')](_0x2757d4['body']);}})[_0x88d2('0x28')](respondWithResult(_0xaeaad8,null))[_0x88d2('0x44')](handleError(_0xaeaad8,null));};exports['getActions']=function(_0x178508,_0xc1db02,_0x3fbb94){var _0x1d56b5={};var _0xe957ef={};var _0x3ea313;var _0x4d2de9;return db[_0x88d2('0x2e')]['findOne']({'where':{'id':_0x178508[_0x88d2('0x46')]['id']}})[_0x88d2('0x28')](handleEntityNotFound(_0xc1db02,null))[_0x88d2('0x28')](function(_0x2f655c){if(_0x2f655c){_0x3ea313=_0x2f655c;_0xe957ef[_0x88d2('0x37')]=_['keys'](db['Action'][_0x88d2('0x2f')]);_0xe957ef['query']=_[_0x88d2('0x47')](_0x178508['query']);_0xe957ef[_0x88d2('0x34')]=_['intersection'](_0xe957ef['model'],_0xe957ef[_0x88d2('0x33')]);_0x1d56b5['attributes']=_[_0x88d2('0x36')](_0xe957ef[_0x88d2('0x37')],qs[_0x88d2('0x38')](_0x178508[_0x88d2('0x33')]['fields']));_0x1d56b5['attributes']=_0x1d56b5[_0x88d2('0x35')][_0x88d2('0x39')]?_0x1d56b5[_0x88d2('0x35')]:_0xe957ef[_0x88d2('0x37')];_0x1d56b5[_0x88d2('0x3c')]=qs['sort'](_0x178508['query'][_0x88d2('0x3d')]);_0x1d56b5[_0x88d2('0x3e')]=qs[_0x88d2('0x34')](_[_0x88d2('0x3f')](_0x178508[_0x88d2('0x33')],_0xe957ef[_0x88d2('0x34')]));if(_0x178508['query']['filter']){_0x1d56b5[_0x88d2('0x3e')]=_[_0x88d2('0x41')](_0x1d56b5[_0x88d2('0x3e')],{'$or':_['map'](_0x1d56b5[_0x88d2('0x35')],function(_0x5f31e6){var _0x386e3e={};_0x386e3e[_0x5f31e6]={'$like':'%'+_0x178508[_0x88d2('0x33')]['filter']+'%'};return _0x386e3e;})});}_0x1d56b5=_[_0x88d2('0x41')]({},_0x1d56b5,_0x178508[_0x88d2('0x48')]);return _0x3ea313['getActions'](_0x1d56b5);}})[_0x88d2('0x28')](function(_0x52555c){if(_0x52555c){_0x4d2de9=_0x52555c[_0x88d2('0x39')];if(!_0x178508[_0x88d2('0x33')][_0x88d2('0x3a')](_0x88d2('0x3b'))){_0x1d56b5[_0x88d2('0x20')]=qs[_0x88d2('0x20')](_0x178508[_0x88d2('0x33')][_0x88d2('0x20')]);_0x1d56b5['offset']=qs['offset'](_0x178508[_0x88d2('0x33')][_0x88d2('0x1d')]);}return _0x3ea313['getActions'](_0x1d56b5);}})[_0x88d2('0x28')](function(_0x120735){if(_0x120735){return _0x120735?{'count':_0x4d2de9,'rows':_0x120735}:null;}})[_0x88d2('0x28')](respondWithResult(_0xc1db02,null))[_0x88d2('0x44')](handleError(_0xc1db02,null));}; \ No newline at end of file +var _0xc723=['api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','set','json','reject','save','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','map','Trigger','rawAttributes','type','query','intersection','fields','model','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','params','keys','attributes','length','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Triggers','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','getAnyConditions','findOne','addAction','TriggerId','Action','order','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x2204f9,_0x186399){var _0x3bf444=function(_0x2f086a){while(--_0x2f086a){_0x2204f9['push'](_0x2204f9['shift']());}};_0x3bf444(++_0x186399);}(_0xc723,0x103));var _0x3c72=function(_0x4e82ff,_0x3cbf4b){_0x4e82ff=_0x4e82ff-0x0;var _0x495205=_0xc723[_0x4e82ff];return _0x495205;};'use strict';var emlformat=require(_0x3c72('0x0'));var rimraf=require(_0x3c72('0x1'));var zipdir=require(_0x3c72('0x2'));var jsonpatch=require(_0x3c72('0x3'));var rp=require(_0x3c72('0x4'));var moment=require(_0x3c72('0x5'));var BPromise=require(_0x3c72('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x3c72('0x7'));var ejs=require(_0x3c72('0x8'));var fs=require('fs');var fs_extra=require(_0x3c72('0x9'));var _=require(_0x3c72('0xa'));var squel=require('squel');var crypto=require(_0x3c72('0xb'));var jsforce=require(_0x3c72('0xc'));var deskjs=require(_0x3c72('0xd'));var toCsv=require(_0x3c72('0x7'));var querystring=require(_0x3c72('0xe'));var Papa=require(_0x3c72('0xf'));var Redis=require(_0x3c72('0x10'));var authService=require(_0x3c72('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c72('0x12'));var logger=require(_0x3c72('0x13'))(_0x3c72('0x14'));var utils=require(_0x3c72('0x15'));var config=require(_0x3c72('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3c72('0x17'))['db'];function respondWithStatusCode(_0x3ed882,_0x481699){_0x481699=_0x481699||0xcc;return function(_0x10f95e){if(_0x10f95e){return _0x3ed882['sendStatus'](_0x481699);}return _0x3ed882[_0x3c72('0x18')](_0x481699)[_0x3c72('0x19')]();};}function respondWithResult(_0x4aef4f,_0x404f3b){_0x404f3b=_0x404f3b||0xc8;return function(_0x7cc976){if(_0x7cc976){return _0x4aef4f[_0x3c72('0x18')](_0x404f3b)['json'](_0x7cc976);}};}function respondWithFilteredResult(_0xcd8980,_0x1c5dc6){return function(_0x587b3a){if(_0x587b3a){var _0x5ab0ea=typeof _0x1c5dc6[_0x3c72('0x1a')]===_0x3c72('0x1b')&&typeof _0x1c5dc6[_0x3c72('0x1c')]===_0x3c72('0x1b');var _0x47fd56=_0x587b3a['count'];var _0x522af6=_0x5ab0ea?0x0:_0x1c5dc6[_0x3c72('0x1a')];var _0x5f4b7b=_0x5ab0ea?_0x587b3a['count']:_0x1c5dc6[_0x3c72('0x1a')]+_0x1c5dc6['limit'];var _0x5b7a37;if(_0x5f4b7b>=_0x47fd56){_0x5f4b7b=_0x47fd56;_0x5b7a37=0xc8;}else{_0x5b7a37=0xce;}_0xcd8980['status'](_0x5b7a37);return _0xcd8980[_0x3c72('0x1d')]('Content-Range',_0x522af6+'-'+_0x5f4b7b+'/'+_0x47fd56)[_0x3c72('0x1e')](_0x587b3a);}return null;};}function patchUpdates(_0x37e11d){return function(_0xf18338){try{jsonpatch['apply'](_0xf18338,_0x37e11d,!![]);}catch(_0xb8c15c){return BPromise[_0x3c72('0x1f')](_0xb8c15c);}return _0xf18338[_0x3c72('0x20')]();};}function saveUpdates(_0x125ce4,_0x5cde37){return function(_0x924d8){if(_0x924d8){return _0x924d8['update'](_0x125ce4)[_0x3c72('0x21')](function(_0x866c5a){return _0x866c5a;});}return null;};}function removeEntity(_0x48adaa,_0x18af15){return function(_0x11372f){if(_0x11372f){return _0x11372f[_0x3c72('0x22')]()[_0x3c72('0x21')](function(){var _0x1d1117=_0x11372f['get']({'plain':!![]});var _0x2c1f3f='Triggers';return db[_0x3c72('0x23')]['destroy']({'where':{'type':_0x2c1f3f,'resourceId':_0x1d1117['id']}})['then'](function(){return _0x11372f;});})[_0x3c72('0x21')](function(){_0x48adaa['status'](0xcc)[_0x3c72('0x19')]();});}};}function handleEntityNotFound(_0x4b2801,_0xfc2966){return function(_0x572b32){if(!_0x572b32){_0x4b2801[_0x3c72('0x24')](0x194);}return _0x572b32;};}function handleError(_0xeec244,_0x49707a){_0x49707a=_0x49707a||0x1f4;return function(_0x371c58){logger[_0x3c72('0x25')](_0x371c58[_0x3c72('0x26')]);if(_0x371c58[_0x3c72('0x27')]){delete _0x371c58[_0x3c72('0x27')];}_0xeec244['status'](_0x49707a)[_0x3c72('0x28')](_0x371c58);};}exports['index']=function(_0x1645ac,_0x31bf96){var _0x576e43={},_0x243866={},_0x53fe7a={'count':0x0,'rows':[]};var _0x1537c8=_[_0x3c72('0x29')](db[_0x3c72('0x2a')][_0x3c72('0x2b')],function(_0x9297e7){return{'name':_0x9297e7['fieldName'],'type':_0x9297e7[_0x3c72('0x2c')]['key']};});_0x243866['model']=_['map'](_0x1537c8,_0x3c72('0x27'));_0x243866['query']=_['keys'](_0x1645ac[_0x3c72('0x2d')]);_0x243866['filters']=_[_0x3c72('0x2e')](_0x243866['model'],_0x243866[_0x3c72('0x2d')]);_0x576e43['attributes']=_[_0x3c72('0x2e')](_0x243866['model'],qs[_0x3c72('0x2f')](_0x1645ac[_0x3c72('0x2d')]['fields']));_0x576e43['attributes']=_0x576e43['attributes']['length']?_0x576e43['attributes']:_0x243866[_0x3c72('0x30')];if(!_0x1645ac[_0x3c72('0x2d')][_0x3c72('0x31')](_0x3c72('0x32'))){_0x576e43[_0x3c72('0x1c')]=qs[_0x3c72('0x1c')](_0x1645ac[_0x3c72('0x2d')][_0x3c72('0x1c')]);_0x576e43[_0x3c72('0x1a')]=qs['offset'](_0x1645ac[_0x3c72('0x2d')][_0x3c72('0x1a')]);}_0x576e43['order']=qs[_0x3c72('0x33')](_0x1645ac[_0x3c72('0x2d')]['sort']);_0x576e43[_0x3c72('0x34')]=qs[_0x3c72('0x35')](_[_0x3c72('0x36')](_0x1645ac[_0x3c72('0x2d')],_0x243866[_0x3c72('0x35')]),_0x1537c8);if(_0x1645ac[_0x3c72('0x2d')][_0x3c72('0x37')]){_0x576e43[_0x3c72('0x34')]=_[_0x3c72('0x38')](_0x576e43[_0x3c72('0x34')],{'$or':_[_0x3c72('0x29')](_0x1537c8,function(_0x3b3b1f){if(_0x3b3b1f[_0x3c72('0x2c')]!==_0x3c72('0x39')){var _0xdb5b50={};_0xdb5b50[_0x3b3b1f[_0x3c72('0x27')]]={'$like':'%'+_0x1645ac[_0x3c72('0x2d')][_0x3c72('0x37')]+'%'};return _0xdb5b50;}})});}_0x576e43=_[_0x3c72('0x38')]({},_0x576e43,_0x1645ac[_0x3c72('0x3a')]);var _0x5f3aa9={'where':_0x576e43[_0x3c72('0x34')]};return db[_0x3c72('0x2a')][_0x3c72('0x3b')](_0x5f3aa9)[_0x3c72('0x21')](function(_0xc1db1b){_0x53fe7a['count']=_0xc1db1b;if(_0x1645ac['query'][_0x3c72('0x3c')]){_0x576e43[_0x3c72('0x3d')]=[{'all':!![]}];}return db[_0x3c72('0x2a')][_0x3c72('0x3e')](_0x576e43);})[_0x3c72('0x21')](function(_0x5c03db){_0x53fe7a['rows']=_0x5c03db;return _0x53fe7a;})[_0x3c72('0x21')](respondWithFilteredResult(_0x31bf96,_0x576e43))[_0x3c72('0x3f')](handleError(_0x31bf96,null));};exports['show']=function(_0xc7f682,_0x1949d4){var _0x5e8b35={'raw':![],'where':{'id':_0xc7f682[_0x3c72('0x40')]['id']}},_0x5b21cb={};_0x5b21cb[_0x3c72('0x30')]=_[_0x3c72('0x41')](db[_0x3c72('0x2a')]['rawAttributes']);_0x5b21cb[_0x3c72('0x2d')]=_[_0x3c72('0x41')](_0xc7f682[_0x3c72('0x2d')]);_0x5b21cb[_0x3c72('0x35')]=_[_0x3c72('0x2e')](_0x5b21cb['model'],_0x5b21cb['query']);_0x5e8b35[_0x3c72('0x42')]=_['intersection'](_0x5b21cb['model'],qs[_0x3c72('0x2f')](_0xc7f682[_0x3c72('0x2d')][_0x3c72('0x2f')]));_0x5e8b35[_0x3c72('0x42')]=_0x5e8b35[_0x3c72('0x42')][_0x3c72('0x43')]?_0x5e8b35[_0x3c72('0x42')]:_0x5b21cb[_0x3c72('0x30')];if(_0xc7f682[_0x3c72('0x2d')][_0x3c72('0x3c')]){_0x5e8b35[_0x3c72('0x3d')]=[{'all':!![]}];}_0x5e8b35=_['merge']({},_0x5e8b35,_0xc7f682[_0x3c72('0x3a')]);return db[_0x3c72('0x2a')]['find'](_0x5e8b35)[_0x3c72('0x21')](handleEntityNotFound(_0x1949d4,null))[_0x3c72('0x21')](respondWithResult(_0x1949d4,null))[_0x3c72('0x3f')](handleError(_0x1949d4,null));};exports[_0x3c72('0x44')]=function(_0x48d1c0,_0x502c72){return db['Trigger'][_0x3c72('0x44')](_0x48d1c0[_0x3c72('0x45')],{})[_0x3c72('0x21')](function(_0x47fe96){var _0x594f7b=_0x48d1c0['user'][_0x3c72('0x46')]({'plain':!![]});if(!_0x594f7b)throw new Error(_0x3c72('0x47'));if(_0x594f7b[_0x3c72('0x48')]===_0x3c72('0x49')){var _0x244d8a=_0x47fe96[_0x3c72('0x46')]({'plain':!![]});var _0x1f055b=_0x3c72('0x4a');return db[_0x3c72('0x4b')][_0x3c72('0x4c')]({'where':{'name':_0x1f055b,'userProfileId':_0x594f7b[_0x3c72('0x4d')]},'raw':!![]})[_0x3c72('0x21')](function(_0x497920){if(_0x497920&&_0x497920[_0x3c72('0x4e')]===0x0){return db[_0x3c72('0x23')][_0x3c72('0x44')]({'name':_0x244d8a[_0x3c72('0x27')],'resourceId':_0x244d8a['id'],'type':_0x497920[_0x3c72('0x27')],'sectionId':_0x497920['id']},{})[_0x3c72('0x21')](function(){return _0x47fe96;});}else{return _0x47fe96;}})['catch'](function(_0x40b233){logger['error'](_0x3c72('0x4f'),_0x40b233);throw _0x40b233;});}return _0x47fe96;})['then'](respondWithResult(_0x502c72,0xc9))['catch'](handleError(_0x502c72,null));};exports[_0x3c72('0x50')]=function(_0x380a2f,_0x3c9302){if(_0x380a2f[_0x3c72('0x45')]['id']){delete _0x380a2f[_0x3c72('0x45')]['id'];}return db[_0x3c72('0x2a')][_0x3c72('0x4c')]({'where':{'id':_0x380a2f[_0x3c72('0x40')]['id']}})[_0x3c72('0x21')](handleEntityNotFound(_0x3c9302,null))[_0x3c72('0x21')](saveUpdates(_0x380a2f[_0x3c72('0x45')],null))['then'](respondWithResult(_0x3c9302,null))['catch'](handleError(_0x3c9302,null));};exports[_0x3c72('0x22')]=function(_0x447549,_0x46abcf){return db[_0x3c72('0x2a')][_0x3c72('0x4c')]({'where':{'id':_0x447549['params']['id']}})[_0x3c72('0x21')](handleEntityNotFound(_0x46abcf,null))[_0x3c72('0x21')](removeEntity(_0x46abcf,null))[_0x3c72('0x3f')](handleError(_0x46abcf,null));};exports[_0x3c72('0x51')]=function(_0x1679b3,_0x935c66,_0x51e076){if(_0x1679b3[_0x3c72('0x45')]['id']){delete _0x1679b3[_0x3c72('0x45')]['id'];}return db['Trigger'][_0x3c72('0x4c')]({'where':{'id':_0x1679b3[_0x3c72('0x40')]['id']}})[_0x3c72('0x21')](handleEntityNotFound(_0x935c66,null))[_0x3c72('0x21')](function(_0x54d482){if(_0x54d482){_0x1679b3['body']['TriggerAllId']=_0x54d482['id'];return db[_0x3c72('0x52')]['create'](_0x1679b3['body']);}})[_0x3c72('0x21')](respondWithResult(_0x935c66,null))['catch'](handleError(_0x935c66,null));};exports[_0x3c72('0x53')]=function(_0x978982,_0x4a39c1,_0x4cf55f){if(_0x978982[_0x3c72('0x45')]['id']){delete _0x978982[_0x3c72('0x45')]['id'];}return db[_0x3c72('0x2a')][_0x3c72('0x4c')]({'where':{'id':_0x978982[_0x3c72('0x40')]['id']}})[_0x3c72('0x21')](handleEntityNotFound(_0x4a39c1,null))[_0x3c72('0x21')](function(_0x5a99e3){if(_0x5a99e3){_0x978982[_0x3c72('0x45')][_0x3c72('0x54')]=_0x5a99e3['id'];return db[_0x3c72('0x52')][_0x3c72('0x44')](_0x978982[_0x3c72('0x45')]);}})[_0x3c72('0x21')](respondWithResult(_0x4a39c1,null))[_0x3c72('0x3f')](handleError(_0x4a39c1,null));};exports[_0x3c72('0x55')]=function(_0x135059,_0x390f03,_0x12a6cd){var _0x118703={};var _0x310e79={};var _0x3be472;var _0x26eb18;return db[_0x3c72('0x2a')]['findOne']({'where':{'id':_0x135059[_0x3c72('0x40')]['id']}})[_0x3c72('0x21')](handleEntityNotFound(_0x390f03,null))[_0x3c72('0x21')](function(_0x111e0d){if(_0x111e0d){_0x3be472=_0x111e0d;_0x310e79[_0x3c72('0x30')]=_[_0x3c72('0x41')](db[_0x3c72('0x52')][_0x3c72('0x2b')]);_0x310e79['query']=_[_0x3c72('0x41')](_0x135059[_0x3c72('0x2d')]);_0x310e79[_0x3c72('0x35')]=_[_0x3c72('0x2e')](_0x310e79[_0x3c72('0x30')],_0x310e79[_0x3c72('0x2d')]);_0x118703[_0x3c72('0x42')]=_[_0x3c72('0x2e')](_0x310e79[_0x3c72('0x30')],qs[_0x3c72('0x2f')](_0x135059['query']['fields']));_0x118703[_0x3c72('0x42')]=_0x118703[_0x3c72('0x42')][_0x3c72('0x43')]?_0x118703['attributes']:_0x310e79['model'];_0x118703['order']=qs[_0x3c72('0x33')](_0x135059[_0x3c72('0x2d')]['sort']);_0x118703[_0x3c72('0x34')]=qs[_0x3c72('0x35')](_[_0x3c72('0x36')](_0x135059[_0x3c72('0x2d')],_0x310e79['filters']));if(_0x135059['query']['filter']){_0x118703[_0x3c72('0x34')]=_[_0x3c72('0x38')](_0x118703[_0x3c72('0x34')],{'$or':_['map'](_0x118703[_0x3c72('0x42')],function(_0x11432b){var _0x2c4e83={};_0x2c4e83[_0x11432b]={'$like':'%'+_0x135059[_0x3c72('0x2d')][_0x3c72('0x37')]+'%'};return _0x2c4e83;})});}_0x118703=_[_0x3c72('0x38')]({},_0x118703,_0x135059[_0x3c72('0x3a')]);return _0x3be472[_0x3c72('0x55')](_0x118703);}})[_0x3c72('0x21')](function(_0xd2d579){if(_0xd2d579){_0x26eb18=_0xd2d579[_0x3c72('0x43')];if(!_0x135059[_0x3c72('0x2d')]['hasOwnProperty'](_0x3c72('0x32'))){_0x118703['limit']=qs[_0x3c72('0x1c')](_0x135059[_0x3c72('0x2d')][_0x3c72('0x1c')]);_0x118703[_0x3c72('0x1a')]=qs[_0x3c72('0x1a')](_0x135059[_0x3c72('0x2d')][_0x3c72('0x1a')]);}return _0x3be472[_0x3c72('0x55')](_0x118703);}})[_0x3c72('0x21')](function(_0x576ded){if(_0x576ded){return _0x576ded?{'count':_0x26eb18,'rows':_0x576ded}:null;}})[_0x3c72('0x21')](respondWithResult(_0x390f03,null))[_0x3c72('0x3f')](handleError(_0x390f03,null));};exports[_0x3c72('0x56')]=function(_0x48dffc,_0x2c203b,_0x267e22){var _0x1c1cb3={};var _0x79c775={};var _0x6ca34a;var _0x58eb88;return db['Trigger'][_0x3c72('0x57')]({'where':{'id':_0x48dffc[_0x3c72('0x40')]['id']}})['then'](handleEntityNotFound(_0x2c203b,null))[_0x3c72('0x21')](function(_0xebb636){if(_0xebb636){_0x6ca34a=_0xebb636;_0x79c775['model']=_[_0x3c72('0x41')](db['Condition'][_0x3c72('0x2b')]);_0x79c775[_0x3c72('0x2d')]=_[_0x3c72('0x41')](_0x48dffc[_0x3c72('0x2d')]);_0x79c775[_0x3c72('0x35')]=_[_0x3c72('0x2e')](_0x79c775[_0x3c72('0x30')],_0x79c775[_0x3c72('0x2d')]);_0x1c1cb3['attributes']=_[_0x3c72('0x2e')](_0x79c775['model'],qs['fields'](_0x48dffc[_0x3c72('0x2d')][_0x3c72('0x2f')]));_0x1c1cb3[_0x3c72('0x42')]=_0x1c1cb3[_0x3c72('0x42')][_0x3c72('0x43')]?_0x1c1cb3[_0x3c72('0x42')]:_0x79c775[_0x3c72('0x30')];_0x1c1cb3['order']=qs[_0x3c72('0x33')](_0x48dffc[_0x3c72('0x2d')]['sort']);_0x1c1cb3['where']=qs[_0x3c72('0x35')](_[_0x3c72('0x36')](_0x48dffc['query'],_0x79c775[_0x3c72('0x35')]));if(_0x48dffc[_0x3c72('0x2d')][_0x3c72('0x37')]){_0x1c1cb3['where']=_['merge'](_0x1c1cb3['where'],{'$or':_[_0x3c72('0x29')](_0x1c1cb3['attributes'],function(_0x2cc4be){var _0x673080={};_0x673080[_0x2cc4be]={'$like':'%'+_0x48dffc['query']['filter']+'%'};return _0x673080;})});}_0x1c1cb3=_[_0x3c72('0x38')]({},_0x1c1cb3,_0x48dffc[_0x3c72('0x3a')]);return _0x6ca34a[_0x3c72('0x56')](_0x1c1cb3);}})[_0x3c72('0x21')](function(_0x3ff378){if(_0x3ff378){_0x58eb88=_0x3ff378[_0x3c72('0x43')];if(!_0x48dffc['query'][_0x3c72('0x31')](_0x3c72('0x32'))){_0x1c1cb3[_0x3c72('0x1c')]=qs['limit'](_0x48dffc[_0x3c72('0x2d')][_0x3c72('0x1c')]);_0x1c1cb3['offset']=qs[_0x3c72('0x1a')](_0x48dffc[_0x3c72('0x2d')]['offset']);}return _0x6ca34a[_0x3c72('0x56')](_0x1c1cb3);}})[_0x3c72('0x21')](function(_0x37d405){if(_0x37d405){return _0x37d405?{'count':_0x58eb88,'rows':_0x37d405}:null;}})['then'](respondWithResult(_0x2c203b,null))[_0x3c72('0x3f')](handleError(_0x2c203b,null));};exports[_0x3c72('0x58')]=function(_0xe41d52,_0x2a11c3,_0x357924){if(_0xe41d52['body']['id']){delete _0xe41d52[_0x3c72('0x45')]['id'];}return db[_0x3c72('0x2a')]['find']({'where':{'id':_0xe41d52[_0x3c72('0x40')]['id']}})['then'](handleEntityNotFound(_0x2a11c3,null))[_0x3c72('0x21')](function(_0x316883){if(_0x316883){_0xe41d52['body'][_0x3c72('0x59')]=_0x316883['id'];return db['Action'][_0x3c72('0x44')](_0xe41d52[_0x3c72('0x45')]);}})['then'](respondWithResult(_0x2a11c3,null))[_0x3c72('0x3f')](handleError(_0x2a11c3,null));};exports['getActions']=function(_0xe3c238,_0x40629d,_0x1f30a3){var _0x13a270={};var _0x4294a2={};var _0x4a7f30;var _0x3203;return db[_0x3c72('0x2a')][_0x3c72('0x57')]({'where':{'id':_0xe3c238[_0x3c72('0x40')]['id']}})[_0x3c72('0x21')](handleEntityNotFound(_0x40629d,null))['then'](function(_0x31fa8c){if(_0x31fa8c){_0x4a7f30=_0x31fa8c;_0x4294a2[_0x3c72('0x30')]=_['keys'](db[_0x3c72('0x5a')][_0x3c72('0x2b')]);_0x4294a2['query']=_['keys'](_0xe3c238['query']);_0x4294a2[_0x3c72('0x35')]=_[_0x3c72('0x2e')](_0x4294a2['model'],_0x4294a2['query']);_0x13a270[_0x3c72('0x42')]=_[_0x3c72('0x2e')](_0x4294a2[_0x3c72('0x30')],qs['fields'](_0xe3c238[_0x3c72('0x2d')][_0x3c72('0x2f')]));_0x13a270[_0x3c72('0x42')]=_0x13a270['attributes'][_0x3c72('0x43')]?_0x13a270[_0x3c72('0x42')]:_0x4294a2[_0x3c72('0x30')];_0x13a270[_0x3c72('0x5b')]=qs[_0x3c72('0x33')](_0xe3c238[_0x3c72('0x2d')][_0x3c72('0x33')]);_0x13a270[_0x3c72('0x34')]=qs[_0x3c72('0x35')](_['pick'](_0xe3c238['query'],_0x4294a2[_0x3c72('0x35')]));if(_0xe3c238[_0x3c72('0x2d')][_0x3c72('0x37')]){_0x13a270[_0x3c72('0x34')]=_['merge'](_0x13a270[_0x3c72('0x34')],{'$or':_['map'](_0x13a270[_0x3c72('0x42')],function(_0x58704a){var _0x2ee403={};_0x2ee403[_0x58704a]={'$like':'%'+_0xe3c238['query'][_0x3c72('0x37')]+'%'};return _0x2ee403;})});}_0x13a270=_[_0x3c72('0x38')]({},_0x13a270,_0xe3c238[_0x3c72('0x3a')]);return _0x4a7f30[_0x3c72('0x5c')](_0x13a270);}})[_0x3c72('0x21')](function(_0x1ae8a4){if(_0x1ae8a4){_0x3203=_0x1ae8a4[_0x3c72('0x43')];if(!_0xe3c238[_0x3c72('0x2d')][_0x3c72('0x31')](_0x3c72('0x32'))){_0x13a270[_0x3c72('0x1c')]=qs['limit'](_0xe3c238[_0x3c72('0x2d')][_0x3c72('0x1c')]);_0x13a270[_0x3c72('0x1a')]=qs[_0x3c72('0x1a')](_0xe3c238[_0x3c72('0x2d')][_0x3c72('0x1a')]);}return _0x4a7f30[_0x3c72('0x5c')](_0x13a270);}})['then'](function(_0x1aff3b){if(_0x1aff3b){return _0x1aff3b?{'count':_0x3203,'rows':_0x1aff3b}:null;}})['then'](respondWithResult(_0x40629d,null))[_0x3c72('0x3f')](handleError(_0x40629d,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index e148814..ab06f25 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 _0xe630=['util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','Trigger','lodash'];(function(_0x34620e,_0x582015){var _0x3d33cd=function(_0x19dc7f){while(--_0x19dc7f){_0x34620e['push'](_0x34620e['shift']());}};_0x3d33cd(++_0x582015);}(_0xe630,0x149));var _0x0e63=function(_0x3f6ffe,_0xf64c5){_0x3f6ffe=_0x3f6ffe-0x0;var _0x7dd7ce=_0xe630[_0x3f6ffe];return _0x7dd7ce;};'use strict';var _=require(_0x0e63('0x0'));var util=require(_0x0e63('0x1'));var logger=require('../../config/logger')(_0x0e63('0x2'));var moment=require(_0x0e63('0x3'));var BPromise=require(_0x0e63('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e63('0x5'));var rimraf=require(_0x0e63('0x6'));var config=require(_0x0e63('0x7'));var attributes=require('./trigger.attributes');module[_0x0e63('0x8')]=function(_0x308039,_0x356abb){return _0x308039[_0x0e63('0x9')](_0x0e63('0xa'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb81=['lodash','util','api','path','rimraf','../../config/environment','./trigger.attributes','exports','define','tools_triggers'];(function(_0x2951f1,_0x42d2d2){var _0x2faf77=function(_0x520db1){while(--_0x520db1){_0x2951f1['push'](_0x2951f1['shift']());}};_0x2faf77(++_0x42d2d2);}(_0xcb81,0x154));var _0x1cb8=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xcb81[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0x1cb8('0x0'));var util=require(_0x1cb8('0x1'));var logger=require('../../config/logger')(_0x1cb8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb8('0x3'));var rimraf=require(_0x1cb8('0x4'));var config=require(_0x1cb8('0x5'));var attributes=require(_0x1cb8('0x6'));module[_0x1cb8('0x7')]=function(_0x4e5c19,_0x98d682){return _0x4e5c19[_0x1cb8('0x8')]('Trigger',attributes,{'tableName':_0x1cb8('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 e953f83..fc4ab68 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 _0xfb11=['debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTrigger','Trigger','findAll','options','where','attributes','limit','include','map','model','info','ShowTrigger','find','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Trigger,\x20%s,\x20%s','request\x20sent'];(function(_0x12bc69,_0x1934aa){var _0x3bc1e1=function(_0x3d25ef){while(--_0x3d25ef){_0x12bc69['push'](_0x12bc69['shift']());}};_0x3bc1e1(++_0x1934aa);}(_0xfb11,0x159));var _0x1fb1=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xfb11[_0x13e741];return _0x3f8bb3;};'use strict';var _=require('lodash');var util=require(_0x1fb1('0x0'));var moment=require(_0x1fb1('0x1'));var BPromise=require(_0x1fb1('0x2'));var rs=require(_0x1fb1('0x3'));var fs=require('fs');var Redis=require(_0x1fb1('0x4'));var db=require(_0x1fb1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1fb1('0x6'))(_0x1fb1('0x7'));var config=require(_0x1fb1('0x8'));var jayson=require(_0x1fb1('0x9'));var client=jayson[_0x1fb1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x124f08,_0x5ce153,_0xe5820e){return new BPromise(function(_0x304416,_0x7aec68){return client[_0x1fb1('0xb')](_0x124f08,_0xe5820e)[_0x1fb1('0xc')](function(_0x9c9df7){logger['info'](_0x1fb1('0xd'),_0x5ce153,_0x1fb1('0xe'));logger[_0x1fb1('0xf')](_0x1fb1('0x10'),_0x5ce153,_0x1fb1('0xe'),JSON[_0x1fb1('0x11')](_0x9c9df7));if(_0x9c9df7[_0x1fb1('0x12')]){if(_0x9c9df7[_0x1fb1('0x12')][_0x1fb1('0x13')]===0x1f4){logger[_0x1fb1('0x12')](_0x1fb1('0xd'),_0x5ce153,_0x9c9df7['error']['message']);return _0x7aec68(_0x9c9df7[_0x1fb1('0x12')][_0x1fb1('0x14')]);}logger[_0x1fb1('0x12')](_0x1fb1('0xd'),_0x5ce153,_0x9c9df7[_0x1fb1('0x12')]['message']);return _0x304416(_0x9c9df7[_0x1fb1('0x12')]['message']);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x5ce153,_0x1fb1('0xe'));_0x304416(_0x9c9df7[_0x1fb1('0x15')][_0x1fb1('0x14')]);}})['catch'](function(_0x41e4e4){logger[_0x1fb1('0x12')](_0x1fb1('0xd'),_0x5ce153,_0x41e4e4);_0x7aec68(_0x41e4e4);});});}exports[_0x1fb1('0x16')]=function(_0x458050){var _0x29045b=this;return new Promise(function(_0x14302c,_0x1a8558){return db[_0x1fb1('0x17')][_0x1fb1('0x18')]({'raw':_0x458050[_0x1fb1('0x19')]?_0x458050[_0x1fb1('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x458050['options']?_0x458050[_0x1fb1('0x19')][_0x1fb1('0x1a')]||null:null,'attributes':_0x458050[_0x1fb1('0x19')]?_0x458050[_0x1fb1('0x19')][_0x1fb1('0x1b')]||null:null,'limit':_0x458050[_0x1fb1('0x19')]?_0x458050[_0x1fb1('0x19')][_0x1fb1('0x1c')]||null:null,'include':_0x458050[_0x1fb1('0x19')]?_0x458050['options'][_0x1fb1('0x1d')]?_[_0x1fb1('0x1e')](_0x458050[_0x1fb1('0x19')][_0x1fb1('0x1d')],function(_0x167629){return{'model':db[_0x167629[_0x1fb1('0x1f')]],'as':_0x167629['as'],'attributes':_0x167629[_0x1fb1('0x1b')],'include':_0x167629[_0x1fb1('0x1d')]?_['map'](_0x167629[_0x1fb1('0x1d')],function(_0x452588){return{'model':db[_0x452588[_0x1fb1('0x1f')]],'as':_0x452588['as'],'attributes':_0x452588[_0x1fb1('0x1b')],'include':_0x452588[_0x1fb1('0x1d')]?_['map'](_0x452588[_0x1fb1('0x1d')],function(_0x331ee2){return{'model':db[_0x331ee2[_0x1fb1('0x1f')]],'as':_0x331ee2['as'],'attributes':_0x331ee2['attributes']};}):[]};}):[]};}):[]:[]})[_0x1fb1('0xc')](function(_0xaf69e5){logger[_0x1fb1('0x20')](_0x1fb1('0x16'),_0x458050);logger[_0x1fb1('0xf')](_0x1fb1('0x16'),_0x458050,JSON[_0x1fb1('0x11')](_0xaf69e5));_0x14302c(_0xaf69e5);})['catch'](function(_0x74cea1){logger[_0x1fb1('0x12')](_0x1fb1('0x16'),_0x74cea1['message'],_0x458050);_0x1a8558(_0x29045b['error'](0x1f4,_0x74cea1['message']));});});};exports[_0x1fb1('0x21')]=function(_0x3f4a0d){var _0x4f3310=this;return new Promise(function(_0x1fab1a,_0x3f4f51){return db[_0x1fb1('0x17')][_0x1fb1('0x22')]({'raw':_0x3f4a0d[_0x1fb1('0x19')]?_0x3f4a0d[_0x1fb1('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3f4a0d['options']?_0x3f4a0d['options'][_0x1fb1('0x1a')]||null:null,'attributes':_0x3f4a0d[_0x1fb1('0x19')]?_0x3f4a0d[_0x1fb1('0x19')][_0x1fb1('0x1b')]||null:null,'include':_0x3f4a0d[_0x1fb1('0x19')]?_0x3f4a0d[_0x1fb1('0x19')][_0x1fb1('0x1d')]?_[_0x1fb1('0x1e')](_0x3f4a0d[_0x1fb1('0x19')]['include'],function(_0x57f476){return{'model':db[_0x57f476[_0x1fb1('0x1f')]],'as':_0x57f476['as'],'attributes':_0x57f476['attributes'],'include':_0x57f476[_0x1fb1('0x1d')]?_['map'](_0x57f476['include'],function(_0x3a7f49){return{'model':db[_0x3a7f49[_0x1fb1('0x1f')]],'as':_0x3a7f49['as'],'attributes':_0x3a7f49[_0x1fb1('0x1b')],'include':_0x3a7f49[_0x1fb1('0x1d')]?_[_0x1fb1('0x1e')](_0x3a7f49[_0x1fb1('0x1d')],function(_0x5ca91a){return{'model':db[_0x5ca91a['model']],'as':_0x5ca91a['as'],'attributes':_0x5ca91a[_0x1fb1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1fb1('0xc')](function(_0x1cdca1){logger[_0x1fb1('0x20')](_0x1fb1('0x21'),_0x3f4a0d);logger[_0x1fb1('0xf')](_0x1fb1('0x21'),_0x3f4a0d,JSON[_0x1fb1('0x11')](_0x1cdca1));_0x1fab1a(_0x1cdca1);})[_0x1fb1('0x23')](function(_0x306b20){logger[_0x1fb1('0x12')](_0x1fb1('0x21'),_0x306b20['message'],_0x3f4a0d);_0x3f4f51(_0x4f3310[_0x1fb1('0x12')](0x1f4,_0x306b20[_0x1fb1('0x14')]));});});}; \ No newline at end of file +var _0x6b5e=['Trigger,\x20%s,\x20%s','message','info','request\x20sent','result','catch','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','debug','GetTrigger','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b5e,0x16a));var _0xe6b5=function(_0x21afa0,_0x1f7b19){_0x21afa0=_0x21afa0-0x0;var _0x55f0e4=_0x6b5e[_0x21afa0];return _0x55f0e4;};'use strict';var _=require(_0xe6b5('0x0'));var util=require(_0xe6b5('0x1'));var moment=require(_0xe6b5('0x2'));var BPromise=require(_0xe6b5('0x3'));var rs=require(_0xe6b5('0x4'));var fs=require('fs');var Redis=require(_0xe6b5('0x5'));var db=require(_0xe6b5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe6b5('0x7'))(_0xe6b5('0x8'));var config=require('../../config/environment');var jayson=require(_0xe6b5('0x9'));var client=jayson[_0xe6b5('0xa')][_0xe6b5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fe51b,_0x31825e,_0x252651){return new BPromise(function(_0x15cb92,_0x1451c2){return client[_0xe6b5('0xc')](_0x4fe51b,_0x252651)[_0xe6b5('0xd')](function(_0x2d67c3){logger['info']('Trigger,\x20%s,\x20%s',_0x31825e,'request\x20sent');logger['debug'](_0xe6b5('0xe'),_0x31825e,'request\x20sent',JSON[_0xe6b5('0xf')](_0x2d67c3));if(_0x2d67c3[_0xe6b5('0x10')]){if(_0x2d67c3['error'][_0xe6b5('0x11')]===0x1f4){logger[_0xe6b5('0x10')](_0xe6b5('0x12'),_0x31825e,_0x2d67c3[_0xe6b5('0x10')]['message']);return _0x1451c2(_0x2d67c3[_0xe6b5('0x10')]['message']);}logger['error']('Trigger,\x20%s,\x20%s',_0x31825e,_0x2d67c3['error'][_0xe6b5('0x13')]);return _0x15cb92(_0x2d67c3[_0xe6b5('0x10')]['message']);}else{logger[_0xe6b5('0x14')](_0xe6b5('0x12'),_0x31825e,_0xe6b5('0x15'));_0x15cb92(_0x2d67c3[_0xe6b5('0x16')][_0xe6b5('0x13')]);}})[_0xe6b5('0x17')](function(_0x2f5029){logger[_0xe6b5('0x10')](_0xe6b5('0x12'),_0x31825e,_0x2f5029);_0x1451c2(_0x2f5029);});});}exports['GetTrigger']=function(_0x391fd2){var _0x419b47=this;return new Promise(function(_0x3534a2,_0x4da487){return db[_0xe6b5('0x18')][_0xe6b5('0x19')]({'raw':_0x391fd2[_0xe6b5('0x1a')]?_0x391fd2[_0xe6b5('0x1a')][_0xe6b5('0x1b')]===undefined?!![]:![]:!![],'where':_0x391fd2[_0xe6b5('0x1a')]?_0x391fd2[_0xe6b5('0x1a')][_0xe6b5('0x1c')]||null:null,'attributes':_0x391fd2[_0xe6b5('0x1a')]?_0x391fd2[_0xe6b5('0x1a')][_0xe6b5('0x1d')]||null:null,'limit':_0x391fd2['options']?_0x391fd2[_0xe6b5('0x1a')][_0xe6b5('0x1e')]||null:null,'include':_0x391fd2[_0xe6b5('0x1a')]?_0x391fd2[_0xe6b5('0x1a')][_0xe6b5('0x1f')]?_['map'](_0x391fd2['options'][_0xe6b5('0x1f')],function(_0x4c4bc1){return{'model':db[_0x4c4bc1['model']],'as':_0x4c4bc1['as'],'attributes':_0x4c4bc1[_0xe6b5('0x1d')],'include':_0x4c4bc1[_0xe6b5('0x1f')]?_[_0xe6b5('0x20')](_0x4c4bc1['include'],function(_0x31406c){return{'model':db[_0x31406c[_0xe6b5('0x21')]],'as':_0x31406c['as'],'attributes':_0x31406c[_0xe6b5('0x1d')],'include':_0x31406c['include']?_[_0xe6b5('0x20')](_0x31406c[_0xe6b5('0x1f')],function(_0x55833e){return{'model':db[_0x55833e[_0xe6b5('0x21')]],'as':_0x55833e['as'],'attributes':_0x55833e[_0xe6b5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe6b5('0xd')](function(_0x2dcda7){logger['info']('GetTrigger',_0x391fd2);logger[_0xe6b5('0x22')]('GetTrigger',_0x391fd2,JSON[_0xe6b5('0xf')](_0x2dcda7));_0x3534a2(_0x2dcda7);})[_0xe6b5('0x17')](function(_0x458a60){logger['error'](_0xe6b5('0x23'),_0x458a60['message'],_0x391fd2);_0x4da487(_0x419b47[_0xe6b5('0x10')](0x1f4,_0x458a60['message']));});});};exports[_0xe6b5('0x24')]=function(_0x19cdf1){var _0x26a6ea=this;return new Promise(function(_0x4bed92,_0xb8321a){return db[_0xe6b5('0x18')][_0xe6b5('0x25')]({'raw':_0x19cdf1['options']?_0x19cdf1[_0xe6b5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x19cdf1[_0xe6b5('0x1a')]?_0x19cdf1[_0xe6b5('0x1a')][_0xe6b5('0x1c')]||null:null,'attributes':_0x19cdf1[_0xe6b5('0x1a')]?_0x19cdf1[_0xe6b5('0x1a')][_0xe6b5('0x1d')]||null:null,'include':_0x19cdf1[_0xe6b5('0x1a')]?_0x19cdf1['options'][_0xe6b5('0x1f')]?_['map'](_0x19cdf1[_0xe6b5('0x1a')][_0xe6b5('0x1f')],function(_0x2613c5){return{'model':db[_0x2613c5[_0xe6b5('0x21')]],'as':_0x2613c5['as'],'attributes':_0x2613c5[_0xe6b5('0x1d')],'include':_0x2613c5[_0xe6b5('0x1f')]?_[_0xe6b5('0x20')](_0x2613c5[_0xe6b5('0x1f')],function(_0x3cab54){return{'model':db[_0x3cab54[_0xe6b5('0x21')]],'as':_0x3cab54['as'],'attributes':_0x3cab54[_0xe6b5('0x1d')],'include':_0x3cab54[_0xe6b5('0x1f')]?_['map'](_0x3cab54[_0xe6b5('0x1f')],function(_0x2a2332){return{'model':db[_0x2a2332[_0xe6b5('0x21')]],'as':_0x2a2332['as'],'attributes':_0x2a2332['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e1b7a){logger[_0xe6b5('0x14')](_0xe6b5('0x24'),_0x19cdf1);logger[_0xe6b5('0x22')](_0xe6b5('0x24'),_0x19cdf1,JSON[_0xe6b5('0xf')](_0x4e1b7a));_0x4bed92(_0x4e1b7a);})[_0xe6b5('0x17')](function(_0x3a7933){logger[_0xe6b5('0x10')](_0xe6b5('0x24'),_0x3a7933[_0xe6b5('0x13')],_0x19cdf1);_0xb8321a(_0x26a6ea[_0xe6b5('0x10')](0x1f4,_0x3a7933[_0xe6b5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 23ba2a1..df28bb6 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 _0xa681=['/:id/clone','isAuthenticated','clone','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','post'];(function(_0x21bcc5,_0x3c0552){var _0xc62ace=function(_0x10019f){while(--_0x10019f){_0x21bcc5['push'](_0x21bcc5['shift']());}};_0xc62ace(++_0x3c0552);}(_0xa681,0x1ac));var _0x1a68=function(_0x186ab3,_0x27ebb7){_0x186ab3=_0x186ab3-0x0;var _0x553305=_0xa681[_0x186ab3];return _0x553305;};'use strict';var multer=require(_0x1a68('0x0'));var util=require(_0x1a68('0x1'));var path=require(_0x1a68('0x2'));var timeout=require(_0x1a68('0x3'));var express=require(_0x1a68('0x4'));var router=express[_0x1a68('0x5')]();var fs_extra=require(_0x1a68('0x6'));var auth=require(_0x1a68('0x7'));var interaction=require(_0x1a68('0x8'));var config=require('../../config/environment');var controller=require('./trunk.controller');router[_0x1a68('0x9')]('/',auth['isAuthenticated'](),controller[_0x1a68('0xa')]);router[_0x1a68('0x9')](_0x1a68('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1a68('0xc')](_0x1a68('0xd'),auth[_0x1a68('0xe')](),controller[_0x1a68('0xf')]);router[_0x1a68('0xc')]('/',auth['isAuthenticated'](),controller[_0x1a68('0x10')]);router['put'](_0x1a68('0xb'),auth[_0x1a68('0xe')](),controller[_0x1a68('0x11')]);router[_0x1a68('0x12')](_0x1a68('0xb'),auth[_0x1a68('0xe')](),controller[_0x1a68('0x13')]);module[_0x1a68('0x14')]=router; \ No newline at end of file +var _0x110a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','show','post','/:id/clone','create','put','/:id','update','delete','destroy','multer','util'];(function(_0x25eb68,_0x2b9197){var _0x359151=function(_0x32ea66){while(--_0x32ea66){_0x25eb68['push'](_0x25eb68['shift']());}};_0x359151(++_0x2b9197);}(_0x110a,0xa6));var _0xa110=function(_0x50ce0c,_0x541b68){_0x50ce0c=_0x50ce0c-0x0;var _0x3c988c=_0x110a[_0x50ce0c];return _0x3c988c;};'use strict';var multer=require(_0xa110('0x0'));var util=require(_0xa110('0x1'));var path=require('path');var timeout=require(_0xa110('0x2'));var express=require(_0xa110('0x3'));var router=express[_0xa110('0x4')]();var fs_extra=require(_0xa110('0x5'));var auth=require(_0xa110('0x6'));var interaction=require(_0xa110('0x7'));var config=require('../../config/environment');var controller=require(_0xa110('0x8'));router[_0xa110('0x9')]('/',auth[_0xa110('0xa')](),controller[_0xa110('0xb')]);router[_0xa110('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa110('0xc')]);router[_0xa110('0xd')](_0xa110('0xe'),auth[_0xa110('0xa')](),controller['clone']);router[_0xa110('0xd')]('/',auth['isAuthenticated'](),controller[_0xa110('0xf')]);router[_0xa110('0x10')](_0xa110('0x11'),auth[_0xa110('0xa')](),controller[_0xa110('0x12')]);router[_0xa110('0x13')](_0xa110('0x11'),auth[_0xa110('0xa')](),controller[_0xa110('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 77aeaba..e3d981b 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 _0x886b=['getDataValue','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','join','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','uac','uas','pai','fingerprint','certificate','passive','actpass','dynamic','BOOLEAN','exports','STRING','name','friend','user','peer','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport'];(function(_0x1b48ea,_0x1c0804){var _0x1a0706=function(_0x103c31){while(--_0x103c31){_0x1b48ea['push'](_0x1b48ea['shift']());}};_0x1a0706(++_0x1c0804);}(_0x886b,0x179));var _0xb886=function(_0x3367a4,_0x18511b){_0x3367a4=_0x3367a4-0x0;var _0x4bc569=_0x886b[_0x3367a4];return _0x4bc569;};'use strict';var Sequelize=require('sequelize');module[_0xb886('0x0')]={'name':{'type':Sequelize[_0xb886('0x1')],'allowNull':![],'unique':_0xb886('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xb886('0x3'),_0xb886('0x4'),_0xb886('0x5')),'allowNull':![],'defaultValue':_0xb886('0x3')},'context':{'type':Sequelize[_0xb886('0x1')],'allowNull':![],'defaultValue':_0xb886('0x6')},'callingpres':{'type':Sequelize[_0xb886('0x7')](_0xb886('0x8'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0xb886('0x9'),_0xb886('0xa'),'PROHIB_PASSED_SCREEN',_0xb886('0xb'),_0xb886('0xc'))},'deny':{'type':Sequelize[_0xb886('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xb886('0x1')]},'md5secret':{'type':Sequelize[_0xb886('0x1')]},'remotesecret':{'type':Sequelize[_0xb886('0x1')]},'transport':{'type':Sequelize[_0xb886('0x1')],'defaultValue':_0xb886('0xd'),'set':function(_0x535144){this['setDataValue'](_0xb886('0xe'),_0x535144?_0x535144['join'](','):null);},'get':function(){return this[_0xb886('0xf')](_0xb886('0xe'))?this[_0xb886('0xf')](_0xb886('0xe'))[_0xb886('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xb886('0x7')](_0xb886('0x11'),_0xb886('0x12'),_0xb886('0x13'),_0xb886('0x14'),_0xb886('0x15')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xb886('0x7')](_0xb886('0x16'),'no',_0xb886('0x17'),_0xb886('0x18'),_0xb886('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xb886('0x7')](_0xb886('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xb886('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x53efca){this[_0xb886('0x1a')](_0xb886('0x1b'),_0x53efca?_0x53efca['join'](','):null);},'get':function(){return this[_0xb886('0xf')](_0xb886('0x1b'))?this['getDataValue']('nat')[_0xb886('0x10')](','):null;},'comment':_0xb886('0x1c')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xb886('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xb886('0x1')]},'language':{'type':Sequelize[_0xb886('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xb886('0x1')],'defaultValue':_0xb886('0x1d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x180ed9){this[_0xb886('0x1a')](_0xb886('0x1e'),_0x180ed9?_0x180ed9[_0xb886('0x1f')](';'):_0xb886('0x20'));},'get':function(){return this[_0xb886('0xf')](_0xb886('0x1e'))?this[_0xb886('0xf')](_0xb886('0x1e'))['split'](';'):null;},'comment':_0xb886('0x21')},'autoframing':{'type':Sequelize[_0xb886('0x7')]('yes','no')},'insecure':{'type':Sequelize[_0xb886('0x1')],'defaultValue':_0xb886('0x22'),'set':function(_0x59e866){this[_0xb886('0x1a')](_0xb886('0x23'),_0x59e866?_0x59e866[_0xb886('0x1f')](','):null);},'get':function(){return this[_0xb886('0xf')]('insecure')?this[_0xb886('0xf')](_0xb886('0x23'))[_0xb886('0x10')](','):null;},'comment':_0xb886('0x24')},'trustrpid':{'type':Sequelize['ENUM'](_0xb886('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xb886('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0xb886('0x25'))},'promiscredir':{'type':Sequelize[_0xb886('0x7')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0xb886('0x16'),'no')},'accountcode':{'type':Sequelize[_0xb886('0x26')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xb886('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xb886('0x7')](_0xb886('0x16'),'no'),'defaultValue':_0xb886('0x16')},'busylevel':{'type':Sequelize[_0xb886('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0xb886('0x7')](_0xb886('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0xb886('0x7')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xb886('0x7')](_0xb886('0x16'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xb886('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0xb886('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0xb886('0x16'),'no',_0xb886('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xb886('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0xb886('0x1')]},'session_timers':{'type':Sequelize['ENUM']('accept','refuse','originate')},'session_expires':{'type':Sequelize[_0xb886('0x26')](0xb)},'session_minse':{'type':Sequelize[_0xb886('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0xb886('0x7')](_0xb886('0x28'),_0xb886('0x29')),'defaultValue':_0xb886('0x29')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xb886('0x1')]},'fromdomain':{'type':Sequelize[_0xb886('0x1')]},'fromuser':{'type':Sequelize[_0xb886('0x1')]},'port':{'type':Sequelize[_0xb886('0x26')](0x5)},'qualify':{'type':Sequelize[_0xb886('0x7')](_0xb886('0x16'),'no'),'defaultValue':_0xb886('0x16')},'keepalive':{'type':Sequelize[_0xb886('0x26')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xb886('0x1')]},'rtptimeout':{'type':Sequelize[_0xb886('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xb886('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xb886('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0xb886('0x7')](_0xb886('0x16'),'no',_0xb886('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xb886('0x1')]},'timert1':{'type':Sequelize[_0xb886('0x26')](0xb)},'timerb':{'type':Sequelize[_0xb886('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0xb886('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0xb886('0x1')]},'contactdeny':{'type':Sequelize[_0xb886('0x1')]},'contactacl':{'type':Sequelize[_0xb886('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xb886('0x1')]},'use_q850_reason':{'type':Sequelize[_0xb886('0x1')]},'maxforwards':{'type':Sequelize[_0xb886('0x26')](0xb)},'encryption':{'type':Sequelize[_0xb886('0x7')](_0xb886('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb886('0x7')](_0xb886('0x16'),'no')},'force_avp':{'type':Sequelize[_0xb886('0x7')](_0xb886('0x16'),'no')},'icesupport':{'type':Sequelize[_0xb886('0x7')](_0xb886('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0xb886('0x7')](_0xb886('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0xb886('0x7')](_0xb886('0x16'),'no',_0xb886('0x2b'),_0xb886('0x2c'))},'dtlsrekey':{'type':Sequelize[_0xb886('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0xb886('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xb886('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xb886('0x1')]},'dtlscapath':{'type':Sequelize[_0xb886('0x1')]},'dtlssetup':{'type':Sequelize[_0xb886('0x7')]('active',_0xb886('0x2d'),_0xb886('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xb886('0x7')](_0xb886('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xb886('0x1')]},'call_limit':{'type':Sequelize[_0xb886('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xb886('0x7')](_0xb886('0x16'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xb886('0x16'),'no')},'vmexten':{'type':Sequelize[_0xb886('0x1')]},'mohinterpret':{'type':Sequelize[_0xb886('0x1')]},'mohsuggest':{'type':Sequelize[_0xb886('0x1')]},'parkinglot':{'type':Sequelize[_0xb886('0x1')]},'description':{'type':Sequelize[_0xb886('0x1')]},'host':{'type':Sequelize[_0xb886('0x1')],'defaultValue':_0xb886('0x2f')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0xb886('0x17'),_0xb886('0x18'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xb886('0x1')]},'otherFields':{'type':Sequelize[_0xb886('0x1')]},'active':{'type':Sequelize[_0xb886('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xb886('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x349a=['PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','outgoing','force_rport,comedia','nat','split','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','uas','pai','certificate','active','passive','actpass','dynamic','nonat','update','update,nonat','BOOLEAN','sequelize','STRING','name','ENUM','user','peer','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x349a,0x160));var _0xa349=function(_0x48d3fa,_0x3808a6){_0x48d3fa=_0x48d3fa-0x0;var _0x4c4995=_0x349a[_0x48d3fa];return _0x4c4995;};'use strict';var Sequelize=require(_0xa349('0x0'));module['exports']={'name':{'type':Sequelize[_0xa349('0x1')],'allowNull':![],'unique':_0xa349('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa349('0x3')]('friend',_0xa349('0x4'),_0xa349('0x5')),'allowNull':![],'defaultValue':_0xa349('0x6')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa349('0x7')},'callingpres':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x8'),'ALLOWED_PASSED_SCREEN',_0xa349('0x9'),_0xa349('0xa'),_0xa349('0xb'),_0xa349('0xc'),_0xa349('0xd'),_0xa349('0xe'))},'deny':{'type':Sequelize[_0xa349('0x1')]},'permit':{'type':Sequelize[_0xa349('0x1')]},'secret':{'type':Sequelize[_0xa349('0x1')]},'md5secret':{'type':Sequelize[_0xa349('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xa349('0x1')],'defaultValue':'udp','set':function(_0x22c865){this[_0xa349('0xf')](_0xa349('0x10'),_0x22c865?_0x22c865[_0xa349('0x11')](','):null);},'get':function(){return this[_0xa349('0x12')](_0xa349('0x10'))?this[_0xa349('0x12')](_0xa349('0x10'))['split'](','):null;},'comment':_0xa349('0x13')},'dtmfmode':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x14'),_0xa349('0x15'),_0xa349('0x16'),_0xa349('0x17'),'auto'),'defaultValue':_0xa349('0x14')},'directmedia':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no','nonat','update',_0xa349('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa349('0x1')]},'directmediadeny':{'type':Sequelize[_0xa349('0x1')]},'nat':{'type':Sequelize[_0xa349('0x1')],'defaultValue':_0xa349('0x1a'),'set':function(_0x54d66a){this[_0xa349('0xf')]('nat',_0x54d66a?_0x54d66a[_0xa349('0x11')](','):null);},'get':function(){return this[_0xa349('0x12')](_0xa349('0x1b'))?this['getDataValue'](_0xa349('0x1b'))[_0xa349('0x1c')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xa349('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xa349('0x1')]},'language':{'type':Sequelize[_0xa349('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa349('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xa349('0x1')],'defaultValue':_0xa349('0x1d')},'allow':{'type':Sequelize[_0xa349('0x1')],'allowNull':![],'defaultValue':_0xa349('0x1e'),'set':function(_0x24a8ba){this[_0xa349('0xf')](_0xa349('0x1f'),_0x24a8ba?_0x24a8ba['join'](';'):_0xa349('0x1e'));},'get':function(){return this[_0xa349('0x12')](_0xa349('0x1f'))?this[_0xa349('0x12')](_0xa349('0x1f'))[_0xa349('0x1c')](';'):null;},'comment':_0xa349('0x20')},'autoframing':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no')},'insecure':{'type':Sequelize[_0xa349('0x1')],'defaultValue':_0xa349('0x21'),'set':function(_0x47f51b){this[_0xa349('0xf')](_0xa349('0x22'),_0x47f51b?_0x47f51b[_0xa349('0x11')](','):null);},'get':function(){return this['getDataValue'](_0xa349('0x22'))?this[_0xa349('0x12')](_0xa349('0x22'))[_0xa349('0x1c')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xa349('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa349('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa349('0x3')]('yes','no','never')},'promiscredir':{'type':Sequelize[_0xa349('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no')},'accountcode':{'type':Sequelize[_0xa349('0x23')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa349('0x1')],'defaultValue':_0xa349('0x24')},'amaflags':{'type':Sequelize[_0xa349('0x1')]},'callcounter':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no'),'defaultValue':_0xa349('0x18')},'busylevel':{'type':Sequelize[_0xa349('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xa349('0x1')]},'template':{'type':Sequelize[_0xa349('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0xa349('0x18'),'no',_0xa349('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa349('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no')},'mailbox':{'type':Sequelize[_0xa349('0x1')]},'session_timers':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x26'),_0xa349('0x27'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xa349('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x28'),_0xa349('0x29')),'defaultValue':_0xa349('0x29')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xa349('0x1')]},'fromuser':{'type':Sequelize[_0xa349('0x1')]},'port':{'type':Sequelize[_0xa349('0x23')](0x5)},'qualify':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no'),'defaultValue':_0xa349('0x18')},'keepalive':{'type':Sequelize[_0xa349('0x23')](0xb)},'defaultip':{'type':Sequelize[_0xa349('0x1')]},'defaultuser':{'type':Sequelize[_0xa349('0x1')]},'rtptimeout':{'type':Sequelize[_0xa349('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xa349('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no',_0xa349('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xa349('0x23')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xa349('0x1')]},'contactdeny':{'type':Sequelize[_0xa349('0x1')]},'contactacl':{'type':Sequelize[_0xa349('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xa349('0x1')]},'use_q850_reason':{'type':Sequelize[_0xa349('0x1')]},'maxforwards':{'type':Sequelize[_0xa349('0x23')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xa349('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no')},'force_avp':{'type':Sequelize[_0xa349('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xa349('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0xa349('0x2b'))},'dtlsrekey':{'type':Sequelize[_0xa349('0x23')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xa349('0x1')]},'dtlscafile':{'type':Sequelize[_0xa349('0x1')]},'dtlscapath':{'type':Sequelize[_0xa349('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xa349('0x2c'),_0xa349('0x2d'),_0xa349('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa349('0x1')]},'usereqphone':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa349('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xa349('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xa349('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0xa349('0x1')]},'mohinterpret':{'type':Sequelize[_0xa349('0x1')]},'mohsuggest':{'type':Sequelize[_0xa349('0x1')]},'parkinglot':{'type':Sequelize[_0xa349('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0xa349('0x2f')},'canreinvite':{'type':Sequelize[_0xa349('0x3')](_0xa349('0x18'),'no',_0xa349('0x30'),_0xa349('0x31'),_0xa349('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xa349('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xa349('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xa349('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index dc12ff9..b70035c 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 _0x008c=['update','destroy','get','Trunks','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','Trunk','findAll','show','params','includeAll','include','options','clone','find','omit','createdAt','updatedAt','body','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','utf8','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','Reload','chan_sip.so','server/files/templates/trunk.ejs','join','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save'];(function(_0x1f0c9b,_0x234e61){var _0x1283e6=function(_0x5e157c){while(--_0x5e157c){_0x1f0c9b['push'](_0x1f0c9b['shift']());}};_0x1283e6(++_0x234e61);}(_0x008c,0x188));var _0xc008=function(_0x3c4087,_0x5c764b){_0x3c4087=_0x3c4087-0x0;var _0x23ad1f=_0x008c[_0x3c4087];return _0x23ad1f;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];var jayson=require(_0xc008('0x18'));var client=jayson[_0xc008('0x19')][_0xc008('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x593f7a,_0x560e28,_0x33f44c,_0x50c1ab){return new BPromise(function(_0x25e13f,_0x4584e1){var _0x2073ef=_0x50c1ab||client;return _0x2073ef[_0xc008('0x1b')](_0x593f7a,_0x33f44c)[_0xc008('0x1c')](function(_0x5ee00b){logger['info']('Trunk,\x20%s,\x20%s',_0x560e28,_0xc008('0x1d'));logger[_0xc008('0x1e')](_0xc008('0x1f'),_0x560e28,_0xc008('0x1d'),JSON['stringify'](_0x5ee00b));if(_0x5ee00b['error']){if(_0x5ee00b['error']['code']===0x1f4){logger[_0xc008('0x20')](_0xc008('0x21'),_0x560e28,_0x5ee00b['error'][_0xc008('0x22')]);return _0x4584e1(_0x5ee00b['error']['message']);}logger['error']('Trunk,\x20%s,\x20%s',_0x560e28,_0x5ee00b[_0xc008('0x20')]['message']);return _0x25e13f(_0x5ee00b['error']['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x560e28,_0xc008('0x1d'));_0x25e13f(_0x5ee00b[_0xc008('0x23')][_0xc008('0x22')]);}})[_0xc008('0x24')](function(_0x11cc75){logger[_0xc008('0x20')]('Trunk,\x20%s,\x20%s',_0x560e28,_0x11cc75);_0x4584e1(_0x11cc75);});});}function respondWithStatusCode(_0x459fd9,_0x5c85f2){_0x5c85f2=_0x5c85f2||0xcc;return function(_0x58a6ea){if(_0x58a6ea){return _0x459fd9[_0xc008('0x25')](_0x5c85f2);}return _0x459fd9[_0xc008('0x26')](_0x5c85f2)[_0xc008('0x27')]();};}function respondWithResult(_0x3cb28c,_0x5410f5){_0x5410f5=_0x5410f5||0xc8;return function(_0x48582b){if(_0x48582b){return _0x3cb28c['status'](_0x5410f5)[_0xc008('0x28')](_0x48582b);}};}function respondWithFilteredResult(_0x15dade,_0x92c582){return function(_0x2e31c2){if(_0x2e31c2){var _0x5bebd9=typeof _0x92c582['offset']==='undefined'&&typeof _0x92c582['limit']==='undefined';var _0x3865c0=_0x2e31c2[_0xc008('0x29')];var _0x25eae4=_0x5bebd9?0x0:_0x92c582['offset'];var _0x24c14c=_0x5bebd9?_0x2e31c2[_0xc008('0x29')]:_0x92c582[_0xc008('0x2a')]+_0x92c582[_0xc008('0x2b')];var _0x4c5dec;if(_0x24c14c>=_0x3865c0){_0x24c14c=_0x3865c0;_0x4c5dec=0xc8;}else{_0x4c5dec=0xce;}_0x15dade[_0xc008('0x26')](_0x4c5dec);return _0x15dade[_0xc008('0x2c')]('Content-Range',_0x25eae4+'-'+_0x24c14c+'/'+_0x3865c0)['json'](_0x2e31c2);}return null;};}function patchUpdates(_0x539766){return function(_0x1032b2){try{jsonpatch[_0xc008('0x2d')](_0x1032b2,_0x539766,!![]);}catch(_0xf831f2){return BPromise[_0xc008('0x2e')](_0xf831f2);}return _0x1032b2[_0xc008('0x2f')]();};}function saveUpdates(_0xceebc3,_0x294f97){return function(_0x22d8e8){if(_0x22d8e8){return _0x22d8e8[_0xc008('0x30')](_0xceebc3)[_0xc008('0x1c')](function(_0x2f4b6b){return _0x2f4b6b;});}return null;};}function removeEntity(_0x1ac7c8,_0x596ee8){return function(_0x334a09){if(_0x334a09){return _0x334a09[_0xc008('0x31')]()['then'](function(){var _0xaf4b84=_0x334a09[_0xc008('0x32')]({'plain':!![]});var _0x383be7=_0xc008('0x33');return db[_0xc008('0x34')][_0xc008('0x31')]({'where':{'type':_0x383be7,'resourceId':_0xaf4b84['id']}})[_0xc008('0x1c')](function(){return _0x334a09;});})[_0xc008('0x1c')](function(){_0x1ac7c8[_0xc008('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415b87,_0x389a40){return function(_0x459df4){if(!_0x459df4){_0x415b87[_0xc008('0x25')](0x194);}return _0x459df4;};}function handleError(_0x40002f,_0x315562){_0x315562=_0x315562||0x1f4;return function(_0x1667a0){logger['error'](_0x1667a0[_0xc008('0x35')]);if(_0x1667a0[_0xc008('0x36')]){delete _0x1667a0['name'];}_0x40002f[_0xc008('0x26')](_0x315562)[_0xc008('0x37')](_0x1667a0);};}exports['index']=function(_0x263473,_0x2e4ae1){var _0x280e9b={},_0x55ff48={},_0x53b353={'count':0x0,'rows':[]};var _0x478810=_[_0xc008('0x38')](db['Trunk'][_0xc008('0x39')],function(_0x3884dd){return{'name':_0x3884dd[_0xc008('0x3a')],'type':_0x3884dd[_0xc008('0x3b')][_0xc008('0x3c')]};});_0x55ff48[_0xc008('0x3d')]=_[_0xc008('0x38')](_0x478810,_0xc008('0x36'));_0x55ff48[_0xc008('0x3e')]=_[_0xc008('0x3f')](_0x263473[_0xc008('0x3e')]);_0x55ff48[_0xc008('0x40')]=_[_0xc008('0x41')](_0x55ff48[_0xc008('0x3d')],_0x55ff48['query']);_0x280e9b[_0xc008('0x42')]=_[_0xc008('0x41')](_0x55ff48[_0xc008('0x3d')],qs[_0xc008('0x43')](_0x263473['query'][_0xc008('0x43')]));_0x280e9b[_0xc008('0x42')]=_0x280e9b[_0xc008('0x42')][_0xc008('0x44')]?_0x280e9b[_0xc008('0x42')]:_0x55ff48['model'];if(!_0x263473[_0xc008('0x3e')][_0xc008('0x45')](_0xc008('0x46'))){_0x280e9b[_0xc008('0x2b')]=qs[_0xc008('0x2b')](_0x263473['query'][_0xc008('0x2b')]);_0x280e9b[_0xc008('0x2a')]=qs[_0xc008('0x2a')](_0x263473[_0xc008('0x3e')]['offset']);}_0x280e9b[_0xc008('0x47')]=qs[_0xc008('0x48')](_0x263473[_0xc008('0x3e')]['sort']);_0x280e9b[_0xc008('0x49')]=qs['filters'](_[_0xc008('0x4a')](_0x263473['query'],_0x55ff48[_0xc008('0x40')]),_0x478810);if(_0x263473[_0xc008('0x3e')]['filter']){_0x280e9b[_0xc008('0x49')]=_[_0xc008('0x4b')](_0x280e9b[_0xc008('0x49')],{'$or':_['map'](_0x478810,function(_0x1cec64){if(_0x1cec64[_0xc008('0x3b')]!==_0xc008('0x4c')){var _0x44fc5d={};_0x44fc5d[_0x1cec64[_0xc008('0x36')]]={'$like':'%'+_0x263473[_0xc008('0x3e')]['filter']+'%'};return _0x44fc5d;}})});}_0x280e9b=_['merge']({},_0x280e9b,_0x263473['options']);var _0x4552ed={'where':_0x280e9b[_0xc008('0x49')]};return db[_0xc008('0x4d')][_0xc008('0x29')](_0x4552ed)[_0xc008('0x1c')](function(_0x24f6a4){_0x53b353[_0xc008('0x29')]=_0x24f6a4;if(_0x263473[_0xc008('0x3e')]['includeAll']){_0x280e9b['include']=[{'all':!![]}];}return db['Trunk'][_0xc008('0x4e')](_0x280e9b);})[_0xc008('0x1c')](function(_0x158eae){_0x53b353['rows']=_0x158eae;return _0x53b353;})[_0xc008('0x1c')](respondWithFilteredResult(_0x2e4ae1,_0x280e9b))[_0xc008('0x24')](handleError(_0x2e4ae1,null));};exports[_0xc008('0x4f')]=function(_0x1c2c50,_0x4981b4){var _0x56e4ac={'raw':![],'where':{'id':_0x1c2c50[_0xc008('0x50')]['id']}},_0x17ec90={};_0x17ec90[_0xc008('0x3d')]=_[_0xc008('0x3f')](db['Trunk']['rawAttributes']);_0x17ec90[_0xc008('0x3e')]=_['keys'](_0x1c2c50[_0xc008('0x3e')]);_0x17ec90[_0xc008('0x40')]=_[_0xc008('0x41')](_0x17ec90['model'],_0x17ec90[_0xc008('0x3e')]);_0x56e4ac[_0xc008('0x42')]=_[_0xc008('0x41')](_0x17ec90[_0xc008('0x3d')],qs[_0xc008('0x43')](_0x1c2c50['query'][_0xc008('0x43')]));_0x56e4ac[_0xc008('0x42')]=_0x56e4ac['attributes'][_0xc008('0x44')]?_0x56e4ac[_0xc008('0x42')]:_0x17ec90['model'];if(_0x1c2c50['query'][_0xc008('0x51')]){_0x56e4ac[_0xc008('0x52')]=[{'all':!![]}];}_0x56e4ac=_[_0xc008('0x4b')]({},_0x56e4ac,_0x1c2c50[_0xc008('0x53')]);return db[_0xc008('0x4d')]['find'](_0x56e4ac)['then'](handleEntityNotFound(_0x4981b4,null))[_0xc008('0x1c')](respondWithResult(_0x4981b4,null))['catch'](handleError(_0x4981b4,null));};exports[_0xc008('0x54')]=function(_0x25d351,_0xf94fcb){var _0x2f1105={'where':{'id':_0x25d351[_0xc008('0x50')]['id']}},_0x44f42d={};_0x44f42d['model']=_[_0xc008('0x3f')](db[_0xc008('0x4d')][_0xc008('0x39')]);_0x2f1105[_0xc008('0x42')]=_[_0xc008('0x41')](_0x44f42d['model'],qs[_0xc008('0x43')](_0x25d351['query']['fields']));_0x2f1105['attributes']=_0x2f1105[_0xc008('0x42')][_0xc008('0x44')]?_0x2f1105[_0xc008('0x42')]:_0x44f42d['model'];if(_0x25d351[_0xc008('0x3e')][_0xc008('0x51')]){_0x2f1105[_0xc008('0x52')]=[{'all':!![]}];}_0x2f1105=_['merge']({},_0x2f1105,_0x25d351[_0xc008('0x53')]);return db[_0xc008('0x4d')][_0xc008('0x55')](_0x2f1105)[_0xc008('0x1c')](handleEntityNotFound(_0xf94fcb,null))['then'](function(_0x4022dd){if(_0x4022dd){var _0x4eaa6d=_0x4022dd[_0xc008('0x32')]({'plain':!![]});_0x4eaa6d=qs[_0xc008('0x56')](_0x4eaa6d,['id',_0xc008('0x57'),_0xc008('0x58')]);_0x25d351[_0xc008('0x59')]=_[_0xc008('0x56')](_0x25d351['body'],['id',_0xc008('0x57'),'updatedAt']);return db['Trunk'][_0xc008('0x5a')](_[_0xc008('0x4b')](_0x4eaa6d,_0x25d351['body']),{'include':_0x25d351[_0xc008('0x3e')][_0xc008('0x51')]?[{'all':!![]}]:undefined})[_0xc008('0x1c')](function(_0x4517c0){var _0x21ee6d=_0x25d351[_0xc008('0x5b')][_0xc008('0x32')]({'plain':!![]});if(!_0x21ee6d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21ee6d[_0xc008('0x5c')]===_0xc008('0x5b')){var _0x3bfb15=_0x4517c0[_0xc008('0x32')]({'plain':!![]});var _0xb3ca0f=_0xc008('0x33');return db[_0xc008('0x5d')][_0xc008('0x55')]({'where':{'name':_0xb3ca0f,'userProfileId':_0x21ee6d[_0xc008('0x5e')]},'raw':!![]})[_0xc008('0x1c')](function(_0x1bef66){if(_0x1bef66&&_0x1bef66[_0xc008('0x5f')]===0x0){return db[_0xc008('0x34')][_0xc008('0x5a')]({'name':_0x3bfb15['name'],'resourceId':_0x3bfb15['id'],'type':_0x1bef66[_0xc008('0x36')],'sectionId':_0x1bef66['id']},{})[_0xc008('0x1c')](function(){return _0x4517c0;});}else{return _0x4517c0;}})[_0xc008('0x24')](function(_0x566dea){logger[_0xc008('0x20')](_0xc008('0x60'),_0x566dea);throw _0x566dea;});}return _0x4517c0;});}})['then'](respondWithResult(_0xf94fcb,0xc9))['catch'](handleError(_0xf94fcb,null));};exports[_0xc008('0x5a')]=function(_0x2a4c2b,_0x7bad14,_0x39083c){var _0x1a2ce7;return db[_0xc008('0x4d')][_0xc008('0x5a')](_0x2a4c2b[_0xc008('0x59')],{'raw':!![]})[_0xc008('0x1c')](function(_0x1b059b){_0x1a2ce7=_0x1b059b;return db[_0xc008('0x4d')]['findAll']({'raw':!![]});})[_0xc008('0x1c')](function(_0x25a52b){var _0xfdb5e3=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],'server/files/templates/trunk.ejs'),_0xc008('0x63'));var _0x46fa7b=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],_0xc008('0x64')),_0xc008('0x63'));var _0x553f5c=ejs[_0xc008('0x65')](_0xfdb5e3,{'trunks':_0x25a52b||[]});fs['writeFileSync'](_0xc008('0x66'),_0x553f5c);if(_0x1a2ce7[_0xc008('0x67')]){var _0x23012c=ejs[_0xc008('0x65')](_0x46fa7b,{'trunks':_0x25a52b||[]});fs[_0xc008('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x23012c);}})[_0xc008('0x1c')](function(){return respondWithRpcPromise(_0xc008('0x69'),'create',{'module':_0xc008('0x6a')});})['then'](function(){var _0x278cbe=_0x2a4c2b['user'][_0xc008('0x32')]({'plain':!![]});if(!_0x278cbe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x278cbe[_0xc008('0x5c')]===_0xc008('0x5b')){var _0x33d8e4=_0x1a2ce7[_0xc008('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xc008('0x55')]({'where':{'name':_0xc008('0x33'),'userProfileId':_0x278cbe[_0xc008('0x5e')]},'raw':!![]})[_0xc008('0x1c')](function(_0x321500){if(_0x321500&&_0x321500[_0xc008('0x5f')]===0x0){return db[_0xc008('0x34')][_0xc008('0x5a')]({'name':_0x33d8e4['name'],'resourceId':_0x33d8e4['id'],'type':_0x321500[_0xc008('0x36')],'sectionId':_0x321500['id']},{})['then'](function(){return _0x1a2ce7;});}else{return _0x1a2ce7;}})['catch'](function(_0x4c84da){logger[_0xc008('0x20')](_0xc008('0x60'),_0x4c84da);throw _0x4c84da;});}return _0x1a2ce7;})[_0xc008('0x1c')](respondWithResult(_0x7bad14,0xc9))[_0xc008('0x24')](handleError(_0x7bad14,null));};exports[_0xc008('0x30')]=function(_0x2e9646,_0x23ef42,_0x519328){var _0x127bdf;return db['Trunk'][_0xc008('0x55')]({'where':{'id':_0x2e9646[_0xc008('0x50')]['id']}})[_0xc008('0x1c')](handleEntityNotFound(_0x23ef42,null))[_0xc008('0x1c')](saveUpdates(_0x2e9646[_0xc008('0x59')],null))[_0xc008('0x1c')](function(_0x23d4ff){if(_0x23d4ff){_0x127bdf=_0x23d4ff;return db[_0xc008('0x4d')][_0xc008('0x4e')]({'raw':!![]});}})[_0xc008('0x1c')](function(_0x334ed8){if(_0x334ed8){var _0x1dd9fe=fs['readFileSync'](path['join'](config[_0xc008('0x62')],_0xc008('0x6b')),_0xc008('0x63'));var _0x572d93=fs[_0xc008('0x61')](path[_0xc008('0x6c')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x3fc44f=ejs[_0xc008('0x65')](_0x1dd9fe,{'trunks':_0x334ed8||[]});fs[_0xc008('0x68')](_0xc008('0x66'),_0x3fc44f);var _0x1101b8=ejs[_0xc008('0x65')](_0x572d93,{'trunks':_0x334ed8||[]});fs[_0xc008('0x68')](_0xc008('0x6d'),_0x1101b8);return respondWithRpcPromise(_0xc008('0x69'),_0xc008('0x30'),{'module':'chan_sip.so'});}return null;})['then'](function(_0xc644fe){if(_0xc644fe){return _0x127bdf;}})[_0xc008('0x1c')](respondWithResult(_0x23ef42,null))[_0xc008('0x24')](handleError(_0x23ef42,null));};exports[_0xc008('0x31')]=function(_0x2b94b2,_0x37fc2c,_0x4b434f){var _0x5794fe;return db[_0xc008('0x4d')][_0xc008('0x55')]({'where':{'id':_0x2b94b2[_0xc008('0x50')]['id']}})['then'](handleEntityNotFound(_0x37fc2c,null))['then'](removeEntity(_0x37fc2c,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})['then'](function(_0x276de2){var _0x52bf60=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],_0xc008('0x6b')),_0xc008('0x63'));var _0x5bc8b0=fs['readFileSync'](path[_0xc008('0x6c')](config['root'],_0xc008('0x64')),_0xc008('0x63'));var _0x544519=ejs[_0xc008('0x65')](_0x52bf60,{'trunks':_0x276de2});var _0x4db90b=ejs['render'](_0x5bc8b0,{'trunks':_0x276de2});fs[_0xc008('0x68')](_0xc008('0x66'),_0x544519);fs['writeFileSync'](_0xc008('0x6d'),_0x4db90b);return respondWithRpcPromise(_0xc008('0x69'),_0xc008('0x31'),{'module':'chan_sip.so'});})[_0xc008('0x24')](handleError(_0x37fc2c,null));}; \ No newline at end of file +var _0xb821=['model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Trunk','includeAll','findAll','intersection','length','include','find','params','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','server/files/templates/trunk.ejs','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','root','rimraf','zip-dir','moment','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','jayson/promise','client','http','request','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','Trunk,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','name','send','index','rawAttributes','fieldName','key'];(function(_0x59c352,_0x1a3d99){var _0x24e1ac=function(_0x3e4931){while(--_0x3e4931){_0x59c352['push'](_0x59c352['shift']());}};_0x24e1ac(++_0x1a3d99);}(_0xb821,0xa7));var _0x1b82=function(_0x55f086,_0x138b7b){_0x55f086=_0x55f086-0x0;var _0x3c66f2=_0xb821[_0x55f086];return _0x3c66f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b82('0x0'));var zipdir=require(_0x1b82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b82('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b82('0x3'));var path=require(_0x1b82('0x4'));var sox=require(_0x1b82('0x5'));var csv=require(_0x1b82('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b82('0x7'));var _=require(_0x1b82('0x8'));var squel=require(_0x1b82('0x9'));var crypto=require(_0x1b82('0xa'));var jsforce=require(_0x1b82('0xb'));var deskjs=require(_0x1b82('0xc'));var toCsv=require(_0x1b82('0x6'));var querystring=require(_0x1b82('0xd'));var Papa=require(_0x1b82('0xe'));var Redis=require('ioredis');var authService=require(_0x1b82('0xf'));var qs=require(_0x1b82('0x10'));var as=require(_0x1b82('0x11'));var hardwareService=require(_0x1b82('0x12'));var logger=require(_0x1b82('0x13'))(_0x1b82('0x14'));var utils=require(_0x1b82('0x15'));var config=require(_0x1b82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b82('0x17'))['db'];var jayson=require(_0x1b82('0x18'));var client=jayson[_0x1b82('0x19')][_0x1b82('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x50aed7,_0x1a6285,_0x5767aa,_0x54915f){return new BPromise(function(_0x1e553a,_0x4bf75b){var _0x1cffd1=_0x54915f||client;return _0x1cffd1[_0x1b82('0x1b')](_0x50aed7,_0x5767aa)['then'](function(_0x46c2cf){logger['info']('Trunk,\x20%s,\x20%s',_0x1a6285,_0x1b82('0x1c'));logger['debug'](_0x1b82('0x1d'),_0x1a6285,_0x1b82('0x1c'),JSON[_0x1b82('0x1e')](_0x46c2cf));if(_0x46c2cf['error']){if(_0x46c2cf['error'][_0x1b82('0x1f')]===0x1f4){logger['error'](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x4bf75b(_0x46c2cf['error'][_0x1b82('0x22')]);}logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x1e553a(_0x46c2cf['error'][_0x1b82('0x22')]);}else{logger[_0x1b82('0x23')](_0x1b82('0x20'),_0x1a6285,_0x1b82('0x1c'));_0x1e553a(_0x46c2cf[_0x1b82('0x24')][_0x1b82('0x22')]);}})[_0x1b82('0x25')](function(_0x486e92){logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x486e92);_0x4bf75b(_0x486e92);});});}function respondWithStatusCode(_0x5b8d09,_0x561d78){_0x561d78=_0x561d78||0xcc;return function(_0x225b81){if(_0x225b81){return _0x5b8d09[_0x1b82('0x26')](_0x561d78);}return _0x5b8d09['status'](_0x561d78)[_0x1b82('0x27')]();};}function respondWithResult(_0x4db690,_0x5cd458){_0x5cd458=_0x5cd458||0xc8;return function(_0x5f556b){if(_0x5f556b){return _0x4db690[_0x1b82('0x28')](_0x5cd458)[_0x1b82('0x29')](_0x5f556b);}};}function respondWithFilteredResult(_0xfd00d1,_0x257b79){return function(_0x548a3b){if(_0x548a3b){var _0x222483=typeof _0x257b79[_0x1b82('0x2a')]===_0x1b82('0x2b')&&typeof _0x257b79[_0x1b82('0x2c')]===_0x1b82('0x2b');var _0x1b8b6f=_0x548a3b[_0x1b82('0x2d')];var _0x21ea34=_0x222483?0x0:_0x257b79[_0x1b82('0x2a')];var _0x1f9c6b=_0x222483?_0x548a3b[_0x1b82('0x2d')]:_0x257b79[_0x1b82('0x2a')]+_0x257b79[_0x1b82('0x2c')];var _0x5ea890;if(_0x1f9c6b>=_0x1b8b6f){_0x1f9c6b=_0x1b8b6f;_0x5ea890=0xc8;}else{_0x5ea890=0xce;}_0xfd00d1[_0x1b82('0x28')](_0x5ea890);return _0xfd00d1[_0x1b82('0x2e')](_0x1b82('0x2f'),_0x21ea34+'-'+_0x1f9c6b+'/'+_0x1b8b6f)[_0x1b82('0x29')](_0x548a3b);}return null;};}function patchUpdates(_0x18e4ff){return function(_0x115ce7){try{jsonpatch[_0x1b82('0x30')](_0x115ce7,_0x18e4ff,!![]);}catch(_0x46575f){return BPromise[_0x1b82('0x31')](_0x46575f);}return _0x115ce7[_0x1b82('0x32')]();};}function saveUpdates(_0x501ab0,_0x225c06){return function(_0x29a31e){if(_0x29a31e){return _0x29a31e[_0x1b82('0x33')](_0x501ab0)[_0x1b82('0x34')](function(_0x5b7b18){return _0x5b7b18;});}return null;};}function removeEntity(_0x474218,_0xbf65a){return function(_0x544bd5){if(_0x544bd5){return _0x544bd5[_0x1b82('0x35')]()[_0x1b82('0x34')](function(){var _0x365c3c=_0x544bd5['get']({'plain':!![]});var _0x5efb8e=_0x1b82('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x5efb8e,'resourceId':_0x365c3c['id']}})[_0x1b82('0x34')](function(){return _0x544bd5;});})[_0x1b82('0x34')](function(){_0x474218[_0x1b82('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42a64e,_0x366db3){return function(_0xea774a){if(!_0xea774a){_0x42a64e[_0x1b82('0x26')](0x194);}return _0xea774a;};}function handleError(_0x4dd64a,_0x42c1c4){_0x42c1c4=_0x42c1c4||0x1f4;return function(_0x1cd7de){logger[_0x1b82('0x21')](_0x1cd7de['stack']);if(_0x1cd7de['name']){delete _0x1cd7de[_0x1b82('0x37')];}_0x4dd64a['status'](_0x42c1c4)[_0x1b82('0x38')](_0x1cd7de);};}exports[_0x1b82('0x39')]=function(_0x286b4b,_0x348880){var _0x1255db={},_0x3ab35c={},_0x39fe4a={'count':0x0,'rows':[]};var _0x1368df=_['map'](db['Trunk'][_0x1b82('0x3a')],function(_0x5f4baf){return{'name':_0x5f4baf[_0x1b82('0x3b')],'type':_0x5f4baf['type'][_0x1b82('0x3c')]};});_0x3ab35c[_0x1b82('0x3d')]=_[_0x1b82('0x3e')](_0x1368df,_0x1b82('0x37'));_0x3ab35c[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x286b4b['query']);_0x3ab35c[_0x1b82('0x41')]=_['intersection'](_0x3ab35c[_0x1b82('0x3d')],_0x3ab35c['query']);_0x1255db[_0x1b82('0x42')]=_['intersection'](_0x3ab35c['model'],qs[_0x1b82('0x43')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x1255db[_0x1b82('0x42')]=_0x1255db[_0x1b82('0x42')]['length']?_0x1255db[_0x1b82('0x42')]:_0x3ab35c['model'];if(!_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x44')](_0x1b82('0x45'))){_0x1255db[_0x1b82('0x2c')]=qs[_0x1b82('0x2c')](_0x286b4b['query'][_0x1b82('0x2c')]);_0x1255db['offset']=qs[_0x1b82('0x2a')](_0x286b4b[_0x1b82('0x3f')]['offset']);}_0x1255db[_0x1b82('0x46')]=qs[_0x1b82('0x47')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x47')]);_0x1255db[_0x1b82('0x48')]=qs[_0x1b82('0x41')](_[_0x1b82('0x49')](_0x286b4b['query'],_0x3ab35c[_0x1b82('0x41')]),_0x1368df);if(_0x286b4b['query'][_0x1b82('0x4a')]){_0x1255db[_0x1b82('0x48')]=_[_0x1b82('0x4b')](_0x1255db[_0x1b82('0x48')],{'$or':_[_0x1b82('0x3e')](_0x1368df,function(_0x1d24d6){if(_0x1d24d6[_0x1b82('0x4c')]!==_0x1b82('0x4d')){var _0x192ce3={};_0x192ce3[_0x1d24d6[_0x1b82('0x37')]]={'$like':'%'+_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x4a')]+'%'};return _0x192ce3;}})});}_0x1255db=_[_0x1b82('0x4b')]({},_0x1255db,_0x286b4b[_0x1b82('0x4e')]);var _0x4fb92f={'where':_0x1255db['where']};return db[_0x1b82('0x4f')]['count'](_0x4fb92f)[_0x1b82('0x34')](function(_0x3df0af){_0x39fe4a[_0x1b82('0x2d')]=_0x3df0af;if(_0x286b4b['query'][_0x1b82('0x50')]){_0x1255db['include']=[{'all':!![]}];}return db['Trunk'][_0x1b82('0x51')](_0x1255db);})[_0x1b82('0x34')](function(_0x242324){_0x39fe4a['rows']=_0x242324;return _0x39fe4a;})[_0x1b82('0x34')](respondWithFilteredResult(_0x348880,_0x1255db))[_0x1b82('0x25')](handleError(_0x348880,null));};exports['show']=function(_0x5ca898,_0x106282){var _0x2e676a={'raw':![],'where':{'id':_0x5ca898['params']['id']}},_0x2dc53e={};_0x2dc53e[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db[_0x1b82('0x4f')][_0x1b82('0x3a')]);_0x2dc53e[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x5ca898['query']);_0x2dc53e[_0x1b82('0x41')]=_['intersection'](_0x2dc53e[_0x1b82('0x3d')],_0x2dc53e[_0x1b82('0x3f')]);_0x2e676a['attributes']=_[_0x1b82('0x52')](_0x2dc53e['model'],qs[_0x1b82('0x43')](_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x2e676a[_0x1b82('0x42')]=_0x2e676a[_0x1b82('0x42')][_0x1b82('0x53')]?_0x2e676a['attributes']:_0x2dc53e['model'];if(_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x2e676a[_0x1b82('0x54')]=[{'all':!![]}];}_0x2e676a=_[_0x1b82('0x4b')]({},_0x2e676a,_0x5ca898[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x2e676a)[_0x1b82('0x34')](handleEntityNotFound(_0x106282,null))['then'](respondWithResult(_0x106282,null))['catch'](handleError(_0x106282,null));};exports['clone']=function(_0x2658b5,_0x2a95d2){var _0x207f1c={'where':{'id':_0x2658b5[_0x1b82('0x56')]['id']}},_0x27ad80={};_0x27ad80[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db['Trunk'][_0x1b82('0x3a')]);_0x207f1c[_0x1b82('0x42')]=_[_0x1b82('0x52')](_0x27ad80[_0x1b82('0x3d')],qs[_0x1b82('0x43')](_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x207f1c[_0x1b82('0x42')]=_0x207f1c['attributes'][_0x1b82('0x53')]?_0x207f1c[_0x1b82('0x42')]:_0x27ad80[_0x1b82('0x3d')];if(_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x207f1c['include']=[{'all':!![]}];}_0x207f1c=_['merge']({},_0x207f1c,_0x2658b5[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x207f1c)[_0x1b82('0x34')](handleEntityNotFound(_0x2a95d2,null))['then'](function(_0x170905){if(_0x170905){var _0x352603=_0x170905[_0x1b82('0x57')]({'plain':!![]});_0x352603=qs[_0x1b82('0x58')](_0x352603,['id',_0x1b82('0x59'),_0x1b82('0x5a')]);_0x2658b5[_0x1b82('0x5b')]=_[_0x1b82('0x58')](_0x2658b5[_0x1b82('0x5b')],['id',_0x1b82('0x59'),'updatedAt']);return db[_0x1b82('0x4f')][_0x1b82('0x5c')](_['merge'](_0x352603,_0x2658b5[_0x1b82('0x5b')]),{'include':_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]?[{'all':!![]}]:undefined})[_0x1b82('0x34')](function(_0x4b26c4){var _0x30f13a=_0x2658b5[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x30f13a)throw new Error(_0x1b82('0x5e'));if(_0x30f13a[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x4e8fa2=_0x4b26c4[_0x1b82('0x57')]({'plain':!![]});var _0x5267c3=_0x1b82('0x36');return db['UserProfileSection'][_0x1b82('0x55')]({'where':{'name':_0x5267c3,'userProfileId':_0x30f13a[_0x1b82('0x60')]},'raw':!![]})[_0x1b82('0x34')](function(_0x2db0fe){if(_0x2db0fe&&_0x2db0fe[_0x1b82('0x61')]===0x0){return db[_0x1b82('0x62')][_0x1b82('0x5c')]({'name':_0x4e8fa2['name'],'resourceId':_0x4e8fa2['id'],'type':_0x2db0fe[_0x1b82('0x37')],'sectionId':_0x2db0fe['id']},{})[_0x1b82('0x34')](function(){return _0x4b26c4;});}else{return _0x4b26c4;}})[_0x1b82('0x25')](function(_0x2de10c){logger[_0x1b82('0x21')](_0x1b82('0x63'),_0x2de10c);throw _0x2de10c;});}return _0x4b26c4;});}})[_0x1b82('0x34')](respondWithResult(_0x2a95d2,0xc9))[_0x1b82('0x25')](handleError(_0x2a95d2,null));};exports[_0x1b82('0x5c')]=function(_0x3f7690,_0x1873de,_0xe31cbc){var _0x1ef92c;return db['Trunk'][_0x1b82('0x5c')](_0x3f7690[_0x1b82('0x5b')],{'raw':!![]})[_0x1b82('0x34')](function(_0x4a229e){_0x1ef92c=_0x4a229e;return db[_0x1b82('0x4f')][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x3bf106){var _0x5cc386=fs[_0x1b82('0x64')](path['join'](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x3b4088=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x68')),'utf8');var _0x143689=ejs[_0x1b82('0x69')](_0x5cc386,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x143689);if(_0x1ef92c[_0x1b82('0x6c')]){var _0x29c42e=ejs[_0x1b82('0x69')](_0x3b4088,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x29c42e);}})[_0x1b82('0x34')](function(){return respondWithRpcPromise(_0x1b82('0x6e'),'create',{'module':_0x1b82('0x6f')});})['then'](function(){var _0x4c2e52=_0x3f7690[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x4c2e52)throw new Error(_0x1b82('0x5e'));if(_0x4c2e52[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x1dd3a1=_0x1ef92c[_0x1b82('0x57')]({'plain':!![]});return db[_0x1b82('0x70')][_0x1b82('0x55')]({'where':{'name':_0x1b82('0x36'),'userProfileId':_0x4c2e52['userProfileId']},'raw':!![]})[_0x1b82('0x34')](function(_0x4d496b){if(_0x4d496b&&_0x4d496b[_0x1b82('0x61')]===0x0){return db['UserProfileResource'][_0x1b82('0x5c')]({'name':_0x1dd3a1[_0x1b82('0x37')],'resourceId':_0x1dd3a1['id'],'type':_0x4d496b[_0x1b82('0x37')],'sectionId':_0x4d496b['id']},{})[_0x1b82('0x34')](function(){return _0x1ef92c;});}else{return _0x1ef92c;}})[_0x1b82('0x25')](function(_0x49a202){logger[_0x1b82('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a202);throw _0x49a202;});}return _0x1ef92c;})['then'](respondWithResult(_0x1873de,0xc9))[_0x1b82('0x25')](handleError(_0x1873de,null));};exports[_0x1b82('0x33')]=function(_0x1a4826,_0x4d986c,_0x2e9191){var _0x52f16e;return db[_0x1b82('0x4f')]['find']({'where':{'id':_0x1a4826[_0x1b82('0x56')]['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x4d986c,null))[_0x1b82('0x34')](saveUpdates(_0x1a4826[_0x1b82('0x5b')],null))['then'](function(_0x46cae4){if(_0x46cae4){_0x52f16e=_0x46cae4;return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});}})[_0x1b82('0x34')](function(_0x1095fb){if(_0x1095fb){var _0x185fce=fs[_0x1b82('0x64')](path['join'](config[_0x1b82('0x71')],'server/files/templates/trunk.ejs'),_0x1b82('0x66'));var _0x5ce247=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],'server/files/templates/registry.ejs'),_0x1b82('0x66'));var _0x31a56e=ejs[_0x1b82('0x69')](_0x185fce,{'trunks':_0x1095fb||[]});fs['writeFileSync'](_0x1b82('0x6b'),_0x31a56e);var _0x396272=ejs[_0x1b82('0x69')](_0x5ce247,{'trunks':_0x1095fb||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x396272);return respondWithRpcPromise('Reload',_0x1b82('0x33'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x2759ac){if(_0x2759ac){return _0x52f16e;}})['then'](respondWithResult(_0x4d986c,null))[_0x1b82('0x25')](handleError(_0x4d986c,null));};exports[_0x1b82('0x35')]=function(_0x5f349f,_0x3e17b0,_0x391207){var _0x553ac5;return db['Trunk']['find']({'where':{'id':_0x5f349f['params']['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x3e17b0,null))[_0x1b82('0x34')](removeEntity(_0x3e17b0,null))[_0x1b82('0x34')](function(){return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x7d95b6){var _0x372c3b=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x14510c=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],_0x1b82('0x68')),'utf8');var _0x58e180=ejs[_0x1b82('0x69')](_0x372c3b,{'trunks':_0x7d95b6});var _0x531d3f=ejs['render'](_0x14510c,{'trunks':_0x7d95b6});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x58e180);fs[_0x1b82('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x531d3f);return respondWithRpcPromise(_0x1b82('0x6e'),'destroy',{'module':_0x1b82('0x6f')});})[_0x1b82('0x25')](handleError(_0x3e17b0,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 945c712..deb9190 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 _0x86a3=['tools_trunks','lodash','moment','request-promise','rimraf','../../config/environment','./trunk.attributes','exports','define'];(function(_0x43f36b,_0x555f39){var _0x48706c=function(_0x46c1c9){while(--_0x46c1c9){_0x43f36b['push'](_0x43f36b['shift']());}};_0x48706c(++_0x555f39);}(_0x86a3,0x76));var _0x386a=function(_0x574617,_0x42eccc){_0x574617=_0x574617-0x0;var _0x29de90=_0x86a3[_0x574617];return _0x29de90;};'use strict';var _=require(_0x386a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x386a('0x1'));var BPromise=require('bluebird');var rp=require(_0x386a('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x386a('0x3'));var config=require(_0x386a('0x4'));var attributes=require(_0x386a('0x5'));module[_0x386a('0x6')]=function(_0x4825b8,_0x21ad0f){return _0x4825b8[_0x386a('0x7')]('Trunk',attributes,{'tableName':_0x386a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1e7=['Trunk','tools_trunks','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1a37b2,_0x584b3b){var _0x130c75=function(_0x268407){while(--_0x268407){_0x1a37b2['push'](_0x1a37b2['shift']());}};_0x130c75(++_0x584b3b);}(_0xa1e7,0x1af));var _0x7a1e=function(_0x343dbb,_0x42e74c){_0x343dbb=_0x343dbb-0x0;var _0x35c94f=_0xa1e7[_0x343dbb];return _0x35c94f;};'use strict';var _=require(_0x7a1e('0x0'));var util=require(_0x7a1e('0x1'));var logger=require('../../config/logger')(_0x7a1e('0x2'));var moment=require(_0x7a1e('0x3'));var BPromise=require(_0x7a1e('0x4'));var rp=require(_0x7a1e('0x5'));var fs=require('fs');var path=require(_0x7a1e('0x6'));var rimraf=require(_0x7a1e('0x7'));var config=require(_0x7a1e('0x8'));var attributes=require('./trunk.attributes');module[_0x7a1e('0x9')]=function(_0x50f502,_0x55f557){return _0x50f502[_0x7a1e('0xa')](_0x7a1e('0xb'),attributes,{'tableName':_0x7a1e('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 bca5fdb..16359c5 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 _0x7ed2=['Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrunk','Trunk','options','raw','where','attributes','limit','include','model','map','ShowTrunk','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x38dd06,_0x3edf66){var _0x3c6312=function(_0x3491cc){while(--_0x3491cc){_0x38dd06['push'](_0x38dd06['shift']());}};_0x3c6312(++_0x3edf66);}(_0x7ed2,0x1ed));var _0x27ed=function(_0x575c02,_0x18e3ce){_0x575c02=_0x575c02-0x0;var _0x1d9fdc=_0x7ed2[_0x575c02];return _0x1d9fdc;};'use strict';var _=require(_0x27ed('0x0'));var util=require(_0x27ed('0x1'));var moment=require('moment');var BPromise=require(_0x27ed('0x2'));var rs=require(_0x27ed('0x3'));var fs=require('fs');var Redis=require(_0x27ed('0x4'));var db=require(_0x27ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x27ed('0x6'))(_0x27ed('0x7'));var config=require(_0x27ed('0x8'));var jayson=require(_0x27ed('0x9'));var client=jayson[_0x27ed('0xa')][_0x27ed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32fb45,_0x3a03e2,_0x41e603){return new BPromise(function(_0x220dcb,_0x125187){return client['request'](_0x32fb45,_0x41e603)[_0x27ed('0xc')](function(_0x15ecb9){logger[_0x27ed('0xd')](_0x27ed('0xe'),_0x3a03e2,_0x27ed('0xf'));logger[_0x27ed('0x10')](_0x27ed('0x11'),_0x3a03e2,_0x27ed('0xf'),JSON[_0x27ed('0x12')](_0x15ecb9));if(_0x15ecb9[_0x27ed('0x13')]){if(_0x15ecb9[_0x27ed('0x13')][_0x27ed('0x14')]===0x1f4){logger[_0x27ed('0x13')](_0x27ed('0xe'),_0x3a03e2,_0x15ecb9[_0x27ed('0x13')][_0x27ed('0x15')]);return _0x125187(_0x15ecb9[_0x27ed('0x13')][_0x27ed('0x15')]);}logger[_0x27ed('0x13')](_0x27ed('0xe'),_0x3a03e2,_0x15ecb9[_0x27ed('0x13')]['message']);return _0x220dcb(_0x15ecb9[_0x27ed('0x13')][_0x27ed('0x15')]);}else{logger[_0x27ed('0xd')]('Trunk,\x20%s,\x20%s',_0x3a03e2,_0x27ed('0xf'));_0x220dcb(_0x15ecb9['result']['message']);}})[_0x27ed('0x16')](function(_0x4cdb7b){logger[_0x27ed('0x13')](_0x27ed('0xe'),_0x3a03e2,_0x4cdb7b);_0x125187(_0x4cdb7b);});});}exports[_0x27ed('0x17')]=function(_0x3ab3b6){var _0x2629f8=this;return new Promise(function(_0x23a830,_0x15bfe9){return db[_0x27ed('0x18')]['findAll']({'raw':_0x3ab3b6[_0x27ed('0x19')]?_0x3ab3b6[_0x27ed('0x19')][_0x27ed('0x1a')]===undefined?!![]:![]:!![],'where':_0x3ab3b6[_0x27ed('0x19')]?_0x3ab3b6[_0x27ed('0x19')][_0x27ed('0x1b')]||null:null,'attributes':_0x3ab3b6[_0x27ed('0x19')]?_0x3ab3b6['options'][_0x27ed('0x1c')]||null:null,'limit':_0x3ab3b6[_0x27ed('0x19')]?_0x3ab3b6['options'][_0x27ed('0x1d')]||null:null,'include':_0x3ab3b6[_0x27ed('0x19')]?_0x3ab3b6[_0x27ed('0x19')][_0x27ed('0x1e')]?_['map'](_0x3ab3b6['options'][_0x27ed('0x1e')],function(_0x238883){return{'model':db[_0x238883[_0x27ed('0x1f')]],'as':_0x238883['as'],'attributes':_0x238883['attributes'],'include':_0x238883[_0x27ed('0x1e')]?_[_0x27ed('0x20')](_0x238883[_0x27ed('0x1e')],function(_0x58757b){return{'model':db[_0x58757b[_0x27ed('0x1f')]],'as':_0x58757b['as'],'attributes':_0x58757b[_0x27ed('0x1c')],'include':_0x58757b[_0x27ed('0x1e')]?_['map'](_0x58757b['include'],function(_0x379b14){return{'model':db[_0x379b14['model']],'as':_0x379b14['as'],'attributes':_0x379b14[_0x27ed('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x876c47){logger[_0x27ed('0xd')](_0x27ed('0x17'),_0x3ab3b6);logger[_0x27ed('0x10')](_0x27ed('0x17'),_0x3ab3b6,JSON[_0x27ed('0x12')](_0x876c47));_0x23a830(_0x876c47);})[_0x27ed('0x16')](function(_0x2646f8){logger[_0x27ed('0x13')](_0x27ed('0x17'),_0x2646f8[_0x27ed('0x15')],_0x3ab3b6);_0x15bfe9(_0x2629f8[_0x27ed('0x13')](0x1f4,_0x2646f8[_0x27ed('0x15')]));});});};exports[_0x27ed('0x21')]=function(_0x53564a){var _0x5b2cd2=this;return new Promise(function(_0x29fcaa,_0x357902){return db[_0x27ed('0x18')]['find']({'raw':_0x53564a['options']?_0x53564a[_0x27ed('0x19')][_0x27ed('0x1a')]===undefined?!![]:![]:!![],'where':_0x53564a[_0x27ed('0x19')]?_0x53564a[_0x27ed('0x19')][_0x27ed('0x1b')]||null:null,'attributes':_0x53564a[_0x27ed('0x19')]?_0x53564a[_0x27ed('0x19')][_0x27ed('0x1c')]||null:null,'include':_0x53564a[_0x27ed('0x19')]?_0x53564a['options'][_0x27ed('0x1e')]?_[_0x27ed('0x20')](_0x53564a['options'][_0x27ed('0x1e')],function(_0x2b31ba){return{'model':db[_0x2b31ba['model']],'as':_0x2b31ba['as'],'attributes':_0x2b31ba[_0x27ed('0x1c')],'include':_0x2b31ba[_0x27ed('0x1e')]?_[_0x27ed('0x20')](_0x2b31ba['include'],function(_0x3163c0){return{'model':db[_0x3163c0['model']],'as':_0x3163c0['as'],'attributes':_0x3163c0[_0x27ed('0x1c')],'include':_0x3163c0['include']?_[_0x27ed('0x20')](_0x3163c0[_0x27ed('0x1e')],function(_0x191fc2){return{'model':db[_0x191fc2[_0x27ed('0x1f')]],'as':_0x191fc2['as'],'attributes':_0x191fc2[_0x27ed('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x27ed('0xc')](function(_0x4cec45){logger[_0x27ed('0xd')](_0x27ed('0x21'),_0x53564a);logger['debug'](_0x27ed('0x21'),_0x53564a,JSON[_0x27ed('0x12')](_0x4cec45));_0x29fcaa(_0x4cec45);})[_0x27ed('0x16')](function(_0x276570){logger[_0x27ed('0x13')]('ShowTrunk',_0x276570[_0x27ed('0x15')],_0x53564a);_0x357902(_0x5b2cd2['error'](0x1f4,_0x276570[_0x27ed('0x15')]));});});}; \ No newline at end of file +var _0x0a9f=['catch','GetTrunk','Trunk','findAll','options','raw','where','limit','model','attributes','include','map','then','debug','stringify','ShowTrunk','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a9f,0x19d));var _0xf0a9=function(_0xa45395,_0x5579e6){_0xa45395=_0xa45395-0x0;var _0x3c83d2=_0x0a9f[_0xa45395];return _0x3c83d2;};'use strict';var _=require(_0xf0a9('0x0'));var util=require(_0xf0a9('0x1'));var moment=require('moment');var BPromise=require(_0xf0a9('0x2'));var rs=require(_0xf0a9('0x3'));var fs=require('fs');var Redis=require(_0xf0a9('0x4'));var db=require(_0xf0a9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0a9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf0a9('0x7'));var client=jayson[_0xf0a9('0x8')][_0xf0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e71c4,_0x36396c,_0xd1e58d){return new BPromise(function(_0x9852f8,_0x2d1794){return client[_0xf0a9('0xa')](_0x2e71c4,_0xd1e58d)['then'](function(_0x20648d){logger[_0xf0a9('0xb')](_0xf0a9('0xc'),_0x36396c,_0xf0a9('0xd'));logger['debug'](_0xf0a9('0xe'),_0x36396c,_0xf0a9('0xd'),JSON['stringify'](_0x20648d));if(_0x20648d[_0xf0a9('0xf')]){if(_0x20648d[_0xf0a9('0xf')][_0xf0a9('0x10')]===0x1f4){logger[_0xf0a9('0xf')]('Trunk,\x20%s,\x20%s',_0x36396c,_0x20648d['error'][_0xf0a9('0x11')]);return _0x2d1794(_0x20648d['error'][_0xf0a9('0x11')]);}logger['error'](_0xf0a9('0xc'),_0x36396c,_0x20648d[_0xf0a9('0xf')]['message']);return _0x9852f8(_0x20648d[_0xf0a9('0xf')][_0xf0a9('0x11')]);}else{logger[_0xf0a9('0xb')](_0xf0a9('0xc'),_0x36396c,_0xf0a9('0xd'));_0x9852f8(_0x20648d[_0xf0a9('0x12')]['message']);}})[_0xf0a9('0x13')](function(_0x5c5fb6){logger[_0xf0a9('0xf')](_0xf0a9('0xc'),_0x36396c,_0x5c5fb6);_0x2d1794(_0x5c5fb6);});});}exports[_0xf0a9('0x14')]=function(_0x2b2d4a){var _0x4609e4=this;return new Promise(function(_0x516f23,_0x556fb9){return db[_0xf0a9('0x15')][_0xf0a9('0x16')]({'raw':_0x2b2d4a[_0xf0a9('0x17')]?_0x2b2d4a['options'][_0xf0a9('0x18')]===undefined?!![]:![]:!![],'where':_0x2b2d4a[_0xf0a9('0x17')]?_0x2b2d4a[_0xf0a9('0x17')][_0xf0a9('0x19')]||null:null,'attributes':_0x2b2d4a[_0xf0a9('0x17')]?_0x2b2d4a[_0xf0a9('0x17')]['attributes']||null:null,'limit':_0x2b2d4a['options']?_0x2b2d4a['options'][_0xf0a9('0x1a')]||null:null,'include':_0x2b2d4a[_0xf0a9('0x17')]?_0x2b2d4a[_0xf0a9('0x17')]['include']?_['map'](_0x2b2d4a[_0xf0a9('0x17')]['include'],function(_0x2d7d36){return{'model':db[_0x2d7d36[_0xf0a9('0x1b')]],'as':_0x2d7d36['as'],'attributes':_0x2d7d36[_0xf0a9('0x1c')],'include':_0x2d7d36[_0xf0a9('0x1d')]?_[_0xf0a9('0x1e')](_0x2d7d36[_0xf0a9('0x1d')],function(_0x4b6163){return{'model':db[_0x4b6163[_0xf0a9('0x1b')]],'as':_0x4b6163['as'],'attributes':_0x4b6163[_0xf0a9('0x1c')],'include':_0x4b6163['include']?_[_0xf0a9('0x1e')](_0x4b6163[_0xf0a9('0x1d')],function(_0x4cbef1){return{'model':db[_0x4cbef1[_0xf0a9('0x1b')]],'as':_0x4cbef1['as'],'attributes':_0x4cbef1[_0xf0a9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf0a9('0x1f')](function(_0x2e5acd){logger['info']('GetTrunk',_0x2b2d4a);logger[_0xf0a9('0x20')](_0xf0a9('0x14'),_0x2b2d4a,JSON[_0xf0a9('0x21')](_0x2e5acd));_0x516f23(_0x2e5acd);})[_0xf0a9('0x13')](function(_0x5e1ffd){logger[_0xf0a9('0xf')](_0xf0a9('0x14'),_0x5e1ffd[_0xf0a9('0x11')],_0x2b2d4a);_0x556fb9(_0x4609e4[_0xf0a9('0xf')](0x1f4,_0x5e1ffd[_0xf0a9('0x11')]));});});};exports[_0xf0a9('0x22')]=function(_0x126be3){var _0x4296f7=this;return new Promise(function(_0xd10bd4,_0x27fa4d){return db[_0xf0a9('0x15')][_0xf0a9('0x23')]({'raw':_0x126be3['options']?_0x126be3['options'][_0xf0a9('0x18')]===undefined?!![]:![]:!![],'where':_0x126be3[_0xf0a9('0x17')]?_0x126be3[_0xf0a9('0x17')][_0xf0a9('0x19')]||null:null,'attributes':_0x126be3[_0xf0a9('0x17')]?_0x126be3['options']['attributes']||null:null,'include':_0x126be3['options']?_0x126be3[_0xf0a9('0x17')][_0xf0a9('0x1d')]?_[_0xf0a9('0x1e')](_0x126be3[_0xf0a9('0x17')][_0xf0a9('0x1d')],function(_0x59b24a){return{'model':db[_0x59b24a[_0xf0a9('0x1b')]],'as':_0x59b24a['as'],'attributes':_0x59b24a['attributes'],'include':_0x59b24a[_0xf0a9('0x1d')]?_[_0xf0a9('0x1e')](_0x59b24a[_0xf0a9('0x1d')],function(_0x48996a){return{'model':db[_0x48996a['model']],'as':_0x48996a['as'],'attributes':_0x48996a[_0xf0a9('0x1c')],'include':_0x48996a[_0xf0a9('0x1d')]?_[_0xf0a9('0x1e')](_0x48996a[_0xf0a9('0x1d')],function(_0x5c16ca){return{'model':db[_0x5c16ca['model']],'as':_0x5c16ca['as'],'attributes':_0x5c16ca[_0xf0a9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf0a9('0x1f')](function(_0x21cc38){logger[_0xf0a9('0xb')](_0xf0a9('0x22'),_0x126be3);logger[_0xf0a9('0x20')]('ShowTrunk',_0x126be3,JSON[_0xf0a9('0x21')](_0x21cc38));_0xd10bd4(_0x21cc38);})[_0xf0a9('0x13')](function(_0x27eab3){logger[_0xf0a9('0xf')](_0xf0a9('0x22'),_0x27eab3[_0xf0a9('0x11')],_0x126be3);_0x27fa4d(_0x4296f7[_0xf0a9('0xf')](0x1f4,_0x27eab3[_0xf0a9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index c10a822..eeb60a3 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca2e=['express','Router','/:id','isAuthenticated','exports'];(function(_0x2ad621,_0x21fbcb){var _0xfbcbde=function(_0x2ce643){while(--_0x2ce643){_0x2ad621['push'](_0x2ad621['shift']());}};_0xfbcbde(++_0x21fbcb);}(_0xca2e,0x122));var _0xeca2=function(_0x192202,_0xf8a4a){_0x192202=_0x192202-0x0;var _0x3024f4=_0xca2e[_0x192202];return _0x3024f4;};'use strict';var express=require(_0xeca2('0x0'));var router=express[_0xeca2('0x1')]();var auth=require('../../components/auth/service');var controller=require('./user-setting.controller');router['put'](_0xeca2('0x2'),auth[_0xeca2('0x3')](),controller['update']);module[_0xeca2('0x4')]=router; \ No newline at end of file +var _0x29d8=['update','exports','express','Router','../../components/auth/service','./user-setting.controller','put'];(function(_0x140c2b,_0x1f4856){var _0x367de6=function(_0x3a3a9b){while(--_0x3a3a9b){_0x140c2b['push'](_0x140c2b['shift']());}};_0x367de6(++_0x1f4856);}(_0x29d8,0xe2));var _0x829d=function(_0xf7b27d,_0x5c051b){_0xf7b27d=_0xf7b27d-0x0;var _0x57e290=_0x29d8[_0xf7b27d];return _0x57e290;};'use strict';var express=require(_0x829d('0x0'));var router=express[_0x829d('0x1')]();var auth=require(_0x829d('0x2'));var controller=require(_0x829d('0x3'));router[_0x829d('0x4')]('/:id',auth['isAuthenticated'](),controller[_0x829d('0x5')]);module[_0x829d('0x6')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index d0800ad..3add18a 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x123c=['exports','ENUM','DATE','UserId','sequelize','error','warning','info','debug'];(function(_0x546e5b,_0x200d7f){var _0x1ea0ec=function(_0x1edad4){while(--_0x1edad4){_0x546e5b['push'](_0x546e5b['shift']());}};_0x1ea0ec(++_0x200d7f);}(_0x123c,0xa6));var _0xc123=function(_0x4f51be,_0x57f092){_0x4f51be=_0x4f51be-0x0;var _0x37d90e=_0x123c[_0x4f51be];return _0x37d90e;};'use strict';var Sequelize=require(_0xc123('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xc123('0x1'),_0xc123('0x2'),_0xc123('0x3'),_0xc123('0x4')];module[_0xc123('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0xc123('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xc123('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0xc123('0x8')}}; \ No newline at end of file +var _0x4902=['warning','info','debug','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId','sequelize','error'];(function(_0x250044,_0xe3d708){var _0x14a2d3=function(_0x2a4d0d){while(--_0x2a4d0d){_0x250044['push'](_0x250044['shift']());}};_0x14a2d3(++_0xe3d708);}(_0x4902,0x82));var _0x2490=function(_0x56686a,_0x58dc61){_0x56686a=_0x56686a-0x0;var _0x5afbf0=_0x4902[_0x56686a];return _0x5afbf0;};'use strict';var Sequelize=require(_0x2490('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x2490('0x1'),_0x2490('0x2'),_0x2490('0x3'),_0x2490('0x4')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x2490('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x2490('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x2490('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x2490('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x2490('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x2490('0x9')],'unique':_0x2490('0xa')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index b919ce0..14e510d 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d4a=['../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','update','then','sendStatus','error','stack','name','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','lodash'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6d4a,0x117));var _0xa6d4=function(_0x167082,_0x5e07b4){_0x167082=_0x167082-0x0;var _0x19a4ea=_0x6d4a[_0x167082];return _0x19a4ea;};'use strict';var _=require(_0xa6d4('0x0'));var Redis=require('ioredis');var logger=require(_0xa6d4('0x1'))(_0xa6d4('0x2'));var config=require(_0xa6d4('0x3'));var db=require(_0xa6d4('0x4'))['db'];var socket=require(_0xa6d4('0x5'))(new Redis(config[_0xa6d4('0x6')]));require(_0xa6d4('0x7'))[_0xa6d4('0x8')](socket);config[_0xa6d4('0x6')]=_[_0xa6d4('0x9')](config[_0xa6d4('0x6')],{'host':_0xa6d4('0xa'),'port':0x18eb});function respondWithResult(_0x354148,_0x444bf9){_0x444bf9=_0x444bf9||0xc8;return function(_0x49a9e8){if(_0x49a9e8){return _0x354148[_0xa6d4('0xb')](_0x444bf9)[_0xa6d4('0xc')](_0x49a9e8);}};}function saveUpdates(_0x52739a){return function(_0x197e6e){if(_0x197e6e){return _0x197e6e[_0xa6d4('0xd')](_0x52739a)[_0xa6d4('0xe')](function(_0xb76050){return _0xb76050;});}return null;};}function handleEntityNotFound(_0x2320cc){return function(_0x54edec){if(!_0x54edec){_0x2320cc[_0xa6d4('0xf')](0x194);}return _0x54edec;};}function handleError(_0x150483,_0x58d06f){_0x58d06f=_0x58d06f||0x1f4;return function(_0x2c7f14){logger[_0xa6d4('0x10')](_0x2c7f14[_0xa6d4('0x11')]);if(_0x2c7f14['name']){delete _0x2c7f14[_0xa6d4('0x12')];}_0x150483['status'](_0x58d06f)[_0xa6d4('0x13')](_0x2c7f14);};}exports[_0xa6d4('0xd')]=function(_0x5c8e37,_0x1cae87){if(_0x5c8e37[_0xa6d4('0x14')][_0xa6d4('0x15')]!==_0xa6d4('0x16'))throw new Error(_0xa6d4('0x17'));if(isNaN(Number(_0x5c8e37[_0xa6d4('0x18')]['id'])))throw new Error(_0xa6d4('0x19'));return db[_0xa6d4('0x1a')][_0xa6d4('0x1b')]({'where':{'id':_0x5c8e37[_0xa6d4('0x18')]['id']}})[_0xa6d4('0xe')](handleEntityNotFound(_0x1cae87,null))[_0xa6d4('0xe')](saveUpdates(_0x5c8e37['body'],null))[_0xa6d4('0xe')](respondWithResult(_0x1cae87,null))['catch'](handleError(_0x1cae87,null));}; \ No newline at end of file +var _0x9aee=['send','user','role','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','status','json','update','then','sendStatus','error','stack','name'];(function(_0x262711,_0x378c42){var _0x2ff581=function(_0x244540){while(--_0x244540){_0x262711['push'](_0x262711['shift']());}};_0x2ff581(++_0x378c42);}(_0x9aee,0x71));var _0xe9ae=function(_0x200490,_0x38bbf3){_0x200490=_0x200490-0x0;var _0x40aa6d=_0x9aee[_0x200490];return _0x40aa6d;};'use strict';var _=require(_0xe9ae('0x0'));var Redis=require(_0xe9ae('0x1'));var logger=require(_0xe9ae('0x2'))(_0xe9ae('0x3'));var config=require(_0xe9ae('0x4'));var db=require(_0xe9ae('0x5'))['db'];var socket=require(_0xe9ae('0x6'))(new Redis(config[_0xe9ae('0x7')]));require(_0xe9ae('0x8'))['register'](socket);config['redis']=_['defaults'](config[_0xe9ae('0x7')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x54e9e7,_0x34cef2){_0x34cef2=_0x34cef2||0xc8;return function(_0x478bf5){if(_0x478bf5){return _0x54e9e7[_0xe9ae('0x9')](_0x34cef2)[_0xe9ae('0xa')](_0x478bf5);}};}function saveUpdates(_0x4a317a){return function(_0x2e3199){if(_0x2e3199){return _0x2e3199[_0xe9ae('0xb')](_0x4a317a)[_0xe9ae('0xc')](function(_0x4dffbd){return _0x4dffbd;});}return null;};}function handleEntityNotFound(_0x359047){return function(_0x17371c){if(!_0x17371c){_0x359047[_0xe9ae('0xd')](0x194);}return _0x17371c;};}function handleError(_0x5689ef,_0xbf049e){_0xbf049e=_0xbf049e||0x1f4;return function(_0x502fac){logger[_0xe9ae('0xe')](_0x502fac[_0xe9ae('0xf')]);if(_0x502fac[_0xe9ae('0x10')]){delete _0x502fac[_0xe9ae('0x10')];}_0x5689ef[_0xe9ae('0x9')](_0xbf049e)[_0xe9ae('0x11')](_0x502fac);};}exports[_0xe9ae('0xb')]=function(_0x3326b9,_0x4e5d3b){if(_0x3326b9[_0xe9ae('0x12')][_0xe9ae('0x13')]!=='admin')throw new Error(_0xe9ae('0x14'));if(isNaN(Number(_0x3326b9[_0xe9ae('0x15')]['id'])))throw new Error(_0xe9ae('0x16'));return db[_0xe9ae('0x17')][_0xe9ae('0x18')]({'where':{'id':_0x3326b9[_0xe9ae('0x15')]['id']}})[_0xe9ae('0xc')](handleEntityNotFound(_0x4e5d3b,null))[_0xe9ae('0xc')](saveUpdates(_0x3326b9[_0xe9ae('0x19')],null))['then'](respondWithResult(_0x4e5d3b,null))['catch'](handleError(_0x4e5d3b,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index c7a65f3..a781b3e 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6722=['remove','emit','hook','events','../../mysqldb','UserSetting','setMaxListeners','save','update'];(function(_0x47a900,_0x16af0b){var _0x5bd6c2=function(_0x5cacfd){while(--_0x5cacfd){_0x47a900['push'](_0x47a900['shift']());}};_0x5bd6c2(++_0x16af0b);}(_0x6722,0xa5));var _0x2672=function(_0x11571b,_0x2bb9f3){_0x11571b=_0x11571b-0x0;var _0x1d9243=_0x6722[_0x11571b];return _0x1d9243;};'use strict';var EventEmitter=require(_0x2672('0x0'));var UserSetting=require(_0x2672('0x1'))['db'][_0x2672('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x2672('0x3')](0x0);var events={'afterCreate':_0x2672('0x4'),'afterUpdate':_0x2672('0x5'),'afterDestroy':_0x2672('0x6')};function emitEvent(_0x22d9bb){return function(_0x5a0ca8,_0x5d9e66,_0x99c498){UserSettingEvents[_0x2672('0x7')](_0x22d9bb+':'+_0x5a0ca8['id'],_0x5a0ca8);UserSettingEvents[_0x2672('0x7')](_0x22d9bb,_0x5a0ca8);_0x99c498(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x2672('0x8')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x4d09=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x4d09,0x137));var _0x94d0=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x4d09[_0x307d86];return _0x361745;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x94d0('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x94d0('0x1')](0x0);var events={'afterCreate':_0x94d0('0x2'),'afterUpdate':_0x94d0('0x3'),'afterDestroy':_0x94d0('0x4')};function emitEvent(_0x36ce09){return function(_0x362231,_0x2681a2,_0x221920){UserSettingEvents[_0x94d0('0x5')](_0x36ce09+':'+_0x362231['id'],_0x362231);UserSettingEvents[_0x94d0('0x5')](_0x36ce09,_0x362231);_0x221920(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x94d0('0x6')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index ffc297d..dab82dd 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadcc=['UserSetting','user_settings','clientSideLoggingEnabledSince','./user-setting.attributes','define'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xadcc,0x76));var _0xcadc=function(_0x488275,_0x38262d){_0x488275=_0x488275-0x0;var _0x416a3c=_0xadcc[_0x488275];return _0x416a3c;};'use strict';var attributes=require(_0xcadc('0x0'));module['exports']=function(_0x150e40){return _0x150e40[_0xcadc('0x1')](_0xcadc('0x2'),attributes,{'tableName':_0xcadc('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2c174f){if(!_0x2c174f['clientSideLoggingEnabled'])_0x2c174f['clientSideLoggingEnabledSince']=null;else if(_0x2c174f[_0xcadc('0x4')]===null)_0x2c174f[_0xcadc('0x4')]=new Date();}}});}; \ No newline at end of file +var _0xc788=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','user_settings','clientSideLoggingEnabled'];(function(_0x1fc7d0,_0x235642){var _0x467002=function(_0x177cc3){while(--_0x177cc3){_0x1fc7d0['push'](_0x1fc7d0['shift']());}};_0x467002(++_0x235642);}(_0xc788,0xc4));var _0x8c78=function(_0x29d849,_0x209ceb){_0x29d849=_0x29d849-0x0;var _0x30b104=_0xc788[_0x29d849];return _0x30b104;};'use strict';var attributes=require(_0x8c78('0x0'));module[_0x8c78('0x1')]=function(_0x2344ba){return _0x2344ba['define']('UserSetting',attributes,{'tableName':_0x8c78('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1af8e2){if(!_0x1af8e2[_0x8c78('0x3')])_0x1af8e2[_0x8c78('0x4')]=null;else if(_0x1af8e2[_0x8c78('0x4')]===null)_0x1af8e2['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 7437a96..1a4fdb6 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0567=['user-setting:update:user-','UserId','register','length','user-setting:','remove','update','emit','user-setting:update'];(function(_0x3bd52b,_0xbbc735){var _0x1e5b89=function(_0x29ccc3){while(--_0x29ccc3){_0x3bd52b['push'](_0x3bd52b['shift']());}};_0x1e5b89(++_0xbbc735);}(_0x0567,0x188));var _0x7056=function(_0x1e462a,_0x4d7f1d){_0x1e462a=_0x1e462a-0x0;var _0x5312a4=_0x0567[_0x1e462a];return _0x5312a4;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save',_0x7056('0x0'),_0x7056('0x1')];function createListener(_0xc8653f,_0x53d9c4){return function(_0xf4f167){_0x53d9c4[_0x7056('0x2')](_0xc8653f,_0xf4f167);if(_0xc8653f===_0x7056('0x3')){_0x53d9c4[_0x7056('0x2')](_0x7056('0x4')+_0xf4f167[_0x7056('0x5')],_0xf4f167);}};}exports[_0x7056('0x6')]=function(_0x3049c0){for(var _0x400591=0x0,_0x3975b3=events[_0x7056('0x7')];_0x400591<_0x3975b3;_0x400591++){var _0xd6d60b=events[_0x400591];var _0x291076=createListener(_0x7056('0x8')+_0xd6d60b,_0x3049c0);UserSettingEvents['on'](_0xd6d60b,_0x291076);}}; \ No newline at end of file +var _0xb675=['save','remove','update','emit','user-setting:update','user-setting:update:user-','UserId','register','length'];(function(_0x362b55,_0x27b2c2){var _0x286ee1=function(_0x4d8079){while(--_0x4d8079){_0x362b55['push'](_0x362b55['shift']());}};_0x286ee1(++_0x27b2c2);}(_0xb675,0x19e));var _0x5b67=function(_0x51e79c,_0x51485e){_0x51e79c=_0x51e79c-0x0;var _0x2467be=_0xb675[_0x51e79c];return _0x2467be;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x5b67('0x0'),_0x5b67('0x1'),_0x5b67('0x2')];function createListener(_0x374500,_0x28f921){return function(_0x3cb67a){_0x28f921[_0x5b67('0x3')](_0x374500,_0x3cb67a);if(_0x374500===_0x5b67('0x4')){_0x28f921[_0x5b67('0x3')](_0x5b67('0x5')+_0x3cb67a[_0x5b67('0x6')],_0x3cb67a);}};}exports[_0x5b67('0x7')]=function(_0xecb2c){for(var _0x351421=0x0,_0x486872=events[_0x5b67('0x8')];_0x351421<_0x486872;_0x351421++){var _0x1ecf17=events[_0x351421];var _0x269ee4=createListener('user-setting:'+_0x1ecf17,_0xecb2c);UserSettingEvents['on'](_0x1ecf17,_0x269ee4);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index face431..04467bc 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 _0xe2c5=['removeApiKey','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','/whoami','whoami','/presence','getPresence','/:id','getAvatar','getOpenTabs','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getScreenRecordings','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','getOpenchannelAccounts','getSmsAccounts','getChatWebsites','getScheduledCalls','/:id/api_key','post','/:id/contacts','addContacts','create','/create_many','bulkCreate','/:id/queues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','/:id/teams','/:id/chat_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','/:id/whatsapp_accounts','createApiKey','put','update','changePassword','delete','removeTeams','destroy','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','removeSmsAccounts','/:id/chat_websites'];(function(_0x22b70f,_0x4c853f){var _0x100985=function(_0x18628e){while(--_0x18628e){_0x22b70f['push'](_0x22b70f['shift']());}};_0x100985(++_0x4c853f);}(_0xe2c5,0xd3));var _0x5e2c=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0xe2c5[_0x4d8666];return _0x37175b;};'use strict';var multer=require('multer');var util=require(_0x5e2c('0x0'));var path=require(_0x5e2c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5e2c('0x2'));var auth=require(_0x5e2c('0x3'));var interaction=require(_0x5e2c('0x4'));var config=require(_0x5e2c('0x5'));var controller=require(_0x5e2c('0x6'));router[_0x5e2c('0x7')]('/',auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x9')]);router[_0x5e2c('0x7')](_0x5e2c('0xa'),auth[_0x5e2c('0x8')](),controller['describe']);router[_0x5e2c('0x7')](_0x5e2c('0xb'),auth['isAuthenticated'](),controller[_0x5e2c('0xc')]);router[_0x5e2c('0x7')](_0x5e2c('0xd'),auth['isAuthenticated'](),controller[_0x5e2c('0xe')]);router[_0x5e2c('0x7')](_0x5e2c('0xf'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/avatar',controller[_0x5e2c('0x10')]);router['get']('/:id/open_tabs',auth['isAuthenticated'](),controller[_0x5e2c('0x11')]);router[_0x5e2c('0x7')]('/:id/contacts',auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x12')]);router[_0x5e2c('0x7')]('/:id/queues',auth['isAuthenticated'](),controller[_0x5e2c('0x13')]);router[_0x5e2c('0x7')](_0x5e2c('0x14'),auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x15')]);router[_0x5e2c('0x7')](_0x5e2c('0x16'),auth['isAuthenticated'](),controller['getGroups']);router[_0x5e2c('0x7')](_0x5e2c('0x17'),auth[_0x5e2c('0x8')](),controller['getRecordings']);router[_0x5e2c('0x7')]('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0x5e2c('0x18')]);router['get']('/:id/chat/interactions',auth[_0x5e2c('0x8')](),controller['getChatInteractions']);router[_0x5e2c('0x7')]('/:id/openchannel/interactions',auth[_0x5e2c('0x8')](),controller['getOpenchannelInteractions']);router['get'](_0x5e2c('0x19'),auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x1a')]);router['get'](_0x5e2c('0x1b'),auth[_0x5e2c('0x8')](),controller['getSmsInteractions']);router['get'](_0x5e2c('0x1c'),auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x1d')]);router[_0x5e2c('0x7')](_0x5e2c('0x1e'),auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x1f')]);router[_0x5e2c('0x7')]('/:id/teams',auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x20')]);router[_0x5e2c('0x7')](_0x5e2c('0x21'),auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x22')]);router['get'](_0x5e2c('0x23'),auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x24')]);router[_0x5e2c('0x7')](_0x5e2c('0x25'),auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x26')]);router[_0x5e2c('0x7')](_0x5e2c('0x27'),auth['isAuthenticated'](),controller[_0x5e2c('0x28')]);router[_0x5e2c('0x7')]('/:id/mail_accounts',auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x29')]);router[_0x5e2c('0x7')]('/:id/openchannel_accounts',auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x2a')]);router['get']('/:id/sms_accounts',auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x2b')]);router[_0x5e2c('0x7')]('/:id/chat_websites',auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x2c')]);router[_0x5e2c('0x7')]('/:id/whatsapp_accounts',auth[_0x5e2c('0x8')](),controller['getWhatsappAccounts']);router[_0x5e2c('0x7')]('/:id/scheduled_calls',auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x2d')]);router[_0x5e2c('0x7')](_0x5e2c('0x2e'),auth[_0x5e2c('0x8')](),controller['getApiKey']);router[_0x5e2c('0x2f')](_0x5e2c('0x30'),auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x31')]);router[_0x5e2c('0x2f')]('/',auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x32')]);router[_0x5e2c('0x2f')](_0x5e2c('0x33'),auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x34')]);router[_0x5e2c('0x2f')](_0x5e2c('0x35'),auth[_0x5e2c('0x8')](),controller['addQueues']);var upload=multer({'storage':multer[_0x5e2c('0x36')]({'destination':function(_0x1c2158,_0x2a806a,_0x22bb0e){_0x22bb0e(null,path[_0x5e2c('0x37')](config[_0x5e2c('0x38')],_0x5e2c('0x39')));},'filename':function(_0x511f12,_0x1274c9,_0x4328e4){_0x4328e4(null,util[_0x5e2c('0x3a')](_0x5e2c('0x3b'),Date[_0x5e2c('0x3c')](),_0x1274c9[_0x5e2c('0x3d')]));}})});router[_0x5e2c('0x2f')](_0x5e2c('0x3e'),upload[_0x5e2c('0x3f')](_0x5e2c('0x40')),controller[_0x5e2c('0x41')]);router[_0x5e2c('0x2f')](_0x5e2c('0x42'),auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x43')]);router[_0x5e2c('0x2f')](_0x5e2c('0x44'),auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x45')]);router[_0x5e2c('0x2f')](_0x5e2c('0x46'),auth[_0x5e2c('0x8')](),controller['pause']);router['post'](_0x5e2c('0x47'),auth['isAuthenticated'](),controller[_0x5e2c('0x48')]);router[_0x5e2c('0x2f')](_0x5e2c('0x49'),auth['isAuthenticated'](),controller['addTeams']);router[_0x5e2c('0x2f')](_0x5e2c('0x4a'),auth['isAuthenticated'](),controller['addChatInteractions']);router[_0x5e2c('0x2f')]('/:id/mail_interactions',auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x4b')]);router['post'](_0x5e2c('0x4c'),auth[_0x5e2c('0x8')](),controller['addFaxInteractions']);router[_0x5e2c('0x2f')](_0x5e2c('0x4d'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0x5e2c('0x2f')](_0x5e2c('0x4e'),auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x4f')]);router['post']('/:id/whatsapp_interactions',auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x50')]);router[_0x5e2c('0x2f')](_0x5e2c('0x27'),auth[_0x5e2c('0x8')](),controller['addFaxAccounts']);router[_0x5e2c('0x2f')](_0x5e2c('0x51'),auth['isAuthenticated'](),controller[_0x5e2c('0x52')]);router[_0x5e2c('0x2f')]('/:id/openchannel_accounts',auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x53')]);router[_0x5e2c('0x2f')]('/:id/sms_accounts',auth[_0x5e2c('0x8')](),controller['addSmsAccounts']);router[_0x5e2c('0x2f')]('/:id/chat_websites',auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x54')]);router['post'](_0x5e2c('0x55'),auth['isAuthenticated'](),controller['addWhatsappAccounts']);router['post'](_0x5e2c('0x2e'),auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x56')]);router[_0x5e2c('0x57')](_0x5e2c('0xf'),auth['isAuthenticated'](),controller[_0x5e2c('0x58')]);router['put']('/:id/password',auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x59')]);router[_0x5e2c('0x5a')](_0x5e2c('0x35'),auth[_0x5e2c('0x8')](),controller['removeQueues']);router[_0x5e2c('0x5a')](_0x5e2c('0x49'),auth['isAuthenticated'](),controller[_0x5e2c('0x5b')]);router[_0x5e2c('0x5a')](_0x5e2c('0xf'),auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x5c')]);router[_0x5e2c('0x5a')](_0x5e2c('0x4a'),auth[_0x5e2c('0x8')](),controller['removeChatInteractions']);router['delete'](_0x5e2c('0x5d'),auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x5e')]);router[_0x5e2c('0x5a')](_0x5e2c('0x4c'),auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x5f')]);router[_0x5e2c('0x5a')](_0x5e2c('0x4d'),auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x60')]);router['delete'](_0x5e2c('0x4e'),auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x61')]);router[_0x5e2c('0x5a')](_0x5e2c('0x62'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router['delete'](_0x5e2c('0x27'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0x5e2c('0x5a')](_0x5e2c('0x51'),auth['isAuthenticated'](),controller[_0x5e2c('0x63')]);router[_0x5e2c('0x5a')](_0x5e2c('0x64'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0x5e2c('0x5a')](_0x5e2c('0x65'),auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x66')]);router['delete'](_0x5e2c('0x67'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0x5e2c('0x5a')](_0x5e2c('0x55'),auth[_0x5e2c('0x8')](),controller['removeWhatsappAccounts']);router['delete'](_0x5e2c('0x2e'),auth[_0x5e2c('0x8')](),controller[_0x5e2c('0x68')]);router[_0x5e2c('0x2f')]('/:id/messengerSoundNotification',auth[_0x5e2c('0x8')](),controller['messengerSoundNotification']);module['exports']=router; \ No newline at end of file +var _0x5453=['bulkCreate','/:id/queues','addQueues','join','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','/:id/fax_accounts','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./user.controller','isAuthenticated','get','describe','/whoami','whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','/create_many'];(function(_0xe95af,_0x4b849b){var _0x16effb=function(_0x454cd0){while(--_0x454cd0){_0xe95af['push'](_0xe95af['shift']());}};_0x16effb(++_0x4b849b);}(_0x5453,0x18b));var _0x3545=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5453[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x3545('0x0'));var util=require(_0x3545('0x1'));var path=require(_0x3545('0x2'));var timeout=require(_0x3545('0x3'));var express=require(_0x3545('0x4'));var router=express[_0x3545('0x5')]();var fs_extra=require(_0x3545('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3545('0x7'));var controller=require(_0x3545('0x8'));router['get']('/',auth[_0x3545('0x9')](),controller['index']);router[_0x3545('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x3545('0xb')]);router[_0x3545('0xa')](_0x3545('0xc'),auth['isAuthenticated'](),controller[_0x3545('0xd')]);router[_0x3545('0xa')](_0x3545('0xe'),auth[_0x3545('0x9')](),controller[_0x3545('0xf')]);router[_0x3545('0xa')](_0x3545('0x10'),auth['isAuthenticated'](),controller['show']);router[_0x3545('0xa')](_0x3545('0x11'),controller[_0x3545('0x12')]);router[_0x3545('0xa')]('/:id/open_tabs',auth['isAuthenticated'](),controller['getOpenTabs']);router[_0x3545('0xa')](_0x3545('0x13'),auth['isAuthenticated'](),controller[_0x3545('0x14')]);router['get']('/:id/queues',auth[_0x3545('0x9')](),controller[_0x3545('0x15')]);router['get'](_0x3545('0x16'),auth[_0x3545('0x9')](),controller['getVoiceQueuesRt']);router[_0x3545('0xa')]('/:id/groups',auth[_0x3545('0x9')](),controller[_0x3545('0x17')]);router[_0x3545('0xa')](_0x3545('0x18'),auth['isAuthenticated'](),controller[_0x3545('0x19')]);router[_0x3545('0xa')]('/:id/screen_recordings',auth[_0x3545('0x9')](),controller[_0x3545('0x1a')]);router[_0x3545('0xa')](_0x3545('0x1b'),auth[_0x3545('0x9')](),controller[_0x3545('0x1c')]);router[_0x3545('0xa')](_0x3545('0x1d'),auth[_0x3545('0x9')](),controller[_0x3545('0x1e')]);router[_0x3545('0xa')]('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0x3545('0x1f')]);router['get'](_0x3545('0x20'),auth[_0x3545('0x9')](),controller['getSmsInteractions']);router[_0x3545('0xa')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0x3545('0x21')]);router[_0x3545('0xa')]('/:id/whatsapp/interactions',auth[_0x3545('0x9')](),controller[_0x3545('0x22')]);router[_0x3545('0xa')](_0x3545('0x23'),auth[_0x3545('0x9')](),controller[_0x3545('0x24')]);router['get'](_0x3545('0x25'),auth[_0x3545('0x9')](),controller[_0x3545('0x26')]);router[_0x3545('0xa')](_0x3545('0x27'),auth[_0x3545('0x9')](),controller[_0x3545('0x28')]);router['get'](_0x3545('0x29'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router['get']('/:id/fax_accounts',auth[_0x3545('0x9')](),controller['getFaxAccounts']);router[_0x3545('0xa')](_0x3545('0x2a'),auth[_0x3545('0x9')](),controller[_0x3545('0x2b')]);router[_0x3545('0xa')](_0x3545('0x2c'),auth[_0x3545('0x9')](),controller[_0x3545('0x2d')]);router[_0x3545('0xa')](_0x3545('0x2e'),auth[_0x3545('0x9')](),controller['getSmsAccounts']);router['get'](_0x3545('0x2f'),auth[_0x3545('0x9')](),controller['getChatWebsites']);router[_0x3545('0xa')](_0x3545('0x30'),auth[_0x3545('0x9')](),controller[_0x3545('0x31')]);router[_0x3545('0xa')](_0x3545('0x32'),auth[_0x3545('0x9')](),controller[_0x3545('0x33')]);router[_0x3545('0xa')](_0x3545('0x34'),auth['isAuthenticated'](),controller[_0x3545('0x35')]);router[_0x3545('0x36')](_0x3545('0x13'),auth[_0x3545('0x9')](),controller[_0x3545('0x37')]);router[_0x3545('0x36')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3545('0x36')](_0x3545('0x38'),auth[_0x3545('0x9')](),controller[_0x3545('0x39')]);router[_0x3545('0x36')](_0x3545('0x3a'),auth['isAuthenticated'](),controller[_0x3545('0x3b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5b206c,_0x54051c,_0x261c5f){_0x261c5f(null,path[_0x3545('0x3c')](config['root'],_0x3545('0x3d')));},'filename':function(_0x3ce42c,_0x2c1386,_0x19d30a){_0x19d30a(null,util[_0x3545('0x3e')](_0x3545('0x3f'),Date[_0x3545('0x40')](),_0x2c1386[_0x3545('0x41')]));}})});router['post'](_0x3545('0x11'),upload[_0x3545('0x42')](_0x3545('0x43')),controller[_0x3545('0x44')]);router[_0x3545('0x36')](_0x3545('0x45'),auth['isAuthenticated'](),controller['login']);router[_0x3545('0x36')](_0x3545('0x46'),auth[_0x3545('0x9')](),controller[_0x3545('0x47')]);router[_0x3545('0x36')]('/:id/pause',auth[_0x3545('0x9')](),controller[_0x3545('0x48')]);router[_0x3545('0x36')]('/:id/unpause',auth[_0x3545('0x9')](),controller[_0x3545('0x49')]);router['post'](_0x3545('0x23'),auth[_0x3545('0x9')](),controller[_0x3545('0x4a')]);router['post'](_0x3545('0x4b'),auth[_0x3545('0x9')](),controller[_0x3545('0x4c')]);router[_0x3545('0x36')](_0x3545('0x4d'),auth[_0x3545('0x9')](),controller['addMailInteractions']);router['post']('/:id/fax_interactions',auth[_0x3545('0x9')](),controller[_0x3545('0x4e')]);router[_0x3545('0x36')](_0x3545('0x4f'),auth['isAuthenticated'](),controller[_0x3545('0x50')]);router[_0x3545('0x36')](_0x3545('0x51'),auth[_0x3545('0x9')](),controller[_0x3545('0x52')]);router[_0x3545('0x36')](_0x3545('0x53'),auth[_0x3545('0x9')](),controller[_0x3545('0x54')]);router['post']('/:id/fax_accounts',auth[_0x3545('0x9')](),controller['addFaxAccounts']);router[_0x3545('0x36')](_0x3545('0x2a'),auth['isAuthenticated'](),controller[_0x3545('0x55')]);router[_0x3545('0x36')](_0x3545('0x2c'),auth[_0x3545('0x9')](),controller['addOpenchannelAccounts']);router['post'](_0x3545('0x2e'),auth[_0x3545('0x9')](),controller['addSmsAccounts']);router[_0x3545('0x36')]('/:id/chat_websites',auth[_0x3545('0x9')](),controller[_0x3545('0x56')]);router['post'](_0x3545('0x30'),auth['isAuthenticated'](),controller[_0x3545('0x57')]);router[_0x3545('0x36')](_0x3545('0x34'),auth[_0x3545('0x9')](),controller[_0x3545('0x58')]);router[_0x3545('0x59')](_0x3545('0x10'),auth[_0x3545('0x9')](),controller[_0x3545('0x5a')]);router['put'](_0x3545('0x5b'),auth['isAuthenticated'](),controller[_0x3545('0x5c')]);router['delete']('/:id/queues',auth[_0x3545('0x9')](),controller[_0x3545('0x5d')]);router[_0x3545('0x5e')](_0x3545('0x23'),auth[_0x3545('0x9')](),controller[_0x3545('0x5f')]);router[_0x3545('0x5e')](_0x3545('0x10'),auth[_0x3545('0x9')](),controller[_0x3545('0x60')]);router['delete'](_0x3545('0x4b'),auth['isAuthenticated'](),controller[_0x3545('0x61')]);router[_0x3545('0x5e')](_0x3545('0x4d'),auth[_0x3545('0x9')](),controller[_0x3545('0x62')]);router['delete']('/:id/fax_interactions',auth[_0x3545('0x9')](),controller[_0x3545('0x63')]);router[_0x3545('0x5e')](_0x3545('0x4f'),auth['isAuthenticated'](),controller[_0x3545('0x64')]);router[_0x3545('0x5e')]('/:id/openchannel_interactions',auth[_0x3545('0x9')](),controller['removeOpenchannelInteractions']);router[_0x3545('0x5e')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x3545('0x65')]);router[_0x3545('0x5e')](_0x3545('0x66'),auth[_0x3545('0x9')](),controller[_0x3545('0x67')]);router[_0x3545('0x5e')](_0x3545('0x2a'),auth[_0x3545('0x9')](),controller[_0x3545('0x68')]);router[_0x3545('0x5e')](_0x3545('0x2c'),auth[_0x3545('0x9')](),controller[_0x3545('0x69')]);router[_0x3545('0x5e')](_0x3545('0x2e'),auth[_0x3545('0x9')](),controller[_0x3545('0x6a')]);router['delete'](_0x3545('0x2f'),auth[_0x3545('0x9')](),controller[_0x3545('0x6b')]);router[_0x3545('0x5e')](_0x3545('0x30'),auth[_0x3545('0x9')](),controller[_0x3545('0x6c')]);router[_0x3545('0x5e')](_0x3545('0x34'),auth[_0x3545('0x9')](),controller[_0x3545('0x6d')]);router[_0x3545('0x36')](_0x3545('0x6e'),auth[_0x3545('0x9')](),controller[_0x3545('0x6f')]);module[_0x3545('0x70')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index d0ec9ee..ba68639 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 _0x3e73=['friend','user','peer','from-sip','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','nonat','update','outgoing','yes','force_rport,comedia','nat','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','always','refuse','originate','uas','fingerprint','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get','isArray','encryption','avpf','force_avp','icesupport','dtlsenable','dtlscertfile','dtlsprivatekey','dtlsverify','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','admin','agent','telephone','local','INTEGER','accountcode','format','fullname','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','ENUM'];(function(_0x452b8d,_0x386fbb){var _0x475564=function(_0x264c29){while(--_0x264c29){_0x452b8d['push'](_0x452b8d['shift']());}};_0x475564(++_0x386fbb);}(_0x3e73,0x197));var _0x33e7=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x3e73[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x33e7('0x0'));var moment=require(_0x33e7('0x1'));var util=require(_0x33e7('0x2'));var _=require(_0x33e7('0x3'));module[_0x33e7('0x4')]={'name':{'type':Sequelize[_0x33e7('0x5')],'allowNull':![],'unique':_0x33e7('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3679ba){this[_0x33e7('0x7')](_0x33e7('0x6'),_0x3679ba);this[_0x33e7('0x7')](_0x33e7('0x8'),_0x3679ba);},'comment':_0x33e7('0x9')},'fullname':{'type':Sequelize[_0x33e7('0x5')],'allowNull':![],'set':function(_0x3621d9){this['setDataValue']('fullname',_0x3621d9);this[_0x33e7('0x7')](_0x33e7('0xa'),util['format'](_0x33e7('0xb'),_0x3621d9,this[_0x33e7('0xc')](_0x33e7('0xd'))));}},'alias':{'type':Sequelize[_0x33e7('0x5')]},'email':{'type':Sequelize[_0x33e7('0x5')],'allowNull':![],'unique':_0x33e7('0xe'),'validate':{'isEmail':!![]},'set':function(_0x1e39ae){if(_0x1e39ae){this[_0x33e7('0x7')](_0x33e7('0xe'),_0x1e39ae['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x33e7('0xf'),'user',_0x33e7('0x10'),_0x33e7('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x33e7('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x33e7('0x5')],'defaultValue':_0x33e7('0x12')},'internal':{'type':Sequelize[_0x33e7('0x13')](0xb),'allowNull':![],'unique':_0x33e7('0xd'),'set':function(_0x4c1207){this[_0x33e7('0x7')](_0x33e7('0xd'),_0x4c1207);this[_0x33e7('0x7')](_0x33e7('0x14'),_0x4c1207);this[_0x33e7('0x7')](_0x33e7('0xa'),util[_0x33e7('0x15')]('\x22%s\x22\x20<%s>',this[_0x33e7('0xc')](_0x33e7('0x16')),_0x4c1207));}},'salt':{'type':Sequelize[_0x33e7('0x5')]},'phone':{'type':Sequelize[_0x33e7('0x5')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x33e7('0x5')]},'zipcode':{'type':Sequelize[_0x33e7('0x5')]},'userpic':{'type':Sequelize[_0x33e7('0x5')]},'city':{'type':Sequelize[_0x33e7('0x5')]},'country':{'type':Sequelize[_0x33e7('0x5')]},'online':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x33e7('0x5')],'defaultValue':_0x33e7('0x18')},'lastPauseAt':{'type':Sequelize[_0x33e7('0x19')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x33e7('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x33e7('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x33e7('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x33e7('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x33e7('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x33e7('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x33e7('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![],'defaultValue':_0x33e7('0x1a')},'ipaddr':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x33e7('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x33e7('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x1c'),_0x33e7('0x1d'),_0x33e7('0x1e')),'allowNull':!![],'defaultValue':_0x33e7('0x1c')},'context':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![],'defaultValue':_0x33e7('0x1f')},'callingpres':{'type':Sequelize[_0x33e7('0x1b')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x33e7('0x20'),_0x33e7('0x21'),'PROHIB_NOT_SCREENED',_0x33e7('0x22'),_0x33e7('0x23'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![],'defaultValue':_0x33e7('0x24'),'set':function(_0xd02806){this[_0x33e7('0x7')](_0x33e7('0x25'),_0xd02806?_0xd02806[_0x33e7('0x26')](','):null);},'get':function(){return this[_0x33e7('0xc')](_0x33e7('0x25'))?this[_0x33e7('0xc')]('transport')[_0x33e7('0x27')](','):null;},'comment':_0x33e7('0x28')},'dtmfmode':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x29'),'info',_0x33e7('0x2a'),'inband',_0x33e7('0x2b')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x33e7('0x2c'),_0x33e7('0x2d'),_0x33e7('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![],'defaultValue':_0x33e7('0x30'),'set':function(_0x281868){this['setDataValue'](_0x33e7('0x31'),_0x281868?_0x281868['join'](','):null);},'get':function(){return this[_0x33e7('0xc')](_0x33e7('0x31'))?this[_0x33e7('0xc')](_0x33e7('0x31'))[_0x33e7('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x33e7('0x5')]},'namedcallgroup':{'type':Sequelize[_0x33e7('0x5')]},'pickupgroup':{'type':Sequelize[_0x33e7('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x33e7('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x33e7('0x5')]},'disallow':{'type':Sequelize[_0x33e7('0x5')],'allowNull':![],'defaultValue':_0x33e7('0x32')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x591493){this['setDataValue']('allow',_0x591493?_0x591493[_0x33e7('0x26')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x33e7('0xc')](_0x33e7('0x33'))?this[_0x33e7('0xc')](_0x33e7('0x33'))[_0x33e7('0x27')](';'):null;},'comment':_0x33e7('0x34')},'autoframing':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x2f'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![],'set':function(_0x503233){this['setDataValue'](_0x33e7('0x35'),_0x503233?_0x503233[_0x33e7('0x26')](','):null);},'get':function(){return this[_0x33e7('0xc')](_0x33e7('0x35'))?this['getDataValue'](_0x33e7('0x35'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x33e7('0x2f'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x2f'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x2f'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x33e7('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x2f'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x2f'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x2f'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x33e7('0x2f'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x2f'),'no',_0x33e7('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x2f'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x33e7('0x37'),_0x33e7('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x33e7('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x33e7('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x33e7('0x1b')]('uac',_0x33e7('0x39')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x33e7('0x2f')},'keepalive':{'type':Sequelize[_0x33e7('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x33e7('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x33e7('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x33e7('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x33e7('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x33e7('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x33e7('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x2f'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x2f'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x2f'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x2f'),'no',_0x33e7('0x3a'),_0x33e7('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x33e7('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x33e7('0x1b')]('active',_0x33e7('0x3c'),_0x33e7('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x33e7('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x2f'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x33e7('0x1b')](_0x33e7('0x2f'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x33e7('0x1b')]('yes','no',_0x33e7('0x2c'),_0x33e7('0x2d'),_0x33e7('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x33e7('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0x33e7('0x19')]},'passwordResetAt':{'type':Sequelize[_0x33e7('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x33e7('0x3f')]},'showWebBar':{'type':Sequelize[_0x33e7('0x13')],'defaultValue':0x0,'set':function(_0xd1c22e){this[_0x33e7('0x7')](_0x33e7('0x40'),_0xd1c22e);var _0x4eb36f=this[_0x33e7('0x41')]({'plain':!![]});switch(_0xd1c22e){case 0x0:case 0x1:var _0x4f5690=_0x4eb36f[_0x33e7('0x25')]?_[_0x33e7('0x42')](_0x4eb36f[_0x33e7('0x25')])?_0x4eb36f[_0x33e7('0x25')][_0x33e7('0x26')]():_0x4eb36f[_0x33e7('0x25')]:_0x33e7('0x24');if(_0x4f5690==='wss'){_0x4f5690='udp';}this[_0x33e7('0x7')](_0x33e7('0x25'),_0x4f5690);this[_0x33e7('0x7')](_0x33e7('0x43'),'no');this[_0x33e7('0x7')](_0x33e7('0x44'),null);this[_0x33e7('0x7')](_0x33e7('0x45'),null);this[_0x33e7('0x7')](_0x33e7('0x46'),null);this[_0x33e7('0x7')](_0x33e7('0x47'),null);this['setDataValue']('dtlsverify',null);this[_0x33e7('0x7')]('dtlssetup',null);this['setDataValue'](_0x33e7('0x48'),null);this[_0x33e7('0x7')](_0x33e7('0x49'),null);this[_0x33e7('0x7')]('rtcp_mux','no');break;case 0x2:this[_0x33e7('0x7')](_0x33e7('0x25'),'wss');this['setDataValue'](_0x33e7('0x43'),_0x33e7('0x2f'));this['setDataValue']('avpf',_0x33e7('0x2f'));this[_0x33e7('0x7')]('force_avp','yes');this['setDataValue'](_0x33e7('0x46'),_0x33e7('0x2f'));this['setDataValue'](_0x33e7('0x47'),_0x33e7('0x2f'));this[_0x33e7('0x7')](_0x33e7('0x4a'),'no');this[_0x33e7('0x7')]('dtlssetup',_0x33e7('0x3d'));this['setDataValue'](_0x33e7('0x48'),_0x4eb36f[_0x33e7('0x48')]||'/etc/pki/tls/certs/motion.crt');this[_0x33e7('0x7')]('dtlsprivatekey',_0x4eb36f[_0x33e7('0x49')]||_0x33e7('0x4b'));this[_0x33e7('0x7')](_0x33e7('0x4c'),_0x33e7('0x2f'));break;default:}}},'permissions':{'type':Sequelize[_0x33e7('0x3f')],'set':function(_0x932078){this[_0x33e7('0x7')](_0x33e7('0x4d'),_0x932078?_0x932078['join'](','):[]);},'get':function(){return this[_0x33e7('0xc')](_0x33e7('0x4d'))?_['map'](this[_0x33e7('0xc')]('permissions')['split'](','),function(_0x252c07){return parseInt(_0x252c07,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x33e7('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x33e7('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0x33e7('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x33e7('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x33e7('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x33e7('0x2f'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x33e7('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x33e7('0x4e')],'get':function(){return this['getDataValue'](_0x33e7('0x4f'))?this[_0x33e7('0xc')](_0x33e7('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x33e7('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x33e7('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![],'set':function(_0x182050){if(typeof _0x182050===_0x33e7('0x50')){var _0x23d3a0=_0x182050==='1'?!![]:_0x182050==='0'?![]:_0x182050===_0x33e7('0x51')?!![]:_0x182050===_0x33e7('0x52')?![]:![];this[_0x33e7('0x7')](_0x33e7('0x53'),_0x23d3a0);}else{this[_0x33e7('0x7')]('screenrecording',_0x182050);}}},'blocked':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![],'set':function(_0x504325){this[_0x33e7('0x7')](_0x33e7('0x54'),_0x504325);if(_0x504325===!![]){this[_0x33e7('0x7')]('blockedAt',moment());this['setDataValue'](_0x33e7('0x55'),0x0);}else{this[_0x33e7('0x7')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x33e7('0x13')](0x5)[_0x33e7('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x33e7('0x13')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x33e7('0x13')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x33e7('0x13')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x33e7('0x13')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x33e7('0x13')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x33e7('0x17')],'defaultValue':![]}}; \ No newline at end of file +var _0x4bd5=['PROHIB_FAILED_SCREEN','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','nonat','update','outgoing','yes','join','nat','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','active','passive','actpass','update,nonat','TEXT','showWebBar','isArray','encryption','avpf','force_avp','dtlsenable','dtlsverify','dtlscertfile','rtcp_mux','wss','icesupport','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','STRING','name','setDataValue','defaultuser','format','getDataValue','internal','email','toLowerCase','user','agent','local','accountcode','callerid','\x22%s\x22\x20<%s>','fullname','BOOLEAN','DEFAULT\x20PAUSE','DATE','INTEGER','dynamic','ENUM','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN'];(function(_0x169bc3,_0xae09fa){var _0x7ada13=function(_0x1e73d2){while(--_0x1e73d2){_0x169bc3['push'](_0x169bc3['shift']());}};_0x7ada13(++_0xae09fa);}(_0x4bd5,0x94));var _0x54bd=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0x4bd5[_0x22dac7];return _0x3e6cfa;};'use strict';var Sequelize=require(_0x54bd('0x0'));var moment=require(_0x54bd('0x1'));var util=require('util');var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x54bd('0x2')],'allowNull':![],'unique':_0x54bd('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4c825c){this[_0x54bd('0x4')](_0x54bd('0x3'),_0x4c825c);this[_0x54bd('0x4')](_0x54bd('0x5'),_0x4c825c);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x34cc9f){this[_0x54bd('0x4')]('fullname',_0x34cc9f);this['setDataValue']('callerid',util[_0x54bd('0x6')]('\x22%s\x22\x20<%s>',_0x34cc9f,this[_0x54bd('0x7')](_0x54bd('0x8'))));}},'alias':{'type':Sequelize[_0x54bd('0x2')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0xa36a4d){if(_0xa36a4d){this[_0x54bd('0x4')](_0x54bd('0x9'),_0xa36a4d[_0x54bd('0xa')]());}}},'role':{'type':Sequelize['ENUM']('admin',_0x54bd('0xb'),_0x54bd('0xc'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x54bd('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x54bd('0xd')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x54bd('0x8'),'set':function(_0x177184){this['setDataValue'](_0x54bd('0x8'),_0x177184);this[_0x54bd('0x4')](_0x54bd('0xe'),_0x177184);this['setDataValue'](_0x54bd('0xf'),util[_0x54bd('0x6')](_0x54bd('0x10'),this[_0x54bd('0x7')](_0x54bd('0x11')),_0x177184));}},'salt':{'type':Sequelize[_0x54bd('0x2')]},'phone':{'type':Sequelize[_0x54bd('0x2')]},'mobile':{'type':Sequelize[_0x54bd('0x2')]},'address':{'type':Sequelize[_0x54bd('0x2')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x54bd('0x2')]},'city':{'type':Sequelize[_0x54bd('0x2')]},'country':{'type':Sequelize[_0x54bd('0x2')]},'online':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x54bd('0x13')},'lastPauseAt':{'type':Sequelize[_0x54bd('0x14')]},'chatCapacity':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x54bd('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x54bd('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x54bd('0x16')},'ipaddr':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'port':{'type':Sequelize[_0x54bd('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x18'),'user','peer'),'allowNull':!![],'defaultValue':_0x54bd('0x18')},'context':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![],'defaultValue':_0x54bd('0x19')},'callingpres':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x1a'),_0x54bd('0x1b'),_0x54bd('0x1c'),_0x54bd('0x1d'),_0x54bd('0x1e'),_0x54bd('0x1f'),_0x54bd('0x20'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'transport':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![],'defaultValue':_0x54bd('0x21'),'set':function(_0x16f8bc){this[_0x54bd('0x4')]('transport',_0x16f8bc?_0x16f8bc['join'](','):null);},'get':function(){return this[_0x54bd('0x7')]('transport')?this[_0x54bd('0x7')](_0x54bd('0x22'))[_0x54bd('0x23')](','):null;},'comment':_0x54bd('0x24')},'dtmfmode':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x25'),'info',_0x54bd('0x26'),_0x54bd('0x27'),_0x54bd('0x28')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x54bd('0x17')]('yes','no',_0x54bd('0x29'),_0x54bd('0x2a'),_0x54bd('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'nat':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x55d0bc){this[_0x54bd('0x4')]('nat',_0x55d0bc?_0x55d0bc[_0x54bd('0x2d')](','):null);},'get':function(){return this[_0x54bd('0x7')]('nat')?this[_0x54bd('0x7')](_0x54bd('0x2e'))[_0x54bd('0x23')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x54bd('0x2')]},'namedcallgroup':{'type':Sequelize[_0x54bd('0x2')]},'pickupgroup':{'type':Sequelize[_0x54bd('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x54bd('0x2')]},'language':{'type':Sequelize[_0x54bd('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x54bd('0x2')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x54bd('0x2f'),'set':function(_0x27442d){this[_0x54bd('0x4')](_0x54bd('0x30'),_0x27442d?_0x27442d[_0x54bd('0x2d')](';'):_0x54bd('0x2f'));},'get':function(){return this[_0x54bd('0x7')](_0x54bd('0x30'))?this['getDataValue'](_0x54bd('0x30'))[_0x54bd('0x23')](';'):null;},'comment':_0x54bd('0x31')},'autoframing':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x8210cf){this[_0x54bd('0x4')](_0x54bd('0x32'),_0x8210cf?_0x8210cf[_0x54bd('0x2d')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x54bd('0x7')]('insecure')[_0x54bd('0x23')](','):null;},'comment':_0x54bd('0x33')},'trustrpid':{'type':Sequelize['ENUM'](_0x54bd('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no',_0x54bd('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x54bd('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![],'defaultValue':_0x54bd('0x35')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x54bd('0x2c')},'busylevel':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x54bd('0x17')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x54bd('0x17')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x54bd('0x17')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no',_0x54bd('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x54bd('0x37'),_0x54bd('0x38'),_0x54bd('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x3a'),_0x54bd('0x3b')),'allowNull':!![],'defaultValue':_0x54bd('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x54bd('0x17')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x54bd('0x17')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x54bd('0x17')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x54bd('0x2c'),'no',_0x54bd('0x3c'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x3d'),_0x54bd('0x3e'),_0x54bd('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x54bd('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x54bd('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no',_0x54bd('0x29'),_0x54bd('0x2a'),_0x54bd('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x54bd('0x2')]},'resetPasswordExpires':{'type':Sequelize[_0x54bd('0x14')]},'passwordResetAt':{'type':Sequelize[_0x54bd('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x54bd('0x41')]},'showWebBar':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0,'set':function(_0x53f506){this[_0x54bd('0x4')](_0x54bd('0x42'),_0x53f506);var _0x49610e=this['get']({'plain':!![]});switch(_0x53f506){case 0x0:case 0x1:var _0x36cf9d=_0x49610e[_0x54bd('0x22')]?_[_0x54bd('0x43')](_0x49610e[_0x54bd('0x22')])?_0x49610e[_0x54bd('0x22')][_0x54bd('0x2d')]():_0x49610e[_0x54bd('0x22')]:_0x54bd('0x21');if(_0x36cf9d==='wss'){_0x36cf9d=_0x54bd('0x21');}this[_0x54bd('0x4')]('transport',_0x36cf9d);this['setDataValue'](_0x54bd('0x44'),'no');this[_0x54bd('0x4')](_0x54bd('0x45'),null);this['setDataValue'](_0x54bd('0x46'),null);this['setDataValue']('icesupport',null);this[_0x54bd('0x4')](_0x54bd('0x47'),null);this[_0x54bd('0x4')](_0x54bd('0x48'),null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x54bd('0x49'),null);this['setDataValue']('dtlsprivatekey',null);this['setDataValue'](_0x54bd('0x4a'),'no');break;case 0x2:this[_0x54bd('0x4')](_0x54bd('0x22'),_0x54bd('0x4b'));this[_0x54bd('0x4')]('encryption',_0x54bd('0x2c'));this[_0x54bd('0x4')]('avpf',_0x54bd('0x2c'));this[_0x54bd('0x4')](_0x54bd('0x46'),'yes');this[_0x54bd('0x4')](_0x54bd('0x4c'),_0x54bd('0x2c'));this[_0x54bd('0x4')](_0x54bd('0x47'),'yes');this['setDataValue'](_0x54bd('0x48'),'no');this['setDataValue']('dtlssetup','actpass');this[_0x54bd('0x4')](_0x54bd('0x49'),_0x49610e[_0x54bd('0x49')]||_0x54bd('0x4d'));this['setDataValue'](_0x54bd('0x4e'),_0x49610e[_0x54bd('0x4e')]||_0x54bd('0x4f'));this['setDataValue']('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0x54bd('0x41')],'set':function(_0x51da01){this[_0x54bd('0x4')](_0x54bd('0x50'),_0x51da01?_0x51da01[_0x54bd('0x2d')](','):[]);},'get':function(){return this[_0x54bd('0x7')]('permissions')?_['map'](this[_0x54bd('0x7')]('permissions')[_0x54bd('0x23')](','),function(_0x157295){return parseInt(_0x157295,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x54bd('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x54bd('0x2')]},'phoneBarBusyNumber':{'type':Sequelize[_0x54bd('0x2')]},'phoneBarUnconditional':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x54bd('0x2')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x54bd('0x17')](_0x54bd('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x54bd('0x2')]},'phoneBarEnableJaws':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x54bd('0x51')],'get':function(){return this[_0x54bd('0x7')](_0x54bd('0x52'))?this[_0x54bd('0x7')](_0x54bd('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x54bd('0x2')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x54bd('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![],'set':function(_0x14cfa2){if(typeof _0x14cfa2===_0x54bd('0x53')){var _0x38d21e=_0x14cfa2==='1'?!![]:_0x14cfa2==='0'?![]:_0x14cfa2===_0x54bd('0x54')?!![]:_0x14cfa2===_0x54bd('0x55')?![]:![];this[_0x54bd('0x4')](_0x54bd('0x56'),_0x38d21e);}else{this[_0x54bd('0x4')](_0x54bd('0x56'),_0x14cfa2);}}},'blocked':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![],'set':function(_0x1c279c){this[_0x54bd('0x4')](_0x54bd('0x57'),_0x1c279c);if(_0x1c279c===!![]){this[_0x54bd('0x4')](_0x54bd('0x58'),moment());this['setDataValue'](_0x54bd('0x59'),0x0);}else{this[_0x54bd('0x4')](_0x54bd('0x58'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x54bd('0x15')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x54bd('0x12')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index ca0225c..9693b0b 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 _0xc73b=['addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','$and','$or','$gt','$gte','$lt','$lte','$ne','$between','$notBetween','$in','$notIn','$like','$notLike','$overlap','$contains','$any','firstName','lastName','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','json','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','send','Unable\x20to\x20retrieve\x20the\x20current\x20user','idle','unknown','ringing','queues','inbound','flatten','toString','col','asc','uniqBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','toUpperCase','slice','SELECT','select','field','ui.','InteractionId','user_has_','ui.UserId\x20=\x20?','messengerSoundNotification','enabled','util','path','lodash','squel','ioredis','jayson/promise','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../config/utils','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIForbiddenrror','redis','register','client','http','sendStatus','status','end','offset','limit','undefined','count','set','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','update','role','agent','emit','admin','Users','user','Agents','Telephones','telephone','map','value','includes','find','destroy','stack','name','User','rawAttributes','fieldName','type','key','filter','previousPasswords','resetPasswordToken','md5secret','index','where','query','includeAll','include','true','userSetting','attributes','push','rows','openTabs','length','chat','dataValues','sms','openchannel','whatsapp','all','show','params','getOptions','merge','fax','mail','body','describe','addContacts','ids','omit','internal','findById','securePassword','password','min_internal','isNil','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)','sequelize','QueryTypes','from','voicemail','mailbox','VoiceMail','permissions','102','103','113','110','105','106','107','100','114','115','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','create','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','UserProfileSection','findAll','isEmpty','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','validatePasswordPattern','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','add','toLowerCase','Queues','spread','capitalize','Queue:save','voice','get','interface','format','upsert','removeQueues','isValidChannel','remove','isArray','QueueId','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','ChatOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getQueues','Unknown\x20channel','model','keys','filters','intersection','fields','order','sort','pick','options','nolimit','Queue','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','VoiceRecording','UserId','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','SIP/%s','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','LOGININPAUSE','isMiddleware','resolve','forEach','pause','QueuePause','PAUSE','updateAttributes','getChannels','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','flattenDeep','addAgent','getDataValue','UserVoicePrefix','VoicePrefixId','removeTeams','getAssociatedQueues','Voice','TeamVoicePrefix','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts'];(function(_0x331e77,_0x114123){var _0x5b1b95=function(_0x1691ae){while(--_0x1691ae){_0x331e77['push'](_0x331e77['shift']());}};_0x5b1b95(++_0x114123);}(_0xc73b,0x1d7));var _0xbc73=function(_0x20ebdf,_0x4ce6fb){_0x20ebdf=_0x20ebdf-0x0;var _0x48c19c=_0xc73b[_0x20ebdf];return _0x48c19c;};'use strict';var moment=require('moment');var util=require(_0xbc73('0x0'));var path=require(_0xbc73('0x1'));var fs=require('fs');var _=require(_0xbc73('0x2'));var squel=require(_0xbc73('0x3'));var Redis=require(_0xbc73('0x4'));var jayson=require(_0xbc73('0x5'));var authService=require(_0xbc73('0x6'));var contacts=require(_0xbc73('0x7'));var qs=require(_0xbc73('0x8'));var rta=require(_0xbc73('0x9'));var logger=require(_0xbc73('0xa'))(_0xbc73('0xb'));var utils=require(_0xbc73('0xc'));var config=require(_0xbc73('0xd'));var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0xbc73('0xe'))[_0xbc73('0xf')];var APINotFoundError=require(_0xbc73('0xe'))[_0xbc73('0x10')];var APIForbiddenError=require('../../errors/api')[_0xbc73('0x11')];var APIHandleError=require(_0xbc73('0xe'))['handleError'];var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xbc73('0x12')]));require('./user.socket')[_0xbc73('0x13')](socket);config[_0xbc73('0x12')]=_['defaults'](config[_0xbc73('0x12')],{'host':'localhost','port':0x18eb});var amiClient=jayson[_0xbc73('0x14')][_0xbc73('0x15')]({'port':0x232a});var values;function respondWithStatusCode(_0x318228,_0x1a93ce){_0x1a93ce=_0x1a93ce||0xcc;return function(_0x32d769){if(_0x32d769){return _0x318228[_0xbc73('0x16')](_0x1a93ce);}return _0x318228[_0xbc73('0x17')](_0x1a93ce)[_0xbc73('0x18')]();};}function respondWithResult(_0x3909cf,_0x2e090c){_0x2e090c=_0x2e090c||0xc8;return function(_0x5a8ba9){if(_0x5a8ba9){return _0x3909cf[_0xbc73('0x17')](_0x2e090c)['json'](_0x5a8ba9);}};}function respondWithFilteredResult(_0x42f756,_0x20a508){return function(_0x30b8f0){if(_0x30b8f0){var _0xf9c20f=typeof _0x20a508[_0xbc73('0x19')]==='undefined'&&typeof _0x20a508[_0xbc73('0x1a')]===_0xbc73('0x1b');var _0x29e42d=_0x30b8f0[_0xbc73('0x1c')];var _0x19cafe=_0xf9c20f?0x0:_0x20a508['offset'];var _0x1176aa=_0xf9c20f?_0x30b8f0[_0xbc73('0x1c')]:_0x20a508[_0xbc73('0x19')]+_0x20a508[_0xbc73('0x1a')];var _0x5eab70;if(_0x1176aa>=_0x29e42d){_0x1176aa=_0x29e42d;_0x5eab70=0xc8;}else{_0x5eab70=0xce;}_0x42f756[_0xbc73('0x17')](_0x5eab70);return _0x42f756[_0xbc73('0x1d')]('Content-Range',_0x19cafe+'-'+_0x1176aa+'/'+_0x29e42d)['json'](_0x30b8f0);}return null;};}function respondWithRpcPromise(_0x40310b,_0x303d89,_0xab5346,_0x48a26f){return new Promise(function(_0x979ff5,_0x3ce385){var _0x42e574=_0x48a26f||amiClient;return _0x42e574['request'](_0x40310b,_0xab5346)[_0xbc73('0x1e')](function(_0x1732b4){logger[_0xbc73('0x1f')](_0xbc73('0x20'),_0x303d89,_0xbc73('0x21'));logger['debug'](_0xbc73('0x22'),_0x303d89,_0xbc73('0x21'),JSON[_0xbc73('0x23')](_0x1732b4));if(_0x1732b4[_0xbc73('0x24')]){if(_0x1732b4[_0xbc73('0x24')][_0xbc73('0x25')]===0x1f4){logger[_0xbc73('0x24')](_0xbc73('0x20'),_0x303d89,_0x1732b4[_0xbc73('0x24')]['message']);return _0x3ce385(_0x1732b4[_0xbc73('0x24')][_0xbc73('0x26')]);}logger[_0xbc73('0x24')](_0xbc73('0x20'),_0x303d89,_0x1732b4[_0xbc73('0x24')][_0xbc73('0x26')]);return _0x979ff5(_0x1732b4['error'][_0xbc73('0x26')]);}else{logger[_0xbc73('0x1f')](_0xbc73('0x20'),_0x303d89,'request\x20sent');_0x979ff5(_0x1732b4[_0xbc73('0x27')][_0xbc73('0x26')]);}})[_0xbc73('0x28')](function(_0x5c4cab){logger[_0xbc73('0x24')]('User,\x20%s,\x20%s',_0x303d89,_0x5c4cab);_0x3ce385(_0x5c4cab);});});}function saveUpdates(_0x32a04a){return function(_0x143051){if(_0x143051){return _0x143051[_0xbc73('0x29')](_0x32a04a)[_0xbc73('0x1e')](function(_0x4cfb0c){if(_0x4cfb0c[_0xbc73('0x2a')]===_0xbc73('0x2b')){socket[_0xbc73('0x2c')]('userNotification:recalc:'+_0x4cfb0c['id'],_0x4cfb0c);}return _0x4cfb0c;});}return null;};}function removeEntity(_0x21428f,_0xdb7247){return function(_0x29da75){if(_0x29da75){return _0x29da75['destroy']({'transaction':_0xdb7247})[_0xbc73('0x1e')](function(){var _0x4bdb51=_0x29da75['get']({'plain':!![]});if(_0x4bdb51[_0xbc73('0x2a')]===_0xbc73('0x2d'))return;var _0x4e3836=[{'name':_0xbc73('0x2e'),'value':_0xbc73('0x2f'),'ignore':!![]},{'name':_0xbc73('0x30'),'value':_0xbc73('0x2b'),'ignore':![]},{'name':_0xbc73('0x31'),'value':_0xbc73('0x32'),'ignore':![]}];var _0xb91d29=_(_0x4e3836)['filter']('ignore')[_0xbc73('0x33')](_0xbc73('0x34'))['value']();if(_[_0xbc73('0x35')](_0xb91d29,_0x4bdb51['role'])){return;}var _0x457504=_[_0xbc73('0x36')](_0x4e3836,[_0xbc73('0x34'),_0x4bdb51[_0xbc73('0x2a')]])['name'];return db['UserProfileResource'][_0xbc73('0x37')]({'where':{'type':_0x457504,'resourceId':_0x4bdb51['id']},'transaction':_0xdb7247})['then'](function(){return _0x29da75;});})[_0xbc73('0x1e')](function(){_0x21428f[_0xbc73('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5253a1){return function(_0x1994d5){if(!_0x1994d5){_0x5253a1[_0xbc73('0x16')](0x194);}return _0x1994d5;};}function handleError(_0x566801,_0x4c30c1){_0x4c30c1=_0x4c30c1||0x1f4;return function(_0x409c36){logger[_0xbc73('0x24')](_0x409c36[_0xbc73('0x38')]);if(_0x409c36[_0xbc73('0x39')]){delete _0x409c36['name'];}_0x566801[_0xbc73('0x17')](_0x4c30c1)['send'](_0x409c36);};}function getUserAttributes(){return _(db[_0xbc73('0x3a')][_0xbc73('0x3b')])[_0xbc73('0x33')](function(_0x15a35d){return{'name':_0x15a35d[_0xbc73('0x3c')],'type':_0x15a35d[_0xbc73('0x3d')][_0xbc73('0x3e')]};})[_0xbc73('0x3f')](function(_0x11f5a9){return!['password','salt',_0xbc73('0x40'),_0xbc73('0x41'),'resetPasswordExpires',_0xbc73('0x42')][_0xbc73('0x35')](_0x11f5a9[_0xbc73('0x39')]);})[_0xbc73('0x34')]();}exports[_0xbc73('0x43')]=function(_0x24c417,_0x382ab2){var _0x549561={},_0x1eaf22={'count':0x0,'rows':[]};var _0x59178c=getUserAttributes();_0x549561=qs['getOptions'](_0x59178c,_0x24c417);var _0x14c386={'where':_0x549561[_0xbc73('0x44')]};return db[_0xbc73('0x3a')][_0xbc73('0x1c')](_0x14c386)[_0xbc73('0x1e')](function(_0x2a8be9){_0x1eaf22['count']=_0x2a8be9;if(_0x24c417[_0xbc73('0x45')][_0xbc73('0x46')]){_0x549561[_0xbc73('0x47')]=[{'all':!![]}];}if(_0x24c417[_0xbc73('0x45')]['userSetting']===_0xbc73('0x48')){_0x549561['include']=[{'model':db['UserSetting'],'as':_0xbc73('0x49')}];}if(!_[_0xbc73('0x35')](_0x549561[_0xbc73('0x4a')],'id')){_0x549561[_0xbc73('0x4a')][_0xbc73('0x4b')]('id');}return db[_0xbc73('0x3a')]['findAll'](_0x549561);})['then'](function(_0x364eed){_0x1eaf22[_0xbc73('0x4c')]=_0x364eed;if(_0x24c417[_0xbc73('0x45')][_0xbc73('0x4d')]==='true'){var _0x56e98c=[];for(var _0x32cf9e=0x0;_0x32cf9e<_0x1eaf22[_0xbc73('0x4c')][_0xbc73('0x4e')];_0x32cf9e++){_0x56e98c[_0xbc73('0x4b')](get_open_tabs(_0xbc73('0x4f'),_0x1eaf22['rows'][_0x32cf9e][_0xbc73('0x50')]));_0x56e98c[_0xbc73('0x4b')](get_open_tabs(_0xbc73('0x51'),_0x1eaf22[_0xbc73('0x4c')][_0x32cf9e]['dataValues']));_0x56e98c[_0xbc73('0x4b')](get_open_tabs('fax',_0x1eaf22[_0xbc73('0x4c')][_0x32cf9e][_0xbc73('0x50')]));_0x56e98c[_0xbc73('0x4b')](get_open_tabs('mail',_0x1eaf22['rows'][_0x32cf9e]['dataValues']));_0x56e98c[_0xbc73('0x4b')](get_open_tabs(_0xbc73('0x52'),_0x1eaf22[_0xbc73('0x4c')][_0x32cf9e][_0xbc73('0x50')]));_0x56e98c['push'](get_open_tabs(_0xbc73('0x53'),_0x1eaf22[_0xbc73('0x4c')][_0x32cf9e][_0xbc73('0x50')]));}return Promise[_0xbc73('0x54')](_0x56e98c)['then'](function(){return _0x1eaf22;});}else{return _0x1eaf22;}})[_0xbc73('0x1e')](respondWithFilteredResult(_0x382ab2,_0x549561))[_0xbc73('0x28')](handleError(_0x382ab2,null));};exports[_0xbc73('0x55')]=function(_0x143a38,_0x29148d){var _0x5939d6=getUserAttributes();_0x143a38[_0xbc73('0x45')]['id']=_0x143a38[_0xbc73('0x56')]['id'];var _0x5e5f54=qs[_0xbc73('0x57')](_0x5939d6,_0x143a38);if(_0x143a38[_0xbc73('0x45')][_0xbc73('0x46')]){_0x5e5f54[_0xbc73('0x47')]=[{'all':!![]}];}if(_0x143a38[_0xbc73('0x45')][_0xbc73('0x49')]===_0xbc73('0x48')){_0x5e5f54[_0xbc73('0x47')]=[{'model':db['UserSetting'],'as':_0xbc73('0x49')}];}_0x5e5f54=_[_0xbc73('0x58')]({},_0x5e5f54,_0x143a38['options']);if(!_['includes'](_0x5e5f54[_0xbc73('0x4a')],'id')){_0x5e5f54[_0xbc73('0x4a')]['push']('id');}return db[_0xbc73('0x3a')][_0xbc73('0x36')](_0x5e5f54)[_0xbc73('0x1e')](handleEntityNotFound(_0x29148d,null))[_0xbc73('0x1e')](function(_0x555f29){var _0x4932e4=[];values=_0x555f29;if(_0x143a38[_0xbc73('0x45')][_0xbc73('0x4d')]===_0xbc73('0x48')){_0x4932e4[_0xbc73('0x4b')](get_open_tabs(_0xbc73('0x4f'),_0x555f29[_0xbc73('0x50')]));_0x4932e4[_0xbc73('0x4b')](get_open_tabs(_0xbc73('0x51'),_0x555f29[_0xbc73('0x50')]));_0x4932e4[_0xbc73('0x4b')](get_open_tabs(_0xbc73('0x52'),_0x555f29[_0xbc73('0x50')]));_0x4932e4['push'](get_open_tabs('whatsapp',_0x555f29['dataValues']));_0x4932e4[_0xbc73('0x4b')](get_open_tabs(_0xbc73('0x59'),_0x555f29['dataValues']));_0x4932e4[_0xbc73('0x4b')](get_open_tabs(_0xbc73('0x5a'),_0x555f29[_0xbc73('0x50')]));return Promise['all'](_0x4932e4);}else{return values;}})[_0xbc73('0x1e')](function(){return values;})[_0xbc73('0x1e')](respondWithResult(_0x29148d,null))[_0xbc73('0x28')](handleError(_0x29148d,null));};exports[_0xbc73('0x29')]=function(_0x16414d,_0x2b9980){if(_0x16414d[_0xbc73('0x5b')]['id']){delete _0x16414d[_0xbc73('0x5b')]['id'];}delete _0x16414d['body'][_0xbc73('0x2a')];return db[_0xbc73('0x3a')][_0xbc73('0x36')]({'where':{'id':_0x16414d[_0xbc73('0x56')]['id']}})[_0xbc73('0x1e')](handleEntityNotFound(_0x2b9980,null))['then'](saveUpdates(_0x16414d[_0xbc73('0x5b')],null))[_0xbc73('0x1e')](respondWithResult(_0x2b9980,null))[_0xbc73('0x28')](handleError(_0x2b9980,null));};exports[_0xbc73('0x5c')]=function(_0x59228a,_0x925697){return db[_0xbc73('0x3a')]['describe']()[_0xbc73('0x1e')](respondWithResult(_0x925697,null))['catch'](handleError(_0x925697,null));};exports[_0xbc73('0x5d')]=function(_0x3e2541,_0x1f3fd0){return db[_0xbc73('0x3a')][_0xbc73('0x36')]({'where':{'id':_0x3e2541[_0xbc73('0x56')]['id']}})[_0xbc73('0x1e')](handleEntityNotFound(_0x1f3fd0,null))[_0xbc73('0x1e')](function(_0x492cb1){if(_0x492cb1){return _0x492cb1[_0xbc73('0x5d')](_0x3e2541[_0xbc73('0x5b')][_0xbc73('0x5e')],_[_0xbc73('0x5f')](_0x3e2541['body'],[_0xbc73('0x5e'),'id'])||{});}})[_0xbc73('0x1e')](respondWithResult(_0x1f3fd0,null))[_0xbc73('0x28')](handleError(_0x1f3fd0,null));};function validateUser(_0x8b12cf){return new Promise(function(_0x4885c1,_0x158442){if(_0x8b12cf[_0xbc73('0x60')])return _0x4885c1(_0x8b12cf);return db['Setting'][_0xbc73('0x61')](0x1)[_0xbc73('0x1e')](function(_0x3416ff){if(_0x3416ff[_0xbc73('0x62')])authService['validatePasswordPattern'](_0x8b12cf[_0xbc73('0x63')]);db[_0xbc73('0x3a')]['max']('internal')['then'](function(_0x63aef6){if(_['isNil'](_0x63aef6)){_0x8b12cf[_0xbc73('0x60')]=_0x3416ff[_0xbc73('0x64')]||0x1;return;}if(_[_0xbc73('0x65')](_0x3416ff[_0xbc73('0x64')])||_0x3416ff[_0xbc73('0x64')]===_0x63aef6){_0x8b12cf[_0xbc73('0x60')]=_0x63aef6+0x1;return;}if(_0x3416ff['min_internal']>_0x63aef6){_0x8b12cf[_0xbc73('0x60')]=_0x3416ff['min_internal'];return;}return db['sequelize'][_0xbc73('0x45')](_0xbc73('0x66'),{'type':db[_0xbc73('0x67')][_0xbc73('0x68')]['SELECT']})[_0xbc73('0x1e')](function(_0x1eb9ea){if(_0x1eb9ea&&_0x1eb9ea[_0xbc73('0x4e')]){for(var _0x2fe81c=0x0,_0x4dd8a0=_0x1eb9ea[_0xbc73('0x4e')];_0x2fe81c<_0x4dd8a0&&_[_0xbc73('0x65')](_0x8b12cf[_0xbc73('0x60')]);_0x2fe81c++){if(_0x3416ff[_0xbc73('0x64')]<=_0x1eb9ea[_0x2fe81c]['from']){_0x8b12cf[_0xbc73('0x60')]=_0x1eb9ea[_0x2fe81c][_0xbc73('0x69')];}else if(_0x3416ff[_0xbc73('0x64')]>_0x1eb9ea[_0x2fe81c]['from']&&_0x3416ff['min_internal']<=_0x1eb9ea[_0x2fe81c]['to']){_0x8b12cf[_0xbc73('0x60')]=_0x3416ff['min_internal'];}}}if(_['isNil'](_0x8b12cf[_0xbc73('0x60')])){_0x8b12cf['internal']=_0x63aef6+0x1;}return _0x4885c1(_0x8b12cf);});});})[_0xbc73('0x28')](function(_0x25920d){_0x158442(_0x25920d);});});}function updateUser(_0x37e3b4){return new Promise(function(_0x2ceddc,_0x4536c9){try{if(_0x37e3b4[_0xbc73('0x6a')]){_0x37e3b4[_0xbc73('0x6b')]=_0x37e3b4[_0xbc73('0x60')];_0x37e3b4[_0xbc73('0x6c')]={'mailbox':_0x37e3b4[_0xbc73('0x60')],'password':_0x37e3b4['password'],'fullname':_0x37e3b4['fullname'],'email':_0x37e3b4['email']};}if(_0x37e3b4[_0xbc73('0x2a')]===_0xbc73('0x2b')){if(!_0x37e3b4[_0xbc73('0x6d')])_0x37e3b4[_0xbc73('0x6d')]=['101',_0xbc73('0x6e'),_0xbc73('0x6f'),_0xbc73('0x70'),_0xbc73('0x71'),'104',_0xbc73('0x72'),_0xbc73('0x73'),_0xbc73('0x74'),'108','109',_0xbc73('0x75'),'111',_0xbc73('0x76'),_0xbc73('0x77')];}_0x2ceddc(_0x37e3b4);}catch(_0x1b68c0){_0x4536c9(_0x1b68c0);}});}exports['create']=function(_0xde213a,_0x3513cb){if(_0xde213a[_0xbc73('0x2f')]['role']==='agent')throw new Error(_0xbc73('0x78'));if(_0xde213a[_0xbc73('0x5b')][_0xbc73('0x2a')]===_0xbc73('0x2f')&&_0xde213a['user'][_0xbc73('0x2a')]!==_0xbc73('0x2d')){throw new Error(_0xbc73('0x79'));}if(_0xde213a[_0xbc73('0x5b')]['role']===_0xbc73('0x2d')&&_0xde213a[_0xbc73('0x2f')][_0xbc73('0x2a')]!==_0xbc73('0x2d')){throw new Error(_0xbc73('0x7a'));}return licenseUtil['checkUserLimits']([_0xde213a['body']])['then'](function(){return validateUser(_0xde213a[_0xbc73('0x5b')]);})['then'](function(_0x62fedc){return updateUser(_0x62fedc)['then'](function(_0x41da30){if(_0x41da30[_0xbc73('0x2a')]===_0xbc73('0x2d')){_0x41da30[_0xbc73('0x7b')]=_0xde213a[_0xbc73('0x2f')][_0xbc73('0x7b')];delete _0x41da30['userProfileId'];}return _0x41da30;});})['then'](function(_0x3e6215){return db[_0xbc73('0x3a')][_0xbc73('0x7c')](_0x3e6215,{'include':[{'model':db[_0xbc73('0x6c')],'as':_0xbc73('0x6c')}]});})[_0xbc73('0x1e')](function(_0xa046a5){if(_0xde213a[_0xbc73('0x5b')][_0xbc73('0x2a')]==='user')return _0xa046a5;if(_0xde213a['user']['role']!==_0xbc73('0x2f'))return _0xa046a5;return db['UserProfileSection']['find']({'where':{'name':_0xa046a5[_0xbc73('0x2a')]===_0xbc73('0x2b')?'Agents':_0xbc73('0x31'),'userProfileId':_0xde213a[_0xbc73('0x2f')][_0xbc73('0x7d')]},'raw':!![]})['then'](function(_0x1e47f0){if(!_0x1e47f0||_0x1e47f0[_0xbc73('0x7e')]!=0x0)return _0xa046a5;return db[_0xbc73('0x7f')]['create']({'name':_0xa046a5[_0xbc73('0x39')],'resourceId':_0xa046a5['id'],'type':_0x1e47f0[_0xbc73('0x39')],'sectionId':_0x1e47f0['id']},{})[_0xbc73('0x1e')](function(){return _0xa046a5;});})[_0xbc73('0x28')](function(_0x4c9b06){logger[_0xbc73('0x24')](_0xbc73('0x80'),_0x4c9b06);throw _0x4c9b06;});})[_0xbc73('0x1e')](respondWithResult(_0x3513cb,0xc9))[_0xbc73('0x28')](handleError(_0x3513cb,null));};exports[_0xbc73('0x81')]=function(_0x1b689e,_0x163bfa){var _0x2f72e3=_0x1b689e[_0xbc73('0x5b')];var _0x52ea4e=[];if(_0x1b689e[_0xbc73('0x2f')][_0xbc73('0x2a')]==='agent')throw new Error(_0xbc73('0x78'));if(_[_0xbc73('0x82')](_0x2f72e3,[_0xbc73('0x2a'),_0xbc73('0x2f')])&&_0x1b689e['user'][_0xbc73('0x2a')]!==_0xbc73('0x2d')){throw new Error(_0xbc73('0x79'));}if(_[_0xbc73('0x82')](_0x2f72e3,['role',_0xbc73('0x2d')])&&_0x1b689e[_0xbc73('0x2f')][_0xbc73('0x2a')]!=='admin'){throw new Error(_0xbc73('0x83'));}return licenseUtil[_0xbc73('0x84')](_0x2f72e3)[_0xbc73('0x1e')](function(){return validateUser(_0x2f72e3[0x0]);})[_0xbc73('0x1e')](function(){for(var _0x29161a=0x1;_0x29161a<_0x2f72e3['length'];_0x29161a++){var _0x1bf12b=_0x2f72e3[_0x29161a-0x1][_0xbc73('0x60')];if(!_0x2f72e3[_0x29161a]['internal'])_0x2f72e3[_0x29161a][_0xbc73('0x60')]=_0x1bf12b+0x1;_0x52ea4e[_0xbc73('0x4b')](validateUser(_0x2f72e3[_0x29161a]));}return Promise[_0xbc73('0x54')](_0x52ea4e);})[_0xbc73('0x1e')](function(){_0x52ea4e=[];for(var _0x52b23c=0x0;_0x52b23c<_0x2f72e3[_0xbc73('0x4e')];_0x52b23c++){_0x52ea4e[_0xbc73('0x4b')](updateUser(_0x2f72e3[_0x52b23c]));}return Promise['all'](_0x52ea4e);})[_0xbc73('0x1e')](function(){_0x52ea4e=_0x2f72e3[_0xbc73('0x33')](function(_0x483e3d){return db[_0xbc73('0x3a')][_0xbc73('0x7c')](_0x483e3d,{'include':[{'model':db[_0xbc73('0x6c')],'as':_0xbc73('0x6c')}]})['then'](function(_0x5f5638){_0x483e3d['id']=_0x5f5638['id'];return _0x483e3d;});});return Promise[_0xbc73('0x54')](_0x52ea4e);})[_0xbc73('0x1e')](function(_0x5474fe){if(_0x1b689e['body'][_0xbc73('0x2a')]==='user')return _0x5474fe;if(_0x1b689e['user'][_0xbc73('0x2a')]!==_0xbc73('0x2f'))return _0x5474fe;var _0x2c3532=_[_0xbc73('0x82')](_0x5474fe,function(_0x10ac84){return _0x10ac84[_0xbc73('0x2a')]===_0xbc73('0x2b')||_0x10ac84[_0xbc73('0x2a')]===_0xbc73('0x32');});if(!_0x2c3532)return _0x5474fe;return db[_0xbc73('0x85')][_0xbc73('0x86')]({'where':{'name':{'$or':['Agents',_0xbc73('0x31')]},'userProfileId':_0x1b689e[_0xbc73('0x2f')][_0xbc73('0x7d')]},'raw':!![]})[_0xbc73('0x1e')](function(_0x4f8504){if(_[_0xbc73('0x87')](_0x4f8504)||!_[_0xbc73('0x82')](_0x4f8504,[_0xbc73('0x7e'),0x0]))return _0x5474fe;_0x52ea4e=[];var _0x313e78=_(_0x4f8504)[_0xbc73('0x33')](function(_0x234653){if(_0x234653[_0xbc73('0x7e')]===0x1)return;return _0x234653[_0xbc73('0x39')]===_0xbc73('0x30')?'agent':_0xbc73('0x32');})[_0xbc73('0x88')]()[_0xbc73('0x34')]();for(var _0x34b266=0x0;_0x34b266<_0x5474fe[_0xbc73('0x4e')];_0x34b266++){if(!_[_0xbc73('0x35')](_0x313e78,_0x5474fe[_0x34b266][_0xbc73('0x2a')]))return;var _0x31ec8d=_0x5474fe[_0x34b266][_0xbc73('0x2a')]===_0xbc73('0x2b')?_0xbc73('0x30'):'Telephones';_0x52ea4e[_0xbc73('0x4b')](db[_0xbc73('0x7f')]['create']({'name':_0x5474fe[_0x34b266]['name'],'resourceId':_0x5474fe[_0x34b266]['id'],'type':_0x31ec8d,'sectionId':_[_0xbc73('0x36')](_0x4f8504,[_0xbc73('0x39'),_0x31ec8d])['id']},{}));}return Promise[_0xbc73('0x54')](_0x52ea4e);});})[_0xbc73('0x1e')](respondWithResult(_0x163bfa,0xc9))[_0xbc73('0x28')](handleError(_0x163bfa,null));};exports[_0xbc73('0x89')]=function(_0x769ec2,_0x4c86ad){if(_0x769ec2[_0xbc73('0x5b')]['id']){delete _0x769ec2[_0xbc73('0x5b')]['id'];}return db['User'][_0xbc73('0x36')]({'where':{'id':_0x769ec2[_0xbc73('0x56')]['id']}})[_0xbc73('0x1e')](function(_0x4aba60){if(!_0x4aba60)return null;if(_0x4aba60['id']===_0x769ec2['user']['id']){if(!_0x769ec2[_0xbc73('0x5b')][_0xbc73('0x8a')]||!_0x769ec2['body'][_0xbc73('0x8b')]){throw new db[(_0xbc73('0x8c'))][(_0xbc73('0x8d'))](_0xbc73('0x8e'));}if(!_0x4aba60[_0xbc73('0x8f')](_0x769ec2[_0xbc73('0x5b')][_0xbc73('0x8a')])){throw new db[(_0xbc73('0x8c'))][(_0xbc73('0x8d'))](_0xbc73('0x90'));}if(_0x769ec2['body']['oldPassword']===_0x769ec2[_0xbc73('0x5b')][_0xbc73('0x8b')]){throw new db[(_0xbc73('0x8c'))]['ValidationError'](_0xbc73('0x91'));}}else if(_0x769ec2[_0xbc73('0x2f')][_0xbc73('0x2a')]==='admin'){if(!_0x769ec2['body'][_0xbc73('0x8b')]){throw new db['Sequelize'][(_0xbc73('0x8d'))](_0xbc73('0x92'));}}else if(_0x769ec2['user'][_0xbc73('0x2a')]===_0xbc73('0x2f')){if(!_0x769ec2[_0xbc73('0x5b')][_0xbc73('0x8b')]){throw new db['Sequelize'][(_0xbc73('0x8d'))](_0xbc73('0x92'));}if(_0x4aba60[_0xbc73('0x2a')]!=='agent'){throw new db['Sequelize'][(_0xbc73('0x8d'))](_0xbc73('0x78'));}}else{throw new db['Sequelize'][(_0xbc73('0x8d'))]('Unauthorized');}return _0x4aba60;})[_0xbc73('0x1e')](handleEntityNotFound(_0x4c86ad,null))[_0xbc73('0x1e')](function(_0x330ce5){return db['Setting'][_0xbc73('0x93')]({'attributes':['id','securePassword',_0xbc73('0x94'),'passwordHistoryLimit']})['then'](function(_0x5d034d){if(_0x5d034d[_0xbc73('0x62')])authService[_0xbc73('0x95')](_0x769ec2['body'][_0xbc73('0x8b')]);if(!_0x5d034d[_0xbc73('0x94')]||!_0x330ce5[_0xbc73('0x40')])return _0x330ce5;authService['validatePasswordHistory'](_0x769ec2[_0xbc73('0x5b')][_0xbc73('0x8b')],_0x330ce5['previousPasswords'],_0x5d034d['passwordHistoryLimit']);return _0x330ce5;})[_0xbc73('0x1e')](saveUpdates({'password':_0x769ec2['body'][_0xbc73('0x8b')],'passwordResetAt':_0x769ec2[_0xbc73('0x2f')]['id']==_0x769ec2[_0xbc73('0x56')]['id']?moment():null,'previousPasswords':authService[_0xbc73('0x96')](_0x769ec2['body']['newPassword'],_0x330ce5[_0xbc73('0x40')])},null));})[_0xbc73('0x1e')](respondWithResult(_0x4c86ad,null))['catch'](handleError(_0x4c86ad,null));};exports[_0xbc73('0x97')]=function(_0x1b9d9d,_0x190fc1){var _0x519ade=_0x1b9d9d[_0xbc73('0x5b')][_0xbc73('0x98')];return db['User'][_0xbc73('0x36')]({'where':{'id':_0x1b9d9d[_0xbc73('0x56')]['id']},'attributes':['id','name',_0xbc73('0x2a'),_0xbc73('0x99'),_0xbc73('0x9a'),_0xbc73('0x9b'),'interface']})[_0xbc73('0x1e')](handleEntityNotFound(_0x190fc1,null))[_0xbc73('0x1e')](function(_0x1c5f4d){if(_0x1c5f4d){if(!utils['isValidChannel'](_0x519ade)){throw new db[(_0xbc73('0x8c'))][(_0xbc73('0x8d'))]('Unknown\x20channel');}return _0x1c5f4d[_0xbc73('0x9c')+_['capitalize'](_0x519ade[_0xbc73('0x9d')]())+_0xbc73('0x9e')](_0x1b9d9d[_0xbc73('0x5b')]['ids'],{'penalty':_0x1b9d9d['body']['penalty']||0x0})[_0xbc73('0x9f')](function(_0x2d62c7){for(var _0x26b385=0x0;_0x26b385<_0x1b9d9d[_0xbc73('0x5b')][_0xbc73('0x5e')][_0xbc73('0x4e')];_0x26b385+=0x1){var _0x30ffdb={'UserId':Number(_0x1b9d9d['params']['id'])};_0x30ffdb[_['capitalize'](_0x519ade[_0xbc73('0x9d')]())+'QueueId']=Number(_0x1b9d9d[_0xbc73('0x5b')][_0xbc73('0x5e')][_0x26b385]);socket[_0xbc73('0x2c')](_0xbc73('0x2f')+_[_0xbc73('0xa0')](_0x519ade[_0xbc73('0x9d')]())+_0xbc73('0xa1'),_0x30ffdb);}return _0x2d62c7;})['then'](function(){if(_0x519ade===_0xbc73('0xa2')){return db['VoiceQueue'][_0xbc73('0x86')]({'where':{'id':_0x1b9d9d['body']['ids']||[]},'raw':!![],'attributes':['id',_0xbc73('0x39')]});}})[_0xbc73('0x1e')](function(_0x479c44){var _0x75d064=_0x1c5f4d[_0xbc73('0xa3')]({'plain':!![]});var _0x22f989=[];if(_0x519ade===_0xbc73('0xa2')&&_0x75d064[_0xbc73('0x2a')]==='agent'&&_0x75d064['online']){for(let _0x4a4081=0x0;_0x4a4081<_0x479c44[_0xbc73('0x4e')];_0x4a4081+=0x1){_0x22f989[_0xbc73('0x4b')]({'membername':_0x75d064['name'],'UserId':_0x75d064['id'],'queue_name':_0x479c44[_0x4a4081]['name'],'VoiceQueueId':_0x479c44[_0x4a4081]['id'],'interface':_[_0xbc73('0x65')](_0x75d064[_0xbc73('0xa4')])?util[_0xbc73('0xa5')]('SIP/%s',_0x75d064[_0xbc73('0x39')]):_0x75d064[_0xbc73('0xa4')],'paused':_0x75d064[_0xbc73('0x9b')]||![],'penalty':_0x1b9d9d['body']['penalty']||0x0});}return Promise['all'](_0x22f989[_0xbc73('0x33')](function(_0x42057a){return db['UserVoiceQueueRt'][_0xbc73('0xa6')](_0x42057a);}));}return _0x1c5f4d;});}})[_0xbc73('0x1e')](respondWithStatusCode(_0x190fc1,null))[_0xbc73('0x28')](handleError(_0x190fc1,null));};exports[_0xbc73('0xa7')]=function(_0x1544de,_0x5938d0){var _0x510ec7,_0x1a1474;return db[_0xbc73('0x3a')][_0xbc73('0x36')]({'where':{'id':_0x1544de['params']['id']},'attributes':['id',_0xbc73('0x39'),_0xbc73('0x2a')]})[_0xbc73('0x1e')](handleEntityNotFound(_0x5938d0,null))[_0xbc73('0x1e')](function(_0x17e7e5){if(_0x17e7e5){_0x510ec7=_0x17e7e5;if(!_0x1544de[_0xbc73('0x45')][_0xbc73('0x98')]||!utils[_0xbc73('0xa8')](_0x1544de[_0xbc73('0x45')][_0xbc73('0x98')])){throw new db[(_0xbc73('0x8c'))][(_0xbc73('0x8d'))]('Unknown\x20channel');}return _0x17e7e5[_0xbc73('0xa9')+_[_0xbc73('0xa0')](_0x1544de['query'][_0xbc73('0x98')][_0xbc73('0x9d')]())+_0xbc73('0x9e')](_0x1544de[_0xbc73('0x45')][_0xbc73('0x5e')]);}})[_0xbc73('0x1e')](function(_0x16d0e2){if(_[_0xbc73('0xaa')](_0x1544de[_0xbc73('0x45')][_0xbc73('0x5e')])){for(var _0x312527=0x0;_0x312527<_0x1544de['query'][_0xbc73('0x5e')][_0xbc73('0x4e')];_0x312527+=0x1){_0x1a1474={'UserId':Number(_0x1544de[_0xbc73('0x56')]['id'])};_0x1a1474[_[_0xbc73('0xa0')](_0x1544de[_0xbc73('0x45')][_0xbc73('0x98')][_0xbc73('0x9d')]())+_0xbc73('0xab')]=Number(_0x1544de[_0xbc73('0x45')][_0xbc73('0x5e')][_0x312527]);socket[_0xbc73('0x2c')](_0xbc73('0x2f')+_[_0xbc73('0xa0')](_0x1544de[_0xbc73('0x45')][_0xbc73('0x98')]['toLowerCase']())+_0xbc73('0xac'),_0x1a1474);}}else{_0x1a1474={'UserId':Number(_0x1544de[_0xbc73('0x56')]['id'])};_0x1a1474[_[_0xbc73('0xa0')](_0x1544de[_0xbc73('0x45')][_0xbc73('0x98')]['toLowerCase']())+_0xbc73('0xab')]=Number(_0x1544de[_0xbc73('0x45')][_0xbc73('0x5e')]);socket[_0xbc73('0x2c')]('user'+_['capitalize'](_0x1544de['query'][_0xbc73('0x98')]['toLowerCase']())+_0xbc73('0xac'),_0x1a1474);}return _0x16d0e2;})[_0xbc73('0x1e')](function(){if(_0x1544de['query'][_0xbc73('0x98')]===_0xbc73('0xa2')){return db[_0xbc73('0xad')]['destroy']({'where':{'UserId':_0x1544de[_0xbc73('0x56')]['id'],'VoiceQueueId':_0x1544de['query'][_0xbc73('0x5e')]},'individualHooks':!![]})['then'](function(){return _0x510ec7;});}return _0x510ec7;})['then'](respondWithStatusCode(_0x5938d0,null))[_0xbc73('0x28')](handleError(_0x5938d0,null));};exports[_0xbc73('0xae')]=function(_0x3adf7b,_0x1157a4){_0x3adf7b[_0xbc73('0x5b')][_0xbc73('0xaf')]=_0x3adf7b[_0xbc73('0xb0')][_0xbc73('0xb1')];return db[_0xbc73('0x3a')][_0xbc73('0x36')]({'where':{'id':_0x3adf7b[_0xbc73('0x56')]['id']}})['then'](handleEntityNotFound(_0x1157a4,null))[_0xbc73('0x1e')](saveUpdates(_0x3adf7b[_0xbc73('0x5b')],null))[_0xbc73('0x1e')](respondWithResult(_0x1157a4,null))[_0xbc73('0x28')](handleError(_0x1157a4,null));};exports[_0xbc73('0xb2')]=function(_0x206ac8,_0x5e57e3){var _0x32e12a=path[_0xbc73('0xb3')](config[_0xbc73('0xb4')],_0xbc73('0xb5'));return db[_0xbc73('0x3a')]['find']({'where':{'id':_0x206ac8[_0xbc73('0x56')]['id']},'attributes':['id',_0xbc73('0xaf')],'raw':!![]})[_0xbc73('0x1e')](handleEntityNotFound(_0x5e57e3,null))[_0xbc73('0x1e')](function(_0x3dada7){if(_0x3dada7){if(_[_0xbc73('0x65')](_0x3dada7['userpic'])){return _0x5e57e3[_0xbc73('0xb6')](_0x32e12a);}else{if(!fs[_0xbc73('0xb7')](path[_0xbc73('0xb3')](config['root'],'server/files/images/',_0x3dada7[_0xbc73('0xaf')]))){return _0x5e57e3[_0xbc73('0xb6')](_0x32e12a);}return _0x5e57e3[_0xbc73('0xb6')](path[_0xbc73('0xb3')](config['root'],'server/files/images/',_0x3dada7[_0xbc73('0xaf')]));}}})[_0xbc73('0x28')](handleError(_0x5e57e3,null));};exports['getOpenTabs']=function(_0x447379,_0x50d362){return db[_0xbc73('0x3a')][_0xbc73('0x36')]({'where':{'id':_0x447379[_0xbc73('0x56')]['id']},'attributes':['id']})[_0xbc73('0x1e')](handleEntityNotFound(_0x50d362,null))[_0xbc73('0x1e')](function(_0x368d2a){var _0x208cfa=[];values=_0x368d2a[_0xbc73('0x50')];_0x208cfa[_0xbc73('0x4b')](get_open_tabs(_0xbc73('0x4f'),_0x368d2a['dataValues']));_0x208cfa[_0xbc73('0x4b')](get_open_tabs(_0xbc73('0x51'),_0x368d2a[_0xbc73('0x50')]));_0x208cfa[_0xbc73('0x4b')](get_open_tabs(_0xbc73('0x52'),_0x368d2a['dataValues']));_0x208cfa['push'](get_open_tabs(_0xbc73('0x53'),_0x368d2a[_0xbc73('0x50')]));_0x208cfa[_0xbc73('0x4b')](get_open_tabs('fax',_0x368d2a[_0xbc73('0x50')]));_0x208cfa['push'](get_open_tabs(_0xbc73('0x5a'),_0x368d2a[_0xbc73('0x50')]));return Promise['all'](_0x208cfa);})[_0xbc73('0x1e')](function(_0x5cb9ed){if(_0x5cb9ed){var _0x3e310f=_[_0xbc73('0x33')](values[_0xbc73('0xb8')],function(_0x1cadec){return{'channel':'CHAT','id':_0x1cadec['id'],'createdAt':_0x1cadec['createdAt']};});var _0x55ea75=_[_0xbc73('0x33')](values['FaxOpenTabs'],function(_0x3b5ede){return{'channel':_0xbc73('0xb9'),'id':_0x3b5ede['id'],'createdAt':_0x3b5ede[_0xbc73('0xba')]};});var _0x31f04d=_[_0xbc73('0x33')](values[_0xbc73('0xbb')],function(_0x1c147e){return{'channel':_0xbc73('0xbc'),'id':_0x1c147e['id'],'createdAt':_0x1c147e[_0xbc73('0xba')]};});var _0x3f73b1=_[_0xbc73('0x33')](values['MailOpenTabs'],function(_0x385ef3){return{'channel':_0xbc73('0xbd'),'id':_0x385ef3['id'],'createdAt':_0x385ef3[_0xbc73('0xba')]};});var _0x355b68=_[_0xbc73('0x33')](values[_0xbc73('0xbe')],function(_0x52ccad){return{'channel':_0xbc73('0xbf'),'id':_0x52ccad['id'],'createdAt':_0x52ccad[_0xbc73('0xba')]};});var _0x15d154=_['map'](values[_0xbc73('0xc0')],function(_0x1f6c96){return{'channel':_0xbc73('0xc1'),'id':_0x1f6c96['id'],'createdAt':_0x1f6c96['createdAt']};});var _0x31bd3a=_[_0xbc73('0xc2')](_0x3e310f,_0x55ea75,_0x31f04d,_0x3f73b1,_0x355b68,_0x15d154);var _0x458e34={'count':_0x31bd3a[_0xbc73('0x4e')],'rows':_0x31bd3a};return _0x458e34;}else return null;})[_0xbc73('0x1e')](respondWithResult(_0x50d362,null))[_0xbc73('0x28')](handleError(_0x50d362,null));};exports[_0xbc73('0xc3')]=function(_0xdc9d82,_0x473aa1){var _0x2821c0={};return db[_0xbc73('0x3a')]['findOne']({'where':{'id':_0xdc9d82[_0xbc73('0x56')]['id']}})[_0xbc73('0x1e')](function(_0x212629){if(!_0x212629){throw new APINotFoundError(util['format'](_0xbc73('0xc4'),_0xdc9d82[_0xbc73('0x56')]['id']));}return contacts[_0xbc73('0x5c')]();})[_0xbc73('0x1e')](function(_0x629636){_0xdc9d82[_0xbc73('0x45')]['User']=_0xdc9d82['params']['id'];_0x2821c0=qs[_0xbc73('0x57')](_0x629636,_0xdc9d82);if(_0xdc9d82[_0xbc73('0x45')][_0xbc73('0xc5')](_0xbc73('0x46'))){_0x2821c0[_0xbc73('0x47')]=[{'model':db[_0xbc73('0xc6')],'as':_0xbc73('0xc7'),'required':![]},{'model':db[_0xbc73('0xc8')],'as':_0xbc73('0xc9'),'attributes':['id',_0xbc73('0x39'),_0xbc73('0xca')],'where':_0xdc9d82['query']['tag']?{'id':_0xdc9d82['query'][_0xbc73('0xcb')]}:undefined,'required':_0xdc9d82[_0xbc73('0x45')][_0xbc73('0xcb')]?!![]:![]}];}return contacts[_0xbc73('0x86')](_0xdc9d82['query'],_0xdc9d82[_0xbc73('0x2f')],_0x2821c0,_0x629636);})[_0xbc73('0x1e')](respondWithFilteredResult(_0x473aa1,_0x2821c0))[_0xbc73('0x28')](APIHandleError(_0x473aa1));};exports[_0xbc73('0xcc')]=function(_0x290b5c,_0x38fe63){var _0x233750;var _0x2b4f64={};var _0x2f94bc;return db['User']['findOne']({'where':{'id':_0x290b5c['params']['id']},'attributes':['id',_0xbc73('0x39'),_0xbc73('0x2a')]})[_0xbc73('0x1e')](handleEntityNotFound(_0x38fe63,null))[_0xbc73('0x1e')](function(_0x197f9b){if(!utils[_0xbc73('0xa8')](_0x290b5c[_0xbc73('0x45')][_0xbc73('0x98')])){throw new db[(_0xbc73('0x8c'))][(_0xbc73('0x8d'))](_0xbc73('0xcd'));}_0x233750=_0x197f9b;var _0x1df0a9={};_0x1df0a9[_0xbc73('0xce')]=_['keys'](db[_[_0xbc73('0xa0')](_0x290b5c['query'][_0xbc73('0x98')])+'Queue']['rawAttributes']);_0x1df0a9[_0xbc73('0x45')]=_[_0xbc73('0xcf')](_0x290b5c[_0xbc73('0x45')]);_0x1df0a9[_0xbc73('0xd0')]=_['intersection'](_0x1df0a9[_0xbc73('0xce')],_0x1df0a9[_0xbc73('0x45')]);_0x2b4f64[_0xbc73('0x4a')]=_[_0xbc73('0xd1')](_0x1df0a9[_0xbc73('0xce')],qs[_0xbc73('0xd2')](_0x290b5c[_0xbc73('0x45')]['fields']));_0x2b4f64[_0xbc73('0x4a')]=_0x2b4f64[_0xbc73('0x4a')][_0xbc73('0x4e')]?_0x2b4f64[_0xbc73('0x4a')]:_0x1df0a9['model'];_0x2b4f64[_0xbc73('0xd3')]=qs[_0xbc73('0xd4')](_0x290b5c[_0xbc73('0x45')][_0xbc73('0xd4')]);_0x2b4f64[_0xbc73('0x44')]=qs[_0xbc73('0xd0')](_[_0xbc73('0xd5')](_0x290b5c['query'],_0x1df0a9[_0xbc73('0xd0')]));if(_0x290b5c[_0xbc73('0x45')]['filter']){_0x2b4f64[_0xbc73('0x44')]=_[_0xbc73('0x58')](_0x2b4f64['where'],{'$or':_['map'](_0x2b4f64[_0xbc73('0x4a')],function(_0x25d1e4){var _0x52f38f={};_0x52f38f[_0x25d1e4]={'$like':'%'+_0x290b5c['query']['filter']+'%'};return _0x52f38f;})});}_0x2b4f64=_[_0xbc73('0x58')]({},_0x2b4f64,_0x290b5c[_0xbc73('0xd6')]);switch(_0x233750[_0xbc73('0x2a')]){case _0xbc73('0x2d'):return db[_[_0xbc73('0xa0')](_0x290b5c[_0xbc73('0x45')][_0xbc73('0x98')])+'Queue'][_0xbc73('0x86')](_0x2b4f64);case'user':case'agent':return _0x233750['get'+_[_0xbc73('0xa0')](_0x290b5c[_0xbc73('0x45')][_0xbc73('0x98')])+_0xbc73('0x9e')](_0x2b4f64);default:throw new db[(_0xbc73('0x8c'))][(_0xbc73('0x8d'))]('Unknown\x20role');}})['then'](function(_0x17feae){_0x2f94bc=_0x17feae[_0xbc73('0x4e')];if(!_0x290b5c[_0xbc73('0x45')][_0xbc73('0xc5')](_0xbc73('0xd7'))){_0x2b4f64[_0xbc73('0x1a')]=qs[_0xbc73('0x1a')](_0x290b5c[_0xbc73('0x45')]['limit']);_0x2b4f64['offset']=qs[_0xbc73('0x19')](_0x290b5c['query']['offset']);}switch(_0x233750[_0xbc73('0x2a')]){case _0xbc73('0x2d'):return db[_[_0xbc73('0xa0')](_0x290b5c['query'][_0xbc73('0x98')])+_0xbc73('0xd8')]['findAll'](_0x2b4f64);case'user':case _0xbc73('0x2b'):return _0x233750[_0xbc73('0xa3')+_['capitalize'](_0x290b5c[_0xbc73('0x45')][_0xbc73('0x98')])+_0xbc73('0x9e')](_0x2b4f64);}})[_0xbc73('0x1e')](function(_0x44b60a){return{'count':_0x2f94bc,'rows':_0x44b60a};})[_0xbc73('0x1e')](respondWithResult(_0x38fe63,null))['catch'](handleError(_0x38fe63,null));};exports['getVoiceQueuesRt']=function(_0xf8f116,_0x28cd13){var _0x207c64={};var _0x264fac={};var _0x4c29b0;var _0x468c18;return db[_0xbc73('0x3a')]['findOne']({'where':{'id':_0xf8f116['params']['id']}})[_0xbc73('0x1e')](handleEntityNotFound(_0x28cd13,null))['then'](function(_0x4853da){if(_0x4853da){_0x4c29b0=_0x4853da;_0x264fac[_0xbc73('0xce')]=_[_0xbc73('0xcf')](db[_0xbc73('0xad')][_0xbc73('0x3b')]);_0x264fac[_0xbc73('0x45')]=_[_0xbc73('0xcf')](_0xf8f116[_0xbc73('0x45')]);_0x264fac[_0xbc73('0xd0')]=_[_0xbc73('0xd1')](_0x264fac[_0xbc73('0xce')],_0x264fac[_0xbc73('0x45')]);_0x207c64[_0xbc73('0x4a')]=_[_0xbc73('0xd1')](_0x264fac['model'],qs[_0xbc73('0xd2')](_0xf8f116[_0xbc73('0x45')][_0xbc73('0xd2')]));_0x207c64[_0xbc73('0x4a')]=_0x207c64['attributes'][_0xbc73('0x4e')]?_0x207c64[_0xbc73('0x4a')]:_0x264fac['model'];_0x207c64[_0xbc73('0xd3')]=qs[_0xbc73('0xd4')](_0xf8f116[_0xbc73('0x45')][_0xbc73('0xd4')]);_0x207c64[_0xbc73('0x44')]=qs[_0xbc73('0xd0')](_[_0xbc73('0xd5')](_0xf8f116[_0xbc73('0x45')],_0x264fac[_0xbc73('0xd0')]));if(_0xf8f116['query']['filter']){_0x207c64['where']=_[_0xbc73('0x58')](_0x207c64['where'],{'$or':_['map'](_0x207c64[_0xbc73('0x4a')],function(_0x3b1f76){var _0x2ab024={};_0x2ab024[_0x3b1f76]={'$like':'%'+_0xf8f116['query'][_0xbc73('0x3f')]+'%'};return _0x2ab024;})});}_0x207c64=_['merge']({},_0x207c64,_0xf8f116[_0xbc73('0xd6')]);return _0x4c29b0[_0xbc73('0xd9')](_0x207c64);}})[_0xbc73('0x1e')](function(_0x2bbcf1){if(_0x2bbcf1){_0x468c18=_0x2bbcf1['length'];if(!_0xf8f116['query']['hasOwnProperty'](_0xbc73('0xd7'))){_0x207c64['limit']=qs[_0xbc73('0x1a')](_0xf8f116['query'][_0xbc73('0x1a')]);_0x207c64['offset']=qs[_0xbc73('0x19')](_0xf8f116[_0xbc73('0x45')][_0xbc73('0x19')]);}return _0x4c29b0[_0xbc73('0xd9')](_0x207c64);}})['then'](function(_0x26c715){if(_0x26c715){return _0x26c715?{'count':_0x468c18,'rows':_0x26c715}:null;}})['then'](respondWithResult(_0x28cd13,null))[_0xbc73('0x28')](handleError(_0x28cd13,null));};exports['getGroups']=function(_0x372047,_0x34b9d8){var _0x54d7a4={};var _0x3be6f9={};var _0x195bf4;var _0x8dec3d;return db[_0xbc73('0x3a')][_0xbc73('0x93')]({'where':{'id':_0x372047['params']['id']}})[_0xbc73('0x1e')](handleEntityNotFound(_0x34b9d8,null))['then'](function(_0x232517){if(_0x232517){_0x195bf4=_0x232517;_0x3be6f9[_0xbc73('0xce')]=_[_0xbc73('0xcf')](db[_0xbc73('0xda')][_0xbc73('0x3b')]);_0x3be6f9['query']=_[_0xbc73('0xcf')](_0x372047[_0xbc73('0x45')]);_0x3be6f9[_0xbc73('0xd0')]=_[_0xbc73('0xd1')](_0x3be6f9[_0xbc73('0xce')],_0x3be6f9[_0xbc73('0x45')]);_0x54d7a4[_0xbc73('0x4a')]=_[_0xbc73('0xd1')](_0x3be6f9['model'],qs[_0xbc73('0xd2')](_0x372047[_0xbc73('0x45')][_0xbc73('0xd2')]));_0x54d7a4['attributes']=_0x54d7a4[_0xbc73('0x4a')]['length']?_0x54d7a4['attributes']:_0x3be6f9[_0xbc73('0xce')];_0x54d7a4[_0xbc73('0xd3')]=qs['sort'](_0x372047[_0xbc73('0x45')]['sort']);_0x54d7a4[_0xbc73('0x44')]=qs[_0xbc73('0xd0')](_[_0xbc73('0xd5')](_0x372047[_0xbc73('0x45')],_0x3be6f9[_0xbc73('0xd0')]));if(_0x372047['query'][_0xbc73('0x3f')]){_0x54d7a4[_0xbc73('0x44')]=_[_0xbc73('0x58')](_0x54d7a4[_0xbc73('0x44')],{'$or':_[_0xbc73('0x33')](_0x54d7a4[_0xbc73('0x4a')],function(_0x1906cf){var _0x418f99={};_0x418f99[_0x1906cf]={'$like':'%'+_0x372047[_0xbc73('0x45')]['filter']+'%'};return _0x418f99;})});}_0x54d7a4=_[_0xbc73('0x58')]({},_0x54d7a4,_0x372047[_0xbc73('0xd6')]);return _0x195bf4[_0xbc73('0xdb')](_0x54d7a4);}})[_0xbc73('0x1e')](function(_0x5b2493){if(_0x5b2493){_0x8dec3d=_0x5b2493[_0xbc73('0x4e')];if(!_0x372047[_0xbc73('0x45')]['hasOwnProperty'](_0xbc73('0xd7'))){_0x54d7a4[_0xbc73('0x1a')]=qs[_0xbc73('0x1a')](_0x372047[_0xbc73('0x45')][_0xbc73('0x1a')]);_0x54d7a4['offset']=qs[_0xbc73('0x19')](_0x372047[_0xbc73('0x45')][_0xbc73('0x19')]);}return _0x195bf4[_0xbc73('0xdb')](_0x54d7a4);}})[_0xbc73('0x1e')](function(_0x3345ae){if(_0x3345ae){return _0x3345ae?{'count':_0x8dec3d,'rows':_0x3345ae}:null;}})[_0xbc73('0x1e')](respondWithResult(_0x34b9d8,null))[_0xbc73('0x28')](handleError(_0x34b9d8,null));};exports[_0xbc73('0xdc')]=function(_0x32f4b0,_0x9dfbe1){var _0x1b6e7e={'raw':!![],'where':{}};var _0x5a39de={};var _0x2c4680={'count':0x0,'rows':[]};return db[_0xbc73('0x3a')]['findOne']({'where':{'id':_0x32f4b0[_0xbc73('0x56')]['id']}})['then'](handleEntityNotFound(_0x9dfbe1,null))['then'](function(_0x125574){if(_0x125574){_0x5a39de[_0xbc73('0xce')]=_[_0xbc73('0xcf')](db[_0xbc73('0xdd')][_0xbc73('0x3b')]);_0x5a39de[_0xbc73('0x45')]=_['keys'](_0x32f4b0[_0xbc73('0x45')]);_0x5a39de[_0xbc73('0xd0')]=_[_0xbc73('0xd1')](_0x5a39de['model'],_0x5a39de[_0xbc73('0x45')]);_0x1b6e7e[_0xbc73('0x4a')]=_[_0xbc73('0xd1')](_0x5a39de[_0xbc73('0xce')],qs[_0xbc73('0xd2')](_0x32f4b0[_0xbc73('0x45')]['fields']));_0x1b6e7e['attributes']=_0x1b6e7e[_0xbc73('0x4a')][_0xbc73('0x4e')]?_0x1b6e7e[_0xbc73('0x4a')]:_0x5a39de[_0xbc73('0xce')];if(!_0x32f4b0[_0xbc73('0x45')][_0xbc73('0xc5')](_0xbc73('0xd7'))){_0x1b6e7e[_0xbc73('0x1a')]=qs[_0xbc73('0x1a')](_0x32f4b0['query'][_0xbc73('0x1a')]);_0x1b6e7e[_0xbc73('0x19')]=qs[_0xbc73('0x19')](_0x32f4b0['query'][_0xbc73('0x19')]);}_0x1b6e7e[_0xbc73('0xd3')]=qs[_0xbc73('0xd4')](_0x32f4b0[_0xbc73('0x45')]['sort']);_0x1b6e7e[_0xbc73('0x44')]=qs[_0xbc73('0xd0')](_['pick'](_0x32f4b0[_0xbc73('0x45')],_0x5a39de[_0xbc73('0xd0')]));_0x1b6e7e['where'][_0xbc73('0xde')]=_0x125574['id'];if(_0x32f4b0[_0xbc73('0x45')][_0xbc73('0x3f')]){_0x1b6e7e[_0xbc73('0x44')]=_[_0xbc73('0x58')](_0x1b6e7e[_0xbc73('0x44')],{'$or':_[_0xbc73('0x33')](_0x1b6e7e[_0xbc73('0x4a')],function(_0xa9bedf){var _0xd9bc16={};_0xd9bc16[_0xa9bedf]={'$like':'%'+_0x32f4b0[_0xbc73('0x45')][_0xbc73('0x3f')]+'%'};return _0xd9bc16;})});}_0x1b6e7e=_[_0xbc73('0x58')]({},_0x1b6e7e,_0x32f4b0[_0xbc73('0xd6')]);return db[_0xbc73('0xdd')][_0xbc73('0x1c')]({'where':_0x1b6e7e[_0xbc73('0x44')]})[_0xbc73('0x1e')](function(_0x3c334a){_0x2c4680['count']=_0x3c334a;if(_0x32f4b0[_0xbc73('0x45')]['includeAll']){_0x1b6e7e['include']=[{'all':!![]}];}return db[_0xbc73('0xdd')]['findAll'](_0x1b6e7e);})[_0xbc73('0x1e')](function(_0x25d620){_0x2c4680[_0xbc73('0x4c')]=_0x25d620;return _0x2c4680;});}})['then'](respondWithFilteredResult(_0x9dfbe1,_0x1b6e7e))[_0xbc73('0x28')](handleError(_0x9dfbe1,null));};exports['getScreenRecordings']=function(_0xcab2d2,_0x4a0093){var _0x4dd931={'raw':!![],'where':{}};var _0x2e9bff={};var _0x24a73b={'count':0x0,'rows':[]};return db[_0xbc73('0x3a')][_0xbc73('0x93')]({'where':{'id':_0xcab2d2[_0xbc73('0x56')]['id']}})[_0xbc73('0x1e')](handleEntityNotFound(_0x4a0093,null))[_0xbc73('0x1e')](function(_0x3218b2){if(_0x3218b2){_0x2e9bff[_0xbc73('0xce')]=_[_0xbc73('0xcf')](db[_0xbc73('0xdf')][_0xbc73('0x3b')]);_0x2e9bff[_0xbc73('0x45')]=_[_0xbc73('0xcf')](_0xcab2d2['query']);_0x2e9bff[_0xbc73('0xd0')]=_[_0xbc73('0xd1')](_0x2e9bff['model'],_0x2e9bff[_0xbc73('0x45')]);_0x4dd931[_0xbc73('0x4a')]=_[_0xbc73('0xd1')](_0x2e9bff['model'],qs[_0xbc73('0xd2')](_0xcab2d2[_0xbc73('0x45')][_0xbc73('0xd2')]));_0x4dd931['attributes']=_0x4dd931[_0xbc73('0x4a')][_0xbc73('0x4e')]?_0x4dd931[_0xbc73('0x4a')]:_0x2e9bff[_0xbc73('0xce')];if(!_0xcab2d2[_0xbc73('0x45')]['hasOwnProperty'](_0xbc73('0xd7'))){_0x4dd931['limit']=qs[_0xbc73('0x1a')](_0xcab2d2[_0xbc73('0x45')]['limit']);_0x4dd931[_0xbc73('0x19')]=qs[_0xbc73('0x19')](_0xcab2d2['query'][_0xbc73('0x19')]);}_0x4dd931[_0xbc73('0xd3')]=qs[_0xbc73('0xd4')](_0xcab2d2[_0xbc73('0x45')][_0xbc73('0xd4')]);_0x4dd931[_0xbc73('0x44')]=qs['filters'](_[_0xbc73('0xd5')](_0xcab2d2[_0xbc73('0x45')],_0x2e9bff[_0xbc73('0xd0')]));_0x4dd931[_0xbc73('0x44')][_0xbc73('0xde')]=_0x3218b2['id'];if(_0xcab2d2['query'][_0xbc73('0x3f')]){_0x4dd931[_0xbc73('0x44')]=_['merge'](_0x4dd931[_0xbc73('0x44')],{'$or':_[_0xbc73('0x33')](_0x4dd931[_0xbc73('0x4a')],function(_0x359323){var _0x55b354={};_0x55b354[_0x359323]={'$like':'%'+_0xcab2d2[_0xbc73('0x45')][_0xbc73('0x3f')]+'%'};return _0x55b354;})});}_0x4dd931=_['merge']({},_0x4dd931,_0xcab2d2[_0xbc73('0xd6')]);return db[_0xbc73('0xdf')][_0xbc73('0x1c')]({'where':_0x4dd931[_0xbc73('0x44')]})[_0xbc73('0x1e')](function(_0x45d224){_0x24a73b[_0xbc73('0x1c')]=_0x45d224;if(_0xcab2d2[_0xbc73('0x45')][_0xbc73('0x46')]){_0x4dd931[_0xbc73('0x47')]=[{'all':!![]}];}return db[_0xbc73('0xdf')]['findAll'](_0x4dd931);})['then'](function(_0x5dd977){_0x24a73b[_0xbc73('0x4c')]=_0x5dd977;return _0x24a73b;});}})[_0xbc73('0x1e')](respondWithFilteredResult(_0x4a0093,_0x4dd931))['catch'](handleError(_0x4a0093,null));};exports['getChatInteractions']=function(_0x3908e8,_0x1b7641){var _0x47638a={};var _0x4799a7={};var _0x557b1;var _0x41d308;return db[_0xbc73('0x3a')][_0xbc73('0x93')]({'where':{'id':_0x3908e8[_0xbc73('0x56')]['id']}})[_0xbc73('0x1e')](handleEntityNotFound(_0x1b7641,null))[_0xbc73('0x1e')](function(_0x1ec19d){if(_0x1ec19d){_0x557b1=_0x1ec19d;_0x4799a7[_0xbc73('0xce')]=_[_0xbc73('0xcf')](db['ChatInteraction'][_0xbc73('0x3b')]);_0x4799a7[_0xbc73('0x45')]=_[_0xbc73('0xcf')](_0x3908e8[_0xbc73('0x45')]);_0x4799a7[_0xbc73('0xd0')]=_[_0xbc73('0xd1')](_0x4799a7[_0xbc73('0xce')],_0x4799a7[_0xbc73('0x45')]);_0x47638a[_0xbc73('0x4a')]=_[_0xbc73('0xd1')](_0x4799a7[_0xbc73('0xce')],qs[_0xbc73('0xd2')](_0x3908e8[_0xbc73('0x45')]['fields']));_0x47638a[_0xbc73('0x4a')]=_0x47638a['attributes']['length']?_0x47638a['attributes']:_0x4799a7[_0xbc73('0xce')];_0x47638a['order']=qs[_0xbc73('0xd4')](_0x3908e8[_0xbc73('0x45')][_0xbc73('0xd4')]);_0x47638a[_0xbc73('0x44')]=qs['filters'](_[_0xbc73('0xd5')](_0x3908e8[_0xbc73('0x45')],_0x4799a7[_0xbc73('0xd0')]));if(_0x3908e8[_0xbc73('0x45')]['filter']){_0x47638a[_0xbc73('0x44')]=_[_0xbc73('0x58')](_0x47638a[_0xbc73('0x44')],{'$or':_[_0xbc73('0x33')](_0x47638a['attributes'],function(_0x5dbe4c){var _0x3d8502={};_0x3d8502[_0x5dbe4c]={'$like':'%'+_0x3908e8[_0xbc73('0x45')][_0xbc73('0x3f')]+'%'};return _0x3d8502;})});}_0x47638a=_[_0xbc73('0x58')]({},_0x47638a,_0x3908e8[_0xbc73('0xd6')]);return _0x557b1[_0xbc73('0xe0')](_0x47638a);}})[_0xbc73('0x1e')](function(_0xbfb5b8){if(_0xbfb5b8){_0x41d308=_0xbfb5b8[_0xbc73('0x4e')];if(!_0x3908e8[_0xbc73('0x45')][_0xbc73('0xc5')](_0xbc73('0xd7'))){_0x47638a['limit']=qs[_0xbc73('0x1a')](_0x3908e8[_0xbc73('0x45')][_0xbc73('0x1a')]);_0x47638a[_0xbc73('0x19')]=qs[_0xbc73('0x19')](_0x3908e8[_0xbc73('0x45')][_0xbc73('0x19')]);}return _0x557b1[_0xbc73('0xe0')](_0x47638a);}})[_0xbc73('0x1e')](function(_0x4d2edb){if(_0x4d2edb){return _0x4d2edb?{'count':_0x41d308,'rows':_0x4d2edb}:null;}})['then'](respondWithResult(_0x1b7641,null))[_0xbc73('0x28')](handleError(_0x1b7641,null));};exports[_0xbc73('0xe1')]=function(_0x5a47da,_0x530f0b){var _0x55acde={};var _0x37abf4={};var _0x45e14b;var _0x12409f;return db[_0xbc73('0x3a')][_0xbc73('0x93')]({'where':{'id':_0x5a47da[_0xbc73('0x56')]['id']}})[_0xbc73('0x1e')](handleEntityNotFound(_0x530f0b,null))['then'](function(_0x2f5055){if(_0x2f5055){_0x45e14b=_0x2f5055;_0x37abf4[_0xbc73('0xce')]=_[_0xbc73('0xcf')](db[_0xbc73('0xe2')][_0xbc73('0x3b')]);_0x37abf4[_0xbc73('0x45')]=_[_0xbc73('0xcf')](_0x5a47da[_0xbc73('0x45')]);_0x37abf4[_0xbc73('0xd0')]=_[_0xbc73('0xd1')](_0x37abf4[_0xbc73('0xce')],_0x37abf4[_0xbc73('0x45')]);_0x55acde[_0xbc73('0x4a')]=_[_0xbc73('0xd1')](_0x37abf4[_0xbc73('0xce')],qs['fields'](_0x5a47da[_0xbc73('0x45')][_0xbc73('0xd2')]));_0x55acde[_0xbc73('0x4a')]=_0x55acde['attributes'][_0xbc73('0x4e')]?_0x55acde[_0xbc73('0x4a')]:_0x37abf4[_0xbc73('0xce')];_0x55acde[_0xbc73('0xd3')]=qs[_0xbc73('0xd4')](_0x5a47da['query'][_0xbc73('0xd4')]);_0x55acde['where']=qs[_0xbc73('0xd0')](_[_0xbc73('0xd5')](_0x5a47da[_0xbc73('0x45')],_0x37abf4[_0xbc73('0xd0')]));if(_0x5a47da[_0xbc73('0x45')]['filter']){_0x55acde['where']=_[_0xbc73('0x58')](_0x55acde['where'],{'$or':_[_0xbc73('0x33')](_0x55acde['attributes'],function(_0x524975){var _0x580810={};_0x580810[_0x524975]={'$like':'%'+_0x5a47da[_0xbc73('0x45')][_0xbc73('0x3f')]+'%'};return _0x580810;})});}_0x55acde=_['merge']({},_0x55acde,_0x5a47da[_0xbc73('0xd6')]);return _0x45e14b[_0xbc73('0xe1')](_0x55acde);}})[_0xbc73('0x1e')](function(_0x5a3864){if(_0x5a3864){_0x12409f=_0x5a3864['length'];if(!_0x5a47da['query'][_0xbc73('0xc5')](_0xbc73('0xd7'))){_0x55acde[_0xbc73('0x1a')]=qs[_0xbc73('0x1a')](_0x5a47da['query'][_0xbc73('0x1a')]);_0x55acde['offset']=qs[_0xbc73('0x19')](_0x5a47da['query']['offset']);}return _0x45e14b[_0xbc73('0xe1')](_0x55acde);}})[_0xbc73('0x1e')](function(_0x39534d){if(_0x39534d){return _0x39534d?{'count':_0x12409f,'rows':_0x39534d}:null;}})[_0xbc73('0x1e')](respondWithResult(_0x530f0b,null))[_0xbc73('0x28')](handleError(_0x530f0b,null));};exports[_0xbc73('0xe3')]=function(_0x15ce6e,_0x44b59d){var _0x14f3e9={'raw':!![],'where':{}};var _0x5d95dc={};var _0x49d552={'count':0x0,'rows':[]};return db[_0xbc73('0x3a')][_0xbc73('0x93')]({'where':{'id':_0x15ce6e['params']['id']}})[_0xbc73('0x1e')](handleEntityNotFound(_0x44b59d,null))['then'](function(_0x5bc6d6){if(_0x5bc6d6){_0x5d95dc['model']=_[_0xbc73('0xcf')](db[_0xbc73('0xe4')][_0xbc73('0x3b')]);_0x5d95dc[_0xbc73('0x45')]=_['keys'](_0x15ce6e[_0xbc73('0x45')]);_0x5d95dc[_0xbc73('0xd0')]=_[_0xbc73('0xd1')](_0x5d95dc[_0xbc73('0xce')],_0x5d95dc[_0xbc73('0x45')]);_0x14f3e9[_0xbc73('0x4a')]=_[_0xbc73('0xd1')](_0x5d95dc[_0xbc73('0xce')],qs[_0xbc73('0xd2')](_0x15ce6e[_0xbc73('0x45')][_0xbc73('0xd2')]));_0x14f3e9[_0xbc73('0x4a')]=_0x14f3e9[_0xbc73('0x4a')][_0xbc73('0x4e')]?_0x14f3e9[_0xbc73('0x4a')]:_0x5d95dc[_0xbc73('0xce')];if(!_0x15ce6e[_0xbc73('0x45')]['hasOwnProperty'](_0xbc73('0xd7'))){_0x14f3e9[_0xbc73('0x1a')]=qs[_0xbc73('0x1a')](_0x15ce6e[_0xbc73('0x45')][_0xbc73('0x1a')]);_0x14f3e9[_0xbc73('0x19')]=qs['offset'](_0x15ce6e[_0xbc73('0x45')]['offset']);}_0x14f3e9[_0xbc73('0xd3')]=qs[_0xbc73('0xd4')](_0x15ce6e[_0xbc73('0x45')][_0xbc73('0xd4')]);_0x14f3e9[_0xbc73('0x44')]=qs['filters'](_[_0xbc73('0xd5')](_0x15ce6e[_0xbc73('0x45')],_0x5d95dc['filters']));_0x14f3e9[_0xbc73('0x44')][_0xbc73('0xde')]=_0x5bc6d6['id'];if(_0x15ce6e[_0xbc73('0x45')][_0xbc73('0x3f')]){_0x14f3e9['where']=_[_0xbc73('0x58')](_0x14f3e9[_0xbc73('0x44')],{'$or':_['map'](_0x14f3e9[_0xbc73('0x4a')],function(_0xc1ab10){var _0x25bbbe={};_0x25bbbe[_0xc1ab10]={'$like':'%'+_0x15ce6e[_0xbc73('0x45')][_0xbc73('0x3f')]+'%'};return _0x25bbbe;})});}_0x14f3e9=_['merge']({},_0x14f3e9,_0x15ce6e[_0xbc73('0xd6')]);return db[_0xbc73('0xe4')][_0xbc73('0x1c')]({'where':_0x14f3e9[_0xbc73('0x44')]})[_0xbc73('0x1e')](function(_0x31c3b4){_0x49d552[_0xbc73('0x1c')]=_0x31c3b4;if(_0x15ce6e['query'][_0xbc73('0x46')]){_0x14f3e9[_0xbc73('0x47')]=[{'all':!![]}];}return db[_0xbc73('0xe4')]['findAll'](_0x14f3e9);})['then'](function(_0x4b0405){_0x49d552['rows']=_0x4b0405;return _0x49d552;});}})[_0xbc73('0x1e')](respondWithFilteredResult(_0x44b59d,_0x14f3e9))[_0xbc73('0x28')](handleError(_0x44b59d,null));};exports['getSmsInteractions']=function(_0x103215,_0x2bed2a){var _0x4d6b18={};var _0x333a1d={};var _0x277e4d;var _0x4c2259;return db['User'][_0xbc73('0x93')]({'where':{'id':_0x103215[_0xbc73('0x56')]['id']}})[_0xbc73('0x1e')](handleEntityNotFound(_0x2bed2a,null))[_0xbc73('0x1e')](function(_0x4fca59){if(_0x4fca59){_0x277e4d=_0x4fca59;_0x333a1d['model']=_['keys'](db[_0xbc73('0xe5')]['rawAttributes']);_0x333a1d[_0xbc73('0x45')]=_[_0xbc73('0xcf')](_0x103215[_0xbc73('0x45')]);_0x333a1d[_0xbc73('0xd0')]=_['intersection'](_0x333a1d[_0xbc73('0xce')],_0x333a1d[_0xbc73('0x45')]);_0x4d6b18['attributes']=_['intersection'](_0x333a1d['model'],qs[_0xbc73('0xd2')](_0x103215['query'][_0xbc73('0xd2')]));_0x4d6b18['attributes']=_0x4d6b18[_0xbc73('0x4a')][_0xbc73('0x4e')]?_0x4d6b18[_0xbc73('0x4a')]:_0x333a1d[_0xbc73('0xce')];_0x4d6b18[_0xbc73('0xd3')]=qs[_0xbc73('0xd4')](_0x103215['query'][_0xbc73('0xd4')]);_0x4d6b18[_0xbc73('0x44')]=qs[_0xbc73('0xd0')](_[_0xbc73('0xd5')](_0x103215['query'],_0x333a1d[_0xbc73('0xd0')]));if(_0x103215[_0xbc73('0x45')]['filter']){_0x4d6b18[_0xbc73('0x44')]=_[_0xbc73('0x58')](_0x4d6b18[_0xbc73('0x44')],{'$or':_[_0xbc73('0x33')](_0x4d6b18[_0xbc73('0x4a')],function(_0x2a0077){var _0x2a8405={};_0x2a8405[_0x2a0077]={'$like':'%'+_0x103215[_0xbc73('0x45')][_0xbc73('0x3f')]+'%'};return _0x2a8405;})});}_0x4d6b18=_[_0xbc73('0x58')]({},_0x4d6b18,_0x103215[_0xbc73('0xd6')]);return _0x277e4d['getSmsInteractions'](_0x4d6b18);}})['then'](function(_0x42b177){if(_0x42b177){_0x4c2259=_0x42b177[_0xbc73('0x4e')];if(!_0x103215[_0xbc73('0x45')][_0xbc73('0xc5')](_0xbc73('0xd7'))){_0x4d6b18['limit']=qs[_0xbc73('0x1a')](_0x103215['query'][_0xbc73('0x1a')]);_0x4d6b18['offset']=qs[_0xbc73('0x19')](_0x103215[_0xbc73('0x45')]['offset']);}return _0x277e4d[_0xbc73('0xe6')](_0x4d6b18);}})[_0xbc73('0x1e')](function(_0x1a1d20){if(_0x1a1d20){return _0x1a1d20?{'count':_0x4c2259,'rows':_0x1a1d20}:null;}})['then'](respondWithResult(_0x2bed2a,null))[_0xbc73('0x28')](handleError(_0x2bed2a,null));};exports[_0xbc73('0xe7')]=function(_0x447118,_0x3f1d0d){var _0x40aef2={};var _0x5eca04={};var _0x5bd0e0;var _0x4046aa;return db[_0xbc73('0x3a')][_0xbc73('0x93')]({'where':{'id':_0x447118['params']['id']}})['then'](handleEntityNotFound(_0x3f1d0d,null))[_0xbc73('0x1e')](function(_0x3a4e53){if(_0x3a4e53){_0x5bd0e0=_0x3a4e53;_0x5eca04[_0xbc73('0xce')]=_[_0xbc73('0xcf')](db[_0xbc73('0xe8')][_0xbc73('0x3b')]);_0x5eca04[_0xbc73('0x45')]=_[_0xbc73('0xcf')](_0x447118[_0xbc73('0x45')]);_0x5eca04[_0xbc73('0xd0')]=_[_0xbc73('0xd1')](_0x5eca04[_0xbc73('0xce')],_0x5eca04[_0xbc73('0x45')]);_0x40aef2[_0xbc73('0x4a')]=_[_0xbc73('0xd1')](_0x5eca04[_0xbc73('0xce')],qs[_0xbc73('0xd2')](_0x447118[_0xbc73('0x45')]['fields']));_0x40aef2[_0xbc73('0x4a')]=_0x40aef2[_0xbc73('0x4a')][_0xbc73('0x4e')]?_0x40aef2[_0xbc73('0x4a')]:_0x5eca04[_0xbc73('0xce')];_0x40aef2[_0xbc73('0xd3')]=qs['sort'](_0x447118[_0xbc73('0x45')][_0xbc73('0xd4')]);_0x40aef2[_0xbc73('0x44')]=qs[_0xbc73('0xd0')](_[_0xbc73('0xd5')](_0x447118[_0xbc73('0x45')],_0x5eca04[_0xbc73('0xd0')]));if(_0x447118[_0xbc73('0x45')]['filter']){_0x40aef2[_0xbc73('0x44')]=_[_0xbc73('0x58')](_0x40aef2[_0xbc73('0x44')],{'$or':_[_0xbc73('0x33')](_0x40aef2[_0xbc73('0x4a')],function(_0x20ff4a){var _0x52dd87={};_0x52dd87[_0x20ff4a]={'$like':'%'+_0x447118[_0xbc73('0x45')]['filter']+'%'};return _0x52dd87;})});}_0x40aef2=_['merge']({},_0x40aef2,_0x447118[_0xbc73('0xd6')]);return _0x5bd0e0[_0xbc73('0xe7')](_0x40aef2);}})[_0xbc73('0x1e')](function(_0x13b6d7){if(_0x13b6d7){_0x4046aa=_0x13b6d7[_0xbc73('0x4e')];if(!_0x447118[_0xbc73('0x45')][_0xbc73('0xc5')](_0xbc73('0xd7'))){_0x40aef2['limit']=qs[_0xbc73('0x1a')](_0x447118[_0xbc73('0x45')][_0xbc73('0x1a')]);_0x40aef2[_0xbc73('0x19')]=qs['offset'](_0x447118['query'][_0xbc73('0x19')]);}return _0x5bd0e0[_0xbc73('0xe7')](_0x40aef2);}})['then'](function(_0x26e3d8){if(_0x26e3d8){return _0x26e3d8?{'count':_0x4046aa,'rows':_0x26e3d8}:null;}})[_0xbc73('0x1e')](respondWithResult(_0x3f1d0d,null))[_0xbc73('0x28')](handleError(_0x3f1d0d,null));};exports[_0xbc73('0xe9')]=function(_0x13580f,_0x129030){var _0x14a8f7={};var _0x56b2e4={};var _0x500bc2;var _0x17313c;return db['User'][_0xbc73('0x93')]({'where':{'id':_0x13580f[_0xbc73('0x56')]['id']}})[_0xbc73('0x1e')](handleEntityNotFound(_0x129030,null))[_0xbc73('0x1e')](function(_0x26be87){if(_0x26be87){_0x500bc2=_0x26be87;_0x56b2e4[_0xbc73('0xce')]=_[_0xbc73('0xcf')](db['WhatsappInteraction'][_0xbc73('0x3b')]);_0x56b2e4[_0xbc73('0x45')]=_[_0xbc73('0xcf')](_0x13580f['query']);_0x56b2e4[_0xbc73('0xd0')]=_[_0xbc73('0xd1')](_0x56b2e4[_0xbc73('0xce')],_0x56b2e4['query']);_0x14a8f7[_0xbc73('0x4a')]=_['intersection'](_0x56b2e4[_0xbc73('0xce')],qs[_0xbc73('0xd2')](_0x13580f[_0xbc73('0x45')][_0xbc73('0xd2')]));_0x14a8f7[_0xbc73('0x4a')]=_0x14a8f7[_0xbc73('0x4a')][_0xbc73('0x4e')]?_0x14a8f7[_0xbc73('0x4a')]:_0x56b2e4[_0xbc73('0xce')];_0x14a8f7[_0xbc73('0xd3')]=qs[_0xbc73('0xd4')](_0x13580f['query'][_0xbc73('0xd4')]);_0x14a8f7[_0xbc73('0x44')]=qs[_0xbc73('0xd0')](_[_0xbc73('0xd5')](_0x13580f['query'],_0x56b2e4['filters']));if(_0x13580f[_0xbc73('0x45')]['filter']){_0x14a8f7[_0xbc73('0x44')]=_['merge'](_0x14a8f7[_0xbc73('0x44')],{'$or':_[_0xbc73('0x33')](_0x14a8f7[_0xbc73('0x4a')],function(_0x74297c){var _0x1972f6={};_0x1972f6[_0x74297c]={'$like':'%'+_0x13580f[_0xbc73('0x45')][_0xbc73('0x3f')]+'%'};return _0x1972f6;})});}_0x14a8f7=_[_0xbc73('0x58')]({},_0x14a8f7,_0x13580f[_0xbc73('0xd6')]);return _0x500bc2[_0xbc73('0xe9')](_0x14a8f7);}})[_0xbc73('0x1e')](function(_0x35e30a){if(_0x35e30a){_0x17313c=_0x35e30a[_0xbc73('0x4e')];if(!_0x13580f[_0xbc73('0x45')][_0xbc73('0xc5')]('nolimit')){_0x14a8f7['limit']=qs[_0xbc73('0x1a')](_0x13580f['query'][_0xbc73('0x1a')]);_0x14a8f7[_0xbc73('0x19')]=qs[_0xbc73('0x19')](_0x13580f['query'][_0xbc73('0x19')]);}return _0x500bc2[_0xbc73('0xe9')](_0x14a8f7);}})['then'](function(_0x14c9a3){if(_0x14c9a3){return _0x14c9a3?{'count':_0x17313c,'rows':_0x14c9a3}:null;}})[_0xbc73('0x1e')](respondWithResult(_0x129030,null))[_0xbc73('0x28')](handleError(_0x129030,null));};exports[_0xbc73('0xea')]=function(_0x2065d,_0x3135bc,_0x10c995){var _0x5c5338;var _0x26ac79;var _0x5f3b5c;var _0x536808=!_[_0xbc73('0x65')](_0x2065d[_0xbc73('0x56')]['id'])?_0x2065d[_0xbc73('0x56')]['id']:!_[_0xbc73('0x65')](_0x2065d[_0xbc73('0x2f')]['id'])?_0x2065d[_0xbc73('0x2f')]['id']:null;return db[_0xbc73('0x3a')]['find']({'where':{'id':_0x536808,'role':{'$or':['admin',_0xbc73('0x2f'),_0xbc73('0x2b')]}},'attributes':['id',_0xbc73('0x39'),_0xbc73('0xeb'),_0xbc73('0xec'),_0xbc73('0x2a'),_0xbc73('0x60'),_0xbc73('0x9a')]})[_0xbc73('0x1e')](function(_0x57af5e){if(_0x57af5e){if(_0x57af5e['role']===_0xbc73('0x2b')){_0x5c5338=_0x57af5e;if(_0x2065d[_0xbc73('0x5b')][_0xbc73('0xa4')]){_0x5f3b5c=util[_0xbc73('0xa5')](_0xbc73('0xed'),_0x5c5338[_0x2065d['body'][_0xbc73('0xa4')]]);}else if(_0x2065d[_0xbc73('0x5b')]['intrf']){_0x5f3b5c=util[_0xbc73('0xa5')](_0xbc73('0xee'),_0x2065d[_0xbc73('0x5b')]['intrf']);}else{_0x5f3b5c=util[_0xbc73('0xa5')](_0xbc73('0xee'),_0x5c5338[_0xbc73('0x39')]);}socket['to'](util[_0xbc73('0xa5')](_0xbc73('0xef'),_0x5c5338[_0xbc73('0x39')]))['emit'](_0xbc73('0xf0'),{'user':{'id':_0x5c5338['id'],'name':_0x5c5338[_0xbc73('0x39')]},'ip':_0x2065d[_0xbc73('0xf1')][_0xbc73('0xf2')]||_0x2065d[_0xbc73('0xf3')][_0xbc73('0xf4')]||_0x2065d['socket'][_0xbc73('0xf4')]||_0x2065d[_0xbc73('0xf3')]['socket'][_0xbc73('0xf4')]});return new Promise(function(_0x4456a4,_0x3e0b3e){db[_0xbc73('0x67')]['transaction']()[_0xbc73('0x1e')](_0x1379b9=>{db[_0xbc73('0xad')]['destroy']({'where':{'membername':_0x5c5338[_0xbc73('0x39')]},'individualHooks':!![]},{'transaction':_0x1379b9})[_0xbc73('0x1e')](function(){return _0x1379b9['commit']();})[_0xbc73('0x1e')](_0x4456a4)[_0xbc73('0x28')](_0x3e0b3e);});});}}else{throw new db[(_0xbc73('0x8c'))][(_0xbc73('0x8d'))](_0xbc73('0xf5'));}})[_0xbc73('0x1e')](function(){if(_0x5c5338){return _0x5c5338[_0xbc73('0xf6')]({'raw':!![]});}})['then'](function(_0x1101d0){if(_0x5c5338){if(_0x1101d0){_0x26ac79=_0x1101d0;if(_0x26ac79[_0xbc73('0x4e')]){var _0x43b4cc=_0x26ac79[_0xbc73('0x33')](function(_0x1ba404){return{'membername':_0x5c5338['name'],'UserId':_0x5c5338['id'],'queue_name':_0x1ba404[_0xbc73('0x39')],'VoiceQueueId':_0x1ba404['id'],'interface':_0x5f3b5c,'paused':_0x5c5338[_0xbc73('0x9a')]||![],'penalty':_0x1ba404[_0xbc73('0xf7')]||0x0};});return db['UserVoiceQueueRt']['bulkCreate'](_0x43b4cc);}}}})[_0xbc73('0x1e')](function(){if(_0x5c5338){return db[_0xbc73('0xf8')][_0xbc73('0x86')]({'where':{'membername':_0x5c5338[_0xbc73('0x39')],'exitAt':null}});}})[_0xbc73('0x1e')](function(_0x3ee592){if(_0x5c5338){var _0x47fa89=[];_0x3ee592['forEach'](function(_0x199339){_0x47fa89[_0xbc73('0x4b')](_0x199339['update']({'exitAt':moment()[_0xbc73('0xa5')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xbc73('0x54')](_0x47fa89);}})[_0xbc73('0x1e')](function(){if(_0x5c5338){var _0x2a7387=[];var _0x276c9d=[];var _0x173e42=utils['getChannels']();var _0x219c19={'membername':_0x5c5338[_0xbc73('0x39')],'interface':_0x5f3b5c,'enterAt':moment()[_0xbc73('0xa5')](_0xbc73('0xf9')),'role':_0x5c5338[_0xbc73('0x2a')],'internal':_0x5c5338[_0xbc73('0x60')]};_0x173e42['forEach'](function(_0x5805c3){_0x2a7387['push'](_[_0xbc73('0x58')]({'channel':_0x5805c3,'type':_0xbc73('0xfa'),'data1':_0x2065d[_0xbc73('0x5b')][_0xbc73('0xfb')],'data2':_0x5f3b5c},_0x219c19));if(_0x5c5338[_0xbc73('0x9a')]){_0x276c9d[_0xbc73('0x4b')](_[_0xbc73('0x58')]({'channel':_0x5805c3,'type':'PAUSE','data1':'LOGININPAUSE'},_0x219c19));}});return db[_0xbc73('0xf8')][_0xbc73('0x81')](_0x2a7387[_0xbc73('0xc2')](_0x276c9d),{'individualHooks':!![]});}})[_0xbc73('0x1e')](function(){if(_0x5c5338){return _0x5c5338[_0xbc73('0x29')]({'online':!![],'lastLoginAt':moment()[_0xbc73('0xa5')](_0xbc73('0xf9')),'voicePause':_0x5c5338[_0xbc73('0x9a')]||![],'mailPause':_0x5c5338[_0xbc73('0x9a')]||![],'chatPause':_0x5c5338[_0xbc73('0x9a')]||![],'faxPause':_0x5c5338[_0xbc73('0x9a')]||![],'smsPause':_0x5c5338['loginInPause']||![],'openchannelPause':_0x5c5338[_0xbc73('0x9a')]||![],'whatsappPause':_0x5c5338['loginInPause']||![],'pauseType':_0x5c5338[_0xbc73('0x9a')]?_0xbc73('0xfc'):null,'interface':_0x5f3b5c,'lastPauseAt':moment()[_0xbc73('0xa5')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xbc73('0x1e')](function(_0x2900fd){if(_0x2065d[_0xbc73('0xfd')]){return _0x10c995();}else{return Promise[_0xbc73('0xfe')](_0x2900fd)[_0xbc73('0x1e')](respondWithResult(_0x3135bc,null));}})[_0xbc73('0x28')](handleError(_0x3135bc,null));};exports['logout']=function(_0x3fad98,_0x1412c7){var _0x3eea8e;return db[_0xbc73('0x3a')][_0xbc73('0x36')]({'where':{'id':_0x3fad98['params']['id'],'role':_0xbc73('0x2b')},'attributes':['id',_0xbc73('0x39'),_0xbc73('0x2a')]})[_0xbc73('0x1e')](handleEntityNotFound(_0x1412c7,null))[_0xbc73('0x1e')](function(_0x539d37){if(_0x539d37){_0x3eea8e=_0x539d37;return db[_0xbc73('0xad')][_0xbc73('0x37')]({'where':{'membername':_0x3eea8e[_0xbc73('0x39')]},'individualHooks':!![]});}})['then'](function(){return db[_0xbc73('0xf8')][_0xbc73('0x86')]({'where':{'membername':_0x3eea8e[_0xbc73('0x39')],'exitAt':null}});})[_0xbc73('0x1e')](function(_0x21d9c8){var _0x4899c8=[];_0x21d9c8[_0xbc73('0xff')](function(_0x4da07b){_0x4899c8['push'](_0x4da07b[_0xbc73('0x29')]({'exitAt':moment()[_0xbc73('0xa5')](_0xbc73('0xf9'))}));});return Promise['all'](_0x4899c8);})[_0xbc73('0x1e')](function(){return _0x3eea8e[_0xbc73('0x29')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xbc73('0x1e')](respondWithResult(_0x1412c7,null))['catch'](handleError(_0x1412c7,null));};exports[_0xbc73('0x100')]=function(_0x4032f2,_0xe437fc){var _0x1edc3a;return db[_0xbc73('0xad')]['update']({'paused':0x1},{'where':{'UserId':_0x4032f2['params']['id']},'individualHooks':!![]})[_0xbc73('0x1e')](function(){return db[_0xbc73('0x3a')]['find']({'where':{'id':_0x4032f2['params']['id'],'role':'agent'},'attributes':['id',_0xbc73('0x39'),_0xbc73('0x2a'),_0xbc73('0x60'),_0xbc73('0xa4'),_0xbc73('0x99')]});})[_0xbc73('0x1e')](handleEntityNotFound(_0xe437fc,null))[_0xbc73('0x1e')](function(_0x3fab97){if(_0x3fab97){_0x1edc3a=_0x3fab97;return respondWithRpcPromise(_0xbc73('0x101'),_0xbc73('0x100'),{'id':_0x1edc3a['id'],'name':_0x1edc3a[_0xbc73('0x39')],'pause':!![]});}})['then'](function(){if(_0x1edc3a){return db[_0xbc73('0xf8')][_0xbc73('0x86')]({'where':{'membername':_0x1edc3a[_0xbc73('0x39')],'type':_0xbc73('0x102'),'exitAt':null}});}})['then'](function(_0x1db885){if(_0x1db885[_0xbc73('0x4e')]){var _0x161700=moment()[_0xbc73('0xa5')](_0xbc73('0xf9'));for(var _0x4a4b24=0x0,_0x146bcf=_0x1db885[_0xbc73('0x4e')];_0x4a4b24<_0x146bcf;_0x4a4b24++){_0x1db885[_0x4a4b24][_0xbc73('0x103')]({'exitAt':_0x161700});}}})[_0xbc73('0x1e')](function(){var _0x3b2484=[];var _0x14153c=utils[_0xbc73('0x104')]();_0x14153c[_0xbc73('0xff')](function(_0x343bd1){_0x3b2484[_0xbc73('0x4b')]({'channel':_0x343bd1,'membername':_0x1edc3a[_0xbc73('0x39')],'interface':_[_0xbc73('0x65')](_0x1edc3a[_0xbc73('0xa4')])?util[_0xbc73('0xa5')](_0xbc73('0xee'),_0x1edc3a['name']):_0x1edc3a[_0xbc73('0xa4')],'type':_0xbc73('0x102'),'enterAt':moment()[_0xbc73('0xa5')](_0xbc73('0xf9')),'data1':_0x4032f2[_0xbc73('0x5b')]['type']||_0xbc73('0x105'),'role':_0x1edc3a[_0xbc73('0x2a')],'internal':_0x1edc3a[_0xbc73('0x60')]});});return db[_0xbc73('0xf8')][_0xbc73('0x81')](_0x3b2484,{'individualHooks':!![]});})[_0xbc73('0x1e')](function(){return _0x1edc3a['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4032f2[_0xbc73('0x5b')][_0xbc73('0x3d')]||_0xbc73('0x105'),'lastPauseAt':moment()['format'](_0xbc73('0xf9'))});})[_0xbc73('0x1e')](respondWithResult(_0xe437fc,null))[_0xbc73('0x28')](handleError(_0xe437fc,null));};exports[_0xbc73('0x106')]=function(_0xb80b2a,_0x2f1bcc){if(_0xb80b2a[_0xbc73('0x5b')]['channel']&&!utils[_0xbc73('0xa8')](_0xb80b2a[_0xbc73('0x5b')][_0xbc73('0x98')])){throw new APIBadRequestError(util[_0xbc73('0xa5')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0xb80b2a[_0xbc73('0x5b')][_0xbc73('0x98')]));}return db[_0xbc73('0x3a')][_0xbc73('0x36')]({'where':{'id':_0xb80b2a['params']['id']},'attributes':['id','name',_0xbc73('0x2a'),_0xbc73('0x60'),_0xbc73('0xa4'),'online','voicePause',_0xbc73('0x107'),_0xbc73('0x108'),_0xbc73('0x109'),_0xbc73('0x10a'),_0xbc73('0x10b'),'whatsappPause',_0xbc73('0x10c'),_0xbc73('0x10d')]})[_0xbc73('0x1e')](function(_0xcdb797){if(!_0xcdb797){throw new APINotFoundError(util[_0xbc73('0xa5')]('User\x20with\x20id\x20%s\x20not\x20found',_0xb80b2a[_0xbc73('0x56')]['id']));}return _0xcdb797[_0xbc73('0x106')](_0xb80b2a['body'][_0xbc73('0x98')]);})['then'](respondWithResult(_0x2f1bcc,null))[_0xbc73('0x28')](APIHandleError(_0x2f1bcc));};exports[_0xbc73('0x10e')]=function(_0x386373,_0x525e50){var _0x3422a4={};var _0x1662b5={};var _0x1fbd81;var _0x4c9952;return db[_0xbc73('0x3a')]['findOne']({'where':{'id':_0x386373[_0xbc73('0x56')]['id']}})['then'](handleEntityNotFound(_0x525e50,null))[_0xbc73('0x1e')](function(_0x481da4){if(_0x481da4){_0x1fbd81=_0x481da4;_0x1662b5[_0xbc73('0xce')]=_[_0xbc73('0xcf')](db[_0xbc73('0x10f')][_0xbc73('0x3b')]);_0x1662b5['query']=_[_0xbc73('0xcf')](_0x386373[_0xbc73('0x45')]);_0x1662b5[_0xbc73('0xd0')]=_[_0xbc73('0xd1')](_0x1662b5[_0xbc73('0xce')],_0x1662b5[_0xbc73('0x45')]);_0x3422a4[_0xbc73('0x4a')]=_[_0xbc73('0xd1')](_0x1662b5[_0xbc73('0xce')],qs[_0xbc73('0xd2')](_0x386373[_0xbc73('0x45')][_0xbc73('0xd2')]));_0x3422a4['attributes']=_0x3422a4[_0xbc73('0x4a')][_0xbc73('0x4e')]?_0x3422a4['attributes']:_0x1662b5['model'];_0x3422a4[_0xbc73('0xd3')]=qs['sort'](_0x386373[_0xbc73('0x45')][_0xbc73('0xd4')]);_0x3422a4[_0xbc73('0x44')]=qs['filters'](_[_0xbc73('0xd5')](_0x386373[_0xbc73('0x45')],_0x1662b5[_0xbc73('0xd0')]));if(_0x386373['query']['filter']){_0x3422a4[_0xbc73('0x44')]=_[_0xbc73('0x58')](_0x3422a4[_0xbc73('0x44')],{'$or':_[_0xbc73('0x33')](_0x3422a4[_0xbc73('0x4a')],function(_0x4a9e30){var _0x39f19a={};_0x39f19a[_0x4a9e30]={'$like':'%'+_0x386373['query'][_0xbc73('0x3f')]+'%'};return _0x39f19a;})});}_0x3422a4=_[_0xbc73('0x58')]({},_0x3422a4,_0x386373['options']);return _0x1fbd81[_0xbc73('0x10e')](_0x3422a4);}})[_0xbc73('0x1e')](function(_0x4b7046){if(_0x4b7046){_0x4c9952=_0x4b7046[_0xbc73('0x4e')];if(!_0x386373['query'][_0xbc73('0xc5')](_0xbc73('0xd7'))){_0x3422a4[_0xbc73('0x1a')]=qs[_0xbc73('0x1a')](_0x386373[_0xbc73('0x45')][_0xbc73('0x1a')]);_0x3422a4[_0xbc73('0x19')]=qs['offset'](_0x386373[_0xbc73('0x45')][_0xbc73('0x19')]);}return _0x1fbd81[_0xbc73('0x10e')](_0x3422a4);}})['then'](function(_0x3a98c1){if(_0x3a98c1){return _0x3a98c1?{'count':_0x4c9952,'rows':_0x3a98c1}:null;}})[_0xbc73('0x1e')](respondWithResult(_0x525e50,null))[_0xbc73('0x28')](handleError(_0x525e50,null));};exports[_0xbc73('0x110')]=function(_0x442eeb,_0x20ec22){var _0x491208=_0x442eeb['params']['id'];var _0x4a95f5=_0x442eeb['body']?_0x442eeb[_0xbc73('0x5b')][_0xbc73('0x5e')]:null;var _0x59a15c=[];return Promise[_0xbc73('0xfe')]()[_0xbc73('0x1e')](function(){if(!_0x4a95f5)throw new APIBadRequestError(_0xbc73('0x111'));})[_0xbc73('0x1e')](function(){return db[_0xbc73('0x3a')][_0xbc73('0x93')]({'where':{'id':_0x491208}});})[_0xbc73('0x1e')](function(_0x4d0ea0){if(!_0x4d0ea0)throw new APINotFoundError(util['format'](_0xbc73('0xc4'),_0x442eeb[_0xbc73('0x56')]['id']));return db[_0xbc73('0x67')][_0xbc73('0x112')](function(_0x1898cb){return _0x4d0ea0[_0xbc73('0x110')](_0x4a95f5,{'transaction':_0x1898cb})[_0xbc73('0x1e')](function(){return db['Team'][_0xbc73('0x86')]({'where':{'id':{'$in':_0x4a95f5}}});})[_0xbc73('0x1e')](function(_0x521ad3){var _0x152a89=_['map'](_0x521ad3,function(_0x461cf4){return _0x461cf4['getAssociatedQueues']();});return Promise[_0xbc73('0x54')](_0x152a89);})[_0xbc73('0x1e')](function(_0x393d17){_0x59a15c=_[_0xbc73('0x113')](_0x393d17);var _0x5f1ed3=_[_0xbc73('0x33')](_0x59a15c,function(_0xfa4625){return _0xfa4625[_0xbc73('0x114')](_0x4d0ea0['id'],{'transaction':_0x1898cb});});return Promise[_0xbc73('0x54')](_0x5f1ed3);})['then'](function(){if(!_0x4d0ea0['online'])return;var _0x485718=_[_0xbc73('0x3f')](_0x59a15c,function(_0x1e10eb){return _0x1e10eb[_0xbc73('0x115')](_0xbc73('0x98'))==='Voice';});var _0x5cb65b=_['map'](_0x485718,function(_0x394477){return db[_0xbc73('0xad')][_0xbc73('0xa6')]({'membername':_0x4d0ea0[_0xbc73('0x39')],'UserId':_0x4d0ea0['id'],'queue_name':_0x394477['name'],'VoiceQueueId':_0x394477['id'],'interface':_[_0xbc73('0x65')](_0x4d0ea0[_0xbc73('0xa4')])?util[_0xbc73('0xa5')](_0xbc73('0xee'),_0x4d0ea0[_0xbc73('0x39')]):_0x4d0ea0['interface'],'paused':_0x4d0ea0['voicePause']||![],'penalty':_0x4d0ea0['penalty']},{'transaction':_0x1898cb});});return Promise['all'](_0x5cb65b);})[_0xbc73('0x1e')](function(){return db['TeamVoicePrefix'][_0xbc73('0x86')]({'where':{'teamId':{'$in':_0x4a95f5}}});})[_0xbc73('0x1e')](function(_0x288ad7){var _0x2bd38b=_[_0xbc73('0x33')](_0x288ad7,function(_0x1fb916){return db[_0xbc73('0x116')][_0xbc73('0x7c')]({'UserId':_0x4d0ea0['id'],'VoicePrefixId':_0x1fb916[_0xbc73('0x117')]},{'transaction':_0x1898cb});});return Promise[_0xbc73('0x54')](_0x2bd38b);});});})[_0xbc73('0x1e')](function(){for(var _0x4c5396=0x0;_0x4c5396<_0x59a15c[_0xbc73('0x4e')];_0x4c5396++){var _0x74838a=_0x59a15c[_0x4c5396][_0xbc73('0x115')]('channel');var _0x42464b=_0x74838a+_0xbc73('0xab');socket['emit'](_0xbc73('0x2f')+_0x74838a+'Queue:save',{'UserId':_0x491208,['queueField']:_0x59a15c[_0x4c5396]['id']});}})['then'](respondWithStatusCode(_0x20ec22,null))[_0xbc73('0x28')](APIHandleError(_0x20ec22));};exports[_0xbc73('0x118')]=function(_0x193b98,_0x417c80){var _0x1cd072=_0x193b98[_0xbc73('0x56')]['id'];var _0x1333ae=null;if(_0x193b98['query']['ids']){_0x1333ae=_[_0xbc73('0xaa')](_0x193b98[_0xbc73('0x45')][_0xbc73('0x5e')])?_0x193b98[_0xbc73('0x45')]['ids']:[_0x193b98[_0xbc73('0x45')]['ids']];}var _0x4f81fd=[];return Promise['resolve']()['then'](function(){if(!_0x1333ae)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db[_0xbc73('0x3a')][_0xbc73('0x93')]({'where':{'id':_0x1cd072}});})[_0xbc73('0x1e')](function(_0x5059da){if(!_0x5059da)throw new APINotFoundError(util[_0xbc73('0xa5')](_0xbc73('0xc4'),_0x193b98[_0xbc73('0x56')]['id']));return db[_0xbc73('0x67')][_0xbc73('0x112')](function(_0x4bdefb){return _0x5059da['removeTeams'](_0x1333ae,{'transaction':_0x4bdefb})[_0xbc73('0x1e')](function(){return db[_0xbc73('0x10f')][_0xbc73('0x86')]({'where':{'id':{'$in':_0x1333ae}}});})['then'](function(_0x5f5388){var _0x296c39=_['map'](_0x5f5388,function(_0x49170e){return _0x49170e[_0xbc73('0x119')]();});return Promise[_0xbc73('0x54')](_0x296c39);})['then'](function(_0x26e1bd){_0x4f81fd=_[_0xbc73('0x113')](_0x26e1bd);var _0x338268=_[_0xbc73('0x33')](_0x4f81fd,function(_0x20ae87){return _0x20ae87['removeAgent'](_0x5059da['id'],{'transaction':_0x4bdefb});});return Promise['all'](_0x338268);})[_0xbc73('0x1e')](function(){if(!_0x5059da[_0xbc73('0x99')])return;var _0x415125=_[_0xbc73('0x3f')](_0x4f81fd,function(_0x34b873){return _0x34b873['getDataValue'](_0xbc73('0x98'))===_0xbc73('0x11a');});var _0x2e14ab=_['map'](_0x415125,function(_0x244b46){return db[_0xbc73('0xad')][_0xbc73('0x37')]({'where':{'VoiceQueueId':_0x244b46['id'],'UserId':_0x5059da['id']},'transaction':_0x4bdefb});});return Promise[_0xbc73('0x54')](_0x2e14ab);})['then'](function(){return db[_0xbc73('0x11b')]['findAll']({'where':{'teamId':{'$in':_0x1333ae}}});})[_0xbc73('0x1e')](function(_0x1b9e9a){var _0x15d175=_[_0xbc73('0x33')](_0x1b9e9a,function(_0x51c318){return db[_0xbc73('0x116')][_0xbc73('0x37')]({'where':{'UserId':_0x5059da['id'],'VoicePrefixId':_0x51c318[_0xbc73('0x117')]}},{'transaction':_0x4bdefb});});return Promise[_0xbc73('0x54')](_0x15d175);});});})[_0xbc73('0x1e')](function(){for(var _0x6187fa=0x0;_0x6187fa<_0x4f81fd[_0xbc73('0x4e')];_0x6187fa++){var _0x1fa2a9=_0x4f81fd[_0x6187fa][_0xbc73('0x115')](_0xbc73('0x98'));var _0x1e5e58=_0x1fa2a9+_0xbc73('0xab');socket[_0xbc73('0x2c')](_0xbc73('0x2f')+_0x1fa2a9+_0xbc73('0xac'),{'UserId':_0x1cd072,['queueField']:_0x4f81fd[_0x6187fa]['id']});}})['then'](respondWithStatusCode(_0x417c80,null))[_0xbc73('0x28')](APIHandleError(_0x417c80));};exports[_0xbc73('0x11c')]=function(_0x5d5910,_0x340ac7){var _0x14f599={};var _0x1ee6ca={};var _0x3f0db9;var _0x1b879b;return db[_0xbc73('0x3a')]['findOne']({'where':{'id':_0x5d5910[_0xbc73('0x56')]['id']}})[_0xbc73('0x1e')](handleEntityNotFound(_0x340ac7,null))[_0xbc73('0x1e')](function(_0x5a2bff){if(_0x5a2bff){_0x3f0db9=_0x5a2bff;_0x1ee6ca[_0xbc73('0xce')]=_[_0xbc73('0xcf')](db['CmList'][_0xbc73('0x3b')]);_0x1ee6ca[_0xbc73('0x45')]=_[_0xbc73('0xcf')](_0x5d5910[_0xbc73('0x45')]);_0x1ee6ca[_0xbc73('0xd0')]=_[_0xbc73('0xd1')](_0x1ee6ca[_0xbc73('0xce')],_0x1ee6ca[_0xbc73('0x45')]);_0x14f599[_0xbc73('0x4a')]=_[_0xbc73('0xd1')](_0x1ee6ca[_0xbc73('0xce')],qs['fields'](_0x5d5910['query'][_0xbc73('0xd2')]));_0x14f599['attributes']=_0x14f599[_0xbc73('0x4a')][_0xbc73('0x4e')]?_0x14f599[_0xbc73('0x4a')]:_0x1ee6ca[_0xbc73('0xce')];_0x14f599[_0xbc73('0xd3')]=qs[_0xbc73('0xd4')](_0x5d5910[_0xbc73('0x45')][_0xbc73('0xd4')]);_0x14f599[_0xbc73('0x44')]=qs[_0xbc73('0xd0')](_[_0xbc73('0xd5')](_0x5d5910[_0xbc73('0x45')],_0x1ee6ca[_0xbc73('0xd0')]));if(_0x5d5910[_0xbc73('0x45')][_0xbc73('0x3f')]){_0x14f599[_0xbc73('0x44')]=_['merge'](_0x14f599[_0xbc73('0x44')],{'$or':_[_0xbc73('0x33')](_0x14f599[_0xbc73('0x4a')],function(_0x25e90e){var _0x4db1d2={};_0x4db1d2[_0x25e90e]={'$like':'%'+_0x5d5910[_0xbc73('0x45')][_0xbc73('0x3f')]+'%'};return _0x4db1d2;})});}_0x14f599=_['merge']({},_0x14f599,_0x5d5910[_0xbc73('0xd6')]);return _0x3f0db9[_0xbc73('0x11c')](_0x14f599);}})[_0xbc73('0x1e')](function(_0x17255a){if(_0x17255a){_0x1b879b=_0x17255a[_0xbc73('0x4e')];if(!_0x5d5910['query'][_0xbc73('0xc5')](_0xbc73('0xd7'))){_0x14f599[_0xbc73('0x1a')]=qs['limit'](_0x5d5910[_0xbc73('0x45')]['limit']);_0x14f599[_0xbc73('0x19')]=qs[_0xbc73('0x19')](_0x5d5910[_0xbc73('0x45')][_0xbc73('0x19')]);}return _0x3f0db9[_0xbc73('0x11c')](_0x14f599);}})[_0xbc73('0x1e')](function(_0x2b9e7a){if(_0x2b9e7a){return _0x2b9e7a?{'count':_0x1b879b,'rows':_0x2b9e7a}:null;}})['then'](respondWithResult(_0x340ac7,null))[_0xbc73('0x28')](handleError(_0x340ac7,null));};exports[_0xbc73('0x11d')]=function(_0x49dbac,_0x4bc75c){var _0x3c03ab={};var _0x5ac75e={};var _0x2bf670;return db[_0xbc73('0x3a')][_0xbc73('0x93')]({'where':{'id':_0x49dbac[_0xbc73('0x56')]['id']}})[_0xbc73('0x1e')](handleEntityNotFound(_0x4bc75c,null))[_0xbc73('0x1e')](function(_0x113b45){if(_0x113b45){_0x2bf670=_0x113b45;_0x5ac75e[_0xbc73('0xce')]=_[_0xbc73('0xcf')](db[_0xbc73('0x3a')][_0xbc73('0x3b')]);_0x5ac75e[_0xbc73('0x45')]=_[_0xbc73('0xcf')](_0x49dbac[_0xbc73('0x45')]);_0x5ac75e[_0xbc73('0xd0')]=_['intersection'](_0x5ac75e[_0xbc73('0xce')],_0x5ac75e[_0xbc73('0x45')]);_0x3c03ab[_0xbc73('0x4a')]=_[_0xbc73('0xd1')](_0x5ac75e[_0xbc73('0xce')],qs[_0xbc73('0xd2')](_0x49dbac[_0xbc73('0x45')][_0xbc73('0xd2')]));_0x3c03ab[_0xbc73('0x4a')]=_0x3c03ab[_0xbc73('0x4a')][_0xbc73('0x4e')]?_0x3c03ab[_0xbc73('0x4a')]:_0x5ac75e[_0xbc73('0xce')];_0x3c03ab[_0xbc73('0xd3')]=qs[_0xbc73('0xd4')](_0x49dbac[_0xbc73('0x45')][_0xbc73('0xd4')]);_0x3c03ab['where']=qs['filters'](_['pick'](_0x49dbac[_0xbc73('0x45')],_0x5ac75e[_0xbc73('0xd0')]));if(_0x49dbac[_0xbc73('0x45')][_0xbc73('0x3f')]){_0x3c03ab['where']=_[_0xbc73('0x58')](_0x3c03ab[_0xbc73('0x44')],{'$or':_[_0xbc73('0x33')](_0x3c03ab[_0xbc73('0x4a')],function(_0x17015b){var _0x269fb4={};_0x269fb4[_0x17015b]={'$like':'%'+_0x49dbac[_0xbc73('0x45')][_0xbc73('0x3f')]+'%'};return _0x269fb4;})});}_0x3c03ab[_0xbc73('0xce')]=db[_0xbc73('0x3a')];_0x3c03ab['as']=_0xbc73('0x30');_0x3c03ab=_[_0xbc73('0x58')]({},_0x3c03ab,_0x49dbac['options']);return _0x2bf670[_0xbc73('0xf6')]({'include':[_0x3c03ab]});}})[_0xbc73('0x1e')](function(_0x1576bb){if(_0x1576bb){var _0x3745ac={},_0x58d00e=[];for(var _0x24d3d5=0x0;_0x24d3d5<_0x1576bb[_0xbc73('0x4e')];_0x24d3d5+=0x1){for(var _0x4b9a77=0x0,_0x3d803e;_0x4b9a77<_0x1576bb[_0x24d3d5][_0xbc73('0x30')][_0xbc73('0x4e')];_0x4b9a77+=0x1){_0x3d803e=_0x1576bb[_0x24d3d5][_0xbc73('0x30')][_0x4b9a77][_0xbc73('0xa3')]({'plain':!![]});_0x3745ac[_0x3d803e['id']]=_0x3d803e;}}_0x3745ac=_[_0xbc73('0x11e')](_0x3745ac);for(var _0x1e5962=qs[_0xbc73('0x19')](_0x49dbac['query'][_0xbc73('0x19')]);_0x1e5962<_0x3745ac['length']&&_0x58d00e[_0xbc73('0x4e')]=_0x2d9cc8){_0x390cfd=_0x2d9cc8;_0x4c2079=0xc8;}else{_0x4c2079=0xce;}_0x230386[_0x6676('0x19')](_0x4c2079);return _0x230386[_0x6676('0x1a')](_0x6676('0x1b'),_0x2c4ea9+'-'+_0x390cfd+'/'+_0x2d9cc8)[_0x6676('0x1c')](_0x1800a1);}return null;};}function respondWithRpcPromise(_0x31d5d1,_0x300f91,_0x4bbad4,_0xa4bedf){return new Promise(function(_0x2f8da4,_0x9c6895){var _0xfb2ac7=_0xa4bedf||amiClient;return _0xfb2ac7[_0x6676('0x1d')](_0x31d5d1,_0x4bbad4)[_0x6676('0x1e')](function(_0x3be942){logger[_0x6676('0x1f')](_0x6676('0x20'),_0x300f91,_0x6676('0x21'));logger[_0x6676('0x22')](_0x6676('0x23'),_0x300f91,'request\x20sent',JSON[_0x6676('0x24')](_0x3be942));if(_0x3be942['error']){if(_0x3be942[_0x6676('0x25')]['code']===0x1f4){logger['error'](_0x6676('0x20'),_0x300f91,_0x3be942[_0x6676('0x25')][_0x6676('0x26')]);return _0x9c6895(_0x3be942[_0x6676('0x25')][_0x6676('0x26')]);}logger[_0x6676('0x25')](_0x6676('0x20'),_0x300f91,_0x3be942[_0x6676('0x25')]['message']);return _0x2f8da4(_0x3be942[_0x6676('0x25')]['message']);}else{logger['info']('User,\x20%s,\x20%s',_0x300f91,_0x6676('0x21'));_0x2f8da4(_0x3be942['result']['message']);}})['catch'](function(_0x3fe5e8){logger[_0x6676('0x25')]('User,\x20%s,\x20%s',_0x300f91,_0x3fe5e8);_0x9c6895(_0x3fe5e8);});});}function saveUpdates(_0x16bbae){return function(_0x103e4e){if(_0x103e4e){return _0x103e4e[_0x6676('0x27')](_0x16bbae)[_0x6676('0x1e')](function(_0x2eefe3){if(_0x2eefe3[_0x6676('0x28')]===_0x6676('0x29')){socket[_0x6676('0x2a')]('userNotification:recalc:'+_0x2eefe3['id'],_0x2eefe3);}return _0x2eefe3;});}return null;};}function removeEntity(_0x4bdb80,_0x2beff6){return function(_0x34631d){if(_0x34631d){return _0x34631d[_0x6676('0x2b')]({'transaction':_0x2beff6})['then'](function(){var _0x24819c=_0x34631d[_0x6676('0x2c')]({'plain':!![]});if(_0x24819c[_0x6676('0x28')]==='admin')return;var _0x13064d=[{'name':_0x6676('0x2d'),'value':_0x6676('0x2e'),'ignore':!![]},{'name':_0x6676('0x2f'),'value':_0x6676('0x29'),'ignore':![]},{'name':_0x6676('0x30'),'value':'telephone','ignore':![]}];var _0x19aca9=_(_0x13064d)['filter'](_0x6676('0x31'))['map'](_0x6676('0x32'))[_0x6676('0x32')]();if(_[_0x6676('0x33')](_0x19aca9,_0x24819c[_0x6676('0x28')])){return;}var _0x5270c2=_[_0x6676('0x34')](_0x13064d,[_0x6676('0x32'),_0x24819c['role']])[_0x6676('0x35')];return db[_0x6676('0x36')][_0x6676('0x2b')]({'where':{'type':_0x5270c2,'resourceId':_0x24819c['id']},'transaction':_0x2beff6})[_0x6676('0x1e')](function(){return _0x34631d;});})['then'](function(){_0x4bdb80[_0x6676('0x19')](0xcc)[_0x6676('0x14')]();});}};}function handleEntityNotFound(_0x53ac27){return function(_0x26b5c9){if(!_0x26b5c9){_0x53ac27['sendStatus'](0x194);}return _0x26b5c9;};}function handleError(_0x440833,_0x13f475){_0x13f475=_0x13f475||0x1f4;return function(_0x1cd5f0){logger[_0x6676('0x25')](_0x1cd5f0[_0x6676('0x37')]);if(_0x1cd5f0[_0x6676('0x35')]){delete _0x1cd5f0[_0x6676('0x35')];}_0x440833[_0x6676('0x19')](_0x13f475)[_0x6676('0x38')](_0x1cd5f0);};}function getUserAttributes(){return _(db[_0x6676('0x39')]['rawAttributes'])[_0x6676('0x3a')](function(_0x25b218){return{'name':_0x25b218['fieldName'],'type':_0x25b218[_0x6676('0x3b')][_0x6676('0x3c')]};})[_0x6676('0x3d')](function(_0x195134){return![_0x6676('0x3e'),'salt',_0x6676('0x3f'),_0x6676('0x40'),'resetPasswordExpires','md5secret']['includes'](_0x195134['name']);})['value']();}exports['index']=function(_0x4b2967,_0x5a2b0d){var _0x3d354b={},_0x47456d={'count':0x0,'rows':[]};var _0x21b839=getUserAttributes();_0x3d354b=qs['getOptions'](_0x21b839,_0x4b2967);var _0x580d21={'where':_0x3d354b[_0x6676('0x41')]};return db['User']['count'](_0x580d21)['then'](function(_0x4ebcb4){_0x47456d[_0x6676('0x18')]=_0x4ebcb4;if(_0x4b2967[_0x6676('0x42')][_0x6676('0x43')]){_0x3d354b[_0x6676('0x44')]=[{'all':!![]}];}if(_0x4b2967[_0x6676('0x42')]['userSetting']==='true'){_0x3d354b['include']=[{'model':db[_0x6676('0x45')],'as':'userSetting'}];}if(!_[_0x6676('0x33')](_0x3d354b[_0x6676('0x46')],'id')){_0x3d354b[_0x6676('0x46')][_0x6676('0x47')]('id');}return db['User'][_0x6676('0x48')](_0x3d354b);})[_0x6676('0x1e')](function(_0x9ae400){_0x47456d['rows']=_0x9ae400;if(_0x4b2967['query'][_0x6676('0x49')]===_0x6676('0x4a')){var _0x5e97d8=[];for(var _0x466655=0x0;_0x466655<_0x47456d[_0x6676('0x4b')][_0x6676('0x4c')];_0x466655++){_0x5e97d8[_0x6676('0x47')](get_open_tabs(_0x6676('0x4d'),_0x47456d[_0x6676('0x4b')][_0x466655]['dataValues']));_0x5e97d8[_0x6676('0x47')](get_open_tabs(_0x6676('0x4e'),_0x47456d[_0x6676('0x4b')][_0x466655][_0x6676('0x4f')]));_0x5e97d8[_0x6676('0x47')](get_open_tabs(_0x6676('0x50'),_0x47456d[_0x6676('0x4b')][_0x466655][_0x6676('0x4f')]));_0x5e97d8[_0x6676('0x47')](get_open_tabs(_0x6676('0x51'),_0x47456d[_0x6676('0x4b')][_0x466655][_0x6676('0x4f')]));_0x5e97d8[_0x6676('0x47')](get_open_tabs('openchannel',_0x47456d['rows'][_0x466655][_0x6676('0x4f')]));_0x5e97d8[_0x6676('0x47')](get_open_tabs(_0x6676('0x52'),_0x47456d['rows'][_0x466655][_0x6676('0x4f')]));}return Promise['all'](_0x5e97d8)[_0x6676('0x1e')](function(){return _0x47456d;});}else{return _0x47456d;}})['then'](respondWithFilteredResult(_0x5a2b0d,_0x3d354b))[_0x6676('0x53')](handleError(_0x5a2b0d,null));};exports[_0x6676('0x54')]=function(_0x13d091,_0x6bb32e){var _0x156cf9=getUserAttributes();_0x13d091[_0x6676('0x42')]['id']=_0x13d091[_0x6676('0x55')]['id'];var _0x4c5b87=qs['getOptions'](_0x156cf9,_0x13d091);if(_0x13d091['query'][_0x6676('0x43')]){_0x4c5b87[_0x6676('0x44')]=[{'all':!![]}];}if(_0x13d091[_0x6676('0x42')][_0x6676('0x56')]===_0x6676('0x4a')){_0x4c5b87['include']=[{'model':db['UserSetting'],'as':'userSetting'}];}_0x4c5b87=_[_0x6676('0x57')]({},_0x4c5b87,_0x13d091[_0x6676('0x58')]);if(!_['includes'](_0x4c5b87[_0x6676('0x46')],'id')){_0x4c5b87[_0x6676('0x46')][_0x6676('0x47')]('id');}return db[_0x6676('0x39')][_0x6676('0x34')](_0x4c5b87)['then'](handleEntityNotFound(_0x6bb32e,null))['then'](function(_0x2be8fc){var _0x2152ad=[];values=_0x2be8fc;if(_0x13d091[_0x6676('0x42')][_0x6676('0x49')]===_0x6676('0x4a')){_0x2152ad[_0x6676('0x47')](get_open_tabs(_0x6676('0x4d'),_0x2be8fc[_0x6676('0x4f')]));_0x2152ad[_0x6676('0x47')](get_open_tabs('sms',_0x2be8fc[_0x6676('0x4f')]));_0x2152ad[_0x6676('0x47')](get_open_tabs('openchannel',_0x2be8fc[_0x6676('0x4f')]));_0x2152ad[_0x6676('0x47')](get_open_tabs(_0x6676('0x52'),_0x2be8fc[_0x6676('0x4f')]));_0x2152ad['push'](get_open_tabs(_0x6676('0x50'),_0x2be8fc[_0x6676('0x4f')]));_0x2152ad[_0x6676('0x47')](get_open_tabs(_0x6676('0x51'),_0x2be8fc['dataValues']));return Promise[_0x6676('0x59')](_0x2152ad);}else{return values;}})[_0x6676('0x1e')](function(){return values;})['then'](respondWithResult(_0x6bb32e,null))[_0x6676('0x53')](handleError(_0x6bb32e,null));};exports['update']=function(_0x4d044f,_0x3dd5b9){if(_0x4d044f[_0x6676('0x5a')]['id']){delete _0x4d044f['body']['id'];}delete _0x4d044f[_0x6676('0x5a')][_0x6676('0x28')];return db[_0x6676('0x39')][_0x6676('0x34')]({'where':{'id':_0x4d044f[_0x6676('0x55')]['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x3dd5b9,null))[_0x6676('0x1e')](saveUpdates(_0x4d044f[_0x6676('0x5a')],null))['then'](respondWithResult(_0x3dd5b9,null))['catch'](handleError(_0x3dd5b9,null));};exports[_0x6676('0x5b')]=function(_0x1cb17a,_0x58faea){return db[_0x6676('0x39')][_0x6676('0x5b')]()[_0x6676('0x1e')](respondWithResult(_0x58faea,null))[_0x6676('0x53')](handleError(_0x58faea,null));};exports[_0x6676('0x5c')]=function(_0x5c0a55,_0x11af95){return db[_0x6676('0x39')][_0x6676('0x34')]({'where':{'id':_0x5c0a55[_0x6676('0x55')]['id']}})['then'](handleEntityNotFound(_0x11af95,null))[_0x6676('0x1e')](function(_0xe7cb45){if(_0xe7cb45){return _0xe7cb45[_0x6676('0x5c')](_0x5c0a55[_0x6676('0x5a')][_0x6676('0x5d')],_[_0x6676('0x5e')](_0x5c0a55[_0x6676('0x5a')],[_0x6676('0x5d'),'id'])||{});}})['then'](respondWithResult(_0x11af95,null))[_0x6676('0x53')](handleError(_0x11af95,null));};function validateUser(_0x150098){return new Promise(function(_0x1d9b8e,_0x209fbd){if(_0x150098[_0x6676('0x5f')])return _0x1d9b8e(_0x150098);return db[_0x6676('0x60')][_0x6676('0x61')](0x1)[_0x6676('0x1e')](function(_0x5f13e5){if(_0x5f13e5[_0x6676('0x62')])authService[_0x6676('0x63')](_0x150098['password']);db[_0x6676('0x39')][_0x6676('0x64')](_0x6676('0x5f'))[_0x6676('0x1e')](function(_0x4fe138){if(_[_0x6676('0x65')](_0x4fe138)){_0x150098['internal']=_0x5f13e5[_0x6676('0x66')]||0x1;return;}if(_[_0x6676('0x65')](_0x5f13e5[_0x6676('0x66')])||_0x5f13e5[_0x6676('0x66')]===_0x4fe138){_0x150098[_0x6676('0x5f')]=_0x4fe138+0x1;return;}if(_0x5f13e5['min_internal']>_0x4fe138){_0x150098[_0x6676('0x5f')]=_0x5f13e5[_0x6676('0x66')];return;}return db[_0x6676('0x67')]['query'](_0x6676('0x68'),{'type':db[_0x6676('0x67')][_0x6676('0x69')][_0x6676('0x6a')]})[_0x6676('0x1e')](function(_0xfffb67){if(_0xfffb67&&_0xfffb67[_0x6676('0x4c')]){for(var _0x4d48ce=0x0,_0xe770d1=_0xfffb67[_0x6676('0x4c')];_0x4d48ce<_0xe770d1&&_[_0x6676('0x65')](_0x150098[_0x6676('0x5f')]);_0x4d48ce++){if(_0x5f13e5[_0x6676('0x66')]<=_0xfffb67[_0x4d48ce][_0x6676('0x6b')]){_0x150098['internal']=_0xfffb67[_0x4d48ce][_0x6676('0x6b')];}else if(_0x5f13e5[_0x6676('0x66')]>_0xfffb67[_0x4d48ce][_0x6676('0x6b')]&&_0x5f13e5[_0x6676('0x66')]<=_0xfffb67[_0x4d48ce]['to']){_0x150098[_0x6676('0x5f')]=_0x5f13e5[_0x6676('0x66')];}}}if(_[_0x6676('0x65')](_0x150098[_0x6676('0x5f')])){_0x150098['internal']=_0x4fe138+0x1;}return _0x1d9b8e(_0x150098);});});})[_0x6676('0x53')](function(_0x34d698){_0x209fbd(_0x34d698);});});}function updateUser(_0x3d3307){return new Promise(function(_0x2cb2ad,_0xa7d5e2){try{if(_0x3d3307[_0x6676('0x6c')]){_0x3d3307[_0x6676('0x6d')]=_0x3d3307[_0x6676('0x5f')];_0x3d3307['VoiceMail']={'mailbox':_0x3d3307[_0x6676('0x5f')],'password':_0x3d3307[_0x6676('0x3e')],'fullname':_0x3d3307[_0x6676('0x6e')],'email':_0x3d3307[_0x6676('0x6f')]};}if(_0x3d3307['role']===_0x6676('0x29')){if(!_0x3d3307[_0x6676('0x70')])_0x3d3307[_0x6676('0x70')]=[_0x6676('0x71'),_0x6676('0x72'),'103',_0x6676('0x73'),_0x6676('0x74'),'104',_0x6676('0x75'),_0x6676('0x76'),_0x6676('0x77'),_0x6676('0x78'),_0x6676('0x79'),_0x6676('0x7a'),_0x6676('0x7b'),_0x6676('0x7c'),_0x6676('0x7d')];}_0x2cb2ad(_0x3d3307);}catch(_0xd1291d){_0xa7d5e2(_0xd1291d);}});}exports['create']=function(_0x1096a8,_0x470ada){if(_0x1096a8[_0x6676('0x2e')]['role']==='agent')throw new Error(_0x6676('0x7e'));if(_0x1096a8[_0x6676('0x5a')][_0x6676('0x28')]===_0x6676('0x2e')&&_0x1096a8['user'][_0x6676('0x28')]!=='admin'){throw new Error(_0x6676('0x7f'));}if(_0x1096a8[_0x6676('0x5a')]['role']===_0x6676('0x80')&&_0x1096a8[_0x6676('0x2e')][_0x6676('0x28')]!==_0x6676('0x80')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x6676('0x81')]([_0x1096a8[_0x6676('0x5a')]])['then'](function(){return validateUser(_0x1096a8[_0x6676('0x5a')]);})[_0x6676('0x1e')](function(_0x3c369e){return updateUser(_0x3c369e)[_0x6676('0x1e')](function(_0x5d72bc){if(_0x5d72bc[_0x6676('0x28')]==='admin'){_0x5d72bc[_0x6676('0x82')]=_0x1096a8[_0x6676('0x2e')][_0x6676('0x82')];delete _0x5d72bc[_0x6676('0x83')];}return _0x5d72bc;});})[_0x6676('0x1e')](function(_0x309079){return db[_0x6676('0x39')][_0x6676('0x84')](_0x309079,{'include':[{'model':db[_0x6676('0x85')],'as':'VoiceMail'}]});})[_0x6676('0x1e')](function(_0x2abd3a){if(_0x1096a8['body']['role']===_0x6676('0x2e'))return _0x2abd3a;if(_0x1096a8[_0x6676('0x2e')][_0x6676('0x28')]!==_0x6676('0x2e'))return _0x2abd3a;return db[_0x6676('0x86')][_0x6676('0x34')]({'where':{'name':_0x2abd3a[_0x6676('0x28')]===_0x6676('0x29')?_0x6676('0x2f'):_0x6676('0x30'),'userProfileId':_0x1096a8[_0x6676('0x2e')]['userProfileId']},'raw':!![]})[_0x6676('0x1e')](function(_0x730ae6){if(!_0x730ae6||_0x730ae6[_0x6676('0x87')]!=0x0)return _0x2abd3a;return db[_0x6676('0x36')][_0x6676('0x84')]({'name':_0x2abd3a[_0x6676('0x35')],'resourceId':_0x2abd3a['id'],'type':_0x730ae6['name'],'sectionId':_0x730ae6['id']},{})['then'](function(){return _0x2abd3a;});})[_0x6676('0x53')](function(_0x4ef988){logger[_0x6676('0x25')](_0x6676('0x88'),_0x4ef988);throw _0x4ef988;});})[_0x6676('0x1e')](respondWithResult(_0x470ada,0xc9))[_0x6676('0x53')](handleError(_0x470ada,null));};exports[_0x6676('0x89')]=function(_0x3a11af,_0x14f619){var _0x54c81c=_0x3a11af[_0x6676('0x5a')];var _0x8bef59=[];if(_0x3a11af['user']['role']===_0x6676('0x29'))throw new Error('Unauthorized');if(_['some'](_0x54c81c,[_0x6676('0x28'),_0x6676('0x2e')])&&_0x3a11af[_0x6676('0x2e')][_0x6676('0x28')]!=='admin'){throw new Error(_0x6676('0x7f'));}if(_[_0x6676('0x8a')](_0x54c81c,[_0x6676('0x28'),'admin'])&&_0x3a11af[_0x6676('0x2e')][_0x6676('0x28')]!=='admin'){throw new Error(_0x6676('0x8b'));}return licenseUtil[_0x6676('0x81')](_0x54c81c)[_0x6676('0x1e')](function(){return validateUser(_0x54c81c[0x0]);})['then'](function(){for(var _0x4920ac=0x1;_0x4920ac<_0x54c81c[_0x6676('0x4c')];_0x4920ac++){var _0x342324=_0x54c81c[_0x4920ac-0x1][_0x6676('0x5f')];if(!_0x54c81c[_0x4920ac][_0x6676('0x5f')])_0x54c81c[_0x4920ac][_0x6676('0x5f')]=_0x342324+0x1;_0x8bef59[_0x6676('0x47')](validateUser(_0x54c81c[_0x4920ac]));}return Promise[_0x6676('0x59')](_0x8bef59);})[_0x6676('0x1e')](function(){_0x8bef59=[];for(var _0x43750b=0x0;_0x43750b<_0x54c81c[_0x6676('0x4c')];_0x43750b++){_0x8bef59[_0x6676('0x47')](updateUser(_0x54c81c[_0x43750b]));}return Promise['all'](_0x8bef59);})[_0x6676('0x1e')](function(){_0x8bef59=_0x54c81c[_0x6676('0x3a')](function(_0x2f97a2){return db['User'][_0x6676('0x84')](_0x2f97a2,{'include':[{'model':db[_0x6676('0x85')],'as':_0x6676('0x85')}]})[_0x6676('0x1e')](function(_0x98bc96){_0x2f97a2['id']=_0x98bc96['id'];return _0x2f97a2;});});return Promise[_0x6676('0x59')](_0x8bef59);})[_0x6676('0x1e')](function(_0x333804){if(_0x3a11af[_0x6676('0x5a')][_0x6676('0x28')]===_0x6676('0x2e'))return _0x333804;if(_0x3a11af[_0x6676('0x2e')]['role']!==_0x6676('0x2e'))return _0x333804;var _0x3d20dc=_[_0x6676('0x8a')](_0x333804,function(_0x198092){return _0x198092['role']===_0x6676('0x29')||_0x198092[_0x6676('0x28')]===_0x6676('0x8c');});if(!_0x3d20dc)return _0x333804;return db[_0x6676('0x86')][_0x6676('0x48')]({'where':{'name':{'$or':[_0x6676('0x2f'),_0x6676('0x30')]},'userProfileId':_0x3a11af[_0x6676('0x2e')][_0x6676('0x83')]},'raw':!![]})[_0x6676('0x1e')](function(_0x44c80f){if(_[_0x6676('0x8d')](_0x44c80f)||!_[_0x6676('0x8a')](_0x44c80f,['autoAssociation',0x0]))return _0x333804;_0x8bef59=[];var _0x5d766e=_(_0x44c80f)[_0x6676('0x3a')](function(_0x26178e){if(_0x26178e['autoAssociation']===0x1)return;return _0x26178e[_0x6676('0x35')]===_0x6676('0x2f')?_0x6676('0x29'):_0x6676('0x8c');})['compact']()['value']();for(var _0x1ec95a=0x0;_0x1ec95a<_0x333804[_0x6676('0x4c')];_0x1ec95a++){if(!_[_0x6676('0x33')](_0x5d766e,_0x333804[_0x1ec95a][_0x6676('0x28')]))return;var _0x1b460d=_0x333804[_0x1ec95a][_0x6676('0x28')]===_0x6676('0x29')?_0x6676('0x2f'):_0x6676('0x30');_0x8bef59[_0x6676('0x47')](db[_0x6676('0x36')][_0x6676('0x84')]({'name':_0x333804[_0x1ec95a][_0x6676('0x35')],'resourceId':_0x333804[_0x1ec95a]['id'],'type':_0x1b460d,'sectionId':_[_0x6676('0x34')](_0x44c80f,[_0x6676('0x35'),_0x1b460d])['id']},{}));}return Promise[_0x6676('0x59')](_0x8bef59);});})['then'](respondWithResult(_0x14f619,0xc9))[_0x6676('0x53')](handleError(_0x14f619,null));};exports[_0x6676('0x8e')]=function(_0x1df3b7,_0x1820de){if(_0x1df3b7['body']['id']){delete _0x1df3b7[_0x6676('0x5a')]['id'];}return db[_0x6676('0x39')][_0x6676('0x34')]({'where':{'id':_0x1df3b7[_0x6676('0x55')]['id']}})['then'](function(_0x3d1548){if(!_0x3d1548)return null;if(_0x3d1548['id']===_0x1df3b7[_0x6676('0x2e')]['id']){if(!_0x1df3b7[_0x6676('0x5a')][_0x6676('0x8f')]||!_0x1df3b7[_0x6676('0x5a')][_0x6676('0x90')]){throw new db[(_0x6676('0x91'))][(_0x6676('0x92'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x3d1548['authenticate'](_0x1df3b7[_0x6676('0x5a')]['oldPassword'])){throw new db[(_0x6676('0x91'))]['ValidationError'](_0x6676('0x93'));}if(_0x1df3b7[_0x6676('0x5a')]['oldPassword']===_0x1df3b7[_0x6676('0x5a')]['newPassword']){throw new db[(_0x6676('0x91'))]['ValidationError'](_0x6676('0x94'));}}else if(_0x1df3b7[_0x6676('0x2e')][_0x6676('0x28')]===_0x6676('0x80')){if(!_0x1df3b7[_0x6676('0x5a')][_0x6676('0x90')]){throw new db[(_0x6676('0x91'))][(_0x6676('0x92'))](_0x6676('0x95'));}}else if(_0x1df3b7[_0x6676('0x2e')][_0x6676('0x28')]==='user'){if(!_0x1df3b7[_0x6676('0x5a')]['newPassword']){throw new db[(_0x6676('0x91'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x3d1548['role']!=='agent'){throw new db[(_0x6676('0x91'))]['ValidationError'](_0x6676('0x7e'));}}else{throw new db['Sequelize'][(_0x6676('0x92'))](_0x6676('0x7e'));}return _0x3d1548;})[_0x6676('0x1e')](handleEntityNotFound(_0x1820de,null))[_0x6676('0x1e')](function(_0x55c03e){return db[_0x6676('0x60')][_0x6676('0x96')]({'attributes':['id',_0x6676('0x62'),_0x6676('0x97'),_0x6676('0x98')]})[_0x6676('0x1e')](function(_0x3f2dcf){if(_0x3f2dcf[_0x6676('0x62')])authService['validatePasswordPattern'](_0x1df3b7[_0x6676('0x5a')]['newPassword']);if(!_0x3f2dcf[_0x6676('0x97')]||!_0x55c03e[_0x6676('0x3f')])return _0x55c03e;authService[_0x6676('0x99')](_0x1df3b7[_0x6676('0x5a')]['newPassword'],_0x55c03e['previousPasswords'],_0x3f2dcf['passwordHistoryLimit']);return _0x55c03e;})['then'](saveUpdates({'password':_0x1df3b7[_0x6676('0x5a')][_0x6676('0x90')],'passwordResetAt':_0x1df3b7[_0x6676('0x2e')]['id']==_0x1df3b7[_0x6676('0x55')]['id']?moment():null,'previousPasswords':authService[_0x6676('0x9a')](_0x1df3b7[_0x6676('0x5a')][_0x6676('0x90')],_0x55c03e[_0x6676('0x3f')])},null));})[_0x6676('0x1e')](respondWithResult(_0x1820de,null))[_0x6676('0x53')](handleError(_0x1820de,null));};exports[_0x6676('0x9b')]=function(_0x55da68,_0x32fe0c){var _0x17f157=_0x55da68[_0x6676('0x5a')]['channel'];return db[_0x6676('0x39')][_0x6676('0x34')]({'where':{'id':_0x55da68[_0x6676('0x55')]['id']},'attributes':['id',_0x6676('0x35'),_0x6676('0x28'),_0x6676('0x9c'),_0x6676('0x9d'),_0x6676('0x9e'),_0x6676('0x9f')]})[_0x6676('0x1e')](handleEntityNotFound(_0x32fe0c,null))[_0x6676('0x1e')](function(_0xaaece1){if(_0xaaece1){if(!utils[_0x6676('0xa0')](_0x17f157)){throw new db['Sequelize'][(_0x6676('0x92'))](_0x6676('0xa1'));}return _0xaaece1['add'+_[_0x6676('0xa2')](_0x17f157[_0x6676('0xa3')]())+_0x6676('0xa4')](_0x55da68[_0x6676('0x5a')]['ids'],{'penalty':_0x55da68[_0x6676('0x5a')][_0x6676('0xa5')]||0x0})['spread'](function(_0x2618b1){for(var _0x10979b=0x0;_0x10979b<_0x55da68[_0x6676('0x5a')][_0x6676('0x5d')][_0x6676('0x4c')];_0x10979b+=0x1){var _0x1d9aff={'UserId':Number(_0x55da68['params']['id'])};_0x1d9aff[_[_0x6676('0xa2')](_0x17f157[_0x6676('0xa3')]())+'QueueId']=Number(_0x55da68[_0x6676('0x5a')][_0x6676('0x5d')][_0x10979b]);socket[_0x6676('0x2a')](_0x6676('0x2e')+_['capitalize'](_0x17f157[_0x6676('0xa3')]())+_0x6676('0xa6'),_0x1d9aff);}return _0x2618b1;})[_0x6676('0x1e')](function(){if(_0x17f157===_0x6676('0xa7')){return db[_0x6676('0xa8')][_0x6676('0x48')]({'where':{'id':_0x55da68['body'][_0x6676('0x5d')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x6676('0x1e')](function(_0x51d3a6){var _0x599ecd=_0xaaece1[_0x6676('0x2c')]({'plain':!![]});var _0x5aaaec=[];if(_0x17f157==='voice'&&_0x599ecd[_0x6676('0x28')]===_0x6676('0x29')&&_0x599ecd[_0x6676('0x9c')]){for(let _0x10fc89=0x0;_0x10fc89<_0x51d3a6[_0x6676('0x4c')];_0x10fc89+=0x1){_0x5aaaec['push']({'membername':_0x599ecd[_0x6676('0x35')],'UserId':_0x599ecd['id'],'queue_name':_0x51d3a6[_0x10fc89][_0x6676('0x35')],'VoiceQueueId':_0x51d3a6[_0x10fc89]['id'],'interface':_['isNil'](_0x599ecd[_0x6676('0x9f')])?util[_0x6676('0xa9')]('SIP/%s',_0x599ecd[_0x6676('0x35')]):_0x599ecd[_0x6676('0x9f')],'paused':_0x599ecd[_0x6676('0x9e')]||![],'penalty':_0x55da68[_0x6676('0x5a')]['penalty']||0x0});}return Promise['all'](_0x5aaaec['map'](function(_0x67615d){return db[_0x6676('0xaa')][_0x6676('0xab')](_0x67615d);}));}return _0xaaece1;});}})[_0x6676('0x1e')](respondWithStatusCode(_0x32fe0c,null))['catch'](handleError(_0x32fe0c,null));};exports[_0x6676('0xac')]=function(_0x437fc4,_0x2429da){var _0x286643,_0x2a2663;return db['User']['find']({'where':{'id':_0x437fc4[_0x6676('0x55')]['id']},'attributes':['id','name',_0x6676('0x28')]})[_0x6676('0x1e')](handleEntityNotFound(_0x2429da,null))['then'](function(_0x584f79){if(_0x584f79){_0x286643=_0x584f79;if(!_0x437fc4[_0x6676('0x42')][_0x6676('0xad')]||!utils[_0x6676('0xa0')](_0x437fc4[_0x6676('0x42')][_0x6676('0xad')])){throw new db[(_0x6676('0x91'))][(_0x6676('0x92'))]('Unknown\x20channel');}return _0x584f79[_0x6676('0xae')+_[_0x6676('0xa2')](_0x437fc4[_0x6676('0x42')][_0x6676('0xad')][_0x6676('0xa3')]())+_0x6676('0xa4')](_0x437fc4[_0x6676('0x42')][_0x6676('0x5d')]);}})[_0x6676('0x1e')](function(_0x928260){if(_['isArray'](_0x437fc4['query'][_0x6676('0x5d')])){for(var _0xc80eea=0x0;_0xc80eea<_0x437fc4[_0x6676('0x42')][_0x6676('0x5d')][_0x6676('0x4c')];_0xc80eea+=0x1){_0x2a2663={'UserId':Number(_0x437fc4[_0x6676('0x55')]['id'])};_0x2a2663[_[_0x6676('0xa2')](_0x437fc4[_0x6676('0x42')]['channel'][_0x6676('0xa3')]())+'QueueId']=Number(_0x437fc4['query'][_0x6676('0x5d')][_0xc80eea]);socket[_0x6676('0x2a')](_0x6676('0x2e')+_['capitalize'](_0x437fc4[_0x6676('0x42')][_0x6676('0xad')][_0x6676('0xa3')]())+'Queue:remove',_0x2a2663);}}else{_0x2a2663={'UserId':Number(_0x437fc4['params']['id'])};_0x2a2663[_[_0x6676('0xa2')](_0x437fc4['query'][_0x6676('0xad')][_0x6676('0xa3')]())+_0x6676('0xaf')]=Number(_0x437fc4[_0x6676('0x42')][_0x6676('0x5d')]);socket['emit'](_0x6676('0x2e')+_[_0x6676('0xa2')](_0x437fc4[_0x6676('0x42')][_0x6676('0xad')][_0x6676('0xa3')]())+_0x6676('0xb0'),_0x2a2663);}return _0x928260;})[_0x6676('0x1e')](function(){if(_0x437fc4[_0x6676('0x42')][_0x6676('0xad')]===_0x6676('0xa7')){return db['UserVoiceQueueRt'][_0x6676('0x2b')]({'where':{'UserId':_0x437fc4['params']['id'],'VoiceQueueId':_0x437fc4['query']['ids']},'individualHooks':!![]})['then'](function(){return _0x286643;});}return _0x286643;})['then'](respondWithStatusCode(_0x2429da,null))['catch'](handleError(_0x2429da,null));};exports[_0x6676('0xb1')]=function(_0x1e4ab3,_0x308af2){_0x1e4ab3[_0x6676('0x5a')][_0x6676('0xb2')]=_0x1e4ab3[_0x6676('0xb3')][_0x6676('0xb4')];return db[_0x6676('0x39')][_0x6676('0x34')]({'where':{'id':_0x1e4ab3[_0x6676('0x55')]['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x308af2,null))[_0x6676('0x1e')](saveUpdates(_0x1e4ab3['body'],null))[_0x6676('0x1e')](respondWithResult(_0x308af2,null))[_0x6676('0x53')](handleError(_0x308af2,null));};exports[_0x6676('0xb5')]=function(_0x515db5,_0x491e37){var _0x387839=path[_0x6676('0xb6')](config['root'],'server/files/images/logos/default_profile.png');return db[_0x6676('0x39')][_0x6676('0x34')]({'where':{'id':_0x515db5[_0x6676('0x55')]['id']},'attributes':['id',_0x6676('0xb2')],'raw':!![]})[_0x6676('0x1e')](handleEntityNotFound(_0x491e37,null))[_0x6676('0x1e')](function(_0x4785b5){if(_0x4785b5){if(_[_0x6676('0x65')](_0x4785b5[_0x6676('0xb2')])){return _0x491e37[_0x6676('0xb7')](_0x387839);}else{if(!fs['existsSync'](path[_0x6676('0xb6')](config[_0x6676('0xb8')],_0x6676('0xb9'),_0x4785b5[_0x6676('0xb2')]))){return _0x491e37['download'](_0x387839);}return _0x491e37[_0x6676('0xb7')](path[_0x6676('0xb6')](config[_0x6676('0xb8')],_0x6676('0xb9'),_0x4785b5[_0x6676('0xb2')]));}}})[_0x6676('0x53')](handleError(_0x491e37,null));};exports['getOpenTabs']=function(_0x1e6989,_0x3c296f){return db[_0x6676('0x39')][_0x6676('0x34')]({'where':{'id':_0x1e6989[_0x6676('0x55')]['id']},'attributes':['id']})[_0x6676('0x1e')](handleEntityNotFound(_0x3c296f,null))['then'](function(_0x10c246){var _0x43fae4=[];values=_0x10c246['dataValues'];_0x43fae4[_0x6676('0x47')](get_open_tabs(_0x6676('0x4d'),_0x10c246[_0x6676('0x4f')]));_0x43fae4['push'](get_open_tabs(_0x6676('0x4e'),_0x10c246[_0x6676('0x4f')]));_0x43fae4[_0x6676('0x47')](get_open_tabs('openchannel',_0x10c246[_0x6676('0x4f')]));_0x43fae4['push'](get_open_tabs('whatsapp',_0x10c246[_0x6676('0x4f')]));_0x43fae4[_0x6676('0x47')](get_open_tabs(_0x6676('0x50'),_0x10c246['dataValues']));_0x43fae4[_0x6676('0x47')](get_open_tabs(_0x6676('0x51'),_0x10c246[_0x6676('0x4f')]));return Promise[_0x6676('0x59')](_0x43fae4);})[_0x6676('0x1e')](function(_0x3e0a87){if(_0x3e0a87){var _0x51336b=_[_0x6676('0x3a')](values[_0x6676('0xba')],function(_0x5e60bb){return{'channel':'CHAT','id':_0x5e60bb['id'],'createdAt':_0x5e60bb['createdAt']};});var _0x55b464=_[_0x6676('0x3a')](values[_0x6676('0xbb')],function(_0x29eca3){return{'channel':_0x6676('0xbc'),'id':_0x29eca3['id'],'createdAt':_0x29eca3[_0x6676('0xbd')]};});var _0x33acd2=_[_0x6676('0x3a')](values['OpenchannelOpenTabs'],function(_0x8a279){return{'channel':_0x6676('0xbe'),'id':_0x8a279['id'],'createdAt':_0x8a279['createdAt']};});var _0x3e960d=_[_0x6676('0x3a')](values['MailOpenTabs'],function(_0x25ac4a){return{'channel':_0x6676('0xbf'),'id':_0x25ac4a['id'],'createdAt':_0x25ac4a[_0x6676('0xbd')]};});var _0x4ce9c8=_[_0x6676('0x3a')](values[_0x6676('0xc0')],function(_0x9e0af3){return{'channel':_0x6676('0xc1'),'id':_0x9e0af3['id'],'createdAt':_0x9e0af3[_0x6676('0xbd')]};});var _0x569089=_[_0x6676('0x3a')](values['WhatsappOpenTabs'],function(_0x5c8cd7){return{'channel':'WHATSAPP','id':_0x5c8cd7['id'],'createdAt':_0x5c8cd7[_0x6676('0xbd')]};});var _0x9e5fc7=_[_0x6676('0xc2')](_0x51336b,_0x55b464,_0x33acd2,_0x3e960d,_0x4ce9c8,_0x569089);var _0x2bae4c={'count':_0x9e5fc7[_0x6676('0x4c')],'rows':_0x9e5fc7};return _0x2bae4c;}else return null;})[_0x6676('0x1e')](respondWithResult(_0x3c296f,null))[_0x6676('0x53')](handleError(_0x3c296f,null));};exports[_0x6676('0xc3')]=function(_0xf9ab97,_0x1b2143){var _0x46070b={};return db[_0x6676('0x39')]['findOne']({'where':{'id':_0xf9ab97[_0x6676('0x55')]['id']}})['then'](function(_0x2a299c){if(!_0x2a299c){throw new APINotFoundError(util['format'](_0x6676('0xc4'),_0xf9ab97[_0x6676('0x55')]['id']));}return contacts[_0x6676('0x5b')]();})[_0x6676('0x1e')](function(_0x3394c4){_0xf9ab97[_0x6676('0x42')][_0x6676('0x39')]=_0xf9ab97[_0x6676('0x55')]['id'];_0x46070b=qs['getOptions'](_0x3394c4,_0xf9ab97);if(_0xf9ab97[_0x6676('0x42')][_0x6676('0xc5')](_0x6676('0x43'))){_0x46070b[_0x6676('0x44')]=[{'model':db[_0x6676('0xc6')],'as':_0x6676('0xc7'),'required':![]},{'model':db[_0x6676('0xc8')],'as':_0x6676('0xc9'),'attributes':['id',_0x6676('0x35'),_0x6676('0xca')],'where':_0xf9ab97[_0x6676('0x42')][_0x6676('0xcb')]?{'id':_0xf9ab97[_0x6676('0x42')][_0x6676('0xcb')]}:undefined,'required':_0xf9ab97[_0x6676('0x42')][_0x6676('0xcb')]?!![]:![]}];}return contacts[_0x6676('0x48')](_0xf9ab97[_0x6676('0x42')],_0xf9ab97[_0x6676('0x2e')],_0x46070b,_0x3394c4);})[_0x6676('0x1e')](respondWithFilteredResult(_0x1b2143,_0x46070b))['catch'](APIHandleError(_0x1b2143));};exports[_0x6676('0xcc')]=function(_0x3e0677,_0x27132c){var _0x4a3430;var _0x55e262={};var _0x42bea8;return db[_0x6676('0x39')][_0x6676('0x96')]({'where':{'id':_0x3e0677[_0x6676('0x55')]['id']},'attributes':['id',_0x6676('0x35'),_0x6676('0x28')]})[_0x6676('0x1e')](handleEntityNotFound(_0x27132c,null))['then'](function(_0x1da7f3){if(!utils['isValidChannel'](_0x3e0677[_0x6676('0x42')][_0x6676('0xad')])){throw new db[(_0x6676('0x91'))][(_0x6676('0x92'))]('Unknown\x20channel');}_0x4a3430=_0x1da7f3;var _0x42c0c7={};_0x42c0c7[_0x6676('0xcd')]=_['keys'](db[_[_0x6676('0xa2')](_0x3e0677['query']['channel'])+'Queue'][_0x6676('0xce')]);_0x42c0c7[_0x6676('0x42')]=_[_0x6676('0xcf')](_0x3e0677[_0x6676('0x42')]);_0x42c0c7['filters']=_[_0x6676('0xd0')](_0x42c0c7[_0x6676('0xcd')],_0x42c0c7[_0x6676('0x42')]);_0x55e262['attributes']=_[_0x6676('0xd0')](_0x42c0c7[_0x6676('0xcd')],qs[_0x6676('0xd1')](_0x3e0677[_0x6676('0x42')][_0x6676('0xd1')]));_0x55e262['attributes']=_0x55e262[_0x6676('0x46')]['length']?_0x55e262['attributes']:_0x42c0c7[_0x6676('0xcd')];_0x55e262['order']=qs[_0x6676('0xd2')](_0x3e0677[_0x6676('0x42')]['sort']);_0x55e262[_0x6676('0x41')]=qs['filters'](_[_0x6676('0xd3')](_0x3e0677['query'],_0x42c0c7[_0x6676('0xd4')]));if(_0x3e0677[_0x6676('0x42')][_0x6676('0x3d')]){_0x55e262[_0x6676('0x41')]=_[_0x6676('0x57')](_0x55e262['where'],{'$or':_['map'](_0x55e262[_0x6676('0x46')],function(_0x2e0b2a){var _0x3d5cca={};_0x3d5cca[_0x2e0b2a]={'$like':'%'+_0x3e0677[_0x6676('0x42')]['filter']+'%'};return _0x3d5cca;})});}_0x55e262=_['merge']({},_0x55e262,_0x3e0677[_0x6676('0x58')]);switch(_0x4a3430['role']){case'admin':return db[_[_0x6676('0xa2')](_0x3e0677[_0x6676('0x42')]['channel'])+_0x6676('0xd5')][_0x6676('0x48')](_0x55e262);case _0x6676('0x2e'):case _0x6676('0x29'):return _0x4a3430[_0x6676('0x2c')+_[_0x6676('0xa2')](_0x3e0677[_0x6676('0x42')]['channel'])+'Queues'](_0x55e262);default:throw new db[(_0x6676('0x91'))]['ValidationError'](_0x6676('0xd6'));}})['then'](function(_0x55cdb7){_0x42bea8=_0x55cdb7[_0x6676('0x4c')];if(!_0x3e0677[_0x6676('0x42')][_0x6676('0xc5')](_0x6676('0xd7'))){_0x55e262[_0x6676('0x17')]=qs['limit'](_0x3e0677['query'][_0x6676('0x17')]);_0x55e262['offset']=qs['offset'](_0x3e0677['query']['offset']);}switch(_0x4a3430[_0x6676('0x28')]){case _0x6676('0x80'):return db[_[_0x6676('0xa2')](_0x3e0677[_0x6676('0x42')][_0x6676('0xad')])+'Queue'][_0x6676('0x48')](_0x55e262);case _0x6676('0x2e'):case'agent':return _0x4a3430[_0x6676('0x2c')+_[_0x6676('0xa2')](_0x3e0677['query'][_0x6676('0xad')])+_0x6676('0xa4')](_0x55e262);}})['then'](function(_0x26b20f){return{'count':_0x42bea8,'rows':_0x26b20f};})['then'](respondWithResult(_0x27132c,null))[_0x6676('0x53')](handleError(_0x27132c,null));};exports[_0x6676('0xd8')]=function(_0xffefdc,_0x1e74da){var _0x2b7c28={};var _0x1c2019={};var _0x4b6a78;var _0x371f63;return db[_0x6676('0x39')][_0x6676('0x96')]({'where':{'id':_0xffefdc[_0x6676('0x55')]['id']}})['then'](handleEntityNotFound(_0x1e74da,null))[_0x6676('0x1e')](function(_0x4ef33e){if(_0x4ef33e){_0x4b6a78=_0x4ef33e;_0x1c2019[_0x6676('0xcd')]=_['keys'](db[_0x6676('0xaa')][_0x6676('0xce')]);_0x1c2019[_0x6676('0x42')]=_['keys'](_0xffefdc[_0x6676('0x42')]);_0x1c2019[_0x6676('0xd4')]=_[_0x6676('0xd0')](_0x1c2019[_0x6676('0xcd')],_0x1c2019[_0x6676('0x42')]);_0x2b7c28['attributes']=_[_0x6676('0xd0')](_0x1c2019[_0x6676('0xcd')],qs[_0x6676('0xd1')](_0xffefdc[_0x6676('0x42')][_0x6676('0xd1')]));_0x2b7c28[_0x6676('0x46')]=_0x2b7c28[_0x6676('0x46')][_0x6676('0x4c')]?_0x2b7c28[_0x6676('0x46')]:_0x1c2019[_0x6676('0xcd')];_0x2b7c28['order']=qs['sort'](_0xffefdc['query'][_0x6676('0xd2')]);_0x2b7c28['where']=qs[_0x6676('0xd4')](_[_0x6676('0xd3')](_0xffefdc[_0x6676('0x42')],_0x1c2019[_0x6676('0xd4')]));if(_0xffefdc[_0x6676('0x42')]['filter']){_0x2b7c28[_0x6676('0x41')]=_[_0x6676('0x57')](_0x2b7c28[_0x6676('0x41')],{'$or':_[_0x6676('0x3a')](_0x2b7c28[_0x6676('0x46')],function(_0x3c5c32){var _0x1b5d6b={};_0x1b5d6b[_0x3c5c32]={'$like':'%'+_0xffefdc[_0x6676('0x42')][_0x6676('0x3d')]+'%'};return _0x1b5d6b;})});}_0x2b7c28=_[_0x6676('0x57')]({},_0x2b7c28,_0xffefdc[_0x6676('0x58')]);return _0x4b6a78[_0x6676('0xd8')](_0x2b7c28);}})[_0x6676('0x1e')](function(_0x3e2109){if(_0x3e2109){_0x371f63=_0x3e2109[_0x6676('0x4c')];if(!_0xffefdc[_0x6676('0x42')][_0x6676('0xc5')](_0x6676('0xd7'))){_0x2b7c28[_0x6676('0x17')]=qs[_0x6676('0x17')](_0xffefdc[_0x6676('0x42')]['limit']);_0x2b7c28[_0x6676('0x15')]=qs['offset'](_0xffefdc[_0x6676('0x42')][_0x6676('0x15')]);}return _0x4b6a78['getVoiceQueuesRt'](_0x2b7c28);}})['then'](function(_0x47c364){if(_0x47c364){return _0x47c364?{'count':_0x371f63,'rows':_0x47c364}:null;}})['then'](respondWithResult(_0x1e74da,null))[_0x6676('0x53')](handleError(_0x1e74da,null));};exports[_0x6676('0xd9')]=function(_0x2d0e4f,_0x3cd0e2){var _0x358e2c={};var _0x2679ef={};var _0x5c401b;var _0x177fc3;return db[_0x6676('0x39')]['findOne']({'where':{'id':_0x2d0e4f[_0x6676('0x55')]['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x3cd0e2,null))['then'](function(_0x1cd6bf){if(_0x1cd6bf){_0x5c401b=_0x1cd6bf;_0x2679ef[_0x6676('0xcd')]=_['keys'](db[_0x6676('0xda')][_0x6676('0xce')]);_0x2679ef[_0x6676('0x42')]=_[_0x6676('0xcf')](_0x2d0e4f[_0x6676('0x42')]);_0x2679ef['filters']=_[_0x6676('0xd0')](_0x2679ef[_0x6676('0xcd')],_0x2679ef[_0x6676('0x42')]);_0x358e2c[_0x6676('0x46')]=_['intersection'](_0x2679ef[_0x6676('0xcd')],qs[_0x6676('0xd1')](_0x2d0e4f[_0x6676('0x42')]['fields']));_0x358e2c[_0x6676('0x46')]=_0x358e2c[_0x6676('0x46')][_0x6676('0x4c')]?_0x358e2c[_0x6676('0x46')]:_0x2679ef[_0x6676('0xcd')];_0x358e2c[_0x6676('0xdb')]=qs[_0x6676('0xd2')](_0x2d0e4f[_0x6676('0x42')]['sort']);_0x358e2c[_0x6676('0x41')]=qs[_0x6676('0xd4')](_[_0x6676('0xd3')](_0x2d0e4f['query'],_0x2679ef['filters']));if(_0x2d0e4f[_0x6676('0x42')][_0x6676('0x3d')]){_0x358e2c[_0x6676('0x41')]=_[_0x6676('0x57')](_0x358e2c[_0x6676('0x41')],{'$or':_['map'](_0x358e2c['attributes'],function(_0x39d3fe){var _0x1f3fc7={};_0x1f3fc7[_0x39d3fe]={'$like':'%'+_0x2d0e4f[_0x6676('0x42')][_0x6676('0x3d')]+'%'};return _0x1f3fc7;})});}_0x358e2c=_[_0x6676('0x57')]({},_0x358e2c,_0x2d0e4f['options']);return _0x5c401b[_0x6676('0xd9')](_0x358e2c);}})[_0x6676('0x1e')](function(_0x15ec77){if(_0x15ec77){_0x177fc3=_0x15ec77['length'];if(!_0x2d0e4f[_0x6676('0x42')][_0x6676('0xc5')](_0x6676('0xd7'))){_0x358e2c[_0x6676('0x17')]=qs['limit'](_0x2d0e4f[_0x6676('0x42')][_0x6676('0x17')]);_0x358e2c[_0x6676('0x15')]=qs['offset'](_0x2d0e4f[_0x6676('0x42')]['offset']);}return _0x5c401b[_0x6676('0xd9')](_0x358e2c);}})[_0x6676('0x1e')](function(_0xeca8a2){if(_0xeca8a2){return _0xeca8a2?{'count':_0x177fc3,'rows':_0xeca8a2}:null;}})[_0x6676('0x1e')](respondWithResult(_0x3cd0e2,null))[_0x6676('0x53')](handleError(_0x3cd0e2,null));};exports[_0x6676('0xdc')]=function(_0x12c0c9,_0xcfc5b2){var _0xb6cf85={'raw':!![],'where':{}};var _0x5cca27={};var _0x33c0e0={'count':0x0,'rows':[]};return db[_0x6676('0x39')][_0x6676('0x96')]({'where':{'id':_0x12c0c9[_0x6676('0x55')]['id']}})['then'](handleEntityNotFound(_0xcfc5b2,null))[_0x6676('0x1e')](function(_0x14f57f){if(_0x14f57f){_0x5cca27[_0x6676('0xcd')]=_[_0x6676('0xcf')](db[_0x6676('0xdd')]['rawAttributes']);_0x5cca27[_0x6676('0x42')]=_[_0x6676('0xcf')](_0x12c0c9[_0x6676('0x42')]);_0x5cca27[_0x6676('0xd4')]=_[_0x6676('0xd0')](_0x5cca27[_0x6676('0xcd')],_0x5cca27[_0x6676('0x42')]);_0xb6cf85[_0x6676('0x46')]=_[_0x6676('0xd0')](_0x5cca27['model'],qs[_0x6676('0xd1')](_0x12c0c9[_0x6676('0x42')][_0x6676('0xd1')]));_0xb6cf85[_0x6676('0x46')]=_0xb6cf85[_0x6676('0x46')][_0x6676('0x4c')]?_0xb6cf85[_0x6676('0x46')]:_0x5cca27['model'];if(!_0x12c0c9[_0x6676('0x42')][_0x6676('0xc5')](_0x6676('0xd7'))){_0xb6cf85[_0x6676('0x17')]=qs[_0x6676('0x17')](_0x12c0c9[_0x6676('0x42')]['limit']);_0xb6cf85[_0x6676('0x15')]=qs['offset'](_0x12c0c9[_0x6676('0x42')][_0x6676('0x15')]);}_0xb6cf85['order']=qs[_0x6676('0xd2')](_0x12c0c9[_0x6676('0x42')][_0x6676('0xd2')]);_0xb6cf85[_0x6676('0x41')]=qs[_0x6676('0xd4')](_[_0x6676('0xd3')](_0x12c0c9['query'],_0x5cca27[_0x6676('0xd4')]));_0xb6cf85[_0x6676('0x41')][_0x6676('0xde')]=_0x14f57f['id'];if(_0x12c0c9['query'][_0x6676('0x3d')]){_0xb6cf85[_0x6676('0x41')]=_[_0x6676('0x57')](_0xb6cf85['where'],{'$or':_[_0x6676('0x3a')](_0xb6cf85[_0x6676('0x46')],function(_0x26cd40){var _0x40db3b={};_0x40db3b[_0x26cd40]={'$like':'%'+_0x12c0c9[_0x6676('0x42')][_0x6676('0x3d')]+'%'};return _0x40db3b;})});}_0xb6cf85=_[_0x6676('0x57')]({},_0xb6cf85,_0x12c0c9[_0x6676('0x58')]);return db[_0x6676('0xdd')][_0x6676('0x18')]({'where':_0xb6cf85[_0x6676('0x41')]})[_0x6676('0x1e')](function(_0x54b0ad){_0x33c0e0[_0x6676('0x18')]=_0x54b0ad;if(_0x12c0c9[_0x6676('0x42')][_0x6676('0x43')]){_0xb6cf85[_0x6676('0x44')]=[{'all':!![]}];}return db[_0x6676('0xdd')]['findAll'](_0xb6cf85);})[_0x6676('0x1e')](function(_0x4f3d27){_0x33c0e0[_0x6676('0x4b')]=_0x4f3d27;return _0x33c0e0;});}})[_0x6676('0x1e')](respondWithFilteredResult(_0xcfc5b2,_0xb6cf85))[_0x6676('0x53')](handleError(_0xcfc5b2,null));};exports[_0x6676('0xdf')]=function(_0xff17d2,_0x25f8bf){var _0x22d190={'raw':!![],'where':{}};var _0x48ffa8={};var _0x181943={'count':0x0,'rows':[]};return db[_0x6676('0x39')]['findOne']({'where':{'id':_0xff17d2[_0x6676('0x55')]['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x25f8bf,null))[_0x6676('0x1e')](function(_0x49039c){if(_0x49039c){_0x48ffa8[_0x6676('0xcd')]=_[_0x6676('0xcf')](db[_0x6676('0xe0')]['rawAttributes']);_0x48ffa8[_0x6676('0x42')]=_['keys'](_0xff17d2[_0x6676('0x42')]);_0x48ffa8[_0x6676('0xd4')]=_[_0x6676('0xd0')](_0x48ffa8[_0x6676('0xcd')],_0x48ffa8['query']);_0x22d190[_0x6676('0x46')]=_[_0x6676('0xd0')](_0x48ffa8['model'],qs[_0x6676('0xd1')](_0xff17d2[_0x6676('0x42')][_0x6676('0xd1')]));_0x22d190['attributes']=_0x22d190[_0x6676('0x46')][_0x6676('0x4c')]?_0x22d190[_0x6676('0x46')]:_0x48ffa8[_0x6676('0xcd')];if(!_0xff17d2[_0x6676('0x42')][_0x6676('0xc5')]('nolimit')){_0x22d190[_0x6676('0x17')]=qs[_0x6676('0x17')](_0xff17d2['query'][_0x6676('0x17')]);_0x22d190[_0x6676('0x15')]=qs[_0x6676('0x15')](_0xff17d2[_0x6676('0x42')][_0x6676('0x15')]);}_0x22d190['order']=qs[_0x6676('0xd2')](_0xff17d2['query']['sort']);_0x22d190[_0x6676('0x41')]=qs[_0x6676('0xd4')](_['pick'](_0xff17d2['query'],_0x48ffa8[_0x6676('0xd4')]));_0x22d190[_0x6676('0x41')][_0x6676('0xde')]=_0x49039c['id'];if(_0xff17d2[_0x6676('0x42')][_0x6676('0x3d')]){_0x22d190['where']=_[_0x6676('0x57')](_0x22d190[_0x6676('0x41')],{'$or':_[_0x6676('0x3a')](_0x22d190[_0x6676('0x46')],function(_0x1db138){var _0x47dd47={};_0x47dd47[_0x1db138]={'$like':'%'+_0xff17d2[_0x6676('0x42')][_0x6676('0x3d')]+'%'};return _0x47dd47;})});}_0x22d190=_[_0x6676('0x57')]({},_0x22d190,_0xff17d2[_0x6676('0x58')]);return db[_0x6676('0xe0')][_0x6676('0x18')]({'where':_0x22d190[_0x6676('0x41')]})[_0x6676('0x1e')](function(_0x4fadd8){_0x181943['count']=_0x4fadd8;if(_0xff17d2[_0x6676('0x42')]['includeAll']){_0x22d190[_0x6676('0x44')]=[{'all':!![]}];}return db['ScreenRecording'][_0x6676('0x48')](_0x22d190);})[_0x6676('0x1e')](function(_0x483393){_0x181943[_0x6676('0x4b')]=_0x483393;return _0x181943;});}})[_0x6676('0x1e')](respondWithFilteredResult(_0x25f8bf,_0x22d190))['catch'](handleError(_0x25f8bf,null));};exports['getChatInteractions']=function(_0x5bea3f,_0x5a0bee){var _0x5bad2c={};var _0x289b13={};var _0x488fa4;var _0x313ef0;return db[_0x6676('0x39')]['findOne']({'where':{'id':_0x5bea3f[_0x6676('0x55')]['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x5a0bee,null))['then'](function(_0x795903){if(_0x795903){_0x488fa4=_0x795903;_0x289b13[_0x6676('0xcd')]=_['keys'](db[_0x6676('0xe1')][_0x6676('0xce')]);_0x289b13[_0x6676('0x42')]=_['keys'](_0x5bea3f['query']);_0x289b13['filters']=_['intersection'](_0x289b13['model'],_0x289b13[_0x6676('0x42')]);_0x5bad2c[_0x6676('0x46')]=_['intersection'](_0x289b13[_0x6676('0xcd')],qs['fields'](_0x5bea3f[_0x6676('0x42')][_0x6676('0xd1')]));_0x5bad2c['attributes']=_0x5bad2c[_0x6676('0x46')]['length']?_0x5bad2c[_0x6676('0x46')]:_0x289b13[_0x6676('0xcd')];_0x5bad2c[_0x6676('0xdb')]=qs['sort'](_0x5bea3f[_0x6676('0x42')][_0x6676('0xd2')]);_0x5bad2c[_0x6676('0x41')]=qs[_0x6676('0xd4')](_[_0x6676('0xd3')](_0x5bea3f[_0x6676('0x42')],_0x289b13[_0x6676('0xd4')]));if(_0x5bea3f['query']['filter']){_0x5bad2c[_0x6676('0x41')]=_[_0x6676('0x57')](_0x5bad2c[_0x6676('0x41')],{'$or':_[_0x6676('0x3a')](_0x5bad2c[_0x6676('0x46')],function(_0xb8af3a){var _0x2b48de={};_0x2b48de[_0xb8af3a]={'$like':'%'+_0x5bea3f['query'][_0x6676('0x3d')]+'%'};return _0x2b48de;})});}_0x5bad2c=_['merge']({},_0x5bad2c,_0x5bea3f[_0x6676('0x58')]);return _0x488fa4[_0x6676('0xe2')](_0x5bad2c);}})[_0x6676('0x1e')](function(_0x2fa88e){if(_0x2fa88e){_0x313ef0=_0x2fa88e[_0x6676('0x4c')];if(!_0x5bea3f['query']['hasOwnProperty'](_0x6676('0xd7'))){_0x5bad2c[_0x6676('0x17')]=qs[_0x6676('0x17')](_0x5bea3f[_0x6676('0x42')][_0x6676('0x17')]);_0x5bad2c[_0x6676('0x15')]=qs[_0x6676('0x15')](_0x5bea3f[_0x6676('0x42')][_0x6676('0x15')]);}return _0x488fa4['getChatInteractions'](_0x5bad2c);}})['then'](function(_0x4d1d5){if(_0x4d1d5){return _0x4d1d5?{'count':_0x313ef0,'rows':_0x4d1d5}:null;}})[_0x6676('0x1e')](respondWithResult(_0x5a0bee,null))['catch'](handleError(_0x5a0bee,null));};exports['getOpenchannelInteractions']=function(_0x2a6d16,_0x264e80){var _0x4661af={};var _0x2105f4={};var _0x4c091e;var _0x43ee5a;return db['User'][_0x6676('0x96')]({'where':{'id':_0x2a6d16[_0x6676('0x55')]['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x264e80,null))[_0x6676('0x1e')](function(_0x5b443c){if(_0x5b443c){_0x4c091e=_0x5b443c;_0x2105f4[_0x6676('0xcd')]=_[_0x6676('0xcf')](db['OpenchannelInteraction'][_0x6676('0xce')]);_0x2105f4[_0x6676('0x42')]=_[_0x6676('0xcf')](_0x2a6d16[_0x6676('0x42')]);_0x2105f4['filters']=_[_0x6676('0xd0')](_0x2105f4[_0x6676('0xcd')],_0x2105f4[_0x6676('0x42')]);_0x4661af[_0x6676('0x46')]=_['intersection'](_0x2105f4[_0x6676('0xcd')],qs[_0x6676('0xd1')](_0x2a6d16[_0x6676('0x42')][_0x6676('0xd1')]));_0x4661af[_0x6676('0x46')]=_0x4661af[_0x6676('0x46')][_0x6676('0x4c')]?_0x4661af[_0x6676('0x46')]:_0x2105f4[_0x6676('0xcd')];_0x4661af[_0x6676('0xdb')]=qs['sort'](_0x2a6d16[_0x6676('0x42')][_0x6676('0xd2')]);_0x4661af['where']=qs[_0x6676('0xd4')](_[_0x6676('0xd3')](_0x2a6d16[_0x6676('0x42')],_0x2105f4[_0x6676('0xd4')]));if(_0x2a6d16[_0x6676('0x42')][_0x6676('0x3d')]){_0x4661af[_0x6676('0x41')]=_[_0x6676('0x57')](_0x4661af['where'],{'$or':_[_0x6676('0x3a')](_0x4661af['attributes'],function(_0x19243c){var _0x26c11f={};_0x26c11f[_0x19243c]={'$like':'%'+_0x2a6d16[_0x6676('0x42')]['filter']+'%'};return _0x26c11f;})});}_0x4661af=_['merge']({},_0x4661af,_0x2a6d16[_0x6676('0x58')]);return _0x4c091e[_0x6676('0xe3')](_0x4661af);}})[_0x6676('0x1e')](function(_0x5abc6c){if(_0x5abc6c){_0x43ee5a=_0x5abc6c[_0x6676('0x4c')];if(!_0x2a6d16[_0x6676('0x42')][_0x6676('0xc5')](_0x6676('0xd7'))){_0x4661af[_0x6676('0x17')]=qs[_0x6676('0x17')](_0x2a6d16[_0x6676('0x42')][_0x6676('0x17')]);_0x4661af[_0x6676('0x15')]=qs[_0x6676('0x15')](_0x2a6d16[_0x6676('0x42')][_0x6676('0x15')]);}return _0x4c091e[_0x6676('0xe3')](_0x4661af);}})[_0x6676('0x1e')](function(_0x5828b4){if(_0x5828b4){return _0x5828b4?{'count':_0x43ee5a,'rows':_0x5828b4}:null;}})[_0x6676('0x1e')](respondWithResult(_0x264e80,null))[_0x6676('0x53')](handleError(_0x264e80,null));};exports[_0x6676('0xe4')]=function(_0x15a1db,_0x335b2d){var _0xce6d98={'raw':!![],'where':{}};var _0x4c3afa={};var _0x507f1e={'count':0x0,'rows':[]};return db[_0x6676('0x39')][_0x6676('0x96')]({'where':{'id':_0x15a1db[_0x6676('0x55')]['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x335b2d,null))['then'](function(_0x31552f){if(_0x31552f){_0x4c3afa[_0x6676('0xcd')]=_[_0x6676('0xcf')](db[_0x6676('0xe5')][_0x6676('0xce')]);_0x4c3afa['query']=_[_0x6676('0xcf')](_0x15a1db[_0x6676('0x42')]);_0x4c3afa[_0x6676('0xd4')]=_[_0x6676('0xd0')](_0x4c3afa['model'],_0x4c3afa[_0x6676('0x42')]);_0xce6d98[_0x6676('0x46')]=_[_0x6676('0xd0')](_0x4c3afa[_0x6676('0xcd')],qs[_0x6676('0xd1')](_0x15a1db[_0x6676('0x42')][_0x6676('0xd1')]));_0xce6d98[_0x6676('0x46')]=_0xce6d98[_0x6676('0x46')]['length']?_0xce6d98[_0x6676('0x46')]:_0x4c3afa['model'];if(!_0x15a1db[_0x6676('0x42')][_0x6676('0xc5')](_0x6676('0xd7'))){_0xce6d98[_0x6676('0x17')]=qs['limit'](_0x15a1db[_0x6676('0x42')][_0x6676('0x17')]);_0xce6d98[_0x6676('0x15')]=qs[_0x6676('0x15')](_0x15a1db['query'][_0x6676('0x15')]);}_0xce6d98['order']=qs[_0x6676('0xd2')](_0x15a1db['query'][_0x6676('0xd2')]);_0xce6d98[_0x6676('0x41')]=qs['filters'](_['pick'](_0x15a1db['query'],_0x4c3afa[_0x6676('0xd4')]));_0xce6d98[_0x6676('0x41')][_0x6676('0xde')]=_0x31552f['id'];if(_0x15a1db[_0x6676('0x42')]['filter']){_0xce6d98[_0x6676('0x41')]=_[_0x6676('0x57')](_0xce6d98[_0x6676('0x41')],{'$or':_['map'](_0xce6d98[_0x6676('0x46')],function(_0x3b3eca){var _0x2ec653={};_0x2ec653[_0x3b3eca]={'$like':'%'+_0x15a1db[_0x6676('0x42')][_0x6676('0x3d')]+'%'};return _0x2ec653;})});}_0xce6d98=_[_0x6676('0x57')]({},_0xce6d98,_0x15a1db[_0x6676('0x58')]);return db[_0x6676('0xe5')][_0x6676('0x18')]({'where':_0xce6d98[_0x6676('0x41')]})[_0x6676('0x1e')](function(_0x3cc57c){_0x507f1e[_0x6676('0x18')]=_0x3cc57c;if(_0x15a1db['query'][_0x6676('0x43')]){_0xce6d98[_0x6676('0x44')]=[{'all':!![]}];}return db[_0x6676('0xe5')][_0x6676('0x48')](_0xce6d98);})[_0x6676('0x1e')](function(_0x25884d){_0x507f1e[_0x6676('0x4b')]=_0x25884d;return _0x507f1e;});}})[_0x6676('0x1e')](respondWithFilteredResult(_0x335b2d,_0xce6d98))['catch'](handleError(_0x335b2d,null));};exports['getSmsInteractions']=function(_0xb3d9ca,_0x293905){var _0x24afec={};var _0x5d160d={};var _0x4e3f85;var _0x5a8ea8;return db[_0x6676('0x39')][_0x6676('0x96')]({'where':{'id':_0xb3d9ca[_0x6676('0x55')]['id']}})['then'](handleEntityNotFound(_0x293905,null))[_0x6676('0x1e')](function(_0x2bc627){if(_0x2bc627){_0x4e3f85=_0x2bc627;_0x5d160d['model']=_['keys'](db[_0x6676('0xe6')][_0x6676('0xce')]);_0x5d160d[_0x6676('0x42')]=_[_0x6676('0xcf')](_0xb3d9ca[_0x6676('0x42')]);_0x5d160d[_0x6676('0xd4')]=_[_0x6676('0xd0')](_0x5d160d[_0x6676('0xcd')],_0x5d160d[_0x6676('0x42')]);_0x24afec[_0x6676('0x46')]=_[_0x6676('0xd0')](_0x5d160d[_0x6676('0xcd')],qs[_0x6676('0xd1')](_0xb3d9ca[_0x6676('0x42')][_0x6676('0xd1')]));_0x24afec[_0x6676('0x46')]=_0x24afec[_0x6676('0x46')][_0x6676('0x4c')]?_0x24afec['attributes']:_0x5d160d[_0x6676('0xcd')];_0x24afec['order']=qs[_0x6676('0xd2')](_0xb3d9ca[_0x6676('0x42')]['sort']);_0x24afec[_0x6676('0x41')]=qs[_0x6676('0xd4')](_[_0x6676('0xd3')](_0xb3d9ca[_0x6676('0x42')],_0x5d160d[_0x6676('0xd4')]));if(_0xb3d9ca['query'][_0x6676('0x3d')]){_0x24afec[_0x6676('0x41')]=_['merge'](_0x24afec['where'],{'$or':_[_0x6676('0x3a')](_0x24afec[_0x6676('0x46')],function(_0x29a833){var _0x964d30={};_0x964d30[_0x29a833]={'$like':'%'+_0xb3d9ca[_0x6676('0x42')][_0x6676('0x3d')]+'%'};return _0x964d30;})});}_0x24afec=_[_0x6676('0x57')]({},_0x24afec,_0xb3d9ca[_0x6676('0x58')]);return _0x4e3f85[_0x6676('0xe7')](_0x24afec);}})[_0x6676('0x1e')](function(_0x13e376){if(_0x13e376){_0x5a8ea8=_0x13e376['length'];if(!_0xb3d9ca[_0x6676('0x42')][_0x6676('0xc5')](_0x6676('0xd7'))){_0x24afec[_0x6676('0x17')]=qs[_0x6676('0x17')](_0xb3d9ca[_0x6676('0x42')][_0x6676('0x17')]);_0x24afec[_0x6676('0x15')]=qs[_0x6676('0x15')](_0xb3d9ca[_0x6676('0x42')]['offset']);}return _0x4e3f85[_0x6676('0xe7')](_0x24afec);}})[_0x6676('0x1e')](function(_0x49fc4d){if(_0x49fc4d){return _0x49fc4d?{'count':_0x5a8ea8,'rows':_0x49fc4d}:null;}})['then'](respondWithResult(_0x293905,null))[_0x6676('0x53')](handleError(_0x293905,null));};exports[_0x6676('0xe8')]=function(_0x498641,_0x554db4){var _0x82f78d={};var _0x1ec6e2={};var _0x133096;var _0x50b309;return db['User'][_0x6676('0x96')]({'where':{'id':_0x498641[_0x6676('0x55')]['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x554db4,null))[_0x6676('0x1e')](function(_0x54d6c1){if(_0x54d6c1){_0x133096=_0x54d6c1;_0x1ec6e2[_0x6676('0xcd')]=_[_0x6676('0xcf')](db[_0x6676('0xe9')][_0x6676('0xce')]);_0x1ec6e2['query']=_['keys'](_0x498641[_0x6676('0x42')]);_0x1ec6e2[_0x6676('0xd4')]=_[_0x6676('0xd0')](_0x1ec6e2[_0x6676('0xcd')],_0x1ec6e2[_0x6676('0x42')]);_0x82f78d[_0x6676('0x46')]=_['intersection'](_0x1ec6e2['model'],qs[_0x6676('0xd1')](_0x498641[_0x6676('0x42')]['fields']));_0x82f78d['attributes']=_0x82f78d[_0x6676('0x46')][_0x6676('0x4c')]?_0x82f78d[_0x6676('0x46')]:_0x1ec6e2[_0x6676('0xcd')];_0x82f78d['order']=qs['sort'](_0x498641[_0x6676('0x42')][_0x6676('0xd2')]);_0x82f78d[_0x6676('0x41')]=qs['filters'](_['pick'](_0x498641[_0x6676('0x42')],_0x1ec6e2[_0x6676('0xd4')]));if(_0x498641[_0x6676('0x42')][_0x6676('0x3d')]){_0x82f78d[_0x6676('0x41')]=_[_0x6676('0x57')](_0x82f78d[_0x6676('0x41')],{'$or':_[_0x6676('0x3a')](_0x82f78d[_0x6676('0x46')],function(_0x1cbb13){var _0x5b4f7d={};_0x5b4f7d[_0x1cbb13]={'$like':'%'+_0x498641['query'][_0x6676('0x3d')]+'%'};return _0x5b4f7d;})});}_0x82f78d=_[_0x6676('0x57')]({},_0x82f78d,_0x498641[_0x6676('0x58')]);return _0x133096[_0x6676('0xe8')](_0x82f78d);}})['then'](function(_0x497a5d){if(_0x497a5d){_0x50b309=_0x497a5d[_0x6676('0x4c')];if(!_0x498641[_0x6676('0x42')][_0x6676('0xc5')]('nolimit')){_0x82f78d[_0x6676('0x17')]=qs[_0x6676('0x17')](_0x498641['query']['limit']);_0x82f78d[_0x6676('0x15')]=qs[_0x6676('0x15')](_0x498641['query'][_0x6676('0x15')]);}return _0x133096[_0x6676('0xe8')](_0x82f78d);}})[_0x6676('0x1e')](function(_0x59fe41){if(_0x59fe41){return _0x59fe41?{'count':_0x50b309,'rows':_0x59fe41}:null;}})[_0x6676('0x1e')](respondWithResult(_0x554db4,null))[_0x6676('0x53')](handleError(_0x554db4,null));};exports['getWhatsappInteractions']=function(_0x19004c,_0x5acdf6){var _0x44930e={};var _0x3f8b5f={};var _0x1dd964;var _0x4d2a01;return db['User'][_0x6676('0x96')]({'where':{'id':_0x19004c['params']['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x5acdf6,null))[_0x6676('0x1e')](function(_0x37573c){if(_0x37573c){_0x1dd964=_0x37573c;_0x3f8b5f[_0x6676('0xcd')]=_[_0x6676('0xcf')](db[_0x6676('0xea')][_0x6676('0xce')]);_0x3f8b5f[_0x6676('0x42')]=_[_0x6676('0xcf')](_0x19004c[_0x6676('0x42')]);_0x3f8b5f['filters']=_['intersection'](_0x3f8b5f[_0x6676('0xcd')],_0x3f8b5f[_0x6676('0x42')]);_0x44930e[_0x6676('0x46')]=_['intersection'](_0x3f8b5f[_0x6676('0xcd')],qs[_0x6676('0xd1')](_0x19004c[_0x6676('0x42')]['fields']));_0x44930e[_0x6676('0x46')]=_0x44930e[_0x6676('0x46')][_0x6676('0x4c')]?_0x44930e['attributes']:_0x3f8b5f[_0x6676('0xcd')];_0x44930e[_0x6676('0xdb')]=qs[_0x6676('0xd2')](_0x19004c[_0x6676('0x42')][_0x6676('0xd2')]);_0x44930e[_0x6676('0x41')]=qs[_0x6676('0xd4')](_[_0x6676('0xd3')](_0x19004c[_0x6676('0x42')],_0x3f8b5f[_0x6676('0xd4')]));if(_0x19004c[_0x6676('0x42')][_0x6676('0x3d')]){_0x44930e['where']=_[_0x6676('0x57')](_0x44930e['where'],{'$or':_[_0x6676('0x3a')](_0x44930e[_0x6676('0x46')],function(_0x1c8213){var _0x40df63={};_0x40df63[_0x1c8213]={'$like':'%'+_0x19004c[_0x6676('0x42')][_0x6676('0x3d')]+'%'};return _0x40df63;})});}_0x44930e=_['merge']({},_0x44930e,_0x19004c[_0x6676('0x58')]);return _0x1dd964[_0x6676('0xeb')](_0x44930e);}})['then'](function(_0x5e771d){if(_0x5e771d){_0x4d2a01=_0x5e771d[_0x6676('0x4c')];if(!_0x19004c[_0x6676('0x42')][_0x6676('0xc5')](_0x6676('0xd7'))){_0x44930e['limit']=qs[_0x6676('0x17')](_0x19004c['query'][_0x6676('0x17')]);_0x44930e[_0x6676('0x15')]=qs['offset'](_0x19004c['query']['offset']);}return _0x1dd964[_0x6676('0xeb')](_0x44930e);}})['then'](function(_0x158229){if(_0x158229){return _0x158229?{'count':_0x4d2a01,'rows':_0x158229}:null;}})[_0x6676('0x1e')](respondWithResult(_0x5acdf6,null))[_0x6676('0x53')](handleError(_0x5acdf6,null));};exports['login']=function(_0x4aa483,_0x275d63,_0x1faa49){var _0xbd7543;var _0x3c9c9f;var _0x33c300;var _0x133345=!_[_0x6676('0x65')](_0x4aa483[_0x6676('0x55')]['id'])?_0x4aa483['params']['id']:!_[_0x6676('0x65')](_0x4aa483[_0x6676('0x2e')]['id'])?_0x4aa483[_0x6676('0x2e')]['id']:null;return db['User'][_0x6676('0x34')]({'where':{'id':_0x133345,'role':{'$or':[_0x6676('0x80'),_0x6676('0x2e'),'agent']}},'attributes':['id',_0x6676('0x35'),_0x6676('0xec'),_0x6676('0xed'),'role',_0x6676('0x5f'),_0x6676('0x9d')]})[_0x6676('0x1e')](function(_0x5ed805){if(_0x5ed805){if(_0x5ed805[_0x6676('0x28')]===_0x6676('0x29')){_0xbd7543=_0x5ed805;if(_0x4aa483['body']['interface']){_0x33c300=util[_0x6676('0xa9')]('LOCAL/%s@from-sip/n',_0xbd7543[_0x4aa483[_0x6676('0x5a')][_0x6676('0x9f')]]);}else if(_0x4aa483[_0x6676('0x5a')][_0x6676('0xee')]){_0x33c300=util[_0x6676('0xa9')](_0x6676('0xef'),_0x4aa483[_0x6676('0x5a')][_0x6676('0xee')]);}else{_0x33c300=util[_0x6676('0xa9')](_0x6676('0xef'),_0xbd7543[_0x6676('0x35')]);}socket['to'](util[_0x6676('0xa9')](_0x6676('0xf0'),_0xbd7543[_0x6676('0x35')]))['emit']('user:forcelogout',{'user':{'id':_0xbd7543['id'],'name':_0xbd7543[_0x6676('0x35')]},'ip':_0x4aa483[_0x6676('0xf1')][_0x6676('0xf2')]||_0x4aa483[_0x6676('0xf3')][_0x6676('0xf4')]||_0x4aa483['socket'][_0x6676('0xf4')]||_0x4aa483['connection'][_0x6676('0xf5')][_0x6676('0xf4')]});return new Promise(function(_0x4654af,_0x55eb18){db[_0x6676('0x67')]['transaction']()[_0x6676('0x1e')](_0x964a60=>{db[_0x6676('0xaa')][_0x6676('0x2b')]({'where':{'membername':_0xbd7543[_0x6676('0x35')]},'individualHooks':!![]},{'transaction':_0x964a60})[_0x6676('0x1e')](function(){return _0x964a60[_0x6676('0xf6')]();})[_0x6676('0x1e')](_0x4654af)['catch'](_0x55eb18);});});}}else{throw new db[(_0x6676('0x91'))][(_0x6676('0x92'))](_0x6676('0xf7'));}})[_0x6676('0x1e')](function(){if(_0xbd7543){return _0xbd7543['getVoiceQueues']({'raw':!![]});}})[_0x6676('0x1e')](function(_0x1d456b){if(_0xbd7543){if(_0x1d456b){_0x3c9c9f=_0x1d456b;if(_0x3c9c9f[_0x6676('0x4c')]){var _0x263f86=_0x3c9c9f['map'](function(_0x1eceb0){return{'membername':_0xbd7543[_0x6676('0x35')],'UserId':_0xbd7543['id'],'queue_name':_0x1eceb0[_0x6676('0x35')],'VoiceQueueId':_0x1eceb0['id'],'interface':_0x33c300,'paused':_0xbd7543[_0x6676('0x9d')]||![],'penalty':_0x1eceb0['UserVoiceQueue.penalty']||0x0};});return db[_0x6676('0xaa')][_0x6676('0x89')](_0x263f86);}}}})[_0x6676('0x1e')](function(){if(_0xbd7543){return db[_0x6676('0xf8')][_0x6676('0x48')]({'where':{'membername':_0xbd7543['name'],'exitAt':null}});}})[_0x6676('0x1e')](function(_0xca2a36){if(_0xbd7543){var _0x565d47=[];_0xca2a36[_0x6676('0xf9')](function(_0x180c24){_0x565d47[_0x6676('0x47')](_0x180c24[_0x6676('0x27')]({'exitAt':moment()[_0x6676('0xa9')](_0x6676('0xfa'))}));});return Promise[_0x6676('0x59')](_0x565d47);}})[_0x6676('0x1e')](function(){if(_0xbd7543){var _0x138971=[];var _0x5af6b9=[];var _0x71a374=utils[_0x6676('0xfb')]();var _0x4d9def={'membername':_0xbd7543[_0x6676('0x35')],'interface':_0x33c300,'enterAt':moment()[_0x6676('0xa9')](_0x6676('0xfa')),'role':_0xbd7543['role'],'internal':_0xbd7543['internal']};_0x71a374[_0x6676('0xf9')](function(_0x151915){_0x138971[_0x6676('0x47')](_[_0x6676('0x57')]({'channel':_0x151915,'type':_0x6676('0xfc'),'data1':_0x4aa483[_0x6676('0x5a')][_0x6676('0xfd')],'data2':_0x33c300},_0x4d9def));if(_0xbd7543['loginInPause']){_0x5af6b9[_0x6676('0x47')](_[_0x6676('0x57')]({'channel':_0x151915,'type':_0x6676('0xfe'),'data1':_0x6676('0xff')},_0x4d9def));}});return db[_0x6676('0xf8')]['bulkCreate'](_0x138971[_0x6676('0xc2')](_0x5af6b9),{'individualHooks':!![]});}})[_0x6676('0x1e')](function(){if(_0xbd7543){return _0xbd7543['update']({'online':!![],'lastLoginAt':moment()['format'](_0x6676('0xfa')),'voicePause':_0xbd7543['loginInPause']||![],'mailPause':_0xbd7543[_0x6676('0x9d')]||![],'chatPause':_0xbd7543[_0x6676('0x9d')]||![],'faxPause':_0xbd7543[_0x6676('0x9d')]||![],'smsPause':_0xbd7543[_0x6676('0x9d')]||![],'openchannelPause':_0xbd7543[_0x6676('0x9d')]||![],'whatsappPause':_0xbd7543[_0x6676('0x9d')]||![],'pauseType':_0xbd7543[_0x6676('0x9d')]?'LOGININPAUSE':null,'interface':_0x33c300,'lastPauseAt':moment()[_0x6676('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x6676('0x1e')](function(_0x1e9696){if(_0x4aa483[_0x6676('0x100')]){return _0x1faa49();}else{return Promise['resolve'](_0x1e9696)[_0x6676('0x1e')](respondWithResult(_0x275d63,null));}})[_0x6676('0x53')](handleError(_0x275d63,null));};exports[_0x6676('0x101')]=function(_0x3a3279,_0x52d1a0){var _0x4e135e;return db[_0x6676('0x39')][_0x6676('0x34')]({'where':{'id':_0x3a3279['params']['id'],'role':_0x6676('0x29')},'attributes':['id',_0x6676('0x35'),_0x6676('0x28')]})[_0x6676('0x1e')](handleEntityNotFound(_0x52d1a0,null))[_0x6676('0x1e')](function(_0x54eb37){if(_0x54eb37){_0x4e135e=_0x54eb37;return db[_0x6676('0xaa')][_0x6676('0x2b')]({'where':{'membername':_0x4e135e[_0x6676('0x35')]},'individualHooks':!![]});}})[_0x6676('0x1e')](function(){return db[_0x6676('0xf8')][_0x6676('0x48')]({'where':{'membername':_0x4e135e[_0x6676('0x35')],'exitAt':null}});})[_0x6676('0x1e')](function(_0x16a7b7){var _0x799168=[];_0x16a7b7[_0x6676('0xf9')](function(_0x1a203c){_0x799168[_0x6676('0x47')](_0x1a203c[_0x6676('0x27')]({'exitAt':moment()['format'](_0x6676('0xfa'))}));});return Promise[_0x6676('0x59')](_0x799168);})[_0x6676('0x1e')](function(){return _0x4e135e[_0x6676('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x6676('0x1e')](respondWithResult(_0x52d1a0,null))[_0x6676('0x53')](handleError(_0x52d1a0,null));};exports[_0x6676('0x102')]=function(_0x5c47c4,_0x50e5f0){var _0x3fa6f3;return db[_0x6676('0xaa')]['update']({'paused':0x1},{'where':{'UserId':_0x5c47c4['params']['id']},'individualHooks':!![]})['then'](function(){return db['User'][_0x6676('0x34')]({'where':{'id':_0x5c47c4[_0x6676('0x55')]['id'],'role':_0x6676('0x29')},'attributes':['id','name','role',_0x6676('0x5f'),_0x6676('0x9f'),'online']});})[_0x6676('0x1e')](handleEntityNotFound(_0x50e5f0,null))[_0x6676('0x1e')](function(_0xf151d2){if(_0xf151d2){_0x3fa6f3=_0xf151d2;return respondWithRpcPromise(_0x6676('0x103'),'pause',{'id':_0x3fa6f3['id'],'name':_0x3fa6f3[_0x6676('0x35')],'pause':!![]});}})[_0x6676('0x1e')](function(){if(_0x3fa6f3){return db['MemberReport'][_0x6676('0x48')]({'where':{'membername':_0x3fa6f3[_0x6676('0x35')],'type':_0x6676('0xfe'),'exitAt':null}});}})[_0x6676('0x1e')](function(_0x29649d){if(_0x29649d[_0x6676('0x4c')]){var _0x2cc2ef=moment()[_0x6676('0xa9')](_0x6676('0xfa'));for(var _0x443792=0x0,_0x341b3a=_0x29649d['length'];_0x443792<_0x341b3a;_0x443792++){_0x29649d[_0x443792]['updateAttributes']({'exitAt':_0x2cc2ef});}}})[_0x6676('0x1e')](function(){var _0x1ba811=[];var _0xf271d3=utils['getChannels']();_0xf271d3[_0x6676('0xf9')](function(_0x258ca7){_0x1ba811[_0x6676('0x47')]({'channel':_0x258ca7,'membername':_0x3fa6f3[_0x6676('0x35')],'interface':_['isNil'](_0x3fa6f3['interface'])?util['format'](_0x6676('0xef'),_0x3fa6f3['name']):_0x3fa6f3[_0x6676('0x9f')],'type':'PAUSE','enterAt':moment()[_0x6676('0xa9')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x5c47c4[_0x6676('0x5a')][_0x6676('0x3b')]||'DEFAULT\x20PAUSE','role':_0x3fa6f3[_0x6676('0x28')],'internal':_0x3fa6f3['internal']});});return db['MemberReport'][_0x6676('0x89')](_0x1ba811,{'individualHooks':!![]});})[_0x6676('0x1e')](function(){return _0x3fa6f3[_0x6676('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5c47c4[_0x6676('0x5a')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x6676('0xa9')](_0x6676('0xfa'))});})[_0x6676('0x1e')](respondWithResult(_0x50e5f0,null))[_0x6676('0x53')](handleError(_0x50e5f0,null));};exports[_0x6676('0x104')]=function(_0x203c0a,_0x113aaa){if(_0x203c0a[_0x6676('0x5a')]['channel']&&!utils[_0x6676('0xa0')](_0x203c0a[_0x6676('0x5a')][_0x6676('0xad')])){throw new APIBadRequestError(util[_0x6676('0xa9')](_0x6676('0x105'),_0x203c0a[_0x6676('0x5a')][_0x6676('0xad')]));}return db[_0x6676('0x39')][_0x6676('0x34')]({'where':{'id':_0x203c0a[_0x6676('0x55')]['id']},'attributes':['id',_0x6676('0x35'),'role',_0x6676('0x5f'),_0x6676('0x9f'),'online',_0x6676('0x9e'),'mailPause',_0x6676('0x106'),_0x6676('0x107'),_0x6676('0x108'),_0x6676('0x109'),_0x6676('0x10a'),_0x6676('0x10b'),_0x6676('0x10c')]})['then'](function(_0x188418){if(!_0x188418){throw new APINotFoundError(util[_0x6676('0xa9')](_0x6676('0xc4'),_0x203c0a[_0x6676('0x55')]['id']));}return _0x188418['unpause'](_0x203c0a[_0x6676('0x5a')][_0x6676('0xad')]);})[_0x6676('0x1e')](respondWithResult(_0x113aaa,null))[_0x6676('0x53')](APIHandleError(_0x113aaa));};exports['getTeams']=function(_0x20358e,_0x2e8c7f){var _0x1c909c={};var _0x2f1991={};var _0x27188a;var _0x657417;return db[_0x6676('0x39')][_0x6676('0x96')]({'where':{'id':_0x20358e[_0x6676('0x55')]['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x2e8c7f,null))[_0x6676('0x1e')](function(_0x5ddff2){if(_0x5ddff2){_0x27188a=_0x5ddff2;_0x2f1991[_0x6676('0xcd')]=_[_0x6676('0xcf')](db[_0x6676('0x10d')][_0x6676('0xce')]);_0x2f1991[_0x6676('0x42')]=_[_0x6676('0xcf')](_0x20358e['query']);_0x2f1991['filters']=_[_0x6676('0xd0')](_0x2f1991[_0x6676('0xcd')],_0x2f1991[_0x6676('0x42')]);_0x1c909c[_0x6676('0x46')]=_[_0x6676('0xd0')](_0x2f1991[_0x6676('0xcd')],qs[_0x6676('0xd1')](_0x20358e['query'][_0x6676('0xd1')]));_0x1c909c[_0x6676('0x46')]=_0x1c909c[_0x6676('0x46')][_0x6676('0x4c')]?_0x1c909c['attributes']:_0x2f1991['model'];_0x1c909c[_0x6676('0xdb')]=qs[_0x6676('0xd2')](_0x20358e['query'][_0x6676('0xd2')]);_0x1c909c[_0x6676('0x41')]=qs['filters'](_['pick'](_0x20358e[_0x6676('0x42')],_0x2f1991[_0x6676('0xd4')]));if(_0x20358e['query'][_0x6676('0x3d')]){_0x1c909c[_0x6676('0x41')]=_[_0x6676('0x57')](_0x1c909c[_0x6676('0x41')],{'$or':_[_0x6676('0x3a')](_0x1c909c[_0x6676('0x46')],function(_0x29c0d5){var _0x534837={};_0x534837[_0x29c0d5]={'$like':'%'+_0x20358e[_0x6676('0x42')]['filter']+'%'};return _0x534837;})});}_0x1c909c=_[_0x6676('0x57')]({},_0x1c909c,_0x20358e[_0x6676('0x58')]);return _0x27188a[_0x6676('0x10e')](_0x1c909c);}})[_0x6676('0x1e')](function(_0x27d678){if(_0x27d678){_0x657417=_0x27d678[_0x6676('0x4c')];if(!_0x20358e[_0x6676('0x42')][_0x6676('0xc5')](_0x6676('0xd7'))){_0x1c909c[_0x6676('0x17')]=qs[_0x6676('0x17')](_0x20358e[_0x6676('0x42')][_0x6676('0x17')]);_0x1c909c[_0x6676('0x15')]=qs[_0x6676('0x15')](_0x20358e[_0x6676('0x42')]['offset']);}return _0x27188a[_0x6676('0x10e')](_0x1c909c);}})['then'](function(_0x232544){if(_0x232544){return _0x232544?{'count':_0x657417,'rows':_0x232544}:null;}})['then'](respondWithResult(_0x2e8c7f,null))[_0x6676('0x53')](handleError(_0x2e8c7f,null));};exports['addTeams']=function(_0x1e2dfb,_0x50c6b0){var _0x5bf18c=_0x1e2dfb[_0x6676('0x55')]['id'];var _0x3b16cf=_0x1e2dfb['body']?_0x1e2dfb[_0x6676('0x5a')][_0x6676('0x5d')]:null;var _0x475ade=[];return Promise[_0x6676('0x10f')]()['then'](function(){if(!_0x3b16cf)throw new APIBadRequestError(_0x6676('0x110'));})[_0x6676('0x1e')](function(){return db[_0x6676('0x39')][_0x6676('0x96')]({'where':{'id':_0x5bf18c}});})[_0x6676('0x1e')](function(_0x4ecf9d){if(!_0x4ecf9d)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x1e2dfb[_0x6676('0x55')]['id']));return db[_0x6676('0x67')][_0x6676('0x111')](function(_0x296bda){return _0x4ecf9d['addTeams'](_0x3b16cf,{'transaction':_0x296bda})[_0x6676('0x1e')](function(){return db[_0x6676('0x10d')][_0x6676('0x48')]({'where':{'id':{'$in':_0x3b16cf}}});})[_0x6676('0x1e')](function(_0x536986){var _0x4076b2=_[_0x6676('0x3a')](_0x536986,function(_0x475ac1){return _0x475ac1[_0x6676('0x112')]();});return Promise[_0x6676('0x59')](_0x4076b2);})[_0x6676('0x1e')](function(_0x39f44b){_0x475ade=_[_0x6676('0x113')](_0x39f44b);var _0x3b39ec=_[_0x6676('0x3a')](_0x475ade,function(_0x5398a0){return _0x5398a0[_0x6676('0x114')](_0x4ecf9d['id'],{'transaction':_0x296bda});});return Promise[_0x6676('0x59')](_0x3b39ec);})[_0x6676('0x1e')](function(){if(!_0x4ecf9d[_0x6676('0x9c')])return;var _0x3bef14=_[_0x6676('0x3d')](_0x475ade,function(_0x33936b){return _0x33936b[_0x6676('0x115')](_0x6676('0xad'))===_0x6676('0x116');});var _0x24abdb=_[_0x6676('0x3a')](_0x3bef14,function(_0x2219c1){return db[_0x6676('0xaa')]['upsert']({'membername':_0x4ecf9d['name'],'UserId':_0x4ecf9d['id'],'queue_name':_0x2219c1['name'],'VoiceQueueId':_0x2219c1['id'],'interface':_['isNil'](_0x4ecf9d[_0x6676('0x9f')])?util[_0x6676('0xa9')](_0x6676('0xef'),_0x4ecf9d[_0x6676('0x35')]):_0x4ecf9d[_0x6676('0x9f')],'paused':_0x4ecf9d[_0x6676('0x9e')]||![],'penalty':_0x4ecf9d['penalty']},{'transaction':_0x296bda});});return Promise[_0x6676('0x59')](_0x24abdb);})[_0x6676('0x1e')](function(){return db[_0x6676('0x117')][_0x6676('0x48')]({'where':{'teamId':{'$in':_0x3b16cf}}});})['then'](function(_0x2be096){var _0x282622=_['map'](_0x2be096,function(_0x375ae3){return db[_0x6676('0x118')][_0x6676('0x84')]({'UserId':_0x4ecf9d['id'],'VoicePrefixId':_0x375ae3[_0x6676('0x119')]},{'transaction':_0x296bda});});return Promise[_0x6676('0x59')](_0x282622);});});})[_0x6676('0x1e')](function(){for(var _0x3279c5=0x0;_0x3279c5<_0x475ade[_0x6676('0x4c')];_0x3279c5++){var _0x1717c6=_0x475ade[_0x3279c5]['getDataValue']('channel');var _0x3bf587=_0x1717c6+_0x6676('0xaf');socket[_0x6676('0x2a')](_0x6676('0x2e')+_0x1717c6+_0x6676('0xa6'),{'UserId':_0x5bf18c,['queueField']:_0x475ade[_0x3279c5]['id']});}})[_0x6676('0x1e')](respondWithStatusCode(_0x50c6b0,null))[_0x6676('0x53')](APIHandleError(_0x50c6b0));};exports[_0x6676('0x11a')]=function(_0x807b3f,_0x38e20b){var _0x2de36f=_0x807b3f[_0x6676('0x55')]['id'];var _0x229f59=null;if(_0x807b3f['query'][_0x6676('0x5d')]){_0x229f59=_[_0x6676('0x11b')](_0x807b3f['query'][_0x6676('0x5d')])?_0x807b3f['query'][_0x6676('0x5d')]:[_0x807b3f['query'][_0x6676('0x5d')]];}var _0x2c28e5=[];return Promise[_0x6676('0x10f')]()['then'](function(){if(!_0x229f59)throw new APIBadRequestError(_0x6676('0x11c'));})[_0x6676('0x1e')](function(){return db[_0x6676('0x39')]['findOne']({'where':{'id':_0x2de36f}});})[_0x6676('0x1e')](function(_0x65b138){if(!_0x65b138)throw new APINotFoundError(util[_0x6676('0xa9')](_0x6676('0xc4'),_0x807b3f['params']['id']));return db[_0x6676('0x67')][_0x6676('0x111')](function(_0x281a12){return _0x65b138['removeTeams'](_0x229f59,{'transaction':_0x281a12})[_0x6676('0x1e')](function(){return db[_0x6676('0x10d')][_0x6676('0x48')]({'where':{'id':{'$in':_0x229f59}}});})[_0x6676('0x1e')](function(_0x3342b6){var _0x118b74=_['map'](_0x3342b6,function(_0x352662){return _0x352662['getAssociatedQueues']();});return Promise[_0x6676('0x59')](_0x118b74);})[_0x6676('0x1e')](function(_0x1297a3){_0x2c28e5=_[_0x6676('0x113')](_0x1297a3);var _0x4fc30b=_[_0x6676('0x3a')](_0x2c28e5,function(_0x237040){return _0x237040[_0x6676('0x11d')](_0x65b138['id'],{'transaction':_0x281a12});});return Promise['all'](_0x4fc30b);})['then'](function(){if(!_0x65b138['online'])return;var _0x79eebb=_[_0x6676('0x3d')](_0x2c28e5,function(_0x34c22f){return _0x34c22f[_0x6676('0x115')](_0x6676('0xad'))===_0x6676('0x116');});var _0x342a8c=_['map'](_0x79eebb,function(_0x13cdcf){return db[_0x6676('0xaa')]['destroy']({'where':{'VoiceQueueId':_0x13cdcf['id'],'UserId':_0x65b138['id']},'transaction':_0x281a12});});return Promise[_0x6676('0x59')](_0x342a8c);})[_0x6676('0x1e')](function(){return db['TeamVoicePrefix'][_0x6676('0x48')]({'where':{'teamId':{'$in':_0x229f59}}});})['then'](function(_0x4640ff){var _0x48b862=_[_0x6676('0x3a')](_0x4640ff,function(_0x3a8857){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x65b138['id'],'VoicePrefixId':_0x3a8857[_0x6676('0x119')]}},{'transaction':_0x281a12});});return Promise['all'](_0x48b862);});});})[_0x6676('0x1e')](function(){for(var _0x50abf3=0x0;_0x50abf3<_0x2c28e5[_0x6676('0x4c')];_0x50abf3++){var _0x197555=_0x2c28e5[_0x50abf3][_0x6676('0x115')](_0x6676('0xad'));var _0x31a6a9=_0x197555+_0x6676('0xaf');socket[_0x6676('0x2a')](_0x6676('0x2e')+_0x197555+_0x6676('0xb0'),{'UserId':_0x2de36f,['queueField']:_0x2c28e5[_0x50abf3]['id']});}})['then'](respondWithStatusCode(_0x38e20b,null))[_0x6676('0x53')](APIHandleError(_0x38e20b));};exports['getLists']=function(_0x58dceb,_0x1b1877){var _0x421af9={};var _0x7d454b={};var _0x11e876;var _0x482c4d;return db['User'][_0x6676('0x96')]({'where':{'id':_0x58dceb[_0x6676('0x55')]['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x1b1877,null))['then'](function(_0x5a5d06){if(_0x5a5d06){_0x11e876=_0x5a5d06;_0x7d454b[_0x6676('0xcd')]=_[_0x6676('0xcf')](db[_0x6676('0xc6')]['rawAttributes']);_0x7d454b[_0x6676('0x42')]=_[_0x6676('0xcf')](_0x58dceb[_0x6676('0x42')]);_0x7d454b['filters']=_[_0x6676('0xd0')](_0x7d454b[_0x6676('0xcd')],_0x7d454b[_0x6676('0x42')]);_0x421af9[_0x6676('0x46')]=_['intersection'](_0x7d454b[_0x6676('0xcd')],qs[_0x6676('0xd1')](_0x58dceb[_0x6676('0x42')]['fields']));_0x421af9['attributes']=_0x421af9['attributes']['length']?_0x421af9['attributes']:_0x7d454b[_0x6676('0xcd')];_0x421af9[_0x6676('0xdb')]=qs[_0x6676('0xd2')](_0x58dceb[_0x6676('0x42')][_0x6676('0xd2')]);_0x421af9['where']=qs[_0x6676('0xd4')](_[_0x6676('0xd3')](_0x58dceb[_0x6676('0x42')],_0x7d454b[_0x6676('0xd4')]));if(_0x58dceb[_0x6676('0x42')][_0x6676('0x3d')]){_0x421af9[_0x6676('0x41')]=_[_0x6676('0x57')](_0x421af9[_0x6676('0x41')],{'$or':_[_0x6676('0x3a')](_0x421af9[_0x6676('0x46')],function(_0x1efbcf){var _0x46db32={};_0x46db32[_0x1efbcf]={'$like':'%'+_0x58dceb[_0x6676('0x42')][_0x6676('0x3d')]+'%'};return _0x46db32;})});}_0x421af9=_['merge']({},_0x421af9,_0x58dceb[_0x6676('0x58')]);return _0x11e876[_0x6676('0x11e')](_0x421af9);}})['then'](function(_0x2e78b9){if(_0x2e78b9){_0x482c4d=_0x2e78b9[_0x6676('0x4c')];if(!_0x58dceb[_0x6676('0x42')][_0x6676('0xc5')](_0x6676('0xd7'))){_0x421af9['limit']=qs[_0x6676('0x17')](_0x58dceb[_0x6676('0x42')]['limit']);_0x421af9[_0x6676('0x15')]=qs[_0x6676('0x15')](_0x58dceb[_0x6676('0x42')]['offset']);}return _0x11e876['getLists'](_0x421af9);}})[_0x6676('0x1e')](function(_0x4c8d3b){if(_0x4c8d3b){return _0x4c8d3b?{'count':_0x482c4d,'rows':_0x4c8d3b}:null;}})[_0x6676('0x1e')](respondWithResult(_0x1b1877,null))[_0x6676('0x53')](handleError(_0x1b1877,null));};exports[_0x6676('0x11f')]=function(_0x28d5cc,_0x278122){var _0x42b014={};var _0x3048a3={};var _0x3c3a46;return db[_0x6676('0x39')][_0x6676('0x96')]({'where':{'id':_0x28d5cc[_0x6676('0x55')]['id']}})[_0x6676('0x1e')](handleEntityNotFound(_0x278122,null))[_0x6676('0x1e')](function(_0x35b9a5){if(_0x35b9a5){_0x3c3a46=_0x35b9a5;_0x3048a3['model']=_[_0x6676('0xcf')](db['User'][_0x6676('0xce')]);_0x3048a3[_0x6676('0x42')]=_[_0x6676('0xcf')](_0x28d5cc['query']);_0x3048a3[_0x6676('0xd4')]=_[_0x6676('0xd0')](_0x3048a3[_0x6676('0xcd')],_0x3048a3[_0x6676('0x42')]);_0x42b014['attributes']=_['intersection'](_0x3048a3[_0x6676('0xcd')],qs['fields'](_0x28d5cc[_0x6676('0x42')]['fields']));_0x42b014['attributes']=_0x42b014[_0x6676('0x46')]['length']?_0x42b014[_0x6676('0x46')]:_0x3048a3['model'];_0x42b014[_0x6676('0xdb')]=qs[_0x6676('0xd2')](_0x28d5cc[_0x6676('0x42')][_0x6676('0xd2')]);_0x42b014['where']=qs['filters'](_['pick'](_0x28d5cc[_0x6676('0x42')],_0x3048a3[_0x6676('0xd4')]));if(_0x28d5cc[_0x6676('0x42')][_0x6676('0x3d')]){_0x42b014[_0x6676('0x41')]=_[_0x6676('0x57')](_0x42b014[_0x6676('0x41')],{'$or':_[_0x6676('0x3a')](_0x42b014['attributes'],function(_0x461750){var _0x512581={};_0x512581[_0x461750]={'$like':'%'+_0x28d5cc[_0x6676('0x42')][_0x6676('0x3d')]+'%'};return _0x512581;})});}_0x42b014[_0x6676('0xcd')]=db[_0x6676('0x39')];_0x42b014['as']=_0x6676('0x2f');_0x42b014=_[_0x6676('0x57')]({},_0x42b014,_0x28d5cc[_0x6676('0x58')]);return _0x3c3a46['getVoiceQueues']({'include':[_0x42b014]});}})[_0x6676('0x1e')](function(_0xe5e477){if(_0xe5e477){var _0x19b5d7={},_0x471eb0=[];for(var _0x2c8c74=0x0;_0x2c8c74<_0xe5e477['length'];_0x2c8c74+=0x1){for(var _0x3641e9=0x0,_0x40fd45;_0x3641e9<_0xe5e477[_0x2c8c74][_0x6676('0x2f')][_0x6676('0x4c')];_0x3641e9+=0x1){_0x40fd45=_0xe5e477[_0x2c8c74][_0x6676('0x2f')][_0x3641e9][_0x6676('0x2c')]({'plain':!![]});_0x19b5d7[_0x40fd45['id']]=_0x40fd45;}}_0x19b5d7=_[_0x6676('0x120')](_0x19b5d7);for(var _0x3dca9f=qs[_0x6676('0x15')](_0x28d5cc['query'][_0x6676('0x15')]);_0x3dca9f<_0x19b5d7[_0x6676('0x4c')]&&_0x471eb0[_0x6676('0x4c')]=_0x382a42[_0x134e('0x4e')]){throw new Error(_0x134e('0x4f'));}})[_0x134e('0x1a')](function(){if(_0x7c8c8f){return db[_0x134e('0x50')]['destroy']({'where':{'membername':_0x7c8c8f[_0x134e('0x1f')]},'individualHooks':!![]});}})[_0x134e('0x1a')](function(){if(_0x7c8c8f){return _0x7c8c8f[_0x134e('0x51')]({'raw':!![]});}})[_0x134e('0x1a')](function(_0x38f50d){if(_0x7c8c8f){if(_0x38f50d){var _0x3e05a3=[];_0xed2e35=_0x38f50d;if(_0xed2e35[_0x134e('0x27')]){for(var _0x2a3fd7=0x0;_0x2a3fd7<_0xed2e35[_0x134e('0x27')];_0x2a3fd7++){_0x3e05a3[_0x134e('0x2b')](db[_0x134e('0x50')]['upsert']({'membername':_0x7c8c8f['name'],'UserId':_0x7c8c8f['id'],'queue_name':_0xed2e35[_0x2a3fd7]['name'],'VoiceQueueId':_0xed2e35[_0x2a3fd7]['id'],'interface':_0x212dbf,'paused':_0x7c8c8f[_0x134e('0x49')]||![],'penalty':_0xed2e35[_0x2a3fd7][_0x134e('0x52')]||0x0}));}return BPromise['all'](_0x3e05a3);}}}})[_0x134e('0x1a')](function(){if(_0x7c8c8f){return db['MemberReport'][_0x134e('0xc')]({'where':{'membername':_0x7c8c8f[_0x134e('0x1f')],'exitAt':null}});}})['then'](function(_0x56f8c9){if(_0x7c8c8f){if(_0x56f8c9&&_0x56f8c9['length']){var _0x3af5bc=[];_0x56f8c9['forEach'](function(_0x5bbb74){_0x3af5bc['push'](_0x5bbb74[_0x134e('0x24')]({'exitAt':moment()[_0x134e('0x22')](_0x134e('0x28'))}));});return BPromise['all'](_0x3af5bc);}}})[_0x134e('0x1a')](function(){if(_0x7c8c8f){var _0x446de0=[];var _0xa1bb2b=[];var _0xebee2f=utils[_0x134e('0x2a')]();var _0x14517e={'membername':_0x7c8c8f[_0x134e('0x1f')],'interface':_0x212dbf,'enterAt':moment()[_0x134e('0x22')](_0x134e('0x28')),'role':_0x7c8c8f[_0x134e('0x39')],'internal':_0x7c8c8f[_0x134e('0x20')]};_0xebee2f[_0x134e('0x44')](function(_0x4551c6){_0x446de0['push'](_[_0x134e('0x53')]({'channel':_0x4551c6,'type':_0x134e('0x54'),'data1':_0x134e('0x55'),'data2':_0x212dbf},_0x14517e));if(_0x7c8c8f['loginInPause']){_0xa1bb2b[_0x134e('0x2b')](_[_0x134e('0x53')]({'channel':_0x4551c6,'type':_0x134e('0x26'),'data1':_0x134e('0x56')},_0x14517e));}});return db[_0x134e('0x25')][_0x134e('0x32')](_0x446de0[_0x134e('0x57')](_0xa1bb2b),{'individualHooks':!![]});}})[_0x134e('0x1a')](function(){if(_0x7c8c8f){return _0x7c8c8f['update']({'online':!![],'lastLoginAt':moment()[_0x134e('0x22')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x7c8c8f[_0x134e('0x49')]||![],'mailPause':_0x7c8c8f['loginInPause']||![],'chatPause':_0x7c8c8f['loginInPause']||![],'faxPause':_0x7c8c8f[_0x134e('0x49')]||![],'smsPause':_0x7c8c8f[_0x134e('0x49')]||![],'openchannelPause':_0x7c8c8f[_0x134e('0x49')]||![],'pauseType':_0x7c8c8f[_0x134e('0x49')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x134e('0x22')](_0x134e('0x28')),'interface':_0x212dbf});}})[_0x134e('0x1a')](function(_0x183d48){_0x4ff6cc(_0x183d48);})['catch'](function(_0x64c25a){_0x107ae9(_0x17cad1['error'](0x1f4,_0x64c25a[_0x134e('0x17')]));});});}; \ No newline at end of file +var _0x7e5e=['lastPauseAt','unpause','system','LogoutUser','findOne','UserVoiceQueueRt','destroy','all','LoginUser','phone','loginInPause','SIP/%s','count','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','concat','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./user.socket','GetUser','options','where','attributes','include','map','model','info','debug','stringify','catch','error','message','ShowUser','User','find','raw','PauseUser','name','role','interface','then','User\x20with\x20id\x20%s\x20not\x20found','params','update','MemberReport','findAll','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','push','isNil','body','type','DEFAULT\x20PAUSE','internal','bulkCreate','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','online','mailPause','chatPause','faxPause','smsPause','whatsappPause'];(function(_0x336c8b,_0x56b55b){var _0x4dd2f6=function(_0x169a0f){while(--_0x169a0f){_0x336c8b['push'](_0x336c8b['shift']());}};_0x4dd2f6(++_0x56b55b);}(_0x7e5e,0x1c1));var _0xe7e5=function(_0x11309c,_0xe18a74){_0x11309c=_0x11309c-0x0;var _0x3fea9c=_0x7e5e[_0x11309c];return _0x3fea9c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7e5('0x0'));var BPromise=require(_0xe7e5('0x1'));var Redis=require(_0xe7e5('0x2'));var db=require(_0xe7e5('0x3'))['db'];var utils=require(_0xe7e5('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe7e5('0x5'));config[_0xe7e5('0x6')]=_['defaults'](config['redis'],{'host':_0xe7e5('0x7'),'port':0x18eb});var socket=require(_0xe7e5('0x8'))(new Redis(config[_0xe7e5('0x6')]));require(_0xe7e5('0x9'))['register'](socket);exports[_0xe7e5('0xa')]=function(_0x54917b){var _0x481c5f=this;return new Promise(function(_0x7b0443,_0x4738e3){return db['User']['findAll']({'raw':_0x54917b['options']?_0x54917b[_0xe7e5('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x54917b['options']?_0x54917b['options'][_0xe7e5('0xc')]||null:null,'attributes':_0x54917b[_0xe7e5('0xb')]?_0x54917b[_0xe7e5('0xb')][_0xe7e5('0xd')]||null:null,'limit':_0x54917b['options']?_0x54917b['options']['limit']||null:null,'include':_0x54917b[_0xe7e5('0xb')]?_0x54917b[_0xe7e5('0xb')][_0xe7e5('0xe')]?_[_0xe7e5('0xf')](_0x54917b[_0xe7e5('0xb')][_0xe7e5('0xe')],function(_0x19a115){return{'model':db[_0x19a115[_0xe7e5('0x10')]],'as':_0x19a115['as'],'attributes':_0x19a115[_0xe7e5('0xd')],'include':_0x19a115['include']?_[_0xe7e5('0xf')](_0x19a115[_0xe7e5('0xe')],function(_0xe13d39){return{'model':db[_0xe13d39[_0xe7e5('0x10')]],'as':_0xe13d39['as'],'attributes':_0xe13d39['attributes'],'include':_0xe13d39['include']?_[_0xe7e5('0xf')](_0xe13d39['include'],function(_0x475c10){return{'model':db[_0x475c10[_0xe7e5('0x10')]],'as':_0x475c10['as'],'attributes':_0x475c10['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x36d628){logger[_0xe7e5('0x11')](_0xe7e5('0xa'),_0x54917b);logger[_0xe7e5('0x12')]('GetUser',_0x54917b,JSON[_0xe7e5('0x13')](_0x36d628));_0x7b0443(_0x36d628);})[_0xe7e5('0x14')](function(_0x190922){logger[_0xe7e5('0x15')](_0xe7e5('0xa'),_0x190922['message'],_0x54917b);_0x4738e3(_0x481c5f['error'](0x1f4,_0x190922[_0xe7e5('0x16')]));});});};exports[_0xe7e5('0x17')]=function(_0x378020){var _0x12e57a=this;return new Promise(function(_0x13f43e,_0xba0d2e){return db[_0xe7e5('0x18')][_0xe7e5('0x19')]({'raw':_0x378020[_0xe7e5('0xb')]?_0x378020['options'][_0xe7e5('0x1a')]===undefined?!![]:![]:!![],'where':_0x378020['options']?_0x378020['options'][_0xe7e5('0xc')]||null:null,'attributes':_0x378020['options']?_0x378020[_0xe7e5('0xb')]['attributes']||null:null,'include':_0x378020[_0xe7e5('0xb')]?_0x378020['options'][_0xe7e5('0xe')]?_[_0xe7e5('0xf')](_0x378020[_0xe7e5('0xb')][_0xe7e5('0xe')],function(_0x1c3c4a){return{'model':db[_0x1c3c4a[_0xe7e5('0x10')]],'as':_0x1c3c4a['as'],'attributes':_0x1c3c4a[_0xe7e5('0xd')],'include':_0x1c3c4a[_0xe7e5('0xe')]?_['map'](_0x1c3c4a['include'],function(_0x5716e5){return{'model':db[_0x5716e5[_0xe7e5('0x10')]],'as':_0x5716e5['as'],'attributes':_0x5716e5['attributes'],'include':_0x5716e5[_0xe7e5('0xe')]?_[_0xe7e5('0xf')](_0x5716e5['include'],function(_0x557956){return{'model':db[_0x557956[_0xe7e5('0x10')]],'as':_0x557956['as'],'attributes':_0x557956[_0xe7e5('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf5cc1d){logger[_0xe7e5('0x11')](_0xe7e5('0x17'),_0x378020);logger[_0xe7e5('0x12')](_0xe7e5('0x17'),_0x378020,JSON[_0xe7e5('0x13')](_0xf5cc1d));_0x13f43e(_0xf5cc1d);})['catch'](function(_0x4ee0cb){logger[_0xe7e5('0x15')](_0xe7e5('0x17'),_0x4ee0cb['message'],_0x378020);_0xba0d2e(_0x12e57a['error'](0x1f4,_0x4ee0cb[_0xe7e5('0x16')]));});});};exports[_0xe7e5('0x1b')]=function(_0x38be44){var _0x5eba20;return db[_0xe7e5('0x18')][_0xe7e5('0x19')]({'where':_0x38be44[_0xe7e5('0xb')][_0xe7e5('0xc')]||{},'attributes':['id',_0xe7e5('0x1c'),_0xe7e5('0x1d'),'internal',_0xe7e5('0x1e')]})[_0xe7e5('0x1f')](function(_0x2e5d98){if(!_0x2e5d98){throw new Error(util['format'](_0xe7e5('0x20'),_0x38be44[_0xe7e5('0x21')]['id']));}_0x5eba20=_0x2e5d98;return db['UserVoiceQueueRt'][_0xe7e5('0x22')]({'paused':0x1},{'where':{'UserId':_0x5eba20['id']},'individualHooks':!![]});})[_0xe7e5('0x1f')](function(){return db[_0xe7e5('0x23')][_0xe7e5('0x24')]({'where':{'membername':_0x5eba20[_0xe7e5('0x1c')],'type':_0xe7e5('0x25'),'exitAt':null}});})[_0xe7e5('0x1f')](function(_0x4e2776){if(_0x4e2776&&_0x4e2776[_0xe7e5('0x26')]){var _0x343c3f=moment()[_0xe7e5('0x27')](_0xe7e5('0x28'));for(var _0x175309=0x0,_0x59dee1=_0x4e2776[_0xe7e5('0x26')];_0x175309<_0x59dee1;_0x175309++){_0x4e2776[_0x175309]['updateAttributes']({'exitAt':_0x343c3f});}}})['then'](function(){var _0x21504e=[];var _0x271458=utils[_0xe7e5('0x29')]();_0x271458[_0xe7e5('0x2a')](function(_0xbf3e55){_0x21504e[_0xe7e5('0x2b')]({'channel':_0xbf3e55,'membername':_0x5eba20[_0xe7e5('0x1c')],'interface':_[_0xe7e5('0x2c')](_0x5eba20[_0xe7e5('0x1e')])?util['format']('SIP/%s',_0x5eba20[_0xe7e5('0x1c')]):_0x5eba20['interface'],'type':'PAUSE','enterAt':moment()[_0xe7e5('0x27')](_0xe7e5('0x28')),'data1':_0x38be44[_0xe7e5('0x2d')][_0xe7e5('0x2e')]||_0xe7e5('0x2f'),'role':_0x5eba20[_0xe7e5('0x1d')],'internal':_0x5eba20[_0xe7e5('0x30')],'uniqueid':_0x38be44[_0xe7e5('0x2d')]['uniqueid']||null});});return db[_0xe7e5('0x23')][_0xe7e5('0x31')](_0x21504e,{'individualHooks':!![]});})['then'](function(){return _0x5eba20['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x38be44[_0xe7e5('0x2d')][_0xe7e5('0x2e')]||_0xe7e5('0x2f'),'lastPauseAt':moment()[_0xe7e5('0x27')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xe7e5('0x14')](function(_0x4319db){throw _0x4319db;});};exports[_0xe7e5('0x32')]=function(_0x2436be){return Promise[_0xe7e5('0x33')]()[_0xe7e5('0x1f')](function(){if(_0x2436be[_0xe7e5('0x2d')][_0xe7e5('0x34')]&&!utils[_0xe7e5('0x35')](_0x2436be[_0xe7e5('0x2d')]['channel'])){throw new Error(util[_0xe7e5('0x27')](_0xe7e5('0x36'),_0x2436be[_0xe7e5('0x2d')][_0xe7e5('0x34')]));}return db['User']['findOne']({'where':_0x2436be['options'][_0xe7e5('0xc')]||{},'attributes':['id','name',_0xe7e5('0x1d'),_0xe7e5('0x30'),_0xe7e5('0x1e'),_0xe7e5('0x37'),'voicePause',_0xe7e5('0x38'),_0xe7e5('0x39'),_0xe7e5('0x3a'),'openchannelPause',_0xe7e5('0x3b'),_0xe7e5('0x3c'),'pauseType',_0xe7e5('0x3d')]});})[_0xe7e5('0x1f')](function(_0x51a969){if(!_0x51a969){throw new Error(util[_0xe7e5('0x27')](_0xe7e5('0x20'),_0x2436be[_0xe7e5('0x21')]['id']));}return _0x51a969[_0xe7e5('0x3e')](_0x2436be[_0xe7e5('0x2d')][_0xe7e5('0x34')],_0xe7e5('0x3f'));})[_0xe7e5('0x14')](function(_0x24dfd5){throw _0x24dfd5;});};exports[_0xe7e5('0x40')]=function(_0x33e828){var _0x261c9e=this;return new Promise(function(_0x3f65f5,_0x3d1291){var _0x26bfd2;return db['User'][_0xe7e5('0x41')]({'where':_0x33e828['options'][_0xe7e5('0xc')]||{},'attributes':['id',_0xe7e5('0x1c')]})[_0xe7e5('0x1f')](function(_0x222e19){if(_0x222e19){_0x26bfd2=_0x222e19;return db[_0xe7e5('0x42')][_0xe7e5('0x43')]({'where':{'membername':_0x26bfd2[_0xe7e5('0x1c')]},'individualHooks':!![]});}})[_0xe7e5('0x1f')](function(){if(_0x26bfd2){return db['MemberReport'][_0xe7e5('0x24')]({'where':{'membername':_0x26bfd2[_0xe7e5('0x1c')],'exitAt':null}});}})[_0xe7e5('0x1f')](function(_0x32d5b1){if(_0x26bfd2){if(_0x32d5b1&&_0x32d5b1[_0xe7e5('0x26')]){var _0x510638=[];_0x32d5b1['forEach'](function(_0x5ddd91){_0x510638[_0xe7e5('0x2b')](_0x5ddd91[_0xe7e5('0x22')]({'exitAt':moment()[_0xe7e5('0x27')](_0xe7e5('0x28'))}));});return BPromise[_0xe7e5('0x44')](_0x510638);}}})[_0xe7e5('0x1f')](function(){if(_0x26bfd2){return _0x26bfd2[_0xe7e5('0x22')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xe7e5('0x1f')](function(_0x39cb59){_0x3f65f5(_0x39cb59);})[_0xe7e5('0x14')](function(_0xed6ece){_0x3d1291(_0x261c9e[_0xe7e5('0x15')](0x1f4,_0xed6ece['message']));});});};exports[_0xe7e5('0x45')]=function(_0x2e6c65){var _0x5c1ae1=this;return new Promise(function(_0x5b9852,_0x1cbd88){var _0x295be0;var _0x43557a;var _0x548789;var _0x1873ed;return db[_0xe7e5('0x18')][_0xe7e5('0x41')]({'where':_0x2e6c65[_0xe7e5('0xb')][_0xe7e5('0xc')]||{},'attributes':['id',_0xe7e5('0x1c'),_0xe7e5('0x1d'),'mobile',_0xe7e5('0x46'),_0xe7e5('0x30'),_0xe7e5('0x47'),_0xe7e5('0x1e')]})['then'](function(_0xaa337c){if(_0xaa337c){_0x295be0=_0xaa337c;_0x1873ed=_0x2e6c65['body'][_0xe7e5('0x1e')]?_0x2e6c65[_0xe7e5('0x2d')]['interface']:util[_0xe7e5('0x27')](_0xe7e5('0x48'),_0x295be0['name']);return db[_0xe7e5('0x18')][_0xe7e5('0x49')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x295be0['id']}}});}})[_0xe7e5('0x1f')](function(_0x34d5ed){if(_0x34d5ed){_0x548789=_0x34d5ed;return require(_0xe7e5('0x4a'))[_0xe7e5('0x4b')]();}})['then'](function(_0x42309f){if(_0x42309f&&_0x42309f[_0xe7e5('0x4c')]&&_0x548789>=_0x42309f[_0xe7e5('0x4c')]){throw new Error(_0xe7e5('0x4d'));}})[_0xe7e5('0x1f')](function(){if(_0x295be0){return db[_0xe7e5('0x42')][_0xe7e5('0x43')]({'where':{'membername':_0x295be0[_0xe7e5('0x1c')]},'individualHooks':!![]});}})[_0xe7e5('0x1f')](function(){if(_0x295be0){return _0x295be0['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x2d61cd){if(_0x295be0){if(_0x2d61cd){var _0x45449=[];_0x43557a=_0x2d61cd;if(_0x43557a['length']){for(var _0x5f18c3=0x0;_0x5f18c3<_0x43557a[_0xe7e5('0x26')];_0x5f18c3++){_0x45449[_0xe7e5('0x2b')](db[_0xe7e5('0x42')][_0xe7e5('0x4e')]({'membername':_0x295be0['name'],'UserId':_0x295be0['id'],'queue_name':_0x43557a[_0x5f18c3][_0xe7e5('0x1c')],'VoiceQueueId':_0x43557a[_0x5f18c3]['id'],'interface':_0x1873ed,'paused':_0x295be0['loginInPause']||![],'penalty':_0x43557a[_0x5f18c3][_0xe7e5('0x4f')]||0x0}));}return BPromise[_0xe7e5('0x44')](_0x45449);}}}})[_0xe7e5('0x1f')](function(){if(_0x295be0){return db[_0xe7e5('0x23')]['findAll']({'where':{'membername':_0x295be0['name'],'exitAt':null}});}})[_0xe7e5('0x1f')](function(_0x17918c){if(_0x295be0){if(_0x17918c&&_0x17918c[_0xe7e5('0x26')]){var _0x25737a=[];_0x17918c[_0xe7e5('0x2a')](function(_0x420649){_0x25737a['push'](_0x420649[_0xe7e5('0x22')]({'exitAt':moment()[_0xe7e5('0x27')](_0xe7e5('0x28'))}));});return BPromise[_0xe7e5('0x44')](_0x25737a);}}})['then'](function(){if(_0x295be0){var _0x3f7aad=[];var _0x5174aa=[];var _0x1e0916=utils['getChannels']();var _0x36848b={'membername':_0x295be0[_0xe7e5('0x1c')],'interface':_0x1873ed,'enterAt':moment()[_0xe7e5('0x27')](_0xe7e5('0x28')),'role':_0x295be0[_0xe7e5('0x1d')],'internal':_0x295be0[_0xe7e5('0x30')]};_0x1e0916['forEach'](function(_0x17d946){_0x3f7aad['push'](_[_0xe7e5('0x50')]({'channel':_0x17d946,'type':_0xe7e5('0x51'),'data1':_0xe7e5('0x52'),'data2':_0x1873ed},_0x36848b));if(_0x295be0[_0xe7e5('0x47')]){_0x5174aa['push'](_[_0xe7e5('0x50')]({'channel':_0x17d946,'type':_0xe7e5('0x25'),'data1':_0xe7e5('0x53')},_0x36848b));}});return db[_0xe7e5('0x23')]['bulkCreate'](_0x3f7aad[_0xe7e5('0x54')](_0x5174aa),{'individualHooks':!![]});}})[_0xe7e5('0x1f')](function(){if(_0x295be0){return _0x295be0[_0xe7e5('0x22')]({'online':!![],'lastLoginAt':moment()[_0xe7e5('0x27')](_0xe7e5('0x28')),'voicePause':_0x295be0['loginInPause']||![],'mailPause':_0x295be0['loginInPause']||![],'chatPause':_0x295be0[_0xe7e5('0x47')]||![],'faxPause':_0x295be0['loginInPause']||![],'smsPause':_0x295be0[_0xe7e5('0x47')]||![],'openchannelPause':_0x295be0[_0xe7e5('0x47')]||![],'pauseType':_0x295be0[_0xe7e5('0x47')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xe7e5('0x27')](_0xe7e5('0x28')),'interface':_0x1873ed});}})[_0xe7e5('0x1f')](function(_0x2eab02){_0x5b9852(_0x2eab02);})[_0xe7e5('0x14')](function(_0x43afbf){_0x1cbd88(_0x5c1ae1[_0xe7e5('0x15')](0x1f4,_0x43afbf[_0xe7e5('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 24fd315..40c71ac 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 _0xbb52=['remove','emit','removeListener','user:','./user.events'];(function(_0x1c3c47,_0x59fd36){var _0x1582b9=function(_0x436c3c){while(--_0x436c3c){_0x1c3c47['push'](_0x1c3c47['shift']());}};_0x1582b9(++_0x59fd36);}(_0xbb52,0x130));var _0x2bb5=function(_0x5b1c50,_0x56e694){_0x5b1c50=_0x5b1c50-0x0;var _0x2d379b=_0xbb52[_0x5b1c50];return _0x2d379b;};'use strict';var UserEvents=require(_0x2bb5('0x0'));var events=['save',_0x2bb5('0x1'),'update'];function createListener(_0x3b0415,_0x3049ed){return function(_0x17de02){_0x3049ed[_0x2bb5('0x2')](_0x3b0415,_0x17de02);};}function removeListener(_0x9a0b9a,_0x28d851){return function(){UserEvents[_0x2bb5('0x3')](_0x9a0b9a,_0x28d851);};}exports['register']=function(_0x631b51){for(var _0x4aeb6e=0x0,_0x21148f=events['length'];_0x4aeb6e<_0x21148f;_0x4aeb6e++){var _0x1db184=events[_0x4aeb6e];var _0x34fa79=createListener(_0x2bb5('0x4')+_0x1db184,_0x631b51);UserEvents['on'](_0x1db184,_0x34fa79);}}; \ No newline at end of file +var _0x9fab=['update','./user.events','save','remove'];(function(_0x370752,_0x114958){var _0x1daba3=function(_0x288503){while(--_0x288503){_0x370752['push'](_0x370752['shift']());}};_0x1daba3(++_0x114958);}(_0x9fab,0x135));var _0xb9fa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9fab[_0x3dd15e];return _0x231fd0;};'use strict';var UserEvents=require(_0xb9fa('0x0'));var events=[_0xb9fa('0x1'),_0xb9fa('0x2'),_0xb9fa('0x3')];function createListener(_0x918be7,_0xfb36a0){return function(_0x23be09){_0xfb36a0['emit'](_0x918be7,_0x23be09);};}function removeListener(_0x20937b,_0xd0b37c){return function(){UserEvents['removeListener'](_0x20937b,_0xd0b37c);};}exports['register']=function(_0x470271){for(var _0xe2a7a=0x0,_0x271ee5=events['length'];_0xe2a7a<_0x271ee5;_0xe2a7a++){var _0x153378=events[_0xe2a7a];var _0x46d93a=createListener('user:'+_0x153378,_0x470271);UserEvents['on'](_0x153378,_0x46d93a);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index b533437..a9dcf2a 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x47af00,_0x1b9de3){var _0x2c97a8=function(_0x8b72d7){while(--_0x8b72d7){_0x47af00['push'](_0x47af00['shift']());}};_0x2c97a8(++_0x1b9de3);}(_0x70e0,0x17b));var _0x070e=function(_0x29cdc4,_0x59ad6f){_0x29cdc4=_0x29cdc4-0x0;var _0x4dc9e8=_0x70e0[_0x29cdc4];return _0x4dc9e8;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1da66d,_0x53e0da){var _0xfa4180=function(_0x4fa2b9){while(--_0x4fa2b9){_0x1da66d['push'](_0x1da66d['shift']());}};_0xfa4180(++_0x53e0da);}(_0x70e0,0x17b));var _0x070e=function(_0x4111fd,_0xc0597c){_0x4111fd=_0x4111fd-0x0;var _0x332f21=_0x70e0[_0x4111fd];return _0x332f21;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index daadf27..3ff4a02 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 _0xc93d=['sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc93d,0x64));var _0xdc93=function(_0x3e531a,_0x28a82a){_0x3e531a=_0x3e531a-0x0;var _0x3c2574=_0xc93d[_0x3e531a];return _0x3c2574;};'use strict';var Sequelize=require(_0xdc93('0x0'));module[_0xdc93('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x20c9=['sequelize','exports','INTEGER'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x20c9,0x108));var _0x920c=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x20c9[_0xef8146];return _0x5a6cb0;};'use strict';var Sequelize=require(_0x920c('0x0'));module[_0x920c('0x1')]={'penalty':{'type':Sequelize[_0x920c('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index f8a4029..0c1e577 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 _0xbe50=['UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define'];(function(_0x13855f,_0x17f2a8){var _0x5980a9=function(_0x275c52){while(--_0x275c52){_0x13855f['push'](_0x13855f['shift']());}};_0x5980a9(++_0x17f2a8);}(_0xbe50,0x144));var _0x0be5=function(_0x1e6f9a,_0x37c6d8){_0x1e6f9a=_0x1e6f9a-0x0;var _0x2b65b0=_0xbe50[_0x1e6f9a];return _0x2b65b0;};'use strict';var _=require(_0x0be5('0x0'));var util=require(_0x0be5('0x1'));var logger=require(_0x0be5('0x2'))(_0x0be5('0x3'));var moment=require('moment');var BPromise=require(_0x0be5('0x4'));var rp=require(_0x0be5('0x5'));var fs=require('fs');var path=require(_0x0be5('0x6'));var rimraf=require(_0x0be5('0x7'));var config=require(_0x0be5('0x8'));var attributes=require(_0x0be5('0x9'));module[_0x0be5('0xa')]=function(_0x3f6492,_0x279e72){return _0x3f6492[_0x0be5('0xb')](_0x0be5('0xc'),attributes,{'tableName':_0x0be5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9276=['../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x8cb31b,_0x509016){var _0x2ce32e=function(_0x1e6f4a){while(--_0x1e6f4a){_0x8cb31b['push'](_0x8cb31b['shift']());}};_0x2ce32e(++_0x509016);}(_0x9276,0x199));var _0x6927=function(_0x454979,_0x1efab1){_0x454979=_0x454979-0x0;var _0x22e7cf=_0x9276[_0x454979];return _0x22e7cf;};'use strict';var _=require('lodash');var util=require(_0x6927('0x0'));var logger=require(_0x6927('0x1'))(_0x6927('0x2'));var moment=require(_0x6927('0x3'));var BPromise=require(_0x6927('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6927('0x5'));var rimraf=require(_0x6927('0x6'));var config=require(_0x6927('0x7'));var attributes=require(_0x6927('0x8'));module[_0x6927('0x9')]=function(_0x5c7050,_0x2cc6c2){return _0x5c7050[_0x6927('0xa')](_0x6927('0xb'),attributes,{'tableName':_0x6927('0xc'),'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 3f58cfa..ab505ac 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 _0x7a55=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x5fbae,_0x39eece){var _0x22fa74=function(_0x4cffc9){while(--_0x4cffc9){_0x5fbae['push'](_0x5fbae['shift']());}};_0x22fa74(++_0x39eece);}(_0x7a55,0xad));var _0x57a5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7a55[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x57a5('0x0'));var util=require(_0x57a5('0x1'));var moment=require(_0x57a5('0x2'));var BPromise=require(_0x57a5('0x3'));var rs=require(_0x57a5('0x4'));var fs=require('fs');var Redis=require(_0x57a5('0x5'));var db=require(_0x57a5('0x6'))['db'];var utils=require(_0x57a5('0x7'));var logger=require(_0x57a5('0x8'))('rpc');var config=require(_0x57a5('0x9'));var jayson=require(_0x57a5('0xa'));var client=jayson[_0x57a5('0xb')][_0x57a5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x534204,_0x2d2f06,_0xe316b1){return new BPromise(function(_0x57bf4f,_0x2a4d22){return client['request'](_0x534204,_0xe316b1)[_0x57a5('0xd')](function(_0x593d55){logger[_0x57a5('0xe')](_0x57a5('0xf'),_0x2d2f06,_0x57a5('0x10'));logger[_0x57a5('0x11')](_0x57a5('0x12'),_0x2d2f06,_0x57a5('0x10'),JSON[_0x57a5('0x13')](_0x593d55));if(_0x593d55['error']){if(_0x593d55[_0x57a5('0x14')]['code']===0x1f4){logger[_0x57a5('0x14')]('UserChatQueue,\x20%s,\x20%s',_0x2d2f06,_0x593d55[_0x57a5('0x14')]['message']);return _0x2a4d22(_0x593d55[_0x57a5('0x14')][_0x57a5('0x15')]);}logger[_0x57a5('0x14')](_0x57a5('0xf'),_0x2d2f06,_0x593d55[_0x57a5('0x14')]['message']);return _0x57bf4f(_0x593d55['error'][_0x57a5('0x15')]);}else{logger[_0x57a5('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x2d2f06,'request\x20sent');_0x57bf4f(_0x593d55[_0x57a5('0x16')]['message']);}})[_0x57a5('0x17')](function(_0x4afa19){logger[_0x57a5('0x14')]('UserChatQueue,\x20%s,\x20%s',_0x2d2f06,_0x4afa19);_0x2a4d22(_0x4afa19);});});} \ No newline at end of file +var _0xe4bc=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util','moment'];(function(_0x33f926,_0xaac7e5){var _0x207955=function(_0x6d0b8a){while(--_0x6d0b8a){_0x33f926['push'](_0x33f926['shift']());}};_0x207955(++_0xaac7e5);}(_0xe4bc,0x167));var _0xce4b=function(_0xc1fcb4,_0x14f85f){_0xc1fcb4=_0xc1fcb4-0x0;var _0x165912=_0xe4bc[_0xc1fcb4];return _0x165912;};'use strict';var _=require('lodash');var util=require(_0xce4b('0x0'));var moment=require(_0xce4b('0x1'));var BPromise=require('bluebird');var rs=require(_0xce4b('0x2'));var fs=require('fs');var Redis=require(_0xce4b('0x3'));var db=require(_0xce4b('0x4'))['db'];var utils=require(_0xce4b('0x5'));var logger=require(_0xce4b('0x6'))(_0xce4b('0x7'));var config=require('../../config/environment');var jayson=require(_0xce4b('0x8'));var client=jayson[_0xce4b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a2be,_0x52a509,_0x5f39e0){return new BPromise(function(_0xaf4b9d,_0x3edc04){return client[_0xce4b('0xa')](_0x41a2be,_0x5f39e0)[_0xce4b('0xb')](function(_0x1bcea1){logger[_0xce4b('0xc')](_0xce4b('0xd'),_0x52a509,_0xce4b('0xe'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x52a509,_0xce4b('0xe'),JSON[_0xce4b('0xf')](_0x1bcea1));if(_0x1bcea1[_0xce4b('0x10')]){if(_0x1bcea1[_0xce4b('0x10')]['code']===0x1f4){logger[_0xce4b('0x10')](_0xce4b('0xd'),_0x52a509,_0x1bcea1[_0xce4b('0x10')][_0xce4b('0x11')]);return _0x3edc04(_0x1bcea1['error']['message']);}logger[_0xce4b('0x10')](_0xce4b('0xd'),_0x52a509,_0x1bcea1[_0xce4b('0x10')][_0xce4b('0x11')]);return _0xaf4b9d(_0x1bcea1[_0xce4b('0x10')][_0xce4b('0x11')]);}else{logger[_0xce4b('0xc')](_0xce4b('0xd'),_0x52a509,'request\x20sent');_0xaf4b9d(_0x1bcea1[_0xce4b('0x12')][_0xce4b('0x11')]);}})['catch'](function(_0x4af71a){logger[_0xce4b('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x52a509,_0x4af71a);_0x3edc04(_0x4af71a);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 511df18..7d94439 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x23cad2,_0x5f1c76){var _0x172c10=function(_0x12ff8c){while(--_0x12ff8c){_0x23cad2['push'](_0x23cad2['shift']());}};_0x172c10(++_0x5f1c76);}(_0xedd9,0xfc));var _0x9edd=function(_0x214093,_0x59fd9a){_0x214093=_0x214093-0x0;var _0x225fe6=_0xedd9[_0x214093];return _0x225fe6;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x416a0a,_0x24f91f){var _0x574c9f=function(_0x44b83e){while(--_0x44b83e){_0x416a0a['push'](_0x416a0a['shift']());}};_0x574c9f(++_0x24f91f);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 2158612..6c99b8d 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 _0x2cc1=['INTEGER','STRING','sequelize'];(function(_0x37b23d,_0x5295a1){var _0x831b6e=function(_0x3342ca){while(--_0x3342ca){_0x37b23d['push'](_0x37b23d['shift']());}};_0x831b6e(++_0x5295a1);}(_0x2cc1,0x74));var _0x12cc=function(_0x3e618a,_0x135251){_0x3e618a=_0x3e618a-0x0;var _0x1f3d61=_0x2cc1[_0x3e618a];return _0x1f3d61;};'use strict';var Sequelize=require(_0x12cc('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x12cc('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x12cc('0x2')]}}; \ No newline at end of file +var _0x207f=['STRING','sequelize','exports','INTEGER'];(function(_0x2f6541,_0x363cba){var _0x4d76d8=function(_0x86404){while(--_0x86404){_0x2f6541['push'](_0x2f6541['shift']());}};_0x4d76d8(++_0x363cba);}(_0x207f,0x1cd));var _0xf207=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x207f[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xf207('0x0'));module[_0xf207('0x1')]={'penalty':{'type':Sequelize[_0xf207('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xf207('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 521bb36..9abd285 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 _0xcb47=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash','util'];(function(_0x4f018d,_0x2913f4){var _0x521c03=function(_0x30031d){while(--_0x30031d){_0x4f018d['push'](_0x4f018d['shift']());}};_0x521c03(++_0x2913f4);}(_0xcb47,0x1c5));var _0x7cb4=function(_0x3ef2d5,_0x423d46){_0x3ef2d5=_0x3ef2d5-0x0;var _0x2fefb2=_0xcb47[_0x3ef2d5];return _0x2fefb2;};'use strict';var _=require(_0x7cb4('0x0'));var util=require(_0x7cb4('0x1'));var logger=require(_0x7cb4('0x2'))('api');var moment=require(_0x7cb4('0x3'));var BPromise=require(_0x7cb4('0x4'));var rp=require(_0x7cb4('0x5'));var fs=require('fs');var path=require(_0x7cb4('0x6'));var rimraf=require(_0x7cb4('0x7'));var config=require(_0x7cb4('0x8'));var attributes=require(_0x7cb4('0x9'));module[_0x7cb4('0xa')]=function(_0x1d125e,_0x47eb49){return _0x1d125e[_0x7cb4('0xb')](_0x7cb4('0xc'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3a6=['path','rimraf','../../config/environment','define','UserFaxQueue','lodash','util','api','moment','bluebird','request-promise'];(function(_0x49b6e2,_0x4770b4){var _0x5ca1ec=function(_0x4d2a28){while(--_0x4d2a28){_0x49b6e2['push'](_0x49b6e2['shift']());}};_0x5ca1ec(++_0x4770b4);}(_0xb3a6,0x15a));var _0x6b3a=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0xb3a6[_0x2b5513];return _0x578fd2;};'use strict';var _=require(_0x6b3a('0x0'));var util=require(_0x6b3a('0x1'));var logger=require('../../config/logger')(_0x6b3a('0x2'));var moment=require(_0x6b3a('0x3'));var BPromise=require(_0x6b3a('0x4'));var rp=require(_0x6b3a('0x5'));var fs=require('fs');var path=require(_0x6b3a('0x6'));var rimraf=require(_0x6b3a('0x7'));var config=require(_0x6b3a('0x8'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x40ad58,_0x1be1d9){return _0x40ad58[_0x6b3a('0x9')](_0x6b3a('0xa'),attributes,{'tableName':'user_has_fax_queues','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 9328599..0da23aa 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 _0xae8f=['then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request'];(function(_0x5b47ba,_0x29b2eb){var _0x41b776=function(_0x3789d5){while(--_0x3789d5){_0x5b47ba['push'](_0x5b47ba['shift']());}};_0x41b776(++_0x29b2eb);}(_0xae8f,0xd0));var _0xfae8=function(_0xe56790,_0x5f304d){_0xe56790=_0xe56790-0x0;var _0x145cf7=_0xae8f[_0xe56790];return _0x145cf7;};'use strict';var _=require('lodash');var util=require(_0xfae8('0x0'));var moment=require(_0xfae8('0x1'));var BPromise=require(_0xfae8('0x2'));var rs=require(_0xfae8('0x3'));var fs=require('fs');var Redis=require(_0xfae8('0x4'));var db=require(_0xfae8('0x5'))['db'];var utils=require(_0xfae8('0x6'));var logger=require('../../config/logger')(_0xfae8('0x7'));var config=require(_0xfae8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfae8('0x9')][_0xfae8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4607d3,_0x4bf39e,_0x1560ad){return new BPromise(function(_0x21e4a0,_0x2b3157){return client[_0xfae8('0xb')](_0x4607d3,_0x1560ad)[_0xfae8('0xc')](function(_0x39a142){logger[_0xfae8('0xd')](_0xfae8('0xe'),_0x4bf39e,_0xfae8('0xf'));logger[_0xfae8('0x10')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x4bf39e,'request\x20sent',JSON[_0xfae8('0x11')](_0x39a142));if(_0x39a142['error']){if(_0x39a142[_0xfae8('0x12')]['code']===0x1f4){logger[_0xfae8('0x12')](_0xfae8('0xe'),_0x4bf39e,_0x39a142[_0xfae8('0x12')][_0xfae8('0x13')]);return _0x2b3157(_0x39a142[_0xfae8('0x12')][_0xfae8('0x13')]);}logger['error'](_0xfae8('0xe'),_0x4bf39e,_0x39a142[_0xfae8('0x12')]['message']);return _0x21e4a0(_0x39a142[_0xfae8('0x12')][_0xfae8('0x13')]);}else{logger[_0xfae8('0xd')](_0xfae8('0xe'),_0x4bf39e,_0xfae8('0xf'));_0x21e4a0(_0x39a142[_0xfae8('0x14')][_0xfae8('0x13')]);}})[_0xfae8('0x15')](function(_0x54fae8){logger[_0xfae8('0x12')](_0xfae8('0xe'),_0x4bf39e,_0x54fae8);_0x2b3157(_0x54fae8);});});} \ No newline at end of file +var _0x58fc=['client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0xee5d2a,_0x534134){var _0x346948=function(_0x458fdf){while(--_0x458fdf){_0xee5d2a['push'](_0xee5d2a['shift']());}};_0x346948(++_0x534134);}(_0x58fc,0xd3));var _0xc58f=function(_0x552bae,_0x16eda1){_0x552bae=_0x552bae-0x0;var _0x147c59=_0x58fc[_0x552bae];return _0x147c59;};'use strict';var _=require('lodash');var util=require(_0xc58f('0x0'));var moment=require(_0xc58f('0x1'));var BPromise=require(_0xc58f('0x2'));var rs=require(_0xc58f('0x3'));var fs=require('fs');var Redis=require(_0xc58f('0x4'));var db=require(_0xc58f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc58f('0x6'));var config=require(_0xc58f('0x7'));var jayson=require(_0xc58f('0x8'));var client=jayson[_0xc58f('0x9')][_0xc58f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5579f5,_0x518ed6,_0x54913f){return new BPromise(function(_0x4f37bf,_0x510885){return client[_0xc58f('0xb')](_0x5579f5,_0x54913f)[_0xc58f('0xc')](function(_0x245005){logger[_0xc58f('0xd')](_0xc58f('0xe'),_0x518ed6,_0xc58f('0xf'));logger['debug'](_0xc58f('0x10'),_0x518ed6,'request\x20sent',JSON[_0xc58f('0x11')](_0x245005));if(_0x245005['error']){if(_0x245005[_0xc58f('0x12')][_0xc58f('0x13')]===0x1f4){logger[_0xc58f('0x12')](_0xc58f('0xe'),_0x518ed6,_0x245005[_0xc58f('0x12')]['message']);return _0x510885(_0x245005[_0xc58f('0x12')]['message']);}logger[_0xc58f('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x518ed6,_0x245005[_0xc58f('0x12')][_0xc58f('0x14')]);return _0x4f37bf(_0x245005[_0xc58f('0x12')][_0xc58f('0x14')]);}else{logger['info'](_0xc58f('0xe'),_0x518ed6,_0xc58f('0xf'));_0x4f37bf(_0x245005[_0xc58f('0x15')][_0xc58f('0x14')]);}})['catch'](function(_0x52b7cd){logger[_0xc58f('0x12')](_0xc58f('0xe'),_0x518ed6,_0x52b7cd);_0x510885(_0x52b7cd);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 46a2ccd..d5aea52 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x282ac4,_0x556ae3){var _0x188ced=function(_0x508176){while(--_0x508176){_0x282ac4['push'](_0x282ac4['shift']());}};_0x188ced(++_0x556ae3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2f3cca,_0x3e232f){var _0x3105c7=function(_0x584e67){while(--_0x584e67){_0x2f3cca['push'](_0x2f3cca['shift']());}};_0x3105c7(++_0x3e232f);}(_0x70e0,0x17b));var _0x070e=function(_0x536838,_0x49a7d7){_0x536838=_0x536838-0x0;var _0x4e0ca7=_0x70e0[_0x536838];return _0x4e0ca7;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 1d040ab..41a15eb 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 _0xf2d7=['INTEGER','sequelize'];(function(_0x2e1d13,_0x3f96d4){var _0x33b4e6=function(_0x1a7130){while(--_0x1a7130){_0x2e1d13['push'](_0x2e1d13['shift']());}};_0x33b4e6(++_0x3f96d4);}(_0xf2d7,0x121));var _0x7f2d=function(_0x47805c,_0x24ad9a){_0x47805c=_0x47805c-0x0;var _0x499ab7=_0xf2d7[_0x47805c];return _0x499ab7;};'use strict';var Sequelize=require(_0x7f2d('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7f2d('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd709=['exports','INTEGER','sequelize'];(function(_0x330997,_0x33302c){var _0x43eb92=function(_0x823e6f){while(--_0x823e6f){_0x330997['push'](_0x330997['shift']());}};_0x43eb92(++_0x33302c);}(_0xd709,0x7d));var _0x9d70=function(_0x5b0e13,_0x51ff8c){_0x5b0e13=_0x5b0e13-0x0;var _0x9258c8=_0xd709[_0x5b0e13];return _0x9258c8;};'use strict';var Sequelize=require(_0x9d70('0x0'));module[_0x9d70('0x1')]={'penalty':{'type':Sequelize[_0x9d70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index fc8f00c..9ea84b1 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 _0x90da=['bluebird','request-promise','../../config/environment','./userMailQueue.attributes','UserMailQueue','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x90da,0x11d));var _0xa90d=function(_0xc0ef15,_0x4b5301){_0xc0ef15=_0xc0ef15-0x0;var _0x228141=_0x90da[_0xc0ef15];return _0x228141;};'use strict';var _=require(_0xa90d('0x0'));var util=require(_0xa90d('0x1'));var logger=require(_0xa90d('0x2'))(_0xa90d('0x3'));var moment=require(_0xa90d('0x4'));var BPromise=require(_0xa90d('0x5'));var rp=require(_0xa90d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa90d('0x7'));var attributes=require(_0xa90d('0x8'));module['exports']=function(_0x535b72,_0x2bf127){return _0x535b72['define'](_0xa90d('0x9'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8909=['./userMailQueue.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x12e8d5,_0x4be36a){var _0xf7964e=function(_0x33bf66){while(--_0x33bf66){_0x12e8d5['push'](_0x12e8d5['shift']());}};_0xf7964e(++_0x4be36a);}(_0x8909,0x12f));var _0x9890=function(_0xe84805,_0x2702d9){_0xe84805=_0xe84805-0x0;var _0x398efd=_0x8909[_0xe84805];return _0x398efd;};'use strict';var _=require(_0x9890('0x0'));var util=require(_0x9890('0x1'));var logger=require(_0x9890('0x2'))(_0x9890('0x3'));var moment=require(_0x9890('0x4'));var BPromise=require(_0x9890('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9890('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9890('0x7'));module[_0x9890('0x8')]=function(_0x157c15,_0x4c2f63){return _0x157c15[_0x9890('0x9')]('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','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 607295f..f8e986c 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 _0xa41a=['rpc','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3b2e2c,_0x162ed9){var _0x5aa99d=function(_0x10846e){while(--_0x10846e){_0x3b2e2c['push'](_0x3b2e2c['shift']());}};_0x5aa99d(++_0x162ed9);}(_0xa41a,0x6b));var _0xaa41=function(_0x16c0a8,_0x41029c){_0x16c0a8=_0x16c0a8-0x0;var _0x2b5080=_0xa41a[_0x16c0a8];return _0x2b5080;};'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);});});} \ No newline at end of file +var _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x57f7bd,_0x438e81){var _0x7f7a5a=function(_0x1abe55){while(--_0x1abe55){_0x57f7bd['push'](_0x57f7bd['shift']());}};_0x7f7a5a(++_0x438e81);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x00bb[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index bac1b0a..c4b3ac7 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 _0x367f=['../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x69117c,_0x50c5bd){var _0x123f81=function(_0x293e71){while(--_0x293e71){_0x69117c['push'](_0x69117c['shift']());}};_0x123f81(++_0x50c5bd);}(_0x367f,0x1db));var _0xf367=function(_0x4eb3ef,_0x5a1a57){_0x4eb3ef=_0x4eb3ef-0x0;var _0x156c88=_0x367f[_0x4eb3ef];return _0x156c88;};'use strict';var multer=require(_0xf367('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf367('0x1'));var express=require('express');var router=express[_0xf367('0x2')]();var fs_extra=require(_0xf367('0x3'));var auth=require(_0xf367('0x4'));var interaction=require(_0xf367('0x5'));var config=require(_0xf367('0x6'));var controller=require(_0xf367('0x7'));router[_0xf367('0x8')]('/',auth[_0xf367('0x9')](),controller[_0xf367('0xa')]);module[_0xf367('0xb')]=router; \ No newline at end of file +var _0x3877=['../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3877,0x16e));var _0x7387=function(_0x391935,_0x3fb9aa){_0x391935=_0x391935-0x0;var _0x6cf66e=_0x3877[_0x391935];return _0x6cf66e;};'use strict';var multer=require(_0x7387('0x0'));var util=require('util');var path=require(_0x7387('0x1'));var timeout=require(_0x7387('0x2'));var express=require('express');var router=express[_0x7387('0x3')]();var fs_extra=require(_0x7387('0x4'));var auth=require(_0x7387('0x5'));var interaction=require(_0x7387('0x6'));var config=require(_0x7387('0x7'));var controller=require(_0x7387('0x8'));router[_0x7387('0x9')]('/',auth[_0x7387('0xa')](),controller[_0x7387('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index c835561..4185e3f 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 _0xf377=['TEXT','sequelize'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0xf377,0x1c1));var _0x7f37=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xf377[_0x2b5eae];return _0x5f3ac9;};'use strict';var Sequelize=require(_0x7f37('0x0'));module['exports']={'body':{'type':Sequelize[_0x7f37('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x7f37('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x7c79=['BOOLEAN','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c79,0x105));var _0x97c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c79[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x97c7('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x97c7('0x1')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index cb714ce..aa7d5b5 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 _0x907b=['mailqueue','smsqueue','voicequeue','whatsappqueue','user','some','includes','model','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','SenderId','recipientsId','sortBy','join','transaction','create','beep','forEach','recipient','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','queue','Queue','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./userNotification.socket','register','sendStatus','end','status','undefined','limit','count','offset','json','apply','update','destroy','then','error','stack','name','send','hasOwnProperty','text','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','body','view','Missing\x20\x27view\x27\x20parameter','recipients','Sequelize','ValidationError','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue'];(function(_0x302fcf,_0x4e4901){var _0x2de7b7=function(_0x1fcdd2){while(--_0x1fcdd2){_0x302fcf['push'](_0x302fcf['shift']());}};_0x2de7b7(++_0x4e4901);}(_0x907b,0xe6));var _0xb907=function(_0x41382c,_0xc3ffd1){_0x41382c=_0x41382c-0x0;var _0x4da35b=_0x907b[_0x41382c];return _0x4da35b;};'use strict';var emlformat=require(_0xb907('0x0'));var rimraf=require(_0xb907('0x1'));var zipdir=require(_0xb907('0x2'));var jsonpatch=require(_0xb907('0x3'));var rp=require(_0xb907('0x4'));var moment=require(_0xb907('0x5'));var BPromise=require(_0xb907('0x6'));var Mustache=require(_0xb907('0x7'));var util=require(_0xb907('0x8'));var path=require(_0xb907('0x9'));var sox=require('sox');var csv=require(_0xb907('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb907('0xb'));var _=require(_0xb907('0xc'));var squel=require(_0xb907('0xd'));var crypto=require(_0xb907('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb907('0xf'));var toCsv=require(_0xb907('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb907('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb907('0x11'));var as=require(_0xb907('0x12'));var hardwareService=require(_0xb907('0x13'));var logger=require('../../config/logger')(_0xb907('0x14'));var utils=require('../../config/utils');var config=require(_0xb907('0x15'));var licenseUtil=require(_0xb907('0x16'));var db=require(_0xb907('0x17'))['db'];config[_0xb907('0x18')]=_[_0xb907('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb907('0x1a'))[_0xb907('0x1b')](socket);function respondWithStatusCode(_0x29847e,_0x32da89){_0x32da89=_0x32da89||0xcc;return function(_0x1d9012){if(_0x1d9012){return _0x29847e[_0xb907('0x1c')](_0x32da89);}return _0x29847e['status'](_0x32da89)[_0xb907('0x1d')]();};}function respondWithResult(_0x2bbf7b,_0x9767b2){_0x9767b2=_0x9767b2||0xc8;return function(_0x5e7e2a){if(_0x5e7e2a){return _0x2bbf7b[_0xb907('0x1e')](_0x9767b2)['json'](_0x5e7e2a);}};}function respondWithFilteredResult(_0xa95bee,_0x39f934){return function(_0x555bd0){if(_0x555bd0){var _0x4fd3fb=typeof _0x39f934['offset']===_0xb907('0x1f')&&typeof _0x39f934[_0xb907('0x20')]===_0xb907('0x1f');var _0x3c3741=_0x555bd0[_0xb907('0x21')];var _0x3544dd=_0x4fd3fb?0x0:_0x39f934['offset'];var _0x423c89=_0x4fd3fb?_0x555bd0['count']:_0x39f934[_0xb907('0x22')]+_0x39f934[_0xb907('0x20')];var _0x364f3f;if(_0x423c89>=_0x3c3741){_0x423c89=_0x3c3741;_0x364f3f=0xc8;}else{_0x364f3f=0xce;}_0xa95bee[_0xb907('0x1e')](_0x364f3f);return _0xa95bee['set']('Content-Range',_0x3544dd+'-'+_0x423c89+'/'+_0x3c3741)[_0xb907('0x23')](_0x555bd0);}return null;};}function patchUpdates(_0x532fc3){return function(_0x4c6303){try{jsonpatch[_0xb907('0x24')](_0x4c6303,_0x532fc3,!![]);}catch(_0x5e5c1e){return BPromise['reject'](_0x5e5c1e);}return _0x4c6303['save']();};}function saveUpdates(_0x477a8c,_0x36c8aa){return function(_0x232d23){if(_0x232d23){return _0x232d23[_0xb907('0x25')](_0x477a8c)['then'](function(_0x552dd7){return _0x552dd7;});}return null;};}function removeEntity(_0xf5c4f3,_0x158fd0){return function(_0x1ea037){if(_0x1ea037){return _0x1ea037[_0xb907('0x26')]()[_0xb907('0x27')](function(){_0xf5c4f3[_0xb907('0x1e')](0xcc)[_0xb907('0x1d')]();});}};}function handleEntityNotFound(_0x40d7b8,_0x2f0639){return function(_0x36e054){if(!_0x36e054){_0x40d7b8['sendStatus'](0x194);}return _0x36e054;};}function handleError(_0xd94d46,_0x34d491){_0x34d491=_0x34d491||0x1f4;return function(_0x41fac3){logger[_0xb907('0x28')](_0x41fac3[_0xb907('0x29')]);if(_0x41fac3[_0xb907('0x2a')]){delete _0x41fac3['name'];}_0xd94d46[_0xb907('0x1e')](_0x34d491)[_0xb907('0x2b')](_0x41fac3);};}exports['sendUserNotification']=function(_0x4ea8c2,_0x1e8fbd,_0x5cf362){if(!_0x4ea8c2['body'][_0xb907('0x2c')](_0xb907('0x2d'))&&!_0x4ea8c2['body']['hasOwnProperty'](_0xb907('0x2e'))){throw new db['Sequelize']['ValidationError'](_0xb907('0x2f'));}else{if(_0x4ea8c2[_0xb907('0x30')]['hasOwnProperty']('TemplateId')&&!_0x4ea8c2['body'][_0xb907('0x2c')](_0xb907('0x31'))){throw new db['Sequelize']['ValidationError'](_0xb907('0x32'));}if(!_0x4ea8c2[_0xb907('0x30')][_0xb907('0x2c')](_0xb907('0x33'))){throw new db[(_0xb907('0x34'))][(_0xb907('0x35'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x1108a4=JSON[_0xb907('0x36')](_0x4ea8c2[_0xb907('0x30')][_0xb907('0x33')]);}catch(_0x5e6650){logger[_0xb907('0x28')](_0x5e6650);throw new db[(_0xb907('0x34'))][(_0xb907('0x35'))](_0xb907('0x37'));}var _0x216a78=[_0xb907('0x38'),_0xb907('0x39'),_0xb907('0x3a'),'openchannelqueue',_0xb907('0x3b'),_0xb907('0x3c'),_0xb907('0x3d'),'team',_0xb907('0x3e')];if(_[_0xb907('0x3f')](_0x1108a4,function(_0x1132ec){return!_[_0xb907('0x40')](_0x216a78,_0x1132ec[_0xb907('0x41')][_0xb907('0x42')]());})){throw new db[(_0xb907('0x34'))][(_0xb907('0x35'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x478701={};_0x478701[_0xb907('0x43')]=_0x4ea8c2[_0xb907('0x30')][_0xb907('0x2c')](_0xb907('0x43'))?_0x4ea8c2[_0xb907('0x30')][_0xb907('0x43')]:_0x4ea8c2[_0xb907('0x3e')][_0xb907('0x44')];_0x478701[_0xb907('0x45')]=_[_0xb907('0x46')](_0x4ea8c2[_0xb907('0x30')][_0xb907('0x45')])?null:_0x4ea8c2[_0xb907('0x30')][_0xb907('0x45')];_0x478701['beep']=_0x4ea8c2[_0xb907('0x30')]['beep']||![];_0x478701[_0xb907('0x47')]=_0x4ea8c2[_0xb907('0x3e')]['id'];return getContent(_0x4ea8c2['body'])['then'](function(_0x50def3){_0x478701[_0xb907('0x30')]=_0x50def3;return getRecipients(_0x1108a4);})[_0xb907('0x27')](function(_0x4d76a4){_0x478701[_0xb907('0x48')]=_[_0xb907('0x49')](_0x4d76a4)[_0xb907('0x4a')](',');return db['sequelize'][_0xb907('0x4b')](function(_0x4df925){return db['UserNotification'][_0xb907('0x4c')](_0x478701,{'raw':!![],'transaction':_0x4df925})['then'](function(_0x3fbc71){var _0x306107={'sender':_0x478701['senderName'],'description':_0x478701[_0xb907('0x45')],'content':_0x478701[_0xb907('0x30')],'beep':_0x478701[_0xb907('0x4d')]};_0x4d76a4[_0xb907('0x4e')](function(_0x54deb8){_0x306107[_0xb907('0x4f')]=_0x54deb8;socket['emit']('userNotification:send',_0x306107);});return _0x3fbc71;});});})[_0xb907('0x27')](respondWithResult(_0x1e8fbd,0xc9))[_0xb907('0x50')](handleError(_0x1e8fbd,null));};function getContent(_0xa5d05c){return new BPromise(function(_0x470c48,_0x37ef08){if(_0xa5d05c['text']){_0x470c48(_0xa5d05c[_0xb907('0x2d')]);return;}return db[_0xb907('0x51')][_0xb907('0x52')]({'attributes':[_0xb907('0x53')],'where':{'id':_0xa5d05c[_0xb907('0x2e')]},'raw':!![]})[_0xb907('0x27')](function(_0x397df2){if(!_0x397df2)throw new db[(_0xb907('0x34'))][(_0xb907('0x35'))](_0xb907('0x54'));var _0x3c8bb6=Mustache[_0xb907('0x55')](_0x397df2[_0xb907('0x53')],_0xa5d05c['view']);_0x470c48(_0x3c8bb6);})[_0xb907('0x50')](function(_0x4a04b5){_0x37ef08(_0x4a04b5);});});}function getRecipients(_0x33e163){return new BPromise(function(_0x4a666e,_0x54bd98){var _0x21a5ab=[];var _0x4eea1b=[];_0x33e163[_0xb907('0x4e')](function(_0x4a5c94){var _0x365cda=_[_0xb907('0x56')](_0x4a5c94[_0xb907('0x41')][_0xb907('0x42')]());if(_0x365cda===_0xb907('0x57')){_0x21a5ab=_[_0xb907('0x58')](_0x21a5ab,_0x4a5c94[_0xb907('0x59')]);}else{if(_[_0xb907('0x40')](_0x365cda,'queue'))_0x365cda=_0x365cda['replace'](_0xb907('0x5a'),_0xb907('0x5b'));_0x4a5c94[_0xb907('0x59')][_0xb907('0x4e')](function(_0x55c8e6){_0x4eea1b['push'](getAgents(_0x365cda,_0x55c8e6));});}});return BPromise[_0xb907('0x5c')](_0x4eea1b)['then'](function(_0x989fc2){_0x21a5ab=_[_0xb907('0x58')](_0x21a5ab,_[_0xb907('0x5d')](_0x989fc2));_0x4a666e(_0x21a5ab);})['catch'](function(_0xdb6420){_0x54bd98(_0xdb6420);});});}function getAgents(_0x2960fa,_0x589046){return new BPromise(function(_0x550ebf,_0x2fd7d7){return db[_0x2960fa][_0xb907('0x52')]({'where':{'id':_0x589046}})['then'](function(_0x59daf7){return _0x59daf7[_0xb907('0x5e')]({'attributes':['id'],'raw':!![]})[_0xb907('0x27')](function(_0x47caa9){var _0xdd75c6=_[_0xb907('0x5f')](_0x47caa9,'id');_0x550ebf(_0xdd75c6);});})[_0xb907('0x50')](function(_0x43094f){_0x2fd7d7(_0x43094f);});});} \ No newline at end of file +var _0xe21b=['squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userNotification.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','some','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','forEach','recipient','emit','userNotification:send','catch','Template','findOne','render','html','view','startCase','model','ids','includes','queue','replace','Queue','push','union','flatten','getAgents','map','zip-dir','request-promise','mustache','util','to-csv','ejs','lodash'];(function(_0x36ff4e,_0x4de0c1){var _0x1eef88=function(_0x448924){while(--_0x448924){_0x36ff4e['push'](_0x36ff4e['shift']());}};_0x1eef88(++_0x4de0c1);}(_0xe21b,0x1d4));var _0xbe21=function(_0x682838,_0x1fcfd9){_0x682838=_0x682838-0x0;var _0x5a3c45=_0xe21b[_0x682838];return _0x5a3c45;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbe21('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe21('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbe21('0x2'));var util=require(_0xbe21('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xbe21('0x4'));var ejs=require(_0xbe21('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbe21('0x6'));var squel=require(_0xbe21('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbe21('0x8'));var toCsv=require(_0xbe21('0x4'));var querystring=require(_0xbe21('0x9'));var Papa=require('papaparse');var Redis=require(_0xbe21('0xa'));var authService=require(_0xbe21('0xb'));var qs=require(_0xbe21('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbe21('0xd'));var utils=require(_0xbe21('0xe'));var config=require(_0xbe21('0xf'));var licenseUtil=require(_0xbe21('0x10'));var db=require(_0xbe21('0x11'))['db'];config[_0xbe21('0x12')]=_[_0xbe21('0x13')](config[_0xbe21('0x12')],{'host':_0xbe21('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbe21('0x12')]));require(_0xbe21('0x15'))[_0xbe21('0x16')](socket);function respondWithStatusCode(_0x4dc425,_0x4f9670){_0x4f9670=_0x4f9670||0xcc;return function(_0x1da72a){if(_0x1da72a){return _0x4dc425['sendStatus'](_0x4f9670);}return _0x4dc425[_0xbe21('0x17')](_0x4f9670)[_0xbe21('0x18')]();};}function respondWithResult(_0x223863,_0x5059bf){_0x5059bf=_0x5059bf||0xc8;return function(_0x2ce420){if(_0x2ce420){return _0x223863[_0xbe21('0x17')](_0x5059bf)[_0xbe21('0x19')](_0x2ce420);}};}function respondWithFilteredResult(_0x516424,_0x3d2661){return function(_0xf53683){if(_0xf53683){var _0x58867e=typeof _0x3d2661[_0xbe21('0x1a')]===_0xbe21('0x1b')&&typeof _0x3d2661[_0xbe21('0x1c')]==='undefined';var _0x29d376=_0xf53683[_0xbe21('0x1d')];var _0x56c30c=_0x58867e?0x0:_0x3d2661[_0xbe21('0x1a')];var _0x42c041=_0x58867e?_0xf53683[_0xbe21('0x1d')]:_0x3d2661[_0xbe21('0x1a')]+_0x3d2661[_0xbe21('0x1c')];var _0x293156;if(_0x42c041>=_0x29d376){_0x42c041=_0x29d376;_0x293156=0xc8;}else{_0x293156=0xce;}_0x516424[_0xbe21('0x17')](_0x293156);return _0x516424[_0xbe21('0x1e')](_0xbe21('0x1f'),_0x56c30c+'-'+_0x42c041+'/'+_0x29d376)[_0xbe21('0x19')](_0xf53683);}return null;};}function patchUpdates(_0xe4e787){return function(_0x566eea){try{jsonpatch['apply'](_0x566eea,_0xe4e787,!![]);}catch(_0x3ccaa9){return BPromise[_0xbe21('0x20')](_0x3ccaa9);}return _0x566eea[_0xbe21('0x21')]();};}function saveUpdates(_0x2655a8,_0x1f2b56){return function(_0x3ebd4f){if(_0x3ebd4f){return _0x3ebd4f[_0xbe21('0x22')](_0x2655a8)[_0xbe21('0x23')](function(_0x4d1f20){return _0x4d1f20;});}return null;};}function removeEntity(_0x40ca66,_0x54e15c){return function(_0x287a3c){if(_0x287a3c){return _0x287a3c['destroy']()[_0xbe21('0x23')](function(){_0x40ca66[_0xbe21('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e2675,_0x449495){return function(_0x582ce6){if(!_0x582ce6){_0x1e2675['sendStatus'](0x194);}return _0x582ce6;};}function handleError(_0x46cd34,_0x3d0127){_0x3d0127=_0x3d0127||0x1f4;return function(_0x6dd57b){logger[_0xbe21('0x24')](_0x6dd57b[_0xbe21('0x25')]);if(_0x6dd57b[_0xbe21('0x26')]){delete _0x6dd57b[_0xbe21('0x26')];}_0x46cd34[_0xbe21('0x17')](_0x3d0127)['send'](_0x6dd57b);};}exports[_0xbe21('0x27')]=function(_0x18f39a,_0x50f762,_0x440b0d){if(!_0x18f39a[_0xbe21('0x28')][_0xbe21('0x29')](_0xbe21('0x2a'))&&!_0x18f39a[_0xbe21('0x28')][_0xbe21('0x29')](_0xbe21('0x2b'))){throw new db[(_0xbe21('0x2c'))][(_0xbe21('0x2d'))](_0xbe21('0x2e'));}else{if(_0x18f39a[_0xbe21('0x28')]['hasOwnProperty']('TemplateId')&&!_0x18f39a['body'][_0xbe21('0x29')]('view')){throw new db[(_0xbe21('0x2c'))][(_0xbe21('0x2d'))](_0xbe21('0x2f'));}if(!_0x18f39a[_0xbe21('0x28')][_0xbe21('0x29')](_0xbe21('0x30'))){throw new db[(_0xbe21('0x2c'))][(_0xbe21('0x2d'))](_0xbe21('0x31'));}else{try{var _0x32f350=JSON['parse'](_0x18f39a[_0xbe21('0x28')][_0xbe21('0x30')]);}catch(_0x27f931){logger['error'](_0x27f931);throw new db[(_0xbe21('0x2c'))][(_0xbe21('0x2d'))](_0xbe21('0x32'));}var _0x454550=[_0xbe21('0x33'),_0xbe21('0x34'),_0xbe21('0x35'),'openchannelqueue',_0xbe21('0x36'),_0xbe21('0x37'),_0xbe21('0x38'),_0xbe21('0x39'),'user'];if(_[_0xbe21('0x3a')](_0x32f350,function(_0x1c13fe){return!_['includes'](_0x454550,_0x1c13fe['model'][_0xbe21('0x3b')]());})){throw new db[(_0xbe21('0x2c'))][(_0xbe21('0x2d'))](_0xbe21('0x3c'));}}}var _0x5f168a={};_0x5f168a[_0xbe21('0x3d')]=_0x18f39a[_0xbe21('0x28')][_0xbe21('0x29')]('senderName')?_0x18f39a[_0xbe21('0x28')][_0xbe21('0x3d')]:_0x18f39a[_0xbe21('0x3e')][_0xbe21('0x3f')];_0x5f168a[_0xbe21('0x40')]=_['isEmpty'](_0x18f39a['body'][_0xbe21('0x40')])?null:_0x18f39a[_0xbe21('0x28')]['recipientsDescription'];_0x5f168a[_0xbe21('0x41')]=_0x18f39a[_0xbe21('0x28')][_0xbe21('0x41')]||![];_0x5f168a[_0xbe21('0x42')]=_0x18f39a['user']['id'];return getContent(_0x18f39a[_0xbe21('0x28')])[_0xbe21('0x23')](function(_0x295cd6){_0x5f168a[_0xbe21('0x28')]=_0x295cd6;return getRecipients(_0x32f350);})[_0xbe21('0x23')](function(_0x16676a){_0x5f168a[_0xbe21('0x43')]=_[_0xbe21('0x44')](_0x16676a)[_0xbe21('0x45')](',');return db[_0xbe21('0x46')][_0xbe21('0x47')](function(_0x1f9471){return db[_0xbe21('0x48')]['create'](_0x5f168a,{'raw':!![],'transaction':_0x1f9471})[_0xbe21('0x23')](function(_0x59f724){var _0x1be4f9={'sender':_0x5f168a[_0xbe21('0x3d')],'description':_0x5f168a[_0xbe21('0x40')],'content':_0x5f168a['body'],'beep':_0x5f168a[_0xbe21('0x41')]};_0x16676a[_0xbe21('0x49')](function(_0x398eb9){_0x1be4f9[_0xbe21('0x4a')]=_0x398eb9;socket[_0xbe21('0x4b')](_0xbe21('0x4c'),_0x1be4f9);});return _0x59f724;});});})[_0xbe21('0x23')](respondWithResult(_0x50f762,0xc9))[_0xbe21('0x4d')](handleError(_0x50f762,null));};function getContent(_0x215889){return new BPromise(function(_0xd1e1c8,_0x21e199){if(_0x215889['text']){_0xd1e1c8(_0x215889['text']);return;}return db[_0xbe21('0x4e')][_0xbe21('0x4f')]({'attributes':['html'],'where':{'id':_0x215889[_0xbe21('0x2b')]},'raw':!![]})['then'](function(_0x23b0c2){if(!_0x23b0c2)throw new db['Sequelize'][(_0xbe21('0x2d'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x2d80c4=Mustache[_0xbe21('0x50')](_0x23b0c2[_0xbe21('0x51')],_0x215889[_0xbe21('0x52')]);_0xd1e1c8(_0x2d80c4);})['catch'](function(_0x148423){_0x21e199(_0x148423);});});}function getRecipients(_0x797422){return new BPromise(function(_0x2043d8,_0x425ad9){var _0x3a8af3=[];var _0x4c6875=[];_0x797422[_0xbe21('0x49')](function(_0x57f8cb){var _0x46769f=_[_0xbe21('0x53')](_0x57f8cb[_0xbe21('0x54')]['toLowerCase']());if(_0x46769f==='User'){_0x3a8af3=_['union'](_0x3a8af3,_0x57f8cb[_0xbe21('0x55')]);}else{if(_[_0xbe21('0x56')](_0x46769f,_0xbe21('0x57')))_0x46769f=_0x46769f[_0xbe21('0x58')]('queue',_0xbe21('0x59'));_0x57f8cb[_0xbe21('0x55')][_0xbe21('0x49')](function(_0x305a0f){_0x4c6875[_0xbe21('0x5a')](getAgents(_0x46769f,_0x305a0f));});}});return BPromise['all'](_0x4c6875)[_0xbe21('0x23')](function(_0x4bafc0){_0x3a8af3=_[_0xbe21('0x5b')](_0x3a8af3,_[_0xbe21('0x5c')](_0x4bafc0));_0x2043d8(_0x3a8af3);})[_0xbe21('0x4d')](function(_0x4804c4){_0x425ad9(_0x4804c4);});});}function getAgents(_0x6149ef,_0x3223e3){return new BPromise(function(_0x5a9df9,_0x1b5ef1){return db[_0x6149ef][_0xbe21('0x4f')]({'where':{'id':_0x3223e3}})[_0xbe21('0x23')](function(_0xbfef4c){return _0xbfef4c[_0xbe21('0x5d')]({'attributes':['id'],'raw':!![]})[_0xbe21('0x23')](function(_0x122df3){var _0x3050ee=_[_0xbe21('0x5e')](_0x122df3,'id');_0x5a9df9(_0x3050ee);});})[_0xbe21('0x4d')](function(_0x1c19b2){_0x1b5ef1(_0x1c19b2);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 394bb25..e0f8a9f 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 _0xb38f=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xb38f,0x1ad));var _0xfb38=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0xb38f[_0x119280];return _0x481797;};'use strict';var EventEmitter=require(_0xfb38('0x0'));var UserNotification=require(_0xfb38('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xfb38('0x2')](0x0);var events={'afterCreate':_0xfb38('0x3'),'afterUpdate':_0xfb38('0x4'),'afterDestroy':_0xfb38('0x5')};function emitEvent(_0x290885){return function(_0x4fc734,_0x1518be,_0x5e9d5f){UserNotificationEvents[_0xfb38('0x6')](_0x290885+':'+_0x4fc734['id'],_0x4fc734);UserNotificationEvents[_0xfb38('0x6')](_0x290885,_0x4fc734);_0x5e9d5f(null);};}for(var e in events){if(events[_0xfb38('0x7')](e)){var event=events[e];UserNotification[_0xfb38('0x8')](e,emitEvent(event));}}module[_0xfb38('0x9')]=UserNotificationEvents; \ No newline at end of file +var _0x6792=['save','update','emit','hasOwnProperty','exports','events','../../mysqldb','UserNotification'];(function(_0x32b769,_0x12d997){var _0x28a9b5=function(_0x1bc161){while(--_0x1bc161){_0x32b769['push'](_0x32b769['shift']());}};_0x28a9b5(++_0x12d997);}(_0x6792,0x18d));var _0x2679=function(_0xe51925,_0x513834){_0xe51925=_0xe51925-0x0;var _0x36d4da=_0x6792[_0xe51925];return _0x36d4da;};'use strict';var EventEmitter=require(_0x2679('0x0'));var UserNotification=require(_0x2679('0x1'))['db'][_0x2679('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2679('0x3'),'afterUpdate':_0x2679('0x4'),'afterDestroy':'remove'};function emitEvent(_0x517865){return function(_0x2df9c5,_0x1ece6a,_0x45e22a){UserNotificationEvents['emit'](_0x517865+':'+_0x2df9c5['id'],_0x2df9c5);UserNotificationEvents[_0x2679('0x5')](_0x517865,_0x2df9c5);_0x45e22a(null);};}for(var e in events){if(events[_0x2679('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x2679('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 04e3e9d..50a01df 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 _0x2286=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x239f30,_0x1c5432){var _0x43a5bc=function(_0x50ac30){while(--_0x50ac30){_0x239f30['push'](_0x239f30['shift']());}};_0x43a5bc(++_0x1c5432);}(_0x2286,0x1a4));var _0x6228=function(_0x326558,_0x4a22a1){_0x326558=_0x326558-0x0;var _0x5cd3a0=_0x2286[_0x326558];return _0x5cd3a0;};'use strict';var _=require(_0x6228('0x0'));var util=require(_0x6228('0x1'));var logger=require(_0x6228('0x2'))(_0x6228('0x3'));var moment=require(_0x6228('0x4'));var BPromise=require(_0x6228('0x5'));var rp=require(_0x6228('0x6'));var fs=require('fs');var path=require(_0x6228('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6228('0x8'));module[_0x6228('0x9')]=function(_0x13d3ed,_0x4aac30){return _0x13d3ed[_0x6228('0xa')](_0x6228('0xb'),attributes,{'tableName':_0x6228('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6228('0xd'),'collate':_0x6228('0xe')});}; \ No newline at end of file +var _0xb7b3=['path','../../config/environment','./userNotification.attributes','exports','UserNotification','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x43b77b,_0x42f79a){var _0x47cd20=function(_0x384006){while(--_0x384006){_0x43b77b['push'](_0x43b77b['shift']());}};_0x47cd20(++_0x42f79a);}(_0xb7b3,0x124));var _0x3b7b=function(_0x33bb07,_0x5b1849){_0x33bb07=_0x33bb07-0x0;var _0x481c81=_0xb7b3[_0x33bb07];return _0x481c81;};'use strict';var _=require(_0x3b7b('0x0'));var util=require(_0x3b7b('0x1'));var logger=require(_0x3b7b('0x2'))(_0x3b7b('0x3'));var moment=require(_0x3b7b('0x4'));var BPromise=require(_0x3b7b('0x5'));var rp=require(_0x3b7b('0x6'));var fs=require('fs');var path=require(_0x3b7b('0x7'));var rimraf=require('rimraf');var config=require(_0x3b7b('0x8'));var attributes=require(_0x3b7b('0x9'));module[_0x3b7b('0xa')]=function(_0x8c6f99,_0x13064d){return _0x8c6f99['define'](_0x3b7b('0xb'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3b7b('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index e8ec0af..00c0919 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 _0x3795=['stringify','error','code','message','info','UserNotification,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','./userNotification.socket','register','request','then','request\x20sent','debug'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x3795,0xe8));var _0x5379=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3795[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x5379('0x0'));var util=require('util');var moment=require(_0x5379('0x1'));var BPromise=require(_0x5379('0x2'));var rs=require(_0x5379('0x3'));var fs=require('fs');var Redis=require(_0x5379('0x4'));var db=require(_0x5379('0x5'))['db'];var utils=require(_0x5379('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5379('0x7'));var jayson=require(_0x5379('0x8'));var client=jayson[_0x5379('0x9')][_0x5379('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5379('0xb')]));require(_0x5379('0xc'))[_0x5379('0xd')](socket);function respondWithRpcPromise(_0x488263,_0x5c2dee,_0x1797ff){return new BPromise(function(_0x3bcf83,_0x5598fe){return client[_0x5379('0xe')](_0x488263,_0x1797ff)[_0x5379('0xf')](function(_0x3476cc){logger['info']('UserNotification,\x20%s,\x20%s',_0x5c2dee,_0x5379('0x10'));logger[_0x5379('0x11')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x5c2dee,_0x5379('0x10'),JSON[_0x5379('0x12')](_0x3476cc));if(_0x3476cc[_0x5379('0x13')]){if(_0x3476cc[_0x5379('0x13')][_0x5379('0x14')]===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0x5c2dee,_0x3476cc[_0x5379('0x13')]['message']);return _0x5598fe(_0x3476cc[_0x5379('0x13')]['message']);}logger[_0x5379('0x13')]('UserNotification,\x20%s,\x20%s',_0x5c2dee,_0x3476cc[_0x5379('0x13')][_0x5379('0x15')]);return _0x3bcf83(_0x3476cc[_0x5379('0x13')][_0x5379('0x15')]);}else{logger[_0x5379('0x16')](_0x5379('0x17'),_0x5c2dee,_0x5379('0x10'));_0x3bcf83(_0x3476cc['result'][_0x5379('0x15')]);}})[_0x5379('0x18')](function(_0x1e961e){logger[_0x5379('0x13')](_0x5379('0x17'),_0x5c2dee,_0x1e961e);_0x5598fe(_0x1e961e);});});} \ No newline at end of file +var _0x4c5b=['http','defaults','redis','localhost','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x1e96c0,_0xf1df02){var _0x257b7=function(_0x1d4b4c){while(--_0x1d4b4c){_0x1e96c0['push'](_0x1e96c0['shift']());}};_0x257b7(++_0xf1df02);}(_0x4c5b,0x94));var _0xb4c5=function(_0x4796ff,_0xbfa800){_0x4796ff=_0x4796ff-0x0;var _0x1d53e9=_0x4c5b[_0x4796ff];return _0x1d53e9;};'use strict';var _=require(_0xb4c5('0x0'));var util=require('util');var moment=require(_0xb4c5('0x1'));var BPromise=require('bluebird');var rs=require(_0xb4c5('0x2'));var fs=require('fs');var Redis=require(_0xb4c5('0x3'));var db=require(_0xb4c5('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb4c5('0x5'));var config=require(_0xb4c5('0x6'));var jayson=require(_0xb4c5('0x7'));var client=jayson['client'][_0xb4c5('0x8')]({'port':0x232a});config['redis']=_[_0xb4c5('0x9')](config[_0xb4c5('0xa')],{'host':_0xb4c5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb4c5('0xc'))[_0xb4c5('0xd')](socket);function respondWithRpcPromise(_0xbe3199,_0x47d68d,_0x490973){return new BPromise(function(_0x36ade6,_0x15735b){return client[_0xb4c5('0xe')](_0xbe3199,_0x490973)[_0xb4c5('0xf')](function(_0x1ec40a){logger[_0xb4c5('0x10')](_0xb4c5('0x11'),_0x47d68d,_0xb4c5('0x12'));logger[_0xb4c5('0x13')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x47d68d,'request\x20sent',JSON[_0xb4c5('0x14')](_0x1ec40a));if(_0x1ec40a['error']){if(_0x1ec40a[_0xb4c5('0x15')][_0xb4c5('0x16')]===0x1f4){logger[_0xb4c5('0x15')](_0xb4c5('0x11'),_0x47d68d,_0x1ec40a[_0xb4c5('0x15')]['message']);return _0x15735b(_0x1ec40a['error'][_0xb4c5('0x17')]);}logger[_0xb4c5('0x15')](_0xb4c5('0x11'),_0x47d68d,_0x1ec40a[_0xb4c5('0x15')][_0xb4c5('0x17')]);return _0x36ade6(_0x1ec40a[_0xb4c5('0x15')]['message']);}else{logger[_0xb4c5('0x10')](_0xb4c5('0x11'),_0x47d68d,_0xb4c5('0x12'));_0x36ade6(_0x1ec40a[_0xb4c5('0x18')][_0xb4c5('0x17')]);}})[_0xb4c5('0x19')](function(_0x26b63d){logger[_0xb4c5('0x15')](_0xb4c5('0x11'),_0x47d68d,_0x26b63d);_0x15735b(_0x26b63d);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index a47ab5c..fd073ba 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 _0x4fe3=['userNotification:','save','remove','update','emit','removeListener','register','length'];(function(_0x396d2e,_0x206a0e){var _0x2f5992=function(_0x6faf70){while(--_0x6faf70){_0x396d2e['push'](_0x396d2e['shift']());}};_0x2f5992(++_0x206a0e);}(_0x4fe3,0x149));var _0x34fe=function(_0x24a96d,_0x4f9faf){_0x24a96d=_0x24a96d-0x0;var _0x1efd8d=_0x4fe3[_0x24a96d];return _0x1efd8d;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x34fe('0x0'),_0x34fe('0x1'),_0x34fe('0x2')];function createListener(_0x11c179,_0x1407db){return function(_0x144a64){_0x1407db[_0x34fe('0x3')](_0x11c179,_0x144a64);};}function removeListener(_0x3b89c2,_0x3a3fd2){return function(){UserNotificationEvents[_0x34fe('0x4')](_0x3b89c2,_0x3a3fd2);};}exports[_0x34fe('0x5')]=function(_0x54c1a3){for(var _0x142342=0x0,_0x4a2f37=events[_0x34fe('0x6')];_0x142342<_0x4a2f37;_0x142342++){var _0x3e24c3=events[_0x142342];var _0x45dbee=createListener(_0x34fe('0x7')+_0x3e24c3,_0x54c1a3);UserNotificationEvents['on'](_0x3e24c3,_0x45dbee);}}; \ No newline at end of file +var _0xb977=['emit','register','length','userNotification:','save','update'];(function(_0x1362d6,_0x4621e9){var _0x339025=function(_0x2eb481){while(--_0x2eb481){_0x1362d6['push'](_0x1362d6['shift']());}};_0x339025(++_0x4621e9);}(_0xb977,0xe2));var _0x7b97=function(_0x3fc75e,_0x39efb9){_0x3fc75e=_0x3fc75e-0x0;var _0x13e53e=_0xb977[_0x3fc75e];return _0x13e53e;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x7b97('0x0'),'remove',_0x7b97('0x1')];function createListener(_0x342d3a,_0x21514){return function(_0x4f4342){_0x21514[_0x7b97('0x2')](_0x342d3a,_0x4f4342);};}function removeListener(_0x5dcb5d,_0x4927ff){return function(){UserNotificationEvents['removeListener'](_0x5dcb5d,_0x4927ff);};}exports[_0x7b97('0x3')]=function(_0x4d8ede){for(var _0x30ba4f=0x0,_0x120a40=events[_0x7b97('0x4')];_0x30ba4f<_0x120a40;_0x30ba4f++){var _0x124c54=events[_0x30ba4f];var _0x555fb2=createListener(_0x7b97('0x5')+_0x124c54,_0x4d8ede);UserNotificationEvents['on'](_0x124c54,_0x555fb2);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 0f75e59..206553e 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x41bd81,_0x558a2d){var _0x4fed84=function(_0x5101eb){while(--_0x5101eb){_0x41bd81['push'](_0x41bd81['shift']());}};_0x4fed84(++_0x558a2d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3eee77,_0x2a76a7){var _0x1b75e9=function(_0x5b9af1){while(--_0x5b9af1){_0x3eee77['push'](_0x3eee77['shift']());}};_0x1b75e9(++_0x2a76a7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xcb91[_0x11ce46];return _0x368a1e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 0fd757e..c2ec72c 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 _0x08fc=['sequelize','exports','INTEGER'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x08fc,0x11a));var _0xc08f=function(_0x21cb7f,_0x48cd16){_0x21cb7f=_0x21cb7f-0x0;var _0x5a079a=_0x08fc[_0x21cb7f];return _0x5a079a;};'use strict';var Sequelize=require(_0xc08f('0x0'));module[_0xc08f('0x1')]={'penalty':{'type':Sequelize[_0xc08f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6037=['sequelize','exports'];(function(_0x37e0e4,_0x21837f){var _0x37e1f7=function(_0x1dadc7){while(--_0x1dadc7){_0x37e0e4['push'](_0x37e0e4['shift']());}};_0x37e1f7(++_0x21837f);}(_0x6037,0xc0));var _0x7603=function(_0x47e1a5,_0x3dc785){_0x47e1a5=_0x47e1a5-0x0;var _0x3c838c=_0x6037[_0x47e1a5];return _0x3c838c;};'use strict';var Sequelize=require(_0x7603('0x0'));module[_0x7603('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index dce423f..b43bcae 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 _0x8ac7=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','user_has_openchannel_queues','util','../../config/logger'];(function(_0x5c332e,_0x25aeaf){var _0x28e696=function(_0x58da0d){while(--_0x58da0d){_0x5c332e['push'](_0x5c332e['shift']());}};_0x28e696(++_0x25aeaf);}(_0x8ac7,0x142));var _0x78ac=function(_0x36a018,_0x1a25fd){_0x36a018=_0x36a018-0x0;var _0xa6686e=_0x8ac7[_0x36a018];return _0xa6686e;};'use strict';var _=require('lodash');var util=require(_0x78ac('0x0'));var logger=require(_0x78ac('0x1'))(_0x78ac('0x2'));var moment=require(_0x78ac('0x3'));var BPromise=require(_0x78ac('0x4'));var rp=require(_0x78ac('0x5'));var fs=require('fs');var path=require(_0x78ac('0x6'));var rimraf=require(_0x78ac('0x7'));var config=require(_0x78ac('0x8'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x78ac('0x9')]=function(_0x27cddb,_0x3e339b){return _0x27cddb[_0x78ac('0xa')]('UserOpenchannelQueue',attributes,{'tableName':_0x78ac('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ebc=['../../config/environment','exports','define','user_has_openchannel_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x125bc6,_0x5d2604){var _0x5de25a=function(_0x42c253){while(--_0x42c253){_0x125bc6['push'](_0x125bc6['shift']());}};_0x5de25a(++_0x5d2604);}(_0x7ebc,0x72));var _0xc7eb=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x7ebc[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xc7eb('0x0'));var util=require(_0xc7eb('0x1'));var logger=require(_0xc7eb('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc7eb('0x3'));var rp=require(_0xc7eb('0x4'));var fs=require('fs');var path=require(_0xc7eb('0x5'));var rimraf=require(_0xc7eb('0x6'));var config=require(_0xc7eb('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xc7eb('0x8')]=function(_0x40aa57,_0x28f2e9){return _0x40aa57[_0xc7eb('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0xc7eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 414e1d6..f11ee4d 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 _0x6c2f=['request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x4c0e39,_0x591118){var _0x56996c=function(_0x169768){while(--_0x169768){_0x4c0e39['push'](_0x4c0e39['shift']());}};_0x56996c(++_0x591118);}(_0x6c2f,0xd6));var _0xf6c2=function(_0x196e1c,_0x597539){_0x196e1c=_0x196e1c-0x0;var _0x24cd78=_0x6c2f[_0x196e1c];return _0x24cd78;};'use strict';var _=require(_0xf6c2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf6c2('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf6c2('0x2'));var logger=require(_0xf6c2('0x3'))('rpc');var config=require(_0xf6c2('0x4'));var jayson=require(_0xf6c2('0x5'));var client=jayson['client'][_0xf6c2('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2c3b32,_0x1e16e3,_0x198f1d){return new BPromise(function(_0x229c55,_0x1a339c){return client[_0xf6c2('0x7')](_0x2c3b32,_0x198f1d)['then'](function(_0x28107f){logger[_0xf6c2('0x8')](_0xf6c2('0x9'),_0x1e16e3,_0xf6c2('0xa'));logger[_0xf6c2('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1e16e3,_0xf6c2('0xa'),JSON['stringify'](_0x28107f));if(_0x28107f[_0xf6c2('0xc')]){if(_0x28107f[_0xf6c2('0xc')][_0xf6c2('0xd')]===0x1f4){logger[_0xf6c2('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1e16e3,_0x28107f[_0xf6c2('0xc')]['message']);return _0x1a339c(_0x28107f['error'][_0xf6c2('0xe')]);}logger[_0xf6c2('0xc')](_0xf6c2('0x9'),_0x1e16e3,_0x28107f[_0xf6c2('0xc')][_0xf6c2('0xe')]);return _0x229c55(_0x28107f['error'][_0xf6c2('0xe')]);}else{logger['info'](_0xf6c2('0x9'),_0x1e16e3,_0xf6c2('0xa'));_0x229c55(_0x28107f[_0xf6c2('0xf')]['message']);}})[_0xf6c2('0x10')](function(_0xa00d9f){logger[_0xf6c2('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1e16e3,_0xa00d9f);_0x1a339c(_0xa00d9f);});});} \ No newline at end of file +var _0xa806=['http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa806,0x69));var _0x6a80=function(_0x531e48,_0x4bb96b){_0x531e48=_0x531e48-0x0;var _0x202971=_0xa806[_0x531e48];return _0x202971;};'use strict';var _=require('lodash');var util=require(_0x6a80('0x0'));var moment=require(_0x6a80('0x1'));var BPromise=require(_0x6a80('0x2'));var rs=require(_0x6a80('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a80('0x4'))['db'];var utils=require(_0x6a80('0x5'));var logger=require(_0x6a80('0x6'))(_0x6a80('0x7'));var config=require('../../config/environment');var jayson=require(_0x6a80('0x8'));var client=jayson[_0x6a80('0x9')][_0x6a80('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21edf8,_0x9ebf49,_0xdcddc8){return new BPromise(function(_0x41232f,_0x16eac8){return client[_0x6a80('0xb')](_0x21edf8,_0xdcddc8)[_0x6a80('0xc')](function(_0x272c9a){logger[_0x6a80('0xd')](_0x6a80('0xe'),_0x9ebf49,_0x6a80('0xf'));logger[_0x6a80('0x10')](_0x6a80('0x11'),_0x9ebf49,'request\x20sent',JSON[_0x6a80('0x12')](_0x272c9a));if(_0x272c9a[_0x6a80('0x13')]){if(_0x272c9a['error'][_0x6a80('0x14')]===0x1f4){logger[_0x6a80('0x13')](_0x6a80('0xe'),_0x9ebf49,_0x272c9a[_0x6a80('0x13')][_0x6a80('0x15')]);return _0x16eac8(_0x272c9a[_0x6a80('0x13')][_0x6a80('0x15')]);}logger[_0x6a80('0x13')](_0x6a80('0xe'),_0x9ebf49,_0x272c9a[_0x6a80('0x13')][_0x6a80('0x15')]);return _0x41232f(_0x272c9a[_0x6a80('0x13')][_0x6a80('0x15')]);}else{logger[_0x6a80('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x9ebf49,_0x6a80('0xf'));_0x41232f(_0x272c9a['result'][_0x6a80('0x15')]);}})[_0x6a80('0x16')](function(_0x439d98){logger['error'](_0x6a80('0xe'),_0x9ebf49,_0x439d98);_0x16eac8(_0x439d98);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 09cc8a4..26061a4 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 _0xd0f7=['/:id','destroy','delete','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get','/describe','describe','getSections','/:id/resources','getResources','/:id/clone','clone','post','/:id/sections','addSections','addResources'];(function(_0x26ebfa,_0x5818c0){var _0x3a097c=function(_0x5588df){while(--_0x5588df){_0x26ebfa['push'](_0x26ebfa['shift']());}};_0x3a097c(++_0x5818c0);}(_0xd0f7,0x1b8));var _0x7d0f=function(_0x3dfbda,_0x4e6cfd){_0x3dfbda=_0x3dfbda-0x0;var _0x106b16=_0xd0f7[_0x3dfbda];return _0x106b16;};'use strict';var multer=require(_0x7d0f('0x0'));var util=require(_0x7d0f('0x1'));var path=require(_0x7d0f('0x2'));var timeout=require(_0x7d0f('0x3'));var express=require(_0x7d0f('0x4'));var router=express[_0x7d0f('0x5')]();var fs_extra=require(_0x7d0f('0x6'));var auth=require(_0x7d0f('0x7'));var interaction=require(_0x7d0f('0x8'));var config=require(_0x7d0f('0x9'));var controller=require(_0x7d0f('0xa'));router['get']('/',auth[_0x7d0f('0xb')](),controller[_0x7d0f('0xc')]);router[_0x7d0f('0xd')](_0x7d0f('0xe'),auth[_0x7d0f('0xb')](),controller[_0x7d0f('0xf')]);router[_0x7d0f('0xd')]('/:id',auth[_0x7d0f('0xb')](),controller['show']);router[_0x7d0f('0xd')]('/:id/sections',auth['isAuthenticated'](),controller[_0x7d0f('0x10')]);router[_0x7d0f('0xd')](_0x7d0f('0x11'),auth[_0x7d0f('0xb')](),controller[_0x7d0f('0x12')]);router['post']('/',auth[_0x7d0f('0xb')](),controller['create']);router['post'](_0x7d0f('0x13'),auth[_0x7d0f('0xb')](),controller[_0x7d0f('0x14')]);router[_0x7d0f('0x15')](_0x7d0f('0x16'),auth[_0x7d0f('0xb')](),controller[_0x7d0f('0x17')]);router[_0x7d0f('0x15')](_0x7d0f('0x11'),auth['isAuthenticated'](),controller[_0x7d0f('0x18')]);router['put'](_0x7d0f('0x19'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7d0f('0x19'),auth[_0x7d0f('0xb')](),controller[_0x7d0f('0x1a')]);router[_0x7d0f('0x1b')]('/:id/sections',auth[_0x7d0f('0xb')](),controller[_0x7d0f('0x1c')]);router[_0x7d0f('0x1b')](_0x7d0f('0x11'),auth['isAuthenticated'](),controller[_0x7d0f('0x1d')]);module[_0x7d0f('0x1e')]=router; \ No newline at end of file +var _0xfce5=['create','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeSections','/:id/resources','removeResources','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','getResources','post'];(function(_0xc74312,_0x3d8ef0){var _0x3a9838=function(_0x49cfac){while(--_0x49cfac){_0xc74312['push'](_0xc74312['shift']());}};_0x3a9838(++_0x3d8ef0);}(_0xfce5,0x1ad));var _0x5fce=function(_0x36aad0,_0x3d2e17){_0x36aad0=_0x36aad0-0x0;var _0x31e987=_0xfce5[_0x36aad0];return _0x31e987;};'use strict';var multer=require(_0x5fce('0x0'));var util=require('util');var path=require(_0x5fce('0x1'));var timeout=require('connect-timeout');var express=require(_0x5fce('0x2'));var router=express['Router']();var fs_extra=require(_0x5fce('0x3'));var auth=require(_0x5fce('0x4'));var interaction=require(_0x5fce('0x5'));var config=require(_0x5fce('0x6'));var controller=require(_0x5fce('0x7'));router[_0x5fce('0x8')]('/',auth[_0x5fce('0x9')](),controller[_0x5fce('0xa')]);router[_0x5fce('0x8')](_0x5fce('0xb'),auth['isAuthenticated'](),controller[_0x5fce('0xc')]);router[_0x5fce('0x8')](_0x5fce('0xd'),auth[_0x5fce('0x9')](),controller[_0x5fce('0xe')]);router[_0x5fce('0x8')](_0x5fce('0xf'),auth[_0x5fce('0x9')](),controller[_0x5fce('0x10')]);router[_0x5fce('0x8')]('/:id/resources',auth[_0x5fce('0x9')](),controller[_0x5fce('0x11')]);router[_0x5fce('0x12')]('/',auth[_0x5fce('0x9')](),controller[_0x5fce('0x13')]);router[_0x5fce('0x12')](_0x5fce('0x14'),auth['isAuthenticated'](),controller[_0x5fce('0x15')]);router[_0x5fce('0x12')](_0x5fce('0xf'),auth[_0x5fce('0x9')](),controller[_0x5fce('0x16')]);router['post']('/:id/resources',auth[_0x5fce('0x9')](),controller[_0x5fce('0x17')]);router[_0x5fce('0x18')](_0x5fce('0xd'),auth[_0x5fce('0x9')](),controller[_0x5fce('0x19')]);router[_0x5fce('0x1a')](_0x5fce('0xd'),auth['isAuthenticated'](),controller[_0x5fce('0x1b')]);router[_0x5fce('0x1a')](_0x5fce('0xf'),auth[_0x5fce('0x9')](),controller[_0x5fce('0x1c')]);router[_0x5fce('0x1a')](_0x5fce('0x1d'),auth[_0x5fce('0x9')](),controller[_0x5fce('0x1e')]);module[_0x5fce('0x1f')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 51049a4..6f3ca93 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 _0xf8fd=['exports','STRING','name','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN'];(function(_0x1fada1,_0x165008){var _0x560086=function(_0x1a1188){while(--_0x1a1188){_0x1fada1['push'](_0x1fada1['shift']());}};_0x560086(++_0x165008);}(_0xf8fd,0x1d4));var _0xdf8f=function(_0x358005,_0x3907a8){_0x358005=_0x358005-0x0;var _0x4c0f0e=_0xf8fd[_0x358005];return _0x4c0f0e;};'use strict';var Sequelize=require('sequelize');module[_0xdf8f('0x0')]={'name':{'type':Sequelize[_0xdf8f('0x1')],'allowNull':![],'unique':_0xdf8f('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x29a9bb){this[_0xdf8f('0x3')](_0xdf8f('0x4'),_0x29a9bb?_0x29a9bb[_0xdf8f('0x5')](''):[]);},'get':function(){return this[_0xdf8f('0x6')](_0xdf8f('0x4'))?this['getDataValue'](_0xdf8f('0x4'))[_0xdf8f('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xdf8f('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xdf8f('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xdf8f('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xdf8f('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xdf8f('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xdf8f('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdb7e=['split','BOOLEAN','exports','name','STRING','setDataValue','crudPermissions','getDataValue'];(function(_0x373096,_0x4d37aa){var _0x14a6d0=function(_0xb3b614){while(--_0xb3b614){_0x373096['push'](_0x373096['shift']());}};_0x14a6d0(++_0x4d37aa);}(_0xdb7e,0x1ba));var _0xedb7=function(_0x4c1ce3,_0xe97ff6){_0x4c1ce3=_0x4c1ce3-0x0;var _0x106692=_0xdb7e[_0x4c1ce3];return _0x106692;};'use strict';var Sequelize=require('sequelize');module[_0xedb7('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xedb7('0x1')},'crudPermissions':{'type':Sequelize[_0xedb7('0x2')],'set':function(_0x1c7e4b){this[_0xedb7('0x3')](_0xedb7('0x4'),_0x1c7e4b?_0x1c7e4b['join'](''):[]);},'get':function(){return this[_0xedb7('0x5')](_0xedb7('0x4'))?this['getDataValue']('crudPermissions')[_0xedb7('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xedb7('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xedb7('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xedb7('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xedb7('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xedb7('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xedb7('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xedb7('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xedb7('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 1b060ae..d8689e1 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 _0x329f=['body','clone','params','get','omit','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','createdAt','sectionId','userProfileId','Resources','update','describe','addSections','push','removeSections','getSections','enabled','includes','subsections','concat','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','ids','getResources','section','rimraf','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','error','stack','send','map','UserProfile','fieldName','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','show','rawAttributes','includeAll','find','catch','create'];(function(_0x3f2f03,_0x288d96){var _0x219656=function(_0x343594){while(--_0x343594){_0x3f2f03['push'](_0x3f2f03['shift']());}};_0x219656(++_0x288d96);}(_0x329f,0x1d1));var _0xf329=function(_0x29f2d2,_0x34b451){_0x29f2d2=_0x29f2d2-0x0;var _0xc6ad58=_0x329f[_0x29f2d2];return _0xc6ad58;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf329('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf329('0x1'));var BPromise=require(_0xf329('0x2'));var Mustache=require(_0xf329('0x3'));var util=require('util');var path=require(_0xf329('0x4'));var sox=require('sox');var csv=require(_0xf329('0x5'));var ejs=require(_0xf329('0x6'));var fs=require('fs');var fs_extra=require(_0xf329('0x7'));var _=require('lodash');var squel=require(_0xf329('0x8'));var crypto=require(_0xf329('0x9'));var jsforce=require(_0xf329('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf329('0x5'));var querystring=require(_0xf329('0xb'));var Papa=require(_0xf329('0xc'));var Redis=require('ioredis');var authService=require(_0xf329('0xd'));var qs=require(_0xf329('0xe'));var as=require(_0xf329('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf329('0x10'));var utils=require(_0xf329('0x11'));var config=require(_0xf329('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xf329('0x13'))['db'];config['redis']=_[_0xf329('0x14')](config[_0xf329('0x15')],{'host':_0xf329('0x16'),'port':0x18eb});var socket=require(_0xf329('0x17'))(new Redis(config['redis']));require(_0xf329('0x18'))[_0xf329('0x19')](socket);function respondWithStatusCode(_0x23f365,_0x455aae){_0x455aae=_0x455aae||0xcc;return function(_0x54377c){if(_0x54377c){return _0x23f365['sendStatus'](_0x455aae);}return _0x23f365[_0xf329('0x1a')](_0x455aae)[_0xf329('0x1b')]();};}function respondWithResult(_0x313a1f,_0x33d247){_0x33d247=_0x33d247||0xc8;return function(_0x281905){if(_0x281905){return _0x313a1f['status'](_0x33d247)['json'](_0x281905);}};}function respondWithFilteredResult(_0x5270ba,_0x549e60){return function(_0xd4ca0e){if(_0xd4ca0e){var _0x2aad37=typeof _0x549e60[_0xf329('0x1c')]===_0xf329('0x1d')&&typeof _0x549e60[_0xf329('0x1e')]===_0xf329('0x1d');var _0x4bfa3e=_0xd4ca0e[_0xf329('0x1f')];var _0x5e350a=_0x2aad37?0x0:_0x549e60[_0xf329('0x1c')];var _0x3b0746=_0x2aad37?_0xd4ca0e[_0xf329('0x1f')]:_0x549e60['offset']+_0x549e60[_0xf329('0x1e')];var _0xe4e8f9;if(_0x3b0746>=_0x4bfa3e){_0x3b0746=_0x4bfa3e;_0xe4e8f9=0xc8;}else{_0xe4e8f9=0xce;}_0x5270ba[_0xf329('0x1a')](_0xe4e8f9);return _0x5270ba[_0xf329('0x20')](_0xf329('0x21'),_0x5e350a+'-'+_0x3b0746+'/'+_0x4bfa3e)['json'](_0xd4ca0e);}return null;};}function patchUpdates(_0x1e4588){return function(_0x4331b7){try{jsonpatch['apply'](_0x4331b7,_0x1e4588,!![]);}catch(_0x3bb3d1){return BPromise[_0xf329('0x22')](_0x3bb3d1);}return _0x4331b7['save']();};}function saveUpdates(_0x2aacfc,_0x324b5a){return function(_0x47d0e8){if(_0x47d0e8){return _0x47d0e8['update'](_0x2aacfc)[_0xf329('0x23')](function(_0x5612c8){return _0x5612c8;});}return null;};}function removeEntity(_0x80f9c9,_0x26d240){return function(_0x48b56e){if(_0x48b56e){return _0x48b56e[_0xf329('0x24')]()[_0xf329('0x23')](function(){_0x80f9c9[_0xf329('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bdbdc,_0x3ff12e){return function(_0x13f605){if(!_0x13f605){_0x1bdbdc['sendStatus'](0x194);}return _0x13f605;};}function handleError(_0x4b80,_0x194de6){_0x194de6=_0x194de6||0x1f4;return function(_0x907f65){logger[_0xf329('0x25')](_0x907f65[_0xf329('0x26')]);if(_0x907f65['name']){delete _0x907f65['name'];}_0x4b80[_0xf329('0x1a')](_0x194de6)[_0xf329('0x27')](_0x907f65);};}exports['index']=function(_0x47c8ce,_0x460140){var _0x55cfb1={},_0x6da880={},_0x3d2054={'count':0x0,'rows':[]};var _0x1b98e6=_[_0xf329('0x28')](db[_0xf329('0x29')]['rawAttributes'],function(_0x161b86){return{'name':_0x161b86[_0xf329('0x2a')],'type':_0x161b86['type']['key']};});_0x6da880[_0xf329('0x2b')]=_[_0xf329('0x28')](_0x1b98e6,_0xf329('0x2c'));_0x6da880[_0xf329('0x2d')]=_[_0xf329('0x2e')](_0x47c8ce[_0xf329('0x2d')]);_0x6da880[_0xf329('0x2f')]=_[_0xf329('0x30')](_0x6da880[_0xf329('0x2b')],_0x6da880['query']);_0x55cfb1[_0xf329('0x31')]=_['intersection'](_0x6da880[_0xf329('0x2b')],qs[_0xf329('0x32')](_0x47c8ce['query'][_0xf329('0x32')]));_0x55cfb1['attributes']=_0x55cfb1[_0xf329('0x31')][_0xf329('0x33')]?_0x55cfb1[_0xf329('0x31')]:_0x6da880[_0xf329('0x2b')];if(!_0x47c8ce[_0xf329('0x2d')][_0xf329('0x34')](_0xf329('0x35'))){_0x55cfb1[_0xf329('0x1e')]=qs[_0xf329('0x1e')](_0x47c8ce[_0xf329('0x2d')][_0xf329('0x1e')]);_0x55cfb1['offset']=qs[_0xf329('0x1c')](_0x47c8ce['query'][_0xf329('0x1c')]);}_0x55cfb1['order']=qs['sort'](_0x47c8ce['query'][_0xf329('0x36')]);_0x55cfb1[_0xf329('0x37')]=qs[_0xf329('0x2f')](_[_0xf329('0x38')](_0x47c8ce['query'],_0x6da880[_0xf329('0x2f')]),_0x1b98e6);if(_0x47c8ce[_0xf329('0x2d')][_0xf329('0x39')]){_0x55cfb1[_0xf329('0x37')]=_[_0xf329('0x3a')](_0x55cfb1['where'],{'$or':_['map'](_0x1b98e6,function(_0x1e5ee0){if(_0x1e5ee0[_0xf329('0x3b')]!==_0xf329('0x3c')){var _0x253ab9={};_0x253ab9[_0x1e5ee0['name']]={'$like':'%'+_0x47c8ce[_0xf329('0x2d')]['filter']+'%'};return _0x253ab9;}})});}_0x55cfb1=_['merge']({},_0x55cfb1,_0x47c8ce[_0xf329('0x3d')]);var _0x8c0d6={'where':_0x55cfb1[_0xf329('0x37')]};return db[_0xf329('0x29')][_0xf329('0x1f')](_0x8c0d6)[_0xf329('0x23')](function(_0xe6a24b){_0x3d2054[_0xf329('0x1f')]=_0xe6a24b;if(_0x47c8ce[_0xf329('0x2d')]['includeAll']){_0x55cfb1[_0xf329('0x3e')]=[{'all':!![]}];}return db['UserProfile'][_0xf329('0x3f')](_0x55cfb1);})[_0xf329('0x23')](function(_0x17906a){_0x3d2054['rows']=_0x17906a;return _0x3d2054;})['then'](respondWithFilteredResult(_0x460140,_0x55cfb1))['catch'](handleError(_0x460140,null));};exports[_0xf329('0x40')]=function(_0xe7566e,_0x2c9d6e){var _0xb1d742={'raw':![],'where':{'id':_0xe7566e['params']['id']}},_0x168233={};_0x168233[_0xf329('0x2b')]=_[_0xf329('0x2e')](db[_0xf329('0x29')][_0xf329('0x41')]);_0x168233[_0xf329('0x2d')]=_[_0xf329('0x2e')](_0xe7566e[_0xf329('0x2d')]);_0x168233[_0xf329('0x2f')]=_['intersection'](_0x168233[_0xf329('0x2b')],_0x168233[_0xf329('0x2d')]);_0xb1d742[_0xf329('0x31')]=_[_0xf329('0x30')](_0x168233['model'],qs[_0xf329('0x32')](_0xe7566e[_0xf329('0x2d')][_0xf329('0x32')]));_0xb1d742[_0xf329('0x31')]=_0xb1d742[_0xf329('0x31')]['length']?_0xb1d742[_0xf329('0x31')]:_0x168233[_0xf329('0x2b')];if(_0xe7566e[_0xf329('0x2d')][_0xf329('0x42')]){_0xb1d742['include']=[{'all':!![]}];}_0xb1d742=_['merge']({},_0xb1d742,_0xe7566e['options']);return db[_0xf329('0x29')][_0xf329('0x43')](_0xb1d742)[_0xf329('0x23')](handleEntityNotFound(_0x2c9d6e,null))[_0xf329('0x23')](respondWithResult(_0x2c9d6e,null))[_0xf329('0x44')](handleError(_0x2c9d6e,null));};exports[_0xf329('0x45')]=function(_0xa4865,_0x10aaac){return db[_0xf329('0x29')]['create'](_0xa4865[_0xf329('0x46')],{})['then'](respondWithResult(_0x10aaac,0xc9))[_0xf329('0x44')](handleError(_0x10aaac,null));};exports[_0xf329('0x47')]=function(_0x5dadd5,_0x2d6f0d){var _0x49c86a={'where':{'id':_0x5dadd5[_0xf329('0x48')]['id']}},_0x333c6d={};_0x333c6d[_0xf329('0x2b')]=_[_0xf329('0x2e')](db[_0xf329('0x29')]['rawAttributes']);_0x49c86a[_0xf329('0x31')]=_[_0xf329('0x30')](_0x333c6d[_0xf329('0x2b')],qs[_0xf329('0x32')](_0x5dadd5[_0xf329('0x2d')][_0xf329('0x32')]));_0x49c86a['attributes']=_0x49c86a['attributes'][_0xf329('0x33')]?_0x49c86a[_0xf329('0x31')]:_0x333c6d[_0xf329('0x2b')];if(_0x5dadd5[_0xf329('0x2d')][_0xf329('0x42')]){_0x49c86a['include']=[{'all':!![]}];}_0x49c86a=_[_0xf329('0x3a')]({},_0x49c86a,_0x5dadd5[_0xf329('0x3d')]);return db[_0xf329('0x29')][_0xf329('0x43')](_0x49c86a)['then'](handleEntityNotFound(_0x2d6f0d,null))[_0xf329('0x23')](function(_0x2156e4){if(_0x2156e4){var _0x591ec5=_0x2156e4[_0xf329('0x49')]({'plain':!![]});_0x591ec5=qs[_0xf329('0x4a')](_0x591ec5,['id','createdAt',_0xf329('0x4b'),_0xf329('0x4c')]);_0x5dadd5[_0xf329('0x46')]=_[_0xf329('0x4a')](_0x5dadd5[_0xf329('0x46')],['id','createdAt',_0xf329('0x4b')]);return db[_0xf329('0x4d')][_0xf329('0x4e')](function(_0x54fd02){return db[_0xf329('0x29')][_0xf329('0x45')](_[_0xf329('0x3a')](_0x591ec5,_0x5dadd5['body']),{'include':_0x5dadd5[_0xf329('0x2d')][_0xf329('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x54fd02})[_0xf329('0x23')](function(_0x3b6929){var _0x1acb0c=_0x3b6929[_0xf329('0x49')]({'plain':!![]});return db[_0xf329('0x4f')][_0xf329('0x3f')]({'where':{'userProfileId':_0x5dadd5[_0xf329('0x48')]['id']},'raw':!![]})[_0xf329('0x23')](function(_0x3e0caf){if(_0x3e0caf){return BPromise[_0xf329('0x50')](_0x3e0caf,function(_0x59ab20){return new BPromise(function(_0x4ddf9b,_0x3edb54){if(_0x59ab20[_0xf329('0x51')]===null||_0x59ab20[_0xf329('0x51')]===0x1)_0x4ddf9b(null);return db[_0xf329('0x52')]['findAll']({'where':{'sectionId':_0x59ab20['id']},'raw':!![]})[_0xf329('0x23')](function(_0x19b56a){var _0x9d49b8=_[_0xf329('0x28')](_0x19b56a,function(_0x22f417){return qs[_0xf329('0x4a')](_0x22f417,['id',_0xf329('0x53'),_0xf329('0x4b'),_0xf329('0x54')]);});_0x4ddf9b(_0x9d49b8);})[_0xf329('0x44')](function(_0x434a69){_0x3edb54(_0x434a69);});})[_0xf329('0x23')](function(_0x1f453a){var _0x2d7e9a=qs['omit'](_0x59ab20,['id',_0xf329('0x53'),_0xf329('0x4b')]);_0x2d7e9a[_0xf329('0x55')]=_0x1acb0c['id'];if(_0x1f453a)_0x2d7e9a[_0xf329('0x56')]=_0x1f453a;return _0x2d7e9a;})[_0xf329('0x23')](function(_0x43ddd1){return db[_0xf329('0x4f')][_0xf329('0x45')](_0x43ddd1,{'include':[{'model':db[_0xf329('0x52')],'as':_0xf329('0x56')}],'raw':!![],'transaction':_0x54fd02});});})['then'](function(){return _0x1acb0c;});}});});});}})[_0xf329('0x23')](respondWithResult(_0x2d6f0d,0xc9))[_0xf329('0x44')](handleError(_0x2d6f0d,null));};exports[_0xf329('0x57')]=function(_0x599345,_0x4842cb){if(_0x599345['body']['id']){delete _0x599345[_0xf329('0x46')]['id'];}return db[_0xf329('0x29')][_0xf329('0x43')]({'where':{'id':_0x599345['params']['id']}})[_0xf329('0x23')](handleEntityNotFound(_0x4842cb,null))[_0xf329('0x23')](saveUpdates(_0x599345[_0xf329('0x46')],null))[_0xf329('0x23')](respondWithResult(_0x4842cb,null))[_0xf329('0x44')](handleError(_0x4842cb,null));};exports[_0xf329('0x24')]=function(_0x517e20,_0x3175d9){return db[_0xf329('0x29')][_0xf329('0x43')]({'where':{'id':_0x517e20[_0xf329('0x48')]['id']}})['then'](handleEntityNotFound(_0x3175d9,null))[_0xf329('0x23')](removeEntity(_0x3175d9,null))[_0xf329('0x44')](handleError(_0x3175d9,null));};exports['describe']=function(_0x3089d1,_0x3459c5){return db[_0xf329('0x29')][_0xf329('0x58')]()['then'](respondWithResult(_0x3459c5,null))['catch'](handleError(_0x3459c5,null));};exports[_0xf329('0x59')]=function(_0xb06ef7,_0x5a3941){var _0x37f7a0=_0xb06ef7[_0xf329('0x46')];return db[_0xf329('0x29')][_0xf329('0x43')]({'where':{'id':_0xb06ef7[_0xf329('0x48')]['id']}})['then'](handleEntityNotFound(_0x5a3941,null))[_0xf329('0x23')](function(_0x24809f){if(_0x24809f){return db['sequelize']['transaction'](function(_0x4110e8){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0xb06ef7[_0xf329('0x48')]['id'],'sectionId':_['map'](_0x37f7a0,function(_0x3d87bf){return _0x3d87bf['sectionId'];})},'transaction':_0x4110e8})['then'](function(){var _0x22556a=_['map'](_0x37f7a0,function(_0x493cd8){_0x493cd8[_0xf329('0x55')]=_0xb06ef7[_0xf329('0x48')]['id'];return _0x493cd8;});var _0x4121a4=[];return BPromise[_0xf329('0x50')](_0x22556a,function(_0x45594a){return db[_0xf329('0x4f')][_0xf329('0x45')](_0x45594a,{'include':[{'model':db[_0xf329('0x52')],'as':_0xf329('0x56')}],'raw':!![],'transaction':_0x4110e8})[_0xf329('0x23')](function(_0x261031){_0x4121a4[_0xf329('0x5a')](_0x261031[_0xf329('0x49')]({'plain':!![]}));});})['then'](function(){return _0x4121a4;});});});}})[_0xf329('0x23')](function(_0x3a6eb5){return _0x3a6eb5;})[_0xf329('0x23')](respondWithResult(_0x5a3941,null))[_0xf329('0x44')](handleError(_0x5a3941,null));};exports[_0xf329('0x5b')]=function(_0x283b06,_0x565acb){var _0x342046;return db[_0xf329('0x29')]['find']({'where':{'id':_0x283b06['params']['id']},'attributes':['id',_0xf329('0x2c')]})[_0xf329('0x23')](handleEntityNotFound(_0x565acb,null))[_0xf329('0x23')](function(_0x2a0357){if(_0x2a0357){_0x342046=_0x2a0357;return db[_0xf329('0x4f')][_0xf329('0x24')]({'where':{'userProfileId':_0x283b06[_0xf329('0x48')]['id'],'sectionId':_0x283b06[_0xf329('0x2d')]['ids']}});}})[_0xf329('0x23')](function(){return _0x342046;})[_0xf329('0x23')](respondWithStatusCode(_0x565acb,null))['catch'](handleError(_0x565acb,null));};exports[_0xf329('0x5c')]=function(_0x391c8a,_0xae62d7){var _0x1961af=[];var _0x698d0b=[];return db[_0xf329('0x4f')][_0xf329('0x3f')]({'where':{'userProfileId':_0x391c8a['params']['id']},'raw':!![]})['then'](function(_0x4414b1){_0x1961af=_[_0xf329('0x39')](_0x4414b1,function(_0x1f0ef5){return _0x1f0ef5[_0xf329('0x5d')]===0x1||_[_0xf329('0x5e')]([0x3eb,0x709],_0x1f0ef5[_0xf329('0x54')]);});if(!_['isEmpty'](_0x1961af)){return _[_0xf329('0x28')](_0x1961af,function(_0x3dac6a){return _0x3dac6a[_0xf329('0x54')];});}else{return;}})[_0xf329('0x23')](function(_0x3afcee){if(_0x3afcee)_0x698d0b=_0x3afcee;if(_[_0xf329('0x5e')](_0x698d0b,0x64)){var _0x48928a=_[_0xf329('0x43')](_0x1961af,{'sectionId':0x64});return hasDefaultDashboard(_0x48928a)[_0xf329('0x23')](function(_0xe76eeb){return _[_0xf329('0x28')](_0x1961af,function(_0x5bb5b8){if(_0x5bb5b8[_0xf329('0x54')]===0x64){_0x5bb5b8[_0xf329('0x5f')]=_0xe76eeb;}return _0x5bb5b8;});});}else{return;}})[_0xf329('0x23')](function(_0x56b8bb){if(_0x56b8bb)_0x1961af=_0x56b8bb;if(_[_0xf329('0x5e')](_0x698d0b,0x3eb)){var _0x11f47c=_[_0xf329('0x43')](_0x1961af,{'sectionId':0x3eb});return getCustomDashboards(_0x11f47c)[_0xf329('0x23')](function(_0x34884c){return _[_0xf329('0x28')](_0x1961af,function(_0x1ae43a){if(_0x11f47c[_0xf329('0x5d')]){if(_0x1ae43a[_0xf329('0x54')]===0x3eb){_0x1ae43a['subsections']=_0x34884c;}}else{if(_0x1ae43a[_0xf329('0x54')]===0x64){if(!_0x1ae43a[_0xf329('0x5f')]){_0x1ae43a[_0xf329('0x5f')]=[];}_0x1ae43a[_0xf329('0x5f')]=_0x1ae43a[_0xf329('0x5f')][_0xf329('0x60')](_0x34884c);}}return _0x1ae43a;});});}else{return;}})[_0xf329('0x23')](function(_0x486608){if(_0x486608)_0x1961af=_0x486608;if(_[_0xf329('0x5e')](_0x698d0b,0x709)){var _0x3fe830=_[_0xf329('0x43')](_0x1961af,{'sectionId':0x709});return getPlugins(_0x3fe830)[_0xf329('0x23')](function(_0x443e76){if(_0x3fe830[_0xf329('0x5d')]){return _[_0xf329('0x28')](_0x1961af,function(_0x3f7fb7){if(_0x3f7fb7['sectionId']===0x709){_0x3f7fb7[_0xf329('0x5f')]=_0x443e76;}return _0x3f7fb7;});}else{var _0x3a139a={'sectionId':0x76c,'enabled':0x1,'subsections':_0x443e76};var _0x8577fe=_[_0xf329('0x28')](_0x1961af);_0x8577fe['push'](_0x3a139a);return _0x8577fe;}});}else{return;}})['then'](function(_0x3e7125){if(_0x3e7125)_0x1961af=_0x3e7125;return _[_0xf329('0x39')](_0x1961af,['enabled',0x1]);})[_0xf329('0x23')](respondWithResult(_0xae62d7,null))[_0xf329('0x44')](handleError(_0xae62d7,null));};function hasDefaultDashboard(_0x470da1){var _0x352a0e=[0x65];return new BPromise(function(_0x1d4898,_0x3182ee){try{if(_0x470da1[_0xf329('0x51')]){_0x1d4898(_0x352a0e);}else{return db[_0xf329('0x52')][_0xf329('0x61')]({'where':{'sectionId':_0x470da1['id']},'raw':!![]})['then'](function(_0x33fb56){_0x33fb56?_0x1d4898(_0x352a0e):_0x1d4898();});}}catch(_0x369f41){_0x3182ee(_0x369f41);}});}function getCustomDashboards(_0x175289){var _0x1e3325=[];return new BPromise(function(_0x55055a,_0x37e1ab){try{if(_0x175289['autoAssociation']){return db[_0xf329('0x62')]['findAll']({'raw':!![]})[_0xf329('0x23')](function(_0x42024f){_0x42024f['forEach'](function(_0xfadf67){_0x1e3325[_0xf329('0x5a')](_0xfadf67['id']+0x1869f);});_0x55055a(_0x1e3325);});}else{return db['UserProfileResource'][_0xf329('0x3f')]({'where':{'sectionId':_0x175289['id']},'raw':!![]})[_0xf329('0x23')](function(_0x2d3761){_0x2d3761[_0xf329('0x63')](function(_0x208dfe){_0x1e3325['push'](_0x208dfe['resourceId']+0x1869f);});_0x55055a(_0x1e3325);});}}catch(_0x533a8d){_0x37e1ab(_0x533a8d);}});}function getPlugins(_0x5753a4){var _0x596209=[];return new BPromise(function(_0x22e6ae,_0x3846e1){try{if(_0x5753a4[_0xf329('0x51')]){return db['Plugin'][_0xf329('0x3f')]({'raw':!![]})['then'](function(_0xa357){_0xa357[_0xf329('0x63')](function(_0x2d4fda){_0x596209[_0xf329('0x5a')](_0x2d4fda['id']+0x15b38);});_0x22e6ae(_0x596209);});}else{return db[_0xf329('0x52')][_0xf329('0x3f')]({'where':{'sectionId':_0x5753a4['id']},'raw':!![]})['then'](function(_0x5a2b86){_0x5a2b86[_0xf329('0x63')](function(_0xe7581a){_0x596209[_0xf329('0x5a')](_0xe7581a[_0xf329('0x64')]+0x15b38);});_0x22e6ae(_0x596209);});}}catch(_0x18c19e){_0x3846e1(_0x18c19e);}});}exports[_0xf329('0x65')]=function(_0x2b3587,_0x46fec9){return db[_0xf329('0x29')]['find']({'where':{'id':_0x2b3587[_0xf329('0x48')]['id']}})[_0xf329('0x23')](handleEntityNotFound(_0x46fec9,null))['then'](function(_0x353c52){if(_0x353c52){return db[_0xf329('0x4d')][_0xf329('0x4e')](function(_0x9da24a){return db['UserProfileSection'][_0xf329('0x3f')]({'where':{'userProfileId':_0x2b3587[_0xf329('0x48')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x2827e4){if(_0x2827e4){return db[_0xf329('0x4f')][_0xf329('0x24')]({'where':{'userProfileId':_0x2b3587[_0xf329('0x48')]['id'],'id':_[_0xf329('0x28')](_0x2827e4,function(_0x4a037b){return _0x4a037b['id'];})},'transaction':_0x9da24a});}})[_0xf329('0x23')](function(_0xa279ac){var _0x1ea594=_['map'](_0x2b3587[_0xf329('0x46')],function(_0x557b38){_0x557b38[_0xf329('0x55')]=_0x2b3587[_0xf329('0x48')]['id'];return _0x557b38;});return db[_0xf329('0x4f')]['bulkCreate'](_0x1ea594,{'raw':!![],'transaction':_0x9da24a});})[_0xf329('0x23')](function(_0xd0520e){var _0x392a4f=_[_0xf329('0x39')](_['map'](_0xd0520e,function(_0x3fc3d2){return _0x3fc3d2[_0xf329('0x49')]({'plain':!![]});}),{'includeAll':![]});if(_0x392a4f){return db[_0xf329('0x4f')]['findAll']({'where':{'userProfileId':_0x2b3587[_0xf329('0x48')]['id'],'sectionId':_[_0xf329('0x28')](_0x392a4f,function(_0x3a0f30){return _0x3a0f30[_0xf329('0x54')];})},'attributes':['id',_0xf329('0x54')],'raw':!![]})[_0xf329('0x23')](function(_0x2f8fba){var _0xccd93f=_['map'](_0x2b3587[_0xf329('0x46')],function(_0x25f626){_0x25f626[_0xf329('0x55')]=_0x2b3587[_0xf329('0x48')]['id'];return _0x25f626;});return db[_0xf329('0x52')][_0xf329('0x66')](_0xccd93f,{'raw':!![],'transaction':_0x9da24a});});}})[_0xf329('0x44')](handleError(_0x46fec9,null));});}})[_0xf329('0x23')](function(_0x3a256e){var _0x3e473b=_[_0xf329('0x28')](_0x3a256e,function(_0x1e1bbd){return _0x1e1bbd[_0xf329('0x49')]({'plain':!![]});});})[_0xf329('0x23')](respondWithResult(_0x46fec9,null))[_0xf329('0x44')](handleError(_0x46fec9,null));};exports[_0xf329('0x67')]=function(_0x18feb6,_0x586cd6,_0x5539df){return db['UserProfile'][_0xf329('0x43')]({'where':{'id':_0x18feb6[_0xf329('0x48')]['id']}})[_0xf329('0x23')](handleEntityNotFound(_0x586cd6,null))[_0xf329('0x23')](function(_0x19fb24){if(_0x19fb24){return _0x19fb24[_0xf329('0x67')](_0x18feb6['query'][_0xf329('0x68')]);}})[_0xf329('0x23')](respondWithStatusCode(_0x586cd6,null))['catch'](handleError(_0x586cd6,null));};exports[_0xf329('0x69')]=function(_0x355115,_0x2f52f4){var _0x5788a8={};if(!_0x355115[_0xf329('0x2d')][_0xf329('0x6a')])throw new Error('Missing\x20section\x20parameter');if(!_0x355115[_0xf329('0x2d')][_0xf329('0x34')]('nolimit')){_0x5788a8[_0xf329('0x1e')]=qs[_0xf329('0x1e')](_0x355115['query']['limit']);_0x5788a8[_0xf329('0x1c')]=qs['offset'](_0x355115[_0xf329('0x2d')][_0xf329('0x1c')]);}return db[_0xf329('0x29')][_0xf329('0x43')]({'where':{'id':_0x355115[_0xf329('0x48')]['id']}})[_0xf329('0x23')](function(_0x385ec1){if(!_0x385ec1)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x355115[_0xf329('0x48')]['id']);return db[_0xf329('0x29')][_0xf329('0x69')](_0x355115);})[_0xf329('0x23')](respondWithFilteredResult(_0x2f52f4,_0x5788a8))[_0xf329('0x44')](handleError(_0x2f52f4,null));}; \ No newline at end of file +var _0x311a=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','name','send','index','map','rawAttributes','fieldName','type','keys','filters','intersection','model','attributes','fields','query','length','order','sort','where','pick','filter','VIRTUAL','merge','UserProfile','includeAll','findAll','rows','show','params','include','options','find','catch','create','body','clone','get','omit','createdAt','crudPermissions','updatedAt','sequelize','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','destroy','describe','transaction','push','ids','getSections','enabled','includes','subsections','concat','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x252295,_0x4bc665){var _0x27f24e=function(_0x513615){while(--_0x513615){_0x252295['push'](_0x252295['shift']());}};_0x27f24e(++_0x4bc665);}(_0x311a,0x6e));var _0xa311=function(_0x58a3c0,_0x4bdb75){_0x58a3c0=_0x58a3c0-0x0;var _0x49bf1f=_0x311a[_0x58a3c0];return _0x49bf1f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa311('0x0'));var zipdir=require(_0xa311('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa311('0x2'));var BPromise=require(_0xa311('0x3'));var Mustache=require(_0xa311('0x4'));var util=require(_0xa311('0x5'));var path=require(_0xa311('0x6'));var sox=require(_0xa311('0x7'));var csv=require(_0xa311('0x8'));var ejs=require(_0xa311('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa311('0xa'));var squel=require(_0xa311('0xb'));var crypto=require(_0xa311('0xc'));var jsforce=require(_0xa311('0xd'));var deskjs=require(_0xa311('0xe'));var toCsv=require(_0xa311('0x8'));var querystring=require('querystring');var Papa=require(_0xa311('0xf'));var Redis=require(_0xa311('0x10'));var authService=require(_0xa311('0x11'));var qs=require(_0xa311('0x12'));var as=require(_0xa311('0x13'));var hardwareService=require(_0xa311('0x14'));var logger=require(_0xa311('0x15'))('api');var utils=require(_0xa311('0x16'));var config=require(_0xa311('0x17'));var licenseUtil=require(_0xa311('0x18'));var db=require(_0xa311('0x19'))['db'];config[_0xa311('0x1a')]=_[_0xa311('0x1b')](config['redis'],{'host':_0xa311('0x1c'),'port':0x18eb});var socket=require(_0xa311('0x1d'))(new Redis(config['redis']));require('./userProfile.socket')[_0xa311('0x1e')](socket);function respondWithStatusCode(_0x3d0f8f,_0x4b0975){_0x4b0975=_0x4b0975||0xcc;return function(_0x46a758){if(_0x46a758){return _0x3d0f8f['sendStatus'](_0x4b0975);}return _0x3d0f8f[_0xa311('0x1f')](_0x4b0975)[_0xa311('0x20')]();};}function respondWithResult(_0x103985,_0x1d67c9){_0x1d67c9=_0x1d67c9||0xc8;return function(_0x4c9339){if(_0x4c9339){return _0x103985[_0xa311('0x1f')](_0x1d67c9)['json'](_0x4c9339);}};}function respondWithFilteredResult(_0x4efbbe,_0x42a219){return function(_0x427167){if(_0x427167){var _0xa1292=typeof _0x42a219[_0xa311('0x21')]==='undefined'&&typeof _0x42a219[_0xa311('0x22')]==='undefined';var _0x1239f6=_0x427167[_0xa311('0x23')];var _0xd1f116=_0xa1292?0x0:_0x42a219['offset'];var _0xdb9486=_0xa1292?_0x427167[_0xa311('0x23')]:_0x42a219[_0xa311('0x21')]+_0x42a219[_0xa311('0x22')];var _0x2900cd;if(_0xdb9486>=_0x1239f6){_0xdb9486=_0x1239f6;_0x2900cd=0xc8;}else{_0x2900cd=0xce;}_0x4efbbe[_0xa311('0x1f')](_0x2900cd);return _0x4efbbe[_0xa311('0x24')](_0xa311('0x25'),_0xd1f116+'-'+_0xdb9486+'/'+_0x1239f6)[_0xa311('0x26')](_0x427167);}return null;};}function patchUpdates(_0x51ccb3){return function(_0x539c9c){try{jsonpatch[_0xa311('0x27')](_0x539c9c,_0x51ccb3,!![]);}catch(_0x2a3096){return BPromise[_0xa311('0x28')](_0x2a3096);}return _0x539c9c[_0xa311('0x29')]();};}function saveUpdates(_0x51b786,_0x51a13c){return function(_0x6d177){if(_0x6d177){return _0x6d177[_0xa311('0x2a')](_0x51b786)[_0xa311('0x2b')](function(_0x43d6f4){return _0x43d6f4;});}return null;};}function removeEntity(_0x564773,_0x10c704){return function(_0x13b0c5){if(_0x13b0c5){return _0x13b0c5['destroy']()[_0xa311('0x2b')](function(){_0x564773[_0xa311('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12b033,_0x5cdf2a){return function(_0x1962a4){if(!_0x1962a4){_0x12b033[_0xa311('0x2c')](0x194);}return _0x1962a4;};}function handleError(_0x583748,_0x45c1e6){_0x45c1e6=_0x45c1e6||0x1f4;return function(_0x21556e){logger['error'](_0x21556e['stack']);if(_0x21556e['name']){delete _0x21556e[_0xa311('0x2d')];}_0x583748['status'](_0x45c1e6)[_0xa311('0x2e')](_0x21556e);};}exports[_0xa311('0x2f')]=function(_0x5a7422,_0x12daa4){var _0x1294d6={},_0x4dbda2={},_0x12fa42={'count':0x0,'rows':[]};var _0x22f6d9=_[_0xa311('0x30')](db['UserProfile'][_0xa311('0x31')],function(_0x3e0326){return{'name':_0x3e0326[_0xa311('0x32')],'type':_0x3e0326[_0xa311('0x33')]['key']};});_0x4dbda2['model']=_['map'](_0x22f6d9,_0xa311('0x2d'));_0x4dbda2['query']=_[_0xa311('0x34')](_0x5a7422['query']);_0x4dbda2[_0xa311('0x35')]=_[_0xa311('0x36')](_0x4dbda2[_0xa311('0x37')],_0x4dbda2['query']);_0x1294d6[_0xa311('0x38')]=_[_0xa311('0x36')](_0x4dbda2['model'],qs[_0xa311('0x39')](_0x5a7422[_0xa311('0x3a')][_0xa311('0x39')]));_0x1294d6[_0xa311('0x38')]=_0x1294d6['attributes'][_0xa311('0x3b')]?_0x1294d6[_0xa311('0x38')]:_0x4dbda2[_0xa311('0x37')];if(!_0x5a7422[_0xa311('0x3a')]['hasOwnProperty']('nolimit')){_0x1294d6['limit']=qs['limit'](_0x5a7422[_0xa311('0x3a')][_0xa311('0x22')]);_0x1294d6['offset']=qs[_0xa311('0x21')](_0x5a7422[_0xa311('0x3a')][_0xa311('0x21')]);}_0x1294d6[_0xa311('0x3c')]=qs[_0xa311('0x3d')](_0x5a7422[_0xa311('0x3a')][_0xa311('0x3d')]);_0x1294d6[_0xa311('0x3e')]=qs[_0xa311('0x35')](_[_0xa311('0x3f')](_0x5a7422[_0xa311('0x3a')],_0x4dbda2[_0xa311('0x35')]),_0x22f6d9);if(_0x5a7422[_0xa311('0x3a')][_0xa311('0x40')]){_0x1294d6[_0xa311('0x3e')]=_['merge'](_0x1294d6[_0xa311('0x3e')],{'$or':_[_0xa311('0x30')](_0x22f6d9,function(_0x560823){if(_0x560823[_0xa311('0x33')]!==_0xa311('0x41')){var _0x2de197={};_0x2de197[_0x560823[_0xa311('0x2d')]]={'$like':'%'+_0x5a7422['query'][_0xa311('0x40')]+'%'};return _0x2de197;}})});}_0x1294d6=_[_0xa311('0x42')]({},_0x1294d6,_0x5a7422['options']);var _0x13c39a={'where':_0x1294d6[_0xa311('0x3e')]};return db[_0xa311('0x43')]['count'](_0x13c39a)[_0xa311('0x2b')](function(_0x557a04){_0x12fa42[_0xa311('0x23')]=_0x557a04;if(_0x5a7422[_0xa311('0x3a')][_0xa311('0x44')]){_0x1294d6['include']=[{'all':!![]}];}return db[_0xa311('0x43')][_0xa311('0x45')](_0x1294d6);})[_0xa311('0x2b')](function(_0x262d44){_0x12fa42[_0xa311('0x46')]=_0x262d44;return _0x12fa42;})['then'](respondWithFilteredResult(_0x12daa4,_0x1294d6))['catch'](handleError(_0x12daa4,null));};exports[_0xa311('0x47')]=function(_0x58564c,_0x1dbe97){var _0x39dddc={'raw':![],'where':{'id':_0x58564c[_0xa311('0x48')]['id']}},_0x3d81ae={};_0x3d81ae['model']=_[_0xa311('0x34')](db[_0xa311('0x43')][_0xa311('0x31')]);_0x3d81ae['query']=_[_0xa311('0x34')](_0x58564c[_0xa311('0x3a')]);_0x3d81ae[_0xa311('0x35')]=_[_0xa311('0x36')](_0x3d81ae[_0xa311('0x37')],_0x3d81ae[_0xa311('0x3a')]);_0x39dddc[_0xa311('0x38')]=_[_0xa311('0x36')](_0x3d81ae[_0xa311('0x37')],qs[_0xa311('0x39')](_0x58564c[_0xa311('0x3a')][_0xa311('0x39')]));_0x39dddc[_0xa311('0x38')]=_0x39dddc[_0xa311('0x38')][_0xa311('0x3b')]?_0x39dddc[_0xa311('0x38')]:_0x3d81ae[_0xa311('0x37')];if(_0x58564c['query'][_0xa311('0x44')]){_0x39dddc[_0xa311('0x49')]=[{'all':!![]}];}_0x39dddc=_[_0xa311('0x42')]({},_0x39dddc,_0x58564c[_0xa311('0x4a')]);return db[_0xa311('0x43')][_0xa311('0x4b')](_0x39dddc)[_0xa311('0x2b')](handleEntityNotFound(_0x1dbe97,null))['then'](respondWithResult(_0x1dbe97,null))[_0xa311('0x4c')](handleError(_0x1dbe97,null));};exports[_0xa311('0x4d')]=function(_0x2785c7,_0x55bc94){return db[_0xa311('0x43')]['create'](_0x2785c7[_0xa311('0x4e')],{})['then'](respondWithResult(_0x55bc94,0xc9))[_0xa311('0x4c')](handleError(_0x55bc94,null));};exports[_0xa311('0x4f')]=function(_0x53b15d,_0x5e89a2){var _0x525935={'where':{'id':_0x53b15d['params']['id']}},_0xd53a20={};_0xd53a20[_0xa311('0x37')]=_[_0xa311('0x34')](db[_0xa311('0x43')][_0xa311('0x31')]);_0x525935['attributes']=_[_0xa311('0x36')](_0xd53a20[_0xa311('0x37')],qs['fields'](_0x53b15d[_0xa311('0x3a')]['fields']));_0x525935[_0xa311('0x38')]=_0x525935['attributes']['length']?_0x525935['attributes']:_0xd53a20[_0xa311('0x37')];if(_0x53b15d[_0xa311('0x3a')]['includeAll']){_0x525935[_0xa311('0x49')]=[{'all':!![]}];}_0x525935=_[_0xa311('0x42')]({},_0x525935,_0x53b15d[_0xa311('0x4a')]);return db[_0xa311('0x43')][_0xa311('0x4b')](_0x525935)[_0xa311('0x2b')](handleEntityNotFound(_0x5e89a2,null))['then'](function(_0xb1a0fa){if(_0xb1a0fa){var _0x251090=_0xb1a0fa[_0xa311('0x50')]({'plain':!![]});_0x251090=qs[_0xa311('0x51')](_0x251090,['id',_0xa311('0x52'),'updatedAt',_0xa311('0x53')]);_0x53b15d[_0xa311('0x4e')]=_['omit'](_0x53b15d['body'],['id','createdAt',_0xa311('0x54')]);return db[_0xa311('0x55')]['transaction'](function(_0x439fcf){return db['UserProfile'][_0xa311('0x4d')](_[_0xa311('0x42')](_0x251090,_0x53b15d[_0xa311('0x4e')]),{'include':_0x53b15d[_0xa311('0x3a')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x439fcf})[_0xa311('0x2b')](function(_0x4dd80f){var _0x45e30a=_0x4dd80f[_0xa311('0x50')]({'plain':!![]});return db['UserProfileSection'][_0xa311('0x45')]({'where':{'userProfileId':_0x53b15d['params']['id']},'raw':!![]})[_0xa311('0x2b')](function(_0x385c2){if(_0x385c2){return BPromise[_0xa311('0x56')](_0x385c2,function(_0x3d8f91){return new BPromise(function(_0x5ad1ee,_0x84170d){if(_0x3d8f91['autoAssociation']===null||_0x3d8f91[_0xa311('0x57')]===0x1)_0x5ad1ee(null);return db[_0xa311('0x58')]['findAll']({'where':{'sectionId':_0x3d8f91['id']},'raw':!![]})[_0xa311('0x2b')](function(_0x44d3b7){var _0x568be6=_['map'](_0x44d3b7,function(_0x104956){return qs['omit'](_0x104956,['id','createdAt',_0xa311('0x54'),_0xa311('0x59')]);});_0x5ad1ee(_0x568be6);})['catch'](function(_0x5dbfcc){_0x84170d(_0x5dbfcc);});})[_0xa311('0x2b')](function(_0x4ca057){var _0x2dd27c=qs['omit'](_0x3d8f91,['id',_0xa311('0x52'),'updatedAt']);_0x2dd27c[_0xa311('0x5a')]=_0x45e30a['id'];if(_0x4ca057)_0x2dd27c[_0xa311('0x5b')]=_0x4ca057;return _0x2dd27c;})[_0xa311('0x2b')](function(_0x2568fd){return db[_0xa311('0x5c')][_0xa311('0x4d')](_0x2568fd,{'include':[{'model':db[_0xa311('0x58')],'as':_0xa311('0x5b')}],'raw':!![],'transaction':_0x439fcf});});})[_0xa311('0x2b')](function(){return _0x45e30a;});}});});});}})['then'](respondWithResult(_0x5e89a2,0xc9))[_0xa311('0x4c')](handleError(_0x5e89a2,null));};exports[_0xa311('0x2a')]=function(_0x5a6668,_0x3fec4e){if(_0x5a6668[_0xa311('0x4e')]['id']){delete _0x5a6668[_0xa311('0x4e')]['id'];}return db[_0xa311('0x43')][_0xa311('0x4b')]({'where':{'id':_0x5a6668[_0xa311('0x48')]['id']}})[_0xa311('0x2b')](handleEntityNotFound(_0x3fec4e,null))['then'](saveUpdates(_0x5a6668[_0xa311('0x4e')],null))[_0xa311('0x2b')](respondWithResult(_0x3fec4e,null))['catch'](handleError(_0x3fec4e,null));};exports[_0xa311('0x5d')]=function(_0x488a1f,_0x596f3b){return db[_0xa311('0x43')][_0xa311('0x4b')]({'where':{'id':_0x488a1f[_0xa311('0x48')]['id']}})['then'](handleEntityNotFound(_0x596f3b,null))['then'](removeEntity(_0x596f3b,null))[_0xa311('0x4c')](handleError(_0x596f3b,null));};exports[_0xa311('0x5e')]=function(_0x24a7a0,_0x21c52b){return db[_0xa311('0x43')][_0xa311('0x5e')]()[_0xa311('0x2b')](respondWithResult(_0x21c52b,null))['catch'](handleError(_0x21c52b,null));};exports['addSections']=function(_0x54fe14,_0x2b9382){var _0x48a2c7=_0x54fe14[_0xa311('0x4e')];return db[_0xa311('0x43')][_0xa311('0x4b')]({'where':{'id':_0x54fe14[_0xa311('0x48')]['id']}})[_0xa311('0x2b')](handleEntityNotFound(_0x2b9382,null))[_0xa311('0x2b')](function(_0x5dc827){if(_0x5dc827){return db['sequelize'][_0xa311('0x5f')](function(_0x2ad5c9){return db[_0xa311('0x5c')][_0xa311('0x5d')]({'where':{'userProfileId':_0x54fe14['params']['id'],'sectionId':_[_0xa311('0x30')](_0x48a2c7,function(_0xfc29e3){return _0xfc29e3[_0xa311('0x59')];})},'transaction':_0x2ad5c9})[_0xa311('0x2b')](function(){var _0x5354d6=_['map'](_0x48a2c7,function(_0x6953b){_0x6953b[_0xa311('0x5a')]=_0x54fe14[_0xa311('0x48')]['id'];return _0x6953b;});var _0x1b5406=[];return BPromise[_0xa311('0x56')](_0x5354d6,function(_0x476b5c){return db['UserProfileSection']['create'](_0x476b5c,{'include':[{'model':db[_0xa311('0x58')],'as':_0xa311('0x5b')}],'raw':!![],'transaction':_0x2ad5c9})[_0xa311('0x2b')](function(_0x2234fc){_0x1b5406[_0xa311('0x60')](_0x2234fc[_0xa311('0x50')]({'plain':!![]}));});})[_0xa311('0x2b')](function(){return _0x1b5406;});});});}})['then'](function(_0x510287){return _0x510287;})[_0xa311('0x2b')](respondWithResult(_0x2b9382,null))['catch'](handleError(_0x2b9382,null));};exports['removeSections']=function(_0x904dd5,_0x393235){var _0x1b279c;return db['UserProfile']['find']({'where':{'id':_0x904dd5[_0xa311('0x48')]['id']},'attributes':['id',_0xa311('0x2d')]})[_0xa311('0x2b')](handleEntityNotFound(_0x393235,null))['then'](function(_0x37ccd2){if(_0x37ccd2){_0x1b279c=_0x37ccd2;return db[_0xa311('0x5c')][_0xa311('0x5d')]({'where':{'userProfileId':_0x904dd5[_0xa311('0x48')]['id'],'sectionId':_0x904dd5[_0xa311('0x3a')][_0xa311('0x61')]}});}})[_0xa311('0x2b')](function(){return _0x1b279c;})[_0xa311('0x2b')](respondWithStatusCode(_0x393235,null))[_0xa311('0x4c')](handleError(_0x393235,null));};exports[_0xa311('0x62')]=function(_0x5a885a,_0xc9f540){var _0x497b3c=[];var _0x585cc2=[];return db[_0xa311('0x5c')][_0xa311('0x45')]({'where':{'userProfileId':_0x5a885a[_0xa311('0x48')]['id']},'raw':!![]})['then'](function(_0x4c4c5e){_0x497b3c=_[_0xa311('0x40')](_0x4c4c5e,function(_0x8f37c7){return _0x8f37c7[_0xa311('0x63')]===0x1||_[_0xa311('0x64')]([0x3eb,0x709],_0x8f37c7[_0xa311('0x59')]);});if(!_['isEmpty'](_0x497b3c)){return _[_0xa311('0x30')](_0x497b3c,function(_0x528c85){return _0x528c85['sectionId'];});}else{return;}})[_0xa311('0x2b')](function(_0x537ca3){if(_0x537ca3)_0x585cc2=_0x537ca3;if(_[_0xa311('0x64')](_0x585cc2,0x64)){var _0x17c703=_[_0xa311('0x4b')](_0x497b3c,{'sectionId':0x64});return hasDefaultDashboard(_0x17c703)[_0xa311('0x2b')](function(_0x3a6e27){return _['map'](_0x497b3c,function(_0x17823d){if(_0x17823d[_0xa311('0x59')]===0x64){_0x17823d[_0xa311('0x65')]=_0x3a6e27;}return _0x17823d;});});}else{return;}})['then'](function(_0xc336be){if(_0xc336be)_0x497b3c=_0xc336be;if(_[_0xa311('0x64')](_0x585cc2,0x3eb)){var _0x5bd7f1=_['find'](_0x497b3c,{'sectionId':0x3eb});return getCustomDashboards(_0x5bd7f1)[_0xa311('0x2b')](function(_0x3ed316){return _[_0xa311('0x30')](_0x497b3c,function(_0x24bfab){if(_0x5bd7f1[_0xa311('0x63')]){if(_0x24bfab[_0xa311('0x59')]===0x3eb){_0x24bfab['subsections']=_0x3ed316;}}else{if(_0x24bfab['sectionId']===0x64){if(!_0x24bfab[_0xa311('0x65')]){_0x24bfab['subsections']=[];}_0x24bfab['subsections']=_0x24bfab[_0xa311('0x65')][_0xa311('0x66')](_0x3ed316);}}return _0x24bfab;});});}else{return;}})[_0xa311('0x2b')](function(_0x317666){if(_0x317666)_0x497b3c=_0x317666;if(_[_0xa311('0x64')](_0x585cc2,0x709)){var _0x25ff3a=_[_0xa311('0x4b')](_0x497b3c,{'sectionId':0x709});return getPlugins(_0x25ff3a)[_0xa311('0x2b')](function(_0x30a102){if(_0x25ff3a[_0xa311('0x63')]){return _['map'](_0x497b3c,function(_0xf04ae3){if(_0xf04ae3['sectionId']===0x709){_0xf04ae3[_0xa311('0x65')]=_0x30a102;}return _0xf04ae3;});}else{var _0x23b1f6={'sectionId':0x76c,'enabled':0x1,'subsections':_0x30a102};var _0x2b1750=_[_0xa311('0x30')](_0x497b3c);_0x2b1750['push'](_0x23b1f6);return _0x2b1750;}});}else{return;}})[_0xa311('0x2b')](function(_0x491559){if(_0x491559)_0x497b3c=_0x491559;return _[_0xa311('0x40')](_0x497b3c,[_0xa311('0x63'),0x1]);})[_0xa311('0x2b')](respondWithResult(_0xc9f540,null))[_0xa311('0x4c')](handleError(_0xc9f540,null));};function hasDefaultDashboard(_0x1f0e74){var _0x35cc94=[0x65];return new BPromise(function(_0x5b89d1,_0x109001){try{if(_0x1f0e74['autoAssociation']){_0x5b89d1(_0x35cc94);}else{return db['UserProfileResource'][_0xa311('0x67')]({'where':{'sectionId':_0x1f0e74['id']},'raw':!![]})[_0xa311('0x2b')](function(_0x471564){_0x471564?_0x5b89d1(_0x35cc94):_0x5b89d1();});}}catch(_0x2fd742){_0x109001(_0x2fd742);}});}function getCustomDashboards(_0xc2b38d){var _0x4ccfc8=[];return new BPromise(function(_0x3c3c21,_0x294500){try{if(_0xc2b38d[_0xa311('0x57')]){return db[_0xa311('0x68')][_0xa311('0x45')]({'raw':!![]})['then'](function(_0x4f54b7){_0x4f54b7[_0xa311('0x69')](function(_0x346ab2){_0x4ccfc8[_0xa311('0x60')](_0x346ab2['id']+0x1869f);});_0x3c3c21(_0x4ccfc8);});}else{return db[_0xa311('0x58')]['findAll']({'where':{'sectionId':_0xc2b38d['id']},'raw':!![]})[_0xa311('0x2b')](function(_0x211388){_0x211388['forEach'](function(_0x1e5147){_0x4ccfc8[_0xa311('0x60')](_0x1e5147[_0xa311('0x6a')]+0x1869f);});_0x3c3c21(_0x4ccfc8);});}}catch(_0x373a2c){_0x294500(_0x373a2c);}});}function getPlugins(_0xe0a57c){var _0x1dfebc=[];return new BPromise(function(_0x1de443,_0x21220c){try{if(_0xe0a57c[_0xa311('0x57')]){return db[_0xa311('0x6b')][_0xa311('0x45')]({'raw':!![]})[_0xa311('0x2b')](function(_0x524172){_0x524172[_0xa311('0x69')](function(_0x75686b){_0x1dfebc['push'](_0x75686b['id']+0x15b38);});_0x1de443(_0x1dfebc);});}else{return db[_0xa311('0x58')]['findAll']({'where':{'sectionId':_0xe0a57c['id']},'raw':!![]})[_0xa311('0x2b')](function(_0x44f988){_0x44f988['forEach'](function(_0x5e3933){_0x1dfebc[_0xa311('0x60')](_0x5e3933['resourceId']+0x15b38);});_0x1de443(_0x1dfebc);});}}catch(_0x540f6c){_0x21220c(_0x540f6c);}});}exports[_0xa311('0x6c')]=function(_0x49de11,_0x6bedb7){return db[_0xa311('0x43')][_0xa311('0x4b')]({'where':{'id':_0x49de11[_0xa311('0x48')]['id']}})[_0xa311('0x2b')](handleEntityNotFound(_0x6bedb7,null))[_0xa311('0x2b')](function(_0xf7ce1){if(_0xf7ce1){return db['sequelize']['transaction'](function(_0x3a3e8a){return db[_0xa311('0x5c')]['findAll']({'where':{'userProfileId':_0x49de11[_0xa311('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0xa311('0x2b')](function(_0x19d74b){if(_0x19d74b){return db[_0xa311('0x5c')][_0xa311('0x5d')]({'where':{'userProfileId':_0x49de11['params']['id'],'id':_[_0xa311('0x30')](_0x19d74b,function(_0xdc5e75){return _0xdc5e75['id'];})},'transaction':_0x3a3e8a});}})[_0xa311('0x2b')](function(_0x501a36){var _0x3e6c15=_[_0xa311('0x30')](_0x49de11[_0xa311('0x4e')],function(_0x514a5c){_0x514a5c[_0xa311('0x5a')]=_0x49de11[_0xa311('0x48')]['id'];return _0x514a5c;});return db[_0xa311('0x5c')][_0xa311('0x6d')](_0x3e6c15,{'raw':!![],'transaction':_0x3a3e8a});})['then'](function(_0x414b44){var _0x1507e7=_['filter'](_[_0xa311('0x30')](_0x414b44,function(_0x23c77c){return _0x23c77c[_0xa311('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x1507e7){return db[_0xa311('0x5c')][_0xa311('0x45')]({'where':{'userProfileId':_0x49de11[_0xa311('0x48')]['id'],'sectionId':_[_0xa311('0x30')](_0x1507e7,function(_0x496347){return _0x496347[_0xa311('0x59')];})},'attributes':['id',_0xa311('0x59')],'raw':!![]})[_0xa311('0x2b')](function(_0x4b5efa){var _0x43e5aa=_['map'](_0x49de11['body'],function(_0x9fa865){_0x9fa865[_0xa311('0x5a')]=_0x49de11[_0xa311('0x48')]['id'];return _0x9fa865;});return db[_0xa311('0x58')][_0xa311('0x6d')](_0x43e5aa,{'raw':!![],'transaction':_0x3a3e8a});});}})[_0xa311('0x4c')](handleError(_0x6bedb7,null));});}})[_0xa311('0x2b')](function(_0x444630){var _0x4cad6c=_[_0xa311('0x30')](_0x444630,function(_0x39b6dd){return _0x39b6dd[_0xa311('0x50')]({'plain':!![]});});})['then'](respondWithResult(_0x6bedb7,null))[_0xa311('0x4c')](handleError(_0x6bedb7,null));};exports[_0xa311('0x6e')]=function(_0x3ada33,_0x61a723,_0x16597c){return db[_0xa311('0x43')][_0xa311('0x4b')]({'where':{'id':_0x3ada33[_0xa311('0x48')]['id']}})[_0xa311('0x2b')](handleEntityNotFound(_0x61a723,null))[_0xa311('0x2b')](function(_0x4675c7){if(_0x4675c7){return _0x4675c7[_0xa311('0x6e')](_0x3ada33[_0xa311('0x3a')][_0xa311('0x61')]);}})[_0xa311('0x2b')](respondWithStatusCode(_0x61a723,null))[_0xa311('0x4c')](handleError(_0x61a723,null));};exports['getResources']=function(_0x32150e,_0x2a1432){var _0x20977d={};if(!_0x32150e['query'][_0xa311('0x6f')])throw new Error('Missing\x20section\x20parameter');if(!_0x32150e[_0xa311('0x3a')][_0xa311('0x70')]('nolimit')){_0x20977d[_0xa311('0x22')]=qs[_0xa311('0x22')](_0x32150e[_0xa311('0x3a')][_0xa311('0x22')]);_0x20977d[_0xa311('0x21')]=qs[_0xa311('0x21')](_0x32150e['query'][_0xa311('0x21')]);}return db[_0xa311('0x43')][_0xa311('0x4b')]({'where':{'id':_0x32150e[_0xa311('0x48')]['id']}})[_0xa311('0x2b')](function(_0x41401d){if(!_0x41401d)throw new Error(_0xa311('0x71')+_0x32150e[_0xa311('0x48')]['id']);return db[_0xa311('0x43')][_0xa311('0x72')](_0x32150e);})[_0xa311('0x2b')](respondWithFilteredResult(_0x2a1432,_0x20977d))[_0xa311('0x4c')](handleError(_0x2a1432,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index cd15d73..49dda03 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 _0x2484=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x50c10e,_0x7c648c){var _0x2574d1=function(_0x4ab67b){while(--_0x4ab67b){_0x50c10e['push'](_0x50c10e['shift']());}};_0x2574d1(++_0x7c648c);}(_0x2484,0x178));var _0x4248=function(_0x8e9597,_0x2aa555){_0x8e9597=_0x8e9597-0x0;var _0x3be06a=_0x2484[_0x8e9597];return _0x3be06a;};'use strict';var EventEmitter=require(_0x4248('0x0'));var UserProfile=require(_0x4248('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x4248('0x2')](0x0);var events={'afterCreate':_0x4248('0x3'),'afterUpdate':_0x4248('0x4'),'afterDestroy':_0x4248('0x5')};function emitEvent(_0x20f0ec){return function(_0x3f98a6,_0x42b611,_0x588b99){UserProfileEvents[_0x4248('0x6')](_0x20f0ec+':'+_0x3f98a6['id'],_0x3f98a6);UserProfileEvents[_0x4248('0x6')](_0x20f0ec,_0x3f98a6);_0x588b99(null);};}for(var e in events){if(events[_0x4248('0x7')](e)){var event=events[e];UserProfile[_0x4248('0x8')](e,emitEvent(event));}}module[_0x4248('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x187d=['save','update','remove','emit','hasOwnProperty','hook','exports','events','UserProfile','setMaxListeners'];(function(_0x529966,_0x25c320){var _0xe643a7=function(_0x39433b){while(--_0x39433b){_0x529966['push'](_0x529966['shift']());}};_0xe643a7(++_0x25c320);}(_0x187d,0x93));var _0xd187=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x187d[_0x47e7cb];return _0x2a8874;};'use strict';var EventEmitter=require(_0xd187('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xd187('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xd187('0x2')](0x0);var events={'afterCreate':_0xd187('0x3'),'afterUpdate':_0xd187('0x4'),'afterDestroy':_0xd187('0x5')};function emitEvent(_0x201b79){return function(_0x58622a,_0x28fa0b,_0x163807){UserProfileEvents['emit'](_0x201b79+':'+_0x58622a['id'],_0x58622a);UserProfileEvents[_0xd187('0x6')](_0x201b79,_0x58622a);_0x163807(null);};}for(var e in events){if(events[_0xd187('0x7')](e)){var event=events[e];UserProfile[_0xd187('0x8')](e,emitEvent(event));}}module[_0xd187('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 1c69caa..d394d3c 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 _0x94fa=['ids','customSorting','extraQueryConditions','Tags','color','tag','ThroughTags','openTabs','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','filter','field','findAll','then','associatedResources','catch','value','model','map','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','JscriptyProject','CmContact','Lists','ListId','lists','CmList','companies','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','voicerecordings','Agents','membername','User','role','agent','Telephones','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','OpenchannelQueue','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','Users','admin','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','Pause','scheduler','Schedule','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','Reports','metrics','AnalyticMetric','toUpperCase','slice','QueryTypes','SELECT','select','ui.','InteractionId','from','_interactions','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','raw','section','Invalid\x20section\x20\x27','isEmpty','UserProfileSection','find','params','all','ignore','union','length','push','autoAssociation','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','where','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','default','reportId','custom','CustomReports','count','rows'];(function(_0xb7648e,_0x587fa3){var _0x912ad2=function(_0x5641f1){while(--_0x5641f1){_0xb7648e['push'](_0xb7648e['shift']());}};_0x912ad2(++_0x587fa3);}(_0x94fa,0x19b));var _0xa94f=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x94fa[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0xa94f('0x0'));var attributes=require(_0xa94f('0x1'));var squel=require(_0xa94f('0x2'));module['exports']=function(_0x4f7d7c){var _0x56bc6f=_0x4f7d7c['models'];function _0x4c3b16(_0x171d4a,_0x2bbd92){return new Promise(function(_0x429e11,_0x3e1d28){if(!_0x2bbd92)return _0x429e11(null);var _0x51385d=_0x2bbd92['filter']?{[_0x2bbd92[_0xa94f('0x3')][_0xa94f('0x4')]]:_0x2bbd92[_0xa94f('0x3')]['value']}:undefined;return _0x56bc6f[_0x171d4a][_0xa94f('0x5')]({'where':_0x51385d,'raw':!![]})[_0xa94f('0x6')](function(_0x5d568c){_0x2bbd92[_0xa94f('0x7')]=_['map'](_0x5d568c,'id');_0x429e11(_0x2bbd92);})[_0xa94f('0x8')](function(_0x396310){_0x3e1d28(_0x396310);});});}function _0xf2b9ef(_0x439b7d,_0x266d5a){return new Promise(function(_0xe918c5,_0x44ba3a){var _0x32bc00=_0x439b7d[_0xa94f('0x3')]?{[_0x439b7d[_0xa94f('0x3')][_0xa94f('0x4')]]:_0x439b7d[_0xa94f('0x3')][_0xa94f('0x9')]}:undefined;return _0x56bc6f[_0x439b7d[_0xa94f('0xa')]][_0xa94f('0x5')]({'where':_0x32bc00,'raw':!![]})[_0xa94f('0x6')](function(_0x17be6f){_0x266d5a[_0xa94f('0x7')]=_[_0xa94f('0xb')](_0x17be6f,function(_0x19830e){return _0x19830e[_0xa94f('0xc')];});_0xe918c5(_0x266d5a);})[_0xa94f('0x8')](function(_0x4c6e3f){_0x44ba3a(_0x4c6e3f);});});}function _0x21b135(_0xbb7304,_0x1c957,_0x5c78c8){if(!_0x1c957)return Promise[_0xa94f('0xd')](null);return new Promise(function(_0x513ecf,_0x3dcaff){return _0x56bc6f[_0xa94f('0xe')][_0xa94f('0x5')]({'where':{'sectionId':_0x1c957['id']},'raw':!![]})[_0xa94f('0x6')](function(_0x5cdbe6){if(_0xbb7304[_0xa94f('0x4')]&&_0xbb7304[_0xa94f('0x4')]!=='id'){_0x1c957[_0xa94f('0x7')]=_[_0xa94f('0xb')](_0x5cdbe6,function(_0x28136a){return _0x28136a[_0xbb7304[_0xa94f('0x4')]];});}else{if(_0x5c78c8===_0xa94f('0xf')){_0x1c957['associatedResources']=_['map'](_0x5cdbe6,function(_0x36e837){return{'id':_0x36e837[_0xa94f('0x10')],'type':_0x36e837[_0xa94f('0x11')]};});}else{_0x1c957[_0xa94f('0x7')]=_['map'](_0x5cdbe6,function(_0x310dca){return _0x310dca[_0xa94f('0x10')];});}}_0x513ecf(_0x1c957);})[_0xa94f('0x8')](function(_0x2fb31b){_0x3dcaff(_0x2fb31b);});});}function _0x28a8e2(_0x1f36a7,_0x2e7e60){var _0xb000d9={'parentSections':[]};switch(_0x1f36a7[_0xa94f('0x12')]()){case _0xa94f('0x13'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x15');break;case _0xa94f('0x16'):_0xb000d9[_0xa94f('0x14')]='SquareOdbc';break;case _0xa94f('0x17'):_0xb000d9['childModel']=_0xa94f('0x18');_0xb000d9[_0xa94f('0x19')]=[{'name':_0xa94f('0x1a'),'field':_0xa94f('0xc'),'foreignKey':_0xa94f('0x1b')}];break;case'projects':_0xb000d9['childModel']=_0xa94f('0x1c');break;case'contacts':_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x1d');_0xb000d9[_0xa94f('0x19')]=[{'name':_0xa94f('0x1e'),'field':'id','foreignKey':_0xa94f('0x1f')}];break;case _0xa94f('0x20'):_0xb000d9['childModel']=_0xa94f('0x21');break;case _0xa94f('0x22'):_0xb000d9[_0xa94f('0x14')]='CmCompany';break;case'globalcustomfields':_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x23');break;case _0xa94f('0x24'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x25');break;case _0xa94f('0x26'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x27');break;case'faxqueues':_0xb000d9['childModel']=_0xa94f('0x28');break;case _0xa94f('0x29'):_0xb000d9[_0xa94f('0x14')]='FaxAccount';break;case'inboundroutes':case _0xa94f('0x2a'):case _0xa94f('0x2b'):_0xb000d9[_0xa94f('0x14')]='VoiceExtension';break;case _0xa94f('0x2c'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x2d');break;case _0xa94f('0x2e'):_0xb000d9[_0xa94f('0x14')]='VoiceMail';break;case _0xa94f('0x2f'):_0xb000d9[_0xa94f('0x14')]='VoiceRecording';_0xb000d9['parentSections']=[{'name':_0xa94f('0x30'),'field':_0xa94f('0xc'),'foreignKey':_0xa94f('0x31'),'model':_0xa94f('0x32'),'filter':{'field':_0xa94f('0x33'),'value':[_0xa94f('0x34')]}},{'name':_0xa94f('0x35'),'field':_0xa94f('0xc'),'foreignKey':_0xa94f('0x31'),'model':_0xa94f('0x32'),'filter':{'field':_0xa94f('0x33'),'value':['telephone']}},{'name':_0xa94f('0x36'),'field':_0xa94f('0xc'),'foreignKey':_0xa94f('0x37'),'model':_0xa94f('0x38'),'filter':{'field':_0xa94f('0x11'),'value':[_0xa94f('0x39')]}},{'name':_0xa94f('0x3a'),'field':_0xa94f('0xc'),'foreignKey':_0xa94f('0x37'),'model':_0xa94f('0x38'),'filter':{'field':'type','value':[_0xa94f('0x3b')]}}];break;case'musiconholds':_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x3c');break;case _0xa94f('0x3d'):_0xb000d9['childModel']=_0xa94f('0x3e');break;case _0xa94f('0x3f'):_0xb000d9['childModel']=_0xa94f('0x40');break;case _0xa94f('0x41'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x42');break;case _0xa94f('0x43'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x44');break;case _0xa94f('0x45'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x46');break;case _0xa94f('0x47'):_0xb000d9[_0xa94f('0x14')]='MailSubstatus';break;case'openchannelqueues':_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x48');break;case'openchannelaccounts':_0xb000d9['childModel']=_0xa94f('0x49');break;case _0xa94f('0x4a'):_0xb000d9[_0xa94f('0x14')]='SmsQueue';break;case _0xa94f('0x4b'):_0xb000d9['childModel']=_0xa94f('0x4c');break;case _0xa94f('0x4d'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x4e');break;case _0xa94f('0x4f'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x50');break;case _0xa94f('0x51'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x52');break;case _0xa94f('0x53'):case _0xa94f('0x54'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x38');if(_0x2e7e60){_0xb000d9['parentSections']=[{'name':_0xa94f('0x36')},{'name':_0xa94f('0x3a')}];}break;case _0xa94f('0x55'):case'agents':case'telephones':_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x32');if(_0x2e7e60){_0xb000d9['parentSections']=[{'name':_0xa94f('0x56'),'filter':{'field':'role','value':[_0xa94f('0x57'),_0xa94f('0x58')]},'ignore':!![]},{'name':_0xa94f('0x30')},{'name':_0xa94f('0x35')}];}break;case _0xa94f('0x59'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x5a');break;case'salesforceaccounts':_0xb000d9['childModel']=_0xa94f('0x5b');break;case _0xa94f('0x5c'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x5d');break;case _0xa94f('0x5e'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x5f');break;case _0xa94f('0x60'):_0xb000d9['childModel']=_0xa94f('0x61');break;case _0xa94f('0x62'):_0xb000d9[_0xa94f('0x14')]='ZohoAccount';break;case _0xa94f('0x63'):_0xb000d9[_0xa94f('0x14')]='User';break;case _0xa94f('0x64'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x65');break;case _0xa94f('0x66'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x67');break;case _0xa94f('0x68'):_0xb000d9[_0xa94f('0x14')]='Dashboard';break;case _0xa94f('0x69'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x6a');break;case'pauses':_0xb000d9['childModel']=_0xa94f('0x6b');break;case _0xa94f('0x6c'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x6d');break;case'sounds':_0xb000d9['childModel']=_0xa94f('0x6e');break;case _0xa94f('0x6f'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x70');break;case _0xa94f('0x71'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x72');break;case _0xa94f('0x73'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x74');break;case _0xa94f('0x75'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x76');break;case _0xa94f('0x77'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x78');break;case _0xa94f('0x79'):_0xb000d9['childModel']=_0xa94f('0x7a');break;case'extractedreports':_0xb000d9[_0xa94f('0x14')]=_0xa94f('0xf');_0xb000d9[_0xa94f('0x19')]=[{'name':_0xa94f('0x7b'),'field':'id','foreignKey':'reportId'}];break;case _0xa94f('0x7c'):_0xb000d9[_0xa94f('0x14')]=_0xa94f('0x7d');break;}return _0xb000d9;}function _0x114379(_0x412afd,_0x29beb1){var _0x18fa02=_0x412afd['charAt'](0x0)[_0xa94f('0x7e')]()+_0x412afd[_0xa94f('0x7f')](0x1);var _0x26abb8={'type':_0x56bc6f['Sequelize'][_0xa94f('0x80')][_0xa94f('0x81')],'raw':!![]};return new Promise(function(_0x1e95a9,_0x381e34){var _0x5c1c85=squel[_0xa94f('0x82')]()[_0xa94f('0x4')](_0xa94f('0x83')+_0x18fa02+_0xa94f('0x84'),'id')[_0xa94f('0x4')]('ui.createdAt')[_0xa94f('0x85')]('user_has_'+_0x412afd+_0xa94f('0x86'),'ui')['where']('ui.UserId\x20=\x20?',_0x29beb1['id']);return _0x56bc6f[_0xa94f('0x87')][_0xa94f('0x88')](_0x5c1c85[_0xa94f('0x89')](),_0x26abb8)[_0xa94f('0x6')](function(_0x541b5c){_0x29beb1[_0x18fa02+_0xa94f('0x8a')]=_0x541b5c;_0x1e95a9(_0x541b5c);})[_0xa94f('0x8')](function(_0x6427c0){_0x381e34(_0x6427c0);});});}return _0x4f7d7c[_0xa94f('0x8b')](_0xa94f('0x8c'),attributes,{'tableName':_0xa94f('0x8d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x571b81){var _0x40e28e=require(_0xa94f('0x8e'));var _0x5191d7={'raw':_0x571b81['query'][_0xa94f('0x8f')],'where':{}};var _0x442b47={};var _0x31f21f={'count':0x0,'rows':[]};var _0xe2d772=_0x571b81['query'][_0xa94f('0x90')];var _0x2138b1=_0x571b81[_0xa94f('0x88')]['mergeResources']||![];var _0x74ddde=_0x28a8e2(_0xe2d772,_0x2138b1);if(!_0x74ddde[_0xa94f('0x14')])throw new Error(_0xa94f('0x91')+_0xe2d772+'\x27');var _0xf36752=[{'name':_0xe2d772}];if(!_[_0xa94f('0x92')](_0x74ddde[_0xa94f('0x19')]))_0xf36752=_0x74ddde[_0xa94f('0x19')];var _0x5693b1=[];for(var _0xc87368=0x0;_0xc87368<_0xf36752['length'];_0xc87368++){_0x5693b1['push'](_0x56bc6f[_0xa94f('0x93')][_0xa94f('0x94')]({'where':{'userProfileId':_0x571b81[_0xa94f('0x95')]['id'],'name':_0xf36752[_0xc87368][_0xa94f('0xc')]},'raw':!![]}));}return Promise[_0xa94f('0x96')](_0x5693b1)[_0xa94f('0x6')](function(_0x456582){var _0x433e99=_[_0xa94f('0x3')](_0x456582,function(_0x21395b){return _0x21395b?_0x21395b:undefined;});var _0x487772=_[_0xa94f('0x3')](_0xf36752,[_0xa94f('0x97'),!![]]);var _0x555f13=_[_0xa94f('0x92')](_0x433e99)&&_[_0xa94f('0x92')](_0x487772)?null:_[_0xa94f('0x98')](_0x487772,_0x433e99);if(!_0x555f13)return null;var _0x5b23c8=[];for(var _0x5e5569=0x0;_0x5e5569<_0x555f13[_0xa94f('0x99')];_0x5e5569++){var _0x1d014c=_[_0xa94f('0x94')](_0xf36752,function(_0xb942a1){return _0x555f13[_0x5e5569]?_0xb942a1['name']===_0x555f13[_0x5e5569][_0xa94f('0xc')]:null;});if(_0x1d014c){if(_0x555f13[_0x5e5569][_0xa94f('0x97')]){_0x5b23c8[_0xa94f('0x9a')](_0x4c3b16(_0x74ddde['childModel'],_0x555f13[_0x5e5569]));}else{if(!_0x555f13[_0x5e5569][_0xa94f('0x9b')]){_0x5b23c8[_0xa94f('0x9a')](_0x21b135(_0x1d014c,_0x555f13[_0x5e5569],_0x74ddde[_0xa94f('0x14')]));}else{if(_0x1d014c['model']){_0x5b23c8[_0xa94f('0x9a')](_0xf2b9ef(_0x1d014c,_0x555f13[_0x5e5569]));}}}}}return Promise[_0xa94f('0x96')](_0x5b23c8);})[_0xa94f('0x6')](function(_0x2803a0){var _0x298a00=_0x2803a0;var _0x1eac1c=null;if(_0x298a00){_0x1eac1c=_0x298a00[_0xa94f('0x99')]===0x1?_0x298a00[0x0]:null;}if(!_0x1eac1c&&!_0x298a00)return _0x31f21f;var _0x59ff7c=_0x56bc6f[_0x74ddde['childModel']]['rawAttributes'];_0x442b47[_0xa94f('0xa')]=_[_0xa94f('0x9c')](_0x59ff7c);_0x442b47[_0xa94f('0x88')]=_[_0xa94f('0x9c')](_0x571b81[_0xa94f('0x88')]);_0x442b47[_0xa94f('0x9d')]=_[_0xa94f('0x9e')](_0x442b47['model'],_0x442b47['query']);_0x5191d7[_0xa94f('0x9f')]=_[_0xa94f('0x9e')](_0x442b47[_0xa94f('0xa')],_0x40e28e[_0xa94f('0xa0')](_0x571b81[_0xa94f('0x88')][_0xa94f('0xa0')]));_0x5191d7['attributes']=_0x5191d7['attributes']['length']?_0x5191d7[_0xa94f('0x9f')]:_0x442b47['model'];if(!_0x571b81['query'][_0xa94f('0xa1')]('nolimit')){_0x5191d7[_0xa94f('0xa2')]=_0x40e28e[_0xa94f('0xa2')](_0x571b81['query'][_0xa94f('0xa2')]);_0x5191d7[_0xa94f('0xa3')]=_0x40e28e[_0xa94f('0xa3')](_0x571b81[_0xa94f('0x88')][_0xa94f('0xa3')]);}_0x5191d7[_0xa94f('0xa4')]=_0x40e28e[_0xa94f('0xa5')](_0x571b81['query'][_0xa94f('0xa5')]);_0x5191d7[_0xa94f('0xa6')]=_0x40e28e[_0xa94f('0x9d')](_[_0xa94f('0xa7')](_0x571b81[_0xa94f('0x88')],_0x442b47['filters']));if(_0x571b81['query'][_0xa94f('0x3')]){_0x5191d7[_0xa94f('0xa6')]=_[_0xa94f('0xa8')](_0x5191d7[_0xa94f('0xa6')],{'$or':_['map'](_0x59ff7c,function(_0x40a1e7){if(_0x40a1e7['type'][_0xa94f('0xa9')]!==_0xa94f('0xaa')){var _0x57c1f9={};_0x57c1f9[_0x40a1e7['field']]={'$like':'%'+_0x571b81[_0xa94f('0x88')][_0xa94f('0x3')]+'%'};return _0x57c1f9;}})});}var _0x46b4cf=[];var _0x4436b3=null;var _0x455312={};if(_0x1eac1c){_0x4436b3=_['find'](_0xf36752,[_0xa94f('0xc'),_0x1eac1c[_0xa94f('0xc')]]);if(_0x4436b3[_0xa94f('0x4')]){_0x455312={};if(_0x74ddde[_0xa94f('0x14')]==='AnalyticExtractedReport'){_0x455312[_0x4436b3[_0xa94f('0xab')]]=_[_0xa94f('0xb')](_0x1eac1c[_0xa94f('0x7')],'id');}else{_0x455312[_0x4436b3['foreignKey']]=_0x1eac1c[_0xa94f('0x7')];}_0x46b4cf[_0xa94f('0x9a')](_0x455312);}else{_0x5191d7[_0xa94f('0xa6')]['id']=_0x1eac1c['associatedResources'];}}else{for(var _0x421360=0x0;_0x421360<_0x298a00['length'];_0x421360++){_0x4436b3=_[_0xa94f('0x94')](_0xf36752,[_0xa94f('0xc'),_0x298a00[_0x421360][_0xa94f('0xc')]]);if(_0x4436b3['field']){_0x455312={};_0x455312[_0x4436b3[_0xa94f('0xab')]]=_0x298a00[_0x421360][_0xa94f('0x7')];_0x46b4cf[_0xa94f('0x9a')](_0x455312);}else{if(!_0x5191d7[_0xa94f('0xa6')]['id'])_0x5191d7[_0xa94f('0xa6')]['id']=[];_0x298a00[_0x421360][_0xa94f('0x7')][_0xa94f('0xac')](function(_0x396412){_0x5191d7['where']['id']['push'](_0x396412);});}}}if(!_[_0xa94f('0x92')](_0x46b4cf)){_0x5191d7[_0xa94f('0xa6')]=_[_0xa94f('0xa8')](_0x5191d7['where'],{'$and':{'$or':_0x46b4cf}});}_0x5191d7=_[_0xa94f('0xa8')]({},_0x5191d7,_0x571b81[_0xa94f('0xad')]);if(_0x1eac1c&&!_0x1eac1c[_0xa94f('0x9b')]&&_0x74ddde[_0xa94f('0x14')]===_0xa94f('0xf')){if(_0x571b81[_0xa94f('0x88')][_0xa94f('0xae')]){_0x5191d7[_0xa94f('0xaf')]=[{'all':!![]}];}return _0x56bc6f[_0x74ddde[_0xa94f('0x14')]]['findAll'](_0x5191d7)[_0xa94f('0x6')](function(_0x4e306b){var _0xed5975=[];_0x4e306b['forEach'](function(_0x4b999a){var _0x35eb2a;switch(_0x4b999a[_0xa94f('0xb0')]){case _0xa94f('0xb1'):_0x35eb2a=_[_0xa94f('0x94')](_0x1eac1c[_0xa94f('0x7')],function(_0x9c1ee0){return _0x9c1ee0['id']===_0x4b999a[_0xa94f('0xb2')]&&_0x9c1ee0[_0xa94f('0x11')]==='DefaultReports';});break;case _0xa94f('0xb3'):_0x35eb2a=_[_0xa94f('0x94')](_0x1eac1c[_0xa94f('0x7')],function(_0x307b53){return _0x307b53['id']===_0x4b999a['reportId']&&_0x307b53[_0xa94f('0x11')]===_0xa94f('0xb4');});break;}if(_0x35eb2a)_0xed5975[_0xa94f('0x9a')](_0x4b999a);});_0x31f21f[_0xa94f('0xb5')]=_0xed5975[_0xa94f('0x99')];_0x31f21f[_0xa94f('0xb6')]=_0xed5975;return _0x31f21f;});}else{if(!_[_0xa94f('0x92')](_0x571b81[_0xa94f('0x88')][_0xa94f('0xb7')])){_0x5191d7[_0xa94f('0xa6')]['id']=_0x5191d7[_0xa94f('0xa6')]['id']?_[_0xa94f('0x9e')](_0x5191d7[_0xa94f('0xa6')]['id'],_0x571b81['query'][_0xa94f('0xb7')]):_0x571b81[_0xa94f('0x88')][_0xa94f('0xb7')];if(_0x571b81[_0xa94f('0x88')][_0xa94f('0xb8')]){_0x5191d7['order']=_0x571b81[_0xa94f('0x88')][_0xa94f('0xb8')];}}if(_0x571b81[_0xa94f('0x88')]['extraQueryConditions']){_0x5191d7[_0xa94f('0xa6')]=_[_0xa94f('0xa8')](_0x5191d7[_0xa94f('0xa6')],{'$and':_0x571b81['query'][_0xa94f('0xb9')]});}return _0x56bc6f[_0x74ddde[_0xa94f('0x14')]][_0xa94f('0xb5')]({'where':_0x5191d7[_0xa94f('0xa6')]})[_0xa94f('0x6')](function(_0x17f816){_0x31f21f[_0xa94f('0xb5')]=_0x17f816;if(_0x571b81[_0xa94f('0x88')][_0xa94f('0xae')]){if(_0x74ddde[_0xa94f('0x14')]===_0xa94f('0x1d')){_0x5191d7['include']=[{'model':_0x56bc6f[_0xa94f('0x70')],'as':_0xa94f('0xba'),'attributes':['id',_0xa94f('0xc'),_0xa94f('0xbb')],'required':_0x571b81['query'][_0xa94f('0xbc')]?!![]:![]},{'model':_0x56bc6f[_0xa94f('0x70')],'as':_0xa94f('0xbd'),'attributes':['id','name','color'],'through':_0x571b81[_0xa94f('0x88')][_0xa94f('0xbc')]?{'attributes':[],'where':{'TagId':_0x571b81['query'][_0xa94f('0xbc')]||undefined}}:{},'required':_0x571b81[_0xa94f('0x88')]['tag']?!![]:![]}];}else{_0x5191d7['include']=[{'all':!![]}];}}return _0x56bc6f[_0x74ddde[_0xa94f('0x14')]][_0xa94f('0x5')](_0x5191d7);})[_0xa94f('0x6')](function(_0x369d22){_0x31f21f[_0xa94f('0xb6')]=_0x369d22;if(_0xe2d772===_0xa94f('0x30')&&_0x571b81[_0xa94f('0x88')][_0xa94f('0xbe')]==='true'){var _0x584e2f=[];for(var _0x26ed45=0x0;_0x26ed45<_0x31f21f[_0xa94f('0xb6')][_0xa94f('0x99')];_0x26ed45++){_0x584e2f['push'](_0x114379(_0xa94f('0xbf'),_0x31f21f[_0xa94f('0xb6')][_0x26ed45][_0xa94f('0xc0')]));_0x584e2f['push'](_0x114379(_0xa94f('0xc1'),_0x31f21f[_0xa94f('0xb6')][_0x26ed45][_0xa94f('0xc0')]));_0x584e2f[_0xa94f('0x9a')](_0x114379(_0xa94f('0xc2'),_0x31f21f[_0xa94f('0xb6')][_0x26ed45][_0xa94f('0xc0')]));_0x584e2f[_0xa94f('0x9a')](_0x114379(_0xa94f('0xc3'),_0x31f21f[_0xa94f('0xb6')][_0x26ed45]['dataValues']));_0x584e2f['push'](_0x114379(_0xa94f('0xc4'),_0x31f21f['rows'][_0x26ed45][_0xa94f('0xc0')]));_0x584e2f[_0xa94f('0x9a')](_0x114379(_0xa94f('0xc5'),_0x31f21f[_0xa94f('0xb6')][_0x26ed45][_0xa94f('0xc0')]));}return Promise[_0xa94f('0x96')](_0x584e2f)[_0xa94f('0x6')](function(){return _0x31f21f;});}return _0x31f21f;});}});}}});}; \ No newline at end of file +var _0x07ea=['chat','dataValues','sms','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','filter','value','findAll','map','catch','model','then','name','resolve','field','associatedResources','type','resourceId','childModel','odbc','SquareOdbc','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','ListId','lists','CmList','companies','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','users','Users','admin','user','Agents','zendeskaccounts','ZendeskAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','tags','Tag','templates','Template','triggers','Trigger','trunks','variables','Plugin','extractedreports','AnalyticExtractedReport','AnalyticMetric','toUpperCase','slice','QueryTypes','SELECT','select','ui.','InteractionId','sequelize','query','OpenTabs','define','../../components/parsers/qs','raw','section','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','params','all','union','find','ignore','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','sort','where','pick','key','VIRTUAL','foreignKey','forEach','merge','options','include','reportType','default','reportId','DefaultReports','CustomReports','count','rows','customSorting','extraQueryConditions','includeAll','Tags','color','tag','ThroughTags','openTabs'];(function(_0xf433fa,_0x32e751){var _0x46c91a=function(_0x293a3b){while(--_0x293a3b){_0xf433fa['push'](_0xf433fa['shift']());}};_0x46c91a(++_0x32e751);}(_0x07ea,0xc0));var _0xa07e=function(_0x4026c8,_0x477780){_0x4026c8=_0x4026c8-0x0;var _0xf7aeba=_0x07ea[_0x4026c8];return _0xf7aeba;};'use strict';var _=require(_0xa07e('0x0'));var attributes=require(_0xa07e('0x1'));var squel=require(_0xa07e('0x2'));module[_0xa07e('0x3')]=function(_0x2719b5){var _0x1c3337=_0x2719b5['models'];function _0xdf877f(_0x2cd874,_0x31f621){return new Promise(function(_0x3ba7d1,_0x3c9212){if(!_0x31f621)return _0x3ba7d1(null);var _0x3daf23=_0x31f621['filter']?{[_0x31f621[_0xa07e('0x4')]['field']]:_0x31f621[_0xa07e('0x4')][_0xa07e('0x5')]}:undefined;return _0x1c3337[_0x2cd874][_0xa07e('0x6')]({'where':_0x3daf23,'raw':!![]})['then'](function(_0xcffa8d){_0x31f621['associatedResources']=_[_0xa07e('0x7')](_0xcffa8d,'id');_0x3ba7d1(_0x31f621);})[_0xa07e('0x8')](function(_0x134140){_0x3c9212(_0x134140);});});}function _0x193ed7(_0x5874bd,_0x2f37f9){return new Promise(function(_0x3330db,_0x4d6b6e){var _0x230312=_0x5874bd['filter']?{[_0x5874bd[_0xa07e('0x4')]['field']]:_0x5874bd[_0xa07e('0x4')][_0xa07e('0x5')]}:undefined;return _0x1c3337[_0x5874bd[_0xa07e('0x9')]][_0xa07e('0x6')]({'where':_0x230312,'raw':!![]})[_0xa07e('0xa')](function(_0x3e6d67){_0x2f37f9['associatedResources']=_[_0xa07e('0x7')](_0x3e6d67,function(_0x163006){return _0x163006[_0xa07e('0xb')];});_0x3330db(_0x2f37f9);})[_0xa07e('0x8')](function(_0x30a0f9){_0x4d6b6e(_0x30a0f9);});});}function _0x37e0ba(_0x50ebf8,_0x287cfa,_0x36e6d2){if(!_0x287cfa)return Promise[_0xa07e('0xc')](null);return new Promise(function(_0x20f69f,_0x5867da){return _0x1c3337['UserProfileResource']['findAll']({'where':{'sectionId':_0x287cfa['id']},'raw':!![]})[_0xa07e('0xa')](function(_0x151433){if(_0x50ebf8[_0xa07e('0xd')]&&_0x50ebf8[_0xa07e('0xd')]!=='id'){_0x287cfa[_0xa07e('0xe')]=_[_0xa07e('0x7')](_0x151433,function(_0x4a62c2){return _0x4a62c2[_0x50ebf8['field']];});}else{if(_0x36e6d2==='AnalyticExtractedReport'){_0x287cfa[_0xa07e('0xe')]=_[_0xa07e('0x7')](_0x151433,function(_0x1fb4b1){return{'id':_0x1fb4b1['resourceId'],'type':_0x1fb4b1[_0xa07e('0xf')]};});}else{_0x287cfa[_0xa07e('0xe')]=_[_0xa07e('0x7')](_0x151433,function(_0x45857c){return _0x45857c[_0xa07e('0x10')];});}}_0x20f69f(_0x287cfa);})[_0xa07e('0x8')](function(_0x42e6b5){_0x5867da(_0x42e6b5);});});}function _0x4d0136(_0x3c8bcd,_0x278f9c){var _0x1f106={'parentSections':[]};switch(_0x3c8bcd['toLowerCase']()){case'squareprojects':_0x1f106[_0xa07e('0x11')]='SquareProject';break;case _0xa07e('0x12'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x13');break;case'squarerecordings':_0x1f106[_0xa07e('0x11')]=_0xa07e('0x14');_0x1f106[_0xa07e('0x15')]=[{'name':_0xa07e('0x16'),'field':_0xa07e('0xb'),'foreignKey':_0xa07e('0x17')}];break;case _0xa07e('0x18'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x19');break;case _0xa07e('0x1a'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x1b');_0x1f106[_0xa07e('0x15')]=[{'name':'Lists','field':'id','foreignKey':_0xa07e('0x1c')}];break;case _0xa07e('0x1d'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x1e');break;case _0xa07e('0x1f'):_0x1f106[_0xa07e('0x11')]='CmCompany';break;case'globalcustomfields':_0x1f106[_0xa07e('0x11')]=_0xa07e('0x20');break;case'chatqueues':_0x1f106['childModel']=_0xa07e('0x21');break;case _0xa07e('0x22'):_0x1f106['childModel']=_0xa07e('0x23');break;case _0xa07e('0x24'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x25');break;case'faxaccounts':_0x1f106[_0xa07e('0x11')]=_0xa07e('0x26');break;case _0xa07e('0x27'):case _0xa07e('0x28'):case _0xa07e('0x29'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x2a');break;case'contexts':_0x1f106[_0xa07e('0x11')]=_0xa07e('0x2b');break;case'voicemails':_0x1f106[_0xa07e('0x11')]=_0xa07e('0x2c');break;case _0xa07e('0x2d'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x2e');_0x1f106['parentSections']=[{'name':'Agents','field':_0xa07e('0xb'),'foreignKey':_0xa07e('0x2f'),'model':_0xa07e('0x30'),'filter':{'field':_0xa07e('0x31'),'value':['agent']}},{'name':_0xa07e('0x32'),'field':_0xa07e('0xb'),'foreignKey':_0xa07e('0x2f'),'model':_0xa07e('0x30'),'filter':{'field':_0xa07e('0x31'),'value':[_0xa07e('0x33')]}},{'name':_0xa07e('0x34'),'field':_0xa07e('0xb'),'foreignKey':_0xa07e('0x35'),'model':_0xa07e('0x36'),'filter':{'field':_0xa07e('0xf'),'value':[_0xa07e('0x37')]}},{'name':'QueueCampaigns','field':_0xa07e('0xb'),'foreignKey':'queue','model':_0xa07e('0x36'),'filter':{'field':_0xa07e('0xf'),'value':[_0xa07e('0x38')]}}];break;case _0xa07e('0x39'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x3a');break;case'chanspies':_0x1f106[_0xa07e('0x11')]=_0xa07e('0x3b');break;case'voiceprefixes':_0x1f106[_0xa07e('0x11')]=_0xa07e('0x3c');break;case _0xa07e('0x3d'):_0x1f106['childModel']=_0xa07e('0x3e');break;case _0xa07e('0x3f'):_0x1f106['childModel']='MailQueue';break;case _0xa07e('0x40'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x41');break;case'mailsubstatuses':_0x1f106['childModel']=_0xa07e('0x42');break;case _0xa07e('0x43'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x44');break;case'openchannelaccounts':_0x1f106[_0xa07e('0x11')]=_0xa07e('0x45');break;case'smsqueues':_0x1f106['childModel']=_0xa07e('0x46');break;case _0xa07e('0x47'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x48');break;case _0xa07e('0x49'):_0x1f106['childModel']=_0xa07e('0x4a');break;case _0xa07e('0x4b'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x4c');break;case _0xa07e('0x4d'):_0x1f106[_0xa07e('0x11')]='Team';break;case _0xa07e('0x4e'):case _0xa07e('0x4f'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x36');if(_0x278f9c){_0x1f106['parentSections']=[{'name':_0xa07e('0x34')},{'name':'QueueCampaigns'}];}break;case _0xa07e('0x50'):case'agents':case'telephones':_0x1f106['childModel']='User';if(_0x278f9c){_0x1f106['parentSections']=[{'name':_0xa07e('0x51'),'filter':{'field':_0xa07e('0x31'),'value':[_0xa07e('0x52'),_0xa07e('0x53')]},'ignore':!![]},{'name':_0xa07e('0x54')},{'name':_0xa07e('0x32')}];}break;case _0xa07e('0x55'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x56');break;case'salesforceaccounts':_0x1f106['childModel']='SalesforceAccount';break;case _0xa07e('0x57'):_0x1f106['childModel']=_0xa07e('0x58');break;case _0xa07e('0x59'):_0x1f106['childModel']=_0xa07e('0x5a');break;case _0xa07e('0x5b'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x5c');break;case _0xa07e('0x5d'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x5e');break;case'vtigeraccounts':_0x1f106[_0xa07e('0x11')]=_0xa07e('0x30');break;case _0xa07e('0x5f'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x60');break;case _0xa07e('0x61'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x62');break;case _0xa07e('0x63'):_0x1f106['childModel']=_0xa07e('0x64');break;case _0xa07e('0x65'):_0x1f106['childModel']=_0xa07e('0x66');break;case _0xa07e('0x67'):_0x1f106['childModel']=_0xa07e('0x68');break;case _0xa07e('0x69'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x6a');break;case _0xa07e('0x6b'):_0x1f106[_0xa07e('0x11')]='Sound';break;case _0xa07e('0x6c'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x6d');break;case _0xa07e('0x6e'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x6f');break;case _0xa07e('0x70'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x71');break;case _0xa07e('0x72'):_0x1f106[_0xa07e('0x11')]='Trunk';break;case _0xa07e('0x73'):_0x1f106[_0xa07e('0x11')]='Variable';break;case'plugins':_0x1f106[_0xa07e('0x11')]=_0xa07e('0x74');break;case _0xa07e('0x75'):_0x1f106[_0xa07e('0x11')]=_0xa07e('0x76');_0x1f106[_0xa07e('0x15')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case'metrics':_0x1f106[_0xa07e('0x11')]=_0xa07e('0x77');break;}return _0x1f106;}function _0x391195(_0x7f893b,_0x34b03d){var _0x98ca58=_0x7f893b['charAt'](0x0)[_0xa07e('0x78')]()+_0x7f893b[_0xa07e('0x79')](0x1);var _0x4940dd={'type':_0x1c3337['Sequelize'][_0xa07e('0x7a')][_0xa07e('0x7b')],'raw':!![]};return new Promise(function(_0x357035,_0x28aa6a){var _0x37edb0=squel[_0xa07e('0x7c')]()[_0xa07e('0xd')](_0xa07e('0x7d')+_0x98ca58+_0xa07e('0x7e'),'id')[_0xa07e('0xd')]('ui.createdAt')['from']('user_has_'+_0x7f893b+'_interactions','ui')['where']('ui.UserId\x20=\x20?',_0x34b03d['id']);return _0x1c3337[_0xa07e('0x7f')][_0xa07e('0x80')](_0x37edb0['toString'](),_0x4940dd)['then'](function(_0x30cf23){_0x34b03d[_0x98ca58+_0xa07e('0x81')]=_0x30cf23;_0x357035(_0x30cf23);})[_0xa07e('0x8')](function(_0x7db89f){_0x28aa6a(_0x7db89f);});});}return _0x2719b5[_0xa07e('0x82')]('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3cbacc){var _0x44ba03=require(_0xa07e('0x83'));var _0x2dcb54={'raw':_0x3cbacc[_0xa07e('0x80')][_0xa07e('0x84')],'where':{}};var _0x5e9de1={};var _0x39da84={'count':0x0,'rows':[]};var _0x32e154=_0x3cbacc[_0xa07e('0x80')][_0xa07e('0x85')];var _0x4d8552=_0x3cbacc[_0xa07e('0x80')]['mergeResources']||![];var _0x21a012=_0x4d0136(_0x32e154,_0x4d8552);if(!_0x21a012['childModel'])throw new Error(_0xa07e('0x86')+_0x32e154+'\x27');var _0x353145=[{'name':_0x32e154}];if(!_[_0xa07e('0x87')](_0x21a012['parentSections']))_0x353145=_0x21a012['parentSections'];var _0x3390ea=[];for(var _0x1cefaf=0x0;_0x1cefaf<_0x353145[_0xa07e('0x88')];_0x1cefaf++){_0x3390ea[_0xa07e('0x89')](_0x1c3337[_0xa07e('0x8a')]['find']({'where':{'userProfileId':_0x3cbacc[_0xa07e('0x8b')]['id'],'name':_0x353145[_0x1cefaf][_0xa07e('0xb')]},'raw':!![]}));}return Promise[_0xa07e('0x8c')](_0x3390ea)[_0xa07e('0xa')](function(_0x16038b){var _0x49322a=_[_0xa07e('0x4')](_0x16038b,function(_0x1ca80a){return _0x1ca80a?_0x1ca80a:undefined;});var _0xca8e61=_[_0xa07e('0x4')](_0x353145,['ignore',!![]]);var _0x24f325=_['isEmpty'](_0x49322a)&&_[_0xa07e('0x87')](_0xca8e61)?null:_[_0xa07e('0x8d')](_0xca8e61,_0x49322a);if(!_0x24f325)return null;var _0x3dcf39=[];for(var _0x58bdd8=0x0;_0x58bdd8<_0x24f325['length'];_0x58bdd8++){var _0x48ebd9=_[_0xa07e('0x8e')](_0x353145,function(_0x4dd7c8){return _0x24f325[_0x58bdd8]?_0x4dd7c8[_0xa07e('0xb')]===_0x24f325[_0x58bdd8][_0xa07e('0xb')]:null;});if(_0x48ebd9){if(_0x24f325[_0x58bdd8][_0xa07e('0x8f')]){_0x3dcf39[_0xa07e('0x89')](_0xdf877f(_0x21a012['childModel'],_0x24f325[_0x58bdd8]));}else{if(!_0x24f325[_0x58bdd8][_0xa07e('0x90')]){_0x3dcf39['push'](_0x37e0ba(_0x48ebd9,_0x24f325[_0x58bdd8],_0x21a012['childModel']));}else{if(_0x48ebd9[_0xa07e('0x9')]){_0x3dcf39[_0xa07e('0x89')](_0x193ed7(_0x48ebd9,_0x24f325[_0x58bdd8]));}}}}}return Promise[_0xa07e('0x8c')](_0x3dcf39);})[_0xa07e('0xa')](function(_0x7ea141){var _0x88f0c1=_0x7ea141;var _0x237692=null;if(_0x88f0c1){_0x237692=_0x88f0c1[_0xa07e('0x88')]===0x1?_0x88f0c1[0x0]:null;}if(!_0x237692&&!_0x88f0c1)return _0x39da84;var _0x335d2b=_0x1c3337[_0x21a012[_0xa07e('0x11')]][_0xa07e('0x91')];_0x5e9de1['model']=_[_0xa07e('0x92')](_0x335d2b);_0x5e9de1[_0xa07e('0x80')]=_['keys'](_0x3cbacc[_0xa07e('0x80')]);_0x5e9de1[_0xa07e('0x93')]=_[_0xa07e('0x94')](_0x5e9de1[_0xa07e('0x9')],_0x5e9de1[_0xa07e('0x80')]);_0x2dcb54['attributes']=_[_0xa07e('0x94')](_0x5e9de1['model'],_0x44ba03['fields'](_0x3cbacc['query'][_0xa07e('0x95')]));_0x2dcb54[_0xa07e('0x96')]=_0x2dcb54['attributes']['length']?_0x2dcb54[_0xa07e('0x96')]:_0x5e9de1[_0xa07e('0x9')];if(!_0x3cbacc[_0xa07e('0x80')][_0xa07e('0x97')](_0xa07e('0x98'))){_0x2dcb54['limit']=_0x44ba03[_0xa07e('0x99')](_0x3cbacc[_0xa07e('0x80')][_0xa07e('0x99')]);_0x2dcb54[_0xa07e('0x9a')]=_0x44ba03[_0xa07e('0x9a')](_0x3cbacc[_0xa07e('0x80')][_0xa07e('0x9a')]);}_0x2dcb54['order']=_0x44ba03['sort'](_0x3cbacc[_0xa07e('0x80')][_0xa07e('0x9b')]);_0x2dcb54[_0xa07e('0x9c')]=_0x44ba03['filters'](_[_0xa07e('0x9d')](_0x3cbacc[_0xa07e('0x80')],_0x5e9de1['filters']));if(_0x3cbacc[_0xa07e('0x80')][_0xa07e('0x4')]){_0x2dcb54['where']=_['merge'](_0x2dcb54[_0xa07e('0x9c')],{'$or':_['map'](_0x335d2b,function(_0x450c9c){if(_0x450c9c[_0xa07e('0xf')][_0xa07e('0x9e')]!==_0xa07e('0x9f')){var _0x46e851={};_0x46e851[_0x450c9c[_0xa07e('0xd')]]={'$like':'%'+_0x3cbacc['query'][_0xa07e('0x4')]+'%'};return _0x46e851;}})});}var _0x127d0b=[];var _0x299bed=null;var _0x4478f3={};if(_0x237692){_0x299bed=_[_0xa07e('0x8e')](_0x353145,[_0xa07e('0xb'),_0x237692[_0xa07e('0xb')]]);if(_0x299bed[_0xa07e('0xd')]){_0x4478f3={};if(_0x21a012[_0xa07e('0x11')]===_0xa07e('0x76')){_0x4478f3[_0x299bed[_0xa07e('0xa0')]]=_[_0xa07e('0x7')](_0x237692[_0xa07e('0xe')],'id');}else{_0x4478f3[_0x299bed[_0xa07e('0xa0')]]=_0x237692[_0xa07e('0xe')];}_0x127d0b['push'](_0x4478f3);}else{_0x2dcb54[_0xa07e('0x9c')]['id']=_0x237692[_0xa07e('0xe')];}}else{for(var _0x41f383=0x0;_0x41f383<_0x88f0c1[_0xa07e('0x88')];_0x41f383++){_0x299bed=_['find'](_0x353145,['name',_0x88f0c1[_0x41f383][_0xa07e('0xb')]]);if(_0x299bed[_0xa07e('0xd')]){_0x4478f3={};_0x4478f3[_0x299bed['foreignKey']]=_0x88f0c1[_0x41f383][_0xa07e('0xe')];_0x127d0b[_0xa07e('0x89')](_0x4478f3);}else{if(!_0x2dcb54[_0xa07e('0x9c')]['id'])_0x2dcb54[_0xa07e('0x9c')]['id']=[];_0x88f0c1[_0x41f383][_0xa07e('0xe')][_0xa07e('0xa1')](function(_0x458fbf){_0x2dcb54[_0xa07e('0x9c')]['id']['push'](_0x458fbf);});}}}if(!_['isEmpty'](_0x127d0b)){_0x2dcb54[_0xa07e('0x9c')]=_[_0xa07e('0xa2')](_0x2dcb54[_0xa07e('0x9c')],{'$and':{'$or':_0x127d0b}});}_0x2dcb54=_[_0xa07e('0xa2')]({},_0x2dcb54,_0x3cbacc[_0xa07e('0xa3')]);if(_0x237692&&!_0x237692['autoAssociation']&&_0x21a012[_0xa07e('0x11')]==='AnalyticExtractedReport'){if(_0x3cbacc['query']['includeAll']){_0x2dcb54[_0xa07e('0xa4')]=[{'all':!![]}];}return _0x1c3337[_0x21a012[_0xa07e('0x11')]]['findAll'](_0x2dcb54)[_0xa07e('0xa')](function(_0x370415){var _0x3fd277=[];_0x370415[_0xa07e('0xa1')](function(_0x3d445a){var _0x4e76d6;switch(_0x3d445a[_0xa07e('0xa5')]){case _0xa07e('0xa6'):_0x4e76d6=_[_0xa07e('0x8e')](_0x237692[_0xa07e('0xe')],function(_0x514083){return _0x514083['id']===_0x3d445a[_0xa07e('0xa7')]&&_0x514083[_0xa07e('0xf')]===_0xa07e('0xa8');});break;case'custom':_0x4e76d6=_[_0xa07e('0x8e')](_0x237692[_0xa07e('0xe')],function(_0x45a9ea){return _0x45a9ea['id']===_0x3d445a[_0xa07e('0xa7')]&&_0x45a9ea[_0xa07e('0xf')]===_0xa07e('0xa9');});break;}if(_0x4e76d6)_0x3fd277[_0xa07e('0x89')](_0x3d445a);});_0x39da84[_0xa07e('0xaa')]=_0x3fd277[_0xa07e('0x88')];_0x39da84[_0xa07e('0xab')]=_0x3fd277;return _0x39da84;});}else{if(!_[_0xa07e('0x87')](_0x3cbacc[_0xa07e('0x80')]['ids'])){_0x2dcb54['where']['id']=_0x2dcb54[_0xa07e('0x9c')]['id']?_[_0xa07e('0x94')](_0x2dcb54[_0xa07e('0x9c')]['id'],_0x3cbacc[_0xa07e('0x80')]['ids']):_0x3cbacc['query']['ids'];if(_0x3cbacc[_0xa07e('0x80')]['customSorting']){_0x2dcb54['order']=_0x3cbacc['query'][_0xa07e('0xac')];}}if(_0x3cbacc[_0xa07e('0x80')][_0xa07e('0xad')]){_0x2dcb54[_0xa07e('0x9c')]=_[_0xa07e('0xa2')](_0x2dcb54[_0xa07e('0x9c')],{'$and':_0x3cbacc['query']['extraQueryConditions']});}return _0x1c3337[_0x21a012['childModel']][_0xa07e('0xaa')]({'where':_0x2dcb54[_0xa07e('0x9c')]})[_0xa07e('0xa')](function(_0x7b4b2a){_0x39da84[_0xa07e('0xaa')]=_0x7b4b2a;if(_0x3cbacc['query'][_0xa07e('0xae')]){if(_0x21a012['childModel']===_0xa07e('0x1b')){_0x2dcb54[_0xa07e('0xa4')]=[{'model':_0x1c3337[_0xa07e('0x6d')],'as':_0xa07e('0xaf'),'attributes':['id',_0xa07e('0xb'),_0xa07e('0xb0')],'required':_0x3cbacc[_0xa07e('0x80')][_0xa07e('0xb1')]?!![]:![]},{'model':_0x1c3337[_0xa07e('0x6d')],'as':_0xa07e('0xb2'),'attributes':['id',_0xa07e('0xb'),_0xa07e('0xb0')],'through':_0x3cbacc[_0xa07e('0x80')][_0xa07e('0xb1')]?{'attributes':[],'where':{'TagId':_0x3cbacc[_0xa07e('0x80')]['tag']||undefined}}:{},'required':_0x3cbacc[_0xa07e('0x80')][_0xa07e('0xb1')]?!![]:![]}];}else{_0x2dcb54[_0xa07e('0xa4')]=[{'all':!![]}];}}return _0x1c3337[_0x21a012[_0xa07e('0x11')]][_0xa07e('0x6')](_0x2dcb54);})[_0xa07e('0xa')](function(_0x2cb468){_0x39da84[_0xa07e('0xab')]=_0x2cb468;if(_0x32e154===_0xa07e('0x54')&&_0x3cbacc[_0xa07e('0x80')][_0xa07e('0xb3')]==='true'){var _0x464eed=[];for(var _0xd241df=0x0;_0xd241df<_0x39da84[_0xa07e('0xab')][_0xa07e('0x88')];_0xd241df++){_0x464eed['push'](_0x391195(_0xa07e('0xb4'),_0x39da84[_0xa07e('0xab')][_0xd241df][_0xa07e('0xb5')]));_0x464eed['push'](_0x391195(_0xa07e('0xb6'),_0x39da84['rows'][_0xd241df][_0xa07e('0xb5')]));_0x464eed[_0xa07e('0x89')](_0x391195('fax',_0x39da84[_0xa07e('0xab')][_0xd241df][_0xa07e('0xb5')]));_0x464eed[_0xa07e('0x89')](_0x391195(_0xa07e('0xb7'),_0x39da84['rows'][_0xd241df][_0xa07e('0xb5')]));_0x464eed[_0xa07e('0x89')](_0x391195(_0xa07e('0xb8'),_0x39da84[_0xa07e('0xab')][_0xd241df][_0xa07e('0xb5')]));_0x464eed[_0xa07e('0x89')](_0x391195(_0xa07e('0xb9'),_0x39da84[_0xa07e('0xab')][_0xd241df]['dataValues']));}return Promise[_0xa07e('0x8c')](_0x464eed)[_0xa07e('0xa')](function(){return _0x39da84;});}return _0x39da84;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index ddc7deb..5692963 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 _0xe056=['message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0xe056,0xdb));var _0x6e05=function(_0x2984d0,_0x1a7211){_0x2984d0=_0x2984d0-0x0;var _0x2885f2=_0xe056[_0x2984d0];return _0x2885f2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6e05('0x0'));var BPromise=require(_0x6e05('0x1'));var rs=require(_0x6e05('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e05('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6e05('0x4'))(_0x6e05('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6e05('0x6')]({'port':0x232a});config[_0x6e05('0x7')]=_[_0x6e05('0x8')](config['redis'],{'host':_0x6e05('0x9'),'port':0x18eb});var socket=require(_0x6e05('0xa'))(new Redis(config[_0x6e05('0x7')]));require(_0x6e05('0xb'))[_0x6e05('0xc')](socket);function respondWithRpcPromise(_0x52b72b,_0x330e12,_0x110d8e){return new BPromise(function(_0x321ee5,_0x178c9f){return client[_0x6e05('0xd')](_0x52b72b,_0x110d8e)[_0x6e05('0xe')](function(_0x4ff533){logger[_0x6e05('0xf')](_0x6e05('0x10'),_0x330e12,_0x6e05('0x11'));logger['debug'](_0x6e05('0x12'),_0x330e12,_0x6e05('0x11'),JSON[_0x6e05('0x13')](_0x4ff533));if(_0x4ff533[_0x6e05('0x14')]){if(_0x4ff533[_0x6e05('0x14')]['code']===0x1f4){logger[_0x6e05('0x14')](_0x6e05('0x10'),_0x330e12,_0x4ff533['error']['message']);return _0x178c9f(_0x4ff533[_0x6e05('0x14')][_0x6e05('0x15')]);}logger[_0x6e05('0x14')]('UserProfile,\x20%s,\x20%s',_0x330e12,_0x4ff533[_0x6e05('0x14')]['message']);return _0x321ee5(_0x4ff533[_0x6e05('0x14')][_0x6e05('0x15')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x330e12,_0x6e05('0x11'));_0x321ee5(_0x4ff533[_0x6e05('0x16')][_0x6e05('0x15')]);}})[_0x6e05('0x17')](function(_0x41d22c){logger['error'](_0x6e05('0x10'),_0x330e12,_0x41d22c);_0x178c9f(_0x41d22c);});});} \ No newline at end of file +var _0x110e=['info','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','UserProfile,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then'];(function(_0x209a38,_0x4bbe11){var _0x10ed34=function(_0x453762){while(--_0x453762){_0x209a38['push'](_0x209a38['shift']());}};_0x10ed34(++_0x4bbe11);}(_0x110e,0x68));var _0xe110=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x110e[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0xe110('0x0'));var util=require(_0xe110('0x1'));var moment=require('moment');var BPromise=require(_0xe110('0x2'));var rs=require(_0xe110('0x3'));var fs=require('fs');var Redis=require(_0xe110('0x4'));var db=require(_0xe110('0x5'))['db'];var utils=require(_0xe110('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe110('0x7')]['http']({'port':0x232a});config[_0xe110('0x8')]=_[_0xe110('0x9')](config[_0xe110('0x8')],{'host':_0xe110('0xa'),'port':0x18eb});var socket=require(_0xe110('0xb'))(new Redis(config[_0xe110('0x8')]));require(_0xe110('0xc'))[_0xe110('0xd')](socket);function respondWithRpcPromise(_0x3985c9,_0x47a535,_0x2df21e){return new BPromise(function(_0x435722,_0x5ebe72){return client[_0xe110('0xe')](_0x3985c9,_0x2df21e)[_0xe110('0xf')](function(_0x326a5a){logger[_0xe110('0x10')]('UserProfile,\x20%s,\x20%s',_0x47a535,'request\x20sent');logger['debug'](_0xe110('0x11'),_0x47a535,_0xe110('0x12'),JSON['stringify'](_0x326a5a));if(_0x326a5a['error']){if(_0x326a5a['error'][_0xe110('0x13')]===0x1f4){logger[_0xe110('0x14')]('UserProfile,\x20%s,\x20%s',_0x47a535,_0x326a5a['error'][_0xe110('0x15')]);return _0x5ebe72(_0x326a5a['error'][_0xe110('0x15')]);}logger[_0xe110('0x14')](_0xe110('0x16'),_0x47a535,_0x326a5a[_0xe110('0x14')]['message']);return _0x435722(_0x326a5a[_0xe110('0x14')][_0xe110('0x15')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x47a535,_0xe110('0x12'));_0x435722(_0x326a5a['result'][_0xe110('0x15')]);}})[_0xe110('0x17')](function(_0x47fff8){logger[_0xe110('0x14')](_0xe110('0x16'),_0x47a535,_0x47fff8);_0x5ebe72(_0x47fff8);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 57cb983..332daa8 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 _0xc84e=['userProfile:','./userProfile.events','remove','update','emit','removeListener','length'];(function(_0x3a78e8,_0x60f89c){var _0x269370=function(_0x50e8fe){while(--_0x50e8fe){_0x3a78e8['push'](_0x3a78e8['shift']());}};_0x269370(++_0x60f89c);}(_0xc84e,0x174));var _0xec84=function(_0x4bc49d,_0x234ab4){_0x4bc49d=_0x4bc49d-0x0;var _0x56527f=_0xc84e[_0x4bc49d];return _0x56527f;};'use strict';var UserProfileEvents=require(_0xec84('0x0'));var events=['save',_0xec84('0x1'),_0xec84('0x2')];function createListener(_0x12a9a3,_0x2a8372){return function(_0x20bf4e){_0x2a8372[_0xec84('0x3')](_0x12a9a3,_0x20bf4e);};}function removeListener(_0x47c1f1,_0x5f4201){return function(){UserProfileEvents[_0xec84('0x4')](_0x47c1f1,_0x5f4201);};}exports['register']=function(_0x34d30d){for(var _0x1166e4=0x0,_0xf69a75=events[_0xec84('0x5')];_0x1166e4<_0xf69a75;_0x1166e4++){var _0x2e9af7=events[_0x1166e4];var _0xd5d0ad=createListener(_0xec84('0x6')+_0x2e9af7,_0x34d30d);UserProfileEvents['on'](_0x2e9af7,_0xd5d0ad);}}; \ No newline at end of file +var _0x1c1b=['save','remove','update','emit','removeListener','register','length','userProfile:'];(function(_0x18c62c,_0x155f10){var _0x57fe3d=function(_0x4b7473){while(--_0x4b7473){_0x18c62c['push'](_0x18c62c['shift']());}};_0x57fe3d(++_0x155f10);}(_0x1c1b,0x80));var _0xb1c1=function(_0x376136,_0x2c5511){_0x376136=_0x376136-0x0;var _0x3483f3=_0x1c1b[_0x376136];return _0x3483f3;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xb1c1('0x0'),_0xb1c1('0x1'),_0xb1c1('0x2')];function createListener(_0x238914,_0x3aa7fb){return function(_0x20fe40){_0x3aa7fb[_0xb1c1('0x3')](_0x238914,_0x20fe40);};}function removeListener(_0x318209,_0x4a59fe){return function(){UserProfileEvents[_0xb1c1('0x4')](_0x318209,_0x4a59fe);};}exports[_0xb1c1('0x5')]=function(_0x25033b){for(var _0x3f43e1=0x0,_0x1cb5a1=events[_0xb1c1('0x6')];_0x3f43e1<_0x1cb5a1;_0x3f43e1++){var _0x5abda9=events[_0x3f43e1];var _0x29d64e=createListener(_0xb1c1('0x7')+_0x5abda9,_0x25033b);UserProfileEvents['on'](_0x5abda9,_0x29d64e);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 4b318e4..bbfdd8c 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 _0xd587=['get','isAuthenticated','/describe','describe','show','post','create','/:id','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller'];(function(_0x31b35e,_0x2fea6a){var _0x1ff774=function(_0x5567c8){while(--_0x5567c8){_0x31b35e['push'](_0x31b35e['shift']());}};_0x1ff774(++_0x2fea6a);}(_0xd587,0x173));var _0x7d58=function(_0x4cf2b6,_0x2bac76){_0x4cf2b6=_0x4cf2b6-0x0;var _0x17d503=_0xd587[_0x4cf2b6];return _0x17d503;};'use strict';var multer=require('multer');var util=require(_0x7d58('0x0'));var path=require(_0x7d58('0x1'));var timeout=require(_0x7d58('0x2'));var express=require(_0x7d58('0x3'));var router=express[_0x7d58('0x4')]();var fs_extra=require(_0x7d58('0x5'));var auth=require(_0x7d58('0x6'));var interaction=require(_0x7d58('0x7'));var config=require('../../config/environment');var controller=require(_0x7d58('0x8'));router[_0x7d58('0x9')]('/',auth[_0x7d58('0xa')](),controller['index']);router[_0x7d58('0x9')](_0x7d58('0xb'),auth[_0x7d58('0xa')](),controller[_0x7d58('0xc')]);router[_0x7d58('0x9')]('/:id',auth[_0x7d58('0xa')](),controller[_0x7d58('0xd')]);router[_0x7d58('0xe')]('/',auth[_0x7d58('0xa')](),controller[_0x7d58('0xf')]);router['put'](_0x7d58('0x10'),auth[_0x7d58('0xa')](),controller[_0x7d58('0x11')]);router['delete'](_0x7d58('0x10'),auth[_0x7d58('0xa')](),controller['destroy']);module[_0x7d58('0x12')]=router; \ No newline at end of file +var _0x3840=['/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get'];(function(_0x222951,_0x302864){var _0x2f9752=function(_0x53bd50){while(--_0x53bd50){_0x222951['push'](_0x222951['shift']());}};_0x2f9752(++_0x302864);}(_0x3840,0x15e));var _0x0384=function(_0x41eb27,_0x4f29bb){_0x41eb27=_0x41eb27-0x0;var _0x26a9e6=_0x3840[_0x41eb27];return _0x26a9e6;};'use strict';var multer=require(_0x0384('0x0'));var util=require('util');var path=require(_0x0384('0x1'));var timeout=require(_0x0384('0x2'));var express=require(_0x0384('0x3'));var router=express['Router']();var fs_extra=require(_0x0384('0x4'));var auth=require(_0x0384('0x5'));var interaction=require(_0x0384('0x6'));var config=require(_0x0384('0x7'));var controller=require(_0x0384('0x8'));router[_0x0384('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0384('0x9')](_0x0384('0xa'),auth[_0x0384('0xb')](),controller['describe']);router[_0x0384('0x9')](_0x0384('0xc'),auth['isAuthenticated'](),controller[_0x0384('0xd')]);router[_0x0384('0xe')]('/',auth[_0x0384('0xb')](),controller[_0x0384('0xf')]);router['put'](_0x0384('0xc'),auth[_0x0384('0xb')](),controller[_0x0384('0x10')]);router[_0x0384('0x11')](_0x0384('0xc'),auth[_0x0384('0xb')](),controller[_0x0384('0x12')]);module[_0x0384('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 4dd65b9..8e58df4 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 _0xd127=['sequelize','exports','INTEGER','STRING'];(function(_0x300726,_0x130d6a){var _0x33bf5d=function(_0x4bccc3){while(--_0x4bccc3){_0x300726['push'](_0x300726['shift']());}};_0x33bf5d(++_0x130d6a);}(_0xd127,0x178));var _0x7d12=function(_0x17885f,_0x4cb7b5){_0x17885f=_0x17885f-0x0;var _0x193328=_0xd127[_0x17885f];return _0x193328;};'use strict';var Sequelize=require(_0x7d12('0x0'));module[_0x7d12('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x7d12('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7d12('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xa821=['sequelize','STRING','INTEGER'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0xa821,0x17a));var _0x1a82=function(_0x30a5f6,_0x2e582a){_0x30a5f6=_0x30a5f6-0x0;var _0x2bc67c=_0xa821[_0x30a5f6];return _0x2bc67c;};'use strict';var Sequelize=require(_0x1a82('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a82('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x1a82('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1a82('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 340f5b0..7c9b906 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 _0xc4aa=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','UserProfileResource','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x73d817,_0x54eed1){var _0x178cf8=function(_0x3cdf24){while(--_0x3cdf24){_0x73d817['push'](_0x73d817['shift']());}};_0x178cf8(++_0x54eed1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')](_0x5a7f6e['body'],{})['then'](respondWithResult(_0x244950,0xc9))[_0xac4a('0x44')](handleError(_0x244950,null));};exports['update']=function(_0x18ae96,_0x566258){if(_0x18ae96[_0xac4a('0x4a')]['id']){delete _0x18ae96['body']['id'];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'id':_0x18ae96[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x566258,null))['then'](saveUpdates(_0x18ae96[_0xac4a('0x4a')],null))[_0xac4a('0x24')](respondWithResult(_0x566258,null))[_0xac4a('0x44')](handleError(_0x566258,null));};exports[_0xac4a('0x25')]=function(_0x2f30e2,_0x138876){return db[_0xac4a('0x2c')]['find']({'where':{'id':_0x2f30e2[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x138876,null))['then'](removeEntity(_0x138876,null))[_0xac4a('0x44')](handleError(_0x138876,null));};exports[_0xac4a('0x4c')]=function(_0x26e716,_0x3ac36e){return db['UserProfileResource'][_0xac4a('0x4c')]()[_0xac4a('0x24')](respondWithResult(_0x3ac36e,null))[_0xac4a('0x44')](handleError(_0x3ac36e,null));}; \ No newline at end of file +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','UserProfileResource','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(_0x52c691,_0x565162){var _0xdefb85=function(_0xa973dd){while(--_0xa973dd){_0x52c691['push'](_0x52c691['shift']());}};_0xdefb85(++_0x565162);}(_0x4975,0x86));var _0x5497=function(_0x2deace,_0x3b5163){_0x2deace=_0x2deace-0x0;var _0x23bc20=_0x4975[_0x2deace];return _0x23bc20;};'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['UserProfileResource']['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['UserProfileResource'][_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['UserProfileResource'][_0x5497('0x47')]()[_0x5497('0x24')](respondWithResult(_0x5b2c22,null))['catch'](handleError(_0x5b2c22,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 8d10220..0aec338 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 _0xaeff=['lodash','util','api','moment','rimraf','../../config/environment','./userProfileResource.attributes','UserProfileResource','compositeIndex','resourceId'];(function(_0xaf92ff,_0x10b562){var _0x5d7696=function(_0x359368){while(--_0x359368){_0xaf92ff['push'](_0xaf92ff['shift']());}};_0x5d7696(++_0x10b562);}(_0xaeff,0xbe));var _0xfaef=function(_0x32474e,_0x532001){_0x32474e=_0x32474e-0x0;var _0x377c5b=_0xaeff[_0x32474e];return _0x377c5b;};'use strict';var _=require(_0xfaef('0x0'));var util=require(_0xfaef('0x1'));var logger=require('../../config/logger')(_0xfaef('0x2'));var moment=require(_0xfaef('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfaef('0x4'));var config=require(_0xfaef('0x5'));var attributes=require(_0xfaef('0x6'));module['exports']=function(_0x109757,_0x452b4d){return _0x109757['define'](_0xfaef('0x7'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xfaef('0x8'),'fields':[_0xfaef('0x9'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4eec=['bluebird','request-promise','path','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','sectionId','lodash','../../config/logger','moment'];(function(_0x105b3a,_0x3f146c){var _0x561a8f=function(_0x566e07){while(--_0x566e07){_0x105b3a['push'](_0x105b3a['shift']());}};_0x561a8f(++_0x3f146c);}(_0x4eec,0x159));var _0xc4ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4eec[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc4ee('0x0'));var util=require('util');var logger=require(_0xc4ee('0x1'))('api');var moment=require(_0xc4ee('0x2'));var BPromise=require(_0xc4ee('0x3'));var rp=require(_0xc4ee('0x4'));var fs=require('fs');var path=require(_0xc4ee('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc4ee('0x6'));module[_0xc4ee('0x7')]=function(_0x127538,_0x475a5f){return _0x127538[_0xc4ee('0x8')](_0xc4ee('0x9'),attributes,{'tableName':_0xc4ee('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0xc4ee('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 b67e970..a8ea9be 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 _0x783d=['code','message','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x33bed7,_0x4990db){var _0xd0458f=function(_0x3354c8){while(--_0x3354c8){_0x33bed7['push'](_0x33bed7['shift']());}};_0xd0458f(++_0x4990db);}(_0x783d,0x1e3));var _0xd783=function(_0x17fd0d,_0x4be94d){_0x17fd0d=_0x17fd0d-0x0;var _0x4b10bb=_0x783d[_0x17fd0d];return _0x4b10bb;};'use strict';var _=require('lodash');var util=require(_0xd783('0x0'));var moment=require(_0xd783('0x1'));var BPromise=require('bluebird');var rs=require(_0xd783('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd783('0x3'))['db'];var utils=require(_0xd783('0x4'));var logger=require(_0xd783('0x5'))(_0xd783('0x6'));var config=require(_0xd783('0x7'));var jayson=require(_0xd783('0x8'));var client=jayson[_0xd783('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48299f,_0x46f8bf,_0xba5b83){return new BPromise(function(_0x1f469b,_0x553429){return client[_0xd783('0xa')](_0x48299f,_0xba5b83)[_0xd783('0xb')](function(_0x4cfb4d){logger[_0xd783('0xc')](_0xd783('0xd'),_0x46f8bf,'request\x20sent');logger['debug'](_0xd783('0xe'),_0x46f8bf,_0xd783('0xf'),JSON['stringify'](_0x4cfb4d));if(_0x4cfb4d[_0xd783('0x10')]){if(_0x4cfb4d[_0xd783('0x10')][_0xd783('0x11')]===0x1f4){logger[_0xd783('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x46f8bf,_0x4cfb4d[_0xd783('0x10')][_0xd783('0x12')]);return _0x553429(_0x4cfb4d['error'][_0xd783('0x12')]);}logger['error'](_0xd783('0xd'),_0x46f8bf,_0x4cfb4d[_0xd783('0x10')][_0xd783('0x12')]);return _0x1f469b(_0x4cfb4d[_0xd783('0x10')][_0xd783('0x12')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x46f8bf,_0xd783('0xf'));_0x1f469b(_0x4cfb4d['result'][_0xd783('0x12')]);}})[_0xd783('0x13')](function(_0x3725dd){logger[_0xd783('0x10')](_0xd783('0xd'),_0x46f8bf,_0x3725dd);_0x553429(_0x3725dd);});});} \ No newline at end of file +var _0x8b85=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','randomstring'];(function(_0x408fe0,_0x2b49c0){var _0x21b8b1=function(_0x57158a){while(--_0x57158a){_0x408fe0['push'](_0x408fe0['shift']());}};_0x21b8b1(++_0x2b49c0);}(_0x8b85,0x1a0));var _0x58b8=function(_0x17fd65,_0x556d01){_0x17fd65=_0x17fd65-0x0;var _0x27d033=_0x8b85[_0x17fd65];return _0x27d033;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x58b8('0x0'));var BPromise=require('bluebird');var rs=require(_0x58b8('0x1'));var fs=require('fs');var Redis=require(_0x58b8('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x58b8('0x3'));var logger=require('../../config/logger')(_0x58b8('0x4'));var config=require(_0x58b8('0x5'));var jayson=require(_0x58b8('0x6'));var client=jayson[_0x58b8('0x7')][_0x58b8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2027f6,_0x2437f2,_0x1eeac2){return new BPromise(function(_0x5b32ac,_0x31279d){return client['request'](_0x2027f6,_0x1eeac2)['then'](function(_0x2f3e43){logger[_0x58b8('0x9')](_0x58b8('0xa'),_0x2437f2,_0x58b8('0xb'));logger[_0x58b8('0xc')](_0x58b8('0xd'),_0x2437f2,_0x58b8('0xb'),JSON['stringify'](_0x2f3e43));if(_0x2f3e43[_0x58b8('0xe')]){if(_0x2f3e43['error'][_0x58b8('0xf')]===0x1f4){logger[_0x58b8('0xe')](_0x58b8('0xa'),_0x2437f2,_0x2f3e43['error'][_0x58b8('0x10')]);return _0x31279d(_0x2f3e43['error'][_0x58b8('0x10')]);}logger[_0x58b8('0xe')](_0x58b8('0xa'),_0x2437f2,_0x2f3e43[_0x58b8('0xe')][_0x58b8('0x10')]);return _0x5b32ac(_0x2f3e43[_0x58b8('0xe')][_0x58b8('0x10')]);}else{logger[_0x58b8('0x9')](_0x58b8('0xa'),_0x2437f2,_0x58b8('0xb'));_0x5b32ac(_0x2f3e43[_0x58b8('0x11')][_0x58b8('0x10')]);}})[_0x58b8('0x12')](function(_0x51916b){logger[_0x58b8('0xe')](_0x58b8('0xa'),_0x2437f2,_0x51916b);_0x31279d(_0x51916b);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 8c4fb36..16ab7e8 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 _0xcc22=['exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','delete','destroy'];(function(_0x2c78df,_0x20abba){var _0x50912=function(_0x5aa161){while(--_0x5aa161){_0x2c78df['push'](_0x2c78df['shift']());}};_0x50912(++_0x20abba);}(_0xcc22,0x1a3));var _0x2cc2=function(_0x4f742b,_0x189c7f){_0x4f742b=_0x4f742b-0x0;var _0x334557=_0xcc22[_0x4f742b];return _0x334557;};'use strict';var multer=require(_0x2cc2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2cc2('0x1'));var express=require(_0x2cc2('0x2'));var router=express['Router']();var fs_extra=require(_0x2cc2('0x3'));var auth=require(_0x2cc2('0x4'));var interaction=require(_0x2cc2('0x5'));var config=require('../../config/environment');var controller=require(_0x2cc2('0x6'));router[_0x2cc2('0x7')]('/',auth['isAuthenticated'](),controller[_0x2cc2('0x8')]);router['get'](_0x2cc2('0x9'),auth[_0x2cc2('0xa')](),controller['describe']);router[_0x2cc2('0x7')](_0x2cc2('0xb'),auth[_0x2cc2('0xa')](),controller[_0x2cc2('0xc')]);router[_0x2cc2('0xd')]('/',auth[_0x2cc2('0xa')](),controller[_0x2cc2('0xe')]);router[_0x2cc2('0xf')](_0x2cc2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x2cc2('0x10')](_0x2cc2('0xb'),auth['isAuthenticated'](),controller[_0x2cc2('0x11')]);module[_0x2cc2('0x12')]=router; \ No newline at end of file +var _0x2a86=['create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x2a86,0x1b9));var _0x62a8=function(_0x4105d9,_0x4b4d2d){_0x4105d9=_0x4105d9-0x0;var _0x47b984=_0x2a86[_0x4105d9];return _0x47b984;};'use strict';var multer=require(_0x62a8('0x0'));var util=require(_0x62a8('0x1'));var path=require('path');var timeout=require(_0x62a8('0x2'));var express=require(_0x62a8('0x3'));var router=express[_0x62a8('0x4')]();var fs_extra=require(_0x62a8('0x5'));var auth=require(_0x62a8('0x6'));var interaction=require(_0x62a8('0x7'));var config=require(_0x62a8('0x8'));var controller=require('./userProfileSection.controller');router[_0x62a8('0x9')]('/',auth['isAuthenticated'](),controller[_0x62a8('0xa')]);router[_0x62a8('0x9')]('/describe',auth[_0x62a8('0xb')](),controller[_0x62a8('0xc')]);router['get'](_0x62a8('0xd'),auth[_0x62a8('0xb')](),controller[_0x62a8('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x62a8('0xf')]);router[_0x62a8('0x10')](_0x62a8('0xd'),auth[_0x62a8('0xb')](),controller['update']);router[_0x62a8('0x11')]('/:id',auth[_0x62a8('0xb')](),controller['destroy']);module[_0x62a8('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index a92fb50..0d3fc11 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 _0xe820=['sequelize','STRING','BOOLEAN','setDataValue','join','getDataValue','crudPermissions'];(function(_0xef9ace,_0xb8eb84){var _0x154c1a=function(_0x34b12d){while(--_0x34b12d){_0xef9ace['push'](_0xef9ace['shift']());}};_0x154c1a(++_0xb8eb84);}(_0xe820,0xd2));var _0x0e82=function(_0x592164,_0x4c6935){_0x592164=_0x592164-0x0;var _0x2e4b42=_0xe820[_0x592164];return _0x2e4b42;};'use strict';var Sequelize=require(_0x0e82('0x0'));module['exports']={'name':{'type':Sequelize[_0x0e82('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x0e82('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0e82('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x0e82('0x1')],'set':function(_0x59b28d){this[_0x0e82('0x3')]('crudPermissions',_0x59b28d?_0x59b28d[_0x0e82('0x4')](''):[]);},'get':function(){return this[_0x0e82('0x5')](_0x0e82('0x6'))?this[_0x0e82('0x5')](_0x0e82('0x6'))['split'](''):[];}}}; \ No newline at end of file +var _0x3de3=['sequelize','STRING','BOOLEAN','crudPermissions','join','split'];(function(_0x149a9b,_0x5bb275){var _0x2c2bf6=function(_0xfe0c14){while(--_0xfe0c14){_0x149a9b['push'](_0x149a9b['shift']());}};_0x2c2bf6(++_0x5bb275);}(_0x3de3,0x1ce));var _0x33de=function(_0x57f75,_0x2dd64a){_0x57f75=_0x57f75-0x0;var _0x3fcae9=_0x3de3[_0x57f75];return _0x3fcae9;};'use strict';var Sequelize=require(_0x33de('0x0'));module['exports']={'name':{'type':Sequelize[_0x33de('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x33de('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x33de('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x33de('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x33de('0x1')],'set':function(_0xbdd404){this['setDataValue'](_0x33de('0x3'),_0xbdd404?_0xbdd404[_0x33de('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0x33de('0x3'))?this['getDataValue'](_0x33de('0x3'))[_0x33de('0x5')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 5be4bb4..73bddbe 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 _0x3f2a=['crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','count','limit','status','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','map','UserProfileSection','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','show','keys','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0xead996,_0x37df5c){var _0x1b2765=function(_0x3ef7af){while(--_0x3ef7af){_0xead996['push'](_0xead996['shift']());}};_0x1b2765(++_0x37df5c);}(_0x3f2a,0x160));var _0xa3f2=function(_0x4aa504,_0x31e26e){_0x4aa504=_0x4aa504-0x0;var _0x5c9b44=_0x3f2a[_0x4aa504];return _0x5c9b44;};'use strict';var emlformat=require(_0xa3f2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa3f2('0x1'));var jsonpatch=require(_0xa3f2('0x2'));var rp=require(_0xa3f2('0x3'));var moment=require(_0xa3f2('0x4'));var BPromise=require(_0xa3f2('0x5'));var Mustache=require(_0xa3f2('0x6'));var util=require(_0xa3f2('0x7'));var path=require('path');var sox=require(_0xa3f2('0x8'));var csv=require(_0xa3f2('0x9'));var ejs=require(_0xa3f2('0xa'));var fs=require('fs');var fs_extra=require(_0xa3f2('0xb'));var _=require(_0xa3f2('0xc'));var squel=require('squel');var crypto=require(_0xa3f2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa3f2('0xe'));var toCsv=require(_0xa3f2('0x9'));var querystring=require('querystring');var Papa=require(_0xa3f2('0xf'));var Redis=require(_0xa3f2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa3f2('0x11'));var as=require(_0xa3f2('0x12'));var hardwareService=require(_0xa3f2('0x13'));var logger=require(_0xa3f2('0x14'))(_0xa3f2('0x15'));var utils=require(_0xa3f2('0x16'));var config=require(_0xa3f2('0x17'));var licenseUtil=require(_0xa3f2('0x18'));var db=require(_0xa3f2('0x19'))['db'];function respondWithStatusCode(_0x2ba18e,_0x45e5b2){_0x45e5b2=_0x45e5b2||0xcc;return function(_0x4d3a8c){if(_0x4d3a8c){return _0x2ba18e['sendStatus'](_0x45e5b2);}return _0x2ba18e['status'](_0x45e5b2)[_0xa3f2('0x1a')]();};}function respondWithResult(_0x27d5d0,_0x2f75a1){_0x2f75a1=_0x2f75a1||0xc8;return function(_0x574762){if(_0x574762){return _0x27d5d0['status'](_0x2f75a1)[_0xa3f2('0x1b')](_0x574762);}};}function respondWithFilteredResult(_0x1e4eb4,_0xb22d83){return function(_0x1e0c6f){if(_0x1e0c6f){var _0xec9a2=typeof _0xb22d83[_0xa3f2('0x1c')]===_0xa3f2('0x1d')&&typeof _0xb22d83['limit']===_0xa3f2('0x1d');var _0x1f4a8b=_0x1e0c6f[_0xa3f2('0x1e')];var _0x642b03=_0xec9a2?0x0:_0xb22d83[_0xa3f2('0x1c')];var _0x5a722a=_0xec9a2?_0x1e0c6f[_0xa3f2('0x1e')]:_0xb22d83['offset']+_0xb22d83[_0xa3f2('0x1f')];var _0x2e3501;if(_0x5a722a>=_0x1f4a8b){_0x5a722a=_0x1f4a8b;_0x2e3501=0xc8;}else{_0x2e3501=0xce;}_0x1e4eb4[_0xa3f2('0x20')](_0x2e3501);return _0x1e4eb4[_0xa3f2('0x21')](_0xa3f2('0x22'),_0x642b03+'-'+_0x5a722a+'/'+_0x1f4a8b)[_0xa3f2('0x1b')](_0x1e0c6f);}return null;};}function patchUpdates(_0x407835){return function(_0x1608a7){try{jsonpatch['apply'](_0x1608a7,_0x407835,!![]);}catch(_0x2898ec){return BPromise['reject'](_0x2898ec);}return _0x1608a7[_0xa3f2('0x23')]();};}function saveUpdates(_0x261b1c,_0x4296ad){return function(_0x182966){if(_0x182966){return _0x182966[_0xa3f2('0x24')](_0x261b1c)[_0xa3f2('0x25')](function(_0x2663fe){return _0x2663fe;});}return null;};}function removeEntity(_0x45c1b8,_0x3fbd36){return function(_0x3f122e){if(_0x3f122e){return _0x3f122e[_0xa3f2('0x26')]()[_0xa3f2('0x25')](function(){_0x45c1b8[_0xa3f2('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25b91f,_0x251639){return function(_0x3dcf8f){if(!_0x3dcf8f){_0x25b91f[_0xa3f2('0x27')](0x194);}return _0x3dcf8f;};}function handleError(_0x4255e9,_0xb861dd){_0xb861dd=_0xb861dd||0x1f4;return function(_0x28efb1){logger[_0xa3f2('0x28')](_0x28efb1[_0xa3f2('0x29')]);if(_0x28efb1[_0xa3f2('0x2a')]){delete _0x28efb1['name'];}_0x4255e9['status'](_0xb861dd)[_0xa3f2('0x2b')](_0x28efb1);};}exports['index']=function(_0x17fe95,_0x204acb){var _0x5c6594={},_0x24d3a5={},_0x39c099={'count':0x0,'rows':[]};var _0x1bba5d=_[_0xa3f2('0x2c')](db[_0xa3f2('0x2d')][_0xa3f2('0x2e')],function(_0x20a762){return{'name':_0x20a762['fieldName'],'type':_0x20a762[_0xa3f2('0x2f')][_0xa3f2('0x30')]};});_0x24d3a5[_0xa3f2('0x31')]=_[_0xa3f2('0x2c')](_0x1bba5d,_0xa3f2('0x2a'));_0x24d3a5[_0xa3f2('0x32')]=_['keys'](_0x17fe95[_0xa3f2('0x32')]);_0x24d3a5[_0xa3f2('0x33')]=_[_0xa3f2('0x34')](_0x24d3a5[_0xa3f2('0x31')],_0x24d3a5[_0xa3f2('0x32')]);_0x5c6594[_0xa3f2('0x35')]=_[_0xa3f2('0x34')](_0x24d3a5[_0xa3f2('0x31')],qs[_0xa3f2('0x36')](_0x17fe95[_0xa3f2('0x32')][_0xa3f2('0x36')]));_0x5c6594[_0xa3f2('0x35')]=_0x5c6594['attributes'][_0xa3f2('0x37')]?_0x5c6594[_0xa3f2('0x35')]:_0x24d3a5['model'];if(!_0x17fe95[_0xa3f2('0x32')]['hasOwnProperty'](_0xa3f2('0x38'))){_0x5c6594[_0xa3f2('0x1f')]=qs[_0xa3f2('0x1f')](_0x17fe95[_0xa3f2('0x32')][_0xa3f2('0x1f')]);_0x5c6594[_0xa3f2('0x1c')]=qs[_0xa3f2('0x1c')](_0x17fe95[_0xa3f2('0x32')][_0xa3f2('0x1c')]);}_0x5c6594['order']=qs[_0xa3f2('0x39')](_0x17fe95[_0xa3f2('0x32')][_0xa3f2('0x39')]);_0x5c6594['where']=qs['filters'](_[_0xa3f2('0x3a')](_0x17fe95[_0xa3f2('0x32')],_0x24d3a5[_0xa3f2('0x33')]),_0x1bba5d);if(_0x17fe95[_0xa3f2('0x32')]['filter']){_0x5c6594['where']=_[_0xa3f2('0x3b')](_0x5c6594['where'],{'$or':_[_0xa3f2('0x2c')](_0x1bba5d,function(_0x5a4a4b){if(_0x5a4a4b[_0xa3f2('0x2f')]!==_0xa3f2('0x3c')){var _0x58ad52={};_0x58ad52[_0x5a4a4b[_0xa3f2('0x2a')]]={'$like':'%'+_0x17fe95[_0xa3f2('0x32')][_0xa3f2('0x3d')]+'%'};return _0x58ad52;}})});}_0x5c6594=_[_0xa3f2('0x3b')]({},_0x5c6594,_0x17fe95[_0xa3f2('0x3e')]);var _0x5aae0f={'where':_0x5c6594['where']};return db[_0xa3f2('0x2d')][_0xa3f2('0x1e')](_0x5aae0f)[_0xa3f2('0x25')](function(_0x119ff8){_0x39c099['count']=_0x119ff8;if(_0x17fe95[_0xa3f2('0x32')][_0xa3f2('0x3f')]){_0x5c6594[_0xa3f2('0x40')]=[{'all':!![]}];}return db[_0xa3f2('0x2d')]['findAll'](_0x5c6594);})[_0xa3f2('0x25')](function(_0x4f6c86){_0x39c099['rows']=_0x4f6c86;return _0x39c099;})[_0xa3f2('0x25')](respondWithFilteredResult(_0x204acb,_0x5c6594))[_0xa3f2('0x41')](handleError(_0x204acb,null));};exports[_0xa3f2('0x42')]=function(_0x473a18,_0x348f2b){var _0x3f655e={'raw':![],'where':{'id':_0x473a18['params']['id']}},_0x492e7a={};_0x492e7a[_0xa3f2('0x31')]=_[_0xa3f2('0x43')](db['UserProfileSection'][_0xa3f2('0x2e')]);_0x492e7a[_0xa3f2('0x32')]=_['keys'](_0x473a18[_0xa3f2('0x32')]);_0x492e7a['filters']=_[_0xa3f2('0x34')](_0x492e7a[_0xa3f2('0x31')],_0x492e7a[_0xa3f2('0x32')]);_0x3f655e['attributes']=_[_0xa3f2('0x34')](_0x492e7a['model'],qs['fields'](_0x473a18['query'][_0xa3f2('0x36')]));_0x3f655e[_0xa3f2('0x35')]=_0x3f655e['attributes'][_0xa3f2('0x37')]?_0x3f655e[_0xa3f2('0x35')]:_0x492e7a[_0xa3f2('0x31')];if(_0x473a18['query'][_0xa3f2('0x3f')]){_0x3f655e[_0xa3f2('0x40')]=[{'all':!![]}];}_0x3f655e=_[_0xa3f2('0x3b')]({},_0x3f655e,_0x473a18[_0xa3f2('0x3e')]);return db[_0xa3f2('0x2d')]['find'](_0x3f655e)[_0xa3f2('0x25')](handleEntityNotFound(_0x348f2b,null))[_0xa3f2('0x25')](respondWithResult(_0x348f2b,null))[_0xa3f2('0x41')](handleError(_0x348f2b,null));};exports[_0xa3f2('0x44')]=function(_0x45ad9e,_0x26415c){return db['UserProfileSection'][_0xa3f2('0x44')](_0x45ad9e[_0xa3f2('0x45')],{})['then'](respondWithResult(_0x26415c,0xc9))[_0xa3f2('0x41')](handleError(_0x26415c,null));};exports[_0xa3f2('0x24')]=function(_0x263652,_0x26e526){if(_0x263652[_0xa3f2('0x45')]['id']){delete _0x263652['body']['id'];}return db[_0xa3f2('0x2d')][_0xa3f2('0x46')]({'where':{'id':_0x263652[_0xa3f2('0x47')]['id']}})['then'](handleEntityNotFound(_0x26e526,null))['then'](saveUpdates(_0x263652[_0xa3f2('0x45')],null))[_0xa3f2('0x25')](respondWithResult(_0x26e526,null))[_0xa3f2('0x41')](handleError(_0x26e526,null));};exports[_0xa3f2('0x26')]=function(_0x5f3a20,_0x36df25){return db['UserProfileSection'][_0xa3f2('0x46')]({'where':{'id':_0x5f3a20[_0xa3f2('0x47')]['id']}})[_0xa3f2('0x25')](handleEntityNotFound(_0x36df25,null))['then'](removeEntity(_0x36df25,null))[_0xa3f2('0x41')](handleError(_0x36df25,null));};exports[_0xa3f2('0x48')]=function(_0x4b57bb,_0x43ccb3){return db['UserProfileSection'][_0xa3f2('0x48')]()[_0xa3f2('0x25')](respondWithResult(_0x43ccb3,null))[_0xa3f2('0x41')](handleError(_0x43ccb3,null));}; \ No newline at end of file +var _0xe8f7=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','count','status','set','json','apply','reject','save','update','then','destroy','error','stack','name','index','UserProfileSection','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','intersection','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x297220,_0x49bec5){var _0x532a3e=function(_0x117fd2){while(--_0x117fd2){_0x297220['push'](_0x297220['shift']());}};_0x532a3e(++_0x49bec5);}(_0xe8f7,0x12a));var _0x7e8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe8f7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7e8f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7e8f('0x1'));var jsonpatch=require(_0x7e8f('0x2'));var rp=require(_0x7e8f('0x3'));var moment=require(_0x7e8f('0x4'));var BPromise=require(_0x7e8f('0x5'));var Mustache=require(_0x7e8f('0x6'));var util=require(_0x7e8f('0x7'));var path=require(_0x7e8f('0x8'));var sox=require(_0x7e8f('0x9'));var csv=require('to-csv');var ejs=require(_0x7e8f('0xa'));var fs=require('fs');var fs_extra=require(_0x7e8f('0xb'));var _=require(_0x7e8f('0xc'));var squel=require('squel');var crypto=require(_0x7e8f('0xd'));var jsforce=require(_0x7e8f('0xe'));var deskjs=require(_0x7e8f('0xf'));var toCsv=require(_0x7e8f('0x10'));var querystring=require(_0x7e8f('0x11'));var Papa=require(_0x7e8f('0x12'));var Redis=require(_0x7e8f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7e8f('0x14'));var as=require(_0x7e8f('0x15'));var hardwareService=require(_0x7e8f('0x16'));var logger=require(_0x7e8f('0x17'))(_0x7e8f('0x18'));var utils=require(_0x7e8f('0x19'));var config=require(_0x7e8f('0x1a'));var licenseUtil=require(_0x7e8f('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49898e,_0x3b2ce6){_0x3b2ce6=_0x3b2ce6||0xcc;return function(_0x46c597){if(_0x46c597){return _0x49898e[_0x7e8f('0x1c')](_0x3b2ce6);}return _0x49898e['status'](_0x3b2ce6)[_0x7e8f('0x1d')]();};}function respondWithResult(_0x28f8d0,_0x1148b2){_0x1148b2=_0x1148b2||0xc8;return function(_0x204ed4){if(_0x204ed4){return _0x28f8d0['status'](_0x1148b2)['json'](_0x204ed4);}};}function respondWithFilteredResult(_0x4a2f72,_0x3518dc){return function(_0x2f03c1){if(_0x2f03c1){var _0x401597=typeof _0x3518dc[_0x7e8f('0x1e')]===_0x7e8f('0x1f')&&typeof _0x3518dc['limit']===_0x7e8f('0x1f');var _0x246dc6=_0x2f03c1[_0x7e8f('0x20')];var _0x3ff56e=_0x401597?0x0:_0x3518dc[_0x7e8f('0x1e')];var _0x54e8e3=_0x401597?_0x2f03c1[_0x7e8f('0x20')]:_0x3518dc[_0x7e8f('0x1e')]+_0x3518dc['limit'];var _0x4bb4dc;if(_0x54e8e3>=_0x246dc6){_0x54e8e3=_0x246dc6;_0x4bb4dc=0xc8;}else{_0x4bb4dc=0xce;}_0x4a2f72[_0x7e8f('0x21')](_0x4bb4dc);return _0x4a2f72[_0x7e8f('0x22')]('Content-Range',_0x3ff56e+'-'+_0x54e8e3+'/'+_0x246dc6)[_0x7e8f('0x23')](_0x2f03c1);}return null;};}function patchUpdates(_0x87e43b){return function(_0x2aad09){try{jsonpatch[_0x7e8f('0x24')](_0x2aad09,_0x87e43b,!![]);}catch(_0x1b87a7){return BPromise[_0x7e8f('0x25')](_0x1b87a7);}return _0x2aad09[_0x7e8f('0x26')]();};}function saveUpdates(_0x4749f9,_0x579e8a){return function(_0x254a25){if(_0x254a25){return _0x254a25[_0x7e8f('0x27')](_0x4749f9)[_0x7e8f('0x28')](function(_0x381b6f){return _0x381b6f;});}return null;};}function removeEntity(_0x447125,_0x27924f){return function(_0x560307){if(_0x560307){return _0x560307[_0x7e8f('0x29')]()['then'](function(){_0x447125[_0x7e8f('0x21')](0xcc)[_0x7e8f('0x1d')]();});}};}function handleEntityNotFound(_0x30c2aa,_0x3d00a9){return function(_0x528234){if(!_0x528234){_0x30c2aa['sendStatus'](0x194);}return _0x528234;};}function handleError(_0x34af99,_0x377c4f){_0x377c4f=_0x377c4f||0x1f4;return function(_0x37d7ed){logger[_0x7e8f('0x2a')](_0x37d7ed[_0x7e8f('0x2b')]);if(_0x37d7ed[_0x7e8f('0x2c')]){delete _0x37d7ed[_0x7e8f('0x2c')];}_0x34af99[_0x7e8f('0x21')](_0x377c4f)['send'](_0x37d7ed);};}exports[_0x7e8f('0x2d')]=function(_0x5031dc,_0x405d05){var _0x1fb015={},_0xfd65c5={},_0x5789a3={'count':0x0,'rows':[]};var _0x444d5c=_['map'](db[_0x7e8f('0x2e')]['rawAttributes'],function(_0x1c91cf){return{'name':_0x1c91cf['fieldName'],'type':_0x1c91cf[_0x7e8f('0x2f')]['key']};});_0xfd65c5[_0x7e8f('0x30')]=_[_0x7e8f('0x31')](_0x444d5c,_0x7e8f('0x2c'));_0xfd65c5[_0x7e8f('0x32')]=_[_0x7e8f('0x33')](_0x5031dc[_0x7e8f('0x32')]);_0xfd65c5[_0x7e8f('0x34')]=_['intersection'](_0xfd65c5[_0x7e8f('0x30')],_0xfd65c5[_0x7e8f('0x32')]);_0x1fb015[_0x7e8f('0x35')]=_['intersection'](_0xfd65c5[_0x7e8f('0x30')],qs[_0x7e8f('0x36')](_0x5031dc[_0x7e8f('0x32')][_0x7e8f('0x36')]));_0x1fb015['attributes']=_0x1fb015[_0x7e8f('0x35')][_0x7e8f('0x37')]?_0x1fb015[_0x7e8f('0x35')]:_0xfd65c5[_0x7e8f('0x30')];if(!_0x5031dc[_0x7e8f('0x32')][_0x7e8f('0x38')](_0x7e8f('0x39'))){_0x1fb015['limit']=qs[_0x7e8f('0x3a')](_0x5031dc['query'][_0x7e8f('0x3a')]);_0x1fb015[_0x7e8f('0x1e')]=qs[_0x7e8f('0x1e')](_0x5031dc[_0x7e8f('0x32')][_0x7e8f('0x1e')]);}_0x1fb015['order']=qs[_0x7e8f('0x3b')](_0x5031dc[_0x7e8f('0x32')][_0x7e8f('0x3b')]);_0x1fb015[_0x7e8f('0x3c')]=qs[_0x7e8f('0x34')](_[_0x7e8f('0x3d')](_0x5031dc[_0x7e8f('0x32')],_0xfd65c5[_0x7e8f('0x34')]),_0x444d5c);if(_0x5031dc[_0x7e8f('0x32')][_0x7e8f('0x3e')]){_0x1fb015[_0x7e8f('0x3c')]=_[_0x7e8f('0x3f')](_0x1fb015['where'],{'$or':_['map'](_0x444d5c,function(_0x5a0259){if(_0x5a0259[_0x7e8f('0x2f')]!==_0x7e8f('0x40')){var _0x3b7b15={};_0x3b7b15[_0x5a0259['name']]={'$like':'%'+_0x5031dc[_0x7e8f('0x32')][_0x7e8f('0x3e')]+'%'};return _0x3b7b15;}})});}_0x1fb015=_[_0x7e8f('0x3f')]({},_0x1fb015,_0x5031dc[_0x7e8f('0x41')]);var _0x14f395={'where':_0x1fb015['where']};return db['UserProfileSection']['count'](_0x14f395)[_0x7e8f('0x28')](function(_0x339c29){_0x5789a3[_0x7e8f('0x20')]=_0x339c29;if(_0x5031dc[_0x7e8f('0x32')][_0x7e8f('0x42')]){_0x1fb015[_0x7e8f('0x43')]=[{'all':!![]}];}return db['UserProfileSection'][_0x7e8f('0x44')](_0x1fb015);})[_0x7e8f('0x28')](function(_0x37c99b){_0x5789a3[_0x7e8f('0x45')]=_0x37c99b;return _0x5789a3;})['then'](respondWithFilteredResult(_0x405d05,_0x1fb015))[_0x7e8f('0x46')](handleError(_0x405d05,null));};exports[_0x7e8f('0x47')]=function(_0x484f15,_0x5bbf9b){var _0x584ba7={'raw':![],'where':{'id':_0x484f15['params']['id']}},_0x1981d0={};_0x1981d0['model']=_[_0x7e8f('0x33')](db[_0x7e8f('0x2e')][_0x7e8f('0x48')]);_0x1981d0[_0x7e8f('0x32')]=_[_0x7e8f('0x33')](_0x484f15[_0x7e8f('0x32')]);_0x1981d0[_0x7e8f('0x34')]=_[_0x7e8f('0x49')](_0x1981d0['model'],_0x1981d0[_0x7e8f('0x32')]);_0x584ba7['attributes']=_[_0x7e8f('0x49')](_0x1981d0['model'],qs[_0x7e8f('0x36')](_0x484f15[_0x7e8f('0x32')]['fields']));_0x584ba7[_0x7e8f('0x35')]=_0x584ba7[_0x7e8f('0x35')][_0x7e8f('0x37')]?_0x584ba7[_0x7e8f('0x35')]:_0x1981d0[_0x7e8f('0x30')];if(_0x484f15[_0x7e8f('0x32')][_0x7e8f('0x42')]){_0x584ba7[_0x7e8f('0x43')]=[{'all':!![]}];}_0x584ba7=_[_0x7e8f('0x3f')]({},_0x584ba7,_0x484f15[_0x7e8f('0x41')]);return db[_0x7e8f('0x2e')][_0x7e8f('0x4a')](_0x584ba7)['then'](handleEntityNotFound(_0x5bbf9b,null))[_0x7e8f('0x28')](respondWithResult(_0x5bbf9b,null))[_0x7e8f('0x46')](handleError(_0x5bbf9b,null));};exports[_0x7e8f('0x4b')]=function(_0x172373,_0x4059b0){return db[_0x7e8f('0x2e')][_0x7e8f('0x4b')](_0x172373[_0x7e8f('0x4c')],{})['then'](respondWithResult(_0x4059b0,0xc9))[_0x7e8f('0x46')](handleError(_0x4059b0,null));};exports[_0x7e8f('0x27')]=function(_0x59b4ae,_0x4b741d){if(_0x59b4ae[_0x7e8f('0x4c')]['id']){delete _0x59b4ae[_0x7e8f('0x4c')]['id'];}return db[_0x7e8f('0x2e')][_0x7e8f('0x4a')]({'where':{'id':_0x59b4ae[_0x7e8f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4b741d,null))[_0x7e8f('0x28')](saveUpdates(_0x59b4ae[_0x7e8f('0x4c')],null))[_0x7e8f('0x28')](respondWithResult(_0x4b741d,null))[_0x7e8f('0x46')](handleError(_0x4b741d,null));};exports['destroy']=function(_0x439a66,_0x2835af){return db[_0x7e8f('0x2e')][_0x7e8f('0x4a')]({'where':{'id':_0x439a66['params']['id']}})[_0x7e8f('0x28')](handleEntityNotFound(_0x2835af,null))[_0x7e8f('0x28')](removeEntity(_0x2835af,null))[_0x7e8f('0x46')](handleError(_0x2835af,null));};exports[_0x7e8f('0x4e')]=function(_0x187a6e,_0x51d63d){return db[_0x7e8f('0x2e')]['describe']()[_0x7e8f('0x28')](respondWithResult(_0x51d63d,null))[_0x7e8f('0x46')](handleError(_0x51d63d,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index da1ef8e..b3c7f1f 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 _0x0445=['bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','define','user_profile_has_sections','sectionId','userProfileId','lodash','util','../../config/logger','api','moment'];(function(_0x16b0f4,_0x99f84f){var _0x25ce98=function(_0x43eddc){while(--_0x43eddc){_0x16b0f4['push'](_0x16b0f4['shift']());}};_0x25ce98(++_0x99f84f);}(_0x0445,0x1ae));var _0x5044=function(_0x870b62,_0x2143f9){_0x870b62=_0x870b62-0x0;var _0x2dcb39=_0x0445[_0x870b62];return _0x2dcb39;};'use strict';var _=require(_0x5044('0x0'));var util=require(_0x5044('0x1'));var logger=require(_0x5044('0x2'))(_0x5044('0x3'));var moment=require(_0x5044('0x4'));var BPromise=require(_0x5044('0x5'));var rp=require(_0x5044('0x6'));var fs=require('fs');var path=require(_0x5044('0x7'));var rimraf=require(_0x5044('0x8'));var config=require(_0x5044('0x9'));var attributes=require(_0x5044('0xa'));module['exports']=function(_0xf235a5,_0x572e4c){return _0xf235a5[_0x5044('0xb')]('UserProfileSection',attributes,{'tableName':_0x5044('0xc'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x5044('0xd'),_0x5044('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4ed2=['define','compositeIndex','userProfileId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ed2,0x1d7));var _0x24ed=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4ed2[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x24ed('0x0'));var util=require(_0x24ed('0x1'));var logger=require('../../config/logger')(_0x24ed('0x2'));var moment=require(_0x24ed('0x3'));var BPromise=require(_0x24ed('0x4'));var rp=require(_0x24ed('0x5'));var fs=require('fs');var path=require(_0x24ed('0x6'));var rimraf=require(_0x24ed('0x7'));var config=require(_0x24ed('0x8'));var attributes=require('./userProfileSection.attributes');module[_0x24ed('0x9')]=function(_0x5254f4,_0x1aa86d){return _0x5254f4[_0x24ed('0xa')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x24ed('0xb'),'fields':['sectionId',_0x24ed('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 78fb4f2..0643d5e 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 _0x7027=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash'];(function(_0x4b617b,_0x39a636){var _0x3a5aa1=function(_0x4f0ffa){while(--_0x4f0ffa){_0x4b617b['push'](_0x4b617b['shift']());}};_0x3a5aa1(++_0x39a636);}(_0x7027,0x6d));var _0x7702=function(_0x4ebe2c,_0x257285){_0x4ebe2c=_0x4ebe2c-0x0;var _0x10581c=_0x7027[_0x4ebe2c];return _0x10581c;};'use strict';var _=require(_0x7702('0x0'));var util=require('util');var moment=require(_0x7702('0x1'));var BPromise=require(_0x7702('0x2'));var rs=require(_0x7702('0x3'));var fs=require('fs');var Redis=require(_0x7702('0x4'));var db=require(_0x7702('0x5'))['db'];var utils=require(_0x7702('0x6'));var logger=require('../../config/logger')(_0x7702('0x7'));var config=require(_0x7702('0x8'));var jayson=require(_0x7702('0x9'));var client=jayson[_0x7702('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcdf48c,_0x1318d3,_0x3250e5){return new BPromise(function(_0x265729,_0x534348){return client[_0x7702('0xb')](_0xcdf48c,_0x3250e5)[_0x7702('0xc')](function(_0x4b5251){logger['info'](_0x7702('0xd'),_0x1318d3,_0x7702('0xe'));logger[_0x7702('0xf')](_0x7702('0x10'),_0x1318d3,_0x7702('0xe'),JSON[_0x7702('0x11')](_0x4b5251));if(_0x4b5251[_0x7702('0x12')]){if(_0x4b5251[_0x7702('0x12')]['code']===0x1f4){logger[_0x7702('0x12')](_0x7702('0xd'),_0x1318d3,_0x4b5251[_0x7702('0x12')][_0x7702('0x13')]);return _0x534348(_0x4b5251[_0x7702('0x12')][_0x7702('0x13')]);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0x1318d3,_0x4b5251[_0x7702('0x12')]['message']);return _0x265729(_0x4b5251[_0x7702('0x12')][_0x7702('0x13')]);}else{logger[_0x7702('0x14')](_0x7702('0xd'),_0x1318d3,_0x7702('0xe'));_0x265729(_0x4b5251[_0x7702('0x15')]['message']);}})['catch'](function(_0x2cca5a){logger[_0x7702('0x12')](_0x7702('0xd'),_0x1318d3,_0x2cca5a);_0x534348(_0x2cca5a);});});} \ No newline at end of file +var _0xf70f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis'];(function(_0x5f14c7,_0x3d98b6){var _0x5c2284=function(_0x3b64ad){while(--_0x3b64ad){_0x5f14c7['push'](_0x5f14c7['shift']());}};_0x5c2284(++_0x3d98b6);}(_0xf70f,0x9c));var _0xff70=function(_0x7efe31,_0x1b42d3){_0x7efe31=_0x7efe31-0x0;var _0x59ea5a=_0xf70f[_0x7efe31];return _0x59ea5a;};'use strict';var _=require(_0xff70('0x0'));var util=require(_0xff70('0x1'));var moment=require(_0xff70('0x2'));var BPromise=require('bluebird');var rs=require(_0xff70('0x3'));var fs=require('fs');var Redis=require(_0xff70('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xff70('0x5'));var logger=require(_0xff70('0x6'))(_0xff70('0x7'));var config=require(_0xff70('0x8'));var jayson=require(_0xff70('0x9'));var client=jayson[_0xff70('0xa')][_0xff70('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a65bf,_0x384f67,_0x381604){return new BPromise(function(_0x1d2083,_0x9fba00){return client[_0xff70('0xc')](_0x4a65bf,_0x381604)['then'](function(_0x274bcb){logger[_0xff70('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x384f67,_0xff70('0xe'));logger[_0xff70('0xf')](_0xff70('0x10'),_0x384f67,_0xff70('0xe'),JSON[_0xff70('0x11')](_0x274bcb));if(_0x274bcb[_0xff70('0x12')]){if(_0x274bcb[_0xff70('0x12')][_0xff70('0x13')]===0x1f4){logger['error'](_0xff70('0x14'),_0x384f67,_0x274bcb['error'][_0xff70('0x15')]);return _0x9fba00(_0x274bcb['error']['message']);}logger[_0xff70('0x12')](_0xff70('0x14'),_0x384f67,_0x274bcb['error']['message']);return _0x1d2083(_0x274bcb[_0xff70('0x12')][_0xff70('0x15')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x384f67,_0xff70('0xe'));_0x1d2083(_0x274bcb[_0xff70('0x16')][_0xff70('0x15')]);}})['catch'](function(_0x5840d0){logger[_0xff70('0x12')](_0xff70('0x14'),_0x384f67,_0x5840d0);_0x9fba00(_0x5840d0);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 2651230..7ad7b00 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x380464,_0x2dfa7c){var _0x31f24a=function(_0x24916e){while(--_0x24916e){_0x380464['push'](_0x380464['shift']());}};_0x31f24a(++_0x2dfa7c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x20e174,_0x321464){var _0x5c9b21=function(_0x1bec55){while(--_0x1bec55){_0x20e174['push'](_0x20e174['shift']());}};_0x5c9b21(++_0x321464);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 6dca63a..b3e9e5e 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 _0x41a1=['INTEGER','exports'];(function(_0x516961,_0x35b1fc){var _0x4a70ce=function(_0x2e8ef){while(--_0x2e8ef){_0x516961['push'](_0x516961['shift']());}};_0x4a70ce(++_0x35b1fc);}(_0x41a1,0x107));var _0x141a=function(_0x44f2eb,_0x1fcafc){_0x44f2eb=_0x44f2eb-0x0;var _0x4b8267=_0x41a1[_0x44f2eb];return _0x4b8267;};'use strict';var Sequelize=require('sequelize');module[_0x141a('0x0')]={'penalty':{'type':Sequelize[_0x141a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa6aa=['sequelize'];(function(_0x2133d9,_0x1bc974){var _0x5719bf=function(_0x1baad4){while(--_0x1baad4){_0x2133d9['push'](_0x2133d9['shift']());}};_0x5719bf(++_0x1bc974);}(_0xa6aa,0x19b));var _0xaa6a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa6aa[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xaa6a('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 21e4a1a..e952692 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 _0x6657=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash'];(function(_0x33430c,_0x4cc99c){var _0x31fcbf=function(_0x1f2d41){while(--_0x1f2d41){_0x33430c['push'](_0x33430c['shift']());}};_0x31fcbf(++_0x4cc99c);}(_0x6657,0x17f));var _0x7665=function(_0x27c436,_0x283d5f){_0x27c436=_0x27c436-0x0;var _0x453a21=_0x6657[_0x27c436];return _0x453a21;};'use strict';var _=require(_0x7665('0x0'));var util=require('util');var logger=require(_0x7665('0x1'))(_0x7665('0x2'));var moment=require(_0x7665('0x3'));var BPromise=require(_0x7665('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7665('0x5'));var rimraf=require(_0x7665('0x6'));var config=require(_0x7665('0x7'));var attributes=require(_0x7665('0x8'));module[_0x7665('0x9')]=function(_0x28b410,_0x1a6f2f){return _0x28b410[_0x7665('0xa')]('UserSmsQueue',attributes,{'tableName':_0x7665('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bd3=['exports','define','UserSmsQueue','lodash','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x278c9b,_0x216e89){var _0x30ce15=function(_0x5b5184){while(--_0x5b5184){_0x278c9b['push'](_0x278c9b['shift']());}};_0x30ce15(++_0x216e89);}(_0x4bd3,0x174));var _0x34bd=function(_0x5b01ce,_0x20b8f4){_0x5b01ce=_0x5b01ce-0x0;var _0x45695a=_0x4bd3[_0x5b01ce];return _0x45695a;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./userSmsQueue.attributes');module[_0x34bd('0x6')]=function(_0x2a15a2,_0x5c2a7a){return _0x2a15a2[_0x34bd('0x7')](_0x34bd('0x8'),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 bd89c6a..27c720c 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 _0xfef0=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','util'];(function(_0x26546c,_0x1f52c2){var _0x45fa97=function(_0x5dc2f1){while(--_0x5dc2f1){_0x26546c['push'](_0x26546c['shift']());}};_0x45fa97(++_0x1f52c2);}(_0xfef0,0x149));var _0x0fef=function(_0x2dd375,_0x19e4eb){_0x2dd375=_0x2dd375-0x0;var _0x27e540=_0xfef0[_0x2dd375];return _0x27e540;};'use strict';var _=require('lodash');var util=require(_0x0fef('0x0'));var moment=require(_0x0fef('0x1'));var BPromise=require(_0x0fef('0x2'));var rs=require(_0x0fef('0x3'));var fs=require('fs');var Redis=require(_0x0fef('0x4'));var db=require(_0x0fef('0x5'))['db'];var utils=require(_0x0fef('0x6'));var logger=require(_0x0fef('0x7'))(_0x0fef('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0fef('0x9')][_0x0fef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1aeec8,_0x59c993,_0x55dc34){return new BPromise(function(_0x20fac0,_0x37e55e){return client[_0x0fef('0xb')](_0x1aeec8,_0x55dc34)[_0x0fef('0xc')](function(_0x31984d){logger[_0x0fef('0xd')](_0x0fef('0xe'),_0x59c993,'request\x20sent');logger[_0x0fef('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x59c993,_0x0fef('0x10'),JSON[_0x0fef('0x11')](_0x31984d));if(_0x31984d[_0x0fef('0x12')]){if(_0x31984d[_0x0fef('0x12')][_0x0fef('0x13')]===0x1f4){logger[_0x0fef('0x12')](_0x0fef('0xe'),_0x59c993,_0x31984d[_0x0fef('0x12')][_0x0fef('0x14')]);return _0x37e55e(_0x31984d[_0x0fef('0x12')][_0x0fef('0x14')]);}logger[_0x0fef('0x12')](_0x0fef('0xe'),_0x59c993,_0x31984d[_0x0fef('0x12')][_0x0fef('0x14')]);return _0x20fac0(_0x31984d[_0x0fef('0x12')][_0x0fef('0x14')]);}else{logger[_0x0fef('0xd')](_0x0fef('0xe'),_0x59c993,_0x0fef('0x10'));_0x20fac0(_0x31984d[_0x0fef('0x15')][_0x0fef('0x14')]);}})['catch'](function(_0x5b0f74){logger[_0x0fef('0x12')](_0x0fef('0xe'),_0x59c993,_0x5b0f74);_0x37e55e(_0x5b0f74);});});} \ No newline at end of file +var _0xcbe5=['rpc','../../config/environment','jayson/promise','client','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2f57d0,_0x5cecc4){var _0x3097e2=function(_0x4b87d7){while(--_0x4b87d7){_0x2f57d0['push'](_0x2f57d0['shift']());}};_0x3097e2(++_0x5cecc4);}(_0xcbe5,0x12e));var _0x5cbe=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xcbe5[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var util=require(_0x5cbe('0x0'));var moment=require(_0x5cbe('0x1'));var BPromise=require('bluebird');var rs=require(_0x5cbe('0x2'));var fs=require('fs');var Redis=require(_0x5cbe('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5cbe('0x4'));var logger=require(_0x5cbe('0x5'))(_0x5cbe('0x6'));var config=require(_0x5cbe('0x7'));var jayson=require(_0x5cbe('0x8'));var client=jayson[_0x5cbe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x290ef2,_0x173931,_0x2eddc7){return new BPromise(function(_0x260665,_0x2e7043){return client[_0x5cbe('0xa')](_0x290ef2,_0x2eddc7)[_0x5cbe('0xb')](function(_0x6b862e){logger[_0x5cbe('0xc')](_0x5cbe('0xd'),_0x173931,_0x5cbe('0xe'));logger[_0x5cbe('0xf')](_0x5cbe('0x10'),_0x173931,_0x5cbe('0xe'),JSON[_0x5cbe('0x11')](_0x6b862e));if(_0x6b862e[_0x5cbe('0x12')]){if(_0x6b862e[_0x5cbe('0x12')][_0x5cbe('0x13')]===0x1f4){logger['error'](_0x5cbe('0xd'),_0x173931,_0x6b862e[_0x5cbe('0x12')]['message']);return _0x2e7043(_0x6b862e['error'][_0x5cbe('0x14')]);}logger[_0x5cbe('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x173931,_0x6b862e['error']['message']);return _0x260665(_0x6b862e[_0x5cbe('0x12')][_0x5cbe('0x14')]);}else{logger['info'](_0x5cbe('0xd'),_0x173931,_0x5cbe('0xe'));_0x260665(_0x6b862e[_0x5cbe('0x15')][_0x5cbe('0x14')]);}})['catch'](function(_0x252921){logger['error'](_0x5cbe('0xd'),_0x173931,_0x252921);_0x2e7043(_0x252921);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index c7d3001..492f3ae 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.attributes.js +++ b/server/api/userVoicePrefix/userVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfea6=['sequelize','INTEGER'];(function(_0x19b116,_0x5208e1){var _0x4a55d0=function(_0x2b7115){while(--_0x2b7115){_0x19b116['push'](_0x19b116['shift']());}};_0x4a55d0(++_0x5208e1);}(_0xfea6,0x19a));var _0x6fea=function(_0x1a1f80,_0x5c7110){_0x1a1f80=_0x1a1f80-0x0;var _0x81cc5b=_0xfea6[_0x1a1f80];return _0x81cc5b;};'use strict';var Sequelize=require(_0x6fea('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x6fea('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x6fea('0x1')]}}; \ No newline at end of file +var _0x8241=['exports','INTEGER','sequelize'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x8241,0x1c4));var _0x1824=function(_0x2bfbae,_0x4e277d){_0x2bfbae=_0x2bfbae-0x0;var _0x268b16=_0x8241[_0x2bfbae];return _0x268b16;};'use strict';var Sequelize=require(_0x1824('0x0'));module[_0x1824('0x1')]={'UserId':{'type':Sequelize[_0x1824('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 3a9453f..946a47a 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.model.js +++ b/server/api/userVoicePrefix/userVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x26e67b,_0x27a9a3){var _0x21aed3=function(_0x3f4a4b){while(--_0x3f4a4b){_0x26e67b['push'](_0x26e67b['shift']());}};_0x21aed3(++_0x27a9a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x643602,_0x42c3f7){var _0x48ce97=function(_0x5d765b){while(--_0x5d765b){_0x643602['push'](_0x643602['shift']());}};_0x48ce97(++_0x42c3f7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 83df503..dfc727d 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x57a430,_0x281e18){var _0x533e30=function(_0x30f094){while(--_0x30f094){_0x57a430['push'](_0x57a430['shift']());}};_0x533e30(++_0x281e18);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x379f05,_0x47bd2c){var _0x359277=function(_0x4ba3fe){while(--_0x4ba3fe){_0x379f05['push'](_0x379f05['shift']());}};_0x359277(++_0x47bd2c);}(_0xedd9,0xfc));var _0x9edd=function(_0x4c6160,_0x3b11d1){_0x4c6160=_0x4c6160-0x0;var _0x8bacfd=_0xedd9[_0x4c6160];return _0x8bacfd;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 2b0a66c..5467d3e 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 _0x897b=['sequelize','exports','INTEGER'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x897b,0x90));var _0xb897=function(_0x534d57,_0x237c25){_0x534d57=_0x534d57-0x0;var _0x54afa6=_0x897b[_0x534d57];return _0x54afa6;};'use strict';var Sequelize=require(_0xb897('0x0'));module[_0xb897('0x1')]={'penalty':{'type':Sequelize[_0xb897('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1f50=['exports','INTEGER','sequelize'];(function(_0x5d85ec,_0x4f6f1c){var _0xa01f0d=function(_0x2686fd){while(--_0x2686fd){_0x5d85ec['push'](_0x5d85ec['shift']());}};_0xa01f0d(++_0x4f6f1c);}(_0x1f50,0xb9));var _0x01f5=function(_0x50e1cf,_0x5b8361){_0x50e1cf=_0x50e1cf-0x0;var _0x39104f=_0x1f50[_0x50e1cf];return _0x39104f;};'use strict';var Sequelize=require(_0x01f5('0x0'));module[_0x01f5('0x1')]={'penalty':{'type':Sequelize[_0x01f5('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 3b3e37b..588952a 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 _0x2a5e=['request-promise','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x53c8bf,_0x5b4de2){var _0x219b1e=function(_0x14e56f){while(--_0x14e56f){_0x53c8bf['push'](_0x53c8bf['shift']());}};_0x219b1e(++_0x5b4de2);}(_0x2a5e,0x1da));var _0xe2a5=function(_0x574af8,_0x20ea89){_0x574af8=_0x574af8-0x0;var _0x35f9dc=_0x2a5e[_0x574af8];return _0x35f9dc;};'use strict';var _=require(_0xe2a5('0x0'));var util=require(_0xe2a5('0x1'));var logger=require(_0xe2a5('0x2'))(_0xe2a5('0x3'));var moment=require(_0xe2a5('0x4'));var BPromise=require(_0xe2a5('0x5'));var rp=require(_0xe2a5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe2a5('0x7'));module[_0xe2a5('0x8')]=function(_0x51075c,_0x31c0d4){return _0x51075c[_0xe2a5('0x9')](_0xe2a5('0xa'),attributes,{'tableName':_0xe2a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x482f=['exports','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userVoiceQueue.attributes'];(function(_0x5ee995,_0x591f41){var _0x509977=function(_0x4f1b90){while(--_0x4f1b90){_0x5ee995['push'](_0x5ee995['shift']());}};_0x509977(++_0x591f41);}(_0x482f,0x93));var _0xf482=function(_0x14885e,_0x2622ef){_0x14885e=_0x14885e-0x0;var _0x264358=_0x482f[_0x14885e];return _0x264358;};'use strict';var _=require(_0xf482('0x0'));var util=require('util');var logger=require(_0xf482('0x1'))(_0xf482('0x2'));var moment=require(_0xf482('0x3'));var BPromise=require(_0xf482('0x4'));var rp=require(_0xf482('0x5'));var fs=require('fs');var path=require(_0xf482('0x6'));var rimraf=require('rimraf');var config=require(_0xf482('0x7'));var attributes=require(_0xf482('0x8'));module[_0xf482('0x9')]=function(_0x133cdf,_0x52c25b){return _0x133cdf[_0xf482('0xa')](_0xf482('0xb'),attributes,{'tableName':_0xf482('0xc'),'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 9b17bd1..25d1dbb 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 _0xaae1=['then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x6d9911,_0x337167){var _0x2a8e15=function(_0x351aef){while(--_0x351aef){_0x6d9911['push'](_0x6d9911['shift']());}};_0x2a8e15(++_0x337167);}(_0xaae1,0x1c2));var _0x1aae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaae1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1aae('0x0'));var util=require(_0x1aae('0x1'));var moment=require(_0x1aae('0x2'));var BPromise=require('bluebird');var rs=require(_0x1aae('0x3'));var fs=require('fs');var Redis=require(_0x1aae('0x4'));var db=require(_0x1aae('0x5'))['db'];var utils=require(_0x1aae('0x6'));var logger=require(_0x1aae('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1aae('0x8'));var client=jayson[_0x1aae('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30be81,_0x27933d,_0x255938){return new BPromise(function(_0x2eab52,_0x59d82f){return client['request'](_0x30be81,_0x255938)[_0x1aae('0xa')](function(_0x40dfc4){logger['info'](_0x1aae('0xb'),_0x27933d,_0x1aae('0xc'));logger[_0x1aae('0xd')](_0x1aae('0xe'),_0x27933d,_0x1aae('0xc'),JSON[_0x1aae('0xf')](_0x40dfc4));if(_0x40dfc4[_0x1aae('0x10')]){if(_0x40dfc4['error'][_0x1aae('0x11')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x27933d,_0x40dfc4[_0x1aae('0x10')][_0x1aae('0x12')]);return _0x59d82f(_0x40dfc4['error'][_0x1aae('0x12')]);}logger['error'](_0x1aae('0xb'),_0x27933d,_0x40dfc4[_0x1aae('0x10')][_0x1aae('0x12')]);return _0x2eab52(_0x40dfc4[_0x1aae('0x10')][_0x1aae('0x12')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x27933d,_0x1aae('0xc'));_0x2eab52(_0x40dfc4[_0x1aae('0x13')]['message']);}})['catch'](function(_0x2e0729){logger[_0x1aae('0x10')](_0x1aae('0xb'),_0x27933d,_0x2e0729);_0x59d82f(_0x2e0729);});});} \ No newline at end of file +var _0x575f=['UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4efcf4,_0x20f39b){var _0x4d9d20=function(_0x563c4b){while(--_0x563c4b){_0x4efcf4['push'](_0x4efcf4['shift']());}};_0x4d9d20(++_0x20f39b);}(_0x575f,0x86));var _0xf575=function(_0x58b2e3,_0xccacc4){_0x58b2e3=_0x58b2e3-0x0;var _0x1c8282=_0x575f[_0x58b2e3];return _0x1c8282;};'use strict';var _=require(_0xf575('0x0'));var util=require(_0xf575('0x1'));var moment=require(_0xf575('0x2'));var BPromise=require(_0xf575('0x3'));var rs=require(_0xf575('0x4'));var fs=require('fs');var Redis=require(_0xf575('0x5'));var db=require(_0xf575('0x6'))['db'];var utils=require(_0xf575('0x7'));var logger=require(_0xf575('0x8'))('rpc');var config=require(_0xf575('0x9'));var jayson=require(_0xf575('0xa'));var client=jayson[_0xf575('0xb')][_0xf575('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18270e,_0x177a19,_0x428e0c){return new BPromise(function(_0x799798,_0x1ff636){return client[_0xf575('0xd')](_0x18270e,_0x428e0c)[_0xf575('0xe')](function(_0xf59a7){logger[_0xf575('0xf')](_0xf575('0x10'),_0x177a19,'request\x20sent');logger[_0xf575('0x11')](_0xf575('0x12'),_0x177a19,_0xf575('0x13'),JSON['stringify'](_0xf59a7));if(_0xf59a7[_0xf575('0x14')]){if(_0xf59a7[_0xf575('0x14')][_0xf575('0x15')]===0x1f4){logger[_0xf575('0x14')](_0xf575('0x10'),_0x177a19,_0xf59a7[_0xf575('0x14')][_0xf575('0x16')]);return _0x1ff636(_0xf59a7[_0xf575('0x14')][_0xf575('0x16')]);}logger[_0xf575('0x14')](_0xf575('0x10'),_0x177a19,_0xf59a7[_0xf575('0x14')]['message']);return _0x799798(_0xf59a7['error']['message']);}else{logger[_0xf575('0xf')](_0xf575('0x10'),_0x177a19,_0xf575('0x13'));_0x799798(_0xf59a7[_0xf575('0x17')][_0xf575('0x16')]);}})[_0xf575('0x18')](function(_0x1c8cd8){logger['error'](_0xf575('0x10'),_0x177a19,_0x1c8cd8);_0x1ff636(_0x1c8cd8);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 7eb45b0..e08a3b5 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x207776,_0x5dbb66){var _0x3c5e1e=function(_0x37fdb5){while(--_0x37fdb5){_0x207776['push'](_0x207776['shift']());}};_0x3c5e1e(++_0x5dbb66);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0xcb91[_0x58547b];return _0x1d3fd2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2f29cf,_0x43e022){var _0x2dcdf9=function(_0x413976){while(--_0x413976){_0x2f29cf['push'](_0x2f29cf['shift']());}};_0x2dcdf9(++_0x43e022);}(_0x70e0,0x17b));var _0x070e=function(_0x13b742,_0x3098c7){_0x13b742=_0x13b742-0x0;var _0x3d3b65=_0x70e0[_0x13b742];return _0x3d3b65;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index abdeea5..e33bcbc 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 _0x99bd=['sequelize','exports','INTEGER','queue_interface','Required\x20by\x20Asterisk','STRING'];(function(_0x36688d,_0x12c64d){var _0x40d6c5=function(_0x54d89b){while(--_0x54d89b){_0x36688d['push'](_0x36688d['shift']());}};_0x40d6c5(++_0x12c64d);}(_0x99bd,0xb4));var _0xd99b=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x99bd[_0x599e60];return _0x468e19;};'use strict';var Sequelize=require(_0xd99b('0x0'));module[_0xd99b('0x1')]={'uniqueid':{'type':Sequelize[_0xd99b('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xd99b('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd99b('0x3'),'comment':_0xd99b('0x4')},'VoiceQueueId':{'type':Sequelize[_0xd99b('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xd99b('0x5')],'allowNull':![],'unique':'queue_interface','comment':_0xd99b('0x4')},'penalty':{'type':Sequelize[_0xd99b('0x2')](0xb),'defaultValue':0x0,'comment':_0xd99b('0x4')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xd99b('0x4')}}; \ No newline at end of file +var _0xe2fa=['queue_interface','sequelize','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x4923eb,_0x4fcf4b){var _0x236c2d=function(_0x53a691){while(--_0x53a691){_0x4923eb['push'](_0x4923eb['shift']());}};_0x236c2d(++_0x4fcf4b);}(_0xe2fa,0x6f));var _0xae2f=function(_0x492424,_0x4e0c4e){_0x492424=_0x492424-0x0;var _0x311f51=_0xe2fa[_0x492424];return _0x311f51;};'use strict';var Sequelize=require(_0xae2f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xae2f('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xae2f('0x2')},'membername':{'type':Sequelize[_0xae2f('0x3')],'allowNull':![],'comment':_0xae2f('0x2')},'UserId':{'type':Sequelize[_0xae2f('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xae2f('0x3')],'allowNull':![],'unique':_0xae2f('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xae2f('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xae2f('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xae2f('0x2')},'penalty':{'type':Sequelize[_0xae2f('0x1')](0xb),'defaultValue':0x0,'comment':_0xae2f('0x2')},'paused':{'type':Sequelize[_0xae2f('0x1')](0xb),'defaultValue':0x0,'comment':_0xae2f('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 06df8fa..b605bf5 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 _0x3445=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0xa636d1,_0x46812d){var _0x119fa4=function(_0xaea46){while(--_0xaea46){_0xa636d1['push'](_0xa636d1['shift']());}};_0x119fa4(++_0x46812d);}(_0x3445,0x141));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x5344('0x0'));var UserVoiceQueueRt=require(_0x5344('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x5344('0x2')](0x0);var events={'afterCreate':_0x5344('0x3'),'afterUpdate':_0x5344('0x4'),'afterDestroy':_0x5344('0x5')};function emitEvent(_0x4b17cb){return function(_0x7ad708,_0x50819e,_0x4547ae){UserVoiceQueueRtEvents[_0x5344('0x6')](_0x4b17cb+':'+_0x7ad708['id'],_0x7ad708);UserVoiceQueueRtEvents['emit'](_0x4b17cb,_0x7ad708);_0x4547ae(null);};}for(var e in events){if(events[_0x5344('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x5344('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x12d2=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x565443,_0x17429){var _0x71025d=function(_0x21bc12){while(--_0x21bc12){_0x565443['push'](_0x565443['shift']());}};_0x71025d(++_0x17429);}(_0x12d2,0xb0));var _0x212d=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x12d2[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0x212d('0x0'));var UserVoiceQueueRt=require(_0x212d('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x212d('0x2')](0x0);var events={'afterCreate':_0x212d('0x3'),'afterUpdate':_0x212d('0x4'),'afterDestroy':_0x212d('0x5')};function emitEvent(_0xb144f){return function(_0x445d1d,_0x121e0e,_0x450d02){UserVoiceQueueRtEvents[_0x212d('0x6')](_0xb144f+':'+_0x445d1d['id'],_0x445d1d);UserVoiceQueueRtEvents[_0x212d('0x6')](_0xb144f,_0x445d1d);_0x450d02(null);};}for(var e in events){if(events[_0x212d('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x212d('0x8')](e,emitEvent(event));}}module[_0x212d('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 66e28d0..7e98cce 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 _0xa586=['../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0xedeffb,_0x423ab9){var _0x3896d3=function(_0x150ca5){while(--_0x150ca5){_0xedeffb['push'](_0xedeffb['shift']());}};_0x3896d3(++_0x423ab9);}(_0xa586,0x12e));var _0x6a58=function(_0x514260,_0x1891e1){_0x514260=_0x514260-0x0;var _0x4ac81b=_0xa586[_0x514260];return _0x4ac81b;};'use strict';var _=require('lodash');var util=require(_0x6a58('0x0'));var logger=require(_0x6a58('0x1'))('api');var moment=require(_0x6a58('0x2'));var BPromise=require('bluebird');var rp=require(_0x6a58('0x3'));var fs=require('fs');var path=require(_0x6a58('0x4'));var rimraf=require(_0x6a58('0x5'));var config=require(_0x6a58('0x6'));var attributes=require(_0x6a58('0x7'));module[_0x6a58('0x8')]=function(_0x19fb10,_0xc665a1){return _0x19fb10['define'](_0x6a58('0x9'),attributes,{'tableName':_0x6a58('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7c3=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x1ee8d6,_0x23faa4){var _0x33f27a=function(_0x285924){while(--_0x285924){_0x1ee8d6['push'](_0x1ee8d6['shift']());}};_0x33f27a(++_0x23faa4);}(_0xe7c3,0x10a));var _0x3e7c=function(_0x523caa,_0x4bea30){_0x523caa=_0x523caa-0x0;var _0x347ef0=_0xe7c3[_0x523caa];return _0x347ef0;};'use strict';var _=require(_0x3e7c('0x0'));var util=require(_0x3e7c('0x1'));var logger=require(_0x3e7c('0x2'))(_0x3e7c('0x3'));var moment=require(_0x3e7c('0x4'));var BPromise=require(_0x3e7c('0x5'));var rp=require(_0x3e7c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e7c('0x7'));var config=require(_0x3e7c('0x8'));var attributes=require(_0x3e7c('0x9'));module[_0x3e7c('0xa')]=function(_0xd0b9bc,_0x388279){return _0xd0b9bc[_0x3e7c('0xb')](_0x3e7c('0xc'),attributes,{'tableName':_0x3e7c('0xd'),'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 0691dc9..6e08a5d 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 _0xcadb=['../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','UserVoiceQueueRt','options','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x366e6a,_0x109f7e){var _0x39e7c1=function(_0x7efba7){while(--_0x7efba7){_0x366e6a['push'](_0x366e6a['shift']());}};_0x39e7c1(++_0x109f7e);}(_0xcadb,0xa9));var _0xbcad=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0xcadb[_0x4a3898];return _0x25ceb0;};'use strict';var _=require(_0xbcad('0x0'));var util=require(_0xbcad('0x1'));var moment=require(_0xbcad('0x2'));var BPromise=require(_0xbcad('0x3'));var rs=require(_0xbcad('0x4'));var fs=require('fs');var Redis=require(_0xbcad('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbcad('0x6'));var logger=require(_0xbcad('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbcad('0x8'));var client=jayson[_0xbcad('0x9')][_0xbcad('0xa')]({'port':0x232a});config[_0xbcad('0xb')]=_[_0xbcad('0xc')](config[_0xbcad('0xb')],{'host':_0xbcad('0xd'),'port':0x18eb});var socket=require(_0xbcad('0xe'))(new Redis(config[_0xbcad('0xb')]));require(_0xbcad('0xf'))[_0xbcad('0x10')](socket);function respondWithRpcPromise(_0x443d0b,_0x1c6c74,_0x1ce969){return new BPromise(function(_0xc915fb,_0x46636b){return client['request'](_0x443d0b,_0x1ce969)[_0xbcad('0x11')](function(_0x1a3850){logger[_0xbcad('0x12')](_0xbcad('0x13'),_0x1c6c74,'request\x20sent');logger[_0xbcad('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x1c6c74,_0xbcad('0x15'),JSON[_0xbcad('0x16')](_0x1a3850));if(_0x1a3850['error']){if(_0x1a3850[_0xbcad('0x17')]['code']===0x1f4){logger[_0xbcad('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1c6c74,_0x1a3850['error'][_0xbcad('0x18')]);return _0x46636b(_0x1a3850['error']['message']);}logger[_0xbcad('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1c6c74,_0x1a3850[_0xbcad('0x17')]['message']);return _0xc915fb(_0x1a3850[_0xbcad('0x17')]['message']);}else{logger[_0xbcad('0x12')](_0xbcad('0x13'),_0x1c6c74,_0xbcad('0x15'));_0xc915fb(_0x1a3850[_0xbcad('0x19')][_0xbcad('0x18')]);}})[_0xbcad('0x1a')](function(_0x482e77){logger[_0xbcad('0x17')](_0xbcad('0x13'),_0x1c6c74,_0x482e77);_0x46636b(_0x482e77);});});}exports['GetVoiceQueueRtPauses']=function(_0x2c61cd){var _0x47431e=this;return new Promise(function(_0x546153,_0x5240fb){return db[_0xbcad('0x1b')]['findAll']({'raw':_0x2c61cd[_0xbcad('0x1c')]?_0x2c61cd['options']['raw']===undefined?!![]:![]:!![],'where':_0x2c61cd[_0xbcad('0x1c')]?_0x2c61cd['options'][_0xbcad('0x1d')]||null:null,'attributes':[[db['sequelize']['fn'](_0xbcad('0x1e'),db[_0xbcad('0x1f')]['fn']('IF',db['sequelize'][_0xbcad('0x20')](_0xbcad('0x21')))),'outboundQueuePauses']]})[_0xbcad('0x11')](function(_0x414ebf){logger[_0xbcad('0x12')](_0xbcad('0x22'),_0x2c61cd);logger[_0xbcad('0x14')](_0xbcad('0x22'),_0x2c61cd,JSON[_0xbcad('0x16')](_0x414ebf));_0x546153(_0x414ebf);})['catch'](function(_0x596ac1){logger['error'](_0xbcad('0x22'),_0x596ac1[_0xbcad('0x18')],_0x2c61cd);_0x5240fb(_0x47431e[_0xbcad('0x17')](0x1f4,_0x596ac1[_0xbcad('0x18')]));});});}; \ No newline at end of file +var _0x72d0=['info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','findAll','options','raw','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','request','then'];(function(_0x207a02,_0x278c56){var _0xd995c3=function(_0x24e415){while(--_0x24e415){_0x207a02['push'](_0x207a02['shift']());}};_0xd995c3(++_0x278c56);}(_0x72d0,0x134));var _0x072d=function(_0x256ea9,_0x390904){_0x256ea9=_0x256ea9-0x0;var _0x32127e=_0x72d0[_0x256ea9];return _0x32127e;};'use strict';var _=require(_0x072d('0x0'));var util=require(_0x072d('0x1'));var moment=require(_0x072d('0x2'));var BPromise=require('bluebird');var rs=require(_0x072d('0x3'));var fs=require('fs');var Redis=require(_0x072d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x072d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x072d('0x6'));var jayson=require(_0x072d('0x7'));var client=jayson[_0x072d('0x8')][_0x072d('0x9')]({'port':0x232a});config[_0x072d('0xa')]=_[_0x072d('0xb')](config[_0x072d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x072d('0xc'))(new Redis(config['redis']));require(_0x072d('0xd'))['register'](socket);function respondWithRpcPromise(_0x566ee0,_0x5d4da4,_0x149ca8){return new BPromise(function(_0x2b96c1,_0x3d25cd){return client[_0x072d('0xe')](_0x566ee0,_0x149ca8)[_0x072d('0xf')](function(_0x25f1c0){logger[_0x072d('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5d4da4,_0x072d('0x11'));logger[_0x072d('0x12')](_0x072d('0x13'),_0x5d4da4,_0x072d('0x11'),JSON['stringify'](_0x25f1c0));if(_0x25f1c0['error']){if(_0x25f1c0[_0x072d('0x14')][_0x072d('0x15')]===0x1f4){logger[_0x072d('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5d4da4,_0x25f1c0[_0x072d('0x14')]['message']);return _0x3d25cd(_0x25f1c0[_0x072d('0x14')]['message']);}logger[_0x072d('0x14')](_0x072d('0x16'),_0x5d4da4,_0x25f1c0[_0x072d('0x14')][_0x072d('0x17')]);return _0x2b96c1(_0x25f1c0['error']['message']);}else{logger['info'](_0x072d('0x16'),_0x5d4da4,_0x072d('0x11'));_0x2b96c1(_0x25f1c0[_0x072d('0x18')][_0x072d('0x17')]);}})[_0x072d('0x19')](function(_0x4959fd){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x5d4da4,_0x4959fd);_0x3d25cd(_0x4959fd);});});}exports[_0x072d('0x1a')]=function(_0x618df0){var _0x287f9a=this;return new Promise(function(_0x481c42,_0x37154d){return db['UserVoiceQueueRt'][_0x072d('0x1b')]({'raw':_0x618df0[_0x072d('0x1c')]?_0x618df0['options'][_0x072d('0x1d')]===undefined?!![]:![]:!![],'where':_0x618df0[_0x072d('0x1c')]?_0x618df0[_0x072d('0x1c')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x072d('0x1e'),db[_0x072d('0x1f')]['fn']('IF',db['sequelize'][_0x072d('0x20')](_0x072d('0x21')))),_0x072d('0x22')]]})['then'](function(_0xf256c5){logger[_0x072d('0x10')](_0x072d('0x1a'),_0x618df0);logger['debug'](_0x072d('0x1a'),_0x618df0,JSON[_0x072d('0x23')](_0xf256c5));_0x481c42(_0xf256c5);})[_0x072d('0x19')](function(_0x217208){logger[_0x072d('0x14')](_0x072d('0x1a'),_0x217208[_0x072d('0x17')],_0x618df0);_0x37154d(_0x287f9a[_0x072d('0x14')](0x1f4,_0x217208['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 7d75756..948ef33 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 _0x044a=['./userVoiceQueueRt.events','save','remove','update','emit','register','userVoiceQueueRt:'];(function(_0x54ad78,_0x170e93){var _0x113bdc=function(_0x5319fe){while(--_0x5319fe){_0x54ad78['push'](_0x54ad78['shift']());}};_0x113bdc(++_0x170e93);}(_0x044a,0x173));var _0xa044=function(_0x75896b,_0x116ce1){_0x75896b=_0x75896b-0x0;var _0x3d1b52=_0x044a[_0x75896b];return _0x3d1b52;};'use strict';var UserVoiceQueueRtEvents=require(_0xa044('0x0'));var events=[_0xa044('0x1'),_0xa044('0x2'),_0xa044('0x3')];function createListener(_0x31c260,_0x17f8c4){return function(_0x1bcad0){_0x17f8c4[_0xa044('0x4')](_0x31c260,_0x1bcad0);};}function removeListener(_0x25ed77,_0x116358){return function(){UserVoiceQueueRtEvents['removeListener'](_0x25ed77,_0x116358);};}exports[_0xa044('0x5')]=function(_0x1103e7){for(var _0x1bdd1b=0x0,_0x1c04bb=events['length'];_0x1bdd1b<_0x1c04bb;_0x1bdd1b++){var _0xe12f7d=events[_0x1bdd1b];var _0x33f556=createListener(_0xa044('0x6')+_0xe12f7d,_0x1103e7);UserVoiceQueueRtEvents['on'](_0xe12f7d,_0x33f556);}}; \ No newline at end of file +var _0xf981=['remove','update','emit','removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x4a13cd,_0x1d5ef8){var _0x57eb9b=function(_0x524bdf){while(--_0x524bdf){_0x4a13cd['push'](_0x4a13cd['shift']());}};_0x57eb9b(++_0x1d5ef8);}(_0xf981,0xe6));var _0x1f98=function(_0x4aa926,_0x236dc1){_0x4aa926=_0x4aa926-0x0;var _0x5a88a7=_0xf981[_0x4aa926];return _0x5a88a7;};'use strict';var UserVoiceQueueRtEvents=require(_0x1f98('0x0'));var events=[_0x1f98('0x1'),_0x1f98('0x2'),_0x1f98('0x3')];function createListener(_0x1125ac,_0x2f8aec){return function(_0x476693){_0x2f8aec[_0x1f98('0x4')](_0x1125ac,_0x476693);};}function removeListener(_0x562a81,_0x14da55){return function(){UserVoiceQueueRtEvents[_0x1f98('0x5')](_0x562a81,_0x14da55);};}exports[_0x1f98('0x6')]=function(_0x14bb19){for(var _0x285cdc=0x0,_0x4a4526=events['length'];_0x285cdc<_0x4a4526;_0x285cdc++){var _0x24a520=events[_0x285cdc];var _0x501423=createListener(_0x1f98('0x7')+_0x24a520,_0x14bb19);UserVoiceQueueRtEvents['on'](_0x24a520,_0x501423);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 30515de..ef12148 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4cd61a,_0xad54a4){var _0x51c337=function(_0x2d490f){while(--_0x2d490f){_0x4cd61a['push'](_0x4cd61a['shift']());}};_0x51c337(++_0xad54a4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0xcb91[_0x1b64dd];return _0xeb464c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x16f7c3,_0x7cc6bd){var _0x259a52=function(_0x5d494a){while(--_0x5d494a){_0x16f7c3['push'](_0x16f7c3['shift']());}};_0x259a52(++_0x7cc6bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index b7bf255..3bbb879 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 _0x0c46=['sequelize','INTEGER'];(function(_0xd30d7c,_0x7b9e69){var _0x197294=function(_0xe077fa){while(--_0xe077fa){_0xd30d7c['push'](_0xd30d7c['shift']());}};_0x197294(++_0x7b9e69);}(_0x0c46,0x134));var _0x60c4=function(_0x5ecdca,_0x4eaa42){_0x5ecdca=_0x5ecdca-0x0;var _0x3a85a1=_0x0c46[_0x5ecdca];return _0x3a85a1;};'use strict';var Sequelize=require(_0x60c4('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x60c4('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x568a=['INTEGER'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x568a,0x1dc));var _0xa568=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x568a[_0x4d8ed9];return _0x1e2140;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xa568('0x0')],'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 45d905b..19bfb39 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 _0x0e16=['rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x16ec1f,_0x18061c){var _0x2878dc=function(_0x2d7749){while(--_0x2d7749){_0x16ec1f['push'](_0x16ec1f['shift']());}};_0x2878dc(++_0x18061c);}(_0x0e16,0x10f));var _0x60e1=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x0e16[_0x5d80de];return _0x1c7556;};'use strict';var _=require(_0x60e1('0x0'));var util=require('util');var logger=require(_0x60e1('0x1'))(_0x60e1('0x2'));var moment=require(_0x60e1('0x3'));var BPromise=require(_0x60e1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x60e1('0x5'));var config=require(_0x60e1('0x6'));var attributes=require(_0x60e1('0x7'));module[_0x60e1('0x8')]=function(_0x229745,_0x608f19){return _0x229745[_0x60e1('0x9')](_0x60e1('0xa'),attributes,{'tableName':_0x60e1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c79=['api','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger'];(function(_0x1208cc,_0x3de835){var _0x48114b=function(_0x546db3){while(--_0x546db3){_0x1208cc['push'](_0x1208cc['shift']());}};_0x48114b(++_0x3de835);}(_0x8c79,0x1c6));var _0x98c7=function(_0xb77dfe,_0x39c4c7){_0xb77dfe=_0xb77dfe-0x0;var _0x5e4f5d=_0x8c79[_0xb77dfe];return _0x5e4f5d;};'use strict';var _=require(_0x98c7('0x0'));var util=require('util');var logger=require(_0x98c7('0x1'))(_0x98c7('0x2'));var moment=require('moment');var BPromise=require(_0x98c7('0x3'));var rp=require(_0x98c7('0x4'));var fs=require('fs');var path=require(_0x98c7('0x5'));var rimraf=require(_0x98c7('0x6'));var config=require(_0x98c7('0x7'));var attributes=require(_0x98c7('0x8'));module[_0x98c7('0x9')]=function(_0xdf909e,_0x7420be){return _0xdf909e['define'](_0x98c7('0xa'),attributes,{'tableName':_0x98c7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 184199e..b7d490b 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 _0x2fec=['rpc','client','http','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x28d7b5,_0x1305a4){var _0x1ed035=function(_0x57e1f6){while(--_0x57e1f6){_0x28d7b5['push'](_0x28d7b5['shift']());}};_0x1ed035(++_0x1305a4);}(_0x2fec,0x115));var _0xc2fe=function(_0x59e4f1,_0x11302a){_0x59e4f1=_0x59e4f1-0x0;var _0x15dd9d=_0x2fec[_0x59e4f1];return _0x15dd9d;};'use strict';var _=require(_0xc2fe('0x0'));var util=require(_0xc2fe('0x1'));var moment=require(_0xc2fe('0x2'));var BPromise=require(_0xc2fe('0x3'));var rs=require(_0xc2fe('0x4'));var fs=require('fs');var Redis=require(_0xc2fe('0x5'));var db=require(_0xc2fe('0x6'))['db'];var utils=require(_0xc2fe('0x7'));var logger=require(_0xc2fe('0x8'))(_0xc2fe('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc2fe('0xa')][_0xc2fe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58f395,_0x594d9f,_0x45433f){return new BPromise(function(_0x40729c,_0x402a61){return client['request'](_0x58f395,_0x45433f)[_0xc2fe('0xc')](function(_0x68f886){logger['info'](_0xc2fe('0xd'),_0x594d9f,_0xc2fe('0xe'));logger[_0xc2fe('0xf')](_0xc2fe('0x10'),_0x594d9f,_0xc2fe('0xe'),JSON['stringify'](_0x68f886));if(_0x68f886[_0xc2fe('0x11')]){if(_0x68f886[_0xc2fe('0x11')][_0xc2fe('0x12')]===0x1f4){logger[_0xc2fe('0x11')](_0xc2fe('0xd'),_0x594d9f,_0x68f886[_0xc2fe('0x11')]['message']);return _0x402a61(_0x68f886[_0xc2fe('0x11')][_0xc2fe('0x13')]);}logger[_0xc2fe('0x11')](_0xc2fe('0xd'),_0x594d9f,_0x68f886[_0xc2fe('0x11')][_0xc2fe('0x13')]);return _0x40729c(_0x68f886[_0xc2fe('0x11')][_0xc2fe('0x13')]);}else{logger[_0xc2fe('0x14')](_0xc2fe('0xd'),_0x594d9f,'request\x20sent');_0x40729c(_0x68f886['result'][_0xc2fe('0x13')]);}})[_0xc2fe('0x15')](function(_0x256f06){logger[_0xc2fe('0x11')](_0xc2fe('0xd'),_0x594d9f,_0x256f06);_0x402a61(_0x256f06);});});} \ No newline at end of file +var _0x79b3=['client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x496ebe,_0x5a224a){var _0x392b56=function(_0x18d137){while(--_0x18d137){_0x496ebe['push'](_0x496ebe['shift']());}};_0x392b56(++_0x5a224a);}(_0x79b3,0xfb));var _0x379b=function(_0x54d3a9,_0x13480c){_0x54d3a9=_0x54d3a9-0x0;var _0x113581=_0x79b3[_0x54d3a9];return _0x113581;};'use strict';var _=require(_0x379b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x379b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x379b('0x2'))['db'];var utils=require(_0x379b('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x379b('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x379b('0x5')][_0x379b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4bd76b,_0x403207,_0x4f3866){return new BPromise(function(_0x5f24ec,_0x3ce03c){return client['request'](_0x4bd76b,_0x4f3866)[_0x379b('0x7')](function(_0x24da31){logger[_0x379b('0x8')](_0x379b('0x9'),_0x403207,'request\x20sent');logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x403207,'request\x20sent',JSON[_0x379b('0xa')](_0x24da31));if(_0x24da31[_0x379b('0xb')]){if(_0x24da31[_0x379b('0xb')]['code']===0x1f4){logger[_0x379b('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0x403207,_0x24da31[_0x379b('0xb')][_0x379b('0xc')]);return _0x3ce03c(_0x24da31[_0x379b('0xb')][_0x379b('0xc')]);}logger[_0x379b('0xb')](_0x379b('0x9'),_0x403207,_0x24da31[_0x379b('0xb')]['message']);return _0x5f24ec(_0x24da31[_0x379b('0xb')][_0x379b('0xc')]);}else{logger['info'](_0x379b('0x9'),_0x403207,_0x379b('0xd'));_0x5f24ec(_0x24da31[_0x379b('0xe')]['message']);}})[_0x379b('0xf')](function(_0x36dc36){logger[_0x379b('0xb')](_0x379b('0x9'),_0x403207,_0x36dc36);_0x3ce03c(_0x36dc36);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 434504f..758ee17 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 _0x1da1=['create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x1da1,0x1a4));var _0x11da=function(_0x338d78,_0x22c44f){_0x338d78=_0x338d78-0x0;var _0x25bf5c=_0x1da1[_0x338d78];return _0x25bf5c;};'use strict';var multer=require(_0x11da('0x0'));var util=require(_0x11da('0x1'));var path=require(_0x11da('0x2'));var timeout=require(_0x11da('0x3'));var express=require(_0x11da('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x11da('0x5'));var interaction=require(_0x11da('0x6'));var config=require(_0x11da('0x7'));var controller=require('./variable.controller');router[_0x11da('0x8')]('/',auth[_0x11da('0x9')](),controller[_0x11da('0xa')]);router['get']('/:id',auth[_0x11da('0x9')](),controller[_0x11da('0xb')]);router['post']('/',auth[_0x11da('0x9')](),controller[_0x11da('0xc')]);router['put'](_0x11da('0xd'),auth[_0x11da('0x9')](),controller[_0x11da('0xe')]);router[_0x11da('0xf')](_0x11da('0xd'),auth[_0x11da('0x9')](),controller[_0x11da('0x10')]);module[_0x11da('0x11')]=router; \ No newline at end of file +var _0x94dc=['Router','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','exports','multer','path','express'];(function(_0xd365a8,_0x36b21b){var _0x57234a=function(_0x34fe3b){while(--_0x34fe3b){_0xd365a8['push'](_0xd365a8['shift']());}};_0x57234a(++_0x36b21b);}(_0x94dc,0xb1));var _0xc94d=function(_0x12b8f6,_0x42a9da){_0x12b8f6=_0x12b8f6-0x0;var _0x3ae1cc=_0x94dc[_0x12b8f6];return _0x3ae1cc;};'use strict';var multer=require(_0xc94d('0x0'));var util=require('util');var path=require(_0xc94d('0x1'));var timeout=require('connect-timeout');var express=require(_0xc94d('0x2'));var router=express[_0xc94d('0x3')]();var fs_extra=require(_0xc94d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc94d('0x5'));var config=require(_0xc94d('0x6'));var controller=require(_0xc94d('0x7'));router[_0xc94d('0x8')]('/',auth[_0xc94d('0x9')](),controller[_0xc94d('0xa')]);router[_0xc94d('0x8')]('/:id',auth[_0xc94d('0x9')](),controller[_0xc94d('0xb')]);router[_0xc94d('0xc')]('/',auth[_0xc94d('0x9')](),controller[_0xc94d('0xd')]);router['put'](_0xc94d('0xe'),auth[_0xc94d('0x9')](),controller[_0xc94d('0xf')]);router[_0xc94d('0x10')](_0xc94d('0xe'),auth[_0xc94d('0x9')](),controller['destroy']);module[_0xc94d('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index da9d7f9..02e413a 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 _0x1459=['name','sequelize','STRING'];(function(_0x36e30c,_0x2a147f){var _0x130873=function(_0x56a159){while(--_0x56a159){_0x36e30c['push'](_0x36e30c['shift']());}};_0x130873(++_0x2a147f);}(_0x1459,0xe8));var _0x9145=function(_0x5054da,_0xaea984){_0x5054da=_0x5054da-0x0;var _0x36f231=_0x1459[_0x5054da];return _0x36f231;};'use strict';var Sequelize=require(_0x9145('0x0'));module['exports']={'name':{'type':Sequelize[_0x9145('0x1')],'unique':_0x9145('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9145('0x1')]}}; \ No newline at end of file +var _0x6816=['STRING','sequelize','exports'];(function(_0x10797d,_0x2e0dcd){var _0x3a6dab=function(_0x4b0bac){while(--_0x4b0bac){_0x10797d['push'](_0x10797d['shift']());}};_0x3a6dab(++_0x2e0dcd);}(_0x6816,0x16f));var _0x6681=function(_0x41930b,_0x329693){_0x41930b=_0x41930b-0x0;var _0x21b9a5=_0x6816[_0x41930b];return _0x21b9a5;};'use strict';var Sequelize=require(_0x6681('0x0'));module[_0x6681('0x1')]={'name':{'type':Sequelize[_0x6681('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6681('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index c8bbaa5..35dba10 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 _0x4ae8=['offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','params','fields','include','merge','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x268a79,_0x438015){var _0x2db00d=function(_0x4396db){while(--_0x4396db){_0x268a79['push'](_0x268a79['shift']());}};_0x2db00d(++_0x438015);}(_0x4ae8,0x1d0));var _0x84ae=function(_0x36d6fd,_0x4455e6){_0x36d6fd=_0x36d6fd-0x0;var _0x445d9e=_0x4ae8[_0x36d6fd];return _0x445d9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x84ae('0x0'));var zipdir=require(_0x84ae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x84ae('0x2'));var BPromise=require(_0x84ae('0x3'));var Mustache=require(_0x84ae('0x4'));var util=require(_0x84ae('0x5'));var path=require(_0x84ae('0x6'));var sox=require(_0x84ae('0x7'));var csv=require(_0x84ae('0x8'));var ejs=require(_0x84ae('0x9'));var fs=require('fs');var fs_extra=require(_0x84ae('0xa'));var _=require(_0x84ae('0xb'));var squel=require(_0x84ae('0xc'));var crypto=require(_0x84ae('0xd'));var jsforce=require(_0x84ae('0xe'));var deskjs=require(_0x84ae('0xf'));var toCsv=require('to-csv');var querystring=require(_0x84ae('0x10'));var Papa=require('papaparse');var Redis=require(_0x84ae('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x84ae('0x12'));var as=require(_0x84ae('0x13'));var hardwareService=require(_0x84ae('0x14'));var logger=require(_0x84ae('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x84ae('0x16'));var licenseUtil=require(_0x84ae('0x17'));var db=require(_0x84ae('0x18'))['db'];function respondWithStatusCode(_0x280b05,_0x41d25e){_0x41d25e=_0x41d25e||0xcc;return function(_0x344668){if(_0x344668){return _0x280b05[_0x84ae('0x19')](_0x41d25e);}return _0x280b05[_0x84ae('0x1a')](_0x41d25e)[_0x84ae('0x1b')]();};}function respondWithResult(_0x1defc9,_0x2f5619){_0x2f5619=_0x2f5619||0xc8;return function(_0x4457e1){if(_0x4457e1){return _0x1defc9['status'](_0x2f5619)['json'](_0x4457e1);}};}function respondWithFilteredResult(_0x1f562b,_0x31d467){return function(_0x5e8825){if(_0x5e8825){var _0x14c1fa=typeof _0x31d467[_0x84ae('0x1c')]===_0x84ae('0x1d')&&typeof _0x31d467[_0x84ae('0x1e')]===_0x84ae('0x1d');var _0xddbf04=_0x5e8825['count'];var _0x44cd04=_0x14c1fa?0x0:_0x31d467[_0x84ae('0x1c')];var _0xa8b8aa=_0x14c1fa?_0x5e8825[_0x84ae('0x1f')]:_0x31d467[_0x84ae('0x1c')]+_0x31d467[_0x84ae('0x1e')];var _0x1e90b8;if(_0xa8b8aa>=_0xddbf04){_0xa8b8aa=_0xddbf04;_0x1e90b8=0xc8;}else{_0x1e90b8=0xce;}_0x1f562b[_0x84ae('0x1a')](_0x1e90b8);return _0x1f562b[_0x84ae('0x20')](_0x84ae('0x21'),_0x44cd04+'-'+_0xa8b8aa+'/'+_0xddbf04)[_0x84ae('0x22')](_0x5e8825);}return null;};}function patchUpdates(_0x792e87){return function(_0x17c451){try{jsonpatch['apply'](_0x17c451,_0x792e87,!![]);}catch(_0x5ca4f2){return BPromise['reject'](_0x5ca4f2);}return _0x17c451[_0x84ae('0x23')]();};}function saveUpdates(_0x221728,_0x248268){return function(_0x1c0cb2){if(_0x1c0cb2){return _0x1c0cb2[_0x84ae('0x24')](_0x221728)[_0x84ae('0x25')](function(_0x56c4bd){return _0x56c4bd;});}return null;};}function removeEntity(_0x221962,_0x1e5de1){return function(_0x548c51){if(_0x548c51){return _0x548c51['destroy']()['then'](function(){var _0x515297=_0x548c51['get']({'plain':!![]});var _0x225b95='Variables';return db['UserProfileResource'][_0x84ae('0x26')]({'where':{'type':_0x225b95,'resourceId':_0x515297['id']}})[_0x84ae('0x25')](function(){return _0x548c51;});})[_0x84ae('0x25')](function(){_0x221962[_0x84ae('0x1a')](0xcc)[_0x84ae('0x1b')]();});}};}function handleEntityNotFound(_0x5214df,_0x353a84){return function(_0x232f70){if(!_0x232f70){_0x5214df['sendStatus'](0x194);}return _0x232f70;};}function handleError(_0x554a32,_0x2da9da){_0x2da9da=_0x2da9da||0x1f4;return function(_0x27c00c){logger['error'](_0x27c00c[_0x84ae('0x27')]);if(_0x27c00c['name']){delete _0x27c00c[_0x84ae('0x28')];}_0x554a32['status'](_0x2da9da)[_0x84ae('0x29')](_0x27c00c);};}exports[_0x84ae('0x2a')]=function(_0x3a8f52,_0x1823f1){var _0x3057ab={},_0x2d0fdb={},_0x2c7cdf={'count':0x0,'rows':[]};var _0x3597f6=_[_0x84ae('0x2b')](db[_0x84ae('0x2c')][_0x84ae('0x2d')],function(_0x3d52ed){return{'name':_0x3d52ed[_0x84ae('0x2e')],'type':_0x3d52ed[_0x84ae('0x2f')][_0x84ae('0x30')]};});_0x2d0fdb[_0x84ae('0x31')]=_[_0x84ae('0x2b')](_0x3597f6,_0x84ae('0x28'));_0x2d0fdb['query']=_[_0x84ae('0x32')](_0x3a8f52[_0x84ae('0x33')]);_0x2d0fdb[_0x84ae('0x34')]=_[_0x84ae('0x35')](_0x2d0fdb['model'],_0x2d0fdb[_0x84ae('0x33')]);_0x3057ab[_0x84ae('0x36')]=_[_0x84ae('0x35')](_0x2d0fdb[_0x84ae('0x31')],qs['fields'](_0x3a8f52['query']['fields']));_0x3057ab[_0x84ae('0x36')]=_0x3057ab[_0x84ae('0x36')][_0x84ae('0x37')]?_0x3057ab[_0x84ae('0x36')]:_0x2d0fdb['model'];if(!_0x3a8f52[_0x84ae('0x33')][_0x84ae('0x38')](_0x84ae('0x39'))){_0x3057ab['limit']=qs[_0x84ae('0x1e')](_0x3a8f52[_0x84ae('0x33')][_0x84ae('0x1e')]);_0x3057ab['offset']=qs[_0x84ae('0x1c')](_0x3a8f52[_0x84ae('0x33')][_0x84ae('0x1c')]);}_0x3057ab[_0x84ae('0x3a')]=qs[_0x84ae('0x3b')](_0x3a8f52[_0x84ae('0x33')][_0x84ae('0x3b')]);_0x3057ab[_0x84ae('0x3c')]=qs[_0x84ae('0x34')](_[_0x84ae('0x3d')](_0x3a8f52[_0x84ae('0x33')],_0x2d0fdb[_0x84ae('0x34')]),_0x3597f6);if(_0x3a8f52['query'][_0x84ae('0x3e')]){_0x3057ab['where']=_['merge'](_0x3057ab[_0x84ae('0x3c')],{'$or':_['map'](_0x3597f6,function(_0x260a21){if(_0x260a21[_0x84ae('0x2f')]!=='VIRTUAL'){var _0x148d0d={};_0x148d0d[_0x260a21[_0x84ae('0x28')]]={'$like':'%'+_0x3a8f52[_0x84ae('0x33')]['filter']+'%'};return _0x148d0d;}})});}_0x3057ab=_['merge']({},_0x3057ab,_0x3a8f52['options']);var _0x277a47={'where':_0x3057ab['where']};return db[_0x84ae('0x2c')][_0x84ae('0x1f')](_0x277a47)[_0x84ae('0x25')](function(_0x33ddea){_0x2c7cdf[_0x84ae('0x1f')]=_0x33ddea;if(_0x3a8f52[_0x84ae('0x33')][_0x84ae('0x3f')]){_0x3057ab['include']=[{'all':!![]}];}return db['Variable']['findAll'](_0x3057ab);})[_0x84ae('0x25')](function(_0x5e778c){_0x2c7cdf['rows']=_0x5e778c;return _0x2c7cdf;})[_0x84ae('0x25')](respondWithFilteredResult(_0x1823f1,_0x3057ab))['catch'](handleError(_0x1823f1,null));};exports['show']=function(_0x1f28e7,_0x5b8f4f){var _0x2e4adb={'raw':!![],'where':{'id':_0x1f28e7[_0x84ae('0x40')]['id']}},_0x241d9d={};_0x241d9d[_0x84ae('0x31')]=_[_0x84ae('0x32')](db['Variable']['rawAttributes']);_0x241d9d[_0x84ae('0x33')]=_[_0x84ae('0x32')](_0x1f28e7[_0x84ae('0x33')]);_0x241d9d[_0x84ae('0x34')]=_[_0x84ae('0x35')](_0x241d9d[_0x84ae('0x31')],_0x241d9d[_0x84ae('0x33')]);_0x2e4adb['attributes']=_[_0x84ae('0x35')](_0x241d9d['model'],qs['fields'](_0x1f28e7[_0x84ae('0x33')][_0x84ae('0x41')]));_0x2e4adb['attributes']=_0x2e4adb[_0x84ae('0x36')][_0x84ae('0x37')]?_0x2e4adb[_0x84ae('0x36')]:_0x241d9d[_0x84ae('0x31')];if(_0x1f28e7['query'][_0x84ae('0x3f')]){_0x2e4adb[_0x84ae('0x42')]=[{'all':!![]}];}_0x2e4adb=_[_0x84ae('0x43')]({},_0x2e4adb,_0x1f28e7[_0x84ae('0x44')]);return db[_0x84ae('0x2c')][_0x84ae('0x45')](_0x2e4adb)[_0x84ae('0x25')](handleEntityNotFound(_0x5b8f4f,null))[_0x84ae('0x25')](respondWithResult(_0x5b8f4f,null))[_0x84ae('0x46')](handleError(_0x5b8f4f,null));};exports['create']=function(_0x14025f,_0x5503e9){return db[_0x84ae('0x2c')][_0x84ae('0x47')](_0x14025f[_0x84ae('0x48')],{})[_0x84ae('0x25')](function(_0x19b616){var _0x5cfb05=_0x14025f[_0x84ae('0x49')][_0x84ae('0x4a')]({'plain':!![]});if(!_0x5cfb05)throw new Error(_0x84ae('0x4b'));if(_0x5cfb05[_0x84ae('0x4c')]==='user'){var _0x5de357=_0x19b616[_0x84ae('0x4a')]({'plain':!![]});var _0x3f60ba=_0x84ae('0x4d');return db[_0x84ae('0x4e')][_0x84ae('0x45')]({'where':{'name':_0x3f60ba,'userProfileId':_0x5cfb05['userProfileId']},'raw':!![]})[_0x84ae('0x25')](function(_0x3ebe8a){if(_0x3ebe8a&&_0x3ebe8a[_0x84ae('0x4f')]===0x0){return db[_0x84ae('0x50')][_0x84ae('0x47')]({'name':_0x5de357[_0x84ae('0x28')],'resourceId':_0x5de357['id'],'type':_0x3ebe8a[_0x84ae('0x28')],'sectionId':_0x3ebe8a['id']},{})[_0x84ae('0x25')](function(){return _0x19b616;});}else{return _0x19b616;}})['catch'](function(_0x361c06){logger['error'](_0x84ae('0x51'),_0x361c06);throw _0x361c06;});}return _0x19b616;})[_0x84ae('0x25')](respondWithResult(_0x5503e9,0xc9))[_0x84ae('0x46')](handleError(_0x5503e9,null));};exports[_0x84ae('0x24')]=function(_0x467899,_0x17e874){if(_0x467899[_0x84ae('0x48')]['id']){delete _0x467899[_0x84ae('0x48')]['id'];}return db[_0x84ae('0x2c')]['find']({'where':{'id':_0x467899[_0x84ae('0x40')]['id']}})[_0x84ae('0x25')](handleEntityNotFound(_0x17e874,null))[_0x84ae('0x25')](saveUpdates(_0x467899[_0x84ae('0x48')],null))['then'](respondWithResult(_0x17e874,null))['catch'](handleError(_0x17e874,null));};exports[_0x84ae('0x26')]=function(_0x1ff330,_0xd05d8){return db[_0x84ae('0x2c')][_0x84ae('0x45')]({'where':{'id':_0x1ff330[_0x84ae('0x40')]['id']}})['then'](handleEntityNotFound(_0xd05d8,null))['then'](removeEntity(_0xd05d8,null))[_0x84ae('0x46')](handleError(_0xd05d8,null));}; \ No newline at end of file +var _0x8d0f=['query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','length','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','UserProfileResource','error','name','send','index','Variable','rawAttributes','type','key','model','map'];(function(_0x3c5e54,_0x2b991b){var _0x3ae1f3=function(_0x43f80f){while(--_0x43f80f){_0x3c5e54['push'](_0x3c5e54['shift']());}};_0x3ae1f3(++_0x2b991b);}(_0x8d0f,0x19a));var _0xf8d0=function(_0x14a3c9,_0x3c787f){_0x14a3c9=_0x14a3c9-0x0;var _0x22191f=_0x8d0f[_0x14a3c9];return _0x22191f;};'use strict';var emlformat=require(_0xf8d0('0x0'));var rimraf=require(_0xf8d0('0x1'));var zipdir=require(_0xf8d0('0x2'));var jsonpatch=require(_0xf8d0('0x3'));var rp=require(_0xf8d0('0x4'));var moment=require(_0xf8d0('0x5'));var BPromise=require(_0xf8d0('0x6'));var Mustache=require('mustache');var util=require(_0xf8d0('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf8d0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf8d0('0x9'));var squel=require(_0xf8d0('0xa'));var crypto=require(_0xf8d0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf8d0('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf8d0('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf8d0('0xe'));var qs=require(_0xf8d0('0xf'));var as=require(_0xf8d0('0x10'));var hardwareService=require(_0xf8d0('0x11'));var logger=require('../../config/logger')(_0xf8d0('0x12'));var utils=require('../../config/utils');var config=require(_0xf8d0('0x13'));var licenseUtil=require(_0xf8d0('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x546129,_0x58aa3c){_0x58aa3c=_0x58aa3c||0xcc;return function(_0x23644e){if(_0x23644e){return _0x546129[_0xf8d0('0x15')](_0x58aa3c);}return _0x546129['status'](_0x58aa3c)[_0xf8d0('0x16')]();};}function respondWithResult(_0x35b219,_0x58eaa1){_0x58eaa1=_0x58eaa1||0xc8;return function(_0x5214b8){if(_0x5214b8){return _0x35b219[_0xf8d0('0x17')](_0x58eaa1)['json'](_0x5214b8);}};}function respondWithFilteredResult(_0x2775dd,_0x2d615b){return function(_0xf22069){if(_0xf22069){var _0x385ba9=typeof _0x2d615b[_0xf8d0('0x18')]===_0xf8d0('0x19')&&typeof _0x2d615b[_0xf8d0('0x1a')]===_0xf8d0('0x19');var _0x579eb9=_0xf22069['count'];var _0x3507b0=_0x385ba9?0x0:_0x2d615b[_0xf8d0('0x18')];var _0x1848d4=_0x385ba9?_0xf22069[_0xf8d0('0x1b')]:_0x2d615b[_0xf8d0('0x18')]+_0x2d615b[_0xf8d0('0x1a')];var _0x5df1bc;if(_0x1848d4>=_0x579eb9){_0x1848d4=_0x579eb9;_0x5df1bc=0xc8;}else{_0x5df1bc=0xce;}_0x2775dd[_0xf8d0('0x17')](_0x5df1bc);return _0x2775dd[_0xf8d0('0x1c')](_0xf8d0('0x1d'),_0x3507b0+'-'+_0x1848d4+'/'+_0x579eb9)[_0xf8d0('0x1e')](_0xf22069);}return null;};}function patchUpdates(_0x4e0be2){return function(_0x407936){try{jsonpatch['apply'](_0x407936,_0x4e0be2,!![]);}catch(_0x1485b5){return BPromise[_0xf8d0('0x1f')](_0x1485b5);}return _0x407936[_0xf8d0('0x20')]();};}function saveUpdates(_0x2fc8a2,_0x5db972){return function(_0x39f894){if(_0x39f894){return _0x39f894['update'](_0x2fc8a2)[_0xf8d0('0x21')](function(_0x1cecda){return _0x1cecda;});}return null;};}function removeEntity(_0x46626d,_0x114204){return function(_0x5e2f0a){if(_0x5e2f0a){return _0x5e2f0a[_0xf8d0('0x22')]()['then'](function(){var _0xd69179=_0x5e2f0a['get']({'plain':!![]});var _0x231a8d='Variables';return db[_0xf8d0('0x23')][_0xf8d0('0x22')]({'where':{'type':_0x231a8d,'resourceId':_0xd69179['id']}})[_0xf8d0('0x21')](function(){return _0x5e2f0a;});})[_0xf8d0('0x21')](function(){_0x46626d['status'](0xcc)[_0xf8d0('0x16')]();});}};}function handleEntityNotFound(_0x990bc9,_0x3796c0){return function(_0x4a8875){if(!_0x4a8875){_0x990bc9['sendStatus'](0x194);}return _0x4a8875;};}function handleError(_0x386311,_0x449f7a){_0x449f7a=_0x449f7a||0x1f4;return function(_0x458769){logger[_0xf8d0('0x24')](_0x458769['stack']);if(_0x458769[_0xf8d0('0x25')]){delete _0x458769[_0xf8d0('0x25')];}_0x386311[_0xf8d0('0x17')](_0x449f7a)[_0xf8d0('0x26')](_0x458769);};}exports[_0xf8d0('0x27')]=function(_0x3a0ad9,_0x4208aa){var _0x283dda={},_0x46535a={},_0x16e6af={'count':0x0,'rows':[]};var _0x31100f=_['map'](db[_0xf8d0('0x28')][_0xf8d0('0x29')],function(_0x3b86cb){return{'name':_0x3b86cb['fieldName'],'type':_0x3b86cb[_0xf8d0('0x2a')][_0xf8d0('0x2b')]};});_0x46535a[_0xf8d0('0x2c')]=_[_0xf8d0('0x2d')](_0x31100f,_0xf8d0('0x25'));_0x46535a['query']=_['keys'](_0x3a0ad9[_0xf8d0('0x2e')]);_0x46535a[_0xf8d0('0x2f')]=_[_0xf8d0('0x30')](_0x46535a[_0xf8d0('0x2c')],_0x46535a['query']);_0x283dda[_0xf8d0('0x31')]=_['intersection'](_0x46535a[_0xf8d0('0x2c')],qs[_0xf8d0('0x32')](_0x3a0ad9['query'][_0xf8d0('0x32')]));_0x283dda[_0xf8d0('0x31')]=_0x283dda[_0xf8d0('0x31')]['length']?_0x283dda['attributes']:_0x46535a[_0xf8d0('0x2c')];if(!_0x3a0ad9[_0xf8d0('0x2e')][_0xf8d0('0x33')]('nolimit')){_0x283dda[_0xf8d0('0x1a')]=qs[_0xf8d0('0x1a')](_0x3a0ad9[_0xf8d0('0x2e')][_0xf8d0('0x1a')]);_0x283dda[_0xf8d0('0x18')]=qs[_0xf8d0('0x18')](_0x3a0ad9[_0xf8d0('0x2e')][_0xf8d0('0x18')]);}_0x283dda[_0xf8d0('0x34')]=qs[_0xf8d0('0x35')](_0x3a0ad9[_0xf8d0('0x2e')]['sort']);_0x283dda[_0xf8d0('0x36')]=qs[_0xf8d0('0x2f')](_[_0xf8d0('0x37')](_0x3a0ad9[_0xf8d0('0x2e')],_0x46535a[_0xf8d0('0x2f')]),_0x31100f);if(_0x3a0ad9[_0xf8d0('0x2e')]['filter']){_0x283dda['where']=_[_0xf8d0('0x38')](_0x283dda[_0xf8d0('0x36')],{'$or':_['map'](_0x31100f,function(_0x23cc28){if(_0x23cc28['type']!==_0xf8d0('0x39')){var _0x318859={};_0x318859[_0x23cc28[_0xf8d0('0x25')]]={'$like':'%'+_0x3a0ad9[_0xf8d0('0x2e')]['filter']+'%'};return _0x318859;}})});}_0x283dda=_[_0xf8d0('0x38')]({},_0x283dda,_0x3a0ad9[_0xf8d0('0x3a')]);var _0x53c122={'where':_0x283dda[_0xf8d0('0x36')]};return db[_0xf8d0('0x28')]['count'](_0x53c122)[_0xf8d0('0x21')](function(_0x58e67a){_0x16e6af[_0xf8d0('0x1b')]=_0x58e67a;if(_0x3a0ad9[_0xf8d0('0x2e')][_0xf8d0('0x3b')]){_0x283dda[_0xf8d0('0x3c')]=[{'all':!![]}];}return db[_0xf8d0('0x28')]['findAll'](_0x283dda);})['then'](function(_0x4446a5){_0x16e6af[_0xf8d0('0x3d')]=_0x4446a5;return _0x16e6af;})[_0xf8d0('0x21')](respondWithFilteredResult(_0x4208aa,_0x283dda))[_0xf8d0('0x3e')](handleError(_0x4208aa,null));};exports[_0xf8d0('0x3f')]=function(_0x25da2b,_0x218049){var _0x35c79a={'raw':!![],'where':{'id':_0x25da2b['params']['id']}},_0x11b91e={};_0x11b91e[_0xf8d0('0x2c')]=_[_0xf8d0('0x40')](db[_0xf8d0('0x28')]['rawAttributes']);_0x11b91e[_0xf8d0('0x2e')]=_['keys'](_0x25da2b['query']);_0x11b91e[_0xf8d0('0x2f')]=_[_0xf8d0('0x30')](_0x11b91e['model'],_0x11b91e[_0xf8d0('0x2e')]);_0x35c79a[_0xf8d0('0x31')]=_['intersection'](_0x11b91e[_0xf8d0('0x2c')],qs[_0xf8d0('0x32')](_0x25da2b[_0xf8d0('0x2e')][_0xf8d0('0x32')]));_0x35c79a[_0xf8d0('0x31')]=_0x35c79a[_0xf8d0('0x31')][_0xf8d0('0x41')]?_0x35c79a[_0xf8d0('0x31')]:_0x11b91e[_0xf8d0('0x2c')];if(_0x25da2b[_0xf8d0('0x2e')][_0xf8d0('0x3b')]){_0x35c79a[_0xf8d0('0x3c')]=[{'all':!![]}];}_0x35c79a=_[_0xf8d0('0x38')]({},_0x35c79a,_0x25da2b[_0xf8d0('0x3a')]);return db[_0xf8d0('0x28')]['find'](_0x35c79a)['then'](handleEntityNotFound(_0x218049,null))[_0xf8d0('0x21')](respondWithResult(_0x218049,null))['catch'](handleError(_0x218049,null));};exports[_0xf8d0('0x42')]=function(_0x1d7419,_0x7a0f79){return db['Variable']['create'](_0x1d7419['body'],{})[_0xf8d0('0x21')](function(_0x2fb6b7){var _0xf57bea=_0x1d7419['user'][_0xf8d0('0x43')]({'plain':!![]});if(!_0xf57bea)throw new Error(_0xf8d0('0x44'));if(_0xf57bea['role']===_0xf8d0('0x45')){var _0x19172f=_0x2fb6b7[_0xf8d0('0x43')]({'plain':!![]});var _0x332bfb='Variables';return db[_0xf8d0('0x46')][_0xf8d0('0x47')]({'where':{'name':_0x332bfb,'userProfileId':_0xf57bea['userProfileId']},'raw':!![]})[_0xf8d0('0x21')](function(_0x5e0eba){if(_0x5e0eba&&_0x5e0eba['autoAssociation']===0x0){return db[_0xf8d0('0x23')][_0xf8d0('0x42')]({'name':_0x19172f[_0xf8d0('0x25')],'resourceId':_0x19172f['id'],'type':_0x5e0eba[_0xf8d0('0x25')],'sectionId':_0x5e0eba['id']},{})[_0xf8d0('0x21')](function(){return _0x2fb6b7;});}else{return _0x2fb6b7;}})[_0xf8d0('0x3e')](function(_0x141bfb){logger[_0xf8d0('0x24')](_0xf8d0('0x48'),_0x141bfb);throw _0x141bfb;});}return _0x2fb6b7;})[_0xf8d0('0x21')](respondWithResult(_0x7a0f79,0xc9))[_0xf8d0('0x3e')](handleError(_0x7a0f79,null));};exports[_0xf8d0('0x49')]=function(_0x555022,_0x56e239){if(_0x555022['body']['id']){delete _0x555022[_0xf8d0('0x4a')]['id'];}return db[_0xf8d0('0x28')][_0xf8d0('0x47')]({'where':{'id':_0x555022[_0xf8d0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x56e239,null))[_0xf8d0('0x21')](saveUpdates(_0x555022[_0xf8d0('0x4a')],null))[_0xf8d0('0x21')](respondWithResult(_0x56e239,null))['catch'](handleError(_0x56e239,null));};exports[_0xf8d0('0x22')]=function(_0x169590,_0x4318cd){return db['Variable'][_0xf8d0('0x47')]({'where':{'id':_0x169590[_0xf8d0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4318cd,null))[_0xf8d0('0x21')](removeEntity(_0x4318cd,null))[_0xf8d0('0x3e')](handleError(_0x4318cd,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index e8f68ab..9da1273 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 _0x3895=['../../config/environment','exports','define','Variable','util','../../config/logger','api','moment','bluebird'];(function(_0xa76425,_0x1fd9fc){var _0x5515de=function(_0x5807d7){while(--_0x5807d7){_0xa76425['push'](_0xa76425['shift']());}};_0x5515de(++_0x1fd9fc);}(_0x3895,0x199));var _0x5389=function(_0x1d78de,_0x47998f){_0x1d78de=_0x1d78de-0x0;var _0x556354=_0x3895[_0x1d78de];return _0x556354;};'use strict';var _=require('lodash');var util=require(_0x5389('0x0'));var logger=require(_0x5389('0x1'))(_0x5389('0x2'));var moment=require(_0x5389('0x3'));var BPromise=require(_0x5389('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5389('0x5'));var attributes=require('./variable.attributes');module[_0x5389('0x6')]=function(_0x3ac965,_0x4a4e5f){return _0x3ac965[_0x5389('0x7')](_0x5389('0x8'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19dd=['api','bluebird','request-promise','rimraf','../../config/environment','define','tools_variables','lodash','util'];(function(_0x162e46,_0x540e39){var _0x28ad45=function(_0xe4c99){while(--_0xe4c99){_0x162e46['push'](_0x162e46['shift']());}};_0x28ad45(++_0x540e39);}(_0x19dd,0xfa));var _0xd19d=function(_0x49d5ae,_0x25cccc){_0x49d5ae=_0x49d5ae-0x0;var _0x5bed55=_0x19dd[_0x49d5ae];return _0x5bed55;};'use strict';var _=require(_0xd19d('0x0'));var util=require(_0xd19d('0x1'));var logger=require('../../config/logger')(_0xd19d('0x2'));var moment=require('moment');var BPromise=require(_0xd19d('0x3'));var rp=require(_0xd19d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd19d('0x5'));var config=require(_0xd19d('0x6'));var attributes=require('./variable.attributes');module['exports']=function(_0x1ffc4a,_0x40c77e){return _0x1ffc4a[_0xd19d('0x7')]('Variable',attributes,{'tableName':_0xd19d('0x8'),'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 03f416a..5ff8e8f 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 _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x331b08,_0x2c5937){var _0x5034d9=function(_0x2c916a){while(--_0x2c916a){_0x331b08['push'](_0x331b08['shift']());}};_0x5034d9(++_0x2c5937);}(_0xe14b,0x93));var _0xbe14=function(_0x270952,_0x3d8751){_0x270952=_0x270952-0x0;var _0x420220=_0xe14b[_0x270952];return _0x420220;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file +var _0xf494=['where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','find','options','raw'];(function(_0x478b59,_0xc9b29e){var _0x5b874b=function(_0x5b3143){while(--_0x5b3143){_0x478b59['push'](_0x478b59['shift']());}};_0x5b874b(++_0xc9b29e);}(_0xf494,0x1c6));var _0x4f49=function(_0x42fe8d,_0xdac443){_0x42fe8d=_0x42fe8d-0x0;var _0x299aea=_0xf494[_0x42fe8d];return _0x299aea;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['Variable'][_0x4f49('0x17')]({'raw':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x19')]===undefined?!![]:![]:!![],'where':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1a')]||null:null,'attributes':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1b')]||null:null,'include':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x4e85df['options'][_0x4f49('0x1c')],function(_0x1d70a7){return{'model':db[_0x1d70a7[_0x4f49('0x1e')]],'as':_0x1d70a7['as'],'attributes':_0x1d70a7[_0x4f49('0x1b')],'include':_0x1d70a7[_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x1d70a7['include'],function(_0x4e9041){return{'model':db[_0x4e9041[_0x4f49('0x1e')]],'as':_0x4e9041['as'],'attributes':_0x4e9041[_0x4f49('0x1b')],'include':_0x4e9041['include']?_[_0x4f49('0x1d')](_0x4e9041[_0x4f49('0x1c')],function(_0x35f8e0){return{'model':db[_0x35f8e0['model']],'as':_0x35f8e0['as'],'attributes':_0x35f8e0[_0x4f49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f49('0xe')](function(_0x298785){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1f')]('ShowVariable',_0x4e85df,JSON['stringify'](_0x298785));_0x5bb23b(_0x298785);})[_0x4f49('0x15')](function(_0x2c00ee){logger[_0x4f49('0x13')]('ShowVariable',_0x2c00ee[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x2c00ee[_0x4f49('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index e3d21f9..8bcb7ee 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 _0x41cc=['isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','/migrations','exports','express','../../components/auth/service','get'];(function(_0x893367,_0x4ff408){var _0x356fb5=function(_0x3186dd){while(--_0x3186dd){_0x893367['push'](_0x893367['shift']());}};_0x356fb5(++_0x4ff408);}(_0x41cc,0x89));var _0xc41c=function(_0x313257,_0x4d3dad){_0x313257=_0x313257-0x0;var _0x5ae611=_0x41cc[_0x313257];return _0x5ae611;};'use strict';var express=require(_0xc41c('0x0'));var router=express['Router']();var auth=require(_0xc41c('0x1'));var controller=require('./version.controller');router['get']('/',controller['index']);router[_0xc41c('0x2')]('/fetch',auth[_0xc41c('0x3')](),auth[_0xc41c('0x4')](),controller[_0xc41c('0x5')]);router[_0xc41c('0x2')](_0xc41c('0x6'),auth[_0xc41c('0x3')](),auth['canUpdate'](),controller[_0xc41c('0x7')]);router[_0xc41c('0x2')](_0xc41c('0x8'),auth[_0xc41c('0x3')](),auth[_0xc41c('0x4')](),controller[_0xc41c('0x9')]);router['get'](_0xc41c('0xa'),auth[_0xc41c('0x3')](),controller[_0xc41c('0xb')]);router[_0xc41c('0x2')](_0xc41c('0xc'),controller['migrations']);module[_0xc41c('0xd')]=router; \ No newline at end of file +var _0xeadd=['/migrations','express','Router','../../components/auth/service','get','isAuthenticated','canUpdate','/pull','pull','restart'];(function(_0x53ced7,_0x40cae1){var _0x1f3122=function(_0x19c83a){while(--_0x19c83a){_0x53ced7['push'](_0x53ced7['shift']());}};_0x1f3122(++_0x40cae1);}(_0xeadd,0x10f));var _0xdead=function(_0x7c3cb0,_0x3a0c14){_0x7c3cb0=_0x7c3cb0-0x0;var _0x2eb5ce=_0xeadd[_0x7c3cb0];return _0x2eb5ce;};'use strict';var express=require(_0xdead('0x0'));var router=express[_0xdead('0x1')]();var auth=require(_0xdead('0x2'));var controller=require('./version.controller');router[_0xdead('0x3')]('/',controller['index']);router[_0xdead('0x3')]('/fetch',auth[_0xdead('0x4')](),auth[_0xdead('0x5')](),controller['fetch']);router[_0xdead('0x3')]('/reset',auth['isAuthenticated'](),auth[_0xdead('0x5')](),controller['reset']);router['get'](_0xdead('0x6'),auth[_0xdead('0x4')](),auth['canUpdate'](),controller[_0xdead('0x7')]);router[_0xdead('0x3')]('/restart',auth[_0xdead('0x4')](),controller[_0xdead('0x8')]);router[_0xdead('0x3')](_0xdead('0x9'),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 2f2a389..8c5b3ee 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 _0x2607=['replace','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.','map','.js','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','path','lodash','pkginfo','version','compare-versions','child_process','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','2.0.0','json','origin','master','error','status','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','pull','npm\x20install\x20--production','restart','motion2','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length'];(function(_0x188703,_0x596b26){var _0x1a0c81=function(_0x1cd22d){while(--_0x1cd22d){_0x188703['push'](_0x188703['shift']());}};_0x1a0c81(++_0x596b26);}(_0x2607,0x1b5));var _0x7260=function(_0x596c43,_0x28647a){_0x596c43=_0x596c43-0x0;var _0x4e1315=_0x2607[_0x596c43];return _0x4e1315;};'use strict';var Umzug=require('umzug');var path=require(_0x7260('0x0'));var fs=require('fs');var _=require(_0x7260('0x1'));var pkginfo=require(_0x7260('0x2'))(module,_0x7260('0x3'));var compareVersions=require(_0x7260('0x4'));var exec=require(_0x7260('0x5'))['exec'];var db=require('../../mysqldb')['db'];var config=require(_0x7260('0x6'));var pm2=require(_0x7260('0x7'));var logger=require(_0x7260('0x8'))(_0x7260('0x9'));var git=require(_0x7260('0xa'))(config[_0x7260('0xb')]);exports[_0x7260('0xc')]=function(_0x5d9396,_0x7a4351){var _0x3c9222={'current':module[_0x7260('0xd')][_0x7260('0x3')],'phonebar':0x2};if(_0x5d9396[_0x7260('0xe')]&&_0x5d9396[_0x7260('0xe')][_0x7260('0xf')]){return git[_0x7260('0x10')]()['tags'](function(_0x125895,_0x291f31){_0x3c9222[_0x7260('0xf')]=(_0x125895?module[_0x7260('0xd')][_0x7260('0x3')]:_0x291f31[_0x7260('0xf')])||_0x7260('0x11');return _0x7a4351['status'](0xc8)[_0x7260('0x12')](_0x3c9222);});}else{return _0x7a4351['status'](0xc8)[_0x7260('0x12')](_0x3c9222);}};exports[_0x7260('0x10')]=function(_0x3b1ece,_0x5120f5){return git[_0x7260('0x10')]([_0x7260('0x13'),_0x7260('0x14')],function(_0x2eb6fb){if(_0x2eb6fb){logger[_0x7260('0x15')](_0x2eb6fb);return _0x5120f5[_0x7260('0x16')](0x1f4)[_0x7260('0x12')](_0x2eb6fb);}logger[_0x7260('0x17')](_0x7260('0x18'));return _0x5120f5['status'](0xc8)[_0x7260('0x12')]({'output':_0x7260('0x19')});});};exports[_0x7260('0x1a')]=function(_0x1e7d99,_0x20779e){return git['reset']([_0x7260('0x1b'),_0x7260('0x1c')],function(_0x4ac47c){if(_0x4ac47c){logger['error'](_0x4ac47c);return _0x20779e['status'](0x1f4)['json'](_0x4ac47c);}logger[_0x7260('0x17')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x20779e[_0x7260('0x16')](0xc8)[_0x7260('0x12')]({'output':'git\x20reset\x20--hard'});});};exports[_0x7260('0x1d')]=function(_0x223e4f,_0x54a31f){exec(_0x7260('0x1e'),function(_0x1cf528,_0x337392,_0x2372dc){logger['info'](_0x337392);logger[_0x7260('0x17')](_0x2372dc);if(_0x1cf528){logger[_0x7260('0x15')](_0x1cf528);return _0x54a31f[_0x7260('0x16')](0x1f4)['json'](_0x1cf528);}return _0x54a31f['status'](0xc8)[_0x7260('0x12')]({'output':_0x337392});});};exports[_0x7260('0x1f')]=function(_0x1a45ca,_0x2b53db){return pm2[_0x7260('0x1f')](_0x7260('0x20'))['then'](function(_0x1ad54b){logger[_0x7260('0x17')]('pm2\x20restart\x20motion\x20%s',_0x1ad54b);return _0x2b53db[_0x7260('0x16')](0xc8)['json']({'output':_0x7260('0x21')});})[_0x7260('0x22')](function(_0xe64920){logger['error'](_0xe64920);return _0x2b53db[_0x7260('0x16')](0x1f4)[_0x7260('0x12')](_0xe64920);});};exports[_0x7260('0x23')]=function(_0x2635d3,_0x8cf82d){var _0x2e128d=fs[_0x7260('0x24')](path[_0x7260('0x25')](config['root'],_0x7260('0x26'),'migrations'));var _0x1a1279=[];for(var _0xfdb211=0x0;_0xfdb211<_0x2e128d[_0x7260('0x27')];_0xfdb211++){var _0x50e4ab=_0x2e128d[_0xfdb211][_0x7260('0x28')]('.js','');if(compareVersions(module[_0x7260('0xd')][_0x7260('0x3')],_0x50e4ab)===-0x1){_0x1a1279[_0x7260('0x29')](_0x50e4ab);}}if(_0x1a1279[_0x7260('0x27')]){var _0x28d5bf=_0x1a1279[_0x7260('0x2a')](compareVersions);var _0x258c5f=new Umzug({'storage':_0x7260('0x2b'),'storageOptions':{'model':db['Migration'],'modelName':_0x7260('0x2c'),'columnName':_0x7260('0x3')},'migrations':{'params':[db[_0x7260('0x2b')]['getQueryInterface'](),db['sequelize']['constructor'],function(){throw new Error(_0x7260('0x2d'));}],'path':path['join'](config['root'],_0x7260('0x26'),_0x7260('0x23')),'pattern':/\.js$/}});_0x258c5f['up']({'migrations':_[_0x7260('0x2e')](_0x28d5bf,function(_0x55a405){return _0x55a405+_0x7260('0x2f');})})[_0x7260('0x30')](function(){return _0x8cf82d[_0x7260('0x16')](0xc8)['json']({'output':_0x7260('0x31')+module['exports']['version']+_0x7260('0x32')+_[_0x7260('0x33')](_0x28d5bf),'migrations':_['join'](_0x28d5bf)});})['catch'](function(_0x31dd2d){if(_0x31dd2d instanceof db['sequelize'][_0x7260('0x34')]){return _0x8cf82d['status'](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x8cf82d[_0x7260('0x16')](0x1f4)[_0x7260('0x12')](_0x31dd2d);}});}else{return _0x8cf82d[_0x7260('0x16')](0xc8)[_0x7260('0x12')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0xe622=['.js','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/logger','simple-git','root','index','exports','query','latest','fetch','2.0.0','status','json','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','length','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map'];(function(_0x57062a,_0x123026){var _0xa178da=function(_0x1702d6){while(--_0x1702d6){_0x57062a['push'](_0x57062a['shift']());}};_0xa178da(++_0x123026);}(_0xe622,0x16c));var _0x2e62=function(_0x37d2f5,_0x34a99b){_0x37d2f5=_0x37d2f5-0x0;var _0x5071f8=_0xe622[_0x37d2f5];return _0x5071f8;};'use strict';var Umzug=require(_0x2e62('0x0'));var path=require(_0x2e62('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x2e62('0x2'))(module,_0x2e62('0x3'));var compareVersions=require(_0x2e62('0x4'));var exec=require(_0x2e62('0x5'))[_0x2e62('0x6')];var db=require(_0x2e62('0x7'))['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require(_0x2e62('0x8'))('update');var git=require(_0x2e62('0x9'))(config[_0x2e62('0xa')]);exports[_0x2e62('0xb')]=function(_0x536594,_0x33fe4f){var _0x28de08={'current':module[_0x2e62('0xc')][_0x2e62('0x3')],'phonebar':0x2};if(_0x536594[_0x2e62('0xd')]&&_0x536594[_0x2e62('0xd')][_0x2e62('0xe')]){return git[_0x2e62('0xf')]()['tags'](function(_0x2ef94a,_0x4dbe7b){_0x28de08['latest']=(_0x2ef94a?module[_0x2e62('0xc')][_0x2e62('0x3')]:_0x4dbe7b[_0x2e62('0xe')])||_0x2e62('0x10');return _0x33fe4f['status'](0xc8)['json'](_0x28de08);});}else{return _0x33fe4f[_0x2e62('0x11')](0xc8)[_0x2e62('0x12')](_0x28de08);}};exports[_0x2e62('0xf')]=function(_0x23b6a3,_0x311718){return git[_0x2e62('0xf')](['origin','master'],function(_0x229a38){if(_0x229a38){logger[_0x2e62('0x13')](_0x229a38);return _0x311718[_0x2e62('0x11')](0x1f4)[_0x2e62('0x12')](_0x229a38);}logger[_0x2e62('0x14')](_0x2e62('0x15'));return _0x311718['status'](0xc8)[_0x2e62('0x12')]({'output':_0x2e62('0x16')});});};exports['reset']=function(_0x1b74e7,_0x538720){return git['reset']([_0x2e62('0x17'),_0x2e62('0x18')],function(_0x509883){if(_0x509883){logger[_0x2e62('0x13')](_0x509883);return _0x538720[_0x2e62('0x11')](0x1f4)['json'](_0x509883);}logger[_0x2e62('0x14')](_0x2e62('0x19'));return _0x538720[_0x2e62('0x11')](0xc8)[_0x2e62('0x12')]({'output':_0x2e62('0x1a')});});};exports['pull']=function(_0xe34af4,_0x28a9bd){exec(_0x2e62('0x1b'),function(_0x50a44f,_0x3cb992,_0x1b6800){logger[_0x2e62('0x14')](_0x3cb992);logger[_0x2e62('0x14')](_0x1b6800);if(_0x50a44f){logger[_0x2e62('0x13')](_0x50a44f);return _0x28a9bd['status'](0x1f4)[_0x2e62('0x12')](_0x50a44f);}return _0x28a9bd[_0x2e62('0x11')](0xc8)[_0x2e62('0x12')]({'output':_0x3cb992});});};exports['restart']=function(_0x58d440,_0x28178a){return pm2[_0x2e62('0x1c')](_0x2e62('0x1d'))['then'](function(_0x543b3a){logger[_0x2e62('0x14')](_0x2e62('0x1e'),_0x543b3a);return _0x28178a['status'](0xc8)[_0x2e62('0x12')]({'output':_0x2e62('0x1f')});})[_0x2e62('0x20')](function(_0x5375d9){logger[_0x2e62('0x13')](_0x5375d9);return _0x28178a[_0x2e62('0x11')](0x1f4)[_0x2e62('0x12')](_0x5375d9);});};exports[_0x2e62('0x21')]=function(_0x433656,_0x1faf33){var _0x5e90e8=fs[_0x2e62('0x22')](path[_0x2e62('0x23')](config[_0x2e62('0xa')],'server',_0x2e62('0x21')));var _0x4fb698=[];for(var _0x93c2df=0x0;_0x93c2df<_0x5e90e8[_0x2e62('0x24')];_0x93c2df++){var _0x68889=_0x5e90e8[_0x93c2df]['replace']('.js','');if(compareVersions(module[_0x2e62('0xc')][_0x2e62('0x3')],_0x68889)===-0x1){_0x4fb698['push'](_0x68889);}}if(_0x4fb698[_0x2e62('0x24')]){var _0x132517=_0x4fb698[_0x2e62('0x25')](compareVersions);var _0x3ace36=new Umzug({'storage':_0x2e62('0x26'),'storageOptions':{'model':db[_0x2e62('0x27')],'modelName':'Migration','columnName':_0x2e62('0x3')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db[_0x2e62('0x26')][_0x2e62('0x28')],function(){throw new Error(_0x2e62('0x29'));}],'path':path[_0x2e62('0x23')](config['root'],_0x2e62('0x2a'),_0x2e62('0x21')),'pattern':/\.js$/}});_0x3ace36['up']({'migrations':_[_0x2e62('0x2b')](_0x132517,function(_0x1a612f){return _0x1a612f+_0x2e62('0x2c');})})[_0x2e62('0x2d')](function(){return _0x1faf33[_0x2e62('0x11')](0xc8)[_0x2e62('0x12')]({'output':_0x2e62('0x2e')+module[_0x2e62('0xc')]['version']+_0x2e62('0x2f')+_[_0x2e62('0x30')](_0x132517),'migrations':_[_0x2e62('0x23')](_0x132517)});})[_0x2e62('0x20')](function(_0x419fb0){if(_0x419fb0 instanceof db['sequelize'][_0x2e62('0x31')]){return _0x1faf33[_0x2e62('0x11')](0xc8)[_0x2e62('0x12')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x1faf33[_0x2e62('0x11')](0x1f4)[_0x2e62('0x12')](_0x419fb0);}});}else{return _0x1faf33['status'](0xc8)[_0x2e62('0x12')]({'output':_0x2e62('0x32')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 0d2e149..38dc914 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 _0x787a=['create','/:id','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','show','post'];(function(_0x33d195,_0x5a1640){var _0x1bc03e=function(_0x3ed777){while(--_0x3ed777){_0x33d195['push'](_0x33d195['shift']());}};_0x1bc03e(++_0x5a1640);}(_0x787a,0x1ce));var _0xa787=function(_0x1d285d,_0x11841c){_0x1d285d=_0x1d285d-0x0;var _0x4f62ab=_0x787a[_0x1d285d];return _0x4f62ab;};'use strict';var multer=require(_0xa787('0x0'));var util=require('util');var path=require(_0xa787('0x1'));var timeout=require('connect-timeout');var express=require(_0xa787('0x2'));var router=express[_0xa787('0x3')]();var fs_extra=require(_0xa787('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa787('0x5'));var config=require(_0xa787('0x6'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0xa787('0x7')](),controller[_0xa787('0x8')]);router[_0xa787('0x9')]('/describe',auth[_0xa787('0x7')](),controller[_0xa787('0xa')]);router[_0xa787('0x9')]('/:id',auth[_0xa787('0x7')](),controller[_0xa787('0xb')]);router[_0xa787('0xc')]('/',auth[_0xa787('0x7')](),controller[_0xa787('0xd')]);router['put'](_0xa787('0xe'),auth[_0xa787('0x7')](),controller[_0xa787('0xf')]);router[_0xa787('0x10')](_0xa787('0xe'),auth[_0xa787('0x7')](),controller[_0xa787('0x11')]);module[_0xa787('0x12')]=router; \ No newline at end of file +var _0x0e87=['create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x58a872,_0x50d43a){var _0x3e1577=function(_0x21c808){while(--_0x21c808){_0x58a872['push'](_0x58a872['shift']());}};_0x3e1577(++_0x50d43a);}(_0x0e87,0xb7));var _0x70e8=function(_0x52284,_0xea39ec){_0x52284=_0x52284-0x0;var _0x3b78f7=_0x0e87[_0x52284];return _0x3b78f7;};'use strict';var multer=require('multer');var util=require(_0x70e8('0x0'));var path=require(_0x70e8('0x1'));var timeout=require(_0x70e8('0x2'));var express=require('express');var router=express[_0x70e8('0x3')]();var fs_extra=require(_0x70e8('0x4'));var auth=require(_0x70e8('0x5'));var interaction=require(_0x70e8('0x6'));var config=require(_0x70e8('0x7'));var controller=require(_0x70e8('0x8'));router[_0x70e8('0x9')]('/',auth[_0x70e8('0xa')](),controller[_0x70e8('0xb')]);router[_0x70e8('0x9')](_0x70e8('0xc'),auth['isAuthenticated'](),controller[_0x70e8('0xd')]);router[_0x70e8('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x70e8('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x70e8('0xf')]);router[_0x70e8('0x10')](_0x70e8('0x11'),auth[_0x70e8('0xa')](),controller[_0x70e8('0x12')]);router[_0x70e8('0x13')](_0x70e8('0x11'),auth[_0x70e8('0xa')](),controller[_0x70e8('0x14')]);module[_0x70e8('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 7430c06..b3e4dcb 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 _0x26f9=['BOOLEAN','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x2fe2f7,_0x2e4789){var _0x5a870e=function(_0x38f9f7){while(--_0x38f9f7){_0x2fe2f7['push'](_0x2fe2f7['shift']());}};_0x5a870e(++_0x2e4789);}(_0x26f9,0x16f));var _0x926f=function(_0xd46227,_0x18477f){_0xd46227=_0xd46227-0x0;var _0x2a980d=_0x26f9[_0xd46227];return _0x2a980d;};'use strict';var Sequelize=require(_0x926f('0x0'));module[_0x926f('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x926f('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x926f('0x2')]},'interface':{'type':Sequelize[_0x926f('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x926f('0x3')]},'agentconnectAt':{'type':Sequelize[_0x926f('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x926f('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x926f('0x3')]},'agentdumpAt':{'type':Sequelize[_0x926f('0x3')]},'holdtime':{'type':Sequelize[_0x926f('0x4')]},'agentcomplete':{'type':Sequelize[_0x926f('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x926f('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x926f('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x926f('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x926f('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x926f('0x2')]},'channel':{'type':Sequelize[_0x926f('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x926f('0x2')]},'connectedlinenum':{'type':Sequelize[_0x926f('0x2')]},'connectedlinename':{'type':Sequelize[_0x926f('0x2')]},'language':{'type':Sequelize[_0x926f('0x2')]},'accountcode':{'type':Sequelize[_0x926f('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x926f('0x2')]},'priority':{'type':Sequelize[_0x926f('0x2')]},'destchannel':{'type':Sequelize[_0x926f('0x2')]},'destchannelstate':{'type':Sequelize[_0x926f('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x926f('0x2')]},'destcalleridnum':{'type':Sequelize[_0x926f('0x2')]},'destcalleridname':{'type':Sequelize[_0x926f('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x926f('0x2')]},'destcontext':{'type':Sequelize[_0x926f('0x2')]},'destexten':{'type':Sequelize[_0x926f('0x2')]},'destpriority':{'type':Sequelize[_0x926f('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x926f('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x926f('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x926f('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x926f('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa866=['STRING','DATE','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x326034,_0x2df5c0){var _0x2aea92=function(_0x5d15cd){while(--_0x5d15cd){_0x326034['push'](_0x326034['shift']());}};_0x2aea92(++_0x2df5c0);}(_0xa866,0x6a));var _0x6a86=function(_0x802c16,_0x207627){_0x802c16=_0x802c16-0x0;var _0x4d456d=_0xa866[_0x802c16];return _0x4d456d;};'use strict';var Sequelize=require(_0x6a86('0x0'));module[_0x6a86('0x1')]={'type':{'type':Sequelize[_0x6a86('0x2')]},'uniqueid':{'type':Sequelize[_0x6a86('0x2')]},'calleridnum':{'type':Sequelize[_0x6a86('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x6a86('0x2')]},'interface':{'type':Sequelize[_0x6a86('0x2')]},'membername':{'type':Sequelize[_0x6a86('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x6a86('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x6a86('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x6a86('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x6a86('0x4')]},'agentcomplete':{'type':Sequelize[_0x6a86('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x6a86('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x6a86('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x6a86('0x4')]},'agentacw':{'type':Sequelize[_0x6a86('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6a86('0x4')]},'reason':{'type':Sequelize[_0x6a86('0x2')]},'lastevent':{'type':Sequelize[_0x6a86('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x6a86('0x4')]},'channelstatedesc':{'type':Sequelize[_0x6a86('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6a86('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x6a86('0x2')]},'accountcode':{'type':Sequelize[_0x6a86('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6a86('0x2')]},'destchannel':{'type':Sequelize[_0x6a86('0x2')]},'destchannelstate':{'type':Sequelize[_0x6a86('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x6a86('0x2')]},'destcalleridnum':{'type':Sequelize[_0x6a86('0x2')]},'destcalleridname':{'type':Sequelize[_0x6a86('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x6a86('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6a86('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x6a86('0x2')]},'destcontext':{'type':Sequelize[_0x6a86('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x6a86('0x2')]},'destuniqueid':{'type':Sequelize[_0x6a86('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x6a86('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x6a86('0x2')]},'transfer':{'type':Sequelize[_0x6a86('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6a86('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x6a86('0x2')]},'transferuniqueid':{'type':Sequelize[_0x6a86('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 a6dd5d7..94284cb 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.controller.js +++ b/server/api/voiceAgentReport/voiceAgentReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_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'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 9cd20b2..0a163db 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 _0x9957=['rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','destuniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x7abd7,_0x1ca3f9){var _0x3a2577=function(_0x18456d){while(--_0x18456d){_0x7abd7['push'](_0x7abd7['shift']());}};_0x3a2577(++_0x1ca3f9);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x7995('0xc'),_0x7995('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5a5a=['moment','bluebird','path','rimraf','../../config/environment','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util','../../config/logger','api'];(function(_0x2f2c27,_0x250129){var _0x1654af=function(_0x54a8cd){while(--_0x54a8cd){_0x2f2c27['push'](_0x2f2c27['shift']());}};_0x1654af(++_0x250129);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x5101f5,_0x16463e){_0x5101f5=_0x5101f5-0x0;var _0x56bf84=_0x5a5a[_0x5101f5];return _0x56bf84;};'use strict';var _=require('lodash');var util=require(_0xa5a5('0x0'));var logger=require(_0xa5a5('0x1'))(_0xa5a5('0x2'));var moment=require(_0xa5a5('0x3'));var BPromise=require(_0xa5a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5a5('0x5'));var rimraf=require(_0xa5a5('0x6'));var config=require(_0xa5a5('0x7'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x43943d,_0x1fe96d){return _0x43943d['define'](_0xa5a5('0x8'),attributes,{'tableName':_0xa5a5('0x9'),'paranoid':![],'indexes':[{'fields':[_0xa5a5('0xa'),_0xa5a5('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 c076254..2fce695 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 _0xee97=['stringify','UpdateVoiceAgentReport','VoiceAgentReport','update','body','raw','where','limit','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','code','error','message','VoiceAgentReport,\x20%s,\x20%s','info','result','catch','CreateVoiceAgentReport','options'];(function(_0x4dc66d,_0x82c5f4){var _0x5742ca=function(_0x490a71){while(--_0x490a71){_0x4dc66d['push'](_0x4dc66d['shift']());}};_0x5742ca(++_0x82c5f4);}(_0xee97,0xbc));var _0x7ee9=function(_0x26944a,_0xa84870){_0x26944a=_0x26944a-0x0;var _0x195820=_0xee97[_0x26944a];return _0x195820;};'use strict';var _=require('lodash');var util=require(_0x7ee9('0x0'));var moment=require(_0x7ee9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ee9('0x2'));var db=require(_0x7ee9('0x3'))['db'];var utils=require(_0x7ee9('0x4'));var logger=require(_0x7ee9('0x5'))(_0x7ee9('0x6'));var config=require(_0x7ee9('0x7'));var jayson=require(_0x7ee9('0x8'));var client=jayson[_0x7ee9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x330574,_0x15144c,_0x281c5d){return new BPromise(function(_0x260f27,_0x58e114){return client['request'](_0x330574,_0x281c5d)[_0x7ee9('0xa')](function(_0x566281){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x15144c,_0x7ee9('0xb'));logger[_0x7ee9('0xc')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x15144c,_0x7ee9('0xb'),JSON['stringify'](_0x566281));if(_0x566281['error']){if(_0x566281['error'][_0x7ee9('0xd')]===0x1f4){logger[_0x7ee9('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x15144c,_0x566281[_0x7ee9('0xe')]['message']);return _0x58e114(_0x566281[_0x7ee9('0xe')][_0x7ee9('0xf')]);}logger['error'](_0x7ee9('0x10'),_0x15144c,_0x566281[_0x7ee9('0xe')][_0x7ee9('0xf')]);return _0x260f27(_0x566281[_0x7ee9('0xe')][_0x7ee9('0xf')]);}else{logger[_0x7ee9('0x11')](_0x7ee9('0x10'),_0x15144c,_0x7ee9('0xb'));_0x260f27(_0x566281[_0x7ee9('0x12')][_0x7ee9('0xf')]);}})[_0x7ee9('0x13')](function(_0x5df69d){logger['error'](_0x7ee9('0x10'),_0x15144c,_0x5df69d);_0x58e114(_0x5df69d);});});}exports[_0x7ee9('0x14')]=function(_0x561c91){var _0xcdbe5e=this;return new Promise(function(_0xa27e51,_0x2ba17a){return db['VoiceAgentReport']['create'](_0x561c91['body'],{'raw':_0x561c91[_0x7ee9('0x15')]?_0x561c91[_0x7ee9('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x7ee9('0xa')](function(_0x3908d5){logger[_0x7ee9('0x11')](_0x7ee9('0x14'),_0x561c91);logger[_0x7ee9('0xc')](_0x7ee9('0x14'),_0x561c91,JSON[_0x7ee9('0x16')](_0x3908d5));_0xa27e51(_0x3908d5);})[_0x7ee9('0x13')](function(_0x501dec){logger[_0x7ee9('0xe')](_0x7ee9('0x14'),_0x501dec[_0x7ee9('0xf')],_0x561c91);_0x2ba17a(_0xcdbe5e[_0x7ee9('0xe')](0x1f4,_0x501dec[_0x7ee9('0xf')]));});});};exports[_0x7ee9('0x17')]=function(_0x246411){var _0x1d915e=this;return new Promise(function(_0x4c23c1,_0x3c69df){return db[_0x7ee9('0x18')][_0x7ee9('0x19')](_0x246411[_0x7ee9('0x1a')],{'raw':_0x246411['options']?_0x246411[_0x7ee9('0x15')][_0x7ee9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x246411['options']?_0x246411['options'][_0x7ee9('0x1c')]||null:null,'attributes':_0x246411[_0x7ee9('0x15')]?_0x246411[_0x7ee9('0x15')]['attributes']||null:null,'limit':_0x246411[_0x7ee9('0x15')]?_0x246411[_0x7ee9('0x15')][_0x7ee9('0x1d')]||null:null})['then'](function(_0x3151b2){logger['info'](_0x7ee9('0x17'),_0x246411);logger[_0x7ee9('0xc')](_0x7ee9('0x17'),_0x246411,JSON[_0x7ee9('0x16')](_0x3151b2));_0x4c23c1(_0x3151b2);})[_0x7ee9('0x13')](function(_0x2e8eb5){logger['error'](_0x7ee9('0x17'),_0x2e8eb5[_0x7ee9('0xf')],_0x246411);_0x3c69df(_0x1d915e['error'](0x1f4,_0x2e8eb5[_0x7ee9('0xf')]));});});}; \ No newline at end of file +var _0x5841=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','raw','UpdateVoiceAgentReport','update','options','limit','util','moment'];(function(_0xce5257,_0x461117){var _0x1d5cfd=function(_0x53270e){while(--_0x53270e){_0xce5257['push'](_0xce5257['shift']());}};_0x1d5cfd(++_0x461117);}(_0x5841,0x1be));var _0x1584=function(_0x2e095d,_0x18af1d){_0x2e095d=_0x2e095d-0x0;var _0x5cb8bd=_0x5841[_0x2e095d];return _0x5cb8bd;};'use strict';var _=require('lodash');var util=require(_0x1584('0x0'));var moment=require(_0x1584('0x1'));var BPromise=require(_0x1584('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1584('0x3'));var db=require(_0x1584('0x4'))['db'];var utils=require(_0x1584('0x5'));var logger=require(_0x1584('0x6'))(_0x1584('0x7'));var config=require(_0x1584('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1584('0x9')][_0x1584('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59487f,_0x3458f8,_0x3a3097){return new BPromise(function(_0x165b2e,_0x207b2e){return client[_0x1584('0xb')](_0x59487f,_0x3a3097)['then'](function(_0x356089){logger[_0x1584('0xc')](_0x1584('0xd'),_0x3458f8,_0x1584('0xe'));logger[_0x1584('0xf')](_0x1584('0x10'),_0x3458f8,_0x1584('0xe'),JSON[_0x1584('0x11')](_0x356089));if(_0x356089[_0x1584('0x12')]){if(_0x356089['error'][_0x1584('0x13')]===0x1f4){logger[_0x1584('0x12')](_0x1584('0xd'),_0x3458f8,_0x356089[_0x1584('0x12')][_0x1584('0x14')]);return _0x207b2e(_0x356089[_0x1584('0x12')][_0x1584('0x14')]);}logger[_0x1584('0x12')](_0x1584('0xd'),_0x3458f8,_0x356089[_0x1584('0x12')][_0x1584('0x14')]);return _0x165b2e(_0x356089[_0x1584('0x12')][_0x1584('0x14')]);}else{logger['info'](_0x1584('0xd'),_0x3458f8,_0x1584('0xe'));_0x165b2e(_0x356089[_0x1584('0x15')][_0x1584('0x14')]);}})[_0x1584('0x16')](function(_0x132cf1){logger[_0x1584('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x3458f8,_0x132cf1);_0x207b2e(_0x132cf1);});});}exports[_0x1584('0x17')]=function(_0x750546){var _0x1bd9ca=this;return new Promise(function(_0x32e649,_0x5ab66f){return db[_0x1584('0x18')][_0x1584('0x19')](_0x750546[_0x1584('0x1a')],{'raw':_0x750546['options']?_0x750546['options'][_0x1584('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x31c58a){logger[_0x1584('0xc')]('CreateVoiceAgentReport',_0x750546);logger[_0x1584('0xf')](_0x1584('0x17'),_0x750546,JSON[_0x1584('0x11')](_0x31c58a));_0x32e649(_0x31c58a);})['catch'](function(_0x20f0a6){logger[_0x1584('0x12')](_0x1584('0x17'),_0x20f0a6[_0x1584('0x14')],_0x750546);_0x5ab66f(_0x1bd9ca[_0x1584('0x12')](0x1f4,_0x20f0a6[_0x1584('0x14')]));});});};exports[_0x1584('0x1c')]=function(_0x124420){var _0x4a70b7=this;return new Promise(function(_0x413a1f,_0x432ada){return db[_0x1584('0x18')][_0x1584('0x1d')](_0x124420['body'],{'raw':_0x124420[_0x1584('0x1e')]?_0x124420[_0x1584('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x124420[_0x1584('0x1e')]?_0x124420[_0x1584('0x1e')]['where']||null:null,'attributes':_0x124420['options']?_0x124420[_0x1584('0x1e')]['attributes']||null:null,'limit':_0x124420[_0x1584('0x1e')]?_0x124420[_0x1584('0x1e')][_0x1584('0x1f')]||null:null})['then'](function(_0x2200a2){logger[_0x1584('0xc')](_0x1584('0x1c'),_0x124420);logger[_0x1584('0xf')]('UpdateVoiceAgentReport',_0x124420,JSON[_0x1584('0x11')](_0x2200a2));_0x413a1f(_0x2200a2);})[_0x1584('0x16')](function(_0x4951c8){logger[_0x1584('0x12')](_0x1584('0x1c'),_0x4951c8[_0x1584('0x14')],_0x124420);_0x432ada(_0x4a70b7['error'](0x1f4,_0x4951c8[_0x1584('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index f6d61d2..a4740cc 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 _0x125c=['get','index','/describe','describe','/:id','isAuthenticated','show','create','update','put','/with-retry/:id','updateWithRetry','delete','exports','express','Router','../../components/auth/service','./voiceCallReport.controller'];(function(_0x17262f,_0x3c7ef2){var _0x28d050=function(_0x211f88){while(--_0x211f88){_0x17262f['push'](_0x17262f['shift']());}};_0x28d050(++_0x3c7ef2);}(_0x125c,0x68));var _0xc125=function(_0x4aba31,_0x1ca340){_0x4aba31=_0x4aba31-0x0;var _0x3d7242=_0x125c[_0x4aba31];return _0x3d7242;};'use strict';var express=require(_0xc125('0x0'));var router=express[_0xc125('0x1')]();var auth=require(_0xc125('0x2'));var controller=require(_0xc125('0x3'));router[_0xc125('0x4')]('/',auth['isAuthenticated'](),controller[_0xc125('0x5')]);router[_0xc125('0x4')](_0xc125('0x6'),auth['isAuthenticated'](),controller[_0xc125('0x7')]);router['get'](_0xc125('0x8'),auth[_0xc125('0x9')](),controller[_0xc125('0xa')]);router['post']('/',auth[_0xc125('0x9')](),controller[_0xc125('0xb')]);router['put'](_0xc125('0x8'),auth['isAuthenticated'](),controller[_0xc125('0xc')]);router[_0xc125('0xd')](_0xc125('0xe'),auth[_0xc125('0x9')](),controller[_0xc125('0xf')]);router[_0xc125('0x10')](_0xc125('0x8'),auth[_0xc125('0x9')](),controller['destroy']);module[_0xc125('0x11')]=router; \ No newline at end of file +var _0x80bd=['show','put','/with-retry/:id','updateWithRetry','delete','destroy','exports','express','../../components/auth/service','isAuthenticated','index','get','describe','/:id'];(function(_0x5aa8e0,_0x1e552c){var _0x4f4060=function(_0x247415){while(--_0x247415){_0x5aa8e0['push'](_0x5aa8e0['shift']());}};_0x4f4060(++_0x1e552c);}(_0x80bd,0x1f1));var _0xd80b=function(_0x3ddcfb,_0x46a1c9){_0x3ddcfb=_0x3ddcfb-0x0;var _0x4392bf=_0x80bd[_0x3ddcfb];return _0x4392bf;};'use strict';var express=require(_0xd80b('0x0'));var router=express['Router']();var auth=require(_0xd80b('0x1'));var controller=require('./voiceCallReport.controller');router['get']('/',auth[_0xd80b('0x2')](),controller[_0xd80b('0x3')]);router[_0xd80b('0x4')]('/describe',auth[_0xd80b('0x2')](),controller[_0xd80b('0x5')]);router[_0xd80b('0x4')](_0xd80b('0x6'),auth['isAuthenticated'](),controller[_0xd80b('0x7')]);router['post']('/',auth[_0xd80b('0x2')](),controller['create']);router[_0xd80b('0x8')](_0xd80b('0x6'),auth['isAuthenticated'](),controller['update']);router['put'](_0xd80b('0x9'),auth[_0xd80b('0x2')](),controller[_0xd80b('0xa')]);router[_0xd80b('0xb')](_0xd80b('0x6'),auth[_0xd80b('0x2')](),controller[_0xd80b('0xc')]);module[_0xd80b('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index e570696..9a035d6 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 _0xaecf=['outbound','inbound-fax','TEXT','DATE','INTEGER','sequelize','exports','STRING','inbound'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0xaecf,0x149));var _0xfaec=function(_0x1fb8c4,_0x273ef0){_0x1fb8c4=_0x1fb8c4-0x0;var _0x309645=_0xaecf[_0x1fb8c4];return _0x309645;};'use strict';var Sequelize=require(_0xfaec('0x0'));module[_0xfaec('0x1')]={'uniqueid':{'type':Sequelize[_0xfaec('0x2')]},'type':{'type':Sequelize['ENUM'](_0xfaec('0x3'),'internal',_0xfaec('0x4'),_0xfaec('0x5'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0xfaec('0x2')]},'accountcode':{'type':Sequelize[_0xfaec('0x2')]},'source':{'type':Sequelize[_0xfaec('0x2')]},'destination':{'type':Sequelize[_0xfaec('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xfaec('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xfaec('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xfaec('0x6')]},'starttime':{'type':Sequelize[_0xfaec('0x7')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xfaec('0x7')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xfaec('0x8')]},'billableseconds':{'type':Sequelize[_0xfaec('0x8')]},'mohtime':{'type':Sequelize[_0xfaec('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xfaec('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xfaec('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xfaec('0x2')]},'note':{'type':Sequelize[_0xfaec('0x2')]},'prefix':{'type':Sequelize[_0xfaec('0x2')]},'routeid':{'type':Sequelize[_0xfaec('0x8')]},'sipcallid':{'type':Sequelize[_0xfaec('0x2')]}}; \ No newline at end of file +var _0x7200=['dialer','TEXT','DATE','INTEGER','sequelize','STRING','inbound','internal','outbound','inbound-fax'];(function(_0x35e3b8,_0x1f543f){var _0xae5b9a=function(_0x483dd6){while(--_0x483dd6){_0x35e3b8['push'](_0x35e3b8['shift']());}};_0xae5b9a(++_0x1f543f);}(_0x7200,0x1a8));var _0x0720=function(_0x44e50a,_0x1cc4a2){_0x44e50a=_0x44e50a-0x0;var _0x1b5994=_0x7200[_0x44e50a];return _0x1b5994;};'use strict';var Sequelize=require(_0x0720('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x0720('0x1')]},'type':{'type':Sequelize['ENUM'](_0x0720('0x2'),_0x0720('0x3'),_0x0720('0x4'),_0x0720('0x5'),'outbound-fax',_0x0720('0x6'))},'tag':{'type':Sequelize[_0x0720('0x1')]},'accountcode':{'type':Sequelize[_0x0720('0x1')]},'source':{'type':Sequelize[_0x0720('0x1')]},'destination':{'type':Sequelize[_0x0720('0x1')]},'destinationcontext':{'type':Sequelize[_0x0720('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0720('0x1')]},'destinationchannel':{'type':Sequelize[_0x0720('0x1')]},'lastapplication':{'type':Sequelize[_0x0720('0x1')]},'lastdata':{'type':Sequelize[_0x0720('0x7')]},'starttime':{'type':Sequelize[_0x0720('0x8')]},'systemanswertime':{'type':Sequelize[_0x0720('0x8')]},'answertime':{'type':Sequelize[_0x0720('0x8')]},'endtime':{'type':Sequelize[_0x0720('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x0720('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x0720('0x1')]},'userfield':{'type':Sequelize[_0x0720('0x1')]},'userDisposition':{'type':Sequelize[_0x0720('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x0720('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x0720('0x1')]},'note':{'type':Sequelize[_0x0720('0x1')]},'prefix':{'type':Sequelize[_0x0720('0x1')]},'routeid':{'type':Sequelize[_0x0720('0x9')]},'sipcallid':{'type':Sequelize[_0x0720('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index c60e9e6..5d55a77 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 _0xba0d=['nolimit','order','sort','filter','merge','where','VIRTUAL','options','include','fullname','alias','User','catch','includeAll','find','create','params','describe','user','update','body','uniqueid','updateWithRetry','No\x20such\x20report','lodash','../../config/logger','api','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','destroy','then','end','sendStatus','error','stack','name','index','VoiceCallReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0xba0d,0x8e));var _0xdba0=function(_0x472c0b,_0x1837a2){_0x472c0b=_0x472c0b-0x0;var _0x35c6b8=_0xba0d[_0x472c0b];return _0x35c6b8;};'use strict';var _=require(_0xdba0('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0xdba0('0x1'))(_0xdba0('0x2'));var db=require(_0xdba0('0x3'))['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x139cf3,_0x50eadf){_0x50eadf=_0x50eadf||0xc8;return function(_0xebb600){if(_0xebb600){return _0x139cf3[_0xdba0('0x4')](_0x50eadf)[_0xdba0('0x5')](_0xebb600);}};}function respondWithFilteredResult(_0x8b0331,_0x592a53){return function(_0x59e841){if(_0x59e841){var _0x220299=typeof _0x592a53[_0xdba0('0x6')]===_0xdba0('0x7')&&typeof _0x592a53[_0xdba0('0x8')]==='undefined';var _0x3db492=_0x59e841['count'];var _0x4ff5f5=_0x220299?0x0:_0x592a53[_0xdba0('0x6')];var _0x4d01a9=_0x220299?_0x59e841[_0xdba0('0x9')]:_0x592a53['offset']+_0x592a53[_0xdba0('0x8')];var _0x357072;if(_0x4d01a9>=_0x3db492){_0x4d01a9=_0x3db492;_0x357072=0xc8;}else{_0x357072=0xce;}_0x8b0331[_0xdba0('0x4')](_0x357072);return _0x8b0331[_0xdba0('0xa')](_0xdba0('0xb'),_0x4ff5f5+'-'+_0x4d01a9+'/'+_0x3db492)[_0xdba0('0x5')](_0x59e841);}return null;};}function saveUpdates(_0x24bf36){return function(_0x43ae3a){if(_0x43ae3a){return _0x43ae3a['update'](_0x24bf36)['then'](function(_0x158cdf){return _0x158cdf;});}return null;};}function removeEntity(_0x2d9e50){return function(_0x223797){if(_0x223797){return _0x223797[_0xdba0('0xc')]()[_0xdba0('0xd')](function(){_0x2d9e50[_0xdba0('0x4')](0xcc)[_0xdba0('0xe')]();});}};}function handleEntityNotFound(_0x563983){return function(_0x327932){if(!_0x327932){_0x563983[_0xdba0('0xf')](0x194);}return _0x327932;};}function handleError(_0x3e47da,_0xb0ffc4){_0xb0ffc4=_0xb0ffc4||0x1f4;return function(_0xd66d92){logger[_0xdba0('0x10')](_0xd66d92[_0xdba0('0x11')]);if(_0xd66d92[_0xdba0('0x12')]){delete _0xd66d92[_0xdba0('0x12')];}_0x3e47da[_0xdba0('0x4')](_0xb0ffc4)['send'](_0xd66d92);};}exports[_0xdba0('0x13')]=function(_0x5e954c,_0x1cdf6c){var _0x2915e6={},_0x30b049={},_0x436fff={'count':0x0,'rows':[]};var _0x5c1d6c=_['map'](db[_0xdba0('0x14')][_0xdba0('0x15')],function(_0x57f5e1){return{'name':_0x57f5e1[_0xdba0('0x16')],'type':_0x57f5e1[_0xdba0('0x17')][_0xdba0('0x18')]};});_0x30b049['model']=_[_0xdba0('0x19')](_0x5c1d6c,_0xdba0('0x12'));_0x30b049[_0xdba0('0x1a')]=_[_0xdba0('0x1b')](_0x5e954c[_0xdba0('0x1a')]);_0x30b049[_0xdba0('0x1c')]=_[_0xdba0('0x1d')](_0x30b049[_0xdba0('0x1e')],_0x30b049[_0xdba0('0x1a')]);_0x2915e6[_0xdba0('0x1f')]=_[_0xdba0('0x1d')](_0x30b049['model'],qs[_0xdba0('0x20')](_0x5e954c[_0xdba0('0x1a')]['fields']));_0x2915e6[_0xdba0('0x1f')]=_0x2915e6['attributes'][_0xdba0('0x21')]?_0x2915e6[_0xdba0('0x1f')]:_0x30b049['model'];if(!_0x5e954c['query'][_0xdba0('0x22')](_0xdba0('0x23'))){_0x2915e6[_0xdba0('0x8')]=qs[_0xdba0('0x8')](_0x5e954c[_0xdba0('0x1a')][_0xdba0('0x8')]);_0x2915e6[_0xdba0('0x6')]=qs['offset'](_0x5e954c['query'][_0xdba0('0x6')]);}_0x2915e6[_0xdba0('0x24')]=qs[_0xdba0('0x25')](_0x5e954c[_0xdba0('0x1a')]['sort']);_0x2915e6['where']=qs[_0xdba0('0x1c')](_['pick'](_0x5e954c[_0xdba0('0x1a')],_0x30b049['filters']),_0x5c1d6c);if(_0x5e954c[_0xdba0('0x1a')][_0xdba0('0x26')]){_0x2915e6['where']=_[_0xdba0('0x27')](_0x2915e6[_0xdba0('0x28')],{'$or':_[_0xdba0('0x19')](_0x5c1d6c,function(_0x46aff8){if(_0x46aff8[_0xdba0('0x17')]!==_0xdba0('0x29')){var _0x2665bc={};_0x2665bc[_0x46aff8['name']]={'$like':'%'+_0x5e954c['query'][_0xdba0('0x26')]+'%'};return _0x2665bc;}})});}_0x2915e6=_[_0xdba0('0x27')]({},_0x2915e6,_0x5e954c[_0xdba0('0x2a')]);var _0x45c743={'where':_0x2915e6[_0xdba0('0x28')]};return db['VoiceCallReport']['count'](_0x45c743)[_0xdba0('0xd')](function(_0x1ec935){_0x436fff['count']=_0x1ec935;if(_0x5e954c[_0xdba0('0x1a')]['includeAll']){_0x2915e6[_0xdba0('0x2b')]=[{'attributes':['id',_0xdba0('0x12'),_0xdba0('0x2c'),_0xdba0('0x2d')],'model':db[_0xdba0('0x2e')],'as':_0xdba0('0x2e')}];}return db[_0xdba0('0x14')]['findAll'](_0x2915e6);})[_0xdba0('0xd')](function(_0x5e6c21){_0x436fff['rows']=_0x5e6c21;return _0x436fff;})[_0xdba0('0xd')](respondWithFilteredResult(_0x1cdf6c,_0x2915e6))[_0xdba0('0x2f')](handleError(_0x1cdf6c,null));};exports['show']=function(_0x2dea7d,_0x146c2b){var _0x559d57={'raw':!![],'where':{'id':_0x2dea7d['params']['id']}},_0x55021a={};_0x55021a['model']=_[_0xdba0('0x1b')](db['VoiceCallReport']['rawAttributes']);_0x55021a[_0xdba0('0x1a')]=_['keys'](_0x2dea7d[_0xdba0('0x1a')]);_0x55021a[_0xdba0('0x1c')]=_[_0xdba0('0x1d')](_0x55021a[_0xdba0('0x1e')],_0x55021a[_0xdba0('0x1a')]);_0x559d57[_0xdba0('0x1f')]=_[_0xdba0('0x1d')](_0x55021a[_0xdba0('0x1e')],qs[_0xdba0('0x20')](_0x2dea7d[_0xdba0('0x1a')][_0xdba0('0x20')]));_0x559d57[_0xdba0('0x1f')]=_0x559d57['attributes'][_0xdba0('0x21')]?_0x559d57[_0xdba0('0x1f')]:_0x55021a['model'];if(_0x2dea7d[_0xdba0('0x1a')][_0xdba0('0x30')]){_0x559d57[_0xdba0('0x2b')]=[{'all':!![]}];}_0x559d57=_[_0xdba0('0x27')]({},_0x559d57,_0x2dea7d[_0xdba0('0x2a')]);return db[_0xdba0('0x14')][_0xdba0('0x31')](_0x559d57)[_0xdba0('0xd')](handleEntityNotFound(_0x146c2b,null))[_0xdba0('0xd')](respondWithResult(_0x146c2b,null))[_0xdba0('0x2f')](handleError(_0x146c2b,null));};exports[_0xdba0('0x32')]=function(_0x4296c1,_0x39963d){return db['VoiceCallReport'][_0xdba0('0x32')](_0x4296c1['body'],{})[_0xdba0('0xd')](respondWithResult(_0x39963d,0xc9))[_0xdba0('0x2f')](handleError(_0x39963d,null));};exports['destroy']=function(_0x51902d,_0x59efe3){return db['VoiceCallReport'][_0xdba0('0x31')]({'where':{'id':_0x51902d[_0xdba0('0x33')]['id']}})['then'](handleEntityNotFound(_0x59efe3,null))['then'](removeEntity(_0x59efe3,null))[_0xdba0('0x2f')](handleError(_0x59efe3,null));};exports[_0xdba0('0x34')]=function(_0x1f2037,_0x7afb70){return db[_0xdba0('0x14')][_0xdba0('0x34')]()[_0xdba0('0xd')](respondWithResult(_0x7afb70,null))[_0xdba0('0x2f')](handleError(_0x7afb70,null));};function findForUpdate(_0xc31213){return db[_0xdba0('0x14')][_0xdba0('0x31')]({'where':{'uniqueid':_0xc31213[_0xdba0('0x33')]['id'],'UserId':{'$or':[null,_0xc31213[_0xdba0('0x35')]['id']]}}});}exports[_0xdba0('0x36')]=function(_0x23f035,_0x57dd1e){if(_0x23f035[_0xdba0('0x37')][_0xdba0('0x38')]){delete _0x23f035[_0xdba0('0x37')]['uniqueid'];}return findForUpdate(_0x23f035)[_0xdba0('0xd')](handleEntityNotFound(_0x57dd1e,null))[_0xdba0('0xd')](saveUpdates(_0x23f035[_0xdba0('0x37')],null))[_0xdba0('0xd')](respondWithResult(_0x57dd1e,null))['catch'](handleError(_0x57dd1e,null));};exports[_0xdba0('0x39')]=function(_0x2b15a1,_0x413569,_0x80f70){if(_0x2b15a1[_0xdba0('0x37')][_0xdba0('0x38')]){delete _0x2b15a1[_0xdba0('0x37')][_0xdba0('0x38')];}promiseRetry(function(_0x4acc68){return findForUpdate(_0x2b15a1)[_0xdba0('0xd')](function(_0x3decea){if(_0x3decea!==null){return _0x3decea;}else{_0x4acc68(new Error(_0xdba0('0x3a')));}});},{'retries':0x4,'minTimeout':0xfa})[_0xdba0('0xd')](function(_0x225d20){if(!_0x225d20){return new Promise(function(_0x49ae8a){_0x49ae8a(handleEntityNotFound(_0x413569)());});}else{return _0x225d20['update'](_0x2b15a1[_0xdba0('0x37')])[_0xdba0('0xd')](function(_0x5e96c8){return respondWithResult(_0x413569)(_0x5e96c8);});}},function(){handleEntityNotFound(_0x413569)();});}; \ No newline at end of file +var _0xa5c9=['status','set','Content-Range','json','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','type','VIRTUAL','VoiceCallReport','count','includeAll','include','alias','User','findAll','catch','show','keys','options','find','create','body','user','uniqueid','updateWithRetry','No\x20such\x20report','lodash','../../components/parsers/qs','../../config/logger','api','undefined','offset','limit'];(function(_0x5dc335,_0x1a2daa){var _0x3a35e7=function(_0x341c0f){while(--_0x341c0f){_0x5dc335['push'](_0x5dc335['shift']());}};_0x3a35e7(++_0x1a2daa);}(_0xa5c9,0x143));var _0x9a5c=function(_0x289e64,_0x5adb3c){_0x289e64=_0x289e64-0x0;var _0x30246c=_0xa5c9[_0x289e64];return _0x30246c;};'use strict';var _=require(_0x9a5c('0x0'));var qs=require(_0x9a5c('0x1'));var logger=require(_0x9a5c('0x2'))(_0x9a5c('0x3'));var db=require('../../mysqldb')['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x2fbbbd,_0x1d80b0){_0x1d80b0=_0x1d80b0||0xc8;return function(_0x55bcf5){if(_0x55bcf5){return _0x2fbbbd['status'](_0x1d80b0)['json'](_0x55bcf5);}};}function respondWithFilteredResult(_0x2fef4c,_0x2a697c){return function(_0x2cac2a){if(_0x2cac2a){var _0x3bb6f2=typeof _0x2a697c['offset']===_0x9a5c('0x4')&&typeof _0x2a697c['limit']===_0x9a5c('0x4');var _0x33fcd8=_0x2cac2a['count'];var _0x127932=_0x3bb6f2?0x0:_0x2a697c[_0x9a5c('0x5')];var _0x1205e3=_0x3bb6f2?_0x2cac2a['count']:_0x2a697c['offset']+_0x2a697c[_0x9a5c('0x6')];var _0x7af197;if(_0x1205e3>=_0x33fcd8){_0x1205e3=_0x33fcd8;_0x7af197=0xc8;}else{_0x7af197=0xce;}_0x2fef4c[_0x9a5c('0x7')](_0x7af197);return _0x2fef4c[_0x9a5c('0x8')](_0x9a5c('0x9'),_0x127932+'-'+_0x1205e3+'/'+_0x33fcd8)[_0x9a5c('0xa')](_0x2cac2a);}return null;};}function saveUpdates(_0xa1c7d5){return function(_0x957b17){if(_0x957b17){return _0x957b17[_0x9a5c('0xb')](_0xa1c7d5)[_0x9a5c('0xc')](function(_0x229580){return _0x229580;});}return null;};}function removeEntity(_0x1bec7c){return function(_0x546c0b){if(_0x546c0b){return _0x546c0b[_0x9a5c('0xd')]()[_0x9a5c('0xc')](function(){_0x1bec7c[_0x9a5c('0x7')](0xcc)['end']();});}};}function handleEntityNotFound(_0x320725){return function(_0x1f008e){if(!_0x1f008e){_0x320725['sendStatus'](0x194);}return _0x1f008e;};}function handleError(_0x16422d,_0x5ef98e){_0x5ef98e=_0x5ef98e||0x1f4;return function(_0x350bd5){logger['error'](_0x350bd5[_0x9a5c('0xe')]);if(_0x350bd5[_0x9a5c('0xf')]){delete _0x350bd5['name'];}_0x16422d[_0x9a5c('0x7')](_0x5ef98e)[_0x9a5c('0x10')](_0x350bd5);};}exports[_0x9a5c('0x11')]=function(_0x4bb262,_0x549a96){var _0x2ff36a={},_0x1b13d2={},_0x5e2bd3={'count':0x0,'rows':[]};var _0x139ec4=_[_0x9a5c('0x12')](db['VoiceCallReport'][_0x9a5c('0x13')],function(_0x41283c){return{'name':_0x41283c[_0x9a5c('0x14')],'type':_0x41283c['type'][_0x9a5c('0x15')]};});_0x1b13d2[_0x9a5c('0x16')]=_['map'](_0x139ec4,_0x9a5c('0xf'));_0x1b13d2[_0x9a5c('0x17')]=_['keys'](_0x4bb262[_0x9a5c('0x17')]);_0x1b13d2[_0x9a5c('0x18')]=_[_0x9a5c('0x19')](_0x1b13d2['model'],_0x1b13d2[_0x9a5c('0x17')]);_0x2ff36a[_0x9a5c('0x1a')]=_[_0x9a5c('0x19')](_0x1b13d2[_0x9a5c('0x16')],qs[_0x9a5c('0x1b')](_0x4bb262[_0x9a5c('0x17')]['fields']));_0x2ff36a['attributes']=_0x2ff36a[_0x9a5c('0x1a')][_0x9a5c('0x1c')]?_0x2ff36a[_0x9a5c('0x1a')]:_0x1b13d2[_0x9a5c('0x16')];if(!_0x4bb262['query'][_0x9a5c('0x1d')](_0x9a5c('0x1e'))){_0x2ff36a[_0x9a5c('0x6')]=qs[_0x9a5c('0x6')](_0x4bb262[_0x9a5c('0x17')][_0x9a5c('0x6')]);_0x2ff36a[_0x9a5c('0x5')]=qs[_0x9a5c('0x5')](_0x4bb262[_0x9a5c('0x17')]['offset']);}_0x2ff36a[_0x9a5c('0x1f')]=qs['sort'](_0x4bb262['query']['sort']);_0x2ff36a[_0x9a5c('0x20')]=qs[_0x9a5c('0x18')](_[_0x9a5c('0x21')](_0x4bb262[_0x9a5c('0x17')],_0x1b13d2[_0x9a5c('0x18')]),_0x139ec4);if(_0x4bb262[_0x9a5c('0x17')]['filter']){_0x2ff36a[_0x9a5c('0x20')]=_[_0x9a5c('0x22')](_0x2ff36a[_0x9a5c('0x20')],{'$or':_['map'](_0x139ec4,function(_0x39945c){if(_0x39945c[_0x9a5c('0x23')]!==_0x9a5c('0x24')){var _0x29bb2b={};_0x29bb2b[_0x39945c['name']]={'$like':'%'+_0x4bb262[_0x9a5c('0x17')]['filter']+'%'};return _0x29bb2b;}})});}_0x2ff36a=_[_0x9a5c('0x22')]({},_0x2ff36a,_0x4bb262['options']);var _0x234c32={'where':_0x2ff36a[_0x9a5c('0x20')]};return db[_0x9a5c('0x25')][_0x9a5c('0x26')](_0x234c32)[_0x9a5c('0xc')](function(_0x3792eb){_0x5e2bd3['count']=_0x3792eb;if(_0x4bb262[_0x9a5c('0x17')][_0x9a5c('0x27')]){_0x2ff36a[_0x9a5c('0x28')]=[{'attributes':['id',_0x9a5c('0xf'),'fullname',_0x9a5c('0x29')],'model':db[_0x9a5c('0x2a')],'as':'User'}];}return db[_0x9a5c('0x25')][_0x9a5c('0x2b')](_0x2ff36a);})['then'](function(_0x37146a){_0x5e2bd3['rows']=_0x37146a;return _0x5e2bd3;})[_0x9a5c('0xc')](respondWithFilteredResult(_0x549a96,_0x2ff36a))[_0x9a5c('0x2c')](handleError(_0x549a96,null));};exports[_0x9a5c('0x2d')]=function(_0x2f6302,_0xac97e4){var _0x55d06b={'raw':!![],'where':{'id':_0x2f6302['params']['id']}},_0x5ca745={};_0x5ca745['model']=_[_0x9a5c('0x2e')](db[_0x9a5c('0x25')][_0x9a5c('0x13')]);_0x5ca745[_0x9a5c('0x17')]=_[_0x9a5c('0x2e')](_0x2f6302[_0x9a5c('0x17')]);_0x5ca745[_0x9a5c('0x18')]=_[_0x9a5c('0x19')](_0x5ca745[_0x9a5c('0x16')],_0x5ca745[_0x9a5c('0x17')]);_0x55d06b[_0x9a5c('0x1a')]=_['intersection'](_0x5ca745[_0x9a5c('0x16')],qs[_0x9a5c('0x1b')](_0x2f6302[_0x9a5c('0x17')][_0x9a5c('0x1b')]));_0x55d06b['attributes']=_0x55d06b[_0x9a5c('0x1a')][_0x9a5c('0x1c')]?_0x55d06b['attributes']:_0x5ca745[_0x9a5c('0x16')];if(_0x2f6302[_0x9a5c('0x17')][_0x9a5c('0x27')]){_0x55d06b[_0x9a5c('0x28')]=[{'all':!![]}];}_0x55d06b=_[_0x9a5c('0x22')]({},_0x55d06b,_0x2f6302[_0x9a5c('0x2f')]);return db[_0x9a5c('0x25')][_0x9a5c('0x30')](_0x55d06b)[_0x9a5c('0xc')](handleEntityNotFound(_0xac97e4,null))[_0x9a5c('0xc')](respondWithResult(_0xac97e4,null))['catch'](handleError(_0xac97e4,null));};exports['create']=function(_0x13e866,_0x3456a7){return db[_0x9a5c('0x25')][_0x9a5c('0x31')](_0x13e866[_0x9a5c('0x32')],{})[_0x9a5c('0xc')](respondWithResult(_0x3456a7,0xc9))[_0x9a5c('0x2c')](handleError(_0x3456a7,null));};exports[_0x9a5c('0xd')]=function(_0x28775c,_0x38c031){return db[_0x9a5c('0x25')][_0x9a5c('0x30')]({'where':{'id':_0x28775c['params']['id']}})['then'](handleEntityNotFound(_0x38c031,null))[_0x9a5c('0xc')](removeEntity(_0x38c031,null))[_0x9a5c('0x2c')](handleError(_0x38c031,null));};exports['describe']=function(_0x5bb590,_0x311524){return db['VoiceCallReport']['describe']()['then'](respondWithResult(_0x311524,null))[_0x9a5c('0x2c')](handleError(_0x311524,null));};function findForUpdate(_0x53b8ad){return db[_0x9a5c('0x25')][_0x9a5c('0x30')]({'where':{'uniqueid':_0x53b8ad['params']['id'],'UserId':{'$or':[null,_0x53b8ad[_0x9a5c('0x33')]['id']]}}});}exports[_0x9a5c('0xb')]=function(_0x56ede0,_0x3f434e){if(_0x56ede0[_0x9a5c('0x32')]['uniqueid']){delete _0x56ede0['body'][_0x9a5c('0x34')];}return findForUpdate(_0x56ede0)[_0x9a5c('0xc')](handleEntityNotFound(_0x3f434e,null))[_0x9a5c('0xc')](saveUpdates(_0x56ede0['body'],null))[_0x9a5c('0xc')](respondWithResult(_0x3f434e,null))[_0x9a5c('0x2c')](handleError(_0x3f434e,null));};exports[_0x9a5c('0x35')]=function(_0x3f19c1,_0x49bc11,_0x46fb24){if(_0x3f19c1[_0x9a5c('0x32')]['uniqueid']){delete _0x3f19c1[_0x9a5c('0x32')][_0x9a5c('0x34')];}promiseRetry(function(_0x2831dc){return findForUpdate(_0x3f19c1)[_0x9a5c('0xc')](function(_0xab882b){if(_0xab882b!==null){return _0xab882b;}else{_0x2831dc(new Error(_0x9a5c('0x36')));}});},{'retries':0x4,'minTimeout':0xfa})[_0x9a5c('0xc')](function(_0x5e0297){if(!_0x5e0297){return new Promise(function(_0x2782c4){_0x2782c4(handleEntityNotFound(_0x49bc11)());});}else{return _0x5e0297['update'](_0x3f19c1[_0x9a5c('0x32')])['then'](function(_0x45a394){return respondWithResult(_0x49bc11)(_0x45a394);});}},function(){handleEntityNotFound(_0x49bc11)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 60689c6..8a79e11 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 _0xa35d=['moment','bluebird','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','report_call','uniqueid','lodash','util','../../config/logger','api'];(function(_0x29394e,_0x1968b1){var _0x832bb5=function(_0x3a1a24){while(--_0x3a1a24){_0x29394e['push'](_0x29394e['shift']());}};_0x832bb5(++_0x1968b1);}(_0xa35d,0x1d8));var _0xda35=function(_0x10319c,_0x511e1d){_0x10319c=_0x10319c-0x0;var _0x4a808b=_0xa35d[_0x10319c];return _0x4a808b;};'use strict';var _=require(_0xda35('0x0'));var util=require(_0xda35('0x1'));var logger=require(_0xda35('0x2'))(_0xda35('0x3'));var moment=require(_0xda35('0x4'));var BPromise=require(_0xda35('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda35('0x6'));var rimraf=require(_0xda35('0x7'));var config=require(_0xda35('0x8'));var attributes=require(_0xda35('0x9'));module[_0xda35('0xa')]=function(_0x1cea75,_0x12e76d){return _0x1cea75[_0xda35('0xb')]('VoiceCallReport',attributes,{'tableName':_0xda35('0xc'),'paranoid':![],'indexes':[{'fields':[_0xda35('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1225=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash'];(function(_0x50457c,_0x581fae){var _0x4fceb7=function(_0x5174bb){while(--_0x5174bb){_0x50457c['push'](_0x50457c['shift']());}};_0x4fceb7(++_0x581fae);}(_0x1225,0x77));var _0x5122=function(_0x256522,_0x4b29a3){_0x256522=_0x256522-0x0;var _0x5f40b6=_0x1225[_0x256522];return _0x5f40b6;};'use strict';var _=require(_0x5122('0x0'));var util=require(_0x5122('0x1'));var logger=require(_0x5122('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5122('0x3'));var rp=require(_0x5122('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5122('0x5'));var config=require(_0x5122('0x6'));var attributes=require(_0x5122('0x7'));module[_0x5122('0x8')]=function(_0x18b8b9,_0x226365){return _0x18b8b9[_0x5122('0x9')](_0x5122('0xa'),attributes,{'tableName':_0x5122('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 630ed59..06d101f 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 _0xbf87=['stringify','error','code','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','options','where','attributes','include','map','model','debug','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent'];(function(_0x775a6a,_0x43acfa){var _0xf86c1e=function(_0x17786c){while(--_0x17786c){_0x775a6a['push'](_0x775a6a['shift']());}};_0xf86c1e(++_0x43acfa);}(_0xbf87,0x1c3));var _0x7bf8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbf87[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x7bf8('0x0'));var moment=require(_0x7bf8('0x1'));var BPromise=require(_0x7bf8('0x2'));var rs=require(_0x7bf8('0x3'));var fs=require('fs');var Redis=require(_0x7bf8('0x4'));var db=require(_0x7bf8('0x5'))['db'];var utils=require(_0x7bf8('0x6'));var logger=require(_0x7bf8('0x7'))(_0x7bf8('0x8'));var config=require(_0x7bf8('0x9'));var jayson=require(_0x7bf8('0xa'));var client=jayson[_0x7bf8('0xb')][_0x7bf8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x979962,_0x31a9f6,_0x52da15){return new BPromise(function(_0x27efcb,_0x51014f){return client[_0x7bf8('0xd')](_0x979962,_0x52da15)[_0x7bf8('0xe')](function(_0x3d15e0){logger['info'](_0x7bf8('0xf'),_0x31a9f6,'request\x20sent');logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x31a9f6,_0x7bf8('0x10'),JSON[_0x7bf8('0x11')](_0x3d15e0));if(_0x3d15e0[_0x7bf8('0x12')]){if(_0x3d15e0['error'][_0x7bf8('0x13')]===0x1f4){logger[_0x7bf8('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x31a9f6,_0x3d15e0[_0x7bf8('0x12')][_0x7bf8('0x14')]);return _0x51014f(_0x3d15e0[_0x7bf8('0x12')][_0x7bf8('0x14')]);}logger[_0x7bf8('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x31a9f6,_0x3d15e0[_0x7bf8('0x12')][_0x7bf8('0x14')]);return _0x27efcb(_0x3d15e0[_0x7bf8('0x12')]['message']);}else{logger[_0x7bf8('0x15')](_0x7bf8('0xf'),_0x31a9f6,_0x7bf8('0x10'));_0x27efcb(_0x3d15e0[_0x7bf8('0x16')][_0x7bf8('0x14')]);}})[_0x7bf8('0x17')](function(_0x1e5064){logger[_0x7bf8('0x12')](_0x7bf8('0xf'),_0x31a9f6,_0x1e5064);_0x51014f(_0x1e5064);});});}exports[_0x7bf8('0x18')]=function(_0x379b49){var _0x310501=this;return new Promise(function(_0x3b854b,_0x31b584){return db[_0x7bf8('0x19')]['findAll']({'raw':_0x379b49[_0x7bf8('0x1a')]?_0x379b49[_0x7bf8('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x379b49[_0x7bf8('0x1a')]?_0x379b49[_0x7bf8('0x1a')][_0x7bf8('0x1b')]||null:null,'attributes':_0x379b49[_0x7bf8('0x1a')]?_0x379b49[_0x7bf8('0x1a')][_0x7bf8('0x1c')]||null:null,'limit':_0x379b49[_0x7bf8('0x1a')]?_0x379b49['options']['limit']||null:null,'include':_0x379b49[_0x7bf8('0x1a')]?_0x379b49[_0x7bf8('0x1a')][_0x7bf8('0x1d')]?_[_0x7bf8('0x1e')](_0x379b49[_0x7bf8('0x1a')]['include'],function(_0x28a9ed){return{'model':db[_0x28a9ed[_0x7bf8('0x1f')]],'as':_0x28a9ed['as'],'attributes':_0x28a9ed[_0x7bf8('0x1c')],'include':_0x28a9ed[_0x7bf8('0x1d')]?_[_0x7bf8('0x1e')](_0x28a9ed[_0x7bf8('0x1d')],function(_0x464aba){return{'model':db[_0x464aba[_0x7bf8('0x1f')]],'as':_0x464aba['as'],'attributes':_0x464aba['attributes'],'include':_0x464aba[_0x7bf8('0x1d')]?_[_0x7bf8('0x1e')](_0x464aba['include'],function(_0x4e33fd){return{'model':db[_0x4e33fd[_0x7bf8('0x1f')]],'as':_0x4e33fd['as'],'attributes':_0x4e33fd['attributes']};}):[]};}):[]};}):[]:[]})[_0x7bf8('0xe')](function(_0xdfbdd0){logger[_0x7bf8('0x15')](_0x7bf8('0x18'),_0x379b49);logger[_0x7bf8('0x20')](_0x7bf8('0x18'),_0x379b49,JSON[_0x7bf8('0x11')](_0xdfbdd0));_0x3b854b(_0xdfbdd0);})[_0x7bf8('0x17')](function(_0x21cb3c){logger[_0x7bf8('0x12')](_0x7bf8('0x18'),_0x21cb3c[_0x7bf8('0x14')],_0x379b49);_0x31b584(_0x310501['error'](0x1f4,_0x21cb3c[_0x7bf8('0x14')]));});});};exports[_0x7bf8('0x21')]=function(_0x3027de){var _0x2d78d0=this;return new Promise(function(_0x20a62b,_0x99042a){return db['VoiceCallReport'][_0x7bf8('0x22')](_0x3027de[_0x7bf8('0x23')],{'raw':_0x3027de[_0x7bf8('0x1a')]?_0x3027de[_0x7bf8('0x1a')][_0x7bf8('0x24')]===undefined?!![]:![]:!![]})['then'](function(_0x348210){logger[_0x7bf8('0x15')](_0x7bf8('0x21'),_0x3027de);logger['debug'](_0x7bf8('0x21'),_0x3027de,JSON['stringify'](_0x348210));_0x20a62b(_0x348210);})[_0x7bf8('0x17')](function(_0x5d69dd){logger['error']('CreateVoiceCallReport',_0x5d69dd[_0x7bf8('0x14')],_0x3027de);_0x99042a(_0x2d78d0[_0x7bf8('0x12')](0x1f4,_0x5d69dd[_0x7bf8('0x14')]));});});};exports[_0x7bf8('0x25')]=function(_0x3f8dba){var _0x5d11aa=this;return new Promise(function(_0x3ddc62,_0x3419c7){return db[_0x7bf8('0x19')]['update'](_0x3f8dba[_0x7bf8('0x23')],{'raw':_0x3f8dba[_0x7bf8('0x1a')]?_0x3f8dba[_0x7bf8('0x1a')][_0x7bf8('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f8dba[_0x7bf8('0x1a')]?_0x3f8dba['options'][_0x7bf8('0x1b')]||null:null,'attributes':_0x3f8dba[_0x7bf8('0x1a')]?_0x3f8dba[_0x7bf8('0x1a')][_0x7bf8('0x1c')]||null:null,'limit':_0x3f8dba[_0x7bf8('0x1a')]?_0x3f8dba['options'][_0x7bf8('0x26')]||null:null})[_0x7bf8('0xe')](function(_0x19b916){logger[_0x7bf8('0x15')](_0x7bf8('0x25'),_0x3f8dba);logger['debug'](_0x7bf8('0x25'),_0x3f8dba,JSON[_0x7bf8('0x11')](_0x19b916));_0x3ddc62(_0x19b916);})[_0x7bf8('0x17')](function(_0x47223f){logger[_0x7bf8('0x12')](_0x7bf8('0x25'),_0x47223f['message'],_0x3f8dba);_0x3419c7(_0x5d11aa[_0x7bf8('0x12')](0x1f4,_0x47223f['message']));});});}; \ No newline at end of file +var _0xdef8=['VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','info','stringify','CreateVoiceCallReport','create','UpdateVoiceCallReport','update','body','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdef8,0xcf));var _0x8def=function(_0x4dd1db,_0x55ebfd){_0x4dd1db=_0x4dd1db-0x0;var _0x4654bb=_0xdef8[_0x4dd1db];return _0x4654bb;};'use strict';var _=require(_0x8def('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8def('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8def('0x2'));var db=require(_0x8def('0x3'))['db'];var utils=require(_0x8def('0x4'));var logger=require(_0x8def('0x5'))(_0x8def('0x6'));var config=require(_0x8def('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x194fc8,_0x1cd046,_0x4c17db){return new BPromise(function(_0x4a5e95,_0x1e015f){return client['request'](_0x194fc8,_0x4c17db)[_0x8def('0x8')](function(_0xcdb1af){logger['info'](_0x8def('0x9'),_0x1cd046,_0x8def('0xa'));logger[_0x8def('0xb')](_0x8def('0xc'),_0x1cd046,_0x8def('0xa'),JSON['stringify'](_0xcdb1af));if(_0xcdb1af[_0x8def('0xd')]){if(_0xcdb1af[_0x8def('0xd')][_0x8def('0xe')]===0x1f4){logger[_0x8def('0xd')](_0x8def('0x9'),_0x1cd046,_0xcdb1af['error'][_0x8def('0xf')]);return _0x1e015f(_0xcdb1af[_0x8def('0xd')]['message']);}logger[_0x8def('0xd')](_0x8def('0x9'),_0x1cd046,_0xcdb1af[_0x8def('0xd')]['message']);return _0x4a5e95(_0xcdb1af['error'][_0x8def('0xf')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x1cd046,_0x8def('0xa'));_0x4a5e95(_0xcdb1af[_0x8def('0x10')][_0x8def('0xf')]);}})[_0x8def('0x11')](function(_0x150599){logger[_0x8def('0xd')](_0x8def('0x9'),_0x1cd046,_0x150599);_0x1e015f(_0x150599);});});}exports[_0x8def('0x12')]=function(_0x340f1e){var _0x5a0557=this;return new Promise(function(_0x1021aa,_0x425a85){return db[_0x8def('0x13')][_0x8def('0x14')]({'raw':_0x340f1e[_0x8def('0x15')]?_0x340f1e[_0x8def('0x15')][_0x8def('0x16')]===undefined?!![]:![]:!![],'where':_0x340f1e[_0x8def('0x15')]?_0x340f1e[_0x8def('0x15')][_0x8def('0x17')]||null:null,'attributes':_0x340f1e[_0x8def('0x15')]?_0x340f1e[_0x8def('0x15')][_0x8def('0x18')]||null:null,'limit':_0x340f1e[_0x8def('0x15')]?_0x340f1e[_0x8def('0x15')][_0x8def('0x19')]||null:null,'include':_0x340f1e[_0x8def('0x15')]?_0x340f1e[_0x8def('0x15')][_0x8def('0x1a')]?_[_0x8def('0x1b')](_0x340f1e[_0x8def('0x15')][_0x8def('0x1a')],function(_0x1e893f){return{'model':db[_0x1e893f['model']],'as':_0x1e893f['as'],'attributes':_0x1e893f['attributes'],'include':_0x1e893f[_0x8def('0x1a')]?_[_0x8def('0x1b')](_0x1e893f[_0x8def('0x1a')],function(_0x2e7e7e){return{'model':db[_0x2e7e7e[_0x8def('0x1c')]],'as':_0x2e7e7e['as'],'attributes':_0x2e7e7e[_0x8def('0x18')],'include':_0x2e7e7e[_0x8def('0x1a')]?_[_0x8def('0x1b')](_0x2e7e7e[_0x8def('0x1a')],function(_0x2b92f1){return{'model':db[_0x2b92f1['model']],'as':_0x2b92f1['as'],'attributes':_0x2b92f1[_0x8def('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52ab96){logger[_0x8def('0x1d')]('GetVoiceCallReport',_0x340f1e);logger['debug'](_0x8def('0x12'),_0x340f1e,JSON[_0x8def('0x1e')](_0x52ab96));_0x1021aa(_0x52ab96);})[_0x8def('0x11')](function(_0x1b009a){logger['error'](_0x8def('0x12'),_0x1b009a[_0x8def('0xf')],_0x340f1e);_0x425a85(_0x5a0557[_0x8def('0xd')](0x1f4,_0x1b009a['message']));});});};exports[_0x8def('0x1f')]=function(_0x57a812){var _0x5f0c35=this;return new Promise(function(_0x307a65,_0x26b622){return db[_0x8def('0x13')][_0x8def('0x20')](_0x57a812['body'],{'raw':_0x57a812['options']?_0x57a812[_0x8def('0x15')][_0x8def('0x16')]===undefined?!![]:![]:!![]})[_0x8def('0x8')](function(_0x422729){logger[_0x8def('0x1d')](_0x8def('0x1f'),_0x57a812);logger[_0x8def('0xb')](_0x8def('0x1f'),_0x57a812,JSON[_0x8def('0x1e')](_0x422729));_0x307a65(_0x422729);})[_0x8def('0x11')](function(_0x3c567a){logger[_0x8def('0xd')](_0x8def('0x1f'),_0x3c567a['message'],_0x57a812);_0x26b622(_0x5f0c35[_0x8def('0xd')](0x1f4,_0x3c567a[_0x8def('0xf')]));});});};exports[_0x8def('0x21')]=function(_0x3a20c4){var _0x16eeea=this;return new Promise(function(_0x2c2ce6,_0x3d83fd){return db[_0x8def('0x13')][_0x8def('0x22')](_0x3a20c4[_0x8def('0x23')],{'raw':_0x3a20c4[_0x8def('0x15')]?_0x3a20c4[_0x8def('0x15')][_0x8def('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a20c4[_0x8def('0x15')]?_0x3a20c4['options']['where']||null:null,'attributes':_0x3a20c4[_0x8def('0x15')]?_0x3a20c4[_0x8def('0x15')][_0x8def('0x18')]||null:null,'limit':_0x3a20c4[_0x8def('0x15')]?_0x3a20c4['options']['limit']||null:null})[_0x8def('0x8')](function(_0xc77667){logger[_0x8def('0x1d')]('UpdateVoiceCallReport',_0x3a20c4);logger[_0x8def('0xb')](_0x8def('0x21'),_0x3a20c4,JSON[_0x8def('0x1e')](_0xc77667));_0x2c2ce6(_0xc77667);})[_0x8def('0x11')](function(_0xc9b051){logger[_0x8def('0xd')](_0x8def('0x21'),_0xc9b051[_0x8def('0xf')],_0x3a20c4);_0x3d83fd(_0x16eeea[_0x8def('0xd')](0x1f4,_0xc9b051[_0x8def('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index e4d4e75..ae4d1eb 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 _0x4141=['multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','show','create','delete','destroy','exports'];(function(_0x2c80f2,_0x3ea39b){var _0x331ecc=function(_0x11adbf){while(--_0x11adbf){_0x2c80f2['push'](_0x2c80f2['shift']());}};_0x331ecc(++_0x3ea39b);}(_0x4141,0x150));var _0x1414=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4141[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x1414('0x0'));var util=require(_0x1414('0x1'));var path=require('path');var timeout=require(_0x1414('0x2'));var express=require(_0x1414('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1414('0x4'));var interaction=require(_0x1414('0x5'));var config=require('../../config/environment');var controller=require(_0x1414('0x6'));router['get']('/',auth[_0x1414('0x7')](),controller[_0x1414('0x8')]);router[_0x1414('0x9')](_0x1414('0xa'),auth[_0x1414('0x7')](),controller[_0x1414('0xb')]);router['post']('/',auth[_0x1414('0x7')](),controller[_0x1414('0xc')]);router['put'](_0x1414('0xa'),auth[_0x1414('0x7')](),controller['update']);router[_0x1414('0xd')](_0x1414('0xa'),auth[_0x1414('0x7')](),controller[_0x1414('0xe')]);module[_0x1414('0xf')]=router; \ No newline at end of file +var _0x1e3f=['Router','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','show','post','create','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express'];(function(_0x41fb9c,_0x8d6ffc){var _0x8c53ed=function(_0x4d7c50){while(--_0x4d7c50){_0x41fb9c['push'](_0x41fb9c['shift']());}};_0x8c53ed(++_0x8d6ffc);}(_0x1e3f,0x10a));var _0xf1e3=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0x1e3f[_0xccf869];return _0x21a9db;};'use strict';var multer=require(_0xf1e3('0x0'));var util=require(_0xf1e3('0x1'));var path=require('path');var timeout=require(_0xf1e3('0x2'));var express=require(_0xf1e3('0x3'));var router=express[_0xf1e3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf1e3('0x5'));var interaction=require(_0xf1e3('0x6'));var config=require('../../config/environment');var controller=require(_0xf1e3('0x7'));router[_0xf1e3('0x8')]('/',auth[_0xf1e3('0x9')](),controller['index']);router[_0xf1e3('0x8')]('/:id',auth[_0xf1e3('0x9')](),controller[_0xf1e3('0xa')]);router[_0xf1e3('0xb')]('/',auth[_0xf1e3('0x9')](),controller[_0xf1e3('0xc')]);router['put']('/:id',auth[_0xf1e3('0x9')](),controller[_0xf1e3('0xd')]);router[_0xf1e3('0xe')](_0xf1e3('0xf'),auth['isAuthenticated'](),controller[_0xf1e3('0x10')]);module[_0xf1e3('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 b52ba81..c8d3621 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 _0xacdd=['options','join','getDataValue','split','BOOLEAN','sequelize','STRING','setDataValue'];(function(_0x30bd66,_0x36a93d){var _0x74c9dd=function(_0x2cd660){while(--_0x2cd660){_0x30bd66['push'](_0x30bd66['shift']());}};_0x74c9dd(++_0x36a93d);}(_0xacdd,0x10d));var _0xdacd=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xacdd[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0xdacd('0x0'));module['exports']={'name':{'type':Sequelize[_0xdacd('0x1')]},'prefix':{'type':Sequelize[_0xdacd('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x19cce6){this[_0xdacd('0x2')](_0xdacd('0x3'),_0x19cce6?_0x19cce6[_0xdacd('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0xdacd('0x3'))?this[_0xdacd('0x5')](_0xdacd('0x3'))[_0xdacd('0x6')](''):[];}},'auth':{'type':Sequelize[_0xdacd('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xdacd('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xdacd('0x1')]},'description':{'type':Sequelize[_0xdacd('0x1')]}}; \ No newline at end of file +var _0x7133=['getDataValue','split','BOOLEAN','STRING','name','options','join'];(function(_0x4b12a6,_0x30c27b){var _0x54b426=function(_0x28ae18){while(--_0x28ae18){_0x4b12a6['push'](_0x4b12a6['shift']());}};_0x54b426(++_0x30c27b);}(_0x7133,0x1a7));var _0x3713=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x7133[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3713('0x0')]},'prefix':{'type':Sequelize[_0x3713('0x0')],'unique':_0x3713('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0x3713('0x0')],'set':function(_0x3ccc3a){this['setDataValue'](_0x3713('0x2'),_0x3ccc3a?_0x3ccc3a[_0x3713('0x3')](''):[]);},'get':function(){return this[_0x3713('0x4')](_0x3713('0x2'))?this['getDataValue'](_0x3713('0x2'))[_0x3713('0x5')](''):[];}},'auth':{'type':Sequelize[_0x3713('0x6')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x3713('0x0')]},'description':{'type':Sequelize[_0x3713('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index dfb9a16..a70a0cb 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 _0x0269=['to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','get','ChanSpies','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','type','includeAll','include','show','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','zip-dir','request-promise','bluebird','mustache','util','path'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x0269,0x135));var _0x9026=function(_0x2f19b6,_0x1b09f4){_0x2f19b6=_0x2f19b6-0x0;var _0x289ef7=_0x0269[_0x2f19b6];return _0x289ef7;};'use strict';var emlformat=require(_0x9026('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9026('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9026('0x2'));var moment=require('moment');var BPromise=require(_0x9026('0x3'));var Mustache=require(_0x9026('0x4'));var util=require(_0x9026('0x5'));var path=require(_0x9026('0x6'));var sox=require('sox');var csv=require(_0x9026('0x7'));var ejs=require(_0x9026('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9026('0x9'));var crypto=require(_0x9026('0xa'));var jsforce=require(_0x9026('0xb'));var deskjs=require(_0x9026('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9026('0xd'));var Papa=require(_0x9026('0xe'));var Redis=require(_0x9026('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9026('0x10'));var as=require(_0x9026('0x11'));var hardwareService=require(_0x9026('0x12'));var logger=require('../../config/logger')(_0x9026('0x13'));var utils=require('../../config/utils');var config=require(_0x9026('0x14'));var licenseUtil=require(_0x9026('0x15'));var db=require(_0x9026('0x16'))['db'];function respondWithStatusCode(_0x2148f0,_0x40f526){_0x40f526=_0x40f526||0xcc;return function(_0x40b5dd){if(_0x40b5dd){return _0x2148f0[_0x9026('0x17')](_0x40f526);}return _0x2148f0['status'](_0x40f526)[_0x9026('0x18')]();};}function respondWithResult(_0x4ee699,_0x385afc){_0x385afc=_0x385afc||0xc8;return function(_0x2612cd){if(_0x2612cd){return _0x4ee699[_0x9026('0x19')](_0x385afc)[_0x9026('0x1a')](_0x2612cd);}};}function respondWithFilteredResult(_0x11c0d1,_0x421ee2){return function(_0x142465){if(_0x142465){var _0x1eb679=typeof _0x421ee2['offset']===_0x9026('0x1b')&&typeof _0x421ee2[_0x9026('0x1c')]==='undefined';var _0xc68011=_0x142465[_0x9026('0x1d')];var _0x15b3ab=_0x1eb679?0x0:_0x421ee2[_0x9026('0x1e')];var _0x1d1613=_0x1eb679?_0x142465[_0x9026('0x1d')]:_0x421ee2[_0x9026('0x1e')]+_0x421ee2[_0x9026('0x1c')];var _0x52edf1;if(_0x1d1613>=_0xc68011){_0x1d1613=_0xc68011;_0x52edf1=0xc8;}else{_0x52edf1=0xce;}_0x11c0d1[_0x9026('0x19')](_0x52edf1);return _0x11c0d1['set'](_0x9026('0x1f'),_0x15b3ab+'-'+_0x1d1613+'/'+_0xc68011)['json'](_0x142465);}return null;};}function patchUpdates(_0x2a9bf0){return function(_0x1b03af){try{jsonpatch[_0x9026('0x20')](_0x1b03af,_0x2a9bf0,!![]);}catch(_0x22a77c){return BPromise[_0x9026('0x21')](_0x22a77c);}return _0x1b03af[_0x9026('0x22')]();};}function saveUpdates(_0x71a263,_0x39f515){return function(_0x12e0b3){if(_0x12e0b3){return _0x12e0b3['update'](_0x71a263)['then'](function(_0x7b962){return _0x7b962;});}return null;};}function removeEntity(_0x134221,_0x2968fb){return function(_0x82a8e0){if(_0x82a8e0){return _0x82a8e0[_0x9026('0x23')]()[_0x9026('0x24')](function(){var _0x1c8c62=_0x82a8e0[_0x9026('0x25')]({'plain':!![]});var _0x775596=_0x9026('0x26');return db[_0x9026('0x27')][_0x9026('0x23')]({'where':{'type':_0x775596,'resourceId':_0x1c8c62['id']}})[_0x9026('0x24')](function(){return _0x82a8e0;});})[_0x9026('0x24')](function(){_0x134221[_0x9026('0x19')](0xcc)[_0x9026('0x18')]();});}};}function handleEntityNotFound(_0x1f431b,_0x9c5f39){return function(_0x2fae98){if(!_0x2fae98){_0x1f431b['sendStatus'](0x194);}return _0x2fae98;};}function handleError(_0x437f7b,_0x341d4d){_0x341d4d=_0x341d4d||0x1f4;return function(_0x30c988){logger[_0x9026('0x28')](_0x30c988[_0x9026('0x29')]);if(_0x30c988[_0x9026('0x2a')]){delete _0x30c988[_0x9026('0x2a')];}_0x437f7b[_0x9026('0x19')](_0x341d4d)[_0x9026('0x2b')](_0x30c988);};}exports[_0x9026('0x2c')]=function(_0x24fa55,_0x5d2672){var _0x1cf21f={},_0x36d6b1={},_0x3b5bfd={'count':0x0,'rows':[]};var _0x38c383=_[_0x9026('0x2d')](db[_0x9026('0x2e')][_0x9026('0x2f')],function(_0x57baf9){return{'name':_0x57baf9[_0x9026('0x30')],'type':_0x57baf9['type'][_0x9026('0x31')]};});_0x36d6b1[_0x9026('0x32')]=_[_0x9026('0x2d')](_0x38c383,_0x9026('0x2a'));_0x36d6b1[_0x9026('0x33')]=_[_0x9026('0x34')](_0x24fa55['query']);_0x36d6b1[_0x9026('0x35')]=_[_0x9026('0x36')](_0x36d6b1[_0x9026('0x32')],_0x36d6b1[_0x9026('0x33')]);_0x1cf21f['attributes']=_[_0x9026('0x36')](_0x36d6b1[_0x9026('0x32')],qs['fields'](_0x24fa55[_0x9026('0x33')][_0x9026('0x37')]));_0x1cf21f[_0x9026('0x38')]=_0x1cf21f[_0x9026('0x38')][_0x9026('0x39')]?_0x1cf21f[_0x9026('0x38')]:_0x36d6b1[_0x9026('0x32')];if(!_0x24fa55[_0x9026('0x33')]['hasOwnProperty'](_0x9026('0x3a'))){_0x1cf21f[_0x9026('0x1c')]=qs['limit'](_0x24fa55[_0x9026('0x33')][_0x9026('0x1c')]);_0x1cf21f[_0x9026('0x1e')]=qs[_0x9026('0x1e')](_0x24fa55[_0x9026('0x33')][_0x9026('0x1e')]);}_0x1cf21f[_0x9026('0x3b')]=qs[_0x9026('0x3c')](_0x24fa55['query'][_0x9026('0x3c')]);_0x1cf21f[_0x9026('0x3d')]=qs[_0x9026('0x35')](_[_0x9026('0x3e')](_0x24fa55[_0x9026('0x33')],_0x36d6b1[_0x9026('0x35')]),_0x38c383);if(_0x24fa55[_0x9026('0x33')]['filter']){_0x1cf21f[_0x9026('0x3d')]=_['merge'](_0x1cf21f[_0x9026('0x3d')],{'$or':_[_0x9026('0x2d')](_0x38c383,function(_0x3632c3){if(_0x3632c3[_0x9026('0x3f')]!=='VIRTUAL'){var _0x58cce0={};_0x58cce0[_0x3632c3[_0x9026('0x2a')]]={'$like':'%'+_0x24fa55[_0x9026('0x33')]['filter']+'%'};return _0x58cce0;}})});}_0x1cf21f=_['merge']({},_0x1cf21f,_0x24fa55['options']);var _0x18272e={'where':_0x1cf21f[_0x9026('0x3d')]};return db['VoiceChanSpy'][_0x9026('0x1d')](_0x18272e)[_0x9026('0x24')](function(_0x1a77bd){_0x3b5bfd[_0x9026('0x1d')]=_0x1a77bd;if(_0x24fa55[_0x9026('0x33')][_0x9026('0x40')]){_0x1cf21f[_0x9026('0x41')]=[{'all':!![]}];}return db[_0x9026('0x2e')]['findAll'](_0x1cf21f);})[_0x9026('0x24')](function(_0x2ece36){_0x3b5bfd['rows']=_0x2ece36;return _0x3b5bfd;})['then'](respondWithFilteredResult(_0x5d2672,_0x1cf21f))['catch'](handleError(_0x5d2672,null));};exports[_0x9026('0x42')]=function(_0x126046,_0x12ea01){var _0xc90e8b={'raw':![],'where':{'id':_0x126046['params']['id']}},_0xa3f7fe={};_0xa3f7fe[_0x9026('0x32')]=_['keys'](db[_0x9026('0x2e')][_0x9026('0x2f')]);_0xa3f7fe[_0x9026('0x33')]=_[_0x9026('0x34')](_0x126046['query']);_0xa3f7fe['filters']=_[_0x9026('0x36')](_0xa3f7fe[_0x9026('0x32')],_0xa3f7fe[_0x9026('0x33')]);_0xc90e8b[_0x9026('0x38')]=_[_0x9026('0x36')](_0xa3f7fe[_0x9026('0x32')],qs['fields'](_0x126046[_0x9026('0x33')]['fields']));_0xc90e8b[_0x9026('0x38')]=_0xc90e8b[_0x9026('0x38')]['length']?_0xc90e8b[_0x9026('0x38')]:_0xa3f7fe['model'];if(_0x126046[_0x9026('0x33')]['includeAll']){_0xc90e8b[_0x9026('0x41')]=[{'all':!![]}];}_0xc90e8b=_['merge']({},_0xc90e8b,_0x126046['options']);return db[_0x9026('0x2e')][_0x9026('0x43')](_0xc90e8b)[_0x9026('0x24')](handleEntityNotFound(_0x12ea01,null))['then'](respondWithResult(_0x12ea01,null))[_0x9026('0x44')](handleError(_0x12ea01,null));};exports[_0x9026('0x45')]=function(_0x446cd0,_0x442e5a){return db[_0x9026('0x2e')]['create'](_0x446cd0[_0x9026('0x46')],{})[_0x9026('0x24')](function(_0x24c3b1){var _0x19d870=_0x446cd0[_0x9026('0x47')][_0x9026('0x25')]({'plain':!![]});if(!_0x19d870)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19d870[_0x9026('0x48')]==='user'){var _0x2e3025=_0x24c3b1[_0x9026('0x25')]({'plain':!![]});var _0x50d424=_0x9026('0x26');return db[_0x9026('0x49')][_0x9026('0x43')]({'where':{'name':_0x50d424,'userProfileId':_0x19d870[_0x9026('0x4a')]},'raw':!![]})[_0x9026('0x24')](function(_0x271e95){if(_0x271e95&&_0x271e95[_0x9026('0x4b')]===0x0){return db[_0x9026('0x27')][_0x9026('0x45')]({'name':_0x2e3025[_0x9026('0x2a')],'resourceId':_0x2e3025['id'],'type':_0x271e95['name'],'sectionId':_0x271e95['id']},{})[_0x9026('0x24')](function(){return _0x24c3b1;});}else{return _0x24c3b1;}})[_0x9026('0x44')](function(_0x4ad73e){logger[_0x9026('0x28')](_0x9026('0x4c'),_0x4ad73e);throw _0x4ad73e;});}return _0x24c3b1;})[_0x9026('0x24')](respondWithResult(_0x442e5a,0xc9))[_0x9026('0x44')](handleError(_0x442e5a,null));};exports[_0x9026('0x4d')]=function(_0x30591f,_0x5ddb50){if(_0x30591f[_0x9026('0x46')]['id']){delete _0x30591f['body']['id'];}return db[_0x9026('0x2e')][_0x9026('0x43')]({'where':{'id':_0x30591f[_0x9026('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5ddb50,null))['then'](saveUpdates(_0x30591f[_0x9026('0x46')],null))[_0x9026('0x24')](respondWithResult(_0x5ddb50,null))[_0x9026('0x44')](handleError(_0x5ddb50,null));};exports[_0x9026('0x23')]=function(_0x3a4a30,_0x401c11){return db[_0x9026('0x2e')][_0x9026('0x43')]({'where':{'id':_0x3a4a30[_0x9026('0x4e')]['id']}})[_0x9026('0x24')](handleEntityNotFound(_0x401c11,null))['then'](removeEntity(_0x401c11,null))['catch'](handleError(_0x401c11,null));}; \ No newline at end of file +var _0xbf6e=['moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../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','save','update','then','destroy','get','ChanSpies','error','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','keys','query','intersection','model','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','zip-dir','fast-json-patch','request-promise'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xbf6e,0x149));var _0xebf6=function(_0x4be7a0,_0xfb3d5b){_0x4be7a0=_0x4be7a0-0x0;var _0x55482b=_0xbf6e[_0x4be7a0];return _0x55482b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xebf6('0x0'));var jsonpatch=require(_0xebf6('0x1'));var rp=require(_0xebf6('0x2'));var moment=require(_0xebf6('0x3'));var BPromise=require(_0xebf6('0x4'));var Mustache=require(_0xebf6('0x5'));var util=require(_0xebf6('0x6'));var path=require('path');var sox=require(_0xebf6('0x7'));var csv=require(_0xebf6('0x8'));var ejs=require(_0xebf6('0x9'));var fs=require('fs');var fs_extra=require(_0xebf6('0xa'));var _=require(_0xebf6('0xb'));var squel=require(_0xebf6('0xc'));var crypto=require(_0xebf6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xebf6('0xe'));var toCsv=require(_0xebf6('0x8'));var querystring=require(_0xebf6('0xf'));var Papa=require('papaparse');var Redis=require(_0xebf6('0x10'));var authService=require(_0xebf6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xebf6('0x12'));var hardwareService=require(_0xebf6('0x13'));var logger=require(_0xebf6('0x14'))(_0xebf6('0x15'));var utils=require(_0xebf6('0x16'));var config=require(_0xebf6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xebf6('0x18'))['db'];function respondWithStatusCode(_0xedc361,_0x4919f1){_0x4919f1=_0x4919f1||0xcc;return function(_0x332ca0){if(_0x332ca0){return _0xedc361[_0xebf6('0x19')](_0x4919f1);}return _0xedc361[_0xebf6('0x1a')](_0x4919f1)[_0xebf6('0x1b')]();};}function respondWithResult(_0x3f69e6,_0x4dbf51){_0x4dbf51=_0x4dbf51||0xc8;return function(_0x4c01f4){if(_0x4c01f4){return _0x3f69e6['status'](_0x4dbf51)[_0xebf6('0x1c')](_0x4c01f4);}};}function respondWithFilteredResult(_0x1ae2f7,_0x50d80f){return function(_0x35570e){if(_0x35570e){var _0x2c980f=typeof _0x50d80f[_0xebf6('0x1d')]===_0xebf6('0x1e')&&typeof _0x50d80f[_0xebf6('0x1f')]===_0xebf6('0x1e');var _0x219621=_0x35570e[_0xebf6('0x20')];var _0x2d3984=_0x2c980f?0x0:_0x50d80f[_0xebf6('0x1d')];var _0x55fa31=_0x2c980f?_0x35570e['count']:_0x50d80f[_0xebf6('0x1d')]+_0x50d80f[_0xebf6('0x1f')];var _0x10051e;if(_0x55fa31>=_0x219621){_0x55fa31=_0x219621;_0x10051e=0xc8;}else{_0x10051e=0xce;}_0x1ae2f7[_0xebf6('0x1a')](_0x10051e);return _0x1ae2f7[_0xebf6('0x21')](_0xebf6('0x22'),_0x2d3984+'-'+_0x55fa31+'/'+_0x219621)[_0xebf6('0x1c')](_0x35570e);}return null;};}function patchUpdates(_0x80f523){return function(_0x4fb497){try{jsonpatch[_0xebf6('0x23')](_0x4fb497,_0x80f523,!![]);}catch(_0x81fdb3){return BPromise[_0xebf6('0x24')](_0x81fdb3);}return _0x4fb497[_0xebf6('0x25')]();};}function saveUpdates(_0x6303ac,_0x14c8ac){return function(_0x2f419e){if(_0x2f419e){return _0x2f419e[_0xebf6('0x26')](_0x6303ac)[_0xebf6('0x27')](function(_0x2e32c6){return _0x2e32c6;});}return null;};}function removeEntity(_0x232074,_0x2dd2ed){return function(_0x43c4e2){if(_0x43c4e2){return _0x43c4e2[_0xebf6('0x28')]()[_0xebf6('0x27')](function(){var _0x1d0078=_0x43c4e2[_0xebf6('0x29')]({'plain':!![]});var _0x1534b2=_0xebf6('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x1534b2,'resourceId':_0x1d0078['id']}})[_0xebf6('0x27')](function(){return _0x43c4e2;});})['then'](function(){_0x232074[_0xebf6('0x1a')](0xcc)[_0xebf6('0x1b')]();});}};}function handleEntityNotFound(_0x5a01ea,_0x4f39eb){return function(_0x37950c){if(!_0x37950c){_0x5a01ea[_0xebf6('0x19')](0x194);}return _0x37950c;};}function handleError(_0x3c3d5c,_0x7959c8){_0x7959c8=_0x7959c8||0x1f4;return function(_0xedaaeb){logger[_0xebf6('0x2b')](_0xedaaeb[_0xebf6('0x2c')]);if(_0xedaaeb[_0xebf6('0x2d')]){delete _0xedaaeb['name'];}_0x3c3d5c[_0xebf6('0x1a')](_0x7959c8)[_0xebf6('0x2e')](_0xedaaeb);};}exports['index']=function(_0x2fe3ee,_0x28bbea){var _0x5ea6b2={},_0x2901fc={},_0x1fa407={'count':0x0,'rows':[]};var _0x32afa3=_[_0xebf6('0x2f')](db[_0xebf6('0x30')][_0xebf6('0x31')],function(_0x4907d0){return{'name':_0x4907d0[_0xebf6('0x32')],'type':_0x4907d0[_0xebf6('0x33')]['key']};});_0x2901fc['model']=_[_0xebf6('0x2f')](_0x32afa3,_0xebf6('0x2d'));_0x2901fc['query']=_[_0xebf6('0x34')](_0x2fe3ee[_0xebf6('0x35')]);_0x2901fc['filters']=_[_0xebf6('0x36')](_0x2901fc[_0xebf6('0x37')],_0x2901fc[_0xebf6('0x35')]);_0x5ea6b2['attributes']=_[_0xebf6('0x36')](_0x2901fc[_0xebf6('0x37')],qs[_0xebf6('0x38')](_0x2fe3ee[_0xebf6('0x35')]['fields']));_0x5ea6b2['attributes']=_0x5ea6b2[_0xebf6('0x39')][_0xebf6('0x3a')]?_0x5ea6b2['attributes']:_0x2901fc[_0xebf6('0x37')];if(!_0x2fe3ee[_0xebf6('0x35')]['hasOwnProperty'](_0xebf6('0x3b'))){_0x5ea6b2[_0xebf6('0x1f')]=qs[_0xebf6('0x1f')](_0x2fe3ee[_0xebf6('0x35')][_0xebf6('0x1f')]);_0x5ea6b2['offset']=qs[_0xebf6('0x1d')](_0x2fe3ee['query'][_0xebf6('0x1d')]);}_0x5ea6b2['order']=qs[_0xebf6('0x3c')](_0x2fe3ee[_0xebf6('0x35')][_0xebf6('0x3c')]);_0x5ea6b2[_0xebf6('0x3d')]=qs[_0xebf6('0x3e')](_[_0xebf6('0x3f')](_0x2fe3ee['query'],_0x2901fc[_0xebf6('0x3e')]),_0x32afa3);if(_0x2fe3ee[_0xebf6('0x35')][_0xebf6('0x40')]){_0x5ea6b2[_0xebf6('0x3d')]=_[_0xebf6('0x41')](_0x5ea6b2[_0xebf6('0x3d')],{'$or':_['map'](_0x32afa3,function(_0xcbe240){if(_0xcbe240[_0xebf6('0x33')]!==_0xebf6('0x42')){var _0x111ff7={};_0x111ff7[_0xcbe240[_0xebf6('0x2d')]]={'$like':'%'+_0x2fe3ee[_0xebf6('0x35')]['filter']+'%'};return _0x111ff7;}})});}_0x5ea6b2=_['merge']({},_0x5ea6b2,_0x2fe3ee['options']);var _0xd4d5f4={'where':_0x5ea6b2[_0xebf6('0x3d')]};return db[_0xebf6('0x30')]['count'](_0xd4d5f4)[_0xebf6('0x27')](function(_0x1c3809){_0x1fa407[_0xebf6('0x20')]=_0x1c3809;if(_0x2fe3ee['query'][_0xebf6('0x43')]){_0x5ea6b2[_0xebf6('0x44')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xebf6('0x45')](_0x5ea6b2);})[_0xebf6('0x27')](function(_0x17c4af){_0x1fa407['rows']=_0x17c4af;return _0x1fa407;})[_0xebf6('0x27')](respondWithFilteredResult(_0x28bbea,_0x5ea6b2))['catch'](handleError(_0x28bbea,null));};exports['show']=function(_0x256552,_0x470f62){var _0x10ca29={'raw':![],'where':{'id':_0x256552['params']['id']}},_0x2ac140={};_0x2ac140[_0xebf6('0x37')]=_['keys'](db[_0xebf6('0x30')][_0xebf6('0x31')]);_0x2ac140[_0xebf6('0x35')]=_[_0xebf6('0x34')](_0x256552[_0xebf6('0x35')]);_0x2ac140['filters']=_['intersection'](_0x2ac140[_0xebf6('0x37')],_0x2ac140[_0xebf6('0x35')]);_0x10ca29[_0xebf6('0x39')]=_[_0xebf6('0x36')](_0x2ac140['model'],qs[_0xebf6('0x38')](_0x256552[_0xebf6('0x35')][_0xebf6('0x38')]));_0x10ca29[_0xebf6('0x39')]=_0x10ca29[_0xebf6('0x39')][_0xebf6('0x3a')]?_0x10ca29[_0xebf6('0x39')]:_0x2ac140['model'];if(_0x256552[_0xebf6('0x35')][_0xebf6('0x43')]){_0x10ca29[_0xebf6('0x44')]=[{'all':!![]}];}_0x10ca29=_[_0xebf6('0x41')]({},_0x10ca29,_0x256552[_0xebf6('0x46')]);return db[_0xebf6('0x30')][_0xebf6('0x47')](_0x10ca29)['then'](handleEntityNotFound(_0x470f62,null))[_0xebf6('0x27')](respondWithResult(_0x470f62,null))['catch'](handleError(_0x470f62,null));};exports[_0xebf6('0x48')]=function(_0x31d8ba,_0x5d84ac){return db[_0xebf6('0x30')]['create'](_0x31d8ba[_0xebf6('0x49')],{})[_0xebf6('0x27')](function(_0x186655){var _0x32c8b1=_0x31d8ba[_0xebf6('0x4a')]['get']({'plain':!![]});if(!_0x32c8b1)throw new Error(_0xebf6('0x4b'));if(_0x32c8b1[_0xebf6('0x4c')]==='user'){var _0x1f98fd=_0x186655[_0xebf6('0x29')]({'plain':!![]});var _0x1455c4=_0xebf6('0x2a');return db[_0xebf6('0x4d')]['find']({'where':{'name':_0x1455c4,'userProfileId':_0x32c8b1[_0xebf6('0x4e')]},'raw':!![]})[_0xebf6('0x27')](function(_0x212414){if(_0x212414&&_0x212414[_0xebf6('0x4f')]===0x0){return db['UserProfileResource'][_0xebf6('0x48')]({'name':_0x1f98fd[_0xebf6('0x2d')],'resourceId':_0x1f98fd['id'],'type':_0x212414[_0xebf6('0x2d')],'sectionId':_0x212414['id']},{})[_0xebf6('0x27')](function(){return _0x186655;});}else{return _0x186655;}})[_0xebf6('0x50')](function(_0x2e7e30){logger[_0xebf6('0x2b')](_0xebf6('0x51'),_0x2e7e30);throw _0x2e7e30;});}return _0x186655;})[_0xebf6('0x27')](respondWithResult(_0x5d84ac,0xc9))['catch'](handleError(_0x5d84ac,null));};exports[_0xebf6('0x26')]=function(_0xe78fe5,_0x24ed4e){if(_0xe78fe5['body']['id']){delete _0xe78fe5[_0xebf6('0x49')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0xe78fe5[_0xebf6('0x52')]['id']}})[_0xebf6('0x27')](handleEntityNotFound(_0x24ed4e,null))[_0xebf6('0x27')](saveUpdates(_0xe78fe5[_0xebf6('0x49')],null))[_0xebf6('0x27')](respondWithResult(_0x24ed4e,null))['catch'](handleError(_0x24ed4e,null));};exports[_0xebf6('0x28')]=function(_0x5a1b51,_0x4ed306){return db['VoiceChanSpy'][_0xebf6('0x47')]({'where':{'id':_0x5a1b51[_0xebf6('0x52')]['id']}})['then'](handleEntityNotFound(_0x4ed306,null))[_0xebf6('0x27')](removeEntity(_0x4ed306,null))[_0xebf6('0x50')](handleError(_0x4ed306,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index e4b1e4b..7619455 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 _0x1a75=['MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','SIP/%s,%s','options','join','internal','name','concat','User','findAll','then','catch','exports','models','define','VoiceChanSpy','length','VoiceExtension','bulkCreate','destroy','lodash','bluebird','./voiceChanSpy.attributes','from-sip','format','system','push','merge','Set','CDR(type)=%s','chanspy','record'];(function(_0x5ee735,_0xcb0a5d){var _0x5d44bb=function(_0x4dfd57){while(--_0x4dfd57){_0x5ee735['push'](_0x5ee735['shift']());}};_0x5d44bb(++_0xcb0a5d);}(_0x1a75,0x180));var _0x51a7=function(_0x3b430e,_0x7f97d8){_0x3b430e=_0x3b430e-0x0;var _0x140c58=_0x1a75[_0x3b430e];return _0x140c58;};'use strict';var _=require(_0x51a7('0x0'));var util=require('util');var BPromise=require(_0x51a7('0x1'));var attributes=require(_0x51a7('0x2'));var getUserApplications=function(_0x5818d6,_0xdcb653,_0x17703b){var _0x4f80fb=0x1;var _0x1314a2=[];var _0x353446={'context':_0xdcb653['context']||_0x51a7('0x3'),'exten':util[_0x51a7('0x4')]('%s%s',_0x5818d6['prefix'],_0x17703b),'type':_0x51a7('0x5'),'isApp':![],'ChanSpyId':_0x5818d6['id'],'UserId':_0xdcb653['id']};_0x1314a2[_0x51a7('0x6')](_[_0x51a7('0x7')]({'app':_0x51a7('0x8'),'appdata':util['format'](_0x51a7('0x9'),_0x51a7('0xa')),'priority':_0x4f80fb++},_0x353446));if(_0x5818d6[_0x51a7('0xb')]){_0x1314a2[_0x51a7('0x6')](_[_0x51a7('0x7')]({'app':_0x51a7('0xc'),'appdata':util[_0x51a7('0x4')](_0x51a7('0xd'),_0x5818d6[_0x51a7('0xe')]),'priority':_0x4f80fb++},_0x353446));}if(_0x5818d6[_0x51a7('0xf')]){_0x1314a2[_0x51a7('0x6')](_[_0x51a7('0x7')]({'app':_0x51a7('0x10'),'appdata':_0x5818d6[_0x51a7('0x11')],'priority':_0x4f80fb++},_0x353446));}_0x1314a2[_0x51a7('0x6')](_[_0x51a7('0x7')]({'app':'ChanSpy','appdata':util[_0x51a7('0x4')](_0x51a7('0x12'),_0xdcb653['name'],_0x5818d6[_0x51a7('0x13')]?_0x5818d6['options'][_0x51a7('0x14')](''):''),'priority':_0x4f80fb++},_0x353446));if(_0x5818d6[_0x51a7('0xb')]){_0x1314a2[_0x51a7('0x6')](_[_0x51a7('0x7')]({'app':'StopMixMonitor','priority':_0x4f80fb++},_0x353446));}return _0x1314a2;};var getChanSpyApplications=function(_0xbe69ce,_0x4775d7){var _0x20003e=[];for(var _0xcfb8e9=0x0,_0x5f4360=0x1;_0xcfb8e9<_0x4775d7['length'];_0xcfb8e9++,_0x5f4360=0x1){_0x20003e=_0x20003e['concat'](getUserApplications(_0xbe69ce,_0x4775d7[_0xcfb8e9],_0x4775d7[_0xcfb8e9][_0x51a7('0x15')]));if(_0x4775d7[_0xcfb8e9][_0x51a7('0x15')]!=_0x4775d7[_0xcfb8e9][_0x51a7('0x16')]){_0x20003e=_0x20003e[_0x51a7('0x17')](getUserApplications(_0xbe69ce,_0x4775d7[_0xcfb8e9],_0x4775d7[_0xcfb8e9]['name']));}}return _0x20003e;};var getChanSpyPromise=function(_0x46176f,_0x53b60b){return new BPromise(function(_0x1eb1a8,_0x1e97aa){return _0x46176f[_0x51a7('0x18')][_0x51a7('0x19')]({'attributes':['id','name',_0x51a7('0x15')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x51a7('0x1a')](function(_0x42ead2){if(_0x42ead2){return _0x1eb1a8(getChanSpyApplications(_0x53b60b,_0x42ead2));}return _0x1eb1a8([]);})[_0x51a7('0x1b')](function(_0x290849){_0x1e97aa(_0x290849);});});};module[_0x51a7('0x1c')]=function(_0xecb943,_0x5e1dfb){var _0x4f71c9=_0xecb943[_0x51a7('0x1d')];return _0xecb943[_0x51a7('0x1e')](_0x51a7('0x1f'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xa7a1c5,_0x4d1fb6,_0x14092f){return getChanSpyPromise(_0x4f71c9,_0xa7a1c5)[_0x51a7('0x1a')](function(_0x24a657){if(_0x24a657&&_0x24a657[_0x51a7('0x20')]){return _0x4f71c9[_0x51a7('0x21')][_0x51a7('0x22')](_0x24a657);}})['then'](function(){_0x14092f();})[_0x51a7('0x1b')](function(_0xf6153b){_0x14092f(_0xf6153b);});},'afterUpdate':function(_0x45b468,_0x210fc0,_0x3a2c02){return _0x4f71c9['VoiceExtension'][_0x51a7('0x23')]({'where':{'ChanSpyId':_0x45b468['id']}})[_0x51a7('0x1a')](function(){return getChanSpyPromise(_0x4f71c9,_0x45b468);})[_0x51a7('0x1a')](function(_0xb80192){if(_0xb80192&&_0xb80192['length']){return _0x4f71c9[_0x51a7('0x21')][_0x51a7('0x22')](_0xb80192);}})['then'](function(){_0x3a2c02();})['catch'](function(_0x59182d){_0x3a2c02(_0x59182d);});},'afterDestroy':function(_0x3f32a6,_0x1637e2,_0x59286e){return _0x4f71c9[_0x51a7('0x21')][_0x51a7('0x23')]({'where':{'ChanSpyId':_0x3f32a6['id']}})[_0x51a7('0x1a')](function(){_0x59286e();})[_0x51a7('0x1b')](function(_0x46c642){_0x59286e(_0x46c642);});}}});}; \ No newline at end of file +var _0xe401=['util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','merge','Set','CDR(type)=%s','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','findAll','agent','then','catch','exports','models','define','voice_chanspy','VoiceExtension','lodash'];(function(_0x12ea52,_0x496229){var _0xb8b08=function(_0x2ed77d){while(--_0x2ed77d){_0x12ea52['push'](_0x12ea52['shift']());}};_0xb8b08(++_0x496229);}(_0xe401,0x117));var _0x1e40=function(_0x3393cb,_0x38e8a3){_0x3393cb=_0x3393cb-0x0;var _0x508cb7=_0xe401[_0x3393cb];return _0x508cb7;};'use strict';var _=require(_0x1e40('0x0'));var util=require(_0x1e40('0x1'));var BPromise=require(_0x1e40('0x2'));var attributes=require(_0x1e40('0x3'));var getUserApplications=function(_0x50a4f2,_0x2ac12f,_0x2b337e){var _0x4d0ee1=0x1;var _0x57f93a=[];var _0x327d20={'context':_0x2ac12f[_0x1e40('0x4')]||_0x1e40('0x5'),'exten':util[_0x1e40('0x6')](_0x1e40('0x7'),_0x50a4f2[_0x1e40('0x8')],_0x2b337e),'type':'system','isApp':![],'ChanSpyId':_0x50a4f2['id'],'UserId':_0x2ac12f['id']};_0x57f93a['push'](_[_0x1e40('0x9')]({'app':_0x1e40('0xa'),'appdata':util[_0x1e40('0x6')](_0x1e40('0xb'),'chanspy'),'priority':_0x4d0ee1++},_0x327d20));if(_0x50a4f2['record']){_0x57f93a[_0x1e40('0xc')](_['merge']({'app':_0x1e40('0xd'),'appdata':util[_0x1e40('0x6')](_0x1e40('0xe'),_0x50a4f2[_0x1e40('0xf')]),'priority':_0x4d0ee1++},_0x327d20));}if(_0x50a4f2[_0x1e40('0x10')]){_0x57f93a['push'](_[_0x1e40('0x9')]({'app':_0x1e40('0x11'),'appdata':_0x50a4f2['password'],'priority':_0x4d0ee1++},_0x327d20));}_0x57f93a[_0x1e40('0xc')](_['merge']({'app':_0x1e40('0x12'),'appdata':util['format'](_0x1e40('0x13'),_0x2ac12f[_0x1e40('0x14')],_0x50a4f2[_0x1e40('0x15')]?_0x50a4f2[_0x1e40('0x15')][_0x1e40('0x16')](''):''),'priority':_0x4d0ee1++},_0x327d20));if(_0x50a4f2['record']){_0x57f93a[_0x1e40('0xc')](_[_0x1e40('0x9')]({'app':_0x1e40('0x17'),'priority':_0x4d0ee1++},_0x327d20));}return _0x57f93a;};var getChanSpyApplications=function(_0x7b1db7,_0x251700){var _0x582c91=[];for(var _0x11291f=0x0,_0x1cc1c7=0x1;_0x11291f<_0x251700[_0x1e40('0x18')];_0x11291f++,_0x1cc1c7=0x1){_0x582c91=_0x582c91[_0x1e40('0x19')](getUserApplications(_0x7b1db7,_0x251700[_0x11291f],_0x251700[_0x11291f]['internal']));if(_0x251700[_0x11291f]['internal']!=_0x251700[_0x11291f][_0x1e40('0x14')]){_0x582c91=_0x582c91[_0x1e40('0x19')](getUserApplications(_0x7b1db7,_0x251700[_0x11291f],_0x251700[_0x11291f]['name']));}}return _0x582c91;};var getChanSpyPromise=function(_0x248251,_0x4d0323){return new BPromise(function(_0x64e502,_0x5668c0){return _0x248251['User'][_0x1e40('0x1a')]({'attributes':['id','name','internal'],'where':{'role':_0x1e40('0x1b'),'chanspy':!![]},'raw':!![]})[_0x1e40('0x1c')](function(_0x57a099){if(_0x57a099){return _0x64e502(getChanSpyApplications(_0x4d0323,_0x57a099));}return _0x64e502([]);})[_0x1e40('0x1d')](function(_0x53f2ef){_0x5668c0(_0x53f2ef);});});};module[_0x1e40('0x1e')]=function(_0xf1266,_0x58c394){var _0x4d76d6=_0xf1266[_0x1e40('0x1f')];return _0xf1266[_0x1e40('0x20')]('VoiceChanSpy',attributes,{'tableName':_0x1e40('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x320317,_0x18e89e,_0x4068b3){return getChanSpyPromise(_0x4d76d6,_0x320317)[_0x1e40('0x1c')](function(_0x44a46c){if(_0x44a46c&&_0x44a46c[_0x1e40('0x18')]){return _0x4d76d6[_0x1e40('0x22')]['bulkCreate'](_0x44a46c);}})[_0x1e40('0x1c')](function(){_0x4068b3();})[_0x1e40('0x1d')](function(_0x2e9339){_0x4068b3(_0x2e9339);});},'afterUpdate':function(_0x42e857,_0x360dc1,_0x42726a){return _0x4d76d6[_0x1e40('0x22')]['destroy']({'where':{'ChanSpyId':_0x42e857['id']}})[_0x1e40('0x1c')](function(){return getChanSpyPromise(_0x4d76d6,_0x42e857);})[_0x1e40('0x1c')](function(_0x6a37d2){if(_0x6a37d2&&_0x6a37d2['length']){return _0x4d76d6[_0x1e40('0x22')]['bulkCreate'](_0x6a37d2);}})[_0x1e40('0x1c')](function(){_0x42726a();})[_0x1e40('0x1d')](function(_0xf4fb11){_0x42726a(_0xf4fb11);});},'afterDestroy':function(_0xc9502d,_0x458c77,_0x2551eb){return _0x4d76d6[_0x1e40('0x22')]['destroy']({'where':{'ChanSpyId':_0xc9502d['id']}})[_0x1e40('0x1c')](function(){_0x2551eb();})['catch'](function(_0x1f39b4){_0x2551eb(_0x1f39b4);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index bcd20c0..df7a62a 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 _0x8ce3=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird'];(function(_0x184c51,_0xcc9d29){var _0x4548cb=function(_0x2e1f70){while(--_0x2e1f70){_0x184c51['push'](_0x184c51['shift']());}};_0x4548cb(++_0xcc9d29);}(_0x8ce3,0xc3));var _0x38ce=function(_0x38dbb5,_0x427be1){_0x38dbb5=_0x38dbb5-0x0;var _0x34bd46=_0x8ce3[_0x38dbb5];return _0x34bd46;};'use strict';var _=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var moment=require('moment');var BPromise=require(_0x38ce('0x2'));var rs=require(_0x38ce('0x3'));var fs=require('fs');var Redis=require(_0x38ce('0x4'));var db=require(_0x38ce('0x5'))['db'];var utils=require(_0x38ce('0x6'));var logger=require(_0x38ce('0x7'))(_0x38ce('0x8'));var config=require(_0x38ce('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x38ce('0xa')][_0x38ce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58074c,_0x262b13,_0xbe7332){return new BPromise(function(_0x3f8011,_0x482955){return client[_0x38ce('0xc')](_0x58074c,_0xbe7332)['then'](function(_0x725d27){logger['info'](_0x38ce('0xd'),_0x262b13,_0x38ce('0xe'));logger[_0x38ce('0xf')](_0x38ce('0x10'),_0x262b13,_0x38ce('0xe'),JSON[_0x38ce('0x11')](_0x725d27));if(_0x725d27[_0x38ce('0x12')]){if(_0x725d27[_0x38ce('0x12')][_0x38ce('0x13')]===0x1f4){logger[_0x38ce('0x12')](_0x38ce('0xd'),_0x262b13,_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);return _0x482955(_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);}logger[_0x38ce('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x262b13,_0x725d27['error'][_0x38ce('0x14')]);return _0x3f8011(_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);}else{logger['info'](_0x38ce('0xd'),_0x262b13,'request\x20sent');_0x3f8011(_0x725d27[_0x38ce('0x15')][_0x38ce('0x14')]);}})['catch'](function(_0x5fc115){logger[_0x38ce('0x12')](_0x38ce('0xd'),_0x262b13,_0x5fc115);_0x482955(_0x5fc115);});});} \ No newline at end of file +var _0x3a25=['then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x34acc3,_0x1d1233){var _0x418597=function(_0x1d80fc){while(--_0x1d80fc){_0x34acc3['push'](_0x34acc3['shift']());}};_0x418597(++_0x1d1233);}(_0x3a25,0x15d));var _0x53a2=function(_0x57d7e1,_0x22455f){_0x57d7e1=_0x57d7e1-0x0;var _0x1949ee=_0x3a25[_0x57d7e1];return _0x1949ee;};'use strict';var _=require(_0x53a2('0x0'));var util=require(_0x53a2('0x1'));var moment=require(_0x53a2('0x2'));var BPromise=require(_0x53a2('0x3'));var rs=require(_0x53a2('0x4'));var fs=require('fs');var Redis=require(_0x53a2('0x5'));var db=require(_0x53a2('0x6'))['db'];var utils=require(_0x53a2('0x7'));var logger=require(_0x53a2('0x8'))(_0x53a2('0x9'));var config=require(_0x53a2('0xa'));var jayson=require(_0x53a2('0xb'));var client=jayson[_0x53a2('0xc')][_0x53a2('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x409fff,_0x4d53b8,_0x3ee956){return new BPromise(function(_0x5dc70e,_0x17aa09){return client[_0x53a2('0xe')](_0x409fff,_0x3ee956)[_0x53a2('0xf')](function(_0x42bf42){logger[_0x53a2('0x10')](_0x53a2('0x11'),_0x4d53b8,_0x53a2('0x12'));logger[_0x53a2('0x13')](_0x53a2('0x14'),_0x4d53b8,_0x53a2('0x12'),JSON['stringify'](_0x42bf42));if(_0x42bf42['error']){if(_0x42bf42[_0x53a2('0x15')][_0x53a2('0x16')]===0x1f4){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x4d53b8,_0x42bf42['error'][_0x53a2('0x17')]);return _0x17aa09(_0x42bf42[_0x53a2('0x15')][_0x53a2('0x17')]);}logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x4d53b8,_0x42bf42['error'][_0x53a2('0x17')]);return _0x5dc70e(_0x42bf42[_0x53a2('0x15')][_0x53a2('0x17')]);}else{logger[_0x53a2('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x4d53b8,_0x53a2('0x12'));_0x5dc70e(_0x42bf42[_0x53a2('0x18')][_0x53a2('0x17')]);}})[_0x53a2('0x19')](function(_0x34c7de){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x4d53b8,_0x34c7de);_0x17aa09(_0x34c7de);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index aabf948..892c881 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 _0xc3d2=['/:id','update','delete','destroy','util','connect-timeout','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','index','show','create','put'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xc3d2,0x170));var _0x2c3d=function(_0x5524e9,_0x1c53e7){_0x5524e9=_0x5524e9-0x0;var _0x2db558=_0xc3d2[_0x5524e9];return _0x2db558;};'use strict';var multer=require('multer');var util=require(_0x2c3d('0x0'));var path=require('path');var timeout=require(_0x2c3d('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2c3d('0x2'));var config=require('../../config/environment');var controller=require(_0x2c3d('0x3'));router[_0x2c3d('0x4')]('/',auth[_0x2c3d('0x5')](),controller[_0x2c3d('0x6')]);router[_0x2c3d('0x4')]('/:id',auth[_0x2c3d('0x5')](),controller[_0x2c3d('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2c3d('0x8')]);router[_0x2c3d('0x9')](_0x2c3d('0xa'),auth[_0x2c3d('0x5')](),controller[_0x2c3d('0xb')]);router[_0x2c3d('0xc')](_0x2c3d('0xa'),auth[_0x2c3d('0x5')](),controller[_0x2c3d('0xd')]);module['exports']=router; \ No newline at end of file +var _0xb549=['isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','get'];(function(_0x4ca1cd,_0x426a42){var _0x49ed57=function(_0x549f26){while(--_0x549f26){_0x4ca1cd['push'](_0x4ca1cd['shift']());}};_0x49ed57(++_0x426a42);}(_0xb549,0x13b));var _0x9b54=function(_0x3aa39d,_0x3d6d02){_0x3aa39d=_0x3aa39d-0x0;var _0x1bcde2=_0xb549[_0x3aa39d];return _0x1bcde2;};'use strict';var multer=require('multer');var util=require(_0x9b54('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9b54('0x1'));var router=express[_0x9b54('0x2')]();var fs_extra=require(_0x9b54('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9b54('0x4'));var config=require(_0x9b54('0x5'));var controller=require(_0x9b54('0x6'));router[_0x9b54('0x7')]('/',auth[_0x9b54('0x8')](),controller[_0x9b54('0x9')]);router['get']('/:id',auth[_0x9b54('0x8')](),controller[_0x9b54('0xa')]);router[_0x9b54('0xb')]('/',auth[_0x9b54('0x8')](),controller[_0x9b54('0xc')]);router[_0x9b54('0xd')](_0x9b54('0xe'),auth['isAuthenticated'](),controller[_0x9b54('0xf')]);router[_0x9b54('0x10')](_0x9b54('0xe'),auth['isAuthenticated'](),controller[_0x9b54('0x11')]);module[_0x9b54('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 f314a9f..df59b2f 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 _0xb88a=['name','BOOLEAN','exports','STRING'];(function(_0x314b56,_0x292792){var _0x34e0d4=function(_0x519f29){while(--_0x519f29){_0x314b56['push'](_0x314b56['shift']());}};_0x34e0d4(++_0x292792);}(_0xb88a,0x162));var _0xab88=function(_0xcf0e,_0x1d3e15){_0xcf0e=_0xcf0e-0x0;var _0x8d0e30=_0xb88a[_0xcf0e];return _0x8d0e30;};'use strict';var Sequelize=require('sequelize');module[_0xab88('0x0')]={'name':{'type':Sequelize[_0xab88('0x1')],'unique':_0xab88('0x2')},'description':{'type':Sequelize[_0xab88('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xab88('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x962d=['name','sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x962d,0xc9));var _0xd962=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x962d[_0x38b14f];return _0x22a324;};'use strict';var Sequelize=require(_0xd962('0x0'));module[_0xd962('0x1')]={'name':{'type':Sequelize[_0xd962('0x2')],'unique':_0xd962('0x3')},'description':{'type':Sequelize[_0xd962('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 671f119..ac587f8 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 _0x5129=['findAll','catch','show','params','length','create','body','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','render','eml-format','zip-dir','fast-json-patch','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','get','UserProfileResource','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include'];(function(_0xb945d3,_0x41cfde){var _0x54a5fd=function(_0x4406dd){while(--_0x4406dd){_0xb945d3['push'](_0xb945d3['shift']());}};_0x54a5fd(++_0x41cfde);}(_0x5129,0x87));var _0x9512=function(_0x57eb16,_0x409bb2){_0x57eb16=_0x57eb16-0x0;var _0x4e1e8d=_0x5129[_0x57eb16];return _0x4e1e8d;};'use strict';var emlformat=require(_0x9512('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9512('0x1'));var jsonpatch=require(_0x9512('0x2'));var rp=require('request-promise');var moment=require(_0x9512('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9512('0x4'));var sox=require(_0x9512('0x5'));var csv=require(_0x9512('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9512('0x7'));var _=require(_0x9512('0x8'));var squel=require(_0x9512('0x9'));var crypto=require(_0x9512('0xa'));var jsforce=require(_0x9512('0xb'));var deskjs=require(_0x9512('0xc'));var toCsv=require(_0x9512('0x6'));var querystring=require(_0x9512('0xd'));var Papa=require(_0x9512('0xe'));var Redis=require(_0x9512('0xf'));var authService=require(_0x9512('0x10'));var qs=require(_0x9512('0x11'));var as=require(_0x9512('0x12'));var hardwareService=require(_0x9512('0x13'));var logger=require(_0x9512('0x14'))(_0x9512('0x15'));var utils=require(_0x9512('0x16'));var config=require(_0x9512('0x17'));var licenseUtil=require(_0x9512('0x18'));var db=require(_0x9512('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x9512('0x1a')][_0x9512('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x195cda,_0x54bfea,_0x43b570,_0x586eec){return new BPromise(function(_0x24b24f,_0x25087f){var _0xcd0027=_0x586eec||client;return _0xcd0027[_0x9512('0x1c')](_0x195cda,_0x43b570)[_0x9512('0x1d')](function(_0x18a0d6){logger[_0x9512('0x1e')](_0x9512('0x1f'),_0x54bfea,'request\x20sent');logger[_0x9512('0x20')](_0x9512('0x21'),_0x54bfea,_0x9512('0x22'),JSON[_0x9512('0x23')](_0x18a0d6));if(_0x18a0d6[_0x9512('0x24')]){if(_0x18a0d6[_0x9512('0x24')][_0x9512('0x25')]===0x1f4){logger[_0x9512('0x24')](_0x9512('0x1f'),_0x54bfea,_0x18a0d6[_0x9512('0x24')][_0x9512('0x26')]);return _0x25087f(_0x18a0d6[_0x9512('0x24')][_0x9512('0x26')]);}logger[_0x9512('0x24')](_0x9512('0x1f'),_0x54bfea,_0x18a0d6[_0x9512('0x24')][_0x9512('0x26')]);return _0x24b24f(_0x18a0d6['error'][_0x9512('0x26')]);}else{logger[_0x9512('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x54bfea,_0x9512('0x22'));_0x24b24f(_0x18a0d6[_0x9512('0x27')][_0x9512('0x26')]);}})['catch'](function(_0x27e724){logger[_0x9512('0x24')](_0x9512('0x1f'),_0x54bfea,_0x27e724);_0x25087f(_0x27e724);});});}function respondWithStatusCode(_0x49ef9a,_0x393800){_0x393800=_0x393800||0xcc;return function(_0x45b4a5){if(_0x45b4a5){return _0x49ef9a[_0x9512('0x28')](_0x393800);}return _0x49ef9a[_0x9512('0x29')](_0x393800)[_0x9512('0x2a')]();};}function respondWithResult(_0x19dfa1,_0x222f62){_0x222f62=_0x222f62||0xc8;return function(_0x35e4bf){if(_0x35e4bf){return _0x19dfa1['status'](_0x222f62)['json'](_0x35e4bf);}};}function respondWithFilteredResult(_0x1eb2a8,_0x199087){return function(_0x26a1ba){if(_0x26a1ba){var _0x1a4e91=typeof _0x199087[_0x9512('0x2b')]===_0x9512('0x2c')&&typeof _0x199087[_0x9512('0x2d')]===_0x9512('0x2c');var _0x2e32f4=_0x26a1ba[_0x9512('0x2e')];var _0x558fd6=_0x1a4e91?0x0:_0x199087[_0x9512('0x2b')];var _0x36a27f=_0x1a4e91?_0x26a1ba['count']:_0x199087[_0x9512('0x2b')]+_0x199087[_0x9512('0x2d')];var _0x32396b;if(_0x36a27f>=_0x2e32f4){_0x36a27f=_0x2e32f4;_0x32396b=0xc8;}else{_0x32396b=0xce;}_0x1eb2a8[_0x9512('0x29')](_0x32396b);return _0x1eb2a8['set'](_0x9512('0x2f'),_0x558fd6+'-'+_0x36a27f+'/'+_0x2e32f4)[_0x9512('0x30')](_0x26a1ba);}return null;};}function patchUpdates(_0x1e3054){return function(_0x52d111){try{jsonpatch[_0x9512('0x31')](_0x52d111,_0x1e3054,!![]);}catch(_0x102f72){return BPromise[_0x9512('0x32')](_0x102f72);}return _0x52d111['save']();};}function saveUpdates(_0x260659,_0x13ed86){return function(_0x32a4f6){if(_0x32a4f6){return _0x32a4f6[_0x9512('0x33')](_0x260659)['then'](function(_0x2f29a1){return _0x2f29a1;});}return null;};}function removeEntity(_0x4b5d73,_0x3033dc){return function(_0x4e313e){if(_0x4e313e){return _0x4e313e[_0x9512('0x34')]()[_0x9512('0x1d')](function(){var _0x47ea15=_0x4e313e[_0x9512('0x35')]({'plain':!![]});var _0x33a14e='Contexts';return db[_0x9512('0x36')][_0x9512('0x34')]({'where':{'type':_0x33a14e,'resourceId':_0x47ea15['id']}})[_0x9512('0x1d')](function(){return _0x4e313e;});})['then'](function(){_0x4b5d73[_0x9512('0x29')](0xcc)[_0x9512('0x2a')]();});}};}function handleEntityNotFound(_0x25bb11,_0x202273){return function(_0x10ad08){if(!_0x10ad08){_0x25bb11[_0x9512('0x28')](0x194);}return _0x10ad08;};}function handleError(_0x2d0818,_0x5bcf2f){_0x5bcf2f=_0x5bcf2f||0x1f4;return function(_0x5be965){logger[_0x9512('0x24')](_0x5be965['stack']);if(_0x5be965['name']){delete _0x5be965[_0x9512('0x37')];}_0x2d0818[_0x9512('0x29')](_0x5bcf2f)[_0x9512('0x38')](_0x5be965);};}exports[_0x9512('0x39')]=function(_0x4799a9,_0x39bed4){var _0x4c86ea={},_0x33ae39={},_0x44f754={'count':0x0,'rows':[]};var _0xb934ee=_[_0x9512('0x3a')](db[_0x9512('0x3b')][_0x9512('0x3c')],function(_0x22e906){return{'name':_0x22e906[_0x9512('0x3d')],'type':_0x22e906[_0x9512('0x3e')][_0x9512('0x3f')]};});_0x33ae39[_0x9512('0x40')]=_[_0x9512('0x3a')](_0xb934ee,'name');_0x33ae39['query']=_[_0x9512('0x41')](_0x4799a9[_0x9512('0x42')]);_0x33ae39[_0x9512('0x43')]=_[_0x9512('0x44')](_0x33ae39[_0x9512('0x40')],_0x33ae39['query']);_0x4c86ea[_0x9512('0x45')]=_['intersection'](_0x33ae39[_0x9512('0x40')],qs['fields'](_0x4799a9[_0x9512('0x42')][_0x9512('0x46')]));_0x4c86ea[_0x9512('0x45')]=_0x4c86ea[_0x9512('0x45')]['length']?_0x4c86ea['attributes']:_0x33ae39['model'];if(!_0x4799a9[_0x9512('0x42')][_0x9512('0x47')](_0x9512('0x48'))){_0x4c86ea[_0x9512('0x2d')]=qs['limit'](_0x4799a9[_0x9512('0x42')][_0x9512('0x2d')]);_0x4c86ea['offset']=qs[_0x9512('0x2b')](_0x4799a9['query']['offset']);}_0x4c86ea[_0x9512('0x49')]=qs[_0x9512('0x4a')](_0x4799a9[_0x9512('0x42')][_0x9512('0x4a')]);_0x4c86ea['where']=qs[_0x9512('0x43')](_[_0x9512('0x4b')](_0x4799a9[_0x9512('0x42')],_0x33ae39[_0x9512('0x43')]),_0xb934ee);if(_0x4799a9[_0x9512('0x42')][_0x9512('0x4c')]){_0x4c86ea['where']=_[_0x9512('0x4d')](_0x4c86ea[_0x9512('0x4e')],{'$or':_[_0x9512('0x3a')](_0xb934ee,function(_0x37d389){if(_0x37d389[_0x9512('0x3e')]!==_0x9512('0x4f')){var _0x242820={};_0x242820[_0x37d389[_0x9512('0x37')]]={'$like':'%'+_0x4799a9[_0x9512('0x42')][_0x9512('0x4c')]+'%'};return _0x242820;}})});}_0x4c86ea=_[_0x9512('0x4d')]({},_0x4c86ea,_0x4799a9[_0x9512('0x50')]);var _0x527576={'where':_0x4c86ea[_0x9512('0x4e')]};return db[_0x9512('0x3b')][_0x9512('0x2e')](_0x527576)[_0x9512('0x1d')](function(_0x4a1616){_0x44f754[_0x9512('0x2e')]=_0x4a1616;if(_0x4799a9[_0x9512('0x42')][_0x9512('0x51')]){_0x4c86ea[_0x9512('0x52')]=[{'all':!![]}];}return db[_0x9512('0x3b')][_0x9512('0x53')](_0x4c86ea);})[_0x9512('0x1d')](function(_0x602bec){_0x44f754['rows']=_0x602bec;return _0x44f754;})[_0x9512('0x1d')](respondWithFilteredResult(_0x39bed4,_0x4c86ea))[_0x9512('0x54')](handleError(_0x39bed4,null));};exports[_0x9512('0x55')]=function(_0x4dd4eb,_0x2514fe){var _0x1d98b5={'raw':![],'where':{'id':_0x4dd4eb[_0x9512('0x56')]['id']}},_0x507fc9={};_0x507fc9[_0x9512('0x40')]=_[_0x9512('0x41')](db[_0x9512('0x3b')]['rawAttributes']);_0x507fc9[_0x9512('0x42')]=_[_0x9512('0x41')](_0x4dd4eb[_0x9512('0x42')]);_0x507fc9['filters']=_[_0x9512('0x44')](_0x507fc9[_0x9512('0x40')],_0x507fc9['query']);_0x1d98b5[_0x9512('0x45')]=_['intersection'](_0x507fc9[_0x9512('0x40')],qs[_0x9512('0x46')](_0x4dd4eb['query'][_0x9512('0x46')]));_0x1d98b5['attributes']=_0x1d98b5[_0x9512('0x45')][_0x9512('0x57')]?_0x1d98b5[_0x9512('0x45')]:_0x507fc9[_0x9512('0x40')];if(_0x4dd4eb[_0x9512('0x42')]['includeAll']){_0x1d98b5['include']=[{'all':!![]}];}_0x1d98b5=_[_0x9512('0x4d')]({},_0x1d98b5,_0x4dd4eb[_0x9512('0x50')]);return db[_0x9512('0x3b')]['find'](_0x1d98b5)[_0x9512('0x1d')](handleEntityNotFound(_0x2514fe,null))[_0x9512('0x1d')](respondWithResult(_0x2514fe,null))[_0x9512('0x54')](handleError(_0x2514fe,null));};exports[_0x9512('0x58')]=function(_0x3d5010,_0x158991,_0x1564fd){var _0x474a5c;return db[_0x9512('0x3b')][_0x9512('0x58')](_0x3d5010[_0x9512('0x59')],{'raw':!![]})[_0x9512('0x1d')](function(_0x23c2a7){_0x474a5c=_0x23c2a7;return db[_0x9512('0x3b')]['findAll']({'raw':!![]});})[_0x9512('0x1d')](function(_0xdae0f0){var _0xbb1b68=fs['readFileSync'](path['join'](config['root'],_0x9512('0x5a')),_0x9512('0x5b'));var _0x4bffcd=ejs['render'](_0xbb1b68,{'contexts':_0xdae0f0||[]});fs[_0x9512('0x5c')](_0x9512('0x5d'),_0x4bffcd);})[_0x9512('0x1d')](function(){return respondWithRpcPromise(_0x9512('0x5e'),_0x9512('0x58'),{'module':_0x9512('0x5f')});})[_0x9512('0x1d')](function(){var _0x7405f8=_0x3d5010['user'][_0x9512('0x35')]({'plain':!![]});if(!_0x7405f8)throw new Error(_0x9512('0x60'));if(_0x7405f8[_0x9512('0x61')]===_0x9512('0x62')){var _0x38b247=_0x474a5c[_0x9512('0x35')]({'plain':!![]});return db[_0x9512('0x63')][_0x9512('0x64')]({'where':{'name':_0x9512('0x65'),'userProfileId':_0x7405f8[_0x9512('0x66')]},'raw':!![]})[_0x9512('0x1d')](function(_0x5a564a){if(_0x5a564a&&_0x5a564a[_0x9512('0x67')]===0x0){return db[_0x9512('0x36')][_0x9512('0x58')]({'name':_0x38b247[_0x9512('0x37')],'resourceId':_0x38b247['id'],'type':_0x5a564a['name'],'sectionId':_0x5a564a['id']},{})[_0x9512('0x1d')](function(){return _0x474a5c;});}else{return _0x474a5c;}})[_0x9512('0x54')](function(_0x39245b){logger['error'](_0x9512('0x68'),_0x39245b);throw _0x39245b;});}return _0x474a5c;})['then'](respondWithResult(_0x158991,0xc9))[_0x9512('0x54')](handleError(_0x158991,null));};exports['update']=function(_0x4e51f7,_0x24f6c4,_0xbd10b9){var _0x4697fe;return db[_0x9512('0x3b')][_0x9512('0x64')]({'where':{'id':_0x4e51f7[_0x9512('0x56')]['id']}})[_0x9512('0x1d')](handleEntityNotFound(_0x24f6c4,null))[_0x9512('0x1d')](saveUpdates(_0x4e51f7[_0x9512('0x59')],null))[_0x9512('0x1d')](function(_0xaefab8){if(_0xaefab8){_0x4697fe=_0xaefab8;return db[_0x9512('0x3b')][_0x9512('0x53')]({'raw':!![]});}})[_0x9512('0x1d')](function(_0x6a674d){var _0x50d2a4=fs[_0x9512('0x69')](path[_0x9512('0x6a')](config[_0x9512('0x6b')],_0x9512('0x5a')),'utf8');var _0x16a660=ejs[_0x9512('0x6c')](_0x50d2a4,{'contexts':_0x6a674d||[]});fs['writeFileSync'](_0x9512('0x5d'),_0x16a660);})[_0x9512('0x1d')](function(){return respondWithRpcPromise('Reload',_0x9512('0x33'),{'module':_0x9512('0x5f')});})[_0x9512('0x1d')](function(){return _0x4697fe;})[_0x9512('0x1d')](respondWithResult(_0x24f6c4,null))['catch'](handleError(_0x24f6c4,null));};exports['destroy']=function(_0x1c4c07,_0x11d7c0,_0x12b7d8){var _0x3b8551;return db[_0x9512('0x3b')]['find']({'where':{'id':_0x1c4c07[_0x9512('0x56')]['id']}})[_0x9512('0x1d')](handleEntityNotFound(_0x11d7c0,null))[_0x9512('0x1d')](removeEntity(_0x11d7c0,null))[_0x9512('0x1d')](function(){return db[_0x9512('0x3b')]['findAll']({'raw':!![]});})[_0x9512('0x1d')](function(_0x3352be){var _0x5363e1=fs['readFileSync'](path[_0x9512('0x6a')](config['root'],_0x9512('0x5a')),'utf8');var _0x592813=ejs[_0x9512('0x6c')](_0x5363e1,{'contexts':_0x3352be});fs[_0x9512('0x5c')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x592813);return respondWithRpcPromise(_0x9512('0x5e'),_0x9512('0x34'),{'module':_0x9512('0x5f')});})['catch'](handleError(_0x11d7c0,null));}; \ No newline at end of file +var _0xf3c4=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','json','undefined','count','offset','set','Content-Range','apply','reject','update','then','get','Contexts','UserProfileResource','stack','name','send','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','keys','length','options','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','writeFileSync','Reload','chan_sip.so','user','role','UserProfileSection','userProfileId','autoAssociation','params','render','/etc/asterisk/extensions_xcally_contexts.conf','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x2ddd0b,_0xff663b){var _0xfe258d=function(_0x31af0e){while(--_0x31af0e){_0x2ddd0b['push'](_0x2ddd0b['shift']());}};_0xfe258d(++_0xff663b);}(_0xf3c4,0x12c));var _0x4f3c=function(_0x2fc939,_0x325f8e){_0x2fc939=_0x2fc939-0x0;var _0x336018=_0xf3c4[_0x2fc939];return _0x336018;};'use strict';var emlformat=require(_0x4f3c('0x0'));var rimraf=require(_0x4f3c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f3c('0x2'));var rp=require(_0x4f3c('0x3'));var moment=require(_0x4f3c('0x4'));var BPromise=require(_0x4f3c('0x5'));var Mustache=require('mustache');var util=require(_0x4f3c('0x6'));var path=require(_0x4f3c('0x7'));var sox=require(_0x4f3c('0x8'));var csv=require(_0x4f3c('0x9'));var ejs=require(_0x4f3c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4f3c('0xb'));var squel=require(_0x4f3c('0xc'));var crypto=require('crypto');var jsforce=require(_0x4f3c('0xd'));var deskjs=require(_0x4f3c('0xe'));var toCsv=require(_0x4f3c('0x9'));var querystring=require(_0x4f3c('0xf'));var Papa=require(_0x4f3c('0x10'));var Redis=require(_0x4f3c('0x11'));var authService=require(_0x4f3c('0x12'));var qs=require(_0x4f3c('0x13'));var as=require(_0x4f3c('0x14'));var hardwareService=require(_0x4f3c('0x15'));var logger=require(_0x4f3c('0x16'))(_0x4f3c('0x17'));var utils=require(_0x4f3c('0x18'));var config=require(_0x4f3c('0x19'));var licenseUtil=require(_0x4f3c('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4f3c('0x1b'));var client=jayson[_0x4f3c('0x1c')][_0x4f3c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x204b24,_0x118e12,_0x2cd70f,_0x246706){return new BPromise(function(_0x3973ac,_0x500d86){var _0x36bbb2=_0x246706||client;return _0x36bbb2[_0x4f3c('0x1e')](_0x204b24,_0x2cd70f)['then'](function(_0x422a5f){logger[_0x4f3c('0x1f')](_0x4f3c('0x20'),_0x118e12,_0x4f3c('0x21'));logger[_0x4f3c('0x22')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x118e12,'request\x20sent',JSON[_0x4f3c('0x23')](_0x422a5f));if(_0x422a5f[_0x4f3c('0x24')]){if(_0x422a5f[_0x4f3c('0x24')][_0x4f3c('0x25')]===0x1f4){logger['error'](_0x4f3c('0x20'),_0x118e12,_0x422a5f[_0x4f3c('0x24')][_0x4f3c('0x26')]);return _0x500d86(_0x422a5f[_0x4f3c('0x24')][_0x4f3c('0x26')]);}logger[_0x4f3c('0x24')]('VoiceContext,\x20%s,\x20%s',_0x118e12,_0x422a5f[_0x4f3c('0x24')]['message']);return _0x3973ac(_0x422a5f[_0x4f3c('0x24')]['message']);}else{logger[_0x4f3c('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x118e12,_0x4f3c('0x21'));_0x3973ac(_0x422a5f[_0x4f3c('0x27')][_0x4f3c('0x26')]);}})[_0x4f3c('0x28')](function(_0x39553b){logger[_0x4f3c('0x24')](_0x4f3c('0x20'),_0x118e12,_0x39553b);_0x500d86(_0x39553b);});});}function respondWithStatusCode(_0x217868,_0x64e9df){_0x64e9df=_0x64e9df||0xcc;return function(_0x188f15){if(_0x188f15){return _0x217868['sendStatus'](_0x64e9df);}return _0x217868['status'](_0x64e9df)['end']();};}function respondWithResult(_0x9748f6,_0x49908f){_0x49908f=_0x49908f||0xc8;return function(_0x5efc74){if(_0x5efc74){return _0x9748f6[_0x4f3c('0x29')](_0x49908f)[_0x4f3c('0x2a')](_0x5efc74);}};}function respondWithFilteredResult(_0x5e85b3,_0x3307d4){return function(_0x37fb08){if(_0x37fb08){var _0x14a568=typeof _0x3307d4['offset']==='undefined'&&typeof _0x3307d4['limit']===_0x4f3c('0x2b');var _0x45eede=_0x37fb08[_0x4f3c('0x2c')];var _0x109f49=_0x14a568?0x0:_0x3307d4[_0x4f3c('0x2d')];var _0x550fa8=_0x14a568?_0x37fb08[_0x4f3c('0x2c')]:_0x3307d4[_0x4f3c('0x2d')]+_0x3307d4['limit'];var _0x5308c3;if(_0x550fa8>=_0x45eede){_0x550fa8=_0x45eede;_0x5308c3=0xc8;}else{_0x5308c3=0xce;}_0x5e85b3[_0x4f3c('0x29')](_0x5308c3);return _0x5e85b3[_0x4f3c('0x2e')](_0x4f3c('0x2f'),_0x109f49+'-'+_0x550fa8+'/'+_0x45eede)[_0x4f3c('0x2a')](_0x37fb08);}return null;};}function patchUpdates(_0x394cf3){return function(_0xd9ba49){try{jsonpatch[_0x4f3c('0x30')](_0xd9ba49,_0x394cf3,!![]);}catch(_0x4ea7c2){return BPromise[_0x4f3c('0x31')](_0x4ea7c2);}return _0xd9ba49['save']();};}function saveUpdates(_0x2abc4d,_0x140164){return function(_0x5c8975){if(_0x5c8975){return _0x5c8975[_0x4f3c('0x32')](_0x2abc4d)[_0x4f3c('0x33')](function(_0x4aaf38){return _0x4aaf38;});}return null;};}function removeEntity(_0xac1764,_0x5a6c73){return function(_0xab3153){if(_0xab3153){return _0xab3153['destroy']()[_0x4f3c('0x33')](function(){var _0x115634=_0xab3153[_0x4f3c('0x34')]({'plain':!![]});var _0x25c939=_0x4f3c('0x35');return db[_0x4f3c('0x36')]['destroy']({'where':{'type':_0x25c939,'resourceId':_0x115634['id']}})[_0x4f3c('0x33')](function(){return _0xab3153;});})[_0x4f3c('0x33')](function(){_0xac1764[_0x4f3c('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b621c,_0x3ad10c){return function(_0x11954c){if(!_0x11954c){_0x2b621c['sendStatus'](0x194);}return _0x11954c;};}function handleError(_0x4249b8,_0x1b9898){_0x1b9898=_0x1b9898||0x1f4;return function(_0x53f61d){logger[_0x4f3c('0x24')](_0x53f61d[_0x4f3c('0x37')]);if(_0x53f61d[_0x4f3c('0x38')]){delete _0x53f61d[_0x4f3c('0x38')];}_0x4249b8['status'](_0x1b9898)[_0x4f3c('0x39')](_0x53f61d);};}exports['index']=function(_0x21b86d,_0x5154c2){var _0x307590={},_0x360bbf={},_0x556691={'count':0x0,'rows':[]};var _0x381979=_['map'](db[_0x4f3c('0x3a')][_0x4f3c('0x3b')],function(_0x10ef11){return{'name':_0x10ef11[_0x4f3c('0x3c')],'type':_0x10ef11[_0x4f3c('0x3d')][_0x4f3c('0x3e')]};});_0x360bbf[_0x4f3c('0x3f')]=_[_0x4f3c('0x40')](_0x381979,_0x4f3c('0x38'));_0x360bbf[_0x4f3c('0x41')]=_['keys'](_0x21b86d[_0x4f3c('0x41')]);_0x360bbf[_0x4f3c('0x42')]=_[_0x4f3c('0x43')](_0x360bbf[_0x4f3c('0x3f')],_0x360bbf[_0x4f3c('0x41')]);_0x307590[_0x4f3c('0x44')]=_['intersection'](_0x360bbf[_0x4f3c('0x3f')],qs[_0x4f3c('0x45')](_0x21b86d['query'][_0x4f3c('0x45')]));_0x307590[_0x4f3c('0x44')]=_0x307590[_0x4f3c('0x44')]['length']?_0x307590[_0x4f3c('0x44')]:_0x360bbf[_0x4f3c('0x3f')];if(!_0x21b86d['query']['hasOwnProperty'](_0x4f3c('0x46'))){_0x307590['limit']=qs[_0x4f3c('0x47')](_0x21b86d[_0x4f3c('0x41')][_0x4f3c('0x47')]);_0x307590[_0x4f3c('0x2d')]=qs['offset'](_0x21b86d[_0x4f3c('0x41')][_0x4f3c('0x2d')]);}_0x307590[_0x4f3c('0x48')]=qs[_0x4f3c('0x49')](_0x21b86d[_0x4f3c('0x41')][_0x4f3c('0x49')]);_0x307590[_0x4f3c('0x4a')]=qs[_0x4f3c('0x42')](_[_0x4f3c('0x4b')](_0x21b86d[_0x4f3c('0x41')],_0x360bbf['filters']),_0x381979);if(_0x21b86d['query'][_0x4f3c('0x4c')]){_0x307590[_0x4f3c('0x4a')]=_[_0x4f3c('0x4d')](_0x307590[_0x4f3c('0x4a')],{'$or':_[_0x4f3c('0x40')](_0x381979,function(_0x225339){if(_0x225339[_0x4f3c('0x3d')]!==_0x4f3c('0x4e')){var _0x587ddb={};_0x587ddb[_0x225339['name']]={'$like':'%'+_0x21b86d[_0x4f3c('0x41')][_0x4f3c('0x4c')]+'%'};return _0x587ddb;}})});}_0x307590=_[_0x4f3c('0x4d')]({},_0x307590,_0x21b86d['options']);var _0x368bc4={'where':_0x307590[_0x4f3c('0x4a')]};return db[_0x4f3c('0x3a')][_0x4f3c('0x2c')](_0x368bc4)[_0x4f3c('0x33')](function(_0x41aec4){_0x556691[_0x4f3c('0x2c')]=_0x41aec4;if(_0x21b86d[_0x4f3c('0x41')][_0x4f3c('0x4f')]){_0x307590['include']=[{'all':!![]}];}return db[_0x4f3c('0x3a')][_0x4f3c('0x50')](_0x307590);})[_0x4f3c('0x33')](function(_0xb3d0cc){_0x556691[_0x4f3c('0x51')]=_0xb3d0cc;return _0x556691;})['then'](respondWithFilteredResult(_0x5154c2,_0x307590))[_0x4f3c('0x28')](handleError(_0x5154c2,null));};exports[_0x4f3c('0x52')]=function(_0x2c5330,_0x36c98d){var _0x43876c={'raw':![],'where':{'id':_0x2c5330['params']['id']}},_0x2944ee={};_0x2944ee[_0x4f3c('0x3f')]=_[_0x4f3c('0x53')](db[_0x4f3c('0x3a')][_0x4f3c('0x3b')]);_0x2944ee[_0x4f3c('0x41')]=_[_0x4f3c('0x53')](_0x2c5330[_0x4f3c('0x41')]);_0x2944ee[_0x4f3c('0x42')]=_[_0x4f3c('0x43')](_0x2944ee[_0x4f3c('0x3f')],_0x2944ee[_0x4f3c('0x41')]);_0x43876c['attributes']=_[_0x4f3c('0x43')](_0x2944ee[_0x4f3c('0x3f')],qs[_0x4f3c('0x45')](_0x2c5330[_0x4f3c('0x41')][_0x4f3c('0x45')]));_0x43876c['attributes']=_0x43876c[_0x4f3c('0x44')][_0x4f3c('0x54')]?_0x43876c[_0x4f3c('0x44')]:_0x2944ee[_0x4f3c('0x3f')];if(_0x2c5330[_0x4f3c('0x41')][_0x4f3c('0x4f')]){_0x43876c['include']=[{'all':!![]}];}_0x43876c=_['merge']({},_0x43876c,_0x2c5330[_0x4f3c('0x55')]);return db['VoiceContext'][_0x4f3c('0x56')](_0x43876c)[_0x4f3c('0x33')](handleEntityNotFound(_0x36c98d,null))[_0x4f3c('0x33')](respondWithResult(_0x36c98d,null))[_0x4f3c('0x28')](handleError(_0x36c98d,null));};exports[_0x4f3c('0x57')]=function(_0xb8b67d,_0xa6269a,_0x2b7877){var _0x47001d;return db['VoiceContext'][_0x4f3c('0x57')](_0xb8b67d[_0x4f3c('0x58')],{'raw':!![]})[_0x4f3c('0x33')](function(_0x55a09f){_0x47001d=_0x55a09f;return db[_0x4f3c('0x3a')][_0x4f3c('0x50')]({'raw':!![]});})[_0x4f3c('0x33')](function(_0x484bd6){var _0x2d360d=fs[_0x4f3c('0x59')](path[_0x4f3c('0x5a')](config[_0x4f3c('0x5b')],_0x4f3c('0x5c')),_0x4f3c('0x5d'));var _0x15542a=ejs['render'](_0x2d360d,{'contexts':_0x484bd6||[]});fs[_0x4f3c('0x5e')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x15542a);})['then'](function(){return respondWithRpcPromise(_0x4f3c('0x5f'),_0x4f3c('0x57'),{'module':_0x4f3c('0x60')});})['then'](function(){var _0x2a67de=_0xb8b67d[_0x4f3c('0x61')][_0x4f3c('0x34')]({'plain':!![]});if(!_0x2a67de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a67de[_0x4f3c('0x62')]===_0x4f3c('0x61')){var _0x4d159b=_0x47001d[_0x4f3c('0x34')]({'plain':!![]});return db[_0x4f3c('0x63')][_0x4f3c('0x56')]({'where':{'name':_0x4f3c('0x35'),'userProfileId':_0x2a67de[_0x4f3c('0x64')]},'raw':!![]})[_0x4f3c('0x33')](function(_0xba9e77){if(_0xba9e77&&_0xba9e77[_0x4f3c('0x65')]===0x0){return db[_0x4f3c('0x36')][_0x4f3c('0x57')]({'name':_0x4d159b['name'],'resourceId':_0x4d159b['id'],'type':_0xba9e77[_0x4f3c('0x38')],'sectionId':_0xba9e77['id']},{})['then'](function(){return _0x47001d;});}else{return _0x47001d;}})[_0x4f3c('0x28')](function(_0x2370f6){logger[_0x4f3c('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2370f6);throw _0x2370f6;});}return _0x47001d;})[_0x4f3c('0x33')](respondWithResult(_0xa6269a,0xc9))['catch'](handleError(_0xa6269a,null));};exports['update']=function(_0x2fd38f,_0x47a8e8,_0x223007){var _0xf17a3e;return db[_0x4f3c('0x3a')][_0x4f3c('0x56')]({'where':{'id':_0x2fd38f[_0x4f3c('0x66')]['id']}})[_0x4f3c('0x33')](handleEntityNotFound(_0x47a8e8,null))['then'](saveUpdates(_0x2fd38f[_0x4f3c('0x58')],null))['then'](function(_0x55844c){if(_0x55844c){_0xf17a3e=_0x55844c;return db[_0x4f3c('0x3a')][_0x4f3c('0x50')]({'raw':!![]});}})[_0x4f3c('0x33')](function(_0x27fc87){var _0x431d0a=fs[_0x4f3c('0x59')](path['join'](config[_0x4f3c('0x5b')],_0x4f3c('0x5c')),_0x4f3c('0x5d'));var _0x5af55c=ejs[_0x4f3c('0x67')](_0x431d0a,{'contexts':_0x27fc87||[]});fs[_0x4f3c('0x5e')](_0x4f3c('0x68'),_0x5af55c);})[_0x4f3c('0x33')](function(){return respondWithRpcPromise('Reload',_0x4f3c('0x32'),{'module':_0x4f3c('0x60')});})['then'](function(){return _0xf17a3e;})[_0x4f3c('0x33')](respondWithResult(_0x47a8e8,null))[_0x4f3c('0x28')](handleError(_0x47a8e8,null));};exports['destroy']=function(_0xaf2792,_0x471f70,_0x1bd00b){var _0x24a8f2;return db['VoiceContext'][_0x4f3c('0x56')]({'where':{'id':_0xaf2792[_0x4f3c('0x66')]['id']}})[_0x4f3c('0x33')](handleEntityNotFound(_0x471f70,null))[_0x4f3c('0x33')](removeEntity(_0x471f70,null))[_0x4f3c('0x33')](function(){return db[_0x4f3c('0x3a')]['findAll']({'raw':!![]});})['then'](function(_0x1b7b89){var _0x397c9c=fs[_0x4f3c('0x59')](path[_0x4f3c('0x5a')](config[_0x4f3c('0x5b')],_0x4f3c('0x5c')),_0x4f3c('0x5d'));var _0x47eba3=ejs[_0x4f3c('0x67')](_0x397c9c,{'contexts':_0x1b7b89});fs[_0x4f3c('0x5e')](_0x4f3c('0x68'),_0x47eba3);return respondWithRpcPromise(_0x4f3c('0x5f'),_0x4f3c('0x69'),{'module':_0x4f3c('0x60')});})[_0x4f3c('0x28')](handleError(_0x471f70,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 6a65a6f..1396c02 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 _0xd3f9=['./voiceContext.attributes','define','VoiceContext','voice_contexts','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x35dbad,_0x410835){var _0x5722e5=function(_0x32c242){while(--_0x32c242){_0x35dbad['push'](_0x35dbad['shift']());}};_0x5722e5(++_0x410835);}(_0xd3f9,0x7d));var _0x9d3f=function(_0x2e1b4e,_0x464045){_0x2e1b4e=_0x2e1b4e-0x0;var _0x3ce7a9=_0xd3f9[_0x2e1b4e];return _0x3ce7a9;};'use strict';var _=require(_0x9d3f('0x0'));var util=require('util');var logger=require(_0x9d3f('0x1'))('api');var moment=require(_0x9d3f('0x2'));var BPromise=require(_0x9d3f('0x3'));var rp=require(_0x9d3f('0x4'));var fs=require('fs');var path=require(_0x9d3f('0x5'));var rimraf=require('rimraf');var config=require(_0x9d3f('0x6'));var attributes=require(_0x9d3f('0x7'));module['exports']=function(_0x3338d0,_0x3fb034){return _0x3338d0[_0x9d3f('0x8')](_0x9d3f('0x9'),attributes,{'tableName':_0x9d3f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54f7=['define','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x586ed,_0x56f823){var _0x294015=function(_0x138312){while(--_0x138312){_0x586ed['push'](_0x586ed['shift']());}};_0x294015(++_0x56f823);}(_0x54f7,0x6d));var _0x754f=function(_0x44d73c,_0x4c6366){_0x44d73c=_0x44d73c-0x0;var _0x670da6=_0x54f7[_0x44d73c];return _0x670da6;};'use strict';var _=require(_0x754f('0x0'));var util=require('util');var logger=require(_0x754f('0x1'))(_0x754f('0x2'));var moment=require('moment');var BPromise=require(_0x754f('0x3'));var rp=require(_0x754f('0x4'));var fs=require('fs');var path=require(_0x754f('0x5'));var rimraf=require('rimraf');var config=require(_0x754f('0x6'));var attributes=require('./voiceContext.attributes');module[_0x754f('0x7')]=function(_0x4afb3d,_0x5717cc){return _0x4afb3d[_0x754f('0x8')]('VoiceContext',attributes,{'tableName':'voice_contexts','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 f05d12d..f9b42b6 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 _0x21ad=['jayson/promise','client','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment'];(function(_0x3dc6f4,_0x362e2a){var _0x3b18e9=function(_0x5bf19e){while(--_0x5bf19e){_0x3dc6f4['push'](_0x3dc6f4['shift']());}};_0x3b18e9(++_0x362e2a);}(_0x21ad,0x85));var _0xd21a=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x21ad[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xd21a('0x0'));var util=require('util');var moment=require(_0xd21a('0x1'));var BPromise=require(_0xd21a('0x2'));var rs=require(_0xd21a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd21a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd21a('0x5'));var config=require(_0xd21a('0x6'));var jayson=require(_0xd21a('0x7'));var client=jayson[_0xd21a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25e0e4,_0x1c7fe9,_0xd4ad66){return new BPromise(function(_0x5f2195,_0x210f2f){return client[_0xd21a('0x9')](_0x25e0e4,_0xd4ad66)['then'](function(_0xf51795){logger[_0xd21a('0xa')]('VoiceContext,\x20%s,\x20%s',_0x1c7fe9,_0xd21a('0xb'));logger[_0xd21a('0xc')](_0xd21a('0xd'),_0x1c7fe9,_0xd21a('0xb'),JSON[_0xd21a('0xe')](_0xf51795));if(_0xf51795[_0xd21a('0xf')]){if(_0xf51795['error'][_0xd21a('0x10')]===0x1f4){logger[_0xd21a('0xf')]('VoiceContext,\x20%s,\x20%s',_0x1c7fe9,_0xf51795[_0xd21a('0xf')][_0xd21a('0x11')]);return _0x210f2f(_0xf51795[_0xd21a('0xf')][_0xd21a('0x11')]);}logger[_0xd21a('0xf')](_0xd21a('0x12'),_0x1c7fe9,_0xf51795[_0xd21a('0xf')]['message']);return _0x5f2195(_0xf51795['error'][_0xd21a('0x11')]);}else{logger[_0xd21a('0xa')](_0xd21a('0x12'),_0x1c7fe9,_0xd21a('0xb'));_0x5f2195(_0xf51795['result'][_0xd21a('0x11')]);}})[_0xd21a('0x13')](function(_0x4c6258){logger[_0xd21a('0xf')](_0xd21a('0x12'),_0x1c7fe9,_0x4c6258);_0x210f2f(_0x4c6258);});});} \ No newline at end of file +var _0x5269=['../../config/environment','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','ioredis','../../mysqldb','../../config/utils'];(function(_0x103e9b,_0x380a0d){var _0x282b01=function(_0x268179){while(--_0x268179){_0x103e9b['push'](_0x103e9b['shift']());}};_0x282b01(++_0x380a0d);}(_0x5269,0x150));var _0x9526=function(_0x358064,_0x45d0f6){_0x358064=_0x358064-0x0;var _0x4d3000=_0x5269[_0x358064];return _0x4d3000;};'use strict';var _=require(_0x9526('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9526('0x1'));var db=require(_0x9526('0x2'))['db'];var utils=require(_0x9526('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x9526('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x9526('0x5')][_0x9526('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2e217a,_0x2082b4,_0x1d4acf){return new BPromise(function(_0x4569a0,_0x161880){return client[_0x9526('0x7')](_0x2e217a,_0x1d4acf)[_0x9526('0x8')](function(_0x320908){logger[_0x9526('0x9')](_0x9526('0xa'),_0x2082b4,'request\x20sent');logger[_0x9526('0xb')](_0x9526('0xc'),_0x2082b4,'request\x20sent',JSON[_0x9526('0xd')](_0x320908));if(_0x320908[_0x9526('0xe')]){if(_0x320908[_0x9526('0xe')][_0x9526('0xf')]===0x1f4){logger[_0x9526('0xe')](_0x9526('0xa'),_0x2082b4,_0x320908[_0x9526('0xe')]['message']);return _0x161880(_0x320908[_0x9526('0xe')][_0x9526('0x10')]);}logger['error'](_0x9526('0xa'),_0x2082b4,_0x320908[_0x9526('0xe')]['message']);return _0x4569a0(_0x320908['error']['message']);}else{logger[_0x9526('0x9')]('VoiceContext,\x20%s,\x20%s',_0x2082b4,_0x9526('0x11'));_0x4569a0(_0x320908[_0x9526('0x12')][_0x9526('0x10')]);}})[_0x9526('0x13')](function(_0x3108ba){logger[_0x9526('0xe')]('VoiceContext,\x20%s,\x20%s',_0x2082b4,_0x3108ba);_0x161880(_0x3108ba);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 9a7f20a..e12a809 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 _0xdfe0=['/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index','describe'];(function(_0x3367a8,_0x396cd0){var _0x6acc4a=function(_0xfe8c73){while(--_0xfe8c73){_0x3367a8['push'](_0x3367a8['shift']());}};_0x6acc4a(++_0x396cd0);}(_0xdfe0,0xce));var _0x0dfe=function(_0x1c7d8a,_0x53fd75){_0x1c7d8a=_0x1c7d8a-0x0;var _0x42a4b8=_0xdfe0[_0x1c7d8a];return _0x42a4b8;};'use strict';var multer=require(_0x0dfe('0x0'));var util=require(_0x0dfe('0x1'));var path=require(_0x0dfe('0x2'));var timeout=require(_0x0dfe('0x3'));var express=require(_0x0dfe('0x4'));var router=express[_0x0dfe('0x5')]();var fs_extra=require(_0x0dfe('0x6'));var auth=require(_0x0dfe('0x7'));var interaction=require(_0x0dfe('0x8'));var config=require('../../config/environment');var controller=require(_0x0dfe('0x9'));router[_0x0dfe('0xa')]('/',auth[_0x0dfe('0xb')](),controller[_0x0dfe('0xc')]);router[_0x0dfe('0xa')]('/describe',auth[_0x0dfe('0xb')](),controller[_0x0dfe('0xd')]);router[_0x0dfe('0xa')](_0x0dfe('0xe'),auth[_0x0dfe('0xb')](),controller[_0x0dfe('0xf')]);router[_0x0dfe('0x10')]('/',auth[_0x0dfe('0xb')](),controller[_0x0dfe('0x11')]);router['put'](_0x0dfe('0xe'),auth[_0x0dfe('0xb')](),controller[_0x0dfe('0x12')]);router[_0x0dfe('0x13')](_0x0dfe('0xe'),auth[_0x0dfe('0xb')](),controller[_0x0dfe('0x14')]);module[_0x0dfe('0x15')]=router; \ No newline at end of file +var _0xb6b5=['show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xb6b5,0x1d5));var _0x5b6b=function(_0x2bced9,_0x239449){_0x2bced9=_0x2bced9-0x0;var _0x493a28=_0xb6b5[_0x2bced9];return _0x493a28;};'use strict';var multer=require(_0x5b6b('0x0'));var util=require(_0x5b6b('0x1'));var path=require(_0x5b6b('0x2'));var timeout=require(_0x5b6b('0x3'));var express=require(_0x5b6b('0x4'));var router=express[_0x5b6b('0x5')]();var fs_extra=require(_0x5b6b('0x6'));var auth=require(_0x5b6b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5b6b('0x8'));var controller=require('./voiceDialReport.controller');router[_0x5b6b('0x9')]('/',auth[_0x5b6b('0xa')](),controller[_0x5b6b('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x5b6b('0xc')]);router['get'](_0x5b6b('0xd'),auth[_0x5b6b('0xa')](),controller[_0x5b6b('0xe')]);router[_0x5b6b('0xf')]('/',auth[_0x5b6b('0xa')](),controller[_0x5b6b('0x10')]);router[_0x5b6b('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5b6b('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x5b6b('0x13')]);module[_0x5b6b('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index ca76996..85957c7 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 _0x34e8=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0xd1da52,_0x296da7){var _0x5cc9b6=function(_0x428ff5){while(--_0x428ff5){_0xd1da52['push'](_0xd1da52['shift']());}};_0x5cc9b6(++_0x296da7);}(_0x34e8,0x12c));var _0x834e=function(_0x240d9b,_0x4b5cf1){_0x240d9b=_0x240d9b-0x0;var _0x4f546f=_0x34e8[_0x240d9b];return _0x4f546f;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'privilege':{'type':Sequelize[_0x834e('0x2')]},'channel':{'type':Sequelize[_0x834e('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x834e('0x2')]},'calleridnum':{'type':Sequelize[_0x834e('0x2')]},'calleridname':{'type':Sequelize[_0x834e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x834e('0x2')]},'connectedlinename':{'type':Sequelize[_0x834e('0x2')]},'language':{'type':Sequelize[_0x834e('0x2')]},'accountcode':{'type':Sequelize[_0x834e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x834e('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x834e('0x2')]},'linkedid':{'type':Sequelize[_0x834e('0x2')]},'destchannel':{'type':Sequelize[_0x834e('0x2')]},'destchannelstate':{'type':Sequelize[_0x834e('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x834e('0x2')]},'destcalleridnum':{'type':Sequelize[_0x834e('0x2')]},'destcalleridname':{'type':Sequelize[_0x834e('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x834e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x834e('0x2')]},'destlanguage':{'type':Sequelize[_0x834e('0x2')]},'destaccountcode':{'type':Sequelize[_0x834e('0x2')]},'destcontext':{'type':Sequelize[_0x834e('0x2')]},'destexten':{'type':Sequelize[_0x834e('0x2')]},'destpriority':{'type':Sequelize[_0x834e('0x3')]},'destuniqueid':{'type':Sequelize[_0x834e('0x2')]},'destlinkedid':{'type':Sequelize[_0x834e('0x2')]},'dialstring':{'type':Sequelize[_0x834e('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x834e('0x4')]},'answertime':{'type':Sequelize[_0x834e('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x834e('0x2')],'comment':_0x834e('0x5')},'routeId':{'type':Sequelize[_0x834e('0x3')]},'duration':{'type':Sequelize[_0x834e('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x834e('0x3')]}}; \ No newline at end of file +var _0x55ca=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x597b5f,_0x4703b5){var _0x2b2b23=function(_0x11d973){while(--_0x11d973){_0x597b5f['push'](_0x597b5f['shift']());}};_0x2b2b23(++_0x4703b5);}(_0x55ca,0x126));var _0xa55c=function(_0x5d9a85,_0x55221e){_0x5d9a85=_0x5d9a85-0x0;var _0x1ef8aa=_0x55ca[_0x5d9a85];return _0x1ef8aa;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'calleridnum':{'type':Sequelize[_0xa55c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa55c('0x2')]},'connectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'language':{'type':Sequelize[_0xa55c('0x2')]},'accountcode':{'type':Sequelize[_0xa55c('0x2')]},'context':{'type':Sequelize[_0xa55c('0x2')]},'exten':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize[_0xa55c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xa55c('0x2')]},'destchannel':{'type':Sequelize[_0xa55c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'destlanguage':{'type':Sequelize[_0xa55c('0x2')]},'destaccountcode':{'type':Sequelize[_0xa55c('0x2')]},'destcontext':{'type':Sequelize[_0xa55c('0x2')]},'destexten':{'type':Sequelize[_0xa55c('0x2')]},'destpriority':{'type':Sequelize[_0xa55c('0x3')]},'destuniqueid':{'type':Sequelize[_0xa55c('0x2')]},'destlinkedid':{'type':Sequelize[_0xa55c('0x2')]},'dialstring':{'type':Sequelize[_0xa55c('0x2')]},'dialstatus':{'type':Sequelize[_0xa55c('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa55c('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xa55c('0x3')]},'holdtime':{'type':Sequelize[_0xa55c('0x3')]},'billableseconds':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index ec656b3..f52c50e 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 _0xf9af=['status','undefined','limit','count','offset','set','Content-Range','json','apply','update','destroy','then','stack','name','send','index','map','VoiceDialReport','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x5cc47d,_0x55146d){var _0x42bf6f=function(_0x5dcc20){while(--_0x5dcc20){_0x5cc47d['push'](_0x5cc47d['shift']());}};_0x42bf6f(++_0x55146d);}(_0xf9af,0x72));var _0xff9a=function(_0x3c86f7,_0x4d7e5d){_0x3c86f7=_0x3c86f7-0x0;var _0x22547d=_0xf9af[_0x3c86f7];return _0x22547d;};'use strict';var emlformat=require(_0xff9a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff9a('0x1'));var jsonpatch=require(_0xff9a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xff9a('0x3'));var Mustache=require(_0xff9a('0x4'));var util=require(_0xff9a('0x5'));var path=require('path');var sox=require(_0xff9a('0x6'));var csv=require('to-csv');var ejs=require(_0xff9a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xff9a('0x8'));var crypto=require(_0xff9a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xff9a('0xa'));var toCsv=require('to-csv');var querystring=require(_0xff9a('0xb'));var Papa=require('papaparse');var Redis=require(_0xff9a('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xff9a('0xd'));var as=require(_0xff9a('0xe'));var hardwareService=require(_0xff9a('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xff9a('0x10'));var config=require(_0xff9a('0x11'));var licenseUtil=require(_0xff9a('0x12'));var db=require(_0xff9a('0x13'))['db'];function respondWithStatusCode(_0x776caf,_0x4b1a56){_0x4b1a56=_0x4b1a56||0xcc;return function(_0x117c62){if(_0x117c62){return _0x776caf[_0xff9a('0x14')](_0x4b1a56);}return _0x776caf['status'](_0x4b1a56)[_0xff9a('0x15')]();};}function respondWithResult(_0x173c4d,_0x352f1b){_0x352f1b=_0x352f1b||0xc8;return function(_0x661c37){if(_0x661c37){return _0x173c4d[_0xff9a('0x16')](_0x352f1b)['json'](_0x661c37);}};}function respondWithFilteredResult(_0x523e58,_0x1d5e7d){return function(_0x551dde){if(_0x551dde){var _0x29f306=typeof _0x1d5e7d['offset']===_0xff9a('0x17')&&typeof _0x1d5e7d[_0xff9a('0x18')]==='undefined';var _0x54a43b=_0x551dde[_0xff9a('0x19')];var _0x1b563a=_0x29f306?0x0:_0x1d5e7d['offset'];var _0x18e0d9=_0x29f306?_0x551dde[_0xff9a('0x19')]:_0x1d5e7d[_0xff9a('0x1a')]+_0x1d5e7d[_0xff9a('0x18')];var _0x469670;if(_0x18e0d9>=_0x54a43b){_0x18e0d9=_0x54a43b;_0x469670=0xc8;}else{_0x469670=0xce;}_0x523e58[_0xff9a('0x16')](_0x469670);return _0x523e58[_0xff9a('0x1b')](_0xff9a('0x1c'),_0x1b563a+'-'+_0x18e0d9+'/'+_0x54a43b)[_0xff9a('0x1d')](_0x551dde);}return null;};}function patchUpdates(_0x4d0884){return function(_0x325701){try{jsonpatch[_0xff9a('0x1e')](_0x325701,_0x4d0884,!![]);}catch(_0x4d1314){return BPromise['reject'](_0x4d1314);}return _0x325701['save']();};}function saveUpdates(_0x860713,_0x26546b){return function(_0x5ccace){if(_0x5ccace){return _0x5ccace[_0xff9a('0x1f')](_0x860713)['then'](function(_0x4ad655){return _0x4ad655;});}return null;};}function removeEntity(_0x4b6ffd,_0xcf4600){return function(_0x2baa3d){if(_0x2baa3d){return _0x2baa3d[_0xff9a('0x20')]()[_0xff9a('0x21')](function(){_0x4b6ffd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52b1fa,_0x4a87fe){return function(_0x519943){if(!_0x519943){_0x52b1fa[_0xff9a('0x14')](0x194);}return _0x519943;};}function handleError(_0x2722e1,_0x2cea78){_0x2cea78=_0x2cea78||0x1f4;return function(_0x25f78a){logger['error'](_0x25f78a[_0xff9a('0x22')]);if(_0x25f78a[_0xff9a('0x23')]){delete _0x25f78a[_0xff9a('0x23')];}_0x2722e1[_0xff9a('0x16')](_0x2cea78)[_0xff9a('0x24')](_0x25f78a);};}exports[_0xff9a('0x25')]=function(_0x15a7f8,_0x422822){var _0x4f1bf9={},_0x39f342={},_0x162353={'count':0x0,'rows':[]};var _0x171a88=_[_0xff9a('0x26')](db[_0xff9a('0x27')][_0xff9a('0x28')],function(_0x3de50e){return{'name':_0x3de50e['fieldName'],'type':_0x3de50e[_0xff9a('0x29')]['key']};});_0x39f342[_0xff9a('0x2a')]=_[_0xff9a('0x26')](_0x171a88,_0xff9a('0x23'));_0x39f342[_0xff9a('0x2b')]=_[_0xff9a('0x2c')](_0x15a7f8['query']);_0x39f342[_0xff9a('0x2d')]=_['intersection'](_0x39f342['model'],_0x39f342[_0xff9a('0x2b')]);_0x4f1bf9[_0xff9a('0x2e')]=_[_0xff9a('0x2f')](_0x39f342['model'],qs[_0xff9a('0x30')](_0x15a7f8[_0xff9a('0x2b')][_0xff9a('0x30')]));_0x4f1bf9['attributes']=_0x4f1bf9['attributes'][_0xff9a('0x31')]?_0x4f1bf9['attributes']:_0x39f342[_0xff9a('0x2a')];if(!_0x15a7f8[_0xff9a('0x2b')][_0xff9a('0x32')](_0xff9a('0x33'))){_0x4f1bf9[_0xff9a('0x18')]=qs['limit'](_0x15a7f8['query']['limit']);_0x4f1bf9['offset']=qs[_0xff9a('0x1a')](_0x15a7f8[_0xff9a('0x2b')][_0xff9a('0x1a')]);}_0x4f1bf9[_0xff9a('0x34')]=qs[_0xff9a('0x35')](_0x15a7f8[_0xff9a('0x2b')][_0xff9a('0x35')]);_0x4f1bf9[_0xff9a('0x36')]=qs[_0xff9a('0x2d')](_['pick'](_0x15a7f8[_0xff9a('0x2b')],_0x39f342['filters']),_0x171a88);if(_0x15a7f8['query']['filter']){_0x4f1bf9['where']=_[_0xff9a('0x37')](_0x4f1bf9[_0xff9a('0x36')],{'$or':_[_0xff9a('0x26')](_0x171a88,function(_0x526f51){if(_0x526f51[_0xff9a('0x29')]!==_0xff9a('0x38')){var _0x20cde0={};_0x20cde0[_0x526f51[_0xff9a('0x23')]]={'$like':'%'+_0x15a7f8['query'][_0xff9a('0x39')]+'%'};return _0x20cde0;}})});}_0x4f1bf9=_['merge']({},_0x4f1bf9,_0x15a7f8[_0xff9a('0x3a')]);var _0x3e8841={'where':_0x4f1bf9[_0xff9a('0x36')]};return db[_0xff9a('0x27')][_0xff9a('0x19')](_0x3e8841)['then'](function(_0x3b70e8){_0x162353['count']=_0x3b70e8;if(_0x15a7f8[_0xff9a('0x2b')][_0xff9a('0x3b')]){_0x4f1bf9[_0xff9a('0x3c')]=[{'all':!![]}];}return db[_0xff9a('0x27')][_0xff9a('0x3d')](_0x4f1bf9);})['then'](function(_0x2b4251){_0x162353['rows']=_0x2b4251;return _0x162353;})[_0xff9a('0x21')](respondWithFilteredResult(_0x422822,_0x4f1bf9))[_0xff9a('0x3e')](handleError(_0x422822,null));};exports['show']=function(_0x27ae04,_0xd63ae4){var _0x5bb562={'raw':!![],'where':{'id':_0x27ae04['params']['id']}},_0xb757ff={};_0xb757ff['model']=_[_0xff9a('0x2c')](db[_0xff9a('0x27')][_0xff9a('0x28')]);_0xb757ff[_0xff9a('0x2b')]=_[_0xff9a('0x2c')](_0x27ae04[_0xff9a('0x2b')]);_0xb757ff['filters']=_['intersection'](_0xb757ff[_0xff9a('0x2a')],_0xb757ff[_0xff9a('0x2b')]);_0x5bb562[_0xff9a('0x2e')]=_[_0xff9a('0x2f')](_0xb757ff[_0xff9a('0x2a')],qs[_0xff9a('0x30')](_0x27ae04['query'][_0xff9a('0x30')]));_0x5bb562['attributes']=_0x5bb562[_0xff9a('0x2e')][_0xff9a('0x31')]?_0x5bb562['attributes']:_0xb757ff[_0xff9a('0x2a')];if(_0x27ae04[_0xff9a('0x2b')][_0xff9a('0x3b')]){_0x5bb562[_0xff9a('0x3c')]=[{'all':!![]}];}_0x5bb562=_['merge']({},_0x5bb562,_0x27ae04[_0xff9a('0x3a')]);return db[_0xff9a('0x27')][_0xff9a('0x3f')](_0x5bb562)[_0xff9a('0x21')](handleEntityNotFound(_0xd63ae4,null))['then'](respondWithResult(_0xd63ae4,null))[_0xff9a('0x3e')](handleError(_0xd63ae4,null));};exports[_0xff9a('0x40')]=function(_0x2ac092,_0x33b6e6){return db[_0xff9a('0x27')]['create'](_0x2ac092[_0xff9a('0x41')],{})[_0xff9a('0x21')](respondWithResult(_0x33b6e6,0xc9))[_0xff9a('0x3e')](handleError(_0x33b6e6,null));};exports[_0xff9a('0x1f')]=function(_0x2cd4f2,_0x217b22){if(_0x2cd4f2['body']['id']){delete _0x2cd4f2[_0xff9a('0x41')]['id'];}return db[_0xff9a('0x27')][_0xff9a('0x3f')]({'where':{'id':_0x2cd4f2[_0xff9a('0x42')]['id']}})[_0xff9a('0x21')](handleEntityNotFound(_0x217b22,null))[_0xff9a('0x21')](saveUpdates(_0x2cd4f2['body'],null))[_0xff9a('0x21')](respondWithResult(_0x217b22,null))[_0xff9a('0x3e')](handleError(_0x217b22,null));};exports[_0xff9a('0x20')]=function(_0x381199,_0x359d27){return db[_0xff9a('0x27')]['find']({'where':{'id':_0x381199[_0xff9a('0x42')]['id']}})[_0xff9a('0x21')](handleEntityNotFound(_0x359d27,null))[_0xff9a('0x21')](removeEntity(_0x359d27,null))['catch'](handleError(_0x359d27,null));};exports[_0xff9a('0x43')]=function(_0x149f41,_0x3bee48){return db['VoiceDialReport'][_0xff9a('0x43')]()[_0xff9a('0x21')](respondWithResult(_0x3bee48,null))['catch'](handleError(_0x3bee48,null));}; \ No newline at end of file +var _0x390d=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type'];(function(_0x2daef6,_0xcac228){var _0x62d030=function(_0x26a7d6){while(--_0x26a7d6){_0x2daef6['push'](_0x2daef6['shift']());}};_0x62d030(++_0xcac228);}(_0x390d,0x1a3));var _0xd390=function(_0x129d00,_0x18ee94){_0x129d00=_0x129d00-0x0;var _0x3cbfe0=_0x390d[_0x129d00];return _0x3cbfe0;};'use strict';var emlformat=require(_0xd390('0x0'));var rimraf=require(_0xd390('0x1'));var zipdir=require(_0xd390('0x2'));var jsonpatch=require(_0xd390('0x3'));var rp=require(_0xd390('0x4'));var moment=require(_0xd390('0x5'));var BPromise=require(_0xd390('0x6'));var Mustache=require(_0xd390('0x7'));var util=require(_0xd390('0x8'));var path=require(_0xd390('0x9'));var sox=require('sox');var csv=require(_0xd390('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd390('0xb'));var _=require('lodash');var squel=require(_0xd390('0xc'));var crypto=require(_0xd390('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd390('0xa'));var querystring=require(_0xd390('0xe'));var Papa=require(_0xd390('0xf'));var Redis=require(_0xd390('0x10'));var authService=require(_0xd390('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd390('0x12'));var hardwareService=require(_0xd390('0x13'));var logger=require(_0xd390('0x14'))(_0xd390('0x15'));var utils=require(_0xd390('0x16'));var config=require(_0xd390('0x17'));var licenseUtil=require(_0xd390('0x18'));var db=require(_0xd390('0x19'))['db'];function respondWithStatusCode(_0x1f83ef,_0x5bd9be){_0x5bd9be=_0x5bd9be||0xcc;return function(_0x5bfc78){if(_0x5bfc78){return _0x1f83ef[_0xd390('0x1a')](_0x5bd9be);}return _0x1f83ef[_0xd390('0x1b')](_0x5bd9be)[_0xd390('0x1c')]();};}function respondWithResult(_0xc85afe,_0x5d4c05){_0x5d4c05=_0x5d4c05||0xc8;return function(_0x3b6b57){if(_0x3b6b57){return _0xc85afe['status'](_0x5d4c05)[_0xd390('0x1d')](_0x3b6b57);}};}function respondWithFilteredResult(_0x3d6ec0,_0x237509){return function(_0x30873c){if(_0x30873c){var _0x161d6e=typeof _0x237509[_0xd390('0x1e')]==='undefined'&&typeof _0x237509['limit']===_0xd390('0x1f');var _0x3ba048=_0x30873c[_0xd390('0x20')];var _0x367815=_0x161d6e?0x0:_0x237509['offset'];var _0x216ea6=_0x161d6e?_0x30873c[_0xd390('0x20')]:_0x237509[_0xd390('0x1e')]+_0x237509[_0xd390('0x21')];var _0xe12a3f;if(_0x216ea6>=_0x3ba048){_0x216ea6=_0x3ba048;_0xe12a3f=0xc8;}else{_0xe12a3f=0xce;}_0x3d6ec0['status'](_0xe12a3f);return _0x3d6ec0['set'](_0xd390('0x22'),_0x367815+'-'+_0x216ea6+'/'+_0x3ba048)[_0xd390('0x1d')](_0x30873c);}return null;};}function patchUpdates(_0x1ab38e){return function(_0x3bf8a4){try{jsonpatch[_0xd390('0x23')](_0x3bf8a4,_0x1ab38e,!![]);}catch(_0x3d1738){return BPromise['reject'](_0x3d1738);}return _0x3bf8a4[_0xd390('0x24')]();};}function saveUpdates(_0x55a8a6,_0x4d3a45){return function(_0x32c817){if(_0x32c817){return _0x32c817[_0xd390('0x25')](_0x55a8a6)[_0xd390('0x26')](function(_0x3d02cd){return _0x3d02cd;});}return null;};}function removeEntity(_0x130059,_0x1594d4){return function(_0x82231d){if(_0x82231d){return _0x82231d['destroy']()[_0xd390('0x26')](function(){_0x130059[_0xd390('0x1b')](0xcc)[_0xd390('0x1c')]();});}};}function handleEntityNotFound(_0xcc1ead,_0x51608b){return function(_0xc2ed09){if(!_0xc2ed09){_0xcc1ead[_0xd390('0x1a')](0x194);}return _0xc2ed09;};}function handleError(_0x5cd3bd,_0x7ffad2){_0x7ffad2=_0x7ffad2||0x1f4;return function(_0x1e8132){logger[_0xd390('0x27')](_0x1e8132[_0xd390('0x28')]);if(_0x1e8132[_0xd390('0x29')]){delete _0x1e8132[_0xd390('0x29')];}_0x5cd3bd[_0xd390('0x1b')](_0x7ffad2)[_0xd390('0x2a')](_0x1e8132);};}exports[_0xd390('0x2b')]=function(_0xd12f8d,_0x306b99){var _0x3c744a={},_0x5e040a={},_0x5b8967={'count':0x0,'rows':[]};var _0x1f58f5=_[_0xd390('0x2c')](db[_0xd390('0x2d')][_0xd390('0x2e')],function(_0xea3291){return{'name':_0xea3291[_0xd390('0x2f')],'type':_0xea3291[_0xd390('0x30')][_0xd390('0x31')]};});_0x5e040a[_0xd390('0x32')]=_['map'](_0x1f58f5,_0xd390('0x29'));_0x5e040a[_0xd390('0x33')]=_[_0xd390('0x34')](_0xd12f8d[_0xd390('0x33')]);_0x5e040a[_0xd390('0x35')]=_[_0xd390('0x36')](_0x5e040a['model'],_0x5e040a[_0xd390('0x33')]);_0x3c744a[_0xd390('0x37')]=_[_0xd390('0x36')](_0x5e040a[_0xd390('0x32')],qs[_0xd390('0x38')](_0xd12f8d[_0xd390('0x33')]['fields']));_0x3c744a[_0xd390('0x37')]=_0x3c744a[_0xd390('0x37')][_0xd390('0x39')]?_0x3c744a[_0xd390('0x37')]:_0x5e040a[_0xd390('0x32')];if(!_0xd12f8d[_0xd390('0x33')][_0xd390('0x3a')](_0xd390('0x3b'))){_0x3c744a[_0xd390('0x21')]=qs[_0xd390('0x21')](_0xd12f8d[_0xd390('0x33')][_0xd390('0x21')]);_0x3c744a[_0xd390('0x1e')]=qs['offset'](_0xd12f8d[_0xd390('0x33')][_0xd390('0x1e')]);}_0x3c744a[_0xd390('0x3c')]=qs[_0xd390('0x3d')](_0xd12f8d[_0xd390('0x33')][_0xd390('0x3d')]);_0x3c744a[_0xd390('0x3e')]=qs[_0xd390('0x35')](_[_0xd390('0x3f')](_0xd12f8d[_0xd390('0x33')],_0x5e040a['filters']),_0x1f58f5);if(_0xd12f8d[_0xd390('0x33')][_0xd390('0x40')]){_0x3c744a[_0xd390('0x3e')]=_[_0xd390('0x41')](_0x3c744a[_0xd390('0x3e')],{'$or':_['map'](_0x1f58f5,function(_0x5d3139){if(_0x5d3139[_0xd390('0x30')]!=='VIRTUAL'){var _0x130334={};_0x130334[_0x5d3139[_0xd390('0x29')]]={'$like':'%'+_0xd12f8d[_0xd390('0x33')][_0xd390('0x40')]+'%'};return _0x130334;}})});}_0x3c744a=_[_0xd390('0x41')]({},_0x3c744a,_0xd12f8d[_0xd390('0x42')]);var _0x52f97f={'where':_0x3c744a[_0xd390('0x3e')]};return db[_0xd390('0x2d')][_0xd390('0x20')](_0x52f97f)[_0xd390('0x26')](function(_0x4ecfe0){_0x5b8967[_0xd390('0x20')]=_0x4ecfe0;if(_0xd12f8d['query'][_0xd390('0x43')]){_0x3c744a['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0xd390('0x44')](_0x3c744a);})['then'](function(_0x37d6e1){_0x5b8967[_0xd390('0x45')]=_0x37d6e1;return _0x5b8967;})[_0xd390('0x26')](respondWithFilteredResult(_0x306b99,_0x3c744a))[_0xd390('0x46')](handleError(_0x306b99,null));};exports[_0xd390('0x47')]=function(_0x2241e4,_0x56284b){var _0x3e078a={'raw':!![],'where':{'id':_0x2241e4[_0xd390('0x48')]['id']}},_0x411e37={};_0x411e37[_0xd390('0x32')]=_[_0xd390('0x34')](db['VoiceDialReport']['rawAttributes']);_0x411e37[_0xd390('0x33')]=_[_0xd390('0x34')](_0x2241e4['query']);_0x411e37[_0xd390('0x35')]=_['intersection'](_0x411e37['model'],_0x411e37[_0xd390('0x33')]);_0x3e078a['attributes']=_['intersection'](_0x411e37['model'],qs[_0xd390('0x38')](_0x2241e4[_0xd390('0x33')][_0xd390('0x38')]));_0x3e078a[_0xd390('0x37')]=_0x3e078a[_0xd390('0x37')][_0xd390('0x39')]?_0x3e078a['attributes']:_0x411e37['model'];if(_0x2241e4['query']['includeAll']){_0x3e078a['include']=[{'all':!![]}];}_0x3e078a=_['merge']({},_0x3e078a,_0x2241e4[_0xd390('0x42')]);return db['VoiceDialReport'][_0xd390('0x49')](_0x3e078a)[_0xd390('0x26')](handleEntityNotFound(_0x56284b,null))[_0xd390('0x26')](respondWithResult(_0x56284b,null))[_0xd390('0x46')](handleError(_0x56284b,null));};exports[_0xd390('0x4a')]=function(_0x174d0e,_0x17ff9c){return db['VoiceDialReport'][_0xd390('0x4a')](_0x174d0e[_0xd390('0x4b')],{})['then'](respondWithResult(_0x17ff9c,0xc9))['catch'](handleError(_0x17ff9c,null));};exports['update']=function(_0x8803e5,_0x433b5b){if(_0x8803e5[_0xd390('0x4b')]['id']){delete _0x8803e5[_0xd390('0x4b')]['id'];}return db[_0xd390('0x2d')]['find']({'where':{'id':_0x8803e5[_0xd390('0x48')]['id']}})['then'](handleEntityNotFound(_0x433b5b,null))['then'](saveUpdates(_0x8803e5[_0xd390('0x4b')],null))[_0xd390('0x26')](respondWithResult(_0x433b5b,null))['catch'](handleError(_0x433b5b,null));};exports[_0xd390('0x4c')]=function(_0x452f29,_0x5dd4f3){return db[_0xd390('0x2d')][_0xd390('0x49')]({'where':{'id':_0x452f29[_0xd390('0x48')]['id']}})[_0xd390('0x26')](handleEntityNotFound(_0x5dd4f3,null))[_0xd390('0x26')](removeEntity(_0x5dd4f3,null))[_0xd390('0x46')](handleError(_0x5dd4f3,null));};exports[_0xd390('0x4d')]=function(_0x2ba447,_0x274743){return db['VoiceDialReport'][_0xd390('0x4d')]()[_0xd390('0x26')](respondWithResult(_0x274743,null))['catch'](handleError(_0x274743,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 03fda15..a6e4f95 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 _0x39a9=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','report_dial','uniqueid','lodash'];(function(_0x51cb73,_0x2d0f20){var _0x4eb0bd=function(_0x3ba4b3){while(--_0x3ba4b3){_0x51cb73['push'](_0x51cb73['shift']());}};_0x4eb0bd(++_0x2d0f20);}(_0x39a9,0x1d0));var _0x939a=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0x39a9[_0x22dac7];return _0x3e6cfa;};'use strict';var _=require(_0x939a('0x0'));var util=require(_0x939a('0x1'));var logger=require(_0x939a('0x2'))(_0x939a('0x3'));var moment=require(_0x939a('0x4'));var BPromise=require(_0x939a('0x5'));var rp=require(_0x939a('0x6'));var fs=require('fs');var path=require(_0x939a('0x7'));var rimraf=require(_0x939a('0x8'));var config=require(_0x939a('0x9'));var attributes=require(_0x939a('0xa'));module['exports']=function(_0x5793fe,_0xed3974){return _0x5793fe[_0x939a('0xb')](_0x939a('0xc'),attributes,{'tableName':_0x939a('0xd'),'paranoid':![],'indexes':[{'fields':[_0x939a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa0d6=['uniqueid','lodash','util','api','moment','bluebird','../../config/environment','./voiceDialReport.attributes','exports','define','report_dial'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xa0d6,0x1f0));var _0x6a0d=function(_0x131e10,_0x28cfea){_0x131e10=_0x131e10-0x0;var _0x18320e=_0xa0d6[_0x131e10];return _0x18320e;};'use strict';var _=require(_0x6a0d('0x0'));var util=require(_0x6a0d('0x1'));var logger=require('../../config/logger')(_0x6a0d('0x2'));var moment=require(_0x6a0d('0x3'));var BPromise=require(_0x6a0d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6a0d('0x5'));var attributes=require(_0x6a0d('0x6'));module[_0x6a0d('0x7')]=function(_0x525d3b,_0x4ec26e){return _0x525d3b[_0x6a0d('0x8')]('VoiceDialReport',attributes,{'tableName':_0x6a0d('0x9'),'paranoid':![],'indexes':[{'fields':[_0x6a0d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 0d1c877..6933b89 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 _0xd5a7=['client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','create','raw','debug','UpdateVoiceDialReport','body','options','where','attributes','limit','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x134f7e,_0x314f4e){var _0x29d76e=function(_0x537e01){while(--_0x537e01){_0x134f7e['push'](_0x134f7e['shift']());}};_0x29d76e(++_0x314f4e);}(_0xd5a7,0xcb));var _0x7d5a=function(_0x48c2f0,_0xce7a9d){_0x48c2f0=_0x48c2f0-0x0;var _0x20e185=_0xd5a7[_0x48c2f0];return _0x20e185;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7d5a('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d5a('0x1'));var db=require(_0x7d5a('0x2'))['db'];var utils=require(_0x7d5a('0x3'));var logger=require(_0x7d5a('0x4'))(_0x7d5a('0x5'));var config=require('../../config/environment');var jayson=require(_0x7d5a('0x6'));var client=jayson[_0x7d5a('0x7')][_0x7d5a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2520fe,_0x4368c2,_0xbf97bf){return new BPromise(function(_0x208df7,_0x298b4c){return client[_0x7d5a('0x9')](_0x2520fe,_0xbf97bf)[_0x7d5a('0xa')](function(_0x26fc55){logger[_0x7d5a('0xb')](_0x7d5a('0xc'),_0x4368c2,_0x7d5a('0xd'));logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x4368c2,_0x7d5a('0xd'),JSON[_0x7d5a('0xe')](_0x26fc55));if(_0x26fc55[_0x7d5a('0xf')]){if(_0x26fc55[_0x7d5a('0xf')][_0x7d5a('0x10')]===0x1f4){logger['error'](_0x7d5a('0xc'),_0x4368c2,_0x26fc55['error'][_0x7d5a('0x11')]);return _0x298b4c(_0x26fc55['error'][_0x7d5a('0x11')]);}logger[_0x7d5a('0xf')](_0x7d5a('0xc'),_0x4368c2,_0x26fc55[_0x7d5a('0xf')][_0x7d5a('0x11')]);return _0x208df7(_0x26fc55[_0x7d5a('0xf')]['message']);}else{logger[_0x7d5a('0xb')](_0x7d5a('0xc'),_0x4368c2,_0x7d5a('0xd'));_0x208df7(_0x26fc55['result'][_0x7d5a('0x11')]);}})[_0x7d5a('0x12')](function(_0x257866){logger[_0x7d5a('0xf')](_0x7d5a('0xc'),_0x4368c2,_0x257866);_0x298b4c(_0x257866);});});}exports[_0x7d5a('0x13')]=function(_0x1197f8){var _0x12d3e2=this;return new Promise(function(_0x5a9005,_0x53469c){return db[_0x7d5a('0x14')][_0x7d5a('0x15')](_0x1197f8['body'],{'raw':_0x1197f8['options']?_0x1197f8['options'][_0x7d5a('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x25ff3b){logger[_0x7d5a('0xb')](_0x7d5a('0x13'),_0x1197f8);logger[_0x7d5a('0x17')](_0x7d5a('0x13'),_0x1197f8,JSON[_0x7d5a('0xe')](_0x25ff3b));_0x5a9005(_0x25ff3b);})[_0x7d5a('0x12')](function(_0x3f65a0){logger[_0x7d5a('0xf')]('CreateVoiceDialReport',_0x3f65a0[_0x7d5a('0x11')],_0x1197f8);_0x53469c(_0x12d3e2['error'](0x1f4,_0x3f65a0[_0x7d5a('0x11')]));});});};exports[_0x7d5a('0x18')]=function(_0x3ec76e){var _0xd109bd=this;return new Promise(function(_0x5f5b05,_0x345806){return db[_0x7d5a('0x14')]['update'](_0x3ec76e[_0x7d5a('0x19')],{'raw':_0x3ec76e[_0x7d5a('0x1a')]?_0x3ec76e[_0x7d5a('0x1a')][_0x7d5a('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ec76e['options']?_0x3ec76e[_0x7d5a('0x1a')][_0x7d5a('0x1b')]||null:null,'attributes':_0x3ec76e[_0x7d5a('0x1a')]?_0x3ec76e[_0x7d5a('0x1a')][_0x7d5a('0x1c')]||null:null,'limit':_0x3ec76e[_0x7d5a('0x1a')]?_0x3ec76e['options'][_0x7d5a('0x1d')]||null:null})[_0x7d5a('0xa')](function(_0xbcc35a){logger[_0x7d5a('0xb')]('UpdateVoiceDialReport',_0x3ec76e);logger[_0x7d5a('0x17')](_0x7d5a('0x18'),_0x3ec76e,JSON[_0x7d5a('0xe')](_0xbcc35a));_0x5f5b05(_0xbcc35a);})[_0x7d5a('0x12')](function(_0x59498d){logger[_0x7d5a('0xf')](_0x7d5a('0x18'),_0x59498d[_0x7d5a('0x11')],_0x3ec76e);_0x345806(_0xd109bd[_0x7d5a('0xf')](0x1f4,_0x59498d['message']));});});}; \ No newline at end of file +var _0x4799=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','CreateVoiceDialReport','body','raw','then','UpdateVoiceDialReport','VoiceDialReport','update','options','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x27d822,_0xdc4c20){var _0x1745c6=function(_0x40b389){while(--_0x40b389){_0x27d822['push'](_0x27d822['shift']());}};_0x1745c6(++_0xdc4c20);}(_0x4799,0x1ba));var _0x9479=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4799[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9479('0x0'));var util=require(_0x9479('0x1'));var moment=require(_0x9479('0x2'));var BPromise=require(_0x9479('0x3'));var rs=require(_0x9479('0x4'));var fs=require('fs');var Redis=require(_0x9479('0x5'));var db=require(_0x9479('0x6'))['db'];var utils=require(_0x9479('0x7'));var logger=require(_0x9479('0x8'))(_0x9479('0x9'));var config=require(_0x9479('0xa'));var jayson=require(_0x9479('0xb'));var client=jayson['client'][_0x9479('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f42cc,_0x3d9f2e,_0x149656){return new BPromise(function(_0x470230,_0x3779b6){return client['request'](_0x1f42cc,_0x149656)['then'](function(_0x3e6aed){logger[_0x9479('0xd')](_0x9479('0xe'),_0x3d9f2e,_0x9479('0xf'));logger[_0x9479('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x3d9f2e,'request\x20sent',JSON[_0x9479('0x11')](_0x3e6aed));if(_0x3e6aed['error']){if(_0x3e6aed[_0x9479('0x12')]['code']===0x1f4){logger[_0x9479('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x3d9f2e,_0x3e6aed[_0x9479('0x12')][_0x9479('0x13')]);return _0x3779b6(_0x3e6aed[_0x9479('0x12')][_0x9479('0x13')]);}logger[_0x9479('0x12')](_0x9479('0xe'),_0x3d9f2e,_0x3e6aed['error'][_0x9479('0x13')]);return _0x470230(_0x3e6aed['error'][_0x9479('0x13')]);}else{logger[_0x9479('0xd')](_0x9479('0xe'),_0x3d9f2e,_0x9479('0xf'));_0x470230(_0x3e6aed['result']['message']);}})[_0x9479('0x14')](function(_0x11ecaf){logger[_0x9479('0x12')](_0x9479('0xe'),_0x3d9f2e,_0x11ecaf);_0x3779b6(_0x11ecaf);});});}exports[_0x9479('0x15')]=function(_0x3a4559){var _0x150b5a=this;return new Promise(function(_0x33ed5e,_0x5ad17f){return db['VoiceDialReport']['create'](_0x3a4559[_0x9479('0x16')],{'raw':_0x3a4559['options']?_0x3a4559['options'][_0x9479('0x17')]===undefined?!![]:![]:!![]})[_0x9479('0x18')](function(_0x5b5887){logger[_0x9479('0xd')](_0x9479('0x15'),_0x3a4559);logger['debug'](_0x9479('0x15'),_0x3a4559,JSON[_0x9479('0x11')](_0x5b5887));_0x33ed5e(_0x5b5887);})[_0x9479('0x14')](function(_0x5de498){logger[_0x9479('0x12')]('CreateVoiceDialReport',_0x5de498[_0x9479('0x13')],_0x3a4559);_0x5ad17f(_0x150b5a[_0x9479('0x12')](0x1f4,_0x5de498[_0x9479('0x13')]));});});};exports[_0x9479('0x19')]=function(_0x4d8d90){var _0x234501=this;return new Promise(function(_0x35372a,_0x118e2a){return db[_0x9479('0x1a')][_0x9479('0x1b')](_0x4d8d90[_0x9479('0x16')],{'raw':_0x4d8d90[_0x9479('0x1c')]?_0x4d8d90['options'][_0x9479('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d8d90[_0x9479('0x1c')]?_0x4d8d90[_0x9479('0x1c')][_0x9479('0x1d')]||null:null,'attributes':_0x4d8d90[_0x9479('0x1c')]?_0x4d8d90[_0x9479('0x1c')][_0x9479('0x1e')]||null:null,'limit':_0x4d8d90[_0x9479('0x1c')]?_0x4d8d90[_0x9479('0x1c')][_0x9479('0x1f')]||null:null})[_0x9479('0x18')](function(_0x2068b9){logger[_0x9479('0xd')](_0x9479('0x19'),_0x4d8d90);logger[_0x9479('0x10')]('UpdateVoiceDialReport',_0x4d8d90,JSON[_0x9479('0x11')](_0x2068b9));_0x35372a(_0x2068b9);})[_0x9479('0x14')](function(_0x543db9){logger['error'](_0x9479('0x19'),_0x543db9[_0x9479('0x13')],_0x4d8d90);_0x118e2a(_0x234501[_0x9479('0x12')](0x1f4,_0x543db9[_0x9479('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 4d56200..39527b7 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 _0xfdee=['/:id/applications','put','/:id','update','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','create','post'];(function(_0x20d54d,_0x1adc8e){var _0x516e8b=function(_0x2754e1){while(--_0x2754e1){_0x20d54d['push'](_0x20d54d['shift']());}};_0x516e8b(++_0x1adc8e);}(_0xfdee,0x78));var _0xefde=function(_0x436add,_0x368cf0){_0x436add=_0x436add-0x0;var _0x413ba6=_0xfdee[_0x436add];return _0x413ba6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xefde('0x0'));var express=require(_0xefde('0x1'));var router=express[_0xefde('0x2')]();var fs_extra=require(_0xefde('0x3'));var auth=require(_0xefde('0x4'));var interaction=require(_0xefde('0x5'));var config=require(_0xefde('0x6'));var controller=require('./voiceExtension.controller');router[_0xefde('0x7')]('/',auth['isAuthenticated'](),controller[_0xefde('0x8')]);router[_0xefde('0x7')]('/:id',auth[_0xefde('0x9')](),controller[_0xefde('0xa')]);router['post']('/',auth[_0xefde('0x9')](),controller[_0xefde('0xb')]);router[_0xefde('0xc')](_0xefde('0xd'),auth[_0xefde('0x9')](),controller['addApplications']);router[_0xefde('0xe')](_0xefde('0xf'),auth['isAuthenticated'](),controller[_0xefde('0x10')]);router['delete'](_0xefde('0xf'),auth[_0xefde('0x9')](),controller[_0xefde('0x11')]);module[_0xefde('0x12')]=router; \ No newline at end of file +var _0xd34f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index','get','show','create','post','/:id/applications','addApplications','put','/:id','delete','exports','multer','path','connect-timeout','express'];(function(_0x45cce9,_0x26a0e9){var _0x445b5b=function(_0x53f8a6){while(--_0x53f8a6){_0x45cce9['push'](_0x45cce9['shift']());}};_0x445b5b(++_0x26a0e9);}(_0xd34f,0x14c));var _0xfd34=function(_0x2a92a4,_0x5ca2ec){_0x2a92a4=_0x2a92a4-0x0;var _0x383acc=_0xd34f[_0x2a92a4];return _0x383acc;};'use strict';var multer=require(_0xfd34('0x0'));var util=require('util');var path=require(_0xfd34('0x1'));var timeout=require(_0xfd34('0x2'));var express=require(_0xfd34('0x3'));var router=express['Router']();var fs_extra=require(_0xfd34('0x4'));var auth=require(_0xfd34('0x5'));var interaction=require(_0xfd34('0x6'));var config=require(_0xfd34('0x7'));var controller=require(_0xfd34('0x8'));router['get']('/',auth[_0xfd34('0x9')](),controller[_0xfd34('0xa')]);router[_0xfd34('0xb')]('/:id',auth[_0xfd34('0x9')](),controller[_0xfd34('0xc')]);router['post']('/',auth[_0xfd34('0x9')](),controller[_0xfd34('0xd')]);router[_0xfd34('0xe')](_0xfd34('0xf'),auth[_0xfd34('0x9')](),controller[_0xfd34('0x10')]);router[_0xfd34('0x11')](_0xfd34('0x12'),auth[_0xfd34('0x9')](),controller['update']);router[_0xfd34('0x13')](_0xfd34('0x12'),auth[_0xfd34('0x9')](),controller['destroy']);module[_0xfd34('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 82b644f..b85703c 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 _0x0713=['internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','STRING','compositeIndex','NoOp','ENUM','inbound','outbound'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'priority':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':_0x3071('0x2')},'appdata':{'type':Sequelize[_0x3071('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3071('0x3')](_0x3071('0x4'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x3071('0x0')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3071('0xb')},'IntervalId':{'type':Sequelize[_0x3071('0xc')]},'isApp':{'type':Sequelize[_0x3071('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x3071('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x3071('0x0')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3071('0xc')]},'recordingFormat':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0xe')},'answer':{'type':Sequelize[_0x3071('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x3071('0xf')],'get':function(){return this['getDataValue']('exten');}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x872f6f,_0x5efe7b){var _0x59a5f4=function(_0x147463){while(--_0x147463){_0x872f6f['push'](_0x872f6f['shift']());}};_0x59a5f4(++_0x5efe7b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(){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 2f55cf7..6ba21e2 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 _0x0a92=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','destroy','then','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','value','includes','type','find','name','UserProfileResource','end','error','stack','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','VoiceExtension','includeAll','include','findAll','rows','show','params','catch','create','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','sequelize','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0a92,0xb1));var _0x20a9=function(_0xd5709b,_0x101823){_0xd5709b=_0xd5709b-0x0;var _0x3dc484=_0x0a92[_0xd5709b];return _0x3dc484;};'use strict';var _=require('lodash');var Redis=require(_0x20a9('0x0'));var qs=require(_0x20a9('0x1'));var logger=require(_0x20a9('0x2'))('api');var config=require(_0x20a9('0x3'));var db=require(_0x20a9('0x4'))['db'];config[_0x20a9('0x5')]=_[_0x20a9('0x6')](config[_0x20a9('0x5')],{'host':_0x20a9('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x20a9('0x5')]));require(_0x20a9('0x8'))['register'](socket);function respondWithStatusCode(_0x3dabaa,_0x106b33){_0x106b33=_0x106b33||0xcc;return function(_0x65ec0d){if(_0x65ec0d){return _0x3dabaa[_0x20a9('0x9')](_0x106b33);}return _0x3dabaa[_0x20a9('0xa')](_0x106b33)['end']();};}function respondWithResult(_0x42e05a,_0x313b1e){_0x313b1e=_0x313b1e||0xc8;return function(_0x30fdfd){if(_0x30fdfd){return _0x42e05a[_0x20a9('0xa')](_0x313b1e)[_0x20a9('0xb')](_0x30fdfd);}};}function respondWithFilteredResult(_0x430acc,_0x2d3610){return function(_0x168de2){if(_0x168de2){var _0x2412ff=typeof _0x2d3610[_0x20a9('0xc')]===_0x20a9('0xd')&&typeof _0x2d3610[_0x20a9('0xe')]===_0x20a9('0xd');var _0x421ddc=_0x168de2['count'];var _0x8287a8=_0x2412ff?0x0:_0x2d3610[_0x20a9('0xc')];var _0x4df758=_0x2412ff?_0x168de2[_0x20a9('0xf')]:_0x2d3610[_0x20a9('0xc')]+_0x2d3610[_0x20a9('0xe')];var _0xd1b789;if(_0x4df758>=_0x421ddc){_0x4df758=_0x421ddc;_0xd1b789=0xc8;}else{_0xd1b789=0xce;}_0x430acc[_0x20a9('0xa')](_0xd1b789);return _0x430acc[_0x20a9('0x10')](_0x20a9('0x11'),_0x8287a8+'-'+_0x4df758+'/'+_0x421ddc)[_0x20a9('0xb')](_0x168de2);}return null;};}function removeEntity(_0x3bbccf){return function(_0x1eba9d){if(_0x1eba9d){return _0x1eba9d[_0x20a9('0x12')]()[_0x20a9('0x13')](function(){var _0x139a1b=_0x1eba9d['get']({'plain':!![]});var _0x4e4adb=[{'name':'InboundRoutes','value':_0x20a9('0x14'),'ignore':![]},{'name':_0x20a9('0x15'),'value':_0x20a9('0x16'),'ignore':![]},{'name':_0x20a9('0x17'),'value':_0x20a9('0x18'),'ignore':![]}];var _0x274223=_(_0x4e4adb)[_0x20a9('0x19')]('ignore')['map']('value')[_0x20a9('0x1a')]();if(_[_0x20a9('0x1b')](_0x274223,_0x139a1b[_0x20a9('0x1c')])){return;}var _0x5e6b6f=_[_0x20a9('0x1d')](_0x4e4adb,[_0x20a9('0x1a'),_0x139a1b[_0x20a9('0x1c')]])[_0x20a9('0x1e')];return db[_0x20a9('0x1f')]['destroy']({'where':{'type':_0x5e6b6f,'resourceId':_0x139a1b['id']}})['then'](function(){return _0x1eba9d;});})[_0x20a9('0x13')](function(){_0x3bbccf[_0x20a9('0xa')](0xcc)[_0x20a9('0x20')]();});}};}function handleEntityNotFound(_0x5de196){return function(_0x12e2cb){if(!_0x12e2cb){_0x5de196[_0x20a9('0x9')](0x194);}return _0x12e2cb;};}function handleError(_0x4fb4ed,_0x4676cb){_0x4676cb=_0x4676cb||0x1f4;return function(_0x2efb8f){logger[_0x20a9('0x21')](_0x2efb8f[_0x20a9('0x22')]);if(_0x2efb8f[_0x20a9('0x1e')]){delete _0x2efb8f[_0x20a9('0x1e')];}_0x4fb4ed[_0x20a9('0xa')](_0x4676cb)[_0x20a9('0x23')](_0x2efb8f);};}exports[_0x20a9('0x24')]=function(_0x5e790b,_0x2d4b66){var _0x5cb655={},_0x49c24a={},_0x105283={'count':0x0,'rows':[]};var _0x28b060=_[_0x20a9('0x25')](db['VoiceExtension'][_0x20a9('0x26')],function(_0x66a73b){return{'name':_0x66a73b['fieldName'],'type':_0x66a73b[_0x20a9('0x1c')][_0x20a9('0x27')]};});_0x49c24a[_0x20a9('0x28')]=_[_0x20a9('0x25')](_0x28b060,'name');_0x49c24a[_0x20a9('0x29')]=_[_0x20a9('0x2a')](_0x5e790b['query']);_0x49c24a[_0x20a9('0x2b')]=_[_0x20a9('0x2c')](_0x49c24a['model'],_0x49c24a[_0x20a9('0x29')]);_0x5cb655[_0x20a9('0x2d')]=_[_0x20a9('0x2c')](_0x49c24a[_0x20a9('0x28')],qs[_0x20a9('0x2e')](_0x5e790b['query']['fields']));_0x5cb655[_0x20a9('0x2d')]=_0x5cb655['attributes'][_0x20a9('0x2f')]?_0x5cb655[_0x20a9('0x2d')]:_0x49c24a[_0x20a9('0x28')];if(!_0x5e790b[_0x20a9('0x29')][_0x20a9('0x30')](_0x20a9('0x31'))){_0x5cb655['limit']=qs['limit'](_0x5e790b[_0x20a9('0x29')][_0x20a9('0xe')]);_0x5cb655['offset']=qs[_0x20a9('0xc')](_0x5e790b['query'][_0x20a9('0xc')]);}_0x5cb655['order']=qs[_0x20a9('0x32')](_0x5e790b[_0x20a9('0x29')][_0x20a9('0x32')]);_0x5cb655[_0x20a9('0x33')]=qs['filters'](_[_0x20a9('0x34')](_0x5e790b[_0x20a9('0x29')],_0x49c24a[_0x20a9('0x2b')]),_0x28b060);if(_0x5e790b[_0x20a9('0x29')][_0x20a9('0x19')]){_0x5cb655[_0x20a9('0x33')]=_[_0x20a9('0x35')](_0x5cb655[_0x20a9('0x33')],{'$or':_['map'](_0x28b060,function(_0x38a099){if(_0x38a099['type']!==_0x20a9('0x36')){var _0x129950={};_0x129950[_0x38a099['name']]={'$like':'%'+_0x5e790b[_0x20a9('0x29')][_0x20a9('0x19')]+'%'};return _0x129950;}})});}_0x5cb655=_['merge']({},_0x5cb655,_0x5e790b[_0x20a9('0x37')]);var _0x53dd5a={'where':_0x5cb655[_0x20a9('0x33')]};return db[_0x20a9('0x38')][_0x20a9('0xf')](_0x53dd5a)['then'](function(_0x3178d0){_0x105283[_0x20a9('0xf')]=_0x3178d0;if(_0x5e790b[_0x20a9('0x29')][_0x20a9('0x39')]){_0x5cb655[_0x20a9('0x3a')]=[{'all':!![]}];}return db['VoiceExtension'][_0x20a9('0x3b')](_0x5cb655);})[_0x20a9('0x13')](function(_0x2b6534){_0x105283[_0x20a9('0x3c')]=_0x2b6534;return _0x105283;})['then'](respondWithFilteredResult(_0x2d4b66,_0x5cb655))['catch'](handleError(_0x2d4b66,null));};exports[_0x20a9('0x3d')]=function(_0x1fbda1,_0x1370a1){var _0x18c321={'raw':![],'where':{'id':_0x1fbda1[_0x20a9('0x3e')]['id']}},_0x1dac46={};_0x1dac46['model']=_[_0x20a9('0x2a')](db[_0x20a9('0x38')][_0x20a9('0x26')]);_0x1dac46[_0x20a9('0x29')]=_['keys'](_0x1fbda1[_0x20a9('0x29')]);_0x1dac46[_0x20a9('0x2b')]=_[_0x20a9('0x2c')](_0x1dac46[_0x20a9('0x28')],_0x1dac46[_0x20a9('0x29')]);_0x18c321[_0x20a9('0x2d')]=_[_0x20a9('0x2c')](_0x1dac46[_0x20a9('0x28')],qs['fields'](_0x1fbda1['query'][_0x20a9('0x2e')]));_0x18c321[_0x20a9('0x2d')]=_0x18c321['attributes']['length']?_0x18c321[_0x20a9('0x2d')]:_0x1dac46[_0x20a9('0x28')];if(_0x1fbda1[_0x20a9('0x29')][_0x20a9('0x39')]){_0x18c321[_0x20a9('0x3a')]=[{'all':!![]}];}_0x18c321=_[_0x20a9('0x35')]({},_0x18c321,_0x1fbda1[_0x20a9('0x37')]);return db[_0x20a9('0x38')][_0x20a9('0x1d')](_0x18c321)[_0x20a9('0x13')](handleEntityNotFound(_0x1370a1,null))[_0x20a9('0x13')](respondWithResult(_0x1370a1,null))[_0x20a9('0x3f')](handleError(_0x1370a1,null));};exports[_0x20a9('0x12')]=function(_0x34cc8c,_0x4bab46){return db[_0x20a9('0x38')][_0x20a9('0x1d')]({'where':{'id':_0x34cc8c[_0x20a9('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4bab46,null))[_0x20a9('0x13')](removeEntity(_0x4bab46,null))[_0x20a9('0x3f')](handleError(_0x4bab46,null));};exports[_0x20a9('0x40')]=function(_0x330d02,_0xfa5601){if(_0x330d02[_0x20a9('0x41')]['type']===_0x20a9('0x16')&&!_['startsWith'](_0x330d02['body'][_0x20a9('0x42')],'_')){_0x330d02[_0x20a9('0x41')]['exten']='_'[_0x20a9('0x43')](_0x330d02['body'][_0x20a9('0x42')]);}return db[_0x20a9('0x38')][_0x20a9('0x40')](_0x330d02['body'],{'raw':![]})[_0x20a9('0x13')](function(_0x1d3f97){var _0x249f98=_0x330d02[_0x20a9('0x44')]['get']({'plain':!![]});if(!_0x249f98)throw new Error(_0x20a9('0x45'));if(_0x249f98['role']===_0x20a9('0x44')){var _0x24ddaf=_0x1d3f97[_0x20a9('0x46')]({'plain':!![]});var _0x1444f3=[{'name':'InboundRoutes','value':_0x20a9('0x14')},{'name':_0x20a9('0x15'),'value':_0x20a9('0x16')},{'name':_0x20a9('0x17'),'value':_0x20a9('0x18')}];var _0x4ad086=_[_0x20a9('0x1d')](_0x1444f3,[_0x20a9('0x1a'),_0x24ddaf[_0x20a9('0x1c')]])[_0x20a9('0x1e')];return db[_0x20a9('0x47')][_0x20a9('0x1d')]({'where':{'name':_0x4ad086,'userProfileId':_0x249f98[_0x20a9('0x48')]},'raw':!![]})['then'](function(_0x168686){if(_0x168686&&_0x168686[_0x20a9('0x49')]===0x0){return db[_0x20a9('0x1f')][_0x20a9('0x40')]({'name':_0x24ddaf[_0x20a9('0x1e')],'resourceId':_0x24ddaf['id'],'type':_0x168686['name'],'sectionId':_0x168686['id']},{})[_0x20a9('0x13')](function(){return _0x1d3f97;});}else{return _0x1d3f97;}})[_0x20a9('0x3f')](function(_0x57d88f){logger[_0x20a9('0x21')](_0x20a9('0x4a'),_0x57d88f);throw _0x57d88f;});}return _0x1d3f97;})[_0x20a9('0x13')](respondWithResult(_0xfa5601,0xc9))[_0x20a9('0x3f')](handleError(_0xfa5601,null));};exports[_0x20a9('0x4b')]=function(_0x259f8d,_0x4f9077){if(_0x259f8d[_0x20a9('0x41')]['id']){delete _0x259f8d['body']['id'];}return db['VoiceExtension'][_0x20a9('0x1d')]({'where':{'id':_0x259f8d['params']['id']}})[_0x20a9('0x13')](handleEntityNotFound(_0x4f9077,null))[_0x20a9('0x13')](function(_0x37f5d2){if(_0x37f5d2){return db[_0x20a9('0x38')][_0x20a9('0x4b')](_[_0x20a9('0x34')](_0x259f8d[_0x20a9('0x41')],['exten','context',_0x20a9('0x4c'),_0x20a9('0x4d'),_0x20a9('0x4e'),_0x20a9('0x4f'),_0x20a9('0x50')]),{'where':{'context':_0x37f5d2[_0x20a9('0x51')],'exten':_0x37f5d2['exten']},'individualHooks':!![]})[_0x20a9('0x13')](function(_0x248bd5){return _0x248bd5;});}return null;})[_0x20a9('0x13')](respondWithStatusCode(_0x4f9077,null))[_0x20a9('0x3f')](handleError(_0x4f9077,null));};exports[_0x20a9('0x52')]=function(_0x1fa43a,_0x305dd3){var _0x50f22f=_0x1fa43a['params']['id'];var _0x3f1e39=_0x1fa43a[_0x20a9('0x41')];var _0x5fbcb6=0xc8;var _0x488f26=null;return db[_0x20a9('0x53')]['transaction']({'isolationLevel':db[_0x20a9('0x53')][_0x20a9('0x54')]['ISOLATION_LEVELS'][_0x20a9('0x55')]},function(_0x3a3333){return db[_0x20a9('0x38')][_0x20a9('0x56')]({'where':{'id':_0x50f22f},'transaction':_0x3a3333})['then'](function(_0x3938e2){if(_0x3938e2){return db[_0x20a9('0x38')][_0x20a9('0x12')]({'where':{'VoiceExtensionId':_0x50f22f},'transaction':_0x3a3333})[_0x20a9('0x13')](function(){var _0x1343d3=_[_0x20a9('0x25')](_0x3f1e39,function(_0x2a67c5){_0x2a67c5[_0x20a9('0x57')]=_0x50f22f;_0x2a67c5[_0x20a9('0x58')]=!![];return _0x2a67c5;});return _0x3938e2[_0x20a9('0x59')](_0x1343d3);})['then'](function(_0x183b91){return db[_0x20a9('0x38')]['bulkCreate'](_0x183b91,{'transaction':_0x3a3333});});}else{_0x5fbcb6=0x194;_0x488f26=[];}});})['then'](function(){if(_0x5fbcb6!==0x194){return db['VoiceExtension'][_0x20a9('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x50f22f},'order':_0x20a9('0x5b')})[_0x20a9('0x13')](function(_0x2f1479){_0x488f26=_0x2f1479;});}})[_0x20a9('0x3f')](function(_0x5de503){_0x5fbcb6=0x1f4;logger[_0x20a9('0x21')](_0x5de503['stack']);if(_0x5de503[_0x20a9('0x1e')]){delete _0x5de503[_0x20a9('0x1e')];}_0x488f26=_0x5de503;})[_0x20a9('0x5c')](function(){if(_0x488f26===null){_0x305dd3[_0x20a9('0x9')](_0x5fbcb6);}else{if(_0x5fbcb6===0x1f4){_0x305dd3[_0x20a9('0xa')](_0x5fbcb6)[_0x20a9('0x23')](_0x488f26);}else{_0x305dd3[_0x20a9('0xa')](_0x5fbcb6)[_0x20a9('0xb')](_0x488f26);}}});}; \ No newline at end of file +var _0xaf98=['ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','destroy','then','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','find','type','name','UserProfileResource','end','error','stack','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','filter','options','VoiceExtension','includeAll','include','findAll','rows','catch','params','fields','create','body','startsWith','exten','concat','get','user','InboundRoutes','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction'];(function(_0x1227c0,_0x5d91ee){var _0x557d9d=function(_0xdd29c4){while(--_0xdd29c4){_0x1227c0['push'](_0x1227c0['shift']());}};_0x557d9d(++_0x5d91ee);}(_0xaf98,0x69));var _0x8af9=function(_0x259ac7,_0x3c65c6){_0x259ac7=_0x259ac7-0x0;var _0x185b01=_0xaf98[_0x259ac7];return _0x185b01;};'use strict';var _=require('lodash');var Redis=require(_0x8af9('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x8af9('0x1'))('api');var config=require(_0x8af9('0x2'));var db=require(_0x8af9('0x3'))['db'];config[_0x8af9('0x4')]=_[_0x8af9('0x5')](config[_0x8af9('0x4')],{'host':_0x8af9('0x6'),'port':0x18eb});var socket=require(_0x8af9('0x7'))(new Redis(config[_0x8af9('0x4')]));require('./voiceExtension.socket')[_0x8af9('0x8')](socket);function respondWithStatusCode(_0x578e82,_0x5b93db){_0x5b93db=_0x5b93db||0xcc;return function(_0x149343){if(_0x149343){return _0x578e82[_0x8af9('0x9')](_0x5b93db);}return _0x578e82[_0x8af9('0xa')](_0x5b93db)['end']();};}function respondWithResult(_0x1f0a3d,_0x1a0882){_0x1a0882=_0x1a0882||0xc8;return function(_0x4ff400){if(_0x4ff400){return _0x1f0a3d[_0x8af9('0xa')](_0x1a0882)['json'](_0x4ff400);}};}function respondWithFilteredResult(_0x4a5c12,_0x1f9523){return function(_0x831ffa){if(_0x831ffa){var _0x5171c4=typeof _0x1f9523['offset']===_0x8af9('0xb')&&typeof _0x1f9523[_0x8af9('0xc')]===_0x8af9('0xb');var _0x2ac93f=_0x831ffa['count'];var _0x4234dd=_0x5171c4?0x0:_0x1f9523[_0x8af9('0xd')];var _0x5d5794=_0x5171c4?_0x831ffa[_0x8af9('0xe')]:_0x1f9523[_0x8af9('0xd')]+_0x1f9523[_0x8af9('0xc')];var _0x3baf3a;if(_0x5d5794>=_0x2ac93f){_0x5d5794=_0x2ac93f;_0x3baf3a=0xc8;}else{_0x3baf3a=0xce;}_0x4a5c12[_0x8af9('0xa')](_0x3baf3a);return _0x4a5c12[_0x8af9('0xf')](_0x8af9('0x10'),_0x4234dd+'-'+_0x5d5794+'/'+_0x2ac93f)[_0x8af9('0x11')](_0x831ffa);}return null;};}function removeEntity(_0x12afbf){return function(_0x16b0d7){if(_0x16b0d7){return _0x16b0d7[_0x8af9('0x12')]()[_0x8af9('0x13')](function(){var _0x4d46e2=_0x16b0d7['get']({'plain':!![]});var _0x5a20bb=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x8af9('0x14'),'value':_0x8af9('0x15'),'ignore':![]},{'name':_0x8af9('0x16'),'value':_0x8af9('0x17'),'ignore':![]}];var _0x385b16=_(_0x5a20bb)['filter'](_0x8af9('0x18'))[_0x8af9('0x19')](_0x8af9('0x1a'))[_0x8af9('0x1a')]();if(_[_0x8af9('0x1b')](_0x385b16,_0x4d46e2['type'])){return;}var _0x4b8c1f=_[_0x8af9('0x1c')](_0x5a20bb,['value',_0x4d46e2[_0x8af9('0x1d')]])[_0x8af9('0x1e')];return db[_0x8af9('0x1f')][_0x8af9('0x12')]({'where':{'type':_0x4b8c1f,'resourceId':_0x4d46e2['id']}})['then'](function(){return _0x16b0d7;});})[_0x8af9('0x13')](function(){_0x12afbf[_0x8af9('0xa')](0xcc)[_0x8af9('0x20')]();});}};}function handleEntityNotFound(_0x4242c5){return function(_0x2f02ed){if(!_0x2f02ed){_0x4242c5[_0x8af9('0x9')](0x194);}return _0x2f02ed;};}function handleError(_0x13d2a0,_0xa7547){_0xa7547=_0xa7547||0x1f4;return function(_0x4be93b){logger[_0x8af9('0x21')](_0x4be93b[_0x8af9('0x22')]);if(_0x4be93b[_0x8af9('0x1e')]){delete _0x4be93b[_0x8af9('0x1e')];}_0x13d2a0[_0x8af9('0xa')](_0xa7547)[_0x8af9('0x23')](_0x4be93b);};}exports[_0x8af9('0x24')]=function(_0x39ace3,_0x9bcb21){var _0x1d7d57={},_0x44c7ad={},_0x267764={'count':0x0,'rows':[]};var _0x31950b=_['map'](db['VoiceExtension'][_0x8af9('0x25')],function(_0x51f541){return{'name':_0x51f541[_0x8af9('0x26')],'type':_0x51f541['type'][_0x8af9('0x27')]};});_0x44c7ad[_0x8af9('0x28')]=_[_0x8af9('0x19')](_0x31950b,_0x8af9('0x1e'));_0x44c7ad[_0x8af9('0x29')]=_[_0x8af9('0x2a')](_0x39ace3['query']);_0x44c7ad[_0x8af9('0x2b')]=_[_0x8af9('0x2c')](_0x44c7ad[_0x8af9('0x28')],_0x44c7ad[_0x8af9('0x29')]);_0x1d7d57[_0x8af9('0x2d')]=_[_0x8af9('0x2c')](_0x44c7ad['model'],qs['fields'](_0x39ace3[_0x8af9('0x29')]['fields']));_0x1d7d57[_0x8af9('0x2d')]=_0x1d7d57[_0x8af9('0x2d')][_0x8af9('0x2e')]?_0x1d7d57[_0x8af9('0x2d')]:_0x44c7ad[_0x8af9('0x28')];if(!_0x39ace3['query'][_0x8af9('0x2f')](_0x8af9('0x30'))){_0x1d7d57[_0x8af9('0xc')]=qs['limit'](_0x39ace3[_0x8af9('0x29')][_0x8af9('0xc')]);_0x1d7d57[_0x8af9('0xd')]=qs[_0x8af9('0xd')](_0x39ace3[_0x8af9('0x29')][_0x8af9('0xd')]);}_0x1d7d57['order']=qs[_0x8af9('0x31')](_0x39ace3[_0x8af9('0x29')][_0x8af9('0x31')]);_0x1d7d57['where']=qs[_0x8af9('0x2b')](_[_0x8af9('0x32')](_0x39ace3[_0x8af9('0x29')],_0x44c7ad[_0x8af9('0x2b')]),_0x31950b);if(_0x39ace3['query']['filter']){_0x1d7d57['where']=_[_0x8af9('0x33')](_0x1d7d57[_0x8af9('0x34')],{'$or':_[_0x8af9('0x19')](_0x31950b,function(_0x5d7498){if(_0x5d7498['type']!==_0x8af9('0x35')){var _0x4ab3a7={};_0x4ab3a7[_0x5d7498[_0x8af9('0x1e')]]={'$like':'%'+_0x39ace3[_0x8af9('0x29')][_0x8af9('0x36')]+'%'};return _0x4ab3a7;}})});}_0x1d7d57=_[_0x8af9('0x33')]({},_0x1d7d57,_0x39ace3[_0x8af9('0x37')]);var _0x13ed1e={'where':_0x1d7d57[_0x8af9('0x34')]};return db[_0x8af9('0x38')][_0x8af9('0xe')](_0x13ed1e)[_0x8af9('0x13')](function(_0x54a240){_0x267764[_0x8af9('0xe')]=_0x54a240;if(_0x39ace3[_0x8af9('0x29')][_0x8af9('0x39')]){_0x1d7d57[_0x8af9('0x3a')]=[{'all':!![]}];}return db[_0x8af9('0x38')][_0x8af9('0x3b')](_0x1d7d57);})[_0x8af9('0x13')](function(_0x6d52e2){_0x267764[_0x8af9('0x3c')]=_0x6d52e2;return _0x267764;})[_0x8af9('0x13')](respondWithFilteredResult(_0x9bcb21,_0x1d7d57))[_0x8af9('0x3d')](handleError(_0x9bcb21,null));};exports['show']=function(_0x1e0853,_0x307f3a){var _0x3e50e8={'raw':![],'where':{'id':_0x1e0853[_0x8af9('0x3e')]['id']}},_0x4b37cc={};_0x4b37cc[_0x8af9('0x28')]=_[_0x8af9('0x2a')](db['VoiceExtension']['rawAttributes']);_0x4b37cc[_0x8af9('0x29')]=_[_0x8af9('0x2a')](_0x1e0853[_0x8af9('0x29')]);_0x4b37cc[_0x8af9('0x2b')]=_[_0x8af9('0x2c')](_0x4b37cc[_0x8af9('0x28')],_0x4b37cc['query']);_0x3e50e8['attributes']=_[_0x8af9('0x2c')](_0x4b37cc[_0x8af9('0x28')],qs['fields'](_0x1e0853[_0x8af9('0x29')][_0x8af9('0x3f')]));_0x3e50e8[_0x8af9('0x2d')]=_0x3e50e8['attributes'][_0x8af9('0x2e')]?_0x3e50e8[_0x8af9('0x2d')]:_0x4b37cc['model'];if(_0x1e0853[_0x8af9('0x29')][_0x8af9('0x39')]){_0x3e50e8[_0x8af9('0x3a')]=[{'all':!![]}];}_0x3e50e8=_[_0x8af9('0x33')]({},_0x3e50e8,_0x1e0853['options']);return db[_0x8af9('0x38')][_0x8af9('0x1c')](_0x3e50e8)['then'](handleEntityNotFound(_0x307f3a,null))[_0x8af9('0x13')](respondWithResult(_0x307f3a,null))[_0x8af9('0x3d')](handleError(_0x307f3a,null));};exports['destroy']=function(_0x145c9a,_0x18b2db){return db[_0x8af9('0x38')][_0x8af9('0x1c')]({'where':{'id':_0x145c9a[_0x8af9('0x3e')]['id']}})[_0x8af9('0x13')](handleEntityNotFound(_0x18b2db,null))[_0x8af9('0x13')](removeEntity(_0x18b2db,null))[_0x8af9('0x3d')](handleError(_0x18b2db,null));};exports[_0x8af9('0x40')]=function(_0x4131aa,_0x2c2441){if(_0x4131aa[_0x8af9('0x41')][_0x8af9('0x1d')]==='outbound'&&!_[_0x8af9('0x42')](_0x4131aa[_0x8af9('0x41')][_0x8af9('0x43')],'_')){_0x4131aa['body']['exten']='_'[_0x8af9('0x44')](_0x4131aa[_0x8af9('0x41')][_0x8af9('0x43')]);}return db[_0x8af9('0x38')][_0x8af9('0x40')](_0x4131aa['body'],{'raw':![]})[_0x8af9('0x13')](function(_0x3a99ca){var _0x15cc26=_0x4131aa['user'][_0x8af9('0x45')]({'plain':!![]});if(!_0x15cc26)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15cc26['role']===_0x8af9('0x46')){var _0x7600cd=_0x3a99ca[_0x8af9('0x45')]({'plain':!![]});var _0x49162b=[{'name':_0x8af9('0x47'),'value':_0x8af9('0x48')},{'name':_0x8af9('0x14'),'value':_0x8af9('0x15')},{'name':_0x8af9('0x16'),'value':'internal'}];var _0x3b05c8=_['find'](_0x49162b,[_0x8af9('0x1a'),_0x7600cd[_0x8af9('0x1d')]])[_0x8af9('0x1e')];return db[_0x8af9('0x49')][_0x8af9('0x1c')]({'where':{'name':_0x3b05c8,'userProfileId':_0x15cc26[_0x8af9('0x4a')]},'raw':!![]})[_0x8af9('0x13')](function(_0x5c0b4b){if(_0x5c0b4b&&_0x5c0b4b[_0x8af9('0x4b')]===0x0){return db[_0x8af9('0x1f')]['create']({'name':_0x7600cd[_0x8af9('0x1e')],'resourceId':_0x7600cd['id'],'type':_0x5c0b4b[_0x8af9('0x1e')],'sectionId':_0x5c0b4b['id']},{})['then'](function(){return _0x3a99ca;});}else{return _0x3a99ca;}})[_0x8af9('0x3d')](function(_0x209c99){logger[_0x8af9('0x21')](_0x8af9('0x4c'),_0x209c99);throw _0x209c99;});}return _0x3a99ca;})[_0x8af9('0x13')](respondWithResult(_0x2c2441,0xc9))[_0x8af9('0x3d')](handleError(_0x2c2441,null));};exports[_0x8af9('0x4d')]=function(_0x26b0fd,_0x490b0a){if(_0x26b0fd[_0x8af9('0x41')]['id']){delete _0x26b0fd[_0x8af9('0x41')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x26b0fd['params']['id']}})[_0x8af9('0x13')](handleEntityNotFound(_0x490b0a,null))[_0x8af9('0x13')](function(_0x464919){if(_0x464919){return db[_0x8af9('0x38')]['update'](_[_0x8af9('0x32')](_0x26b0fd[_0x8af9('0x41')],[_0x8af9('0x43'),_0x8af9('0x4e'),_0x8af9('0x4f'),_0x8af9('0x50'),'cutdigits',_0x8af9('0x51'),_0x8af9('0x52')]),{'where':{'context':_0x464919[_0x8af9('0x4e')],'exten':_0x464919[_0x8af9('0x43')]},'individualHooks':!![]})[_0x8af9('0x13')](function(_0x536853){return _0x536853;});}return null;})[_0x8af9('0x13')](respondWithStatusCode(_0x490b0a,null))[_0x8af9('0x3d')](handleError(_0x490b0a,null));};exports[_0x8af9('0x53')]=function(_0x248552,_0xd72267){var _0x24698c=_0x248552[_0x8af9('0x3e')]['id'];var _0x1a987e=_0x248552[_0x8af9('0x41')];var _0x56c11c=0xc8;var _0x3914e3=null;return db[_0x8af9('0x54')][_0x8af9('0x55')]({'isolationLevel':db[_0x8af9('0x54')][_0x8af9('0x56')][_0x8af9('0x57')]['READ_COMMITTED']},function(_0x2b31cf){return db['VoiceExtension'][_0x8af9('0x58')]({'where':{'id':_0x24698c},'transaction':_0x2b31cf})[_0x8af9('0x13')](function(_0x53670d){if(_0x53670d){return db[_0x8af9('0x38')][_0x8af9('0x12')]({'where':{'VoiceExtensionId':_0x24698c},'transaction':_0x2b31cf})[_0x8af9('0x13')](function(){var _0x2f5bdf=_[_0x8af9('0x19')](_0x1a987e,function(_0x24596b){_0x24596b[_0x8af9('0x59')]=_0x24698c;_0x24596b[_0x8af9('0x5a')]=!![];return _0x24596b;});return _0x53670d[_0x8af9('0x5b')](_0x2f5bdf);})[_0x8af9('0x13')](function(_0x9cf09a){return db[_0x8af9('0x38')][_0x8af9('0x5c')](_0x9cf09a,{'transaction':_0x2b31cf});});}else{_0x56c11c=0x194;_0x3914e3=[];}});})[_0x8af9('0x13')](function(){if(_0x56c11c!==0x194){return db[_0x8af9('0x38')][_0x8af9('0x5d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x24698c},'order':_0x8af9('0x5e')})[_0x8af9('0x13')](function(_0x2d9305){_0x3914e3=_0x2d9305;});}})[_0x8af9('0x3d')](function(_0x10c102){_0x56c11c=0x1f4;logger[_0x8af9('0x21')](_0x10c102[_0x8af9('0x22')]);if(_0x10c102[_0x8af9('0x1e')]){delete _0x10c102['name'];}_0x3914e3=_0x10c102;})[_0x8af9('0x5f')](function(){if(_0x3914e3===null){_0xd72267['sendStatus'](_0x56c11c);}else{if(_0x56c11c===0x1f4){_0xd72267[_0x8af9('0xa')](_0x56c11c)[_0x8af9('0x23')](_0x3914e3);}else{_0xd72267[_0x8af9('0xa')](_0x56c11c)['json'](_0x3914e3);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 0e6c0df..ede1201 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 _0x83d9=['../../mysqldb','VoiceExtension','setMaxListeners','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2d6e84,_0x437040){var _0x18d106=function(_0x416501){while(--_0x416501){_0x2d6e84['push'](_0x2d6e84['shift']());}};_0x18d106(++_0x437040);}(_0x83d9,0xb8));var _0x983d=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x83d9[_0x4243a3];return _0x1b2a33;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x983d('0x0'))['db'][_0x983d('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x983d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x983d('0x3')};function emitEvent(_0x4b69dd){return function(_0x39d4a3,_0x2f59b9,_0x50c8ca){VoiceExtensionEvents[_0x983d('0x4')](_0x4b69dd+':'+_0x39d4a3['id'],_0x39d4a3);VoiceExtensionEvents[_0x983d('0x4')](_0x4b69dd,_0x39d4a3);_0x50c8ca(null);};}for(var e in events){if(events[_0x983d('0x5')](e)){var event=events[e];VoiceExtension[_0x983d('0x6')](e,emitEvent(event));}}module[_0x983d('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0xfde2=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xfde2,0x164));var _0x2fde=function(_0x1998bb,_0x1f1da1){_0x1998bb=_0x1998bb-0x0;var _0x4ae4c9=_0xfde2[_0x1998bb];return _0x4ae4c9;};'use strict';var EventEmitter=require(_0x2fde('0x0'));var VoiceExtension=require(_0x2fde('0x1'))['db'][_0x2fde('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x2fde('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2fde('0x4'),'afterDestroy':_0x2fde('0x5')};function emitEvent(_0x257843){return function(_0x5dcfc8,_0x20a4b5,_0x37bfaf){VoiceExtensionEvents[_0x2fde('0x6')](_0x257843+':'+_0x5dcfc8['id'],_0x5dcfc8);VoiceExtensionEvents['emit'](_0x257843,_0x5dcfc8);_0x37bfaf(null);};}for(var e in events){if(events[_0x2fde('0x7')](e)){var event=events[e];VoiceExtension[_0x2fde('0x8')](e,emitEvent(event));}}module[_0x2fde('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 39e633b..c0df1b7 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 _0x0bcc=['filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','ExecIf','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','voice_extensions','concat','Hangup','lodash','./voiceExtension.attributes','exports','type','Set','CDR(type)=','context','exten','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','${EXTEN}','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','recordingFormat','none','push','wav','trunk','options','split','length','param','phone','prefix','cutdigits','SIP','join','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x0bcc,0xb1));var _0xc0bc=function(_0x4bf889,_0x2da88b){_0x4bf889=_0x4bf889-0x0;var _0x1da590=_0x0bcc[_0x4bf889];return _0x1da590;};'use strict';var _=require(_0xc0bc('0x0'));var attributes=require(_0xc0bc('0x1'));module[_0xc0bc('0x2')]=function(_0x5d2330){var _0x53aec8=_0x5d2330['models'];function _0x111134(_0x272950){var _0x115d02=0x2;var _0x3ed342=[{'type':_0x272950[_0xc0bc('0x3')],'app':_0xc0bc('0x4'),'appdata':_0xc0bc('0x5')+_0x272950[_0xc0bc('0x3')],'context':_0x272950[_0xc0bc('0x6')],'exten':_0x272950[_0xc0bc('0x7')],'priority':_0x115d02++,'VoiceExtensionId':_0x272950['id']}];if(_0x272950[_0xc0bc('0x3')]==='inbound'){_0x3ed342['push']({'type':'inbound','app':_0xc0bc('0x4'),'appdata':'CDR(routeid)='+_0x272950['id'],'context':_0x272950[_0xc0bc('0x6')],'exten':_0x272950[_0xc0bc('0x7')],'priority':_0x115d02++,'VoiceExtensionId':_0x272950['id']});}_0x3ed342['push']({'type':_0x272950['type'],'app':'Set','appdata':_0xc0bc('0x8'),'context':_0x272950[_0xc0bc('0x6')],'exten':_0x272950[_0xc0bc('0x7')],'priority':_0x115d02++,'VoiceExtensionId':_0x272950['id']},{'type':_0x272950[_0xc0bc('0x3')],'app':_0xc0bc('0x4'),'appdata':_0xc0bc('0x9'),'context':_0x272950[_0xc0bc('0x6')],'exten':_0x272950[_0xc0bc('0x7')],'priority':_0x115d02++,'VoiceExtensionId':_0x272950['id']},{'type':_0x272950[_0xc0bc('0x3')],'app':'Set','appdata':_0xc0bc('0xa'),'context':_0x272950[_0xc0bc('0x6')],'exten':_0x272950[_0xc0bc('0x7')],'priority':_0x115d02++,'VoiceExtensionId':_0x272950['id']});return _0x3ed342;}function _0x4c9407(_0x4c9a4c){var _0x208cd1=0x2;var _0x1f6eca=[{'type':_0xc0bc('0xb'),'app':'Set','appdata':_0xc0bc('0xc'),'context':_0x4c9a4c['context'],'exten':_0x4c9a4c[_0xc0bc('0x7')],'priority':_0x208cd1++,'VoiceExtensionId':_0x4c9a4c['id']},{'type':_0xc0bc('0xb'),'app':_0xc0bc('0x4'),'appdata':_0xc0bc('0xd')+(_0x4c9a4c['cutdigits']?_0xc0bc('0xe')+_0x4c9a4c['cutdigits']+'}':_0xc0bc('0xf')),'context':_0x4c9a4c[_0xc0bc('0x6')],'exten':_0x4c9a4c[_0xc0bc('0x7')],'priority':_0x208cd1++,'VoiceExtensionId':_0x4c9a4c['id']},{'type':'outbound','app':_0xc0bc('0x4'),'appdata':_0xc0bc('0x10')+_0x4c9a4c['id'],'context':_0x4c9a4c['context'],'exten':_0x4c9a4c[_0xc0bc('0x7')],'priority':_0x208cd1++,'VoiceExtensionId':_0x4c9a4c['id']},{'type':'outbound','app':'ExecIf','appdata':_0xc0bc('0x11')+(_0x208cd1+0x2)+_0xc0bc('0x12')+(_0x208cd1+0x1)+')','context':_0x4c9a4c[_0xc0bc('0x6')],'exten':_0x4c9a4c[_0xc0bc('0x7')],'priority':_0x208cd1++,'VoiceExtensionId':_0x4c9a4c['id']},{'type':_0xc0bc('0xb'),'app':'Set','appdata':_0x4c9a4c['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x4c9a4c['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x4c9a4c['context'],'exten':_0x4c9a4c['exten'],'priority':_0x208cd1++,'VoiceExtensionId':_0x4c9a4c['id']},{'type':_0xc0bc('0xb'),'app':_0xc0bc('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4c9a4c[_0xc0bc('0x6')],'exten':_0x4c9a4c[_0xc0bc('0x7')],'priority':_0x208cd1++,'VoiceExtensionId':_0x4c9a4c['id']},{'type':_0xc0bc('0xb'),'app':'Set','appdata':_0xc0bc('0x9'),'context':_0x4c9a4c[_0xc0bc('0x6')],'exten':_0x4c9a4c['exten'],'priority':_0x208cd1++,'VoiceExtensionId':_0x4c9a4c['id']},{'type':_0xc0bc('0xb'),'app':_0xc0bc('0x4'),'appdata':_0xc0bc('0xa'),'context':_0x4c9a4c['context'],'exten':_0x4c9a4c[_0xc0bc('0x7')],'priority':_0x208cd1++,'VoiceExtensionId':_0x4c9a4c['id']},{'type':_0xc0bc('0xb'),'app':_0xc0bc('0x4'),'appdata':_0xc0bc('0x13')+_0x4c9a4c['id'],'context':_0x4c9a4c['context'],'exten':_0x4c9a4c[_0xc0bc('0x7')],'priority':_0x208cd1++,'VoiceExtensionId':_0x4c9a4c['id']}];if(_0x4c9a4c['hasOwnProperty'](_0xc0bc('0x14'))&&_0x4c9a4c[_0xc0bc('0x14')]!==_0xc0bc('0x15')){_0x1f6eca[_0xc0bc('0x16')]({'type':_0xc0bc('0xb'),'app':_0xc0bc('0x4'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x4c9a4c[_0xc0bc('0x6')],'exten':_0x4c9a4c['exten'],'priority':_0x208cd1++,'VoiceExtensionId':_0x4c9a4c['id']},{'type':'outbound','app':_0xc0bc('0x4'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x4c9a4c[_0xc0bc('0x14')]||_0xc0bc('0x17'),'context':_0x4c9a4c[_0xc0bc('0x6')],'exten':_0x4c9a4c[_0xc0bc('0x7')],'priority':_0x208cd1++,'VoiceExtensionId':_0x4c9a4c['id']});}return _0x1f6eca;}function _0xe9612c(_0x5e6651,_0x40e945){var _0xeb5d85=[{'name':_0xc0bc('0x18'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0xc0bc('0x19'),'param':0x2},{'name':'url','param':0x3}];var _0x2711de={};var _0x1507b0=_0x40e945[_0xc0bc('0x1a')](',');var _0x2efadc=[];for(var _0x2a5353=0x0;_0x2a5353<_0xeb5d85[_0xc0bc('0x1b')];_0x2a5353++){switch(_0xeb5d85[_0x2a5353]['name']){case _0xc0bc('0x18'):_0x2711de['trunk']=_0x1507b0[_0xeb5d85[_0x2a5353][_0xc0bc('0x1c')]]['split']('/')[0x1];_0x2711de[_0xc0bc('0x1d')]=_0x1507b0[_0xeb5d85[_0x2a5353][_0xc0bc('0x1c')]][_0xc0bc('0x1a')]('/')[0x2];_0x2711de[_0xc0bc('0x1e')]=_0x2711de['phone']?_0x2711de['phone'][_0xc0bc('0x1a')]('$')[0x0]:undefined;_0x2711de[_0xc0bc('0x1d')]=_0x5e6651[_0xc0bc('0x1f')]?(_0x2711de[_0xc0bc('0x1e')]||'')+_0xc0bc('0xe')+_0x5e6651['cutdigits']+'}':(_0x2711de[_0xc0bc('0x1e')]||'')+_0xc0bc('0xf');_0x2efadc[_0xeb5d85[_0x2a5353][_0xc0bc('0x1c')]]=[_0xc0bc('0x20'),_0x2711de[_0xc0bc('0x18')],_0x2711de[_0xc0bc('0x1d')]][_0xc0bc('0x21')]('/');break;case _0xc0bc('0x19'):_0x2711de[_0xc0bc('0x19')]=_0x1507b0[_0xeb5d85[_0x2a5353]['param']];if(_0x5e6651[_0xc0bc('0x14')]!==_0xc0bc('0x15')){if(_0x2711de[_0xc0bc('0x19')]['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x2711de[_0xc0bc('0x19')]+=_0xc0bc('0x22');}}else{_0x2711de['options']=_0x2711de['options'][_0xc0bc('0x23')]('U(xcally-mixmonitor-context)','');}_0x2efadc[_0xeb5d85[_0x2a5353][_0xc0bc('0x1c')]]=_0x2711de['options'];break;default:_0x2efadc[_0xeb5d85[_0x2a5353][_0xc0bc('0x1c')]]=_0x1507b0[_0xeb5d85[_0x2a5353][_0xc0bc('0x1c')]];}}return _0x2efadc['join'](',');}function _0x1b8d9e(_0x16d3f3,_0x31c68d,_0xd8b6a3){return new Promise(function(_0x40856a,_0x17d6b9){var _0x6f374d=[];if(_[_0xc0bc('0x24')](_0x31c68d))return _0x40856a(_0x6f374d);_0x53aec8[_0xc0bc('0x25')][_0xc0bc('0x26')]({'attributes':['id',_0xc0bc('0x27'),_0xc0bc('0x28')],'raw':!![]})[_0xc0bc('0x29')](function(_0x1801d3){for(var _0x57393b=0x0,_0x95ca4d=0x0;_0x57393b<_0x31c68d[_0xc0bc('0x1b')];_0x57393b++,_0x95ca4d=0x0){var _0x34e5d3=_0x31c68d[_0x57393b];var _0x42d0a1=[];var _0x5448ec=[];delete _0x34e5d3['id'];if(_0x34e5d3['interval']!==_0xc0bc('0x2a')){_0x34e5d3[_0xc0bc('0x2b')]=[_0x34e5d3['interval']];}else{_0x34e5d3[_0xc0bc('0x2b')]=_0x34e5d3[_0xc0bc('0x28')]?_[_0xc0bc('0x2c')](_[_0xc0bc('0x2d')](_0x1801d3,{'IntervalId':_0x34e5d3[_0xc0bc('0x28')]}),_0xc0bc('0x27')):[];}_0x34e5d3[_0xc0bc('0x6')]=_0x16d3f3[_0xc0bc('0x6')];_0x34e5d3['exten']=_0x16d3f3[_0xc0bc('0x7')];if(_0x34e5d3[_0xc0bc('0x3')])_0x34e5d3[_0xc0bc('0x3')]=_0x34e5d3[_0xc0bc('0x3')][_0xc0bc('0x2e')]();if(_0x16d3f3[_0xc0bc('0x3')]===_0xc0bc('0xb')){if(_0x34e5d3[_0xc0bc('0x2f')]('tag')&&_0x34e5d3[_0xc0bc('0x30')]&&_0x34e5d3['tag']!=='--'){_0x42d0a1['push']({'type':_0x34e5d3[_0xc0bc('0x3')][_0xc0bc('0x2e')](),'app':_0xc0bc('0x4'),'appdata':_0xc0bc('0x31')+_0x34e5d3[_0xc0bc('0x30')],'context':_0x16d3f3[_0xc0bc('0x6')],'exten':_0x16d3f3[_0xc0bc('0x7')],'priority':_0x34e5d3[_0xc0bc('0x2b')]['length']+_0xd8b6a3+_0x95ca4d++,'VoiceExtensionId':_0x16d3f3['id']});}_0x42d0a1[_0xc0bc('0x16')]({'type':_0x34e5d3[_0xc0bc('0x3')][_0xc0bc('0x2e')](),'app':_0xc0bc('0x32'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x34e5d3[_0xc0bc('0x33')]?_0xc0bc('0x34')+_0x34e5d3[_0xc0bc('0x33')]+')':_0xc0bc('0x35')),'context':_0x16d3f3[_0xc0bc('0x6')],'exten':_0x16d3f3[_0xc0bc('0x7')],'priority':_0x34e5d3[_0xc0bc('0x2b')][_0xc0bc('0x1b')]+_0xd8b6a3+_0x95ca4d++,'VoiceExtensionId':_0x16d3f3['id']});}else{if(_0x34e5d3[_0xc0bc('0x2f')](_0xc0bc('0x36'))){if([_0xc0bc('0x37'),_0xc0bc('0x38')][_0xc0bc('0x39')](_0x34e5d3[_0xc0bc('0x3a')][_0xc0bc('0x2e')]())&&_0x34e5d3[_0xc0bc('0x3b')]!==_0xc0bc('0x3c')){if(_0x34e5d3[_0xc0bc('0x36')]){_0x42d0a1['push']({'type':_0x34e5d3[_0xc0bc('0x3')]['toLowerCase'](),'app':_0xc0bc('0x32'),'appdata':_0xc0bc('0x3d'),'context':_0x16d3f3[_0xc0bc('0x6')],'exten':_0x16d3f3['exten'],'priority':_0x34e5d3[_0xc0bc('0x2b')]['length']+_0xd8b6a3+_0x95ca4d++,'VoiceExtensionId':_0x16d3f3['id']});_0x42d0a1[_0xc0bc('0x16')]({'type':_0x34e5d3[_0xc0bc('0x3')][_0xc0bc('0x2e')](),'app':'Set','appdata':_0xc0bc('0x3e'),'context':_0x16d3f3['context'],'exten':_0x16d3f3[_0xc0bc('0x7')],'priority':_0x34e5d3[_0xc0bc('0x2b')][_0xc0bc('0x1b')]+_0xd8b6a3+_0x95ca4d++,'VoiceExtensionId':_0x16d3f3['id']});}else{_0x42d0a1[_0xc0bc('0x16')]({'type':_0x34e5d3[_0xc0bc('0x3')][_0xc0bc('0x2e')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x16d3f3[_0xc0bc('0x6')],'exten':_0x16d3f3[_0xc0bc('0x7')],'priority':_0x34e5d3[_0xc0bc('0x2b')][_0xc0bc('0x1b')]+_0xd8b6a3+_0x95ca4d++,'VoiceExtensionId':_0x16d3f3['id']});_0x42d0a1['push']({'type':_0x34e5d3['type'][_0xc0bc('0x2e')](),'app':_0xc0bc('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x16d3f3[_0xc0bc('0x6')],'exten':_0x16d3f3[_0xc0bc('0x7')],'priority':_0x34e5d3[_0xc0bc('0x2b')]['length']+_0xd8b6a3+_0x95ca4d++,'VoiceExtensionId':_0x16d3f3['id']});}}}}for(var _0x54d9c2=0x0;_0x54d9c2<_0x34e5d3['intervals']['length'];_0x54d9c2++){var _0x402fca=_0xd8b6a3+_0x34e5d3[_0xc0bc('0x2b')][_0xc0bc('0x1b')];var _0x808145=_0x54d9c2===_0x34e5d3[_0xc0bc('0x2b')][_0xc0bc('0x1b')]-0x1?_0xd8b6a3+_0x42d0a1[_0xc0bc('0x1b')]+_0x5448ec['length']+0x2:_0xd8b6a3+_0x54d9c2+0x1;_0x42d0a1[_0xc0bc('0x3f')](_0x54d9c2,0x0,{'type':_0x16d3f3['type'],'app':_0xc0bc('0x40'),'appdata':_0x34e5d3[_0xc0bc('0x2b')][_0x54d9c2]+'?'+_0x16d3f3[_0xc0bc('0x6')]+_0xc0bc('0x41')+_0x402fca+':'+_0x16d3f3[_0xc0bc('0x6')]+',${EXTEN},'+_0x808145,'exten':_0x16d3f3[_0xc0bc('0x7')],'context':_0x16d3f3[_0xc0bc('0x6')],'priority':_0xd8b6a3+_0x54d9c2,'VoiceExtensionId':_0x16d3f3['id']});}if(_0x34e5d3[_0xc0bc('0x3b')]==='outboundDial'){_0x34e5d3[_0xc0bc('0x42')]=_0xe9612c(_0x16d3f3,_0x34e5d3[_0xc0bc('0x42')]);}if(_0x34e5d3[_0xc0bc('0x3b')]===_0xc0bc('0x43')){_0x42d0a1['push']({'type':_0x34e5d3[_0xc0bc('0x3')][_0xc0bc('0x2e')](),'app':'Set','appdata':_0xc0bc('0x44'),'context':_0x16d3f3[_0xc0bc('0x6')],'exten':_0x16d3f3[_0xc0bc('0x7')],'priority':_0x34e5d3[_0xc0bc('0x2b')][_0xc0bc('0x1b')]+_0xd8b6a3+_0x95ca4d++,'VoiceExtensionId':_0x16d3f3['id']});}_0x34e5d3[_0xc0bc('0x45')]=_0x42d0a1['length']?_['last'](_0x42d0a1)['priority']+0x1:_0xd8b6a3;_0x6f374d=_['concat'](_0x6f374d,_0x42d0a1,[_0x34e5d3],_0x5448ec);_0xd8b6a3=_[_0xc0bc('0x46')](_0x6f374d)[_0xc0bc('0x45')]+0x1;}return _0x40856a(_0x6f374d);})['catch'](function(_0x3dd049){_0x17d6b9(_0x3dd049);});});}return _0x5d2330['define']('VoiceExtension',attributes,{'tableName':_0xc0bc('0x47'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xf55b9d){var _0x1bfce7=this['get']({'plain':!![]});var _0x249730=_0x1bfce7[_0xc0bc('0x3')]===_0xc0bc('0xb')?_0x4c9407(_0x1bfce7):_0x111134(_0x1bfce7);return _0x1b8d9e(_0x1bfce7,_0xf55b9d,_['last'](_0x249730)['priority']+0x1)[_0xc0bc('0x29')](function(_0x1d249b){var _0x55fd9d=_[_0xc0bc('0x48')](_0x249730,_0x1d249b);_0x55fd9d['push']({'type':_0x1bfce7[_0xc0bc('0x3')],'app':_0xc0bc('0x49'),'exten':_0x1bfce7['exten'],'context':_0x1bfce7[_0xc0bc('0x6')],'priority':_[_0xc0bc('0x46')](_0x55fd9d)[_0xc0bc('0x45')]+0x1,'VoiceExtensionId':_0x1bfce7['id']});return _0x55fd9d;});}}});}; \ No newline at end of file +var _0xaee4=['define','VoiceExtension','voice_extensions','get','Hangup','./voiceExtension.attributes','exports','models','type','Set','exten','inbound','context','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','hasOwnProperty','recordingFormat','none','push','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','options','url','split','length','name','trunk','param','prefix','phone','${EXTEN:','join','U(xcally-mixmonitor-context)','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','toLowerCase','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','playback','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress',',${EXTEN},','outboundDial','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','priority','concat','catch'];(function(_0x7275e9,_0x321fa5){var _0x17b99d=function(_0x54af41){while(--_0x54af41){_0x7275e9['push'](_0x7275e9['shift']());}};_0x17b99d(++_0x321fa5);}(_0xaee4,0xda));var _0x4aee=function(_0x16e173,_0x2f3704){_0x16e173=_0x16e173-0x0;var _0x357395=_0xaee4[_0x16e173];return _0x357395;};'use strict';var _=require('lodash');var attributes=require(_0x4aee('0x0'));module[_0x4aee('0x1')]=function(_0x139716){var _0x579d0f=_0x139716[_0x4aee('0x2')];function _0x5a2772(_0x3bbc5a){var _0x1bb33e=0x2;var _0x3c00cc=[{'type':_0x3bbc5a[_0x4aee('0x3')],'app':_0x4aee('0x4'),'appdata':'CDR(type)='+_0x3bbc5a[_0x4aee('0x3')],'context':_0x3bbc5a['context'],'exten':_0x3bbc5a[_0x4aee('0x5')],'priority':_0x1bb33e++,'VoiceExtensionId':_0x3bbc5a['id']}];if(_0x3bbc5a[_0x4aee('0x3')]==='inbound'){_0x3c00cc['push']({'type':_0x4aee('0x6'),'app':_0x4aee('0x4'),'appdata':'CDR(routeid)='+_0x3bbc5a['id'],'context':_0x3bbc5a[_0x4aee('0x7')],'exten':_0x3bbc5a['exten'],'priority':_0x1bb33e++,'VoiceExtensionId':_0x3bbc5a['id']});}_0x3c00cc['push']({'type':_0x3bbc5a[_0x4aee('0x3')],'app':_0x4aee('0x4'),'appdata':_0x4aee('0x8'),'context':_0x3bbc5a[_0x4aee('0x7')],'exten':_0x3bbc5a['exten'],'priority':_0x1bb33e++,'VoiceExtensionId':_0x3bbc5a['id']},{'type':_0x3bbc5a['type'],'app':_0x4aee('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3bbc5a[_0x4aee('0x7')],'exten':_0x3bbc5a[_0x4aee('0x5')],'priority':_0x1bb33e++,'VoiceExtensionId':_0x3bbc5a['id']},{'type':_0x3bbc5a[_0x4aee('0x3')],'app':_0x4aee('0x4'),'appdata':_0x4aee('0x9'),'context':_0x3bbc5a[_0x4aee('0x7')],'exten':_0x3bbc5a[_0x4aee('0x5')],'priority':_0x1bb33e++,'VoiceExtensionId':_0x3bbc5a['id']});return _0x3c00cc;}function _0x421c5e(_0x40394b){var _0x5783e4=0x2;var _0x577b65=[{'type':_0x4aee('0xa'),'app':_0x4aee('0x4'),'appdata':_0x4aee('0xb'),'context':_0x40394b['context'],'exten':_0x40394b['exten'],'priority':_0x5783e4++,'VoiceExtensionId':_0x40394b['id']},{'type':_0x4aee('0xa'),'app':_0x4aee('0x4'),'appdata':_0x4aee('0xc')+(_0x40394b[_0x4aee('0xd')]?'${EXTEN:'+_0x40394b['cutdigits']+'}':_0x4aee('0xe')),'context':_0x40394b[_0x4aee('0x7')],'exten':_0x40394b[_0x4aee('0x5')],'priority':_0x5783e4++,'VoiceExtensionId':_0x40394b['id']},{'type':_0x4aee('0xa'),'app':_0x4aee('0x4'),'appdata':_0x4aee('0xf')+_0x40394b['id'],'context':_0x40394b[_0x4aee('0x7')],'exten':_0x40394b[_0x4aee('0x5')],'priority':_0x5783e4++,'VoiceExtensionId':_0x40394b['id']},{'type':_0x4aee('0xa'),'app':'ExecIf','appdata':_0x4aee('0x10')+(_0x5783e4+0x2)+_0x4aee('0x11')+(_0x5783e4+0x1)+')','context':_0x40394b[_0x4aee('0x7')],'exten':_0x40394b['exten'],'priority':_0x5783e4++,'VoiceExtensionId':_0x40394b['id']},{'type':_0x4aee('0xa'),'app':_0x4aee('0x4'),'appdata':_0x40394b[_0x4aee('0xd')]?'CDR(prefix)=${EXTEN:0:'+_0x40394b[_0x4aee('0xd')]+'}':'CDR(prefix)=noprefix','context':_0x40394b[_0x4aee('0x7')],'exten':_0x40394b[_0x4aee('0x5')],'priority':_0x5783e4++,'VoiceExtensionId':_0x40394b['id']},{'type':_0x4aee('0xa'),'app':_0x4aee('0x4'),'appdata':_0x4aee('0x8'),'context':_0x40394b[_0x4aee('0x7')],'exten':_0x40394b[_0x4aee('0x5')],'priority':_0x5783e4++,'VoiceExtensionId':_0x40394b['id']},{'type':_0x4aee('0xa'),'app':_0x4aee('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x40394b['context'],'exten':_0x40394b[_0x4aee('0x5')],'priority':_0x5783e4++,'VoiceExtensionId':_0x40394b['id']},{'type':'outbound','app':_0x4aee('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x40394b['context'],'exten':_0x40394b[_0x4aee('0x5')],'priority':_0x5783e4++,'VoiceExtensionId':_0x40394b['id']},{'type':'outbound','app':_0x4aee('0x4'),'appdata':_0x4aee('0x12')+_0x40394b['id'],'context':_0x40394b['context'],'exten':_0x40394b[_0x4aee('0x5')],'priority':_0x5783e4++,'VoiceExtensionId':_0x40394b['id']}];if(_0x40394b[_0x4aee('0x13')](_0x4aee('0x14'))&&_0x40394b['recordingFormat']!==_0x4aee('0x15')){_0x577b65[_0x4aee('0x16')]({'type':_0x4aee('0xa'),'app':_0x4aee('0x4'),'appdata':_0x4aee('0x17'),'context':_0x40394b['context'],'exten':_0x40394b[_0x4aee('0x5')],'priority':_0x5783e4++,'VoiceExtensionId':_0x40394b['id']},{'type':'outbound','app':_0x4aee('0x4'),'appdata':_0x4aee('0x18')+_0x40394b[_0x4aee('0x14')]||_0x4aee('0x19'),'context':_0x40394b[_0x4aee('0x7')],'exten':_0x40394b[_0x4aee('0x5')],'priority':_0x5783e4++,'VoiceExtensionId':_0x40394b['id']});}return _0x577b65;}function _0x4ef333(_0x556896,_0x483099){var _0x54ebbb=[{'name':'trunk','param':0x0},{'name':'timeout','param':0x1},{'name':_0x4aee('0x1a'),'param':0x2},{'name':_0x4aee('0x1b'),'param':0x3}];var _0x44dac7={};var _0x3fd5e3=_0x483099[_0x4aee('0x1c')](',');var _0xc5739d=[];for(var _0x1301e4=0x0;_0x1301e4<_0x54ebbb[_0x4aee('0x1d')];_0x1301e4++){switch(_0x54ebbb[_0x1301e4][_0x4aee('0x1e')]){case'trunk':_0x44dac7[_0x4aee('0x1f')]=_0x3fd5e3[_0x54ebbb[_0x1301e4][_0x4aee('0x20')]]['split']('/')[0x1];_0x44dac7['phone']=_0x3fd5e3[_0x54ebbb[_0x1301e4][_0x4aee('0x20')]]['split']('/')[0x2];_0x44dac7[_0x4aee('0x21')]=_0x44dac7[_0x4aee('0x22')]?_0x44dac7[_0x4aee('0x22')]['split']('$')[0x0]:undefined;_0x44dac7[_0x4aee('0x22')]=_0x556896[_0x4aee('0xd')]?(_0x44dac7[_0x4aee('0x21')]||'')+_0x4aee('0x23')+_0x556896[_0x4aee('0xd')]+'}':(_0x44dac7[_0x4aee('0x21')]||'')+'${EXTEN}';_0xc5739d[_0x54ebbb[_0x1301e4]['param']]=['SIP',_0x44dac7[_0x4aee('0x1f')],_0x44dac7[_0x4aee('0x22')]][_0x4aee('0x24')]('/');break;case _0x4aee('0x1a'):_0x44dac7[_0x4aee('0x1a')]=_0x3fd5e3[_0x54ebbb[_0x1301e4]['param']];if(_0x556896[_0x4aee('0x14')]!==_0x4aee('0x15')){if(_0x44dac7['options']['indexOf'](_0x4aee('0x25'))<0x0){_0x44dac7[_0x4aee('0x1a')]+=_0x4aee('0x25');}}else{_0x44dac7['options']=_0x44dac7['options']['replace'](_0x4aee('0x25'),'');}_0xc5739d[_0x54ebbb[_0x1301e4][_0x4aee('0x20')]]=_0x44dac7[_0x4aee('0x1a')];break;default:_0xc5739d[_0x54ebbb[_0x1301e4]['param']]=_0x3fd5e3[_0x54ebbb[_0x1301e4][_0x4aee('0x20')]];}}return _0xc5739d[_0x4aee('0x24')](',');}function _0x131de6(_0x4e863d,_0x55bd8e,_0x452a9c){return new Promise(function(_0x477b85,_0x2bea70){var _0x513bb9=[];if(_['isEmpty'](_0x55bd8e))return _0x477b85(_0x513bb9);_0x579d0f[_0x4aee('0x26')][_0x4aee('0x27')]({'attributes':['id',_0x4aee('0x28'),_0x4aee('0x29')],'raw':!![]})[_0x4aee('0x2a')](function(_0x364fb2){for(var _0x2b8f08=0x0,_0x431cfc=0x0;_0x2b8f08<_0x55bd8e[_0x4aee('0x1d')];_0x2b8f08++,_0x431cfc=0x0){var _0x3076d6=_0x55bd8e[_0x2b8f08];var _0x35a6e6=[];var _0x1c077d=[];delete _0x3076d6['id'];if(_0x3076d6[_0x4aee('0x28')]!==_0x4aee('0x2b')){_0x3076d6[_0x4aee('0x2c')]=[_0x3076d6['interval']];}else{_0x3076d6['intervals']=_0x3076d6['IntervalId']?_['map'](_['filter'](_0x364fb2,{'IntervalId':_0x3076d6[_0x4aee('0x29')]}),'interval'):[];}_0x3076d6['context']=_0x4e863d[_0x4aee('0x7')];_0x3076d6[_0x4aee('0x5')]=_0x4e863d['exten'];if(_0x3076d6['type'])_0x3076d6[_0x4aee('0x3')]=_0x3076d6[_0x4aee('0x3')][_0x4aee('0x2d')]();if(_0x4e863d[_0x4aee('0x3')]===_0x4aee('0xa')){if(_0x3076d6['hasOwnProperty'](_0x4aee('0x2e'))&&_0x3076d6[_0x4aee('0x2e')]&&_0x3076d6[_0x4aee('0x2e')]!=='--'){_0x35a6e6[_0x4aee('0x16')]({'type':_0x3076d6[_0x4aee('0x3')][_0x4aee('0x2d')](),'app':_0x4aee('0x4'),'appdata':_0x4aee('0x2f')+_0x3076d6['tag'],'context':_0x4e863d[_0x4aee('0x7')],'exten':_0x4e863d[_0x4aee('0x5')],'priority':_0x3076d6['intervals'][_0x4aee('0x1d')]+_0x452a9c+_0x431cfc++,'VoiceExtensionId':_0x4e863d['id']});}_0x35a6e6[_0x4aee('0x16')]({'type':_0x3076d6['type'][_0x4aee('0x2d')](),'app':_0x4aee('0x30'),'appdata':_0x4aee('0x31')+(_0x3076d6[_0x4aee('0x32')]?_0x4aee('0x33')+_0x3076d6[_0x4aee('0x32')]+')':'NoOp(No\x20number\x20available)'),'context':_0x4e863d['context'],'exten':_0x4e863d['exten'],'priority':_0x3076d6[_0x4aee('0x2c')]['length']+_0x452a9c+_0x431cfc++,'VoiceExtensionId':_0x4e863d['id']});}else{if(_0x3076d6[_0x4aee('0x13')](_0x4aee('0x34'))){if(['queue',_0x4aee('0x35')][_0x4aee('0x36')](_0x3076d6[_0x4aee('0x37')][_0x4aee('0x2d')]())&&_0x3076d6[_0x4aee('0x38')]!=='custom'){if(_0x3076d6[_0x4aee('0x34')]){_0x35a6e6[_0x4aee('0x16')]({'type':_0x3076d6[_0x4aee('0x3')][_0x4aee('0x2d')](),'app':_0x4aee('0x30'),'appdata':_0x4aee('0x39'),'context':_0x4e863d['context'],'exten':_0x4e863d[_0x4aee('0x5')],'priority':_0x3076d6[_0x4aee('0x2c')]['length']+_0x452a9c+_0x431cfc++,'VoiceExtensionId':_0x4e863d['id']});_0x35a6e6['push']({'type':_0x3076d6['type'][_0x4aee('0x2d')](),'app':_0x4aee('0x4'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4e863d['context'],'exten':_0x4e863d['exten'],'priority':_0x3076d6[_0x4aee('0x2c')][_0x4aee('0x1d')]+_0x452a9c+_0x431cfc++,'VoiceExtensionId':_0x4e863d['id']});}else{_0x35a6e6[_0x4aee('0x16')]({'type':_0x3076d6[_0x4aee('0x3')][_0x4aee('0x2d')](),'app':_0x4aee('0x30'),'appdata':_0x4aee('0x3a'),'context':_0x4e863d[_0x4aee('0x7')],'exten':_0x4e863d['exten'],'priority':_0x3076d6['intervals']['length']+_0x452a9c+_0x431cfc++,'VoiceExtensionId':_0x4e863d['id']});_0x35a6e6['push']({'type':_0x3076d6[_0x4aee('0x3')][_0x4aee('0x2d')](),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x4e863d[_0x4aee('0x7')],'exten':_0x4e863d['exten'],'priority':_0x3076d6[_0x4aee('0x2c')][_0x4aee('0x1d')]+_0x452a9c+_0x431cfc++,'VoiceExtensionId':_0x4e863d['id']});}}}}for(var _0x3b07ef=0x0;_0x3b07ef<_0x3076d6[_0x4aee('0x2c')]['length'];_0x3b07ef++){var _0x2e99cf=_0x452a9c+_0x3076d6[_0x4aee('0x2c')][_0x4aee('0x1d')];var _0x33bf88=_0x3b07ef===_0x3076d6[_0x4aee('0x2c')][_0x4aee('0x1d')]-0x1?_0x452a9c+_0x35a6e6['length']+_0x1c077d[_0x4aee('0x1d')]+0x2:_0x452a9c+_0x3b07ef+0x1;_0x35a6e6['splice'](_0x3b07ef,0x0,{'type':_0x4e863d[_0x4aee('0x3')],'app':'GotoIfTime','appdata':_0x3076d6[_0x4aee('0x2c')][_0x3b07ef]+'?'+_0x4e863d[_0x4aee('0x7')]+_0x4aee('0x3b')+_0x2e99cf+':'+_0x4e863d[_0x4aee('0x7')]+',${EXTEN},'+_0x33bf88,'exten':_0x4e863d[_0x4aee('0x5')],'context':_0x4e863d[_0x4aee('0x7')],'priority':_0x452a9c+_0x3b07ef,'VoiceExtensionId':_0x4e863d['id']});}if(_0x3076d6['appType']===_0x4aee('0x3c')){_0x3076d6['appdata']=_0x4ef333(_0x4e863d,_0x3076d6['appdata']);}if(_0x3076d6['appType']==='agi'){_0x35a6e6[_0x4aee('0x16')]({'type':_0x3076d6['type']['toLowerCase'](),'app':'Set','appdata':_0x4aee('0x3d'),'context':_0x4e863d[_0x4aee('0x7')],'exten':_0x4e863d['exten'],'priority':_0x3076d6[_0x4aee('0x2c')][_0x4aee('0x1d')]+_0x452a9c+_0x431cfc++,'VoiceExtensionId':_0x4e863d['id']});}_0x3076d6['priority']=_0x35a6e6['length']?_[_0x4aee('0x3e')](_0x35a6e6)[_0x4aee('0x3f')]+0x1:_0x452a9c;_0x513bb9=_[_0x4aee('0x40')](_0x513bb9,_0x35a6e6,[_0x3076d6],_0x1c077d);_0x452a9c=_[_0x4aee('0x3e')](_0x513bb9)[_0x4aee('0x3f')]+0x1;}return _0x477b85(_0x513bb9);})[_0x4aee('0x41')](function(_0x205d3b){_0x2bea70(_0x205d3b);});});}return _0x139716[_0x4aee('0x42')](_0x4aee('0x43'),attributes,{'tableName':_0x4aee('0x44'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4ddfa9){var _0x5cbf69=this[_0x4aee('0x45')]({'plain':!![]});var _0x2b114e=_0x5cbf69['type']===_0x4aee('0xa')?_0x421c5e(_0x5cbf69):_0x5a2772(_0x5cbf69);return _0x131de6(_0x5cbf69,_0x4ddfa9,_[_0x4aee('0x3e')](_0x2b114e)[_0x4aee('0x3f')]+0x1)['then'](function(_0x2b8879){var _0x380165=_[_0x4aee('0x40')](_0x2b114e,_0x2b8879);_0x380165[_0x4aee('0x16')]({'type':_0x5cbf69['type'],'app':_0x4aee('0x46'),'exten':_0x5cbf69['exten'],'context':_0x5cbf69[_0x4aee('0x7')],'priority':_[_0x4aee('0x3e')](_0x380165)['priority']+0x1,'VoiceExtensionId':_0x5cbf69['id']});return _0x380165;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index ac9b2a9..5c0fa34 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 _0xbb67=['GetVoiceExtension','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','message','result','catch','VoiceExtension','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x541d11,_0x45ff54){var _0x12f92c=function(_0x5521d8){while(--_0x5521d8){_0x541d11['push'](_0x541d11['shift']());}};_0x12f92c(++_0x45ff54);}(_0xbb67,0x161));var _0x7bb6=function(_0x5e80b9,_0x362ed){_0x5e80b9=_0x5e80b9-0x0;var _0x4b2df4=_0xbb67[_0x5e80b9];return _0x4b2df4;};'use strict';var _=require('lodash');var util=require(_0x7bb6('0x0'));var moment=require(_0x7bb6('0x1'));var BPromise=require(_0x7bb6('0x2'));var rs=require(_0x7bb6('0x3'));var fs=require('fs');var Redis=require(_0x7bb6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7bb6('0x5'));var logger=require(_0x7bb6('0x6'))(_0x7bb6('0x7'));var config=require(_0x7bb6('0x8'));var jayson=require(_0x7bb6('0x9'));var client=jayson[_0x7bb6('0xa')][_0x7bb6('0xb')]({'port':0x232a});config[_0x7bb6('0xc')]=_['defaults'](config[_0x7bb6('0xc')],{'host':_0x7bb6('0xd'),'port':0x18eb});var socket=require(_0x7bb6('0xe'))(new Redis(config[_0x7bb6('0xc')]));require(_0x7bb6('0xf'))[_0x7bb6('0x10')](socket);function respondWithRpcPromise(_0x2ffdaa,_0x17eee7,_0x14a6af){return new BPromise(function(_0x4fce9e,_0x3dc93c){return client[_0x7bb6('0x11')](_0x2ffdaa,_0x14a6af)[_0x7bb6('0x12')](function(_0x46be82){logger[_0x7bb6('0x13')](_0x7bb6('0x14'),_0x17eee7,_0x7bb6('0x15'));logger[_0x7bb6('0x16')](_0x7bb6('0x17'),_0x17eee7,'request\x20sent',JSON['stringify'](_0x46be82));if(_0x46be82[_0x7bb6('0x18')]){if(_0x46be82[_0x7bb6('0x18')]['code']===0x1f4){logger[_0x7bb6('0x18')](_0x7bb6('0x14'),_0x17eee7,_0x46be82[_0x7bb6('0x18')][_0x7bb6('0x19')]);return _0x3dc93c(_0x46be82[_0x7bb6('0x18')][_0x7bb6('0x19')]);}logger['error'](_0x7bb6('0x14'),_0x17eee7,_0x46be82[_0x7bb6('0x18')][_0x7bb6('0x19')]);return _0x4fce9e(_0x46be82[_0x7bb6('0x18')][_0x7bb6('0x19')]);}else{logger[_0x7bb6('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x17eee7,_0x7bb6('0x15'));_0x4fce9e(_0x46be82[_0x7bb6('0x1a')][_0x7bb6('0x19')]);}})[_0x7bb6('0x1b')](function(_0x392a00){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x17eee7,_0x392a00);_0x3dc93c(_0x392a00);});});}exports['GetVoiceExtension']=function(_0x15eafb){var _0x88e054=this;return new Promise(function(_0x118e9e,_0x30eb86){return db[_0x7bb6('0x1c')][_0x7bb6('0x1d')]({'raw':_0x15eafb['options']?_0x15eafb[_0x7bb6('0x1e')][_0x7bb6('0x1f')]===undefined?!![]:![]:!![],'where':_0x15eafb['options']?_0x15eafb['options']['where']||null:null,'attributes':_0x15eafb[_0x7bb6('0x1e')]?_0x15eafb[_0x7bb6('0x1e')][_0x7bb6('0x20')]||null:null,'limit':_0x15eafb['options']?_0x15eafb[_0x7bb6('0x1e')][_0x7bb6('0x21')]||null:null,'include':_0x15eafb[_0x7bb6('0x1e')]?_0x15eafb[_0x7bb6('0x1e')][_0x7bb6('0x22')]?_[_0x7bb6('0x23')](_0x15eafb['options'][_0x7bb6('0x22')],function(_0x515091){return{'model':db[_0x515091[_0x7bb6('0x24')]],'as':_0x515091['as'],'attributes':_0x515091[_0x7bb6('0x20')],'include':_0x515091['include']?_[_0x7bb6('0x23')](_0x515091[_0x7bb6('0x22')],function(_0x3896ba){return{'model':db[_0x3896ba['model']],'as':_0x3896ba['as'],'attributes':_0x3896ba[_0x7bb6('0x20')],'include':_0x3896ba['include']?_['map'](_0x3896ba[_0x7bb6('0x22')],function(_0x13fad0){return{'model':db[_0x13fad0[_0x7bb6('0x24')]],'as':_0x13fad0['as'],'attributes':_0x13fad0[_0x7bb6('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7bb6('0x12')](function(_0x3684eb){logger['info'](_0x7bb6('0x25'),_0x15eafb);logger['debug'](_0x7bb6('0x25'),_0x15eafb,JSON[_0x7bb6('0x26')](_0x3684eb));_0x118e9e(_0x3684eb);})[_0x7bb6('0x1b')](function(_0x4f3763){logger[_0x7bb6('0x18')](_0x7bb6('0x25'),_0x4f3763[_0x7bb6('0x19')],_0x15eafb);_0x30eb86(_0x88e054[_0x7bb6('0x18')](0x1f4,_0x4f3763['message']));});});}; \ No newline at end of file +var _0x15c6=['attributes','map','model','GetVoiceExtension','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','then','info','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','options','raw','limit','include'];(function(_0x571dbc,_0x400df9){var _0x55043c=function(_0x47df3b){while(--_0x47df3b){_0x571dbc['push'](_0x571dbc['shift']());}};_0x55043c(++_0x400df9);}(_0x15c6,0x1cd));var _0x615c=function(_0x40822a,_0x582b60){_0x40822a=_0x40822a-0x0;var _0x357420=_0x15c6[_0x40822a];return _0x357420;};'use strict';var _=require(_0x615c('0x0'));var util=require(_0x615c('0x1'));var moment=require(_0x615c('0x2'));var BPromise=require(_0x615c('0x3'));var rs=require(_0x615c('0x4'));var fs=require('fs');var Redis=require(_0x615c('0x5'));var db=require(_0x615c('0x6'))['db'];var utils=require(_0x615c('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x615c('0x8'));var client=jayson[_0x615c('0x9')][_0x615c('0xa')]({'port':0x232a});config['redis']=_[_0x615c('0xb')](config[_0x615c('0xc')],{'host':_0x615c('0xd'),'port':0x18eb});var socket=require(_0x615c('0xe'))(new Redis(config['redis']));require(_0x615c('0xf'))['register'](socket);function respondWithRpcPromise(_0x3df139,_0x19f033,_0x2af037){return new BPromise(function(_0x8f4a1e,_0x51f114){return client['request'](_0x3df139,_0x2af037)[_0x615c('0x10')](function(_0x286731){logger[_0x615c('0x11')](_0x615c('0x12'),_0x19f033,'request\x20sent');logger['debug'](_0x615c('0x13'),_0x19f033,_0x615c('0x14'),JSON['stringify'](_0x286731));if(_0x286731[_0x615c('0x15')]){if(_0x286731['error']['code']===0x1f4){logger[_0x615c('0x15')](_0x615c('0x12'),_0x19f033,_0x286731[_0x615c('0x15')][_0x615c('0x16')]);return _0x51f114(_0x286731[_0x615c('0x15')][_0x615c('0x16')]);}logger['error'](_0x615c('0x12'),_0x19f033,_0x286731[_0x615c('0x15')][_0x615c('0x16')]);return _0x8f4a1e(_0x286731['error'][_0x615c('0x16')]);}else{logger[_0x615c('0x11')](_0x615c('0x12'),_0x19f033,_0x615c('0x14'));_0x8f4a1e(_0x286731[_0x615c('0x17')][_0x615c('0x16')]);}})[_0x615c('0x18')](function(_0x341344){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x19f033,_0x341344);_0x51f114(_0x341344);});});}exports['GetVoiceExtension']=function(_0x2cbe15){var _0x1179a3=this;return new Promise(function(_0x348280,_0x146c58){return db['VoiceExtension']['findAll']({'raw':_0x2cbe15[_0x615c('0x19')]?_0x2cbe15['options'][_0x615c('0x1a')]===undefined?!![]:![]:!![],'where':_0x2cbe15['options']?_0x2cbe15[_0x615c('0x19')]['where']||null:null,'attributes':_0x2cbe15[_0x615c('0x19')]?_0x2cbe15[_0x615c('0x19')]['attributes']||null:null,'limit':_0x2cbe15['options']?_0x2cbe15[_0x615c('0x19')][_0x615c('0x1b')]||null:null,'include':_0x2cbe15[_0x615c('0x19')]?_0x2cbe15[_0x615c('0x19')][_0x615c('0x1c')]?_['map'](_0x2cbe15[_0x615c('0x19')][_0x615c('0x1c')],function(_0x5968aa){return{'model':db[_0x5968aa['model']],'as':_0x5968aa['as'],'attributes':_0x5968aa[_0x615c('0x1d')],'include':_0x5968aa[_0x615c('0x1c')]?_[_0x615c('0x1e')](_0x5968aa['include'],function(_0x32ce76){return{'model':db[_0x32ce76[_0x615c('0x1f')]],'as':_0x32ce76['as'],'attributes':_0x32ce76[_0x615c('0x1d')],'include':_0x32ce76[_0x615c('0x1c')]?_['map'](_0x32ce76[_0x615c('0x1c')],function(_0x174259){return{'model':db[_0x174259[_0x615c('0x1f')]],'as':_0x174259['as'],'attributes':_0x174259[_0x615c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x615c('0x10')](function(_0x266e46){logger[_0x615c('0x11')](_0x615c('0x20'),_0x2cbe15);logger[_0x615c('0x21')](_0x615c('0x20'),_0x2cbe15,JSON[_0x615c('0x22')](_0x266e46));_0x348280(_0x266e46);})[_0x615c('0x18')](function(_0x391211){logger[_0x615c('0x15')]('GetVoiceExtension',_0x391211[_0x615c('0x16')],_0x2cbe15);_0x146c58(_0x1179a3[_0x615c('0x15')](0x1f4,_0x391211[_0x615c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index d16b1d1..37f1d0b 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['remove','update','removeListener','register','length','./voiceExtension.events','save'];(function(_0x191c5f,_0x1e04c0){var _0xaec83a=function(_0x112f3e){while(--_0x112f3e){_0x191c5f['push'](_0x191c5f['shift']());}};_0xaec83a(++_0x1e04c0);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xc4aa[_0x2d2c16];return _0x53f2fb;};'use strict';var VoiceExtensionEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){VoiceExtensionEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('voiceExtension:'+_0x10525b,_0x215f39);VoiceExtensionEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file +var _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0x3ac893,_0x462309){var _0x5dbec2=function(_0x36627d){while(--_0x36627d){_0x3ac893['push'](_0x3ac893['shift']());}};_0x5dbec2(++_0x462309);}(_0xf494,0x1c6));var _0x4f49=function(_0xce9363,_0x58cd6b){_0xce9363=_0xce9363-0x0;var _0x529f99=_0xf494[_0xce9363];return _0x529f99;};'use strict';var VoiceExtensionEvents=require(_0x4f49('0x0'));var events=[_0x4f49('0x1'),_0x4f49('0x2'),'update'];function createListener(_0x3aeeb8,_0x1d54cc){return function(_0x423b25){_0x1d54cc[_0x4f49('0x3')](_0x3aeeb8,_0x423b25);};}function removeListener(_0x20c0d7,_0x2a15fb){return function(){VoiceExtensionEvents[_0x4f49('0x4')](_0x20c0d7,_0x2a15fb);};}exports[_0x4f49('0x5')]=function(_0xc5e778){for(var _0x413530=0x0,_0x42b0e8=events['length'];_0x413530<_0x42b0e8;_0x413530++){var _0x58e9a0=events[_0x413530];var _0x169c95=createListener(_0x4f49('0x6')+_0x58e9a0,_0xc5e778);VoiceExtensionEvents['on'](_0x58e9a0,_0x169c95);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index f5c31ca..d4296db 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 _0xacf4=['index','/:id','isAuthenticated','show','post','create','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get'];(function(_0x4c12c3,_0x29b9b9){var _0x2e3a78=function(_0x2e2538){while(--_0x2e2538){_0x4c12c3['push'](_0x4c12c3['shift']());}};_0x2e3a78(++_0x29b9b9);}(_0xacf4,0xe7));var _0x4acf=function(_0x3799ac,_0x4756a2){_0x3799ac=_0x3799ac-0x0;var _0x3e9c5e=_0xacf4[_0x3799ac];return _0x3e9c5e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4acf('0x0'));var timeout=require(_0x4acf('0x1'));var express=require(_0x4acf('0x2'));var router=express[_0x4acf('0x3')]();var fs_extra=require(_0x4acf('0x4'));var auth=require(_0x4acf('0x5'));var interaction=require(_0x4acf('0x6'));var config=require('../../config/environment');var controller=require(_0x4acf('0x7'));router[_0x4acf('0x8')]('/',auth['isAuthenticated'](),controller[_0x4acf('0x9')]);router[_0x4acf('0x8')](_0x4acf('0xa'),auth[_0x4acf('0xb')](),controller[_0x4acf('0xc')]);router['get']('/:id/messages',auth[_0x4acf('0xb')](),controller['getMessages']);router[_0x4acf('0xd')]('/',auth[_0x4acf('0xb')](),controller[_0x4acf('0xe')]);router['put'](_0x4acf('0xa'),auth[_0x4acf('0xb')](),controller['update']);router['delete'](_0x4acf('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x4acf('0xf')]=router; \ No newline at end of file +var _0xfdbd=['get','getMessages','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','isAuthenticated','index','show'];(function(_0xaa6625,_0x4ef31d){var _0xfd8be4=function(_0x4f3d20){while(--_0x4f3d20){_0xaa6625['push'](_0xaa6625['shift']());}};_0xfd8be4(++_0x4ef31d);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xfdbd[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var path=require(_0xdfdb('0x2'));var timeout=require(_0xdfdb('0x3'));var express=require(_0xdfdb('0x4'));var router=express[_0xdfdb('0x5')]();var fs_extra=require(_0xdfdb('0x6'));var auth=require(_0xdfdb('0x7'));var interaction=require(_0xdfdb('0x8'));var config=require('../../config/environment');var controller=require(_0xdfdb('0x9'));router['get']('/',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xdfdb('0xc')]);router[_0xdfdb('0xd')]('/:id/messages',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0xe')]);router[_0xdfdb('0xf')]('/',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x10')]);router[_0xdfdb('0x11')](_0xdfdb('0x12'),auth['isAuthenticated'](),controller[_0xdfdb('0x13')]);router[_0xdfdb('0x14')]('/:id',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x15')]);module[_0xdfdb('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 0240ab9..956bbfb 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 _0x73b1=['string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','email'];(function(_0x41d0c2,_0x5921a8){var _0x2a1755=function(_0x51f5ed){while(--_0x51f5ed){_0x41d0c2['push'](_0x41d0c2['shift']());}};_0x2a1755(++_0x5921a8);}(_0x73b1,0x9c));var _0x173b=function(_0x395fa4,_0x4aca26){_0x395fa4=_0x395fa4-0x0;var _0x4a2921=_0x73b1[_0x395fa4];return _0x4a2921;};'use strict';var Sequelize=require(_0x173b('0x0'));module[_0x173b('0x1')]={'customer_id':{'type':Sequelize[_0x173b('0x2')]},'context':{'type':Sequelize[_0x173b('0x2')],'defaultValue':_0x173b('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x173b('0x2')],'defaultValue':'','allowNull':![],'unique':_0x173b('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x173b('0x2')],'validate':{'isEmail':!![]},'set':function(_0xa25171){this['setDataValue'](_0x173b('0x5'),typeof _0xa25171===_0x173b('0x6')&&_0xa25171[_0x173b('0x7')]()?_0xa25171[_0x173b('0x7')]():null);}},'pager':{'type':Sequelize[_0x173b('0x2')]},'tz':{'type':Sequelize[_0x173b('0x2')],'defaultValue':_0x173b('0x8')},'attach':{'type':Sequelize[_0x173b('0x9')](_0x173b('0xa'),'no'),'defaultValue':_0x173b('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x173b('0x9')](_0x173b('0xa'),'no'),'defaultValue':_0x173b('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x173b('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0x173b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x173b('0x9')](_0x173b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x173b('0x9')](_0x173b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x173b('0x9')](_0x173b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x173b('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x173b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x173b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x173b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x173b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x173b('0x9')](_0x173b('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x173b('0xc')},'emailsubject':{'type':Sequelize[_0x173b('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x173b('0xd')],'get':function(){return this[_0x173b('0xe')](_0x173b('0xf'))+_0x173b('0x10')+this[_0x173b('0xe')](_0x173b('0x11'));}}}; \ No newline at end of file +var _0xb47b=['central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xb47b,0x1e5));var _0xbb47=function(_0x2867e5,_0x8c540c){_0x2867e5=_0x2867e5-0x0;var _0x12a39f=_0xb47b[_0x2867e5];return _0x12a39f;};'use strict';var Sequelize=require(_0xbb47('0x0'));module[_0xbb47('0x1')]={'customer_id':{'type':Sequelize[_0xbb47('0x2')]},'context':{'type':Sequelize[_0xbb47('0x2')],'defaultValue':_0xbb47('0x3'),'unique':_0xbb47('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xbb47('0x4')},'password':{'type':Sequelize[_0xbb47('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xbb47('0x2')],'validate':{'isEmail':!![]},'set':function(_0x292ba9){this[_0xbb47('0x5')](_0xbb47('0x6'),typeof _0x292ba9===_0xbb47('0x7')&&_0x292ba9[_0xbb47('0x8')]()?_0x292ba9[_0xbb47('0x8')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xbb47('0x9')},'attach':{'type':Sequelize[_0xbb47('0xa')](_0xbb47('0xb'),'no'),'defaultValue':_0xbb47('0xb'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xbb47('0xb'),'no'),'defaultValue':_0xbb47('0xb'),'allowNull':![]},'dialout':{'type':Sequelize[_0xbb47('0x2')]},'callback':{'type':Sequelize[_0xbb47('0x2')]},'review':{'type':Sequelize['ENUM'](_0xbb47('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xbb47('0xa')](_0xbb47('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xbb47('0xa')](_0xbb47('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xbb47('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xbb47('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xbb47('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xbb47('0xa')](_0xbb47('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xbb47('0xb'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xbb47('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xbb47('0xa')](_0xbb47('0xb'),'no'),'defaultValue':_0xbb47('0xb'),'allowNull':![]},'stamp':{'type':_0xbb47('0xd')},'emailsubject':{'type':Sequelize[_0xbb47('0x2')]},'emailbody':{'type':Sequelize[_0xbb47('0x2')]},'maxsecs':{'type':Sequelize[_0xbb47('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xbb47('0xf')],'get':function(){return this[_0xbb47('0x10')](_0xbb47('0x11'))+'\x20-\x20'+this[_0xbb47('0x10')](_0xbb47('0x12'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index aeb3af6..2bb30a4 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 _0x087b=['catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','destroy','getMessages','findOne','hasOwnProperty','order','mailbox','VoiceMailMessage','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','error','stack','name','send','index','VoiceMail','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','where','merge','options','includeAll','include','findAll','show','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource'];(function(_0x421263,_0x18187d){var _0x34e4b5=function(_0x4e7978){while(--_0x4e7978){_0x421263['push'](_0x421263['shift']());}};_0x34e4b5(++_0x18187d);}(_0x087b,0x11a));var _0xb087=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x087b[_0x45b034];return _0x509cb0;};'use strict';var emlformat=require(_0xb087('0x0'));var rimraf=require(_0xb087('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb087('0x2'));var moment=require('moment');var BPromise=require(_0xb087('0x3'));var Mustache=require(_0xb087('0x4'));var util=require(_0xb087('0x5'));var path=require(_0xb087('0x6'));var sox=require(_0xb087('0x7'));var csv=require(_0xb087('0x8'));var ejs=require(_0xb087('0x9'));var fs=require('fs');var fs_extra=require(_0xb087('0xa'));var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x8'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var hardwareService=require(_0xb087('0x15'));var logger=require(_0xb087('0x16'))(_0xb087('0x17'));var utils=require(_0xb087('0x18'));var config=require(_0xb087('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb087('0x1a'))['db'];function respondWithStatusCode(_0x31f977,_0x323656){_0x323656=_0x323656||0xcc;return function(_0x51ceaa){if(_0x51ceaa){return _0x31f977[_0xb087('0x1b')](_0x323656);}return _0x31f977[_0xb087('0x1c')](_0x323656)[_0xb087('0x1d')]();};}function respondWithResult(_0x46410b,_0x11784c){_0x11784c=_0x11784c||0xc8;return function(_0x12d0db){if(_0x12d0db){return _0x46410b[_0xb087('0x1c')](_0x11784c)[_0xb087('0x1e')](_0x12d0db);}};}function respondWithFilteredResult(_0x24e1a3,_0x16d0b7){return function(_0x5193a4){if(_0x5193a4){var _0x43e576=typeof _0x16d0b7[_0xb087('0x1f')]==='undefined'&&typeof _0x16d0b7[_0xb087('0x20')]===_0xb087('0x21');var _0x2e9e74=_0x5193a4['count'];var _0x330005=_0x43e576?0x0:_0x16d0b7[_0xb087('0x1f')];var _0x17200d=_0x43e576?_0x5193a4[_0xb087('0x22')]:_0x16d0b7['offset']+_0x16d0b7[_0xb087('0x20')];var _0x28428e;if(_0x17200d>=_0x2e9e74){_0x17200d=_0x2e9e74;_0x28428e=0xc8;}else{_0x28428e=0xce;}_0x24e1a3[_0xb087('0x1c')](_0x28428e);return _0x24e1a3[_0xb087('0x23')]('Content-Range',_0x330005+'-'+_0x17200d+'/'+_0x2e9e74)['json'](_0x5193a4);}return null;};}function patchUpdates(_0x5ea3dc){return function(_0x49450a){try{jsonpatch[_0xb087('0x24')](_0x49450a,_0x5ea3dc,!![]);}catch(_0x17be8e){return BPromise[_0xb087('0x25')](_0x17be8e);}return _0x49450a[_0xb087('0x26')]();};}function saveUpdates(_0x1fb765,_0x258b4c){return function(_0x31ae01){if(_0x31ae01){return _0x31ae01['update'](_0x1fb765)[_0xb087('0x27')](function(_0x466397){return _0x466397;});}return null;};}function removeEntity(_0x1de654,_0x1cfb3e){return function(_0x3ad74e){if(_0x3ad74e){return _0x3ad74e['destroy']()[_0xb087('0x27')](function(){var _0xdd4216=_0x3ad74e['get']({'plain':!![]});var _0x5a2dc6='Voicemails';return db['UserProfileResource']['destroy']({'where':{'type':_0x5a2dc6,'resourceId':_0xdd4216['id']}})[_0xb087('0x27')](function(){return _0x3ad74e;});})[_0xb087('0x27')](function(){_0x1de654[_0xb087('0x1c')](0xcc)[_0xb087('0x1d')]();});}};}function handleEntityNotFound(_0xd9ec66,_0xb72173){return function(_0xf3f41f){if(!_0xf3f41f){_0xd9ec66[_0xb087('0x1b')](0x194);}return _0xf3f41f;};}function handleError(_0x6cfb22,_0x1551c3){_0x1551c3=_0x1551c3||0x1f4;return function(_0x18058c){logger[_0xb087('0x28')](_0x18058c[_0xb087('0x29')]);if(_0x18058c[_0xb087('0x2a')]){delete _0x18058c['name'];}_0x6cfb22[_0xb087('0x1c')](_0x1551c3)[_0xb087('0x2b')](_0x18058c);};}exports[_0xb087('0x2c')]=function(_0x15c9ac,_0x22d441){var _0xa6d90c={},_0x2e1c57={},_0x13fb2f={'count':0x0,'rows':[]};var _0x53a535=_['map'](db[_0xb087('0x2d')][_0xb087('0x2e')],function(_0x4cb5a8){return{'name':_0x4cb5a8[_0xb087('0x2f')],'type':_0x4cb5a8[_0xb087('0x30')][_0xb087('0x31')]};});_0x2e1c57[_0xb087('0x32')]=_[_0xb087('0x33')](_0x53a535,_0xb087('0x2a'));_0x2e1c57[_0xb087('0x34')]=_[_0xb087('0x35')](_0x15c9ac[_0xb087('0x34')]);_0x2e1c57[_0xb087('0x36')]=_[_0xb087('0x37')](_0x2e1c57[_0xb087('0x32')],_0x2e1c57['query']);_0xa6d90c[_0xb087('0x38')]=_['intersection'](_0x2e1c57[_0xb087('0x32')],qs[_0xb087('0x39')](_0x15c9ac[_0xb087('0x34')][_0xb087('0x39')]));_0xa6d90c[_0xb087('0x38')]=_0xa6d90c[_0xb087('0x38')][_0xb087('0x3a')]?_0xa6d90c[_0xb087('0x38')]:_0x2e1c57[_0xb087('0x32')];if(!_0x15c9ac['query']['hasOwnProperty'](_0xb087('0x3b'))){_0xa6d90c[_0xb087('0x20')]=qs[_0xb087('0x20')](_0x15c9ac[_0xb087('0x34')][_0xb087('0x20')]);_0xa6d90c['offset']=qs[_0xb087('0x1f')](_0x15c9ac[_0xb087('0x34')]['offset']);}_0xa6d90c['order']=qs[_0xb087('0x3c')](_0x15c9ac[_0xb087('0x34')][_0xb087('0x3c')]);_0xa6d90c['where']=qs[_0xb087('0x36')](_[_0xb087('0x3d')](_0x15c9ac[_0xb087('0x34')],_0x2e1c57[_0xb087('0x36')]),_0x53a535);if(_0x15c9ac[_0xb087('0x34')]['filter']){_0xa6d90c[_0xb087('0x3e')]=_['merge'](_0xa6d90c[_0xb087('0x3e')],{'$or':_['map'](_0x53a535,function(_0x52a98f){if(_0x52a98f[_0xb087('0x30')]!=='VIRTUAL'){var _0xed47c4={};_0xed47c4[_0x52a98f['name']]={'$like':'%'+_0x15c9ac[_0xb087('0x34')]['filter']+'%'};return _0xed47c4;}})});}_0xa6d90c=_[_0xb087('0x3f')]({},_0xa6d90c,_0x15c9ac[_0xb087('0x40')]);var _0x364b1d={'where':_0xa6d90c[_0xb087('0x3e')]};return db[_0xb087('0x2d')][_0xb087('0x22')](_0x364b1d)[_0xb087('0x27')](function(_0x5e7690){_0x13fb2f[_0xb087('0x22')]=_0x5e7690;if(_0x15c9ac['query'][_0xb087('0x41')]){_0xa6d90c[_0xb087('0x42')]=[{'all':!![]}];}return db['VoiceMail'][_0xb087('0x43')](_0xa6d90c);})[_0xb087('0x27')](function(_0x7650c5){_0x13fb2f['rows']=_0x7650c5;return _0x13fb2f;})[_0xb087('0x27')](respondWithFilteredResult(_0x22d441,_0xa6d90c))['catch'](handleError(_0x22d441,null));};exports[_0xb087('0x44')]=function(_0x32b9d3,_0x5e7f45){var _0x38cb9d={'raw':!![],'where':{'id':_0x32b9d3['params']['id']}},_0x302ce7={};_0x302ce7[_0xb087('0x32')]=_[_0xb087('0x35')](db['VoiceMail'][_0xb087('0x2e')]);_0x302ce7[_0xb087('0x34')]=_[_0xb087('0x35')](_0x32b9d3[_0xb087('0x34')]);_0x302ce7['filters']=_['intersection'](_0x302ce7[_0xb087('0x32')],_0x302ce7[_0xb087('0x34')]);_0x38cb9d[_0xb087('0x38')]=_[_0xb087('0x37')](_0x302ce7[_0xb087('0x32')],qs[_0xb087('0x39')](_0x32b9d3['query']['fields']));_0x38cb9d[_0xb087('0x38')]=_0x38cb9d['attributes'][_0xb087('0x3a')]?_0x38cb9d[_0xb087('0x38')]:_0x302ce7[_0xb087('0x32')];if(_0x32b9d3[_0xb087('0x34')]['includeAll']){_0x38cb9d[_0xb087('0x42')]=[{'all':!![]}];}_0x38cb9d=_['merge']({},_0x38cb9d,_0x32b9d3[_0xb087('0x40')]);return db[_0xb087('0x2d')][_0xb087('0x45')](_0x38cb9d)[_0xb087('0x27')](handleEntityNotFound(_0x5e7f45,null))[_0xb087('0x27')](respondWithResult(_0x5e7f45,null))['catch'](handleError(_0x5e7f45,null));};exports[_0xb087('0x46')]=function(_0xb15e28,_0x588d96){return db['VoiceMail'][_0xb087('0x46')](_0xb15e28['body'],{})['then'](function(_0x1c9f8f){var _0x341665=_0xb15e28['user'][_0xb087('0x47')]({'plain':!![]});if(!_0x341665)throw new Error(_0xb087('0x48'));if(_0x341665[_0xb087('0x49')]==='user'){var _0x5ba160=_0x1c9f8f[_0xb087('0x47')]({'plain':!![]});var _0x54862a='Voicemails';return db[_0xb087('0x4a')][_0xb087('0x45')]({'where':{'name':_0x54862a,'userProfileId':_0x341665[_0xb087('0x4b')]},'raw':!![]})[_0xb087('0x27')](function(_0x2bf92f){if(_0x2bf92f&&_0x2bf92f[_0xb087('0x4c')]===0x0){return db[_0xb087('0x4d')][_0xb087('0x46')]({'name':_0x5ba160[_0xb087('0x2a')],'resourceId':_0x5ba160['id'],'type':_0x2bf92f[_0xb087('0x2a')],'sectionId':_0x2bf92f['id']},{})[_0xb087('0x27')](function(){return _0x1c9f8f;});}else{return _0x1c9f8f;}})[_0xb087('0x4e')](function(_0x55e653){logger[_0xb087('0x28')](_0xb087('0x4f'),_0x55e653);throw _0x55e653;});}return _0x1c9f8f;})['then'](respondWithResult(_0x588d96,0xc9))[_0xb087('0x4e')](handleError(_0x588d96,null));};exports[_0xb087('0x50')]=function(_0x343830,_0x1c91e8){if(_0x343830[_0xb087('0x51')]['id']){delete _0x343830[_0xb087('0x51')]['id'];}return db[_0xb087('0x2d')][_0xb087('0x45')]({'where':{'id':_0x343830[_0xb087('0x52')]['id']}})[_0xb087('0x27')](handleEntityNotFound(_0x1c91e8,null))[_0xb087('0x27')](saveUpdates(_0x343830['body'],null))[_0xb087('0x27')](respondWithResult(_0x1c91e8,null))['catch'](handleError(_0x1c91e8,null));};exports[_0xb087('0x53')]=function(_0x575cc4,_0xf0b592){return db[_0xb087('0x2d')][_0xb087('0x45')]({'where':{'id':_0x575cc4[_0xb087('0x52')]['id']}})[_0xb087('0x27')](handleEntityNotFound(_0xf0b592,null))[_0xb087('0x27')](removeEntity(_0xf0b592,null))[_0xb087('0x4e')](handleError(_0xf0b592,null));};exports[_0xb087('0x54')]=function(_0x3f3091,_0x323e0a,_0x300e9b){return db[_0xb087('0x2d')][_0xb087('0x55')]({'where':{'id':_0x3f3091[_0xb087('0x52')]['id']}})[_0xb087('0x27')](handleEntityNotFound(_0x323e0a,null))[_0xb087('0x27')](function(_0x217f26){var _0x3185c4;var _0x40ff74={},_0xe3cb2={};_0xe3cb2[_0xb087('0x32')]=_[_0xb087('0x35')](db['VoiceMailMessage'][_0xb087('0x2e')]);_0xe3cb2[_0xb087('0x34')]=_[_0xb087('0x35')](_0x3f3091['query']);_0xe3cb2[_0xb087('0x36')]=_[_0xb087('0x37')](_0xe3cb2['model'],_0xe3cb2[_0xb087('0x34')]);_0x40ff74[_0xb087('0x38')]=_[_0xb087('0x37')](_0xe3cb2['model'],qs[_0xb087('0x39')](_0x3f3091[_0xb087('0x34')][_0xb087('0x39')]));_0x40ff74[_0xb087('0x38')]=_0x40ff74[_0xb087('0x38')][_0xb087('0x3a')]?_0x40ff74[_0xb087('0x38')]:_0xe3cb2[_0xb087('0x32')];if(!_0x3f3091['query'][_0xb087('0x56')](_0xb087('0x3b'))){_0x40ff74[_0xb087('0x20')]=qs['limit'](_0x3f3091[_0xb087('0x34')]['limit']);_0x40ff74['offset']=qs[_0xb087('0x1f')](_0x3f3091[_0xb087('0x34')]['offset']);}_0x40ff74[_0xb087('0x57')]=qs['sort'](_0x3f3091[_0xb087('0x34')][_0xb087('0x3c')]);_0x40ff74['where']=qs['filters'](_[_0xb087('0x3d')](_0x3f3091['query'],_0xe3cb2['filters']));if(_0x3f3091[_0xb087('0x34')]['filter']){_0x40ff74[_0xb087('0x3e')]=_['merge'](_0x40ff74[_0xb087('0x3e')],{'$or':_[_0xb087('0x33')](_0x40ff74[_0xb087('0x38')],function(_0x2a6b2e){var _0x4e1683={};_0x4e1683[_0x2a6b2e]={'$like':'%'+_0x3f3091[_0xb087('0x34')]['filter']+'%'};return _0x4e1683;})});}_0x40ff74[_0xb087('0x3e')]=_['merge'](_0x40ff74[_0xb087('0x3e')],{'mailboxuser':_0x217f26[_0xb087('0x58')]});_0x40ff74=_[_0xb087('0x3f')]({},_0x40ff74,_0x3f3091['options']);return db[_0xb087('0x59')]['findAndCountAll'](_0x40ff74)[_0xb087('0x27')](respondWithFilteredResult(_0x323e0a,_0x40ff74));})[_0xb087('0x4e')](handleError(_0x323e0a,null));}; \ No newline at end of file +var _0x4024=['limit','count','Content-Range','apply','save','update','then','destroy','get','Voicemails','UserProfileResource','error','name','index','map','VoiceMail','rawAttributes','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','intersection','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','order','pick','mailbox','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x5f4c37,_0x46f099){var _0x2f2d4a=function(_0x2d7f79){while(--_0x2d7f79){_0x5f4c37['push'](_0x5f4c37['shift']());}};_0x2f2d4a(++_0x46f099);}(_0x4024,0x89));var _0x4402=function(_0x263487,_0x3fc21c){_0x263487=_0x263487-0x0;var _0x246e76=_0x4024[_0x263487];return _0x246e76;};'use strict';var emlformat=require(_0x4402('0x0'));var rimraf=require(_0x4402('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4402('0x2'));var rp=require(_0x4402('0x3'));var moment=require('moment');var BPromise=require(_0x4402('0x4'));var Mustache=require('mustache');var util=require(_0x4402('0x5'));var path=require(_0x4402('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4402('0x7'));var fs=require('fs');var fs_extra=require(_0x4402('0x8'));var _=require(_0x4402('0x9'));var squel=require('squel');var crypto=require(_0x4402('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4402('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4402('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x4402('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4402('0xe'));var logger=require('../../config/logger')(_0x4402('0xf'));var utils=require(_0x4402('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4402('0x11'));var db=require(_0x4402('0x12'))['db'];function respondWithStatusCode(_0xa819e9,_0x4c9032){_0x4c9032=_0x4c9032||0xcc;return function(_0x7e4475){if(_0x7e4475){return _0xa819e9[_0x4402('0x13')](_0x4c9032);}return _0xa819e9[_0x4402('0x14')](_0x4c9032)[_0x4402('0x15')]();};}function respondWithResult(_0x248ad9,_0x31710c){_0x31710c=_0x31710c||0xc8;return function(_0x18c7a8){if(_0x18c7a8){return _0x248ad9[_0x4402('0x14')](_0x31710c)[_0x4402('0x16')](_0x18c7a8);}};}function respondWithFilteredResult(_0x263a57,_0x375166){return function(_0xc03f65){if(_0xc03f65){var _0x2a2ce8=typeof _0x375166[_0x4402('0x17')]===_0x4402('0x18')&&typeof _0x375166[_0x4402('0x19')]===_0x4402('0x18');var _0x25e88b=_0xc03f65[_0x4402('0x1a')];var _0x231382=_0x2a2ce8?0x0:_0x375166['offset'];var _0x494389=_0x2a2ce8?_0xc03f65[_0x4402('0x1a')]:_0x375166[_0x4402('0x17')]+_0x375166['limit'];var _0x756962;if(_0x494389>=_0x25e88b){_0x494389=_0x25e88b;_0x756962=0xc8;}else{_0x756962=0xce;}_0x263a57[_0x4402('0x14')](_0x756962);return _0x263a57['set'](_0x4402('0x1b'),_0x231382+'-'+_0x494389+'/'+_0x25e88b)['json'](_0xc03f65);}return null;};}function patchUpdates(_0x55cc8c){return function(_0x1b9599){try{jsonpatch[_0x4402('0x1c')](_0x1b9599,_0x55cc8c,!![]);}catch(_0x28f44b){return BPromise['reject'](_0x28f44b);}return _0x1b9599[_0x4402('0x1d')]();};}function saveUpdates(_0x57a25e,_0x47ab54){return function(_0x6f1f72){if(_0x6f1f72){return _0x6f1f72[_0x4402('0x1e')](_0x57a25e)[_0x4402('0x1f')](function(_0xc583b){return _0xc583b;});}return null;};}function removeEntity(_0x258d10,_0x2e6fee){return function(_0x289a3e){if(_0x289a3e){return _0x289a3e[_0x4402('0x20')]()[_0x4402('0x1f')](function(){var _0x4d6846=_0x289a3e[_0x4402('0x21')]({'plain':!![]});var _0x4e1c04=_0x4402('0x22');return db[_0x4402('0x23')][_0x4402('0x20')]({'where':{'type':_0x4e1c04,'resourceId':_0x4d6846['id']}})[_0x4402('0x1f')](function(){return _0x289a3e;});})['then'](function(){_0x258d10[_0x4402('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59d52f,_0x1be54d){return function(_0x395e49){if(!_0x395e49){_0x59d52f[_0x4402('0x13')](0x194);}return _0x395e49;};}function handleError(_0xabf61b,_0x3eb796){_0x3eb796=_0x3eb796||0x1f4;return function(_0x514e41){logger[_0x4402('0x24')](_0x514e41['stack']);if(_0x514e41[_0x4402('0x25')]){delete _0x514e41[_0x4402('0x25')];}_0xabf61b[_0x4402('0x14')](_0x3eb796)['send'](_0x514e41);};}exports[_0x4402('0x26')]=function(_0x6c87f6,_0x316239){var _0x3f4bcb={},_0x2526d1={},_0x605702={'count':0x0,'rows':[]};var _0x1189b8=_[_0x4402('0x27')](db[_0x4402('0x28')][_0x4402('0x29')],function(_0xcea26b){return{'name':_0xcea26b['fieldName'],'type':_0xcea26b[_0x4402('0x2a')]['key']};});_0x2526d1[_0x4402('0x2b')]=_['map'](_0x1189b8,_0x4402('0x25'));_0x2526d1[_0x4402('0x2c')]=_[_0x4402('0x2d')](_0x6c87f6[_0x4402('0x2c')]);_0x2526d1[_0x4402('0x2e')]=_['intersection'](_0x2526d1[_0x4402('0x2b')],_0x2526d1[_0x4402('0x2c')]);_0x3f4bcb[_0x4402('0x2f')]=_['intersection'](_0x2526d1[_0x4402('0x2b')],qs[_0x4402('0x30')](_0x6c87f6['query'][_0x4402('0x30')]));_0x3f4bcb[_0x4402('0x2f')]=_0x3f4bcb[_0x4402('0x2f')][_0x4402('0x31')]?_0x3f4bcb[_0x4402('0x2f')]:_0x2526d1[_0x4402('0x2b')];if(!_0x6c87f6[_0x4402('0x2c')][_0x4402('0x32')](_0x4402('0x33'))){_0x3f4bcb['limit']=qs[_0x4402('0x19')](_0x6c87f6[_0x4402('0x2c')][_0x4402('0x19')]);_0x3f4bcb['offset']=qs[_0x4402('0x17')](_0x6c87f6[_0x4402('0x2c')]['offset']);}_0x3f4bcb['order']=qs[_0x4402('0x34')](_0x6c87f6[_0x4402('0x2c')][_0x4402('0x34')]);_0x3f4bcb[_0x4402('0x35')]=qs['filters'](_['pick'](_0x6c87f6['query'],_0x2526d1[_0x4402('0x2e')]),_0x1189b8);if(_0x6c87f6[_0x4402('0x2c')][_0x4402('0x36')]){_0x3f4bcb[_0x4402('0x35')]=_['merge'](_0x3f4bcb[_0x4402('0x35')],{'$or':_[_0x4402('0x27')](_0x1189b8,function(_0x35f877){if(_0x35f877['type']!==_0x4402('0x37')){var _0x5aca7b={};_0x5aca7b[_0x35f877[_0x4402('0x25')]]={'$like':'%'+_0x6c87f6[_0x4402('0x2c')]['filter']+'%'};return _0x5aca7b;}})});}_0x3f4bcb=_[_0x4402('0x38')]({},_0x3f4bcb,_0x6c87f6['options']);var _0x423628={'where':_0x3f4bcb[_0x4402('0x35')]};return db['VoiceMail'][_0x4402('0x1a')](_0x423628)[_0x4402('0x1f')](function(_0x250f09){_0x605702[_0x4402('0x1a')]=_0x250f09;if(_0x6c87f6['query']['includeAll']){_0x3f4bcb[_0x4402('0x39')]=[{'all':!![]}];}return db['VoiceMail'][_0x4402('0x3a')](_0x3f4bcb);})[_0x4402('0x1f')](function(_0xb9cf85){_0x605702[_0x4402('0x3b')]=_0xb9cf85;return _0x605702;})[_0x4402('0x1f')](respondWithFilteredResult(_0x316239,_0x3f4bcb))[_0x4402('0x3c')](handleError(_0x316239,null));};exports[_0x4402('0x3d')]=function(_0x390169,_0x1f9b3e){var _0x42812b={'raw':!![],'where':{'id':_0x390169[_0x4402('0x3e')]['id']}},_0x486e43={};_0x486e43[_0x4402('0x2b')]=_['keys'](db[_0x4402('0x28')][_0x4402('0x29')]);_0x486e43['query']=_[_0x4402('0x2d')](_0x390169[_0x4402('0x2c')]);_0x486e43[_0x4402('0x2e')]=_[_0x4402('0x3f')](_0x486e43[_0x4402('0x2b')],_0x486e43['query']);_0x42812b[_0x4402('0x2f')]=_[_0x4402('0x3f')](_0x486e43[_0x4402('0x2b')],qs[_0x4402('0x30')](_0x390169[_0x4402('0x2c')][_0x4402('0x30')]));_0x42812b[_0x4402('0x2f')]=_0x42812b[_0x4402('0x2f')][_0x4402('0x31')]?_0x42812b[_0x4402('0x2f')]:_0x486e43[_0x4402('0x2b')];if(_0x390169['query'][_0x4402('0x40')]){_0x42812b['include']=[{'all':!![]}];}_0x42812b=_[_0x4402('0x38')]({},_0x42812b,_0x390169[_0x4402('0x41')]);return db['VoiceMail'][_0x4402('0x42')](_0x42812b)[_0x4402('0x1f')](handleEntityNotFound(_0x1f9b3e,null))[_0x4402('0x1f')](respondWithResult(_0x1f9b3e,null))[_0x4402('0x3c')](handleError(_0x1f9b3e,null));};exports[_0x4402('0x43')]=function(_0x2503eb,_0x5b094b){return db[_0x4402('0x28')][_0x4402('0x43')](_0x2503eb[_0x4402('0x44')],{})[_0x4402('0x1f')](function(_0x2b2ed3){var _0x24d51c=_0x2503eb[_0x4402('0x45')][_0x4402('0x21')]({'plain':!![]});if(!_0x24d51c)throw new Error(_0x4402('0x46'));if(_0x24d51c['role']==='user'){var _0x5ab12b=_0x2b2ed3['get']({'plain':!![]});var _0x257010=_0x4402('0x22');return db[_0x4402('0x47')][_0x4402('0x42')]({'where':{'name':_0x257010,'userProfileId':_0x24d51c['userProfileId']},'raw':!![]})[_0x4402('0x1f')](function(_0x12d6de){if(_0x12d6de&&_0x12d6de[_0x4402('0x48')]===0x0){return db[_0x4402('0x23')][_0x4402('0x43')]({'name':_0x5ab12b[_0x4402('0x25')],'resourceId':_0x5ab12b['id'],'type':_0x12d6de[_0x4402('0x25')],'sectionId':_0x12d6de['id']},{})['then'](function(){return _0x2b2ed3;});}else{return _0x2b2ed3;}})[_0x4402('0x3c')](function(_0x2a8085){logger[_0x4402('0x24')](_0x4402('0x49'),_0x2a8085);throw _0x2a8085;});}return _0x2b2ed3;})[_0x4402('0x1f')](respondWithResult(_0x5b094b,0xc9))[_0x4402('0x3c')](handleError(_0x5b094b,null));};exports['update']=function(_0xe8a8e9,_0x642ab4){if(_0xe8a8e9[_0x4402('0x44')]['id']){delete _0xe8a8e9[_0x4402('0x44')]['id'];}return db[_0x4402('0x28')][_0x4402('0x42')]({'where':{'id':_0xe8a8e9[_0x4402('0x3e')]['id']}})['then'](handleEntityNotFound(_0x642ab4,null))['then'](saveUpdates(_0xe8a8e9[_0x4402('0x44')],null))[_0x4402('0x1f')](respondWithResult(_0x642ab4,null))[_0x4402('0x3c')](handleError(_0x642ab4,null));};exports['destroy']=function(_0x5a076a,_0x258926){return db[_0x4402('0x28')][_0x4402('0x42')]({'where':{'id':_0x5a076a[_0x4402('0x3e')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x258926,null))[_0x4402('0x1f')](removeEntity(_0x258926,null))[_0x4402('0x3c')](handleError(_0x258926,null));};exports[_0x4402('0x4a')]=function(_0x394ac9,_0x3f2599,_0x353679){return db[_0x4402('0x28')][_0x4402('0x4b')]({'where':{'id':_0x394ac9['params']['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x3f2599,null))['then'](function(_0xe4530a){var _0x55922e;var _0x3fb9f0={},_0x1e5891={};_0x1e5891[_0x4402('0x2b')]=_[_0x4402('0x2d')](db[_0x4402('0x4c')][_0x4402('0x29')]);_0x1e5891['query']=_[_0x4402('0x2d')](_0x394ac9[_0x4402('0x2c')]);_0x1e5891[_0x4402('0x2e')]=_[_0x4402('0x3f')](_0x1e5891[_0x4402('0x2b')],_0x1e5891['query']);_0x3fb9f0[_0x4402('0x2f')]=_[_0x4402('0x3f')](_0x1e5891[_0x4402('0x2b')],qs[_0x4402('0x30')](_0x394ac9[_0x4402('0x2c')][_0x4402('0x30')]));_0x3fb9f0[_0x4402('0x2f')]=_0x3fb9f0[_0x4402('0x2f')]['length']?_0x3fb9f0[_0x4402('0x2f')]:_0x1e5891[_0x4402('0x2b')];if(!_0x394ac9['query'][_0x4402('0x32')](_0x4402('0x33'))){_0x3fb9f0['limit']=qs['limit'](_0x394ac9[_0x4402('0x2c')][_0x4402('0x19')]);_0x3fb9f0[_0x4402('0x17')]=qs['offset'](_0x394ac9[_0x4402('0x2c')][_0x4402('0x17')]);}_0x3fb9f0[_0x4402('0x4d')]=qs['sort'](_0x394ac9[_0x4402('0x2c')][_0x4402('0x34')]);_0x3fb9f0[_0x4402('0x35')]=qs['filters'](_[_0x4402('0x4e')](_0x394ac9[_0x4402('0x2c')],_0x1e5891['filters']));if(_0x394ac9['query'][_0x4402('0x36')]){_0x3fb9f0['where']=_[_0x4402('0x38')](_0x3fb9f0[_0x4402('0x35')],{'$or':_['map'](_0x3fb9f0['attributes'],function(_0x432c2e){var _0x42cdd6={};_0x42cdd6[_0x432c2e]={'$like':'%'+_0x394ac9[_0x4402('0x2c')][_0x4402('0x36')]+'%'};return _0x42cdd6;})});}_0x3fb9f0['where']=_[_0x4402('0x38')](_0x3fb9f0[_0x4402('0x35')],{'mailboxuser':_0xe4530a[_0x4402('0x4f')]});_0x3fb9f0=_[_0x4402('0x38')]({},_0x3fb9f0,_0x394ac9[_0x4402('0x41')]);return db[_0x4402('0x4c')][_0x4402('0x50')](_0x3fb9f0)['then'](respondWithFilteredResult(_0x3f2599,_0x3fb9f0));})[_0x4402('0x3c')](handleError(_0x3f2599,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 30176fb..e32f09a 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 _0x00a0=['api','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox','context','lodash','util','../../config/logger'];(function(_0x4237d8,_0x13cc54){var _0x1e8caf=function(_0x1b18c5){while(--_0x1b18c5){_0x4237d8['push'](_0x4237d8['shift']());}};_0x1e8caf(++_0x13cc54);}(_0x00a0,0xcf));var _0x000a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x00a0[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x000a('0x0'));var util=require(_0x000a('0x1'));var logger=require(_0x000a('0x2'))(_0x000a('0x3'));var moment=require('moment');var BPromise=require(_0x000a('0x4'));var rp=require(_0x000a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x000a('0x6'));var config=require(_0x000a('0x7'));var attributes=require(_0x000a('0x8'));module[_0x000a('0x9')]=function(_0x375ab9,_0x2070ca){return _0x375ab9[_0x000a('0xa')]('VoiceMail',attributes,{'tableName':_0x000a('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x000a('0xc'),_0x000a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0343=['voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceMail.attributes','exports','define','VoiceMail'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x0343,0x1f4));var _0x3034=function(_0x3dd991,_0x4bef12){_0x3dd991=_0x3dd991-0x0;var _0x251609=_0x0343[_0x3dd991];return _0x251609;};'use strict';var _=require(_0x3034('0x0'));var util=require(_0x3034('0x1'));var logger=require(_0x3034('0x2'))(_0x3034('0x3'));var moment=require(_0x3034('0x4'));var BPromise=require(_0x3034('0x5'));var rp=require(_0x3034('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3034('0x7'));var config=require('../../config/environment');var attributes=require(_0x3034('0x8'));module[_0x3034('0x9')]=function(_0x4f2517,_0x617be1){return _0x4f2517[_0x3034('0xa')](_0x3034('0xb'),attributes,{'tableName':_0x3034('0xc'),'paranoid':![],'indexes':[{'name':_0x3034('0xd'),'fields':[_0x3034('0xe'),_0x3034('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index d25e524..dcb1401 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 _0xb449=['stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s'];(function(_0x55caea,_0x3bbd8c){var _0x4004e5=function(_0x55499f){while(--_0x55499f){_0x55caea['push'](_0x55caea['shift']());}};_0x4004e5(++_0x3bbd8c);}(_0xb449,0x131));var _0x9b44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb449[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9b44('0x0'));var BPromise=require(_0x9b44('0x1'));var rs=require(_0x9b44('0x2'));var fs=require('fs');var Redis=require(_0x9b44('0x3'));var db=require(_0x9b44('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b44('0x5'))(_0x9b44('0x6'));var config=require(_0x9b44('0x7'));var jayson=require(_0x9b44('0x8'));var client=jayson[_0x9b44('0x9')][_0x9b44('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x522c7b,_0x1ec5ef,_0x4c8566){return new BPromise(function(_0x20edeb,_0x25b2f3){return client[_0x9b44('0xb')](_0x522c7b,_0x4c8566)['then'](function(_0x489a60){logger[_0x9b44('0xc')](_0x9b44('0xd'),_0x1ec5ef,_0x9b44('0xe'));logger[_0x9b44('0xf')](_0x9b44('0x10'),_0x1ec5ef,_0x9b44('0xe'),JSON[_0x9b44('0x11')](_0x489a60));if(_0x489a60['error']){if(_0x489a60[_0x9b44('0x12')][_0x9b44('0x13')]===0x1f4){logger[_0x9b44('0x12')](_0x9b44('0xd'),_0x1ec5ef,_0x489a60['error'][_0x9b44('0x14')]);return _0x25b2f3(_0x489a60[_0x9b44('0x12')][_0x9b44('0x14')]);}logger['error'](_0x9b44('0xd'),_0x1ec5ef,_0x489a60[_0x9b44('0x12')]['message']);return _0x20edeb(_0x489a60['error'][_0x9b44('0x14')]);}else{logger['info'](_0x9b44('0xd'),_0x1ec5ef,_0x9b44('0xe'));_0x20edeb(_0x489a60[_0x9b44('0x15')][_0x9b44('0x14')]);}})[_0x9b44('0x16')](function(_0x3777a8){logger[_0x9b44('0x12')](_0x9b44('0xd'),_0x1ec5ef,_0x3777a8);_0x25b2f3(_0x3777a8);});});} \ No newline at end of file +var _0x4da8=['result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMail,\x20%s,\x20%s','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x305a6e,_0x1f4a40){var _0xd23128=function(_0x230ce6){while(--_0x230ce6){_0x305a6e['push'](_0x305a6e['shift']());}};_0xd23128(++_0x1f4a40);}(_0x4da8,0xb1));var _0x84da=function(_0xcda9ea,_0x469a95){_0xcda9ea=_0xcda9ea-0x0;var _0x4a10db=_0x4da8[_0xcda9ea];return _0x4a10db;};'use strict';var _=require(_0x84da('0x0'));var util=require(_0x84da('0x1'));var moment=require(_0x84da('0x2'));var BPromise=require(_0x84da('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x84da('0x4'))['db'];var utils=require(_0x84da('0x5'));var logger=require('../../config/logger')(_0x84da('0x6'));var config=require(_0x84da('0x7'));var jayson=require(_0x84da('0x8'));var client=jayson[_0x84da('0x9')][_0x84da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x224acf,_0x304acf,_0x568f61){return new BPromise(function(_0x5ae13e,_0x3102b5){return client[_0x84da('0xb')](_0x224acf,_0x568f61)[_0x84da('0xc')](function(_0x41472c){logger['info'](_0x84da('0xd'),_0x304acf,'request\x20sent');logger['debug'](_0x84da('0xe'),_0x304acf,_0x84da('0xf'),JSON[_0x84da('0x10')](_0x41472c));if(_0x41472c[_0x84da('0x11')]){if(_0x41472c[_0x84da('0x11')][_0x84da('0x12')]===0x1f4){logger[_0x84da('0x11')](_0x84da('0xd'),_0x304acf,_0x41472c[_0x84da('0x11')][_0x84da('0x13')]);return _0x3102b5(_0x41472c[_0x84da('0x11')]['message']);}logger[_0x84da('0x11')](_0x84da('0xd'),_0x304acf,_0x41472c[_0x84da('0x11')][_0x84da('0x13')]);return _0x5ae13e(_0x41472c[_0x84da('0x11')]['message']);}else{logger[_0x84da('0x14')](_0x84da('0xd'),_0x304acf,_0x84da('0xf'));_0x5ae13e(_0x41472c[_0x84da('0x15')][_0x84da('0x13')]);}})['catch'](function(_0x2e75c4){logger[_0x84da('0x11')](_0x84da('0xd'),_0x304acf,_0x2e75c4);_0x3102b5(_0x2e75c4);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 9798155..780f241 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 _0x916d=['update','delete','util','path','express','Router','fs-extra','./voiceMailMessage.controller','index','get','/:id','isAuthenticated','/:id/download','download','post','create','put'];(function(_0x2ff17e,_0xfaeb26){var _0x438c21=function(_0x35f6cb){while(--_0x35f6cb){_0x2ff17e['push'](_0x2ff17e['shift']());}};_0x438c21(++_0xfaeb26);}(_0x916d,0x123));var _0xd916=function(_0x1539b8,_0x4cf43a){_0x1539b8=_0x1539b8-0x0;var _0x54cf58=_0x916d[_0x1539b8];return _0x54cf58;};'use strict';var multer=require('multer');var util=require(_0xd916('0x0'));var path=require(_0xd916('0x1'));var timeout=require('connect-timeout');var express=require(_0xd916('0x2'));var router=express[_0xd916('0x3')]();var fs_extra=require(_0xd916('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd916('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xd916('0x6')]);router[_0xd916('0x7')](_0xd916('0x8'),auth[_0xd916('0x9')](),controller['show']);router[_0xd916('0x7')](_0xd916('0xa'),auth[_0xd916('0x9')](),controller[_0xd916('0xb')]);router[_0xd916('0xc')]('/',auth[_0xd916('0x9')](),controller[_0xd916('0xd')]);router[_0xd916('0xe')](_0xd916('0x8'),auth[_0xd916('0x9')](),controller[_0xd916('0xf')]);router[_0xd916('0x10')](_0xd916('0x8'),auth[_0xd916('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8738=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','isAuthenticated','show','/:id/download','download','post','create','put','/:id'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x8738,0x153));var _0x8873=function(_0x417f69,_0x260a0b){_0x417f69=_0x417f69-0x0;var _0x270654=_0x8738[_0x417f69];return _0x270654;};'use strict';var multer=require(_0x8873('0x0'));var util=require(_0x8873('0x1'));var path=require(_0x8873('0x2'));var timeout=require(_0x8873('0x3'));var express=require(_0x8873('0x4'));var router=express[_0x8873('0x5')]();var fs_extra=require(_0x8873('0x6'));var auth=require(_0x8873('0x7'));var interaction=require(_0x8873('0x8'));var config=require(_0x8873('0x9'));var controller=require(_0x8873('0xa'));router[_0x8873('0xb')]('/',auth['isAuthenticated'](),controller[_0x8873('0xc')]);router[_0x8873('0xb')]('/:id',auth[_0x8873('0xd')](),controller[_0x8873('0xe')]);router[_0x8873('0xb')](_0x8873('0xf'),auth['isAuthenticated'](),controller[_0x8873('0x10')]);router[_0x8873('0x11')]('/',auth[_0x8873('0xd')](),controller[_0x8873('0x12')]);router[_0x8873('0x13')](_0x8873('0x14'),auth[_0x8873('0xd')](),controller['update']);router[_0x8873('0x15')](_0x8873('0x14'),auth['isAuthenticated'](),controller[_0x8873('0x16')]);module[_0x8873('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index fca40ac..9ef586a 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 _0x8ae4=['sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x56a0f3,_0xc4c072){var _0x4d261d=function(_0x1110fa){while(--_0x1110fa){_0x56a0f3['push'](_0x56a0f3['shift']());}};_0x4d261d(++_0xc4c072);}(_0x8ae4,0xa2));var _0x48ae=function(_0x2b5568,_0x19dd7a){_0x2b5568=_0x2b5568-0x0;var _0x26f03c=_0x8ae4[_0x2b5568];return _0x26f03c;};'use strict';var Sequelize=require(_0x48ae('0x0'));module[_0x48ae('0x1')]={'name':{'type':Sequelize[_0x48ae('0x2')],'get':function(_0x164179){return this[_0x48ae('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x48ae('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x48ae('0x5')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x48ae('0x5')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x48ae('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x48ae('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x48ae('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x48ae('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x48ae('0x7')](_0x48ae('0x8'))}}; \ No newline at end of file +var _0x74b0=['long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','INTEGER','STRING','BLOB'];(function(_0x38f509,_0x1886ab){var _0x456187=function(_0x8aae95){while(--_0x8aae95){_0x38f509['push'](_0x38f509['shift']());}};_0x456187(++_0x1886ab);}(_0x74b0,0xab));var _0x074b=function(_0x310448,_0x59f6bd){_0x310448=_0x310448-0x0;var _0xc0124b=_0x74b0[_0x310448];return _0xc0124b;};'use strict';var Sequelize=require(_0x074b('0x0'));module['exports']={'name':{'type':Sequelize[_0x074b('0x1')],'get':function(_0x12b266){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x074b('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x074b('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x074b('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x074b('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x074b('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x074b('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x074b('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x074b('0x4')](_0x074b('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x074b('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x074b('0x3')],'defaultValue':''},'stamp':{'type':_0x074b('0x6'),'defaultValue':Sequelize['literal'](_0x074b('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index a392c9f..7cddb24 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 _0x87fb=['find','catch','destroy','download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','index','fieldName','type','differenceBy','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','VoiceMailMessage','include','findAll','rows','show','params','rawAttributes','includeAll','create','body'];(function(_0x3531f3,_0xc59aca){var _0x51170e=function(_0x2a47f){while(--_0x2a47f){_0x3531f3['push'](_0x3531f3['shift']());}};_0x51170e(++_0xc59aca);}(_0x87fb,0x165));var _0xb87f=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x87fb[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xb87f('0x0'));var rimraf=require(_0xb87f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb87f('0x2'));var moment=require(_0xb87f('0x3'));var BPromise=require(_0xb87f('0x4'));var Mustache=require(_0xb87f('0x5'));var util=require(_0xb87f('0x6'));var path=require(_0xb87f('0x7'));var sox=require(_0xb87f('0x8'));var csv=require(_0xb87f('0x9'));var ejs=require(_0xb87f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb87f('0xb'));var squel=require(_0xb87f('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb87f('0x9'));var querystring=require(_0xb87f('0xd'));var Papa=require(_0xb87f('0xe'));var Redis=require(_0xb87f('0xf'));var authService=require(_0xb87f('0x10'));var qs=require(_0xb87f('0x11'));var as=require(_0xb87f('0x12'));var hardwareService=require(_0xb87f('0x13'));var logger=require('../../config/logger')(_0xb87f('0x14'));var utils=require(_0xb87f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb87f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47a0a1,_0x210317){_0x210317=_0x210317||0xcc;return function(_0x9ad625){if(_0x9ad625){return _0x47a0a1[_0xb87f('0x17')](_0x210317);}return _0x47a0a1[_0xb87f('0x18')](_0x210317)[_0xb87f('0x19')]();};}function respondWithResult(_0x1a2a53,_0x3fe7a9){_0x3fe7a9=_0x3fe7a9||0xc8;return function(_0x5e70a5){if(_0x5e70a5){return _0x1a2a53['status'](_0x3fe7a9)[_0xb87f('0x1a')](_0x5e70a5);}};}function respondWithFilteredResult(_0xf815f5,_0x35d9b1){return function(_0x1fdebd){if(_0x1fdebd){var _0xd7b725=typeof _0x35d9b1['offset']===_0xb87f('0x1b')&&typeof _0x35d9b1['limit']==='undefined';var _0x58bd06=_0x1fdebd[_0xb87f('0x1c')];var _0x3041bf=_0xd7b725?0x0:_0x35d9b1['offset'];var _0x4df1dd=_0xd7b725?_0x1fdebd[_0xb87f('0x1c')]:_0x35d9b1[_0xb87f('0x1d')]+_0x35d9b1[_0xb87f('0x1e')];var _0x1f45b7;if(_0x4df1dd>=_0x58bd06){_0x4df1dd=_0x58bd06;_0x1f45b7=0xc8;}else{_0x1f45b7=0xce;}_0xf815f5[_0xb87f('0x18')](_0x1f45b7);return _0xf815f5[_0xb87f('0x1f')](_0xb87f('0x20'),_0x3041bf+'-'+_0x4df1dd+'/'+_0x58bd06)[_0xb87f('0x1a')](_0x1fdebd);}return null;};}function patchUpdates(_0x53211b){return function(_0x17ee66){try{jsonpatch[_0xb87f('0x21')](_0x17ee66,_0x53211b,!![]);}catch(_0x2f13c1){return BPromise[_0xb87f('0x22')](_0x2f13c1);}return _0x17ee66[_0xb87f('0x23')]();};}function saveUpdates(_0x26cb48,_0x4baebd){return function(_0x534822){if(_0x534822){return _0x534822[_0xb87f('0x24')](_0x26cb48)[_0xb87f('0x25')](function(_0x4f230b){return _0x4f230b;});}return null;};}function removeEntity(_0x163862,_0x4487d8){return function(_0x51d21a){if(_0x51d21a){return _0x51d21a['destroy']()['then'](function(){_0x163862[_0xb87f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29f4e3,_0x335173){return function(_0x369a06){if(!_0x369a06){_0x29f4e3[_0xb87f('0x17')](0x194);}return _0x369a06;};}function handleError(_0x4b24c8,_0x52c0aa){_0x52c0aa=_0x52c0aa||0x1f4;return function(_0x4292eb){logger[_0xb87f('0x26')](_0x4292eb['stack']);if(_0x4292eb[_0xb87f('0x27')]){delete _0x4292eb[_0xb87f('0x27')];}_0x4b24c8[_0xb87f('0x18')](_0x52c0aa)[_0xb87f('0x28')](_0x4292eb);};}exports[_0xb87f('0x29')]=function(_0x2b8f3a,_0x208bca){var _0x14c6fd={},_0x6c1d14={},_0x5f17be={'count':0x0,'rows':[]};var _0x41886f=_['map'](db['VoiceMailMessage']['rawAttributes'],function(_0x233511){return{'name':_0x233511[_0xb87f('0x2a')],'type':_0x233511[_0xb87f('0x2b')]['key']};});_0x6c1d14['model']=_[_0xb87f('0x2c')](_[_0xb87f('0x2d')](_0x41886f,_0xb87f('0x27')),[_0xb87f('0x27')]);_0x6c1d14[_0xb87f('0x2e')]=_[_0xb87f('0x2f')](_0x2b8f3a[_0xb87f('0x2e')]);_0x6c1d14['filters']=_[_0xb87f('0x30')](_0x6c1d14[_0xb87f('0x31')],_0x6c1d14[_0xb87f('0x2e')]);_0x14c6fd[_0xb87f('0x32')]=_['intersection'](_0x6c1d14[_0xb87f('0x31')],qs['fields'](_0x2b8f3a[_0xb87f('0x2e')][_0xb87f('0x33')]));_0x14c6fd[_0xb87f('0x32')]=_0x14c6fd[_0xb87f('0x32')][_0xb87f('0x34')]?_0x14c6fd['attributes']:_0x6c1d14['model'];if(!_0x2b8f3a[_0xb87f('0x2e')][_0xb87f('0x35')](_0xb87f('0x36'))){_0x14c6fd[_0xb87f('0x1e')]=qs[_0xb87f('0x1e')](_0x2b8f3a['query']['limit']);_0x14c6fd['offset']=qs[_0xb87f('0x1d')](_0x2b8f3a[_0xb87f('0x2e')]['offset']);}_0x14c6fd[_0xb87f('0x37')]=qs[_0xb87f('0x38')](_0x2b8f3a[_0xb87f('0x2e')][_0xb87f('0x38')]);_0x14c6fd[_0xb87f('0x39')]=qs[_0xb87f('0x3a')](_['pick'](_0x2b8f3a[_0xb87f('0x2e')],_0x6c1d14[_0xb87f('0x3a')]),_0x41886f);if(_0x2b8f3a[_0xb87f('0x2e')][_0xb87f('0x3b')]){_0x14c6fd[_0xb87f('0x39')]=_[_0xb87f('0x3c')](_0x14c6fd[_0xb87f('0x39')],{'$or':_[_0xb87f('0x2d')](_0x41886f,function(_0x5092be){if(_0x5092be[_0xb87f('0x2b')]!==_0xb87f('0x3d')){var _0x6b05c5={};_0x6b05c5[_0x5092be[_0xb87f('0x27')]]={'$like':'%'+_0x2b8f3a[_0xb87f('0x2e')][_0xb87f('0x3b')]+'%'};return _0x6b05c5;}})});}_0x14c6fd=_['merge']({},_0x14c6fd,_0x2b8f3a[_0xb87f('0x3e')]);var _0x437dbc={'where':_0x14c6fd[_0xb87f('0x39')]};return db[_0xb87f('0x3f')]['count'](_0x437dbc)[_0xb87f('0x25')](function(_0x1a5e8d){_0x5f17be[_0xb87f('0x1c')]=_0x1a5e8d;if(_0x2b8f3a['query']['includeAll']){_0x14c6fd[_0xb87f('0x40')]=[{'all':!![]}];}return db[_0xb87f('0x3f')][_0xb87f('0x41')](_0x14c6fd);})[_0xb87f('0x25')](function(_0x1cf809){_0x5f17be[_0xb87f('0x42')]=_0x1cf809;return _0x5f17be;})['then'](respondWithFilteredResult(_0x208bca,_0x14c6fd))['catch'](handleError(_0x208bca,null));};exports[_0xb87f('0x43')]=function(_0x40a676,_0x53e6fd){var _0x574c3e={'raw':!![],'where':{'id':_0x40a676[_0xb87f('0x44')]['id']}},_0x1ae6d1={};_0x1ae6d1[_0xb87f('0x31')]=_[_0xb87f('0x2f')](db[_0xb87f('0x3f')][_0xb87f('0x45')]);_0x1ae6d1[_0xb87f('0x2e')]=_[_0xb87f('0x2f')](_0x40a676[_0xb87f('0x2e')]);_0x1ae6d1['filters']=_[_0xb87f('0x30')](_0x1ae6d1[_0xb87f('0x31')],_0x1ae6d1[_0xb87f('0x2e')]);_0x574c3e[_0xb87f('0x32')]=_[_0xb87f('0x30')](_0x1ae6d1[_0xb87f('0x31')],qs[_0xb87f('0x33')](_0x40a676[_0xb87f('0x2e')]['fields']));_0x574c3e[_0xb87f('0x32')]=_0x574c3e[_0xb87f('0x32')][_0xb87f('0x34')]?_0x574c3e[_0xb87f('0x32')]:_0x1ae6d1['model'];if(_0x40a676[_0xb87f('0x2e')][_0xb87f('0x46')]){_0x574c3e['include']=[{'all':!![]}];}_0x574c3e=_[_0xb87f('0x3c')]({},_0x574c3e,_0x40a676[_0xb87f('0x3e')]);return db[_0xb87f('0x3f')]['find'](_0x574c3e)[_0xb87f('0x25')](handleEntityNotFound(_0x53e6fd,null))['then'](respondWithResult(_0x53e6fd,null))['catch'](handleError(_0x53e6fd,null));};exports[_0xb87f('0x47')]=function(_0x176e3f,_0x377f63){return db[_0xb87f('0x3f')]['create'](_0x176e3f['body'],{})[_0xb87f('0x25')](respondWithResult(_0x377f63,0xc9))['catch'](handleError(_0x377f63,null));};exports[_0xb87f('0x24')]=function(_0x4984e0,_0x4e3ef3){if(_0x4984e0['body']['id']){delete _0x4984e0[_0xb87f('0x48')]['id'];}return db[_0xb87f('0x3f')][_0xb87f('0x49')]({'where':{'id':_0x4984e0[_0xb87f('0x44')]['id']}})[_0xb87f('0x25')](handleEntityNotFound(_0x4e3ef3,null))[_0xb87f('0x25')](saveUpdates(_0x4984e0[_0xb87f('0x48')],null))[_0xb87f('0x25')](respondWithResult(_0x4e3ef3,null))[_0xb87f('0x4a')](handleError(_0x4e3ef3,null));};exports[_0xb87f('0x4b')]=function(_0x4ca5ee,_0x2dbd23){return db[_0xb87f('0x3f')][_0xb87f('0x49')]({'where':{'id':_0x4ca5ee[_0xb87f('0x44')]['id']}})[_0xb87f('0x25')](handleEntityNotFound(_0x2dbd23,null))[_0xb87f('0x25')](removeEntity(_0x2dbd23,null))[_0xb87f('0x4a')](handleError(_0x2dbd23,null));};exports[_0xb87f('0x4c')]=function(_0xda36be,_0x128597,_0x47ae86){return db[_0xb87f('0x3f')][_0xb87f('0x49')]({'where':{'id':_0xda36be[_0xb87f('0x44')]['id']},'attributes':['id',_0xb87f('0x4d'),_0xb87f('0x4e')]})[_0xb87f('0x25')](handleEntityNotFound(_0x128597,null))[_0xb87f('0x25')](function(_0x46dcee){if(_0x46dcee){if(!_0x46dcee['recording']){throw new db[(_0xb87f('0x4f'))][(_0xb87f('0x50'))]('VoiceMailMessage\x20not\x20found');}var _0x40a888={'Content-Type':_0xb87f('0x51'),'Content-Disposition':_0xb87f('0x52')};if(_0x46dcee[_0xb87f('0x4e')]){_0x40a888[_0xb87f('0x53')]=_0xb87f('0x54')+_0x46dcee['msg_id']+_0xb87f('0x55');}_0x128597[_0xb87f('0x1f')](_0x40a888);return _0x128597[_0xb87f('0x28')](new Buffer(_0x46dcee[_0xb87f('0x4d')]));}})[_0xb87f('0x4a')](handleError(_0x128597,null));}; \ No newline at end of file +var _0x424f=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','set','apply','reject','then','destroy','error','stack','name','send','map','VoiceMailMessage','rawAttributes','type','key','differenceBy','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','find','download','recording','msg_id','Sequelize','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv'];(function(_0x2d7c1d,_0x159c26){var _0x15c9cb=function(_0x3c0a92){while(--_0x3c0a92){_0x2d7c1d['push'](_0x2d7c1d['shift']());}};_0x15c9cb(++_0x159c26);}(_0x424f,0xf2));var _0xf424=function(_0x1ea8c9,_0x4d9d96){_0x1ea8c9=_0x1ea8c9-0x0;var _0x3eaa4c=_0x424f[_0x1ea8c9];return _0x3eaa4c;};'use strict';var emlformat=require(_0xf424('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf424('0x1'));var jsonpatch=require(_0xf424('0x2'));var rp=require('request-promise');var moment=require(_0xf424('0x3'));var BPromise=require(_0xf424('0x4'));var Mustache=require(_0xf424('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf424('0x6'));var ejs=require(_0xf424('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf424('0x8'));var squel=require(_0xf424('0x9'));var crypto=require(_0xf424('0xa'));var jsforce=require(_0xf424('0xb'));var deskjs=require(_0xf424('0xc'));var toCsv=require(_0xf424('0x6'));var querystring=require(_0xf424('0xd'));var Papa=require(_0xf424('0xe'));var Redis=require(_0xf424('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf424('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf424('0x11'));var logger=require(_0xf424('0x12'))(_0xf424('0x13'));var utils=require(_0xf424('0x14'));var config=require(_0xf424('0x15'));var licenseUtil=require(_0xf424('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22a087,_0x51ff50){_0x51ff50=_0x51ff50||0xcc;return function(_0x47df9d){if(_0x47df9d){return _0x22a087['sendStatus'](_0x51ff50);}return _0x22a087[_0xf424('0x17')](_0x51ff50)[_0xf424('0x18')]();};}function respondWithResult(_0x257f36,_0x10c29f){_0x10c29f=_0x10c29f||0xc8;return function(_0x350f6a){if(_0x350f6a){return _0x257f36[_0xf424('0x17')](_0x10c29f)[_0xf424('0x19')](_0x350f6a);}};}function respondWithFilteredResult(_0x3a28e1,_0x384cc2){return function(_0x3f7e6a){if(_0x3f7e6a){var _0xd456c6=typeof _0x384cc2[_0xf424('0x1a')]===_0xf424('0x1b')&&typeof _0x384cc2['limit']==='undefined';var _0xb4a5c2=_0x3f7e6a[_0xf424('0x1c')];var _0x570cda=_0xd456c6?0x0:_0x384cc2['offset'];var _0xb961ef=_0xd456c6?_0x3f7e6a['count']:_0x384cc2[_0xf424('0x1a')]+_0x384cc2['limit'];var _0x48a7a6;if(_0xb961ef>=_0xb4a5c2){_0xb961ef=_0xb4a5c2;_0x48a7a6=0xc8;}else{_0x48a7a6=0xce;}_0x3a28e1[_0xf424('0x17')](_0x48a7a6);return _0x3a28e1[_0xf424('0x1d')]('Content-Range',_0x570cda+'-'+_0xb961ef+'/'+_0xb4a5c2)[_0xf424('0x19')](_0x3f7e6a);}return null;};}function patchUpdates(_0x1c66ea){return function(_0x4521b0){try{jsonpatch[_0xf424('0x1e')](_0x4521b0,_0x1c66ea,!![]);}catch(_0x2c1703){return BPromise[_0xf424('0x1f')](_0x2c1703);}return _0x4521b0['save']();};}function saveUpdates(_0x43e6c5,_0x58f9f3){return function(_0x49d73e){if(_0x49d73e){return _0x49d73e['update'](_0x43e6c5)[_0xf424('0x20')](function(_0x4a3f5f){return _0x4a3f5f;});}return null;};}function removeEntity(_0x232624,_0xb587df){return function(_0x561aeb){if(_0x561aeb){return _0x561aeb[_0xf424('0x21')]()['then'](function(){_0x232624[_0xf424('0x17')](0xcc)[_0xf424('0x18')]();});}};}function handleEntityNotFound(_0x47fb49,_0x204d4d){return function(_0x5612ee){if(!_0x5612ee){_0x47fb49['sendStatus'](0x194);}return _0x5612ee;};}function handleError(_0x5771c5,_0xf7032f){_0xf7032f=_0xf7032f||0x1f4;return function(_0x2196ac){logger[_0xf424('0x22')](_0x2196ac[_0xf424('0x23')]);if(_0x2196ac[_0xf424('0x24')]){delete _0x2196ac[_0xf424('0x24')];}_0x5771c5[_0xf424('0x17')](_0xf7032f)[_0xf424('0x25')](_0x2196ac);};}exports['index']=function(_0x365b0a,_0x12e860){var _0x3a6afa={},_0xb3c1d0={},_0x4389a9={'count':0x0,'rows':[]};var _0x32cc1b=_[_0xf424('0x26')](db[_0xf424('0x27')][_0xf424('0x28')],function(_0x514e3f){return{'name':_0x514e3f['fieldName'],'type':_0x514e3f[_0xf424('0x29')][_0xf424('0x2a')]};});_0xb3c1d0['model']=_[_0xf424('0x2b')](_[_0xf424('0x26')](_0x32cc1b,'name'),[_0xf424('0x24')]);_0xb3c1d0[_0xf424('0x2c')]=_[_0xf424('0x2d')](_0x365b0a[_0xf424('0x2c')]);_0xb3c1d0[_0xf424('0x2e')]=_['intersection'](_0xb3c1d0[_0xf424('0x2f')],_0xb3c1d0[_0xf424('0x2c')]);_0x3a6afa[_0xf424('0x30')]=_[_0xf424('0x31')](_0xb3c1d0['model'],qs['fields'](_0x365b0a[_0xf424('0x2c')][_0xf424('0x32')]));_0x3a6afa[_0xf424('0x30')]=_0x3a6afa[_0xf424('0x30')]['length']?_0x3a6afa['attributes']:_0xb3c1d0[_0xf424('0x2f')];if(!_0x365b0a['query'][_0xf424('0x33')](_0xf424('0x34'))){_0x3a6afa[_0xf424('0x35')]=qs[_0xf424('0x35')](_0x365b0a[_0xf424('0x2c')]['limit']);_0x3a6afa['offset']=qs[_0xf424('0x1a')](_0x365b0a[_0xf424('0x2c')]['offset']);}_0x3a6afa[_0xf424('0x36')]=qs[_0xf424('0x37')](_0x365b0a[_0xf424('0x2c')][_0xf424('0x37')]);_0x3a6afa[_0xf424('0x38')]=qs[_0xf424('0x2e')](_[_0xf424('0x39')](_0x365b0a[_0xf424('0x2c')],_0xb3c1d0[_0xf424('0x2e')]),_0x32cc1b);if(_0x365b0a['query'][_0xf424('0x3a')]){_0x3a6afa['where']=_['merge'](_0x3a6afa[_0xf424('0x38')],{'$or':_[_0xf424('0x26')](_0x32cc1b,function(_0x506d48){if(_0x506d48[_0xf424('0x29')]!==_0xf424('0x3b')){var _0xc5f0d9={};_0xc5f0d9[_0x506d48[_0xf424('0x24')]]={'$like':'%'+_0x365b0a[_0xf424('0x2c')][_0xf424('0x3a')]+'%'};return _0xc5f0d9;}})});}_0x3a6afa=_[_0xf424('0x3c')]({},_0x3a6afa,_0x365b0a[_0xf424('0x3d')]);var _0x308563={'where':_0x3a6afa[_0xf424('0x38')]};return db[_0xf424('0x27')][_0xf424('0x1c')](_0x308563)[_0xf424('0x20')](function(_0x4315ae){_0x4389a9['count']=_0x4315ae;if(_0x365b0a[_0xf424('0x2c')][_0xf424('0x3e')]){_0x3a6afa[_0xf424('0x3f')]=[{'all':!![]}];}return db[_0xf424('0x27')][_0xf424('0x40')](_0x3a6afa);})['then'](function(_0x62e930){_0x4389a9[_0xf424('0x41')]=_0x62e930;return _0x4389a9;})['then'](respondWithFilteredResult(_0x12e860,_0x3a6afa))[_0xf424('0x42')](handleError(_0x12e860,null));};exports[_0xf424('0x43')]=function(_0xe68ee8,_0x28e878){var _0xa67d87={'raw':!![],'where':{'id':_0xe68ee8[_0xf424('0x44')]['id']}},_0xe84f38={};_0xe84f38[_0xf424('0x2f')]=_['keys'](db[_0xf424('0x27')][_0xf424('0x28')]);_0xe84f38[_0xf424('0x2c')]=_['keys'](_0xe68ee8['query']);_0xe84f38[_0xf424('0x2e')]=_['intersection'](_0xe84f38['model'],_0xe84f38['query']);_0xa67d87['attributes']=_[_0xf424('0x31')](_0xe84f38[_0xf424('0x2f')],qs[_0xf424('0x32')](_0xe68ee8['query'][_0xf424('0x32')]));_0xa67d87[_0xf424('0x30')]=_0xa67d87['attributes'][_0xf424('0x45')]?_0xa67d87[_0xf424('0x30')]:_0xe84f38[_0xf424('0x2f')];if(_0xe68ee8[_0xf424('0x2c')]['includeAll']){_0xa67d87[_0xf424('0x3f')]=[{'all':!![]}];}_0xa67d87=_[_0xf424('0x3c')]({},_0xa67d87,_0xe68ee8[_0xf424('0x3d')]);return db[_0xf424('0x27')]['find'](_0xa67d87)[_0xf424('0x20')](handleEntityNotFound(_0x28e878,null))[_0xf424('0x20')](respondWithResult(_0x28e878,null))[_0xf424('0x42')](handleError(_0x28e878,null));};exports[_0xf424('0x46')]=function(_0x524fe1,_0x229730){return db[_0xf424('0x27')]['create'](_0x524fe1[_0xf424('0x47')],{})[_0xf424('0x20')](respondWithResult(_0x229730,0xc9))[_0xf424('0x42')](handleError(_0x229730,null));};exports[_0xf424('0x48')]=function(_0x570481,_0x2fd581){if(_0x570481[_0xf424('0x47')]['id']){delete _0x570481[_0xf424('0x47')]['id'];}return db[_0xf424('0x27')][_0xf424('0x49')]({'where':{'id':_0x570481[_0xf424('0x44')]['id']}})[_0xf424('0x20')](handleEntityNotFound(_0x2fd581,null))[_0xf424('0x20')](saveUpdates(_0x570481['body'],null))[_0xf424('0x20')](respondWithResult(_0x2fd581,null))['catch'](handleError(_0x2fd581,null));};exports[_0xf424('0x21')]=function(_0x5d582e,_0x38c24a){return db[_0xf424('0x27')][_0xf424('0x49')]({'where':{'id':_0x5d582e['params']['id']}})[_0xf424('0x20')](handleEntityNotFound(_0x38c24a,null))[_0xf424('0x20')](removeEntity(_0x38c24a,null))[_0xf424('0x42')](handleError(_0x38c24a,null));};exports[_0xf424('0x4a')]=function(_0x137667,_0x38450e,_0x33dc90){return db[_0xf424('0x27')][_0xf424('0x49')]({'where':{'id':_0x137667[_0xf424('0x44')]['id']},'attributes':['id',_0xf424('0x4b'),_0xf424('0x4c')]})[_0xf424('0x20')](handleEntityNotFound(_0x38450e,null))['then'](function(_0x254e37){if(_0x254e37){if(!_0x254e37[_0xf424('0x4b')]){throw new db[(_0xf424('0x4d'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x3e1228={'Content-Type':_0xf424('0x4e'),'Content-Disposition':_0xf424('0x4f')};if(_0x254e37['msg_id']){_0x3e1228[_0xf424('0x50')]=_0xf424('0x51')+_0x254e37['msg_id']+_0xf424('0x52');}_0x38450e[_0xf424('0x1d')](_0x3e1228);return _0x38450e[_0xf424('0x25')](new Buffer(_0x254e37['recording']));}})[_0xf424('0x42')](handleError(_0x38450e,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 2d86ace..5ce9fef 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 _0xfff1=['exports','define','VoiceMailMessage','dir','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x3ff507,_0x431563){var _0x26e36e=function(_0x470746){while(--_0x470746){_0x3ff507['push'](_0x3ff507['shift']());}};_0x26e36e(++_0x431563);}(_0xfff1,0xfe));var _0x1fff=function(_0x10c897,_0x568396){_0x10c897=_0x10c897-0x0;var _0x173ada=_0xfff1[_0x10c897];return _0x173ada;};'use strict';var _=require('lodash');var util=require(_0x1fff('0x0'));var logger=require(_0x1fff('0x1'))(_0x1fff('0x2'));var moment=require('moment');var BPromise=require(_0x1fff('0x3'));var rp=require(_0x1fff('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1fff('0x5'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x1fff('0x6')]=function(_0x104131,_0x436426){return _0x104131[_0x1fff('0x7')](_0x1fff('0x8'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x1fff('0x9'),'fields':[_0x1fff('0x9')]}],'timestamps':![]});}; \ No newline at end of file +var _0xd141=['voice_voicemail_messages','dir','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes','define','VoiceMailMessage'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xd141,0x152));var _0x1d14=function(_0x228277,_0x506989){_0x228277=_0x228277-0x0;var _0x1fd6c4=_0xd141[_0x228277];return _0x1fd6c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1d14('0x0'))(_0x1d14('0x1'));var moment=require(_0x1d14('0x2'));var BPromise=require(_0x1d14('0x3'));var rp=require(_0x1d14('0x4'));var fs=require('fs');var path=require(_0x1d14('0x5'));var rimraf=require(_0x1d14('0x6'));var config=require('../../config/environment');var attributes=require(_0x1d14('0x7'));module['exports']=function(_0x4c6e9b,_0x2c0280){return _0x4c6e9b[_0x1d14('0x8')](_0x1d14('0x9'),attributes,{'tableName':_0x1d14('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x1d14('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 42a92be..8dce50e 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 _0x69a5=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util'];(function(_0x344c01,_0x464b0b){var _0x3d57a4=function(_0x4d1272){while(--_0x4d1272){_0x344c01['push'](_0x344c01['shift']());}};_0x3d57a4(++_0x464b0b);}(_0x69a5,0xbb));var _0x569a=function(_0x58bd7b,_0x558e61){_0x58bd7b=_0x58bd7b-0x0;var _0x470c1c=_0x69a5[_0x58bd7b];return _0x470c1c;};'use strict';var _=require(_0x569a('0x0'));var util=require(_0x569a('0x1'));var moment=require(_0x569a('0x2'));var BPromise=require('bluebird');var rs=require(_0x569a('0x3'));var fs=require('fs');var Redis=require(_0x569a('0x4'));var db=require(_0x569a('0x5'))['db'];var utils=require(_0x569a('0x6'));var logger=require('../../config/logger')(_0x569a('0x7'));var config=require(_0x569a('0x8'));var jayson=require(_0x569a('0x9'));var client=jayson[_0x569a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x367a1a,_0x388486,_0x3625d2){return new BPromise(function(_0x167bf3,_0x40c4ad){return client[_0x569a('0xb')](_0x367a1a,_0x3625d2)[_0x569a('0xc')](function(_0x3c2a1a){logger[_0x569a('0xd')](_0x569a('0xe'),_0x388486,_0x569a('0xf'));logger[_0x569a('0x10')](_0x569a('0x11'),_0x388486,_0x569a('0xf'),JSON['stringify'](_0x3c2a1a));if(_0x3c2a1a['error']){if(_0x3c2a1a[_0x569a('0x12')]['code']===0x1f4){logger[_0x569a('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x388486,_0x3c2a1a['error'][_0x569a('0x13')]);return _0x40c4ad(_0x3c2a1a[_0x569a('0x12')][_0x569a('0x13')]);}logger[_0x569a('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x388486,_0x3c2a1a[_0x569a('0x12')][_0x569a('0x13')]);return _0x167bf3(_0x3c2a1a[_0x569a('0x12')]['message']);}else{logger[_0x569a('0xd')](_0x569a('0xe'),_0x388486,'request\x20sent');_0x167bf3(_0x3c2a1a[_0x569a('0x14')][_0x569a('0x13')]);}})['catch'](function(_0x3d4666){logger[_0x569a('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x388486,_0x3d4666);_0x40c4ad(_0x3d4666);});});} \ No newline at end of file +var _0xad16=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2d3206,_0x434cf5){var _0x18702d=function(_0x4e0735){while(--_0x4e0735){_0x2d3206['push'](_0x2d3206['shift']());}};_0x18702d(++_0x434cf5);}(_0xad16,0x8f));var _0x6ad1=function(_0x1d7cec,_0x1242a4){_0x1d7cec=_0x1d7cec-0x0;var _0x51e770=_0xad16[_0x1d7cec];return _0x51e770;};'use strict';var _=require(_0x6ad1('0x0'));var util=require(_0x6ad1('0x1'));var moment=require(_0x6ad1('0x2'));var BPromise=require(_0x6ad1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ad1('0x4'));var db=require(_0x6ad1('0x5'))['db'];var utils=require(_0x6ad1('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6ad1('0x7'));var jayson=require(_0x6ad1('0x8'));var client=jayson[_0x6ad1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19f16d,_0x273a0d,_0x1b5cda){return new BPromise(function(_0x4cdc25,_0x4595d5){return client[_0x6ad1('0xa')](_0x19f16d,_0x1b5cda)[_0x6ad1('0xb')](function(_0x3a114b){logger[_0x6ad1('0xc')](_0x6ad1('0xd'),_0x273a0d,'request\x20sent');logger[_0x6ad1('0xe')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x273a0d,_0x6ad1('0xf'),JSON['stringify'](_0x3a114b));if(_0x3a114b[_0x6ad1('0x10')]){if(_0x3a114b['error'][_0x6ad1('0x11')]===0x1f4){logger[_0x6ad1('0x10')](_0x6ad1('0xd'),_0x273a0d,_0x3a114b[_0x6ad1('0x10')][_0x6ad1('0x12')]);return _0x4595d5(_0x3a114b['error'][_0x6ad1('0x12')]);}logger[_0x6ad1('0x10')](_0x6ad1('0xd'),_0x273a0d,_0x3a114b[_0x6ad1('0x10')]['message']);return _0x4cdc25(_0x3a114b[_0x6ad1('0x10')][_0x6ad1('0x12')]);}else{logger['info'](_0x6ad1('0xd'),_0x273a0d,_0x6ad1('0xf'));_0x4cdc25(_0x3a114b[_0x6ad1('0x13')]['message']);}})[_0x6ad1('0x14')](function(_0xf1e76c){logger[_0x6ad1('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x273a0d,_0xf1e76c);_0x4595d5(_0xf1e76c);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 3b26ef1..cb0f1da 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 _0xc9cb=['put','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id','isAuthenticated','getSounds','post','addSound'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc9cb,0x1de));var _0xbc9c=function(_0x5ce862,_0xc7a088){_0x5ce862=_0x5ce862-0x0;var _0x11bad3=_0xc9cb[_0x5ce862];return _0x11bad3;};'use strict';var multer=require(_0xbc9c('0x0'));var util=require(_0xbc9c('0x1'));var path=require(_0xbc9c('0x2'));var timeout=require(_0xbc9c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbc9c('0x4'));var auth=require(_0xbc9c('0x5'));var interaction=require(_0xbc9c('0x6'));var config=require(_0xbc9c('0x7'));var controller=require(_0xbc9c('0x8'));router[_0xbc9c('0x9')]('/',auth['isAuthenticated'](),controller[_0xbc9c('0xa')]);router[_0xbc9c('0x9')](_0xbc9c('0xb'),auth[_0xbc9c('0xc')](),controller['show']);router[_0xbc9c('0x9')]('/:id/sounds',auth[_0xbc9c('0xc')](),controller[_0xbc9c('0xd')]);router[_0xbc9c('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/sounds',auth[_0xbc9c('0xc')](),controller[_0xbc9c('0xf')]);router[_0xbc9c('0x10')](_0xbc9c('0xb'),auth[_0xbc9c('0xc')](),controller['update']);router[_0xbc9c('0x11')](_0xbc9c('0xb'),auth[_0xbc9c('0xc')](),controller['destroy']);router['delete']('/:id/sounds/:id2',auth['isAuthenticated'](),controller['removeSound']);module[_0xbc9c('0x12')]=router; \ No newline at end of file +var _0x61c9=['../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','getSounds','post','/:id/sounds','update','delete','destroy','removeSound','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x552e0e,_0x4fbc60){var _0x570e10=function(_0x466429){while(--_0x466429){_0x552e0e['push'](_0x552e0e['shift']());}};_0x570e10(++_0x4fbc60);}(_0x61c9,0x1c9));var _0x961c=function(_0x53a00d,_0x462437){_0x53a00d=_0x53a00d-0x0;var _0x28b7f6=_0x61c9[_0x53a00d];return _0x28b7f6;};'use strict';var multer=require(_0x961c('0x0'));var util=require('util');var path=require(_0x961c('0x1'));var timeout=require(_0x961c('0x2'));var express=require(_0x961c('0x3'));var router=express['Router']();var fs_extra=require(_0x961c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x961c('0x5'));var config=require(_0x961c('0x6'));var controller=require(_0x961c('0x7'));router[_0x961c('0x8')]('/',auth[_0x961c('0x9')](),controller[_0x961c('0xa')]);router[_0x961c('0x8')](_0x961c('0xb'),auth[_0x961c('0x9')](),controller[_0x961c('0xc')]);router['get']('/:id/sounds',auth[_0x961c('0x9')](),controller[_0x961c('0xd')]);router[_0x961c('0xe')]('/',auth[_0x961c('0x9')](),controller['create']);router[_0x961c('0xe')](_0x961c('0xf'),auth[_0x961c('0x9')](),controller['addSound']);router['put']('/:id',auth[_0x961c('0x9')](),controller[_0x961c('0x10')]);router[_0x961c('0x11')](_0x961c('0xb'),auth['isAuthenticated'](),controller[_0x961c('0x12')]);router[_0x961c('0x11')]('/:id/sounds/:id2',auth[_0x961c('0x9')](),controller[_0x961c('0x13')]);module[_0x961c('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c1a7701..92ea028 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 _0x9f32=['BOOLEAN','exports','STRING','name','ENUM','custom','files','quietmp3nb','mp3','alpha','TIMESTAMP'];(function(_0x5520c7,_0xbee449){var _0x3b0590=function(_0x1bb4f9){while(--_0x1bb4f9){_0x5520c7['push'](_0x5520c7['shift']());}};_0x3b0590(++_0xbee449);}(_0x9f32,0x198));var _0x29f3=function(_0x478bbc,_0x54c396){_0x478bbc=_0x478bbc-0x0;var _0x237ca0=_0x9f32[_0x478bbc];return _0x237ca0;};'use strict';var Sequelize=require('sequelize');module[_0x29f3('0x0')]={'name':{'type':Sequelize[_0x29f3('0x1')],'allowNull':![],'unique':_0x29f3('0x2')},'mode':{'type':Sequelize[_0x29f3('0x3')](_0x29f3('0x4'),_0x29f3('0x5'),'mp3nb',_0x29f3('0x6'),'quietmp3',_0x29f3('0x7')),'allowNull':!![],'defaultValue':_0x29f3('0x5')},'directory':{'type':Sequelize[_0x29f3('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x29f3('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x29f3('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x29f3('0x1')],'allowNull':!![],'defaultValue':_0x29f3('0x8')},'format':{'type':Sequelize[_0x29f3('0x1')],'allowNull':!![]},'stamp':{'type':_0x29f3('0x9')},'defaultEntry':{'type':Sequelize[_0x29f3('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0xaefa=['mp3nb','quietmp3','mp3','alpha','BOOLEAN','sequelize','STRING','name','custom','files'];(function(_0x38d4ac,_0x19cf87){var _0x3497fb=function(_0x5dc7a0){while(--_0x5dc7a0){_0x38d4ac['push'](_0x38d4ac['shift']());}};_0x3497fb(++_0x19cf87);}(_0xaefa,0x163));var _0xaaef=function(_0x5799e0,_0x5a2b87){_0x5799e0=_0x5799e0-0x0;var _0x4730f4=_0xaefa[_0x5799e0];return _0x4730f4;};'use strict';var Sequelize=require(_0xaaef('0x0'));module['exports']={'name':{'type':Sequelize[_0xaaef('0x1')],'allowNull':![],'unique':_0xaaef('0x2')},'mode':{'type':Sequelize['ENUM'](_0xaaef('0x3'),_0xaaef('0x4'),_0xaaef('0x5'),'quietmp3nb',_0xaaef('0x6'),_0xaaef('0x7')),'allowNull':!![],'defaultValue':_0xaaef('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xaaef('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xaaef('0x1')],'allowNull':!![],'defaultValue':_0xaaef('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xaaef('0x9')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index f0f7a42..be6a323 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 _0x0925=['set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','type','key','model','query','keys','attributes','fields','hasOwnProperty','sort','where','pick','filters','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','intersection','length','find','body','transaction','mode','files','directory','join','root','server/files/moh','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','forEach','unlinkSync','ValidationError','Sound','findOne','save_name','createdAt','server/files/sounds/converted','%s.%s','extname','format','converted_format','Sequelize','removeSound','id2','order','getSounds','nolimit','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x0925,0xb9));var _0x5092=function(_0x1ef04e,_0x26c2fd){_0x1ef04e=_0x1ef04e-0x0;var _0x59a3c8=_0x0925[_0x1ef04e];return _0x59a3c8;};'use strict';var emlformat=require(_0x5092('0x0'));var rimraf=require(_0x5092('0x1'));var zipdir=require(_0x5092('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5092('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5092('0x4'));var util=require(_0x5092('0x5'));var path=require('path');var sox=require(_0x5092('0x6'));var csv=require(_0x5092('0x7'));var ejs=require(_0x5092('0x8'));var fs=require('fs');var fs_extra=require(_0x5092('0x9'));var _=require(_0x5092('0xa'));var squel=require(_0x5092('0xb'));var crypto=require('crypto');var jsforce=require(_0x5092('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5092('0x7'));var querystring=require(_0x5092('0xd'));var Papa=require(_0x5092('0xe'));var Redis=require(_0x5092('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5092('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5092('0x11'));var config=require(_0x5092('0x12'));var licenseUtil=require(_0x5092('0x13'));var db=require(_0x5092('0x14'))['db'];function respondWithStatusCode(_0x3420e5,_0x27497e){_0x27497e=_0x27497e||0xcc;return function(_0x445fea){if(_0x445fea){return _0x3420e5['sendStatus'](_0x27497e);}return _0x3420e5['status'](_0x27497e)['end']();};}function respondWithResult(_0x4031ea,_0x4404c3){_0x4404c3=_0x4404c3||0xc8;return function(_0xd017b){if(_0xd017b){return _0x4031ea[_0x5092('0x15')](_0x4404c3)[_0x5092('0x16')](_0xd017b);}};}function respondWithFilteredResult(_0x538d4d,_0x2ab98c){return function(_0x312a0b){if(_0x312a0b){var _0x3b5ece=typeof _0x2ab98c[_0x5092('0x17')]===_0x5092('0x18')&&typeof _0x2ab98c['limit']===_0x5092('0x18');var _0x52047d=_0x312a0b[_0x5092('0x19')];var _0x42fe11=_0x3b5ece?0x0:_0x2ab98c[_0x5092('0x17')];var _0xbc4e78=_0x3b5ece?_0x312a0b[_0x5092('0x19')]:_0x2ab98c[_0x5092('0x17')]+_0x2ab98c[_0x5092('0x1a')];var _0x21b695;if(_0xbc4e78>=_0x52047d){_0xbc4e78=_0x52047d;_0x21b695=0xc8;}else{_0x21b695=0xce;}_0x538d4d[_0x5092('0x15')](_0x21b695);return _0x538d4d[_0x5092('0x1b')](_0x5092('0x1c'),_0x42fe11+'-'+_0xbc4e78+'/'+_0x52047d)['json'](_0x312a0b);}return null;};}function patchUpdates(_0x277c67){return function(_0x27e725){try{jsonpatch[_0x5092('0x1d')](_0x27e725,_0x277c67,!![]);}catch(_0x1003dd){return BPromise['reject'](_0x1003dd);}return _0x27e725[_0x5092('0x1e')]();};}function saveUpdates(_0x15d896,_0x5ccae2){return function(_0x1578dc){if(_0x1578dc){return _0x1578dc[_0x5092('0x1f')](_0x15d896)[_0x5092('0x20')](function(_0x3893af){return _0x3893af;});}return null;};}function removeEntity(_0x596678,_0x21eabd){return function(_0x32ab58){if(_0x32ab58){return _0x32ab58[_0x5092('0x21')]()[_0x5092('0x20')](function(){var _0x405123=_0x32ab58[_0x5092('0x22')]({'plain':!![]});var _0x195a68='MusicOnHolds';return db[_0x5092('0x23')][_0x5092('0x21')]({'where':{'type':_0x195a68,'resourceId':_0x405123['id']}})[_0x5092('0x20')](function(){return _0x32ab58;});})[_0x5092('0x20')](function(){_0x596678[_0x5092('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21d019,_0x380516){return function(_0x493b2b){if(!_0x493b2b){_0x21d019['sendStatus'](0x194);}return _0x493b2b;};}function handleError(_0x114a48,_0x1d3c33){_0x1d3c33=_0x1d3c33||0x1f4;return function(_0xb84bc9){logger['error'](_0xb84bc9[_0x5092('0x24')]);if(_0xb84bc9[_0x5092('0x25')]){delete _0xb84bc9[_0x5092('0x25')];}_0x114a48['status'](_0x1d3c33)[_0x5092('0x26')](_0xb84bc9);};}exports[_0x5092('0x27')]=function(_0x313c01,_0x5948a5){var _0x4ec371={},_0x4db785={},_0x1003a2={'count':0x0,'rows':[]};var _0x5520ce=_[_0x5092('0x28')](db[_0x5092('0x29')][_0x5092('0x2a')],function(_0x1434fb){return{'name':_0x1434fb['fieldName'],'type':_0x1434fb[_0x5092('0x2b')][_0x5092('0x2c')]};});_0x4db785[_0x5092('0x2d')]=_[_0x5092('0x28')](_0x5520ce,_0x5092('0x25'));_0x4db785[_0x5092('0x2e')]=_[_0x5092('0x2f')](_0x313c01['query']);_0x4db785['filters']=_['intersection'](_0x4db785[_0x5092('0x2d')],_0x4db785[_0x5092('0x2e')]);_0x4ec371[_0x5092('0x30')]=_['intersection'](_0x4db785[_0x5092('0x2d')],qs[_0x5092('0x31')](_0x313c01['query'][_0x5092('0x31')]));_0x4ec371[_0x5092('0x30')]=_0x4ec371[_0x5092('0x30')]['length']?_0x4ec371[_0x5092('0x30')]:_0x4db785[_0x5092('0x2d')];if(!_0x313c01[_0x5092('0x2e')][_0x5092('0x32')]('nolimit')){_0x4ec371[_0x5092('0x1a')]=qs[_0x5092('0x1a')](_0x313c01['query'][_0x5092('0x1a')]);_0x4ec371[_0x5092('0x17')]=qs[_0x5092('0x17')](_0x313c01[_0x5092('0x2e')][_0x5092('0x17')]);}_0x4ec371['order']=qs[_0x5092('0x33')](_0x313c01[_0x5092('0x2e')][_0x5092('0x33')]);delete _0x313c01[_0x5092('0x2e')][_0x5092('0x33')];_0x4ec371[_0x5092('0x34')]=qs['filters'](_[_0x5092('0x35')](_0x313c01['query'],_0x4db785[_0x5092('0x36')]),_0x5520ce);if(_0x313c01[_0x5092('0x2e')]['filter']){_0x4ec371['where']=_[_0x5092('0x37')](_0x4ec371[_0x5092('0x34')],{'$or':_[_0x5092('0x28')](_0x5520ce,function(_0x246c74){if(_0x246c74['type']!=='VIRTUAL'){var _0x1b4c5a={};_0x1b4c5a[_0x246c74[_0x5092('0x25')]]={'$like':'%'+_0x313c01[_0x5092('0x2e')][_0x5092('0x38')]+'%'};return _0x1b4c5a;}})});}_0x4ec371=_['merge']({},_0x4ec371,_0x313c01[_0x5092('0x39')]);var _0x5c9cd9={'where':_0x4ec371['where']};return db['VoiceMusicOnHold'][_0x5092('0x19')](_0x5c9cd9)[_0x5092('0x20')](function(_0x57a8b9){_0x1003a2[_0x5092('0x19')]=_0x57a8b9;if(_0x313c01[_0x5092('0x2e')][_0x5092('0x3a')]){_0x4ec371[_0x5092('0x3b')]=[{'all':!![]}];}return db[_0x5092('0x29')][_0x5092('0x3c')](_0x4ec371);})[_0x5092('0x20')](function(_0x2d65ef){_0x1003a2[_0x5092('0x3d')]=_0x2d65ef;return _0x1003a2;})['then'](respondWithFilteredResult(_0x5948a5,_0x4ec371))[_0x5092('0x3e')](handleError(_0x5948a5,null));};exports[_0x5092('0x3f')]=function(_0x2c5d30,_0x1b6be6){var _0x195305={'raw':![],'where':{'id':_0x2c5d30[_0x5092('0x40')]['id']}},_0x509ecc={};_0x509ecc[_0x5092('0x2d')]=_['keys'](db[_0x5092('0x29')][_0x5092('0x2a')]);_0x509ecc[_0x5092('0x2e')]=_[_0x5092('0x2f')](_0x2c5d30[_0x5092('0x2e')]);_0x509ecc[_0x5092('0x36')]=_[_0x5092('0x41')](_0x509ecc[_0x5092('0x2d')],_0x509ecc['query']);_0x195305[_0x5092('0x30')]=_[_0x5092('0x41')](_0x509ecc[_0x5092('0x2d')],qs['fields'](_0x2c5d30[_0x5092('0x2e')][_0x5092('0x31')]));_0x195305[_0x5092('0x30')]=_0x195305['attributes'][_0x5092('0x42')]?_0x195305[_0x5092('0x30')]:_0x509ecc['model'];if(_0x2c5d30[_0x5092('0x2e')][_0x5092('0x3a')]){_0x195305['include']=[{'all':!![]}];}_0x195305=_[_0x5092('0x37')]({},_0x195305,_0x2c5d30['options']);return db[_0x5092('0x29')][_0x5092('0x43')](_0x195305)[_0x5092('0x20')](handleEntityNotFound(_0x1b6be6,null))['then'](respondWithResult(_0x1b6be6,null))[_0x5092('0x3e')](handleError(_0x1b6be6,null));};exports['update']=function(_0x36cbea,_0x531696){if(_0x36cbea[_0x5092('0x44')]['id']){delete _0x36cbea[_0x5092('0x44')]['id'];}return db[_0x5092('0x29')][_0x5092('0x43')]({'where':{'id':_0x36cbea[_0x5092('0x40')]['id']}})['then'](handleEntityNotFound(_0x531696,null))[_0x5092('0x20')](saveUpdates(_0x36cbea[_0x5092('0x44')],null))['then'](respondWithResult(_0x531696,null))[_0x5092('0x3e')](handleError(_0x531696,null));};exports['create']=function(_0x19405d,_0x201a5d,_0x46255a){return db['sequelize'][_0x5092('0x45')](function(_0x3c7da0){if(_0x19405d[_0x5092('0x44')][_0x5092('0x46')]===_0x5092('0x47')){_0x19405d[_0x5092('0x44')][_0x5092('0x48')]=path[_0x5092('0x49')](config[_0x5092('0x4a')],_0x5092('0x4b'),_0x19405d[_0x5092('0x44')][_0x5092('0x25')]);}return db['VoiceMusicOnHold'][_0x5092('0x4c')](_0x19405d[_0x5092('0x44')],{'transaction':_0x3c7da0})[_0x5092('0x20')](function(_0x20b780){if(_0x19405d[_0x5092('0x44')][_0x5092('0x46')]===_0x5092('0x47')){fs['mkdirSync'](_0x20b780[_0x5092('0x48')],parseInt('0777',0x8));}var _0x2f46f5=_0x19405d[_0x5092('0x4d')]['get']({'plain':!![]});if(!_0x2f46f5)throw new Error(_0x5092('0x4e'));if(_0x2f46f5[_0x5092('0x4f')]===_0x5092('0x4d')){var _0x5e2e37=_0x20b780[_0x5092('0x22')]({'plain':!![]});return db[_0x5092('0x50')]['find']({'where':{'name':_0x5092('0x51'),'userProfileId':_0x2f46f5[_0x5092('0x52')]},'raw':!![]})[_0x5092('0x20')](function(_0x286fb7){if(_0x286fb7&&_0x286fb7[_0x5092('0x53')]===0x0){return db[_0x5092('0x23')][_0x5092('0x4c')]({'name':_0x5e2e37[_0x5092('0x25')],'resourceId':_0x5e2e37['id'],'type':_0x286fb7[_0x5092('0x25')],'sectionId':_0x286fb7['id']},{})[_0x5092('0x20')](function(){return _0x20b780;});}else{return _0x20b780;}})[_0x5092('0x3e')](function(_0x3d78fe){logger[_0x5092('0x54')](_0x5092('0x55'),_0x3d78fe);});}return _0x20b780;});})[_0x5092('0x20')](respondWithResult(_0x201a5d,0xc9))[_0x5092('0x3e')](handleError(_0x201a5d,null));};exports[_0x5092('0x21')]=function(_0x8fe44,_0x28f010,_0x231431){var _0x1b0aaa;return db[_0x5092('0x29')][_0x5092('0x43')]({'where':{'id':_0x8fe44[_0x5092('0x40')]['id']}})[_0x5092('0x20')](function(_0x3a1ac7){if(_0x3a1ac7){return db[_0x5092('0x56')][_0x5092('0x45')](function(_0x199a64){return _0x3a1ac7[_0x5092('0x21')]({'transaction':_0x199a64,'raw':!![]})[_0x5092('0x20')](function(_0x453cf8){if(_0x453cf8[_0x5092('0x48')]){fs[_0x5092('0x57')](_0x453cf8[_0x5092('0x48')])[_0x5092('0x58')](function(_0xd72184){fs[_0x5092('0x59')](path['join'](_0x453cf8[_0x5092('0x48')],_0xd72184));});fs['rmdirSync'](_0x453cf8[_0x5092('0x48')]);}return _0x453cf8;});})[_0x5092('0x3e')](function(_0x25aa0d){throw new db['Sequelize'][(_0x5092('0x5a'))](_0x25aa0d['message']);});}})['then'](handleEntityNotFound(_0x28f010,null))[_0x5092('0x20')](removeEntity(_0x28f010,null))[_0x5092('0x3e')](handleError(_0x28f010,null));};exports['addSound']=function(_0x31b7ba,_0x209b1b,_0x315506){return db['sequelize']['transaction'](function(_0x422ac4){var _0x98804d;return db['VoiceMusicOnHold'][_0x5092('0x43')]({'where':{'id':_0x31b7ba[_0x5092('0x40')]['id']}})[_0x5092('0x20')](function(_0x9c1e59){if(_0x9c1e59){_0x98804d=_0x9c1e59;return _0x9c1e59['addSound'](_0x31b7ba[_0x5092('0x44')]['id'],{'transaction':_0x422ac4});}})[_0x5092('0x20')](function(_0x2c0c41){if(_0x2c0c41){return db[_0x5092('0x5b')][_0x5092('0x5c')]({'where':{'id':_0x31b7ba['body']['id']},'attributes':['id',_0x5092('0x25'),_0x5092('0x5d'),'converted_format',_0x5092('0x5e')],'raw':!![]});}})[_0x5092('0x20')](function(_0x20e908){if(_0x20e908){var _0x1fd8ed=path[_0x5092('0x49')](config['root'],_0x5092('0x5f'),util['format'](_0x5092('0x60'),path['basename'](_0x20e908['save_name'],path[_0x5092('0x61')](_0x20e908['save_name'])),_0x20e908['converted_format']));var _0x59a2c6=path[_0x5092('0x49')](config['root'],_0x5092('0x4b'),_0x98804d[_0x5092('0x25')],util[_0x5092('0x62')]('%s.%s',_0x20e908[_0x5092('0x25')],_0x20e908[_0x5092('0x63')]));fs['symlinkSync'](_0x1fd8ed,_0x59a2c6);return _0x20e908;}})[_0x5092('0x3e')](function(_0x3a050e){throw new db[(_0x5092('0x64'))]['ValidationError'](_0x3a050e['message']);});})[_0x5092('0x20')](handleEntityNotFound(_0x209b1b,null))[_0x5092('0x20')](respondWithResult(_0x209b1b,0xc9))[_0x5092('0x3e')](handleError(_0x209b1b,null));};exports[_0x5092('0x65')]=function(_0x239b6c,_0x3d02f3,_0x29ca13){return db[_0x5092('0x56')]['transaction'](function(_0xd6c522){var _0x562f70;return db[_0x5092('0x29')]['findOne']({'where':{'id':_0x239b6c['params']['id']}})[_0x5092('0x20')](handleEntityNotFound(_0x3d02f3,null))[_0x5092('0x20')](function(_0x1b557e){if(_0x1b557e){_0x562f70=_0x1b557e;return _0x1b557e[_0x5092('0x65')](_0x239b6c[_0x5092('0x40')]['id2']);}})['then'](function(_0x1f1437){if(_0x1f1437){return db[_0x5092('0x5b')][_0x5092('0x5c')]({'where':{'id':_0x239b6c[_0x5092('0x40')][_0x5092('0x66')]},'attributes':['id',_0x5092('0x25'),_0x5092('0x5d'),_0x5092('0x63'),_0x5092('0x5e')],'raw':!![]});}})[_0x5092('0x20')](function(_0x2c7e1c){if(_0x2c7e1c){fs['unlinkSync'](path[_0x5092('0x49')](_0x562f70[_0x5092('0x48')],util[_0x5092('0x62')]('%s.%s',_0x2c7e1c[_0x5092('0x25')],_0x2c7e1c[_0x5092('0x63')])));return _0x2c7e1c;}})[_0x5092('0x3e')](function(_0x56438d){throw new db[(_0x5092('0x64'))]['ValidationError'](_0x56438d['message']);});})[_0x5092('0x20')](handleEntityNotFound(_0x3d02f3,null))[_0x5092('0x20')](respondWithStatusCode(_0x3d02f3,0xcc))[_0x5092('0x3e')](handleError(_0x3d02f3,null));};exports['getSounds']=function(_0x3b0ee6,_0x13feb7,_0x5125e8){var _0x2c4a6e={};var _0x33cc91={};var _0x4a3206;var _0x3aa8dd;return db[_0x5092('0x29')][_0x5092('0x5c')]({'where':{'id':_0x3b0ee6[_0x5092('0x40')]['id']}})[_0x5092('0x20')](handleEntityNotFound(_0x13feb7,null))[_0x5092('0x20')](function(_0x2d0425){if(_0x2d0425){_0x4a3206=_0x2d0425;_0x33cc91[_0x5092('0x2d')]=_[_0x5092('0x2f')](db['Sound'][_0x5092('0x2a')]);_0x33cc91[_0x5092('0x2e')]=_[_0x5092('0x2f')](_0x3b0ee6[_0x5092('0x2e')]);_0x33cc91[_0x5092('0x36')]=_[_0x5092('0x41')](_0x33cc91[_0x5092('0x2d')],_0x33cc91[_0x5092('0x2e')]);_0x2c4a6e[_0x5092('0x30')]=_[_0x5092('0x41')](_0x33cc91['model'],qs[_0x5092('0x31')](_0x3b0ee6[_0x5092('0x2e')]['fields']));_0x2c4a6e[_0x5092('0x30')]=_0x2c4a6e[_0x5092('0x30')][_0x5092('0x42')]?_0x2c4a6e[_0x5092('0x30')]:_0x33cc91[_0x5092('0x2d')];_0x2c4a6e[_0x5092('0x67')]=qs[_0x5092('0x33')](_0x3b0ee6['query'][_0x5092('0x33')]);_0x2c4a6e[_0x5092('0x34')]=qs[_0x5092('0x36')](_[_0x5092('0x35')](_0x3b0ee6[_0x5092('0x2e')],_0x33cc91[_0x5092('0x36')]));if(_0x3b0ee6['query'][_0x5092('0x38')]){_0x2c4a6e['where']=_[_0x5092('0x37')](_0x2c4a6e[_0x5092('0x34')],{'$or':_[_0x5092('0x28')](_0x2c4a6e[_0x5092('0x30')],function(_0x185e43){var _0x49afcf={};_0x49afcf[_0x185e43]={'$like':'%'+_0x3b0ee6['query'][_0x5092('0x38')]+'%'};return _0x49afcf;})});}_0x2c4a6e=_[_0x5092('0x37')]({},_0x2c4a6e,_0x3b0ee6[_0x5092('0x39')]);return _0x4a3206[_0x5092('0x68')](_0x2c4a6e);}})[_0x5092('0x20')](function(_0x125345){if(_0x125345){_0x3aa8dd=_0x125345[_0x5092('0x42')];if(!_0x3b0ee6[_0x5092('0x2e')][_0x5092('0x32')](_0x5092('0x69'))){_0x2c4a6e[_0x5092('0x1a')]=qs[_0x5092('0x1a')](_0x3b0ee6[_0x5092('0x2e')][_0x5092('0x1a')]);_0x2c4a6e[_0x5092('0x17')]=qs[_0x5092('0x17')](_0x3b0ee6['query'][_0x5092('0x17')]);}return _0x4a3206[_0x5092('0x68')](_0x2c4a6e);}})[_0x5092('0x20')](function(_0x15598f){if(_0x15598f){return _0x15598f?{'count':_0x3aa8dd,'rows':_0x15598f}:null;}})['then'](respondWithResult(_0x13feb7,null))[_0x5092('0x3e')](handleError(_0x13feb7,null));}; \ No newline at end of file +var _0x1c6e=['createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','server/files/moh','symlinkSync','removeSound','id2','unlinkSync','getSounds','nolimit','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','undefined','limit','count','offset','set','json','apply','save','update','then','UserProfileResource','destroy','end','error','stack','name','index','map','VoiceMusicOnHold','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','include','body','find','sequelize','transaction','mode','files','join','create','mkdirSync','directory','0777','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','MusicOnHolds','userProfileId','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1c6e,0x1b1));var _0xe1c6=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x1c6e[_0x50007c];return _0x5c1ec7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe1c6('0x0'));var zipdir=require(_0xe1c6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe1c6('0x2'));var moment=require(_0xe1c6('0x3'));var BPromise=require(_0xe1c6('0x4'));var Mustache=require(_0xe1c6('0x5'));var util=require('util');var path=require(_0xe1c6('0x6'));var sox=require(_0xe1c6('0x7'));var csv=require(_0xe1c6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe1c6('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe1c6('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe1c6('0xb'));var toCsv=require(_0xe1c6('0x8'));var querystring=require(_0xe1c6('0xc'));var Papa=require(_0xe1c6('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe1c6('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe1c6('0xf'));var logger=require(_0xe1c6('0x10'))(_0xe1c6('0x11'));var utils=require(_0xe1c6('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31b0c5,_0x21144b){_0x21144b=_0x21144b||0xcc;return function(_0x569a30){if(_0x569a30){return _0x31b0c5[_0xe1c6('0x13')](_0x21144b);}return _0x31b0c5[_0xe1c6('0x14')](_0x21144b)['end']();};}function respondWithResult(_0x20cefd,_0x3ac14b){_0x3ac14b=_0x3ac14b||0xc8;return function(_0x14ef22){if(_0x14ef22){return _0x20cefd[_0xe1c6('0x14')](_0x3ac14b)['json'](_0x14ef22);}};}function respondWithFilteredResult(_0xb43d2e,_0x429ec1){return function(_0x5e89c7){if(_0x5e89c7){var _0x374666=typeof _0x429ec1['offset']===_0xe1c6('0x15')&&typeof _0x429ec1[_0xe1c6('0x16')]===_0xe1c6('0x15');var _0x2d9176=_0x5e89c7[_0xe1c6('0x17')];var _0x244bd0=_0x374666?0x0:_0x429ec1[_0xe1c6('0x18')];var _0x1155b2=_0x374666?_0x5e89c7[_0xe1c6('0x17')]:_0x429ec1[_0xe1c6('0x18')]+_0x429ec1['limit'];var _0x8282ae;if(_0x1155b2>=_0x2d9176){_0x1155b2=_0x2d9176;_0x8282ae=0xc8;}else{_0x8282ae=0xce;}_0xb43d2e[_0xe1c6('0x14')](_0x8282ae);return _0xb43d2e[_0xe1c6('0x19')]('Content-Range',_0x244bd0+'-'+_0x1155b2+'/'+_0x2d9176)[_0xe1c6('0x1a')](_0x5e89c7);}return null;};}function patchUpdates(_0x28f0fa){return function(_0x38fa6f){try{jsonpatch[_0xe1c6('0x1b')](_0x38fa6f,_0x28f0fa,!![]);}catch(_0x34f159){return BPromise['reject'](_0x34f159);}return _0x38fa6f[_0xe1c6('0x1c')]();};}function saveUpdates(_0x111773,_0x4cdf0c){return function(_0x25e63f){if(_0x25e63f){return _0x25e63f[_0xe1c6('0x1d')](_0x111773)[_0xe1c6('0x1e')](function(_0x10ef3c){return _0x10ef3c;});}return null;};}function removeEntity(_0x464369,_0x27c198){return function(_0x2d0d9a){if(_0x2d0d9a){return _0x2d0d9a['destroy']()[_0xe1c6('0x1e')](function(){var _0xd17e15=_0x2d0d9a['get']({'plain':!![]});var _0x17e217='MusicOnHolds';return db[_0xe1c6('0x1f')][_0xe1c6('0x20')]({'where':{'type':_0x17e217,'resourceId':_0xd17e15['id']}})[_0xe1c6('0x1e')](function(){return _0x2d0d9a;});})[_0xe1c6('0x1e')](function(){_0x464369[_0xe1c6('0x14')](0xcc)[_0xe1c6('0x21')]();});}};}function handleEntityNotFound(_0x3ef592,_0x1c7170){return function(_0x23e4b0){if(!_0x23e4b0){_0x3ef592[_0xe1c6('0x13')](0x194);}return _0x23e4b0;};}function handleError(_0x5ac007,_0x51aa15){_0x51aa15=_0x51aa15||0x1f4;return function(_0x3f27cc){logger[_0xe1c6('0x22')](_0x3f27cc[_0xe1c6('0x23')]);if(_0x3f27cc[_0xe1c6('0x24')]){delete _0x3f27cc['name'];}_0x5ac007[_0xe1c6('0x14')](_0x51aa15)['send'](_0x3f27cc);};}exports[_0xe1c6('0x25')]=function(_0x584837,_0x2ec6e2){var _0x47e187={},_0x49e85e={},_0xb19b83={'count':0x0,'rows':[]};var _0x3525f6=_[_0xe1c6('0x26')](db[_0xe1c6('0x27')][_0xe1c6('0x28')],function(_0x268e3f){return{'name':_0x268e3f[_0xe1c6('0x29')],'type':_0x268e3f['type'][_0xe1c6('0x2a')]};});_0x49e85e[_0xe1c6('0x2b')]=_[_0xe1c6('0x26')](_0x3525f6,_0xe1c6('0x24'));_0x49e85e[_0xe1c6('0x2c')]=_[_0xe1c6('0x2d')](_0x584837[_0xe1c6('0x2c')]);_0x49e85e[_0xe1c6('0x2e')]=_['intersection'](_0x49e85e['model'],_0x49e85e[_0xe1c6('0x2c')]);_0x47e187[_0xe1c6('0x2f')]=_[_0xe1c6('0x30')](_0x49e85e[_0xe1c6('0x2b')],qs['fields'](_0x584837['query'][_0xe1c6('0x31')]));_0x47e187['attributes']=_0x47e187[_0xe1c6('0x2f')][_0xe1c6('0x32')]?_0x47e187[_0xe1c6('0x2f')]:_0x49e85e[_0xe1c6('0x2b')];if(!_0x584837[_0xe1c6('0x2c')][_0xe1c6('0x33')]('nolimit')){_0x47e187[_0xe1c6('0x16')]=qs['limit'](_0x584837['query'][_0xe1c6('0x16')]);_0x47e187[_0xe1c6('0x18')]=qs[_0xe1c6('0x18')](_0x584837[_0xe1c6('0x2c')][_0xe1c6('0x18')]);}_0x47e187[_0xe1c6('0x34')]=qs[_0xe1c6('0x35')](_0x584837[_0xe1c6('0x2c')][_0xe1c6('0x35')]);delete _0x584837[_0xe1c6('0x2c')]['sort'];_0x47e187[_0xe1c6('0x36')]=qs['filters'](_['pick'](_0x584837['query'],_0x49e85e[_0xe1c6('0x2e')]),_0x3525f6);if(_0x584837['query'][_0xe1c6('0x37')]){_0x47e187[_0xe1c6('0x36')]=_[_0xe1c6('0x38')](_0x47e187[_0xe1c6('0x36')],{'$or':_['map'](_0x3525f6,function(_0x29910c){if(_0x29910c[_0xe1c6('0x39')]!==_0xe1c6('0x3a')){var _0x6eaffe={};_0x6eaffe[_0x29910c[_0xe1c6('0x24')]]={'$like':'%'+_0x584837[_0xe1c6('0x2c')][_0xe1c6('0x37')]+'%'};return _0x6eaffe;}})});}_0x47e187=_[_0xe1c6('0x38')]({},_0x47e187,_0x584837[_0xe1c6('0x3b')]);var _0x14ef8d={'where':_0x47e187[_0xe1c6('0x36')]};return db['VoiceMusicOnHold']['count'](_0x14ef8d)[_0xe1c6('0x1e')](function(_0x31c3ac){_0xb19b83[_0xe1c6('0x17')]=_0x31c3ac;if(_0x584837['query'][_0xe1c6('0x3c')]){_0x47e187['include']=[{'all':!![]}];}return db[_0xe1c6('0x27')][_0xe1c6('0x3d')](_0x47e187);})[_0xe1c6('0x1e')](function(_0x3dcfe1){_0xb19b83['rows']=_0x3dcfe1;return _0xb19b83;})[_0xe1c6('0x1e')](respondWithFilteredResult(_0x2ec6e2,_0x47e187))[_0xe1c6('0x3e')](handleError(_0x2ec6e2,null));};exports[_0xe1c6('0x3f')]=function(_0x2f15b5,_0x31ffcb){var _0x4bcf01={'raw':![],'where':{'id':_0x2f15b5[_0xe1c6('0x40')]['id']}},_0x4cd673={};_0x4cd673[_0xe1c6('0x2b')]=_['keys'](db[_0xe1c6('0x27')][_0xe1c6('0x28')]);_0x4cd673[_0xe1c6('0x2c')]=_[_0xe1c6('0x2d')](_0x2f15b5['query']);_0x4cd673[_0xe1c6('0x2e')]=_[_0xe1c6('0x30')](_0x4cd673[_0xe1c6('0x2b')],_0x4cd673[_0xe1c6('0x2c')]);_0x4bcf01[_0xe1c6('0x2f')]=_['intersection'](_0x4cd673['model'],qs[_0xe1c6('0x31')](_0x2f15b5[_0xe1c6('0x2c')][_0xe1c6('0x31')]));_0x4bcf01['attributes']=_0x4bcf01[_0xe1c6('0x2f')][_0xe1c6('0x32')]?_0x4bcf01[_0xe1c6('0x2f')]:_0x4cd673[_0xe1c6('0x2b')];if(_0x2f15b5[_0xe1c6('0x2c')]['includeAll']){_0x4bcf01[_0xe1c6('0x41')]=[{'all':!![]}];}_0x4bcf01=_['merge']({},_0x4bcf01,_0x2f15b5[_0xe1c6('0x3b')]);return db[_0xe1c6('0x27')]['find'](_0x4bcf01)[_0xe1c6('0x1e')](handleEntityNotFound(_0x31ffcb,null))[_0xe1c6('0x1e')](respondWithResult(_0x31ffcb,null))[_0xe1c6('0x3e')](handleError(_0x31ffcb,null));};exports[_0xe1c6('0x1d')]=function(_0x511dd5,_0x33d098){if(_0x511dd5[_0xe1c6('0x42')]['id']){delete _0x511dd5[_0xe1c6('0x42')]['id'];}return db[_0xe1c6('0x27')][_0xe1c6('0x43')]({'where':{'id':_0x511dd5['params']['id']}})['then'](handleEntityNotFound(_0x33d098,null))[_0xe1c6('0x1e')](saveUpdates(_0x511dd5[_0xe1c6('0x42')],null))['then'](respondWithResult(_0x33d098,null))[_0xe1c6('0x3e')](handleError(_0x33d098,null));};exports['create']=function(_0x1bf6c5,_0x13d2b7,_0x5123ba){return db[_0xe1c6('0x44')][_0xe1c6('0x45')](function(_0x6887f1){if(_0x1bf6c5[_0xe1c6('0x42')][_0xe1c6('0x46')]===_0xe1c6('0x47')){_0x1bf6c5['body']['directory']=path[_0xe1c6('0x48')](config['root'],'server/files/moh',_0x1bf6c5[_0xe1c6('0x42')][_0xe1c6('0x24')]);}return db['VoiceMusicOnHold'][_0xe1c6('0x49')](_0x1bf6c5['body'],{'transaction':_0x6887f1})[_0xe1c6('0x1e')](function(_0x14fb1c){if(_0x1bf6c5[_0xe1c6('0x42')][_0xe1c6('0x46')]===_0xe1c6('0x47')){fs[_0xe1c6('0x4a')](_0x14fb1c[_0xe1c6('0x4b')],parseInt(_0xe1c6('0x4c'),0x8));}var _0x497a59=_0x1bf6c5['user'][_0xe1c6('0x4d')]({'plain':!![]});if(!_0x497a59)throw new Error(_0xe1c6('0x4e'));if(_0x497a59[_0xe1c6('0x4f')]===_0xe1c6('0x50')){var _0x3af661=_0x14fb1c[_0xe1c6('0x4d')]({'plain':!![]});return db[_0xe1c6('0x51')][_0xe1c6('0x43')]({'where':{'name':_0xe1c6('0x52'),'userProfileId':_0x497a59[_0xe1c6('0x53')]},'raw':!![]})['then'](function(_0x4f34e5){if(_0x4f34e5&&_0x4f34e5['autoAssociation']===0x0){return db['UserProfileResource'][_0xe1c6('0x49')]({'name':_0x3af661['name'],'resourceId':_0x3af661['id'],'type':_0x4f34e5['name'],'sectionId':_0x4f34e5['id']},{})[_0xe1c6('0x1e')](function(){return _0x14fb1c;});}else{return _0x14fb1c;}})[_0xe1c6('0x3e')](function(_0x2555b8){logger[_0xe1c6('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2555b8);});}return _0x14fb1c;});})[_0xe1c6('0x1e')](respondWithResult(_0x13d2b7,0xc9))[_0xe1c6('0x3e')](handleError(_0x13d2b7,null));};exports[_0xe1c6('0x20')]=function(_0x3edb5a,_0x42cf03,_0x37372a){var _0x421403;return db['VoiceMusicOnHold'][_0xe1c6('0x43')]({'where':{'id':_0x3edb5a[_0xe1c6('0x40')]['id']}})[_0xe1c6('0x1e')](function(_0x42c5c2){if(_0x42c5c2){return db[_0xe1c6('0x44')][_0xe1c6('0x45')](function(_0x2bfe44){return _0x42c5c2['destroy']({'transaction':_0x2bfe44,'raw':!![]})[_0xe1c6('0x1e')](function(_0x26eca6){if(_0x26eca6[_0xe1c6('0x4b')]){fs['readdirSync'](_0x26eca6[_0xe1c6('0x4b')])['forEach'](function(_0x1ccd66){fs['unlinkSync'](path[_0xe1c6('0x48')](_0x26eca6[_0xe1c6('0x4b')],_0x1ccd66));});fs['rmdirSync'](_0x26eca6['directory']);}return _0x26eca6;});})['catch'](function(_0x1d3e30){throw new db[(_0xe1c6('0x54'))][(_0xe1c6('0x55'))](_0x1d3e30[_0xe1c6('0x56')]);});}})[_0xe1c6('0x1e')](handleEntityNotFound(_0x42cf03,null))[_0xe1c6('0x1e')](removeEntity(_0x42cf03,null))[_0xe1c6('0x3e')](handleError(_0x42cf03,null));};exports[_0xe1c6('0x57')]=function(_0x54514f,_0x5ed980,_0x1f720e){return db[_0xe1c6('0x44')][_0xe1c6('0x45')](function(_0x5af1f4){var _0x4ec5e0;return db[_0xe1c6('0x27')][_0xe1c6('0x43')]({'where':{'id':_0x54514f['params']['id']}})['then'](function(_0x495724){if(_0x495724){_0x4ec5e0=_0x495724;return _0x495724[_0xe1c6('0x57')](_0x54514f[_0xe1c6('0x42')]['id'],{'transaction':_0x5af1f4});}})[_0xe1c6('0x1e')](function(_0x332562){if(_0x332562){return db[_0xe1c6('0x58')][_0xe1c6('0x59')]({'where':{'id':_0x54514f[_0xe1c6('0x42')]['id']},'attributes':['id',_0xe1c6('0x24'),_0xe1c6('0x5a'),_0xe1c6('0x5b'),_0xe1c6('0x5c')],'raw':!![]});}})['then'](function(_0xe8487e){if(_0xe8487e){var _0x4890c1=path[_0xe1c6('0x48')](config['root'],_0xe1c6('0x5d'),util[_0xe1c6('0x5e')](_0xe1c6('0x5f'),path[_0xe1c6('0x60')](_0xe8487e[_0xe1c6('0x5a')],path[_0xe1c6('0x61')](_0xe8487e[_0xe1c6('0x5a')])),_0xe8487e[_0xe1c6('0x5b')]));var _0x198eb8=path[_0xe1c6('0x48')](config['root'],_0xe1c6('0x62'),_0x4ec5e0[_0xe1c6('0x24')],util[_0xe1c6('0x5e')]('%s.%s',_0xe8487e[_0xe1c6('0x24')],_0xe8487e['converted_format']));fs[_0xe1c6('0x63')](_0x4890c1,_0x198eb8);return _0xe8487e;}})[_0xe1c6('0x3e')](function(_0x3bec33){throw new db[(_0xe1c6('0x54'))][(_0xe1c6('0x55'))](_0x3bec33[_0xe1c6('0x56')]);});})[_0xe1c6('0x1e')](handleEntityNotFound(_0x5ed980,null))['then'](respondWithResult(_0x5ed980,0xc9))[_0xe1c6('0x3e')](handleError(_0x5ed980,null));};exports['removeSound']=function(_0x500ccc,_0x50a3a4,_0x4f5622){return db[_0xe1c6('0x44')][_0xe1c6('0x45')](function(_0x346702){var _0x37377e;return db[_0xe1c6('0x27')]['findOne']({'where':{'id':_0x500ccc[_0xe1c6('0x40')]['id']}})['then'](handleEntityNotFound(_0x50a3a4,null))['then'](function(_0x212848){if(_0x212848){_0x37377e=_0x212848;return _0x212848[_0xe1c6('0x64')](_0x500ccc[_0xe1c6('0x40')]['id2']);}})['then'](function(_0x4d72cc){if(_0x4d72cc){return db[_0xe1c6('0x58')][_0xe1c6('0x59')]({'where':{'id':_0x500ccc[_0xe1c6('0x40')][_0xe1c6('0x65')]},'attributes':['id','name',_0xe1c6('0x5a'),'converted_format',_0xe1c6('0x5c')],'raw':!![]});}})['then'](function(_0x3c2691){if(_0x3c2691){fs[_0xe1c6('0x66')](path[_0xe1c6('0x48')](_0x37377e[_0xe1c6('0x4b')],util[_0xe1c6('0x5e')](_0xe1c6('0x5f'),_0x3c2691[_0xe1c6('0x24')],_0x3c2691[_0xe1c6('0x5b')])));return _0x3c2691;}})[_0xe1c6('0x3e')](function(_0x414244){throw new db['Sequelize'][(_0xe1c6('0x55'))](_0x414244[_0xe1c6('0x56')]);});})[_0xe1c6('0x1e')](handleEntityNotFound(_0x50a3a4,null))[_0xe1c6('0x1e')](respondWithStatusCode(_0x50a3a4,0xcc))['catch'](handleError(_0x50a3a4,null));};exports[_0xe1c6('0x67')]=function(_0x414591,_0xf440b2,_0x37832f){var _0x5d9541={};var _0x22f2d8={};var _0x112bc7;var _0x2c0ad1;return db['VoiceMusicOnHold'][_0xe1c6('0x59')]({'where':{'id':_0x414591[_0xe1c6('0x40')]['id']}})[_0xe1c6('0x1e')](handleEntityNotFound(_0xf440b2,null))[_0xe1c6('0x1e')](function(_0x5982c9){if(_0x5982c9){_0x112bc7=_0x5982c9;_0x22f2d8['model']=_['keys'](db[_0xe1c6('0x58')][_0xe1c6('0x28')]);_0x22f2d8[_0xe1c6('0x2c')]=_[_0xe1c6('0x2d')](_0x414591['query']);_0x22f2d8[_0xe1c6('0x2e')]=_['intersection'](_0x22f2d8['model'],_0x22f2d8[_0xe1c6('0x2c')]);_0x5d9541['attributes']=_[_0xe1c6('0x30')](_0x22f2d8[_0xe1c6('0x2b')],qs['fields'](_0x414591['query'][_0xe1c6('0x31')]));_0x5d9541['attributes']=_0x5d9541[_0xe1c6('0x2f')]['length']?_0x5d9541['attributes']:_0x22f2d8['model'];_0x5d9541[_0xe1c6('0x34')]=qs[_0xe1c6('0x35')](_0x414591[_0xe1c6('0x2c')][_0xe1c6('0x35')]);_0x5d9541['where']=qs[_0xe1c6('0x2e')](_['pick'](_0x414591['query'],_0x22f2d8['filters']));if(_0x414591[_0xe1c6('0x2c')][_0xe1c6('0x37')]){_0x5d9541[_0xe1c6('0x36')]=_[_0xe1c6('0x38')](_0x5d9541[_0xe1c6('0x36')],{'$or':_['map'](_0x5d9541[_0xe1c6('0x2f')],function(_0x5f277d){var _0xa19983={};_0xa19983[_0x5f277d]={'$like':'%'+_0x414591[_0xe1c6('0x2c')][_0xe1c6('0x37')]+'%'};return _0xa19983;})});}_0x5d9541=_['merge']({},_0x5d9541,_0x414591[_0xe1c6('0x3b')]);return _0x112bc7[_0xe1c6('0x67')](_0x5d9541);}})[_0xe1c6('0x1e')](function(_0x14d6ed){if(_0x14d6ed){_0x2c0ad1=_0x14d6ed['length'];if(!_0x414591[_0xe1c6('0x2c')][_0xe1c6('0x33')](_0xe1c6('0x68'))){_0x5d9541[_0xe1c6('0x16')]=qs[_0xe1c6('0x16')](_0x414591[_0xe1c6('0x2c')][_0xe1c6('0x16')]);_0x5d9541['offset']=qs[_0xe1c6('0x18')](_0x414591[_0xe1c6('0x2c')][_0xe1c6('0x18')]);}return _0x112bc7[_0xe1c6('0x67')](_0x5d9541);}})[_0xe1c6('0x1e')](function(_0x107a19){if(_0x107a19){return _0x107a19?{'count':_0x2c0ad1,'rows':_0x107a19}:null;}})[_0xe1c6('0x1e')](respondWithResult(_0xf440b2,null))[_0xe1c6('0x3e')](handleError(_0xf440b2,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 0e571f9..7fcca8e 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 _0x3fc8=['api','moment','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger'];(function(_0x13ce8f,_0x399bc5){var _0xe5e05=function(_0x2f2676){while(--_0x2f2676){_0x13ce8f['push'](_0x13ce8f['shift']());}};_0xe5e05(++_0x399bc5);}(_0x3fc8,0x14d));var _0x83fc=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3fc8[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x83fc('0x0'));var util=require(_0x83fc('0x1'));var logger=require(_0x83fc('0x2'))(_0x83fc('0x3'));var moment=require(_0x83fc('0x4'));var BPromise=require('bluebird');var rp=require(_0x83fc('0x5'));var fs=require('fs');var path=require(_0x83fc('0x6'));var rimraf=require(_0x83fc('0x7'));var config=require(_0x83fc('0x8'));var attributes=require(_0x83fc('0x9'));module[_0x83fc('0xa')]=function(_0x25d7e8,_0x2eb83b){return _0x25d7e8[_0x83fc('0xb')](_0x83fc('0xc'),attributes,{'tableName':_0x83fc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2dac=['exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','api','moment','bluebird','path','./voiceMusicOnHold.attributes'];(function(_0x2843da,_0x47a8ff){var _0x13147b=function(_0x4611a9){while(--_0x4611a9){_0x2843da['push'](_0x2843da['shift']());}};_0x13147b(++_0x47a8ff);}(_0x2dac,0x93));var _0xc2da=function(_0x2b8bf1,_0x3977d6){_0x2b8bf1=_0x2b8bf1-0x0;var _0x3d2a62=_0x2dac[_0x2b8bf1];return _0x3d2a62;};'use strict';var _=require(_0xc2da('0x0'));var util=require(_0xc2da('0x1'));var logger=require('../../config/logger')(_0xc2da('0x2'));var moment=require(_0xc2da('0x3'));var BPromise=require(_0xc2da('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc2da('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc2da('0x6'));module[_0xc2da('0x7')]=function(_0x1bef3c,_0x5f4247){return _0x1bef3c[_0xc2da('0x8')](_0xc2da('0x9'),attributes,{'tableName':_0xc2da('0xa'),'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 b356c7c..e47a29c 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x85630d,_0x91262b){var _0x3781de=function(_0x23eead){while(--_0x23eead){_0x85630d['push'](_0x85630d['shift']());}};_0x3781de(++_0x91262b);}(_0x34e8,0x12c));var _0x834e=function(_0x490afa,_0xa356ff){_0x490afa=_0x490afa-0x0;var _0x27cb4f=_0x34e8[_0x490afa];return _0x27cb4f;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2ddc63,_0x4569ad){var _0x3a372e=function(_0x1c6f7c){while(--_0x1c6f7c){_0x2ddc63['push'](_0x2ddc63['shift']());}};_0x3a372e(++_0x4569ad);}(_0xe706,0xa3));var _0x6e70=function(_0x2b9cf5,_0x2a7804){_0x2b9cf5=_0x2b9cf5-0x0;var _0xd0cf15=_0xe706[_0x2b9cf5];return _0xd0cf15;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 8d0f89f..34018bf 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 _0xe4b8=['../../config/environment','./voicePrefix.controller','get','index','/describe','show','/:id/users','isAuthenticated','/:id/teams','post','create','addAgents','addTeams','put','/:id','update','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x65ca71,_0x126845){var _0x5cb16e=function(_0xe1143b){while(--_0xe1143b){_0x65ca71['push'](_0x65ca71['shift']());}};_0x5cb16e(++_0x126845);}(_0xe4b8,0x179));var _0x8e4b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe4b8[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x8e4b('0x0'));var util=require(_0x8e4b('0x1'));var path=require(_0x8e4b('0x2'));var timeout=require(_0x8e4b('0x3'));var express=require(_0x8e4b('0x4'));var router=express[_0x8e4b('0x5')]();var fs_extra=require(_0x8e4b('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8e4b('0x7'));var controller=require(_0x8e4b('0x8'));router[_0x8e4b('0x9')]('/',auth['isAuthenticated'](),controller[_0x8e4b('0xa')]);router['get'](_0x8e4b('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8e4b('0xc')]);router['get'](_0x8e4b('0xd'),auth[_0x8e4b('0xe')](),controller['getAgents']);router[_0x8e4b('0x9')](_0x8e4b('0xf'),auth[_0x8e4b('0xe')](),controller['getTeams']);router[_0x8e4b('0x10')]('/',auth[_0x8e4b('0xe')](),controller[_0x8e4b('0x11')]);router[_0x8e4b('0x10')](_0x8e4b('0xd'),auth[_0x8e4b('0xe')](),controller[_0x8e4b('0x12')]);router[_0x8e4b('0x10')]('/:id/teams',auth['isAuthenticated'](),controller[_0x8e4b('0x13')]);router[_0x8e4b('0x14')](_0x8e4b('0x15'),auth[_0x8e4b('0xe')](),controller[_0x8e4b('0x16')]);router['delete']('/:id',auth[_0x8e4b('0xe')](),controller['destroy']);router['delete'](_0x8e4b('0xd'),auth['isAuthenticated'](),controller[_0x8e4b('0x17')]);router['delete'](_0x8e4b('0xf'),auth[_0x8e4b('0xe')](),controller['removeTeams']);module['exports']=router; \ No newline at end of file +var _0xa566=['../../config/environment','get','isAuthenticated','/:id','show','/:id/users','/:id/teams','post','create','addAgents','addTeams','put','update','delete','destroy','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa566,0x1c1));var _0x6a56=function(_0x1026e0,_0x62b8e0){_0x1026e0=_0x1026e0-0x0;var _0x536a17=_0xa566[_0x1026e0];return _0x536a17;};'use strict';var multer=require(_0x6a56('0x0'));var util=require(_0x6a56('0x1'));var path=require(_0x6a56('0x2'));var timeout=require('connect-timeout');var express=require(_0x6a56('0x3'));var router=express[_0x6a56('0x4')]();var fs_extra=require(_0x6a56('0x5'));var auth=require(_0x6a56('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6a56('0x7'));var controller=require('./voicePrefix.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6a56('0x8')]('/describe',auth[_0x6a56('0x9')](),controller['describe']);router[_0x6a56('0x8')](_0x6a56('0xa'),auth['isAuthenticated'](),controller[_0x6a56('0xb')]);router[_0x6a56('0x8')](_0x6a56('0xc'),auth[_0x6a56('0x9')](),controller['getAgents']);router[_0x6a56('0x8')](_0x6a56('0xd'),auth['isAuthenticated'](),controller['getTeams']);router[_0x6a56('0xe')]('/',auth[_0x6a56('0x9')](),controller[_0x6a56('0xf')]);router[_0x6a56('0xe')](_0x6a56('0xc'),auth[_0x6a56('0x9')](),controller[_0x6a56('0x10')]);router['post'](_0x6a56('0xd'),auth[_0x6a56('0x9')](),controller[_0x6a56('0x11')]);router[_0x6a56('0x12')](_0x6a56('0xa'),auth['isAuthenticated'](),controller[_0x6a56('0x13')]);router[_0x6a56('0x14')](_0x6a56('0xa'),auth[_0x6a56('0x9')](),controller[_0x6a56('0x15')]);router['delete']('/:id/users',auth[_0x6a56('0x9')](),controller[_0x6a56('0x16')]);router['delete'](_0x6a56('0xd'),auth[_0x6a56('0x9')](),controller['removeTeams']);module[_0x6a56('0x17')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index d7f21f6..aa909d2 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 _0x4ad6=['sequelize','STRING','name','system-','getDataValue'];(function(_0x3513a0,_0x3bdc88){var _0x2bdeb9=function(_0x37f06d){while(--_0x37f06d){_0x3513a0['push'](_0x3513a0['shift']());}};_0x2bdeb9(++_0x3bdc88);}(_0x4ad6,0x69));var _0x64ad=function(_0xb213df,_0x4fbb3a){_0xb213df=_0xb213df-0x0;var _0x339361=_0x4ad6[_0xb213df];return _0x339361;};'use strict';var Sequelize=require(_0x64ad('0x0'));module['exports']={'name':{'type':Sequelize[_0x64ad('0x1')],'allowNull':![],'unique':_0x64ad('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x1679d2){return _0x64ad('0x3')+this[_0x64ad('0x4')](_0x64ad('0x2'))+'-';}},'description':{'type':Sequelize[_0x64ad('0x1')]},'callerIdAll':{'type':Sequelize[_0x64ad('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xf707=['INTEGER','sequelize','exports','STRING','VIRTUAL','system-','name'];(function(_0x901d57,_0x48d9b1){var _0x1eaa80=function(_0x23b382){while(--_0x23b382){_0x901d57['push'](_0x901d57['shift']());}};_0x1eaa80(++_0x48d9b1);}(_0xf707,0xf6));var _0x7f70=function(_0x2b8fe9,_0x5cac02){_0x2b8fe9=_0x2b8fe9-0x0;var _0x138c37=_0xf707[_0x2b8fe9];return _0x138c37;};'use strict';var Sequelize=require(_0x7f70('0x0'));module[_0x7f70('0x1')]={'name':{'type':Sequelize[_0x7f70('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x7f70('0x3')],'get':function(_0x27a7ab){return _0x7f70('0x4')+this['getDataValue'](_0x7f70('0x5'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x7f70('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x7f70('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 40d869c..0ec172c 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 _0x5b12=['QueryTypes','SELECT','TeamId','includes','all','union','compact','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','name','index','map','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','options','VoicePrefix','includeAll','include','findAll','rows','catch','show','fields','find','params','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','context','from-sip','exten','app','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','push','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','findOne','merge','getTeams','Team','User','online','flatMap','Agents','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b12,0xa3));var _0x25b1=function(_0xddedf1,_0x250d8c){_0xddedf1=_0xddedf1-0x0;var _0x55913f=_0x5b12[_0xddedf1];return _0x55913f;};'use strict';var emlformat=require(_0x25b1('0x0'));var rimraf=require(_0x25b1('0x1'));var zipdir=require(_0x25b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25b1('0x3'));var moment=require('moment');var BPromise=require(_0x25b1('0x4'));var Mustache=require(_0x25b1('0x5'));var util=require('util');var path=require(_0x25b1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x25b1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x25b1('0x8'));var crypto=require(_0x25b1('0x9'));var jsforce=require(_0x25b1('0xa'));var deskjs=require(_0x25b1('0xb'));var toCsv=require(_0x25b1('0xc'));var querystring=require(_0x25b1('0xd'));var Papa=require(_0x25b1('0xe'));var Redis=require(_0x25b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x25b1('0x10'));var as=require(_0x25b1('0x11'));var hardwareService=require(_0x25b1('0x12'));var logger=require(_0x25b1('0x13'))(_0x25b1('0x14'));var utils=require(_0x25b1('0x15'));var config=require(_0x25b1('0x16'));var licenseUtil=require(_0x25b1('0x17'));var db=require(_0x25b1('0x18'))['db'];config[_0x25b1('0x19')]=_[_0x25b1('0x1a')](config[_0x25b1('0x19')],{'host':_0x25b1('0x1b'),'port':0x18eb});var socket=require(_0x25b1('0x1c'))(new Redis(config[_0x25b1('0x19')]));require(_0x25b1('0x1d'))['register'](socket);function respondWithStatusCode(_0x2c337a,_0x2559a1){_0x2559a1=_0x2559a1||0xcc;return function(_0x4de13f){if(_0x4de13f){return _0x2c337a[_0x25b1('0x1e')](_0x2559a1);}return _0x2c337a[_0x25b1('0x1f')](_0x2559a1)[_0x25b1('0x20')]();};}function respondWithResult(_0x4a5a58,_0x593165){_0x593165=_0x593165||0xc8;return function(_0x7b50ab){if(_0x7b50ab){return _0x4a5a58['status'](_0x593165)[_0x25b1('0x21')](_0x7b50ab);}};}function respondWithFilteredResult(_0x2ca567,_0x1be2d8){return function(_0x27ccc9){if(_0x27ccc9){var _0x1f78c2=typeof _0x1be2d8[_0x25b1('0x22')]===_0x25b1('0x23')&&typeof _0x1be2d8[_0x25b1('0x24')]==='undefined';var _0x4ecff1=_0x27ccc9[_0x25b1('0x25')];var _0x501dc8=_0x1f78c2?0x0:_0x1be2d8[_0x25b1('0x22')];var _0x50ae0f=_0x1f78c2?_0x27ccc9[_0x25b1('0x25')]:_0x1be2d8['offset']+_0x1be2d8[_0x25b1('0x24')];var _0x529310;if(_0x50ae0f>=_0x4ecff1){_0x50ae0f=_0x4ecff1;_0x529310=0xc8;}else{_0x529310=0xce;}_0x2ca567[_0x25b1('0x1f')](_0x529310);return _0x2ca567['set']('Content-Range',_0x501dc8+'-'+_0x50ae0f+'/'+_0x4ecff1)['json'](_0x27ccc9);}return null;};}function patchUpdates(_0x3bca9f){return function(_0x150436){try{jsonpatch['apply'](_0x150436,_0x3bca9f,!![]);}catch(_0x19bab8){return BPromise[_0x25b1('0x26')](_0x19bab8);}return _0x150436[_0x25b1('0x27')]();};}function saveUpdates(_0x246acd,_0x1aabbb){return function(_0x5e6b6b){if(_0x5e6b6b){return _0x5e6b6b[_0x25b1('0x28')](_0x246acd)[_0x25b1('0x29')](function(_0xd22469){return _0xd22469;});}return null;};}function removeEntity(_0x282187,_0x1f37ed){return function(_0x1292bf){if(_0x1292bf){return _0x1292bf['destroy']()[_0x25b1('0x29')](function(){var _0x27dd68=_0x1292bf[_0x25b1('0x2a')]({'plain':!![]});var _0x5bc8fc=_0x25b1('0x2b');return db[_0x25b1('0x2c')][_0x25b1('0x2d')]({'where':{'type':_0x5bc8fc,'resourceId':_0x27dd68['id']}})['then'](function(){return _0x1292bf;});})[_0x25b1('0x29')](function(){_0x282187['status'](0xcc)[_0x25b1('0x20')]();});}};}function handleEntityNotFound(_0x3febb8,_0x3a4475){return function(_0x293413){if(!_0x293413){_0x3febb8[_0x25b1('0x1e')](0x194);}return _0x293413;};}function handleError(_0x300a14,_0x46e429){_0x46e429=_0x46e429||0x1f4;return function(_0x4cd825){logger[_0x25b1('0x2e')](_0x4cd825[_0x25b1('0x2f')]);if(_0x4cd825[_0x25b1('0x30')]){delete _0x4cd825[_0x25b1('0x30')];}_0x300a14[_0x25b1('0x1f')](_0x46e429)['send'](_0x4cd825);};}exports[_0x25b1('0x31')]=function(_0x548dd0,_0x42441d){var _0x1622e8={},_0x1e1796={},_0x5a4234={'count':0x0,'rows':[]};var _0x5cbde5=_[_0x25b1('0x32')](db['VoicePrefix'][_0x25b1('0x33')],function(_0x391713){return{'name':_0x391713[_0x25b1('0x34')],'type':_0x391713['type']['key']};});_0x1e1796[_0x25b1('0x35')]=_[_0x25b1('0x32')](_0x5cbde5,_0x25b1('0x30'));_0x1e1796['query']=_[_0x25b1('0x36')](_0x548dd0[_0x25b1('0x37')]);_0x1e1796[_0x25b1('0x38')]=_[_0x25b1('0x39')](_0x1e1796['model'],_0x1e1796[_0x25b1('0x37')]);_0x1622e8[_0x25b1('0x3a')]=_[_0x25b1('0x39')](_0x1e1796['model'],qs['fields'](_0x548dd0[_0x25b1('0x37')]['fields']));_0x1622e8[_0x25b1('0x3a')]=_0x1622e8[_0x25b1('0x3a')][_0x25b1('0x3b')]?_0x1622e8[_0x25b1('0x3a')]:_0x1e1796[_0x25b1('0x35')];if(!_0x548dd0[_0x25b1('0x37')][_0x25b1('0x3c')](_0x25b1('0x3d'))){_0x1622e8[_0x25b1('0x24')]=qs[_0x25b1('0x24')](_0x548dd0[_0x25b1('0x37')][_0x25b1('0x24')]);_0x1622e8[_0x25b1('0x22')]=qs[_0x25b1('0x22')](_0x548dd0[_0x25b1('0x37')]['offset']);}_0x1622e8[_0x25b1('0x3e')]=qs[_0x25b1('0x3f')](_0x548dd0['query'][_0x25b1('0x3f')]);_0x1622e8[_0x25b1('0x40')]=qs[_0x25b1('0x38')](_[_0x25b1('0x41')](_0x548dd0[_0x25b1('0x37')],_0x1e1796['filters']),_0x5cbde5);if(_0x548dd0[_0x25b1('0x37')]['filter']){_0x1622e8[_0x25b1('0x40')]=_['merge'](_0x1622e8[_0x25b1('0x40')],{'$or':_[_0x25b1('0x32')](_0x5cbde5,function(_0x1b354e){if(_0x1b354e[_0x25b1('0x42')]!==_0x25b1('0x43')){var _0x45713f={};_0x45713f[_0x1b354e[_0x25b1('0x30')]]={'$like':'%'+_0x548dd0[_0x25b1('0x37')][_0x25b1('0x44')]+'%'};return _0x45713f;}})});}_0x1622e8=_['merge']({},_0x1622e8,_0x548dd0[_0x25b1('0x45')]);var _0x585c37={'where':_0x1622e8[_0x25b1('0x40')]};return db[_0x25b1('0x46')]['count'](_0x585c37)[_0x25b1('0x29')](function(_0x39b4c7){_0x5a4234[_0x25b1('0x25')]=_0x39b4c7;if(_0x548dd0[_0x25b1('0x37')][_0x25b1('0x47')]){_0x1622e8[_0x25b1('0x48')]=[{'all':!![]}];}return db[_0x25b1('0x46')][_0x25b1('0x49')](_0x1622e8);})[_0x25b1('0x29')](function(_0x453352){_0x5a4234[_0x25b1('0x4a')]=_0x453352;return _0x5a4234;})[_0x25b1('0x29')](respondWithFilteredResult(_0x42441d,_0x1622e8))[_0x25b1('0x4b')](handleError(_0x42441d,null));};exports[_0x25b1('0x4c')]=function(_0x21242a,_0x210cef){var _0x103953={'raw':![],'where':{'id':_0x21242a['params']['id']}},_0x210a13={};_0x210a13['model']=_['keys'](db[_0x25b1('0x46')]['rawAttributes']);_0x210a13[_0x25b1('0x37')]=_['keys'](_0x21242a[_0x25b1('0x37')]);_0x210a13[_0x25b1('0x38')]=_[_0x25b1('0x39')](_0x210a13[_0x25b1('0x35')],_0x210a13[_0x25b1('0x37')]);_0x103953[_0x25b1('0x3a')]=_['intersection'](_0x210a13[_0x25b1('0x35')],qs[_0x25b1('0x4d')](_0x21242a[_0x25b1('0x37')][_0x25b1('0x4d')]));_0x103953['attributes']=_0x103953[_0x25b1('0x3a')][_0x25b1('0x3b')]?_0x103953[_0x25b1('0x3a')]:_0x210a13['model'];if(_0x21242a[_0x25b1('0x37')]['includeAll']){_0x103953[_0x25b1('0x48')]=[{'all':!![]}];}_0x103953=_['merge']({},_0x103953,_0x21242a['options']);return db[_0x25b1('0x46')][_0x25b1('0x4e')](_0x103953)[_0x25b1('0x29')](handleEntityNotFound(_0x210cef,null))[_0x25b1('0x29')](respondWithResult(_0x210cef,null))['catch'](handleError(_0x210cef,null));};exports[_0x25b1('0x2d')]=function(_0x58e612,_0x7c30da){return db['VoicePrefix'][_0x25b1('0x4e')]({'where':{'id':_0x58e612[_0x25b1('0x4f')]['id']}})[_0x25b1('0x29')](handleEntityNotFound(_0x7c30da,null))['then'](removeEntity(_0x7c30da,null))[_0x25b1('0x4b')](handleError(_0x7c30da,null));};exports[_0x25b1('0x50')]=function(_0x354294,_0xf38a9e){return db[_0x25b1('0x46')][_0x25b1('0x50')]()['then'](respondWithResult(_0xf38a9e,null))[_0x25b1('0x4b')](handleError(_0xf38a9e,null));};exports[_0x25b1('0x51')]=function(_0x168931,_0x2311da){var _0x5e367;return db[_0x25b1('0x52')][_0x25b1('0x53')](function(_0x40d574){return db[_0x25b1('0x46')][_0x25b1('0x51')](_0x168931[_0x25b1('0x54')],{'transaction':_0x40d574})[_0x25b1('0x29')](function(_0x4190a1){_0x5e367=_0x4190a1[_0x25b1('0x2a')]({'plain':!![]});return db[_0x25b1('0x55')][_0x25b1('0x4e')]({'where':{'id':_0x5e367[_0x25b1('0x56')]},'raw':!![]})[_0x25b1('0x29')](function(_0x5732a1){return createVoicePrefixExtensions(_0x5e367,_0x5732a1,_0x40d574);});});})[_0x25b1('0x29')](function(){var _0x16e61e=_0x168931[_0x25b1('0x57')][_0x25b1('0x2a')]({'plain':!![]});if(!_0x16e61e)throw new Error(_0x25b1('0x58'));if(_0x16e61e[_0x25b1('0x59')]==='user'){var _0x105587=_0x5e367;return db[_0x25b1('0x5a')][_0x25b1('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x16e61e[_0x25b1('0x5b')]},'raw':!![]})['then'](function(_0x5bd36b){if(_0x5bd36b&&_0x5bd36b['autoAssociation']===0x0){return db['UserProfileResource'][_0x25b1('0x51')]({'name':_0x105587['name'],'resourceId':_0x105587['id'],'type':_0x5bd36b[_0x25b1('0x30')],'sectionId':_0x5bd36b['id']},{})[_0x25b1('0x29')](function(){return _0x5e367;});}else{return _0x5e367;}})[_0x25b1('0x4b')](function(_0x439bab){logger[_0x25b1('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x439bab);throw _0x439bab;});}return _0x5e367;})[_0x25b1('0x29')](respondWithResult(_0x2311da,null))[_0x25b1('0x4b')](handleError(_0x2311da,null));};function Extension(_0x37b58d,_0x400ec9,_0x5ecc36,_0xcca343){this[_0x25b1('0x5c')]=_0x25b1('0x5d');this[_0x25b1('0x5e')]=_0x37b58d;this[_0x25b1('0x5f')]=_0x5ecc36;this[_0x25b1('0x42')]='system';this[_0x25b1('0x60')]='Voice\x20Prefix\x20Extension';this[_0x25b1('0x61')]=_0x400ec9;this[_0x25b1('0x62')]=_0xcca343;}function createVoicePrefixExtensions(_0x49052b,_0x42a81f,_0x3d8d33){return new BPromise(function(_0x551bed,_0x1351ea){var _0x303049=new Extension(formatPrefixName(_0x49052b[_0x25b1('0x63')]),0x1,_0x25b1('0x64'),_0x25b1('0x65'));_0x303049[_0x25b1('0x66')]=_0x49052b['id'];return db[_0x25b1('0x55')][_0x25b1('0x51')](_0x303049,{'transaction':_0x3d8d33})['then'](function(_0x6f1b1f){var _0x1e2dcb=_0x6f1b1f[_0x25b1('0x2a')]({'plain':!![]});var _0x1da588=_[_0x25b1('0x32')](addVoicePrefixExtensions(_0x49052b,_0x42a81f),function(_0x2b9223){_0x2b9223[_0x25b1('0x56')]=_0x1e2dcb['id'];_0x2b9223[_0x25b1('0x66')]=_0x49052b['id'];return _0x2b9223;});return db['VoiceExtension'][_0x25b1('0x67')](_0x1da588,{'transaction':_0x3d8d33})[_0x25b1('0x29')](function(_0x51f922){if(!_0x51f922){return _0x1351ea(_0x25b1('0x68'));}else{return _0x551bed(_0x51f922);}})[_0x25b1('0x4b')](function(_0x5b71e5){return _0x1351ea(_0x5b71e5);});});;});};function addVoicePrefixExtensions(_0x26e90c,_0x498aca){var _0x44aa87=[];var _0x4e62b5=formatPrefixName(_0x26e90c[_0x25b1('0x63')]);_0x44aa87['push'](new Extension(_0x4e62b5,0x2,_0x25b1('0x69'),_0x25b1('0x6a')+_0x26e90c[_0x25b1('0x30')]));if(_0x26e90c['callerIdAll']){_0x44aa87['push'](new Extension(_0x4e62b5,0x3,_0x25b1('0x69'),_0x25b1('0x6b')+_0x26e90c[_0x25b1('0x6c')]));}else{_0x44aa87[_0x25b1('0x6d')](new Extension(_0x4e62b5,0x3,_0x25b1('0x64'),_0x25b1('0x6e')));}_0x44aa87[_0x25b1('0x6d')](new Extension(_0x4e62b5,0x4,_0x25b1('0x6f'),_0x498aca[_0x25b1('0x5c')]+','+_0x25b1('0x70')+(0x8+_0x26e90c[_0x25b1('0x30')][_0x25b1('0x3b')])+'}'+','+0x1));return _0x44aa87;}function formatPrefixName(_0x3d06ab){var _0x975b85='_';for(var _0x1c22c4=0x0;_0x1c22c4<_0x3d06ab[_0x25b1('0x3b')];_0x1c22c4++){if(_0x3d06ab[_0x25b1('0x71')](_0x1c22c4)=='-'){_0x975b85+=_0x3d06ab[_0x25b1('0x71')](_0x1c22c4);}else{_0x975b85+='['+_0x3d06ab[_0x25b1('0x71')](_0x1c22c4)+']';}}_0x975b85+='.';return _0x975b85;}exports[_0x25b1('0x28')]=function(_0x15272b,_0x2fe4a5,_0x584499){var _0x1a3368=_0x15272b['body'];_0x1a3368[_0x25b1('0x63')]=_0x25b1('0x72')+_0x1a3368[_0x25b1('0x30')]+'-';return db['sequelize']['transaction'](function(_0x3f9ca7){return db[_0x25b1('0x46')]['update'](_0x1a3368,{'where':{'id':_0x1a3368['id']},'transaction':_0x3f9ca7})[_0x25b1('0x29')](function(){return db[_0x25b1('0x55')][_0x25b1('0x2d')]({'where':{'VoicePrefixId':_0x1a3368['id']},'transaction':_0x3f9ca7})['then'](function(){return db[_0x25b1('0x55')][_0x25b1('0x4e')]({'where':{'id':_0x1a3368[_0x25b1('0x56')]},'raw':!![]})[_0x25b1('0x29')](function(_0x5f1fef){return createVoicePrefixExtensions(_0x1a3368,_0x5f1fef,_0x3f9ca7);});});});})[_0x25b1('0x29')](function(){return db[_0x25b1('0x46')][_0x25b1('0x73')](_0x1a3368['id']);})[_0x25b1('0x29')](respondWithResult(_0x2fe4a5,null))[_0x25b1('0x4b')](handleError(_0x2fe4a5,null));};exports[_0x25b1('0x74')]=function(_0x4a9fbf,_0x40400e,_0x3f77e0){return db['VoicePrefix']['find']({'where':{'id':_0x4a9fbf[_0x25b1('0x4f')]['id']}})[_0x25b1('0x29')](handleEntityNotFound(_0x40400e,null))[_0x25b1('0x29')](function(_0x3ff99d){if(_0x3ff99d){return _0x3ff99d[_0x25b1('0x74')](_0x4a9fbf[_0x25b1('0x54')][_0x25b1('0x75')],_['omit'](_0x4a9fbf[_0x25b1('0x54')],[_0x25b1('0x75'),'id'])||{})[_0x25b1('0x76')](function(_0x49fac2){for(var _0x1bbb9b=0x0;_0x1bbb9b<_0x4a9fbf[_0x25b1('0x54')][_0x25b1('0x75')]['length'];_0x1bbb9b+=0x1){socket[_0x25b1('0x77')](_0x25b1('0x78'),{'UserId':Number(_0x4a9fbf[_0x25b1('0x54')][_0x25b1('0x75')][_0x1bbb9b]),'VoicePrefixId':Number(_0x4a9fbf[_0x25b1('0x4f')]['id'])});}return _0x49fac2;});}})[_0x25b1('0x29')](respondWithResult(_0x40400e,null))[_0x25b1('0x4b')](handleError(_0x40400e,null));};exports[_0x25b1('0x79')]=function(_0x1a07cb,_0x18021f,_0x20b43f){return db['VoicePrefix'][_0x25b1('0x4e')]({'where':{'id':_0x1a07cb[_0x25b1('0x4f')]['id']}})['then'](handleEntityNotFound(_0x18021f,null))[_0x25b1('0x29')](function(_0x45804b){if(_0x45804b){return _0x45804b[_0x25b1('0x79')](_0x1a07cb[_0x25b1('0x37')][_0x25b1('0x75')])['then'](function(){if(_['isArray'](_0x1a07cb[_0x25b1('0x37')]['ids'])){for(var _0x3e7f2b=0x0;_0x3e7f2b<_0x1a07cb[_0x25b1('0x37')][_0x25b1('0x75')][_0x25b1('0x3b')];_0x3e7f2b+=0x1){socket[_0x25b1('0x77')](_0x25b1('0x7a'),{'UserId':Number(_0x1a07cb['query'][_0x25b1('0x75')][_0x3e7f2b]),'VoicePrefixId':Number(_0x1a07cb[_0x25b1('0x4f')]['id'])});}}else{socket[_0x25b1('0x77')](_0x25b1('0x7a'),{'UserId':Number(_0x1a07cb['query']['ids']),'VoicePrefixId':Number(_0x1a07cb['params']['id'])});}});}})[_0x25b1('0x29')](respondWithStatusCode(_0x18021f,null))[_0x25b1('0x4b')](handleError(_0x18021f,null));};exports['getAgents']=function(_0x49c2d3,_0x271837,_0x102b85){var _0x6bbd44={};var _0x67a4b7={};var _0x54e1a6;var _0x10409f;return db[_0x25b1('0x46')][_0x25b1('0x7b')]({'where':{'id':_0x49c2d3[_0x25b1('0x4f')]['id']}})[_0x25b1('0x29')](handleEntityNotFound(_0x271837,null))[_0x25b1('0x29')](function(_0x175c72){if(_0x175c72){_0x54e1a6=_0x175c72;_0x67a4b7[_0x25b1('0x35')]=_['keys'](db['User'][_0x25b1('0x33')]);_0x67a4b7[_0x25b1('0x37')]=_['keys'](_0x49c2d3['query']);_0x67a4b7[_0x25b1('0x38')]=_[_0x25b1('0x39')](_0x67a4b7['model'],_0x67a4b7[_0x25b1('0x37')]);_0x6bbd44[_0x25b1('0x3a')]=_[_0x25b1('0x39')](_0x67a4b7[_0x25b1('0x35')],qs[_0x25b1('0x4d')](_0x49c2d3[_0x25b1('0x37')][_0x25b1('0x4d')]));_0x6bbd44['attributes']=_0x6bbd44[_0x25b1('0x3a')][_0x25b1('0x3b')]?_0x6bbd44[_0x25b1('0x3a')]:_0x67a4b7['model'];_0x6bbd44['order']=qs['sort'](_0x49c2d3[_0x25b1('0x37')][_0x25b1('0x3f')]);_0x6bbd44[_0x25b1('0x40')]=qs['filters'](_['pick'](_0x49c2d3[_0x25b1('0x37')],_0x67a4b7[_0x25b1('0x38')]));if(_0x49c2d3[_0x25b1('0x37')][_0x25b1('0x44')]){_0x6bbd44[_0x25b1('0x40')]=_[_0x25b1('0x7c')](_0x6bbd44[_0x25b1('0x40')],{'$or':_[_0x25b1('0x32')](_0x6bbd44[_0x25b1('0x3a')],function(_0x4c74f8){var _0xb7494b={};_0xb7494b[_0x4c74f8]={'$like':'%'+_0x49c2d3[_0x25b1('0x37')]['filter']+'%'};return _0xb7494b;})});}_0x6bbd44=_['merge']({},_0x6bbd44,_0x49c2d3[_0x25b1('0x45')]);return _0x54e1a6['getAgents'](_0x6bbd44);}})[_0x25b1('0x29')](function(_0x133a5d){if(_0x133a5d){_0x10409f=_0x133a5d[_0x25b1('0x3b')];if(!_0x49c2d3['query']['hasOwnProperty']('nolimit')){_0x6bbd44[_0x25b1('0x24')]=qs[_0x25b1('0x24')](_0x49c2d3['query'][_0x25b1('0x24')]);_0x6bbd44[_0x25b1('0x22')]=qs[_0x25b1('0x22')](_0x49c2d3[_0x25b1('0x37')][_0x25b1('0x22')]);}return _0x54e1a6['getAgents'](_0x6bbd44);}})[_0x25b1('0x29')](function(_0x954de5){if(_0x954de5){return _0x954de5?{'count':_0x10409f,'rows':_0x954de5}:null;}})['then'](respondWithResult(_0x271837,null))[_0x25b1('0x4b')](handleError(_0x271837,null));};exports['getTeams']=function(_0x198561,_0x4c2b9f,_0x5c7849){var _0x92b5d6={};var _0x1958c0={};var _0x4428d2;var _0x12e63d;return db[_0x25b1('0x46')]['findOne']({'where':{'id':_0x198561['params']['id']}})[_0x25b1('0x29')](handleEntityNotFound(_0x4c2b9f,null))['then'](function(_0x2890c1){if(_0x2890c1){_0x4428d2=_0x2890c1;_0x1958c0[_0x25b1('0x35')]=_[_0x25b1('0x36')](db['Team'][_0x25b1('0x33')]);_0x1958c0['query']=_['keys'](_0x198561['query']);_0x1958c0[_0x25b1('0x38')]=_['intersection'](_0x1958c0[_0x25b1('0x35')],_0x1958c0[_0x25b1('0x37')]);_0x92b5d6[_0x25b1('0x3a')]=_[_0x25b1('0x39')](_0x1958c0[_0x25b1('0x35')],qs[_0x25b1('0x4d')](_0x198561[_0x25b1('0x37')][_0x25b1('0x4d')]));_0x92b5d6[_0x25b1('0x3a')]=_0x92b5d6[_0x25b1('0x3a')][_0x25b1('0x3b')]?_0x92b5d6[_0x25b1('0x3a')]:_0x1958c0[_0x25b1('0x35')];_0x92b5d6[_0x25b1('0x3e')]=qs[_0x25b1('0x3f')](_0x198561[_0x25b1('0x37')][_0x25b1('0x3f')]);_0x92b5d6['where']=qs[_0x25b1('0x38')](_['pick'](_0x198561[_0x25b1('0x37')],_0x1958c0[_0x25b1('0x38')]));if(_0x198561[_0x25b1('0x37')][_0x25b1('0x44')]){_0x92b5d6[_0x25b1('0x40')]=_['merge'](_0x92b5d6[_0x25b1('0x40')],{'$or':_[_0x25b1('0x32')](_0x92b5d6[_0x25b1('0x3a')],function(_0x5af2b6){var _0x339e82={};_0x339e82[_0x5af2b6]={'$like':'%'+_0x198561[_0x25b1('0x37')][_0x25b1('0x44')]+'%'};return _0x339e82;})});}_0x92b5d6=_[_0x25b1('0x7c')]({},_0x92b5d6,_0x198561['options']);return _0x4428d2[_0x25b1('0x7d')](_0x92b5d6);}})[_0x25b1('0x29')](function(_0x270f00){if(_0x270f00){_0x12e63d=_0x270f00['length'];if(!_0x198561[_0x25b1('0x37')][_0x25b1('0x3c')](_0x25b1('0x3d'))){_0x92b5d6['limit']=qs[_0x25b1('0x24')](_0x198561[_0x25b1('0x37')]['limit']);_0x92b5d6[_0x25b1('0x22')]=qs[_0x25b1('0x22')](_0x198561['query'][_0x25b1('0x22')]);}return _0x4428d2[_0x25b1('0x7d')](_0x92b5d6);}})[_0x25b1('0x29')](function(_0x14b909){if(_0x14b909){return _0x14b909?{'count':_0x12e63d,'rows':_0x14b909}:null;}})[_0x25b1('0x29')](respondWithResult(_0x4c2b9f,null))[_0x25b1('0x4b')](handleError(_0x4c2b9f,null));};exports['addTeams']=function(_0x3496a9,_0x30f1e9,_0x18211a){var _0x3038be=_0x3496a9[_0x25b1('0x54')][_0x25b1('0x75')];var _0x310a32;return db[_0x25b1('0x7e')][_0x25b1('0x49')]({'where':{'id':_0x3038be},'attributes':['id'],'include':[{'model':db[_0x25b1('0x7f')],'as':'Agents','attributes':['id',_0x25b1('0x30'),_0x25b1('0x80'),'voicePause','interface'],'raw':!![]}]})[_0x25b1('0x29')](function(_0x96a1b0){if(_0x96a1b0){_0x310a32=_0x96a1b0;var _0x2db4a9=_[_0x25b1('0x81')](_0x96a1b0,function(_0x58e166){var _0x4c6181=_0x58e166['get']({'plain':!![]});return _0x4c6181[_0x25b1('0x82')];});return db[_0x25b1('0x46')][_0x25b1('0x4e')]({'where':{'id':_0x3496a9['params']['id']}})['then'](function(_0x16702d){return db[_0x25b1('0x52')][_0x25b1('0x53')](function(_0x55f740){return _0x16702d[_0x25b1('0x83')](_0x3038be,{'transaction':_0x55f740})[_0x25b1('0x29')](function(){return BPromise[_0x25b1('0x84')](_0x310a32,function(_0x2da0d9){return db[_0x25b1('0x85')][_0x25b1('0x86')]({'TeamId':_0x2da0d9['id'],'VoicePrefixId':_0x3496a9[_0x25b1('0x4f')]['id']},{'transaction':_0x55f740});});})[_0x25b1('0x29')](function(){return BPromise[_0x25b1('0x84')](_0x2db4a9,function(_0x5c515b){return db[_0x25b1('0x87')][_0x25b1('0x88')]({'where':{'UserId':_0x5c515b['id'],'VoicePrefixId':_0x3496a9[_0x25b1('0x4f')]['id']},'transaction':_0x55f740});});})[_0x25b1('0x29')](function(){_0x2db4a9[_0x25b1('0x89')](function(_0x3c8c4e){socket[_0x25b1('0x77')]('userVoicePrefix:save',{'UserId':_0x3c8c4e['id'],'VoicePrefixId':_0x16702d['id']});});});});});}})[_0x25b1('0x29')](respondWithStatusCode(_0x30f1e9,null))['catch'](handleError(_0x30f1e9,null));};exports[_0x25b1('0x8a')]=function(_0x469405,_0x1010c4,_0x22d3e4){return db['Team']['findAll']({'where':{'id':_0x469405[_0x25b1('0x37')][_0x25b1('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1010c4,null))[_0x25b1('0x29')](function(_0xd05872){var _0x25c07f=_[_0x25b1('0x32')](_0xd05872,'id');var _0x1041d1=[];var _0x1f1160=[];var _0x29d8fe=squel[_0x25b1('0x8b')]();_0x29d8fe[_0x25b1('0x8c')](_0x25b1('0x8d'))[_0x25b1('0x8e')](_0x25b1('0x8f'),'tq')['join'](_0x25b1('0x90'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x25b1('0x40')](_0x25b1('0x91'),_0x469405[_0x25b1('0x4f')]['id']);for(var _0x1354c3=0x0;_0x1354c3<_0xd05872[_0x25b1('0x3b')];_0x1354c3+=0x1){let _0x3ccdab=_0xd05872[_0x1354c3];for(var _0x381a62=0x0;_0x381a62<_0x3ccdab[_0x25b1('0x82')]['length'];_0x381a62+=0x1){let _0x330ae7=_0x3ccdab[_0x25b1('0x82')][_0x381a62];var _0xbe6572=_0x29d8fe[_0x25b1('0x92')]();_0xbe6572[_0x25b1('0x40')](_0x25b1('0x93'),_0x330ae7['id']);_0x1f1160[_0x25b1('0x6d')](db['sequelize'][_0x25b1('0x37')](_0xbe6572[_0x25b1('0x94')](),{'type':db[_0x25b1('0x52')][_0x25b1('0x95')][_0x25b1('0x96')]})['then'](function(_0x4edb48){if(_0x4edb48[_0x25b1('0x3b')]===0x1){return _0x330ae7['id'];}else{var _0x2e924b=_['every'](_['map'](_0x4edb48,_0x25b1('0x97')),function(_0x16d969){return _[_0x25b1('0x98')](_0x25c07f,_0x16d969);});if(_0x2e924b){return _0x330ae7['id'];}}}));}}return BPromise[_0x25b1('0x99')](_0x1f1160)[_0x25b1('0x29')](function(_0x3128bd){_0x1041d1=_(_0x1041d1)[_0x25b1('0x9a')](_0x3128bd)[_0x25b1('0x9b')]()['value']();return db[_0x25b1('0x46')]['find']({'where':{'id':_0x469405['params']['id']}})[_0x25b1('0x29')](function(_0x4cf3e6){return db[_0x25b1('0x52')][_0x25b1('0x53')](function(_0x2c0147){return _0x4cf3e6[_0x25b1('0x8a')](_0x469405[_0x25b1('0x37')][_0x25b1('0x75')],{'transaction':_0x2c0147})[_0x25b1('0x29')](function(){if(!_['isEmpty'](_0x1041d1)){return _0x4cf3e6[_0x25b1('0x79')](_0x1041d1,{'transaction':_0x2c0147});}})[_0x25b1('0x29')](function(){_0x1041d1[_0x25b1('0x89')](function(_0x220f92){socket[_0x25b1('0x77')](_0x25b1('0x7a'),{'UserId':_0x220f92,'VoicePrefixId':_0x4cf3e6['id']});});});});});});})[_0x25b1('0x29')](respondWithStatusCode(_0x1010c4,null))[_0x25b1('0x4b')](handleError(_0x1010c4,null));}; \ No newline at end of file +var _0x2032=['sequelize','body','VoiceExtension','user','VoicePrefixes','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','goto','charAt','system-','transaction','findById','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','sort','nolimit','Team','getTeams','addTeams','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','upsert','findOrCreate','forEach','userVoicePrefix:save','removeTeams','User','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','sendStatus','status','end','offset','limit','count','set','json','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','describe','create'];(function(_0x292a00,_0x46b033){var _0x3e9fa8=function(_0x438446){while(--_0x438446){_0x292a00['push'](_0x292a00['shift']());}};_0x3e9fa8(++_0x46b033);}(_0x2032,0xd9));var _0x2203=function(_0x1ab917,_0x5021e7){_0x1ab917=_0x1ab917-0x0;var _0x1dfdca=_0x2032[_0x1ab917];return _0x1dfdca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2203('0x18')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x21a3af,_0x472265){_0x472265=_0x472265||0xcc;return function(_0x1c1ead){if(_0x1c1ead){return _0x21a3af[_0x2203('0x19')](_0x472265);}return _0x21a3af[_0x2203('0x1a')](_0x472265)[_0x2203('0x1b')]();};}function respondWithResult(_0x2c36e6,_0x2c085c){_0x2c085c=_0x2c085c||0xc8;return function(_0xdf9d0b){if(_0xdf9d0b){return _0x2c36e6[_0x2203('0x1a')](_0x2c085c)['json'](_0xdf9d0b);}};}function respondWithFilteredResult(_0x280eda,_0x2ee127){return function(_0x4893ff){if(_0x4893ff){var _0x3f9ef6=typeof _0x2ee127[_0x2203('0x1c')]==='undefined'&&typeof _0x2ee127[_0x2203('0x1d')]==='undefined';var _0x2904ba=_0x4893ff[_0x2203('0x1e')];var _0x3c8c34=_0x3f9ef6?0x0:_0x2ee127[_0x2203('0x1c')];var _0x15cb1a=_0x3f9ef6?_0x4893ff[_0x2203('0x1e')]:_0x2ee127['offset']+_0x2ee127[_0x2203('0x1d')];var _0x50822b;if(_0x15cb1a>=_0x2904ba){_0x15cb1a=_0x2904ba;_0x50822b=0xc8;}else{_0x50822b=0xce;}_0x280eda['status'](_0x50822b);return _0x280eda[_0x2203('0x1f')]('Content-Range',_0x3c8c34+'-'+_0x15cb1a+'/'+_0x2904ba)[_0x2203('0x20')](_0x4893ff);}return null;};}function patchUpdates(_0x5bfe61){return function(_0x5d4c4e){try{jsonpatch[_0x2203('0x21')](_0x5d4c4e,_0x5bfe61,!![]);}catch(_0x5e29cd){return BPromise['reject'](_0x5e29cd);}return _0x5d4c4e[_0x2203('0x22')]();};}function saveUpdates(_0x2718f5,_0x21f930){return function(_0xfd0970){if(_0xfd0970){return _0xfd0970[_0x2203('0x23')](_0x2718f5)[_0x2203('0x24')](function(_0x49c12){return _0x49c12;});}return null;};}function removeEntity(_0x250349,_0x576378){return function(_0x143f41){if(_0x143f41){return _0x143f41[_0x2203('0x25')]()[_0x2203('0x24')](function(){var _0x5f11bf=_0x143f41[_0x2203('0x26')]({'plain':!![]});var _0x1cec17='VoicePrefixes';return db[_0x2203('0x27')][_0x2203('0x25')]({'where':{'type':_0x1cec17,'resourceId':_0x5f11bf['id']}})[_0x2203('0x24')](function(){return _0x143f41;});})[_0x2203('0x24')](function(){_0x250349[_0x2203('0x1a')](0xcc)[_0x2203('0x1b')]();});}};}function handleEntityNotFound(_0x9c53f,_0x5a95c1){return function(_0x34b8ba){if(!_0x34b8ba){_0x9c53f[_0x2203('0x19')](0x194);}return _0x34b8ba;};}function handleError(_0x406ce9,_0x74f035){_0x74f035=_0x74f035||0x1f4;return function(_0x52a426){logger[_0x2203('0x28')](_0x52a426[_0x2203('0x29')]);if(_0x52a426[_0x2203('0x2a')]){delete _0x52a426[_0x2203('0x2a')];}_0x406ce9['status'](_0x74f035)[_0x2203('0x2b')](_0x52a426);};}exports[_0x2203('0x2c')]=function(_0x5e6560,_0x5c0157){var _0x1d5f74={},_0x52fafc={},_0x58b44d={'count':0x0,'rows':[]};var _0x125dfc=_[_0x2203('0x2d')](db[_0x2203('0x2e')][_0x2203('0x2f')],function(_0xf2801d){return{'name':_0xf2801d['fieldName'],'type':_0xf2801d[_0x2203('0x30')][_0x2203('0x31')]};});_0x52fafc['model']=_[_0x2203('0x2d')](_0x125dfc,_0x2203('0x2a'));_0x52fafc[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5e6560[_0x2203('0x32')]);_0x52fafc[_0x2203('0x34')]=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],_0x52fafc[_0x2203('0x32')]);_0x1d5f74['attributes']=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],qs['fields'](_0x5e6560['query'][_0x2203('0x37')]));_0x1d5f74['attributes']=_0x1d5f74[_0x2203('0x38')][_0x2203('0x39')]?_0x1d5f74[_0x2203('0x38')]:_0x52fafc['model'];if(!_0x5e6560['query'][_0x2203('0x3a')]('nolimit')){_0x1d5f74[_0x2203('0x1d')]=qs['limit'](_0x5e6560[_0x2203('0x32')]['limit']);_0x1d5f74[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x5e6560[_0x2203('0x32')][_0x2203('0x1c')]);}_0x1d5f74[_0x2203('0x3b')]=qs['sort'](_0x5e6560['query']['sort']);_0x1d5f74[_0x2203('0x3c')]=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x5e6560[_0x2203('0x32')],_0x52fafc[_0x2203('0x34')]),_0x125dfc);if(_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]){_0x1d5f74['where']=_[_0x2203('0x3f')](_0x1d5f74[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x125dfc,function(_0x26be74){if(_0x26be74['type']!=='VIRTUAL'){var _0x3ddfe0={};_0x3ddfe0[_0x26be74['name']]={'$like':'%'+_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3ddfe0;}})});}_0x1d5f74=_[_0x2203('0x3f')]({},_0x1d5f74,_0x5e6560['options']);var _0x5bba52={'where':_0x1d5f74[_0x2203('0x3c')]};return db[_0x2203('0x2e')][_0x2203('0x1e')](_0x5bba52)[_0x2203('0x24')](function(_0x372709){_0x58b44d[_0x2203('0x1e')]=_0x372709;if(_0x5e6560['query'][_0x2203('0x40')]){_0x1d5f74[_0x2203('0x41')]=[{'all':!![]}];}return db[_0x2203('0x2e')][_0x2203('0x42')](_0x1d5f74);})[_0x2203('0x24')](function(_0x36b99f){_0x58b44d[_0x2203('0x43')]=_0x36b99f;return _0x58b44d;})[_0x2203('0x24')](respondWithFilteredResult(_0x5c0157,_0x1d5f74))[_0x2203('0x44')](handleError(_0x5c0157,null));};exports[_0x2203('0x45')]=function(_0x595281,_0x2e2ca5){var _0x24e773={'raw':![],'where':{'id':_0x595281[_0x2203('0x46')]['id']}},_0x4aab80={};_0x4aab80['model']=_['keys'](db[_0x2203('0x2e')]['rawAttributes']);_0x4aab80[_0x2203('0x32')]=_[_0x2203('0x33')](_0x595281[_0x2203('0x32')]);_0x4aab80[_0x2203('0x34')]=_['intersection'](_0x4aab80[_0x2203('0x36')],_0x4aab80[_0x2203('0x32')]);_0x24e773['attributes']=_[_0x2203('0x35')](_0x4aab80[_0x2203('0x36')],qs[_0x2203('0x37')](_0x595281[_0x2203('0x32')]['fields']));_0x24e773['attributes']=_0x24e773[_0x2203('0x38')]['length']?_0x24e773['attributes']:_0x4aab80[_0x2203('0x36')];if(_0x595281[_0x2203('0x32')][_0x2203('0x40')]){_0x24e773['include']=[{'all':!![]}];}_0x24e773=_['merge']({},_0x24e773,_0x595281[_0x2203('0x47')]);return db[_0x2203('0x2e')][_0x2203('0x48')](_0x24e773)[_0x2203('0x24')](handleEntityNotFound(_0x2e2ca5,null))[_0x2203('0x24')](respondWithResult(_0x2e2ca5,null))[_0x2203('0x44')](handleError(_0x2e2ca5,null));};exports['destroy']=function(_0x747dce,_0x557659){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x747dce[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x557659,null))['then'](removeEntity(_0x557659,null))['catch'](handleError(_0x557659,null));};exports[_0x2203('0x49')]=function(_0x1f772d,_0x126aad){return db[_0x2203('0x2e')]['describe']()['then'](respondWithResult(_0x126aad,null))['catch'](handleError(_0x126aad,null));};exports[_0x2203('0x4a')]=function(_0x1c2734,_0x57b891){var _0x7f61df;return db[_0x2203('0x4b')]['transaction'](function(_0x32b1db){return db[_0x2203('0x2e')][_0x2203('0x4a')](_0x1c2734[_0x2203('0x4c')],{'transaction':_0x32b1db})['then'](function(_0x120db1){_0x7f61df=_0x120db1['get']({'plain':!![]});return db[_0x2203('0x4d')][_0x2203('0x48')]({'where':{'id':_0x7f61df['VoiceExtensionId']},'raw':!![]})[_0x2203('0x24')](function(_0x8d089e){return createVoicePrefixExtensions(_0x7f61df,_0x8d089e,_0x32b1db);});});})[_0x2203('0x24')](function(){var _0x378132=_0x1c2734[_0x2203('0x4e')][_0x2203('0x26')]({'plain':!![]});if(!_0x378132)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x378132['role']===_0x2203('0x4e')){var _0x524356=_0x7f61df;return db['UserProfileSection'][_0x2203('0x48')]({'where':{'name':_0x2203('0x4f'),'userProfileId':_0x378132[_0x2203('0x50')]},'raw':!![]})['then'](function(_0x213c24){if(_0x213c24&&_0x213c24['autoAssociation']===0x0){return db['UserProfileResource'][_0x2203('0x4a')]({'name':_0x524356['name'],'resourceId':_0x524356['id'],'type':_0x213c24['name'],'sectionId':_0x213c24['id']},{})['then'](function(){return _0x7f61df;});}else{return _0x7f61df;}})[_0x2203('0x44')](function(_0x31256b){logger[_0x2203('0x28')](_0x2203('0x51'),_0x31256b);throw _0x31256b;});}return _0x7f61df;})[_0x2203('0x24')](respondWithResult(_0x57b891,null))[_0x2203('0x44')](handleError(_0x57b891,null));};function Extension(_0x2baea2,_0x91f70c,_0x36b5fb,_0x216641){this[_0x2203('0x52')]=_0x2203('0x53');this['exten']=_0x2baea2;this['app']=_0x36b5fb;this[_0x2203('0x30')]=_0x2203('0x54');this[_0x2203('0x55')]=_0x2203('0x56');this[_0x2203('0x57')]=_0x91f70c;this[_0x2203('0x58')]=_0x216641;}function createVoicePrefixExtensions(_0x4f8b8e,_0x5486f9,_0xb49120){return new BPromise(function(_0x34358e,_0x21ee59){var _0x1e6d21=new Extension(formatPrefixName(_0x4f8b8e[_0x2203('0x59')]),0x1,_0x2203('0x5a'),_0x2203('0x5b'));_0x1e6d21[_0x2203('0x5c')]=_0x4f8b8e['id'];return db[_0x2203('0x4d')][_0x2203('0x4a')](_0x1e6d21,{'transaction':_0xb49120})[_0x2203('0x24')](function(_0x48bed1){var _0x1ea97a=_0x48bed1[_0x2203('0x26')]({'plain':!![]});var _0x3ce9f5=_[_0x2203('0x2d')](addVoicePrefixExtensions(_0x4f8b8e,_0x5486f9),function(_0x41a938){_0x41a938[_0x2203('0x5d')]=_0x1ea97a['id'];_0x41a938[_0x2203('0x5c')]=_0x4f8b8e['id'];return _0x41a938;});return db[_0x2203('0x4d')][_0x2203('0x5e')](_0x3ce9f5,{'transaction':_0xb49120})[_0x2203('0x24')](function(_0x49e795){if(!_0x49e795){return _0x21ee59(_0x2203('0x5f'));}else{return _0x34358e(_0x49e795);}})[_0x2203('0x44')](function(_0x24179a){return _0x21ee59(_0x24179a);});});;});};function addVoicePrefixExtensions(_0xc193b7,_0x34e820){var _0x1e44c=[];var _0x1068bc=formatPrefixName(_0xc193b7[_0x2203('0x59')]);_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x2,'Set',_0x2203('0x61')+_0xc193b7[_0x2203('0x2a')]));if(_0xc193b7[_0x2203('0x62')]){_0x1e44c['push'](new Extension(_0x1068bc,0x3,_0x2203('0x63'),_0x2203('0x64')+_0xc193b7[_0x2203('0x62')]));}else{_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x3,_0x2203('0x5a'),'No\x20callerid\x20available'));}_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x4,_0x2203('0x65'),_0x34e820[_0x2203('0x52')]+','+'${EXTEN:'+(0x8+_0xc193b7['name']['length'])+'}'+','+0x1));return _0x1e44c;}function formatPrefixName(_0x485e5b){var _0x595814='_';for(var _0x418d48=0x0;_0x418d48<_0x485e5b[_0x2203('0x39')];_0x418d48++){if(_0x485e5b[_0x2203('0x66')](_0x418d48)=='-'){_0x595814+=_0x485e5b[_0x2203('0x66')](_0x418d48);}else{_0x595814+='['+_0x485e5b[_0x2203('0x66')](_0x418d48)+']';}}_0x595814+='.';return _0x595814;}exports[_0x2203('0x23')]=function(_0x3f7926,_0x44bea0,_0x56dcbe){var _0x500860=_0x3f7926[_0x2203('0x4c')];_0x500860[_0x2203('0x59')]=_0x2203('0x67')+_0x500860[_0x2203('0x2a')]+'-';return db[_0x2203('0x4b')][_0x2203('0x68')](function(_0x45cc3a){return db[_0x2203('0x2e')][_0x2203('0x23')](_0x500860,{'where':{'id':_0x500860['id']},'transaction':_0x45cc3a})[_0x2203('0x24')](function(){return db[_0x2203('0x4d')][_0x2203('0x25')]({'where':{'VoicePrefixId':_0x500860['id']},'transaction':_0x45cc3a})[_0x2203('0x24')](function(){return db[_0x2203('0x4d')][_0x2203('0x48')]({'where':{'id':_0x500860[_0x2203('0x5d')]},'raw':!![]})[_0x2203('0x24')](function(_0x173ac1){return createVoicePrefixExtensions(_0x500860,_0x173ac1,_0x45cc3a);});});});})[_0x2203('0x24')](function(){return db['VoicePrefix'][_0x2203('0x69')](_0x500860['id']);})['then'](respondWithResult(_0x44bea0,null))[_0x2203('0x44')](handleError(_0x44bea0,null));};exports['addAgents']=function(_0x5ba500,_0xf71e7e,_0x269649){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x5ba500[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0xf71e7e,null))[_0x2203('0x24')](function(_0x4e9a01){if(_0x4e9a01){return _0x4e9a01['addAgents'](_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')],_[_0x2203('0x6b')](_0x5ba500['body'],['ids','id'])||{})['spread'](function(_0xdff006){for(var _0x2d26ba=0x0;_0x2d26ba<_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')]['length'];_0x2d26ba+=0x1){socket[_0x2203('0x6c')]('userVoicePrefix:save',{'UserId':Number(_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')][_0x2d26ba]),'VoicePrefixId':Number(_0x5ba500[_0x2203('0x46')]['id'])});}return _0xdff006;});}})[_0x2203('0x24')](respondWithResult(_0xf71e7e,null))[_0x2203('0x44')](handleError(_0xf71e7e,null));};exports['removeAgents']=function(_0x4592fa,_0x247f26,_0x18663f){return db['VoicePrefix'][_0x2203('0x48')]({'where':{'id':_0x4592fa[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x247f26,null))[_0x2203('0x24')](function(_0x1c65f9){if(_0x1c65f9){return _0x1c65f9[_0x2203('0x6d')](_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')])[_0x2203('0x24')](function(){if(_[_0x2203('0x6e')](_0x4592fa[_0x2203('0x32')]['ids'])){for(var _0x1adfa6=0x0;_0x1adfa6<_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')][_0x2203('0x39')];_0x1adfa6+=0x1){socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':Number(_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')][_0x1adfa6]),'VoicePrefixId':Number(_0x4592fa[_0x2203('0x46')]['id'])});}}else{socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':Number(_0x4592fa[_0x2203('0x32')]['ids']),'VoicePrefixId':Number(_0x4592fa['params']['id'])});}});}})[_0x2203('0x24')](respondWithStatusCode(_0x247f26,null))[_0x2203('0x44')](handleError(_0x247f26,null));};exports[_0x2203('0x70')]=function(_0xb6863b,_0x42dce6,_0x4fd029){var _0x16e518={};var _0x3cb792={};var _0x4e539b;var _0x511689;return db['VoicePrefix']['findOne']({'where':{'id':_0xb6863b['params']['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x42dce6,null))[_0x2203('0x24')](function(_0x437095){if(_0x437095){_0x4e539b=_0x437095;_0x3cb792['model']=_['keys'](db['User'][_0x2203('0x2f')]);_0x3cb792[_0x2203('0x32')]=_[_0x2203('0x33')](_0xb6863b[_0x2203('0x32')]);_0x3cb792[_0x2203('0x34')]=_[_0x2203('0x35')](_0x3cb792[_0x2203('0x36')],_0x3cb792['query']);_0x16e518[_0x2203('0x38')]=_[_0x2203('0x35')](_0x3cb792[_0x2203('0x36')],qs[_0x2203('0x37')](_0xb6863b[_0x2203('0x32')][_0x2203('0x37')]));_0x16e518[_0x2203('0x38')]=_0x16e518['attributes'][_0x2203('0x39')]?_0x16e518['attributes']:_0x3cb792['model'];_0x16e518[_0x2203('0x3b')]=qs['sort'](_0xb6863b[_0x2203('0x32')][_0x2203('0x71')]);_0x16e518['where']=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0xb6863b[_0x2203('0x32')],_0x3cb792[_0x2203('0x34')]));if(_0xb6863b[_0x2203('0x32')][_0x2203('0x3e')]){_0x16e518['where']=_[_0x2203('0x3f')](_0x16e518[_0x2203('0x3c')],{'$or':_['map'](_0x16e518['attributes'],function(_0x377176){var _0x3fe71b={};_0x3fe71b[_0x377176]={'$like':'%'+_0xb6863b[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3fe71b;})});}_0x16e518=_[_0x2203('0x3f')]({},_0x16e518,_0xb6863b[_0x2203('0x47')]);return _0x4e539b[_0x2203('0x70')](_0x16e518);}})[_0x2203('0x24')](function(_0x4749df){if(_0x4749df){_0x511689=_0x4749df[_0x2203('0x39')];if(!_0xb6863b[_0x2203('0x32')][_0x2203('0x3a')](_0x2203('0x72'))){_0x16e518[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0xb6863b[_0x2203('0x32')]['limit']);_0x16e518['offset']=qs[_0x2203('0x1c')](_0xb6863b[_0x2203('0x32')]['offset']);}return _0x4e539b[_0x2203('0x70')](_0x16e518);}})[_0x2203('0x24')](function(_0x5b5e95){if(_0x5b5e95){return _0x5b5e95?{'count':_0x511689,'rows':_0x5b5e95}:null;}})[_0x2203('0x24')](respondWithResult(_0x42dce6,null))[_0x2203('0x44')](handleError(_0x42dce6,null));};exports['getTeams']=function(_0x21f357,_0x10c65a,_0x541639){var _0x318f3f={};var _0x1c4b57={};var _0x3cfe3f;var _0x1596f7;return db['VoicePrefix']['findOne']({'where':{'id':_0x21f357[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x10c65a,null))[_0x2203('0x24')](function(_0x4ff77f){if(_0x4ff77f){_0x3cfe3f=_0x4ff77f;_0x1c4b57['model']=_[_0x2203('0x33')](db[_0x2203('0x73')][_0x2203('0x2f')]);_0x1c4b57['query']=_['keys'](_0x21f357[_0x2203('0x32')]);_0x1c4b57[_0x2203('0x34')]=_['intersection'](_0x1c4b57[_0x2203('0x36')],_0x1c4b57[_0x2203('0x32')]);_0x318f3f['attributes']=_[_0x2203('0x35')](_0x1c4b57['model'],qs[_0x2203('0x37')](_0x21f357['query']['fields']));_0x318f3f['attributes']=_0x318f3f[_0x2203('0x38')][_0x2203('0x39')]?_0x318f3f['attributes']:_0x1c4b57[_0x2203('0x36')];_0x318f3f[_0x2203('0x3b')]=qs[_0x2203('0x71')](_0x21f357['query'][_0x2203('0x71')]);_0x318f3f['where']=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x21f357['query'],_0x1c4b57[_0x2203('0x34')]));if(_0x21f357[_0x2203('0x32')]['filter']){_0x318f3f[_0x2203('0x3c')]=_[_0x2203('0x3f')](_0x318f3f[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x318f3f[_0x2203('0x38')],function(_0x5d73a7){var _0x2ba7d3={};_0x2ba7d3[_0x5d73a7]={'$like':'%'+_0x21f357[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x2ba7d3;})});}_0x318f3f=_[_0x2203('0x3f')]({},_0x318f3f,_0x21f357[_0x2203('0x47')]);return _0x3cfe3f[_0x2203('0x74')](_0x318f3f);}})['then'](function(_0x29b41b){if(_0x29b41b){_0x1596f7=_0x29b41b[_0x2203('0x39')];if(!_0x21f357['query'][_0x2203('0x3a')]('nolimit')){_0x318f3f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x21f357[_0x2203('0x32')]['limit']);_0x318f3f[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x21f357[_0x2203('0x32')][_0x2203('0x1c')]);}return _0x3cfe3f[_0x2203('0x74')](_0x318f3f);}})[_0x2203('0x24')](function(_0x1ccf09){if(_0x1ccf09){return _0x1ccf09?{'count':_0x1596f7,'rows':_0x1ccf09}:null;}})['then'](respondWithResult(_0x10c65a,null))['catch'](handleError(_0x10c65a,null));};exports[_0x2203('0x75')]=function(_0x41eb4c,_0x25996c,_0x4e1f55){var _0x2188d4=_0x41eb4c[_0x2203('0x4c')][_0x2203('0x6a')];var _0x500604;return db[_0x2203('0x73')][_0x2203('0x42')]({'where':{'id':_0x2188d4},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2203('0x76'),'attributes':['id','name',_0x2203('0x77'),_0x2203('0x78'),'interface'],'raw':!![]}]})[_0x2203('0x24')](function(_0x9586e1){if(_0x9586e1){_0x500604=_0x9586e1;var _0x266d7e=_[_0x2203('0x79')](_0x9586e1,function(_0x34a160){var _0x36ab7f=_0x34a160[_0x2203('0x26')]({'plain':!![]});return _0x36ab7f[_0x2203('0x76')];});return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x41eb4c[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x4e7ba1){return db[_0x2203('0x4b')]['transaction'](function(_0x114e07){return _0x4e7ba1[_0x2203('0x75')](_0x2188d4,{'transaction':_0x114e07})[_0x2203('0x24')](function(){return BPromise[_0x2203('0x7a')](_0x500604,function(_0x145a72){return db[_0x2203('0x7b')][_0x2203('0x7c')]({'TeamId':_0x145a72['id'],'VoicePrefixId':_0x41eb4c[_0x2203('0x46')]['id']},{'transaction':_0x114e07});});})[_0x2203('0x24')](function(){return BPromise[_0x2203('0x7a')](_0x266d7e,function(_0x62843c){return db['UserVoicePrefix'][_0x2203('0x7d')]({'where':{'UserId':_0x62843c['id'],'VoicePrefixId':_0x41eb4c['params']['id']},'transaction':_0x114e07});});})[_0x2203('0x24')](function(){_0x266d7e[_0x2203('0x7e')](function(_0x6b8ea4){socket['emit'](_0x2203('0x7f'),{'UserId':_0x6b8ea4['id'],'VoicePrefixId':_0x4e7ba1['id']});});});});});}})[_0x2203('0x24')](respondWithStatusCode(_0x25996c,null))[_0x2203('0x44')](handleError(_0x25996c,null));};exports[_0x2203('0x80')]=function(_0x4316ae,_0x5c1138,_0x389f7f){return db['Team'][_0x2203('0x42')]({'where':{'id':_0x4316ae[_0x2203('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2203('0x81')],'as':_0x2203('0x76'),'attributes':['id'],'raw':!![]}]})[_0x2203('0x24')](handleEntityNotFound(_0x5c1138,null))[_0x2203('0x24')](function(_0x56c2cb){var _0x12179d=_['map'](_0x56c2cb,'id');var _0x55e083=[];var _0x4055eb=[];var _0x95b45a=squel[_0x2203('0x82')]();_0x95b45a[_0x2203('0x83')](_0x2203('0x84'))[_0x2203('0x85')](_0x2203('0x86'),'tq')['join'](_0x2203('0x87'),'ut',_0x2203('0x88'))[_0x2203('0x3c')]('VoicePrefixId\x20=\x20?',_0x4316ae['params']['id']);for(var _0x4d6ece=0x0;_0x4d6ece<_0x56c2cb[_0x2203('0x39')];_0x4d6ece+=0x1){let _0x46b5e6=_0x56c2cb[_0x4d6ece];for(var _0x3dba31=0x0;_0x3dba31<_0x46b5e6[_0x2203('0x76')]['length'];_0x3dba31+=0x1){let _0x238e6f=_0x46b5e6[_0x2203('0x76')][_0x3dba31];var _0x46146e=_0x95b45a[_0x2203('0x89')]();_0x46146e['where']('ut.UserId\x20=\x20?',_0x238e6f['id']);_0x4055eb[_0x2203('0x60')](db[_0x2203('0x4b')][_0x2203('0x32')](_0x46146e['toString'](),{'type':db[_0x2203('0x4b')][_0x2203('0x8a')][_0x2203('0x8b')]})[_0x2203('0x24')](function(_0x263130){if(_0x263130[_0x2203('0x39')]===0x1){return _0x238e6f['id'];}else{var _0xbee79c=_['every'](_[_0x2203('0x2d')](_0x263130,_0x2203('0x8c')),function(_0x131332){return _[_0x2203('0x8d')](_0x12179d,_0x131332);});if(_0xbee79c){return _0x238e6f['id'];}}}));}}return BPromise[_0x2203('0x8e')](_0x4055eb)[_0x2203('0x24')](function(_0x2d9004){_0x55e083=_(_0x55e083)[_0x2203('0x8f')](_0x2d9004)[_0x2203('0x90')]()['value']();return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x4316ae[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x547eb9){return db[_0x2203('0x4b')][_0x2203('0x68')](function(_0x1022ef){return _0x547eb9[_0x2203('0x80')](_0x4316ae[_0x2203('0x32')][_0x2203('0x6a')],{'transaction':_0x1022ef})[_0x2203('0x24')](function(){if(!_[_0x2203('0x91')](_0x55e083)){return _0x547eb9[_0x2203('0x6d')](_0x55e083,{'transaction':_0x1022ef});}})['then'](function(){_0x55e083['forEach'](function(_0x225ea1){socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':_0x225ea1,'VoicePrefixId':_0x547eb9['id']});});});});});});})[_0x2203('0x24')](respondWithStatusCode(_0x5c1138,null))['catch'](handleError(_0x5c1138,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 567b388..ca026c2 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 _0xaeb5=['events','../../mysqldb','VoicePrefix','save','update','remove','emit','hook','exports'];(function(_0x4bfcbe,_0x4630f5){var _0x5b65e6=function(_0x5dcfc8){while(--_0x5dcfc8){_0x4bfcbe['push'](_0x4bfcbe['shift']());}};_0x5b65e6(++_0x4630f5);}(_0xaeb5,0xf3));var _0x5aeb=function(_0x93b579,_0x429f63){_0x93b579=_0x93b579-0x0;var _0xc9ae85=_0xaeb5[_0x93b579];return _0xc9ae85;};'use strict';var EventEmitter=require(_0x5aeb('0x0'));var VoicePrefix=require(_0x5aeb('0x1'))['db'][_0x5aeb('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5aeb('0x3'),'afterUpdate':_0x5aeb('0x4'),'afterDestroy':_0x5aeb('0x5')};function emitEvent(_0x29dc1a){return function(_0xe7777,_0x471f44,_0x4dfaa4){VoicePrefixEvents['emit'](_0x29dc1a+':'+_0xe7777['id'],_0xe7777);VoicePrefixEvents[_0x5aeb('0x6')](_0x29dc1a,_0xe7777);_0x4dfaa4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x5aeb('0x7')](e,emitEvent(event));}}module[_0x5aeb('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x341d=['events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x47c005,_0xa5c9a5){var _0x25bf04=function(_0x41c37e){while(--_0x41c37e){_0x47c005['push'](_0x47c005['shift']());}};_0x25bf04(++_0xa5c9a5);}(_0x341d,0xd0));var _0xd341=function(_0x539861,_0x205ca8){_0x539861=_0x539861-0x0;var _0x32f06d=_0x341d[_0x539861];return _0x32f06d;};'use strict';var EventEmitter=require(_0xd341('0x0'));var VoicePrefix=require(_0xd341('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xd341('0x2')](0x0);var events={'afterCreate':_0xd341('0x3'),'afterUpdate':_0xd341('0x4'),'afterDestroy':'remove'};function emitEvent(_0xf2bc08){return function(_0xe2d584,_0x486d3d,_0x14dc47){VoicePrefixEvents[_0xd341('0x5')](_0xf2bc08+':'+_0xe2d584['id'],_0xe2d584);VoicePrefixEvents[_0xd341('0x5')](_0xf2bc08,_0xe2d584);_0x14dc47(null);};}for(var e in events){if(events[_0xd341('0x6')](e)){var event=events[e];VoicePrefix[_0xd341('0x7')](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 c76fd30..704eecb 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 _0x490c=['path','rimraf','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix','lodash','api','moment','bluebird'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x490c,0x88));var _0xc490=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0x490c[_0x4dcc2d];return _0x1bbd79;};'use strict';var _=require(_0xc490('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc490('0x1'));var moment=require(_0xc490('0x2'));var BPromise=require(_0xc490('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc490('0x4'));var rimraf=require(_0xc490('0x5'));var config=require(_0xc490('0x6'));var attributes=require(_0xc490('0x7'));module[_0xc490('0x8')]=function(_0x139276,_0x459fce){return _0x139276['define'](_0xc490('0x9'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfabd=['../../config/environment','./voicePrefix.attributes','define','VoicePrefix','util','../../config/logger','api','moment','bluebird'];(function(_0x501c32,_0x2f24c9){var _0x9bd372=function(_0x34c2be){while(--_0x34c2be){_0x501c32['push'](_0x501c32['shift']());}};_0x9bd372(++_0x2f24c9);}(_0xfabd,0x1e1));var _0xdfab=function(_0x174e68,_0xaaa417){_0x174e68=_0x174e68-0x0;var _0x12957e=_0xfabd[_0x174e68];return _0x12957e;};'use strict';var _=require('lodash');var util=require(_0xdfab('0x0'));var logger=require(_0xdfab('0x1'))(_0xdfab('0x2'));var moment=require(_0xdfab('0x3'));var BPromise=require(_0xdfab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdfab('0x5'));var attributes=require(_0xdfab('0x6'));module['exports']=function(_0x5f40f0,_0x110185){return _0x5f40f0[_0xdfab('0x7')](_0xdfab('0x8'),attributes,{'tableName':'voice_prefixes','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 98dd28f..6ac1eb9 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 _0xf105=['register','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','VoicePrefix,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket'];(function(_0x49f3a4,_0x2d0f9d){var _0x559fbf=function(_0x2ce9f9){while(--_0x2ce9f9){_0x49f3a4['push'](_0x49f3a4['shift']());}};_0x559fbf(++_0x2d0f9d);}(_0xf105,0x1b0));var _0x5f10=function(_0xcdaaa6,_0x4767df){_0xcdaaa6=_0xcdaaa6-0x0;var _0x575d02=_0xf105[_0xcdaaa6];return _0x575d02;};'use strict';var _=require(_0x5f10('0x0'));var util=require(_0x5f10('0x1'));var moment=require(_0x5f10('0x2'));var BPromise=require(_0x5f10('0x3'));var rs=require(_0x5f10('0x4'));var fs=require('fs');var Redis=require(_0x5f10('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f10('0x6'));var logger=require('../../config/logger')(_0x5f10('0x7'));var config=require(_0x5f10('0x8'));var jayson=require(_0x5f10('0x9'));var client=jayson[_0x5f10('0xa')][_0x5f10('0xb')]({'port':0x232a});config[_0x5f10('0xc')]=_[_0x5f10('0xd')](config[_0x5f10('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5f10('0xe'))(new Redis(config[_0x5f10('0xc')]));require(_0x5f10('0xf'))[_0x5f10('0x10')](socket);function respondWithRpcPromise(_0x1b5463,_0x6dc96e,_0x540d92){return new BPromise(function(_0x1009b9,_0x3fd8eb){return client[_0x5f10('0x11')](_0x1b5463,_0x540d92)[_0x5f10('0x12')](function(_0x20fad6){logger[_0x5f10('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x6dc96e,_0x5f10('0x14'));logger[_0x5f10('0x15')](_0x5f10('0x16'),_0x6dc96e,_0x5f10('0x14'),JSON['stringify'](_0x20fad6));if(_0x20fad6['error']){if(_0x20fad6[_0x5f10('0x17')][_0x5f10('0x18')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x6dc96e,_0x20fad6[_0x5f10('0x17')]['message']);return _0x3fd8eb(_0x20fad6['error']['message']);}logger[_0x5f10('0x17')](_0x5f10('0x19'),_0x6dc96e,_0x20fad6['error'][_0x5f10('0x1a')]);return _0x1009b9(_0x20fad6[_0x5f10('0x17')]['message']);}else{logger[_0x5f10('0x13')](_0x5f10('0x19'),_0x6dc96e,_0x5f10('0x14'));_0x1009b9(_0x20fad6[_0x5f10('0x1b')]['message']);}})['catch'](function(_0x40c679){logger[_0x5f10('0x17')](_0x5f10('0x19'),_0x6dc96e,_0x40c679);_0x3fd8eb(_0x40c679);});});} \ No newline at end of file +var _0x794b=['request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s'];(function(_0xff7781,_0x2a5edb){var _0x25b5d4=function(_0xd74778){while(--_0xd74778){_0xff7781['push'](_0xff7781['shift']());}};_0x25b5d4(++_0x2a5edb);}(_0x794b,0x1c2));var _0xb794=function(_0x51a07a,_0xbd0fc7){_0x51a07a=_0x51a07a-0x0;var _0x57531e=_0x794b[_0x51a07a];return _0x57531e;};'use strict';var _=require(_0xb794('0x0'));var util=require(_0xb794('0x1'));var moment=require('moment');var BPromise=require(_0xb794('0x2'));var rs=require(_0xb794('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb794('0x4'));var logger=require(_0xb794('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb794('0x6'));var client=jayson[_0xb794('0x7')][_0xb794('0x8')]({'port':0x232a});config[_0xb794('0x9')]=_[_0xb794('0xa')](config[_0xb794('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xb794('0xb'))(new Redis(config[_0xb794('0x9')]));require(_0xb794('0xc'))[_0xb794('0xd')](socket);function respondWithRpcPromise(_0x2d0d36,_0xf87756,_0x13bd3d){return new BPromise(function(_0x1f224a,_0x19cfa0){return client[_0xb794('0xe')](_0x2d0d36,_0x13bd3d)[_0xb794('0xf')](function(_0x1b1cee){logger[_0xb794('0x10')](_0xb794('0x11'),_0xf87756,_0xb794('0x12'));logger[_0xb794('0x13')](_0xb794('0x14'),_0xf87756,_0xb794('0x12'),JSON[_0xb794('0x15')](_0x1b1cee));if(_0x1b1cee[_0xb794('0x16')]){if(_0x1b1cee[_0xb794('0x16')]['code']===0x1f4){logger[_0xb794('0x16')](_0xb794('0x11'),_0xf87756,_0x1b1cee[_0xb794('0x16')][_0xb794('0x17')]);return _0x19cfa0(_0x1b1cee[_0xb794('0x16')][_0xb794('0x17')]);}logger['error'](_0xb794('0x11'),_0xf87756,_0x1b1cee[_0xb794('0x16')]['message']);return _0x1f224a(_0x1b1cee[_0xb794('0x16')][_0xb794('0x17')]);}else{logger['info'](_0xb794('0x11'),_0xf87756,_0xb794('0x12'));_0x1f224a(_0x1b1cee[_0xb794('0x18')]['message']);}})[_0xb794('0x19')](function(_0xa0c655){logger['error'](_0xb794('0x11'),_0xf87756,_0xa0c655);_0x19cfa0(_0xa0c655);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index b5daa67..b697aa5 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 _0x10b8=['length','./voicePrefix.events','save','remove','update','emit','register'];(function(_0x32e3da,_0x600439){var _0xfa924c=function(_0x5027e4){while(--_0x5027e4){_0x32e3da['push'](_0x32e3da['shift']());}};_0xfa924c(++_0x600439);}(_0x10b8,0x166));var _0x810b=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x10b8[_0x1a7846];return _0x48049;};'use strict';var VoicePrefixEvents=require(_0x810b('0x0'));var events=[_0x810b('0x1'),_0x810b('0x2'),_0x810b('0x3')];function createListener(_0x377d88,_0x3ddf1f){return function(_0x4c370c){_0x3ddf1f[_0x810b('0x4')](_0x377d88,_0x4c370c);};}function removeListener(_0x30dac0,_0x2cef3f){return function(){VoicePrefixEvents['removeListener'](_0x30dac0,_0x2cef3f);};}exports[_0x810b('0x5')]=function(_0x3166f9){for(var _0x3d3a15=0x0,_0x33b73f=events[_0x810b('0x6')];_0x3d3a15<_0x33b73f;_0x3d3a15++){var _0x3c5f12=events[_0x3d3a15];var _0x43e6ed=createListener('voicePrefix:'+_0x3c5f12,_0x3166f9);VoicePrefixEvents['on'](_0x3c5f12,_0x43e6ed);}}; \ No newline at end of file +var _0xa62c=['./voicePrefix.events','save','remove','update','removeListener','register','length','voicePrefix:'];(function(_0x213856,_0x34af6b){var _0x522c80=function(_0x2f35e8){while(--_0x2f35e8){_0x213856['push'](_0x213856['shift']());}};_0x522c80(++_0x34af6b);}(_0xa62c,0x70));var _0xca62=function(_0x46111d,_0x5d286b){_0x46111d=_0x46111d-0x0;var _0xe82586=_0xa62c[_0x46111d];return _0xe82586;};'use strict';var VoicePrefixEvents=require(_0xca62('0x0'));var events=[_0xca62('0x1'),_0xca62('0x2'),_0xca62('0x3')];function createListener(_0x27ee5c,_0x1eed11){return function(_0x11ad76){_0x1eed11['emit'](_0x27ee5c,_0x11ad76);};}function removeListener(_0x35180a,_0x3da6b7){return function(){VoicePrefixEvents[_0xca62('0x4')](_0x35180a,_0x3da6b7);};}exports[_0xca62('0x5')]=function(_0x1e51ba){for(var _0x31d267=0x0,_0x310378=events[_0xca62('0x6')];_0x31d267<_0x310378;_0x31d267++){var _0x5da9b9=events[_0x31d267];var _0x2160c4=createListener(_0xca62('0x7')+_0x5da9b9,_0x1e51ba);VoicePrefixEvents['on'](_0x5da9b9,_0x2160c4);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index fa9de6b..99d9ba9 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 _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x1a0600,_0x41feef){var _0x734670=function(_0x2da4e4){while(--_0x2da4e4){_0x1a0600['push'](_0x1a0600['shift']());}};_0x734670(++_0x41feef);}(_0xb10b,0x12a));var _0xbb10=function(_0x579baf,_0x4aaafa){_0x579baf=_0x579baf-0x0;var _0x4c601a=_0xb10b[_0x579baf];return _0x4c601a;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xb10b,0x12a));var _0xbb10=function(_0x20d434,_0x3fb64f){_0x20d434=_0x20d434-0x0;var _0x1d90f1=_0xb10b[_0x20d434];return _0x1d90f1;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 7bcc2e5..267cf04 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 _0x3219=['#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','inbound','default','ringall','fewestcalls','rrmemory','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','outbound','preview','booked','roundrobin','includes','INTEGER','yes','all','ENUM','periodic_announce','join','split','joinempty','leavewhenempty','wrapuptime','BOOLEAN','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#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'];(function(_0x2ad008,_0x45c253){var _0x4538cf=function(_0xe143e4){while(--_0xe143e4){_0x2ad008['push'](_0x2ad008['shift']());}};_0x4538cf(++_0x45c253);}(_0x3219,0x64));var _0x9321=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x3219[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0x9321('0x0'));module[_0x9321('0x1')]={'name':{'type':Sequelize[_0x9321('0x2')],'allowNull':![],'unique':_0x9321('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('inbound','outbound'),'allowNull':![],'defaultValue':_0x9321('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x9321('0x5')},'announce':{'type':Sequelize[_0x9321('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x9321('0x6'),'leastrecent',_0x9321('0x7'),'random',_0x9321('0x8'),'linear',_0x9321('0x9'),_0x9321('0xa')),'allowNull':![],'defaultValue':_0x9321('0x6'),'set':function(_0x376929){this[_0x9321('0xb')](_0x9321('0xc'),_0x376929?_0x376929:_0x9321('0x8'));},'get':function(){var _0x3a0eea=this[_0x9321('0xd')](_0x9321('0xe'));var _0x883397=this[_0x9321('0xd')](_0x9321('0xf'));var _0x4178ae=this['getDataValue'](_0x9321('0xc'));if(_0x3a0eea===_0x9321('0x10')){if(_0x883397===_0x9321('0x11')){return null;}if(_0x883397===_0x9321('0x12')&&!['rrmemory',_0x9321('0x13')][_0x9321('0x14')](_0x4178ae)){this['setDataValue'](_0x9321('0xc'),_0x9321('0x8'));}}return _0x4178ae;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x9321('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x9321('0x15')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x9321('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x9321('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x9321('0x16'),'no'),'defaultValue':_0x9321('0x16')},'autopause':{'type':Sequelize['ENUM'](_0x9321('0x16'),'no',_0x9321('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x9321('0x18')](_0x9321('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x9321('0x18')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x9321('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x9321('0x18')](_0x9321('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x9321('0x18')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x9321('0x18')](_0x9321('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x9321('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x9321('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x9321('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x9321('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x9321('0x18')](_0x9321('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x9321('0x18')](_0x9321('0x16'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x9321('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x9321('0x18')](_0x9321('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x9321('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x9321('0x18')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x9321('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x9321('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x9321('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x9321('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x9321('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x9321('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x9321('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x9321('0x2')]},'queue_quantity1':{'type':Sequelize[_0x9321('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x9321('0x2')]},'queue_less_than':{'type':Sequelize[_0x9321('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x2312a5){this['setDataValue'](_0x9321('0x19'),_0x2312a5?_0x2312a5[_0x9321('0x1a')](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this[_0x9321('0xd')](_0x9321('0x19'))[_0x9321('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x9321('0x2')],'defaultValue':'yes','set':function(_0x1e611a){this[_0x9321('0xb')](_0x9321('0x1c'),_0x1e611a?_0x1e611a[_0x9321('0x1a')](','):undefined);},'get':function(){return this[_0x9321('0xd')](_0x9321('0x1c'))?this[_0x9321('0xd')](_0x9321('0x1c'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x9321('0x2')],'defaultValue':'no','set':function(_0x6848df){this['setDataValue'](_0x9321('0x1d'),_0x6848df?_0x6848df[_0x9321('0x1a')](','):undefined);},'get':function(){return this[_0x9321('0xd')](_0x9321('0x1d'))?this[_0x9321('0xd')](_0x9321('0x1d'))[_0x9321('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x9321('0x18')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x9321('0x18')](_0x9321('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x9321('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x9321('0x18')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x9321('0x2')]},'description':{'type':Sequelize[_0x9321('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x52d0a5){this['setDataValue']('acw',_0x52d0a5);if(_0x52d0a5){if(this[_0x9321('0xd')](_0x9321('0x1e'))<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x9321('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x9321('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x9321('0x18')](_0x9321('0x11'),_0x9321('0x20'),_0x9321('0x21'),_0x9321('0x22'),_0x9321('0x12')),'defaultValue':_0x9321('0x20'),'comment':_0x9321('0x23')},'dialLimitChannel':{'type':Sequelize[_0x9321('0x15')](0x4)[_0x9321('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9321('0x25')},'dialLimitQueue':{'type':Sequelize[_0x9321('0x15')](0x4)[_0x9321('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9321('0x26')},'dialPowerLevel':{'type':Sequelize[_0x9321('0x27')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x9321('0x18')](_0x9321('0x28'),_0x9321('0x29')),'defaultValue':_0x9321('0x29'),'comment':_0x9321('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x9321('0x27')](0x2)[_0x9321('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x9321('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x9321('0x15')](0x3)[_0x9321('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x9321('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0x9321('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x9321('0x15')](0x3)[_0x9321('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9321('0x2d')},'dialQueueOptions':{'type':Sequelize[_0x9321('0x2')],'defaultValue':'tTxX','comment':_0x9321('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0x9321('0x15')](0x3)[_0x9321('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9321('0x2f')},'dialQueueProject':{'type':Sequelize[_0x9321('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x9321('0x15')](0x3)[_0x9321('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9321('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9321('0x15')](0x5)[_0x9321('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9321('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x9321('0x15')](0x3)[_0x9321('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9321('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9321('0x15')](0x5)[_0x9321('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9321('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9321('0x15')](0x3)[_0x9321('0x24')],'defaultValue':0x3,'comment':_0x9321('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9321('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9321('0x35')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9321('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9321('0x36')},'dialTimezone':{'type':Sequelize[_0x9321('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9321('0x2')],'defaultValue':_0x9321('0x37')},'dialPrefix':{'type':Sequelize[_0x9321('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x9321('0x18')]('always','never','onlyIfOpen'),'defaultValue':_0x9321('0x38')},'dialAMDActive':{'type':Sequelize[_0x9321('0x1f')],'defaultValue':0x0,'comment':_0x9321('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x9321('0x15')](0x9)[_0x9321('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9321('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x9321('0x15')](0x9)[_0x9321('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9321('0x15')](0x9)[_0x9321('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9321('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x9321('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9321('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0x9321('0x15')](0x9)[_0x9321('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9321('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9321('0x15')](0x9)[_0x9321('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9321('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9321('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9321('0x15')](0x5)[_0x9321('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9321('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9321('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9321('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0x9321('0x15')](0x5)[_0x9321('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x9321('0x42')},'dialRecallInQueue':{'type':Sequelize[_0x9321('0x1f')],'defaultValue':0x0,'comment':_0x9321('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9321('0x18')](_0x9321('0x44'),_0x9321('0x45')),'defaultValue':_0x9321('0x44')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x9321('0x46')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x9321('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x9321('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9321('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9321('0x47')},'dialCutDigit':{'type':Sequelize[_0x9321('0x15')](0x3)[_0x9321('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9321('0x48')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9321('0x15')](0x3)[_0x9321('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9321('0x49')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9321('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9321('0x4a')},'dialDropMaxRetry':{'type':Sequelize[_0x9321('0x15')](0x3)[_0x9321('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9321('0x4b')},'dialDropRetryFrequency':{'type':Sequelize[_0x9321('0x15')](0x5)[_0x9321('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9321('0x4c')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9321('0x15')](0x3)[_0x9321('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9321('0x4d')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9321('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x9321('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x9321('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9321('0x4e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9321('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9321('0x4f')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9321('0x15')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9321('0x1f')],'defaultValue':![],'comment':_0x9321('0x50'),'set':function(_0x311f78){if(!_0x311f78)this['setDataValue'](_0x9321('0x51'),null);this[_0x9321('0xb')](_0x9321('0x52'),_0x311f78);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x9321('0x15')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x9321('0x15')](0x3)[_0x9321('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x9321('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x9321('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x9321('0x1f')],'defaultValue':![]}}; \ No newline at end of file +var _0x73e3=['wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','progressive','power','predictive','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','#AMD\x20Greeting','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','outbound','default','ringall','random','rrmemory','linear','wrandom','rrordered','strategy','getDataValue','dialMethod','preview','booked','roundrobin','INTEGER','yes','once','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','acw'];(function(_0x425716,_0x3e9d1c){var _0x2d39af=function(_0x1febc1){while(--_0x1febc1){_0x425716['push'](_0x425716['shift']());}};_0x2d39af(++_0x3e9d1c);}(_0x73e3,0xcf));var _0x373e=function(_0x4a0e68,_0x45c08c){_0x4a0e68=_0x4a0e68-0x0;var _0x4fb274=_0x73e3[_0x4a0e68];return _0x4fb274;};'use strict';var Sequelize=require('sequelize');module[_0x373e('0x0')]={'name':{'type':Sequelize[_0x373e('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x373e('0x2')]('inbound',_0x373e('0x3')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x373e('0x1')],'defaultValue':_0x373e('0x4')},'announce':{'type':Sequelize[_0x373e('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x373e('0x2')]('rr',_0x373e('0x5'),'leastrecent','fewestcalls',_0x373e('0x6'),_0x373e('0x7'),_0x373e('0x8'),_0x373e('0x9'),_0x373e('0xa')),'allowNull':![],'defaultValue':_0x373e('0x5'),'set':function(_0x4f05c9){this['setDataValue'](_0x373e('0xb'),_0x4f05c9?_0x4f05c9:_0x373e('0x7'));},'get':function(){var _0x4244c8=this['getDataValue']('type');var _0x153003=this[_0x373e('0xc')](_0x373e('0xd'));var _0x2eeb32=this[_0x373e('0xc')]('strategy');if(_0x4244c8==='outbound'){if(_0x153003===_0x373e('0xe')){return null;}if(_0x153003===_0x373e('0xf')&&![_0x373e('0x7'),_0x373e('0x10')]['includes'](_0x2eeb32)){this['setDataValue'](_0x373e('0xb'),_0x373e('0x7'));}}return _0x2eeb32;}},'servicelevel':{'type':Sequelize[_0x373e('0x11')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x373e('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x373e('0x11')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x373e('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x373e('0x11')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x373e('0x2')]('yes','no'),'defaultValue':_0x373e('0x12')},'autopause':{'type':Sequelize['ENUM'](_0x373e('0x12'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x373e('0x11')](0xb)},'autopausebusy':{'type':Sequelize[_0x373e('0x2')](_0x373e('0x12'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x373e('0x2')](_0x373e('0x12'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x373e('0x2')](_0x373e('0x12'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x373e('0x2')](_0x373e('0x12'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x373e('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x373e('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x373e('0x11')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x373e('0x2')](_0x373e('0x12'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x373e('0x2')]('yes','no'),'defaultValue':_0x373e('0x12')},'announce_holdtime':{'type':Sequelize[_0x373e('0x2')]('yes','no',_0x373e('0x13')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x373e('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x373e('0x12'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x373e('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x373e('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x373e('0x1')]},'queue_youarenext':{'type':Sequelize[_0x373e('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x373e('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x373e('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x373e('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x373e('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x373e('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x373e('0x1')]},'queue_quantity2':{'type':Sequelize[_0x373e('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x373e('0x1')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x44c38e){this[_0x373e('0x14')](_0x373e('0x15'),_0x44c38e?_0x44c38e[_0x373e('0x16')](','):[]);},'get':function(){return this[_0x373e('0xc')]('periodic_announce')?this[_0x373e('0xc')]('periodic_announce')[_0x373e('0x17')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x533d1e){this[_0x373e('0x14')](_0x373e('0x18'),_0x533d1e?_0x533d1e['join'](','):undefined);},'get':function(){return this[_0x373e('0xc')](_0x373e('0x18'))?this[_0x373e('0xc')](_0x373e('0x18'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x373e('0x1')],'defaultValue':'no','set':function(_0x3882f8){this[_0x373e('0x14')](_0x373e('0x19'),_0x3882f8?_0x3882f8[_0x373e('0x16')](','):undefined);},'get':function(){return this[_0x373e('0xc')](_0x373e('0x19'))?this[_0x373e('0xc')](_0x373e('0x19'))[_0x373e('0x17')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x373e('0x12'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x373e('0x2')](_0x373e('0x12'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x373e('0x11')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x373e('0x2')](_0x373e('0x12'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x373e('0x1')]},'description':{'type':Sequelize[_0x373e('0x1')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x4e3259){this[_0x373e('0x14')](_0x373e('0x1a'),_0x4e3259);if(_0x4e3259){if(this[_0x373e('0xc')]('wrapuptime')<0x2){this[_0x373e('0x14')](_0x373e('0x1b'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x373e('0x1c')],'defaultValue':0x0,'comment':_0x373e('0x1d')},'dialMethod':{'type':Sequelize[_0x373e('0x2')](_0x373e('0xe'),_0x373e('0x1e'),_0x373e('0x1f'),_0x373e('0x20'),_0x373e('0xf')),'defaultValue':_0x373e('0x1e'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x373e('0x11')](0x4)[_0x373e('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x373e('0x22')},'dialLimitQueue':{'type':Sequelize[_0x373e('0x11')](0x4)[_0x373e('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x373e('0x23')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x373e('0x21')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0x373e('0x24')),'defaultValue':_0x373e('0x24'),'comment':_0x373e('0x25')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x373e('0x26')](0x2)[_0x373e('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x373e('0x27')},'dialOriginateCallerIdName':{'type':Sequelize[_0x373e('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x373e('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x373e('0x28')},'dialQueueOptions':{'type':Sequelize[_0x373e('0x1')],'defaultValue':_0x373e('0x29'),'comment':_0x373e('0x2a')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x373e('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x373e('0x2b')},'dialQueueProject':{'type':Sequelize[_0x373e('0x1')],'comment':_0x373e('0x2c')},'dialCongestionMaxRetry':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x373e('0x2d')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x373e('0x11')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x373e('0x2e')},'dialBusyMaxRetry':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x373e('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize[_0x373e('0x11')](0x5)[_0x373e('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x373e('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'defaultValue':0x3,'comment':_0x373e('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x373e('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x373e('0x32')},'dialGlobalMaxRetry':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x373e('0x33')},'dialTimezone':{'type':Sequelize[_0x373e('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x373e('0x1')],'defaultValue':_0x373e('0x34')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x373e('0x2')]('always',_0x373e('0x35'),_0x373e('0x36')),'defaultValue':_0x373e('0x37')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x373e('0x11')](0x9)[_0x373e('0x21')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x373e('0x21')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x373e('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x373e('0x21')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x373e('0x11')](0x9)[_0x373e('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x373e('0x11')](0x9)[_0x373e('0x21')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x373e('0x11')](0x9)[_0x373e('0x21')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x373e('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x373e('0x11')](0x9)[_0x373e('0x21')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x373e('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x373e('0x11')](0x5)[_0x373e('0x21')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x373e('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x373e('0x11')](0x9)[_0x373e('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x373e('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0x373e('0x11')](0x5)[_0x373e('0x21')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x373e('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0x373e('0x1c')],'defaultValue':0x0,'comment':_0x373e('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x373e('0x2')]('DESC',_0x373e('0x3f')),'defaultValue':_0x373e('0x40')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x373e('0x2c')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x373e('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x373e('0x41')},'dialCutDigit':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x373e('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x373e('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x373e('0x11')](0x5)[_0x373e('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x373e('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x373e('0x44')},'dialDropRetryFrequency':{'type':Sequelize[_0x373e('0x11')](0x5)[_0x373e('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x373e('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x373e('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x373e('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x373e('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x373e('0x11')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x373e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x373e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x373e('0x11')](0x5)[_0x373e('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x373e('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x373e('0x11')],'allowNull':!![],'comment':_0x373e('0x4a')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x373e('0x4b'),'set':function(_0x1f0472){if(!_0x1f0472)this['setDataValue'](_0x373e('0x4c'),null);this[_0x373e('0x14')](_0x373e('0x4d'),_0x1f0472);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x373e('0x1c')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x373e('0x11')](0x3)[_0x373e('0x21')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 5eeefd5..b37115a 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 _0x8ef6=['select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','into','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','VoiceQueues','inbound','outbound','ignore','map','value','find','type','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','getOptions','include','query','findAll','rows','catch','show','model','keys','intersection','attributes','fields','length','merge','options','create','body','user','get','role','QueueCampaigns','UserProfileSection','userProfileId','clone','includeAll','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getHoppers','findOne','CmHopper','filters','hasOwnProperty','order','sort','where','pick','filter','getHopperHistories','CmHopperHistory','nolimit','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids'];(function(_0x48dda8,_0x8f93bb){var _0x43011e=function(_0x343dc3){while(--_0x343dc3){_0x48dda8['push'](_0x48dda8['shift']());}};_0x43011e(++_0x8f93bb);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2a4aa7,_0x131942){_0x2a4aa7=_0x2a4aa7-0x0;var _0x37cf6d=_0x8ef6[_0x2a4aa7];return _0x37cf6d;};'use strict';var moment=require(_0x68ef('0x0'));var BPromise=require(_0x68ef('0x1'));var util=require(_0x68ef('0x2'));var _=require(_0x68ef('0x3'));var squel=require(_0x68ef('0x4'));var Redis=require(_0x68ef('0x5'));var qs=require(_0x68ef('0x6'));var logger=require('../../config/logger')(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var db=require(_0x68ef('0x9'))['db'];config[_0x68ef('0xa')]=_['defaults'](config['redis'],{'host':_0x68ef('0xb'),'port':0x18eb});var socket=require(_0x68ef('0xc'))(new Redis(config[_0x68ef('0xa')]));require('./voiceQueue.socket')[_0x68ef('0xd')](socket);function respondWithStatusCode(_0x31007e,_0x1bee73){_0x1bee73=_0x1bee73||0xcc;return function(_0x22ae26){if(_0x22ae26){return _0x31007e[_0x68ef('0xe')](_0x1bee73);}return _0x31007e[_0x68ef('0xf')](_0x1bee73)[_0x68ef('0x10')]();};}function respondWithResult(_0x23da00,_0x1f6747){_0x1f6747=_0x1f6747||0xc8;return function(_0x255c85){if(_0x255c85){return _0x23da00[_0x68ef('0xf')](_0x1f6747)[_0x68ef('0x11')](_0x255c85);}};}function respondWithFilteredResult(_0x582a79,_0x1aa045){return function(_0x46356f){if(_0x46356f){var _0x1e117a=typeof _0x1aa045[_0x68ef('0x12')]===_0x68ef('0x13')&&typeof _0x1aa045[_0x68ef('0x14')]==='undefined';var _0x3b48dd=_0x46356f[_0x68ef('0x15')];var _0x2657c5=_0x1e117a?0x0:_0x1aa045['offset'];var _0x22fe96=_0x1e117a?_0x46356f[_0x68ef('0x15')]:_0x1aa045[_0x68ef('0x12')]+_0x1aa045['limit'];var _0x35493d;if(_0x22fe96>=_0x3b48dd){_0x22fe96=_0x3b48dd;_0x35493d=0xc8;}else{_0x35493d=0xce;}_0x582a79[_0x68ef('0xf')](_0x35493d);return _0x582a79[_0x68ef('0x16')](_0x68ef('0x17'),_0x2657c5+'-'+_0x22fe96+'/'+_0x3b48dd)['json'](_0x46356f);}return null;};}function saveUpdates(_0x2ada1c){return function(_0x54139e){if(_0x54139e){return _0x54139e['update'](_0x2ada1c)[_0x68ef('0x18')](function(_0x404870){return _0x404870;});}return null;};}function removeEntity(_0x4ade0d){return function(_0x527870){if(_0x527870){return _0x527870[_0x68ef('0x19')]()[_0x68ef('0x18')](function(){var _0x318514=_0x527870['get']({'plain':!![]});var _0x1dc49c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b'),'ignore':![]},{'name':'QueueCampaigns','value':_0x68ef('0x1c'),'ignore':![]}];var _0x3be4c0=_(_0x1dc49c)['filter'](_0x68ef('0x1d'))[_0x68ef('0x1e')](_0x68ef('0x1f'))['value']();if(_['includes'](_0x3be4c0,_0x318514['type'])){return;}var _0x26018d=_[_0x68ef('0x20')](_0x1dc49c,[_0x68ef('0x1f'),_0x318514[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x23')][_0x68ef('0x19')]({'where':{'type':_0x26018d,'resourceId':_0x318514['id']}})[_0x68ef('0x18')](function(){return _0x527870;});})[_0x68ef('0x18')](function(){_0x4ade0d[_0x68ef('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x178460){return function(_0x57f9ee){if(!_0x57f9ee){_0x178460['sendStatus'](0x194);}return _0x57f9ee;};}function handleError(_0x55d8b0,_0x1a7ce1){_0x1a7ce1=_0x1a7ce1||0x1f4;return function(_0x268f32){logger[_0x68ef('0x24')](_0x268f32[_0x68ef('0x25')]);if(_0x268f32['name']){delete _0x268f32['name'];}_0x55d8b0[_0x68ef('0xf')](_0x1a7ce1)[_0x68ef('0x26')](_0x268f32);};}exports[_0x68ef('0x27')]=function(_0x263b30,_0x22ef25){var _0x201884={};var _0x26288a={'count':0x0,'rows':[]};var _0x4579cb=_['map'](db[_0x68ef('0x28')][_0x68ef('0x29')],function(_0x132d9e){return{'name':_0x132d9e['fieldName'],'type':_0x132d9e[_0x68ef('0x21')]['key']};});_0x201884=qs[_0x68ef('0x2a')](_0x4579cb,_0x263b30);var _0x17588a={'where':_0x201884['where']};return db['VoiceQueue'][_0x68ef('0x15')](_0x17588a)[_0x68ef('0x18')](function(_0x4b8fc8){_0x26288a[_0x68ef('0x15')]=_0x4b8fc8;_0x201884[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x263b30[_0x68ef('0x2c')]);return db['VoiceQueue'][_0x68ef('0x2d')](_0x201884);})[_0x68ef('0x18')](function(_0x5f137b){_0x26288a[_0x68ef('0x2e')]=_0x5f137b;return _0x26288a;})['then'](respondWithFilteredResult(_0x22ef25,_0x201884))[_0x68ef('0x2f')](handleError(_0x22ef25,null));};exports[_0x68ef('0x30')]=function(_0x4973c2,_0x24c2c9){var _0x4a0763={'raw':![],'where':{'id':_0x4973c2['params']['id']}},_0x38c2f8={};_0x38c2f8[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x28')]['rawAttributes']);_0x38c2f8[_0x68ef('0x2c')]=_['keys'](_0x4973c2[_0x68ef('0x2c')]);_0x38c2f8['filters']=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],_0x38c2f8[_0x68ef('0x2c')]);_0x4a0763[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],qs['fields'](_0x4973c2[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a0763[_0x68ef('0x34')]=_0x4a0763['attributes'][_0x68ef('0x36')]?_0x4a0763[_0x68ef('0x34')]:_0x38c2f8[_0x68ef('0x31')];if(_0x4973c2['query']['includeAll']){_0x4a0763[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4a0763=_[_0x68ef('0x37')]({},_0x4a0763,_0x4973c2[_0x68ef('0x38')]);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4a0763)[_0x68ef('0x18')](handleEntityNotFound(_0x24c2c9,null))[_0x68ef('0x18')](respondWithResult(_0x24c2c9,null))['catch'](handleError(_0x24c2c9,null));};exports[_0x68ef('0x39')]=function(_0xd7f9ca,_0x2f6ee0){return db[_0x68ef('0x28')]['create'](_0xd7f9ca[_0x68ef('0x3a')],{})[_0x68ef('0x18')](function(_0xcf595d){var _0x410c10=_0xd7f9ca[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0x410c10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x410c10[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0xf5010c=_0xcf595d[_0x68ef('0x3c')]({'plain':!![]});var _0x449f3c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b')},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x531096=_[_0x68ef('0x20')](_0x449f3c,[_0x68ef('0x1f'),_0xf5010c[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x531096,'userProfileId':_0x410c10[_0x68ef('0x40')]},'raw':!![]})['then'](function(_0xb3d396){if(_0xb3d396&&_0xb3d396['autoAssociation']===0x0){return db[_0x68ef('0x23')][_0x68ef('0x39')]({'name':_0xf5010c[_0x68ef('0x22')],'resourceId':_0xf5010c['id'],'type':_0xb3d396[_0x68ef('0x22')],'sectionId':_0xb3d396['id']},{})['then'](function(){return _0xcf595d;});}else{return _0xcf595d;}})[_0x68ef('0x2f')](function(_0x5a8231){logger[_0x68ef('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a8231);throw _0x5a8231;});}return _0xcf595d;})[_0x68ef('0x18')](respondWithResult(_0x2f6ee0,0xc9))[_0x68ef('0x2f')](handleError(_0x2f6ee0,null));};exports[_0x68ef('0x41')]=function(_0x5c4a66,_0x59b148){var _0x4044d5={'where':{'id':_0x5c4a66['params']['id']}},_0x399055={};_0x399055['model']=_['keys'](db[_0x68ef('0x28')][_0x68ef('0x29')]);_0x4044d5[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x399055[_0x68ef('0x31')],qs['fields'](_0x5c4a66['query'][_0x68ef('0x35')]));_0x4044d5[_0x68ef('0x34')]=_0x4044d5[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4044d5['attributes']:_0x399055[_0x68ef('0x31')];if(_0x5c4a66[_0x68ef('0x2c')][_0x68ef('0x42')]){_0x4044d5[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4044d5=_['merge']({},_0x4044d5,_0x5c4a66['options']);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4044d5)['then'](handleEntityNotFound(_0x59b148,null))[_0x68ef('0x18')](function(_0x12fff3){if(_0x12fff3){var _0x3a82a0=_0x12fff3[_0x68ef('0x3c')]({'plain':!![]});_0x3a82a0=qs[_0x68ef('0x43')](_0x3a82a0,['id','createdAt',_0x68ef('0x44')]);_0x5c4a66[_0x68ef('0x3a')]=_[_0x68ef('0x43')](_0x5c4a66['body'],['id',_0x68ef('0x45'),_0x68ef('0x44')]);return db[_0x68ef('0x28')]['create'](_[_0x68ef('0x37')](_0x3a82a0,_0x5c4a66['body']),{'include':_0x5c4a66['query'][_0x68ef('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x39dd21){var _0xb33afd=_0x5c4a66[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0xb33afd)throw new Error(_0x68ef('0x46'));if(_0xb33afd[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0x1d1d6e=_0x39dd21[_0x68ef('0x3c')]({'plain':!![]});var _0x247915=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x317b79=_[_0x68ef('0x20')](_0x247915,[_0x68ef('0x1f'),_0x1d1d6e[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x317b79,'userProfileId':_0xb33afd['userProfileId']},'raw':!![]})['then'](function(_0x42a4b2){if(_0x42a4b2&&_0x42a4b2['autoAssociation']===0x0){return db[_0x68ef('0x23')]['create']({'name':_0x1d1d6e[_0x68ef('0x22')],'resourceId':_0x1d1d6e['id'],'type':_0x42a4b2[_0x68ef('0x22')],'sectionId':_0x42a4b2['id']},{})['then'](function(){return _0x39dd21;});}else{return _0x39dd21;}})[_0x68ef('0x2f')](function(_0x4e097e){logger[_0x68ef('0x24')](_0x68ef('0x47'),_0x4e097e);throw _0x4e097e;});}return _0x39dd21;});}})[_0x68ef('0x18')](respondWithResult(_0x59b148,0xc9))[_0x68ef('0x2f')](handleError(_0x59b148,null));};exports[_0x68ef('0x48')]=function(_0x3d81c8,_0x5c347c){if(_0x3d81c8[_0x68ef('0x3a')]['id']){delete _0x3d81c8[_0x68ef('0x3a')]['id'];}return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3d81c8[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5c347c,null))['then'](saveUpdates(_0x3d81c8[_0x68ef('0x3a')],null))[_0x68ef('0x18')](respondWithResult(_0x5c347c,null))['catch'](handleError(_0x5c347c,null));};exports[_0x68ef('0x19')]=function(_0x114d9f,_0x3d3087){return db['VoiceQueue'][_0x68ef('0x20')]({'where':{'id':_0x114d9f['params']['id']}})['then'](handleEntityNotFound(_0x3d3087,null))[_0x68ef('0x18')](removeEntity(_0x3d3087,null))['catch'](handleError(_0x3d3087,null));};exports[_0x68ef('0x4a')]=function(_0x47c1d5,_0x100a20){var _0x9e8554={'raw':![],'where':{}};var _0x304405={};var _0x3fbd39={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x47c1d5['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x100a20,null))['then'](function(_0x2cbd99){if(_0x2cbd99){_0x304405['model']=_[_0x68ef('0x32')](db[_0x68ef('0x4c')][_0x68ef('0x29')]);_0x304405[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x47c1d5[_0x68ef('0x2c')]);_0x304405[_0x68ef('0x4d')]=_['intersection'](_0x304405[_0x68ef('0x31')],_0x304405[_0x68ef('0x2c')]);_0x9e8554[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x304405[_0x68ef('0x31')],qs['fields'](_0x47c1d5[_0x68ef('0x2c')]['fields']));_0x9e8554[_0x68ef('0x34')]=_0x9e8554['attributes']['length']?_0x9e8554[_0x68ef('0x34')]:_0x304405[_0x68ef('0x31')];if(!_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x4e')]('nolimit')){_0x9e8554[_0x68ef('0x14')]=qs['limit'](_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x9e8554[_0x68ef('0x12')]=qs['offset'](_0x47c1d5['query'][_0x68ef('0x12')]);}_0x9e8554[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x47c1d5[_0x68ef('0x2c')]['sort']);_0x9e8554[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x47c1d5[_0x68ef('0x2c')],_0x304405['filters']));_0x9e8554[_0x68ef('0x51')]['VoiceQueueId']=_0x2cbd99['id'];if(_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x9e8554[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x9e8554[_0x68ef('0x51')],{'$or':_['map'](_0x9e8554[_0x68ef('0x34')],function(_0x2caed7){var _0x147695={};_0x147695[_0x2caed7]={'$like':'%'+_0x47c1d5['query'][_0x68ef('0x53')]+'%'};return _0x147695;})});}_0x9e8554=_['merge']({},_0x9e8554,_0x47c1d5[_0x68ef('0x38')]);return db['CmHopper']['count']({'where':_0x9e8554[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x38c117){_0x3fbd39[_0x68ef('0x15')]=_0x38c117;if(_0x47c1d5['query'][_0x68ef('0x42')]){_0x9e8554[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x4c')]['findAll'](_0x9e8554);})[_0x68ef('0x18')](function(_0x2db826){_0x3fbd39[_0x68ef('0x2e')]=_0x2db826;return _0x3fbd39;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x100a20,_0x9e8554))[_0x68ef('0x2f')](handleError(_0x100a20,null));};exports[_0x68ef('0x54')]=function(_0x139557,_0xfe72dc){var _0x156ce3={'raw':!![],'where':{}};var _0x11feff={};var _0x454999={'count':0x0,'rows':[]};return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x139557[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0xfe72dc,null))['then'](function(_0x513c69){if(_0x513c69){_0x11feff[_0x68ef('0x31')]=_['keys'](db[_0x68ef('0x55')][_0x68ef('0x29')]);_0x11feff['query']=_['keys'](_0x139557[_0x68ef('0x2c')]);_0x11feff['filters']=_[_0x68ef('0x33')](_0x11feff['model'],_0x11feff[_0x68ef('0x2c')]);_0x156ce3['attributes']=_[_0x68ef('0x33')](_0x11feff[_0x68ef('0x31')],qs['fields'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x156ce3[_0x68ef('0x34')]=_0x156ce3[_0x68ef('0x34')]['length']?_0x156ce3[_0x68ef('0x34')]:_0x11feff[_0x68ef('0x31')];if(!_0x139557['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x156ce3[_0x68ef('0x14')]=qs['limit'](_0x139557[_0x68ef('0x2c')]['limit']);_0x156ce3[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x139557['query']['offset']);}_0x156ce3['order']=qs['sort'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x156ce3[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x139557[_0x68ef('0x2c')],_0x11feff[_0x68ef('0x4d')]));_0x156ce3[_0x68ef('0x51')][_0x68ef('0x57')]=_0x513c69['id'];if(_0x139557[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x156ce3[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x156ce3['where'],{'$or':_[_0x68ef('0x1e')](_0x156ce3['attributes'],function(_0x791181){var _0x5b39a8={};_0x5b39a8[_0x791181]={'$like':'%'+_0x139557['query'][_0x68ef('0x53')]+'%'};return _0x5b39a8;})});}_0x156ce3=_[_0x68ef('0x37')]({},_0x156ce3,_0x139557[_0x68ef('0x38')]);return db[_0x68ef('0x55')]['count']({'where':_0x156ce3['where']})[_0x68ef('0x18')](function(_0x308997){_0x454999[_0x68ef('0x15')]=_0x308997;if(_0x139557['query'][_0x68ef('0x42')]){_0x156ce3[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x55')][_0x68ef('0x2d')](_0x156ce3);})['then'](function(_0x214e89){_0x454999[_0x68ef('0x2e')]=_0x214e89;return _0x454999;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0xfe72dc,_0x156ce3))[_0x68ef('0x2f')](handleError(_0xfe72dc,null));};exports[_0x68ef('0x58')]=function(_0x346049,_0x489ca6){var _0x2a72e8={'raw':!![],'where':{}};var _0x49844f={};var _0xea97f4={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x346049[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x489ca6,null))[_0x68ef('0x18')](function(_0x4c47ab){if(_0x4c47ab){_0x49844f[_0x68ef('0x31')]=_[_0x68ef('0x32')](db['CmHopperFinal']['rawAttributes']);_0x49844f[_0x68ef('0x2c')]=_['keys'](_0x346049[_0x68ef('0x2c')]);_0x49844f['filters']=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],_0x49844f[_0x68ef('0x2c')]);_0x2a72e8[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],qs['fields'](_0x346049[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x2a72e8[_0x68ef('0x34')]=_0x2a72e8[_0x68ef('0x34')][_0x68ef('0x36')]?_0x2a72e8[_0x68ef('0x34')]:_0x49844f[_0x68ef('0x31')];if(!_0x346049['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x2a72e8[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x346049[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x2a72e8[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x346049[_0x68ef('0x2c')]['offset']);}_0x2a72e8[_0x68ef('0x4f')]=qs['sort'](_0x346049['query']['sort']);_0x2a72e8[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x346049['query'],_0x49844f['filters']));_0x2a72e8['where'][_0x68ef('0x57')]=_0x4c47ab['id'];if(_0x346049[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x2a72e8[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x2a72e8[_0x68ef('0x51')],{'$or':_['map'](_0x2a72e8[_0x68ef('0x34')],function(_0x2c7f18){var _0x1bdacc={};_0x1bdacc[_0x2c7f18]={'$like':'%'+_0x346049[_0x68ef('0x2c')]['filter']+'%'};return _0x1bdacc;})});}_0x2a72e8=_[_0x68ef('0x37')]({},_0x2a72e8,_0x346049[_0x68ef('0x38')]);return db[_0x68ef('0x59')][_0x68ef('0x15')]({'where':_0x2a72e8[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x6ca6f4){_0xea97f4[_0x68ef('0x15')]=_0x6ca6f4;if(_0x346049['query'][_0x68ef('0x42')]){_0x2a72e8[_0x68ef('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x68ef('0x2d')](_0x2a72e8);})[_0x68ef('0x18')](function(_0x1b9028){_0xea97f4[_0x68ef('0x2e')]=_0x1b9028;return _0xea97f4;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x489ca6,_0x2a72e8))[_0x68ef('0x2f')](handleError(_0x489ca6,null));};exports[_0x68ef('0x5a')]=function(_0x2e626c,_0x3b1781){var _0x159169={'raw':!![],'where':{}};var _0x29522c={};var _0x37bf89={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x2e626c[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3b1781,null))[_0x68ef('0x18')](function(_0x24af15){if(_0x24af15){_0x29522c['model']=_[_0x68ef('0x32')](db[_0x68ef('0x5b')][_0x68ef('0x29')]);_0x29522c[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x2e626c['query']);_0x29522c[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x29522c['model'],_0x29522c[_0x68ef('0x2c')]);_0x159169['attributes']=_['intersection'](_0x29522c['model'],qs['fields'](_0x2e626c[_0x68ef('0x2c')]['fields']));_0x159169[_0x68ef('0x34')]=_0x159169['attributes']['length']?_0x159169['attributes']:_0x29522c[_0x68ef('0x31')];if(!_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x159169[_0x68ef('0x14')]=qs['limit'](_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x159169[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x2e626c['query'][_0x68ef('0x12')]);}_0x159169['order']=qs['sort'](_0x2e626c['query'][_0x68ef('0x50')]);_0x159169[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x2e626c[_0x68ef('0x2c')],_0x29522c[_0x68ef('0x4d')]));_0x159169[_0x68ef('0x51')][_0x68ef('0x57')]=_0x24af15['id'];if(_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x159169[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x159169['where'],{'$or':_['map'](_0x159169['attributes'],function(_0x25e698){var _0x1cad59={};_0x1cad59[_0x25e698]={'$like':'%'+_0x2e626c[_0x68ef('0x2c')]['filter']+'%'};return _0x1cad59;})});}_0x159169=_[_0x68ef('0x37')]({},_0x159169,_0x2e626c['options']);return db[_0x68ef('0x5b')][_0x68ef('0x15')]({'where':_0x159169[_0x68ef('0x51')]})['then'](function(_0x304260){_0x37bf89[_0x68ef('0x15')]=_0x304260;if(_0x2e626c['query'][_0x68ef('0x42')]){_0x159169[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x5b')][_0x68ef('0x2d')](_0x159169);})[_0x68ef('0x18')](function(_0x23126a){_0x37bf89[_0x68ef('0x2e')]=_0x23126a;return _0x37bf89;});}})['then'](respondWithFilteredResult(_0x3b1781,_0x159169))[_0x68ef('0x2f')](handleError(_0x3b1781,null));};exports[_0x68ef('0x5c')]=function(_0x5a262d,_0x28cad4){var _0x424e46={};var _0x46c87e={};var _0x20a131;var _0x1b8250;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5a262d['params']['id']}})['then'](handleEntityNotFound(_0x28cad4,null))[_0x68ef('0x18')](function(_0x4dcf9e){if(_0x4dcf9e){_0x20a131=_0x4dcf9e;_0x46c87e[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x5d')][_0x68ef('0x29')]);_0x46c87e[_0x68ef('0x2c')]=_['keys'](_0x5a262d[_0x68ef('0x2c')]);_0x46c87e[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],_0x46c87e['query']);_0x424e46['attributes']=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x424e46[_0x68ef('0x34')]=_0x424e46[_0x68ef('0x34')][_0x68ef('0x36')]?_0x424e46[_0x68ef('0x34')]:_0x46c87e[_0x68ef('0x31')];_0x424e46[_0x68ef('0x4f')]=qs['sort'](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x424e46[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x5a262d[_0x68ef('0x2c')],_0x46c87e[_0x68ef('0x4d')]));if(_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x424e46[_0x68ef('0x51')]=_['merge'](_0x424e46['where'],{'$or':_[_0x68ef('0x1e')](_0x424e46[_0x68ef('0x34')],function(_0x3ef9e2){var _0x12ef69={};_0x12ef69[_0x3ef9e2]={'$like':'%'+_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0x12ef69;})});}_0x424e46=_[_0x68ef('0x37')]({},_0x424e46,_0x5a262d['options']);return _0x20a131[_0x68ef('0x5c')](_0x424e46);}})[_0x68ef('0x18')](function(_0x11c717){if(_0x11c717){_0x1b8250=_0x11c717[_0x68ef('0x36')];if(!_0x5a262d['query'][_0x68ef('0x4e')]('nolimit')){_0x424e46[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5a262d[_0x68ef('0x2c')]['limit']);_0x424e46['offset']=qs[_0x68ef('0x12')](_0x5a262d['query'][_0x68ef('0x12')]);}return _0x20a131['getTeams'](_0x424e46);}})[_0x68ef('0x18')](function(_0x426274){if(_0x426274){return _0x426274?{'count':_0x1b8250,'rows':_0x426274}:null;}})['then'](respondWithResult(_0x28cad4,null))['catch'](handleError(_0x28cad4,null));};exports[_0x68ef('0x5e')]=function(_0x1d429a,_0x4d96a9){var _0xf9f2c4=_0x1d429a[_0x68ef('0x3a')][_0x68ef('0x5f')];var _0x4ae311=_['map'](_0xf9f2c4,'id');return db[_0x68ef('0x5d')]['findAll']({'where':{'id':_0x4ae311},'attributes':['id'],'include':[{'model':db[_0x68ef('0x60')],'as':_0x68ef('0x61'),'attributes':['id',_0x68ef('0x22'),_0x68ef('0x62'),_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]}]})['then'](function(_0x48f3f6){if(_0x48f3f6){var _0x453f91=_[_0x68ef('0x65')](_0x48f3f6,function(_0x8eb711){var _0x39ab6a=_0x8eb711[_0x68ef('0x3c')]({'plain':!![]});_0x39ab6a['Agents'][_0x68ef('0x66')](function(_0x428fd5){_0x428fd5[_0x68ef('0x67')]=_[_0x68ef('0x20')](_0xf9f2c4,{'id':_0x39ab6a['id']})[_0x68ef('0x67')];});return _0x39ab6a[_0x68ef('0x61')];});return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x1d429a['params']['id']}})[_0x68ef('0x18')](function(_0x261ce6){return db[_0x68ef('0x68')][_0x68ef('0x69')](function(_0x2138cd){return _0x261ce6[_0x68ef('0x5e')](_0x4ae311,{'transaction':_0x2138cd})['then'](function(){return BPromise[_0x68ef('0x6a')](_0xf9f2c4,function(_0x13fae2){return db[_0x68ef('0x6b')][_0x68ef('0x6c')]({'TeamId':_0x13fae2['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id'],'penalty':_0x13fae2['penalty']},{'transaction':_0x2138cd});});})[_0x68ef('0x18')](function(){return BPromise[_0x68ef('0x6a')](_0x453f91,function(_0x5d156e){return db['UserVoiceQueue'][_0x68ef('0x6d')]({'where':{'UserId':_0x5d156e['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id']},'defaults':{'penalty':_0x5d156e[_0x68ef('0x67')]},'transaction':_0x2138cd});});})['then'](function(){return BPromise['each'](_[_0x68ef('0x53')](_0x453f91,{'online':!![]}),function(_0x10a3f9){return db[_0x68ef('0x6e')][_0x68ef('0x6c')]({'membername':_0x10a3f9[_0x68ef('0x22')],'UserId':_0x10a3f9['id'],'queue_name':_0x261ce6[_0x68ef('0x22')],'VoiceQueueId':_0x261ce6['id'],'interface':_[_0x68ef('0x6f')](_0x10a3f9[_0x68ef('0x64')])?util[_0x68ef('0x70')](_0x68ef('0x71'),_0x10a3f9[_0x68ef('0x22')]):_0x10a3f9[_0x68ef('0x64')],'paused':_0x10a3f9[_0x68ef('0x63')]||![],'penalty':_0x10a3f9[_0x68ef('0x67')]},{'transaction':_0x2138cd});});})['then'](function(){_0x453f91['forEach'](function(_0x503219){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':_0x503219['id'],'VoiceQueueId':_0x261ce6['id']});});});});});}})[_0x68ef('0x18')](respondWithStatusCode(_0x4d96a9,null))['catch'](handleError(_0x4d96a9,null));};exports[_0x68ef('0x74')]=function(_0x3713e0,_0x5af5d0){return db['Team'][_0x68ef('0x2d')]({'where':{'id':_0x3713e0[_0x68ef('0x2c')][_0x68ef('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x68ef('0x61'),'attributes':['id'],'raw':!![]}]})[_0x68ef('0x18')](handleEntityNotFound(_0x5af5d0,null))[_0x68ef('0x18')](function(_0x48959f){var _0x1bb11f=_['map'](_0x48959f,'id');var _0x211d51=[];var _0x3e37e3=[];var _0x5168cd=squel[_0x68ef('0x76')]();_0x5168cd[_0x68ef('0x77')](_0x68ef('0x78'))[_0x68ef('0x79')](_0x68ef('0x7a'),'tq')[_0x68ef('0x7b')](_0x68ef('0x7c'),'ut',_0x68ef('0x7d'))[_0x68ef('0x51')]('VoiceQueueId\x20=\x20?',_0x3713e0[_0x68ef('0x49')]['id']);for(var _0x121a0f=0x0;_0x121a0f<_0x48959f[_0x68ef('0x36')];_0x121a0f+=0x1){let _0x465198=_0x48959f[_0x121a0f];for(var _0x3e3775=0x0;_0x3e3775<_0x465198[_0x68ef('0x61')][_0x68ef('0x36')];_0x3e3775+=0x1){let _0x4906d2=_0x465198['Agents'][_0x3e3775];var _0x1e8577=_0x5168cd['clone']();_0x1e8577[_0x68ef('0x51')](_0x68ef('0x7e'),_0x4906d2['id']);_0x3e37e3[_0x68ef('0x7f')](db[_0x68ef('0x68')]['query'](_0x1e8577[_0x68ef('0x80')](),{'type':db[_0x68ef('0x68')][_0x68ef('0x81')]['SELECT']})[_0x68ef('0x18')](function(_0xe82f3a){if(_0xe82f3a['length']===0x1){return _0x4906d2['id'];}else{var _0x3c3933=_[_0x68ef('0x82')](_['map'](_0xe82f3a,'TeamId'),function(_0x522ef7){return _[_0x68ef('0x83')](_0x1bb11f,_0x522ef7);});if(_0x3c3933){return _0x4906d2['id'];}}}));}}return BPromise[_0x68ef('0x84')](_0x3e37e3)[_0x68ef('0x18')](function(_0x3e92e0){_0x211d51=_(_0x211d51)[_0x68ef('0x85')](_0x3e92e0)[_0x68ef('0x86')]()[_0x68ef('0x1f')]();return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3713e0['params']['id']}})[_0x68ef('0x18')](function(_0x62a830){return db['sequelize'][_0x68ef('0x69')](function(_0x2374fa){return _0x62a830[_0x68ef('0x74')](_0x3713e0['query'][_0x68ef('0x75')],{'transaction':_0x2374fa})['then'](function(){if(!_[_0x68ef('0x87')](_0x211d51)){return _0x62a830[_0x68ef('0x88')](_0x211d51,{'transaction':_0x2374fa})[_0x68ef('0x18')](function(){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x3713e0[_0x68ef('0x49')]['id'],'UserId':_0x211d51},'transaction':_0x2374fa});});}})[_0x68ef('0x18')](function(){_0x211d51[_0x68ef('0x66')](function(_0x491464){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':_0x491464,'VoiceQueueId':_0x62a830['id']});});});});});});})['then'](respondWithStatusCode(_0x5af5d0,null))[_0x68ef('0x2f')](handleError(_0x5af5d0,null));};exports[_0x68ef('0x8a')]=function(_0x430ef5,_0x1d3499){var _0x2b1686,_0x51c52b;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x430ef5[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1d3499,null))[_0x68ef('0x18')](function(_0x5548b1){if(_0x5548b1){_0x51c52b=_0x5548b1;return _0x5548b1[_0x68ef('0x8a')](_0x430ef5['body']['ids'],_[_0x68ef('0x43')](_0x430ef5[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{})[_0x68ef('0x8b')](function(_0x32e1e3){for(var _0x150e0d=0x0;_0x150e0d<_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]['length'];_0x150e0d+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':Number(_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')][_0x150e0d]),'VoiceQueueId':Number(_0x430ef5[_0x68ef('0x49')]['id'])});}return _0x32e1e3;});}})[_0x68ef('0x18')](function(_0x39302e){_0x2b1686=_0x39302e||[];if(_0x51c52b){return db[_0x68ef('0x60')][_0x68ef('0x2d')]({'where':{'id':_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]},'attributes':['id',_0x68ef('0x22'),'online',_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]});}})[_0x68ef('0x18')](function(_0xe4c314){if(!_['isEmpty'](_0xe4c314)){var _0xc5163d=[];for(var _0xb342e5=0x0;_0xb342e5<_0xe4c314[_0x68ef('0x36')];_0xb342e5++){if(_0xe4c314[_0xb342e5]['online']){_0xc5163d[_0x68ef('0x7f')](db['UserVoiceQueueRt'][_0x68ef('0x6c')]({'membername':_0xe4c314[_0xb342e5][_0x68ef('0x22')],'UserId':_0xe4c314[_0xb342e5]['id'],'queue_name':_0x51c52b[_0x68ef('0x22')],'VoiceQueueId':_0x51c52b['id'],'interface':_[_0x68ef('0x6f')](_0xe4c314[_0xb342e5][_0x68ef('0x64')])?util['format']('SIP/%s',_0xe4c314[_0xb342e5]['name']):_0xe4c314[_0xb342e5][_0x68ef('0x64')],'paused':_0xe4c314[_0xb342e5][_0x68ef('0x63')]||![],'penalty':_0x430ef5['body'][_0x68ef('0x67')]||0x0}));}}return BPromise[_0x68ef('0x84')](_0xc5163d);}})[_0x68ef('0x18')](function(){return _0x2b1686;})[_0x68ef('0x18')](respondWithResult(_0x1d3499,null))[_0x68ef('0x2f')](handleError(_0x1d3499,null));};exports[_0x68ef('0x88')]=function(_0x34edc4,_0x1576ac){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x34edc4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1576ac,null))[_0x68ef('0x18')](function(_0x31b61d){if(_0x31b61d){return _0x31b61d[_0x68ef('0x88')](_0x34edc4[_0x68ef('0x2c')]['ids'])[_0x68ef('0x18')](function(){if(_[_0x68ef('0x8c')](_0x34edc4['query'][_0x68ef('0x75')])){for(var _0x1774a9=0x0;_0x1774a9<_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')][_0x68ef('0x36')];_0x1774a9+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':Number(_0x34edc4['query']['ids'][_0x1774a9]),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}}else{socket[_0x68ef('0x72')]('userVoiceQueue:remove',{'UserId':Number(_0x34edc4[_0x68ef('0x2c')]['ids']),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}});}})['then'](function(_0x3054e8){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x34edc4[_0x68ef('0x49')]['id'],'UserId':_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')]}})[_0x68ef('0x18')](function(){return _0x3054e8;});})[_0x68ef('0x18')](respondWithStatusCode(_0x1576ac,null))['catch'](handleError(_0x1576ac,null));};exports[_0x68ef('0x8d')]=function(_0x60a1e7,_0x3bd9f2){var _0x3dd5f7={};var _0x35eba3={};var _0x18e166;var _0x3a6e25;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x60a1e7['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3bd9f2,null))[_0x68ef('0x18')](function(_0x33ec8e){if(_0x33ec8e){_0x18e166=_0x33ec8e;_0x35eba3['model']=_[_0x68ef('0x32')](db[_0x68ef('0x60')][_0x68ef('0x29')]);_0x35eba3[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x60a1e7[_0x68ef('0x2c')]);_0x35eba3[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],_0x35eba3[_0x68ef('0x2c')]);_0x3dd5f7[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x60a1e7[_0x68ef('0x2c')]['fields']));_0x3dd5f7[_0x68ef('0x34')]=_0x3dd5f7[_0x68ef('0x34')]['length']?_0x3dd5f7[_0x68ef('0x34')]:_0x35eba3['model'];_0x3dd5f7[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x3dd5f7[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x60a1e7[_0x68ef('0x2c')],_0x35eba3[_0x68ef('0x4d')]));if(_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x3dd5f7[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x3dd5f7['where'],{'$or':_[_0x68ef('0x1e')](_0x3dd5f7[_0x68ef('0x34')],function(_0x2cf7d3){var _0x154c78={};_0x154c78[_0x2cf7d3]={'$like':'%'+_0x60a1e7['query'][_0x68ef('0x53')]+'%'};return _0x154c78;})});}_0x3dd5f7=_[_0x68ef('0x37')]({},_0x3dd5f7,_0x60a1e7[_0x68ef('0x38')]);return _0x18e166['getAgents'](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x225067){if(_0x225067){_0x3a6e25=_0x225067[_0x68ef('0x36')];if(!_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x3dd5f7[_0x68ef('0x14')]=qs['limit'](_0x60a1e7['query'][_0x68ef('0x14')]);_0x3dd5f7[_0x68ef('0x12')]=qs['offset'](_0x60a1e7['query'][_0x68ef('0x12')]);}return _0x18e166[_0x68ef('0x8d')](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x1e1738){if(_0x1e1738){return _0x1e1738?{'count':_0x3a6e25,'rows':_0x1e1738}:null;}})[_0x68ef('0x18')](respondWithResult(_0x3bd9f2,null))[_0x68ef('0x2f')](handleError(_0x3bd9f2,null));};exports[_0x68ef('0x8e')]=function(_0x13db31,_0x58800b){var _0x4cc80a={};var _0x3452d1={};var _0x1c5b4a;var _0x33dd03;return db['VoiceQueue'][_0x68ef('0x4b')]({'where':{'id':_0x13db31[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x58800b,null))[_0x68ef('0x18')](function(_0x535c5c){if(_0x535c5c){_0x1c5b4a=_0x535c5c;_0x3452d1['model']=_[_0x68ef('0x32')](db[_0x68ef('0x6e')][_0x68ef('0x29')]);_0x3452d1['query']=_[_0x68ef('0x32')](_0x13db31[_0x68ef('0x2c')]);_0x3452d1[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],_0x3452d1[_0x68ef('0x2c')]);_0x4cc80a[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],qs['fields'](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4cc80a['attributes']=_0x4cc80a[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4cc80a[_0x68ef('0x34')]:_0x3452d1[_0x68ef('0x31')];_0x4cc80a['order']=qs[_0x68ef('0x50')](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x4cc80a['where']=qs[_0x68ef('0x4d')](_['pick'](_0x13db31['query'],_0x3452d1['filters']));if(_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x4cc80a['where']=_[_0x68ef('0x37')](_0x4cc80a['where'],{'$or':_['map'](_0x4cc80a[_0x68ef('0x34')],function(_0x103585){var _0xa28738={};_0xa28738[_0x103585]={'$like':'%'+_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0xa28738;})});}_0x4cc80a=_[_0x68ef('0x37')]({},_0x4cc80a,_0x13db31[_0x68ef('0x38')]);return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0xcd5609){if(_0xcd5609){_0x33dd03=_0xcd5609[_0x68ef('0x36')];if(!_0x13db31['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4cc80a['limit']=qs[_0x68ef('0x14')](_0x13db31['query'][_0x68ef('0x14')]);_0x4cc80a[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x13db31['query'][_0x68ef('0x12')]);}return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0x799597){return _0x799597?{'count':_0x33dd03,'rows':_0x799597}:null;})[_0x68ef('0x18')](respondWithResult(_0x58800b,null))[_0x68ef('0x2f')](handleError(_0x58800b,null));};exports['getLists']=function(_0x5e4ec4,_0x40c6ec){var _0x4a45f9={};var _0x16ba3d={};var _0x405008;var _0x3ecec3;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5e4ec4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x40c6ec,null))[_0x68ef('0x18')](function(_0x4d4bfa){if(_0x4d4bfa){_0x405008=_0x4d4bfa;_0x16ba3d[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')]['rawAttributes']);_0x16ba3d[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x5e4ec4[_0x68ef('0x2c')]);_0x16ba3d[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x16ba3d[_0x68ef('0x31')],_0x16ba3d[_0x68ef('0x2c')]);_0x4a45f9[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x16ba3d['model'],qs['fields'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a45f9['attributes']=_0x4a45f9[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4a45f9['attributes']:_0x16ba3d['model'];_0x4a45f9['order']=qs['sort'](_0x5e4ec4[_0x68ef('0x2c')]['sort']);_0x4a45f9[_0x68ef('0x51')]=qs['filters'](_[_0x68ef('0x52')](_0x5e4ec4[_0x68ef('0x2c')],_0x16ba3d['filters']));if(_0x5e4ec4['query']['filter']){_0x4a45f9[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x4a45f9[_0x68ef('0x51')],{'$or':_['map'](_0x4a45f9[_0x68ef('0x34')],function(_0x4898ad){var _0x22a810={};_0x22a810[_0x4898ad]={'$like':'%'+_0x5e4ec4['query'][_0x68ef('0x53')]+'%'};return _0x22a810;})});}_0x4a45f9=_[_0x68ef('0x37')]({},_0x4a45f9,_0x5e4ec4[_0x68ef('0x38')]);return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x3f9113){if(_0x3f9113){_0x3ecec3=_0x3f9113[_0x68ef('0x36')];if(!_0x5e4ec4['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4a45f9[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x4a45f9[_0x68ef('0x12')]=qs['offset'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x12')]);}return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x2a93bf){if(_0x2a93bf){return _0x2a93bf?{'count':_0x3ecec3,'rows':_0x2a93bf}:null;}})[_0x68ef('0x18')](respondWithResult(_0x40c6ec,null))[_0x68ef('0x2f')](handleError(_0x40c6ec,null));};exports[_0x68ef('0x91')]=function(_0x2d0bf5,_0x40da26){var _0x202e78=moment()[_0x68ef('0x70')]('YYYY-MM-DD\x20HH:mm:ss');var _0x253b31,_0x14b845;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x2d0bf5['params']['id']}})['then'](handleEntityNotFound(_0x40da26,null))['then'](function(_0x2e6bcf){if(_0x2e6bcf){_0x14b845=_0x2e6bcf;return _0x2e6bcf[_0x68ef('0x91')](_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0x2d0bf5['body'],['ids','id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x12dbe5){var _0x547e6d;_0x253b31=_0x12dbe5||[];var _0x575f73=[];if(_0x12dbe5){for(var _0x6dc883=0x0;_0x6dc883<_0x12dbe5[_0x68ef('0x36')];_0x6dc883+=0x1){var _0x1dcc3e=_0x12dbe5[_0x6dc883][_0x68ef('0x3c')]({'plain':!![]});_0x14b845[_0x68ef('0x92')]=_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x92')]?_0x2d0bf5['body'][_0x68ef('0x92')]:_0x14b845[_0x68ef('0x92')];switch(_0x14b845[_0x68ef('0x92')]){case _0x68ef('0x93'):_0x547e6d=squel[_0x68ef('0x94')]()['into'](_0x68ef('0x95'))[_0x68ef('0x96')](['phone',_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),'createdAt',_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id','ContactId')['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')['field'](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa1'))[_0x68ef('0x79')]('cm_hopper_final')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]()))[_0x68ef('0x51')]('phone\x20NOT\x20IN\x20(?)',squel[_0x68ef('0x76')]()[_0x68ef('0x77')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x68ef('0x51')](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id']['toString']())))[_0x68ef('0x80')]();break;case'onlyIfOpen':_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0x95'))[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),_0x68ef('0x45'),_0x68ef('0x44')],squel[_0x68ef('0x76')]()['field'](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id',_0x68ef('0x98'))['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0x2d0bf5['params']['id']['toString'](),_0x68ef('0x57'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))[_0x68ef('0x79')](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa4'))[_0x68ef('0x79')]('cm_hopper')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]())))[_0x68ef('0x80')]();break;default:_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')]('cm_hopper')[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),'VoiceQueueId','createdAt',_0x68ef('0x44')],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))['field']('id','ContactId')[_0x68ef('0x77')](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')[_0x68ef('0x77')](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))['where'](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))[_0x68ef('0x80')]();}_0x575f73[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x547e6d));}return BPromise[_0x68ef('0x84')](_0x575f73);}})[_0x68ef('0x18')](function(){var _0x54b4cc=[];var _0x59637f=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xa5'))['fromQuery']([_0x68ef('0xa6'),_0x68ef('0x9a'),_0x68ef('0xa7'),'createdAt','updatedAt'],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa8'))[_0x68ef('0x77')](_0x68ef('0xa9'))[_0x68ef('0x77')]('ci.OrderBy+1')['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0xaa'),'ci')[_0x68ef('0x7b')](_0x68ef('0x95'),'h',_0x68ef('0xab'))[_0x68ef('0x51')]('h.scheduledat=?',_0x202e78)[_0x68ef('0x51')](_0x68ef('0xac'),_0x68ef('0xad')))['toString']();_0x54b4cc[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x59637f));return BPromise[_0x68ef('0x84')](_0x54b4cc);})[_0x68ef('0x18')](function(){return _0x253b31;})[_0x68ef('0x18')](respondWithResult(_0x40da26,null))[_0x68ef('0x2f')](handleError(_0x40da26,null));};exports[_0x68ef('0xae')]=function(_0x58d5da,_0x1873b5){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x58d5da[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x1873b5,null))[_0x68ef('0x18')](function(_0x351b99){if(_0x351b99){return _0x351b99[_0x68ef('0xae')](_0x58d5da[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x5b41f0){if(_0x5b41f0){return db[_0x68ef('0x4c')]['destroy']({'where':{'ListId':_0x58d5da['query'][_0x68ef('0x75')],'VoiceQueueId':_0x58d5da[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](function(){return _0x5b41f0;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x1873b5,null))[_0x68ef('0x2f')](handleError(_0x1873b5,null));};exports[_0x68ef('0xaf')]=function(_0x3ee069,_0x5f49e9){var _0x40cd91={};var _0x848118={};var _0x794d1e;var _0x266f6c;return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x3ee069[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5f49e9,null))[_0x68ef('0x18')](function(_0x2b5994){if(_0x2b5994){_0x794d1e=_0x2b5994;_0x848118[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')][_0x68ef('0x29')]);_0x848118['query']=_[_0x68ef('0x32')](_0x3ee069[_0x68ef('0x2c')]);_0x848118[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x848118[_0x68ef('0x31')],_0x848118[_0x68ef('0x2c')]);_0x40cd91[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x848118['model'],qs[_0x68ef('0x35')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x40cd91[_0x68ef('0x34')]=_0x40cd91[_0x68ef('0x34')]['length']?_0x40cd91[_0x68ef('0x34')]:_0x848118[_0x68ef('0x31')];_0x40cd91[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x40cd91[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x3ee069[_0x68ef('0x2c')],_0x848118[_0x68ef('0x4d')]));if(_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x40cd91['where']=_[_0x68ef('0x37')](_0x40cd91[_0x68ef('0x51')],{'$or':_[_0x68ef('0x1e')](_0x40cd91[_0x68ef('0x34')],function(_0x124eda){var _0x4b738d={};_0x4b738d[_0x124eda]={'$like':'%'+_0x3ee069[_0x68ef('0x2c')]['filter']+'%'};return _0x4b738d;})});}_0x40cd91=_['merge']({},_0x40cd91,_0x3ee069[_0x68ef('0x38')]);return _0x794d1e['getBlackLists'](_0x40cd91);}})['then'](function(_0x4210c0){if(_0x4210c0){_0x266f6c=_0x4210c0['length'];if(!_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x40cd91[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x40cd91[_0x68ef('0x12')]=qs['offset'](_0x3ee069['query'][_0x68ef('0x12')]);}return _0x794d1e[_0x68ef('0xaf')](_0x40cd91);}})[_0x68ef('0x18')](function(_0x23946d){if(_0x23946d){return _0x23946d?{'count':_0x266f6c,'rows':_0x23946d}:null;}})[_0x68ef('0x18')](respondWithResult(_0x5f49e9,null))[_0x68ef('0x2f')](handleError(_0x5f49e9,null));};exports[_0x68ef('0xb0')]=function(_0xcc1765,_0x29662c){var _0x1185bd;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0xcc1765['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x29662c,null))['then'](function(_0x30876d){if(_0x30876d){return _0x30876d[_0x68ef('0xb0')](_0xcc1765[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0xcc1765[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x295b66){var _0x3455b5;_0x1185bd=_0x295b66||[];var _0xbf2168=[];if(_0x295b66){for(var _0x4cf8b6=0x0;_0x4cf8b6<_0x295b66[_0x68ef('0x36')];_0x4cf8b6+=0x1){var _0x4e3f0a=_0x295b66[_0x4cf8b6][_0x68ef('0x3c')]({'plain':!![]});_0x3455b5=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xb1'))[_0x68ef('0x96')]([_0x68ef('0x9a'),'ContactId','ListId','VoiceQueueId',_0x68ef('0x45'),_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('id','ContactId')[_0x68ef('0x77')](_0x4e3f0a[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0xcc1765[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')](_0x68ef('0xb2'),'createdAt')[_0x68ef('0x77')](_0x68ef('0xb2'),_0x68ef('0x44'))[_0x68ef('0x79')]('cm_contacts')[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x4e3f0a['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))['toString']();_0xbf2168['push'](db['sequelize'][_0x68ef('0x2c')](_0x3455b5));}return BPromise['all'](_0xbf2168);}})['then'](function(){return _0x1185bd;})[_0x68ef('0x18')](respondWithResult(_0x29662c,null))['catch'](handleError(_0x29662c,null));};exports[_0x68ef('0xb3')]=function(_0x398899,_0x8dd212){return db[_0x68ef('0x28')]['find']({'where':{'id':_0x398899[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x8dd212,null))[_0x68ef('0x18')](function(_0x57d305){if(_0x57d305){return _0x57d305[_0x68ef('0xb3')](_0x398899[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x4c6756){if(_0x4c6756){return db[_0x68ef('0x5b')]['destroy']({'where':{'ListId':_0x398899[_0x68ef('0x2c')]['ids'],'VoiceQueueId':_0x398899['params']['id']}})['then'](function(){return _0x4c6756;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x8dd212,null))[_0x68ef('0x2f')](handleError(_0x8dd212,null));}; \ No newline at end of file +var _0x5fc3=['redis','localhost','./voiceQueue.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','UserProfileResource','destroy','stack','name','index','VoiceQueue','fieldName','getOptions','where','include','findAll','rows','catch','show','params','model','keys','query','intersection','attributes','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','rawAttributes','fields','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','nolimit','order','sort','pick','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','hasOwnProperty','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','emit','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','User','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','moment','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x4da3fc,_0x30412f){var _0x5025be=function(_0x52577f){while(--_0x52577f){_0x4da3fc['push'](_0x4da3fc['shift']());}};_0x5025be(++_0x30412f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0x5fc3[_0x466bc5];return _0x138952;};'use strict';var moment=require(_0x35fc('0x0'));var BPromise=require(_0x35fc('0x1'));var util=require('util');var _=require(_0x35fc('0x2'));var squel=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var qs=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('api');var config=require(_0x35fc('0x7'));var db=require(_0x35fc('0x8'))['db'];config[_0x35fc('0x9')]=_['defaults'](config['redis'],{'host':_0x35fc('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35fc('0x9')]));require(_0x35fc('0xb'))[_0x35fc('0xc')](socket);function respondWithStatusCode(_0x1e5f90,_0x34ff19){_0x34ff19=_0x34ff19||0xcc;return function(_0xf9d3a6){if(_0xf9d3a6){return _0x1e5f90[_0x35fc('0xd')](_0x34ff19);}return _0x1e5f90['status'](_0x34ff19)[_0x35fc('0xe')]();};}function respondWithResult(_0x2a1084,_0x4fdca1){_0x4fdca1=_0x4fdca1||0xc8;return function(_0x471549){if(_0x471549){return _0x2a1084[_0x35fc('0xf')](_0x4fdca1)['json'](_0x471549);}};}function respondWithFilteredResult(_0xda83fb,_0x1a9f2b){return function(_0x5469f5){if(_0x5469f5){var _0x4cbe74=typeof _0x1a9f2b[_0x35fc('0x10')]==='undefined'&&typeof _0x1a9f2b[_0x35fc('0x11')]===_0x35fc('0x12');var _0x2a6ad2=_0x5469f5[_0x35fc('0x13')];var _0x38d9f2=_0x4cbe74?0x0:_0x1a9f2b['offset'];var _0x59507a=_0x4cbe74?_0x5469f5['count']:_0x1a9f2b['offset']+_0x1a9f2b[_0x35fc('0x11')];var _0x229d56;if(_0x59507a>=_0x2a6ad2){_0x59507a=_0x2a6ad2;_0x229d56=0xc8;}else{_0x229d56=0xce;}_0xda83fb[_0x35fc('0xf')](_0x229d56);return _0xda83fb[_0x35fc('0x14')](_0x35fc('0x15'),_0x38d9f2+'-'+_0x59507a+'/'+_0x2a6ad2)[_0x35fc('0x16')](_0x5469f5);}return null;};}function saveUpdates(_0x480851){return function(_0x26ba54){if(_0x26ba54){return _0x26ba54[_0x35fc('0x17')](_0x480851)['then'](function(_0x41e165){return _0x41e165;});}return null;};}function removeEntity(_0x363e47){return function(_0x2e513b){if(_0x2e513b){return _0x2e513b['destroy']()[_0x35fc('0x18')](function(){var _0x3c58ea=_0x2e513b[_0x35fc('0x19')]({'plain':!![]});var _0x488234=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b'),'ignore':![]},{'name':_0x35fc('0x1c'),'value':_0x35fc('0x1d'),'ignore':![]}];var _0x20ffde=_(_0x488234)[_0x35fc('0x1e')](_0x35fc('0x1f'))[_0x35fc('0x20')](_0x35fc('0x21'))[_0x35fc('0x21')]();if(_['includes'](_0x20ffde,_0x3c58ea[_0x35fc('0x22')])){return;}var _0xd5399f=_[_0x35fc('0x23')](_0x488234,[_0x35fc('0x21'),_0x3c58ea[_0x35fc('0x22')]])['name'];return db[_0x35fc('0x24')][_0x35fc('0x25')]({'where':{'type':_0xd5399f,'resourceId':_0x3c58ea['id']}})['then'](function(){return _0x2e513b;});})[_0x35fc('0x18')](function(){_0x363e47[_0x35fc('0xf')](0xcc)[_0x35fc('0xe')]();});}};}function handleEntityNotFound(_0x51cfec){return function(_0x4086e9){if(!_0x4086e9){_0x51cfec['sendStatus'](0x194);}return _0x4086e9;};}function handleError(_0x1bf180,_0xdfab9f){_0xdfab9f=_0xdfab9f||0x1f4;return function(_0x5cb986){logger['error'](_0x5cb986[_0x35fc('0x26')]);if(_0x5cb986['name']){delete _0x5cb986[_0x35fc('0x27')];}_0x1bf180[_0x35fc('0xf')](_0xdfab9f)['send'](_0x5cb986);};}exports[_0x35fc('0x28')]=function(_0x645eac,_0x383837){var _0x9f3c8a={};var _0x3735da={'count':0x0,'rows':[]};var _0x134dfa=_[_0x35fc('0x20')](db[_0x35fc('0x29')]['rawAttributes'],function(_0x1cd1ae){return{'name':_0x1cd1ae[_0x35fc('0x2a')],'type':_0x1cd1ae[_0x35fc('0x22')]['key']};});_0x9f3c8a=qs[_0x35fc('0x2b')](_0x134dfa,_0x645eac);var _0x16f067={'where':_0x9f3c8a[_0x35fc('0x2c')]};return db[_0x35fc('0x29')][_0x35fc('0x13')](_0x16f067)[_0x35fc('0x18')](function(_0x222ddb){_0x3735da[_0x35fc('0x13')]=_0x222ddb;_0x9f3c8a[_0x35fc('0x2d')]=qs[_0x35fc('0x2d')](_0x645eac['query']);return db['VoiceQueue'][_0x35fc('0x2e')](_0x9f3c8a);})['then'](function(_0x37b394){_0x3735da[_0x35fc('0x2f')]=_0x37b394;return _0x3735da;})[_0x35fc('0x18')](respondWithFilteredResult(_0x383837,_0x9f3c8a))[_0x35fc('0x30')](handleError(_0x383837,null));};exports[_0x35fc('0x31')]=function(_0x12e78f,_0x4e43b4){var _0x3fe193={'raw':![],'where':{'id':_0x12e78f[_0x35fc('0x32')]['id']}},_0x330a14={};_0x330a14[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x29')]['rawAttributes']);_0x330a14[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x12e78f[_0x35fc('0x35')]);_0x330a14['filters']=_[_0x35fc('0x36')](_0x330a14['model'],_0x330a14[_0x35fc('0x35')]);_0x3fe193[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x330a14[_0x35fc('0x33')],qs['fields'](_0x12e78f['query']['fields']));_0x3fe193[_0x35fc('0x37')]=_0x3fe193['attributes'][_0x35fc('0x38')]?_0x3fe193['attributes']:_0x330a14[_0x35fc('0x33')];if(_0x12e78f[_0x35fc('0x35')][_0x35fc('0x39')]){_0x3fe193[_0x35fc('0x2d')]=[{'all':!![]}];}_0x3fe193=_[_0x35fc('0x3a')]({},_0x3fe193,_0x12e78f[_0x35fc('0x3b')]);return db[_0x35fc('0x29')]['find'](_0x3fe193)[_0x35fc('0x18')](handleEntityNotFound(_0x4e43b4,null))[_0x35fc('0x18')](respondWithResult(_0x4e43b4,null))['catch'](handleError(_0x4e43b4,null));};exports[_0x35fc('0x3c')]=function(_0x1ccc41,_0x1aac67){return db[_0x35fc('0x29')][_0x35fc('0x3c')](_0x1ccc41[_0x35fc('0x3d')],{})['then'](function(_0x3f6480){var _0x267858=_0x1ccc41[_0x35fc('0x3e')]['get']({'plain':!![]});if(!_0x267858)throw new Error(_0x35fc('0x3f'));if(_0x267858[_0x35fc('0x40')]==='user'){var _0x237548=_0x3f6480[_0x35fc('0x19')]({'plain':!![]});var _0x43b77c=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b')},{'name':_0x35fc('0x1c'),'value':_0x35fc('0x1d')}];var _0x3ec51f=_['find'](_0x43b77c,['value',_0x237548[_0x35fc('0x22')]])[_0x35fc('0x27')];return db['UserProfileSection']['find']({'where':{'name':_0x3ec51f,'userProfileId':_0x267858['userProfileId']},'raw':!![]})[_0x35fc('0x18')](function(_0x10f98b){if(_0x10f98b&&_0x10f98b['autoAssociation']===0x0){return db[_0x35fc('0x24')][_0x35fc('0x3c')]({'name':_0x237548[_0x35fc('0x27')],'resourceId':_0x237548['id'],'type':_0x10f98b[_0x35fc('0x27')],'sectionId':_0x10f98b['id']},{})['then'](function(){return _0x3f6480;});}else{return _0x3f6480;}})['catch'](function(_0x5bf2f4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bf2f4);throw _0x5bf2f4;});}return _0x3f6480;})[_0x35fc('0x18')](respondWithResult(_0x1aac67,0xc9))[_0x35fc('0x30')](handleError(_0x1aac67,null));};exports['clone']=function(_0x119925,_0x56cf1f){var _0x13d16c={'where':{'id':_0x119925[_0x35fc('0x32')]['id']}},_0x40797d={};_0x40797d[_0x35fc('0x33')]=_[_0x35fc('0x34')](db['VoiceQueue'][_0x35fc('0x41')]);_0x13d16c[_0x35fc('0x37')]=_['intersection'](_0x40797d[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x119925[_0x35fc('0x35')][_0x35fc('0x42')]));_0x13d16c['attributes']=_0x13d16c[_0x35fc('0x37')]['length']?_0x13d16c['attributes']:_0x40797d[_0x35fc('0x33')];if(_0x119925[_0x35fc('0x35')][_0x35fc('0x39')]){_0x13d16c[_0x35fc('0x2d')]=[{'all':!![]}];}_0x13d16c=_[_0x35fc('0x3a')]({},_0x13d16c,_0x119925[_0x35fc('0x3b')]);return db[_0x35fc('0x29')][_0x35fc('0x23')](_0x13d16c)['then'](handleEntityNotFound(_0x56cf1f,null))[_0x35fc('0x18')](function(_0x91d7c0){if(_0x91d7c0){var _0xeca02e=_0x91d7c0[_0x35fc('0x19')]({'plain':!![]});_0xeca02e=qs[_0x35fc('0x43')](_0xeca02e,['id',_0x35fc('0x44'),_0x35fc('0x45')]);_0x119925[_0x35fc('0x3d')]=_[_0x35fc('0x43')](_0x119925[_0x35fc('0x3d')],['id',_0x35fc('0x44'),_0x35fc('0x45')]);return db[_0x35fc('0x29')][_0x35fc('0x3c')](_['merge'](_0xeca02e,_0x119925['body']),{'include':_0x119925[_0x35fc('0x35')][_0x35fc('0x39')]?[{'all':!![]}]:undefined})[_0x35fc('0x18')](function(_0x2bf0b0){var _0x3ee296=_0x119925[_0x35fc('0x3e')]['get']({'plain':!![]});if(!_0x3ee296)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ee296[_0x35fc('0x40')]===_0x35fc('0x3e')){var _0x395d63=_0x2bf0b0[_0x35fc('0x19')]({'plain':!![]});var _0x5b2595=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b')},{'name':'QueueCampaigns','value':_0x35fc('0x1d')}];var _0x2536d3=_['find'](_0x5b2595,[_0x35fc('0x21'),_0x395d63[_0x35fc('0x22')]])[_0x35fc('0x27')];return db[_0x35fc('0x46')]['find']({'where':{'name':_0x2536d3,'userProfileId':_0x3ee296['userProfileId']},'raw':!![]})['then'](function(_0x240338){if(_0x240338&&_0x240338[_0x35fc('0x47')]===0x0){return db['UserProfileResource'][_0x35fc('0x3c')]({'name':_0x395d63[_0x35fc('0x27')],'resourceId':_0x395d63['id'],'type':_0x240338[_0x35fc('0x27')],'sectionId':_0x240338['id']},{})[_0x35fc('0x18')](function(){return _0x2bf0b0;});}else{return _0x2bf0b0;}})[_0x35fc('0x30')](function(_0x538be0){logger[_0x35fc('0x48')](_0x35fc('0x49'),_0x538be0);throw _0x538be0;});}return _0x2bf0b0;});}})[_0x35fc('0x18')](respondWithResult(_0x56cf1f,0xc9))['catch'](handleError(_0x56cf1f,null));};exports[_0x35fc('0x17')]=function(_0x1dbf5a,_0x47fb1a){if(_0x1dbf5a[_0x35fc('0x3d')]['id']){delete _0x1dbf5a[_0x35fc('0x3d')]['id'];}return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x1dbf5a[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x47fb1a,null))[_0x35fc('0x18')](saveUpdates(_0x1dbf5a[_0x35fc('0x3d')],null))['then'](respondWithResult(_0x47fb1a,null))[_0x35fc('0x30')](handleError(_0x47fb1a,null));};exports[_0x35fc('0x25')]=function(_0x303927,_0x4fabd4){return db[_0x35fc('0x29')]['find']({'where':{'id':_0x303927['params']['id']}})['then'](handleEntityNotFound(_0x4fabd4,null))[_0x35fc('0x18')](removeEntity(_0x4fabd4,null))[_0x35fc('0x30')](handleError(_0x4fabd4,null));};exports[_0x35fc('0x4a')]=function(_0x13901c,_0x3d06b8){var _0x4bbea0={'raw':![],'where':{}};var _0x579f5a={};var _0x5353ea={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x13901c[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x3d06b8,null))[_0x35fc('0x18')](function(_0x3ef680){if(_0x3ef680){_0x579f5a['model']=_[_0x35fc('0x34')](db[_0x35fc('0x4b')][_0x35fc('0x41')]);_0x579f5a[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x13901c[_0x35fc('0x35')]);_0x579f5a[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x579f5a[_0x35fc('0x33')],_0x579f5a['query']);_0x4bbea0[_0x35fc('0x37')]=_['intersection'](_0x579f5a[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x13901c[_0x35fc('0x35')][_0x35fc('0x42')]));_0x4bbea0['attributes']=_0x4bbea0[_0x35fc('0x37')]['length']?_0x4bbea0['attributes']:_0x579f5a['model'];if(!_0x13901c[_0x35fc('0x35')]['hasOwnProperty'](_0x35fc('0x4d'))){_0x4bbea0['limit']=qs[_0x35fc('0x11')](_0x13901c['query'][_0x35fc('0x11')]);_0x4bbea0[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x13901c[_0x35fc('0x35')]['offset']);}_0x4bbea0[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x13901c[_0x35fc('0x35')]['sort']);_0x4bbea0[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x13901c[_0x35fc('0x35')],_0x579f5a[_0x35fc('0x4c')]));_0x4bbea0[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x3ef680['id'];if(_0x13901c[_0x35fc('0x35')]['filter']){_0x4bbea0[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x4bbea0[_0x35fc('0x2c')],{'$or':_['map'](_0x4bbea0[_0x35fc('0x37')],function(_0x1b76f0){var _0x586729={};_0x586729[_0x1b76f0]={'$like':'%'+_0x13901c['query'][_0x35fc('0x1e')]+'%'};return _0x586729;})});}_0x4bbea0=_['merge']({},_0x4bbea0,_0x13901c[_0x35fc('0x3b')]);return db[_0x35fc('0x4b')][_0x35fc('0x13')]({'where':_0x4bbea0[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x20ddc6){_0x5353ea[_0x35fc('0x13')]=_0x20ddc6;if(_0x13901c[_0x35fc('0x35')][_0x35fc('0x39')]){_0x4bbea0[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x4b')][_0x35fc('0x2e')](_0x4bbea0);})[_0x35fc('0x18')](function(_0x9f034e){_0x5353ea[_0x35fc('0x2f')]=_0x9f034e;return _0x5353ea;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0x3d06b8,_0x4bbea0))[_0x35fc('0x30')](handleError(_0x3d06b8,null));};exports[_0x35fc('0x52')]=function(_0x3b2160,_0x3f3f36){var _0x4ba1b0={'raw':!![],'where':{}};var _0x1797d0={};var _0x55cb69={'count':0x0,'rows':[]};return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x3b2160[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x3f3f36,null))[_0x35fc('0x18')](function(_0x3f56f4){if(_0x3f56f4){_0x1797d0[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x54')][_0x35fc('0x41')]);_0x1797d0[_0x35fc('0x35')]=_['keys'](_0x3b2160[_0x35fc('0x35')]);_0x1797d0[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x1797d0[_0x35fc('0x33')],_0x1797d0[_0x35fc('0x35')]);_0x4ba1b0[_0x35fc('0x37')]=_['intersection'](_0x1797d0[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x42')]));_0x4ba1b0[_0x35fc('0x37')]=_0x4ba1b0[_0x35fc('0x37')][_0x35fc('0x38')]?_0x4ba1b0[_0x35fc('0x37')]:_0x1797d0[_0x35fc('0x33')];if(!_0x3b2160['query'][_0x35fc('0x55')]('nolimit')){_0x4ba1b0[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x3b2160['query'][_0x35fc('0x11')]);_0x4ba1b0[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x4ba1b0[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x4ba1b0['where']=qs['filters'](_['pick'](_0x3b2160['query'],_0x1797d0[_0x35fc('0x4c')]));_0x4ba1b0[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x3f56f4['id'];if(_0x3b2160[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x4ba1b0['where']=_[_0x35fc('0x3a')](_0x4ba1b0[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x4ba1b0[_0x35fc('0x37')],function(_0x584a58){var _0x15e936={};_0x15e936[_0x584a58]={'$like':'%'+_0x3b2160[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x15e936;})});}_0x4ba1b0=_['merge']({},_0x4ba1b0,_0x3b2160[_0x35fc('0x3b')]);return db[_0x35fc('0x54')][_0x35fc('0x13')]({'where':_0x4ba1b0[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x31d276){_0x55cb69[_0x35fc('0x13')]=_0x31d276;if(_0x3b2160[_0x35fc('0x35')]['includeAll']){_0x4ba1b0[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x54')][_0x35fc('0x2e')](_0x4ba1b0);})[_0x35fc('0x18')](function(_0x221c5b){_0x55cb69[_0x35fc('0x2f')]=_0x221c5b;return _0x55cb69;});}})['then'](respondWithFilteredResult(_0x3f3f36,_0x4ba1b0))[_0x35fc('0x30')](handleError(_0x3f3f36,null));};exports['getHopperFinals']=function(_0x4855ee,_0x1a2da0){var _0x597670={'raw':!![],'where':{}};var _0x1246c7={};var _0x233b7d={'count':0x0,'rows':[]};return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x4855ee[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x1a2da0,null))[_0x35fc('0x18')](function(_0x1beb46){if(_0x1beb46){_0x1246c7[_0x35fc('0x33')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x1246c7[_0x35fc('0x35')]=_['keys'](_0x4855ee[_0x35fc('0x35')]);_0x1246c7[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x1246c7[_0x35fc('0x33')],_0x1246c7['query']);_0x597670[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x1246c7[_0x35fc('0x33')],qs['fields'](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x42')]));_0x597670[_0x35fc('0x37')]=_0x597670['attributes']['length']?_0x597670['attributes']:_0x1246c7[_0x35fc('0x33')];if(!_0x4855ee[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x597670['limit']=qs[_0x35fc('0x11')](_0x4855ee[_0x35fc('0x35')]['limit']);_0x597670['offset']=qs[_0x35fc('0x10')](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x597670['order']=qs['sort'](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x597670['where']=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x4855ee[_0x35fc('0x35')],_0x1246c7['filters']));_0x597670[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x1beb46['id'];if(_0x4855ee[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x597670['where']=_[_0x35fc('0x3a')](_0x597670[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x597670['attributes'],function(_0x96dfc){var _0x26d242={};_0x26d242[_0x96dfc]={'$like':'%'+_0x4855ee[_0x35fc('0x35')]['filter']+'%'};return _0x26d242;})});}_0x597670=_[_0x35fc('0x3a')]({},_0x597670,_0x4855ee[_0x35fc('0x3b')]);return db['CmHopperFinal'][_0x35fc('0x13')]({'where':_0x597670[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x45eaae){_0x233b7d[_0x35fc('0x13')]=_0x45eaae;if(_0x4855ee[_0x35fc('0x35')][_0x35fc('0x39')]){_0x597670[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x56')]['findAll'](_0x597670);})[_0x35fc('0x18')](function(_0x3fc6cc){_0x233b7d[_0x35fc('0x2f')]=_0x3fc6cc;return _0x233b7d;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0x1a2da0,_0x597670))['catch'](handleError(_0x1a2da0,null));};exports[_0x35fc('0x57')]=function(_0x1808a3,_0x209d7a){var _0x7b633a={'raw':!![],'where':{}};var _0x4684b6={};var _0x319998={'count':0x0,'rows':[]};return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x1808a3['params']['id']}})['then'](handleEntityNotFound(_0x209d7a,null))[_0x35fc('0x18')](function(_0xafa771){if(_0xafa771){_0x4684b6[_0x35fc('0x33')]=_['keys'](db[_0x35fc('0x58')][_0x35fc('0x41')]);_0x4684b6[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x1808a3['query']);_0x4684b6['filters']=_[_0x35fc('0x36')](_0x4684b6['model'],_0x4684b6[_0x35fc('0x35')]);_0x7b633a[_0x35fc('0x37')]=_['intersection'](_0x4684b6['model'],qs[_0x35fc('0x42')](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x42')]));_0x7b633a['attributes']=_0x7b633a[_0x35fc('0x37')][_0x35fc('0x38')]?_0x7b633a[_0x35fc('0x37')]:_0x4684b6['model'];if(!_0x1808a3[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x7b633a[_0x35fc('0x11')]=qs['limit'](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x11')]);_0x7b633a[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x7b633a['order']=qs[_0x35fc('0x4f')](_0x1808a3[_0x35fc('0x35')]['sort']);_0x7b633a[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_['pick'](_0x1808a3[_0x35fc('0x35')],_0x4684b6[_0x35fc('0x4c')]));_0x7b633a[_0x35fc('0x2c')][_0x35fc('0x51')]=_0xafa771['id'];if(_0x1808a3[_0x35fc('0x35')]['filter']){_0x7b633a[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x7b633a[_0x35fc('0x2c')],{'$or':_['map'](_0x7b633a[_0x35fc('0x37')],function(_0x5a8641){var _0x58d3d5={};_0x58d3d5[_0x5a8641]={'$like':'%'+_0x1808a3[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x58d3d5;})});}_0x7b633a=_[_0x35fc('0x3a')]({},_0x7b633a,_0x1808a3[_0x35fc('0x3b')]);return db[_0x35fc('0x58')]['count']({'where':_0x7b633a[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x44683e){_0x319998['count']=_0x44683e;if(_0x1808a3[_0x35fc('0x35')][_0x35fc('0x39')]){_0x7b633a[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x58')][_0x35fc('0x2e')](_0x7b633a);})['then'](function(_0x1a2d73){_0x319998[_0x35fc('0x2f')]=_0x1a2d73;return _0x319998;});}})['then'](respondWithFilteredResult(_0x209d7a,_0x7b633a))['catch'](handleError(_0x209d7a,null));};exports[_0x35fc('0x59')]=function(_0x44b356,_0x207336){var _0x2b16b2={};var _0x405a43={};var _0x2b2a87;var _0x8c80ca;return db['VoiceQueue']['findOne']({'where':{'id':_0x44b356[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x207336,null))[_0x35fc('0x18')](function(_0x1a92fa){if(_0x1a92fa){_0x2b2a87=_0x1a92fa;_0x405a43[_0x35fc('0x33')]=_['keys'](db['Team'][_0x35fc('0x41')]);_0x405a43[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x44b356[_0x35fc('0x35')]);_0x405a43['filters']=_['intersection'](_0x405a43[_0x35fc('0x33')],_0x405a43[_0x35fc('0x35')]);_0x2b16b2[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x405a43['model'],qs['fields'](_0x44b356[_0x35fc('0x35')][_0x35fc('0x42')]));_0x2b16b2['attributes']=_0x2b16b2[_0x35fc('0x37')][_0x35fc('0x38')]?_0x2b16b2[_0x35fc('0x37')]:_0x405a43[_0x35fc('0x33')];_0x2b16b2[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x44b356[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x2b16b2[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x44b356[_0x35fc('0x35')],_0x405a43[_0x35fc('0x4c')]));if(_0x44b356[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x2b16b2[_0x35fc('0x2c')]=_['merge'](_0x2b16b2[_0x35fc('0x2c')],{'$or':_['map'](_0x2b16b2[_0x35fc('0x37')],function(_0x5d677a){var _0x5aa072={};_0x5aa072[_0x5d677a]={'$like':'%'+_0x44b356[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x5aa072;})});}_0x2b16b2=_[_0x35fc('0x3a')]({},_0x2b16b2,_0x44b356['options']);return _0x2b2a87[_0x35fc('0x59')](_0x2b16b2);}})[_0x35fc('0x18')](function(_0xe9c7c2){if(_0xe9c7c2){_0x8c80ca=_0xe9c7c2[_0x35fc('0x38')];if(!_0x44b356[_0x35fc('0x35')][_0x35fc('0x55')]('nolimit')){_0x2b16b2['limit']=qs[_0x35fc('0x11')](_0x44b356['query']['limit']);_0x2b16b2[_0x35fc('0x10')]=qs['offset'](_0x44b356['query']['offset']);}return _0x2b2a87[_0x35fc('0x59')](_0x2b16b2);}})['then'](function(_0x355154){if(_0x355154){return _0x355154?{'count':_0x8c80ca,'rows':_0x355154}:null;}})[_0x35fc('0x18')](respondWithResult(_0x207336,null))[_0x35fc('0x30')](handleError(_0x207336,null));};exports[_0x35fc('0x5a')]=function(_0x392212,_0x201dfa){var _0x4ab6f9=_0x392212['body'][_0x35fc('0x5b')];var _0x5994ec=_[_0x35fc('0x20')](_0x4ab6f9,'id');return db[_0x35fc('0x5c')]['findAll']({'where':{'id':_0x5994ec},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x35fc('0x27'),_0x35fc('0x5d'),_0x35fc('0x5e'),_0x35fc('0x5f')],'raw':!![]}]})[_0x35fc('0x18')](function(_0x28525f){if(_0x28525f){var _0x9116b1=_[_0x35fc('0x60')](_0x28525f,function(_0x4818ea){var _0x5436a3=_0x4818ea['get']({'plain':!![]});_0x5436a3['Agents'][_0x35fc('0x61')](function(_0x4c9c90){_0x4c9c90[_0x35fc('0x62')]=_['find'](_0x4ab6f9,{'id':_0x5436a3['id']})[_0x35fc('0x62')];});return _0x5436a3[_0x35fc('0x63')];});return db['VoiceQueue']['find']({'where':{'id':_0x392212[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(_0x10ef95){return db[_0x35fc('0x64')][_0x35fc('0x65')](function(_0x4ff80c){return _0x10ef95['addTeams'](_0x5994ec,{'transaction':_0x4ff80c})[_0x35fc('0x18')](function(){return BPromise['each'](_0x4ab6f9,function(_0x15b6be){return db['TeamVoiceQueue'][_0x35fc('0x66')]({'TeamId':_0x15b6be['id'],'VoiceQueueId':_0x392212[_0x35fc('0x32')]['id'],'penalty':_0x15b6be[_0x35fc('0x62')]},{'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){return BPromise['each'](_0x9116b1,function(_0x29a77a){return db['UserVoiceQueue'][_0x35fc('0x67')]({'where':{'UserId':_0x29a77a['id'],'VoiceQueueId':_0x392212['params']['id']},'defaults':{'penalty':_0x29a77a['penalty']},'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){return BPromise['each'](_[_0x35fc('0x1e')](_0x9116b1,{'online':!![]}),function(_0x2c8361){return db[_0x35fc('0x68')][_0x35fc('0x66')]({'membername':_0x2c8361[_0x35fc('0x27')],'UserId':_0x2c8361['id'],'queue_name':_0x10ef95[_0x35fc('0x27')],'VoiceQueueId':_0x10ef95['id'],'interface':_[_0x35fc('0x69')](_0x2c8361[_0x35fc('0x5f')])?util[_0x35fc('0x6a')]('SIP/%s',_0x2c8361[_0x35fc('0x27')]):_0x2c8361[_0x35fc('0x5f')],'paused':_0x2c8361[_0x35fc('0x5e')]||![],'penalty':_0x2c8361[_0x35fc('0x62')]},{'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){_0x9116b1[_0x35fc('0x61')](function(_0x4020ae){socket[_0x35fc('0x6b')]('userVoiceQueue:save',{'UserId':_0x4020ae['id'],'VoiceQueueId':_0x10ef95['id']});});});});});}})['then'](respondWithStatusCode(_0x201dfa,null))['catch'](handleError(_0x201dfa,null));};exports['removeTeams']=function(_0x5c8419,_0x271087){return db[_0x35fc('0x5c')][_0x35fc('0x2e')]({'where':{'id':_0x5c8419[_0x35fc('0x35')][_0x35fc('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x35fc('0x63'),'attributes':['id'],'raw':!![]}]})[_0x35fc('0x18')](handleEntityNotFound(_0x271087,null))[_0x35fc('0x18')](function(_0x2f450e){var _0x370e99=_['map'](_0x2f450e,'id');var _0x195ca3=[];var _0x398359=[];var _0x4188bc=squel['select']();_0x4188bc[_0x35fc('0x6d')](_0x35fc('0x6e'))[_0x35fc('0x6f')](_0x35fc('0x70'),'tq')[_0x35fc('0x71')](_0x35fc('0x72'),'ut',_0x35fc('0x73'))[_0x35fc('0x2c')](_0x35fc('0x74'),_0x5c8419[_0x35fc('0x32')]['id']);for(var _0x3aba1c=0x0;_0x3aba1c<_0x2f450e[_0x35fc('0x38')];_0x3aba1c+=0x1){let _0x225eb1=_0x2f450e[_0x3aba1c];for(var _0x206f0b=0x0;_0x206f0b<_0x225eb1[_0x35fc('0x63')]['length'];_0x206f0b+=0x1){let _0x4ae3d8=_0x225eb1[_0x35fc('0x63')][_0x206f0b];var _0x6a0c44=_0x4188bc[_0x35fc('0x75')]();_0x6a0c44[_0x35fc('0x2c')](_0x35fc('0x76'),_0x4ae3d8['id']);_0x398359[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x6a0c44[_0x35fc('0x78')](),{'type':db[_0x35fc('0x64')][_0x35fc('0x79')][_0x35fc('0x7a')]})[_0x35fc('0x18')](function(_0x336c4a){if(_0x336c4a[_0x35fc('0x38')]===0x1){return _0x4ae3d8['id'];}else{var _0x5824a0=_[_0x35fc('0x7b')](_[_0x35fc('0x20')](_0x336c4a,_0x35fc('0x7c')),function(_0x34e007){return _[_0x35fc('0x7d')](_0x370e99,_0x34e007);});if(_0x5824a0){return _0x4ae3d8['id'];}}}));}}return BPromise[_0x35fc('0x7e')](_0x398359)[_0x35fc('0x18')](function(_0xa4c51a){_0x195ca3=_(_0x195ca3)['union'](_0xa4c51a)['compact']()[_0x35fc('0x21')]();return db[_0x35fc('0x29')]['find']({'where':{'id':_0x5c8419[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(_0x43a794){return db[_0x35fc('0x64')]['transaction'](function(_0x42912c){return _0x43a794[_0x35fc('0x7f')](_0x5c8419[_0x35fc('0x35')][_0x35fc('0x6c')],{'transaction':_0x42912c})['then'](function(){if(!_[_0x35fc('0x80')](_0x195ca3)){return _0x43a794[_0x35fc('0x81')](_0x195ca3,{'transaction':_0x42912c})['then'](function(){return db[_0x35fc('0x68')][_0x35fc('0x25')]({'where':{'VoiceQueueId':_0x5c8419[_0x35fc('0x32')]['id'],'UserId':_0x195ca3},'transaction':_0x42912c});});}})['then'](function(){_0x195ca3[_0x35fc('0x61')](function(_0x4de072){socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':_0x4de072,'VoiceQueueId':_0x43a794['id']});});});});});});})['then'](respondWithStatusCode(_0x271087,null))[_0x35fc('0x30')](handleError(_0x271087,null));};exports[_0x35fc('0x83')]=function(_0x139065,_0x25aedf){var _0x316d37,_0x3fd897;return db[_0x35fc('0x29')]['find']({'where':{'id':_0x139065['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x25aedf,null))[_0x35fc('0x18')](function(_0x2463dd){if(_0x2463dd){_0x3fd897=_0x2463dd;return _0x2463dd[_0x35fc('0x83')](_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0x139065['body'],[_0x35fc('0x6c'),'id'])||{})[_0x35fc('0x84')](function(_0x46b9b6){for(var _0x4cdc31=0x0;_0x4cdc31<_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')][_0x35fc('0x38')];_0x4cdc31+=0x1){socket[_0x35fc('0x6b')](_0x35fc('0x85'),{'UserId':Number(_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')][_0x4cdc31]),'VoiceQueueId':Number(_0x139065[_0x35fc('0x32')]['id'])});}return _0x46b9b6;});}})[_0x35fc('0x18')](function(_0x14e414){_0x316d37=_0x14e414||[];if(_0x3fd897){return db[_0x35fc('0x86')][_0x35fc('0x2e')]({'where':{'id':_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')]},'attributes':['id',_0x35fc('0x27'),_0x35fc('0x5d'),_0x35fc('0x5e'),_0x35fc('0x5f')],'raw':!![]});}})[_0x35fc('0x18')](function(_0x4949ed){if(!_[_0x35fc('0x80')](_0x4949ed)){var _0x4f74ff=[];for(var _0x28cbc8=0x0;_0x28cbc8<_0x4949ed[_0x35fc('0x38')];_0x28cbc8++){if(_0x4949ed[_0x28cbc8]['online']){_0x4f74ff[_0x35fc('0x77')](db[_0x35fc('0x68')][_0x35fc('0x66')]({'membername':_0x4949ed[_0x28cbc8][_0x35fc('0x27')],'UserId':_0x4949ed[_0x28cbc8]['id'],'queue_name':_0x3fd897[_0x35fc('0x27')],'VoiceQueueId':_0x3fd897['id'],'interface':_[_0x35fc('0x69')](_0x4949ed[_0x28cbc8][_0x35fc('0x5f')])?util[_0x35fc('0x6a')]('SIP/%s',_0x4949ed[_0x28cbc8][_0x35fc('0x27')]):_0x4949ed[_0x28cbc8][_0x35fc('0x5f')],'paused':_0x4949ed[_0x28cbc8][_0x35fc('0x5e')]||![],'penalty':_0x139065[_0x35fc('0x3d')]['penalty']||0x0}));}}return BPromise['all'](_0x4f74ff);}})['then'](function(){return _0x316d37;})['then'](respondWithResult(_0x25aedf,null))[_0x35fc('0x30')](handleError(_0x25aedf,null));};exports['removeAgents']=function(_0xcbabdf,_0x2475d6){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0xcbabdf[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x2475d6,null))[_0x35fc('0x18')](function(_0x41cbaa){if(_0x41cbaa){return _0x41cbaa[_0x35fc('0x81')](_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')])[_0x35fc('0x18')](function(){if(_[_0x35fc('0x87')](_0xcbabdf['query'][_0x35fc('0x6c')])){for(var _0x3e8580=0x0;_0x3e8580<_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]['length'];_0x3e8580+=0x1){socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':Number(_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')][_0x3e8580]),'VoiceQueueId':Number(_0xcbabdf[_0x35fc('0x32')]['id'])});}}else{socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':Number(_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]),'VoiceQueueId':Number(_0xcbabdf[_0x35fc('0x32')]['id'])});}});}})[_0x35fc('0x18')](function(_0xa39c4c){return db[_0x35fc('0x68')][_0x35fc('0x25')]({'where':{'VoiceQueueId':_0xcbabdf[_0x35fc('0x32')]['id'],'UserId':_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]}})[_0x35fc('0x18')](function(){return _0xa39c4c;});})[_0x35fc('0x18')](respondWithStatusCode(_0x2475d6,null))[_0x35fc('0x30')](handleError(_0x2475d6,null));};exports[_0x35fc('0x88')]=function(_0x11d0f4,_0x4f150a){var _0x12238e={};var _0x16b52f={};var _0x238242;var _0x452f30;return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x11d0f4[_0x35fc('0x32')]['id']}})['then'](handleEntityNotFound(_0x4f150a,null))[_0x35fc('0x18')](function(_0x156c24){if(_0x156c24){_0x238242=_0x156c24;_0x16b52f[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x86')][_0x35fc('0x41')]);_0x16b52f[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x11d0f4[_0x35fc('0x35')]);_0x16b52f[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x16b52f[_0x35fc('0x33')],_0x16b52f[_0x35fc('0x35')]);_0x12238e[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x16b52f[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x42')]));_0x12238e[_0x35fc('0x37')]=_0x12238e['attributes'][_0x35fc('0x38')]?_0x12238e[_0x35fc('0x37')]:_0x16b52f[_0x35fc('0x33')];_0x12238e['order']=qs[_0x35fc('0x4f')](_0x11d0f4[_0x35fc('0x35')]['sort']);_0x12238e['where']=qs['filters'](_[_0x35fc('0x50')](_0x11d0f4[_0x35fc('0x35')],_0x16b52f['filters']));if(_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x12238e[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x12238e[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x12238e['attributes'],function(_0x13534c){var _0x3be339={};_0x3be339[_0x13534c]={'$like':'%'+_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x3be339;})});}_0x12238e=_[_0x35fc('0x3a')]({},_0x12238e,_0x11d0f4['options']);return _0x238242[_0x35fc('0x88')](_0x12238e);}})[_0x35fc('0x18')](function(_0x52f355){if(_0x52f355){_0x452f30=_0x52f355[_0x35fc('0x38')];if(!_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x12238e[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x11')]);_0x12238e[_0x35fc('0x10')]=qs['offset'](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x238242['getAgents'](_0x12238e);}})[_0x35fc('0x18')](function(_0x4ffbf9){if(_0x4ffbf9){return _0x4ffbf9?{'count':_0x452f30,'rows':_0x4ffbf9}:null;}})[_0x35fc('0x18')](respondWithResult(_0x4f150a,null))[_0x35fc('0x30')](handleError(_0x4f150a,null));};exports[_0x35fc('0x89')]=function(_0x206491,_0x536837){var _0x3cfbd4={};var _0x3ac7fb={};var _0x3916e7;var _0x4bcc53;return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x206491[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x536837,null))[_0x35fc('0x18')](function(_0x3da024){if(_0x3da024){_0x3916e7=_0x3da024;_0x3ac7fb[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x68')][_0x35fc('0x41')]);_0x3ac7fb[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x206491[_0x35fc('0x35')]);_0x3ac7fb[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x3ac7fb[_0x35fc('0x33')],_0x3ac7fb[_0x35fc('0x35')]);_0x3cfbd4['attributes']=_[_0x35fc('0x36')](_0x3ac7fb[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x206491[_0x35fc('0x35')][_0x35fc('0x42')]));_0x3cfbd4[_0x35fc('0x37')]=_0x3cfbd4[_0x35fc('0x37')]['length']?_0x3cfbd4['attributes']:_0x3ac7fb['model'];_0x3cfbd4['order']=qs[_0x35fc('0x4f')](_0x206491['query'][_0x35fc('0x4f')]);_0x3cfbd4[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x206491[_0x35fc('0x35')],_0x3ac7fb[_0x35fc('0x4c')]));if(_0x206491['query'][_0x35fc('0x1e')]){_0x3cfbd4['where']=_[_0x35fc('0x3a')](_0x3cfbd4['where'],{'$or':_['map'](_0x3cfbd4[_0x35fc('0x37')],function(_0x472e13){var _0x2d0512={};_0x2d0512[_0x472e13]={'$like':'%'+_0x206491['query']['filter']+'%'};return _0x2d0512;})});}_0x3cfbd4=_['merge']({},_0x3cfbd4,_0x206491['options']);return _0x3916e7[_0x35fc('0x89')](_0x3cfbd4);}})[_0x35fc('0x18')](function(_0x131db6){if(_0x131db6){_0x4bcc53=_0x131db6[_0x35fc('0x38')];if(!_0x206491[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x3cfbd4[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x206491['query']['limit']);_0x3cfbd4[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x206491[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x3916e7[_0x35fc('0x89')](_0x3cfbd4);}})[_0x35fc('0x18')](function(_0x4f4c68){return _0x4f4c68?{'count':_0x4bcc53,'rows':_0x4f4c68}:null;})[_0x35fc('0x18')](respondWithResult(_0x536837,null))[_0x35fc('0x30')](handleError(_0x536837,null));};exports[_0x35fc('0x8a')]=function(_0x4f9a00,_0x5c097d){var _0x11c117={};var _0x26b1cb={};var _0x84e749;var _0x4f9685;return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x4f9a00[_0x35fc('0x32')]['id']}})['then'](handleEntityNotFound(_0x5c097d,null))[_0x35fc('0x18')](function(_0x546d2e){if(_0x546d2e){_0x84e749=_0x546d2e;_0x26b1cb[_0x35fc('0x33')]=_['keys'](db[_0x35fc('0x8b')][_0x35fc('0x41')]);_0x26b1cb['query']=_[_0x35fc('0x34')](_0x4f9a00[_0x35fc('0x35')]);_0x26b1cb['filters']=_[_0x35fc('0x36')](_0x26b1cb[_0x35fc('0x33')],_0x26b1cb[_0x35fc('0x35')]);_0x11c117[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x26b1cb[_0x35fc('0x33')],qs['fields'](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x42')]));_0x11c117[_0x35fc('0x37')]=_0x11c117[_0x35fc('0x37')][_0x35fc('0x38')]?_0x11c117['attributes']:_0x26b1cb[_0x35fc('0x33')];_0x11c117[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x11c117[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x4f9a00[_0x35fc('0x35')],_0x26b1cb['filters']));if(_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x11c117[_0x35fc('0x2c')]=_['merge'](_0x11c117[_0x35fc('0x2c')],{'$or':_['map'](_0x11c117[_0x35fc('0x37')],function(_0x413a4b){var _0x599121={};_0x599121[_0x413a4b]={'$like':'%'+_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x599121;})});}_0x11c117=_[_0x35fc('0x3a')]({},_0x11c117,_0x4f9a00[_0x35fc('0x3b')]);return _0x84e749[_0x35fc('0x8a')](_0x11c117);}})[_0x35fc('0x18')](function(_0x411d09){if(_0x411d09){_0x4f9685=_0x411d09['length'];if(!_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x11c117['limit']=qs['limit'](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x11')]);_0x11c117[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x84e749[_0x35fc('0x8a')](_0x11c117);}})[_0x35fc('0x18')](function(_0x214f01){if(_0x214f01){return _0x214f01?{'count':_0x4f9685,'rows':_0x214f01}:null;}})[_0x35fc('0x18')](respondWithResult(_0x5c097d,null))[_0x35fc('0x30')](handleError(_0x5c097d,null));};exports[_0x35fc('0x8c')]=function(_0xae43b4,_0x3c5524){var _0x2ceb04=moment()[_0x35fc('0x6a')](_0x35fc('0x8d'));var _0x605f3b,_0x43bb43;return db['VoiceQueue'][_0x35fc('0x23')]({'where':{'id':_0xae43b4['params']['id']}})['then'](handleEntityNotFound(_0x3c5524,null))[_0x35fc('0x18')](function(_0x1d7881){if(_0x1d7881){_0x43bb43=_0x1d7881;return _0x1d7881[_0x35fc('0x8c')](_0xae43b4[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0xae43b4[_0x35fc('0x3d')],[_0x35fc('0x6c'),'id'])||{});}return null;})[_0x35fc('0x84')](function(_0x3e0ebb){var _0x138fe5;_0x605f3b=_0x3e0ebb||[];var _0x3033a0=[];if(_0x3e0ebb){for(var _0x228bb9=0x0;_0x228bb9<_0x3e0ebb[_0x35fc('0x38')];_0x228bb9+=0x1){var _0x163afe=_0x3e0ebb[_0x228bb9][_0x35fc('0x19')]({'plain':!![]});_0x43bb43[_0x35fc('0x8e')]=_0xae43b4[_0x35fc('0x3d')][_0x35fc('0x8e')]?_0xae43b4[_0x35fc('0x3d')]['dialCheckDuplicateType']:_0x43bb43[_0x35fc('0x8e')];switch(_0x43bb43[_0x35fc('0x8e')]){case _0x35fc('0x8f'):_0x138fe5=squel['insert']()[_0x35fc('0x90')](_0x35fc('0x91'))[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),_0x35fc('0x95'),'VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel['select']()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','scheduledAt')['field']('id','ContactId')[_0x35fc('0x6d')](_0x163afe[_0x35fc('0x97')]['toString'](),_0x35fc('0x95'))[_0x35fc('0x6d')](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','updatedAt')[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')](_0x35fc('0x9a'),_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())['where'](_0x35fc('0x9b'))['where'](_0x35fc('0x9c'),squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x9e'))[_0x35fc('0x6f')](_0x35fc('0x9f'))['where']('VoiceQueueId\x20=\x20?',_0xae43b4['params']['id'][_0x35fc('0x78')]()))[_0x35fc('0x2c')](_0x35fc('0x9c'),squel['select']()[_0x35fc('0x6d')](_0x35fc('0xa0'))[_0x35fc('0x6f')](_0x35fc('0x91'))[_0x35fc('0x2c')](_0x35fc('0x74'),_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')]())))[_0x35fc('0x78')]();break;case _0x35fc('0xa1'):_0x138fe5=squel[_0x35fc('0xa2')]()['into'](_0x35fc('0x91'))[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),'ListId','VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x93'))['field']('id',_0x35fc('0x94'))[_0x35fc('0x6d')](_0x163afe[_0x35fc('0x97')]['toString'](),_0x35fc('0x95'))['field'](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x45'))['from']('cm_contacts')[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')]('ListId\x20=\x20?',_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())[_0x35fc('0x2c')](_0x35fc('0x9b'))[_0x35fc('0x2c')](_0x35fc('0x9c'),squel[_0x35fc('0x9d')]()['field']('COALESCE(phone,\x27\x27)')[_0x35fc('0x6f')](_0x35fc('0x91'))['where'](_0x35fc('0x74'),_0xae43b4['params']['id'][_0x35fc('0x78')]())))[_0x35fc('0x78')]();break;default:_0x138fe5=squel[_0x35fc('0xa2')]()[_0x35fc('0x90')]('cm_hopper')[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),_0x35fc('0x95'),'VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x93'))[_0x35fc('0x6d')]('id','ContactId')[_0x35fc('0x6d')](_0x163afe['CmListId']['toString'](),'ListId')[_0x35fc('0x6d')](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x45'))[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))['where'](_0x35fc('0x9a'),_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())[_0x35fc('0x2c')](_0x35fc('0x9b')))[_0x35fc('0x78')]();}_0x3033a0[_0x35fc('0x77')](db['sequelize'][_0x35fc('0x35')](_0x138fe5));}return BPromise['all'](_0x3033a0);}})[_0x35fc('0x18')](function(){var _0x477d70=[];var _0x28533f=squel['insert']()[_0x35fc('0x90')](_0x35fc('0xa3'))[_0x35fc('0x92')]([_0x35fc('0xa4'),_0x35fc('0x96'),_0x35fc('0xa5'),'createdAt',_0x35fc('0x45')],squel['select']()[_0x35fc('0x6d')]('h.id')['field'](_0x35fc('0xa6'))[_0x35fc('0x6d')]('ci.OrderBy+1')[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','updatedAt')[_0x35fc('0x6f')](_0x35fc('0xa7'),'ci')[_0x35fc('0x71')]('cm_hopper','h',_0x35fc('0xa8'))[_0x35fc('0x2c')](_0x35fc('0xa9'),_0x2ceb04)[_0x35fc('0x2c')](_0x35fc('0xaa'),_0x35fc('0xab')))[_0x35fc('0x78')]();_0x477d70[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x28533f));return BPromise[_0x35fc('0x7e')](_0x477d70);})[_0x35fc('0x18')](function(){return _0x605f3b;})[_0x35fc('0x18')](respondWithResult(_0x3c5524,null))[_0x35fc('0x30')](handleError(_0x3c5524,null));};exports['removeLists']=function(_0x57b3f1,_0x8fa3cf){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x57b3f1[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x8fa3cf,null))[_0x35fc('0x18')](function(_0x293c2d){if(_0x293c2d){return _0x293c2d[_0x35fc('0xac')](_0x57b3f1[_0x35fc('0x35')][_0x35fc('0x6c')]);}})['then'](function(_0x4860b4){if(_0x4860b4){return db[_0x35fc('0x4b')][_0x35fc('0x25')]({'where':{'ListId':_0x57b3f1[_0x35fc('0x35')][_0x35fc('0x6c')],'VoiceQueueId':_0x57b3f1[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(){return _0x4860b4;});}})[_0x35fc('0x18')](respondWithStatusCode(_0x8fa3cf,null))[_0x35fc('0x30')](handleError(_0x8fa3cf,null));};exports[_0x35fc('0xad')]=function(_0x55d140,_0x488cea){var _0x1a5f12={};var _0x4c40e5={};var _0x3afdf3;var _0x3b64de;return db['VoiceQueue'][_0x35fc('0x53')]({'where':{'id':_0x55d140['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x488cea,null))[_0x35fc('0x18')](function(_0xa46452){if(_0xa46452){_0x3afdf3=_0xa46452;_0x4c40e5[_0x35fc('0x33')]=_[_0x35fc('0x34')](db['CmList'][_0x35fc('0x41')]);_0x4c40e5[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x55d140['query']);_0x4c40e5[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x4c40e5[_0x35fc('0x33')],_0x4c40e5['query']);_0x1a5f12[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x4c40e5[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x42')]));_0x1a5f12[_0x35fc('0x37')]=_0x1a5f12[_0x35fc('0x37')][_0x35fc('0x38')]?_0x1a5f12[_0x35fc('0x37')]:_0x4c40e5[_0x35fc('0x33')];_0x1a5f12[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x1a5f12[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x55d140[_0x35fc('0x35')],_0x4c40e5[_0x35fc('0x4c')]));if(_0x55d140['query'][_0x35fc('0x1e')]){_0x1a5f12[_0x35fc('0x2c')]=_['merge'](_0x1a5f12[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x1a5f12[_0x35fc('0x37')],function(_0x55c126){var _0x9e7561={};_0x9e7561[_0x55c126]={'$like':'%'+_0x55d140[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x9e7561;})});}_0x1a5f12=_[_0x35fc('0x3a')]({},_0x1a5f12,_0x55d140[_0x35fc('0x3b')]);return _0x3afdf3[_0x35fc('0xad')](_0x1a5f12);}})[_0x35fc('0x18')](function(_0x5545e9){if(_0x5545e9){_0x3b64de=_0x5545e9[_0x35fc('0x38')];if(!_0x55d140[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x1a5f12[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x11')]);_0x1a5f12['offset']=qs['offset'](_0x55d140[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x3afdf3['getBlackLists'](_0x1a5f12);}})[_0x35fc('0x18')](function(_0x2c1181){if(_0x2c1181){return _0x2c1181?{'count':_0x3b64de,'rows':_0x2c1181}:null;}})[_0x35fc('0x18')](respondWithResult(_0x488cea,null))[_0x35fc('0x30')](handleError(_0x488cea,null));};exports[_0x35fc('0xae')]=function(_0x3f7fd7,_0x5e16f1){var _0xa46ffd;return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x3f7fd7[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x5e16f1,null))[_0x35fc('0x18')](function(_0x4abeb5){if(_0x4abeb5){return _0x4abeb5[_0x35fc('0xae')](_0x3f7fd7[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0x3f7fd7[_0x35fc('0x3d')],[_0x35fc('0x6c'),'id'])||{});}return null;})[_0x35fc('0x84')](function(_0x4007f9){var _0x58d0b1;_0xa46ffd=_0x4007f9||[];var _0x4bf83e=[];if(_0x4007f9){for(var _0x1afe94=0x0;_0x1afe94<_0x4007f9[_0x35fc('0x38')];_0x1afe94+=0x1){var _0x108366=_0x4007f9[_0x1afe94][_0x35fc('0x19')]({'plain':!![]});_0x58d0b1=squel['insert']()[_0x35fc('0x90')]('cm_hopper_black')['fromQuery']([_0x35fc('0x96'),_0x35fc('0x94'),_0x35fc('0x95'),_0x35fc('0x51'),_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()['field'](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('id',_0x35fc('0x94'))['field'](_0x108366[_0x35fc('0x97')][_0x35fc('0x78')](),_0x35fc('0x95'))[_0x35fc('0x6d')](_0x3f7fd7[_0x35fc('0x32')]['id']['toString'](),_0x35fc('0x51'))[_0x35fc('0x6d')](_0x35fc('0xaf'),_0x35fc('0x44'))[_0x35fc('0x6d')]('NOW()','updatedAt')[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')](_0x35fc('0x9a'),_0x108366[_0x35fc('0x97')]['toString']())[_0x35fc('0x2c')](_0x35fc('0x9b')))['toString']();_0x4bf83e[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x58d0b1));}return BPromise[_0x35fc('0x7e')](_0x4bf83e);}})[_0x35fc('0x18')](function(){return _0xa46ffd;})[_0x35fc('0x18')](respondWithResult(_0x5e16f1,null))[_0x35fc('0x30')](handleError(_0x5e16f1,null));};exports[_0x35fc('0xb0')]=function(_0x4fd3d4,_0x2dff64){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x4fd3d4['params']['id']}})['then'](handleEntityNotFound(_0x2dff64,null))[_0x35fc('0x18')](function(_0x409a32){if(_0x409a32){return _0x409a32['removeBlackLists'](_0x4fd3d4[_0x35fc('0x35')][_0x35fc('0x6c')]);}})[_0x35fc('0x18')](function(_0x2c0bf5){if(_0x2c0bf5){return db['CmHopperBlack'][_0x35fc('0x25')]({'where':{'ListId':_0x4fd3d4['query']['ids'],'VoiceQueueId':_0x4fd3d4[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(){return _0x2c0bf5;});}})[_0x35fc('0x18')](respondWithStatusCode(_0x2dff64,null))[_0x35fc('0x30')](handleError(_0x2dff64,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 3212661..d37d6f9 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 _0x4bca=['save','emit','hasOwnProperty','exports','events','VoiceQueue','setMaxListeners'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4bca,0xc8));var _0xa4bc=function(_0x4e1a36,_0x5346d1){_0x4e1a36=_0x4e1a36-0x0;var _0x2ccb03=_0x4bca[_0x4e1a36];return _0x2ccb03;};'use strict';var EventEmitter=require(_0xa4bc('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xa4bc('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa4bc('0x2')](0x0);var events={'afterCreate':_0xa4bc('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5903da){return function(_0x37e2f5,_0xc9ca16,_0x17380a){VoiceQueueEvents[_0xa4bc('0x4')](_0x5903da+':'+_0x37e2f5['id'],_0x37e2f5);VoiceQueueEvents[_0xa4bc('0x4')](_0x5903da,_0x37e2f5);_0x17380a(null);};}for(var e in events){if(events[_0xa4bc('0x5')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xa4bc('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0x48e6=['exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4e23d8,_0x1495d7){var _0x99d01b=function(_0x8be219){while(--_0x8be219){_0x4e23d8['push'](_0x4e23d8['shift']());}};_0x99d01b(++_0x1495d7);}(_0x48e6,0xdd));var _0x648e=function(_0x532556,_0x36817f){_0x532556=_0x532556-0x0;var _0x57815f=_0x48e6[_0x532556];return _0x57815f;};'use strict';var EventEmitter=require(_0x648e('0x0'));var VoiceQueue=require(_0x648e('0x1'))['db'][_0x648e('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x648e('0x3')](0x0);var events={'afterCreate':_0x648e('0x4'),'afterUpdate':_0x648e('0x5'),'afterDestroy':_0x648e('0x6')};function emitEvent(_0xcea1fc){return function(_0x23b1c4,_0x20a5f5,_0x1430fd){VoiceQueueEvents[_0x648e('0x7')](_0xcea1fc+':'+_0x23b1c4['id'],_0x23b1c4);VoiceQueueEvents[_0x648e('0x7')](_0xcea1fc,_0x23b1c4);_0x1430fd(null);};}for(var e in events){if(events[_0x648e('0x8')](e)){var event=events[e];VoiceQueue[_0x648e('0x9')](e,emitEvent(event));}}module[_0x648e('0xa')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index e5e7018..825cf3f 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0xc81f5f,_0x181205){var _0x4410dc=function(_0x3cf9a5){while(--_0x3cf9a5){_0xc81f5f['push'](_0xc81f5f['shift']());}};_0x4410dc(++_0x181205);}(_0x3e74,0x175));var _0x43e7=function(_0x31f05a,_0x1ed5bc){_0x31f05a=_0x31f05a-0x0;var _0x4cc987=_0x3e74[_0x31f05a];return _0x4cc987;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5cc169,_0x3fb1d5){var _0x274ad8=function(_0x15fef2){while(--_0x15fef2){_0x5cc169['push'](_0x5cc169['shift']());}};_0x274ad8(++_0x3fb1d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index d5b2c82..145f20e 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 _0xf2f5=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceQueue','stringify','find','ShowVoiceQueue','lodash','moment'];(function(_0xe539b9,_0xa9cc64){var _0x266fcc=function(_0x1371ce){while(--_0x1371ce){_0xe539b9['push'](_0xe539b9['shift']());}};_0x266fcc(++_0xa9cc64);}(_0xf2f5,0x7c));var _0x5f2f=function(_0x5a814c,_0x14f061){_0x5a814c=_0x5a814c-0x0;var _0x5c2d09=_0xf2f5[_0x5a814c];return _0x5c2d09;};'use strict';var _=require(_0x5f2f('0x0'));var util=require('util');var moment=require(_0x5f2f('0x1'));var BPromise=require(_0x5f2f('0x2'));var rs=require(_0x5f2f('0x3'));var fs=require('fs');var Redis=require(_0x5f2f('0x4'));var db=require(_0x5f2f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f2f('0x6'))(_0x5f2f('0x7'));var config=require('../../config/environment');var jayson=require(_0x5f2f('0x8'));var client=jayson[_0x5f2f('0x9')][_0x5f2f('0xa')]({'port':0x232a});config['redis']=_[_0x5f2f('0xb')](config[_0x5f2f('0xc')],{'host':_0x5f2f('0xd'),'port':0x18eb});var socket=require(_0x5f2f('0xe'))(new Redis(config['redis']));require(_0x5f2f('0xf'))[_0x5f2f('0x10')](socket);function respondWithRpcPromise(_0x48563e,_0x27f51c,_0x423a83){return new BPromise(function(_0x588660,_0x3a1384){return client[_0x5f2f('0x11')](_0x48563e,_0x423a83)[_0x5f2f('0x12')](function(_0x930d10){logger[_0x5f2f('0x13')](_0x5f2f('0x14'),_0x27f51c,_0x5f2f('0x15'));logger[_0x5f2f('0x16')](_0x5f2f('0x17'),_0x27f51c,_0x5f2f('0x15'),JSON['stringify'](_0x930d10));if(_0x930d10[_0x5f2f('0x18')]){if(_0x930d10[_0x5f2f('0x18')][_0x5f2f('0x19')]===0x1f4){logger[_0x5f2f('0x18')](_0x5f2f('0x14'),_0x27f51c,_0x930d10[_0x5f2f('0x18')][_0x5f2f('0x1a')]);return _0x3a1384(_0x930d10[_0x5f2f('0x18')][_0x5f2f('0x1a')]);}logger[_0x5f2f('0x18')](_0x5f2f('0x14'),_0x27f51c,_0x930d10[_0x5f2f('0x18')]['message']);return _0x588660(_0x930d10[_0x5f2f('0x18')][_0x5f2f('0x1a')]);}else{logger[_0x5f2f('0x13')](_0x5f2f('0x14'),_0x27f51c,_0x5f2f('0x15'));_0x588660(_0x930d10['result'][_0x5f2f('0x1a')]);}})[_0x5f2f('0x1b')](function(_0x108307){logger['error'](_0x5f2f('0x14'),_0x27f51c,_0x108307);_0x3a1384(_0x108307);});});}exports['GetVoiceQueue']=function(_0x4a88f9){var _0x283935=this;return new Promise(function(_0x482859,_0x5105c5){return db[_0x5f2f('0x1c')][_0x5f2f('0x1d')]({'raw':_0x4a88f9[_0x5f2f('0x1e')]?_0x4a88f9[_0x5f2f('0x1e')][_0x5f2f('0x1f')]===undefined?!![]:![]:!![],'where':_0x4a88f9[_0x5f2f('0x1e')]?_0x4a88f9['options'][_0x5f2f('0x20')]||null:null,'attributes':_0x4a88f9[_0x5f2f('0x1e')]?_0x4a88f9[_0x5f2f('0x1e')][_0x5f2f('0x21')]||null:null,'limit':_0x4a88f9[_0x5f2f('0x1e')]?_0x4a88f9[_0x5f2f('0x1e')][_0x5f2f('0x22')]||null:null,'include':_0x4a88f9[_0x5f2f('0x1e')]?_0x4a88f9[_0x5f2f('0x1e')]['include']?_['map'](_0x4a88f9[_0x5f2f('0x1e')]['include'],function(_0x310d8b){return{'model':db[_0x310d8b['model']],'as':_0x310d8b['as'],'attributes':_0x310d8b[_0x5f2f('0x21')],'include':_0x310d8b[_0x5f2f('0x23')]?_[_0x5f2f('0x24')](_0x310d8b['include'],function(_0xc9f284){return{'model':db[_0xc9f284[_0x5f2f('0x25')]],'as':_0xc9f284['as'],'attributes':_0xc9f284[_0x5f2f('0x21')],'include':_0xc9f284[_0x5f2f('0x23')]?_['map'](_0xc9f284[_0x5f2f('0x23')],function(_0x214dd6){return{'model':db[_0x214dd6[_0x5f2f('0x25')]],'as':_0x214dd6['as'],'attributes':_0x214dd6[_0x5f2f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5f2f('0x12')](function(_0x51d8e7){logger[_0x5f2f('0x13')](_0x5f2f('0x26'),_0x4a88f9);logger['debug'](_0x5f2f('0x26'),_0x4a88f9,JSON[_0x5f2f('0x27')](_0x51d8e7));_0x482859(_0x51d8e7);})[_0x5f2f('0x1b')](function(_0x4c6def){logger['error']('GetVoiceQueue',_0x4c6def['message'],_0x4a88f9);_0x5105c5(_0x283935[_0x5f2f('0x18')](0x1f4,_0x4c6def[_0x5f2f('0x1a')]));});});};exports['ShowVoiceQueue']=function(_0x13c81e){var _0x19fd73=this;return new Promise(function(_0xa69395,_0x33458b){return db['VoiceQueue'][_0x5f2f('0x28')]({'raw':_0x13c81e[_0x5f2f('0x1e')]?_0x13c81e[_0x5f2f('0x1e')][_0x5f2f('0x1f')]===undefined?!![]:![]:!![],'where':_0x13c81e[_0x5f2f('0x1e')]?_0x13c81e['options'][_0x5f2f('0x20')]||null:null,'attributes':_0x13c81e[_0x5f2f('0x1e')]?_0x13c81e[_0x5f2f('0x1e')][_0x5f2f('0x21')]||null:null,'include':_0x13c81e[_0x5f2f('0x1e')]?_0x13c81e[_0x5f2f('0x1e')][_0x5f2f('0x23')]?_['map'](_0x13c81e[_0x5f2f('0x1e')][_0x5f2f('0x23')],function(_0x36912c){return{'model':db[_0x36912c['model']],'as':_0x36912c['as'],'attributes':_0x36912c[_0x5f2f('0x21')],'include':_0x36912c[_0x5f2f('0x23')]?_[_0x5f2f('0x24')](_0x36912c['include'],function(_0x49f249){return{'model':db[_0x49f249[_0x5f2f('0x25')]],'as':_0x49f249['as'],'attributes':_0x49f249[_0x5f2f('0x21')],'include':_0x49f249[_0x5f2f('0x23')]?_[_0x5f2f('0x24')](_0x49f249['include'],function(_0x38c351){return{'model':db[_0x38c351[_0x5f2f('0x25')]],'as':_0x38c351['as'],'attributes':_0x38c351[_0x5f2f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5f2f('0x12')](function(_0x36256a){logger[_0x5f2f('0x13')](_0x5f2f('0x29'),_0x13c81e);logger[_0x5f2f('0x16')](_0x5f2f('0x29'),_0x13c81e,JSON[_0x5f2f('0x27')](_0x36256a));_0xa69395(_0x36256a);})[_0x5f2f('0x1b')](function(_0xe353de){logger[_0x5f2f('0x18')]('ShowVoiceQueue',_0xe353de[_0x5f2f('0x1a')],_0x13c81e);_0x33458b(_0x19fd73[_0x5f2f('0x18')](0x1f4,_0xe353de['message']));});});}; \ No newline at end of file +var _0x31d2=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','info','request\x20sent','debug','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','VoiceQueue','options','raw','where','attributes','limit','include','map','model','then','GetVoiceQueue','ShowVoiceQueue','moment','bluebird'];(function(_0x5d5bcb,_0x25e2ea){var _0x4ea5eb=function(_0x36782b){while(--_0x36782b){_0x5d5bcb['push'](_0x5d5bcb['shift']());}};_0x4ea5eb(++_0x25e2ea);}(_0x31d2,0x18e));var _0x231d=function(_0xb9b1d4,_0x2220e7){_0xb9b1d4=_0xb9b1d4-0x0;var _0x47d0b0=_0x31d2[_0xb9b1d4];return _0x47d0b0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x231d('0x0'));var BPromise=require(_0x231d('0x1'));var rs=require(_0x231d('0x2'));var fs=require('fs');var Redis=require(_0x231d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x231d('0x4'));var logger=require(_0x231d('0x5'))(_0x231d('0x6'));var config=require(_0x231d('0x7'));var jayson=require(_0x231d('0x8'));var client=jayson[_0x231d('0x9')][_0x231d('0xa')]({'port':0x232a});config[_0x231d('0xb')]=_[_0x231d('0xc')](config['redis'],{'host':_0x231d('0xd'),'port':0x18eb});var socket=require(_0x231d('0xe'))(new Redis(config['redis']));require(_0x231d('0xf'))[_0x231d('0x10')](socket);function respondWithRpcPromise(_0x3e9e9e,_0x5c0eed,_0x2e4db0){return new BPromise(function(_0x4a79eb,_0x11ed50){return client[_0x231d('0x11')](_0x3e9e9e,_0x2e4db0)['then'](function(_0x14a3ba){logger[_0x231d('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x5c0eed,_0x231d('0x13'));logger[_0x231d('0x14')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x5c0eed,_0x231d('0x13'),JSON[_0x231d('0x15')](_0x14a3ba));if(_0x14a3ba[_0x231d('0x16')]){if(_0x14a3ba['error'][_0x231d('0x17')]===0x1f4){logger[_0x231d('0x16')](_0x231d('0x18'),_0x5c0eed,_0x14a3ba['error'][_0x231d('0x19')]);return _0x11ed50(_0x14a3ba[_0x231d('0x16')][_0x231d('0x19')]);}logger[_0x231d('0x16')](_0x231d('0x18'),_0x5c0eed,_0x14a3ba['error']['message']);return _0x4a79eb(_0x14a3ba[_0x231d('0x16')][_0x231d('0x19')]);}else{logger[_0x231d('0x12')](_0x231d('0x18'),_0x5c0eed,_0x231d('0x13'));_0x4a79eb(_0x14a3ba[_0x231d('0x1a')][_0x231d('0x19')]);}})[_0x231d('0x1b')](function(_0x178b6a){logger[_0x231d('0x16')](_0x231d('0x18'),_0x5c0eed,_0x178b6a);_0x11ed50(_0x178b6a);});});}exports['GetVoiceQueue']=function(_0x22513a){var _0x204dfc=this;return new Promise(function(_0x5dd9e6,_0x331788){return db[_0x231d('0x1c')]['findAll']({'raw':_0x22513a[_0x231d('0x1d')]?_0x22513a[_0x231d('0x1d')][_0x231d('0x1e')]===undefined?!![]:![]:!![],'where':_0x22513a[_0x231d('0x1d')]?_0x22513a[_0x231d('0x1d')][_0x231d('0x1f')]||null:null,'attributes':_0x22513a[_0x231d('0x1d')]?_0x22513a[_0x231d('0x1d')][_0x231d('0x20')]||null:null,'limit':_0x22513a['options']?_0x22513a['options'][_0x231d('0x21')]||null:null,'include':_0x22513a[_0x231d('0x1d')]?_0x22513a[_0x231d('0x1d')][_0x231d('0x22')]?_[_0x231d('0x23')](_0x22513a[_0x231d('0x1d')][_0x231d('0x22')],function(_0x525227){return{'model':db[_0x525227[_0x231d('0x24')]],'as':_0x525227['as'],'attributes':_0x525227[_0x231d('0x20')],'include':_0x525227[_0x231d('0x22')]?_[_0x231d('0x23')](_0x525227[_0x231d('0x22')],function(_0x49b3e9){return{'model':db[_0x49b3e9[_0x231d('0x24')]],'as':_0x49b3e9['as'],'attributes':_0x49b3e9[_0x231d('0x20')],'include':_0x49b3e9[_0x231d('0x22')]?_[_0x231d('0x23')](_0x49b3e9[_0x231d('0x22')],function(_0x5aa35d){return{'model':db[_0x5aa35d[_0x231d('0x24')]],'as':_0x5aa35d['as'],'attributes':_0x5aa35d[_0x231d('0x20')]};}):[]};}):[]};}):[]:[]})[_0x231d('0x25')](function(_0x3a5eed){logger['info'](_0x231d('0x26'),_0x22513a);logger[_0x231d('0x14')](_0x231d('0x26'),_0x22513a,JSON[_0x231d('0x15')](_0x3a5eed));_0x5dd9e6(_0x3a5eed);})['catch'](function(_0x406eb2){logger[_0x231d('0x16')](_0x231d('0x26'),_0x406eb2[_0x231d('0x19')],_0x22513a);_0x331788(_0x204dfc[_0x231d('0x16')](0x1f4,_0x406eb2[_0x231d('0x19')]));});});};exports[_0x231d('0x27')]=function(_0x232b77){var _0x39cfc6=this;return new Promise(function(_0x5c24ea,_0x25fd81){return db[_0x231d('0x1c')]['find']({'raw':_0x232b77[_0x231d('0x1d')]?_0x232b77[_0x231d('0x1d')][_0x231d('0x1e')]===undefined?!![]:![]:!![],'where':_0x232b77['options']?_0x232b77[_0x231d('0x1d')]['where']||null:null,'attributes':_0x232b77['options']?_0x232b77[_0x231d('0x1d')][_0x231d('0x20')]||null:null,'include':_0x232b77[_0x231d('0x1d')]?_0x232b77[_0x231d('0x1d')][_0x231d('0x22')]?_[_0x231d('0x23')](_0x232b77[_0x231d('0x1d')]['include'],function(_0x3646dd){return{'model':db[_0x3646dd['model']],'as':_0x3646dd['as'],'attributes':_0x3646dd['attributes'],'include':_0x3646dd[_0x231d('0x22')]?_[_0x231d('0x23')](_0x3646dd[_0x231d('0x22')],function(_0x24ac90){return{'model':db[_0x24ac90[_0x231d('0x24')]],'as':_0x24ac90['as'],'attributes':_0x24ac90[_0x231d('0x20')],'include':_0x24ac90['include']?_[_0x231d('0x23')](_0x24ac90['include'],function(_0x5cf498){return{'model':db[_0x5cf498['model']],'as':_0x5cf498['as'],'attributes':_0x5cf498[_0x231d('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a3b5d){logger[_0x231d('0x12')](_0x231d('0x27'),_0x232b77);logger['debug'](_0x231d('0x27'),_0x232b77,JSON['stringify'](_0x2a3b5d));_0x5c24ea(_0x2a3b5d);})['catch'](function(_0x2fbf81){logger[_0x231d('0x16')](_0x231d('0x27'),_0x2fbf81[_0x231d('0x19')],_0x232b77);_0x25fd81(_0x39cfc6[_0x231d('0x16')](0x1f4,_0x2fbf81[_0x231d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 00e076a..4edd251 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 _0xd2f2=['emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','remove'];(function(_0x498423,_0x5e4eff){var _0x50a5af=function(_0x572dc2){while(--_0x572dc2){_0x498423['push'](_0x498423['shift']());}};_0x50a5af(++_0x5e4eff);}(_0xd2f2,0x171));var _0x2d2f=function(_0xe4d365,_0x460c68){_0xe4d365=_0xe4d365-0x0;var _0x1297f8=_0xd2f2[_0xe4d365];return _0x1297f8;};'use strict';var VoiceQueueEvents=require(_0x2d2f('0x0'));var events=['save',_0x2d2f('0x1'),'update'];function createListener(_0x50d1d8,_0x307cf){return function(_0x39f733){_0x307cf[_0x2d2f('0x2')](_0x50d1d8,_0x39f733);};}function removeListener(_0x1e0e6b,_0x28365a){return function(){VoiceQueueEvents[_0x2d2f('0x3')](_0x1e0e6b,_0x28365a);};}exports[_0x2d2f('0x4')]=function(_0x35e3e5){for(var _0x46ae24=0x0,_0x421bfd=events[_0x2d2f('0x5')];_0x46ae24<_0x421bfd;_0x46ae24++){var _0x5b4fa2=events[_0x46ae24];var _0xcfdc6d=createListener(_0x2d2f('0x6')+_0x5b4fa2,_0x35e3e5);VoiceQueueEvents['on'](_0x5b4fa2,_0xcfdc6d);}}; \ No newline at end of file +var _0x183e=['removeListener','register','./voiceQueue.events','save','remove','update'];(function(_0x19b866,_0x274cd1){var _0x28aa24=function(_0x46e69a){while(--_0x46e69a){_0x19b866['push'](_0x19b866['shift']());}};_0x28aa24(++_0x274cd1);}(_0x183e,0x86));var _0xe183=function(_0x3522df,_0x189099){_0x3522df=_0x3522df-0x0;var _0x2b77dc=_0x183e[_0x3522df];return _0x2b77dc;};'use strict';var VoiceQueueEvents=require(_0xe183('0x0'));var events=[_0xe183('0x1'),_0xe183('0x2'),_0xe183('0x3')];function createListener(_0x2db71c,_0x16b668){return function(_0x419e66){_0x16b668['emit'](_0x2db71c,_0x419e66);};}function removeListener(_0x30f72c,_0xeb25c1){return function(){VoiceQueueEvents[_0xe183('0x4')](_0x30f72c,_0xeb25c1);};}exports[_0xe183('0x5')]=function(_0x28ad0f){for(var _0x221e47=0x0,_0x1f7356=events['length'];_0x221e47<_0x1f7356;_0x221e47++){var _0x30eaa4=events[_0x221e47];var _0x2380fe=createListener('voiceQueue:'+_0x30eaa4,_0x28ad0f);VoiceQueueEvents['on'](_0x30eaa4,_0x2380fe);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 48c5561..541630f 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 _0xe4cf=['delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','getVoiceQueuesReport','/:id','show','post','create','update'];(function(_0x164b28,_0x2a6041){var _0x49ce10=function(_0x52bacd){while(--_0x52bacd){_0x164b28['push'](_0x164b28['shift']());}};_0x49ce10(++_0x2a6041);}(_0xe4cf,0x18f));var _0xfe4c=function(_0x1e5755,_0x5e0d48){_0x1e5755=_0x1e5755-0x0;var _0x38975b=_0xe4cf[_0x1e5755];return _0x38975b;};'use strict';var multer=require(_0xfe4c('0x0'));var util=require(_0xfe4c('0x1'));var path=require('path');var timeout=require(_0xfe4c('0x2'));var express=require('express');var router=express[_0xfe4c('0x3')]();var fs_extra=require(_0xfe4c('0x4'));var auth=require(_0xfe4c('0x5'));var interaction=require(_0xfe4c('0x6'));var config=require('../../config/environment');var controller=require(_0xfe4c('0x7'));router[_0xfe4c('0x8')]('/',auth[_0xfe4c('0x9')](),controller[_0xfe4c('0xa')]);router[_0xfe4c('0x8')](_0xfe4c('0xb'),auth[_0xfe4c('0x9')](),controller[_0xfe4c('0xc')]);router[_0xfe4c('0x8')]('/index',auth[_0xfe4c('0x9')](),controller[_0xfe4c('0xd')]);router['get'](_0xfe4c('0xe'),auth['isAuthenticated'](),controller[_0xfe4c('0xf')]);router[_0xfe4c('0x10')]('/',auth[_0xfe4c('0x9')](),controller[_0xfe4c('0x11')]);router['put'](_0xfe4c('0xe'),auth[_0xfe4c('0x9')](),controller[_0xfe4c('0x12')]);router[_0xfe4c('0x13')](_0xfe4c('0xe'),auth[_0xfe4c('0x9')](),controller[_0xfe4c('0x14')]);module[_0xfe4c('0x15')]=router; \ No newline at end of file +var _0x06e2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','/:id','post','create','update','delete','destroy','util','path','express','Router','fs-extra'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x06e2,0xa3));var _0x206e=function(_0x5656bc,_0x3585b6){_0x5656bc=_0x5656bc-0x0;var _0x6e5f64=_0x06e2[_0x5656bc];return _0x6e5f64;};'use strict';var multer=require('multer');var util=require(_0x206e('0x0'));var path=require(_0x206e('0x1'));var timeout=require('connect-timeout');var express=require(_0x206e('0x2'));var router=express[_0x206e('0x3')]();var fs_extra=require(_0x206e('0x4'));var auth=require(_0x206e('0x5'));var interaction=require(_0x206e('0x6'));var config=require(_0x206e('0x7'));var controller=require(_0x206e('0x8'));router[_0x206e('0x9')]('/',auth[_0x206e('0xa')](),controller[_0x206e('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x206e('0xc')]);router['get'](_0x206e('0xd'),auth['isAuthenticated'](),controller[_0x206e('0xe')]);router[_0x206e('0x9')](_0x206e('0xf'),auth[_0x206e('0xa')](),controller['show']);router[_0x206e('0x10')]('/',auth[_0x206e('0xa')](),controller[_0x206e('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x206e('0x12')]);router[_0x206e('0x13')]('/:id',auth[_0x206e('0xa')](),controller[_0x206e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 1eb7fab..e9d9388 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 _0x7764=['exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x7764,0x64));var _0x4776=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x7764[_0x5e36d1];return _0x950b9e;};'use strict';var Sequelize=require(_0x4776('0x0'));var moment=require(_0x4776('0x1'));module[_0x4776('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4776('0x3')]},'calleridnum':{'type':Sequelize[_0x4776('0x3')]},'calleridname':{'type':Sequelize[_0x4776('0x3')]},'queue':{'type':Sequelize[_0x4776('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x4776('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x39b6da){var _0x29e06b=moment(_0x39b6da);var _0x3ba80e=moment(this[_0x4776('0x5')](_0x4776('0x6')))[_0x4776('0x7')](_0x4776('0x8'));var _0x4ad2bc=_0x29e06b[_0x4776('0x9')](_0x3ba80e,_0x4776('0xa'));this[_0x4776('0xb')](_0x4776('0xc'),_0x39b6da);this[_0x4776('0xb')](_0x4776('0xd'),_0x4ad2bc||null);}},'position':{'type':Sequelize[_0x4776('0xe')]},'count':{'type':Sequelize[_0x4776('0xe')]},'queuecallerabandon':{'type':Sequelize[_0x4776('0xf')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x4776('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x4776('0xf')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x4776('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x4776('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x4776('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4776('0x3')]},'connectedlinename':{'type':Sequelize[_0x4776('0x3')]},'accountcode':{'type':Sequelize[_0x4776('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4776('0x3')]},'priority':{'type':Sequelize[_0x4776('0x3')]},'holdtime':{'type':Sequelize[_0x4776('0xe')]},'mohtime':{'type':Sequelize[_0x4776('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x4776('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4776('0x3')],'comment':_0x4776('0x10')},'transferexten':{'type':Sequelize[_0x4776('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x4776('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x4776('0xe')],'defaultValue':0x0},'note':{'type':Sequelize[_0x4776('0x3')]}}; \ No newline at end of file +var _0x262c=['FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','queuecallerleaveAt','holdtime','BOOLEAN','INTEGER'];(function(_0x4ea6af,_0x4aa32e){var _0x4cb1e6=function(_0xc9edd0){while(--_0xc9edd0){_0x4ea6af['push'](_0x4ea6af['shift']());}};_0x4cb1e6(++_0x4aa32e);}(_0x262c,0x1e1));var _0xc262=function(_0x3d38ae,_0x51102b){_0x3d38ae=_0x3d38ae-0x0;var _0x3757ee=_0x262c[_0x3d38ae];return _0x3757ee;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc262('0x0'));module[_0xc262('0x1')]={'type':{'type':Sequelize[_0xc262('0x2')]},'uniqueid':{'type':Sequelize[_0xc262('0x2')]},'calleridnum':{'type':Sequelize[_0xc262('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xc262('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xc262('0x3')],'set':function(_0x485d02){var _0x1d8e96=moment(_0x485d02);var _0x1f0304=moment(this[_0xc262('0x4')](_0xc262('0x5')))[_0xc262('0x6')](_0xc262('0x7'));var _0x363d3d=_0x1d8e96[_0xc262('0x8')](_0x1f0304,'seconds');this[_0xc262('0x9')](_0xc262('0xa'),_0x485d02);this[_0xc262('0x9')](_0xc262('0xb'),_0x363d3d||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xc262('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xc262('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xc262('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xc262('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xc262('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc262('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc262('0x2')]},'context':{'type':Sequelize[_0xc262('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xc262('0xd')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc262('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xc262('0x2')]},'transfer':{'type':Sequelize[_0xc262('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc262('0x2')],'comment':_0xc262('0xe')},'transferexten':{'type':Sequelize[_0xc262('0x2')]},'transferuniqueid':{'type':Sequelize[_0xc262('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc262('0x2')]},'thirdDisposition':{'type':Sequelize[_0xc262('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xc262('0xd')],'defaultValue':0x0},'note':{'type':Sequelize[_0xc262('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 2f02429..6314726 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 _0x00fb=['type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','merge','find','create','body','describe','getVoiceQueuesReport','findAll','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','then','destroy','end','error','stack','name','send','map','VoiceQueueReport','rawAttributes','fieldName'];(function(_0x1935b2,_0x44278d){var _0x1e0b8d=function(_0x18b15a){while(--_0x18b15a){_0x1935b2['push'](_0x1935b2['shift']());}};_0x1e0b8d(++_0x44278d);}(_0x00fb,0x15c));var _0xb00f=function(_0x3e1c03,_0x297560){_0x3e1c03=_0x3e1c03-0x0;var _0x48c1c0=_0x00fb[_0x3e1c03];return _0x48c1c0;};'use strict';var emlformat=require(_0xb00f('0x0'));var rimraf=require(_0xb00f('0x1'));var zipdir=require(_0xb00f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00f('0x3'));var moment=require(_0xb00f('0x4'));var BPromise=require(_0xb00f('0x5'));var Mustache=require(_0xb00f('0x6'));var util=require(_0xb00f('0x7'));var path=require(_0xb00f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00f('0x9'));var squel=require(_0xb00f('0xa'));var crypto=require(_0xb00f('0xb'));var jsforce=require(_0xb00f('0xc'));var deskjs=require(_0xb00f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb00f('0xe'));var Papa=require(_0xb00f('0xf'));var Redis=require('ioredis');var authService=require(_0xb00f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb00f('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xb00f('0x12'));var config=require(_0xb00f('0x13'));var licenseUtil=require(_0xb00f('0x14'));var db=require(_0xb00f('0x15'))['db'];config[_0xb00f('0x16')]=_[_0xb00f('0x17')](config[_0xb00f('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xb00f('0x18'))(new Redis(config[_0xb00f('0x16')]));require('./voiceQueueReport.socket')[_0xb00f('0x19')](socket);function respondWithStatusCode(_0xc4c8a6,_0x5248dd){_0x5248dd=_0x5248dd||0xcc;return function(_0x4a06a0){if(_0x4a06a0){return _0xc4c8a6[_0xb00f('0x1a')](_0x5248dd);}return _0xc4c8a6['status'](_0x5248dd)['end']();};}function respondWithResult(_0x5ba42b,_0x51a165){_0x51a165=_0x51a165||0xc8;return function(_0x32c4da){if(_0x32c4da){return _0x5ba42b[_0xb00f('0x1b')](_0x51a165)[_0xb00f('0x1c')](_0x32c4da);}};}function respondWithFilteredResult(_0xdc4a5c,_0x3dfcdf){return function(_0x1a3059){if(_0x1a3059){var _0x4e1cbc=typeof _0x3dfcdf[_0xb00f('0x1d')]===_0xb00f('0x1e')&&typeof _0x3dfcdf['limit']==='undefined';var _0x3807a8=_0x1a3059[_0xb00f('0x1f')];var _0x5f071d=_0x4e1cbc?0x0:_0x3dfcdf['offset'];var _0x5291d0=_0x4e1cbc?_0x1a3059[_0xb00f('0x1f')]:_0x3dfcdf[_0xb00f('0x1d')]+_0x3dfcdf[_0xb00f('0x20')];var _0x23df2b;if(_0x5291d0>=_0x3807a8){_0x5291d0=_0x3807a8;_0x23df2b=0xc8;}else{_0x23df2b=0xce;}_0xdc4a5c[_0xb00f('0x1b')](_0x23df2b);return _0xdc4a5c[_0xb00f('0x21')](_0xb00f('0x22'),_0x5f071d+'-'+_0x5291d0+'/'+_0x3807a8)[_0xb00f('0x1c')](_0x1a3059);}return null;};}function patchUpdates(_0xca5249){return function(_0x3f3e31){try{jsonpatch['apply'](_0x3f3e31,_0xca5249,!![]);}catch(_0x12107d){return BPromise[_0xb00f('0x23')](_0x12107d);}return _0x3f3e31['save']();};}function saveUpdates(_0x3103f3,_0x127db3){return function(_0x5b8ef7){if(_0x5b8ef7){return _0x5b8ef7['update'](_0x3103f3)[_0xb00f('0x24')](function(_0x2fcf6f){return _0x2fcf6f;});}return null;};}function removeEntity(_0x2b357c,_0x4e593f){return function(_0x43697f){if(_0x43697f){return _0x43697f[_0xb00f('0x25')]()[_0xb00f('0x24')](function(){_0x2b357c['status'](0xcc)[_0xb00f('0x26')]();});}};}function handleEntityNotFound(_0x421bb4,_0x28e294){return function(_0xf4552f){if(!_0xf4552f){_0x421bb4['sendStatus'](0x194);}return _0xf4552f;};}function handleError(_0x2acd01,_0x44c657){_0x44c657=_0x44c657||0x1f4;return function(_0x11badf){logger[_0xb00f('0x27')](_0x11badf[_0xb00f('0x28')]);if(_0x11badf[_0xb00f('0x29')]){delete _0x11badf[_0xb00f('0x29')];}_0x2acd01[_0xb00f('0x1b')](_0x44c657)[_0xb00f('0x2a')](_0x11badf);};}exports['index']=function(_0x3dfddb,_0x1d888a){var _0x208bc6={},_0x374855={},_0x2142f6={'count':0x0,'rows':[]};var _0x27778e=_[_0xb00f('0x2b')](db[_0xb00f('0x2c')][_0xb00f('0x2d')],function(_0x42e177){return{'name':_0x42e177[_0xb00f('0x2e')],'type':_0x42e177[_0xb00f('0x2f')][_0xb00f('0x30')]};});_0x374855[_0xb00f('0x31')]=_[_0xb00f('0x2b')](_0x27778e,_0xb00f('0x29'));_0x374855['query']=_[_0xb00f('0x32')](_0x3dfddb[_0xb00f('0x33')]);_0x374855['filters']=_[_0xb00f('0x34')](_0x374855[_0xb00f('0x31')],_0x374855['query']);_0x208bc6[_0xb00f('0x35')]=_[_0xb00f('0x34')](_0x374855[_0xb00f('0x31')],qs[_0xb00f('0x36')](_0x3dfddb[_0xb00f('0x33')][_0xb00f('0x36')]));_0x208bc6[_0xb00f('0x35')]=_0x208bc6[_0xb00f('0x35')]['length']?_0x208bc6['attributes']:_0x374855[_0xb00f('0x31')];if(!_0x3dfddb[_0xb00f('0x33')][_0xb00f('0x37')](_0xb00f('0x38'))){_0x208bc6[_0xb00f('0x20')]=qs[_0xb00f('0x20')](_0x3dfddb['query'][_0xb00f('0x20')]);_0x208bc6[_0xb00f('0x1d')]=qs[_0xb00f('0x1d')](_0x3dfddb[_0xb00f('0x33')][_0xb00f('0x1d')]);}_0x208bc6[_0xb00f('0x39')]=qs[_0xb00f('0x3a')](_0x3dfddb[_0xb00f('0x33')][_0xb00f('0x3a')]);_0x208bc6['where']=qs[_0xb00f('0x3b')](_[_0xb00f('0x3c')](_0x3dfddb[_0xb00f('0x33')],_0x374855[_0xb00f('0x3b')]),_0x27778e);if(_0x3dfddb[_0xb00f('0x33')][_0xb00f('0x3d')]){_0x208bc6[_0xb00f('0x3e')]=_['merge'](_0x208bc6[_0xb00f('0x3e')],{'$or':_[_0xb00f('0x2b')](_0x27778e,function(_0x24b2a6){if(_0x24b2a6[_0xb00f('0x2f')]!==_0xb00f('0x3f')){var _0x2d2ea7={};_0x2d2ea7[_0x24b2a6[_0xb00f('0x29')]]={'$like':'%'+_0x3dfddb[_0xb00f('0x33')][_0xb00f('0x3d')]+'%'};return _0x2d2ea7;}})});}_0x208bc6=_['merge']({},_0x208bc6,_0x3dfddb[_0xb00f('0x40')]);var _0x29630e={'where':_0x208bc6[_0xb00f('0x3e')]};return db[_0xb00f('0x2c')][_0xb00f('0x1f')](_0x29630e)['then'](function(_0x122a4e){_0x2142f6[_0xb00f('0x1f')]=_0x122a4e;if(_0x3dfddb['query'][_0xb00f('0x41')]){_0x208bc6[_0xb00f('0x42')]=[{'all':!![]}];}return db[_0xb00f('0x2c')]['findAll'](_0x208bc6);})[_0xb00f('0x24')](function(_0x5290c7){_0x2142f6[_0xb00f('0x43')]=_0x5290c7;return _0x2142f6;})[_0xb00f('0x24')](respondWithFilteredResult(_0x1d888a,_0x208bc6))[_0xb00f('0x44')](handleError(_0x1d888a,null));};exports[_0xb00f('0x45')]=function(_0x2b730d,_0x21e1da){var _0x54c27d={'raw':![],'where':{'id':_0x2b730d[_0xb00f('0x46')]['id']}},_0x2f1a63={};_0x2f1a63['model']=_[_0xb00f('0x32')](db['VoiceQueueReport']['rawAttributes']);_0x2f1a63['query']=_[_0xb00f('0x32')](_0x2b730d[_0xb00f('0x33')]);_0x2f1a63[_0xb00f('0x3b')]=_[_0xb00f('0x34')](_0x2f1a63[_0xb00f('0x31')],_0x2f1a63[_0xb00f('0x33')]);_0x54c27d[_0xb00f('0x35')]=_['intersection'](_0x2f1a63[_0xb00f('0x31')],qs[_0xb00f('0x36')](_0x2b730d[_0xb00f('0x33')][_0xb00f('0x36')]));_0x54c27d[_0xb00f('0x35')]=_0x54c27d[_0xb00f('0x35')][_0xb00f('0x47')]?_0x54c27d[_0xb00f('0x35')]:_0x2f1a63['model'];if(_0x2b730d[_0xb00f('0x33')]['includeAll']){_0x54c27d[_0xb00f('0x42')]=[{'all':!![]}];}_0x54c27d=_[_0xb00f('0x48')]({},_0x54c27d,_0x2b730d[_0xb00f('0x40')]);return db[_0xb00f('0x2c')][_0xb00f('0x49')](_0x54c27d)[_0xb00f('0x24')](handleEntityNotFound(_0x21e1da,null))[_0xb00f('0x24')](respondWithResult(_0x21e1da,null))[_0xb00f('0x44')](handleError(_0x21e1da,null));};exports[_0xb00f('0x4a')]=function(_0x4cedb7,_0x4a1454){return db[_0xb00f('0x2c')]['create'](_0x4cedb7[_0xb00f('0x4b')],{})[_0xb00f('0x24')](respondWithResult(_0x4a1454,0xc9))['catch'](handleError(_0x4a1454,null));};exports['update']=function(_0x304a8c,_0x5fca1a){if(_0x304a8c[_0xb00f('0x4b')]['id']){delete _0x304a8c['body']['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x304a8c[_0xb00f('0x46')]['id']}})[_0xb00f('0x24')](handleEntityNotFound(_0x5fca1a,null))['then'](saveUpdates(_0x304a8c[_0xb00f('0x4b')],null))[_0xb00f('0x24')](respondWithResult(_0x5fca1a,null))['catch'](handleError(_0x5fca1a,null));};exports['destroy']=function(_0x11082d,_0x279ccb){return db['VoiceQueueReport'][_0xb00f('0x49')]({'where':{'id':_0x11082d[_0xb00f('0x46')]['id']}})[_0xb00f('0x24')](handleEntityNotFound(_0x279ccb,null))[_0xb00f('0x24')](removeEntity(_0x279ccb,null))[_0xb00f('0x44')](handleError(_0x279ccb,null));};exports[_0xb00f('0x4c')]=function(_0x3ba9b5,_0x5223ae){return db[_0xb00f('0x2c')][_0xb00f('0x4c')]()[_0xb00f('0x24')](respondWithResult(_0x5223ae,null))[_0xb00f('0x44')](handleError(_0x5223ae,null));};exports[_0xb00f('0x4d')]=function(_0x19cbf7,_0x485822){var _0x21fdf9={},_0x16056f={},_0x5517cb={'count':0x0,'rows':[]};_0x16056f[_0xb00f('0x31')]=_[_0xb00f('0x32')](db[_0xb00f('0x2c')][_0xb00f('0x2d')]);_0x16056f['query']=_[_0xb00f('0x32')](_0x19cbf7[_0xb00f('0x33')]);_0x16056f['filters']=_[_0xb00f('0x34')](_0x16056f[_0xb00f('0x31')],_0x16056f[_0xb00f('0x33')]);_0x21fdf9['attributes']=_[_0xb00f('0x34')](_0x16056f[_0xb00f('0x31')],qs[_0xb00f('0x36')](_0x19cbf7['query'][_0xb00f('0x36')]));_0x21fdf9[_0xb00f('0x35')]=_0x21fdf9[_0xb00f('0x35')][_0xb00f('0x47')]?_0x21fdf9[_0xb00f('0x35')]:_0x16056f[_0xb00f('0x31')];if(!_0x19cbf7[_0xb00f('0x33')][_0xb00f('0x37')]('nolimit')){_0x21fdf9[_0xb00f('0x20')]=qs[_0xb00f('0x20')](_0x19cbf7['query']['limit']);_0x21fdf9[_0xb00f('0x1d')]=qs[_0xb00f('0x1d')](_0x19cbf7['query']['offset']);}_0x21fdf9[_0xb00f('0x39')]=qs[_0xb00f('0x3a')](_0x19cbf7[_0xb00f('0x33')][_0xb00f('0x3a')]);_0x21fdf9[_0xb00f('0x3e')]=qs['filters'](_['pick'](_0x19cbf7[_0xb00f('0x33')],_0x16056f[_0xb00f('0x3b')]));if(_0x19cbf7['query']['filter']){_0x21fdf9[_0xb00f('0x3e')]=_[_0xb00f('0x48')](_0x21fdf9[_0xb00f('0x3e')],{'$or':_[_0xb00f('0x2b')](_0x21fdf9[_0xb00f('0x35')],function(_0x6d399b){var _0x19e6e1={};_0x19e6e1[_0x6d399b]={'$like':'%'+_0x19cbf7[_0xb00f('0x33')][_0xb00f('0x3d')]+'%'};return _0x19e6e1;})});}_0x21fdf9=_['merge']({},_0x21fdf9,_0x19cbf7['options']);var _0x1b9dbf={'where':_0x21fdf9['where']};return db[_0xb00f('0x2c')][_0xb00f('0x1f')](_0x1b9dbf)[_0xb00f('0x24')](function(_0x20f863){_0x5517cb[_0xb00f('0x1f')]=_0x20f863;if(_0x19cbf7[_0xb00f('0x33')][_0xb00f('0x41')]){_0x21fdf9['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0xb00f('0x4e')](_0x21fdf9);})['then'](function(_0x38de00){_0x5517cb[_0xb00f('0x43')]=_0x38de00;return _0x5517cb;})['then'](respondWithFilteredResult(_0x485822,_0x21fdf9,_0xb00f('0x4d')))[_0xb00f('0x44')](handleError(_0x485822,null,_0xb00f('0x4d')));}; \ No newline at end of file +var _0xd789=['rows','catch','show','params','include','find','create','body','describe','getVoiceQueuesReport','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','VoiceQueueReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0xd789,0x19a));var _0x9d78=function(_0x5b13c3,_0x378e0a){_0x5b13c3=_0x5b13c3-0x0;var _0x3d6780=_0xd789[_0x5b13c3];return _0x3d6780;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d78('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9d78('0x1'));var rp=require(_0x9d78('0x2'));var moment=require('moment');var BPromise=require(_0x9d78('0x3'));var Mustache=require(_0x9d78('0x4'));var util=require(_0x9d78('0x5'));var path=require(_0x9d78('0x6'));var sox=require(_0x9d78('0x7'));var csv=require(_0x9d78('0x8'));var ejs=require(_0x9d78('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d78('0xa'));var squel=require(_0x9d78('0xb'));var crypto=require(_0x9d78('0xc'));var jsforce=require(_0x9d78('0xd'));var deskjs=require(_0x9d78('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9d78('0xf'));var Papa=require(_0x9d78('0x10'));var Redis=require(_0x9d78('0x11'));var authService=require(_0x9d78('0x12'));var qs=require(_0x9d78('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d78('0x14'));var logger=require('../../config/logger')(_0x9d78('0x15'));var utils=require(_0x9d78('0x16'));var config=require(_0x9d78('0x17'));var licenseUtil=require(_0x9d78('0x18'));var db=require('../../mysqldb')['db'];config[_0x9d78('0x19')]=_['defaults'](config[_0x9d78('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x9d78('0x1a'))(new Redis(config[_0x9d78('0x19')]));require('./voiceQueueReport.socket')[_0x9d78('0x1b')](socket);function respondWithStatusCode(_0xa5afd3,_0x195466){_0x195466=_0x195466||0xcc;return function(_0x2d649c){if(_0x2d649c){return _0xa5afd3[_0x9d78('0x1c')](_0x195466);}return _0xa5afd3['status'](_0x195466)[_0x9d78('0x1d')]();};}function respondWithResult(_0x57cb83,_0x108dc8){_0x108dc8=_0x108dc8||0xc8;return function(_0x3eda37){if(_0x3eda37){return _0x57cb83['status'](_0x108dc8)[_0x9d78('0x1e')](_0x3eda37);}};}function respondWithFilteredResult(_0x32bf78,_0x3ab017){return function(_0x3fdfa2){if(_0x3fdfa2){var _0x5d35d8=typeof _0x3ab017[_0x9d78('0x1f')]===_0x9d78('0x20')&&typeof _0x3ab017[_0x9d78('0x21')]===_0x9d78('0x20');var _0x2e4195=_0x3fdfa2[_0x9d78('0x22')];var _0x1c83ac=_0x5d35d8?0x0:_0x3ab017['offset'];var _0x170f8d=_0x5d35d8?_0x3fdfa2['count']:_0x3ab017[_0x9d78('0x1f')]+_0x3ab017[_0x9d78('0x21')];var _0x3e0f08;if(_0x170f8d>=_0x2e4195){_0x170f8d=_0x2e4195;_0x3e0f08=0xc8;}else{_0x3e0f08=0xce;}_0x32bf78[_0x9d78('0x23')](_0x3e0f08);return _0x32bf78['set'](_0x9d78('0x24'),_0x1c83ac+'-'+_0x170f8d+'/'+_0x2e4195)[_0x9d78('0x1e')](_0x3fdfa2);}return null;};}function patchUpdates(_0x5e3f45){return function(_0x1a00e9){try{jsonpatch[_0x9d78('0x25')](_0x1a00e9,_0x5e3f45,!![]);}catch(_0x424717){return BPromise['reject'](_0x424717);}return _0x1a00e9[_0x9d78('0x26')]();};}function saveUpdates(_0x532f0b,_0xa4dd0){return function(_0x4e3ea2){if(_0x4e3ea2){return _0x4e3ea2[_0x9d78('0x27')](_0x532f0b)[_0x9d78('0x28')](function(_0xc4fbc9){return _0xc4fbc9;});}return null;};}function removeEntity(_0x426632,_0x34de66){return function(_0x4b7315){if(_0x4b7315){return _0x4b7315[_0x9d78('0x29')]()['then'](function(){_0x426632[_0x9d78('0x23')](0xcc)[_0x9d78('0x1d')]();});}};}function handleEntityNotFound(_0x22b165,_0x31c93a){return function(_0x163216){if(!_0x163216){_0x22b165['sendStatus'](0x194);}return _0x163216;};}function handleError(_0x8d35dd,_0x24d6dc){_0x24d6dc=_0x24d6dc||0x1f4;return function(_0xa85476){logger[_0x9d78('0x2a')](_0xa85476[_0x9d78('0x2b')]);if(_0xa85476['name']){delete _0xa85476[_0x9d78('0x2c')];}_0x8d35dd['status'](_0x24d6dc)['send'](_0xa85476);};}exports[_0x9d78('0x2d')]=function(_0x1e8de3,_0x4cbf03){var _0x4c0881={},_0x25e49e={},_0x8c85d3={'count':0x0,'rows':[]};var _0x16da74=_[_0x9d78('0x2e')](db[_0x9d78('0x2f')][_0x9d78('0x30')],function(_0x59cab3){return{'name':_0x59cab3[_0x9d78('0x31')],'type':_0x59cab3[_0x9d78('0x32')]['key']};});_0x25e49e[_0x9d78('0x33')]=_[_0x9d78('0x2e')](_0x16da74,_0x9d78('0x2c'));_0x25e49e[_0x9d78('0x34')]=_[_0x9d78('0x35')](_0x1e8de3[_0x9d78('0x34')]);_0x25e49e['filters']=_[_0x9d78('0x36')](_0x25e49e[_0x9d78('0x33')],_0x25e49e[_0x9d78('0x34')]);_0x4c0881[_0x9d78('0x37')]=_[_0x9d78('0x36')](_0x25e49e[_0x9d78('0x33')],qs[_0x9d78('0x38')](_0x1e8de3[_0x9d78('0x34')][_0x9d78('0x38')]));_0x4c0881[_0x9d78('0x37')]=_0x4c0881[_0x9d78('0x37')][_0x9d78('0x39')]?_0x4c0881[_0x9d78('0x37')]:_0x25e49e['model'];if(!_0x1e8de3[_0x9d78('0x34')][_0x9d78('0x3a')]('nolimit')){_0x4c0881[_0x9d78('0x21')]=qs[_0x9d78('0x21')](_0x1e8de3[_0x9d78('0x34')][_0x9d78('0x21')]);_0x4c0881['offset']=qs[_0x9d78('0x1f')](_0x1e8de3[_0x9d78('0x34')][_0x9d78('0x1f')]);}_0x4c0881[_0x9d78('0x3b')]=qs[_0x9d78('0x3c')](_0x1e8de3['query'][_0x9d78('0x3c')]);_0x4c0881[_0x9d78('0x3d')]=qs[_0x9d78('0x3e')](_[_0x9d78('0x3f')](_0x1e8de3[_0x9d78('0x34')],_0x25e49e[_0x9d78('0x3e')]),_0x16da74);if(_0x1e8de3[_0x9d78('0x34')][_0x9d78('0x40')]){_0x4c0881[_0x9d78('0x3d')]=_[_0x9d78('0x41')](_0x4c0881[_0x9d78('0x3d')],{'$or':_[_0x9d78('0x2e')](_0x16da74,function(_0x2d42a9){if(_0x2d42a9[_0x9d78('0x32')]!==_0x9d78('0x42')){var _0x731606={};_0x731606[_0x2d42a9['name']]={'$like':'%'+_0x1e8de3[_0x9d78('0x34')][_0x9d78('0x40')]+'%'};return _0x731606;}})});}_0x4c0881=_[_0x9d78('0x41')]({},_0x4c0881,_0x1e8de3[_0x9d78('0x43')]);var _0x3dc376={'where':_0x4c0881[_0x9d78('0x3d')]};return db['VoiceQueueReport']['count'](_0x3dc376)[_0x9d78('0x28')](function(_0x283017){_0x8c85d3[_0x9d78('0x22')]=_0x283017;if(_0x1e8de3[_0x9d78('0x34')][_0x9d78('0x44')]){_0x4c0881['include']=[{'all':!![]}];}return db[_0x9d78('0x2f')][_0x9d78('0x45')](_0x4c0881);})[_0x9d78('0x28')](function(_0x18ac17){_0x8c85d3[_0x9d78('0x46')]=_0x18ac17;return _0x8c85d3;})['then'](respondWithFilteredResult(_0x4cbf03,_0x4c0881))[_0x9d78('0x47')](handleError(_0x4cbf03,null));};exports[_0x9d78('0x48')]=function(_0x4c4240,_0x50854f){var _0x3c11b2={'raw':![],'where':{'id':_0x4c4240[_0x9d78('0x49')]['id']}},_0x226806={};_0x226806[_0x9d78('0x33')]=_['keys'](db[_0x9d78('0x2f')][_0x9d78('0x30')]);_0x226806[_0x9d78('0x34')]=_[_0x9d78('0x35')](_0x4c4240[_0x9d78('0x34')]);_0x226806[_0x9d78('0x3e')]=_['intersection'](_0x226806['model'],_0x226806[_0x9d78('0x34')]);_0x3c11b2[_0x9d78('0x37')]=_['intersection'](_0x226806[_0x9d78('0x33')],qs[_0x9d78('0x38')](_0x4c4240[_0x9d78('0x34')][_0x9d78('0x38')]));_0x3c11b2['attributes']=_0x3c11b2[_0x9d78('0x37')][_0x9d78('0x39')]?_0x3c11b2[_0x9d78('0x37')]:_0x226806[_0x9d78('0x33')];if(_0x4c4240[_0x9d78('0x34')]['includeAll']){_0x3c11b2[_0x9d78('0x4a')]=[{'all':!![]}];}_0x3c11b2=_[_0x9d78('0x41')]({},_0x3c11b2,_0x4c4240['options']);return db[_0x9d78('0x2f')][_0x9d78('0x4b')](_0x3c11b2)[_0x9d78('0x28')](handleEntityNotFound(_0x50854f,null))[_0x9d78('0x28')](respondWithResult(_0x50854f,null))['catch'](handleError(_0x50854f,null));};exports[_0x9d78('0x4c')]=function(_0x264c99,_0x10c2ee){return db[_0x9d78('0x2f')][_0x9d78('0x4c')](_0x264c99[_0x9d78('0x4d')],{})[_0x9d78('0x28')](respondWithResult(_0x10c2ee,0xc9))['catch'](handleError(_0x10c2ee,null));};exports[_0x9d78('0x27')]=function(_0x24d97e,_0x528846){if(_0x24d97e[_0x9d78('0x4d')]['id']){delete _0x24d97e[_0x9d78('0x4d')]['id'];}return db['VoiceQueueReport'][_0x9d78('0x4b')]({'where':{'id':_0x24d97e[_0x9d78('0x49')]['id']}})[_0x9d78('0x28')](handleEntityNotFound(_0x528846,null))['then'](saveUpdates(_0x24d97e[_0x9d78('0x4d')],null))[_0x9d78('0x28')](respondWithResult(_0x528846,null))[_0x9d78('0x47')](handleError(_0x528846,null));};exports[_0x9d78('0x29')]=function(_0x2b63ec,_0x50a687){return db[_0x9d78('0x2f')][_0x9d78('0x4b')]({'where':{'id':_0x2b63ec[_0x9d78('0x49')]['id']}})[_0x9d78('0x28')](handleEntityNotFound(_0x50a687,null))['then'](removeEntity(_0x50a687,null))[_0x9d78('0x47')](handleError(_0x50a687,null));};exports[_0x9d78('0x4e')]=function(_0x220aa9,_0x50a5bb){return db[_0x9d78('0x2f')][_0x9d78('0x4e')]()[_0x9d78('0x28')](respondWithResult(_0x50a5bb,null))[_0x9d78('0x47')](handleError(_0x50a5bb,null));};exports[_0x9d78('0x4f')]=function(_0x4b166f,_0x16ec45){var _0x12201b={},_0x222aa0={},_0xb7271b={'count':0x0,'rows':[]};_0x222aa0['model']=_['keys'](db['VoiceQueueReport'][_0x9d78('0x30')]);_0x222aa0[_0x9d78('0x34')]=_[_0x9d78('0x35')](_0x4b166f[_0x9d78('0x34')]);_0x222aa0[_0x9d78('0x3e')]=_[_0x9d78('0x36')](_0x222aa0[_0x9d78('0x33')],_0x222aa0[_0x9d78('0x34')]);_0x12201b[_0x9d78('0x37')]=_[_0x9d78('0x36')](_0x222aa0[_0x9d78('0x33')],qs['fields'](_0x4b166f[_0x9d78('0x34')][_0x9d78('0x38')]));_0x12201b[_0x9d78('0x37')]=_0x12201b[_0x9d78('0x37')][_0x9d78('0x39')]?_0x12201b[_0x9d78('0x37')]:_0x222aa0[_0x9d78('0x33')];if(!_0x4b166f[_0x9d78('0x34')][_0x9d78('0x3a')]('nolimit')){_0x12201b['limit']=qs[_0x9d78('0x21')](_0x4b166f[_0x9d78('0x34')][_0x9d78('0x21')]);_0x12201b[_0x9d78('0x1f')]=qs[_0x9d78('0x1f')](_0x4b166f[_0x9d78('0x34')][_0x9d78('0x1f')]);}_0x12201b[_0x9d78('0x3b')]=qs[_0x9d78('0x3c')](_0x4b166f['query'][_0x9d78('0x3c')]);_0x12201b[_0x9d78('0x3d')]=qs[_0x9d78('0x3e')](_['pick'](_0x4b166f[_0x9d78('0x34')],_0x222aa0['filters']));if(_0x4b166f[_0x9d78('0x34')][_0x9d78('0x40')]){_0x12201b[_0x9d78('0x3d')]=_[_0x9d78('0x41')](_0x12201b[_0x9d78('0x3d')],{'$or':_[_0x9d78('0x2e')](_0x12201b[_0x9d78('0x37')],function(_0x334c23){var _0x1d4306={};_0x1d4306[_0x334c23]={'$like':'%'+_0x4b166f[_0x9d78('0x34')][_0x9d78('0x40')]+'%'};return _0x1d4306;})});}_0x12201b=_[_0x9d78('0x41')]({},_0x12201b,_0x4b166f[_0x9d78('0x43')]);var _0x3a3441={'where':_0x12201b[_0x9d78('0x3d')]};return db[_0x9d78('0x2f')][_0x9d78('0x22')](_0x3a3441)[_0x9d78('0x28')](function(_0x40e682){_0xb7271b[_0x9d78('0x22')]=_0x40e682;if(_0x4b166f[_0x9d78('0x34')][_0x9d78('0x44')]){_0x12201b[_0x9d78('0x4a')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x9d78('0x45')](_0x12201b);})[_0x9d78('0x28')](function(_0xc0b0a9){_0xb7271b[_0x9d78('0x46')]=_0xc0b0a9;return _0xb7271b;})[_0x9d78('0x28')](respondWithFilteredResult(_0x16ec45,_0x12201b,'getVoiceQueuesReport'))['catch'](handleError(_0x16ec45,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 2492e1c..f378224 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 _0x8e19=['hasOwnProperty','hook','exports','VoiceQueueReport','setMaxListeners','save','update','emit'];(function(_0x163aec,_0x326dfa){var _0x4add9d=function(_0x1a9824){while(--_0x1a9824){_0x163aec['push'](_0x163aec['shift']());}};_0x4add9d(++_0x326dfa);}(_0x8e19,0xb3));var _0x98e1=function(_0x1d7966,_0x359208){_0x1d7966=_0x1d7966-0x0;var _0x27bbf7=_0x8e19[_0x1d7966];return _0x27bbf7;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0x98e1('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x98e1('0x1')](0x0);var events={'afterCreate':_0x98e1('0x2'),'afterUpdate':_0x98e1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x16e431){return function(_0xb199b3,_0x14a4c9,_0x4d1426){VoiceQueueReportEvents[_0x98e1('0x4')](_0x16e431+':'+_0xb199b3['id'],_0xb199b3);VoiceQueueReportEvents[_0x98e1('0x4')](_0x16e431,_0xb199b3);_0x4d1426(null);};}for(var e in events){if(events[_0x98e1('0x5')](e)){var event=events[e];VoiceQueueReport[_0x98e1('0x6')](e,emitEvent(event));}}module[_0x98e1('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xf450=['hasOwnProperty','hook','exports','VoiceQueueReport','save','emit'];(function(_0x20da9c,_0xcf292b){var _0x198ea5=function(_0x197a6a){while(--_0x197a6a){_0x20da9c['push'](_0x20da9c['shift']());}};_0x198ea5(++_0xcf292b);}(_0xf450,0xdb));var _0x0f45=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf450[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0x0f45('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0f45('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4cc2ac){return function(_0xf58757,_0x578f9a,_0x36a807){VoiceQueueReportEvents[_0x0f45('0x2')](_0x4cc2ac+':'+_0xf58757['id'],_0xf58757);VoiceQueueReportEvents[_0x0f45('0x2')](_0x4cc2ac,_0xf58757);_0x36a807(null);};}for(var e in events){if(events[_0x0f45('0x3')](e)){var event=events[e];VoiceQueueReport[_0x0f45('0x4')](e,emitEvent(event));}}module[_0x0f45('0x5')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 45ef5b7..dfc6055 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 _0xb06c=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api'];(function(_0x135448,_0x4ca19f){var _0x28389e=function(_0x5a2113){while(--_0x5a2113){_0x135448['push'](_0x135448['shift']());}};_0x28389e(++_0x4ca19f);}(_0xb06c,0x10a));var _0xcb06=function(_0x4b4798,_0x355203){_0x4b4798=_0x4b4798-0x0;var _0x4681f4=_0xb06c[_0x4b4798];return _0x4681f4;};'use strict';var _=require(_0xcb06('0x0'));var util=require(_0xcb06('0x1'));var logger=require(_0xcb06('0x2'))(_0xcb06('0x3'));var moment=require(_0xcb06('0x4'));var BPromise=require(_0xcb06('0x5'));var rp=require(_0xcb06('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb06('0x7'));var config=require(_0xcb06('0x8'));var attributes=require(_0xcb06('0x9'));module[_0xcb06('0xa')]=function(_0x1d1ea4,_0x3908ae){return _0x1d1ea4['define'](_0xcb06('0xb'),attributes,{'tableName':_0xcb06('0xc'),'paranoid':![],'indexes':[{'fields':[_0xcb06('0xd')]},{'fields':[_0xcb06('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb7f=['rimraf','../../config/environment','define','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5bced2,_0x317e86){var _0x2f5c70=function(_0x5f314a){while(--_0x5f314a){_0x5bced2['push'](_0x5bced2['shift']());}};_0x2f5c70(++_0x317e86);}(_0xdb7f,0x1c0));var _0xfdb7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdb7f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xfdb7('0x0'));var util=require(_0xfdb7('0x1'));var logger=require(_0xfdb7('0x2'))(_0xfdb7('0x3'));var moment=require('moment');var BPromise=require(_0xfdb7('0x4'));var rp=require(_0xfdb7('0x5'));var fs=require('fs');var path=require(_0xfdb7('0x6'));var rimraf=require(_0xfdb7('0x7'));var config=require(_0xfdb7('0x8'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x1ac359,_0x1c2765){return _0x1ac359[_0xfdb7('0x9')]('VoiceQueueReport',attributes,{'tableName':_0xfdb7('0xa'),'paranoid':![],'indexes':[{'fields':[_0xfdb7('0xb')]},{'fields':[_0xfdb7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 659dbdb..6011d81 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 _0x1691=['options','raw','where','include','map','attributes','model','then','info','catch','CreateVoiceQueueReport','create','body','update','limit','UpdateVoiceQueueReport','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueueReport,\x20%s,\x20%s','message','GetVoiceQueueReport','VoiceQueueReport'];(function(_0x584323,_0x592964){var _0x18ea99=function(_0x51ffd2){while(--_0x51ffd2){_0x584323['push'](_0x584323['shift']());}};_0x18ea99(++_0x592964);}(_0x1691,0x8e));var _0x1169=function(_0x48c042,_0x678407){_0x48c042=_0x48c042-0x0;var _0x547759=_0x1691[_0x48c042];return _0x547759;};'use strict';var _=require(_0x1169('0x0'));var util=require(_0x1169('0x1'));var moment=require(_0x1169('0x2'));var BPromise=require('bluebird');var rs=require(_0x1169('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1169('0x4'));var logger=require(_0x1169('0x5'))('rpc');var config=require(_0x1169('0x6'));var jayson=require(_0x1169('0x7'));var client=jayson[_0x1169('0x8')][_0x1169('0x9')]({'port':0x232a});config['redis']=_[_0x1169('0xa')](config[_0x1169('0xb')],{'host':_0x1169('0xc'),'port':0x18eb});var socket=require(_0x1169('0xd'))(new Redis(config['redis']));require(_0x1169('0xe'))[_0x1169('0xf')](socket);function respondWithRpcPromise(_0x19434e,_0x44a6f7,_0x5a5059){return new BPromise(function(_0x57f1fe,_0x25a868){return client[_0x1169('0x10')](_0x19434e,_0x5a5059)['then'](function(_0xfb945a){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x44a6f7,_0x1169('0x11'));logger[_0x1169('0x12')](_0x1169('0x13'),_0x44a6f7,_0x1169('0x11'),JSON[_0x1169('0x14')](_0xfb945a));if(_0xfb945a[_0x1169('0x15')]){if(_0xfb945a[_0x1169('0x15')]['code']===0x1f4){logger[_0x1169('0x15')](_0x1169('0x16'),_0x44a6f7,_0xfb945a[_0x1169('0x15')][_0x1169('0x17')]);return _0x25a868(_0xfb945a['error'][_0x1169('0x17')]);}logger[_0x1169('0x15')](_0x1169('0x16'),_0x44a6f7,_0xfb945a[_0x1169('0x15')][_0x1169('0x17')]);return _0x57f1fe(_0xfb945a['error'][_0x1169('0x17')]);}else{logger['info'](_0x1169('0x16'),_0x44a6f7,'request\x20sent');_0x57f1fe(_0xfb945a['result'][_0x1169('0x17')]);}})['catch'](function(_0x26f62f){logger[_0x1169('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x44a6f7,_0x26f62f);_0x25a868(_0x26f62f);});});}exports[_0x1169('0x18')]=function(_0x584950){var _0xa7f6e7=this;return new Promise(function(_0x2a8e90,_0x596fe0){return db[_0x1169('0x19')]['findAll']({'raw':_0x584950[_0x1169('0x1a')]?_0x584950['options'][_0x1169('0x1b')]===undefined?!![]:![]:!![],'where':_0x584950['options']?_0x584950[_0x1169('0x1a')][_0x1169('0x1c')]||null:null,'attributes':_0x584950['options']?_0x584950[_0x1169('0x1a')]['attributes']||null:null,'limit':_0x584950[_0x1169('0x1a')]?_0x584950['options']['limit']||null:null,'include':_0x584950['options']?_0x584950[_0x1169('0x1a')][_0x1169('0x1d')]?_[_0x1169('0x1e')](_0x584950['options'][_0x1169('0x1d')],function(_0x33a1dd){return{'model':db[_0x33a1dd['model']],'as':_0x33a1dd['as'],'attributes':_0x33a1dd[_0x1169('0x1f')],'include':_0x33a1dd[_0x1169('0x1d')]?_[_0x1169('0x1e')](_0x33a1dd[_0x1169('0x1d')],function(_0x1e7292){return{'model':db[_0x1e7292['model']],'as':_0x1e7292['as'],'attributes':_0x1e7292[_0x1169('0x1f')],'include':_0x1e7292[_0x1169('0x1d')]?_['map'](_0x1e7292['include'],function(_0x3cf2f8){return{'model':db[_0x3cf2f8[_0x1169('0x20')]],'as':_0x3cf2f8['as'],'attributes':_0x3cf2f8[_0x1169('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1169('0x21')](function(_0x4803a7){logger[_0x1169('0x22')](_0x1169('0x18'),_0x584950);logger['debug']('GetVoiceQueueReport',_0x584950,JSON[_0x1169('0x14')](_0x4803a7));_0x2a8e90(_0x4803a7);})[_0x1169('0x23')](function(_0x332cbc){logger[_0x1169('0x15')](_0x1169('0x18'),_0x332cbc[_0x1169('0x17')],_0x584950);_0x596fe0(_0xa7f6e7[_0x1169('0x15')](0x1f4,_0x332cbc[_0x1169('0x17')]));});});};exports[_0x1169('0x24')]=function(_0x112cea){var _0x4f4f8b=this;return new Promise(function(_0x361d43,_0x2a52fd){return db[_0x1169('0x19')][_0x1169('0x25')](_0x112cea[_0x1169('0x26')],{'raw':_0x112cea[_0x1169('0x1a')]?_0x112cea[_0x1169('0x1a')][_0x1169('0x1b')]===undefined?!![]:![]:!![]})[_0x1169('0x21')](function(_0x3cf866){logger[_0x1169('0x22')](_0x1169('0x24'),_0x112cea);logger['debug'](_0x1169('0x24'),_0x112cea,JSON[_0x1169('0x14')](_0x3cf866));_0x361d43(_0x3cf866);})[_0x1169('0x23')](function(_0x3cb0fa){logger[_0x1169('0x15')](_0x1169('0x24'),_0x3cb0fa[_0x1169('0x17')],_0x112cea);_0x2a52fd(_0x4f4f8b['error'](0x1f4,_0x3cb0fa[_0x1169('0x17')]));});});};exports['UpdateVoiceQueueReport']=function(_0x24ca62){var _0x2166a5=this;return new Promise(function(_0x2fbae5,_0x323851){return db['VoiceQueueReport'][_0x1169('0x27')](_0x24ca62[_0x1169('0x26')],{'raw':_0x24ca62[_0x1169('0x1a')]?_0x24ca62[_0x1169('0x1a')][_0x1169('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24ca62[_0x1169('0x1a')]?_0x24ca62['options'][_0x1169('0x1c')]||null:null,'attributes':_0x24ca62['options']?_0x24ca62['options'][_0x1169('0x1f')]||null:null,'limit':_0x24ca62[_0x1169('0x1a')]?_0x24ca62[_0x1169('0x1a')][_0x1169('0x28')]||null:null})[_0x1169('0x21')](function(_0x1f316f){logger[_0x1169('0x22')](_0x1169('0x29'),_0x24ca62);logger[_0x1169('0x12')](_0x1169('0x29'),_0x24ca62,JSON[_0x1169('0x14')](_0x1f316f));_0x2fbae5(_0x1f316f);})[_0x1169('0x23')](function(_0x28742a){logger['error'](_0x1169('0x29'),_0x28742a[_0x1169('0x17')],_0x24ca62);_0x323851(_0x2166a5[_0x1169('0x15')](0x1f4,_0x28742a['message']));});});}; \ No newline at end of file +var _0x9698=['raw','where','attributes','limit','include','map','model','then','CreateVoiceQueueReport','create','stringify','UpdateVoiceQueueReport','update','body','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options'];(function(_0x5008d6,_0xf4e1f1){var _0x2c82aa=function(_0x15f04f){while(--_0x15f04f){_0x5008d6['push'](_0x5008d6['shift']());}};_0x2c82aa(++_0xf4e1f1);}(_0x9698,0x13b));var _0x8969=function(_0x1f4a7d,_0x499f7d){_0x1f4a7d=_0x1f4a7d-0x0;var _0x2247b7=_0x9698[_0x1f4a7d];return _0x2247b7;};'use strict';var _=require('lodash');var util=require(_0x8969('0x0'));var moment=require(_0x8969('0x1'));var BPromise=require(_0x8969('0x2'));var rs=require(_0x8969('0x3'));var fs=require('fs');var Redis=require(_0x8969('0x4'));var db=require(_0x8969('0x5'))['db'];var utils=require(_0x8969('0x6'));var logger=require(_0x8969('0x7'))(_0x8969('0x8'));var config=require(_0x8969('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8969('0xa')][_0x8969('0xb')]({'port':0x232a});config['redis']=_[_0x8969('0xc')](config[_0x8969('0xd')],{'host':_0x8969('0xe'),'port':0x18eb});var socket=require(_0x8969('0xf'))(new Redis(config[_0x8969('0xd')]));require(_0x8969('0x10'))['register'](socket);function respondWithRpcPromise(_0x17de27,_0xd3d25a,_0x584d73){return new BPromise(function(_0x2e3b1e,_0x3ceb75){return client['request'](_0x17de27,_0x584d73)['then'](function(_0x339d30){logger[_0x8969('0x11')](_0x8969('0x12'),_0xd3d25a,_0x8969('0x13'));logger[_0x8969('0x14')](_0x8969('0x15'),_0xd3d25a,_0x8969('0x13'),JSON['stringify'](_0x339d30));if(_0x339d30[_0x8969('0x16')]){if(_0x339d30[_0x8969('0x16')]['code']===0x1f4){logger[_0x8969('0x16')](_0x8969('0x12'),_0xd3d25a,_0x339d30[_0x8969('0x16')][_0x8969('0x17')]);return _0x3ceb75(_0x339d30[_0x8969('0x16')][_0x8969('0x17')]);}logger[_0x8969('0x16')](_0x8969('0x12'),_0xd3d25a,_0x339d30[_0x8969('0x16')][_0x8969('0x17')]);return _0x2e3b1e(_0x339d30[_0x8969('0x16')][_0x8969('0x17')]);}else{logger[_0x8969('0x11')](_0x8969('0x12'),_0xd3d25a,_0x8969('0x13'));_0x2e3b1e(_0x339d30[_0x8969('0x18')][_0x8969('0x17')]);}})[_0x8969('0x19')](function(_0xec1f36){logger[_0x8969('0x16')](_0x8969('0x12'),_0xd3d25a,_0xec1f36);_0x3ceb75(_0xec1f36);});});}exports[_0x8969('0x1a')]=function(_0x2b14aa){var _0x45abf2=this;return new Promise(function(_0x319255,_0xd4a0d3){return db[_0x8969('0x1b')]['findAll']({'raw':_0x2b14aa[_0x8969('0x1c')]?_0x2b14aa['options'][_0x8969('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b14aa[_0x8969('0x1c')]?_0x2b14aa[_0x8969('0x1c')][_0x8969('0x1e')]||null:null,'attributes':_0x2b14aa[_0x8969('0x1c')]?_0x2b14aa[_0x8969('0x1c')][_0x8969('0x1f')]||null:null,'limit':_0x2b14aa['options']?_0x2b14aa[_0x8969('0x1c')][_0x8969('0x20')]||null:null,'include':_0x2b14aa[_0x8969('0x1c')]?_0x2b14aa['options'][_0x8969('0x21')]?_[_0x8969('0x22')](_0x2b14aa['options'][_0x8969('0x21')],function(_0x18cd2d){return{'model':db[_0x18cd2d[_0x8969('0x23')]],'as':_0x18cd2d['as'],'attributes':_0x18cd2d[_0x8969('0x1f')],'include':_0x18cd2d[_0x8969('0x21')]?_[_0x8969('0x22')](_0x18cd2d['include'],function(_0x379167){return{'model':db[_0x379167['model']],'as':_0x379167['as'],'attributes':_0x379167[_0x8969('0x1f')],'include':_0x379167[_0x8969('0x21')]?_[_0x8969('0x22')](_0x379167[_0x8969('0x21')],function(_0x5aa93c){return{'model':db[_0x5aa93c[_0x8969('0x23')]],'as':_0x5aa93c['as'],'attributes':_0x5aa93c[_0x8969('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8969('0x24')](function(_0x5d611a){logger['info']('GetVoiceQueueReport',_0x2b14aa);logger['debug'](_0x8969('0x1a'),_0x2b14aa,JSON['stringify'](_0x5d611a));_0x319255(_0x5d611a);})[_0x8969('0x19')](function(_0x3ddacd){logger['error']('GetVoiceQueueReport',_0x3ddacd[_0x8969('0x17')],_0x2b14aa);_0xd4a0d3(_0x45abf2[_0x8969('0x16')](0x1f4,_0x3ddacd[_0x8969('0x17')]));});});};exports[_0x8969('0x25')]=function(_0x29ead1){var _0x3d1f78=this;return new Promise(function(_0xca53c2,_0x2133ea){return db['VoiceQueueReport'][_0x8969('0x26')](_0x29ead1['body'],{'raw':_0x29ead1['options']?_0x29ead1[_0x8969('0x1c')][_0x8969('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x1fe60d){logger[_0x8969('0x11')](_0x8969('0x25'),_0x29ead1);logger[_0x8969('0x14')](_0x8969('0x25'),_0x29ead1,JSON[_0x8969('0x27')](_0x1fe60d));_0xca53c2(_0x1fe60d);})[_0x8969('0x19')](function(_0x6d0c9){logger[_0x8969('0x16')]('CreateVoiceQueueReport',_0x6d0c9[_0x8969('0x17')],_0x29ead1);_0x2133ea(_0x3d1f78[_0x8969('0x16')](0x1f4,_0x6d0c9[_0x8969('0x17')]));});});};exports[_0x8969('0x28')]=function(_0x52e908){var _0x5ddceb=this;return new Promise(function(_0x1925c3,_0x1ad2ab){return db[_0x8969('0x1b')][_0x8969('0x29')](_0x52e908[_0x8969('0x2a')],{'raw':_0x52e908[_0x8969('0x1c')]?_0x52e908[_0x8969('0x1c')][_0x8969('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52e908[_0x8969('0x1c')]?_0x52e908[_0x8969('0x1c')]['where']||null:null,'attributes':_0x52e908[_0x8969('0x1c')]?_0x52e908[_0x8969('0x1c')][_0x8969('0x1f')]||null:null,'limit':_0x52e908['options']?_0x52e908['options'][_0x8969('0x20')]||null:null})[_0x8969('0x24')](function(_0x4611e9){logger[_0x8969('0x11')](_0x8969('0x28'),_0x52e908);logger['debug'](_0x8969('0x28'),_0x52e908,JSON[_0x8969('0x27')](_0x4611e9));_0x1925c3(_0x4611e9);})['catch'](function(_0x517866){logger[_0x8969('0x16')]('UpdateVoiceQueueReport',_0x517866[_0x8969('0x17')],_0x52e908);_0x1ad2ab(_0x5ddceb[_0x8969('0x16')](0x1f4,_0x517866['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 01a489f..c560391 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 _0x135c=['length','voiceQueueReport:','./voiceQueueReport.events','save','update','emit','removeListener','register'];(function(_0x143c0b,_0x1f3e3e){var _0x229c97=function(_0x29a856){while(--_0x29a856){_0x143c0b['push'](_0x143c0b['shift']());}};_0x229c97(++_0x1f3e3e);}(_0x135c,0xda));var _0xc135=function(_0x5b53d1,_0x4a7622){_0x5b53d1=_0x5b53d1-0x0;var _0x3a7cb5=_0x135c[_0x5b53d1];return _0x3a7cb5;};'use strict';var VoiceQueueReportEvents=require(_0xc135('0x0'));var events=[_0xc135('0x1'),'remove',_0xc135('0x2')];function createListener(_0x59bb32,_0x4d91af){return function(_0xfed959){_0x4d91af[_0xc135('0x3')](_0x59bb32,_0xfed959);};}function removeListener(_0x1d62b8,_0x4fea6a){return function(){VoiceQueueReportEvents[_0xc135('0x4')](_0x1d62b8,_0x4fea6a);};}exports[_0xc135('0x5')]=function(_0x14317c){for(var _0x42cf72=0x0,_0x2467ba=events[_0xc135('0x6')];_0x42cf72<_0x2467ba;_0x42cf72++){var _0x120204=events[_0x42cf72];var _0x2b20a4=createListener(_0xc135('0x7')+_0x120204,_0x14317c);VoiceQueueReportEvents['on'](_0x120204,_0x2b20a4);}}; \ No newline at end of file +var _0x7da7=['save','remove','register','voiceQueueReport:','./voiceQueueReport.events'];(function(_0xbf4a92,_0x4cfd8a){var _0x3b9cdf=function(_0x29e794){while(--_0x29e794){_0xbf4a92['push'](_0xbf4a92['shift']());}};_0x3b9cdf(++_0x4cfd8a);}(_0x7da7,0x10d));var _0x77da=function(_0x364cf8,_0x146b9b){_0x364cf8=_0x364cf8-0x0;var _0x6a59ee=_0x7da7[_0x364cf8];return _0x6a59ee;};'use strict';var VoiceQueueReportEvents=require(_0x77da('0x0'));var events=[_0x77da('0x1'),_0x77da('0x2'),'update'];function createListener(_0x59892b,_0x37667b){return function(_0xaaefb1){_0x37667b['emit'](_0x59892b,_0xaaefb1);};}function removeListener(_0x3a9fa6,_0x37b3d9){return function(){VoiceQueueReportEvents['removeListener'](_0x3a9fa6,_0x37b3d9);};}exports[_0x77da('0x3')]=function(_0xc54a12){for(var _0x47da81=0x0,_0x30afe0=events['length'];_0x47da81<_0x30afe0;_0x47da81++){var _0x1191de=events[_0x47da81];var _0x13992e=createListener(_0x77da('0x4')+_0x1191de,_0xc54a12);VoiceQueueReportEvents['on'](_0x1191de,_0x13992e);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index e847548..6591bfb 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 _0x8dd9=['../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','create','delete','/:id','destroy','exports','multer','util','path','express','Router'];(function(_0x1cbbfd,_0x214c43){var _0x53104c=function(_0x1b3655){while(--_0x1b3655){_0x1cbbfd['push'](_0x1cbbfd['shift']());}};_0x53104c(++_0x214c43);}(_0x8dd9,0x16b));var _0x98dd=function(_0x13a700,_0x88c174){_0x13a700=_0x13a700-0x0;var _0x3f0dc7=_0x8dd9[_0x13a700];return _0x3f0dc7;};'use strict';var multer=require(_0x98dd('0x0'));var util=require(_0x98dd('0x1'));var path=require(_0x98dd('0x2'));var timeout=require('connect-timeout');var express=require(_0x98dd('0x3'));var router=express[_0x98dd('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x98dd('0x5'));var config=require(_0x98dd('0x6'));var controller=require(_0x98dd('0x7'));router['get']('/',auth[_0x98dd('0x8')](),controller[_0x98dd('0x9')]);router[_0x98dd('0xa')]('/:id',auth[_0x98dd('0x8')](),controller['show']);router['post']('/',auth[_0x98dd('0x8')](),controller[_0x98dd('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x98dd('0xc')](_0x98dd('0xd'),auth[_0x98dd('0x8')](),controller[_0x98dd('0xe')]);module[_0x98dd('0xf')]=router; \ No newline at end of file +var _0xa92e=['../../config/environment','get','isAuthenticated','index','/:id','show','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1258a3,_0x116c40){var _0x28d9bd=function(_0x26a2f0){while(--_0x26a2f0){_0x1258a3['push'](_0x1258a3['shift']());}};_0x28d9bd(++_0x116c40);}(_0xa92e,0x1e5));var _0xea92=function(_0x3200a8,_0x31132f){_0x3200a8=_0x3200a8-0x0;var _0x21f956=_0xa92e[_0x3200a8];return _0x21f956;};'use strict';var multer=require(_0xea92('0x0'));var util=require('util');var path=require(_0xea92('0x1'));var timeout=require(_0xea92('0x2'));var express=require(_0xea92('0x3'));var router=express[_0xea92('0x4')]();var fs_extra=require(_0xea92('0x5'));var auth=require(_0xea92('0x6'));var interaction=require(_0xea92('0x7'));var config=require(_0xea92('0x8'));var controller=require('./voiceQueuesLog.controller');router[_0xea92('0x9')]('/',auth[_0xea92('0xa')](),controller[_0xea92('0xb')]);router[_0xea92('0x9')](_0xea92('0xc'),auth[_0xea92('0xa')](),controller[_0xea92('0xd')]);router['post']('/',auth[_0xea92('0xa')](),controller['create']);router[_0xea92('0xe')]('/:id',auth[_0xea92('0xa')](),controller[_0xea92('0xf')]);router['delete'](_0xea92('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xea92('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 bac68f6..cbfd790 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 _0x8a28=['sequelize','exports','STRING','DATE','literal'];(function(_0x5b3c48,_0x37001e){var _0x2fed4f=function(_0x5ec104){while(--_0x5ec104){_0x5b3c48['push'](_0x5b3c48['shift']());}};_0x2fed4f(++_0x37001e);}(_0x8a28,0x9b));var _0x88a2=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x8a28[_0x55f8b4];return _0x2475f9;};'use strict';var Sequelize=require(_0x88a2('0x0'));var moment=require('moment');module[_0x88a2('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x88a2('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x88a2('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x88a2('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x88a2('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x88a2('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x88a2('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x88a2('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x88a2('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x88a2('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x88a2('0x4')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0xdfe6=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','STRING'];(function(_0x2ca547,_0x50739a){var _0x2065bc=function(_0x31e2ab){while(--_0x31e2ab){_0x2ca547['push'](_0x2ca547['shift']());}};_0x2065bc(++_0x50739a);}(_0xdfe6,0xb6));var _0x6dfe=function(_0x86b378,_0x2bac7f){_0x86b378=_0x86b378-0x0;var _0x37cf95=_0xdfe6[_0x86b378];return _0x37cf95;};'use strict';var Sequelize=require(_0x6dfe('0x0'));var moment=require('moment');module[_0x6dfe('0x1')]={'time':{'type':Sequelize[_0x6dfe('0x2')]},'callid':{'type':Sequelize[_0x6dfe('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6dfe('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x6dfe('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x6dfe('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6dfe('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x6dfe('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x6dfe('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6dfe('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x6dfe('0x3')](_0x6dfe('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 4da0b36..58d95f4 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 _0x5047=['merge','VIRTUAL','filter','options','VoiceQueuesLog','includeAll','rows','catch','params','find','create','body','update','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x13992d,_0x3029ea){var _0x3d15bf=function(_0x3444f7){while(--_0x3444f7){_0x13992d['push'](_0x13992d['shift']());}};_0x3d15bf(++_0x3029ea);}(_0x5047,0x131));var _0x7504=function(_0x45ae0d,_0x1ea3b9){_0x45ae0d=_0x45ae0d-0x0;var _0x371826=_0x5047[_0x45ae0d];return _0x371826;};'use strict';var emlformat=require(_0x7504('0x0'));var rimraf=require(_0x7504('0x1'));var zipdir=require(_0x7504('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7504('0x3'));var BPromise=require(_0x7504('0x4'));var Mustache=require(_0x7504('0x5'));var util=require(_0x7504('0x6'));var path=require(_0x7504('0x7'));var sox=require(_0x7504('0x8'));var csv=require('to-csv');var ejs=require(_0x7504('0x9'));var fs=require('fs');var fs_extra=require(_0x7504('0xa'));var _=require('lodash');var squel=require(_0x7504('0xb'));var crypto=require(_0x7504('0xc'));var jsforce=require(_0x7504('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7504('0xe'));var querystring=require('querystring');var Papa=require(_0x7504('0xf'));var Redis=require(_0x7504('0x10'));var authService=require(_0x7504('0x11'));var qs=require(_0x7504('0x12'));var as=require(_0x7504('0x13'));var hardwareService=require(_0x7504('0x14'));var logger=require(_0x7504('0x15'))(_0x7504('0x16'));var utils=require(_0x7504('0x17'));var config=require(_0x7504('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7504('0x19'))['db'];function respondWithStatusCode(_0x38eaad,_0x507d60){_0x507d60=_0x507d60||0xcc;return function(_0x33a28c){if(_0x33a28c){return _0x38eaad['sendStatus'](_0x507d60);}return _0x38eaad[_0x7504('0x1a')](_0x507d60)[_0x7504('0x1b')]();};}function respondWithResult(_0x1ce385,_0x5efa57){_0x5efa57=_0x5efa57||0xc8;return function(_0x28ead2){if(_0x28ead2){return _0x1ce385[_0x7504('0x1a')](_0x5efa57)[_0x7504('0x1c')](_0x28ead2);}};}function respondWithFilteredResult(_0x4d59c6,_0x1bdafb){return function(_0x379c56){if(_0x379c56){var _0x458fb8=typeof _0x1bdafb[_0x7504('0x1d')]===_0x7504('0x1e')&&typeof _0x1bdafb[_0x7504('0x1f')]===_0x7504('0x1e');var _0x59ee51=_0x379c56[_0x7504('0x20')];var _0xd0836d=_0x458fb8?0x0:_0x1bdafb[_0x7504('0x1d')];var _0xe7bc0a=_0x458fb8?_0x379c56[_0x7504('0x20')]:_0x1bdafb[_0x7504('0x1d')]+_0x1bdafb[_0x7504('0x1f')];var _0x28f0ba;if(_0xe7bc0a>=_0x59ee51){_0xe7bc0a=_0x59ee51;_0x28f0ba=0xc8;}else{_0x28f0ba=0xce;}_0x4d59c6[_0x7504('0x1a')](_0x28f0ba);return _0x4d59c6[_0x7504('0x21')](_0x7504('0x22'),_0xd0836d+'-'+_0xe7bc0a+'/'+_0x59ee51)[_0x7504('0x1c')](_0x379c56);}return null;};}function patchUpdates(_0x4be340){return function(_0x2443fa){try{jsonpatch['apply'](_0x2443fa,_0x4be340,!![]);}catch(_0xe2c10){return BPromise[_0x7504('0x23')](_0xe2c10);}return _0x2443fa[_0x7504('0x24')]();};}function saveUpdates(_0x66cb3f,_0x64f6d3){return function(_0xfd9197){if(_0xfd9197){return _0xfd9197['update'](_0x66cb3f)[_0x7504('0x25')](function(_0x194e4f){return _0x194e4f;});}return null;};}function removeEntity(_0x3a111e,_0x346060){return function(_0x51002b){if(_0x51002b){return _0x51002b[_0x7504('0x26')]()[_0x7504('0x25')](function(){_0x3a111e[_0x7504('0x1a')](0xcc)[_0x7504('0x1b')]();});}};}function handleEntityNotFound(_0x241da1,_0x2e4fe6){return function(_0x54ef1e){if(!_0x54ef1e){_0x241da1[_0x7504('0x27')](0x194);}return _0x54ef1e;};}function handleError(_0x1dc959,_0x5f261d){_0x5f261d=_0x5f261d||0x1f4;return function(_0x381788){logger[_0x7504('0x28')](_0x381788[_0x7504('0x29')]);if(_0x381788[_0x7504('0x2a')]){delete _0x381788[_0x7504('0x2a')];}_0x1dc959['status'](_0x5f261d)['send'](_0x381788);};}exports['index']=function(_0x1fabe6,_0x2aacb2){var _0x2cc20c={},_0x16804b={},_0x2f228a={'count':0x0,'rows':[]};var _0x270851=_['map'](db['VoiceQueuesLog'][_0x7504('0x2b')],function(_0xa34e7f){return{'name':_0xa34e7f[_0x7504('0x2c')],'type':_0xa34e7f[_0x7504('0x2d')][_0x7504('0x2e')]};});_0x16804b[_0x7504('0x2f')]=_['map'](_0x270851,_0x7504('0x2a'));_0x16804b[_0x7504('0x30')]=_[_0x7504('0x31')](_0x1fabe6[_0x7504('0x30')]);_0x16804b[_0x7504('0x32')]=_['intersection'](_0x16804b['model'],_0x16804b[_0x7504('0x30')]);_0x2cc20c[_0x7504('0x33')]=_[_0x7504('0x34')](_0x16804b[_0x7504('0x2f')],qs[_0x7504('0x35')](_0x1fabe6[_0x7504('0x30')][_0x7504('0x35')]));_0x2cc20c[_0x7504('0x33')]=_0x2cc20c[_0x7504('0x33')][_0x7504('0x36')]?_0x2cc20c[_0x7504('0x33')]:_0x16804b['model'];if(!_0x1fabe6['query'][_0x7504('0x37')](_0x7504('0x38'))){_0x2cc20c[_0x7504('0x1f')]=qs[_0x7504('0x1f')](_0x1fabe6[_0x7504('0x30')]['limit']);_0x2cc20c[_0x7504('0x1d')]=qs[_0x7504('0x1d')](_0x1fabe6[_0x7504('0x30')]['offset']);}_0x2cc20c['order']=qs[_0x7504('0x39')](_0x1fabe6['query']['sort']);_0x2cc20c[_0x7504('0x3a')]=qs[_0x7504('0x32')](_[_0x7504('0x3b')](_0x1fabe6[_0x7504('0x30')],_0x16804b[_0x7504('0x32')]),_0x270851);if(_0x1fabe6[_0x7504('0x30')]['filter']){_0x2cc20c['where']=_[_0x7504('0x3c')](_0x2cc20c[_0x7504('0x3a')],{'$or':_['map'](_0x270851,function(_0x43ca7c){if(_0x43ca7c[_0x7504('0x2d')]!==_0x7504('0x3d')){var _0x598967={};_0x598967[_0x43ca7c['name']]={'$like':'%'+_0x1fabe6[_0x7504('0x30')][_0x7504('0x3e')]+'%'};return _0x598967;}})});}_0x2cc20c=_[_0x7504('0x3c')]({},_0x2cc20c,_0x1fabe6[_0x7504('0x3f')]);var _0x43ae96={'where':_0x2cc20c[_0x7504('0x3a')]};return db[_0x7504('0x40')]['count'](_0x43ae96)[_0x7504('0x25')](function(_0x42b4cf){_0x2f228a[_0x7504('0x20')]=_0x42b4cf;if(_0x1fabe6['query'][_0x7504('0x41')]){_0x2cc20c['include']=[{'all':!![]}];}return db['VoiceQueuesLog']['findAll'](_0x2cc20c);})[_0x7504('0x25')](function(_0x284924){_0x2f228a[_0x7504('0x42')]=_0x284924;return _0x2f228a;})[_0x7504('0x25')](respondWithFilteredResult(_0x2aacb2,_0x2cc20c))[_0x7504('0x43')](handleError(_0x2aacb2,null));};exports['show']=function(_0x41403d,_0x13c255){var _0x5b31f3={'raw':!![],'where':{'id':_0x41403d[_0x7504('0x44')]['id']}},_0x15eccd={};_0x15eccd['model']=_['keys'](db[_0x7504('0x40')][_0x7504('0x2b')]);_0x15eccd['query']=_['keys'](_0x41403d[_0x7504('0x30')]);_0x15eccd['filters']=_[_0x7504('0x34')](_0x15eccd[_0x7504('0x2f')],_0x15eccd[_0x7504('0x30')]);_0x5b31f3[_0x7504('0x33')]=_[_0x7504('0x34')](_0x15eccd[_0x7504('0x2f')],qs[_0x7504('0x35')](_0x41403d[_0x7504('0x30')][_0x7504('0x35')]));_0x5b31f3[_0x7504('0x33')]=_0x5b31f3[_0x7504('0x33')][_0x7504('0x36')]?_0x5b31f3[_0x7504('0x33')]:_0x15eccd[_0x7504('0x2f')];if(_0x41403d[_0x7504('0x30')][_0x7504('0x41')]){_0x5b31f3['include']=[{'all':!![]}];}_0x5b31f3=_[_0x7504('0x3c')]({},_0x5b31f3,_0x41403d[_0x7504('0x3f')]);return db['VoiceQueuesLog'][_0x7504('0x45')](_0x5b31f3)[_0x7504('0x25')](handleEntityNotFound(_0x13c255,null))['then'](respondWithResult(_0x13c255,null))['catch'](handleError(_0x13c255,null));};exports[_0x7504('0x46')]=function(_0x65b5ac,_0x2f9b89){return db[_0x7504('0x40')][_0x7504('0x46')](_0x65b5ac[_0x7504('0x47')],{})['then'](respondWithResult(_0x2f9b89,0xc9))[_0x7504('0x43')](handleError(_0x2f9b89,null));};exports[_0x7504('0x48')]=function(_0x17cdb4,_0x291285){if(_0x17cdb4[_0x7504('0x47')]['id']){delete _0x17cdb4[_0x7504('0x47')]['id'];}return db[_0x7504('0x40')][_0x7504('0x45')]({'where':{'id':_0x17cdb4['params']['id']}})['then'](handleEntityNotFound(_0x291285,null))[_0x7504('0x25')](saveUpdates(_0x17cdb4['body'],null))[_0x7504('0x25')](respondWithResult(_0x291285,null))[_0x7504('0x43')](handleError(_0x291285,null));};exports['destroy']=function(_0x1f2999,_0x636b80){return db[_0x7504('0x40')][_0x7504('0x45')]({'where':{'id':_0x1f2999[_0x7504('0x44')]['id']}})['then'](handleEntityNotFound(_0x636b80,null))['then'](removeEntity(_0x636b80,null))['catch'](handleError(_0x636b80,null));}; \ No newline at end of file +var _0x1648=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','sendStatus','error','stack','name','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','then','rows','catch','show','keys','options','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','fs-extra','lodash','crypto'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1648,0x85));var _0x8164=function(_0x47a6f8,_0x374775){_0x47a6f8=_0x47a6f8-0x0;var _0x3deee3=_0x1648[_0x47a6f8];return _0x3deee3;};'use strict';var emlformat=require(_0x8164('0x0'));var rimraf=require(_0x8164('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8164('0x2'));var rp=require(_0x8164('0x3'));var moment=require('moment');var BPromise=require(_0x8164('0x4'));var Mustache=require(_0x8164('0x5'));var util=require(_0x8164('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x8164('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8164('0x8'));var _=require(_0x8164('0x9'));var squel=require('squel');var crypto=require(_0x8164('0xa'));var jsforce=require(_0x8164('0xb'));var deskjs=require(_0x8164('0xc'));var toCsv=require(_0x8164('0x7'));var querystring=require(_0x8164('0xd'));var Papa=require(_0x8164('0xe'));var Redis=require(_0x8164('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8164('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8164('0x11'))(_0x8164('0x12'));var utils=require('../../config/utils');var config=require(_0x8164('0x13'));var licenseUtil=require(_0x8164('0x14'));var db=require(_0x8164('0x15'))['db'];function respondWithStatusCode(_0x5f1f8d,_0xb13fc9){_0xb13fc9=_0xb13fc9||0xcc;return function(_0x364261){if(_0x364261){return _0x5f1f8d['sendStatus'](_0xb13fc9);}return _0x5f1f8d[_0x8164('0x16')](_0xb13fc9)[_0x8164('0x17')]();};}function respondWithResult(_0x468370,_0x3eb923){_0x3eb923=_0x3eb923||0xc8;return function(_0x342eaf){if(_0x342eaf){return _0x468370[_0x8164('0x16')](_0x3eb923)[_0x8164('0x18')](_0x342eaf);}};}function respondWithFilteredResult(_0x2866cc,_0x269e7c){return function(_0x25b415){if(_0x25b415){var _0x44fda0=typeof _0x269e7c[_0x8164('0x19')]===_0x8164('0x1a')&&typeof _0x269e7c[_0x8164('0x1b')]===_0x8164('0x1a');var _0x21689e=_0x25b415[_0x8164('0x1c')];var _0x4b0700=_0x44fda0?0x0:_0x269e7c[_0x8164('0x19')];var _0x41d900=_0x44fda0?_0x25b415['count']:_0x269e7c[_0x8164('0x19')]+_0x269e7c['limit'];var _0x5953db;if(_0x41d900>=_0x21689e){_0x41d900=_0x21689e;_0x5953db=0xc8;}else{_0x5953db=0xce;}_0x2866cc[_0x8164('0x16')](_0x5953db);return _0x2866cc[_0x8164('0x1d')](_0x8164('0x1e'),_0x4b0700+'-'+_0x41d900+'/'+_0x21689e)['json'](_0x25b415);}return null;};}function patchUpdates(_0x3c3103){return function(_0x52bb5b){try{jsonpatch[_0x8164('0x1f')](_0x52bb5b,_0x3c3103,!![]);}catch(_0x24a67b){return BPromise['reject'](_0x24a67b);}return _0x52bb5b[_0x8164('0x20')]();};}function saveUpdates(_0x1d4318,_0xa5564c){return function(_0x2d5256){if(_0x2d5256){return _0x2d5256[_0x8164('0x21')](_0x1d4318)['then'](function(_0x1d40ca){return _0x1d40ca;});}return null;};}function removeEntity(_0x3b95f1,_0x73c1cf){return function(_0x20effd){if(_0x20effd){return _0x20effd[_0x8164('0x22')]()['then'](function(){_0x3b95f1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x272479,_0x50acff){return function(_0x1b820e){if(!_0x1b820e){_0x272479[_0x8164('0x23')](0x194);}return _0x1b820e;};}function handleError(_0x5bea0a,_0x55c33c){_0x55c33c=_0x55c33c||0x1f4;return function(_0x435fd){logger[_0x8164('0x24')](_0x435fd[_0x8164('0x25')]);if(_0x435fd['name']){delete _0x435fd[_0x8164('0x26')];}_0x5bea0a[_0x8164('0x16')](_0x55c33c)['send'](_0x435fd);};}exports['index']=function(_0x520c48,_0x5b8545){var _0x10b93a={},_0x1ea708={},_0x3d0617={'count':0x0,'rows':[]};var _0x5c8e69=_['map'](db[_0x8164('0x27')][_0x8164('0x28')],function(_0x4bbdf6){return{'name':_0x4bbdf6[_0x8164('0x29')],'type':_0x4bbdf6[_0x8164('0x2a')][_0x8164('0x2b')]};});_0x1ea708[_0x8164('0x2c')]=_[_0x8164('0x2d')](_0x5c8e69,'name');_0x1ea708[_0x8164('0x2e')]=_['keys'](_0x520c48[_0x8164('0x2e')]);_0x1ea708[_0x8164('0x2f')]=_['intersection'](_0x1ea708[_0x8164('0x2c')],_0x1ea708[_0x8164('0x2e')]);_0x10b93a['attributes']=_[_0x8164('0x30')](_0x1ea708[_0x8164('0x2c')],qs[_0x8164('0x31')](_0x520c48[_0x8164('0x2e')][_0x8164('0x31')]));_0x10b93a[_0x8164('0x32')]=_0x10b93a['attributes'][_0x8164('0x33')]?_0x10b93a[_0x8164('0x32')]:_0x1ea708[_0x8164('0x2c')];if(!_0x520c48['query'][_0x8164('0x34')](_0x8164('0x35'))){_0x10b93a[_0x8164('0x1b')]=qs[_0x8164('0x1b')](_0x520c48[_0x8164('0x2e')]['limit']);_0x10b93a['offset']=qs[_0x8164('0x19')](_0x520c48[_0x8164('0x2e')][_0x8164('0x19')]);}_0x10b93a['order']=qs[_0x8164('0x36')](_0x520c48['query'][_0x8164('0x36')]);_0x10b93a[_0x8164('0x37')]=qs['filters'](_['pick'](_0x520c48[_0x8164('0x2e')],_0x1ea708[_0x8164('0x2f')]),_0x5c8e69);if(_0x520c48[_0x8164('0x2e')][_0x8164('0x38')]){_0x10b93a[_0x8164('0x37')]=_[_0x8164('0x39')](_0x10b93a[_0x8164('0x37')],{'$or':_[_0x8164('0x2d')](_0x5c8e69,function(_0x3a604c){if(_0x3a604c[_0x8164('0x2a')]!==_0x8164('0x3a')){var _0x512231={};_0x512231[_0x3a604c['name']]={'$like':'%'+_0x520c48[_0x8164('0x2e')][_0x8164('0x38')]+'%'};return _0x512231;}})});}_0x10b93a=_[_0x8164('0x39')]({},_0x10b93a,_0x520c48['options']);var _0x5160f9={'where':_0x10b93a[_0x8164('0x37')]};return db[_0x8164('0x27')]['count'](_0x5160f9)['then'](function(_0x47e303){_0x3d0617['count']=_0x47e303;if(_0x520c48[_0x8164('0x2e')][_0x8164('0x3b')]){_0x10b93a[_0x8164('0x3c')]=[{'all':!![]}];}return db[_0x8164('0x27')][_0x8164('0x3d')](_0x10b93a);})[_0x8164('0x3e')](function(_0x440eb7){_0x3d0617[_0x8164('0x3f')]=_0x440eb7;return _0x3d0617;})[_0x8164('0x3e')](respondWithFilteredResult(_0x5b8545,_0x10b93a))[_0x8164('0x40')](handleError(_0x5b8545,null));};exports[_0x8164('0x41')]=function(_0x3ee0a1,_0x2f0b73){var _0x21a461={'raw':!![],'where':{'id':_0x3ee0a1['params']['id']}},_0x1b5e5d={};_0x1b5e5d[_0x8164('0x2c')]=_['keys'](db['VoiceQueuesLog'][_0x8164('0x28')]);_0x1b5e5d[_0x8164('0x2e')]=_[_0x8164('0x42')](_0x3ee0a1[_0x8164('0x2e')]);_0x1b5e5d[_0x8164('0x2f')]=_['intersection'](_0x1b5e5d[_0x8164('0x2c')],_0x1b5e5d[_0x8164('0x2e')]);_0x21a461[_0x8164('0x32')]=_['intersection'](_0x1b5e5d[_0x8164('0x2c')],qs[_0x8164('0x31')](_0x3ee0a1[_0x8164('0x2e')]['fields']));_0x21a461[_0x8164('0x32')]=_0x21a461[_0x8164('0x32')][_0x8164('0x33')]?_0x21a461[_0x8164('0x32')]:_0x1b5e5d['model'];if(_0x3ee0a1['query'][_0x8164('0x3b')]){_0x21a461[_0x8164('0x3c')]=[{'all':!![]}];}_0x21a461=_['merge']({},_0x21a461,_0x3ee0a1[_0x8164('0x43')]);return db[_0x8164('0x27')][_0x8164('0x44')](_0x21a461)['then'](handleEntityNotFound(_0x2f0b73,null))[_0x8164('0x3e')](respondWithResult(_0x2f0b73,null))[_0x8164('0x40')](handleError(_0x2f0b73,null));};exports[_0x8164('0x45')]=function(_0x94405,_0x4c397e){return db[_0x8164('0x27')][_0x8164('0x45')](_0x94405[_0x8164('0x46')],{})[_0x8164('0x3e')](respondWithResult(_0x4c397e,0xc9))['catch'](handleError(_0x4c397e,null));};exports[_0x8164('0x21')]=function(_0x3830d9,_0x5e1531){if(_0x3830d9[_0x8164('0x46')]['id']){delete _0x3830d9[_0x8164('0x46')]['id'];}return db[_0x8164('0x27')][_0x8164('0x44')]({'where':{'id':_0x3830d9[_0x8164('0x47')]['id']}})[_0x8164('0x3e')](handleEntityNotFound(_0x5e1531,null))[_0x8164('0x3e')](saveUpdates(_0x3830d9[_0x8164('0x46')],null))[_0x8164('0x3e')](respondWithResult(_0x5e1531,null))['catch'](handleError(_0x5e1531,null));};exports[_0x8164('0x22')]=function(_0x52b28b,_0xb9678b){return db['VoiceQueuesLog']['find']({'where':{'id':_0x52b28b[_0x8164('0x47')]['id']}})[_0x8164('0x3e')](handleEntityNotFound(_0xb9678b,null))[_0x8164('0x3e')](removeEntity(_0xb9678b,null))[_0x8164('0x40')](handleError(_0xb9678b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 6b505b7..2f23ec9 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 _0x59a2=['rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event','dtm','lodash','util','../../config/logger','moment','request-promise'];(function(_0x3da743,_0x2f8679){var _0x2c6bc8=function(_0x1b1567){while(--_0x1b1567){_0x3da743['push'](_0x3da743['shift']());}};_0x2c6bc8(++_0x2f8679);}(_0x59a2,0x1dc));var _0x259a=function(_0x1103c0,_0x17a093){_0x1103c0=_0x1103c0-0x0;var _0x5dae88=_0x59a2[_0x1103c0];return _0x5dae88;};'use strict';var _=require(_0x259a('0x0'));var util=require(_0x259a('0x1'));var logger=require(_0x259a('0x2'))('api');var moment=require(_0x259a('0x3'));var BPromise=require('bluebird');var rp=require(_0x259a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x259a('0x5'));var config=require(_0x259a('0x6'));var attributes=require('./voiceQueuesLog.attributes');module[_0x259a('0x7')]=function(_0x35e077,_0x5e2c40){return _0x35e077[_0x259a('0x8')](_0x259a('0x9'),attributes,{'tableName':_0x259a('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x259a('0xb'),_0x259a('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xb0c5=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event','lodash','moment'];(function(_0x34c7a8,_0x1fde1c){var _0x34fc72=function(_0x1e38f0){while(--_0x1e38f0){_0x34c7a8['push'](_0x34c7a8['shift']());}};_0x34fc72(++_0x1fde1c);}(_0xb0c5,0xfa));var _0x5b0c=function(_0x19140d,_0x201c46){_0x19140d=_0x19140d-0x0;var _0x5c37c1=_0xb0c5[_0x19140d];return _0x5c37c1;};'use strict';var _=require(_0x5b0c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5b0c('0x1'));var BPromise=require(_0x5b0c('0x2'));var rp=require(_0x5b0c('0x3'));var fs=require('fs');var path=require(_0x5b0c('0x4'));var rimraf=require(_0x5b0c('0x5'));var config=require(_0x5b0c('0x6'));var attributes=require(_0x5b0c('0x7'));module[_0x5b0c('0x8')]=function(_0x48ad35,_0x4ea937){return _0x48ad35['define'](_0x5b0c('0x9'),attributes,{'tableName':_0x5b0c('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x5b0c('0xb'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index dfd6d44..2b25cd7 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 _0x43ae=['client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1bee4a,_0x30af1d){var _0x25af7f=function(_0x16c5e2){while(--_0x16c5e2){_0x1bee4a['push'](_0x1bee4a['shift']());}};_0x25af7f(++_0x30af1d);}(_0x43ae,0x199));var _0xe43a=function(_0x3d43b3,_0x19fdc9){_0x3d43b3=_0x3d43b3-0x0;var _0x4ed23c=_0x43ae[_0x3d43b3];return _0x4ed23c;};'use strict';var _=require(_0xe43a('0x0'));var util=require(_0xe43a('0x1'));var moment=require('moment');var BPromise=require(_0xe43a('0x2'));var rs=require(_0xe43a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe43a('0x4'))['db'];var utils=require(_0xe43a('0x5'));var logger=require(_0xe43a('0x6'))('rpc');var config=require(_0xe43a('0x7'));var jayson=require(_0xe43a('0x8'));var client=jayson[_0xe43a('0x9')][_0xe43a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1913ad,_0x27a8be,_0x19acaf){return new BPromise(function(_0x5ab977,_0x55048a){return client[_0xe43a('0xb')](_0x1913ad,_0x19acaf)[_0xe43a('0xc')](function(_0x376d8e){logger[_0xe43a('0xd')](_0xe43a('0xe'),_0x27a8be,'request\x20sent');logger[_0xe43a('0xf')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x27a8be,'request\x20sent',JSON[_0xe43a('0x10')](_0x376d8e));if(_0x376d8e[_0xe43a('0x11')]){if(_0x376d8e['error'][_0xe43a('0x12')]===0x1f4){logger[_0xe43a('0x11')](_0xe43a('0xe'),_0x27a8be,_0x376d8e[_0xe43a('0x11')]['message']);return _0x55048a(_0x376d8e['error']['message']);}logger[_0xe43a('0x11')](_0xe43a('0xe'),_0x27a8be,_0x376d8e['error'][_0xe43a('0x13')]);return _0x5ab977(_0x376d8e[_0xe43a('0x11')][_0xe43a('0x13')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x27a8be,_0xe43a('0x14'));_0x5ab977(_0x376d8e['result'][_0xe43a('0x13')]);}})[_0xe43a('0x15')](function(_0x1d8ac5){logger[_0xe43a('0x11')](_0xe43a('0xe'),_0x27a8be,_0x1d8ac5);_0x55048a(_0x1d8ac5);});});} \ No newline at end of file +var _0x5e24=['request','then','info','request\x20sent','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4169d8,_0x3d7cd4){var _0x32084a=function(_0x5f59c6){while(--_0x5f59c6){_0x4169d8['push'](_0x4169d8['shift']());}};_0x32084a(++_0x3d7cd4);}(_0x5e24,0xb2));var _0x45e2=function(_0x10d89b,_0x13351a){_0x10d89b=_0x10d89b-0x0;var _0x4251db=_0x5e24[_0x10d89b];return _0x4251db;};'use strict';var _=require('lodash');var util=require(_0x45e2('0x0'));var moment=require('moment');var BPromise=require(_0x45e2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x45e2('0x2'));var db=require(_0x45e2('0x3'))['db'];var utils=require(_0x45e2('0x4'));var logger=require(_0x45e2('0x5'))(_0x45e2('0x6'));var config=require(_0x45e2('0x7'));var jayson=require(_0x45e2('0x8'));var client=jayson[_0x45e2('0x9')][_0x45e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8a1c24,_0x4df492,_0x3b19a2){return new BPromise(function(_0x4a0829,_0x35ea06){return client[_0x45e2('0xb')](_0x8a1c24,_0x3b19a2)[_0x45e2('0xc')](function(_0x43e8f8){logger[_0x45e2('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4df492,_0x45e2('0xe'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x4df492,'request\x20sent',JSON[_0x45e2('0xf')](_0x43e8f8));if(_0x43e8f8[_0x45e2('0x10')]){if(_0x43e8f8[_0x45e2('0x10')][_0x45e2('0x11')]===0x1f4){logger[_0x45e2('0x10')](_0x45e2('0x12'),_0x4df492,_0x43e8f8[_0x45e2('0x10')][_0x45e2('0x13')]);return _0x35ea06(_0x43e8f8['error'][_0x45e2('0x13')]);}logger[_0x45e2('0x10')](_0x45e2('0x12'),_0x4df492,_0x43e8f8[_0x45e2('0x10')][_0x45e2('0x13')]);return _0x4a0829(_0x43e8f8[_0x45e2('0x10')][_0x45e2('0x13')]);}else{logger[_0x45e2('0xd')](_0x45e2('0x12'),_0x4df492,_0x45e2('0xe'));_0x4a0829(_0x43e8f8[_0x45e2('0x14')][_0x45e2('0x13')]);}})['catch'](function(_0x286035){logger['error'](_0x45e2('0x12'),_0x4df492,_0x286035);_0x35ea06(_0x286035);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 12112bf..c475457 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 _0x91a3=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','/describe','isAuthenticated','describe','get','/:id/download','downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','update','delete','/:id','destroy'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x91a3,0x11f));var _0x391a=function(_0x3a76a1,_0x1dfc96){_0x3a76a1=_0x3a76a1-0x0;var _0x4601e1=_0x91a3[_0x3a76a1];return _0x4601e1;};'use strict';var multer=require(_0x391a('0x0'));var util=require(_0x391a('0x1'));var path=require(_0x391a('0x2'));var timeout=require('connect-timeout');var express=require(_0x391a('0x3'));var router=express[_0x391a('0x4')]();var fs_extra=require(_0x391a('0x5'));var auth=require(_0x391a('0x6'));var interaction=require(_0x391a('0x7'));var config=require(_0x391a('0x8'));var controller=require(_0x391a('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x391a('0xa'),auth[_0x391a('0xb')](),controller[_0x391a('0xc')]);router[_0x391a('0xd')]('/:id',auth[_0x391a('0xb')](),controller['show']);router['get'](_0x391a('0xe'),auth[_0x391a('0xb')](),controller['download']);router[_0x391a('0xd')]('/:id/downloads',controller[_0x391a('0xf')]);router[_0x391a('0xd')]('/:id/transcribe',auth[_0x391a('0xb')](),controller[_0x391a('0x10')]);router[_0x391a('0x11')]('/',auth['isAuthenticated'](),controller[_0x391a('0x12')]);router[_0x391a('0x11')](_0x391a('0x13'),auth[_0x391a('0xb')](),controller[_0x391a('0x14')]);router['put']('/:id',auth[_0x391a('0xb')](),controller[_0x391a('0x15')]);router[_0x391a('0x16')](_0x391a('0x17'),auth['isAuthenticated'](),controller[_0x391a('0x18')]);module[_0x391a('0x19')]=router; \ No newline at end of file +var _0xca2f=['index','/describe','isAuthenticated','describe','/:id','show','/:id/download','downloads','/:id/transcribe','downloadTranscribe','create','post','runTranscribe','put','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service','get'];(function(_0x507c81,_0x3e1b56){var _0x368a25=function(_0x1e7519){while(--_0x1e7519){_0x507c81['push'](_0x507c81['shift']());}};_0x368a25(++_0x3e1b56);}(_0xca2f,0x119));var _0xfca2=function(_0x12058d,_0x922975){_0x12058d=_0x12058d-0x0;var _0x152865=_0xca2f[_0x12058d];return _0x152865;};'use strict';var multer=require(_0xfca2('0x0'));var util=require(_0xfca2('0x1'));var path=require(_0xfca2('0x2'));var timeout=require('connect-timeout');var express=require(_0xfca2('0x3'));var router=express[_0xfca2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfca2('0x5'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0xfca2('0x6')]('/',auth['isAuthenticated'](),controller[_0xfca2('0x7')]);router[_0xfca2('0x6')](_0xfca2('0x8'),auth[_0xfca2('0x9')](),controller[_0xfca2('0xa')]);router['get'](_0xfca2('0xb'),auth['isAuthenticated'](),controller[_0xfca2('0xc')]);router[_0xfca2('0x6')](_0xfca2('0xd'),auth[_0xfca2('0x9')](),controller['download']);router['get']('/:id/downloads',controller[_0xfca2('0xe')]);router[_0xfca2('0x6')](_0xfca2('0xf'),auth[_0xfca2('0x9')](),controller[_0xfca2('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfca2('0x11')]);router[_0xfca2('0x12')](_0xfca2('0xf'),auth[_0xfca2('0x9')](),controller[_0xfca2('0x13')]);router[_0xfca2('0x14')](_0xfca2('0xb'),auth[_0xfca2('0x9')](),controller[_0xfca2('0x15')]);router[_0xfca2('0x16')](_0xfca2('0xb'),auth[_0xfca2('0x9')](),controller['destroy']);module[_0xfca2('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index c35b497..d89de34 100644 --- a/server/api/voiceRecording/voiceRecording.attributes.js +++ b/server/api/voiceRecording/voiceRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 5ab6fbc..5a577aa 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 _0x3b6f=['transcribeRegion','runSentiment','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','Transcript\x20not\x20available','eml-format','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','save','update','destroy','then','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','format','keys','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','sequelize','MD5','col','token','$and','push','Sequelize','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','findOne','transcribe','transcribeAccountId'];(function(_0x564279,_0x26cb53){var _0x4b3aff=function(_0x52130d){while(--_0x52130d){_0x564279['push'](_0x564279['shift']());}};_0x4b3aff(++_0x26cb53);}(_0x3b6f,0x1cd));var _0xf3b6=function(_0x4e439e,_0x436bc1){_0x4e439e=_0x4e439e-0x0;var _0x4b3e10=_0x3b6f[_0x4e439e];return _0x4b3e10;};'use strict';var emlformat=require(_0xf3b6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf3b6('0x1'));var moment=require(_0xf3b6('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf3b6('0x3'));var util=require('util');var path=require('path');var sox=require(_0xf3b6('0x4'));var csv=require(_0xf3b6('0x5'));var ejs=require(_0xf3b6('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf3b6('0x7'));var squel=require(_0xf3b6('0x8'));var crypto=require(_0xf3b6('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf3b6('0x5'));var querystring=require(_0xf3b6('0xa'));var Papa=require(_0xf3b6('0xb'));var AWS=require(_0xf3b6('0xc'));var uuidv4=require('uuid/v4');var Redis=require(_0xf3b6('0xd'));var authService=require(_0xf3b6('0xe'));var qs=require(_0xf3b6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf3b6('0x10'));var logger=require(_0xf3b6('0x11'))(_0xf3b6('0x12'));var utils=require(_0xf3b6('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf3b6('0x14'))['db'];function respondWithStatusCode(_0x3b0248,_0x110f0d){_0x110f0d=_0x110f0d||0xcc;return function(_0x54130c){if(_0x54130c){return _0x3b0248[_0xf3b6('0x15')](_0x110f0d);}return _0x3b0248[_0xf3b6('0x16')](_0x110f0d)[_0xf3b6('0x17')]();};}function respondWithResult(_0x14d595,_0x412951){_0x412951=_0x412951||0xc8;return function(_0x58f279){if(_0x58f279){return _0x14d595['status'](_0x412951)['json'](_0x58f279);}};}function respondWithFilteredResult(_0xeeb658,_0x2978ea){return function(_0x32364e){if(_0x32364e){var _0x360497=typeof _0x2978ea[_0xf3b6('0x18')]===_0xf3b6('0x19')&&typeof _0x2978ea[_0xf3b6('0x1a')]===_0xf3b6('0x19');var _0x610ea=_0x32364e[_0xf3b6('0x1b')];var _0x2fd48c=_0x360497?0x0:_0x2978ea['offset'];var _0x436c9d=_0x360497?_0x32364e['count']:_0x2978ea['offset']+_0x2978ea[_0xf3b6('0x1a')];var _0x76cd49;if(_0x436c9d>=_0x610ea){_0x436c9d=_0x610ea;_0x76cd49=0xc8;}else{_0x76cd49=0xce;}_0xeeb658['status'](_0x76cd49);return _0xeeb658['set'](_0xf3b6('0x1c'),_0x2fd48c+'-'+_0x436c9d+'/'+_0x610ea)[_0xf3b6('0x1d')](_0x32364e);}return null;};}function patchUpdates(_0x4630bb){return function(_0x218071){try{jsonpatch['apply'](_0x218071,_0x4630bb,!![]);}catch(_0x76760b){return BPromise['reject'](_0x76760b);}return _0x218071[_0xf3b6('0x1e')]();};}function saveUpdates(_0x5d1c4c,_0x12a05e){return function(_0x51434d){if(_0x51434d){return _0x51434d[_0xf3b6('0x1f')](_0x5d1c4c)['then'](function(_0x1af738){return _0x1af738;});}return null;};}function removeEntity(_0x566bd2,_0x528853){return function(_0x45c55f){if(_0x45c55f){return _0x45c55f[_0xf3b6('0x20')]()[_0xf3b6('0x21')](function(){_0x566bd2[_0xf3b6('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4825e1,_0x322d75){return function(_0x523375){if(!_0x523375){_0x4825e1[_0xf3b6('0x15')](0x194);}return _0x523375;};}function handleError(_0x592a2c,_0x3421ef){_0x3421ef=_0x3421ef||0x1f4;return function(_0x5876a6){logger[_0xf3b6('0x22')](_0x5876a6[_0xf3b6('0x23')]);if(_0x5876a6[_0xf3b6('0x24')]){delete _0x5876a6[_0xf3b6('0x24')];}_0x592a2c[_0xf3b6('0x16')](_0x3421ef)[_0xf3b6('0x25')](_0x5876a6);};}exports[_0xf3b6('0x26')]=function(_0x3849c9,_0x557c94){var _0x4ca315={},_0x4c0059={},_0x200ffe={'count':0x0,'rows':[]};var _0x36f039=_[_0xf3b6('0x27')](db[_0xf3b6('0x28')][_0xf3b6('0x29')],function(_0x210783){return{'name':_0x210783[_0xf3b6('0x2a')],'type':_0x210783[_0xf3b6('0x2b')]['key']};});_0x4c0059[_0xf3b6('0x2c')]=_[_0xf3b6('0x2d')](_[_0xf3b6('0x27')](_0x36f039,_0xf3b6('0x24')),[_0xf3b6('0x2e')]);_0x4c0059['query']=_[_0xf3b6('0x2f')](_0x3849c9['query']);_0x4c0059[_0xf3b6('0x30')]=_['intersection'](_0x4c0059['model'],_0x4c0059[_0xf3b6('0x31')]);_0x4ca315['attributes']=_[_0xf3b6('0x32')](_0x4c0059[_0xf3b6('0x2c')],qs[_0xf3b6('0x33')](_0x3849c9['query'][_0xf3b6('0x33')]));_0x4ca315[_0xf3b6('0x34')]=_0x4ca315[_0xf3b6('0x34')][_0xf3b6('0x35')]?_0x4ca315[_0xf3b6('0x34')]:_0x4c0059['model'];if(!_0x3849c9[_0xf3b6('0x31')][_0xf3b6('0x36')](_0xf3b6('0x37'))){_0x4ca315[_0xf3b6('0x1a')]=qs[_0xf3b6('0x1a')](_0x3849c9[_0xf3b6('0x31')][_0xf3b6('0x1a')]);_0x4ca315['offset']=qs['offset'](_0x3849c9[_0xf3b6('0x31')]['offset']);}_0x4ca315[_0xf3b6('0x38')]=qs[_0xf3b6('0x39')](_0x3849c9[_0xf3b6('0x31')][_0xf3b6('0x39')]);_0x4ca315[_0xf3b6('0x3a')]=qs[_0xf3b6('0x30')](_[_0xf3b6('0x3b')](_0x3849c9['query'],_0x4c0059[_0xf3b6('0x30')]),_0x36f039);if(_0x3849c9[_0xf3b6('0x31')][_0xf3b6('0x3c')]){_0x4ca315[_0xf3b6('0x3a')]=_['merge'](_0x4ca315[_0xf3b6('0x3a')],{'$or':_['map'](_0x36f039,function(_0x265841){if(_0x265841['type']!==_0xf3b6('0x3d')){var _0x2e214f={};_0x2e214f[_0x265841['name']]={'$like':'%'+_0x3849c9[_0xf3b6('0x31')][_0xf3b6('0x3c')]+'%'};return _0x2e214f;}})});}_0x4ca315=_[_0xf3b6('0x3e')]({},_0x4ca315,_0x3849c9[_0xf3b6('0x3f')]);var _0x298ee6={'where':_0x4ca315[_0xf3b6('0x3a')]};return db['VoiceRecording'][_0xf3b6('0x1b')](_0x298ee6)['then'](function(_0x282964){_0x200ffe[_0xf3b6('0x1b')]=_0x282964;if(_0x3849c9['query'][_0xf3b6('0x40')]){_0x4ca315[_0xf3b6('0x41')]=[{'all':!![]}];}return db[_0xf3b6('0x28')][_0xf3b6('0x42')](_0x4ca315);})[_0xf3b6('0x21')](function(_0x2d6389){_0x200ffe[_0xf3b6('0x43')]=_0x2d6389;return _0x200ffe;})['then'](respondWithFilteredResult(_0x557c94,_0x4ca315))[_0xf3b6('0x44')](handleError(_0x557c94,null));};exports[_0xf3b6('0x45')]=function(_0x437bc9,_0x50acc6){var _0x14833d={'raw':![],'where':{'id':_0x437bc9[_0xf3b6('0x46')]['id']}},_0x1014b6={};_0x1014b6[_0xf3b6('0x2c')]=_[_0xf3b6('0x2f')](db[_0xf3b6('0x28')][_0xf3b6('0x29')]);_0x1014b6[_0xf3b6('0x31')]=_[_0xf3b6('0x2f')](_0x437bc9[_0xf3b6('0x31')]);_0x1014b6[_0xf3b6('0x30')]=_[_0xf3b6('0x32')](_0x1014b6[_0xf3b6('0x2c')],_0x1014b6[_0xf3b6('0x31')]);_0x14833d[_0xf3b6('0x34')]=_[_0xf3b6('0x32')](_0x1014b6['model'],qs[_0xf3b6('0x33')](_0x437bc9[_0xf3b6('0x31')]['fields']));_0x14833d[_0xf3b6('0x34')]=_0x14833d[_0xf3b6('0x34')][_0xf3b6('0x35')]?_0x14833d['attributes']:_0x1014b6[_0xf3b6('0x2c')];if(_0x437bc9[_0xf3b6('0x31')][_0xf3b6('0x40')]){_0x14833d[_0xf3b6('0x41')]=[{'all':!![]}];}_0x14833d=_['merge']({},_0x14833d,_0x437bc9[_0xf3b6('0x3f')]);return db[_0xf3b6('0x28')][_0xf3b6('0x47')](_0x14833d)['then'](handleEntityNotFound(_0x50acc6,null))[_0xf3b6('0x21')](respondWithResult(_0x50acc6,null))[_0xf3b6('0x44')](handleError(_0x50acc6,null));};exports[_0xf3b6('0x48')]=function(_0x2fc2c2,_0x3a971a){return db[_0xf3b6('0x28')][_0xf3b6('0x48')](_0x2fc2c2[_0xf3b6('0x49')],{})[_0xf3b6('0x21')](respondWithResult(_0x3a971a,0xc9))[_0xf3b6('0x44')](handleError(_0x3a971a,null));};exports[_0xf3b6('0x1f')]=function(_0x3dd1d0,_0x3af2e3){if(_0x3dd1d0[_0xf3b6('0x49')]['id']){delete _0x3dd1d0['body']['id'];}return db['VoiceRecording'][_0xf3b6('0x47')]({'where':{'id':_0x3dd1d0[_0xf3b6('0x46')]['id']}})['then'](handleEntityNotFound(_0x3af2e3,null))[_0xf3b6('0x21')](saveUpdates(_0x3dd1d0['body'],null))[_0xf3b6('0x21')](respondWithResult(_0x3af2e3,null))['catch'](handleError(_0x3af2e3,null));};exports[_0xf3b6('0x4a')]=function(_0x23dd7f,_0x5021e9){return db[_0xf3b6('0x28')][_0xf3b6('0x4a')]()[_0xf3b6('0x21')](respondWithResult(_0x5021e9,null))[_0xf3b6('0x44')](handleError(_0x5021e9,null));};exports[_0xf3b6('0x4b')]=function(_0x3e5539,_0x304614,_0x39f794){var _0x4cae62=require(_0xf3b6('0x4c'));var _0x4076b4=![];var _0x30359f={};if(_0x3e5539['query']['type']&&_0x3e5539[_0xf3b6('0x31')]['type']===_0xf3b6('0x4d')){_0x30359f[_0xf3b6('0x4d')]=_0x3e5539[_0xf3b6('0x46')]['id'];}else{_0x30359f['id']=_0x3e5539['params']['id'];}return db['VoiceRecording'][_0xf3b6('0x47')]({'where':_0x30359f,'attributes':['id','value'],'raw':!![]})[_0xf3b6('0x21')](handleEntityNotFound(_0x304614,null))['then'](function(_0x45eec4){if(_0x45eec4){var _0x483a8a=_0x45eec4[_0xf3b6('0x4e')];var _0x23fb5c=util[_0xf3b6('0x2e')](_0xf3b6('0x4f'),_0x483a8a);if(fs[_0xf3b6('0x50')](_0x23fb5c)){_0x4076b4=!![];return _0x4cae62[_0xf3b6('0x51')](_0x23fb5c,_0x483a8a,config[_0xf3b6('0x52')][_0xf3b6('0x53')])['then'](function(){return _0x45eec4;});}return _0x45eec4;}})['then'](function(_0x592cc9){if(_0x592cc9){var _0x2a9db4=_0x592cc9['value'];if(!fs[_0xf3b6('0x50')](_0x2a9db4)){throw new db['Sequelize'][(_0xf3b6('0x54'))](_0xf3b6('0x55'));}if(_0x592cc9[_0xf3b6('0x56')]){return _0x304614['download'](_0x2a9db4,_0x592cc9[_0xf3b6('0x56')]+path[_0xf3b6('0x57')](_0x2a9db4),function(){if(_0x4076b4){fs['unlink'](_0x2a9db4);}});}else{return _0x304614['download'](_0x2a9db4,function(_0x3d282b){if(_0x4076b4){fs[_0xf3b6('0x58')](_0x2a9db4);}});}}})[_0xf3b6('0x44')](function(_0x3d3c6e){if(_0x3d3c6e[_0xf3b6('0x59')]===_0xf3b6('0x55')){_0x304614['status'](0x194)[_0xf3b6('0x25')](_0xf3b6('0x5a'));}else{return handleError(_0x304614,null);}});};exports['downloads']=function(_0x8f5b56,_0x20ecc5,_0x376397){var _0x4641fa=require('../../components/encryptor');var _0x1c04e7=![];var _0x152368={'$and':[db['sequelize']['where'](db[_0xf3b6('0x5b')]['fn'](_0xf3b6('0x5c'),db[_0xf3b6('0x5b')][_0xf3b6('0x5d')](_0xf3b6('0x4d'))),_0x8f5b56[_0xf3b6('0x31')][_0xf3b6('0x5e')])]};if(_0x8f5b56[_0xf3b6('0x31')][_0xf3b6('0x2b')]&&_0x8f5b56[_0xf3b6('0x31')][_0xf3b6('0x2b')]==='uniqueid'){_0x152368[_0xf3b6('0x5f')][_0xf3b6('0x60')]({'uniqueid':_0x8f5b56[_0xf3b6('0x46')]['id']});}else{_0x152368['$and'][_0xf3b6('0x60')]({'id':_0x8f5b56[_0xf3b6('0x46')]['id']});}return db[_0xf3b6('0x28')][_0xf3b6('0x47')]({'where':_0x152368,'attributes':['id',_0xf3b6('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x20ecc5,null))['then'](function(_0x5c5e53){if(_0x5c5e53){var _0x3fc0be=util['format'](_0xf3b6('0x4f'),_0x5c5e53[_0xf3b6('0x4e')]);if(fs['existsSync'](_0x3fc0be)){_0x1c04e7=!![];return _0x4641fa[_0xf3b6('0x51')](_0x3fc0be,_0x5c5e53['value'],config[_0xf3b6('0x52')][_0xf3b6('0x53')])[_0xf3b6('0x21')](function(){return _0x5c5e53;});}return _0x5c5e53;}})['then'](function(_0x8bfc63){if(_0x8bfc63){if(!fs[_0xf3b6('0x50')](_0x8bfc63[_0xf3b6('0x4e')])){throw new db[(_0xf3b6('0x61'))][(_0xf3b6('0x54'))](_0xf3b6('0x55'));}if(_0x8bfc63[_0xf3b6('0x56')]){return _0x20ecc5[_0xf3b6('0x4b')](_0x8bfc63[_0xf3b6('0x4e')],_0x8bfc63[_0xf3b6('0x56')]+path[_0xf3b6('0x57')](_0x8bfc63[_0xf3b6('0x4e')]),function(){if(_0x1c04e7){fs['unlink'](_0x8bfc63[_0xf3b6('0x4e')]);}});}else{return _0x20ecc5[_0xf3b6('0x4b')](_0x8bfc63[_0xf3b6('0x4e')],function(_0x13a7ef){if(_0x1c04e7){fs[_0xf3b6('0x58')](_0x8bfc63[_0xf3b6('0x4e')]);}});}}})[_0xf3b6('0x44')](handleError(_0x20ecc5,null));};exports[_0xf3b6('0x20')]=function(_0x5af978,_0x446b49){return db['VoiceRecording'][_0xf3b6('0x47')]({'where':{'id':_0x5af978[_0xf3b6('0x46')]['id']}})[_0xf3b6('0x21')](function(_0x1da10e){if(_[_0xf3b6('0x62')](_0x1da10e)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1da10e;})['then'](function(_0x487979){var _0x4315aa=_0x487979[_0xf3b6('0x4e')];logger[_0xf3b6('0x63')](_0xf3b6('0x64'),_0x4315aa);if(!_['isNil'](_0x487979['value'])&&fs['existsSync'](_0x4315aa)){logger[_0xf3b6('0x63')](_0xf3b6('0x65')+_0x4315aa+_0xf3b6('0x66'));fs['unlinkSync'](_0x4315aa);}_0x4315aa=_0x4315aa+_0xf3b6('0x67');if(!_[_0xf3b6('0x62')](_0x487979['value'])&&fs[_0xf3b6('0x50')](_0x4315aa)){logger[_0xf3b6('0x63')](_0xf3b6('0x65')+_0x4315aa+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf3b6('0x68')](_0x4315aa);}return _0x487979;})[_0xf3b6('0x21')](function(_0x4d0e2a){if(!_0x4d0e2a)throw new InternalError();return _0x4d0e2a[_0xf3b6('0x20')]();})[_0xf3b6('0x21')](function(){_0x446b49[_0xf3b6('0x16')](0xcc)[_0xf3b6('0x17')]();})[_0xf3b6('0x44')](handleError(_0x446b49,null));};function getBucketslist(_0x358dcd,_0x5277de,_0x36c6f2){return new Promise(function(_0x11235e,_0x58929f){var _0x36d115=new AWS['S3']({'accessKeyId':_0x5277de,'secretAccessKey':_0x358dcd,'region':_0x36c6f2});_0x36d115[_0xf3b6('0x69')]({},function(_0x1f30f6,_0x630dc){if(_0x1f30f6){return _0x58929f(_0x1f30f6);}else{return _0x11235e(_0x630dc);}});});}function createBucket(_0x2cacfc,_0x47ac89,_0x2ca5f3,_0x43a020){return new Promise(function(_0xe95242,_0x5355db){var _0x53014a=new AWS['S3']({'accessKeyId':_0x47ac89,'secretAccessKey':_0x2cacfc,'region':_0x2ca5f3});_0x53014a[_0xf3b6('0x6a')]({'Bucket':_0x43a020},function(_0x38f179,_0x5985a6){if(_0x38f179){return _0x5355db(_0x38f179);}else{return _0xe95242(_0x5985a6);}});});}function uploadFile(_0x355922,_0x365e00,_0x4aed8c,_0x504b71,_0xee6d74,_0x1eff08){return new Promise(function(_0x4b8e97,_0x15b8db){var _0x783f39=new AWS['S3']({'accessKeyId':_0x365e00,'secretAccessKey':_0x355922,'region':_0x4aed8c});_0x783f39[_0xf3b6('0x6b')]({'Bucket':_0x504b71,'Key':_0xee6d74,'Body':_0x1eff08},function(_0x3b6853,_0x2195bb){if(_0x3b6853){return _0x15b8db(_0x3b6853);}else{return _0x4b8e97(_0x2195bb);}});});}function startTranscribe(_0x11e38e,_0x1849c0,_0x33e9a3,_0x16b798,_0x57a6e6,_0x5d1498){return new Promise(function(_0x36f28e,_0x5b4dd0){var _0x541613=new AWS[(_0xf3b6('0x6c'))]({'accessKeyId':_0x1849c0,'secretAccessKey':_0x11e38e,'region':_0x33e9a3});_0x541613['startTranscriptionJob']({'TranscriptionJobName':_0x16b798,'LanguageCode':_0x57a6e6,'Media':{'MediaFileUri':_0x5d1498}},function(_0x4691ed,_0x115a6f){if(_0x4691ed){return _0x5b4dd0(_0x4691ed);}else{return _0x36f28e(_0x115a6f);}});});}function transcribe(_0x58122c,_0x25efe7,_0x5eedaf,_0x1281fa,_0x353d6e,_0x2ec3f2,_0xcb1994){return new Promise(function(_0x4ce729,_0x423770){var _0x469a61={};logger[_0xf3b6('0x63')](util[_0xf3b6('0x2e')](_0xf3b6('0x6d'),_0x58122c,_0x353d6e));return uploadFile(_0x25efe7,_0x5eedaf,_0x1281fa,_0x353d6e,path[_0xf3b6('0x6e')](_0x2ec3f2),fs[_0xf3b6('0x6f')](_0x2ec3f2))['then'](function(_0x57a4c7){logger[_0xf3b6('0x63')](util[_0xf3b6('0x2e')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x58122c,_0x353d6e,_0x57a4c7[_0xf3b6('0x70')]));_0x469a61[_0xf3b6('0x71')]=_0x57a4c7['Bucket'];_0x469a61[_0xf3b6('0x72')]=_0x57a4c7[_0xf3b6('0x70')];logger[_0xf3b6('0x63')](util[_0xf3b6('0x2e')](_0xf3b6('0x73'),_0x58122c));return startTranscribe(_0x25efe7,_0x5eedaf,_0x1281fa,uuidv4(),_0xcb1994,_0x57a4c7['Location']);})['then'](function(_0xe8ddcf){logger[_0xf3b6('0x63')](util['format'](_0xf3b6('0x74'),_0x58122c,_0xe8ddcf[_0xf3b6('0x75')][_0xf3b6('0x76')]));_0x469a61[_0xf3b6('0x77')]=_0xe8ddcf[_0xf3b6('0x75')][_0xf3b6('0x76')];_0x469a61[_0xf3b6('0x78')]=_0xe8ddcf[_0xf3b6('0x75')][_0xf3b6('0x79')];return _0x4ce729(_0x469a61);})[_0xf3b6('0x44')](function(_0x184ae7){return _0x423770(_0x184ae7);});});}exports[_0xf3b6('0x7a')]=function(_0x2f1f64,_0x37f628,_0x1702a3){var _0x582366;var _0x4610f7;var _0x5a6375;var _0x4c491f=require('../../components/encryptor');return db[_0xf3b6('0x28')]['findOne']({'where':{'id':_0x2f1f64[_0xf3b6('0x46')]['id']}})[_0xf3b6('0x21')](function(_0x240f4d){if(_0x240f4d){var _0x36d638=util[_0xf3b6('0x2e')]('%s.cypher',_0x240f4d[_0xf3b6('0x4e')]);if(fs[_0xf3b6('0x50')](_0x36d638)){cypher=!![];return _0x4c491f[_0xf3b6('0x51')](_0x36d638,_0x240f4d[_0xf3b6('0x4e')],config[_0xf3b6('0x52')][_0xf3b6('0x53')])[_0xf3b6('0x21')](function(){return _0x240f4d;});}return _0x240f4d;}})['then'](function(_0x44a793){if(!_0x44a793){throw new db['Sequelize'][(_0xf3b6('0x54'))](_0xf3b6('0x7b'));}_0x4610f7=_0x44a793;return db['Setting'][_0xf3b6('0x7c')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x37f628,null))[_0xf3b6('0x21')](function(_0x47707b){if(_0x47707b){_0x582366=_0x47707b;if(!_0x582366[_0xf3b6('0x7d')]||!_0x582366[_0xf3b6('0x7e')]||!_0x582366[_0xf3b6('0x7f')]||!_0x582366['language']||!_0x582366[_0xf3b6('0x71')]){throw new db[(_0xf3b6('0x61'))][(_0xf3b6('0x54'))]('Transcribe\x20not\x20configured');}if(_0x2f1f64[_0xf3b6('0x49')][_0xf3b6('0x80')]&&(!_0x582366[_0xf3b6('0x81')]||!_0x582366['sentimentAccountId']||!_0x582366[_0xf3b6('0x82')]||!_0x582366[_0xf3b6('0x83')]||!_0x582366[_0xf3b6('0x71')])){throw new db['Sequelize'][(_0xf3b6('0x54'))](_0xf3b6('0x84'));}return db[_0xf3b6('0x85')][_0xf3b6('0x7c')]({'where':{'id':_0x582366[_0xf3b6('0x7e')]}});}})['then'](function(_0xb9c2ab){if(!_0xb9c2ab){throw new db[(_0xf3b6('0x61'))][(_0xf3b6('0x54'))](_0xf3b6('0x86'));}if(!_0xb9c2ab[_0xf3b6('0x87')]||!_0xb9c2ab['data2']){throw new db[(_0xf3b6('0x61'))][(_0xf3b6('0x54'))]('Cloud\x20Provider\x20not\x20configured');}_0x5a6375=_0xb9c2ab;return getBucketslist(_0x5a6375['data1'],_0x5a6375[_0xf3b6('0x88')],_0x582366[_0xf3b6('0x7f')]);})[_0xf3b6('0x21')](function(_0x280074){if(_0x280074&&_0x280074[_0xf3b6('0x89')]){var _0x31edac=_[_0xf3b6('0x47')](_0x280074[_0xf3b6('0x89')],function(_0x239b74){return _0x239b74['Name']===_0x582366['bucket'];});if(!_0x31edac){logger['info'](util[_0xf3b6('0x2e')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x2f1f64[_0xf3b6('0x46')]['id'],_0x582366['bucket']));return createBucket(_0x5a6375[_0xf3b6('0x87')],_0x5a6375[_0xf3b6('0x88')],_0x582366[_0xf3b6('0x7f')],_0x582366[_0xf3b6('0x71')]);}logger[_0xf3b6('0x63')](util[_0xf3b6('0x2e')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x2f1f64[_0xf3b6('0x46')]['id'],_0x582366[_0xf3b6('0x71')]));return;}})[_0xf3b6('0x21')](function(_0x20d5c9){if(_0x4610f7['transcribeStatus']===_0xf3b6('0x8a')){return transcribe(_0x2f1f64['params']['id'],_0x5a6375[_0xf3b6('0x87')],_0x5a6375[_0xf3b6('0x88')],_0x582366['transcribeRegion'],_0x582366[_0xf3b6('0x71')],_0x4610f7[_0xf3b6('0x4e')],_0x582366[_0xf3b6('0x83')]);}else{logger['info'](util[_0xf3b6('0x2e')](_0xf3b6('0x8b'),_0x2f1f64[_0xf3b6('0x46')]['id']));return{'transcribeStatus':_0xf3b6('0x8c')};}})['then'](function(_0x58481f){if(_0x58481f){_0x58481f[_0xf3b6('0x8d')]=_0x2f1f64[_0xf3b6('0x49')][_0xf3b6('0x80')];return _0x4610f7[_0xf3b6('0x8e')](_0x58481f);}})[_0xf3b6('0x21')](respondWithResult(_0x37f628,null))[_0xf3b6('0x44')](handleError(_0x37f628,null));};function writeFile(_0x10c21b,_0x22aa17){return new Promise(function(_0x5bfd0e,_0x2a9dcc){fs[_0xf3b6('0x8f')](_0x22aa17,_0x10c21b,function(_0x244949,_0x1d8f72){if(_0x244949){return _0x2a9dcc(_0x244949);}else{return _0x5bfd0e(_0x1d8f72);}});});}exports[_0xf3b6('0x90')]=function(_0x3a304c,_0x51e02a,_0x5e12ca){return db[_0xf3b6('0x28')][_0xf3b6('0x7c')]({'where':{'id':_0x3a304c[_0xf3b6('0x46')]['id']}})[_0xf3b6('0x21')](handleEntityNotFound(_0x51e02a))[_0xf3b6('0x21')](function(_0x2b8261){if(_0x2b8261&&_0x2b8261[_0xf3b6('0x91')]){var _0x30c26e=_0x2b8261[_0xf3b6('0x91')];var _0x1223d7=config['root']+'/server/files/transcribes/transcribe_'+_0x2b8261['id']+'.txt';if(fs[_0xf3b6('0x50')](_0x1223d7)){return _0x1223d7;}return writeFile(_0x30c26e,_0x1223d7)['then'](function(){return _0x1223d7;});}else{throw new db[(_0xf3b6('0x61'))][(_0xf3b6('0x54'))](_0xf3b6('0x92'));}})['then'](function(_0x88c1b5){return _0x51e02a[_0xf3b6('0x4b')](_0x88c1b5);})[_0xf3b6('0x44')](handleError(_0x51e02a));}; \ No newline at end of file +var _0x6690=['TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','ValidationError','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','findOne','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','error','stack','name','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','intersection','options','create','body','find','describe','../../components/encryptor','uniqueid','value','decryptFile','secrets','recording','existsSync','download','filename','extname','unlink','message','send','downloads','sequelize','MD5','col','token','$and','push','%s.cypher','Sequelize','VoiceRecording\x20not\x20found','Entity\x20not\x20found','info','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','createBucket','upload'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x6690,0xd3));var _0x0669=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x6690[_0x1cfa0d];return _0xe33279;};'use strict';var emlformat=require(_0x0669('0x0'));var rimraf=require(_0x0669('0x1'));var zipdir=require(_0x0669('0x2'));var jsonpatch=require(_0x0669('0x3'));var rp=require(_0x0669('0x4'));var moment=require(_0x0669('0x5'));var BPromise=require(_0x0669('0x6'));var Mustache=require(_0x0669('0x7'));var util=require(_0x0669('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x0669('0x9'));var ejs=require(_0x0669('0xa'));var fs=require('fs');var fs_extra=require(_0x0669('0xb'));var _=require(_0x0669('0xc'));var squel=require(_0x0669('0xd'));var crypto=require(_0x0669('0xe'));var jsforce=require(_0x0669('0xf'));var deskjs=require(_0x0669('0x10'));var toCsv=require(_0x0669('0x9'));var querystring=require(_0x0669('0x11'));var Papa=require(_0x0669('0x12'));var AWS=require(_0x0669('0x13'));var uuidv4=require('uuid/v4');var Redis=require(_0x0669('0x14'));var authService=require(_0x0669('0x15'));var qs=require(_0x0669('0x16'));var as=require(_0x0669('0x17'));var hardwareService=require(_0x0669('0x18'));var logger=require('../../config/logger')(_0x0669('0x19'));var utils=require(_0x0669('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x0669('0x1b'));var db=require(_0x0669('0x1c'))['db'];function respondWithStatusCode(_0x35c608,_0x38b0d8){_0x38b0d8=_0x38b0d8||0xcc;return function(_0x2a2b3a){if(_0x2a2b3a){return _0x35c608[_0x0669('0x1d')](_0x38b0d8);}return _0x35c608[_0x0669('0x1e')](_0x38b0d8)[_0x0669('0x1f')]();};}function respondWithResult(_0x3185d8,_0x6553ee){_0x6553ee=_0x6553ee||0xc8;return function(_0x14acbd){if(_0x14acbd){return _0x3185d8['status'](_0x6553ee)[_0x0669('0x20')](_0x14acbd);}};}function respondWithFilteredResult(_0x10b97b,_0x46e6d7){return function(_0x3e7a4a){if(_0x3e7a4a){var _0x3e1feb=typeof _0x46e6d7[_0x0669('0x21')]==='undefined'&&typeof _0x46e6d7[_0x0669('0x22')]===_0x0669('0x23');var _0x4c8276=_0x3e7a4a[_0x0669('0x24')];var _0x5e07c1=_0x3e1feb?0x0:_0x46e6d7['offset'];var _0xc25e00=_0x3e1feb?_0x3e7a4a[_0x0669('0x24')]:_0x46e6d7[_0x0669('0x21')]+_0x46e6d7[_0x0669('0x22')];var _0x46b291;if(_0xc25e00>=_0x4c8276){_0xc25e00=_0x4c8276;_0x46b291=0xc8;}else{_0x46b291=0xce;}_0x10b97b[_0x0669('0x1e')](_0x46b291);return _0x10b97b[_0x0669('0x25')](_0x0669('0x26'),_0x5e07c1+'-'+_0xc25e00+'/'+_0x4c8276)[_0x0669('0x20')](_0x3e7a4a);}return null;};}function patchUpdates(_0x5446c6){return function(_0x21031b){try{jsonpatch['apply'](_0x21031b,_0x5446c6,!![]);}catch(_0x361147){return BPromise['reject'](_0x361147);}return _0x21031b['save']();};}function saveUpdates(_0x1f137c,_0x5682f5){return function(_0x5049ae){if(_0x5049ae){return _0x5049ae[_0x0669('0x27')](_0x1f137c)[_0x0669('0x28')](function(_0x4f6731){return _0x4f6731;});}return null;};}function removeEntity(_0x1143e7,_0x37e9cd){return function(_0x3e7fd5){if(_0x3e7fd5){return _0x3e7fd5[_0x0669('0x29')]()[_0x0669('0x28')](function(){_0x1143e7[_0x0669('0x1e')](0xcc)[_0x0669('0x1f')]();});}};}function handleEntityNotFound(_0x2cbfee,_0x4a1f4f){return function(_0x172df1){if(!_0x172df1){_0x2cbfee[_0x0669('0x1d')](0x194);}return _0x172df1;};}function handleError(_0x169959,_0x20b257){_0x20b257=_0x20b257||0x1f4;return function(_0x51865f){logger[_0x0669('0x2a')](_0x51865f[_0x0669('0x2b')]);if(_0x51865f[_0x0669('0x2c')]){delete _0x51865f[_0x0669('0x2c')];}_0x169959['status'](_0x20b257)['send'](_0x51865f);};}exports[_0x0669('0x2d')]=function(_0x44434e,_0x2aaf8e){var _0x3985ea={},_0x32d13f={},_0x5f4e90={'count':0x0,'rows':[]};var _0x1d1e7d=_[_0x0669('0x2e')](db[_0x0669('0x2f')][_0x0669('0x30')],function(_0x340bcc){return{'name':_0x340bcc[_0x0669('0x31')],'type':_0x340bcc[_0x0669('0x32')][_0x0669('0x33')]};});_0x32d13f[_0x0669('0x34')]=_[_0x0669('0x35')](_[_0x0669('0x2e')](_0x1d1e7d,_0x0669('0x2c')),[_0x0669('0x36')]);_0x32d13f[_0x0669('0x37')]=_[_0x0669('0x38')](_0x44434e[_0x0669('0x37')]);_0x32d13f['filters']=_['intersection'](_0x32d13f[_0x0669('0x34')],_0x32d13f[_0x0669('0x37')]);_0x3985ea[_0x0669('0x39')]=_['intersection'](_0x32d13f[_0x0669('0x34')],qs[_0x0669('0x3a')](_0x44434e[_0x0669('0x37')]['fields']));_0x3985ea[_0x0669('0x39')]=_0x3985ea[_0x0669('0x39')][_0x0669('0x3b')]?_0x3985ea['attributes']:_0x32d13f[_0x0669('0x34')];if(!_0x44434e[_0x0669('0x37')][_0x0669('0x3c')](_0x0669('0x3d'))){_0x3985ea[_0x0669('0x22')]=qs['limit'](_0x44434e['query']['limit']);_0x3985ea[_0x0669('0x21')]=qs[_0x0669('0x21')](_0x44434e[_0x0669('0x37')][_0x0669('0x21')]);}_0x3985ea[_0x0669('0x3e')]=qs[_0x0669('0x3f')](_0x44434e[_0x0669('0x37')]['sort']);_0x3985ea[_0x0669('0x40')]=qs[_0x0669('0x41')](_['pick'](_0x44434e[_0x0669('0x37')],_0x32d13f[_0x0669('0x41')]),_0x1d1e7d);if(_0x44434e[_0x0669('0x37')][_0x0669('0x42')]){_0x3985ea[_0x0669('0x40')]=_[_0x0669('0x43')](_0x3985ea['where'],{'$or':_['map'](_0x1d1e7d,function(_0x47dc85){if(_0x47dc85[_0x0669('0x32')]!==_0x0669('0x44')){var _0x2df864={};_0x2df864[_0x47dc85['name']]={'$like':'%'+_0x44434e[_0x0669('0x37')][_0x0669('0x42')]+'%'};return _0x2df864;}})});}_0x3985ea=_['merge']({},_0x3985ea,_0x44434e['options']);var _0x2501e5={'where':_0x3985ea[_0x0669('0x40')]};return db[_0x0669('0x2f')]['count'](_0x2501e5)['then'](function(_0x17e333){_0x5f4e90[_0x0669('0x24')]=_0x17e333;if(_0x44434e[_0x0669('0x37')][_0x0669('0x45')]){_0x3985ea[_0x0669('0x46')]=[{'all':!![]}];}return db['VoiceRecording'][_0x0669('0x47')](_0x3985ea);})[_0x0669('0x28')](function(_0x53cb4d){_0x5f4e90['rows']=_0x53cb4d;return _0x5f4e90;})[_0x0669('0x28')](respondWithFilteredResult(_0x2aaf8e,_0x3985ea))[_0x0669('0x48')](handleError(_0x2aaf8e,null));};exports[_0x0669('0x49')]=function(_0x1222f4,_0x58365c){var _0xccf3ca={'raw':![],'where':{'id':_0x1222f4[_0x0669('0x4a')]['id']}},_0x290888={};_0x290888[_0x0669('0x34')]=_['keys'](db[_0x0669('0x2f')][_0x0669('0x30')]);_0x290888[_0x0669('0x37')]=_[_0x0669('0x38')](_0x1222f4[_0x0669('0x37')]);_0x290888[_0x0669('0x41')]=_[_0x0669('0x4b')](_0x290888[_0x0669('0x34')],_0x290888[_0x0669('0x37')]);_0xccf3ca[_0x0669('0x39')]=_['intersection'](_0x290888[_0x0669('0x34')],qs[_0x0669('0x3a')](_0x1222f4[_0x0669('0x37')][_0x0669('0x3a')]));_0xccf3ca['attributes']=_0xccf3ca[_0x0669('0x39')][_0x0669('0x3b')]?_0xccf3ca[_0x0669('0x39')]:_0x290888[_0x0669('0x34')];if(_0x1222f4['query'][_0x0669('0x45')]){_0xccf3ca[_0x0669('0x46')]=[{'all':!![]}];}_0xccf3ca=_[_0x0669('0x43')]({},_0xccf3ca,_0x1222f4[_0x0669('0x4c')]);return db['VoiceRecording']['find'](_0xccf3ca)[_0x0669('0x28')](handleEntityNotFound(_0x58365c,null))['then'](respondWithResult(_0x58365c,null))[_0x0669('0x48')](handleError(_0x58365c,null));};exports[_0x0669('0x4d')]=function(_0x27a211,_0x3c6581){return db[_0x0669('0x2f')][_0x0669('0x4d')](_0x27a211[_0x0669('0x4e')],{})[_0x0669('0x28')](respondWithResult(_0x3c6581,0xc9))[_0x0669('0x48')](handleError(_0x3c6581,null));};exports[_0x0669('0x27')]=function(_0x296ea8,_0x831381){if(_0x296ea8[_0x0669('0x4e')]['id']){delete _0x296ea8[_0x0669('0x4e')]['id'];}return db[_0x0669('0x2f')][_0x0669('0x4f')]({'where':{'id':_0x296ea8[_0x0669('0x4a')]['id']}})[_0x0669('0x28')](handleEntityNotFound(_0x831381,null))[_0x0669('0x28')](saveUpdates(_0x296ea8['body'],null))[_0x0669('0x28')](respondWithResult(_0x831381,null))[_0x0669('0x48')](handleError(_0x831381,null));};exports[_0x0669('0x50')]=function(_0x16f50f,_0x226394){return db[_0x0669('0x2f')][_0x0669('0x50')]()[_0x0669('0x28')](respondWithResult(_0x226394,null))[_0x0669('0x48')](handleError(_0x226394,null));};exports['download']=function(_0x75ef7d,_0x629385,_0x57b417){var _0x137d87=require(_0x0669('0x51'));var _0xa6d030=![];var _0xe55cf8={};if(_0x75ef7d[_0x0669('0x37')][_0x0669('0x32')]&&_0x75ef7d[_0x0669('0x37')][_0x0669('0x32')]===_0x0669('0x52')){_0xe55cf8['uniqueid']=_0x75ef7d[_0x0669('0x4a')]['id'];}else{_0xe55cf8['id']=_0x75ef7d[_0x0669('0x4a')]['id'];}return db[_0x0669('0x2f')][_0x0669('0x4f')]({'where':_0xe55cf8,'attributes':['id',_0x0669('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x629385,null))['then'](function(_0x1aa354){if(_0x1aa354){var _0x77eea1=_0x1aa354[_0x0669('0x53')];var _0x25b9e4=util[_0x0669('0x36')]('%s.cypher',_0x77eea1);if(fs['existsSync'](_0x25b9e4)){_0xa6d030=!![];return _0x137d87[_0x0669('0x54')](_0x25b9e4,_0x77eea1,config[_0x0669('0x55')][_0x0669('0x56')])['then'](function(){return _0x1aa354;});}return _0x1aa354;}})[_0x0669('0x28')](function(_0xb652bc){if(_0xb652bc){var _0x34d26a=_0xb652bc[_0x0669('0x53')];if(!fs[_0x0669('0x57')](_0x34d26a)){throw new db['Sequelize']['ValidationError']('VoiceRecording\x20not\x20found');}if(_0xb652bc['filename']){return _0x629385[_0x0669('0x58')](_0x34d26a,_0xb652bc[_0x0669('0x59')]+path[_0x0669('0x5a')](_0x34d26a),function(){if(_0xa6d030){fs[_0x0669('0x5b')](_0x34d26a);}});}else{return _0x629385[_0x0669('0x58')](_0x34d26a,function(_0x273749){if(_0xa6d030){fs[_0x0669('0x5b')](_0x34d26a);}});}}})['catch'](function(_0x14331b){if(_0x14331b[_0x0669('0x5c')]==='VoiceRecording\x20not\x20found'){_0x629385[_0x0669('0x1e')](0x194)[_0x0669('0x5d')]('Not\x20found');}else{return handleError(_0x629385,null);}});};exports[_0x0669('0x5e')]=function(_0x77c523,_0x57c45c,_0x25b623){var _0xbf1525=require(_0x0669('0x51'));var _0xca83cb=![];var _0x14a033={'$and':[db[_0x0669('0x5f')][_0x0669('0x40')](db[_0x0669('0x5f')]['fn'](_0x0669('0x60'),db[_0x0669('0x5f')][_0x0669('0x61')](_0x0669('0x52'))),_0x77c523['query'][_0x0669('0x62')])]};if(_0x77c523['query'][_0x0669('0x32')]&&_0x77c523[_0x0669('0x37')][_0x0669('0x32')]===_0x0669('0x52')){_0x14a033[_0x0669('0x63')][_0x0669('0x64')]({'uniqueid':_0x77c523[_0x0669('0x4a')]['id']});}else{_0x14a033[_0x0669('0x63')][_0x0669('0x64')]({'id':_0x77c523[_0x0669('0x4a')]['id']});}return db[_0x0669('0x2f')]['find']({'where':_0x14a033,'attributes':['id',_0x0669('0x53')],'raw':!![]})[_0x0669('0x28')](handleEntityNotFound(_0x57c45c,null))['then'](function(_0xabdf21){if(_0xabdf21){var _0x4f5712=util[_0x0669('0x36')](_0x0669('0x65'),_0xabdf21[_0x0669('0x53')]);if(fs[_0x0669('0x57')](_0x4f5712)){_0xca83cb=!![];return _0xbf1525[_0x0669('0x54')](_0x4f5712,_0xabdf21[_0x0669('0x53')],config[_0x0669('0x55')][_0x0669('0x56')])[_0x0669('0x28')](function(){return _0xabdf21;});}return _0xabdf21;}})[_0x0669('0x28')](function(_0x4cf56f){if(_0x4cf56f){if(!fs['existsSync'](_0x4cf56f[_0x0669('0x53')])){throw new db[(_0x0669('0x66'))]['ValidationError'](_0x0669('0x67'));}if(_0x4cf56f[_0x0669('0x59')]){return _0x57c45c[_0x0669('0x58')](_0x4cf56f[_0x0669('0x53')],_0x4cf56f[_0x0669('0x59')]+path['extname'](_0x4cf56f[_0x0669('0x53')]),function(){if(_0xca83cb){fs[_0x0669('0x5b')](_0x4cf56f[_0x0669('0x53')]);}});}else{return _0x57c45c['download'](_0x4cf56f[_0x0669('0x53')],function(_0x5aa96a){if(_0xca83cb){fs['unlink'](_0x4cf56f[_0x0669('0x53')]);}});}}})[_0x0669('0x48')](handleError(_0x57c45c,null));};exports[_0x0669('0x29')]=function(_0x43c576,_0x2b87ee){return db[_0x0669('0x2f')][_0x0669('0x4f')]({'where':{'id':_0x43c576[_0x0669('0x4a')]['id']}})[_0x0669('0x28')](function(_0x17bd0f){if(_['isNil'](_0x17bd0f)){throw new ReferenceError(_0x0669('0x68'));}return _0x17bd0f;})[_0x0669('0x28')](function(_0x1613b8){var _0x5e7eb4=_0x1613b8[_0x0669('0x53')];logger[_0x0669('0x69')]('cancellazione\x20fisica\x20documento\x20%s',_0x5e7eb4);if(!_[_0x0669('0x6a')](_0x1613b8['value'])&&fs[_0x0669('0x57')](_0x5e7eb4)){logger[_0x0669('0x69')]('File:\x20\x22'+_0x5e7eb4+_0x0669('0x6b'));fs[_0x0669('0x6c')](_0x5e7eb4);}_0x5e7eb4=_0x5e7eb4+_0x0669('0x6d');if(!_[_0x0669('0x6a')](_0x1613b8['value'])&&fs[_0x0669('0x57')](_0x5e7eb4)){logger[_0x0669('0x69')](_0x0669('0x6e')+_0x5e7eb4+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x5e7eb4);}return _0x1613b8;})[_0x0669('0x28')](function(_0x400f96){if(!_0x400f96)throw new InternalError();return _0x400f96['destroy']();})[_0x0669('0x28')](function(){_0x2b87ee['status'](0xcc)[_0x0669('0x1f')]();})[_0x0669('0x48')](handleError(_0x2b87ee,null));};function getBucketslist(_0x2959e4,_0x1a5eee,_0x5cf49c){return new Promise(function(_0x26263d,_0xb37aa1){var _0x53c93f=new AWS['S3']({'accessKeyId':_0x1a5eee,'secretAccessKey':_0x2959e4,'region':_0x5cf49c});_0x53c93f['listBuckets']({},function(_0x312ed7,_0x5cb16a){if(_0x312ed7){return _0xb37aa1(_0x312ed7);}else{return _0x26263d(_0x5cb16a);}});});}function createBucket(_0x2727cb,_0x238306,_0x55a30b,_0x972e16){return new Promise(function(_0x1f18ce,_0x6e6c8f){var _0x10648f=new AWS['S3']({'accessKeyId':_0x238306,'secretAccessKey':_0x2727cb,'region':_0x55a30b});_0x10648f[_0x0669('0x6f')]({'Bucket':_0x972e16},function(_0x2d42c4,_0x4d75e9){if(_0x2d42c4){return _0x6e6c8f(_0x2d42c4);}else{return _0x1f18ce(_0x4d75e9);}});});}function uploadFile(_0x175067,_0x41a99d,_0x33dda9,_0x553922,_0x255037,_0x17bd2e){return new Promise(function(_0x38746c,_0x265fdc){var _0x4fc752=new AWS['S3']({'accessKeyId':_0x41a99d,'secretAccessKey':_0x175067,'region':_0x33dda9});_0x4fc752[_0x0669('0x70')]({'Bucket':_0x553922,'Key':_0x255037,'Body':_0x17bd2e},function(_0xfb2649,_0x158e87){if(_0xfb2649){return _0x265fdc(_0xfb2649);}else{return _0x38746c(_0x158e87);}});});}function startTranscribe(_0x23962c,_0x222b0e,_0x278f33,_0x36bf9e,_0x4e43a2,_0x432473){return new Promise(function(_0x4b9ade,_0x6ec199){var _0x4b21e8=new AWS[(_0x0669('0x71'))]({'accessKeyId':_0x222b0e,'secretAccessKey':_0x23962c,'region':_0x278f33});_0x4b21e8[_0x0669('0x72')]({'TranscriptionJobName':_0x36bf9e,'LanguageCode':_0x4e43a2,'Media':{'MediaFileUri':_0x432473}},function(_0x1ccfbb,_0x3b217a){if(_0x1ccfbb){return _0x6ec199(_0x1ccfbb);}else{return _0x4b9ade(_0x3b217a);}});});}function transcribe(_0x26635d,_0x2476cc,_0x38f73b,_0x1b6854,_0x1df90d,_0xb756af,_0x551dd1){return new Promise(function(_0x4a6358,_0x4a94c7){var _0x5a1d21={};logger[_0x0669('0x69')](util[_0x0669('0x36')](_0x0669('0x73'),_0x26635d,_0x1df90d));return uploadFile(_0x2476cc,_0x38f73b,_0x1b6854,_0x1df90d,path[_0x0669('0x74')](_0xb756af),fs[_0x0669('0x75')](_0xb756af))[_0x0669('0x28')](function(_0x34e8ad){logger['info'](util[_0x0669('0x36')](_0x0669('0x76'),_0x26635d,_0x1df90d,_0x34e8ad[_0x0669('0x77')]));_0x5a1d21[_0x0669('0x78')]=_0x34e8ad[_0x0669('0x79')];_0x5a1d21['location']=_0x34e8ad[_0x0669('0x77')];logger[_0x0669('0x69')](util['format'](_0x0669('0x7a'),_0x26635d));return startTranscribe(_0x2476cc,_0x38f73b,_0x1b6854,uuidv4(),_0x551dd1,_0x34e8ad['Location']);})[_0x0669('0x28')](function(_0x4266cd){logger['info'](util[_0x0669('0x36')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x26635d,_0x4266cd[_0x0669('0x7b')]['TranscriptionJobName']));_0x5a1d21[_0x0669('0x7c')]=_0x4266cd['TranscriptionJob'][_0x0669('0x7d')];_0x5a1d21[_0x0669('0x7e')]=_0x4266cd[_0x0669('0x7b')][_0x0669('0x7f')];return _0x4a6358(_0x5a1d21);})[_0x0669('0x48')](function(_0x4b8ab2){return _0x4a94c7(_0x4b8ab2);});});}exports[_0x0669('0x80')]=function(_0x45faa6,_0x2455dc,_0x1db7ae){var _0x39b7de;var _0xf6d6c1;var _0x5c50eb;var _0x1acb4c=require('../../components/encryptor');return db[_0x0669('0x2f')]['findOne']({'where':{'id':_0x45faa6['params']['id']}})[_0x0669('0x28')](function(_0x1e1eb0){if(_0x1e1eb0){var _0x4436ac=util[_0x0669('0x36')](_0x0669('0x65'),_0x1e1eb0['value']);if(fs[_0x0669('0x57')](_0x4436ac)){cypher=!![];return _0x1acb4c['decryptFile'](_0x4436ac,_0x1e1eb0[_0x0669('0x53')],config[_0x0669('0x55')][_0x0669('0x56')])['then'](function(){return _0x1e1eb0;});}return _0x1e1eb0;}})['then'](function(_0x191528){if(!_0x191528){throw new db[(_0x0669('0x66'))][(_0x0669('0x81'))](_0x0669('0x82'));}_0xf6d6c1=_0x191528;return db[_0x0669('0x83')]['findOne']({'where':{'id':0x1}});})[_0x0669('0x28')](handleEntityNotFound(_0x2455dc,null))[_0x0669('0x28')](function(_0x197593){if(_0x197593){_0x39b7de=_0x197593;if(!_0x39b7de[_0x0669('0x84')]||!_0x39b7de[_0x0669('0x85')]||!_0x39b7de[_0x0669('0x86')]||!_0x39b7de[_0x0669('0x87')]||!_0x39b7de[_0x0669('0x78')]){throw new db[(_0x0669('0x66'))][(_0x0669('0x81'))](_0x0669('0x88'));}if(_0x45faa6[_0x0669('0x4e')][_0x0669('0x89')]&&(!_0x39b7de[_0x0669('0x8a')]||!_0x39b7de[_0x0669('0x8b')]||!_0x39b7de[_0x0669('0x8c')]||!_0x39b7de[_0x0669('0x87')]||!_0x39b7de[_0x0669('0x78')])){throw new db[(_0x0669('0x66'))][(_0x0669('0x81'))](_0x0669('0x8d'));}return db[_0x0669('0x8e')]['findOne']({'where':{'id':_0x39b7de[_0x0669('0x85')]}});}})[_0x0669('0x28')](function(_0x4d558f){if(!_0x4d558f){throw new db[(_0x0669('0x66'))][(_0x0669('0x81'))](_0x0669('0x8f'));}if(!_0x4d558f[_0x0669('0x90')]||!_0x4d558f[_0x0669('0x91')]){throw new db['Sequelize'][(_0x0669('0x81'))](_0x0669('0x92'));}_0x5c50eb=_0x4d558f;return getBucketslist(_0x5c50eb[_0x0669('0x90')],_0x5c50eb[_0x0669('0x91')],_0x39b7de['transcribeRegion']);})[_0x0669('0x28')](function(_0x19a6af){if(_0x19a6af&&_0x19a6af[_0x0669('0x93')]){var _0x496203=_[_0x0669('0x4f')](_0x19a6af[_0x0669('0x93')],function(_0x509e7e){return _0x509e7e[_0x0669('0x94')]===_0x39b7de[_0x0669('0x78')];});if(!_0x496203){logger[_0x0669('0x69')](util[_0x0669('0x36')](_0x0669('0x95'),_0x45faa6[_0x0669('0x4a')]['id'],_0x39b7de['bucket']));return createBucket(_0x5c50eb['data1'],_0x5c50eb['data2'],_0x39b7de[_0x0669('0x86')],_0x39b7de[_0x0669('0x78')]);}logger['info'](util[_0x0669('0x36')](_0x0669('0x96'),_0x45faa6[_0x0669('0x4a')]['id'],_0x39b7de['bucket']));return;}})['then'](function(_0x14e9fd){if(_0xf6d6c1[_0x0669('0x7e')]===_0x0669('0x97')){return transcribe(_0x45faa6[_0x0669('0x4a')]['id'],_0x5c50eb[_0x0669('0x90')],_0x5c50eb['data2'],_0x39b7de[_0x0669('0x86')],_0x39b7de[_0x0669('0x78')],_0xf6d6c1[_0x0669('0x53')],_0x39b7de['language']);}else{logger['info'](util[_0x0669('0x36')](_0x0669('0x98'),_0x45faa6[_0x0669('0x4a')]['id']));return{'transcribeStatus':_0x0669('0x99')};}})['then'](function(_0x2c0b82){if(_0x2c0b82){_0x2c0b82[_0x0669('0x9a')]=_0x45faa6[_0x0669('0x4e')]['runSentiment'];return _0xf6d6c1[_0x0669('0x9b')](_0x2c0b82);}})[_0x0669('0x28')](respondWithResult(_0x2455dc,null))[_0x0669('0x48')](handleError(_0x2455dc,null));};function writeFile(_0x51c923,_0x251994){return new Promise(function(_0x35212f,_0x4d5108){fs['writeFile'](_0x251994,_0x51c923,function(_0x1bc42e,_0xba75c5){if(_0x1bc42e){return _0x4d5108(_0x1bc42e);}else{return _0x35212f(_0xba75c5);}});});}exports[_0x0669('0x9c')]=function(_0x19d580,_0x328df7,_0x51bbc8){return db['VoiceRecording'][_0x0669('0x9d')]({'where':{'id':_0x19d580[_0x0669('0x4a')]['id']}})[_0x0669('0x28')](handleEntityNotFound(_0x328df7))[_0x0669('0x28')](function(_0x115314){if(_0x115314&&_0x115314[_0x0669('0x9e')]){var _0x51454b=_0x115314['fileText'];var _0x29188a=config[_0x0669('0x9f')]+_0x0669('0xa0')+_0x115314['id']+_0x0669('0xa1');if(fs[_0x0669('0x57')](_0x29188a)){return _0x29188a;}return writeFile(_0x51454b,_0x29188a)['then'](function(){return _0x29188a;});}else{throw new db[(_0x0669('0x66'))]['ValidationError']('Transcript\x20not\x20available');}})[_0x0669('0x28')](function(_0x19c9e){return _0x328df7[_0x0669('0x58')](_0x19c9e);})[_0x0669('0x48')](handleError(_0x328df7));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 02426ec..0482e85 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 _0x323b=['define','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x189d03,_0x3ba640){var _0x454bf9=function(_0x1c4450){while(--_0x1c4450){_0x189d03['push'](_0x189d03['shift']());}};_0x454bf9(++_0x3ba640);}(_0x323b,0x1ad));var _0xb323=function(_0x152647,_0x42c47e){_0x152647=_0x152647-0x0;var _0x2d5f5d=_0x323b[_0x152647];return _0x2d5f5d;};'use strict';var attributes=require(_0xb323('0x0'));module['exports']=function(_0x124e69,_0x3fbfb2){return _0x124e69[_0xb323('0x1')]('VoiceRecording',attributes,{'tableName':_0xb323('0x2'),'paranoid':![],'indexes':[{'name':_0xb323('0x3'),'fields':[_0xb323('0x3')]},{'name':_0xb323('0x4'),'fields':[_0xb323('0x4')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9585=['uniqueid','transcribeStatus','exports','define','VoiceRecording','voice_recordings'];(function(_0x46d6aa,_0x5fe46c){var _0x1ce8e6=function(_0x16ae58){while(--_0x16ae58){_0x46d6aa['push'](_0x46d6aa['shift']());}};_0x1ce8e6(++_0x5fe46c);}(_0x9585,0x15e));var _0x5958=function(_0x4ad6c2,_0x4e1364){_0x4ad6c2=_0x4ad6c2-0x0;var _0x58036a=_0x9585[_0x4ad6c2];return _0x58036a;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0x5958('0x0')]=function(_0x57d84d,_0x35702f){return _0x57d84d[_0x5958('0x1')](_0x5958('0x2'),attributes,{'tableName':_0x5958('0x3'),'paranoid':![],'indexes':[{'name':_0x5958('0x4'),'fields':[_0x5958('0x4')]},{'name':_0x5958('0x5'),'fields':[_0x5958('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index d16d734..0f3e511 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 _0x7b84=['VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','where','attributes','limit','UpdateVoiceRecording','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','create','body','existsSync','value','format','%s.cypher','recording','unlink','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x7b84,0x17c));var _0x47b8=function(_0x36ba15,_0x18cacd){_0x36ba15=_0x36ba15-0x0;var _0x5ab80d=_0x7b84[_0x36ba15];return _0x5ab80d;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var BPromise=require(_0x47b8('0x3'));var rs=require(_0x47b8('0x4'));var fs=require('fs');var Redis=require(_0x47b8('0x5'));var db=require(_0x47b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x47b8('0x7'))(_0x47b8('0x8'));var config=require(_0x47b8('0x9'));var jayson=require(_0x47b8('0xa'));var client=jayson[_0x47b8('0xb')][_0x47b8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53e656,_0x3867ca,_0x3ce846){return new BPromise(function(_0x46245a,_0xb845c9){return client[_0x47b8('0xd')](_0x53e656,_0x3ce846)[_0x47b8('0xe')](function(_0x24d240){logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));logger[_0x47b8('0x12')](_0x47b8('0x13'),_0x3867ca,_0x47b8('0x11'),JSON[_0x47b8('0x14')](_0x24d240));if(_0x24d240[_0x47b8('0x15')]){if(_0x24d240[_0x47b8('0x15')][_0x47b8('0x16')]===0x1f4){logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0xb845c9(_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);}logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0x46245a(_0x24d240['error'][_0x47b8('0x17')]);}else{logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));_0x46245a(_0x24d240[_0x47b8('0x18')][_0x47b8('0x17')]);}})[_0x47b8('0x19')](function(_0x5ad3ae){logger[_0x47b8('0x15')]('VoiceRecording,\x20%s,\x20%s',_0x3867ca,_0x5ad3ae);_0xb845c9(_0x5ad3ae);});});}exports['UpdateVoiceRecording']=function(_0x4f7317){var _0x299195=this;return new Promise(function(_0x36faf1,_0x2797ac){return db['VoiceRecording']['update'](_0x4f7317['body'],{'raw':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317['options'][_0x47b8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')][_0x47b8('0x1c')]||null:null,'attributes':_0x4f7317['options']?_0x4f7317[_0x47b8('0x1a')][_0x47b8('0x1d')]||null:null,'limit':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')][_0x47b8('0x1e')]||null:null})[_0x47b8('0xe')](function(_0x54f6bc){logger[_0x47b8('0xf')](_0x47b8('0x1f'),_0x4f7317);logger['debug'](_0x47b8('0x1f'),_0x4f7317,JSON[_0x47b8('0x14')](_0x54f6bc));_0x36faf1(_0x54f6bc);})[_0x47b8('0x19')](function(_0x142fb6){logger['error'](_0x47b8('0x1f'),_0x142fb6[_0x47b8('0x17')],_0x4f7317);_0x2797ac(_0x299195[_0x47b8('0x15')](0x1f4,_0x142fb6[_0x47b8('0x17')]));});});};exports[_0x47b8('0x20')]=function(_0xbf5ce9){var _0x40918f=this;return new Promise(function(_0x568c1e,_0x43fd49){var _0x1f719a=require('../../components/encryptor');var _0x195a66;return db[_0x47b8('0x21')][_0x47b8('0x22')]({'attributes':['id',_0x47b8('0x23')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x162d96){_0x195a66=_0x162d96;return db['VoiceRecording'][_0x47b8('0x24')](_0xbf5ce9[_0x47b8('0x25')]);})[_0x47b8('0xe')](function(_0x2e540d){if(_0x195a66['callRecordingEncryption']&&fs[_0x47b8('0x26')](_0x2e540d[_0x47b8('0x27')])){var _0x402e7c=util[_0x47b8('0x28')](_0x47b8('0x29'),_0x2e540d[_0x47b8('0x27')]);return _0x1f719a['encryptFile'](_0x2e540d['value'],_0x402e7c,config['secrets'][_0x47b8('0x2a')])[_0x47b8('0xe')](function(){fs[_0x47b8('0x2b')](_0x2e540d['value']);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x2e540d;});}return _0x2e540d;})['then'](function(_0x347769){logger[_0x47b8('0xf')](_0x47b8('0x20'),_0xbf5ce9);logger[_0x47b8('0x12')](_0x47b8('0x20'),_0xbf5ce9,JSON[_0x47b8('0x14')](_0x347769));_0x568c1e(_0x347769);})[_0x47b8('0x19')](function(_0x460dcc){logger[_0x47b8('0x15')]('CreateVoiceRecording',_0x460dcc['message'],_0xbf5ce9);_0x43fd49(_0x40918f[_0x47b8('0x15')](0x1f4,_0x460dcc[_0x47b8('0x17')]));});});}; \ No newline at end of file +var _0x8f4c=['../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording'];(function(_0x3690db,_0x4febac){var _0x3562a8=function(_0x2a1ff7){while(--_0x2a1ff7){_0x3690db['push'](_0x3690db['shift']());}};_0x3562a8(++_0x4febac);}(_0x8f4c,0x113));var _0xc8f4=function(_0x1b12b8,_0x51b75c){_0x1b12b8=_0x1b12b8-0x0;var _0x2907a7=_0x8f4c[_0x1b12b8];return _0x2907a7;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});}exports[_0xc8f4('0x17')]=function(_0x108076){var _0x7bb973=this;return new Promise(function(_0x4763c1,_0x374761){return db[_0xc8f4('0x18')][_0xc8f4('0x19')](_0x108076[_0xc8f4('0x1a')],{'raw':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x108076[_0xc8f4('0x1b')]?_0x108076['options'][_0xc8f4('0x1d')]||null:null,'attributes':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1e')]||null:null,'limit':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1f')]||null:null})[_0xc8f4('0xb')](function(_0x5e62aa){logger[_0xc8f4('0x14')](_0xc8f4('0x17'),_0x108076);logger[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x108076,JSON['stringify'](_0x5e62aa));_0x4763c1(_0x5e62aa);})[_0xc8f4('0x16')](function(_0x4a44e0){logger[_0xc8f4('0x11')]('UpdateVoiceRecording',_0x4a44e0[_0xc8f4('0x13')],_0x108076);_0x374761(_0x7bb973[_0xc8f4('0x11')](0x1f4,_0x4a44e0['message']));});});};exports[_0xc8f4('0x20')]=function(_0x21062f){var _0x11f766=this;return new Promise(function(_0x2fa052,_0x4ce586){var _0x3db490=require(_0xc8f4('0x21'));var _0x5db666;return db[_0xc8f4('0x22')][_0xc8f4('0x23')]({'attributes':['id',_0xc8f4('0x24')],'where':{'id':0x1},'raw':!![]})[_0xc8f4('0xb')](function(_0x24bef0){_0x5db666=_0x24bef0;return db[_0xc8f4('0x18')]['create'](_0x21062f[_0xc8f4('0x1a')]);})[_0xc8f4('0xb')](function(_0x1ea3d9){if(_0x5db666['callRecordingEncryption']&&fs[_0xc8f4('0x25')](_0x1ea3d9[_0xc8f4('0x26')])){var _0x5ab6cb=util['format']('%s.cypher',_0x1ea3d9[_0xc8f4('0x26')]);return _0x3db490[_0xc8f4('0x27')](_0x1ea3d9[_0xc8f4('0x26')],_0x5ab6cb,config[_0xc8f4('0x28')][_0xc8f4('0x29')])[_0xc8f4('0xb')](function(){fs[_0xc8f4('0x2a')](_0x1ea3d9[_0xc8f4('0x26')]);logger['info'](_0xc8f4('0x2b'));return _0x1ea3d9;});}return _0x1ea3d9;})[_0xc8f4('0xb')](function(_0x3910f3){logger['info'](_0xc8f4('0x20'),_0x21062f);logger[_0xc8f4('0xe')]('CreateVoiceRecording',_0x21062f,JSON[_0xc8f4('0x10')](_0x3910f3));_0x2fa052(_0x3910f3);})[_0xc8f4('0x16')](function(_0x36f24f){logger['error'](_0xc8f4('0x20'),_0x36f24f[_0xc8f4('0x13')],_0x21062f);_0x4ce586(_0x11f766[_0xc8f4('0x11')](0x1f4,_0x36f24f['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 03bd1cf..6bb34d4 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 _0xcbfb=['/:id','show','post','create','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','describe'];(function(_0xed4881,_0x45771c){var _0x7fcbd5=function(_0x36b960){while(--_0x36b960){_0xed4881['push'](_0xed4881['shift']());}};_0x7fcbd5(++_0x45771c);}(_0xcbfb,0x11f));var _0xbcbf=function(_0x1f5d8c,_0x4c1faf){_0x1f5d8c=_0x1f5d8c-0x0;var _0x3847d0=_0xcbfb[_0x1f5d8c];return _0x3847d0;};'use strict';var multer=require('multer');var util=require(_0xbcbf('0x0'));var path=require(_0xbcbf('0x1'));var timeout=require(_0xbcbf('0x2'));var express=require(_0xbcbf('0x3'));var router=express[_0xbcbf('0x4')]();var fs_extra=require(_0xbcbf('0x5'));var auth=require(_0xbcbf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbcbf('0x7'));var controller=require(_0xbcbf('0x8'));router[_0xbcbf('0x9')]('/',auth[_0xbcbf('0xa')](),controller[_0xbcbf('0xb')]);router[_0xbcbf('0x9')]('/describe',auth[_0xbcbf('0xa')](),controller[_0xbcbf('0xc')]);router[_0xbcbf('0x9')](_0xbcbf('0xd'),auth[_0xbcbf('0xa')](),controller[_0xbcbf('0xe')]);router[_0xbcbf('0xf')]('/',auth['isAuthenticated'](),controller[_0xbcbf('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xbcbf('0x11')]);router[_0xbcbf('0x12')](_0xbcbf('0xd'),auth[_0xbcbf('0xa')](),controller['destroy']);module[_0xbcbf('0x13')]=router; \ No newline at end of file +var _0xa64a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','describe','get','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra'];(function(_0x111085,_0x572fa5){var _0x17738e=function(_0x3ab98b){while(--_0x3ab98b){_0x111085['push'](_0x111085['shift']());}};_0x17738e(++_0x572fa5);}(_0xa64a,0xaf));var _0xaa64=function(_0x2fd624,_0x38745d){_0x2fd624=_0x2fd624-0x0;var _0x56d3d8=_0xa64a[_0x2fd624];return _0x56d3d8;};'use strict';var multer=require(_0xaa64('0x0'));var util=require(_0xaa64('0x1'));var path=require(_0xaa64('0x2'));var timeout=require(_0xaa64('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xaa64('0x4'));var auth=require(_0xaa64('0x5'));var interaction=require(_0xaa64('0x6'));var config=require(_0xaa64('0x7'));var controller=require(_0xaa64('0x8'));router['get']('/',auth[_0xaa64('0x9')](),controller['index']);router['get']('/describe',auth[_0xaa64('0x9')](),controller[_0xaa64('0xa')]);router[_0xaa64('0xb')](_0xaa64('0xc'),auth[_0xaa64('0x9')](),controller[_0xaa64('0xd')]);router['post']('/',auth[_0xaa64('0x9')](),controller[_0xaa64('0xe')]);router[_0xaa64('0xf')](_0xaa64('0xc'),auth[_0xaa64('0x9')](),controller[_0xaa64('0x10')]);router[_0xaa64('0x11')](_0xaa64('0xc'),auth[_0xaa64('0x9')](),controller[_0xaa64('0x12')]);module[_0xaa64('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 2343d76..f84019a 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 _0xd0e0=['Yes','sequelize','moment','exports','ENUM','blind','attended','STRING'];(function(_0x2202b0,_0x241c58){var _0x344b03=function(_0x3a107f){while(--_0x3a107f){_0x2202b0['push'](_0x2202b0['shift']());}};_0x344b03(++_0x241c58);}(_0xd0e0,0xe9));var _0x0d0e=function(_0x41f5dc,_0x1a7b52){_0x41f5dc=_0x41f5dc-0x0;var _0x4468bb=_0xd0e0[_0x41f5dc];return _0x4468bb;};'use strict';var Sequelize=require(_0x0d0e('0x0'));var moment=require(_0x0d0e('0x1'));module[_0x0d0e('0x2')]={'type':{'type':Sequelize[_0x0d0e('0x3')](_0x0d0e('0x4'),_0x0d0e('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x0d0e('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x0d0e('0x6')]},'transferercalleridname':{'type':Sequelize[_0x0d0e('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x0d0e('0x6')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x0d0e('0x6')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x0d0e('0x6')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x0d0e('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x0d0e('0x6')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x0d0e('0x6')]},'transfereeexten':{'type':Sequelize[_0x0d0e('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x0d0e('0x6')]},'isexternal':{'type':Sequelize[_0x0d0e('0x3')](_0x0d0e('0x7'),'No')},'context':{'type':Sequelize[_0x0d0e('0x6')]},'extension':{'type':Sequelize[_0x0d0e('0x6')]}}; \ No newline at end of file +var _0x6a74=['moment','exports','attended','STRING','ENUM','sequelize'];(function(_0x1b3f9f,_0x43af39){var _0x44e078=function(_0x327c8c){while(--_0x327c8c){_0x1b3f9f['push'](_0x1b3f9f['shift']());}};_0x44e078(++_0x43af39);}(_0x6a74,0xd1));var _0x46a7=function(_0x62b09a,_0x3e0e70){_0x62b09a=_0x62b09a-0x0;var _0x442042=_0x6a74[_0x62b09a];return _0x442042;};'use strict';var Sequelize=require(_0x46a7('0x0'));var moment=require(_0x46a7('0x1'));module[_0x46a7('0x2')]={'type':{'type':Sequelize['ENUM']('blind',_0x46a7('0x3'))},'result':{'type':Sequelize[_0x46a7('0x4')]},'transfererchannel':{'type':Sequelize[_0x46a7('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x46a7('0x4')]},'transferercalleridname':{'type':Sequelize[_0x46a7('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x46a7('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x46a7('0x4')]},'transferercontext':{'type':Sequelize[_0x46a7('0x4')]},'transfererexten':{'type':Sequelize[_0x46a7('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x46a7('0x4')]},'transfereechannel':{'type':Sequelize[_0x46a7('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x46a7('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x46a7('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x46a7('0x4')]},'transfereeexten':{'type':Sequelize[_0x46a7('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x46a7('0x4')]},'isexternal':{'type':Sequelize[_0x46a7('0x5')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 3b90e56..0a791dd 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 _0xac57=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','include','findAll','params','length','includeAll','find','catch','body','destroy','describe','rimraf','zip-dir','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto'];(function(_0x3c1d92,_0x52bbf4){var _0x153334=function(_0x1c45ff){while(--_0x1c45ff){_0x3c1d92['push'](_0x3c1d92['shift']());}};_0x153334(++_0x52bbf4);}(_0xac57,0x115));var _0x7ac5=function(_0xf2682d,_0x48f012){_0xf2682d=_0xf2682d-0x0;var _0x53dea0=_0xac57[_0xf2682d];return _0x53dea0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ac5('0x0'));var zipdir=require(_0x7ac5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7ac5('0x2'));var moment=require('moment');var BPromise=require(_0x7ac5('0x3'));var Mustache=require('mustache');var util=require(_0x7ac5('0x4'));var path=require('path');var sox=require(_0x7ac5('0x5'));var csv=require('to-csv');var ejs=require(_0x7ac5('0x6'));var fs=require('fs');var fs_extra=require(_0x7ac5('0x7'));var _=require(_0x7ac5('0x8'));var squel=require(_0x7ac5('0x9'));var crypto=require(_0x7ac5('0xa'));var jsforce=require(_0x7ac5('0xb'));var deskjs=require(_0x7ac5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7ac5('0xd'));var Papa=require(_0x7ac5('0xe'));var Redis=require(_0x7ac5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7ac5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ac5('0x11'));var logger=require(_0x7ac5('0x12'))(_0x7ac5('0x13'));var utils=require(_0x7ac5('0x14'));var config=require(_0x7ac5('0x15'));var licenseUtil=require(_0x7ac5('0x16'));var db=require(_0x7ac5('0x17'))['db'];function respondWithStatusCode(_0x2ebcbb,_0x4d65ff){_0x4d65ff=_0x4d65ff||0xcc;return function(_0x2e0d69){if(_0x2e0d69){return _0x2ebcbb[_0x7ac5('0x18')](_0x4d65ff);}return _0x2ebcbb[_0x7ac5('0x19')](_0x4d65ff)[_0x7ac5('0x1a')]();};}function respondWithResult(_0x1b1b7c,_0x22c6a8){_0x22c6a8=_0x22c6a8||0xc8;return function(_0x3968a5){if(_0x3968a5){return _0x1b1b7c[_0x7ac5('0x19')](_0x22c6a8)[_0x7ac5('0x1b')](_0x3968a5);}};}function respondWithFilteredResult(_0x2237d1,_0x2c20a8){return function(_0x1ec204){if(_0x1ec204){var _0x5406f6=typeof _0x2c20a8[_0x7ac5('0x1c')]==='undefined'&&typeof _0x2c20a8[_0x7ac5('0x1d')]===_0x7ac5('0x1e');var _0x54b3b9=_0x1ec204[_0x7ac5('0x1f')];var _0x36acc4=_0x5406f6?0x0:_0x2c20a8[_0x7ac5('0x1c')];var _0x1d41c7=_0x5406f6?_0x1ec204['count']:_0x2c20a8[_0x7ac5('0x1c')]+_0x2c20a8['limit'];var _0x87f785;if(_0x1d41c7>=_0x54b3b9){_0x1d41c7=_0x54b3b9;_0x87f785=0xc8;}else{_0x87f785=0xce;}_0x2237d1['status'](_0x87f785);return _0x2237d1[_0x7ac5('0x20')]('Content-Range',_0x36acc4+'-'+_0x1d41c7+'/'+_0x54b3b9)['json'](_0x1ec204);}return null;};}function patchUpdates(_0x586922){return function(_0x199aa0){try{jsonpatch[_0x7ac5('0x21')](_0x199aa0,_0x586922,!![]);}catch(_0xe1a3e2){return BPromise[_0x7ac5('0x22')](_0xe1a3e2);}return _0x199aa0['save']();};}function saveUpdates(_0x89e800,_0x5e7374){return function(_0x368e8a){if(_0x368e8a){return _0x368e8a[_0x7ac5('0x23')](_0x89e800)['then'](function(_0x38c9ce){return _0x38c9ce;});}return null;};}function removeEntity(_0x338f88,_0x18bbdb){return function(_0x3c48bc){if(_0x3c48bc){return _0x3c48bc['destroy']()[_0x7ac5('0x24')](function(){_0x338f88['status'](0xcc)[_0x7ac5('0x1a')]();});}};}function handleEntityNotFound(_0x238267,_0x212183){return function(_0x5cec1b){if(!_0x5cec1b){_0x238267['sendStatus'](0x194);}return _0x5cec1b;};}function handleError(_0x5aff5f,_0x13ea15){_0x13ea15=_0x13ea15||0x1f4;return function(_0x91fcf){logger[_0x7ac5('0x25')](_0x91fcf[_0x7ac5('0x26')]);if(_0x91fcf['name']){delete _0x91fcf[_0x7ac5('0x27')];}_0x5aff5f[_0x7ac5('0x19')](_0x13ea15)[_0x7ac5('0x28')](_0x91fcf);};}exports[_0x7ac5('0x29')]=function(_0x460044,_0x1a6fc2){var _0xffef10={},_0x222965={},_0x257cdf={'count':0x0,'rows':[]};var _0x266d24=_[_0x7ac5('0x2a')](db[_0x7ac5('0x2b')][_0x7ac5('0x2c')],function(_0x3498c7){return{'name':_0x3498c7[_0x7ac5('0x2d')],'type':_0x3498c7[_0x7ac5('0x2e')][_0x7ac5('0x2f')]};});_0x222965[_0x7ac5('0x30')]=_[_0x7ac5('0x2a')](_0x266d24,_0x7ac5('0x27'));_0x222965[_0x7ac5('0x31')]=_[_0x7ac5('0x32')](_0x460044[_0x7ac5('0x31')]);_0x222965[_0x7ac5('0x33')]=_[_0x7ac5('0x34')](_0x222965['model'],_0x222965['query']);_0xffef10[_0x7ac5('0x35')]=_['intersection'](_0x222965[_0x7ac5('0x30')],qs[_0x7ac5('0x36')](_0x460044[_0x7ac5('0x31')]['fields']));_0xffef10[_0x7ac5('0x35')]=_0xffef10['attributes']['length']?_0xffef10['attributes']:_0x222965[_0x7ac5('0x30')];if(!_0x460044['query'][_0x7ac5('0x37')]('nolimit')){_0xffef10[_0x7ac5('0x1d')]=qs[_0x7ac5('0x1d')](_0x460044['query'][_0x7ac5('0x1d')]);_0xffef10[_0x7ac5('0x1c')]=qs['offset'](_0x460044[_0x7ac5('0x31')]['offset']);}_0xffef10['order']=qs[_0x7ac5('0x38')](_0x460044[_0x7ac5('0x31')][_0x7ac5('0x38')]);_0xffef10['where']=qs[_0x7ac5('0x33')](_[_0x7ac5('0x39')](_0x460044[_0x7ac5('0x31')],_0x222965[_0x7ac5('0x33')]),_0x266d24);if(_0x460044[_0x7ac5('0x31')][_0x7ac5('0x3a')]){_0xffef10[_0x7ac5('0x3b')]=_[_0x7ac5('0x3c')](_0xffef10['where'],{'$or':_[_0x7ac5('0x2a')](_0x266d24,function(_0x545043){if(_0x545043[_0x7ac5('0x2e')]!==_0x7ac5('0x3d')){var _0x44c2d9={};_0x44c2d9[_0x545043['name']]={'$like':'%'+_0x460044['query'][_0x7ac5('0x3a')]+'%'};return _0x44c2d9;}})});}_0xffef10=_[_0x7ac5('0x3c')]({},_0xffef10,_0x460044['options']);var _0x5e6d93={'where':_0xffef10['where']};return db[_0x7ac5('0x2b')][_0x7ac5('0x1f')](_0x5e6d93)[_0x7ac5('0x24')](function(_0x4497e1){_0x257cdf[_0x7ac5('0x1f')]=_0x4497e1;if(_0x460044['query']['includeAll']){_0xffef10[_0x7ac5('0x3e')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x7ac5('0x3f')](_0xffef10);})[_0x7ac5('0x24')](function(_0x3be305){_0x257cdf['rows']=_0x3be305;return _0x257cdf;})[_0x7ac5('0x24')](respondWithFilteredResult(_0x1a6fc2,_0xffef10))['catch'](handleError(_0x1a6fc2,null));};exports['show']=function(_0x5ae5eb,_0xa3590d){var _0x11abe8={'raw':!![],'where':{'id':_0x5ae5eb[_0x7ac5('0x40')]['id']}},_0x28e865={};_0x28e865[_0x7ac5('0x30')]=_[_0x7ac5('0x32')](db[_0x7ac5('0x2b')][_0x7ac5('0x2c')]);_0x28e865[_0x7ac5('0x31')]=_[_0x7ac5('0x32')](_0x5ae5eb[_0x7ac5('0x31')]);_0x28e865[_0x7ac5('0x33')]=_['intersection'](_0x28e865[_0x7ac5('0x30')],_0x28e865[_0x7ac5('0x31')]);_0x11abe8[_0x7ac5('0x35')]=_[_0x7ac5('0x34')](_0x28e865[_0x7ac5('0x30')],qs[_0x7ac5('0x36')](_0x5ae5eb[_0x7ac5('0x31')]['fields']));_0x11abe8[_0x7ac5('0x35')]=_0x11abe8['attributes'][_0x7ac5('0x41')]?_0x11abe8['attributes']:_0x28e865[_0x7ac5('0x30')];if(_0x5ae5eb[_0x7ac5('0x31')][_0x7ac5('0x42')]){_0x11abe8[_0x7ac5('0x3e')]=[{'all':!![]}];}_0x11abe8=_[_0x7ac5('0x3c')]({},_0x11abe8,_0x5ae5eb['options']);return db[_0x7ac5('0x2b')][_0x7ac5('0x43')](_0x11abe8)[_0x7ac5('0x24')](handleEntityNotFound(_0xa3590d,null))[_0x7ac5('0x24')](respondWithResult(_0xa3590d,null))[_0x7ac5('0x44')](handleError(_0xa3590d,null));};exports['create']=function(_0x3fcd47,_0xa1bd88){return db[_0x7ac5('0x2b')]['create'](_0x3fcd47['body'],{})['then'](respondWithResult(_0xa1bd88,0xc9))[_0x7ac5('0x44')](handleError(_0xa1bd88,null));};exports[_0x7ac5('0x23')]=function(_0x52376d,_0x4b921d){if(_0x52376d[_0x7ac5('0x45')]['id']){delete _0x52376d['body']['id'];}return db[_0x7ac5('0x2b')][_0x7ac5('0x43')]({'where':{'id':_0x52376d[_0x7ac5('0x40')]['id']}})[_0x7ac5('0x24')](handleEntityNotFound(_0x4b921d,null))[_0x7ac5('0x24')](saveUpdates(_0x52376d[_0x7ac5('0x45')],null))[_0x7ac5('0x24')](respondWithResult(_0x4b921d,null))[_0x7ac5('0x44')](handleError(_0x4b921d,null));};exports[_0x7ac5('0x46')]=function(_0x4ba030,_0x15e8c7){return db[_0x7ac5('0x2b')][_0x7ac5('0x43')]({'where':{'id':_0x4ba030[_0x7ac5('0x40')]['id']}})['then'](handleEntityNotFound(_0x15e8c7,null))[_0x7ac5('0x24')](removeEntity(_0x15e8c7,null))[_0x7ac5('0x44')](handleError(_0x15e8c7,null));};exports[_0x7ac5('0x47')]=function(_0x38c793,_0x2ba5fc){return db['VoiceTransferReport']['describe']()['then'](respondWithResult(_0x2ba5fc,null))[_0x7ac5('0x44')](handleError(_0x2ba5fc,null));}; \ No newline at end of file +var _0xb0a0=['findAll','rows','catch','show','params','keys','merge','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','name','send','index','VoiceTransferReport','rawAttributes','type','key','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','options','includeAll'];(function(_0x5a7f59,_0x2e191a){var _0x2a0c89=function(_0x94427d){while(--_0x94427d){_0x5a7f59['push'](_0x5a7f59['shift']());}};_0x2a0c89(++_0x2e191a);}(_0xb0a0,0xa5));var _0x0b0a=function(_0x3f92bc,_0x482ad4){_0x3f92bc=_0x3f92bc-0x0;var _0xa15d20=_0xb0a0[_0x3f92bc];return _0xa15d20;};'use strict';var emlformat=require(_0x0b0a('0x0'));var rimraf=require(_0x0b0a('0x1'));var zipdir=require(_0x0b0a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0b0a('0x3'));var moment=require(_0x0b0a('0x4'));var BPromise=require(_0x0b0a('0x5'));var Mustache=require('mustache');var util=require(_0x0b0a('0x6'));var path=require(_0x0b0a('0x7'));var sox=require(_0x0b0a('0x8'));var csv=require(_0x0b0a('0x9'));var ejs=require(_0x0b0a('0xa'));var fs=require('fs');var fs_extra=require(_0x0b0a('0xb'));var _=require(_0x0b0a('0xc'));var squel=require(_0x0b0a('0xd'));var crypto=require(_0x0b0a('0xe'));var jsforce=require(_0x0b0a('0xf'));var deskjs=require(_0x0b0a('0x10'));var toCsv=require('to-csv');var querystring=require(_0x0b0a('0x11'));var Papa=require(_0x0b0a('0x12'));var Redis=require(_0x0b0a('0x13'));var authService=require(_0x0b0a('0x14'));var qs=require(_0x0b0a('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b0a('0x16'));var logger=require(_0x0b0a('0x17'))(_0x0b0a('0x18'));var utils=require(_0x0b0a('0x19'));var config=require(_0x0b0a('0x1a'));var licenseUtil=require(_0x0b0a('0x1b'));var db=require(_0x0b0a('0x1c'))['db'];function respondWithStatusCode(_0x198def,_0x245cd7){_0x245cd7=_0x245cd7||0xcc;return function(_0x10a5ef){if(_0x10a5ef){return _0x198def['sendStatus'](_0x245cd7);}return _0x198def[_0x0b0a('0x1d')](_0x245cd7)[_0x0b0a('0x1e')]();};}function respondWithResult(_0x1dc816,_0x311a96){_0x311a96=_0x311a96||0xc8;return function(_0x228e90){if(_0x228e90){return _0x1dc816[_0x0b0a('0x1d')](_0x311a96)[_0x0b0a('0x1f')](_0x228e90);}};}function respondWithFilteredResult(_0x4958a1,_0x28d072){return function(_0xce2089){if(_0xce2089){var _0x362263=typeof _0x28d072[_0x0b0a('0x20')]===_0x0b0a('0x21')&&typeof _0x28d072[_0x0b0a('0x22')]==='undefined';var _0x2a3b45=_0xce2089[_0x0b0a('0x23')];var _0x595de8=_0x362263?0x0:_0x28d072[_0x0b0a('0x20')];var _0x3ad39c=_0x362263?_0xce2089['count']:_0x28d072[_0x0b0a('0x20')]+_0x28d072['limit'];var _0x560475;if(_0x3ad39c>=_0x2a3b45){_0x3ad39c=_0x2a3b45;_0x560475=0xc8;}else{_0x560475=0xce;}_0x4958a1['status'](_0x560475);return _0x4958a1[_0x0b0a('0x24')](_0x0b0a('0x25'),_0x595de8+'-'+_0x3ad39c+'/'+_0x2a3b45)[_0x0b0a('0x1f')](_0xce2089);}return null;};}function patchUpdates(_0x197d4f){return function(_0x9dafb5){try{jsonpatch['apply'](_0x9dafb5,_0x197d4f,!![]);}catch(_0x152db5){return BPromise[_0x0b0a('0x26')](_0x152db5);}return _0x9dafb5['save']();};}function saveUpdates(_0x1c9fd5,_0x5b1d76){return function(_0xe515d4){if(_0xe515d4){return _0xe515d4[_0x0b0a('0x27')](_0x1c9fd5)[_0x0b0a('0x28')](function(_0xb21636){return _0xb21636;});}return null;};}function removeEntity(_0xc25bd0,_0x522e5a){return function(_0x5cda5e){if(_0x5cda5e){return _0x5cda5e[_0x0b0a('0x29')]()[_0x0b0a('0x28')](function(){_0xc25bd0[_0x0b0a('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42eb22,_0x3efac2){return function(_0x260e6d){if(!_0x260e6d){_0x42eb22['sendStatus'](0x194);}return _0x260e6d;};}function handleError(_0x4b7290,_0x44c540){_0x44c540=_0x44c540||0x1f4;return function(_0x203f7e){logger[_0x0b0a('0x2a')](_0x203f7e['stack']);if(_0x203f7e[_0x0b0a('0x2b')]){delete _0x203f7e['name'];}_0x4b7290[_0x0b0a('0x1d')](_0x44c540)[_0x0b0a('0x2c')](_0x203f7e);};}exports[_0x0b0a('0x2d')]=function(_0x8479a0,_0x4970b2){var _0xfcfb11={},_0x1c621a={},_0x5aba51={'count':0x0,'rows':[]};var _0x3cb0d4=_['map'](db[_0x0b0a('0x2e')][_0x0b0a('0x2f')],function(_0x1c557a){return{'name':_0x1c557a['fieldName'],'type':_0x1c557a[_0x0b0a('0x30')][_0x0b0a('0x31')]};});_0x1c621a['model']=_[_0x0b0a('0x32')](_0x3cb0d4,_0x0b0a('0x2b'));_0x1c621a[_0x0b0a('0x33')]=_['keys'](_0x8479a0[_0x0b0a('0x33')]);_0x1c621a[_0x0b0a('0x34')]=_['intersection'](_0x1c621a[_0x0b0a('0x35')],_0x1c621a[_0x0b0a('0x33')]);_0xfcfb11[_0x0b0a('0x36')]=_[_0x0b0a('0x37')](_0x1c621a[_0x0b0a('0x35')],qs[_0x0b0a('0x38')](_0x8479a0[_0x0b0a('0x33')]['fields']));_0xfcfb11['attributes']=_0xfcfb11['attributes'][_0x0b0a('0x39')]?_0xfcfb11[_0x0b0a('0x36')]:_0x1c621a[_0x0b0a('0x35')];if(!_0x8479a0[_0x0b0a('0x33')][_0x0b0a('0x3a')]('nolimit')){_0xfcfb11[_0x0b0a('0x22')]=qs[_0x0b0a('0x22')](_0x8479a0[_0x0b0a('0x33')]['limit']);_0xfcfb11[_0x0b0a('0x20')]=qs['offset'](_0x8479a0['query'][_0x0b0a('0x20')]);}_0xfcfb11[_0x0b0a('0x3b')]=qs['sort'](_0x8479a0[_0x0b0a('0x33')][_0x0b0a('0x3c')]);_0xfcfb11[_0x0b0a('0x3d')]=qs[_0x0b0a('0x34')](_[_0x0b0a('0x3e')](_0x8479a0[_0x0b0a('0x33')],_0x1c621a[_0x0b0a('0x34')]),_0x3cb0d4);if(_0x8479a0[_0x0b0a('0x33')][_0x0b0a('0x3f')]){_0xfcfb11[_0x0b0a('0x3d')]=_['merge'](_0xfcfb11[_0x0b0a('0x3d')],{'$or':_['map'](_0x3cb0d4,function(_0x47e53b){if(_0x47e53b[_0x0b0a('0x30')]!=='VIRTUAL'){var _0x3543ff={};_0x3543ff[_0x47e53b[_0x0b0a('0x2b')]]={'$like':'%'+_0x8479a0[_0x0b0a('0x33')]['filter']+'%'};return _0x3543ff;}})});}_0xfcfb11=_['merge']({},_0xfcfb11,_0x8479a0[_0x0b0a('0x40')]);var _0x33d332={'where':_0xfcfb11[_0x0b0a('0x3d')]};return db[_0x0b0a('0x2e')][_0x0b0a('0x23')](_0x33d332)[_0x0b0a('0x28')](function(_0x569c0c){_0x5aba51[_0x0b0a('0x23')]=_0x569c0c;if(_0x8479a0['query'][_0x0b0a('0x41')]){_0xfcfb11['include']=[{'all':!![]}];}return db[_0x0b0a('0x2e')][_0x0b0a('0x42')](_0xfcfb11);})[_0x0b0a('0x28')](function(_0x19d2df){_0x5aba51[_0x0b0a('0x43')]=_0x19d2df;return _0x5aba51;})[_0x0b0a('0x28')](respondWithFilteredResult(_0x4970b2,_0xfcfb11))[_0x0b0a('0x44')](handleError(_0x4970b2,null));};exports[_0x0b0a('0x45')]=function(_0x312360,_0x30a6a7){var _0x4da014={'raw':!![],'where':{'id':_0x312360[_0x0b0a('0x46')]['id']}},_0x36acf0={};_0x36acf0[_0x0b0a('0x35')]=_[_0x0b0a('0x47')](db['VoiceTransferReport'][_0x0b0a('0x2f')]);_0x36acf0[_0x0b0a('0x33')]=_['keys'](_0x312360[_0x0b0a('0x33')]);_0x36acf0[_0x0b0a('0x34')]=_[_0x0b0a('0x37')](_0x36acf0['model'],_0x36acf0[_0x0b0a('0x33')]);_0x4da014[_0x0b0a('0x36')]=_[_0x0b0a('0x37')](_0x36acf0[_0x0b0a('0x35')],qs[_0x0b0a('0x38')](_0x312360[_0x0b0a('0x33')][_0x0b0a('0x38')]));_0x4da014['attributes']=_0x4da014[_0x0b0a('0x36')][_0x0b0a('0x39')]?_0x4da014['attributes']:_0x36acf0[_0x0b0a('0x35')];if(_0x312360[_0x0b0a('0x33')][_0x0b0a('0x41')]){_0x4da014['include']=[{'all':!![]}];}_0x4da014=_[_0x0b0a('0x48')]({},_0x4da014,_0x312360['options']);return db[_0x0b0a('0x2e')][_0x0b0a('0x49')](_0x4da014)['then'](handleEntityNotFound(_0x30a6a7,null))[_0x0b0a('0x28')](respondWithResult(_0x30a6a7,null))['catch'](handleError(_0x30a6a7,null));};exports[_0x0b0a('0x4a')]=function(_0x41778a,_0x465c88){return db[_0x0b0a('0x2e')]['create'](_0x41778a[_0x0b0a('0x4b')],{})['then'](respondWithResult(_0x465c88,0xc9))['catch'](handleError(_0x465c88,null));};exports['update']=function(_0x363ef5,_0x5d769e){if(_0x363ef5['body']['id']){delete _0x363ef5[_0x0b0a('0x4b')]['id'];}return db[_0x0b0a('0x2e')][_0x0b0a('0x49')]({'where':{'id':_0x363ef5[_0x0b0a('0x46')]['id']}})[_0x0b0a('0x28')](handleEntityNotFound(_0x5d769e,null))[_0x0b0a('0x28')](saveUpdates(_0x363ef5['body'],null))[_0x0b0a('0x28')](respondWithResult(_0x5d769e,null))['catch'](handleError(_0x5d769e,null));};exports[_0x0b0a('0x29')]=function(_0x44c879,_0x4fc48a){return db[_0x0b0a('0x2e')]['find']({'where':{'id':_0x44c879[_0x0b0a('0x46')]['id']}})['then'](handleEntityNotFound(_0x4fc48a,null))['then'](removeEntity(_0x4fc48a,null))[_0x0b0a('0x44')](handleError(_0x4fc48a,null));};exports[_0x0b0a('0x4c')]=function(_0x91968c,_0x1da7b5){return db[_0x0b0a('0x2e')][_0x0b0a('0x4c')]()[_0x0b0a('0x28')](respondWithResult(_0x1da7b5,null))['catch'](handleError(_0x1da7b5,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index f34c749..6e4c804 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 _0x4808=['request-promise','path','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','util','api','moment','bluebird'];(function(_0x8fb035,_0x217b6d){var _0x3a678d=function(_0x29d401){while(--_0x29d401){_0x8fb035['push'](_0x8fb035['shift']());}};_0x3a678d(++_0x217b6d);}(_0x4808,0x132));var _0x8480=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x4808[_0x4fde08];return _0x12e725;};'use strict';var _=require('lodash');var util=require(_0x8480('0x0'));var logger=require('../../config/logger')(_0x8480('0x1'));var moment=require(_0x8480('0x2'));var BPromise=require(_0x8480('0x3'));var rp=require(_0x8480('0x4'));var fs=require('fs');var path=require(_0x8480('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8480('0x6'));module[_0x8480('0x7')]=function(_0x575378,_0x33f77f){return _0x575378['define'](_0x8480('0x8'),attributes,{'tableName':_0x8480('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22df=['VoiceTransferReport','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./voiceTransferReport.attributes','exports','define'];(function(_0x150eda,_0x5d1eb3){var _0x4f5636=function(_0x27d6ed){while(--_0x27d6ed){_0x150eda['push'](_0x150eda['shift']());}};_0x4f5636(++_0x5d1eb3);}(_0x22df,0x156));var _0xf22d=function(_0x234aa6,_0x2e929d){_0x234aa6=_0x234aa6-0x0;var _0x2323d2=_0x22df[_0x234aa6];return _0x2323d2;};'use strict';var _=require(_0xf22d('0x0'));var util=require(_0xf22d('0x1'));var logger=require(_0xf22d('0x2'))(_0xf22d('0x3'));var moment=require('moment');var BPromise=require(_0xf22d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf22d('0x5'));var rimraf=require('rimraf');var config=require(_0xf22d('0x6'));var attributes=require(_0xf22d('0x7'));module[_0xf22d('0x8')]=function(_0x5c258c,_0x274e66){return _0x5c258c[_0xf22d('0x9')](_0xf22d('0xa'),attributes,{'tableName':'report_call_transfer','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 240ed4e..8d007dd 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 _0xc3a9=['bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','catch','lodash','moment'];(function(_0x4ac424,_0x554b5d){var _0xe1b890=function(_0x5e85c4){while(--_0x5e85c4){_0x4ac424['push'](_0x4ac424['shift']());}};_0xe1b890(++_0x554b5d);}(_0xc3a9,0x80));var _0x9c3a=function(_0x3ec376,_0x3b839a){_0x3ec376=_0x3ec376-0x0;var _0x5cc6c1=_0xc3a9[_0x3ec376];return _0x5cc6c1;};'use strict';var _=require(_0x9c3a('0x0'));var util=require('util');var moment=require(_0x9c3a('0x1'));var BPromise=require(_0x9c3a('0x2'));var rs=require(_0x9c3a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9c3a('0x4'));var logger=require('../../config/logger')(_0x9c3a('0x5'));var config=require(_0x9c3a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9c3a('0x7')][_0x9c3a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d95b4,_0x23a263,_0x32906b){return new BPromise(function(_0x28802d,_0x1c33f7){return client['request'](_0x5d95b4,_0x32906b)[_0x9c3a('0x9')](function(_0x30d5ee){logger[_0x9c3a('0xa')](_0x9c3a('0xb'),_0x23a263,'request\x20sent');logger[_0x9c3a('0xc')](_0x9c3a('0xd'),_0x23a263,'request\x20sent',JSON[_0x9c3a('0xe')](_0x30d5ee));if(_0x30d5ee[_0x9c3a('0xf')]){if(_0x30d5ee[_0x9c3a('0xf')][_0x9c3a('0x10')]===0x1f4){logger[_0x9c3a('0xf')](_0x9c3a('0xb'),_0x23a263,_0x30d5ee[_0x9c3a('0xf')]['message']);return _0x1c33f7(_0x30d5ee[_0x9c3a('0xf')]['message']);}logger[_0x9c3a('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x23a263,_0x30d5ee[_0x9c3a('0xf')][_0x9c3a('0x11')]);return _0x28802d(_0x30d5ee[_0x9c3a('0xf')][_0x9c3a('0x11')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x23a263,'request\x20sent');_0x28802d(_0x30d5ee[_0x9c3a('0x12')][_0x9c3a('0x11')]);}})['catch'](function(_0x5d0aae){logger[_0x9c3a('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x23a263,_0x5d0aae);_0x1c33f7(_0x5d0aae);});});}exports[_0x9c3a('0x13')]=function(_0x5ed5db){var _0x5ad73c=this;return new Promise(function(_0x3c27a0,_0xbb0370){return db[_0x9c3a('0x14')][_0x9c3a('0x15')](_0x5ed5db[_0x9c3a('0x16')],{'raw':_0x5ed5db[_0x9c3a('0x17')]?_0x5ed5db[_0x9c3a('0x17')][_0x9c3a('0x18')]===undefined?!![]:![]:!![]})[_0x9c3a('0x9')](function(_0x37867d){logger[_0x9c3a('0xa')](_0x9c3a('0x13'),_0x5ed5db);logger[_0x9c3a('0xc')](_0x9c3a('0x13'),_0x5ed5db,JSON['stringify'](_0x37867d));_0x3c27a0(_0x37867d);})[_0x9c3a('0x19')](function(_0x4b8be7){logger[_0x9c3a('0xf')](_0x9c3a('0x13'),_0x4b8be7['message'],_0x5ed5db);_0xbb0370(_0x5ad73c[_0x9c3a('0xf')](0x1f4,_0x4b8be7[_0x9c3a('0x11')]));});});}; \ No newline at end of file +var _0x5c32=['options','raw','CreateVoiceTransferReport','debug','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceTransferReport','create'];(function(_0x26e5c8,_0x1f10bf){var _0x217843=function(_0x577972){while(--_0x577972){_0x26e5c8['push'](_0x26e5c8['shift']());}};_0x217843(++_0x1f10bf);}(_0x5c32,0x199));var _0x25c3=function(_0x34f465,_0x524121){_0x34f465=_0x34f465-0x0;var _0x1a14f8=_0x5c32[_0x34f465];return _0x1a14f8;};'use strict';var _=require(_0x25c3('0x0'));var util=require(_0x25c3('0x1'));var moment=require(_0x25c3('0x2'));var BPromise=require(_0x25c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x25c3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x25c3('0x5'));var logger=require(_0x25c3('0x6'))(_0x25c3('0x7'));var config=require(_0x25c3('0x8'));var jayson=require(_0x25c3('0x9'));var client=jayson['client'][_0x25c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41062c,_0x2c4ad4,_0xeb0c83){return new BPromise(function(_0x16f6ca,_0x75b601){return client['request'](_0x41062c,_0xeb0c83)[_0x25c3('0xb')](function(_0x353f2e){logger[_0x25c3('0xc')](_0x25c3('0xd'),_0x2c4ad4,_0x25c3('0xe'));logger['debug'](_0x25c3('0xf'),_0x2c4ad4,_0x25c3('0xe'),JSON['stringify'](_0x353f2e));if(_0x353f2e['error']){if(_0x353f2e['error'][_0x25c3('0x10')]===0x1f4){logger[_0x25c3('0x11')](_0x25c3('0xd'),_0x2c4ad4,_0x353f2e[_0x25c3('0x11')]['message']);return _0x75b601(_0x353f2e[_0x25c3('0x11')][_0x25c3('0x12')]);}logger[_0x25c3('0x11')](_0x25c3('0xd'),_0x2c4ad4,_0x353f2e[_0x25c3('0x11')]['message']);return _0x16f6ca(_0x353f2e[_0x25c3('0x11')][_0x25c3('0x12')]);}else{logger[_0x25c3('0xc')](_0x25c3('0xd'),_0x2c4ad4,'request\x20sent');_0x16f6ca(_0x353f2e[_0x25c3('0x13')]['message']);}})[_0x25c3('0x14')](function(_0x1f37b1){logger[_0x25c3('0x11')](_0x25c3('0xd'),_0x2c4ad4,_0x1f37b1);_0x75b601(_0x1f37b1);});});}exports['CreateVoiceTransferReport']=function(_0x50fec4){var _0x579575=this;return new Promise(function(_0x5f3b4d,_0x57ab10){return db[_0x25c3('0x15')][_0x25c3('0x16')](_0x50fec4['body'],{'raw':_0x50fec4[_0x25c3('0x17')]?_0x50fec4[_0x25c3('0x17')][_0x25c3('0x18')]===undefined?!![]:![]:!![]})[_0x25c3('0xb')](function(_0x1c2ae5){logger[_0x25c3('0xc')](_0x25c3('0x19'),_0x50fec4);logger[_0x25c3('0x1a')]('CreateVoiceTransferReport',_0x50fec4,JSON['stringify'](_0x1c2ae5));_0x5f3b4d(_0x1c2ae5);})['catch'](function(_0xa32b9a){logger['error'](_0x25c3('0x19'),_0xa32b9a[_0x25c3('0x12')],_0x50fec4);_0x57ab10(_0x579575[_0x25c3('0x11')](0x1f4,_0xa32b9a['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 888dabe..3a6a473 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 _0x00bb=['answer','hold','/unhold','unhold','calls','/transfer','exports','express','Router','../../components/auth/service','post','isAuthenticated','isWebrtcLicence','/hangup','/answer'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x00bb[_0x2dafbe];return _0x58a45a;};'use strict';var express=require(_0xb00b('0x0'));var router=express[_0xb00b('0x1')]();var auth=require(_0xb00b('0x2'));var controller=require('./webbar.controller');router[_0xb00b('0x3')]('/originate',auth[_0xb00b('0x4')](),auth[_0xb00b('0x5')](),controller['originate']);router[_0xb00b('0x3')](_0xb00b('0x6'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller['hangup']);router[_0xb00b('0x3')](_0xb00b('0x7'),auth[_0xb00b('0x4')](),auth[_0xb00b('0x5')](),controller[_0xb00b('0x8')]);router[_0xb00b('0x3')]('/hold',auth['isAuthenticated'](),auth[_0xb00b('0x5')](),controller[_0xb00b('0x9')]);router[_0xb00b('0x3')](_0xb00b('0xa'),auth[_0xb00b('0x4')](),auth['isWebrtcLicence'](),controller[_0xb00b('0xb')]);router['post']('/calls',auth['isAuthenticated'](),auth[_0xb00b('0x5')](),controller[_0xb00b('0xc')]);router[_0xb00b('0x3')](_0xb00b('0xd'),auth[_0xb00b('0x4')](),auth[_0xb00b('0x5')](),controller['transfer']);module[_0xb00b('0xe')]=router; \ No newline at end of file +var _0x9a19=['hangup','answer','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup'];(function(_0x42e36e,_0x3a9ac0){var _0x1d5a3b=function(_0x1ca245){while(--_0x1ca245){_0x42e36e['push'](_0x42e36e['shift']());}};_0x1d5a3b(++_0x3a9ac0);}(_0x9a19,0x114));var _0x99a1=function(_0x95411e,_0x38b4c3){_0x95411e=_0x95411e-0x0;var _0x2c8718=_0x9a19[_0x95411e];return _0x2c8718;};'use strict';var express=require(_0x99a1('0x0'));var router=express[_0x99a1('0x1')]();var auth=require(_0x99a1('0x2'));var controller=require('./webbar.controller');router[_0x99a1('0x3')](_0x99a1('0x4'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0x7')]);router[_0x99a1('0x3')](_0x99a1('0x8'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0x9')]);router[_0x99a1('0x3')]('/answer',auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x99a1('0xa')]);router[_0x99a1('0x3')]('/hold',auth['isAuthenticated'](),auth[_0x99a1('0x6')](),controller[_0x99a1('0xb')]);router[_0x99a1('0x3')](_0x99a1('0xc'),auth[_0x99a1('0x5')](),auth['isWebrtcLicence'](),controller[_0x99a1('0xd')]);router[_0x99a1('0x3')](_0x99a1('0xe'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0xf')]);router[_0x99a1('0x3')](_0x99a1('0x10'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0x11')]);module[_0x99a1('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 1410c22..a50f33b 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 _0x1e0b=['log','handleError:','stack','name','send','status','NotFound','request','error','code','message','catch','User','findOne','agent','VoiceChannels','all','then','filter','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','callNumber','callerId','info','entityFound:','format','user:%s','hangup','sessionId','webbar:hangup','userId','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','redis','defaults','localhost','validate','string','callNumber\x20is\x20required','number','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','emit'];(function(_0x496ce8,_0x1fc5e2){var _0xa7a53d=function(_0x40913d){while(--_0x40913d){_0x496ce8['push'](_0x496ce8['shift']());}};_0xa7a53d(++_0x1fc5e2);}(_0x1e0b,0x1b2));var _0xb1e0=function(_0x5a7d5f,_0x5695cb){_0x5a7d5f=_0x5a7d5f-0x0;var _0x5dcded=_0x1e0b[_0x5a7d5f];return _0x5dcded;};'use strict';var path=require(_0xb1e0('0x0'));var fs=require('fs');var _=require(_0xb1e0('0x1'));var db=require(_0xb1e0('0x2'))['db'];var config=require(_0xb1e0('0x3'));var util=require(_0xb1e0('0x4'));var BPromise=require(_0xb1e0('0x5'));var jayson=require(_0xb1e0('0x6'));var amiClient=jayson[_0xb1e0('0x7')][_0xb1e0('0x8')]({'port':0x232a});var logger=require(_0xb1e0('0x9'))(_0xb1e0('0xa'));var Redis=require('ioredis');config[_0xb1e0('0xb')]=_[_0xb1e0('0xc')](config[_0xb1e0('0xb')],{'host':_0xb1e0('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0xb1e0('0xe'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xb1e0('0xf'),'required':[!![],_0xb1e0('0x10')]},'callerId':{'type':_0xb1e0('0xf')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xb1e0('0x11'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xb1e0('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xb1e0('0x11'),'required':[!![],_0xb1e0('0x12')]},'sessionId':{'type':_0xb1e0('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xb1e0('0x11'),'required':[!![],_0xb1e0('0x12')]},'sessionId':{'type':_0xb1e0('0xf'),'required':[!![],_0xb1e0('0x13')]},'transferNumber':{'type':_0xb1e0('0xf'),'required':[!![],_0xb1e0('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0xb1e0('0x11'),'required':[!![],_0xb1e0('0x12')]},'sessionId':{'type':_0xb1e0('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb1e0('0x12')]},'sessionId':{'type':_0xb1e0('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb1e0('0x12')]}});var conferenceValidation=new Schema({'userId':{'type':_0xb1e0('0x11'),'required':[!![],_0xb1e0('0x12')]}});function emit(_0x136f9f,_0x417ebb,_0x193b95){logger['info'](_0x136f9f,_0x417ebb,JSON['stringify'](_0x193b95));io['to'](_0x136f9f)[_0xb1e0('0x15')](_0x417ebb,_0x193b95);}function handleError(_0x140ee4){return function(_0x63042b){console[_0xb1e0('0x16')](_0xb1e0('0x17'),_0x63042b,_0x63042b instanceof RangeError);logger['error'](_0x63042b[_0xb1e0('0x18')]);if(_0x63042b instanceof RangeError){if(_0x63042b[_0xb1e0('0x19')]){delete _0x63042b[_0xb1e0('0x19')];}_0x140ee4['status'](0x194)[_0xb1e0('0x1a')](_0x63042b);}else{if(_0x63042b[_0xb1e0('0x19')]){delete _0x63042b['name'];}_0x140ee4[_0xb1e0('0x1b')](0x1f4)[_0xb1e0('0x1a')](_0x63042b);}};}function checkError(){return function(_0xc8b517){if(!_0xc8b517){throw new RangeError(_0xb1e0('0x1c'));}return _0xc8b517;};}function respondWithRpcPromise(_0x463d9e,_0x575bf8){return new BPromise(function(_0x5939c6,_0x583817){var _0x105c7c=amiClient;return _0x105c7c[_0xb1e0('0x1d')](_0x463d9e,_0x575bf8)['then'](function(_0x34a738){if(_0x34a738['error']){if(_0x34a738[_0xb1e0('0x1e')][_0xb1e0('0x1f')]===0x1f4){return _0x583817(_0x34a738[_0xb1e0('0x1e')][_0xb1e0('0x20')]);}return _0x5939c6(_0x34a738[_0xb1e0('0x1e')]['message']);}else{_0x5939c6(_0x34a738['result']);}})[_0xb1e0('0x21')](function(_0x166aad){_0x583817(_0x166aad);});});}function getAgent(_0x141c38){return db[_0xb1e0('0x22')][_0xb1e0('0x23')]({'where':{'id':_0x141c38,'role':_0xb1e0('0x24')}})['then'](checkError());}function getAgentCheckSession(_0x14d43a,_0x59b394){return new BPromise(function(_0x2c07d7,_0x4b5ad1){var _0xdc2881=respondWithRpcPromise(_0xb1e0('0x25'));var _0x5a494c=getAgent(_0x14d43a);Promise[_0xb1e0('0x26')]([_0xdc2881,_0x5a494c])[_0xb1e0('0x27')](function(_0xa8b39c){var _0x51b61d=_0xa8b39c[0x0];var _0x2aec9e=_0xa8b39c[0x1];var _0x3041c7=_[_0xb1e0('0x28')](_0x51b61d['rows'],function(_0x27653d){return _0x27653d[_0xb1e0('0x29')]==_0x2aec9e['id']&&_0x27653d['sessionId']==_0x59b394;});if(_0x3041c7[_0xb1e0('0x2a')]==0x1){_0x2c07d7(_0x2aec9e);}else{_0x4b5ad1(new RangeError(_0xb1e0('0x2b')+_0x59b394+_0xb1e0('0x2c')));}});});}exports[_0xb1e0('0x2d')]=function(_0x183b1d,_0x7102af){logger['info'](_0xb1e0('0x2e'),_0x183b1d['body']);var _0xbe5a97=originateValidation[_0xb1e0('0xe')](_0x183b1d[_0xb1e0('0x2f')]);if(_0xbe5a97[_0xb1e0('0x2a')]>0x0){return _0x7102af[_0xb1e0('0x1b')](0x190)[_0xb1e0('0x30')](_0xbe5a97);}var _0x30b77a=_0x183b1d[_0xb1e0('0x2f')]['userId'];var _0x11b962=_0x183b1d[_0xb1e0('0x2f')][_0xb1e0('0x31')];var _0x369059=_0x183b1d[_0xb1e0('0x2f')][_0xb1e0('0x32')];var _0x3f8ba6=_0x183b1d[_0xb1e0('0x2f')]['callbackUrl'];return getAgent(_0x30b77a)[_0xb1e0('0x27')](function(_0x31edf5){logger[_0xb1e0('0x33')](_0xb1e0('0x34'),_0x31edf5[_0xb1e0('0x19')]);emit(util[_0xb1e0('0x35')](_0xb1e0('0x36'),_0x31edf5[_0xb1e0('0x19')]),'webbar:originate',{'callNumber':_0x11b962,'callerId':_0x369059,'callbackUrl':_0x3f8ba6});return _0x7102af[_0xb1e0('0x1b')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0xb1e0('0x21')](handleError(_0x7102af));};exports[_0xb1e0('0x37')]=function(_0x16159c,_0x510786){logger[_0xb1e0('0x33')]('hangup\x20fired:',_0x16159c[_0xb1e0('0x2f')]);var _0x1aeab6=hangupValidation['validate'](_0x16159c[_0xb1e0('0x2f')]);if(_0x1aeab6[_0xb1e0('0x2a')]>0x0){return _0x510786[_0xb1e0('0x1b')](0x190)[_0xb1e0('0x30')](_0x1aeab6);}var _0xe2ab68=_0x16159c['body']['userId'];var _0x1ad1c2=_0x16159c['body'][_0xb1e0('0x38')];return getAgent(_0xe2ab68)[_0xb1e0('0x27')](function(_0xf20b17){logger[_0xb1e0('0x33')](_0xb1e0('0x34'),_0xf20b17[_0xb1e0('0x19')]);emit(util[_0xb1e0('0x35')](_0xb1e0('0x36'),_0xf20b17[_0xb1e0('0x19')]),_0xb1e0('0x39'),{'sessionId':_0x1ad1c2});return _0x510786[_0xb1e0('0x1b')](0xc8)[_0xb1e0('0x30')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x510786));};exports['answer']=function(_0x55d7fa,_0x2618c6){logger[_0xb1e0('0x33')]('answer\x20fired:',_0x55d7fa['body']);var _0x2fc79a=answerValidation[_0xb1e0('0xe')](_0x55d7fa[_0xb1e0('0x2f')]);if(_0x2fc79a[_0xb1e0('0x2a')]>0x0){return _0x2618c6[_0xb1e0('0x1b')](0x190)['json'](_0x2fc79a);}var _0x56990a=_0x55d7fa[_0xb1e0('0x2f')][_0xb1e0('0x3a')];var _0x443302=_0x55d7fa[_0xb1e0('0x2f')][_0xb1e0('0x38')];return getAgent(_0x56990a)[_0xb1e0('0x27')](function(_0x172afe){logger[_0xb1e0('0x33')](_0xb1e0('0x34'),_0x172afe['name']);emit(util[_0xb1e0('0x35')](_0xb1e0('0x36'),_0x172afe[_0xb1e0('0x19')]),'webbar:answer',{'sessionId':_0x443302});return _0x2618c6[_0xb1e0('0x1b')](0xc8)['json']({'error':![],'message':_0xb1e0('0x3b')});})[_0xb1e0('0x21')](handleError(_0x2618c6));};exports[_0xb1e0('0x3c')]=function(_0x8c9a2a,_0x428125){logger[_0xb1e0('0x33')](_0xb1e0('0x3d'),_0x8c9a2a[_0xb1e0('0x2f')]);var _0x194d61=holdValidation['validate'](_0x8c9a2a[_0xb1e0('0x2f')]);if(_0x194d61[_0xb1e0('0x2a')]>0x0){return _0x428125[_0xb1e0('0x1b')](0x190)[_0xb1e0('0x30')](_0x194d61);}var _0x153419=_0x8c9a2a[_0xb1e0('0x2f')][_0xb1e0('0x3a')];var _0x8d9156=_0x8c9a2a['body'][_0xb1e0('0x38')];return getAgent(_0x153419)[_0xb1e0('0x27')](function(_0x57da26){logger[_0xb1e0('0x33')](_0xb1e0('0x34'),_0x57da26[_0xb1e0('0x19')]);emit(util['format'](_0xb1e0('0x36'),_0x57da26[_0xb1e0('0x19')]),_0xb1e0('0x3e'),{'sessionId':_0x8d9156});return _0x428125[_0xb1e0('0x1b')](0xc8)[_0xb1e0('0x30')]({'error':![],'message':_0xb1e0('0x3f')});})['catch'](handleError(_0x428125));};exports[_0xb1e0('0x40')]=function(_0x34630b,_0x1810cc){logger[_0xb1e0('0x33')](_0xb1e0('0x41'),_0x34630b[_0xb1e0('0x2f')]);var _0x10be62=unholdValidation[_0xb1e0('0xe')](_0x34630b[_0xb1e0('0x2f')]);if(_0x10be62[_0xb1e0('0x2a')]>0x0){return _0x1810cc[_0xb1e0('0x1b')](0x190)[_0xb1e0('0x30')](_0x10be62);}var _0x111c21=_0x34630b[_0xb1e0('0x2f')][_0xb1e0('0x3a')];var _0x34a114=_0x34630b[_0xb1e0('0x2f')][_0xb1e0('0x38')];return getAgent(_0x111c21)[_0xb1e0('0x27')](function(_0x54c63f){logger[_0xb1e0('0x33')]('entityFound:',_0x54c63f[_0xb1e0('0x19')]);emit(util['format'](_0xb1e0('0x36'),_0x54c63f[_0xb1e0('0x19')]),'webbar:unhold',{'sessionId':_0x34a114});return _0x1810cc[_0xb1e0('0x1b')](0xc8)[_0xb1e0('0x30')]({'error':![],'message':_0xb1e0('0x42')});})[_0xb1e0('0x21')](handleError(_0x1810cc));};exports[_0xb1e0('0x43')]=function(_0x5c4a46,_0x2c4beb){logger[_0xb1e0('0x33')]('calls\x20fired:',_0x2c4beb[_0xb1e0('0x2f')]);var _0x48f708=callsValidation[_0xb1e0('0xe')](_0x5c4a46[_0xb1e0('0x2f')]);if(_0x48f708['length']>0x0){return _0x2c4beb[_0xb1e0('0x1b')](0x190)['json'](_0x48f708);}var _0x3201da=_0x5c4a46[_0xb1e0('0x2f')]['userId'];var _0x20af43=respondWithRpcPromise('VoiceChannels');var _0x375424=getAgent(_0x3201da);return Promise[_0xb1e0('0x26')]([_0x20af43,_0x375424])[_0xb1e0('0x27')](function(_0x372db2){var _0xab3944=_0x372db2[0x0];var _0x53516a=_0x372db2[0x1];var _0x20d97c=_['filter'](_0xab3944['rows'],function(_0x50f4b5){return _0x50f4b5[_0xb1e0('0x29')]==_0x53516a['id'];});return _0x2c4beb[_0xb1e0('0x1b')](0xc8)[_0xb1e0('0x30')]({'count':_0x20d97c[_0xb1e0('0x2a')],'rows':_0x20d97c});})[_0xb1e0('0x21')](handleError(_0x2c4beb));};exports[_0xb1e0('0x44')]=function(_0x4d4b62,_0x34353e){logger[_0xb1e0('0x33')]('conference\x20fired:',_0x4d4b62[_0xb1e0('0x2f')]);var _0xdf8597=conferenceValidation[_0xb1e0('0xe')](_0x4d4b62[_0xb1e0('0x2f')]);if(_0xdf8597['length']>0x0){return _0x34353e['status'](0x190)['json'](_0xdf8597);}var _0x1453e7=_0x4d4b62[_0xb1e0('0x2f')][_0xb1e0('0x3a')];return getAgent(_0x1453e7)[_0xb1e0('0x27')](function(_0x4ea510){logger[_0xb1e0('0x33')](_0xb1e0('0x34'),_0x4ea510[_0xb1e0('0x19')]);emit(util['format']('user:%s',_0x4ea510[_0xb1e0('0x19')]),_0xb1e0('0x45'));return _0x34353e[_0xb1e0('0x1b')](0xc8)[_0xb1e0('0x30')]({'error':![],'message':_0xb1e0('0x46')});})[_0xb1e0('0x21')](handleError(_0x34353e));};exports[_0xb1e0('0x47')]=function(_0x21bf61,_0x641184){logger[_0xb1e0('0x33')](_0xb1e0('0x48'),_0x21bf61[_0xb1e0('0x2f')]);var _0x218d96=transferValidation[_0xb1e0('0xe')](_0x21bf61[_0xb1e0('0x2f')]);if(_0x218d96['length']>0x0){return _0x641184['status'](0x190)[_0xb1e0('0x30')](_0x218d96);}var _0x468070=_0x21bf61[_0xb1e0('0x2f')][_0xb1e0('0x3a')];var _0x17259b=_0x21bf61[_0xb1e0('0x2f')][_0xb1e0('0x38')];var _0x14e664=_0x21bf61[_0xb1e0('0x2f')][_0xb1e0('0x49')];return getAgent(_0x468070)[_0xb1e0('0x27')](function(_0x107cef){logger[_0xb1e0('0x33')]('entityFound:',_0x107cef[_0xb1e0('0x19')]);emit(util['format'](_0xb1e0('0x36'),_0x107cef['name']),_0xb1e0('0x4a'),{'sessionId':_0x17259b,'transferNumber':_0x14e664});return _0x641184[_0xb1e0('0x1b')](0xc8)[_0xb1e0('0x30')]({'error':![],'message':_0xb1e0('0x4b')});})[_0xb1e0('0x21')](handleError(_0x641184));}; \ No newline at end of file +var _0xa01c=['User','findOne','then','VoiceChannels','all','filter','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','body','validate','length','json','userId','callNumber','callerId','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','webbar:hold','hold\x20executed!','unhold\x20fired:','unhold\x20executed!','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','stack','name','status','NotFound','request','code','error','message','result','catch'];(function(_0x19a806,_0x2f85b2){var _0x11f083=function(_0x5efbdf){while(--_0x5efbdf){_0x19a806['push'](_0x19a806['shift']());}};_0x11f083(++_0x2f85b2);}(_0xa01c,0x1f1));var _0xca01=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa01c[_0x14add3];return _0x4a174f;};'use strict';var path=require(_0xca01('0x0'));var fs=require('fs');var _=require(_0xca01('0x1'));var db=require(_0xca01('0x2'))['db'];var config=require(_0xca01('0x3'));var util=require('util');var BPromise=require(_0xca01('0x4'));var jayson=require(_0xca01('0x5'));var amiClient=jayson[_0xca01('0x6')][_0xca01('0x7')]({'port':0x232a});var logger=require(_0xca01('0x8'))(_0xca01('0x9'));var Redis=require(_0xca01('0xa'));config[_0xca01('0xb')]=_[_0xca01('0xc')](config[_0xca01('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xca01('0xd'))(new Redis(config[_0xca01('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xca01('0xe'),'required':[!![],_0xca01('0xf')]},'callNumber':{'type':'string','required':[!![],_0xca01('0x10')]},'callerId':{'type':_0xca01('0x11')},'callbackUrl':{'type':_0xca01('0x11')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xca01('0xf')]},'sessionId':{'type':_0xca01('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xca01('0x11'),'required':[!![],_0xca01('0x12')]},'transferNumber':{'type':_0xca01('0x11'),'required':[!![],_0xca01('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0xca01('0xe'),'required':[!![],_0xca01('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xca01('0xf')]},'sessionId':{'type':_0xca01('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xca01('0xe'),'required':[!![],_0xca01('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0xca01('0xe'),'required':[!![],_0xca01('0xf')]}});function emit(_0x55fbf4,_0x6f7df7,_0x117d5f){logger[_0xca01('0x14')](_0x55fbf4,_0x6f7df7,JSON[_0xca01('0x15')](_0x117d5f));io['to'](_0x55fbf4)[_0xca01('0x16')](_0x6f7df7,_0x117d5f);}function handleError(_0x598a30){return function(_0x16303c){console[_0xca01('0x17')](_0xca01('0x18'),_0x16303c,_0x16303c instanceof RangeError);logger['error'](_0x16303c[_0xca01('0x19')]);if(_0x16303c instanceof RangeError){if(_0x16303c[_0xca01('0x1a')]){delete _0x16303c[_0xca01('0x1a')];}_0x598a30[_0xca01('0x1b')](0x194)['send'](_0x16303c);}else{if(_0x16303c[_0xca01('0x1a')]){delete _0x16303c[_0xca01('0x1a')];}_0x598a30[_0xca01('0x1b')](0x1f4)['send'](_0x16303c);}};}function checkError(){return function(_0x162e8e){if(!_0x162e8e){throw new RangeError(_0xca01('0x1c'));}return _0x162e8e;};}function respondWithRpcPromise(_0x196678,_0x3238f7){return new BPromise(function(_0x3aef1d,_0x3d2b23){var _0x56a0f3=amiClient;return _0x56a0f3[_0xca01('0x1d')](_0x196678,_0x3238f7)['then'](function(_0x34c48e){if(_0x34c48e['error']){if(_0x34c48e['error'][_0xca01('0x1e')]===0x1f4){return _0x3d2b23(_0x34c48e[_0xca01('0x1f')][_0xca01('0x20')]);}return _0x3aef1d(_0x34c48e[_0xca01('0x1f')]['message']);}else{_0x3aef1d(_0x34c48e[_0xca01('0x21')]);}})[_0xca01('0x22')](function(_0x3d075a){_0x3d2b23(_0x3d075a);});});}function getAgent(_0x5f08d8){return db[_0xca01('0x23')][_0xca01('0x24')]({'where':{'id':_0x5f08d8,'role':'agent'}})[_0xca01('0x25')](checkError());}function getAgentCheckSession(_0xdeae48,_0x1c01f5){return new BPromise(function(_0x1403ad,_0x516682){var _0x3229bb=respondWithRpcPromise(_0xca01('0x26'));var _0x384df6=getAgent(_0xdeae48);Promise[_0xca01('0x27')]([_0x3229bb,_0x384df6])[_0xca01('0x25')](function(_0x2485c1){var _0x47241c=_0x2485c1[0x0];var _0x760e91=_0x2485c1[0x1];var _0x390e5b=_[_0xca01('0x28')](_0x47241c['rows'],function(_0x3675ce){return _0x3675ce[_0xca01('0x29')]==_0x760e91['id']&&_0x3675ce[_0xca01('0x2a')]==_0x1c01f5;});if(_0x390e5b['length']==0x1){_0x1403ad(_0x760e91);}else{_0x516682(new RangeError(_0xca01('0x2b')+_0x1c01f5+_0xca01('0x2c')));}});});}exports[_0xca01('0x2d')]=function(_0xeff93,_0x46e946){logger['info']('originate\x20fired:',_0xeff93[_0xca01('0x2e')]);var _0x3227a9=originateValidation[_0xca01('0x2f')](_0xeff93[_0xca01('0x2e')]);if(_0x3227a9[_0xca01('0x30')]>0x0){return _0x46e946['status'](0x190)[_0xca01('0x31')](_0x3227a9);}var _0x6438b0=_0xeff93['body'][_0xca01('0x32')];var _0x5776ef=_0xeff93[_0xca01('0x2e')][_0xca01('0x33')];var _0x31c83b=_0xeff93[_0xca01('0x2e')][_0xca01('0x34')];var _0x2c5c89=_0xeff93[_0xca01('0x2e')]['callbackUrl'];return getAgent(_0x6438b0)[_0xca01('0x25')](function(_0x38969b){logger[_0xca01('0x14')](_0xca01('0x35'),_0x38969b[_0xca01('0x1a')]);emit(util[_0xca01('0x36')](_0xca01('0x37'),_0x38969b[_0xca01('0x1a')]),_0xca01('0x38'),{'callNumber':_0x5776ef,'callerId':_0x31c83b,'callbackUrl':_0x2c5c89});return _0x46e946[_0xca01('0x1b')](0xc8)[_0xca01('0x31')]({'error':![],'message':_0xca01('0x39')});})[_0xca01('0x22')](handleError(_0x46e946));};exports[_0xca01('0x3a')]=function(_0x45ed0e,_0x106903){logger[_0xca01('0x14')](_0xca01('0x3b'),_0x45ed0e[_0xca01('0x2e')]);var _0x34c51c=hangupValidation[_0xca01('0x2f')](_0x45ed0e[_0xca01('0x2e')]);if(_0x34c51c[_0xca01('0x30')]>0x0){return _0x106903[_0xca01('0x1b')](0x190)[_0xca01('0x31')](_0x34c51c);}var _0x23f254=_0x45ed0e[_0xca01('0x2e')][_0xca01('0x32')];var _0x3a8114=_0x45ed0e[_0xca01('0x2e')]['sessionId'];return getAgent(_0x23f254)['then'](function(_0x4eeba4){logger['info'](_0xca01('0x35'),_0x4eeba4['name']);emit(util[_0xca01('0x36')](_0xca01('0x37'),_0x4eeba4[_0xca01('0x1a')]),'webbar:hangup',{'sessionId':_0x3a8114});return _0x106903[_0xca01('0x1b')](0xc8)['json']({'error':![],'message':_0xca01('0x3c')});})[_0xca01('0x22')](handleError(_0x106903));};exports[_0xca01('0x3d')]=function(_0xfad0e7,_0x1d19b6){logger[_0xca01('0x14')]('answer\x20fired:',_0xfad0e7[_0xca01('0x2e')]);var _0x523641=answerValidation[_0xca01('0x2f')](_0xfad0e7['body']);if(_0x523641[_0xca01('0x30')]>0x0){return _0x1d19b6[_0xca01('0x1b')](0x190)[_0xca01('0x31')](_0x523641);}var _0x160b5e=_0xfad0e7[_0xca01('0x2e')][_0xca01('0x32')];var _0x552ae5=_0xfad0e7['body'][_0xca01('0x2a')];return getAgent(_0x160b5e)['then'](function(_0x949da3){logger[_0xca01('0x14')](_0xca01('0x35'),_0x949da3[_0xca01('0x1a')]);emit(util[_0xca01('0x36')](_0xca01('0x37'),_0x949da3[_0xca01('0x1a')]),_0xca01('0x3e'),{'sessionId':_0x552ae5});return _0x1d19b6[_0xca01('0x1b')](0xc8)[_0xca01('0x31')]({'error':![],'message':_0xca01('0x3f')});})['catch'](handleError(_0x1d19b6));};exports['hold']=function(_0x2d3e44,_0x3ad9b6){logger[_0xca01('0x14')]('hold\x20fired:',_0x2d3e44[_0xca01('0x2e')]);var _0xde1b63=holdValidation[_0xca01('0x2f')](_0x2d3e44['body']);if(_0xde1b63['length']>0x0){return _0x3ad9b6[_0xca01('0x1b')](0x190)['json'](_0xde1b63);}var _0x2e4e6d=_0x2d3e44[_0xca01('0x2e')]['userId'];var _0x39acca=_0x2d3e44[_0xca01('0x2e')][_0xca01('0x2a')];return getAgent(_0x2e4e6d)['then'](function(_0x2455b6){logger[_0xca01('0x14')](_0xca01('0x35'),_0x2455b6[_0xca01('0x1a')]);emit(util[_0xca01('0x36')](_0xca01('0x37'),_0x2455b6[_0xca01('0x1a')]),_0xca01('0x40'),{'sessionId':_0x39acca});return _0x3ad9b6[_0xca01('0x1b')](0xc8)[_0xca01('0x31')]({'error':![],'message':_0xca01('0x41')});})['catch'](handleError(_0x3ad9b6));};exports['unhold']=function(_0x17f8ec,_0x58bd98){logger[_0xca01('0x14')](_0xca01('0x42'),_0x17f8ec[_0xca01('0x2e')]);var _0x4e8041=unholdValidation[_0xca01('0x2f')](_0x17f8ec[_0xca01('0x2e')]);if(_0x4e8041[_0xca01('0x30')]>0x0){return _0x58bd98[_0xca01('0x1b')](0x190)[_0xca01('0x31')](_0x4e8041);}var _0x320bcc=_0x17f8ec[_0xca01('0x2e')][_0xca01('0x32')];var _0x59af41=_0x17f8ec[_0xca01('0x2e')][_0xca01('0x2a')];return getAgent(_0x320bcc)['then'](function(_0x2a1c7b){logger[_0xca01('0x14')](_0xca01('0x35'),_0x2a1c7b[_0xca01('0x1a')]);emit(util[_0xca01('0x36')]('user:%s',_0x2a1c7b['name']),'webbar:unhold',{'sessionId':_0x59af41});return _0x58bd98[_0xca01('0x1b')](0xc8)[_0xca01('0x31')]({'error':![],'message':_0xca01('0x43')});})['catch'](handleError(_0x58bd98));};exports['calls']=function(_0x16f992,_0xd634bb){logger[_0xca01('0x14')]('calls\x20fired:',_0xd634bb[_0xca01('0x2e')]);var _0x6239e7=callsValidation['validate'](_0x16f992['body']);if(_0x6239e7[_0xca01('0x30')]>0x0){return _0xd634bb[_0xca01('0x1b')](0x190)[_0xca01('0x31')](_0x6239e7);}var _0x116187=_0x16f992[_0xca01('0x2e')]['userId'];var _0x5d2831=respondWithRpcPromise(_0xca01('0x26'));var _0x538e63=getAgent(_0x116187);return Promise[_0xca01('0x27')]([_0x5d2831,_0x538e63])['then'](function(_0x52c9fc){var _0x576802=_0x52c9fc[0x0];var _0x1b5029=_0x52c9fc[0x1];var _0x510507=_[_0xca01('0x28')](_0x576802[_0xca01('0x44')],function(_0x580155){return _0x580155[_0xca01('0x29')]==_0x1b5029['id'];});return _0xd634bb[_0xca01('0x1b')](0xc8)[_0xca01('0x31')]({'count':_0x510507[_0xca01('0x30')],'rows':_0x510507});})['catch'](handleError(_0xd634bb));};exports[_0xca01('0x45')]=function(_0x306ccb,_0x13a751){logger[_0xca01('0x14')](_0xca01('0x46'),_0x306ccb[_0xca01('0x2e')]);var _0x21b79b=conferenceValidation[_0xca01('0x2f')](_0x306ccb['body']);if(_0x21b79b[_0xca01('0x30')]>0x0){return _0x13a751[_0xca01('0x1b')](0x190)['json'](_0x21b79b);}var _0x43e007=_0x306ccb['body'][_0xca01('0x32')];return getAgent(_0x43e007)[_0xca01('0x25')](function(_0xd31301){logger['info'](_0xca01('0x35'),_0xd31301[_0xca01('0x1a')]);emit(util[_0xca01('0x36')](_0xca01('0x37'),_0xd31301[_0xca01('0x1a')]),_0xca01('0x47'));return _0x13a751[_0xca01('0x1b')](0xc8)[_0xca01('0x31')]({'error':![],'message':_0xca01('0x48')});})[_0xca01('0x22')](handleError(_0x13a751));};exports['transfer']=function(_0x29bff9,_0x1406c8){logger[_0xca01('0x14')](_0xca01('0x49'),_0x29bff9[_0xca01('0x2e')]);var _0x1eeb9c=transferValidation[_0xca01('0x2f')](_0x29bff9[_0xca01('0x2e')]);if(_0x1eeb9c[_0xca01('0x30')]>0x0){return _0x1406c8[_0xca01('0x1b')](0x190)[_0xca01('0x31')](_0x1eeb9c);}var _0x1a3309=_0x29bff9[_0xca01('0x2e')][_0xca01('0x32')];var _0x446be4=_0x29bff9[_0xca01('0x2e')]['sessionId'];var _0x47b2e5=_0x29bff9[_0xca01('0x2e')][_0xca01('0x4a')];return getAgent(_0x1a3309)[_0xca01('0x25')](function(_0x232cc1){logger[_0xca01('0x14')]('entityFound:',_0x232cc1[_0xca01('0x1a')]);emit(util['format'](_0xca01('0x37'),_0x232cc1[_0xca01('0x1a')]),_0xca01('0x4b'),{'sessionId':_0x446be4,'transferNumber':_0x47b2e5});return _0x1406c8[_0xca01('0x1b')](0xc8)[_0xca01('0x31')]({'error':![],'message':'transfer\x20executed!'});})[_0xca01('0x22')](handleError(_0x1406c8));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 8a9913d..5bf357e 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 _0x9ddd=['isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','create','post','addDisposition','addAnswer','/:id/users','addAgents','/:id/notify','notify','/:id/send','send','put','update','delete','removeAnswers','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x9ddd,0x12e));var _0xd9dd=function(_0x1a6e8f,_0x4a6f6f){_0x1a6e8f=_0x1a6e8f-0x0;var _0x2ca4c8=_0x9ddd[_0x1a6e8f];return _0x2ca4c8;};'use strict';var multer=require('multer');var util=require(_0xd9dd('0x0'));var path=require(_0xd9dd('0x1'));var timeout=require(_0xd9dd('0x2'));var express=require('express');var router=express[_0xd9dd('0x3')]();var fs_extra=require(_0xd9dd('0x4'));var auth=require(_0xd9dd('0x5'));var interaction=require(_0xd9dd('0x6'));var config=require(_0xd9dd('0x7'));var controller=require(_0xd9dd('0x8'));router[_0xd9dd('0x9')]('/',auth[_0xd9dd('0xa')](),controller[_0xd9dd('0xb')]);router['get'](_0xd9dd('0xc'),auth[_0xd9dd('0xa')](),controller[_0xd9dd('0xd')]);router[_0xd9dd('0x9')](_0xd9dd('0xe'),auth[_0xd9dd('0xa')](),controller[_0xd9dd('0xf')]);router[_0xd9dd('0x9')](_0xd9dd('0x10'),auth['isAuthenticated'](),controller[_0xd9dd('0x11')]);router['get'](_0xd9dd('0x12'),auth[_0xd9dd('0xa')](),controller[_0xd9dd('0x13')]);router[_0xd9dd('0x9')]('/:id/users',auth[_0xd9dd('0xa')](),controller[_0xd9dd('0x14')]);router[_0xd9dd('0x9')](_0xd9dd('0x15'),auth[_0xd9dd('0xa')](),controller[_0xd9dd('0x16')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd9dd('0x17')]);router[_0xd9dd('0x18')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xd9dd('0x19')]);router['post'](_0xd9dd('0x12'),auth[_0xd9dd('0xa')](),controller[_0xd9dd('0x1a')]);router['post'](_0xd9dd('0x1b'),auth[_0xd9dd('0xa')](),controller[_0xd9dd('0x1c')]);router[_0xd9dd('0x18')](_0xd9dd('0x15'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0xd9dd('0x1d'),controller[_0xd9dd('0x1e')]);router['post'](_0xd9dd('0x1f'),auth['isAuthenticated'](),controller[_0xd9dd('0x20')]);router[_0xd9dd('0x21')](_0xd9dd('0xe'),auth['isAuthenticated'](),controller[_0xd9dd('0x22')]);router[_0xd9dd('0x23')](_0xd9dd('0xe'),auth[_0xd9dd('0xa')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0xd9dd('0xa')](),controller['removeDispositions']);router[_0xd9dd('0x23')](_0xd9dd('0x12'),auth[_0xd9dd('0xa')](),controller[_0xd9dd('0x24')]);router[_0xd9dd('0x23')]('/:id/users',auth[_0xd9dd('0xa')](),controller[_0xd9dd('0x25')]);module[_0xd9dd('0x26')]=router; \ No newline at end of file +var _0x0754=['addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition'];(function(_0x14dd10,_0x4900d6){var _0x5cb641=function(_0x499124){while(--_0x499124){_0x14dd10['push'](_0x14dd10['shift']());}};_0x5cb641(++_0x4900d6);}(_0x0754,0x17f));var _0x4075=function(_0x26d386,_0x1660c0){_0x26d386=_0x26d386-0x0;var _0x4ef9a8=_0x0754[_0x26d386];return _0x4ef9a8;};'use strict';var multer=require(_0x4075('0x0'));var util=require(_0x4075('0x1'));var path=require(_0x4075('0x2'));var timeout=require(_0x4075('0x3'));var express=require(_0x4075('0x4'));var router=express[_0x4075('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4075('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4075('0x7'));var controller=require(_0x4075('0x8'));router[_0x4075('0x9')]('/',auth[_0x4075('0xa')](),controller[_0x4075('0xb')]);router[_0x4075('0x9')]('/describe',auth[_0x4075('0xa')](),controller['describe']);router[_0x4075('0x9')](_0x4075('0xc'),auth[_0x4075('0xa')](),controller[_0x4075('0xd')]);router[_0x4075('0x9')](_0x4075('0xe'),auth[_0x4075('0xa')](),controller[_0x4075('0xf')]);router[_0x4075('0x9')](_0x4075('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x4075('0x9')](_0x4075('0x11'),auth['isAuthenticated'](),controller[_0x4075('0x12')]);router[_0x4075('0x9')](_0x4075('0x13'),auth[_0x4075('0xa')](),controller[_0x4075('0x14')]);router[_0x4075('0x15')]('/',auth[_0x4075('0xa')](),controller[_0x4075('0x16')]);router[_0x4075('0x15')](_0x4075('0xe'),auth[_0x4075('0xa')](),controller[_0x4075('0x17')]);router[_0x4075('0x15')](_0x4075('0x10'),auth[_0x4075('0xa')](),controller[_0x4075('0x18')]);router['post'](_0x4075('0x11'),auth[_0x4075('0xa')](),controller[_0x4075('0x19')]);router['post'](_0x4075('0x13'),auth[_0x4075('0xa')](),controller[_0x4075('0x1a')]);router[_0x4075('0x15')](_0x4075('0x1b'),controller[_0x4075('0x1c')]);router[_0x4075('0x15')](_0x4075('0x1d'),auth[_0x4075('0xa')](),controller[_0x4075('0x1e')]);router[_0x4075('0x1f')]('/:id',auth[_0x4075('0xa')](),controller[_0x4075('0x20')]);router[_0x4075('0x21')]('/:id',auth[_0x4075('0xa')](),controller[_0x4075('0x22')]);router[_0x4075('0x21')](_0x4075('0xe'),auth[_0x4075('0xa')](),controller['removeDispositions']);router[_0x4075('0x21')](_0x4075('0x10'),auth[_0x4075('0xa')](),controller[_0x4075('0x23')]);router['delete'](_0x4075('0x11'),auth['isAuthenticated'](),controller[_0x4075('0x24')]);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 6e05697..9e88b05 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 _0x755b=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','exports','STRING','name','generate','ENUM','twilio'];(function(_0x2ae0ec,_0x43212f){var _0x1ab194=function(_0x481380){while(--_0x481380){_0x2ae0ec['push'](_0x2ae0ec['shift']());}};_0x1ab194(++_0x43212f);}(_0x755b,0x1c7));var _0xb755=function(_0x24c4e8,_0x3cd6f6){_0x24c4e8=_0x24c4e8-0x0;var _0x5b6739=_0x755b[_0x24c4e8];return _0x5b6739;};'use strict';var Sequelize=require(_0xb755('0x0'));var rs=require('randomstring');module[_0xb755('0x1')]={'name':{'type':Sequelize[_0xb755('0x2')],'unique':_0xb755('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xb755('0x4')]();}},'phone':{'type':Sequelize[_0xb755('0x2')]},'type':{'type':Sequelize[_0xb755('0x5')](_0xb755('0x6'),'sinch')},'accountSid':{'type':Sequelize[_0xb755('0x2')]},'baseUrl':{'type':Sequelize[_0xb755('0x2')]},'authToken':{'type':Sequelize[_0xb755('0x2')]},'notificationTemplate':{'type':Sequelize[_0xb755('0x7')],'defaultValue':function(){return _0xb755('0x8');}},'notificationSound':{'type':Sequelize[_0xb755('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb755('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb755('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb755('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb755('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb755('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb755('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xb755('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xb755('0x9')],'defaultValue':![],'comment':_0xb755('0xc'),'set':function(_0x3e423f){if(!_0x3e423f){this[_0xb755('0xd')]('mandatoryDispositionPauseId',null);}this[_0xb755('0xd')]('mandatoryDisposition',_0x3e423f);}},'description':{'type':Sequelize[_0xb755('0x2')]}}; \ No newline at end of file +var _0x8ea8=['name','sinch','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','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0x8ea8,0xca));var _0x88ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ea8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x88ea('0x0'));module['exports']={'name':{'type':Sequelize[_0x88ea('0x1')],'unique':_0x88ea('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x88ea('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x88ea('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x88ea('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x88ea('0x1')]},'type':{'type':Sequelize['ENUM']('twilio',_0x88ea('0x3'))},'accountSid':{'type':Sequelize[_0x88ea('0x1')]},'baseUrl':{'type':Sequelize[_0x88ea('0x1')]},'authToken':{'type':Sequelize[_0x88ea('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x88ea('0x4');}},'notificationSound':{'type':Sequelize[_0x88ea('0x5')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x88ea('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x88ea('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x88ea('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x88ea('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x88ea('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x88ea('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x88ea('0x5')],'defaultValue':![],'comment':_0x88ea('0x8'),'set':function(_0x2f50c0){if(!_0x2f50c0){this[_0x88ea('0x9')](_0x88ea('0xa'),null);}this[_0x88ea('0x9')](_0x88ea('0xb'),_0x2f50c0);}},'description':{'type':Sequelize[_0x88ea('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index bd400ad..4b7eed1 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 _0xf804=['agent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','json','offset','limit','undefined','count','status','save','update','destroy','WhatsappAccounts','UserProfileResource','stack','send','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','model','map','name','query','keys','intersection','attributes','fields','filters','pick','where','merge','VIRTUAL','filter','WhatsappAccount','includeAll','rows','params','length','include','find','body','role','user','get','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','WhatsappAccountId','getDispositions','findOne','Disposition','nolimit','order','sort','findAll','removeDispositions','ids','CannedAnswer','getAnswers','hasOwnProperty','options','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','message_id','orderBy','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','Body','from','notifications','messageId','from\x20is\x20mandatory','isNil','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','Contacts','DESC','contact','WhatsappInteraction','interaction','applications','push','close','*,*,*,*','created','ContactId','AttachmentId','UserId','unshift'];(function(_0x42fdcf,_0x274558){var _0x4f9dc8=function(_0x5c6e71){while(--_0x5c6e71){_0x42fdcf['push'](_0x42fdcf['shift']());}};_0x4f9dc8(++_0x274558);}(_0xf804,0x197));var _0x4f80=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf804[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f80('0x0'));var zipdir=require(_0x4f80('0x1'));var jsonpatch=require(_0x4f80('0x2'));var rp=require(_0x4f80('0x3'));var moment=require(_0x4f80('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4f80('0x5'));var util=require(_0x4f80('0x6'));var path=require('path');var sox=require(_0x4f80('0x7'));var csv=require(_0x4f80('0x8'));var ejs=require(_0x4f80('0x9'));var fs=require('fs');var fs_extra=require(_0x4f80('0xa'));var _=require(_0x4f80('0xb'));var squel=require(_0x4f80('0xc'));var crypto=require('crypto');var jsforce=require(_0x4f80('0xd'));var deskjs=require(_0x4f80('0xe'));var toCsv=require(_0x4f80('0x8'));var querystring=require(_0x4f80('0xf'));var Papa=require(_0x4f80('0x10'));var Redis=require(_0x4f80('0x11'));var authService=require(_0x4f80('0x12'));var qs=require(_0x4f80('0x13'));var as=require(_0x4f80('0x14'));var hardwareService=require(_0x4f80('0x15'));var logger=require(_0x4f80('0x16'))('api');var utils=require(_0x4f80('0x17'));var config=require(_0x4f80('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4f80('0x19'))['db'];config[_0x4f80('0x1a')]=_[_0x4f80('0x1b')](config[_0x4f80('0x1a')],{'host':_0x4f80('0x1c'),'port':0x18eb});var socket=require(_0x4f80('0x1d'))(new Redis(config[_0x4f80('0x1a')]));require(_0x4f80('0x1e'))['register'](socket);var jayson=require(_0x4f80('0x1f'));var client=jayson[_0x4f80('0x20')][_0x4f80('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x3a1992,_0xb4fd11,_0x7eab79,_0x2ace1a){return new BPromise(function(_0x49df56,_0x56970f){var _0x5bc15e=_0x2ace1a||client;return _0x5bc15e[_0x4f80('0x22')](_0x3a1992,_0x7eab79)[_0x4f80('0x23')](function(_0x15486f){logger[_0x4f80('0x24')](_0x4f80('0x25'),_0xb4fd11,_0x4f80('0x26'));logger[_0x4f80('0x27')](_0x4f80('0x28'),_0xb4fd11,_0x4f80('0x26'),JSON[_0x4f80('0x29')](_0x15486f));if(_0x15486f[_0x4f80('0x2a')]){if(_0x15486f['error'][_0x4f80('0x2b')]===0x1f4){logger[_0x4f80('0x2a')](_0x4f80('0x25'),_0xb4fd11,_0x15486f[_0x4f80('0x2a')][_0x4f80('0x2c')]);return _0x56970f(_0x15486f['error']['message']);}logger['error'](_0x4f80('0x25'),_0xb4fd11,_0x15486f[_0x4f80('0x2a')][_0x4f80('0x2c')]);return _0x49df56(_0x15486f[_0x4f80('0x2a')]['message']);}else{logger['info'](_0x4f80('0x25'),_0xb4fd11,'request\x20sent');_0x49df56(_0x15486f['result'][_0x4f80('0x2c')]);}})[_0x4f80('0x2d')](function(_0x58ce6d){logger[_0x4f80('0x2a')](_0x4f80('0x25'),_0xb4fd11,_0x58ce6d);_0x56970f(_0x58ce6d);});});}function respondWithStatusCode(_0x12ce84,_0x1b0017){_0x1b0017=_0x1b0017||0xcc;return function(_0x1c1b03){if(_0x1c1b03){return _0x12ce84[_0x4f80('0x2e')](_0x1b0017);}return _0x12ce84['status'](_0x1b0017)[_0x4f80('0x2f')]();};}function respondWithResult(_0x35ad53,_0x12f20e){_0x12f20e=_0x12f20e||0xc8;return function(_0x55a818){if(_0x55a818){return _0x35ad53['status'](_0x12f20e)[_0x4f80('0x30')](_0x55a818);}};}function respondWithFilteredResult(_0x1442d2,_0x5e2336){return function(_0x64981d){if(_0x64981d){var _0x479859=typeof _0x5e2336[_0x4f80('0x31')]==='undefined'&&typeof _0x5e2336[_0x4f80('0x32')]===_0x4f80('0x33');var _0x14bd20=_0x64981d[_0x4f80('0x34')];var _0x2da16e=_0x479859?0x0:_0x5e2336[_0x4f80('0x31')];var _0x4b30e7=_0x479859?_0x64981d[_0x4f80('0x34')]:_0x5e2336['offset']+_0x5e2336[_0x4f80('0x32')];var _0x58f8e6;if(_0x4b30e7>=_0x14bd20){_0x4b30e7=_0x14bd20;_0x58f8e6=0xc8;}else{_0x58f8e6=0xce;}_0x1442d2[_0x4f80('0x35')](_0x58f8e6);return _0x1442d2['set']('Content-Range',_0x2da16e+'-'+_0x4b30e7+'/'+_0x14bd20)['json'](_0x64981d);}return null;};}function patchUpdates(_0x4ce073){return function(_0x5b89c4){try{jsonpatch['apply'](_0x5b89c4,_0x4ce073,!![]);}catch(_0x43823e){return BPromise['reject'](_0x43823e);}return _0x5b89c4[_0x4f80('0x36')]();};}function saveUpdates(_0x4e0fd7,_0x1fd58d){return function(_0x4c915d){if(_0x4c915d){return _0x4c915d[_0x4f80('0x37')](_0x4e0fd7)[_0x4f80('0x23')](function(_0x3f4598){return _0x3f4598;});}return null;};}function removeEntity(_0x4f2383,_0x18faa1){return function(_0xea7f5b){if(_0xea7f5b){return _0xea7f5b[_0x4f80('0x38')]()[_0x4f80('0x23')](function(){var _0x229e79=_0xea7f5b['get']({'plain':!![]});var _0x3309d4=_0x4f80('0x39');return db[_0x4f80('0x3a')]['destroy']({'where':{'type':_0x3309d4,'resourceId':_0x229e79['id']}})[_0x4f80('0x23')](function(){return _0xea7f5b;});})[_0x4f80('0x23')](function(){_0x4f2383['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe45c28,_0x4771a4){return function(_0x46954f){if(!_0x46954f){_0xe45c28[_0x4f80('0x2e')](0x194);}return _0x46954f;};}function handleError(_0x5e71b3,_0x35b1e3){_0x35b1e3=_0x35b1e3||0x1f4;return function(_0x337480){logger[_0x4f80('0x2a')](_0x337480[_0x4f80('0x3b')]);if(_0x337480['name']){delete _0x337480['name'];}_0x5e71b3[_0x4f80('0x35')](_0x35b1e3)[_0x4f80('0x3c')](_0x337480);};}exports['index']=function(_0x21f415,_0x1d82a5){var _0xd210b3={'include':[{'model':db[_0x4f80('0x3d')],'as':_0x4f80('0x3e')}]},_0x581555={},_0x4b632f={'count':0x0,'rows':[]};var _0x5343b9=_['map'](db['WhatsappAccount'][_0x4f80('0x3f')],function(_0x3e05bd){return{'name':_0x3e05bd[_0x4f80('0x40')],'type':_0x3e05bd[_0x4f80('0x41')]['key']};});_0x581555[_0x4f80('0x42')]=_[_0x4f80('0x43')](_0x5343b9,_0x4f80('0x44'));_0x581555[_0x4f80('0x45')]=_[_0x4f80('0x46')](_0x21f415[_0x4f80('0x45')]);_0x581555['filters']=_[_0x4f80('0x47')](_0x581555[_0x4f80('0x42')],_0x581555[_0x4f80('0x45')]);_0xd210b3[_0x4f80('0x48')]=_[_0x4f80('0x47')](_0x581555['model'],qs['fields'](_0x21f415[_0x4f80('0x45')][_0x4f80('0x49')]));_0xd210b3[_0x4f80('0x48')]=_0xd210b3[_0x4f80('0x48')]['length']?_0xd210b3[_0x4f80('0x48')]:_0x581555[_0x4f80('0x42')];if(!_0x21f415[_0x4f80('0x45')]['hasOwnProperty']('nolimit')){_0xd210b3[_0x4f80('0x32')]=qs[_0x4f80('0x32')](_0x21f415['query']['limit']);_0xd210b3['offset']=qs[_0x4f80('0x31')](_0x21f415['query'][_0x4f80('0x31')]);}_0xd210b3['order']=qs['sort'](_0x21f415[_0x4f80('0x45')]['sort']);_0xd210b3['where']=qs[_0x4f80('0x4a')](_[_0x4f80('0x4b')](_0x21f415[_0x4f80('0x45')],_0x581555[_0x4f80('0x4a')]),_0x5343b9);if(_0x21f415['query']['filter']){_0xd210b3[_0x4f80('0x4c')]=_[_0x4f80('0x4d')](_0xd210b3[_0x4f80('0x4c')],{'$or':_['map'](_0x5343b9,function(_0x1704c1){if(_0x1704c1[_0x4f80('0x41')]!==_0x4f80('0x4e')){var _0x352adf={};_0x352adf[_0x1704c1['name']]={'$like':'%'+_0x21f415[_0x4f80('0x45')][_0x4f80('0x4f')]+'%'};return _0x352adf;}})});}_0xd210b3=_[_0x4f80('0x4d')]({},_0xd210b3,_0x21f415['options']);var _0x42cb50={'where':_0xd210b3[_0x4f80('0x4c')]};return db[_0x4f80('0x50')][_0x4f80('0x34')](_0x42cb50)[_0x4f80('0x23')](function(_0x1cffb9){_0x4b632f['count']=_0x1cffb9;if(_0x21f415[_0x4f80('0x45')][_0x4f80('0x51')]){_0xd210b3['include']=[{'all':!![]}];}return db[_0x4f80('0x50')]['findAll'](_0xd210b3);})['then'](function(_0x29e7f9){_0x4b632f[_0x4f80('0x52')]=_0x29e7f9;return _0x4b632f;})['then'](respondWithFilteredResult(_0x1d82a5,_0xd210b3))[_0x4f80('0x2d')](handleError(_0x1d82a5,null));};exports['show']=function(_0x573f66,_0x86edd){var _0x58f167={'raw':![],'where':{'id':_0x573f66[_0x4f80('0x53')]['id']},'include':[{'model':db[_0x4f80('0x3d')],'as':'mandatoryDispositionPause'}]},_0x272a20={};_0x272a20[_0x4f80('0x42')]=_[_0x4f80('0x46')](db[_0x4f80('0x50')][_0x4f80('0x3f')]);_0x272a20[_0x4f80('0x45')]=_[_0x4f80('0x46')](_0x573f66[_0x4f80('0x45')]);_0x272a20[_0x4f80('0x4a')]=_[_0x4f80('0x47')](_0x272a20['model'],_0x272a20[_0x4f80('0x45')]);_0x58f167[_0x4f80('0x48')]=_[_0x4f80('0x47')](_0x272a20[_0x4f80('0x42')],qs[_0x4f80('0x49')](_0x573f66['query'][_0x4f80('0x49')]));_0x58f167[_0x4f80('0x48')]=_0x58f167[_0x4f80('0x48')][_0x4f80('0x54')]?_0x58f167['attributes']:_0x272a20[_0x4f80('0x42')];if(_0x573f66[_0x4f80('0x45')][_0x4f80('0x51')]){_0x58f167[_0x4f80('0x55')]=[{'all':!![]}];}_0x58f167=_[_0x4f80('0x4d')]({},_0x58f167,_0x573f66['options']);return db[_0x4f80('0x50')][_0x4f80('0x56')](_0x58f167)['then'](handleEntityNotFound(_0x86edd,null))[_0x4f80('0x23')](respondWithResult(_0x86edd,null))[_0x4f80('0x2d')](handleError(_0x86edd,null));};exports['create']=function(_0x18e496,_0x3c0e6){return db['WhatsappAccount']['create'](_0x18e496[_0x4f80('0x57')],{})[_0x4f80('0x23')](function(_0x4dfafc){var _0x536bf4=_0x18e496['user']['get']({'plain':!![]});if(!_0x536bf4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x536bf4[_0x4f80('0x58')]===_0x4f80('0x59')){var _0x2ab247=_0x4dfafc[_0x4f80('0x5a')]({'plain':!![]});var _0x575e02='WhatsappAccounts';return db[_0x4f80('0x5b')][_0x4f80('0x56')]({'where':{'name':_0x575e02,'userProfileId':_0x536bf4[_0x4f80('0x5c')]},'raw':!![]})['then'](function(_0x5101aa){if(_0x5101aa&&_0x5101aa['autoAssociation']===0x0){return db['UserProfileResource'][_0x4f80('0x5d')]({'name':_0x2ab247['name'],'resourceId':_0x2ab247['id'],'type':_0x5101aa[_0x4f80('0x44')],'sectionId':_0x5101aa['id']},{})['then'](function(){return _0x4dfafc;});}else{return _0x4dfafc;}})['catch'](function(_0x39bcc5){logger[_0x4f80('0x2a')](_0x4f80('0x5e'),_0x39bcc5);throw _0x39bcc5;});}return _0x4dfafc;})[_0x4f80('0x23')](respondWithResult(_0x3c0e6,0xc9))[_0x4f80('0x2d')](handleError(_0x3c0e6,null));};exports[_0x4f80('0x37')]=function(_0x32b60a,_0x305684){if(_0x32b60a[_0x4f80('0x57')]['id']){delete _0x32b60a[_0x4f80('0x57')]['id'];}return db[_0x4f80('0x50')][_0x4f80('0x56')]({'where':{'id':_0x32b60a['params']['id']},'include':[{'model':db[_0x4f80('0x3d')],'as':_0x4f80('0x3e')}]})[_0x4f80('0x23')](handleEntityNotFound(_0x305684,null))[_0x4f80('0x23')](saveUpdates(_0x32b60a[_0x4f80('0x57')],null))[_0x4f80('0x23')](respondWithResult(_0x305684,null))[_0x4f80('0x2d')](handleError(_0x305684,null));};exports[_0x4f80('0x38')]=function(_0x5d56da,_0x5b7bd6){return db[_0x4f80('0x50')][_0x4f80('0x56')]({'where':{'id':_0x5d56da['params']['id']}})[_0x4f80('0x23')](handleEntityNotFound(_0x5b7bd6,null))[_0x4f80('0x23')](removeEntity(_0x5b7bd6,null))[_0x4f80('0x2d')](handleError(_0x5b7bd6,null));};exports[_0x4f80('0x5f')]=function(_0x3c50e4,_0x3bd53f){return db['WhatsappAccount']['describe']()[_0x4f80('0x23')](respondWithResult(_0x3bd53f,null))['catch'](handleError(_0x3bd53f,null));};exports['addDisposition']=function(_0x520a39,_0x4594a4,_0x1fcfc3){if(_0x520a39[_0x4f80('0x57')]['id']){delete _0x520a39[_0x4f80('0x57')]['id'];}return db[_0x4f80('0x50')][_0x4f80('0x56')]({'where':{'id':_0x520a39[_0x4f80('0x53')]['id']}})[_0x4f80('0x23')](handleEntityNotFound(_0x4594a4,null))[_0x4f80('0x23')](function(_0x182875){if(_0x182875){_0x520a39['body'][_0x4f80('0x60')]=_0x182875['id'];return db['Disposition'][_0x4f80('0x5d')](_0x520a39['body']);}})[_0x4f80('0x23')](respondWithResult(_0x4594a4,null))[_0x4f80('0x2d')](handleError(_0x4594a4,null));};exports[_0x4f80('0x61')]=function(_0x349e76,_0x3ddfce,_0x52fba0){var _0xccf0c6={'raw':![],'where':{}};var _0x584a9f={};var _0x446b94={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x4f80('0x62')]({'where':{'id':_0x349e76[_0x4f80('0x53')]['id']}})['then'](handleEntityNotFound(_0x3ddfce,null))['then'](function(_0x2665f5){if(_0x2665f5){_0x584a9f['model']=_['keys'](db[_0x4f80('0x63')][_0x4f80('0x3f')]);_0x584a9f[_0x4f80('0x45')]=_[_0x4f80('0x46')](_0x349e76['query']);_0x584a9f[_0x4f80('0x4a')]=_[_0x4f80('0x47')](_0x584a9f[_0x4f80('0x42')],_0x584a9f[_0x4f80('0x45')]);_0xccf0c6['attributes']=_['intersection'](_0x584a9f[_0x4f80('0x42')],qs[_0x4f80('0x49')](_0x349e76['query']['fields']));_0xccf0c6['attributes']=_0xccf0c6[_0x4f80('0x48')][_0x4f80('0x54')]?_0xccf0c6[_0x4f80('0x48')]:_0x584a9f[_0x4f80('0x42')];if(!_0x349e76[_0x4f80('0x45')]['hasOwnProperty'](_0x4f80('0x64'))){_0xccf0c6[_0x4f80('0x32')]=qs[_0x4f80('0x32')](_0x349e76['query']['limit']);_0xccf0c6['offset']=qs[_0x4f80('0x31')](_0x349e76['query'][_0x4f80('0x31')]);}_0xccf0c6[_0x4f80('0x65')]=qs[_0x4f80('0x66')](_0x349e76[_0x4f80('0x45')][_0x4f80('0x66')]);_0xccf0c6[_0x4f80('0x4c')]=qs[_0x4f80('0x4a')](_[_0x4f80('0x4b')](_0x349e76['query'],_0x584a9f['filters']));_0xccf0c6[_0x4f80('0x4c')][_0x4f80('0x60')]=_0x2665f5['id'];if(_0x349e76[_0x4f80('0x45')][_0x4f80('0x4f')]){_0xccf0c6[_0x4f80('0x4c')]=_[_0x4f80('0x4d')](_0xccf0c6[_0x4f80('0x4c')],{'$or':_[_0x4f80('0x43')](_0xccf0c6[_0x4f80('0x48')],function(_0x91a723){var _0x5c4832={};_0x5c4832[_0x91a723]={'$like':'%'+_0x349e76[_0x4f80('0x45')][_0x4f80('0x4f')]+'%'};return _0x5c4832;})});}_0xccf0c6=_['merge']({},_0xccf0c6,_0x349e76['options']);return db[_0x4f80('0x63')][_0x4f80('0x34')]({'where':_0xccf0c6[_0x4f80('0x4c')]})[_0x4f80('0x23')](function(_0x1b5711){_0x446b94[_0x4f80('0x34')]=_0x1b5711;if(_0x349e76['query'][_0x4f80('0x51')]){_0xccf0c6[_0x4f80('0x55')]=[{'all':!![]}];}return db[_0x4f80('0x63')][_0x4f80('0x67')](_0xccf0c6);})[_0x4f80('0x23')](function(_0x41e0b7){_0x446b94['rows']=_0x41e0b7;return _0x446b94;});}})[_0x4f80('0x23')](respondWithFilteredResult(_0x3ddfce,_0xccf0c6))[_0x4f80('0x2d')](handleError(_0x3ddfce,null));};exports[_0x4f80('0x68')]=function(_0x4ff3f9,_0x2d451b,_0x2ece78){return db[_0x4f80('0x50')][_0x4f80('0x56')]({'where':{'id':_0x4ff3f9['params']['id']}})['then'](handleEntityNotFound(_0x2d451b,null))[_0x4f80('0x23')](function(_0x3dc91b){if(_0x3dc91b){return _0x3dc91b[_0x4f80('0x68')](_0x4ff3f9['query'][_0x4f80('0x69')]);}})['then'](respondWithStatusCode(_0x2d451b,null))[_0x4f80('0x2d')](handleError(_0x2d451b,null));};exports['addAnswer']=function(_0x5f4064,_0x4a595e,_0x1cd075){if(_0x5f4064['body']['id']){delete _0x5f4064['body']['id'];}return db[_0x4f80('0x50')]['find']({'where':{'id':_0x5f4064[_0x4f80('0x53')]['id']}})[_0x4f80('0x23')](handleEntityNotFound(_0x4a595e,null))[_0x4f80('0x23')](function(_0x4fe93f){if(_0x4fe93f){_0x5f4064['body']['WhatsappAccountId']=_0x4fe93f['id'];return db[_0x4f80('0x6a')][_0x4f80('0x5d')](_0x5f4064[_0x4f80('0x57')]);}})[_0x4f80('0x23')](respondWithResult(_0x4a595e,null))['catch'](handleError(_0x4a595e,null));};exports[_0x4f80('0x6b')]=function(_0x2fedcc,_0x452f4f,_0x386e61){var _0x4f9e6f={'raw':![],'where':{}};var _0x1b821c={};var _0x2278cd={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x2fedcc[_0x4f80('0x53')]['id']}})['then'](handleEntityNotFound(_0x452f4f,null))[_0x4f80('0x23')](function(_0x40494d){if(_0x40494d){_0x1b821c[_0x4f80('0x42')]=_[_0x4f80('0x46')](db['CannedAnswer'][_0x4f80('0x3f')]);_0x1b821c['query']=_['keys'](_0x2fedcc[_0x4f80('0x45')]);_0x1b821c[_0x4f80('0x4a')]=_[_0x4f80('0x47')](_0x1b821c[_0x4f80('0x42')],_0x1b821c['query']);_0x4f9e6f[_0x4f80('0x48')]=_[_0x4f80('0x47')](_0x1b821c[_0x4f80('0x42')],qs[_0x4f80('0x49')](_0x2fedcc[_0x4f80('0x45')][_0x4f80('0x49')]));_0x4f9e6f['attributes']=_0x4f9e6f[_0x4f80('0x48')][_0x4f80('0x54')]?_0x4f9e6f[_0x4f80('0x48')]:_0x1b821c[_0x4f80('0x42')];if(!_0x2fedcc[_0x4f80('0x45')][_0x4f80('0x6c')](_0x4f80('0x64'))){_0x4f9e6f[_0x4f80('0x32')]=qs['limit'](_0x2fedcc['query']['limit']);_0x4f9e6f[_0x4f80('0x31')]=qs[_0x4f80('0x31')](_0x2fedcc[_0x4f80('0x45')]['offset']);}_0x4f9e6f['order']=qs[_0x4f80('0x66')](_0x2fedcc['query'][_0x4f80('0x66')]);_0x4f9e6f[_0x4f80('0x4c')]=qs[_0x4f80('0x4a')](_[_0x4f80('0x4b')](_0x2fedcc[_0x4f80('0x45')],_0x1b821c[_0x4f80('0x4a')]));_0x4f9e6f[_0x4f80('0x4c')][_0x4f80('0x60')]=_0x40494d['id'];if(_0x2fedcc[_0x4f80('0x45')][_0x4f80('0x4f')]){_0x4f9e6f[_0x4f80('0x4c')]=_['merge'](_0x4f9e6f[_0x4f80('0x4c')],{'$or':_['map'](_0x4f9e6f[_0x4f80('0x48')],function(_0xd2586a){var _0x4e13fc={};_0x4e13fc[_0xd2586a]={'$like':'%'+_0x2fedcc[_0x4f80('0x45')][_0x4f80('0x4f')]+'%'};return _0x4e13fc;})});}_0x4f9e6f=_[_0x4f80('0x4d')]({},_0x4f9e6f,_0x2fedcc[_0x4f80('0x6d')]);return db[_0x4f80('0x6a')][_0x4f80('0x34')]({'where':_0x4f9e6f[_0x4f80('0x4c')]})[_0x4f80('0x23')](function(_0x1ab1e6){_0x2278cd[_0x4f80('0x34')]=_0x1ab1e6;if(_0x2fedcc[_0x4f80('0x45')][_0x4f80('0x51')]){_0x4f9e6f['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x4f80('0x67')](_0x4f9e6f);})[_0x4f80('0x23')](function(_0x50a15d){_0x2278cd[_0x4f80('0x52')]=_0x50a15d;return _0x2278cd;});}})[_0x4f80('0x23')](respondWithFilteredResult(_0x452f4f,_0x4f9e6f))[_0x4f80('0x2d')](handleError(_0x452f4f,null));};exports[_0x4f80('0x6e')]=function(_0x2a7917,_0x4d4b84,_0x441aa2){return db[_0x4f80('0x50')][_0x4f80('0x56')]({'where':{'id':_0x2a7917[_0x4f80('0x53')]['id']}})['then'](handleEntityNotFound(_0x4d4b84,null))[_0x4f80('0x23')](function(_0x369254){if(_0x369254){return _0x369254[_0x4f80('0x6e')](_0x2a7917[_0x4f80('0x45')]['ids']);}})[_0x4f80('0x23')](respondWithStatusCode(_0x4d4b84,null))[_0x4f80('0x2d')](handleError(_0x4d4b84,null));};exports[_0x4f80('0x6f')]=function(_0xa7f402,_0x1e5893,_0x1b72f0){return db[_0x4f80('0x50')][_0x4f80('0x56')]({'where':{'id':_0xa7f402['params']['id']}})[_0x4f80('0x23')](handleEntityNotFound(_0x1e5893,null))['then'](function(_0x2e189b){if(_0x2e189b){return _0x2e189b[_0x4f80('0x6f')](_0xa7f402[_0x4f80('0x57')][_0x4f80('0x69')],_[_0x4f80('0x70')](_0xa7f402[_0x4f80('0x57')],[_0x4f80('0x69'),'id'])||{})[_0x4f80('0x71')](function(_0x5ae7fd){for(var _0x2d77e3=0x0;_0x2d77e3<_0xa7f402['body']['ids'][_0x4f80('0x54')];_0x2d77e3+=0x1){socket[_0x4f80('0x72')](_0x4f80('0x73'),{'UserId':Number(_0xa7f402[_0x4f80('0x57')][_0x4f80('0x69')][_0x2d77e3]),'WhatsappAccountId':Number(_0xa7f402[_0x4f80('0x53')]['id'])});}return _0x5ae7fd;});}})[_0x4f80('0x23')](respondWithResult(_0x1e5893,null))[_0x4f80('0x2d')](handleError(_0x1e5893,null));};exports[_0x4f80('0x74')]=function(_0x398b12,_0x177dda,_0x4dba3b){return db['WhatsappAccount'][_0x4f80('0x56')]({'where':{'id':_0x398b12['params']['id']}})['then'](handleEntityNotFound(_0x177dda,null))[_0x4f80('0x23')](function(_0x49ccae){if(_0x49ccae){return _0x49ccae[_0x4f80('0x74')](_0x398b12['query'][_0x4f80('0x69')])[_0x4f80('0x23')](function(){if(_[_0x4f80('0x75')](_0x398b12[_0x4f80('0x45')]['ids'])){for(var _0x18eaf2=0x0;_0x18eaf2<_0x398b12[_0x4f80('0x45')][_0x4f80('0x69')][_0x4f80('0x54')];_0x18eaf2+=0x1){socket[_0x4f80('0x72')]('userWhatsappAccount:remove',{'UserId':Number(_0x398b12[_0x4f80('0x45')]['ids'][_0x18eaf2]),'WhatsappAccountId':Number(_0x398b12[_0x4f80('0x53')]['id'])});}}else{socket[_0x4f80('0x72')](_0x4f80('0x76'),{'UserId':Number(_0x398b12['query'][_0x4f80('0x69')]),'WhatsappAccountId':Number(_0x398b12[_0x4f80('0x53')]['id'])});}});}})[_0x4f80('0x23')](respondWithStatusCode(_0x177dda,null))[_0x4f80('0x2d')](handleError(_0x177dda,null));};exports[_0x4f80('0x77')]=function(_0x3b70ac,_0x488aa6,_0xa02e32){var _0x44ab97={};var _0x21b1af={};var _0x5ae151;var _0x224656;return db[_0x4f80('0x50')][_0x4f80('0x62')]({'where':{'id':_0x3b70ac[_0x4f80('0x53')]['id']}})[_0x4f80('0x23')](handleEntityNotFound(_0x488aa6,null))[_0x4f80('0x23')](function(_0x2d76cd){if(_0x2d76cd){_0x5ae151=_0x2d76cd;_0x21b1af[_0x4f80('0x42')]=_[_0x4f80('0x46')](db[_0x4f80('0x78')][_0x4f80('0x3f')]);_0x21b1af[_0x4f80('0x45')]=_[_0x4f80('0x46')](_0x3b70ac[_0x4f80('0x45')]);_0x21b1af[_0x4f80('0x4a')]=_[_0x4f80('0x47')](_0x21b1af[_0x4f80('0x42')],_0x21b1af[_0x4f80('0x45')]);_0x44ab97[_0x4f80('0x48')]=_[_0x4f80('0x47')](_0x21b1af['model'],qs[_0x4f80('0x49')](_0x3b70ac['query'][_0x4f80('0x49')]));_0x44ab97[_0x4f80('0x48')]=_0x44ab97[_0x4f80('0x48')]['length']?_0x44ab97[_0x4f80('0x48')]:_0x21b1af[_0x4f80('0x42')];_0x44ab97[_0x4f80('0x65')]=qs['sort'](_0x3b70ac[_0x4f80('0x45')][_0x4f80('0x66')]);_0x44ab97[_0x4f80('0x4c')]=qs[_0x4f80('0x4a')](_[_0x4f80('0x4b')](_0x3b70ac[_0x4f80('0x45')],_0x21b1af[_0x4f80('0x4a')]));if(_0x3b70ac[_0x4f80('0x45')]['filter']){_0x44ab97[_0x4f80('0x4c')]=_['merge'](_0x44ab97[_0x4f80('0x4c')],{'$or':_[_0x4f80('0x43')](_0x44ab97['attributes'],function(_0x134c69){var _0x3fb531={};_0x3fb531[_0x134c69]={'$like':'%'+_0x3b70ac['query'][_0x4f80('0x4f')]+'%'};return _0x3fb531;})});}_0x44ab97=_['merge']({},_0x44ab97,_0x3b70ac[_0x4f80('0x6d')]);return _0x5ae151['getAgents'](_0x44ab97);}})[_0x4f80('0x23')](function(_0x2301ff){if(_0x2301ff){_0x224656=_0x2301ff[_0x4f80('0x54')];if(!_0x3b70ac[_0x4f80('0x45')][_0x4f80('0x6c')](_0x4f80('0x64'))){_0x44ab97['limit']=qs['limit'](_0x3b70ac[_0x4f80('0x45')][_0x4f80('0x32')]);_0x44ab97['offset']=qs[_0x4f80('0x31')](_0x3b70ac[_0x4f80('0x45')][_0x4f80('0x31')]);}return _0x5ae151[_0x4f80('0x77')](_0x44ab97);}})['then'](function(_0x2c2973){if(_0x2c2973){return _0x2c2973?{'count':_0x224656,'rows':_0x2c2973}:null;}})[_0x4f80('0x23')](respondWithResult(_0x488aa6,null))[_0x4f80('0x2d')](handleError(_0x488aa6,null));};exports[_0x4f80('0x79')]=function(_0x109a78,_0x3ca09d){var _0x115625=_0x109a78[_0x4f80('0x53')]['id'];var _0x57e613=_0x109a78[_0x4f80('0x57')];var _0xd87e52=0xc8;var _0xbc9f66=null;return db[_0x4f80('0x7a')][_0x4f80('0x7b')]({'isolationLevel':db['sequelize'][_0x4f80('0x7c')][_0x4f80('0x7d')][_0x4f80('0x7e')]},function(_0x4f7574){return db['WhatsappAccount'][_0x4f80('0x62')]({'where':{'id':_0x115625},'transaction':_0x4f7574})['then'](function(_0xa9ee0f){if(_0xa9ee0f){return db[_0x4f80('0x7f')]['destroy']({'where':{'WhatsappAccountId':_0x115625},'transaction':_0x4f7574})[_0x4f80('0x23')](function(){var _0x4198c7=_[_0x4f80('0x43')](_0x57e613,function(_0x5c7139){_0x5c7139['WhatsappAccountId']=_0x115625;return _0x5c7139;});return db[_0x4f80('0x7f')][_0x4f80('0x80')](_0x4198c7,{'transaction':_0x4f7574});});}else{_0xd87e52=0x194;_0xbc9f66=[];}});})[_0x4f80('0x23')](function(){if(_0xd87e52!==0x194){return db[_0x4f80('0x7f')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x115625},'order':_0x4f80('0x81')})['then'](function(_0x1ee5ef){_0xbc9f66=_0x1ee5ef;});}})[_0x4f80('0x2d')](function(_0x1031e0){_0xd87e52=0x1f4;logger[_0x4f80('0x2a')](_0x1031e0[_0x4f80('0x3b')]);if(_0x1031e0['name']){delete _0x1031e0[_0x4f80('0x44')];}_0xbc9f66=_0x1031e0;})['finally'](function(){if(_0xbc9f66===null){_0x3ca09d[_0x4f80('0x2e')](_0xd87e52);}else{if(_0xd87e52===0x1f4){_0x3ca09d[_0x4f80('0x35')](_0xd87e52)['send'](_0xbc9f66);}else{_0x3ca09d['status'](_0xd87e52)['json'](_0xbc9f66);}}});};exports['getApplications']=function(_0x3f7890,_0x5c21ad,_0x258074){var _0x2e8f3d={};var _0x1863bc={};var _0x1fad04;var _0x3c0af7;return db[_0x4f80('0x50')][_0x4f80('0x62')]({'where':{'id':_0x3f7890[_0x4f80('0x53')]['id']}})[_0x4f80('0x23')](handleEntityNotFound(_0x5c21ad,null))[_0x4f80('0x23')](function(_0x413b62){if(_0x413b62){_0x1fad04=_0x413b62;_0x1863bc[_0x4f80('0x42')]=_[_0x4f80('0x46')](db[_0x4f80('0x7f')][_0x4f80('0x3f')]);_0x1863bc[_0x4f80('0x45')]=_['keys'](_0x3f7890[_0x4f80('0x45')]);_0x1863bc[_0x4f80('0x4a')]=_[_0x4f80('0x47')](_0x1863bc[_0x4f80('0x42')],_0x1863bc[_0x4f80('0x45')]);_0x2e8f3d[_0x4f80('0x48')]=_['intersection'](_0x1863bc[_0x4f80('0x42')],qs[_0x4f80('0x49')](_0x3f7890[_0x4f80('0x45')]['fields']));_0x2e8f3d[_0x4f80('0x48')]=_0x2e8f3d[_0x4f80('0x48')][_0x4f80('0x54')]?_0x2e8f3d[_0x4f80('0x48')]:_0x1863bc['model'];_0x2e8f3d[_0x4f80('0x65')]=qs[_0x4f80('0x66')](_0x3f7890[_0x4f80('0x45')][_0x4f80('0x66')]);_0x2e8f3d[_0x4f80('0x4c')]=qs[_0x4f80('0x4a')](_[_0x4f80('0x4b')](_0x3f7890[_0x4f80('0x45')],_0x1863bc[_0x4f80('0x4a')]));if(_0x3f7890['query'][_0x4f80('0x4f')]){_0x2e8f3d[_0x4f80('0x4c')]=_[_0x4f80('0x4d')](_0x2e8f3d[_0x4f80('0x4c')],{'$or':_[_0x4f80('0x43')](_0x2e8f3d['attributes'],function(_0x233394){var _0x24c739={};_0x24c739[_0x233394]={'$like':'%'+_0x3f7890['query'][_0x4f80('0x4f')]+'%'};return _0x24c739;})});}_0x2e8f3d=_[_0x4f80('0x4d')]({},_0x2e8f3d,_0x3f7890[_0x4f80('0x6d')]);return _0x1fad04['getApplications'](_0x2e8f3d);}})['then'](function(_0xa566db){if(_0xa566db){_0x3c0af7=_0xa566db['length'];if(!_0x3f7890[_0x4f80('0x45')]['hasOwnProperty']('nolimit')){_0x2e8f3d[_0x4f80('0x32')]=qs[_0x4f80('0x32')](_0x3f7890['query'][_0x4f80('0x32')]);_0x2e8f3d['offset']=qs[_0x4f80('0x31')](_0x3f7890[_0x4f80('0x45')][_0x4f80('0x31')]);}return _0x1fad04[_0x4f80('0x82')](_0x2e8f3d);}})['then'](function(_0x2975df){if(_0x2975df){return _0x2975df?{'count':_0x3c0af7,'rows':_0x2975df}:null;}})[_0x4f80('0x23')](respondWithResult(_0x5c21ad,null))[_0x4f80('0x2d')](handleError(_0x5c21ad,null));};exports[_0x4f80('0x83')]=function(_0x2704e2,_0x499706,_0x440c03){var _0x44554b={'channel':_0x4f80('0x84')};var _0x116837=[];var _0x2ec91e=[];var _0x4a102a={};return db[_0x4f80('0x50')]['find']({'where':{'id':_0x2704e2[_0x4f80('0x53')]['id']},'include':[{'model':db[_0x4f80('0x7f')],'as':_0x4f80('0x85')}]})[_0x4f80('0x23')](handleEntityNotFound(_0x499706,null))[_0x4f80('0x23')](function(_0x41c6ca){_0x44554b[_0x4f80('0x86')]=_0x41c6ca;if(_0x44554b[_0x4f80('0x86')]&&_0x44554b[_0x4f80('0x86')]['type']===_0x4f80('0x87')&&_0x2704e2[_0x4f80('0x57')][_0x4f80('0x88')]){if(_0x2704e2[_0x4f80('0x57')][_0x4f80('0x88')][_0x4f80('0x54')]===0x0)return;if(_0x2704e2[_0x4f80('0x57')]['statuses'][0x0][_0x4f80('0x89')]!==_0x4f80('0x8a'))return;return db[_0x4f80('0x8b')]['update']({'read':!![],'readAt':_0x2704e2[_0x4f80('0x57')][_0x4f80('0x88')][0x0]['timestamp']},{'where':{'messageId':_0x2704e2[_0x4f80('0x57')]['statuses'][0x0][_0x4f80('0x8c')]},'individualHooks':!![]})[_0x4f80('0x23')](function(_0x3df654){return _0x499706[_0x4f80('0x35')](0xc8)[_0x4f80('0x30')](_0x3df654);});}_0x44554b['applications']=_[_0x4f80('0x8d')](_0x41c6ca['Applications'],[_0x4f80('0x81')],['asc']);if(_0x44554b[_0x4f80('0x86')]['Applications']){delete _0x44554b[_0x4f80('0x86')]['Applications'];}return db['CmContact'][_0x4f80('0x5f')]()['then'](function(_0x4487c0){if(!_0x4487c0){throw new db[(_0x4f80('0x8e'))][(_0x4f80('0x8f'))]('no\x20available\x20attributes');}_0x116837=_[_0x4f80('0x90')](_[_0x4f80('0x46')](_0x4487c0),[_0x4f80('0x91'),_0x4f80('0x92')]);_0x2ec91e=_[_0x4f80('0x90')](_[_0x4f80('0x46')](_0x4487c0),[_0x4f80('0x91'),_0x4f80('0x92'),_0x4f80('0x93'),_0x4f80('0x94')]);_0x44554b[_0x4f80('0x57')]={'mapKey':_0x4f80('0x95')};if(_0x44554b[_0x4f80('0x86')]&&_0x44554b[_0x4f80('0x86')][_0x4f80('0x41')]===_0x4f80('0x96')){_0x44554b['body']['from']=_0x2704e2['body'][_0x4f80('0x97')]['replace']('whatsapp:','');_0x44554b[_0x4f80('0x57')][_0x4f80('0x57')]=_0x2704e2[_0x4f80('0x57')][_0x4f80('0x98')];_0x44554b['body']['messageId']=_0x2704e2[_0x4f80('0x57')]['MessageSid'];}if(_0x44554b[_0x4f80('0x86')]&&_0x44554b[_0x4f80('0x86')]['type']===_0x4f80('0x87')){_0x44554b['body'][_0x4f80('0x99')]=_0x2704e2[_0x4f80('0x57')][_0x4f80('0x9a')][0x0][_0x4f80('0x99')];_0x44554b[_0x4f80('0x57')][_0x4f80('0x57')]=_0x2704e2[_0x4f80('0x57')][_0x4f80('0x9a')][0x0][_0x4f80('0x2c')][_0x4f80('0x57')];_0x44554b[_0x4f80('0x57')][_0x4f80('0x9b')]=_0x2704e2[_0x4f80('0x57')][_0x4f80('0x9a')][0x0]['message_id'];}if(_0x44554b['body']['id']){delete _0x44554b[_0x4f80('0x57')]['id'];}if(_['isNil'](_0x44554b[_0x4f80('0x57')][_0x4f80('0x99')])){throw new db[(_0x4f80('0x8e'))][(_0x4f80('0x8f'))](_0x4f80('0x9c'));}if(_[_0x4f80('0x9d')](_0x44554b[_0x4f80('0x57')][_0x4f80('0x57')])||_0x44554b[_0x4f80('0x57')][_0x4f80('0x57')]===''){throw new db['Sequelize']['ValidationError'](_0x4f80('0x9e'));}if(_[_0x4f80('0x9d')](_0x44554b[_0x4f80('0x57')][_0x4f80('0x9f')])){throw new db[(_0x4f80('0x8e'))][(_0x4f80('0x8f'))](_0x4f80('0xa0')+_0x2ec91e);}if(!_['includes'](_0x2ec91e,_0x44554b[_0x4f80('0x57')][_0x4f80('0x9f')])){throw new db[(_0x4f80('0x8e'))][(_0x4f80('0x8f'))](_0x4f80('0xa1')+_0x2ec91e);}_0x4a102a[_0x44554b[_0x4f80('0x57')]['mapKey']]=_0x44554b[_0x4f80('0x57')]['from'];return db[_0x4f80('0xa2')][_0x4f80('0x56')]({'where':{'id':_0x44554b[_0x4f80('0x86')][_0x4f80('0x94')]},'include':[{'model':db[_0x4f80('0xa3')],'as':_0x4f80('0xa4'),'where':_0x4a102a,'limit':0x1,'order':[[_0x4f80('0x92'),_0x4f80('0xa5')]]}]});})[_0x4f80('0x23')](handleEntityNotFound(_0x499706,null))[_0x4f80('0x23')](function(_0x21a389){if(_0x21a389){_0x44554b['list']=_[_0x4f80('0x70')](_0x21a389,['Contacts']);if(_0x21a389[_0x4f80('0xa4')][_0x4f80('0x54')]){return _0x21a389[_0x4f80('0xa4')][0x0];}var _0x2600be=_[_0x4f80('0x1b')](_0x44554b[_0x4f80('0x57')],{'firstName':_0x44554b[_0x4f80('0x57')][_0x4f80('0x99')],'ListId':_0x21a389['id']});_0x2600be[_0x44554b[_0x4f80('0x57')][_0x4f80('0x9f')]]=_0x44554b[_0x4f80('0x57')][_0x4f80('0x99')];return db[_0x4f80('0xa3')][_0x4f80('0x5d')](_0x2600be,{'fields':_0x116837,'raw':!![]});}})[_0x4f80('0x23')](handleEntityNotFound(_0x499706,null))[_0x4f80('0x23')](function(_0x28eb90){if(_0x28eb90){_0x44554b[_0x4f80('0xa6')]=_0x28eb90;var _0x542d8f={'ContactId':_0x28eb90['id'],'phone':_0x44554b['body'][_0x4f80('0x99')],'WhatsappAccountId':_0x2704e2[_0x4f80('0x53')]['id']};var _0x393e14={'ContactId':_0x28eb90['id'],'WhatsappAccountId':_0x2704e2[_0x4f80('0x53')]['id'],'closed':![]};return db[_0x4f80('0xa7')]['find']({'where':_0x393e14})['then'](function(_0x503529){if(_0x503529){return[_0x503529,![]];}return db[_0x4f80('0xa7')][_0x4f80('0x5d')](_0x542d8f)['then'](function(_0x216036){return[_0x216036,!![]];});});}})['spread'](function(_0x12d2ae,_0x449e98){_0x44554b[_0x4f80('0xa8')]=_0x12d2ae['get']({'plain':!![]});_0x44554b['interaction']['created']=![];if(_0x449e98){if(_0x44554b[_0x4f80('0x86')]['autoclose']){_0x44554b[_0x4f80('0xa9')][_0x4f80('0xaa')]({'id':0x0,'priority':_0x44554b['applications']['length']+0x1,'app':_0x4f80('0xab'),'appdata':'unmanaged','interval':_0x4f80('0xac')});}_0x44554b[_0x4f80('0xa8')][_0x4f80('0xad')]=!![];}return db[_0x4f80('0x8b')][_0x4f80('0x5d')]({'phone':_0x44554b[_0x4f80('0x57')]['from'],'messageId':_0x44554b['body']['messageId'],'body':_0x44554b[_0x4f80('0x57')][_0x4f80('0x57')],'WhatsappAccountId':_0x2704e2[_0x4f80('0x53')]['id'],'WhatsappInteractionId':_0x12d2ae['id'],'direction':'in','ContactId':_0x12d2ae[_0x4f80('0xae')],'AttachmentId':_0x44554b['body'][_0x4f80('0xaf')]});})[_0x4f80('0x23')](function(_0x2062a1){_0x44554b[_0x4f80('0x2c')]=_0x2062a1;if(!_0x44554b['interaction'][_0x4f80('0xb0')])return;return db[_0x4f80('0x78')][_0x4f80('0x56')]({'attributes':['id',_0x4f80('0x44')],'where':{'id':_0x44554b[_0x4f80('0xa8')][_0x4f80('0xb0')]}});})['then'](function(_0xd9ced2){if(_0xd9ced2){_0x44554b['applications'][_0x4f80('0xb1')]({'id':0x0,'priority':0x0,'app':_0x4f80('0xb2'),'appdata':_0xd9ced2[_0x4f80('0x44')]+','+(_0x44554b[_0x4f80('0x86')]['waitForTheAssignedAgent']||0xa),'interval':_0x4f80('0xac')});}if(!_0x44554b['interaction'][_0x4f80('0xb3')])return;return db[_0x4f80('0xb4')][_0x4f80('0x56')]({'attributes':['id','name'],'where':{'id':_0x44554b[_0x4f80('0xa8')]['queueId']}});})[_0x4f80('0x23')](function(_0x41ac3a){if(_0x41ac3a){_0x44554b['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x4f80('0xb5'),'appdata':_0x41ac3a[_0x4f80('0x44')]+','+(_0x44554b['account'][_0x4f80('0xb6')]||0x12c),'interval':_0x4f80('0xac')});}return respondWithRpcPromise('Start',_0x4f80('0xb7'),_0x44554b);})[_0x4f80('0x23')](function(_0x129f1f){if(_0x129f1f){var _0x3bf90f=0xc8;var _0x2e20ea=_0x4f80('0xb8');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2e20ea,_0x3bf90f,_0x4f80('0xb9'));logger[_0x4f80('0x27')](_0x4f80('0xba'),_0x2e20ea,_0x3bf90f,_0x4f80('0xb9'),JSON[_0x4f80('0x29')](_0x129f1f));if(_0x44554b[_0x4f80('0x86')][_0x4f80('0x41')]===_0x4f80('0x96')){return _0x499706[_0x4f80('0x35')](_0x3bf90f)[_0x4f80('0xbb')](_0x4f80('0xbc'),'text/xml')[_0x4f80('0x3c')](_0x4f80('0xbd'));}else{return _0x499706[_0x4f80('0x35')](_0x3bf90f)[_0x4f80('0x30')](_0x129f1f);}}});})['catch'](handleError(_0x499706,null));};exports[_0x4f80('0x3c')]=function(_0x3985,_0x16e953,_0xdf3cfa){var _0x3ae92a,_0x241948,_0x5eaea7;if(_[_0x4f80('0x9d')](_0x3985[_0x4f80('0x57')][_0x4f80('0x57')])||_0x3985[_0x4f80('0x57')]['body']===''){throw new db[(_0x4f80('0x8e'))][(_0x4f80('0x8f'))](_0x4f80('0x9e'));}if(_[_0x4f80('0x9d')](_0x3985[_0x4f80('0x57')]['to'])){throw new db[(_0x4f80('0x8e'))][(_0x4f80('0x8f'))](_0x4f80('0xbe'));}_0x3ae92a=_0x3985[_0x4f80('0x57')]['to'];return db[_0x4f80('0x50')][_0x4f80('0x56')]({'where':{'id':_0x3985['params']['id']},'include':[{'model':db[_0x4f80('0xa2')],'as':_0x4f80('0xbf'),'include':[{'model':db[_0x4f80('0xa3')],'as':_0x4f80('0xa4'),'where':{'mobile':_0x3ae92a},'limit':0x1,'order':[[_0x4f80('0x92'),_0x4f80('0xa5')]]}]}]})[_0x4f80('0x23')](handleEntityNotFound(_0x16e953,null))[_0x4f80('0x23')](function(_0x297ff0){if(_0x297ff0&&_0x297ff0[_0x4f80('0xbf')]){_0x241948=_0x297ff0[_0x4f80('0x5a')]({'plain':!![]});if(_0x241948['List']&&_0x241948['List'][_0x4f80('0xa4')]['length']){return _0x241948[_0x4f80('0xbf')][_0x4f80('0xa4')][0x0];}return db[_0x4f80('0xa3')][_0x4f80('0x5d')](_[_0x4f80('0x1b')](_0x3985[_0x4f80('0x57')],{'firstName':_0x3ae92a,'mobile':_0x3ae92a,'phone':_0x3ae92a,'ListId':_0x241948[_0x4f80('0x94')]}));}})['then'](handleEntityNotFound(_0x16e953,null))['then'](function(_0x55c731){if(_0x55c731){_0x5eaea7=_0x55c731;return db[_0x4f80('0xa7')][_0x4f80('0x56')]({'where':{'ContactId':_0x5eaea7['id'],'closed':![],'WhatsappAccountId':_0x241948['id']}})['then'](function(_0x555cde){if(_0x555cde){return[_0x555cde,![]];}return db[_0x4f80('0xa7')][_0x4f80('0x5d')]({'UserId':_0x3985['user']['id'],'ContactId':_0x5eaea7['id'],'WhatsappAccountId':_0x241948['id'],'phone':_0x3ae92a,'firstMsgDirection':_0x4f80('0xc0'),'Messages':[_['merge'](_0x3985['body'],{'read':![],'body':_0x3985[_0x4f80('0x57')][_0x4f80('0x57')],'phone':_0x3ae92a,'WhatsappAccountId':_0x241948['id'],'UserId':_0x3985[_0x4f80('0x59')]['id'],'ContactId':_0x5eaea7['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x4f80('0xc1')}]})[_0x4f80('0x23')](function(_0x3a3a78){return[_0x3a3a78,!![]];});});}})['spread'](function(_0x3a1aa7,_0x504b9a){if(_0x504b9a){return _0x3a1aa7;}return db['WhatsappMessage'][_0x4f80('0x5d')](_['merge'](_0x3985[_0x4f80('0x57')],{'read':![],'body':_0x3985[_0x4f80('0x57')][_0x4f80('0x57')],'phone':_0x3ae92a,'WhatsappAccountId':_0x241948['id'],'WhatsappInteractionId':_0x3a1aa7['id'],'UserId':_0x3985[_0x4f80('0x59')]['id'],'ContactId':_0x5eaea7['id']}))[_0x4f80('0x23')](function(_0x203fe0){_0x3a1aa7[_0x4f80('0xc2')][_0x4f80('0xc1')]=[];_0x3a1aa7[_0x4f80('0xc2')][_0x4f80('0xc1')][_0x4f80('0xaa')](_0x203fe0['dataValues']);return _0x3a1aa7;});})['then'](respondWithResult(_0x16e953,null))[_0x4f80('0x2d')](handleError(_0x16e953,null));}; \ No newline at end of file +var _0x6e9c=['filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','Pause','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','params','Disposition','findOne','nolimit','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','rows','addAgents','omit','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','order','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','WhatsappApplication','findAndCountAll','priority','stack','finally','getApplications','notify','whatsapp','account','sinch','statuses','state','read','WhatsappMessage','timestamp','orderBy','Applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','createdAt','ListId','mobile','From','replace','whatsapp:','Body','MessageSid','from','messageId','notifications','message_id','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','Contacts','DESC','list','contact','WhatsappInteraction','spread','interaction','created','autoclose','push','applications','close','unmanaged','*,*,*,*','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','reject','update','destroy','get','WhatsappAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x11ba09,_0x2a01a8){var _0x44f298=function(_0x59bcc5){while(--_0x59bcc5){_0x11ba09['push'](_0x11ba09['shift']());}};_0x44f298(++_0x2a01a8);}(_0x6e9c,0x153));var _0xc6e9=function(_0x27ad96,_0x2431f9){_0x27ad96=_0x27ad96-0x0;var _0xd75b77=_0x6e9c[_0x27ad96];return _0xd75b77;};'use strict';var emlformat=require(_0xc6e9('0x0'));var rimraf=require(_0xc6e9('0x1'));var zipdir=require(_0xc6e9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc6e9('0x3'));var moment=require(_0xc6e9('0x4'));var BPromise=require(_0xc6e9('0x5'));var Mustache=require('mustache');var util=require(_0xc6e9('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc6e9('0x7'));var fs=require('fs');var fs_extra=require(_0xc6e9('0x8'));var _=require(_0xc6e9('0x9'));var squel=require(_0xc6e9('0xa'));var crypto=require('crypto');var jsforce=require(_0xc6e9('0xb'));var deskjs=require(_0xc6e9('0xc'));var toCsv=require(_0xc6e9('0xd'));var querystring=require(_0xc6e9('0xe'));var Papa=require(_0xc6e9('0xf'));var Redis=require(_0xc6e9('0x10'));var authService=require(_0xc6e9('0x11'));var qs=require(_0xc6e9('0x12'));var as=require(_0xc6e9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc6e9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc6e9('0x15'));var db=require(_0xc6e9('0x16'))['db'];config[_0xc6e9('0x17')]=_[_0xc6e9('0x18')](config[_0xc6e9('0x17')],{'host':_0xc6e9('0x19'),'port':0x18eb});var socket=require(_0xc6e9('0x1a'))(new Redis(config['redis']));require(_0xc6e9('0x1b'))['register'](socket);var jayson=require(_0xc6e9('0x1c'));var client=jayson[_0xc6e9('0x1d')][_0xc6e9('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x4939da,_0x5e9fba,_0x57a204,_0xf615e5){return new BPromise(function(_0x44eb58,_0x3004fd){var _0x49dd5c=_0xf615e5||client;return _0x49dd5c['request'](_0x4939da,_0x57a204)[_0xc6e9('0x1f')](function(_0x137ecf){logger[_0xc6e9('0x20')](_0xc6e9('0x21'),_0x5e9fba,_0xc6e9('0x22'));logger['debug'](_0xc6e9('0x23'),_0x5e9fba,_0xc6e9('0x22'),JSON['stringify'](_0x137ecf));if(_0x137ecf['error']){if(_0x137ecf[_0xc6e9('0x24')]['code']===0x1f4){logger[_0xc6e9('0x24')](_0xc6e9('0x21'),_0x5e9fba,_0x137ecf['error'][_0xc6e9('0x25')]);return _0x3004fd(_0x137ecf[_0xc6e9('0x24')][_0xc6e9('0x25')]);}logger[_0xc6e9('0x24')](_0xc6e9('0x21'),_0x5e9fba,_0x137ecf[_0xc6e9('0x24')][_0xc6e9('0x25')]);return _0x44eb58(_0x137ecf[_0xc6e9('0x24')][_0xc6e9('0x25')]);}else{logger[_0xc6e9('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x5e9fba,_0xc6e9('0x22'));_0x44eb58(_0x137ecf[_0xc6e9('0x26')][_0xc6e9('0x25')]);}})['catch'](function(_0x5257cc){logger[_0xc6e9('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x5e9fba,_0x5257cc);_0x3004fd(_0x5257cc);});});}function respondWithStatusCode(_0x45693b,_0x20f5f8){_0x20f5f8=_0x20f5f8||0xcc;return function(_0x87928e){if(_0x87928e){return _0x45693b[_0xc6e9('0x27')](_0x20f5f8);}return _0x45693b['status'](_0x20f5f8)[_0xc6e9('0x28')]();};}function respondWithResult(_0x238e79,_0x2eabf1){_0x2eabf1=_0x2eabf1||0xc8;return function(_0x2611bf){if(_0x2611bf){return _0x238e79[_0xc6e9('0x29')](_0x2eabf1)[_0xc6e9('0x2a')](_0x2611bf);}};}function respondWithFilteredResult(_0x2ccead,_0x4c7d2b){return function(_0x497f97){if(_0x497f97){var _0x26cbc5=typeof _0x4c7d2b[_0xc6e9('0x2b')]===_0xc6e9('0x2c')&&typeof _0x4c7d2b['limit']===_0xc6e9('0x2c');var _0x3a9c14=_0x497f97['count'];var _0x4787bd=_0x26cbc5?0x0:_0x4c7d2b[_0xc6e9('0x2b')];var _0x3760bf=_0x26cbc5?_0x497f97[_0xc6e9('0x2d')]:_0x4c7d2b[_0xc6e9('0x2b')]+_0x4c7d2b['limit'];var _0x4aef05;if(_0x3760bf>=_0x3a9c14){_0x3760bf=_0x3a9c14;_0x4aef05=0xc8;}else{_0x4aef05=0xce;}_0x2ccead[_0xc6e9('0x29')](_0x4aef05);return _0x2ccead[_0xc6e9('0x2e')](_0xc6e9('0x2f'),_0x4787bd+'-'+_0x3760bf+'/'+_0x3a9c14)[_0xc6e9('0x2a')](_0x497f97);}return null;};}function patchUpdates(_0x5db620){return function(_0x5b94ff){try{jsonpatch['apply'](_0x5b94ff,_0x5db620,!![]);}catch(_0x31669a){return BPromise[_0xc6e9('0x30')](_0x31669a);}return _0x5b94ff['save']();};}function saveUpdates(_0x1b5f3e,_0xac8c94){return function(_0x464c3d){if(_0x464c3d){return _0x464c3d[_0xc6e9('0x31')](_0x1b5f3e)['then'](function(_0x117c40){return _0x117c40;});}return null;};}function removeEntity(_0x38657e,_0x3e8ffb){return function(_0x427814){if(_0x427814){return _0x427814[_0xc6e9('0x32')]()['then'](function(){var _0x34ffcb=_0x427814[_0xc6e9('0x33')]({'plain':!![]});var _0x1fde88=_0xc6e9('0x34');return db[_0xc6e9('0x35')]['destroy']({'where':{'type':_0x1fde88,'resourceId':_0x34ffcb['id']}})[_0xc6e9('0x1f')](function(){return _0x427814;});})[_0xc6e9('0x1f')](function(){_0x38657e[_0xc6e9('0x29')](0xcc)[_0xc6e9('0x28')]();});}};}function handleEntityNotFound(_0x1a00ea,_0x132bb8){return function(_0x76f049){if(!_0x76f049){_0x1a00ea[_0xc6e9('0x27')](0x194);}return _0x76f049;};}function handleError(_0x5a9d3a,_0x5a0c38){_0x5a0c38=_0x5a0c38||0x1f4;return function(_0x3f3d60){logger[_0xc6e9('0x24')](_0x3f3d60['stack']);if(_0x3f3d60[_0xc6e9('0x36')]){delete _0x3f3d60[_0xc6e9('0x36')];}_0x5a9d3a[_0xc6e9('0x29')](_0x5a0c38)[_0xc6e9('0x37')](_0x3f3d60);};}exports[_0xc6e9('0x38')]=function(_0x279eca,_0xde2354){var _0x28afd3={'include':[{'model':db['Pause'],'as':_0xc6e9('0x39')}]},_0x1ca222={},_0x42ee89={'count':0x0,'rows':[]};var _0x4dc3a5=_[_0xc6e9('0x3a')](db[_0xc6e9('0x3b')][_0xc6e9('0x3c')],function(_0x34dd2a){return{'name':_0x34dd2a[_0xc6e9('0x3d')],'type':_0x34dd2a[_0xc6e9('0x3e')][_0xc6e9('0x3f')]};});_0x1ca222[_0xc6e9('0x40')]=_[_0xc6e9('0x3a')](_0x4dc3a5,'name');_0x1ca222[_0xc6e9('0x41')]=_[_0xc6e9('0x42')](_0x279eca[_0xc6e9('0x41')]);_0x1ca222[_0xc6e9('0x43')]=_['intersection'](_0x1ca222[_0xc6e9('0x40')],_0x1ca222[_0xc6e9('0x41')]);_0x28afd3[_0xc6e9('0x44')]=_[_0xc6e9('0x45')](_0x1ca222['model'],qs[_0xc6e9('0x46')](_0x279eca['query']['fields']));_0x28afd3[_0xc6e9('0x44')]=_0x28afd3[_0xc6e9('0x44')][_0xc6e9('0x47')]?_0x28afd3['attributes']:_0x1ca222[_0xc6e9('0x40')];if(!_0x279eca[_0xc6e9('0x41')][_0xc6e9('0x48')]('nolimit')){_0x28afd3[_0xc6e9('0x49')]=qs[_0xc6e9('0x49')](_0x279eca[_0xc6e9('0x41')]['limit']);_0x28afd3['offset']=qs[_0xc6e9('0x2b')](_0x279eca[_0xc6e9('0x41')][_0xc6e9('0x2b')]);}_0x28afd3['order']=qs[_0xc6e9('0x4a')](_0x279eca[_0xc6e9('0x41')][_0xc6e9('0x4a')]);_0x28afd3['where']=qs[_0xc6e9('0x43')](_[_0xc6e9('0x4b')](_0x279eca[_0xc6e9('0x41')],_0x1ca222[_0xc6e9('0x43')]),_0x4dc3a5);if(_0x279eca[_0xc6e9('0x41')][_0xc6e9('0x4c')]){_0x28afd3[_0xc6e9('0x4d')]=_[_0xc6e9('0x4e')](_0x28afd3['where'],{'$or':_[_0xc6e9('0x3a')](_0x4dc3a5,function(_0x51dcd1){if(_0x51dcd1[_0xc6e9('0x3e')]!==_0xc6e9('0x4f')){var _0x5bcbd4={};_0x5bcbd4[_0x51dcd1[_0xc6e9('0x36')]]={'$like':'%'+_0x279eca[_0xc6e9('0x41')][_0xc6e9('0x4c')]+'%'};return _0x5bcbd4;}})});}_0x28afd3=_['merge']({},_0x28afd3,_0x279eca[_0xc6e9('0x50')]);var _0x390f43={'where':_0x28afd3['where']};return db[_0xc6e9('0x3b')][_0xc6e9('0x2d')](_0x390f43)[_0xc6e9('0x1f')](function(_0x85ddf5){_0x42ee89[_0xc6e9('0x2d')]=_0x85ddf5;if(_0x279eca[_0xc6e9('0x41')][_0xc6e9('0x51')]){_0x28afd3[_0xc6e9('0x52')]=[{'all':!![]}];}return db[_0xc6e9('0x3b')][_0xc6e9('0x53')](_0x28afd3);})[_0xc6e9('0x1f')](function(_0x389c2d){_0x42ee89['rows']=_0x389c2d;return _0x42ee89;})['then'](respondWithFilteredResult(_0xde2354,_0x28afd3))[_0xc6e9('0x54')](handleError(_0xde2354,null));};exports[_0xc6e9('0x55')]=function(_0x2e364e,_0x2f55d6){var _0x7e49c8={'raw':![],'where':{'id':_0x2e364e['params']['id']},'include':[{'model':db[_0xc6e9('0x56')],'as':'mandatoryDispositionPause'}]},_0x33ed6d={};_0x33ed6d['model']=_['keys'](db[_0xc6e9('0x3b')]['rawAttributes']);_0x33ed6d[_0xc6e9('0x41')]=_[_0xc6e9('0x42')](_0x2e364e[_0xc6e9('0x41')]);_0x33ed6d[_0xc6e9('0x43')]=_['intersection'](_0x33ed6d[_0xc6e9('0x40')],_0x33ed6d[_0xc6e9('0x41')]);_0x7e49c8['attributes']=_['intersection'](_0x33ed6d['model'],qs['fields'](_0x2e364e['query'][_0xc6e9('0x46')]));_0x7e49c8[_0xc6e9('0x44')]=_0x7e49c8[_0xc6e9('0x44')][_0xc6e9('0x47')]?_0x7e49c8['attributes']:_0x33ed6d['model'];if(_0x2e364e[_0xc6e9('0x41')][_0xc6e9('0x51')]){_0x7e49c8['include']=[{'all':!![]}];}_0x7e49c8=_[_0xc6e9('0x4e')]({},_0x7e49c8,_0x2e364e[_0xc6e9('0x50')]);return db[_0xc6e9('0x3b')][_0xc6e9('0x57')](_0x7e49c8)[_0xc6e9('0x1f')](handleEntityNotFound(_0x2f55d6,null))['then'](respondWithResult(_0x2f55d6,null))['catch'](handleError(_0x2f55d6,null));};exports['create']=function(_0x2796b4,_0x1bf6a4){return db['WhatsappAccount'][_0xc6e9('0x58')](_0x2796b4[_0xc6e9('0x59')],{})[_0xc6e9('0x1f')](function(_0x598d54){var _0x55154d=_0x2796b4['user']['get']({'plain':!![]});if(!_0x55154d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55154d[_0xc6e9('0x5a')]===_0xc6e9('0x5b')){var _0xfcc03=_0x598d54[_0xc6e9('0x33')]({'plain':!![]});var _0x17ccf8='WhatsappAccounts';return db[_0xc6e9('0x5c')][_0xc6e9('0x57')]({'where':{'name':_0x17ccf8,'userProfileId':_0x55154d[_0xc6e9('0x5d')]},'raw':!![]})['then'](function(_0x237809){if(_0x237809&&_0x237809[_0xc6e9('0x5e')]===0x0){return db[_0xc6e9('0x35')][_0xc6e9('0x58')]({'name':_0xfcc03[_0xc6e9('0x36')],'resourceId':_0xfcc03['id'],'type':_0x237809[_0xc6e9('0x36')],'sectionId':_0x237809['id']},{})[_0xc6e9('0x1f')](function(){return _0x598d54;});}else{return _0x598d54;}})['catch'](function(_0xd08f6c){logger[_0xc6e9('0x24')](_0xc6e9('0x5f'),_0xd08f6c);throw _0xd08f6c;});}return _0x598d54;})['then'](respondWithResult(_0x1bf6a4,0xc9))['catch'](handleError(_0x1bf6a4,null));};exports[_0xc6e9('0x31')]=function(_0x30b83c,_0x535308){if(_0x30b83c[_0xc6e9('0x59')]['id']){delete _0x30b83c[_0xc6e9('0x59')]['id'];}return db[_0xc6e9('0x3b')][_0xc6e9('0x57')]({'where':{'id':_0x30b83c['params']['id']},'include':[{'model':db[_0xc6e9('0x56')],'as':'mandatoryDispositionPause'}]})[_0xc6e9('0x1f')](handleEntityNotFound(_0x535308,null))['then'](saveUpdates(_0x30b83c[_0xc6e9('0x59')],null))[_0xc6e9('0x1f')](respondWithResult(_0x535308,null))[_0xc6e9('0x54')](handleError(_0x535308,null));};exports[_0xc6e9('0x32')]=function(_0x5e8810,_0x63113a){return db['WhatsappAccount'][_0xc6e9('0x57')]({'where':{'id':_0x5e8810['params']['id']}})['then'](handleEntityNotFound(_0x63113a,null))[_0xc6e9('0x1f')](removeEntity(_0x63113a,null))[_0xc6e9('0x54')](handleError(_0x63113a,null));};exports['describe']=function(_0x4f1a78,_0xedda93){return db[_0xc6e9('0x3b')][_0xc6e9('0x60')]()['then'](respondWithResult(_0xedda93,null))['catch'](handleError(_0xedda93,null));};exports[_0xc6e9('0x61')]=function(_0x475f00,_0x111464,_0xf1f822){if(_0x475f00[_0xc6e9('0x59')]['id']){delete _0x475f00[_0xc6e9('0x59')]['id'];}return db['WhatsappAccount'][_0xc6e9('0x57')]({'where':{'id':_0x475f00[_0xc6e9('0x62')]['id']}})[_0xc6e9('0x1f')](handleEntityNotFound(_0x111464,null))[_0xc6e9('0x1f')](function(_0x4f67f6){if(_0x4f67f6){_0x475f00[_0xc6e9('0x59')]['WhatsappAccountId']=_0x4f67f6['id'];return db[_0xc6e9('0x63')]['create'](_0x475f00['body']);}})[_0xc6e9('0x1f')](respondWithResult(_0x111464,null))['catch'](handleError(_0x111464,null));};exports['getDispositions']=function(_0x2a5c8d,_0x1c30ed,_0x32cbb2){var _0x37fb41={'raw':![],'where':{}};var _0x412580={};var _0x185ba4={'count':0x0,'rows':[]};return db[_0xc6e9('0x3b')][_0xc6e9('0x64')]({'where':{'id':_0x2a5c8d['params']['id']}})[_0xc6e9('0x1f')](handleEntityNotFound(_0x1c30ed,null))[_0xc6e9('0x1f')](function(_0x1517ab){if(_0x1517ab){_0x412580[_0xc6e9('0x40')]=_['keys'](db[_0xc6e9('0x63')][_0xc6e9('0x3c')]);_0x412580[_0xc6e9('0x41')]=_['keys'](_0x2a5c8d[_0xc6e9('0x41')]);_0x412580[_0xc6e9('0x43')]=_[_0xc6e9('0x45')](_0x412580[_0xc6e9('0x40')],_0x412580[_0xc6e9('0x41')]);_0x37fb41['attributes']=_[_0xc6e9('0x45')](_0x412580[_0xc6e9('0x40')],qs[_0xc6e9('0x46')](_0x2a5c8d['query'][_0xc6e9('0x46')]));_0x37fb41[_0xc6e9('0x44')]=_0x37fb41[_0xc6e9('0x44')][_0xc6e9('0x47')]?_0x37fb41[_0xc6e9('0x44')]:_0x412580[_0xc6e9('0x40')];if(!_0x2a5c8d[_0xc6e9('0x41')][_0xc6e9('0x48')](_0xc6e9('0x65'))){_0x37fb41['limit']=qs[_0xc6e9('0x49')](_0x2a5c8d[_0xc6e9('0x41')]['limit']);_0x37fb41[_0xc6e9('0x2b')]=qs[_0xc6e9('0x2b')](_0x2a5c8d[_0xc6e9('0x41')][_0xc6e9('0x2b')]);}_0x37fb41['order']=qs['sort'](_0x2a5c8d[_0xc6e9('0x41')][_0xc6e9('0x4a')]);_0x37fb41[_0xc6e9('0x4d')]=qs[_0xc6e9('0x43')](_[_0xc6e9('0x4b')](_0x2a5c8d[_0xc6e9('0x41')],_0x412580[_0xc6e9('0x43')]));_0x37fb41[_0xc6e9('0x4d')][_0xc6e9('0x66')]=_0x1517ab['id'];if(_0x2a5c8d[_0xc6e9('0x41')][_0xc6e9('0x4c')]){_0x37fb41[_0xc6e9('0x4d')]=_[_0xc6e9('0x4e')](_0x37fb41[_0xc6e9('0x4d')],{'$or':_[_0xc6e9('0x3a')](_0x37fb41[_0xc6e9('0x44')],function(_0x26615b){var _0x2e7e75={};_0x2e7e75[_0x26615b]={'$like':'%'+_0x2a5c8d['query'][_0xc6e9('0x4c')]+'%'};return _0x2e7e75;})});}_0x37fb41=_[_0xc6e9('0x4e')]({},_0x37fb41,_0x2a5c8d[_0xc6e9('0x50')]);return db[_0xc6e9('0x63')][_0xc6e9('0x2d')]({'where':_0x37fb41[_0xc6e9('0x4d')]})[_0xc6e9('0x1f')](function(_0x19bd28){_0x185ba4['count']=_0x19bd28;if(_0x2a5c8d[_0xc6e9('0x41')][_0xc6e9('0x51')]){_0x37fb41['include']=[{'all':!![]}];}return db[_0xc6e9('0x63')][_0xc6e9('0x53')](_0x37fb41);})[_0xc6e9('0x1f')](function(_0x194449){_0x185ba4['rows']=_0x194449;return _0x185ba4;});}})['then'](respondWithFilteredResult(_0x1c30ed,_0x37fb41))[_0xc6e9('0x54')](handleError(_0x1c30ed,null));};exports['removeDispositions']=function(_0x3f77b7,_0x59d52b,_0x1c265f){return db[_0xc6e9('0x3b')][_0xc6e9('0x57')]({'where':{'id':_0x3f77b7['params']['id']}})[_0xc6e9('0x1f')](handleEntityNotFound(_0x59d52b,null))[_0xc6e9('0x1f')](function(_0x42b4c5){if(_0x42b4c5){return _0x42b4c5[_0xc6e9('0x67')](_0x3f77b7[_0xc6e9('0x41')][_0xc6e9('0x68')]);}})[_0xc6e9('0x1f')](respondWithStatusCode(_0x59d52b,null))[_0xc6e9('0x54')](handleError(_0x59d52b,null));};exports[_0xc6e9('0x69')]=function(_0x5e4f72,_0x17e22d,_0x5a2775){if(_0x5e4f72[_0xc6e9('0x59')]['id']){delete _0x5e4f72[_0xc6e9('0x59')]['id'];}return db[_0xc6e9('0x3b')]['find']({'where':{'id':_0x5e4f72[_0xc6e9('0x62')]['id']}})[_0xc6e9('0x1f')](handleEntityNotFound(_0x17e22d,null))['then'](function(_0x33c8ae){if(_0x33c8ae){_0x5e4f72[_0xc6e9('0x59')][_0xc6e9('0x66')]=_0x33c8ae['id'];return db[_0xc6e9('0x6a')]['create'](_0x5e4f72[_0xc6e9('0x59')]);}})[_0xc6e9('0x1f')](respondWithResult(_0x17e22d,null))[_0xc6e9('0x54')](handleError(_0x17e22d,null));};exports['getAnswers']=function(_0x154348,_0x18c222,_0x3d9271){var _0x183dd0={'raw':![],'where':{}};var _0x28919f={};var _0x54714c={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xc6e9('0x64')]({'where':{'id':_0x154348[_0xc6e9('0x62')]['id']}})[_0xc6e9('0x1f')](handleEntityNotFound(_0x18c222,null))[_0xc6e9('0x1f')](function(_0x377cdd){if(_0x377cdd){_0x28919f[_0xc6e9('0x40')]=_[_0xc6e9('0x42')](db[_0xc6e9('0x6a')][_0xc6e9('0x3c')]);_0x28919f[_0xc6e9('0x41')]=_['keys'](_0x154348[_0xc6e9('0x41')]);_0x28919f[_0xc6e9('0x43')]=_[_0xc6e9('0x45')](_0x28919f[_0xc6e9('0x40')],_0x28919f[_0xc6e9('0x41')]);_0x183dd0[_0xc6e9('0x44')]=_['intersection'](_0x28919f['model'],qs[_0xc6e9('0x46')](_0x154348['query'][_0xc6e9('0x46')]));_0x183dd0[_0xc6e9('0x44')]=_0x183dd0[_0xc6e9('0x44')]['length']?_0x183dd0[_0xc6e9('0x44')]:_0x28919f[_0xc6e9('0x40')];if(!_0x154348[_0xc6e9('0x41')]['hasOwnProperty'](_0xc6e9('0x65'))){_0x183dd0[_0xc6e9('0x49')]=qs[_0xc6e9('0x49')](_0x154348[_0xc6e9('0x41')][_0xc6e9('0x49')]);_0x183dd0[_0xc6e9('0x2b')]=qs[_0xc6e9('0x2b')](_0x154348[_0xc6e9('0x41')][_0xc6e9('0x2b')]);}_0x183dd0['order']=qs['sort'](_0x154348[_0xc6e9('0x41')][_0xc6e9('0x4a')]);_0x183dd0[_0xc6e9('0x4d')]=qs[_0xc6e9('0x43')](_[_0xc6e9('0x4b')](_0x154348[_0xc6e9('0x41')],_0x28919f[_0xc6e9('0x43')]));_0x183dd0[_0xc6e9('0x4d')]['WhatsappAccountId']=_0x377cdd['id'];if(_0x154348[_0xc6e9('0x41')][_0xc6e9('0x4c')]){_0x183dd0[_0xc6e9('0x4d')]=_[_0xc6e9('0x4e')](_0x183dd0[_0xc6e9('0x4d')],{'$or':_['map'](_0x183dd0[_0xc6e9('0x44')],function(_0xcf1d7b){var _0x59fef0={};_0x59fef0[_0xcf1d7b]={'$like':'%'+_0x154348[_0xc6e9('0x41')][_0xc6e9('0x4c')]+'%'};return _0x59fef0;})});}_0x183dd0=_[_0xc6e9('0x4e')]({},_0x183dd0,_0x154348[_0xc6e9('0x50')]);return db[_0xc6e9('0x6a')][_0xc6e9('0x2d')]({'where':_0x183dd0['where']})['then'](function(_0x3bb84f){_0x54714c['count']=_0x3bb84f;if(_0x154348[_0xc6e9('0x41')][_0xc6e9('0x51')]){_0x183dd0[_0xc6e9('0x52')]=[{'all':!![]}];}return db[_0xc6e9('0x6a')][_0xc6e9('0x53')](_0x183dd0);})['then'](function(_0x5b266b){_0x54714c[_0xc6e9('0x6b')]=_0x5b266b;return _0x54714c;});}})[_0xc6e9('0x1f')](respondWithFilteredResult(_0x18c222,_0x183dd0))['catch'](handleError(_0x18c222,null));};exports['removeAnswers']=function(_0x43fa4b,_0x321b62,_0x5a84dd){return db[_0xc6e9('0x3b')]['find']({'where':{'id':_0x43fa4b[_0xc6e9('0x62')]['id']}})[_0xc6e9('0x1f')](handleEntityNotFound(_0x321b62,null))['then'](function(_0x4edbaf){if(_0x4edbaf){return _0x4edbaf['removeAnswers'](_0x43fa4b[_0xc6e9('0x41')][_0xc6e9('0x68')]);}})[_0xc6e9('0x1f')](respondWithStatusCode(_0x321b62,null))[_0xc6e9('0x54')](handleError(_0x321b62,null));};exports[_0xc6e9('0x6c')]=function(_0x551df1,_0x15bcf2,_0x3b76c1){return db['WhatsappAccount'][_0xc6e9('0x57')]({'where':{'id':_0x551df1[_0xc6e9('0x62')]['id']}})[_0xc6e9('0x1f')](handleEntityNotFound(_0x15bcf2,null))[_0xc6e9('0x1f')](function(_0x54a47f){if(_0x54a47f){return _0x54a47f[_0xc6e9('0x6c')](_0x551df1['body'][_0xc6e9('0x68')],_[_0xc6e9('0x6d')](_0x551df1[_0xc6e9('0x59')],[_0xc6e9('0x68'),'id'])||{})['spread'](function(_0x420fa1){for(var _0x24fc91=0x0;_0x24fc91<_0x551df1[_0xc6e9('0x59')][_0xc6e9('0x68')][_0xc6e9('0x47')];_0x24fc91+=0x1){socket[_0xc6e9('0x6e')]('userWhatsappAccount:save',{'UserId':Number(_0x551df1[_0xc6e9('0x59')]['ids'][_0x24fc91]),'WhatsappAccountId':Number(_0x551df1[_0xc6e9('0x62')]['id'])});}return _0x420fa1;});}})['then'](respondWithResult(_0x15bcf2,null))[_0xc6e9('0x54')](handleError(_0x15bcf2,null));};exports[_0xc6e9('0x6f')]=function(_0x1029de,_0x14a557,_0x2d6be0){return db[_0xc6e9('0x3b')]['find']({'where':{'id':_0x1029de[_0xc6e9('0x62')]['id']}})[_0xc6e9('0x1f')](handleEntityNotFound(_0x14a557,null))['then'](function(_0x291c15){if(_0x291c15){return _0x291c15[_0xc6e9('0x6f')](_0x1029de[_0xc6e9('0x41')]['ids'])[_0xc6e9('0x1f')](function(){if(_[_0xc6e9('0x70')](_0x1029de['query'][_0xc6e9('0x68')])){for(var _0x125be1=0x0;_0x125be1<_0x1029de[_0xc6e9('0x41')][_0xc6e9('0x68')][_0xc6e9('0x47')];_0x125be1+=0x1){socket[_0xc6e9('0x6e')](_0xc6e9('0x71'),{'UserId':Number(_0x1029de[_0xc6e9('0x41')][_0xc6e9('0x68')][_0x125be1]),'WhatsappAccountId':Number(_0x1029de[_0xc6e9('0x62')]['id'])});}}else{socket['emit'](_0xc6e9('0x71'),{'UserId':Number(_0x1029de['query'][_0xc6e9('0x68')]),'WhatsappAccountId':Number(_0x1029de[_0xc6e9('0x62')]['id'])});}});}})['then'](respondWithStatusCode(_0x14a557,null))[_0xc6e9('0x54')](handleError(_0x14a557,null));};exports[_0xc6e9('0x72')]=function(_0xdbb2bf,_0x462856,_0x409a21){var _0x4ba435={};var _0x35f560={};var _0x8a1abf;var _0x44abc5;return db[_0xc6e9('0x3b')]['findOne']({'where':{'id':_0xdbb2bf[_0xc6e9('0x62')]['id']}})['then'](handleEntityNotFound(_0x462856,null))['then'](function(_0x4c01bf){if(_0x4c01bf){_0x8a1abf=_0x4c01bf;_0x35f560[_0xc6e9('0x40')]=_[_0xc6e9('0x42')](db['User'][_0xc6e9('0x3c')]);_0x35f560[_0xc6e9('0x41')]=_[_0xc6e9('0x42')](_0xdbb2bf[_0xc6e9('0x41')]);_0x35f560[_0xc6e9('0x43')]=_['intersection'](_0x35f560[_0xc6e9('0x40')],_0x35f560['query']);_0x4ba435[_0xc6e9('0x44')]=_[_0xc6e9('0x45')](_0x35f560[_0xc6e9('0x40')],qs[_0xc6e9('0x46')](_0xdbb2bf['query'][_0xc6e9('0x46')]));_0x4ba435['attributes']=_0x4ba435[_0xc6e9('0x44')][_0xc6e9('0x47')]?_0x4ba435[_0xc6e9('0x44')]:_0x35f560[_0xc6e9('0x40')];_0x4ba435[_0xc6e9('0x73')]=qs[_0xc6e9('0x4a')](_0xdbb2bf[_0xc6e9('0x41')]['sort']);_0x4ba435[_0xc6e9('0x4d')]=qs[_0xc6e9('0x43')](_['pick'](_0xdbb2bf[_0xc6e9('0x41')],_0x35f560[_0xc6e9('0x43')]));if(_0xdbb2bf[_0xc6e9('0x41')]['filter']){_0x4ba435[_0xc6e9('0x4d')]=_[_0xc6e9('0x4e')](_0x4ba435[_0xc6e9('0x4d')],{'$or':_['map'](_0x4ba435[_0xc6e9('0x44')],function(_0x4d6302){var _0x2dc00e={};_0x2dc00e[_0x4d6302]={'$like':'%'+_0xdbb2bf[_0xc6e9('0x41')]['filter']+'%'};return _0x2dc00e;})});}_0x4ba435=_[_0xc6e9('0x4e')]({},_0x4ba435,_0xdbb2bf[_0xc6e9('0x50')]);return _0x8a1abf[_0xc6e9('0x72')](_0x4ba435);}})[_0xc6e9('0x1f')](function(_0x57219d){if(_0x57219d){_0x44abc5=_0x57219d[_0xc6e9('0x47')];if(!_0xdbb2bf[_0xc6e9('0x41')][_0xc6e9('0x48')](_0xc6e9('0x65'))){_0x4ba435[_0xc6e9('0x49')]=qs[_0xc6e9('0x49')](_0xdbb2bf[_0xc6e9('0x41')][_0xc6e9('0x49')]);_0x4ba435['offset']=qs[_0xc6e9('0x2b')](_0xdbb2bf[_0xc6e9('0x41')][_0xc6e9('0x2b')]);}return _0x8a1abf[_0xc6e9('0x72')](_0x4ba435);}})[_0xc6e9('0x1f')](function(_0x2629b1){if(_0x2629b1){return _0x2629b1?{'count':_0x44abc5,'rows':_0x2629b1}:null;}})[_0xc6e9('0x1f')](respondWithResult(_0x462856,null))['catch'](handleError(_0x462856,null));};exports[_0xc6e9('0x74')]=function(_0x59818f,_0x35c91a){var _0x1cf773=_0x59818f[_0xc6e9('0x62')]['id'];var _0x44acf9=_0x59818f['body'];var _0x13d0ea=0xc8;var _0x45d786=null;return db[_0xc6e9('0x75')][_0xc6e9('0x76')]({'isolationLevel':db[_0xc6e9('0x75')][_0xc6e9('0x77')][_0xc6e9('0x78')][_0xc6e9('0x79')]},function(_0x125e4c){return db[_0xc6e9('0x3b')][_0xc6e9('0x64')]({'where':{'id':_0x1cf773},'transaction':_0x125e4c})['then'](function(_0x1a96df){if(_0x1a96df){return db['WhatsappApplication'][_0xc6e9('0x32')]({'where':{'WhatsappAccountId':_0x1cf773},'transaction':_0x125e4c})[_0xc6e9('0x1f')](function(){var _0x197d15=_['map'](_0x44acf9,function(_0x1d113f){_0x1d113f[_0xc6e9('0x66')]=_0x1cf773;return _0x1d113f;});return db['WhatsappApplication'][_0xc6e9('0x7a')](_0x197d15,{'transaction':_0x125e4c});});}else{_0x13d0ea=0x194;_0x45d786=[];}});})['then'](function(){if(_0x13d0ea!==0x194){return db[_0xc6e9('0x7b')][_0xc6e9('0x7c')]({'where':{'WhatsappAccountId':_0x1cf773},'order':_0xc6e9('0x7d')})[_0xc6e9('0x1f')](function(_0x10e46c){_0x45d786=_0x10e46c;});}})[_0xc6e9('0x54')](function(_0x4d2adb){_0x13d0ea=0x1f4;logger[_0xc6e9('0x24')](_0x4d2adb[_0xc6e9('0x7e')]);if(_0x4d2adb[_0xc6e9('0x36')]){delete _0x4d2adb['name'];}_0x45d786=_0x4d2adb;})[_0xc6e9('0x7f')](function(){if(_0x45d786===null){_0x35c91a[_0xc6e9('0x27')](_0x13d0ea);}else{if(_0x13d0ea===0x1f4){_0x35c91a['status'](_0x13d0ea)['send'](_0x45d786);}else{_0x35c91a[_0xc6e9('0x29')](_0x13d0ea)['json'](_0x45d786);}}});};exports[_0xc6e9('0x80')]=function(_0x29013a,_0x212fab,_0xa3154f){var _0x13eab1={};var _0x4ce093={};var _0x3f9c35;var _0x517457;return db[_0xc6e9('0x3b')][_0xc6e9('0x64')]({'where':{'id':_0x29013a[_0xc6e9('0x62')]['id']}})[_0xc6e9('0x1f')](handleEntityNotFound(_0x212fab,null))[_0xc6e9('0x1f')](function(_0x1c091c){if(_0x1c091c){_0x3f9c35=_0x1c091c;_0x4ce093[_0xc6e9('0x40')]=_[_0xc6e9('0x42')](db[_0xc6e9('0x7b')][_0xc6e9('0x3c')]);_0x4ce093[_0xc6e9('0x41')]=_[_0xc6e9('0x42')](_0x29013a[_0xc6e9('0x41')]);_0x4ce093[_0xc6e9('0x43')]=_['intersection'](_0x4ce093[_0xc6e9('0x40')],_0x4ce093['query']);_0x13eab1['attributes']=_['intersection'](_0x4ce093['model'],qs[_0xc6e9('0x46')](_0x29013a[_0xc6e9('0x41')][_0xc6e9('0x46')]));_0x13eab1['attributes']=_0x13eab1[_0xc6e9('0x44')][_0xc6e9('0x47')]?_0x13eab1[_0xc6e9('0x44')]:_0x4ce093['model'];_0x13eab1['order']=qs[_0xc6e9('0x4a')](_0x29013a[_0xc6e9('0x41')][_0xc6e9('0x4a')]);_0x13eab1[_0xc6e9('0x4d')]=qs[_0xc6e9('0x43')](_['pick'](_0x29013a[_0xc6e9('0x41')],_0x4ce093['filters']));if(_0x29013a[_0xc6e9('0x41')]['filter']){_0x13eab1['where']=_[_0xc6e9('0x4e')](_0x13eab1[_0xc6e9('0x4d')],{'$or':_[_0xc6e9('0x3a')](_0x13eab1[_0xc6e9('0x44')],function(_0x54a8ce){var _0x4f6d5b={};_0x4f6d5b[_0x54a8ce]={'$like':'%'+_0x29013a[_0xc6e9('0x41')]['filter']+'%'};return _0x4f6d5b;})});}_0x13eab1=_[_0xc6e9('0x4e')]({},_0x13eab1,_0x29013a[_0xc6e9('0x50')]);return _0x3f9c35[_0xc6e9('0x80')](_0x13eab1);}})[_0xc6e9('0x1f')](function(_0x221456){if(_0x221456){_0x517457=_0x221456[_0xc6e9('0x47')];if(!_0x29013a[_0xc6e9('0x41')][_0xc6e9('0x48')](_0xc6e9('0x65'))){_0x13eab1[_0xc6e9('0x49')]=qs[_0xc6e9('0x49')](_0x29013a[_0xc6e9('0x41')][_0xc6e9('0x49')]);_0x13eab1[_0xc6e9('0x2b')]=qs[_0xc6e9('0x2b')](_0x29013a[_0xc6e9('0x41')][_0xc6e9('0x2b')]);}return _0x3f9c35[_0xc6e9('0x80')](_0x13eab1);}})[_0xc6e9('0x1f')](function(_0x5437b7){if(_0x5437b7){return _0x5437b7?{'count':_0x517457,'rows':_0x5437b7}:null;}})['then'](respondWithResult(_0x212fab,null))['catch'](handleError(_0x212fab,null));};exports[_0xc6e9('0x81')]=function(_0x1b6892,_0xcc44aa,_0x437e09){var _0x3e23b5={'channel':_0xc6e9('0x82')};var _0x446ff2=[];var _0x3a05a6=[];var _0x209164={};return db['WhatsappAccount'][_0xc6e9('0x57')]({'where':{'id':_0x1b6892[_0xc6e9('0x62')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0xc6e9('0x1f')](handleEntityNotFound(_0xcc44aa,null))[_0xc6e9('0x1f')](function(_0x5494e1){_0x3e23b5[_0xc6e9('0x83')]=_0x5494e1;if(_0x3e23b5[_0xc6e9('0x83')]&&_0x3e23b5[_0xc6e9('0x83')][_0xc6e9('0x3e')]===_0xc6e9('0x84')&&_0x1b6892[_0xc6e9('0x59')]['statuses']){if(_0x1b6892['body'][_0xc6e9('0x85')][_0xc6e9('0x47')]===0x0)return;if(_0x1b6892[_0xc6e9('0x59')][_0xc6e9('0x85')][0x0][_0xc6e9('0x86')]!==_0xc6e9('0x87'))return;return db[_0xc6e9('0x88')][_0xc6e9('0x31')]({'read':!![],'readAt':_0x1b6892[_0xc6e9('0x59')][_0xc6e9('0x85')][0x0][_0xc6e9('0x89')]},{'where':{'messageId':_0x1b6892[_0xc6e9('0x59')][_0xc6e9('0x85')][0x0]['message_id']},'individualHooks':!![]})[_0xc6e9('0x1f')](function(_0x217b57){return _0xcc44aa['status'](0xc8)[_0xc6e9('0x2a')](_0x217b57);});}_0x3e23b5['applications']=_[_0xc6e9('0x8a')](_0x5494e1[_0xc6e9('0x8b')],['priority'],[_0xc6e9('0x8c')]);if(_0x3e23b5['account'][_0xc6e9('0x8b')]){delete _0x3e23b5[_0xc6e9('0x83')][_0xc6e9('0x8b')];}return db[_0xc6e9('0x8d')]['describe']()[_0xc6e9('0x1f')](function(_0x389a96){if(!_0x389a96){throw new db[(_0xc6e9('0x8e'))][(_0xc6e9('0x8f'))](_0xc6e9('0x90'));}_0x446ff2=_['difference'](_[_0xc6e9('0x42')](_0x389a96),['createdAt',_0xc6e9('0x91')]);_0x3a05a6=_[_0xc6e9('0x92')](_[_0xc6e9('0x42')](_0x389a96),[_0xc6e9('0x93'),_0xc6e9('0x91'),'CompanyId',_0xc6e9('0x94')]);_0x3e23b5[_0xc6e9('0x59')]={'mapKey':_0xc6e9('0x95')};if(_0x3e23b5[_0xc6e9('0x83')]&&_0x3e23b5[_0xc6e9('0x83')][_0xc6e9('0x3e')]==='twilio'){_0x3e23b5[_0xc6e9('0x59')]['from']=_0x1b6892['body'][_0xc6e9('0x96')][_0xc6e9('0x97')](_0xc6e9('0x98'),'');_0x3e23b5[_0xc6e9('0x59')][_0xc6e9('0x59')]=_0x1b6892[_0xc6e9('0x59')][_0xc6e9('0x99')];_0x3e23b5[_0xc6e9('0x59')]['messageId']=_0x1b6892[_0xc6e9('0x59')][_0xc6e9('0x9a')];}if(_0x3e23b5[_0xc6e9('0x83')]&&_0x3e23b5['account'][_0xc6e9('0x3e')]==='sinch'){_0x3e23b5['body'][_0xc6e9('0x9b')]=_0x1b6892[_0xc6e9('0x59')]['notifications'][0x0][_0xc6e9('0x9b')];_0x3e23b5[_0xc6e9('0x59')][_0xc6e9('0x59')]=_0x1b6892['body']['notifications'][0x0][_0xc6e9('0x25')][_0xc6e9('0x59')];_0x3e23b5[_0xc6e9('0x59')][_0xc6e9('0x9c')]=_0x1b6892[_0xc6e9('0x59')][_0xc6e9('0x9d')][0x0][_0xc6e9('0x9e')];}if(_0x3e23b5[_0xc6e9('0x59')]['id']){delete _0x3e23b5[_0xc6e9('0x59')]['id'];}if(_[_0xc6e9('0x9f')](_0x3e23b5[_0xc6e9('0x59')][_0xc6e9('0x9b')])){throw new db['Sequelize']['ValidationError'](_0xc6e9('0xa0'));}if(_['isNil'](_0x3e23b5[_0xc6e9('0x59')][_0xc6e9('0x59')])||_0x3e23b5[_0xc6e9('0x59')][_0xc6e9('0x59')]===''){throw new db[(_0xc6e9('0x8e'))][(_0xc6e9('0x8f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc6e9('0x9f')](_0x3e23b5[_0xc6e9('0x59')]['mapKey'])){throw new db[(_0xc6e9('0x8e'))][(_0xc6e9('0x8f'))](_0xc6e9('0xa1')+_0x3a05a6);}if(!_[_0xc6e9('0xa2')](_0x3a05a6,_0x3e23b5[_0xc6e9('0x59')][_0xc6e9('0xa3')])){throw new db[(_0xc6e9('0x8e'))][(_0xc6e9('0x8f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3a05a6);}_0x209164[_0x3e23b5['body']['mapKey']]=_0x3e23b5[_0xc6e9('0x59')][_0xc6e9('0x9b')];return db['CmList'][_0xc6e9('0x57')]({'where':{'id':_0x3e23b5[_0xc6e9('0x83')][_0xc6e9('0x94')]},'include':[{'model':db['CmContact'],'as':_0xc6e9('0xa4'),'where':_0x209164,'limit':0x1,'order':[[_0xc6e9('0x91'),_0xc6e9('0xa5')]]}]});})[_0xc6e9('0x1f')](handleEntityNotFound(_0xcc44aa,null))['then'](function(_0x58e778){if(_0x58e778){_0x3e23b5[_0xc6e9('0xa6')]=_[_0xc6e9('0x6d')](_0x58e778,[_0xc6e9('0xa4')]);if(_0x58e778[_0xc6e9('0xa4')]['length']){return _0x58e778['Contacts'][0x0];}var _0x1a5175=_[_0xc6e9('0x18')](_0x3e23b5[_0xc6e9('0x59')],{'firstName':_0x3e23b5['body'][_0xc6e9('0x9b')],'ListId':_0x58e778['id']});_0x1a5175[_0x3e23b5['body'][_0xc6e9('0xa3')]]=_0x3e23b5['body'][_0xc6e9('0x9b')];return db[_0xc6e9('0x8d')][_0xc6e9('0x58')](_0x1a5175,{'fields':_0x446ff2,'raw':!![]});}})[_0xc6e9('0x1f')](handleEntityNotFound(_0xcc44aa,null))[_0xc6e9('0x1f')](function(_0x11c84f){if(_0x11c84f){_0x3e23b5[_0xc6e9('0xa7')]=_0x11c84f;var _0x111420={'ContactId':_0x11c84f['id'],'phone':_0x3e23b5[_0xc6e9('0x59')][_0xc6e9('0x9b')],'WhatsappAccountId':_0x1b6892['params']['id']};var _0x39b1da={'ContactId':_0x11c84f['id'],'WhatsappAccountId':_0x1b6892[_0xc6e9('0x62')]['id'],'closed':![]};return db[_0xc6e9('0xa8')][_0xc6e9('0x57')]({'where':_0x39b1da})[_0xc6e9('0x1f')](function(_0x4797c5){if(_0x4797c5){return[_0x4797c5,![]];}return db[_0xc6e9('0xa8')][_0xc6e9('0x58')](_0x111420)[_0xc6e9('0x1f')](function(_0x3a891a){return[_0x3a891a,!![]];});});}})[_0xc6e9('0xa9')](function(_0x1220a5,_0x265ffe){_0x3e23b5[_0xc6e9('0xaa')]=_0x1220a5['get']({'plain':!![]});_0x3e23b5[_0xc6e9('0xaa')][_0xc6e9('0xab')]=![];if(_0x265ffe){if(_0x3e23b5[_0xc6e9('0x83')][_0xc6e9('0xac')]){_0x3e23b5['applications'][_0xc6e9('0xad')]({'id':0x0,'priority':_0x3e23b5[_0xc6e9('0xae')][_0xc6e9('0x47')]+0x1,'app':_0xc6e9('0xaf'),'appdata':_0xc6e9('0xb0'),'interval':_0xc6e9('0xb1')});}_0x3e23b5[_0xc6e9('0xaa')]['created']=!![];}return db[_0xc6e9('0x88')][_0xc6e9('0x58')]({'phone':_0x3e23b5[_0xc6e9('0x59')]['from'],'messageId':_0x3e23b5[_0xc6e9('0x59')][_0xc6e9('0x9c')],'body':_0x3e23b5['body'][_0xc6e9('0x59')],'WhatsappAccountId':_0x1b6892[_0xc6e9('0x62')]['id'],'WhatsappInteractionId':_0x1220a5['id'],'direction':'in','ContactId':_0x1220a5[_0xc6e9('0xb2')],'AttachmentId':_0x3e23b5[_0xc6e9('0x59')][_0xc6e9('0xb3')]});})['then'](function(_0x4fd31a){_0x3e23b5[_0xc6e9('0x25')]=_0x4fd31a;if(!_0x3e23b5[_0xc6e9('0xaa')]['UserId'])return;return db[_0xc6e9('0xb4')][_0xc6e9('0x57')]({'attributes':['id',_0xc6e9('0x36')],'where':{'id':_0x3e23b5[_0xc6e9('0xaa')][_0xc6e9('0xb5')]}});})['then'](function(_0x4d5a27){if(_0x4d5a27){_0x3e23b5[_0xc6e9('0xae')][_0xc6e9('0xb6')]({'id':0x0,'priority':0x0,'app':_0xc6e9('0xb7'),'appdata':_0x4d5a27[_0xc6e9('0x36')]+','+(_0x3e23b5[_0xc6e9('0x83')][_0xc6e9('0xb8')]||0xa),'interval':_0xc6e9('0xb1')});}if(!_0x3e23b5[_0xc6e9('0xaa')][_0xc6e9('0xb9')])return;return db[_0xc6e9('0xba')][_0xc6e9('0x57')]({'attributes':['id',_0xc6e9('0x36')],'where':{'id':_0x3e23b5[_0xc6e9('0xaa')][_0xc6e9('0xb9')]}});})['then'](function(_0x12e34d){if(_0x12e34d){_0x3e23b5[_0xc6e9('0xae')][_0xc6e9('0xb6')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x12e34d[_0xc6e9('0x36')]+','+(_0x3e23b5[_0xc6e9('0x83')][_0xc6e9('0xbb')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xc6e9('0xbc'),_0xc6e9('0xbd'),_0x3e23b5);})[_0xc6e9('0x1f')](function(_0x4da538){if(_0x4da538){var _0x3579b4=0xc8;var _0x3b6ece=_0xc6e9('0xbe');logger[_0xc6e9('0x20')](_0xc6e9('0x23'),_0x3b6ece,_0x3579b4,_0xc6e9('0xbf'));logger['debug'](_0xc6e9('0xc0'),_0x3b6ece,_0x3579b4,_0xc6e9('0xbf'),JSON['stringify'](_0x4da538));if(_0x3e23b5[_0xc6e9('0x83')][_0xc6e9('0x3e')]===_0xc6e9('0xc1')){return _0xcc44aa[_0xc6e9('0x29')](_0x3579b4)[_0xc6e9('0x2e')](_0xc6e9('0xc2'),_0xc6e9('0xc3'))[_0xc6e9('0x37')](_0xc6e9('0xc4'));}else{return _0xcc44aa[_0xc6e9('0x29')](_0x3579b4)[_0xc6e9('0x2a')](_0x4da538);}}});})[_0xc6e9('0x54')](handleError(_0xcc44aa,null));};exports[_0xc6e9('0x37')]=function(_0x14a409,_0x201579,_0x36ccea){var _0x4f1283,_0x4d30bd,_0x5600d2;if(_[_0xc6e9('0x9f')](_0x14a409[_0xc6e9('0x59')]['body'])||_0x14a409[_0xc6e9('0x59')][_0xc6e9('0x59')]===''){throw new db['Sequelize'][(_0xc6e9('0x8f'))](_0xc6e9('0xc5'));}if(_[_0xc6e9('0x9f')](_0x14a409[_0xc6e9('0x59')]['to'])){throw new db['Sequelize'][(_0xc6e9('0x8f'))](_0xc6e9('0xc6'));}_0x4f1283=_0x14a409['body']['to'];return db[_0xc6e9('0x3b')]['find']({'where':{'id':_0x14a409[_0xc6e9('0x62')]['id']},'include':[{'model':db[_0xc6e9('0xc7')],'as':'List','include':[{'model':db['CmContact'],'as':_0xc6e9('0xa4'),'where':{'mobile':_0x4f1283},'limit':0x1,'order':[[_0xc6e9('0x91'),_0xc6e9('0xa5')]]}]}]})['then'](handleEntityNotFound(_0x201579,null))[_0xc6e9('0x1f')](function(_0x2e6ba8){if(_0x2e6ba8&&_0x2e6ba8['List']){_0x4d30bd=_0x2e6ba8['get']({'plain':!![]});if(_0x4d30bd[_0xc6e9('0xc8')]&&_0x4d30bd[_0xc6e9('0xc8')][_0xc6e9('0xa4')]['length']){return _0x4d30bd['List'][_0xc6e9('0xa4')][0x0];}return db['CmContact'][_0xc6e9('0x58')](_[_0xc6e9('0x18')](_0x14a409[_0xc6e9('0x59')],{'firstName':_0x4f1283,'mobile':_0x4f1283,'phone':_0x4f1283,'ListId':_0x4d30bd['ListId']}));}})[_0xc6e9('0x1f')](handleEntityNotFound(_0x201579,null))[_0xc6e9('0x1f')](function(_0x5d462e){if(_0x5d462e){_0x5600d2=_0x5d462e;return db[_0xc6e9('0xa8')][_0xc6e9('0x57')]({'where':{'ContactId':_0x5600d2['id'],'closed':![],'WhatsappAccountId':_0x4d30bd['id']}})[_0xc6e9('0x1f')](function(_0x10bf51){if(_0x10bf51){return[_0x10bf51,![]];}return db[_0xc6e9('0xa8')]['create']({'UserId':_0x14a409[_0xc6e9('0x5b')]['id'],'ContactId':_0x5600d2['id'],'WhatsappAccountId':_0x4d30bd['id'],'phone':_0x4f1283,'firstMsgDirection':'out','Messages':[_['merge'](_0x14a409[_0xc6e9('0x59')],{'read':![],'body':_0x14a409[_0xc6e9('0x59')]['body'],'phone':_0x4f1283,'WhatsappAccountId':_0x4d30bd['id'],'UserId':_0x14a409[_0xc6e9('0x5b')]['id'],'ContactId':_0x5600d2['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xc6e9('0xc9')}]})['then'](function(_0x184c9b){return[_0x184c9b,!![]];});});}})[_0xc6e9('0xa9')](function(_0x2b8490,_0x277149){if(_0x277149){return _0x2b8490;}return db[_0xc6e9('0x88')]['create'](_[_0xc6e9('0x4e')](_0x14a409[_0xc6e9('0x59')],{'read':![],'body':_0x14a409[_0xc6e9('0x59')][_0xc6e9('0x59')],'phone':_0x4f1283,'WhatsappAccountId':_0x4d30bd['id'],'WhatsappInteractionId':_0x2b8490['id'],'UserId':_0x14a409[_0xc6e9('0x5b')]['id'],'ContactId':_0x5600d2['id']}))[_0xc6e9('0x1f')](function(_0x17b6e7){_0x2b8490[_0xc6e9('0xca')][_0xc6e9('0xc9')]=[];_0x2b8490[_0xc6e9('0xca')][_0xc6e9('0xc9')]['push'](_0x17b6e7[_0xc6e9('0xca')]);return _0x2b8490;});})['then'](respondWithResult(_0x201579,null))[_0xc6e9('0x54')](handleError(_0x201579,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index ebeb482..bf08fd0 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 _0x339e=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events','WhatsappAccount'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0x339e,0x146));var _0xe339=function(_0x3a21c0,_0x348451){_0x3a21c0=_0x3a21c0-0x0;var _0x411e84=_0x339e[_0x3a21c0];return _0x411e84;};'use strict';var EventEmitter=require(_0xe339('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0xe339('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xe339('0x2')](0x0);var events={'afterCreate':_0xe339('0x3'),'afterUpdate':_0xe339('0x4'),'afterDestroy':_0xe339('0x5')};function emitEvent(_0x2beae3){return function(_0x60a7a0,_0x125e2c,_0x5abcbb){WhatsappAccountEvents[_0xe339('0x6')](_0x2beae3+':'+_0x60a7a0['id'],_0x60a7a0);WhatsappAccountEvents[_0xe339('0x6')](_0x2beae3,_0x60a7a0);_0x5abcbb(null);};}for(var e in events){if(events[_0xe339('0x7')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xcbc5=['events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1c02de,_0x421e46){var _0x42a55f=function(_0x26fb96){while(--_0x26fb96){_0x1c02de['push'](_0x1c02de['shift']());}};_0x42a55f(++_0x421e46);}(_0xcbc5,0x160));var _0x5cbc=function(_0x23e8ee,_0x259afd){_0x23e8ee=_0x23e8ee-0x0;var _0x952c2=_0xcbc5[_0x23e8ee];return _0x952c2;};'use strict';var EventEmitter=require(_0x5cbc('0x0'));var WhatsappAccount=require(_0x5cbc('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5cbc('0x2'),'afterUpdate':_0x5cbc('0x3'),'afterDestroy':_0x5cbc('0x4')};function emitEvent(_0x2cc5ed){return function(_0x432183,_0xa5a447,_0x3ce1be){WhatsappAccountEvents[_0x5cbc('0x5')](_0x2cc5ed+':'+_0x432183['id'],_0x432183);WhatsappAccountEvents[_0x5cbc('0x5')](_0x2cc5ed,_0x432183);_0x3ce1be(null);};}for(var e in events){if(events[_0x5cbc('0x6')](e)){var event=events[e];WhatsappAccount[_0x5cbc('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index a728b7e..b47a802 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 _0xa711=['define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./whatsappAccount.attributes','exports'];(function(_0x1c3e05,_0x3feafe){var _0x19d0d9=function(_0x1603b3){while(--_0x1603b3){_0x1c3e05['push'](_0x1c3e05['shift']());}};_0x19d0d9(++_0x3feafe);}(_0xa711,0x9f));var _0x1a71=function(_0x563020,_0x3e4175){_0x563020=_0x563020-0x0;var _0x1adfce=_0xa711[_0x563020];return _0x1adfce;};'use strict';var _=require(_0x1a71('0x0'));var util=require(_0x1a71('0x1'));var logger=require(_0x1a71('0x2'))(_0x1a71('0x3'));var moment=require(_0x1a71('0x4'));var BPromise=require(_0x1a71('0x5'));var rp=require(_0x1a71('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1a71('0x7'));var config=require('../../config/environment');var attributes=require(_0x1a71('0x8'));module[_0x1a71('0x9')]=function(_0x52112b,_0x1c0b70){return _0x52112b[_0x1a71('0xa')](_0x1a71('0xb'),attributes,{'tableName':_0x1a71('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd837=['util','../../config/logger','api','moment','bluebird','path','rimraf','./whatsappAccount.attributes','exports'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xd837,0x120));var _0x7d83=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0xd837[_0x2ec2bf];return _0x2c279c;};'use strict';var _=require('lodash');var util=require(_0x7d83('0x0'));var logger=require(_0x7d83('0x1'))(_0x7d83('0x2'));var moment=require(_0x7d83('0x3'));var BPromise=require(_0x7d83('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d83('0x5'));var rimraf=require(_0x7d83('0x6'));var config=require('../../config/environment');var attributes=require(_0x7d83('0x7'));module[_0x7d83('0x8')]=function(_0x7405be,_0xf42ab5){return _0x7405be['define']('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 331003c..bab4044 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 _0x4b17=['moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','request\x20sent','stringify','error','message','WhatsappAccount,\x20%s,\x20%s','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','map','include','model','debug','catch','lodash'];(function(_0x718f1f,_0x2e2338){var _0x48b289=function(_0x524e31){while(--_0x524e31){_0x718f1f['push'](_0x718f1f['shift']());}};_0x48b289(++_0x2e2338);}(_0x4b17,0x10f));var _0x74b1=function(_0xd2e2ab,_0x2440cf){_0xd2e2ab=_0xd2e2ab-0x0;var _0x1703a2=_0x4b17[_0xd2e2ab];return _0x1703a2;};'use strict';var _=require(_0x74b1('0x0'));var util=require('util');var moment=require(_0x74b1('0x1'));var BPromise=require('bluebird');var rs=require(_0x74b1('0x2'));var fs=require('fs');var Redis=require(_0x74b1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x74b1('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x74b1('0x5'));var jayson=require(_0x74b1('0x6'));var client=jayson[_0x74b1('0x7')][_0x74b1('0x8')]({'port':0x232a});config[_0x74b1('0x9')]=_[_0x74b1('0xa')](config[_0x74b1('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x74b1('0xb'))(new Redis(config[_0x74b1('0x9')]));require(_0x74b1('0xc'))[_0x74b1('0xd')](socket);function respondWithRpcPromise(_0xc1952,_0x4eab15,_0x33f4bf){return new BPromise(function(_0x20bd4c,_0x57f3ad){return client[_0x74b1('0xe')](_0xc1952,_0x33f4bf)[_0x74b1('0xf')](function(_0x6434fd){logger[_0x74b1('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x4eab15,_0x74b1('0x11'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4eab15,_0x74b1('0x11'),JSON[_0x74b1('0x12')](_0x6434fd));if(_0x6434fd['error']){if(_0x6434fd['error']['code']===0x1f4){logger[_0x74b1('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x4eab15,_0x6434fd['error'][_0x74b1('0x14')]);return _0x57f3ad(_0x6434fd[_0x74b1('0x13')][_0x74b1('0x14')]);}logger[_0x74b1('0x13')](_0x74b1('0x15'),_0x4eab15,_0x6434fd[_0x74b1('0x13')]['message']);return _0x20bd4c(_0x6434fd[_0x74b1('0x13')][_0x74b1('0x14')]);}else{logger[_0x74b1('0x10')](_0x74b1('0x15'),_0x4eab15,_0x74b1('0x11'));_0x20bd4c(_0x6434fd[_0x74b1('0x16')][_0x74b1('0x14')]);}})['catch'](function(_0xd50f0){logger[_0x74b1('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x4eab15,_0xd50f0);_0x57f3ad(_0xd50f0);});});}exports[_0x74b1('0x17')]=function(_0x38d932){var _0x39f261=this;return new Promise(function(_0x25704e,_0x13bb44){return db[_0x74b1('0x18')][_0x74b1('0x19')]({'raw':_0x38d932[_0x74b1('0x1a')]?_0x38d932['options'][_0x74b1('0x1b')]===undefined?!![]:![]:!![],'where':_0x38d932['options']?_0x38d932['options']['where']||null:null,'attributes':_0x38d932[_0x74b1('0x1a')]?_0x38d932[_0x74b1('0x1a')][_0x74b1('0x1c')]||null:null,'include':_0x38d932[_0x74b1('0x1a')]?_0x38d932[_0x74b1('0x1a')]['include']?_[_0x74b1('0x1d')](_0x38d932['options'][_0x74b1('0x1e')],function(_0x4376c7){return{'model':db[_0x4376c7[_0x74b1('0x1f')]],'as':_0x4376c7['as'],'attributes':_0x4376c7[_0x74b1('0x1c')],'include':_0x4376c7[_0x74b1('0x1e')]?_[_0x74b1('0x1d')](_0x4376c7[_0x74b1('0x1e')],function(_0x33fa8e){return{'model':db[_0x33fa8e['model']],'as':_0x33fa8e['as'],'attributes':_0x33fa8e[_0x74b1('0x1c')],'include':_0x33fa8e[_0x74b1('0x1e')]?_[_0x74b1('0x1d')](_0x33fa8e['include'],function(_0x1998cd){return{'model':db[_0x1998cd[_0x74b1('0x1f')]],'as':_0x1998cd['as'],'attributes':_0x1998cd[_0x74b1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x74b1('0xf')](function(_0x26d9f1){logger[_0x74b1('0x10')](_0x74b1('0x17'),_0x38d932);logger[_0x74b1('0x20')]('ShowWhatsappAccount',_0x38d932,JSON[_0x74b1('0x12')](_0x26d9f1));_0x25704e(_0x26d9f1);})[_0x74b1('0x21')](function(_0x51ce6d){logger[_0x74b1('0x13')](_0x74b1('0x17'),_0x51ce6d[_0x74b1('0x14')],_0x38d932);_0x13bb44(_0x39f261['error'](0x1f4,_0x51ce6d[_0x74b1('0x14')]));});});}; \ No newline at end of file +var _0xb961=['catch','ShowWhatsappAccount','find','options','raw','include','map','model','attributes','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x385fcc,_0x438ca3){var _0x50c842=function(_0x2d8dd0){while(--_0x2d8dd0){_0x385fcc['push'](_0x385fcc['shift']());}};_0x50c842(++_0x438ca3);}(_0xb961,0x114));var _0x1b96=function(_0x33862b,_0x583ddc){_0x33862b=_0x33862b-0x0;var _0x1b15a0=_0xb961[_0x33862b];return _0x1b15a0;};'use strict';var _=require(_0x1b96('0x0'));var util=require(_0x1b96('0x1'));var moment=require(_0x1b96('0x2'));var BPromise=require(_0x1b96('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b96('0x4'));var db=require(_0x1b96('0x5'))['db'];var utils=require(_0x1b96('0x6'));var logger=require(_0x1b96('0x7'))(_0x1b96('0x8'));var config=require(_0x1b96('0x9'));var jayson=require(_0x1b96('0xa'));var client=jayson['client'][_0x1b96('0xb')]({'port':0x232a});config[_0x1b96('0xc')]=_[_0x1b96('0xd')](config[_0x1b96('0xc')],{'host':_0x1b96('0xe'),'port':0x18eb});var socket=require(_0x1b96('0xf'))(new Redis(config['redis']));require(_0x1b96('0x10'))[_0x1b96('0x11')](socket);function respondWithRpcPromise(_0x26d17f,_0x43cd97,_0x4f9ea8){return new BPromise(function(_0x3bf8e0,_0x6f9d79){return client[_0x1b96('0x12')](_0x26d17f,_0x4f9ea8)[_0x1b96('0x13')](function(_0xfab0f3){logger[_0x1b96('0x14')](_0x1b96('0x15'),_0x43cd97,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x43cd97,_0x1b96('0x16'),JSON[_0x1b96('0x17')](_0xfab0f3));if(_0xfab0f3[_0x1b96('0x18')]){if(_0xfab0f3['error'][_0x1b96('0x19')]===0x1f4){logger['error'](_0x1b96('0x15'),_0x43cd97,_0xfab0f3[_0x1b96('0x18')]['message']);return _0x6f9d79(_0xfab0f3[_0x1b96('0x18')]['message']);}logger[_0x1b96('0x18')](_0x1b96('0x15'),_0x43cd97,_0xfab0f3['error'][_0x1b96('0x1a')]);return _0x3bf8e0(_0xfab0f3[_0x1b96('0x18')][_0x1b96('0x1a')]);}else{logger[_0x1b96('0x14')](_0x1b96('0x15'),_0x43cd97,_0x1b96('0x16'));_0x3bf8e0(_0xfab0f3[_0x1b96('0x1b')][_0x1b96('0x1a')]);}})[_0x1b96('0x1c')](function(_0x14673a){logger[_0x1b96('0x18')](_0x1b96('0x15'),_0x43cd97,_0x14673a);_0x6f9d79(_0x14673a);});});}exports[_0x1b96('0x1d')]=function(_0x58715f){var _0x112a05=this;return new Promise(function(_0x340751,_0x1f2e1a){return db['WhatsappAccount'][_0x1b96('0x1e')]({'raw':_0x58715f[_0x1b96('0x1f')]?_0x58715f[_0x1b96('0x1f')][_0x1b96('0x20')]===undefined?!![]:![]:!![],'where':_0x58715f['options']?_0x58715f[_0x1b96('0x1f')]['where']||null:null,'attributes':_0x58715f[_0x1b96('0x1f')]?_0x58715f['options']['attributes']||null:null,'include':_0x58715f['options']?_0x58715f['options'][_0x1b96('0x21')]?_[_0x1b96('0x22')](_0x58715f['options'][_0x1b96('0x21')],function(_0xf68f62){return{'model':db[_0xf68f62[_0x1b96('0x23')]],'as':_0xf68f62['as'],'attributes':_0xf68f62[_0x1b96('0x24')],'include':_0xf68f62['include']?_[_0x1b96('0x22')](_0xf68f62[_0x1b96('0x21')],function(_0x2cd651){return{'model':db[_0x2cd651[_0x1b96('0x23')]],'as':_0x2cd651['as'],'attributes':_0x2cd651[_0x1b96('0x24')],'include':_0x2cd651[_0x1b96('0x21')]?_[_0x1b96('0x22')](_0x2cd651[_0x1b96('0x21')],function(_0x7b4650){return{'model':db[_0x7b4650[_0x1b96('0x23')]],'as':_0x7b4650['as'],'attributes':_0x7b4650[_0x1b96('0x24')]};}):[]};}):[]};}):[]:[]})[_0x1b96('0x13')](function(_0x26a763){logger[_0x1b96('0x14')](_0x1b96('0x1d'),_0x58715f);logger[_0x1b96('0x25')](_0x1b96('0x1d'),_0x58715f,JSON[_0x1b96('0x17')](_0x26a763));_0x340751(_0x26a763);})[_0x1b96('0x1c')](function(_0x42c497){logger[_0x1b96('0x18')](_0x1b96('0x1d'),_0x42c497[_0x1b96('0x1a')],_0x58715f);_0x1f2e1a(_0x112a05[_0x1b96('0x18')](0x1f4,_0x42c497[_0x1b96('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 2e0cf02..434a176 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 _0xb9c9=['update','whatsappAccount:','./whatsappAccount.events','save','remove'];(function(_0x3166ce,_0x136e21){var _0x309267=function(_0x267ab5){while(--_0x267ab5){_0x3166ce['push'](_0x3166ce['shift']());}};_0x309267(++_0x136e21);}(_0xb9c9,0x13d));var _0x9b9c=function(_0x322f98,_0x433173){_0x322f98=_0x322f98-0x0;var _0x2aeef8=_0xb9c9[_0x322f98];return _0x2aeef8;};'use strict';var WhatsappAccountEvents=require(_0x9b9c('0x0'));var events=[_0x9b9c('0x1'),_0x9b9c('0x2'),_0x9b9c('0x3')];function createListener(_0xa68547,_0x1b6b76){return function(_0x329292){_0x1b6b76['emit'](_0xa68547,_0x329292);};}function removeListener(_0x590f11,_0x465377){return function(){WhatsappAccountEvents['removeListener'](_0x590f11,_0x465377);};}exports['register']=function(_0x119772){for(var _0x55ae6e=0x0,_0x64e10d=events['length'];_0x55ae6e<_0x64e10d;_0x55ae6e++){var _0x358988=events[_0x55ae6e];var _0x21af04=createListener(_0x9b9c('0x4')+_0x358988,_0x119772);WhatsappAccountEvents['on'](_0x358988,_0x21af04);}}; \ No newline at end of file +var _0x450f=['emit','removeListener','length','whatsappAccount:','save','remove','update'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x450f,0x162));var _0xf450=function(_0x430244,_0x3b8a5e){_0x430244=_0x430244-0x0;var _0x2ed66c=_0x450f[_0x430244];return _0x2ed66c;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xf450('0x0'),_0xf450('0x1'),_0xf450('0x2')];function createListener(_0x1f1dfd,_0x53a021){return function(_0x46ad1b){_0x53a021[_0xf450('0x3')](_0x1f1dfd,_0x46ad1b);};}function removeListener(_0x129544,_0x23e789){return function(){WhatsappAccountEvents[_0xf450('0x4')](_0x129544,_0x23e789);};}exports['register']=function(_0x4a8475){for(var _0x9707f=0x0,_0x18cf9f=events[_0xf450('0x5')];_0x9707f<_0x18cf9f;_0x9707f++){var _0x4950ca=events[_0x9707f];var _0x4ba135=createListener(_0xf450('0x6')+_0x4950ca,_0x4a8475);WhatsappAccountEvents['on'](_0x4950ca,_0x4ba135);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 80a9005..4cff4c9 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 _0x01ae=['/:id','show','create','update','delete','destroy','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated'];(function(_0x4221f7,_0x33f069){var _0x5df3bb=function(_0x1df964){while(--_0x1df964){_0x4221f7['push'](_0x4221f7['shift']());}};_0x5df3bb(++_0x33f069);}(_0x01ae,0xc6));var _0xe01a=function(_0x4ad0f7,_0x1920b0){_0x4ad0f7=_0x4ad0f7-0x0;var _0x30f5c8=_0x01ae[_0x4ad0f7];return _0x30f5c8;};'use strict';var multer=require(_0xe01a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe01a('0x1'));var router=express[_0xe01a('0x2')]();var fs_extra=require(_0xe01a('0x3'));var auth=require(_0xe01a('0x4'));var interaction=require(_0xe01a('0x5'));var config=require(_0xe01a('0x6'));var controller=require(_0xe01a('0x7'));router[_0xe01a('0x8')]('/',auth[_0xe01a('0x9')](),controller['index']);router[_0xe01a('0x8')](_0xe01a('0xa'),auth['isAuthenticated'](),controller[_0xe01a('0xb')]);router['post']('/',auth[_0xe01a('0x9')](),controller[_0xe01a('0xc')]);router['put'](_0xe01a('0xa'),auth[_0xe01a('0x9')](),controller[_0xe01a('0xd')]);router[_0xe01a('0xe')](_0xe01a('0xa'),auth[_0xe01a('0x9')](),controller[_0xe01a('0xf')]);module['exports']=router; \ No newline at end of file +var _0xe5c5=['../../config/environment','./whatsappApplication.controller','get','index','/:id','isAuthenticated','show','put','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4766f6,_0x4ec6a5){var _0x92f94c=function(_0x44d7a5){while(--_0x44d7a5){_0x4766f6['push'](_0x4766f6['shift']());}};_0x92f94c(++_0x4ec6a5);}(_0xe5c5,0x190));var _0x5e5c=function(_0x15e205,_0x3e4958){_0x15e205=_0x15e205-0x0;var _0xed40f2=_0xe5c5[_0x15e205];return _0xed40f2;};'use strict';var multer=require(_0x5e5c('0x0'));var util=require(_0x5e5c('0x1'));var path=require('path');var timeout=require(_0x5e5c('0x2'));var express=require(_0x5e5c('0x3'));var router=express[_0x5e5c('0x4')]();var fs_extra=require(_0x5e5c('0x5'));var auth=require(_0x5e5c('0x6'));var interaction=require(_0x5e5c('0x7'));var config=require(_0x5e5c('0x8'));var controller=require(_0x5e5c('0x9'));router[_0x5e5c('0xa')]('/',auth['isAuthenticated'](),controller[_0x5e5c('0xb')]);router[_0x5e5c('0xa')](_0x5e5c('0xc'),auth[_0x5e5c('0xd')](),controller[_0x5e5c('0xe')]);router['post']('/',auth[_0x5e5c('0xd')](),controller['create']);router[_0x5e5c('0xf')](_0x5e5c('0xc'),auth[_0x5e5c('0xd')](),controller['update']);router[_0x5e5c('0x10')](_0x5e5c('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 72ba160..caf7ffb 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 _0x6658=['*,*,*,*','sequelize','exports','STRING'];(function(_0x2c4709,_0x436880){var _0xec7f40=function(_0x32c93f){while(--_0x32c93f){_0x2c4709['push'](_0x2c4709['shift']());}};_0xec7f40(++_0x436880);}(_0x6658,0x1c1));var _0x8665=function(_0x34992e,_0x4e3297){_0x34992e=_0x34992e-0x0;var _0x4cc143=_0x6658[_0x34992e];return _0x4cc143;};'use strict';var Sequelize=require(_0x8665('0x0'));module[_0x8665('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x8665('0x2')]},'interval':{'type':Sequelize[_0x8665('0x2')],'defaultValue':_0x8665('0x3')}}; \ No newline at end of file +var _0x5996=['exports','noop','TEXT','STRING','sequelize'];(function(_0x193432,_0x5b5efc){var _0xf8d4e=function(_0x2afa86){while(--_0x2afa86){_0x193432['push'](_0x193432['shift']());}};_0xf8d4e(++_0x5b5efc);}(_0x5996,0x6d));var _0x6599=function(_0x37eaf5,_0x4bd2ec){_0x37eaf5=_0x37eaf5-0x0;var _0x154060=_0x5996[_0x37eaf5];return _0x154060;};'use strict';var Sequelize=require(_0x6599('0x0'));module[_0x6599('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6599('0x2')},'appdata':{'type':Sequelize[_0x6599('0x3')]()},'description':{'type':Sequelize[_0x6599('0x4')]},'interval':{'type':Sequelize[_0x6599('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 1e27577..2070194 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 _0x36fe=['create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','then','destroy','error','stack','name','index','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','includeAll','include','findAll','catch','params','intersection','fields'];(function(_0xa3c06b,_0x490f99){var _0x33aa1d=function(_0x23a88e){while(--_0x23a88e){_0xa3c06b['push'](_0xa3c06b['shift']());}};_0x33aa1d(++_0x490f99);}(_0x36fe,0x127));var _0xe36f=function(_0xca1f0e,_0x2713d5){_0xca1f0e=_0xca1f0e-0x0;var _0x35e4ef=_0x36fe[_0xca1f0e];return _0x35e4ef;};'use strict';var emlformat=require(_0xe36f('0x0'));var rimraf=require(_0xe36f('0x1'));var zipdir=require(_0xe36f('0x2'));var jsonpatch=require(_0xe36f('0x3'));var rp=require(_0xe36f('0x4'));var moment=require(_0xe36f('0x5'));var BPromise=require(_0xe36f('0x6'));var Mustache=require(_0xe36f('0x7'));var util=require(_0xe36f('0x8'));var path=require(_0xe36f('0x9'));var sox=require(_0xe36f('0xa'));var csv=require('to-csv');var ejs=require(_0xe36f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe36f('0xc'));var squel=require(_0xe36f('0xd'));var crypto=require('crypto');var jsforce=require(_0xe36f('0xe'));var deskjs=require(_0xe36f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe36f('0x10'));var Papa=require(_0xe36f('0x11'));var Redis=require(_0xe36f('0x12'));var authService=require(_0xe36f('0x13'));var qs=require(_0xe36f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe36f('0x15'));var logger=require('../../config/logger')(_0xe36f('0x16'));var utils=require(_0xe36f('0x17'));var config=require(_0xe36f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe36f('0x19'))['db'];function respondWithStatusCode(_0x3caacb,_0x564d1e){_0x564d1e=_0x564d1e||0xcc;return function(_0x1bd5c2){if(_0x1bd5c2){return _0x3caacb[_0xe36f('0x1a')](_0x564d1e);}return _0x3caacb[_0xe36f('0x1b')](_0x564d1e)[_0xe36f('0x1c')]();};}function respondWithResult(_0x5f2407,_0x95f267){_0x95f267=_0x95f267||0xc8;return function(_0x8acac3){if(_0x8acac3){return _0x5f2407[_0xe36f('0x1b')](_0x95f267)['json'](_0x8acac3);}};}function respondWithFilteredResult(_0x2fcef3,_0x3ffb15){return function(_0x511de8){if(_0x511de8){var _0x1834a3=typeof _0x3ffb15[_0xe36f('0x1d')]===_0xe36f('0x1e')&&typeof _0x3ffb15[_0xe36f('0x1f')]===_0xe36f('0x1e');var _0x146efd=_0x511de8['count'];var _0x4d9df2=_0x1834a3?0x0:_0x3ffb15['offset'];var _0x5aed4f=_0x1834a3?_0x511de8[_0xe36f('0x20')]:_0x3ffb15[_0xe36f('0x1d')]+_0x3ffb15[_0xe36f('0x1f')];var _0x464164;if(_0x5aed4f>=_0x146efd){_0x5aed4f=_0x146efd;_0x464164=0xc8;}else{_0x464164=0xce;}_0x2fcef3['status'](_0x464164);return _0x2fcef3['set'](_0xe36f('0x21'),_0x4d9df2+'-'+_0x5aed4f+'/'+_0x146efd)[_0xe36f('0x22')](_0x511de8);}return null;};}function patchUpdates(_0x1502bf){return function(_0xb51dbf){try{jsonpatch[_0xe36f('0x23')](_0xb51dbf,_0x1502bf,!![]);}catch(_0x5c09ad){return BPromise[_0xe36f('0x24')](_0x5c09ad);}return _0xb51dbf['save']();};}function saveUpdates(_0x1fda7b,_0x395cc6){return function(_0x2dc212){if(_0x2dc212){return _0x2dc212['update'](_0x1fda7b)[_0xe36f('0x25')](function(_0xd00e9b){return _0xd00e9b;});}return null;};}function removeEntity(_0x5d8e84,_0xfd3899){return function(_0x12a473){if(_0x12a473){return _0x12a473[_0xe36f('0x26')]()['then'](function(){_0x5d8e84['status'](0xcc)[_0xe36f('0x1c')]();});}};}function handleEntityNotFound(_0x35ef46,_0x5edc48){return function(_0x1bd728){if(!_0x1bd728){_0x35ef46['sendStatus'](0x194);}return _0x1bd728;};}function handleError(_0xd0e82,_0x55f6d6){_0x55f6d6=_0x55f6d6||0x1f4;return function(_0x196183){logger[_0xe36f('0x27')](_0x196183[_0xe36f('0x28')]);if(_0x196183[_0xe36f('0x29')]){delete _0x196183[_0xe36f('0x29')];}_0xd0e82[_0xe36f('0x1b')](_0x55f6d6)['send'](_0x196183);};}exports[_0xe36f('0x2a')]=function(_0x5aa516,_0x13af30){var _0x253deb={},_0x471b91={},_0x1b8451={'count':0x0,'rows':[]};var _0x3296f2=_['map'](db[_0xe36f('0x2b')][_0xe36f('0x2c')],function(_0x1d8e72){return{'name':_0x1d8e72[_0xe36f('0x2d')],'type':_0x1d8e72[_0xe36f('0x2e')][_0xe36f('0x2f')]};});_0x471b91['model']=_['map'](_0x3296f2,_0xe36f('0x29'));_0x471b91[_0xe36f('0x30')]=_[_0xe36f('0x31')](_0x5aa516['query']);_0x471b91[_0xe36f('0x32')]=_['intersection'](_0x471b91[_0xe36f('0x33')],_0x471b91['query']);_0x253deb[_0xe36f('0x34')]=_['intersection'](_0x471b91[_0xe36f('0x33')],qs['fields'](_0x5aa516[_0xe36f('0x30')]['fields']));_0x253deb[_0xe36f('0x34')]=_0x253deb[_0xe36f('0x34')]['length']?_0x253deb[_0xe36f('0x34')]:_0x471b91[_0xe36f('0x33')];if(!_0x5aa516[_0xe36f('0x30')][_0xe36f('0x35')](_0xe36f('0x36'))){_0x253deb['limit']=qs['limit'](_0x5aa516[_0xe36f('0x30')][_0xe36f('0x1f')]);_0x253deb[_0xe36f('0x1d')]=qs['offset'](_0x5aa516[_0xe36f('0x30')]['offset']);}_0x253deb[_0xe36f('0x37')]=qs[_0xe36f('0x38')](_0x5aa516[_0xe36f('0x30')][_0xe36f('0x38')]);_0x253deb['where']=qs['filters'](_[_0xe36f('0x39')](_0x5aa516['query'],_0x471b91[_0xe36f('0x32')]),_0x3296f2);if(_0x5aa516[_0xe36f('0x30')][_0xe36f('0x3a')]){_0x253deb[_0xe36f('0x3b')]=_[_0xe36f('0x3c')](_0x253deb[_0xe36f('0x3b')],{'$or':_[_0xe36f('0x3d')](_0x3296f2,function(_0x5bfa56){if(_0x5bfa56[_0xe36f('0x2e')]!==_0xe36f('0x3e')){var _0x2593cf={};_0x2593cf[_0x5bfa56[_0xe36f('0x29')]]={'$like':'%'+_0x5aa516[_0xe36f('0x30')][_0xe36f('0x3a')]+'%'};return _0x2593cf;}})});}_0x253deb=_[_0xe36f('0x3c')]({},_0x253deb,_0x5aa516['options']);var _0x2e7dbd={'where':_0x253deb[_0xe36f('0x3b')]};return db[_0xe36f('0x2b')]['count'](_0x2e7dbd)[_0xe36f('0x25')](function(_0x573385){_0x1b8451[_0xe36f('0x20')]=_0x573385;if(_0x5aa516['query'][_0xe36f('0x3f')]){_0x253deb[_0xe36f('0x40')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xe36f('0x41')](_0x253deb);})['then'](function(_0x29f5e5){_0x1b8451['rows']=_0x29f5e5;return _0x1b8451;})[_0xe36f('0x25')](respondWithFilteredResult(_0x13af30,_0x253deb))[_0xe36f('0x42')](handleError(_0x13af30,null));};exports['show']=function(_0xd14f0d,_0x40c746){var _0x11e17e={'raw':!![],'where':{'id':_0xd14f0d[_0xe36f('0x43')]['id']}},_0x452314={};_0x452314[_0xe36f('0x33')]=_[_0xe36f('0x31')](db['WhatsappApplication'][_0xe36f('0x2c')]);_0x452314[_0xe36f('0x30')]=_['keys'](_0xd14f0d['query']);_0x452314['filters']=_[_0xe36f('0x44')](_0x452314['model'],_0x452314['query']);_0x11e17e[_0xe36f('0x34')]=_[_0xe36f('0x44')](_0x452314[_0xe36f('0x33')],qs['fields'](_0xd14f0d[_0xe36f('0x30')][_0xe36f('0x45')]));_0x11e17e[_0xe36f('0x34')]=_0x11e17e[_0xe36f('0x34')]['length']?_0x11e17e[_0xe36f('0x34')]:_0x452314[_0xe36f('0x33')];if(_0xd14f0d[_0xe36f('0x30')][_0xe36f('0x3f')]){_0x11e17e[_0xe36f('0x40')]=[{'all':!![]}];}_0x11e17e=_[_0xe36f('0x3c')]({},_0x11e17e,_0xd14f0d['options']);return db[_0xe36f('0x2b')]['find'](_0x11e17e)[_0xe36f('0x25')](handleEntityNotFound(_0x40c746,null))[_0xe36f('0x25')](respondWithResult(_0x40c746,null))[_0xe36f('0x42')](handleError(_0x40c746,null));};exports[_0xe36f('0x46')]=function(_0x4c3a2b,_0x58c3f6){return db[_0xe36f('0x2b')][_0xe36f('0x46')](_0x4c3a2b[_0xe36f('0x47')],{})[_0xe36f('0x25')](respondWithResult(_0x58c3f6,0xc9))[_0xe36f('0x42')](handleError(_0x58c3f6,null));};exports['update']=function(_0x66fa03,_0x4215b8){if(_0x66fa03['body']['id']){delete _0x66fa03[_0xe36f('0x47')]['id'];}return db[_0xe36f('0x2b')][_0xe36f('0x48')]({'where':{'id':_0x66fa03[_0xe36f('0x43')]['id']}})[_0xe36f('0x25')](handleEntityNotFound(_0x4215b8,null))[_0xe36f('0x25')](saveUpdates(_0x66fa03[_0xe36f('0x47')],null))[_0xe36f('0x25')](respondWithResult(_0x4215b8,null))[_0xe36f('0x42')](handleError(_0x4215b8,null));};exports['destroy']=function(_0x324def,_0x4f5f6a){return db['WhatsappApplication']['find']({'where':{'id':_0x324def[_0xe36f('0x43')]['id']}})[_0xe36f('0x25')](handleEntityNotFound(_0x4f5f6a,null))[_0xe36f('0x25')](removeEntity(_0x4f5f6a,null))['catch'](handleError(_0x4f5f6a,null));}; \ No newline at end of file +var _0x955f=['undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x1c72b8,_0x104b7e){var _0x191114=function(_0x5d76da){while(--_0x5d76da){_0x1c72b8['push'](_0x1c72b8['shift']());}};_0x191114(++_0x104b7e);}(_0x955f,0x1eb));var _0xf955=function(_0x415c5a,_0x49a851){_0x415c5a=_0x415c5a-0x0;var _0xb8f5ca=_0x955f[_0x415c5a];return _0xb8f5ca;};'use strict';var emlformat=require(_0xf955('0x0'));var rimraf=require(_0xf955('0x1'));var zipdir=require(_0xf955('0x2'));var jsonpatch=require(_0xf955('0x3'));var rp=require(_0xf955('0x4'));var moment=require('moment');var BPromise=require(_0xf955('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf955('0x6'));var sox=require('sox');var csv=require(_0xf955('0x7'));var ejs=require(_0xf955('0x8'));var fs=require('fs');var fs_extra=require(_0xf955('0x9'));var _=require('lodash');var squel=require(_0xf955('0xa'));var crypto=require(_0xf955('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf955('0xc'));var toCsv=require(_0xf955('0x7'));var querystring=require(_0xf955('0xd'));var Papa=require(_0xf955('0xe'));var Redis=require(_0xf955('0xf'));var authService=require(_0xf955('0x10'));var qs=require(_0xf955('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf955('0x12'));var logger=require('../../config/logger')(_0xf955('0x13'));var utils=require(_0xf955('0x14'));var config=require(_0xf955('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf955('0x16'))['db'];function respondWithStatusCode(_0x542347,_0x23e0c6){_0x23e0c6=_0x23e0c6||0xcc;return function(_0x50d9a9){if(_0x50d9a9){return _0x542347[_0xf955('0x17')](_0x23e0c6);}return _0x542347[_0xf955('0x18')](_0x23e0c6)[_0xf955('0x19')]();};}function respondWithResult(_0x109bc5,_0x2080c4){_0x2080c4=_0x2080c4||0xc8;return function(_0x341b8c){if(_0x341b8c){return _0x109bc5[_0xf955('0x18')](_0x2080c4)[_0xf955('0x1a')](_0x341b8c);}};}function respondWithFilteredResult(_0x3c6af7,_0x24e75c){return function(_0x5350e4){if(_0x5350e4){var _0xc29b35=typeof _0x24e75c['offset']===_0xf955('0x1b')&&typeof _0x24e75c[_0xf955('0x1c')]===_0xf955('0x1b');var _0x15c07c=_0x5350e4['count'];var _0x5ac6cb=_0xc29b35?0x0:_0x24e75c[_0xf955('0x1d')];var _0xe6de5c=_0xc29b35?_0x5350e4[_0xf955('0x1e')]:_0x24e75c['offset']+_0x24e75c[_0xf955('0x1c')];var _0x3576fa;if(_0xe6de5c>=_0x15c07c){_0xe6de5c=_0x15c07c;_0x3576fa=0xc8;}else{_0x3576fa=0xce;}_0x3c6af7[_0xf955('0x18')](_0x3576fa);return _0x3c6af7[_0xf955('0x1f')](_0xf955('0x20'),_0x5ac6cb+'-'+_0xe6de5c+'/'+_0x15c07c)['json'](_0x5350e4);}return null;};}function patchUpdates(_0x17d86a){return function(_0x3dbbe8){try{jsonpatch[_0xf955('0x21')](_0x3dbbe8,_0x17d86a,!![]);}catch(_0x488d04){return BPromise[_0xf955('0x22')](_0x488d04);}return _0x3dbbe8['save']();};}function saveUpdates(_0x21ae24,_0x43b078){return function(_0x37143d){if(_0x37143d){return _0x37143d[_0xf955('0x23')](_0x21ae24)[_0xf955('0x24')](function(_0x565641){return _0x565641;});}return null;};}function removeEntity(_0x25f4f2,_0x5fab1c){return function(_0x3585c7){if(_0x3585c7){return _0x3585c7[_0xf955('0x25')]()[_0xf955('0x24')](function(){_0x25f4f2[_0xf955('0x18')](0xcc)[_0xf955('0x19')]();});}};}function handleEntityNotFound(_0x552cf3,_0x18f435){return function(_0x1acf33){if(!_0x1acf33){_0x552cf3[_0xf955('0x17')](0x194);}return _0x1acf33;};}function handleError(_0x406632,_0x2dcd55){_0x2dcd55=_0x2dcd55||0x1f4;return function(_0x13a86d){logger[_0xf955('0x26')](_0x13a86d['stack']);if(_0x13a86d[_0xf955('0x27')]){delete _0x13a86d[_0xf955('0x27')];}_0x406632[_0xf955('0x18')](_0x2dcd55)[_0xf955('0x28')](_0x13a86d);};}exports[_0xf955('0x29')]=function(_0x264f6d,_0x4d4af0){var _0x2232a7={},_0x1e5d37={},_0x4ec3e8={'count':0x0,'rows':[]};var _0x256df5=_[_0xf955('0x2a')](db[_0xf955('0x2b')][_0xf955('0x2c')],function(_0x59bfb5){return{'name':_0x59bfb5[_0xf955('0x2d')],'type':_0x59bfb5['type'][_0xf955('0x2e')]};});_0x1e5d37[_0xf955('0x2f')]=_[_0xf955('0x2a')](_0x256df5,_0xf955('0x27'));_0x1e5d37[_0xf955('0x30')]=_[_0xf955('0x31')](_0x264f6d[_0xf955('0x30')]);_0x1e5d37[_0xf955('0x32')]=_['intersection'](_0x1e5d37[_0xf955('0x2f')],_0x1e5d37[_0xf955('0x30')]);_0x2232a7[_0xf955('0x33')]=_[_0xf955('0x34')](_0x1e5d37['model'],qs[_0xf955('0x35')](_0x264f6d[_0xf955('0x30')][_0xf955('0x35')]));_0x2232a7[_0xf955('0x33')]=_0x2232a7[_0xf955('0x33')]['length']?_0x2232a7['attributes']:_0x1e5d37['model'];if(!_0x264f6d[_0xf955('0x30')][_0xf955('0x36')](_0xf955('0x37'))){_0x2232a7[_0xf955('0x1c')]=qs[_0xf955('0x1c')](_0x264f6d[_0xf955('0x30')]['limit']);_0x2232a7[_0xf955('0x1d')]=qs['offset'](_0x264f6d[_0xf955('0x30')][_0xf955('0x1d')]);}_0x2232a7[_0xf955('0x38')]=qs['sort'](_0x264f6d[_0xf955('0x30')]['sort']);_0x2232a7[_0xf955('0x39')]=qs[_0xf955('0x32')](_[_0xf955('0x3a')](_0x264f6d[_0xf955('0x30')],_0x1e5d37['filters']),_0x256df5);if(_0x264f6d[_0xf955('0x30')][_0xf955('0x3b')]){_0x2232a7['where']=_[_0xf955('0x3c')](_0x2232a7[_0xf955('0x39')],{'$or':_[_0xf955('0x2a')](_0x256df5,function(_0x547ed9){if(_0x547ed9[_0xf955('0x3d')]!==_0xf955('0x3e')){var _0x11b7e2={};_0x11b7e2[_0x547ed9['name']]={'$like':'%'+_0x264f6d[_0xf955('0x30')][_0xf955('0x3b')]+'%'};return _0x11b7e2;}})});}_0x2232a7=_[_0xf955('0x3c')]({},_0x2232a7,_0x264f6d[_0xf955('0x3f')]);var _0x2bfbe4={'where':_0x2232a7[_0xf955('0x39')]};return db[_0xf955('0x2b')][_0xf955('0x1e')](_0x2bfbe4)['then'](function(_0x8fa41b){_0x4ec3e8[_0xf955('0x1e')]=_0x8fa41b;if(_0x264f6d[_0xf955('0x30')][_0xf955('0x40')]){_0x2232a7[_0xf955('0x41')]=[{'all':!![]}];}return db[_0xf955('0x2b')][_0xf955('0x42')](_0x2232a7);})[_0xf955('0x24')](function(_0x47651b){_0x4ec3e8[_0xf955('0x43')]=_0x47651b;return _0x4ec3e8;})[_0xf955('0x24')](respondWithFilteredResult(_0x4d4af0,_0x2232a7))[_0xf955('0x44')](handleError(_0x4d4af0,null));};exports[_0xf955('0x45')]=function(_0x159ae3,_0x3557b5){var _0x248f60={'raw':!![],'where':{'id':_0x159ae3[_0xf955('0x46')]['id']}},_0x356ec2={};_0x356ec2[_0xf955('0x2f')]=_['keys'](db[_0xf955('0x2b')][_0xf955('0x2c')]);_0x356ec2[_0xf955('0x30')]=_['keys'](_0x159ae3[_0xf955('0x30')]);_0x356ec2['filters']=_[_0xf955('0x34')](_0x356ec2['model'],_0x356ec2[_0xf955('0x30')]);_0x248f60[_0xf955('0x33')]=_[_0xf955('0x34')](_0x356ec2[_0xf955('0x2f')],qs['fields'](_0x159ae3[_0xf955('0x30')][_0xf955('0x35')]));_0x248f60[_0xf955('0x33')]=_0x248f60['attributes']['length']?_0x248f60[_0xf955('0x33')]:_0x356ec2[_0xf955('0x2f')];if(_0x159ae3[_0xf955('0x30')][_0xf955('0x40')]){_0x248f60['include']=[{'all':!![]}];}_0x248f60=_[_0xf955('0x3c')]({},_0x248f60,_0x159ae3[_0xf955('0x3f')]);return db[_0xf955('0x2b')]['find'](_0x248f60)[_0xf955('0x24')](handleEntityNotFound(_0x3557b5,null))['then'](respondWithResult(_0x3557b5,null))[_0xf955('0x44')](handleError(_0x3557b5,null));};exports[_0xf955('0x47')]=function(_0x2c867f,_0x4dd592){return db[_0xf955('0x2b')][_0xf955('0x47')](_0x2c867f[_0xf955('0x48')],{})[_0xf955('0x24')](respondWithResult(_0x4dd592,0xc9))['catch'](handleError(_0x4dd592,null));};exports[_0xf955('0x23')]=function(_0x4ff0f1,_0x1c6d76){if(_0x4ff0f1[_0xf955('0x48')]['id']){delete _0x4ff0f1[_0xf955('0x48')]['id'];}return db['WhatsappApplication'][_0xf955('0x49')]({'where':{'id':_0x4ff0f1['params']['id']}})[_0xf955('0x24')](handleEntityNotFound(_0x1c6d76,null))['then'](saveUpdates(_0x4ff0f1[_0xf955('0x48')],null))['then'](respondWithResult(_0x1c6d76,null))['catch'](handleError(_0x1c6d76,null));};exports[_0xf955('0x25')]=function(_0x45c7fe,_0x4961cc){return db[_0xf955('0x2b')]['find']({'where':{'id':_0x45c7fe['params']['id']}})['then'](handleEntityNotFound(_0x4961cc,null))['then'](removeEntity(_0x4961cc,null))[_0xf955('0x44')](handleError(_0x4961cc,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index dcd15a8..1e593c8 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 _0x885a=['./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x885a,0x180));var _0xa885=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x885a[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0xa885('0x0'));var logger=require(_0xa885('0x1'))(_0xa885('0x2'));var moment=require(_0xa885('0x3'));var BPromise=require('bluebird');var rp=require(_0xa885('0x4'));var fs=require('fs');var path=require(_0xa885('0x5'));var rimraf=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var attributes=require(_0xa885('0x8'));module[_0xa885('0x9')]=function(_0x5dfd7e,_0x7ac6bd){return _0x5dfd7e[_0xa885('0xa')](_0xa885('0xb'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa885('0xc'),'collate':_0xa885('0xd')});}; \ No newline at end of file +var _0x102b=['define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes'];(function(_0xa5cbbc,_0x312aa4){var _0x109cdd=function(_0x3b712d){while(--_0x3b712d){_0xa5cbbc['push'](_0xa5cbbc['shift']());}};_0x109cdd(++_0x312aa4);}(_0x102b,0x1be));var _0xb102=function(_0x222f2d,_0x4e8292){_0x222f2d=_0x222f2d-0x0;var _0x113192=_0x102b[_0x222f2d];return _0x113192;};'use strict';var _=require('lodash');var util=require(_0xb102('0x0'));var logger=require('../../config/logger')(_0xb102('0x1'));var moment=require(_0xb102('0x2'));var BPromise=require(_0xb102('0x3'));var rp=require(_0xb102('0x4'));var fs=require('fs');var path=require(_0xb102('0x5'));var rimraf=require(_0xb102('0x6'));var config=require(_0xb102('0x7'));var attributes=require(_0xb102('0x8'));module['exports']=function(_0x3325b7,_0x370baa){return _0x3325b7[_0xb102('0x9')](_0xb102('0xa'),attributes,{'tableName':_0xb102('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb102('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 21bf212..7094506 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 _0x9a19=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xae282f,_0x2d9368){var _0x5f46d4=function(_0x4f703e){while(--_0x4f703e){_0xae282f['push'](_0xae282f['shift']());}};_0x5f46d4(++_0x2d9368);}(_0x9a19,0x114));var _0x99a1=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0x9a19[_0x1d87fc];return _0x492b56;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var moment=require(_0x99a1('0x2'));var BPromise=require('bluebird');var rs=require(_0x99a1('0x3'));var fs=require('fs');var Redis=require(_0x99a1('0x4'));var db=require(_0x99a1('0x5'))['db'];var utils=require(_0x99a1('0x6'));var logger=require(_0x99a1('0x7'))(_0x99a1('0x8'));var config=require(_0x99a1('0x9'));var jayson=require(_0x99a1('0xa'));var client=jayson[_0x99a1('0xb')][_0x99a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x65045d,_0x523b9e,_0x4d2a5c){return new BPromise(function(_0x5aa6c2,_0x56f50){return client[_0x99a1('0xd')](_0x65045d,_0x4d2a5c)['then'](function(_0x5874fc){logger[_0x99a1('0xe')](_0x99a1('0xf'),_0x523b9e,_0x99a1('0x10'));logger[_0x99a1('0x11')](_0x99a1('0x12'),_0x523b9e,'request\x20sent',JSON[_0x99a1('0x13')](_0x5874fc));if(_0x5874fc[_0x99a1('0x14')]){if(_0x5874fc[_0x99a1('0x14')][_0x99a1('0x15')]===0x1f4){logger[_0x99a1('0x14')](_0x99a1('0xf'),_0x523b9e,_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);return _0x56f50(_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);}logger[_0x99a1('0x14')](_0x99a1('0xf'),_0x523b9e,_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);return _0x5aa6c2(_0x5874fc[_0x99a1('0x14')]['message']);}else{logger[_0x99a1('0xe')](_0x99a1('0xf'),_0x523b9e,_0x99a1('0x10'));_0x5aa6c2(_0x5874fc[_0x99a1('0x17')][_0x99a1('0x16')]);}})[_0x99a1('0x18')](function(_0x1ca878){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x523b9e,_0x1ca878);_0x56f50(_0x1ca878);});});} \ No newline at end of file +var _0x99e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x2e6c75,_0x1bdbb7){var _0x13a9ea=function(_0x6ad297){while(--_0x6ad297){_0x2e6c75['push'](_0x2e6c75['shift']());}};_0x13a9ea(++_0x1bdbb7);}(_0x99e9,0xb4));var _0x999e=function(_0x289a67,_0x1e5a3c){_0x289a67=_0x289a67-0x0;var _0x572b49=_0x99e9[_0x289a67];return _0x572b49;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100330,_0x18f337,_0x5c1c17){return new BPromise(function(_0x46aeae,_0x38a692){return client[_0x999e('0xa')](_0x100330,_0x5c1c17)[_0x999e('0xb')](function(_0x2c38cf){logger[_0x999e('0xc')](_0x999e('0xd'),_0x18f337,_0x999e('0xe'));logger[_0x999e('0xf')](_0x999e('0x10'),_0x18f337,_0x999e('0xe'),JSON[_0x999e('0x11')](_0x2c38cf));if(_0x2c38cf[_0x999e('0x12')]){if(_0x2c38cf[_0x999e('0x12')][_0x999e('0x13')]===0x1f4){logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x38a692(_0x2c38cf['error'][_0x999e('0x14')]);}logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x46aeae(_0x2c38cf['error'][_0x999e('0x14')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 466fe94..e82e61b 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 _0xa23f=['/:id/messages','/:id/tags','tracked','whatsapp','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getMessages','/:id/download','download','post'];(function(_0x5d0cd5,_0x4391dc){var _0x53191d=function(_0x51a2eb){while(--_0x51a2eb){_0x5d0cd5['push'](_0x5d0cd5['shift']());}};_0x53191d(++_0x4391dc);}(_0xa23f,0x7c));var _0xfa23=function(_0x15737a,_0x52e632){_0x15737a=_0x15737a-0x0;var _0x28161c=_0xa23f[_0x15737a];return _0x28161c;};'use strict';var multer=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfa23('0x2'));var router=express[_0xfa23('0x3')]();var fs_extra=require(_0xfa23('0x4'));var auth=require(_0xfa23('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfa23('0x6'));var controller=require('./whatsappInteraction.controller');router[_0xfa23('0x7')]('/',auth[_0xfa23('0x8')](),controller[_0xfa23('0x9')]);router[_0xfa23('0x7')]('/describe',auth[_0xfa23('0x8')](),controller['describe']);router[_0xfa23('0x7')](_0xfa23('0xa'),auth[_0xfa23('0x8')](),controller[_0xfa23('0xb')]);router[_0xfa23('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0xfa23('0xc')]);router['get'](_0xfa23('0xd'),auth['isAuthenticated'](),controller[_0xfa23('0xe')]);router[_0xfa23('0xf')]('/',auth[_0xfa23('0x8')](),controller['create']);router[_0xfa23('0xf')](_0xfa23('0x10'),auth[_0xfa23('0x8')](),controller['addMessage']);router['post'](_0xfa23('0x11'),auth[_0xfa23('0x8')](),interaction[_0xfa23('0x12')](_0xfa23('0x13'),'whatsappinteraction:addtags'),controller[_0xfa23('0x14')]);router[_0xfa23('0x15')](_0xfa23('0xa'),auth[_0xfa23('0x8')](),interaction['tracked'](_0xfa23('0x13'),_0xfa23('0x16')),controller[_0xfa23('0x17')]);router[_0xfa23('0x18')](_0xfa23('0xa'),auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0xfa23('0x19')),controller[_0xfa23('0x1a')]);router['delete'](_0xfa23('0x11'),auth[_0xfa23('0x8')](),controller[_0xfa23('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xfc17=['create','/:id/messages','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','tracked','whatsappinteraction:update','update','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','show','/:id/download','download','post'];(function(_0x534000,_0x48d4be){var _0xfb39ac=function(_0x39d9b7){while(--_0x39d9b7){_0x534000['push'](_0x534000['shift']());}};_0xfb39ac(++_0x48d4be);}(_0xfc17,0x1b4));var _0x7fc1=function(_0x38dea3,_0x5591cc){_0x38dea3=_0x38dea3-0x0;var _0x350734=_0xfc17[_0x38dea3];return _0x350734;};'use strict';var multer=require(_0x7fc1('0x0'));var util=require(_0x7fc1('0x1'));var path=require(_0x7fc1('0x2'));var timeout=require(_0x7fc1('0x3'));var express=require('express');var router=express[_0x7fc1('0x4')]();var fs_extra=require(_0x7fc1('0x5'));var auth=require(_0x7fc1('0x6'));var interaction=require(_0x7fc1('0x7'));var config=require(_0x7fc1('0x8'));var controller=require(_0x7fc1('0x9'));router['get']('/',auth[_0x7fc1('0xa')](),controller[_0x7fc1('0xb')]);router[_0x7fc1('0xc')](_0x7fc1('0xd'),auth[_0x7fc1('0xa')](),controller[_0x7fc1('0xe')]);router[_0x7fc1('0xc')]('/:id',auth[_0x7fc1('0xa')](),controller[_0x7fc1('0xf')]);router[_0x7fc1('0xc')]('/:id/messages',auth[_0x7fc1('0xa')](),controller['getMessages']);router['get'](_0x7fc1('0x10'),auth[_0x7fc1('0xa')](),controller[_0x7fc1('0x11')]);router[_0x7fc1('0x12')]('/',auth[_0x7fc1('0xa')](),controller[_0x7fc1('0x13')]);router[_0x7fc1('0x12')](_0x7fc1('0x14'),auth[_0x7fc1('0xa')](),controller[_0x7fc1('0x15')]);router[_0x7fc1('0x12')](_0x7fc1('0x16'),auth['isAuthenticated'](),interaction['tracked'](_0x7fc1('0x17'),_0x7fc1('0x18')),controller[_0x7fc1('0x19')]);router[_0x7fc1('0x1a')](_0x7fc1('0x1b'),auth[_0x7fc1('0xa')](),interaction[_0x7fc1('0x1c')](_0x7fc1('0x17'),_0x7fc1('0x1d')),controller[_0x7fc1('0x1e')]);router['delete'](_0x7fc1('0x1b'),auth['isAuthenticated'](),interaction[_0x7fc1('0x1c')](_0x7fc1('0x17'),'whatsappinteraction:destroy'),controller[_0x7fc1('0x1f')]);router[_0x7fc1('0x20')]('/:id/tags',auth[_0x7fc1('0xa')](),controller[_0x7fc1('0x21')]);module[_0x7fc1('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 30cd861..372770c 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 _0xbe51=['moment','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0xffa283,_0x4c3d16){var _0x3e673e=function(_0x191d02){while(--_0x191d02){_0xffa283['push'](_0xffa283['shift']());}};_0x3e673e(++_0x4c3d16);}(_0xbe51,0x1e2));var _0x1be5=function(_0x11bb56,_0x14299c){_0x11bb56=_0x11bb56-0x0;var _0x148b93=_0xbe51[_0x11bb56];return _0x148b93;};'use strict';var Sequelize=require(_0x1be5('0x0'));var moment=require(_0x1be5('0x1'));module['exports']={'closed':{'type':Sequelize[_0x1be5('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1be5('0x3')]},'secondDisposition':{'type':Sequelize[_0x1be5('0x3')]},'thirdDisposition':{'type':Sequelize[_0x1be5('0x3')]},'note':{'type':Sequelize[_0x1be5('0x3')]},'phone':{'type':Sequelize[_0x1be5('0x3')]},'read1stAt':{'type':Sequelize[_0x1be5('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x1be5('0x5')]('in',_0x1be5('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1be5('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x1be5('0x5')]('in',_0x1be5('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xf954=['sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER'];(function(_0x3579fa,_0x3a34a9){var _0x114b1b=function(_0x27b094){while(--_0x27b094){_0x3579fa['push'](_0x3579fa['shift']());}};_0x114b1b(++_0x3a34a9);}(_0xf954,0x10e));var _0x4f95=function(_0x3cd881,_0x525fbd){_0x3cd881=_0x3cd881-0x0;var _0x16907d=_0xf954[_0x3cd881];return _0x16907d;};'use strict';var Sequelize=require(_0x4f95('0x0'));var moment=require(_0x4f95('0x1'));module[_0x4f95('0x2')]={'closed':{'type':Sequelize[_0x4f95('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4f95('0x4')]},'disposition':{'type':Sequelize[_0x4f95('0x5')]},'secondDisposition':{'type':Sequelize[_0x4f95('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x4f95('0x5')]},'read1stAt':{'type':Sequelize[_0x4f95('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x4f95('0x6')]('in',_0x4f95('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x4f95('0x6')]('in',_0x4f95('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4f95('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4f95('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 2835647..aa20418 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 _0x87e6=['ids','omit','getMessages','hasOwnProperty','nolimit','limit','offset','order','sort','where','filter','merge','$gte','format','WhatsappMessage','rows','addTags','setTags','spread','Tag','name','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','push','User','fullname','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','Account','Owner','get','mkdirSync','Whatsapp','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','map','basename','existsSync','createReadStream','pipe','out','System','value','renderFile','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','json','undefined','count','set','Content-Range','update','then','destroy','stack','index','WhatsappInteraction','rawAttributes','fieldName','key','findAll','whatsapp','user','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','include','options','create','find','describe','addMessage','body'];(function(_0x3ca13c,_0x41d0b){var _0x131b0a=function(_0x112845){while(--_0x112845){_0x3ca13c['push'](_0x3ca13c['shift']());}};_0x131b0a(++_0x41d0b);}(_0x87e6,0x1bb));var _0x687e=function(_0x638597,_0x1f190f){_0x638597=_0x638597-0x0;var _0x3a6e6f=_0x87e6[_0x638597];return _0x3a6e6f;};'use strict';var rimraf=require(_0x687e('0x0'));var zipdir=require(_0x687e('0x1'));var moment=require(_0x687e('0x2'));var BPromise=require(_0x687e('0x3'));var util=require(_0x687e('0x4'));var path=require(_0x687e('0x5'));var ejs=require(_0x687e('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x687e('0x7'));var interaction=require(_0x687e('0x8'));var qs=require(_0x687e('0x9'));var pdf=require('../../components/export/pdf');var logger=require(_0x687e('0xa'))(_0x687e('0xb'));var config=require(_0x687e('0xc'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x687e('0xd')](config[_0x687e('0xe')],{'host':_0x687e('0xf'),'port':0x18eb});var socket=require(_0x687e('0x10'))(new Redis(config[_0x687e('0xe')]));require(_0x687e('0x11'))[_0x687e('0x12')](socket);function respondWithStatusCode(_0x3c7355,_0x3185ce){_0x3185ce=_0x3185ce||0xcc;return function(_0x359f10){if(_0x359f10){return _0x3c7355[_0x687e('0x13')](_0x3185ce);}return _0x3c7355['status'](_0x3185ce)['end']();};}function respondWithResult(_0x3c5802,_0x4a693f){_0x4a693f=_0x4a693f||0xc8;return function(_0x233bf0){if(_0x233bf0){return _0x3c5802[_0x687e('0x14')](_0x4a693f)[_0x687e('0x15')](_0x233bf0);}};}function respondWithFilteredResult(_0x4b4d8a,_0x191332){return function(_0x1e65b5){if(_0x1e65b5){var _0x4c3541=typeof _0x191332['offset']===_0x687e('0x16')&&typeof _0x191332['limit']===_0x687e('0x16');var _0x4c0410=_0x1e65b5['count'];var _0xe4124f=_0x4c3541?0x0:_0x191332['offset'];var _0x28ed2f=_0x4c3541?_0x1e65b5[_0x687e('0x17')]:_0x191332['offset']+_0x191332['limit'];var _0x281dc1;if(_0x28ed2f>=_0x4c0410){_0x28ed2f=_0x4c0410;_0x281dc1=0xc8;}else{_0x281dc1=0xce;}_0x4b4d8a[_0x687e('0x14')](_0x281dc1);return _0x4b4d8a[_0x687e('0x18')](_0x687e('0x19'),_0xe4124f+'-'+_0x28ed2f+'/'+_0x4c0410)['json'](_0x1e65b5);}return null;};}function saveUpdates(_0x44db91){return function(_0x243ffe){if(_0x243ffe){return _0x243ffe[_0x687e('0x1a')](_0x44db91)[_0x687e('0x1b')](function(_0xdbe6d2){return _0xdbe6d2;});}return null;};}function removeEntity(_0x39e399){return function(_0x292386){if(_0x292386){return _0x292386[_0x687e('0x1c')]()[_0x687e('0x1b')](function(){_0x39e399[_0x687e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13e549){return function(_0x39085a){if(!_0x39085a){_0x13e549[_0x687e('0x13')](0x194);}return _0x39085a;};}function handleError(_0x50ac91,_0x3d4adc){_0x3d4adc=_0x3d4adc||0x1f4;return function(_0x21f94e){logger['error'](_0x21f94e[_0x687e('0x1d')]);if(_0x21f94e['name']){delete _0x21f94e['name'];}_0x50ac91[_0x687e('0x14')](_0x3d4adc)['send'](_0x21f94e);};}exports[_0x687e('0x1e')]=function(_0x3951f2,_0x2317fd){var _0x40ef2f={};var _0x288280=_['map'](db[_0x687e('0x1f')][_0x687e('0x20')],function(_0x5a3771){return{'name':_0x5a3771[_0x687e('0x21')],'type':_0x5a3771['type'][_0x687e('0x22')]};});_0x40ef2f=qs['getOptions'](_0x288280,_0x3951f2);return interaction[_0x687e('0x23')](_0x687e('0x24'),_0x3951f2['query'],_0x3951f2[_0x687e('0x25')],_0x40ef2f,_0x288280)[_0x687e('0x1b')](respondWithFilteredResult(_0x2317fd,_0x40ef2f))[_0x687e('0x26')](handleError(_0x2317fd,null));};exports[_0x687e('0x27')]=function(_0x17557b,_0x26977a){var _0x361909={'raw':![],'where':{'id':_0x17557b[_0x687e('0x28')]['id']}},_0x40be41={};_0x40be41[_0x687e('0x29')]=_[_0x687e('0x2a')](db['WhatsappInteraction']['rawAttributes']);_0x40be41[_0x687e('0x2b')]=_[_0x687e('0x2a')](_0x17557b['query']);_0x40be41[_0x687e('0x2c')]=_[_0x687e('0x2d')](_0x40be41[_0x687e('0x29')],_0x40be41[_0x687e('0x2b')]);_0x361909[_0x687e('0x2e')]=_[_0x687e('0x2d')](_0x40be41[_0x687e('0x29')],qs[_0x687e('0x2f')](_0x17557b['query']['fields']));_0x361909['attributes']=_0x361909[_0x687e('0x2e')][_0x687e('0x30')]?_0x361909[_0x687e('0x2e')]:_0x40be41[_0x687e('0x29')];if(_0x17557b['query'][_0x687e('0x31')]){_0x361909[_0x687e('0x32')]=[{'all':!![]}];}_0x361909=_['merge']({},_0x361909,_0x17557b[_0x687e('0x33')]);return db[_0x687e('0x1f')]['find'](_0x361909)[_0x687e('0x1b')](handleEntityNotFound(_0x26977a,null))[_0x687e('0x1b')](respondWithResult(_0x26977a,null))[_0x687e('0x26')](handleError(_0x26977a,null));};exports[_0x687e('0x34')]=function(_0x214fd2,_0x165124){return db[_0x687e('0x1f')][_0x687e('0x34')](_0x214fd2['body'],{})['then'](respondWithResult(_0x165124,0xc9))[_0x687e('0x26')](handleError(_0x165124,null));};exports['update']=function(_0x878267,_0x36bf4a){if(_0x878267['body']['id']){delete _0x878267['body']['id'];}return db[_0x687e('0x1f')]['find']({'where':{'id':_0x878267[_0x687e('0x28')]['id']}})['then'](handleEntityNotFound(_0x36bf4a,null))[_0x687e('0x1b')](saveUpdates(_0x878267['body'],null))[_0x687e('0x1b')](respondWithResult(_0x36bf4a,null))['catch'](handleError(_0x36bf4a,null));};exports[_0x687e('0x1c')]=function(_0x1cbb2e,_0x5d5290){return db['WhatsappInteraction'][_0x687e('0x35')]({'where':{'id':_0x1cbb2e['params']['id']}})[_0x687e('0x1b')](handleEntityNotFound(_0x5d5290,null))[_0x687e('0x1b')](removeEntity(_0x5d5290,null))['catch'](handleError(_0x5d5290,null));};exports['describe']=function(_0x459cc0,_0x49763c){return db[_0x687e('0x1f')][_0x687e('0x36')]()[_0x687e('0x1b')](respondWithResult(_0x49763c,null))['catch'](handleError(_0x49763c,null));};exports[_0x687e('0x37')]=function(_0x576644,_0x38f011){return db['WhatsappMessage'][_0x687e('0x35')]({'where':{'id':_0x576644[_0x687e('0x28')]['id']}})[_0x687e('0x1b')](handleEntityNotFound(_0x38f011,null))[_0x687e('0x1b')](function(_0xdd1b1f){if(_0xdd1b1f){return _0xdd1b1f[_0x687e('0x37')](_0x576644[_0x687e('0x38')][_0x687e('0x39')],_[_0x687e('0x3a')](_0x576644[_0x687e('0x38')],['ids','id'])||{});}})[_0x687e('0x1b')](respondWithResult(_0x38f011,null))[_0x687e('0x26')](handleError(_0x38f011,null));};exports[_0x687e('0x3b')]=function(_0x11a72f,_0x602911){var _0x40a7b4={'raw':![],'where':{}};var _0x578c42={};var _0x46f330={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x11a72f[_0x687e('0x28')]['id']}})[_0x687e('0x1b')](handleEntityNotFound(_0x602911,null))[_0x687e('0x1b')](function(_0x4b87c1){if(_0x4b87c1){_0x578c42['model']=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x578c42[_0x687e('0x2b')]=_[_0x687e('0x2a')](_0x11a72f[_0x687e('0x2b')]);_0x578c42['filters']=_[_0x687e('0x2d')](_0x578c42[_0x687e('0x29')],_0x578c42[_0x687e('0x2b')]);_0x40a7b4[_0x687e('0x2e')]=_[_0x687e('0x2d')](_0x578c42['model'],qs[_0x687e('0x2f')](_0x11a72f[_0x687e('0x2b')][_0x687e('0x2f')]));_0x40a7b4[_0x687e('0x2e')]=_0x40a7b4[_0x687e('0x2e')][_0x687e('0x30')]?_0x40a7b4[_0x687e('0x2e')]:_0x578c42[_0x687e('0x29')];if(!_0x11a72f[_0x687e('0x2b')][_0x687e('0x3c')](_0x687e('0x3d'))){_0x40a7b4[_0x687e('0x3e')]=qs[_0x687e('0x3e')](_0x11a72f['query'][_0x687e('0x3e')]);_0x40a7b4['offset']=qs[_0x687e('0x3f')](_0x11a72f[_0x687e('0x2b')][_0x687e('0x3f')]);}_0x40a7b4[_0x687e('0x40')]=qs[_0x687e('0x41')](_0x11a72f['query'][_0x687e('0x41')]);_0x40a7b4[_0x687e('0x42')]=qs[_0x687e('0x2c')](_['pick'](_0x11a72f[_0x687e('0x2b')],_0x578c42[_0x687e('0x2c')]));_0x40a7b4['where']['WhatsappInteractionId']=_0x4b87c1['id'];if(_0x11a72f[_0x687e('0x2b')][_0x687e('0x43')]){_0x40a7b4[_0x687e('0x42')]=_[_0x687e('0x44')](_0x40a7b4[_0x687e('0x42')],{'$or':_['map'](_0x40a7b4[_0x687e('0x2e')],function(_0x1d2cf2){var _0x116c00={};_0x116c00[_0x1d2cf2]={'$like':'%'+_0x11a72f[_0x687e('0x2b')]['filter']+'%'};return _0x116c00;})});}if(_0x11a72f[_0x687e('0x2b')][_0x687e('0x45')]){var _0x12b958=_0x11a72f[_0x687e('0x2b')][_0x687e('0x45')]['split'](',');var _0x5404f9={};_0x5404f9[_0x12b958[0x0]]={'$gte':moment(_0x12b958[0x1])[_0x687e('0x46')]('YYYY-MM-DD\x20HH:mm:ss')};_0x40a7b4['where']=_[_0x687e('0x44')](_0x40a7b4[_0x687e('0x42')],_0x5404f9);}_0x40a7b4=_[_0x687e('0x44')]({},_0x40a7b4,_0x11a72f[_0x687e('0x33')]);return db[_0x687e('0x47')][_0x687e('0x17')]({'where':_0x40a7b4[_0x687e('0x42')]})[_0x687e('0x1b')](function(_0x84dd5e){_0x46f330[_0x687e('0x17')]=_0x84dd5e;if(_0x11a72f[_0x687e('0x2b')][_0x687e('0x31')]){_0x40a7b4[_0x687e('0x32')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x687e('0x23')](_0x40a7b4);})[_0x687e('0x1b')](function(_0x2bbe83){_0x46f330[_0x687e('0x48')]=_0x2bbe83;return _0x46f330;});}})['then'](respondWithFilteredResult(_0x602911,_0x40a7b4))['catch'](handleError(_0x602911,null));};exports[_0x687e('0x49')]=function(_0x440dfa,_0x2b0074){return db[_0x687e('0x1f')]['find']({'where':{'id':_0x440dfa[_0x687e('0x28')]['id']}})[_0x687e('0x1b')](handleEntityNotFound(_0x2b0074,null))[_0x687e('0x1b')](function(_0x54b8e1){if(_0x54b8e1){return _0x54b8e1[_0x687e('0x4a')](_0x440dfa[_0x687e('0x38')]['ids'],_[_0x687e('0x3a')](_0x440dfa['body'],[_0x687e('0x39'),'id'])||{})[_0x687e('0x4b')](function(){return db[_0x687e('0x4c')][_0x687e('0x23')]({'attributes':['id',_0x687e('0x4d'),'color'],'where':{'id':_0x440dfa[_0x687e('0x38')]['ids']}});})['then'](function(_0x2d6142){socket[_0x687e('0x4e')](_0x687e('0x4f'),{'id':Number(_0x440dfa['params']['id']),'tags':_0x2d6142||[]});return{'id':Number(_0x440dfa[_0x687e('0x28')]['id']),'tags':_0x2d6142||[]};});}})[_0x687e('0x1b')](respondWithResult(_0x2b0074,null))[_0x687e('0x26')](handleError(_0x2b0074,null));};exports[_0x687e('0x50')]=function(_0x279268,_0x27ec49){return db[_0x687e('0x1f')][_0x687e('0x35')]({'where':{'id':_0x279268[_0x687e('0x28')]['id']}})['then'](handleEntityNotFound(_0x27ec49,null))[_0x687e('0x1b')](function(_0x147ca1){if(_0x147ca1){return _0x147ca1['removeTags'](_0x279268['query'][_0x687e('0x39')]);}})[_0x687e('0x1b')](respondWithStatusCode(_0x27ec49,null))[_0x687e('0x26')](handleError(_0x27ec49,null));};exports[_0x687e('0x51')]=function(_0x4143e5,_0x39faca){var _0x4aaf40=moment()[_0x687e('0x52')]()[_0x687e('0x53')]();var _0x393e61=path[_0x687e('0x54')](config[_0x687e('0x55')],_0x687e('0x56'),_0x687e('0x57'),_0x687e('0x58'));var _0x350c24=path[_0x687e('0x54')](config[_0x687e('0x55')],_0x687e('0x56'),_0x687e('0x57'),_0x687e('0x59'));var _0x31b528=path[_0x687e('0x54')](_0x393e61,_0x4aaf40);var _0x14a1e5=util[_0x687e('0x46')]('transcript-%d-%s.zip',_0x4143e5[_0x687e('0x28')]['id'],_0x4aaf40);var _0x5068c7=path[_0x687e('0x54')](_0x393e61,_0x14a1e5);var _0x9ddc0b=[];_0x9ddc0b[_0x687e('0x5a')]({'model':db[_0x687e('0x5b')],'as':_0x687e('0x5b'),'attributes':['id',_0x687e('0x5c')],'raw':!![]});_0x9ddc0b['push']({'model':db['CmContact'],'as':_0x687e('0x5d'),'attributes':['id',_0x687e('0x5e'),_0x687e('0x5f')],'raw':!![]});if(_0x4143e5[_0x687e('0x2b')][_0x687e('0x59')]){_0x9ddc0b[_0x687e('0x5a')]({'model':db[_0x687e('0x60')],'as':'Attachment','raw':!![]});}var _0x3880ec=[{'model':db[_0x687e('0x47')],'as':_0x687e('0x61'),'attributes':['id','body',_0x687e('0x62'),_0x687e('0x63'),_0x687e('0x64'),_0x687e('0x65')],'include':_0x9ddc0b}];_0x3880ec[_0x687e('0x5a')]({'model':db['WhatsappAccount'],'as':_0x687e('0x66'),'attributes':['id',_0x687e('0x4d')]});_0x3880ec[_0x687e('0x5a')]({'model':db[_0x687e('0x5b')],'as':_0x687e('0x67'),'attributes':['id',_0x687e('0x5c')]});return db['WhatsappInteraction'][_0x687e('0x35')]({'where':{'id':_0x4143e5[_0x687e('0x28')]['id']},'include':_0x3880ec})[_0x687e('0x1b')](handleEntityNotFound(_0x39faca,null))[_0x687e('0x1b')](function(_0x1c4908){if(_0x1c4908){var _0x3d7111=_0x1c4908[_0x687e('0x68')]({'plain':!![]});fs[_0x687e('0x69')](_0x31b528);var _0x3df30e={'channel':_0x687e('0x6a'),'account':_0x3d7111[_0x687e('0x66')][_0x687e('0x4d')],'agent':_0x3d7111[_0x687e('0x67')]?_0x3d7111['Owner'][_0x687e('0x5c')]:_0x687e('0x6b'),'createdAt':moment(_0x3d7111[_0x687e('0x62')])[_0x687e('0x46')](_0x687e('0x6c'))[_0x687e('0x53')](),'closedAt':_0x3d7111[_0x687e('0x6d')]?moment(_0x3d7111['closedAt'])[_0x687e('0x46')](_0x687e('0x6c'))['toString']():'','disposition':_0x3d7111[_0x687e('0x6e')],'messages':_(_0x3d7111[_0x687e('0x61')])[_0x687e('0x43')]({'secret':![]})[_0x687e('0x6f')](function(_0x54a789){if(_0x54a789[_0x687e('0x60')]){var _0x44f34d=path[_0x687e('0x54')](_0x350c24,_0x54a789[_0x687e('0x60')][_0x687e('0x70')]);if(fs[_0x687e('0x71')](_0x44f34d)){fs[_0x687e('0x72')](_0x44f34d)[_0x687e('0x73')](fs['createWriteStream'](path[_0x687e('0x54')](_0x31b528,_0x54a789['Attachment'][_0x687e('0x70')])));}}return{'date':moment(_0x54a789[_0x687e('0x62')])['format'](_0x687e('0x6c'))[_0x687e('0x53')](),'sender':_0x54a789[_0x687e('0x63')]===_0x687e('0x74')?_0x54a789[_0x687e('0x5b')]?_0x54a789[_0x687e('0x5b')][_0x687e('0x5c')]:_0x687e('0x75'):_0x54a789['Contact'][_0x687e('0x5e')]+(_0x54a789[_0x687e('0x5d')]['lastName']?'\x20'+_0x54a789['Contact'][_0x687e('0x5f')]:''),'body':_0x54a789[_0x687e('0x60')]?_0x54a789['Attachment'][_0x687e('0x70')]:_0x54a789[_0x687e('0x38')],'direction':_0x54a789['direction']===_0x687e('0x74')?'A':'C','secret':_0x54a789[_0x687e('0x64')],'read':_0x54a789[_0x687e('0x65')],'attachment':_0x54a789['Attachment']};})[_0x687e('0x76')]()};return ejs[_0x687e('0x77')](path[_0x687e('0x54')](config[_0x687e('0x55')],_0x687e('0x56'),'views','downloadInteraction.ejs'),{'interaction':_0x3df30e})[_0x687e('0x1b')](function(_0x25bd57){var _0x5a1553=path[_0x687e('0x54')](_0x31b528,_0x687e('0x78')+_0x3d7111['id']+'-'+_0x4aaf40+_0x687e('0x79'));var _0x4d56f0={'path':_0x5a1553,'channel':_0x687e('0x6a'),'interactionId':_0x3d7111['id']};return pdf[_0x687e('0x7a')](_0x25bd57,_0x4d56f0);})[_0x687e('0x1b')](function(){return new BPromise(function(_0x49d536,_0xdac459){zipdir(_0x31b528,{'saveTo':_0x5068c7},function(_0xc85763,_0x568237){if(_0xc85763)return _0xdac459(_0xc85763);return _0x49d536(_0x568237);});})[_0x687e('0x1b')](function(){return new BPromise(function(_0x1c63ee,_0x5083bc){rimraf(_0x31b528,function(_0x318542){if(_0x318542)_0x5083bc(_0x318542);return _0x1c63ee();});});})[_0x687e('0x1b')](function(){return _0x39faca[_0x687e('0x51')](_0x5068c7,_0x14a1e5,function(_0x582052){if(_0x582052){console['log'](_0x687e('0x7b'),_0x582052);}else{fs[_0x687e('0x7c')](_0x5068c7);}});});});}else{return _0x39faca['sendStatus'](0xc8);}})['catch'](handleError(_0x39faca,null));}; \ No newline at end of file +var _0x1cce=['path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','then','destroy','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','type','key','getOptions','findAll','whatsapp','query','show','params','keys','filters','intersection','attributes','model','fields','length','includeAll','include','options','create','body','catch','describe','addMessage','WhatsappMessage','find','omit','ids','getMessages','hasOwnProperty','nolimit','order','where','pick','WhatsappInteractionId','filter','merge','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','push','User','Contact','firstName','lastName','Attachment','Messages','createdAt','Account','Owner','fullname','mkdirSync','Whatsapp','N.A.','toString','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','secret','read','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0x1cce,0x7e));var _0xe1cc=function(_0x476b00,_0x250877){_0x476b00=_0x476b00-0x0;var _0x44ec8e=_0x1cce[_0x476b00];return _0x44ec8e;};'use strict';var rimraf=require(_0xe1cc('0x0'));var zipdir=require(_0xe1cc('0x1'));var moment=require(_0xe1cc('0x2'));var BPromise=require(_0xe1cc('0x3'));var util=require(_0xe1cc('0x4'));var path=require(_0xe1cc('0x5'));var ejs=require(_0xe1cc('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xe1cc('0x7'));var interaction=require(_0xe1cc('0x8'));var qs=require(_0xe1cc('0x9'));var pdf=require(_0xe1cc('0xa'));var logger=require('../../config/logger')(_0xe1cc('0xb'));var config=require(_0xe1cc('0xc'));var db=require(_0xe1cc('0xd'))['db'];config[_0xe1cc('0xe')]=_[_0xe1cc('0xf')](config[_0xe1cc('0xe')],{'host':_0xe1cc('0x10'),'port':0x18eb});var socket=require(_0xe1cc('0x11'))(new Redis(config[_0xe1cc('0xe')]));require(_0xe1cc('0x12'))[_0xe1cc('0x13')](socket);function respondWithStatusCode(_0x3327bc,_0x14a93a){_0x14a93a=_0x14a93a||0xcc;return function(_0x212c3a){if(_0x212c3a){return _0x3327bc[_0xe1cc('0x14')](_0x14a93a);}return _0x3327bc[_0xe1cc('0x15')](_0x14a93a)[_0xe1cc('0x16')]();};}function respondWithResult(_0x1b8c7d,_0x458b61){_0x458b61=_0x458b61||0xc8;return function(_0x1f61eb){if(_0x1f61eb){return _0x1b8c7d['status'](_0x458b61)[_0xe1cc('0x17')](_0x1f61eb);}};}function respondWithFilteredResult(_0x2a8341,_0x4a5cbe){return function(_0x28b38d){if(_0x28b38d){var _0x3d3340=typeof _0x4a5cbe[_0xe1cc('0x18')]==='undefined'&&typeof _0x4a5cbe[_0xe1cc('0x19')]===_0xe1cc('0x1a');var _0x4e5c3a=_0x28b38d['count'];var _0x571d13=_0x3d3340?0x0:_0x4a5cbe[_0xe1cc('0x18')];var _0xb45115=_0x3d3340?_0x28b38d[_0xe1cc('0x1b')]:_0x4a5cbe[_0xe1cc('0x18')]+_0x4a5cbe[_0xe1cc('0x19')];var _0x5dd612;if(_0xb45115>=_0x4e5c3a){_0xb45115=_0x4e5c3a;_0x5dd612=0xc8;}else{_0x5dd612=0xce;}_0x2a8341[_0xe1cc('0x15')](_0x5dd612);return _0x2a8341['set'](_0xe1cc('0x1c'),_0x571d13+'-'+_0xb45115+'/'+_0x4e5c3a)[_0xe1cc('0x17')](_0x28b38d);}return null;};}function saveUpdates(_0x2a6543){return function(_0x1ab552){if(_0x1ab552){return _0x1ab552[_0xe1cc('0x1d')](_0x2a6543)[_0xe1cc('0x1e')](function(_0x348aa0){return _0x348aa0;});}return null;};}function removeEntity(_0x100cfc){return function(_0x31b05b){if(_0x31b05b){return _0x31b05b[_0xe1cc('0x1f')]()[_0xe1cc('0x1e')](function(){_0x100cfc[_0xe1cc('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbbab5a){return function(_0x1cb52b){if(!_0x1cb52b){_0xbbab5a[_0xe1cc('0x14')](0x194);}return _0x1cb52b;};}function handleError(_0x53717a,_0x1a531e){_0x1a531e=_0x1a531e||0x1f4;return function(_0xaa6964){logger[_0xe1cc('0x20')](_0xaa6964[_0xe1cc('0x21')]);if(_0xaa6964['name']){delete _0xaa6964[_0xe1cc('0x22')];}_0x53717a[_0xe1cc('0x15')](_0x1a531e)[_0xe1cc('0x23')](_0xaa6964);};}exports[_0xe1cc('0x24')]=function(_0xbccc7c,_0x151952){var _0x48aa38={};var _0x116fb2=_[_0xe1cc('0x25')](db[_0xe1cc('0x26')][_0xe1cc('0x27')],function(_0x476095){return{'name':_0x476095['fieldName'],'type':_0x476095[_0xe1cc('0x28')][_0xe1cc('0x29')]};});_0x48aa38=qs[_0xe1cc('0x2a')](_0x116fb2,_0xbccc7c);return interaction[_0xe1cc('0x2b')](_0xe1cc('0x2c'),_0xbccc7c[_0xe1cc('0x2d')],_0xbccc7c['user'],_0x48aa38,_0x116fb2)[_0xe1cc('0x1e')](respondWithFilteredResult(_0x151952,_0x48aa38))['catch'](handleError(_0x151952,null));};exports[_0xe1cc('0x2e')]=function(_0x36c31f,_0x58f279){var _0x57bf8a={'raw':![],'where':{'id':_0x36c31f[_0xe1cc('0x2f')]['id']}},_0x56a707={};_0x56a707['model']=_[_0xe1cc('0x30')](db[_0xe1cc('0x26')]['rawAttributes']);_0x56a707[_0xe1cc('0x2d')]=_[_0xe1cc('0x30')](_0x36c31f[_0xe1cc('0x2d')]);_0x56a707[_0xe1cc('0x31')]=_[_0xe1cc('0x32')](_0x56a707['model'],_0x56a707[_0xe1cc('0x2d')]);_0x57bf8a[_0xe1cc('0x33')]=_[_0xe1cc('0x32')](_0x56a707[_0xe1cc('0x34')],qs[_0xe1cc('0x35')](_0x36c31f['query'][_0xe1cc('0x35')]));_0x57bf8a[_0xe1cc('0x33')]=_0x57bf8a['attributes'][_0xe1cc('0x36')]?_0x57bf8a[_0xe1cc('0x33')]:_0x56a707[_0xe1cc('0x34')];if(_0x36c31f[_0xe1cc('0x2d')][_0xe1cc('0x37')]){_0x57bf8a[_0xe1cc('0x38')]=[{'all':!![]}];}_0x57bf8a=_['merge']({},_0x57bf8a,_0x36c31f[_0xe1cc('0x39')]);return db[_0xe1cc('0x26')]['find'](_0x57bf8a)['then'](handleEntityNotFound(_0x58f279,null))[_0xe1cc('0x1e')](respondWithResult(_0x58f279,null))['catch'](handleError(_0x58f279,null));};exports[_0xe1cc('0x3a')]=function(_0x5996db,_0x45b364){return db[_0xe1cc('0x26')]['create'](_0x5996db[_0xe1cc('0x3b')],{})[_0xe1cc('0x1e')](respondWithResult(_0x45b364,0xc9))[_0xe1cc('0x3c')](handleError(_0x45b364,null));};exports['update']=function(_0x57ff81,_0x9bf969){if(_0x57ff81[_0xe1cc('0x3b')]['id']){delete _0x57ff81['body']['id'];}return db[_0xe1cc('0x26')]['find']({'where':{'id':_0x57ff81[_0xe1cc('0x2f')]['id']}})['then'](handleEntityNotFound(_0x9bf969,null))['then'](saveUpdates(_0x57ff81[_0xe1cc('0x3b')],null))['then'](respondWithResult(_0x9bf969,null))['catch'](handleError(_0x9bf969,null));};exports[_0xe1cc('0x1f')]=function(_0x528a2b,_0x93dc51){return db[_0xe1cc('0x26')]['find']({'where':{'id':_0x528a2b['params']['id']}})[_0xe1cc('0x1e')](handleEntityNotFound(_0x93dc51,null))['then'](removeEntity(_0x93dc51,null))[_0xe1cc('0x3c')](handleError(_0x93dc51,null));};exports['describe']=function(_0x44eeb1,_0x56dfd5){return db[_0xe1cc('0x26')][_0xe1cc('0x3d')]()[_0xe1cc('0x1e')](respondWithResult(_0x56dfd5,null))[_0xe1cc('0x3c')](handleError(_0x56dfd5,null));};exports[_0xe1cc('0x3e')]=function(_0x5b41fd,_0x2676f1){return db[_0xe1cc('0x3f')][_0xe1cc('0x40')]({'where':{'id':_0x5b41fd[_0xe1cc('0x2f')]['id']}})[_0xe1cc('0x1e')](handleEntityNotFound(_0x2676f1,null))[_0xe1cc('0x1e')](function(_0x46c48e){if(_0x46c48e){return _0x46c48e[_0xe1cc('0x3e')](_0x5b41fd['body']['ids'],_[_0xe1cc('0x41')](_0x5b41fd[_0xe1cc('0x3b')],[_0xe1cc('0x42'),'id'])||{});}})[_0xe1cc('0x1e')](respondWithResult(_0x2676f1,null))[_0xe1cc('0x3c')](handleError(_0x2676f1,null));};exports[_0xe1cc('0x43')]=function(_0x312bf9,_0x256514){var _0x597ff5={'raw':![],'where':{}};var _0x388184={};var _0xd95fac={'count':0x0,'rows':[]};return db[_0xe1cc('0x26')]['findOne']({'where':{'id':_0x312bf9[_0xe1cc('0x2f')]['id']}})[_0xe1cc('0x1e')](handleEntityNotFound(_0x256514,null))['then'](function(_0x20b7fb){if(_0x20b7fb){_0x388184['model']=_['keys'](db[_0xe1cc('0x3f')]['rawAttributes']);_0x388184['query']=_['keys'](_0x312bf9[_0xe1cc('0x2d')]);_0x388184[_0xe1cc('0x31')]=_[_0xe1cc('0x32')](_0x388184[_0xe1cc('0x34')],_0x388184[_0xe1cc('0x2d')]);_0x597ff5[_0xe1cc('0x33')]=_['intersection'](_0x388184[_0xe1cc('0x34')],qs[_0xe1cc('0x35')](_0x312bf9[_0xe1cc('0x2d')]['fields']));_0x597ff5[_0xe1cc('0x33')]=_0x597ff5[_0xe1cc('0x33')]['length']?_0x597ff5[_0xe1cc('0x33')]:_0x388184[_0xe1cc('0x34')];if(!_0x312bf9[_0xe1cc('0x2d')][_0xe1cc('0x44')](_0xe1cc('0x45'))){_0x597ff5[_0xe1cc('0x19')]=qs[_0xe1cc('0x19')](_0x312bf9[_0xe1cc('0x2d')][_0xe1cc('0x19')]);_0x597ff5['offset']=qs[_0xe1cc('0x18')](_0x312bf9[_0xe1cc('0x2d')]['offset']);}_0x597ff5[_0xe1cc('0x46')]=qs['sort'](_0x312bf9['query']['sort']);_0x597ff5[_0xe1cc('0x47')]=qs[_0xe1cc('0x31')](_[_0xe1cc('0x48')](_0x312bf9[_0xe1cc('0x2d')],_0x388184[_0xe1cc('0x31')]));_0x597ff5['where'][_0xe1cc('0x49')]=_0x20b7fb['id'];if(_0x312bf9[_0xe1cc('0x2d')][_0xe1cc('0x4a')]){_0x597ff5[_0xe1cc('0x47')]=_[_0xe1cc('0x4b')](_0x597ff5[_0xe1cc('0x47')],{'$or':_[_0xe1cc('0x25')](_0x597ff5[_0xe1cc('0x33')],function(_0x3fbac5){var _0x4fff46={};_0x4fff46[_0x3fbac5]={'$like':'%'+_0x312bf9[_0xe1cc('0x2d')][_0xe1cc('0x4a')]+'%'};return _0x4fff46;})});}if(_0x312bf9[_0xe1cc('0x2d')]['$gte']){var _0x754fa0=_0x312bf9[_0xe1cc('0x2d')]['$gte']['split'](',');var _0x3b8a66={};_0x3b8a66[_0x754fa0[0x0]]={'$gte':moment(_0x754fa0[0x1])[_0xe1cc('0x4c')](_0xe1cc('0x4d'))};_0x597ff5[_0xe1cc('0x47')]=_['merge'](_0x597ff5[_0xe1cc('0x47')],_0x3b8a66);}_0x597ff5=_[_0xe1cc('0x4b')]({},_0x597ff5,_0x312bf9[_0xe1cc('0x39')]);return db[_0xe1cc('0x3f')]['count']({'where':_0x597ff5[_0xe1cc('0x47')]})['then'](function(_0x547fe9){_0xd95fac[_0xe1cc('0x1b')]=_0x547fe9;if(_0x312bf9['query'][_0xe1cc('0x37')]){_0x597ff5['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xe1cc('0x2b')](_0x597ff5);})[_0xe1cc('0x1e')](function(_0x4e4d7e){_0xd95fac[_0xe1cc('0x4e')]=_0x4e4d7e;return _0xd95fac;});}})[_0xe1cc('0x1e')](respondWithFilteredResult(_0x256514,_0x597ff5))[_0xe1cc('0x3c')](handleError(_0x256514,null));};exports[_0xe1cc('0x4f')]=function(_0x4e2c2e,_0x5cb2d2){return db[_0xe1cc('0x26')][_0xe1cc('0x40')]({'where':{'id':_0x4e2c2e[_0xe1cc('0x2f')]['id']}})['then'](handleEntityNotFound(_0x5cb2d2,null))['then'](function(_0x49382f){if(_0x49382f){return _0x49382f['setTags'](_0x4e2c2e[_0xe1cc('0x3b')][_0xe1cc('0x42')],_[_0xe1cc('0x41')](_0x4e2c2e[_0xe1cc('0x3b')],['ids','id'])||{})[_0xe1cc('0x50')](function(){return db[_0xe1cc('0x51')]['findAll']({'attributes':['id',_0xe1cc('0x22'),_0xe1cc('0x52')],'where':{'id':_0x4e2c2e['body'][_0xe1cc('0x42')]}});})[_0xe1cc('0x1e')](function(_0x58a1c8){socket[_0xe1cc('0x53')](_0xe1cc('0x54'),{'id':Number(_0x4e2c2e['params']['id']),'tags':_0x58a1c8||[]});return{'id':Number(_0x4e2c2e['params']['id']),'tags':_0x58a1c8||[]};});}})['then'](respondWithResult(_0x5cb2d2,null))[_0xe1cc('0x3c')](handleError(_0x5cb2d2,null));};exports[_0xe1cc('0x55')]=function(_0x42da72,_0x298c12){return db['WhatsappInteraction']['find']({'where':{'id':_0x42da72[_0xe1cc('0x2f')]['id']}})[_0xe1cc('0x1e')](handleEntityNotFound(_0x298c12,null))[_0xe1cc('0x1e')](function(_0x14a222){if(_0x14a222){return _0x14a222['removeTags'](_0x42da72[_0xe1cc('0x2d')]['ids']);}})[_0xe1cc('0x1e')](respondWithStatusCode(_0x298c12,null))[_0xe1cc('0x3c')](handleError(_0x298c12,null));};exports[_0xe1cc('0x56')]=function(_0x3b4cbd,_0x54d018){var _0x279c80=moment()['unix']()['toString']();var _0x3f9960=path[_0xe1cc('0x57')](config['root'],_0xe1cc('0x58'),_0xe1cc('0x59'),_0xe1cc('0x5a'));var _0x1c380f=path['join'](config[_0xe1cc('0x5b')],'server',_0xe1cc('0x59'),_0xe1cc('0x5c'));var _0x1910a7=path[_0xe1cc('0x57')](_0x3f9960,_0x279c80);var _0x13d9ae=util[_0xe1cc('0x4c')](_0xe1cc('0x5d'),_0x3b4cbd[_0xe1cc('0x2f')]['id'],_0x279c80);var _0xe5606=path['join'](_0x3f9960,_0x13d9ae);var _0xbdddfa=[];_0xbdddfa[_0xe1cc('0x5e')]({'model':db[_0xe1cc('0x5f')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0xbdddfa['push']({'model':db['CmContact'],'as':_0xe1cc('0x60'),'attributes':['id',_0xe1cc('0x61'),_0xe1cc('0x62')],'raw':!![]});if(_0x3b4cbd[_0xe1cc('0x2d')][_0xe1cc('0x5c')]){_0xbdddfa[_0xe1cc('0x5e')]({'model':db['Attachment'],'as':_0xe1cc('0x63'),'raw':!![]});}var _0x508eb1=[{'model':db[_0xe1cc('0x3f')],'as':_0xe1cc('0x64'),'attributes':['id',_0xe1cc('0x3b'),_0xe1cc('0x65'),'direction','secret','read'],'include':_0xbdddfa}];_0x508eb1[_0xe1cc('0x5e')]({'model':db['WhatsappAccount'],'as':_0xe1cc('0x66'),'attributes':['id',_0xe1cc('0x22')]});_0x508eb1[_0xe1cc('0x5e')]({'model':db[_0xe1cc('0x5f')],'as':_0xe1cc('0x67'),'attributes':['id',_0xe1cc('0x68')]});return db[_0xe1cc('0x26')]['find']({'where':{'id':_0x3b4cbd[_0xe1cc('0x2f')]['id']},'include':_0x508eb1})[_0xe1cc('0x1e')](handleEntityNotFound(_0x54d018,null))[_0xe1cc('0x1e')](function(_0x1ed5c6){if(_0x1ed5c6){var _0x267449=_0x1ed5c6['get']({'plain':!![]});fs[_0xe1cc('0x69')](_0x1910a7);var _0x22f88b={'channel':_0xe1cc('0x6a'),'account':_0x267449[_0xe1cc('0x66')][_0xe1cc('0x22')],'agent':_0x267449[_0xe1cc('0x67')]?_0x267449['Owner'][_0xe1cc('0x68')]:_0xe1cc('0x6b'),'createdAt':moment(_0x267449[_0xe1cc('0x65')])[_0xe1cc('0x4c')](_0xe1cc('0x4d'))[_0xe1cc('0x6c')](),'closedAt':_0x267449[_0xe1cc('0x6d')]?moment(_0x267449[_0xe1cc('0x6e')])['format'](_0xe1cc('0x4d'))['toString']():'','disposition':_0x267449[_0xe1cc('0x6f')],'messages':_(_0x267449[_0xe1cc('0x64')])[_0xe1cc('0x4a')]({'secret':![]})[_0xe1cc('0x25')](function(_0x5331af){if(_0x5331af['Attachment']){var _0x8059b3=path[_0xe1cc('0x57')](_0x1c380f,_0x5331af[_0xe1cc('0x63')][_0xe1cc('0x70')]);if(fs[_0xe1cc('0x71')](_0x8059b3)){fs[_0xe1cc('0x72')](_0x8059b3)[_0xe1cc('0x73')](fs[_0xe1cc('0x74')](path[_0xe1cc('0x57')](_0x1910a7,_0x5331af['Attachment']['basename'])));}}return{'date':moment(_0x5331af[_0xe1cc('0x65')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x5331af[_0xe1cc('0x75')]===_0xe1cc('0x76')?_0x5331af[_0xe1cc('0x5f')]?_0x5331af[_0xe1cc('0x5f')]['fullname']:_0xe1cc('0x77'):_0x5331af[_0xe1cc('0x60')][_0xe1cc('0x61')]+(_0x5331af[_0xe1cc('0x60')][_0xe1cc('0x62')]?'\x20'+_0x5331af[_0xe1cc('0x60')][_0xe1cc('0x62')]:''),'body':_0x5331af[_0xe1cc('0x63')]?_0x5331af[_0xe1cc('0x63')][_0xe1cc('0x70')]:_0x5331af[_0xe1cc('0x3b')],'direction':_0x5331af['direction']===_0xe1cc('0x76')?'A':'C','secret':_0x5331af[_0xe1cc('0x78')],'read':_0x5331af[_0xe1cc('0x79')],'attachment':_0x5331af['Attachment']};})[_0xe1cc('0x7a')]()};return ejs[_0xe1cc('0x7b')](path[_0xe1cc('0x57')](config[_0xe1cc('0x5b')],_0xe1cc('0x58'),_0xe1cc('0x7c'),_0xe1cc('0x7d')),{'interaction':_0x22f88b})[_0xe1cc('0x1e')](function(_0xd41f23){var _0x3d21e1=path['join'](_0x1910a7,_0xe1cc('0x7e')+_0x267449['id']+'-'+_0x279c80+'.pdf');var _0x240d68={'path':_0x3d21e1,'channel':'Whatsapp','interactionId':_0x267449['id']};return pdf[_0xe1cc('0x7f')](_0xd41f23,_0x240d68);})[_0xe1cc('0x1e')](function(){return new BPromise(function(_0x46ef60,_0x8d01b9){zipdir(_0x1910a7,{'saveTo':_0xe5606},function(_0x3f0cbe,_0x5db10f){if(_0x3f0cbe)return _0x8d01b9(_0x3f0cbe);return _0x46ef60(_0x5db10f);});})[_0xe1cc('0x1e')](function(){return new BPromise(function(_0x90624e,_0x259f46){rimraf(_0x1910a7,function(_0x191276){if(_0x191276)_0x259f46(_0x191276);return _0x90624e();});});})[_0xe1cc('0x1e')](function(){return _0x54d018[_0xe1cc('0x56')](_0xe5606,_0x13d9ae,function(_0x103b92){if(_0x103b92){console[_0xe1cc('0x80')](_0xe1cc('0x81'),_0x103b92);}else{fs[_0xe1cc('0x82')](_0xe5606);}});});});}else{return _0x54d018[_0xe1cc('0x14')](0xc8);}})[_0xe1cc('0x3c')](handleError(_0x54d018,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 74ad4d5..e6da052 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 _0x9bde=['exports','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','hasOwnProperty','hook'];(function(_0x3a4318,_0x13c6eb){var _0x36d746=function(_0x508617){while(--_0x508617){_0x3a4318['push'](_0x3a4318['shift']());}};_0x36d746(++_0x13c6eb);}(_0x9bde,0xe1));var _0xe9bd=function(_0x243eaa,_0xb12a5e){_0x243eaa=_0x243eaa-0x0;var _0x37739e=_0x9bde[_0x243eaa];return _0x37739e;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xe9bd('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xe9bd('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xe9bd('0x1')](0x0);var events={'afterCreate':_0xe9bd('0x2'),'afterUpdate':_0xe9bd('0x3'),'afterDestroy':_0xe9bd('0x4')};function emitEvent(_0x10822d){return function(_0x1a4d14,_0x1baab1,_0x4fd7b8){_0x1a4d14[_0xe9bd('0x5')]({'attributes':['id'],'raw':!![]})[_0xe9bd('0x6')](function(_0x22a438){_0x1a4d14[_0xe9bd('0x7')](_0xe9bd('0x8'),_0x22a438[_0xe9bd('0x9')](function(_0x29bc2b){return{'id':_0x29bc2b['id']};}));return WhatsappMessage[_0xe9bd('0xa')]({'where':{'WhatsappInteractionId':_0x1a4d14['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe9bd('0x6')](function(_0x45c7ba){_0x1a4d14['setDataValue']('unreadMessages',_0x45c7ba[_0xe9bd('0xb')]);WhatsappInteractionEvents[_0xe9bd('0xc')](_0x10822d+':'+_0x1a4d14['id'],_0x1a4d14);WhatsappInteractionEvents[_0xe9bd('0xc')](_0x10822d,_0x1a4d14);_0x4fd7b8(null);})['catch'](_0x4fd7b8(null));};}for(var e in events){if(events[_0xe9bd('0xd')](e)){var event=events[e];WhatsappInteraction[_0xe9bd('0xe')](e,emitEvent(event));}}module[_0xe9bd('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x4058=['then','setDataValue','map','findAll','unreadMessages','length','emit','catch','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x4058,0x129));var _0x8405=function(_0x670f1b,_0x51e927){_0x670f1b=_0x670f1b-0x0;var _0x339c8e=_0x4058[_0x670f1b];return _0x339c8e;};'use strict';var EventEmitter=require(_0x8405('0x0'));var WhatsappInteraction=require(_0x8405('0x1'))['db'][_0x8405('0x2')];var WhatsappMessage=require(_0x8405('0x1'))['db'][_0x8405('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x8405('0x4')](0x0);var events={'afterCreate':_0x8405('0x5'),'afterUpdate':_0x8405('0x6'),'afterDestroy':_0x8405('0x7')};function emitEvent(_0x4948b2){return function(_0x5ebf0e,_0x57fb07,_0x1db7ea){_0x5ebf0e[_0x8405('0x8')]({'attributes':['id'],'raw':!![]})[_0x8405('0x9')](function(_0x1322e5){_0x5ebf0e[_0x8405('0xa')]('Users',_0x1322e5[_0x8405('0xb')](function(_0x2b1c0a){return{'id':_0x2b1c0a['id']};}));return WhatsappMessage[_0x8405('0xc')]({'where':{'WhatsappInteractionId':_0x5ebf0e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x30705f){_0x5ebf0e['setDataValue'](_0x8405('0xd'),_0x30705f[_0x8405('0xe')]);WhatsappInteractionEvents['emit'](_0x4948b2+':'+_0x5ebf0e['id'],_0x5ebf0e);WhatsappInteractionEvents[_0x8405('0xf')](_0x4948b2,_0x5ebf0e);_0x1db7ea(null);})[_0x8405('0x10')](_0x1db7ea(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 37d9f0f..2c5ff0c 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 _0x254e=['exports','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x40df2c,_0x539761){var _0x3899c5=function(_0xfe326b){while(--_0xfe326b){_0x40df2c['push'](_0x40df2c['shift']());}};_0x3899c5(++_0x539761);}(_0x254e,0x19c));var _0xe254=function(_0x5952b0,_0x2da824){_0x5952b0=_0x5952b0-0x0;var _0x54778f=_0x254e[_0x5952b0];return _0x54778f;};'use strict';var _=require(_0xe254('0x0'));var util=require(_0xe254('0x1'));var logger=require(_0xe254('0x2'))('api');var moment=require(_0xe254('0x3'));var BPromise=require(_0xe254('0x4'));var rp=require(_0xe254('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe254('0x6'));var config=require(_0xe254('0x7'));var attributes=require('./whatsappInteraction.attributes');module[_0xe254('0x8')]=function(_0x18cdb5,_0xa708d0){return _0x18cdb5['define'](_0xe254('0x9'),attributes,{'tableName':_0xe254('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b19d5,_0x1d5702,_0x3967df){if(_0x4b19d5[_0xe254('0xb')](_0xe254('0xc'))){_0x4b19d5[_0xe254('0xd')]=moment()[_0xe254('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3967df(null,_0x4b19d5);}}});}; \ No newline at end of file +var _0x1d21=['./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2c1841,_0x505204){var _0x28d148=function(_0x5be79f){while(--_0x5be79f){_0x2c1841['push'](_0x2c1841['shift']());}};_0x28d148(++_0x505204);}(_0x1d21,0x158));var _0x11d2=function(_0x3ff0f0,_0x5523bf){_0x3ff0f0=_0x3ff0f0-0x0;var _0x5dc82a=_0x1d21[_0x3ff0f0];return _0x5dc82a;};'use strict';var _=require(_0x11d2('0x0'));var util=require(_0x11d2('0x1'));var logger=require(_0x11d2('0x2'))(_0x11d2('0x3'));var moment=require('moment');var BPromise=require(_0x11d2('0x4'));var rp=require(_0x11d2('0x5'));var fs=require('fs');var path=require(_0x11d2('0x6'));var rimraf=require(_0x11d2('0x7'));var config=require('../../config/environment');var attributes=require(_0x11d2('0x8'));module[_0x11d2('0x9')]=function(_0x16e99c,_0x21a2d3){return _0x16e99c[_0x11d2('0xa')](_0x11d2('0xb'),attributes,{'tableName':_0x11d2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4d8792,_0xd6d34c,_0x7f0625){if(_0x4d8792['changed'](_0x11d2('0xd'))){_0x4d8792['closedAt']=moment()[_0x11d2('0xe')](_0x11d2('0xf'));}_0x7f0625(null,_0x4d8792);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 088d94c..06eb26b 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 _0x758c=['./whatsappInteraction.socket','register','request','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','options','raw','attributes','limit','AddTagsToWhatsappInteraction','WhatsappInteraction','find','where','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter'];(function(_0x3bd027,_0x575b9f){var _0x4d4efa=function(_0x44f9b7){while(--_0x44f9b7){_0x3bd027['push'](_0x3bd027['shift']());}};_0x4d4efa(++_0x575b9f);}(_0x758c,0x17d));var _0xc758=function(_0x3ce2fa,_0x5b8510){_0x3ce2fa=_0x3ce2fa-0x0;var _0x215728=_0x758c[_0x3ce2fa];return _0x215728;};'use strict';var _=require(_0xc758('0x0'));var util=require(_0xc758('0x1'));var moment=require('moment');var BPromise=require(_0xc758('0x2'));var rs=require(_0xc758('0x3'));var fs=require('fs');var Redis=require(_0xc758('0x4'));var db=require(_0xc758('0x5'))['db'];var utils=require(_0xc758('0x6'));var logger=require(_0xc758('0x7'))(_0xc758('0x8'));var config=require(_0xc758('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc758('0xa')][_0xc758('0xb')]({'port':0x232a});config[_0xc758('0xc')]=_['defaults'](config[_0xc758('0xc')],{'host':_0xc758('0xd'),'port':0x18eb});var socket=require(_0xc758('0xe'))(new Redis(config[_0xc758('0xc')]));require(_0xc758('0xf'))[_0xc758('0x10')](socket);function respondWithRpcPromise(_0xd02de0,_0x4bece2,_0x38e680){return new BPromise(function(_0x54b76f,_0x599d51){return client[_0xc758('0x11')](_0xd02de0,_0x38e680)[_0xc758('0x12')](function(_0x22fbac){logger[_0xc758('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x4bece2,_0xc758('0x14'));logger[_0xc758('0x15')](_0xc758('0x16'),_0x4bece2,_0xc758('0x14'),JSON[_0xc758('0x17')](_0x22fbac));if(_0x22fbac[_0xc758('0x18')]){if(_0x22fbac[_0xc758('0x18')]['code']===0x1f4){logger[_0xc758('0x18')](_0xc758('0x19'),_0x4bece2,_0x22fbac[_0xc758('0x18')][_0xc758('0x1a')]);return _0x599d51(_0x22fbac[_0xc758('0x18')][_0xc758('0x1a')]);}logger[_0xc758('0x18')](_0xc758('0x19'),_0x4bece2,_0x22fbac[_0xc758('0x18')][_0xc758('0x1a')]);return _0x54b76f(_0x22fbac['error'][_0xc758('0x1a')]);}else{logger[_0xc758('0x13')](_0xc758('0x19'),_0x4bece2,_0xc758('0x14'));_0x54b76f(_0x22fbac[_0xc758('0x1b')]['message']);}})[_0xc758('0x1c')](function(_0x536776){logger[_0xc758('0x18')](_0xc758('0x19'),_0x4bece2,_0x536776);_0x599d51(_0x536776);});});}exports[_0xc758('0x1d')]=function(_0x1dccc3){var _0x5e1ffe=this;return new Promise(function(_0x1b064e,_0x1439b2){return db['WhatsappInteraction']['update'](_0x1dccc3['body'],{'raw':_0x1dccc3[_0xc758('0x1e')]?_0x1dccc3[_0xc758('0x1e')][_0xc758('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1dccc3[_0xc758('0x1e')]?_0x1dccc3[_0xc758('0x1e')]['where']||null:null,'attributes':_0x1dccc3['options']?_0x1dccc3[_0xc758('0x1e')][_0xc758('0x20')]||null:null,'limit':_0x1dccc3[_0xc758('0x1e')]?_0x1dccc3['options'][_0xc758('0x21')]||null:null})['then'](function(_0x3369f8){logger[_0xc758('0x13')](_0xc758('0x1d'),_0x1dccc3);logger[_0xc758('0x15')]('UpdateWhatsappInteraction',_0x1dccc3,JSON['stringify'](_0x3369f8));_0x1b064e(_0x3369f8);})['catch'](function(_0x473a19){logger[_0xc758('0x18')](_0xc758('0x1d'),_0x473a19['message'],_0x1dccc3);_0x1439b2(_0x5e1ffe['error'](0x1f4,_0x473a19[_0xc758('0x1a')]));});});};exports[_0xc758('0x22')]=function(_0x409cd5){return new Promise(function(_0x5e7db3,_0x47a352){return db[_0xc758('0x23')][_0xc758('0x24')]({'where':_0x409cd5['options']?_0x409cd5['options'][_0xc758('0x25')]||null:null})['then'](function(_0x332240){if(_0x332240){return _0x332240[_0xc758('0x26')](_0x409cd5[_0xc758('0x27')][_0xc758('0x28')],_[_0xc758('0x29')](_0x409cd5[_0xc758('0x27')],['ids','id'])||{});}})[_0xc758('0x2a')](function(_0x268d6a){logger[_0xc758('0x13')](_0xc758('0x2b'),_0x409cd5);logger[_0xc758('0x15')]('AddTags',_0x409cd5,JSON[_0xc758('0x17')](_0x268d6a));_0x5e7db3(_0x268d6a);})[_0xc758('0x1c')](function(_0x10de50){logger[_0xc758('0x18')](_0xc758('0x2b'),_0x10de50[_0xc758('0x1a')],_0x409cd5);_0x47a352(_this['error'](0x1f4,_0x10de50[_0xc758('0x1a')]));});});}; \ No newline at end of file +var _0x6985=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','update','body','options','raw','where','limit','then','UpdateWhatsappInteraction','stringify','AddTagsToWhatsappInteraction','WhatsappInteraction','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x9a23df,_0x2edc93){var _0x44c94e=function(_0xb17494){while(--_0xb17494){_0x9a23df['push'](_0x9a23df['shift']());}};_0x44c94e(++_0x2edc93);}(_0x6985,0x77));var _0x5698=function(_0x27652f,_0x385de4){_0x27652f=_0x27652f-0x0;var _0x3e4ada=_0x6985[_0x27652f];return _0x3e4ada;};'use strict';var _=require(_0x5698('0x0'));var util=require(_0x5698('0x1'));var moment=require(_0x5698('0x2'));var BPromise=require(_0x5698('0x3'));var rs=require(_0x5698('0x4'));var fs=require('fs');var Redis=require(_0x5698('0x5'));var db=require(_0x5698('0x6'))['db'];var utils=require(_0x5698('0x7'));var logger=require(_0x5698('0x8'))(_0x5698('0x9'));var config=require(_0x5698('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x5698('0xb')][_0x5698('0xc')]({'port':0x232a});config[_0x5698('0xd')]=_[_0x5698('0xe')](config[_0x5698('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x5698('0xf'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x5698('0x10')](socket);function respondWithRpcPromise(_0x311e1c,_0x5f23b7,_0x2950c0){return new BPromise(function(_0x15ca84,_0x11c3ee){return client[_0x5698('0x11')](_0x311e1c,_0x2950c0)['then'](function(_0x2ea0d3){logger[_0x5698('0x12')](_0x5698('0x13'),_0x5f23b7,_0x5698('0x14'));logger[_0x5698('0x15')](_0x5698('0x16'),_0x5f23b7,_0x5698('0x14'),JSON['stringify'](_0x2ea0d3));if(_0x2ea0d3[_0x5698('0x17')]){if(_0x2ea0d3[_0x5698('0x17')][_0x5698('0x18')]===0x1f4){logger['error'](_0x5698('0x13'),_0x5f23b7,_0x2ea0d3['error'][_0x5698('0x19')]);return _0x11c3ee(_0x2ea0d3['error'][_0x5698('0x19')]);}logger[_0x5698('0x17')](_0x5698('0x13'),_0x5f23b7,_0x2ea0d3[_0x5698('0x17')][_0x5698('0x19')]);return _0x15ca84(_0x2ea0d3[_0x5698('0x17')][_0x5698('0x19')]);}else{logger['info'](_0x5698('0x13'),_0x5f23b7,_0x5698('0x14'));_0x15ca84(_0x2ea0d3['result'][_0x5698('0x19')]);}})[_0x5698('0x1a')](function(_0x4d0dbc){logger[_0x5698('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x5f23b7,_0x4d0dbc);_0x11c3ee(_0x4d0dbc);});});}exports['UpdateWhatsappInteraction']=function(_0x13736c){var _0x1b8635=this;return new Promise(function(_0x3f9f9b,_0x5012dd){return db['WhatsappInteraction'][_0x5698('0x1b')](_0x13736c[_0x5698('0x1c')],{'raw':_0x13736c[_0x5698('0x1d')]?_0x13736c[_0x5698('0x1d')][_0x5698('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13736c[_0x5698('0x1d')]?_0x13736c['options'][_0x5698('0x1f')]||null:null,'attributes':_0x13736c[_0x5698('0x1d')]?_0x13736c['options']['attributes']||null:null,'limit':_0x13736c['options']?_0x13736c[_0x5698('0x1d')][_0x5698('0x20')]||null:null})[_0x5698('0x21')](function(_0x2f3f3){logger['info'](_0x5698('0x22'),_0x13736c);logger[_0x5698('0x15')](_0x5698('0x22'),_0x13736c,JSON[_0x5698('0x23')](_0x2f3f3));_0x3f9f9b(_0x2f3f3);})['catch'](function(_0x2c725c){logger['error']('UpdateWhatsappInteraction',_0x2c725c[_0x5698('0x19')],_0x13736c);_0x5012dd(_0x1b8635[_0x5698('0x17')](0x1f4,_0x2c725c[_0x5698('0x19')]));});});};exports[_0x5698('0x24')]=function(_0x3c11cd){return new Promise(function(_0xffc343,_0x45dc35){return db[_0x5698('0x25')]['find']({'where':_0x3c11cd[_0x5698('0x1d')]?_0x3c11cd[_0x5698('0x1d')][_0x5698('0x1f')]||null:null})[_0x5698('0x21')](function(_0x2ad8be){if(_0x2ad8be){return _0x2ad8be['addTags'](_0x3c11cd[_0x5698('0x1c')][_0x5698('0x26')],_[_0x5698('0x27')](_0x3c11cd['body'],[_0x5698('0x26'),'id'])||{});}})[_0x5698('0x28')](function(_0x22c5b9){logger[_0x5698('0x12')](_0x5698('0x29'),_0x3c11cd);logger[_0x5698('0x15')]('AddTags',_0x3c11cd,JSON['stringify'](_0x22c5b9));_0xffc343(_0x22c5b9);})['catch'](function(_0x2f70cc){logger['error']('AddTags',_0x2f70cc['message'],_0x3c11cd);_0x45dc35(_this[_0x5698('0x17')](0x1f4,_0x2f70cc[_0x5698('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index dea9897..dd1b2e8 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 _0x9f2d=['whatsappInteraction:','./whatsappInteraction.events','save','remove','update','removeListener','register'];(function(_0x4cfd78,_0x52355e){var _0xf4a95a=function(_0x5c2d5b){while(--_0x5c2d5b){_0x4cfd78['push'](_0x4cfd78['shift']());}};_0xf4a95a(++_0x52355e);}(_0x9f2d,0x12e));var _0xd9f2=function(_0x5a10c8,_0x5222d2){_0x5a10c8=_0x5a10c8-0x0;var _0x59e303=_0x9f2d[_0x5a10c8];return _0x59e303;};'use strict';var WhatsappInteractionEvents=require(_0xd9f2('0x0'));var events=[_0xd9f2('0x1'),_0xd9f2('0x2'),_0xd9f2('0x3')];function createListener(_0x12295b,_0x5ed3b7){return function(_0x2bc30e){_0x5ed3b7['emit'](_0x12295b,_0x2bc30e);};}function removeListener(_0x15e09c,_0x18c417){return function(){WhatsappInteractionEvents[_0xd9f2('0x4')](_0x15e09c,_0x18c417);};}exports[_0xd9f2('0x5')]=function(_0x257046){for(var _0xbb161a=0x0,_0xf495af=events['length'];_0xbb161a<_0xf495af;_0xbb161a++){var _0x2f51b1=events[_0xbb161a];var _0x2d5bdb=createListener(_0xd9f2('0x6')+_0x2f51b1,_0x257046);WhatsappInteractionEvents['on'](_0x2f51b1,_0x2d5bdb);}}; \ No newline at end of file +var _0x5f34=['whatsappInteraction:','./whatsappInteraction.events','save','remove','emit','removeListener','register','length'];(function(_0x4fecf3,_0x17fdb0){var _0x50161f=function(_0x49b2ad){while(--_0x49b2ad){_0x4fecf3['push'](_0x4fecf3['shift']());}};_0x50161f(++_0x17fdb0);}(_0x5f34,0x141));var _0x45f3=function(_0xaf7e3d,_0x13d52e){_0xaf7e3d=_0xaf7e3d-0x0;var _0x4e042c=_0x5f34[_0xaf7e3d];return _0x4e042c;};'use strict';var WhatsappInteractionEvents=require(_0x45f3('0x0'));var events=[_0x45f3('0x1'),_0x45f3('0x2'),'update'];function createListener(_0x423f3b,_0x2362f1){return function(_0x1012a8){_0x2362f1[_0x45f3('0x3')](_0x423f3b,_0x1012a8);};}function removeListener(_0x3c2d0e,_0x1678bf){return function(){WhatsappInteractionEvents[_0x45f3('0x4')](_0x3c2d0e,_0x1678bf);};}exports[_0x45f3('0x5')]=function(_0x3a21bd){for(var _0x3d6f7c=0x0,_0x31c442=events[_0x45f3('0x6')];_0x3d6f7c<_0x31c442;_0x3d6f7c++){var _0x262ff6=events[_0x3d6f7c];var _0x19138e=createListener(_0x45f3('0x7')+_0x262ff6,_0x3a21bd);WhatsappInteractionEvents['on'](_0x262ff6,_0x19138e);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 20f6ec7..207f5ce 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 _0x70b1=['Router','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','/describe','isAuthenticated','/:id','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','delete','util','path','express'];(function(_0x32b7b9,_0x3de1e6){var _0x2c5a74=function(_0x3dba68){while(--_0x3dba68){_0x32b7b9['push'](_0x32b7b9['shift']());}};_0x2c5a74(++_0x3de1e6);}(_0x70b1,0x1c5));var _0x170b=function(_0x190323,_0x4e67dd){_0x190323=_0x190323-0x0;var _0x1f0899=_0x70b1[_0x190323];return _0x1f0899;};'use strict';var multer=require('multer');var util=require(_0x170b('0x0'));var path=require(_0x170b('0x1'));var timeout=require('connect-timeout');var express=require(_0x170b('0x2'));var router=express[_0x170b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x170b('0x4'));var config=require(_0x170b('0x5'));var controller=require(_0x170b('0x6'));router[_0x170b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x170b('0x7')](_0x170b('0x8'),auth[_0x170b('0x9')](),controller['describe']);router[_0x170b('0x7')](_0x170b('0xa'),auth[_0x170b('0x9')](),controller['show']);router[_0x170b('0xb')]('/',auth[_0x170b('0x9')](),interaction[_0x170b('0xc')](_0x170b('0xd'),_0x170b('0xe')),controller[_0x170b('0xf')]);router['post'](_0x170b('0x10'),controller[_0x170b('0x11')]);router[_0x170b('0x12')](_0x170b('0xa'),auth['isAuthenticated'](),controller[_0x170b('0x13')]);router[_0x170b('0x12')](_0x170b('0x14'),auth['isAuthenticated'](),controller[_0x170b('0x15')]);router[_0x170b('0x12')](_0x170b('0x16'),auth['isAuthenticated'](),controller['reject']);router[_0x170b('0x17')](_0x170b('0xa'),auth[_0x170b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb947=['put','update','/:id/accept','accept','reject','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status'];(function(_0x39d08a,_0x1ab2df){var _0x177e59=function(_0x1a5148){while(--_0x1a5148){_0x39d08a['push'](_0x39d08a['shift']());}};_0x177e59(++_0x1ab2df);}(_0xb947,0x146));var _0x7b94=function(_0x7f672d,_0xe22310){_0x7f672d=_0x7f672d-0x0;var _0x52d480=_0xb947[_0x7f672d];return _0x52d480;};'use strict';var multer=require('multer');var util=require(_0x7b94('0x0'));var path=require(_0x7b94('0x1'));var timeout=require(_0x7b94('0x2'));var express=require('express');var router=express[_0x7b94('0x3')]();var fs_extra=require(_0x7b94('0x4'));var auth=require(_0x7b94('0x5'));var interaction=require(_0x7b94('0x6'));var config=require(_0x7b94('0x7'));var controller=require(_0x7b94('0x8'));router[_0x7b94('0x9')]('/',auth['isAuthenticated'](),controller[_0x7b94('0xa')]);router[_0x7b94('0x9')](_0x7b94('0xb'),auth[_0x7b94('0xc')](),controller['describe']);router['get'](_0x7b94('0xd'),auth[_0x7b94('0xc')](),controller[_0x7b94('0xe')]);router[_0x7b94('0xf')]('/',auth[_0x7b94('0xc')](),interaction[_0x7b94('0x10')](_0x7b94('0x11'),_0x7b94('0x12')),controller[_0x7b94('0x13')]);router[_0x7b94('0xf')](_0x7b94('0x14'),controller[_0x7b94('0x15')]);router[_0x7b94('0x16')](_0x7b94('0xd'),auth[_0x7b94('0xc')](),controller[_0x7b94('0x17')]);router[_0x7b94('0x16')](_0x7b94('0x18'),auth[_0x7b94('0xc')](),controller[_0x7b94('0x19')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x7b94('0x1a')]);router[_0x7b94('0x1b')](_0x7b94('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x7b94('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 3b45620..3e3fb10 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 _0x0324=['STRING','DATE','TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out'];(function(_0x3fa8ee,_0x3b350d){var _0x36a857=function(_0x289c6c){while(--_0x289c6c){_0x3fa8ee['push'](_0x3fa8ee['shift']());}};_0x36a857(++_0x3b350d);}(_0x0324,0x1e0));var _0x4032=function(_0x2e0fa2,_0x5c50b5){_0x2e0fa2=_0x2e0fa2-0x0;var _0x38c8f2=_0x0324[_0x2e0fa2];return _0x38c8f2;};'use strict';var Sequelize=require(_0x4032('0x0'));module[_0x4032('0x1')]={'body':{'type':Sequelize['TEXT'](_0x4032('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4032('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4032('0x4')]('in','out'),'defaultValue':_0x4032('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4032('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x4032('0x7')]},'secret':{'type':Sequelize[_0x4032('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x4032('0x6')]},'providerResponse':{'type':Sequelize[_0x4032('0x8')]}}; \ No newline at end of file +var _0xa63a=['TEXT','exports','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x38b770,_0x1bd8f1){var _0x208f58=function(_0x247b19){while(--_0x247b19){_0x38b770['push'](_0x38b770['shift']());}};_0x208f58(++_0x1bd8f1);}(_0xa63a,0xa9));var _0xaa63=function(_0x1bf809,_0x536f55){_0x1bf809=_0x1bf809-0x0;var _0x1caa4e=_0xa63a[_0x1bf809];return _0x1caa4e;};'use strict';var Sequelize=require('sequelize');module[_0xaa63('0x0')]={'body':{'type':Sequelize['TEXT'](_0xaa63('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xaa63('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xaa63('0x3')]('in',_0xaa63('0x4')),'defaultValue':_0xaa63('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xaa63('0x5')](0xbe)},'phone':{'type':Sequelize[_0xaa63('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xaa63('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xaa63('0x5')]},'providerResponse':{'type':Sequelize[_0xaa63('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 98672cc..b136732 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 _0x9072=['info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','stack','name','index','WhatsappMessage','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','describe','accept','whatsapp','acceptMessage','user','agent','get','WhatsappInteraction','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','UserId','fullname','email','internal','interface','format','channel','motionChannel','event','reject','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','client','http','then'];(function(_0x1bb80c,_0x26d406){var _0x368f16=function(_0x4e37e5){while(--_0x4e37e5){_0x1bb80c['push'](_0x1bb80c['shift']());}};_0x368f16(++_0x26d406);}(_0x9072,0x13a));var _0x2907=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9072[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var Redis=require('ioredis');var interactionService=require(_0x2907('0x0'));var qs=require(_0x2907('0x1'));var logger=require(_0x2907('0x2'))('api');var config=require(_0x2907('0x3'));var db=require(_0x2907('0x4'))['db'];config[_0x2907('0x5')]=_[_0x2907('0x6')](config[_0x2907('0x5')],{'host':_0x2907('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2907('0x8'))[_0x2907('0x9')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2907('0xa')][_0x2907('0xb')]({'port':0x232c});var client9002=jayson[_0x2907('0xa')][_0x2907('0xb')]({'port':0x232a});var interaction_log=require(_0x2907('0x2'))('whatsapp-interactions');function respondWithRpcPromise(_0x24b6e0,_0x9c9241,_0x46f8d3,_0x12d867){return new Promise(function(_0x2cbb7d,_0x3a14cf){var _0x362f81=_0x12d867||client;return _0x362f81['request'](_0x24b6e0,_0x46f8d3)[_0x2907('0xc')](function(_0x50eda2){logger[_0x2907('0xd')](_0x2907('0xe'),_0x9c9241,_0x2907('0xf'));logger[_0x2907('0x10')](_0x2907('0x11'),_0x9c9241,_0x2907('0xf'),JSON[_0x2907('0x12')](_0x50eda2));if(_0x50eda2[_0x2907('0x13')]){if(_0x50eda2['error'][_0x2907('0x14')]===0x1f4){logger[_0x2907('0x13')](_0x2907('0xe'),_0x9c9241,_0x50eda2[_0x2907('0x13')]['message']);return _0x3a14cf(_0x50eda2[_0x2907('0x13')][_0x2907('0x15')]);}logger[_0x2907('0x13')](_0x2907('0xe'),_0x9c9241,_0x50eda2[_0x2907('0x13')][_0x2907('0x15')]);return _0x2cbb7d(_0x50eda2['error'][_0x2907('0x15')]);}else{logger['info'](_0x2907('0xe'),_0x9c9241,_0x2907('0xf'));_0x2cbb7d(_0x50eda2[_0x2907('0x16')][_0x2907('0x15')]);}})[_0x2907('0x17')](function(_0x2e5c17){logger[_0x2907('0x13')](_0x2907('0xe'),_0x9c9241,_0x2e5c17);_0x3a14cf(_0x2e5c17);});});}function respondWithResult(_0x336e40,_0x127391){_0x127391=_0x127391||0xc8;return function(_0x27767b){if(_0x27767b){return _0x336e40[_0x2907('0x18')](_0x127391)[_0x2907('0x19')](_0x27767b);}};}function respondWithFilteredResult(_0x1190ca,_0x436d97){return function(_0x5972d9){if(_0x5972d9){var _0x3483cc=typeof _0x436d97[_0x2907('0x1a')]==='undefined'&&typeof _0x436d97[_0x2907('0x1b')]===_0x2907('0x1c');var _0x3ac653=_0x5972d9['count'];var _0x572641=_0x3483cc?0x0:_0x436d97['offset'];var _0x26f789=_0x3483cc?_0x5972d9[_0x2907('0x1d')]:_0x436d97['offset']+_0x436d97[_0x2907('0x1b')];var _0x200547;if(_0x26f789>=_0x3ac653){_0x26f789=_0x3ac653;_0x200547=0xc8;}else{_0x200547=0xce;}_0x1190ca[_0x2907('0x18')](_0x200547);return _0x1190ca[_0x2907('0x1e')](_0x2907('0x1f'),_0x572641+'-'+_0x26f789+'/'+_0x3ac653)[_0x2907('0x19')](_0x5972d9);}return null;};}function saveUpdates(_0x32554b){return function(_0x9b7c4a){if(_0x9b7c4a){return _0x9b7c4a[_0x2907('0x20')](_0x32554b)['then'](function(_0x2d2c9b){return _0x2d2c9b;});}return null;};}function removeEntity(_0x5a6810){return function(_0x287214){if(_0x287214){return _0x287214[_0x2907('0x21')]()['then'](function(){_0x5a6810[_0x2907('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x373713){return function(_0x32f527){if(!_0x32f527){_0x373713['sendStatus'](0x194);}return _0x32f527;};}function handleError(_0x5b2f40,_0x14459a){_0x14459a=_0x14459a||0x1f4;return function(_0x45b601){logger[_0x2907('0x13')](_0x45b601[_0x2907('0x22')]);if(_0x45b601[_0x2907('0x23')]){delete _0x45b601[_0x2907('0x23')];}_0x5b2f40[_0x2907('0x18')](_0x14459a)['send'](_0x45b601);};}exports[_0x2907('0x24')]=function(_0x57e4fe,_0x49d290){var _0xb91bc={},_0x19f685={},_0x4f0350={'count':0x0,'rows':[]};var _0xd787f3=_['map'](db[_0x2907('0x25')][_0x2907('0x26')],function(_0x2eb98f){return{'name':_0x2eb98f[_0x2907('0x27')],'type':_0x2eb98f[_0x2907('0x28')][_0x2907('0x29')]};});_0x19f685['model']=_[_0x2907('0x2a')](_0xd787f3,_0x2907('0x23'));_0x19f685[_0x2907('0x2b')]=_[_0x2907('0x2c')](_0x57e4fe['query']);_0x19f685[_0x2907('0x2d')]=_[_0x2907('0x2e')](_0x19f685[_0x2907('0x2f')],_0x19f685[_0x2907('0x2b')]);_0xb91bc['attributes']=_[_0x2907('0x2e')](_0x19f685['model'],qs[_0x2907('0x30')](_0x57e4fe[_0x2907('0x2b')][_0x2907('0x30')]));_0xb91bc[_0x2907('0x31')]=_0xb91bc[_0x2907('0x31')][_0x2907('0x32')]?_0xb91bc['attributes']:_0x19f685[_0x2907('0x2f')];if(!_0x57e4fe[_0x2907('0x2b')][_0x2907('0x33')](_0x2907('0x34'))){_0xb91bc[_0x2907('0x1b')]=qs['limit'](_0x57e4fe[_0x2907('0x2b')]['limit']);_0xb91bc[_0x2907('0x1a')]=qs[_0x2907('0x1a')](_0x57e4fe[_0x2907('0x2b')]['offset']);}_0xb91bc[_0x2907('0x35')]=qs[_0x2907('0x36')](_0x57e4fe['query']['sort']);_0xb91bc[_0x2907('0x37')]=qs[_0x2907('0x2d')](_[_0x2907('0x38')](_0x57e4fe[_0x2907('0x2b')],_0x19f685[_0x2907('0x2d')]),_0xd787f3);if(_0x57e4fe['query'][_0x2907('0x39')]){_0xb91bc[_0x2907('0x37')]=_[_0x2907('0x3a')](_0xb91bc[_0x2907('0x37')],{'$or':_[_0x2907('0x2a')](_0xd787f3,function(_0x1cbe09){if(_0x1cbe09[_0x2907('0x28')]!==_0x2907('0x3b')){var _0x53e7c7={};_0x53e7c7[_0x1cbe09[_0x2907('0x23')]]={'$like':'%'+_0x57e4fe[_0x2907('0x2b')]['filter']+'%'};return _0x53e7c7;}})});}_0xb91bc=_[_0x2907('0x3a')]({},_0xb91bc,_0x57e4fe[_0x2907('0x3c')]);var _0x1269ee={'where':_0xb91bc['where']};return db['WhatsappMessage'][_0x2907('0x1d')](_0x1269ee)[_0x2907('0xc')](function(_0x507dff){_0x4f0350[_0x2907('0x1d')]=_0x507dff;if(_0x57e4fe['query'][_0x2907('0x3d')]){_0xb91bc[_0x2907('0x3e')]=[{'all':!![]}];}return db[_0x2907('0x25')]['findAll'](_0xb91bc);})['then'](function(_0x34dc14){_0x4f0350[_0x2907('0x3f')]=_0x34dc14;return _0x4f0350;})[_0x2907('0xc')](respondWithFilteredResult(_0x49d290,_0xb91bc))[_0x2907('0x17')](handleError(_0x49d290,null));};exports[_0x2907('0x40')]=function(_0x196480,_0x30b9d6){var _0x7684a0={'raw':!![],'where':{'id':_0x196480[_0x2907('0x41')]['id']}},_0x480323={};_0x480323['model']=_['keys'](db[_0x2907('0x25')][_0x2907('0x26')]);_0x480323[_0x2907('0x2b')]=_['keys'](_0x196480[_0x2907('0x2b')]);_0x480323[_0x2907('0x2d')]=_[_0x2907('0x2e')](_0x480323['model'],_0x480323[_0x2907('0x2b')]);_0x7684a0[_0x2907('0x31')]=_[_0x2907('0x2e')](_0x480323[_0x2907('0x2f')],qs['fields'](_0x196480[_0x2907('0x2b')]['fields']));_0x7684a0[_0x2907('0x31')]=_0x7684a0[_0x2907('0x31')]['length']?_0x7684a0[_0x2907('0x31')]:_0x480323[_0x2907('0x2f')];if(_0x196480[_0x2907('0x2b')]['includeAll']){_0x7684a0[_0x2907('0x3e')]=[{'all':!![]}];}_0x7684a0=_[_0x2907('0x3a')]({},_0x7684a0,_0x196480[_0x2907('0x3c')]);return db[_0x2907('0x25')][_0x2907('0x42')](_0x7684a0)['then'](handleEntityNotFound(_0x30b9d6,null))[_0x2907('0xc')](respondWithResult(_0x30b9d6,null))[_0x2907('0x17')](handleError(_0x30b9d6,null));};exports[_0x2907('0x43')]=function(_0x387aa6,_0x3ae449){return db[_0x2907('0x25')][_0x2907('0x43')](_0x387aa6[_0x2907('0x44')],{})['then'](respondWithResult(_0x3ae449,0xc9))['catch'](handleError(_0x3ae449,null));};exports[_0x2907('0x20')]=function(_0x30a146,_0x27ca95){if(_0x30a146[_0x2907('0x44')]['id']){delete _0x30a146[_0x2907('0x44')]['id'];}return db['WhatsappMessage'][_0x2907('0x42')]({'where':{'id':_0x30a146[_0x2907('0x41')]['id']}})['then'](handleEntityNotFound(_0x27ca95,null))[_0x2907('0xc')](saveUpdates(_0x30a146[_0x2907('0x44')],null))[_0x2907('0xc')](respondWithResult(_0x27ca95,null))['catch'](handleError(_0x27ca95,null));};exports[_0x2907('0x21')]=function(_0xf3dad5,_0x5da94c){return db[_0x2907('0x25')][_0x2907('0x42')]({'where':{'id':_0xf3dad5[_0x2907('0x41')]['id']}})[_0x2907('0xc')](handleEntityNotFound(_0x5da94c,null))[_0x2907('0xc')](removeEntity(_0x5da94c,null))[_0x2907('0x17')](handleError(_0x5da94c,null));};exports[_0x2907('0x45')]=function(_0x516733,_0x1bd655){return db[_0x2907('0x25')][_0x2907('0x45')]()[_0x2907('0xc')](respondWithResult(_0x1bd655,null))[_0x2907('0x17')](handleError(_0x1bd655,null));};exports[_0x2907('0x46')]=function(_0x465725,_0x16d7d8){var _0x4d3429=_0x2907('0x47');return interactionService[_0x2907('0x48')](_0x465725,_0x4d3429)[_0x2907('0xc')](respondWithResult(_0x16d7d8,null))[_0x2907('0x17')](handleError(_0x16d7d8,null));};exports['reject']=function(_0x35c4d2,_0x4b81f3){var _0x589454={'agent':{},'channel':_0x2907('0x47')};if(_0x35c4d2['body']['id']){delete _0x35c4d2[_0x2907('0x44')]['id'];}_0x35c4d2[_0x2907('0x44')]['UserId']=_0x35c4d2[_0x2907('0x44')]['UserId']||_0x35c4d2[_0x2907('0x49')]['id'];_0x589454[_0x2907('0x4a')]['id']=_0x35c4d2[_0x2907('0x44')]['UserId'];return db[_0x2907('0x25')][_0x2907('0x42')]({'where':{'id':_0x35c4d2[_0x2907('0x41')]['id'],'UserId':null}})[_0x2907('0xc')](handleEntityNotFound(_0x4b81f3,null))[_0x2907('0xc')](function(_0x863218){if(_0x863218){_0x589454['message']=_0x863218[_0x2907('0x4b')]({'plain':!![]});return db[_0x2907('0x4c')][_0x2907('0x42')]({'where':{'id':_0x863218[_0x2907('0x4d')]}});}return null;})['then'](handleEntityNotFound(_0x4b81f3,null))[_0x2907('0xc')](function(_0x5d6da9){if(_0x5d6da9){_0x589454['interaction']=_0x5d6da9['get']({'plain':!![]});interaction_log['info'](_0x2907('0x4e'),_0x35c4d2[_0x2907('0x49')]['id'],_0x35c4d2[_0x2907('0x49')][_0x2907('0x23')],_0x35c4d2['user'][_0x2907('0x4f')],_0x589454[_0x2907('0x50')]['id'],_0x35c4d2[_0x2907('0x44')]?JSON['stringify'](_0x35c4d2[_0x2907('0x44')]):'null');return respondWithRpcPromise(_0x2907('0x51'),_0x2907('0x52'),_0x589454);}return null;})['then'](function(_0x3c8a88){var _0xfbc43=_0x2907('0x53')+_0x3c8a88[_0x2907('0x15')][_0x2907('0x54')];return db['sequelize'][_0x2907('0x2b')](_0xfbc43,{'type':db[_0x2907('0x55')][_0x2907('0x56')][_0x2907('0x57')],'raw':!![]})[_0x2907('0xc')](function(_0x5f2433){return _0x5f2433;});})[_0x2907('0xc')](function(_0x570091){if(_0x570091){_0x589454[_0x2907('0x15')][_0x2907('0x58')]=_0x570091[0x0];if(!_0x35c4d2[_0x2907('0x44')][_0x2907('0x59')])return;return db['User'][_0x2907('0x42')]({'where':{'id':_0x35c4d2[_0x2907('0x44')][_0x2907('0x59')],'role':_0x2907('0x4a')},'attributes':['id','name',_0x2907('0x5a'),_0x2907('0x5b'),_0x2907('0x5c')],'raw':!![]});}return null;})[_0x2907('0xc')](function(_0x4c515f){if(!_0x4c515f)return null;_0x589454[_0x2907('0x15')]['agent']=_0x4c515f;return _0x589454;})[_0x2907('0xc')](function(_0x78aaf0){if(_0x78aaf0){_0x78aaf0[_0x2907('0x15')][_0x2907('0x5d')]=util[_0x2907('0x5e')]('SIP/%s',_0x35c4d2['user'][_0x2907('0x23')]);_0x78aaf0[_0x2907('0x15')][_0x2907('0x5f')]=_0x589454[_0x2907('0x5f')];_0x78aaf0[_0x2907('0x15')][_0x2907('0x60')]=_0x589454['channel'];_0x78aaf0[_0x2907('0x15')][_0x2907('0x61')]=_0x2907('0x62');respondWithRpcPromise('EventManager','EventManager',{'event':_0x2907('0x63'),'message':_0x78aaf0['message']},client9002);return _0x589454;}return null;})[_0x2907('0xc')](respondWithResult(_0x4b81f3,null))[_0x2907('0x17')](handleError(_0x4b81f3,null));};exports[_0x2907('0x18')]=function(_0x46c955,_0x3fbb63){if(_0x46c955[_0x2907('0x44')]['id']){delete _0x46c955[_0x2907('0x44')]['id'];}var _0x40ff4c;return db['WhatsappMessage'][_0x2907('0x42')]({'where':{'id':_0x46c955[_0x2907('0x41')]['id']}})[_0x2907('0xc')](handleEntityNotFound(_0x3fbb63,null))[_0x2907('0xc')](function(_0x5298d5){if(_0x5298d5){_0x40ff4c=_0x5298d5;return db[_0x2907('0x64')][_0x2907('0x42')]({'where':{'id':_0x5298d5[_0x2907('0x65')]}});}})['then'](handleEntityNotFound(_0x3fbb63,null))[_0x2907('0xc')](function(_0x514fbb){if(_0x514fbb){logger[_0x2907('0x10')](_0x2907('0x66'),_0x2907('0x18'),'received\x20delivery\x20report\x20from',_0x514fbb[_0x2907('0x28')],util[_0x2907('0x67')](_0x46c955['body'],{'showHidden':![],'depth':null}));switch(_0x514fbb[_0x2907('0x28')]){case'twilio':if(_0x46c955[_0x2907('0x44')][_0x2907('0x68')]&&_0x46c955[_0x2907('0x44')][_0x2907('0x68')]===_0x40ff4c[_0x2907('0x69')]&&_0x46c955[_0x2907('0x44')]['MessageStatus']&&_0x46c955['body'][_0x2907('0x6a')]==='read'){return _0x40ff4c[_0x2907('0x20')]({'read':!![]});}else{logger[_0x2907('0x13')](_0x2907('0x6b'),_0x2907('0x18'),_0x2907('0x6c'),util[_0x2907('0x67')](_0x46c955['body'],{'showHidden':![],'depth':null}));}break;}return _0x40ff4c;}})[_0x2907('0xc')](respondWithResult(_0x3fbb63,null))['catch'](handleError(_0x3fbb63,null));}; \ No newline at end of file +var _0xef25=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','rows','show','params','rawAttributes','find','create','body','describe','accept','whatsapp','acceptMessage','UserId','user','agent','get','interaction','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','email','internal','SIP/%s','channel','motionChannel','reject','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','util','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','whatsapp-interactions','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','json','offset','undefined','count','limit','status','set','update','destroy','end','sendStatus','name','send','index','WhatsappMessage','fieldName','type','key','map','query','keys','filters','intersection','attributes','model'];(function(_0x174f3f,_0x37af67){var _0x15175d=function(_0x210ad4){while(--_0x210ad4){_0x174f3f['push'](_0x174f3f['shift']());}};_0x15175d(++_0x37af67);}(_0xef25,0xa4));var _0x5ef2=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0xef25[_0x56740a];return _0x257144;};'use strict';var util=require(_0x5ef2('0x0'));var _=require(_0x5ef2('0x1'));var Redis=require(_0x5ef2('0x2'));var interactionService=require(_0x5ef2('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x5ef2('0x4'))(_0x5ef2('0x5'));var config=require(_0x5ef2('0x6'));var db=require('../../mysqldb')['db'];config[_0x5ef2('0x7')]=_[_0x5ef2('0x8')](config['redis'],{'host':_0x5ef2('0x9'),'port':0x18eb});var socket=require(_0x5ef2('0xa'))(new Redis(config['redis']));require(_0x5ef2('0xb'))[_0x5ef2('0xc')](socket);var jayson=require(_0x5ef2('0xd'));var client=jayson['client'][_0x5ef2('0xe')]({'port':0x232c});var client9002=jayson[_0x5ef2('0xf')]['http']({'port':0x232a});var interaction_log=require(_0x5ef2('0x4'))(_0x5ef2('0x10'));function respondWithRpcPromise(_0x3601fb,_0x306571,_0x4a6748,_0xefe33b){return new Promise(function(_0x51ac8a,_0x4170a7){var _0x23aa9b=_0xefe33b||client;return _0x23aa9b['request'](_0x3601fb,_0x4a6748)[_0x5ef2('0x11')](function(_0x204845){logger[_0x5ef2('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x306571,_0x5ef2('0x13'));logger[_0x5ef2('0x14')](_0x5ef2('0x15'),_0x306571,_0x5ef2('0x13'),JSON[_0x5ef2('0x16')](_0x204845));if(_0x204845['error']){if(_0x204845[_0x5ef2('0x17')][_0x5ef2('0x18')]===0x1f4){logger[_0x5ef2('0x17')](_0x5ef2('0x19'),_0x306571,_0x204845['error']['message']);return _0x4170a7(_0x204845['error'][_0x5ef2('0x1a')]);}logger['error'](_0x5ef2('0x19'),_0x306571,_0x204845['error'][_0x5ef2('0x1a')]);return _0x51ac8a(_0x204845[_0x5ef2('0x17')][_0x5ef2('0x1a')]);}else{logger[_0x5ef2('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x306571,_0x5ef2('0x13'));_0x51ac8a(_0x204845[_0x5ef2('0x1b')]['message']);}})[_0x5ef2('0x1c')](function(_0x1cb752){logger[_0x5ef2('0x17')](_0x5ef2('0x19'),_0x306571,_0x1cb752);_0x4170a7(_0x1cb752);});});}function respondWithResult(_0x5528d9,_0x51bf6c){_0x51bf6c=_0x51bf6c||0xc8;return function(_0x2103b0){if(_0x2103b0){return _0x5528d9['status'](_0x51bf6c)[_0x5ef2('0x1d')](_0x2103b0);}};}function respondWithFilteredResult(_0x55ed9d,_0x5c93e1){return function(_0x461b45){if(_0x461b45){var _0x36f516=typeof _0x5c93e1[_0x5ef2('0x1e')]===_0x5ef2('0x1f')&&typeof _0x5c93e1['limit']===_0x5ef2('0x1f');var _0x71a130=_0x461b45[_0x5ef2('0x20')];var _0x17d968=_0x36f516?0x0:_0x5c93e1[_0x5ef2('0x1e')];var _0x26e78b=_0x36f516?_0x461b45[_0x5ef2('0x20')]:_0x5c93e1[_0x5ef2('0x1e')]+_0x5c93e1[_0x5ef2('0x21')];var _0x25b732;if(_0x26e78b>=_0x71a130){_0x26e78b=_0x71a130;_0x25b732=0xc8;}else{_0x25b732=0xce;}_0x55ed9d[_0x5ef2('0x22')](_0x25b732);return _0x55ed9d[_0x5ef2('0x23')]('Content-Range',_0x17d968+'-'+_0x26e78b+'/'+_0x71a130)[_0x5ef2('0x1d')](_0x461b45);}return null;};}function saveUpdates(_0x59e39f){return function(_0x180fc0){if(_0x180fc0){return _0x180fc0[_0x5ef2('0x24')](_0x59e39f)[_0x5ef2('0x11')](function(_0xb92c26){return _0xb92c26;});}return null;};}function removeEntity(_0x15439b){return function(_0x158da5){if(_0x158da5){return _0x158da5[_0x5ef2('0x25')]()[_0x5ef2('0x11')](function(){_0x15439b[_0x5ef2('0x22')](0xcc)[_0x5ef2('0x26')]();});}};}function handleEntityNotFound(_0x32dd94){return function(_0x2aba60){if(!_0x2aba60){_0x32dd94[_0x5ef2('0x27')](0x194);}return _0x2aba60;};}function handleError(_0x391fb9,_0x2ddcd7){_0x2ddcd7=_0x2ddcd7||0x1f4;return function(_0xfa4ad2){logger[_0x5ef2('0x17')](_0xfa4ad2['stack']);if(_0xfa4ad2[_0x5ef2('0x28')]){delete _0xfa4ad2[_0x5ef2('0x28')];}_0x391fb9[_0x5ef2('0x22')](_0x2ddcd7)[_0x5ef2('0x29')](_0xfa4ad2);};}exports[_0x5ef2('0x2a')]=function(_0x3bf747,_0x13ebc9){var _0x383af5={},_0x26075c={},_0x1d21a0={'count':0x0,'rows':[]};var _0x6788c9=_['map'](db[_0x5ef2('0x2b')]['rawAttributes'],function(_0x486007){return{'name':_0x486007[_0x5ef2('0x2c')],'type':_0x486007[_0x5ef2('0x2d')][_0x5ef2('0x2e')]};});_0x26075c['model']=_[_0x5ef2('0x2f')](_0x6788c9,_0x5ef2('0x28'));_0x26075c[_0x5ef2('0x30')]=_[_0x5ef2('0x31')](_0x3bf747[_0x5ef2('0x30')]);_0x26075c[_0x5ef2('0x32')]=_[_0x5ef2('0x33')](_0x26075c['model'],_0x26075c[_0x5ef2('0x30')]);_0x383af5[_0x5ef2('0x34')]=_['intersection'](_0x26075c[_0x5ef2('0x35')],qs[_0x5ef2('0x36')](_0x3bf747[_0x5ef2('0x30')][_0x5ef2('0x36')]));_0x383af5[_0x5ef2('0x34')]=_0x383af5[_0x5ef2('0x34')][_0x5ef2('0x37')]?_0x383af5[_0x5ef2('0x34')]:_0x26075c['model'];if(!_0x3bf747[_0x5ef2('0x30')][_0x5ef2('0x38')](_0x5ef2('0x39'))){_0x383af5[_0x5ef2('0x21')]=qs[_0x5ef2('0x21')](_0x3bf747[_0x5ef2('0x30')][_0x5ef2('0x21')]);_0x383af5[_0x5ef2('0x1e')]=qs[_0x5ef2('0x1e')](_0x3bf747[_0x5ef2('0x30')][_0x5ef2('0x1e')]);}_0x383af5[_0x5ef2('0x3a')]=qs[_0x5ef2('0x3b')](_0x3bf747[_0x5ef2('0x30')][_0x5ef2('0x3b')]);_0x383af5[_0x5ef2('0x3c')]=qs[_0x5ef2('0x32')](_[_0x5ef2('0x3d')](_0x3bf747[_0x5ef2('0x30')],_0x26075c[_0x5ef2('0x32')]),_0x6788c9);if(_0x3bf747[_0x5ef2('0x30')]['filter']){_0x383af5[_0x5ef2('0x3c')]=_[_0x5ef2('0x3e')](_0x383af5[_0x5ef2('0x3c')],{'$or':_[_0x5ef2('0x2f')](_0x6788c9,function(_0x5c5d5b){if(_0x5c5d5b[_0x5ef2('0x2d')]!=='VIRTUAL'){var _0x167fb3={};_0x167fb3[_0x5c5d5b[_0x5ef2('0x28')]]={'$like':'%'+_0x3bf747[_0x5ef2('0x30')][_0x5ef2('0x3f')]+'%'};return _0x167fb3;}})});}_0x383af5=_['merge']({},_0x383af5,_0x3bf747[_0x5ef2('0x40')]);var _0xd5366b={'where':_0x383af5[_0x5ef2('0x3c')]};return db['WhatsappMessage'][_0x5ef2('0x20')](_0xd5366b)[_0x5ef2('0x11')](function(_0x47c6cc){_0x1d21a0[_0x5ef2('0x20')]=_0x47c6cc;if(_0x3bf747[_0x5ef2('0x30')]['includeAll']){_0x383af5[_0x5ef2('0x41')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x5ef2('0x42')](_0x383af5);})[_0x5ef2('0x11')](function(_0x195b59){_0x1d21a0[_0x5ef2('0x43')]=_0x195b59;return _0x1d21a0;})['then'](respondWithFilteredResult(_0x13ebc9,_0x383af5))[_0x5ef2('0x1c')](handleError(_0x13ebc9,null));};exports[_0x5ef2('0x44')]=function(_0x117b74,_0x191bf5){var _0x57353a={'raw':!![],'where':{'id':_0x117b74[_0x5ef2('0x45')]['id']}},_0x4cf55c={};_0x4cf55c[_0x5ef2('0x35')]=_['keys'](db[_0x5ef2('0x2b')][_0x5ef2('0x46')]);_0x4cf55c[_0x5ef2('0x30')]=_[_0x5ef2('0x31')](_0x117b74[_0x5ef2('0x30')]);_0x4cf55c[_0x5ef2('0x32')]=_[_0x5ef2('0x33')](_0x4cf55c['model'],_0x4cf55c[_0x5ef2('0x30')]);_0x57353a['attributes']=_[_0x5ef2('0x33')](_0x4cf55c[_0x5ef2('0x35')],qs['fields'](_0x117b74['query'][_0x5ef2('0x36')]));_0x57353a['attributes']=_0x57353a[_0x5ef2('0x34')]['length']?_0x57353a[_0x5ef2('0x34')]:_0x4cf55c[_0x5ef2('0x35')];if(_0x117b74['query']['includeAll']){_0x57353a[_0x5ef2('0x41')]=[{'all':!![]}];}_0x57353a=_[_0x5ef2('0x3e')]({},_0x57353a,_0x117b74[_0x5ef2('0x40')]);return db[_0x5ef2('0x2b')][_0x5ef2('0x47')](_0x57353a)[_0x5ef2('0x11')](handleEntityNotFound(_0x191bf5,null))[_0x5ef2('0x11')](respondWithResult(_0x191bf5,null))['catch'](handleError(_0x191bf5,null));};exports[_0x5ef2('0x48')]=function(_0x157f75,_0x4d4832){return db[_0x5ef2('0x2b')]['create'](_0x157f75[_0x5ef2('0x49')],{})['then'](respondWithResult(_0x4d4832,0xc9))[_0x5ef2('0x1c')](handleError(_0x4d4832,null));};exports[_0x5ef2('0x24')]=function(_0x2d8254,_0x261aec){if(_0x2d8254[_0x5ef2('0x49')]['id']){delete _0x2d8254[_0x5ef2('0x49')]['id'];}return db[_0x5ef2('0x2b')][_0x5ef2('0x47')]({'where':{'id':_0x2d8254[_0x5ef2('0x45')]['id']}})[_0x5ef2('0x11')](handleEntityNotFound(_0x261aec,null))[_0x5ef2('0x11')](saveUpdates(_0x2d8254[_0x5ef2('0x49')],null))[_0x5ef2('0x11')](respondWithResult(_0x261aec,null))[_0x5ef2('0x1c')](handleError(_0x261aec,null));};exports[_0x5ef2('0x25')]=function(_0x3efc17,_0x491dcc){return db[_0x5ef2('0x2b')][_0x5ef2('0x47')]({'where':{'id':_0x3efc17[_0x5ef2('0x45')]['id']}})[_0x5ef2('0x11')](handleEntityNotFound(_0x491dcc,null))[_0x5ef2('0x11')](removeEntity(_0x491dcc,null))[_0x5ef2('0x1c')](handleError(_0x491dcc,null));};exports['describe']=function(_0x389ef5,_0x201020){return db[_0x5ef2('0x2b')][_0x5ef2('0x4a')]()[_0x5ef2('0x11')](respondWithResult(_0x201020,null))[_0x5ef2('0x1c')](handleError(_0x201020,null));};exports[_0x5ef2('0x4b')]=function(_0xeb78f3,_0x52b40b){var _0x31ff51=_0x5ef2('0x4c');return interactionService[_0x5ef2('0x4d')](_0xeb78f3,_0x31ff51)[_0x5ef2('0x11')](respondWithResult(_0x52b40b,null))[_0x5ef2('0x1c')](handleError(_0x52b40b,null));};exports['reject']=function(_0x1103a0,_0x177080){var _0x1ae652={'agent':{},'channel':_0x5ef2('0x4c')};if(_0x1103a0[_0x5ef2('0x49')]['id']){delete _0x1103a0[_0x5ef2('0x49')]['id'];}_0x1103a0['body'][_0x5ef2('0x4e')]=_0x1103a0['body']['UserId']||_0x1103a0[_0x5ef2('0x4f')]['id'];_0x1ae652[_0x5ef2('0x50')]['id']=_0x1103a0[_0x5ef2('0x49')]['UserId'];return db['WhatsappMessage'][_0x5ef2('0x47')]({'where':{'id':_0x1103a0[_0x5ef2('0x45')]['id'],'UserId':null}})[_0x5ef2('0x11')](handleEntityNotFound(_0x177080,null))[_0x5ef2('0x11')](function(_0x15d1e5){if(_0x15d1e5){_0x1ae652[_0x5ef2('0x1a')]=_0x15d1e5[_0x5ef2('0x51')]({'plain':!![]});return db['WhatsappInteraction'][_0x5ef2('0x47')]({'where':{'id':_0x15d1e5['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x177080,null))[_0x5ef2('0x11')](function(_0x48663b){if(_0x48663b){_0x1ae652[_0x5ef2('0x52')]=_0x48663b['get']({'plain':!![]});interaction_log[_0x5ef2('0x12')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1103a0[_0x5ef2('0x4f')]['id'],_0x1103a0[_0x5ef2('0x4f')][_0x5ef2('0x28')],_0x1103a0[_0x5ef2('0x4f')]['role'],_0x1ae652[_0x5ef2('0x52')]['id'],_0x1103a0[_0x5ef2('0x49')]?JSON[_0x5ef2('0x16')](_0x1103a0[_0x5ef2('0x49')]):_0x5ef2('0x53'));return respondWithRpcPromise(_0x5ef2('0x54'),_0x5ef2('0x55'),_0x1ae652);}return null;})['then'](function(_0x549551){var _0xa5d7f2=_0x5ef2('0x56')+_0x549551[_0x5ef2('0x1a')]['ContactId'];return db[_0x5ef2('0x57')][_0x5ef2('0x30')](_0xa5d7f2,{'type':db[_0x5ef2('0x58')][_0x5ef2('0x59')]['SELECT'],'raw':!![]})[_0x5ef2('0x11')](function(_0x48fd6f){return _0x48fd6f;});})[_0x5ef2('0x11')](function(_0x19e51b){if(_0x19e51b){_0x1ae652['message'][_0x5ef2('0x5a')]=_0x19e51b[0x0];if(!_0x1103a0['body'][_0x5ef2('0x4e')])return;return db[_0x5ef2('0x5b')][_0x5ef2('0x47')]({'where':{'id':_0x1103a0[_0x5ef2('0x49')][_0x5ef2('0x4e')],'role':_0x5ef2('0x50')},'attributes':['id',_0x5ef2('0x28'),'fullname',_0x5ef2('0x5c'),_0x5ef2('0x5d')],'raw':!![]});}return null;})[_0x5ef2('0x11')](function(_0x3f0ad5){if(!_0x3f0ad5)return null;_0x1ae652['message'][_0x5ef2('0x50')]=_0x3f0ad5;return _0x1ae652;})[_0x5ef2('0x11')](function(_0x41ee96){if(_0x41ee96){_0x41ee96[_0x5ef2('0x1a')]['interface']=util['format'](_0x5ef2('0x5e'),_0x1103a0[_0x5ef2('0x4f')][_0x5ef2('0x28')]);_0x41ee96[_0x5ef2('0x1a')][_0x5ef2('0x5f')]=_0x1ae652[_0x5ef2('0x5f')];_0x41ee96[_0x5ef2('0x1a')][_0x5ef2('0x60')]=_0x1ae652[_0x5ef2('0x5f')];_0x41ee96[_0x5ef2('0x1a')]['event']=_0x5ef2('0x61');respondWithRpcPromise(_0x5ef2('0x62'),_0x5ef2('0x62'),{'event':_0x5ef2('0x63'),'message':_0x41ee96[_0x5ef2('0x1a')]},client9002);return _0x1ae652;}return null;})[_0x5ef2('0x11')](respondWithResult(_0x177080,null))[_0x5ef2('0x1c')](handleError(_0x177080,null));};exports[_0x5ef2('0x22')]=function(_0x596673,_0x5a975e){if(_0x596673['body']['id']){delete _0x596673[_0x5ef2('0x49')]['id'];}var _0x27d3e8;return db['WhatsappMessage'][_0x5ef2('0x47')]({'where':{'id':_0x596673[_0x5ef2('0x45')]['id']}})[_0x5ef2('0x11')](handleEntityNotFound(_0x5a975e,null))[_0x5ef2('0x11')](function(_0xf223c9){if(_0xf223c9){_0x27d3e8=_0xf223c9;return db[_0x5ef2('0x64')][_0x5ef2('0x47')]({'where':{'id':_0xf223c9[_0x5ef2('0x65')]}});}})[_0x5ef2('0x11')](handleEntityNotFound(_0x5a975e,null))[_0x5ef2('0x11')](function(_0x175cec){if(_0x175cec){logger[_0x5ef2('0x14')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x5ef2('0x22'),_0x5ef2('0x66'),_0x175cec[_0x5ef2('0x2d')],util[_0x5ef2('0x67')](_0x596673[_0x5ef2('0x49')],{'showHidden':![],'depth':null}));switch(_0x175cec['type']){case _0x5ef2('0x68'):if(_0x596673[_0x5ef2('0x49')]['MessageSid']&&_0x596673[_0x5ef2('0x49')][_0x5ef2('0x69')]===_0x27d3e8[_0x5ef2('0x6a')]&&_0x596673[_0x5ef2('0x49')]['MessageStatus']&&_0x596673[_0x5ef2('0x49')]['MessageStatus']===_0x5ef2('0x6b')){return _0x27d3e8['update']({'read':!![]});}else{logger[_0x5ef2('0x17')](_0x5ef2('0x6c'),'status',_0x5ef2('0x68'),util[_0x5ef2('0x67')](_0x596673['body'],{'showHidden':![],'depth':null}));}break;}return _0x27d3e8;}})[_0x5ef2('0x11')](respondWithResult(_0x5a975e,null))[_0x5ef2('0x1c')](handleError(_0x5a975e,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 0629eb5..eb8dc78 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x174b=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xae8eb1,_0x2099ad){var _0x4400df=function(_0x1a8f69){while(--_0x1a8f69){_0xae8eb1['push'](_0xae8eb1['shift']());}};_0x4400df(++_0x2099ad);}(_0x174b,0x19d));var _0xb174=function(_0x271f3f,_0x1e389f){_0x271f3f=_0x271f3f-0x0;var _0x3c0222=_0x174b[_0x271f3f];return _0x3c0222;};'use strict';var EventEmitter=require(_0xb174('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xb174('0x1')](0x0);var events={'afterCreate':_0xb174('0x2'),'afterUpdate':_0xb174('0x3'),'afterDestroy':_0xb174('0x4')};function emitEvent(_0xe89462){return function(_0x3c1d7d,_0x553d1b,_0x515f54){WhatsappMessageEvents[_0xb174('0x5')](_0xe89462+':'+_0x3c1d7d['id'],_0x3c1d7d);WhatsappMessageEvents[_0xb174('0x5')](_0xe89462,_0x3c1d7d);_0x515f54(null);};}for(var e in events){if(events[_0xb174('0x6')](e)){var event=events[e];WhatsappMessage[_0xb174('0x7')](e,emitEvent(event));}}module[_0xb174('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0xcffe=['../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x23be40,_0x26e1b6){var _0x216312=function(_0x4b03e0){while(--_0x4b03e0){_0x23be40['push'](_0x23be40['shift']());}};_0x216312(++_0x26e1b6);}(_0xcffe,0x1a1));var _0xecff=function(_0x3b632f,_0x453380){_0x3b632f=_0x3b632f-0x0;var _0x10e788=_0xcffe[_0x3b632f];return _0x10e788;};'use strict';var EventEmitter=require(_0xecff('0x0'));var WhatsappMessage=require(_0xecff('0x1'))['db'][_0xecff('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xecff('0x3')](0x0);var events={'afterCreate':_0xecff('0x4'),'afterUpdate':_0xecff('0x5'),'afterDestroy':_0xecff('0x6')};function emitEvent(_0x2045b6){return function(_0x352a15,_0xfffe9b,_0x5410f4){WhatsappMessageEvents['emit'](_0x2045b6+':'+_0x352a15['id'],_0x352a15);WhatsappMessageEvents[_0xecff('0x7')](_0x2045b6,_0x352a15);_0x5410f4(null);};}for(var e in events){if(events[_0xecff('0x8')](e)){var event=events[e];WhatsappMessage[_0xecff('0x9')](e,emitEvent(event));}}module[_0xecff('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 5e91c32..1f62837 100644 --- a/server/api/whatsappMessage/whatsappMessage.model.js +++ b/server/api/whatsappMessage/whatsappMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22c0=['fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','then','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','whatsapp:','/api/whatsapp/messages/','/status?token=','update','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','/messages/','text','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','node-fetch','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0x22c0,0x1c4));var _0x022c=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x22c0[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0x022c('0x0'));var util=require(_0x022c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x022c('0x2'));var BPromise=require(_0x022c('0x3'));var rp=require(_0x022c('0x4'));var fetch=require(_0x022c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x022c('0x6'));var attributes=require(_0x022c('0x7'));module[_0x022c('0x8')]=function(_0x2324c3,_0x37c61e){return _0x2324c3['define'](_0x022c('0x9'),attributes,{'tableName':_0x022c('0xa'),'paranoid':![],'indexes':[{'name':_0x022c('0xb'),'fields':[_0x022c('0xb')]},{'name':_0x022c('0xc'),'fields':[_0x022c('0xd')],'type':_0x022c('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x503af4,_0x23065f,_0x40a63a){var _0x48274d=_0x2324c3['models'];var _0x3f9f6c=_0x503af4[_0x022c('0xf')]({'plain':!![]});if(_0x3f9f6c[_0x022c('0x10')][_0x022c('0x11')]()==='in'||_0x3f9f6c[_0x022c('0x10')][_0x022c('0x11')]()===_0x022c('0x12')&&!_0x3f9f6c[_0x022c('0x13')]&&!_[_0x022c('0x14')](_0x3f9f6c[_0x022c('0x15')])){_0x48274d[_0x022c('0x16')][_0x022c('0x17')]({'where':{'id':_0x3f9f6c['WhatsappInteractionId']}})[_0x022c('0x18')](function(_0x4738cd){if(_0x4738cd){_0x4738cd['update']({'lastMsgAt':_0x3f9f6c[_0x022c('0x19')],'lastMsgDirection':_0x3f9f6c['direction'][_0x022c('0x11')]()});}})[_0x022c('0x1a')](function(_0x2f6dc1){console[_0x022c('0x1b')](_0x2f6dc1);});}if(_0x3f9f6c[_0x022c('0x10')]===_0x022c('0x12')&&!_0x3f9f6c['secret']){var _0x197cf9;_0x48274d[_0x022c('0x1c')][_0x022c('0x1d')]({'where':{'id':_0x3f9f6c[_0x022c('0x1e')]},'raw':!![]})[_0x022c('0x18')](function(_0x9720a8){_0x197cf9=_0x9720a8;if(_0x197cf9&&_0x197cf9[_0x022c('0x1f')]){switch(_0x197cf9[_0x022c('0x1f')]){case _0x022c('0x20'):var _0x3254d1=require(_0x022c('0x20'));if(_0x197cf9[_0x022c('0x21')]&&_0x197cf9[_0x022c('0x22')]&&_0x197cf9[_0x022c('0x23')]){var _0x28ca9e=new _0x3254d1(_0x197cf9[_0x022c('0x21')],_0x197cf9[_0x022c('0x22')]);_0x28ca9e[_0x022c('0x24')]['create']({'body':_0x3f9f6c['body'],'to':'whatsapp:'+_0x3f9f6c[_0x022c('0x23')],'from':_0x022c('0x25')+_0x197cf9['phone'],'statusCallback':_0x197cf9['remote']+_0x022c('0x26')+_0x3f9f6c['id']+_0x022c('0x27')+_0x197cf9['token']})[_0x022c('0x18')](function(_0x3a0bcf){if(_0x3a0bcf['sid']){return _0x503af4[_0x022c('0x28')]({'messageId':_0x3a0bcf[_0x022c('0x29')]});}})[_0x022c('0x1a')](function(_0x1c56f2){logger['error'](_0x022c('0x2a'),_0x022c('0x2b'),_0x022c('0x20'),util['inspect'](_0x1c56f2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x022c('0x2a'),_0x022c('0x2b'),'twilio',_0x022c('0x2c'));}break;case'sinch':var _0x27561d=_0x197cf9['accountSid'];var _0x1ceffa=_0x197cf9[_0x022c('0x22')];var _0x57c957=_0x197cf9[_0x022c('0x2d')]+_0x022c('0x2e')+_0x27561d+_0x022c('0x2f');var _0x193131={'to':[_0x3f9f6c[_0x022c('0x23')]],'message':{'type':_0x022c('0x30'),'text':_0x3f9f6c[_0x022c('0xd')]}};var _0x30364c={'method':_0x022c('0x31'),'uri':_0x57c957,'headers':{'Authorization':'Bearer\x20'+_0x1ceffa,'Content-Type':_0x022c('0x32')},'body':_0x193131,'json':!![]};rp(_0x30364c)[_0x022c('0x18')](function(_0x408440){if(_0x408440[_0x022c('0x33')][0x0]['message_id']){return _0x503af4[_0x022c('0x28')]({'messageId':_0x408440['statuses'][0x0][_0x022c('0x34')]});}})['catch'](function(_0x35d294){logger[_0x022c('0x35')](_0x022c('0x36'),_0x35d294);});break;}}})[_0x022c('0x37')](function(){_0x40a63a();});}else{_0x40a63a();}}},'charset':_0x022c('0x38'),'collate':_0x022c('0x39')});}; \ No newline at end of file +var _0x0c7b=['isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','error','secret','find','type','twilio','accountSid','authToken','create','whatsapp:','phone','/api/whatsapp/messages/','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','node-fetch','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out'];(function(_0xe2ebaa,_0x138483){var _0x563838=function(_0x542a4c){while(--_0x542a4c){_0xe2ebaa['push'](_0xe2ebaa['shift']());}};_0x563838(++_0x138483);}(_0x0c7b,0x189));var _0xb0c7=function(_0x4c05fd,_0x42151a){_0x4c05fd=_0x4c05fd-0x0;var _0x59b2d0=_0x0c7b[_0x4c05fd];return _0x59b2d0;};'use strict';var _=require('lodash');var util=require(_0xb0c7('0x0'));var logger=require(_0xb0c7('0x1'))(_0xb0c7('0x2'));var moment=require(_0xb0c7('0x3'));var BPromise=require('bluebird');var rp=require(_0xb0c7('0x4'));var fetch=require(_0xb0c7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb0c7('0x6'));var config=require(_0xb0c7('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0xb0c7('0x8')]=function(_0x35f764,_0xd16417){return _0x35f764[_0xb0c7('0x9')](_0xb0c7('0xa'),attributes,{'tableName':_0xb0c7('0xb'),'paranoid':![],'indexes':[{'name':_0xb0c7('0xc'),'fields':[_0xb0c7('0xc')]},{'name':'fti_whatsapp_messages','fields':[_0xb0c7('0xd')],'type':_0xb0c7('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ecab2,_0x44ba22,_0x59cf4e){var _0x14ace1=_0x35f764[_0xb0c7('0xf')];var _0x18933e=_0x3ecab2[_0xb0c7('0x10')]({'plain':!![]});if(_0x18933e[_0xb0c7('0x11')][_0xb0c7('0x12')]()==='in'||_0x18933e[_0xb0c7('0x11')][_0xb0c7('0x12')]()===_0xb0c7('0x13')&&!_0x18933e['secret']&&!_[_0xb0c7('0x14')](_0x18933e[_0xb0c7('0x15')])){_0x14ace1[_0xb0c7('0x16')]['findOne']({'where':{'id':_0x18933e[_0xb0c7('0x17')]}})[_0xb0c7('0x18')](function(_0x2f7f63){if(_0x2f7f63){_0x2f7f63[_0xb0c7('0x19')]({'lastMsgAt':_0x18933e[_0xb0c7('0x1a')],'lastMsgDirection':_0x18933e['direction'][_0xb0c7('0x12')]()});}})['catch'](function(_0x2cb97d){console[_0xb0c7('0x1b')](_0x2cb97d);});}if(_0x18933e[_0xb0c7('0x11')]===_0xb0c7('0x13')&&!_0x18933e[_0xb0c7('0x1c')]){var _0x5813c4;_0x14ace1['WhatsappAccount'][_0xb0c7('0x1d')]({'where':{'id':_0x18933e['WhatsappAccountId']},'raw':!![]})[_0xb0c7('0x18')](function(_0xb9f91d){_0x5813c4=_0xb9f91d;if(_0x5813c4&&_0x5813c4['type']){switch(_0x5813c4[_0xb0c7('0x1e')]){case _0xb0c7('0x1f'):var _0xa8e3f4=require(_0xb0c7('0x1f'));if(_0x5813c4[_0xb0c7('0x20')]&&_0x5813c4[_0xb0c7('0x21')]&&_0x5813c4['phone']){var _0x2c19db=new _0xa8e3f4(_0x5813c4['accountSid'],_0x5813c4['authToken']);_0x2c19db['messages'][_0xb0c7('0x22')]({'body':_0x18933e[_0xb0c7('0xd')],'to':_0xb0c7('0x23')+_0x18933e['phone'],'from':_0xb0c7('0x23')+_0x5813c4[_0xb0c7('0x24')],'statusCallback':_0x5813c4['remote']+_0xb0c7('0x25')+_0x18933e['id']+_0xb0c7('0x26')+_0x5813c4[_0xb0c7('0x27')]})[_0xb0c7('0x18')](function(_0x3bc3a9){if(_0x3bc3a9[_0xb0c7('0x28')]){return _0x3ecab2[_0xb0c7('0x19')]({'messageId':_0x3bc3a9[_0xb0c7('0x28')]});}})[_0xb0c7('0x29')](function(_0x45d2a0){logger[_0xb0c7('0x1b')](_0xb0c7('0x2a'),_0xb0c7('0x2b'),'twilio',util[_0xb0c7('0x2c')](_0x45d2a0,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xb0c7('0x2b'),_0xb0c7('0x1f'),_0xb0c7('0x2d'));}break;case _0xb0c7('0x2e'):var _0x30e2a2=_0x5813c4[_0xb0c7('0x20')];var _0x1deef0=_0x5813c4['authToken'];var _0x4a2976=_0x5813c4[_0xb0c7('0x2f')]+_0xb0c7('0x30')+_0x30e2a2+_0xb0c7('0x31');var _0x51baf0={'to':[_0x18933e[_0xb0c7('0x24')]],'message':{'type':_0xb0c7('0x32'),'text':_0x18933e[_0xb0c7('0xd')]}};var _0x175930={'method':_0xb0c7('0x33'),'uri':_0x4a2976,'headers':{'Authorization':'Bearer\x20'+_0x1deef0,'Content-Type':'application/json'},'body':_0x51baf0,'json':!![]};rp(_0x175930)[_0xb0c7('0x18')](function(_0x2a387f){if(_0x2a387f[_0xb0c7('0x34')][0x0][_0xb0c7('0x35')]){return _0x3ecab2[_0xb0c7('0x19')]({'messageId':_0x2a387f[_0xb0c7('0x34')][0x0]['message_id']});}})[_0xb0c7('0x29')](function(_0x246e45){logger[_0xb0c7('0x36')](_0xb0c7('0x37'),_0x246e45);});break;}}})[_0xb0c7('0x38')](function(){_0x59cf4e();});}else{_0x59cf4e();}}},'charset':_0xb0c7('0x39'),'collate':_0xb0c7('0x3a')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 4173a92..a59b72c 100644 --- a/server/api/whatsappMessage/whatsappMessage.rpc.js +++ b/server/api/whatsappMessage/whatsappMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x091f=['result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','lodash','util','bluebird','randomstring','rpc','../../config/environment','client','redis','localhost','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x540c01,_0x5803c){var _0x1f3b93=function(_0x5edbf9){while(--_0x5edbf9){_0x540c01['push'](_0x540c01['shift']());}};_0x1f3b93(++_0x5803c);}(_0x091f,0xa9));var _0xf091=function(_0x322e89,_0x29cc1d){_0x322e89=_0x322e89-0x0;var _0x88f22b=_0x091f[_0x322e89];return _0x88f22b;};'use strict';var _=require(_0xf091('0x0'));var util=require(_0xf091('0x1'));var moment=require('moment');var BPromise=require(_0xf091('0x2'));var rs=require(_0xf091('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf091('0x4'));var config=require(_0xf091('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf091('0x6')]['http']({'port':0x232a});config[_0xf091('0x7')]=_['defaults'](config[_0xf091('0x7')],{'host':_0xf091('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf091('0x9'))[_0xf091('0xa')](socket);function respondWithRpcPromise(_0x8e238,_0x197f3e,_0x10fc8e){return new BPromise(function(_0x279403,_0x2d8dff){return client['request'](_0x8e238,_0x10fc8e)[_0xf091('0xb')](function(_0x30234c){logger[_0xf091('0xc')](_0xf091('0xd'),_0x197f3e,_0xf091('0xe'));logger[_0xf091('0xf')](_0xf091('0x10'),_0x197f3e,_0xf091('0xe'),JSON[_0xf091('0x11')](_0x30234c));if(_0x30234c['error']){if(_0x30234c[_0xf091('0x12')]['code']===0x1f4){logger['error'](_0xf091('0xd'),_0x197f3e,_0x30234c[_0xf091('0x12')]['message']);return _0x2d8dff(_0x30234c[_0xf091('0x12')][_0xf091('0x13')]);}logger[_0xf091('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x197f3e,_0x30234c[_0xf091('0x12')][_0xf091('0x13')]);return _0x279403(_0x30234c[_0xf091('0x12')][_0xf091('0x13')]);}else{logger[_0xf091('0xc')]('WhatsappMessage,\x20%s,\x20%s',_0x197f3e,_0xf091('0xe'));_0x279403(_0x30234c[_0xf091('0x14')]['message']);}})[_0xf091('0x15')](function(_0x34e392){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x197f3e,_0x34e392);_0x2d8dff(_0x34e392);});});}exports[_0xf091('0x16')]=function(_0x23cf4d){var _0x798ab1=this;return new Promise(function(_0x5968af,_0x2e7eca){return db[_0xf091('0x17')]['create'](_0x23cf4d[_0xf091('0x18')],{'raw':_0x23cf4d[_0xf091('0x19')]?_0x23cf4d[_0xf091('0x19')][_0xf091('0x1a')]===undefined?!![]:![]:!![]})[_0xf091('0xb')](function(_0x1de0ea){logger[_0xf091('0xc')](_0xf091('0x16'),_0x23cf4d);logger['debug'](_0xf091('0x16'),_0x23cf4d,JSON[_0xf091('0x11')](_0x1de0ea));_0x5968af(_0x1de0ea);})[_0xf091('0x15')](function(_0x4183f0){logger[_0xf091('0x12')](_0xf091('0x16'),_0x4183f0[_0xf091('0x13')],_0x23cf4d);_0x2e7eca(_0x798ab1[_0xf091('0x12')](0x1f4,_0x4183f0[_0xf091('0x13')]));});});}; \ No newline at end of file +var _0xf854=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappMessage','create','options','raw','CreateWhatsappMessage','lodash','util','moment','bluebird'];(function(_0x2be445,_0x282275){var _0x459614=function(_0x6add12){while(--_0x6add12){_0x2be445['push'](_0x2be445['shift']());}};_0x459614(++_0x282275);}(_0xf854,0xda));var _0x4f85=function(_0x224c4d,_0x473e47){_0x224c4d=_0x224c4d-0x0;var _0x3677c9=_0xf854[_0x224c4d];return _0x3677c9;};'use strict';var _=require(_0x4f85('0x0'));var util=require(_0x4f85('0x1'));var moment=require(_0x4f85('0x2'));var BPromise=require(_0x4f85('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f85('0x4'));var db=require(_0x4f85('0x5'))['db'];var utils=require(_0x4f85('0x6'));var logger=require(_0x4f85('0x7'))(_0x4f85('0x8'));var config=require(_0x4f85('0x9'));var jayson=require(_0x4f85('0xa'));var client=jayson[_0x4f85('0xb')][_0x4f85('0xc')]({'port':0x232a});config[_0x4f85('0xd')]=_[_0x4f85('0xe')](config[_0x4f85('0xd')],{'host':_0x4f85('0xf'),'port':0x18eb});var socket=require(_0x4f85('0x10'))(new Redis(config['redis']));require(_0x4f85('0x11'))[_0x4f85('0x12')](socket);function respondWithRpcPromise(_0x4b3adb,_0x192180,_0x17b686){return new BPromise(function(_0x4ed4b1,_0x48668a){return client[_0x4f85('0x13')](_0x4b3adb,_0x17b686)[_0x4f85('0x14')](function(_0x25434f){logger[_0x4f85('0x15')](_0x4f85('0x16'),_0x192180,_0x4f85('0x17'));logger[_0x4f85('0x18')](_0x4f85('0x19'),_0x192180,'request\x20sent',JSON[_0x4f85('0x1a')](_0x25434f));if(_0x25434f[_0x4f85('0x1b')]){if(_0x25434f[_0x4f85('0x1b')][_0x4f85('0x1c')]===0x1f4){logger[_0x4f85('0x1b')](_0x4f85('0x16'),_0x192180,_0x25434f[_0x4f85('0x1b')][_0x4f85('0x1d')]);return _0x48668a(_0x25434f[_0x4f85('0x1b')]['message']);}logger[_0x4f85('0x1b')]('WhatsappMessage,\x20%s,\x20%s',_0x192180,_0x25434f[_0x4f85('0x1b')][_0x4f85('0x1d')]);return _0x4ed4b1(_0x25434f[_0x4f85('0x1b')][_0x4f85('0x1d')]);}else{logger[_0x4f85('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x192180,_0x4f85('0x17'));_0x4ed4b1(_0x25434f[_0x4f85('0x1e')]['message']);}})[_0x4f85('0x1f')](function(_0x1403f0){logger['error'](_0x4f85('0x16'),_0x192180,_0x1403f0);_0x48668a(_0x1403f0);});});}exports['CreateWhatsappMessage']=function(_0x29ea48){var _0x3dbcea=this;return new Promise(function(_0x12a7d1,_0xd6c3f3){return db[_0x4f85('0x20')][_0x4f85('0x21')](_0x29ea48['body'],{'raw':_0x29ea48[_0x4f85('0x22')]?_0x29ea48[_0x4f85('0x22')][_0x4f85('0x23')]===undefined?!![]:![]:!![]})[_0x4f85('0x14')](function(_0x7a2142){logger[_0x4f85('0x15')](_0x4f85('0x24'),_0x29ea48);logger[_0x4f85('0x18')]('CreateWhatsappMessage',_0x29ea48,JSON[_0x4f85('0x1a')](_0x7a2142));_0x12a7d1(_0x7a2142);})[_0x4f85('0x1f')](function(_0x4375d9){logger[_0x4f85('0x1b')](_0x4f85('0x24'),_0x4375d9['message'],_0x29ea48);_0xd6c3f3(_0x3dbcea[_0x4f85('0x1b')](0x1f4,_0x4375d9[_0x4f85('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 1b00097..a85aafc 100644 --- a/server/api/whatsappMessage/whatsappMessage.socket.js +++ b/server/api/whatsappMessage/whatsappMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf035=['remove','removeListener','register','length','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf035,0x1b7));var _0x5f03=function(_0x38c760,_0x1fb825){_0x38c760=_0x38c760-0x0;var _0xdcba18=_0xf035[_0x38c760];return _0xdcba18;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x5f03('0x0'),_0x5f03('0x1'),'update'];function createListener(_0x317572,_0x2f1381){return function(_0x2af2af){_0x2f1381['emit'](_0x317572,_0x2af2af);};}function removeListener(_0x2ef5ff,_0x326b11){return function(){WhatsappMessageEvents[_0x5f03('0x2')](_0x2ef5ff,_0x326b11);};}exports[_0x5f03('0x3')]=function(_0x598a4f){for(var _0x1abd28=0x0,_0x53d060=events[_0x5f03('0x4')];_0x1abd28<_0x53d060;_0x1abd28++){var _0x2e83c1=events[_0x1abd28];var _0x265ca6=createListener('whatsappMessage:'+_0x2e83c1,_0x598a4f);WhatsappMessageEvents['on'](_0x2e83c1,_0x265ca6);}}; \ No newline at end of file +var _0x57ac=['remove','update','emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x2faa8a,_0x5668ab){var _0x288d30=function(_0x5e3650){while(--_0x5e3650){_0x2faa8a['push'](_0x2faa8a['shift']());}};_0x288d30(++_0x5668ab);}(_0x57ac,0x127));var _0xc57a=function(_0x403e26,_0x52cfda){_0x403e26=_0x403e26-0x0;var _0x5136e3=_0x57ac[_0x403e26];return _0x5136e3;};'use strict';var WhatsappMessageEvents=require(_0xc57a('0x0'));var events=[_0xc57a('0x1'),_0xc57a('0x2'),_0xc57a('0x3')];function createListener(_0x1dd941,_0x4b5dfa){return function(_0x25872f){_0x4b5dfa[_0xc57a('0x4')](_0x1dd941,_0x25872f);};}function removeListener(_0x38f607,_0x531f27){return function(){WhatsappMessageEvents[_0xc57a('0x5')](_0x38f607,_0x531f27);};}exports[_0xc57a('0x6')]=function(_0x4a2e8c){for(var _0x2e01f7=0x0,_0x27a9e6=events[_0xc57a('0x7')];_0x2e01f7<_0x27a9e6;_0x2e01f7++){var _0xe789ec=events[_0x2e01f7];var _0x441703=createListener(_0xc57a('0x8')+_0xe789ec,_0x4a2e8c);WhatsappMessageEvents['on'](_0xe789ec,_0x441703);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index c439648..245c97a 100644 --- a/server/api/whatsappQueue/index.js +++ b/server/api/whatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c22=['/:id/teams','getTeams','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','show','/:id/members','getMembers'];(function(_0x32dd77,_0x27bf01){var _0x2cc052=function(_0x3a11bf){while(--_0x3a11bf){_0x32dd77['push'](_0x32dd77['shift']());}};_0x2cc052(++_0x27bf01);}(_0x4c22,0x177));var _0x24c2=function(_0xd089be,_0x1fc680){_0xd089be=_0xd089be-0x0;var _0x36ffb9=_0x4c22[_0xd089be];return _0x36ffb9;};'use strict';var multer=require(_0x24c2('0x0'));var util=require('util');var path=require(_0x24c2('0x1'));var timeout=require(_0x24c2('0x2'));var express=require(_0x24c2('0x3'));var router=express[_0x24c2('0x4')]();var fs_extra=require(_0x24c2('0x5'));var auth=require(_0x24c2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24c2('0x7'));var controller=require('./whatsappQueue.controller');router[_0x24c2('0x8')]('/',auth['isAuthenticated'](),controller[_0x24c2('0x9')]);router['get']('/describe',auth[_0x24c2('0xa')](),controller[_0x24c2('0xb')]);router[_0x24c2('0x8')]('/:id',auth[_0x24c2('0xa')](),controller[_0x24c2('0xc')]);router[_0x24c2('0x8')](_0x24c2('0xd'),auth[_0x24c2('0xa')](),controller[_0x24c2('0xe')]);router[_0x24c2('0x8')](_0x24c2('0xf'),auth[_0x24c2('0xa')](),controller[_0x24c2('0x10')]);router[_0x24c2('0x8')]('/:id/users',auth[_0x24c2('0xa')](),controller[_0x24c2('0x11')]);router[_0x24c2('0x12')]('/',auth[_0x24c2('0xa')](),controller[_0x24c2('0x13')]);router[_0x24c2('0x12')](_0x24c2('0xf'),auth[_0x24c2('0xa')](),controller[_0x24c2('0x14')]);router[_0x24c2('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0x24c2('0x15')]);router[_0x24c2('0x16')](_0x24c2('0x17'),auth[_0x24c2('0xa')](),controller[_0x24c2('0x18')]);router[_0x24c2('0x19')](_0x24c2('0x17'),auth[_0x24c2('0xa')](),controller[_0x24c2('0x1a')]);router['delete'](_0x24c2('0xf'),auth[_0x24c2('0xa')](),controller[_0x24c2('0x1b')]);router[_0x24c2('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x24c2('0x1c')]);module[_0x24c2('0x1d')]=router; \ No newline at end of file +var _0x9e25=['post','create','addAgents','update','delete','destroy','removeTeams','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x430dfd,_0x4b3e82){var _0x567dfa=function(_0x11175c){while(--_0x11175c){_0x430dfd['push'](_0x430dfd['shift']());}};_0x567dfa(++_0x4b3e82);}(_0x9e25,0x12a));var _0x59e2=function(_0xccf334,_0x603759){_0xccf334=_0xccf334-0x0;var _0x123cf8=_0x9e25[_0xccf334];return _0x123cf8;};'use strict';var multer=require(_0x59e2('0x0'));var util=require(_0x59e2('0x1'));var path=require('path');var timeout=require(_0x59e2('0x2'));var express=require(_0x59e2('0x3'));var router=express[_0x59e2('0x4')]();var fs_extra=require(_0x59e2('0x5'));var auth=require(_0x59e2('0x6'));var interaction=require(_0x59e2('0x7'));var config=require(_0x59e2('0x8'));var controller=require(_0x59e2('0x9'));router[_0x59e2('0xa')]('/',auth[_0x59e2('0xb')](),controller['index']);router['get'](_0x59e2('0xc'),auth[_0x59e2('0xb')](),controller[_0x59e2('0xd')]);router[_0x59e2('0xa')](_0x59e2('0xe'),auth[_0x59e2('0xb')](),controller['show']);router[_0x59e2('0xa')](_0x59e2('0xf'),auth[_0x59e2('0xb')](),controller[_0x59e2('0x10')]);router[_0x59e2('0xa')](_0x59e2('0x11'),auth[_0x59e2('0xb')](),controller[_0x59e2('0x12')]);router[_0x59e2('0xa')](_0x59e2('0x13'),auth[_0x59e2('0xb')](),controller[_0x59e2('0x14')]);router[_0x59e2('0x15')]('/',auth[_0x59e2('0xb')](),controller[_0x59e2('0x16')]);router[_0x59e2('0x15')](_0x59e2('0x11'),auth['isAuthenticated'](),controller['addTeams']);router[_0x59e2('0x15')](_0x59e2('0x13'),auth['isAuthenticated'](),controller[_0x59e2('0x17')]);router['put'](_0x59e2('0xe'),auth[_0x59e2('0xb')](),controller[_0x59e2('0x18')]);router[_0x59e2('0x19')]('/:id',auth[_0x59e2('0xb')](),controller[_0x59e2('0x1a')]);router['delete'](_0x59e2('0x11'),auth[_0x59e2('0xb')](),controller[_0x59e2('0x1b')]);router[_0x59e2('0x19')](_0x59e2('0x13'),auth[_0x59e2('0xb')](),controller['removeAgents']);module[_0x59e2('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index f8d8c40..6a36a33 100644 --- a/server/api/whatsappQueue/whatsappQueue.attributes.js +++ b/server/api/whatsappQueue/whatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e0d=['rrmemory','beepall','roundrobin','STRING','sequelize','name','INTEGER'];(function(_0x123d3d,_0x114ea5){var _0x5707bf=function(_0x9e1a39){while(--_0x9e1a39){_0x123d3d['push'](_0x123d3d['shift']());}};_0x5707bf(++_0x114ea5);}(_0x8e0d,0x82));var _0xd8e0=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x8e0d[_0x548627];return _0x844a84;};'use strict';var Sequelize=require(_0xd8e0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xd8e0('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xd8e0('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xd8e0('0x3'),_0xd8e0('0x4'),_0xd8e0('0x5'))},'description':{'type':Sequelize[_0xd8e0('0x6')]}}; \ No newline at end of file +var _0x9c44=['INTEGER','ENUM','rrmemory','beepall','STRING','name'];(function(_0x391b36,_0x51a6a1){var _0x17adc8=function(_0x332491){while(--_0x332491){_0x391b36['push'](_0x391b36['shift']());}};_0x17adc8(++_0x51a6a1);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49c4('0x0')],'unique':_0x49c4('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x49c4('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x49c4('0x3')](_0x49c4('0x4'),_0x49c4('0x5'),'roundrobin')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 625acc4..fe15061 100644 --- a/server/api/whatsappQueue/whatsappQueue.controller.js +++ b/server/api/whatsappQueue/whatsappQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x561f=['end','offset','undefined','limit','count','Content-Range','json','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','type','getOptions','where','include','query','findAll','rows','catch','show','params','keys','filters','intersection','model','attributes','fields','length','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','order','pick','filter','merge','User','agent','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','sort','addTeams','ids','Agents','online','voicePause','flatMap','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','tq.TeamId','team_has_whatsapp_queues','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','bluebird','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status'];(function(_0x4c2c66,_0x149bb1){var _0x4cba29=function(_0x10f261){while(--_0x10f261){_0x4c2c66['push'](_0x4c2c66['shift']());}};_0x4cba29(++_0x149bb1);}(_0x561f,0x15a));var _0xf561=function(_0x46ad7b,_0xc31c90){_0x46ad7b=_0x46ad7b-0x0;var _0x2009bb=_0x561f[_0x46ad7b];return _0x2009bb;};'use strict';var BPromise=require(_0xf561('0x0'));var util=require('util');var _=require(_0xf561('0x1'));var squel=require(_0xf561('0x2'));var Redis=require('ioredis');var qs=require(_0xf561('0x3'));var logger=require(_0xf561('0x4'))('api');var config=require(_0xf561('0x5'));var db=require(_0xf561('0x6'))['db'];config[_0xf561('0x7')]=_[_0xf561('0x8')](config['redis'],{'host':_0xf561('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf561('0x7')]));require(_0xf561('0xa'))[_0xf561('0xb')](socket);function respondWithStatusCode(_0x5ad503,_0x391b6d){_0x391b6d=_0x391b6d||0xcc;return function(_0x1d00c8){if(_0x1d00c8){return _0x5ad503[_0xf561('0xc')](_0x391b6d);}return _0x5ad503[_0xf561('0xd')](_0x391b6d)[_0xf561('0xe')]();};}function respondWithResult(_0x1d2eca,_0x42c114){_0x42c114=_0x42c114||0xc8;return function(_0x451484){if(_0x451484){return _0x1d2eca[_0xf561('0xd')](_0x42c114)['json'](_0x451484);}};}function respondWithFilteredResult(_0x35ef4e,_0x131a87){return function(_0x5ec159){if(_0x5ec159){var _0x2fab95=typeof _0x131a87[_0xf561('0xf')]===_0xf561('0x10')&&typeof _0x131a87[_0xf561('0x11')]==='undefined';var _0x43cbf4=_0x5ec159[_0xf561('0x12')];var _0x72812a=_0x2fab95?0x0:_0x131a87[_0xf561('0xf')];var _0x5c8a12=_0x2fab95?_0x5ec159[_0xf561('0x12')]:_0x131a87[_0xf561('0xf')]+_0x131a87[_0xf561('0x11')];var _0x4445f4;if(_0x5c8a12>=_0x43cbf4){_0x5c8a12=_0x43cbf4;_0x4445f4=0xc8;}else{_0x4445f4=0xce;}_0x35ef4e['status'](_0x4445f4);return _0x35ef4e['set'](_0xf561('0x13'),_0x72812a+'-'+_0x5c8a12+'/'+_0x43cbf4)[_0xf561('0x14')](_0x5ec159);}return null;};}function saveUpdates(_0x3968d5){return function(_0x1757ce){if(_0x1757ce){return _0x1757ce[_0xf561('0x15')](_0x3968d5)[_0xf561('0x16')](function(_0x211db4){return _0x211db4;});}return null;};}function removeEntity(_0x202d98){return function(_0x16eec8){if(_0x16eec8){return _0x16eec8[_0xf561('0x17')]()[_0xf561('0x16')](function(){var _0x142669=_0x16eec8[_0xf561('0x18')]({'plain':!![]});var _0x11309e=_0xf561('0x19');return db[_0xf561('0x1a')][_0xf561('0x17')]({'where':{'type':_0x11309e,'resourceId':_0x142669['id']}})[_0xf561('0x16')](function(){return _0x16eec8;});})[_0xf561('0x16')](function(){_0x202d98[_0xf561('0xd')](0xcc)[_0xf561('0xe')]();});}};}function handleEntityNotFound(_0x17895c){return function(_0x1bd85c){if(!_0x1bd85c){_0x17895c[_0xf561('0xc')](0x194);}return _0x1bd85c;};}function handleError(_0x4147b4,_0x50ef8e){_0x50ef8e=_0x50ef8e||0x1f4;return function(_0x129242){logger[_0xf561('0x1b')](_0x129242[_0xf561('0x1c')]);if(_0x129242[_0xf561('0x1d')]){delete _0x129242['name'];}_0x4147b4[_0xf561('0xd')](_0x50ef8e)[_0xf561('0x1e')](_0x129242);};}exports[_0xf561('0x1f')]=function(_0x1d57b7,_0x388a14){var _0x2f827c={};var _0x196dea={'count':0x0,'rows':[]};var _0x311d5b=_[_0xf561('0x20')](db[_0xf561('0x21')][_0xf561('0x22')],function(_0x51ebec){return{'name':_0x51ebec['fieldName'],'type':_0x51ebec[_0xf561('0x23')]['key']};});_0x2f827c=qs[_0xf561('0x24')](_0x311d5b,_0x1d57b7);var _0x10f8d6={'where':_0x2f827c[_0xf561('0x25')]};return db[_0xf561('0x21')]['count'](_0x10f8d6)[_0xf561('0x16')](function(_0x12e342){_0x196dea[_0xf561('0x12')]=_0x12e342;_0x2f827c[_0xf561('0x26')]=qs['include'](_0x1d57b7[_0xf561('0x27')]);return db[_0xf561('0x21')][_0xf561('0x28')](_0x2f827c);})[_0xf561('0x16')](function(_0x35a080){_0x196dea[_0xf561('0x29')]=_0x35a080;return _0x196dea;})['then'](respondWithFilteredResult(_0x388a14,_0x2f827c))[_0xf561('0x2a')](handleError(_0x388a14,null));};exports[_0xf561('0x2b')]=function(_0x13ab2d,_0x7b2437){var _0x4002b1={'raw':!![],'where':{'id':_0x13ab2d[_0xf561('0x2c')]['id']}},_0x4cf71f={};_0x4cf71f['model']=_[_0xf561('0x2d')](db['WhatsappQueue'][_0xf561('0x22')]);_0x4cf71f[_0xf561('0x27')]=_['keys'](_0x13ab2d['query']);_0x4cf71f[_0xf561('0x2e')]=_[_0xf561('0x2f')](_0x4cf71f[_0xf561('0x30')],_0x4cf71f['query']);_0x4002b1[_0xf561('0x31')]=_[_0xf561('0x2f')](_0x4cf71f[_0xf561('0x30')],qs[_0xf561('0x32')](_0x13ab2d[_0xf561('0x27')][_0xf561('0x32')]));_0x4002b1['attributes']=_0x4002b1[_0xf561('0x31')][_0xf561('0x33')]?_0x4002b1[_0xf561('0x31')]:_0x4cf71f[_0xf561('0x30')];if(_0x13ab2d[_0xf561('0x27')][_0xf561('0x34')]){_0x4002b1['include']=[{'all':!![]}];}_0x4002b1=_['merge']({},_0x4002b1,_0x13ab2d[_0xf561('0x35')]);return db[_0xf561('0x21')][_0xf561('0x36')](_0x4002b1)[_0xf561('0x16')](handleEntityNotFound(_0x7b2437,null))[_0xf561('0x16')](respondWithResult(_0x7b2437,null))[_0xf561('0x2a')](handleError(_0x7b2437,null));};exports[_0xf561('0x37')]=function(_0x7a3eca,_0x3d7ae1){return db[_0xf561('0x21')]['create'](_0x7a3eca['body'],{})[_0xf561('0x16')](function(_0x15f2dd){var _0x3ae4af=_0x7a3eca[_0xf561('0x38')][_0xf561('0x18')]({'plain':!![]});if(!_0x3ae4af)throw new Error(_0xf561('0x39'));if(_0x3ae4af['role']===_0xf561('0x38')){var _0x46e118=_0x15f2dd[_0xf561('0x18')]({'plain':!![]});var _0x2d1a05=_0xf561('0x19');return db[_0xf561('0x3a')][_0xf561('0x36')]({'where':{'name':_0x2d1a05,'userProfileId':_0x3ae4af[_0xf561('0x3b')]},'raw':!![]})[_0xf561('0x16')](function(_0xc4a5c){if(_0xc4a5c&&_0xc4a5c[_0xf561('0x3c')]===0x0){return db[_0xf561('0x1a')]['create']({'name':_0x46e118[_0xf561('0x1d')],'resourceId':_0x46e118['id'],'type':_0xc4a5c[_0xf561('0x1d')],'sectionId':_0xc4a5c['id']},{})['then'](function(){return _0x15f2dd;});}else{return _0x15f2dd;}})[_0xf561('0x2a')](function(_0x2601fa){logger['error'](_0xf561('0x3d'),_0x2601fa);throw _0x2601fa;});}return _0x15f2dd;})[_0xf561('0x16')](respondWithResult(_0x3d7ae1,0xc9))[_0xf561('0x2a')](handleError(_0x3d7ae1,null));};exports[_0xf561('0x15')]=function(_0x1a748f,_0x2ebea8){if(_0x1a748f[_0xf561('0x3e')]['id']){delete _0x1a748f['body']['id'];}return db[_0xf561('0x21')][_0xf561('0x36')]({'where':{'id':_0x1a748f[_0xf561('0x2c')]['id']}})[_0xf561('0x16')](handleEntityNotFound(_0x2ebea8,null))[_0xf561('0x16')](saveUpdates(_0x1a748f['body'],null))[_0xf561('0x16')](respondWithResult(_0x2ebea8,null))[_0xf561('0x2a')](handleError(_0x2ebea8,null));};exports['destroy']=function(_0x57752f,_0x3c1a48){return db[_0xf561('0x21')][_0xf561('0x36')]({'where':{'id':_0x57752f[_0xf561('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3c1a48,null))['then'](removeEntity(_0x3c1a48,null))[_0xf561('0x2a')](handleError(_0x3c1a48,null));};exports[_0xf561('0x3f')]=function(_0x490756,_0x558b5e){return db[_0xf561('0x21')][_0xf561('0x3f')]()[_0xf561('0x16')](respondWithResult(_0x558b5e,null))[_0xf561('0x2a')](handleError(_0x558b5e,null));};exports[_0xf561('0x40')]=function(_0x3564b5,_0x2e4727){var _0x2488d2={'raw':!![],'where':{}},_0x41bb8f={},_0x1d7410;return db['WhatsappQueue'][_0xf561('0x41')]({'where':{'id':_0x3564b5[_0xf561('0x2c')]['id']}})[_0xf561('0x16')](handleEntityNotFound(_0x2e4727,null))[_0xf561('0x16')](function(_0x14033d){if(_0x14033d){_0x1d7410=_0x14033d[_0xf561('0x18')]({'plain':!![]});_0x41bb8f['model']=_[_0xf561('0x2d')](db[_0xf561('0x42')][_0xf561('0x22')]);_0x41bb8f[_0xf561('0x27')]=_['keys'](_0x3564b5[_0xf561('0x27')]);_0x41bb8f[_0xf561('0x2e')]=_[_0xf561('0x2f')](_0x41bb8f[_0xf561('0x30')],_0x41bb8f[_0xf561('0x27')]);_0x2488d2[_0xf561('0x31')]=_[_0xf561('0x2f')](_0x41bb8f[_0xf561('0x30')],qs[_0xf561('0x32')](_0x3564b5['query']['fields']));_0x2488d2['attributes']=_0x2488d2[_0xf561('0x31')][_0xf561('0x33')]?_0x2488d2[_0xf561('0x31')]:_0x41bb8f['model'];if(!_0x3564b5[_0xf561('0x27')][_0xf561('0x43')](_0xf561('0x44'))){_0x2488d2[_0xf561('0x11')]=qs[_0xf561('0x11')](_0x3564b5[_0xf561('0x27')][_0xf561('0x11')]);_0x2488d2[_0xf561('0xf')]=qs['offset'](_0x3564b5[_0xf561('0x27')]['offset']);}_0x2488d2[_0xf561('0x45')]=qs['sort'](_0x3564b5[_0xf561('0x27')]['sort']);_0x2488d2[_0xf561('0x25')]=qs[_0xf561('0x2e')](_[_0xf561('0x46')](_0x3564b5[_0xf561('0x27')],_0x41bb8f[_0xf561('0x2e')]));_0x2488d2[_0xf561('0x25')]['WhatsappQueueId']=_0x14033d['id'];if(_0x3564b5[_0xf561('0x27')][_0xf561('0x47')]){_0x2488d2[_0xf561('0x25')]=_[_0xf561('0x48')](_0x2488d2[_0xf561('0x25')],{'$or':_[_0xf561('0x20')](_0x2488d2['attributes'],function(_0x4ae8c8){var _0x221255={};_0x221255[_0x4ae8c8]={'$like':'%'+_0x3564b5[_0xf561('0x27')][_0xf561('0x47')]+'%'};return _0x221255;})});}_0x2488d2=_[_0xf561('0x48')]({},_0x2488d2,_0x3564b5[_0xf561('0x35')]);return db['UserWhatsappQueue'][_0xf561('0x28')](_0x2488d2);}})[_0xf561('0x16')](function(_0x2d523a){if(_0x2d523a){return db[_0xf561('0x49')]['findAndCountAll']({'where':{'id':_[_0xf561('0x20')](_0x2d523a,'UserId'),'role':_0xf561('0x4a')},'attributes':['id',_0xf561('0x1d'),_0xf561('0x4b'),_0xf561('0x4c'),'createdAt']});}})[_0xf561('0x16')](function(_0x12a10a){if(_0x12a10a){return{'count':_0x12a10a['count'],'rows':_[_0xf561('0x20')](_0x12a10a[_0xf561('0x29')],function(_0x247532){return{'membername':_0x247532['name'],'UserId':_0x247532['id'],'queue_name':_0x1d7410['name'],'WhatsappQueueId':_0x1d7410['id'],'interface':util[_0xf561('0x4d')](_0xf561('0x4e'),_0xf561('0x4f'),_0x247532[_0xf561('0x1d')]),'penalty':0x0,'paused':_0x247532[_0xf561('0x4b')],'createdAt':_0x247532[_0xf561('0x50')],'updatedAt':_0x247532[_0xf561('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2e4727,_0x2488d2))['catch'](handleError(_0x2e4727,null));};exports[_0xf561('0x51')]=function(_0x158a52,_0x12d9a1){var _0x5bf9d3={};var _0x56915a={};var _0x2c9039;var _0x133bbd;return db[_0xf561('0x21')]['findOne']({'where':{'id':_0x158a52['params']['id']}})[_0xf561('0x16')](handleEntityNotFound(_0x12d9a1,null))[_0xf561('0x16')](function(_0x1ce214){if(_0x1ce214){_0x2c9039=_0x1ce214;_0x56915a[_0xf561('0x30')]=_[_0xf561('0x2d')](db[_0xf561('0x52')][_0xf561('0x22')]);_0x56915a[_0xf561('0x27')]=_['keys'](_0x158a52['query']);_0x56915a[_0xf561('0x2e')]=_[_0xf561('0x2f')](_0x56915a[_0xf561('0x30')],_0x56915a['query']);_0x5bf9d3[_0xf561('0x31')]=_[_0xf561('0x2f')](_0x56915a[_0xf561('0x30')],qs[_0xf561('0x32')](_0x158a52['query'][_0xf561('0x32')]));_0x5bf9d3[_0xf561('0x31')]=_0x5bf9d3[_0xf561('0x31')][_0xf561('0x33')]?_0x5bf9d3[_0xf561('0x31')]:_0x56915a[_0xf561('0x30')];_0x5bf9d3[_0xf561('0x45')]=qs[_0xf561('0x53')](_0x158a52[_0xf561('0x27')][_0xf561('0x53')]);_0x5bf9d3['where']=qs[_0xf561('0x2e')](_['pick'](_0x158a52[_0xf561('0x27')],_0x56915a['filters']));if(_0x158a52['query'][_0xf561('0x47')]){_0x5bf9d3[_0xf561('0x25')]=_[_0xf561('0x48')](_0x5bf9d3['where'],{'$or':_[_0xf561('0x20')](_0x5bf9d3[_0xf561('0x31')],function(_0x2901d4){var _0x3c967a={};_0x3c967a[_0x2901d4]={'$like':'%'+_0x158a52['query'][_0xf561('0x47')]+'%'};return _0x3c967a;})});}_0x5bf9d3=_[_0xf561('0x48')]({},_0x5bf9d3,_0x158a52[_0xf561('0x35')]);return _0x2c9039[_0xf561('0x51')](_0x5bf9d3);}})['then'](function(_0x220b21){if(_0x220b21){_0x133bbd=_0x220b21[_0xf561('0x33')];if(!_0x158a52['query']['hasOwnProperty']('nolimit')){_0x5bf9d3['limit']=qs[_0xf561('0x11')](_0x158a52[_0xf561('0x27')][_0xf561('0x11')]);_0x5bf9d3[_0xf561('0xf')]=qs[_0xf561('0xf')](_0x158a52[_0xf561('0x27')][_0xf561('0xf')]);}return _0x2c9039['getTeams'](_0x5bf9d3);}})['then'](function(_0xf5ead8){if(_0xf5ead8){return _0xf5ead8?{'count':_0x133bbd,'rows':_0xf5ead8}:null;}})['then'](respondWithResult(_0x12d9a1,null))[_0xf561('0x2a')](handleError(_0x12d9a1,null));};exports[_0xf561('0x54')]=function(_0x2ad9d5,_0x366090){var _0x3c710e=_0x2ad9d5['body'][_0xf561('0x55')];return db[_0xf561('0x52')][_0xf561('0x28')]({'where':{'id':_0x3c710e},'attributes':['id'],'include':[{'model':db[_0xf561('0x49')],'as':_0xf561('0x56'),'attributes':['id','name',_0xf561('0x57'),_0xf561('0x58'),'interface'],'raw':!![]}]})[_0xf561('0x16')](function(_0x2a8c3d){if(_0x2a8c3d){var _0x50f602=_[_0xf561('0x59')](_0x2a8c3d,function(_0x4335cf){var _0x26e3ae=_0x4335cf['get']({'plain':!![]});return _0x26e3ae[_0xf561('0x56')];});return db[_0xf561('0x21')][_0xf561('0x36')]({'where':{'id':_0x2ad9d5['params']['id']}})[_0xf561('0x16')](function(_0x19b680){return db['sequelize'][_0xf561('0x5a')](function(_0x27cc68){return _0x19b680[_0xf561('0x54')](_0x3c710e,{'transaction':_0x27cc68})['then'](function(){return BPromise[_0xf561('0x5b')](_0x50f602,function(_0x7b74ce){return db[_0xf561('0x42')][_0xf561('0x5c')]({'where':{'UserId':_0x7b74ce['id'],'WhatsappQueueId':_0x2ad9d5['params']['id']},'transaction':_0x27cc68});});})[_0xf561('0x16')](function(){_0x50f602[_0xf561('0x5d')](function(_0x2e6b2e){socket[_0xf561('0x5e')](_0xf561('0x5f'),{'UserId':_0x2e6b2e['id'],'WhatsappQueueId':_0x19b680['id']});});});});});}})[_0xf561('0x16')](respondWithStatusCode(_0x366090,null))[_0xf561('0x2a')](handleError(_0x366090,null));};exports[_0xf561('0x60')]=function(_0x8ec457,_0x1cde5a){return db[_0xf561('0x52')][_0xf561('0x28')]({'where':{'id':_0x8ec457['query'][_0xf561('0x55')]},'attributes':['id'],'include':[{'model':db[_0xf561('0x49')],'as':_0xf561('0x56'),'attributes':['id'],'raw':!![]}]})[_0xf561('0x16')](handleEntityNotFound(_0x1cde5a,null))[_0xf561('0x16')](function(_0x400f5a){var _0x17d23d=_[_0xf561('0x20')](_0x400f5a,'id');var _0x4bd31a=[];var _0x3f29b4=[];var _0x4ceec4=squel[_0xf561('0x61')]();_0x4ceec4['field'](_0xf561('0x62'))['from'](_0xf561('0x63'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xf561('0x64'),_0x8ec457[_0xf561('0x2c')]['id']);for(var _0x586cf5=0x0;_0x586cf5<_0x400f5a[_0xf561('0x33')];_0x586cf5+=0x1){let _0x2ba1c5=_0x400f5a[_0x586cf5];for(var _0x41414c=0x0;_0x41414c<_0x2ba1c5['Agents']['length'];_0x41414c+=0x1){let _0x14f758=_0x2ba1c5['Agents'][_0x41414c];var _0x13deba=_0x4ceec4[_0xf561('0x65')]();_0x13deba[_0xf561('0x25')](_0xf561('0x66'),_0x14f758['id']);_0x3f29b4[_0xf561('0x67')](db[_0xf561('0x68')]['query'](_0x13deba[_0xf561('0x69')](),{'type':db[_0xf561('0x68')][_0xf561('0x6a')][_0xf561('0x6b')]})['then'](function(_0xa75465){if(_0xa75465['length']===0x1){return _0x14f758['id'];}else{var _0x295029=_[_0xf561('0x6c')](_[_0xf561('0x20')](_0xa75465,_0xf561('0x6d')),function(_0xf4bb9){return _[_0xf561('0x6e')](_0x17d23d,_0xf4bb9);});if(_0x295029){return _0x14f758['id'];}}}));}}return BPromise[_0xf561('0x6f')](_0x3f29b4)['then'](function(_0x27c3d8){_0x4bd31a=_(_0x4bd31a)[_0xf561('0x70')](_0x27c3d8)['compact']()[_0xf561('0x71')]();return db[_0xf561('0x21')]['find']({'where':{'id':_0x8ec457['params']['id']}})[_0xf561('0x16')](function(_0x1d0683){return db[_0xf561('0x68')][_0xf561('0x5a')](function(_0x360cba){return _0x1d0683[_0xf561('0x60')](_0x8ec457[_0xf561('0x27')][_0xf561('0x55')],{'transaction':_0x360cba})[_0xf561('0x16')](function(){if(!_['isEmpty'](_0x4bd31a)){return _0x1d0683[_0xf561('0x72')](_0x4bd31a,{'transaction':_0x360cba});}})[_0xf561('0x16')](function(){_0x4bd31a[_0xf561('0x5d')](function(_0x3cd5e1){socket[_0xf561('0x5e')](_0xf561('0x73'),{'UserId':_0x3cd5e1,'WhatsappQueueId':_0x1d0683['id']});});});});});});})['then'](respondWithStatusCode(_0x1cde5a,null))[_0xf561('0x2a')](handleError(_0x1cde5a,null));};exports[_0xf561('0x74')]=function(_0xac9d85,_0xd4e639){return db[_0xf561('0x21')][_0xf561('0x36')]({'where':{'id':_0xac9d85[_0xf561('0x2c')]['id']}})['then'](handleEntityNotFound(_0xd4e639,null))[_0xf561('0x16')](function(_0x94b1de){if(_0x94b1de){return _0x94b1de[_0xf561('0x74')](_0xac9d85[_0xf561('0x3e')]['ids'],_[_0xf561('0x75')](_0xac9d85[_0xf561('0x3e')],[_0xf561('0x55'),'id'])||{})[_0xf561('0x76')](function(_0x16407f){for(var _0x4368a6=0x0;_0x4368a6<_0xac9d85[_0xf561('0x3e')][_0xf561('0x55')][_0xf561('0x33')];_0x4368a6+=0x1){socket['emit'](_0xf561('0x5f'),{'UserId':Number(_0xac9d85[_0xf561('0x3e')]['ids'][_0x4368a6]),'WhatsappQueueId':Number(_0xac9d85[_0xf561('0x2c')]['id'])});}return _0x16407f;});}})['then'](respondWithResult(_0xd4e639,null))['catch'](handleError(_0xd4e639,null));};exports[_0xf561('0x72')]=function(_0x5d8812,_0x44d134){return db[_0xf561('0x21')]['find']({'where':{'id':_0x5d8812[_0xf561('0x2c')]['id']}})[_0xf561('0x16')](handleEntityNotFound(_0x44d134,null))['then'](function(_0x56f3a){if(_0x56f3a){return _0x56f3a['removeAgents'](_0x5d8812[_0xf561('0x27')]['ids'])[_0xf561('0x16')](function(){if(_['isArray'](_0x5d8812[_0xf561('0x27')][_0xf561('0x55')])){for(var _0x3de8d2=0x0;_0x3de8d2<_0x5d8812[_0xf561('0x27')]['ids'][_0xf561('0x33')];_0x3de8d2+=0x1){socket[_0xf561('0x5e')](_0xf561('0x73'),{'UserId':Number(_0x5d8812[_0xf561('0x27')]['ids'][_0x3de8d2]),'WhatsappQueueId':Number(_0x5d8812['params']['id'])});}}else{socket[_0xf561('0x5e')]('userWhatsappQueue:remove',{'UserId':Number(_0x5d8812[_0xf561('0x27')][_0xf561('0x55')]),'WhatsappQueueId':Number(_0x5d8812[_0xf561('0x2c')]['id'])});}});}})['then'](respondWithStatusCode(_0x44d134,null))[_0xf561('0x2a')](handleError(_0x44d134,null));};exports[_0xf561('0x77')]=function(_0x196a4c,_0x2e64a4){var _0x59fde7={};var _0x3ae44f={};var _0x544262;var _0x3b90ad;return db[_0xf561('0x21')]['findOne']({'where':{'id':_0x196a4c[_0xf561('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2e64a4,null))['then'](function(_0xc0804a){if(_0xc0804a){_0x544262=_0xc0804a;_0x3ae44f['model']=_[_0xf561('0x2d')](db[_0xf561('0x49')][_0xf561('0x22')]);_0x3ae44f['query']=_[_0xf561('0x2d')](_0x196a4c[_0xf561('0x27')]);_0x3ae44f[_0xf561('0x2e')]=_['intersection'](_0x3ae44f['model'],_0x3ae44f[_0xf561('0x27')]);_0x59fde7[_0xf561('0x31')]=_[_0xf561('0x2f')](_0x3ae44f['model'],qs[_0xf561('0x32')](_0x196a4c[_0xf561('0x27')][_0xf561('0x32')]));_0x59fde7[_0xf561('0x31')]=_0x59fde7[_0xf561('0x31')][_0xf561('0x33')]?_0x59fde7[_0xf561('0x31')]:_0x3ae44f['model'];_0x59fde7[_0xf561('0x45')]=qs[_0xf561('0x53')](_0x196a4c[_0xf561('0x27')][_0xf561('0x53')]);_0x59fde7[_0xf561('0x25')]=qs[_0xf561('0x2e')](_['pick'](_0x196a4c['query'],_0x3ae44f[_0xf561('0x2e')]));if(_0x196a4c['query'][_0xf561('0x47')]){_0x59fde7[_0xf561('0x25')]=_[_0xf561('0x48')](_0x59fde7['where'],{'$or':_[_0xf561('0x20')](_0x59fde7[_0xf561('0x31')],function(_0x21cebd){var _0x21c51d={};_0x21c51d[_0x21cebd]={'$like':'%'+_0x196a4c[_0xf561('0x27')]['filter']+'%'};return _0x21c51d;})});}_0x59fde7=_[_0xf561('0x48')]({},_0x59fde7,_0x196a4c[_0xf561('0x35')]);return _0x544262[_0xf561('0x77')](_0x59fde7);}})[_0xf561('0x16')](function(_0x723b76){if(_0x723b76){_0x3b90ad=_0x723b76[_0xf561('0x33')];if(!_0x196a4c['query'][_0xf561('0x43')](_0xf561('0x44'))){_0x59fde7[_0xf561('0x11')]=qs[_0xf561('0x11')](_0x196a4c[_0xf561('0x27')][_0xf561('0x11')]);_0x59fde7['offset']=qs['offset'](_0x196a4c[_0xf561('0x27')][_0xf561('0xf')]);}return _0x544262[_0xf561('0x77')](_0x59fde7);}})[_0xf561('0x16')](function(_0x3dcd5d){if(_0x3dcd5d){return _0x3dcd5d?{'count':_0x3b90ad,'rows':_0x3dcd5d}:null;}})[_0xf561('0x16')](respondWithResult(_0x2e64a4,null))[_0xf561('0x2a')](handleError(_0x2e64a4,null));}; \ No newline at end of file +var _0x0bc2=['removeTeams','select','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','sequelize','QueryTypes','SELECT','all','compact','value','transaction','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','isArray','emit','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','WhatsappQueue','rawAttributes','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','model','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','keys','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','WhatsappQueueId','map','filter','User','UserId','agent','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','pick','ids','Agents','online','voicePause','interface','flatMap','addTeams','each','findOrCreate','forEach'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0bc2,0x9a));var _0x20bc=function(_0x25731b,_0x473a2f){_0x25731b=_0x25731b-0x0;var _0x4a46cd=_0x0bc2[_0x25731b];return _0x4a46cd;};'use strict';var BPromise=require('bluebird');var util=require(_0x20bc('0x0'));var _=require(_0x20bc('0x1'));var squel=require(_0x20bc('0x2'));var Redis=require(_0x20bc('0x3'));var qs=require(_0x20bc('0x4'));var logger=require(_0x20bc('0x5'))('api');var config=require(_0x20bc('0x6'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x20bc('0x7')](config[_0x20bc('0x8')],{'host':_0x20bc('0x9'),'port':0x18eb});var socket=require(_0x20bc('0xa'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x20bc('0xb')](socket);function respondWithStatusCode(_0x53b353,_0x59ab94){_0x59ab94=_0x59ab94||0xcc;return function(_0x3dfccd){if(_0x3dfccd){return _0x53b353[_0x20bc('0xc')](_0x59ab94);}return _0x53b353[_0x20bc('0xd')](_0x59ab94)[_0x20bc('0xe')]();};}function respondWithResult(_0x486ed8,_0x483750){_0x483750=_0x483750||0xc8;return function(_0x53dc14){if(_0x53dc14){return _0x486ed8[_0x20bc('0xd')](_0x483750)[_0x20bc('0xf')](_0x53dc14);}};}function respondWithFilteredResult(_0x394072,_0xfef678){return function(_0x3f35a2){if(_0x3f35a2){var _0x5a70b3=typeof _0xfef678[_0x20bc('0x10')]==='undefined'&&typeof _0xfef678['limit']===_0x20bc('0x11');var _0x44a62b=_0x3f35a2[_0x20bc('0x12')];var _0x30aa1e=_0x5a70b3?0x0:_0xfef678['offset'];var _0x2b29de=_0x5a70b3?_0x3f35a2[_0x20bc('0x12')]:_0xfef678[_0x20bc('0x10')]+_0xfef678[_0x20bc('0x13')];var _0x2df78e;if(_0x2b29de>=_0x44a62b){_0x2b29de=_0x44a62b;_0x2df78e=0xc8;}else{_0x2df78e=0xce;}_0x394072[_0x20bc('0xd')](_0x2df78e);return _0x394072[_0x20bc('0x14')](_0x20bc('0x15'),_0x30aa1e+'-'+_0x2b29de+'/'+_0x44a62b)[_0x20bc('0xf')](_0x3f35a2);}return null;};}function saveUpdates(_0x5bab72){return function(_0x2ab64a){if(_0x2ab64a){return _0x2ab64a[_0x20bc('0x16')](_0x5bab72)[_0x20bc('0x17')](function(_0x3b573d){return _0x3b573d;});}return null;};}function removeEntity(_0x1622e8){return function(_0x41b6e2){if(_0x41b6e2){return _0x41b6e2['destroy']()[_0x20bc('0x17')](function(){var _0x168c79=_0x41b6e2[_0x20bc('0x18')]({'plain':!![]});var _0x31e1a2=_0x20bc('0x19');return db[_0x20bc('0x1a')]['destroy']({'where':{'type':_0x31e1a2,'resourceId':_0x168c79['id']}})[_0x20bc('0x17')](function(){return _0x41b6e2;});})['then'](function(){_0x1622e8['status'](0xcc)[_0x20bc('0xe')]();});}};}function handleEntityNotFound(_0xe4bdc6){return function(_0x41cb85){if(!_0x41cb85){_0xe4bdc6[_0x20bc('0xc')](0x194);}return _0x41cb85;};}function handleError(_0x179d08,_0x53adb8){_0x53adb8=_0x53adb8||0x1f4;return function(_0x182f82){logger[_0x20bc('0x1b')](_0x182f82[_0x20bc('0x1c')]);if(_0x182f82['name']){delete _0x182f82[_0x20bc('0x1d')];}_0x179d08[_0x20bc('0xd')](_0x53adb8)[_0x20bc('0x1e')](_0x182f82);};}exports[_0x20bc('0x1f')]=function(_0x28f96f,_0x1ff059){var _0x5c579f={};var _0x4b1630={'count':0x0,'rows':[]};var _0x4d1e7a=_['map'](db[_0x20bc('0x20')][_0x20bc('0x21')],function(_0x2f5d7b){return{'name':_0x2f5d7b['fieldName'],'type':_0x2f5d7b[_0x20bc('0x22')][_0x20bc('0x23')]};});_0x5c579f=qs[_0x20bc('0x24')](_0x4d1e7a,_0x28f96f);var _0x2695ea={'where':_0x5c579f[_0x20bc('0x25')]};return db[_0x20bc('0x20')][_0x20bc('0x12')](_0x2695ea)[_0x20bc('0x17')](function(_0x4dbbab){_0x4b1630[_0x20bc('0x12')]=_0x4dbbab;_0x5c579f['include']=qs[_0x20bc('0x26')](_0x28f96f[_0x20bc('0x27')]);return db[_0x20bc('0x20')][_0x20bc('0x28')](_0x5c579f);})['then'](function(_0x27b5b7){_0x4b1630[_0x20bc('0x29')]=_0x27b5b7;return _0x4b1630;})[_0x20bc('0x17')](respondWithFilteredResult(_0x1ff059,_0x5c579f))[_0x20bc('0x2a')](handleError(_0x1ff059,null));};exports[_0x20bc('0x2b')]=function(_0x406a7b,_0x5d35a4){var _0x4d9e77={'raw':!![],'where':{'id':_0x406a7b[_0x20bc('0x2c')]['id']}},_0x525f4f={};_0x525f4f[_0x20bc('0x2d')]=_['keys'](db[_0x20bc('0x20')][_0x20bc('0x21')]);_0x525f4f[_0x20bc('0x27')]=_['keys'](_0x406a7b[_0x20bc('0x27')]);_0x525f4f[_0x20bc('0x2e')]=_[_0x20bc('0x2f')](_0x525f4f[_0x20bc('0x2d')],_0x525f4f[_0x20bc('0x27')]);_0x4d9e77[_0x20bc('0x30')]=_[_0x20bc('0x2f')](_0x525f4f[_0x20bc('0x2d')],qs[_0x20bc('0x31')](_0x406a7b[_0x20bc('0x27')][_0x20bc('0x31')]));_0x4d9e77[_0x20bc('0x30')]=_0x4d9e77['attributes'][_0x20bc('0x32')]?_0x4d9e77[_0x20bc('0x30')]:_0x525f4f['model'];if(_0x406a7b[_0x20bc('0x27')][_0x20bc('0x33')]){_0x4d9e77[_0x20bc('0x26')]=[{'all':!![]}];}_0x4d9e77=_[_0x20bc('0x34')]({},_0x4d9e77,_0x406a7b[_0x20bc('0x35')]);return db['WhatsappQueue'][_0x20bc('0x36')](_0x4d9e77)[_0x20bc('0x17')](handleEntityNotFound(_0x5d35a4,null))[_0x20bc('0x17')](respondWithResult(_0x5d35a4,null))[_0x20bc('0x2a')](handleError(_0x5d35a4,null));};exports[_0x20bc('0x37')]=function(_0x8cde91,_0x4f80c6){return db[_0x20bc('0x20')][_0x20bc('0x37')](_0x8cde91[_0x20bc('0x38')],{})[_0x20bc('0x17')](function(_0x4a16a2){var _0x10e449=_0x8cde91[_0x20bc('0x39')][_0x20bc('0x18')]({'plain':!![]});if(!_0x10e449)throw new Error(_0x20bc('0x3a'));if(_0x10e449['role']==='user'){var _0x2e12d9=_0x4a16a2[_0x20bc('0x18')]({'plain':!![]});var _0x5a6bba='WhatsappQueues';return db[_0x20bc('0x3b')][_0x20bc('0x36')]({'where':{'name':_0x5a6bba,'userProfileId':_0x10e449[_0x20bc('0x3c')]},'raw':!![]})['then'](function(_0x3cd394){if(_0x3cd394&&_0x3cd394[_0x20bc('0x3d')]===0x0){return db[_0x20bc('0x1a')][_0x20bc('0x37')]({'name':_0x2e12d9['name'],'resourceId':_0x2e12d9['id'],'type':_0x3cd394[_0x20bc('0x1d')],'sectionId':_0x3cd394['id']},{})['then'](function(){return _0x4a16a2;});}else{return _0x4a16a2;}})[_0x20bc('0x2a')](function(_0x7a9e85){logger['error'](_0x20bc('0x3e'),_0x7a9e85);throw _0x7a9e85;});}return _0x4a16a2;})[_0x20bc('0x17')](respondWithResult(_0x4f80c6,0xc9))[_0x20bc('0x2a')](handleError(_0x4f80c6,null));};exports[_0x20bc('0x16')]=function(_0xe93a2e,_0x2e9962){if(_0xe93a2e[_0x20bc('0x38')]['id']){delete _0xe93a2e[_0x20bc('0x38')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0xe93a2e[_0x20bc('0x2c')]['id']}})[_0x20bc('0x17')](handleEntityNotFound(_0x2e9962,null))['then'](saveUpdates(_0xe93a2e[_0x20bc('0x38')],null))[_0x20bc('0x17')](respondWithResult(_0x2e9962,null))[_0x20bc('0x2a')](handleError(_0x2e9962,null));};exports[_0x20bc('0x3f')]=function(_0x445608,_0x55fb31){return db['WhatsappQueue']['find']({'where':{'id':_0x445608[_0x20bc('0x2c')]['id']}})[_0x20bc('0x17')](handleEntityNotFound(_0x55fb31,null))[_0x20bc('0x17')](removeEntity(_0x55fb31,null))[_0x20bc('0x2a')](handleError(_0x55fb31,null));};exports[_0x20bc('0x40')]=function(_0x33fa99,_0x38e2dc){return db[_0x20bc('0x20')]['describe']()[_0x20bc('0x17')](respondWithResult(_0x38e2dc,null))['catch'](handleError(_0x38e2dc,null));};exports[_0x20bc('0x41')]=function(_0x2d30e3,_0x52d7f2){var _0xddbf9e={'raw':!![],'where':{}},_0x24282b={},_0x33b417;return db[_0x20bc('0x20')][_0x20bc('0x42')]({'where':{'id':_0x2d30e3[_0x20bc('0x2c')]['id']}})[_0x20bc('0x17')](handleEntityNotFound(_0x52d7f2,null))[_0x20bc('0x17')](function(_0x4a2c1d){if(_0x4a2c1d){_0x33b417=_0x4a2c1d['get']({'plain':!![]});_0x24282b[_0x20bc('0x2d')]=_[_0x20bc('0x43')](db[_0x20bc('0x44')][_0x20bc('0x21')]);_0x24282b[_0x20bc('0x27')]=_[_0x20bc('0x43')](_0x2d30e3[_0x20bc('0x27')]);_0x24282b['filters']=_[_0x20bc('0x2f')](_0x24282b[_0x20bc('0x2d')],_0x24282b[_0x20bc('0x27')]);_0xddbf9e[_0x20bc('0x30')]=_[_0x20bc('0x2f')](_0x24282b[_0x20bc('0x2d')],qs[_0x20bc('0x31')](_0x2d30e3['query'][_0x20bc('0x31')]));_0xddbf9e[_0x20bc('0x30')]=_0xddbf9e[_0x20bc('0x30')][_0x20bc('0x32')]?_0xddbf9e[_0x20bc('0x30')]:_0x24282b[_0x20bc('0x2d')];if(!_0x2d30e3[_0x20bc('0x27')][_0x20bc('0x45')](_0x20bc('0x46'))){_0xddbf9e[_0x20bc('0x13')]=qs[_0x20bc('0x13')](_0x2d30e3['query'][_0x20bc('0x13')]);_0xddbf9e[_0x20bc('0x10')]=qs['offset'](_0x2d30e3[_0x20bc('0x27')][_0x20bc('0x10')]);}_0xddbf9e[_0x20bc('0x47')]=qs[_0x20bc('0x48')](_0x2d30e3['query']['sort']);_0xddbf9e[_0x20bc('0x25')]=qs['filters'](_['pick'](_0x2d30e3[_0x20bc('0x27')],_0x24282b[_0x20bc('0x2e')]));_0xddbf9e[_0x20bc('0x25')][_0x20bc('0x49')]=_0x4a2c1d['id'];if(_0x2d30e3[_0x20bc('0x27')]['filter']){_0xddbf9e[_0x20bc('0x25')]=_[_0x20bc('0x34')](_0xddbf9e['where'],{'$or':_[_0x20bc('0x4a')](_0xddbf9e[_0x20bc('0x30')],function(_0x385d41){var _0x2b6f82={};_0x2b6f82[_0x385d41]={'$like':'%'+_0x2d30e3[_0x20bc('0x27')][_0x20bc('0x4b')]+'%'};return _0x2b6f82;})});}_0xddbf9e=_[_0x20bc('0x34')]({},_0xddbf9e,_0x2d30e3['options']);return db[_0x20bc('0x44')][_0x20bc('0x28')](_0xddbf9e);}})[_0x20bc('0x17')](function(_0x2353fc){if(_0x2353fc){return db[_0x20bc('0x4c')]['findAndCountAll']({'where':{'id':_[_0x20bc('0x4a')](_0x2353fc,_0x20bc('0x4d')),'role':_0x20bc('0x4e')},'attributes':['id',_0x20bc('0x1d'),_0x20bc('0x4f'),'updatedAt',_0x20bc('0x50')]});}})[_0x20bc('0x17')](function(_0x25230f){if(_0x25230f){return{'count':_0x25230f[_0x20bc('0x12')],'rows':_[_0x20bc('0x4a')](_0x25230f[_0x20bc('0x29')],function(_0x2e8482){return{'membername':_0x2e8482[_0x20bc('0x1d')],'UserId':_0x2e8482['id'],'queue_name':_0x33b417[_0x20bc('0x1d')],'WhatsappQueueId':_0x33b417['id'],'interface':util[_0x20bc('0x51')](_0x20bc('0x52'),_0x20bc('0x53'),_0x2e8482[_0x20bc('0x1d')]),'penalty':0x0,'paused':_0x2e8482[_0x20bc('0x4f')],'createdAt':_0x2e8482[_0x20bc('0x50')],'updatedAt':_0x2e8482[_0x20bc('0x54')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x20bc('0x17')](respondWithFilteredResult(_0x52d7f2,_0xddbf9e))[_0x20bc('0x2a')](handleError(_0x52d7f2,null));};exports[_0x20bc('0x55')]=function(_0x402070,_0x3c4e52){var _0x444416={};var _0x4a6170={};var _0x5a2322;var _0x44495f;return db['WhatsappQueue'][_0x20bc('0x42')]({'where':{'id':_0x402070[_0x20bc('0x2c')]['id']}})[_0x20bc('0x17')](handleEntityNotFound(_0x3c4e52,null))[_0x20bc('0x17')](function(_0x402508){if(_0x402508){_0x5a2322=_0x402508;_0x4a6170[_0x20bc('0x2d')]=_[_0x20bc('0x43')](db[_0x20bc('0x56')][_0x20bc('0x21')]);_0x4a6170[_0x20bc('0x27')]=_[_0x20bc('0x43')](_0x402070[_0x20bc('0x27')]);_0x4a6170['filters']=_[_0x20bc('0x2f')](_0x4a6170['model'],_0x4a6170[_0x20bc('0x27')]);_0x444416[_0x20bc('0x30')]=_['intersection'](_0x4a6170[_0x20bc('0x2d')],qs['fields'](_0x402070[_0x20bc('0x27')]['fields']));_0x444416[_0x20bc('0x30')]=_0x444416['attributes'][_0x20bc('0x32')]?_0x444416[_0x20bc('0x30')]:_0x4a6170['model'];_0x444416['order']=qs[_0x20bc('0x48')](_0x402070[_0x20bc('0x27')]['sort']);_0x444416['where']=qs[_0x20bc('0x2e')](_[_0x20bc('0x57')](_0x402070[_0x20bc('0x27')],_0x4a6170[_0x20bc('0x2e')]));if(_0x402070[_0x20bc('0x27')][_0x20bc('0x4b')]){_0x444416[_0x20bc('0x25')]=_[_0x20bc('0x34')](_0x444416[_0x20bc('0x25')],{'$or':_[_0x20bc('0x4a')](_0x444416[_0x20bc('0x30')],function(_0x28d93f){var _0xb28346={};_0xb28346[_0x28d93f]={'$like':'%'+_0x402070[_0x20bc('0x27')][_0x20bc('0x4b')]+'%'};return _0xb28346;})});}_0x444416=_[_0x20bc('0x34')]({},_0x444416,_0x402070[_0x20bc('0x35')]);return _0x5a2322[_0x20bc('0x55')](_0x444416);}})['then'](function(_0x29a73c){if(_0x29a73c){_0x44495f=_0x29a73c['length'];if(!_0x402070[_0x20bc('0x27')][_0x20bc('0x45')](_0x20bc('0x46'))){_0x444416[_0x20bc('0x13')]=qs[_0x20bc('0x13')](_0x402070[_0x20bc('0x27')][_0x20bc('0x13')]);_0x444416[_0x20bc('0x10')]=qs[_0x20bc('0x10')](_0x402070['query']['offset']);}return _0x5a2322[_0x20bc('0x55')](_0x444416);}})[_0x20bc('0x17')](function(_0x5c8db7){if(_0x5c8db7){return _0x5c8db7?{'count':_0x44495f,'rows':_0x5c8db7}:null;}})[_0x20bc('0x17')](respondWithResult(_0x3c4e52,null))['catch'](handleError(_0x3c4e52,null));};exports['addTeams']=function(_0x162261,_0x13d417){var _0x22e400=_0x162261[_0x20bc('0x38')][_0x20bc('0x58')];return db[_0x20bc('0x56')][_0x20bc('0x28')]({'where':{'id':_0x22e400},'attributes':['id'],'include':[{'model':db['User'],'as':_0x20bc('0x59'),'attributes':['id',_0x20bc('0x1d'),_0x20bc('0x5a'),_0x20bc('0x5b'),_0x20bc('0x5c')],'raw':!![]}]})['then'](function(_0x35a4a7){if(_0x35a4a7){var _0x2ef624=_[_0x20bc('0x5d')](_0x35a4a7,function(_0x442e68){var _0x24df67=_0x442e68[_0x20bc('0x18')]({'plain':!![]});return _0x24df67[_0x20bc('0x59')];});return db['WhatsappQueue'][_0x20bc('0x36')]({'where':{'id':_0x162261['params']['id']}})['then'](function(_0xd17165){return db['sequelize']['transaction'](function(_0xa0f608){return _0xd17165[_0x20bc('0x5e')](_0x22e400,{'transaction':_0xa0f608})[_0x20bc('0x17')](function(){return BPromise[_0x20bc('0x5f')](_0x2ef624,function(_0x15c080){return db['UserWhatsappQueue'][_0x20bc('0x60')]({'where':{'UserId':_0x15c080['id'],'WhatsappQueueId':_0x162261[_0x20bc('0x2c')]['id']},'transaction':_0xa0f608});});})[_0x20bc('0x17')](function(){_0x2ef624[_0x20bc('0x61')](function(_0x1a519e){socket['emit']('userWhatsappQueue:save',{'UserId':_0x1a519e['id'],'WhatsappQueueId':_0xd17165['id']});});});});});}})[_0x20bc('0x17')](respondWithStatusCode(_0x13d417,null))[_0x20bc('0x2a')](handleError(_0x13d417,null));};exports[_0x20bc('0x62')]=function(_0x541160,_0x401ffd){return db['Team'][_0x20bc('0x28')]({'where':{'id':_0x541160[_0x20bc('0x27')][_0x20bc('0x58')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x20bc('0x59'),'attributes':['id'],'raw':!![]}]})[_0x20bc('0x17')](handleEntityNotFound(_0x401ffd,null))[_0x20bc('0x17')](function(_0x72c36e){var _0x25bf52=_[_0x20bc('0x4a')](_0x72c36e,'id');var _0x572e07=[];var _0x408ba4=[];var _0x416657=squel[_0x20bc('0x63')]();_0x416657['field'](_0x20bc('0x64'))[_0x20bc('0x65')](_0x20bc('0x66'),'tq')[_0x20bc('0x67')]('user_has_teams','ut',_0x20bc('0x68'))['where'](_0x20bc('0x69'),_0x541160[_0x20bc('0x2c')]['id']);for(var _0x3d0b90=0x0;_0x3d0b90<_0x72c36e[_0x20bc('0x32')];_0x3d0b90+=0x1){let _0x25dae7=_0x72c36e[_0x3d0b90];for(var _0x54a1c4=0x0;_0x54a1c4<_0x25dae7[_0x20bc('0x59')][_0x20bc('0x32')];_0x54a1c4+=0x1){let _0x494dd7=_0x25dae7[_0x20bc('0x59')][_0x54a1c4];var _0x569a13=_0x416657[_0x20bc('0x6a')]();_0x569a13['where'](_0x20bc('0x6b'),_0x494dd7['id']);_0x408ba4['push'](db['sequelize'][_0x20bc('0x27')](_0x569a13[_0x20bc('0x6c')](),{'type':db[_0x20bc('0x6d')][_0x20bc('0x6e')][_0x20bc('0x6f')]})['then'](function(_0x3fd960){if(_0x3fd960[_0x20bc('0x32')]===0x1){return _0x494dd7['id'];}else{var _0xd44c7=_['every'](_[_0x20bc('0x4a')](_0x3fd960,'TeamId'),function(_0x49a79a){return _['includes'](_0x25bf52,_0x49a79a);});if(_0xd44c7){return _0x494dd7['id'];}}}));}}return BPromise[_0x20bc('0x70')](_0x408ba4)[_0x20bc('0x17')](function(_0x51bb3a){_0x572e07=_(_0x572e07)['union'](_0x51bb3a)[_0x20bc('0x71')]()[_0x20bc('0x72')]();return db[_0x20bc('0x20')][_0x20bc('0x36')]({'where':{'id':_0x541160[_0x20bc('0x2c')]['id']}})[_0x20bc('0x17')](function(_0x5edbe4){return db['sequelize'][_0x20bc('0x73')](function(_0xf481c8){return _0x5edbe4['removeTeams'](_0x541160[_0x20bc('0x27')]['ids'],{'transaction':_0xf481c8})[_0x20bc('0x17')](function(){if(!_[_0x20bc('0x74')](_0x572e07)){return _0x5edbe4[_0x20bc('0x75')](_0x572e07,{'transaction':_0xf481c8});}})['then'](function(){_0x572e07[_0x20bc('0x61')](function(_0x101a1d){socket['emit'](_0x20bc('0x76'),{'UserId':_0x101a1d,'WhatsappQueueId':_0x5edbe4['id']});});});});});});})[_0x20bc('0x17')](respondWithStatusCode(_0x401ffd,null))[_0x20bc('0x2a')](handleError(_0x401ffd,null));};exports['addAgents']=function(_0x5700a1,_0x2ee76){return db[_0x20bc('0x20')][_0x20bc('0x36')]({'where':{'id':_0x5700a1['params']['id']}})[_0x20bc('0x17')](handleEntityNotFound(_0x2ee76,null))[_0x20bc('0x17')](function(_0x51ad23){if(_0x51ad23){return _0x51ad23[_0x20bc('0x77')](_0x5700a1['body'][_0x20bc('0x58')],_[_0x20bc('0x78')](_0x5700a1[_0x20bc('0x38')],['ids','id'])||{})[_0x20bc('0x79')](function(_0x39a7c8){for(var _0x3f5f02=0x0;_0x3f5f02<_0x5700a1['body'][_0x20bc('0x58')]['length'];_0x3f5f02+=0x1){socket['emit'](_0x20bc('0x7a'),{'UserId':Number(_0x5700a1[_0x20bc('0x38')]['ids'][_0x3f5f02]),'WhatsappQueueId':Number(_0x5700a1['params']['id'])});}return _0x39a7c8;});}})[_0x20bc('0x17')](respondWithResult(_0x2ee76,null))['catch'](handleError(_0x2ee76,null));};exports[_0x20bc('0x75')]=function(_0x5c379a,_0x22c997){return db['WhatsappQueue'][_0x20bc('0x36')]({'where':{'id':_0x5c379a[_0x20bc('0x2c')]['id']}})[_0x20bc('0x17')](handleEntityNotFound(_0x22c997,null))[_0x20bc('0x17')](function(_0x58f26c){if(_0x58f26c){return _0x58f26c[_0x20bc('0x75')](_0x5c379a[_0x20bc('0x27')][_0x20bc('0x58')])[_0x20bc('0x17')](function(){if(_[_0x20bc('0x7b')](_0x5c379a['query']['ids'])){for(var _0x5b84b3=0x0;_0x5b84b3<_0x5c379a[_0x20bc('0x27')][_0x20bc('0x58')][_0x20bc('0x32')];_0x5b84b3+=0x1){socket['emit'](_0x20bc('0x76'),{'UserId':Number(_0x5c379a[_0x20bc('0x27')][_0x20bc('0x58')][_0x5b84b3]),'WhatsappQueueId':Number(_0x5c379a[_0x20bc('0x2c')]['id'])});}}else{socket[_0x20bc('0x7c')]('userWhatsappQueue:remove',{'UserId':Number(_0x5c379a['query'][_0x20bc('0x58')]),'WhatsappQueueId':Number(_0x5c379a['params']['id'])});}});}})[_0x20bc('0x17')](respondWithStatusCode(_0x22c997,null))[_0x20bc('0x2a')](handleError(_0x22c997,null));};exports[_0x20bc('0x7d')]=function(_0x413611,_0x5be9d8){var _0x3fe9d5={};var _0x24f759={};var _0x4fa78d;var _0x2524d2;return db[_0x20bc('0x20')]['findOne']({'where':{'id':_0x413611['params']['id']}})['then'](handleEntityNotFound(_0x5be9d8,null))[_0x20bc('0x17')](function(_0x470b04){if(_0x470b04){_0x4fa78d=_0x470b04;_0x24f759[_0x20bc('0x2d')]=_[_0x20bc('0x43')](db['User'][_0x20bc('0x21')]);_0x24f759[_0x20bc('0x27')]=_[_0x20bc('0x43')](_0x413611['query']);_0x24f759[_0x20bc('0x2e')]=_['intersection'](_0x24f759[_0x20bc('0x2d')],_0x24f759[_0x20bc('0x27')]);_0x3fe9d5[_0x20bc('0x30')]=_['intersection'](_0x24f759['model'],qs['fields'](_0x413611[_0x20bc('0x27')][_0x20bc('0x31')]));_0x3fe9d5[_0x20bc('0x30')]=_0x3fe9d5[_0x20bc('0x30')]['length']?_0x3fe9d5[_0x20bc('0x30')]:_0x24f759[_0x20bc('0x2d')];_0x3fe9d5[_0x20bc('0x47')]=qs[_0x20bc('0x48')](_0x413611['query'][_0x20bc('0x48')]);_0x3fe9d5['where']=qs['filters'](_[_0x20bc('0x57')](_0x413611['query'],_0x24f759['filters']));if(_0x413611[_0x20bc('0x27')][_0x20bc('0x4b')]){_0x3fe9d5[_0x20bc('0x25')]=_[_0x20bc('0x34')](_0x3fe9d5[_0x20bc('0x25')],{'$or':_[_0x20bc('0x4a')](_0x3fe9d5[_0x20bc('0x30')],function(_0x54eee9){var _0x2edd35={};_0x2edd35[_0x54eee9]={'$like':'%'+_0x413611[_0x20bc('0x27')][_0x20bc('0x4b')]+'%'};return _0x2edd35;})});}_0x3fe9d5=_[_0x20bc('0x34')]({},_0x3fe9d5,_0x413611[_0x20bc('0x35')]);return _0x4fa78d['getAgents'](_0x3fe9d5);}})[_0x20bc('0x17')](function(_0x86dabf){if(_0x86dabf){_0x2524d2=_0x86dabf['length'];if(!_0x413611[_0x20bc('0x27')][_0x20bc('0x45')]('nolimit')){_0x3fe9d5[_0x20bc('0x13')]=qs['limit'](_0x413611[_0x20bc('0x27')]['limit']);_0x3fe9d5[_0x20bc('0x10')]=qs[_0x20bc('0x10')](_0x413611[_0x20bc('0x27')]['offset']);}return _0x4fa78d['getAgents'](_0x3fe9d5);}})[_0x20bc('0x17')](function(_0x28b5be){if(_0x28b5be){return _0x28b5be?{'count':_0x2524d2,'rows':_0x28b5be}:null;}})[_0x20bc('0x17')](respondWithResult(_0x5be9d8,null))[_0x20bc('0x2a')](handleError(_0x5be9d8,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index b81365e..50c458e 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 _0x7c9b=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x28c41d,_0x4f86bf){var _0x407ece=function(_0x81a438){while(--_0x81a438){_0x28c41d['push'](_0x28c41d['shift']());}};_0x407ece(++_0x4f86bf);}(_0x7c9b,0x74));var _0xb7c9=function(_0x4819e9,_0x4bcdd7){_0x4819e9=_0x4819e9-0x0;var _0x2a95be=_0x7c9b[_0x4819e9];return _0x2a95be;};'use strict';var EventEmitter=require(_0xb7c9('0x0'));var WhatsappQueue=require(_0xb7c9('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xb7c9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb7c9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x14966f){return function(_0x3d37d8,_0x556885,_0x483987){WhatsappQueueEvents[_0xb7c9('0x4')](_0x14966f+':'+_0x3d37d8['id'],_0x3d37d8);WhatsappQueueEvents[_0xb7c9('0x4')](_0x14966f,_0x3d37d8);_0x483987(null);};}for(var e in events){if(events[_0xb7c9('0x5')](e)){var event=events[e];WhatsappQueue[_0xb7c9('0x6')](e,emitEvent(event));}}module[_0xb7c9('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xec51=['WhatsappQueue','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xec51,0xa1));var _0x1ec5=function(_0xa34f01,_0x4dfd44){_0xa34f01=_0xa34f01-0x0;var _0x34c117=_0xec51[_0xa34f01];return _0x34c117;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0x1ec5('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1ec5('0x1'),'afterDestroy':_0x1ec5('0x2')};function emitEvent(_0xff72e4){return function(_0x27c46f,_0x426fa9,_0x31e414){WhatsappQueueEvents[_0x1ec5('0x3')](_0xff72e4+':'+_0x27c46f['id'],_0x27c46f);WhatsappQueueEvents['emit'](_0xff72e4,_0x27c46f);_0x31e414(null);};}for(var e in events){if(events[_0x1ec5('0x4')](e)){var event=events[e];WhatsappQueue[_0x1ec5('0x5')](e,emitEvent(event));}}module[_0x1ec5('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 0dd17db..9f13620 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 _0xeb57=['WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./whatsappQueue.attributes'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xeb57,0x11a));var _0x7eb5=function(_0x178e51,_0x5c1941){_0x178e51=_0x178e51-0x0;var _0x5d8bcb=_0xeb57[_0x178e51];return _0x5d8bcb;};'use strict';var _=require(_0x7eb5('0x0'));var util=require('util');var logger=require(_0x7eb5('0x1'))(_0x7eb5('0x2'));var moment=require(_0x7eb5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7eb5('0x4'));var rimraf=require(_0x7eb5('0x5'));var config=require(_0x7eb5('0x6'));var attributes=require(_0x7eb5('0x7'));module['exports']=function(_0x1edd81,_0x55803e){return _0x1edd81['define'](_0x7eb5('0x8'),attributes,{'tableName':_0x7eb5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5b0=['path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x59d7f1,_0x43a185){var _0x5b6e21=function(_0x1388c4){while(--_0x1388c4){_0x59d7f1['push'](_0x59d7f1['shift']());}};_0x5b6e21(++_0x43a185);}(_0xd5b0,0x182));var _0x0d5b=function(_0x11f75e,_0x10a020){_0x11f75e=_0x11f75e-0x0;var _0x11f58a=_0xd5b0[_0x11f75e];return _0x11f58a;};'use strict';var _=require(_0x0d5b('0x0'));var util=require(_0x0d5b('0x1'));var logger=require(_0x0d5b('0x2'))(_0x0d5b('0x3'));var moment=require('moment');var BPromise=require(_0x0d5b('0x4'));var rp=require(_0x0d5b('0x5'));var fs=require('fs');var path=require(_0x0d5b('0x6'));var rimraf=require(_0x0d5b('0x7'));var config=require(_0x0d5b('0x8'));var attributes=require(_0x0d5b('0x9'));module[_0x0d5b('0xa')]=function(_0x3c2339,_0x235da1){return _0x3c2339[_0x0d5b('0xb')](_0x0d5b('0xc'),attributes,{'tableName':_0x0d5b('0xd'),'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 1af3a0a..835092c 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 _0xcee1=['rpc','../../config/environment','http','defaults','localhost','socket.io-emitter','redis','request','then','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','map','info','debug','catch','find','ShowWhatsappQueue','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x189692,_0x5492d7){var _0x3fe337=function(_0x47454d){while(--_0x47454d){_0x189692['push'](_0x189692['shift']());}};_0x3fe337(++_0x5492d7);}(_0xcee1,0x1cd));var _0x1cee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcee1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x1cee('0x0'));var moment=require(_0x1cee('0x1'));var BPromise=require(_0x1cee('0x2'));var rs=require(_0x1cee('0x3'));var fs=require('fs');var Redis=require(_0x1cee('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cee('0x5'));var logger=require(_0x1cee('0x6'))(_0x1cee('0x7'));var config=require(_0x1cee('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1cee('0x9')]({'port':0x232a});config['redis']=_[_0x1cee('0xa')](config['redis'],{'host':_0x1cee('0xb'),'port':0x18eb});var socket=require(_0x1cee('0xc'))(new Redis(config[_0x1cee('0xd')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x3c2034,_0x4218bf,_0x4bac24){return new BPromise(function(_0x195c36,_0x479252){return client[_0x1cee('0xe')](_0x3c2034,_0x4bac24)[_0x1cee('0xf')](function(_0x4eeb08){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x4218bf,_0x1cee('0x10'));logger['debug'](_0x1cee('0x11'),_0x4218bf,'request\x20sent',JSON[_0x1cee('0x12')](_0x4eeb08));if(_0x4eeb08[_0x1cee('0x13')]){if(_0x4eeb08[_0x1cee('0x13')][_0x1cee('0x14')]===0x1f4){logger['error'](_0x1cee('0x15'),_0x4218bf,_0x4eeb08[_0x1cee('0x13')][_0x1cee('0x16')]);return _0x479252(_0x4eeb08[_0x1cee('0x13')]['message']);}logger[_0x1cee('0x13')](_0x1cee('0x15'),_0x4218bf,_0x4eeb08[_0x1cee('0x13')]['message']);return _0x195c36(_0x4eeb08['error'][_0x1cee('0x16')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x4218bf,_0x1cee('0x10'));_0x195c36(_0x4eeb08['result']['message']);}})['catch'](function(_0x25d864){logger[_0x1cee('0x13')](_0x1cee('0x15'),_0x4218bf,_0x25d864);_0x479252(_0x25d864);});});}exports[_0x1cee('0x17')]=function(_0x4ceb33){var _0xeda849=this;return new Promise(function(_0x35c09f,_0x4ac36a){return db[_0x1cee('0x18')][_0x1cee('0x19')]({'raw':_0x4ceb33[_0x1cee('0x1a')]?_0x4ceb33[_0x1cee('0x1a')][_0x1cee('0x1b')]===undefined?!![]:![]:!![],'where':_0x4ceb33['options']?_0x4ceb33[_0x1cee('0x1a')][_0x1cee('0x1c')]||null:null,'attributes':_0x4ceb33[_0x1cee('0x1a')]?_0x4ceb33[_0x1cee('0x1a')][_0x1cee('0x1d')]||null:null,'limit':_0x4ceb33[_0x1cee('0x1a')]?_0x4ceb33['options'][_0x1cee('0x1e')]||null:null,'include':_0x4ceb33[_0x1cee('0x1a')]?_0x4ceb33[_0x1cee('0x1a')][_0x1cee('0x1f')]?_['map'](_0x4ceb33[_0x1cee('0x1a')][_0x1cee('0x1f')],function(_0xad205e){return{'model':db[_0xad205e[_0x1cee('0x20')]],'as':_0xad205e['as'],'attributes':_0xad205e[_0x1cee('0x1d')],'include':_0xad205e[_0x1cee('0x1f')]?_[_0x1cee('0x21')](_0xad205e[_0x1cee('0x1f')],function(_0x1472de){return{'model':db[_0x1472de[_0x1cee('0x20')]],'as':_0x1472de['as'],'attributes':_0x1472de[_0x1cee('0x1d')],'include':_0x1472de[_0x1cee('0x1f')]?_[_0x1cee('0x21')](_0x1472de[_0x1cee('0x1f')],function(_0x568704){return{'model':db[_0x568704[_0x1cee('0x20')]],'as':_0x568704['as'],'attributes':_0x568704[_0x1cee('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1cee('0xf')](function(_0x518fa2){logger[_0x1cee('0x22')](_0x1cee('0x17'),_0x4ceb33);logger[_0x1cee('0x23')](_0x1cee('0x17'),_0x4ceb33,JSON[_0x1cee('0x12')](_0x518fa2));_0x35c09f(_0x518fa2);})[_0x1cee('0x24')](function(_0x2df6c8){logger['error'](_0x1cee('0x17'),_0x2df6c8[_0x1cee('0x16')],_0x4ceb33);_0x4ac36a(_0xeda849['error'](0x1f4,_0x2df6c8[_0x1cee('0x16')]));});});};exports['ShowWhatsappQueue']=function(_0x52d7c2){var _0x15d6ce=this;return new Promise(function(_0x1afe21,_0x27bb85){return db[_0x1cee('0x18')][_0x1cee('0x25')]({'raw':_0x52d7c2[_0x1cee('0x1a')]?_0x52d7c2[_0x1cee('0x1a')][_0x1cee('0x1b')]===undefined?!![]:![]:!![],'where':_0x52d7c2[_0x1cee('0x1a')]?_0x52d7c2[_0x1cee('0x1a')][_0x1cee('0x1c')]||null:null,'attributes':_0x52d7c2['options']?_0x52d7c2[_0x1cee('0x1a')]['attributes']||null:null,'include':_0x52d7c2[_0x1cee('0x1a')]?_0x52d7c2['options'][_0x1cee('0x1f')]?_['map'](_0x52d7c2[_0x1cee('0x1a')][_0x1cee('0x1f')],function(_0x14a74a){return{'model':db[_0x14a74a[_0x1cee('0x20')]],'as':_0x14a74a['as'],'attributes':_0x14a74a['attributes'],'include':_0x14a74a[_0x1cee('0x1f')]?_[_0x1cee('0x21')](_0x14a74a[_0x1cee('0x1f')],function(_0x501cca){return{'model':db[_0x501cca[_0x1cee('0x20')]],'as':_0x501cca['as'],'attributes':_0x501cca[_0x1cee('0x1d')],'include':_0x501cca[_0x1cee('0x1f')]?_[_0x1cee('0x21')](_0x501cca[_0x1cee('0x1f')],function(_0x1fb231){return{'model':db[_0x1fb231['model']],'as':_0x1fb231['as'],'attributes':_0x1fb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x1cee('0xf')](function(_0x2e8e23){logger[_0x1cee('0x22')]('ShowWhatsappQueue',_0x52d7c2);logger[_0x1cee('0x23')](_0x1cee('0x26'),_0x52d7c2,JSON[_0x1cee('0x12')](_0x2e8e23));_0x1afe21(_0x2e8e23);})['catch'](function(_0x574d41){logger[_0x1cee('0x13')](_0x1cee('0x26'),_0x574d41['message'],_0x52d7c2);_0x27bb85(_0x15d6ce[_0x1cee('0x13')](0x1f4,_0x574d41[_0x1cee('0x16')]));});});}; \ No newline at end of file +var _0x3a82=['raw','where','attributes','limit','include','map','model','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x3a82,0xb9));var _0x23a8=function(_0x433993,_0x54adeb){_0x433993=_0x433993-0x0;var _0x1e9ddf=_0x3a82[_0x433993];return _0x1e9ddf;};'use strict';var _=require(_0x23a8('0x0'));var util=require(_0x23a8('0x1'));var moment=require(_0x23a8('0x2'));var BPromise=require(_0x23a8('0x3'));var rs=require(_0x23a8('0x4'));var fs=require('fs');var Redis=require(_0x23a8('0x5'));var db=require(_0x23a8('0x6'))['db'];var utils=require(_0x23a8('0x7'));var logger=require(_0x23a8('0x8'))(_0x23a8('0x9'));var config=require(_0x23a8('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x23a8('0xb')][_0x23a8('0xc')]({'port':0x232a});config[_0x23a8('0xd')]=_[_0x23a8('0xe')](config[_0x23a8('0xd')],{'host':_0x23a8('0xf'),'port':0x18eb});var socket=require(_0x23a8('0x10'))(new Redis(config[_0x23a8('0xd')]));require(_0x23a8('0x11'))[_0x23a8('0x12')](socket);function respondWithRpcPromise(_0x31bc7c,_0x165c77,_0x1f7d72){return new BPromise(function(_0x4554cf,_0x44e0fa){return client[_0x23a8('0x13')](_0x31bc7c,_0x1f7d72)[_0x23a8('0x14')](function(_0x5351d3){logger[_0x23a8('0x15')](_0x23a8('0x16'),_0x165c77,'request\x20sent');logger[_0x23a8('0x17')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x165c77,_0x23a8('0x18'),JSON[_0x23a8('0x19')](_0x5351d3));if(_0x5351d3[_0x23a8('0x1a')]){if(_0x5351d3[_0x23a8('0x1a')][_0x23a8('0x1b')]===0x1f4){logger[_0x23a8('0x1a')]('WhatsappQueue,\x20%s,\x20%s',_0x165c77,_0x5351d3[_0x23a8('0x1a')][_0x23a8('0x1c')]);return _0x44e0fa(_0x5351d3[_0x23a8('0x1a')][_0x23a8('0x1c')]);}logger['error'](_0x23a8('0x16'),_0x165c77,_0x5351d3[_0x23a8('0x1a')][_0x23a8('0x1c')]);return _0x4554cf(_0x5351d3[_0x23a8('0x1a')][_0x23a8('0x1c')]);}else{logger[_0x23a8('0x15')](_0x23a8('0x16'),_0x165c77,'request\x20sent');_0x4554cf(_0x5351d3[_0x23a8('0x1d')]['message']);}})[_0x23a8('0x1e')](function(_0x5c05c3){logger[_0x23a8('0x1a')](_0x23a8('0x16'),_0x165c77,_0x5c05c3);_0x44e0fa(_0x5c05c3);});});}exports[_0x23a8('0x1f')]=function(_0x3048bd){var _0x5ea7e1=this;return new Promise(function(_0x12a583,_0x1a119a){return db[_0x23a8('0x20')][_0x23a8('0x21')]({'raw':_0x3048bd[_0x23a8('0x22')]?_0x3048bd[_0x23a8('0x22')][_0x23a8('0x23')]===undefined?!![]:![]:!![],'where':_0x3048bd[_0x23a8('0x22')]?_0x3048bd[_0x23a8('0x22')][_0x23a8('0x24')]||null:null,'attributes':_0x3048bd[_0x23a8('0x22')]?_0x3048bd[_0x23a8('0x22')][_0x23a8('0x25')]||null:null,'limit':_0x3048bd[_0x23a8('0x22')]?_0x3048bd[_0x23a8('0x22')][_0x23a8('0x26')]||null:null,'include':_0x3048bd[_0x23a8('0x22')]?_0x3048bd['options'][_0x23a8('0x27')]?_[_0x23a8('0x28')](_0x3048bd[_0x23a8('0x22')][_0x23a8('0x27')],function(_0x48fa6d){return{'model':db[_0x48fa6d[_0x23a8('0x29')]],'as':_0x48fa6d['as'],'attributes':_0x48fa6d[_0x23a8('0x25')],'include':_0x48fa6d[_0x23a8('0x27')]?_[_0x23a8('0x28')](_0x48fa6d[_0x23a8('0x27')],function(_0x1a2c92){return{'model':db[_0x1a2c92[_0x23a8('0x29')]],'as':_0x1a2c92['as'],'attributes':_0x1a2c92[_0x23a8('0x25')],'include':_0x1a2c92[_0x23a8('0x27')]?_[_0x23a8('0x28')](_0x1a2c92[_0x23a8('0x27')],function(_0x26b13f){return{'model':db[_0x26b13f[_0x23a8('0x29')]],'as':_0x26b13f['as'],'attributes':_0x26b13f[_0x23a8('0x25')]};}):[]};}):[]};}):[]:[]})[_0x23a8('0x14')](function(_0x2ce4c9){logger['info'](_0x23a8('0x1f'),_0x3048bd);logger['debug'](_0x23a8('0x1f'),_0x3048bd,JSON[_0x23a8('0x19')](_0x2ce4c9));_0x12a583(_0x2ce4c9);})[_0x23a8('0x1e')](function(_0x4e4452){logger[_0x23a8('0x1a')](_0x23a8('0x1f'),_0x4e4452[_0x23a8('0x1c')],_0x3048bd);_0x1a119a(_0x5ea7e1[_0x23a8('0x1a')](0x1f4,_0x4e4452[_0x23a8('0x1c')]));});});};exports[_0x23a8('0x2a')]=function(_0x57d081){var _0x20d77f=this;return new Promise(function(_0x59006d,_0x3f4552){return db[_0x23a8('0x20')][_0x23a8('0x2b')]({'raw':_0x57d081['options']?_0x57d081[_0x23a8('0x22')][_0x23a8('0x23')]===undefined?!![]:![]:!![],'where':_0x57d081[_0x23a8('0x22')]?_0x57d081['options']['where']||null:null,'attributes':_0x57d081['options']?_0x57d081['options']['attributes']||null:null,'include':_0x57d081['options']?_0x57d081[_0x23a8('0x22')]['include']?_['map'](_0x57d081['options'][_0x23a8('0x27')],function(_0x5e8ed7){return{'model':db[_0x5e8ed7['model']],'as':_0x5e8ed7['as'],'attributes':_0x5e8ed7['attributes'],'include':_0x5e8ed7[_0x23a8('0x27')]?_['map'](_0x5e8ed7[_0x23a8('0x27')],function(_0x2d90a4){return{'model':db[_0x2d90a4['model']],'as':_0x2d90a4['as'],'attributes':_0x2d90a4[_0x23a8('0x25')],'include':_0x2d90a4[_0x23a8('0x27')]?_[_0x23a8('0x28')](_0x2d90a4[_0x23a8('0x27')],function(_0xa9030d){return{'model':db[_0xa9030d[_0x23a8('0x29')]],'as':_0xa9030d['as'],'attributes':_0xa9030d[_0x23a8('0x25')]};}):[]};}):[]};}):[]:[]})[_0x23a8('0x14')](function(_0x52572c){logger[_0x23a8('0x15')]('ShowWhatsappQueue',_0x57d081);logger['debug']('ShowWhatsappQueue',_0x57d081,JSON['stringify'](_0x52572c));_0x59006d(_0x52572c);})[_0x23a8('0x1e')](function(_0x288663){logger['error'](_0x23a8('0x2a'),_0x288663[_0x23a8('0x1c')],_0x57d081);_0x3f4552(_0x20d77f[_0x23a8('0x1a')](0x1f4,_0x288663[_0x23a8('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 1ae31a5..690c2e6 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 _0x8fe3=['update','emit','removeListener','length','./whatsappQueue.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8fe3,0x148));var _0x38fe=function(_0x376b78,_0x2cd428){_0x376b78=_0x376b78-0x0;var _0x5f35c=_0x8fe3[_0x376b78];return _0x5f35c;};'use strict';var WhatsappQueueEvents=require(_0x38fe('0x0'));var events=[_0x38fe('0x1'),'remove',_0x38fe('0x2')];function createListener(_0x5423d7,_0x1ad3d9){return function(_0x4fbbb0){_0x1ad3d9[_0x38fe('0x3')](_0x5423d7,_0x4fbbb0);};}function removeListener(_0x22f36d,_0x37d27){return function(){WhatsappQueueEvents[_0x38fe('0x4')](_0x22f36d,_0x37d27);};}exports['register']=function(_0x372807){for(var _0x59630d=0x0,_0x928e60=events[_0x38fe('0x5')];_0x59630d<_0x928e60;_0x59630d++){var _0x5a5a46=events[_0x59630d];var _0x163ae2=createListener('whatsappQueue:'+_0x5a5a46,_0x372807);WhatsappQueueEvents['on'](_0x5a5a46,_0x163ae2);}}; \ No newline at end of file +var _0x41e6=['whatsappQueue:','./whatsappQueue.events','save','emit','removeListener','register','length'];(function(_0x2eb0c2,_0x4d98ab){var _0x1b4616=function(_0xb5f552){while(--_0xb5f552){_0x2eb0c2['push'](_0x2eb0c2['shift']());}};_0x1b4616(++_0x4d98ab);}(_0x41e6,0x1dd));var _0x641e=function(_0x2d321f,_0x196439){_0x2d321f=_0x2d321f-0x0;var _0x16744f=_0x41e6[_0x2d321f];return _0x16744f;};'use strict';var WhatsappQueueEvents=require(_0x641e('0x0'));var events=[_0x641e('0x1'),'remove','update'];function createListener(_0x555893,_0x27a772){return function(_0x413b4b){_0x27a772[_0x641e('0x2')](_0x555893,_0x413b4b);};}function removeListener(_0xb3513c,_0x2428f7){return function(){WhatsappQueueEvents[_0x641e('0x3')](_0xb3513c,_0x2428f7);};}exports[_0x641e('0x4')]=function(_0x416459){for(var _0x5f523e=0x0,_0x1224be=events[_0x641e('0x5')];_0x5f523e<_0x1224be;_0x5f523e++){var _0x153ffa=events[_0x5f523e];var _0x28c4dc=createListener(_0x641e('0x6')+_0x153ffa,_0x416459);WhatsappQueueEvents['on'](_0x153ffa,_0x28c4dc);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index f24f18a..19258ff 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 _0xf4eb=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','delete','multer','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x5d240d,_0x22e0e0){var _0x59701e=function(_0x47df1d){while(--_0x47df1d){_0x5d240d['push'](_0x5d240d['shift']());}};_0x59701e(++_0x22e0e0);}(_0xf4eb,0x1bb));var _0xbf4e=function(_0x310203,_0xd02693){_0x310203=_0x310203-0x0;var _0xa062c0=_0xf4eb[_0x310203];return _0xa062c0;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require(_0xbf4e('0x1'));var timeout=require(_0xbf4e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbf4e('0x3'));var auth=require(_0xbf4e('0x4'));var interaction=require(_0xbf4e('0x5'));var config=require(_0xbf4e('0x6'));var controller=require('./whatsappQueueReport.controller');router[_0xbf4e('0x7')]('/',auth[_0xbf4e('0x8')](),controller['index']);router[_0xbf4e('0x7')](_0xbf4e('0x9'),auth[_0xbf4e('0x8')](),controller[_0xbf4e('0xa')]);router[_0xbf4e('0x7')](_0xbf4e('0xb'),auth[_0xbf4e('0x8')](),controller[_0xbf4e('0xc')]);router['post']('/',auth[_0xbf4e('0x8')](),controller[_0xbf4e('0xd')]);router[_0xbf4e('0xe')](_0xbf4e('0xb'),auth[_0xbf4e('0x8')](),controller['update']);router[_0xbf4e('0xf')]('/:id',auth[_0xbf4e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa5ed=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','update','delete','exports','multer','util','path','Router'];(function(_0x4201a0,_0x1cd7a6){var _0x43e04e=function(_0xfbf783){while(--_0xfbf783){_0x4201a0['push'](_0x4201a0['shift']());}};_0x43e04e(++_0x1cd7a6);}(_0xa5ed,0x150));var _0xda5e=function(_0x5ec60f,_0x32a220){_0x5ec60f=_0x5ec60f-0x0;var _0x618e2b=_0xa5ed[_0x5ec60f];return _0x618e2b;};'use strict';var multer=require(_0xda5e('0x0'));var util=require(_0xda5e('0x1'));var path=require(_0xda5e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xda5e('0x3')]();var fs_extra=require(_0xda5e('0x4'));var auth=require(_0xda5e('0x5'));var interaction=require(_0xda5e('0x6'));var config=require(_0xda5e('0x7'));var controller=require(_0xda5e('0x8'));router[_0xda5e('0x9')]('/',auth[_0xda5e('0xa')](),controller[_0xda5e('0xb')]);router[_0xda5e('0x9')](_0xda5e('0xc'),auth[_0xda5e('0xa')](),controller[_0xda5e('0xd')]);router[_0xda5e('0x9')](_0xda5e('0xe'),auth[_0xda5e('0xa')](),controller['show']);router[_0xda5e('0xf')]('/',auth['isAuthenticated'](),controller[_0xda5e('0x10')]);router['put']('/:id',auth[_0xda5e('0xa')](),controller[_0xda5e('0x11')]);router[_0xda5e('0x12')](_0xda5e('0xe'),auth[_0xda5e('0xa')](),controller['destroy']);module[_0xda5e('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 108f352..c2be102 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x142f4f,_0x5647c6){var _0x472468=function(_0x4e26c5){while(--_0x4e26c5){_0x142f4f['push'](_0x142f4f['shift']());}};_0x472468(++_0x5647c6);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x297f6d,_0x536724){var _0x2d6516=function(_0x46daa4){while(--_0x46daa4){_0x297f6d['push'](_0x297f6d['shift']());}};_0x2d6516(++_0x536724);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 8471463..93e6332 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 _0xc900=['filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','rows','catch','show','includeAll','include','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','keys','query'];(function(_0xa12c33,_0x3677b3){var _0x6d8ba=function(_0x3b712b){while(--_0x3b712b){_0xa12c33['push'](_0xa12c33['shift']());}};_0x6d8ba(++_0x3677b3);}(_0xc900,0xb3));var _0x0c90=function(_0x14dbb5,_0x44bfe8){_0x14dbb5=_0x14dbb5-0x0;var _0x1c1d53=_0xc900[_0x14dbb5];return _0x1c1d53;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0c90('0x0'));var jsonpatch=require(_0x0c90('0x1'));var rp=require(_0x0c90('0x2'));var moment=require('moment');var BPromise=require(_0x0c90('0x3'));var Mustache=require(_0x0c90('0x4'));var util=require('util');var path=require(_0x0c90('0x5'));var sox=require(_0x0c90('0x6'));var csv=require(_0x0c90('0x7'));var ejs=require(_0x0c90('0x8'));var fs=require('fs');var fs_extra=require(_0x0c90('0x9'));var _=require(_0x0c90('0xa'));var squel=require('squel');var crypto=require(_0x0c90('0xb'));var jsforce=require(_0x0c90('0xc'));var deskjs=require(_0x0c90('0xd'));var toCsv=require(_0x0c90('0x7'));var querystring=require(_0x0c90('0xe'));var Papa=require(_0x0c90('0xf'));var Redis=require(_0x0c90('0x10'));var authService=require(_0x0c90('0x11'));var qs=require(_0x0c90('0x12'));var as=require(_0x0c90('0x13'));var hardwareService=require(_0x0c90('0x14'));var logger=require(_0x0c90('0x15'))(_0x0c90('0x16'));var utils=require('../../config/utils');var config=require(_0x0c90('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c90('0x18'))['db'];function respondWithStatusCode(_0x50e7db,_0x459cdb){_0x459cdb=_0x459cdb||0xcc;return function(_0x26fc46){if(_0x26fc46){return _0x50e7db[_0x0c90('0x19')](_0x459cdb);}return _0x50e7db[_0x0c90('0x1a')](_0x459cdb)[_0x0c90('0x1b')]();};}function respondWithResult(_0x59ea8e,_0x467b32){_0x467b32=_0x467b32||0xc8;return function(_0x4451e0){if(_0x4451e0){return _0x59ea8e['status'](_0x467b32)[_0x0c90('0x1c')](_0x4451e0);}};}function respondWithFilteredResult(_0x3a492d,_0x3bd5e8){return function(_0x5bef7d){if(_0x5bef7d){var _0x5daeb7=typeof _0x3bd5e8[_0x0c90('0x1d')]===_0x0c90('0x1e')&&typeof _0x3bd5e8[_0x0c90('0x1f')]===_0x0c90('0x1e');var _0x276b92=_0x5bef7d[_0x0c90('0x20')];var _0x42321a=_0x5daeb7?0x0:_0x3bd5e8['offset'];var _0xc3bb47=_0x5daeb7?_0x5bef7d[_0x0c90('0x20')]:_0x3bd5e8[_0x0c90('0x1d')]+_0x3bd5e8[_0x0c90('0x1f')];var _0x594267;if(_0xc3bb47>=_0x276b92){_0xc3bb47=_0x276b92;_0x594267=0xc8;}else{_0x594267=0xce;}_0x3a492d[_0x0c90('0x1a')](_0x594267);return _0x3a492d[_0x0c90('0x21')](_0x0c90('0x22'),_0x42321a+'-'+_0xc3bb47+'/'+_0x276b92)[_0x0c90('0x1c')](_0x5bef7d);}return null;};}function patchUpdates(_0x315932){return function(_0xc08f54){try{jsonpatch['apply'](_0xc08f54,_0x315932,!![]);}catch(_0x365a42){return BPromise['reject'](_0x365a42);}return _0xc08f54[_0x0c90('0x23')]();};}function saveUpdates(_0x1a021e,_0x47b13c){return function(_0x2a053a){if(_0x2a053a){return _0x2a053a[_0x0c90('0x24')](_0x1a021e)[_0x0c90('0x25')](function(_0x86dee){return _0x86dee;});}return null;};}function removeEntity(_0x212164,_0x3b287c){return function(_0x4dfbc3){if(_0x4dfbc3){return _0x4dfbc3[_0x0c90('0x26')]()[_0x0c90('0x25')](function(){_0x212164['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28d005,_0x3ea861){return function(_0x35c243){if(!_0x35c243){_0x28d005[_0x0c90('0x19')](0x194);}return _0x35c243;};}function handleError(_0x4dde67,_0x2dfa14){_0x2dfa14=_0x2dfa14||0x1f4;return function(_0x438652){logger[_0x0c90('0x27')](_0x438652[_0x0c90('0x28')]);if(_0x438652[_0x0c90('0x29')]){delete _0x438652[_0x0c90('0x29')];}_0x4dde67['status'](_0x2dfa14)[_0x0c90('0x2a')](_0x438652);};}exports[_0x0c90('0x2b')]=function(_0x39f1b2,_0x13b377){var _0x52d28d={},_0x4c8603={},_0x1f27f1={'count':0x0,'rows':[]};var _0x25da6e=_[_0x0c90('0x2c')](db[_0x0c90('0x2d')][_0x0c90('0x2e')],function(_0x562664){return{'name':_0x562664[_0x0c90('0x2f')],'type':_0x562664[_0x0c90('0x30')][_0x0c90('0x31')]};});_0x4c8603['model']=_[_0x0c90('0x2c')](_0x25da6e,'name');_0x4c8603['query']=_[_0x0c90('0x32')](_0x39f1b2[_0x0c90('0x33')]);_0x4c8603[_0x0c90('0x34')]=_[_0x0c90('0x35')](_0x4c8603['model'],_0x4c8603[_0x0c90('0x33')]);_0x52d28d['attributes']=_[_0x0c90('0x35')](_0x4c8603['model'],qs[_0x0c90('0x36')](_0x39f1b2[_0x0c90('0x33')]['fields']));_0x52d28d[_0x0c90('0x37')]=_0x52d28d[_0x0c90('0x37')][_0x0c90('0x38')]?_0x52d28d[_0x0c90('0x37')]:_0x4c8603[_0x0c90('0x39')];if(!_0x39f1b2[_0x0c90('0x33')][_0x0c90('0x3a')](_0x0c90('0x3b'))){_0x52d28d['limit']=qs[_0x0c90('0x1f')](_0x39f1b2[_0x0c90('0x33')][_0x0c90('0x1f')]);_0x52d28d[_0x0c90('0x1d')]=qs['offset'](_0x39f1b2[_0x0c90('0x33')][_0x0c90('0x1d')]);}_0x52d28d[_0x0c90('0x3c')]=qs[_0x0c90('0x3d')](_0x39f1b2[_0x0c90('0x33')][_0x0c90('0x3d')]);_0x52d28d[_0x0c90('0x3e')]=qs[_0x0c90('0x34')](_['pick'](_0x39f1b2[_0x0c90('0x33')],_0x4c8603[_0x0c90('0x34')]),_0x25da6e);if(_0x39f1b2['query'][_0x0c90('0x3f')]){_0x52d28d[_0x0c90('0x3e')]=_[_0x0c90('0x40')](_0x52d28d[_0x0c90('0x3e')],{'$or':_[_0x0c90('0x2c')](_0x25da6e,function(_0x50c126){if(_0x50c126[_0x0c90('0x30')]!==_0x0c90('0x41')){var _0x11530f={};_0x11530f[_0x50c126[_0x0c90('0x29')]]={'$like':'%'+_0x39f1b2[_0x0c90('0x33')][_0x0c90('0x3f')]+'%'};return _0x11530f;}})});}_0x52d28d=_[_0x0c90('0x40')]({},_0x52d28d,_0x39f1b2[_0x0c90('0x42')]);var _0x11a8e3={'where':_0x52d28d['where']};return db[_0x0c90('0x2d')]['count'](_0x11a8e3)[_0x0c90('0x25')](function(_0x593cc0){_0x1f27f1[_0x0c90('0x20')]=_0x593cc0;if(_0x39f1b2[_0x0c90('0x33')]['includeAll']){_0x52d28d['include']=[{'all':!![]}];}return db[_0x0c90('0x2d')]['findAll'](_0x52d28d);})[_0x0c90('0x25')](function(_0x4545bb){_0x1f27f1[_0x0c90('0x43')]=_0x4545bb;return _0x1f27f1;})['then'](respondWithFilteredResult(_0x13b377,_0x52d28d))[_0x0c90('0x44')](handleError(_0x13b377,null));};exports[_0x0c90('0x45')]=function(_0x123b58,_0x3e5137){var _0x2139c3={'raw':!![],'where':{'id':_0x123b58['params']['id']}},_0x1184c4={};_0x1184c4[_0x0c90('0x39')]=_[_0x0c90('0x32')](db[_0x0c90('0x2d')][_0x0c90('0x2e')]);_0x1184c4[_0x0c90('0x33')]=_[_0x0c90('0x32')](_0x123b58[_0x0c90('0x33')]);_0x1184c4['filters']=_[_0x0c90('0x35')](_0x1184c4['model'],_0x1184c4[_0x0c90('0x33')]);_0x2139c3[_0x0c90('0x37')]=_[_0x0c90('0x35')](_0x1184c4[_0x0c90('0x39')],qs[_0x0c90('0x36')](_0x123b58[_0x0c90('0x33')][_0x0c90('0x36')]));_0x2139c3[_0x0c90('0x37')]=_0x2139c3[_0x0c90('0x37')][_0x0c90('0x38')]?_0x2139c3[_0x0c90('0x37')]:_0x1184c4[_0x0c90('0x39')];if(_0x123b58[_0x0c90('0x33')][_0x0c90('0x46')]){_0x2139c3[_0x0c90('0x47')]=[{'all':!![]}];}_0x2139c3=_['merge']({},_0x2139c3,_0x123b58[_0x0c90('0x42')]);return db[_0x0c90('0x2d')][_0x0c90('0x48')](_0x2139c3)[_0x0c90('0x25')](handleEntityNotFound(_0x3e5137,null))[_0x0c90('0x25')](respondWithResult(_0x3e5137,null))[_0x0c90('0x44')](handleError(_0x3e5137,null));};exports[_0x0c90('0x49')]=function(_0x302dc6,_0x3bb138){return db[_0x0c90('0x2d')][_0x0c90('0x49')](_0x302dc6[_0x0c90('0x4a')],{})[_0x0c90('0x25')](respondWithResult(_0x3bb138,0xc9))[_0x0c90('0x44')](handleError(_0x3bb138,null));};exports['update']=function(_0x1b4aac,_0x38f492){if(_0x1b4aac['body']['id']){delete _0x1b4aac['body']['id'];}return db['WhatsappQueueReport'][_0x0c90('0x48')]({'where':{'id':_0x1b4aac[_0x0c90('0x4b')]['id']}})[_0x0c90('0x25')](handleEntityNotFound(_0x38f492,null))[_0x0c90('0x25')](saveUpdates(_0x1b4aac[_0x0c90('0x4a')],null))['then'](respondWithResult(_0x38f492,null))[_0x0c90('0x44')](handleError(_0x38f492,null));};exports[_0x0c90('0x26')]=function(_0x2b756d,_0x549c78){return db[_0x0c90('0x2d')][_0x0c90('0x48')]({'where':{'id':_0x2b756d[_0x0c90('0x4b')]['id']}})[_0x0c90('0x25')](handleEntityNotFound(_0x549c78,null))[_0x0c90('0x25')](removeEntity(_0x549c78,null))[_0x0c90('0x44')](handleError(_0x549c78,null));};exports[_0x0c90('0x4c')]=function(_0x2a339d,_0x1daeed){return db[_0x0c90('0x2d')]['describe']()[_0x0c90('0x25')](respondWithResult(_0x1daeed,null))['catch'](handleError(_0x1daeed,null));}; \ No newline at end of file +var _0xdd4f=['intersection','includeAll','create','body','find','describe','eml-format','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys'];(function(_0x1d7146,_0x217930){var _0x2a215a=function(_0x32f845){while(--_0x32f845){_0x1d7146['push'](_0x1d7146['shift']());}};_0x2a215a(++_0x217930);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x1db8b9,_0x46a5a5){_0x1db8b9=_0x1db8b9-0x0;var _0xabd59f=_0xdd4f[_0x1db8b9];return _0xabd59f;};'use strict';var emlformat=require(_0xfdd4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfdd4('0x1'));var moment=require(_0xfdd4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfdd4('0x3'));var util=require(_0xfdd4('0x4'));var path=require(_0xfdd4('0x5'));var sox=require('sox');var csv=require(_0xfdd4('0x6'));var ejs=require(_0xfdd4('0x7'));var fs=require('fs');var fs_extra=require(_0xfdd4('0x8'));var _=require(_0xfdd4('0x9'));var squel=require(_0xfdd4('0xa'));var crypto=require('crypto');var jsforce=require(_0xfdd4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfdd4('0x6'));var querystring=require(_0xfdd4('0xc'));var Papa=require(_0xfdd4('0xd'));var Redis=require('ioredis');var authService=require(_0xfdd4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfdd4('0xf'));var hardwareService=require(_0xfdd4('0x10'));var logger=require(_0xfdd4('0x11'))(_0xfdd4('0x12'));var utils=require(_0xfdd4('0x13'));var config=require(_0xfdd4('0x14'));var licenseUtil=require(_0xfdd4('0x15'));var db=require(_0xfdd4('0x16'))['db'];function respondWithStatusCode(_0x3f07f1,_0x4565e6){_0x4565e6=_0x4565e6||0xcc;return function(_0x1bf37b){if(_0x1bf37b){return _0x3f07f1['sendStatus'](_0x4565e6);}return _0x3f07f1[_0xfdd4('0x17')](_0x4565e6)[_0xfdd4('0x18')]();};}function respondWithResult(_0x227099,_0x57b21f){_0x57b21f=_0x57b21f||0xc8;return function(_0x1b7da1){if(_0x1b7da1){return _0x227099['status'](_0x57b21f)[_0xfdd4('0x19')](_0x1b7da1);}};}function respondWithFilteredResult(_0x42c3a8,_0x2f34ec){return function(_0x431255){if(_0x431255){var _0x37b05f=typeof _0x2f34ec['offset']==='undefined'&&typeof _0x2f34ec['limit']===_0xfdd4('0x1a');var _0x216c7e=_0x431255[_0xfdd4('0x1b')];var _0x2ccc88=_0x37b05f?0x0:_0x2f34ec[_0xfdd4('0x1c')];var _0x33d752=_0x37b05f?_0x431255[_0xfdd4('0x1b')]:_0x2f34ec[_0xfdd4('0x1c')]+_0x2f34ec[_0xfdd4('0x1d')];var _0x52ce34;if(_0x33d752>=_0x216c7e){_0x33d752=_0x216c7e;_0x52ce34=0xc8;}else{_0x52ce34=0xce;}_0x42c3a8[_0xfdd4('0x17')](_0x52ce34);return _0x42c3a8[_0xfdd4('0x1e')](_0xfdd4('0x1f'),_0x2ccc88+'-'+_0x33d752+'/'+_0x216c7e)[_0xfdd4('0x19')](_0x431255);}return null;};}function patchUpdates(_0x1454f1){return function(_0x29cc8d){try{jsonpatch[_0xfdd4('0x20')](_0x29cc8d,_0x1454f1,!![]);}catch(_0x34dfa8){return BPromise['reject'](_0x34dfa8);}return _0x29cc8d[_0xfdd4('0x21')]();};}function saveUpdates(_0x17302b,_0x2a24e8){return function(_0x16e81b){if(_0x16e81b){return _0x16e81b[_0xfdd4('0x22')](_0x17302b)[_0xfdd4('0x23')](function(_0x451767){return _0x451767;});}return null;};}function removeEntity(_0x277ec1,_0x538b00){return function(_0x1e14da){if(_0x1e14da){return _0x1e14da[_0xfdd4('0x24')]()[_0xfdd4('0x23')](function(){_0x277ec1['status'](0xcc)[_0xfdd4('0x18')]();});}};}function handleEntityNotFound(_0x39b712,_0xf9c346){return function(_0x2f8268){if(!_0x2f8268){_0x39b712[_0xfdd4('0x25')](0x194);}return _0x2f8268;};}function handleError(_0x4a8790,_0x18bafb){_0x18bafb=_0x18bafb||0x1f4;return function(_0x2c88ad){logger[_0xfdd4('0x26')](_0x2c88ad[_0xfdd4('0x27')]);if(_0x2c88ad[_0xfdd4('0x28')]){delete _0x2c88ad[_0xfdd4('0x28')];}_0x4a8790[_0xfdd4('0x17')](_0x18bafb)[_0xfdd4('0x29')](_0x2c88ad);};}exports['index']=function(_0xcbd1fb,_0x39981f){var _0x385a68={},_0xef012e={},_0x2207ae={'count':0x0,'rows':[]};var _0x4a36a2=_[_0xfdd4('0x2a')](db[_0xfdd4('0x2b')][_0xfdd4('0x2c')],function(_0x2bb793){return{'name':_0x2bb793[_0xfdd4('0x2d')],'type':_0x2bb793['type'][_0xfdd4('0x2e')]};});_0xef012e[_0xfdd4('0x2f')]=_[_0xfdd4('0x2a')](_0x4a36a2,'name');_0xef012e[_0xfdd4('0x30')]=_['keys'](_0xcbd1fb[_0xfdd4('0x30')]);_0xef012e[_0xfdd4('0x31')]=_['intersection'](_0xef012e['model'],_0xef012e[_0xfdd4('0x30')]);_0x385a68[_0xfdd4('0x32')]=_['intersection'](_0xef012e['model'],qs[_0xfdd4('0x33')](_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x33')]));_0x385a68[_0xfdd4('0x32')]=_0x385a68[_0xfdd4('0x32')][_0xfdd4('0x34')]?_0x385a68[_0xfdd4('0x32')]:_0xef012e[_0xfdd4('0x2f')];if(!_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x35')](_0xfdd4('0x36'))){_0x385a68[_0xfdd4('0x1d')]=qs[_0xfdd4('0x1d')](_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x1d')]);_0x385a68[_0xfdd4('0x1c')]=qs[_0xfdd4('0x1c')](_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x1c')]);}_0x385a68[_0xfdd4('0x37')]=qs[_0xfdd4('0x38')](_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x38')]);_0x385a68[_0xfdd4('0x39')]=qs[_0xfdd4('0x31')](_[_0xfdd4('0x3a')](_0xcbd1fb['query'],_0xef012e[_0xfdd4('0x31')]),_0x4a36a2);if(_0xcbd1fb[_0xfdd4('0x30')][_0xfdd4('0x3b')]){_0x385a68[_0xfdd4('0x39')]=_[_0xfdd4('0x3c')](_0x385a68[_0xfdd4('0x39')],{'$or':_['map'](_0x4a36a2,function(_0x245ce4){if(_0x245ce4['type']!==_0xfdd4('0x3d')){var _0x2c5199={};_0x2c5199[_0x245ce4[_0xfdd4('0x28')]]={'$like':'%'+_0xcbd1fb[_0xfdd4('0x30')]['filter']+'%'};return _0x2c5199;}})});}_0x385a68=_[_0xfdd4('0x3c')]({},_0x385a68,_0xcbd1fb[_0xfdd4('0x3e')]);var _0x1040e8={'where':_0x385a68[_0xfdd4('0x39')]};return db[_0xfdd4('0x2b')][_0xfdd4('0x1b')](_0x1040e8)[_0xfdd4('0x23')](function(_0x55fcec){_0x2207ae[_0xfdd4('0x1b')]=_0x55fcec;if(_0xcbd1fb[_0xfdd4('0x30')]['includeAll']){_0x385a68[_0xfdd4('0x3f')]=[{'all':!![]}];}return db[_0xfdd4('0x2b')][_0xfdd4('0x40')](_0x385a68);})[_0xfdd4('0x23')](function(_0x5173db){_0x2207ae[_0xfdd4('0x41')]=_0x5173db;return _0x2207ae;})[_0xfdd4('0x23')](respondWithFilteredResult(_0x39981f,_0x385a68))[_0xfdd4('0x42')](handleError(_0x39981f,null));};exports[_0xfdd4('0x43')]=function(_0x362c4f,_0x496747){var _0x1411e0={'raw':!![],'where':{'id':_0x362c4f[_0xfdd4('0x44')]['id']}},_0x23af2a={};_0x23af2a[_0xfdd4('0x2f')]=_[_0xfdd4('0x45')](db[_0xfdd4('0x2b')][_0xfdd4('0x2c')]);_0x23af2a['query']=_[_0xfdd4('0x45')](_0x362c4f['query']);_0x23af2a[_0xfdd4('0x31')]=_[_0xfdd4('0x46')](_0x23af2a[_0xfdd4('0x2f')],_0x23af2a[_0xfdd4('0x30')]);_0x1411e0['attributes']=_[_0xfdd4('0x46')](_0x23af2a[_0xfdd4('0x2f')],qs['fields'](_0x362c4f[_0xfdd4('0x30')][_0xfdd4('0x33')]));_0x1411e0['attributes']=_0x1411e0[_0xfdd4('0x32')]['length']?_0x1411e0['attributes']:_0x23af2a['model'];if(_0x362c4f[_0xfdd4('0x30')][_0xfdd4('0x47')]){_0x1411e0[_0xfdd4('0x3f')]=[{'all':!![]}];}_0x1411e0=_['merge']({},_0x1411e0,_0x362c4f[_0xfdd4('0x3e')]);return db[_0xfdd4('0x2b')]['find'](_0x1411e0)[_0xfdd4('0x23')](handleEntityNotFound(_0x496747,null))[_0xfdd4('0x23')](respondWithResult(_0x496747,null))[_0xfdd4('0x42')](handleError(_0x496747,null));};exports[_0xfdd4('0x48')]=function(_0x746f6a,_0x3817fe){return db[_0xfdd4('0x2b')][_0xfdd4('0x48')](_0x746f6a[_0xfdd4('0x49')],{})[_0xfdd4('0x23')](respondWithResult(_0x3817fe,0xc9))[_0xfdd4('0x42')](handleError(_0x3817fe,null));};exports[_0xfdd4('0x22')]=function(_0x300965,_0x3c0ee1){if(_0x300965['body']['id']){delete _0x300965['body']['id'];}return db[_0xfdd4('0x2b')][_0xfdd4('0x4a')]({'where':{'id':_0x300965[_0xfdd4('0x44')]['id']}})[_0xfdd4('0x23')](handleEntityNotFound(_0x3c0ee1,null))['then'](saveUpdates(_0x300965[_0xfdd4('0x49')],null))[_0xfdd4('0x23')](respondWithResult(_0x3c0ee1,null))['catch'](handleError(_0x3c0ee1,null));};exports['destroy']=function(_0x53c66d,_0x51dd34){return db['WhatsappQueueReport'][_0xfdd4('0x4a')]({'where':{'id':_0x53c66d[_0xfdd4('0x44')]['id']}})[_0xfdd4('0x23')](handleEntityNotFound(_0x51dd34,null))[_0xfdd4('0x23')](removeEntity(_0x51dd34,null))[_0xfdd4('0x42')](handleError(_0x51dd34,null));};exports[_0xfdd4('0x4b')]=function(_0x4d0332,_0x17bbab){return db[_0xfdd4('0x2b')][_0xfdd4('0x4b')]()[_0xfdd4('0x23')](respondWithResult(_0x17bbab,null))['catch'](handleError(_0x17bbab,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index dcbc5cc..464d9a3 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 _0x7cd0=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue'];(function(_0x5b9692,_0x1e4e4c){var _0x4a32f0=function(_0x234655){while(--_0x234655){_0x5b9692['push'](_0x5b9692['shift']());}};_0x4a32f0(++_0x1e4e4c);}(_0x7cd0,0x75));var _0x07cd=function(_0x472072,_0x5add18){_0x472072=_0x472072-0x0;var _0x38ca35=_0x7cd0[_0x472072];return _0x38ca35;};'use strict';var _=require(_0x07cd('0x0'));var util=require(_0x07cd('0x1'));var logger=require(_0x07cd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x07cd('0x3'));var rp=require(_0x07cd('0x4'));var fs=require('fs');var path=require(_0x07cd('0x5'));var rimraf=require(_0x07cd('0x6'));var config=require(_0x07cd('0x7'));var attributes=require(_0x07cd('0x8'));module[_0x07cd('0x9')]=function(_0x16bb1c,_0x55ff6e){return _0x16bb1c[_0x07cd('0xa')](_0x07cd('0xb'),attributes,{'tableName':_0x07cd('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x08b4=['define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x440f7a,_0x4368eb){var _0x5325e1=function(_0x1324a7){while(--_0x1324a7){_0x440f7a['push'](_0x440f7a['shift']());}};_0x5325e1(++_0x4368eb);}(_0x08b4,0x1b3));var _0x408b=function(_0x53b594,_0x559767){_0x53b594=_0x53b594-0x0;var _0x1e616f=_0x08b4[_0x53b594];return _0x1e616f;};'use strict';var _=require(_0x408b('0x0'));var util=require(_0x408b('0x1'));var logger=require(_0x408b('0x2'))('api');var moment=require(_0x408b('0x3'));var BPromise=require(_0x408b('0x4'));var rp=require(_0x408b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x408b('0x6'));var config=require(_0x408b('0x7'));var attributes=require(_0x408b('0x8'));module['exports']=function(_0x2e5806,_0x39562c){return _0x2e5806[_0x408b('0x9')]('WhatsappQueueReport',attributes,{'tableName':_0x408b('0xa'),'paranoid':![],'indexes':[{'name':_0x408b('0xb'),'fields':[_0x408b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 0c84870..40defa6 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 _0xaa00=['WhatsappQueueReport,\x20%s,\x20%s','message','info','result','catch','WhatsappQueueReport','body','options','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xaa00,0x91));var _0x0aa0=function(_0x164eba,_0x2d3485){_0x164eba=_0x164eba-0x0;var _0x470d0e=_0xaa00[_0x164eba];return _0x470d0e;};'use strict';var _=require(_0x0aa0('0x0'));var util=require(_0x0aa0('0x1'));var moment=require(_0x0aa0('0x2'));var BPromise=require(_0x0aa0('0x3'));var rs=require(_0x0aa0('0x4'));var fs=require('fs');var Redis=require(_0x0aa0('0x5'));var db=require(_0x0aa0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0aa0('0x7'))(_0x0aa0('0x8'));var config=require(_0x0aa0('0x9'));var jayson=require(_0x0aa0('0xa'));var client=jayson['client'][_0x0aa0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14d2e8,_0x56e2d5,_0x22c8ba){return new BPromise(function(_0x299808,_0x29ecc9){return client[_0x0aa0('0xc')](_0x14d2e8,_0x22c8ba)[_0x0aa0('0xd')](function(_0x5acefc){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x56e2d5,_0x0aa0('0xe'));logger[_0x0aa0('0xf')](_0x0aa0('0x10'),_0x56e2d5,_0x0aa0('0xe'),JSON[_0x0aa0('0x11')](_0x5acefc));if(_0x5acefc[_0x0aa0('0x12')]){if(_0x5acefc[_0x0aa0('0x12')][_0x0aa0('0x13')]===0x1f4){logger[_0x0aa0('0x12')](_0x0aa0('0x14'),_0x56e2d5,_0x5acefc['error'][_0x0aa0('0x15')]);return _0x29ecc9(_0x5acefc['error'][_0x0aa0('0x15')]);}logger['error'](_0x0aa0('0x14'),_0x56e2d5,_0x5acefc[_0x0aa0('0x12')][_0x0aa0('0x15')]);return _0x299808(_0x5acefc['error'][_0x0aa0('0x15')]);}else{logger[_0x0aa0('0x16')](_0x0aa0('0x14'),_0x56e2d5,'request\x20sent');_0x299808(_0x5acefc[_0x0aa0('0x17')][_0x0aa0('0x15')]);}})[_0x0aa0('0x18')](function(_0x5280d8){logger[_0x0aa0('0x12')](_0x0aa0('0x14'),_0x56e2d5,_0x5280d8);_0x29ecc9(_0x5280d8);});});}exports['CreateWhatsappQueueReport']=function(_0x3d70c0){var _0x394221=this;return new Promise(function(_0x348385,_0x4aeddf){return db[_0x0aa0('0x19')]['create'](_0x3d70c0[_0x0aa0('0x1a')],{'raw':_0x3d70c0[_0x0aa0('0x1b')]?_0x3d70c0['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3ea98f){logger[_0x0aa0('0x16')](_0x0aa0('0x1c'),_0x3d70c0);logger[_0x0aa0('0xf')]('CreateWhatsappQueueReport',_0x3d70c0,JSON[_0x0aa0('0x11')](_0x3ea98f));_0x348385(_0x3ea98f);})[_0x0aa0('0x18')](function(_0x55ea68){logger[_0x0aa0('0x12')](_0x0aa0('0x1c'),_0x55ea68[_0x0aa0('0x15')],_0x3d70c0);_0x4aeddf(_0x394221[_0x0aa0('0x12')](0x1f4,_0x55ea68[_0x0aa0('0x15')]));});});};exports[_0x0aa0('0x1d')]=function(_0x680860){var _0x375bad=this;return new Promise(function(_0x574d98,_0x18fd14){return db[_0x0aa0('0x19')]['update'](_0x680860[_0x0aa0('0x1a')],{'raw':_0x680860[_0x0aa0('0x1b')]?_0x680860[_0x0aa0('0x1b')][_0x0aa0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x680860[_0x0aa0('0x1b')]?_0x680860[_0x0aa0('0x1b')][_0x0aa0('0x1f')]||null:null,'attributes':_0x680860[_0x0aa0('0x1b')]?_0x680860[_0x0aa0('0x1b')][_0x0aa0('0x20')]||null:null,'limit':_0x680860[_0x0aa0('0x1b')]?_0x680860[_0x0aa0('0x1b')]['limit']||null:null})['then'](function(_0x599804){logger[_0x0aa0('0x16')](_0x0aa0('0x1d'),_0x680860);logger[_0x0aa0('0xf')](_0x0aa0('0x1d'),_0x680860,JSON[_0x0aa0('0x11')](_0x599804));_0x574d98(_0x599804);})['catch'](function(_0x268fc7){logger[_0x0aa0('0x12')](_0x0aa0('0x1d'),_0x268fc7[_0x0aa0('0x15')],_0x680860);_0x18fd14(_0x375bad[_0x0aa0('0x12')](0x1f4,_0x268fc7[_0x0aa0('0x15')]));});});}; \ No newline at end of file +var _0xe45f=['WhatsappQueueReport','create','body','options','raw','debug','catch','UpdateWhatsappQueueReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateWhatsappQueueReport'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe45f,0x6d));var _0xfe45=function(_0x43b0c3,_0x25a62a){_0x43b0c3=_0x43b0c3-0x0;var _0xc5107a=_0xe45f[_0x43b0c3];return _0xc5107a;};'use strict';var _=require(_0xfe45('0x0'));var util=require(_0xfe45('0x1'));var moment=require(_0xfe45('0x2'));var BPromise=require(_0xfe45('0x3'));var rs=require(_0xfe45('0x4'));var fs=require('fs');var Redis=require(_0xfe45('0x5'));var db=require(_0xfe45('0x6'))['db'];var utils=require(_0xfe45('0x7'));var logger=require(_0xfe45('0x8'))(_0xfe45('0x9'));var config=require(_0xfe45('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xfe45('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc7f46d,_0x1d722b,_0x5ca5bb){return new BPromise(function(_0x19d372,_0x3511e1){return client[_0xfe45('0xc')](_0xc7f46d,_0x5ca5bb)[_0xfe45('0xd')](function(_0x44243c){logger[_0xfe45('0xe')](_0xfe45('0xf'),_0x1d722b,_0xfe45('0x10'));logger['debug'](_0xfe45('0x11'),_0x1d722b,'request\x20sent',JSON[_0xfe45('0x12')](_0x44243c));if(_0x44243c[_0xfe45('0x13')]){if(_0x44243c[_0xfe45('0x13')]['code']===0x1f4){logger['error'](_0xfe45('0xf'),_0x1d722b,_0x44243c[_0xfe45('0x13')][_0xfe45('0x14')]);return _0x3511e1(_0x44243c[_0xfe45('0x13')][_0xfe45('0x14')]);}logger[_0xfe45('0x13')](_0xfe45('0xf'),_0x1d722b,_0x44243c[_0xfe45('0x13')]['message']);return _0x19d372(_0x44243c[_0xfe45('0x13')][_0xfe45('0x14')]);}else{logger[_0xfe45('0xe')](_0xfe45('0xf'),_0x1d722b,_0xfe45('0x10'));_0x19d372(_0x44243c[_0xfe45('0x15')][_0xfe45('0x14')]);}})['catch'](function(_0x19d086){logger[_0xfe45('0x13')](_0xfe45('0xf'),_0x1d722b,_0x19d086);_0x3511e1(_0x19d086);});});}exports[_0xfe45('0x16')]=function(_0x4b9e29){var _0x36e351=this;return new Promise(function(_0x578429,_0xa8e57d){return db[_0xfe45('0x17')][_0xfe45('0x18')](_0x4b9e29[_0xfe45('0x19')],{'raw':_0x4b9e29['options']?_0x4b9e29[_0xfe45('0x1a')][_0xfe45('0x1b')]===undefined?!![]:![]:!![]})[_0xfe45('0xd')](function(_0x1b5d42){logger[_0xfe45('0xe')](_0xfe45('0x16'),_0x4b9e29);logger[_0xfe45('0x1c')](_0xfe45('0x16'),_0x4b9e29,JSON[_0xfe45('0x12')](_0x1b5d42));_0x578429(_0x1b5d42);})[_0xfe45('0x1d')](function(_0x16f48d){logger[_0xfe45('0x13')](_0xfe45('0x16'),_0x16f48d[_0xfe45('0x14')],_0x4b9e29);_0xa8e57d(_0x36e351[_0xfe45('0x13')](0x1f4,_0x16f48d[_0xfe45('0x14')]));});});};exports[_0xfe45('0x1e')]=function(_0x5e3b59){var _0x4e4b46=this;return new Promise(function(_0x3e1800,_0x4c739b){return db['WhatsappQueueReport'][_0xfe45('0x1f')](_0x5e3b59[_0xfe45('0x19')],{'raw':_0x5e3b59['options']?_0x5e3b59[_0xfe45('0x1a')][_0xfe45('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e3b59[_0xfe45('0x1a')]?_0x5e3b59['options'][_0xfe45('0x20')]||null:null,'attributes':_0x5e3b59[_0xfe45('0x1a')]?_0x5e3b59['options']['attributes']||null:null,'limit':_0x5e3b59[_0xfe45('0x1a')]?_0x5e3b59[_0xfe45('0x1a')]['limit']||null:null})[_0xfe45('0xd')](function(_0x14f3f8){logger['info']('UpdateWhatsappQueueReport',_0x5e3b59);logger[_0xfe45('0x1c')]('UpdateWhatsappQueueReport',_0x5e3b59,JSON[_0xfe45('0x12')](_0x14f3f8));_0x3e1800(_0x14f3f8);})[_0xfe45('0x1d')](function(_0x75fda0){logger[_0xfe45('0x13')](_0xfe45('0x1e'),_0x75fda0[_0xfe45('0x14')],_0x5e3b59);_0x4c739b(_0x4e4b46[_0xfe45('0x13')](0x1f4,_0x75fda0[_0xfe45('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 0bd43e1..e99e1a7 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 _0x8478=['isAuthenticated','show','create','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappTransferReport.controller','get','/describe','describe','/:id'];(function(_0x1dba23,_0x10a95d){var _0x598f91=function(_0xee6d58){while(--_0xee6d58){_0x1dba23['push'](_0x1dba23['shift']());}};_0x598f91(++_0x10a95d);}(_0x8478,0x102));var _0x8847=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8478[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x8847('0x0'));var util=require('util');var path=require(_0x8847('0x1'));var timeout=require(_0x8847('0x2'));var express=require(_0x8847('0x3'));var router=express[_0x8847('0x4')]();var fs_extra=require(_0x8847('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8847('0x6'));var config=require('../../config/environment');var controller=require(_0x8847('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8847('0x8')](_0x8847('0x9'),auth['isAuthenticated'](),controller[_0x8847('0xa')]);router[_0x8847('0x8')](_0x8847('0xb'),auth[_0x8847('0xc')](),controller[_0x8847('0xd')]);router['post']('/',auth[_0x8847('0xc')](),controller[_0x8847('0xe')]);router['put'](_0x8847('0xb'),auth[_0x8847('0xc')](),controller[_0x8847('0xf')]);router['delete'](_0x8847('0xb'),auth[_0x8847('0xc')](),controller[_0x8847('0x10')]);module[_0x8847('0x11')]=router; \ No newline at end of file +var _0x2dae=['describe','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x1e636a,_0x494535){var _0x33cf14=function(_0x363715){while(--_0x363715){_0x1e636a['push'](_0x1e636a['shift']());}};_0x33cf14(++_0x494535);}(_0x2dae,0xec));var _0xe2da=function(_0x354164,_0x4c30de){_0x354164=_0x354164-0x0;var _0x5db9a8=_0x2dae[_0x354164];return _0x5db9a8;};'use strict';var multer=require(_0xe2da('0x0'));var util=require(_0xe2da('0x1'));var path=require(_0xe2da('0x2'));var timeout=require(_0xe2da('0x3'));var express=require(_0xe2da('0x4'));var router=express['Router']();var fs_extra=require(_0xe2da('0x5'));var auth=require(_0xe2da('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe2da('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0xe2da('0x8')]('/',auth[_0xe2da('0x9')](),controller['index']);router[_0xe2da('0x8')](_0xe2da('0xa'),auth['isAuthenticated'](),controller[_0xe2da('0xb')]);router[_0xe2da('0x8')](_0xe2da('0xc'),auth['isAuthenticated'](),controller[_0xe2da('0xd')]);router[_0xe2da('0xe')]('/',auth[_0xe2da('0x9')](),controller[_0xe2da('0xf')]);router['put'](_0xe2da('0xc'),auth[_0xe2da('0x9')](),controller['update']);router[_0xe2da('0x10')]('/:id',auth[_0xe2da('0x9')](),controller[_0xe2da('0x11')]);module[_0xe2da('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 2d4f49c..cb20e2b 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 _0x1c9a=['agent','queue','sequelize','STRING','account'];(function(_0x4ea6af,_0x4aa32e){var _0x4cb1e6=function(_0xc9edd0){while(--_0xc9edd0){_0x4ea6af['push'](_0x4ea6af['shift']());}};_0x4cb1e6(++_0x4aa32e);}(_0x1c9a,0x98));var _0xa1c9=function(_0x501efc,_0x22b6f4){_0x501efc=_0x501efc-0x0;var _0x4f08c2=_0x1c9a[_0x501efc];return _0x4f08c2;};'use strict';var Sequelize=require(_0xa1c9('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa1c9('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa1c9('0x2'),_0xa1c9('0x3'),_0xa1c9('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xd0e4=['exports','STRING','ENUM','queue','DATE','sequelize'];(function(_0x438d6b,_0x105026){var _0x261104=function(_0x56916b){while(--_0x56916b){_0x438d6b['push'](_0x438d6b['shift']());}};_0x261104(++_0x105026);}(_0xd0e4,0x1d3));var _0x4d0e=function(_0x28111f,_0x254934){_0x28111f=_0x28111f-0x0;var _0x5203e6=_0xd0e4[_0x28111f];return _0x5203e6;};'use strict';var Sequelize=require(_0x4d0e('0x0'));module[_0x4d0e('0x1')]={'uniqueid':{'type':Sequelize[_0x4d0e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4d0e('0x3')]('account','agent',_0x4d0e('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x4d0e('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 8a0023f..2e1b5a5 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 _0x4148=['reject','save','update','destroy','then','error','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','name','include','findAll','rows','catch','show','params','length','includeAll','merge','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x1df7b8,_0x2fe5e5){var _0x29d911=function(_0x340121){while(--_0x340121){_0x1df7b8['push'](_0x1df7b8['shift']());}};_0x29d911(++_0x2fe5e5);}(_0x4148,0x75));var _0x8414=function(_0x1bd0c4,_0x2405e0){_0x1bd0c4=_0x1bd0c4-0x0;var _0x13a3af=_0x4148[_0x1bd0c4];return _0x13a3af;};'use strict';var emlformat=require(_0x8414('0x0'));var rimraf=require(_0x8414('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8414('0x2'));var moment=require(_0x8414('0x3'));var BPromise=require(_0x8414('0x4'));var Mustache=require(_0x8414('0x5'));var util=require(_0x8414('0x6'));var path=require('path');var sox=require(_0x8414('0x7'));var csv=require(_0x8414('0x8'));var ejs=require(_0x8414('0x9'));var fs=require('fs');var fs_extra=require(_0x8414('0xa'));var _=require(_0x8414('0xb'));var squel=require(_0x8414('0xc'));var crypto=require('crypto');var jsforce=require(_0x8414('0xd'));var deskjs=require(_0x8414('0xe'));var toCsv=require(_0x8414('0x8'));var querystring=require(_0x8414('0xf'));var Papa=require('papaparse');var Redis=require(_0x8414('0x10'));var authService=require(_0x8414('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8414('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8414('0x13'))(_0x8414('0x14'));var utils=require('../../config/utils');var config=require(_0x8414('0x15'));var licenseUtil=require(_0x8414('0x16'));var db=require(_0x8414('0x17'))['db'];function respondWithStatusCode(_0x17837d,_0x1a203b){_0x1a203b=_0x1a203b||0xcc;return function(_0x1b82bf){if(_0x1b82bf){return _0x17837d[_0x8414('0x18')](_0x1a203b);}return _0x17837d[_0x8414('0x19')](_0x1a203b)[_0x8414('0x1a')]();};}function respondWithResult(_0x52eab9,_0x433bbe){_0x433bbe=_0x433bbe||0xc8;return function(_0x4df682){if(_0x4df682){return _0x52eab9[_0x8414('0x19')](_0x433bbe)[_0x8414('0x1b')](_0x4df682);}};}function respondWithFilteredResult(_0x8b3c0b,_0x5f1f24){return function(_0x209da9){if(_0x209da9){var _0x9aa9bd=typeof _0x5f1f24[_0x8414('0x1c')]===_0x8414('0x1d')&&typeof _0x5f1f24['limit']==='undefined';var _0x348805=_0x209da9[_0x8414('0x1e')];var _0x3d0165=_0x9aa9bd?0x0:_0x5f1f24['offset'];var _0x43051b=_0x9aa9bd?_0x209da9[_0x8414('0x1e')]:_0x5f1f24['offset']+_0x5f1f24[_0x8414('0x1f')];var _0x5c58e3;if(_0x43051b>=_0x348805){_0x43051b=_0x348805;_0x5c58e3=0xc8;}else{_0x5c58e3=0xce;}_0x8b3c0b[_0x8414('0x19')](_0x5c58e3);return _0x8b3c0b[_0x8414('0x20')](_0x8414('0x21'),_0x3d0165+'-'+_0x43051b+'/'+_0x348805)[_0x8414('0x1b')](_0x209da9);}return null;};}function patchUpdates(_0x222f9a){return function(_0x3a1abe){try{jsonpatch[_0x8414('0x22')](_0x3a1abe,_0x222f9a,!![]);}catch(_0x44cbe6){return BPromise[_0x8414('0x23')](_0x44cbe6);}return _0x3a1abe[_0x8414('0x24')]();};}function saveUpdates(_0x269ad2,_0x909862){return function(_0x11eaa8){if(_0x11eaa8){return _0x11eaa8[_0x8414('0x25')](_0x269ad2)['then'](function(_0x1b56e1){return _0x1b56e1;});}return null;};}function removeEntity(_0x57cc40,_0x1d2b61){return function(_0x36df01){if(_0x36df01){return _0x36df01[_0x8414('0x26')]()[_0x8414('0x27')](function(){_0x57cc40['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x503b55,_0x258435){return function(_0x43ffcb){if(!_0x43ffcb){_0x503b55[_0x8414('0x18')](0x194);}return _0x43ffcb;};}function handleError(_0xc93507,_0x160910){_0x160910=_0x160910||0x1f4;return function(_0x12aeb4){logger[_0x8414('0x28')](_0x12aeb4['stack']);if(_0x12aeb4['name']){delete _0x12aeb4['name'];}_0xc93507[_0x8414('0x19')](_0x160910)['send'](_0x12aeb4);};}exports[_0x8414('0x29')]=function(_0x57701d,_0x398295){var _0x23eee1={},_0x1a880c={},_0x36341e={'count':0x0,'rows':[]};var _0xc4b79=_[_0x8414('0x2a')](db[_0x8414('0x2b')][_0x8414('0x2c')],function(_0x5b6105){return{'name':_0x5b6105[_0x8414('0x2d')],'type':_0x5b6105[_0x8414('0x2e')][_0x8414('0x2f')]};});_0x1a880c[_0x8414('0x30')]=_['map'](_0xc4b79,'name');_0x1a880c['query']=_[_0x8414('0x31')](_0x57701d[_0x8414('0x32')]);_0x1a880c[_0x8414('0x33')]=_[_0x8414('0x34')](_0x1a880c['model'],_0x1a880c[_0x8414('0x32')]);_0x23eee1[_0x8414('0x35')]=_[_0x8414('0x34')](_0x1a880c[_0x8414('0x30')],qs[_0x8414('0x36')](_0x57701d['query'][_0x8414('0x36')]));_0x23eee1[_0x8414('0x35')]=_0x23eee1[_0x8414('0x35')]['length']?_0x23eee1[_0x8414('0x35')]:_0x1a880c[_0x8414('0x30')];if(!_0x57701d[_0x8414('0x32')][_0x8414('0x37')](_0x8414('0x38'))){_0x23eee1[_0x8414('0x1f')]=qs['limit'](_0x57701d[_0x8414('0x32')][_0x8414('0x1f')]);_0x23eee1['offset']=qs[_0x8414('0x1c')](_0x57701d['query'][_0x8414('0x1c')]);}_0x23eee1[_0x8414('0x39')]=qs['sort'](_0x57701d[_0x8414('0x32')][_0x8414('0x3a')]);_0x23eee1[_0x8414('0x3b')]=qs['filters'](_[_0x8414('0x3c')](_0x57701d[_0x8414('0x32')],_0x1a880c[_0x8414('0x33')]),_0xc4b79);if(_0x57701d['query'][_0x8414('0x3d')]){_0x23eee1[_0x8414('0x3b')]=_['merge'](_0x23eee1[_0x8414('0x3b')],{'$or':_[_0x8414('0x2a')](_0xc4b79,function(_0x53da07){if(_0x53da07['type']!=='VIRTUAL'){var _0x579ddf={};_0x579ddf[_0x53da07[_0x8414('0x3e')]]={'$like':'%'+_0x57701d[_0x8414('0x32')][_0x8414('0x3d')]+'%'};return _0x579ddf;}})});}_0x23eee1=_['merge']({},_0x23eee1,_0x57701d['options']);var _0x480519={'where':_0x23eee1[_0x8414('0x3b')]};return db[_0x8414('0x2b')][_0x8414('0x1e')](_0x480519)[_0x8414('0x27')](function(_0x30eb53){_0x36341e[_0x8414('0x1e')]=_0x30eb53;if(_0x57701d[_0x8414('0x32')]['includeAll']){_0x23eee1[_0x8414('0x3f')]=[{'all':!![]}];}return db[_0x8414('0x2b')][_0x8414('0x40')](_0x23eee1);})[_0x8414('0x27')](function(_0x5a153e){_0x36341e[_0x8414('0x41')]=_0x5a153e;return _0x36341e;})['then'](respondWithFilteredResult(_0x398295,_0x23eee1))[_0x8414('0x42')](handleError(_0x398295,null));};exports[_0x8414('0x43')]=function(_0x79a931,_0x478095){var _0x2b8e39={'raw':!![],'where':{'id':_0x79a931[_0x8414('0x44')]['id']}},_0x37d68b={};_0x37d68b[_0x8414('0x30')]=_[_0x8414('0x31')](db[_0x8414('0x2b')][_0x8414('0x2c')]);_0x37d68b['query']=_[_0x8414('0x31')](_0x79a931[_0x8414('0x32')]);_0x37d68b[_0x8414('0x33')]=_[_0x8414('0x34')](_0x37d68b[_0x8414('0x30')],_0x37d68b[_0x8414('0x32')]);_0x2b8e39[_0x8414('0x35')]=_['intersection'](_0x37d68b[_0x8414('0x30')],qs[_0x8414('0x36')](_0x79a931[_0x8414('0x32')][_0x8414('0x36')]));_0x2b8e39['attributes']=_0x2b8e39[_0x8414('0x35')][_0x8414('0x45')]?_0x2b8e39['attributes']:_0x37d68b['model'];if(_0x79a931[_0x8414('0x32')][_0x8414('0x46')]){_0x2b8e39[_0x8414('0x3f')]=[{'all':!![]}];}_0x2b8e39=_[_0x8414('0x47')]({},_0x2b8e39,_0x79a931['options']);return db['WhatsappTransferReport'][_0x8414('0x48')](_0x2b8e39)[_0x8414('0x27')](handleEntityNotFound(_0x478095,null))['then'](respondWithResult(_0x478095,null))[_0x8414('0x42')](handleError(_0x478095,null));};exports['create']=function(_0x32c201,_0x3cf20e){return db[_0x8414('0x2b')][_0x8414('0x49')](_0x32c201[_0x8414('0x4a')],{})['then'](respondWithResult(_0x3cf20e,0xc9))[_0x8414('0x42')](handleError(_0x3cf20e,null));};exports[_0x8414('0x25')]=function(_0x3f0b55,_0x5a0ea7){if(_0x3f0b55[_0x8414('0x4a')]['id']){delete _0x3f0b55[_0x8414('0x4a')]['id'];}return db['WhatsappTransferReport'][_0x8414('0x48')]({'where':{'id':_0x3f0b55[_0x8414('0x44')]['id']}})[_0x8414('0x27')](handleEntityNotFound(_0x5a0ea7,null))[_0x8414('0x27')](saveUpdates(_0x3f0b55[_0x8414('0x4a')],null))[_0x8414('0x27')](respondWithResult(_0x5a0ea7,null))[_0x8414('0x42')](handleError(_0x5a0ea7,null));};exports[_0x8414('0x26')]=function(_0x4f1731,_0x1e3baa){return db[_0x8414('0x2b')][_0x8414('0x48')]({'where':{'id':_0x4f1731['params']['id']}})[_0x8414('0x27')](handleEntityNotFound(_0x1e3baa,null))[_0x8414('0x27')](removeEntity(_0x1e3baa,null))[_0x8414('0x42')](handleError(_0x1e3baa,null));};exports[_0x8414('0x4b')]=function(_0x500a96,_0x1d6e7f){return db[_0x8414('0x2b')]['describe']()['then'](respondWithResult(_0x1d6e7f,null))[_0x8414('0x42')](handleError(_0x1d6e7f,null));}; \ No newline at end of file +var _0xd566=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','save','update','then','end','stack','name','send','index','map','WhatsappTransferReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','findAll','catch','rawAttributes','options','create','body','find','params','destroy','describe'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xd566,0x8e));var _0x6d56=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd566[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x6d56('0x0'));var rimraf=require(_0x6d56('0x1'));var zipdir=require(_0x6d56('0x2'));var jsonpatch=require(_0x6d56('0x3'));var rp=require('request-promise');var moment=require(_0x6d56('0x4'));var BPromise=require(_0x6d56('0x5'));var Mustache=require(_0x6d56('0x6'));var util=require(_0x6d56('0x7'));var path=require(_0x6d56('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6d56('0x9'));var fs=require('fs');var fs_extra=require(_0x6d56('0xa'));var _=require(_0x6d56('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6d56('0xc'));var toCsv=require(_0x6d56('0xd'));var querystring=require(_0x6d56('0xe'));var Papa=require(_0x6d56('0xf'));var Redis=require(_0x6d56('0x10'));var authService=require(_0x6d56('0x11'));var qs=require(_0x6d56('0x12'));var as=require(_0x6d56('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6d56('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6d56('0x15'));var db=require(_0x6d56('0x16'))['db'];function respondWithStatusCode(_0x1a3546,_0x124e53){_0x124e53=_0x124e53||0xcc;return function(_0x1e8863){if(_0x1e8863){return _0x1a3546[_0x6d56('0x17')](_0x124e53);}return _0x1a3546['status'](_0x124e53)['end']();};}function respondWithResult(_0x2be4ec,_0x343884){_0x343884=_0x343884||0xc8;return function(_0x567f59){if(_0x567f59){return _0x2be4ec[_0x6d56('0x18')](_0x343884)[_0x6d56('0x19')](_0x567f59);}};}function respondWithFilteredResult(_0x44b568,_0x33013a){return function(_0x2aa29b){if(_0x2aa29b){var _0x4fcc84=typeof _0x33013a['offset']===_0x6d56('0x1a')&&typeof _0x33013a[_0x6d56('0x1b')]===_0x6d56('0x1a');var _0x334647=_0x2aa29b[_0x6d56('0x1c')];var _0x3a4b37=_0x4fcc84?0x0:_0x33013a[_0x6d56('0x1d')];var _0x365de9=_0x4fcc84?_0x2aa29b[_0x6d56('0x1c')]:_0x33013a['offset']+_0x33013a[_0x6d56('0x1b')];var _0x193a1f;if(_0x365de9>=_0x334647){_0x365de9=_0x334647;_0x193a1f=0xc8;}else{_0x193a1f=0xce;}_0x44b568[_0x6d56('0x18')](_0x193a1f);return _0x44b568['set'](_0x6d56('0x1e'),_0x3a4b37+'-'+_0x365de9+'/'+_0x334647)['json'](_0x2aa29b);}return null;};}function patchUpdates(_0x5dff77){return function(_0xfcf821){try{jsonpatch['apply'](_0xfcf821,_0x5dff77,!![]);}catch(_0x11b417){return BPromise['reject'](_0x11b417);}return _0xfcf821[_0x6d56('0x1f')]();};}function saveUpdates(_0x1b4de3,_0xe4c783){return function(_0x3fac7c){if(_0x3fac7c){return _0x3fac7c[_0x6d56('0x20')](_0x1b4de3)[_0x6d56('0x21')](function(_0x391f7e){return _0x391f7e;});}return null;};}function removeEntity(_0x5b192d,_0x107f70){return function(_0x4d8c75){if(_0x4d8c75){return _0x4d8c75['destroy']()[_0x6d56('0x21')](function(){_0x5b192d['status'](0xcc)[_0x6d56('0x22')]();});}};}function handleEntityNotFound(_0x31a8dd,_0x4a9968){return function(_0x3dc74f){if(!_0x3dc74f){_0x31a8dd[_0x6d56('0x17')](0x194);}return _0x3dc74f;};}function handleError(_0x4123ac,_0xfc8580){_0xfc8580=_0xfc8580||0x1f4;return function(_0x3cc1d9){logger['error'](_0x3cc1d9[_0x6d56('0x23')]);if(_0x3cc1d9[_0x6d56('0x24')]){delete _0x3cc1d9['name'];}_0x4123ac['status'](_0xfc8580)[_0x6d56('0x25')](_0x3cc1d9);};}exports[_0x6d56('0x26')]=function(_0x2f3981,_0xc37546){var _0x52d45b={},_0x4e5e46={},_0xfa466d={'count':0x0,'rows':[]};var _0x40a30b=_[_0x6d56('0x27')](db[_0x6d56('0x28')]['rawAttributes'],function(_0x555f44){return{'name':_0x555f44[_0x6d56('0x29')],'type':_0x555f44[_0x6d56('0x2a')][_0x6d56('0x2b')]};});_0x4e5e46[_0x6d56('0x2c')]=_[_0x6d56('0x27')](_0x40a30b,_0x6d56('0x24'));_0x4e5e46['query']=_[_0x6d56('0x2d')](_0x2f3981[_0x6d56('0x2e')]);_0x4e5e46[_0x6d56('0x2f')]=_[_0x6d56('0x30')](_0x4e5e46[_0x6d56('0x2c')],_0x4e5e46['query']);_0x52d45b[_0x6d56('0x31')]=_[_0x6d56('0x30')](_0x4e5e46[_0x6d56('0x2c')],qs[_0x6d56('0x32')](_0x2f3981[_0x6d56('0x2e')][_0x6d56('0x32')]));_0x52d45b['attributes']=_0x52d45b['attributes'][_0x6d56('0x33')]?_0x52d45b[_0x6d56('0x31')]:_0x4e5e46[_0x6d56('0x2c')];if(!_0x2f3981[_0x6d56('0x2e')][_0x6d56('0x34')](_0x6d56('0x35'))){_0x52d45b[_0x6d56('0x1b')]=qs[_0x6d56('0x1b')](_0x2f3981[_0x6d56('0x2e')][_0x6d56('0x1b')]);_0x52d45b[_0x6d56('0x1d')]=qs['offset'](_0x2f3981[_0x6d56('0x2e')][_0x6d56('0x1d')]);}_0x52d45b[_0x6d56('0x36')]=qs['sort'](_0x2f3981[_0x6d56('0x2e')][_0x6d56('0x37')]);_0x52d45b[_0x6d56('0x38')]=qs['filters'](_['pick'](_0x2f3981[_0x6d56('0x2e')],_0x4e5e46[_0x6d56('0x2f')]),_0x40a30b);if(_0x2f3981['query'][_0x6d56('0x39')]){_0x52d45b['where']=_[_0x6d56('0x3a')](_0x52d45b[_0x6d56('0x38')],{'$or':_['map'](_0x40a30b,function(_0x41b9b7){if(_0x41b9b7[_0x6d56('0x2a')]!==_0x6d56('0x3b')){var _0x4ca866={};_0x4ca866[_0x41b9b7[_0x6d56('0x24')]]={'$like':'%'+_0x2f3981['query'][_0x6d56('0x39')]+'%'};return _0x4ca866;}})});}_0x52d45b=_[_0x6d56('0x3a')]({},_0x52d45b,_0x2f3981['options']);var _0x47e1a8={'where':_0x52d45b['where']};return db[_0x6d56('0x28')]['count'](_0x47e1a8)[_0x6d56('0x21')](function(_0x537d41){_0xfa466d[_0x6d56('0x1c')]=_0x537d41;if(_0x2f3981[_0x6d56('0x2e')]['includeAll']){_0x52d45b[_0x6d56('0x3c')]=[{'all':!![]}];}return db[_0x6d56('0x28')][_0x6d56('0x3d')](_0x52d45b);})[_0x6d56('0x21')](function(_0x382b4f){_0xfa466d['rows']=_0x382b4f;return _0xfa466d;})[_0x6d56('0x21')](respondWithFilteredResult(_0xc37546,_0x52d45b))[_0x6d56('0x3e')](handleError(_0xc37546,null));};exports['show']=function(_0x1ee39e,_0x335d9e){var _0x4e83d7={'raw':!![],'where':{'id':_0x1ee39e['params']['id']}},_0x3df4c4={};_0x3df4c4[_0x6d56('0x2c')]=_[_0x6d56('0x2d')](db[_0x6d56('0x28')][_0x6d56('0x3f')]);_0x3df4c4['query']=_[_0x6d56('0x2d')](_0x1ee39e[_0x6d56('0x2e')]);_0x3df4c4[_0x6d56('0x2f')]=_[_0x6d56('0x30')](_0x3df4c4['model'],_0x3df4c4[_0x6d56('0x2e')]);_0x4e83d7[_0x6d56('0x31')]=_[_0x6d56('0x30')](_0x3df4c4[_0x6d56('0x2c')],qs['fields'](_0x1ee39e[_0x6d56('0x2e')]['fields']));_0x4e83d7[_0x6d56('0x31')]=_0x4e83d7[_0x6d56('0x31')]['length']?_0x4e83d7[_0x6d56('0x31')]:_0x3df4c4[_0x6d56('0x2c')];if(_0x1ee39e[_0x6d56('0x2e')]['includeAll']){_0x4e83d7[_0x6d56('0x3c')]=[{'all':!![]}];}_0x4e83d7=_[_0x6d56('0x3a')]({},_0x4e83d7,_0x1ee39e[_0x6d56('0x40')]);return db[_0x6d56('0x28')]['find'](_0x4e83d7)[_0x6d56('0x21')](handleEntityNotFound(_0x335d9e,null))[_0x6d56('0x21')](respondWithResult(_0x335d9e,null))['catch'](handleError(_0x335d9e,null));};exports[_0x6d56('0x41')]=function(_0x43c2f0,_0x4689a0){return db[_0x6d56('0x28')]['create'](_0x43c2f0[_0x6d56('0x42')],{})[_0x6d56('0x21')](respondWithResult(_0x4689a0,0xc9))[_0x6d56('0x3e')](handleError(_0x4689a0,null));};exports[_0x6d56('0x20')]=function(_0xd6ab0a,_0x4bec42){if(_0xd6ab0a['body']['id']){delete _0xd6ab0a[_0x6d56('0x42')]['id'];}return db[_0x6d56('0x28')][_0x6d56('0x43')]({'where':{'id':_0xd6ab0a[_0x6d56('0x44')]['id']}})['then'](handleEntityNotFound(_0x4bec42,null))[_0x6d56('0x21')](saveUpdates(_0xd6ab0a[_0x6d56('0x42')],null))[_0x6d56('0x21')](respondWithResult(_0x4bec42,null))[_0x6d56('0x3e')](handleError(_0x4bec42,null));};exports[_0x6d56('0x45')]=function(_0x1f4b3,_0x40e593){return db['WhatsappTransferReport']['find']({'where':{'id':_0x1f4b3[_0x6d56('0x44')]['id']}})[_0x6d56('0x21')](handleEntityNotFound(_0x40e593,null))['then'](removeEntity(_0x40e593,null))['catch'](handleError(_0x40e593,null));};exports[_0x6d56('0x46')]=function(_0x4e69b5,_0x331968){return db[_0x6d56('0x28')][_0x6d56('0x46')]()[_0x6d56('0x21')](respondWithResult(_0x331968,null))[_0x6d56('0x3e')](handleError(_0x331968,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 4d12b8a..e1a4f52 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 _0xdc9c=['uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdc9c,0x15f));var _0xcdc9=function(_0x18b177,_0x3c60df){_0x18b177=_0x18b177-0x0;var _0x5617ec=_0xdc9c[_0x18b177];return _0x5617ec;};'use strict';var _=require(_0xcdc9('0x0'));var util=require(_0xcdc9('0x1'));var logger=require('../../config/logger')(_0xcdc9('0x2'));var moment=require(_0xcdc9('0x3'));var BPromise=require(_0xcdc9('0x4'));var rp=require(_0xcdc9('0x5'));var fs=require('fs');var path=require(_0xcdc9('0x6'));var rimraf=require(_0xcdc9('0x7'));var config=require(_0xcdc9('0x8'));var attributes=require(_0xcdc9('0x9'));module[_0xcdc9('0xa')]=function(_0x248f79,_0x46f366){return _0x248f79[_0xcdc9('0xb')]('WhatsappTransferReport',attributes,{'tableName':_0xcdc9('0xc'),'paranoid':![],'indexes':[{'name':_0xcdc9('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x56a1=['request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x4cd1ae,_0x48ff9d){var _0x23e09f=function(_0x1f5745){while(--_0x1f5745){_0x4cd1ae['push'](_0x4cd1ae['shift']());}};_0x23e09f(++_0x48ff9d);}(_0x56a1,0xdc));var _0x156a=function(_0x3c8618,_0x54ada2){_0x3c8618=_0x3c8618-0x0;var _0x2deb98=_0x56a1[_0x3c8618];return _0x2deb98;};'use strict';var _=require(_0x156a('0x0'));var util=require(_0x156a('0x1'));var logger=require(_0x156a('0x2'))(_0x156a('0x3'));var moment=require(_0x156a('0x4'));var BPromise=require('bluebird');var rp=require(_0x156a('0x5'));var fs=require('fs');var path=require(_0x156a('0x6'));var rimraf=require(_0x156a('0x7'));var config=require(_0x156a('0x8'));var attributes=require(_0x156a('0x9'));module[_0x156a('0xa')]=function(_0x243f43,_0x1bb2ce){return _0x243f43[_0x156a('0xb')](_0x156a('0xc'),attributes,{'tableName':_0x156a('0xd'),'paranoid':![],'indexes':[{'name':_0x156a('0xe'),'fields':[_0x156a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 05b844b..61f85fa 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 _0x5e7e=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x33c9f8,_0x5aedbb){var _0x2d7004=function(_0x4f4f43){while(--_0x4f4f43){_0x33c9f8['push'](_0x33c9f8['shift']());}};_0x2d7004(++_0x5aedbb);}(_0x5e7e,0x177));var _0xe5e7=function(_0x389f51,_0x9804e2){_0x389f51=_0x389f51-0x0;var _0x49aafa=_0x5e7e[_0x389f51];return _0x49aafa;};'use strict';var _=require(_0xe5e7('0x0'));var util=require(_0xe5e7('0x1'));var moment=require(_0xe5e7('0x2'));var BPromise=require(_0xe5e7('0x3'));var rs=require(_0xe5e7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe5e7('0x5'))(_0xe5e7('0x6'));var config=require(_0xe5e7('0x7'));var jayson=require(_0xe5e7('0x8'));var client=jayson[_0xe5e7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19fce0,_0x57acfe,_0x5380b0){return new BPromise(function(_0x2fbcca,_0x9b6ec6){return client['request'](_0x19fce0,_0x5380b0)[_0xe5e7('0xa')](function(_0x3adc03){logger[_0xe5e7('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x57acfe,'request\x20sent');logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x57acfe,_0xe5e7('0xc'),JSON[_0xe5e7('0xd')](_0x3adc03));if(_0x3adc03[_0xe5e7('0xe')]){if(_0x3adc03[_0xe5e7('0xe')][_0xe5e7('0xf')]===0x1f4){logger[_0xe5e7('0xe')](_0xe5e7('0x10'),_0x57acfe,_0x3adc03[_0xe5e7('0xe')][_0xe5e7('0x11')]);return _0x9b6ec6(_0x3adc03[_0xe5e7('0xe')][_0xe5e7('0x11')]);}logger[_0xe5e7('0xe')](_0xe5e7('0x10'),_0x57acfe,_0x3adc03[_0xe5e7('0xe')][_0xe5e7('0x11')]);return _0x2fbcca(_0x3adc03[_0xe5e7('0xe')]['message']);}else{logger[_0xe5e7('0xb')](_0xe5e7('0x10'),_0x57acfe,_0xe5e7('0xc'));_0x2fbcca(_0x3adc03[_0xe5e7('0x12')][_0xe5e7('0x11')]);}})['catch'](function(_0x3c96e8){logger[_0xe5e7('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x57acfe,_0x3c96e8);_0x9b6ec6(_0x3c96e8);});});} \ No newline at end of file +var _0x6a6b=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x6a6b,0xd0));var _0xb6a6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6a6b[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xb6a6('0x0'));var util=require(_0xb6a6('0x1'));var moment=require(_0xb6a6('0x2'));var BPromise=require(_0xb6a6('0x3'));var rs=require(_0xb6a6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb6a6('0x5'))['db'];var utils=require(_0xb6a6('0x6'));var logger=require(_0xb6a6('0x7'))(_0xb6a6('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb6a6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ca54f,_0x157b82,_0x3a84a1){return new BPromise(function(_0xd71fbf,_0x5aca5d){return client[_0xb6a6('0xa')](_0x5ca54f,_0x3a84a1)[_0xb6a6('0xb')](function(_0x294fdc){logger[_0xb6a6('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x157b82,_0xb6a6('0xd'));logger['debug'](_0xb6a6('0xe'),_0x157b82,_0xb6a6('0xd'),JSON[_0xb6a6('0xf')](_0x294fdc));if(_0x294fdc[_0xb6a6('0x10')]){if(_0x294fdc[_0xb6a6('0x10')][_0xb6a6('0x11')]===0x1f4){logger[_0xb6a6('0x10')](_0xb6a6('0x12'),_0x157b82,_0x294fdc[_0xb6a6('0x10')][_0xb6a6('0x13')]);return _0x5aca5d(_0x294fdc[_0xb6a6('0x10')][_0xb6a6('0x13')]);}logger[_0xb6a6('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x157b82,_0x294fdc['error'][_0xb6a6('0x13')]);return _0xd71fbf(_0x294fdc['error'][_0xb6a6('0x13')]);}else{logger[_0xb6a6('0xc')](_0xb6a6('0x12'),_0x157b82,_0xb6a6('0xd'));_0xd71fbf(_0x294fdc['result'][_0xb6a6('0x13')]);}})[_0xb6a6('0x14')](function(_0x10f421){logger[_0xb6a6('0x10')](_0xb6a6('0x12'),_0x157b82,_0x10f421);_0x5aca5d(_0x10f421);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 4d43d87..b0a0de4 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1134=['./config/schedule/transcribe','sequelize','sync','then','seedDB','default','info','start','filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','online','join','Offline\x20apps:','status','None','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/license','./rpc','./config/logger','app','./config/pm2/config','./config/schedule/chat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1134,0x19c));var _0x4113=function(_0x4cbfee,_0x3004c2){_0x4cbfee=_0x4cbfee-0x0;var _0x1041dd=_0x1134[_0x4cbfee];return _0x1041dd;};'use strict';var _=require(_0x4113('0x0'));var db=require(_0x4113('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x4113('0x2'));var rpc=require(_0x4113('0x3'));var config=require('./config/environment');var logger=require(_0x4113('0x4'))(_0x4113('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0x4113('0x6'));var schedule=require('./config/schedule');var chat=require(_0x4113('0x7'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x4113('0x8'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x4113('0x9')][_0x4113('0xa')]()[_0x4113('0xb')](function(){if(config[_0x4113('0xc')]){return seedDb[_0x4113('0xd')]();}})[_0x4113('0xb')](function(){return checkLicense[_0x4113('0xd')]();})[_0x4113('0xb')](function(){return rpc['listen']();})[_0x4113('0xb')](function(_0x207442){logger[_0x4113('0xe')](_0x207442);return chat[_0x4113('0xf')]();})[_0x4113('0xb')](function(){return whatsapp[_0x4113('0xf')]();})[_0x4113('0xb')](function(){return schedule[_0x4113('0xf')]();})[_0x4113('0xb')](function(){return transcribe[_0x4113('0xf')]();})['then'](function(){return provider['start']();})['then'](function(_0x203503){logger[_0x4113('0xe')](_0x203503);return pm2['start'](pm2Config);})['then'](function(_0x40f01e){var _0x5d9801=_0x40f01e[_0x4113('0x10')](function(_0x5ab2a7){return typeof _0x5ab2a7['exitCode']===_0x4113('0x11')&&_0x5ab2a7[_0x4113('0x12')]>=0x0;});if(_0x5d9801[_0x4113('0x13')]>0x0){throw new Error(_0x5d9801[_0x4113('0x13')]+_0x4113('0x14')+_[_0x4113('0x15')](_0x5d9801,function(_0x405849){return'\x22'+_0x405849[_0x4113('0x16')][_0x4113('0x17')]+'\x22';}));}logger[_0x4113('0xe')]('Online\x20apps:',_[_0x4113('0x15')](_[_0x4113('0x10')](_0x40f01e,{'status':_0x4113('0x18')}),_0x4113('0x17'))[_0x4113('0x19')]());logger[_0x4113('0xe')](_0x4113('0x1a'),_[_0x4113('0x15')](_[_0x4113('0x10')](_0x40f01e,function(_0x57540a){return _0x57540a[_0x4113('0x1b')]!==_0x4113('0x18');}),'name')['join']()||_0x4113('0x1c'));console['log'](_0x4113('0x1d'));})[_0x4113('0x1e')](function(_0x2b0de5){console['log'](_0x4113('0x1f'),_0x2b0de5);logger[_0x4113('0x20')](_0x4113('0x21'),_0x2b0de5);process[_0x4113('0x22')](0x1);});}main(); \ No newline at end of file +var _0x43fd=['app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','default','listen','info','start','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','Online\x20apps:','filter','online','name','join','Offline\x20apps:','map','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./rpc','./config/environment'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x43fd,0x1ec));var _0xd43f=function(_0x5d6900,_0x34e763){_0x5d6900=_0x5d6900-0x0;var _0x46adcc=_0x43fd[_0x5d6900];return _0x46adcc;};'use strict';var _=require('lodash');var db=require(_0xd43f('0x0'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require('./config/license');var rpc=require(_0xd43f('0x1'));var config=require(_0xd43f('0x2'));var logger=require('./config/logger')(_0xd43f('0x3'));var pm2=require('./config/pm2');var pm2Config=require(_0xd43f('0x4'));var schedule=require(_0xd43f('0x5'));var chat=require(_0xd43f('0x6'));var whatsapp=require(_0xd43f('0x7'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0xd43f('0x8'));function main(){return db[_0xd43f('0x9')][_0xd43f('0xa')]()[_0xd43f('0xb')](function(){if(config['seedDB']){return seedDb[_0xd43f('0xc')]();}})[_0xd43f('0xb')](function(){return checkLicense['default']();})[_0xd43f('0xb')](function(){return rpc[_0xd43f('0xd')]();})[_0xd43f('0xb')](function(_0x1a91e9){logger[_0xd43f('0xe')](_0x1a91e9);return chat['start']();})[_0xd43f('0xb')](function(){return whatsapp[_0xd43f('0xf')]();})[_0xd43f('0xb')](function(){return schedule[_0xd43f('0xf')]();})[_0xd43f('0xb')](function(){return transcribe[_0xd43f('0xf')]();})[_0xd43f('0xb')](function(){return provider[_0xd43f('0xf')]();})[_0xd43f('0xb')](function(_0x1bed70){logger[_0xd43f('0xe')](_0x1bed70);return pm2['start'](pm2Config);})[_0xd43f('0xb')](function(_0x922f49){var _0x41be43=_0x922f49['filter'](function(_0x4c576e){return typeof _0x4c576e['exitCode']===_0xd43f('0x10')&&_0x4c576e[_0xd43f('0x11')]>=0x0;});if(_0x41be43['length']>0x0){throw new Error(_0x41be43[_0xd43f('0x12')]+_0xd43f('0x13')+_['map'](_0x41be43,function(_0x5ced70){return'\x22'+_0x5ced70['pm2_env']['name']+'\x22';}));}logger[_0xd43f('0xe')](_0xd43f('0x14'),_['map'](_[_0xd43f('0x15')](_0x922f49,{'status':_0xd43f('0x16')}),_0xd43f('0x17'))[_0xd43f('0x18')]());logger['info'](_0xd43f('0x19'),_[_0xd43f('0x1a')](_[_0xd43f('0x15')](_0x922f49,function(_0x564261){return _0x564261['status']!=='online';}),_0xd43f('0x17'))[_0xd43f('0x18')]()||_0xd43f('0x1b'));console[_0xd43f('0x1c')](_0xd43f('0x1d'));})[_0xd43f('0x1e')](function(_0x296a77){console['log'](_0xd43f('0x1f'),_0x296a77);logger['error'](_0xd43f('0x20'),_0x296a77);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index b01478b..fb27ad1 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 _0x794a=['downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','messengerSoundNotification','isChatInteractionAuthorized','use','findOne','params','closed','disposition','then','query','forceDownload','status','json','unmanaged','Unmanaged.','catch','isAuthenticated','headers','authorization','startsWith','User','find','authenticate','Wrong\x20credentials.','user','apikey','getUuid','sub','allowedLoginAttempts','isEqual','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','setTokenCookie','cookie','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','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','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','encryptString','promisify','secret','secrets','session','options','verify','randomBytes','hex','floor','now','toString','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','fullname','internal','email','userpic','permissions','md5secret','voicePause','mailPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','wssPort','downloadVoiceRecordings'];(function(_0x568f96,_0x32d489){var _0x5a053a=function(_0x5570ce){while(--_0x5570ce){_0x568f96['push'](_0x568f96['shift']());}};_0x5a053a(++_0x32d489);}(_0x794a,0x16c));var _0xa794=function(_0x254fc1,_0x44441c){_0x254fc1=_0x254fc1-0x0;var _0x2bda1f=_0x794a[_0x254fc1];return _0x2bda1f;};'use strict';var db=require(_0xa794('0x0'))['db'];var config=require(_0xa794('0x1'));var hardwareConf=require(_0xa794('0x2'));var licenseUtil=require(_0xa794('0x3'));var encryptor=require(_0xa794('0x4'));var _=require(_0xa794('0x5'));var jwt=require(_0xa794('0x6'));var expressJwt=require(_0xa794('0x7'));var compose=require(_0xa794('0x8'));var basicAuth=require(_0xa794('0x9'));var crypto=require(_0xa794('0xa'));var BPromise=require(_0xa794('0xb'));var util=require(_0xa794('0xc'));var moment=require(_0xa794('0xd'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id','role',_0xa794('0xe'),'name',_0xa794('0xf'),_0xa794('0x10'),_0xa794('0x11'),_0xa794('0x12'),_0xa794('0x13'),_0xa794('0x14'),'chatPause',_0xa794('0x15'),_0xa794('0x16'),_0xa794('0x17'),_0xa794('0x18'),_0xa794('0x19'),'showWebBar',_0xa794('0x1a'),_0xa794('0x1b'),'crudPermissions',_0xa794('0x1c'),_0xa794('0x1d'),'alias',_0xa794('0x1e'),_0xa794('0x1f'),_0xa794('0x20'),_0xa794('0x21'),_0xa794('0x22'),_0xa794('0x23'),_0xa794('0x24'),'phoneBarPrefixRequired',_0xa794('0x25'),_0xa794('0x26'),_0xa794('0x27'),_0xa794('0x28'),_0xa794('0x29'),'privacyEnabled','settingsEnabled',_0xa794('0x2a'),_0xa794('0x2b'),_0xa794('0x2c'),_0xa794('0x2d'),_0xa794('0x2e'),'selectRecallMeCampaign',_0xa794('0x2f'),_0xa794('0x30'),_0xa794('0x31'),_0xa794('0x32'),_0xa794('0x33'),_0xa794('0x34'),'openchannelAutoanswer',_0xa794('0x35'),_0xa794('0x36'),_0xa794('0x37'),_0xa794('0x38'),'whatsappAutoanswerDelay',_0xa794('0x39')];exports[_0xa794('0x3a')]=function(){return this['isAuthenticated'](!![])[_0xa794('0x3b')](function(_0x4066fe,_0x318a78,_0x488905){if(_0x4066fe['user']){_0x488905();}else{return db['ChatInteraction'][_0xa794('0x3c')]({'where':{'id':_0x4066fe[_0xa794('0x3d')]['id']},'attributes':['id',_0xa794('0x3e'),_0xa794('0x3f')],'raw':!![]})[_0xa794('0x40')](function(_0x34c39c){if(_0x34c39c&&_0x34c39c['closed']&&!_0x4066fe[_0xa794('0x41')][_0xa794('0x42')]){return _0x318a78[_0xa794('0x43')](_0x34c39c[_0xa794('0x3f')]==='unmanaged'?0x195:0x193)[_0xa794('0x44')]({'message':_0x34c39c[_0xa794('0x3f')]===_0xa794('0x45')?_0xa794('0x46'):'Forbidden.'});}else{_0x488905();}})[_0xa794('0x47')](function(_0x1644b5){_0x488905(_0x1644b5);});}});};exports[_0xa794('0x48')]=function isAuthenticated(_0x5f5062){return compose()[_0xa794('0x3b')](function(_0x5f1e4d,_0x453d9c,_0x5e29dd){var _0x19e10f;if(_0x5f1e4d[_0xa794('0x49')][_0xa794('0x4a')]){if(_[_0xa794('0x4b')](_0x5f1e4d[_0xa794('0x49')][_0xa794('0x4a')],'Basic')){var _0x48951e=basicAuth(_0x5f1e4d);db[_0xa794('0x4c')][_0xa794('0x4d')]({'where':{'name':_0x48951e['name']}})[_0xa794('0x40')](function(_0x281924){if(!_0x281924||!_0x281924[_0xa794('0x4e')](_0x48951e['pass'])){return _0x453d9c[_0xa794('0x43')](0x191)['json']({'message':_0xa794('0x4f')});}_0x5f1e4d[_0xa794('0x50')]={'id':_0x281924['id']};_0x5e29dd();})[_0xa794('0x47')](function(_0xdc0247){_0x5e29dd(_0xdc0247);});}else if(_['startsWith'](_0x5f1e4d[_0xa794('0x49')]['authorization'],'Bearer')){validateJwt(_0x5f1e4d,_0x453d9c,_0x5e29dd);}else{if(_0x5f5062){_0x5e29dd();}else{return _0x453d9c['status'](0x193)[_0xa794('0x44')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x5f1e4d[_0xa794('0x41')][_0xa794('0x51')]){try{var _0x1fdd62={'audience':hardwareConf[_0xa794('0x52')](),'issuer':hardwareConf[_0xa794('0x52')]()};verifyJwt(_0x5f1e4d[_0xa794('0x41')][_0xa794('0x51')],_0x1fdd62)[_0xa794('0x40')](function(_0x61f361){return db['User'][_0xa794('0x4d')]({'where':{'id':_0x61f361[_0xa794('0x53')]}})[_0xa794('0x40')](function(_0x4124e3){_0x19e10f=_0x4124e3;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xa794('0x54'),'blockDuration'],'raw':!![]});})[_0xa794('0x40')](function(_0x41fc93){if(!_0x19e10f||!_[_0xa794('0x55')](_0x19e10f['apiKeyNonce'],_0x61f361[_0xa794('0x56')])){return _0x453d9c[_0xa794('0x43')](0x191)[_0xa794('0x44')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x19e10f[_0xa794('0x57')]){return _0x453d9c[_0xa794('0x43')](0x191)[_0xa794('0x44')]({'message':_0xa794('0x58')});}if(_0x19e10f[_0xa794('0x59')]){if(_0x41fc93[_0xa794('0x5a')]>0x0){if(moment(_0x19e10f[_0xa794('0x5b')])[_0xa794('0x5c')](_0x41fc93[_0xa794('0x5a')],_0xa794('0x5d'))>moment()){return _0x453d9c[_0xa794('0x43')](0x191)['json']({'message':_0xa794('0x58')});}}else{return _0x453d9c[_0xa794('0x43')](0x191)[_0xa794('0x44')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x5f1e4d[_0xa794('0x50')]={'id':_0x19e10f['id']};_0x5e29dd();});})[_0xa794('0x47')](function(){return _0x453d9c[_0xa794('0x43')](0x191)[_0xa794('0x44')]({'message':_0xa794('0x58')});});}catch(_0x116f3d){_0x5e29dd(_0x116f3d);}}else if(_0x5f5062){_0x5e29dd();}else{return _0x453d9c['status'](0x193)[_0xa794('0x44')]({'message':_0xa794('0x5e')});}})[_0xa794('0x3b')](function(_0x1ec150,_0x519315,_0x13a172){if(_0x1ec150['user']){db[_0xa794('0x4c')][_0xa794('0x4d')]({'where':{'id':_0x1ec150[_0xa794('0x50')]['id']},'attributes':userAttributes})[_0xa794('0x40')](function(_0x38dc18){if(!_0x38dc18){return _0x519315[_0xa794('0x43')](0x194)['json']({'message':_0xa794('0x5f')});}_0x1ec150[_0xa794('0x50')]=_0x38dc18;_0x13a172();})[_0xa794('0x47')](function(_0x4ab739){_0x13a172(_0x4ab739);});}else if(_0x5f5062){_0x13a172();}else{return _0x519315['status'](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xa794('0x3b')](function(_0x24072b,_0x5414fc,_0x44c5d7){return licenseUtil['getLicense']()['then'](function(_0x535b64){if(_0x535b64[_0xa794('0x60')]){_0x44c5d7();}else{return _0x5414fc[_0xa794('0x43')](0x193)[_0xa794('0x44')]({'message':_0xa794('0x61')});}})['catch'](function(_0xa7f897){_0x44c5d7(_0xa7f897);});});};exports[_0xa794('0x62')]=function isWebrtcLicence(){return compose()[_0xa794('0x3b')](function(_0x21108c,_0x37518e,_0x39cb56){return licenseUtil[_0xa794('0x63')]()['then'](function(_0x11e998){if(_0x11e998[_0xa794('0x64')]){_0x39cb56();}else{return _0x37518e['status'](0x193)[_0xa794('0x44')]({'message':_0xa794('0x61')});}})[_0xa794('0x47')](function(_0x4e65af){_0x39cb56(_0x4e65af);});});};exports[_0xa794('0x65')]=function(_0x1dbbb1,_0x4a2837,_0x442e1c){_0x1dbbb1[_0xa794('0x65')]=!![];return _0x442e1c();};exports['signToken']=function signToken(_0xf52347){return signJwt(_0xf52347);};exports[_0xa794('0x66')]=function(_0x2d1684,_0x6b3453){if(!_0x2d1684[_0xa794('0x50')]){return _0x6b3453['status'](0x194)[_0xa794('0x44')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x5deb19={'payload':{'id':_0x2d1684[_0xa794('0x50')]['id'],'role':_0x2d1684[_0xa794('0x50')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x5deb19)[_0xa794('0x40')](function(_0x3473f3){_0x6b3453[_0xa794('0x67')]('motion.token',_0x3473f3);_0x6b3453[_0xa794('0x68')](_0xa794('0x69'));})[_0xa794('0x47')](function(_0x20a6f5){return _0x6b3453[_0xa794('0x43')](0x1f4)[_0xa794('0x6a')](_0x20a6f5);});};exports[_0xa794('0x6b')]=function(_0x4e0a0f){if(_[_0xa794('0x6c')](_0x4e0a0f[_0xa794('0x6d')])||_[_0xa794('0x6c')](_0x4e0a0f[_0xa794('0x6e')])){return null;}else{return createJwt(_0x4e0a0f);}};exports[_0xa794('0x6f')]=function(_0x48da9e){_0x48da9e[_0xa794('0x6d')]=generateNonce();_0x48da9e['apiKeyIat']=generateIssuedAt();return createJwt(_0x48da9e);};exports[_0xa794('0x70')]=function(_0x1f0c80,_0x1b9f78){var _0x40fb2f=_0x1f0c80[_0xa794('0x41')]['apikey'];if(_0x40fb2f){var _0x309b2a={'nonce':_0x1b9f78[_0xa794('0x6d')],'iat':_0x1b9f78[_0xa794('0x6e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xa794('0x52')]()};return verifyJwt(_0x40fb2f,_0x309b2a)[_0xa794('0x40')](function(){return generateApiKey(_0x1b9f78);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xa794('0x71')]=function(_0x3175da){var _0x4071e6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4071e6['test'](_0x3175da))throw new db['Sequelize'][(_0xa794('0x72'))](_0xa794('0x73'));return;};exports[_0xa794('0x74')]=function(_0x1ff7c2,_0x2cbcc4,_0xa9cb54){var _0xc462a8=encryptor[_0xa794('0x75')](_0x2cbcc4)['split'](',');for(var _0x2912e4=0x0;_0x2912e4<_0xa9cb54;_0x2912e4++){if(!_0xc462a8[_0x2912e4])break;if(_0x1ff7c2[_0xa794('0x76')]()===_0xc462a8[_0x2912e4]['toLowerCase']()){var _0x5a6e28=util[_0xa794('0x77')](_0xa794('0x78'),_0xa9cb54);if(_0xa9cb54===0x1){_0x5a6e28=_0xa794('0x79');}throw new db['Sequelize'][(_0xa794('0x72'))](_0x5a6e28);}}return;};exports[_0xa794('0x7a')]=function(_0x82cb54,_0xb806e5){var _0x19e354=_0xb806e5?encryptor[_0xa794('0x75')](_0xb806e5)[_0xa794('0x7b')](','):[];if(_0x19e354['length']===0x5){_0x19e354['splice'](-0x1,0x1);}_0x19e354['unshift'](_0x82cb54);return encryptor[_0xa794('0x7c')](_0x19e354['join'](','));};function signJwt(_0x4d70fa){var _0x3a12f5=BPromise[_0xa794('0x7d')](jwt['sign'],{'context':jwt});var _0x7e61d9=_0x4d70fa[_0xa794('0x7e')]||config[_0xa794('0x7f')][_0xa794('0x80')];return new BPromise(function(_0x28e5ec,_0x27c70f){_0x3a12f5(_0x4d70fa['payload'],_0x7e61d9,_0x4d70fa[_0xa794('0x81')])[_0xa794('0x40')](function(_0x171e49){_0x28e5ec(_0x171e49);})[_0xa794('0x47')](function(_0x214b45){_0x27c70f(_0x214b45);});});}function verifyJwt(_0x1b37fd,_0x4e7221,_0x33e633){var _0x42d883=BPromise[_0xa794('0x7d')](jwt[_0xa794('0x82')],{'context':jwt});var _0x148bcf=_0x33e633||config[_0xa794('0x7f')][_0xa794('0x80')];return new BPromise(function(_0x42719b,_0x41f3f5){_0x42d883(_0x1b37fd,_0x148bcf,_0x4e7221)[_0xa794('0x40')](function(_0x296da5){_0x42719b(_0x296da5);})[_0xa794('0x47')](function(_0x273cd3){_0x41f3f5(_0x273cd3);});});}function generateNonce(){return crypto[_0xa794('0x83')](0x10)['toString'](_0xa794('0x84'));}function generateIssuedAt(){return Math[_0xa794('0x85')](Date[_0xa794('0x86')]()/0x3e8)[_0xa794('0x87')]();}function createJwt(_0xa9c8d2){var _0x4aaf19={'payload':{'iat':_0xa9c8d2['apiKeyIat'],'nonce':_0xa9c8d2[_0xa794('0x6d')]},'options':{'algorithm':'HS512','subject':_0xa9c8d2['id'][_0xa794('0x87')](),'issuer':hardwareConf[_0xa794('0x52')](),'audience':hardwareConf[_0xa794('0x52')]()}};return signJwt(_0x4aaf19)['then'](function(_0x2a086f){return{'iat':_0xa9c8d2[_0xa794('0x6e')],'nonce':_0xa9c8d2[_0xa794('0x6d')],'token':_0x2a086f};});} \ No newline at end of file +var _0xeced=['permissions','md5secret','voicePause','chatPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','use','user','ChatInteraction','params','disposition','then','closed','query','forceDownload','status','unmanaged','json','Unmanaged.','isAuthenticated','headers','authorization','startsWith','Basic','User','authenticate','pass','Wrong\x20credentials.','catch','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','find','sub','Setting','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','getLicense','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','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~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','unshift','encryptString','promisify','sign','secret','payload','options','verify','session','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','composable-middleware','basic-auth','util','secrets','role','name','internal'];(function(_0x10b6ae,_0x56a559){var _0x1321e9=function(_0x9b0eb2){while(--_0x9b0eb2){_0x10b6ae['push'](_0x10b6ae['shift']());}};_0x1321e9(++_0x56a559);}(_0xeced,0x10f));var _0xdece=function(_0x2c680d,_0x1cb29f){_0x2c680d=_0x2c680d-0x0;var _0x43bc53=_0xeced[_0x2c680d];return _0x43bc53;};'use strict';var db=require(_0xdece('0x0'))['db'];var config=require(_0xdece('0x1'));var hardwareConf=require(_0xdece('0x2'));var licenseUtil=require(_0xdece('0x3'));var encryptor=require(_0xdece('0x4'));var _=require(_0xdece('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require(_0xdece('0x6'));var basicAuth=require(_0xdece('0x7'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0xdece('0x8'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xdece('0x9')]['session']});var userAttributes=['id',_0xdece('0xa'),'fullname',_0xdece('0xb'),_0xdece('0xc'),'email','userpic',_0xdece('0xd'),_0xdece('0xe'),_0xdece('0xf'),_0xdece('0x10'),'mailPause',_0xdece('0x11'),'smsPause',_0xdece('0x12'),_0xdece('0x13'),_0xdece('0x14'),_0xdece('0x15'),_0xdece('0x16'),_0xdece('0x17'),_0xdece('0x18'),_0xdece('0x19'),_0xdece('0x1a'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd',_0xdece('0x1b'),_0xdece('0x1c'),_0xdece('0x1d'),_0xdece('0x1e'),_0xdece('0x1f'),_0xdece('0x20'),_0xdece('0x21'),_0xdece('0x22'),_0xdece('0x23'),_0xdece('0x24'),_0xdece('0x25'),'settingsEnabled',_0xdece('0x26'),_0xdece('0x27'),_0xdece('0x28'),_0xdece('0x29'),'ignorePauseForPreviewCalls',_0xdece('0x2a'),'chatAutoanswer',_0xdece('0x2b'),_0xdece('0x2c'),'emailAutoanswerDelay','smsAutoanswer',_0xdece('0x2d'),_0xdece('0x2e'),_0xdece('0x2f'),_0xdece('0x30'),_0xdece('0x31'),_0xdece('0x32'),_0xdece('0x33'),'messengerSoundNotification'];exports[_0xdece('0x34')]=function(){return this['isAuthenticated'](!![])[_0xdece('0x35')](function(_0x1158f5,_0x54700f,_0x1a05a8){if(_0x1158f5[_0xdece('0x36')]){_0x1a05a8();}else{return db[_0xdece('0x37')]['findOne']({'where':{'id':_0x1158f5[_0xdece('0x38')]['id']},'attributes':['id','closed',_0xdece('0x39')],'raw':!![]})[_0xdece('0x3a')](function(_0x48b9d5){if(_0x48b9d5&&_0x48b9d5[_0xdece('0x3b')]&&!_0x1158f5[_0xdece('0x3c')][_0xdece('0x3d')]){return _0x54700f[_0xdece('0x3e')](_0x48b9d5['disposition']===_0xdece('0x3f')?0x195:0x193)[_0xdece('0x40')]({'message':_0x48b9d5[_0xdece('0x39')]===_0xdece('0x3f')?_0xdece('0x41'):'Forbidden.'});}else{_0x1a05a8();}})['catch'](function(_0x3f1330){_0x1a05a8(_0x3f1330);});}});};exports[_0xdece('0x42')]=function isAuthenticated(_0x77959d){return compose()[_0xdece('0x35')](function(_0x568788,_0x2e3c3d,_0x47eb54){var _0x23603c;if(_0x568788[_0xdece('0x43')][_0xdece('0x44')]){if(_[_0xdece('0x45')](_0x568788[_0xdece('0x43')][_0xdece('0x44')],_0xdece('0x46'))){var _0x5d0e40=basicAuth(_0x568788);db[_0xdece('0x47')]['find']({'where':{'name':_0x5d0e40[_0xdece('0xb')]}})['then'](function(_0x3e37dc){if(!_0x3e37dc||!_0x3e37dc[_0xdece('0x48')](_0x5d0e40[_0xdece('0x49')])){return _0x2e3c3d[_0xdece('0x3e')](0x191)[_0xdece('0x40')]({'message':_0xdece('0x4a')});}_0x568788['user']={'id':_0x3e37dc['id']};_0x47eb54();})[_0xdece('0x4b')](function(_0xbf6e73){_0x47eb54(_0xbf6e73);});}else if(_[_0xdece('0x45')](_0x568788[_0xdece('0x43')][_0xdece('0x44')],_0xdece('0x4c'))){validateJwt(_0x568788,_0x2e3c3d,_0x47eb54);}else{if(_0x77959d){_0x47eb54();}else{return _0x2e3c3d[_0xdece('0x3e')](0x193)['json']({'message':_0xdece('0x4d')});}}}else if(_0x568788[_0xdece('0x3c')][_0xdece('0x4e')]){try{var _0x3a51b4={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdece('0x4f')]()};verifyJwt(_0x568788[_0xdece('0x3c')][_0xdece('0x4e')],_0x3a51b4)[_0xdece('0x3a')](function(_0x1759e9){return db[_0xdece('0x47')][_0xdece('0x50')]({'where':{'id':_0x1759e9[_0xdece('0x51')]}})['then'](function(_0x739f3c){_0x23603c=_0x739f3c;return db[_0xdece('0x52')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xdece('0x53')],'raw':!![]});})['then'](function(_0x43b80a){if(!_0x23603c||!_[_0xdece('0x54')](_0x23603c[_0xdece('0x55')],_0x1759e9[_0xdece('0x56')])){return _0x2e3c3d[_0xdece('0x3e')](0x191)[_0xdece('0x40')]({'message':_0xdece('0x57')});}if(_0x23603c['disabled']){return _0x2e3c3d[_0xdece('0x3e')](0x191)[_0xdece('0x40')]({'message':_0xdece('0x58')});}if(_0x23603c['blocked']){if(_0x43b80a[_0xdece('0x53')]>0x0){if(moment(_0x23603c['blockedAt'])[_0xdece('0x59')](_0x43b80a[_0xdece('0x53')],_0xdece('0x5a'))>moment()){return _0x2e3c3d[_0xdece('0x3e')](0x191)[_0xdece('0x40')]({'message':_0xdece('0x58')});}}else{return _0x2e3c3d[_0xdece('0x3e')](0x191)[_0xdece('0x40')]({'message':_0xdece('0x58')});}}_0x568788['user']={'id':_0x23603c['id']};_0x47eb54();});})[_0xdece('0x4b')](function(){return _0x2e3c3d[_0xdece('0x3e')](0x191)[_0xdece('0x40')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x45f9c8){_0x47eb54(_0x45f9c8);}}else if(_0x77959d){_0x47eb54();}else{return _0x2e3c3d[_0xdece('0x3e')](0x193)[_0xdece('0x40')]({'message':_0xdece('0x4d')});}})['use'](function(_0x511a97,_0x2db5de,_0x1874f8){if(_0x511a97['user']){db[_0xdece('0x47')][_0xdece('0x50')]({'where':{'id':_0x511a97[_0xdece('0x36')]['id']},'attributes':userAttributes})[_0xdece('0x3a')](function(_0x56081c){if(!_0x56081c){return _0x2db5de[_0xdece('0x3e')](0x194)['json']({'message':_0xdece('0x5b')});}_0x511a97[_0xdece('0x36')]=_0x56081c;_0x1874f8();})[_0xdece('0x4b')](function(_0x1d26ae){_0x1874f8(_0x1d26ae);});}else if(_0x77959d){_0x1874f8();}else{return _0x2db5de[_0xdece('0x3e')](0x194)['json']({'message':_0xdece('0x5c')});}});};exports[_0xdece('0x5d')]=function canUpdate(){return compose()[_0xdece('0x35')](function(_0x3193f3,_0x29916c,_0x30aa17){return licenseUtil['getLicense']()[_0xdece('0x3a')](function(_0x205e06){if(_0x205e06[_0xdece('0x5e')]){_0x30aa17();}else{return _0x29916c[_0xdece('0x3e')](0x193)[_0xdece('0x40')]({'message':_0xdece('0x5f')});}})['catch'](function(_0x4e66b9){_0x30aa17(_0x4e66b9);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0xdece('0x35')](function(_0x14075c,_0x20504a,_0x4f7bef){return licenseUtil[_0xdece('0x60')]()[_0xdece('0x3a')](function(_0x551cd7){if(_0x551cd7[_0xdece('0x61')]){_0x4f7bef();}else{return _0x20504a[_0xdece('0x3e')](0x193)['json']({'message':_0xdece('0x5f')});}})['catch'](function(_0x1c7015){_0x4f7bef(_0x1c7015);});});};exports[_0xdece('0x62')]=function(_0x5b55c0,_0x1031ac,_0x6bb1d5){_0x5b55c0['isMiddleware']=!![];return _0x6bb1d5();};exports[_0xdece('0x63')]=function signToken(_0x3d022b){return signJwt(_0x3d022b);};exports[_0xdece('0x64')]=function(_0x763b56,_0x3b0ed6){if(!_0x763b56[_0xdece('0x36')]){return _0x3b0ed6[_0xdece('0x3e')](0x194)[_0xdece('0x40')]({'message':_0xdece('0x65')});}var _0x212a50={'payload':{'id':_0x763b56[_0xdece('0x36')]['id'],'role':_0x763b56[_0xdece('0x36')][_0xdece('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x212a50)[_0xdece('0x3a')](function(_0x4026eb){_0x3b0ed6[_0xdece('0x66')](_0xdece('0x67'),_0x4026eb);_0x3b0ed6[_0xdece('0x68')](_0xdece('0x69'));})[_0xdece('0x4b')](function(_0x2b41ef){return _0x3b0ed6[_0xdece('0x3e')](0x1f4)[_0xdece('0x6a')](_0x2b41ef);});};exports[_0xdece('0x6b')]=function(_0x1b8033){if(_['isNil'](_0x1b8033[_0xdece('0x55')])||_[_0xdece('0x6c')](_0x1b8033[_0xdece('0x6d')])){return null;}else{return createJwt(_0x1b8033);}};exports[_0xdece('0x6e')]=function(_0x22934e){_0x22934e[_0xdece('0x55')]=generateNonce();_0x22934e['apiKeyIat']=generateIssuedAt();return createJwt(_0x22934e);};exports[_0xdece('0x6f')]=function(_0x47c96c,_0x2f34f7){var _0x254f2f=_0x47c96c['query']['apikey'];if(_0x254f2f){var _0x2f494b={'nonce':_0x2f34f7['apiKeyNonce'],'iat':_0x2f34f7[_0xdece('0x6d')],'audience':hardwareConf[_0xdece('0x4f')](),'issuer':hardwareConf[_0xdece('0x4f')]()};return verifyJwt(_0x254f2f,_0x2f494b)[_0xdece('0x3a')](function(){return generateApiKey(_0x2f34f7);});}else{throw{'message':_0xdece('0x70')};}};exports[_0xdece('0x71')]=function(_0x2e1400){var _0x4e591b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4e591b[_0xdece('0x72')](_0x2e1400))throw new db['Sequelize'][(_0xdece('0x73'))](_0xdece('0x74'));return;};exports[_0xdece('0x75')]=function(_0x439a8b,_0x2eb1f0,_0x52d40a){var _0x115258=encryptor[_0xdece('0x76')](_0x2eb1f0)[_0xdece('0x77')](',');for(var _0x1b9b12=0x0;_0x1b9b12<_0x52d40a;_0x1b9b12++){if(!_0x115258[_0x1b9b12])break;if(_0x439a8b[_0xdece('0x78')]()===_0x115258[_0x1b9b12][_0xdece('0x78')]()){var _0x4a5ba0=util[_0xdece('0x79')](_0xdece('0x7a'),_0x52d40a);if(_0x52d40a===0x1){_0x4a5ba0=_0xdece('0x7b');}throw new db[(_0xdece('0x7c'))]['ValidationError'](_0x4a5ba0);}}return;};exports[_0xdece('0x7d')]=function(_0x271b76,_0x152e8f){var _0x47a990=_0x152e8f?encryptor[_0xdece('0x76')](_0x152e8f)[_0xdece('0x77')](','):[];if(_0x47a990[_0xdece('0x7e')]===0x5){_0x47a990['splice'](-0x1,0x1);}_0x47a990[_0xdece('0x7f')](_0x271b76);return encryptor[_0xdece('0x80')](_0x47a990['join'](','));};function signJwt(_0xe94051){var _0x5eec50=BPromise[_0xdece('0x81')](jwt[_0xdece('0x82')],{'context':jwt});var _0x1be83f=_0xe94051[_0xdece('0x83')]||config[_0xdece('0x9')]['session'];return new BPromise(function(_0x228326,_0xc59016){_0x5eec50(_0xe94051[_0xdece('0x84')],_0x1be83f,_0xe94051[_0xdece('0x85')])[_0xdece('0x3a')](function(_0x389338){_0x228326(_0x389338);})['catch'](function(_0x13a1bd){_0xc59016(_0x13a1bd);});});}function verifyJwt(_0x4dc8aa,_0x1a7165,_0x58590c){var _0x44fb2d=BPromise['promisify'](jwt[_0xdece('0x86')],{'context':jwt});var _0x22956e=_0x58590c||config['secrets'][_0xdece('0x87')];return new BPromise(function(_0x518279,_0x20e398){_0x44fb2d(_0x4dc8aa,_0x22956e,_0x1a7165)[_0xdece('0x3a')](function(_0x26b01c){_0x518279(_0x26b01c);})['catch'](function(_0x2f1994){_0x20e398(_0x2f1994);});});}function generateNonce(){return crypto[_0xdece('0x88')](0x10)[_0xdece('0x89')](_0xdece('0x8a'));}function generateIssuedAt(){return Math[_0xdece('0x8b')](Date[_0xdece('0x8c')]()/0x3e8)[_0xdece('0x89')]();}function createJwt(_0xd08440){var _0x5f01d4={'payload':{'iat':_0xd08440[_0xdece('0x6d')],'nonce':_0xd08440[_0xdece('0x55')]},'options':{'algorithm':_0xdece('0x8d'),'subject':_0xd08440['id'][_0xdece('0x89')](),'issuer':hardwareConf[_0xdece('0x4f')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x5f01d4)[_0xdece('0x3a')](function(_0x374be9){return{'iat':_0xd08440[_0xdece('0x6d')],'nonce':_0xd08440['apiKeyNonce'],'token':_0x374be9};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 70da06f..5f1d8be 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfab=['parseAdvancedSearchFilter','parseQueryParameters','where','default','filter','user','clause','tags','skip','ids','tag','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','rows','describe','keys','cf_','map','slice','all','length','fieldType','type','catch','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search'];(function(_0x1cd47d,_0x55bc75){var _0x29d52f=function(_0x37737a){while(--_0x37737a){_0x1cd47d['push'](_0x1cd47d['shift']());}};_0x29d52f(++_0x55bc75);}(_0xdfab,0x13b));var _0xbdfa=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0xdfab[_0x484c03];return _0x294127;};'use strict';var _=require(_0xbdfa('0x0'));var sqlUtils=require(_0xbdfa('0x1'));var db=require(_0xbdfa('0x2'))['db'];exports[_0xbdfa('0x3')]=function(_0xd3c699,_0x2156df,_0x57cfb3,_0x23f3d0){var _0x509f56={'count':0x0,'rows':[]};var _0x325f0c=sqlUtils[_0xbdfa('0x4')](_0x2156df,_0xd3c699);if(_0x325f0c){return Promise[_0xbdfa('0x5')](_0x509f56);}var _0x275265=sqlUtils[_0xbdfa('0x6')]();var _0x49c85e={};var _0x25bc81=![];var _0x4e8e92=![];return Promise[_0xbdfa('0x5')]()[_0xbdfa('0x7')](function(){if(_0xd3c699[_0xbdfa('0x8')]){return sqlUtils[_0xbdfa('0x9')](_0xd3c699[_0xbdfa('0x8')],_0x23f3d0);}else{return sqlUtils[_0xbdfa('0xa')](_0xd3c699,_0x23f3d0);}})[_0xbdfa('0x7')](function(_0x560e69){_0x275265[_0xbdfa('0xb')](_0x560e69[_0xbdfa('0xc')]);_0x275265[_0xbdfa('0xb')](_0x560e69['fields']);_0x275265[_0xbdfa('0xb')](_0x560e69[_0xbdfa('0xd')]);_0x275265[_0xbdfa('0xb')](_0x560e69[_0xbdfa('0xe')][_0xbdfa('0xf')]);_0x49c85e=_0x560e69[_0xbdfa('0x10')];_0x4e8e92=_0x560e69[_0xbdfa('0xe')][_0xbdfa('0x11')];return sqlUtils['checkListsRestrictions'](_0x2156df,_0xd3c699,_0x4e8e92);})[_0xbdfa('0x7')](function(_0x3b54d9){_0x275265['where'](_0x3b54d9);var _0x243e53=_0xd3c699[_0xbdfa('0x8')]?_0x49c85e[_0xbdfa('0x12')]:_0xd3c699[_0xbdfa('0x13')];_0x25bc81=_0x243e53?!![]:![];return sqlUtils[_0xbdfa('0x14')](_0x275265,_0x243e53);})[_0xbdfa('0x7')](function(_0x148f7c){_0x509f56[_0xbdfa('0x15')]=_0x148f7c;if(_0x509f56[_0xbdfa('0x15')]===0x0){return;}if(_0xd3c699[_0xbdfa('0x16')]){_0x4e8e92=!![];}return sqlUtils[_0xbdfa('0x17')](_0x275265,_0xd3c699['fields'],_0x57cfb3,_0x25bc81,_0x49c85e['clause'],_0x4e8e92);})[_0xbdfa('0x7')](function(_0x42e27d){if(!_0x42e27d){return[];}return sqlUtils[_0xbdfa('0x18')](_0x42e27d,_0xd3c699,_0x57cfb3);})[_0xbdfa('0x7')](function(_0x148d77){_0x509f56[_0xbdfa('0x19')]=_0x148d77;return _0x509f56;})['catch'](function(_0xd3e60b){throw _0xd3e60b;});};exports[_0xbdfa('0x1a')]=function(){var _0x3223b4={};var _0x2410d9=[];return db['CmContact'][_0xbdfa('0x1a')]()['then'](function(_0x203211){_0x3223b4=_0x203211;var _0x32e99e=Object[_0xbdfa('0x1b')](_0x3223b4)[_0xbdfa('0xd')](function(_0x314198){return _['startsWith'](_0x314198,_0xbdfa('0x1c'))?_0x314198:undefined;});var _0xc714ed=_0x32e99e[_0xbdfa('0x1d')](function(_0x3d57cf){return db['CmCustomField']['findOne']({'where':{'id':_0x3d57cf[_0xbdfa('0x1e')](0x3)},'raw':!![]});});return Promise[_0xbdfa('0x1f')](_0xc714ed);})[_0xbdfa('0x7')](function(_0x3d0207){for(var _0x453e7d=0x0;_0x453e7d<_0x3d0207[_0xbdfa('0x20')];_0x453e7d++){if(_0x3d0207[_0x453e7d]){var _0x4c8a1e=_0xbdfa('0x1c')+_0x3d0207[_0x453e7d]['id'];_0x3223b4[_0x4c8a1e][_0xbdfa('0x21')]=_0x3d0207[_0x453e7d][_0xbdfa('0x22')];}}_0x2410d9=_[_0xbdfa('0x1d')](Object[_0xbdfa('0x1b')](_0x3223b4),function(_0x3ed127){return{'name':_0x3ed127,'type':_0x3223b4[_0x3ed127][_0xbdfa('0x22')]};});return _0x2410d9;})[_0xbdfa('0x23')](function(_0x5b6a2a){throw _0x5b6a2a;});}; \ No newline at end of file +var _0xcd1d=['slice','all','length','type','./sql-utils','../../mysqldb','findAll','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','filter','user','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','fields','clause','getFilteredContacts','rows','catch','describe','keys','cf_','map','CmCustomField'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xcd1d,0x16f));var _0xdcd1=function(_0x5532d9,_0x2a43ce){_0x5532d9=_0x5532d9-0x0;var _0x25469d=_0xcd1d[_0x5532d9];return _0x25469d;};'use strict';var _=require('lodash');var sqlUtils=require(_0xdcd1('0x0'));var db=require(_0xdcd1('0x1'))['db'];exports[_0xdcd1('0x2')]=function(_0xfb403c,_0x53ddf3,_0x511ebe,_0x243ff8){var _0x6f9aea={'count':0x0,'rows':[]};var _0x2726af=sqlUtils['skipContactsQuery'](_0x53ddf3,_0xfb403c);if(_0x2726af){return Promise[_0xdcd1('0x3')](_0x6f9aea);}var _0xec2fe3=sqlUtils[_0xdcd1('0x4')]();var _0x41df36={};var _0x337784=![];var _0x25ffe5=![];return Promise[_0xdcd1('0x3')]()[_0xdcd1('0x5')](function(){if(_0xfb403c[_0xdcd1('0x6')]){return sqlUtils[_0xdcd1('0x7')](_0xfb403c[_0xdcd1('0x6')],_0x243ff8);}else{return sqlUtils[_0xdcd1('0x8')](_0xfb403c,_0x243ff8);}})[_0xdcd1('0x5')](function(_0x164136){_0xec2fe3[_0xdcd1('0x9')](_0x164136[_0xdcd1('0xa')]);_0xec2fe3[_0xdcd1('0x9')](_0x164136['fields']);_0xec2fe3[_0xdcd1('0x9')](_0x164136[_0xdcd1('0xb')]);_0xec2fe3[_0xdcd1('0x9')](_0x164136[_0xdcd1('0xc')]['clause']);_0x41df36=_0x164136['tags'];_0x25ffe5=_0x164136[_0xdcd1('0xc')]['skip'];return sqlUtils[_0xdcd1('0xd')](_0x53ddf3,_0xfb403c,_0x25ffe5);})[_0xdcd1('0x5')](function(_0x14f1a5){_0xec2fe3[_0xdcd1('0x9')](_0x14f1a5);var _0x556094=_0xfb403c[_0xdcd1('0x6')]?_0x41df36[_0xdcd1('0xe')]:_0xfb403c[_0xdcd1('0xf')];_0x337784=_0x556094?!![]:![];return sqlUtils[_0xdcd1('0x10')](_0xec2fe3,_0x556094);})[_0xdcd1('0x5')](function(_0x4ef809){_0x6f9aea[_0xdcd1('0x11')]=_0x4ef809;if(_0x6f9aea[_0xdcd1('0x11')]===0x0){return;}if(_0xfb403c['User']){_0x25ffe5=!![];}return sqlUtils[_0xdcd1('0x12')](_0xec2fe3,_0xfb403c[_0xdcd1('0x13')],_0x511ebe,_0x337784,_0x41df36[_0xdcd1('0x14')],_0x25ffe5);})['then'](function(_0x414219){if(!_0x414219){return[];}return sqlUtils[_0xdcd1('0x15')](_0x414219,_0xfb403c,_0x511ebe);})[_0xdcd1('0x5')](function(_0x2f4355){_0x6f9aea[_0xdcd1('0x16')]=_0x2f4355;return _0x6f9aea;})[_0xdcd1('0x17')](function(_0x4346a0){throw _0x4346a0;});};exports['describe']=function(){var _0x4e08a2={};var _0x299227=[];return db['CmContact'][_0xdcd1('0x18')]()['then'](function(_0x48752b){_0x4e08a2=_0x48752b;var _0x5af484=Object[_0xdcd1('0x19')](_0x4e08a2)[_0xdcd1('0xb')](function(_0x510656){return _['startsWith'](_0x510656,_0xdcd1('0x1a'))?_0x510656:undefined;});var _0x2b51ba=_0x5af484[_0xdcd1('0x1b')](function(_0x89b7a1){return db[_0xdcd1('0x1c')]['findOne']({'where':{'id':_0x89b7a1[_0xdcd1('0x1d')](0x3)},'raw':!![]});});return Promise[_0xdcd1('0x1e')](_0x2b51ba);})[_0xdcd1('0x5')](function(_0x636c2){for(var _0x1d5841=0x0;_0x1d5841<_0x636c2[_0xdcd1('0x1f')];_0x1d5841++){if(_0x636c2[_0x1d5841]){var _0xb5950e=_0xdcd1('0x1a')+_0x636c2[_0x1d5841]['id'];_0x4e08a2[_0xb5950e]['fieldType']=_0x636c2[_0x1d5841][_0xdcd1('0x20')];}}_0x299227=_['map'](Object[_0xdcd1('0x19')](_0x4e08a2),function(_0x5e305e){return{'name':_0x5e305e,'type':_0x4e08a2[_0x5e305e][_0xdcd1('0x20')]};});return _0x299227;})[_0xdcd1('0x17')](function(_0x391d1d){throw _0x391d1d;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index a007ceb..78dd9f6 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x032e=['name','dateOfBirth','fieldType','datetime','castTo','DATE','type','default','value','start','end','Tag','tags','clause','and','ids','uc.UserId\x20=\x20?','skip','keys','map','some','compact','Contact','User','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','filter','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','order','DESC','findAll','keyBy','QueryTypes','SELECT','CmContact','sequelize','Tags','clone','COUNT(*)','isEmpty','Sequelize','query','toString','exports','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','uc.CmContactId\x20=\x20','ct.CmContactId\x20=\x20','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','email','CompanyId','deletedAt','includes','push','forEach','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','conditions','find'];(function(_0xe32b6f,_0x2831d7){var _0x5f5d54=function(_0x2b2ca2){while(--_0x2b2ca2){_0xe32b6f['push'](_0xe32b6f['shift']());}};_0x5f5d54(++_0x2831d7);}(_0x032e,0x1cc));var _0xe032=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x032e[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var squel=require(_0xe032('0x0'));var as=require(_0xe032('0x1'));var qs=require(_0xe032('0x2'));var utils=require(_0xe032('0x3'));var db=require(_0xe032('0x4'))['db'];function skipContactsQuery(_0x4a135a,_0x3aa0cb){var _0x3c0e0a=![];if(_0x4a135a[_0xe032('0x5')]===_0xe032('0x6')&&!_0x3aa0cb[_0xe032('0x7')]&&!_0x3aa0cb[_0xe032('0x8')]&&_0x3aa0cb[_0xe032('0x9')]!=='true'){_0x3c0e0a=!![];}return _0x3c0e0a;}function getContactsSubquery(){return squel[_0xe032('0xa')]()[_0xe032('0xb')](_0xe032('0xc'),'c')[_0xe032('0xd')](_0xe032('0xe'));}function applyJoinClauses(_0x3e7dd5,_0x565295){var _0x359454=_0x565295?'c':_0xe032('0xf');_0x3e7dd5[_0xe032('0x10')]('cm_user_has_contacts','uc',_0xe032('0x11')+_0x359454+'.id')['left_join']('cm_contact_has_tags','ct',_0xe032('0x12')+_0x359454+'.id')[_0xe032('0x10')]('tools_tags','t',_0xe032('0x13'));return _0x3e7dd5;}function addFieldsToQuery(_0x12c535,_0x3937bc,_0x3164ab,_0x34fd0b,_0x140e56){var _0x10aac3=_0x140e56?'c':_0xe032('0xf');if(!_0x3937bc){_0x3937bc=['id',_0xe032('0x14'),_0xe032('0x15'),_0xe032('0x16'),_0xe032('0x17'),_0xe032('0x18'),_0xe032('0x19'),_0xe032('0x8'),_0xe032('0x1a'),'createdAt','updatedAt',_0xe032('0x1b'),'TagIds'];}else if(!_0x3937bc[_0xe032('0x1c')]('id')){_0x3937bc[_0xe032('0x1d')]('id');}var _0x1625a0=_0x3164ab&&_0x140e56||!_0x3164ab&&!_0x140e56;if(_0x34fd0b){_0x1625a0=_0x34fd0b&&_0x140e56||!_0x34fd0b&&!_0x140e56;}_0x3937bc[_0xe032('0x1e')](function(_0x3a6a04){if(_0x3a6a04===_0xe032('0x1f')){if(_0x1625a0){_0x12c535[_0xe032('0x20')](_0xe032('0x21'),_0x3a6a04);}else if(_0x3164ab||_0x34fd0b){_0x12c535[_0xe032('0x20')](_0x10aac3+'.'+_0x3a6a04);}}else{_0x12c535[_0xe032('0x20')](_0x10aac3+'.'+_0x3a6a04);}});return _0x12c535;}function getSqlClauses(){var _0x31496e={'default':squel[_0xe032('0x22')](),'fields':squel[_0xe032('0x22')](),'filter':squel[_0xe032('0x22')](),'tags':{'clause':squel[_0xe032('0x22')](),'ids':null},'user':{'clause':squel[_0xe032('0x22')](),'skip':![]}};return _0x31496e;}function parseTagParameter(_0x35c3a9){var _0x448e8a=squel[_0xe032('0x22')]();if(_0x35c3a9){var _0x5e37f9=utils[_0xe032('0x23')](_0x35c3a9);_0x5e37f9['forEach'](function(_0x3122db){_0x448e8a['or'](_0xe032('0x24'),'%,'+_0x3122db+',%');});}return _0x448e8a;}function parseSearchFilter(_0x330030){var _0x36b8f7=squel[_0xe032('0x22')]();if(_0x330030){var _0x143e1f=_0x330030[_0xe032('0x25')]('\x5c','\x5c\x5c')[_0xe032('0x25')](/'/g,'\x27\x27');var _0x52db98=qs['escapeLIKESpecialChars'](_0x143e1f);if(_0x143e1f[_0xe032('0x26')]('\x20')[_0xe032('0x27')]>0x1){_0x36b8f7['or'](_0xe032('0x28'),qs[_0xe032('0x29')](_0x143e1f,!![]),null);}else{if(qs[_0xe032('0x2a')](_0x143e1f)){_0x36b8f7['or']('c.id\x20LIKE\x20?',_0x52db98+'%');_0x36b8f7['or'](_0xe032('0x2b'),_0x52db98+'%');_0x36b8f7['or'](_0xe032('0x2c'),_0x52db98+'%');_0x36b8f7['or'](_0xe032('0x2d'),_0x52db98+'%');}else if(qs['isEmail'](_0x143e1f)){_0x36b8f7['or'](_0xe032('0x2e'),_0x52db98+'%');}else{_0x36b8f7['or']('c.firstName\x20LIKE\x20?','%'+_0x52db98+'%');_0x36b8f7['or'](_0xe032('0x2f'),'%'+_0x52db98+'%');_0x36b8f7['or'](_0xe032('0x2e'),'%'+_0x52db98+'%');}}}return _0x36b8f7;}function parseAdvancedSearchFilter(_0x322c9c,_0x1911fb){var _0x5f16e8=getSqlClauses();var _0x425e9a=as['parseSearch'](_0x322c9c);var _0x5bf7a3=_0x425e9a['sqlOperator'];for(var _0x4bfcf2=0x0;_0x4bfcf2<_0x425e9a['conditions'][_0xe032('0x27')];_0x4bfcf2++){var _0x19235c=_0x425e9a[_0xe032('0x30')][_0x4bfcf2];var _0x5e4321='c';var _0x4ffd6f=_[_0xe032('0x31')](_0x1911fb,[_0xe032('0x32'),_0x19235c[_0xe032('0x20')]]);if(_0x4ffd6f){if(_0x19235c[_0xe032('0x20')]===_0xe032('0x33')||_0x4ffd6f[_0xe032('0x34')]===_0xe032('0x35')){_0x19235c[_0xe032('0x36')]=_0xe032('0x37');}var _0x5d58de=as['buildExpression'](_0x5e4321,_0x4ffd6f[_0xe032('0x38')],_0x19235c);_0x5f16e8[_0xe032('0x39')][_0x5bf7a3](_0x5d58de['text'],_0x5d58de[_0xe032('0x3a')][_0xe032('0x3b')],_0x5d58de[_0xe032('0x3a')][_0xe032('0x3c')]);}else{if(_0x19235c[_0xe032('0x20')]===_0xe032('0x3d')){var _0x7a7e04=_0x19235c[_0xe032('0x3a')][_0xe032('0x26')](',')['map'](function(_0x30754d){return Number(_0x30754d);});var _0xf4f236=parseTagParameter(_0x7a7e04);_0x5f16e8[_0xe032('0x3e')][_0xe032('0x3f')][_0xe032('0x40')](_0xf4f236);_0x5f16e8[_0xe032('0x3e')][_0xe032('0x41')]=_0x7a7e04;}else if(_0x19235c[_0xe032('0x20')]==='User'){_0x5f16e8['user'][_0xe032('0x3f')][_0xe032('0x40')](_0xe032('0x42'),_0x19235c[_0xe032('0x3a')]);_0x5f16e8['user'][_0xe032('0x43')]=!![];}}}return _0x5f16e8;}function parseModelFields(_0x26fdac,_0x33807d){var _0x98d40c=squel[_0xe032('0x22')]();var _0x20e526=_(_0x26fdac)[_0xe032('0x44')]()[_0xe032('0x45')](function(_0x5401d3){return _[_0xe032('0x46')](_0x33807d,['name',_0x5401d3])?_0x5401d3:undefined;})[_0xe032('0x47')]()[_0xe032('0x3a')]();if(_0x26fdac[_0xe032('0x48')]){_0x20e526[_0xe032('0x1d')](_0xe032('0x48'));}if(_0x26fdac[_0xe032('0x49')]){_0x20e526['push'](_0xe032('0x49'));}if(_0x20e526['length']>0x0){_0x20e526['forEach'](function(_0x315dc3){if(_0x315dc3==='ListId'){_0x98d40c[_0xe032('0x40')]('c.ListId\x20IN\x20?',[]['concat'](_0x26fdac[_0x315dc3]));}else if(_0x315dc3==='Contact'){var _0x24e0bc='%'+_0x26fdac[_0x315dc3]+'%';_0x98d40c[_0xe032('0x40')](_0xe032('0x4a'),_0x24e0bc);}else if(_0x315dc3===_0xe032('0x49')){_0x98d40c[_0xe032('0x40')](_0xe032('0x42'),_0x26fdac[_0x315dc3]);}else{_0x98d40c[_0xe032('0x40')]('c.'+_0x315dc3+_0xe032('0x4b'),_0x26fdac[_0x315dc3]);}});}return _0x98d40c;}function parseQueryParameters(_0x177c47,_0x1361d9){var _0x3903af=getSqlClauses();return Promise[_0xe032('0x4c')]()[_0xe032('0x4d')](function(){return parseModelFields(_0x177c47,_0x1361d9);})[_0xe032('0x4d')](function(_0x2ab67d){_0x3903af[_0xe032('0x4e')]['and'](_0x2ab67d);return parseTagParameter(_0x177c47['tag']);})[_0xe032('0x4d')](function(_0x290ecd){_0x3903af[_0xe032('0x3e')][_0xe032('0x3f')][_0xe032('0x40')](_0x290ecd);return parseSearchFilter(_0x177c47[_0xe032('0x4f')]);})['then'](function(_0x119407){_0x3903af[_0xe032('0x4f')]=_0x119407;return _0x3903af;});}function checkListsRestrictions(_0x44525c,_0x6ac824,_0x275399){var _0xa1f315=squel[_0xe032('0x22')]();return Promise[_0xe032('0x4c')]()['then'](function(){if(_0x6ac824['search']&&_0x44525c['role']===_0xe032('0x6')&&!_0x275399){return _0x44525c['getLists']({'attributes':['id'],'raw':!![]});}})[_0xe032('0x4d')](function(_0x43972a){if(_0x43972a){if(_0x43972a[_0xe032('0x27')]===0x0){_0xa1f315[_0xe032('0x40')](_0xe032('0x50'));}else{_0xa1f315[_0xe032('0x40')]('c.ListId\x20IN\x20?',_[_0xe032('0x45')](_0x43972a,'id'));}}})[_0xe032('0x4d')](function(){return _0xa1f315;});}function buildContactsQuery(_0x2a7f87,_0x2dbbcb,_0x2ff264,_0x576ccc,_0x523c92,_0x31fd6a){if(_0x2dbbcb){_0x2dbbcb=_0x2ff264[_0xe032('0x51')];}_0x2a7f87=addFieldsToQuery(_0x2a7f87,_0x2dbbcb,_0x576ccc,_0x31fd6a,!![]);var _0x23b656=squel[_0xe032('0xa')]();_0x23b656=addFieldsToQuery(_0x23b656,_0x2dbbcb,_0x576ccc,_0x31fd6a,![]);if(_0x576ccc||_0x31fd6a){_0x2a7f87=applyJoinClauses(_0x2a7f87,!![]);_0x2a7f87[_0xe032('0x52')](_0xe032('0x53'));if(_0x2ff264[_0xe032('0x54')]){_0x23b656[_0xe032('0x54')](_0x2ff264[_0xe032('0x54')]);}if(_0x2ff264['offset']){_0x23b656[_0xe032('0x55')](_0x2ff264['offset']);}}else{_0x23b656=applyJoinClauses(_0x23b656,![]);_0x23b656['group']('subqry.id');if(_0x2ff264[_0xe032('0x54')]){_0x2a7f87[_0xe032('0x54')](_0x2ff264[_0xe032('0x54')]);}if(_0x2ff264['offset']){_0x2a7f87[_0xe032('0x55')](_0x2ff264['offset']);}}_0x23b656['having'](_0x523c92);if(_0x2ff264['order']){_0x2ff264['order'][_0xe032('0x1e')](function(_0x3f5caf){_0x2a7f87[_0xe032('0x56')]('c.'+_0x3f5caf[0x0],_0x3f5caf[0x1]==='DESC'?![]:!![]);_0x23b656[_0xe032('0x56')]('subqry.'+_0x3f5caf[0x0],_0x3f5caf[0x1]===_0xe032('0x57')?![]:!![]);});}_0x23b656[_0xe032('0xb')](_0x2a7f87,'subqry');return _0x23b656;}function getFilteredContacts(_0x4de127){var _0x1da454=[];return db[_0xe032('0x3d')][_0xe032('0x58')]({'attributes':['id',_0xe032('0x32'),'color'],'raw':!![]})[_0xe032('0x4d')](function(_0x2a2c33){_0x1da454=_[_0xe032('0x59')](_0x2a2c33,'id');var _0x34c5ea={'type':db['Sequelize'][_0xe032('0x5a')][_0xe032('0x5b')],'model':db[_0xe032('0x5c')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xe032('0x5d')]['query'](_0x4de127['toString'](),_0x34c5ea);})['then'](function(_0x576a88){_0x576a88[_0xe032('0x1e')](function(_0x1b0e08){if(_0x1b0e08['TagIds']){_0x1b0e08[_0xe032('0x5e')]=[];_0x1b0e08['TagIds'][_0xe032('0x26')](',')[_0xe032('0x1e')](function(_0x378ca8){_0x1b0e08[_0xe032('0x5e')][_0xe032('0x1d')](_0x1da454[_0x378ca8]);});}delete _0x1b0e08['TagIds'];});return _0x576a88;});}function countFilteredContacts(_0x15d5d5,_0x421ffd){var _0x38a931=_0x15d5d5[_0xe032('0x5f')]();_0x38a931[_0xe032('0x20')](_0xe032('0x60'));_0x38a931=applyJoinClauses(_0x38a931,!![]);_0x15d5d5[_0xe032('0x52')](_0xe032('0x53'));var _0x5cf6ad=utils[_0xe032('0x23')](_0x421ffd);if(!_[_0xe032('0x61')](_0x5cf6ad)){_0x38a931[_0xe032('0xd')]('t.id\x20IN\x20?',_0x5cf6ad);}var _0x36dea6={'type':db[_0xe032('0x62')][_0xe032('0x5a')][_0xe032('0x5b')],'raw':!![]};return db[_0xe032('0x5d')][_0xe032('0x63')](_0x38a931[_0xe032('0x64')](),_0x36dea6)['then'](function(_0x532d97){return _0x532d97[0x0][_0xe032('0x60')];});}module[_0xe032('0x65')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xc21a=['MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','default','text','value','clause','and','ids','User','user','skip','some','compact','Contact','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','resolve','then','tag','tags','filter','agent','getLists','c.ListId\x20IN\x20?','attributes','select','group','limit','offset','subqry.id','having','order','subqry.','Tag','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','Tags','clone','isEmpty','t.id\x20IN\x20?','exports','lodash','squel','../interaction/utils','../../mysqldb','search','ListId','autocomplete','true','from','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','firstName','phone','mobile','fax','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length'];(function(_0x1edb87,_0x55bc63){var _0x4e864e=function(_0x23e58e){while(--_0x23e58e){_0x1edb87['push'](_0x1edb87['shift']());}};_0x4e864e(++_0x55bc63);}(_0xc21a,0x1dc));var _0xac21=function(_0x20ad7e,_0x44ddf7){_0x20ad7e=_0x20ad7e-0x0;var _0x519be3=_0xc21a[_0x20ad7e];return _0x519be3;};'use strict';var _=require(_0xac21('0x0'));var squel=require(_0xac21('0x1'));var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var utils=require(_0xac21('0x2'));var db=require(_0xac21('0x3'))['db'];function skipContactsQuery(_0x293f54,_0x3fe353){var _0x484b43=![];if(_0x293f54['role']==='agent'&&!_0x3fe353[_0xac21('0x4')]&&!_0x3fe353[_0xac21('0x5')]&&_0x3fe353[_0xac21('0x6')]!==_0xac21('0x7')){_0x484b43=!![];}return _0x484b43;}function getContactsSubquery(){return squel['select']()[_0xac21('0x8')](_0xac21('0x9'),'c')['where'](_0xac21('0xa'));}function applyJoinClauses(_0x25890b,_0x34137b){var _0x372025=_0x34137b?'c':_0xac21('0xb');_0x25890b[_0xac21('0xc')](_0xac21('0xd'),'uc',_0xac21('0xe')+_0x372025+_0xac21('0xf'))[_0xac21('0xc')](_0xac21('0x10'),'ct','ct.CmContactId\x20=\x20'+_0x372025+_0xac21('0xf'))[_0xac21('0xc')](_0xac21('0x11'),'t',_0xac21('0x12'));return _0x25890b;}function addFieldsToQuery(_0x47c94d,_0x418397,_0xc8fb61,_0x116a28,_0x35e0f8){var _0x590b9b=_0x35e0f8?'c':_0xac21('0xb');if(!_0x418397){_0x418397=['id',_0xac21('0x13'),'lastName',_0xac21('0x14'),_0xac21('0x15'),_0xac21('0x16'),_0xac21('0x17'),_0xac21('0x5'),_0xac21('0x18'),_0xac21('0x19'),_0xac21('0x1a'),_0xac21('0x1b'),_0xac21('0x1c')];}else if(!_0x418397['includes']('id')){_0x418397[_0xac21('0x1d')]('id');}var _0x5a1dca=_0xc8fb61&&_0x35e0f8||!_0xc8fb61&&!_0x35e0f8;if(_0x116a28){_0x5a1dca=_0x116a28&&_0x35e0f8||!_0x116a28&&!_0x35e0f8;}_0x418397[_0xac21('0x1e')](function(_0x90519e){if(_0x90519e===_0xac21('0x1c')){if(_0x5a1dca){_0x47c94d[_0xac21('0x1f')](_0xac21('0x20'),_0x90519e);}else if(_0xc8fb61||_0x116a28){_0x47c94d[_0xac21('0x1f')](_0x590b9b+'.'+_0x90519e);}}else{_0x47c94d['field'](_0x590b9b+'.'+_0x90519e);}});return _0x47c94d;}function getSqlClauses(){var _0x26d2b6={'default':squel[_0xac21('0x21')](),'fields':squel[_0xac21('0x21')](),'filter':squel[_0xac21('0x21')](),'tags':{'clause':squel[_0xac21('0x21')](),'ids':null},'user':{'clause':squel[_0xac21('0x21')](),'skip':![]}};return _0x26d2b6;}function parseTagParameter(_0x3bf724){var _0x1fe061=squel[_0xac21('0x21')]();if(_0x3bf724){var _0x23484c=utils[_0xac21('0x22')](_0x3bf724);_0x23484c['forEach'](function(_0x4533af){_0x1fe061['or'](_0xac21('0x23'),'%,'+_0x4533af+',%');});}return _0x1fe061;}function parseSearchFilter(_0x5f201a){var _0xe3729f=squel['expr']();if(_0x5f201a){var _0x568c6e=_0x5f201a[_0xac21('0x24')]('\x5c','\x5c\x5c')[_0xac21('0x24')](/'/g,'\x27\x27');var _0x11f2aa=qs['escapeLIKESpecialChars'](_0x568c6e);if(_0x568c6e[_0xac21('0x25')]('\x20')[_0xac21('0x26')]>0x1){_0xe3729f['or'](_0xac21('0x27'),qs[_0xac21('0x28')](_0x568c6e,!![]),null);}else{if(qs[_0xac21('0x29')](_0x568c6e)){_0xe3729f['or'](_0xac21('0x2a'),_0x11f2aa+'%');_0xe3729f['or'](_0xac21('0x2b'),_0x11f2aa+'%');_0xe3729f['or'](_0xac21('0x2c'),_0x11f2aa+'%');_0xe3729f['or']('c.fax\x20LIKE\x20?',_0x11f2aa+'%');}else if(qs[_0xac21('0x2d')](_0x568c6e)){_0xe3729f['or']('c.email\x20LIKE\x20?',_0x11f2aa+'%');}else{_0xe3729f['or'](_0xac21('0x2e'),'%'+_0x11f2aa+'%');_0xe3729f['or']('c.lastName\x20LIKE\x20?','%'+_0x11f2aa+'%');_0xe3729f['or'](_0xac21('0x2f'),'%'+_0x11f2aa+'%');}}}return _0xe3729f;}function parseAdvancedSearchFilter(_0x57ab53,_0x13a1a8){var _0x34148d=getSqlClauses();var _0x2ce319=as[_0xac21('0x30')](_0x57ab53);var _0x200491=_0x2ce319['sqlOperator'];for(var _0x36eee8=0x0;_0x36eee8<_0x2ce319[_0xac21('0x31')][_0xac21('0x26')];_0x36eee8++){var _0x5dfb1e=_0x2ce319[_0xac21('0x31')][_0x36eee8];var _0x3e0d45='c';var _0x22b6ff=_[_0xac21('0x32')](_0x13a1a8,[_0xac21('0x33'),_0x5dfb1e[_0xac21('0x1f')]]);if(_0x22b6ff){if(_0x5dfb1e[_0xac21('0x1f')]===_0xac21('0x34')||_0x22b6ff[_0xac21('0x35')]===_0xac21('0x36')){_0x5dfb1e[_0xac21('0x37')]=_0xac21('0x38');}var _0x542922=as[_0xac21('0x39')](_0x3e0d45,_0x22b6ff['type'],_0x5dfb1e);_0x34148d[_0xac21('0x3a')][_0x200491](_0x542922[_0xac21('0x3b')],_0x542922['value']['start'],_0x542922['value']['end']);}else{if(_0x5dfb1e[_0xac21('0x1f')]==='Tag'){var _0x3214f2=_0x5dfb1e[_0xac21('0x3c')][_0xac21('0x25')](',')['map'](function(_0x20b1c8){return Number(_0x20b1c8);});var _0x5905a5=parseTagParameter(_0x3214f2);_0x34148d['tags'][_0xac21('0x3d')][_0xac21('0x3e')](_0x5905a5);_0x34148d['tags'][_0xac21('0x3f')]=_0x3214f2;}else if(_0x5dfb1e[_0xac21('0x1f')]===_0xac21('0x40')){_0x34148d['user']['clause'][_0xac21('0x3e')]('uc.UserId\x20=\x20?',_0x5dfb1e[_0xac21('0x3c')]);_0x34148d[_0xac21('0x41')][_0xac21('0x42')]=!![];}}}return _0x34148d;}function parseModelFields(_0xc2c632,_0x431930){var _0x2c39f0=squel[_0xac21('0x21')]();var _0x2051de=_(_0xc2c632)['keys']()['map'](function(_0x5aee11){return _[_0xac21('0x43')](_0x431930,['name',_0x5aee11])?_0x5aee11:undefined;})[_0xac21('0x44')]()[_0xac21('0x3c')]();if(_0xc2c632[_0xac21('0x45')]){_0x2051de[_0xac21('0x1d')](_0xac21('0x45'));}if(_0xc2c632[_0xac21('0x40')]){_0x2051de['push']('User');}if(_0x2051de['length']>0x0){_0x2051de[_0xac21('0x1e')](function(_0x17e20b){if(_0x17e20b===_0xac21('0x5')){_0x2c39f0[_0xac21('0x3e')]('c.ListId\x20IN\x20?',[][_0xac21('0x46')](_0xc2c632[_0x17e20b]));}else if(_0x17e20b===_0xac21('0x45')){var _0x450c66='%'+_0xc2c632[_0x17e20b]+'%';_0x2c39f0[_0xac21('0x3e')](_0xac21('0x47'),_0x450c66);}else if(_0x17e20b===_0xac21('0x40')){_0x2c39f0['and'](_0xac21('0x48'),_0xc2c632[_0x17e20b]);}else{_0x2c39f0[_0xac21('0x3e')]('c.'+_0x17e20b+'\x20=\x20?',_0xc2c632[_0x17e20b]);}});}return _0x2c39f0;}function parseQueryParameters(_0xeddc9b,_0x5f2701){var _0x207ffb=getSqlClauses();return Promise[_0xac21('0x49')]()[_0xac21('0x4a')](function(){return parseModelFields(_0xeddc9b,_0x5f2701);})[_0xac21('0x4a')](function(_0x5ac23e){_0x207ffb['fields'][_0xac21('0x3e')](_0x5ac23e);return parseTagParameter(_0xeddc9b[_0xac21('0x4b')]);})[_0xac21('0x4a')](function(_0x49dafb){_0x207ffb[_0xac21('0x4c')][_0xac21('0x3d')][_0xac21('0x3e')](_0x49dafb);return parseSearchFilter(_0xeddc9b[_0xac21('0x4d')]);})[_0xac21('0x4a')](function(_0x39b816){_0x207ffb[_0xac21('0x4d')]=_0x39b816;return _0x207ffb;});}function checkListsRestrictions(_0x4430bd,_0x49b8ff,_0x161611){var _0x1fc77f=squel['expr']();return Promise[_0xac21('0x49')]()[_0xac21('0x4a')](function(){if(_0x49b8ff[_0xac21('0x4')]&&_0x4430bd['role']===_0xac21('0x4e')&&!_0x161611){return _0x4430bd[_0xac21('0x4f')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x4e0226){if(_0x4e0226){if(_0x4e0226[_0xac21('0x26')]===0x0){_0x1fc77f[_0xac21('0x3e')]('c.ListId\x20IS\x20NULL');}else{_0x1fc77f[_0xac21('0x3e')](_0xac21('0x50'),_['map'](_0x4e0226,'id'));}}})[_0xac21('0x4a')](function(){return _0x1fc77f;});}function buildContactsQuery(_0x117e49,_0x29b24f,_0x1dbaa1,_0x38e988,_0x53d777,_0x3e1451){if(_0x29b24f){_0x29b24f=_0x1dbaa1[_0xac21('0x51')];}_0x117e49=addFieldsToQuery(_0x117e49,_0x29b24f,_0x38e988,_0x3e1451,!![]);var _0x4cca38=squel[_0xac21('0x52')]();_0x4cca38=addFieldsToQuery(_0x4cca38,_0x29b24f,_0x38e988,_0x3e1451,![]);if(_0x38e988||_0x3e1451){_0x117e49=applyJoinClauses(_0x117e49,!![]);_0x117e49[_0xac21('0x53')]('c.id');if(_0x1dbaa1[_0xac21('0x54')]){_0x4cca38[_0xac21('0x54')](_0x1dbaa1[_0xac21('0x54')]);}if(_0x1dbaa1[_0xac21('0x55')]){_0x4cca38['offset'](_0x1dbaa1[_0xac21('0x55')]);}}else{_0x4cca38=applyJoinClauses(_0x4cca38,![]);_0x4cca38['group'](_0xac21('0x56'));if(_0x1dbaa1['limit']){_0x117e49[_0xac21('0x54')](_0x1dbaa1[_0xac21('0x54')]);}if(_0x1dbaa1[_0xac21('0x55')]){_0x117e49[_0xac21('0x55')](_0x1dbaa1[_0xac21('0x55')]);}}_0x4cca38[_0xac21('0x57')](_0x53d777);if(_0x1dbaa1['order']){_0x1dbaa1['order'][_0xac21('0x1e')](function(_0x297dd7){_0x117e49[_0xac21('0x58')]('c.'+_0x297dd7[0x0],_0x297dd7[0x1]==='DESC'?![]:!![]);_0x4cca38[_0xac21('0x58')](_0xac21('0x59')+_0x297dd7[0x0],_0x297dd7[0x1]==='DESC'?![]:!![]);});}_0x4cca38[_0xac21('0x8')](_0x117e49,_0xac21('0xb'));return _0x4cca38;}function getFilteredContacts(_0x1d647c){var _0x165441=[];return db[_0xac21('0x5a')]['findAll']({'attributes':['id','name','color'],'raw':!![]})[_0xac21('0x4a')](function(_0x23b765){_0x165441=_[_0xac21('0x5b')](_0x23b765,'id');var _0x29465c={'type':db[_0xac21('0x5c')][_0xac21('0x5d')][_0xac21('0x5e')],'model':db[_0xac21('0x5f')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xac21('0x60')][_0xac21('0x61')](_0x1d647c['toString'](),_0x29465c);})[_0xac21('0x4a')](function(_0x5b508f){_0x5b508f[_0xac21('0x1e')](function(_0x51b80d){if(_0x51b80d[_0xac21('0x1c')]){_0x51b80d[_0xac21('0x62')]=[];_0x51b80d[_0xac21('0x1c')][_0xac21('0x25')](',')[_0xac21('0x1e')](function(_0x510717){_0x51b80d[_0xac21('0x62')][_0xac21('0x1d')](_0x165441[_0x510717]);});}delete _0x51b80d[_0xac21('0x1c')];});return _0x5b508f;});}function countFilteredContacts(_0x51c088,_0x3f26aa){var _0x281900=_0x51c088[_0xac21('0x63')]();_0x281900['field']('COUNT(*)');_0x281900=applyJoinClauses(_0x281900,!![]);_0x51c088['group']('c.id');var _0x326960=utils[_0xac21('0x22')](_0x3f26aa);if(!_[_0xac21('0x64')](_0x326960)){_0x281900['where'](_0xac21('0x65'),_0x326960);}var _0x2373ab={'type':db['Sequelize']['QueryTypes'][_0xac21('0x5e')],'raw':!![]};return db[_0xac21('0x60')][_0xac21('0x61')](_0x281900['toString'](),_0x2373ab)['then'](function(_0x257169){return _0x257169[0x0]['COUNT(*)'];});}module[_0xac21('0x66')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index a117afe..ad39971 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 _0x7a2b=['unlink','secret','utf8','base64','final','createDecipher','crypto','bluebird','lodash','../../config/logger','app','session','aes-256-ctr','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','indexOf','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','close'];(function(_0x356184,_0x42ee78){var _0x36d3b6=function(_0x1b4004){while(--_0x1b4004){_0x356184['push'](_0x356184['shift']());}};_0x36d3b6(++_0x42ee78);}(_0x7a2b,0x1c8));var _0xb7a2=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x7a2b[_0x618414];return _0x21c19a;};'use strict';var crypto=require(_0xb7a2('0x0'));var fs=require('fs');var BPromise=require(_0xb7a2('0x1'));var _=require(_0xb7a2('0x2'));var config=require('../../config/environment');var logger=require(_0xb7a2('0x3'))(_0xb7a2('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xb7a2('0x5')],'algorithm':_0xb7a2('0x6')};const fileOptions={'algorithm':'aes192'};if(config[_0xb7a2('0x7')]&&config[_0xb7a2('0x7')][_0xb7a2('0x8')]){var isSupported=isAlgorithmSupported(config[_0xb7a2('0x7')][_0xb7a2('0x8')]);if(isSupported){fileOptions[_0xb7a2('0x8')]=config[_0xb7a2('0x7')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xb7a2('0x9')](',\x20');logger[_0xb7a2('0xa')](config[_0xb7a2('0x7')]['algorithm'],_0xb7a2('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x2c79eb){return AES_SUPPORTED_RX[_0xb7a2('0xc')](_0x2c79eb);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x4f11c9){return getSupportedCiphers()[_0xb7a2('0xd')](_0x4f11c9)>-0x1;}function combineOptions(_0x4f0ec4){var _0x250349={};for(var _0x39ac1f in fileOptions){if(fileOptions['hasOwnProperty'](_0x39ac1f)){_0x250349[_0x39ac1f]=fileOptions[_0x39ac1f];}}if(_0x4f0ec4){for(var _0x59a299 in _0x4f0ec4){if(_0x4f0ec4['hasOwnProperty'](_0x59a299)){_0x250349[_0x59a299]=_0x4f0ec4[_0x59a299];}}}return _0x250349;}exports[_0xb7a2('0xe')]=function(_0x21eb67,_0x6f8de0,_0x2c5e2a,_0x5c2618){return new BPromise(function(_0x3942ea,_0x1ccf44){_0x5c2618=combineOptions(_0x5c2618);var _0xf848a7=new Buffer(_0x2c5e2a);var _0x543467=fs[_0xb7a2('0xf')](_0x21eb67);var _0x335dfc=fs[_0xb7a2('0x10')](_0x6f8de0);var _0x333120=crypto[_0xb7a2('0x11')](_0x5c2618[_0xb7a2('0x8')],_0xf848a7);_0x543467['on'](_0xb7a2('0x12'),function(_0x42872c){var _0x37d8a6=new Buffer(_0x333120[_0xb7a2('0x13')](_0x42872c),_0xb7a2('0x14'));_0x335dfc[_0xb7a2('0x15')](_0x37d8a6);});_0x543467['on'](_0xb7a2('0x16'),function(){try{var _0x447781=new Buffer(_0x333120['final'](_0xb7a2('0x14')),'binary');_0x335dfc['write'](_0x447781);_0x335dfc[_0xb7a2('0x16')]();_0x335dfc['on'](_0xb7a2('0x17'),function(){return _0x3942ea(_0x6f8de0);});}catch(_0x508c2e){fs[_0xb7a2('0x18')](_0x6f8de0);return _0x1ccf44(_0x508c2e);}});});};exports['decryptFile']=function(_0x49eaa7,_0x4cbe3c,_0x5d8dac,_0x3f3c10){return new BPromise(function(_0x1906d7,_0x18673e){_0x3f3c10=combineOptions(_0x3f3c10);var _0x1047e7=new Buffer(_0x5d8dac);var _0x5bc6df=fs['createReadStream'](_0x49eaa7);var _0x1577a7=fs['createWriteStream'](_0x4cbe3c);var _0x1c9859=crypto['createDecipher'](_0x3f3c10[_0xb7a2('0x8')],_0x1047e7);_0x5bc6df['on'](_0xb7a2('0x12'),function(_0x4f1701){var _0x34f212=new Buffer(_0x1c9859[_0xb7a2('0x13')](_0x4f1701),'binary');_0x1577a7[_0xb7a2('0x15')](_0x34f212);});_0x5bc6df['on']('end',function(){try{var _0x87bdc=new Buffer(_0x1c9859['final'](_0xb7a2('0x14')),'binary');_0x1577a7[_0xb7a2('0x15')](_0x87bdc);_0x1577a7[_0xb7a2('0x16')]();_0x1577a7['on'](_0xb7a2('0x17'),function(){return _0x1906d7(_0x4cbe3c);});}catch(_0x542012){fs[_0xb7a2('0x18')](_0x4cbe3c);return _0x18673e(_0x542012);}});});};exports['encryptString']=function(_0x360010,_0x180f2d,_0x54ec29){var _0x259141=_0x54ec29||stringOptions[_0xb7a2('0x8')];var _0x27ffef=_0x180f2d||stringOptions[_0xb7a2('0x19')];var _0x434e3b=crypto[_0xb7a2('0x11')](_0x259141,_0x27ffef);var _0x50ccf6=_0x434e3b[_0xb7a2('0x13')](_0x360010,_0xb7a2('0x1a'),_0xb7a2('0x1b'));_0x50ccf6+=_0x434e3b[_0xb7a2('0x1c')](_0xb7a2('0x1b'));return _0x50ccf6;};exports['decryptString']=function(_0x43aecb,_0x8cc3fa,_0x32c78c){var _0x3164ce=_0x32c78c||stringOptions[_0xb7a2('0x8')];var _0x2e364f=_0x8cc3fa||stringOptions[_0xb7a2('0x19')];var _0x208f3b=crypto[_0xb7a2('0x1d')](_0x3164ce,_0x2e364f);var _0x4d34df=_0x208f3b[_0xb7a2('0x13')](_0x43aecb,_0xb7a2('0x1b'),_0xb7a2('0x1a'));_0x4d34df+=_0x208f3b[_0xb7a2('0x1c')]('utf8');return _0x4d34df;}; \ No newline at end of file +var _0x4886=['final','encryptString','secret','update','utf8','base64','decryptString','createDecipher','crypto','../../config/environment','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','binary','write','end','close','unlink','decryptFile'];(function(_0x4877bc,_0x24b542){var _0x296c34=function(_0x45e2b0){while(--_0x45e2b0){_0x4877bc['push'](_0x4877bc['shift']());}};_0x296c34(++_0x24b542);}(_0x4886,0x1e4));var _0x6488=function(_0xeef6af,_0x3ce84c){_0xeef6af=_0xeef6af-0x0;var _0x3061d7=_0x4886[_0xeef6af];return _0x3061d7;};'use strict';var crypto=require(_0x6488('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require(_0x6488('0x1'));var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x6488('0x2')],'algorithm':_0x6488('0x3')};const fileOptions={'algorithm':_0x6488('0x4')};if(config['encrypt']&&config[_0x6488('0x5')][_0x6488('0x6')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x6488('0x6')]);if(isSupported){fileOptions[_0x6488('0x6')]=config[_0x6488('0x5')][_0x6488('0x6')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x6488('0x7')](',\x20');logger[_0x6488('0x8')](config[_0x6488('0x5')][_0x6488('0x6')],_0x6488('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0xaea69f){return AES_SUPPORTED_RX[_0x6488('0xa')](_0xaea69f);}function getSupportedCiphers(){return crypto[_0x6488('0xb')]()[_0x6488('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x469c47){return getSupportedCiphers()[_0x6488('0xd')](_0x469c47)>-0x1;}function combineOptions(_0x2ca5c7){var _0x2934f0={};for(var _0x215a4a in fileOptions){if(fileOptions[_0x6488('0xe')](_0x215a4a)){_0x2934f0[_0x215a4a]=fileOptions[_0x215a4a];}}if(_0x2ca5c7){for(var _0x36c39 in _0x2ca5c7){if(_0x2ca5c7[_0x6488('0xe')](_0x36c39)){_0x2934f0[_0x36c39]=_0x2ca5c7[_0x36c39];}}}return _0x2934f0;}exports[_0x6488('0xf')]=function(_0x4cdf08,_0x3ae701,_0x167083,_0x45a16e){return new BPromise(function(_0x6b74b7,_0xae8859){_0x45a16e=combineOptions(_0x45a16e);var _0xaa0faf=new Buffer(_0x167083);var _0x597b48=fs[_0x6488('0x10')](_0x4cdf08);var _0x22d1e0=fs[_0x6488('0x11')](_0x3ae701);var _0x1fcaea=crypto[_0x6488('0x12')](_0x45a16e[_0x6488('0x6')],_0xaa0faf);_0x597b48['on'](_0x6488('0x13'),function(_0x4aa306){var _0x42575a=new Buffer(_0x1fcaea['update'](_0x4aa306),_0x6488('0x14'));_0x22d1e0[_0x6488('0x15')](_0x42575a);});_0x597b48['on'](_0x6488('0x16'),function(){try{var _0x1cede5=new Buffer(_0x1fcaea['final'](_0x6488('0x14')),'binary');_0x22d1e0[_0x6488('0x15')](_0x1cede5);_0x22d1e0[_0x6488('0x16')]();_0x22d1e0['on'](_0x6488('0x17'),function(){return _0x6b74b7(_0x3ae701);});}catch(_0x3e2d00){fs[_0x6488('0x18')](_0x3ae701);return _0xae8859(_0x3e2d00);}});});};exports[_0x6488('0x19')]=function(_0x1f58ad,_0x5d018c,_0x1f1b48,_0xa0223e){return new BPromise(function(_0x165b75,_0xf2bd43){_0xa0223e=combineOptions(_0xa0223e);var _0x400202=new Buffer(_0x1f1b48);var _0x5cf781=fs[_0x6488('0x10')](_0x1f58ad);var _0x3ac869=fs['createWriteStream'](_0x5d018c);var _0x37df9f=crypto['createDecipher'](_0xa0223e[_0x6488('0x6')],_0x400202);_0x5cf781['on']('data',function(_0x1cf74f){var _0x546d3c=new Buffer(_0x37df9f['update'](_0x1cf74f),_0x6488('0x14'));_0x3ac869[_0x6488('0x15')](_0x546d3c);});_0x5cf781['on'](_0x6488('0x16'),function(){try{var _0x1df87b=new Buffer(_0x37df9f[_0x6488('0x1a')](_0x6488('0x14')),_0x6488('0x14'));_0x3ac869['write'](_0x1df87b);_0x3ac869['end']();_0x3ac869['on'](_0x6488('0x17'),function(){return _0x165b75(_0x5d018c);});}catch(_0x3cf2f8){fs[_0x6488('0x18')](_0x5d018c);return _0xf2bd43(_0x3cf2f8);}});});};exports[_0x6488('0x1b')]=function(_0x5027c7,_0x119543,_0xe4c30){var _0x53eeb=_0xe4c30||stringOptions[_0x6488('0x6')];var _0x58eea5=_0x119543||stringOptions[_0x6488('0x1c')];var _0x36900b=crypto[_0x6488('0x12')](_0x53eeb,_0x58eea5);var _0x4a7d2e=_0x36900b[_0x6488('0x1d')](_0x5027c7,_0x6488('0x1e'),_0x6488('0x1f'));_0x4a7d2e+=_0x36900b[_0x6488('0x1a')](_0x6488('0x1f'));return _0x4a7d2e;};exports[_0x6488('0x20')]=function(_0x197220,_0x30fa71,_0x38e2a4){var _0x1148c3=_0x38e2a4||stringOptions[_0x6488('0x6')];var _0x446243=_0x30fa71||stringOptions[_0x6488('0x1c')];var _0x29af61=crypto[_0x6488('0x21')](_0x1148c3,_0x446243);var _0x26800f=_0x29af61[_0x6488('0x1d')](_0x197220,_0x6488('0x1f'),'utf8');_0x26800f+=_0x29af61['final']('utf8');return _0x26800f;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 8fe2896..2f92a49 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 _0xce76=['zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','QueryTypes','SELECT','Empty','length','range','isInteger','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','mkdirSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip'];(function(_0x1b5050,_0x202c5e){var _0x388e48=function(_0x1019e2){while(--_0x1019e2){_0x1b5050['push'](_0x1b5050['shift']());}};_0x388e48(++_0x202c5e);}(_0xce76,0xd0));var _0x6ce7=function(_0x2b42bf,_0x2f1463){_0x2b42bf=_0x2b42bf-0x0;var _0x23c423=_0xce76[_0x2b42bf];return _0x23c423;};'use strict';var util=require(_0x6ce7('0x0'));var path=require(_0x6ce7('0x1'));var _=require(_0x6ce7('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x6ce7('0x3'));var zipdir=require(_0x6ce7('0x4'));var rimraf=require(_0x6ce7('0x5'));var db=require(_0x6ce7('0x6'))['db'];var dbH=require(_0x6ce7('0x6'))['dbH'];var logger=require(_0x6ce7('0x7'))(_0x6ce7('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x6ce7('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3db1fb,_0x263259){var _0xec2cd7={'status':_0x3db1fb};var _0x36250b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x263259){_0xec2cd7[_0x6ce7('0xa')]=_0x263259;}return db[_0x6ce7('0xb')]['update'](_0xec2cd7,_0x36250b);}function main(){var _0x3953de=0x1388;var _0x157adc;logger[_0x6ce7('0xc')](util[_0x6ce7('0xd')](_0x6ce7('0xe'),EXTRACTED_REPORT_ID,_0x6ce7('0xf')));return db[_0x6ce7('0x10')][_0x6ce7('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6ce7('0x12'),_0x6ce7('0x13')]})[_0x6ce7('0x14')](function(_0x2256e){if(_0x2256e){_0x157adc=_0x2256e;_0x3953de=_0x157adc['splitSizeCsv']||0x1388;}})[_0x6ce7('0x14')](function(){return dbH[_0x6ce7('0x15')][_0x6ce7('0x16')](util[_0x6ce7('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x6ce7('0x15')][_0x6ce7('0x17')][_0x6ce7('0x18')]});})['then'](function(_0x6cca75){if(!_0x6cca75[0x0]['num']){return analyticExtractedReport(_0x6ce7('0x19'));}var _0x506232=[];var _0x4c295c=0x0;if(_0x157adc[_0x6ce7('0x12')]){if(_0x6cca75&&_0x6cca75[_0x6ce7('0x1a')]){var _0x473f13=_[_0x6ce7('0x1b')](_0x6cca75[0x0]['num']/_0x3953de);var _0x551f9=Number[_0x6ce7('0x1c')](_0x6cca75[0x0][_0x6ce7('0x1d')]/_0x3953de)?_0x6cca75[0x0][_0x6ce7('0x1d')]%_0x3953de:0x0;_0x473f13['forEach'](function(_0x528da3){if(_0x528da3>0x0){_0x4c295c+=_0x3953de;}_0x506232[_0x6ce7('0x1e')](dbH[_0x6ce7('0x15')][_0x6ce7('0x16')](util[_0x6ce7('0xd')](_0x6ce7('0x1f'),QUERY,_0x3953de,_0x4c295c),{'type':dbH[_0x6ce7('0x15')][_0x6ce7('0x17')][_0x6ce7('0x18')]}));});if(_0x551f9>0x0){_0x4c295c+=_0x3953de;_0x506232[_0x6ce7('0x1e')](dbH['sequelize']['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x551f9,_0x4c295c),{'type':dbH[_0x6ce7('0x15')]['QueryTypes'][_0x6ce7('0x18')]}));}}}else{_0x506232[_0x6ce7('0x1e')](dbH['sequelize'][_0x6ce7('0x16')](QUERY,{'type':dbH[_0x6ce7('0x15')][_0x6ce7('0x17')]['SELECT']}));}var _0x572b3e=path['dirname'](PATH);var _0x596a5e=path[_0x6ce7('0x20')](PATH,_0x6ce7('0x21'));var _0x144ccb=_0x157adc[_0x6ce7('0x12')]&&_0x506232[_0x6ce7('0x1a')]>0x1;var _0x282b7f=[];if(!fs['existsSync'](path['join'](_0x572b3e,_0x596a5e))&&_0x144ccb){fs[_0x6ce7('0x22')](path[_0x6ce7('0x23')](_0x572b3e,_0x596a5e));}return BPromise[_0x6ce7('0x24')](_0x506232,function(_0x2f1d02){_0x282b7f[_0x6ce7('0x1e')](_0x2f1d02);})['then'](function(){for(var _0x323483=0x0;_0x323483<_0x282b7f[_0x6ce7('0x1a')];_0x323483+=0x1){var _0x7dd749;var _0xf7356c=_0x282b7f[_0x323483];if(_0x144ccb){_0x7dd749=path['join'](_0x572b3e,_0x596a5e,util[_0x6ce7('0xd')](_0x6ce7('0x25'),_0x596a5e,_0x323483,_0x6ce7('0x26')));}else{_0x7dd749=path[_0x6ce7('0x23')](_0x572b3e,util[_0x6ce7('0xd')](_0x6ce7('0x27'),_0x596a5e,_0x6ce7('0x26')));}fs[_0x6ce7('0x28')](_0x7dd749,csv(_0xf7356c));}})[_0x6ce7('0x14')](function(){if(_0x144ccb){return new Promise(function(_0x164b2d){zipdir(path['join'](_0x572b3e,_0x596a5e),{'saveTo':path[_0x6ce7('0x23')](_0x572b3e,util[_0x6ce7('0xd')](_0x6ce7('0x27'),_0x596a5e,_0x6ce7('0x29')))},function(_0x2aafac,_0x1fc15d){rimraf(path['join'](_0x572b3e,_0x596a5e),function(){});_0x164b2d(_0x6ce7('0x2a'));});});}})[_0x6ce7('0x14')](function(){logger['info'](util[_0x6ce7('0xd')](_0x6ce7('0x2b'),EXTRACTED_REPORT_ID,_0x6ce7('0xf')));return analyticExtractedReport(_0x6ce7('0x2c'),_0x144ccb?util[_0x6ce7('0xd')]('%s.%s',_0x596a5e,_0x144ccb?_0x6ce7('0x29'):_0x6ce7('0x26')):null);});})[_0x6ce7('0x2d')](function(_0x1d32f5){logger['info'](util['format'](_0x6ce7('0x2e'),EXTRACTED_REPORT_ID,_0x6ce7('0xf')),util[_0x6ce7('0x2f')](_0x1d32f5,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6ce7('0x30'));})[_0x6ce7('0x31')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xbe89=['join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','exit','util','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','split','splitSizeCsv','then','sequelize','query','QueryTypes','SELECT','num','length','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','existsSync'];(function(_0x4c3f13,_0x4c1782){var _0x74adc6=function(_0x7c96b1){while(--_0x7c96b1){_0x4c3f13['push'](_0x4c3f13['shift']());}};_0x74adc6(++_0x4c1782);}(_0xbe89,0x17e));var _0x9be8=function(_0x3ae107,_0x5804fa){_0x3ae107=_0x3ae107-0x0;var _0x3ecfad=_0xbe89[_0x3ae107];return _0x3ecfad;};'use strict';var util=require(_0x9be8('0x0'));var path=require('path');var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x9be8('0x1'));var zipdir=require(_0x9be8('0x2'));var rimraf=require(_0x9be8('0x3'));var db=require(_0x9be8('0x4'))['db'];var dbH=require(_0x9be8('0x4'))[_0x9be8('0x5')];var logger=require(_0x9be8('0x6'))(_0x9be8('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x9be8('0x8')][0x2]);var QUERY=process[_0x9be8('0x8')][0x3];var PATH=process[_0x9be8('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x32ef68,_0x163a37){var _0x8ecde8={'status':_0x32ef68};var _0x5ecf91={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x163a37){_0x8ecde8[_0x9be8('0x9')]=_0x163a37;}return db[_0x9be8('0xa')][_0x9be8('0xb')](_0x8ecde8,_0x5ecf91);}function main(){var _0x125a7d=0x1388;var _0x5651cd;logger[_0x9be8('0xc')](util[_0x9be8('0xd')](_0x9be8('0xe'),EXTRACTED_REPORT_ID,_0x9be8('0xf')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9be8('0x10'),_0x9be8('0x11')]})[_0x9be8('0x12')](function(_0x54a8f1){if(_0x54a8f1){_0x5651cd=_0x54a8f1;_0x125a7d=_0x5651cd[_0x9be8('0x11')]||0x1388;}})[_0x9be8('0x12')](function(){return dbH[_0x9be8('0x13')][_0x9be8('0x14')](util[_0x9be8('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x9be8('0x13')][_0x9be8('0x15')][_0x9be8('0x16')]});})[_0x9be8('0x12')](function(_0x2af6d0){if(!_0x2af6d0[0x0][_0x9be8('0x17')]){return analyticExtractedReport('Empty');}var _0x2c19f1=[];var _0x3c973d=0x0;if(_0x5651cd[_0x9be8('0x10')]){if(_0x2af6d0&&_0x2af6d0[_0x9be8('0x18')]){var _0x1f56fe=_['range'](_0x2af6d0[0x0][_0x9be8('0x17')]/_0x125a7d);var _0x463d92=Number[_0x9be8('0x19')](_0x2af6d0[0x0][_0x9be8('0x17')]/_0x125a7d)?_0x2af6d0[0x0]['num']%_0x125a7d:0x0;_0x1f56fe[_0x9be8('0x1a')](function(_0x1d27f4){if(_0x1d27f4>0x0){_0x3c973d+=_0x125a7d;}_0x2c19f1['push'](dbH[_0x9be8('0x13')]['query'](util[_0x9be8('0xd')](_0x9be8('0x1b'),QUERY,_0x125a7d,_0x3c973d),{'type':dbH[_0x9be8('0x13')]['QueryTypes'][_0x9be8('0x16')]}));});if(_0x463d92>0x0){_0x3c973d+=_0x125a7d;_0x2c19f1[_0x9be8('0x1c')](dbH['sequelize'][_0x9be8('0x14')](util[_0x9be8('0xd')](_0x9be8('0x1b'),QUERY,_0x463d92,_0x3c973d),{'type':dbH[_0x9be8('0x13')]['QueryTypes']['SELECT']}));}}}else{_0x2c19f1[_0x9be8('0x1c')](dbH[_0x9be8('0x13')][_0x9be8('0x14')](QUERY,{'type':dbH[_0x9be8('0x13')]['QueryTypes'][_0x9be8('0x16')]}));}var _0x5855eb=path[_0x9be8('0x1d')](PATH);var _0x3b18fc=path[_0x9be8('0x1e')](PATH,'.csv');var _0x25313c=_0x5651cd[_0x9be8('0x10')]&&_0x2c19f1[_0x9be8('0x18')]>0x1;var _0x3dd322=[];if(!fs[_0x9be8('0x1f')](path[_0x9be8('0x20')](_0x5855eb,_0x3b18fc))&&_0x25313c){fs[_0x9be8('0x21')](path['join'](_0x5855eb,_0x3b18fc));}return BPromise[_0x9be8('0x22')](_0x2c19f1,function(_0x3520b6){_0x3dd322[_0x9be8('0x1c')](_0x3520b6);})[_0x9be8('0x12')](function(){for(var _0x57647c=0x0;_0x57647c<_0x3dd322['length'];_0x57647c+=0x1){var _0x19478a;var _0x5af08e=_0x3dd322[_0x57647c];if(_0x25313c){_0x19478a=path[_0x9be8('0x20')](_0x5855eb,_0x3b18fc,util[_0x9be8('0xd')](_0x9be8('0x23'),_0x3b18fc,_0x57647c,_0x9be8('0x24')));}else{_0x19478a=path[_0x9be8('0x20')](_0x5855eb,util[_0x9be8('0xd')](_0x9be8('0x25'),_0x3b18fc,_0x9be8('0x24')));}fs[_0x9be8('0x26')](_0x19478a,csv(_0x5af08e));}})[_0x9be8('0x12')](function(){if(_0x25313c){return new Promise(function(_0x30124d){zipdir(path['join'](_0x5855eb,_0x3b18fc),{'saveTo':path[_0x9be8('0x20')](_0x5855eb,util[_0x9be8('0xd')](_0x9be8('0x25'),_0x3b18fc,_0x9be8('0x27')))},function(_0x5cdbc6,_0x5358aa){rimraf(path[_0x9be8('0x20')](_0x5855eb,_0x3b18fc),function(){});_0x30124d(_0x9be8('0x28'));});});}})[_0x9be8('0x12')](function(){logger[_0x9be8('0xc')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x9be8('0xf')));return analyticExtractedReport(_0x9be8('0x29'),_0x25313c?util[_0x9be8('0xd')](_0x9be8('0x25'),_0x3b18fc,_0x25313c?'zip':_0x9be8('0x24')):null);});})[_0x9be8('0x2a')](function(_0x45603d){logger[_0x9be8('0xc')](util[_0x9be8('0xd')](_0x9be8('0x2b'),EXTRACTED_REPORT_ID,_0x9be8('0xf')),util[_0x9be8('0x2c')](_0x45603d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x9be8('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 9484889..dde6c88 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 _0x91b6=['/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','Interaction\x20Transcript','pipe','createWriteStream','finish','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','pick','toString','length','push','body','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','find','splitSizePdf','then','isInteger','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.pdf','split','existsSync','mkdirSync','join','each','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit'];(function(_0x36e557,_0x598f76){var _0x840c99=function(_0x1799a6){while(--_0x1799a6){_0x36e557['push'](_0x36e557['shift']());}};_0x840c99(++_0x598f76);}(_0x91b6,0x16b));var _0x691b=function(_0x28b14e,_0x5dc218){_0x28b14e=_0x28b14e-0x0;var _0x319848=_0x91b6[_0x28b14e];return _0x319848;};'use strict';var _=require(_0x691b('0x0'));var fs=require('fs');var util=require(_0x691b('0x1'));var path=require(_0x691b('0x2'));var moment=require(_0x691b('0x3'));var htmlToPdfmake=require(_0x691b('0x4'));var PdfPrinter=require(_0x691b('0x5'));var zipdir=require(_0x691b('0x6'));var rimraf=require(_0x691b('0x7'));var JSDOM=require(_0x691b('0x8'))[_0x691b('0x9')];var window=new JSDOM('')['window'];var BPromise=require(_0x691b('0xa'));var db=require(_0x691b('0xb'))['db'];var dbH=require('../../mysqldb')[_0x691b('0xc')];var logger=require(_0x691b('0xd'))(_0x691b('0xe'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x691b('0xf')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x691b('0xf')][0x5];var FORMAT=_0x691b('0x10');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x37b4c0,_0x44f987){var _0x720ff={'status':_0x37b4c0};var _0x4ebf6b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x44f987){_0x720ff[_0x691b('0x11')]=_0x44f987;}return db[_0x691b('0x12')]['update'](_0x720ff,_0x4ebf6b);}function getHeaders(_0x6331cb){return _[_0x691b('0x13')](_0x6331cb,function(_0x2c2979){return{'text':_0x2c2979,'style':'tableHeader'};});}function getRows(_0x8956a3,_0x4d9a4b){return _[_0x691b('0x13')](_0x4d9a4b,function(_0x20393f){return _(_0x20393f)[_0x691b('0x14')](_0x8956a3)[_0x691b('0x13')](function(_0x57f81e){return _0x57f81e?_[_0x691b('0x15')](_0x57f81e):'';})['value']();});}function createTable(_0x42234b,_0x5e2100){var _0x3fc48d={'widths':_['fill'](Array(_0x42234b[_0x691b('0x16')]),0x91),'heights':function(_0x47c5a5){return _0x47c5a5===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5f1a6e=getHeaders(_0x42234b);_0x3fc48d['body'][_0x691b('0x17')](_0x5f1a6e);var _0x271322=getRows(_0x42234b,_0x5e2100);_0x3fc48d[_0x691b('0x18')]=_0x3fc48d['body']['concat'](_0x271322);return _0x3fc48d;}function createTables(_0x35001f){var _0x2bc068=[];var _0x2fd0a8=_['chunk'](Object[_0x691b('0x19')](_0x35001f[0x0]),0x5);_0x2fd0a8['forEach'](function(_0x124e67){_0x2bc068[_0x691b('0x17')](createTable(_0x124e67,_0x35001f));});return _0x2bc068;}function getPDFDocDefinition(_0x1bd08e){var _0x5ee5a3=util[_0x691b('0x1a')](_0x691b('0x1b'),NAME,EXTRACTED_REPORT[_0x691b('0x1c')],moment(EXTRACTED_REPORT[_0x691b('0x1d')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x691b('0x1e')])[_0x691b('0x1a')](FORMAT));var _0x54e369=[];for(var _0x45c194=0x0;_0x45c194<_0x1bd08e[_0x691b('0x16')];_0x45c194++){var _0x22b5c8=[];if(_0x45c194===0x0){_0x22b5c8[_0x691b('0x17')]({'text':_0x5ee5a3,'style':_0x691b('0x1f')});}var _0x2d1ad1={'table':_0x1bd08e[_0x45c194]};if(_0x45c194>0x0){_0x2d1ad1[_0x691b('0x20')]=_0x691b('0x21');_0x2d1ad1[_0x691b('0x22')]=[0x0,0x46,0x0,0x0];}_0x22b5c8[_0x691b('0x17')](_0x2d1ad1);_0x54e369['push'](_0x22b5c8);}return{'pageSize':'A4','pageOrientation':_0x691b('0x23'),'content':_0x54e369,'footer':function(_0x530ab3,_0x3cc8fb){return{'text':_0x530ab3[_0x691b('0x15')]()+_0x691b('0x24')+_0x3cc8fb,'style':_0x691b('0x25')};},'defaultStyle':{'font':_0x691b('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x691b('0x27')},'footer':{'alignment':_0x691b('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x548e5b){var _0x3ee151=0x1388;var _0x298943;if(!_0x548e5b[0x0][_0x691b('0x29')]){return analyticExtractedReport(_0x691b('0x2a'));}return db['Setting'][_0x691b('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x691b('0x2c')]})[_0x691b('0x2d')](function(_0x2c8b90){if(_0x2c8b90){_0x298943=_0x2c8b90;_0x3ee151=_0x298943[_0x691b('0x2c')]||0x3e8;}})[_0x691b('0x2d')](function(){var _0x318c65=[];var _0x2f97fa=0x0;if(_0x298943['split']){if(_0x548e5b&&_0x548e5b[_0x691b('0x16')]){var _0x2a0d92=_['range'](_0x548e5b[0x0][_0x691b('0x29')]/_0x3ee151);var _0xffc64a=Number[_0x691b('0x2e')](_0x548e5b[0x0][_0x691b('0x29')]/_0x3ee151)?_0x548e5b[0x0][_0x691b('0x29')]%_0x3ee151:0x0;_0x2a0d92['forEach'](function(_0x373779){if(_0x373779>0x0){_0x2f97fa+=_0x3ee151;}_0x318c65[_0x691b('0x17')](dbH[_0x691b('0x2f')][_0x691b('0x30')](util[_0x691b('0x1a')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3ee151,_0x2f97fa),{'type':dbH[_0x691b('0x2f')][_0x691b('0x31')][_0x691b('0x32')]}));});if(_0xffc64a>0x0){_0x2f97fa+=_0x3ee151;_0x318c65[_0x691b('0x17')](dbH[_0x691b('0x2f')][_0x691b('0x30')](util[_0x691b('0x1a')](_0x691b('0x33'),QUERY,_0xffc64a,_0x2f97fa),{'type':dbH[_0x691b('0x2f')][_0x691b('0x31')][_0x691b('0x32')]}));}}}else{_0x318c65['push'](dbH[_0x691b('0x2f')]['query'](QUERY,{'type':dbH['sequelize'][_0x691b('0x31')][_0x691b('0x32')]}));}var _0x258a87=path[_0x691b('0x34')](PATH);var _0x8a7c0f=path[_0x691b('0x35')](PATH,_0x691b('0x36'));var _0x3a4d11=_0x298943[_0x691b('0x37')]&&_0x318c65[_0x691b('0x16')]>0x1;var _0x1a5af8=[];if(!fs[_0x691b('0x38')](path['join'](_0x258a87,_0x8a7c0f))&&_0x3a4d11){fs[_0x691b('0x39')](path[_0x691b('0x3a')](_0x258a87,_0x8a7c0f));}return BPromise[_0x691b('0x3b')](_0x318c65,function(_0xa78662){_0x1a5af8[_0x691b('0x17')](_0xa78662);})[_0x691b('0x2d')](function(){var _0x2d4e06=[];for(var _0x1ae0bd=0x0;_0x1ae0bd<_0x1a5af8['length'];_0x1ae0bd+=0x1){var _0x167ed4=_0x1a5af8[_0x1ae0bd];var _0x1d8191=createTables(_['flatten'](_0x167ed4));var _0x37988f;var _0x164917=getPDFDocDefinition(_0x1d8191);var _0x1585b4=getPDFPrinter();var _0x5bb234=_0x1585b4[_0x691b('0x3c')](_0x164917);if(_0x3a4d11){_0x37988f=path[_0x691b('0x3a')](_0x258a87,_0x8a7c0f,util[_0x691b('0x1a')](_0x691b('0x3d'),_0x8a7c0f,_0x1ae0bd,_0x691b('0x3e')));}else{_0x37988f=path[_0x691b('0x3a')](_0x258a87,util[_0x691b('0x1a')](_0x691b('0x3f'),_0x8a7c0f,'pdf'));}_0x2d4e06[_0x691b('0x17')](writePDFDocument(_0x5bb234,_0x37988f));}return Promise[_0x691b('0x40')](_0x2d4e06);})['then'](function(){if(_0x3a4d11){return new Promise(function(_0xf759b9){zipdir(path[_0x691b('0x3a')](_0x258a87,_0x8a7c0f),{'saveTo':path[_0x691b('0x3a')](_0x258a87,util[_0x691b('0x1a')](_0x691b('0x3f'),_0x8a7c0f,_0x691b('0x41')))},function(){rimraf(path['join'](_0x258a87,_0x8a7c0f),function(){});_0xf759b9('zip\x20finished');});});}})['then'](function(){if(!_0x3a4d11)return;rimraf(path[_0x691b('0x3a')](_0x258a87,_0x8a7c0f),function(){});})[_0x691b('0x2d')](function(){logger[_0x691b('0x42')](util['format'](_0x691b('0x43'),EXTRACTED_REPORT_ID,_0x691b('0x44')));return analyticExtractedReport(_0x691b('0x45'),_0x3a4d11?util[_0x691b('0x1a')](_0x691b('0x3f'),_0x8a7c0f,_0x3a4d11?_0x691b('0x41'):_0x691b('0x3e')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x691b('0x42')](util[_0x691b('0x1a')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x691b('0x44')));return db['AnalyticExtractedReport'][_0x691b('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x691b('0x2d')](function(_0x44d01f){EXTRACTED_REPORT=_0x44d01f;return dbH['sequelize'][_0x691b('0x30')](util[_0x691b('0x1a')](_0x691b('0x47'),QUERY),{'type':dbH['sequelize'][_0x691b('0x31')][_0x691b('0x32')]});})[_0x691b('0x2d')](extractReport)[_0x691b('0x48')](function(_0x3cd925){logger[_0x691b('0x42')](util[_0x691b('0x1a')](_0x691b('0x49'),EXTRACTED_REPORT_ID,_0x691b('0x44')),util[_0x691b('0x4a')](_0x3cd925,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x691b('0x4b'));})['finally'](function(){process[_0x691b('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x46742d=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x691b('0x4d'),'italics':__dirname+_0x691b('0x4e'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x46742d;}function getPDFDocDefinitionFromHTML(_0x426384,_0x3dee82){var _0x1d06ce=util[_0x691b('0x1a')](_0x691b('0x4f'),_0x3dee82[_0x691b('0x50')],_0x3dee82['interactionId']);var _0x29ad45=moment()[_0x691b('0x1a')](_0x691b('0x51'))[_0x691b('0x15')]();var _0x54e9d7=htmlToPdfmake(_0x426384,{'window':window,'tableAutoSize':!![]});return{'content':[_0x54e9d7],'defaultStyle':{'font':_0x691b('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x691b('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x691b('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x691b('0x53'),'style':_0x691b('0x1f')}];},'footer':function(_0x3197e8,_0x5eb904){return[{'text':util[_0x691b('0x1a')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x1d06ce,_0x3197e8,_0x5eb904,_0x29ad45),'style':_0x691b('0x25')}];}};}function writePDFDocument(_0xc84a0a,_0x484f56){return new Promise(function(_0x4e14e6,_0xd6f76d){var _0x4e1af9=_0xc84a0a[_0x691b('0x54')](fs[_0x691b('0x55')](_0x484f56));_0x4e1af9['on'](_0x691b('0x56'),function(){_0x4e14e6(_0x691b('0x56'));});_0x4e1af9['on']('error',function(_0x1146ed){_0xd6f76d(_0x1146ed);});_0xc84a0a['end']();});}exports[_0x691b('0x57')]=function(_0x3d62b7,_0x2850c2){var _0x486801=getPDFPrinter();var _0x3b6ab7=getPDFDocDefinitionFromHTML(_0x3d62b7,_0x2850c2);var _0x8163db=_0x486801[_0x691b('0x3c')](_0x3b6ab7);return writePDFDocument(_0x8163db,_0x2850c2[_0x691b('0x2')])['catch'](function(_0x1c24b5){throw _0x1c24b5;});}; \ No newline at end of file +var _0x5e14=['zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','toString','value','fill','auto','body','push','concat','chunk','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','format','header','pageBreak','margin','landscape','\x20/\x20','footer','black','right','num','Setting','find','split','then','splitSizePdf','length','isInteger','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.pdf','existsSync','mkdirSync','join','each','createPdfKitDocument','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','end','path','catch','lodash','util','pdfmake/src/printer'];(function(_0x344e34,_0x27b9c8){var _0xdde948=function(_0x6b4afc){while(--_0x6b4afc){_0x344e34['push'](_0x344e34['shift']());}};_0xdde948(++_0x27b9c8);}(_0x5e14,0xb5));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x45e1('0x0'));var fs=require('fs');var util=require(_0x45e1('0x1'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x45e1('0x2'));var zipdir=require(_0x45e1('0x3'));var rimraf=require(_0x45e1('0x4'));var JSDOM=require(_0x45e1('0x5'))[_0x45e1('0x6')];var window=new JSDOM('')[_0x45e1('0x7')];var BPromise=require(_0x45e1('0x8'));var db=require(_0x45e1('0x9'))['db'];var dbH=require('../../mysqldb')[_0x45e1('0xa')];var logger=require('../../config/logger')(_0x45e1('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x45e1('0xc')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x45e1('0xc')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x45e1('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3f4e5a,_0x325232){var _0x3c289e={'status':_0x3f4e5a};var _0x53f539={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x325232){_0x3c289e[_0x45e1('0xe')]=_0x325232;}return db['AnalyticExtractedReport'][_0x45e1('0xf')](_0x3c289e,_0x53f539);}function getHeaders(_0x2cffab){return _[_0x45e1('0x10')](_0x2cffab,function(_0x5e35ab){return{'text':_0x5e35ab,'style':_0x45e1('0x11')};});}function getRows(_0x1af27c,_0x4e906f){return _[_0x45e1('0x10')](_0x4e906f,function(_0x2cf231){return _(_0x2cf231)['pick'](_0x1af27c)[_0x45e1('0x10')](function(_0x2ae5b9){return _0x2ae5b9?_[_0x45e1('0x12')](_0x2ae5b9):'';})[_0x45e1('0x13')]();});}function createTable(_0xe831f1,_0x312a09){var _0x1b2f84={'widths':_[_0x45e1('0x14')](Array(_0xe831f1['length']),0x91),'heights':function(_0xc19c24){return _0xc19c24===0x0?_0x45e1('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x37d55e=getHeaders(_0xe831f1);_0x1b2f84[_0x45e1('0x16')][_0x45e1('0x17')](_0x37d55e);var _0x5d07e6=getRows(_0xe831f1,_0x312a09);_0x1b2f84['body']=_0x1b2f84[_0x45e1('0x16')][_0x45e1('0x18')](_0x5d07e6);return _0x1b2f84;}function createTables(_0x198036){var _0x8eac6d=[];var _0x495b50=_[_0x45e1('0x19')](Object['keys'](_0x198036[0x0]),0x5);_0x495b50[_0x45e1('0x1a')](function(_0x4bfa19){_0x8eac6d[_0x45e1('0x17')](createTable(_0x4bfa19,_0x198036));});return _0x8eac6d;}function getPDFDocDefinition(_0x4d2b03){var _0x5ab24a=util['format'](_0x45e1('0x1b'),NAME,EXTRACTED_REPORT[_0x45e1('0x1c')],moment(EXTRACTED_REPORT['startDate'])[_0x45e1('0x1d')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x45e1('0x1d')](FORMAT));var _0x330702=[];for(var _0x4ab7fc=0x0;_0x4ab7fc<_0x4d2b03['length'];_0x4ab7fc++){var _0x1e3d4c=[];if(_0x4ab7fc===0x0){_0x1e3d4c[_0x45e1('0x17')]({'text':_0x5ab24a,'style':_0x45e1('0x1e')});}var _0xf54f3f={'table':_0x4d2b03[_0x4ab7fc]};if(_0x4ab7fc>0x0){_0xf54f3f[_0x45e1('0x1f')]='before';_0xf54f3f[_0x45e1('0x20')]=[0x0,0x46,0x0,0x0];}_0x1e3d4c[_0x45e1('0x17')](_0xf54f3f);_0x330702[_0x45e1('0x17')](_0x1e3d4c);}return{'pageSize':'A4','pageOrientation':_0x45e1('0x21'),'content':_0x330702,'footer':function(_0x578988,_0x470746){return{'text':_0x578988[_0x45e1('0x12')]()+_0x45e1('0x22')+_0x470746,'style':_0x45e1('0x23')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x45e1('0x24')},'footer':{'alignment':_0x45e1('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5b3316){var _0x2a660b=0x1388;var _0x4954bf;if(!_0x5b3316[0x0][_0x45e1('0x26')]){return analyticExtractedReport('Empty');}return db[_0x45e1('0x27')][_0x45e1('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x45e1('0x29'),'splitSizePdf']})[_0x45e1('0x2a')](function(_0x10bdf2){if(_0x10bdf2){_0x4954bf=_0x10bdf2;_0x2a660b=_0x4954bf[_0x45e1('0x2b')]||0x3e8;}})[_0x45e1('0x2a')](function(){var _0x5698f8=[];var _0x3bc23b=0x0;if(_0x4954bf[_0x45e1('0x29')]){if(_0x5b3316&&_0x5b3316[_0x45e1('0x2c')]){var _0x2eb851=_['range'](_0x5b3316[0x0]['num']/_0x2a660b);var _0x5e37c5=Number[_0x45e1('0x2d')](_0x5b3316[0x0]['num']/_0x2a660b)?_0x5b3316[0x0]['num']%_0x2a660b:0x0;_0x2eb851['forEach'](function(_0xc22bc9){if(_0xc22bc9>0x0){_0x3bc23b+=_0x2a660b;}_0x5698f8[_0x45e1('0x17')](dbH[_0x45e1('0x2e')][_0x45e1('0x2f')](util[_0x45e1('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2a660b,_0x3bc23b),{'type':dbH[_0x45e1('0x2e')][_0x45e1('0x30')][_0x45e1('0x31')]}));});if(_0x5e37c5>0x0){_0x3bc23b+=_0x2a660b;_0x5698f8[_0x45e1('0x17')](dbH[_0x45e1('0x2e')][_0x45e1('0x2f')](util[_0x45e1('0x1d')](_0x45e1('0x32'),QUERY,_0x5e37c5,_0x3bc23b),{'type':dbH[_0x45e1('0x2e')][_0x45e1('0x30')][_0x45e1('0x31')]}));}}}else{_0x5698f8['push'](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x45e1('0x2e')][_0x45e1('0x30')][_0x45e1('0x31')]}));}var _0x1f91ef=path['dirname'](PATH);var _0xfc8afa=path[_0x45e1('0x33')](PATH,_0x45e1('0x34'));var _0x3bb063=_0x4954bf[_0x45e1('0x29')]&&_0x5698f8[_0x45e1('0x2c')]>0x1;var _0x31ce40=[];if(!fs[_0x45e1('0x35')](path['join'](_0x1f91ef,_0xfc8afa))&&_0x3bb063){fs[_0x45e1('0x36')](path[_0x45e1('0x37')](_0x1f91ef,_0xfc8afa));}return BPromise[_0x45e1('0x38')](_0x5698f8,function(_0x41c901){_0x31ce40['push'](_0x41c901);})[_0x45e1('0x2a')](function(){var _0x4242ad=[];for(var _0x3926fa=0x0;_0x3926fa<_0x31ce40[_0x45e1('0x2c')];_0x3926fa+=0x1){var _0xdb9444=_0x31ce40[_0x3926fa];var _0x483d3f=createTables(_['flatten'](_0xdb9444));var _0x792143;var _0xbbcb48=getPDFDocDefinition(_0x483d3f);var _0x9d5be1=getPDFPrinter();var _0x13d630=_0x9d5be1[_0x45e1('0x39')](_0xbbcb48);if(_0x3bb063){_0x792143=path[_0x45e1('0x37')](_0x1f91ef,_0xfc8afa,util[_0x45e1('0x1d')]('%s%d.%s',_0xfc8afa,_0x3926fa,_0x45e1('0x3a')));}else{_0x792143=path['join'](_0x1f91ef,util[_0x45e1('0x1d')](_0x45e1('0x3b'),_0xfc8afa,_0x45e1('0x3a')));}_0x4242ad[_0x45e1('0x17')](writePDFDocument(_0x13d630,_0x792143));}return Promise[_0x45e1('0x3c')](_0x4242ad);})[_0x45e1('0x2a')](function(){if(_0x3bb063){return new Promise(function(_0x26140d){zipdir(path['join'](_0x1f91ef,_0xfc8afa),{'saveTo':path[_0x45e1('0x37')](_0x1f91ef,util['format'](_0x45e1('0x3b'),_0xfc8afa,_0x45e1('0x3d')))},function(){rimraf(path[_0x45e1('0x37')](_0x1f91ef,_0xfc8afa),function(){});_0x26140d(_0x45e1('0x3e'));});});}})[_0x45e1('0x2a')](function(){if(!_0x3bb063)return;rimraf(path[_0x45e1('0x37')](_0x1f91ef,_0xfc8afa),function(){});})[_0x45e1('0x2a')](function(){logger[_0x45e1('0x3f')](util['format'](_0x45e1('0x40'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x45e1('0x41'),_0x3bb063?util['format'](_0x45e1('0x3b'),_0xfc8afa,_0x3bb063?_0x45e1('0x3d'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x45e1('0x3f')](util[_0x45e1('0x1d')](_0x45e1('0x42'),EXTRACTED_REPORT_ID,_0x45e1('0x43')));return db[_0x45e1('0x44')][_0x45e1('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x9489e9){EXTRACTED_REPORT=_0x9489e9;return dbH[_0x45e1('0x2e')]['query'](util['format'](_0x45e1('0x46'),QUERY),{'type':dbH[_0x45e1('0x2e')][_0x45e1('0x30')][_0x45e1('0x31')]});})['then'](extractReport)['catch'](function(_0x5ac706){logger[_0x45e1('0x3f')](util[_0x45e1('0x1d')](_0x45e1('0x47'),EXTRACTED_REPORT_ID,_0x45e1('0x43')),util['inspect'](_0x5ac706,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x45e1('0x48'));})[_0x45e1('0x49')](function(){process[_0x45e1('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3999a8=new PdfPrinter({'Arial':{'normal':__dirname+_0x45e1('0x4b'),'bold':__dirname+_0x45e1('0x4c'),'italics':__dirname+_0x45e1('0x4d'),'bolditalics':__dirname+_0x45e1('0x4e')}});return _0x3999a8;}function getPDFDocDefinitionFromHTML(_0x243229,_0x1cd5f8){var _0x2f33c6=util[_0x45e1('0x1d')](_0x45e1('0x4f'),_0x1cd5f8[_0x45e1('0x50')],_0x1cd5f8[_0x45e1('0x51')]);var _0x1d3055=moment()[_0x45e1('0x1d')]('YYYY-MM-DD')[_0x45e1('0x12')]();var _0x406bb5=htmlToPdfmake(_0x243229,{'window':window,'tableAutoSize':!![]});return{'content':[_0x406bb5],'defaultStyle':{'font':_0x45e1('0x52')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x45e1('0x53'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x45e1('0x53')}},'header':function(){return[{'text':_0x45e1('0x54'),'style':_0x45e1('0x1e')}];},'footer':function(_0x4c48f7,_0x70201c){return[{'text':util[_0x45e1('0x1d')](_0x45e1('0x55'),_0x2f33c6,_0x4c48f7,_0x70201c,_0x1d3055),'style':_0x45e1('0x23')}];}};}function writePDFDocument(_0x51a00e,_0x28b9f9){return new Promise(function(_0x52bd71,_0x379107){var _0x142ca3=_0x51a00e['pipe'](fs[_0x45e1('0x56')](_0x28b9f9));_0x142ca3['on'](_0x45e1('0x57'),function(){_0x52bd71(_0x45e1('0x57'));});_0x142ca3['on'](_0x45e1('0x58'),function(_0x58a472){_0x379107(_0x58a472);});_0x51a00e[_0x45e1('0x59')]();});}exports['createPdfFromHTML']=function(_0xb5157e,_0x47f278){var _0x473eb6=getPDFPrinter();var _0x37c9bd=getPDFDocDefinitionFromHTML(_0xb5157e,_0x47f278);var _0x52289d=_0x473eb6[_0x45e1('0x39')](_0x37c9bd);return writePDFDocument(_0x52289d,_0x47f278[_0x45e1('0x5a')])[_0x45e1('0x5b')](function(_0x73206){throw _0x73206;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 2a8ab1f..40181fd 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 _0x149c=['Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','then','splitSizeXlsx','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','range','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','length','existsSync','join','mkdirSync','%s.%s','xlsx','writeFileSync','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Failed','finally','exit','util','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update'];(function(_0x4146b9,_0x487702){var _0x2e8b68=function(_0x435b90){while(--_0x435b90){_0x4146b9['push'](_0x4146b9['shift']());}};_0x2e8b68(++_0x487702);}(_0x149c,0x1de));var _0xc149=function(_0x10dc0e,_0x458bde){_0x10dc0e=_0x10dc0e-0x0;var _0xe4a300=_0x149c[_0x10dc0e];return _0xe4a300;};'use strict';var util=require(_0xc149('0x0'));var path=require(_0xc149('0x1'));var _=require(_0xc149('0x2'));var fs=require('fs');var json2xls=require(_0xc149('0x3'));var BPromise=require('bluebird');var zipdir=require(_0xc149('0x4'));var rimraf=require(_0xc149('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xc149('0x6'))[_0xc149('0x7')];var logger=require(_0xc149('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xc149('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x185653,_0x3a9cc7){var _0x218882={'status':_0x185653};var _0x1fae68={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3a9cc7){_0x218882['savename']=_0x3a9cc7;}return db[_0xc149('0xa')][_0xc149('0xb')](_0x218882,_0x1fae68);}function main(){var _0x48b4bc=0x1388;var _0x1ffc74;logger['info'](util['format'](_0xc149('0xc'),EXTRACTED_REPORT_ID,_0xc149('0xd')));return db[_0xc149('0xe')][_0xc149('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})[_0xc149('0x10')](function(_0x460817){if(_0x460817){_0x1ffc74=_0x460817;_0x48b4bc=_0x1ffc74[_0xc149('0x11')]||0x1388;}})[_0xc149('0x10')](function(){return dbH[_0xc149('0x12')][_0xc149('0x13')](util[_0xc149('0x14')](_0xc149('0x15'),QUERY),{'type':dbH[_0xc149('0x12')][_0xc149('0x16')][_0xc149('0x17')]});})['then'](function(_0x122178){if(!_0x122178[0x0]['num']){return analyticExtractedReport(_0xc149('0x18'));}var _0x452d8f=[];var _0x59d6a7=0x0;if(_0x1ffc74['split']){if(_0x122178&&_0x122178['length']){var _0x30fb7a=_[_0xc149('0x19')](_0x122178[0x0][_0xc149('0x1a')]/_0x48b4bc);var _0x3e1e22=Number['isInteger'](_0x122178[0x0][_0xc149('0x1a')]/_0x48b4bc)?_0x122178[0x0][_0xc149('0x1a')]%_0x48b4bc:0x0;_0x30fb7a[_0xc149('0x1b')](function(_0x1a89af){if(_0x1a89af>0x0){_0x59d6a7+=_0x48b4bc;}_0x452d8f[_0xc149('0x1c')](dbH[_0xc149('0x12')][_0xc149('0x13')](util['format'](_0xc149('0x1d'),QUERY,_0x48b4bc,_0x59d6a7),{'type':dbH[_0xc149('0x12')][_0xc149('0x16')][_0xc149('0x17')]}));});if(_0x3e1e22>0x0){_0x59d6a7+=_0x48b4bc;_0x452d8f[_0xc149('0x1c')](dbH[_0xc149('0x12')][_0xc149('0x13')](util[_0xc149('0x14')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3e1e22,_0x59d6a7),{'type':dbH['sequelize'][_0xc149('0x16')][_0xc149('0x17')]}));}}}else{_0x452d8f[_0xc149('0x1c')](dbH[_0xc149('0x12')][_0xc149('0x13')](QUERY,{'type':dbH[_0xc149('0x12')][_0xc149('0x16')]['SELECT']}));}var _0x3e88db=path[_0xc149('0x1e')](PATH);var _0x329b1e=path[_0xc149('0x1f')](PATH,_0xc149('0x20'));var _0x487cca=_0x1ffc74['split']&&_0x452d8f[_0xc149('0x21')]>0x1;var _0x457e10=[];if(!fs[_0xc149('0x22')](path[_0xc149('0x23')](_0x3e88db,_0x329b1e))&&_0x487cca){fs[_0xc149('0x24')](path[_0xc149('0x23')](_0x3e88db,_0x329b1e));}return BPromise['each'](_0x452d8f,function(_0x5e454a){_0x457e10['push'](_0x5e454a);})[_0xc149('0x10')](function(){for(var _0x2524d8=0x0;_0x2524d8<_0x457e10[_0xc149('0x21')];_0x2524d8+=0x1){var _0x5928f6;var _0x2a9476=_0x457e10[_0x2524d8];if(_0x487cca){_0x5928f6=path[_0xc149('0x23')](_0x3e88db,_0x329b1e,util['format']('%s%d.%s',_0x329b1e,_0x2524d8,'xlsx'));}else{_0x5928f6=path['join'](_0x3e88db,util['format'](_0xc149('0x25'),_0x329b1e,_0xc149('0x26')));}fs[_0xc149('0x27')](_0x5928f6,json2xls(_0x2a9476),'binary');}})[_0xc149('0x10')](function(){if(_0x487cca){return new Promise(function(_0x37ad4b){zipdir(path[_0xc149('0x23')](_0x3e88db,_0x329b1e),{'saveTo':path['join'](_0x3e88db,util[_0xc149('0x14')]('%s.%s',_0x329b1e,_0xc149('0x28')))},function(_0x447038,_0x34d5cc){rimraf(path[_0xc149('0x23')](_0x3e88db,_0x329b1e),function(){});_0x37ad4b(_0xc149('0x29'));});});}})['then'](function(){logger[_0xc149('0x2a')](util[_0xc149('0x14')](_0xc149('0x2b'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xc149('0x2c'),_0x487cca?util[_0xc149('0x14')](_0xc149('0x25'),_0x329b1e,_0x487cca?_0xc149('0x28'):_0xc149('0x26')):null);});})[_0xc149('0x2d')](function(_0x2e4e5e){logger[_0xc149('0x2a')](util[_0xc149('0x14')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x2e4e5e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc149('0x2e'));})[_0xc149('0x2f')](function(){process[_0xc149('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x674a=['each','%s%d.%s','xlsx','%s.%s','binary','info','Completed','Failed','exit','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','update','XLSX','Setting','find','then','splitSizeXlsx','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','split','length','range','num','isInteger','push','query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','join','mkdirSync'];(function(_0x35ad84,_0x2a0067){var _0x50ea13=function(_0xc5dc88){while(--_0xc5dc88){_0x35ad84['push'](_0x35ad84['shift']());}};_0x50ea13(++_0x2a0067);}(_0x674a,0x111));var _0xa674=function(_0x2e740d,_0x531abe){_0x2e740d=_0x2e740d-0x0;var _0x2295e4=_0x674a[_0x2e740d];return _0x2295e4;};'use strict';var util=require(_0xa674('0x0'));var path=require('path');var _=require(_0xa674('0x1'));var fs=require('fs');var json2xls=require(_0xa674('0x2'));var BPromise=require(_0xa674('0x3'));var zipdir=require(_0xa674('0x4'));var rimraf=require(_0xa674('0x5'));var db=require(_0xa674('0x6'))['db'];var dbH=require(_0xa674('0x6'))['dbH'];var logger=require('../../config/logger')(_0xa674('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xa674('0x8')][0x3];var PATH=process[_0xa674('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x52a5c0,_0x318d05){var _0x5658ea={'status':_0x52a5c0};var _0x3fe5f1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x318d05){_0x5658ea[_0xa674('0x9')]=_0x318d05;}return db[_0xa674('0xa')][_0xa674('0xb')](_0x5658ea,_0x3fe5f1);}function main(){var _0x4a33c8=0x1388;var _0x37b0c3;logger['info'](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa674('0xc')));return db[_0xa674('0xd')][_0xa674('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})[_0xa674('0xf')](function(_0x4a0833){if(_0x4a0833){_0x37b0c3=_0x4a0833;_0x4a33c8=_0x37b0c3[_0xa674('0x10')]||0x1388;}})[_0xa674('0xf')](function(){return dbH[_0xa674('0x11')]['query'](util['format'](_0xa674('0x12'),QUERY),{'type':dbH['sequelize'][_0xa674('0x13')][_0xa674('0x14')]});})[_0xa674('0xf')](function(_0x285723){if(!_0x285723[0x0]['num']){return analyticExtractedReport('Empty');}var _0x31ce02=[];var _0x11dfc0=0x0;if(_0x37b0c3[_0xa674('0x15')]){if(_0x285723&&_0x285723[_0xa674('0x16')]){var _0x33a679=_[_0xa674('0x17')](_0x285723[0x0][_0xa674('0x18')]/_0x4a33c8);var _0x53e243=Number[_0xa674('0x19')](_0x285723[0x0]['num']/_0x4a33c8)?_0x285723[0x0][_0xa674('0x18')]%_0x4a33c8:0x0;_0x33a679['forEach'](function(_0x1eb468){if(_0x1eb468>0x0){_0x11dfc0+=_0x4a33c8;}_0x31ce02[_0xa674('0x1a')](dbH[_0xa674('0x11')][_0xa674('0x1b')](util[_0xa674('0x1c')](_0xa674('0x1d'),QUERY,_0x4a33c8,_0x11dfc0),{'type':dbH[_0xa674('0x11')]['QueryTypes'][_0xa674('0x14')]}));});if(_0x53e243>0x0){_0x11dfc0+=_0x4a33c8;_0x31ce02[_0xa674('0x1a')](dbH[_0xa674('0x11')]['query'](util[_0xa674('0x1c')](_0xa674('0x1d'),QUERY,_0x53e243,_0x11dfc0),{'type':dbH[_0xa674('0x11')][_0xa674('0x13')][_0xa674('0x14')]}));}}}else{_0x31ce02['push'](dbH[_0xa674('0x11')][_0xa674('0x1b')](QUERY,{'type':dbH[_0xa674('0x11')]['QueryTypes'][_0xa674('0x14')]}));}var _0x12c486=path[_0xa674('0x1e')](PATH);var _0x241eee=path[_0xa674('0x1f')](PATH,_0xa674('0x20'));var _0x407c23=_0x37b0c3[_0xa674('0x15')]&&_0x31ce02[_0xa674('0x16')]>0x1;var _0x4b18d8=[];if(!fs['existsSync'](path[_0xa674('0x21')](_0x12c486,_0x241eee))&&_0x407c23){fs[_0xa674('0x22')](path[_0xa674('0x21')](_0x12c486,_0x241eee));}return BPromise[_0xa674('0x23')](_0x31ce02,function(_0xdbdcaa){_0x4b18d8['push'](_0xdbdcaa);})[_0xa674('0xf')](function(){for(var _0x4d6762=0x0;_0x4d6762<_0x4b18d8[_0xa674('0x16')];_0x4d6762+=0x1){var _0x4281c8;var _0x5f5f1=_0x4b18d8[_0x4d6762];if(_0x407c23){_0x4281c8=path[_0xa674('0x21')](_0x12c486,_0x241eee,util[_0xa674('0x1c')](_0xa674('0x24'),_0x241eee,_0x4d6762,_0xa674('0x25')));}else{_0x4281c8=path[_0xa674('0x21')](_0x12c486,util['format'](_0xa674('0x26'),_0x241eee,'xlsx'));}fs['writeFileSync'](_0x4281c8,json2xls(_0x5f5f1),_0xa674('0x27'));}})[_0xa674('0xf')](function(){if(_0x407c23){return new Promise(function(_0x223638){zipdir(path[_0xa674('0x21')](_0x12c486,_0x241eee),{'saveTo':path['join'](_0x12c486,util['format']('%s.%s',_0x241eee,'zip'))},function(_0x439e14,_0x271cc1){rimraf(path['join'](_0x12c486,_0x241eee),function(){});_0x223638('zip\x20finished');});});}})[_0xa674('0xf')](function(){logger[_0xa674('0x28')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xa674('0xc')));return analyticExtractedReport(_0xa674('0x29'),_0x407c23?util[_0xa674('0x1c')](_0xa674('0x26'),_0x241eee,_0x407c23?'zip':'xlsx'):null);});})['catch'](function(_0x253c8a){logger[_0xa674('0x28')](util[_0xa674('0x1c')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa674('0xc')),util['inspect'](_0x253c8a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa674('0x2a'));})['finally'](function(){process[_0xa674('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 7790ca0..209cc92 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 _0x8880=['IntervalId','VoiceExtension','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','priority','extensions','extension','find','push','type','format','CDR(type)=%s','inbound','Set','VoiceExtensionId','context','CDR(destination)=','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','*,*,*,*','interval','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','models','findAll','then','intervals'];(function(_0x452550,_0x554f3e){var _0xeac0d3=function(_0x763c97){while(--_0x763c97){_0x452550['push'](_0x452550['shift']());}};_0xeac0d3(++_0x554f3e);}(_0x8880,0x100));var _0x0888=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0x8880[_0x71e493];return _0x3d40ab;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x152f3f,_0x468c90){var _0x4e7202=this;return _0x152f3f[_0x0888('0x0')]['Interval'][_0x0888('0x1')]({'raw':!![]})[_0x0888('0x2')](function(_0x76fc8f){_0x4e7202[_0x0888('0x3')]=_0x76fc8f;return _0x152f3f['models']['VoiceExtension']['findAll']({'where':{'IntervalId':_0x468c90[_0x0888('0x4')]},'raw':!![]});})[_0x0888('0x2')](function(_0x246f85){return _0x152f3f[_0x0888('0x0')][_0x0888('0x5')][_0x0888('0x1')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x246f85,_0x0888('0x6')))}},'order':[{'raw':_0x0888('0x7')}],'raw':!![]});})[_0x0888('0x2')](function(_0x2fa5e0){var _0x53c6d2=_['filter'](_0x2fa5e0,{'priority':'1'});var _0x191974=_[_0x0888('0x8')](_0x2fa5e0,{'isApp':0x1});var _0x41c9ec=_['groupBy'](_0x191974,_0x0888('0x6'));var _0x7a7084=[_0x0888('0x9'),'playback'];var _0x539aaa=[];var _0x39c76b=[];for(var _0x5591ea in _0x41c9ec){if(_0x41c9ec['hasOwnProperty'](_0x5591ea)){_0x4e7202[_0x0888('0xa')]=0x2;_0x4e7202[_0x0888('0xb')]=[];_0x4e7202[_0x0888('0xc')]=_[_0x0888('0xd')](_0x53c6d2,{'exten':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x6')]});_0x4e7202['extensions'][_0x0888('0xe')]({'type':_0x41c9ec[_0x5591ea][0x0][_0x0888('0xf')],'app':'Set','appdata':util[_0x0888('0x10')](_0x0888('0x11'),_0x41c9ec[_0x5591ea][0x0][_0x0888('0xf')]),'context':_0x41c9ec[_0x5591ea][0x0]['context'],'exten':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x6')],'priority':_0x4e7202['priority']++,'VoiceExtensionId':_0x41c9ec[_0x5591ea][0x0]['VoiceExtensionId']});if(_0x41c9ec[_0x5591ea][0x0][_0x0888('0xf')]===_0x0888('0x12')){_0x4e7202[_0x0888('0xb')][_0x0888('0xe')]({'type':_0x41c9ec[_0x5591ea][0x0][_0x0888('0xf')],'app':_0x0888('0x13'),'appdata':'CDR(routeid)='+_0x41c9ec[_0x5591ea][0x0][_0x0888('0x14')],'context':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x15')],'exten':_0x41c9ec[_0x5591ea][0x0]['exten'],'priority':_0x4e7202['priority']++,'VoiceExtensionId':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x14')]});}else if(_0x41c9ec[_0x5591ea][0x0][_0x0888('0xf')]==='outbound'){if(_0x4e7202['extension']){_0x4e7202[_0x0888('0xb')][_0x0888('0xe')]({'type':_0x41c9ec[_0x5591ea][0x0]['type'],'app':_0x0888('0x13'),'appdata':_0x0888('0x16')+(_0x4e7202[_0x0888('0xc')][_0x0888('0x17')]?_0x0888('0x18')+_0x4e7202[_0x0888('0xc')][_0x0888('0x17')]+'}':'${EXTEN}'),'context':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x15')],'exten':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x6')],'priority':_0x4e7202[_0x0888('0xa')]++,'VoiceExtensionId':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x14')]});}_0x4e7202[_0x0888('0xb')][_0x0888('0xe')]({'type':_0x41c9ec[_0x5591ea][0x0][_0x0888('0xf')],'app':_0x0888('0x13'),'appdata':_0x0888('0x19')+_0x41c9ec[_0x5591ea][0x0]['VoiceExtensionId'],'context':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x15')],'exten':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x6')],'priority':_0x4e7202[_0x0888('0xa')]++,'VoiceExtensionId':_0x41c9ec[_0x5591ea][0x0]['VoiceExtensionId']});var _0x56c697=_0x4e7202[_0x0888('0xa')]++;_0x4e7202[_0x0888('0xb')][_0x0888('0xe')]({'type':_0x41c9ec[_0x5591ea][0x0][_0x0888('0xf')],'app':_0x0888('0x1a'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x56c697+0x2)+_0x0888('0x1b')+(_0x56c697+0x1)+')','context':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x15')],'exten':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x6')],'priority':_0x56c697,'VoiceExtensionId':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x14')]});if(_0x4e7202[_0x0888('0xc')]){_0x4e7202['extensions'][_0x0888('0xe')]({'type':_0x41c9ec[_0x5591ea][0x0][_0x0888('0xf')],'app':_0x0888('0x13'),'appdata':_0x4e7202[_0x0888('0xc')]['cutdigits']?_0x0888('0x1c')+_0x4e7202[_0x0888('0xc')][_0x0888('0x17')]+'}':_0x0888('0x1d'),'context':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x15')],'exten':_0x41c9ec[_0x5591ea][0x0]['exten'],'priority':_0x4e7202[_0x0888('0xa')]++,'VoiceExtensionId':_0x41c9ec[_0x5591ea][0x0]['VoiceExtensionId']});}_0x4e7202[_0x0888('0xb')][_0x0888('0xe')]({'type':_0x41c9ec[_0x5591ea][0x0]['type'],'app':_0x0888('0x13'),'appdata':_0x0888('0x1e')+_0x41c9ec[_0x5591ea][0x0][_0x0888('0x14')],'context':_0x41c9ec[_0x5591ea][0x0]['context'],'exten':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x6')],'priority':_0x4e7202[_0x0888('0xa')]++,'VoiceExtensionId':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x14')]});if(_0x4e7202[_0x0888('0xc')]&&_0x4e7202['extension'][_0x0888('0x1f')](_0x0888('0x20'))&&_0x4e7202['extension']['recordingFormat']!=='none'){_0x4e7202[_0x0888('0xb')][_0x0888('0xe')]({'type':_0x41c9ec[_0x5591ea][0x0][_0x0888('0xf')],'app':'Set','appdata':_0x0888('0x21'),'context':_0x41c9ec[_0x5591ea][0x0]['context'],'exten':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x6')],'priority':_0x4e7202[_0x0888('0xa')]++,'VoiceExtensionId':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x14')]});_0x4e7202[_0x0888('0xb')][_0x0888('0xe')]({'type':_0x41c9ec[_0x5591ea][0x0][_0x0888('0xf')],'app':_0x0888('0x13'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x4e7202[_0x0888('0xc')][_0x0888('0x20')]||_0x0888('0x22'),'context':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x15')],'exten':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x6')],'priority':_0x4e7202[_0x0888('0xa')]++,'VoiceExtensionId':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x14')]});}}_0x4e7202['extensions'][_0x0888('0xe')]({'type':_0x41c9ec[_0x5591ea][0x0]['type'],'app':_0x0888('0x13'),'appdata':_0x0888('0x23'),'context':_0x41c9ec[_0x5591ea][0x0]['context'],'exten':_0x41c9ec[_0x5591ea][0x0]['exten'],'priority':_0x4e7202[_0x0888('0xa')]++,'VoiceExtensionId':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x14')]});_0x4e7202[_0x0888('0xb')][_0x0888('0xe')]({'type':_0x41c9ec[_0x5591ea][0x0][_0x0888('0xf')],'app':_0x0888('0x13'),'appdata':_0x0888('0x24'),'context':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x15')],'exten':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x6')],'priority':_0x4e7202['priority']++,'VoiceExtensionId':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x14')]});_0x4e7202[_0x0888('0xb')][_0x0888('0xe')]({'type':_0x41c9ec[_0x5591ea][0x0][_0x0888('0xf')],'app':_0x0888('0x13'),'appdata':'MONITOR_OPTIONS=ab','context':_0x41c9ec[_0x5591ea][0x0]['context'],'exten':_0x41c9ec[_0x5591ea][0x0]['exten'],'priority':_0x4e7202[_0x0888('0xa')]++,'VoiceExtensionId':_0x41c9ec[_0x5591ea][0x0]['VoiceExtensionId']});for(var _0x135684=0x0,_0x221161=0x0;_0x135684<_0x41c9ec[_0x5591ea][_0x0888('0x25')];_0x135684+=0x1,_0x221161=0x0){var _0xce63fd=_0x41c9ec[_0x5591ea][_0x135684];if(_0xce63fd[_0x0888('0xf')]){_0xce63fd[_0x0888('0xf')]=_0xce63fd[_0x0888('0xf')][_0x0888('0x26')]();}var _0x5a3d62=[];var _0x294177=[];delete _0xce63fd['id'];delete _0xce63fd['createdAt'];delete _0xce63fd['updatedAt'];var _0x179fc9=_0xce63fd['interval']!==_0x0888('0x27')?[_0xce63fd[_0x0888('0x28')]]:_0xce63fd[_0x0888('0x4')]?_['map'](_[_0x0888('0x8')](_0x4e7202[_0x0888('0x3')],{'IntervalId':_0xce63fd['IntervalId']}),_0x0888('0x28')):[];if(_0xce63fd['hasOwnProperty'](_0x0888('0x29'))){if(_0xce63fd[_0x0888('0x29')]&&_0xce63fd[_0x0888('0x29')]!=='--'){_0x5a3d62[_0x0888('0xe')]({'type':_0xce63fd[_0x0888('0xf')],'app':_0x0888('0x13'),'appdata':_0x0888('0x2a')+_0xce63fd[_0x0888('0x29')],'context':_0xce63fd[_0x0888('0x15')],'exten':_0xce63fd[_0x0888('0x6')],'priority':_0x179fc9[_0x0888('0x25')]+_0x4e7202['priority']+_0x221161++,'VoiceExtensionId':_0xce63fd['VoiceExtensionId']});}}if(_0xce63fd[_0x0888('0xf')]===_0x0888('0x2b')&&_0xce63fd['hasOwnProperty'](_0x0888('0x2c'))){if(_0xce63fd[_0x0888('0x2c')]){_0x5a3d62['push']({'type':_0xce63fd['type'],'app':_0x0888('0x1a'),'appdata':_0x0888('0x2d')+_0xce63fd[_0x0888('0x2c')]+')','context':_0xce63fd[_0x0888('0x15')],'exten':_0xce63fd[_0x0888('0x6')],'priority':_0x179fc9[_0x0888('0x25')]+_0x4e7202[_0x0888('0xa')]+_0x221161++,'VoiceExtensionId':_0xce63fd['VoiceExtensionId']});}else{_0x5a3d62[_0x0888('0xe')]({'type':_0xce63fd['type'],'app':_0x0888('0x1a'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0xce63fd['context'],'exten':_0xce63fd[_0x0888('0x6')],'priority':_0x179fc9[_0x0888('0x25')]+_0x4e7202[_0x0888('0xa')]+_0x221161++,'VoiceExtensionId':_0xce63fd['VoiceExtensionId']});}}if(_0xce63fd[_0x0888('0x1f')](_0x0888('0x2e'))){if(_0x7a7084[_0x0888('0x2f')](_0xce63fd[_0x0888('0x30')]['toLowerCase']())>=0x0&&_0xce63fd[_0x0888('0x31')]!==_0x0888('0x32')){if(_0xce63fd[_0x0888('0x2e')]){_0x5a3d62[_0x0888('0xe')]({'type':_0xce63fd[_0x0888('0xf')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0xce63fd['context'],'exten':_0xce63fd[_0x0888('0x6')],'priority':_0x179fc9['length']+_0x4e7202[_0x0888('0xa')]+_0x221161++,'VoiceExtensionId':_0xce63fd[_0x0888('0x14')]});_0x5a3d62['push']({'type':_0xce63fd[_0x0888('0xf')],'app':'Set','appdata':_0x0888('0x33'),'context':_0xce63fd[_0x0888('0x15')],'exten':_0xce63fd['exten'],'priority':_0x179fc9[_0x0888('0x25')]+_0x4e7202[_0x0888('0xa')]+_0x221161++,'VoiceExtensionId':_0xce63fd[_0x0888('0x14')]});}else{_0x5a3d62[_0x0888('0xe')]({'type':_0xce63fd[_0x0888('0xf')],'app':_0x0888('0x1a'),'appdata':_0x0888('0x34'),'context':_0xce63fd[_0x0888('0x15')],'exten':_0xce63fd[_0x0888('0x6')],'priority':_0x179fc9[_0x0888('0x25')]+_0x4e7202[_0x0888('0xa')]+_0x221161++,'VoiceExtensionId':_0xce63fd[_0x0888('0x14')]});_0x5a3d62[_0x0888('0xe')]({'type':_0xce63fd[_0x0888('0xf')],'app':_0x0888('0x13'),'appdata':_0x0888('0x35'),'context':_0xce63fd[_0x0888('0x15')],'exten':_0xce63fd[_0x0888('0x6')],'priority':_0x179fc9['length']+_0x4e7202[_0x0888('0xa')]+_0x221161++,'VoiceExtensionId':_0xce63fd[_0x0888('0x14')]});}}}for(var _0x17027c=0x0;_0x17027c<_0x179fc9[_0x0888('0x25')];_0x17027c+=0x1){var _0x59a473=_0x4e7202[_0x0888('0xa')]+_0x179fc9[_0x0888('0x25')];var _0x500745=_0x17027c===_0x179fc9[_0x0888('0x25')]-0x1?_0x4e7202[_0x0888('0xa')]+_0x5a3d62[_0x0888('0x25')]+_0x294177[_0x0888('0x25')]+0x2:_0x4e7202[_0x0888('0xa')]+_0x17027c+0x1;_0x5a3d62[_0x0888('0x36')](_0x17027c,0x0,{'type':_0xce63fd[_0x0888('0xf')],'app':_0x0888('0x37'),'appdata':_0x179fc9[_0x17027c]+'?'+_0xce63fd[_0x0888('0x15')]+_0x0888('0x38')+_0x59a473+':'+_0xce63fd[_0x0888('0x15')]+_0x0888('0x38')+_0x500745,'exten':_0xce63fd[_0x0888('0x6')],'context':_0xce63fd[_0x0888('0x15')],'priority':_0x4e7202[_0x0888('0xa')]+_0x17027c,'VoiceExtensionId':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x14')]});}_0xce63fd[_0x0888('0xa')]=_0x5a3d62['length']?_['last'](_0x5a3d62)[_0x0888('0xa')]+0x1:_0x4e7202[_0x0888('0xa')];_0x4e7202[_0x0888('0xa')]=(_0x294177[_0x0888('0x25')]?_['last'](_0x294177)[_0x0888('0xa')]:_0xce63fd[_0x0888('0xa')])+0x1;_0x4e7202['extensions']=_[_0x0888('0x39')](_0x4e7202[_0x0888('0xb')],_0x5a3d62,[_0xce63fd],_0x294177);}_0x4e7202[_0x0888('0xb')][_0x0888('0xe')]({'type':_0x41c9ec[_0x5591ea][0x0]['type'],'app':_0x0888('0x3a'),'exten':_0x41c9ec[_0x5591ea][0x0]['exten'],'context':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x15')],'priority':_0x4e7202[_0x0888('0xa')],'VoiceExtensionId':_0x41c9ec[_0x5591ea][0x0][_0x0888('0x14')]});_0x539aaa[_0x0888('0xe')](_0x41c9ec[_0x5591ea][0x0][_0x0888('0x14')]);_0x39c76b=_[_0x0888('0x39')](_0x39c76b,_0x4e7202[_0x0888('0xb')]);}}return _0x152f3f[_0x0888('0x3b')](function(_0x2e3dca){return _0x152f3f[_0x0888('0x0')][_0x0888('0x5')][_0x0888('0x3c')]({'where':{'VoiceExtensionId':{'$in':_0x539aaa}},'transaction':_0x2e3dca})[_0x0888('0x2')](function(_0x5251df){return _0x152f3f[_0x0888('0x0')][_0x0888('0x5')][_0x0888('0x3d')](_[_0x0888('0x3e')](_0x39c76b,_0x0888('0xa')),{'transaction':_0x2e3dca});});});})[_0x0888('0x3f')](function(_0x42c9b6){console[_0x0888('0x40')](_0x42c9b6);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0xcc59=['VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-PROGRESS=0','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','length','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','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','lodash','util','Interval','then','intervals','findAll','models','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','hasOwnProperty','extensions','extension','push','Set','format','CDR(type)=%s','type','context','priority'];(function(_0x3e2b0f,_0x3bfb86){var _0x1bc6fb=function(_0x15d460){while(--_0x15d460){_0x3e2b0f['push'](_0x3e2b0f['shift']());}};_0x1bc6fb(++_0x3bfb86);}(_0xcc59,0x100));var _0x9cc5=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0xcc59[_0x2bc3f4];return _0x14ac53;};'use strict';var _=require(_0x9cc5('0x0'));var util=require(_0x9cc5('0x1'));function rewrite(_0x2effc1,_0x5acd4d){var _0x97e182=this;return _0x2effc1['models'][_0x9cc5('0x2')]['findAll']({'raw':!![]})[_0x9cc5('0x3')](function(_0x112f52){_0x97e182[_0x9cc5('0x4')]=_0x112f52;return _0x2effc1['models']['VoiceExtension'][_0x9cc5('0x5')]({'where':{'IntervalId':_0x5acd4d['IntervalId']},'raw':!![]});})[_0x9cc5('0x3')](function(_0x4f8b04){return _0x2effc1[_0x9cc5('0x6')][_0x9cc5('0x7')][_0x9cc5('0x5')]({'where':{'exten':{'$in':_[_0x9cc5('0x8')](_[_0x9cc5('0x9')](_0x4f8b04,_0x9cc5('0xa')))}},'order':[{'raw':_0x9cc5('0xb')}],'raw':!![]});})[_0x9cc5('0x3')](function(_0x27300f){var _0x476aa9=_[_0x9cc5('0xc')](_0x27300f,{'priority':'1'});var _0x419c1a=_[_0x9cc5('0xc')](_0x27300f,{'isApp':0x1});var _0xf4ae2e=_[_0x9cc5('0xd')](_0x419c1a,_0x9cc5('0xa'));var _0x1fe546=['queue','playback'];var _0x1cf362=[];var _0x208418=[];for(var _0x1d2beb in _0xf4ae2e){if(_0xf4ae2e[_0x9cc5('0xe')](_0x1d2beb)){_0x97e182['priority']=0x2;_0x97e182[_0x9cc5('0xf')]=[];_0x97e182[_0x9cc5('0x10')]=_['find'](_0x476aa9,{'exten':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0xa')]});_0x97e182[_0x9cc5('0xf')][_0x9cc5('0x11')]({'type':_0xf4ae2e[_0x1d2beb][0x0]['type'],'app':_0x9cc5('0x12'),'appdata':util[_0x9cc5('0x13')](_0x9cc5('0x14'),_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')]),'context':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x16')],'exten':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0xa')],'priority':_0x97e182[_0x9cc5('0x17')]++,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')]});if(_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')]===_0x9cc5('0x19')){_0x97e182[_0x9cc5('0xf')]['push']({'type':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')],'app':_0x9cc5('0x12'),'appdata':_0x9cc5('0x1a')+_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')],'context':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x16')],'exten':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0xa')],'priority':_0x97e182[_0x9cc5('0x17')]++,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')]});}else if(_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')]===_0x9cc5('0x1b')){if(_0x97e182['extension']){_0x97e182[_0x9cc5('0xf')][_0x9cc5('0x11')]({'type':_0xf4ae2e[_0x1d2beb][0x0]['type'],'app':_0x9cc5('0x12'),'appdata':_0x9cc5('0x1c')+(_0x97e182['extension']['cutdigits']?'${EXTEN:'+_0x97e182[_0x9cc5('0x10')][_0x9cc5('0x1d')]+'}':_0x9cc5('0x1e')),'context':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x16')],'exten':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0xa')],'priority':_0x97e182['priority']++,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')]});}_0x97e182[_0x9cc5('0xf')][_0x9cc5('0x11')]({'type':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')],'app':_0x9cc5('0x12'),'appdata':_0x9cc5('0x1a')+_0xf4ae2e[_0x1d2beb][0x0]['VoiceExtensionId'],'context':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x16')],'exten':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0xa')],'priority':_0x97e182['priority']++,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')]});var _0x598d75=_0x97e182['priority']++;_0x97e182[_0x9cc5('0xf')][_0x9cc5('0x11')]({'type':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')],'app':_0x9cc5('0x1f'),'appdata':_0x9cc5('0x20')+(_0x598d75+0x2)+_0x9cc5('0x21')+(_0x598d75+0x1)+')','context':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x16')],'exten':_0xf4ae2e[_0x1d2beb][0x0]['exten'],'priority':_0x598d75,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0]['VoiceExtensionId']});if(_0x97e182[_0x9cc5('0x10')]){_0x97e182[_0x9cc5('0xf')][_0x9cc5('0x11')]({'type':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')],'app':_0x9cc5('0x12'),'appdata':_0x97e182['extension'][_0x9cc5('0x1d')]?_0x9cc5('0x22')+_0x97e182['extension']['cutdigits']+'}':_0x9cc5('0x23'),'context':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x16')],'exten':_0xf4ae2e[_0x1d2beb][0x0]['exten'],'priority':_0x97e182[_0x9cc5('0x17')]++,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0]['VoiceExtensionId']});}_0x97e182[_0x9cc5('0xf')][_0x9cc5('0x11')]({'type':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')],'app':_0x9cc5('0x12'),'appdata':_0x9cc5('0x24')+_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')],'context':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x16')],'exten':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0xa')],'priority':_0x97e182[_0x9cc5('0x17')]++,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')]});if(_0x97e182[_0x9cc5('0x10')]&&_0x97e182[_0x9cc5('0x10')][_0x9cc5('0xe')](_0x9cc5('0x25'))&&_0x97e182[_0x9cc5('0x10')][_0x9cc5('0x25')]!=='none'){_0x97e182[_0x9cc5('0xf')][_0x9cc5('0x11')]({'type':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')],'app':'Set','appdata':_0x9cc5('0x26'),'context':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x16')],'exten':_0xf4ae2e[_0x1d2beb][0x0]['exten'],'priority':_0x97e182[_0x9cc5('0x17')]++,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')]});_0x97e182[_0x9cc5('0xf')][_0x9cc5('0x11')]({'type':_0xf4ae2e[_0x1d2beb][0x0]['type'],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x97e182['extension'][_0x9cc5('0x25')]||'wav','context':_0xf4ae2e[_0x1d2beb][0x0]['context'],'exten':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0xa')],'priority':_0x97e182[_0x9cc5('0x17')]++,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')]});}}_0x97e182[_0x9cc5('0xf')]['push']({'type':_0xf4ae2e[_0x1d2beb][0x0]['type'],'app':_0x9cc5('0x12'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x16')],'exten':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0xa')],'priority':_0x97e182['priority']++,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0]['VoiceExtensionId']});_0x97e182[_0x9cc5('0xf')][_0x9cc5('0x11')]({'type':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')],'app':_0x9cc5('0x12'),'appdata':_0x9cc5('0x27'),'context':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x16')],'exten':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0xa')],'priority':_0x97e182[_0x9cc5('0x17')]++,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')]});_0x97e182['extensions'][_0x9cc5('0x11')]({'type':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')],'app':_0x9cc5('0x12'),'appdata':'MONITOR_OPTIONS=ab','context':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x16')],'exten':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0xa')],'priority':_0x97e182['priority']++,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')]});for(var _0x5e06fb=0x0,_0x38e58e=0x0;_0x5e06fb<_0xf4ae2e[_0x1d2beb]['length'];_0x5e06fb+=0x1,_0x38e58e=0x0){var _0x2014f3=_0xf4ae2e[_0x1d2beb][_0x5e06fb];if(_0x2014f3['type']){_0x2014f3[_0x9cc5('0x15')]=_0x2014f3['type'][_0x9cc5('0x28')]();}var _0x36feeb=[];var _0x483656=[];delete _0x2014f3['id'];delete _0x2014f3[_0x9cc5('0x29')];delete _0x2014f3[_0x9cc5('0x2a')];var _0x34fa2b=_0x2014f3[_0x9cc5('0x2b')]!==_0x9cc5('0x2c')?[_0x2014f3[_0x9cc5('0x2b')]]:_0x2014f3[_0x9cc5('0x2d')]?_[_0x9cc5('0x9')](_[_0x9cc5('0xc')](_0x97e182['intervals'],{'IntervalId':_0x2014f3[_0x9cc5('0x2d')]}),_0x9cc5('0x2b')):[];if(_0x2014f3[_0x9cc5('0xe')](_0x9cc5('0x2e'))){if(_0x2014f3[_0x9cc5('0x2e')]&&_0x2014f3[_0x9cc5('0x2e')]!=='--'){_0x36feeb['push']({'type':_0x2014f3[_0x9cc5('0x15')],'app':_0x9cc5('0x12'),'appdata':_0x9cc5('0x2f')+_0x2014f3[_0x9cc5('0x2e')],'context':_0x2014f3[_0x9cc5('0x16')],'exten':_0x2014f3[_0x9cc5('0xa')],'priority':_0x34fa2b[_0x9cc5('0x30')]+_0x97e182[_0x9cc5('0x17')]+_0x38e58e++,'VoiceExtensionId':_0x2014f3[_0x9cc5('0x18')]});}}if(_0x2014f3[_0x9cc5('0x15')]===_0x9cc5('0x1b')&&_0x2014f3[_0x9cc5('0xe')]('callerID')){if(_0x2014f3[_0x9cc5('0x31')]){_0x36feeb[_0x9cc5('0x11')]({'type':_0x2014f3[_0x9cc5('0x15')],'app':_0x9cc5('0x1f'),'appdata':_0x9cc5('0x32')+_0x2014f3['callerID']+')','context':_0x2014f3[_0x9cc5('0x16')],'exten':_0x2014f3[_0x9cc5('0xa')],'priority':_0x34fa2b[_0x9cc5('0x30')]+_0x97e182[_0x9cc5('0x17')]+_0x38e58e++,'VoiceExtensionId':_0x2014f3['VoiceExtensionId']});}else{_0x36feeb[_0x9cc5('0x11')]({'type':_0x2014f3['type'],'app':_0x9cc5('0x1f'),'appdata':_0x9cc5('0x33'),'context':_0x2014f3[_0x9cc5('0x16')],'exten':_0x2014f3['exten'],'priority':_0x34fa2b[_0x9cc5('0x30')]+_0x97e182[_0x9cc5('0x17')]+_0x38e58e++,'VoiceExtensionId':_0x2014f3[_0x9cc5('0x18')]});}}if(_0x2014f3[_0x9cc5('0xe')](_0x9cc5('0x34'))){if(_0x1fe546['indexOf'](_0x2014f3[_0x9cc5('0x35')][_0x9cc5('0x28')]())>=0x0&&_0x2014f3[_0x9cc5('0x36')]!==_0x9cc5('0x37')){if(_0x2014f3[_0x9cc5('0x34')]){_0x36feeb[_0x9cc5('0x11')]({'type':_0x2014f3[_0x9cc5('0x15')],'app':_0x9cc5('0x1f'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2014f3[_0x9cc5('0x16')],'exten':_0x2014f3[_0x9cc5('0xa')],'priority':_0x34fa2b['length']+_0x97e182['priority']+_0x38e58e++,'VoiceExtensionId':_0x2014f3['VoiceExtensionId']});_0x36feeb[_0x9cc5('0x11')]({'type':_0x2014f3[_0x9cc5('0x15')],'app':_0x9cc5('0x12'),'appdata':_0x9cc5('0x38'),'context':_0x2014f3['context'],'exten':_0x2014f3[_0x9cc5('0xa')],'priority':_0x34fa2b['length']+_0x97e182[_0x9cc5('0x17')]+_0x38e58e++,'VoiceExtensionId':_0x2014f3[_0x9cc5('0x18')]});}else{_0x36feeb['push']({'type':_0x2014f3[_0x9cc5('0x15')],'app':_0x9cc5('0x1f'),'appdata':_0x9cc5('0x39'),'context':_0x2014f3[_0x9cc5('0x16')],'exten':_0x2014f3[_0x9cc5('0xa')],'priority':_0x34fa2b[_0x9cc5('0x30')]+_0x97e182['priority']+_0x38e58e++,'VoiceExtensionId':_0x2014f3[_0x9cc5('0x18')]});_0x36feeb[_0x9cc5('0x11')]({'type':_0x2014f3[_0x9cc5('0x15')],'app':_0x9cc5('0x12'),'appdata':_0x9cc5('0x3a'),'context':_0x2014f3['context'],'exten':_0x2014f3[_0x9cc5('0xa')],'priority':_0x34fa2b[_0x9cc5('0x30')]+_0x97e182[_0x9cc5('0x17')]+_0x38e58e++,'VoiceExtensionId':_0x2014f3[_0x9cc5('0x18')]});}}}for(var _0x2015da=0x0;_0x2015da<_0x34fa2b[_0x9cc5('0x30')];_0x2015da+=0x1){var _0x3c587d=_0x97e182[_0x9cc5('0x17')]+_0x34fa2b[_0x9cc5('0x30')];var _0x3c8961=_0x2015da===_0x34fa2b['length']-0x1?_0x97e182[_0x9cc5('0x17')]+_0x36feeb['length']+_0x483656[_0x9cc5('0x30')]+0x2:_0x97e182[_0x9cc5('0x17')]+_0x2015da+0x1;_0x36feeb[_0x9cc5('0x3b')](_0x2015da,0x0,{'type':_0x2014f3[_0x9cc5('0x15')],'app':'GotoIfTime','appdata':_0x34fa2b[_0x2015da]+'?'+_0x2014f3[_0x9cc5('0x16')]+_0x9cc5('0x3c')+_0x3c587d+':'+_0x2014f3[_0x9cc5('0x16')]+_0x9cc5('0x3c')+_0x3c8961,'exten':_0x2014f3[_0x9cc5('0xa')],'context':_0x2014f3[_0x9cc5('0x16')],'priority':_0x97e182['priority']+_0x2015da,'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')]});}_0x2014f3[_0x9cc5('0x17')]=_0x36feeb[_0x9cc5('0x30')]?_[_0x9cc5('0x3d')](_0x36feeb)[_0x9cc5('0x17')]+0x1:_0x97e182['priority'];_0x97e182['priority']=(_0x483656[_0x9cc5('0x30')]?_['last'](_0x483656)[_0x9cc5('0x17')]:_0x2014f3[_0x9cc5('0x17')])+0x1;_0x97e182[_0x9cc5('0xf')]=_[_0x9cc5('0x3e')](_0x97e182[_0x9cc5('0xf')],_0x36feeb,[_0x2014f3],_0x483656);}_0x97e182[_0x9cc5('0xf')][_0x9cc5('0x11')]({'type':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x15')],'app':_0x9cc5('0x3f'),'exten':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0xa')],'context':_0xf4ae2e[_0x1d2beb][0x0]['context'],'priority':_0x97e182[_0x9cc5('0x17')],'VoiceExtensionId':_0xf4ae2e[_0x1d2beb][0x0][_0x9cc5('0x18')]});_0x1cf362[_0x9cc5('0x11')](_0xf4ae2e[_0x1d2beb][0x0]['VoiceExtensionId']);_0x208418=_[_0x9cc5('0x3e')](_0x208418,_0x97e182[_0x9cc5('0xf')]);}}return _0x2effc1[_0x9cc5('0x40')](function(_0x2402d9){return _0x2effc1[_0x9cc5('0x6')][_0x9cc5('0x7')][_0x9cc5('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x1cf362}},'transaction':_0x2402d9})['then'](function(_0x33156b){return _0x2effc1['models'][_0x9cc5('0x7')][_0x9cc5('0x42')](_[_0x9cc5('0x43')](_0x208418,_0x9cc5('0x17')),{'transaction':_0x2402d9});});});})[_0x9cc5('0x44')](function(_0x6e02b9){console[_0x9cc5('0x45')](_0x6e02b9);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 7da6352..a83ebce 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 _0xe428=['info','CSV\x20import\x20process\x20stopped!','resolve','split','CmContact','createReadStream','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20binding\x20parameters!','Missing\x20ListId\x20parameter!','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','where','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','into','findAll','outbound','dialCheckDuplicateType','CmList','then','get','always','push','sequelize','VoiceQueueId','query','all','VoiceQueue','BlackLists','Campaign','Lists','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','resume','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT'];(function(_0x2f574a,_0x5d01c6){var _0x46a47f=function(_0x511baf){while(--_0x511baf){_0x2f574a['push'](_0x2f574a['shift']());}};_0x46a47f(++_0x5d01c6);}(_0xe428,0xdc));var _0x8e42=function(_0x4b30f9,_0x439966){_0x4b30f9=_0x4b30f9-0x0;var _0xc20e9c=_0xe428[_0x4b30f9];return _0xc20e9c;};'use strict';var BPromise=require(_0x8e42('0x0'));var util=require(_0x8e42('0x1'));var _=require(_0x8e42('0x2'));var fs=require('fs');var squel=require(_0x8e42('0x3'));var Papa=require(_0x8e42('0x4'));var Redis=require('ioredis');var db=require(_0x8e42('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x8e42('0x6'))(_0x8e42('0x7'));config[_0x8e42('0x8')]=_['defaults'](config[_0x8e42('0x8')],{'host':_0x8e42('0x9'),'port':0x18eb});var socket=require(_0x8e42('0xa'))(new Redis(config[_0x8e42('0x8')]));require(_0x8e42('0xb'))['register'](socket);try{if(!process['argv'][0x2]||process[_0x8e42('0xc')][0x2]===_0x8e42('0xd')||process[_0x8e42('0xc')][0x2]==='null'){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0x8e42('0xc')][0x3]||process[_0x8e42('0xc')][0x3]==='undefined'||process[_0x8e42('0xc')][0x3]===_0x8e42('0xe')||!process[_0x8e42('0xc')][0x4]||process[_0x8e42('0xc')][0x4]===_0x8e42('0xd')||process[_0x8e42('0xc')][0x4]===_0x8e42('0xe')){throw new Error(_0x8e42('0xf'));}var FIELDS=_['zipObject'](process[_0x8e42('0xc')][0x3]['split'](','),process[_0x8e42('0xc')][0x4]['split'](','));if(!process[_0x8e42('0xc')][0x5]||process[_0x8e42('0xc')][0x5]==='undefined'||process[_0x8e42('0xc')][0x5]===_0x8e42('0xe')){throw new Error(_0x8e42('0x10'));}var LISTID=process[_0x8e42('0xc')][0x5];var COMPANYID=process[_0x8e42('0xc')][0x6]&&process[_0x8e42('0xc')][0x6]!==_0x8e42('0xd')&&process[_0x8e42('0xc')][0x6]!==_0x8e42('0xe')?process[_0x8e42('0xc')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x8e42('0xc')][0x7]!=='undefined'&&process['argv'][0x7]!==_0x8e42('0xe')?process[_0x8e42('0xc')][0x7]:null;if(!process[_0x8e42('0xc')][0x8]||process[_0x8e42('0xc')][0x8]==='undefined'||process[_0x8e42('0xc')][0x8]===_0x8e42('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x8e42('0xc')][0x8];}catch(_0x589461){logger['error'](_0x589461);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(_0x5a1ccf,_0x2e2e1d,_0x18f655,_0x751c12){var _0x46e465={'message':_0x2e2e1d};_0x46e465[_0x5a1ccf]=!![];if(_0x18f655){_0x46e465['contact']=_0x18f655;}if(_0x751c12){_0x46e465[_0x8e42('0x11')]=_0x751c12;}return _0x46e465;}function isEmail(_0x36b426){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))*$/[_0x8e42('0x12')](_0x36b426);}function checkRow(_0x190022,_0xe97de9,_0x34ce62){return new BPromise(function(_0x2b0308,_0x2a72f4){if(_[_0x8e42('0x13')](_0x190022)){return _0x2a72f4(handleCheckRowError(_0x8e42('0x14'),_0x8e42('0x15'),null,_0x34ce62));}if(_0x190022['errors']&&_0x190022[_0x8e42('0x16')][_0x8e42('0x17')]){var _0x3eb286=_[_0x8e42('0x18')](_0x190022[_0x8e42('0x16')],_0x8e42('0x19'))[_0x8e42('0x1a')](';');return _0x2a72f4(handleCheckRowError(_0x8e42('0x14'),_0x3eb286,null,_0x34ce62));}var _0x30713d={};for(var _0x28adc5 in FIELDS){if(FIELDS[_0x8e42('0x1b')](_0x28adc5)&&FIELDS[_0x28adc5]){_0x30713d[_0x28adc5]=_0x190022[_0x8e42('0x1c')][0x0][FIELDS[_0x28adc5]]||_0x190022[_0x8e42('0x1c')][0x0]['\ufeff'+FIELDS[_0x28adc5]];}}if(!_0x30713d[_0x8e42('0x1d')]){return _0x2a72f4(handleCheckRowError(_0x8e42('0x14'),'firstName\x20not\x20specified!',null,_0x34ce62));}if(!_0x30713d['phone']){return _0x2a72f4(handleCheckRowError(_0x8e42('0x14'),_0x8e42('0x1e'),null,_0x34ce62));}if(_0x30713d[_0x8e42('0x1f')]){var _0x3718b7=moment(_0x30713d['birthDate'],'YYYY-MM-DD');if(!_0x3718b7[_0x8e42('0x20')]()){return _0x2a72f4(handleCheckRowError(_0x8e42('0x14'),_0x8e42('0x21'),null,_0x34ce62));}}if(_0x30713d[_0x8e42('0x22')]){if(!isEmail(_0x30713d[_0x8e42('0x22')])){return _0x2a72f4(handleCheckRowError(_0x8e42('0x14'),_0x8e42('0x23'),null,_0x34ce62));}}_0x30713d['ListId']=LISTID;_0x30713d[_0x8e42('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0xe97de9){var _0x118b07={};for(var _0x2d7d09=0x0,_0x3c0de2=DUPLICATES[_0x8e42('0x17')];_0x2d7d09<_0x3c0de2;_0x2d7d09+=0x1){_0x118b07[DUPLICATES[_0x2d7d09]]=_0x30713d[DUPLICATES[_0x2d7d09]];}var _0x2afe42=_[_0x8e42('0x25')](_0xe97de9,_0x118b07);if(_0x2afe42){return _0x2a72f4(handleCheckRowError(_0x8e42('0x26'),'Duplicate\x20Contact',_0x2afe42,_0x34ce62));}}return db['CmContact']['create'](_0x30713d,{'raw':!![],'hooks':![],'fields':_['keys'](_0x30713d)})['then'](function(_0x420f39){if(DUPLICATES&&DUPLICATES[_0x8e42('0x17')]&&_0xe97de9){_0xe97de9['push'](_['pick'](_0x30713d,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x420f39['id'];return _0x2b0308();})[_0x8e42('0x27')](function(_0x5eaeab){return _0x2a72f4(handleCheckRowError('error',_0x8e42('0x28')+(_0x5eaeab[_0x8e42('0x19')]||JSON[_0x8e42('0x29')](_0x5eaeab)),null,_0x34ce62));});});}function checkHopper(){function _0x3aa282(){return function(_0x21628b){logger[_0x8e42('0x14')](_0x8e42('0x2a'),'checkHopper',util[_0x8e42('0x2b')](_0x21628b,{'showHidden':![],'depth':null}));};}var _0x5cc446=function(_0x352a75,_0x29fbd8){var _0x516605=squel[_0x8e42('0x2c')]()['into'](_0x8e42('0x2d'))[_0x8e42('0x2e')]([_0x8e42('0x2f'),_0x8e42('0x30'),_0x8e42('0x31'),_0x8e42('0x32'),_0x29fbd8,_0x8e42('0x33'),_0x8e42('0x34')],squel[_0x8e42('0x35')]()[_0x8e42('0x36')](_0x8e42('0x2f'),'phone')['field'](_0x8e42('0x37'),_0x8e42('0x30'))[_0x8e42('0x36')]('id',_0x8e42('0x31'))['field'](LISTID[_0x8e42('0x38')](),_0x8e42('0x32'))[_0x8e42('0x36')](_0x352a75['id'][_0x8e42('0x38')](),_0x29fbd8)['field'](_0x8e42('0x37'),_0x8e42('0x33'))['field']('NOW()',_0x8e42('0x34'))[_0x8e42('0x39')](_0x8e42('0x3a'))['where'](_0x8e42('0x3b'))[_0x8e42('0x3c')]('ListId\x20=\x20?',LISTID[_0x8e42('0x38')]())[_0x8e42('0x3c')](_0x8e42('0x3d'))[_0x8e42('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x8e42('0x35')]()[_0x8e42('0x36')](_0x8e42('0x2f'))[_0x8e42('0x39')](_0x8e42('0x2d'))[_0x8e42('0x3c')](_0x29fbd8+_0x8e42('0x3e'),_0x352a75['id'][_0x8e42('0x38')]())))[_0x8e42('0x38')]();return _0x516605;};var _0x443047=function(_0x144fc9,_0x19d5fb){var _0xda7a51=squel[_0x8e42('0x2c')]()['into'](_0x8e42('0x2d'))['fromQuery']([_0x8e42('0x2f'),_0x8e42('0x30'),_0x8e42('0x31'),_0x8e42('0x32'),_0x19d5fb,'createdAt',_0x8e42('0x34')],squel['select']()[_0x8e42('0x36')](_0x8e42('0x2f'),'phone')[_0x8e42('0x36')]('NOW()',_0x8e42('0x30'))['field']('id',_0x8e42('0x31'))[_0x8e42('0x36')](LISTID[_0x8e42('0x38')](),_0x8e42('0x32'))[_0x8e42('0x36')](_0x144fc9['id'][_0x8e42('0x38')](),_0x19d5fb)[_0x8e42('0x36')]('NOW()',_0x8e42('0x33'))[_0x8e42('0x36')](_0x8e42('0x37'),_0x8e42('0x34'))['from'](_0x8e42('0x3a'))['where'](_0x8e42('0x3b'))[_0x8e42('0x3c')](_0x8e42('0x3f'),LISTID[_0x8e42('0x38')]())['where'](_0x8e42('0x40'),squel[_0x8e42('0x41')](hopperContacts))[_0x8e42('0x3c')](_0x8e42('0x3d'))['where'](_0x8e42('0x42'),squel[_0x8e42('0x35')]()[_0x8e42('0x36')](_0x8e42('0x43'))[_0x8e42('0x39')](_0x8e42('0x44'))['where'](_0x19d5fb+_0x8e42('0x3e'),_0x144fc9['id'][_0x8e42('0x38')]()))[_0x8e42('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x8e42('0x35')]()[_0x8e42('0x36')](_0x8e42('0x2f'))[_0x8e42('0x39')](_0x8e42('0x2d'))[_0x8e42('0x3c')](_0x19d5fb+_0x8e42('0x3e'),_0x144fc9['id'][_0x8e42('0x38')]())))[_0x8e42('0x38')]();return _0xda7a51;};function _0x2ca6bc(_0x40bbf2,_0xd4628b){var _0x59cd33=squel['insert']()[_0x8e42('0x45')](_0x8e42('0x2d'))[_0x8e42('0x2e')]([_0x8e42('0x2f'),'scheduledAt',_0x8e42('0x31'),_0x8e42('0x32'),_0xd4628b,_0x8e42('0x33'),_0x8e42('0x34')],squel[_0x8e42('0x35')]()['field'](_0x8e42('0x2f'),_0x8e42('0x2f'))[_0x8e42('0x36')]('NOW()','scheduledAt')['field']('id',_0x8e42('0x31'))[_0x8e42('0x36')](LISTID[_0x8e42('0x38')](),_0x8e42('0x32'))[_0x8e42('0x36')](_0x40bbf2['id']['toString'](),_0xd4628b)['field']('NOW()',_0x8e42('0x33'))[_0x8e42('0x36')](_0x8e42('0x37'),'updatedAt')[_0x8e42('0x39')](_0x8e42('0x3a'))[_0x8e42('0x3c')]('deletedAt\x20IS\x20NULL')[_0x8e42('0x3c')](_0x8e42('0x3f'),LISTID['toString']())[_0x8e42('0x3c')](_0x8e42('0x40'),squel[_0x8e42('0x41')](hopperContacts))[_0x8e42('0x3c')](_0x8e42('0x3d')))[_0x8e42('0x38')]();return _0x59cd33;}function _0x492e9b(_0x546ce0,_0x4b5a6a){var _0x2fe2a1=squel[_0x8e42('0x2c')]()['into']('cm_hopper_black')['fromQuery']([_0x8e42('0x2f'),_0x8e42('0x31'),'ListId',_0x4b5a6a,_0x8e42('0x33'),_0x8e42('0x34')],squel[_0x8e42('0x35')]()[_0x8e42('0x36')]('phone','phone')[_0x8e42('0x36')]('id','ContactId')[_0x8e42('0x36')](LISTID[_0x8e42('0x38')](),_0x8e42('0x32'))[_0x8e42('0x36')](_0x546ce0['id']['toString'](),_0x4b5a6a)[_0x8e42('0x36')](_0x8e42('0x37'),'createdAt')[_0x8e42('0x36')]('NOW()',_0x8e42('0x34'))[_0x8e42('0x39')](_0x8e42('0x3a'))[_0x8e42('0x3c')]('deletedAt\x20IS\x20NULL')[_0x8e42('0x3c')](_0x8e42('0x3f'),LISTID[_0x8e42('0x38')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))['where'](_0x8e42('0x3d')))[_0x8e42('0x38')]();return _0x2fe2a1;}return db['VoiceQueue'][_0x8e42('0x46')]({'where':{'type':_0x8e42('0x47')},'attributes':['id',_0x8e42('0x48')],'include':[{'model':db[_0x8e42('0x49')],'as':'Lists','where':{'id':LISTID}}]})[_0x8e42('0x4a')](function(_0x4782b0){var _0xa20b63=[];if(_0x4782b0){var _0x89d809;for(var _0x426392=0x0,_0x1e50e3;_0x426392<_0x4782b0[_0x8e42('0x17')];_0x426392+=0x1){_0x1e50e3=_0x4782b0[_0x426392][_0x8e42('0x4b')]({'plain':!![]});switch(_0x1e50e3['dialCheckDuplicateType']){case _0x8e42('0x4c'):_0xa20b63[_0x8e42('0x4d')](db[_0x8e42('0x4e')]['query'](_0x443047(_0x1e50e3,_0x8e42('0x4f')))[_0x8e42('0x4a')](function(){})[_0x8e42('0x27')](_0x3aa282()));break;case'onlyIfOpen':_0xa20b63[_0x8e42('0x4d')](db[_0x8e42('0x4e')][_0x8e42('0x50')](_0x5cc446(_0x1e50e3,'VoiceQueueId'))[_0x8e42('0x4a')](function(){})[_0x8e42('0x27')](_0x3aa282()));break;default:_0xa20b63[_0x8e42('0x4d')](db[_0x8e42('0x4e')][_0x8e42('0x50')](_0x2ca6bc(_0x1e50e3,'VoiceQueueId'))[_0x8e42('0x4a')](function(){})[_0x8e42('0x27')](_0x3aa282()));}}}return _0xa20b63;})[_0x8e42('0x51')]()[_0x8e42('0x4a')](function(){return db[_0x8e42('0x52')][_0x8e42('0x46')]({'where':{'type':_0x8e42('0x47')},'attributes':['id'],'include':[{'model':db[_0x8e42('0x49')],'as':_0x8e42('0x53'),'where':{'id':LISTID}}]})[_0x8e42('0x4a')](function(_0x213ef6){var _0x539847=[];if(_0x213ef6){var _0xac55ac;for(var _0x5351a0=0x0,_0x13bdfe;_0x5351a0<_0x213ef6[_0x8e42('0x17')];_0x5351a0+=0x1){_0x13bdfe=_0x213ef6[_0x5351a0][_0x8e42('0x4b')]({'plain':!![]});_0x539847[_0x8e42('0x4d')](db[_0x8e42('0x4e')]['query'](_0x492e9b(_0x13bdfe,_0x8e42('0x4f')))[_0x8e42('0x4a')](function(){})[_0x8e42('0x27')](_0x3aa282()));}}return _0x539847;})['all']();})[_0x8e42('0x4a')](function(){return db[_0x8e42('0x54')][_0x8e42('0x46')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x8e42('0x55'),'where':{'id':LISTID}}]})[_0x8e42('0x4a')](function(_0x58d568){var _0x20935f=[];if(_0x58d568){for(var _0x2310b2=0x0,_0x41c854;_0x2310b2<_0x58d568['length'];_0x2310b2+=0x1){_0x41c854=_0x58d568[_0x2310b2][_0x8e42('0x4b')]({'plain':!![]});switch(_0x41c854['dialCheckDuplicateType']){case'always':_0x20935f[_0x8e42('0x4d')](db[_0x8e42('0x4e')]['query'](_0x443047(_0x41c854,'CampaignId'))[_0x8e42('0x4a')](function(){})[_0x8e42('0x27')](_0x3aa282()));break;case _0x8e42('0x56'):_0x20935f['push'](db['sequelize'][_0x8e42('0x50')](_0x5cc446(_0x41c854,'CampaignId'))[_0x8e42('0x4a')](function(){})[_0x8e42('0x27')](_0x3aa282()));break;default:_0x20935f['push'](db['sequelize']['query'](_0x2ca6bc(_0x41c854,'CampaignId'))['then'](function(){})['catch'](_0x3aa282()));}}}return _0x20935f;})[_0x8e42('0x51')]();})['then'](function(){return db['Campaign'][_0x8e42('0x46')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x8e42('0x53'),'where':{'id':LISTID}}]})[_0x8e42('0x4a')](function(_0x56dcd3){var _0x2ce60b=[];if(_0x56dcd3){for(var _0x26fa58=0x0,_0x139856;_0x26fa58<_0x56dcd3[_0x8e42('0x17')];_0x26fa58+=0x1){_0x139856=_0x56dcd3[_0x26fa58]['get']({'plain':!![]});_0x2ce60b[_0x8e42('0x4d')](db[_0x8e42('0x4e')][_0x8e42('0x50')](_0x492e9b(_0x139856,'CampaignId'))[_0x8e42('0x4a')](function(){})[_0x8e42('0x27')](_0x3aa282()));}}return _0x2ce60b;})[_0x8e42('0x51')]();})['catch'](function(_0x2d0ac1){logger[_0x8e42('0x14')](_0x8e42('0x57'),_0x8e42('0x58'),_0x2d0ac1[_0x8e42('0x19')]);});}var processPromises=function(_0x1ccc40){return BPromise[_0x8e42('0x51')](promises)[_0x8e42('0x4a')](function(_0x56072b){})[_0x8e42('0x27')](function(_0x57889d){logger['error'](_0x8e42('0x59'),JSON['stringify'](_0x57889d));})[_0x8e42('0x5a')](function(){socket[_0x8e42('0x5b')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1ccc40){return _0x1ccc40[_0x8e42('0x5c')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x8e42('0x4a')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x8e42('0x5b')](_0x8e42('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x8e42('0x5e')](FILEPATH);}catch(_0x2d4f12){logger[_0x8e42('0x14')](_0x8e42('0x5f'),JSON['stringify'](_0x2d4f12));}finally{process[_0x8e42('0x60')](0x0);}});};process['on'](_0x8e42('0x61'),function(){logger[_0x8e42('0x62')](_0x8e42('0x63'));endCsv();});function main(){return BPromise[_0x8e42('0x64')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x8e42('0x65')](',');return db[_0x8e42('0x66')][_0x8e42('0x46')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x8e42('0x4a')](function(_0x281e0c){var _0x442322=fs[_0x8e42('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x442322,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4245c0,_0x36e5d8){total+=0x1;var _0x2d6e3b=total;promises['push'](checkRow(_0x4245c0,_0x281e0c,_0x2d6e3b)[_0x8e42('0x4a')](function(){success+=0x1;})['catch'](function(_0x1ef494){if(_0x1ef494[_0x8e42('0x14')]){errors+=0x1;delete _0x1ef494[_0x8e42('0x14')];}else if(_0x1ef494[_0x8e42('0x26')]){duplicates+=0x1;delete _0x1ef494[_0x8e42('0x26')];}rows[_0x8e42('0x4d')](_0x1ef494);}));if(total%0xc8===0x0){_0x36e5d8['pause']();return processPromises(_0x36e5d8);}},'complete':function(){return processPromises()[_0x8e42('0x4a')](function(){logger[_0x8e42('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x25bc8e,_0x58eecf){logger['info'](_0x8e42('0x68'),JSON[_0x8e42('0x29')](_0x25bc8e));endCsv();}});})[_0x8e42('0x27')](function(_0x4167f1){logger[_0x8e42('0x14')](_0x8e42('0x69'),JSON[_0x8e42('0x29')](_0x4167f1));});}main(); \ No newline at end of file +var _0x63dd=['email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','catch','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','scheduledAt','id\x20IN\x20?','str','calleridnum','cm_hopper_final','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','onlyIfOpen','VoiceQueueId','all','findAll','BlackLists','get','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','resume','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','error','contact','index','test','isNil','errors','length','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid'];(function(_0x5b26cb,_0x527ab0){var _0x563d12=function(_0x472b38){while(--_0x472b38){_0x5b26cb['push'](_0x5b26cb['shift']());}};_0x563d12(++_0x527ab0);}(_0x63dd,0x125));var _0xd63d=function(_0x5887f2,_0x23a73c){_0x5887f2=_0x5887f2-0x0;var _0x489c62=_0x63dd[_0x5887f2];return _0x489c62;};'use strict';var BPromise=require('bluebird');var util=require(_0xd63d('0x0'));var _=require(_0xd63d('0x1'));var fs=require('fs');var squel=require(_0xd63d('0x2'));var Papa=require(_0xd63d('0x3'));var Redis=require(_0xd63d('0x4'));var db=require(_0xd63d('0x5'))['db'];var config=require(_0xd63d('0x6'));var logger=require(_0xd63d('0x7'))(_0xd63d('0x8'));config[_0xd63d('0x9')]=_[_0xd63d('0xa')](config[_0xd63d('0x9')],{'host':_0xd63d('0xb'),'port':0x18eb});var socket=require(_0xd63d('0xc'))(new Redis(config['redis']));require(_0xd63d('0xd'))['register'](socket);try{if(!process[_0xd63d('0xe')][0x2]||process[_0xd63d('0xe')][0x2]===_0xd63d('0xf')||process[_0xd63d('0xe')][0x2]===_0xd63d('0x10')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0xd63d('0xe')][0x2];if(!process['argv'][0x3]||process['argv'][0x3]==='undefined'||process[_0xd63d('0xe')][0x3]===_0xd63d('0x10')||!process[_0xd63d('0xe')][0x4]||process[_0xd63d('0xe')][0x4]==='undefined'||process['argv'][0x4]===_0xd63d('0x10')){throw new Error(_0xd63d('0x11'));}var FIELDS=_[_0xd63d('0x12')](process[_0xd63d('0xe')][0x3][_0xd63d('0x13')](','),process['argv'][0x4][_0xd63d('0x13')](','));if(!process[_0xd63d('0xe')][0x5]||process[_0xd63d('0xe')][0x5]===_0xd63d('0xf')||process[_0xd63d('0xe')][0x5]===_0xd63d('0x10')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xd63d('0xe')][0x5];var COMPANYID=process[_0xd63d('0xe')][0x6]&&process['argv'][0x6]!==_0xd63d('0xf')&&process['argv'][0x6]!==_0xd63d('0x10')?process[_0xd63d('0xe')][0x6]:null;var DUPLICATES=process[_0xd63d('0xe')][0x7]&&process[_0xd63d('0xe')][0x7]!==_0xd63d('0xf')&&process[_0xd63d('0xe')][0x7]!=='null'?process[_0xd63d('0xe')][0x7]:null;if(!process[_0xd63d('0xe')][0x8]||process[_0xd63d('0xe')][0x8]===_0xd63d('0xf')||process[_0xd63d('0xe')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x4a1bbd){logger[_0xd63d('0x14')](_0x4a1bbd);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(_0x5d7856,_0x59aa36,_0x1e157c,_0x58a6eb){var _0x2b02c9={'message':_0x59aa36};_0x2b02c9[_0x5d7856]=!![];if(_0x1e157c){_0x2b02c9[_0xd63d('0x15')]=_0x1e157c;}if(_0x58a6eb){_0x2b02c9[_0xd63d('0x16')]=_0x58a6eb;}return _0x2b02c9;}function isEmail(_0x44f35f){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))*$/[_0xd63d('0x17')](_0x44f35f);}function checkRow(_0xbfa7f6,_0x4f7afe,_0x554783){return new BPromise(function(_0x2e098e,_0x52436b){if(_[_0xd63d('0x18')](_0xbfa7f6)){return _0x52436b(handleCheckRowError(_0xd63d('0x14'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x554783));}if(_0xbfa7f6[_0xd63d('0x19')]&&_0xbfa7f6['errors'][_0xd63d('0x1a')]){var _0x2173c3=_['map'](_0xbfa7f6[_0xd63d('0x19')],_0xd63d('0x1b'))[_0xd63d('0x1c')](';');return _0x52436b(handleCheckRowError(_0xd63d('0x14'),_0x2173c3,null,_0x554783));}var _0x400bf5={};for(var _0x2c06b2 in FIELDS){if(FIELDS[_0xd63d('0x1d')](_0x2c06b2)&&FIELDS[_0x2c06b2]){_0x400bf5[_0x2c06b2]=_0xbfa7f6[_0xd63d('0x1e')][0x0][FIELDS[_0x2c06b2]]||_0xbfa7f6['data'][0x0]['\ufeff'+FIELDS[_0x2c06b2]];}}if(!_0x400bf5['firstName']){return _0x52436b(handleCheckRowError(_0xd63d('0x14'),_0xd63d('0x1f'),null,_0x554783));}if(!_0x400bf5[_0xd63d('0x20')]){return _0x52436b(handleCheckRowError(_0xd63d('0x14'),_0xd63d('0x21'),null,_0x554783));}if(_0x400bf5[_0xd63d('0x22')]){var _0xb1ac30=moment(_0x400bf5[_0xd63d('0x22')],_0xd63d('0x23'));if(!_0xb1ac30[_0xd63d('0x24')]()){return _0x52436b(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x554783));}}if(_0x400bf5['email']){if(!isEmail(_0x400bf5[_0xd63d('0x25')])){return _0x52436b(handleCheckRowError(_0xd63d('0x14'),_0xd63d('0x26'),null,_0x554783));}}_0x400bf5['ListId']=LISTID;_0x400bf5[_0xd63d('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x4f7afe){var _0x19b108={};for(var _0x2c0db6=0x0,_0xb80fb3=DUPLICATES[_0xd63d('0x1a')];_0x2c0db6<_0xb80fb3;_0x2c0db6+=0x1){_0x19b108[DUPLICATES[_0x2c0db6]]=_0x400bf5[DUPLICATES[_0x2c0db6]];}var _0x2ac3c9=_[_0xd63d('0x28')](_0x4f7afe,_0x19b108);if(_0x2ac3c9){return _0x52436b(handleCheckRowError(_0xd63d('0x29'),_0xd63d('0x2a'),_0x2ac3c9,_0x554783));}}return db[_0xd63d('0x2b')][_0xd63d('0x2c')](_0x400bf5,{'raw':!![],'hooks':![],'fields':_[_0xd63d('0x2d')](_0x400bf5)})[_0xd63d('0x2e')](function(_0x103ee6){if(DUPLICATES&&DUPLICATES[_0xd63d('0x1a')]&&_0x4f7afe){_0x4f7afe[_0xd63d('0x2f')](_['pick'](_0x400bf5,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x103ee6['id'];return _0x2e098e();})[_0xd63d('0x30')](function(_0x1e10d0){return _0x52436b(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x1e10d0[_0xd63d('0x1b')]||JSON[_0xd63d('0x31')](_0x1e10d0)),null,_0x554783));});});}function checkHopper(){function _0x1ca6f2(){return function(_0x3c8141){logger[_0xd63d('0x14')](_0xd63d('0x32'),_0xd63d('0x33'),util[_0xd63d('0x34')](_0x3c8141,{'showHidden':![],'depth':null}));};}var _0x29c1d3=function(_0x3f2bec,_0x4d2b64){var _0x4fc8f5=squel[_0xd63d('0x35')]()[_0xd63d('0x36')](_0xd63d('0x37'))[_0xd63d('0x38')]([_0xd63d('0x20'),'scheduledAt',_0xd63d('0x39'),_0xd63d('0x3a'),_0x4d2b64,_0xd63d('0x3b'),_0xd63d('0x3c')],squel[_0xd63d('0x3d')]()['field'](_0xd63d('0x20'),'phone')[_0xd63d('0x3e')](_0xd63d('0x3f'),'scheduledAt')[_0xd63d('0x3e')]('id','ContactId')[_0xd63d('0x3e')](LISTID[_0xd63d('0x40')](),_0xd63d('0x3a'))['field'](_0x3f2bec['id'][_0xd63d('0x40')](),_0x4d2b64)['field'](_0xd63d('0x3f'),_0xd63d('0x3b'))[_0xd63d('0x3e')](_0xd63d('0x3f'),'updatedAt')[_0xd63d('0x41')](_0xd63d('0x42'))[_0xd63d('0x43')](_0xd63d('0x44'))['where'](_0xd63d('0x45'),LISTID[_0xd63d('0x40')]())[_0xd63d('0x43')](_0xd63d('0x46'))[_0xd63d('0x43')](_0xd63d('0x47'),squel['select']()[_0xd63d('0x3e')]('phone')[_0xd63d('0x41')]('cm_hopper')[_0xd63d('0x43')](_0x4d2b64+_0xd63d('0x48'),_0x3f2bec['id']['toString']())))[_0xd63d('0x40')]();return _0x4fc8f5;};var _0x155a0d=function(_0x47f034,_0x3c64a8){var _0x1af3e5=squel[_0xd63d('0x35')]()['into'](_0xd63d('0x37'))[_0xd63d('0x38')]([_0xd63d('0x20'),_0xd63d('0x49'),_0xd63d('0x39'),_0xd63d('0x3a'),_0x3c64a8,_0xd63d('0x3b'),_0xd63d('0x3c')],squel[_0xd63d('0x3d')]()['field']('phone',_0xd63d('0x20'))['field'](_0xd63d('0x3f'),_0xd63d('0x49'))[_0xd63d('0x3e')]('id',_0xd63d('0x39'))['field'](LISTID[_0xd63d('0x40')](),'ListId')[_0xd63d('0x3e')](_0x47f034['id']['toString'](),_0x3c64a8)[_0xd63d('0x3e')](_0xd63d('0x3f'),'createdAt')[_0xd63d('0x3e')]('NOW()',_0xd63d('0x3c'))[_0xd63d('0x41')](_0xd63d('0x42'))[_0xd63d('0x43')](_0xd63d('0x44'))[_0xd63d('0x43')](_0xd63d('0x45'),LISTID['toString']())[_0xd63d('0x43')](_0xd63d('0x4a'),squel[_0xd63d('0x4b')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')[_0xd63d('0x43')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd63d('0x3d')]()[_0xd63d('0x3e')](_0xd63d('0x4c'))[_0xd63d('0x41')](_0xd63d('0x4d'))[_0xd63d('0x43')](_0x3c64a8+_0xd63d('0x48'),_0x47f034['id'][_0xd63d('0x40')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xd63d('0x3d')]()[_0xd63d('0x3e')](_0xd63d('0x20'))[_0xd63d('0x41')](_0xd63d('0x37'))[_0xd63d('0x43')](_0x3c64a8+_0xd63d('0x48'),_0x47f034['id']['toString']())))[_0xd63d('0x40')]();return _0x1af3e5;};function _0x14f3cb(_0x518591,_0x87c0d1){var _0x39988d=squel[_0xd63d('0x35')]()[_0xd63d('0x36')]('cm_hopper')[_0xd63d('0x38')]([_0xd63d('0x20'),'scheduledAt',_0xd63d('0x39'),_0xd63d('0x3a'),_0x87c0d1,'createdAt',_0xd63d('0x3c')],squel[_0xd63d('0x3d')]()['field']('phone',_0xd63d('0x20'))[_0xd63d('0x3e')](_0xd63d('0x3f'),_0xd63d('0x49'))[_0xd63d('0x3e')]('id',_0xd63d('0x39'))[_0xd63d('0x3e')](LISTID['toString'](),_0xd63d('0x3a'))[_0xd63d('0x3e')](_0x518591['id'][_0xd63d('0x40')](),_0x87c0d1)['field'](_0xd63d('0x3f'),_0xd63d('0x3b'))[_0xd63d('0x3e')](_0xd63d('0x3f'),_0xd63d('0x3c'))[_0xd63d('0x41')](_0xd63d('0x42'))[_0xd63d('0x43')]('deletedAt\x20IS\x20NULL')[_0xd63d('0x43')](_0xd63d('0x45'),LISTID['toString']())[_0xd63d('0x43')]('id\x20IN\x20?',squel[_0xd63d('0x4b')](hopperContacts))['where'](_0xd63d('0x46')))['toString']();return _0x39988d;}function _0x5eea32(_0x30e9a5,_0x4aca8a){var _0x3a9e49=squel[_0xd63d('0x35')]()[_0xd63d('0x36')]('cm_hopper_black')[_0xd63d('0x38')]([_0xd63d('0x20'),_0xd63d('0x39'),'ListId',_0x4aca8a,_0xd63d('0x3b'),_0xd63d('0x3c')],squel['select']()[_0xd63d('0x3e')](_0xd63d('0x20'),_0xd63d('0x20'))[_0xd63d('0x3e')]('id',_0xd63d('0x39'))[_0xd63d('0x3e')](LISTID['toString'](),'ListId')[_0xd63d('0x3e')](_0x30e9a5['id']['toString'](),_0x4aca8a)[_0xd63d('0x3e')](_0xd63d('0x3f'),'createdAt')[_0xd63d('0x3e')](_0xd63d('0x3f'),'updatedAt')['from'](_0xd63d('0x42'))[_0xd63d('0x43')](_0xd63d('0x44'))[_0xd63d('0x43')](_0xd63d('0x45'),LISTID[_0xd63d('0x40')]())['where']('id\x20IN\x20?',squel[_0xd63d('0x4b')](hopperContacts))[_0xd63d('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0xd63d('0x40')]();return _0x3a9e49;}return db[_0xd63d('0x4e')]['findAll']({'where':{'type':_0xd63d('0x4f')},'attributes':['id',_0xd63d('0x50')],'include':[{'model':db[_0xd63d('0x51')],'as':_0xd63d('0x52'),'where':{'id':LISTID}}]})['then'](function(_0x168e71){var _0x34c298=[];if(_0x168e71){var _0x53b835;for(var _0x1357da=0x0,_0x1bbb17;_0x1357da<_0x168e71[_0xd63d('0x1a')];_0x1357da+=0x1){_0x1bbb17=_0x168e71[_0x1357da]['get']({'plain':!![]});switch(_0x1bbb17[_0xd63d('0x50')]){case _0xd63d('0x53'):_0x34c298[_0xd63d('0x2f')](db[_0xd63d('0x54')][_0xd63d('0x55')](_0x155a0d(_0x1bbb17,'VoiceQueueId'))['then'](function(){})[_0xd63d('0x30')](_0x1ca6f2()));break;case _0xd63d('0x56'):_0x34c298[_0xd63d('0x2f')](db[_0xd63d('0x54')]['query'](_0x29c1d3(_0x1bbb17,_0xd63d('0x57')))[_0xd63d('0x2e')](function(){})[_0xd63d('0x30')](_0x1ca6f2()));break;default:_0x34c298[_0xd63d('0x2f')](db['sequelize'][_0xd63d('0x55')](_0x14f3cb(_0x1bbb17,_0xd63d('0x57')))['then'](function(){})[_0xd63d('0x30')](_0x1ca6f2()));}}}return _0x34c298;})[_0xd63d('0x58')]()[_0xd63d('0x2e')](function(){return db[_0xd63d('0x4e')][_0xd63d('0x59')]({'where':{'type':_0xd63d('0x4f')},'attributes':['id'],'include':[{'model':db[_0xd63d('0x51')],'as':_0xd63d('0x5a'),'where':{'id':LISTID}}]})['then'](function(_0x27bfc4){var _0x52dc51=[];if(_0x27bfc4){var _0x39af25;for(var _0x5a4284=0x0,_0x11e839;_0x5a4284<_0x27bfc4[_0xd63d('0x1a')];_0x5a4284+=0x1){_0x11e839=_0x27bfc4[_0x5a4284][_0xd63d('0x5b')]({'plain':!![]});_0x52dc51[_0xd63d('0x2f')](db[_0xd63d('0x54')][_0xd63d('0x55')](_0x5eea32(_0x11e839,_0xd63d('0x57')))[_0xd63d('0x2e')](function(){})['catch'](_0x1ca6f2()));}}return _0x52dc51;})[_0xd63d('0x58')]();})[_0xd63d('0x2e')](function(){return db[_0xd63d('0x5c')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xd63d('0x51')],'as':'Lists','where':{'id':LISTID}}]})[_0xd63d('0x2e')](function(_0x40ca67){var _0x1f8331=[];if(_0x40ca67){for(var _0x46a5f9=0x0,_0x3e52b1;_0x46a5f9<_0x40ca67[_0xd63d('0x1a')];_0x46a5f9+=0x1){_0x3e52b1=_0x40ca67[_0x46a5f9][_0xd63d('0x5b')]({'plain':!![]});switch(_0x3e52b1[_0xd63d('0x50')]){case _0xd63d('0x53'):_0x1f8331[_0xd63d('0x2f')](db[_0xd63d('0x54')]['query'](_0x155a0d(_0x3e52b1,_0xd63d('0x5d')))[_0xd63d('0x2e')](function(){})[_0xd63d('0x30')](_0x1ca6f2()));break;case _0xd63d('0x56'):_0x1f8331[_0xd63d('0x2f')](db['sequelize']['query'](_0x29c1d3(_0x3e52b1,_0xd63d('0x5d')))['then'](function(){})['catch'](_0x1ca6f2()));break;default:_0x1f8331['push'](db[_0xd63d('0x54')][_0xd63d('0x55')](_0x14f3cb(_0x3e52b1,_0xd63d('0x5d')))[_0xd63d('0x2e')](function(){})['catch'](_0x1ca6f2()));}}}return _0x1f8331;})[_0xd63d('0x58')]();})[_0xd63d('0x2e')](function(){return db[_0xd63d('0x5c')][_0xd63d('0x59')]({'attributes':['id'],'include':[{'model':db[_0xd63d('0x51')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xd63d('0x2e')](function(_0x3e8cd5){var _0x56610c=[];if(_0x3e8cd5){for(var _0x3335e4=0x0,_0x950b4a;_0x3335e4<_0x3e8cd5['length'];_0x3335e4+=0x1){_0x950b4a=_0x3e8cd5[_0x3335e4][_0xd63d('0x5b')]({'plain':!![]});_0x56610c['push'](db[_0xd63d('0x54')][_0xd63d('0x55')](_0x5eea32(_0x950b4a,_0xd63d('0x5d')))[_0xd63d('0x2e')](function(){})[_0xd63d('0x30')](_0x1ca6f2()));}}return _0x56610c;})[_0xd63d('0x58')]();})[_0xd63d('0x30')](function(_0x1eb87e){logger[_0xd63d('0x14')](_0xd63d('0x5e'),_0xd63d('0x5f'),_0x1eb87e[_0xd63d('0x1b')]);});}var processPromises=function(_0x2cf7e4){return BPromise['all'](promises)[_0xd63d('0x2e')](function(_0x53e5b8){})[_0xd63d('0x30')](function(_0x3c1004){logger[_0xd63d('0x14')](_0xd63d('0x60'),JSON[_0xd63d('0x31')](_0x3c1004));})[_0xd63d('0x61')](function(){socket[_0xd63d('0x62')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2cf7e4){return _0x2cf7e4[_0xd63d('0x63')]();}});};var endCsv=function(){return BPromise[_0xd63d('0x64')]()[_0xd63d('0x2e')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xd63d('0x62')](_0xd63d('0x65')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xd63d('0x66')](FILEPATH);}catch(_0x227e56){logger[_0xd63d('0x14')](_0xd63d('0x67'),JSON[_0xd63d('0x31')](_0x227e56));}finally{process['exit'](0x0);}});};process['on'](_0xd63d('0x68'),function(){logger[_0xd63d('0x69')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xd63d('0x64')]()[_0xd63d('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xd63d('0x13')](',');return db['CmContact'][_0xd63d('0x59')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xd63d('0x2e')](function(_0x5180a5){var _0x526021=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xd63d('0x6a')](_0x526021,{'header':!![],'skipEmptyLines':!![],'step':function(_0x42ecff,_0x4bf08a){total+=0x1;var _0x673f83=total;promises[_0xd63d('0x2f')](checkRow(_0x42ecff,_0x5180a5,_0x673f83)['then'](function(){success+=0x1;})['catch'](function(_0x20b5ef){if(_0x20b5ef[_0xd63d('0x14')]){errors+=0x1;delete _0x20b5ef[_0xd63d('0x14')];}else if(_0x20b5ef[_0xd63d('0x29')]){duplicates+=0x1;delete _0x20b5ef[_0xd63d('0x29')];}rows[_0xd63d('0x2f')](_0x20b5ef);}));if(total%0xc8===0x0){_0x4bf08a[_0xd63d('0x6b')]();return processPromises(_0x4bf08a);}},'complete':function(){return processPromises()[_0xd63d('0x2e')](function(){logger[_0xd63d('0x69')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x4329de,_0x4de20b){logger[_0xd63d('0x69')](_0xd63d('0x6c'),JSON[_0xd63d('0x31')](_0x4329de));endCsv();}});})[_0xd63d('0x30')](function(_0x519fc1){logger[_0xd63d('0x14')](_0xd63d('0x6d'),JSON[_0xd63d('0x31')](_0x519fc1));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 261ec14..8a22d97 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 _0x21d2=['offset','main','stringify','send','start','binding','socket_timestamp','root','includes','ContactItemType','name','_description','writeFileSync','createReadStream','data','rows','find','hasOwnProperty','trim','replace','isValid','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','Abort\x20parser','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','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()','contactId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','DROP\x20TABLE\x20','finish','affectedRows','emit','contact:import:','unlink','exit','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','push','all','then','split','length','isNil','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','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','scheduledat','ListId','createdAt','updatedAt','UserId','recallme','cm_contacts','.CmListId','.CmListId\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.phone','cm_hopper_black','fields','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','priority','ContactId','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','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','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','errors','query','spread','catch','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','timezones','dialTimezone','utcOffset','set'];(function(_0x27d8bc,_0x19e010){var _0x4b04cb=function(_0x524568){while(--_0x524568){_0x27d8bc['push'](_0x27d8bc['shift']());}};_0x4b04cb(++_0x19e010);}(_0x21d2,0x1c1));var _0x221d=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x21d2[_0x166d93];return _0xba708;};'use strict';var fs=require('fs');var path=require(_0x221d('0x0'));var _=require(_0x221d('0x1'));var Papa=require(_0x221d('0x2'));var util=require(_0x221d('0x3'));var BPromise=require('bluebird');var moment=require(_0x221d('0x4'));var squel=require(_0x221d('0x5'));var Redis=require(_0x221d('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0x221d('0x7'));var shared=require(_0x221d('0x8'));var logger=require(_0x221d('0x9'))(_0x221d('0xa'));config[_0x221d('0xb')]=_['defaults'](config[_0x221d('0xb')],{'host':_0x221d('0xc'),'port':0x18eb});var socket=require(_0x221d('0xd'))(new Redis(config[_0x221d('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0x221d('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x3db69d){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'](_0x3db69d);}function selectNotIn(_0x2ef868,_0x369285,_0x449949,_0x10b7e6,_0x2db5bc){return squel[_0x221d('0xf')]()[_0x221d('0x10')](_0x221d('0x11'))[_0x221d('0x12')](_0x10b7e6)[_0x221d('0x13')](_0x369285,null,_0x369285+_0x221d('0x14')+_0x10b7e6+'.'+_0x449949)[_0x221d('0x15')](_0x10b7e6+'.'+_0x449949+'\x20=\x20'+_0x2ef868+'.'+_0x449949)['where'](_0x369285+_0x221d('0x16')+_0x2db5bc['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x116aef,_0x97e5f0){promisesAdditionalPhones=[];return db[_0x221d('0x17')][_0x221d('0x18')]({'raw':!![],'attributes':['id',_0x221d('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x65628){if(_0x65628!==null){var _0x5bb69d=[];for(var _0x19adab=0x0;_0x19adab<_0x65628['length'];_0x19adab++){var _0x2d276b=_0x65628[_0x19adab];_0x5bb69d[_0x221d('0x1a')](insertAdditionalPhones(_0x2d276b));}}Promise[_0x221d('0x1b')](_0x5bb69d)[_0x221d('0x1c')](function(){_0x116aef({'val':0x1});});});});}function insertAdditionalPhones(_0x4f6a70){return new Promise(function(_0x4321ca,_0x59e572){var _0x4375ab=_0x4f6a70['AdditionalPhones'];var _0x5b1ffc=_0x4375ab[_0x221d('0x1d')](';');var _0xcebec4=[];orderBy=0x0;for(var _0x54d87e=0x0;_0x54d87e<_0x5b1ffc[_0x221d('0x1e')];_0x54d87e++){_0xcebec4[_0x221d('0x1a')](splitAdditionalPhone(_0x4f6a70['id'],_0x5b1ffc[_0x54d87e]));}Promise[_0x221d('0x1b')](_0xcebec4)[_0x221d('0x1c')](function(){_0x4321ca({'val':_0x5b1ffc['length']});});});}function splitAdditionalPhone(_0x3b3e38,_0x1332b6){return new Promise(function(_0x5135a5,_0x330cda){var _0x5a2886=_0x1332b6[_0x221d('0x1d')](':');var _0x935554=_0x5a2886[0x0];var _0x14cd44=_0x5a2886[0x1];if(!_[_0x221d('0x1f')](_0x14cd44)){var _0x378d00=_0x14cd44[_0x221d('0x1d')]('|');var _0x5db1a7=[];for(var _0xece436=0x0;_0xece436<_0x378d00[_0x221d('0x1e')];_0xece436++){if(_0x378d00[_0xece436]!==''){var _0x594cde=_[_0x221d('0x20')](promisesAdditionalPhones,{'contactId':_0x3b3e38,'phone':_0x378d00[_0xece436]});if(_0x594cde[_0x221d('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0x221d('0x1a')]({'contactId':_0x3b3e38,'contactTypeId':_0x935554,'phone':_0x378d00[_0xece436],'orderBy':orderBy});}}}_0x5135a5({'ok':0x1});}else _0x5135a5({'res':0x0});});}function createAdditionalPhone(_0x438d1b,_0x17333f,_0x339945,_0x33284b){var _0x142c5c='';var _0x47603a='';var _0x15a7c0=_0x339945[_0x221d('0x1d')]('§');_0x142c5c=_0x15a7c0[0x0];if(_0x15a7c0[_0x221d('0x1e')]==0x2)_0x47603a=_0x15a7c0[0x1];return new Promise(function(_0x26621d,_0x3a7882){return db[_0x221d('0x21')][_0x221d('0x22')]({'where':{'CmContactId':_0x438d1b,'item':_0x142c5c}})[_0x221d('0x1c')](function(_0x36c890){if(_0x36c890){return db['CmContactHasItem'][_0x221d('0x23')]({'ItemTypeId':_0x17333f,'description':_0x47603a,'OrderBy':_0x33284b},{'where':{'CmContactId':_0x438d1b,'item':_0x142c5c}})[_0x221d('0x1c')](function(_0x56c7aa){_0x26621d({'res':_0x221d('0x24')});});}else{return db[_0x221d('0x21')][_0x221d('0x25')]({'CmContactId':_0x438d1b,'item':_0x142c5c,'description':_0x47603a,'ItemTypeId':_0x17333f,'OrderBy':_0x33284b,'ItemClass':_0x221d('0x26')})[_0x221d('0x1c')](function(_0x230909){_0x26621d({'res':_0x221d('0x27')});});}});});}function insertCmHopper(_0x1668ea,_0x4383f4,_0x57418b,_0x469769,_0xf1665b){var _0x1a1d0e=['cm_contacts.phone',_0x221d('0x28'),_0x221d('0x29'),_0x221d('0x2a'),_0x4383f4+'.'+_0x469769,_0x221d('0x2b'),_0x221d('0x2c'),_0x221d('0x2d'),_0x221d('0x2e'),'\x22'+_0xf1665b+'\x22'];return squel[_0x221d('0x2f')]()[_0x221d('0x30')](_0x221d('0x31'))[_0x221d('0x32')]([_0x221d('0x11'),_0x221d('0x33'),'ContactId',_0x221d('0x34'),_0x469769,_0x221d('0x35'),_0x221d('0x36'),'priority',_0x221d('0x37'),_0x221d('0x38')],squel[_0x221d('0xf')]()['fields'](_0x1a1d0e)['from'](_0x4383f4)['join'](_0x221d('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x4383f4+_0x221d('0x3a'))[_0x221d('0x13')](_0x57418b,null,_0x57418b+_0x221d('0x14')+_0x4383f4+'.'+_0x469769)['where'](_0x4383f4+_0x221d('0x3b'),_0x1668ea)[_0x221d('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x221d('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4383f4,_0x57418b,_0x469769,_0x221d('0x31'),[_0x221d('0x3c'),_0x221d('0x3d')]))['where'](_0x221d('0x3e'),selectNotIn(_0x4383f4,_0x57418b,_0x469769,_0x221d('0x31'),[_0x221d('0x3c')])))[_0x221d('0x3f')]();}function insertCmHopperBlack(_0x24cbb1,_0xe22d33,_0x427bd0,_0x2e84f1){var _0x38255d=[_0x221d('0x40'),_0x221d('0x29'),'cm_contacts.ListId',_0xe22d33+'.'+_0x2e84f1,_0x221d('0x2b'),_0x221d('0x2c')];return squel[_0x221d('0x2f')]()[_0x221d('0x30')](_0x221d('0x41'))[_0x221d('0x32')]([_0x221d('0x11'),'ContactId',_0x221d('0x34'),_0x2e84f1,_0x221d('0x35'),_0x221d('0x36')],squel[_0x221d('0xf')]()[_0x221d('0x42')](_0x38255d)[_0x221d('0x12')](_0xe22d33)[_0x221d('0x13')](_0x221d('0x39'),null,_0x221d('0x43')+_0xe22d33+_0x221d('0x3a'))[_0x221d('0x13')](_0x427bd0,null,_0x427bd0+_0x221d('0x14')+_0xe22d33+'.'+_0x2e84f1)[_0x221d('0x15')](_0xe22d33+_0x221d('0x3b'),_0x24cbb1)[_0x221d('0x15')](_0x221d('0x44'),NOW)[_0x221d('0x15')](_0x221d('0x3e'),squel[_0x221d('0xf')]()['field'](_0x221d('0x11'))[_0x221d('0x12')](_0x221d('0x41'))[_0x221d('0x15')]('ListId\x20=\x20?',_0x24cbb1)['where'](_0x2e84f1+_0x221d('0x45')+_0xe22d33+'.'+_0x2e84f1)))[_0x221d('0x3f')]();}function insertTzCmHopper(_0x2a4f7f,_0x1b0242,_0x3711b5,_0x189ef9,_0x3fb99f,_0x5e656c){var _0x3574da=[_0x221d('0x40'),_0x221d('0x46')+_0x5e656c+_0x221d('0x47'),'cm_contacts.id',_0x221d('0x2a'),_0x1b0242+'.'+_0x189ef9,_0x221d('0x2b'),_0x221d('0x2c'),'cm_contacts.priority',_0x221d('0x2e'),'\x22'+_0x3fb99f+'\x22'];var _0xb52e7b=squel[_0x221d('0x2f')]()[_0x221d('0x30')]('cm_hopper')['fromQuery']([_0x221d('0x11'),_0x221d('0x33'),'ContactId','ListId',_0x189ef9,_0x221d('0x35'),_0x221d('0x36'),_0x221d('0x48'),_0x221d('0x37'),_0x221d('0x38')],squel['select']()[_0x221d('0x42')](_0x3574da)[_0x221d('0x12')](_0x1b0242)[_0x221d('0x13')](_0x221d('0x39'),null,_0x221d('0x43')+_0x1b0242+_0x221d('0x3a'))[_0x221d('0x13')](_0x3711b5,null,_0x3711b5+_0x221d('0x14')+_0x1b0242+'.'+_0x189ef9)[_0x221d('0x13')](_0x5e656c,null,_0x5e656c+'.id\x20=\x20'+_0x1b0242+'.'+_0x189ef9)[_0x221d('0x15')](_0x1b0242+'.CmListId\x20=\x20?',_0x2a4f7f)[_0x221d('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1b0242,_0x3711b5,_0x189ef9,_0x221d('0x31'),[_0x221d('0x3c'),'\x22onlyIfOpen\x22']))[_0x221d('0x15')](_0x221d('0x3e'),selectNotIn(_0x1b0242,_0x3711b5,_0x189ef9,_0x221d('0x31'),[_0x221d('0x3c')])))[_0x221d('0x3f')]();return _0xb52e7b;}function insertTzCmHopperBlack(_0x2c3ad0,_0x201175,_0x484fbf,_0x46db70){var _0x352377=['cm_contacts.phone',_0x221d('0x29'),'cm_contacts.ListId',_0x201175+'.'+_0x46db70,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x221d('0x2f')]()[_0x221d('0x30')](_0x221d('0x41'))[_0x221d('0x32')]([_0x221d('0x11'),_0x221d('0x49'),'ListId',_0x46db70,_0x221d('0x35'),_0x221d('0x36')],squel[_0x221d('0xf')]()[_0x221d('0x42')](_0x352377)['from'](_0x201175)[_0x221d('0x13')](_0x221d('0x39'),null,_0x221d('0x43')+_0x201175+_0x221d('0x3a'))['join'](_0x484fbf,null,_0x484fbf+_0x221d('0x14')+_0x201175+'.'+_0x46db70)['where'](_0x201175+_0x221d('0x3b'),_0x2c3ad0)['where'](_0x221d('0x44'),NOW)[_0x221d('0x15')](_0x221d('0x3e'),squel['select']()[_0x221d('0x10')](_0x221d('0x11'))[_0x221d('0x12')](_0x221d('0x41'))[_0x221d('0x15')](_0x221d('0x4a'),_0x2c3ad0)[_0x221d('0x15')](_0x46db70+_0x221d('0x45')+_0x201175+'.'+_0x46db70)))['toString']();}function insertCmHopperAdditionalPhones(_0x3e5f3a){var _0x38d14c=[_0x221d('0x4b'),_0x221d('0x4c'),'cm_contact_has_items.OrderBy',_0x221d('0x4d'),_0x221d('0x4e')];return squel[_0x221d('0x2f')]()['into'](_0x221d('0x4f'))[_0x221d('0x32')]([_0x221d('0x50'),_0x221d('0x11'),_0x221d('0x51'),_0x221d('0x35'),'updatedAt'],squel[_0x221d('0xf')]()['fields'](_0x38d14c)['from']('cm_hopper')['join'](_0x221d('0x39'),null,_0x221d('0x52'))[_0x221d('0x13')](_0x221d('0x53'),null,_0x221d('0x54'))[_0x221d('0x15')](_0x221d('0x55'),_0x3e5f3a)[_0x221d('0x15')](_0x221d('0x44'),NOW))[_0x221d('0x3f')]();}function insertCmContact(_0x199e4a,_0x90c9d7,_0x384b95,_0x1e1f90){var _0x2bfed7=_[_0x221d('0x56')](_[_0x221d('0x57')](_0x1e1f90),[_0x221d('0x34'),_0x221d('0x58'),_0x221d('0x35'),_0x221d('0x36'),_0x221d('0x59')]);return squel[_0x221d('0x2f')]()[_0x221d('0x30')](_0x221d('0x39'))[_0x221d('0x32')](_0x2bfed7,squel[_0x221d('0xf')]()[_0x221d('0x42')](_0x2bfed7)[_0x221d('0x12')](_0x90c9d7)[_0x221d('0x15')]('('+_0x384b95[_0x221d('0x13')](',')+_0x221d('0x5a'),squel[_0x221d('0xf')]()[_0x221d('0x42')](_0x384b95)[_0x221d('0x12')]('cm_contacts')[_0x221d('0x15')](_0x221d('0x4a'),_0x199e4a)[_0x221d('0x15')](_0x221d('0x5b')))['where'](_0x221d('0x5c'),squel[_0x221d('0xf')]()[_0x221d('0x10')](_0x221d('0x5d'),_0x221d('0x5e'))['from'](_0x90c9d7)[_0x221d('0x5f')](_0x384b95[_0x221d('0x13')](','))))[_0x221d('0x3f')]();}function handleStop(){logger[_0x221d('0x60')](_0x221d('0x61'));stopped=!![];}function handleUncaughtException(_0x334fee){logger[_0x221d('0x62')](_0x334fee[_0x221d('0x63')]);process['exit'](0x1);}function handleError(_0x48cfe7,_0x364d48){stats[_0x221d('0x64')][_0x221d('0x1a')]({'name':_0x364d48['code'],'message':_0x364d48[_0x221d('0x63')],'row':_0x48cfe7});}function handleQuery(_0x14c8b4){logger[_0x221d('0x60')](_0x14c8b4);return db['sequelize'][_0x221d('0x65')](_0x14c8b4)[_0x221d('0x66')](function(_0x16b577){results[_0x221d('0x1a')](_0x16b577);})[_0x221d('0x67')](function(_0x1f5a01){logger[_0x221d('0x62')](_0x1f5a01[_0x221d('0x63')]);});}function updateTzCampaigns(_0x95b73a){return new Promise(function(_0x8af3f3,_0x229a72){var _0xb6962f=squel[_0x221d('0xf')]()['fields'](['campaigns.id',_0x221d('0x68')])[_0x221d('0x12')](_0x221d('0x69'))[_0x221d('0x13')](_0x221d('0x6a'),null,_0x221d('0x6b'))[_0x221d('0x15')](_0x221d('0x6c')+_0x95b73a);db[_0x221d('0x6d')]['query'](_0xb6962f[_0x221d('0x3f')]())[_0x221d('0x66')](function(_0x4f8ca9){var _0x278e60=[];for(var _0x444782=0x0;_0x444782<_0x4f8ca9[_0x221d('0x1e')];_0x444782++){_0x278e60[_0x221d('0x1a')](getTimezoneData(_0x4f8ca9[_0x444782],tmp_campaigns));}BPromise[_0x221d('0x1b')](_0x278e60)[_0x221d('0x1c')](function(){_0x8af3f3({'val':0x1});});})[_0x221d('0x67')](function(_0x15dd3e){logger[_0x221d('0x62')](_0x15dd3e[_0x221d('0x63')]);_0x8af3f3({'val':0x0});});});}function updateTzVoiceQueues(_0x54d631){return new Promise(function(_0x11aee5,_0x4b984d){var _0x442cc3=squel[_0x221d('0xf')]()[_0x221d('0x42')]([_0x221d('0x6e'),_0x221d('0x6f')])[_0x221d('0x12')](_0x221d('0x70'))['join'](_0x221d('0x71'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x221d('0x15')]('voice_queues_has_cm_lists.CmListId='+_0x54d631);db[_0x221d('0x6d')]['query'](_0x442cc3[_0x221d('0x3f')]())['spread'](function(_0x334e9d){var _0xc42625=[];for(var _0x3e0085=0x0;_0x3e0085<_0x334e9d[_0x221d('0x1e')];_0x3e0085++){_0xc42625[_0x221d('0x1a')](getTimezoneData(_0x334e9d[_0x3e0085],tmp_voice_queues));}BPromise['all'](_0xc42625)[_0x221d('0x1c')](function(){_0x11aee5({'val':0x1});});})['catch'](function(_0x69cd6e){logger[_0x221d('0x62')](_0x69cd6e[_0x221d('0x63')]);_0x11aee5({'val':0x0});});});}function getTimezoneData(_0xc4496a,_0x501b4d){return new Promise(function(_0x43dc04,_0xb44b20){var _0x29b973=shared[_0x221d('0x72')];var _0x2d8070=_0x29b973[_0xc4496a[_0x221d('0x73')]];if(_['isNil'](_0x2d8070)){_0x43dc04({'ret':0x1});}else{var _0x1b4a06=_0x2d8070[_0x221d('0x74')];var _0x2f6e25=squel[_0x221d('0x2f')]()['into'](_0x501b4d)['set']('id',_0xc4496a['id'])[_0x221d('0x75')](_0x221d('0x76'),_0x1b4a06)[_0x221d('0x75')]('dialTimezone',_0xc4496a[_0x221d('0x73')])[_0x221d('0x3f')]();return db[_0x221d('0x6d')][_0x221d('0x65')](_0x2f6e25)['spread'](function(_0x33d369){_0x43dc04({'ret':0x1});})[_0x221d('0x67')](function(_0x44504d){logger[_0x221d('0x62')](_0x44504d[_0x221d('0x63')]);_0xb44b20({'ret':0x1});});}});}function handleTZQuery(_0x11a513){logger[_0x221d('0x60')](_0x11a513);return db[_0x221d('0x6d')][_0x221d('0x65')](_0x11a513)[_0x221d('0x66')](function(_0x5605c0){})[_0x221d('0x67')](function(_0xd6d16f){logger[_0x221d('0x62')](_0xd6d16f[_0x221d('0x63')]);});}function main(_0x2e7787,_0x3379bb,_0x5276e8,_0x263715){logger[_0x221d('0x60')](_0x221d('0x77'),_0x2e7787,JSON[_0x221d('0x78')](_0x3379bb));process[_0x221d('0x79')](_0x221d('0x7a'));var _0x40ba08=_0x3379bb[_0x221d('0x7b')];var _0x5bde51=_['clone'](_0x40ba08);var _0x40580b=_0x3379bb[_0x221d('0x7c')];var _0x37428c=path['join'](config[_0x221d('0x7d')],'server/files/tmp',_0x40580b+'.csv');hasTZ=_[_0x221d('0x57')](_0x40ba08)[_0x221d('0x7e')](_0x221d('0x73'));var _0xfdc396=_[_0x221d('0x57')](_0x40ba08)['join']();logger['info']('header',_0xfdc396);db[_0x221d('0x7f')][_0x221d('0x18')]({'raw':!![],'attributes':['id',_0x221d('0x80')]})[_0x221d('0x1c')](function(_0x382085){for(var _0x6431e0=0x0;_0x6431e0<_0x382085['length'];_0x6431e0++){if(_0x382085[_0x6431e0][_0x221d('0x80')]in _0x40ba08){contactItemTypes['push'](_0x382085[_0x6431e0]);delete _0x5bde51[_0x382085[_0x6431e0][_0x221d('0x80')]];hasAdditionalPhones=!![];}for(var _0x19a327 in _0x40ba08){if(_0x382085[_0x6431e0][_0x221d('0x80')]+_0x221d('0x81')===_0x19a327){phoneDescriptions[_0x221d('0x1a')]({'itemTypeId':_0x382085[_0x6431e0]['id'],'description':_0x19a327});delete _0x5bde51[_0x19a327];}}}if(hasAdditionalPhones)_0x5bde51['AdditionalPhones']='';var _0xa61b0=_[_0x221d('0x57')](_0x5bde51)['join']();logger[_0x221d('0x60')]('header',_0xa61b0);fs[_0x221d('0x82')](_0x37428c,_0xa61b0+'\x0a');Papa['parse'](fs[_0x221d('0x83')](_0x2e7787),{'header':!![],'skipEmptyLines':!![],'step':function(_0x48e797,_0x5c8c5a){try{for(var _0x3fa980=0x0,_0xd58948=[];_0x3fa980<_0x48e797[_0x221d('0x84')]['length'];_0x3fa980++){stats[_0x221d('0x85')]+=0x1;if(_0x48e797[_0x221d('0x64')][_0x3fa980]){handleError(_0x48e797[_0x221d('0x84')][_0x3fa980],_0x48e797['errors'][_0x3fa980]);}else{var _0x2e61c8=[];var _0x4707b2=[];var _0x52710b={};for(var _0x57662b in _0x40ba08){let _0xa12e95=contactItemTypes[_0x221d('0x86')](_0x5f1ca1=>_0x5f1ca1[_0x221d('0x80')]===_0x57662b);let _0x4f6537=contactItemTypes[_0x221d('0x86')](_0x331b2a=>_0x331b2a['name']+_0x221d('0x81')===_0x57662b);if(_[_0x221d('0x1f')](_0xa12e95)&&_['isNil'](_0x4f6537)){if(_0x40ba08[_0x221d('0x87')](_0x57662b)){if(_0x48e797[_0x221d('0x84')][_0x3fa980][_0x40ba08[_0x57662b]]){var _0x2ead1d=_[_0x221d('0x88')](_0x48e797[_0x221d('0x84')][_0x3fa980][_0x40ba08[_0x57662b]][_0x221d('0x89')](/"/g,'\x27'));switch(_0x57662b){case'scheduledat':var _0x33563d=moment(_0x2ead1d,_0x221d('0xe'),!![]);if(_0x33563d[_0x221d('0x8a')]()){_0xd58948[_0x221d('0x1a')]('\x22'+_0x2ead1d+'\x22');}else{_0x2e61c8[_0x221d('0x1a')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x221d('0x48'):var _0x2115c1=parseInt(_0x2ead1d);_0x2ead1d=_[_0x221d('0x8b')](_0x2115c1)||_0x2115c1<0x0||_0x2115c1>0x4?_0x263715?0x3:0x2:_0x2115c1;_0xd58948[_0x221d('0x1a')]('\x22'+_0x2ead1d+'\x22');break;case _0x221d('0x37'):var _0x241458=parseInt(_0x2ead1d);if(_[_0x221d('0x8c')](_0x241458)&&_['includes'](_0x5276e8,_0x241458)){_0xd58948['push']('\x22'+_0x241458+'\x22');}else{_0x2e61c8[_0x221d('0x1a')](_0x221d('0x8d'));}break;case _0x221d('0x8e'):if(isEmail(_0x2ead1d)){_0xd58948[_0x221d('0x1a')]('\x22'+_0x2ead1d+'\x22');}else{_0x2e61c8['push'](_0x221d('0x8f'));}break;case _0x221d('0x90'):var _0x53a9e0=moment(_0x2ead1d,_0x221d('0x91'),!![]);if(_0x53a9e0['isValid']()){_0xd58948['push']('\x22'+_0x2ead1d+'\x22');}else{_0x2e61c8[_0x221d('0x1a')](_0x221d('0x92'));}break;case _0x221d('0x73'):var _0x18cf7a=shared[_0x221d('0x72')];var _0x468eb5=_0x18cf7a[_0x2ead1d];if(!_[_0x221d('0x1f')](_0x468eb5)){var _0x4f4047=_0x468eb5['utcOffset'];_0xd58948[_0x221d('0x1a')]('\x22'+_0x2ead1d+'\x22');_0xd58948[_0x221d('0x1a')]('\x22'+_0x4f4047+'\x22');}break;default:_0xd58948['push']('\x22'+_0x2ead1d+'\x22');}}else{switch(_0x57662b){case _0x221d('0x93'):case'phone':_0x2e61c8[_0x221d('0x1a')](_0x57662b+_0x221d('0x94'));break;default:_0xd58948['push']('\x22\x22');}}}}else{var _0xa1699a='';if(!_[_0x221d('0x1f')](_0xa12e95)){if(!_0x52710b[_0x221d('0x87')](_0xa12e95['id'])){if(!_['isNil'](_0x48e797[_0x221d('0x84')][_0x3fa980][_0x40ba08[_0x57662b]])){var _0x2ead1d=_[_0x221d('0x88')](_0x48e797['data'][_0x3fa980][_0x40ba08[_0x57662b]][_0x221d('0x89')](/"/g,'\x27'));var _0x44f046=phoneDescriptions[_0x221d('0x86')](_0x367fbd=>_0x367fbd[_0x221d('0x95')]===_0xa12e95['id']);if(!_[_0x221d('0x1f')](_0x44f046)){var _0x255f32=_['trim'](_0x48e797[_0x221d('0x84')][_0x3fa980][_0x40ba08[_0x44f046[_0x221d('0x96')]]][_0x221d('0x89')](/"/g,'\x27'));if(!_['isNil'](_0x255f32))_0x2ead1d=_0x2ead1d+'§'+_0x255f32;}if(_0xa1699a=='')_0xa1699a=_0x2ead1d;else _0xa1699a+='|'+_0x2ead1d;}_0x4707b2[_0x221d('0x1a')](_0xa12e95['id']+':'+_0xa1699a);_0x52710b[_0xa12e95['id']]=0x1;}}}}if(hasAdditionalPhones){_0xd58948[_0x221d('0x1a')]('\x22'+_0x4707b2['join'](';')+'\x22');}if(_0x2e61c8[_0x221d('0x1e')]){handleError(_0x48e797[_0x221d('0x84')][_0x3fa980],{'code':_0x221d('0x97'),'message':_0x2e61c8[_0x221d('0x13')]()});}else{fs[_0x221d('0x98')](_0x37428c,_0xd58948['join']()+'\x0a');}_0xd58948=[];}if(!(stats['rows']%0xc8)){socket['emit']('contact:import:'+_0x40580b,stats);stats[_0x221d('0x64')]=[];}}if(stopped){logger[_0x221d('0x60')](_0x221d('0x99'));_0x5c8c5a['abort']();}}catch(_0x2de812){handleError(_0x48e797[_0x221d('0x84')][_0x3fa980],{'code':'SystemError','message':_0x2de812[_0x221d('0x63')]});logger[_0x221d('0x62')](_0x221d('0x9a'),_0x2de812['message']);}},'complete':function(){try{var _0x106f9e=[];var _0x21fbd1=[];var _0x28c50f=_0x221d('0x39');if(_0x3379bb['duplicates']&&_0x3379bb[_0x221d('0x9b')][_0x221d('0x1e')]){_0x28c50f='cm_contacts_'+_0x40580b;_0x106f9e[_0x221d('0x1a')](_0x221d('0x9c')+_0x28c50f+_0x221d('0x9d'));}tmp_campaigns=_0x221d('0x9e')+_0x40580b;tmp_voice_queues=_0x221d('0x9f')+_0x40580b;_0x21fbd1['push'](_0x221d('0x9c')+tmp_campaigns+_0x221d('0xa0'));_0x21fbd1[_0x221d('0x1a')](_0x221d('0x9c')+tmp_voice_queues+_0x221d('0xa0'));BPromise[_0x221d('0xa1')](_0x21fbd1,handleTZQuery)[_0x221d('0x1c')](function(_0x223dad){updateTzCampaigns(_0x3379bb['ListId'])[_0x221d('0x1c')](function(_0x4ce39c){updateTzVoiceQueues(_0x3379bb[_0x221d('0x34')])[_0x221d('0x1c')](function(_0x1f4af8){if(hasTZ)_0xa61b0=_0xa61b0[_0x221d('0x89')](_0x221d('0x73'),_0x221d('0xa2'));var _0x5dc1b0=util[_0x221d('0xa3')](_0x221d('0xa4'),_0x37428c,_0x28c50f,_0xa61b0,_0x3379bb[_0x221d('0x34')],_0x3379bb[_0x221d('0x58')]||null,NOW,NOW);if(_[_0x221d('0x1f')](_0x40ba08['scheduledat'])){_0x5dc1b0+=_0x221d('0xa5');}_0x106f9e['push'](_0x5dc1b0);if(_0x3379bb[_0x221d('0x9b')]&&_0x3379bb[_0x221d('0x9b')][_0x221d('0x1e')]){_0x106f9e[_0x221d('0x1a')](insertCmContact(_0x3379bb[_0x221d('0x34')],_0x28c50f,_0x3379bb[_0x221d('0x9b')],_0x40ba08));_0x106f9e[_0x221d('0x1a')]('DROP\x20TABLE\x20'+_0x28c50f+';');}BPromise[_0x221d('0xa1')](_0x106f9e,handleQuery)['then'](function(_0x12e912){BPromise[_0x221d('0x1b')]([handleAdditionalPhones()])[_0x221d('0x1c')](function(){_0x106f9e=[];for(var _0x1cf3c1=0x0;_0x1cf3c1\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','firstName','UserId','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','path','lodash','util','bluebird','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','defaults','redis','localhost','YYYY-MM-DD\x20HH:mm:ss','format','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','length','push','all','then','split','filter','CmContactHasItem','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','scheduledat','ListId','createdAt','updatedAt','priority','recallme','fields','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','cm_hopper_black','fromQuery','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','\x22always\x22','ContactId','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','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','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','message','exit','errors','code','info','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','query','voice_queues.id','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','error','dialTimezone','isNil','utcOffset','set','offset','main','stringify','start','clone','socket_timestamp','root','server/files/tmp','ContactItemType','name','writeFileSync','parse','createReadStream','data','rows','find','_description','replace','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)','\x20not\x20specified','trim','itemTypeId','description','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','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','contactTypeId','orderBy','voice_queues_has_cm_lists','VoiceQueueId'];(function(_0x433194,_0x44240a){var _0xc2fac4=function(_0x744f93){while(--_0x744f93){_0x433194['push'](_0x433194['shift']());}};_0xc2fac4(++_0x44240a);}(_0x52ee,0xc9));var _0xe52e=function(_0x1d8b9c,_0xc2cdd3){_0x1d8b9c=_0x1d8b9c-0x0;var _0x459bf4=_0x52ee[_0x1d8b9c];return _0x459bf4;};'use strict';var fs=require('fs');var path=require(_0xe52e('0x0'));var _=require(_0xe52e('0x1'));var Papa=require('papaparse');var util=require(_0xe52e('0x2'));var BPromise=require(_0xe52e('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require(_0xe52e('0x4'));var db=require(_0xe52e('0x5'))['db'];var config=require('../../../config/environment');var shared=require(_0xe52e('0x6'));var logger=require(_0xe52e('0x7'))('import');config['redis']=_[_0xe52e('0x8')](config[_0xe52e('0x9')],{'host':_0xe52e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe52e('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0xe52e('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xe52e('0xc')](_0xe52e('0xb'));function isEmail(_0x2a7b1c){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))*$/[_0xe52e('0xd')](_0x2a7b1c);}function selectNotIn(_0x427883,_0x489b82,_0x1ffa2f,_0x3f0ab4,_0x402a0a){return squel[_0xe52e('0xe')]()[_0xe52e('0xf')](_0xe52e('0x10'))[_0xe52e('0x11')](_0x3f0ab4)[_0xe52e('0x12')](_0x489b82,null,_0x489b82+_0xe52e('0x13')+_0x3f0ab4+'.'+_0x1ffa2f)['where'](_0x3f0ab4+'.'+_0x1ffa2f+_0xe52e('0x14')+_0x427883+'.'+_0x1ffa2f)[_0xe52e('0x15')](_0x489b82+_0xe52e('0x16')+_0x402a0a[_0xe52e('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x29f6c6,_0x10f8ee){promisesAdditionalPhones=[];return db[_0xe52e('0x17')][_0xe52e('0x18')]({'raw':!![],'attributes':['id',_0xe52e('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x2adf72){if(_0x2adf72!==null){var _0x12074c=[];for(var _0x1a2450=0x0;_0x1a2450<_0x2adf72[_0xe52e('0x1a')];_0x1a2450++){var _0x2132a6=_0x2adf72[_0x1a2450];_0x12074c[_0xe52e('0x1b')](insertAdditionalPhones(_0x2132a6));}}Promise[_0xe52e('0x1c')](_0x12074c)[_0xe52e('0x1d')](function(){_0x29f6c6({'val':0x1});});});});}function insertAdditionalPhones(_0x5a45f0){return new Promise(function(_0x57ecc7,_0x44f61c){var _0x5da303=_0x5a45f0[_0xe52e('0x19')];var _0x3ad5cf=_0x5da303[_0xe52e('0x1e')](';');var _0x460376=[];orderBy=0x0;for(var _0x1a8c91=0x0;_0x1a8c91<_0x3ad5cf[_0xe52e('0x1a')];_0x1a8c91++){_0x460376['push'](splitAdditionalPhone(_0x5a45f0['id'],_0x3ad5cf[_0x1a8c91]));}Promise['all'](_0x460376)['then'](function(){_0x57ecc7({'val':_0x3ad5cf[_0xe52e('0x1a')]});});});}function splitAdditionalPhone(_0x1a46a6,_0x19fff2){return new Promise(function(_0x474337,_0x2bf555){var _0x13c1bf=_0x19fff2[_0xe52e('0x1e')](':');var _0x1eee6c=_0x13c1bf[0x0];var _0x1f95f7=_0x13c1bf[0x1];if(!_['isNil'](_0x1f95f7)){var _0x4054e9=_0x1f95f7[_0xe52e('0x1e')]('|');var _0x76764=[];for(var _0x543e9c=0x0;_0x543e9c<_0x4054e9['length'];_0x543e9c++){if(_0x4054e9[_0x543e9c]!==''){var _0x3f2af1=_[_0xe52e('0x1f')](promisesAdditionalPhones,{'contactId':_0x1a46a6,'phone':_0x4054e9[_0x543e9c]});if(_0x3f2af1[_0xe52e('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0xe52e('0x1b')]({'contactId':_0x1a46a6,'contactTypeId':_0x1eee6c,'phone':_0x4054e9[_0x543e9c],'orderBy':orderBy});}}}_0x474337({'ok':0x1});}else _0x474337({'res':0x0});});}function createAdditionalPhone(_0x58b0d6,_0x34fd95,_0x3186b5,_0x1c2c0c){var _0x2bc091='';var _0x2621c9='';var _0x4b1808=_0x3186b5['split']('§');_0x2bc091=_0x4b1808[0x0];if(_0x4b1808[_0xe52e('0x1a')]==0x2)_0x2621c9=_0x4b1808[0x1];return new Promise(function(_0x55fe98,_0x442e58){return db[_0xe52e('0x20')]['findOne']({'where':{'CmContactId':_0x58b0d6,'item':_0x2bc091}})[_0xe52e('0x1d')](function(_0xba82d1){if(_0xba82d1){return db['CmContactHasItem']['update']({'ItemTypeId':_0x34fd95,'description':_0x2621c9,'OrderBy':_0x1c2c0c},{'where':{'CmContactId':_0x58b0d6,'item':_0x2bc091}})[_0xe52e('0x1d')](function(_0xe3b532){_0x55fe98({'res':_0xe52e('0x21')});});}else{return db[_0xe52e('0x20')][_0xe52e('0x22')]({'CmContactId':_0x58b0d6,'item':_0x2bc091,'description':_0x2621c9,'ItemTypeId':_0x34fd95,'OrderBy':_0x1c2c0c,'ItemClass':_0xe52e('0x23')})[_0xe52e('0x1d')](function(_0x434200){_0x55fe98({'res':_0xe52e('0x24')});});}});});}function insertCmHopper(_0x272e88,_0x1e7bf5,_0x1dace1,_0x44dd42,_0x4e1ab5){var _0x16f3b5=[_0xe52e('0x25'),_0xe52e('0x26'),_0xe52e('0x27'),'cm_contacts.ListId',_0x1e7bf5+'.'+_0x44dd42,_0xe52e('0x28'),_0xe52e('0x29'),_0xe52e('0x2a'),'cm_contacts.UserId','\x22'+_0x4e1ab5+'\x22'];return squel[_0xe52e('0x2b')]()[_0xe52e('0x2c')]('cm_hopper')['fromQuery']([_0xe52e('0x10'),_0xe52e('0x2d'),'ContactId',_0xe52e('0x2e'),_0x44dd42,_0xe52e('0x2f'),_0xe52e('0x30'),_0xe52e('0x31'),'UserId',_0xe52e('0x32')],squel[_0xe52e('0xe')]()[_0xe52e('0x33')](_0x16f3b5)[_0xe52e('0x11')](_0x1e7bf5)[_0xe52e('0x12')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x1e7bf5+_0xe52e('0x34'))[_0xe52e('0x12')](_0x1dace1,null,_0x1dace1+'.id\x20=\x20'+_0x1e7bf5+'.'+_0x44dd42)[_0xe52e('0x15')](_0x1e7bf5+'.CmListId\x20=\x20?',_0x272e88)['where'](_0xe52e('0x35'),NOW)[_0xe52e('0x15')](_0xe52e('0x36'),selectNotIn(_0x1e7bf5,_0x1dace1,_0x44dd42,_0xe52e('0x37'),['\x22always\x22',_0xe52e('0x38')]))[_0xe52e('0x15')](_0xe52e('0x36'),selectNotIn(_0x1e7bf5,_0x1dace1,_0x44dd42,'cm_hopper',['\x22always\x22'])))[_0xe52e('0x39')]();}function insertCmHopperBlack(_0x389a27,_0x3b6913,_0xf02811,_0x55d8ce){var _0x3d7f6a=[_0xe52e('0x25'),_0xe52e('0x27'),_0xe52e('0x3a'),_0x3b6913+'.'+_0x55d8ce,_0xe52e('0x28'),_0xe52e('0x29')];return squel[_0xe52e('0x2b')]()[_0xe52e('0x2c')](_0xe52e('0x3b'))[_0xe52e('0x3c')]([_0xe52e('0x10'),'ContactId','ListId',_0x55d8ce,_0xe52e('0x2f'),_0xe52e('0x30')],squel[_0xe52e('0xe')]()[_0xe52e('0x33')](_0x3d7f6a)[_0xe52e('0x11')](_0x3b6913)[_0xe52e('0x12')](_0xe52e('0x3d'),null,_0xe52e('0x3e')+_0x3b6913+_0xe52e('0x34'))['join'](_0xf02811,null,_0xf02811+'.id\x20=\x20'+_0x3b6913+'.'+_0x55d8ce)[_0xe52e('0x15')](_0x3b6913+_0xe52e('0x3f'),_0x389a27)[_0xe52e('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe52e('0x15')](_0xe52e('0x36'),squel[_0xe52e('0xe')]()['field'](_0xe52e('0x10'))['from'](_0xe52e('0x3b'))[_0xe52e('0x15')]('ListId\x20=\x20?',_0x389a27)['where'](_0x55d8ce+_0xe52e('0x14')+_0x3b6913+'.'+_0x55d8ce)))[_0xe52e('0x39')]();}function insertTzCmHopper(_0x2331bf,_0x13e934,_0x29ebbf,_0x4220d6,_0x34f079,_0x26ed84){var _0x3addcd=['cm_contacts.phone',_0xe52e('0x40')+_0x26ed84+_0xe52e('0x41'),'cm_contacts.id',_0xe52e('0x3a'),_0x13e934+'.'+_0x4220d6,_0xe52e('0x28'),_0xe52e('0x29'),_0xe52e('0x2a'),'cm_contacts.UserId','\x22'+_0x34f079+'\x22'];var _0x4f2412=squel['insert']()[_0xe52e('0x2c')]('cm_hopper')['fromQuery']([_0xe52e('0x10'),'scheduledat','ContactId',_0xe52e('0x2e'),_0x4220d6,_0xe52e('0x2f'),_0xe52e('0x30'),_0xe52e('0x31'),'UserId',_0xe52e('0x32')],squel['select']()[_0xe52e('0x33')](_0x3addcd)[_0xe52e('0x11')](_0x13e934)[_0xe52e('0x12')](_0xe52e('0x3d'),null,_0xe52e('0x3e')+_0x13e934+_0xe52e('0x34'))[_0xe52e('0x12')](_0x29ebbf,null,_0x29ebbf+_0xe52e('0x13')+_0x13e934+'.'+_0x4220d6)['join'](_0x26ed84,null,_0x26ed84+'.id\x20=\x20'+_0x13e934+'.'+_0x4220d6)[_0xe52e('0x15')](_0x13e934+_0xe52e('0x3f'),_0x2331bf)['where'](_0xe52e('0x35'),NOW)[_0xe52e('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x13e934,_0x29ebbf,_0x4220d6,'cm_hopper',[_0xe52e('0x42'),'\x22onlyIfOpen\x22']))[_0xe52e('0x15')](_0xe52e('0x36'),selectNotIn(_0x13e934,_0x29ebbf,_0x4220d6,'cm_hopper',[_0xe52e('0x42')])))[_0xe52e('0x39')]();return _0x4f2412;}function insertTzCmHopperBlack(_0x29c4d4,_0x3e82dd,_0x24376e,_0x374623){var _0x56fceb=[_0xe52e('0x25'),_0xe52e('0x27'),'cm_contacts.ListId',_0x3e82dd+'.'+_0x374623,_0xe52e('0x28'),_0xe52e('0x29')];return squel[_0xe52e('0x2b')]()[_0xe52e('0x2c')](_0xe52e('0x3b'))[_0xe52e('0x3c')]([_0xe52e('0x10'),_0xe52e('0x43'),_0xe52e('0x2e'),_0x374623,_0xe52e('0x2f'),_0xe52e('0x30')],squel[_0xe52e('0xe')]()['fields'](_0x56fceb)['from'](_0x3e82dd)['join'](_0xe52e('0x3d'),null,_0xe52e('0x3e')+_0x3e82dd+'.CmListId')[_0xe52e('0x12')](_0x24376e,null,_0x24376e+_0xe52e('0x13')+_0x3e82dd+'.'+_0x374623)[_0xe52e('0x15')](_0x3e82dd+_0xe52e('0x3f'),_0x29c4d4)[_0xe52e('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe52e('0x15')](_0xe52e('0x36'),squel[_0xe52e('0xe')]()[_0xe52e('0xf')](_0xe52e('0x10'))[_0xe52e('0x11')](_0xe52e('0x3b'))[_0xe52e('0x15')](_0xe52e('0x44'),_0x29c4d4)['where'](_0x374623+_0xe52e('0x14')+_0x3e82dd+'.'+_0x374623)))[_0xe52e('0x39')]();}function insertCmHopperAdditionalPhones(_0x59577f){var _0x4b6467=[_0xe52e('0x45'),_0xe52e('0x46'),_0xe52e('0x47'),_0xe52e('0x48'),'cm_contact_has_items.updatedAt'];return squel[_0xe52e('0x2b')]()[_0xe52e('0x2c')](_0xe52e('0x49'))[_0xe52e('0x3c')]([_0xe52e('0x4a'),_0xe52e('0x10'),_0xe52e('0x4b'),_0xe52e('0x2f'),'updatedAt'],squel[_0xe52e('0xe')]()[_0xe52e('0x33')](_0x4b6467)[_0xe52e('0x11')](_0xe52e('0x37'))[_0xe52e('0x12')](_0xe52e('0x3d'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xe52e('0x12')](_0xe52e('0x4c'),null,_0xe52e('0x4d'))[_0xe52e('0x15')](_0xe52e('0x4e'),_0x59577f)[_0xe52e('0x15')](_0xe52e('0x35'),NOW))[_0xe52e('0x39')]();}function insertCmContact(_0x59443a,_0x2b140b,_0x46a359,_0xd2f6a9){var _0x286bab=_[_0xe52e('0x4f')](_[_0xe52e('0x50')](_0xd2f6a9),[_0xe52e('0x2e'),_0xe52e('0x51'),'createdAt',_0xe52e('0x30'),_0xe52e('0x52')]);return squel[_0xe52e('0x2b')]()['into'](_0xe52e('0x3d'))['fromQuery'](_0x286bab,squel[_0xe52e('0xe')]()[_0xe52e('0x33')](_0x286bab)[_0xe52e('0x11')](_0x2b140b)[_0xe52e('0x15')]('('+_0x46a359[_0xe52e('0x12')](',')+_0xe52e('0x53'),squel['select']()[_0xe52e('0x33')](_0x46a359)[_0xe52e('0x11')]('cm_contacts')[_0xe52e('0x15')](_0xe52e('0x44'),_0x59443a)[_0xe52e('0x15')](_0xe52e('0x54')))['where'](_0xe52e('0x55'),squel[_0xe52e('0xe')]()['field']('MIN(id)',_0xe52e('0x56'))[_0xe52e('0x11')](_0x2b140b)[_0xe52e('0x57')](_0x46a359[_0xe52e('0x12')](','))))[_0xe52e('0x39')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x26a1e5){logger['error'](_0x26a1e5[_0xe52e('0x58')]);process[_0xe52e('0x59')](0x1);}function handleError(_0x4e9d88,_0x26adf8){stats[_0xe52e('0x5a')][_0xe52e('0x1b')]({'name':_0x26adf8[_0xe52e('0x5b')],'message':_0x26adf8[_0xe52e('0x58')],'row':_0x4e9d88});}function handleQuery(_0xe84896){logger[_0xe52e('0x5c')](_0xe84896);return db['sequelize']['query'](_0xe84896)[_0xe52e('0x5d')](function(_0x1b47bb){results['push'](_0x1b47bb);})[_0xe52e('0x5e')](function(_0x5e70c6){logger['error'](_0x5e70c6[_0xe52e('0x58')]);});}function updateTzCampaigns(_0x54e8d4){return new Promise(function(_0x28802a,_0x40a89c){var _0x39ed93=squel[_0xe52e('0xe')]()[_0xe52e('0x33')]([_0xe52e('0x5f'),_0xe52e('0x60')])[_0xe52e('0x11')](_0xe52e('0x61'))['join'](_0xe52e('0x62'),null,_0xe52e('0x63'))['where'](_0xe52e('0x64')+_0x54e8d4);db[_0xe52e('0x65')][_0xe52e('0x66')](_0x39ed93[_0xe52e('0x39')]())[_0xe52e('0x5d')](function(_0x233ef6){var _0x50b514=[];for(var _0xbbd9f=0x0;_0xbbd9f<_0x233ef6[_0xe52e('0x1a')];_0xbbd9f++){_0x50b514[_0xe52e('0x1b')](getTimezoneData(_0x233ef6[_0xbbd9f],tmp_campaigns));}BPromise[_0xe52e('0x1c')](_0x50b514)['then'](function(){_0x28802a({'val':0x1});});})[_0xe52e('0x5e')](function(_0x5dddb9){logger['error'](_0x5dddb9['message']);_0x28802a({'val':0x0});});});}function updateTzVoiceQueues(_0x34761){return new Promise(function(_0x59ba62,_0x2ae7c8){var _0x328562=squel[_0xe52e('0xe')]()['fields']([_0xe52e('0x67'),'voice_queues.dialTimezone'])['from'](_0xe52e('0x68'))[_0xe52e('0x12')]('voice_queues_has_cm_lists',null,_0xe52e('0x69'))[_0xe52e('0x15')]('voice_queues_has_cm_lists.CmListId='+_0x34761);db[_0xe52e('0x65')][_0xe52e('0x66')](_0x328562['toString']())[_0xe52e('0x5d')](function(_0x3e7e8f){var _0x1f3ab4=[];for(var _0x3af79b=0x0;_0x3af79b<_0x3e7e8f['length'];_0x3af79b++){_0x1f3ab4[_0xe52e('0x1b')](getTimezoneData(_0x3e7e8f[_0x3af79b],tmp_voice_queues));}BPromise[_0xe52e('0x1c')](_0x1f3ab4)['then'](function(){_0x59ba62({'val':0x1});});})[_0xe52e('0x5e')](function(_0x5a4e92){logger[_0xe52e('0x6a')](_0x5a4e92['message']);_0x59ba62({'val':0x0});});});}function getTimezoneData(_0x12d5d9,_0x406323){return new Promise(function(_0x471dd4,_0x42e299){var _0x364519=shared['timezones'];var _0x5f7d94=_0x364519[_0x12d5d9[_0xe52e('0x6b')]];if(_[_0xe52e('0x6c')](_0x5f7d94)){_0x471dd4({'ret':0x1});}else{var _0x1f4305=_0x5f7d94[_0xe52e('0x6d')];var _0x28f062=squel[_0xe52e('0x2b')]()[_0xe52e('0x2c')](_0x406323)['set']('id',_0x12d5d9['id'])[_0xe52e('0x6e')](_0xe52e('0x6f'),_0x1f4305)[_0xe52e('0x6e')](_0xe52e('0x6b'),_0x12d5d9['dialTimezone'])[_0xe52e('0x39')]();return db[_0xe52e('0x65')][_0xe52e('0x66')](_0x28f062)[_0xe52e('0x5d')](function(_0x2a8714){_0x471dd4({'ret':0x1});})['catch'](function(_0x3501c8){logger[_0xe52e('0x6a')](_0x3501c8[_0xe52e('0x58')]);_0x42e299({'ret':0x1});});}});}function handleTZQuery(_0x8c089f){logger[_0xe52e('0x5c')](_0x8c089f);return db[_0xe52e('0x65')][_0xe52e('0x66')](_0x8c089f)[_0xe52e('0x5d')](function(_0x109cc8){})[_0xe52e('0x5e')](function(_0x107d72){logger[_0xe52e('0x6a')](_0x107d72[_0xe52e('0x58')]);});}function main(_0x183a4f,_0x275678,_0x1a41eb,_0x297701){logger[_0xe52e('0x5c')](_0xe52e('0x70'),_0x183a4f,JSON[_0xe52e('0x71')](_0x275678));process['send'](_0xe52e('0x72'));var _0xede4dc=_0x275678['binding'];var _0x150af6=_[_0xe52e('0x73')](_0xede4dc);var _0x173288=_0x275678[_0xe52e('0x74')];var _0x64bd81=path[_0xe52e('0x12')](config[_0xe52e('0x75')],_0xe52e('0x76'),_0x173288+'.csv');hasTZ=_[_0xe52e('0x50')](_0xede4dc)['includes'](_0xe52e('0x6b'));var _0x1cabed=_['keys'](_0xede4dc)[_0xe52e('0x12')]();logger[_0xe52e('0x5c')]('header',_0x1cabed);db[_0xe52e('0x77')]['findAll']({'raw':!![],'attributes':['id',_0xe52e('0x78')]})[_0xe52e('0x1d')](function(_0x3a6e77){for(var _0x2ba3cb=0x0;_0x2ba3cb<_0x3a6e77['length'];_0x2ba3cb++){if(_0x3a6e77[_0x2ba3cb]['name']in _0xede4dc){contactItemTypes['push'](_0x3a6e77[_0x2ba3cb]);delete _0x150af6[_0x3a6e77[_0x2ba3cb][_0xe52e('0x78')]];hasAdditionalPhones=!![];}for(var _0xd35a92 in _0xede4dc){if(_0x3a6e77[_0x2ba3cb]['name']+'_description'===_0xd35a92){phoneDescriptions[_0xe52e('0x1b')]({'itemTypeId':_0x3a6e77[_0x2ba3cb]['id'],'description':_0xd35a92});delete _0x150af6[_0xd35a92];}}}if(hasAdditionalPhones)_0x150af6[_0xe52e('0x19')]='';var _0x490e36=_['keys'](_0x150af6)[_0xe52e('0x12')]();logger[_0xe52e('0x5c')]('header',_0x490e36);fs[_0xe52e('0x79')](_0x64bd81,_0x490e36+'\x0a');Papa[_0xe52e('0x7a')](fs[_0xe52e('0x7b')](_0x183a4f),{'header':!![],'skipEmptyLines':!![],'step':function(_0xe17d29,_0x1bf924){try{for(var _0x27b4ca=0x0,_0x141d25=[];_0x27b4ca<_0xe17d29[_0xe52e('0x7c')][_0xe52e('0x1a')];_0x27b4ca++){stats[_0xe52e('0x7d')]+=0x1;if(_0xe17d29['errors'][_0x27b4ca]){handleError(_0xe17d29[_0xe52e('0x7c')][_0x27b4ca],_0xe17d29[_0xe52e('0x5a')][_0x27b4ca]);}else{var _0x52131e=[];var _0x708d40=[];var _0x29b224={};for(var _0xef4994 in _0xede4dc){let _0x339687=contactItemTypes[_0xe52e('0x7e')](_0x21884b=>_0x21884b[_0xe52e('0x78')]===_0xef4994);let _0x3f4a03=contactItemTypes[_0xe52e('0x7e')](_0x47a294=>_0x47a294[_0xe52e('0x78')]+_0xe52e('0x7f')===_0xef4994);if(_[_0xe52e('0x6c')](_0x339687)&&_[_0xe52e('0x6c')](_0x3f4a03)){if(_0xede4dc['hasOwnProperty'](_0xef4994)){if(_0xe17d29[_0xe52e('0x7c')][_0x27b4ca][_0xede4dc[_0xef4994]]){var _0x33fa75=_['trim'](_0xe17d29[_0xe52e('0x7c')][_0x27b4ca][_0xede4dc[_0xef4994]][_0xe52e('0x80')](/"/g,'\x27'));switch(_0xef4994){case'scheduledat':var _0x17812f=moment(_0x33fa75,_0xe52e('0xb'),!![]);if(_0x17812f[_0xe52e('0x81')]()){_0x141d25[_0xe52e('0x1b')]('\x22'+_0x33fa75+'\x22');}else{_0x52131e[_0xe52e('0x1b')](_0xe52e('0x82'));}break;case'priority':var _0x2fe0e8=parseInt(_0x33fa75);_0x33fa75=_[_0xe52e('0x83')](_0x2fe0e8)||_0x2fe0e8<0x0||_0x2fe0e8>0x4?_0x297701?0x3:0x2:_0x2fe0e8;_0x141d25['push']('\x22'+_0x33fa75+'\x22');break;case'UserId':var _0x43a426=parseInt(_0x33fa75);if(_[_0xe52e('0x84')](_0x43a426)&&_[_0xe52e('0x85')](_0x1a41eb,_0x43a426)){_0x141d25['push']('\x22'+_0x43a426+'\x22');}else{_0x52131e[_0xe52e('0x1b')](_0xe52e('0x86'));}break;case'email':if(isEmail(_0x33fa75)){_0x141d25[_0xe52e('0x1b')]('\x22'+_0x33fa75+'\x22');}else{_0x52131e[_0xe52e('0x1b')](_0xe52e('0x87'));}break;case _0xe52e('0x88'):var _0x395d40=moment(_0x33fa75,_0xe52e('0x89'),!![]);if(_0x395d40[_0xe52e('0x81')]()){_0x141d25[_0xe52e('0x1b')]('\x22'+_0x33fa75+'\x22');}else{_0x52131e[_0xe52e('0x1b')](_0xe52e('0x8a'));}break;case'dialTimezone':var _0x367e6b=shared['timezones'];var _0x4444d2=_0x367e6b[_0x33fa75];if(!_[_0xe52e('0x6c')](_0x4444d2)){var _0x3b99a0=_0x4444d2[_0xe52e('0x6d')];_0x141d25[_0xe52e('0x1b')]('\x22'+_0x33fa75+'\x22');_0x141d25[_0xe52e('0x1b')]('\x22'+_0x3b99a0+'\x22');}break;default:_0x141d25[_0xe52e('0x1b')]('\x22'+_0x33fa75+'\x22');}}else{switch(_0xef4994){case'firstName':case _0xe52e('0x10'):_0x52131e[_0xe52e('0x1b')](_0xef4994+_0xe52e('0x8b'));break;default:_0x141d25[_0xe52e('0x1b')]('\x22\x22');}}}}else{var _0x299998='';if(!_['isNil'](_0x339687)){if(!_0x29b224['hasOwnProperty'](_0x339687['id'])){if(!_[_0xe52e('0x6c')](_0xe17d29['data'][_0x27b4ca][_0xede4dc[_0xef4994]])){var _0x33fa75=_[_0xe52e('0x8c')](_0xe17d29[_0xe52e('0x7c')][_0x27b4ca][_0xede4dc[_0xef4994]][_0xe52e('0x80')](/"/g,'\x27'));var _0x7336d6=phoneDescriptions['find'](_0x32cf7d=>_0x32cf7d[_0xe52e('0x8d')]===_0x339687['id']);if(!_[_0xe52e('0x6c')](_0x7336d6)){var _0x446360=_['trim'](_0xe17d29['data'][_0x27b4ca][_0xede4dc[_0x7336d6[_0xe52e('0x8e')]]][_0xe52e('0x80')](/"/g,'\x27'));if(!_['isNil'](_0x446360))_0x33fa75=_0x33fa75+'§'+_0x446360;}if(_0x299998=='')_0x299998=_0x33fa75;else _0x299998+='|'+_0x33fa75;}_0x708d40['push'](_0x339687['id']+':'+_0x299998);_0x29b224[_0x339687['id']]=0x1;}}}}if(hasAdditionalPhones){_0x141d25['push']('\x22'+_0x708d40[_0xe52e('0x12')](';')+'\x22');}if(_0x52131e[_0xe52e('0x1a')]){handleError(_0xe17d29[_0xe52e('0x7c')][_0x27b4ca],{'code':_0xe52e('0x8f'),'message':_0x52131e[_0xe52e('0x12')]()});}else{fs[_0xe52e('0x90')](_0x64bd81,_0x141d25[_0xe52e('0x12')]()+'\x0a');}_0x141d25=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0xe52e('0x91')+_0x173288,stats);stats[_0xe52e('0x5a')]=[];}}if(stopped){logger[_0xe52e('0x5c')](_0xe52e('0x92'));_0x1bf924[_0xe52e('0x93')]();}}catch(_0x14e21){handleError(_0xe17d29[_0xe52e('0x7c')][_0x27b4ca],{'code':'SystemError','message':_0x14e21[_0xe52e('0x58')]});logger[_0xe52e('0x6a')](_0xe52e('0x94'),_0x14e21[_0xe52e('0x58')]);}},'complete':function(){try{var _0x181549=[];var _0x48443a=[];var _0x38ec02='cm_contacts';if(_0x275678[_0xe52e('0x95')]&&_0x275678[_0xe52e('0x95')][_0xe52e('0x1a')]){_0x38ec02='cm_contacts_'+_0x173288;_0x181549[_0xe52e('0x1b')](_0xe52e('0x96')+_0x38ec02+_0xe52e('0x97'));}tmp_campaigns=_0xe52e('0x98')+_0x173288;tmp_voice_queues='voice_queues_'+_0x173288;_0x48443a[_0xe52e('0x1b')](_0xe52e('0x96')+tmp_campaigns+_0xe52e('0x99'));_0x48443a[_0xe52e('0x1b')](_0xe52e('0x96')+tmp_voice_queues+_0xe52e('0x99'));BPromise[_0xe52e('0x9a')](_0x48443a,handleTZQuery)[_0xe52e('0x1d')](function(_0x539f1e){updateTzCampaigns(_0x275678['ListId'])['then'](function(_0x18594b){updateTzVoiceQueues(_0x275678[_0xe52e('0x2e')])[_0xe52e('0x1d')](function(_0x513d3e){if(hasTZ)_0x490e36=_0x490e36[_0xe52e('0x80')](_0xe52e('0x6b'),_0xe52e('0x9b'));var _0x457283=util['format'](_0xe52e('0x9c'),_0x64bd81,_0x38ec02,_0x490e36,_0x275678['ListId'],_0x275678['CompanyId']||null,NOW,NOW);if(_['isNil'](_0xede4dc['scheduledat'])){_0x457283+=_0xe52e('0x9d');}_0x181549['push'](_0x457283);if(_0x275678[_0xe52e('0x95')]&&_0x275678[_0xe52e('0x95')][_0xe52e('0x1a')]){_0x181549[_0xe52e('0x1b')](insertCmContact(_0x275678[_0xe52e('0x2e')],_0x38ec02,_0x275678[_0xe52e('0x95')],_0xede4dc));_0x181549['push'](_0xe52e('0x9e')+_0x38ec02+';');}BPromise[_0xe52e('0x9a')](_0x181549,handleQuery)['then'](function(_0xdce264){BPromise[_0xe52e('0x1c')]([handleAdditionalPhones()])[_0xe52e('0x1d')](function(){_0x181549=[];for(var _0x1cf290=0x0;_0x1cf290\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','papaparse','util','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','field','phone','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','error','message','split','filter','findOne','CmContactHasItem','updated','create','PHONE','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ListId','createdAt','updatedAt','priority','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.createdAt','into','cm_hopper_black','ContactId','fields','ListId\x20=\x20?','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','select','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','id\x20IN\x20?','min_id','group','Received\x20SIGINT','exit','info','main','stringify','send','start','binding','clone','socket_timestamp','root','body','ContactItemType','findAll','name','_description','header','writeFileSync','parse','createReadStream'];(function(_0x21e034,_0x59fc14){var _0x1faab3=function(_0x2bd3ba){while(--_0x2bd3ba){_0x21e034['push'](_0x21e034['shift']());}};_0x1faab3(++_0x59fc14);}(_0xc19f,0x164));var _0xfc19=function(_0x585481,_0x16e775){_0x585481=_0x585481-0x0;var _0x2ac3b7=_0xc19f[_0x585481];return _0x2ac3b7;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0xfc19('0x0'));var util=require(_0xfc19('0x1'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0xfc19('0x2'));var Redis=require(_0xfc19('0x3'));var db=require(_0xfc19('0x4'))['db'];var config=require(_0xfc19('0x5'));var logger=require(_0xfc19('0x6'))(_0xfc19('0x7'));config[_0xfc19('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfc19('0x9'))(new Redis(config[_0xfc19('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()[_0xfc19('0xa')](_0xfc19('0xb'));var tempTableName=_0xfc19('0xc')+moment()[_0xfc19('0xa')](_0xfc19('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2b1a67){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'](_0x2b1a67);}function selectNotIn(_0x4da686,_0x3ba4c4,_0x3b78cf,_0x49776d,_0x45791b){return squel['select']()[_0xfc19('0xe')](_0xfc19('0xf'))['from'](_0x49776d)[_0xfc19('0x10')](_0x3ba4c4,null,_0x3ba4c4+_0xfc19('0x11')+_0x49776d+'.'+_0x3b78cf)['where'](_0x49776d+'.'+_0x3b78cf+_0xfc19('0x12')+_0x4da686+'.'+_0x3b78cf)[_0xfc19('0x13')](_0x3ba4c4+_0xfc19('0x14')+_0x45791b[_0xfc19('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x158b36,_0x4f4b84){promisesAdditionalPhones=[];promisesContact=[];return db[_0xfc19('0x15')][_0xfc19('0x16')](_0xfc19('0x17')+tempTableName)[_0xfc19('0x18')](function(_0x414011){if(_0x414011!==null){var _0x3201b2=[];for(var _0x30a3af=0x0;_0x30a3af<_0x414011[_0xfc19('0x19')];_0x30a3af++){var _0x4186fe=_0x414011[_0x30a3af];if(!_[_0xfc19('0x1a')](_0x4186fe[_0xfc19('0xf')])){if(!_[_0xfc19('0x1a')](_0x4186fe[_0xfc19('0x1b')]))_0x3201b2[_0xfc19('0x1c')](insertAdditionalPhones(_0x4186fe));promisesContact[_0xfc19('0x1c')]({'contact':_0x4186fe});}}}Promise[_0xfc19('0x1d')](_0x3201b2)[_0xfc19('0x1e')](function(){_0x158b36({'val':0x1});});})[_0xfc19('0x1f')](function(_0x41c0db){logger[_0xfc19('0x20')](_0x41c0db[_0xfc19('0x21')]);});});}function insertAdditionalPhones(_0x539a4d){return new Promise(function(_0x2a4d18,_0x58b64e){var _0xef1dbd=_0x539a4d[_0xfc19('0x1b')];if(_[_0xfc19('0x1a')](_0xef1dbd))_0x58b64e({'val':0x0});else{var _0x47f21c=_0xef1dbd[_0xfc19('0x22')](';');var _0x1e31df=[];orderBy=0x0;for(var _0x4f8fef=0x0;_0x4f8fef<_0x47f21c[_0xfc19('0x19')];_0x4f8fef++){_0x1e31df[_0xfc19('0x1c')](splitAdditionalPhone(_0x539a4d['id'],_0x47f21c[_0x4f8fef]));}Promise['all'](_0x1e31df)['then'](function(){_0x2a4d18({'val':_0x47f21c[_0xfc19('0x19')]});});}});}function splitAdditionalPhone(_0x4e7c72,_0x2f9b20){return new Promise(function(_0x479756,_0x1cb08f){var _0x45e020=_0x2f9b20[_0xfc19('0x22')](':');var _0x4883f1=_0x45e020[0x0];var _0xe77f34=_0x45e020[0x1];if(_0xe77f34!==''){var _0xc302a8=_0xe77f34[_0xfc19('0x22')]('|');var _0x3e6b53=[];for(var _0xbec1bc=0x0;_0xbec1bc<_0xc302a8[_0xfc19('0x19')];_0xbec1bc++){if(_0xc302a8[_0xbec1bc]!==''){var _0x40c66d=_[_0xfc19('0x23')](promisesAdditionalPhones,{'contactId':_0x4e7c72,'phone':_0xc302a8[_0xbec1bc]});if(_0x40c66d[_0xfc19('0x19')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x4e7c72,'contactTypeId':_0x4883f1,'phone':_0xc302a8[_0xbec1bc],'orderBy':orderBy});}}}_0x479756({'ok':0x1});}else _0x479756({'res':0x0});});}function createAdditionalPhone(_0x3eac40,_0x126a5b,_0x55803d,_0x10f5d5){var _0x2bc6b4='';var _0x39a706='';var _0xe36510=_0x55803d['split']('§');_0x2bc6b4=_0xe36510[0x0];if(_0xe36510[_0xfc19('0x19')]==0x2)_0x39a706=_0xe36510[0x1];return new Promise(function(_0x220abd,_0x2932bd){return db['CmContactHasItem'][_0xfc19('0x24')]({'where':{'CmContactId':_0x3eac40,'item':_0x2bc6b4}})[_0xfc19('0x1e')](function(_0x54a8d9){if(_0x54a8d9){return db[_0xfc19('0x25')]['update']({'ItemTypeId':_0x126a5b,'description':_0x39a706,'OrderBy':_0x10f5d5},{'where':{'CmContactId':_0x3eac40,'item':_0x2bc6b4}})[_0xfc19('0x1e')](function(_0x513e50){_0x220abd({'res':_0xfc19('0x26')});});}else{return db[_0xfc19('0x25')][_0xfc19('0x27')]({'CmContactId':_0x3eac40,'item':_0x2bc6b4,'ItemTypeId':_0x126a5b,'description':_0x39a706,'OrderBy':_0x10f5d5,'ItemClass':_0xfc19('0x28')})[_0xfc19('0x1e')](function(_0x4f8faa){_0x220abd({'res':'inserted'});});}});});}function updateContact(_0x13806d){return new Promise(function(_0x553a59,_0x2d8e2e){var _0x2906da=_0x13806d['id'];delete _0x13806d['id'];return db[_0xfc19('0x29')][_0xfc19('0x2a')](_0x13806d,{'where':{'id':_0x2906da}})[_0xfc19('0x1e')](function(_0x269014){updatedRows+=0x1;return db[_0xfc19('0x2b')][_0xfc19('0x2a')]({'phone':_0x13806d[_0xfc19('0xf')]},{'where':{'ContactId':_0x2906da}})[_0xfc19('0x1e')](function(_0xf34e73){_0x553a59({'ret':'OK'});});});});}function insertCmHopper(_0xfb3c0,_0x3ef069,_0x3b24bc,_0x3b8844,_0x2dfea5){var _0xc55bf6=[_0xfc19('0x2c'),_0xfc19('0x2d'),_0xfc19('0x2e'),'cm_contacts.ListId',_0x3ef069+'.'+_0x3b8844,'cm_contacts.createdAt',_0xfc19('0x2f'),_0xfc19('0x30'),_0xfc19('0x31'),'\x22'+_0x2dfea5+'\x22'];return squel[_0xfc19('0x32')]()['into'](_0xfc19('0x33'))[_0xfc19('0x34')]([_0xfc19('0xf'),_0xfc19('0x35'),'ContactId',_0xfc19('0x36'),_0x3b8844,_0xfc19('0x37'),_0xfc19('0x38'),_0xfc19('0x39'),'UserId','recallme'],squel['select']()['fields'](_0xc55bf6)[_0xfc19('0x3a')](_0x3ef069)[_0xfc19('0x10')](_0xfc19('0x3b'),null,_0xfc19('0x3c')+_0x3ef069+_0xfc19('0x3d'))[_0xfc19('0x10')](_0x3b24bc,null,_0x3b24bc+_0xfc19('0x11')+_0x3ef069+'.'+_0x3b8844)[_0xfc19('0x13')](_0x3ef069+_0xfc19('0x3e'),_0xfb3c0)[_0xfc19('0x13')](_0xfc19('0x3f'),NOW)[_0xfc19('0x13')](_0xfc19('0x40'),selectNotIn(_0x3ef069,_0x3b24bc,_0x3b8844,_0xfc19('0x33'),['\x22always\x22',_0xfc19('0x41')]))[_0xfc19('0x13')](_0xfc19('0x40'),selectNotIn(_0x3ef069,_0x3b24bc,_0x3b8844,_0xfc19('0x33'),[_0xfc19('0x42')])))[_0xfc19('0x43')]();}function insertCmHopperBlack(_0x1d4b9b,_0x3bb022,_0x27caad,_0x2594c5){var _0x34cc70=[_0xfc19('0x2c'),_0xfc19('0x2e'),'cm_contacts.ListId',_0x3bb022+'.'+_0x2594c5,_0xfc19('0x44'),'cm_contacts.updatedAt'];return squel[_0xfc19('0x32')]()[_0xfc19('0x45')](_0xfc19('0x46'))[_0xfc19('0x34')]([_0xfc19('0xf'),_0xfc19('0x47'),_0xfc19('0x36'),_0x2594c5,_0xfc19('0x37'),_0xfc19('0x38')],squel['select']()[_0xfc19('0x48')](_0x34cc70)[_0xfc19('0x3a')](_0x3bb022)['join'](_0xfc19('0x3b'),null,'cm_contacts.ListId\x20=\x20'+_0x3bb022+_0xfc19('0x3d'))[_0xfc19('0x10')](_0x27caad,null,_0x27caad+_0xfc19('0x11')+_0x3bb022+'.'+_0x2594c5)[_0xfc19('0x13')](_0x3bb022+_0xfc19('0x3e'),_0x1d4b9b)[_0xfc19('0x13')](_0xfc19('0x3f'),NOW)[_0xfc19('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xfc19('0xe')](_0xfc19('0xf'))[_0xfc19('0x3a')](_0xfc19('0x46'))[_0xfc19('0x13')](_0xfc19('0x49'),_0x1d4b9b)[_0xfc19('0x13')](_0x2594c5+'\x20=\x20?',_0x3bb022+'.'+_0x2594c5)))[_0xfc19('0x43')]();}function insertCmHopperAdditionalPhones(_0x8c8178){var _0x718df4=['cm_hopper.id','cm_contact_has_items.item',_0xfc19('0x4a'),_0xfc19('0x4b'),_0xfc19('0x4c')];return squel[_0xfc19('0x32')]()[_0xfc19('0x45')](_0xfc19('0x4d'))[_0xfc19('0x34')]([_0xfc19('0x4e'),'phone','OrderBy',_0xfc19('0x37'),'updatedAt'],squel[_0xfc19('0x4f')]()[_0xfc19('0x48')](_0x718df4)['from'](_0xfc19('0x33'))[_0xfc19('0x10')](_0xfc19('0x3b'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xfc19('0x10')](_0xfc19('0x50'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where'](_0xfc19('0x51'),_0x8c8178)[_0xfc19('0x13')](_0xfc19('0x3f'),NOW))[_0xfc19('0x43')]();}function insertCmContact(_0x16ab97,_0x873e99,_0x168ffb,_0x2a9806){var _0x37ac16=_[_0xfc19('0x52')](_['keys'](_0x2a9806),[_0xfc19('0x36'),'CompanyId',_0xfc19('0x37'),_0xfc19('0x38')]);return squel[_0xfc19('0x32')]()[_0xfc19('0x45')](_0xfc19('0x3b'))[_0xfc19('0x34')](_0x37ac16,squel[_0xfc19('0x4f')]()[_0xfc19('0x48')](_0x37ac16)[_0xfc19('0x3a')](_0x873e99)[_0xfc19('0x13')]('('+_0x168ffb[_0xfc19('0x10')](',')+')\x20NOT\x20IN\x20?',squel['select']()['fields'](_0x168ffb)[_0xfc19('0x3a')]('cm_contacts')[_0xfc19('0x13')](_0xfc19('0x49'),_0x16ab97))[_0xfc19('0x13')](_0xfc19('0x53'),squel[_0xfc19('0x4f')]()['field']('MIN(id)',_0xfc19('0x54'))[_0xfc19('0x3a')](_0x873e99)[_0xfc19('0x55')](_0x168ffb[_0xfc19('0x10')](','))))[_0xfc19('0x43')]();}function handleStop(){logger['info'](_0xfc19('0x56'));stopped=!![];}function handleUncaughtException(_0x446f0a){logger['error'](_0x446f0a['message']);process[_0xfc19('0x57')](0x1);}function handleError(_0xeeca4d,_0x5c4ebd){stats['errors'][_0xfc19('0x1c')]({'name':_0x5c4ebd['code'],'message':_0x5c4ebd[_0xfc19('0x21')],'row':_0xeeca4d});}function handleQuery(_0x42fe5d){logger['info'](_0x42fe5d);return db[_0xfc19('0x15')]['query'](_0x42fe5d)[_0xfc19('0x18')](function(_0x13a436){results[_0xfc19('0x1c')](_0x13a436);})['catch'](function(_0x23dcae){logger[_0xfc19('0x20')](_0x23dcae['message']);});}function main(_0x520dc0,_0x385f40,_0x2979ab,_0x47125b){logger[_0xfc19('0x58')](_0xfc19('0x59'),_0x520dc0,JSON[_0xfc19('0x5a')](_0x385f40));process[_0xfc19('0x5b')](_0xfc19('0x5c'));var _0x341d8b=_0x385f40[_0xfc19('0x5d')];var _0x3860fb=_[_0xfc19('0x5e')](_0x341d8b);var _0xcbec62=_0x385f40[_0xfc19('0x5f')];var _0x1c21a5=path[_0xfc19('0x10')](config[_0xfc19('0x60')],'server/files/tmp',_0xcbec62+'.csv');logger[_0xfc19('0x58')](_0xfc19('0x61'),_0x385f40);db[_0xfc19('0x62')][_0xfc19('0x63')]({'raw':!![],'attributes':['id',_0xfc19('0x64')]})[_0xfc19('0x1e')](function(_0x154056){for(var _0x70799a=0x0;_0x70799a<_0x154056[_0xfc19('0x19')];_0x70799a++){if(_0x154056[_0x70799a][_0xfc19('0x64')]in _0x341d8b){contactItemTypes[_0xfc19('0x1c')](_0x154056[_0x70799a]);delete _0x3860fb[_0x154056[_0x70799a][_0xfc19('0x64')]];hasAdditionalPhones=!![];}for(var _0x225b73 in _0x341d8b){if(_0x154056[_0x70799a]['name']+_0xfc19('0x65')===_0x225b73){phoneDescriptions['push']({'itemTypeId':_0x154056[_0x70799a]['id'],'description':_0x225b73});delete _0x3860fb[_0x225b73];}}}if(hasAdditionalPhones)_0x3860fb[_0xfc19('0x1b')]='';var _0x243b88=_['keys'](_0x3860fb)['join']();logger[_0xfc19('0x58')](_0xfc19('0x66'),_0x243b88);fs[_0xfc19('0x67')](_0x1c21a5,_0x243b88+'\x0a');Papa[_0xfc19('0x68')](fs[_0xfc19('0x69')](_0x520dc0),{'header':!![],'skipEmptyLines':!![],'step':function(_0x7e0a6d,_0x51de0b){try{for(var _0x57b6a7=0x0,_0x5ed3af=[];_0x57b6a7<_0x7e0a6d[_0xfc19('0x6a')][_0xfc19('0x19')];_0x57b6a7++){stats[_0xfc19('0x6b')]+=0x1;if(_0x7e0a6d[_0xfc19('0x6c')][_0x57b6a7]){handleError(_0x7e0a6d[_0xfc19('0x6a')][_0x57b6a7],_0x7e0a6d['errors'][_0x57b6a7]);}else{var _0x3493ed=[];var _0x47fb9e=[];var _0x1f2e46={};for(var _0x1e47ad in _0x341d8b){let _0x24613e=contactItemTypes[_0xfc19('0x6d')](_0x4f1c53=>_0x4f1c53['name']===_0x1e47ad);let _0x3cd487=contactItemTypes[_0xfc19('0x6d')](_0x188a62=>_0x188a62[_0xfc19('0x64')]+_0xfc19('0x65')===_0x1e47ad);if(_[_0xfc19('0x1a')](_0x24613e)&&_['isNil'](_0x3cd487)){if(_0x341d8b[_0xfc19('0x6e')](_0x1e47ad)){if(_0x7e0a6d[_0xfc19('0x6a')][_0x57b6a7][_0x341d8b[_0x1e47ad]]){var _0x338e3c=_[_0xfc19('0x6f')](_0x7e0a6d[_0xfc19('0x6a')][_0x57b6a7][_0x341d8b[_0x1e47ad]]['replace'](/"/g,'\x27'));switch(_0x1e47ad){case'scheduledat':var _0xadf8f1=moment(_0x338e3c,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0xadf8f1[_0xfc19('0x70')]()){_0x5ed3af[_0xfc19('0x1c')]('\x22'+_0x338e3c+'\x22');}else{_0x3493ed[_0xfc19('0x1c')](_0xfc19('0x71'));}break;case _0xfc19('0x39'):var _0x4d5768=parseInt(_0x338e3c);_0x338e3c=_['isNaN'](_0x4d5768)||_0x4d5768<0x0||_0x4d5768>0x4?_0x47125b?0x3:0x2:_0x4d5768;_0x5ed3af[_0xfc19('0x1c')]('\x22'+_0x338e3c+'\x22');break;case _0xfc19('0x72'):var _0x7af69a=parseInt(_0x338e3c);if(_[_0xfc19('0x73')](_0x7af69a)&&_[_0xfc19('0x74')](_0x2979ab,_0x7af69a)){_0x5ed3af[_0xfc19('0x1c')]('\x22'+_0x7af69a+'\x22');}else{_0x3493ed[_0xfc19('0x1c')](_0xfc19('0x75'));}break;case _0xfc19('0x76'):if(isEmail(_0x338e3c)){_0x5ed3af['push']('\x22'+_0x338e3c+'\x22');}else{_0x3493ed[_0xfc19('0x1c')](_0xfc19('0x77'));}break;case _0xfc19('0x78'):var _0x251a25=moment(_0x338e3c,'YYYY-MM-DD',!![]);if(_0x251a25[_0xfc19('0x70')]()){_0x5ed3af[_0xfc19('0x1c')]('\x22'+_0x338e3c+'\x22');}else{_0x3493ed[_0xfc19('0x1c')](_0xfc19('0x79'));}break;default:_0x5ed3af[_0xfc19('0x1c')]('\x22'+_0x338e3c+'\x22');}}else{switch(_0x1e47ad){case'firstName':case _0xfc19('0xf'):_0x3493ed[_0xfc19('0x1c')](_0x1e47ad+'\x20not\x20specified');break;default:_0x5ed3af[_0xfc19('0x1c')]('\x22\x22');}}}}else{var _0x32e55b='';if(!_['isNil'](_0x24613e)){if(!_0x1f2e46[_0xfc19('0x6e')](_0x24613e['id'])){for(var _0x516f2c=0x0;_0x516f2c<_0x341d8b[_0x1e47ad][_0xfc19('0x19')];_0x516f2c++){var _0x338e3c=_[_0xfc19('0x6f')](_0x7e0a6d['data'][_0x57b6a7][_0x341d8b[_0x1e47ad][_0x516f2c]][_0xfc19('0x7a')](/"/g,'\x27'));var _0x42eab0=phoneDescriptions[_0xfc19('0x6d')](_0x4c1326=>_0x4c1326[_0xfc19('0x7b')]===_0x24613e['id']);if(!_[_0xfc19('0x1a')](_0x42eab0)){var _0x14810b=_[_0xfc19('0x6f')](_0x7e0a6d[_0xfc19('0x6a')][_0x57b6a7][_0x341d8b[_0x42eab0[_0xfc19('0x7c')]][0x0]][_0xfc19('0x7a')](/"/g,'\x27'));if(!_['isNil'](_0x14810b))_0x338e3c=_0x338e3c+'§'+_0x14810b;}if(_0x32e55b=='')_0x32e55b=_0x338e3c;else _0x32e55b+='|'+_0x338e3c;}_0x47fb9e['push'](_0x24613e['id']+':'+_0x32e55b);_0x1f2e46[_0x24613e['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5ed3af['push']('\x22'+_0x47fb9e[_0xfc19('0x10')](';')+'\x22');}if(_0x3493ed[_0xfc19('0x19')]){handleError(_0x7e0a6d['data'][_0x57b6a7],{'code':_0xfc19('0x7d'),'message':_0x3493ed['join']()});}else{fs[_0xfc19('0x7e')](_0x1c21a5,_0x5ed3af[_0xfc19('0x10')]()+'\x0a');}_0x5ed3af=[];}if(!(stats[_0xfc19('0x6b')]%0xc8)){socket[_0xfc19('0x7f')]('contact:import:'+_0xcbec62,stats);stats['errors']=[];}}if(stopped){logger[_0xfc19('0x58')](_0xfc19('0x80'));_0x51de0b[_0xfc19('0x81')]();}}catch(_0x3368f1){handleError(_0x7e0a6d[_0xfc19('0x6a')][_0x57b6a7],{'code':_0xfc19('0x82'),'message':_0x3368f1['message']});logger['error'](_0xfc19('0x83'),_0x3368f1[_0xfc19('0x21')]);}},'complete':function(){try{var _0x25d313=[];var _0x22983d=tempTableName;_0x25d313[_0xfc19('0x1c')](_0xfc19('0x84')+_0x22983d+_0xfc19('0x85'));logger[_0xfc19('0x58')](_0xfc19('0x86'),contactItemTypes[_0xfc19('0x19')]);var _0x50bd1e=util[_0xfc19('0xa')](_0xfc19('0x87'),_0x1c21a5,_0x22983d,_0x243b88,_0x385f40[_0xfc19('0x36')],_0x385f40[_0xfc19('0x88')]||null,NOW,NOW);if(_[_0xfc19('0x1a')](_0x341d8b[_0xfc19('0x35')])){_0x50bd1e+=',\x20scheduledAt\x20=\x20NOW()';}_0x25d313[_0xfc19('0x1c')](_0x50bd1e);BPromise[_0xfc19('0x89')](_0x25d313,handleQuery)[_0xfc19('0x1e')](function(_0xeacfb5){BPromise[_0xfc19('0x1d')]([handleAdditionalPhones()])[_0xfc19('0x1e')](function(){_0x25d313=[];for(var _0xe7b0c6=0x0;_0xe7b0c6\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','field','from','join','where','sequelize','query','select\x20*\x20from\x20','spread','isNil','AdditionalPhones','push','all','then','catch','error','split','length','filter','findOne','CmContactHasItem','update','updated','inserted','CmContact','phone','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','insert','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','select','fields','cm_contacts','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.updatedAt','cm_contacts.ListId\x20=\x20','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','toString','cm_contact_has_items.item','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_hopper','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','group','info','message','exit','code','stringify','start','clone','socket_timestamp','root','server/files/tmp','.csv','ContactItemType','findAll','name','_description','header','writeFileSync','parse','createReadStream','errors','data','find','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','rows','emit','Abort\x20parser','abort','CREATE\x20TABLE\x20'];(function(_0x4d6e5d,_0x4cf785){var _0x51c166=function(_0x30ef09){while(--_0x30ef09){_0x4d6e5d['push'](_0x4d6e5d['shift']());}};_0x51c166(++_0x4cf785);}(_0xeca8,0x1f2));var _0x8eca=function(_0x258f0b,_0x4833e3){_0x258f0b=_0x258f0b-0x0;var _0x10af40=_0xeca8[_0x258f0b];return _0x10af40;};'use strict';var fs=require('fs');var path=require(_0x8eca('0x0'));var _=require(_0x8eca('0x1'));var Papa=require(_0x8eca('0x2'));var util=require(_0x8eca('0x3'));var BPromise=require(_0x8eca('0x4'));var moment=require(_0x8eca('0x5'));var squel=require('squel');var Redis=require(_0x8eca('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0x8eca('0x7'));var logger=require(_0x8eca('0x8'))(_0x8eca('0x9'));config['redis']=_[_0x8eca('0xa')](config[_0x8eca('0xb')],{'host':_0x8eca('0xc'),'port':0x18eb});var socket=require(_0x8eca('0xd'))(new Redis(config[_0x8eca('0xb')]));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()[_0x8eca('0xe')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x8eca('0xf')+moment()[_0x8eca('0xe')](_0x8eca('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x10184f){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))*$/[_0x8eca('0x11')](_0x10184f);}function selectNotIn(_0x24b0ca,_0x40e285,_0x2653b7,_0x220093,_0x38301b){return squel['select']()[_0x8eca('0x12')]('phone')[_0x8eca('0x13')](_0x220093)[_0x8eca('0x14')](_0x40e285,null,_0x40e285+'.id\x20=\x20'+_0x220093+'.'+_0x2653b7)[_0x8eca('0x15')](_0x220093+'.'+_0x2653b7+'\x20=\x20'+_0x24b0ca+'.'+_0x2653b7)['where'](_0x40e285+'.dialCheckDuplicateType\x20IN\x20('+_0x38301b[_0x8eca('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x36b8f1,_0x2b901f){promisesAdditionalPhones=[];promisesContact=[];return db[_0x8eca('0x16')][_0x8eca('0x17')](_0x8eca('0x18')+tempTableName)[_0x8eca('0x19')](function(_0x4e390c){if(_0x4e390c!==null){var _0x15be36=[];for(var _0x1f7012=0x0;_0x1f7012<_0x4e390c['length'];_0x1f7012++){var _0x41ca2d=_0x4e390c[_0x1f7012];if(!_[_0x8eca('0x1a')](_0x41ca2d['phone'])){if(!_['isNil'](_0x41ca2d[_0x8eca('0x1b')]))_0x15be36['push'](insertAdditionalPhones(_0x41ca2d));promisesContact[_0x8eca('0x1c')]({'contact':_0x41ca2d});}}}Promise[_0x8eca('0x1d')](_0x15be36)[_0x8eca('0x1e')](function(){_0x36b8f1({'val':0x1});});})[_0x8eca('0x1f')](function(_0x5180c8){logger[_0x8eca('0x20')](_0x5180c8['message']);});});}function insertAdditionalPhones(_0x449434){return new Promise(function(_0x536d40,_0x373117){var _0x14af03=_0x449434[_0x8eca('0x1b')];if(_[_0x8eca('0x1a')](_0x14af03))_0x373117({'val':0x0});else{var _0x1cf97a=_0x14af03[_0x8eca('0x21')](';');var _0x4cecf6=[];orderBy=0x0;for(var _0xacfa9c=0x0;_0xacfa9c<_0x1cf97a['length'];_0xacfa9c++){_0x4cecf6['push'](splitAdditionalPhone(_0x449434['id'],_0x1cf97a[_0xacfa9c]));}Promise[_0x8eca('0x1d')](_0x4cecf6)[_0x8eca('0x1e')](function(){_0x536d40({'val':_0x1cf97a[_0x8eca('0x22')]});});}});}function splitAdditionalPhone(_0x14d9c9,_0x271179){return new Promise(function(_0x5ac424,_0x472c54){var _0x5484aa=_0x271179[_0x8eca('0x21')](':');var _0x15823b=_0x5484aa[0x0];var _0x18ae97=_0x5484aa[0x1];if(_0x18ae97!==''){var _0x3e1f66=_0x18ae97[_0x8eca('0x21')]('|');var _0xb3ffd7=[];for(var _0x33e4db=0x0;_0x33e4db<_0x3e1f66[_0x8eca('0x22')];_0x33e4db++){if(_0x3e1f66[_0x33e4db]!==''){var _0x4e524f=_[_0x8eca('0x23')](promisesAdditionalPhones,{'contactId':_0x14d9c9,'phone':_0x3e1f66[_0x33e4db]});if(_0x4e524f[_0x8eca('0x22')]==0x0){orderBy++;promisesAdditionalPhones[_0x8eca('0x1c')]({'contactId':_0x14d9c9,'contactTypeId':_0x15823b,'phone':_0x3e1f66[_0x33e4db],'orderBy':orderBy});}}}_0x5ac424({'ok':0x1});}else _0x5ac424({'res':0x0});});}function createAdditionalPhone(_0x205b0d,_0x1b3e41,_0x8b406b,_0x39e04f){var _0x189ecf='';var _0x36b286='';var _0x497122=_0x8b406b[_0x8eca('0x21')]('§');_0x189ecf=_0x497122[0x0];if(_0x497122[_0x8eca('0x22')]==0x2)_0x36b286=_0x497122[0x1];return new Promise(function(_0x372f13,_0x1f6ed5){return db['CmContactHasItem'][_0x8eca('0x24')]({'where':{'CmContactId':_0x205b0d,'item':_0x189ecf}})[_0x8eca('0x1e')](function(_0x3701f6){if(_0x3701f6){return db[_0x8eca('0x25')][_0x8eca('0x26')]({'ItemTypeId':_0x1b3e41,'description':_0x36b286,'OrderBy':_0x39e04f},{'where':{'CmContactId':_0x205b0d,'item':_0x189ecf}})[_0x8eca('0x1e')](function(_0x20e7ba){_0x372f13({'res':_0x8eca('0x27')});});}else{return db[_0x8eca('0x25')]['create']({'CmContactId':_0x205b0d,'item':_0x189ecf,'ItemTypeId':_0x1b3e41,'description':_0x36b286,'OrderBy':_0x39e04f,'ItemClass':'PHONE'})[_0x8eca('0x1e')](function(_0x8abf4d){_0x372f13({'res':_0x8eca('0x28')});});}});});}function updateContact(_0xe283b1){return new Promise(function(_0x3a1175,_0x194eed){var _0x220e33=_0xe283b1['id'];delete _0xe283b1['id'];return db[_0x8eca('0x29')][_0x8eca('0x26')](_0xe283b1,{'where':{'id':_0x220e33}})[_0x8eca('0x1e')](function(_0x49cee8){updatedRows+=0x1;return db['CmHopper']['update']({'phone':_0xe283b1[_0x8eca('0x2a')]},{'where':{'ContactId':_0x220e33}})[_0x8eca('0x1e')](function(_0xfaaf1f){_0x3a1175({'ret':'OK'});});});});}function insertCmHopper(_0x1d680c,_0x2fe644,_0x35b2bc,_0x2f6df4,_0xa0a7f5){var _0x35b57e=[_0x8eca('0x2b'),_0x8eca('0x2c'),_0x8eca('0x2d'),_0x8eca('0x2e'),_0x2fe644+'.'+_0x2f6df4,_0x8eca('0x2f'),'cm_contacts.updatedAt',_0x8eca('0x30'),'cm_contacts.UserId','\x22'+_0xa0a7f5+'\x22'];return squel[_0x8eca('0x31')]()[_0x8eca('0x32')]('cm_hopper')[_0x8eca('0x33')](['phone',_0x8eca('0x34'),_0x8eca('0x35'),_0x8eca('0x36'),_0x2f6df4,_0x8eca('0x37'),_0x8eca('0x38'),_0x8eca('0x39'),_0x8eca('0x3a'),_0x8eca('0x3b')],squel[_0x8eca('0x3c')]()[_0x8eca('0x3d')](_0x35b57e)[_0x8eca('0x13')](_0x2fe644)[_0x8eca('0x14')](_0x8eca('0x3e'),null,'cm_contacts.ListId\x20=\x20'+_0x2fe644+_0x8eca('0x3f'))[_0x8eca('0x14')](_0x35b2bc,null,_0x35b2bc+_0x8eca('0x40')+_0x2fe644+'.'+_0x2f6df4)['where'](_0x2fe644+_0x8eca('0x41'),_0x1d680c)['where'](_0x8eca('0x42'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2fe644,_0x35b2bc,_0x2f6df4,'cm_hopper',[_0x8eca('0x43'),'\x22onlyIfOpen\x22']))[_0x8eca('0x15')](_0x8eca('0x44'),selectNotIn(_0x2fe644,_0x35b2bc,_0x2f6df4,'cm_hopper',[_0x8eca('0x43')])))['toString']();}function insertCmHopperBlack(_0x489666,_0x4bdcc5,_0x569b60,_0x29f030){var _0x5135e8=[_0x8eca('0x2b'),_0x8eca('0x2d'),'cm_contacts.ListId',_0x4bdcc5+'.'+_0x29f030,_0x8eca('0x2f'),_0x8eca('0x45')];return squel[_0x8eca('0x31')]()[_0x8eca('0x32')]('cm_hopper_black')[_0x8eca('0x33')]([_0x8eca('0x2a'),_0x8eca('0x35'),'ListId',_0x29f030,_0x8eca('0x37'),_0x8eca('0x38')],squel[_0x8eca('0x3c')]()[_0x8eca('0x3d')](_0x5135e8)[_0x8eca('0x13')](_0x4bdcc5)['join'](_0x8eca('0x3e'),null,_0x8eca('0x46')+_0x4bdcc5+_0x8eca('0x3f'))[_0x8eca('0x14')](_0x569b60,null,_0x569b60+'.id\x20=\x20'+_0x4bdcc5+'.'+_0x29f030)['where'](_0x4bdcc5+'.CmListId\x20=\x20?',_0x489666)[_0x8eca('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x8eca('0x15')](_0x8eca('0x44'),squel['select']()[_0x8eca('0x12')](_0x8eca('0x2a'))['from'](_0x8eca('0x47'))['where'](_0x8eca('0x48'),_0x489666)[_0x8eca('0x15')](_0x29f030+_0x8eca('0x49'),_0x4bdcc5+'.'+_0x29f030)))[_0x8eca('0x4a')]();}function insertCmHopperAdditionalPhones(_0x5dd642){var _0x5cea41=['cm_hopper.id',_0x8eca('0x4b'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0x8eca('0x4c')];return squel[_0x8eca('0x31')]()[_0x8eca('0x32')](_0x8eca('0x4d'))[_0x8eca('0x33')]([_0x8eca('0x4e'),'phone',_0x8eca('0x4f'),_0x8eca('0x37'),'updatedAt'],squel[_0x8eca('0x3c')]()[_0x8eca('0x3d')](_0x5cea41)['from'](_0x8eca('0x50'))[_0x8eca('0x14')](_0x8eca('0x3e'),null,_0x8eca('0x51'))['join']('cm_contact_has_items',null,_0x8eca('0x52'))['where'](_0x8eca('0x53'),_0x5dd642)[_0x8eca('0x15')](_0x8eca('0x42'),NOW))[_0x8eca('0x4a')]();}function insertCmContact(_0x1af9fb,_0x45da41,_0x3f5a85,_0x5eed95){var _0xfdd3ab=_[_0x8eca('0x54')](_[_0x8eca('0x55')](_0x5eed95),[_0x8eca('0x36'),'CompanyId',_0x8eca('0x37'),_0x8eca('0x38')]);return squel[_0x8eca('0x31')]()['into'](_0x8eca('0x3e'))['fromQuery'](_0xfdd3ab,squel[_0x8eca('0x3c')]()[_0x8eca('0x3d')](_0xfdd3ab)[_0x8eca('0x13')](_0x45da41)[_0x8eca('0x15')]('('+_0x3f5a85[_0x8eca('0x14')](',')+_0x8eca('0x56'),squel[_0x8eca('0x3c')]()[_0x8eca('0x3d')](_0x3f5a85)[_0x8eca('0x13')](_0x8eca('0x3e'))[_0x8eca('0x15')](_0x8eca('0x48'),_0x1af9fb))['where'](_0x8eca('0x57'),squel[_0x8eca('0x3c')]()['field'](_0x8eca('0x58'),'min_id')[_0x8eca('0x13')](_0x45da41)[_0x8eca('0x59')](_0x3f5a85[_0x8eca('0x14')](','))))['toString']();}function handleStop(){logger[_0x8eca('0x5a')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x9ef9e9){logger[_0x8eca('0x20')](_0x9ef9e9[_0x8eca('0x5b')]);process[_0x8eca('0x5c')](0x1);}function handleError(_0x61d452,_0x480713){stats['errors'][_0x8eca('0x1c')]({'name':_0x480713[_0x8eca('0x5d')],'message':_0x480713[_0x8eca('0x5b')],'row':_0x61d452});}function handleQuery(_0x380eac){logger[_0x8eca('0x5a')](_0x380eac);return db['sequelize'][_0x8eca('0x17')](_0x380eac)[_0x8eca('0x19')](function(_0x4366a0){results[_0x8eca('0x1c')](_0x4366a0);})[_0x8eca('0x1f')](function(_0x3f5274){logger[_0x8eca('0x20')](_0x3f5274['message']);});}function main(_0xb86773,_0x35e24e,_0x54ef41,_0x163541){logger['info']('main',_0xb86773,JSON[_0x8eca('0x5e')](_0x35e24e));process['send'](_0x8eca('0x5f'));var _0x20ab07=_0x35e24e['binding'];var _0x1178a2=_[_0x8eca('0x60')](_0x20ab07);var _0xcd593a=_0x35e24e[_0x8eca('0x61')];var _0x8e61a5=path[_0x8eca('0x14')](config[_0x8eca('0x62')],_0x8eca('0x63'),_0xcd593a+_0x8eca('0x64'));logger[_0x8eca('0x5a')]('body',_0x35e24e);db[_0x8eca('0x65')][_0x8eca('0x66')]({'raw':!![],'attributes':['id',_0x8eca('0x67')]})[_0x8eca('0x1e')](function(_0x4921e2){for(var _0x57d28d=0x0;_0x57d28d<_0x4921e2['length'];_0x57d28d++){if(_0x4921e2[_0x57d28d][_0x8eca('0x67')]in _0x20ab07){contactItemTypes[_0x8eca('0x1c')](_0x4921e2[_0x57d28d]);delete _0x1178a2[_0x4921e2[_0x57d28d][_0x8eca('0x67')]];hasAdditionalPhones=!![];}for(var _0x528df7 in _0x20ab07){if(_0x4921e2[_0x57d28d][_0x8eca('0x67')]+_0x8eca('0x68')===_0x528df7){phoneDescriptions[_0x8eca('0x1c')]({'itemTypeId':_0x4921e2[_0x57d28d]['id'],'description':_0x528df7});delete _0x1178a2[_0x528df7];}}}if(hasAdditionalPhones)_0x1178a2['AdditionalPhones']='';var _0x3a0025=_['keys'](_0x1178a2)[_0x8eca('0x14')]();logger[_0x8eca('0x5a')](_0x8eca('0x69'),_0x3a0025);fs[_0x8eca('0x6a')](_0x8e61a5,_0x3a0025+'\x0a');Papa[_0x8eca('0x6b')](fs[_0x8eca('0x6c')](_0xb86773),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2c0631,_0x11cfb6){try{for(var _0x3d9df4=0x0,_0x5b71bc=[];_0x3d9df4<_0x2c0631['data'][_0x8eca('0x22')];_0x3d9df4++){stats['rows']+=0x1;if(_0x2c0631[_0x8eca('0x6d')][_0x3d9df4]){handleError(_0x2c0631[_0x8eca('0x6e')][_0x3d9df4],_0x2c0631[_0x8eca('0x6d')][_0x3d9df4]);}else{var _0x2e7991=[];var _0x166f21=[];var _0x1f9ecb={};for(var _0x28f71a in _0x20ab07){let _0x191d34=contactItemTypes[_0x8eca('0x6f')](_0x395497=>_0x395497[_0x8eca('0x67')]===_0x28f71a);let _0x52fa88=contactItemTypes[_0x8eca('0x6f')](_0x3cae49=>_0x3cae49[_0x8eca('0x67')]+'_description'===_0x28f71a);if(_[_0x8eca('0x1a')](_0x191d34)&&_[_0x8eca('0x1a')](_0x52fa88)){if(_0x20ab07['hasOwnProperty'](_0x28f71a)){if(_0x2c0631['data'][_0x3d9df4][_0x20ab07[_0x28f71a]]){var _0x3e725e=_[_0x8eca('0x70')](_0x2c0631['data'][_0x3d9df4][_0x20ab07[_0x28f71a]][_0x8eca('0x71')](/"/g,'\x27'));switch(_0x28f71a){case _0x8eca('0x34'):var _0x5d1841=moment(_0x3e725e,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x5d1841['isValid']()){_0x5b71bc[_0x8eca('0x1c')]('\x22'+_0x3e725e+'\x22');}else{_0x2e7991[_0x8eca('0x1c')](_0x8eca('0x72'));}break;case _0x8eca('0x39'):var _0x184cdc=parseInt(_0x3e725e);_0x3e725e=_[_0x8eca('0x73')](_0x184cdc)||_0x184cdc<0x0||_0x184cdc>0x4?_0x163541?0x3:0x2:_0x184cdc;_0x5b71bc[_0x8eca('0x1c')]('\x22'+_0x3e725e+'\x22');break;case _0x8eca('0x3a'):var _0xd74de7=parseInt(_0x3e725e);if(_['isNumber'](_0xd74de7)&&_[_0x8eca('0x74')](_0x54ef41,_0xd74de7)){_0x5b71bc['push']('\x22'+_0xd74de7+'\x22');}else{_0x2e7991['push'](_0x8eca('0x75'));}break;case _0x8eca('0x76'):if(isEmail(_0x3e725e)){_0x5b71bc[_0x8eca('0x1c')]('\x22'+_0x3e725e+'\x22');}else{_0x2e7991[_0x8eca('0x1c')](_0x8eca('0x77'));}break;case _0x8eca('0x78'):var _0x13c7ec=moment(_0x3e725e,_0x8eca('0x79'),!![]);if(_0x13c7ec['isValid']()){_0x5b71bc[_0x8eca('0x1c')]('\x22'+_0x3e725e+'\x22');}else{_0x2e7991['push'](_0x8eca('0x7a'));}break;default:_0x5b71bc[_0x8eca('0x1c')]('\x22'+_0x3e725e+'\x22');}}else{switch(_0x28f71a){case _0x8eca('0x7b'):case _0x8eca('0x2a'):_0x2e7991[_0x8eca('0x1c')](_0x28f71a+_0x8eca('0x7c'));break;default:_0x5b71bc['push']('\x22\x22');}}}}else{var _0x273dfc='';if(!_[_0x8eca('0x1a')](_0x191d34)){if(!_0x1f9ecb['hasOwnProperty'](_0x191d34['id'])){for(var _0x33da06=0x0;_0x33da06<_0x20ab07[_0x28f71a][_0x8eca('0x22')];_0x33da06++){var _0x3e725e=_[_0x8eca('0x70')](_0x2c0631['data'][_0x3d9df4][_0x20ab07[_0x28f71a][_0x33da06]][_0x8eca('0x71')](/"/g,'\x27'));var _0x1ffa2e=phoneDescriptions[_0x8eca('0x6f')](_0x13a4d4=>_0x13a4d4[_0x8eca('0x7d')]===_0x191d34['id']);if(!_[_0x8eca('0x1a')](_0x1ffa2e)){var _0xa22072=_[_0x8eca('0x70')](_0x2c0631[_0x8eca('0x6e')][_0x3d9df4][_0x20ab07[_0x1ffa2e[_0x8eca('0x7e')]][0x0]][_0x8eca('0x71')](/"/g,'\x27'));if(!_['isNil'](_0xa22072))_0x3e725e=_0x3e725e+'§'+_0xa22072;}if(_0x273dfc=='')_0x273dfc=_0x3e725e;else _0x273dfc+='|'+_0x3e725e;}_0x166f21[_0x8eca('0x1c')](_0x191d34['id']+':'+_0x273dfc);_0x1f9ecb[_0x191d34['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5b71bc['push']('\x22'+_0x166f21[_0x8eca('0x14')](';')+'\x22');}if(_0x2e7991[_0x8eca('0x22')]){handleError(_0x2c0631[_0x8eca('0x6e')][_0x3d9df4],{'code':_0x8eca('0x7f'),'message':_0x2e7991[_0x8eca('0x14')]()});}else{fs[_0x8eca('0x80')](_0x8e61a5,_0x5b71bc[_0x8eca('0x14')]()+'\x0a');}_0x5b71bc=[];}if(!(stats[_0x8eca('0x81')]%0xc8)){socket[_0x8eca('0x82')]('contact:import:'+_0xcd593a,stats);stats[_0x8eca('0x6d')]=[];}}if(stopped){logger[_0x8eca('0x5a')](_0x8eca('0x83'));_0x11cfb6[_0x8eca('0x84')]();}}catch(_0x1c1ab5){handleError(_0x2c0631[_0x8eca('0x6e')][_0x3d9df4],{'code':'SystemError','message':_0x1c1ab5['message']});logger[_0x8eca('0x20')]('step',_0x1c1ab5[_0x8eca('0x5b')]);}},'complete':function(){try{var _0x501642=[];var _0x3a4c9e=tempTableName;_0x501642['push'](_0x8eca('0x85')+_0x3a4c9e+_0x8eca('0x86'));logger['info'](_0x8eca('0x87'),contactItemTypes[_0x8eca('0x22')]);var _0x2d1898=util[_0x8eca('0xe')](_0x8eca('0x88'),_0x8e61a5,_0x3a4c9e,_0x3a0025,_0x35e24e['ListId'],_0x35e24e['CompanyId']||null,NOW,NOW);if(_[_0x8eca('0x1a')](_0x20ab07['scheduledat'])){_0x2d1898+=_0x8eca('0x89');}_0x501642[_0x8eca('0x1c')](_0x2d1898);BPromise[_0x8eca('0x8a')](_0x501642,handleQuery)[_0x8eca('0x1e')](function(_0x109f1e){BPromise['all']([handleAdditionalPhones()])[_0x8eca('0x1e')](function(){_0x501642=[];for(var _0x26099d=0x0;_0x26099d\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','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.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','getSelectedTags','isEmpty','t.id\x20IN\x20?','exports','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','getAccountFK','agent','search','select','field','color','tools_tags','getInteractionFK','_interactions','u.id','u.fullname','ui.','from'];(function(_0x202ea3,_0x38ab41){var _0x58787b=function(_0x1dce0b){while(--_0x1dce0b){_0x202ea3['push'](_0x202ea3['shift']());}};_0x58787b(++_0x38ab41);}(_0xf23c,0x13e));var _0xcf23=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0xf23c[_0x5c6244];return _0x5800ce;};'use strict';var _=require(_0xcf23('0x0'));var squel=require('squel');var as=require(_0xcf23('0x1'));var qs=require(_0xcf23('0x2'));var updateInteraction=require(_0xcf23('0x3'))[_0xcf23('0x4')];var utils=require('./utils');var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x3dbca5,_0x326c60,_0xcae9e){var _0x2e6457=![];var _0x4d4575=utils[_0xcf23('0x5')](_0x3dbca5);if(_0x326c60['role']===_0xcf23('0x6')&&!_0xcae9e[_0xcf23('0x7')]&&!_0xcae9e[_0x4d4575]){_0x2e6457=!![];}return _0x2e6457;}function getTagsQuery(){return squel[_0xcf23('0x8')]()[_0xcf23('0x9')]('id')['field']('name')[_0xcf23('0x9')](_0xcf23('0xa'))['from'](_0xcf23('0xb'));}function getUsersQuery(_0x518c55,_0x1e2e1b){var _0x375a34=utils[_0xcf23('0xc')](_0x518c55);var _0x4861ca='user_has_'+_0x518c55+_0xcf23('0xd');var _0x45bdcb=squel['select']()[_0xcf23('0x9')](_0xcf23('0xe'))['field'](_0xcf23('0xf'))[_0xcf23('0x9')](_0xcf23('0x10')+_0x375a34)[_0xcf23('0x11')](_0x4861ca,'ui')[_0xcf23('0x12')](_0xcf23('0x13'),'u',_0xcf23('0x14'));if(_0x1e2e1b[_0xcf23('0x15')]>0x0){_0x45bdcb[_0xcf23('0x16')](_0xcf23('0x10')+_0x375a34+_0xcf23('0x17'),_['map'](_0x1e2e1b,'id'));}return _0x45bdcb;}function getInteractionsQuery(_0x37bb7e){var _0x26f968=utils[_0xcf23('0x18')](_0x37bb7e);var _0x56c08f=utils[_0xcf23('0x5')](_0x37bb7e);var _0x1ec837=utils['getInteractionFK'](_0x37bb7e);return squel[_0xcf23('0x8')]()[_0xcf23('0x11')](_0x26f968[_0xcf23('0x19')],'i')[_0xcf23('0x12')](_0xcf23('0x1a'),'c',_0xcf23('0x1b'))[_0xcf23('0x12')](_0xcf23('0x13'),'o',_0xcf23('0x1c'))[_0xcf23('0x12')](_0x26f968[_0xcf23('0x1d')],'a','a.id\x20=\x20i.'+_0x56c08f)[_0xcf23('0x12')](_0x26f968[_0xcf23('0x1e')],'me',_0xcf23('0x1f')+_0x1ec837+'\x20=\x20i.id')['left_join'](_0x26f968[_0xcf23('0x20')],'it',_0xcf23('0x21')+_0x1ec837+_0xcf23('0x22'))['left_join'](_0xcf23('0xb'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0xe02220={'body':squel[_0xcf23('0x23')](),'contact':squel[_0xcf23('0x23')](),'default':squel[_0xcf23('0x23')](),'fields':squel[_0xcf23('0x23')](),'filter':squel[_0xcf23('0x23')](),'read':squel[_0xcf23('0x23')](),'tags':{'clause':squel[_0xcf23('0x23')](),'ids':null},'user':squel[_0xcf23('0x23')]()};return _0xe02220;}function parseTagParameter(_0x56f392){var _0x1dd560=squel[_0xcf23('0x23')]();if(_0x56f392){var _0xd4b243=utils['getSelectedTags'](_0x56f392);_0xd4b243['forEach'](function(_0x52867d){_0x1dd560['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x52867d+',%');});}return _0x1dd560;}function parseReadParameter(_0x3a95bc){var _0x3963cb='';if(_0x3a95bc){_0x3963cb='unreadMessages\x20{OPERATOR}\x200';if(_0x3a95bc==='1'){_0x3963cb=_0x3963cb['replace']('{OPERATOR}','=');}else{_0x3963cb=_0x3963cb[_0xcf23('0x24')](_0xcf23('0x25'),'>');}}return _0x3963cb;}function parseSearchFilter(_0x3c5411,_0x5c7078){var _0x3c117e=squel['expr']();if(_0x5c7078){var _0x5b7429=_0x5c7078[_0xcf23('0x24')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');var _0x21eda5=qs[_0xcf23('0x26')](_0x5b7429);if(qs[_0xcf23('0x27')](_0x5b7429)){_0x3c117e['or'](_0xcf23('0x28'),_0x21eda5+'%');if([_0xcf23('0x29'),_0xcf23('0x2a')][_0xcf23('0x2b')](_0x3c5411)){_0x3c117e['or']('i.phone\x20LIKE\x20?',_0x21eda5+'%');}else if(_0x3c5411==='fax'){_0x3c117e['or'](_0xcf23('0x2c'),_0x21eda5+'%');}else if(_0x3c5411===_0xcf23('0x2d')){_0x3c117e['or'](_0xcf23('0x2e'),_0x21eda5+'%');}}else if(_0x3c5411===_0xcf23('0x2f')&&qs[_0xcf23('0x30')](_0x5b7429)){_0x3c117e['or'](_0xcf23('0x31'),_0x21eda5+'%');}else{if(_0x3c5411===_0xcf23('0x2f')){_0x3c117e['or'](_0xcf23('0x32'),qs['getFullTextValue'](_0x5b7429,!![]))['or'](_0xcf23('0x33'),qs[_0xcf23('0x34')](_0x5b7429));}else if(_0x3c5411!=='fax'){_0x3c117e['or'](_0xcf23('0x35'),qs['getFullTextValue'](_0x5b7429));}_0x3c117e['or'](_0xcf23('0x36'),qs[_0xcf23('0x34')](_0x5b7429,!![]),null);}}return _0x3c117e;}function parseAdvancedSearchFilter(_0x3d4c6f,_0x3967f3){var _0x11a551=getSqlClauses();var _0xaa23e=as[_0xcf23('0x37')](_0x3d4c6f);var _0x3d9133=_0xaa23e['sqlOperator'];for(var _0x2b56ba=0x0;_0x2b56ba<_0xaa23e['conditions']['length'];_0x2b56ba++){var _0x29a59d=_0xaa23e[_0xcf23('0x38')][_0x2b56ba];var _0x46c781='i';var _0x279387=_[_0xcf23('0x39')](_0x3967f3,['name',_0x29a59d[_0xcf23('0x9')]]);if(_0x279387){var _0x10e683=as[_0xcf23('0x3a')](_0x46c781,_0x279387['type'],_0x29a59d);_0x11a551[_0xcf23('0x3b')][_0x3d9133](_0x10e683[_0xcf23('0x3c')],_0x10e683[_0xcf23('0x3d')][_0xcf23('0x3e')],_0x10e683[_0xcf23('0x3d')]['end']);}else{switch(_0x29a59d[_0xcf23('0x9')]){case _0xcf23('0x3f'):var _0xc5019b=parseReadParameter(_0x29a59d[_0xcf23('0x3d')]);_0x11a551[_0xcf23('0x40')]['and'](_0xc5019b);break;case'Contact':if(_0x29a59d[_0xcf23('0x41')]===_0xcf23('0x42')){if(_0x29a59d['value'][_0xcf23('0x43')]('\x20')[_0xcf23('0x15')]>0x1){_0x11a551['contact'][_0x3d9133]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcf23('0x34')](_0x29a59d[_0xcf23('0x3d')],!![]),null);}else{var _0x2c563d='%'+_0x29a59d['value']+'%';_0x11a551[_0xcf23('0x44')][_0x3d9133]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2c563d,_0x2c563d,_0x2c563d);}}else{_0x279387=_[_0xcf23('0x39')](_0x3967f3,[_0xcf23('0x45'),_0xcf23('0x46')]);_0x29a59d[_0xcf23('0x9')]=_0xcf23('0x46');_0x10e683=as[_0xcf23('0x3a')](_0x46c781,_0x279387[_0xcf23('0x47')],_0x29a59d);_0x11a551[_0xcf23('0x44')][_0x3d9133](_0x10e683[_0xcf23('0x3c')],_0x10e683['value'][_0xcf23('0x3e')],_0x10e683[_0xcf23('0x3d')][_0xcf23('0x48')]);}break;case _0xcf23('0x49'):var _0x58fa72=_0x29a59d['value'][_0xcf23('0x43')](',')[_0xcf23('0x4a')](function(_0x3b75f5){return Number(_0x3b75f5);});var _0x67d989=parseTagParameter(_0x58fa72);_0x11a551[_0xcf23('0x4b')][_0xcf23('0x4c')][_0xcf23('0x4d')](_0x67d989);_0x11a551['tags'][_0xcf23('0x4e')]=_0x58fa72;break;case _0xcf23('0x4f'):if(_0x29a59d[_0xcf23('0x41')]===_0xcf23('0x42')){_0x11a551[_0xcf23('0x50')][_0x3d9133](_0xcf23('0x51'),'%'+_0x29a59d[_0xcf23('0x3d')]+'%',null);}else{_0x279387=_[_0xcf23('0x39')](_0x3967f3,[_0xcf23('0x45'),'UserId']);_0x29a59d['field']=_0xcf23('0x52');_0x10e683=as[_0xcf23('0x3a')](_0x46c781,_0x279387['type'],_0x29a59d);_0x11a551['user'][_0x3d9133](_0x10e683['text'],_0x10e683[_0xcf23('0x3d')][_0xcf23('0x3e')],_0x10e683['value'][_0xcf23('0x48')]);}break;case _0xcf23('0x53'):case'plainBody':_0x10e683=as['buildExpression']('me',null,_0x29a59d);_0x11a551[_0xcf23('0x53')][_0x3d9133](_0x10e683[_0xcf23('0x3c')],_0x10e683[_0xcf23('0x3d')][_0xcf23('0x3e')],_0x10e683[_0xcf23('0x3d')][_0xcf23('0x48')]);break;}}}return _0x11a551;}function parseModelFields(_0x3710cc,_0x57c573,_0x1cf3cf){var _0x5c4620=utils[_0xcf23('0x5')](_0x3710cc);var _0x1ee2c1=squel[_0xcf23('0x23')]();var _0x4f47c0=_(_0x57c573)[_0xcf23('0x54')]()[_0xcf23('0x4a')](function(_0x32a709){return _[_0xcf23('0x55')](_0x1cf3cf,['name',_0x32a709])?_0x32a709:undefined;})[_0xcf23('0x56')]()['value']();if(_0x4f47c0[_0xcf23('0x15')]>0x0){_0x4f47c0['forEach'](function(_0x541bf2){if(_0x541bf2===_0x5c4620){_0x1ee2c1[_0xcf23('0x4d')]('i.'+_0x5c4620+'\x20IN\x20?',[]['concat'](_0x57c573[_0x541bf2]));}else if(_0x541bf2===_0xcf23('0x57')){var _0xdbcbea=JSON[_0xcf23('0x58')](_0x57c573[_0x541bf2])[_0xcf23('0x59')];var _0x17ff4b=JSON[_0xcf23('0x58')](_0x57c573[_0x541bf2])[_0xcf23('0x5a')];_0x1ee2c1[_0xcf23('0x4d')](_0xcf23('0x5b'),_0xdbcbea,_0x17ff4b);}else{if(_0x57c573[_0x541bf2]===_0xcf23('0x5c')){_0x1ee2c1[_0xcf23('0x4d')]('i.'+_0x541bf2+_0xcf23('0x5d'));}else{_0x1ee2c1['and']('i.'+_0x541bf2+'\x20=\x20?',_0x57c573[_0x541bf2]);}}});}return _0x1ee2c1;}function parseQueryParameters(_0xedb25d,_0xd17854,_0xacaca8){var _0x563916=getSqlClauses();return Promise[_0xcf23('0x5e')]()[_0xcf23('0x5f')](function(){return parseModelFields(_0xedb25d,_0xd17854,_0xacaca8);})[_0xcf23('0x5f')](function(_0x55c546){_0x563916[_0xcf23('0x60')][_0xcf23('0x4d')](_0x55c546);return parseReadParameter(_0xd17854['read']);})[_0xcf23('0x5f')](function(_0x4e07d7){_0x563916[_0xcf23('0x40')][_0xcf23('0x4d')](_0x4e07d7);return parseTagParameter(_0xd17854[_0xcf23('0x61')]);})[_0xcf23('0x5f')](function(_0x536614){_0x563916[_0xcf23('0x4b')][_0xcf23('0x4c')][_0xcf23('0x4d')](_0x536614);return parseSearchFilter(_0xedb25d,_0xd17854[_0xcf23('0x62')]);})[_0xcf23('0x5f')](function(_0x487041){_0x563916['filter']=_0x487041;return _0x563916;});}function checkAccountsRestrictions(_0x380e20,_0x4f74cd,_0xd9e6a9){var _0x488d58=utils[_0xcf23('0x5')](_0x380e20);var _0x5f521d='get'+_['capitalize'](_0x380e20)+(_0x380e20===_0xcf23('0x63')?_0xcf23('0x64'):_0xcf23('0x65'));var _0x54e0cb=squel[_0xcf23('0x23')]();return Promise['resolve']()[_0xcf23('0x5f')](function(){if(_0xd9e6a9[_0xcf23('0x7')]&&_0x4f74cd[_0xcf23('0x66')]===_0xcf23('0x6')){return _0x4f74cd[_0x5f521d]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x84cf56){if(_0x84cf56){if(_0x84cf56['length']===0x0){_0x54e0cb[_0xcf23('0x4d')]('i.'+_0x488d58+_0xcf23('0x5d'));}else{_0x54e0cb[_0xcf23('0x4d')]('i.'+_0x488d58+_0xcf23('0x17'),_[_0xcf23('0x4a')](_0x84cf56,'id'));}}else if(!_0xd9e6a9[_0x488d58]){_0x54e0cb[_0xcf23('0x4d')]('i.'+_0x488d58+_0xcf23('0x67'));}})['then'](function(){return _0x54e0cb;});}function getClosedOrderClause(_0x4582f9,_0x3ce62a){var _0x462542='';var _0x3e871c=['i.thirdDisposition',_0xcf23('0x68'),'i.disposition'];if(_0x4582f9===_0xcf23('0x2f')){_0x3e871c[_0xcf23('0x69')](_0xcf23('0x6a'));}if(_0x3ce62a['closed']==='0'&&_0x4582f9===_0xcf23('0x2f')){_0x462542=_0xcf23('0x6a');}else{if(_0x3ce62a[_0xcf23('0x6b')]==='1'){_0x3e871c[_0xcf23('0x6c')]();}_0x462542=_0xcf23('0x6d')+_0x3e871c[_0xcf23('0x6e')](',\x20')+')';}return _0x462542;}function getFilteredInteractions(_0x54bebf,_0x5563a4,_0x12542c,_0x112487){var _0x7d77f6=utils['getInteractionFK'](_0x54bebf);var _0x5e81db=_[_0xcf23('0x6f')](_0x54bebf)+'Interaction';var _0x369dea=[];var _0x235476=getTagsQuery();var _0x288ac7={'type':db[_0xcf23('0x70')][_0xcf23('0x71')][_0xcf23('0x72')],'raw':!![]};var _0x12132f=[];var _0x3d7d5d=[];return db['sequelize'][_0xcf23('0x73')](_0x235476[_0xcf23('0x74')](),_0x288ac7)[_0xcf23('0x5f')](function(_0x17da19){_0x369dea=_[_0xcf23('0x75')](_0x17da19,'id');_0x288ac7=_['merge'](_0x288ac7,{'model':db[_0x5e81db],'mapToModel':!![],'nest':!![]});if(_0x12542c[_0xcf23('0x60')]){_0x112487[_0xcf23('0x76')][_0xcf23('0x77')](function(_0x5f522f){_0x5563a4['field']('i.'+_0x5f522f);});}else{_0x5563a4[_0xcf23('0x9')](_0xcf23('0x78'),_0xcf23('0x3f'));_0x5563a4[_0xcf23('0x9')](_0xcf23('0x79'),_0xcf23('0x7a'));_0x5563a4[_0xcf23('0x9')](_0xcf23('0x7b'),_0xcf23('0x7c'));if(_0x54bebf===_0xcf23('0x2f')){_0x5563a4['field'](_0xcf23('0x7d'),'Account.email');_0x5563a4[_0xcf23('0x9')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x5563a4['field'](_0xcf23('0x7e'));_0x5563a4[_0xcf23('0x9')]('i.createdAt');_0x5563a4[_0xcf23('0x9')](_0xcf23('0x7f'));_0x5563a4[_0xcf23('0x9')](_0xcf23('0x80'));_0x5563a4['field']('i.closedAt');_0x5563a4[_0xcf23('0x9')](_0xcf23('0x81'));_0x5563a4['field'](_0xcf23('0x82'));_0x5563a4[_0xcf23('0x9')](_0xcf23('0x83'));_0x5563a4[_0xcf23('0x9')](_0xcf23('0x84'));_0x5563a4['field']('i.disposition');_0x5563a4[_0xcf23('0x9')](_0xcf23('0x68'));_0x5563a4[_0xcf23('0x9')](_0xcf23('0x85'));_0x5563a4[_0xcf23('0x9')](_0xcf23('0x6a'));_0x5563a4[_0xcf23('0x9')](_0xcf23('0x86'));_0x5563a4[_0xcf23('0x9')](_0xcf23('0x87'));_0x5563a4[_0xcf23('0x9')](_0xcf23('0x88'));_0x5563a4[_0xcf23('0x9')](_0xcf23('0x89'));}else if(_0x54bebf===_0xcf23('0x2d')){_0x5563a4[_0xcf23('0x9')](_0xcf23('0x8a'),_0xcf23('0x8b'));}else{_0x5563a4[_0xcf23('0x9')](_0xcf23('0x8c'),_0xcf23('0x8b'));}if(_0x54bebf!==_0xcf23('0x2f')){_0x5563a4[_0xcf23('0x9')](_0xcf23('0x8d'));}_0x5563a4['field'](_0xcf23('0x8e'),_0xcf23('0x8f'));_0x5563a4[_0xcf23('0x9')](_0xcf23('0x90'),'Contact.lastName');_0x5563a4['field'](_0xcf23('0x91'),_0xcf23('0x92'));_0x5563a4['field'](_0xcf23('0x93'),'Contact.phone');_0x5563a4[_0xcf23('0x9')](_0xcf23('0x94'),'Contact.mobile');_0x5563a4[_0xcf23('0x9')]('c.fax',_0xcf23('0x95'));_0x5563a4[_0xcf23('0x9')](_0xcf23('0x96'),_0xcf23('0x97'));_0x5563a4[_0xcf23('0x9')]('o.internal',_0xcf23('0x98'));_0x5563a4[_0xcf23('0x9')](_0xcf23('0x99'),_0xcf23('0x9a'));}if(_0x112487[_0xcf23('0x9b')]){_0x5563a4['limit'](_0x112487[_0xcf23('0x9b')]);}if(_0x112487[_0xcf23('0x9c')]){_0x5563a4[_0xcf23('0x9c')](_0x112487['offset']);}return db[_0xcf23('0x9d')]['query'](_0x5563a4[_0xcf23('0x74')](),_0x288ac7);})[_0xcf23('0x5f')](function(_0x1f58c2){_0x12132f=_0x1f58c2;var _0x352d7c=getUsersQuery(_0x54bebf,_0x12132f);return db[_0xcf23('0x9d')][_0xcf23('0x73')](_0x352d7c[_0xcf23('0x74')](),_0x288ac7);})[_0xcf23('0x5f')](function(_0x17b013){_0x3d7d5d=_['groupBy'](_0x17b013,_0x7d77f6);if(_0x54bebf===_0xcf23('0x2f')){return db[_0xcf23('0x9e')][_0xcf23('0x9f')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0xcf23('0x5f')](function(_0x438710){var _0x1a501e=_0x438710?_0x438710[_0xcf23('0xa0')]:undefined;var _0x33b377=_0x12132f[_0xcf23('0x4a')](function(_0x291451){return updateInteraction(_0x291451,_0x369dea,_0x3d7d5d,_0x1a501e);});return Promise[_0xcf23('0xa1')](_0x33b377);});}function countFilteredInteractions(_0x982b4,_0x1a7f6e){var _0x5192ae=_0x982b4[_0xcf23('0xa2')]();_0x5192ae[_0xcf23('0x9')](_0xcf23('0xa3'));_0x5192ae['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');var _0x4ba727=utils[_0xcf23('0xa4')](_0x1a7f6e);if(!_[_0xcf23('0xa5')](_0x4ba727)){_0x5192ae['where'](_0xcf23('0xa6'),_0x4ba727);}var _0x2576ab={'type':db['Sequelize'][_0xcf23('0x71')][_0xcf23('0x72')],'raw':!![]};return db[_0xcf23('0x9d')][_0xcf23('0x73')](_0x5192ae[_0xcf23('0x74')](),_0x2576ab);}module[_0xcf23('0xa7')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x869e=['type','default','text','start','value','unreadMessages','and','Contact','$substring','split','contact','ContactId','end','Tag','tags','clause','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','body','plainBody','compact','\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','then','fields','read','filter','get','capitalize','chat','Websites','Accounts','resolve','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','Interaction','Sequelize','sequelize','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','a.email','contactName','i.id','i.createdAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','openchannel','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','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','COUNT(*)','t.id\x20IN\x20?','QueryTypes','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','user_has_','_interactions','u.id','ui.','left_join','u.id\x20=\x20ui.UserId','map','getInteractionsTables','getInteractionFK','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','replace','{OPERATOR}','escapeLIKESpecialChars','sms','whatsapp','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','i.from\x20LIKE\x20?','c.email\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','conditions','length','find','buildExpression'];(function(_0x5ba206,_0x19ae8b){var _0x52c199=function(_0x5a06a5){while(--_0x5a06a5){_0x5ba206['push'](_0x5ba206['shift']());}};_0x52c199(++_0x19ae8b);}(_0x869e,0x1b0));var _0xe869=function(_0x9ffa53,_0x5d2878){_0x9ffa53=_0x9ffa53-0x0;var _0x5bc2f9=_0x869e[_0x9ffa53];return _0x5bc2f9;};'use strict';var _=require(_0xe869('0x0'));var squel=require(_0xe869('0x1'));var as=require(_0xe869('0x2'));var qs=require(_0xe869('0x3'));var updateInteraction=require(_0xe869('0x4'))[_0xe869('0x5')];var utils=require(_0xe869('0x6'));var db=require(_0xe869('0x7'))['db'];function skipInteractionsQuery(_0x5c1230,_0x5ae504,_0x4ce6af){var _0x30bafb=![];var _0x402ebe=utils[_0xe869('0x8')](_0x5c1230);if(_0x5ae504[_0xe869('0x9')]===_0xe869('0xa')&&!_0x4ce6af[_0xe869('0xb')]&&!_0x4ce6af[_0x402ebe]){_0x30bafb=!![];}return _0x30bafb;}function getTagsQuery(){return squel[_0xe869('0xc')]()[_0xe869('0xd')]('id')[_0xe869('0xd')](_0xe869('0xe'))[_0xe869('0xd')](_0xe869('0xf'))[_0xe869('0x10')](_0xe869('0x11'));}function getUsersQuery(_0x1f16c1,_0x19fc36){var _0x169899=utils['getInteractionFK'](_0x1f16c1);var _0x5b39a0=_0xe869('0x12')+_0x1f16c1+_0xe869('0x13');var _0x9eb474=squel[_0xe869('0xc')]()['field'](_0xe869('0x14'))[_0xe869('0xd')]('u.fullname')['field'](_0xe869('0x15')+_0x169899)[_0xe869('0x10')](_0x5b39a0,'ui')[_0xe869('0x16')]('users','u',_0xe869('0x17'));if(_0x19fc36['length']>0x0){_0x9eb474['where']('ui.'+_0x169899+'\x20IN\x20?',_[_0xe869('0x18')](_0x19fc36,'id'));}return _0x9eb474;}function getInteractionsQuery(_0x5f0a67){var _0x4248b8=utils[_0xe869('0x19')](_0x5f0a67);var _0x238255=utils[_0xe869('0x8')](_0x5f0a67);var _0x52c24c=utils[_0xe869('0x1a')](_0x5f0a67);return squel[_0xe869('0xc')]()[_0xe869('0x10')](_0x4248b8[_0xe869('0x1b')],'i')[_0xe869('0x16')](_0xe869('0x1c'),'c',_0xe869('0x1d'))['left_join'](_0xe869('0x1e'),'o',_0xe869('0x1f'))[_0xe869('0x16')](_0x4248b8[_0xe869('0x20')],'a',_0xe869('0x21')+_0x238255)[_0xe869('0x16')](_0x4248b8[_0xe869('0x22')],'me',_0xe869('0x23')+_0x52c24c+_0xe869('0x24'))[_0xe869('0x16')](_0x4248b8[_0xe869('0x25')],'it',_0xe869('0x26')+_0x52c24c+_0xe869('0x24'))['left_join'](_0xe869('0x11'),'t',_0xe869('0x27'));}function getSqlClauses(){var _0xc4a8a8={'body':squel[_0xe869('0x28')](),'contact':squel[_0xe869('0x28')](),'default':squel['expr'](),'fields':squel[_0xe869('0x28')](),'filter':squel[_0xe869('0x28')](),'read':squel[_0xe869('0x28')](),'tags':{'clause':squel[_0xe869('0x28')](),'ids':null},'user':squel[_0xe869('0x28')]()};return _0xc4a8a8;}function parseTagParameter(_0x111113){var _0x463641=squel[_0xe869('0x28')]();if(_0x111113){var _0x56126c=utils[_0xe869('0x29')](_0x111113);_0x56126c['forEach'](function(_0x4be34b){_0x463641['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4be34b+',%');});}return _0x463641;}function parseReadParameter(_0x616b40){var _0x4e0a91='';if(_0x616b40){_0x4e0a91='unreadMessages\x20{OPERATOR}\x200';if(_0x616b40==='1'){_0x4e0a91=_0x4e0a91[_0xe869('0x2a')](_0xe869('0x2b'),'=');}else{_0x4e0a91=_0x4e0a91[_0xe869('0x2a')](_0xe869('0x2b'),'>');}}return _0x4e0a91;}function parseSearchFilter(_0x69a3fe,_0x335bd8){var _0x19465a=squel[_0xe869('0x28')]();if(_0x335bd8){var _0x5b2e8e=_0x335bd8[_0xe869('0x2a')]('\x5c','\x5c\x5c')[_0xe869('0x2a')](/'/g,'\x27\x27');var _0x3463e1=qs[_0xe869('0x2c')](_0x5b2e8e);if(qs['isNumeric'](_0x5b2e8e)){_0x19465a['or']('i.id\x20LIKE\x20?',_0x3463e1+'%');if([_0xe869('0x2d'),_0xe869('0x2e')]['includes'](_0x69a3fe)){_0x19465a['or'](_0xe869('0x2f'),_0x3463e1+'%');}else if(_0x69a3fe===_0xe869('0x30')){_0x19465a['or'](_0xe869('0x31'),_0x3463e1+'%');}else if(_0x69a3fe==='openchannel'){_0x19465a['or'](_0xe869('0x32'),_0x3463e1+'%');}}else if(_0x69a3fe==='mail'&&qs['isEmail'](_0x5b2e8e)){_0x19465a['or'](_0xe869('0x33'),_0x3463e1+'%');}else{if(_0x69a3fe===_0xe869('0x34')){_0x19465a['or'](_0xe869('0x35'),qs['getFullTextValue'](_0x5b2e8e,!![]))['or'](_0xe869('0x36'),qs[_0xe869('0x37')](_0x5b2e8e));}else if(_0x69a3fe!==_0xe869('0x30')){_0x19465a['or'](_0xe869('0x38'),qs[_0xe869('0x37')](_0x5b2e8e));}_0x19465a['or'](_0xe869('0x39'),qs[_0xe869('0x37')](_0x5b2e8e,!![]),null);}}return _0x19465a;}function parseAdvancedSearchFilter(_0x3a5878,_0x5aa2b5){var _0x3144e8=getSqlClauses();var _0x53ac03=as[_0xe869('0x3a')](_0x3a5878);var _0x127cef=_0x53ac03['sqlOperator'];for(var _0x283d77=0x0;_0x283d77<_0x53ac03[_0xe869('0x3b')][_0xe869('0x3c')];_0x283d77++){var _0x288cc4=_0x53ac03[_0xe869('0x3b')][_0x283d77];var _0x3552be='i';var _0x37d95c=_[_0xe869('0x3d')](_0x5aa2b5,[_0xe869('0xe'),_0x288cc4['field']]);if(_0x37d95c){var _0xd384ff=as[_0xe869('0x3e')](_0x3552be,_0x37d95c[_0xe869('0x3f')],_0x288cc4);_0x3144e8[_0xe869('0x40')][_0x127cef](_0xd384ff[_0xe869('0x41')],_0xd384ff['value'][_0xe869('0x42')],_0xd384ff[_0xe869('0x43')]['end']);}else{switch(_0x288cc4['field']){case _0xe869('0x44'):var _0x55adcc=parseReadParameter(_0x288cc4[_0xe869('0x43')]);_0x3144e8['read'][_0xe869('0x45')](_0x55adcc);break;case _0xe869('0x46'):if(_0x288cc4['operator']===_0xe869('0x47')){if(_0x288cc4['value'][_0xe869('0x48')]('\x20')[_0xe869('0x3c')]>0x1){_0x3144e8[_0xe869('0x49')][_0x127cef]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xe869('0x37')](_0x288cc4['value'],!![]),null);}else{var _0x4e9559='%'+_0x288cc4['value']+'%';_0x3144e8['contact'][_0x127cef]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4e9559,_0x4e9559,_0x4e9559);}}else{_0x37d95c=_[_0xe869('0x3d')](_0x5aa2b5,['name',_0xe869('0x4a')]);_0x288cc4['field']=_0xe869('0x4a');_0xd384ff=as['buildExpression'](_0x3552be,_0x37d95c[_0xe869('0x3f')],_0x288cc4);_0x3144e8['contact'][_0x127cef](_0xd384ff[_0xe869('0x41')],_0xd384ff[_0xe869('0x43')]['start'],_0xd384ff[_0xe869('0x43')][_0xe869('0x4b')]);}break;case _0xe869('0x4c'):var _0x2d45ab=_0x288cc4[_0xe869('0x43')][_0xe869('0x48')](',')[_0xe869('0x18')](function(_0x1906ef){return Number(_0x1906ef);});var _0x134050=parseTagParameter(_0x2d45ab);_0x3144e8[_0xe869('0x4d')][_0xe869('0x4e')][_0xe869('0x45')](_0x134050);_0x3144e8[_0xe869('0x4d')]['ids']=_0x2d45ab;break;case _0xe869('0x4f'):if(_0x288cc4['operator']===_0xe869('0x47')){_0x3144e8[_0xe869('0x50')][_0x127cef](_0xe869('0x51'),'%'+_0x288cc4['value']+'%',null);}else{_0x37d95c=_['find'](_0x5aa2b5,[_0xe869('0xe'),_0xe869('0x52')]);_0x288cc4[_0xe869('0xd')]=_0xe869('0x52');_0xd384ff=as['buildExpression'](_0x3552be,_0x37d95c[_0xe869('0x3f')],_0x288cc4);_0x3144e8[_0xe869('0x50')][_0x127cef](_0xd384ff[_0xe869('0x41')],_0xd384ff[_0xe869('0x43')][_0xe869('0x42')],_0xd384ff[_0xe869('0x43')][_0xe869('0x4b')]);}break;case _0xe869('0x53'):case _0xe869('0x54'):_0xd384ff=as['buildExpression']('me',null,_0x288cc4);_0x3144e8[_0xe869('0x53')][_0x127cef](_0xd384ff['text'],_0xd384ff[_0xe869('0x43')][_0xe869('0x42')],_0xd384ff[_0xe869('0x43')][_0xe869('0x4b')]);break;}}}return _0x3144e8;}function parseModelFields(_0x11f840,_0x8b068c,_0x40fb0d){var _0x44b515=utils[_0xe869('0x8')](_0x11f840);var _0x27dd4b=squel[_0xe869('0x28')]();var _0xb53a85=_(_0x8b068c)['keys']()[_0xe869('0x18')](function(_0x4b8734){return _['some'](_0x40fb0d,[_0xe869('0xe'),_0x4b8734])?_0x4b8734:undefined;})[_0xe869('0x55')]()[_0xe869('0x43')]();if(_0xb53a85[_0xe869('0x3c')]>0x0){_0xb53a85['forEach'](function(_0x9b17c9){if(_0x9b17c9===_0x44b515){_0x27dd4b[_0xe869('0x45')]('i.'+_0x44b515+_0xe869('0x56'),[]['concat'](_0x8b068c[_0x9b17c9]));}else if(_0x9b17c9===_0xe869('0x57')){var _0xf79fcc=JSON[_0xe869('0x58')](_0x8b068c[_0x9b17c9])[_0xe869('0x59')];var _0x40f4bb=JSON['parse'](_0x8b068c[_0x9b17c9])['$lte'];_0x27dd4b[_0xe869('0x45')](_0xe869('0x5a'),_0xf79fcc,_0x40f4bb);}else{if(_0x8b068c[_0x9b17c9]==='null'){_0x27dd4b[_0xe869('0x45')]('i.'+_0x9b17c9+_0xe869('0x5b'));}else{_0x27dd4b[_0xe869('0x45')]('i.'+_0x9b17c9+_0xe869('0x5c'),_0x8b068c[_0x9b17c9]);}}});}return _0x27dd4b;}function parseQueryParameters(_0x5d5716,_0x37d65e,_0x108429){var _0x39a4ce=getSqlClauses();return Promise['resolve']()[_0xe869('0x5d')](function(){return parseModelFields(_0x5d5716,_0x37d65e,_0x108429);})[_0xe869('0x5d')](function(_0x93f09e){_0x39a4ce[_0xe869('0x5e')][_0xe869('0x45')](_0x93f09e);return parseReadParameter(_0x37d65e[_0xe869('0x5f')]);})['then'](function(_0x42fdb9){_0x39a4ce[_0xe869('0x5f')][_0xe869('0x45')](_0x42fdb9);return parseTagParameter(_0x37d65e['tag']);})[_0xe869('0x5d')](function(_0x5e6917){_0x39a4ce[_0xe869('0x4d')][_0xe869('0x4e')][_0xe869('0x45')](_0x5e6917);return parseSearchFilter(_0x5d5716,_0x37d65e[_0xe869('0x60')]);})['then'](function(_0x3a2603){_0x39a4ce['filter']=_0x3a2603;return _0x39a4ce;});}function checkAccountsRestrictions(_0x5466a1,_0x388817,_0x477453){var _0x4a1485=utils[_0xe869('0x8')](_0x5466a1);var _0x255f18=_0xe869('0x61')+_[_0xe869('0x62')](_0x5466a1)+(_0x5466a1===_0xe869('0x63')?_0xe869('0x64'):_0xe869('0x65'));var _0x4831cf=squel[_0xe869('0x28')]();return Promise[_0xe869('0x66')]()[_0xe869('0x5d')](function(){if(_0x477453[_0xe869('0xb')]&&_0x388817[_0xe869('0x9')]===_0xe869('0xa')){return _0x388817[_0x255f18]({'attributes':['id'],'raw':!![]});}})[_0xe869('0x5d')](function(_0x403f30){if(_0x403f30){if(_0x403f30['length']===0x0){_0x4831cf[_0xe869('0x45')]('i.'+_0x4a1485+'\x20IS\x20NULL');}else{_0x4831cf[_0xe869('0x45')]('i.'+_0x4a1485+_0xe869('0x56'),_[_0xe869('0x18')](_0x403f30,'id'));}}else if(!_0x477453[_0x4a1485]){_0x4831cf[_0xe869('0x45')]('i.'+_0x4a1485+_0xe869('0x67'));}})[_0xe869('0x5d')](function(){return _0x4831cf;});}function getClosedOrderClause(_0x5888e3,_0xf799e2){var _0x3c8a89='';var _0x1266d9=[_0xe869('0x68'),_0xe869('0x69'),_0xe869('0x6a')];if(_0x5888e3===_0xe869('0x34')){_0x1266d9['unshift'](_0xe869('0x6b'));}if(_0xf799e2['closed']==='0'&&_0x5888e3==='mail'){_0x3c8a89=_0xe869('0x6b');}else{if(_0xf799e2[_0xe869('0x6c')]==='1'){_0x1266d9[_0xe869('0x6d')]();}_0x3c8a89=_0xe869('0x6e')+_0x1266d9['join'](',\x20')+')';}return _0x3c8a89;}function getFilteredInteractions(_0x317ac0,_0x4b722c,_0x9d0b57,_0xe259ce){var _0x9896bc=utils[_0xe869('0x1a')](_0x317ac0);var _0xa1d97d=_[_0xe869('0x62')](_0x317ac0)+_0xe869('0x6f');var _0x51c9cb=[];var _0x26385b=getTagsQuery();var _0x5ab39b={'type':db[_0xe869('0x70')]['QueryTypes']['SELECT'],'raw':!![]};var _0x234679=[];var _0x44e158=[];return db[_0xe869('0x71')][_0xe869('0x72')](_0x26385b[_0xe869('0x73')](),_0x5ab39b)['then'](function(_0x4cdbf6){_0x51c9cb=_[_0xe869('0x74')](_0x4cdbf6,'id');_0x5ab39b=_[_0xe869('0x75')](_0x5ab39b,{'model':db[_0xa1d97d],'mapToModel':!![],'nest':!![]});if(_0x9d0b57[_0xe869('0x5e')]){_0xe259ce[_0xe869('0x76')]['forEach'](function(_0x1b9a54){_0x4b722c[_0xe869('0xd')]('i.'+_0x1b9a54);});}else{_0x4b722c[_0xe869('0xd')](_0xe869('0x77'),_0xe869('0x44'));_0x4b722c['field'](_0xe869('0x78'),_0xe869('0x79'));_0x4b722c['field'](_0xe869('0x7a'),'Account.mandatoryDisposition');if(_0x317ac0===_0xe869('0x34')){_0x4b722c[_0xe869('0xd')](_0xe869('0x7b'),'Account.email');_0x4b722c[_0xe869('0xd')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_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',_0xe869('0x7c'));_0x4b722c[_0xe869('0xd')](_0xe869('0x7d'));_0x4b722c[_0xe869('0xd')](_0xe869('0x7e'));_0x4b722c[_0xe869('0xd')]('i.updatedAt');_0x4b722c['field'](_0xe869('0x7f'));_0x4b722c[_0xe869('0xd')](_0xe869('0x80'));_0x4b722c[_0xe869('0xd')]('i.attach');_0x4b722c['field'](_0xe869('0x81'));_0x4b722c['field'](_0xe869('0x82'));_0x4b722c[_0xe869('0xd')](_0xe869('0x83'));_0x4b722c['field']('i.disposition');_0x4b722c[_0xe869('0xd')](_0xe869('0x69'));_0x4b722c[_0xe869('0xd')]('i.thirdDisposition');_0x4b722c[_0xe869('0xd')](_0xe869('0x6b'));_0x4b722c['field'](_0xe869('0x84'));_0x4b722c[_0xe869('0xd')](_0xe869('0x85'));_0x4b722c[_0xe869('0xd')](_0xe869('0x86'));_0x4b722c[_0xe869('0xd')]('i.UserId');}else if(_0x317ac0===_0xe869('0x87')){_0x4b722c[_0xe869('0xd')](_0xe869('0x88'),_0xe869('0x7c'));}else{_0x4b722c[_0xe869('0xd')](_0xe869('0x89'),_0xe869('0x7c'));}if(_0x317ac0!==_0xe869('0x34')){_0x4b722c[_0xe869('0xd')](_0xe869('0x8a'));}_0x4b722c[_0xe869('0xd')](_0xe869('0x8b'),_0xe869('0x8c'));_0x4b722c['field']('c.lastName',_0xe869('0x8d'));_0x4b722c[_0xe869('0xd')](_0xe869('0x8e'),_0xe869('0x8f'));_0x4b722c['field']('c.phone',_0xe869('0x90'));_0x4b722c['field'](_0xe869('0x91'),_0xe869('0x92'));_0x4b722c[_0xe869('0xd')](_0xe869('0x93'),'Contact.fax');_0x4b722c['field'](_0xe869('0x94'),_0xe869('0x95'));_0x4b722c[_0xe869('0xd')](_0xe869('0x96'),_0xe869('0x97'));_0x4b722c[_0xe869('0xd')](_0xe869('0x98'),_0xe869('0x99'));}if(_0xe259ce[_0xe869('0x9a')]){_0x4b722c[_0xe869('0x9a')](_0xe259ce[_0xe869('0x9a')]);}if(_0xe259ce[_0xe869('0x9b')]){_0x4b722c[_0xe869('0x9b')](_0xe259ce['offset']);}return db[_0xe869('0x71')]['query'](_0x4b722c['toString'](),_0x5ab39b);})[_0xe869('0x5d')](function(_0x188eaa){_0x234679=_0x188eaa;var _0x5b6cb2=getUsersQuery(_0x317ac0,_0x234679);return db[_0xe869('0x71')][_0xe869('0x72')](_0x5b6cb2['toString'](),_0x5ab39b);})[_0xe869('0x5d')](function(_0x55aeb6){_0x44e158=_[_0xe869('0x9c')](_0x55aeb6,_0x9896bc);if(_0x317ac0===_0xe869('0x34')){return db[_0xe869('0x9d')][_0xe869('0x9e')]({'attributes':[_0xe869('0x9f')],'raw':!![]});}})['then'](function(_0x2a32b9){var _0x51cd14=_0x2a32b9?_0x2a32b9['enableEmailPreview']:undefined;var _0x227e13=_0x234679[_0xe869('0x18')](function(_0x464de6){return updateInteraction(_0x464de6,_0x51c9cb,_0x44e158,_0x51cd14);});return Promise[_0xe869('0xa0')](_0x227e13);});}function countFilteredInteractions(_0x14940b,_0x1976a7){var _0x48dfbd=_0x14940b['clone']();_0x48dfbd[_0xe869('0xd')](_0xe869('0xa1'));_0x48dfbd[_0xe869('0xd')](_0xe869('0x77'),_0xe869('0x44'));var _0x3570d6=utils['getSelectedTags'](_0x1976a7);if(!_['isEmpty'](_0x3570d6)){_0x48dfbd['where'](_0xe869('0xa2'),_0x3570d6);}var _0x5ef769={'type':db['Sequelize'][_0xe869('0xa3')]['SELECT'],'raw':!![]};return db[_0xe869('0x71')][_0xe869('0x72')](_0x48dfbd['toString'](),_0x5ef769);}module[_0xe869('0xa4')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 6702004..2fac348 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x05f2=['TagIds','then','Tags','lodash','../../mysqldb','fullname','split','waiting','talking','answered','unmanaged','abandoned','total','disposition','UserId','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','Users'];(function(_0x2f82e7,_0x50f448){var _0x483927=function(_0x1f9d9c){while(--_0x1f9d9c){_0x2f82e7['push'](_0x2f82e7['shift']());}};_0x483927(++_0x50f448);}(_0x05f2,0x16b));var _0x205f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x05f2[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x205f('0x0'));var db=require(_0x205f('0x1'))['db'];function getInteractionUsers(_0x26b146,_0x17daef){return new Promise(function(_0x3e1849,_0x2015d4){try{var _0x9fabbc=[];if(_0x17daef[_0x26b146]){_0x9fabbc=_0x17daef[_0x26b146]['map'](function(_0x187d73){return{'id':_0x187d73['id'],'fullname':_0x187d73[_0x205f('0x2')]};});}return _0x3e1849(_0x9fabbc);}catch(_0x481235){_0x2015d4(_0x481235);}});}function getInteractionTags(_0x43307b,_0x157eab){var _0x4e8693=[];if(_0x43307b){_0x43307b[_0x205f('0x3')](',')['forEach'](function(_0x35824a){_0x4e8693['push'](_0x157eab[_0x35824a]);});}return _0x4e8693;}function updateWaitingCounter(_0x1fd29b){if(_0x1fd29b[_0x205f('0x4')]){_0x1fd29b[_0x205f('0x4')]-=0x1;}}function updateInteractionCounters(_0x517784){_0x517784[_0x205f('0x4')]=0x0;_0x517784[_0x205f('0x5')]=0x0;_0x517784[_0x205f('0x6')]=0x0;_0x517784[_0x205f('0x7')]=0x0;_0x517784[_0x205f('0x8')]=0x0;_0x517784[_0x205f('0x9')]=0x0;if(_0x517784['closed']){if(_0x517784[_0x205f('0xa')]===_0x205f('0x8')){_0x517784['abandoned']+=0x1;updateWaitingCounter(_0x517784);}if(_0x517784[_0x205f('0xb')]){_0x517784['answered']+=0x1;if(_0x517784['talking']){_0x517784[_0x205f('0x5')]-=0x1;}}else{if(_0x517784[_0x205f('0xa')]){_0x517784['unmanaged']+=0x1;updateWaitingCounter(_0x517784);}}}else{if(!_0x517784['UserId']){_0x517784[_0x205f('0x4')]+=0x1;}if(_0x517784[_0x205f('0xb')]){_0x517784[_0x205f('0x5')]+=0x1;updateWaitingCounter(_0x517784);}}_0x517784[_0x205f('0x9')]+=0x1;return _0x517784;}function getLastMessageText(_0x4a094a){return db[_0x205f('0xc')][_0x205f('0xd')]({'where':{'$and':[{'MailInteractionId':_0x4a094a['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x205f('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x205f('0xf')],'order':_0x205f('0x10'),'raw':!![]})['then'](function(_0x126173){if(_0x126173&&_0x126173['plainBody']){_0x4a094a[_0x205f('0x11')]=_[_0x205f('0x12')](_0x126173[_0x205f('0xf')]);}return _0x4a094a;})[_0x205f('0x13')](function(_0x3c4eaa){throw _0x3c4eaa;});}exports['updateInteraction']=function(_0x3e9e51,_0x31f3c8,_0x64a19,_0x581125){return new Promise(function(_0x359b49,_0x209a08){return getInteractionUsers(_0x3e9e51['id'],_0x64a19)['then'](function(_0x351512){_0x3e9e51[_0x205f('0x14')]=_0x351512;return getInteractionTags(_0x3e9e51[_0x205f('0x15')],_0x31f3c8);})[_0x205f('0x16')](function(_0x4cffba){_0x3e9e51[_0x205f('0x17')]=_0x4cffba;delete _0x3e9e51[_0x205f('0x15')];return updateInteractionCounters(_0x3e9e51);})[_0x205f('0x16')](function(_0x52c74a){if(_0x581125){return getLastMessageText(_0x52c74a);}else{return _0x52c74a;}})['then'](function(_0x5aac1b){_0x359b49(_0x5aac1b);})[_0x205f('0x13')](function(_0x3e99a8){_0x209a08(_0x3e99a8);});});}; \ No newline at end of file +var _0x20a6=['plainBody','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','../../mysqldb','map','fullname','push','waiting','talking','answered','abandoned','total','closed','UserId','disposition','unmanaged','MailMessage','findOne','out','then'];(function(_0xf04aa,_0x3eecca){var _0x2dfdc0=function(_0x39f9ab){while(--_0x39f9ab){_0xf04aa['push'](_0xf04aa['shift']());}};_0x2dfdc0(++_0x3eecca);}(_0x20a6,0x1b1));var _0x620a=function(_0x531b8c,_0x3d63dc){_0x531b8c=_0x531b8c-0x0;var _0x4c011e=_0x20a6[_0x531b8c];return _0x4c011e;};'use strict';var _=require('lodash');var db=require(_0x620a('0x0'))['db'];function getInteractionUsers(_0x1a731f,_0x2c3de1){return new Promise(function(_0xb1d02b,_0x143dc4){try{var _0x187cf1=[];if(_0x2c3de1[_0x1a731f]){_0x187cf1=_0x2c3de1[_0x1a731f][_0x620a('0x1')](function(_0x1360a6){return{'id':_0x1360a6['id'],'fullname':_0x1360a6[_0x620a('0x2')]};});}return _0xb1d02b(_0x187cf1);}catch(_0x2e47ce){_0x143dc4(_0x2e47ce);}});}function getInteractionTags(_0x445a01,_0x5712bf){var _0x3d061b=[];if(_0x445a01){_0x445a01['split'](',')['forEach'](function(_0x2e4219){_0x3d061b[_0x620a('0x3')](_0x5712bf[_0x2e4219]);});}return _0x3d061b;}function updateWaitingCounter(_0xf7d5f0){if(_0xf7d5f0[_0x620a('0x4')]){_0xf7d5f0['waiting']-=0x1;}}function updateInteractionCounters(_0xf1a1d1){_0xf1a1d1[_0x620a('0x4')]=0x0;_0xf1a1d1[_0x620a('0x5')]=0x0;_0xf1a1d1[_0x620a('0x6')]=0x0;_0xf1a1d1['unmanaged']=0x0;_0xf1a1d1[_0x620a('0x7')]=0x0;_0xf1a1d1[_0x620a('0x8')]=0x0;if(_0xf1a1d1[_0x620a('0x9')]){if(_0xf1a1d1['disposition']===_0x620a('0x7')){_0xf1a1d1[_0x620a('0x7')]+=0x1;updateWaitingCounter(_0xf1a1d1);}if(_0xf1a1d1[_0x620a('0xa')]){_0xf1a1d1[_0x620a('0x6')]+=0x1;if(_0xf1a1d1[_0x620a('0x5')]){_0xf1a1d1[_0x620a('0x5')]-=0x1;}}else{if(_0xf1a1d1[_0x620a('0xb')]){_0xf1a1d1[_0x620a('0xc')]+=0x1;updateWaitingCounter(_0xf1a1d1);}}}else{if(!_0xf1a1d1[_0x620a('0xa')]){_0xf1a1d1['waiting']+=0x1;}if(_0xf1a1d1['UserId']){_0xf1a1d1[_0x620a('0x5')]+=0x1;updateWaitingCounter(_0xf1a1d1);}}_0xf1a1d1[_0x620a('0x8')]+=0x1;return _0xf1a1d1;}function getLastMessageText(_0x3cf665){return db[_0x620a('0xd')][_0x620a('0xe')]({'where':{'$and':[{'MailInteractionId':_0x3cf665['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x620a('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':'-id','raw':!![]})[_0x620a('0x10')](function(_0x3199a9){if(_0x3199a9&&_0x3199a9[_0x620a('0x11')]){_0x3cf665[_0x620a('0x12')]=_[_0x620a('0x13')](_0x3199a9['plainBody']);}return _0x3cf665;})[_0x620a('0x14')](function(_0x2406d6){throw _0x2406d6;});}exports[_0x620a('0x15')]=function(_0x1afd54,_0x24a2cd,_0x14e22c,_0x465235){return new Promise(function(_0xd40c5,_0xa8c330){return getInteractionUsers(_0x1afd54['id'],_0x14e22c)[_0x620a('0x10')](function(_0x5d38e3){_0x1afd54[_0x620a('0x16')]=_0x5d38e3;return getInteractionTags(_0x1afd54[_0x620a('0x17')],_0x24a2cd);})[_0x620a('0x10')](function(_0x2def67){_0x1afd54[_0x620a('0x18')]=_0x2def67;delete _0x1afd54[_0x620a('0x17')];return updateInteractionCounters(_0x1afd54);})[_0x620a('0x10')](function(_0xe2594){if(_0x465235){return getLastMessageText(_0xe2594);}else{return _0xe2594;}})['then'](function(_0x362070){_0xd40c5(_0x362070);})[_0x620a('0x14')](function(_0x2d9f25){_0xa8c330(_0x2d9f25);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 84de5fb..7ab9d88 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe683=['catch','error','MESSAGE:ACCEPT]\x20id=','\x20name=','\x20role=','\x20interaction=','\x20body=','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','upperFirst','InteractionId','accounts','_messages','_interactions','toLowerCase','toUpperCase','name','role','stringify','null','then','update','info'];(function(_0x358ad8,_0x52d29c){var _0x5d164f=function(_0xe92c3e){while(--_0xe92c3e){_0x358ad8['push'](_0x358ad8['shift']());}};_0x5d164f(++_0x52d29c);}(_0xe683,0xda));var _0x3e68=function(_0x1256ba,_0x27b1c1){_0x1256ba=_0x1256ba-0x0;var _0x371639=_0xe683[_0x1256ba];return _0x371639;};'use strict';var _=require(_0x3e68('0x0'));var db=require(_0x3e68('0x1'))['db'];var loggers={'openchannel':require(_0x3e68('0x2'))(_0x3e68('0x3')),'mail':require(_0x3e68('0x2'))(_0x3e68('0x4')),'fax':require('../../config/logger')(_0x3e68('0x5')),'sms':require(_0x3e68('0x2'))(_0x3e68('0x6')),'chat':require('../../config/logger')(_0x3e68('0x7')),'whatsapp':require(_0x3e68('0x2'))(_0x3e68('0x8'))};function getAccountFK(_0x1987ff){return _[_0x3e68('0x9')](_0x1987ff)+(_0x1987ff===_0x3e68('0xa')?_0x3e68('0xb'):_0x3e68('0xc'))+'Id';}function getInteractionFK(_0x441990){return _[_0x3e68('0x9')](_0x441990)+'InteractionId';}function getInteractionId(_0x387ea7,_0x4d7daa,_0x134c47){if(_0x387ea7&&_0x387ea7[_[_0x3e68('0xd')](_0x134c47)+_0x3e68('0xe')]){return _0x387ea7[_[_0x3e68('0xd')](_0x134c47)+_0x3e68('0xe')];}else if(_0x387ea7&&_0x387ea7['id']){return _0x387ea7['id'];}else if(_0x4d7daa&&_0x4d7daa['id']){return _0x4d7daa['id'];}else{return'unknown';}}function getInteractionsTables(_0x36943b){return{'accounts':_0x36943b+'_'+(_0x36943b===_0x3e68('0xa')?'websites':_0x3e68('0xf')),'interactions':_0x36943b+'_interactions','interactionsTags':_0x36943b+'_interaction_has_tags','messages':_0x36943b+_0x3e68('0x10'),'userInteractions':'user_has_'+_0x36943b+_0x3e68('0x11')};}function getSelectedTags(_0x2df417){var _0x10beb5=[];if(_0x2df417){_0x10beb5=Array['isArray'](_0x2df417)?_0x2df417:[_0x2df417];}return _0x10beb5;}function log(_0x42a43b,_0xe2cbc3,_0x16ed4a,_0x1bb126,_0x4c2902,_0x429ed7){loggers[_0x4c2902[_0x3e68('0x12')]()][_0x42a43b]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x429ed7[_0x3e68('0x13')](),_0xe2cbc3?_0xe2cbc3['id']:null,_0xe2cbc3?_0xe2cbc3[_0x3e68('0x14')]:null,_0xe2cbc3?_0xe2cbc3[_0x3e68('0x15')]:null,getInteractionId(_0x16ed4a,_0x1bb126,_0x4c2902),_0x16ed4a?JSON[_0x3e68('0x16')](_0x16ed4a):_0x3e68('0x17'));}function updateUser(_0x2c4e3b,_0x2d8870,_0x57e7fb,_0x2857bb,_0x47d19c){db[_[_0x3e68('0xd')](_0x2857bb)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x2d8870,_0x57e7fb,_0x2857bb)}})[_0x3e68('0x18')](function(_0x206e98){if(_0x206e98){return _0x206e98[_0x3e68('0x19')]({'UserId':_0x2c4e3b?_0x2c4e3b['id']:null});}})['then'](function(_0x160eed){if(_0x160eed){log(_0x3e68('0x1a'),_0x2c4e3b,_0x2d8870,_0x57e7fb,_0x2857bb,_0x47d19c);}})[_0x3e68('0x1b')](function(){log(_0x3e68('0x1c'),_0x2c4e3b,_0x2d8870,_0x57e7fb,_0x2857bb,_0x47d19c);});}function logAcceptMessage(_0x1d64fb,_0xba7e9a,_0x44346c,_0x63d078){var _0x34dd4b=loggers[_0x1d64fb['toLowerCase']()];var _0x42425d=_0xba7e9a['id'];var _0x401171=_0xba7e9a[_0x3e68('0x14')];var _0x33e005=_0xba7e9a['role'];var _0x1a2f94=JSON[_0x3e68('0x16')](_0x63d078||null);_0x34dd4b['info']('['+_0x1d64fb[_0x3e68('0x13')]()+_0x3e68('0x1d')+_0x42425d+_0x3e68('0x1e')+_0x401171+_0x3e68('0x1f')+_0x33e005+_0x3e68('0x20')+_0x44346c+_0x3e68('0x21')+_0x1a2f94);}module[_0x3e68('0x22')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file +var _0x0b1e=['unknown','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','toUpperCase','name','role','stringify','null','then','update','info','MESSAGE:ACCEPT]\x20id=','\x20name=','\x20role=','\x20interaction=','\x20body=','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','InteractionId','upperFirst'];(function(_0x436d8c,_0x241d05){var _0x184f8b=function(_0x2ff4c6){while(--_0x2ff4c6){_0x436d8c['push'](_0x436d8c['shift']());}};_0x184f8b(++_0x241d05);}(_0x0b1e,0x1f2));var _0xe0b1=function(_0x21a2b2,_0x22ba1e){_0x21a2b2=_0x21a2b2-0x0;var _0x2060b4=_0x0b1e[_0x21a2b2];return _0x2060b4;};'use strict';var _=require(_0xe0b1('0x0'));var db=require(_0xe0b1('0x1'))['db'];var loggers={'openchannel':require(_0xe0b1('0x2'))(_0xe0b1('0x3')),'mail':require(_0xe0b1('0x2'))('mail-interactions'),'fax':require('../../config/logger')(_0xe0b1('0x4')),'sms':require(_0xe0b1('0x2'))('sms-interactions'),'chat':require('../../config/logger')(_0xe0b1('0x5')),'whatsapp':require(_0xe0b1('0x2'))(_0xe0b1('0x6'))};function getAccountFK(_0x400b78){return _[_0xe0b1('0x7')](_0x400b78)+(_0x400b78===_0xe0b1('0x8')?_0xe0b1('0x9'):'Account')+'Id';}function getInteractionFK(_0x1b0a2f){return _[_0xe0b1('0x7')](_0x1b0a2f)+_0xe0b1('0xa');}function getInteractionId(_0x28846e,_0x75a09a,_0x4ea091){if(_0x28846e&&_0x28846e[_[_0xe0b1('0xb')](_0x4ea091)+_0xe0b1('0xa')]){return _0x28846e[_[_0xe0b1('0xb')](_0x4ea091)+'InteractionId'];}else if(_0x28846e&&_0x28846e['id']){return _0x28846e['id'];}else if(_0x75a09a&&_0x75a09a['id']){return _0x75a09a['id'];}else{return _0xe0b1('0xc');}}function getInteractionsTables(_0x44d582){return{'accounts':_0x44d582+'_'+(_0x44d582===_0xe0b1('0x8')?'websites':_0xe0b1('0xd')),'interactions':_0x44d582+_0xe0b1('0xe'),'interactionsTags':_0x44d582+_0xe0b1('0xf'),'messages':_0x44d582+_0xe0b1('0x10'),'userInteractions':_0xe0b1('0x11')+_0x44d582+_0xe0b1('0xe')};}function getSelectedTags(_0x520da4){var _0x1cc729=[];if(_0x520da4){_0x1cc729=Array[_0xe0b1('0x12')](_0x520da4)?_0x520da4:[_0x520da4];}return _0x1cc729;}function log(_0x1270fe,_0x19666a,_0x257de5,_0x5b9e72,_0xb6de13,_0x21e113){loggers[_0xb6de13[_0xe0b1('0x13')]()][_0x1270fe]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x21e113[_0xe0b1('0x14')](),_0x19666a?_0x19666a['id']:null,_0x19666a?_0x19666a[_0xe0b1('0x15')]:null,_0x19666a?_0x19666a[_0xe0b1('0x16')]:null,getInteractionId(_0x257de5,_0x5b9e72,_0xb6de13),_0x257de5?JSON[_0xe0b1('0x17')](_0x257de5):_0xe0b1('0x18'));}function updateUser(_0x54da78,_0x228e7a,_0x567204,_0x221baf,_0x4944c7){db[_[_0xe0b1('0xb')](_0x221baf)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x228e7a,_0x567204,_0x221baf)}})[_0xe0b1('0x19')](function(_0x2bba20){if(_0x2bba20){return _0x2bba20[_0xe0b1('0x1a')]({'UserId':_0x54da78?_0x54da78['id']:null});}})[_0xe0b1('0x19')](function(_0x5d7dfa){if(_0x5d7dfa){log(_0xe0b1('0x1b'),_0x54da78,_0x228e7a,_0x567204,_0x221baf,_0x4944c7);}})['catch'](function(){log('error',_0x54da78,_0x228e7a,_0x567204,_0x221baf,_0x4944c7);});}function logAcceptMessage(_0x4abe8f,_0x5878e7,_0x383154,_0x162663){var _0x77d9b=loggers[_0x4abe8f[_0xe0b1('0x13')]()];var _0x52fc4d=_0x5878e7['id'];var _0x336282=_0x5878e7[_0xe0b1('0x15')];var _0x4e64da=_0x5878e7[_0xe0b1('0x16')];var _0x25687d=JSON[_0xe0b1('0x17')](_0x162663||null);_0x77d9b[_0xe0b1('0x1b')]('['+_0x4abe8f['toUpperCase']()+_0xe0b1('0x1c')+_0x52fc4d+_0xe0b1('0x1d')+_0x336282+_0xe0b1('0x1e')+_0x4e64da+_0xe0b1('0x1f')+_0x383154+_0xe0b1('0x20')+_0x25687d);}module[_0xe0b1('0x21')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 2e7df3f..a36fac8 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfa5=['catch','User','admin','isUserLimit','crypto','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','utf8','parse','hasOwnProperty','use','License','findOne','then','status','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached'];(function(_0x1ecd22,_0x174e15){var _0x2a8edf=function(_0x33a61c){while(--_0x33a61c){_0x1ecd22['push'](_0x1ecd22['shift']());}};_0x2a8edf(++_0x174e15);}(_0xbfa5,0x16c));var _0x5bfa=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xbfa5[_0x1f9f37];return _0x21c080;};'use strict';var crypto=require(_0x5bfa('0x0'));var util=require('util');var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0x5bfa('0x1'));function getValueFromLicense(_0x56e874,_0x26cb3b){if(_0x56e874&&_0x26cb3b){if(_0x26cb3b[_0x5bfa('0x2')]&&_0x26cb3b[_0x5bfa('0x3')]){var _0x3aeb05=_0x26cb3b[_0x5bfa('0x2')];var _0x4cb4de=_0x26cb3b[_0x5bfa('0x3')];var _0x513e5c=_0x3aeb05[_0x5bfa('0x4')]('-')[0x4];var _0x48dd0a=_0x3aeb05[_0x5bfa('0x4')]('-')[0x0];var _0x5497d0=crypto[_0x5bfa('0x5')](_0x5bfa('0x6'),util['format'](_0x5bfa('0x7'),_0x513e5c,_0x3aeb05,_0x48dd0a));var _0x4767e6=_0x5497d0[_0x5bfa('0x8')](_0x4cb4de,_0x5bfa('0x9'),'utf8');_0x4767e6+=_0x5497d0['final'](_0x5bfa('0xa'));var _0x294411=JSON[_0x5bfa('0xb')](_0x4767e6);return _0x294411[_0x5bfa('0xc')](_0x56e874)?_0x294411[_0x56e874]:null;}}return null;}function isLimit(_0x328cc6,_0x40090a,_0x54d6c1,_0x4563c5){var _0xea9d8c=_0x40090a;return compose()[_0x5bfa('0xd')](function(_0x3d2018,_0x33a834,_0x44975a){return db[_0x5bfa('0xe')][_0x5bfa('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x5bfa('0x10')](function(_0x36442c){var _0x6f8a91=getValueFromLicense(_0x328cc6,_0x36442c);return _0x6f8a91?_0x6f8a91:_0xea9d8c;})[_0x5bfa('0x10')](function(_0x194430){_0xea9d8c=_0x194430;return _0x54d6c1['count'](_0x4563c5);})[_0x5bfa('0x10')](function(_0xe33b0f){if(_0xe33b0f>=_0xea9d8c){return _0x33a834[_0x5bfa('0x11')](0x193)['json']({'message':util[_0x5bfa('0x12')](_0x5bfa('0x13'),_0x328cc6)});}_0x44975a();})[_0x5bfa('0x14')](function(_0x3c156e){_0x44975a(_0x3c156e);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x5bfa('0x15')],{'where':{'$or':[{'role':_0x5bfa('0x16')},{'role':'user'}]}});}exports[_0x5bfa('0x17')]=isUserLimit; \ No newline at end of file +var _0xec82=['split','createDecipher','format','%s:%s:%s','update','base64','utf8','final','hasOwnProperty','use','License','findOne','then','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','crypto','composable-middleware','../../mysqldb','data1','license'];(function(_0x273b7e,_0x1b642f){var _0x5df145=function(_0x58e003){while(--_0x58e003){_0x273b7e['push'](_0x273b7e['shift']());}};_0x5df145(++_0x1b642f);}(_0xec82,0x95));var _0x2ec8=function(_0xccac79,_0x30c43c){_0xccac79=_0xccac79-0x0;var _0x3776cf=_0xec82[_0xccac79];return _0x3776cf;};'use strict';var crypto=require(_0x2ec8('0x0'));var util=require('util');var compose=require(_0x2ec8('0x1'));var db=require(_0x2ec8('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x5e247e,_0x59d330){if(_0x5e247e&&_0x59d330){if(_0x59d330[_0x2ec8('0x3')]&&_0x59d330['license']){var _0x5c2e16=_0x59d330['data1'];var _0x72df4d=_0x59d330[_0x2ec8('0x4')];var _0x6263b9=_0x5c2e16[_0x2ec8('0x5')]('-')[0x4];var _0x44b152=_0x5c2e16[_0x2ec8('0x5')]('-')[0x0];var _0x4c3c37=crypto[_0x2ec8('0x6')]('aes-256-ctr',util[_0x2ec8('0x7')](_0x2ec8('0x8'),_0x6263b9,_0x5c2e16,_0x44b152));var _0x598c03=_0x4c3c37[_0x2ec8('0x9')](_0x72df4d,_0x2ec8('0xa'),_0x2ec8('0xb'));_0x598c03+=_0x4c3c37[_0x2ec8('0xc')]('utf8');var _0x3839a7=JSON['parse'](_0x598c03);return _0x3839a7[_0x2ec8('0xd')](_0x5e247e)?_0x3839a7[_0x5e247e]:null;}}return null;}function isLimit(_0x2fda5b,_0x53b607,_0x48315e,_0x10a091){var _0x5acae7=_0x53b607;return compose()[_0x2ec8('0xe')](function(_0x14486b,_0x4d0f5b,_0xd26761){return db[_0x2ec8('0xf')][_0x2ec8('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x2ec8('0x11')](function(_0x393918){var _0x2abe27=getValueFromLicense(_0x2fda5b,_0x393918);return _0x2abe27?_0x2abe27:_0x5acae7;})[_0x2ec8('0x11')](function(_0x19ef0d){_0x5acae7=_0x19ef0d;return _0x48315e['count'](_0x10a091);})[_0x2ec8('0x11')](function(_0x5983cd){if(_0x5983cd>=_0x5acae7){return _0x4d0f5b['status'](0x193)[_0x2ec8('0x12')]({'message':util['format'](_0x2ec8('0x13'),_0x2fda5b)});}_0xd26761();})['catch'](function(_0xfc8335){_0xd26761(_0xfc8335);});});}function isUserLimit(){return isLimit(_0x2ec8('0x14'),0x1,db[_0x2ec8('0x15')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index d42cd5f..d6cd0a9 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 _0x33a8=['$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','start','pop','utcOffset','format','hours','minutes','seconds','moment','startsWith','[$or]','and','replace','[$and]','length','split','forEach','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','castTo','text','field','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?'];(function(_0x3cb474,_0x1e6ff7){var _0x615b3a=function(_0x192f5a){while(--_0x192f5a){_0x3cb474['push'](_0x3cb474['shift']());}};_0x615b3a(++_0x1e6ff7);}(_0x33a8,0x163));var _0x833a=function(_0x51ed21,_0x54b194){_0x51ed21=_0x51ed21-0x0;var _0x1ac433=_0x33a8[_0x51ed21];return _0x1ac433;};'use strict';var _=require('lodash');var moment=require(_0x833a('0x0'));exports['parseSearch']=function(_0x465ac7){var _0x3ecec0={'conditions':[]};_0x3ecec0['sqlOperator']=_[_0x833a('0x1')](_0x465ac7,_0x833a('0x2'))?'or':_0x833a('0x3');var _0x23813b=_0x465ac7[_0x833a('0x4')](_0x833a('0x5'),'')[_0x833a('0x4')](_0x833a('0x2'),'')['split']('||');for(var _0xb24719=0x0;_0xb24719<_0x23813b[_0x833a('0x6')];_0xb24719++){var _0x53b395=_0x23813b[_0xb24719][_0x833a('0x7')](':=');var _0x56c1fb=_0x53b395[0x0];var _0xe478fd=_0x53b395['slice'](0x1);_0xe478fd[_0x833a('0x8')](function(_0x3e51e7){var _0x44bfff=_0x3e51e7[_0x833a('0x7')]('[')['shift']();var _0x56db1c=_0x3e51e7['match'](/\[(.*?)\]/g);_0x56db1c[_0x833a('0x8')](function(_0x118946){var _0x9c5fac=_0x118946['split']('[')['filter'](function(_0x515bb1){return _0x515bb1[_0x833a('0x9')](']')>-0x1;})[_0x833a('0xa')](function(_0x3a4db3){return _0x3a4db3[_0x833a('0x7')](']')[0x0];})[0x0];_0x3ecec0[_0x833a('0xb')][_0x833a('0xc')]({'field':_0x56c1fb,'operator':_0x44bfff,'value':_0x9c5fac});});});}return _0x3ecec0;};exports[_0x833a('0xd')]=function(_0x14279e,_0x5e8d5b,_0x4b6f4b){var _0x5062fd={};if(_0x5e8d5b===_0x833a('0xe')){if(_0x4b6f4b[_0x833a('0xf')]===_0x833a('0x10')){_0x4b6f4b[_0x833a('0xf')]=_0x833a('0x11');_0x4b6f4b['value']+=','+_0x4b6f4b[_0x833a('0x12')];}else if(_[_0x833a('0x13')]([_0x833a('0x14'),_0x833a('0x15')],_0x4b6f4b[_0x833a('0xf')])){_0x4b6f4b[_0x833a('0x12')]=moment(_0x4b6f4b[_0x833a('0x12')])[_0x833a('0x16')](0x1,'days')['format']('YYYY-MM-DD');}}if(_0x4b6f4b['castTo']){_0x5e8d5b=_0x4b6f4b[_0x833a('0x17')];_0x5062fd[_0x833a('0x18')]='CAST('+_0x14279e+'.'+_0x4b6f4b[_0x833a('0x19')]+'\x20AS\x20'+_0x4b6f4b[_0x833a('0x17')]+')\x20'+parseOperator(_0x4b6f4b[_0x833a('0xf')]);}else{_0x5062fd[_0x833a('0x18')]=_0x14279e+'.'+_0x4b6f4b[_0x833a('0x19')]+'\x20'+parseOperator(_0x4b6f4b[_0x833a('0xf')]);}if(_[_0x833a('0x13')]([_0x833a('0x1a'),_0x833a('0x1b')],_0x4b6f4b[_0x833a('0xf')]))_0x5062fd[_0x833a('0x18')]='('+_0x5062fd['text']+'\x20OR\x20'+_0x14279e+'.'+_0x4b6f4b['field']+_0x833a('0x1c');_0x5062fd[_0x833a('0x12')]=parseValue(_0x5e8d5b,_0x4b6f4b[_0x833a('0xf')],_0x4b6f4b[_0x833a('0x12')]);return _0x5062fd;};function parseOperator(_0x10f8a2){var _0x5c6b68;switch(_0x10f8a2){case _0x833a('0x1d'):_0x5c6b68=_0x833a('0x1e');break;case _0x833a('0x1b'):_0x5c6b68='NOT\x20IN\x20?';break;case _0x833a('0x10'):_0x5c6b68=_0x833a('0x1f');break;case _0x833a('0x1a'):_0x5c6b68=_0x833a('0x20');break;case _0x833a('0x21'):case _0x833a('0x22'):case _0x833a('0x23'):_0x5c6b68=_0x833a('0x24');break;case _0x833a('0x25'):_0x5c6b68=_0x833a('0x26');break;case _0x833a('0x14'):_0x5c6b68=_0x833a('0x27');break;case _0x833a('0x15'):_0x5c6b68=_0x833a('0x28');break;case'$gte':_0x5c6b68=_0x833a('0x29');break;case'$between':_0x5c6b68='BETWEEN\x20?\x20AND\x20?';break;}return _0x5c6b68;}function parseValue(_0x4778e2,_0x44babe,_0x32526e){var _0x58d9fc={'start':undefined,'end':undefined};switch(_0x44babe){case _0x833a('0x1d'):case _0x833a('0x1b'):_0x58d9fc['start']=_0x32526e[_0x833a('0x7')](',');break;case _0x833a('0x21'):_0x58d9fc[_0x833a('0x2a')]='%'+_0x32526e+'%';break;case _0x833a('0x22'):_0x58d9fc[_0x833a('0x2a')]=_0x32526e+'%';break;case _0x833a('0x23'):_0x58d9fc[_0x833a('0x2a')]='%'+_0x32526e;break;case _0x833a('0x11'):var _0x29fa92=_0x32526e[_0x833a('0x7')](',');var _0x32526e=_0x29fa92['shift']();var _0x3760f1=_0x29fa92[_0x833a('0x2b')]();if(_0x4778e2===_0x833a('0xe')){_0x32526e=moment(_0x32526e)[_0x833a('0x2c')](0x0,!![])[_0x833a('0x2d')]();_0x3760f1=moment(_0x3760f1)[_0x833a('0x2c')](0x0,!![])[_0x833a('0x16')](0x17,_0x833a('0x2e'))['add'](0x3b,_0x833a('0x2f'))[_0x833a('0x16')](0x3b,_0x833a('0x30'))[_0x833a('0x2d')]();}_0x58d9fc={'start':_0x32526e,'end':_0x3760f1};break;default:_0x58d9fc[_0x833a('0x2a')]=_0x32526e;break;}return _0x58d9fc;} \ No newline at end of file +var _0xbb81=['days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','$eq','<>\x20?','$substring','LIKE\x20?','$lt','<\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','$between','utcOffset','hours','seconds','lodash','moment','parseSearch','startsWith','and','replace','[$or]','split','slice','forEach','shift','match','filter','indexOf','map','push','buildExpression','DATE','operator','value','includes','$gt','$lte','add'];(function(_0x489291,_0x3f78a8){var _0x2935f1=function(_0x129be3){while(--_0x129be3){_0x489291['push'](_0x489291['shift']());}};_0x2935f1(++_0x3f78a8);}(_0xbb81,0x126));var _0x1bb8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb81[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1bb8('0x0'));var moment=require(_0x1bb8('0x1'));exports[_0x1bb8('0x2')]=function(_0x201c28){var _0x192248={'conditions':[]};_0x192248['sqlOperator']=_[_0x1bb8('0x3')](_0x201c28,'[$or]')?'or':_0x1bb8('0x4');var _0x457ac1=_0x201c28[_0x1bb8('0x5')]('[$and]','')[_0x1bb8('0x5')](_0x1bb8('0x6'),'')[_0x1bb8('0x7')]('||');for(var _0x1bf88d=0x0;_0x1bf88d<_0x457ac1['length'];_0x1bf88d++){var _0x127069=_0x457ac1[_0x1bf88d]['split'](':=');var _0x49c5e6=_0x127069[0x0];var _0xb5ea3e=_0x127069[_0x1bb8('0x8')](0x1);_0xb5ea3e[_0x1bb8('0x9')](function(_0x5ac7d2){var _0x2af84b=_0x5ac7d2[_0x1bb8('0x7')]('[')[_0x1bb8('0xa')]();var _0x53b4eb=_0x5ac7d2[_0x1bb8('0xb')](/\[(.*?)\]/g);_0x53b4eb[_0x1bb8('0x9')](function(_0x470693){var _0x39068e=_0x470693[_0x1bb8('0x7')]('[')[_0x1bb8('0xc')](function(_0x31fd11){return _0x31fd11[_0x1bb8('0xd')](']')>-0x1;})[_0x1bb8('0xe')](function(_0x39b200){return _0x39b200[_0x1bb8('0x7')](']')[0x0];})[0x0];_0x192248['conditions'][_0x1bb8('0xf')]({'field':_0x49c5e6,'operator':_0x2af84b,'value':_0x39068e});});});}return _0x192248;};exports[_0x1bb8('0x10')]=function(_0x4d5044,_0x19b81f,_0x45d2b1){var _0x257a6d={};if(_0x19b81f===_0x1bb8('0x11')){if(_0x45d2b1[_0x1bb8('0x12')]==='$eq'){_0x45d2b1[_0x1bb8('0x12')]='$between';_0x45d2b1[_0x1bb8('0x13')]+=','+_0x45d2b1[_0x1bb8('0x13')];}else if(_[_0x1bb8('0x14')]([_0x1bb8('0x15'),_0x1bb8('0x16')],_0x45d2b1[_0x1bb8('0x12')])){_0x45d2b1['value']=moment(_0x45d2b1['value'])[_0x1bb8('0x17')](0x1,_0x1bb8('0x18'))[_0x1bb8('0x19')](_0x1bb8('0x1a'));}}if(_0x45d2b1[_0x1bb8('0x1b')]){_0x19b81f=_0x45d2b1[_0x1bb8('0x1b')];_0x257a6d[_0x1bb8('0x1c')]=_0x1bb8('0x1d')+_0x4d5044+'.'+_0x45d2b1[_0x1bb8('0x1e')]+_0x1bb8('0x1f')+_0x45d2b1['castTo']+')\x20'+parseOperator(_0x45d2b1[_0x1bb8('0x12')]);}else{_0x257a6d[_0x1bb8('0x1c')]=_0x4d5044+'.'+_0x45d2b1[_0x1bb8('0x1e')]+'\x20'+parseOperator(_0x45d2b1[_0x1bb8('0x12')]);}if(_['includes']([_0x1bb8('0x20'),_0x1bb8('0x21')],_0x45d2b1[_0x1bb8('0x12')]))_0x257a6d[_0x1bb8('0x1c')]='('+_0x257a6d[_0x1bb8('0x1c')]+_0x1bb8('0x22')+_0x4d5044+'.'+_0x45d2b1['field']+_0x1bb8('0x23');_0x257a6d[_0x1bb8('0x13')]=parseValue(_0x19b81f,_0x45d2b1[_0x1bb8('0x12')],_0x45d2b1['value']);return _0x257a6d;};function parseOperator(_0x72e5cb){var _0x2bc78a;switch(_0x72e5cb){case _0x1bb8('0x24'):_0x2bc78a='IN\x20?';break;case _0x1bb8('0x21'):_0x2bc78a='NOT\x20IN\x20?';break;case _0x1bb8('0x25'):_0x2bc78a='=\x20?';break;case _0x1bb8('0x20'):_0x2bc78a=_0x1bb8('0x26');break;case _0x1bb8('0x27'):case'$startsWith':case'$endsWith':_0x2bc78a=_0x1bb8('0x28');break;case _0x1bb8('0x29'):_0x2bc78a=_0x1bb8('0x2a');break;case'$gt':_0x2bc78a='>\x20?';break;case _0x1bb8('0x16'):_0x2bc78a=_0x1bb8('0x2b');break;case _0x1bb8('0x2c'):_0x2bc78a=_0x1bb8('0x2d');break;case'$between':_0x2bc78a=_0x1bb8('0x2e');break;}return _0x2bc78a;}function parseValue(_0x6328af,_0x5dee30,_0x39cc28){var _0x39d8b1={'start':undefined,'end':undefined};switch(_0x5dee30){case'$in':case _0x1bb8('0x21'):_0x39d8b1['start']=_0x39cc28[_0x1bb8('0x7')](',');break;case _0x1bb8('0x27'):_0x39d8b1[_0x1bb8('0x2f')]='%'+_0x39cc28+'%';break;case _0x1bb8('0x30'):_0x39d8b1[_0x1bb8('0x2f')]=_0x39cc28+'%';break;case'$endsWith':_0x39d8b1[_0x1bb8('0x2f')]='%'+_0x39cc28;break;case _0x1bb8('0x31'):var _0x48182c=_0x39cc28[_0x1bb8('0x7')](',');var _0x39cc28=_0x48182c[_0x1bb8('0xa')]();var _0x706145=_0x48182c['pop']();if(_0x6328af===_0x1bb8('0x11')){_0x39cc28=moment(_0x39cc28)[_0x1bb8('0x32')](0x0,!![])[_0x1bb8('0x19')]();_0x706145=moment(_0x706145)[_0x1bb8('0x32')](0x0,!![])[_0x1bb8('0x17')](0x17,_0x1bb8('0x33'))['add'](0x3b,'minutes')[_0x1bb8('0x17')](0x3b,_0x1bb8('0x34'))['format']();}_0x39d8b1={'start':_0x39cc28,'end':_0x706145};break;default:_0x39d8b1[_0x1bb8('0x2f')]=_0x39cc28;break;}return _0x39d8b1;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index c375be9..e5f2070 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 _0xdff4=['lodash','sequelize','moment','../../mysqldb','parse','includes','model','alias','fields','raw','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','$gte','format','$lte','utc','subtract','name','uniqueid','isArray','limit','map','indexOf','priority','cast','col','unsigned','substr','ASC','omit','isObject','isString','length','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','forEach','push','join','getOptions','query','$id','keys','intersection','attributes','nolimit','offset','sort','filter','object','columns','value','where','merge','VIRTUAL','lower','include','escapeLIKESpecialChars'];(function(_0x3a66e7,_0x5c0003){var _0x4edc1c=function(_0x23f176){while(--_0x23f176){_0x3a66e7['push'](_0x3a66e7['shift']());}};_0x4edc1c(++_0x5c0003);}(_0xdff4,0x114));var _0x4dff=function(_0x388b5c,_0x79668c){_0x388b5c=_0x388b5c-0x0;var _0x4fd23c=_0xdff4[_0x388b5c];return _0x4fd23c;};'use strict';var _=require(_0x4dff('0x0'));var sequelize=require(_0x4dff('0x1'));var moment=require(_0x4dff('0x2'));var db=require(_0x4dff('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2481dc){var _0x44a366=['ne'];try{var _0x4f599b=JSON[_0x4dff('0x4')](_0x2481dc);var _0x2f030d=Object['keys'](_0x4f599b)[0x0];return _0x44a366[_0x4dff('0x5')](_0x2f030d);}catch(_0x5bb92f){return![];}}function getOperatorValue(_0xda65c){var _0x5b698f=JSON[_0x4dff('0x4')](_0xda65c);var _0x51fe95=Object['keys'](_0x5b698f)[0x0];var _0x18c63d=_0x5b698f[_0x51fe95];return{['$'+_0x51fe95]:_0x18c63d};}function parseIncludeModel(_0x47cd71){var _0x33e8f1=JSON[_0x4dff('0x4')](_0x47cd71);return{'model':db[_0x33e8f1[_0x4dff('0x6')]],'as':_0x33e8f1[_0x4dff('0x7')],'attributes':_0x33e8f1[_0x4dff('0x8')],'raw':_0x33e8f1[_0x4dff('0x9')]};}exports['fields']=function(_0x388926){var _0x5c7a62=null;if(_0x388926){_0x5c7a62=_0x388926[_0x4dff('0xa')](',');}return _0x5c7a62;};exports[_0x4dff('0xb')]=function(_0x2aa833,_0x369df0){var _0xc055b5={};if(!_[_0x4dff('0xc')](_0x2aa833)){_[_0x4dff('0xd')](_0x2aa833,function(_0x3e0098,_0x3914bf){try{if(_0x369df0){var _0xbece3a=_['find'](_0x369df0,{'name':_0x3914bf})||{};if(hasSequelizeOperator(_0x3e0098)){_0xc055b5[_0x3914bf]=getOperatorValue(_0x3e0098);}else if(_0xbece3a[_0x4dff('0xe')]===_0x4dff('0xf')&&_[_0x4dff('0x10')](_0x3e0098)){var _0x1d7c40=JSON[_0x4dff('0x4')](_0x3e0098);var _0x218ca6={'$gte':moment(moment(_0x1d7c40[_0x4dff('0x11')])['format']('YYYY-MM-DD'))['utc']()[_0x4dff('0x12')](),'$lte':moment(moment(_0x1d7c40[_0x4dff('0x13')])['format']('YYYY-MM-DD'))[_0x4dff('0x14')]()[_0x4dff('0x15')](0x1,'s')[_0x4dff('0x12')]()};_0xc055b5[_0x3914bf]=_0x218ca6;}else if(_0xbece3a[_0x4dff('0x16')]===_0x4dff('0x17')){_0xc055b5[_0x3914bf]=_0x3e0098;}else{_0xc055b5[_0x3914bf]=_[_0x4dff('0x18')](_0x3e0098)?_0x3e0098:JSON[_0x4dff('0x4')](_0x3e0098);}}else{_0xc055b5[_0x3914bf]=_[_0x4dff('0x18')](_0x3e0098)?_0x3e0098:JSON['parse'](_0x3e0098);}}catch(_0x332f70){_0xc055b5[_0x3914bf]=_0x3e0098['split'](',');}});}return _0xc055b5;};exports[_0x4dff('0x19')]=function(_0x308710){_0x308710=parseInt(_0x308710,0xa);if(!_0x308710||_0x308710<0x0){_0x308710=LIMIT_VALUE;}return _0x308710;};exports['offset']=function(_0x1f63fc){_0x1f63fc=parseInt(_0x1f63fc,0xa);if(!_0x1f63fc||_0x1f63fc<0x0){_0x1f63fc=0x0;}return _0x1f63fc;};exports['sort']=function(_0x15709e){var _0x49a83c,_0xa68f97=null;if(_0x15709e){_0x49a83c=_0x15709e[_0x4dff('0xa')](',');_0xa68f97=_[_0x4dff('0x1a')](_0x49a83c,function(_0x3ca31f){if(_0x3ca31f[_0x4dff('0x1b')]('-')===0x0){return[_0x3ca31f===_0x4dff('0x1c')?sequelize[_0x4dff('0x1d')](sequelize[_0x4dff('0x1e')]('priority'),_0x4dff('0x1f')):_0x3ca31f[_0x4dff('0x20')](0x1),'DESC'];}else{return[_0x3ca31f===_0x4dff('0x1c')?sequelize[_0x4dff('0x1d')](sequelize[_0x4dff('0x1e')](_0x4dff('0x1c')),_0x4dff('0x1f')):_0x3ca31f,_0x4dff('0x21')];}});}return _0xa68f97;};exports[_0x4dff('0x22')]=function(_0x22e0ed,_0x273e68){if(_[_0x4dff('0xc')](_0x22e0ed)){return _0x22e0ed;}if(_[_0x4dff('0x18')](_0x22e0ed)){for(var _0x260cbd=0x0;_0x260cbd<_0x22e0ed['length'];_0x260cbd+=0x1){_0x22e0ed[_0x260cbd]=this[_0x4dff('0x22')](_0x22e0ed[_0x260cbd],_0x273e68);}return _0x22e0ed;}if(!_[_0x4dff('0x23')](_0x22e0ed)){return _0x22e0ed;}if(_[_0x4dff('0x24')](_0x273e68)){_0x273e68=[_0x273e68];}if(!_[_0x4dff('0x18')](_0x273e68)){return _0x22e0ed;}for(var _0x692fc2=0x0;_0x692fc2<_0x273e68[_0x4dff('0x25')];_0x692fc2+=0x1){_[_0x4dff('0x26')](_0x22e0ed,_0x273e68[_0x692fc2]);}for(var _0x3f65ab in _0x22e0ed){if(_0x22e0ed[_0x4dff('0x27')](_0x3f65ab)){_0x22e0ed[_0x3f65ab]=this[_0x4dff('0x22')](_0x22e0ed[_0x3f65ab],_0x273e68);}}return _0x22e0ed;};exports[_0x4dff('0x28')]=function(_0x5f15d8){return _0x5f15d8[_0x4dff('0x29')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x4dff('0x2a')]=function(_0x8835d3){return _0x8835d3[_0x4dff('0x29')](/^\S+@\S+$/)?!![]:![];};exports[_0x4dff('0x2b')]=function(_0x4d605c,_0x3bb3a7){var _0xff71d=[];var _0x93b5b3=/([^:]")"+/g;var _0x3a8855=/[*<>~@-]/g;var _0x225f3e=/[ `!@#$%^&*()_\-?~<>]/;var _0x297ba5=/[ ,]+/;var _0x481fb4=_0x3bb3a7?_0x4dff('0x2c'):_0x4dff('0x2d');if(_0x3bb3a7){_0x4d605c=_0x4d605c[_0x4dff('0x2e')](_0x3a8855,'\x20')['trim']();}_0x4d605c[_0x4dff('0xa')](_0x297ba5)[_0x4dff('0x2f')](function(_0x4ca724){_0x4ca724=_0x4ca724[_0x4dff('0x2e')](_0x93b5b3,'$1');_0x4ca724='+'+_0x4ca724+'*';var _0x3c1be6=_0x4ca724[_0x4dff('0x29')](_0x225f3e);if(_0x3c1be6){_0x4ca724='\x22'+_0x4ca724+'\x22';}_0xff71d[_0x4dff('0x30')](_0x4ca724);});_0x481fb4=_0x481fb4['replace'](_0x4dff('0x2d'),_0xff71d[_0x4dff('0x31')]('\x20'));return _0x481fb4;};exports[_0x4dff('0x32')]=function(_0x516935,_0x2d8d15,_0x30bfe1){var _0x30d1cf={},_0x38bd98={};if(_0x2d8d15[_0x4dff('0x33')][_0x4dff('0x34')]){_0x2d8d15[_0x4dff('0x33')]['id']=_0x2d8d15['query']['$id'];delete _0x2d8d15[_0x4dff('0x33')][_0x4dff('0x34')];}_0x30d1cf[_0x4dff('0x6')]=_[_0x4dff('0x1a')](_0x516935,_0x4dff('0x16'));_0x30d1cf['query']=_[_0x4dff('0x35')](_0x2d8d15[_0x4dff('0x33')]);_0x30d1cf[_0x4dff('0xb')]=_[_0x4dff('0x36')](_0x30d1cf[_0x4dff('0x6')],_0x30d1cf[_0x4dff('0x33')]);_0x38bd98['attributes']=_[_0x4dff('0x36')](_0x30d1cf[_0x4dff('0x6')],this['fields'](_0x2d8d15[_0x4dff('0x33')][_0x4dff('0x8')]));_0x38bd98['attributes']=_0x38bd98[_0x4dff('0x37')][_0x4dff('0x25')]?_0x38bd98[_0x4dff('0x37')]:_0x30d1cf[_0x4dff('0x6')];if(!_0x2d8d15[_0x4dff('0x33')][_0x4dff('0x27')](_0x4dff('0x38'))){_0x38bd98[_0x4dff('0x19')]=this[_0x4dff('0x19')](_0x2d8d15[_0x4dff('0x33')][_0x4dff('0x19')]);_0x38bd98[_0x4dff('0x39')]=this[_0x4dff('0x39')](_0x2d8d15[_0x4dff('0x33')]['offset']);}_0x38bd98['order']=this[_0x4dff('0x3a')](_0x2d8d15[_0x4dff('0x33')][_0x4dff('0x3a')]);_0x38bd98['where']=this[_0x4dff('0xb')](_['pick'](_0x2d8d15[_0x4dff('0x33')],_0x30d1cf[_0x4dff('0xb')]),_0x516935);if(_0x2d8d15[_0x4dff('0x33')][_0x4dff('0x3b')]){var _0x439190=_0x516935;var _0xf3c3d1=_0x2d8d15[_0x4dff('0x33')]['filter'];if(typeof _0xf3c3d1===_0x4dff('0x3c')){_0x439190=_[_0x4dff('0x3b')](_0x516935,function(_0x3449a5){return _[_0x4dff('0x5')](_0xf3c3d1[_0x4dff('0x3d')],_0x3449a5['name']);});_0xf3c3d1=_0xf3c3d1[_0x4dff('0x3e')];}_0x38bd98[_0x4dff('0x3f')]=_[_0x4dff('0x40')](_0x38bd98[_0x4dff('0x3f')],{'$or':_[_0x4dff('0x1a')](_0x439190,function(_0x1d29e4){if(_0x1d29e4['type']!==_0x4dff('0x41')){if(_0x30bfe1){return sequelize[_0x4dff('0x3f')](sequelize['fn'](_0x4dff('0x42'),sequelize[_0x4dff('0x1e')](_0x1d29e4['name'])),{'$like':sequelize['fn'](_0x4dff('0x42'),'%'+_0x2d8d15[_0x4dff('0x33')][_0x4dff('0x3b')]+'%')});}else{var _0x47399c={};_0x47399c[_0x1d29e4[_0x4dff('0x16')]]={'$like':'%'+_0x2d8d15[_0x4dff('0x33')]['filter']+'%'};return _0x47399c;}}})});}_0x38bd98=_[_0x4dff('0x40')]({},_0x38bd98,_0x2d8d15['options']);return _0x38bd98;};exports[_0x4dff('0x43')]=function(_0x27f0f9){var _0x57f683=[];if(_0x27f0f9['includeAll']){_0x57f683[_0x4dff('0x30')]({'all':!![]});}else if(_0x27f0f9[_0x4dff('0x43')]){if(Array['isArray'](_0x27f0f9['include'])){_0x57f683=Object[_0x4dff('0x35')](_0x27f0f9['include'])[_0x4dff('0x1a')](function(_0x22983e){return parseIncludeModel(_0x27f0f9['include'][_0x22983e]);});}else{var _0x40d526=parseIncludeModel(_0x27f0f9[_0x4dff('0x43')]);_0x57f683[_0x4dff('0x30')](_0x40d526);}}return _0x57f683;};exports[_0x4dff('0x44')]=function(_0x221b76){return _0x221b76[_0x4dff('0x2e')](/[%_^-]/g,function(_0x2d5d64){return'\x5c'+_0x2d5d64;});}; \ No newline at end of file +var _0x7aca=['split','offset','sort','map','indexOf','priority','col','DESC','cast','unsigned','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','\x22{EXPR}\x22','{EXPR}','replace','forEach','push','getOptions','query','$id','model','name','attributes','nolimit','limit','where','filter','columns','value','merge','VIRTUAL','lower','options','include','escapeLIKESpecialChars','lodash','moment','../../mysqldb','parse','keys','alias','fields','raw','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','uniqueid','isArray'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x7aca,0x1ea));var _0xa7ac=function(_0x569d72,_0x415be2){_0x569d72=_0x569d72-0x0;var _0xa891a0=_0x7aca[_0x569d72];return _0xa891a0;};'use strict';var _=require(_0xa7ac('0x0'));var sequelize=require('sequelize');var moment=require(_0xa7ac('0x1'));var db=require(_0xa7ac('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2012e7){var _0x1c4859=['ne'];try{var _0x274013=JSON[_0xa7ac('0x3')](_0x2012e7);var _0x112b86=Object[_0xa7ac('0x4')](_0x274013)[0x0];return _0x1c4859['includes'](_0x112b86);}catch(_0x36cd05){return![];}}function getOperatorValue(_0x3fb9d2){var _0x39f5ce=JSON['parse'](_0x3fb9d2);var _0x443d26=Object[_0xa7ac('0x4')](_0x39f5ce)[0x0];var _0x5af0df=_0x39f5ce[_0x443d26];return{['$'+_0x443d26]:_0x5af0df};}function parseIncludeModel(_0x972742){var _0x3017ca=JSON[_0xa7ac('0x3')](_0x972742);return{'model':db[_0x3017ca['model']],'as':_0x3017ca[_0xa7ac('0x5')],'attributes':_0x3017ca[_0xa7ac('0x6')],'raw':_0x3017ca[_0xa7ac('0x7')]};}exports[_0xa7ac('0x6')]=function(_0x5dd18e){var _0x2ab819=null;if(_0x5dd18e){_0x2ab819=_0x5dd18e['split'](',');}return _0x2ab819;};exports[_0xa7ac('0x8')]=function(_0x4047e4,_0x3b0001){var _0x4aca56={};if(!_[_0xa7ac('0x9')](_0x4047e4)){_[_0xa7ac('0xa')](_0x4047e4,function(_0x1fdc15,_0x13b974){try{if(_0x3b0001){var _0x4b21c0=_[_0xa7ac('0xb')](_0x3b0001,{'name':_0x13b974})||{};if(hasSequelizeOperator(_0x1fdc15)){_0x4aca56[_0x13b974]=getOperatorValue(_0x1fdc15);}else if(_0x4b21c0[_0xa7ac('0xc')]===_0xa7ac('0xd')&&_[_0xa7ac('0xe')](_0x1fdc15)){var _0x13e77e=JSON[_0xa7ac('0x3')](_0x1fdc15);var _0x2ab680={'$gte':moment(moment(_0x13e77e[_0xa7ac('0xf')])[_0xa7ac('0x10')](_0xa7ac('0x11')))[_0xa7ac('0x12')]()[_0xa7ac('0x10')](),'$lte':moment(moment(_0x13e77e[_0xa7ac('0x13')])[_0xa7ac('0x10')](_0xa7ac('0x11')))['utc']()['subtract'](0x1,'s')[_0xa7ac('0x10')]()};_0x4aca56[_0x13b974]=_0x2ab680;}else if(_0x4b21c0['name']===_0xa7ac('0x14')){_0x4aca56[_0x13b974]=_0x1fdc15;}else{_0x4aca56[_0x13b974]=_['isArray'](_0x1fdc15)?_0x1fdc15:JSON[_0xa7ac('0x3')](_0x1fdc15);}}else{_0x4aca56[_0x13b974]=_[_0xa7ac('0x15')](_0x1fdc15)?_0x1fdc15:JSON[_0xa7ac('0x3')](_0x1fdc15);}}catch(_0x50fd80){_0x4aca56[_0x13b974]=_0x1fdc15[_0xa7ac('0x16')](',');}});}return _0x4aca56;};exports['limit']=function(_0x409ddb){_0x409ddb=parseInt(_0x409ddb,0xa);if(!_0x409ddb||_0x409ddb<0x0){_0x409ddb=LIMIT_VALUE;}return _0x409ddb;};exports[_0xa7ac('0x17')]=function(_0x4cbae4){_0x4cbae4=parseInt(_0x4cbae4,0xa);if(!_0x4cbae4||_0x4cbae4<0x0){_0x4cbae4=0x0;}return _0x4cbae4;};exports[_0xa7ac('0x18')]=function(_0x22e91f){var _0x5c33b8,_0xe657=null;if(_0x22e91f){_0x5c33b8=_0x22e91f[_0xa7ac('0x16')](',');_0xe657=_[_0xa7ac('0x19')](_0x5c33b8,function(_0x3a8e02){if(_0x3a8e02[_0xa7ac('0x1a')]('-')===0x0){return[_0x3a8e02===_0xa7ac('0x1b')?sequelize['cast'](sequelize[_0xa7ac('0x1c')](_0xa7ac('0x1b')),'unsigned'):_0x3a8e02['substr'](0x1),_0xa7ac('0x1d')];}else{return[_0x3a8e02===_0xa7ac('0x1b')?sequelize[_0xa7ac('0x1e')](sequelize[_0xa7ac('0x1c')](_0xa7ac('0x1b')),_0xa7ac('0x1f')):_0x3a8e02,'ASC'];}});}return _0xe657;};exports[_0xa7ac('0x20')]=function(_0x56902b,_0x27174d){if(_[_0xa7ac('0x9')](_0x56902b)){return _0x56902b;}if(_[_0xa7ac('0x15')](_0x56902b)){for(var _0xba9720=0x0;_0xba9720<_0x56902b[_0xa7ac('0x21')];_0xba9720+=0x1){_0x56902b[_0xba9720]=this[_0xa7ac('0x20')](_0x56902b[_0xba9720],_0x27174d);}return _0x56902b;}if(!_[_0xa7ac('0x22')](_0x56902b)){return _0x56902b;}if(_[_0xa7ac('0x23')](_0x27174d)){_0x27174d=[_0x27174d];}if(!_[_0xa7ac('0x15')](_0x27174d)){return _0x56902b;}for(var _0x1f3d15=0x0;_0x1f3d15<_0x27174d['length'];_0x1f3d15+=0x1){_[_0xa7ac('0x24')](_0x56902b,_0x27174d[_0x1f3d15]);}for(var _0x27e94c in _0x56902b){if(_0x56902b[_0xa7ac('0x25')](_0x27e94c)){_0x56902b[_0x27e94c]=this[_0xa7ac('0x20')](_0x56902b[_0x27e94c],_0x27174d);}}return _0x56902b;};exports[_0xa7ac('0x26')]=function(_0x352361){return _0x352361[_0xa7ac('0x27')](RegExp(_0xa7ac('0x28')))?!![]:![];};exports['isEmail']=function(_0x5ccf19){return _0x5ccf19[_0xa7ac('0x27')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x39fd85,_0x2d3ff7){var _0x281177=[];var _0x48031b=/([^:]")"+/g;var _0x20ebb3=/[*<>~@-]/g;var _0x23aca1=/[ `!@#$%^&*()_\-?~<>]/;var _0x256a97=/[ ,]+/;var _0x2f8553=_0x2d3ff7?_0xa7ac('0x29'):_0xa7ac('0x2a');if(_0x2d3ff7){_0x39fd85=_0x39fd85[_0xa7ac('0x2b')](_0x20ebb3,'\x20')['trim']();}_0x39fd85[_0xa7ac('0x16')](_0x256a97)[_0xa7ac('0x2c')](function(_0x1fc256){_0x1fc256=_0x1fc256[_0xa7ac('0x2b')](_0x48031b,'$1');_0x1fc256='+'+_0x1fc256+'*';var _0x11f28b=_0x1fc256[_0xa7ac('0x27')](_0x23aca1);if(_0x11f28b){_0x1fc256='\x22'+_0x1fc256+'\x22';}_0x281177[_0xa7ac('0x2d')](_0x1fc256);});_0x2f8553=_0x2f8553[_0xa7ac('0x2b')](_0xa7ac('0x2a'),_0x281177['join']('\x20'));return _0x2f8553;};exports[_0xa7ac('0x2e')]=function(_0x5521f4,_0x36f7ba,_0x28bc6e){var _0x193c8d={},_0x41cb51={};if(_0x36f7ba[_0xa7ac('0x2f')][_0xa7ac('0x30')]){_0x36f7ba[_0xa7ac('0x2f')]['id']=_0x36f7ba[_0xa7ac('0x2f')][_0xa7ac('0x30')];delete _0x36f7ba[_0xa7ac('0x2f')][_0xa7ac('0x30')];}_0x193c8d[_0xa7ac('0x31')]=_[_0xa7ac('0x19')](_0x5521f4,_0xa7ac('0x32'));_0x193c8d['query']=_[_0xa7ac('0x4')](_0x36f7ba[_0xa7ac('0x2f')]);_0x193c8d[_0xa7ac('0x8')]=_['intersection'](_0x193c8d[_0xa7ac('0x31')],_0x193c8d[_0xa7ac('0x2f')]);_0x41cb51[_0xa7ac('0x33')]=_['intersection'](_0x193c8d[_0xa7ac('0x31')],this['fields'](_0x36f7ba[_0xa7ac('0x2f')][_0xa7ac('0x6')]));_0x41cb51[_0xa7ac('0x33')]=_0x41cb51['attributes'][_0xa7ac('0x21')]?_0x41cb51['attributes']:_0x193c8d[_0xa7ac('0x31')];if(!_0x36f7ba['query']['hasOwnProperty'](_0xa7ac('0x34'))){_0x41cb51['limit']=this[_0xa7ac('0x35')](_0x36f7ba[_0xa7ac('0x2f')][_0xa7ac('0x35')]);_0x41cb51[_0xa7ac('0x17')]=this[_0xa7ac('0x17')](_0x36f7ba['query'][_0xa7ac('0x17')]);}_0x41cb51['order']=this[_0xa7ac('0x18')](_0x36f7ba[_0xa7ac('0x2f')][_0xa7ac('0x18')]);_0x41cb51[_0xa7ac('0x36')]=this[_0xa7ac('0x8')](_['pick'](_0x36f7ba[_0xa7ac('0x2f')],_0x193c8d[_0xa7ac('0x8')]),_0x5521f4);if(_0x36f7ba[_0xa7ac('0x2f')][_0xa7ac('0x37')]){var _0x1995fd=_0x5521f4;var _0x56bf7a=_0x36f7ba['query'][_0xa7ac('0x37')];if(typeof _0x56bf7a==='object'){_0x1995fd=_[_0xa7ac('0x37')](_0x5521f4,function(_0x3cefdb){return _['includes'](_0x56bf7a[_0xa7ac('0x38')],_0x3cefdb[_0xa7ac('0x32')]);});_0x56bf7a=_0x56bf7a[_0xa7ac('0x39')];}_0x41cb51[_0xa7ac('0x36')]=_[_0xa7ac('0x3a')](_0x41cb51[_0xa7ac('0x36')],{'$or':_['map'](_0x1995fd,function(_0x4408c9){if(_0x4408c9[_0xa7ac('0xc')]!==_0xa7ac('0x3b')){if(_0x28bc6e){return sequelize['where'](sequelize['fn'](_0xa7ac('0x3c'),sequelize[_0xa7ac('0x1c')](_0x4408c9['name'])),{'$like':sequelize['fn'](_0xa7ac('0x3c'),'%'+_0x36f7ba['query'][_0xa7ac('0x37')]+'%')});}else{var _0x24fc51={};_0x24fc51[_0x4408c9[_0xa7ac('0x32')]]={'$like':'%'+_0x36f7ba[_0xa7ac('0x2f')][_0xa7ac('0x37')]+'%'};return _0x24fc51;}}})});}_0x41cb51=_[_0xa7ac('0x3a')]({},_0x41cb51,_0x36f7ba[_0xa7ac('0x3d')]);return _0x41cb51;};exports[_0xa7ac('0x3e')]=function(_0x251e7a){var _0x389bd9=[];if(_0x251e7a['includeAll']){_0x389bd9[_0xa7ac('0x2d')]({'all':!![]});}else if(_0x251e7a['include']){if(Array['isArray'](_0x251e7a[_0xa7ac('0x3e')])){_0x389bd9=Object[_0xa7ac('0x4')](_0x251e7a[_0xa7ac('0x3e')])['map'](function(_0x650452){return parseIncludeModel(_0x251e7a[_0xa7ac('0x3e')][_0x650452]);});}else{var _0x5271c2=parseIncludeModel(_0x251e7a[_0xa7ac('0x3e')]);_0x389bd9['push'](_0x5271c2);}}return _0x389bd9;};exports[_0xa7ac('0x3f')]=function(_0x33f69a){return _0x33f69a[_0xa7ac('0x2b')](/[%_^-]/g,function(_0x472460){return'\x5c'+_0x472460;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 5ccc14f..1d4f21d 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb3f=['unknown','pause','*pause','busy','getAgentStatus','isArray','startCase','map','findOne','getAgents','flatten','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','name','fullname','pauseType','find','globalStatus','catch','split','fields','startsWith','ASC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter','sort','DESC','toLowerCase','userpic','lastLoginAt','lastPauseAt','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','online','pick','filterAgentAttributes','whatsappStatusTime','openchannelCapacity','phoneBarEnableAutomaticScreenRecording','onhold','queue','screenrecording','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','every','filter','length','idle','unavailable','ringing','isNil','voiceStatus','voicePause','chatStatus','faxStatus','mailStatus','smsStatus','whatsappStatus','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0xeb3f,0xa8));var _0xfeb3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xeb3f[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xfeb3('0x0'));var jayson=require(_0xfeb3('0x1'));var db=require(_0xfeb3('0x2'))['db'];var amiClient=jayson[_0xfeb3('0x3')][_0xfeb3('0x4')]({'port':0x232a});var routingClient=jayson[_0xfeb3('0x3')][_0xfeb3('0x4')]({'port':0x232c});function isAgentPaused(_0x1b0d84,_0x1f27f4){var _0x125a2f=[_0x1b0d84[_0xfeb3('0x5')],_0x1b0d84[_0xfeb3('0x6')],_0x1b0d84[_0xfeb3('0x7')],_0x1b0d84[_0xfeb3('0x8')],_0x1b0d84[_0xfeb3('0x9')],_0x1b0d84['voicePause'],_0x1b0d84[_0xfeb3('0xa')]];if(!_0x1f27f4)return _[_0xfeb3('0xb')](_0x125a2f);var _0x45695c=_[_0xfeb3('0xc')](_0x125a2f);return _0x45695c[_0xfeb3('0xd')]>0x0&&_0x45695c[_0xfeb3('0xd')]<_0x125a2f[_0xfeb3('0xd')]?!![]:![];}function isIdle(_0x2b9150){return _0x2b9150===_0xfeb3('0xe')||_0x2b9150==='unknown'||_0x2b9150===_0xfeb3('0xf')||_0x2b9150===_0xfeb3('0x10')||_[_0xfeb3('0x11')](_0x2b9150);}function isAgentIdle(_0x1838b3){if(_0x1838b3[_0xfeb3('0x12')]!==_0xfeb3('0xe')&&_0x1838b3[_0xfeb3('0x13')]){_0x1838b3[_0xfeb3('0x12')]='pause';return![];}return _[_0xfeb3('0xb')]([_0x1838b3[_0xfeb3('0x14')],_0x1838b3[_0xfeb3('0x15')],_0x1838b3[_0xfeb3('0x16')],_0x1838b3['openchannelStatus'],_0x1838b3[_0xfeb3('0x17')],_0x1838b3['voiceStatus'],_0x1838b3[_0xfeb3('0x18')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xfeb3('0x19')](_0xfeb3('0x1a'),{})[_0xfeb3('0x1b')](function(_0x1b6df3){if(_0x1b6df3['error']){throw new Error(_0xfeb3('0x1c'));}var _0x363a9c=_0x1b6df3[_0xfeb3('0x1d')];return routingClient['request']('Agents',{})['then'](function(_0x1465d4){if(_0x1465d4['error']){throw new Error(_0xfeb3('0x1e'));}var _0x1fdb64=_0x1465d4[_0xfeb3('0x1d')];return _[_0xfeb3('0x1f')]({},_0x363a9c,_0x1fdb64);});})['catch'](function(_0x338c37){throw _0x338c37;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x505f02){var _0x4d48a2=_0xfeb3('0x20');if(isAgentPaused(_0x505f02))_0x4d48a2=_0xfeb3('0x21');else if(isAgentPaused(_0x505f02,!![]))_0x4d48a2=_0xfeb3('0x22');else if(isAgentIdle(_0x505f02))_0x4d48a2='idle';else _0x4d48a2=_0xfeb3('0x23');return _0x4d48a2;}exports[_0xfeb3('0x24')]=getAgentStatus;function getAgentIdsByQueues(_0x421ccd,_0x43a21f){var _0x8b1cc1=_[_0xfeb3('0x25')](_0x421ccd)?_0x421ccd:[_0x421ccd];var _0x4704fa=_[_0xfeb3('0x26')](_0x43a21f)+'Queue';var _0x3978eb=_[_0xfeb3('0x27')](_0x8b1cc1,function(_0x9580ae){return db[_0x4704fa][_0xfeb3('0x28')]({'where':{'id':_0x9580ae}})[_0xfeb3('0x1b')](function(_0x17b5f4){if(!_0x17b5f4)return[];return _0x17b5f4[_0xfeb3('0x29')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x3978eb)[_0xfeb3('0x1b')](function(_0x5d6b65){var _0x279c3e=_(_0x5d6b65)[_0xfeb3('0x2a')]()['map']('id')[_0xfeb3('0x2b')]()[_0xfeb3('0x2c')]();return _0x279c3e;});}exports[_0xfeb3('0x2d')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x2a6df6,_0x4a7478,_0x1d8c33){try{if(_0x4a7478[_0xfeb3('0xd')]>0x0){_0x2a6df6=_0x2a6df6[_0xfeb3('0xc')](function(_0x4c3781){return _0x4a7478[_0xfeb3('0x2e')](_0x4c3781['id']);});}var _0x499096=_0x2a6df6[_0xfeb3('0xc')](function(_0x342a91){var _0x380c98=_0xfeb3('0x23');if(isAgentIdle(_0x342a91)){_0x380c98=_0xfeb3('0xe');}return _0x380c98===_0x1d8c33;});return _[_0xfeb3('0x27')](_0x499096,'id');}catch(_0x27fd16){throw _0x27fd16;}}exports[_0xfeb3('0x2f')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x38cbec,_0x3582d8,_0xe35b03){return Promise[_0xfeb3('0x30')]()['then'](function(){if(_0x3582d8['length']>0x0){_0x38cbec=_0x38cbec[_0xfeb3('0xc')](function(_0x31bbff){return _0x3582d8[_0xfeb3('0x2e')](_0x31bbff['id']);});}return _0x38cbec;})[_0xfeb3('0x1b')](function(){return db['User']['findAll']({'attributes':['id',_0xfeb3('0x31'),_0xfeb3('0x32'),_0xfeb3('0x5'),_0xfeb3('0x6'),_0xfeb3('0x7'),_0xfeb3('0x8'),_0xfeb3('0x9'),_0xfeb3('0x13'),_0xfeb3('0xa'),_0xfeb3('0x33')],'where':{'id':{'$in':_[_0xfeb3('0x27')](_0x38cbec,'id')}},'raw':!![]});})[_0xfeb3('0x1b')](function(_0x2539c1){return _0x2539c1[_0xfeb3('0x27')](function(_0x175304){var _0x390bc3=_[_0xfeb3('0x34')](_0x38cbec,['id',_0x175304['id']]);var _0x3500c5=filterAgentAttributes(_0x390bc3);_['merge'](_0x175304,_0x3500c5);_0x175304[_0xfeb3('0x35')]=getAgentStatus(_0x175304);return _0x175304;});})[_0xfeb3('0x1b')](function(_0x88d0d0){var _0x305f29=sortAgentsByStatus(_0x88d0d0,_0xe35b03);return _[_0xfeb3('0x27')](_0x305f29,'id');})[_0xfeb3('0x36')](function(_0x504527){throw _0x504527;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x8f15a8){var _0x6d3617={'fields':[],'order':null};var _0x1f7941=_0x8f15a8[_0xfeb3('0x37')](',');_0x6d3617[_0xfeb3('0x38')]=_[_0xfeb3('0xc')](_0x1f7941,function(_0x22616e){if(!_0x22616e['includes']('globalStatus')){return!![];}_0x6d3617['order']=_[_0xfeb3('0x39')](_0x22616e,'-')?'DESC':_0xfeb3('0x3a');return![];});return _0x6d3617;}exports[_0xfeb3('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0xee3ef0){if(!_0xee3ef0){_0xee3ef0=_0xfeb3('0x3c');}if(_0xee3ef0[_0xfeb3('0x2e')](_0xfeb3('0x32'))&&!_0xee3ef0['includes'](_0xfeb3('0x3d'))){var _0x5dc530=_0xee3ef0[_0xfeb3('0x3e')](0x0,_0xee3ef0[_0xfeb3('0x3f')](_0xfeb3('0x32')));_0xee3ef0+=','+_0x5dc530+_0xfeb3('0x3d');}return _0xee3ef0;}exports[_0xfeb3('0x40')]=validateSortParameter;function sortAgentsByStatus(_0x327b37,_0x2fd65c){var _0x452a07=_0x327b37[_0xfeb3('0x41')](function(_0x196b03,_0x11a504){if(_0x196b03['globalStatus']===_0x11a504[_0xfeb3('0x35')]){if(_0x196b03[_0xfeb3('0x35')]==='pause'){if(_0x2fd65c===_0xfeb3('0x42')){return(_0x196b03['pauseType']||'')<(_0x11a504[_0xfeb3('0x33')]||'')||_0x196b03['fullname'][_0xfeb3('0x43')]()>_0x11a504['fullname'][_0xfeb3('0x43')]()?0x1:-0x1;}else{return(_0x196b03['pauseType']||'')<(_0x11a504[_0xfeb3('0x33')]||'')||_0x196b03[_0xfeb3('0x32')]['toLowerCase']()>_0x11a504['fullname'][_0xfeb3('0x43')]()?-0x1:0x1;}}else{if(_0x2fd65c==='DESC'){return _0x196b03[_0xfeb3('0x32')][_0xfeb3('0x43')]()<_0x11a504[_0xfeb3('0x32')][_0xfeb3('0x43')]()?0x1:-0x1;}else{return _0x196b03[_0xfeb3('0x32')][_0xfeb3('0x43')]()<_0x11a504[_0xfeb3('0x32')][_0xfeb3('0x43')]()?-0x1:0x1;}}}else{if(_0x2fd65c===_0xfeb3('0x42')){return _0x196b03[_0xfeb3('0x35')]<_0x11a504[_0xfeb3('0x35')]?0x1:-0x1;}else{return _0x196b03[_0xfeb3('0x35')]<_0x11a504[_0xfeb3('0x35')]?-0x1:0x1;}}});return _0x452a07;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0xca6cae){var _0x4c317b=[_0xfeb3('0x44'),'online',_0xfeb3('0x45'),_0xfeb3('0x46'),_0xfeb3('0x33'),_0xfeb3('0x46'),_0xfeb3('0x3d'),'address',_0xfeb3('0x5'),'openchannelPause',_0xfeb3('0x7'),'smsPause',_0xfeb3('0xa'),_0xfeb3('0x6'),_0xfeb3('0x13'),_0xfeb3('0x47'),'openchannelCapacity',_0xfeb3('0x48'),_0xfeb3('0x49'),_0xfeb3('0x4a'),_0xfeb3('0x4b'),_0xfeb3('0x4c'),_0xfeb3('0x4d'),_0xfeb3('0x4e'),_0xfeb3('0x4f'),_0xfeb3('0x50'),_0xfeb3('0x51'),_0xfeb3('0x14'),_0xfeb3('0x52'),'mailStatus',_0xfeb3('0x17'),_0xfeb3('0x18'),_0xfeb3('0x15'),_0xfeb3('0x12'),_0xfeb3('0x53'),_0xfeb3('0x54'),_0xfeb3('0x55'),_0xfeb3('0x56'),'whatsappStatusTime',_0xfeb3('0x57'),_0xfeb3('0x58'),'queue',_0xfeb3('0x59'),'screenrecording',_0xfeb3('0x5a'),'phoneBarEnableAutomaticScreenRecording'];var _0xf61925=[_0xfeb3('0x5'),'openchannelPause',_0xfeb3('0x7'),_0xfeb3('0x9'),_0xfeb3('0xa'),_0xfeb3('0x6'),_0xfeb3('0x13'),_0xfeb3('0x5b')];var _0x138ebd=_(_0xca6cae)['omit'](_0xf61925)[_0xfeb3('0x5c')](_0x4c317b)[_0xfeb3('0x2c')]();return _0x138ebd;}exports[_0xfeb3('0x5d')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xfeb3('0x31'),'fullname','role',_0xfeb3('0x3d'),_0xfeb3('0x5b'),'globalStatus','userpic',_0xfeb3('0x45'),_0xfeb3('0x33'),'lastPauseAt',_0xfeb3('0x6'),'chatPause',_0xfeb3('0x7'),_0xfeb3('0x8'),'smsPause',_0xfeb3('0x13'),_0xfeb3('0xa'),_0xfeb3('0x14'),'faxStatus',_0xfeb3('0x16'),_0xfeb3('0x52'),_0xfeb3('0x17'),_0xfeb3('0x12'),_0xfeb3('0x18'),_0xfeb3('0x53'),'faxStatusTime',_0xfeb3('0x55'),_0xfeb3('0x54'),_0xfeb3('0x56'),_0xfeb3('0x58'),_0xfeb3('0x5e'),'chatCapacity',_0xfeb3('0x4b'),_0xfeb3('0x48'),_0xfeb3('0x5f'),'smsCapacity',_0xfeb3('0x4a'),_0xfeb3('0x4c'),'faxCurrentCapacity',_0xfeb3('0x4e'),_0xfeb3('0x4d'),'smsCurrentCapacity','whatsappCurrentCapacity',_0xfeb3('0x5a'),_0xfeb3('0x60'),_0xfeb3('0x59'),_0xfeb3('0x61'),_0xfeb3('0x62'),_0xfeb3('0x63')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xb7aa=['voiceStatus','voicePause','chatStatus','faxStatus','mailStatus','smsStatus','request','Agents','then','error','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','getRealtimeAgents','pause','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','flatten','uniq','value','includes','getAgentIdsByStatus','resolve','findAll','fullname','chatPause','find','globalStatus','getSortedAgentsIdsByStatus','fields','order','startsWith','DESC','fullname,internal','internal','substring','validateSortParameter','pauseType','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','smsCapacity','whatsappCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','omit','pick','filterAgentAttributes','name','role','openchannelStatus','chatCapacity','faxCapacity','openchannelCapacity','chatCurrentCapacity','phoneBarEnableScreenRecordingByAgent','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','isNil'];(function(_0x2e2c26,_0x1b3e84){var _0x345643=function(_0x564df5){while(--_0x564df5){_0x2e2c26['push'](_0x2e2c26['shift']());}};_0x345643(++_0x1b3e84);}(_0xb7aa,0x11a));var _0xab7a=function(_0x5c56ec,_0xc7f70b){_0x5c56ec=_0x5c56ec-0x0;var _0x438537=_0xb7aa[_0x5c56ec];return _0x438537;};'use strict';var _=require(_0xab7a('0x0'));var jayson=require(_0xab7a('0x1'));var db=require(_0xab7a('0x2'))['db'];var amiClient=jayson[_0xab7a('0x3')][_0xab7a('0x4')]({'port':0x232a});var routingClient=jayson[_0xab7a('0x3')][_0xab7a('0x4')]({'port':0x232c});function isAgentPaused(_0x242521,_0x34adc3){var _0x3b0621=[_0x242521['chatPause'],_0x242521[_0xab7a('0x5')],_0x242521[_0xab7a('0x6')],_0x242521[_0xab7a('0x7')],_0x242521[_0xab7a('0x8')],_0x242521['voicePause'],_0x242521[_0xab7a('0x9')]];if(!_0x34adc3)return _[_0xab7a('0xa')](_0x3b0621);var _0x520d21=_[_0xab7a('0xb')](_0x3b0621);return _0x520d21[_0xab7a('0xc')]>0x0&&_0x520d21[_0xab7a('0xc')]<_0x3b0621[_0xab7a('0xc')]?!![]:![];}function isIdle(_0x40cc81){return _0x40cc81===_0xab7a('0xd')||_0x40cc81===_0xab7a('0xe')||_0x40cc81===_0xab7a('0xf')||_0x40cc81===_0xab7a('0x10')||_[_0xab7a('0x11')](_0x40cc81);}function isAgentIdle(_0x563b84){if(_0x563b84[_0xab7a('0x12')]!==_0xab7a('0xd')&&_0x563b84[_0xab7a('0x13')]){_0x563b84[_0xab7a('0x12')]='pause';return![];}return _[_0xab7a('0xa')]([_0x563b84[_0xab7a('0x14')],_0x563b84[_0xab7a('0x15')],_0x563b84[_0xab7a('0x16')],_0x563b84['openchannelStatus'],_0x563b84[_0xab7a('0x17')],_0x563b84[_0xab7a('0x12')],_0x563b84['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0xab7a('0x18')](_0xab7a('0x19'),{})[_0xab7a('0x1a')](function(_0x8ddb0d){if(_0x8ddb0d[_0xab7a('0x1b')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x198e78=_0x8ddb0d[_0xab7a('0x1c')];return routingClient['request'](_0xab7a('0x19'),{})[_0xab7a('0x1a')](function(_0x187f51){if(_0x187f51[_0xab7a('0x1b')]){throw new Error(_0xab7a('0x1d'));}var _0x14b2b5=_0x187f51[_0xab7a('0x1c')];return _['merge']({},_0x198e78,_0x14b2b5);});})[_0xab7a('0x1e')](function(_0x2ea6c8){throw _0x2ea6c8;});}exports[_0xab7a('0x1f')]=getRealtimeAgents;function getAgentStatus(_0x9db11a){var _0x2fa287=_0xab7a('0xe');if(isAgentPaused(_0x9db11a))_0x2fa287=_0xab7a('0x20');else if(isAgentPaused(_0x9db11a,!![]))_0x2fa287=_0xab7a('0x21');else if(isAgentIdle(_0x9db11a))_0x2fa287=_0xab7a('0xd');else _0x2fa287=_0xab7a('0x22');return _0x2fa287;}exports[_0xab7a('0x23')]=getAgentStatus;function getAgentIdsByQueues(_0x5b7ee4,_0x4b65f0){var _0x5c4c3e=_[_0xab7a('0x24')](_0x5b7ee4)?_0x5b7ee4:[_0x5b7ee4];var _0x210ac6=_[_0xab7a('0x25')](_0x4b65f0)+_0xab7a('0x26');var _0x41ecb5=_[_0xab7a('0x27')](_0x5c4c3e,function(_0x3324f2){return db[_0x210ac6]['findOne']({'where':{'id':_0x3324f2}})['then'](function(_0x2c62dc){if(!_0x2c62dc)return[];return _0x2c62dc['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x41ecb5)[_0xab7a('0x1a')](function(_0x570a8b){var _0x169417=_(_0x570a8b)[_0xab7a('0x28')]()[_0xab7a('0x27')]('id')[_0xab7a('0x29')]()[_0xab7a('0x2a')]();return _0x169417;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x14fbee,_0x47f1e1,_0x26c106){try{if(_0x47f1e1['length']>0x0){_0x14fbee=_0x14fbee[_0xab7a('0xb')](function(_0x311dfa){return _0x47f1e1[_0xab7a('0x2b')](_0x311dfa['id']);});}var _0x599375=_0x14fbee['filter'](function(_0x2e0600){var _0x5b5501=_0xab7a('0x22');if(isAgentIdle(_0x2e0600)){_0x5b5501=_0xab7a('0xd');}return _0x5b5501===_0x26c106;});return _['map'](_0x599375,'id');}catch(_0x14065b){throw _0x14065b;}}exports[_0xab7a('0x2c')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x467dce,_0x6e0d82,_0x36b71e){return Promise[_0xab7a('0x2d')]()['then'](function(){if(_0x6e0d82[_0xab7a('0xc')]>0x0){_0x467dce=_0x467dce['filter'](function(_0x304af8){return _0x6e0d82[_0xab7a('0x2b')](_0x304af8['id']);});}return _0x467dce;})[_0xab7a('0x1a')](function(){return db['User'][_0xab7a('0x2e')]({'attributes':['id','name',_0xab7a('0x2f'),_0xab7a('0x30'),_0xab7a('0x5'),_0xab7a('0x6'),_0xab7a('0x7'),_0xab7a('0x8'),_0xab7a('0x13'),_0xab7a('0x9'),'pauseType'],'where':{'id':{'$in':_[_0xab7a('0x27')](_0x467dce,'id')}},'raw':!![]});})[_0xab7a('0x1a')](function(_0x2ac036){return _0x2ac036[_0xab7a('0x27')](function(_0x4ad5ff){var _0x2df446=_[_0xab7a('0x31')](_0x467dce,['id',_0x4ad5ff['id']]);var _0x2377d9=filterAgentAttributes(_0x2df446);_['merge'](_0x4ad5ff,_0x2377d9);_0x4ad5ff[_0xab7a('0x32')]=getAgentStatus(_0x4ad5ff);return _0x4ad5ff;});})[_0xab7a('0x1a')](function(_0x2243aa){var _0x1db644=sortAgentsByStatus(_0x2243aa,_0x36b71e);return _['map'](_0x1db644,'id');})[_0xab7a('0x1e')](function(_0x4d178f){throw _0x4d178f;});}exports[_0xab7a('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x4fa7c9){var _0x4bdbea={'fields':[],'order':null};var _0x8e145b=_0x4fa7c9['split'](',');_0x4bdbea[_0xab7a('0x34')]=_[_0xab7a('0xb')](_0x8e145b,function(_0x5aadb1){if(!_0x5aadb1['includes'](_0xab7a('0x32'))){return!![];}_0x4bdbea[_0xab7a('0x35')]=_[_0xab7a('0x36')](_0x5aadb1,'-')?_0xab7a('0x37'):'ASC';return![];});return _0x4bdbea;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x1dd395){if(!_0x1dd395){_0x1dd395=_0xab7a('0x38');}if(_0x1dd395[_0xab7a('0x2b')](_0xab7a('0x2f'))&&!_0x1dd395['includes'](_0xab7a('0x39'))){var _0xcac61=_0x1dd395[_0xab7a('0x3a')](0x0,_0x1dd395['indexOf'](_0xab7a('0x2f')));_0x1dd395+=','+_0xcac61+_0xab7a('0x39');}return _0x1dd395;}exports[_0xab7a('0x3b')]=validateSortParameter;function sortAgentsByStatus(_0x9cfc25,_0x4d9303){var _0x1e431d=_0x9cfc25['sort'](function(_0x6bfc12,_0x1bf286){if(_0x6bfc12[_0xab7a('0x32')]===_0x1bf286['globalStatus']){if(_0x6bfc12[_0xab7a('0x32')]===_0xab7a('0x20')){if(_0x4d9303===_0xab7a('0x37')){return(_0x6bfc12[_0xab7a('0x3c')]||'')<(_0x1bf286['pauseType']||'')||_0x6bfc12[_0xab7a('0x2f')][_0xab7a('0x3d')]()>_0x1bf286[_0xab7a('0x2f')][_0xab7a('0x3d')]()?0x1:-0x1;}else{return(_0x6bfc12['pauseType']||'')<(_0x1bf286[_0xab7a('0x3c')]||'')||_0x6bfc12['fullname'][_0xab7a('0x3d')]()>_0x1bf286['fullname'][_0xab7a('0x3d')]()?-0x1:0x1;}}else{if(_0x4d9303===_0xab7a('0x37')){return _0x6bfc12['fullname'][_0xab7a('0x3d')]()<_0x1bf286[_0xab7a('0x2f')][_0xab7a('0x3d')]()?0x1:-0x1;}else{return _0x6bfc12[_0xab7a('0x2f')][_0xab7a('0x3d')]()<_0x1bf286[_0xab7a('0x2f')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x4d9303==='DESC'){return _0x6bfc12[_0xab7a('0x32')]<_0x1bf286[_0xab7a('0x32')]?0x1:-0x1;}else{return _0x6bfc12[_0xab7a('0x32')]<_0x1bf286[_0xab7a('0x32')]?-0x1:0x1;}}});return _0x1e431d;}exports[_0xab7a('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0xbaef59){var _0x2930c5=[_0xab7a('0x3f'),_0xab7a('0x40'),_0xab7a('0x41'),_0xab7a('0x42'),_0xab7a('0x3c'),'lastPauseAt','internal',_0xab7a('0x43'),_0xab7a('0x30'),_0xab7a('0x7'),'mailPause',_0xab7a('0x8'),'whatsappPause',_0xab7a('0x5'),_0xab7a('0x13'),'chatCapacity','openchannelCapacity','mailCapacity',_0xab7a('0x44'),_0xab7a('0x45'),'faxCapacity','chatCurrentCapacity',_0xab7a('0x46'),_0xab7a('0x47'),_0xab7a('0x48'),_0xab7a('0x49'),_0xab7a('0x4a'),'chatStatus','openchannelStatus',_0xab7a('0x16'),'smsStatus',_0xab7a('0x4b'),'faxStatus',_0xab7a('0x12'),_0xab7a('0x4c'),_0xab7a('0x4d'),_0xab7a('0x4e'),_0xab7a('0x4f'),_0xab7a('0x50'),_0xab7a('0x51'),_0xab7a('0x52'),_0xab7a('0x53'),_0xab7a('0x54'),_0xab7a('0x55'),'phoneBarEnableScreenRecordingByAgent',_0xab7a('0x56')];var _0xafeb36=[_0xab7a('0x30'),_0xab7a('0x7'),'mailPause','smsPause','whatsappPause',_0xab7a('0x5'),_0xab7a('0x13'),'online'];var _0x7ccec9=_(_0xbaef59)[_0xab7a('0x57')](_0xafeb36)[_0xab7a('0x58')](_0x2930c5)[_0xab7a('0x2a')]();return _0x7ccec9;}exports[_0xab7a('0x59')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xab7a('0x5a'),_0xab7a('0x2f'),_0xab7a('0x5b'),_0xab7a('0x39'),_0xab7a('0x40'),_0xab7a('0x32'),_0xab7a('0x3f'),'lastLoginAt','pauseType',_0xab7a('0x42'),_0xab7a('0x5'),_0xab7a('0x30'),'mailPause',_0xab7a('0x7'),'smsPause',_0xab7a('0x13'),'whatsappPause',_0xab7a('0x14'),'faxStatus',_0xab7a('0x16'),_0xab7a('0x5c'),_0xab7a('0x17'),_0xab7a('0x12'),_0xab7a('0x4b'),_0xab7a('0x4c'),_0xab7a('0x51'),_0xab7a('0x4e'),_0xab7a('0x4d'),'smsStatusTime','voiceStatusTime','whatsappStatusTime',_0xab7a('0x5d'),_0xab7a('0x5e'),'mailCapacity',_0xab7a('0x5f'),_0xab7a('0x44'),_0xab7a('0x45'),_0xab7a('0x60'),_0xab7a('0x4a'),_0xab7a('0x47'),_0xab7a('0x46'),'smsCurrentCapacity','whatsappCurrentCapacity',_0xab7a('0x61'),_0xab7a('0x56'),_0xab7a('0x54'),_0xab7a('0x62'),_0xab7a('0x53'),_0xab7a('0x55')];}exports[_0xab7a('0x63')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 9ab9e27..2ea4637 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4f0=['inUse','invalid','loggedInDb','notInUse','onHold','talking','unavailable','originated','message','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','voice','request','startCase','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','get','loggedIn','available','pTalking','find','merge','pick','initializeQueues','jayson/promise','client','http','paused','waiting'];(function(_0x4c0fd7,_0x183571){var _0x46edaf=function(_0x55bf7d){while(--_0x55bf7d){_0x4c0fd7['push'](_0x4c0fd7['shift']());}};_0x46edaf(++_0x183571);}(_0xf4f0,0x121));var _0x0f4f=function(_0x23b3e0,_0x802d57){_0x23b3e0=_0x23b3e0-0x0;var _0x122558=_0xf4f0[_0x23b3e0];return _0x122558;};'use strict';var _=require('lodash');var jayson=require(_0x0f4f('0x0'));var util=require('util');var amiClient=jayson[_0x0f4f('0x1')][_0x0f4f('0x2')]({'port':0x232a});var routingClient=jayson[_0x0f4f('0x1')][_0x0f4f('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available','loggedIn',_0x0f4f('0x3'),_0x0f4f('0x4')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0x0f4f('0x5'),_0x0f4f('0x6'),_0x0f4f('0x7'),_0x0f4f('0x8'),_0x0f4f('0x9'),'ringing','ringInUse',_0x0f4f('0xa'),_0x0f4f('0xb'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x0f4f('0xc'),_0x0f4f('0xd'),'statusMessage',_0x0f4f('0xe'),'dialMethod',_0x0f4f('0xf'),_0x0f4f('0x10'),_0x0f4f('0x11'),_0x0f4f('0x12'),_0x0f4f('0x13'),_0x0f4f('0x14'),_0x0f4f('0x15'),_0x0f4f('0x16'),'dialPredictiveIntervalMaxThreshold',_0x0f4f('0x17'),_0x0f4f('0x18'),_0x0f4f('0x19'),_0x0f4f('0x1a'),_0x0f4f('0x1b'),'predictiveIntervalDroppedCallsCallersExit',_0x0f4f('0x1c'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x2ad9de,_0x1d89ef){var _0x15ffc0=_0x1d89ef===_0x0f4f('0x1d')?amiClient:routingClient;return _0x15ffc0[_0x0f4f('0x1e')](_[_0x0f4f('0x1f')](_0x1d89ef)+'Queues',_0x2ad9de)[_0x0f4f('0x20')](function(_0x4353c8){if(_0x4353c8[_0x0f4f('0x21')])throw new Error(util['format'](_0x0f4f('0x22'),_0x1d89ef));return _0x4353c8[_0x0f4f('0x23')];})[_0x0f4f('0x24')](function(_0x1d71ce){throw _0x1d71ce;});}exports[_0x0f4f('0x25')]=getRealtimeQueues;function initializeQueues(_0x5a8660,_0x54de1c,_0x101376,_0x1780cb){var _0x4438b4=DEFAULT_QUEUE_ATTRIBUTES;if(_0x101376===_0x0f4f('0x1d')){if(_0x1780cb===_0x0f4f('0x26')){_0x4438b4=_0x4438b4[_0x0f4f('0x27')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x1780cb===_0x0f4f('0x28')){_0x4438b4=_0x4438b4[_0x0f4f('0x27')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x5a8660['map'](function(_0x37f56e){var _0x3ee25d=_0x37f56e[_0x0f4f('0x29')]({'plain':!![]});_0x3ee25d[_0x0f4f('0x3')]=0x0;_0x3ee25d['loggedInDb']=0x0;_0x3ee25d[_0x0f4f('0x2a')]=0x0;_0x3ee25d[_0x0f4f('0x2b')]=0x0;_0x3ee25d[_0x0f4f('0x4')]=0x0;if(_0x101376===_0x0f4f('0x1d')){_0x3ee25d[_0x0f4f('0xa')]=0x0;_0x3ee25d['busy']=0x0;if(_0x1780cb==='outbound'){_0x3ee25d[_0x0f4f('0x2c')]=0x0;_0x3ee25d[_0x0f4f('0xc')]=0x0;}}var _0x2bc5e1=_[_0x0f4f('0x2d')](_0x54de1c,['id',_0x3ee25d['id']]);if(_0x2bc5e1){_[_0x0f4f('0x2e')](_0x3ee25d,_[_0x0f4f('0x2f')](_0x2bc5e1,_0x4438b4));}return _0x3ee25d;});}exports[_0x0f4f('0x30')]=initializeQueues; \ No newline at end of file +var _0x2917=['outbound','initializeQueues','lodash','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','talking','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','inbound','concat','map','get'];(function(_0x35b7c7,_0x382abb){var _0x2061c1=function(_0x4b0e79){while(--_0x4b0e79){_0x35b7c7['push'](_0x35b7c7['shift']());}};_0x2061c1(++_0x382abb);}(_0x2917,0x16e));var _0x7291=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x2917[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0x7291('0x0'));var jayson=require('jayson/promise');var util=require(_0x7291('0x1'));var amiClient=jayson[_0x7291('0x2')][_0x7291('0x3')]({'port':0x232a});var routingClient=jayson[_0x7291('0x2')][_0x7291('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x7291('0x4'),_0x7291('0x5'),_0x7291('0x6'),_0x7291('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x7291('0x8'),_0x7291('0x9'),_0x7291('0xa'),_0x7291('0xb'),_0x7291('0xc'),_0x7291('0xd'),_0x7291('0xe'),'ringInUse',_0x7291('0xf'),'unavailable',_0x7291('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x7291('0x11'),_0x7291('0x12'),_0x7291('0x13'),_0x7291('0x14'),_0x7291('0x15'),_0x7291('0x16'),_0x7291('0x17'),'startPredictive',_0x7291('0x18'),_0x7291('0x19'),_0x7291('0x1a'),_0x7291('0x1b'),_0x7291('0x1c'),'dialPredictiveInterval',_0x7291('0x1d'),_0x7291('0x1e'),_0x7291('0x1f'),_0x7291('0x20'),_0x7291('0x21'),_0x7291('0x22'),_0x7291('0x23'),_0x7291('0x24'),_0x7291('0x25')];function getRealtimeQueues(_0x1ed54b,_0x547569){var _0x2b5bb0=_0x547569===_0x7291('0x26')?amiClient:routingClient;return _0x2b5bb0[_0x7291('0x27')](_[_0x7291('0x28')](_0x547569)+'Queues',_0x1ed54b)[_0x7291('0x29')](function(_0x4c3b59){if(_0x4c3b59[_0x7291('0x2a')])throw new Error(util['format'](_0x7291('0x2b'),_0x547569));return _0x4c3b59[_0x7291('0x2c')];})[_0x7291('0x2d')](function(_0x2cdd10){throw _0x2cdd10;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x588e54,_0x7cf8a3,_0x4f74c4,_0x421538){var _0x4d6b26=DEFAULT_QUEUE_ATTRIBUTES;if(_0x4f74c4===_0x7291('0x26')){if(_0x421538===_0x7291('0x2e')){_0x4d6b26=_0x4d6b26[_0x7291('0x2f')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x421538==='outbound'){_0x4d6b26=_0x4d6b26[_0x7291('0x2f')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x588e54[_0x7291('0x30')](function(_0x4cbfcb){var _0x712ed0=_0x4cbfcb[_0x7291('0x31')]({'plain':!![]});_0x712ed0[_0x7291('0x6')]=0x0;_0x712ed0[_0x7291('0xb')]=0x0;_0x712ed0['loggedIn']=0x0;_0x712ed0['available']=0x0;_0x712ed0['waiting']=0x0;if(_0x4f74c4==='voice'){_0x712ed0[_0x7291('0xf')]=0x0;_0x712ed0[_0x7291('0x8')]=0x0;if(_0x421538===_0x7291('0x32')){_0x712ed0[_0x7291('0x11')]=0x0;_0x712ed0[_0x7291('0x12')]=0x0;}}var _0x39643c=_['find'](_0x7cf8a3,['id',_0x712ed0['id']]);if(_0x39643c){_['merge'](_0x712ed0,_['pick'](_0x39643c,_0x4d6b26));}return _0x712ed0;});}exports[_0x7291('0x33')]=initializeQueues; \ No newline at end of file diff --git a/server/config/environment/development.js b/server/config/environment/development.js index 9753583..e98170d 100644 --- a/server/config/environment/development.js +++ b/server/config/environment/development.js @@ -88,5 +88,6 @@ module.exports = { baseDN: process.env.AD_BASEDN || '', url: process.env.AD_URL, domain: process.env.AD_DOMAIN - } + }, + emailMaxHTMLbytesLimit: process.env.XC_EMAIL_MAX_HTML_BYTES_LIMIT || 4000000000, }; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index d403adf..da67d0b 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x4b1c73,_0x1a4207){var _0xfab919=function(_0x423a33){while(--_0x423a33){_0x4b1c73['push'](_0x4b1c73['shift']());}};_0xfab919(++_0x1a4207);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x819e48,_0x430040){var _0x522d4a=function(_0x1bb24f){while(--_0x1bb24f){_0x819e48['push'](_0x819e48['shift']());}};_0x522d4a(++_0x430040);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index c398baf..99a5f34 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 _0x12f5=['createHash','md5','update','digest','getUuid','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','substring','crypto','bimedia-machine-uuid','child_process','execSync','../environment','orderBy','keys','length','filter','family','IPv4','concat','head','address','127.0.0.1','getFirstInterface','cpus','map','join'];(function(_0x2b37b9,_0x4f7e8b){var _0x54d01c=function(_0x201d7a){while(--_0x201d7a){_0x2b37b9['push'](_0x2b37b9['shift']());}};_0x54d01c(++_0x4f7e8b);}(_0x12f5,0x12d));var _0x512f=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x12f5[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x512f('0x0'));var machine=require(_0x512f('0x1'));var exec=require(_0x512f('0x2'))[_0x512f('0x3')];var config=require(_0x512f('0x4'));function getInterfaces(){var _0x44cc53=[];var _0x1b516a=os['networkInterfaces']();var _0x48acd1=_[_0x512f('0x5')](_[_0x512f('0x6')](_0x1b516a));for(var _0x482450=0x0;_0x482450<_0x48acd1[_0x512f('0x7')];_0x482450++){var _0x33c49c=_0x1b516a[_0x48acd1[_0x482450]][_0x512f('0x8')](function(_0x5e1304){return _0x5e1304[_0x512f('0x9')]===_0x512f('0xa')&&_0x5e1304['internal']===![];});_0x44cc53=_0x44cc53[_0x512f('0xb')](_0x33c49c);}return _0x44cc53;}function getFirstInterface(){var _0xfb811=_[_0x512f('0xc')](getInterfaces());return{'macAddress':_0xfb811&&_0xfb811['mac']?_0xfb811['mac']:'00:00:00:00:00:00','ipAddress':_0xfb811&&_0xfb811[_0x512f('0xd')]?_0xfb811[_0x512f('0xd')]:_0x512f('0xe')};}exports[_0x512f('0xf')]=getFirstInterface;function getCPUhash(){var _0x172209=_[_0x512f('0x5')](os[_0x512f('0x10')]()[_0x512f('0x11')](function(_0x540e15){return _0x540e15['model'];}))[_0x512f('0x12')](':');return crypto[_0x512f('0x13')](_0x512f('0x14'))[_0x512f('0x15')](_0x172209)[_0x512f('0x16')]('hex');}exports[_0x512f('0x17')]=function(){var _0x2feb61=os['platform']();var _0x470f9e=/[0-9a-f-]{36}/;if(config[_0x512f('0x18')]&&_0x470f9e[_0x512f('0x19')](config[_0x512f('0x18')])){return config['licenseToken'];}else if(_0x2feb61==='win32'){return exec(_0x512f('0x1a'),{'encoding':_0x512f('0x1b')})['replace']('\x0d\x0a','');}else{var _0x5475ee=getFirstInterface();var _0x414049=getCPUhash();var _0x8ad220=_0x414049+'|'+os[_0x512f('0x1c')]()+'|'+_0x5475ee[_0x512f('0x1d')]+'|'+_0x5475ee[_0x512f('0x1e')];var _0x1cfec5=crypto['createHash'](_0x512f('0x14'))[_0x512f('0x15')](_0x8ad220)[_0x512f('0x16')]('hex');return _0x1cfec5['substring'](0x0,0x8)+'-'+_0x1cfec5[_0x512f('0x1f')](0x8,0xc)+'-'+_0x1cfec5[_0x512f('0x1f')](0xc,0x10)+'-'+_0x1cfec5[_0x512f('0x1f')](0x10,0x14)+'-'+_0x1cfec5[_0x512f('0x1f')](0x14);}}; \ No newline at end of file +var _0x3990=['substring','bimedia-machine-uuid','child_process','execSync','orderBy','length','filter','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','model','join','createHash','md5','update','digest','hex','platform','licenseToken','dmidecode\x20--string\x20system-uuid','utf8','macAddress'];(function(_0x54b283,_0x5eb8a6){var _0x2462b3=function(_0x13fca7){while(--_0x13fca7){_0x54b283['push'](_0x54b283['shift']());}};_0x2462b3(++_0x5eb8a6);}(_0x3990,0x145));var _0x0399=function(_0x36211c,_0x178508){_0x36211c=_0x36211c-0x0;var _0xd2487b=_0x3990[_0x36211c];return _0xd2487b;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x0399('0x0'));var exec=require(_0x0399('0x1'))[_0x0399('0x2')];var config=require('../environment');function getInterfaces(){var _0x29927a=[];var _0x3f335e=os['networkInterfaces']();var _0x5d315a=_[_0x0399('0x3')](_['keys'](_0x3f335e));for(var _0x4170dd=0x0;_0x4170dd<_0x5d315a[_0x0399('0x4')];_0x4170dd++){var _0x1435f3=_0x3f335e[_0x5d315a[_0x4170dd]][_0x0399('0x5')](function(_0x13fe37){return _0x13fe37['family']===_0x0399('0x6')&&_0x13fe37['internal']===![];});_0x29927a=_0x29927a[_0x0399('0x7')](_0x1435f3);}return _0x29927a;}function getFirstInterface(){var _0x3fe29c=_[_0x0399('0x8')](getInterfaces());return{'macAddress':_0x3fe29c&&_0x3fe29c[_0x0399('0x9')]?_0x3fe29c[_0x0399('0x9')]:_0x0399('0xa'),'ipAddress':_0x3fe29c&&_0x3fe29c['address']?_0x3fe29c[_0x0399('0xb')]:_0x0399('0xc')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x3edee5=_[_0x0399('0x3')](os[_0x0399('0xd')]()['map'](function(_0x3547c5){return _0x3547c5[_0x0399('0xe')];}))[_0x0399('0xf')](':');return crypto[_0x0399('0x10')](_0x0399('0x11'))[_0x0399('0x12')](_0x3edee5)[_0x0399('0x13')](_0x0399('0x14'));}exports['getUuid']=function(){var _0xa2d548=os[_0x0399('0x15')]();var _0x16877f=/[0-9a-f-]{36}/;if(config[_0x0399('0x16')]&&_0x16877f['test'](config[_0x0399('0x16')])){return config[_0x0399('0x16')];}else if(_0xa2d548==='win32'){return exec(_0x0399('0x17'),{'encoding':_0x0399('0x18')})['replace']('\x0d\x0a','');}else{var _0x4b6d91=getFirstInterface();var _0x1dd5d7=getCPUhash();var _0x30a0bd=_0x1dd5d7+'|'+os['hostname']()+'|'+_0x4b6d91[_0x0399('0x19')]+'|'+_0x4b6d91['ipAddress'];var _0x5e2af6=crypto[_0x0399('0x10')](_0x0399('0x11'))[_0x0399('0x12')](_0x30a0bd)['digest'](_0x0399('0x14'));return _0x5e2af6[_0x0399('0x1a')](0x0,0x8)+'-'+_0x5e2af6['substring'](0x8,0xc)+'-'+_0x5e2af6['substring'](0xc,0x10)+'-'+_0x5e2af6[_0x0399('0x1a')](0x10,0x14)+'-'+_0x5e2af6['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 7086931..b3c6c70 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 _0x9393=['data2','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','diff','decryptString','error','message','finally','getUuid','License','findOrCreate','default','util','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','catch','get','data1'];(function(_0x31b64c,_0x3b0036){var _0x2a5170=function(_0x45e9a2){while(--_0x45e9a2){_0x31b64c['push'](_0x31b64c['shift']());}};_0x2a5170(++_0x3b0036);}(_0x9393,0x88));var _0x3939=function(_0x292c74,_0x1a3382){_0x292c74=_0x292c74-0x0;var _0x442aa0=_0x9393[_0x292c74];return _0x442aa0;};'use strict';var util=require(_0x3939('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0x3939('0x1'))(module,_0x3939('0x2'));var db=require(_0x3939('0x3'))['db'];var encryptor=require(_0x3939('0x4'));var hardware=require(_0x3939('0x5'));var logger=require('../logger')(_0x3939('0x6'));var HOST=_0x3939('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x595b03){return new BPromise(function(_0x932113,_0x499269){var _0x517aee=util[_0x3939('0x8')](_0x3939('0x9'),HOST,_0x595b03,module['exports']['version']);if(oldToken){_0x517aee=util[_0x3939('0x8')](_0x3939('0xa'),HOST,_0x595b03,module[_0x3939('0xb')]['version'],oldToken);}var _0x4151b7={'uri':_0x517aee,'method':_0x3939('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x4151b7)['then'](function(_0x1afee8){_0x932113(_0x1afee8);})[_0x3939('0xd')](function(_0x5661e3){_0x499269(_0x5661e3);});});}function manageLicense(_0x11445d,_0x2c1af2){var _0x5b052a=_0x2c1af2[_0x3939('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x5b052a[_0x3939('0xf')]!==_0x11445d&&!_0x5b052a[_0x3939('0x10')]){oldToken=_0x5b052a[_0x3939('0xf')];}httpRequest(_0x11445d)[_0x3939('0x11')](function(_0x43c570){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x43c570[_0x3939('0x12')]){isOldTokenSent=![];if(!_0x5b052a['license']&&_0x5b052a['license']!=_0x43c570[_0x3939('0x6')]||_0x5b052a['license']&&_0x5b052a[_0x3939('0x10')]){logger[_0x3939('0x13')](_0x3939('0x14'));}if(_0x5b052a[_0x3939('0x6')]&&!_0x5b052a[_0x3939('0x10')]&&_0x5b052a['license']!=_0x43c570[_0x3939('0x6')]){logger[_0x3939('0x13')](_0x3939('0x15'));}if(_0x5b052a[_0x3939('0x6')]&&!_0x5b052a['data2']&&_0x5b052a[_0x3939('0x6')]==_0x43c570['license']){return _0x2c1af2;}return _0x2c1af2['update']({'data1':_0x11445d,'data2':null,'license':_0x43c570['license']});}else{if(_0x43c570['license']||_0x5b052a[_0x3939('0x6')]){if(!_0x5b052a[_0x3939('0x10')]){if(_0x5b052a[_0x3939('0xf')]==_0x11445d){GRAY_PERIOD_REASON=_0x3939('0x16');logger['info'](_0x3939('0x17'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x3939('0x13')](_0x3939('0x18'),_0x5b052a[_0x3939('0xf')],_0x11445d);}logger[_0x3939('0x13')](_0x3939('0x19'),GRAY_PERIOD_REASON[_0x3939('0x1a')](),moment()[_0x3939('0x8')](_0x3939('0x1b')));return _0x2c1af2[_0x3939('0x1c')]({'data2':encryptor['encryptString'](moment()[_0x3939('0x8')](_0x3939('0x1b')))});}else{if(moment()[_0x3939('0x1d')](encryptor[_0x3939('0x1e')](_0x5b052a[_0x3939('0x10')]),'days')>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0x3939('0x8')](_0x3939('0x1b')));isOldTokenSent=![];return _0x2c1af2[_0x3939('0x1c')]({'data1':_0x11445d,'data2':null,'license':null});}}}else{if(_0x5b052a[_0x3939('0xf')]!=_0x11445d){logger[_0x3939('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5b052a[_0x3939('0xf')],_0x11445d);return _0x2c1af2['update']({'data1':_0x11445d,'data2':null,'license':null});}}}return _0x2c1af2;})[_0x3939('0x11')](function(_0x5086d3){_0x2c1af2=_0x5086d3;})['catch'](function(_0x16b749){logger[_0x3939('0x1f')](_0x16b749[_0x3939('0x20')]);})[_0x3939('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x3939('0x22')](),_0x2c1af2);},TIME);});}function defaultLicense(){var _0x466ddd=hardware[_0x3939('0x22')]();if(_0x466ddd){return db[_0x3939('0x23')][_0x3939('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x466ddd}})['spread'](function(_0x9ab732,_0x33d87a){logger[_0x3939('0x13')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x466ddd);manageLicense(_0x466ddd,_0x9ab732);})[_0x3939('0xd')](function(_0x516d4f){logger['error'](_0x516d4f[_0x3939('0x20')]);});}}exports[_0x3939('0x25')]=defaultLicense; \ No newline at end of file +var _0x007b=['decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','../../mysqldb','../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','version','format','catch','get','data1','data2','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff'];(function(_0x28eec9,_0x34eece){var _0xb99c09=function(_0x386a11){while(--_0x386a11){_0x28eec9['push'](_0x28eec9['shift']());}};_0xb99c09(++_0x34eece);}(_0x007b,0xd2));var _0xb007=function(_0x192f9a,_0x12fee2){_0x192f9a=_0x192f9a-0x0;var _0x99d99=_0x007b[_0x192f9a];return _0x99d99;};'use strict';var util=require(_0xb007('0x0'));var moment=require(_0xb007('0x1'));var rp=require(_0xb007('0x2'));var BPromise=require(_0xb007('0x3'));var pkginfo=require(_0xb007('0x4'))(module,'version');var db=require(_0xb007('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0xb007('0x6'))(_0xb007('0x7'));var HOST=_0xb007('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x46873){return new BPromise(function(_0x495622,_0xdfa657){var _0x2af13d=util['format'](_0xb007('0x9'),HOST,_0x46873,module[_0xb007('0xa')][_0xb007('0xb')]);if(oldToken){_0x2af13d=util[_0xb007('0xc')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x46873,module[_0xb007('0xa')]['version'],oldToken);}var _0xd5333c={'uri':_0x2af13d,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0xd5333c)['then'](function(_0x198da3){_0x495622(_0x198da3);})[_0xb007('0xd')](function(_0x4561d9){_0xdfa657(_0x4561d9);});});}function manageLicense(_0x7f6659,_0x3af160){var _0x4deb6b=_0x3af160[_0xb007('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x4deb6b[_0xb007('0xf')]!==_0x7f6659&&!_0x4deb6b[_0xb007('0x10')]){oldToken=_0x4deb6b[_0xb007('0xf')];}httpRequest(_0x7f6659)[_0xb007('0x11')](function(_0x7439a5){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x7439a5[_0xb007('0x12')]){isOldTokenSent=![];if(!_0x4deb6b[_0xb007('0x7')]&&_0x4deb6b['license']!=_0x7439a5[_0xb007('0x7')]||_0x4deb6b['license']&&_0x4deb6b[_0xb007('0x10')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x4deb6b[_0xb007('0x7')]&&!_0x4deb6b['data2']&&_0x4deb6b[_0xb007('0x7')]!=_0x7439a5[_0xb007('0x7')]){logger[_0xb007('0x13')](_0xb007('0x14'));}if(_0x4deb6b['license']&&!_0x4deb6b['data2']&&_0x4deb6b[_0xb007('0x7')]==_0x7439a5[_0xb007('0x7')]){return _0x3af160;}return _0x3af160[_0xb007('0x15')]({'data1':_0x7f6659,'data2':null,'license':_0x7439a5[_0xb007('0x7')]});}else{if(_0x7439a5[_0xb007('0x7')]||_0x4deb6b[_0xb007('0x7')]){if(!_0x4deb6b[_0xb007('0x10')]){if(_0x4deb6b[_0xb007('0xf')]==_0x7f6659){GRAY_PERIOD_REASON=_0xb007('0x16');logger[_0xb007('0x13')](_0xb007('0x17'));}else{GRAY_PERIOD_REASON=_0xb007('0x18');logger[_0xb007('0x13')](_0xb007('0x19'),_0x4deb6b[_0xb007('0xf')],_0x7f6659);}logger[_0xb007('0x13')](_0xb007('0x1a'),GRAY_PERIOD_REASON[_0xb007('0x1b')](),moment()[_0xb007('0xc')](_0xb007('0x1c')));return _0x3af160[_0xb007('0x15')]({'data2':encryptor['encryptString'](moment()[_0xb007('0xc')](_0xb007('0x1c')))});}else{if(moment()[_0xb007('0x1d')](encryptor[_0xb007('0x1e')](_0x4deb6b['data2']),_0xb007('0x1f'))>DAYS){logger['info'](_0xb007('0x20'),moment()[_0xb007('0xc')](_0xb007('0x1c')));isOldTokenSent=![];return _0x3af160[_0xb007('0x15')]({'data1':_0x7f6659,'data2':null,'license':null});}}}else{if(_0x4deb6b[_0xb007('0xf')]!=_0x7f6659){logger[_0xb007('0x13')](_0xb007('0x19'),_0x4deb6b[_0xb007('0xf')],_0x7f6659);return _0x3af160['update']({'data1':_0x7f6659,'data2':null,'license':null});}}}return _0x3af160;})['then'](function(_0x3d1871){_0x3af160=_0x3d1871;})[_0xb007('0xd')](function(_0x2d58a8){logger[_0xb007('0x21')](_0x2d58a8[_0xb007('0x22')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xb007('0x23')](),_0x3af160);},TIME);});}function defaultLicense(){var _0x377b56=hardware['getUuid']();if(_0x377b56){return db[_0xb007('0x24')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x377b56}})[_0xb007('0x25')](function(_0x5c9a55,_0x4538aa){logger[_0xb007('0x13')](_0xb007('0x26'),_0x377b56);manageLicense(_0x377b56,_0x5c9a55);})['catch'](function(_0x2eb52f){logger[_0xb007('0x21')](_0x2eb52f['message']);});}}exports[_0xb007('0x27')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index e312e3f..e61c793 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 _0xc7e6=['license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','uuid','machineUuid','gray','deadline','add','days','grayReason','changed','disabled','message','findAll','sequelize','COUNT','col','role','count','admin','user','telephone','users','telephones','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','util','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','data1'];(function(_0x3eac22,_0x4f77cf){var _0x1dcda0=function(_0x300cfb){while(--_0x300cfb){_0x3eac22['push'](_0x3eac22['shift']());}};_0x1dcda0(++_0x4f77cf);}(_0xc7e6,0x87));var _0x6c7e=function(_0x4a57b0,_0x3ee928){_0x4a57b0=_0x4a57b0-0x0;var _0x5e82c8=_0xc7e6[_0x4a57b0];return _0x5e82c8;};'use strict';var util=require(_0x6c7e('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0x6c7e('0x1'));var hardware=require(_0x6c7e('0x2'));var encryptor=require(_0x6c7e('0x3'));var db=require(_0x6c7e('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6c7e('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6c7e('0x6'),'machineUuid':hardware[_0x6c7e('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6c7e('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6c7e('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x56fdbb){return new BPromise(function(_0x488614,_0x399a5f){return db[_0x6c7e('0x9')][_0x6c7e('0xa')](_[_0x6c7e('0xb')](_0x56fdbb,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x4416f4){return checkLicense(_0x4416f4,null);})[_0x6c7e('0xc')](function(_0x4492f1){_0x488614(_0x4492f1);return;})[_0x6c7e('0xd')](function(_0x3be2da){_0x399a5f(_0x3be2da);});});}function checkLicense(_0x1d8f39,_0x324d20){if(!_0x1d8f39){demoLicense['uuid']=_0x1d8f39[_0x6c7e('0xe')];return demoLicense;}try{var _0x58be06=_0x324d20||_0x1d8f39[_0x6c7e('0xf')];if(_[_0x6c7e('0x10')](_0x58be06)){throw new Error(_0x6c7e('0x11'));}var _0x4a6fde=_0x1d8f39[_0x6c7e('0xe')];var _0x4c577b=_0x1d8f39[_0x6c7e('0x12')];var _0x1682e4=_0x4a6fde[_0x6c7e('0x13')]('-')[0x4];var _0x6024a1=_0x4a6fde[_0x6c7e('0x13')]('-')[0x0];var _0x195a07=encryptor[_0x6c7e('0x14')](_0x58be06,util[_0x6c7e('0x15')](_0x6c7e('0x16'),_0x1682e4,_0x4a6fde,_0x6024a1));var _0x96bbda=JSON[_0x6c7e('0x17')](_0x195a07);_0x96bbda[_0x6c7e('0x18')]=![];_0x96bbda[_0x6c7e('0x19')]=_0x4a6fde;_0x96bbda[_0x6c7e('0x1a')]=hardware[_0x6c7e('0x7')]();if(_0x4c577b){var _0x58d6a1=encryptor[_0x6c7e('0x14')](_0x4c577b);_0x96bbda[_0x6c7e('0x1b')]=_0x58d6a1;_0x96bbda[_0x6c7e('0x1c')]=moment(_0x58d6a1)[_0x6c7e('0x1d')](0x7,_0x6c7e('0x1e'))[_0x6c7e('0x15')]();_0x96bbda[_0x6c7e('0x1f')]=_0x96bbda[_0x6c7e('0x19')]!=_0x96bbda[_0x6c7e('0x1a')]?_0x6c7e('0x20'):_0x6c7e('0x21');}return _0x96bbda;}catch(_0xce2385){breakingLicense[_0x6c7e('0x19')]=_0x1d8f39[_0x6c7e('0xe')];breakingLicense['message']=_0xce2385[_0x6c7e('0x22')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5a8017,_0x1af930){getLicense()[_0x6c7e('0xc')](function(_0x55e2f3){return db['User'][_0x6c7e('0x23')]({'attributes':['role',[db[_0x6c7e('0x24')]['fn'](_0x6c7e('0x25'),db[_0x6c7e('0x24')][_0x6c7e('0x26')](_0x6c7e('0x27'))),_0x6c7e('0x28')]],'group':'role','where':{'role':{'$or':[_0x6c7e('0x29'),_0x6c7e('0x2a'),_0x6c7e('0x2b')]}},'raw':!![]})['then'](function(_0x4de67d){var _0x1a8baa={'user':_0x55e2f3[_0x6c7e('0x2c')]||0x0,'telephone':_0x55e2f3[_0x6c7e('0x2d')]||0x0};_0x4de67d['forEach'](function(_0x2dc3a6){var _0x46a6d2=_0x2dc3a6[_0x6c7e('0x27')]===_0x6c7e('0x29')?_0x6c7e('0x2a'):_0x2dc3a6[_0x6c7e('0x27')];_0x1a8baa[_0x46a6d2]-=_0x2dc3a6[_0x6c7e('0x28')];if(_0x1a8baa[_0x46a6d2]<0x0)_0x1a8baa[_0x46a6d2]=0x0;});_0x5a8017(_0x1a8baa);return;});})[_0x6c7e('0xd')](function(_0x2506a6){_0x1af930(_0x2506a6);});});}function checkUserLimits(_0x22c3fe){return new BPromise(function(_0x7b6030,_0x139861){getLimits()[_0x6c7e('0xc')](function(_0x6cd75b){var _0x3a42d1=_[_0x6c7e('0x2e')](_[_0x6c7e('0x2f')](_0x22c3fe,_0x6c7e('0x27')),['admin',_0x6c7e('0x2a'),_0x6c7e('0x2b')]);var _0xc52d4=(_0x3a42d1['admin']||0x0)+(_0x3a42d1[_0x6c7e('0x2a')]||0x0);var _0x11f2bc=_0x3a42d1[_0x6c7e('0x2b')]||0x0;if(_0xc52d4>_0x6cd75b[_0x6c7e('0x2a')])return _0x139861('License\x20limit\x20reached\x20for\x20users');if(_0x11f2bc>_0x6cd75b[_0x6c7e('0x2b')])return _0x139861(_0x6c7e('0x30'));return _0x7b6030();})['catch'](function(_0x2528cf){_0x139861(_0x2528cf);});});}module[_0x6c7e('0x31')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xd7a1=['users','telephones','forEach','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','defaults','then','uuid','data1','isEmpty','data2','split','decryptString','%s:%s:%s','demo','machineUuid','gray','deadline','add','days','format','grayReason','changed','message','User','role','sequelize','COUNT','col','count','admin','user','telephone'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xd7a1,0x180));var _0x1d7a=function(_0x41fcb8,_0x12c1e9){_0x41fcb8=_0x41fcb8-0x0;var _0x3c7d62=_0xd7a1[_0x41fcb8];return _0x3c7d62;};'use strict';var util=require(_0x1d7a('0x0'));var _=require(_0x1d7a('0x1'));var moment=require(_0x1d7a('0x2'));var BPromise=require(_0x1d7a('0x3'));var hardware=require(_0x1d7a('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0x1d7a('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1d7a('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x1d7a('0x7'),'machineUuid':hardware[_0x1d7a('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1d7a('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x1d7a('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x21ba7d){return new BPromise(function(_0x40c85f,_0xae8f91){return db[_0x1d7a('0x9')][_0x1d7a('0xa')](_[_0x1d7a('0xb')](_0x21ba7d,{'raw':!![],'where':{'id':0x1}}))[_0x1d7a('0xc')](function(_0x5dc3f8){return checkLicense(_0x5dc3f8,null);})['then'](function(_0x17dceb){_0x40c85f(_0x17dceb);return;})['catch'](function(_0x16c117){_0xae8f91(_0x16c117);});});}function checkLicense(_0x32ae35,_0x2b30a8){if(!_0x32ae35){demoLicense[_0x1d7a('0xd')]=_0x32ae35[_0x1d7a('0xe')];return demoLicense;}try{var _0x596f28=_0x2b30a8||_0x32ae35['license'];if(_[_0x1d7a('0xf')](_0x596f28)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x537328=_0x32ae35[_0x1d7a('0xe')];var _0x395395=_0x32ae35[_0x1d7a('0x10')];var _0x1b726c=_0x537328[_0x1d7a('0x11')]('-')[0x4];var _0x1a0be5=_0x537328[_0x1d7a('0x11')]('-')[0x0];var _0x306be9=encryptor[_0x1d7a('0x12')](_0x596f28,util['format'](_0x1d7a('0x13'),_0x1b726c,_0x537328,_0x1a0be5));var _0x3c99b8=JSON['parse'](_0x306be9);_0x3c99b8[_0x1d7a('0x14')]=![];_0x3c99b8[_0x1d7a('0xd')]=_0x537328;_0x3c99b8[_0x1d7a('0x15')]=hardware[_0x1d7a('0x8')]();if(_0x395395){var _0x3391ab=encryptor['decryptString'](_0x395395);_0x3c99b8[_0x1d7a('0x16')]=_0x3391ab;_0x3c99b8[_0x1d7a('0x17')]=moment(_0x3391ab)[_0x1d7a('0x18')](0x7,_0x1d7a('0x19'))[_0x1d7a('0x1a')]();_0x3c99b8[_0x1d7a('0x1b')]=_0x3c99b8[_0x1d7a('0xd')]!=_0x3c99b8[_0x1d7a('0x15')]?_0x1d7a('0x1c'):'disabled';}return _0x3c99b8;}catch(_0x325ca2){breakingLicense[_0x1d7a('0xd')]=_0x32ae35[_0x1d7a('0xe')];breakingLicense[_0x1d7a('0x1d')]=_0x325ca2['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x35a185,_0x33f0a1){getLicense()[_0x1d7a('0xc')](function(_0x4bad0d){return db[_0x1d7a('0x1e')]['findAll']({'attributes':[_0x1d7a('0x1f'),[db[_0x1d7a('0x20')]['fn'](_0x1d7a('0x21'),db[_0x1d7a('0x20')][_0x1d7a('0x22')](_0x1d7a('0x1f'))),_0x1d7a('0x23')]],'group':'role','where':{'role':{'$or':[_0x1d7a('0x24'),_0x1d7a('0x25'),_0x1d7a('0x26')]}},'raw':!![]})['then'](function(_0x3d6184){var _0x3830e7={'user':_0x4bad0d[_0x1d7a('0x27')]||0x0,'telephone':_0x4bad0d[_0x1d7a('0x28')]||0x0};_0x3d6184[_0x1d7a('0x29')](function(_0x3a2cf9){var _0x3dd40d=_0x3a2cf9[_0x1d7a('0x1f')]==='admin'?_0x1d7a('0x25'):_0x3a2cf9[_0x1d7a('0x1f')];_0x3830e7[_0x3dd40d]-=_0x3a2cf9[_0x1d7a('0x23')];if(_0x3830e7[_0x3dd40d]<0x0)_0x3830e7[_0x3dd40d]=0x0;});_0x35a185(_0x3830e7);return;});})[_0x1d7a('0x2a')](function(_0x30b65a){_0x33f0a1(_0x30b65a);});});}function checkUserLimits(_0x1d4e6b){return new BPromise(function(_0x27264f,_0x31674d){getLimits()[_0x1d7a('0xc')](function(_0x2165fa){var _0x33718a=_[_0x1d7a('0x2b')](_[_0x1d7a('0x2c')](_0x1d4e6b,_0x1d7a('0x1f')),[_0x1d7a('0x24'),_0x1d7a('0x25'),_0x1d7a('0x26')]);var _0x5f84a5=(_0x33718a[_0x1d7a('0x24')]||0x0)+(_0x33718a['user']||0x0);var _0x575d90=_0x33718a[_0x1d7a('0x26')]||0x0;if(_0x5f84a5>_0x2165fa[_0x1d7a('0x25')])return _0x31674d(_0x1d7a('0x2d'));if(_0x575d90>_0x2165fa[_0x1d7a('0x26')])return _0x31674d('License\x20limit\x20reached\x20for\x20telephones');return _0x27264f();})[_0x1d7a('0x2a')](function(_0x4bf07b){_0x31674d(_0x4bf07b);});});}module[_0x1d7a('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 3885a4a..60cdd03 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 _0x9f0e=['myappanuglar-secret','app-id','secret','exports','http://localhost:9000'];(function(_0x5eb0ae,_0x384dfb){var _0x274060=function(_0x53f964){while(--_0x53f964){_0x5eb0ae['push'](_0x5eb0ae['shift']());}};_0x274060(++_0x384dfb);}(_0x9f0e,0x116));var _0xe9f0=function(_0x3ece10,_0x46c5fa){_0x3ece10=_0x3ece10-0x0;var _0x3c74b2=_0x9f0e[_0x3ece10];return _0x3c74b2;};'use strict';module[_0xe9f0('0x0')]={'DOMAIN':_0xe9f0('0x1'),'SESSION_SECRET':_0xe9f0('0x2'),'GOOGLE_ID':_0xe9f0('0x3'),'GOOGLE_SECRET':_0xe9f0('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x9f0e=['myappanuglar-secret','app-id','secret','exports','http://localhost:9000'];(function(_0x4adbfe,_0x44732a){var _0x2170ad=function(_0x249e43){while(--_0x249e43){_0x4adbfe['push'](_0x4adbfe['shift']());}};_0x2170ad(++_0x44732a);}(_0x9f0e,0x116));var _0xe9f0=function(_0x2972fa,_0x3ced9a){_0x2972fa=_0x2972fa-0x0;var _0x5942d9=_0x9f0e[_0x2972fa];return _0x5942d9;};'use strict';module[_0xe9f0('0x0')]={'DOMAIN':_0xe9f0('0x1'),'SESSION_SECRET':_0xe9f0('0x2'),'GOOGLE_ID':_0xe9f0('0x3'),'GOOGLE_SECRET':_0xe9f0('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index f890f4d..0bbf7e5 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x04d3=['../utils/loggers','fileLogger','exports'];(function(_0x22df32,_0x317190){var _0x17a3a5=function(_0x2778b0){while(--_0x2778b0){_0x22df32['push'](_0x22df32['shift']());}};_0x17a3a5(++_0x317190);}(_0x04d3,0x19e));var _0x304d=function(_0x19bdf6,_0x2a5c3b){_0x19bdf6=_0x19bdf6-0x0;var _0xf54cc=_0x04d3[_0x19bdf6];return _0xf54cc;};'use strict';var fileLogger=require(_0x304d('0x0'))[_0x304d('0x1')];module[_0x304d('0x2')]=fileLogger; \ No newline at end of file +var _0xcdaa=['fileLogger','exports','../utils/loggers'];(function(_0x462b3a,_0x52fa71){var _0xbc5daa=function(_0x10dc88){while(--_0x10dc88){_0x462b3a['push'](_0x462b3a['shift']());}};_0xbc5daa(++_0x52fa71);}(_0xcdaa,0xb6));var _0xacda=function(_0x52e367,_0xdb16be){_0x52e367=_0x52e367-0x0;var _0x53d936=_0xcdaa[_0x52e367];return _0x53d936;};'use strict';var fileLogger=require(_0xacda('0x0'))[_0xacda('0x1')];module[_0xacda('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 3f64a34..5a06917 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 _0x7216=['root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','routing','../../services/xdr/index.js','exports','path','../../config/environment','resolve','join'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x7216,0x7c));var _0x6721=function(_0x23f786,_0x8d8935){_0x23f786=_0x23f786-0x0;var _0xbebeb3=_0x7216[_0x23f786];return _0xbebeb3;};'use strict';var path=require(_0x6721('0x0'));var cfg=require(_0x6721('0x1'));var env={'NODE_PATH':path[_0x6721('0x2')](path[_0x6721('0x3')](cfg[_0x6721('0x4')],_0x6721('0x5')))};var pm2config={'apps':[{'name':_0x6721('0x6'),'script':path[_0x6721('0x3')](__dirname,_0x6721('0x7')),'env':env},{'name':_0x6721('0x8'),'script':path['join'](__dirname,_0x6721('0x9')),'env':env},{'name':_0x6721('0xa'),'script':path['join'](__dirname,_0x6721('0xb')),'env':env},{'name':'email','script':path[_0x6721('0x3')](__dirname,_0x6721('0xc')),'env':env},{'name':_0x6721('0xd'),'script':path[_0x6721('0x3')](__dirname,'../../services/routing/index.js'),'env':env},{'name':'xdr','script':path[_0x6721('0x3')](__dirname,_0x6721('0xe')),'env':env}]};module[_0x6721('0xf')]=pm2config; \ No newline at end of file +var _0xc482=['routing','xdr','../../services/xdr/index.js','exports','path','../../config/environment','resolve','legacy-libs','join','../../services/express/index.js','email','../../services/email/index.js'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xc482,0x70));var _0x2c48=function(_0x2c84c7,_0x553577){_0x2c84c7=_0x2c84c7-0x0;var _0x3dc9c3=_0xc482[_0x2c84c7];return _0x3dc9c3;};'use strict';var path=require(_0x2c48('0x0'));var cfg=require(_0x2c48('0x1'));var env={'NODE_PATH':path[_0x2c48('0x2')](path['join'](cfg['root'],_0x2c48('0x3')))};var pm2config={'apps':[{'name':'express','script':path[_0x2c48('0x4')](__dirname,_0x2c48('0x5')),'env':env},{'name':'ami','script':path[_0x2c48('0x4')](__dirname,'../../services/ami/index.js'),'env':env},{'name':'agi','script':path[_0x2c48('0x4')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x2c48('0x6'),'script':path[_0x2c48('0x4')](__dirname,_0x2c48('0x7')),'env':env},{'name':_0x2c48('0x8'),'script':path[_0x2c48('0x4')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x2c48('0x9'),'script':path['join'](__dirname,_0x2c48('0xa')),'env':env}]};module[_0x2c48('0xb')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index fc8aba4..7f4be3a 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 _0x0032=['dump','pm2','start','then','stop','restart','disconnect','list','describe','delete'];(function(_0x3512b2,_0x2cb54a){var _0x16c6e8=function(_0x1698d4){while(--_0x1698d4){_0x3512b2['push'](_0x3512b2['shift']());}};_0x16c6e8(++_0x2cb54a);}(_0x0032,0x12d));var _0x2003=function(_0x149d10,_0x1c66c9){_0x149d10=_0x149d10-0x0;var _0x505f92=_0x0032[_0x149d10];return _0x505f92;};'use strict';var pm2=require(_0x2003('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0xdcbd58,_0x12476f){return pm2['connect'](function(_0x119fe4){if(_0x119fe4){return _0x12476f(_0x119fe4);}return _0xdcbd58('connected');});});};exports[_0x2003('0x1')]=function(_0x42300b){return connect()[_0x2003('0x2')](function(){return new BPromise(function(_0x7bc0e2,_0x130306){return pm2[_0x2003('0x1')](_0x42300b,function(_0x339fef,_0x268436){if(_0x339fef){return _0x130306(_0x339fef);}pm2['disconnect']();return _0x7bc0e2(_0x268436);});});});};exports[_0x2003('0x3')]=function(_0x592281){return connect()[_0x2003('0x2')](function(){return new BPromise(function(_0x49d1d7,_0x4c9661){return pm2[_0x2003('0x3')](_0x592281,function(_0x5eec73,_0x178ef6){if(_0x5eec73){return _0x4c9661(_0x5eec73);}pm2['disconnect']();return _0x49d1d7(_0x178ef6);});});});};exports[_0x2003('0x4')]=function(_0x41e1a8){return connect()[_0x2003('0x2')](function(){return new BPromise(function(_0x181de3,_0xcf9f72){return pm2['restart'](_0x41e1a8,function(_0x695cdf,_0x43d9e7){if(_0x695cdf){return _0xcf9f72(_0x695cdf);}pm2[_0x2003('0x5')]();return _0x181de3(_0x43d9e7);});});});};exports[_0x2003('0x6')]=function(){return connect()[_0x2003('0x2')](function(){return new BPromise(function(_0x463642,_0x5c5ea8){return pm2[_0x2003('0x6')](function(_0x1da16d,_0x2bdf8e){if(_0x1da16d){return _0x5c5ea8(_0x1da16d);}pm2['disconnect']();return _0x463642(_0x2bdf8e);});});});};exports[_0x2003('0x7')]=function(_0x5596b6){return connect()['then'](function(){return new BPromise(function(_0x1645b4,_0xf4415a){return pm2[_0x2003('0x7')](_0x5596b6,function(_0x513ae5,_0x1a4090){if(_0x513ae5){return _0xf4415a(_0x513ae5);}pm2[_0x2003('0x5')]();return _0x1645b4(_0x1a4090);});});});};exports['delete']=function(_0x1476c7){return connect()[_0x2003('0x2')](function(){return new BPromise(function(_0xc80a0c,_0x5446f4){return pm2[_0x2003('0x8')](_0x1476c7,function(_0x29319e,_0x1f7397){if(_0x29319e){return _0x5446f4(_0x29319e);}pm2['disconnect']();return _0xc80a0c(_0x1f7397);});});});};exports[_0x2003('0x9')]=function(){return connect()[_0x2003('0x2')](function(){return new BPromise(function(_0x42cbeb,_0x391f8a){return pm2[_0x2003('0x9')](function(_0x312cd1){if(_0x312cd1){return _0x391f8a(_0x312cd1);}return _0x42cbeb('saved');});});});}; \ No newline at end of file +var _0x8eeb=['list','describe','delete','dump','saved','pm2','bluebird','./config','connect','connected','start','then','stop','disconnect'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x8eeb,0x171));var _0xb8ee=function(_0x6e1fd4,_0x5352bc){_0x6e1fd4=_0x6e1fd4-0x0;var _0x3fbf5b=_0x8eeb[_0x6e1fd4];return _0x3fbf5b;};'use strict';var pm2=require(_0xb8ee('0x0'));var BPromise=require(_0xb8ee('0x1'));var config=require(_0xb8ee('0x2'));function connect(){return new BPromise(function(_0x1fc9f4,_0x5440fa){return pm2[_0xb8ee('0x3')](function(_0x22ee6a){if(_0x22ee6a){return _0x5440fa(_0x22ee6a);}return _0x1fc9f4(_0xb8ee('0x4'));});});};exports[_0xb8ee('0x5')]=function(_0x3152be){return connect()[_0xb8ee('0x6')](function(){return new BPromise(function(_0xcb30fd,_0x593a5f){return pm2[_0xb8ee('0x5')](_0x3152be,function(_0x13e473,_0x444546){if(_0x13e473){return _0x593a5f(_0x13e473);}pm2['disconnect']();return _0xcb30fd(_0x444546);});});});};exports['stop']=function(_0x2abd03){return connect()[_0xb8ee('0x6')](function(){return new BPromise(function(_0x4c1782,_0x5c8b20){return pm2[_0xb8ee('0x7')](_0x2abd03,function(_0x3b8367,_0x38c81c){if(_0x3b8367){return _0x5c8b20(_0x3b8367);}pm2[_0xb8ee('0x8')]();return _0x4c1782(_0x38c81c);});});});};exports['restart']=function(_0x3365ad){return connect()['then'](function(){return new BPromise(function(_0x2f31eb,_0x1bcee5){return pm2['restart'](_0x3365ad,function(_0x3c1994,_0x441c67){if(_0x3c1994){return _0x1bcee5(_0x3c1994);}pm2[_0xb8ee('0x8')]();return _0x2f31eb(_0x441c67);});});});};exports[_0xb8ee('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x420fd8,_0x10931c){return pm2[_0xb8ee('0x9')](function(_0x4ed5c5,_0x28fe4d){if(_0x4ed5c5){return _0x10931c(_0x4ed5c5);}pm2[_0xb8ee('0x8')]();return _0x420fd8(_0x28fe4d);});});});};exports[_0xb8ee('0xa')]=function(_0x4c03fa){return connect()[_0xb8ee('0x6')](function(){return new BPromise(function(_0x522fb3,_0x4ec87c){return pm2[_0xb8ee('0xa')](_0x4c03fa,function(_0x5990e1,_0x332219){if(_0x5990e1){return _0x4ec87c(_0x5990e1);}pm2[_0xb8ee('0x8')]();return _0x522fb3(_0x332219);});});});};exports[_0xb8ee('0xb')]=function(_0x248726){return connect()[_0xb8ee('0x6')](function(){return new BPromise(function(_0x2b4721,_0x539170){return pm2[_0xb8ee('0xb')](_0x248726,function(_0x515141,_0x27ef6d){if(_0x515141){return _0x539170(_0x515141);}pm2[_0xb8ee('0x8')]();return _0x2b4721(_0x27ef6d);});});});};exports[_0xb8ee('0xc')]=function(){return connect()[_0xb8ee('0x6')](function(){return new BPromise(function(_0x27d544,_0xc1f5f1){return pm2[_0xb8ee('0xc')](function(_0xd5075b){if(_0xd5075b){return _0xc1f5f1(_0xd5075b);}return _0x27d544(_0xb8ee('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 7ad4598..86b9858 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 _0x9de4=['[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','then','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','util','../../config/environment','../logger','schedule','defaults','redis','localhost','socket.io-emitter','Setting','find','findAll','lastMsgAt','subtract','chatTimeout','minutes','length','map','info'];(function(_0x4f6ffd,_0x316dd8){var _0x34a32e=function(_0x386980){while(--_0x386980){_0x4f6ffd['push'](_0x4f6ffd['shift']());}};_0x34a32e(++_0x316dd8);}(_0x9de4,0x130));var _0x49de=function(_0x206821,_0x4f2ac8){_0x206821=_0x206821-0x0;var _0x3eb788=_0x9de4[_0x206821];return _0x3eb788;};'use strict';var _=require(_0x49de('0x0'));var moment=require(_0x49de('0x1'));var Redis=require('ioredis');var util=require(_0x49de('0x2'));var config=require(_0x49de('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x49de('0x4'))(_0x49de('0x5'));config['redis']=_[_0x49de('0x6')](config[_0x49de('0x7')],{'host':_0x49de('0x8'),'port':0x18eb});var io=require(_0x49de('0x9'))(new Redis(config[_0x49de('0x7')]));function closeInteractions(){var _0x64c2e3=0x0;var _0x47136c=[];return db[_0x49de('0xa')][_0x49de('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x2dc1c3){_0x64c2e3=_0x2dc1c3['chatTimeout'];if(_0x64c2e3){return db['ChatInteraction'][_0x49de('0xc')]({'raw':!![],'attributes':['id',_0x49de('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x49de('0xe')](_0x2dc1c3[_0x49de('0xf')],_0x49de('0x10'))}}});}else{return[];}})['then'](function(_0x4ddced){if(_0x4ddced&&_0x4ddced[_0x49de('0x11')]){_0x47136c=_[_0x49de('0x12')](_0x4ddced||[],'id');logger[_0x49de('0x13')](_0x49de('0x14'),_0x47136c[_0x49de('0x15')]());return db[_0x49de('0x16')][_0x49de('0x17')]({'closeReason':_0x49de('0x18'),'disposition':_0x49de('0x19'),'closed':!![],'closedAt':moment()['format'](_0x49de('0x1a'))},{'where':{'id':_0x47136c}});}})[_0x49de('0x1b')](function(){if(_0x47136c&&_0x47136c['length']){logger[_0x49de('0x13')](_0x49de('0x1c'),_0x47136c[_0x49de('0x15')]());for(var _0x53aa12=0x0;_0x53aa12<_0x47136c[_0x49de('0x11')];_0x53aa12++){io[_0x49de('0x1d')](_0x49de('0x1e'),{'id':_0x47136c[_0x53aa12],'closed':!![]});}}})[_0x49de('0x1f')](function(_0x102b09){logger[_0x49de('0x20')](_0x49de('0x21'),_0x102b09?util[_0x49de('0x22')](_0x102b09,{'showHidden':![],'depth':null}):'');});}exports[_0x49de('0x23')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xc2f1=['system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','lodash','moment','util','../../config/environment','../logger','schedule','defaults','redis','localhost','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','length','info','[CHAT]\x20Interactions\x20to\x20close:'];(function(_0x33c090,_0x184b69){var _0x4081df=function(_0x109a20){while(--_0x109a20){_0x33c090['push'](_0x33c090['shift']());}};_0x4081df(++_0x184b69);}(_0xc2f1,0x68));var _0x1c2f=function(_0x1ff0f0,_0x4a62d4){_0x1ff0f0=_0x1ff0f0-0x0;var _0x46932a=_0xc2f1[_0x1ff0f0];return _0x46932a;};'use strict';var _=require(_0x1c2f('0x0'));var moment=require(_0x1c2f('0x1'));var Redis=require('ioredis');var util=require(_0x1c2f('0x2'));var config=require(_0x1c2f('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x1c2f('0x4'))(_0x1c2f('0x5'));config['redis']=_[_0x1c2f('0x6')](config[_0x1c2f('0x7')],{'host':_0x1c2f('0x8'),'port':0x18eb});var io=require(_0x1c2f('0x9'))(new Redis(config[_0x1c2f('0x7')]));function closeInteractions(){var _0x34d76c=0x0;var _0x2986b4=[];return db[_0x1c2f('0xa')][_0x1c2f('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x1c2f('0xc')](function(_0x33071d){_0x34d76c=_0x33071d[_0x1c2f('0xd')];if(_0x34d76c){return db[_0x1c2f('0xe')][_0x1c2f('0xf')]({'raw':!![],'attributes':['id',_0x1c2f('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x33071d[_0x1c2f('0xd')],'minutes')}}});}else{return[];}})[_0x1c2f('0xc')](function(_0x370038){if(_0x370038&&_0x370038[_0x1c2f('0x11')]){_0x2986b4=_['map'](_0x370038||[],'id');logger[_0x1c2f('0x12')](_0x1c2f('0x13'),_0x2986b4['join']());return db[_0x1c2f('0xe')]['update']({'closeReason':_0x1c2f('0x14'),'disposition':_0x1c2f('0x15'),'closed':!![],'closedAt':moment()[_0x1c2f('0x16')](_0x1c2f('0x17'))},{'where':{'id':_0x2986b4}});}})[_0x1c2f('0xc')](function(){if(_0x2986b4&&_0x2986b4[_0x1c2f('0x11')]){logger[_0x1c2f('0x12')](_0x1c2f('0x18'),_0x2986b4[_0x1c2f('0x19')]());for(var _0x37bf93=0x0;_0x37bf93<_0x2986b4['length'];_0x37bf93++){io[_0x1c2f('0x1a')](_0x1c2f('0x1b'),{'id':_0x2986b4[_0x37bf93],'closed':!![]});}}})[_0x1c2f('0x1c')](function(_0x5411b8){logger[_0x1c2f('0x1d')](_0x1c2f('0x1e'),_0x5411b8?util['inspect'](_0x5411b8,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 49300e7..79eab27 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf91f=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0xf91f,0x1e9));var _0xff91=function(_0x5dd4e8,_0x4fe162){_0x5dd4e8=_0x5dd4e8-0x0;var _0x2a4403=_0xf91f[_0x5dd4e8];return _0x2a4403;};'use strict';function start(){var _0x48e832=require(_0xff91('0x0'));return _0x48e832[_0xff91('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x9917=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x1dc48e,_0x2a9e57){var _0x34035a=function(_0x5f4612){while(--_0x5f4612){_0x1dc48e['push'](_0x1dc48e['shift']());}};_0x34035a(++_0x2a9e57);}(_0x9917,0xdb));var _0x7991=function(_0x1958b2,_0x1261eb){_0x1958b2=_0x1958b2-0x0;var _0x52a7d7=_0x9917[_0x1958b2];return _0x52a7d7;};'use strict';function start(){var _0x12674b=require(_0x7991('0x0'));return _0x12674b[_0x7991('0x1')]();}module[_0x7991('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 89b2ff4..919ddee 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 _0x0d63=['retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','number','AnalyticExtractedReport','findOne','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','name','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','text','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','SendMail','error\x20mail','stringify','email\x20sent','currentAttempt','retryOptions','retries','job','operation','stop','still\x20loading','case\x20completed','data','case\x20empty','Unrecognized\x20status:','dataValues','attempt','\x20Attempt\x20#:','report\x20status:','sendMail','isNil','subtractUnit','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','keyBy','toString','difference','length','exists','delete\x20cron','toRun','resolve','run\x20job','cron','isBetween','startAt','endAt','add','start','deleteJob','stop\x20cron','update','update\x20cron','run','path','lodash','jayson/promise','schedule','../../mysqldb'];(function(_0x4bccd7,_0x213c94){var _0x196ceb=function(_0x2accb0){while(--_0x2accb0){_0x4bccd7['push'](_0x4bccd7['shift']());}};_0x196ceb(++_0x213c94);}(_0x0d63,0x69));var _0x30d6=function(_0x5790ab,_0xa4f493){_0x5790ab=_0x5790ab-0x0;var _0xcbbef1=_0x0d63[_0x5790ab];return _0xcbbef1;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x30d6('0x0'));var _=require(_0x30d6('0x1'));var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0x30d6('0x2'));var BPromise=require('bluebird');var logger=require('../logger')(_0x30d6('0x3'));var db=require(_0x30d6('0x4'))['db'];const retry=require(_0x30d6('0x5'));var analyticCustomReportController=require(_0x30d6('0x6'));var analyticDefaultReportController=require(_0x30d6('0x7'));var client=jayson[_0x30d6('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x588176){const _0xdc788b={};if(typeof _0x588176===_0x30d6('0x9')){_0xdc788b['id']=_0x588176;}return db[_0x30d6('0xa')][_0x30d6('0xb')]({'where':_0xdc788b})[_0x30d6('0xc')](function(_0x6cd001){return _0x6cd001;})[_0x30d6('0xd')](function(_0x5c7787){logger[_0x30d6('0xe')](_0x5c7787);});}function handleSendEmail(_0x398fc3,_0x3efad0){logger[_0x30d6('0xf')](_0x30d6('0x10'),_0x398fc3[_0x30d6('0x11')]);var _0x369f83=!![];var _0x49e5e0=_0x398fc3[_0x30d6('0x12')]['getSmtpOptions']();var _0x447310={'account':_0x49e5e0,'message':{'from':util[_0x30d6('0x13')](_0x30d6('0x14'),_0x398fc3[_0x30d6('0x12')][_0x30d6('0x15')],_0x398fc3['MailAccount'][_0x30d6('0x11')]||_0x398fc3[_0x30d6('0x12')][_0x30d6('0x16')][_0x30d6('0x17')]),'to':_0x398fc3[_0x30d6('0x11')],'cc':_0x398fc3['cc'],'bcc':_0x398fc3['bcc'],'subject':util['format'](_0x30d6('0x18'),_0x3efad0[_0x30d6('0x15')],_0x398fc3[_0x30d6('0x19')],_0x398fc3['subtractUnit'])}};var _0x11997d=path[_0x30d6('0x1a')](__dirname,_0x30d6('0x1b'));var _0x5a8280=_0x3efad0[_0x30d6('0x1c')];var _0x4e3f26=util[_0x30d6('0x13')](_0x30d6('0x1d'),path[_0x30d6('0x1e')](_0x3efad0[_0x30d6('0x1c')],path[_0x30d6('0x1f')](_0x3efad0[_0x30d6('0x1c')])),_0x30d6('0x20'));var _0x35adaa=path[_0x30d6('0x1a')](_0x11997d,_0x5a8280);var _0x895e94=path[_0x30d6('0x1a')](_0x11997d,_0x4e3f26);if(fs[_0x30d6('0x21')](_0x35adaa)){_0x3efad0[_0x30d6('0x22')]=_0x30d6('0x23');_0x447310[_0x30d6('0x24')][_0x30d6('0x25')]=[{'filename':_0x5a8280,'path':_0x35adaa}];_0x447310['message']['text']=util['format'](_0x30d6('0x26'),JSON['stringify'](_0x3efad0,null,0x2));}else if(fs['existsSync'](_0x895e94)){_0x3efad0['status']=_0x30d6('0x23');_0x447310['message'][_0x30d6('0x25')]=[{'filename':_0x4e3f26,'path':_0x895e94}];}else{if(_0x3efad0[_0x30d6('0x22')]===_0x30d6('0x27')){_0x447310[_0x30d6('0x24')]['text']=_0x30d6('0x28');if(!_0x398fc3[_0x30d6('0x29')]){_0x369f83=![];logger[_0x30d6('0xf')](_0x30d6('0x2a'));}}else if(_0x3efad0[_0x30d6('0x22')]===_0x30d6('0x2b')){_0x447310['message']['text']=_0x30d6('0x2c');}else if(_0x3efad0[_0x30d6('0x22')]===_0x30d6('0x2d')){_0x447310[_0x30d6('0x24')][_0x30d6('0x2e')]=_0x30d6('0x2f');}else if(_0x3efad0[_0x30d6('0x22')]===_0x30d6('0x30')){_0x447310[_0x30d6('0x24')][_0x30d6('0x2e')]=_0x30d6('0x31');}else{logger['error'](_0x30d6('0x32'),_0x3efad0[_0x30d6('0x22')]);}}if(_0x369f83){return client['request'](_0x30d6('0x33'),_0x447310)['then'](function(_0x186bca){if(_0x186bca[_0x30d6('0xe')]){return logger['error'](_0x30d6('0x34'),JSON[_0x30d6('0x35')](_0x186bca));}return logger[_0x30d6('0xf')](_0x30d6('0x36'));})[_0x30d6('0xd')](function(_0x293f49){return logger[_0x30d6('0xe')](_0x30d6('0x34'),JSON[_0x30d6('0x35')](_0x293f49));});}}function handleError(){return function(_0x326266){return logger[_0x30d6('0xe')](JSON[_0x30d6('0x35')](_0x326266));};}function loading(_0x2970a8){logger[_0x30d6('0xf')]('case\x20loading');if(_0x2970a8[_0x30d6('0x37')]===_0x2970a8[_0x30d6('0x38')][_0x30d6('0x39')]){handleSendEmail(_0x2970a8[_0x30d6('0x3a')],_0x2970a8['data']);_0x2970a8[_0x30d6('0x3b')][_0x30d6('0x3c')]();}else{_0x2970a8['operation'][_0x30d6('0x5')](_0x30d6('0x3d'));}}function completed(_0x1a9713){logger[_0x30d6('0xf')](_0x30d6('0x3e'));handleSendEmail(_0x1a9713[_0x30d6('0x3a')],_0x1a9713[_0x30d6('0x3f')]);_0x1a9713['operation'][_0x30d6('0x3c')]();}function empty(_0x353a80){logger['info'](_0x30d6('0x40'));handleSendEmail(_0x353a80[_0x30d6('0x3a')],_0x353a80[_0x30d6('0x3f')]);_0x353a80[_0x30d6('0x3b')][_0x30d6('0x3c')]();}function failed(_0x3d611b){logger['info']('case\x20failed');handleSendEmail(_0x3d611b['job'],_0x3d611b[_0x30d6('0x3f')]);_0x3d611b[_0x30d6('0x3b')][_0x30d6('0x3c')]();}function urecognized(_0x5082b6){logger[_0x30d6('0xe')](_0x30d6('0x41'),_0x5082b6['entity'][_0x30d6('0x42')][_0x30d6('0x22')]);_0x5082b6[_0x30d6('0x3b')]['stop']();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0xfb5740,_0x17d6fe){const _0x1e78b2={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x218208=retry[_0x30d6('0x3b')](_0x1e78b2);_0x218208[_0x30d6('0x43')](_0x2eab0a=>{logger[_0x30d6('0xf')]('Job\x20ID\x20'+_0xfb5740['id']+_0x30d6('0x44')+_0x2eab0a);try{getReportData(_0x17d6fe['id'])[_0x30d6('0xc')](function(_0x43cd11){_0x17d6fe=_0x43cd11;logger[_0x30d6('0xf')]('report\x20status:',_0x43cd11['dataValues']['status']);if(!reportStatusStrategies[_0x43cd11[_0x30d6('0x42')][_0x30d6('0x22')]]){logger[_0x30d6('0xe')](_0x30d6('0x45'),_0x43cd11[_0x30d6('0x42')][_0x30d6('0x22')]);_0x218208[_0x30d6('0x5')]();}reportStatusStrategies[_0x43cd11[_0x30d6('0x42')][_0x30d6('0x22')]]({'operation':_0x218208,'currentAttempt':_0x2eab0a,'retryOptions':_0x1e78b2,'job':_0xfb5740,'data':_0x17d6fe,'entity':_0x43cd11});});}catch(_0x476d9f){_0x218208['retry'](_0x476d9f);}});}function handleResult(_0x386537){return function(_0x496ee5){if(_0x386537[_0x30d6('0x46')]&&_0x386537[_0x30d6('0x12')]&&_0x386537['MailAccount'][_0x30d6('0x16')]&&!_[_0x30d6('0x47')](_0x386537[_0x30d6('0x11')])){retryer(_0x386537,_0x496ee5);}};}function handleJob(_0x264454){return function(){try{if(_['isNil'](_0x264454[_0x30d6('0x19')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x30d6('0x47')](_0x264454[_0x30d6('0x48')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x305360={'startDate':moment()[_0x30d6('0x49')](_0x264454[_0x30d6('0x19')],_0x264454[_0x30d6('0x48')])[_0x30d6('0x13')](_0x30d6('0x4a')),'endDate':moment()[_0x30d6('0x13')](_0x30d6('0x4a')),'type':_0x30d6('0x4b'),'output':_0x264454[_0x30d6('0x4c')],'name':_0x264454['name']};if(!_[_0x30d6('0x47')](_0x264454[_0x30d6('0x4d')])){logger[_0x30d6('0xf')](_0x30d6('0x4e'),_0x264454[_0x30d6('0x4d')]);return analyticDefaultReportController[_0x30d6('0x4f')]({'id':_0x264454[_0x30d6('0x4d')]},_0x305360)['then'](handleResult(_0x264454))['catch'](handleError());}if(!_['isNil'](_0x264454[_0x30d6('0x50')])){logger['info'](_0x30d6('0x51'),_0x264454[_0x30d6('0x50')]);return analyticCustomReportController['runReport']({'id':_0x264454[_0x30d6('0x50')]},_0x305360)[_0x30d6('0xc')](handleResult(_0x264454))[_0x30d6('0xd')](handleError());}}catch(_0x199362){logger[_0x30d6('0xe')](JSON[_0x30d6('0x35')](_0x199362));}return logger[_0x30d6('0xf')](_0x30d6('0x52'));};}function getJobs(_0x45ac1f){var _0x305109={};if(_0x45ac1f){_0x305109['id']=_0x45ac1f;}return db[_0x30d6('0x53')][_0x30d6('0x54')]({'where':_0x305109,'include':[{'model':db['MailAccount'],'attributes':['id',_0x30d6('0x15'),_0x30d6('0x11')],'include':[{'model':db[_0x30d6('0x55')],'as':_0x30d6('0x16'),'include':[{'model':db[_0x30d6('0x56')],'as':_0x30d6('0x56')}]}]}]})[_0x30d6('0xc')](function(_0x288862){var _0x425287=_[_0x30d6('0x57')](manager[_0x30d6('0x58')]);var _0x496840=_[_0x30d6('0x59')](_0x288862,function(_0x3fe148){return _0x3fe148['id']['toString']();});var _0x497e63=_[_0x30d6('0x5a')](_0x288862,function(_0x4c98ea){return _0x4c98ea['id'][_0x30d6('0x5b')]();});var _0x3c6b40=_0x45ac1f?_0x496840:_[_0x30d6('0x5c')](_0x496840,_0x425287);var _0x57748f=_['intersection'](_0x496840,_0x425287);var _0x568c40=_[_0x30d6('0x5c')](_0x425287,_0x496840);var _0x2cd295;var _0x227872;for(_0x2cd295=0x0;_0x2cd295<_0x568c40[_0x30d6('0x5d')]&&!_0x45ac1f;_0x2cd295+=0x1){_0x227872=_0x568c40[_0x2cd295][_0x30d6('0x5b')]();if(manager[_0x30d6('0x5e')](_0x227872)){manager[_0x30d6('0x3c')](_0x227872);manager['deleteJob'](_0x227872);logger[_0x30d6('0xf')](_0x30d6('0x5f'),_0x227872);}}logger[_0x30d6('0xf')](_0x30d6('0x60'),JSON[_0x30d6('0x35')](_0x3c6b40));for(_0x2cd295=0x0;_0x2cd295<_0x3c6b40['length'];_0x2cd295+=0x1){_0x227872=_0x3c6b40[_0x2cd295]['toString']();if(_0x45ac1f){logger[_0x30d6('0xf')](JSON[_0x30d6('0x35')](_0x497e63[_0x227872]));BPromise[_0x30d6('0x61')]()[_0x30d6('0xc')](handleJob(_0x497e63[_0x227872]));logger[_0x30d6('0xf')](_0x30d6('0x62'),_0x497e63[_0x227872][_0x30d6('0x15')],_0x497e63[_0x227872]['cron']);}else if(_0x497e63[_0x227872][_0x30d6('0x63')]&&_0x497e63[_0x227872]['active']&&moment()[_0x30d6('0x64')](_0x497e63[_0x227872][_0x30d6('0x65')],_0x497e63[_0x227872][_0x30d6('0x66')])){manager[_0x30d6('0x67')](_0x227872,_0x497e63[_0x227872][_0x30d6('0x63')],handleJob(_0x497e63[_0x227872]));manager[_0x30d6('0x68')](_0x227872);logger[_0x30d6('0xf')]('add\x20cron',_0x497e63[_0x227872][_0x30d6('0x15')],_0x497e63[_0x227872][_0x30d6('0x63')]);}else if(manager[_0x30d6('0x5e')](_0x227872)){manager[_0x30d6('0x3c')](_0x227872);manager[_0x30d6('0x69')](_0x227872);logger['info'](_0x30d6('0x6a'),_0x497e63[_0x227872]['name'],_0x497e63[_0x227872][_0x30d6('0x63')]);}}for(_0x2cd295=0x0,_0x227872;_0x2cd295<_0x57748f[_0x30d6('0x5d')]&&!_0x45ac1f;_0x2cd295+=0x1){_0x227872=_0x57748f[_0x2cd295][_0x30d6('0x5b')]();if(manager['exists'](_0x227872)){if(_0x497e63[_0x227872][_0x30d6('0x63')]&&_0x497e63[_0x227872]['active']&&moment()[_0x30d6('0x64')](_0x497e63[_0x227872][_0x30d6('0x65')],_0x497e63[_0x227872][_0x30d6('0x66')])){manager[_0x30d6('0x6b')](_0x227872,_0x497e63[_0x227872]['cron'],handleJob(_0x497e63[_0x227872]));logger['info'](_0x30d6('0x6c'),_0x497e63[_0x227872][_0x30d6('0x15')],_0x497e63[_0x227872][_0x30d6('0x63')]);}else{manager[_0x30d6('0x3c')](_0x227872);manager[_0x30d6('0x69')](_0x227872);logger[_0x30d6('0xf')](_0x30d6('0x6a'),_0x497e63[_0x227872][_0x30d6('0x15')],_0x497e63[_0x227872][_0x30d6('0x63')]);}}}})[_0x30d6('0xd')](function(_0x576911){logger[_0x30d6('0xe')](JSON[_0x30d6('0x35')](_0x576911));});}exports[_0x30d6('0x6d')]=function(_0x56913e){return getJobs(_0x56913e);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x85c7=['delete\x20cron','toRun','resolve','run\x20job','cron','active','isBetween','add','start','add\x20cron','stop\x20cron','startAt','endAt','update','run','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','client','number','findOne','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','../../files/reports','%s.%s','basename','savename','extname','zip','join','status','Sent','message','attachments','text','stringify','existsSync','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','error\x20mail','email\x20sent','case\x20loading','retryOptions','retries','job','operation','stop','still\x20loading','case\x20completed','data','case\x20empty','Unrecognized\x20status:','entity','dataValues','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','retry','sendMail','subtractNumber','subtractNumber\x20null\x20or\x20undefined','isNil','subtractUnit','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','exec\x20custom\x20report\x20id:%s','Schedule','MailServerOut','CloudProvider','keys','jobs','toString','keyBy','difference','length','exists','deleteJob'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x85c7,0x78));var _0x785c=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x85c7[_0x4fc9e6];return _0x551d28;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x785c('0x0'));var _=require(_0x785c('0x1'));var moment=require('moment');var CronJobManager=require(_0x785c('0x2'));var jayson=require(_0x785c('0x3'));var BPromise=require(_0x785c('0x4'));var logger=require(_0x785c('0x5'))(_0x785c('0x6'));var db=require('../../mysqldb')['db'];const retry=require('retry');var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x785c('0x7')]['http']({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x364b9a){const _0x1bda74={};if(typeof _0x364b9a===_0x785c('0x8')){_0x1bda74['id']=_0x364b9a;}return db['AnalyticExtractedReport'][_0x785c('0x9')]({'where':_0x1bda74})[_0x785c('0xa')](function(_0x40bf27){return _0x40bf27;})[_0x785c('0xb')](function(_0x4bff87){logger[_0x785c('0xc')](_0x4bff87);});}function handleSendEmail(_0x447d1d,_0x4f9a5e){logger[_0x785c('0xd')](_0x785c('0xe'),_0x447d1d[_0x785c('0xf')]);var _0xed68ec=!![];var _0x5b004=_0x447d1d[_0x785c('0x10')]['getSmtpOptions']();var _0x25d720={'account':_0x5b004,'message':{'from':util[_0x785c('0x11')](_0x785c('0x12'),_0x447d1d['MailAccount'][_0x785c('0x13')],_0x447d1d['MailAccount'][_0x785c('0xf')]||_0x447d1d['MailAccount'][_0x785c('0x14')][_0x785c('0x15')]),'to':_0x447d1d[_0x785c('0xf')],'cc':_0x447d1d['cc'],'bcc':_0x447d1d[_0x785c('0x16')],'subject':util[_0x785c('0x11')]('Report\x20%s\x20last\x20%s\x20%s',_0x4f9a5e['name'],_0x447d1d['subtractNumber'],_0x447d1d['subtractUnit'])}};var _0xe95aeb=path['join'](__dirname,_0x785c('0x17'));var _0x517336=_0x4f9a5e['savename'];var _0x369e95=util[_0x785c('0x11')](_0x785c('0x18'),path[_0x785c('0x19')](_0x4f9a5e[_0x785c('0x1a')],path[_0x785c('0x1b')](_0x4f9a5e[_0x785c('0x1a')])),_0x785c('0x1c'));var _0x3174c7=path[_0x785c('0x1d')](_0xe95aeb,_0x517336);var _0x2c28cb=path[_0x785c('0x1d')](_0xe95aeb,_0x369e95);if(fs['existsSync'](_0x3174c7)){_0x4f9a5e[_0x785c('0x1e')]=_0x785c('0x1f');_0x25d720[_0x785c('0x20')][_0x785c('0x21')]=[{'filename':_0x517336,'path':_0x3174c7}];_0x25d720[_0x785c('0x20')][_0x785c('0x22')]=util[_0x785c('0x11')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x785c('0x23')](_0x4f9a5e,null,0x2));}else if(fs[_0x785c('0x24')](_0x2c28cb)){_0x4f9a5e[_0x785c('0x1e')]=_0x785c('0x1f');_0x25d720[_0x785c('0x20')][_0x785c('0x21')]=[{'filename':_0x369e95,'path':_0x2c28cb}];}else{if(_0x4f9a5e['status']===_0x785c('0x25')){_0x25d720[_0x785c('0x20')][_0x785c('0x22')]=_0x785c('0x26');if(!_0x447d1d[_0x785c('0x27')]){_0xed68ec=![];logger[_0x785c('0xd')](_0x785c('0x28'));}}else if(_0x4f9a5e[_0x785c('0x1e')]===_0x785c('0x29')){_0x25d720[_0x785c('0x20')]['text']='Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x4f9a5e['status']===_0x785c('0x2a')){_0x25d720['message']['text']=_0x785c('0x2b');}else if(_0x4f9a5e[_0x785c('0x1e')]===_0x785c('0x2c')){_0x25d720[_0x785c('0x20')]['text']=_0x785c('0x2d');}else{logger[_0x785c('0xc')](_0x785c('0x2e'),_0x4f9a5e[_0x785c('0x1e')]);}}if(_0xed68ec){return client[_0x785c('0x2f')]('SendMail',_0x25d720)[_0x785c('0xa')](function(_0x470d4b){if(_0x470d4b['error']){return logger['error'](_0x785c('0x30'),JSON[_0x785c('0x23')](_0x470d4b));}return logger[_0x785c('0xd')](_0x785c('0x31'));})['catch'](function(_0x56a276){return logger[_0x785c('0xc')]('error\x20mail',JSON[_0x785c('0x23')](_0x56a276));});}}function handleError(){return function(_0xf39a35){return logger[_0x785c('0xc')](JSON[_0x785c('0x23')](_0xf39a35));};}function loading(_0xafce9f){logger[_0x785c('0xd')](_0x785c('0x32'));if(_0xafce9f['currentAttempt']===_0xafce9f[_0x785c('0x33')][_0x785c('0x34')]){handleSendEmail(_0xafce9f[_0x785c('0x35')],_0xafce9f['data']);_0xafce9f[_0x785c('0x36')][_0x785c('0x37')]();}else{_0xafce9f['operation']['retry'](_0x785c('0x38'));}}function completed(_0x46ec05){logger[_0x785c('0xd')](_0x785c('0x39'));handleSendEmail(_0x46ec05['job'],_0x46ec05[_0x785c('0x3a')]);_0x46ec05[_0x785c('0x36')][_0x785c('0x37')]();}function empty(_0x3a3364){logger[_0x785c('0xd')](_0x785c('0x3b'));handleSendEmail(_0x3a3364[_0x785c('0x35')],_0x3a3364[_0x785c('0x3a')]);_0x3a3364['operation'][_0x785c('0x37')]();}function failed(_0x110294){logger[_0x785c('0xd')]('case\x20failed');handleSendEmail(_0x110294['job'],_0x110294[_0x785c('0x3a')]);_0x110294[_0x785c('0x36')]['stop']();}function urecognized(_0x476a3b){logger[_0x785c('0xc')](_0x785c('0x3c'),_0x476a3b[_0x785c('0x3d')][_0x785c('0x3e')][_0x785c('0x1e')]);_0x476a3b['operation']['stop']();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x5ec53b,_0x1f878f){const _0x167230={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x26bc6c=retry[_0x785c('0x36')](_0x167230);_0x26bc6c['attempt'](_0x38ed90=>{logger['info'](_0x785c('0x3f')+_0x5ec53b['id']+_0x785c('0x40')+_0x38ed90);try{getReportData(_0x1f878f['id'])[_0x785c('0xa')](function(_0x3a8487){_0x1f878f=_0x3a8487;logger[_0x785c('0xd')](_0x785c('0x41'),_0x3a8487[_0x785c('0x3e')][_0x785c('0x1e')]);if(!reportStatusStrategies[_0x3a8487['dataValues']['status']]){logger[_0x785c('0xc')](_0x785c('0x41'),_0x3a8487[_0x785c('0x3e')][_0x785c('0x1e')]);_0x26bc6c['retry']();}reportStatusStrategies[_0x3a8487['dataValues'][_0x785c('0x1e')]]({'operation':_0x26bc6c,'currentAttempt':_0x38ed90,'retryOptions':_0x167230,'job':_0x5ec53b,'data':_0x1f878f,'entity':_0x3a8487});});}catch(_0x404b01){_0x26bc6c[_0x785c('0x42')](_0x404b01);}});}function handleResult(_0xcd30cc){return function(_0x2add51){if(_0xcd30cc[_0x785c('0x43')]&&_0xcd30cc[_0x785c('0x10')]&&_0xcd30cc[_0x785c('0x10')][_0x785c('0x14')]&&!_['isNil'](_0xcd30cc['email'])){retryer(_0xcd30cc,_0x2add51);}};}function handleJob(_0x3f0b3e){return function(){try{if(_['isNil'](_0x3f0b3e[_0x785c('0x44')])){return logger[_0x785c('0xd')](_0x785c('0x45'));}if(_[_0x785c('0x46')](_0x3f0b3e[_0x785c('0x47')])){return logger[_0x785c('0xd')]('subtractUnit\x20null\x20or\x20undefined');}var _0x4d7b06={'startDate':moment()[_0x785c('0x48')](_0x3f0b3e[_0x785c('0x44')],_0x3f0b3e[_0x785c('0x47')])[_0x785c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x785c('0x11')](_0x785c('0x49')),'type':_0x785c('0x4a'),'output':_0x3f0b3e[_0x785c('0x4b')],'name':_0x3f0b3e[_0x785c('0x13')]};if(!_[_0x785c('0x46')](_0x3f0b3e[_0x785c('0x4c')])){logger[_0x785c('0xd')](_0x785c('0x4d'),_0x3f0b3e[_0x785c('0x4c')]);return analyticDefaultReportController['runReport']({'id':_0x3f0b3e[_0x785c('0x4c')]},_0x4d7b06)[_0x785c('0xa')](handleResult(_0x3f0b3e))[_0x785c('0xb')](handleError());}if(!_['isNil'](_0x3f0b3e['CustomReportId'])){logger[_0x785c('0xd')](_0x785c('0x4e'),_0x3f0b3e['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x3f0b3e['CustomReportId']},_0x4d7b06)['then'](handleResult(_0x3f0b3e))[_0x785c('0xb')](handleError());}}catch(_0x157c57){logger['error'](JSON[_0x785c('0x23')](_0x157c57));}return logger[_0x785c('0xd')]('no\x20report\x20id');};}function getJobs(_0x535de5){var _0x1db4bd={};if(_0x535de5){_0x1db4bd['id']=_0x535de5;}return db[_0x785c('0x4f')]['findAll']({'where':_0x1db4bd,'include':[{'model':db[_0x785c('0x10')],'attributes':['id',_0x785c('0x13'),_0x785c('0xf')],'include':[{'model':db[_0x785c('0x50')],'as':'Smtp','include':[{'model':db[_0x785c('0x51')],'as':_0x785c('0x51')}]}]}]})[_0x785c('0xa')](function(_0x315e51){var _0x22fb21=_[_0x785c('0x52')](manager[_0x785c('0x53')]);var _0x334f30=_['map'](_0x315e51,function(_0x555f0c){return _0x555f0c['id'][_0x785c('0x54')]();});var _0x1eba0c=_[_0x785c('0x55')](_0x315e51,function(_0x564cf3){return _0x564cf3['id'][_0x785c('0x54')]();});var _0x2ecf9f=_0x535de5?_0x334f30:_['difference'](_0x334f30,_0x22fb21);var _0x13f6b6=_['intersection'](_0x334f30,_0x22fb21);var _0x5ea4ad=_[_0x785c('0x56')](_0x22fb21,_0x334f30);var _0xf249a7;var _0x82bd97;for(_0xf249a7=0x0;_0xf249a7<_0x5ea4ad[_0x785c('0x57')]&&!_0x535de5;_0xf249a7+=0x1){_0x82bd97=_0x5ea4ad[_0xf249a7][_0x785c('0x54')]();if(manager[_0x785c('0x58')](_0x82bd97)){manager['stop'](_0x82bd97);manager[_0x785c('0x59')](_0x82bd97);logger[_0x785c('0xd')](_0x785c('0x5a'),_0x82bd97);}}logger[_0x785c('0xd')](_0x785c('0x5b'),JSON[_0x785c('0x23')](_0x2ecf9f));for(_0xf249a7=0x0;_0xf249a7<_0x2ecf9f[_0x785c('0x57')];_0xf249a7+=0x1){_0x82bd97=_0x2ecf9f[_0xf249a7][_0x785c('0x54')]();if(_0x535de5){logger[_0x785c('0xd')](JSON[_0x785c('0x23')](_0x1eba0c[_0x82bd97]));BPromise[_0x785c('0x5c')]()[_0x785c('0xa')](handleJob(_0x1eba0c[_0x82bd97]));logger['info'](_0x785c('0x5d'),_0x1eba0c[_0x82bd97]['name'],_0x1eba0c[_0x82bd97]['cron']);}else if(_0x1eba0c[_0x82bd97][_0x785c('0x5e')]&&_0x1eba0c[_0x82bd97][_0x785c('0x5f')]&&moment()[_0x785c('0x60')](_0x1eba0c[_0x82bd97]['startAt'],_0x1eba0c[_0x82bd97]['endAt'])){manager[_0x785c('0x61')](_0x82bd97,_0x1eba0c[_0x82bd97][_0x785c('0x5e')],handleJob(_0x1eba0c[_0x82bd97]));manager[_0x785c('0x62')](_0x82bd97);logger[_0x785c('0xd')](_0x785c('0x63'),_0x1eba0c[_0x82bd97][_0x785c('0x13')],_0x1eba0c[_0x82bd97][_0x785c('0x5e')]);}else if(manager[_0x785c('0x58')](_0x82bd97)){manager[_0x785c('0x37')](_0x82bd97);manager[_0x785c('0x59')](_0x82bd97);logger[_0x785c('0xd')](_0x785c('0x64'),_0x1eba0c[_0x82bd97][_0x785c('0x13')],_0x1eba0c[_0x82bd97]['cron']);}}for(_0xf249a7=0x0,_0x82bd97;_0xf249a7<_0x13f6b6['length']&&!_0x535de5;_0xf249a7+=0x1){_0x82bd97=_0x13f6b6[_0xf249a7][_0x785c('0x54')]();if(manager[_0x785c('0x58')](_0x82bd97)){if(_0x1eba0c[_0x82bd97]['cron']&&_0x1eba0c[_0x82bd97][_0x785c('0x5f')]&&moment()[_0x785c('0x60')](_0x1eba0c[_0x82bd97][_0x785c('0x65')],_0x1eba0c[_0x82bd97][_0x785c('0x66')])){manager[_0x785c('0x67')](_0x82bd97,_0x1eba0c[_0x82bd97][_0x785c('0x5e')],handleJob(_0x1eba0c[_0x82bd97]));logger['info']('update\x20cron',_0x1eba0c[_0x82bd97]['name'],_0x1eba0c[_0x82bd97][_0x785c('0x5e')]);}else{manager[_0x785c('0x37')](_0x82bd97);manager[_0x785c('0x59')](_0x82bd97);logger[_0x785c('0xd')](_0x785c('0x64'),_0x1eba0c[_0x82bd97][_0x785c('0x13')],_0x1eba0c[_0x82bd97][_0x785c('0x5e')]);}}}})[_0x785c('0xb')](function(_0x24124a){logger[_0x785c('0xc')](JSON[_0x785c('0x23')](_0x24124a));});}exports[_0x785c('0x68')]=function(_0xc2cd10){return getJobs(_0xc2cd10);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 22c8c2b..59483ec 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 _0x8580=['language','bucket','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','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','CloudProvider','forEach','push','all','inspect','aws-sdk','util','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId'];(function(_0x3697ec,_0x1c5732){var _0x5440da=function(_0x357636){while(--_0x357636){_0x3697ec['push'](_0x3697ec['shift']());}};_0x5440da(++_0x1c5732);}(_0x8580,0x1c7));var _0x0858=function(_0x28c03b,_0x1b4489){_0x28c03b=_0x28c03b-0x0;var _0xa53fb=_0x8580[_0x28c03b];return _0xa53fb;};var _=require('lodash');var AWS=require(_0x0858('0x0'));var rp=require('request-promise');var util=require(_0x0858('0x1'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x0858('0x2'))(_0x0858('0x3'));function getTranscriptionJob(_0x55aab5,_0x6928ba,_0xa857b7,_0x47be72){return new Promise(function(_0x2b34e0,_0x8c913d){var _0x3515b4=new AWS[(_0x0858('0x4'))]({'accessKeyId':_0x6928ba,'secretAccessKey':_0x55aab5,'region':_0xa857b7});_0x3515b4['getTranscriptionJob']({'TranscriptionJobName':_0x47be72},function(_0x9c611c,_0x3ae92b){if(_0x9c611c){return _0x8c913d(_0x9c611c);}else{return _0x2b34e0(_0x3ae92b);}});});}function sentiment(_0x3e1da7,_0x4fb9ff,_0x4ceffb,_0x470459,_0x4b5072){return new Promise(function(_0x24996d,_0x1c214c){var _0x38371f=new AWS[(_0x0858('0x5'))]({'accessKeyId':_0x4fb9ff,'secretAccessKey':_0x3e1da7,'region':_0x4ceffb});_0x38371f[_0x0858('0x6')]({'Text':_0x470459,'LanguageCode':_0x4b5072[_0x0858('0x7')](0x0,0x2)},function(_0x3afdde,_0x55d54e){if(_0x3afdde){return _0x1c214c(_0x3afdde);}else{return _0x24996d(_0x55d54e);}});});}function checkTranscribeJob(_0x537811,_0x49eb34,_0x448d29){var _0x4dec96;return new BPromise(function(_0x514b21,_0x590446){logger[_0x0858('0x8')](util[_0x0858('0x9')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x537811['id'],_0x537811[_0x0858('0xa')]));return getTranscriptionJob(_0x448d29[_0x0858('0xb')],_0x448d29[_0x0858('0xc')],_0x49eb34[_0x0858('0xd')],_0x537811[_0x0858('0xa')])[_0x0858('0xe')](function(_0xca6a95){logger[_0x0858('0x8')](util[_0x0858('0x9')](_0x0858('0xf'),_0x537811['id'],_0x537811[_0x0858('0xa')],_0xca6a95[_0x0858('0x10')]['TranscriptionJobStatus']));if(!_0x537811[_0x0858('0x11')]){switch(_0xca6a95['TranscriptionJob'][_0x0858('0x12')]){case _0x0858('0x13'):var _0x3a2d96={'transcribeStatus':_0xca6a95[_0x0858('0x10')][_0x0858('0x12')],'fileUri':_0xca6a95['TranscriptionJob'][_0x0858('0x14')][_0x0858('0x15')]};logger['info'](util[_0x0858('0x9')]('[RECORDING:%d]\x20Get\x20transcript',_0x537811['id']));return rp({'uri':_0xca6a95['TranscriptionJob'][_0x0858('0x14')][_0x0858('0x15')],'json':!![]})[_0x0858('0xe')](function(_0x157a39){logger[_0x0858('0x8')](util['format'](_0x0858('0x16'),_0x537811['id']));if(_0x157a39&&_0x157a39['results']&&_0x157a39[_0x0858('0x17')]['transcripts']&&_0x157a39[_0x0858('0x17')][_0x0858('0x18')][_0x0858('0x19')]){_0x3a2d96[_0x0858('0x11')]='';for(var _0x4fe016=0x0;_0x4fe016<_0x157a39[_0x0858('0x17')][_0x0858('0x18')][_0x0858('0x19')];_0x4fe016++){_0x3a2d96[_0x0858('0x11')]+=_0x157a39[_0x0858('0x17')][_0x0858('0x18')][_0x4fe016][_0x0858('0x1a')]+'';}}return _0x537811[_0x0858('0x1b')](_0x3a2d96);})[_0x0858('0xe')](function(){logger[_0x0858('0x8')](util[_0x0858('0x9')](_0x0858('0x1c'),_0x537811['id']));if(!_0x537811[_0x0858('0x1d')]){throw new db[(_0x0858('0x1e'))][(_0x0858('0x1f'))](_0x0858('0x20'));}if(!_0x49eb34[_0x0858('0x21')]||!_0x49eb34[_0x0858('0x22')]||!_0x49eb34['sentimentRegion']||!_0x49eb34[_0x0858('0x23')]||!_0x49eb34[_0x0858('0x24')]){throw new db[(_0x0858('0x1e'))][(_0x0858('0x1f'))](_0x0858('0x25'));}if(!_0x3a2d96[_0x0858('0x11')]){throw new Error(_0x0858('0x26'));}if(_0x49eb34[_0x0858('0x22')]===_0x448d29['id']){return _0x448d29;}else{return db['CloudProvider'][_0x0858('0x27')]({'where':{'id':_settings[_0x0858('0x22')]}});}})[_0x0858('0xe')](function(_0x2ab544){if(!_0x2ab544){throw new db['Sequelize'][(_0x0858('0x1f'))](_0x0858('0x28'));}if(!_0x2ab544['data1']||!_0x2ab544[_0x0858('0xc')]){throw new db[(_0x0858('0x1e'))]['ValidationError'](_0x0858('0x29'));}_0x4dec96=_0x2ab544;logger[_0x0858('0x8')](util[_0x0858('0x9')](_0x0858('0x2a'),_0x537811['id']));return sentiment(_0x4dec96[_0x0858('0xb')],_0x4dec96[_0x0858('0xc')],_0x49eb34[_0x0858('0x2b')],_0x3a2d96[_0x0858('0x11')],_0x49eb34[_0x0858('0x23')]);})['then'](function(_0x4fbb5e){logger[_0x0858('0x8')](util[_0x0858('0x9')](_0x0858('0x2c'),_0x537811['id']));return _0x537811[_0x0858('0x1b')]({'sentiment':_0x4fbb5e[_0x0858('0x2d')],'sPositive':_0x4fbb5e[_0x0858('0x2e')][_0x0858('0x2f')],'sNegative':_0x4fbb5e[_0x0858('0x2e')][_0x0858('0x30')],'sMixed':_0x4fbb5e[_0x0858('0x2e')][_0x0858('0x31')],'sNeutral':_0x4fbb5e[_0x0858('0x2e')][_0x0858('0x32')]});})[_0x0858('0xe')](function(){logger[_0x0858('0x8')](util[_0x0858('0x9')](_0x0858('0x1c'),_0x537811['id']));_0x514b21();});case _0x0858('0x33'):return _0x537811['update']({'transcribeStatus':'FAILED','failureReason':_0xca6a95['TranscriptionJob']['FailureReason']})[_0x0858('0xe')](function(){logger[_0x0858('0x8')](util[_0x0858('0x9')](_0x0858('0x1c'),_0x537811['id']));_0x514b21();});default:logger[_0x0858('0x8')](util[_0x0858('0x9')](_0x0858('0x34'),_0x537811['id']));break;}}else{return BPromise[_0x0858('0x35')]()['then'](function(){if(!_0x537811['tempSentiment']){throw new db['Sequelize'][(_0x0858('0x1f'))](_0x0858('0x20'));}if(!_0x49eb34['sentiment']||!_0x49eb34['sentimentAccountId']||!_0x49eb34[_0x0858('0x2b')]||!_0x49eb34[_0x0858('0x23')]||!_0x49eb34[_0x0858('0x24')]){throw new db['Sequelize'][(_0x0858('0x1f'))](_0x0858('0x25'));}if(!_0x537811[_0x0858('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x49eb34[_0x0858('0x22')]===_0x448d29['id']){return _0x448d29;}else{return db['CloudProvider'][_0x0858('0x27')]({'where':{'id':_settings[_0x0858('0x22')]}});}})[_0x0858('0xe')](function(_0x1dc538){if(!_0x1dc538){throw new db[(_0x0858('0x1e'))]['ValidationError'](_0x0858('0x28'));}if(!_0x1dc538['data1']||!_0x1dc538[_0x0858('0xc')]){throw new db['Sequelize'][(_0x0858('0x1f'))](_0x0858('0x29'));}_0x4dec96=_0x1dc538;logger[_0x0858('0x8')](util[_0x0858('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x537811['id']));return sentiment(_0x4dec96[_0x0858('0xb')],_0x4dec96[_0x0858('0xc')],_0x49eb34['sentimentRegion'],_0x537811[_0x0858('0x11')],_0x49eb34[_0x0858('0x23')]);})[_0x0858('0xe')](function(_0x5c208e){logger['info'](util[_0x0858('0x9')](_0x0858('0x2c'),_0x537811['id']));return _0x537811['update']({'sentiment':_0x5c208e[_0x0858('0x2d')],'sPositive':_0x5c208e[_0x0858('0x2e')][_0x0858('0x2f')],'sNegative':_0x5c208e[_0x0858('0x2e')][_0x0858('0x30')],'sMixed':_0x5c208e['SentimentScore']['Mixed'],'sNeutral':_0x5c208e[_0x0858('0x2e')][_0x0858('0x32')],'transcribeStatus':_0x0858('0x13')});})[_0x0858('0xe')](function(){logger[_0x0858('0x8')](util[_0x0858('0x9')](_0x0858('0x1c'),_0x537811['id']));_0x514b21();});}})[_0x0858('0x36')](function(_0x2156ed){if(_0x2156ed){if(!_0x2156ed[_0x0858('0x37')]||_0x2156ed[_0x0858('0x37')]!==_0x0858('0x38')){logger[_0x0858('0x39')](util['format'](_0x0858('0x3a'),_0x537811['id']),util['inspect'](_0x2156ed,{'showHidden':![],'depth':null}));}}_0x514b21();});});}function checkTranscribe(){var _0x38b706;var _0x402253;var _0x2b8395;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':_0x0858('0x3b')}})['then'](function(_0x318715){if(!_0x318715||!_0x318715['length']){throw new db[(_0x0858('0x1e'))][(_0x0858('0x1f'))](_0x0858('0x3c'));}_0x38b706=_0x318715;return db[_0x0858('0x3d')]['findOne']({'where':{'id':0x1}});})[_0x0858('0xe')](function(_0x2cf3a8){if(!_0x2cf3a8){throw new db[(_0x0858('0x1e'))][(_0x0858('0x1f'))](_0x0858('0x3e'));}_0x402253=_0x2cf3a8;if(!_0x402253[_0x0858('0x3')]||!_0x402253[_0x0858('0x3f')]||!_0x402253[_0x0858('0xd')]||!_0x402253[_0x0858('0x23')]||!_0x402253[_0x0858('0x24')]){throw new db[(_0x0858('0x1e'))][(_0x0858('0x1f'))](_0x0858('0x40'));}return db[_0x0858('0x41')]['findOne']({'where':{'id':_0x402253[_0x0858('0x3f')]}});})[_0x0858('0xe')](function(_0xd983ce){if(!_0xd983ce){throw new db[(_0x0858('0x1e'))][(_0x0858('0x1f'))](_0x0858('0x28'));}if(!_0xd983ce['data1']||!_0xd983ce[_0x0858('0xc')]){throw new db[(_0x0858('0x1e'))]['ValidationError'](_0x0858('0x29'));}_0x2b8395=_0xd983ce;var _0x37e6f0=[];_0x38b706[_0x0858('0x42')](function(_0x1af027){_0x37e6f0[_0x0858('0x43')](checkTranscribeJob(_0x1af027,_0x402253,_0x2b8395));});return BPromise[_0x0858('0x44')](_0x37e6f0);})[_0x0858('0x36')](function(_0x59f2b7){if(_0x59f2b7){if(!_0x59f2b7[_0x0858('0x37')]||_0x59f2b7[_0x0858('0x37')]!==_0x0858('0x38')){logger[_0x0858('0x39')](util[_0x0858('0x45')](_0x59f2b7,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xbc87=['format','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20available','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','lodash','util','bluebird','../../mysqldb','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri'];(function(_0x523f21,_0x4d0552){var _0x38b4a2=function(_0x1e57bc){while(--_0x1e57bc){_0x523f21['push'](_0x523f21['shift']());}};_0x38b4a2(++_0x4d0552);}(_0xbc87,0x144));var _0x7bc8=function(_0x22b983,_0x244e2e){_0x22b983=_0x22b983-0x0;var _0x2b28da=_0xbc87[_0x22b983];return _0x2b28da;};var _=require(_0x7bc8('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0x7bc8('0x1'));var BPromise=require(_0x7bc8('0x2'));var db=require(_0x7bc8('0x3'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x16e8d7,_0x2160fc,_0x103551,_0xc8e5a8){return new Promise(function(_0x489d0b,_0x184610){var _0x410b95=new AWS[(_0x7bc8('0x4'))]({'accessKeyId':_0x2160fc,'secretAccessKey':_0x16e8d7,'region':_0x103551});_0x410b95[_0x7bc8('0x5')]({'TranscriptionJobName':_0xc8e5a8},function(_0x466ed5,_0xb87048){if(_0x466ed5){return _0x184610(_0x466ed5);}else{return _0x489d0b(_0xb87048);}});});}function sentiment(_0x420011,_0x370f27,_0x368899,_0x236bee,_0x24e4cf){return new Promise(function(_0xefdf44,_0x47c0b6){var _0xd1616a=new AWS['Comprehend']({'accessKeyId':_0x370f27,'secretAccessKey':_0x420011,'region':_0x368899});_0xd1616a[_0x7bc8('0x6')]({'Text':_0x236bee,'LanguageCode':_0x24e4cf[_0x7bc8('0x7')](0x0,0x2)},function(_0x3a292b,_0x2f80de){if(_0x3a292b){return _0x47c0b6(_0x3a292b);}else{return _0xefdf44(_0x2f80de);}});});}function checkTranscribeJob(_0x39d4f8,_0x41a2be,_0x4cd0ff){var _0x1d099f;return new BPromise(function(_0x17801e,_0x4bb015){logger[_0x7bc8('0x8')](util['format'](_0x7bc8('0x9'),_0x39d4f8['id'],_0x39d4f8[_0x7bc8('0xa')]));return getTranscriptionJob(_0x4cd0ff[_0x7bc8('0xb')],_0x4cd0ff[_0x7bc8('0xc')],_0x41a2be[_0x7bc8('0xd')],_0x39d4f8['transcribeName'])[_0x7bc8('0xe')](function(_0x47fb8f){logger[_0x7bc8('0x8')](util['format'](_0x7bc8('0xf'),_0x39d4f8['id'],_0x39d4f8[_0x7bc8('0xa')],_0x47fb8f[_0x7bc8('0x10')][_0x7bc8('0x11')]));if(!_0x39d4f8[_0x7bc8('0x12')]){switch(_0x47fb8f[_0x7bc8('0x10')][_0x7bc8('0x11')]){case'COMPLETED':var _0x5b4968={'transcribeStatus':_0x47fb8f[_0x7bc8('0x10')][_0x7bc8('0x11')],'fileUri':_0x47fb8f[_0x7bc8('0x10')][_0x7bc8('0x13')][_0x7bc8('0x14')]};logger['info'](util[_0x7bc8('0x15')](_0x7bc8('0x16'),_0x39d4f8['id']));return rp({'uri':_0x47fb8f[_0x7bc8('0x10')][_0x7bc8('0x13')][_0x7bc8('0x14')],'json':!![]})[_0x7bc8('0xe')](function(_0x1718a2){logger[_0x7bc8('0x8')](util[_0x7bc8('0x15')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x39d4f8['id']));if(_0x1718a2&&_0x1718a2[_0x7bc8('0x17')]&&_0x1718a2[_0x7bc8('0x17')][_0x7bc8('0x18')]&&_0x1718a2[_0x7bc8('0x17')][_0x7bc8('0x18')]['length']){_0x5b4968[_0x7bc8('0x12')]='';for(var _0x3130bf=0x0;_0x3130bf<_0x1718a2[_0x7bc8('0x17')]['transcripts']['length'];_0x3130bf++){_0x5b4968[_0x7bc8('0x12')]+=_0x1718a2[_0x7bc8('0x17')]['transcripts'][_0x3130bf][_0x7bc8('0x19')]+'';}}return _0x39d4f8['update'](_0x5b4968);})[_0x7bc8('0xe')](function(){logger[_0x7bc8('0x8')](util[_0x7bc8('0x15')](_0x7bc8('0x1a'),_0x39d4f8['id']));if(!_0x39d4f8[_0x7bc8('0x1b')]){throw new db[(_0x7bc8('0x1c'))]['ValidationError'](_0x7bc8('0x1d'));}if(!_0x41a2be[_0x7bc8('0x1e')]||!_0x41a2be[_0x7bc8('0x1f')]||!_0x41a2be[_0x7bc8('0x20')]||!_0x41a2be[_0x7bc8('0x21')]||!_0x41a2be[_0x7bc8('0x22')]){throw new db['Sequelize'][(_0x7bc8('0x23'))](_0x7bc8('0x24'));}if(!_0x5b4968['fileText']){throw new Error(_0x7bc8('0x25'));}if(_0x41a2be['sentimentAccountId']===_0x4cd0ff['id']){return _0x4cd0ff;}else{return db[_0x7bc8('0x26')][_0x7bc8('0x27')]({'where':{'id':_settings[_0x7bc8('0x1f')]}});}})[_0x7bc8('0xe')](function(_0x2da153){if(!_0x2da153){throw new db[(_0x7bc8('0x1c'))][(_0x7bc8('0x23'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2da153[_0x7bc8('0xb')]||!_0x2da153['data2']){throw new db[(_0x7bc8('0x1c'))][(_0x7bc8('0x23'))](_0x7bc8('0x28'));}_0x1d099f=_0x2da153;logger['info'](util['format'](_0x7bc8('0x29'),_0x39d4f8['id']));return sentiment(_0x1d099f['data1'],_0x1d099f['data2'],_0x41a2be[_0x7bc8('0x20')],_0x5b4968[_0x7bc8('0x12')],_0x41a2be[_0x7bc8('0x21')]);})[_0x7bc8('0xe')](function(_0xdd3c2b){logger['info'](util[_0x7bc8('0x15')](_0x7bc8('0x2a'),_0x39d4f8['id']));return _0x39d4f8['update']({'sentiment':_0xdd3c2b[_0x7bc8('0x2b')],'sPositive':_0xdd3c2b[_0x7bc8('0x2c')][_0x7bc8('0x2d')],'sNegative':_0xdd3c2b[_0x7bc8('0x2c')][_0x7bc8('0x2e')],'sMixed':_0xdd3c2b['SentimentScore'][_0x7bc8('0x2f')],'sNeutral':_0xdd3c2b['SentimentScore'][_0x7bc8('0x30')]});})[_0x7bc8('0xe')](function(){logger['info'](util[_0x7bc8('0x15')](_0x7bc8('0x1a'),_0x39d4f8['id']));_0x17801e();});case'FAILED':return _0x39d4f8['update']({'transcribeStatus':_0x7bc8('0x31'),'failureReason':_0x47fb8f[_0x7bc8('0x10')][_0x7bc8('0x32')]})['then'](function(){logger[_0x7bc8('0x8')](util['format'](_0x7bc8('0x1a'),_0x39d4f8['id']));_0x17801e();});default:logger[_0x7bc8('0x8')](util['format'](_0x7bc8('0x33'),_0x39d4f8['id']));break;}}else{return BPromise[_0x7bc8('0x34')]()[_0x7bc8('0xe')](function(){if(!_0x39d4f8[_0x7bc8('0x1b')]){throw new db['Sequelize'][(_0x7bc8('0x23'))](_0x7bc8('0x1d'));}if(!_0x41a2be[_0x7bc8('0x1e')]||!_0x41a2be[_0x7bc8('0x1f')]||!_0x41a2be['sentimentRegion']||!_0x41a2be[_0x7bc8('0x21')]||!_0x41a2be[_0x7bc8('0x22')]){throw new db[(_0x7bc8('0x1c'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x39d4f8['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x41a2be[_0x7bc8('0x1f')]===_0x4cd0ff['id']){return _0x4cd0ff;}else{return db[_0x7bc8('0x26')][_0x7bc8('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x7bc8('0xe')](function(_0x3afece){if(!_0x3afece){throw new db[(_0x7bc8('0x1c'))][(_0x7bc8('0x23'))](_0x7bc8('0x35'));}if(!_0x3afece['data1']||!_0x3afece['data2']){throw new db[(_0x7bc8('0x1c'))][(_0x7bc8('0x23'))](_0x7bc8('0x28'));}_0x1d099f=_0x3afece;logger[_0x7bc8('0x8')](util[_0x7bc8('0x15')](_0x7bc8('0x29'),_0x39d4f8['id']));return sentiment(_0x1d099f[_0x7bc8('0xb')],_0x1d099f[_0x7bc8('0xc')],_0x41a2be[_0x7bc8('0x20')],_0x39d4f8['fileText'],_0x41a2be['language']);})[_0x7bc8('0xe')](function(_0xc67e76){logger[_0x7bc8('0x8')](util[_0x7bc8('0x15')](_0x7bc8('0x2a'),_0x39d4f8['id']));return _0x39d4f8['update']({'sentiment':_0xc67e76[_0x7bc8('0x2b')],'sPositive':_0xc67e76['SentimentScore'][_0x7bc8('0x2d')],'sNegative':_0xc67e76['SentimentScore'][_0x7bc8('0x2e')],'sMixed':_0xc67e76[_0x7bc8('0x2c')][_0x7bc8('0x2f')],'sNeutral':_0xc67e76[_0x7bc8('0x2c')]['Neutral'],'transcribeStatus':'COMPLETED'});})[_0x7bc8('0xe')](function(){logger[_0x7bc8('0x8')](util[_0x7bc8('0x15')](_0x7bc8('0x1a'),_0x39d4f8['id']));_0x17801e();});}})[_0x7bc8('0x36')](function(_0x4745f7){if(_0x4745f7){if(!_0x4745f7['name']||_0x4745f7[_0x7bc8('0x37')]!==_0x7bc8('0x38')){logger[_0x7bc8('0x39')](util[_0x7bc8('0x15')](_0x7bc8('0x3a'),_0x39d4f8['id']),util[_0x7bc8('0x3b')](_0x4745f7,{'showHidden':![],'depth':null}));}}_0x17801e();});});}function checkTranscribe(){var _0x3c53c3;var _0x163fed;var _0x3ef113;return db['VoiceRecording'][_0x7bc8('0x3c')]({'where':{'transcribeStatus':_0x7bc8('0x3d')}})[_0x7bc8('0xe')](function(_0x3717e8){if(!_0x3717e8||!_0x3717e8['length']){throw new db[(_0x7bc8('0x1c'))][(_0x7bc8('0x23'))](_0x7bc8('0x3e'));}_0x3c53c3=_0x3717e8;return db[_0x7bc8('0x3f')][_0x7bc8('0x27')]({'where':{'id':0x1}});})['then'](function(_0x30d970){if(!_0x30d970){throw new db[(_0x7bc8('0x1c'))][(_0x7bc8('0x23'))](_0x7bc8('0x40'));}_0x163fed=_0x30d970;if(!_0x163fed['transcribe']||!_0x163fed[_0x7bc8('0x41')]||!_0x163fed['transcribeRegion']||!_0x163fed[_0x7bc8('0x21')]||!_0x163fed['bucket']){throw new db['Sequelize'][(_0x7bc8('0x23'))](_0x7bc8('0x42'));}return db['CloudProvider'][_0x7bc8('0x27')]({'where':{'id':_0x163fed['transcribeAccountId']}});})[_0x7bc8('0xe')](function(_0x368351){if(!_0x368351){throw new db['Sequelize'][(_0x7bc8('0x23'))](_0x7bc8('0x35'));}if(!_0x368351[_0x7bc8('0xb')]||!_0x368351['data2']){throw new db[(_0x7bc8('0x1c'))][(_0x7bc8('0x23'))](_0x7bc8('0x28'));}_0x3ef113=_0x368351;var _0x1a5250=[];_0x3c53c3[_0x7bc8('0x43')](function(_0x26f2a8){_0x1a5250['push'](checkTranscribeJob(_0x26f2a8,_0x163fed,_0x3ef113));});return BPromise[_0x7bc8('0x44')](_0x1a5250);})[_0x7bc8('0x36')](function(_0xa2d005){if(_0xa2d005){if(!_0xa2d005[_0x7bc8('0x37')]||_0xa2d005['name']!==_0x7bc8('0x38')){logger[_0x7bc8('0x39')](util['inspect'](_0xa2d005,{'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 5eb249c..d447ac9 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 _0x3f13=['length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','util','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','hours','then'];(function(_0xabd853,_0x2f4184){var _0x2e20e6=function(_0x5857d1){while(--_0x5857d1){_0xabd853['push'](_0xabd853['shift']());}};_0x2e20e6(++_0x2f4184);}(_0x3f13,0x10b));var _0x33f1=function(_0x524a82,_0x5c3862){_0x524a82=_0x524a82-0x0;var _0x24d574=_0x3f13[_0x524a82];return _0x24d574;};'use strict';var _=require(_0x33f1('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0x33f1('0x1'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x33f1('0x2'))(_0x33f1('0x3'));config[_0x33f1('0x4')]=_[_0x33f1('0x5')](config[_0x33f1('0x4')],{'host':_0x33f1('0x6'),'port':0x18eb});var io=require(_0x33f1('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x21d367=[];return db[_0x33f1('0x8')]['findAll']({'raw':!![],'attributes':['id',_0x33f1('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x33f1('0xa')](0x18,_0x33f1('0xb'))}}})[_0x33f1('0xc')](function(_0x43a539){if(_0x43a539&&_0x43a539[_0x33f1('0xd')]){_0x21d367=_[_0x33f1('0xe')](_0x43a539||[],'id');logger[_0x33f1('0xf')](_0x33f1('0x10'),_0x21d367[_0x33f1('0x11')]());return db[_0x33f1('0x8')][_0x33f1('0x12')]({'closeReason':_0x33f1('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x33f1('0x14')](_0x33f1('0x15'))},{'where':{'id':_0x21d367}});}})[_0x33f1('0xc')](function(){if(_0x21d367&&_0x21d367[_0x33f1('0xd')]){logger[_0x33f1('0xf')](_0x33f1('0x16'),_0x21d367['join']());for(var _0x23377c=0x0;_0x23377c<_0x21d367[_0x33f1('0xd')];_0x23377c++){io[_0x33f1('0x17')]('whatsappInteraction:update',{'id':_0x21d367[_0x23377c],'closed':!![]});}}})[_0x33f1('0x18')](function(_0x23dc3a){logger['error'](_0x33f1('0x19'),_0x23dc3a?util[_0x33f1('0x1a')](_0x23dc3a,{'showHidden':![],'depth':null}):'');});}exports[_0x33f1('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x43ea=['[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','hours','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error'];(function(_0x267e70,_0x4f4842){var _0x2e29ea=function(_0x8c02fd){while(--_0x8c02fd){_0x267e70['push'](_0x267e70['shift']());}};_0x2e29ea(++_0x4f4842);}(_0x43ea,0x157));var _0xa43e=function(_0x11abef,_0x30fd75){_0x11abef=_0x11abef-0x0;var _0xb0bf55=_0x43ea[_0x11abef];return _0xb0bf55;};'use strict';var _=require('lodash');var moment=require(_0xa43e('0x0'));var Redis=require(_0xa43e('0x1'));var util=require(_0xa43e('0x2'));var config=require(_0xa43e('0x3'));var db=require(_0xa43e('0x4'))['db'];var logger=require(_0xa43e('0x5'))(_0xa43e('0x6'));config[_0xa43e('0x7')]=_[_0xa43e('0x8')](config[_0xa43e('0x7')],{'host':_0xa43e('0x9'),'port':0x18eb});var io=require(_0xa43e('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x58efb2=[];return db[_0xa43e('0xb')][_0xa43e('0xc')]({'raw':!![],'attributes':['id',_0xa43e('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xa43e('0xe'))}}})['then'](function(_0x315992){if(_0x315992&&_0x315992[_0xa43e('0xf')]){_0x58efb2=_[_0xa43e('0x10')](_0x315992||[],'id');logger['info'](_0xa43e('0x11'),_0x58efb2[_0xa43e('0x12')]());return db['WhatsappInteraction'][_0xa43e('0x13')]({'closeReason':_0xa43e('0x14'),'disposition':_0xa43e('0x15'),'closed':!![],'closedAt':moment()[_0xa43e('0x16')](_0xa43e('0x17'))},{'where':{'id':_0x58efb2}});}})[_0xa43e('0x18')](function(){if(_0x58efb2&&_0x58efb2['length']){logger['info'](_0xa43e('0x19'),_0x58efb2[_0xa43e('0x12')]());for(var _0x193576=0x0;_0x193576<_0x58efb2[_0xa43e('0xf')];_0x193576++){io[_0xa43e('0x1a')]('whatsappInteraction:update',{'id':_0x58efb2[_0x193576],'closed':!![]});}}})[_0xa43e('0x1b')](function(_0x10b646){logger[_0xa43e('0x1c')](_0xa43e('0x1d'),_0x10b646?util[_0xa43e('0x1e')](_0x10b646,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 2885362..ff56c61 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x591a=['Innocenzo','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1','CmContact','catch','util','Biondo','innocenzo.biondo','@xcally.com','push','now'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x591a,0x18a));var _0xa591=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x591a[_0x342700];return _0x53406f;};'use strict';var util=require(_0xa591('0x0'));var db=require('../mysqldb')['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':_0xa591('0x1')+i,'phone':0xf879fb460+i,'email':_0xa591('0x2')+i+_0xa591('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xa591('0x4')]({'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[_0xa591('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xa591('0x4')]({'id':i,'firstName':_0xa591('0x6')+i,'lastName':_0xa591('0x1')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xa591('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xa591('0x4')]({'id':i,'active':![],'scheduledat':Date[_0xa591('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xa591('0x5')](),'updatedAt':Date[_0xa591('0x5')]()});}db['CmContact']['destroy']({'where':{}})[_0xa591('0x7')](function(){return db['CmContact']['bulkCreate'](contacts);})['then'](function(){console[_0xa591('0x8')](_0xa591('0x9'),_0xa591('0xa'));return db['CmHopper']['destroy']({'where':{}});})['then'](function(){return db[_0xa591('0xb')][_0xa591('0xc')](hopper);})[_0xa591('0x7')](function(){console[_0xa591('0x8')](_0xa591('0x9'),_0xa591('0xd'));return db[_0xa591('0xe')][_0xa591('0xc')](contacts2);})[_0xa591('0x7')](function(){console[_0xa591('0x8')]('finished\x20populating','contacts2');return db['CmHopper'][_0xa591('0xc')](hopper2);})[_0xa591('0x7')](function(){console[_0xa591('0x8')](_0xa591('0x9'),'hopper2');})[_0xa591('0xf')](function(_0x25d77b){console[_0xa591('0x8')](_0x25d77b);}); \ No newline at end of file +var _0x7301=['hopper1','contacts2','catch','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','log'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7301,0x135));var _0x1730=function(_0xc05d8d,_0x2d8668){_0xc05d8d=_0xc05d8d-0x0;var _0x58d54=_0x7301[_0xc05d8d];return _0x58d54;};'use strict';var util=require(_0x1730('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x1730('0x1')]({'id':i,'firstName':_0x1730('0x2')+i,'lastName':_0x1730('0x3')+i,'phone':0xf879fb460+i,'email':_0x1730('0x4')+i+_0x1730('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x1730('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x1730('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1730('0x6')](),'updatedAt':Date[_0x1730('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x1730('0x1')]({'id':i,'firstName':_0x1730('0x2')+i,'lastName':_0x1730('0x3')+i,'phone':0xf879fb460+i,'email':_0x1730('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1730('0x6')](),'updatedAt':Date[_0x1730('0x6')]()});}db[_0x1730('0x7')][_0x1730('0x8')]({'where':{}})[_0x1730('0x9')](function(){return db[_0x1730('0x7')][_0x1730('0xa')](contacts);})[_0x1730('0x9')](function(){console['log'](_0x1730('0xb'),_0x1730('0xc'));return db[_0x1730('0xd')]['destroy']({'where':{}});})[_0x1730('0x9')](function(){return db['CmHopper']['bulkCreate'](hopper);})['then'](function(){console[_0x1730('0xe')](_0x1730('0xb'),_0x1730('0xf'));return db[_0x1730('0x7')][_0x1730('0xa')](contacts2);})[_0x1730('0x9')](function(){console[_0x1730('0xe')](_0x1730('0xb'),_0x1730('0x10'));return db[_0x1730('0xd')][_0x1730('0xa')](hopper2);})[_0x1730('0x9')](function(){console[_0x1730('0xe')](_0x1730('0xb'),'hopper2');})[_0x1730('0x11')](function(_0x4a8a1b){console[_0x1730('0xe')](_0x4a8a1b);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 1e28443..708291b 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6802=['ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','add\x20user','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x6802,0xc6));var _0x2680=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x6802[_0x36c5b0];return _0xf19333;};'use strict';var util=require(_0x2680('0x0'));var db=require(_0x2680('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x2680('0x2')]({'name':util[_0x2680('0x3')](_0x2680('0x4'),'agent',i),'fullname':util['format'](_0x2680('0x4'),_0x2680('0x5'),i),'email':util[_0x2680('0x3')](_0x2680('0x6'),_0x2680('0x5'),i),'role':_0x2680('0x5'),'password':_0x2680('0x7'),'internal':0xfa0+i,'type':_0x2680('0x8'),'transport':[_0x2680('0x9'),'ws',_0x2680('0xa')],'disallow':[_0x2680('0xb')],'allow':[_0x2680('0xc')],'defaultuser':util[_0x2680('0x3')]('%s%s',_0x2680('0x5'),i),'encryption':'yes','avpf':_0x2680('0xd'),'force_avp':_0x2680('0xd'),'icesupport':'yes','dtlsenable':_0x2680('0xd'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x2680('0xe'),'dtlssetup':_0x2680('0xf'),'callerid':util[_0x2680('0x3')](_0x2680('0x10'),util['format']('%s%s',_0x2680('0x5'),i),0xfa0+i)});}db[_0x2680('0x11')][_0x2680('0x12')](users)[_0x2680('0x13')](function(){console['log'](_0x2680('0x14'));})['catch'](function(_0x5366a8){console['log'](_0x5366a8);}); \ No newline at end of file +var _0x152e=['agent','format','friend','udp','ulaw','yes','/etc/pki/tls/certs/motion.crt','User','bulkCreate','log','catch','push','%s%s'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x152e,0x136));var _0xe152=function(_0x77a42b,_0x25c9b3){_0x77a42b=_0x77a42b-0x0;var _0x8f2a8a=_0x152e[_0x77a42b];return _0x8f2a8a;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xe152('0x0')]({'name':util['format'](_0xe152('0x1'),'agent',i),'fullname':util['format']('%s%s',_0xe152('0x2'),i),'email':util[_0xe152('0x3')]('%s%s@xcally.com',_0xe152('0x2'),i),'role':_0xe152('0x2'),'password':'password','internal':0xfa0+i,'type':_0xe152('0x4'),'transport':[_0xe152('0x5'),'ws','wss'],'disallow':['all'],'allow':[_0xe152('0x6')],'defaultuser':util[_0xe152('0x3')](_0xe152('0x1'),_0xe152('0x2'),i),'encryption':_0xe152('0x7'),'avpf':_0xe152('0x7'),'force_avp':'yes','icesupport':_0xe152('0x7'),'dtlsenable':_0xe152('0x7'),'dtlsverify':'no','dtlscertfile':_0xe152('0x8'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0xe152('0x3')]('\x22%s\x22\x20<%s>',util['format']('%s%s','agent',i),0xfa0+i)});}db[_0xe152('0x9')][_0xe152('0xa')](users)['then'](function(){console[_0xe152('0xb')]('add\x20user');})[_0xe152('0xc')](function(_0x80c71b){console[_0xe152('0xb')](_0x80c71b);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 1a9fc11..c5ee76f 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x352b=['connectedAt','log','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','./environment','name','role','agent','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','UserProfileResource','resourceId','map','User','Campaign','where','then','format','Agents','length','user:%s','query','find','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','voice:outbound','hasOwnProperty','include','ChatQueue','push','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueue','voice:inbound','getVoiceQueues','getChatQueues','getSmsQueues','getWhatsappQueues','chat','fax','mail','whatsapp','trunk:%s','type','removeChatInteractions','emit','leave','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','SmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','connection','setMaxListeners','address','request','remoteAddress'];(function(_0x5758bf,_0x26722b){var _0x53c797=function(_0x22a6ad){while(--_0x22a6ad){_0x5758bf['push'](_0x5758bf['shift']());}};_0x53c797(++_0x26722b);}(_0x352b,0x1c8));var _0xb352=function(_0x260bae,_0x26e21c){_0x260bae=_0x260bae-0x0;var _0xc31028=_0x352b[_0x260bae];return _0xc31028;};'use strict';var _=require(_0xb352('0x0'));var util=require(_0xb352('0x1'));var BPromise=require('bluebird');var db=require(_0xb352('0x2'))['db'];var config=require(_0xb352('0x3'));var queryQueues={'attributes':['id',_0xb352('0x4')],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0xb352('0x4'),_0xb352('0x5')],'raw':!![],'where':{'role':_0xb352('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xb352('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xb352('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb352('0x4'),'type'],'where':{'type':'ivr'}};function getAssociatedResources(_0x39caad,_0x47c539,_0x49d21f){return db['UserProfileSection']['findOne']({'where':{'name':_0x39caad,'userProfileId':_0x47c539},'raw':!![]})['then'](function(_0x3852ae){if(_0x3852ae){if(_0x3852ae[_0xb352('0x7')]){switch(_0x39caad){case _0xb352('0x8'):case _0xb352('0x9'):case _0xb352('0xa'):case _0xb352('0xb'):case _0xb352('0xc'):case _0xb352('0xd'):case _0xb352('0xe'):return db[_0x49d21f]['findAll'](queryQueues);case _0xb352('0xf'):return db[_0x49d21f][_0xb352('0x10')](queryTelephones);case'Trunks':return db[_0x49d21f][_0xb352('0x10')](queryTrunks);case'IvrCampaigns':return db[_0x49d21f]['findAll'](queryCampaigns);}}else{return db[_0xb352('0x11')][_0xb352('0x10')]({'attributes':[_0xb352('0x12')],'where':{'sectionId':_0x3852ae['id']},'raw':!![]})['then'](function(_0x250675){if(_0x250675){var _0x450c41={'where':{'id':_[_0xb352('0x13')](_0x250675,'resourceId')},'raw':!![]};switch(_0x49d21f){case _0xb352('0x14'):_0x450c41['where'][_0xb352('0x5')]='telephone';break;case _0xb352('0x15'):_0x450c41[_0xb352('0x16')]['type']='ivr';break;}return db[_0x49d21f][_0xb352('0x10')](_0x450c41);}else{return[];}});}}else{return[];}})[_0xb352('0x17')](function(_0x390e36){return _0x390e36;});}function joinOrLeaveQueues(_0x4943a8,_0x26dd78,_0x3b0c20,_0x3c9cf0){_0x4943a8[_0x26dd78](util[_0xb352('0x18')]('%s:queue:%s',_0x3b0c20,_0x3c9cf0[_0xb352('0x4')]));if(_0x3c9cf0[_0xb352('0x19')]){for(var _0x4ef2f9=0x0;_0x4ef2f9<_0x3c9cf0[_0xb352('0x19')][_0xb352('0x1a')];_0x4ef2f9+=0x1){_0x4943a8[_0x26dd78](util['format'](_0xb352('0x1b'),_0x3c9cf0['Agents'][_0x4ef2f9][_0xb352('0x4')]));}}}function joinOrLeave(_0x5914fc,_0x510ca2,_0x4cb924){var _0x3bc72b;if(_0x5914fc['handshake'][_0xb352('0x1c')]['id']){db[_0xb352('0x14')][_0xb352('0x1d')]({'attributes':['id',_0xb352('0x4'),_0xb352('0x5'),_0xb352('0x1e')],'where':{'id':_0x5914fc[_0xb352('0x1f')][_0xb352('0x1c')]['id']},'include':[{'model':db[_0xb352('0x20')],'as':_0xb352('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xb352('0x22')],'as':_0xb352('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xb352('0x24')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb352('0x25')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb352('0x26')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb352('0x27')],'as':_0xb352('0x28'),'attributes':['id'],'raw':!![]}]})[_0xb352('0x17')](function(_0x1db5f7){if(_0x1db5f7){_0x3bc72b=_0x1db5f7;_0x5914fc[_0x510ca2](util['format'](_0xb352('0x1b'),_0x1db5f7[_0xb352('0x4')]));var _0xd608c0=[];switch(_0x1db5f7[_0xb352('0x5')]){case'admin':_0x5914fc[_0x510ca2]('voice:inbound');_0x5914fc[_0x510ca2](_0xb352('0x29'));if(queryQueues[_0xb352('0x2a')](_0xb352('0x2b'))){delete queryQueues['include'];}_0xd608c0['push'](db['VoiceQueue'][_0xb352('0x10')](queryQueues));_0xd608c0['push'](db[_0xb352('0x2c')][_0xb352('0x10')](queryQueues));_0xd608c0[_0xb352('0x2d')](db[_0xb352('0x2e')][_0xb352('0x10')](queryQueues));_0xd608c0[_0xb352('0x2d')](db[_0xb352('0x2f')][_0xb352('0x10')](queryQueues));_0xd608c0[_0xb352('0x2d')](db['MailQueue'][_0xb352('0x10')](queryQueues));_0xd608c0[_0xb352('0x2d')](db[_0xb352('0x30')][_0xb352('0x10')](queryQueues));_0xd608c0[_0xb352('0x2d')](db[_0xb352('0x31')][_0xb352('0x10')](queryQueues));_0xd608c0['push'](db[_0xb352('0x14')][_0xb352('0x10')](queryTelephones));_0xd608c0['push'](db[_0xb352('0x32')][_0xb352('0x10')](queryTrunks));_0xd608c0[_0xb352('0x2d')](db[_0xb352('0x15')]['findAll'](queryCampaigns));_0xd608c0[_0xb352('0x2d')](db[_0xb352('0x14')]['findAll'](queryAgents));break;case _0xb352('0x33'):_0x5914fc[_0x510ca2]('voice:inbound');_0x5914fc[_0x510ca2](_0xb352('0x29'));_0xd608c0[_0xb352('0x2d')](getAssociatedResources(_0xb352('0x8'),_0x1db5f7[_0xb352('0x1e')],_0xb352('0x34')));_0xd608c0[_0xb352('0x2d')](getAssociatedResources(_0xb352('0x9'),_0x1db5f7['userProfileId'],_0xb352('0x2c')));_0xd608c0['push'](getAssociatedResources(_0xb352('0xa'),_0x1db5f7['userProfileId'],'FaxQueue'));_0xd608c0['push'](getAssociatedResources('SmsQueues',_0x1db5f7[_0xb352('0x1e')],_0xb352('0x2f')));_0xd608c0[_0xb352('0x2d')](getAssociatedResources(_0xb352('0xc'),_0x1db5f7['userProfileId'],'MailQueue'));_0xd608c0[_0xb352('0x2d')](getAssociatedResources(_0xb352('0xd'),_0x1db5f7[_0xb352('0x1e')],_0xb352('0x30')));_0xd608c0[_0xb352('0x2d')](getAssociatedResources(_0xb352('0xe'),_0x1db5f7[_0xb352('0x1e')],_0xb352('0x31')));_0xd608c0[_0xb352('0x2d')](getAssociatedResources('Telephones',_0x1db5f7[_0xb352('0x1e')],'User'));_0xd608c0[_0xb352('0x2d')](getAssociatedResources('Trunks',_0x1db5f7[_0xb352('0x1e')],_0xb352('0x32')));_0xd608c0[_0xb352('0x2d')](getAssociatedResources('IvrCampaigns',_0x1db5f7[_0xb352('0x1e')],_0xb352('0x15')));_0xd608c0[_0xb352('0x2d')](db['User']['findAll'](queryAgents));break;case _0xb352('0x6'):_0x5914fc[_0x510ca2](_0xb352('0x35'));_0x5914fc[_0x510ca2](_0xb352('0x29'));_0xd608c0[_0xb352('0x2d')](_0x1db5f7[_0xb352('0x36')]({'attributes':['id',_0xb352('0x4')]}));_0xd608c0[_0xb352('0x2d')](_0x1db5f7[_0xb352('0x37')]({'attributes':['id',_0xb352('0x4')]}));_0xd608c0[_0xb352('0x2d')](_0x1db5f7['getFaxQueues']({'attributes':['id','name']}));_0xd608c0['push'](_0x1db5f7[_0xb352('0x38')]({'attributes':['id',_0xb352('0x4')]}));_0xd608c0[_0xb352('0x2d')](_0x1db5f7['getMailQueues']({'attributes':['id',_0xb352('0x4')]}));_0xd608c0['push'](_0x1db5f7['getOpenchannelQueues']({'attributes':['id',_0xb352('0x4')]}));_0xd608c0['push'](_0x1db5f7[_0xb352('0x39')]({'attributes':['id',_0xb352('0x4')]}));break;}return BPromise['all'](_0xd608c0);}})[_0xb352('0x17')](function(_0x25d99d){if(_0x25d99d&&_0x25d99d['length']){for(var _0x509db5=0x0;_0x509db5<_0x25d99d[_0xb352('0x1a')];_0x509db5+=0x1){for(var _0x48a361=0x0;_0x48a361<_0x25d99d[_0x509db5]['length'];_0x48a361+=0x1){switch(_0x509db5){case 0x0:joinOrLeaveQueues(_0x5914fc,_0x510ca2,'voice',_0x25d99d[_0x509db5][_0x48a361]);break;case 0x1:joinOrLeaveQueues(_0x5914fc,_0x510ca2,_0xb352('0x3a'),_0x25d99d[_0x509db5][_0x48a361]);break;case 0x2:joinOrLeaveQueues(_0x5914fc,_0x510ca2,_0xb352('0x3b'),_0x25d99d[_0x509db5][_0x48a361]);break;case 0x3:joinOrLeaveQueues(_0x5914fc,_0x510ca2,'sms',_0x25d99d[_0x509db5][_0x48a361]);break;case 0x4:joinOrLeaveQueues(_0x5914fc,_0x510ca2,_0xb352('0x3c'),_0x25d99d[_0x509db5][_0x48a361]);break;case 0x5:joinOrLeaveQueues(_0x5914fc,_0x510ca2,'openchannel',_0x25d99d[_0x509db5][_0x48a361]);break;case 0x6:joinOrLeaveQueues(_0x5914fc,_0x510ca2,_0xb352('0x3d'),_0x25d99d[_0x509db5][_0x48a361]);break;case 0x7:if(_0x3bc72b[_0xb352('0x5')]!=='agent')_0x5914fc[_0x510ca2](util['format']('telephone:%s',_0x25d99d[_0x509db5][_0x48a361][_0xb352('0x4')]));break;case 0x8:if(_0x3bc72b[_0xb352('0x5')]!==_0xb352('0x6'))_0x5914fc[_0x510ca2](util[_0xb352('0x18')](_0xb352('0x3e'),_0x25d99d[_0x509db5][_0x48a361]['name']));break;case 0x9:if(_0x3bc72b[_0xb352('0x5')]!==_0xb352('0x6'))_0x5914fc[_0x510ca2](util[_0xb352('0x18')]('campaign:%s:%s',_0x25d99d[_0x509db5][_0x48a361][_0xb352('0x3f')],_0x25d99d[_0x509db5][_0x48a361][_0xb352('0x4')]));break;case 0xa:_0x5914fc[_0x510ca2](util[_0xb352('0x18')]('user:%s',_0x25d99d[_0x509db5][_0x48a361][_0xb352('0x4')]));break;}}}}})[_0xb352('0x17')](function(){if(_0x510ca2==='leave'){var _0x42259a=_[_0xb352('0x13')](_0x3bc72b['ChatInteractions'],'id');return _0x3bc72b[_0xb352('0x40')](_0x42259a)[_0xb352('0x17')](function(){for(var _0x75fb85=0x0;_0x75fb85<_0x42259a[_0xb352('0x1a')];_0x75fb85+=0x1){_0x4cb924[_0xb352('0x41')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x42259a[_0x75fb85]),'UserId':Number(_0x3bc72b['id'])});}});}})[_0xb352('0x17')](function(){if(_0x510ca2===_0xb352('0x42')){var _0x26d811=_[_0xb352('0x13')](_0x3bc72b[_0xb352('0x23')],'id');return _0x3bc72b[_0xb352('0x43')](_0x26d811)[_0xb352('0x17')](function(){for(var _0x2e30a8=0x0;_0x2e30a8<_0x26d811[_0xb352('0x1a')];_0x2e30a8+=0x1){_0x4cb924[_0xb352('0x41')](_0xb352('0x44'),{'MailInteractionId':Number(_0x26d811[_0x2e30a8]),'UserId':Number(_0x3bc72b['id'])});}});}})[_0xb352('0x17')](function(){if(_0x510ca2===_0xb352('0x42')){var _0x232630=_[_0xb352('0x13')](_0x3bc72b[_0xb352('0x45')],'id');return _0x3bc72b[_0xb352('0x46')](_0x232630)['then'](function(){for(var _0x1acd1c=0x0;_0x1acd1c<_0x232630[_0xb352('0x1a')];_0x1acd1c+=0x1){_0x4cb924[_0xb352('0x41')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x232630[_0x1acd1c]),'UserId':Number(_0x3bc72b['id'])});}});}})['then'](function(){if(_0x510ca2==='leave'){var _0x3eaf7f=_[_0xb352('0x13')](_0x3bc72b[_0xb352('0x47')],'id');return _0x3bc72b['removeSmsInteractions'](_0x3eaf7f)['then'](function(){for(var _0x3779ee=0x0;_0x3779ee<_0x3eaf7f[_0xb352('0x1a')];_0x3779ee+=0x1){_0x4cb924['emit'](_0xb352('0x48'),{'SmsInteractionId':Number(_0x3eaf7f[_0x3779ee]),'UserId':Number(_0x3bc72b['id'])});}});}})[_0xb352('0x17')](function(){if(_0x510ca2===_0xb352('0x42')){var _0x48587e=_[_0xb352('0x13')](_0x3bc72b[_0xb352('0x49')],'id');return _0x3bc72b['removeOpenchannelInteractions'](_0x48587e)[_0xb352('0x17')](function(){for(var _0x5387de=0x0;_0x5387de<_0x48587e[_0xb352('0x1a')];_0x5387de+=0x1){_0x4cb924[_0xb352('0x41')](_0xb352('0x4a'),{'OpenchannelInteractionId':Number(_0x48587e[_0x5387de]),'UserId':Number(_0x3bc72b['id'])});}});}})[_0xb352('0x17')](function(){if(_0x510ca2==='leave'){var _0x368b4a=_[_0xb352('0x13')](_0x3bc72b['WhatsappInteractions'],'id');return _0x3bc72b[_0xb352('0x4b')](_0x368b4a)['then'](function(){for(var _0x1e74d9=0x0;_0x1e74d9<_0x368b4a[_0xb352('0x1a')];_0x1e74d9+=0x1){_0x4cb924[_0xb352('0x41')](_0xb352('0x4c'),{'WhatsappInteractionId':Number(_0x368b4a[_0x1e74d9]),'UserId':Number(_0x3bc72b['id'])});}});}})[_0xb352('0x4d')](function(_0x61a76a){_0x5914fc['log'](_0x61a76a);});}}function onDisconnect(_0x2f9d3b,_0x3e8d07){joinOrLeave(_0x2f9d3b,_0xb352('0x42'),_0x3e8d07);}function onConnect(_0x19bd7a){joinOrLeave(_0x19bd7a,_0xb352('0x4e'));}exports['default']=function(_0x36e3bc){_0x36e3bc['on'](_0xb352('0x4f'),function(_0x2d3f4a){_0x2d3f4a[_0xb352('0x50')](0x0);_0x2d3f4a[_0xb352('0x51')]=_0x2d3f4a[_0xb352('0x52')][_0xb352('0x4f')][_0xb352('0x53')]+':'+_0x2d3f4a[_0xb352('0x52')][_0xb352('0x4f')]['remotePort'];_0x2d3f4a[_0xb352('0x54')]=new Date();_0x2d3f4a[_0xb352('0x55')]=function(_0x474949){console['log'](_0xb352('0x56')+_0x2d3f4a[_0xb352('0x57')]['name']+'['+_0x2d3f4a[_0xb352('0x51')]+']',_0x474949);};_0x2d3f4a['on']('disconnect',function(){onDisconnect(_0x2d3f4a,_0x36e3bc);_0x2d3f4a['log'](_0xb352('0x58'));});onConnect(_0x2d3f4a);_0x2d3f4a['log'](_0xb352('0x59'));});}; \ No newline at end of file +var _0xf55c=['removeChatInteractions','leave','MailInteractions','removeMailInteractions','emit','user_has_mail_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','join','connection','setMaxListeners','address','remoteAddress','connectedAt','log','nsp','disconnect','DISCONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents','User','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','role','Campaign','where','%s:queue:%s','length','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','FaxInteractions','SmsInteraction','OpenchannelInteractions','WhatsappInteractions','format','user:%s','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','VoiceQueues','ChatQueue','FaxQueue','SmsQueue','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','sms','mail','telephone:%s','trunk:%s'];(function(_0xffb140,_0xe43dda){var _0x1cc871=function(_0x4abed2){while(--_0x4abed2){_0xffb140['push'](_0xffb140['shift']());}};_0x1cc871(++_0xe43dda);}(_0xf55c,0x1e7));var _0xcf55=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xf55c[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0xcf55('0x0'));var util=require('util');var BPromise=require(_0xcf55('0x1'));var db=require(_0xcf55('0x2'))['db'];var config=require(_0xcf55('0x3'));var queryQueues={'attributes':['id',_0xcf55('0x4')],'include':[{'as':_0xcf55('0x5'),'model':db[_0xcf55('0x6')],'attributes':['id',_0xcf55('0x4'),'role'],'raw':!![],'where':{'role':_0xcf55('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xcf55('0x4')],'where':{'role':_0xcf55('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xcf55('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xcf55('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xcf55('0x4'),_0xcf55('0x9')],'where':{'type':_0xcf55('0xa')}};function getAssociatedResources(_0x576566,_0x428f2,_0x3ce5d2){return db[_0xcf55('0xb')][_0xcf55('0xc')]({'where':{'name':_0x576566,'userProfileId':_0x428f2},'raw':!![]})[_0xcf55('0xd')](function(_0x1d8ffc){if(_0x1d8ffc){if(_0x1d8ffc[_0xcf55('0xe')]){switch(_0x576566){case'VoiceQueues':case _0xcf55('0xf'):case _0xcf55('0x10'):case'SmsQueues':case'MailQueues':case _0xcf55('0x11'):case _0xcf55('0x12'):return db[_0x3ce5d2][_0xcf55('0x13')](queryQueues);case _0xcf55('0x14'):return db[_0x3ce5d2][_0xcf55('0x13')](queryTelephones);case _0xcf55('0x15'):return db[_0x3ce5d2][_0xcf55('0x13')](queryTrunks);case _0xcf55('0x16'):return db[_0x3ce5d2][_0xcf55('0x13')](queryCampaigns);}}else{return db[_0xcf55('0x17')][_0xcf55('0x13')]({'attributes':[_0xcf55('0x18')],'where':{'sectionId':_0x1d8ffc['id']},'raw':!![]})['then'](function(_0x410f47){if(_0x410f47){var _0xfba091={'where':{'id':_[_0xcf55('0x19')](_0x410f47,_0xcf55('0x18'))},'raw':!![]};switch(_0x3ce5d2){case _0xcf55('0x6'):_0xfba091['where'][_0xcf55('0x1a')]=_0xcf55('0x8');break;case _0xcf55('0x1b'):_0xfba091[_0xcf55('0x1c')][_0xcf55('0x9')]='ivr';break;}return db[_0x3ce5d2][_0xcf55('0x13')](_0xfba091);}else{return[];}});}}else{return[];}})['then'](function(_0x64f5b3){return _0x64f5b3;});}function joinOrLeaveQueues(_0x1511ba,_0x168bc7,_0x5ca906,_0x5b7612){_0x1511ba[_0x168bc7](util['format'](_0xcf55('0x1d'),_0x5ca906,_0x5b7612[_0xcf55('0x4')]));if(_0x5b7612[_0xcf55('0x5')]){for(var _0x5df9e9=0x0;_0x5df9e9<_0x5b7612[_0xcf55('0x5')][_0xcf55('0x1e')];_0x5df9e9+=0x1){_0x1511ba[_0x168bc7](util['format']('user:%s',_0x5b7612[_0xcf55('0x5')][_0x5df9e9][_0xcf55('0x4')]));}}}function joinOrLeave(_0x5de5af,_0x1891d1,_0x6dbf56){var _0x1bb5cf;if(_0x5de5af[_0xcf55('0x1f')][_0xcf55('0x20')]['id']){db[_0xcf55('0x6')][_0xcf55('0x21')]({'attributes':['id',_0xcf55('0x4'),'role',_0xcf55('0x22')],'where':{'id':_0x5de5af['handshake'][_0xcf55('0x20')]['id']},'include':[{'model':db[_0xcf55('0x23')],'as':_0xcf55('0x24'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xcf55('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xcf55('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xcf55('0x27'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xcf55('0x28'),'attributes':['id'],'raw':!![]}]})[_0xcf55('0xd')](function(_0x1f9ed9){if(_0x1f9ed9){_0x1bb5cf=_0x1f9ed9;_0x5de5af[_0x1891d1](util[_0xcf55('0x29')](_0xcf55('0x2a'),_0x1f9ed9[_0xcf55('0x4')]));var _0x3cf082=[];switch(_0x1f9ed9['role']){case _0xcf55('0x2b'):_0x5de5af[_0x1891d1]('voice:inbound');_0x5de5af[_0x1891d1](_0xcf55('0x2c'));if(queryQueues[_0xcf55('0x2d')](_0xcf55('0x2e'))){delete queryQueues['include'];}_0x3cf082[_0xcf55('0x2f')](db[_0xcf55('0x30')][_0xcf55('0x13')](queryQueues));_0x3cf082[_0xcf55('0x2f')](db['ChatQueue'][_0xcf55('0x13')](queryQueues));_0x3cf082['push'](db['FaxQueue']['findAll'](queryQueues));_0x3cf082[_0xcf55('0x2f')](db['SmsQueue']['findAll'](queryQueues));_0x3cf082[_0xcf55('0x2f')](db[_0xcf55('0x31')]['findAll'](queryQueues));_0x3cf082[_0xcf55('0x2f')](db[_0xcf55('0x32')]['findAll'](queryQueues));_0x3cf082['push'](db[_0xcf55('0x33')][_0xcf55('0x13')](queryQueues));_0x3cf082[_0xcf55('0x2f')](db[_0xcf55('0x6')]['findAll'](queryTelephones));_0x3cf082[_0xcf55('0x2f')](db[_0xcf55('0x34')][_0xcf55('0x13')](queryTrunks));_0x3cf082[_0xcf55('0x2f')](db[_0xcf55('0x1b')][_0xcf55('0x13')](queryCampaigns));_0x3cf082['push'](db[_0xcf55('0x6')][_0xcf55('0x13')](queryAgents));break;case _0xcf55('0x35'):_0x5de5af[_0x1891d1](_0xcf55('0x36'));_0x5de5af[_0x1891d1]('voice:outbound');_0x3cf082[_0xcf55('0x2f')](getAssociatedResources(_0xcf55('0x37'),_0x1f9ed9['userProfileId'],_0xcf55('0x30')));_0x3cf082[_0xcf55('0x2f')](getAssociatedResources(_0xcf55('0xf'),_0x1f9ed9[_0xcf55('0x22')],_0xcf55('0x38')));_0x3cf082[_0xcf55('0x2f')](getAssociatedResources(_0xcf55('0x10'),_0x1f9ed9[_0xcf55('0x22')],_0xcf55('0x39')));_0x3cf082[_0xcf55('0x2f')](getAssociatedResources('SmsQueues',_0x1f9ed9[_0xcf55('0x22')],_0xcf55('0x3a')));_0x3cf082[_0xcf55('0x2f')](getAssociatedResources('MailQueues',_0x1f9ed9['userProfileId'],_0xcf55('0x31')));_0x3cf082[_0xcf55('0x2f')](getAssociatedResources(_0xcf55('0x11'),_0x1f9ed9['userProfileId'],_0xcf55('0x32')));_0x3cf082['push'](getAssociatedResources('WhatsappQueues',_0x1f9ed9[_0xcf55('0x22')],_0xcf55('0x33')));_0x3cf082['push'](getAssociatedResources(_0xcf55('0x14'),_0x1f9ed9[_0xcf55('0x22')],'User'));_0x3cf082['push'](getAssociatedResources(_0xcf55('0x15'),_0x1f9ed9[_0xcf55('0x22')],'Trunk'));_0x3cf082[_0xcf55('0x2f')](getAssociatedResources(_0xcf55('0x16'),_0x1f9ed9[_0xcf55('0x22')],_0xcf55('0x1b')));_0x3cf082[_0xcf55('0x2f')](db['User'][_0xcf55('0x13')](queryAgents));break;case'agent':_0x5de5af[_0x1891d1](_0xcf55('0x36'));_0x5de5af[_0x1891d1](_0xcf55('0x2c'));_0x3cf082[_0xcf55('0x2f')](_0x1f9ed9[_0xcf55('0x3b')]({'attributes':['id','name']}));_0x3cf082['push'](_0x1f9ed9[_0xcf55('0x3c')]({'attributes':['id',_0xcf55('0x4')]}));_0x3cf082[_0xcf55('0x2f')](_0x1f9ed9[_0xcf55('0x3d')]({'attributes':['id','name']}));_0x3cf082[_0xcf55('0x2f')](_0x1f9ed9['getSmsQueues']({'attributes':['id','name']}));_0x3cf082[_0xcf55('0x2f')](_0x1f9ed9[_0xcf55('0x3e')]({'attributes':['id',_0xcf55('0x4')]}));_0x3cf082[_0xcf55('0x2f')](_0x1f9ed9[_0xcf55('0x3f')]({'attributes':['id',_0xcf55('0x4')]}));_0x3cf082[_0xcf55('0x2f')](_0x1f9ed9['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0xcf55('0x40')](_0x3cf082);}})[_0xcf55('0xd')](function(_0x4fcf4a){if(_0x4fcf4a&&_0x4fcf4a[_0xcf55('0x1e')]){for(var _0x351dc8=0x0;_0x351dc8<_0x4fcf4a[_0xcf55('0x1e')];_0x351dc8+=0x1){for(var _0x5f209e=0x0;_0x5f209e<_0x4fcf4a[_0x351dc8][_0xcf55('0x1e')];_0x5f209e+=0x1){switch(_0x351dc8){case 0x0:joinOrLeaveQueues(_0x5de5af,_0x1891d1,_0xcf55('0x41'),_0x4fcf4a[_0x351dc8][_0x5f209e]);break;case 0x1:joinOrLeaveQueues(_0x5de5af,_0x1891d1,_0xcf55('0x42'),_0x4fcf4a[_0x351dc8][_0x5f209e]);break;case 0x2:joinOrLeaveQueues(_0x5de5af,_0x1891d1,'fax',_0x4fcf4a[_0x351dc8][_0x5f209e]);break;case 0x3:joinOrLeaveQueues(_0x5de5af,_0x1891d1,_0xcf55('0x43'),_0x4fcf4a[_0x351dc8][_0x5f209e]);break;case 0x4:joinOrLeaveQueues(_0x5de5af,_0x1891d1,_0xcf55('0x44'),_0x4fcf4a[_0x351dc8][_0x5f209e]);break;case 0x5:joinOrLeaveQueues(_0x5de5af,_0x1891d1,'openchannel',_0x4fcf4a[_0x351dc8][_0x5f209e]);break;case 0x6:joinOrLeaveQueues(_0x5de5af,_0x1891d1,'whatsapp',_0x4fcf4a[_0x351dc8][_0x5f209e]);break;case 0x7:if(_0x1bb5cf[_0xcf55('0x1a')]!==_0xcf55('0x7'))_0x5de5af[_0x1891d1](util[_0xcf55('0x29')](_0xcf55('0x45'),_0x4fcf4a[_0x351dc8][_0x5f209e][_0xcf55('0x4')]));break;case 0x8:if(_0x1bb5cf['role']!==_0xcf55('0x7'))_0x5de5af[_0x1891d1](util[_0xcf55('0x29')](_0xcf55('0x46'),_0x4fcf4a[_0x351dc8][_0x5f209e][_0xcf55('0x4')]));break;case 0x9:if(_0x1bb5cf[_0xcf55('0x1a')]!=='agent')_0x5de5af[_0x1891d1](util[_0xcf55('0x29')]('campaign:%s:%s',_0x4fcf4a[_0x351dc8][_0x5f209e]['type'],_0x4fcf4a[_0x351dc8][_0x5f209e][_0xcf55('0x4')]));break;case 0xa:_0x5de5af[_0x1891d1](util[_0xcf55('0x29')](_0xcf55('0x2a'),_0x4fcf4a[_0x351dc8][_0x5f209e][_0xcf55('0x4')]));break;}}}}})[_0xcf55('0xd')](function(){if(_0x1891d1==='leave'){var _0x1039eb=_[_0xcf55('0x19')](_0x1bb5cf[_0xcf55('0x24')],'id');return _0x1bb5cf[_0xcf55('0x47')](_0x1039eb)['then'](function(){for(var _0x18dd33=0x0;_0x18dd33<_0x1039eb[_0xcf55('0x1e')];_0x18dd33+=0x1){_0x6dbf56['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x1039eb[_0x18dd33]),'UserId':Number(_0x1bb5cf['id'])});}});}})['then'](function(){if(_0x1891d1===_0xcf55('0x48')){var _0x209998=_[_0xcf55('0x19')](_0x1bb5cf[_0xcf55('0x49')],'id');return _0x1bb5cf[_0xcf55('0x4a')](_0x209998)[_0xcf55('0xd')](function(){for(var _0x3c0404=0x0;_0x3c0404<_0x209998[_0xcf55('0x1e')];_0x3c0404+=0x1){_0x6dbf56[_0xcf55('0x4b')](_0xcf55('0x4c'),{'MailInteractionId':Number(_0x209998[_0x3c0404]),'UserId':Number(_0x1bb5cf['id'])});}});}})[_0xcf55('0xd')](function(){if(_0x1891d1===_0xcf55('0x48')){var _0x17ee25=_['map'](_0x1bb5cf[_0xcf55('0x25')],'id');return _0x1bb5cf['removeFaxInteractions'](_0x17ee25)[_0xcf55('0xd')](function(){for(var _0x1f73ca=0x0;_0x1f73ca<_0x17ee25[_0xcf55('0x1e')];_0x1f73ca+=0x1){_0x6dbf56[_0xcf55('0x4b')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x17ee25[_0x1f73ca]),'UserId':Number(_0x1bb5cf['id'])});}});}})[_0xcf55('0xd')](function(){if(_0x1891d1==='leave'){var _0xb765fd=_['map'](_0x1bb5cf[_0xcf55('0x4d')],'id');return _0x1bb5cf[_0xcf55('0x4e')](_0xb765fd)[_0xcf55('0xd')](function(){for(var _0x2a1c1a=0x0;_0x2a1c1a<_0xb765fd[_0xcf55('0x1e')];_0x2a1c1a+=0x1){_0x6dbf56[_0xcf55('0x4b')](_0xcf55('0x4f'),{'SmsInteractionId':Number(_0xb765fd[_0x2a1c1a]),'UserId':Number(_0x1bb5cf['id'])});}});}})[_0xcf55('0xd')](function(){if(_0x1891d1===_0xcf55('0x48')){var _0x44a08d=_[_0xcf55('0x19')](_0x1bb5cf[_0xcf55('0x27')],'id');return _0x1bb5cf[_0xcf55('0x50')](_0x44a08d)['then'](function(){for(var _0x3eed38=0x0;_0x3eed38<_0x44a08d[_0xcf55('0x1e')];_0x3eed38+=0x1){_0x6dbf56[_0xcf55('0x4b')](_0xcf55('0x51'),{'OpenchannelInteractionId':Number(_0x44a08d[_0x3eed38]),'UserId':Number(_0x1bb5cf['id'])});}});}})[_0xcf55('0xd')](function(){if(_0x1891d1===_0xcf55('0x48')){var _0x580b57=_[_0xcf55('0x19')](_0x1bb5cf['WhatsappInteractions'],'id');return _0x1bb5cf['removeWhatsappInteractions'](_0x580b57)[_0xcf55('0xd')](function(){for(var _0x6ca65b=0x0;_0x6ca65b<_0x580b57[_0xcf55('0x1e')];_0x6ca65b+=0x1){_0x6dbf56['emit'](_0xcf55('0x52'),{'WhatsappInteractionId':Number(_0x580b57[_0x6ca65b]),'UserId':Number(_0x1bb5cf['id'])});}});}})['catch'](function(_0x50f0e8){_0x5de5af['log'](_0x50f0e8);});}}function onDisconnect(_0x1a705f,_0x18ba1e){joinOrLeave(_0x1a705f,_0xcf55('0x48'),_0x18ba1e);}function onConnect(_0x13ad88){joinOrLeave(_0x13ad88,_0xcf55('0x53'));}exports['default']=function(_0x367808){_0x367808['on'](_0xcf55('0x54'),function(_0x5e3b9e){_0x5e3b9e[_0xcf55('0x55')](0x0);_0x5e3b9e[_0xcf55('0x56')]=_0x5e3b9e['request'][_0xcf55('0x54')][_0xcf55('0x57')]+':'+_0x5e3b9e['request'][_0xcf55('0x54')]['remotePort'];_0x5e3b9e[_0xcf55('0x58')]=new Date();_0x5e3b9e[_0xcf55('0x59')]=function(_0x5c0909){console[_0xcf55('0x59')]('SocketIO\x20'+_0x5e3b9e[_0xcf55('0x5a')][_0xcf55('0x4')]+'['+_0x5e3b9e[_0xcf55('0x56')]+']',_0x5c0909);};_0x5e3b9e['on'](_0xcf55('0x5b'),function(){onDisconnect(_0x5e3b9e,_0x367808);_0x5e3b9e[_0xcf55('0x59')](_0xcf55('0x5c'));});onConnect(_0x5e3b9e);_0x5e3b9e['log']('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 7ce16f2..709ca4c 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 _0x5d7f=['find','fullname','email','internal','default','length','hasOwnProperty','model','hook','callback','toLowerCase','util','../../mysqldb','jayson/promise','triggers','http','Chat','afterCreate','newinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','afterUpdate','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','event','direction','resolve','ContactId','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','SELECT','contact','UserId','undefined','interface','format','SIP/%s','name','agent','channel','incomingmessage','outgoingmessage','AfterCreateMessage','get','motionChannel','offlineMessage','opened','QueryTypes','AfterCreate','changed','closed','substatus','AfterUpdate','User'];(function(_0x1d4b1f,_0xd906a0){var _0x5e3c1a=function(_0x30c3be){while(--_0x30c3be){_0x1d4b1f['push'](_0x1d4b1f['shift']());}};_0x5e3c1a(++_0xd906a0);}(_0x5d7f,0x191));var _0xf5d7=function(_0x1bb735,_0xf066e9){_0x1bb735=_0x1bb735-0x0;var _0x3f1d92=_0x5d7f[_0x1bb735];return _0x3f1d92;};'use strict';var util=require(_0xf5d7('0x0'));var db=require(_0xf5d7('0x1'))['db'];var jayson=require(_0xf5d7('0x2'));var logger=require('../logger')(_0xf5d7('0x3'));var client=jayson['client'][_0xf5d7('0x4')]({'port':0x232a});var triggers=[{'channel':_0xf5d7('0x5'),'model':'ChatInteraction','event':_0xf5d7('0x6'),'condition':_0xf5d7('0x7'),'callback':afterCreate},{'channel':'Chat','model':'ChatInteraction','event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xf5d7('0x5'),'model':_0xf5d7('0x8'),'event':_0xf5d7('0x6'),'condition':_0xf5d7('0x9'),'callback':afterCreateMessage},{'channel':'Chat','model':_0xf5d7('0xa'),'event':_0xf5d7('0x6'),'condition':_0xf5d7('0x9'),'callback':afterCreateOfflineMessage},{'channel':_0xf5d7('0xb'),'model':_0xf5d7('0xc'),'event':_0xf5d7('0x6'),'condition':_0xf5d7('0x7'),'callback':afterCreate},{'channel':_0xf5d7('0xb'),'model':_0xf5d7('0xc'),'event':_0xf5d7('0xd'),'condition':_0xf5d7('0xe'),'callback':afterUpdate},{'channel':_0xf5d7('0xb'),'model':_0xf5d7('0xf'),'event':_0xf5d7('0x6'),'condition':_0xf5d7('0x9'),'callback':afterCreateMessage},{'channel':_0xf5d7('0x10'),'model':_0xf5d7('0x11'),'event':_0xf5d7('0x6'),'condition':_0xf5d7('0x7'),'callback':afterCreate},{'channel':_0xf5d7('0x10'),'model':_0xf5d7('0x11'),'event':_0xf5d7('0xd'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xf5d7('0x10'),'model':_0xf5d7('0x12'),'event':_0xf5d7('0x6'),'condition':_0xf5d7('0x9'),'callback':afterCreateMessage},{'channel':_0xf5d7('0x13'),'model':_0xf5d7('0x14'),'event':_0xf5d7('0x6'),'condition':_0xf5d7('0x7'),'callback':afterCreate},{'channel':_0xf5d7('0x13'),'model':_0xf5d7('0x14'),'event':'afterUpdate','condition':_0xf5d7('0xe'),'callback':afterUpdate},{'channel':_0xf5d7('0x13'),'model':_0xf5d7('0x15'),'event':'afterCreate','condition':_0xf5d7('0x9'),'callback':afterCreateMessage},{'channel':'Mail','model':'MailInteraction','event':_0xf5d7('0x6'),'condition':_0xf5d7('0x7'),'callback':afterCreate},{'channel':_0xf5d7('0x16'),'model':'MailInteraction','event':_0xf5d7('0xd'),'condition':_0xf5d7('0xe'),'callback':afterUpdate},{'channel':_0xf5d7('0x16'),'model':_0xf5d7('0x17'),'event':_0xf5d7('0x6'),'condition':_0xf5d7('0x9'),'callback':afterCreateMessage},{'channel':_0xf5d7('0x18'),'model':_0xf5d7('0x19'),'event':_0xf5d7('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xf5d7('0x18'),'model':_0xf5d7('0x19'),'event':_0xf5d7('0xd'),'condition':_0xf5d7('0xe'),'callback':afterUpdate},{'channel':_0xf5d7('0x18'),'model':_0xf5d7('0x1a'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage}];function request(_0x46d786){return client[_0xf5d7('0x1b')](_0xf5d7('0x1c'),_0x46d786)[_0xf5d7('0x1d')](function(_0x3c6f8b){logger[_0xf5d7('0x1e')](_0xf5d7('0x1f'),'EventManager',_0x3c6f8b);if(_0x3c6f8b[_0xf5d7('0x20')]){if(_0x3c6f8b[_0xf5d7('0x20')][_0xf5d7('0x21')]===0x1f4){logger['error'](_0xf5d7('0x1f'),_0xf5d7('0x1c'),_0x3c6f8b['error']);}}})[_0xf5d7('0x22')](function(_0x494101){logger[_0xf5d7('0x20')]('Trigger,\x20%s',_0xf5d7('0x1c'),_0x494101);});}function afterCreateMessage(_0x374170){return function(_0x38aa14){_0x38aa14=_0x38aa14['get']({'plain':!![]});_0x38aa14['channel']=_0x374170;_0x38aa14['motionChannel']=_0x374170;_0x38aa14[_0xf5d7('0x23')]=_0x38aa14[_0xf5d7('0x24')];Promise[_0xf5d7('0x25')]()['then'](function(){if(typeof _0x38aa14[_0xf5d7('0x26')]==='undefined')return null;var _0x5ee6dd=_0xf5d7('0x27')+_0x38aa14[_0xf5d7('0x26')];return db[_0xf5d7('0x28')][_0xf5d7('0x29')](_0x5ee6dd,{'type':db[_0xf5d7('0x2a')]['QueryTypes'][_0xf5d7('0x2b')],'raw':!![]});})[_0xf5d7('0x1d')](function(_0x32aa75){if(_0x32aa75){_0x38aa14[_0xf5d7('0x2c')]=_0x32aa75[0x0];}if(typeof _0x38aa14[_0xf5d7('0x2d')]===_0xf5d7('0x2e'))return;return getAgent(_0x38aa14[_0xf5d7('0x2d')]);})[_0xf5d7('0x1d')](function(_0x365560){if(_0x365560){_0x38aa14[_0xf5d7('0x2f')]=util[_0xf5d7('0x30')](_0xf5d7('0x31'),_0x365560[_0xf5d7('0x32')]);_0x38aa14[_0xf5d7('0x33')]=_0x365560;_0x38aa14[_0xf5d7('0x34')]=_0x374170;return request({'event':_0xf5d7('0x35'),'message':_0x38aa14});}else{return request({'event':_0xf5d7('0x36'),'message':_0x38aa14});}})[_0xf5d7('0x22')](function(_0x1b965d){logger[_0xf5d7('0x20')](_0xf5d7('0x1f'),_0xf5d7('0x37'),_0x1b965d);});};}function afterCreateOfflineMessage(_0x53679c){return function(_0x4b7fdd){_0x4b7fdd=_0x4b7fdd[_0xf5d7('0x38')]({'plain':!![]});_0x4b7fdd['channel']=_0x53679c;_0x4b7fdd[_0xf5d7('0x39')]=_0x53679c;_0x4b7fdd[_0xf5d7('0x23')]=_0xf5d7('0x3a');return request({'event':_0x4b7fdd[_0xf5d7('0x23')],'message':_0x4b7fdd});};}function afterCreate(_0x2175fa,_0x26a97b){return function(_0xdc5d74){var _0x1ab58b=_0xdc5d74[_0xf5d7('0x38')]({'plain':!![]});_0x1ab58b[_0xf5d7('0x34')]=_0x2175fa;_0x1ab58b[_0xf5d7('0x39')]=_0x2175fa;_0x1ab58b[_0xf5d7('0x23')]=_0xf5d7('0x3b');Promise[_0xf5d7('0x25')]()[_0xf5d7('0x1d')](function(){var _0x2e4046=_0xf5d7('0x27')+_0x1ab58b[_0xf5d7('0x26')];return db['sequelize']['query'](_0x2e4046,{'type':db[_0xf5d7('0x2a')][_0xf5d7('0x3c')][_0xf5d7('0x2b')],'raw':!![]});})[_0xf5d7('0x1d')](function(_0x16cc69){if(_0x16cc69){_0x1ab58b[_0xf5d7('0x2c')]=_0x16cc69[0x0];}if(_0x1ab58b[_0xf5d7('0x2d')]){return getAgent(_0x1ab58b[_0xf5d7('0x2d')]);}return;})[_0xf5d7('0x1d')](function(_0x40bf4d){if(_0x40bf4d){_0x1ab58b[_0xf5d7('0x2f')]=util['format'](_0xf5d7('0x31'),_0x40bf4d[_0xf5d7('0x32')]);_0x1ab58b['agent']=_0x40bf4d;}return request({'event':_0x26a97b,'message':_0x1ab58b});})[_0xf5d7('0x22')](function(_0x425e48){logger[_0xf5d7('0x20')](_0xf5d7('0x1f'),_0xf5d7('0x3d'),_0x425e48);});};}function afterUpdate(_0x22c9d8){return function(_0x3826b8){var _0x382450=_0x3826b8[_0xf5d7('0x3e')](_0xf5d7('0x3f'))&&_0x3826b8[_0xf5d7('0x3f')];var _0x49161d=_0x3826b8[_0xf5d7('0x3e')](_0xf5d7('0x40'));if(_0x382450||_0x49161d){var _0x540dce=_0x382450?_0xf5d7('0xe'):'substatus';var _0x46aacc=_0x3826b8[_0xf5d7('0x38')]({'plain':!![]});_0x46aacc[_0xf5d7('0x34')]=_0x22c9d8;_0x46aacc[_0xf5d7('0x39')]=_0x22c9d8;_0x46aacc['event']=_0x382450?_0xf5d7('0x3f'):'substatus';var _0x3bebe1=_0xf5d7('0x27')+_0x46aacc['ContactId'];return db[_0xf5d7('0x28')]['query'](_0x3bebe1,{'type':db['Sequelize'][_0xf5d7('0x3c')][_0xf5d7('0x2b')],'raw':!![]})[_0xf5d7('0x1d')](function(_0x344179){if(_0x344179){_0x46aacc[_0xf5d7('0x2c')]=_0x344179[0x0];}if(typeof _0x46aacc[_0xf5d7('0x2d')]==='undefined')return;return getAgent(_0x46aacc[_0xf5d7('0x2d')]);})['then'](function(_0x4c0b71){if(_0x4c0b71){_0x46aacc[_0xf5d7('0x2f')]=util[_0xf5d7('0x30')]('SIP/%s',_0x4c0b71[_0xf5d7('0x32')]);_0x46aacc[_0xf5d7('0x33')]=_0x4c0b71;}return request({'event':_0x540dce,'message':_0x46aacc});})['catch'](function(_0x194688){logger[_0xf5d7('0x20')](_0xf5d7('0x1f'),_0xf5d7('0x41'),_0x194688);});}};}function getAgent(_0x430895){return db[_0xf5d7('0x42')][_0xf5d7('0x43')]({'where':{'id':_0x430895},'attributes':['id',_0xf5d7('0x32'),_0xf5d7('0x44'),_0xf5d7('0x45'),_0xf5d7('0x46')],'raw':!![]})[_0xf5d7('0x1d')](function(_0x358bdd){return _0x358bdd;});}exports[_0xf5d7('0x47')]=function(){for(var _0x5e73fc=0x0;_0x5e73fc=_0x5aca3b[_0x5a27('0x16')]){throw Error(_0x5a27('0x17'));}_0x155de7(_0x4ef2d6);})[_0x5a27('0x18')](function(_0x45519c){_0x2c01b7(_0x45519c);});});}; \ No newline at end of file +var _0x479f=['isValidChannel','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','agent','count','then','agents','catch','bluebird','../mysqldb','./license/util','voice','mail','whatsapp','openchannel'];(function(_0x2543d6,_0x3a5e78){var _0x55213c=function(_0x292768){while(--_0x292768){_0x2543d6['push'](_0x2543d6['shift']());}};_0x55213c(++_0x3a5e78);}(_0x479f,0x1f1));var _0xf479=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x479f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var BPromise=require(_0xf479('0x0'));var db=require(_0xf479('0x1'))['db'];var util=require(_0xf479('0x2'));var channels=[_0xf479('0x3'),_0xf479('0x4'),'chat','fax','sms',_0xf479('0x5'),_0xf479('0x6')];exports['getChannels']=function(){return channels;};exports[_0xf479('0x7')]=function(_0x3f51f4){_0x3f51f4=_0x3f51f4['toLowerCase']();return _['includes'](channels,_0x3f51f4);};exports[_0xf479('0x8')]=function(_0xf14499,_0x11a007,_0x24f3a6,_0x44424c){var _0x456fb0={'loginAttempts':_0x11a007,'blocked':_0x24f3a6};if(!_[_0xf479('0x9')](_0x44424c)){_0x456fb0[_0xf479('0xa')]=_0x44424c;}return _0xf14499[_0xf479('0xb')](_0x456fb0);};exports[_0xf479('0xc')]=function(_0x29d6a2){return new BPromise(function(_0x417fea,_0x1c2024){var _0x490bc7=0x0;if(_0x29d6a2['role']!==_0xf479('0xd')){_0x417fea(_0x29d6a2);}db['User'][_0xf479('0xe')]({'where':{'role':_0xf479('0xd'),'online':!![],'id':{'$ne':_0x29d6a2['id']}}})[_0xf479('0xf')](function(_0x2def07){_0x490bc7=_0x2def07;return util[_0xf479('0xc')]();})[_0xf479('0xf')](function(_0x6e2ad7){if(_0x6e2ad7&&_0x6e2ad7[_0xf479('0x10')]&&_0x490bc7>=_0x6e2ad7[_0xf479('0x10')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x417fea(_0x29d6a2);})[_0xf479('0x11')](function(_0x51d3ac){_0x1c2024(_0x51d3ac);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index f9f73e9..3804e67 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5bba=['api','message','Internal\x20Server\x20Error','name','Error','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','inherits','Message\x20sent\x20outside\x20a\x20valid\x20interval','code','OutOfInterval','Resource\x20Conflict','Conflict','Out\x20Of\x20Interval','error','stack','statusMessage','status','send','util','../config/logger'];(function(_0x1300ea,_0x40f9fa){var _0x416a32=function(_0x468cca){while(--_0x468cca){_0x1300ea['push'](_0x1300ea['shift']());}};_0x416a32(++_0x40f9fa);}(_0x5bba,0x71));var _0xa5bb=function(_0x177639,_0x5a4375){_0x177639=_0x177639-0x0;var _0x5b6800=_0x5bba[_0x177639];return _0x5b6800;};'use strict';var util=require(_0xa5bb('0x0'));var logger=require(_0xa5bb('0x1'))(_0xa5bb('0x2'));var APIError=function(_0x2f5982,_0x36b1e4){this[_0xa5bb('0x3')]=_0x2f5982||_0xa5bb('0x4');this[_0xa5bb('0x5')]=_0x36b1e4||_0xa5bb('0x6');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x49665d){this[_0xa5bb('0x3')]=_0x49665d||_0xa5bb('0x7');this[_0xa5bb('0x5')]=_0xa5bb('0x7');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x2c928d){this[_0xa5bb('0x3')]=_0x2c928d||_0xa5bb('0x8');this[_0xa5bb('0x5')]=_0xa5bb('0x8');util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0x22b742){this[_0xa5bb('0x3')]=_0x22b742||_0xa5bb('0x9');this[_0xa5bb('0x5')]=_0xa5bb('0xa');util[_0xa5bb('0xb')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0xf732c5){this[_0xa5bb('0x3')]=_0xf732c5||_0xa5bb('0xc');this['name']='Out\x20Of\x20Interval';this[_0xa5bb('0xd')]=0x193;this['details']={'type':_0xa5bb('0xe')};util[_0xa5bb('0xb')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x470dc1){this[_0xa5bb('0x3')]=_0x470dc1||_0xa5bb('0xf');this[_0xa5bb('0x5')]=_0xa5bb('0x10');util[_0xa5bb('0xb')](APIBadRequestError,APIError);};function getStatusCode(_0x365005){switch(_0x365005){case _0xa5bb('0x7'):return 0x190;case'Forbidden',_0xa5bb('0x11'):return 0x193;case'Not\x20Found':return 0x194;case _0xa5bb('0x10'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x21efb1){if(_0x21efb1===_0xa5bb('0x11'))return _0x21efb1;return null;}function handleError(_0x59cc60){return function(_0x95c931){logger[_0xa5bb('0x12')](_0x95c931[_0xa5bb('0x13')]);var _0x449000=getStatusCode(_0x95c931[_0xa5bb('0x5')]);var _0x2ee2f7=getCustomStatusMessage(_0x95c931[_0xa5bb('0x5')]);if(_0x95c931[_0xa5bb('0x5')]){delete _0x95c931[_0xa5bb('0x5')];}if(_0x2ee2f7){_0x59cc60[_0xa5bb('0x14')]=_0x2ee2f7;}return _0x59cc60[_0xa5bb('0x15')](_0x449000)[_0xa5bb('0x16')](_0x95c931);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0xa02c=['name','Error','Bad\x20Request','Forbidden','inherits','Not\x20Found','Out\x20Of\x20Interval','code','details','OutOfInterval','Resource\x20Conflict','Conflict','error','status','send','util','../config/logger','api','message','Internal\x20Server\x20Error'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0xa02c,0x1db));var _0xca02=function(_0x1fe918,_0x458654){_0x1fe918=_0x1fe918-0x0;var _0x12954c=_0xa02c[_0x1fe918];return _0x12954c;};'use strict';var util=require(_0xca02('0x0'));var logger=require(_0xca02('0x1'))(_0xca02('0x2'));var APIError=function(_0x3f32db,_0x5a239c){this[_0xca02('0x3')]=_0x3f32db||_0xca02('0x4');this[_0xca02('0x5')]=_0x5a239c||_0xca02('0x6');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x1c7c59){this['message']=_0x1c7c59||_0xca02('0x7');this['name']='Bad\x20Request';util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x567458){this[_0xca02('0x3')]=_0x567458||_0xca02('0x8');this[_0xca02('0x5')]=_0xca02('0x8');util[_0xca02('0x9')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x13ca1b){this[_0xca02('0x3')]=_0x13ca1b||'Entity\x20not\x20found';this[_0xca02('0x5')]=_0xca02('0xa');util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x34789d){this['message']=_0x34789d||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0xca02('0x5')]=_0xca02('0xb');this[_0xca02('0xc')]=0x193;this[_0xca02('0xd')]={'type':_0xca02('0xe')};util[_0xca02('0x9')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x45ec61){this['message']=_0x45ec61||_0xca02('0xf');this['name']=_0xca02('0x10');util['inherits'](APIBadRequestError,APIError);};function getStatusCode(_0x28674c){switch(_0x28674c){case _0xca02('0x7'):return 0x190;case _0xca02('0x8'),_0xca02('0xb'):return 0x193;case _0xca02('0xa'):return 0x194;case _0xca02('0x10'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x8fffc3){if(_0x8fffc3===_0xca02('0xb'))return _0x8fffc3;return null;}function handleError(_0x4c9c67){return function(_0x3cb986){logger[_0xca02('0x11')](_0x3cb986['stack']);var _0xf5ea19=getStatusCode(_0x3cb986[_0xca02('0x5')]);var _0x4162f1=getCustomStatusMessage(_0x3cb986[_0xca02('0x5')]);if(_0x3cb986['name']){delete _0x3cb986[_0xca02('0x5')];}if(_0x4162f1){_0x4c9c67['statusMessage']=_0x4162f1;}return _0x4c9c67[_0xca02('0x12')](_0xf5ea19)[_0xca02('0x13')](_0x3cb986);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 24e4251..480c169 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60c9=['json','send','exports','404','status','render'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x60c9,0x116));var _0x960c=function(_0x2ea2b9,_0x48f001){_0x2ea2b9=_0x2ea2b9-0x0;var _0xa3e4b0=_0x60c9[_0x2ea2b9];return _0xa3e4b0;};'use strict';module[_0x960c('0x0')][0x194]=function pageNotFound(_0x38569e,_0x19db24){var _0x249a2a=_0x960c('0x1');var _0x198894=0x194;var _0x394079={'status':_0x198894};_0x19db24[_0x960c('0x2')](_0x394079[_0x960c('0x2')]);_0x19db24[_0x960c('0x3')](_0x249a2a,{},function(_0x11d25b,_0x588f0e){if(_0x11d25b){return _0x19db24[_0x960c('0x2')](_0x394079['status'])[_0x960c('0x4')](_0x394079);}_0x19db24[_0x960c('0x5')](_0x588f0e);});}; \ No newline at end of file +var _0x4046=['404','status','json'];(function(_0x51b19b,_0x5015d2){var _0x1a3cd6=function(_0x495134){while(--_0x495134){_0x51b19b['push'](_0x51b19b['shift']());}};_0x1a3cd6(++_0x5015d2);}(_0x4046,0x126));var _0x6404=function(_0x53d5b9,_0x50836d){_0x53d5b9=_0x53d5b9-0x0;var _0x23426b=_0x4046[_0x53d5b9];return _0x23426b;};'use strict';module['exports'][0x194]=function pageNotFound(_0x224071,_0x435baa){var _0x3345a9=_0x6404('0x0');var _0x15ac05=0x194;var _0x4e2695={'status':_0x15ac05};_0x435baa['status'](_0x4e2695['status']);_0x435baa['render'](_0x3345a9,{},function(_0x230d7a,_0x2e4062){if(_0x230d7a){return _0x435baa[_0x6404('0x1')](_0x4e2695[_0x6404('0x1')])[_0x6404('0x2')](_0x4e2695);}_0x435baa['send'](_0x2e4062);});}; \ No newline at end of file diff --git a/server/migrations/2.6.32.js b/server/migrations/2.6.32.js new file mode 100644 index 0000000..a59425a --- /dev/null +++ b/server/migrations/2.6.32.js @@ -0,0 +1,169 @@ +'use strict'; + +var BPromise = require('bluebird'); +var util = require('util'); +var logger = require('../config/logger')('migration'); +var Sequence = function() {}; + +Sequence.prototype.enqueue = function(fn) { + this.tail = this.tail ? this.tail.finally(fn) : fn(); +}; + +var Migration = function(queryInterface) { + this.queryInterface = queryInterface; + this.sequence = new Sequence(); +}; + +Migration.prototype.changeColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .changeColumn(table, column, type) + .then(function() { + logger.info('Changed column %s in table %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addColumn(table, column, type) + .then(function() { + logger.info('Added column %s to %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.dropTable = function(table) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .dropTable(table, { + force: true, + }) + .then(function() { + logger.info('table dropped %s', table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addIndex = function(table, column, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addIndex(table, column, { + indexName: indexName, + }) + .then(function() { + logger.info('addIndex %s %s %s', table, column.join(','), indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeIndex = function(table, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeIndex(table, indexName) + .then(function() { + logger.info('removeIndex %s %s', table, indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.query = function(sql) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface.sequelize + .query(sql) + .then(function() { + logger.info('query %s', sql); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeColumn = function(table, column) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeColumn(table, column) + .then(function() { + logger.info('Removed column %s from %s', column, table); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null, + }) + ); + }); + }); +}; + +Migration.prototype.renameColumn = function(table, oldColumn, newColumn) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .renameColumn(table, oldColumn, newColumn) + .then(function() { + logger.info( + 'Renamed column from %s to %s on %s', + oldColumn, + newColumn, + table + ); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null, + }) + ); + }); + }); +}; + +Migration.prototype.final = function(resolve) { + this.sequence.enqueue(function() { + return resolve(); + }); +}; + +module.exports = { + up: function(queryInterface /*, Sequelize */) { + return new BPromise(function(resolve) { + var migration = new Migration(queryInterface); + // Add your migration code here + + // START FINAL + migration.final(resolve); + // END FINAL + }); + }, + + down: function( /* queryInterface, Sequelize */ ) { + // var migration = new Migration(queryInterface); + }, +}; \ No newline at end of file diff --git a/server/migrations/2.6.33.js b/server/migrations/2.6.33.js new file mode 100644 index 0000000..a59425a --- /dev/null +++ b/server/migrations/2.6.33.js @@ -0,0 +1,169 @@ +'use strict'; + +var BPromise = require('bluebird'); +var util = require('util'); +var logger = require('../config/logger')('migration'); +var Sequence = function() {}; + +Sequence.prototype.enqueue = function(fn) { + this.tail = this.tail ? this.tail.finally(fn) : fn(); +}; + +var Migration = function(queryInterface) { + this.queryInterface = queryInterface; + this.sequence = new Sequence(); +}; + +Migration.prototype.changeColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .changeColumn(table, column, type) + .then(function() { + logger.info('Changed column %s in table %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addColumn(table, column, type) + .then(function() { + logger.info('Added column %s to %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.dropTable = function(table) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .dropTable(table, { + force: true, + }) + .then(function() { + logger.info('table dropped %s', table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addIndex = function(table, column, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addIndex(table, column, { + indexName: indexName, + }) + .then(function() { + logger.info('addIndex %s %s %s', table, column.join(','), indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeIndex = function(table, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeIndex(table, indexName) + .then(function() { + logger.info('removeIndex %s %s', table, indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.query = function(sql) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface.sequelize + .query(sql) + .then(function() { + logger.info('query %s', sql); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeColumn = function(table, column) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeColumn(table, column) + .then(function() { + logger.info('Removed column %s from %s', column, table); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null, + }) + ); + }); + }); +}; + +Migration.prototype.renameColumn = function(table, oldColumn, newColumn) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .renameColumn(table, oldColumn, newColumn) + .then(function() { + logger.info( + 'Renamed column from %s to %s on %s', + oldColumn, + newColumn, + table + ); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null, + }) + ); + }); + }); +}; + +Migration.prototype.final = function(resolve) { + this.sequence.enqueue(function() { + return resolve(); + }); +}; + +module.exports = { + up: function(queryInterface /*, Sequelize */) { + return new BPromise(function(resolve) { + var migration = new Migration(queryInterface); + // Add your migration code here + + // START FINAL + migration.final(resolve); + // END FINAL + }); + }, + + down: function( /* queryInterface, Sequelize */ ) { + // var migration = new Migration(queryInterface); + }, +}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 9b789c9..cadd386 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb30e=['../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','UserId','userSetting','VoiceRecording','Recordings','VoiceQueuesRt','hasMany','HopperFinals','CmHopperHistory','HopperHistory','ChatInteractions','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','Hoppers','SET\x20NULL','belongsTo','userProfileId','Groups','Contacts','cm_user_has_contacts','belongsToMany','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoicePrefixes','MailQueue','ChatQueues','FaxQueue','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','ChatWebsite','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Applications','Sounds','Members','VoiceQueueId','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','voice_queues_has_cm_blacklists','Messages','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','CloudProviderId','restrict','MailServerOut','MailAccountId','Imap','Smtp','Dispositions','CannedAnswer','Answers','Interactions','List','ListId','TemplateId','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Interaction','ChatWebsiteId','ChatOfflineMessageId','IntervalId','Items','FaxAccountId','Exntensions','TagId','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','ChatApplication','Agent','Website','ChatInteractionId','chat_interaction_has_tags','Attachments','team_has_chat_queues','ChatGroupId','chat_group_has_users','CompanyId','CmContactHasItem','CmContactId','HopperHistories','OpenchannelInteractions','cm_contact_has_tags','CmHopperId','Queue','Campaign','CampaignId','Automation','All','OneAll','Any','OneAny','AutomationAnyId','Actions','ParentId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','AnalyticCustomReport','CustomReportId','VoiceMusicOnHold','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','SalesforceAccount','SalesforceConfiguration','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Subject','Description','Field','Variable','VariableId','DeskAccount','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskAccount','FromId','ToId','SessionId','ProjectId','VoiceQueues','team_has_mail_queues','MailQueues','team_has_sms_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromAccount','FromUserId','FromAgent','ToUserId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','WhatsappAccountId','WhatsappMessage','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','sequelize','lodash','jstz','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8_general_ci','sequelizeHistory','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','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','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/automation/automation.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr'];(function(_0x2507c2,_0xa71755){var _0x3f06ee=function(_0xfa55a4){while(--_0xfa55a4){_0x2507c2['push'](_0x2507c2['shift']());}};_0x3f06ee(++_0xa71755);}(_0xb30e,0x17d));var _0xeb30=function(_0x1ad0b1,_0x1fb76e){_0x1ad0b1=_0x1ad0b1-0x0;var _0x32811c=_0xb30e[_0x1ad0b1];return _0x32811c;};'use strict';var config=require('../config/environment');var Sequelize=require(_0xeb30('0x0'));var _=require(_0xeb30('0x1'));var jstz=require(_0xeb30('0x2'));var timezone=jstz['determine']();config[_0xeb30('0x0')]=_['defaultsDeep'](config[_0xeb30('0x0')],{'database':_0xeb30('0x3'),'username':_0xeb30('0x4'),'password':_0xeb30('0x5'),'options':{'host':_0xeb30('0x6'),'port':0xcea,'dialect':_0xeb30('0x7'),'dialectOptions':{'charset':_0xeb30('0x8')},'logging':![],'timezone':timezone[_0xeb30('0x9')](),'define':{'charset':'utf8','collate':_0xeb30('0xa')}}});config[_0xeb30('0xb')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0xeb30('0x3'),'username':_0xeb30('0x4'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xeb30('0x7'),'dialectOptions':{'charset':_0xeb30('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0xeb30('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xeb30('0xc')],config['sequelize'][_0xeb30('0xd')],config[_0xeb30('0x0')][_0xeb30('0xe')],config[_0xeb30('0x0')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xeb30('0xb')][_0xeb30('0xc')],config[_0xeb30('0xb')]['username'],config[_0xeb30('0xb')][_0xeb30('0xe')],config['sequelizeHistory'][_0xeb30('0xf')])};db[_0xeb30('0x10')]=db['sequelize'][_0xeb30('0x11')](_0xeb30('0x12'));db[_0xeb30('0x13')]=db[_0xeb30('0x0')]['import'](_0xeb30('0x14'));db[_0xeb30('0x15')]=db[_0xeb30('0x0')]['import'](_0xeb30('0x16'));db[_0xeb30('0x17')]=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db['sequelize'][_0xeb30('0x11')](_0xeb30('0x18'));db[_0xeb30('0x19')]=db['sequelize'][_0xeb30('0x11')](_0xeb30('0x1a'));db['VoiceRecording']=db['sequelize'][_0xeb30('0x11')]('../api/voiceRecording/voiceRecording.model');db[_0xeb30('0x1b')]=db['sequelize'][_0xeb30('0x11')]('../api/screenRecording/screenRecording.model');db[_0xeb30('0x1c')]=db[_0xeb30('0x0')]['import'](_0xeb30('0x1d'));db[_0xeb30('0x1e')]=db['sequelize'][_0xeb30('0x11')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xeb30('0x1f')]=db['sequelize'][_0xeb30('0x11')](_0xeb30('0x20'));db[_0xeb30('0x21')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x22'));db[_0xeb30('0x23')]=db[_0xeb30('0x0')]['import'](_0xeb30('0x24'));db[_0xeb30('0x25')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x26'));db[_0xeb30('0x27')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x28'));db['Trunk']=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x29'));db[_0xeb30('0x2a')]=db['sequelize'][_0xeb30('0x11')](_0xeb30('0x2b'));db[_0xeb30('0x2c')]=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xeb30('0x2d')]=db['sequelize'][_0xeb30('0x11')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xeb30('0x2e')]=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/userChatQueue/userChatQueue.model');db[_0xeb30('0x2f')]=db['sequelize'][_0xeb30('0x11')](_0xeb30('0x30'));db['UserFaxQueue']=db['sequelize'][_0xeb30('0x11')](_0xeb30('0x31'));db[_0xeb30('0x32')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x33'));db[_0xeb30('0x34')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x35'));db[_0xeb30('0x36')]=db['sequelize'][_0xeb30('0x11')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xeb30('0x37')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x38'));db['MailServerOut']=db['sequelize'][_0xeb30('0x11')](_0xeb30('0x39'));db[_0xeb30('0x3a')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x3b'));db['MailQueue']=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x3c'));db[_0xeb30('0x3d')]=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/mailInteraction/mailInteraction.model');db[_0xeb30('0x3e')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x3f'));db[_0xeb30('0x40')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x41'));db[_0xeb30('0x42')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x43'));db[_0xeb30('0x44')]=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/dashboard/dashboard.model');db['DashboardItem']=db['sequelize'][_0xeb30('0x11')]('../api/dashboardItem/dashboardItem.model');db[_0xeb30('0x45')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x46'));db[_0xeb30('0x47')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x48'));db[_0xeb30('0x49')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x4a'));db[_0xeb30('0x4b')]=db['sequelize'][_0xeb30('0x11')](_0xeb30('0x4c'));db['FaxQueue']=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/faxQueue/faxQueue.model');db[_0xeb30('0x4d')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x4e'));db[_0xeb30('0x4f')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x50'));db[_0xeb30('0x51')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x52'));db[_0xeb30('0x53')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x54'));db[_0xeb30('0x55')]=db['sequelize'][_0xeb30('0x11')](_0xeb30('0x56'));db[_0xeb30('0x57')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x58'));db['OpenchannelAccount']=db['sequelize'][_0xeb30('0x11')](_0xeb30('0x59'));db[_0xeb30('0x5a')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x5b'));db[_0xeb30('0x5c')]=db['sequelize'][_0xeb30('0x11')](_0xeb30('0x5d'));db[_0xeb30('0x5e')]=db['sequelize']['import']('../api/openchannelMessage/openchannelMessage.model');db[_0xeb30('0x5f')]=db[_0xeb30('0x0')]['import'](_0xeb30('0x60'));db['ChatWebsite']=db['sequelize'][_0xeb30('0x11')](_0xeb30('0x61'));db[_0xeb30('0x62')]=db['sequelize']['import'](_0xeb30('0x63'));db['ChatApplication']=db[_0xeb30('0x0')]['import'](_0xeb30('0x64'));db[_0xeb30('0x65')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x66'));db[_0xeb30('0x67')]=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/chatMessage/chatMessage.model');db[_0xeb30('0x68')]=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xeb30('0x69')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x6a'));db[_0xeb30('0x6b')]=db[_0xeb30('0x0')]['import'](_0xeb30('0x6c'));db[_0xeb30('0x6d')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x6e'));db[_0xeb30('0x6f')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x70'));db[_0xeb30('0x71')]=db[_0xeb30('0x0')]['import'](_0xeb30('0x72'));db[_0xeb30('0x73')]=db['sequelize'][_0xeb30('0x11')]('../api/cmHopper/cmHopper.model');db[_0xeb30('0x74')]=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0xeb30('0x75')]=db['sequelize']['import'](_0xeb30('0x76'));db['CmHopperHistory']=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x77'));db[_0xeb30('0x78')]=db[_0xeb30('0x0')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db[_0xeb30('0x79')]=db['sequelize'][_0xeb30('0x11')](_0xeb30('0x7a'));db[_0xeb30('0x7b')]=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/action/action.model');db['Automation']=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x7c'));db['CannedAnswer']=db['sequelize'][_0xeb30('0x11')]('../api/cannedAnswer/cannedAnswer.model');db[_0xeb30('0x7d')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x7e'));db[_0xeb30('0x7f')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x80'));db[_0xeb30('0x81')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x82'));db[_0xeb30('0x83')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x84'));db[_0xeb30('0x85')]=db['sequelize']['import'](_0xeb30('0x86'));db['VoiceQueuesLog']=db['sequelize']['import'](_0xeb30('0x87'));db[_0xeb30('0x88')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x89'));db[_0xeb30('0x8a')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x8b'));db[_0xeb30('0x8c')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x8d'));db[_0xeb30('0x8e')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x8f'));db['CmContactHasItem']=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x90'));db[_0xeb30('0x91')]=db['sequelize'][_0xeb30('0x11')](_0xeb30('0x92'));db[_0xeb30('0x93')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x94'));db[_0xeb30('0x95')]=db['sequelize'][_0xeb30('0x11')](_0xeb30('0x96'));db['Variable']=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/variable/variable.model');db[_0xeb30('0x97')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x98'));db[_0xeb30('0x99')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x9a'));db['AnalyticCustomReport']=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x9b'));db[_0xeb30('0x9c')]=db['sequelize'][_0xeb30('0x11')](_0xeb30('0x9d'));db['AnalyticExtractedReport']=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x9e'));db['AnalyticMetric']=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x9f'));db[_0xeb30('0xa0')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xa1'));db[_0xeb30('0xa2')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xa3'));db['SalesforceAccount']=db[_0xeb30('0x0')]['import']('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db[_0xeb30('0x0')]['import'](_0xeb30('0xa4'));db[_0xeb30('0xa5')]=db['sequelize']['import'](_0xeb30('0xa6'));db[_0xeb30('0xa7')]=db[_0xeb30('0x0')]['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xeb30('0xa8')]=db[_0xeb30('0x0')]['import'](_0xeb30('0xa9'));db[_0xeb30('0xaa')]=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/intSugarcrmField/intSugarcrmField.model');db['DeskAccount']=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xab'));db[_0xeb30('0xac')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xad'));db[_0xeb30('0xae')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xaf'));db[_0xeb30('0xb0')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xb1'));db['ZohoConfiguration']=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xb2'));db[_0xeb30('0xb3')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xb4'));db[_0xeb30('0xb5')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xb6'));db[_0xeb30('0xb7')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xb8'));db['ZendeskField']=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0xeb30('0x0')]['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xeb30('0xb9')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xba'));db[_0xeb30('0xbb')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xbc'));db[_0xeb30('0xbd')]=db[_0xeb30('0x0')]['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0xeb30('0xbe')]=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xeb30('0xbf')]=db['sequelize'][_0xeb30('0x11')](_0xeb30('0xc0'));db[_0xeb30('0xc1')]=db['sequelize']['import'](_0xeb30('0xc2'));db[_0xeb30('0xc3')]=db['sequelize'][_0xeb30('0x11')](_0xeb30('0xc4'));db[_0xeb30('0xc5')]=db['sequelize']['import'](_0xeb30('0xc6'));db[_0xeb30('0xc7')]=db['sequelize']['import']('../api/intDynamics365Account/intDynamics365Account.model');db[_0xeb30('0xc8')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xc9'));db[_0xeb30('0xca')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xcb'));db[_0xeb30('0xcc')]=db[_0xeb30('0x0')]['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xeb30('0xcd')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xce'));db[_0xeb30('0xcf')]=db[_0xeb30('0x0')]['import']('../api/intFreshsalesField/intFreshsalesField.model');db[_0xeb30('0x97')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x98'));db['Network']=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/network/network.model');db[_0xeb30('0xd0')]=db[_0xeb30('0x0')]['import'](_0xeb30('0xd1'));db[_0xeb30('0xd2')]=db['sequelize'][_0xeb30('0x11')](_0xeb30('0xd3'));db[_0xeb30('0xd4')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xd5'));db[_0xeb30('0xd6')]=db[_0xeb30('0x0')]['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xeb30('0xd7')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xd8'));db[_0xeb30('0xd9')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xda'));db['SquareReport']=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xdb'));db[_0xeb30('0xdc')]=db['sequelize'][_0xeb30('0x11')]('../api/squareReportDetail/squareReportDetail.model');db[_0xeb30('0xdd')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xde'));db[_0xeb30('0xdf')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xe0'));db[_0xeb30('0xe1')]=db[_0xeb30('0x0')]['import'](_0xeb30('0xe2'));db[_0xeb30('0xe3')]=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/squareProject/squareProject.model');db[_0xeb30('0xe4')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xe5'));db[_0xeb30('0xe6')]=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/squareMessage/squareMessage.model');db[_0xeb30('0xe7')]=db['sequelize'][_0xeb30('0x11')](_0xeb30('0xe8'));db[_0xeb30('0xe9')]=db['sequelize'][_0xeb30('0x11')](_0xeb30('0xea'));db['Campaign']=db['sequelize'][_0xeb30('0x11')]('../api/campaign/campaign.model');db[_0xeb30('0xeb')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xec'));db[_0xeb30('0xed')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xee'));db[_0xeb30('0xef')]=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/plugin/plugin.model');db[_0xeb30('0xf0')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xf1'));db[_0xeb30('0xf2')]=db['sequelize']['import']('../api/chatTransferReport/chatTransferReport.model');db[_0xeb30('0xf3')]=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/faxTransferReport/faxTransferReport.model');db[_0xeb30('0xf4')]=db['sequelize'][_0xeb30('0x11')](_0xeb30('0xf5'));db['SmsTransferReport']=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xf6'));db[_0xeb30('0xf7')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xf8'));db[_0xeb30('0xf9')]=db[_0xeb30('0x0')]['import'](_0xeb30('0xfa'));db[_0xeb30('0xfb')]=db['sequelize']['import'](_0xeb30('0xfc'));db[_0xeb30('0xfd')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0xfe'));db[_0xeb30('0xff')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x100'));db[_0xeb30('0x101')]=db['sequelize']['import'](_0xeb30('0x102'));db['WhatsappAccount']=db[_0xeb30('0x0')]['import'](_0xeb30('0x103'));db['WhatsappApplication']=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x104'));db[_0xeb30('0x105')]=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/whatsappMessage/whatsappMessage.model');db[_0xeb30('0x106')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x107'));db[_0xeb30('0x108')]=db['sequelize'][_0xeb30('0x11')](_0xeb30('0x109'));db[_0xeb30('0x10a')]=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x10b'));db[_0xeb30('0x10c')]=db[_0xeb30('0x0')][_0xeb30('0x11')]('../api/cloudProvider/cloudProvider.model');db['TeamVoiceQueue']=db[_0xeb30('0x0')][_0xeb30('0x11')](_0xeb30('0x10d'));db[_0xeb30('0x10e')]=db[_0xeb30('0x0')]['import']('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0xeb30('0x10f')]=db[_0xeb30('0x0')]['import']('../api/userVoicePrefix/userVoicePrefix.model');db[_0xeb30('0x110')]=db[_0xeb30('0x0')]['import'](_0xeb30('0x111'));db[_0xeb30('0x112')]=db[_0xeb30('0x0')]['import'](_0xeb30('0x113'));db[_0xeb30('0x10')][_0xeb30('0x114')](db['VoiceMail'],{'as':_0xeb30('0x1c'),'onDelete':_0xeb30('0x115'),'foreignKey':_0xeb30('0x116')});db['User'][_0xeb30('0x114')](db[_0xeb30('0x110')],{'as':_0xeb30('0x117'),'onDelete':'cascade','foreignKey':_0xeb30('0x116')});db['User']['hasMany'](db[_0xeb30('0x118')],{'as':_0xeb30('0x119'),'foreignKey':_0xeb30('0x116')});db[_0xeb30('0x10')]['hasMany'](db[_0xeb30('0x2c')],{'as':_0xeb30('0x11a'),'foreignKey':'UserId'});db[_0xeb30('0x10')][_0xeb30('0x11b')](db[_0xeb30('0x17')],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db[_0xeb30('0x10')]['hasMany'](db[_0xeb30('0x75')],{'as':_0xeb30('0x11c'),'foreignKey':_0xeb30('0x116')});db[_0xeb30('0x10')][_0xeb30('0x11b')](db[_0xeb30('0x11d')],{'as':_0xeb30('0x11e'),'foreignKey':_0xeb30('0x116')});db[_0xeb30('0x10')][_0xeb30('0x11b')](db[_0xeb30('0x78')],{'as':_0xeb30('0x78'),'foreignKey':_0xeb30('0x116')});db[_0xeb30('0x10')][_0xeb30('0x11b')](db[_0xeb30('0x5c')],{'as':'OpenchannelInteractions','foreignKey':'UserId'});db['User']['hasMany'](db[_0xeb30('0x65')],{'as':_0xeb30('0x11f'),'foreignKey':_0xeb30('0x116')});db[_0xeb30('0x10')][_0xeb30('0x11b')](db[_0xeb30('0x53')],{'as':'SmsInteractions','foreignKey':_0xeb30('0x116')});db[_0xeb30('0x10')][_0xeb30('0x11b')](db[_0xeb30('0x49')],{'as':_0xeb30('0x120'),'foreignKey':_0xeb30('0x116')});db[_0xeb30('0x10')][_0xeb30('0x11b')](db[_0xeb30('0x121')],{'as':_0xeb30('0x122'),'foreignKey':_0xeb30('0x116')});db[_0xeb30('0x10')][_0xeb30('0x11b')](db[_0xeb30('0x105')],{'as':_0xeb30('0x123'),'foreignKey':'UserId'});db[_0xeb30('0x10')][_0xeb30('0x11b')](db[_0xeb30('0x101')],{'as':_0xeb30('0x124'),'foreignKey':_0xeb30('0x125')});db[_0xeb30('0x10')][_0xeb30('0x11b')](db['CmHopper'],{'as':_0xeb30('0x126'),'foreignKey':_0xeb30('0x116'),'onDelete':_0xeb30('0x127')});db['User'][_0xeb30('0x128')](db[_0xeb30('0xfb')],{'as':_0xeb30('0xfb'),'foreignKey':_0xeb30('0x129')});db[_0xeb30('0x10')]['belongsToMany'](db['ChatGroup'],{'as':_0xeb30('0x12a'),'through':'chat_group_has_users'});db[_0xeb30('0x10')]['belongsToMany'](db['CmContact'],{'as':_0xeb30('0x12b'),'through':_0xeb30('0x12c')});db[_0xeb30('0x10')][_0xeb30('0x12d')](db['CmList'],{'as':_0xeb30('0x12e'),'through':_0xeb30('0x12f')});db[_0xeb30('0x10')][_0xeb30('0x12d')](db[_0xeb30('0xe7')],{'through':_0xeb30('0x130')});db[_0xeb30('0x10')][_0xeb30('0x12d')](db[_0xeb30('0x121')],{'as':_0xeb30('0x122'),'through':_0xeb30('0x131')});db[_0xeb30('0x10')][_0xeb30('0x12d')](db[_0xeb30('0x65')],{'as':'ChatInteractions','through':_0xeb30('0x132')});db[_0xeb30('0x10')][_0xeb30('0x12d')](db[_0xeb30('0x49')],{'as':_0xeb30('0x120'),'through':_0xeb30('0x133')});db[_0xeb30('0x10')]['belongsToMany'](db['SmsInteraction'],{'as':_0xeb30('0x134'),'through':_0xeb30('0x135')});db[_0xeb30('0x10')][_0xeb30('0x12d')](db[_0xeb30('0x5c')],{'as':'OpenchannelInteractions','through':_0xeb30('0x136')});db[_0xeb30('0x10')]['belongsToMany'](db[_0xeb30('0x105')],{'as':_0xeb30('0x123'),'through':_0xeb30('0x137')});db[_0xeb30('0x10')][_0xeb30('0x12d')](db['VoiceQueue'],{'as':'VoiceQueues','through':_0xeb30('0x2d'),'required':![]});db[_0xeb30('0x10')]['belongsToMany'](db[_0xeb30('0xf9')],{'as':_0xeb30('0x138'),'through':_0xeb30('0x10f'),'required':![]});db[_0xeb30('0x10')]['belongsToMany'](db[_0xeb30('0x139')],{'as':'MailQueues','through':_0xeb30('0x2f'),'required':![]});db[_0xeb30('0x10')][_0xeb30('0x12d')](db[_0xeb30('0x69')],{'as':_0xeb30('0x13a'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0xeb30('0x10')][_0xeb30('0x12d')](db[_0xeb30('0x13b')],{'as':_0xeb30('0x13c'),'through':_0xeb30('0x13d'),'required':![]});db[_0xeb30('0x10')][_0xeb30('0x12d')](db['SmsQueue'],{'as':_0xeb30('0x13e'),'through':_0xeb30('0x32'),'required':![]});db[_0xeb30('0x10')]['belongsToMany'](db[_0xeb30('0x5f')],{'as':_0xeb30('0x13f'),'through':_0xeb30('0x34'),'required':![]});db[_0xeb30('0x10')][_0xeb30('0x12d')](db[_0xeb30('0x10a')],{'as':_0xeb30('0x140'),'through':_0xeb30('0x36'),'required':![]});db[_0xeb30('0x10')][_0xeb30('0x12d')](db[_0xeb30('0xf7')],{'through':_0xeb30('0x12f')});db[_0xeb30('0x10')]['belongsToMany'](db[_0xeb30('0x141')],{'as':'ChatWebsites','through':_0xeb30('0x142')});db[_0xeb30('0x10')]['belongsToMany'](db[_0xeb30('0x45')],{'as':'FaxAccounts','through':_0xeb30('0x143')});db[_0xeb30('0x10')][_0xeb30('0x12d')](db['MailAccount'],{'as':_0xeb30('0x144'),'through':_0xeb30('0x145')});db[_0xeb30('0x10')]['belongsToMany'](db[_0xeb30('0x146')],{'as':_0xeb30('0x147'),'through':_0xeb30('0x148')});db[_0xeb30('0x10')][_0xeb30('0x12d')](db['SmsAccount'],{'as':'SmsAccounts','through':_0xeb30('0x149')});db[_0xeb30('0x10')][_0xeb30('0x12d')](db[_0xeb30('0x14a')],{'as':_0xeb30('0x14b'),'through':_0xeb30('0x14c')});db[_0xeb30('0x13')]['hasMany'](db[_0xeb30('0x17')],{'as':_0xeb30('0x14d'),'onDelete':'cascade','foreignKey':_0xeb30('0x14e')});db[_0xeb30('0x15')]['hasMany'](db[_0xeb30('0x17')],{'onDelete':_0xeb30('0x115')});db[_0xeb30('0x17')][_0xeb30('0x11b')](db[_0xeb30('0x17')],{'as':_0xeb30('0x14f'),'onDelete':_0xeb30('0x115')});db['VoiceMusicOnHold']['belongsToMany'](db['Sound'],{'as':_0xeb30('0x150'),'through':'moh_has_sounds'});db[_0xeb30('0x19')][_0xeb30('0x11b')](db['UserVoiceQueueRt'],{'as':_0xeb30('0x151'),'foreignKey':_0xeb30('0x152')});db[_0xeb30('0x19')][_0xeb30('0x11b')](db[_0xeb30('0x73')],{'as':'Hoppers','foreignKey':_0xeb30('0x152')});db[_0xeb30('0x19')][_0xeb30('0x11b')](db[_0xeb30('0x75')],{'as':_0xeb30('0x11c'),'foreignKey':_0xeb30('0x152')});db['VoiceQueue'][_0xeb30('0x11b')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0xeb30('0x152')});db['VoiceQueue'][_0xeb30('0x11b')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xeb30('0x152')});db[_0xeb30('0x19')][_0xeb30('0x11b')](db['CmHopperBlack'],{'as':_0xeb30('0x153'),'foreignKey':'VoiceQueueId'});db[_0xeb30('0x19')][_0xeb30('0x11b')](db['JscriptySessionReport'],{'as':_0xeb30('0x154'),'foreignKey':_0xeb30('0x152')});db[_0xeb30('0x19')][_0xeb30('0x128')](db[_0xeb30('0x155')],{'as':_0xeb30('0x155'),'foreignKey':_0xeb30('0x156')});db[_0xeb30('0x19')][_0xeb30('0x128')](db['Trunk'],{'as':_0xeb30('0x157'),'foreignKey':_0xeb30('0x158')});db[_0xeb30('0x19')][_0xeb30('0x128')](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db['VoiceQueue'][_0xeb30('0x128')](db[_0xeb30('0x83')],{'as':_0xeb30('0x159'),'foreignKey':_0xeb30('0x15a')});db['VoiceQueue'][_0xeb30('0x12d')](db[_0xeb30('0xf7')],{'as':_0xeb30('0x12e'),'through':_0xeb30('0x15b')});db['VoiceQueue'][_0xeb30('0x12d')](db[_0xeb30('0x10')],{'as':_0xeb30('0x15c'),'through':_0xeb30('0x2d')});db[_0xeb30('0x19')][_0xeb30('0x12d')](db[_0xeb30('0xe7')],{'as':_0xeb30('0x15d'),'through':_0xeb30('0x15e')});db[_0xeb30('0x19')]['belongsToMany'](db[_0xeb30('0xf7')],{'as':'BlackLists','through':_0xeb30('0x15f')});db[_0xeb30('0x118')]['belongsTo'](db['User'],{'as':_0xeb30('0x10'),'foreignKey':'UserId'});db[_0xeb30('0x1b')]['belongsTo'](db['User'],{'as':'User','foreignKey':_0xeb30('0x116')});db[_0xeb30('0x1c')][_0xeb30('0x11b')](db[_0xeb30('0x1e')],{'as':_0xeb30('0x160'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':_0xeb30('0x161')});db['VoiceMailMessage'][_0xeb30('0x128')](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':'mailbox'});db[_0xeb30('0x1f')]['hasMany'](db[_0xeb30('0x25')],{'as':_0xeb30('0x162'),'foreignKey':_0xeb30('0x163'),'constraints':![]});db[_0xeb30('0x1f')][_0xeb30('0x11b')](db[_0xeb30('0x23')],{'as':_0xeb30('0x164'),'foreignKey':_0xeb30('0x163'),'constraints':![]});db[_0xeb30('0x1f')]['belongsTo'](db[_0xeb30('0x10')],{'as':_0xeb30('0x10'),'foreignKey':_0xeb30('0x116')});db[_0xeb30('0x1f')][_0xeb30('0x128')](db['CmContact'],{'as':_0xeb30('0x165'),'foreignKey':_0xeb30('0x166')});db[_0xeb30('0x37')][_0xeb30('0x128')](db[_0xeb30('0x3a')],{'as':_0xeb30('0x3a'),'foreignKey':'MailAccountId'});db['MailServerIn'][_0xeb30('0x128')](db[_0xeb30('0x10c')],{'as':_0xeb30('0x10c'),'foreignKey':_0xeb30('0x167'),'onDelete':_0xeb30('0x168')});db[_0xeb30('0x169')][_0xeb30('0x128')](db[_0xeb30('0x3a')],{'as':_0xeb30('0x3a'),'foreignKey':_0xeb30('0x16a')});db[_0xeb30('0x169')][_0xeb30('0x128')](db[_0xeb30('0x10c')],{'as':_0xeb30('0x10c'),'foreignKey':_0xeb30('0x167'),'onDelete':_0xeb30('0x168')});db[_0xeb30('0x3a')]['hasOne'](db['MailServerIn'],{'as':_0xeb30('0x16b'),'onDelete':_0xeb30('0x115')});db[_0xeb30('0x3a')][_0xeb30('0x114')](db[_0xeb30('0x169')],{'as':_0xeb30('0x16c'),'onDelete':_0xeb30('0x115')});db[_0xeb30('0x3a')][_0xeb30('0x11b')](db[_0xeb30('0x7d')],{'as':_0xeb30('0x16d'),'foreignKey':_0xeb30('0x16a'),'onDelete':_0xeb30('0x115')});db[_0xeb30('0x3a')]['hasMany'](db[_0xeb30('0x16e')],{'as':_0xeb30('0x16f'),'foreignKey':_0xeb30('0x16a')});db['MailAccount'][_0xeb30('0x11b')](db[_0xeb30('0x3e')],{'as':_0xeb30('0x160'),'foreignKey':_0xeb30('0x16a')});db[_0xeb30('0x3a')]['hasMany'](db[_0xeb30('0x121')],{'as':_0xeb30('0x170')});db['MailAccount'][_0xeb30('0x11b')](db['MailApplication'],{'as':_0xeb30('0x14f'),'foreignKey':_0xeb30('0x16a'),'onDelete':_0xeb30('0x115')});db[_0xeb30('0x3a')]['belongsTo'](db[_0xeb30('0xf7')],{'as':_0xeb30('0x171'),'foreignKey':_0xeb30('0x172')});db[_0xeb30('0x3a')][_0xeb30('0x128')](db['Template'],{'as':_0xeb30('0x93'),'foreignKey':_0xeb30('0x173')});db['MailAccount'][_0xeb30('0x128')](db[_0xeb30('0x83')],{'as':_0xeb30('0x159'),'foreignKey':_0xeb30('0x15a')});db['MailAccount'][_0xeb30('0x12d')](db[_0xeb30('0x10')],{'as':'Agents','through':_0xeb30('0x145')});db[_0xeb30('0x139')][_0xeb30('0x12d')](db[_0xeb30('0x10')],{'as':_0xeb30('0x15c'),'through':_0xeb30('0x2f')});db[_0xeb30('0x139')][_0xeb30('0x12d')](db['Team'],{'through':'team_has_mail_queues','as':'Teams'});db[_0xeb30('0x121')][_0xeb30('0x11b')](db[_0xeb30('0x3e')],{'as':_0xeb30('0x160'),'onDelete':'cascade','foreignKey':_0xeb30('0x174')});db['MailInteraction'][_0xeb30('0x128')](db[_0xeb30('0x3a')],{'as':_0xeb30('0x175'),'foreignKey':_0xeb30('0x16a')});db[_0xeb30('0x121')][_0xeb30('0x128')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db['MailInteraction'][_0xeb30('0x128')](db[_0xeb30('0x10')],{'as':_0xeb30('0x176'),'foreignKey':'UserId'});db[_0xeb30('0x121')][_0xeb30('0x12d')](db[_0xeb30('0x8c')],{'through':_0xeb30('0x177'),'as':_0xeb30('0x178')});db[_0xeb30('0x121')][_0xeb30('0x12d')](db['Tag'],{'through':_0xeb30('0x177'),'as':_0xeb30('0x179')});db[_0xeb30('0x121')][_0xeb30('0x12d')](db[_0xeb30('0x10')],{'as':_0xeb30('0x17a'),'through':'user_has_mail_interactions','foreignKey':_0xeb30('0x174')});db[_0xeb30('0x3e')][_0xeb30('0x11b')](db[_0xeb30('0xed')],{'as':'Attachments','onDelete':'cascade'});db['MailMessage'][_0xeb30('0x128')](db[_0xeb30('0x10')],{'as':_0xeb30('0x10')});db['MailMessage'][_0xeb30('0x128')](db['CmContact'],{'onDelete':_0xeb30('0x115'),'as':_0xeb30('0x165')});db[_0xeb30('0x3e')][_0xeb30('0x128')](db[_0xeb30('0x121')],{'as':_0xeb30('0x17b'),'foreignKey':_0xeb30('0x174')});db[_0xeb30('0x3e')][_0xeb30('0x128')](db[_0xeb30('0x3a')],{'as':_0xeb30('0x175'),'foreignKey':'MailAccountId'});db[_0xeb30('0x3e')][_0xeb30('0x128')](db[_0xeb30('0x141')],{'as':_0xeb30('0x141'),'foreignKey':_0xeb30('0x17c')});db[_0xeb30('0x3e')][_0xeb30('0x128')](db[_0xeb30('0x68')],{'as':'ChatOfflineMessage','foreignKey':_0xeb30('0x17d')});db[_0xeb30('0x40')][_0xeb30('0x128')](db[_0xeb30('0x10')],{'onDelete':'restrict'});db['MailApplication'][_0xeb30('0x128')](db[_0xeb30('0x139')],{'onDelete':_0xeb30('0x168')});db[_0xeb30('0x40')]['belongsTo'](db[_0xeb30('0x3a')],{'onDelete':_0xeb30('0x168')});db[_0xeb30('0x40')][_0xeb30('0x128')](db['Interval'],{'onDelete':_0xeb30('0x168'),'foreignKey':_0xeb30('0x17e')});db['MailApplication'][_0xeb30('0x128')](db[_0xeb30('0x8c')],{'onDelete':_0xeb30('0x168'),'foreignKey':'TagId'});db[_0xeb30('0x42')]['belongsTo'](db[_0xeb30('0x3a')],{});db['MailQueueReport'][_0xeb30('0x128')](db[_0xeb30('0xf7')],{'as':_0xeb30('0x171'),'foreignKey':_0xeb30('0x172')});db[_0xeb30('0x42')][_0xeb30('0x128')](db[_0xeb30('0x71')],{'as':_0xeb30('0x165'),'foreignKey':'ContactId'});db[_0xeb30('0x42')][_0xeb30('0x128')](db[_0xeb30('0x121')],{});db[_0xeb30('0x42')][_0xeb30('0x128')](db['MailMessage'],{});db[_0xeb30('0x42')][_0xeb30('0x128')](db['User'],{});db[_0xeb30('0x42')]['belongsTo'](db[_0xeb30('0x139')],{});db['Dashboard'][_0xeb30('0x11b')](db['DashboardItem'],{'as':_0xeb30('0x17f'),'onDelete':'cascade'});db['FaxAccount'][_0xeb30('0x11b')](db[_0xeb30('0x7d')],{'as':'Dispositions','foreignKey':_0xeb30('0x180'),'onDelete':_0xeb30('0x115')});db['FaxAccount'][_0xeb30('0x11b')](db['CannedAnswer'],{'as':_0xeb30('0x16f'),'foreignKey':_0xeb30('0x180')});db['FaxAccount']['hasMany'](db['FaxInteraction'],{'as':_0xeb30('0x170')});db[_0xeb30('0x45')][_0xeb30('0x11b')](db[_0xeb30('0x47')],{'as':_0xeb30('0x14f'),'foreignKey':'FaxAccountId','onDelete':_0xeb30('0x115')});db[_0xeb30('0x45')][_0xeb30('0x11b')](db[_0xeb30('0x17')],{'as':_0xeb30('0x181'),'onDelete':'cascade'});db[_0xeb30('0x45')][_0xeb30('0x11b')](db[_0xeb30('0x4b')],{'as':_0xeb30('0x160')});db['FaxAccount']['belongsTo'](db[_0xeb30('0x155')],{'as':_0xeb30('0x155')});db['FaxAccount'][_0xeb30('0x128')](db['CmList'],{'as':'List','foreignKey':_0xeb30('0x172')});db[_0xeb30('0x45')][_0xeb30('0x128')](db[_0xeb30('0x83')],{'as':_0xeb30('0x159'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xeb30('0x45')][_0xeb30('0x12d')](db[_0xeb30('0x10')],{'as':_0xeb30('0x15c'),'through':_0xeb30('0x143')});db['FaxApplication'][_0xeb30('0x128')](db[_0xeb30('0x10')],{'onDelete':_0xeb30('0x168')});db['FaxApplication'][_0xeb30('0x128')](db[_0xeb30('0x13b')],{'onDelete':_0xeb30('0x168')});db[_0xeb30('0x47')][_0xeb30('0x128')](db[_0xeb30('0x45')],{'onDelete':_0xeb30('0x168')});db[_0xeb30('0x47')][_0xeb30('0x128')](db[_0xeb30('0x8c')],{'onDelete':_0xeb30('0x168'),'foreignKey':_0xeb30('0x182')});db[_0xeb30('0x49')][_0xeb30('0x11b')](db[_0xeb30('0x4b')],{'as':_0xeb30('0x160'),'onDelete':_0xeb30('0x115'),'foreignKey':_0xeb30('0x183')});db['FaxInteraction']['belongsTo'](db[_0xeb30('0x45')],{'as':_0xeb30('0x175'),'foreignKey':_0xeb30('0x180')});db[_0xeb30('0x49')][_0xeb30('0x128')](db[_0xeb30('0x71')],{'as':_0xeb30('0x165'),'foreignKey':_0xeb30('0x166')});db[_0xeb30('0x49')][_0xeb30('0x128')](db[_0xeb30('0x10')],{'as':_0xeb30('0x176'),'foreignKey':_0xeb30('0x116')});db[_0xeb30('0x49')]['belongsToMany'](db['Tag'],{'through':_0xeb30('0x184'),'as':'Tags'});db[_0xeb30('0x49')][_0xeb30('0x12d')](db[_0xeb30('0x8c')],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db[_0xeb30('0x49')]['belongsToMany'](db[_0xeb30('0x10')],{'as':_0xeb30('0x17a'),'through':_0xeb30('0x133'),'foreignKey':_0xeb30('0x183')});db[_0xeb30('0x4b')]['belongsTo'](db[_0xeb30('0x10')],{'onDelete':_0xeb30('0x115'),'as':_0xeb30('0x10')});db[_0xeb30('0x4b')][_0xeb30('0x128')](db[_0xeb30('0x49')],{'as':_0xeb30('0x17b'),'foreignKey':_0xeb30('0x183')});db['FaxMessage'][_0xeb30('0x128')](db[_0xeb30('0x71')],{'onDelete':_0xeb30('0x115'),'as':'Contact'});db[_0xeb30('0x4b')][_0xeb30('0x128')](db[_0xeb30('0xed')],{'as':_0xeb30('0xed'),'foreignKey':_0xeb30('0x185')});db[_0xeb30('0x4b')][_0xeb30('0x128')](db['FaxAccount'],{'as':_0xeb30('0x175'),'foreignKey':_0xeb30('0x180')});db['FaxQueue'][_0xeb30('0x12d')](db['User'],{'as':_0xeb30('0x15c'),'through':'UserFaxQueue'});db[_0xeb30('0x13b')][_0xeb30('0x12d')](db[_0xeb30('0xe7')],{'through':_0xeb30('0x186'),'as':_0xeb30('0x15d')});db[_0xeb30('0x4d')][_0xeb30('0x128')](db[_0xeb30('0x45')],{});db[_0xeb30('0x4d')]['belongsTo'](db[_0xeb30('0xf7')],{'as':_0xeb30('0x171'),'foreignKey':_0xeb30('0x172')});db[_0xeb30('0x4d')][_0xeb30('0x128')](db[_0xeb30('0x71')],{'as':_0xeb30('0x165'),'foreignKey':_0xeb30('0x166')});db['FaxQueueReport']['belongsTo'](db[_0xeb30('0x49')],{});db[_0xeb30('0x4d')][_0xeb30('0x128')](db[_0xeb30('0x4b')],{});db[_0xeb30('0x4d')][_0xeb30('0x128')](db['User'],{});db[_0xeb30('0x4d')][_0xeb30('0x128')](db[_0xeb30('0x13b')],{});db[_0xeb30('0x4f')][_0xeb30('0x11b')](db[_0xeb30('0x7d')],{'as':_0xeb30('0x16d'),'foreignKey':'SmsAccountId','onDelete':_0xeb30('0x115')});db['SmsAccount'][_0xeb30('0x11b')](db[_0xeb30('0x16e')],{'as':_0xeb30('0x16f'),'foreignKey':_0xeb30('0x187')});db[_0xeb30('0x4f')][_0xeb30('0x11b')](db[_0xeb30('0x55')],{'as':'Messages','foreignKey':_0xeb30('0x187')});db['SmsAccount'][_0xeb30('0x11b')](db[_0xeb30('0x53')],{'as':_0xeb30('0x170')});db[_0xeb30('0x4f')][_0xeb30('0x11b')](db['SmsApplication'],{'as':'Applications','foreignKey':_0xeb30('0x187'),'onDelete':_0xeb30('0x115')});db[_0xeb30('0x4f')][_0xeb30('0x128')](db[_0xeb30('0xf7')],{'as':_0xeb30('0x171'),'foreignKey':_0xeb30('0x172')});db[_0xeb30('0x4f')][_0xeb30('0x128')](db['Pause'],{'as':_0xeb30('0x159'),'foreignKey':_0xeb30('0x15a')});db[_0xeb30('0x4f')]['belongsToMany'](db[_0xeb30('0x10')],{'as':_0xeb30('0x15c'),'through':_0xeb30('0x149')});db[_0xeb30('0x51')][_0xeb30('0x128')](db[_0xeb30('0x10')],{'onDelete':_0xeb30('0x168')});db[_0xeb30('0x51')][_0xeb30('0x128')](db[_0xeb30('0x57')],{'onDelete':_0xeb30('0x168')});db[_0xeb30('0x51')][_0xeb30('0x128')](db[_0xeb30('0x4f')],{'onDelete':'restrict'});db[_0xeb30('0x51')][_0xeb30('0x128')](db['Interval'],{'onDelete':_0xeb30('0x168'),'foreignKey':_0xeb30('0x17e')});db[_0xeb30('0x51')][_0xeb30('0x128')](db[_0xeb30('0x8c')],{'onDelete':'restrict','foreignKey':_0xeb30('0x182')});db[_0xeb30('0x53')]['hasMany'](db[_0xeb30('0x55')],{'as':'Messages','onDelete':_0xeb30('0x115'),'foreignKey':_0xeb30('0x188')});db[_0xeb30('0x53')][_0xeb30('0x128')](db[_0xeb30('0x4f')],{'as':_0xeb30('0x175'),'foreignKey':_0xeb30('0x187')});db['SmsInteraction']['belongsTo'](db[_0xeb30('0x71')],{'as':_0xeb30('0x165'),'foreignKey':_0xeb30('0x166')});db[_0xeb30('0x53')]['belongsTo'](db['User'],{'as':_0xeb30('0x176'),'foreignKey':_0xeb30('0x116')});db[_0xeb30('0x53')][_0xeb30('0x12d')](db[_0xeb30('0x8c')],{'through':'sms_interaction_has_tags','as':_0xeb30('0x178')});db[_0xeb30('0x53')][_0xeb30('0x12d')](db[_0xeb30('0x8c')],{'through':_0xeb30('0x189'),'as':_0xeb30('0x179')});db[_0xeb30('0x53')]['belongsToMany'](db[_0xeb30('0x10')],{'as':_0xeb30('0x17a'),'through':_0xeb30('0x135'),'foreignKey':_0xeb30('0x188')});db[_0xeb30('0x55')][_0xeb30('0x128')](db[_0xeb30('0x10')],{'as':_0xeb30('0x10')});db[_0xeb30('0x55')][_0xeb30('0x128')](db['CmContact'],{'onDelete':_0xeb30('0x115'),'as':'Contact'});db['SmsMessage'][_0xeb30('0x128')](db[_0xeb30('0x53')],{'onDelete':_0xeb30('0x115'),'as':_0xeb30('0x17b'),'foreignKey':_0xeb30('0x188')});db[_0xeb30('0x55')][_0xeb30('0x128')](db[_0xeb30('0x4f')],{'as':_0xeb30('0x175'),'foreignKey':_0xeb30('0x187')});db[_0xeb30('0x57')][_0xeb30('0x12d')](db[_0xeb30('0x10')],{'as':'Agents','through':_0xeb30('0x32'),'foreignKey':_0xeb30('0x18a')});db[_0xeb30('0x57')]['belongsToMany'](db[_0xeb30('0xe7')],{'through':'team_has_sms_queues','as':_0xeb30('0x15d')});db[_0xeb30('0x146')][_0xeb30('0x11b')](db['Disposition'],{'as':_0xeb30('0x16d'),'foreignKey':_0xeb30('0x18b'),'onDelete':_0xeb30('0x115')});db[_0xeb30('0x146')]['hasMany'](db['CannedAnswer'],{'as':_0xeb30('0x16f'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xeb30('0x11b')](db['OpenchannelInteraction'],{'as':_0xeb30('0x170'),'foreignKey':'OpenchannelAccountId'});db[_0xeb30('0x146')][_0xeb30('0x11b')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0xeb30('0x18b')});db['OpenchannelAccount'][_0xeb30('0x11b')](db[_0xeb30('0x5a')],{'as':_0xeb30('0x14f'),'foreignKey':_0xeb30('0x18b'),'onDelete':_0xeb30('0x115')});db[_0xeb30('0x146')][_0xeb30('0x128')](db[_0xeb30('0xf7')],{'as':_0xeb30('0x171'),'foreignKey':_0xeb30('0x172')});db[_0xeb30('0x146')][_0xeb30('0x128')](db['Pause'],{'as':_0xeb30('0x159'),'foreignKey':_0xeb30('0x15a')});db['OpenchannelAccount']['belongsToMany'](db['User'],{'as':'Agents','through':_0xeb30('0x148')});db[_0xeb30('0x5a')][_0xeb30('0x128')](db[_0xeb30('0x10')],{'onDelete':_0xeb30('0x168')});db[_0xeb30('0x5a')][_0xeb30('0x128')](db[_0xeb30('0x5f')],{'onDelete':_0xeb30('0x168'),'foreignKey':_0xeb30('0x18c')});db[_0xeb30('0x5a')][_0xeb30('0x128')](db[_0xeb30('0x146')],{'onDelete':'restrict','foreignKey':_0xeb30('0x18b')});db['OpenchannelApplication'][_0xeb30('0x128')](db[_0xeb30('0x81')],{'onDelete':_0xeb30('0x168'),'foreignKey':_0xeb30('0x17e')});db[_0xeb30('0x5a')][_0xeb30('0x128')](db['Tag'],{'onDelete':_0xeb30('0x168'),'foreignKey':'TagId'});db[_0xeb30('0x5c')][_0xeb30('0x11b')](db[_0xeb30('0x5e')],{'as':_0xeb30('0x160'),'onDelete':_0xeb30('0x115'),'foreignKey':_0xeb30('0x18d')});db[_0xeb30('0x5c')][_0xeb30('0x128')](db[_0xeb30('0x146')],{'as':_0xeb30('0x175'),'foreignKey':_0xeb30('0x18b')});db[_0xeb30('0x5c')][_0xeb30('0x128')](db['CmContact'],{'as':'Contact','foreignKey':_0xeb30('0x166')});db[_0xeb30('0x5c')][_0xeb30('0x128')](db[_0xeb30('0x10')],{'as':_0xeb30('0x176'),'foreignKey':_0xeb30('0x116')});db[_0xeb30('0x5c')][_0xeb30('0x12d')](db['Tag'],{'through':_0xeb30('0x18e'),'as':_0xeb30('0x178')});db[_0xeb30('0x5c')]['belongsToMany'](db[_0xeb30('0x8c')],{'through':_0xeb30('0x18e'),'as':_0xeb30('0x179')});db[_0xeb30('0x5c')][_0xeb30('0x12d')](db[_0xeb30('0x10')],{'as':_0xeb30('0x17a'),'through':_0xeb30('0x136'),'foreignKey':_0xeb30('0x18d')});db[_0xeb30('0x5e')][_0xeb30('0x128')](db[_0xeb30('0x10')],{'onDelete':'cascade','as':_0xeb30('0x10')});db[_0xeb30('0x5e')][_0xeb30('0x128')](db[_0xeb30('0x71')],{'onDelete':_0xeb30('0x115'),'as':_0xeb30('0x165')});db[_0xeb30('0x5e')][_0xeb30('0x128')](db[_0xeb30('0x5c')],{'onDelete':_0xeb30('0x115'),'as':_0xeb30('0x17b'),'foreignKey':_0xeb30('0x18d')});db[_0xeb30('0x5e')][_0xeb30('0x128')](db['Attachment'],{'as':_0xeb30('0xed'),'foreignKey':_0xeb30('0x185')});db[_0xeb30('0x5e')][_0xeb30('0x128')](db['OpenchannelAccount'],{'as':_0xeb30('0x175'),'foreignKey':_0xeb30('0x18b')});db[_0xeb30('0x5f')]['belongsToMany'](db['User'],{'as':_0xeb30('0x15c'),'through':_0xeb30('0x34'),'foreignKey':_0xeb30('0x18c')});db[_0xeb30('0x5f')]['belongsToMany'](db[_0xeb30('0xe7')],{'through':_0xeb30('0x18f'),'as':'Teams'});db[_0xeb30('0x141')][_0xeb30('0x11b')](db[_0xeb30('0x7d')],{'as':_0xeb30('0x16d'),'foreignKey':'ChatWebsiteId','onDelete':'cascade'});db[_0xeb30('0x141')][_0xeb30('0x11b')](db[_0xeb30('0x16e')],{'as':_0xeb30('0x16f'),'foreignKey':_0xeb30('0x17c')});db[_0xeb30('0x141')][_0xeb30('0x11b')](db[_0xeb30('0x6d')],{'as':_0xeb30('0x190')});db[_0xeb30('0x141')][_0xeb30('0x11b')](db['ChatInteraction'],{'as':_0xeb30('0x170')});db[_0xeb30('0x141')]['hasMany'](db[_0xeb30('0x191')],{'as':_0xeb30('0x14f'),'foreignKey':_0xeb30('0x17c'),'onDelete':_0xeb30('0x115')});db[_0xeb30('0x141')][_0xeb30('0x11b')](db[_0xeb30('0x67')],{'as':'Messages'});db[_0xeb30('0x141')][_0xeb30('0x128')](db['CmList'],{'as':'List','foreignKey':_0xeb30('0x172')});db[_0xeb30('0x141')][_0xeb30('0x128')](db['Interval'],{'as':_0xeb30('0x81'),'foreignKey':_0xeb30('0x17e')});db[_0xeb30('0x141')][_0xeb30('0x128')](db[_0xeb30('0x3a')],{'as':_0xeb30('0x3a'),'foreignKey':_0xeb30('0x16a')});db['ChatWebsite'][_0xeb30('0x128')](db[_0xeb30('0x83')],{'as':_0xeb30('0x159'),'foreignKey':_0xeb30('0x15a')});db[_0xeb30('0x141')][_0xeb30('0x12d')](db[_0xeb30('0x10')],{'as':'Agents','through':'user_has_chat_websites'});db[_0xeb30('0x62')]['belongsTo'](db['OpenchannelAccount'],{});db[_0xeb30('0x62')][_0xeb30('0x128')](db[_0xeb30('0xf7')],{'as':_0xeb30('0x171'),'foreignKey':_0xeb30('0x172')});db[_0xeb30('0x62')][_0xeb30('0x128')](db[_0xeb30('0x71')],{'as':_0xeb30('0x165'),'foreignKey':'ContactId'});db[_0xeb30('0x62')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0xeb30('0x62')][_0xeb30('0x128')](db[_0xeb30('0x5e')],{});db['OpenchannelQueueReport'][_0xeb30('0x128')](db[_0xeb30('0x10')],{});db[_0xeb30('0x62')][_0xeb30('0x128')](db[_0xeb30('0x5f')],{});db[_0xeb30('0x191')]['belongsTo'](db['User'],{'as':_0xeb30('0x192'),'foreignKey':_0xeb30('0x116'),'onDelete':_0xeb30('0x168')});db[_0xeb30('0x191')][_0xeb30('0x128')](db[_0xeb30('0x69')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':'restrict'});db['ChatApplication'][_0xeb30('0x128')](db[_0xeb30('0x141')],{'as':_0xeb30('0x193'),'foreignKey':_0xeb30('0x17c'),'onDelete':_0xeb30('0x168')});db[_0xeb30('0x191')][_0xeb30('0x128')](db[_0xeb30('0x8c')],{'onDelete':'restrict','foreignKey':_0xeb30('0x182')});db['ChatInteraction'][_0xeb30('0x11b')](db[_0xeb30('0x67')],{'as':_0xeb30('0x160'),'onDelete':_0xeb30('0x115'),'foreignKey':_0xeb30('0x194')});db[_0xeb30('0x65')][_0xeb30('0x128')](db[_0xeb30('0x141')],{'as':_0xeb30('0x175'),'foreignKey':'ChatWebsiteId'});db[_0xeb30('0x65')][_0xeb30('0x128')](db['CmContact'],{'as':'Contact','foreignKey':_0xeb30('0x166')});db[_0xeb30('0x65')][_0xeb30('0x128')](db['User'],{'as':'Owner','foreignKey':_0xeb30('0x116')});db[_0xeb30('0x65')][_0xeb30('0x12d')](db[_0xeb30('0x8c')],{'through':_0xeb30('0x195'),'as':_0xeb30('0x178')});db['ChatInteraction'][_0xeb30('0x12d')](db[_0xeb30('0x8c')],{'through':_0xeb30('0x195'),'as':_0xeb30('0x179')});db[_0xeb30('0x65')][_0xeb30('0x12d')](db[_0xeb30('0x10')],{'as':_0xeb30('0x17a'),'through':_0xeb30('0x132'),'foreignKey':_0xeb30('0x194')});db[_0xeb30('0x67')][_0xeb30('0x128')](db['User'],{'onDelete':_0xeb30('0x115'),'as':'User'});db[_0xeb30('0x67')][_0xeb30('0x128')](db['CmContact'],{'onDelete':_0xeb30('0x115'),'as':'Contact','foreignKey':'ContactId'});db['ChatMessage'][_0xeb30('0x128')](db[_0xeb30('0x65')],{'onDelete':_0xeb30('0x115'),'as':_0xeb30('0x17b'),'foreignKey':_0xeb30('0x194')});db[_0xeb30('0x67')][_0xeb30('0x128')](db[_0xeb30('0xed')],{'as':_0xeb30('0xed'),'foreignKey':_0xeb30('0x185')});db['ChatMessage'][_0xeb30('0x128')](db[_0xeb30('0x141')],{'as':_0xeb30('0x175'),'foreignKey':_0xeb30('0x17c')});db['ChatOfflineMessage'][_0xeb30('0x11b')](db[_0xeb30('0xed')],{'as':_0xeb30('0x196'),'foreignKey':_0xeb30('0x17d'),'onDelete':_0xeb30('0x115'),'hooks':!![]});db['ChatOfflineMessage'][_0xeb30('0x128')](db[_0xeb30('0x71')],{'onDelete':_0xeb30('0x115'),'as':_0xeb30('0x165'),'foreignKey':'ContactId'});db[_0xeb30('0x68')][_0xeb30('0x128')](db[_0xeb30('0x141')],{'as':_0xeb30('0x175'),'foreignKey':'ChatWebsiteId'});db[_0xeb30('0x69')][_0xeb30('0x12d')](db[_0xeb30('0x10')],{'as':_0xeb30('0x15c'),'through':_0xeb30('0x2e'),'hooks':!![]});db[_0xeb30('0x69')]['belongsToMany'](db[_0xeb30('0xe7')],{'through':_0xeb30('0x197'),'as':'Teams'});db[_0xeb30('0x6b')][_0xeb30('0x11b')](db[_0xeb30('0xd2')],{'as':'Messages','foreignKey':_0xeb30('0x198'),'onDelete':_0xeb30('0x115')});db[_0xeb30('0x6b')][_0xeb30('0x12d')](db['User'],{'as':_0xeb30('0x151'),'through':_0xeb30('0x199')});db[_0xeb30('0x6d')]['belongsTo'](db['ChatWebsite'],{'as':_0xeb30('0x193'),'foreignKey':_0xeb30('0x17c')});db[_0xeb30('0x6f')][_0xeb30('0x11b')](db[_0xeb30('0x71')],{'as':_0xeb30('0x12b'),'foreignKey':_0xeb30('0x19a')});db[_0xeb30('0x71')][_0xeb30('0x11b')](db[_0xeb30('0x19b')],{'as':'Phones','foreignKey':_0xeb30('0x19c')});db[_0xeb30('0x71')][_0xeb30('0x11b')](db['CmHopper'],{'as':_0xeb30('0x126'),'foreignKey':'ContactId'});db[_0xeb30('0x71')][_0xeb30('0x11b')](db[_0xeb30('0x75')],{'as':'HopperFinals','foreignKey':'ContactId'});db[_0xeb30('0x71')][_0xeb30('0x11b')](db[_0xeb30('0x11d')],{'as':_0xeb30('0x19d'),'foreignKey':'ContactId'});db[_0xeb30('0x71')][_0xeb30('0x11b')](db[_0xeb30('0x78')],{'as':_0xeb30('0x78'),'foreignKey':_0xeb30('0x166')});db['CmContact'][_0xeb30('0x11b')](db[_0xeb30('0xd7')],{'as':_0xeb30('0x154'),'foreignKey':'ContactId'});db[_0xeb30('0x71')]['hasMany'](db[_0xeb30('0x5c')],{'as':_0xeb30('0x19e'),'foreignKey':_0xeb30('0x166'),'onDelete':'restrict'});db[_0xeb30('0x71')][_0xeb30('0x11b')](db[_0xeb30('0x65')],{'as':_0xeb30('0x11f'),'foreignKey':_0xeb30('0x166'),'onDelete':_0xeb30('0x168')});db[_0xeb30('0x71')]['hasMany'](db[_0xeb30('0x53')],{'as':_0xeb30('0x134'),'foreignKey':'ContactId','onDelete':_0xeb30('0x168')});db[_0xeb30('0x71')][_0xeb30('0x11b')](db[_0xeb30('0x49')],{'as':_0xeb30('0x120'),'foreignKey':_0xeb30('0x166'),'onDelete':'restrict'});db[_0xeb30('0x71')]['hasMany'](db['MailInteraction'],{'as':_0xeb30('0x122'),'foreignKey':_0xeb30('0x166'),'onDelete':_0xeb30('0x168')});db['CmContact'][_0xeb30('0x128')](db[_0xeb30('0x6f')],{'as':'Company','foreignKey':_0xeb30('0x19a')});db[_0xeb30('0x71')][_0xeb30('0x128')](db[_0xeb30('0xf7')],{'as':_0xeb30('0x171'),'foreignKey':'ListId','onDelete':_0xeb30('0x115')});db['CmContact'][_0xeb30('0x12d')](db['User'],{'as':_0xeb30('0x17a'),'through':_0xeb30('0x12c')});db[_0xeb30('0x71')][_0xeb30('0x12d')](db[_0xeb30('0x8c')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0xeb30('0x71')][_0xeb30('0x12d')](db[_0xeb30('0x8c')],{'through':_0xeb30('0x19f'),'as':'ThroughTags'});db[_0xeb30('0x73')][_0xeb30('0x11b')](db[_0xeb30('0x91')],{'as':'AdditionalPhones','foreignKey':_0xeb30('0x1a0')});db[_0xeb30('0x73')]['belongsTo'](db[_0xeb30('0x71')],{'as':_0xeb30('0x165'),'foreignKey':_0xeb30('0x166'),'onDelete':'cascade'});db[_0xeb30('0x73')][_0xeb30('0x128')](db[_0xeb30('0xf7')],{'as':_0xeb30('0x171'),'foreignKey':'ListId','onDelete':_0xeb30('0x115')});db[_0xeb30('0x73')]['belongsTo'](db[_0xeb30('0x10')],{'as':_0xeb30('0x192'),'foreignKey':_0xeb30('0x116')});db[_0xeb30('0x73')]['belongsTo'](db[_0xeb30('0x19')],{'as':_0xeb30('0x1a1'),'foreignKey':_0xeb30('0x152'),'onDelete':_0xeb30('0x115')});db[_0xeb30('0x73')][_0xeb30('0x128')](db[_0xeb30('0x1a2')],{'as':_0xeb30('0x1a2'),'foreignKey':_0xeb30('0x1a3'),'onDelete':_0xeb30('0x115')});db[_0xeb30('0x73')][_0xeb30('0x128')](db[_0xeb30('0x10')],{'as':_0xeb30('0x176'),'foreignKey':'OwnerId'});db['CmHopperBlack'][_0xeb30('0x128')](db[_0xeb30('0x71')],{'as':_0xeb30('0x165'),'foreignKey':'ContactId','onDelete':_0xeb30('0x115')});db[_0xeb30('0x74')][_0xeb30('0x128')](db[_0xeb30('0xf7')],{'as':_0xeb30('0x171'),'foreignKey':_0xeb30('0x172'),'onDelete':_0xeb30('0x115')});db[_0xeb30('0x74')][_0xeb30('0x128')](db[_0xeb30('0x19')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0xeb30('0x115')});db[_0xeb30('0x74')]['belongsTo'](db[_0xeb30('0x1a2')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':'cascade'});db[_0xeb30('0x1a4')][_0xeb30('0x11b')](db[_0xeb30('0x7f')],{'as':{'plural':_0xeb30('0x1a5'),'singular':_0xeb30('0x1a6')},'foreignKey':'AutomationAllId','onDelete':_0xeb30('0x115'),'hooks':!![]});db['Automation'][_0xeb30('0x11b')](db[_0xeb30('0x7f')],{'as':{'plural':_0xeb30('0x1a7'),'singular':_0xeb30('0x1a8')},'foreignKey':_0xeb30('0x1a9'),'onDelete':'cascade','hooks':!![]});db['Automation']['hasMany'](db[_0xeb30('0x7b')],{'as':_0xeb30('0x1aa'),'foreignKey':'AutomationId','onDelete':_0xeb30('0x115'),'hooks':!![]});db[_0xeb30('0x7d')][_0xeb30('0x11b')](db[_0xeb30('0x7d')],{'as':_0xeb30('0x16d'),'foreignKey':_0xeb30('0x1ab'),'onDelete':'cascade'});db[_0xeb30('0x81')][_0xeb30('0x11b')](db[_0xeb30('0x81')],{'as':_0xeb30('0x1ac'),'foreignKey':_0xeb30('0x17e'),'onDelete':_0xeb30('0x115'),'hooks':!![],'required':![]});db[_0xeb30('0x81')][_0xeb30('0x11b')](db[_0xeb30('0x17')],{'as':_0xeb30('0x1ad'),'foreignKey':_0xeb30('0x17e'),'onDelete':_0xeb30('0x168')});db[_0xeb30('0x81')][_0xeb30('0x11b')](db[_0xeb30('0x40')],{'as':_0xeb30('0x1ae'),'foreignKey':_0xeb30('0x17e')});db[_0xeb30('0x81')][_0xeb30('0x11b')](db['ChatApplication'],{'as':_0xeb30('0x1af'),'foreignKey':'IntervalId'});db[_0xeb30('0x81')][_0xeb30('0x11b')](db['FaxApplication'],{'as':_0xeb30('0x1b0'),'foreignKey':_0xeb30('0x17e')});db['Interval'][_0xeb30('0x11b')](db[_0xeb30('0x51')],{'as':'SmsApplications','foreignKey':_0xeb30('0x17e')});db[_0xeb30('0x88')][_0xeb30('0x128')](db[_0xeb30('0x3a')],{});db[_0xeb30('0x88')][_0xeb30('0x128')](db[_0xeb30('0x9c')],{'foreignKey':'DefaultReportId'});db[_0xeb30('0x88')][_0xeb30('0x128')](db[_0xeb30('0x1b1')],{'foreignKey':_0xeb30('0x1b2')});db[_0xeb30('0x8a')][_0xeb30('0x12d')](db[_0xeb30('0x1b3')],{'as':_0xeb30('0x1b4'),'through':_0xeb30('0x1b5'),'onDelete':_0xeb30('0x168')});db[_0xeb30('0x8c')][_0xeb30('0x12d')](db[_0xeb30('0x71')],{'through':_0xeb30('0x19f')});db[_0xeb30('0x8c')][_0xeb30('0x12d')](db[_0xeb30('0x65')],{'through':_0xeb30('0x195')});db['Tag'][_0xeb30('0x12d')](db[_0xeb30('0x121')],{'through':_0xeb30('0x177')});db[_0xeb30('0x8c')][_0xeb30('0x12d')](db['SmsInteraction'],{'through':_0xeb30('0x189')});db[_0xeb30('0x8c')][_0xeb30('0x12d')](db[_0xeb30('0x49')],{'through':_0xeb30('0x184')});db[_0xeb30('0x8c')]['belongsToMany'](db[_0xeb30('0x5c')],{'through':_0xeb30('0x18e')});db[_0xeb30('0x8c')][_0xeb30('0x12d')](db[_0xeb30('0x105')],{'through':_0xeb30('0x1b6')});db[_0xeb30('0x19b')][_0xeb30('0x128')](db[_0xeb30('0x8e')],{'as':'ItemType','foreignKey':'ItemTypeId'});db[_0xeb30('0x91')][_0xeb30('0x128')](db[_0xeb30('0x73')],{'as':_0xeb30('0x1b7'),'foreignKey':_0xeb30('0x1a0')});db[_0xeb30('0x19b')][_0xeb30('0x128')](db['CmContact'],{'as':_0xeb30('0x165'),'foreignKey':'CmContactId'});db[_0xeb30('0x95')][_0xeb30('0x11b')](db[_0xeb30('0x7f')],{'as':{'plural':_0xeb30('0x1b8'),'singular':_0xeb30('0x1b9')},'foreignKey':_0xeb30('0x1ba'),'onDelete':_0xeb30('0x115'),'hooks':!![]});db[_0xeb30('0x95')][_0xeb30('0x11b')](db[_0xeb30('0x7f')],{'as':{'plural':_0xeb30('0x1bb'),'singular':_0xeb30('0x1bc')},'foreignKey':_0xeb30('0x1bd'),'onDelete':_0xeb30('0x115'),'hooks':!![]});db[_0xeb30('0x95')][_0xeb30('0x11b')](db[_0xeb30('0x7b')],{'as':_0xeb30('0x1aa'),'foreignKey':_0xeb30('0x1be'),'onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport'][_0xeb30('0x11b')](db[_0xeb30('0xa0')],{'as':_0xeb30('0x1bf'),'onDelete':_0xeb30('0x115'),'foreignKey':_0xeb30('0x1b2'),'hooks':!![]});db[_0xeb30('0x9c')][_0xeb30('0x11b')](db['AnalyticFieldReport'],{'as':_0xeb30('0x1bf'),'onDelete':_0xeb30('0x115'),'foreignKey':'DefaultReportId'});db['AnalyticMetric'][_0xeb30('0x11b')](db[_0xeb30('0xa0')],{'as':_0xeb30('0x1bf'),'onDelete':'cascade','foreignKey':_0xeb30('0x1c0')});db[_0xeb30('0xa0')][_0xeb30('0x128')](db['AnalyticMetric'],{'foreignKey':_0xeb30('0x1c0')});db[_0xeb30('0x1c1')][_0xeb30('0x11b')](db[_0xeb30('0x1c2')],{'as':_0xeb30('0x1c3'),'onDelete':_0xeb30('0x115'),'foreignKey':'AccountId'});db[_0xeb30('0x1c2')][_0xeb30('0x11b')](db[_0xeb30('0xa5')],{'as':_0xeb30('0x1c4'),'onDelete':'cascade','foreignKey':_0xeb30('0x1c5')});db['SalesforceConfiguration'][_0xeb30('0x11b')](db[_0xeb30('0xa5')],{'as':_0xeb30('0x1c6'),'onDelete':_0xeb30('0x115'),'foreignKey':_0xeb30('0x1c7')});db[_0xeb30('0x1c2')][_0xeb30('0x11b')](db['SalesforceField'],{'as':_0xeb30('0x1bf'),'onDelete':_0xeb30('0x115'),'foreignKey':_0xeb30('0x1c8')});db[_0xeb30('0x1c2')][_0xeb30('0x128')](db['SalesforceAccount'],{'as':'Account','foreignKey':_0xeb30('0x1c9')});db[_0xeb30('0xa5')]['hasMany'](db[_0xeb30('0xa5')],{'as':_0xeb30('0x1ca'),'foreignKey':_0xeb30('0x1c5')});db[_0xeb30('0xa5')][_0xeb30('0x11b')](db[_0xeb30('0xa5')],{'as':_0xeb30('0x1cb'),'foreignKey':'DescriptionId'});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0xeb30('0x1cc'),'foreignKey':_0xeb30('0x1c8')});db['SalesforceField']['belongsTo'](db[_0xeb30('0x1cd')],{'as':_0xeb30('0x1cd'),'foreignKey':_0xeb30('0x1ce')});db['SugarcrmAccount'][_0xeb30('0x11b')](db[_0xeb30('0xa8')],{'as':_0xeb30('0x1c3'),'onDelete':'cascade','foreignKey':_0xeb30('0x1c9')});db[_0xeb30('0xa8')][_0xeb30('0x11b')](db[_0xeb30('0xaa')],{'as':_0xeb30('0x1c4'),'onDelete':_0xeb30('0x115'),'foreignKey':_0xeb30('0x1c5')});db[_0xeb30('0xa8')][_0xeb30('0x11b')](db[_0xeb30('0xaa')],{'as':'Descriptions','onDelete':_0xeb30('0x115'),'foreignKey':_0xeb30('0x1c7')});db[_0xeb30('0xa8')][_0xeb30('0x11b')](db['SugarcrmField'],{'as':'Fields','onDelete':_0xeb30('0x115'),'foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0xeb30('0x128')](db[_0xeb30('0xa7')],{'as':'Account','foreignKey':_0xeb30('0x1c9')});db[_0xeb30('0xaa')][_0xeb30('0x11b')](db[_0xeb30('0xaa')],{'as':_0xeb30('0x1ca'),'foreignKey':_0xeb30('0x1c5')});db[_0xeb30('0xaa')][_0xeb30('0x11b')](db[_0xeb30('0xaa')],{'as':_0xeb30('0x1cb'),'foreignKey':_0xeb30('0x1c7')});db['SugarcrmField']['hasMany'](db[_0xeb30('0xaa')],{'as':_0xeb30('0x1cc'),'foreignKey':_0xeb30('0x1c8')});db[_0xeb30('0xaa')]['belongsTo'](db[_0xeb30('0x1cd')],{'as':_0xeb30('0x1cd'),'foreignKey':_0xeb30('0x1ce')});db[_0xeb30('0x1cf')][_0xeb30('0x11b')](db[_0xeb30('0xac')],{'as':_0xeb30('0x1c3'),'onDelete':'cascade','foreignKey':_0xeb30('0x1c9')});db[_0xeb30('0xac')][_0xeb30('0x11b')](db[_0xeb30('0xae')],{'as':_0xeb30('0x1c4'),'onDelete':_0xeb30('0x115'),'foreignKey':_0xeb30('0x1c5')});db[_0xeb30('0xac')][_0xeb30('0x11b')](db['DeskField'],{'as':_0xeb30('0x1c6'),'onDelete':_0xeb30('0x115'),'foreignKey':'DescriptionId'});db[_0xeb30('0xac')]['hasMany'](db[_0xeb30('0xae')],{'as':_0xeb30('0x1bf'),'onDelete':'cascade','foreignKey':_0xeb30('0x1c8')});db[_0xeb30('0xac')]['belongsTo'](db['DeskAccount'],{'as':_0xeb30('0x175'),'foreignKey':_0xeb30('0x1c9')});db[_0xeb30('0xac')][_0xeb30('0x12d')](db['Tag'],{'through':_0xeb30('0x1d0')});db[_0xeb30('0xae')][_0xeb30('0x11b')](db[_0xeb30('0xae')],{'as':_0xeb30('0x1ca'),'foreignKey':'SubjectId'});db['DeskField'][_0xeb30('0x11b')](db[_0xeb30('0xae')],{'as':_0xeb30('0x1cb'),'foreignKey':_0xeb30('0x1c7')});db[_0xeb30('0xae')]['hasMany'](db[_0xeb30('0xae')],{'as':_0xeb30('0x1cc'),'foreignKey':_0xeb30('0x1c8')});db[_0xeb30('0xae')][_0xeb30('0x128')](db[_0xeb30('0x1cd')],{'as':_0xeb30('0x1cd'),'foreignKey':_0xeb30('0x1ce')});db['ZohoAccount']['hasMany'](db[_0xeb30('0x1d1')],{'as':_0xeb30('0x1c3'),'onDelete':_0xeb30('0x115'),'foreignKey':_0xeb30('0x1c9')});db['ZohoConfiguration'][_0xeb30('0x11b')](db['ZohoField'],{'as':_0xeb30('0x1c4'),'onDelete':_0xeb30('0x115'),'foreignKey':_0xeb30('0x1c5')});db[_0xeb30('0x1d1')][_0xeb30('0x11b')](db[_0xeb30('0xb3')],{'as':_0xeb30('0x1c6'),'onDelete':_0xeb30('0x115'),'foreignKey':_0xeb30('0x1c7')});db['ZohoConfiguration'][_0xeb30('0x11b')](db['ZohoField'],{'as':_0xeb30('0x1bf'),'onDelete':_0xeb30('0x115'),'foreignKey':'FieldId'});db[_0xeb30('0x1d1')][_0xeb30('0x128')](db[_0xeb30('0xb0')],{'as':_0xeb30('0x175'),'foreignKey':'AccountId'});db['ZohoField'][_0xeb30('0x11b')](db[_0xeb30('0xb3')],{'as':_0xeb30('0x1ca'),'foreignKey':_0xeb30('0x1c5')});db[_0xeb30('0xb3')]['hasMany'](db[_0xeb30('0xb3')],{'as':_0xeb30('0x1cb'),'foreignKey':'DescriptionId'});db[_0xeb30('0xb3')]['hasMany'](db[_0xeb30('0xb3')],{'as':_0xeb30('0x1cc'),'foreignKey':_0xeb30('0x1c8')});db['ZohoField'][_0xeb30('0x128')](db[_0xeb30('0x1cd')],{'as':_0xeb30('0x1cd'),'foreignKey':_0xeb30('0x1ce')});db[_0xeb30('0xb5')][_0xeb30('0x11b')](db[_0xeb30('0xb7')],{'as':_0xeb30('0x1c3'),'onDelete':_0xeb30('0x115'),'foreignKey':_0xeb30('0x1c9')});db['ZendeskConfiguration'][_0xeb30('0x11b')](db[_0xeb30('0x1d2')],{'as':_0xeb30('0x1c4'),'foreignKey':_0xeb30('0x1c5')});db['ZendeskConfiguration'][_0xeb30('0x11b')](db[_0xeb30('0x1d2')],{'as':'Descriptions','foreignKey':_0xeb30('0x1c7')});db[_0xeb30('0xb7')]['hasMany'](db[_0xeb30('0x1d2')],{'as':_0xeb30('0x1bf'),'foreignKey':_0xeb30('0x1c8')});db[_0xeb30('0xb7')]['belongsTo'](db[_0xeb30('0xb5')],{'as':'Account','foreignKey':_0xeb30('0x1c9')});db[_0xeb30('0xb7')][_0xeb30('0x12d')](db['Tag'],{'through':_0xeb30('0x1d3')});db['ZendeskField'][_0xeb30('0x11b')](db[_0xeb30('0x1d2')],{'as':'Subject','foreignKey':_0xeb30('0x1c5')});db[_0xeb30('0x1d2')][_0xeb30('0x11b')](db[_0xeb30('0x1d2')],{'as':_0xeb30('0x1cb'),'foreignKey':_0xeb30('0x1c7')});db['ZendeskField'][_0xeb30('0x11b')](db[_0xeb30('0x1d2')],{'as':'Field','foreignKey':_0xeb30('0x1c8')});db[_0xeb30('0x1d2')][_0xeb30('0x128')](db[_0xeb30('0x1cd')],{'as':'Variable','foreignKey':'VariableId'});db[_0xeb30('0x1d4')][_0xeb30('0x11b')](db['FreshdeskConfiguration'],{'as':_0xeb30('0x1c3'),'onDelete':_0xeb30('0x115'),'foreignKey':_0xeb30('0x1c9')});db[_0xeb30('0xb9')]['hasMany'](db['FreshdeskField'],{'as':_0xeb30('0x1c4'),'onDelete':_0xeb30('0x115'),'foreignKey':_0xeb30('0x1c5')});db[_0xeb30('0xb9')]['hasMany'](db[_0xeb30('0xbb')],{'as':_0xeb30('0x1c6'),'onDelete':_0xeb30('0x115'),'foreignKey':'DescriptionId'});db[_0xeb30('0xb9')]['hasMany'](db[_0xeb30('0xbb')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xeb30('0x1c8')});db[_0xeb30('0xb9')]['belongsTo'](db[_0xeb30('0x1d4')],{'as':_0xeb30('0x175'),'foreignKey':_0xeb30('0x1c9')});db[_0xeb30('0xb9')][_0xeb30('0x12d')](db[_0xeb30('0x8c')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xeb30('0xbb')][_0xeb30('0x11b')](db[_0xeb30('0xbb')],{'as':_0xeb30('0x1ca'),'foreignKey':_0xeb30('0x1c5')});db[_0xeb30('0xbb')][_0xeb30('0x11b')](db[_0xeb30('0xbb')],{'as':_0xeb30('0x1cb'),'foreignKey':_0xeb30('0x1c7')});db[_0xeb30('0xbb')][_0xeb30('0x11b')](db[_0xeb30('0xbb')],{'as':'Field','foreignKey':_0xeb30('0x1c8')});db[_0xeb30('0xbb')][_0xeb30('0x128')](db[_0xeb30('0x1cd')],{'as':'Variable','foreignKey':_0xeb30('0x1ce')});db[_0xeb30('0xbd')][_0xeb30('0x11b')](db['VtigerConfiguration'],{'as':_0xeb30('0x1c3'),'onDelete':_0xeb30('0x115'),'foreignKey':_0xeb30('0x1c9')});db[_0xeb30('0xbe')][_0xeb30('0x11b')](db[_0xeb30('0xbf')],{'as':'Subjects','foreignKey':_0xeb30('0x1c5')});db[_0xeb30('0xbe')][_0xeb30('0x11b')](db[_0xeb30('0xbf')],{'as':_0xeb30('0x1c6'),'foreignKey':_0xeb30('0x1c7')});db[_0xeb30('0xbe')]['hasMany'](db[_0xeb30('0xbf')],{'as':_0xeb30('0x1bf'),'foreignKey':_0xeb30('0x1c8')});db['VtigerConfiguration']['belongsTo'](db[_0xeb30('0xbd')],{'as':_0xeb30('0x175'),'foreignKey':_0xeb30('0x1c9')});db[_0xeb30('0xbf')][_0xeb30('0x11b')](db[_0xeb30('0xbf')],{'as':_0xeb30('0x1ca'),'foreignKey':'SubjectId'});db[_0xeb30('0xbf')][_0xeb30('0x11b')](db['VtigerField'],{'as':_0xeb30('0x1cb'),'foreignKey':_0xeb30('0x1c7')});db['VtigerField'][_0xeb30('0x11b')](db[_0xeb30('0xbf')],{'as':'Field','foreignKey':_0xeb30('0x1c8')});db['VtigerField']['belongsTo'](db[_0xeb30('0x1cd')],{'as':_0xeb30('0x1cd'),'foreignKey':_0xeb30('0x1ce')});db[_0xeb30('0xc1')]['hasMany'](db['ServicenowConfiguration'],{'as':_0xeb30('0x1c3'),'onDelete':'cascade','foreignKey':_0xeb30('0x1c9')});db[_0xeb30('0xc3')][_0xeb30('0x11b')](db[_0xeb30('0xc5')],{'as':_0xeb30('0x1c4'),'foreignKey':_0xeb30('0x1c5')});db[_0xeb30('0xc3')][_0xeb30('0x11b')](db[_0xeb30('0xc5')],{'as':'Descriptions','foreignKey':_0xeb30('0x1c7')});db['ServicenowConfiguration'][_0xeb30('0x11b')](db[_0xeb30('0xc5')],{'as':_0xeb30('0x1bf'),'foreignKey':_0xeb30('0x1c8')});db[_0xeb30('0xc3')][_0xeb30('0x128')](db[_0xeb30('0xc1')],{'as':_0xeb30('0x175'),'foreignKey':'AccountId'});db[_0xeb30('0xc5')][_0xeb30('0x11b')](db['ServicenowField'],{'as':'Subject','foreignKey':_0xeb30('0x1c5')});db[_0xeb30('0xc5')]['hasMany'](db[_0xeb30('0xc5')],{'as':_0xeb30('0x1cb'),'foreignKey':_0xeb30('0x1c7')});db[_0xeb30('0xc5')][_0xeb30('0x11b')](db[_0xeb30('0xc5')],{'as':'Field','foreignKey':'FieldId'});db[_0xeb30('0xc5')][_0xeb30('0x128')](db[_0xeb30('0x1cd')],{'as':'Variable','foreignKey':_0xeb30('0x1ce')});db[_0xeb30('0xc7')][_0xeb30('0x11b')](db[_0xeb30('0xc8')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xeb30('0x1c9')});db['Dynamics365Account'][_0xeb30('0x128')](db['CloudProvider'],{'as':_0xeb30('0x10c'),'foreignKey':_0xeb30('0x167')});db[_0xeb30('0xc8')][_0xeb30('0x11b')](db[_0xeb30('0xca')],{'as':_0xeb30('0x1c4'),'onDelete':_0xeb30('0x115'),'foreignKey':'SubjectId'});db[_0xeb30('0xc8')][_0xeb30('0x11b')](db['Dynamics365Field'],{'as':_0xeb30('0x1c6'),'onDelete':_0xeb30('0x115'),'foreignKey':'DescriptionId'});db[_0xeb30('0xc8')][_0xeb30('0x11b')](db[_0xeb30('0xca')],{'as':_0xeb30('0x1bf'),'onDelete':'cascade','foreignKey':_0xeb30('0x1c8')});db[_0xeb30('0xc8')][_0xeb30('0x128')](db[_0xeb30('0xc7')],{'as':_0xeb30('0x175'),'foreignKey':_0xeb30('0x1c9')});db[_0xeb30('0xca')]['hasMany'](db[_0xeb30('0xca')],{'as':_0xeb30('0x1ca'),'foreignKey':_0xeb30('0x1c5')});db[_0xeb30('0xca')]['hasMany'](db[_0xeb30('0xca')],{'as':'Description','foreignKey':_0xeb30('0x1c7')});db[_0xeb30('0xca')][_0xeb30('0x11b')](db[_0xeb30('0xca')],{'as':_0xeb30('0x1cc'),'foreignKey':_0xeb30('0x1c8')});db[_0xeb30('0xca')][_0xeb30('0x128')](db[_0xeb30('0x1cd')],{'as':_0xeb30('0x1cd'),'foreignKey':_0xeb30('0x1ce')});db[_0xeb30('0xcc')][_0xeb30('0x11b')](db[_0xeb30('0xcd')],{'as':'Configurations','onDelete':_0xeb30('0x115'),'foreignKey':_0xeb30('0x1c9')});db[_0xeb30('0xcd')][_0xeb30('0x11b')](db[_0xeb30('0xcf')],{'as':_0xeb30('0x1c4'),'foreignKey':'SubjectId'});db[_0xeb30('0xcd')][_0xeb30('0x11b')](db[_0xeb30('0xcf')],{'as':_0xeb30('0x1c6'),'foreignKey':_0xeb30('0x1c7')});db[_0xeb30('0xcd')][_0xeb30('0x11b')](db['FreshsalesField'],{'as':_0xeb30('0x1bf'),'foreignKey':_0xeb30('0x1c8')});db[_0xeb30('0xcd')][_0xeb30('0x128')](db['FreshsalesAccount'],{'as':_0xeb30('0x175'),'foreignKey':_0xeb30('0x1c9')});db[_0xeb30('0xcf')][_0xeb30('0x11b')](db[_0xeb30('0xcf')],{'as':'Subject','foreignKey':_0xeb30('0x1c5')});db[_0xeb30('0xcf')][_0xeb30('0x11b')](db[_0xeb30('0xcf')],{'as':_0xeb30('0x1cb'),'foreignKey':'DescriptionId'});db['FreshsalesField'][_0xeb30('0x11b')](db[_0xeb30('0xcf')],{'as':_0xeb30('0x1cc'),'foreignKey':_0xeb30('0x1c8')});db[_0xeb30('0xcf')][_0xeb30('0x128')](db[_0xeb30('0x1cd')],{'as':_0xeb30('0x1cd'),'foreignKey':_0xeb30('0x1ce')});db[_0xeb30('0xd0')]['belongsTo'](db['ChatWebsite'],{});db[_0xeb30('0xd0')][_0xeb30('0x128')](db[_0xeb30('0xf7')],{'as':_0xeb30('0x171'),'foreignKey':_0xeb30('0x172')});db['ChatQueueReport'][_0xeb30('0x128')](db[_0xeb30('0x71')],{'as':_0xeb30('0x165'),'foreignKey':_0xeb30('0x166')});db[_0xeb30('0xd0')][_0xeb30('0x128')](db[_0xeb30('0x65')],{});db['ChatQueueReport'][_0xeb30('0x128')](db[_0xeb30('0x67')],{});db['ChatQueueReport'][_0xeb30('0x128')](db[_0xeb30('0x10')],{});db[_0xeb30('0xd0')][_0xeb30('0x128')](db[_0xeb30('0x69')],{});db['ChatInternalMessage'][_0xeb30('0x128')](db[_0xeb30('0x10')],{'onDelete':_0xeb30('0x115'),'foreignKey':_0xeb30('0x1d5')});db['ChatInternalMessage'][_0xeb30('0x128')](db[_0xeb30('0x10')],{'onDelete':_0xeb30('0x115'),'foreignKey':_0xeb30('0x1d6')});db[_0xeb30('0xd7')][_0xeb30('0x11b')](db[_0xeb30('0xd6')],{'foreignKey':_0xeb30('0x1d7'),'onDelete':_0xeb30('0x115')});db['JscriptySessionReport']['hasMany'](db[_0xeb30('0xd4')],{'foreignKey':_0xeb30('0x1d7'),'onDelete':_0xeb30('0x115')});db[_0xeb30('0xd9')]['belongsTo'](db['SmsAccount'],{});db[_0xeb30('0xd9')]['belongsTo'](db['CmList'],{'as':_0xeb30('0x171'),'foreignKey':_0xeb30('0x172')});db[_0xeb30('0xd9')][_0xeb30('0x128')](db['CmContact'],{'as':_0xeb30('0x165'),'foreignKey':_0xeb30('0x166')});db[_0xeb30('0xd9')][_0xeb30('0x128')](db[_0xeb30('0x53')],{});db[_0xeb30('0xd9')][_0xeb30('0x128')](db[_0xeb30('0x55')],{});db[_0xeb30('0xd9')][_0xeb30('0x128')](db['User'],{});db[_0xeb30('0xd9')][_0xeb30('0x128')](db[_0xeb30('0x57')],{});db['JscriptyProject'][_0xeb30('0x11b')](db[_0xeb30('0xd7')],{'foreignKey':_0xeb30('0x1d8')});db[_0xeb30('0xdd')]['hasMany'](db[_0xeb30('0xd6')],{'foreignKey':_0xeb30('0x1d8')});db[_0xeb30('0xdd')][_0xeb30('0x11b')](db[_0xeb30('0xd4')],{'foreignKey':_0xeb30('0x1d8')});db['Team'][_0xeb30('0x12d')](db['User'],{'as':'Agents','through':_0xeb30('0x130')});db['Team'][_0xeb30('0x12d')](db[_0xeb30('0x19')],{'through':_0xeb30('0x15e'),'as':_0xeb30('0x1d9')});db[_0xeb30('0xe7')][_0xeb30('0x12d')](db[_0xeb30('0x139')],{'through':_0xeb30('0x1da'),'as':_0xeb30('0x1db')});db[_0xeb30('0xe7')][_0xeb30('0x12d')](db[_0xeb30('0x69')],{'through':_0xeb30('0x197'),'as':_0xeb30('0x13a')});db[_0xeb30('0xe7')][_0xeb30('0x12d')](db[_0xeb30('0x13b')],{'through':_0xeb30('0x186'),'as':'FaxQueues'});db['Team'][_0xeb30('0x12d')](db[_0xeb30('0x57')],{'through':_0xeb30('0x1dc'),'as':_0xeb30('0x13e')});db[_0xeb30('0xe7')][_0xeb30('0x12d')](db[_0xeb30('0x5f')],{'through':_0xeb30('0x18f'),'as':_0xeb30('0x13f')});db[_0xeb30('0xe7')][_0xeb30('0x12d')](db[_0xeb30('0x10a')],{'through':_0xeb30('0x1dd'),'as':_0xeb30('0x140')});db['Team']['belongsToMany'](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':'VoicePrefixes'});db[_0xeb30('0x1a2')][_0xeb30('0x11b')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xeb30('0x1a3')});db[_0xeb30('0x1a2')][_0xeb30('0x11b')](db[_0xeb30('0x75')],{'as':'HopperFinals','foreignKey':_0xeb30('0x1a3')});db[_0xeb30('0x1a2')]['hasMany'](db['CmHopperHistory'],{'as':_0xeb30('0x19d'),'foreignKey':_0xeb30('0x1a3')});db[_0xeb30('0x1a2')]['hasMany'](db[_0xeb30('0x74')],{'as':_0xeb30('0x153'),'foreignKey':_0xeb30('0x1a3')});db[_0xeb30('0x1a2')]['belongsTo'](db[_0xeb30('0x155')],{'as':_0xeb30('0x155'),'foreignKey':_0xeb30('0x156')});db[_0xeb30('0x1a2')]['belongsTo'](db[_0xeb30('0x155')],{'as':_0xeb30('0x157'),'foreignKey':_0xeb30('0x158')});db[_0xeb30('0x1a2')][_0xeb30('0x128')](db[_0xeb30('0x81')],{'as':'Interval','foreignKey':'IntervalId'});db[_0xeb30('0x1a2')][_0xeb30('0x128')](db[_0xeb30('0xe3')],{'as':_0xeb30('0xe3'),'foreignKey':_0xeb30('0x1de')});db[_0xeb30('0x1a2')]['belongsToMany'](db[_0xeb30('0xf7')],{'as':_0xeb30('0x12e'),'through':_0xeb30('0x1df')});db[_0xeb30('0x1a2')][_0xeb30('0x12d')](db['CmList'],{'as':_0xeb30('0x1e0'),'through':_0xeb30('0x1e1')});db[_0xeb30('0xed')][_0xeb30('0x128')](db['ChatOfflineMessage'],{'as':_0xeb30('0x68'),'foreignKey':_0xeb30('0x17d')});db[_0xeb30('0xf0')][_0xeb30('0x128')](db[_0xeb30('0x3e')],{});db[_0xeb30('0xf0')][_0xeb30('0x128')](db[_0xeb30('0x121')],{});db[_0xeb30('0xf0')][_0xeb30('0x128')](db[_0xeb30('0x3a')],{'foreignKey':'FromMailAccountId','as':_0xeb30('0x1e2')});db[_0xeb30('0xf0')][_0xeb30('0x128')](db[_0xeb30('0x10')],{'foreignKey':_0xeb30('0x1e3'),'as':_0xeb30('0x1e4')});db[_0xeb30('0xf0')][_0xeb30('0x128')](db[_0xeb30('0x10')],{'foreignKey':_0xeb30('0x1e5'),'as':'ToAgent'});db[_0xeb30('0xf0')]['belongsTo'](db[_0xeb30('0x139')],{'foreignKey':'ToMailQueueId','as':_0xeb30('0x1e6')});db[_0xeb30('0xf0')]['belongsTo'](db['MailAccount'],{'foreignKey':_0xeb30('0x1e7'),'as':_0xeb30('0x1e8')});db[_0xeb30('0xf2')][_0xeb30('0x128')](db[_0xeb30('0x67')],{});db['ChatTransferReport']['belongsTo'](db[_0xeb30('0x65')],{});db['ChatTransferReport'][_0xeb30('0x128')](db[_0xeb30('0x141')],{'foreignKey':_0xeb30('0x1e9'),'as':_0xeb30('0x1e2')});db['ChatTransferReport'][_0xeb30('0x128')](db[_0xeb30('0x10')],{'foreignKey':_0xeb30('0x1e3'),'as':_0xeb30('0x1e4')});db[_0xeb30('0xf2')][_0xeb30('0x128')](db[_0xeb30('0x10')],{'foreignKey':_0xeb30('0x1e5'),'as':_0xeb30('0x1ea')});db[_0xeb30('0xf2')][_0xeb30('0x128')](db[_0xeb30('0x69')],{'foreignKey':_0xeb30('0x1eb'),'as':_0xeb30('0x1e6')});db['ChatTransferReport']['belongsTo'](db[_0xeb30('0x141')],{'foreignKey':_0xeb30('0x1ec'),'as':_0xeb30('0x1e8')});db[_0xeb30('0xf3')][_0xeb30('0x128')](db['FaxMessage'],{});db[_0xeb30('0xf3')][_0xeb30('0x128')](db[_0xeb30('0x49')],{});db[_0xeb30('0xf3')]['belongsTo'](db[_0xeb30('0x45')],{'foreignKey':_0xeb30('0x1ed'),'as':_0xeb30('0x1e2')});db[_0xeb30('0xf3')][_0xeb30('0x128')](db[_0xeb30('0x10')],{'foreignKey':_0xeb30('0x1e3'),'as':_0xeb30('0x1e4')});db[_0xeb30('0xf3')][_0xeb30('0x128')](db[_0xeb30('0x10')],{'foreignKey':_0xeb30('0x1e5'),'as':_0xeb30('0x1ea')});db[_0xeb30('0xf3')][_0xeb30('0x128')](db[_0xeb30('0x13b')],{'foreignKey':_0xeb30('0x1ee'),'as':'ToQueue'});db[_0xeb30('0xf3')][_0xeb30('0x128')](db[_0xeb30('0x45')],{'foreignKey':_0xeb30('0x1ef'),'as':_0xeb30('0x1e8')});db[_0xeb30('0xf4')]['belongsTo'](db[_0xeb30('0x5e')],{});db[_0xeb30('0xf4')][_0xeb30('0x128')](db[_0xeb30('0x5c')],{});db[_0xeb30('0xf4')][_0xeb30('0x128')](db['OpenchannelAccount'],{'foreignKey':_0xeb30('0x1f0'),'as':'FromAccount'});db[_0xeb30('0xf4')][_0xeb30('0x128')](db['User'],{'foreignKey':_0xeb30('0x1e3'),'as':_0xeb30('0x1e4')});db[_0xeb30('0xf4')]['belongsTo'](db[_0xeb30('0x10')],{'foreignKey':_0xeb30('0x1e5'),'as':_0xeb30('0x1ea')});db[_0xeb30('0xf4')][_0xeb30('0x128')](db['OpenchannelQueue'],{'foreignKey':_0xeb30('0x1f1'),'as':'ToQueue'});db[_0xeb30('0xf4')][_0xeb30('0x128')](db[_0xeb30('0x146')],{'foreignKey':_0xeb30('0x1f2'),'as':_0xeb30('0x1e8')});db['SmsTransferReport'][_0xeb30('0x128')](db[_0xeb30('0x55')],{});db[_0xeb30('0x1f3')][_0xeb30('0x128')](db[_0xeb30('0x53')],{});db[_0xeb30('0x1f3')][_0xeb30('0x128')](db['SmsAccount'],{'foreignKey':_0xeb30('0x1f4'),'as':_0xeb30('0x1e2')});db[_0xeb30('0x1f3')][_0xeb30('0x128')](db[_0xeb30('0x10')],{'foreignKey':_0xeb30('0x1e3'),'as':_0xeb30('0x1e4')});db[_0xeb30('0x1f3')][_0xeb30('0x128')](db[_0xeb30('0x10')],{'foreignKey':'ToUserId','as':_0xeb30('0x1ea')});db[_0xeb30('0x1f3')][_0xeb30('0x128')](db[_0xeb30('0x57')],{'foreignKey':_0xeb30('0x1f5'),'as':_0xeb30('0x1e6')});db[_0xeb30('0x1f3')][_0xeb30('0x128')](db[_0xeb30('0x4f')],{'foreignKey':_0xeb30('0x1f6'),'as':'ToAccount'});db[_0xeb30('0xf7')][_0xeb30('0x11b')](db[_0xeb30('0x7d')],{'as':'Dispositions','foreignKey':'ListId','onDelete':_0xeb30('0x115')});db[_0xeb30('0xf7')][_0xeb30('0x11b')](db[_0xeb30('0x79')],{'as':_0xeb30('0x1f7'),'foreignKey':_0xeb30('0x172')});db['CmList'][_0xeb30('0x11b')](db[_0xeb30('0x71')],{'as':'Contacts','onDelete':'cascade','foreignKey':'ListId'});db[_0xeb30('0xf7')][_0xeb30('0x11b')](db[_0xeb30('0x75')],{'as':_0xeb30('0x11c'),'foreignKey':_0xeb30('0x172')});db[_0xeb30('0xf7')][_0xeb30('0x11b')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':'ListId'});db[_0xeb30('0xf7')][_0xeb30('0x11b')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xeb30('0x172')});db[_0xeb30('0xf7')][_0xeb30('0x12d')](db[_0xeb30('0x19')],{'as':_0xeb30('0x1f8'),'through':_0xeb30('0x15b')});db[_0xeb30('0xf7')]['belongsToMany'](db[_0xeb30('0x10')],{'as':_0xeb30('0x15c'),'through':'cm_user_has_lists'});db[_0xeb30('0xf9')][_0xeb30('0x11b')](db[_0xeb30('0x17')],{'as':_0xeb30('0x1ad'),'onDelete':_0xeb30('0x115')});db[_0xeb30('0xf9')][_0xeb30('0x12d')](db['User'],{'as':_0xeb30('0x15c'),'through':_0xeb30('0x10f')});db[_0xeb30('0xf9')][_0xeb30('0x12d')](db[_0xeb30('0xe7')],{'through':_0xeb30('0x10e'),'as':_0xeb30('0x15d')});db[_0xeb30('0xfb')][_0xeb30('0x11b')](db[_0xeb30('0x10')],{'as':_0xeb30('0x17a'),'foreignKey':_0xeb30('0x129')});db[_0xeb30('0xfb')]['hasMany'](db[_0xeb30('0xfd')],{'as':'UserProfileSections','foreignKey':_0xeb30('0x129'),'onDelete':_0xeb30('0x115')});db[_0xeb30('0xfd')][_0xeb30('0x11b')](db[_0xeb30('0xff')],{'as':'Resources','foreignKey':'sectionId','onDelete':_0xeb30('0x115')});db[_0xeb30('0x14a')][_0xeb30('0x11b')](db['Disposition'],{'as':_0xeb30('0x16d'),'foreignKey':_0xeb30('0x1f9'),'onDelete':_0xeb30('0x115')});db[_0xeb30('0x14a')][_0xeb30('0x11b')](db[_0xeb30('0x16e')],{'as':_0xeb30('0x16f'),'foreignKey':_0xeb30('0x1f9')});db[_0xeb30('0x14a')][_0xeb30('0x11b')](db[_0xeb30('0x1fa')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db[_0xeb30('0x14a')][_0xeb30('0x11b')](db[_0xeb30('0x105')],{'as':_0xeb30('0x170')});db[_0xeb30('0x14a')][_0xeb30('0x11b')](db[_0xeb30('0x1fb')],{'as':_0xeb30('0x14f'),'foreignKey':_0xeb30('0x1f9'),'onDelete':_0xeb30('0x115')});db[_0xeb30('0x14a')][_0xeb30('0x128')](db[_0xeb30('0xf7')],{'as':'List','foreignKey':_0xeb30('0x172')});db[_0xeb30('0x14a')][_0xeb30('0x128')](db[_0xeb30('0x83')],{'as':_0xeb30('0x159'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount'][_0xeb30('0x12d')](db[_0xeb30('0x10')],{'as':'Agents','through':_0xeb30('0x14c')});db['WhatsappApplication'][_0xeb30('0x128')](db[_0xeb30('0x10')],{'onDelete':'restrict'});db[_0xeb30('0x1fb')]['belongsTo'](db[_0xeb30('0x10a')],{'onDelete':_0xeb30('0x168')});db[_0xeb30('0x1fb')][_0xeb30('0x128')](db[_0xeb30('0x14a')],{'onDelete':_0xeb30('0x168')});db[_0xeb30('0x1fb')][_0xeb30('0x128')](db[_0xeb30('0x81')],{'onDelete':'restrict','foreignKey':_0xeb30('0x17e')});db['WhatsappApplication']['belongsTo'](db[_0xeb30('0x8c')],{'onDelete':_0xeb30('0x168'),'foreignKey':_0xeb30('0x182')});db['WhatsappInteraction'][_0xeb30('0x11b')](db[_0xeb30('0x1fa')],{'as':_0xeb30('0x160'),'onDelete':_0xeb30('0x115'),'foreignKey':_0xeb30('0x1fc')});db[_0xeb30('0x105')][_0xeb30('0x128')](db[_0xeb30('0x14a')],{'as':'Account','foreignKey':_0xeb30('0x1f9')});db[_0xeb30('0x105')][_0xeb30('0x128')](db[_0xeb30('0x71')],{'as':_0xeb30('0x165'),'foreignKey':_0xeb30('0x166')});db[_0xeb30('0x105')][_0xeb30('0x128')](db['User'],{'as':'Owner','foreignKey':'UserId'});db['WhatsappInteraction'][_0xeb30('0x12d')](db[_0xeb30('0x8c')],{'through':_0xeb30('0x1b6'),'as':_0xeb30('0x178')});db[_0xeb30('0x105')][_0xeb30('0x12d')](db[_0xeb30('0x8c')],{'through':_0xeb30('0x1b6'),'as':_0xeb30('0x179')});db['WhatsappInteraction'][_0xeb30('0x12d')](db[_0xeb30('0x10')],{'as':_0xeb30('0x17a'),'through':'user_has_whatsapp_interactions','foreignKey':_0xeb30('0x1fc')});db['WhatsappMessage'][_0xeb30('0x128')](db['User'],{'as':_0xeb30('0x10')});db[_0xeb30('0x1fa')][_0xeb30('0x128')](db[_0xeb30('0x71')],{'onDelete':_0xeb30('0x115'),'as':_0xeb30('0x165')});db[_0xeb30('0x1fa')][_0xeb30('0x128')](db[_0xeb30('0x105')],{'onDelete':'cascade','as':_0xeb30('0x17b'),'foreignKey':_0xeb30('0x1fc')});db['WhatsappMessage'][_0xeb30('0x128')](db[_0xeb30('0x14a')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0xeb30('0x106')][_0xeb30('0x128')](db[_0xeb30('0x14a')],{});db[_0xeb30('0x106')][_0xeb30('0x128')](db[_0xeb30('0xf7')],{'as':_0xeb30('0x171'),'foreignKey':_0xeb30('0x172')});db[_0xeb30('0x106')][_0xeb30('0x128')](db[_0xeb30('0x71')],{'as':_0xeb30('0x165'),'foreignKey':_0xeb30('0x166')});db[_0xeb30('0x106')]['belongsTo'](db['WhatsappInteraction'],{});db['WhatsappQueueReport'][_0xeb30('0x128')](db[_0xeb30('0x10a')],{});db['WhatsappQueueReport'][_0xeb30('0x128')](db['WhatsappMessage'],{});db[_0xeb30('0x106')]['belongsTo'](db['User'],{});db[_0xeb30('0x108')][_0xeb30('0x128')](db[_0xeb30('0x1fa')],{});db[_0xeb30('0x108')][_0xeb30('0x128')](db['WhatsappInteraction'],{});db[_0xeb30('0x108')]['belongsTo'](db[_0xeb30('0x14a')],{'foreignKey':_0xeb30('0x1fd'),'as':_0xeb30('0x1e2')});db['WhatsappTransferReport'][_0xeb30('0x128')](db[_0xeb30('0x14a')],{'foreignKey':_0xeb30('0x1fe'),'as':_0xeb30('0x1e8')});db['WhatsappTransferReport'][_0xeb30('0x128')](db[_0xeb30('0x10a')],{'foreignKey':_0xeb30('0x1ff'),'as':_0xeb30('0x1e6')});db[_0xeb30('0x108')]['belongsTo'](db[_0xeb30('0x10')],{'foreignKey':_0xeb30('0x1e3'),'as':'FromAgent'});db[_0xeb30('0x108')][_0xeb30('0x128')](db[_0xeb30('0x10')],{'foreignKey':_0xeb30('0x1e5'),'as':_0xeb30('0x1ea')});db[_0xeb30('0x10a')][_0xeb30('0x12d')](db[_0xeb30('0x10')],{'as':_0xeb30('0x15c'),'through':_0xeb30('0x36'),'foreignKey':_0xeb30('0x200')});db[_0xeb30('0x10a')][_0xeb30('0x12d')](db[_0xeb30('0xe7')],{'through':_0xeb30('0x1dd'),'as':_0xeb30('0x15d')});db[_0xeb30('0x110')][_0xeb30('0x128')](db[_0xeb30('0x10')],{'as':_0xeb30('0x201'),'foreignKey':_0xeb30('0x116'),'onDelete':_0xeb30('0x115'),'hooks':!![]});db[_0xeb30('0x10c')]['hasOne'](db['Dynamics365Account'],{'as':_0xeb30('0xc7'),'onDelete':_0xeb30('0x168')});db[_0xeb30('0x10c')][_0xeb30('0x114')](db[_0xeb30('0x37')],{'as':'Imap','onDelete':_0xeb30('0x168')});db[_0xeb30('0x10c')][_0xeb30('0x114')](db[_0xeb30('0x169')],{'as':_0xeb30('0x16c'),'onDelete':_0xeb30('0x168')});module[_0xeb30('0x202')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xe2ab=['user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperBlacks','belongsTo','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','AgentReports','ContactId','MailServerIn','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','TemplateId','Teams','Account','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','TagId','MailQueueReport','ListId','Items','FaxAccountId','Exntensions','List','fax_interaction_has_tags','FaxInteractionId','AttachmentId','FaxQueueReport','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','ChatMessage','user_has_chat_websites','Queue','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CmCompany','CompanyId','Phones','CmContactId','Hoppers','HopperHistories','JscriptySessions','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Agent','All','OneAll','Any','OneAny','AutomationAnyId','Action','Actions','AutomationId','ParentId','MailApplications','ChatApplications','FaxApplications','DefaultReportId','CustomReportId','whatsapp_interaction_has_tags','ContactItemType','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','SalesforceConfiguration','AccountId','SalesforceField','SubjectId','Descriptions','FieldId','SalesforceAccount','DescriptionId','VariableId','Configurations','Subjects','Subject','Description','DeskAccount','int_desk_configuration_has_tags','Field','ZohoConfiguration','ZendeskConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowField','FreshsalesConfiguration','FromId','ToId','JscriptyQuestionReport','SessionId','JscriptyAnswerReport','ProjectId','team_has_mail_queues','team_has_fax_queues','FaxQueues','team_has_whatsapp_queues','WhatsappQueues','CampaignId','TrunkBackupId','SquareProject','SquareProjectId','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','FromChatWebsiteId','ToChatQueueId','ToQueue','ToAccount','FaxTransferReport','FromFaxAccountId','ToFaxAccountId','FromOpenchannelAccountId','ToSmsAccountId','Contacts','HopperHistory','Queues','TeamVoicePrefix','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','jstz','determine','motion2','xcall','xC@LL1234','mysql','name','utf8_general_ci','sequelizeHistory','defaultsDeep','utf8mb4','utf8','username','password','options','database','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','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','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/contactItemType/contactItemType.model','CmContactHasItem','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/integration/integration.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','JscriptyProject','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','UserId','userSetting','hasMany','Extensions','HopperFinals','OpenchannelInteraction','OpenchannelInteractions','SmsInteraction','SmsInteractions','MailInteraction','MailInteractions','WhatsappInteraction','SenderId','SET\x20NULL','userProfileId','Groups','chat_group_has_users','cm_user_has_contacts','belongsToMany','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','VoicePrefix','VoicePrefixes','MailQueues','ChatQueues','UserChatQueue','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueue','UserWhatsappQueue','cm_user_has_lists','ChatWebsites','FaxAccounts'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xe2ab,0xc4));var _0xbe2a=function(_0x1a32e1,_0x401c10){_0x1a32e1=_0x1a32e1-0x0;var _0x4658c6=_0xe2ab[_0x1a32e1];return _0x4658c6;};'use strict';var config=require(_0xbe2a('0x0'));var Sequelize=require(_0xbe2a('0x1'));var _=require(_0xbe2a('0x2'));var jstz=require(_0xbe2a('0x3'));var timezone=jstz[_0xbe2a('0x4')]();config[_0xbe2a('0x1')]=_['defaultsDeep'](config[_0xbe2a('0x1')],{'database':_0xbe2a('0x5'),'username':_0xbe2a('0x6'),'password':_0xbe2a('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xbe2a('0x8'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xbe2a('0x9')](),'define':{'charset':'utf8','collate':_0xbe2a('0xa')}}});config[_0xbe2a('0xb')]=_[_0xbe2a('0xc')](config['sequelizeHistory'],{'database':'motion2','username':_0xbe2a('0x6'),'password':_0xbe2a('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xbe2a('0x8'),'dialectOptions':{'charset':_0xbe2a('0xd')},'logging':![],'timezone':timezone[_0xbe2a('0x9')](),'define':{'charset':_0xbe2a('0xe'),'collate':_0xbe2a('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config['sequelize'][_0xbe2a('0xf')],config[_0xbe2a('0x1')][_0xbe2a('0x10')],config[_0xbe2a('0x1')][_0xbe2a('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xbe2a('0x12')],config[_0xbe2a('0xb')][_0xbe2a('0xf')],config['sequelizeHistory'][_0xbe2a('0x10')],config[_0xbe2a('0xb')][_0xbe2a('0x11')])};db[_0xbe2a('0x13')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x15'));db[_0xbe2a('0x16')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x17'));db[_0xbe2a('0x18')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/voiceContext/voiceContext.model');db[_0xbe2a('0x19')]=db[_0xbe2a('0x1')]['import']('../api/voiceExtension/voiceExtension.model');db[_0xbe2a('0x1a')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x1b'));db['VoiceQueue']=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x1c'));db[_0xbe2a('0x1d')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/voiceRecording/voiceRecording.model');db[_0xbe2a('0x1e')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/screenRecording/screenRecording.model');db[_0xbe2a('0x1f')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x20'));db[_0xbe2a('0x21')]=db['sequelize']['import'](_0xbe2a('0x22'));db[_0xbe2a('0x23')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/voiceCallReport/voiceCallReport.model');db[_0xbe2a('0x24')]=db['sequelize'][_0xbe2a('0x14')]('../api/voiceDialReport/voiceDialReport.model');db[_0xbe2a('0x25')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x26'));db[_0xbe2a('0x27')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x28'));db[_0xbe2a('0x29')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/memberReport/memberReport.model');db[_0xbe2a('0x2a')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x2b'));db[_0xbe2a('0x2c')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x2d'));db[_0xbe2a('0x2e')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x2f'));db[_0xbe2a('0x30')]=db['sequelize']['import']('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x31'));db[_0xbe2a('0x32')]=db['sequelize']['import']('../api/userMailQueue/userMailQueue.model');db[_0xbe2a('0x33')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/userFaxQueue/userFaxQueue.model');db[_0xbe2a('0x34')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x35'));db[_0xbe2a('0x36')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x37'));db['UserWhatsappQueue']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x38'));db['MailServerIn']=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x39'));db[_0xbe2a('0x3a')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x3b'));db[_0xbe2a('0x3c')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/mailAccount/mailAccount.model');db[_0xbe2a('0x3d')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x3e'));db[_0xbe2a('0x3f')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x40'));db['MailInteraction']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x41'));db[_0xbe2a('0x42')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x43'));db[_0xbe2a('0x44')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x45'));db['MailQueueReport']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x46'));db[_0xbe2a('0x47')]=db['sequelize']['import'](_0xbe2a('0x48'));db[_0xbe2a('0x49')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x4a'));db[_0xbe2a('0x4b')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x4c'));db[_0xbe2a('0x4d')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/faxApplication/faxApplication.model');db[_0xbe2a('0x4e')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x4f'));db[_0xbe2a('0x50')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x51'));db[_0xbe2a('0x52')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x53'));db['FaxQueueReport']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x54'));db[_0xbe2a('0x55')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x56'));db[_0xbe2a('0x57')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x58'));db['SmsInteraction']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x59'));db[_0xbe2a('0x5a')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x5b'));db[_0xbe2a('0x5c')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x5d'));db[_0xbe2a('0x5e')]=db['sequelize']['import']('../api/openchannelAccount/openchannelAccount.model');db[_0xbe2a('0x5f')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x60'));db['OpenchannelInteraction']=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x61'));db[_0xbe2a('0x62')]=db['sequelize']['import'](_0xbe2a('0x63'));db['OpenchannelQueue']=db[_0xbe2a('0x1')]['import']('../api/openchannelQueue/openchannelQueue.model');db[_0xbe2a('0x64')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x65'));db[_0xbe2a('0x66')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x67'));db[_0xbe2a('0x68')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x69'));db[_0xbe2a('0x6a')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x6b'));db['ChatMessage']=db[_0xbe2a('0x1')]['import']('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x6c'));db[_0xbe2a('0x6d')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x6e'));db[_0xbe2a('0x6f')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x70'));db[_0xbe2a('0x71')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x72'));db['CmCompany']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x73'));db[_0xbe2a('0x74')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x75'));db[_0xbe2a('0x76')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x77'));db[_0xbe2a('0x78')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x79'));db[_0xbe2a('0x7a')]=db[_0xbe2a('0x1')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0xbe2a('0x7b')]=db['sequelize']['import'](_0xbe2a('0x7c'));db[_0xbe2a('0x7d')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x7e'));db[_0xbe2a('0x7f')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x80'));db['Action']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x81'));db[_0xbe2a('0x82')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x83'));db[_0xbe2a('0x84')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x85'));db['Disposition']=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x86'));db[_0xbe2a('0x87')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x88'));db[_0xbe2a('0x89')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x8a'));db[_0xbe2a('0x8b')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x8c'));db[_0xbe2a('0x8d')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x8e'));db[_0xbe2a('0x8f')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x90'));db[_0xbe2a('0x91')]=db['sequelize']['import'](_0xbe2a('0x92'));db[_0xbe2a('0x93')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x94'));db[_0xbe2a('0x95')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x96'));db['ContactItemType']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x97'));db[_0xbe2a('0x98')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/cmContactHasItem/cmContactHasItem.model');db['CmHopperAdditionalPhone']=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0xbe2a('0x99')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x9a'));db[_0xbe2a('0x9b')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x9c'));db[_0xbe2a('0x9d')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x9e'));db[_0xbe2a('0x9f')]=db['sequelize'][_0xbe2a('0x14')]('../api/integration/integration.model');db[_0xbe2a('0xa0')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xa1'));db[_0xbe2a('0xa2')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0xa3'));db[_0xbe2a('0xa4')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xbe2a('0xa5')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0xa6'));db[_0xbe2a('0xa7')]=db['sequelize'][_0xbe2a('0x14')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xbe2a('0xa8')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0xa9'));db['SalesforceAccount']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xaa'));db['SalesforceConfiguration']=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0xbe2a('0x1')]['import'](_0xbe2a('0xab'));db[_0xbe2a('0xac')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xad'));db[_0xbe2a('0xae')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0xaf'));db[_0xbe2a('0xb0')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xb1'));db['DeskAccount']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xb2'));db[_0xbe2a('0xb3')]=db['sequelize']['import'](_0xbe2a('0xb4'));db[_0xbe2a('0xb5')]=db['sequelize'][_0xbe2a('0x14')]('../api/intDeskField/intDeskField.model');db[_0xbe2a('0xb6')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db[_0xbe2a('0x1')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xbe2a('0xb7')]=db['sequelize']['import'](_0xbe2a('0xb8'));db[_0xbe2a('0xb9')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xbe2a('0xba')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xbb'));db[_0xbe2a('0xbc')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0xbd'));db[_0xbe2a('0xbe')]=db[_0xbe2a('0x1')]['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xbe2a('0xbf')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0xc0'));db[_0xbe2a('0xc1')]=db['sequelize']['import'](_0xbe2a('0xc2'));db[_0xbe2a('0xc3')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xc4'));db[_0xbe2a('0xc5')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xc6'));db[_0xbe2a('0xc7')]=db['sequelize']['import']('../api/intServicenowAccount/intServicenowAccount.model');db[_0xbe2a('0xc8')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xc9'));db['ServicenowField']=db[_0xbe2a('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db[_0xbe2a('0xca')]=db['sequelize']['import']('../api/intDynamics365Account/intDynamics365Account.model');db[_0xbe2a('0xcb')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xcc'));db[_0xbe2a('0xcd')]=db[_0xbe2a('0x1')]['import']('../api/intDynamics365Field/intDynamics365Field.model');db[_0xbe2a('0xce')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0xcf'));db['FreshsalesConfiguration']=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0xd0'));db[_0xbe2a('0xd1')]=db['sequelize'][_0xbe2a('0x14')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0xbe2a('0x9f')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xd2'));db['Network']=db['sequelize'][_0xbe2a('0x14')]('../api/network/network.model');db[_0xbe2a('0xd3')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/chatQueueReport/chatQueueReport.model');db[_0xbe2a('0xd4')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xd5'));db['JscriptyAnswerReport']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xd6'));db['JscriptyQuestionReport']=db['sequelize'][_0xbe2a('0x14')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xbe2a('0xd7')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xbe2a('0xd8')]=db['sequelize']['import'](_0xbe2a('0xd9'));db[_0xbe2a('0xda')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/squareReport/squareReport.model');db[_0xbe2a('0xdb')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/squareReportDetail/squareReportDetail.model');db[_0xbe2a('0xdc')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/jscriptyProject/jscriptyProject.model');db[_0xbe2a('0xdd')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xde'));db['SquareOdbc']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xdf'));db['SquareProject']=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0xe0'));db['SquareRecording']=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0xe1'));db['SquareMessage']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xe2'));db[_0xbe2a('0xe3')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0xe4'));db[_0xbe2a('0xe5')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xe6'));db[_0xbe2a('0xe7')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xe8'));db[_0xbe2a('0xe9')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xea'));db[_0xbe2a('0xeb')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xec'));db['Plugin']=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/plugin/plugin.model');db[_0xbe2a('0xed')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/mailTransferReport/mailTransferReport.model');db[_0xbe2a('0xee')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xef'));db['FaxTransferReport']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xf0'));db[_0xbe2a('0xf1')]=db[_0xbe2a('0x1')]['import']('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xbe2a('0xf2')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xf3'));db[_0xbe2a('0xf4')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xf5'));db['VoicePrefix']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xf6'));db[_0xbe2a('0xf7')]=db['sequelize'][_0xbe2a('0x14')]('../api/userProfile/userProfile.model');db[_0xbe2a('0xf8')]=db['sequelize']['import'](_0xbe2a('0xf9'));db['UserProfileResource']=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/userProfileResource/userProfileResource.model');db[_0xbe2a('0xfa')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/userNotification/userNotification.model');db[_0xbe2a('0xfb')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xfc'));db[_0xbe2a('0xfd')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0xfe'));db['WhatsappInteraction']=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0xff'));db[_0xbe2a('0x100')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x101'));db[_0xbe2a('0x102')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')](_0xbe2a('0x103'));db[_0xbe2a('0x104')]=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db[_0xbe2a('0x1')][_0xbe2a('0x14')]('../api/whatsappQueue/whatsappQueue.model');db[_0xbe2a('0x105')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x106'));db[_0xbe2a('0x107')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x108'));db['TeamVoicePrefix']=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x109'));db[_0xbe2a('0x10a')]=db[_0xbe2a('0x1')]['import'](_0xbe2a('0x10b'));db[_0xbe2a('0x10c')]=db['sequelize'][_0xbe2a('0x14')]('../api/user-setting/user-setting.model');db[_0xbe2a('0x10d')]=db['sequelize'][_0xbe2a('0x14')](_0xbe2a('0x10e'));db[_0xbe2a('0x13')][_0xbe2a('0x10f')](db[_0xbe2a('0x1f')],{'as':_0xbe2a('0x1f'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x13')][_0xbe2a('0x10f')](db[_0xbe2a('0x10c')],{'as':_0xbe2a('0x112'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db[_0xbe2a('0x1d')],{'as':'Recordings','foreignKey':'UserId'});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db[_0xbe2a('0x2e')],{'as':'VoiceQueuesRt','foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db[_0xbe2a('0x19')],{'as':_0xbe2a('0x114'),'onDelete':_0xbe2a('0x110'),'hooks':!![]});db[_0xbe2a('0x13')]['hasMany'](db['CmHopperFinal'],{'as':_0xbe2a('0x115'),'foreignKey':_0xbe2a('0x111')});db['User']['hasMany'](db[_0xbe2a('0x7b')],{'as':'HopperHistory','foreignKey':'UserId'});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db[_0xbe2a('0x7d')],{'as':_0xbe2a('0x7d'),'foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db[_0xbe2a('0x116')],{'as':_0xbe2a('0x117'),'foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db[_0xbe2a('0x6a')],{'as':'ChatInteractions','foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db[_0xbe2a('0x118')],{'as':_0xbe2a('0x119'),'foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db[_0xbe2a('0x4e')],{'as':'FaxInteractions','foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db[_0xbe2a('0x11a')],{'as':_0xbe2a('0x11b'),'foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db[_0xbe2a('0x11c')],{'as':'WhatsappInteractions','foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db['UserNotification'],{'as':'UserNotifications','foreignKey':_0xbe2a('0x11d')});db[_0xbe2a('0x13')][_0xbe2a('0x113')](db[_0xbe2a('0x76')],{'as':'Hoppers','foreignKey':_0xbe2a('0x111'),'onDelete':_0xbe2a('0x11e')});db[_0xbe2a('0x13')]['belongsTo'](db[_0xbe2a('0xf7')],{'as':_0xbe2a('0xf7'),'foreignKey':_0xbe2a('0x11f')});db[_0xbe2a('0x13')]['belongsToMany'](db[_0xbe2a('0x6f')],{'as':_0xbe2a('0x120'),'through':_0xbe2a('0x121')});db[_0xbe2a('0x13')]['belongsToMany'](db[_0xbe2a('0x74')],{'as':'Contacts','through':_0xbe2a('0x122')});db['User'][_0xbe2a('0x123')](db['CmList'],{'as':'Lists','through':'cm_user_has_lists'});db[_0xbe2a('0x13')]['belongsToMany'](db[_0xbe2a('0xe3')],{'through':_0xbe2a('0x124')});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db[_0xbe2a('0x11a')],{'as':_0xbe2a('0x11b'),'through':_0xbe2a('0x125')});db['User'][_0xbe2a('0x123')](db[_0xbe2a('0x6a')],{'as':'ChatInteractions','through':_0xbe2a('0x126')});db['User'][_0xbe2a('0x123')](db['FaxInteraction'],{'as':_0xbe2a('0x127'),'through':'user_has_fax_interactions'});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db[_0xbe2a('0x118')],{'as':_0xbe2a('0x119'),'through':_0xbe2a('0x128')});db['User']['belongsToMany'](db['OpenchannelInteraction'],{'as':_0xbe2a('0x117'),'through':_0xbe2a('0x129')});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db[_0xbe2a('0x11c')],{'as':'WhatsappInteractions','through':_0xbe2a('0x12a')});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db[_0xbe2a('0x12b')],{'as':_0xbe2a('0x12c'),'through':'UserVoiceQueue','required':![]});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db[_0xbe2a('0x12d')],{'as':_0xbe2a('0x12e'),'through':'UserVoicePrefix','required':![]});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db[_0xbe2a('0x3d')],{'as':_0xbe2a('0x12f'),'through':'UserMailQueue','required':![]});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db['ChatQueue'],{'as':_0xbe2a('0x130'),'through':_0xbe2a('0x131'),'required':![],'hooks':!![]});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db[_0xbe2a('0x52')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db[_0xbe2a('0x5c')],{'as':_0xbe2a('0x132'),'through':_0xbe2a('0x34'),'required':![]});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db[_0xbe2a('0x133')],{'as':_0xbe2a('0x134'),'through':_0xbe2a('0x36'),'required':![]});db[_0xbe2a('0x13')]['belongsToMany'](db[_0xbe2a('0x135')],{'as':'WhatsappQueues','through':_0xbe2a('0x136'),'required':![]});db['User'][_0xbe2a('0x123')](db['CmList'],{'through':_0xbe2a('0x137')});db[_0xbe2a('0x13')]['belongsToMany'](db['ChatWebsite'],{'as':_0xbe2a('0x138'),'through':'user_has_chat_websites'});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db[_0xbe2a('0x4b')],{'as':_0xbe2a('0x139'),'through':_0xbe2a('0x13a')});db['User']['belongsToMany'](db['MailAccount'],{'as':'MailAccounts','through':_0xbe2a('0x13b')});db['User'][_0xbe2a('0x123')](db['OpenchannelAccount'],{'as':_0xbe2a('0x13c'),'through':'user_has_openchannel_accounts'});db[_0xbe2a('0x13')][_0xbe2a('0x123')](db[_0xbe2a('0x55')],{'as':_0xbe2a('0x13d'),'through':'user_has_sms_accounts'});db['User']['belongsToMany'](db[_0xbe2a('0xfb')],{'as':_0xbe2a('0x13e'),'through':_0xbe2a('0x13f')});db['VoiceChanSpy'][_0xbe2a('0x113')](db[_0xbe2a('0x19')],{'as':_0xbe2a('0x140'),'onDelete':_0xbe2a('0x110'),'foreignKey':'ChanSpyId'});db[_0xbe2a('0x18')][_0xbe2a('0x113')](db[_0xbe2a('0x19')],{'onDelete':'cascade'});db[_0xbe2a('0x19')][_0xbe2a('0x113')](db['VoiceExtension'],{'as':_0xbe2a('0x141'),'onDelete':'cascade'});db[_0xbe2a('0x1a')]['belongsToMany'](db[_0xbe2a('0x93')],{'as':_0xbe2a('0x142'),'through':_0xbe2a('0x143')});db['VoiceQueue'][_0xbe2a('0x113')](db[_0xbe2a('0x2e')],{'as':_0xbe2a('0x144'),'foreignKey':_0xbe2a('0x145')});db[_0xbe2a('0x12b')]['hasMany'](db[_0xbe2a('0x76')],{'as':'Hoppers','foreignKey':_0xbe2a('0x145')});db[_0xbe2a('0x12b')][_0xbe2a('0x113')](db[_0xbe2a('0x7a')],{'as':_0xbe2a('0x115'),'foreignKey':'VoiceQueueId'});db[_0xbe2a('0x12b')][_0xbe2a('0x113')](db[_0xbe2a('0x7b')],{'as':'HopperHistories','foreignKey':_0xbe2a('0x145')});db[_0xbe2a('0x12b')][_0xbe2a('0x113')](db[_0xbe2a('0x7d')],{'as':_0xbe2a('0x7d'),'foreignKey':'VoiceQueueId'});db[_0xbe2a('0x12b')][_0xbe2a('0x113')](db[_0xbe2a('0x78')],{'as':_0xbe2a('0x146'),'foreignKey':_0xbe2a('0x145')});db[_0xbe2a('0x12b')]['hasMany'](db[_0xbe2a('0xd7')],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db[_0xbe2a('0x12b')][_0xbe2a('0x147')](db[_0xbe2a('0x2a')],{'as':_0xbe2a('0x2a'),'foreignKey':_0xbe2a('0x148')});db[_0xbe2a('0x12b')][_0xbe2a('0x147')](db['Trunk'],{'as':_0xbe2a('0x149'),'foreignKey':'TrunkBackupId'});db[_0xbe2a('0x12b')]['belongsTo'](db['Interval'],{'as':_0xbe2a('0x89'),'foreignKey':_0xbe2a('0x14a')});db['VoiceQueue'][_0xbe2a('0x147')](db[_0xbe2a('0x8b')],{'as':_0xbe2a('0x14b'),'foreignKey':_0xbe2a('0x14c')});db['VoiceQueue'][_0xbe2a('0x123')](db['CmList'],{'as':_0xbe2a('0x14d'),'through':_0xbe2a('0x14e')});db[_0xbe2a('0x12b')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x14f'),'through':_0xbe2a('0x30')});db[_0xbe2a('0x12b')][_0xbe2a('0x123')](db[_0xbe2a('0xe3')],{'as':'Teams','through':_0xbe2a('0x107')});db[_0xbe2a('0x12b')][_0xbe2a('0x123')](db[_0xbe2a('0xf4')],{'as':_0xbe2a('0x150'),'through':_0xbe2a('0x151')});db[_0xbe2a('0x1d')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x13'),'foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x1e')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x13'),'foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x1f')][_0xbe2a('0x113')](db[_0xbe2a('0x21')],{'as':_0xbe2a('0x152'),'onDelete':_0xbe2a('0x110'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0xbe2a('0x21')][_0xbe2a('0x147')](db['VoiceMail'],{'foreignKey':_0xbe2a('0x153'),'targetKey':_0xbe2a('0x154')});db[_0xbe2a('0x23')][_0xbe2a('0x113')](db['VoiceQueueReport'],{'as':_0xbe2a('0x155'),'foreignKey':'uniqueid','constraints':![]});db[_0xbe2a('0x23')][_0xbe2a('0x113')](db[_0xbe2a('0x25')],{'as':_0xbe2a('0x156'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'as':'User','foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x23')]['belongsTo'](db[_0xbe2a('0x74')],{'as':'Contact','foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x158')][_0xbe2a('0x147')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xbe2a('0x159')});db[_0xbe2a('0x158')][_0xbe2a('0x147')](db['CloudProvider'],{'as':_0xbe2a('0x105'),'foreignKey':_0xbe2a('0x15a'),'onDelete':_0xbe2a('0x15b')});db['MailServerOut'][_0xbe2a('0x147')](db[_0xbe2a('0x3c')],{'as':_0xbe2a('0x3c'),'foreignKey':'MailAccountId'});db[_0xbe2a('0x3a')]['belongsTo'](db[_0xbe2a('0x105')],{'as':_0xbe2a('0x105'),'foreignKey':_0xbe2a('0x15a'),'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x3c')][_0xbe2a('0x10f')](db[_0xbe2a('0x158')],{'as':_0xbe2a('0x15c'),'onDelete':'cascade'});db[_0xbe2a('0x3c')][_0xbe2a('0x10f')](db['MailServerOut'],{'as':_0xbe2a('0x15d'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x3c')][_0xbe2a('0x113')](db[_0xbe2a('0x15e')],{'as':_0xbe2a('0x15f'),'foreignKey':'MailAccountId','onDelete':'cascade'});db[_0xbe2a('0x3c')][_0xbe2a('0x113')](db[_0xbe2a('0x84')],{'as':_0xbe2a('0x160'),'foreignKey':'MailAccountId'});db[_0xbe2a('0x3c')][_0xbe2a('0x113')](db['MailMessage'],{'as':_0xbe2a('0x152'),'foreignKey':_0xbe2a('0x159')});db[_0xbe2a('0x3c')][_0xbe2a('0x113')](db[_0xbe2a('0x11a')],{'as':_0xbe2a('0x161')});db[_0xbe2a('0x3c')][_0xbe2a('0x113')](db[_0xbe2a('0x44')],{'as':_0xbe2a('0x141'),'foreignKey':'MailAccountId','onDelete':'cascade'});db[_0xbe2a('0x3c')][_0xbe2a('0x147')](db[_0xbe2a('0xf4')],{'as':'List','foreignKey':'ListId'});db[_0xbe2a('0x3c')][_0xbe2a('0x147')](db[_0xbe2a('0x99')],{'as':'Template','foreignKey':_0xbe2a('0x162')});db['MailAccount'][_0xbe2a('0x147')](db['Pause'],{'as':_0xbe2a('0x14b'),'foreignKey':_0xbe2a('0x14c')});db[_0xbe2a('0x3c')]['belongsToMany'](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x14f'),'through':_0xbe2a('0x13b')});db['MailQueue'][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':'Agents','through':_0xbe2a('0x32')});db['MailQueue']['belongsToMany'](db[_0xbe2a('0xe3')],{'through':'team_has_mail_queues','as':_0xbe2a('0x163')});db[_0xbe2a('0x11a')][_0xbe2a('0x113')](db[_0xbe2a('0x42')],{'as':_0xbe2a('0x152'),'onDelete':_0xbe2a('0x110'),'foreignKey':'MailInteractionId'});db[_0xbe2a('0x11a')][_0xbe2a('0x147')](db[_0xbe2a('0x3c')],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x159')});db[_0xbe2a('0x11a')][_0xbe2a('0x147')](db['CmContact'],{'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x11a')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x166'),'foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x11a')]['belongsToMany'](db['Tag'],{'through':_0xbe2a('0x167'),'as':_0xbe2a('0x168')});db[_0xbe2a('0x11a')][_0xbe2a('0x123')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0xbe2a('0x169')});db['MailInteraction'][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x16a'),'through':'user_has_mail_interactions','foreignKey':_0xbe2a('0x16b')});db['MailMessage'][_0xbe2a('0x113')](db[_0xbe2a('0xeb')],{'as':_0xbe2a('0x16c'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x42')][_0xbe2a('0x147')](db['User'],{'as':_0xbe2a('0x13')});db[_0xbe2a('0x42')][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'onDelete':_0xbe2a('0x110'),'as':_0xbe2a('0x165')});db[_0xbe2a('0x42')][_0xbe2a('0x147')](db[_0xbe2a('0x11a')],{'as':_0xbe2a('0x16d'),'foreignKey':_0xbe2a('0x16b')});db[_0xbe2a('0x42')]['belongsTo'](db[_0xbe2a('0x3c')],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x159')});db['MailMessage'][_0xbe2a('0x147')](db[_0xbe2a('0x64')],{'as':_0xbe2a('0x64'),'foreignKey':_0xbe2a('0x16e')});db[_0xbe2a('0x42')][_0xbe2a('0x147')](db['ChatOfflineMessage'],{'as':_0xbe2a('0x16f'),'foreignKey':_0xbe2a('0x170')});db['MailApplication'][_0xbe2a('0x147')](db['User'],{'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x44')][_0xbe2a('0x147')](db[_0xbe2a('0x3d')],{'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x44')][_0xbe2a('0x147')](db[_0xbe2a('0x3c')],{'onDelete':_0xbe2a('0x15b')});db['MailApplication'][_0xbe2a('0x147')](db[_0xbe2a('0x89')],{'onDelete':_0xbe2a('0x15b'),'foreignKey':_0xbe2a('0x14a')});db[_0xbe2a('0x44')]['belongsTo'](db[_0xbe2a('0x95')],{'onDelete':'restrict','foreignKey':_0xbe2a('0x171')});db[_0xbe2a('0x172')][_0xbe2a('0x147')](db[_0xbe2a('0x3c')],{});db[_0xbe2a('0x172')][_0xbe2a('0x147')](db[_0xbe2a('0xf4')],{'as':'List','foreignKey':_0xbe2a('0x173')});db[_0xbe2a('0x172')]['belongsTo'](db['CmContact'],{'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x172')][_0xbe2a('0x147')](db[_0xbe2a('0x11a')],{});db[_0xbe2a('0x172')][_0xbe2a('0x147')](db[_0xbe2a('0x42')],{});db[_0xbe2a('0x172')]['belongsTo'](db[_0xbe2a('0x13')],{});db[_0xbe2a('0x172')][_0xbe2a('0x147')](db[_0xbe2a('0x3d')],{});db['Dashboard']['hasMany'](db[_0xbe2a('0x49')],{'as':_0xbe2a('0x174'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x4b')][_0xbe2a('0x113')](db[_0xbe2a('0x15e')],{'as':_0xbe2a('0x15f'),'foreignKey':_0xbe2a('0x175'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x4b')][_0xbe2a('0x113')](db[_0xbe2a('0x84')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0xbe2a('0x4b')]['hasMany'](db['FaxInteraction'],{'as':_0xbe2a('0x161')});db[_0xbe2a('0x4b')][_0xbe2a('0x113')](db[_0xbe2a('0x4d')],{'as':_0xbe2a('0x141'),'foreignKey':_0xbe2a('0x175'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x4b')][_0xbe2a('0x113')](db[_0xbe2a('0x19')],{'as':_0xbe2a('0x176'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x4b')][_0xbe2a('0x113')](db[_0xbe2a('0x50')],{'as':_0xbe2a('0x152')});db['FaxAccount'][_0xbe2a('0x147')](db[_0xbe2a('0x2a')],{'as':_0xbe2a('0x2a')});db['FaxAccount'][_0xbe2a('0x147')](db[_0xbe2a('0xf4')],{'as':_0xbe2a('0x177'),'foreignKey':_0xbe2a('0x173')});db[_0xbe2a('0x4b')][_0xbe2a('0x147')](db['Pause'],{'as':_0xbe2a('0x14b'),'foreignKey':_0xbe2a('0x14c')});db[_0xbe2a('0x4b')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x14f'),'through':_0xbe2a('0x13a')});db[_0xbe2a('0x4d')][_0xbe2a('0x147')](db['User'],{'onDelete':'restrict'});db[_0xbe2a('0x4d')][_0xbe2a('0x147')](db[_0xbe2a('0x52')],{'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x4d')][_0xbe2a('0x147')](db[_0xbe2a('0x4b')],{'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x4d')][_0xbe2a('0x147')](db[_0xbe2a('0x95')],{'onDelete':_0xbe2a('0x15b'),'foreignKey':_0xbe2a('0x171')});db[_0xbe2a('0x4e')]['hasMany'](db['FaxMessage'],{'as':_0xbe2a('0x152'),'onDelete':_0xbe2a('0x110'),'foreignKey':'FaxInteractionId'});db[_0xbe2a('0x4e')]['belongsTo'](db[_0xbe2a('0x4b')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0xbe2a('0x4e')]['belongsTo'](db[_0xbe2a('0x74')],{'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x4e')]['belongsTo'](db[_0xbe2a('0x13')],{'as':'Owner','foreignKey':'UserId'});db['FaxInteraction'][_0xbe2a('0x123')](db['Tag'],{'through':_0xbe2a('0x178'),'as':'Tags'});db[_0xbe2a('0x4e')][_0xbe2a('0x123')](db[_0xbe2a('0x95')],{'through':_0xbe2a('0x178'),'as':_0xbe2a('0x169')});db[_0xbe2a('0x4e')]['belongsToMany'](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x16a'),'through':'user_has_fax_interactions','foreignKey':_0xbe2a('0x179')});db[_0xbe2a('0x50')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'onDelete':'cascade','as':'User'});db[_0xbe2a('0x50')][_0xbe2a('0x147')](db[_0xbe2a('0x4e')],{'as':'Interaction','foreignKey':_0xbe2a('0x179')});db[_0xbe2a('0x50')][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'onDelete':_0xbe2a('0x110'),'as':_0xbe2a('0x165')});db[_0xbe2a('0x50')][_0xbe2a('0x147')](db[_0xbe2a('0xeb')],{'as':_0xbe2a('0xeb'),'foreignKey':_0xbe2a('0x17a')});db[_0xbe2a('0x50')][_0xbe2a('0x147')](db[_0xbe2a('0x4b')],{'as':'Account','foreignKey':_0xbe2a('0x175')});db['FaxQueue']['belongsToMany'](db[_0xbe2a('0x13')],{'as':'Agents','through':_0xbe2a('0x33')});db['FaxQueue'][_0xbe2a('0x123')](db[_0xbe2a('0xe3')],{'through':'team_has_fax_queues','as':_0xbe2a('0x163')});db[_0xbe2a('0x17b')][_0xbe2a('0x147')](db[_0xbe2a('0x4b')],{});db[_0xbe2a('0x17b')][_0xbe2a('0x147')](db[_0xbe2a('0xf4')],{'as':_0xbe2a('0x177'),'foreignKey':_0xbe2a('0x173')});db[_0xbe2a('0x17b')][_0xbe2a('0x147')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xbe2a('0x17b')][_0xbe2a('0x147')](db[_0xbe2a('0x4e')],{});db[_0xbe2a('0x17b')][_0xbe2a('0x147')](db[_0xbe2a('0x50')],{});db[_0xbe2a('0x17b')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{});db[_0xbe2a('0x17b')]['belongsTo'](db['FaxQueue'],{});db[_0xbe2a('0x55')][_0xbe2a('0x113')](db[_0xbe2a('0x15e')],{'as':_0xbe2a('0x15f'),'foreignKey':'SmsAccountId','onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x55')][_0xbe2a('0x113')](db[_0xbe2a('0x84')],{'as':_0xbe2a('0x160'),'foreignKey':_0xbe2a('0x17c')});db[_0xbe2a('0x55')][_0xbe2a('0x113')](db['SmsMessage'],{'as':_0xbe2a('0x152'),'foreignKey':_0xbe2a('0x17c')});db[_0xbe2a('0x55')][_0xbe2a('0x113')](db[_0xbe2a('0x118')],{'as':'Interactions'});db[_0xbe2a('0x55')][_0xbe2a('0x113')](db[_0xbe2a('0x57')],{'as':_0xbe2a('0x141'),'foreignKey':_0xbe2a('0x17c'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x55')]['belongsTo'](db[_0xbe2a('0xf4')],{'as':'List','foreignKey':_0xbe2a('0x173')});db[_0xbe2a('0x55')]['belongsTo'](db[_0xbe2a('0x8b')],{'as':_0xbe2a('0x14b'),'foreignKey':_0xbe2a('0x14c')});db['SmsAccount'][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':'Agents','through':_0xbe2a('0x17d')});db[_0xbe2a('0x57')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x57')][_0xbe2a('0x147')](db[_0xbe2a('0x5c')],{'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x57')][_0xbe2a('0x147')](db[_0xbe2a('0x55')],{'onDelete':'restrict'});db[_0xbe2a('0x57')]['belongsTo'](db[_0xbe2a('0x89')],{'onDelete':_0xbe2a('0x15b'),'foreignKey':_0xbe2a('0x14a')});db[_0xbe2a('0x57')][_0xbe2a('0x147')](db[_0xbe2a('0x95')],{'onDelete':_0xbe2a('0x15b'),'foreignKey':_0xbe2a('0x171')});db[_0xbe2a('0x118')]['hasMany'](db[_0xbe2a('0x5a')],{'as':_0xbe2a('0x152'),'onDelete':'cascade','foreignKey':_0xbe2a('0x17e')});db[_0xbe2a('0x118')]['belongsTo'](db[_0xbe2a('0x55')],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x17c')});db[_0xbe2a('0x118')][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x118')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x166'),'foreignKey':'UserId'});db[_0xbe2a('0x118')][_0xbe2a('0x123')](db['Tag'],{'through':_0xbe2a('0x17f'),'as':'Tags'});db[_0xbe2a('0x118')][_0xbe2a('0x123')](db[_0xbe2a('0x95')],{'through':_0xbe2a('0x17f'),'as':_0xbe2a('0x169')});db[_0xbe2a('0x118')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':'Users','through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db['SmsMessage'][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x13')});db[_0xbe2a('0x5a')][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'onDelete':_0xbe2a('0x110'),'as':'Contact'});db[_0xbe2a('0x5a')]['belongsTo'](db[_0xbe2a('0x118')],{'onDelete':_0xbe2a('0x110'),'as':_0xbe2a('0x16d'),'foreignKey':_0xbe2a('0x17e')});db['SmsMessage']['belongsTo'](db[_0xbe2a('0x55')],{'as':'Account','foreignKey':_0xbe2a('0x17c')});db[_0xbe2a('0x5c')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xbe2a('0x34'),'foreignKey':_0xbe2a('0x180')});db[_0xbe2a('0x5c')][_0xbe2a('0x123')](db[_0xbe2a('0xe3')],{'through':_0xbe2a('0x181'),'as':_0xbe2a('0x163')});db['OpenchannelAccount'][_0xbe2a('0x113')](db['Disposition'],{'as':_0xbe2a('0x15f'),'foreignKey':_0xbe2a('0x182'),'onDelete':_0xbe2a('0x110')});db['OpenchannelAccount'][_0xbe2a('0x113')](db['CannedAnswer'],{'as':_0xbe2a('0x160'),'foreignKey':'OpenchannelAccountId'});db[_0xbe2a('0x5e')][_0xbe2a('0x113')](db[_0xbe2a('0x116')],{'as':'Interactions','foreignKey':_0xbe2a('0x182')});db[_0xbe2a('0x5e')]['hasMany'](db['OpenchannelMessage'],{'as':_0xbe2a('0x152'),'foreignKey':_0xbe2a('0x182')});db[_0xbe2a('0x5e')][_0xbe2a('0x113')](db[_0xbe2a('0x5f')],{'as':'Applications','foreignKey':_0xbe2a('0x182'),'onDelete':_0xbe2a('0x110')});db['OpenchannelAccount'][_0xbe2a('0x147')](db['CmList'],{'as':_0xbe2a('0x177'),'foreignKey':_0xbe2a('0x173')});db['OpenchannelAccount']['belongsTo'](db[_0xbe2a('0x8b')],{'as':_0xbe2a('0x14b'),'foreignKey':_0xbe2a('0x14c')});db[_0xbe2a('0x5e')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x14f'),'through':_0xbe2a('0x183')});db['OpenchannelApplication']['belongsTo'](db['User'],{'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x5f')][_0xbe2a('0x147')](db[_0xbe2a('0x133')],{'onDelete':_0xbe2a('0x15b'),'foreignKey':_0xbe2a('0x184')});db[_0xbe2a('0x5f')][_0xbe2a('0x147')](db['OpenchannelAccount'],{'onDelete':_0xbe2a('0x15b'),'foreignKey':'OpenchannelAccountId'});db[_0xbe2a('0x5f')][_0xbe2a('0x147')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xbe2a('0x14a')});db[_0xbe2a('0x5f')][_0xbe2a('0x147')](db[_0xbe2a('0x95')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xbe2a('0x116')][_0xbe2a('0x113')](db[_0xbe2a('0x62')],{'as':_0xbe2a('0x152'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x185')});db[_0xbe2a('0x116')][_0xbe2a('0x147')](db['OpenchannelAccount'],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x182')});db['OpenchannelInteraction'][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x157')});db['OpenchannelInteraction'][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x166'),'foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x116')]['belongsToMany'](db['Tag'],{'through':_0xbe2a('0x186'),'as':_0xbe2a('0x168')});db[_0xbe2a('0x116')][_0xbe2a('0x123')](db[_0xbe2a('0x95')],{'through':_0xbe2a('0x186'),'as':_0xbe2a('0x169')});db[_0xbe2a('0x116')][_0xbe2a('0x123')](db['User'],{'as':_0xbe2a('0x16a'),'through':_0xbe2a('0x129'),'foreignKey':_0xbe2a('0x185')});db[_0xbe2a('0x62')]['belongsTo'](db[_0xbe2a('0x13')],{'onDelete':_0xbe2a('0x110'),'as':_0xbe2a('0x13')});db[_0xbe2a('0x62')][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'onDelete':_0xbe2a('0x110'),'as':_0xbe2a('0x165')});db[_0xbe2a('0x62')][_0xbe2a('0x147')](db[_0xbe2a('0x116')],{'onDelete':_0xbe2a('0x110'),'as':'Interaction','foreignKey':_0xbe2a('0x185')});db[_0xbe2a('0x62')][_0xbe2a('0x147')](db[_0xbe2a('0xeb')],{'as':_0xbe2a('0xeb'),'foreignKey':_0xbe2a('0x17a')});db['OpenchannelMessage'][_0xbe2a('0x147')](db[_0xbe2a('0x5e')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0xbe2a('0x133')]['belongsToMany'](db[_0xbe2a('0x13')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue']['belongsToMany'](db['Team'],{'through':_0xbe2a('0x187'),'as':'Teams'});db[_0xbe2a('0x64')][_0xbe2a('0x113')](db[_0xbe2a('0x15e')],{'as':_0xbe2a('0x15f'),'foreignKey':'ChatWebsiteId','onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x64')][_0xbe2a('0x113')](db[_0xbe2a('0x84')],{'as':_0xbe2a('0x160'),'foreignKey':'ChatWebsiteId'});db[_0xbe2a('0x64')][_0xbe2a('0x113')](db[_0xbe2a('0x71')],{'as':_0xbe2a('0x188')});db[_0xbe2a('0x64')][_0xbe2a('0x113')](db['ChatInteraction'],{'as':_0xbe2a('0x161')});db[_0xbe2a('0x64')][_0xbe2a('0x113')](db[_0xbe2a('0x68')],{'as':_0xbe2a('0x141'),'foreignKey':_0xbe2a('0x16e'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x64')][_0xbe2a('0x113')](db[_0xbe2a('0x189')],{'as':'Messages'});db[_0xbe2a('0x64')][_0xbe2a('0x147')](db[_0xbe2a('0xf4')],{'as':_0xbe2a('0x177'),'foreignKey':'ListId'});db['ChatWebsite']['belongsTo'](db[_0xbe2a('0x89')],{'as':'Interval','foreignKey':_0xbe2a('0x14a')});db[_0xbe2a('0x64')][_0xbe2a('0x147')](db[_0xbe2a('0x3c')],{'as':_0xbe2a('0x3c'),'foreignKey':_0xbe2a('0x159')});db[_0xbe2a('0x64')][_0xbe2a('0x147')](db[_0xbe2a('0x8b')],{'as':_0xbe2a('0x14b'),'foreignKey':_0xbe2a('0x14c')});db['ChatWebsite']['belongsToMany'](db[_0xbe2a('0x13')],{'as':'Agents','through':_0xbe2a('0x18a')});db['OpenchannelQueueReport'][_0xbe2a('0x147')](db['OpenchannelAccount'],{});db[_0xbe2a('0x66')][_0xbe2a('0x147')](db[_0xbe2a('0xf4')],{'as':_0xbe2a('0x177'),'foreignKey':_0xbe2a('0x173')});db[_0xbe2a('0x66')][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x66')][_0xbe2a('0x147')](db[_0xbe2a('0x116')],{});db[_0xbe2a('0x66')][_0xbe2a('0x147')](db['OpenchannelMessage'],{});db[_0xbe2a('0x66')]['belongsTo'](db[_0xbe2a('0x13')],{});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelQueue'],{});db[_0xbe2a('0x68')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'as':'Agent','foreignKey':_0xbe2a('0x111'),'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x68')][_0xbe2a('0x147')](db[_0xbe2a('0x6d')],{'as':_0xbe2a('0x18b'),'foreignKey':'ChatQueueId','onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x68')]['belongsTo'](db[_0xbe2a('0x64')],{'as':_0xbe2a('0x18c'),'foreignKey':_0xbe2a('0x16e'),'onDelete':_0xbe2a('0x15b')});db['ChatApplication'][_0xbe2a('0x147')](db[_0xbe2a('0x95')],{'onDelete':'restrict','foreignKey':_0xbe2a('0x171')});db[_0xbe2a('0x6a')]['hasMany'](db[_0xbe2a('0x189')],{'as':_0xbe2a('0x152'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x18d')});db['ChatInteraction'][_0xbe2a('0x147')](db['ChatWebsite'],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x16e')});db[_0xbe2a('0x6a')][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x6a')][_0xbe2a('0x147')](db['User'],{'as':_0xbe2a('0x166'),'foreignKey':_0xbe2a('0x111')});db['ChatInteraction'][_0xbe2a('0x123')](db[_0xbe2a('0x95')],{'through':_0xbe2a('0x18e'),'as':_0xbe2a('0x168')});db[_0xbe2a('0x6a')][_0xbe2a('0x123')](db[_0xbe2a('0x95')],{'through':'chat_interaction_has_tags','as':_0xbe2a('0x169')});db[_0xbe2a('0x6a')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x16a'),'through':_0xbe2a('0x126'),'foreignKey':_0xbe2a('0x18d')});db[_0xbe2a('0x189')][_0xbe2a('0x147')](db['User'],{'onDelete':_0xbe2a('0x110'),'as':_0xbe2a('0x13')});db['ChatMessage'][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'onDelete':_0xbe2a('0x110'),'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x189')][_0xbe2a('0x147')](db[_0xbe2a('0x6a')],{'onDelete':_0xbe2a('0x110'),'as':_0xbe2a('0x16d'),'foreignKey':'ChatInteractionId'});db[_0xbe2a('0x189')][_0xbe2a('0x147')](db[_0xbe2a('0xeb')],{'as':_0xbe2a('0xeb'),'foreignKey':_0xbe2a('0x17a')});db[_0xbe2a('0x189')]['belongsTo'](db['ChatWebsite'],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x16e')});db['ChatOfflineMessage'][_0xbe2a('0x113')](db[_0xbe2a('0xeb')],{'as':_0xbe2a('0x16c'),'foreignKey':_0xbe2a('0x170'),'onDelete':_0xbe2a('0x110'),'hooks':!![]});db[_0xbe2a('0x16f')][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'onDelete':'cascade','as':_0xbe2a('0x165'),'foreignKey':'ContactId'});db[_0xbe2a('0x16f')][_0xbe2a('0x147')](db[_0xbe2a('0x64')],{'as':'Account','foreignKey':_0xbe2a('0x16e')});db[_0xbe2a('0x6d')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':'Agents','through':_0xbe2a('0x131'),'hooks':!![]});db[_0xbe2a('0x6d')]['belongsToMany'](db['Team'],{'through':_0xbe2a('0x18f'),'as':_0xbe2a('0x163')});db[_0xbe2a('0x6f')]['hasMany'](db['ChatInternalMessage'],{'as':_0xbe2a('0x152'),'foreignKey':_0xbe2a('0x190'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x6f')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x144'),'through':'chat_group_has_users'});db[_0xbe2a('0x71')][_0xbe2a('0x147')](db['ChatWebsite'],{'as':'Website','foreignKey':_0xbe2a('0x16e')});db[_0xbe2a('0x191')][_0xbe2a('0x113')](db[_0xbe2a('0x74')],{'as':'Contacts','foreignKey':_0xbe2a('0x192')});db[_0xbe2a('0x74')][_0xbe2a('0x113')](db['CmContactHasItem'],{'as':_0xbe2a('0x193'),'foreignKey':_0xbe2a('0x194')});db[_0xbe2a('0x74')][_0xbe2a('0x113')](db[_0xbe2a('0x76')],{'as':_0xbe2a('0x195'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x74')][_0xbe2a('0x113')](db['CmHopperFinal'],{'as':_0xbe2a('0x115'),'foreignKey':_0xbe2a('0x157')});db['CmContact']['hasMany'](db['CmHopperHistory'],{'as':_0xbe2a('0x196'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x74')][_0xbe2a('0x113')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xbe2a('0x157')});db['CmContact'][_0xbe2a('0x113')](db[_0xbe2a('0xd7')],{'as':_0xbe2a('0x197'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x74')]['hasMany'](db[_0xbe2a('0x116')],{'as':_0xbe2a('0x117'),'foreignKey':'ContactId','onDelete':_0xbe2a('0x15b')});db['CmContact'][_0xbe2a('0x113')](db[_0xbe2a('0x6a')],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x74')][_0xbe2a('0x113')](db[_0xbe2a('0x118')],{'as':_0xbe2a('0x119'),'foreignKey':_0xbe2a('0x157'),'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x74')][_0xbe2a('0x113')](db[_0xbe2a('0x4e')],{'as':_0xbe2a('0x127'),'foreignKey':'ContactId','onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x74')]['hasMany'](db[_0xbe2a('0x11a')],{'as':_0xbe2a('0x11b'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xbe2a('0x74')][_0xbe2a('0x147')](db['CmCompany'],{'as':'Company','foreignKey':_0xbe2a('0x192')});db[_0xbe2a('0x74')][_0xbe2a('0x147')](db['CmList'],{'as':'List','foreignKey':_0xbe2a('0x173'),'onDelete':_0xbe2a('0x110')});db['CmContact'][_0xbe2a('0x123')](db['User'],{'as':_0xbe2a('0x16a'),'through':_0xbe2a('0x122')});db[_0xbe2a('0x74')][_0xbe2a('0x123')](db[_0xbe2a('0x95')],{'as':_0xbe2a('0x168'),'through':'cm_contact_has_tags'});db[_0xbe2a('0x74')][_0xbe2a('0x123')](db[_0xbe2a('0x95')],{'through':_0xbe2a('0x198'),'as':_0xbe2a('0x169')});db[_0xbe2a('0x76')][_0xbe2a('0x113')](db[_0xbe2a('0x199')],{'as':_0xbe2a('0x19a'),'foreignKey':_0xbe2a('0x19b')});db['CmHopper'][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'as':'Contact','foreignKey':_0xbe2a('0x157'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x76')][_0xbe2a('0x147')](db[_0xbe2a('0xf4')],{'as':_0xbe2a('0x177'),'foreignKey':_0xbe2a('0x173'),'onDelete':'cascade'});db[_0xbe2a('0x76')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x19c'),'foreignKey':_0xbe2a('0x111')});db[_0xbe2a('0x76')]['belongsTo'](db[_0xbe2a('0x12b')],{'as':'Queue','foreignKey':_0xbe2a('0x145'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x76')][_0xbe2a('0x147')](db[_0xbe2a('0xe7')],{'as':_0xbe2a('0xe7'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0xbe2a('0x76')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x166'),'foreignKey':'OwnerId'});db[_0xbe2a('0x78')][_0xbe2a('0x147')](db['CmContact'],{'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x157'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x78')][_0xbe2a('0x147')](db[_0xbe2a('0xf4')],{'as':'List','foreignKey':_0xbe2a('0x173'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x78')][_0xbe2a('0x147')](db['VoiceQueue'],{'as':_0xbe2a('0x18b'),'foreignKey':'VoiceQueueId','onDelete':_0xbe2a('0x110')});db[_0xbe2a('0x78')][_0xbe2a('0x147')](db[_0xbe2a('0xe7')],{'as':_0xbe2a('0xe7'),'foreignKey':'CampaignId','onDelete':_0xbe2a('0x110')});db['Automation'][_0xbe2a('0x113')](db[_0xbe2a('0x87')],{'as':{'plural':_0xbe2a('0x19d'),'singular':_0xbe2a('0x19e')},'foreignKey':'AutomationAllId','onDelete':_0xbe2a('0x110'),'hooks':!![]});db[_0xbe2a('0x82')][_0xbe2a('0x113')](db[_0xbe2a('0x87')],{'as':{'plural':_0xbe2a('0x19f'),'singular':_0xbe2a('0x1a0')},'foreignKey':_0xbe2a('0x1a1'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xbe2a('0x113')](db[_0xbe2a('0x1a2')],{'as':_0xbe2a('0x1a3'),'foreignKey':_0xbe2a('0x1a4'),'onDelete':_0xbe2a('0x110'),'hooks':!![]});db[_0xbe2a('0x15e')][_0xbe2a('0x113')](db[_0xbe2a('0x15e')],{'as':_0xbe2a('0x15f'),'foreignKey':_0xbe2a('0x1a5'),'onDelete':'cascade'});db[_0xbe2a('0x89')]['hasMany'](db[_0xbe2a('0x89')],{'as':'Intervals','foreignKey':_0xbe2a('0x14a'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xbe2a('0x89')][_0xbe2a('0x113')](db[_0xbe2a('0x19')],{'as':_0xbe2a('0x114'),'foreignKey':'IntervalId','onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x89')]['hasMany'](db[_0xbe2a('0x44')],{'as':_0xbe2a('0x1a6'),'foreignKey':'IntervalId'});db[_0xbe2a('0x89')]['hasMany'](db['ChatApplication'],{'as':_0xbe2a('0x1a7'),'foreignKey':_0xbe2a('0x14a')});db[_0xbe2a('0x89')][_0xbe2a('0x113')](db[_0xbe2a('0x4d')],{'as':_0xbe2a('0x1a8'),'foreignKey':'IntervalId'});db[_0xbe2a('0x89')][_0xbe2a('0x113')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0xbe2a('0x14a')});db[_0xbe2a('0x91')][_0xbe2a('0x147')](db[_0xbe2a('0x3c')],{});db[_0xbe2a('0x91')][_0xbe2a('0x147')](db[_0xbe2a('0xa4')],{'foreignKey':_0xbe2a('0x1a9')});db[_0xbe2a('0x91')]['belongsTo'](db[_0xbe2a('0xa2')],{'foreignKey':_0xbe2a('0x1aa')});db['Sound'][_0xbe2a('0x123')](db[_0xbe2a('0x1a')],{'as':'Mohs','through':'moh_has_sounds','onDelete':_0xbe2a('0x15b')});db['Tag']['belongsToMany'](db[_0xbe2a('0x74')],{'through':'cm_contact_has_tags'});db['Tag'][_0xbe2a('0x123')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db['Tag'][_0xbe2a('0x123')](db['MailInteraction'],{'through':_0xbe2a('0x167')});db[_0xbe2a('0x95')][_0xbe2a('0x123')](db[_0xbe2a('0x118')],{'through':'sms_interaction_has_tags'});db[_0xbe2a('0x95')][_0xbe2a('0x123')](db['FaxInteraction'],{'through':_0xbe2a('0x178')});db[_0xbe2a('0x95')][_0xbe2a('0x123')](db[_0xbe2a('0x116')],{'through':_0xbe2a('0x186')});db['Tag'][_0xbe2a('0x123')](db[_0xbe2a('0x11c')],{'through':_0xbe2a('0x1ab')});db[_0xbe2a('0x98')][_0xbe2a('0x147')](db[_0xbe2a('0x1ac')],{'as':_0xbe2a('0x1ad'),'foreignKey':_0xbe2a('0x1ae')});db[_0xbe2a('0x199')][_0xbe2a('0x147')](db[_0xbe2a('0x76')],{'as':_0xbe2a('0x1af'),'foreignKey':_0xbe2a('0x19b')});db[_0xbe2a('0x98')][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x194')});db[_0xbe2a('0x9b')][_0xbe2a('0x113')](db[_0xbe2a('0x87')],{'as':{'plural':_0xbe2a('0x1b0'),'singular':_0xbe2a('0x1b1')},'foreignKey':_0xbe2a('0x1b2'),'onDelete':_0xbe2a('0x110'),'hooks':!![]});db['Trigger'][_0xbe2a('0x113')](db[_0xbe2a('0x87')],{'as':{'plural':_0xbe2a('0x1b3'),'singular':_0xbe2a('0x1b4')},'foreignKey':_0xbe2a('0x1b5'),'onDelete':_0xbe2a('0x110'),'hooks':!![]});db['Trigger']['hasMany'](db[_0xbe2a('0x1a2')],{'as':_0xbe2a('0x1a3'),'foreignKey':_0xbe2a('0x1b6'),'onDelete':_0xbe2a('0x110'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0xbe2a('0xa7')],{'as':_0xbe2a('0x1b7'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1aa'),'hooks':!![]});db[_0xbe2a('0xa4')][_0xbe2a('0x113')](db[_0xbe2a('0xa7')],{'as':_0xbe2a('0x1b7'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1a9')});db[_0xbe2a('0xa5')][_0xbe2a('0x113')](db[_0xbe2a('0xa7')],{'as':_0xbe2a('0x1b7'),'onDelete':'cascade','foreignKey':'MetricId'});db['AnalyticFieldReport']['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0xbe2a('0x1b8')});db['SalesforceAccount'][_0xbe2a('0x113')](db[_0xbe2a('0x1b9')],{'as':'Configurations','onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0x1b9')][_0xbe2a('0x113')](db[_0xbe2a('0x1bb')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0x1b9')]['hasMany'](db[_0xbe2a('0x1bb')],{'as':_0xbe2a('0x1bd'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['SalesforceConfiguration'][_0xbe2a('0x113')](db['SalesforceField'],{'as':_0xbe2a('0x1b7'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0x1b9')][_0xbe2a('0x147')](db[_0xbe2a('0x1bf')],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0x1bb')][_0xbe2a('0x113')](db[_0xbe2a('0x1bb')],{'as':'Subject','foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0x1bb')]['hasMany'](db[_0xbe2a('0x1bb')],{'as':'Description','foreignKey':_0xbe2a('0x1c0')});db[_0xbe2a('0x1bb')][_0xbe2a('0x113')](db['SalesforceField'],{'as':'Field','foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0x1bb')]['belongsTo'](db[_0xbe2a('0x9d')],{'as':_0xbe2a('0x9d'),'foreignKey':_0xbe2a('0x1c1')});db[_0xbe2a('0xac')]['hasMany'](db['SugarcrmConfiguration'],{'as':_0xbe2a('0x1c2'),'onDelete':'cascade','foreignKey':_0xbe2a('0x1ba')});db['SugarcrmConfiguration']['hasMany'](db['SugarcrmField'],{'as':_0xbe2a('0x1c3'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0xae')][_0xbe2a('0x113')](db[_0xbe2a('0xb0')],{'as':_0xbe2a('0x1bd'),'onDelete':_0xbe2a('0x110'),'foreignKey':'DescriptionId'});db[_0xbe2a('0xae')][_0xbe2a('0x113')](db[_0xbe2a('0xb0')],{'as':_0xbe2a('0x1b7'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0xae')]['belongsTo'](db[_0xbe2a('0xac')],{'as':'Account','foreignKey':'AccountId'});db[_0xbe2a('0xb0')][_0xbe2a('0x113')](db[_0xbe2a('0xb0')],{'as':_0xbe2a('0x1c4'),'foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0xb0')][_0xbe2a('0x113')](db[_0xbe2a('0xb0')],{'as':_0xbe2a('0x1c5'),'foreignKey':_0xbe2a('0x1c0')});db['SugarcrmField'][_0xbe2a('0x113')](db[_0xbe2a('0xb0')],{'as':'Field','foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0xb0')]['belongsTo'](db['Variable'],{'as':_0xbe2a('0x9d'),'foreignKey':_0xbe2a('0x1c1')});db[_0xbe2a('0x1c6')][_0xbe2a('0x113')](db[_0xbe2a('0xb3')],{'as':_0xbe2a('0x1c2'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1ba')});db['DeskConfiguration'][_0xbe2a('0x113')](db[_0xbe2a('0xb5')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0xb3')][_0xbe2a('0x113')](db['DeskField'],{'as':_0xbe2a('0x1bd'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1c0')});db['DeskConfiguration']['hasMany'](db[_0xbe2a('0xb5')],{'as':_0xbe2a('0x1b7'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0xb3')][_0xbe2a('0x147')](db[_0xbe2a('0x1c6')],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0xb3')][_0xbe2a('0x123')](db[_0xbe2a('0x95')],{'through':_0xbe2a('0x1c7')});db[_0xbe2a('0xb5')][_0xbe2a('0x113')](db['DeskField'],{'as':_0xbe2a('0x1c4'),'foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0xb5')][_0xbe2a('0x113')](db[_0xbe2a('0xb5')],{'as':_0xbe2a('0x1c5'),'foreignKey':_0xbe2a('0x1c0')});db['DeskField'][_0xbe2a('0x113')](db[_0xbe2a('0xb5')],{'as':_0xbe2a('0x1c8'),'foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0xb5')]['belongsTo'](db['Variable'],{'as':_0xbe2a('0x9d'),'foreignKey':'VariableId'});db['ZohoAccount'][_0xbe2a('0x113')](db[_0xbe2a('0x1c9')],{'as':_0xbe2a('0x1c2'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1ba')});db['ZohoConfiguration']['hasMany'](db[_0xbe2a('0xb7')],{'as':_0xbe2a('0x1c3'),'onDelete':'cascade','foreignKey':_0xbe2a('0x1bc')});db['ZohoConfiguration'][_0xbe2a('0x113')](db[_0xbe2a('0xb7')],{'as':_0xbe2a('0x1bd'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1c0')});db[_0xbe2a('0x1c9')][_0xbe2a('0x113')](db[_0xbe2a('0xb7')],{'as':_0xbe2a('0x1b7'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0x1c9')][_0xbe2a('0x147')](db[_0xbe2a('0xb6')],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0xb7')][_0xbe2a('0x113')](db['ZohoField'],{'as':_0xbe2a('0x1c4'),'foreignKey':'SubjectId'});db[_0xbe2a('0xb7')]['hasMany'](db[_0xbe2a('0xb7')],{'as':'Description','foreignKey':_0xbe2a('0x1c0')});db[_0xbe2a('0xb7')][_0xbe2a('0x113')](db['ZohoField'],{'as':_0xbe2a('0x1c8'),'foreignKey':'FieldId'});db[_0xbe2a('0xb7')][_0xbe2a('0x147')](db[_0xbe2a('0x9d')],{'as':_0xbe2a('0x9d'),'foreignKey':'VariableId'});db[_0xbe2a('0xb9')]['hasMany'](db[_0xbe2a('0x1ca')],{'as':_0xbe2a('0x1c2'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0x1ca')][_0xbe2a('0x113')](db[_0xbe2a('0xba')],{'as':'Subjects','foreignKey':_0xbe2a('0x1bc')});db['ZendeskConfiguration'][_0xbe2a('0x113')](db[_0xbe2a('0xba')],{'as':_0xbe2a('0x1bd'),'foreignKey':_0xbe2a('0x1c0')});db['ZendeskConfiguration'][_0xbe2a('0x113')](db[_0xbe2a('0xba')],{'as':'Fields','foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0x1ca')][_0xbe2a('0x147')](db[_0xbe2a('0xb9')],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0x1ca')][_0xbe2a('0x123')](db[_0xbe2a('0x95')],{'through':_0xbe2a('0x1cb')});db[_0xbe2a('0xba')]['hasMany'](db['ZendeskField'],{'as':_0xbe2a('0x1c4'),'foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0xba')][_0xbe2a('0x113')](db[_0xbe2a('0xba')],{'as':_0xbe2a('0x1c5'),'foreignKey':_0xbe2a('0x1c0')});db['ZendeskField'][_0xbe2a('0x113')](db['ZendeskField'],{'as':_0xbe2a('0x1c8'),'foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0xba')]['belongsTo'](db[_0xbe2a('0x9d')],{'as':_0xbe2a('0x9d'),'foreignKey':'VariableId'});db['FreshdeskAccount'][_0xbe2a('0x113')](db[_0xbe2a('0xbe')],{'as':_0xbe2a('0x1c2'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0xbe')][_0xbe2a('0x113')](db[_0xbe2a('0xbf')],{'as':_0xbe2a('0x1c3'),'onDelete':'cascade','foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0xbe')]['hasMany'](db[_0xbe2a('0xbf')],{'as':_0xbe2a('0x1bd'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1c0')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':_0xbe2a('0x1b7'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0xbe')][_0xbe2a('0x147')](db[_0xbe2a('0xbc')],{'as':_0xbe2a('0x164'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0xbe2a('0x123')](db[_0xbe2a('0x95')],{'through':_0xbe2a('0x1cc')});db[_0xbe2a('0xbf')][_0xbe2a('0x113')](db[_0xbe2a('0xbf')],{'as':_0xbe2a('0x1c4'),'foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0xbf')][_0xbe2a('0x113')](db[_0xbe2a('0xbf')],{'as':_0xbe2a('0x1c5'),'foreignKey':_0xbe2a('0x1c0')});db[_0xbe2a('0xbf')][_0xbe2a('0x113')](db['FreshdeskField'],{'as':_0xbe2a('0x1c8'),'foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0xbf')][_0xbe2a('0x147')](db[_0xbe2a('0x9d')],{'as':'Variable','foreignKey':_0xbe2a('0x1c1')});db[_0xbe2a('0xc1')]['hasMany'](db[_0xbe2a('0xc3')],{'as':'Configurations','onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0xc3')][_0xbe2a('0x113')](db[_0xbe2a('0xc5')],{'as':'Subjects','foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0xc3')]['hasMany'](db[_0xbe2a('0xc5')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xbe2a('0xc3')][_0xbe2a('0x113')](db[_0xbe2a('0xc5')],{'as':_0xbe2a('0x1b7'),'foreignKey':_0xbe2a('0x1be')});db['VtigerConfiguration'][_0xbe2a('0x147')](db[_0xbe2a('0xc1')],{'as':'Account','foreignKey':'AccountId'});db['VtigerField']['hasMany'](db[_0xbe2a('0xc5')],{'as':'Subject','foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0xc5')][_0xbe2a('0x113')](db[_0xbe2a('0xc5')],{'as':_0xbe2a('0x1c5'),'foreignKey':_0xbe2a('0x1c0')});db['VtigerField'][_0xbe2a('0x113')](db['VtigerField'],{'as':_0xbe2a('0x1c8'),'foreignKey':'FieldId'});db['VtigerField'][_0xbe2a('0x147')](db[_0xbe2a('0x9d')],{'as':_0xbe2a('0x9d'),'foreignKey':_0xbe2a('0x1c1')});db[_0xbe2a('0xc7')][_0xbe2a('0x113')](db['ServicenowConfiguration'],{'as':_0xbe2a('0x1c2'),'onDelete':'cascade','foreignKey':'AccountId'});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':'Subjects','foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0xc8')][_0xbe2a('0x113')](db[_0xbe2a('0x1cd')],{'as':_0xbe2a('0x1bd'),'foreignKey':_0xbe2a('0x1c0')});db['ServicenowConfiguration'][_0xbe2a('0x113')](db[_0xbe2a('0x1cd')],{'as':_0xbe2a('0x1b7'),'foreignKey':'FieldId'});db[_0xbe2a('0xc8')][_0xbe2a('0x147')](db[_0xbe2a('0xc7')],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0x1cd')][_0xbe2a('0x113')](db[_0xbe2a('0x1cd')],{'as':_0xbe2a('0x1c4'),'foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0x1cd')][_0xbe2a('0x113')](db['ServicenowField'],{'as':_0xbe2a('0x1c5'),'foreignKey':'DescriptionId'});db[_0xbe2a('0x1cd')][_0xbe2a('0x113')](db[_0xbe2a('0x1cd')],{'as':'Field','foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0x1cd')][_0xbe2a('0x147')](db[_0xbe2a('0x9d')],{'as':_0xbe2a('0x9d'),'foreignKey':_0xbe2a('0x1c1')});db['Dynamics365Account'][_0xbe2a('0x113')](db[_0xbe2a('0xcb')],{'as':_0xbe2a('0x1c2'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0xca')][_0xbe2a('0x147')](db[_0xbe2a('0x105')],{'as':'CloudProvider','foreignKey':_0xbe2a('0x15a')});db[_0xbe2a('0xcb')][_0xbe2a('0x113')](db['Dynamics365Field'],{'as':_0xbe2a('0x1c3'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1bc')});db[_0xbe2a('0xcb')][_0xbe2a('0x113')](db[_0xbe2a('0xcd')],{'as':'Descriptions','onDelete':_0xbe2a('0x110'),'foreignKey':'DescriptionId'});db[_0xbe2a('0xcb')][_0xbe2a('0x113')](db[_0xbe2a('0xcd')],{'as':_0xbe2a('0x1b7'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0xcb')][_0xbe2a('0x147')](db[_0xbe2a('0xca')],{'as':'Account','foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0xcd')][_0xbe2a('0x113')](db[_0xbe2a('0xcd')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xbe2a('0xcd')][_0xbe2a('0x113')](db[_0xbe2a('0xcd')],{'as':_0xbe2a('0x1c5'),'foreignKey':'DescriptionId'});db[_0xbe2a('0xcd')][_0xbe2a('0x113')](db['Dynamics365Field'],{'as':'Field','foreignKey':_0xbe2a('0x1be')});db[_0xbe2a('0xcd')][_0xbe2a('0x147')](db[_0xbe2a('0x9d')],{'as':_0xbe2a('0x9d'),'foreignKey':'VariableId'});db[_0xbe2a('0xce')][_0xbe2a('0x113')](db[_0xbe2a('0x1ce')],{'as':_0xbe2a('0x1c2'),'onDelete':'cascade','foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0x1ce')][_0xbe2a('0x113')](db[_0xbe2a('0xd1')],{'as':_0xbe2a('0x1c3'),'foreignKey':'SubjectId'});db[_0xbe2a('0x1ce')]['hasMany'](db[_0xbe2a('0xd1')],{'as':_0xbe2a('0x1bd'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0xbe2a('0x113')](db['FreshsalesField'],{'as':_0xbe2a('0x1b7'),'foreignKey':'FieldId'});db[_0xbe2a('0x1ce')][_0xbe2a('0x147')](db[_0xbe2a('0xce')],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x1ba')});db[_0xbe2a('0xd1')][_0xbe2a('0x113')](db[_0xbe2a('0xd1')],{'as':_0xbe2a('0x1c4'),'foreignKey':_0xbe2a('0x1bc')});db['FreshsalesField'][_0xbe2a('0x113')](db[_0xbe2a('0xd1')],{'as':_0xbe2a('0x1c5'),'foreignKey':_0xbe2a('0x1c0')});db['FreshsalesField'][_0xbe2a('0x113')](db[_0xbe2a('0xd1')],{'as':'Field','foreignKey':_0xbe2a('0x1be')});db['FreshsalesField'][_0xbe2a('0x147')](db[_0xbe2a('0x9d')],{'as':_0xbe2a('0x9d'),'foreignKey':_0xbe2a('0x1c1')});db[_0xbe2a('0xd3')][_0xbe2a('0x147')](db['ChatWebsite'],{});db['ChatQueueReport'][_0xbe2a('0x147')](db[_0xbe2a('0xf4')],{'as':_0xbe2a('0x177'),'foreignKey':_0xbe2a('0x173')});db['ChatQueueReport']['belongsTo'](db[_0xbe2a('0x74')],{'as':'Contact','foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0xd3')][_0xbe2a('0x147')](db['ChatInteraction'],{});db['ChatQueueReport'][_0xbe2a('0x147')](db[_0xbe2a('0x189')],{});db[_0xbe2a('0xd3')]['belongsTo'](db['User'],{});db[_0xbe2a('0xd3')][_0xbe2a('0x147')](db[_0xbe2a('0x6d')],{});db[_0xbe2a('0xd4')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1cf')});db['ChatInternalMessage'][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'onDelete':'cascade','foreignKey':_0xbe2a('0x1d0')});db[_0xbe2a('0xd7')][_0xbe2a('0x113')](db[_0xbe2a('0x1d1')],{'foreignKey':_0xbe2a('0x1d2'),'onDelete':'cascade'});db[_0xbe2a('0xd7')][_0xbe2a('0x113')](db[_0xbe2a('0x1d3')],{'foreignKey':_0xbe2a('0x1d2'),'onDelete':'cascade'});db[_0xbe2a('0xd8')][_0xbe2a('0x147')](db[_0xbe2a('0x55')],{});db['SmsQueueReport'][_0xbe2a('0x147')](db['CmList'],{'as':_0xbe2a('0x177'),'foreignKey':_0xbe2a('0x173')});db[_0xbe2a('0xd8')]['belongsTo'](db[_0xbe2a('0x74')],{'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0xd8')][_0xbe2a('0x147')](db['SmsInteraction'],{});db[_0xbe2a('0xd8')][_0xbe2a('0x147')](db[_0xbe2a('0x5a')],{});db[_0xbe2a('0xd8')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{});db['SmsQueueReport']['belongsTo'](db['SmsQueue'],{});db['JscriptyProject'][_0xbe2a('0x113')](db['JscriptySessionReport'],{'foreignKey':_0xbe2a('0x1d4')});db[_0xbe2a('0xdc')]['hasMany'](db[_0xbe2a('0x1d1')],{'foreignKey':_0xbe2a('0x1d4')});db[_0xbe2a('0xdc')][_0xbe2a('0x113')](db[_0xbe2a('0x1d3')],{'foreignKey':_0xbe2a('0x1d4')});db[_0xbe2a('0xe3')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x14f'),'through':_0xbe2a('0x124')});db[_0xbe2a('0xe3')][_0xbe2a('0x123')](db[_0xbe2a('0x12b')],{'through':_0xbe2a('0x107'),'as':_0xbe2a('0x12c')});db[_0xbe2a('0xe3')][_0xbe2a('0x123')](db[_0xbe2a('0x3d')],{'through':_0xbe2a('0x1d5'),'as':_0xbe2a('0x12f')});db[_0xbe2a('0xe3')]['belongsToMany'](db[_0xbe2a('0x6d')],{'through':_0xbe2a('0x18f'),'as':'ChatQueues'});db[_0xbe2a('0xe3')][_0xbe2a('0x123')](db[_0xbe2a('0x52')],{'through':_0xbe2a('0x1d6'),'as':_0xbe2a('0x1d7')});db[_0xbe2a('0xe3')][_0xbe2a('0x123')](db['SmsQueue'],{'through':_0xbe2a('0x181'),'as':_0xbe2a('0x132')});db[_0xbe2a('0xe3')]['belongsToMany'](db[_0xbe2a('0x133')],{'through':_0xbe2a('0x187'),'as':_0xbe2a('0x134')});db[_0xbe2a('0xe3')][_0xbe2a('0x123')](db[_0xbe2a('0x135')],{'through':_0xbe2a('0x1d8'),'as':_0xbe2a('0x1d9')});db['Team'][_0xbe2a('0x123')](db[_0xbe2a('0x12d')],{'through':'TeamVoicePrefix','as':_0xbe2a('0x12e')});db['Campaign'][_0xbe2a('0x113')](db[_0xbe2a('0x76')],{'as':'Hoppers','foreignKey':_0xbe2a('0x1da')});db[_0xbe2a('0xe7')][_0xbe2a('0x113')](db[_0xbe2a('0x7a')],{'as':'HopperFinals','foreignKey':_0xbe2a('0x1da')});db[_0xbe2a('0xe7')]['hasMany'](db[_0xbe2a('0x7b')],{'as':_0xbe2a('0x196'),'foreignKey':_0xbe2a('0x1da')});db[_0xbe2a('0xe7')]['hasMany'](db[_0xbe2a('0x78')],{'as':'HopperBlacks','foreignKey':_0xbe2a('0x1da')});db[_0xbe2a('0xe7')][_0xbe2a('0x147')](db[_0xbe2a('0x2a')],{'as':_0xbe2a('0x2a'),'foreignKey':_0xbe2a('0x148')});db['Campaign'][_0xbe2a('0x147')](db[_0xbe2a('0x2a')],{'as':_0xbe2a('0x149'),'foreignKey':_0xbe2a('0x1db')});db['Campaign']['belongsTo'](db['Interval'],{'as':_0xbe2a('0x89'),'foreignKey':'IntervalId'});db[_0xbe2a('0xe7')][_0xbe2a('0x147')](db['SquareProject'],{'as':_0xbe2a('0x1dc'),'foreignKey':_0xbe2a('0x1dd')});db['Campaign'][_0xbe2a('0x123')](db['CmList'],{'as':_0xbe2a('0x14d'),'through':'campaigns_has_cm_lists'});db[_0xbe2a('0xe7')][_0xbe2a('0x123')](db['CmList'],{'as':_0xbe2a('0x150'),'through':'campaigns_has_cm_blacklists'});db['Attachment'][_0xbe2a('0x147')](db[_0xbe2a('0x16f')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0xbe2a('0xed')][_0xbe2a('0x147')](db[_0xbe2a('0x42')],{});db['MailTransferReport'][_0xbe2a('0x147')](db[_0xbe2a('0x11a')],{});db[_0xbe2a('0xed')][_0xbe2a('0x147')](db['MailAccount'],{'foreignKey':_0xbe2a('0x1de'),'as':_0xbe2a('0x1df')});db['MailTransferReport'][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'foreignKey':_0xbe2a('0x1e0'),'as':_0xbe2a('0x1e1')});db[_0xbe2a('0xed')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'foreignKey':_0xbe2a('0x1e2'),'as':_0xbe2a('0x1e3')});db['MailTransferReport'][_0xbe2a('0x147')](db['MailQueue'],{'foreignKey':_0xbe2a('0x1e4'),'as':'ToQueue'});db[_0xbe2a('0xed')][_0xbe2a('0x147')](db[_0xbe2a('0x3c')],{'foreignKey':_0xbe2a('0x1e5'),'as':'ToAccount'});db[_0xbe2a('0xee')][_0xbe2a('0x147')](db[_0xbe2a('0x189')],{});db[_0xbe2a('0xee')]['belongsTo'](db[_0xbe2a('0x6a')],{});db[_0xbe2a('0xee')][_0xbe2a('0x147')](db[_0xbe2a('0x64')],{'foreignKey':_0xbe2a('0x1e6'),'as':_0xbe2a('0x1df')});db[_0xbe2a('0xee')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'foreignKey':_0xbe2a('0x1e0'),'as':'FromAgent'});db[_0xbe2a('0xee')]['belongsTo'](db[_0xbe2a('0x13')],{'foreignKey':_0xbe2a('0x1e2'),'as':_0xbe2a('0x1e3')});db['ChatTransferReport'][_0xbe2a('0x147')](db['ChatQueue'],{'foreignKey':_0xbe2a('0x1e7'),'as':_0xbe2a('0x1e8')});db['ChatTransferReport'][_0xbe2a('0x147')](db[_0xbe2a('0x64')],{'foreignKey':'ToChatWebsiteId','as':_0xbe2a('0x1e9')});db[_0xbe2a('0x1ea')][_0xbe2a('0x147')](db[_0xbe2a('0x50')],{});db[_0xbe2a('0x1ea')][_0xbe2a('0x147')](db[_0xbe2a('0x4e')],{});db['FaxTransferReport']['belongsTo'](db[_0xbe2a('0x4b')],{'foreignKey':_0xbe2a('0x1eb'),'as':_0xbe2a('0x1df')});db[_0xbe2a('0x1ea')]['belongsTo'](db[_0xbe2a('0x13')],{'foreignKey':_0xbe2a('0x1e0'),'as':_0xbe2a('0x1e1')});db[_0xbe2a('0x1ea')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'foreignKey':_0xbe2a('0x1e2'),'as':_0xbe2a('0x1e3')});db[_0xbe2a('0x1ea')][_0xbe2a('0x147')](db[_0xbe2a('0x52')],{'foreignKey':'ToFaxQueueId','as':'ToQueue'});db[_0xbe2a('0x1ea')][_0xbe2a('0x147')](db['FaxAccount'],{'foreignKey':_0xbe2a('0x1ec'),'as':'ToAccount'});db[_0xbe2a('0xf1')]['belongsTo'](db[_0xbe2a('0x62')],{});db[_0xbe2a('0xf1')][_0xbe2a('0x147')](db['OpenchannelInteraction'],{});db[_0xbe2a('0xf1')]['belongsTo'](db[_0xbe2a('0x5e')],{'foreignKey':_0xbe2a('0x1ed'),'as':_0xbe2a('0x1df')});db[_0xbe2a('0xf1')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'foreignKey':_0xbe2a('0x1e0'),'as':'FromAgent'});db[_0xbe2a('0xf1')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'foreignKey':_0xbe2a('0x1e2'),'as':'ToAgent'});db[_0xbe2a('0xf1')][_0xbe2a('0x147')](db[_0xbe2a('0x133')],{'foreignKey':'ToOpenchannelQueueId','as':_0xbe2a('0x1e8')});db[_0xbe2a('0xf1')][_0xbe2a('0x147')](db[_0xbe2a('0x5e')],{'foreignKey':'ToOpenchannelAccountId','as':_0xbe2a('0x1e9')});db[_0xbe2a('0xf2')][_0xbe2a('0x147')](db['SmsMessage'],{});db[_0xbe2a('0xf2')][_0xbe2a('0x147')](db[_0xbe2a('0x118')],{});db[_0xbe2a('0xf2')][_0xbe2a('0x147')](db[_0xbe2a('0x55')],{'foreignKey':'FromSmsAccountId','as':'FromAccount'});db[_0xbe2a('0xf2')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'foreignKey':_0xbe2a('0x1e0'),'as':_0xbe2a('0x1e1')});db[_0xbe2a('0xf2')]['belongsTo'](db[_0xbe2a('0x13')],{'foreignKey':_0xbe2a('0x1e2'),'as':'ToAgent'});db['SmsTransferReport']['belongsTo'](db[_0xbe2a('0x5c')],{'foreignKey':'ToSmsQueueId','as':_0xbe2a('0x1e8')});db['SmsTransferReport']['belongsTo'](db[_0xbe2a('0x55')],{'foreignKey':_0xbe2a('0x1ee'),'as':_0xbe2a('0x1e9')});db[_0xbe2a('0xf4')][_0xbe2a('0x113')](db[_0xbe2a('0x15e')],{'as':_0xbe2a('0x15f'),'foreignKey':_0xbe2a('0x173'),'onDelete':'cascade'});db[_0xbe2a('0xf4')][_0xbe2a('0x113')](db['CmCustomField'],{'as':'CustomFields','foreignKey':'ListId'});db[_0xbe2a('0xf4')][_0xbe2a('0x113')](db['CmContact'],{'as':_0xbe2a('0x1ef'),'onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x173')});db[_0xbe2a('0xf4')][_0xbe2a('0x113')](db['CmHopperFinal'],{'as':_0xbe2a('0x115'),'foreignKey':_0xbe2a('0x173')});db['CmList'][_0xbe2a('0x113')](db['CmHopperHistory'],{'as':_0xbe2a('0x1f0'),'foreignKey':_0xbe2a('0x173')});db[_0xbe2a('0xf4')][_0xbe2a('0x113')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xbe2a('0x173')});db[_0xbe2a('0xf4')]['belongsToMany'](db[_0xbe2a('0x12b')],{'as':_0xbe2a('0x1f1'),'through':'voice_queues_has_cm_lists'});db[_0xbe2a('0xf4')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':'Agents','through':'cm_user_has_lists'});db['VoicePrefix'][_0xbe2a('0x113')](db[_0xbe2a('0x19')],{'as':_0xbe2a('0x114'),'onDelete':'cascade'});db[_0xbe2a('0x12d')][_0xbe2a('0x123')](db['User'],{'as':'Agents','through':'UserVoicePrefix'});db[_0xbe2a('0x12d')][_0xbe2a('0x123')](db[_0xbe2a('0xe3')],{'through':_0xbe2a('0x1f2'),'as':'Teams'});db[_0xbe2a('0xf7')][_0xbe2a('0x113')](db['User'],{'as':'Users','foreignKey':_0xbe2a('0x11f')});db['UserProfile'][_0xbe2a('0x113')](db[_0xbe2a('0xf8')],{'as':_0xbe2a('0x1f3'),'foreignKey':'userProfileId','onDelete':_0xbe2a('0x110')});db['UserProfileSection'][_0xbe2a('0x113')](db[_0xbe2a('0x1f4')],{'as':_0xbe2a('0x1f5'),'foreignKey':_0xbe2a('0x1f6'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0xfb')][_0xbe2a('0x113')](db[_0xbe2a('0x15e')],{'as':'Dispositions','foreignKey':_0xbe2a('0x1f7'),'onDelete':_0xbe2a('0x110')});db[_0xbe2a('0xfb')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xbe2a('0x1f7')});db[_0xbe2a('0xfb')]['hasMany'](db[_0xbe2a('0x100')],{'as':_0xbe2a('0x152'),'foreignKey':'WhatsappAccountId'});db[_0xbe2a('0xfb')][_0xbe2a('0x113')](db[_0xbe2a('0x11c')],{'as':'Interactions'});db[_0xbe2a('0xfb')][_0xbe2a('0x113')](db[_0xbe2a('0xfd')],{'as':_0xbe2a('0x141'),'foreignKey':_0xbe2a('0x1f7'),'onDelete':'cascade'});db['WhatsappAccount'][_0xbe2a('0x147')](db['CmList'],{'as':_0xbe2a('0x177'),'foreignKey':_0xbe2a('0x173')});db[_0xbe2a('0xfb')][_0xbe2a('0x147')](db[_0xbe2a('0x8b')],{'as':_0xbe2a('0x14b'),'foreignKey':_0xbe2a('0x14c')});db[_0xbe2a('0xfb')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x14f'),'through':'user_has_whatsapp_accounts'});db[_0xbe2a('0xfd')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0xfd')]['belongsTo'](db[_0xbe2a('0x135')],{'onDelete':'restrict'});db[_0xbe2a('0xfd')][_0xbe2a('0x147')](db[_0xbe2a('0xfb')],{'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0xfd')][_0xbe2a('0x147')](db[_0xbe2a('0x89')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xbe2a('0xfd')][_0xbe2a('0x147')](db[_0xbe2a('0x95')],{'onDelete':_0xbe2a('0x15b'),'foreignKey':_0xbe2a('0x171')});db[_0xbe2a('0x11c')]['hasMany'](db[_0xbe2a('0x100')],{'as':'Messages','onDelete':_0xbe2a('0x110'),'foreignKey':_0xbe2a('0x1f8')});db[_0xbe2a('0x11c')][_0xbe2a('0x147')](db[_0xbe2a('0xfb')],{'as':_0xbe2a('0x164'),'foreignKey':_0xbe2a('0x1f7')});db['WhatsappInteraction'][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'as':'Contact','foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x11c')]['belongsTo'](db['User'],{'as':_0xbe2a('0x166'),'foreignKey':'UserId'});db['WhatsappInteraction']['belongsToMany'](db[_0xbe2a('0x95')],{'through':'whatsapp_interaction_has_tags','as':_0xbe2a('0x168')});db[_0xbe2a('0x11c')][_0xbe2a('0x123')](db[_0xbe2a('0x95')],{'through':_0xbe2a('0x1ab'),'as':_0xbe2a('0x169')});db[_0xbe2a('0x11c')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x16a'),'through':_0xbe2a('0x12a'),'foreignKey':_0xbe2a('0x1f8')});db[_0xbe2a('0x100')][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x13')});db[_0xbe2a('0x100')][_0xbe2a('0x147')](db[_0xbe2a('0x74')],{'onDelete':_0xbe2a('0x110'),'as':_0xbe2a('0x165')});db[_0xbe2a('0x100')][_0xbe2a('0x147')](db['WhatsappInteraction'],{'onDelete':_0xbe2a('0x110'),'as':_0xbe2a('0x16d'),'foreignKey':_0xbe2a('0x1f8')});db['WhatsappMessage'][_0xbe2a('0x147')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0xbe2a('0x1f7')});db[_0xbe2a('0x102')]['belongsTo'](db[_0xbe2a('0xfb')],{});db[_0xbe2a('0x102')][_0xbe2a('0x147')](db[_0xbe2a('0xf4')],{'as':'List','foreignKey':_0xbe2a('0x173')});db[_0xbe2a('0x102')][_0xbe2a('0x147')](db['CmContact'],{'as':_0xbe2a('0x165'),'foreignKey':_0xbe2a('0x157')});db[_0xbe2a('0x102')][_0xbe2a('0x147')](db[_0xbe2a('0x11c')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xbe2a('0x135')],{});db[_0xbe2a('0x102')][_0xbe2a('0x147')](db[_0xbe2a('0x100')],{});db['WhatsappQueueReport'][_0xbe2a('0x147')](db[_0xbe2a('0x13')],{});db[_0xbe2a('0x104')][_0xbe2a('0x147')](db[_0xbe2a('0x100')],{});db[_0xbe2a('0x104')][_0xbe2a('0x147')](db['WhatsappInteraction'],{});db[_0xbe2a('0x104')][_0xbe2a('0x147')](db[_0xbe2a('0xfb')],{'foreignKey':_0xbe2a('0x1f9'),'as':_0xbe2a('0x1df')});db['WhatsappTransferReport'][_0xbe2a('0x147')](db[_0xbe2a('0xfb')],{'foreignKey':_0xbe2a('0x1fa'),'as':_0xbe2a('0x1e9')});db[_0xbe2a('0x104')][_0xbe2a('0x147')](db[_0xbe2a('0x135')],{'foreignKey':'ToQueueId','as':_0xbe2a('0x1e8')});db['WhatsappTransferReport']['belongsTo'](db[_0xbe2a('0x13')],{'foreignKey':_0xbe2a('0x1e0'),'as':'FromAgent'});db['WhatsappTransferReport']['belongsTo'](db[_0xbe2a('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xbe2a('0x135')][_0xbe2a('0x123')](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x14f'),'through':_0xbe2a('0x136'),'foreignKey':_0xbe2a('0x1fb')});db[_0xbe2a('0x135')][_0xbe2a('0x123')](db['Team'],{'through':_0xbe2a('0x1d8'),'as':'Teams'});db[_0xbe2a('0x10c')]['belongsTo'](db[_0xbe2a('0x13')],{'as':_0xbe2a('0x1fc'),'foreignKey':_0xbe2a('0x111'),'onDelete':_0xbe2a('0x110'),'hooks':!![]});db[_0xbe2a('0x105')][_0xbe2a('0x10f')](db[_0xbe2a('0xca')],{'as':_0xbe2a('0xca'),'onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x105')][_0xbe2a('0x10f')](db['MailServerIn'],{'as':'Imap','onDelete':_0xbe2a('0x15b')});db[_0xbe2a('0x105')][_0xbe2a('0x10f')](db[_0xbe2a('0x3a')],{'as':'Smtp','onDelete':'restrict'});module[_0xbe2a('0x1fd')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 66212b7..8fbf51e 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a6b=['./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./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/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareMessage','/api/license','./api/license','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','join','/www','static','root','/demo','/snippet','snippet','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','path','./utils/client-side-logger','./api/client-side-logs','default','use','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations'];(function(_0x5bc889,_0xd385d8){var _0x2d3152=function(_0xc959c2){while(--_0xc959c2){_0x5bc889['push'](_0x5bc889['shift']());}};_0x2d3152(++_0xd385d8);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x3093fe,_0x5a0cff){_0x3093fe=_0x3093fe-0x0;var _0x31517d=_0x0a6b[_0x3093fe];return _0x31517d;};'use strict';var path=require(_0xb0a6('0x0'));var express=require('express');var errors=require('./errors');var config=require('./config/environment');var setupLoggers=require(_0xb0a6('0x1'))['setupLoggers'];var clientSideLogs=require(_0xb0a6('0x2'));exports[_0xb0a6('0x3')]=function(_0x1d3b78){return setupLoggers(_0x1d3b78)['then'](function(){_0x1d3b78[_0xb0a6('0x4')]('/api/users',require(_0xb0a6('0x5')));_0x1d3b78[_0xb0a6('0x4')]('/api/voice/chanspy',require(_0xb0a6('0x6')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x7'),require('./api/voiceContext'));_0x1d3b78['use']('/api/voice/extensions',require(_0xb0a6('0x8')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x9'),require(_0xb0a6('0xa')));_0x1d3b78['use'](_0xb0a6('0xb'),require(_0xb0a6('0xc')));_0x1d3b78['use'](_0xb0a6('0xd'),require(_0xb0a6('0xe')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xf'),require(_0xb0a6('0x10')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x11'),require(_0xb0a6('0x12')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x13'),require('./api/voiceMailMessage'));_0x1d3b78[_0xb0a6('0x4')]('/api/voice/calls/reports',require(_0xb0a6('0x14')));_0x1d3b78['use'](_0xb0a6('0x15'),require('./api/voiceDialReport'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x16'),require(_0xb0a6('0x17')));_0x1d3b78['use']('/api/voice/queues/reports',require(_0xb0a6('0x18')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x19'),require(_0xb0a6('0x1a')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x1b'),require('./api/trunk'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x1c'),require(_0xb0a6('0x1d')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x1e'),require(_0xb0a6('0x1f')));_0x1d3b78['use'](_0xb0a6('0x20'),require(_0xb0a6('0x21')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x22'),require(_0xb0a6('0x23')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x24'),require(_0xb0a6('0x25')));_0x1d3b78['use'](_0xb0a6('0x26'),require('./api/mailInteraction'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x27'),require('./api/mailMessage'));_0x1d3b78['use'](_0xb0a6('0x28'),require(_0xb0a6('0x29')));_0x1d3b78['use'](_0xb0a6('0x2a'),require(_0xb0a6('0x2b')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x2c'),require('./api/dashboard'));_0x1d3b78['use'](_0xb0a6('0x2d'),require(_0xb0a6('0x2e')));_0x1d3b78[_0xb0a6('0x4')]('/api/fax/accounts',require(_0xb0a6('0x2f')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x30'),require(_0xb0a6('0x31')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x32'),require(_0xb0a6('0x33')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x34'),require('./api/faxMessage'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x35'),require(_0xb0a6('0x36')));_0x1d3b78['use'](_0xb0a6('0x37'),require('./api/faxQueueReport'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x38'),require(_0xb0a6('0x39')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x3a'),require(_0xb0a6('0x3b')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x3c'),require(_0xb0a6('0x3d')));_0x1d3b78[_0xb0a6('0x4')]('/api/sms/messages',require('./api/smsMessage'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x3e'),require(_0xb0a6('0x3f')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x40'),require(_0xb0a6('0x41')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x42'),require('./api/openchannelApplication'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x43'),require('./api/openchannelInteraction'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x44'),require('./api/openchannelMessage'));_0x1d3b78['use'](_0xb0a6('0x45'),require(_0xb0a6('0x46')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x47'),require(_0xb0a6('0x48')));_0x1d3b78[_0xb0a6('0x4')]('/api/openchannel/reports/queue',require(_0xb0a6('0x49')));_0x1d3b78['use'](_0xb0a6('0x4a'),require(_0xb0a6('0x4b')));_0x1d3b78['use']('/api/chat/interactions',require('./api/chatInteraction'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x4c'),require(_0xb0a6('0x4d')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x4e'),require('./api/chatOfflineMessage'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x4f'),require(_0xb0a6('0x50')));_0x1d3b78[_0xb0a6('0x4')]('/api/chat/groups',require(_0xb0a6('0x51')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x52'),require(_0xb0a6('0x53')));_0x1d3b78[_0xb0a6('0x4')]('/api/cm/companies',require('./api/cmCompany'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x54'),require(_0xb0a6('0x55')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x56'),require(_0xb0a6('0x57')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x58'),require('./api/cmHopperBlack'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x59'),require(_0xb0a6('0x5a')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x5b'),require('./api/cmHopperHistory'));_0x1d3b78[_0xb0a6('0x4')]('/api/cm/custom_fields',require(_0xb0a6('0x5c')));_0x1d3b78['use'](_0xb0a6('0x5d'),require('./api/action'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x5e'),require(_0xb0a6('0x5f')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x60'),require(_0xb0a6('0x61')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x62'),require(_0xb0a6('0x63')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x64'),require(_0xb0a6('0x65')));_0x1d3b78['use'](_0xb0a6('0x66'),require(_0xb0a6('0x67')));_0x1d3b78['use'](_0xb0a6('0x68'),require('./api/pause'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x69'),require(_0xb0a6('0x6a')));_0x1d3b78['use'](_0xb0a6('0x6b'),require(_0xb0a6('0x6c')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x6d'),require(_0xb0a6('0x6e')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x6f'),require(_0xb0a6('0x70')));_0x1d3b78['use'](_0xb0a6('0x71'),require(_0xb0a6('0x72')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x73'),require('./api/contactItemType'));_0x1d3b78['use']('/api/cm_contact_has_items',require('./api/cmContactHasItem'));_0x1d3b78['use']('/api/cm_hopper_additional_phones',require('./api/cmHopperAdditionalPhone'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x74'),require(_0xb0a6('0x75')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x76'),require(_0xb0a6('0x77')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x78'),require(_0xb0a6('0x79')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x7a'),require(_0xb0a6('0x7b')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x7c'),require(_0xb0a6('0x7d')));_0x1d3b78[_0xb0a6('0x4')]('/api/analytics/custom_reports',require(_0xb0a6('0x7e')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x7f'),require(_0xb0a6('0x80')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x81'),require(_0xb0a6('0x82')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x83'),require('./api/analyticMetric'));_0x1d3b78['use'](_0xb0a6('0x84'),require(_0xb0a6('0x85')));_0x1d3b78[_0xb0a6('0x4')]('/api/analytics/tree_reports',require(_0xb0a6('0x86')));_0x1d3b78['use'](_0xb0a6('0x87'),require(_0xb0a6('0x88')));_0x1d3b78['use'](_0xb0a6('0x89'),require(_0xb0a6('0x8a')));_0x1d3b78['use'](_0xb0a6('0x8b'),require('./api/intSalesforceField'));_0x1d3b78[_0xb0a6('0x4')]('/api/integrations/sugarcrm/accounts',require(_0xb0a6('0x8c')));_0x1d3b78[_0xb0a6('0x4')]('/api/integrations/sugarcrm/configurations',require(_0xb0a6('0x8d')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x8e'),require(_0xb0a6('0x8f')));_0x1d3b78[_0xb0a6('0x4')]('/api/integrations/desk/accounts',require(_0xb0a6('0x90')));_0x1d3b78['use'](_0xb0a6('0x91'),require('./api/intDeskConfiguration'));_0x1d3b78['use'](_0xb0a6('0x92'),require(_0xb0a6('0x93')));_0x1d3b78['use'](_0xb0a6('0x94'),require('./api/intZohoAccount'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x95'),require(_0xb0a6('0x96')));_0x1d3b78[_0xb0a6('0x4')]('/api/integrations/zoho/fields',require(_0xb0a6('0x97')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x98'),require(_0xb0a6('0x99')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x9a'),require('./api/intZendeskConfiguration'));_0x1d3b78['use'](_0xb0a6('0x9b'),require('./api/intZendeskField'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x9c'),require(_0xb0a6('0x9d')));_0x1d3b78['use'](_0xb0a6('0x9e'),require(_0xb0a6('0x9f')));_0x1d3b78['use'](_0xb0a6('0xa0'),require(_0xb0a6('0xa1')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xa2'),require(_0xb0a6('0xa3')));_0x1d3b78['use'](_0xb0a6('0xa4'),require(_0xb0a6('0xa5')));_0x1d3b78['use'](_0xb0a6('0xa6'),require(_0xb0a6('0xa7')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xa8'),require(_0xb0a6('0xa9')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xaa'),require(_0xb0a6('0xab')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xac'),require(_0xb0a6('0xad')));_0x1d3b78[_0xb0a6('0x4')]('/api/integrations/dynamics365/accounts',require(_0xb0a6('0xae')));_0x1d3b78['use'](_0xb0a6('0xaf'),require(_0xb0a6('0xb0')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xb1'),require('./api/intDynamics365Field'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xb2'),require(_0xb0a6('0xb3')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xb4'),require(_0xb0a6('0xb5')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xb6'),require(_0xb0a6('0xb7')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xb8'),require(_0xb0a6('0xb9')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xba'),require(_0xb0a6('0xbb')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xbc'),require(_0xb0a6('0xbd')));_0x1d3b78['use'](_0xb0a6('0xbe'),require(_0xb0a6('0xbf')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xc0'),require(_0xb0a6('0xc1')));_0x1d3b78[_0xb0a6('0x4')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xc2'),require(_0xb0a6('0xc3')));_0x1d3b78[_0xb0a6('0x4')]('/api/square/reports',require(_0xb0a6('0xc4')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xc5'),require(_0xb0a6('0xc6')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xc7'),require(_0xb0a6('0xc8')));_0x1d3b78['use'](_0xb0a6('0xc9'),require(_0xb0a6('0xca')));_0x1d3b78['use']('/api/square/odbc',require(_0xb0a6('0xcb')));_0x1d3b78['use'](_0xb0a6('0xcc'),require(_0xb0a6('0xcd')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xce'),require('./api/squareRecording'));_0x1d3b78[_0xb0a6('0x4')]('/api/square/messages',require(_0xb0a6('0xcf')));_0x1d3b78[_0xb0a6('0x4')]('/api/teams',require('./api/team'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xd0'),require(_0xb0a6('0xd1')));_0x1d3b78['use']('/api/campaigns',require('./api/campaign'));_0x1d3b78[_0xb0a6('0x4')]('/api/migrations',require(_0xb0a6('0xd2')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xd3'),require('./api/attachment'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xd4'),require(_0xb0a6('0xd5')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xd6'),require(_0xb0a6('0xd7')));_0x1d3b78[_0xb0a6('0x4')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xd8'),require(_0xb0a6('0xd9')));_0x1d3b78[_0xb0a6('0x4')]('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xda'),require(_0xb0a6('0xdb')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xdc'),require('./api/cmList'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xdd'),require('./api/voicePrefix'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xde'),require(_0xb0a6('0xdf')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xe0'),require(_0xb0a6('0xe1')));_0x1d3b78['use'](_0xb0a6('0xe2'),require(_0xb0a6('0xe3')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xe4'),require(_0xb0a6('0xe5')));_0x1d3b78['use']('/api/whatsapp/accounts',require(_0xb0a6('0xe6')));_0x1d3b78['use'](_0xb0a6('0xe7'),require('./api/whatsappApplication'));_0x1d3b78[_0xb0a6('0x4')]('/api/whatsapp/interactions',require(_0xb0a6('0xe8')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xe9'),require(_0xb0a6('0xea')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xeb'),require(_0xb0a6('0xec')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xed'),require(_0xb0a6('0xee')));_0x1d3b78['use']('/api/whatsapp/queues',require('./api/whatsappQueue'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xef'),require(_0xb0a6('0xf0')));_0x1d3b78[_0xb0a6('0x4')]('/api/realtime',require(_0xb0a6('0xf1')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xf2'),require(_0xb0a6('0xf3')));_0x1d3b78[_0xb0a6('0x4')]('/api/mail_interaction_has_tags',require('./api/mailInteractionHasTag'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xf4'),require(_0xb0a6('0xf5')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xf6'),require(_0xb0a6('0xf7')));_0x1d3b78['use']('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xf8'),require(_0xb0a6('0xf9')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xfa'),require(_0xb0a6('0xfb')));_0x1d3b78[_0xb0a6('0x4')]('/api/version',require(_0xb0a6('0xfc')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xfd'),require(_0xb0a6('0xfe')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0xff'),require('./api/pm2'));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x100'),require(_0xb0a6('0x101')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x102'),clientSideLogs);_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x103'),express['static'](path[_0xb0a6('0x104')](config['root'],_0xb0a6('0x103'))));_0x1d3b78['use'](_0xb0a6('0x105'),express[_0xb0a6('0x106')](path[_0xb0a6('0x104')](config[_0xb0a6('0x107')],_0xb0a6('0x105'))));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x108'),express[_0xb0a6('0x106')](path['join'](config[_0xb0a6('0x107')],_0xb0a6('0x108'))));_0x1d3b78['use'](_0xb0a6('0x109'),express[_0xb0a6('0x106')](path['join'](config['root'],_0xb0a6('0x10a'),'3.13.0')));_0x1d3b78[_0xb0a6('0x4')](_0xb0a6('0x10b'),express[_0xb0a6('0x106')](path[_0xb0a6('0x104')](config[_0xb0a6('0x107')],_0xb0a6('0x10c'))));_0x1d3b78['route'](_0xb0a6('0x10d'))[_0xb0a6('0x10e')](errors[0x194]);_0x1d3b78['route']('/*')['get'](function(_0xc729cd,_0x3f60c4){_0x3f60c4[_0xb0a6('0x10f')](path[_0xb0a6('0x110')](_0x1d3b78[_0xb0a6('0x10e')](_0xb0a6('0x111'))+'/index.html'));});return _0x1d3b78;});}; \ No newline at end of file +var _0xd117=['/api/analytics/field_reports','./api/analyticFieldReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/fields','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/reports/queue','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','./api/system','./api/pm2','/api/webbar','/api/logs','/apidoc','static','root','join','/www','/demo','/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','resolve','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/screenRecording','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/messages','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/disposition','/api/conditions','./api/condition','./api/interval','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xd117,0x182));var _0x7d11=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0xd117[_0x3c487b];return _0x1d65f6;};'use strict';var path=require(_0x7d11('0x0'));var express=require(_0x7d11('0x1'));var errors=require(_0x7d11('0x2'));var config=require(_0x7d11('0x3'));var setupLoggers=require(_0x7d11('0x4'))[_0x7d11('0x5')];var clientSideLogs=require(_0x7d11('0x6'));exports[_0x7d11('0x7')]=function(_0x3c07be){return setupLoggers(_0x3c07be)[_0x7d11('0x8')](function(){_0x3c07be[_0x7d11('0x9')](_0x7d11('0xa'),require(_0x7d11('0xb')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xc'),require(_0x7d11('0xd')));_0x3c07be['use'](_0x7d11('0xe'),require(_0x7d11('0xf')));_0x3c07be[_0x7d11('0x9')]('/api/voice/extensions',require(_0x7d11('0x10')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x11'),require('./api/voiceMusicOnHold'));_0x3c07be[_0x7d11('0x9')]('/api/voice/queues',require('./api/voiceQueue'));_0x3c07be[_0x7d11('0x9')]('/api/voice/recordings',require('./api/voiceRecording'));_0x3c07be[_0x7d11('0x9')]('/api/screen/recordings',require(_0x7d11('0x12')));_0x3c07be[_0x7d11('0x9')]('/api/voice/mails',require(_0x7d11('0x13')));_0x3c07be[_0x7d11('0x9')]('/api/voice/mails/messages',require(_0x7d11('0x14')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x15'),require(_0x7d11('0x16')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x17'),require(_0x7d11('0x18')));_0x3c07be[_0x7d11('0x9')]('/api/voice/agents/reports',require(_0x7d11('0x19')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x1a'),require(_0x7d11('0x1b')));_0x3c07be[_0x7d11('0x9')]('/api/members/reports',require(_0x7d11('0x1c')));_0x3c07be[_0x7d11('0x9')]('/api/trunks',require('./api/trunk'));_0x3c07be[_0x7d11('0x9')]('/api/voice/transfers/reports',require(_0x7d11('0x1d')));_0x3c07be['use'](_0x7d11('0x1e'),require(_0x7d11('0x1f')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x20'),require(_0x7d11('0x21')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x22'),require(_0x7d11('0x23')));_0x3c07be['use'](_0x7d11('0x24'),require('./api/mailSubstatus'));_0x3c07be['use']('/api/mail/interactions',require(_0x7d11('0x25')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x26'),require(_0x7d11('0x27')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x28'),require(_0x7d11('0x29')));_0x3c07be[_0x7d11('0x9')]('/api/mail/reports/queue',require(_0x7d11('0x2a')));_0x3c07be['use']('/api/dashboards',require('./api/dashboard'));_0x3c07be[_0x7d11('0x9')]('/api/dashboards/items',require(_0x7d11('0x2b')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x2c'),require('./api/faxAccount'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x2d'),require(_0x7d11('0x2e')));_0x3c07be['use'](_0x7d11('0x2f'),require(_0x7d11('0x30')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x31'),require('./api/faxMessage'));_0x3c07be[_0x7d11('0x9')]('/api/fax/queues',require(_0x7d11('0x32')));_0x3c07be['use'](_0x7d11('0x33'),require(_0x7d11('0x34')));_0x3c07be[_0x7d11('0x9')]('/api/sms/accounts',require('./api/smsAccount'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x35'),require('./api/smsApplication'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x36'),require(_0x7d11('0x37')));_0x3c07be['use'](_0x7d11('0x38'),require('./api/smsMessage'));_0x3c07be['use'](_0x7d11('0x39'),require('./api/smsQueue'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x3a'),require(_0x7d11('0x3b')));_0x3c07be[_0x7d11('0x9')]('/api/openchannel/applications',require(_0x7d11('0x3c')));_0x3c07be[_0x7d11('0x9')]('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x3d'),require('./api/openchannelMessage'));_0x3c07be[_0x7d11('0x9')]('/api/openchannel/queues',require('./api/openchannelQueue'));_0x3c07be[_0x7d11('0x9')]('/api/chat/websites',require('./api/chatWebsite'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x3e'),require(_0x7d11('0x3f')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x40'),require(_0x7d11('0x41')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x42'),require(_0x7d11('0x43')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x44'),require(_0x7d11('0x45')));_0x3c07be['use'](_0x7d11('0x46'),require('./api/chatOfflineMessage'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x47'),require(_0x7d11('0x48')));_0x3c07be[_0x7d11('0x9')]('/api/chat/groups',require(_0x7d11('0x49')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x4a'),require(_0x7d11('0x4b')));_0x3c07be['use'](_0x7d11('0x4c'),require('./api/cmCompany'));_0x3c07be[_0x7d11('0x9')]('/api/cm/contacts',require(_0x7d11('0x4d')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x4e'),require(_0x7d11('0x4f')));_0x3c07be['use']('/api/cm/hopper_black',require(_0x7d11('0x50')));_0x3c07be[_0x7d11('0x9')]('/api/cm/hopper_final',require(_0x7d11('0x51')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x52'),require(_0x7d11('0x53')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x54'),require('./api/cmCustomField'));_0x3c07be[_0x7d11('0x9')]('/api/actions',require(_0x7d11('0x55')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x56'),require(_0x7d11('0x57')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x58'),require('./api/cannedAnswer'));_0x3c07be['use']('/api/dispositions',require(_0x7d11('0x59')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x5a'),require(_0x7d11('0x5b')));_0x3c07be[_0x7d11('0x9')]('/api/intervals',require(_0x7d11('0x5c')));_0x3c07be[_0x7d11('0x9')]('/api/pauses',require(_0x7d11('0x5d')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x5e'),require('./api/cdr'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x5f'),require(_0x7d11('0x60')));_0x3c07be['use'](_0x7d11('0x61'),require('./api/schedule'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x62'),require(_0x7d11('0x63')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x64'),require(_0x7d11('0x65')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x66'),require(_0x7d11('0x67')));_0x3c07be['use']('/api/cm_contact_has_items',require('./api/cmContactHasItem'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x68'),require(_0x7d11('0x69')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x6a'),require(_0x7d11('0x6b')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x6c'),require(_0x7d11('0x6d')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x6e'),require(_0x7d11('0x6f')));_0x3c07be['use'](_0x7d11('0x70'),require(_0x7d11('0x71')));_0x3c07be[_0x7d11('0x9')]('/api/integrations/reports',require('./api/integrationReport'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x72'),require(_0x7d11('0x73')));_0x3c07be['use']('/api/analytics/default_reports',require(_0x7d11('0x74')));_0x3c07be[_0x7d11('0x9')]('/api/analytics/extracted_reports',require(_0x7d11('0x75')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x76'),require(_0x7d11('0x77')));_0x3c07be['use'](_0x7d11('0x78'),require(_0x7d11('0x79')));_0x3c07be[_0x7d11('0x9')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x7a'),require(_0x7d11('0x7b')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x7c'),require('./api/intSalesforceConfiguration'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x7d'),require(_0x7d11('0x7e')));_0x3c07be[_0x7d11('0x9')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x7f'),require(_0x7d11('0x80')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x81'),require(_0x7d11('0x82')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x83'),require(_0x7d11('0x84')));_0x3c07be[_0x7d11('0x9')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x3c07be['use'](_0x7d11('0x85'),require(_0x7d11('0x86')));_0x3c07be[_0x7d11('0x9')]('/api/integrations/zoho/accounts',require(_0x7d11('0x87')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x88'),require(_0x7d11('0x89')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x8a'),require('./api/intZohoField'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x8b'),require(_0x7d11('0x8c')));_0x3c07be['use']('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x3c07be['use'](_0x7d11('0x8d'),require('./api/intZendeskField'));_0x3c07be['use']('/api/integrations/freshdesk/accounts',require(_0x7d11('0x8e')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x8f'),require(_0x7d11('0x90')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x91'),require('./api/intFreshdeskField'));_0x3c07be[_0x7d11('0x9')]('/api/integrations/vtiger/accounts',require(_0x7d11('0x92')));_0x3c07be['use'](_0x7d11('0x93'),require(_0x7d11('0x94')));_0x3c07be['use'](_0x7d11('0x95'),require(_0x7d11('0x96')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x97'),require('./api/intServicenowAccount'));_0x3c07be['use'](_0x7d11('0x98'),require(_0x7d11('0x99')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x9a'),require(_0x7d11('0x9b')));_0x3c07be['use'](_0x7d11('0x9c'),require('./api/intDynamics365Account'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0x9d'),require(_0x7d11('0x9e')));_0x3c07be[_0x7d11('0x9')]('/api/integrations/dynamics365/fields',require(_0x7d11('0x9f')));_0x3c07be['use'](_0x7d11('0xa0'),require(_0x7d11('0xa1')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xa2'),require(_0x7d11('0xa3')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xa4'),require(_0x7d11('0xa5')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xa6'),require(_0x7d11('0xa7')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xa8'),require(_0x7d11('0xa9')));_0x3c07be['use'](_0x7d11('0xaa'),require('./api/chatInternalMessage'));_0x3c07be[_0x7d11('0x9')]('/api/jscripty/answers/reports',require(_0x7d11('0xab')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xac'),require(_0x7d11('0xad')));_0x3c07be['use']('/api/jscripty/sessions/reports',require(_0x7d11('0xae')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xaf'),require('./api/smsQueueReport'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xb0'),require(_0x7d11('0xb1')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xb2'),require(_0x7d11('0xb3')));_0x3c07be['use'](_0x7d11('0xb4'),require('./api/jscriptyProject'));_0x3c07be[_0x7d11('0x9')]('/api/settings',require('./api/setting'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xb5'),require(_0x7d11('0xb6')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xb7'),require(_0x7d11('0xb8')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xb9'),require(_0x7d11('0xba')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xbb'),require('./api/squareMessage'));_0x3c07be[_0x7d11('0x9')]('/api/teams',require(_0x7d11('0xbc')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xbd'),require(_0x7d11('0xbe')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xbf'),require(_0x7d11('0xc0')));_0x3c07be['use']('/api/migrations',require(_0x7d11('0xc1')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xc2'),require(_0x7d11('0xc3')));_0x3c07be[_0x7d11('0x9')]('/api/plugins',require(_0x7d11('0xc4')));_0x3c07be['use'](_0x7d11('0xc5'),require(_0x7d11('0xc6')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xc7'),require(_0x7d11('0xc8')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xc9'),require(_0x7d11('0xca')));_0x3c07be['use']('/api/openchannel/reports/transfer',require(_0x7d11('0xcb')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xcc'),require('./api/smsTransferReport'));_0x3c07be['use'](_0x7d11('0xcd'),require('./api/cmList'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xce'),require(_0x7d11('0xcf')));_0x3c07be[_0x7d11('0x9')]('/api/userProfiles',require(_0x7d11('0xd0')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xd1'),require(_0x7d11('0xd2')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xd3'),require(_0x7d11('0xd4')));_0x3c07be[_0x7d11('0x9')]('/api/userNotifications',require(_0x7d11('0xd5')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xd6'),require(_0x7d11('0xd7')));_0x3c07be[_0x7d11('0x9')]('/api/whatsapp/applications',require(_0x7d11('0xd8')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xd9'),require(_0x7d11('0xda')));_0x3c07be[_0x7d11('0x9')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x3c07be['use'](_0x7d11('0xdb'),require('./api/whatsappQueueReport'));_0x3c07be[_0x7d11('0x9')]('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xdc'),require(_0x7d11('0xdd')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xde'),require(_0x7d11('0xdf')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xe0'),require(_0x7d11('0xe1')));_0x3c07be[_0x7d11('0x9')]('/api/user-settings',require(_0x7d11('0xe2')));_0x3c07be[_0x7d11('0x9')]('/api/mail_interaction_has_tags',require(_0x7d11('0xe3')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xe4'),require(_0x7d11('0xe5')));_0x3c07be['use']('/api/auth/google',require(_0x7d11('0xe6')));_0x3c07be['use'](_0x7d11('0xe7'),require(_0x7d11('0xe8')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xe9'),require(_0x7d11('0xea')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xeb'),require('./api/rpc'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xec'),require(_0x7d11('0xed')));_0x3c07be[_0x7d11('0x9')]('/api/system',require(_0x7d11('0xee')));_0x3c07be[_0x7d11('0x9')]('/api/pm2',require(_0x7d11('0xef')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xf0'),require('./api/webbar'));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xf1'),clientSideLogs);_0x3c07be['use'](_0x7d11('0xf2'),express[_0x7d11('0xf3')](path['join'](config[_0x7d11('0xf4')],'/apidoc')));_0x3c07be['use']('/www',express['static'](path[_0x7d11('0xf5')](config[_0x7d11('0xf4')],_0x7d11('0xf6'))));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xf7'),express[_0x7d11('0xf3')](path[_0x7d11('0xf5')](config[_0x7d11('0xf4')],_0x7d11('0xf7'))));_0x3c07be[_0x7d11('0x9')]('/snippet',express['static'](path[_0x7d11('0xf5')](config[_0x7d11('0xf4')],'snippet','3.13.0')));_0x3c07be[_0x7d11('0x9')](_0x7d11('0xf8'),express[_0x7d11('0xf3')](path[_0x7d11('0xf5')](config['root'],'/server/files/plugins')));_0x3c07be['route'](_0x7d11('0xf9'))[_0x7d11('0xfa')](errors[0x194]);_0x3c07be[_0x7d11('0xfb')]('/*')['get'](function(_0x3ce304,_0x238cfd){_0x238cfd['sendFile'](path[_0x7d11('0xfc')](_0x3c07be[_0x7d11('0xfa')]('appPath')+'/index.html'));});return _0x3c07be;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 44fb7a7..cc422ea 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x094f=['../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','localhost','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.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'];(function(_0x539da1,_0x6a7ab3){var _0x4ea36d=function(_0x3e2771){while(--_0x3e2771){_0x539da1['push'](_0x539da1['shift']());}};_0x4ea36d(++_0x6a7ab3);}(_0x094f,0xe7));var _0xf094=function(_0x48999d,_0x1e02cb){_0x48999d=_0x48999d-0x0;var _0x1ad0d1=_0x094f[_0x48999d];return _0x1ad0d1;};'use strict';var jayson=require(_0xf094('0x0'));var _=require('lodash');var config=require(_0xf094('0x1'));exports['listen']=function(){return new Promise(function(_0x599b21,_0x48b549){var _0x58c009={};_0x58c009=_[_0xf094('0x2')](_0x58c009,require('../api/user/user.rpc'));_0x58c009=_[_0xf094('0x2')](_0x58c009,require('../api/voiceExtension/voiceExtension.rpc'));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x3')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x4')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x5')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x6')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x7')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x8')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x9')));_0x58c009=_['merge'](_0x58c009,require(_0xf094('0xa')));_0x58c009=_['merge'](_0x58c009,require(_0xf094('0xb')));_0x58c009=_['merge'](_0x58c009,require(_0xf094('0xc')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0xd')));_0x58c009=_['merge'](_0x58c009,require(_0xf094('0xe')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0xf')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x10')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x11')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x12')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x13')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x14')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require('../api/faxInteraction/faxInteraction.rpc'));_0x58c009=_['merge'](_0x58c009,require(_0xf094('0x15')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x16')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x17')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require('../api/smsAccount/smsAccount.rpc'));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x18')));_0x58c009=_['merge'](_0x58c009,require('../api/smsMessage/smsMessage.rpc'));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x19')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x1a')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x1b')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x1c')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x1d')));_0x58c009=_['merge'](_0x58c009,require(_0xf094('0x1e')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x1f')));_0x58c009=_['merge'](_0x58c009,require(_0xf094('0x20')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require('../api/cmContact/cmContact.rpc'));_0x58c009=_[_0xf094('0x2')](_0x58c009,require('../api/cmHopper/cmHopper.rpc'));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x21')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x22')));_0x58c009=_['merge'](_0x58c009,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x58c009=_['merge'](_0x58c009,require(_0xf094('0x23')));_0x58c009=_['merge'](_0x58c009,require(_0xf094('0x24')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x25')));_0x58c009=_['merge'](_0x58c009,require(_0xf094('0x26')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x27')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x28')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require('../api/trigger/trigger.rpc'));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x29')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x2a')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x2b')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x2c')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x2d')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x2e')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x2f')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x30')));_0x58c009=_['merge'](_0x58c009,require(_0xf094('0x31')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x32')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x33')));_0x58c009=_['merge'](_0x58c009,require(_0xf094('0x34')));_0x58c009=_['merge'](_0x58c009,require(_0xf094('0x35')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x36')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require('../api/squareProject/squareProject.rpc'));_0x58c009=_['merge'](_0x58c009,require(_0xf094('0x37')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x38')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x39')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x3a')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x3b')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x3c')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x58c009=_['merge'](_0x58c009,require(_0xf094('0x3d')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x3e')));_0x58c009=_[_0xf094('0x2')](_0x58c009,require(_0xf094('0x3f')));var _0x19caf5=jayson[_0xf094('0x40')](_0x58c009)[_0xf094('0x41')]();var _0x14410b=config['rpc'][_0xf094('0x42')]||config['port']+0x1;var _0x30bbd4=config['rpc']['ip']||_0xf094('0x43');_0x19caf5['on']('error',function(_0x3fbc41){return _0x48b549(_0x3fbc41);});_0x19caf5[_0xf094('0x44')](_0x14410b,_0x30bbd4,function(){console[_0xf094('0x45')](_0xf094('0x46'),_0x30bbd4,_0x14410b);require(_0xf094('0x47'))['default']();return _0x599b21(_0xf094('0x48')+_0x30bbd4+':'+_0x14410b);});});}; \ No newline at end of file +var _0x76c1=['listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/memberReport/memberReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.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/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','server','http','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment'];(function(_0x388072,_0x426c3c){var _0x316b06=function(_0x4aa5a3){while(--_0x4aa5a3){_0x388072['push'](_0x388072['shift']());}};_0x316b06(++_0x426c3c);}(_0x76c1,0x87));var _0x176c=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x76c1[_0x12f688];return _0x59c3de;};'use strict';var jayson=require(_0x176c('0x0'));var _=require(_0x176c('0x1'));var config=require(_0x176c('0x2'));exports[_0x176c('0x3')]=function(){return new Promise(function(_0x2ad0a7,_0x478001){var _0xecc8cb={};_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0x4')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x6')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x7')));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0x8')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/voiceCallReport/voiceCallReport.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/voiceDialReport/voiceDialReport.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x9')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/trunk/trunk.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0xa')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0xb')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/mailQueue/mailQueue.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/mailInteraction/mailInteraction.rpc'));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0xc')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0xd')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0xe')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0xf')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x10')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x11')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x12')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x13')));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0x14')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x15')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/smsInteraction/smsInteraction.rpc'));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0x16')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x17')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x18')));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0x19')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/openchannelMessage/openchannelMessage.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/openchannelQueue/openchannelQueue.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x1a')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x1b')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x1c')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/chatQueue/chatQueue.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x1d')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x1e')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x1f')));_0xecc8cb=_['merge'](_0xecc8cb,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x20')));_0xecc8cb=_['merge'](_0xecc8cb,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/interval/interval.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x21')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x22')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x23')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x24')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x25')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/variable/variable.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x26')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x27')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x28')));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0x29')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x2a')));_0xecc8cb=_['merge'](_0xecc8cb,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x2b')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x2c')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x2d')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x2e')));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0x2f')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x30')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x31')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x32')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x33')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x34')));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0x35')));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0x36')));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0x37')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x38')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/plugin/plugin.rpc'));_0xecc8cb=_['merge'](_0xecc8cb,require(_0x176c('0x39')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require(_0x176c('0x3a')));_0xecc8cb=_[_0x176c('0x5')](_0xecc8cb,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0xecc8cb=_['merge'](_0xecc8cb,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x2496e2=jayson[_0x176c('0x3b')](_0xecc8cb)[_0x176c('0x3c')]();var _0x5b78b9=config[_0x176c('0x3d')]['port']||config['port']+0x1;var _0x200f78=config['rpc']['ip']||_0x176c('0x3e');_0x2496e2['on'](_0x176c('0x3f'),function(_0x3e1588){return _0x478001(_0x3e1588);});_0x2496e2['listen'](_0x5b78b9,_0x200f78,function(){console[_0x176c('0x40')](_0x176c('0x41'),_0x200f78,_0x5b78b9);require(_0x176c('0x42'))[_0x176c('0x43')]();return _0x2ad0a7(_0x176c('0x44')+_0x200f78+':'+_0x5b78b9);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 66b4fe5..cc8d654 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 _0x2c6f=['setEncoding','utf8','setTimeout','headers','emit','ready','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','./error'];(function(_0x3cb392,_0x56515b){var _0x4e0163=function(_0x28a8ab){while(--_0x28a8ab){_0x3cb392['push'](_0x3cb392['shift']());}};_0x4e0163(++_0x56515b);}(_0x2c6f,0x138));var _0xf2c6=function(_0x3cb61c,_0x559bd2){_0x3cb61c=_0x3cb61c-0x0;var _0x1015e1=_0x2c6f[_0x3cb61c];return _0x1015e1;};'use strict';var util=require(_0xf2c6('0x0'));var _=require(_0xf2c6('0x1'));var EventEmitter=require(_0xf2c6('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0xf2c6('0x3'));function AGIChannel(_0x55ec37){var _0x59ed4d=this,_0x46e156=new AGIReply(),_0x30e041=![],_0x1208b3={};EventEmitter['call'](_0x59ed4d);_0x55ec37[_0xf2c6('0x4')](_0xf2c6('0x5'));_0x55ec37[_0xf2c6('0x6')](0x8*0x3c*0x3c*0x3e8);_0x46e156[_0xf2c6('0x4')]('utf8');_0x46e156['on'](_0xf2c6('0x7'),function(_0x573a7d){for(var _0x296a14 in _0x573a7d){_0x59ed4d[_0x296a14]=_0x573a7d[_0x296a14];}_0x59ed4d[_0xf2c6('0x8')](_0xf2c6('0x9'));});_0x46e156['on']('line',function(_0x1ea5c6){if(_0x1ea5c6[_0xf2c6('0xa')]()==_0xf2c6('0xb')){_0x59ed4d[_0xf2c6('0x8')](_0xf2c6('0xb'));return;}if(_0x1ea5c6['substring'](0x0,0xb)==_0xf2c6('0xc')){_0x30e041=!![];}if(_0x30e041){_0x1208b3['rx']+=_0x1ea5c6+'\x0a';if(_0x1ea5c6[_0xf2c6('0xd')](_0xf2c6('0xe'))!=-0x1){_0x30e041=![];}}else{_0x1208b3['rx']=_0x1ea5c6;}if(_0x30e041){return;}if(typeof _0x1208b3['cb']==_0xf2c6('0xf')){var _0x2b5236=_0x1208b3['rx'][_0xf2c6('0x10')](0x0,0x3),_0x3dff21=null,_0x2aee72=null;_0x2b5236=parseInt(_0x2b5236);if(isNaN(_0x2b5236)){_0x1208b3['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x2b5236!=0xc8){_0x1208b3['cb'](null,{'code':_0x2b5236,'result':-0x1,'extra':'KO'});return;}_0x3dff21=_0x1208b3['rx'][_0xf2c6('0x10')](0x4)[_0xf2c6('0x11')](_0xf2c6('0x12'),'');if(_0x3dff21[_0xf2c6('0x13')]('\x20')!=-0x1){_0x3dff21=_0x3dff21[_0xf2c6('0x14')](0x0,_0x3dff21[_0xf2c6('0x13')]('\x20'));}if(_[_0xf2c6('0x15')](_0x3dff21,'-1')){_0x3dff21=parseInt(_0x3dff21);}_0x2aee72=_0x1208b3['rx'][_0xf2c6('0x16')]('\x20');if(_0x2aee72[_0xf2c6('0x17')]==0x3){_0x2aee72=_0x2aee72[0x2][_0xf2c6('0x10')](0x1,_0x2aee72[0x2]['length']-0x1);}else if(_0x2aee72[_0xf2c6('0x17')]>0x3){var _0x24dfca=/\((.+)\)/;var _0x2dc695=_0x1208b3['rx']['match'](_0x24dfca);if(_0x2dc695){_0x2aee72=_0x2dc695[0x1];}else{_0x2aee72=null;}}else{_0x2aee72=null;}_0x1208b3['cb'](null,{'code':_0x2b5236,'result':_0x3dff21,'extra':_0x2aee72});}});_0x55ec37['on'](_0xf2c6('0x18'),function(_0x27253c){_0x59ed4d['emit'](_0xf2c6('0x18'),new AGIError(_0xf2c6('0x19'),_0x27253c[_0xf2c6('0x1a')]));});_0x55ec37['on']('close',function(){_0x59ed4d[_0xf2c6('0x8')](_0xf2c6('0x1b'),new AGIError(_0xf2c6('0x1c')));});_0x55ec37['on'](_0xf2c6('0x1d'),function(){_0x59ed4d[_0xf2c6('0x8')](_0xf2c6('0x1d'),new AGIError(_0xf2c6('0x1e')));_0x55ec37['destroy']();});_0x55ec37[_0xf2c6('0x1f')](_0x46e156);this[_0xf2c6('0x20')]=function(_0x49b055,_0x54c0eb){var _0x49b055=_0x49b055||'',_0x54c0eb=typeof _0x54c0eb==_0xf2c6('0xf')?_0x54c0eb:new Function();_0x1208b3={'tx':_0x49b055,'rx':'','cb':_0x54c0eb};_0x55ec37[_0xf2c6('0x21')](_0x49b055+'\x0a');},this[_0xf2c6('0x1b')]=function(){_0x55ec37['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xf2c6('0x22')][_0xf2c6('0x23')]=function(_0x1d1db2){return this[_0xf2c6('0x20')][_0xf2c6('0x24')](this,_0x1d1db2);};AGIChannel[_0xf2c6('0x22')][_0xf2c6('0x25')]=function(){return this[_0xf2c6('0x23')](_0xf2c6('0x26'));};AGIChannel[_0xf2c6('0x22')][_0xf2c6('0x27')]=function(_0x4971b1,_0x2c13cb,_0x5382aa){_0x4971b1=_0x4971b1===undefined?_0xf2c6('0x28'):_0x4971b1;_0x2c13cb=_0x2c13cb===undefined?'5':_0x2c13cb;_0x5382aa=_0x5382aa===undefined?'1':_0x5382aa;return this[_0xf2c6('0x23')](util[_0xf2c6('0x29')](_0xf2c6('0x2a'),_0x4971b1,_0x2c13cb*0x3e8,_0x5382aa));};AGIChannel[_0xf2c6('0x22')][_0xf2c6('0x2b')]=function(_0x185475){_0x185475=_0x185475||_0xf2c6('0x2c');return this[_0xf2c6('0x23')](util[_0xf2c6('0x29')](_0xf2c6('0x2d'),_0x185475));};AGIChannel[_0xf2c6('0x22')][_0xf2c6('0x2e')]=function(_0x29a032,_0x5c6939){if(_[_0xf2c6('0x2f')](_0x5c6939)){return this[_0xf2c6('0x23')](util[_0xf2c6('0x29')](_0xf2c6('0x30'),_0x29a032,_0x5c6939[_0xf2c6('0x31')](',')));}return this['sendRequest'](util['format']('EXEC\x20%s\x20%s',_0x29a032,_0x5c6939));};AGIChannel[_0xf2c6('0x22')][_0xf2c6('0x32')]=function(_0x43b0d2){return this['sendRequest'](util[_0xf2c6('0x29')](_0xf2c6('0x33'),_0x43b0d2));};AGIChannel[_0xf2c6('0x22')][_0xf2c6('0x34')]=function(_0x1ae259){return this[_0xf2c6('0x23')](util['format'](_0xf2c6('0x35'),_0x1ae259));};AGIChannel[_0xf2c6('0x22')][_0xf2c6('0x36')]=function(_0x5aa627){return this[_0xf2c6('0x23')](util['format'](_0xf2c6('0x37'),_0x5aa627));};AGIChannel[_0xf2c6('0x22')]['hangup']=function(){return this['sendRequest'](_0xf2c6('0x38'));};AGIChannel[_0xf2c6('0x22')][_0xf2c6('0x39')]=function(_0x420a0b,_0x251d8f){var _0x392a74=_['isBoolean'](_0x251d8f)||_[_0xf2c6('0x3a')](_0x251d8f)?_0x251d8f['toString']():_0x251d8f;return this[_0xf2c6('0x23')](util[_0xf2c6('0x29')](_0xf2c6('0x3b'),_0x420a0b,_0x392a74?_0x392a74[_0xf2c6('0x3c')]()[_0xf2c6('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xf2c6('0x22')][_0xf2c6('0x3d')]=function(_0x2a32a9,_0x198281){return this[_0xf2c6('0x23')](util[_0xf2c6('0x29')](_0xf2c6('0x3e'),_0x2a32a9,_0x198281));};AGIChannel['prototype']['sayDigits']=function(_0x46a530,_0x1543bf){return this[_0xf2c6('0x23')](util[_0xf2c6('0x29')](_0xf2c6('0x3f'),_0x46a530,_0x1543bf));};AGIChannel[_0xf2c6('0x22')][_0xf2c6('0x40')]=function(_0x1c27cf,_0x4387e3){return this['sendRequest'](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x1c27cf,_0x4387e3));};AGIChannel[_0xf2c6('0x22')][_0xf2c6('0x41')]=function(_0x342ac9,_0x1ff2f4,_0x4fa88c){_0x1ff2f4=_0x1ff2f4||this[_0xf2c6('0x42')];_0x4fa88c=_0x4fa88c||0x1;this[_0xf2c6('0x32')](_0x342ac9);this[_0xf2c6('0x34')](_0x1ff2f4);this[_0xf2c6('0x36')](_0x4fa88c);return this['noop'](util[_0xf2c6('0x29')](_0xf2c6('0x43'),_0x342ac9,_0x1ff2f4,_0x4fa88c));};AGIChannel[_0xf2c6('0x22')][_0xf2c6('0x44')]=function(_0x176a11){return this[_0xf2c6('0x23')](util[_0xf2c6('0x29')]('GET\x20VARIABLE\x20\x22%s\x22',_0x176a11));};AGIChannel[_0xf2c6('0x22')]['recordFile']=function(_0x363b48,_0xaa89bb,_0x2b7cea,_0x1feffc,_0x246737,_0x35edb4){_0xaa89bb=_0xaa89bb||_0xf2c6('0x45');_0x2b7cea=_0x2b7cea||'';_0x1feffc=_0x1feffc===undefined?-0x1:_0x1feffc==='-1'?-0x1:_0x1feffc*0x3e8;_0x246737=_0x246737===undefined?'':'s='+_0x246737;_0x35edb4=_0x35edb4?_0xf2c6('0x46'):'';return this[_0xf2c6('0x23')](util[_0xf2c6('0x29')](_0xf2c6('0x47'),_0x363b48,_0xaa89bb,_0x2b7cea,_0x1feffc,_0x35edb4,_0x246737));};AGIChannel[_0xf2c6('0x22')]['streamFile']=function(_0x38e43f,_0x2a8de9){_0x2a8de9=_0x2a8de9||'';return this[_0xf2c6('0x23')](util['format'](_0xf2c6('0x48'),_0x38e43f,_0x2a8de9));};AGIChannel[_0xf2c6('0x22')][_0xf2c6('0x49')]=function(_0x33bfd5){return this['exec'](_0xf2c6('0x4a'),_0x33bfd5);};AGIChannel['prototype'][_0xf2c6('0x4b')]=function(_0x5816cf){return this[_0xf2c6('0x2e')](_0xf2c6('0x4c'),_0x5816cf);};AGIChannel[_0xf2c6('0x22')]['error']=function(_0x42c58d,_0x1f8856){this[_0xf2c6('0x2b')](util['format'](_0xf2c6('0x4d'),_0x42c58d['id'],_0x42c58d[_0xf2c6('0x4e')],_0x1f8856));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x8604=['hangup','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setExtension','setPriority','GOTO\x20%s\x20%s\x20%s','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','AGI','wait','WAIT','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','utf8','setTimeout','headers','emit','ready','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','substr','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','inherits','sendRequest','sync','prototype','answer','ANSWER','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','exec','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s'];(function(_0x45e2cd,_0x522b9a){var _0x4006f5=function(_0x9da299){while(--_0x9da299){_0x45e2cd['push'](_0x45e2cd['shift']());}};_0x4006f5(++_0x522b9a);}(_0x8604,0x100));var _0x4860=function(_0x300bcb,_0x59a0f2){_0x300bcb=_0x300bcb-0x0;var _0x50fdca=_0x8604[_0x300bcb];return _0x50fdca;};'use strict';var util=require(_0x4860('0x0'));var _=require(_0x4860('0x1'));var EventEmitter=require(_0x4860('0x2'))[_0x4860('0x3')];var AGIReply=require(_0x4860('0x4'));var AGIError=require(_0x4860('0x5'));function AGIChannel(_0x1fdd37){var _0x53474a=this,_0x13b1ad=new AGIReply(),_0x6c95b0=![],_0xb90d93={};EventEmitter[_0x4860('0x6')](_0x53474a);_0x1fdd37['setEncoding'](_0x4860('0x7'));_0x1fdd37[_0x4860('0x8')](0x8*0x3c*0x3c*0x3e8);_0x13b1ad['setEncoding']('utf8');_0x13b1ad['on'](_0x4860('0x9'),function(_0x528623){for(var _0xd389c3 in _0x528623){_0x53474a[_0xd389c3]=_0x528623[_0xd389c3];}_0x53474a[_0x4860('0xa')](_0x4860('0xb'));});_0x13b1ad['on']('line',function(_0x3a531b){if(_0x3a531b['toLowerCase']()=='hangup'){_0x53474a['emit']('hangup');return;}if(_0x3a531b[_0x4860('0xc')](0x0,0xb)==_0x4860('0xd')){_0x6c95b0=!![];}if(_0x6c95b0){_0xb90d93['rx']+=_0x3a531b+'\x0a';if(_0x3a531b[_0x4860('0xe')](_0x4860('0xf'))!=-0x1){_0x6c95b0=![];}}else{_0xb90d93['rx']=_0x3a531b;}if(_0x6c95b0){return;}if(typeof _0xb90d93['cb']==_0x4860('0x10')){var _0x237c66=_0xb90d93['rx'][_0x4860('0xc')](0x0,0x3),_0x4a0fc1=null,_0x5b6f47=null;_0x237c66=parseInt(_0x237c66);if(isNaN(_0x237c66)){_0xb90d93['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x4860('0x11')});return;}if(_0x237c66!=0xc8){_0xb90d93['cb'](null,{'code':_0x237c66,'result':-0x1,'extra':'KO'});return;}_0x4a0fc1=_0xb90d93['rx'][_0x4860('0xc')](0x4)[_0x4860('0x12')](_0x4860('0x13'),'');if(_0x4a0fc1['indexOf']('\x20')!=-0x1){_0x4a0fc1=_0x4a0fc1[_0x4860('0x14')](0x0,_0x4a0fc1[_0x4860('0x15')]('\x20'));}if(_[_0x4860('0x16')](_0x4a0fc1,'-1')){_0x4a0fc1=parseInt(_0x4a0fc1);}_0x5b6f47=_0xb90d93['rx'][_0x4860('0x17')]('\x20');if(_0x5b6f47[_0x4860('0x18')]==0x3){_0x5b6f47=_0x5b6f47[0x2][_0x4860('0xc')](0x1,_0x5b6f47[0x2][_0x4860('0x18')]-0x1);}else if(_0x5b6f47['length']>0x3){var _0x4c36a4=/\((.+)\)/;var _0xd5ce7=_0xb90d93['rx'][_0x4860('0x19')](_0x4c36a4);if(_0xd5ce7){_0x5b6f47=_0xd5ce7[0x1];}else{_0x5b6f47=null;}}else{_0x5b6f47=null;}_0xb90d93['cb'](null,{'code':_0x237c66,'result':_0x4a0fc1,'extra':_0x5b6f47});}});_0x1fdd37['on']('error',function(_0x408daf){_0x53474a['emit'](_0x4860('0x1a'),new AGIError(_0x4860('0x1b'),_0x408daf[_0x4860('0x1c')]));});_0x1fdd37['on'](_0x4860('0x1d'),function(){_0x53474a[_0x4860('0xa')]('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x1fdd37['on'](_0x4860('0x1e'),function(){_0x53474a[_0x4860('0xa')](_0x4860('0x1e'),new AGIError(_0x4860('0x1f')));_0x1fdd37['destroy']();});_0x1fdd37[_0x4860('0x20')](_0x13b1ad);this[_0x4860('0x21')]=function(_0x334716,_0x3cf453){var _0x334716=_0x334716||'',_0x3cf453=typeof _0x3cf453==_0x4860('0x10')?_0x3cf453:new Function();_0xb90d93={'tx':_0x334716,'rx':'','cb':_0x3cf453};_0x1fdd37[_0x4860('0x22')](_0x334716+'\x0a');},this['close']=function(){_0x1fdd37[_0x4860('0x23')]();};}util[_0x4860('0x24')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x4860('0x25')]=function(_0x343954){return this[_0x4860('0x21')][_0x4860('0x26')](this,_0x343954);};AGIChannel[_0x4860('0x27')][_0x4860('0x28')]=function(){return this['sendRequest'](_0x4860('0x29'));};AGIChannel[_0x4860('0x27')]['getData']=function(_0x11ea2b,_0x525086,_0x3ca770){_0x11ea2b=_0x11ea2b===undefined?'beep':_0x11ea2b;_0x525086=_0x525086===undefined?'5':_0x525086;_0x3ca770=_0x3ca770===undefined?'1':_0x3ca770;return this[_0x4860('0x25')](util['format'](_0x4860('0x2a'),_0x11ea2b,_0x525086*0x3e8,_0x3ca770));};AGIChannel[_0x4860('0x27')][_0x4860('0x2b')]=function(_0x3a9da7){_0x3a9da7=_0x3a9da7||_0x4860('0x2c');return this[_0x4860('0x25')](util[_0x4860('0x2d')]('VERBOSE\x20\x22%s\x22',_0x3a9da7));};AGIChannel[_0x4860('0x27')][_0x4860('0x2e')]=function(_0x5aee47,_0x3fa15b){if(_['isArray'](_0x3fa15b)){return this[_0x4860('0x25')](util[_0x4860('0x2d')](_0x4860('0x2f'),_0x5aee47,_0x3fa15b['join'](',')));}return this[_0x4860('0x25')](util[_0x4860('0x2d')](_0x4860('0x2f'),_0x5aee47,_0x3fa15b));};AGIChannel[_0x4860('0x27')][_0x4860('0x30')]=function(_0x213047){return this[_0x4860('0x25')](util[_0x4860('0x2d')](_0x4860('0x31'),_0x213047));};AGIChannel[_0x4860('0x27')]['setExtension']=function(_0x4436b8){return this[_0x4860('0x25')](util['format'](_0x4860('0x32'),_0x4436b8));};AGIChannel['prototype']['setPriority']=function(_0x19649b){return this[_0x4860('0x25')](util[_0x4860('0x2d')](_0x4860('0x33'),_0x19649b));};AGIChannel[_0x4860('0x27')][_0x4860('0x34')]=function(){return this[_0x4860('0x25')]('HANGUP');};AGIChannel[_0x4860('0x27')][_0x4860('0x35')]=function(_0xbad421,_0x5880a0){var _0x3df978=_[_0x4860('0x36')](_0x5880a0)||_['isNumber'](_0x5880a0)?_0x5880a0[_0x4860('0x37')]():_0x5880a0;return this[_0x4860('0x25')](util[_0x4860('0x2d')](_0x4860('0x38'),_0xbad421,_0x3df978?_0x3df978[_0x4860('0x37')]()[_0x4860('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x2b315f,_0x5d6f25){return this[_0x4860('0x25')](util[_0x4860('0x2d')](_0x4860('0x39'),_0x2b315f,_0x5d6f25));};AGIChannel['prototype'][_0x4860('0x3a')]=function(_0x42a0ef,_0xd6b068){return this[_0x4860('0x25')](util[_0x4860('0x2d')](_0x4860('0x3b'),_0x42a0ef,_0xd6b068));};AGIChannel['prototype'][_0x4860('0x3c')]=function(_0x1a8704,_0x5c167b){return this['sendRequest'](util[_0x4860('0x2d')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x1a8704,_0x5c167b));};AGIChannel[_0x4860('0x27')][_0x4860('0x3d')]=function(_0x5089a4,_0x4bc3ea,_0x197865){_0x4bc3ea=_0x4bc3ea||this[_0x4860('0x3e')];_0x197865=_0x197865||0x1;this[_0x4860('0x30')](_0x5089a4);this[_0x4860('0x3f')](_0x4bc3ea);this[_0x4860('0x40')](_0x197865);return this[_0x4860('0x2b')](util[_0x4860('0x2d')](_0x4860('0x41'),_0x5089a4,_0x4bc3ea,_0x197865));};AGIChannel[_0x4860('0x27')]['getVariable']=function(_0x3dcace){return this['sendRequest'](util[_0x4860('0x2d')]('GET\x20VARIABLE\x20\x22%s\x22',_0x3dcace));};AGIChannel[_0x4860('0x27')][_0x4860('0x42')]=function(_0x28fe3a,_0x22c183,_0x34eb63,_0x4c406c,_0x303b6f,_0x3743dc){_0x22c183=_0x22c183||'wav';_0x34eb63=_0x34eb63||'';_0x4c406c=_0x4c406c===undefined?-0x1:_0x4c406c==='-1'?-0x1:_0x4c406c*0x3e8;_0x303b6f=_0x303b6f===undefined?'':'s='+_0x303b6f;_0x3743dc=_0x3743dc?_0x4860('0x43'):'';return this[_0x4860('0x25')](util[_0x4860('0x2d')](_0x4860('0x44'),_0x28fe3a,_0x22c183,_0x34eb63,_0x4c406c,_0x3743dc,_0x303b6f));};AGIChannel['prototype'][_0x4860('0x45')]=function(_0x51be0d,_0x16737a){_0x16737a=_0x16737a||'';return this[_0x4860('0x25')](util[_0x4860('0x2d')](_0x4860('0x46'),_0x51be0d,_0x16737a));};AGIChannel[_0x4860('0x27')][_0x4860('0x47')]=function(_0x348715){return this[_0x4860('0x2e')](_0x4860('0x48'),_0x348715);};AGIChannel[_0x4860('0x27')][_0x4860('0x49')]=function(_0x47ea4f){return this[_0x4860('0x2e')](_0x4860('0x4a'),_0x47ea4f);};AGIChannel[_0x4860('0x27')][_0x4860('0x1a')]=function(_0x32d953,_0x3c5459){this[_0x4860('0x2b')](util[_0x4860('0x2d')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x32d953['id'],_0x32d953[_0x4860('0x4b')],_0x3c5459));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x4860('0x4c')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 68587cd..2bb98cb 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 _0x0855=['util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','name','exports'];(function(_0x2775a7,_0x3da3b8){var _0x52be4a=function(_0x285804){while(--_0x285804){_0x2775a7['push'](_0x2775a7['shift']());}};_0x52be4a(++_0x3da3b8);}(_0x0855,0x1c2));var _0x5085=function(_0x3c0206,_0x54e6af){_0x3c0206=_0x3c0206-0x0;var _0x547446=_0x0855[_0x3c0206];return _0x547446;};'use strict';var util=require(_0x5085('0x0'));var error={'E_AGI_UNDEFINED':_0x5085('0x1'),'E_AGI_ARGUMENT_PORT':_0x5085('0x2'),'E_AGI_SERVER_ERROR':_0x5085('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x5085('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x5085('0x5'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x5085('0x6'),'E_AGI_COMMAND_EMPTY':_0x5085('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x5085('0x8'),'E_AGI_IVR_ENTRY':_0x5085('0x9')};function AGIError(_0x296cb6){var _0x296cb6=_0x296cb6||null,_0x332b92=_0x332b92||[],_0x1f98d4=0x1,_0x8896f4='';if(!error[_0x296cb6]){_0x296cb6=_0x5085('0xa');}_0x332b92[_0x5085('0xb')](error[_0x296cb6]);while(arguments[_0x1f98d4]){_0x332b92['push'](arguments[_0x1f98d4]);_0x1f98d4++;}_0x8896f4=util['format'][_0x5085('0xc')](util,_0x332b92);this['message']=_0x8896f4;this[_0x5085('0xd')]=_0x296cb6;}module[_0x5085('0xe')]=AGIError; \ No newline at end of file +var _0x92f7=['exports','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','name'];(function(_0x526aa6,_0x29e8cb){var _0x245735=function(_0xae5def){while(--_0xae5def){_0x526aa6['push'](_0x526aa6['shift']());}};_0x245735(++_0x29e8cb);}(_0x92f7,0x1c1));var _0x792f=function(_0x1138c4,_0x841d33){_0x1138c4=_0x1138c4-0x0;var _0x200cc1=_0x92f7[_0x1138c4];return _0x200cc1;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x792f('0x0'),'E_AGI_SERVER_ERROR':_0x792f('0x1'),'E_AGI_SERVER_CLOSE':_0x792f('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x792f('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x792f('0x4'),'E_AGI_SOCKET_ERROR':_0x792f('0x5'),'E_AGI_SOCKET_CLOSE':_0x792f('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x792f('0x7'),'E_AGI_COMMAND_EMPTY':_0x792f('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x792f('0x9'),'E_AGI_IVR_ENTRY':_0x792f('0xa')};function AGIError(_0x494907){var _0x494907=_0x494907||null,_0x508ca0=_0x508ca0||[],_0x472abe=0x1,_0x4c774f='';if(!error[_0x494907]){_0x494907=_0x792f('0xb');}_0x508ca0[_0x792f('0xc')](error[_0x494907]);while(arguments[_0x472abe]){_0x508ca0[_0x792f('0xc')](arguments[_0x472abe]);_0x472abe++;}_0x4c774f=util[_0x792f('0xd')]['apply'](util,_0x508ca0);this['message']=_0x4c774f;this[_0x792f('0xe')]=_0x494907;}module[_0x792f('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index fd37644..0ff0fd3 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa493=['localhost','agi','emit','error','parse','projectUpdate','E_AGI_SERVER_ERROR','exports','events','EventEmitter','ioredis','../../config/environment','redis'];(function(_0x483860,_0x430e2a){var _0x5673b2=function(_0x5d4911){while(--_0x5d4911){_0x483860['push'](_0x483860['shift']());}};_0x5673b2(++_0x430e2a);}(_0xa493,0xff));var _0x3a49=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa493[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var EventEmitter=require(_0x3a49('0x0'))[_0x3a49('0x1')];var Redis=require(_0x3a49('0x2'));var AGIError=require('./error');var config=require(_0x3a49('0x3'));config[_0x3a49('0x4')]=_['defaults'](config[_0x3a49('0x4')],{'host':_0x3a49('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub['subscribe'](_0x3a49('0x6'),function(_0x353b3b){if(_0x353b3b)return eventEmitter[_0x3a49('0x7')](_0x3a49('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x353b3b));});sub['on']('message',function(_0x38b0f0,_0x3fa4e){if(_0x38b0f0!=='agi')return;try{var _0x801257=JSON[_0x3a49('0x9')](_0x3fa4e);eventEmitter[_0x3a49('0x7')](_0x3a49('0xa'),_0x801257);}catch(_0x281002){eventEmitter[_0x3a49('0x7')](_0x3a49('0x8'),new AGIError(_0x3a49('0xb'),_0x281002));}});module[_0x3a49('0xc')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x5d27=['EventEmitter','ioredis','redis','defaults','localhost','subscribe','emit','error','E_AGI_SERVER_ERROR','message','agi','parse','projectUpdate','exports','lodash'];(function(_0x4ef77b,_0x6a3df){var _0x58d1a6=function(_0x3b7e29){while(--_0x3b7e29){_0x4ef77b['push'](_0x4ef77b['shift']());}};_0x58d1a6(++_0x6a3df);}(_0x5d27,0x13a));var _0x75d2=function(_0x8d244d,_0x49c04a){_0x8d244d=_0x8d244d-0x0;var _0x30fcd2=_0x5d27[_0x8d244d];return _0x30fcd2;};'use strict';var _=require(_0x75d2('0x0'));var EventEmitter=require('events')[_0x75d2('0x1')];var Redis=require(_0x75d2('0x2'));var AGIError=require('./error');var config=require('../../config/environment');config[_0x75d2('0x3')]=_[_0x75d2('0x4')](config[_0x75d2('0x3')],{'host':_0x75d2('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x75d2('0x6')]('agi',function(_0x2a0e3c){if(_0x2a0e3c)return eventEmitter[_0x75d2('0x7')](_0x75d2('0x8'),new AGIError(_0x75d2('0x9'),_0x2a0e3c));});sub['on'](_0x75d2('0xa'),function(_0x14ac1d,_0xcf32cd){if(_0x14ac1d!==_0x75d2('0xb'))return;try{var _0x3957c0=JSON[_0x75d2('0xc')](_0xcf32cd);eventEmitter[_0x75d2('0x7')](_0x75d2('0xd'),_0x3957c0);}catch(_0x2bc3c4){eventEmitter[_0x75d2('0x7')](_0x75d2('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x2bc3c4));}});module[_0x75d2('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 27085aa..bab93ec 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 _0x8c53=['edges','numberOfEdges','prototype','addVertex','addEdge','push','relations','traverseBFS','info','no\x20vertex\x20found','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','default','target','menu','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports','../../../config/logger','agi','getdigits','vertices'];(function(_0xbca15c,_0x5ac4cc){var _0x2f2a88=function(_0x1ab4b6){while(--_0x1ab4b6){_0xbca15c['push'](_0xbca15c['shift']());}};_0x2f2a88(++_0x5ac4cc);}(_0x8c53,0x88));var _0x38c5=function(_0x5c36f1,_0x5aa8d5){_0x5c36f1=_0x5c36f1-0x0;var _0x19f954=_0x8c53[_0x5c36f1];return _0x19f954;};'use strict';var _=require('lodash');var logger=require(_0x38c5('0x0'))(_0x38c5('0x1'));var verticesWithRetry=['menu',_0x38c5('0x2'),'getsecretdigits'];var Graph=function(){this[_0x38c5('0x3')]={};this[_0x38c5('0x4')]={};this[_0x38c5('0x5')]=0x0;};Graph[_0x38c5('0x6')][_0x38c5('0x7')]=function(_0x205f75){this[_0x38c5('0x3')][_0x205f75['id']]=_0x205f75;this[_0x38c5('0x4')][_0x205f75['id']]=[];};Graph[_0x38c5('0x6')][_0x38c5('0x8')]=function(_0x27d211,_0x40db55,_0x3746c7){this[_0x38c5('0x4')][_0x27d211][_0x38c5('0x9')]({'target':_0x40db55,'condition':_0x3746c7});this['numberOfEdges']+=0x1;};Graph[_0x38c5('0x6')]['size']=function(){return _['size'](this[_0x38c5('0x3')]);};Graph[_0x38c5('0x6')][_0x38c5('0xa')]=function(){return this['numberOfEdges'];};Graph[_0x38c5('0x6')]['getVertex']=function(_0x40e047){return this['vertices'][_0x40e047];};Graph[_0x38c5('0x6')][_0x38c5('0xb')]=function(_0x1a7a1f,_0x1342fb){if(!this[_0x38c5('0x3')][_0x1a7a1f]){return logger[_0x38c5('0xc')](_0x38c5('0xd'));}var _0x33f0af=_0x1342fb(this['vertices'][_0x1a7a1f]);if(!_0x33f0af){return logger[_0x38c5('0xc')]('stop\x20traverse');}if(this['edges'][_0x1a7a1f][_0x38c5('0xe')]===0x0){return logger[_0x38c5('0xc')](_0x38c5('0xf'));}for(var _0x34bb58=0x0,_0x455bbb=[],_0x81c73c=![];_0x34bb58\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','indexOf','agi_','substring','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleNotFound','handleUnpublished','initialize','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','catch','finally','./server','listening','connection','syncho','../../config/logger','agi','../../config/license/util','./rpc','./project','EventEmitter','defaults','127.0.0.1','projectUpdate','stack','findIndex','splice','push','error','env','production','log','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','host.docker.internal','name','message','[%s]\x20%s'];(function(_0x2704be,_0x2555d4){var _0x21d7b5=function(_0x5f2a1b){while(--_0x5f2a1b){_0x2704be['push'](_0x2704be['shift']());}};_0x21d7b5(++_0x2555d4);}(_0x29a5,0x113));var _0x529a=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x29a5[_0x10004e];return _0x5af990;};'use strict';var _=require('lodash');var syncho=require(_0x529a('0x0'));var util=require('util');var config=require('../../config/environment');var logger=require(_0x529a('0x1'))(_0x529a('0x2'));var utilLicense=require(_0x529a('0x3'));var rpc=require(_0x529a('0x4'));var Project=require(_0x529a('0x5'));var AGIEmitter=require('./events')[_0x529a('0x6')];var projects=[];config['agi']=_[_0x529a('0x7')](config[_0x529a('0x2')],{'ip':_0x529a('0x8'),'port':0x11dd});AGIEmitter['on'](_0x529a('0x9'),projectUpdateHandler);function connectionHandler(_0x4bca30){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x4bca30);agiHandler(_0x4bca30);}catch(_0x4930a6){logger['error'](_0x4930a6[_0x529a('0xa')]);}});});}function projectUpdateHandler(_0x1c79fc){try{var _0x124503=_[_0x529a('0xb')](projects,['id',_0x1c79fc['id']]);if(_0x124503>-0x1){if(_0x1c79fc['deleted']===!![]){projects[_0x529a('0xc')](_0x124503,0x1);}else{projects[_0x124503]=_0x1c79fc;}}else{projects[_0x529a('0xd')](_0x1c79fc);}}catch(_0x41e268){logger[_0x529a('0xe')](_0x41e268['stack']);}}function listeningHandler(){var _0x348c29=config[_0x529a('0xf')]===_0x529a('0x10')||![];console[_0x529a('0x11')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x529a('0x2')][_0x529a('0x12')]);logger[_0x529a('0x13')](util['format'](_0x529a('0x14'),_0x348c29?config[_0x529a('0x2')]['ip']:_0x529a('0x15'),config['agi'][_0x529a('0x12')]));}function errorHandler(_0x4dd0b0){if(_0x4dd0b0&&_0x4dd0b0[_0x529a('0x16')]&&_0x4dd0b0[_0x529a('0x17')]){logger['error'](util['format'](_0x529a('0x18'),_0x4dd0b0[_0x529a('0x16')],_0x4dd0b0[_0x529a('0x17')]));}else{logger[_0x529a('0xe')](util[_0x529a('0x19')](_0x529a('0x1a'),_0x4dd0b0[_0x529a('0xa')]));}}function closeHandler(){logger[_0x529a('0x13')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x529a('0x1b')],this[_0x529a('0x1c')],this[_0x529a('0x1d')],this[_0x529a('0x1e')],this[_0x529a('0x1f')]));try{createSquareReport(this);}catch(_0x4d6342){logger[_0x529a('0xe')](_0x4d6342[_0x529a('0xa')]);}}function timeoutHandler(){logger[_0x529a('0x13')](util[_0x529a('0x19')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x529a('0x1b')],this[_0x529a('0x1c')],this[_0x529a('0x1d')],this['dnid'],this[_0x529a('0x1f')]));}function hangupHandler(){logger[_0x529a('0x13')](util[_0x529a('0x19')](_0x529a('0x20'),this[_0x529a('0x1b')],this[_0x529a('0x1c')],this[_0x529a('0x1d')],this[_0x529a('0x1e')],this['uniqueid']));this[_0x529a('0x21')]=!![];}function createSquareReport(_0x84ef7d,_0x5777cb){rpc[_0x529a('0x22')](_0x84ef7d)[_0x529a('0x23')](function(_0x41df20){if(_0x5777cb){_0x5777cb(null,_0x41df20);}})['catch'](function(_0x4d1920){if(_0x5777cb){_0x5777cb(null,_0x4d1920);}});}function setChannelVariables(_0x4ec134){for(var _0x5287ff in _0x4ec134){if(_0x4ec134['hasOwnProperty'](_0x5287ff)){if(_0x5287ff[_0x529a('0x24')](_0x529a('0x25'))===0x0){_0x4ec134[_0x5287ff[_0x529a('0x26')](0x4)]=_0x4ec134[_0x5287ff];delete _0x4ec134[_0x5287ff];}}}}function agiHandler(_0x45c437){logger[_0x529a('0x27')](_0x529a('0x28'),JSON['stringify'](_0x45c437,null,0x2));logger[_0x529a('0x13')](util[_0x529a('0x19')](_0x529a('0x29'),_0x45c437[_0x529a('0x1b')],_0x45c437[_0x529a('0x1c')],_0x45c437[_0x529a('0x1d')],_0x45c437[_0x529a('0x1e')],_0x45c437[_0x529a('0x1f')]));_0x45c437['on'](_0x529a('0xe'),errorHandler);_0x45c437['on'](_0x529a('0x2a'),closeHandler);_0x45c437['on'](_0x529a('0x2b'),timeoutHandler);_0x45c437[_0x529a('0x21')]=![];_0x45c437['on'](_0x529a('0x2c'),hangupHandler);var _0x41bf07=_[_0x529a('0x2d')](projects,[_0x529a('0x16'),_0x45c437['arg_1']]);if(!_0x41bf07)return Project[_0x529a('0x2e')](_0x45c437);if(!_0x41bf07['production'])return Project[_0x529a('0x2f')](_0x45c437);return Project[_0x529a('0x30')](_0x41bf07,_0x45c437);}function main(){var _0x537837;return utilLicense[_0x529a('0x31')]()[_0x529a('0x23')](function(_0xa83457){if(!_0xa83457)return;if(_0xa83457['voice']){if(_0xa83457[_0x529a('0x32')]&&_0xa83457[_0x529a('0x32')]>0x0){logger['info'](util[_0x529a('0x19')](_0x529a('0x33'),_0xa83457[_0x529a('0x32')]));_0x537837=_0xa83457[_0x529a('0x32')];}else{logger[_0x529a('0x13')](_0x529a('0x34'));}}else{logger[_0x529a('0x13')](_0x529a('0x35'));_0x537837=-0x1;}})[_0x529a('0x23')](function(){return Project[_0x529a('0x36')]();})[_0x529a('0x23')](function(_0x2a8ac6){projects=_0x2a8ac6;return;})[_0x529a('0x37')](function(_0x435baf){logger[_0x529a('0xe')]('[LICENSE]',_0x435baf[_0x529a('0xa')]);})[_0x529a('0x38')](function(){var _0x1ad9be=require(_0x529a('0x39'))(config[_0x529a('0x2')][_0x529a('0x12')],config[_0x529a('0x2')]['ip'],_0x537837);_0x1ad9be['on'](_0x529a('0xe'),errorHandler);_0x1ad9be['on'](_0x529a('0x3a'),listeningHandler);_0x1ad9be['on'](_0x529a('0x3b'),connectionHandler);_0x1ad9be['on'](_0x529a('0x2a'),closeHandler);});}main(); \ No newline at end of file +var _0xac32=['close','hangup','find','handleNotFound','handleUnpublished','initialize','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','then','[LICENSE]','./server','listening','connection','lodash','syncho','util','../../config/environment','agi','../../config/license/util','./project','./events','EventEmitter','defaults','projectUpdate','nextTick','error','stack','findIndex','deleted','splice','env','production','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','host.docker.internal','port','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x2c46d5,_0xe2384c){var _0x5c4088=function(_0x132d40){while(--_0x132d40){_0x2c46d5['push'](_0x2c46d5['shift']());}};_0x5c4088(++_0xe2384c);}(_0xac32,0x183));var _0x2ac3=function(_0x15a7dc,_0x228979){_0x15a7dc=_0x15a7dc-0x0;var _0x4f21bf=_0xac32[_0x15a7dc];return _0x4f21bf;};'use strict';var _=require(_0x2ac3('0x0'));var syncho=require(_0x2ac3('0x1'));var util=require(_0x2ac3('0x2'));var config=require(_0x2ac3('0x3'));var logger=require('../../config/logger')(_0x2ac3('0x4'));var utilLicense=require(_0x2ac3('0x5'));var rpc=require('./rpc');var Project=require(_0x2ac3('0x6'));var AGIEmitter=require(_0x2ac3('0x7'))[_0x2ac3('0x8')];var projects=[];config[_0x2ac3('0x4')]=_[_0x2ac3('0x9')](config[_0x2ac3('0x4')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x2ac3('0xa'),projectUpdateHandler);function connectionHandler(_0x5569a7){process[_0x2ac3('0xb')](function(){syncho(function(){try{setChannelVariables(_0x5569a7);agiHandler(_0x5569a7);}catch(_0x13c283){logger[_0x2ac3('0xc')](_0x13c283[_0x2ac3('0xd')]);}});});}function projectUpdateHandler(_0xa796b){try{var _0x6a91c2=_[_0x2ac3('0xe')](projects,['id',_0xa796b['id']]);if(_0x6a91c2>-0x1){if(_0xa796b[_0x2ac3('0xf')]===!![]){projects[_0x2ac3('0x10')](_0x6a91c2,0x1);}else{projects[_0x6a91c2]=_0xa796b;}}else{projects['push'](_0xa796b);}}catch(_0x512971){logger[_0x2ac3('0xc')](_0x512971[_0x2ac3('0xd')]);}}function listeningHandler(){var _0x4b9947=config[_0x2ac3('0x11')]===_0x2ac3('0x12')||![];console['log'](_0x2ac3('0x13'),config[_0x2ac3('0x4')]['port']);logger[_0x2ac3('0x14')](util[_0x2ac3('0x15')](_0x2ac3('0x16'),_0x4b9947?config['agi']['ip']:_0x2ac3('0x17'),config[_0x2ac3('0x4')][_0x2ac3('0x18')]));}function errorHandler(_0x5b66c8){if(_0x5b66c8&&_0x5b66c8[_0x2ac3('0x19')]&&_0x5b66c8[_0x2ac3('0x1a')]){logger[_0x2ac3('0xc')](util['format'](_0x2ac3('0x1b'),_0x5b66c8[_0x2ac3('0x19')],_0x5b66c8[_0x2ac3('0x1a')]));}else{logger[_0x2ac3('0xc')](util[_0x2ac3('0x15')](_0x2ac3('0x1c'),_0x5b66c8['stack']));}}function closeHandler(){logger[_0x2ac3('0x14')](util[_0x2ac3('0x15')](_0x2ac3('0x1d'),this[_0x2ac3('0x1e')],this[_0x2ac3('0x1f')],this[_0x2ac3('0x20')],this[_0x2ac3('0x21')],this[_0x2ac3('0x22')]));try{createSquareReport(this);}catch(_0x1ce97d){logger['error'](_0x1ce97d['stack']);}}function timeoutHandler(){logger[_0x2ac3('0x14')](util[_0x2ac3('0x15')](_0x2ac3('0x23'),this[_0x2ac3('0x1e')],this[_0x2ac3('0x1f')],this[_0x2ac3('0x20')],this[_0x2ac3('0x21')],this[_0x2ac3('0x22')]));}function hangupHandler(){logger[_0x2ac3('0x14')](util[_0x2ac3('0x15')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x2ac3('0x1e')],this[_0x2ac3('0x1f')],this['callerid'],this[_0x2ac3('0x21')],this['uniqueid']));this[_0x2ac3('0x24')]=!![];}function createSquareReport(_0x2e3fbb,_0x175cc9){rpc[_0x2ac3('0x25')](_0x2e3fbb)['then'](function(_0xd09fa5){if(_0x175cc9){_0x175cc9(null,_0xd09fa5);}})[_0x2ac3('0x26')](function(_0x19de49){if(_0x175cc9){_0x175cc9(null,_0x19de49);}});}function setChannelVariables(_0x4e04a3){for(var _0x3e3f9f in _0x4e04a3){if(_0x4e04a3[_0x2ac3('0x27')](_0x3e3f9f)){if(_0x3e3f9f[_0x2ac3('0x28')](_0x2ac3('0x29'))===0x0){_0x4e04a3[_0x3e3f9f[_0x2ac3('0x2a')](0x4)]=_0x4e04a3[_0x3e3f9f];delete _0x4e04a3[_0x3e3f9f];}}}}function agiHandler(_0x1e8088){logger[_0x2ac3('0x2b')](_0x2ac3('0x2c'),JSON[_0x2ac3('0x2d')](_0x1e8088,null,0x2));logger[_0x2ac3('0x14')](util['format'](_0x2ac3('0x2e'),_0x1e8088['arg_1'],_0x1e8088[_0x2ac3('0x1f')],_0x1e8088[_0x2ac3('0x20')],_0x1e8088[_0x2ac3('0x21')],_0x1e8088[_0x2ac3('0x22')]));_0x1e8088['on'](_0x2ac3('0xc'),errorHandler);_0x1e8088['on'](_0x2ac3('0x2f'),closeHandler);_0x1e8088['on']('timeout',timeoutHandler);_0x1e8088[_0x2ac3('0x24')]=![];_0x1e8088['on'](_0x2ac3('0x30'),hangupHandler);var _0x2e342a=_[_0x2ac3('0x31')](projects,[_0x2ac3('0x19'),_0x1e8088[_0x2ac3('0x1e')]]);if(!_0x2e342a)return Project[_0x2ac3('0x32')](_0x1e8088);if(!_0x2e342a[_0x2ac3('0x12')])return Project[_0x2ac3('0x33')](_0x1e8088);return Project[_0x2ac3('0x34')](_0x2e342a,_0x1e8088);}function main(){var _0x3e3a54;return utilLicense[_0x2ac3('0x35')]()['then'](function(_0xcacbb3){if(!_0xcacbb3)return;if(_0xcacbb3['voice']){if(_0xcacbb3[_0x2ac3('0x36')]&&_0xcacbb3[_0x2ac3('0x36')]>0x0){logger[_0x2ac3('0x14')](util[_0x2ac3('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0xcacbb3[_0x2ac3('0x36')]));_0x3e3a54=_0xcacbb3['callysquare'];}else{logger[_0x2ac3('0x14')](_0x2ac3('0x37'));}}else{logger[_0x2ac3('0x14')](_0x2ac3('0x38'));_0x3e3a54=-0x1;}})[_0x2ac3('0x39')](function(){return Project['getAll']();})[_0x2ac3('0x39')](function(_0xc0a06d){projects=_0xc0a06d;return;})[_0x2ac3('0x26')](function(_0x32493){logger['error'](_0x2ac3('0x3a'),_0x32493[_0x2ac3('0xd')]);})['finally'](function(){var _0x2a7987=require(_0x2ac3('0x3b'))(config[_0x2ac3('0x4')][_0x2ac3('0x18')],config['agi']['ip'],_0x3e3a54);_0x2a7987['on'](_0x2ac3('0xc'),errorHandler);_0x2a7987['on'](_0x2ac3('0x3c'),listeningHandler);_0x2a7987['on'](_0x2ac3('0x3d'),connectionHandler);_0x2a7987['on'](_0x2ac3('0x2f'),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 a986975..d18aeb2 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 _0x0369=['message','catch','SendMail','bluebird','jayson/promise','client','then','error'];(function(_0x7f4712,_0x112ee8){var _0x3fc48c=function(_0x89b4b7){while(--_0x89b4b7){_0x7f4712['push'](_0x7f4712['shift']());}};_0x3fc48c(++_0x112ee8);}(_0x0369,0xbb));var _0x9036=function(_0x1d887d,_0x3a2a64){_0x1d887d=_0x1d887d-0x0;var _0x4b5128=_0x0369[_0x1d887d];return _0x4b5128;};'use strict';var BPromise=require(_0x9036('0x0'));var jayson=require(_0x9036('0x1'));var client=jayson[_0x9036('0x2')]['http']({'port':0x232b});function request(_0x228889,_0x37819f){return new BPromise(function(_0xee2a70,_0x450ded){return client['request'](_0x228889,_0x37819f)[_0x9036('0x3')](function(_0x3f9f4a){if(_0x3f9f4a['error']){return _0x450ded(_0x3f9f4a[_0x9036('0x4')][_0x9036('0x5')]);}else{return _0xee2a70(_0x3f9f4a['result']);}})[_0x9036('0x6')](function(_0x2d1937){return _0x450ded(_0x2d1937);});});}exports['sendMailMessage']=function(_0x4bbee0,_0x59d757){return request(_0x9036('0x7'),{'account':_0x4bbee0,'message':_0x59d757});}; \ No newline at end of file +var _0x6f07=['client','http','request','then','error','message','result','catch','bluebird'];(function(_0x38306c,_0x4f3df2){var _0x40a472=function(_0x1d08b5){while(--_0x1d08b5){_0x38306c['push'](_0x38306c['shift']());}};_0x40a472(++_0x4f3df2);}(_0x6f07,0x19d));var _0x76f0=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x6f07[_0x57b54c];return _0x59cc19;};'use strict';var BPromise=require(_0x76f0('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x76f0('0x1')][_0x76f0('0x2')]({'port':0x232b});function request(_0x1addb6,_0x1fe603){return new BPromise(function(_0x418d96,_0x2e0721){return client[_0x76f0('0x3')](_0x1addb6,_0x1fe603)[_0x76f0('0x4')](function(_0x3e1be8){if(_0x3e1be8[_0x76f0('0x5')]){return _0x2e0721(_0x3e1be8[_0x76f0('0x5')][_0x76f0('0x6')]);}else{return _0x418d96(_0x3e1be8[_0x76f0('0x7')]);}})[_0x76f0('0x8')](function(_0x52a009){return _0x2e0721(_0x52a009);});});}exports['sendMailMessage']=function(_0x2f1be1,_0x3321a0){return request('SendMail',{'account':_0x2f1be1,'message':_0x3321a0});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 35398f2..1725e15 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc2aa=['arg_1','callerid','dnid','uniqueid','traverseBFS','start','clear','debug','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','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','Project\x20%s\x20not\x20found','close','exports','moment','xml2json','util','../../config/logger','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','stringify','joinAt','format','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x50e7e0,_0x5affce){var _0x1a0307=function(_0x32d343){while(--_0x32d343){_0x50e7e0['push'](_0x50e7e0['shift']());}};_0x1a0307(++_0x5affce);}(_0xc2aa,0x18c));var _0xac2a=function(_0x361012,_0x395290){_0x361012=_0x361012-0x0;var _0x2e8840=_0xc2aa[_0x361012];return _0x2e8840;};'use strict';var _=require('lodash');var moment=require(_0xac2a('0x0'));var parser=require(_0xac2a('0x1'));var util=require(_0xac2a('0x2'));var logger=require(_0xac2a('0x3'))('agi');var rpc=require('./rpc');var mailRpc=require(_0xac2a('0x4'));var Graph=require(_0xac2a('0x5'));var Vertices=require(_0xac2a('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xac2a('0x7')]()[_0xac2a('0x8')](function(_0x37f4e0){logger[_0xac2a('0x9')](_0xac2a('0xa'),_0x37f4e0[_0xac2a('0xb')]);return[];});}function addVertex(_0xec85bd,_0x5c06aa,_0x1e02e6){_0x5c06aa['agicommand']=_0x1e02e6;if(_0x5c06aa[_0xac2a('0xc')](_0xac2a('0xd'))){_0x5c06aa[_0xac2a('0xe')]=parseInt(_0x5c06aa[_0xac2a('0xd')],0xa);}_0xec85bd[_0xac2a('0xf')](_['omit'](_0x5c06aa,_0xac2a('0x10')));}function initGraph(_0x53d81e,_0x4a7989){var _0x5cd8d0=new Graph();for(var _0x113642 in _0x53d81e){if(_0x53d81e['hasOwnProperty'](_0x113642)){if(_[_0xac2a('0x11')](_0x53d81e[_0x113642])){for(var _0x2e8c01=0x0;_0x2e8c01<_0x53d81e[_0x113642][_0xac2a('0x12')];_0x2e8c01+=0x1){addVertex(_0x5cd8d0,_0x53d81e[_0x113642][_0x2e8c01],_0x113642);}}else{addVertex(_0x5cd8d0,_0x53d81e[_0x113642],_0x113642);}}}for(var _0x4b8383=0x0;_0x4b8383<_0x4a7989[_0xac2a('0x12')];_0x4b8383+=0x1){if(_0x4a7989[_0x4b8383][_0xac2a('0x13')]&&_0x4a7989[_0x4b8383][_0xac2a('0x14')]){_0x5cd8d0[_0xac2a('0x15')](_0x4a7989[_0x4b8383][_0xac2a('0x13')],_0x4a7989[_0x4b8383]['target'],_0x4a7989[_0x4b8383][_0xac2a('0x16')]);}}return _0x5cd8d0;}function getRoot(_0xd7a1db){return parser[_0xac2a('0x17')](_0xd7a1db,{'object':!![]})[_0xac2a('0x18')][_0xac2a('0x19')];}function inspect(_0x2d103e){return util['inspect'](_0x2d103e,{'showHidden':![],'depth':null});}function initialize(_0x2b2703,_0x1e7425){var _0x22e054=getRoot(_0x2b2703['production']);if(!_0x22e054||!_0x22e054['start'])return;var _0x287487,_0x3e67b6,_0x5d4748;logger['debug'](_0xac2a('0x19'),JSON[_0xac2a('0x1a')](_0x22e054,null,0x2));_0x1e7425[_0xac2a('0x1b')]=moment()[_0xac2a('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');_0x287487=initGraph(_['omit'](_0x22e054,'mxCell'),_0x22e054[_0xac2a('0x10')]);_0x3e67b6=new Vertices(_0x1e7425,rpc,mailRpc);logger[_0xac2a('0x1d')](util[_0xac2a('0x1c')](_0xac2a('0x1e'),_0x1e7425[_0xac2a('0x1f')],_0x1e7425['calleridname'],_0x1e7425[_0xac2a('0x20')],_0x1e7425[_0xac2a('0x21')],_0x1e7425[_0xac2a('0x22')]));_0x287487[_0xac2a('0x23')](_0x22e054[_0xac2a('0x24')]['id'],function(_0x180646){try{_0x180646=_0x3e67b6[_0xac2a('0x25')](_0x180646);logger[_0xac2a('0x26')](_0xac2a('0x27'),JSON[_0xac2a('0x1a')](_0x180646,null,0x2));if(_0x180646[_0xac2a('0x28')]===_0xac2a('0x29')){logger[_0xac2a('0x1d')](_0xac2a('0x2a'));_0x1e7425[_0xac2a('0x2b')]=_0x180646[_0xac2a('0x2b')]||_0x1e7425[_0xac2a('0x2b')];_0x1e7425[_0xac2a('0x2c')]=_0x180646[_0xac2a('0x2c')];_0x1e7425[_0xac2a('0x2d')]=_0x180646['priority']?_0x180646[_0xac2a('0x2d')]-0x1:0x1;return null;}else if(_0x180646&&_0x3e67b6[_0x180646['agicommand']]){_0x5d4748=_0x3e67b6[_0x180646[_0xac2a('0x28')]](_0x180646);logger[_0xac2a('0x1d')](_0xac2a('0x2e'),JSON[_0xac2a('0x1a')](_0x5d4748,null,0x2));if(_0x5d4748&&_0x5d4748[_0xac2a('0x2f')]===AGI_CODE_SUCCESS&&_0x5d4748[_0xac2a('0x30')]!==AGI_RESULT_ERROR&&!_0x1e7425['evtHangup']){logger['debug'](_0xac2a('0x2e'),inspect(_0x5d4748));return _[_0xac2a('0x31')](_0x5d4748[_0xac2a('0x30')])?null:_0x5d4748[_0xac2a('0x30')][_0xac2a('0x32')]();}else{logger[_0xac2a('0x9')](_0xac2a('0x2e'),inspect(_0x5d4748));return null;}}else{logger[_0xac2a('0x9')](_0xac2a('0x33'));return null;}}catch(_0x88f628){logger[_0xac2a('0x9')](_0x88f628[_0xac2a('0xb')]);return null;}});if(_0x22e054['finally']){logger['info'](util[_0xac2a('0x1c')](_0xac2a('0x34'),_0x1e7425[_0xac2a('0x1f')],_0x1e7425[_0xac2a('0x35')],_0x1e7425[_0xac2a('0x20')],_0x1e7425[_0xac2a('0x21')],_0x1e7425[_0xac2a('0x22')]));_0x287487[_0xac2a('0x23')](_0x22e054[_0xac2a('0x36')]['id'],function(_0x142067){try{_0x142067=_0x3e67b6[_0xac2a('0x25')](_0x142067);logger[_0xac2a('0x26')](_0xac2a('0x27'),JSON[_0xac2a('0x1a')](_0x142067,null,0x2));if(_0x142067&&_0x3e67b6[_0x142067[_0xac2a('0x28')]]){_0x5d4748=_0x3e67b6[_0x142067[_0xac2a('0x28')]](_0x142067);if(_0x5d4748){logger[_0xac2a('0x26')]('response',inspect(_0x5d4748));return _[_0xac2a('0x31')](_0x5d4748['result'])?null:_0x5d4748[_0xac2a('0x30')][_0xac2a('0x32')]();}else{logger['error'](_0xac2a('0x2e'),inspect(_0x5d4748));return null;}}else{logger[_0xac2a('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x3b4895){logger[_0xac2a('0x9')](_0x3b4895[_0xac2a('0xb')]);return null;}});}logger[_0xac2a('0x1d')](util[_0xac2a('0x1c')](_0xac2a('0x37'),_0x1e7425['arg_1'],_0x1e7425[_0xac2a('0x35')],_0x1e7425[_0xac2a('0x20')],_0x1e7425[_0xac2a('0x21')],_0x1e7425[_0xac2a('0x22')]));logger['info'](util[_0xac2a('0x1c')](_0xac2a('0x38'),_0x1e7425[_0xac2a('0x2b')],_0x1e7425[_0xac2a('0x2c')],parseInt(_0x1e7425[_0xac2a('0x2d')],0xa)+0x1));_0x1e7425[_0xac2a('0x39')](_0x1e7425[_0xac2a('0x2b')],_0x1e7425[_0xac2a('0x2c')],parseInt(_0x1e7425[_0xac2a('0x2d')],0xa)+0x1);_0x1e7425['close']();}function handleNotFound(_0x5eab63){logger[_0xac2a('0x9')](util[_0xac2a('0x1c')](_0xac2a('0x3a'),_0x5eab63['arg_1']));_0x5eab63[_0xac2a('0x39')](_0x5eab63['context'],_0x5eab63['extension'],parseInt(_0x5eab63[_0xac2a('0x2d')],0xa)+0x1);_0x5eab63[_0xac2a('0x3b')]();}function handleUnpublished(_0x527698){logger[_0xac2a('0x9')](util[_0xac2a('0x1c')]('Project\x20%s\x20not\x20published',_0x527698[_0xac2a('0x1f')]));_0x527698[_0xac2a('0x39')](_0x527698[_0xac2a('0x2b')],_0x527698[_0xac2a('0x2c')],parseInt(_0x527698[_0xac2a('0x2d')],0xa)+0x1);_0x527698[_0xac2a('0x3b')]();}module[_0xac2a('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xb0be=['target','value','mxGraphModel','inspect','start','root','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','arg_1','calleridname','dnid','traverseBFS','clear','debug','vertex','stringify','gotoc','context','extension','priority','code','result','evtHangup','response','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','uniqueid','[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\x20found','Project\x20%s\x20not\x20published','close','exports','moment','xml2json','agi','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','maxRetry','addVertex','omit','hasOwnProperty','isArray','length','source'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0xb0be,0xa3));var _0xeb0b=function(_0x59c765,_0x1b14cb){_0x59c765=_0x59c765-0x0;var _0x731b6d=_0xb0be[_0x59c765];return _0x731b6d;};'use strict';var _=require('lodash');var moment=require(_0xeb0b('0x0'));var parser=require(_0xeb0b('0x1'));var util=require('util');var logger=require('../../config/logger')(_0xeb0b('0x2'));var rpc=require('./rpc');var mailRpc=require(_0xeb0b('0x3'));var Graph=require(_0xeb0b('0x4'));var Vertices=require(_0xeb0b('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xeb0b('0x6')]()[_0xeb0b('0x7')](function(_0x14224e){logger[_0xeb0b('0x8')](_0xeb0b('0x9'),_0x14224e[_0xeb0b('0xa')]);return[];});}function addVertex(_0x11feb6,_0xd48e22,_0x2269e0){_0xd48e22[_0xeb0b('0xb')]=_0x2269e0;if(_0xd48e22['hasOwnProperty'](_0xeb0b('0xc'))){_0xd48e22[_0xeb0b('0xd')]=parseInt(_0xd48e22['retry'],0xa);}_0x11feb6[_0xeb0b('0xe')](_[_0xeb0b('0xf')](_0xd48e22,'mxCell'));}function initGraph(_0x8c49f3,_0x253d2f){var _0x5b4114=new Graph();for(var _0x16b992 in _0x8c49f3){if(_0x8c49f3[_0xeb0b('0x10')](_0x16b992)){if(_[_0xeb0b('0x11')](_0x8c49f3[_0x16b992])){for(var _0x3a80ef=0x0;_0x3a80ef<_0x8c49f3[_0x16b992]['length'];_0x3a80ef+=0x1){addVertex(_0x5b4114,_0x8c49f3[_0x16b992][_0x3a80ef],_0x16b992);}}else{addVertex(_0x5b4114,_0x8c49f3[_0x16b992],_0x16b992);}}}for(var _0x2b0ca4=0x0;_0x2b0ca4<_0x253d2f[_0xeb0b('0x12')];_0x2b0ca4+=0x1){if(_0x253d2f[_0x2b0ca4][_0xeb0b('0x13')]&&_0x253d2f[_0x2b0ca4]['target']){_0x5b4114['addEdge'](_0x253d2f[_0x2b0ca4][_0xeb0b('0x13')],_0x253d2f[_0x2b0ca4][_0xeb0b('0x14')],_0x253d2f[_0x2b0ca4][_0xeb0b('0x15')]);}}return _0x5b4114;}function getRoot(_0x2a75b0){return parser['toJson'](_0x2a75b0,{'object':!![]})[_0xeb0b('0x16')]['root'];}function inspect(_0x33a675){return util[_0xeb0b('0x17')](_0x33a675,{'showHidden':![],'depth':null});}function initialize(_0x460e10,_0x371608){var _0x1a1e81=getRoot(_0x460e10['production']);if(!_0x1a1e81||!_0x1a1e81[_0xeb0b('0x18')])return;var _0x231e1b,_0x59e913,_0x31351f;logger['debug'](_0xeb0b('0x19'),JSON['stringify'](_0x1a1e81,null,0x2));_0x371608[_0xeb0b('0x1a')]=moment()[_0xeb0b('0x1b')](_0xeb0b('0x1c'));_0x231e1b=initGraph(_['omit'](_0x1a1e81,_0xeb0b('0x1d')),_0x1a1e81[_0xeb0b('0x1d')]);_0x59e913=new Vertices(_0x371608,rpc,mailRpc);logger[_0xeb0b('0x1e')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x371608[_0xeb0b('0x1f')],_0x371608[_0xeb0b('0x20')],_0x371608['callerid'],_0x371608[_0xeb0b('0x21')],_0x371608['uniqueid']));_0x231e1b[_0xeb0b('0x22')](_0x1a1e81[_0xeb0b('0x18')]['id'],function(_0x45a79e){try{_0x45a79e=_0x59e913[_0xeb0b('0x23')](_0x45a79e);logger[_0xeb0b('0x24')](_0xeb0b('0x25'),JSON[_0xeb0b('0x26')](_0x45a79e,null,0x2));if(_0x45a79e[_0xeb0b('0xb')]===_0xeb0b('0x27')){logger[_0xeb0b('0x1e')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x371608[_0xeb0b('0x28')]=_0x45a79e[_0xeb0b('0x28')]||_0x371608[_0xeb0b('0x28')];_0x371608['extension']=_0x45a79e[_0xeb0b('0x29')];_0x371608['priority']=_0x45a79e['priority']?_0x45a79e[_0xeb0b('0x2a')]-0x1:0x1;return null;}else if(_0x45a79e&&_0x59e913[_0x45a79e['agicommand']]){_0x31351f=_0x59e913[_0x45a79e['agicommand']](_0x45a79e);logger['info']('response',JSON[_0xeb0b('0x26')](_0x31351f,null,0x2));if(_0x31351f&&_0x31351f[_0xeb0b('0x2b')]===AGI_CODE_SUCCESS&&_0x31351f[_0xeb0b('0x2c')]!==AGI_RESULT_ERROR&&!_0x371608[_0xeb0b('0x2d')]){logger[_0xeb0b('0x24')](_0xeb0b('0x2e'),inspect(_0x31351f));return _[_0xeb0b('0x2f')](_0x31351f[_0xeb0b('0x2c')])?null:_0x31351f[_0xeb0b('0x2c')][_0xeb0b('0x30')]();}else{logger[_0xeb0b('0x8')]('response',inspect(_0x31351f));return null;}}else{logger['error'](_0xeb0b('0x31'));return null;}}catch(_0x2d61a1){logger['error'](_0x2d61a1[_0xeb0b('0xa')]);return null;}});if(_0x1a1e81[_0xeb0b('0x32')]){logger[_0xeb0b('0x1e')](util['format'](_0xeb0b('0x33'),_0x371608[_0xeb0b('0x1f')],_0x371608[_0xeb0b('0x20')],_0x371608[_0xeb0b('0x34')],_0x371608[_0xeb0b('0x21')],_0x371608[_0xeb0b('0x35')]));_0x231e1b[_0xeb0b('0x22')](_0x1a1e81['finally']['id'],function(_0x46c72c){try{_0x46c72c=_0x59e913[_0xeb0b('0x23')](_0x46c72c);logger[_0xeb0b('0x24')](_0xeb0b('0x25'),JSON[_0xeb0b('0x26')](_0x46c72c,null,0x2));if(_0x46c72c&&_0x59e913[_0x46c72c[_0xeb0b('0xb')]]){_0x31351f=_0x59e913[_0x46c72c[_0xeb0b('0xb')]](_0x46c72c);if(_0x31351f){logger['debug'](_0xeb0b('0x2e'),inspect(_0x31351f));return _[_0xeb0b('0x2f')](_0x31351f['result'])?null:_0x31351f[_0xeb0b('0x2c')][_0xeb0b('0x30')]();}else{logger[_0xeb0b('0x8')]('response',inspect(_0x31351f));return null;}}else{logger[_0xeb0b('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0xf6e576){logger[_0xeb0b('0x8')](_0xf6e576[_0xeb0b('0xa')]);return null;}});}logger[_0xeb0b('0x1e')](util['format'](_0xeb0b('0x36'),_0x371608['arg_1'],_0x371608[_0xeb0b('0x20')],_0x371608[_0xeb0b('0x34')],_0x371608['dnid'],_0x371608[_0xeb0b('0x35')]));logger[_0xeb0b('0x1e')](util[_0xeb0b('0x1b')](_0xeb0b('0x37'),_0x371608['context'],_0x371608[_0xeb0b('0x29')],parseInt(_0x371608[_0xeb0b('0x2a')],0xa)+0x1));_0x371608[_0xeb0b('0x38')](_0x371608[_0xeb0b('0x28')],_0x371608['extension'],parseInt(_0x371608['priority'],0xa)+0x1);_0x371608['close']();}function handleNotFound(_0x367195){logger[_0xeb0b('0x8')](util[_0xeb0b('0x1b')](_0xeb0b('0x39'),_0x367195[_0xeb0b('0x1f')]));_0x367195['continueAt'](_0x367195[_0xeb0b('0x28')],_0x367195[_0xeb0b('0x29')],parseInt(_0x367195[_0xeb0b('0x2a')],0xa)+0x1);_0x367195['close']();}function handleUnpublished(_0x58eda7){logger[_0xeb0b('0x8')](util[_0xeb0b('0x1b')](_0xeb0b('0x3a'),_0x58eda7['arg_1']));_0x58eda7[_0xeb0b('0x38')](_0x58eda7[_0xeb0b('0x28')],_0x58eda7[_0xeb0b('0x29')],parseInt(_0x58eda7[_0xeb0b('0x2a')],0xa)+0x1);_0x58eda7[_0xeb0b('0x3b')]();}module[_0xeb0b('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 3a63d34..6dec2f4 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 _0xdff8=['slice','trim','emit','headers','line','util','stream','Transform','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split'];(function(_0x550852,_0x5b9618){var _0x2cf9bd=function(_0x8ba02e){while(--_0x8ba02e){_0x550852['push'](_0x550852['shift']());}};_0x2cf9bd(++_0x5b9618);}(_0xdff8,0xc3));var _0x8dff=function(_0x1b7dfc,_0x50210c){_0x1b7dfc=_0x1b7dfc-0x0;var _0x134c30=_0xdff8[_0x1b7dfc];return _0x134c30;};'use strict';var util=require(_0x8dff('0x0'));var Transform=require(_0x8dff('0x1'))[_0x8dff('0x2')];function AGIReply(_0x56bcda){Transform['call'](this,_0x56bcda);this[_0x8dff('0x3')]='';this[_0x8dff('0x4')]=![];}util[_0x8dff('0x5')](AGIReply,Transform);AGIReply[_0x8dff('0x6')][_0x8dff('0x7')]=function(_0x230d89,_0x4c02ca,_0x4e09cc){var _0x517540='\x0a',_0x55433d=['\x0a\x0a',_0x8dff('0x8')],_0x24eb87=-0x1,_0xe6668e=-0x1,_0x5ace99='',_0x25d3de=0x0,_0x2d780d='',_0x4aa09f='';this['_localBuffer']+=_0x230d89[_0x8dff('0x9')]();_0x2d780d=this[_0x8dff('0x3')];if(!this[_0x8dff('0x4')]){_0x25d3de=0x0;while(_0x55433d[_0x25d3de]){while((_0xe6668e=_0x2d780d[_0x8dff('0xa')](_0x55433d[_0x25d3de]))!=-0x1){_0x5ace99=_0x55433d[_0x25d3de];_0x4aa09f=_0x2d780d[_0x8dff('0xb')](0x0,_0xe6668e);_0x2d780d=_0x2d780d['substring'](_0xe6668e+_0x5ace99[_0x8dff('0xc')]);var _0x49e926=_0x4aa09f[_0x8dff('0xd')](_0x517540),_0x3adef8=0x0,_0x144f0b={},_0x4d930d='',_0x2d1005='',_0x5a0d47=-0x1;while(_0x49e926[_0x3adef8]){_0x5a0d47=_0x49e926[_0x3adef8][_0x8dff('0xa')](':');if(_0x5a0d47!=-0x1){_0x4d930d=_0x49e926[_0x3adef8][_0x8dff('0xe')](0x0,_0x5a0d47)[_0x8dff('0xf')]();_0x2d1005=_0x49e926[_0x3adef8][_0x8dff('0xe')](_0x5a0d47+0x1)['trim']();if(_0x4d930d[_0x8dff('0xc')]>0x0){_0x144f0b[_0x4d930d]=_0x2d1005;}}else{}_0x3adef8++;}this[_0x8dff('0x10')](_0x8dff('0x11'),_0x144f0b);this['_inBody']=!![];}_0x25d3de++;}this[_0x8dff('0x3')]=_0x2d780d;}else{while((_0x24eb87=_0x2d780d[_0x8dff('0xa')](_0x517540))!=-0x1){_0x4aa09f=_0x2d780d['substring'](0x0,_0x24eb87);this[_0x8dff('0x10')](_0x8dff('0x12'),_0x4aa09f);_0x2d780d=_0x2d780d['substring'](_0x24eb87+_0x517540[_0x8dff('0xc')]);}this[_0x8dff('0x3')]=_0x2d780d;}_0x4e09cc();};module['exports']=AGIReply; \ No newline at end of file +var _0x2b81=['\x0d\x0a\x0d\x0a','toString','substring','split','indexOf','slice','trim','emit','headers','line','length','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform'];(function(_0x37c30d,_0x306072){var _0x48512f=function(_0x232f14){while(--_0x232f14){_0x37c30d['push'](_0x37c30d['shift']());}};_0x48512f(++_0x306072);}(_0x2b81,0x1ef));var _0x12b8=function(_0x21f9e9,_0x307ffb){_0x21f9e9=_0x21f9e9-0x0;var _0x153a53=_0x2b81[_0x21f9e9];return _0x153a53;};'use strict';var util=require(_0x12b8('0x0'));var Transform=require(_0x12b8('0x1'))[_0x12b8('0x2')];function AGIReply(_0x427db8){Transform[_0x12b8('0x3')](this,_0x427db8);this[_0x12b8('0x4')]='';this[_0x12b8('0x5')]=![];}util[_0x12b8('0x6')](AGIReply,Transform);AGIReply[_0x12b8('0x7')][_0x12b8('0x8')]=function(_0x554505,_0x41db95,_0x490284){var _0x2f8abc='\x0a',_0x29eb3d=['\x0a\x0a',_0x12b8('0x9')],_0x3f9216=-0x1,_0x119d5b=-0x1,_0x50a615='',_0x3e8473=0x0,_0x12f442='',_0x3727c3='';this[_0x12b8('0x4')]+=_0x554505[_0x12b8('0xa')]();_0x12f442=this[_0x12b8('0x4')];if(!this[_0x12b8('0x5')]){_0x3e8473=0x0;while(_0x29eb3d[_0x3e8473]){while((_0x119d5b=_0x12f442['indexOf'](_0x29eb3d[_0x3e8473]))!=-0x1){_0x50a615=_0x29eb3d[_0x3e8473];_0x3727c3=_0x12f442[_0x12b8('0xb')](0x0,_0x119d5b);_0x12f442=_0x12f442['substring'](_0x119d5b+_0x50a615['length']);var _0x4451fa=_0x3727c3[_0x12b8('0xc')](_0x2f8abc),_0x379990=0x0,_0xca9f1b={},_0x582c19='',_0x425900='',_0x39826c=-0x1;while(_0x4451fa[_0x379990]){_0x39826c=_0x4451fa[_0x379990][_0x12b8('0xd')](':');if(_0x39826c!=-0x1){_0x582c19=_0x4451fa[_0x379990][_0x12b8('0xe')](0x0,_0x39826c)[_0x12b8('0xf')]();_0x425900=_0x4451fa[_0x379990][_0x12b8('0xe')](_0x39826c+0x1)['trim']();if(_0x582c19['length']>0x0){_0xca9f1b[_0x582c19]=_0x425900;}}else{}_0x379990++;}this[_0x12b8('0x10')](_0x12b8('0x11'),_0xca9f1b);this[_0x12b8('0x5')]=!![];}_0x3e8473++;}this['_localBuffer']=_0x12f442;}else{while((_0x3f9216=_0x12f442['indexOf'](_0x2f8abc))!=-0x1){_0x3727c3=_0x12f442[_0x12b8('0xb')](0x0,_0x3f9216);this[_0x12b8('0x10')](_0x12b8('0x12'),_0x3727c3);_0x12f442=_0x12f442[_0x12b8('0xb')](_0x3f9216+_0x2f8abc[_0x12b8('0x13')]);}this[_0x12b8('0x4')]=_0x12f442;}_0x490284();};module[_0x12b8('0x14')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index b7bf904..c355c97 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 _0xd5b2=['CloudProvider','getSquareProjectById','getVoiceQueueById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','jayson/promise','http','request','error','result','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp'];(function(_0x5e9d35,_0x382c91){var _0x3beb2e=function(_0x4242cf){while(--_0x4242cf){_0x5e9d35['push'](_0x5e9d35['shift']());}};_0x3beb2e(++_0x382c91);}(_0xd5b2,0x10e));var _0x2d5b=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xd5b2[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var moment=require(_0x2d5b('0x0'));var jayson=require(_0x2d5b('0x1'));var client=jayson['client'][_0x2d5b('0x2')]({'port':0x2329});function request(_0x2f54e1,_0x457ace){return new Promise(function(_0x2846a3,_0x5c31d3){return client[_0x2d5b('0x3')](_0x2f54e1,_0x457ace)['then'](function(_0x5c6eba){if(_0x5c6eba['error']){return _0x5c31d3(_0x5c6eba[_0x2d5b('0x4')]['message']);}else{return _0x2846a3(_0x5c6eba[_0x2d5b('0x5')]);}})['catch'](function(_0x1c2150){return _0x5c31d3(_0x1c2150);});});}exports['getSquareProjects']=function(){return request(_0x2d5b('0x6'),{'options':{'raw':![],'attributes':['id',_0x2d5b('0x7'),_0x2d5b('0x8')]}});};exports[_0x2d5b('0x9')]=function(_0x15fdce){return request(_0x2d5b('0xa'),{'options':{'raw':![],'where':{'name':_0x15fdce},'attributes':[_0x2d5b('0x8')]}});};exports[_0x2d5b('0xb')]=function(_0x3e9d7a){return request(_0x2d5b('0xc'),{'options':{'raw':![],'where':{'id':_0x3e9d7a},'include':[{'model':_0x2d5b('0xd'),'as':_0x2d5b('0xe'),'include':[{'model':_0x2d5b('0xf'),'as':_0x2d5b('0xf')}]}],'attributes':['id','name','email'],'smtp':!![]}});};exports[_0x2d5b('0x10')]=function(_0x3dee67){return request(_0x2d5b('0xa'),{'options':{'where':{'id':_0x3dee67},'attributes':[_0x2d5b('0x7')]}});};exports[_0x2d5b('0x11')]=function(_0x461969){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x461969},'attributes':[_0x2d5b('0x7')]}});};exports['getVariableById']=function(_0x1a5624){return request(_0x2d5b('0x12'),{'options':{'where':{'id':_0x1a5624},'attributes':['name']}});};exports[_0x2d5b('0x13')]=function(_0xa1b05d){return request('ShowSquareOdbc',{'options':{'where':{'id':_0xa1b05d},'attributes':[_0x2d5b('0x14')]}});};exports[_0x2d5b('0x15')]=function(_0x4cecb5){return request(_0x2d5b('0x16'),{'options':{'where':{'id':_0x4cecb5},'attributes':[_0x2d5b('0x7')]}});};exports[_0x2d5b('0x17')]=function(_0x8c32cc){return request(_0x2d5b('0x18'),{'options':{'where':{'phone':_0x8c32cc[_0x2d5b('0x19')]},'attributes':['id']}});};exports[_0x2d5b('0x1a')]=function(_0x4f81db){return request(_0x2d5b('0x1b'),{'options':{'where':{'id':_0x4f81db},'attributes':[_0x2d5b('0x7')]}});};exports[_0x2d5b('0x1c')]=function(_0x90198b){return request('ShowSound',{'options':{'where':{'id':_0x90198b},'attributes':[_0x2d5b('0x1d')]}});};exports['getIntervalById']=function(_0xc3bd09){return request(_0x2d5b('0x1e'),{'options':{'raw':![],'where':{'id':_0xc3bd09},'include':[{'model':_0x2d5b('0x1f'),'as':_0x2d5b('0x20')}]}});};exports[_0x2d5b('0x21')]=function(_0x52cd78){return request(_0x2d5b('0x22'),{'options':{'where':{'id':_0x52cd78},'attributes':['id',_0x2d5b('0x7')]}});};exports['createSmsMessage']=function(_0x4e8372){return request(_0x2d5b('0x23'),{'body':_0x4e8372});};exports[_0x2d5b('0x24')]=function(_0x4bf500){return request('CreateSquareDetailsReport',{'body':_0x4bf500});};exports[_0x2d5b('0x25')]=function(_0xaebca4){return request(_0x2d5b('0x26'),{'body':_[_0x2d5b('0x27')](_0xaebca4,{'project_name':_0xaebca4[_0x2d5b('0x28')],'prev_project_name':_0xaebca4[_0x2d5b('0x29')]||'','is_subproject':_0xaebca4[_0x2d5b('0x29')]?!![]:![],'leaveAt':moment()[_0x2d5b('0x2a')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x2e9a87){return request(_0x2d5b('0x2b'),{'body':_0x2e9a87});};exports[_0x2d5b('0x2c')]=function(_0x2aa2cf){return request(_0x2d5b('0x2d'),{'body':_0x2aa2cf});};exports['createCmContact']=function(_0x8e8fbc){return request(_0x2d5b('0x2e'),{'options':{'raw':![],'where':{'phone':_0x8e8fbc[_0x2d5b('0x19')],'ListId':_0x8e8fbc[_0x2d5b('0x2f')]}}})['then'](function(_0x4c95ee){if(_0x4c95ee){return _0x4c95ee;}return request(_0x2d5b('0x30'),{'body':_0x8e8fbc});});};exports[_0x2d5b('0x31')]=function(_0x22d6af){return request(_0x2d5b('0x32'),{'options':{'where':{'id':_0x22d6af},'attributes':[_0x2d5b('0x7')]}});};exports[_0x2d5b('0x33')]=function(_0x47338e,_0xc7d23f){return request('LoginUser',{'body':{'interface':_0xc7d23f},'options':{'where':_0x47338e}});};exports[_0x2d5b('0x34')]=function(_0x511a87,_0x258894,_0x2bc737){return request('PauseUser',{'body':{'type':_0x258894,'uniqueid':_0x2bc737},'options':{'where':_0x511a87}});};exports[_0x2d5b('0x35')]=function(_0x442f6c){return request(_0x2d5b('0x36'),{'body':{},'options':{'where':_0x442f6c}});};exports[_0x2d5b('0x37')]=function(_0xb970e8){return request(_0x2d5b('0x38'),{'body':{},'options':{'where':_0xb970e8}});}; \ No newline at end of file +var _0x12c9=['YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createCmContact','ListId','agentLogin','LoginUser','agentUnpause','lodash','moment','jayson/promise','client','http','request','then','error','message','result','catch','GetSquareProjects','production','ShowMailAccount','Smtp','CloudProvider','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','save_name','Interval','Intervals','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_1','arg_2','format'];(function(_0x4dab7b,_0x1b80a1){var _0xc84024=function(_0x6b6c2e){while(--_0x6b6c2e){_0x4dab7b['push'](_0x4dab7b['shift']());}};_0xc84024(++_0x1b80a1);}(_0x12c9,0x1c9));var _0x912c=function(_0x424f22,_0x26b347){_0x424f22=_0x424f22-0x0;var _0x15daea=_0x12c9[_0x424f22];return _0x15daea;};'use strict';var _=require(_0x912c('0x0'));var moment=require(_0x912c('0x1'));var jayson=require(_0x912c('0x2'));var client=jayson[_0x912c('0x3')][_0x912c('0x4')]({'port':0x2329});function request(_0x5420d6,_0x10ebce){return new Promise(function(_0xcb7adc,_0x2c8059){return client[_0x912c('0x5')](_0x5420d6,_0x10ebce)[_0x912c('0x6')](function(_0x505262){if(_0x505262['error']){return _0x2c8059(_0x505262[_0x912c('0x7')][_0x912c('0x8')]);}else{return _0xcb7adc(_0x505262[_0x912c('0x9')]);}})[_0x912c('0xa')](function(_0x312a7f){return _0x2c8059(_0x312a7f);});});}exports['getSquareProjects']=function(){return request(_0x912c('0xb'),{'options':{'raw':![],'attributes':['id','name',_0x912c('0xc')]}});};exports['getSquareProject']=function(_0xf95487){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0xf95487},'attributes':[_0x912c('0xc')]}});};exports['getMailAccountById']=function(_0x370b91){return request(_0x912c('0xd'),{'options':{'raw':![],'where':{'id':_0x370b91},'include':[{'model':'MailServerOut','as':_0x912c('0xe'),'include':[{'model':'CloudProvider','as':_0x912c('0xf')}]}],'attributes':['id',_0x912c('0x10'),_0x912c('0x11')],'smtp':!![]}});};exports[_0x912c('0x12')]=function(_0x325880){return request('ShowSquareProject',{'options':{'where':{'id':_0x325880},'attributes':[_0x912c('0x10')]}});};exports['getVoiceQueueById']=function(_0x28cdb4){return request(_0x912c('0x13'),{'options':{'where':{'id':_0x28cdb4},'attributes':['name']}});};exports[_0x912c('0x14')]=function(_0xc48e52){return request(_0x912c('0x15'),{'options':{'where':{'id':_0xc48e52},'attributes':[_0x912c('0x10')]}});};exports[_0x912c('0x16')]=function(_0x11c2a6){return request(_0x912c('0x17'),{'options':{'where':{'id':_0x11c2a6},'attributes':[_0x912c('0x18')]}});};exports[_0x912c('0x19')]=function(_0x26cb90){return request('ShowUser',{'options':{'where':{'id':_0x26cb90},'attributes':[_0x912c('0x10')]}});};exports[_0x912c('0x1a')]=function(_0x2a7693){return request(_0x912c('0x1b'),{'options':{'where':{'phone':_0x2a7693[_0x912c('0x1c')]},'attributes':['id']}});};exports[_0x912c('0x1d')]=function(_0x2a22d3){return request(_0x912c('0x1e'),{'options':{'where':{'id':_0x2a22d3},'attributes':[_0x912c('0x10')]}});};exports['getSoundById']=function(_0x5ca648){return request(_0x912c('0x1f'),{'options':{'where':{'id':_0x5ca648},'attributes':[_0x912c('0x20')]}});};exports['getIntervalById']=function(_0x49cb1e){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x49cb1e},'include':[{'model':_0x912c('0x21'),'as':_0x912c('0x22')}]}});};exports['getSmsAccountById']=function(_0x5afd32){return request('ShowSmsAccount',{'options':{'where':{'id':_0x5afd32},'attributes':['id',_0x912c('0x10')]}});};exports[_0x912c('0x23')]=function(_0x4293f2){return request(_0x912c('0x24'),{'body':_0x4293f2});};exports[_0x912c('0x25')]=function(_0x11ea1c){return request(_0x912c('0x26'),{'body':_0x11ea1c});};exports['createSquareReport']=function(_0x18b398){return request('CreateSquareReport',{'body':_[_0x912c('0x27')](_0x18b398,{'project_name':_0x18b398[_0x912c('0x28')],'prev_project_name':_0x18b398[_0x912c('0x29')]||'','is_subproject':_0x18b398[_0x912c('0x29')]?!![]:![],'leaveAt':moment()[_0x912c('0x2a')](_0x912c('0x2b'))})});};exports[_0x912c('0x2c')]=function(_0x71b2e6){return request('CreateSquareRecording',{'body':_0x71b2e6});};exports['createSquareMessage']=function(_0x302687){return request('CreateSquareMessage',{'body':_0x302687});};exports[_0x912c('0x2d')]=function(_0x24c2f2){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x24c2f2[_0x912c('0x1c')],'ListId':_0x24c2f2[_0x912c('0x2e')]}}})[_0x912c('0x6')](function(_0x188790){if(_0x188790){return _0x188790;}return request('CreateCmContact',{'body':_0x24c2f2});});};exports['getPauseById']=function(_0xb58718){return request('ShowPause',{'options':{'where':{'id':_0xb58718},'attributes':[_0x912c('0x10')]}});};exports[_0x912c('0x2f')]=function(_0x3b112e,_0x654542){return request(_0x912c('0x30'),{'body':{'interface':_0x654542},'options':{'where':_0x3b112e}});};exports['agentPause']=function(_0x41366f,_0x3492e7,_0x10bd1a){return request('PauseUser',{'body':{'type':_0x3492e7,'uniqueid':_0x10bd1a},'options':{'where':_0x41366f}});};exports[_0x912c('0x31')]=function(_0x5973ba){return request('UnpauseUser',{'body':{},'options':{'where':_0x5973ba}});};exports['agentLogout']=function(_0x1e29b0){return request('LogoutUser',{'body':{},'options':{'where':_0x1e29b0}});}; \ 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 e8a4115..e56d9b8 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 _0x4677=['exports','./polly'];(function(_0x15f38c,_0x5cba33){var _0x3b94dd=function(_0x5012f9){while(--_0x5012f9){_0x15f38c['push'](_0x15f38c['shift']());}};_0x3b94dd(++_0x5cba33);}(_0x4677,0x155));var _0x7467=function(_0x2b820c,_0x321d59){_0x2b820c=_0x2b820c-0x0;var _0x58db3f=_0x4677[_0x2b820c];return _0x58db3f;};var polly=require(_0x7467('0x0'));var lex=require('./lex');module[_0x7467('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x5f71=['exports','./polly'];(function(_0x27c24e,_0x5db1c7){var _0x39004a=function(_0x44286d){while(--_0x44286d){_0x27c24e['push'](_0x27c24e['shift']());}};_0x39004a(++_0x5db1c7);}(_0x5f71,0xc9));var _0x15f7=function(_0x5a01bc,_0x4b0b27){_0x5a01bc=_0x5a01bc-0x0;var _0x2eefda=_0x5f71[_0x5a01bc];return _0x2eefda;};var polly=require(_0x15f7('0x0'));var lex=require('./lex');module[_0x15f7('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 59b57ab..3cc517d 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 _0xda3f=['exports'];(function(_0x4ee9cd,_0xd375b0){var _0x328a5b=function(_0x3ad1f4){while(--_0x3ad1f4){_0x4ee9cd['push'](_0x4ee9cd['shift']());}};_0x328a5b(++_0xd375b0);}(_0xda3f,0xec));var _0xfda3=function(_0x1e4942,_0x243a97){_0x1e4942=_0x1e4942-0x0;var _0xf4d90b=_0xda3f[_0x1e4942];return _0xf4d90b;};'use strict';var lex=require('./lib/api');module[_0xfda3('0x0')]=function(_0xf4e78,_0x534697,_0x5299b0,_0x5d7071,_0x3859fe,_0x581693){return lex(_0xf4e78,_0x534697,_0x5299b0,_0x5d7071,_0x3859fe,_0x581693);}; \ No newline at end of file +var _0x41bb=['exports','./lib/api'];(function(_0x4e2f96,_0x289db4){var _0x35b8d5=function(_0x2fde81){while(--_0x2fde81){_0x4e2f96['push'](_0x4e2f96['shift']());}};_0x35b8d5(++_0x289db4);}(_0x41bb,0xc5));var _0xb41b=function(_0x54e7af,_0x3906b7){_0x54e7af=_0x54e7af-0x0;var _0xa1fce0=_0x41bb[_0x54e7af];return _0xa1fce0;};'use strict';var lex=require(_0xb41b('0x0'));module[_0xb41b('0x1')]=function(_0x4ef2f1,_0x428431,_0x4d5578,_0x30ea75,_0x1c9d36,_0x148333){return lex(_0x4ef2f1,_0x428431,_0x4d5578,_0x30ea75,_0x1c9d36,_0x148333);}; \ 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 fc3cb2c..281ee59 100644 --- a/server/services/agi/scripts/aws/lex/lib/api.js +++ b/server/services/agi/scripts/aws/lex/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0xf6d2c2,_0x39a37e){var _0x2c526a=function(_0x5b33ee){while(--_0x5b33ee){_0xf6d2c2['push'](_0xf6d2c2['shift']());}};_0x2c526a(++_0x39a37e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x1db9ea,_0x54d6d3){var _0x1a7ee4=function(_0x40e66f){while(--_0x40e66f){_0x1db9ea['push'](_0x1db9ea['shift']());}};_0x1a7ee4(++_0x54d6d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index 066fbe8..2fd829b 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 _0xb855=['./lib/api','exports'];(function(_0x43b08,_0x15f967){var _0x5e05f4=function(_0x4bb0cb){while(--_0x4bb0cb){_0x43b08['push'](_0x43b08['shift']());}};_0x5e05f4(++_0x15f967);}(_0xb855,0x17c));var _0x5b85=function(_0x39fba9,_0x245311){_0x39fba9=_0x39fba9-0x0;var _0x3078c5=_0xb855[_0x39fba9];return _0x3078c5;};'use strict';var polly=require(_0x5b85('0x0'));module[_0x5b85('0x1')]=function(_0x371cc6,_0x38f546,_0x3e8c8e,_0x25fa2a,_0x19604b,_0x4f9b52,_0x5e92c0){return polly(_0x371cc6,_0x38f546,_0x3e8c8e,_0x25fa2a,_0x19604b,_0x4f9b52,_0x5e92c0);}; \ No newline at end of file +var _0x7767=['./lib/api'];(function(_0x25bdd0,_0x28ed57){var _0x11430e=function(_0x5891fe){while(--_0x5891fe){_0x25bdd0['push'](_0x25bdd0['shift']());}};_0x11430e(++_0x28ed57);}(_0x7767,0x101));var _0x7776=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x7767[_0x4b2863];return _0x567d67;};'use strict';var polly=require(_0x7776('0x0'));module['exports']=function(_0x20165c,_0xad750b,_0x40be84,_0x4229fb,_0x3bd919,_0x62387c,_0x3ae4ed){return polly(_0x20165c,_0xad750b,_0x40be84,_0x4229fb,_0x3bd919,_0x62387c,_0x3ae4ed);}; \ 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 6c7e835..021961c 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 _0x67c4=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','bluebird','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0xb581a5,_0x2ccfd8){var _0x3213f2=function(_0x53598b){while(--_0x53598b){_0xb581a5['push'](_0xb581a5['shift']());}};_0x3213f2(++_0x2ccfd8);}(_0x67c4,0xaf));var _0x467c=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x67c4[_0x17406a];return _0x1501ff;};'use strict';var fs=require('fs');var path=require(_0x467c('0x0'));var BPromise=require(_0x467c('0x1'));var rs=require('randomstring');var AWS=require(_0x467c('0x2'));function pollyResult(_0x583ab8,_0x1ab656,_0x41cdda){return new BPromise(function(_0x2a0cd0,_0x568772){_0x583ab8[_0x467c('0x3')](_0x1ab656,function(_0x4a0230,_0x4e896b){if(_0x4a0230){_0x568772(_0x4a0230);}else if(_0x4e896b){if(_0x4e896b[_0x467c('0x4')]instanceof Buffer){fs['writeFile'](_0x41cdda,_0x4e896b[_0x467c('0x4')],function(_0x3c32f8){if(_0x3c32f8){_0x568772(_0x3c32f8);}else{_0x2a0cd0();}});}else{_0x568772(new Error(_0x467c('0x5')));}}else{_0x568772(new Error(_0x467c('0x6')));}});});}module[_0x467c('0x7')]=function(_0x509297,_0x1c7c99,_0x1e334f,_0x4afdfb,_0x51280a,_0x115812,_0x47a35f){var _0x5cce4f=new AWS[(_0x467c('0x8'))]({'accessKeyId':_0x509297,'secretAccessKey':_0x1c7c99,'region':_0x1e334f});var _0x41898e={'Text':_0x51280a,'TextType':_0x115812||'text','OutputFormat':_0x467c('0x9'),'VoiceId':_0x4afdfb};return pollyResult(_0x5cce4f,_0x41898e,_0x47a35f);}; \ No newline at end of file +var _0x2a79=['path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3'];(function(_0x5ebf44,_0x4e543e){var _0x2fef12=function(_0x59d629){while(--_0x59d629){_0x5ebf44['push'](_0x5ebf44['shift']());}};_0x2fef12(++_0x4e543e);}(_0x2a79,0xb4));var _0x92a7=function(_0x1f8e09,_0x30778c){_0x1f8e09=_0x1f8e09-0x0;var _0xbd9c10=_0x2a79[_0x1f8e09];return _0xbd9c10;};'use strict';var fs=require('fs');var path=require(_0x92a7('0x0'));var BPromise=require(_0x92a7('0x1'));var rs=require(_0x92a7('0x2'));var AWS=require(_0x92a7('0x3'));function pollyResult(_0x34723c,_0x12c6f7,_0x34bd48){return new BPromise(function(_0x334fe3,_0x24459c){_0x34723c[_0x92a7('0x4')](_0x12c6f7,function(_0x46a240,_0x250498){if(_0x46a240){_0x24459c(_0x46a240);}else if(_0x250498){if(_0x250498[_0x92a7('0x5')]instanceof Buffer){fs[_0x92a7('0x6')](_0x34bd48,_0x250498[_0x92a7('0x5')],function(_0x18070f){if(_0x18070f){_0x24459c(_0x18070f);}else{_0x334fe3();}});}else{_0x24459c(new Error(_0x92a7('0x7')));}}else{_0x24459c(new Error(_0x92a7('0x8')));}});});}module['exports']=function(_0x2880fc,_0x3cb8fc,_0x1847ff,_0x5ddab5,_0x21367b,_0x31caa5,_0x4d39cd){var _0x1067e3=new AWS[(_0x92a7('0x9'))]({'accessKeyId':_0x2880fc,'secretAccessKey':_0x3cb8fc,'region':_0x1847ff});var _0x52d4c3={'Text':_0x21367b,'TextType':_0x31caa5||_0x92a7('0xa'),'OutputFormat':_0x92a7('0xb'),'VoiceId':_0x5ddab5};return pollyResult(_0x1067e3,_0x52d4c3,_0x4d39cd);}; \ 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 a9559b2..34e913d 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 _0xe73b=['exports'];(function(_0x1b40b5,_0x25e063){var _0x5f0a6e=function(_0x22af6d){while(--_0x22af6d){_0x1b40b5['push'](_0x1b40b5['shift']());}};_0x5f0a6e(++_0x25e063);}(_0xe73b,0x1be));var _0xbe73=function(_0xf7f60a,_0x15f736){_0xf7f60a=_0xf7f60a-0x0;var _0x2567ad=_0xe73b[_0xf7f60a];return _0x2567ad;};'use strict';var asr=require('./lib/api');module[_0xbe73('0x0')]=function(_0x147554,_0x507b77,_0x468d56,_0x563d01){return asr(_0x147554,_0x507b77,_0x468d56);}; \ No newline at end of file +var _0x175b=['./lib/api'];(function(_0x2135a8,_0x2d5706){var _0x3dd593=function(_0x3c4c5d){while(--_0x3c4c5d){_0x2135a8['push'](_0x2135a8['shift']());}};_0x3dd593(++_0x2d5706);}(_0x175b,0x155));var _0xb175=function(_0x188a93,_0xaf57db){_0x188a93=_0x188a93-0x0;var _0x23b40d=_0x175b[_0x188a93];return _0x23b40d;};'use strict';var asr=require(_0xb175('0x0'));module['exports']=function(_0x5936a4,_0x409501,_0x178186,_0x4a3e9c){return asr(_0x5936a4,_0x409501,_0x178186);}; \ 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 8701e3f..0423f03 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 _0x54ef=['https://speech.googleapis.com','string','length','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','8000','url','bluebird'];(function(_0x34b413,_0x5f159f){var _0x2455fc=function(_0x20c1f2){while(--_0x20c1f2){_0x34b413['push'](_0x34b413['shift']());}};_0x2455fc(++_0x5f159f);}(_0x54ef,0x112));var _0xf54e=function(_0x39f983,_0x310a5a){_0x39f983=_0x39f983-0x0;var _0x473279=_0x54ef[_0x39f983];return _0x473279;};'use strict';var url=require(_0xf54e('0x0'));var BPromise=require(_0xf54e('0x1'));var fs=require('fs');var host=_0xf54e('0x2');module['exports']=function(_0xd936f7,_0x18b7d6,_0x18b1cf){return new BPromise(function(_0x42b9b2,_0x8b6bb6){var _0x431e36;if(typeof _0xd936f7!==_0xf54e('0x3')||_0xd936f7['length']===0x0){return _0x8b6bb6('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x18b7d6!==_0xf54e('0x3')||_0x18b7d6[_0xf54e('0x4')]===0x0){return _0x8b6bb6(_0xf54e('0x5'));}if(typeof _0x18b1cf!=='undefined'&&(typeof _0x18b1cf!==_0xf54e('0x3')||_0x18b1cf['length']===0x0)){return _0x8b6bb6(_0xf54e('0x6'));}try{_0x431e36=fs[_0xf54e('0x7')](_0xd936f7)['toString'](_0xf54e('0x8'));}catch(_0xefa1c0){return _0x8b6bb6(_0xefa1c0);}return _0x42b9b2({'method':_0xf54e('0x9'),'uri':host+_0xf54e('0xa')+_0x18b7d6,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xf54e('0xb'),'languageCode':_0x18b1cf},'audio':{'content':_0x431e36}},'json':!![]});});}; \ No newline at end of file +var _0x26c2=['readFileSync','toString','POST','8000','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string'];(function(_0x38d682,_0x5766ef){var _0x4c22b5=function(_0x2ee576){while(--_0x2ee576){_0x38d682['push'](_0x38d682['shift']());}};_0x4c22b5(++_0x5766ef);}(_0x26c2,0x130));var _0x226c=function(_0x279171,_0x195a91){_0x279171=_0x279171-0x0;var _0x574ab0=_0x26c2[_0x279171];return _0x574ab0;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0x226c('0x0')]=function(_0x23ec98,_0x674a14,_0x3b56e8){return new BPromise(function(_0x5e55b3,_0x2f79d3){var _0x117899;if(typeof _0x23ec98!=='string'||_0x23ec98[_0x226c('0x1')]===0x0){return _0x2f79d3(_0x226c('0x2'));}if(typeof _0x674a14!==_0x226c('0x3')||_0x674a14[_0x226c('0x1')]===0x0){return _0x2f79d3(_0x226c('0x4'));}if(typeof _0x3b56e8!=='undefined'&&(typeof _0x3b56e8!==_0x226c('0x3')||_0x3b56e8[_0x226c('0x1')]===0x0)){return _0x2f79d3(_0x226c('0x5'));}try{_0x117899=fs[_0x226c('0x6')](_0x23ec98)[_0x226c('0x7')]('base64');}catch(_0x16cbbd){return _0x2f79d3(_0x16cbbd);}return _0x5e55b3({'method':_0x226c('0x8'),'uri':host+'/v1/speech:recognize?key='+_0x674a14,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x226c('0x9'),'languageCode':_0x3b56e8},'audio':{'content':_0x117899}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index ea36edb..2f03ed5 100644 --- a/server/services/agi/scripts/google/index.js +++ b/server/services/agi/scripts/google/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7a2=['./asr'];(function(_0x14ce8,_0x47b777){var _0x2376c1=function(_0x339692){while(--_0x339692){_0x14ce8['push'](_0x14ce8['shift']());}};_0x2376c1(++_0x47b777);}(_0xd7a2,0x198));var _0x2d7a=function(_0x402129,_0x1bc6a1){_0x402129=_0x402129-0x0;var _0x2d6bd6=_0xd7a2[_0x402129];return _0x2d6bd6;};var asr=require(_0x2d7a('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x208f=['./asr','exports'];(function(_0x5c3432,_0x37e25d){var _0x350bee=function(_0x4cf95c){while(--_0x4cf95c){_0x5c3432['push'](_0x5c3432['shift']());}};_0x350bee(++_0x37e25d);}(_0x208f,0x1d6));var _0xf208=function(_0x35abf6,_0x43902d){_0x35abf6=_0x35abf6-0x0;var _0x30587a=_0x208f[_0x35abf6];return _0x30587a;};var asr=require(_0xf208('0x0'));module[_0xf208('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 7a54f26..7ec6b98 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 _0x5c2a=['./aws','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','close','pipe','error','end','https:','data','wav','finish\x20to\x20convert','start','generate','.wav','writeFileSync','base64','unlink','777','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','then','resolve','tmp','.mp3','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','split','utf8','POST','application/x-www-form-urlencoded','stringify','null','generic','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','googleASR','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','name','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','diagnosticInfo','queryResult','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','text','channelData','CustomAction','CustomActionData','AudioFromTts','apiai-promise','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5c2a,0x101));var _0xa5c2=function(_0x2a7c2a,_0x37cc9e){_0x2a7c2a=_0x2a7c2a-0x0;var _0x195732=_0x5c2a[_0x2a7c2a];return _0x195732;};'use strict';var apiai=require(_0xa5c2('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xa5c2('0x1'));var fs=require('fs');var http=require(_0xa5c2('0x2'));var https=require(_0xa5c2('0x3'));var md5=require(_0xa5c2('0x4'));var path=require(_0xa5c2('0x5'));var querystring=require(_0xa5c2('0x6'));var rp=require(_0xa5c2('0x7'));var rs=require(_0xa5c2('0x8'));var sox=require(_0xa5c2('0x9'));var tts=require(_0xa5c2('0xa'));var urlParse=require(_0xa5c2('0xb'))[_0xa5c2('0xc')];var util=require('util');var aws=require(_0xa5c2('0xd'));var google=require(_0xa5c2('0xe'));var sestek=require(_0xa5c2('0xf'));var tilde=require(_0xa5c2('0x10'));var logger=require(_0xa5c2('0x11'))('agi');var ISPEECH_API=_0xa5c2('0x12');function downloadFile(_0x3ce464,_0x15449a){return new BPromise(function(_0x9a49e5,_0x25762c){var _0x5489b3=urlParse(_0x3ce464);var _0x506375=_0x5489b3[_0xa5c2('0x13')]==='https:'?https:http;var _0x309bc7={'host':_0x5489b3[_0xa5c2('0x14')],'path':_0x5489b3[_0xa5c2('0x5')],'headers':{'user-agent':_0xa5c2('0x15')}};_0x506375[_0xa5c2('0x16')](_0x309bc7,function(_0x552a00){if(_0x552a00[_0xa5c2('0x17')]!==0xc8){logger['error'](_0xa5c2('0x18')+_0x3ce464+_0xa5c2('0x19')+_0x552a00[_0xa5c2('0x17')]+'\x20('+_0x552a00[_0xa5c2('0x1a')]+')');_0x25762c(new Error(_0xa5c2('0x18')+_0x3ce464+_0xa5c2('0x19')+_0x552a00[_0xa5c2('0x17')]+'\x20('+_0x552a00[_0xa5c2('0x1a')]+')'));return;}var _0x24bd75=fs[_0xa5c2('0x1b')](_0x15449a);_0x24bd75['on'](_0xa5c2('0x1c'),function(){logger[_0xa5c2('0x1d')]('finish\x20download\x20file');_0x24bd75[_0xa5c2('0x1e')](_0x9a49e5);});_0x24bd75['on']('error',function(_0x2707ed){fs['unlink'](_0x15449a);logger['error']('download\x20error',_0x2707ed);_0x25762c(_0x2707ed);});_0x552a00[_0xa5c2('0x1f')](_0x24bd75);})['on']('error',function(_0x2ba3b7){logger[_0xa5c2('0x20')](_0x2ba3b7);_0x25762c(_0x2ba3b7);})[_0xa5c2('0x21')]();});}function uploadFile(_0x19491b){return new BPromise(function(_0x1bddc5,_0x37ab8e){var _0x39d1b3=urlParse(_0x19491b);var _0x4ab2e2=_0x39d1b3['protocol']===_0xa5c2('0x22')?https:http;var _0x1dc910={'host':_0x39d1b3[_0xa5c2('0x14')],'path':_0x39d1b3[_0xa5c2('0x5')],'headers':{'user-agent':_0xa5c2('0x15')}};_0x4ab2e2[_0xa5c2('0x16')](_0x1dc910,function(_0xba7996){if(_0xba7996[_0xa5c2('0x17')]!==0xc8){_0x37ab8e(new Error(_0xa5c2('0x18')+_0x19491b+_0xa5c2('0x19')+_0xba7996[_0xa5c2('0x17')]+'\x20('+_0xba7996[_0xa5c2('0x1a')]+')'));return;}var _0x3692a8='';_0xba7996['on'](_0xa5c2('0x23'),function(_0x2c04be){_0x3692a8+=_0x2c04be;});_0xba7996['on']('end',function(){_0x1bddc5(_0x3692a8);});})['on'](_0xa5c2('0x20'),function(_0x1f0e13){_0x37ab8e(_0x1f0e13);})['end']();});}function convertFile(_0x51dfa2,_0x2e62f8){return new BPromise(function(_0x7e3cb5,_0x66d08a){var _0x1a151a=sox['transcode'](_0x51dfa2,_0x2e62f8,{'sampleRate':0x1f40,'format':_0xa5c2('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1a151a['on'](_0xa5c2('0x20'),function(_0x53dfb1){logger[_0xa5c2('0x20')]('error\x20convert',_0x53dfb1);_0x66d08a(_0x53dfb1);});_0x1a151a['on'](_0xa5c2('0x21'),function(){logger[_0xa5c2('0x1d')](_0xa5c2('0x25'));_0x7e3cb5();});_0x1a151a[_0xa5c2('0x26')]();});}function base64Decode(_0x4c1c28,_0x4b5407){var _0x22d952=path['resolve'](__dirname,'tmp',rs[_0xa5c2('0x27')](0x4)+_0xa5c2('0x28'));fs[_0xa5c2('0x29')](_0x22d952,_0x4c1c28,_0xa5c2('0x2a'));return convertFile(_0x22d952,_0x4b5407)['then'](function(){try{fs[_0xa5c2('0x2b')](_0x22d952);fs['chmodSync'](_0x4b5407,_0xa5c2('0x2c'));}catch(_0x21b4a4){logger[_0xa5c2('0x20')](_0x21b4a4);}return _0x4b5407['split']('.')[0x0];});}function base64Encode(_0x383314){var _0x781fc9=fs[_0xa5c2('0x2d')](_0x383314);return new Buffer(_0x781fc9)[_0xa5c2('0x2e')](_0xa5c2('0x2a'));}exports[_0xa5c2('0x2f')]=function(_0x5a0d2e,_0x20382b,_0x11b3f3,_0x258238,_0x17342f,_0x5dc33){var _0x450147,_0x34bad1;var _0x13b682=_0xa5c2('0x30');var _0x5be357='?key='+_0x5a0d2e;var _0x588900={};if(_0x20382b===_0xa5c2('0x31')){_0x588900[_0xa5c2('0x32')]={'ssml':_0x11b3f3};}else{_0x588900[_0xa5c2('0x32')]={'text':_0x11b3f3};};_0x588900[_0xa5c2('0x33')]={'languageCode':_0x258238,'ssmlGender':_0x17342f};_0x588900[_0xa5c2('0x34')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x213c01={'url':_0x13b682+'text:synthesize'+_0x5be357,'method':'POST','json':!![],'body':_0x588900};return rp(_0x213c01)[_0xa5c2('0x35')](function(_0x2a59d5){return new BPromise(function(_0xb09b00,_0x55034a){_0x450147=path[_0xa5c2('0x36')](__dirname,_0xa5c2('0x37'),rs[_0xa5c2('0x27')](0x4)+_0xa5c2('0x38'));var _0x22e734=Buffer['from'](_0x2a59d5[_0xa5c2('0x39')],_0xa5c2('0x2a'));return fs[_0xa5c2('0x3a')](_0x450147,_0x22e734,function(_0x1f9d79){_0x55034a(_0x1f9d79);},function(_0x454221){fs['chmodSync'](_0x450147,'777');_0xb09b00(_0x454221);});});})[_0xa5c2('0x35')](function(_0xdf0a3d){_0x34bad1=path['resolve'](__dirname,_0xa5c2('0x37'),rs[_0xa5c2('0x27')](0x4)+_0xa5c2('0x28'));return convertFile(_0x450147,_0x34bad1);})['then'](function(){try{fs[_0xa5c2('0x2b')](_0x450147);fs[_0xa5c2('0x3b')](_0x34bad1,'777');}catch(_0x3570ee){logger['error'](_0x3570ee);}logger[_0xa5c2('0x1d')](_0xa5c2('0x3c'),_0x34bad1[_0xa5c2('0x3d')]('.')[0x0]);return _0x34bad1['split']('.')[0x0];});};exports['googleTTS']=function(_0x1bb8c1,_0x336273){var _0x5ed322='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x525fe2,_0x5f0553;var _0xeb73d3;var _0x53ef46={'encoding':_0xa5c2('0x3e'),'method':_0xa5c2('0x3f'),'timeout':0x2710,'url':_0x5ed322,'headers':{'Content-Type':_0xa5c2('0x40')},'body':'f.req='+encodeURIComponent(JSON[_0xa5c2('0x41')]([[['jQ1olc',JSON[_0xa5c2('0x41')]([_0x1bb8c1,_0x336273||'en',![],_0xa5c2('0x42')]),null,_0xa5c2('0x43')]]]))};return rp(_0x53ef46)[_0xa5c2('0x35')](function(_0x157b44){try{_0xeb73d3=eval(_0x157b44[_0xa5c2('0x44')](0x5))[0x0][0x2];}catch(_0xe09970){throw new Error('parse\x20response\x20failed:\x0a'+_0x157b44[_0xa5c2('0x23')]);}if(!_0xeb73d3){if(_0x1bb8c1[_0xa5c2('0x45')]>0xc8){throw new Error(_0xa5c2('0x46'));}else{throw new Error(_0xa5c2('0x47')+_0x336273+_0xa5c2('0x48'));}}try{_0xeb73d3=eval(_0xeb73d3)[0x0];}catch(_0x2727ac){throw new Error(_0xa5c2('0x49')+res[_0xa5c2('0x23')]);}const _0x4dc366=_0xeb73d3;_0x525fe2=path['resolve'](__dirname,_0xa5c2('0x37'),rs[_0xa5c2('0x27')](0x4)+_0xa5c2('0x38'));fs['writeFileSync'](_0x525fe2,_0xeb73d3,{'encoding':_0xa5c2('0x2a')});_0x5f0553=path[_0xa5c2('0x36')](__dirname,_0xa5c2('0x37'),rs[_0xa5c2('0x27')](0x4)+_0xa5c2('0x28'));return convertFile(_0x525fe2,_0x5f0553);})[_0xa5c2('0x35')](function(){try{fs[_0xa5c2('0x2b')](_0x525fe2);fs['chmodSync'](_0x5f0553,_0xa5c2('0x2c'));}catch(_0x4cffa9){logger[_0xa5c2('0x20')](_0x4cffa9);}logger['info']('goggleTTS\x20path',_0x5f0553[_0xa5c2('0x3d')]('.')[0x0]);return _0x5f0553['split']('.')[0x0];});};exports[_0xa5c2('0x4a')]=function(_0xd5c750,_0x39a976,_0x3a3421){return google[_0xa5c2('0x4b')](_0xd5c750,_0x39a976,_0x3a3421)[_0xa5c2('0x35')](function(_0x1d58bc){logger[_0xa5c2('0x1d')](_0x1d58bc[_0xa5c2('0x4c')]);return rp(_0x1d58bc);})[_0xa5c2('0x35')](function(_0xe6e8e2){var _0x4ccb89='';var _0x4ee700=0x0;try{fs[_0xa5c2('0x2b')](_0xd5c750);}catch(_0x4d1793){logger[_0xa5c2('0x20')](_0x4d1793);}if(_0xe6e8e2&&_0xe6e8e2[_0xa5c2('0x4d')]){_0x4ccb89=_0xe6e8e2[_0xa5c2('0x4d')][_0xa5c2('0x4e')](function(_0x5276ba){return _0x5276ba&&_0x5276ba[_0xa5c2('0x4f')][0x0]&&_0x5276ba[_0xa5c2('0x4f')][0x0][_0xa5c2('0x50')]?_0x5276ba[_0xa5c2('0x4f')][0x0][_0xa5c2('0x50')]:'';})['join']('\x0a');_0x4ee700=_0xe6e8e2[_0xa5c2('0x4d')]['map'](function(_0x1907b4){return _0x1907b4&&_0x1907b4[_0xa5c2('0x4f')][0x0]&&_0x1907b4[_0xa5c2('0x4f')][0x0][_0xa5c2('0x51')]?_0x1907b4[_0xa5c2('0x4f')][0x0][_0xa5c2('0x51')]:0x0;})[_0xa5c2('0x52')]('\x0a');}logger['info'](_0xa5c2('0x53'),_0x4ccb89);logger[_0xa5c2('0x1d')](_0xa5c2('0x54'),_0x4ee700);return{'transcript':_0x4ccb89,'confidence':_0x4ee700};})['catch'](function(_0x22bc4d){logger[_0xa5c2('0x20')]('[%s]\x20%s:%s',_0x22bc4d[_0xa5c2('0x17')],_0x22bc4d[_0xa5c2('0x55')],_0x22bc4d[_0xa5c2('0x56')]);});};exports[_0xa5c2('0x57')]=function(_0xb3984a,_0x104908,_0xbd307a,_0x532c3f){var _0x2f7838=apiai(_0x104908,{'language':_0x532c3f||'en'});return _0x2f7838[_0xa5c2('0x58')](_0xbd307a,{'sessionId':md5(_0xb3984a)})[_0xa5c2('0x35')](function(_0x4aacf9){logger[_0xa5c2('0x1d')](JSON[_0xa5c2('0x41')](_0x4aacf9));return{'source':_0x4aacf9['result'][_0xa5c2('0x59')],'resolvedQuery':_0x4aacf9[_0xa5c2('0x5a')][_0xa5c2('0x5b')],'action':_0x4aacf9[_0xa5c2('0x5a')][_0xa5c2('0x5c')],'actionIncomplete':_0x4aacf9[_0xa5c2('0x5a')][_0xa5c2('0x5d')],'speech':_0x4aacf9[_0xa5c2('0x5a')][_0xa5c2('0x5e')][_0xa5c2('0x5f')],'score':_0x4aacf9[_0xa5c2('0x5a')][_0xa5c2('0x60')],'statusCode':_0x4aacf9[_0xa5c2('0x61')]['code'],'endConversation':_0x4aacf9[_0xa5c2('0x5a')][_0xa5c2('0x62')][_0xa5c2('0x63')]||![],'isFallbackIntent':_0x4aacf9[_0xa5c2('0x5a')]['metadata'][_0xa5c2('0x64')]};});};exports[_0xa5c2('0x65')]=function(_0x5802cf,_0x370e45,_0xb504f6,_0x325aa3,_0x5403be,_0x19e88b){var _0x1778a2=_0x325aa3[_0xa5c2('0x66')](/\\n/g,'\x0a');var _0x1589e5={'credentials':{'private_key':_0x1778a2,'client_email':_0xb504f6}};var _0x14fba0=new dialogflow[(_0xa5c2('0x67'))](_0x1589e5);var _0x456f40=_0x14fba0[_0xa5c2('0x68')](_0x370e45,md5(_0x5802cf));var _0x1ecd56={'session':_0x456f40,'queryInput':{'text':{'text':_0x5403be,'languageCode':_0x19e88b}}};return _0x14fba0[_0xa5c2('0x69')](_0x1ecd56)[_0xa5c2('0x35')](function(_0x483aa6){if(_0x483aa6&&_0x483aa6[_0xa5c2('0x45')]){logger[_0xa5c2('0x1d')](_0xa5c2('0x6a'),JSON[_0xa5c2('0x41')](_0x483aa6));var _0x24085d=_0x483aa6[0x0];if(_0x24085d){var _0x21403c={'action':_0x24085d['queryResult'][_0xa5c2('0x5c')],'allRequiredParamsPresent':_0x24085d['queryResult'][_0xa5c2('0x6b')],'endConversation':_0x24085d['queryResult'][_0xa5c2('0x6c')]&&_0x24085d[_0xa5c2('0x6d')][_0xa5c2('0x6c')][_0xa5c2('0x6e')]?_0x24085d[_0xa5c2('0x6d')][_0xa5c2('0x6c')][_0xa5c2('0x6e')]['end_conversation'][_0xa5c2('0x6f')]:![],'fulfillmentText':_0x24085d[_0xa5c2('0x6d')][_0xa5c2('0x70')],'intentName':_0x24085d[_0xa5c2('0x6d')][_0xa5c2('0x71')][_0xa5c2('0x55')],'intentDisplayName':_0x24085d[_0xa5c2('0x6d')][_0xa5c2('0x71')][_0xa5c2('0x72')],'isFallbackIntent':_0x24085d[_0xa5c2('0x6d')]['intent'][_0xa5c2('0x73')],'languageCode':_0x24085d['queryResult'][_0xa5c2('0x74')],'queryText':_0x24085d[_0xa5c2('0x6d')]['queryText'],'responseId':_0x24085d[_0xa5c2('0x75')],'score':_0x24085d[_0xa5c2('0x6d')][_0xa5c2('0x76')],'speech':_0x24085d[_0xa5c2('0x6d')][_0xa5c2('0x70')],'providerResponse':JSON[_0xa5c2('0x41')](_0x483aa6)};return _0x21403c;}}});};exports['tildeASR']=function(_0x25aa08,_0x2db238,_0x319688,_0x39cd15){return tilde[_0xa5c2('0x4b')](_0x25aa08,_0x2db238,_0x319688,_0x39cd15)[_0xa5c2('0x35')](function(_0x39dda6){try{fs[_0xa5c2('0x2b')](_0x25aa08);}catch(_0x250da5){logger[_0xa5c2('0x20')](_0x250da5);}logger[_0xa5c2('0x1d')](_0xa5c2('0x77'),_0x39dda6[_0xa5c2('0x50')]);logger[_0xa5c2('0x1d')](_0xa5c2('0x78'),_0x39dda6[_0xa5c2('0x51')]);return _0x39dda6;});};exports[_0xa5c2('0x79')]=function(_0x120a61,_0x317b69,_0x5cfcc8,_0x504866,_0xefa861,_0x4e8ef0){var _0x4af948=path[_0xa5c2('0x36')](__dirname,'tmp',rs[_0xa5c2('0x27')](0x4)+_0xa5c2('0x38'));var _0x346ccd;return aws[_0xa5c2('0x7a')](_0x120a61,_0x317b69,_0x5cfcc8,_0x504866,_0xefa861,_0x4e8ef0,_0x4af948)[_0xa5c2('0x35')](function(){_0x346ccd=path['resolve'](__dirname,_0xa5c2('0x37'),rs['generate'](0x4)+_0xa5c2('0x28'));return convertFile(_0x4af948,_0x346ccd);})['then'](function(){try{fs[_0xa5c2('0x2b')](_0x4af948);fs[_0xa5c2('0x3b')](_0x346ccd,_0xa5c2('0x2c'));}catch(_0x5eb910){logger[_0xa5c2('0x20')](_0x5eb910);}return _0x346ccd[_0xa5c2('0x3d')]('.')[0x0];});};exports[_0xa5c2('0x7b')]=function(_0x3fb95b,_0x451e2f,_0x618867,_0x4fa1b6,_0xa3d678,_0x111f15){return aws['lex'](_0x3fb95b,_0x451e2f,_0x618867,_0x4fa1b6,_0xa3d678,_0x111f15)[_0xa5c2('0x35')](function(_0x19e2b7){logger[_0xa5c2('0x1d')](JSON[_0xa5c2('0x41')](_0x19e2b7));return _0x19e2b7;});};exports[_0xa5c2('0x7c')]=function(_0x1c616d,_0x857d6a,_0x3624a7,_0x57c309){var _0x50962b=util['format'](_0xa5c2('0x7d'),ISPEECH_API,_0x1c616d,encodeURIComponent(_0x857d6a),_0x3624a7,_0x57c309);var _0x370a14=path[_0xa5c2('0x36')](__dirname,_0xa5c2('0x37'),rs[_0xa5c2('0x27')](0x4)+_0xa5c2('0x38'));var _0x352a0e;return downloadFile(_0x50962b,_0x370a14)['then'](function(){_0x352a0e=path['resolve'](__dirname,'tmp',rs[_0xa5c2('0x27')](0x4)+_0xa5c2('0x28'));return convertFile(_0x370a14,_0x352a0e);})[_0xa5c2('0x35')](function(){try{fs['unlink'](_0x370a14);fs['chmodSync'](_0x352a0e,'777');}catch(_0x4c5cda){logger['error'](_0x4c5cda);}return _0x352a0e['split']('.')[0x0];});};exports['ispeechASR']=function(_0x35f3de,_0x191404,_0x5b9f72,_0x45b0f2){var _0x4583ee=util[_0xa5c2('0x7e')](_0xa5c2('0x7f'),ISPEECH_API,_0x191404,_0x5b9f72,base64Encode(_0x35f3de),_0x45b0f2?util[_0xa5c2('0x7e')](_0xa5c2('0x80'),encodeURIComponent(_0x45b0f2)):_0xa5c2('0x81'));return uploadFile(_0x4583ee)[_0xa5c2('0x35')](function(_0x67373b){return querystring['parse'](_0x67373b);});};exports['sestekNDA']=function(_0x5d749d,_0x15f3a5){return sestek['nda'](_0x5d749d,_0x15f3a5)[_0xa5c2('0x35')](function(_0x26f0e0){logger[_0xa5c2('0x1d')](JSON[_0xa5c2('0x41')](_0x26f0e0));var _0x7e8586={'speech':_0x26f0e0[_0xa5c2('0x82')],'action':_0x26f0e0[_0xa5c2('0x83')]?_0x26f0e0[_0xa5c2('0x83')][_0xa5c2('0x84')]:undefined,'actiondata':_0x26f0e0[_0xa5c2('0x83')]?_0x26f0e0[_0xa5c2('0x83')][_0xa5c2('0x85')]:undefined};if(_0x26f0e0[_0xa5c2('0x83')]&&_0x26f0e0['channelData'][_0xa5c2('0x86')]){return base64Decode(_0x26f0e0['channelData'][_0xa5c2('0x86')]['Data'],path[_0xa5c2('0x36')](__dirname,'tmp',rs[_0xa5c2('0x27')](0x4)+_0xa5c2('0x28')))['then'](function(_0x46b7af){_0x7e8586['audiofile']=_0x46b7af;return _0x7e8586;});}return _0x7e8586;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x3714=['alternatives','join','map','confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','name','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','transcript','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','format','model=%s','sestekNDA','nda','channelData','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','dialogflow','http','https','md5','querystring','sox','google-tts-api','url','parse','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','error','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','pipe','path','request\x20to\x20','data','transcode','wav','end','finish\x20to\x20convert','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','toString','https://texttospeech.googleapis.com/v1/','?key=','input','audioConfig','MP3','POST','resolve','.mp3','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr'];(function(_0x512ea8,_0x309b1a){var _0x5d2659=function(_0x2ba87f){while(--_0x2ba87f){_0x512ea8['push'](_0x512ea8['shift']());}};_0x5d2659(++_0x309b1a);}(_0x3714,0xc1));var _0x4371=function(_0x3b5662,_0x39145b){_0x3b5662=_0x3b5662-0x0;var _0x1d4da=_0x3714[_0x3b5662];return _0x1d4da;};'use strict';var apiai=require(_0x4371('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x4371('0x1'));var fs=require('fs');var http=require(_0x4371('0x2'));var https=require(_0x4371('0x3'));var md5=require(_0x4371('0x4'));var path=require('path');var querystring=require(_0x4371('0x5'));var rp=require('request-promise');var rs=require('randomstring');var sox=require(_0x4371('0x6'));var tts=require(_0x4371('0x7'));var urlParse=require(_0x4371('0x8'))[_0x4371('0x9')];var util=require('util');var aws=require(_0x4371('0xa'));var google=require(_0x4371('0xb'));var sestek=require(_0x4371('0xc'));var tilde=require(_0x4371('0xd'));var logger=require(_0x4371('0xe'))(_0x4371('0xf'));var ISPEECH_API=_0x4371('0x10');function downloadFile(_0x42ce59,_0x16a4af){return new BPromise(function(_0x19d86c,_0x403eec){var _0x139dc0=urlParse(_0x42ce59);var _0x3453e2=_0x139dc0[_0x4371('0x11')]===_0x4371('0x12')?https:http;var _0x4f704f={'host':_0x139dc0[_0x4371('0x13')],'path':_0x139dc0['path'],'headers':{'user-agent':_0x4371('0x14')}};_0x3453e2[_0x4371('0x15')](_0x4f704f,function(_0x231bf5){if(_0x231bf5['statusCode']!==0xc8){logger[_0x4371('0x16')]('request\x20to\x20'+_0x42ce59+_0x4371('0x17')+_0x231bf5[_0x4371('0x18')]+'\x20('+_0x231bf5[_0x4371('0x19')]+')');_0x403eec(new Error('request\x20to\x20'+_0x42ce59+'\x20failed,\x20status\x20code\x20=\x20'+_0x231bf5[_0x4371('0x18')]+'\x20('+_0x231bf5['statusMessage']+')'));return;}var _0x2c4d50=fs[_0x4371('0x1a')](_0x16a4af);_0x2c4d50['on'](_0x4371('0x1b'),function(){logger[_0x4371('0x1c')](_0x4371('0x1d'));_0x2c4d50[_0x4371('0x1e')](_0x19d86c);});_0x2c4d50['on']('error',function(_0x3112ab){fs[_0x4371('0x1f')](_0x16a4af);logger[_0x4371('0x16')]('download\x20error',_0x3112ab);_0x403eec(_0x3112ab);});_0x231bf5[_0x4371('0x20')](_0x2c4d50);})['on'](_0x4371('0x16'),function(_0x286b96){logger['error'](_0x286b96);_0x403eec(_0x286b96);})['end']();});}function uploadFile(_0x146f06){return new BPromise(function(_0xada9e1,_0x1133fb){var _0x587835=urlParse(_0x146f06);var _0x296a3b=_0x587835[_0x4371('0x11')]==='https:'?https:http;var _0x1c3485={'host':_0x587835['host'],'path':_0x587835[_0x4371('0x21')],'headers':{'user-agent':_0x4371('0x14')}};_0x296a3b[_0x4371('0x15')](_0x1c3485,function(_0x35b656){if(_0x35b656[_0x4371('0x18')]!==0xc8){_0x1133fb(new Error(_0x4371('0x22')+_0x146f06+_0x4371('0x17')+_0x35b656[_0x4371('0x18')]+'\x20('+_0x35b656[_0x4371('0x19')]+')'));return;}var _0x55eec2='';_0x35b656['on'](_0x4371('0x23'),function(_0x2ad315){_0x55eec2+=_0x2ad315;});_0x35b656['on']('end',function(){_0xada9e1(_0x55eec2);});})['on']('error',function(_0x56c52e){_0x1133fb(_0x56c52e);})['end']();});}function convertFile(_0x2bd0b9,_0x489006){return new BPromise(function(_0x5e48e5,_0x8c2b00){var _0x5d6fda=sox[_0x4371('0x24')](_0x2bd0b9,_0x489006,{'sampleRate':0x1f40,'format':_0x4371('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5d6fda['on'](_0x4371('0x16'),function(_0x237d57){logger[_0x4371('0x16')]('error\x20convert',_0x237d57);_0x8c2b00(_0x237d57);});_0x5d6fda['on'](_0x4371('0x26'),function(){logger[_0x4371('0x1c')](_0x4371('0x27'));_0x5e48e5();});_0x5d6fda['start']();});}function base64Decode(_0x3a5249,_0xfad4b2){var _0x353651=path['resolve'](__dirname,_0x4371('0x28'),rs[_0x4371('0x29')](0x4)+_0x4371('0x2a'));fs[_0x4371('0x2b')](_0x353651,_0x3a5249,_0x4371('0x2c'));return convertFile(_0x353651,_0xfad4b2)[_0x4371('0x2d')](function(){try{fs[_0x4371('0x1f')](_0x353651);fs[_0x4371('0x2e')](_0xfad4b2,_0x4371('0x2f'));}catch(_0x4b499f){logger[_0x4371('0x16')](_0x4b499f);}return _0xfad4b2[_0x4371('0x30')]('.')[0x0];});}function base64Encode(_0x2e3c63){var _0x1f6a1c=fs['readFileSync'](_0x2e3c63);return new Buffer(_0x1f6a1c)[_0x4371('0x31')](_0x4371('0x2c'));}exports['googleCloudTTS']=function(_0x49e2fc,_0x52d4b0,_0xd5441c,_0x14a901,_0x29b79f,_0x2196a6){var _0x123f9a,_0x4df34b;var _0x528146=_0x4371('0x32');var _0xd7248a=_0x4371('0x33')+_0x49e2fc;var _0x2561b2={};if(_0x52d4b0==='ssml'){_0x2561b2[_0x4371('0x34')]={'ssml':_0xd5441c};}else{_0x2561b2['input']={'text':_0xd5441c};};_0x2561b2['voice']={'languageCode':_0x14a901,'ssmlGender':_0x29b79f};_0x2561b2[_0x4371('0x35')]={'audioEncoding':_0x4371('0x36'),'sampleRateHertz':0x1f40};var _0x3f5ca5={'url':_0x528146+'text:synthesize'+_0xd7248a,'method':_0x4371('0x37'),'json':!![],'body':_0x2561b2};return rp(_0x3f5ca5)[_0x4371('0x2d')](function(_0x160d3e){return new BPromise(function(_0x5c1749,_0x347a18){_0x123f9a=path[_0x4371('0x38')](__dirname,_0x4371('0x28'),rs[_0x4371('0x29')](0x4)+_0x4371('0x39'));var _0x2e0d48=Buffer['from'](_0x160d3e[_0x4371('0x3a')],_0x4371('0x2c'));return fs[_0x4371('0x3b')](_0x123f9a,_0x2e0d48,function(_0x2e4ef3){_0x347a18(_0x2e4ef3);},function(_0x1c12c4){fs[_0x4371('0x2e')](_0x123f9a,_0x4371('0x2f'));_0x5c1749(_0x1c12c4);});});})[_0x4371('0x2d')](function(_0x3c2645){_0x4df34b=path[_0x4371('0x38')](__dirname,_0x4371('0x28'),rs[_0x4371('0x29')](0x4)+_0x4371('0x2a'));return convertFile(_0x123f9a,_0x4df34b);})[_0x4371('0x2d')](function(){try{fs[_0x4371('0x1f')](_0x123f9a);fs[_0x4371('0x2e')](_0x4df34b,_0x4371('0x2f'));}catch(_0x84e01b){logger[_0x4371('0x16')](_0x84e01b);}logger[_0x4371('0x1c')](_0x4371('0x3c'),_0x4df34b['split']('.')[0x0]);return _0x4df34b[_0x4371('0x30')]('.')[0x0];});};exports[_0x4371('0x3d')]=function(_0x1e594a,_0xff9ccd){var _0x1f905c=_0x4371('0x3e');var _0x54b727,_0x3cda4d;var _0x45beff;var _0x2567bd={'encoding':_0x4371('0x3f'),'method':_0x4371('0x37'),'timeout':0x2710,'url':_0x1f905c,'headers':{'Content-Type':_0x4371('0x40')},'body':_0x4371('0x41')+encodeURIComponent(JSON[_0x4371('0x42')]([[['jQ1olc',JSON[_0x4371('0x42')]([_0x1e594a,_0xff9ccd||'en',![],_0x4371('0x43')]),null,_0x4371('0x44')]]]))};return rp(_0x2567bd)['then'](function(_0x1967b2){try{_0x45beff=eval(_0x1967b2[_0x4371('0x45')](0x5))[0x0][0x2];}catch(_0x2b2a5b){throw new Error(_0x4371('0x46')+_0x1967b2[_0x4371('0x23')]);}if(!_0x45beff){if(_0x1e594a[_0x4371('0x47')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x4371('0x48')+_0xff9ccd+_0x4371('0x49'));}}try{_0x45beff=eval(_0x45beff)[0x0];}catch(_0x218f8e){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x4371('0x23')]);}const _0x7ad1c3=_0x45beff;_0x54b727=path['resolve'](__dirname,_0x4371('0x28'),rs[_0x4371('0x29')](0x4)+_0x4371('0x39'));fs['writeFileSync'](_0x54b727,_0x45beff,{'encoding':'base64'});_0x3cda4d=path['resolve'](__dirname,'tmp',rs[_0x4371('0x29')](0x4)+_0x4371('0x2a'));return convertFile(_0x54b727,_0x3cda4d);})['then'](function(){try{fs[_0x4371('0x1f')](_0x54b727);fs[_0x4371('0x2e')](_0x3cda4d,_0x4371('0x2f'));}catch(_0x18b346){logger[_0x4371('0x16')](_0x18b346);}logger[_0x4371('0x1c')](_0x4371('0x4a'),_0x3cda4d['split']('.')[0x0]);return _0x3cda4d[_0x4371('0x30')]('.')[0x0];});};exports[_0x4371('0x4b')]=function(_0x4c8b2c,_0x18359f,_0x18ad89){return google[_0x4371('0x4c')](_0x4c8b2c,_0x18359f,_0x18ad89)[_0x4371('0x2d')](function(_0x416283){logger[_0x4371('0x1c')](_0x416283['uri']);return rp(_0x416283);})['then'](function(_0x4003b8){var _0x3db745='';var _0x22fa07=0x0;try{fs[_0x4371('0x1f')](_0x4c8b2c);}catch(_0x6984b2){logger[_0x4371('0x16')](_0x6984b2);}if(_0x4003b8&&_0x4003b8['results']){_0x3db745=_0x4003b8['results']['map'](function(_0x3cc314){return _0x3cc314&&_0x3cc314[_0x4371('0x4d')][0x0]&&_0x3cc314['alternatives'][0x0]['transcript']?_0x3cc314[_0x4371('0x4d')][0x0]['transcript']:'';})[_0x4371('0x4e')]('\x0a');_0x22fa07=_0x4003b8['results'][_0x4371('0x4f')](function(_0x37d5fe){return _0x37d5fe&&_0x37d5fe[_0x4371('0x4d')][0x0]&&_0x37d5fe[_0x4371('0x4d')][0x0][_0x4371('0x50')]?_0x37d5fe[_0x4371('0x4d')][0x0][_0x4371('0x50')]:0x0;})[_0x4371('0x4e')]('\x0a');}logger['info']('googleASR\x20transcription',_0x3db745);logger[_0x4371('0x1c')]('googleASR\x20confidence',_0x22fa07);return{'transcript':_0x3db745,'confidence':_0x22fa07};})[_0x4371('0x51')](function(_0x430d18){logger['error'](_0x4371('0x52'),_0x430d18[_0x4371('0x18')],_0x430d18['name'],_0x430d18[_0x4371('0x53')]);});};exports[_0x4371('0x54')]=function(_0x30759b,_0x2df6de,_0x19d9b1,_0x13335f){var _0x11b61c=apiai(_0x2df6de,{'language':_0x13335f||'en'});return _0x11b61c[_0x4371('0x55')](_0x19d9b1,{'sessionId':md5(_0x30759b)})[_0x4371('0x2d')](function(_0x1f44b5){logger[_0x4371('0x1c')](JSON['stringify'](_0x1f44b5));return{'source':_0x1f44b5['result'][_0x4371('0x56')],'resolvedQuery':_0x1f44b5[_0x4371('0x57')][_0x4371('0x58')],'action':_0x1f44b5[_0x4371('0x57')][_0x4371('0x59')],'actionIncomplete':_0x1f44b5['result'][_0x4371('0x5a')],'speech':_0x1f44b5['result'][_0x4371('0x5b')][_0x4371('0x5c')],'score':_0x1f44b5[_0x4371('0x57')][_0x4371('0x5d')],'statusCode':_0x1f44b5[_0x4371('0x5e')][_0x4371('0x5f')],'endConversation':_0x1f44b5[_0x4371('0x57')][_0x4371('0x60')][_0x4371('0x61')]||![],'isFallbackIntent':_0x1f44b5['result'][_0x4371('0x60')][_0x4371('0x62')]};});};exports['googleDialogflowV2']=function(_0x10a87e,_0x15c271,_0x185b92,_0x2ebc64,_0x392698,_0x24c3e8){var _0x1a7deb=_0x2ebc64[_0x4371('0x63')](/\\n/g,'\x0a');var _0x4ae2a2={'credentials':{'private_key':_0x1a7deb,'client_email':_0x185b92}};var _0x1eda24=new dialogflow[(_0x4371('0x64'))](_0x4ae2a2);var _0x20c877=_0x1eda24[_0x4371('0x65')](_0x15c271,md5(_0x10a87e));var _0x37f7e1={'session':_0x20c877,'queryInput':{'text':{'text':_0x392698,'languageCode':_0x24c3e8}}};return _0x1eda24[_0x4371('0x66')](_0x37f7e1)[_0x4371('0x2d')](function(_0x5d8d7a){if(_0x5d8d7a&&_0x5d8d7a[_0x4371('0x47')]){logger['info'](_0x4371('0x67'),JSON['stringify'](_0x5d8d7a));var _0x1234cc=_0x5d8d7a[0x0];if(_0x1234cc){var _0x3ad14e={'action':_0x1234cc[_0x4371('0x68')][_0x4371('0x59')],'allRequiredParamsPresent':_0x1234cc[_0x4371('0x68')]['allRequiredParamsPresent'],'endConversation':_0x1234cc[_0x4371('0x68')][_0x4371('0x69')]&&_0x1234cc[_0x4371('0x68')][_0x4371('0x69')][_0x4371('0x6a')]?_0x1234cc[_0x4371('0x68')][_0x4371('0x69')][_0x4371('0x6a')][_0x4371('0x6b')]['boolValue']:![],'fulfillmentText':_0x1234cc['queryResult'][_0x4371('0x6c')],'intentName':_0x1234cc['queryResult'][_0x4371('0x6d')][_0x4371('0x6e')],'intentDisplayName':_0x1234cc['queryResult'][_0x4371('0x6d')][_0x4371('0x6f')],'isFallbackIntent':_0x1234cc['queryResult'][_0x4371('0x6d')][_0x4371('0x70')],'languageCode':_0x1234cc[_0x4371('0x68')][_0x4371('0x71')],'queryText':_0x1234cc[_0x4371('0x68')][_0x4371('0x72')],'responseId':_0x1234cc[_0x4371('0x73')],'score':_0x1234cc['queryResult'][_0x4371('0x74')],'speech':_0x1234cc['queryResult']['fulfillmentText'],'providerResponse':JSON[_0x4371('0x42')](_0x5d8d7a)};return _0x3ad14e;}}});};exports[_0x4371('0x75')]=function(_0x5554cc,_0x3f5e3b,_0x2cbea6,_0x52c374){return tilde[_0x4371('0x4c')](_0x5554cc,_0x3f5e3b,_0x2cbea6,_0x52c374)[_0x4371('0x2d')](function(_0x39b146){try{fs[_0x4371('0x1f')](_0x5554cc);}catch(_0x5570fc){logger['error'](_0x5570fc);}logger['info'](_0x4371('0x76'),_0x39b146[_0x4371('0x77')]);logger['info'](_0x4371('0x78'),_0x39b146[_0x4371('0x50')]);return _0x39b146;});};exports[_0x4371('0x79')]=function(_0x21d980,_0x15c463,_0x24bab5,_0x72e04d,_0x39c8eb,_0xd81af5){var _0x26688a=path[_0x4371('0x38')](__dirname,'tmp',rs['generate'](0x4)+_0x4371('0x39'));var _0x15bd54;return aws[_0x4371('0x7a')](_0x21d980,_0x15c463,_0x24bab5,_0x72e04d,_0x39c8eb,_0xd81af5,_0x26688a)['then'](function(){_0x15bd54=path[_0x4371('0x38')](__dirname,_0x4371('0x28'),rs['generate'](0x4)+_0x4371('0x2a'));return convertFile(_0x26688a,_0x15bd54);})[_0x4371('0x2d')](function(){try{fs['unlink'](_0x26688a);fs[_0x4371('0x2e')](_0x15bd54,'777');}catch(_0x339ea4){logger[_0x4371('0x16')](_0x339ea4);}return _0x15bd54[_0x4371('0x30')]('.')[0x0];});};exports['awsLex']=function(_0x532e51,_0x462795,_0x4b1103,_0x5b864d,_0x480b1e,_0x2fb6a3){return aws[_0x4371('0x7b')](_0x532e51,_0x462795,_0x4b1103,_0x5b864d,_0x480b1e,_0x2fb6a3)[_0x4371('0x2d')](function(_0x12004e){logger[_0x4371('0x1c')](JSON['stringify'](_0x12004e));return _0x12004e;});};exports[_0x4371('0x7c')]=function(_0x3fbbed,_0x39585c,_0x3d1727,_0x35e96f){var _0x231d05=util['format'](_0x4371('0x7d'),ISPEECH_API,_0x3fbbed,encodeURIComponent(_0x39585c),_0x3d1727,_0x35e96f);var _0x4ca12e=path['resolve'](__dirname,_0x4371('0x28'),rs[_0x4371('0x29')](0x4)+_0x4371('0x39'));var _0x1856dc;return downloadFile(_0x231d05,_0x4ca12e)[_0x4371('0x2d')](function(){_0x1856dc=path[_0x4371('0x38')](__dirname,_0x4371('0x28'),rs['generate'](0x4)+_0x4371('0x2a'));return convertFile(_0x4ca12e,_0x1856dc);})[_0x4371('0x2d')](function(){try{fs['unlink'](_0x4ca12e);fs[_0x4371('0x2e')](_0x1856dc,_0x4371('0x2f'));}catch(_0x3a24ec){logger[_0x4371('0x16')](_0x3a24ec);}return _0x1856dc[_0x4371('0x30')]('.')[0x0];});};exports['ispeechASR']=function(_0xbef4ea,_0x3491a0,_0x492ac5,_0x2e750c){var _0x4ea717=util[_0x4371('0x7e')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x3491a0,_0x492ac5,base64Encode(_0xbef4ea),_0x2e750c?util['format'](_0x4371('0x7f'),encodeURIComponent(_0x2e750c)):'freeform=3');return uploadFile(_0x4ea717)[_0x4371('0x2d')](function(_0x109022){return querystring['parse'](_0x109022);});};exports[_0x4371('0x80')]=function(_0x3b42bb,_0x4ef35f){return sestek[_0x4371('0x81')](_0x3b42bb,_0x4ef35f)['then'](function(_0x31ef36){logger[_0x4371('0x1c')](JSON[_0x4371('0x42')](_0x31ef36));var _0xb7ca0d={'speech':_0x31ef36['text'],'action':_0x31ef36[_0x4371('0x82')]?_0x31ef36[_0x4371('0x82')]['CustomAction']:undefined,'actiondata':_0x31ef36[_0x4371('0x82')]?_0x31ef36[_0x4371('0x82')][_0x4371('0x83')]:undefined};if(_0x31ef36[_0x4371('0x82')]&&_0x31ef36[_0x4371('0x82')][_0x4371('0x84')]){return base64Decode(_0x31ef36['channelData'][_0x4371('0x84')]['Data'],path[_0x4371('0x38')](__dirname,_0x4371('0x28'),rs[_0x4371('0x29')](0x4)+_0x4371('0x2a')))[_0x4371('0x2d')](function(_0xc6540e){_0xb7ca0d[_0x4371('0x85')]=_0xc6540e;return _0xb7ca0d;});}return _0xb7ca0d;});};exports[_0x4371('0x86')]=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 9e5767b..4a90cbf 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 _0x4213=['exports'];(function(_0x4bc079,_0x57203e){var _0xaa53=function(_0x1293aa){while(--_0x1293aa){_0x4bc079['push'](_0x4bc079['shift']());}};_0xaa53(++_0x57203e);}(_0x4213,0x198));var _0x3421=function(_0x51cc20,_0x57ef23){_0x51cc20=_0x51cc20-0x0;var _0x361e18=_0x4213[_0x51cc20];return _0x361e18;};var nda=require('./nda');module[_0x3421('0x0')]={'nda':nda}; \ No newline at end of file +var _0x72f7=['./nda'];(function(_0x3acc81,_0xf7c3cc){var _0x3308e6=function(_0x1063b1){while(--_0x1063b1){_0x3acc81['push'](_0x3acc81['shift']());}};_0x3308e6(++_0xf7c3cc);}(_0x72f7,0x93));var _0x772f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72f7[_0x3dd15e];return _0x231fd0;};var nda=require(_0x772f('0x0'));module['exports']={'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 28fdb54..23a04bd 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 _0x2a41=['CustomAction','custom_action','CustomActionData','custom_action_data','info','stringify','request-promise','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ndagenerate_audio','AudioOutputSettings'];(function(_0xb85f1,_0x2dda75){var _0x3d980a=function(_0x4b206f){while(--_0x4b206f){_0xb85f1['push'](_0xb85f1['shift']());}};_0x3d980a(++_0x2dda75);}(_0x2a41,0x126));var _0x12a4=function(_0x3f940e,_0x140c3b){_0x3f940e=_0x3f940e-0x0;var _0x424b2e=_0x2a41[_0x3f940e];return _0x424b2e;};'use strict';var rp=require(_0x12a4('0x0'));var url=require('url');var logger=require(_0x12a4('0x1'))(_0x12a4('0x2'));module[_0x12a4('0x3')]=function(_0x321075,_0x1b4dd3){var _0x23d966={'method':_0x12a4('0x4'),'uri':url[_0x12a4('0x5')](_0x1b4dd3[_0x12a4('0x6')],'/token'),'form':{'grant_type':_0x12a4('0x7'),'username':_0x1b4dd3[_0x12a4('0x8')],'password':_0x1b4dd3['password']},'json':!![]};return rp(_0x23d966)['then'](function(_0x2042cc){var _0x5ae867={'method':_0x12a4('0x4'),'uri':url[_0x12a4('0x5')](_0x1b4dd3[_0x12a4('0x9')],_0x12a4('0xa')),'body':{'type':_0x1b4dd3[_0x12a4('0xb')]||'message','channelId':_0x12a4('0xc'),'conversation':{'id':_0x321075[_0x12a4('0xd')]},'from':{'id':_0x321075[_0x12a4('0xe')],'name':_0x321075[_0x12a4('0xf')]},'recipient':{'id':_0x321075[_0x12a4('0x10')],'name':_0x321075[_0x12a4('0x11')]},'text':_0x1b4dd3[_0x12a4('0x12')],'channelData':{}},'headers':{'Authorization':_0x12a4('0x13')+_0x2042cc[_0x12a4('0x14')]},'json':!![]};if(_0x1b4dd3[_0x12a4('0x15')]){_0x5ae867[_0x12a4('0x16')][_0x12a4('0x17')]['ProjectName']=_0x1b4dd3[_0x12a4('0x15')];}if(_0x1b4dd3[_0x12a4('0x18')]=='1'){_0x5ae867[_0x12a4('0x16')][_0x12a4('0x17')][_0x12a4('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x1b4dd3['custom_action']){_0x5ae867[_0x12a4('0x16')][_0x12a4('0x17')][_0x12a4('0x1a')]=_0x1b4dd3[_0x12a4('0x1b')];if(_0x1b4dd3['custom_action_data']){_0x5ae867[_0x12a4('0x16')][_0x12a4('0x17')][_0x12a4('0x1c')]=_0x1b4dd3[_0x12a4('0x1d')];}}logger[_0x12a4('0x1e')](JSON[_0x12a4('0x1f')](_0x5ae867));return rp(_0x5ae867);});}; \ No newline at end of file +var _0xc36d=['custom_action','CustomAction','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','ndauth_url','/token','password','username','resolve','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','dnid','extension','access_token','project','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav'];(function(_0x389859,_0x156658){var _0x520d21=function(_0x4ac6a6){while(--_0x4ac6a6){_0x389859['push'](_0x389859['shift']());}};_0x520d21(++_0x156658);}(_0xc36d,0x7d));var _0xdc36=function(_0x25f3e3,_0x207891){_0x25f3e3=_0x25f3e3-0x0;var _0xa89b6d=_0xc36d[_0x25f3e3];return _0xa89b6d;};'use strict';var rp=require(_0xdc36('0x0'));var url=require(_0xdc36('0x1'));var logger=require(_0xdc36('0x2'))(_0xdc36('0x3'));module[_0xdc36('0x4')]=function(_0x2d5df5,_0x4c42dd){var _0x42522b={'method':_0xdc36('0x5'),'uri':url['resolve'](_0x4c42dd[_0xdc36('0x6')],_0xdc36('0x7')),'form':{'grant_type':_0xdc36('0x8'),'username':_0x4c42dd[_0xdc36('0x9')],'password':_0x4c42dd[_0xdc36('0x8')]},'json':!![]};return rp(_0x42522b)['then'](function(_0x20ba02){var _0x456897={'method':_0xdc36('0x5'),'uri':url[_0xdc36('0xa')](_0x4c42dd['ndassistant_url'],_0xdc36('0xb')),'body':{'type':_0x4c42dd[_0xdc36('0xc')]||'message','channelId':_0xdc36('0xd'),'conversation':{'id':_0x2d5df5[_0xdc36('0xe')]},'from':{'id':_0x2d5df5[_0xdc36('0xf')],'name':_0x2d5df5['calleridname']},'recipient':{'id':_0x2d5df5[_0xdc36('0x10')],'name':_0x2d5df5[_0xdc36('0x11')]},'text':_0x4c42dd['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x20ba02[_0xdc36('0x12')]},'json':!![]};if(_0x4c42dd[_0xdc36('0x13')]){_0x456897[_0xdc36('0x14')][_0xdc36('0x15')]['ProjectName']=_0x4c42dd[_0xdc36('0x13')];}if(_0x4c42dd[_0xdc36('0x16')]=='1'){_0x456897[_0xdc36('0x14')][_0xdc36('0x15')][_0xdc36('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xdc36('0x18')};}if(_0x4c42dd[_0xdc36('0x19')]){_0x456897[_0xdc36('0x14')]['channelData'][_0xdc36('0x1a')]=_0x4c42dd['custom_action'];if(_0x4c42dd['custom_action_data']){_0x456897['body'][_0xdc36('0x15')][_0xdc36('0x1b')]=_0x4c42dd['custom_action_data'];}}logger[_0xdc36('0x1c')](JSON[_0xdc36('0x1d')](_0x456897));return rp(_0x456897);});}; \ 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 42d89db..0032d25 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 _0x2652=['./lib/api'];(function(_0x1a682e,_0x1500c3){var _0x86d253=function(_0xe004dd){while(--_0xe004dd){_0x1a682e['push'](_0x1a682e['shift']());}};_0x86d253(++_0x1500c3);}(_0x2652,0xb2));var _0x2265=function(_0x54039f,_0x122e28){_0x54039f=_0x54039f-0x0;var _0x38bfd2=_0x2652[_0x54039f];return _0x38bfd2;};'use strict';var asr=require(_0x2265('0x0'));module['exports']=function(_0x28f036,_0x2e5804,_0x331178,_0x1733a0){return asr(_0x28f036,_0x2e5804,_0x331178,_0x1733a0);}; \ No newline at end of file +var _0x4c37=['./lib/api','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4c37,0x19a));var _0x74c3=function(_0x14c2c2,_0x5aaba4){_0x14c2c2=_0x14c2c2-0x0;var _0x3f88a5=_0x4c37[_0x14c2c2];return _0x3f88a5;};'use strict';var asr=require(_0x74c3('0x0'));module[_0x74c3('0x1')]=function(_0x45bb66,_0x174b03,_0xbfbb6a,_0x9433e1){return asr(_0x45bb66,_0x174b03,_0xbfbb6a,_0x9433e1);}; \ 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 a017ac0..0e84d66 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 _0xda4d=['open','message','bluebird','lodash','crypto','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','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil'];(function(_0x19ccc7,_0x1479be){var _0x5c670f=function(_0xd51c7d){while(--_0xd51c7d){_0x19ccc7['push'](_0x19ccc7['shift']());}};_0x5c670f(++_0x1479be);}(_0xda4d,0x12a));var _0xdda4=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xda4d[_0x1ac595];return _0x455fff;};'use strict';var BPromise=require(_0xdda4('0x0'));var _=require(_0xdda4('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xdda4('0x2'));var logger=require('../../../../../../config/logger')('agi');module['exports']=function(_0x1dcd3c,_0x5a7e7d,_0x30a918,_0x350f70){return new BPromise(function(_0x2e8967,_0x3b0485){logger[_0xdda4('0x3')](_0xdda4('0x4'),_0x350f70||_0xdda4('0x5'));var _0x454d1e=new WebSocket(_0x350f70||_0xdda4('0x5'),{'perMessageDeflate':![]});var _0x18e02f='';var _0x1eb45d='0';var _0x139def='1';var _0x5affeb=_0xdda4('0x6');function _0x3c8b75(_0xf1371d){var _0x5c0d52=crypto['createHash']('sha1');_0x5c0d52[_0xdda4('0x7')](_0xf1371d);return _0x5c0d52[_0xdda4('0x8')](_0xdda4('0x9'));}function _0x14097d(){try{logger[_0xdda4('0x3')](_0xdda4('0xa'));var _0x76146e=moment()[_0xdda4('0xb')]();var _0x5dbfd6=_0x3c8b75(_0x76146e+_0x5a7e7d+_0x30a918);_0x454d1e[_0xdda4('0xc')](JSON[_0xdda4('0xd')]({'appID':_0x5a7e7d,'timestamp':_0x76146e,'appKey':_0x5dbfd6}));var _0x478a6c=fs[_0xdda4('0xe')](_0x1dcd3c);_0x478a6c['on'](_0xdda4('0xf'),function(_0x527d84){_0x454d1e[_0xdda4('0xc')](_0x527d84);});_0x478a6c['on'](_0xdda4('0x10'),function(){_0x454d1e[_0xdda4('0xc')](_0xdda4('0x11'));});}catch(_0x30b118){logger[_0xdda4('0x12')](_0xdda4('0x13'),JSON['stringify'](_0x30b118));_0x454d1e[_0xdda4('0x14')]();}}function _0x50a299(_0x1734b3){try{if(_0x1734b3){var _0x128111=JSON['parse'](_0x1734b3);switch(_0x128111[_0xdda4('0x15')]){case 0x0:if(_0x128111[_0xdda4('0x16')]){if(_0x128111[_0xdda4('0x16')][_0xdda4('0x17')]){logger[_0xdda4('0x3')]('Tilde\x20ASR\x20hypoteses',JSON[_0xdda4('0xd')](_0x128111[_0xdda4('0x16')][_0xdda4('0x18')]));_0x18e02f=_0x128111['result'][_0xdda4('0x18')][0x0][_0xdda4('0x19')];_0x1eb45d=_0x128111[_0xdda4('0x16')][_0xdda4('0x18')][0x0]['likelihood'];_0x139def='0';_0x5affeb=_0xdda4('0x1a');_0x454d1e[_0xdda4('0x14')]();}}break;case 0x1:logger[_0xdda4('0x3')](_0xdda4('0x6'));_0x139def='1';_0x5affeb=_0xdda4('0x6');break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x139def='2';_0x5affeb=_0xdda4('0x1b');break;case 0x9:logger[_0xdda4('0x3')](_0xdda4('0x1c'));_0x139def='9';_0x5affeb=_0xdda4('0x1c');break;case 0xa:logger[_0xdda4('0x3')]('Authentication\x20failed.');_0x139def='10';_0x5affeb=_0xdda4('0x1d');break;case 0xb:logger[_0xdda4('0x3')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x139def='11';_0x5affeb=_0xdda4('0x1e');}}}catch(_0x3064ab){logger[_0xdda4('0x12')](_0xdda4('0x1f'),JSON[_0xdda4('0xd')](_0x3064ab));_0x454d1e['terminate']();}}function _0x32a795(){logger[_0xdda4('0x3')](_0xdda4('0x20'));_0x2e8967({'transcript':_0x18e02f,'confidence':_0x1eb45d,'status':_0x139def,'status_message':_0x5affeb});}function _0x3e839a(_0x1df80f){logger[_0xdda4('0x12')](_0xdda4('0x21'));if(!_[_0xdda4('0x22')](_0x1df80f)){logger[_0xdda4('0x12')](_['isObject'](_0x1df80f)?JSON[_0xdda4('0xd')](_0x1df80f):_0x1df80f);}}_0x454d1e['on'](_0xdda4('0x23'),_0x14097d);_0x454d1e['on'](_0xdda4('0x24'),_0x50a299);_0x454d1e['on'](_0xdda4('0x10'),_0x32a795);_0x454d1e['on'](_0xdda4('0x12'),_0x3e839a);});}; \ No newline at end of file +var _0xa70f=['EOS','error','Tilde\x20ASR\x20send\x20error','parse','status','final','Tilde\x20ASR\x20hypoteses','hypotheses','result','transcript','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','unix','stringify','createReadStream','send','close'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa70f,0xba));var _0xfa70=function(_0x705c3c,_0x1c44c8){_0x705c3c=_0x705c3c-0x0;var _0x5a7578=_0xa70f[_0x705c3c];return _0x5a7578;};'use strict';var BPromise=require(_0xfa70('0x0'));var _=require(_0xfa70('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xfa70('0x2'));var crypto=require(_0xfa70('0x3'));var logger=require('../../../../../../config/logger')(_0xfa70('0x4'));module['exports']=function(_0x1a136f,_0x46319d,_0x322937,_0x5da584){return new BPromise(function(_0x516f39,_0x8cde41){logger[_0xfa70('0x5')](_0xfa70('0x6'),_0x5da584||_0xfa70('0x7'));var _0x39f39e=new WebSocket(_0x5da584||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x2c857a='';var _0x1583c0='0';var _0x24bdb3='1';var _0xfbc47d=_0xfa70('0x8');function _0x13ab0a(_0x22eb2c){var _0x2380b8=crypto[_0xfa70('0x9')](_0xfa70('0xa'));_0x2380b8[_0xfa70('0xb')](_0x22eb2c);return _0x2380b8[_0xfa70('0xc')](_0xfa70('0xd'));}function _0x2d4da6(){try{logger[_0xfa70('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x28c4ae=moment()[_0xfa70('0xe')]();var _0x457e0c=_0x13ab0a(_0x28c4ae+_0x46319d+_0x322937);_0x39f39e['send'](JSON[_0xfa70('0xf')]({'appID':_0x46319d,'timestamp':_0x28c4ae,'appKey':_0x457e0c}));var _0x42f255=fs[_0xfa70('0x10')](_0x1a136f);_0x42f255['on']('data',function(_0x43e0f0){_0x39f39e[_0xfa70('0x11')](_0x43e0f0);});_0x42f255['on'](_0xfa70('0x12'),function(){_0x39f39e[_0xfa70('0x11')](_0xfa70('0x13'));});}catch(_0x5cabab){logger[_0xfa70('0x14')](_0xfa70('0x15'),JSON[_0xfa70('0xf')](_0x5cabab));_0x39f39e['terminate']();}}function _0x203c1b(_0x4b2396){try{if(_0x4b2396){var _0x30e40e=JSON[_0xfa70('0x16')](_0x4b2396);switch(_0x30e40e[_0xfa70('0x17')]){case 0x0:if(_0x30e40e['result']){if(_0x30e40e['result'][_0xfa70('0x18')]){logger[_0xfa70('0x5')](_0xfa70('0x19'),JSON[_0xfa70('0xf')](_0x30e40e['result'][_0xfa70('0x1a')]));_0x2c857a=_0x30e40e[_0xfa70('0x1b')][_0xfa70('0x1a')][0x0][_0xfa70('0x1c')];_0x1583c0=_0x30e40e['result'][_0xfa70('0x1a')][0x0]['likelihood'];_0x24bdb3='0';_0xfbc47d='Success.';_0x39f39e['terminate']();}}break;case 0x1:logger[_0xfa70('0x5')](_0xfa70('0x8'));_0x24bdb3='1';_0xfbc47d=_0xfa70('0x8');break;case 0x2:logger['info'](_0xfa70('0x1d'));_0x24bdb3='2';_0xfbc47d=_0xfa70('0x1d');break;case 0x9:logger[_0xfa70('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x24bdb3='9';_0xfbc47d=_0xfa70('0x1e');break;case 0xa:logger['info'](_0xfa70('0x1f'));_0x24bdb3='10';_0xfbc47d=_0xfa70('0x1f');break;case 0xb:logger[_0xfa70('0x5')](_0xfa70('0x20'));_0x24bdb3='11';_0xfbc47d='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x682cc2){logger[_0xfa70('0x14')](_0xfa70('0x21'),JSON[_0xfa70('0xf')](_0x682cc2));_0x39f39e[_0xfa70('0x22')]();}}function _0x130c11(){logger[_0xfa70('0x5')](_0xfa70('0x23'));_0x516f39({'transcript':_0x2c857a,'confidence':_0x1583c0,'status':_0x24bdb3,'status_message':_0xfbc47d});}function _0x5d2dab(_0x5f5a4c){logger[_0xfa70('0x14')](_0xfa70('0x24'));if(!_[_0xfa70('0x25')](_0x5f5a4c)){logger[_0xfa70('0x14')](_[_0xfa70('0x26')](_0x5f5a4c)?JSON[_0xfa70('0xf')](_0x5f5a4c):_0x5f5a4c);}}_0x39f39e['on'](_0xfa70('0x27'),_0x2d4da6);_0x39f39e['on'](_0xfa70('0x28'),_0x203c1b);_0x39f39e['on']('close',_0x130c11);_0x39f39e['on'](_0xfa70('0x14'),_0x5d2dab);});}; \ 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 10cb4be..23290c7 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0xddcc=['./asr','exports'];(function(_0x894081,_0x1764c6){var _0x182845=function(_0xfc78fc){while(--_0xfc78fc){_0x894081['push'](_0x894081['shift']());}};_0x182845(++_0x1764c6);}(_0xddcc,0x96));var _0xcddc=function(_0x93ef34,_0x7070f8){_0x93ef34=_0x93ef34-0x0;var _0x4f35c6=_0xddcc[_0x93ef34];return _0x4f35c6;};var asr=require(_0xcddc('0x0'));module[_0xcddc('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index a29de2a..2bd3c3d 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 _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x57e18a,_0x199383){var _0x1181c7=function(_0x2503e8){while(--_0x2503e8){_0x57e18a['push'](_0x57e18a['shift']());}};_0x1181c7(++_0x199383);}(_0xe706,0xa3));var _0x6e70=function(_0x45d1b1,_0x328cb0){_0x45d1b1=_0x45d1b1-0x0;var _0x313c30=_0xe706[_0x45d1b1];return _0x313c30;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x54a8d3,_0x12b8b7){var _0x5eec0e=function(_0xbc1ade){while(--_0xbc1ade){_0x54a8d3['push'](_0x54a8d3['shift']());}};_0x5eec0e(++_0x12b8b7);}(_0xe706,0xa3));var _0x6e70=function(_0x405ac9,_0x2c795c){_0x405ac9=_0x405ac9-0x0;var _0x2d200f=_0xe706[_0x405ac9];return _0x2d200f;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 501af16..7096e6d 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 _0x4f17=['Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','operation','math\x20%s','%s[%s]','menu','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','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','sms_text','debug','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','START\x20CALLY\x20SQUARE','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','AGI','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','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','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','split','join','exports','util','shelljs','odbc','moment','mustache','request-promise','../../config/logger','agi','/var/opt/motion2/server/files','rawBody','getdigits','getsecretdigits','rpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','channel','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','method','timeout','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','computedVariables','uri','url','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','en-US','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','isString','replaceAllVariables','hasOwnProperty','saveRestApiResult','length','%s.%s','setVariable','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_INPUT()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','no\x20list\x20selected','delay','add','minutes','sync','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','Trying\x20Dialogflow:\x20%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','client_email','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','username','no\x20username\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','streamFile','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','.wav','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured'];(function(_0x3dddfa,_0x30c2bf){var _0x1c2827=function(_0x33b83b){while(--_0x33b83b){_0x3dddfa['push'](_0x3dddfa['shift']());}};_0x1c2827(++_0x30c2bf);}(_0x4f17,0x9e));var _0x74f1=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0x4f17[_0x725a4c];return _0x37b2cc;};'use strict';var fs=require('fs');var util=require(_0x74f1('0x0'));var _=require('lodash');var sh=require(_0x74f1('0x1'));var odbc=require(_0x74f1('0x2'))();var rs=require('randomstring');var moment=require(_0x74f1('0x3'));var Mustache=require(_0x74f1('0x4'));var rp=require(_0x74f1('0x5'));var logger=require(_0x74f1('0x6'))(_0x74f1('0x7'));var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH=_0x74f1('0x8');var recursiveMapAttributes=['rawHeaders',_0x74f1('0x9')];var verticesWithRetry=['menu',_0x74f1('0xa'),_0x74f1('0xb')];var AGIVertices=function(_0x3b4914,_0x5377d3,_0x31b7ec){this['channel']=_0x3b4914;this[_0x74f1('0xc')]=_0x5377d3;this['mailRpc']=_0x31b7ec;};AGIVertices[_0x74f1('0xd')][_0x74f1('0xe')]=function(_0x57e775,_0x5f1fc3){this[_0x74f1('0xc')][_0x74f1('0xf')](_0x57e775)[_0x74f1('0x10')](function(_0x3f6672){_0x5f1fc3(null,_0x3f6672?_0x3f6672[_0x74f1('0x11')]:![]);})[_0x74f1('0x12')](function(_0x467e15){_0x5f1fc3(_0x467e15);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x13')]=function(_0x16ba86,_0x4f34fd){this[_0x74f1('0xc')]['getVoiceQueueById'](_0x16ba86)[_0x74f1('0x10')](function(_0x57e087){_0x4f34fd(null,_0x57e087?_0x57e087[_0x74f1('0x11')]:![]);})[_0x74f1('0x12')](function(_0x373b73){_0x4f34fd(_0x373b73);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x14')]=function(_0x51faf1,_0x2310b0){this[_0x74f1('0xc')]['getSquareProjectById'](_0x51faf1)[_0x74f1('0x10')](function(_0x149ad8){_0x2310b0(null,_0x149ad8?_0x149ad8['name']:![]);})[_0x74f1('0x12')](function(_0x29de10){_0x2310b0(_0x29de10);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x15')]=function(_0x174051,_0x4a10ab){this[_0x74f1('0xc')][_0x74f1('0x16')](_0x174051)[_0x74f1('0x10')](function(_0xeaa63){_0x4a10ab(null,_0xeaa63?_0xeaa63[_0x74f1('0x17')]:![]);})[_0x74f1('0x12')](function(_0x535590){_0x4a10ab(_0x535590);});};AGIVertices['prototype']['getUser']=function(_0x300d84,_0x132a81){this[_0x74f1('0xc')][_0x74f1('0x18')](_0x300d84)[_0x74f1('0x10')](function(_0x26d363){_0x132a81(null,_0x26d363?_0x26d363[_0x74f1('0x11')]:![]);})[_0x74f1('0x12')](function(_0x2c336b){_0x132a81(_0x2c336b);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x19')]=function(_0x47b22f,_0x4cff5f){this[_0x74f1('0xc')][_0x74f1('0x1a')](_0x47b22f)[_0x74f1('0x10')](function(_0x1b9554){_0x4cff5f(null,_0x1b9554?_0x1b9554[_0x74f1('0x11')]:![]);})[_0x74f1('0x12')](function(_0xd079b5){_0x4cff5f(_0xd079b5);});};AGIVertices['prototype'][_0x74f1('0x1b')]=function(_0xad2a05,_0x59a7ac){var _0x1736e3=this;this['rpc']['getSoundById'](_0xad2a05)[_0x74f1('0x10')](function(_0x37894a){_0x59a7ac(null,_0x37894a?_0x1736e3[_0x74f1('0x1c')](_0x37894a[_0x74f1('0x1d')]):![]);})[_0x74f1('0x12')](function(_0x176340){_0x59a7ac(_0x176340);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x1e')]=function(_0x20b8eb,_0x35e928){this[_0x74f1('0xc')][_0x74f1('0x1f')](_0x20b8eb)[_0x74f1('0x10')](function(_0x4bd1a0){_0x35e928(null,_0x4bd1a0?_0x4bd1a0:![]);})[_0x74f1('0x12')](function(_0x333226){_0x35e928(_0x333226);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x20')]=function(_0x52a4b0,_0x181201,_0x48f7e8){this[_0x74f1('0x21')][_0x74f1('0x20')](_0x52a4b0,_0x181201)[_0x74f1('0x10')](function(){_0x48f7e8(null);})[_0x74f1('0x12')](function(_0x49e3b3){_0x48f7e8(_0x49e3b3);});};AGIVertices[_0x74f1('0xd')]['getIntervals']=function(_0x28ac8a,_0x7cdfb7){this[_0x74f1('0xc')][_0x74f1('0x22')](_0x28ac8a)[_0x74f1('0x10')](function(_0x366472){if(_0x366472){if(_0x366472[_0x74f1('0x23')]){_0x7cdfb7(null,[_0x366472[_0x74f1('0x24')]]);}else{_0x7cdfb7(null,_[_0x74f1('0x25')](_0x366472['Intervals'],_0x74f1('0x24')));}}else{_0x7cdfb7(null,![]);}})[_0x74f1('0x12')](function(_0x4f7fe1){_0x7cdfb7(_0x4f7fe1);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x1c')]=function(_0x221c75){return util[_0x74f1('0x26')](_0x74f1('0x27'),FILES_PATH,_0x221c75);};AGIVertices[_0x74f1('0xd')]['getQueryOdbc']=function(_0x45497f,_0x10117b,_0x120939){odbc[_0x74f1('0x28')](_0x45497f,function(_0x43ac84){if(_0x43ac84){logger[_0x74f1('0x29')](_0x74f1('0x2a'),_0x43ac84);_0x120939(_0x43ac84);}else{logger[_0x74f1('0x2b')](_0x74f1('0x2c'));odbc[_0x74f1('0x2d')](_0x10117b,function(_0x547de5,_0x3e9698){if(_0x547de5){logger['info'](_0x74f1('0x2e'),_0x10117b);_0x120939(_0x547de5);}else{logger[_0x74f1('0x2b')]('Query\x20executed\x20correctly\x20%s',_0x10117b);odbc[_0x74f1('0x2f')](function(_0x230aeb){if(_0x230aeb){logger['error'](_0x74f1('0x30'),_0x230aeb);}_0x120939(null,_0x3e9698);});}});}});};AGIVertices[_0x74f1('0xd')]['getSmsAccount']=function(_0x3693cc,_0x312371){this[_0x74f1('0xc')][_0x74f1('0x31')](_0x3693cc)[_0x74f1('0x10')](function(_0x42c0b2){_0x312371(null,_0x42c0b2?_0x42c0b2:![]);})['catch'](function(_0x563cb7){_0x312371(_0x563cb7);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x32')]=function(_0x201de8,_0x279993){this[_0x74f1('0xc')][_0x74f1('0x32')](_0x201de8)[_0x74f1('0x10')](function(_0x40527f){_0x279993(null,_0x40527f);})[_0x74f1('0x12')](function(_0x355820){_0x279993(_0x355820);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x44edeb,_0x4ae128,_0x31403c){this[_0x74f1('0xc')][_0x74f1('0x33')]({'uniqueid':this['channel'][_0x74f1('0x34')],'node':_0x44edeb[_0x74f1('0x35')],'application':_0x44edeb[_0x74f1('0x36')],'data':_0x4ae128||null,'project_name':this[_0x74f1('0x37')][_0x74f1('0x38')],'callerid':this[_0x74f1('0x37')][_0x74f1('0x39')]})[_0x74f1('0x10')](function(_0x4e1ad5){if(_0x31403c){_0x31403c(null,_0x4e1ad5);}})['catch'](function(_0x2194c9){if(_0x31403c){_0x31403c(_0x2194c9);}});};AGIVertices['prototype'][_0x74f1('0x3a')]=function(_0x290422,_0x420235,_0x1b7e82,_0x1d8b07){this[_0x74f1('0xc')][_0x74f1('0x3a')]({'uniqueid':this['channel'][_0x74f1('0x34')],'callerid':this[_0x74f1('0x37')][_0x74f1('0x39')],'calleridname':this[_0x74f1('0x37')][_0x74f1('0x3b')],'context':this['channel'][_0x74f1('0x3c')],'extension':this[_0x74f1('0x37')][_0x74f1('0x3d')],'priority':this[_0x74f1('0x37')][_0x74f1('0x3e')],'accountcode':this[_0x74f1('0x37')][_0x74f1('0x3f')],'dnid':this[_0x74f1('0x37')][_0x74f1('0x40')],'projectName':this['channel'][_0x74f1('0x38')],'saveName':_0x420235,'filename':_0x290422[_0x74f1('0x41')]||_0x420235,'savePath':_0x1b7e82})[_0x74f1('0x10')](function(_0x4b0a12){_0x1d8b07(null,_0x4b0a12);})['catch'](function(_0x2d8949){_0x1d8b07(_0x2d8949);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x42')]=function(_0x1086c1,_0x3f1a61,_0x42ab92,_0x23198e,_0x228f73){this['rpc'][_0x74f1('0x42')]({'uniqueid':this[_0x74f1('0x37')][_0x74f1('0x34')],'body':_0x1086c1,'direction':_0x3f1a61,'providerName':_0x42ab92,'providerResponse':_0x23198e})[_0x74f1('0x10')](function(_0x45099a){if(_0x228f73){_0x228f73(null,_0x45099a);}})[_0x74f1('0x12')](function(_0x49441a){if(_0x228f73){_0x228f73(_0x49441a);}});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x43')]=function(_0x56aa19,_0x469cab){this[_0x74f1('0xc')][_0x74f1('0x43')]({'firstName':_[_0x74f1('0x44')](_0x56aa19[_0x74f1('0x11')])||_[_0x74f1('0x45')](_0x56aa19[_0x74f1('0x11')])?_0x74f1('0x46')+Math[_0x74f1('0x47')]():_0x56aa19[_0x74f1('0x11')],'lastName':_[_0x74f1('0x44')](_0x56aa19[_0x74f1('0x48')])||_[_0x74f1('0x45')](_0x56aa19[_0x74f1('0x48')])?null:_0x56aa19[_0x74f1('0x48')],'phone':_0x56aa19[_0x74f1('0x49')],'ListId':_0x56aa19[_0x74f1('0x4a')],'scheduledat':_0x56aa19[_0x74f1('0x4b')],'callbackUniqueid':this[_0x74f1('0x37')][_0x74f1('0x34')],'tags':_0x74f1('0x4c'),'description':_0x74f1('0x4d')+_0x56aa19[_0x74f1('0x4b')][_0x74f1('0x4e')](),'priority':_0x56aa19[_0x74f1('0x4f')]})[_0x74f1('0x10')](function(_0x455127){_0x469cab(null,_0x455127);})[_0x74f1('0x12')](function(_0x55b919){_0x469cab(_0x55b919);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x50')]=function(_0x396ec6,_0x404a0b){this[_0x74f1('0xc')][_0x74f1('0x51')](_0x396ec6)['then'](function(_0x3bb90d){_0x404a0b(null,_0x3bb90d?_0x3bb90d[_0x74f1('0x11')]:![]);})[_0x74f1('0x12')](function(_0x25f579){_0x404a0b(_0x25f579);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x52')]=function(_0x15e336,_0x56963d,_0x1c99f9){var _0x329e4c={'role':'agent'};_0x329e4c[_0x15e336]=this[_0x74f1('0x37')][_0x74f1('0x39')];this['rpc'][_0x74f1('0x52')](_0x329e4c,_0x56963d,this[_0x74f1('0x37')][_0x74f1('0x34')])[_0x74f1('0x10')](function(_0x1547ab){_0x1c99f9(null,_['isNil'](_0x1547ab)?![]:!![]);})[_0x74f1('0x12')](function(_0x536641){logger[_0x74f1('0x29')](_0x536641);_0x1c99f9(null,![]);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x53')]=function(_0x45b4de,_0x441d5f){var _0x34d740={'role':_0x74f1('0x54')};_0x34d740[_0x45b4de]=this[_0x74f1('0x37')][_0x74f1('0x39')];this[_0x74f1('0xc')][_0x74f1('0x53')](_0x34d740)['then'](function(_0x5b4d19){_0x441d5f(null,_[_0x74f1('0x45')](_0x5b4d19)?![]:!![]);})[_0x74f1('0x12')](function(_0x28673e){logger[_0x74f1('0x29')](_0x28673e);_0x441d5f(null,![]);});};AGIVertices[_0x74f1('0xd')]['agentLogout']=function(_0x32afcd,_0x3afa2d){var _0x4f32e2={'role':_0x74f1('0x54')};_0x4f32e2[_0x32afcd]=this[_0x74f1('0x37')][_0x74f1('0x39')];this[_0x74f1('0xc')][_0x74f1('0x55')](_0x4f32e2)[_0x74f1('0x10')](function(_0x26ebd5){_0x3afa2d(null,_['isNil'](_0x26ebd5)?![]:!![]);})['catch'](function(_0x32dfa3){logger['error'](_0x32dfa3);_0x3afa2d(null,![]);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x56')]=function(_0x3a33cc,_0x524c7d){var _0x3d5891={'role':'agent'};_0x3d5891[_0x3a33cc]=this['channel'][_0x74f1('0x39')];var _0x492bf7=_0x3a33cc!=_0x74f1('0x57')?util[_0x74f1('0x26')](_0x74f1('0x58'),_0x74f1('0x59'),this[_0x74f1('0x37')][_0x74f1('0x39')]):undefined;this[_0x74f1('0xc')][_0x74f1('0x56')](_0x3d5891,_0x492bf7)[_0x74f1('0x10')](function(_0x414edf){_0x524c7d(null,_[_0x74f1('0x45')](_0x414edf)?![]:!![]);})[_0x74f1('0x12')](function(_0x43f525){logger[_0x74f1('0x29')](_0x43f525);_0x524c7d(null,![]);});};AGIVertices[_0x74f1('0xd')]['shellCommand']=function(_0x42a407,_0x1fd601){sh[_0x74f1('0x5a')](_['trim'](_0x42a407),function(_0x1eca4c,_0x489680){var _0x323b26=_0x489680[_0x74f1('0x5b')](/(\r\n|\n|\r)/gm,'');_0x1fd601(null,_0x323b26);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x2c8ab4,_0x51f273){scripts[_0x74f1('0x5c')](_0x2c8ab4[_0x74f1('0x5d')],_0x2c8ab4[_0x74f1('0x5e')]||'text',_0x2c8ab4[_0x74f1('0x5f')],_0x2c8ab4[_0x74f1('0x60')]||'en-US',_0x2c8ab4[_0x74f1('0x61')]||_0x74f1('0x62'),_0x2c8ab4[_0x74f1('0x63')]||_0x74f1('0x64'))['then'](function(_0x84537b){_0x51f273(null,_0x84537b);})[_0x74f1('0x12')](function(_0x2ef0e0){_0x51f273(_0x2ef0e0);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x65')]=function(_0x1e9b03,_0x4940a1){scripts[_0x74f1('0x65')](_0x1e9b03[_0x74f1('0x5f')],_0x1e9b03[_0x74f1('0x66')]||'en',0x1)['then'](function(_0x41c7c3){_0x4940a1(null,_0x41c7c3);})[_0x74f1('0x12')](function(_0x46fc36){_0x4940a1(_0x46fc36);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x67')]=function(_0x15f1bd,_0x507c75){var _0x789773={'uri':_0x15f1bd['url'],'method':_0x15f1bd[_0x74f1('0x68')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x15f1bd['timeout'])==='number'&&parseInt(_0x15f1bd[_0x74f1('0x69')])>=0x1?parseInt(_0x15f1bd[_0x74f1('0x69')])*0x3e8:0x5*0x3e8};if(_[_0x74f1('0x6a')]([_0x74f1('0x6b'),_0x74f1('0x6c')],_0x789773[_0x74f1('0x68')][_0x74f1('0x6d')]())){try{_0x789773[_0x74f1('0x6e')]=_0x15f1bd[_0x74f1('0x9')]?JSON[_0x74f1('0x6f')](_0x15f1bd[_0x74f1('0x9')]):{};}catch(_0x5a28b2){logger[_0x74f1('0x29')](_0x74f1('0x70'),_0x5a28b2);}}try{_0x789773[_0x74f1('0x71')]=_0x15f1bd[_0x74f1('0x72')]?JSON[_0x74f1('0x6f')](_0x15f1bd[_0x74f1('0x72')]):{};}catch(_0x438467){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x438467);}if(_0x15f1bd[_0x74f1('0x73')]){try{var _0x37208f=require(_0x15f1bd['computedVariables'])['sync'](this,_0x789773);_0x789773[_0x74f1('0x74')]=Mustache['render'](_0x15f1bd[_0x74f1('0x75')],_0x37208f,{},['$$','$$']);if(_0x789773[_0x74f1('0x71')]){_0x789773[_0x74f1('0x71')]=JSON[_0x74f1('0x6f')](Mustache[_0x74f1('0x76')](JSON['stringify'](_0x789773['headers']),_0x37208f,{},['$$','$$']));}if(_0x789773['body']){_0x789773[_0x74f1('0x6e')]=JSON[_0x74f1('0x6f')](Mustache['render'](JSON[_0x74f1('0x77')](_0x789773[_0x74f1('0x6e')]),_0x37208f,{},['$$','$$']));}}catch(_0x28b9bf){logger['error'](_0x74f1('0x78'),_0x28b9bf);}}rp(_0x789773)[_0x74f1('0x10')](function(_0x1de8f9){var _0x46a84b={'statusCode':_0x1de8f9[_0x74f1('0x79')]||0xc8,'statusMessage':_0x1de8f9[_0x74f1('0x7a')]||'OK','headers':_0x1de8f9[_0x74f1('0x71')]||{},'body':_0x1de8f9[_0x74f1('0x6e')]||{}};_0x507c75(null,_0x46a84b);})['catch'](function(_0x166fab){var _0x27a8d4={'statusCode':_0x166fab[_0x74f1('0x79')]||0x1f4,'statusMessage':_0x166fab[_0x74f1('0x7b')]||_0x74f1('0x7c'),'headers':_0x166fab[_0x74f1('0x7d')][_0x74f1('0x71')]||{},'body':_0x166fab[_0x74f1('0x7d')][_0x74f1('0x6e')]||{}};_0x507c75(null,_0x27a8d4);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x7e')]=function(_0x5629d7,_0x29024d){scripts[_0x74f1('0x7e')](this[_0x74f1('0x37')][_0x74f1('0x34')],_0x5629d7['key'],_0x5629d7['text'],_0x5629d7['dialogflow_language']||'en')[_0x74f1('0x10')](function(_0x1d7902){_0x29024d(null,_0x1d7902);})[_0x74f1('0x12')](function(_0x474a56){_0x29024d(_0x474a56);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x7f')]=function(_0x330a7e,_0xeb4a70){scripts['googleDialogflowV2'](this['channel'][_0x74f1('0x34')],_0x330a7e[_0x74f1('0x80')],_0x330a7e['client_email'],_0x330a7e[_0x74f1('0x81')],_0x330a7e[_0x74f1('0x5f')],_0x330a7e[_0x74f1('0x82')]||'en')[_0x74f1('0x10')](function(_0x1626ec){_0xeb4a70(null,_0x1626ec);})[_0x74f1('0x12')](function(_0x5a8b97){_0xeb4a70(_0x5a8b97);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x83')]=function(_0x2fdd72,_0x19a8a5){scripts['sestekNDA'](this['channel'],_0x2fdd72)[_0x74f1('0x10')](function(_0x12d1b3){_0x19a8a5(null,_0x12d1b3);})['catch'](function(_0x54ca41){_0x19a8a5(_0x54ca41);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x84')]=function(_0xde7bf8,_0x81b54b){scripts[_0x74f1('0x84')](_0xde7bf8[_0x74f1('0x85')],_0xde7bf8['text'],_0xde7bf8['ispeech_tts_language']||_0x74f1('0x86'),_0xde7bf8['speed'])['then'](function(_0x2c72dd){_0x81b54b(null,_0x2c72dd);})['catch'](function(_0x23fba0){_0x81b54b(_0x23fba0);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x87')]=function(_0x277660,_0x190cdc,_0x4090e3){scripts[_0x74f1('0x87')](_0x190cdc,_0x277660[_0x74f1('0x85')],_0x277660[_0x74f1('0x88')]||_0x74f1('0x86'),this[_0x74f1('0x89')](_0x277660[_0x74f1('0x8a')])?_0x277660[_0x74f1('0x8a')]:undefined)[_0x74f1('0x10')](function(_0x17bc97){_0x4090e3(null,_0x17bc97);})['catch'](function(_0x2eef13){_0x4090e3(_0x2eef13);});};AGIVertices['prototype'][_0x74f1('0x8b')]=function(_0x133b8d,_0x429608){scripts[_0x74f1('0x8b')](_0x133b8d[_0x74f1('0x8c')],_0x133b8d['aws_secret_access_key'],_0x133b8d[_0x74f1('0x8d')],_0x133b8d[_0x74f1('0x8e')]||_0x74f1('0x8f'),_0x133b8d['text'],_0x133b8d[_0x74f1('0x90')]||'text')[_0x74f1('0x10')](function(_0x4f9a8e){_0x429608(null,_0x4f9a8e);})[_0x74f1('0x12')](function(_0xd92e5f){_0x429608(_0xd92e5f);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x91')]=function(_0x68b4df,_0x380de5){scripts[_0x74f1('0x91')](this[_0x74f1('0x37')]['uniqueid'],_0x68b4df[_0x74f1('0x8c')],_0x68b4df[_0x74f1('0x92')],_0x68b4df['aws_lex_region'],_0x68b4df['text'],_0x68b4df[_0x74f1('0x93')])[_0x74f1('0x10')](function(_0x14825b){_0x380de5(null,_0x14825b);})[_0x74f1('0x12')](function(_0xb5398){_0x380de5(_0xb5398);});};AGIVertices['prototype'][_0x74f1('0x94')]=function(_0x392135,_0x559b5b,_0x2ecb12){scripts[_0x74f1('0x94')](_0x559b5b,_0x392135[_0x74f1('0x85')],_0x392135[_0x74f1('0x95')]||_0x74f1('0x86'))[_0x74f1('0x10')](function(_0x3f6e9f){_0x2ecb12(null,_0x3f6e9f);})[_0x74f1('0x12')](function(_0x4c21a4){_0x2ecb12(_0x4c21a4);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x96')]=function(_0x4a6dd3,_0x10975b,_0x2248e3){scripts[_0x74f1('0x96')](_0x10975b,_0x4a6dd3[_0x74f1('0x97')],_0x4a6dd3[_0x74f1('0x98')],_0x4a6dd3[_0x74f1('0x74')])[_0x74f1('0x10')](function(_0x493080){_0x2248e3(null,_0x493080);})[_0x74f1('0x12')](function(_0x55ae48){_0x2248e3(_0x55ae48);});};AGIVertices[_0x74f1('0xd')][_0x74f1('0x99')]=function(_0x593920){var _0x31fbe6=_[_0x74f1('0x6a')](verticesWithRetry,_0x593920[_0x74f1('0x36')])?_0x593920:_[_0x74f1('0x9a')](_0x593920);for(var _0x386627 in _0x31fbe6){if(_0x31fbe6['hasOwnProperty'](_0x386627)){if(_0x31fbe6[_0x386627]&&_['isString'](_0x31fbe6[_0x386627])){if(_[_0x74f1('0x6a')](recursiveMapAttributes,_0x386627)){_0x31fbe6[_0x386627]=this[_0x74f1('0x9b')](_0x31fbe6[_0x386627]);}else{_0x31fbe6[_0x386627]=this['replaceAllVariables'](_0x31fbe6[_0x386627]);}}}}return _0x31fbe6;};AGIVertices['prototype'][_0x74f1('0x9c')]=function(_0x105044){for(var _0x151c79 in _0x105044){if(_0x105044['hasOwnProperty'](_0x151c79)){if(_[_0x74f1('0x9d')](_0x105044[_0x151c79])){this[_0x74f1('0x9c')](_0x105044[_0x151c79]);}else if(_[_0x74f1('0x9e')](_0x105044[_0x151c79])){for(var _0x4f7353=0x0;_0x4f7353<_0x105044[_0x151c79]['length'];_0x4f7353++){this[_0x74f1('0x9c')](_0x105044[_0x151c79][_0x4f7353]);}}else if(_[_0x74f1('0x9f')](_0x105044[_0x151c79])){_0x105044[_0x151c79]=this[_0x74f1('0xa0')](_0x105044[_0x151c79]);}}}};AGIVertices[_0x74f1('0xd')]['saveRestApiResult']=function(_0x162059,_0x2484e4){for(var _0x4c0f17 in _0x162059){if(_0x162059[_0x74f1('0xa1')](_0x4c0f17)){if(_[_0x74f1('0x9d')](_0x162059[_0x4c0f17])){if(!_['isEmpty'](_0x162059[_0x4c0f17])){this[_0x74f1('0xa2')](_0x162059[_0x4c0f17],util[_0x74f1('0x26')]('%s.%s',_0x2484e4,_0x4c0f17));}}else if(_['isArray'](_0x162059[_0x4c0f17])){for(var _0x25a8e5=0x0;_0x25a8e5<_0x162059[_0x4c0f17][_0x74f1('0xa3')];_0x25a8e5++){this[_0x74f1('0xa2')](_0x162059[_0x4c0f17][_0x25a8e5],util['format'](_0x74f1('0xa4'),_0x2484e4,_0x4c0f17+'['+_0x25a8e5+']'));}}else{if(!_[_0x74f1('0x45')](_0x162059[_0x4c0f17])){this['channel'][_0x74f1('0xa5')](util[_0x74f1('0x26')](_0x74f1('0xa4'),_0x2484e4,_0x4c0f17),_0x162059[_0x4c0f17]);}}}}};AGIVertices[_0x74f1('0xd')][_0x74f1('0x9b')]=function(_0x44f547){try{var _0x149563=JSON['parse'](_0x44f547);this[_0x74f1('0x9c')](_0x149563);return JSON[_0x74f1('0x77')](_0x149563);}catch(_0x54223b){return this[_0x74f1('0xa0')](_0x44f547);}};AGIVertices['prototype'][_0x74f1('0xa0')]=function(_0x5dd7c5){var _0x382037=_0x5dd7c5['split']('{');for(var _0x123b6a=0x1;_0x123b6a<_0x382037[_0x74f1('0xa3')];_0x123b6a+=0x1){var _0x15e703=_0x382037[_0x123b6a]['split']('}');if(_0x15e703[_0x74f1('0xa3')]>0x1){_0x5dd7c5=_0x5dd7c5['replaceAll']('{'+_0x15e703[0x0]+'}',this[_0x74f1('0x37')][_0x74f1('0xe')](_0x15e703[0x0])[_0x74f1('0xa6')]||_0x15e703[0x0]);}}if(_0x382037[_0x74f1('0xa3')]===0x1){return _0x5dd7c5['toString']();}return this[_0x74f1('0xa0')](_0x5dd7c5);};AGIVertices[_0x74f1('0xd')][_0x74f1('0xa7')]=function(_0xf1af16,_0x323197){var _0x1a1e6c=this['channel'][_0x74f1('0xe')](_0xf1af16);if(_0x1a1e6c[_0x74f1('0xa8')]===-0x1){return _0x1a1e6c;}logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0xa9'),_0x323197,_0x1a1e6c[_0x74f1('0xa6')]));return this['channel'][_0x74f1('0xa5')](_0x323197,_0x1a1e6c[_0x74f1('0xa6')]);};AGIVertices[_0x74f1('0xd')][_0x74f1('0x89')]=function(_0x26edf9){return _0x26edf9&&_0x26edf9!=='0'&&_0x26edf9!=='-1'&&_0x26edf9!=='';};AGIVertices[_0x74f1('0xd')][_0x74f1('0xaa')]=function(_0x30c9ed){this['createSquareDetailsReport']['sync'](this,_0x30c9ed,'-');_0x30c9ed[_0x74f1('0xab')]=_0x30c9ed[_0x74f1('0xaa')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x74f1('0xd')][_0x74f1('0xac')]=function(_0x590466){logger[_0x74f1('0x2b')](util['format'](_0x74f1('0xad'),_0x590466['label']));if(!this[_0x74f1('0x89')](_0x590466['text'])){return this['channel'][_0x74f1('0xae')]('no\x20text\x20configured');}var _0x28c598='\x22'+_0x590466[_0x74f1('0x5f')]+'\x22';if(this[_0x74f1('0x89')](_0x590466[_0x74f1('0x7d')])){_0x28c598+=','+_0x590466[_0x74f1('0x7d')];}var _0x4007ba=this['channel'][_0x74f1('0x5a')](_0x74f1('0xaf'),_0x28c598);if(_0x4007ba[_0x74f1('0xa8')]===-0x1){return _0x4007ba;}return this['channel'][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0xb0'),_0x28c598));};AGIVertices[_0x74f1('0xd')][_0x74f1('0xb1')]=function(_0x589815){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0xb2'),_0x589815[_0x74f1('0x35')]));if(!this[_0x74f1('0x89')](_0x589815[_0x74f1('0xb3')])){return this['channel'][_0x74f1('0xae')](_0x74f1('0xb4'));}var _0x4828b2=_0x589815['grammar'];if(this['isConfigured'](_0x589815[_0x74f1('0x7d')])){_0x4828b2+=','+_0x589815[_0x74f1('0x7d')];}var _0x2a1e60=this[_0x74f1('0x37')][_0x74f1('0x5a')]('MRCPRecog',_0x4828b2);if(_0x2a1e60[_0x74f1('0xa8')]===-0x1){return _0x2a1e60;}var _0x2c826a=this[_0x74f1('0xa7')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x2c826a['result']===-0x1){return _0x2c826a;}var _0x109f64=this[_0x74f1('0xa7')](_0x74f1('0xb5'),'MRCP_RECOG_TRANSCRIPT');if(_0x109f64[_0x74f1('0xa8')]===-0x1){return _0x109f64;}var _0x7f541f=this[_0x74f1('0xa7')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x7f541f[_0x74f1('0xa8')]===-0x1){return _0x7f541f;}return this['channel'][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0xb6'),_0x4828b2));};AGIVertices[_0x74f1('0xd')][_0x74f1('0x7')]=function(_0x410a99){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0xb7'),_0x410a99[_0x74f1('0x35')]));return this[_0x74f1('0x37')][_0x74f1('0x7')]([_0x410a99[_0x74f1('0xb8')],_0x410a99[_0x74f1('0xb9')]]);};AGIVertices[_0x74f1('0xd')][_0x74f1('0xba')]=function(_0x5caab8){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0xbb'),_0x5caab8[_0x74f1('0x35')]));if(this[_0x74f1('0x89')](_0x5caab8[_0x74f1('0x69')])){logger['info'](util[_0x74f1('0x26')](_0x74f1('0xbc'),_0x5caab8[_0x74f1('0x69')]));var _0x3c3c59=this[_0x74f1('0x37')][_0x74f1('0xbd')](_0x5caab8[_0x74f1('0x69')]);if(_0x3c3c59['result']===-0x1){return _0x3c3c59;}}return this[_0x74f1('0x37')]['answer']();};AGIVertices[_0x74f1('0xd')][_0x74f1('0x4c')]=function(_0x4228ee){logger[_0x74f1('0x2b')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x4228ee['label']));if(!this[_0x74f1('0x89')](_0x4228ee[_0x74f1('0x4a')])){return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x4228ee,_0x74f1('0xbe'));}_0x4228ee[_0x74f1('0x4b')]=moment();if(this[_0x74f1('0x89')](_0x4228ee[_0x74f1('0xbf')])){_0x4228ee[_0x74f1('0x4b')]=moment()[_0x74f1('0xc0')](_0x4228ee['delay'],_0x74f1('0xc1'));}if(!this[_0x74f1('0x89')](_0x4228ee[_0x74f1('0x4f')])){_0x4228ee['callback_priority']=0x2;}this[_0x74f1('0x43')][_0x74f1('0xc2')](this,_0x4228ee);return this[_0x74f1('0x37')][_0x74f1('0xae')](util[_0x74f1('0x26')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x4228ee['phone'],_0x4228ee[_0x74f1('0x4a')],_0x4228ee['scheduledAt']));};AGIVertices[_0x74f1('0xd')][_0x74f1('0xc3')]=function(_0x2357c1){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0xc4'),_0x2357c1[_0x74f1('0x35')]));var _0x3b8828=this['channel']['exec'](_0x2357c1[_0x74f1('0xc5')],_0x2357c1[_0x74f1('0x7d')]);if(_0x3b8828[_0x74f1('0xa8')]===-0x1){return _0x3b8828;}return this[_0x74f1('0x37')][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0xc6'),_0x2357c1[_0x74f1('0xc5')],_0x2357c1['options']));};AGIVertices[_0x74f1('0xd')]['lumenvoxtts']=function(_0x1f9c93){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0xc7'),_0x1f9c93[_0x74f1('0x35')]));if(!this[_0x74f1('0x89')](_0x1f9c93[_0x74f1('0x5f')])){return this['channel'][_0x74f1('0xae')](_0x74f1('0xc8'));}var _0x36051='\x22'+_0x1f9c93[_0x74f1('0x5f')]+'\x22';if(this[_0x74f1('0x89')](_0x1f9c93[_0x74f1('0x7d')])){_0x36051+=','+_0x1f9c93['options'];}var _0x2125ca=this[_0x74f1('0x37')][_0x74f1('0x5a')](_0x74f1('0xaf'),_0x36051);if(_0x2125ca[_0x74f1('0xa8')]===-0x1){return _0x2125ca;}return this[_0x74f1('0x37')][_0x74f1('0xae')](util['format'](_0x74f1('0xb0'),_0x36051));};AGIVertices[_0x74f1('0xd')]['sestektts']=function(_0x564db9){logger['info'](util[_0x74f1('0x26')](_0x74f1('0xc9'),_0x564db9[_0x74f1('0x35')]));if(!this[_0x74f1('0x89')](_0x564db9[_0x74f1('0x5f')])){return this['channel'][_0x74f1('0xae')](_0x74f1('0xc8'));}var _0x597ab7='\x22'+_0x564db9[_0x74f1('0x5f')]+'\x22';if(this[_0x74f1('0x89')](_0x564db9[_0x74f1('0x7d')])){_0x597ab7+=','+_0x564db9[_0x74f1('0x7d')];}var _0x3b8d83=this[_0x74f1('0x37')]['exec'](_0x74f1('0xaf'),_0x597ab7);if(_0x3b8d83[_0x74f1('0xa8')]===-0x1){return _0x3b8d83;}return this['channel']['noop'](util[_0x74f1('0x26')](_0x74f1('0xb0'),_0x597ab7));};AGIVertices[_0x74f1('0xd')]['lumenvoxasr']=function(_0xd8928){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0xd8928['label']));if(!this[_0x74f1('0x89')](_0xd8928[_0x74f1('0xb3')])){return this[_0x74f1('0x37')][_0x74f1('0xae')](_0x74f1('0xb4'));}var _0x389cc2=_0xd8928[_0x74f1('0xb3')];if(this['isConfigured'](_0xd8928[_0x74f1('0x7d')])){_0x389cc2+=','+_0xd8928[_0x74f1('0x7d')];}var _0x5586c9=this[_0x74f1('0x37')][_0x74f1('0x5a')](_0x74f1('0xca'),_0x389cc2);if(_0x5586c9[_0x74f1('0xa8')]===-0x1){return _0x5586c9;}var _0x551b3a=this[_0x74f1('0xa7')](_0x74f1('0xcb'),'LUMENVOX_ASR_CONFIDENCE');if(_0x551b3a[_0x74f1('0xa8')]===-0x1){return _0x551b3a;}var _0x4cec3c=this['getAndSetVariable'](_0x74f1('0xb5'),_0x74f1('0xcc'));if(_0x4cec3c[_0x74f1('0xa8')]===-0x1){return _0x4cec3c;}var _0x3a34c9=this[_0x74f1('0xa7')](_0x74f1('0xcd'),_0x74f1('0xce'));if(_0x3a34c9[_0x74f1('0xa8')]===-0x1){return _0x3a34c9;}return this[_0x74f1('0x37')][_0x74f1('0xae')](util[_0x74f1('0x26')]('Executed\x20command\x20MRCPRecog\x20%s',_0x389cc2));};AGIVertices[_0x74f1('0xd')][_0x74f1('0xcf')]=function(_0x1e673c){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x1e673c[_0x74f1('0x35')]));if(!this[_0x74f1('0x89')](_0x1e673c[_0x74f1('0xb3')])){return this[_0x74f1('0x37')]['noop'](_0x74f1('0xb4'));}var _0x3d000d=_0x1e673c['grammar'];if(this[_0x74f1('0x89')](_0x1e673c['options'])){_0x3d000d+=','+_0x1e673c['options'];}var _0x139d27=this[_0x74f1('0x37')][_0x74f1('0x5a')](_0x74f1('0xca'),_0x3d000d);if(_0x139d27[_0x74f1('0xa8')]===-0x1){return _0x139d27;}var _0x3a1cfc=this[_0x74f1('0xa7')](_0x74f1('0xcb'),_0x74f1('0xd0'));if(_0x3a1cfc[_0x74f1('0xa8')]===-0x1){return _0x3a1cfc;}var _0x2d2e02=this[_0x74f1('0xa7')](_0x74f1('0xb5'),_0x74f1('0xd1'));if(_0x2d2e02[_0x74f1('0xa8')]===-0x1){return _0x2d2e02;}var _0x6cfad=this[_0x74f1('0xa7')]('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x6cfad[_0x74f1('0xa8')]===-0x1){return _0x6cfad;}return this[_0x74f1('0x37')]['noop'](util[_0x74f1('0x26')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3d000d));};AGIVertices[_0x74f1('0xd')]['database']=function(_0x2c8141){logger[_0x74f1('0x2b')](util['format'](_0x74f1('0xd2'),_0x2c8141[_0x74f1('0x35')]));if(!this[_0x74f1('0x89')](_0x2c8141[_0x74f1('0xd3')])){return this[_0x74f1('0x37')]['error'](_0x2c8141,_0x74f1('0xd4'));}var _0x2990ed=this[_0x74f1('0x15')][_0x74f1('0xc2')](this,_0x2c8141[_0x74f1('0xd3')]);if(!_0x2990ed){return this[_0x74f1('0x37')]['error'](_0x2c8141,_0x74f1('0xd5'));}if(!this[_0x74f1('0x89')](_0x2c8141['query'])){return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x2c8141,'no\x20query\x20configured');}var _0x115fe0=_0x2c8141['query'][_0x74f1('0x5b')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0xd6'),_0x115fe0));var _0x282cbe=this['getQueryOdbc'][_0x74f1('0xc2')](this,_0x2990ed,_0x115fe0);this[_0x74f1('0x33')]['sync'](this,_0x2c8141,_0x115fe0);if(!this['isConfigured'](_0x2c8141[_0x74f1('0xd7')])){return this[_0x74f1('0x37')]['noop'](_0x74f1('0xd8'));}var _0x423050=this[_0x74f1('0xe')][_0x74f1('0xc2')](this,_0x2c8141[_0x74f1('0xd7')]);if(!_0x423050){return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x2c8141,_0x74f1('0xd9'));}var _0x22f45d=this;_0x282cbe[_0x74f1('0xda')](function(_0x24a591,_0x3bd6c0){Object[_0x74f1('0xdb')](_0x24a591)['forEach'](function(_0x420e0f){_0x22f45d[_0x74f1('0x37')][_0x74f1('0xa5')](util[_0x74f1('0x26')]('%s[%s][%s]',_0x423050,_0x3bd6c0,_0x420e0f),_0x24a591[_0x420e0f]);});});this[_0x74f1('0x37')]['setVariable'](util[_0x74f1('0x26')]('%s_ROWS_COUNT',_0x423050),_0x282cbe['length']);return this[_0x74f1('0x37')][_0x74f1('0xae')](util['format']('variable\x20%s\x20set',_0x423050));};AGIVertices[_0x74f1('0xd')][_0x74f1('0xdc')]=function(_0x1e4cd2){logger['debug'](util[_0x74f1('0x26')](_0x74f1('0xdd'),_0x1e4cd2[_0x74f1('0x35')]));if(!this['isConfigured'](_0x1e4cd2[_0x74f1('0xde')])){return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x1e4cd2,_0x74f1('0xdf'));}var _0x289e6e=this[_0x74f1('0xe0')][_0x74f1('0xc2')](this,_0x1e4cd2[_0x74f1('0xde')]);if(!_0x289e6e){return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x1e4cd2,_0x74f1('0xe1'));}var _0x593b6d=this['channel'][_0x74f1('0x5a')](_0x74f1('0xe2'),[util[_0x74f1('0x26')](_0x74f1('0xe3'),_0x289e6e),_0x1e4cd2[_0x74f1('0x69')],_0x1e4cd2[_0x74f1('0xe4')],_0x1e4cd2['url']]);if(_0x593b6d[_0x74f1('0xa8')]===-0x1){return _0x593b6d;}return this[_0x74f1('0x37')][_0x74f1('0xae')](util[_0x74f1('0x26')]('Executed\x20command\x20%s',_0x74f1('0xe2')));};AGIVertices[_0x74f1('0xd')][_0x74f1('0xe5')]=function(_0x10cc4a){logger[_0x74f1('0x2b')](util['format'](_0x74f1('0xe6'),_0x10cc4a[_0x74f1('0x35')]));if(!this[_0x74f1('0x89')](_0x10cc4a[_0x74f1('0x85')])){return this[_0x74f1('0x37')][_0x74f1('0xae')]('no\x20key\x20configured');}if(!this[_0x74f1('0x89')](_0x10cc4a[_0x74f1('0x5f')])){return this[_0x74f1('0x37')][_0x74f1('0xae')](_0x74f1('0xc8'));}this[_0x74f1('0x37')]['bot']=!![];this['createSquareDetailsReport'](_0x10cc4a);this['createSquareMessage'](_0x10cc4a['text'],'in','','');this[_0x74f1('0x37')][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0xe7'),_0x10cc4a['text']));var _0x697cd0=this['googleDialogflow']['sync'](this,_0x10cc4a);if(_0x697cd0){for(var _0x2e1712 in _0x697cd0){if(_0x697cd0[_0x74f1('0xa1')](_0x2e1712)){this[_0x74f1('0x37')][_0x74f1('0xa5')](util['format']('DIALOGFLOW_%s',_0x2e1712['toUpperCase']()),_0x697cd0[_0x2e1712]);}}this[_0x74f1('0x42')](_0x697cd0['speech'],_0x74f1('0xe8'),_0x74f1('0xe5'),'');return this[_0x74f1('0x37')][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0xe9'),_0x697cd0[_0x74f1('0xea')]));}return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x10cc4a,_0x74f1('0xeb'));};AGIVertices['prototype'][_0x74f1('0xec')]=function(_0x51cad7){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0xed'),_0x51cad7[_0x74f1('0x35')]));if(!this[_0x74f1('0x89')](_0x51cad7[_0x74f1('0x80')])){return this[_0x74f1('0x37')][_0x74f1('0xae')]('no\x20project_id\x20configured');}if(!this[_0x74f1('0x89')](_0x51cad7[_0x74f1('0xee')])){return this[_0x74f1('0x37')][_0x74f1('0xae')]('no\x20client_email\x20configured');}if(!this[_0x74f1('0x89')](_0x51cad7[_0x74f1('0x81')])){return this[_0x74f1('0x37')]['noop'](_0x74f1('0xef'));}if(!this['isConfigured'](_0x51cad7['dialogflowV2_language'])){return this[_0x74f1('0x37')]['noop'](_0x74f1('0xf0'));}if(!this[_0x74f1('0x89')](_0x51cad7[_0x74f1('0x5f')])){return this['channel'][_0x74f1('0xae')](_0x74f1('0xc8'));}this[_0x74f1('0x37')][_0x74f1('0xf1')]=!![];this[_0x74f1('0x33')](_0x51cad7);this['createSquareMessage'](_0x51cad7[_0x74f1('0x5f')],'in','','');this['channel'][_0x74f1('0xae')](util['format'](_0x74f1('0xf2'),_0x51cad7['text']));var _0x579f67=this[_0x74f1('0x7f')][_0x74f1('0xc2')](this,_0x51cad7);if(_0x579f67){for(var _0x47b465 in _0x579f67){if(_0x579f67[_0x74f1('0xa1')](_0x47b465)){if(_0x47b465!==_0x74f1('0xf3')){this[_0x74f1('0x37')][_0x74f1('0xa5')](util[_0x74f1('0x26')](_0x74f1('0xf4'),_0x47b465[_0x74f1('0x6d')]()),_0x579f67[_0x47b465]);}}}this[_0x74f1('0x42')](_0x579f67['speech'],_0x74f1('0xe8'),'dialogflowV2',_0x579f67['providerResponse']);return this[_0x74f1('0x37')][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0xf5'),_0x579f67[_0x74f1('0xea')]));}return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x51cad7,_0x74f1('0xf6'));};AGIVertices[_0x74f1('0xd')][_0x74f1('0xf7')]=function(_0x2231a2){logger['info'](util[_0x74f1('0x26')](_0x74f1('0xf8'),_0x2231a2[_0x74f1('0x35')]));if(!this['isConfigured'](_0x2231a2['ndauth_url'])){return this[_0x74f1('0x37')][_0x74f1('0xae')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x74f1('0x89')](_0x2231a2[_0x74f1('0xf9')])){return this[_0x74f1('0x37')]['noop'](_0x74f1('0xfa'));}if(!this[_0x74f1('0x89')](_0x2231a2['password'])){return this['channel'][_0x74f1('0xae')]('no\x20password\x20configured');}if(!this[_0x74f1('0x89')](_0x2231a2[_0x74f1('0xfb')])){return this[_0x74f1('0x37')][_0x74f1('0xae')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0x74f1('0x33')](_0x2231a2);this[_0x74f1('0x42')](_0x2231a2[_0x74f1('0x5f')],'in','','');this[_0x74f1('0x37')][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0xfc'),_0x2231a2[_0x74f1('0x5f')]));var _0x4c410c=this[_0x74f1('0x83')][_0x74f1('0xc2')](this,_0x2231a2);if(_0x4c410c){for(var _0x338835 in _0x4c410c){if(_0x4c410c[_0x74f1('0xa1')](_0x338835)){this[_0x74f1('0x37')][_0x74f1('0xa5')](util[_0x74f1('0x26')]('SESTEK_NDA_%s',_0x338835[_0x74f1('0x6d')]()),_0x4c410c[_0x338835]);}}this['createSquareMessage'](_0x4c410c[_0x74f1('0xea')],'out',_0x74f1('0xf7'),'');if(_0x4c410c[_0x74f1('0xfd')]){this[_0x74f1('0x37')]['noop'](util[_0x74f1('0x26')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x4c410c[_0x74f1('0xfd')]));var _0x3465da=this[_0x74f1('0x37')][_0x74f1('0xfe')](_0x4c410c['audiofile']);try{fs['unlink'](_0x4c410c[_0x74f1('0xfd')]+'.wav');}catch(_0x18a602){logger['error'](_0x18a602);}return _0x3465da;}else{return this[_0x74f1('0x37')][_0x74f1('0xae')](util['format'](_0x74f1('0xff'),_0x4c410c[_0x74f1('0xea')]));}}return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x2231a2,_0x74f1('0x100'));};AGIVertices[_0x74f1('0xd')][_0x74f1('0x101')]=function(_0x5c6acf){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x102'),_0x5c6acf['label']));return this[_0x74f1('0x37')][_0x74f1('0xae')](_0x74f1('0x101'));};AGIVertices[_0x74f1('0xd')][_0x74f1('0x103')]=function(_0x20bd3e){logger[_0x74f1('0x2b')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x20bd3e['label']));var _0x53b847='';if(_0x20bd3e['trunk_id']){if(!this['isConfigured'](_0x20bd3e[_0x74f1('0x104')])){return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x20bd3e,_0x74f1('0x105'));}else{var _0xf2d62f=parseInt(_0x20bd3e['trunk_id'],0xa);if(isNaN(_0xf2d62f)){_0x53b847=_0x20bd3e['trunk_id'];}else{_0x53b847=this[_0x74f1('0x19')]['sync'](this,_0x20bd3e[_0x74f1('0x104')]);if(!_0x53b847){return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x20bd3e,_0x74f1('0x106'));}}}}else if(_0x20bd3e['trunk_name']){_0x53b847=_0x20bd3e[_0x74f1('0x107')];}else{return this[_0x74f1('0x37')]['error'](_0x20bd3e,_0x74f1('0x105'));}var _0x318b8f=this[_0x74f1('0x37')]['exec'](_0x74f1('0xe2'),[util[_0x74f1('0x26')](_0x74f1('0x108'),_0x53b847,_0x20bd3e[_0x74f1('0x49')]),_0x20bd3e[_0x74f1('0x69')],_0x20bd3e[_0x74f1('0xe4')],_0x20bd3e['url']]);if(_0x318b8f[_0x74f1('0xa8')]===-0x1){return _0x318b8f;}return this[_0x74f1('0x37')]['noop'](util[_0x74f1('0x26')](_0x74f1('0x109'),_0x74f1('0xe2')));};AGIVertices['prototype'][_0x74f1('0x10a')]=function(_0x309d2b){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x10b'),_0x309d2b[_0x74f1('0x35')]));return this[_0x74f1('0x37')]['noop'](_0x74f1('0x10a'));};AGIVertices[_0x74f1('0xd')]['getdigits']=function(_0x32a634){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x10c'),_0x32a634[_0x74f1('0x35')]));if(_0x32a634[_0x74f1('0xab')]===0x0){return this['maxRetry'](_0x32a634);}_0x32a634['retry']-=0x1;if(!this['isConfigured'](_0x32a634[_0x74f1('0x10d')])){return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x32a634,_0x74f1('0x10e'));}var _0x1d70bd=this['getSound']['sync'](this,_0x32a634[_0x74f1('0x10d')]);if(!_0x1d70bd){return this['channel']['error'](_0x32a634,_0x74f1('0x10f'));}if(!this['isConfigured'](_0x32a634[_0x74f1('0xd7')])){return this['channel'][_0x74f1('0x29')](_0x74f1('0xd8'));}var _0x2f27e6=this[_0x74f1('0x37')][_0x74f1('0x110')](_0x1d70bd,_0x32a634['response'],_0x32a634[_0x74f1('0x111')]);var _0x507ad7=_0x2f27e6['result']?_0x2f27e6['result'][_0x74f1('0x4e')]():'';logger[_0x74f1('0x2b')]('test',JSON[_0x74f1('0x77')](_0x2f27e6));if(_0x2f27e6[_0x74f1('0xa8')]===-0x1){this[_0x74f1('0x33')][_0x74f1('0xc2')](this,_0x32a634,_0x507ad7);return _0x2f27e6;}else if(_0x2f27e6['extra']===_0x74f1('0x69')){_0x2f27e6[_0x74f1('0xa8')]=_0x507ad7[_0x74f1('0xa3')]>=parseInt(_0x32a634[_0x74f1('0x112')])?'x':'i';}else{_0x2f27e6['result']=_0x507ad7[_0x74f1('0xa3')]>=parseInt(_0x32a634['mindigit'])&&_0x507ad7[_0x74f1('0xa3')]<=parseInt(_0x32a634[_0x74f1('0x111')])?'x':'i';}var _0x13523a=this[_0x74f1('0xe')][_0x74f1('0xc2')](this,_0x32a634[_0x74f1('0xd7')]);if(!_0x13523a){return this[_0x74f1('0x37')]['error'](_0x32a634,_0x74f1('0xd9'));}this[_0x74f1('0x37')][_0x74f1('0xa5')](_0x13523a,_0x507ad7);if(this[_0x74f1('0x89')](_0x32a634[_0x74f1('0x113')])){var _0x15fe5b=parseInt(_0x32a634['hiddendigitsnum'],0xa);var _0x1e5056=rs[_0x74f1('0x114')]({'charset':'*','length':_0x15fe5b});var _0x4f87c8=_0x507ad7[_0x74f1('0xa3')];if(_0x4f87c8>0x0){if(_0x4f87c8>_0x15fe5b){this['createSquareDetailsReport'][_0x74f1('0xc2')](this,_0x32a634,_0x32a634['hiddendigitspos']===_0x74f1('0x115')?_0x1e5056+_0x507ad7[_0x74f1('0x116')](_0x15fe5b):_0x507ad7['substr'](0x0,_0x4f87c8-_0x15fe5b)+_0x1e5056);}else{this[_0x74f1('0x33')][_0x74f1('0xc2')](this,_0x32a634,rs[_0x74f1('0x114')]({'charset':'*','length':_0x4f87c8}));}}else{this['createSquareDetailsReport'][_0x74f1('0xc2')](this,_0x32a634,'');}}else{this[_0x74f1('0x33')]['sync'](this,_0x32a634,_0x507ad7);}return _0x2f27e6;};AGIVertices[_0x74f1('0xd')][_0x74f1('0xb')]=function(_0x27cbde){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x117'),_0x27cbde[_0x74f1('0x35')]));return this[_0x74f1('0xa')](_0x27cbde);};AGIVertices[_0x74f1('0xd')][_0x74f1('0x118')]=function(_0x186b52){logger['info'](util[_0x74f1('0x26')](_0x74f1('0x119'),_0x186b52[_0x74f1('0x35')]));this['createSquareDetailsReport'][_0x74f1('0xc2')](this,_0x186b52,_0x186b52['goalname']);return this['channel'][_0x74f1('0xae')](util['format'](_0x74f1('0x11a'),_0x186b52['goalname']));};AGIVertices[_0x74f1('0xd')][_0x74f1('0x11b')]=function(_0x54bdfe){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x11c'),_0x54bdfe[_0x74f1('0x35')]));if(!this[_0x74f1('0x89')](_0x54bdfe[_0x74f1('0x8c')])||!this[_0x74f1('0x89')](_0x54bdfe['aws_secret_access_key'])){return this[_0x74f1('0x37')][_0x74f1('0xae')](_0x74f1('0x11d'));}if(!this['isConfigured'](_0x54bdfe[_0x74f1('0x5f')])){return this[_0x74f1('0x37')][_0x74f1('0xae')](_0x74f1('0xc8'));}this[_0x74f1('0x37')]['noop'](util[_0x74f1('0x26')](_0x74f1('0x11e'),_0x54bdfe[_0x74f1('0x5f')]));var _0x3ad475=this[_0x74f1('0x8b')][_0x74f1('0xc2')](this,_0x54bdfe);if(_0x3ad475){this['channel'][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0x11f'),_0x3ad475));var _0x3b969c=this[_0x74f1('0x37')][_0x74f1('0xfe')](_0x3ad475);try{fs[_0x74f1('0x120')](_0x3ad475+_0x74f1('0x121'));}catch(_0x2c6dd4){logger[_0x74f1('0x29')](_0x2c6dd4);}return _0x3b969c;}return this['channel'][_0x74f1('0x29')](_0x54bdfe,_0x74f1('0x122'));};AGIVertices[_0x74f1('0xd')][_0x74f1('0x123')]=function(_0xfba204){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0xfba204[_0x74f1('0x35')]));if(!this['isConfigured'](_0xfba204[_0x74f1('0x8c')])||!this[_0x74f1('0x89')](_0xfba204[_0x74f1('0x92')])){return this[_0x74f1('0x37')][_0x74f1('0xae')](_0x74f1('0x11d'));}if(!this[_0x74f1('0x89')](_0xfba204[_0x74f1('0x93')])){return this[_0x74f1('0x37')][_0x74f1('0xae')](_0x74f1('0x124'));}if(!this[_0x74f1('0x89')](_0xfba204[_0x74f1('0x5f')])){return this[_0x74f1('0x37')][_0x74f1('0xae')](_0x74f1('0xc8'));}this['channel']['bot']=!![];this[_0x74f1('0x33')](_0xfba204);this['createSquareMessage'](_0xfba204[_0x74f1('0x5f')],'in','','');this['channel']['noop'](util['format'](_0x74f1('0x125'),_0xfba204[_0x74f1('0x5f')]));var _0x52e7ef=this[_0x74f1('0x91')]['sync'](this,_0xfba204);if(_0x52e7ef){for(var _0x4d50ca in _0x52e7ef){if(_0x52e7ef[_0x74f1('0xa1')](_0x4d50ca)&&_[_0x74f1('0x9f')](_0x52e7ef[_0x4d50ca])){this[_0x74f1('0x37')]['setVariable'](util[_0x74f1('0x26')](_0x74f1('0x126'),_0x4d50ca[_0x74f1('0x6d')]()),_0x52e7ef[_0x4d50ca]);}}if(_['isNil'](_0x52e7ef[_0x74f1('0x7b')])){return this[_0x74f1('0x37')][_0x74f1('0xae')](_0x74f1('0x127'));}else{this[_0x74f1('0x42')](_0x52e7ef[_0x74f1('0x7b')],_0x74f1('0xe8'),_0x74f1('0x128'),'');return this[_0x74f1('0x37')][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0x129'),_0x52e7ef[_0x74f1('0x7b')]));}}return this[_0x74f1('0x37')][_0x74f1('0x29')](_0xfba204,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices['prototype'][_0x74f1('0x12a')]=function(_0x5cd044){logger[_0x74f1('0x2b')](util['format'](_0x74f1('0x12b'),_0x5cd044[_0x74f1('0x35')],_0x5cd044[_0x74f1('0x69')]));if(!this[_0x74f1('0x89')](_0x5cd044[_0x74f1('0x85')])){return this['channel']['noop'](_0x74f1('0x12c'));}var _0x5758f8=_0x74f1('0x12d');var _0x2f1a70=util[_0x74f1('0x26')](_0x74f1('0x12e'),FILES_PATH,rs[_0x74f1('0x114')](0x4));var _0x232ad8=util[_0x74f1('0x26')](_0x74f1('0xa4'),_0x2f1a70,_0x5758f8);var _0xd8263b=!![];if(_0x5cd044[_0x74f1('0x12f')]===_0x74f1('0x130')){_0xd8263b=![];}var _0x3b4251=this[_0x74f1('0x37')][_0x74f1('0x131')](_0x2f1a70,_0x5758f8,_0x5cd044[_0x74f1('0x132')],_0x5cd044[_0x74f1('0x69')],undefined,_0xd8263b);if(_0x3b4251[_0x74f1('0xa8')]!==-0x1){this[_0x74f1('0x37')][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0x133'),_0x232ad8));var _0x1ee5c3=this['googleASR']['sync'](this,_0x5cd044,_0x232ad8);if(_0x1ee5c3){for(var _0x5c6b61 in _0x1ee5c3){if(_0x1ee5c3[_0x74f1('0xa1')](_0x5c6b61)){this[_0x74f1('0x37')][_0x74f1('0xa5')](util[_0x74f1('0x26')]('GOOGLE_ASR_%s',_0x5c6b61[_0x74f1('0x6d')]()),_0x1ee5c3[_0x5c6b61]);}}return this['channel'][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0x134'),JSON[_0x74f1('0x77')](_0x1ee5c3)));}}return _0x3b4251;};AGIVertices[_0x74f1('0xd')]['tildeasr']=function(_0x5bcf59){logger['info'](util[_0x74f1('0x26')](_0x74f1('0x135'),_0x5bcf59[_0x74f1('0x35')]));if(!this[_0x74f1('0x89')](_0x5bcf59['appid'])){return this['channel'][_0x74f1('0xae')](_0x74f1('0x136'));}if(!this[_0x74f1('0x89')](_0x5bcf59[_0x74f1('0x98')])){return this['channel'][_0x74f1('0xae')](_0x74f1('0x137'));}var _0x209301='wav';var _0x1a780e=util[_0x74f1('0x26')](_0x74f1('0x12e'),FILES_PATH,rs['generate'](0x4));var _0x18dc5e=util[_0x74f1('0x26')](_0x74f1('0xa4'),_0x1a780e,_0x209301);var _0x3225dd=!![];if(_0x5bcf59[_0x74f1('0x12f')]==='NOBEEP'){_0x3225dd=![];}var _0x2af07a=this['channel'][_0x74f1('0x131')](_0x1a780e,_0x209301,_0x5bcf59[_0x74f1('0x132')],_0x5bcf59[_0x74f1('0x69')],undefined,_0x3225dd);if(_0x2af07a['result']!==-0x1){this['channel'][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0x138'),_0x18dc5e));var _0x58f19b=this[_0x74f1('0x96')][_0x74f1('0xc2')](this,_0x5bcf59,_0x18dc5e);if(_0x58f19b){for(var _0x377a0a in _0x58f19b){if(_0x58f19b[_0x74f1('0xa1')](_0x377a0a)){this[_0x74f1('0x37')][_0x74f1('0xa5')](util['format']('TILDE_ASR_%s',_0x377a0a[_0x74f1('0x6d')]()),_0x58f19b[_0x377a0a]);}}return this[_0x74f1('0x37')][_0x74f1('0xae')](util['format'](_0x74f1('0x139'),JSON[_0x74f1('0x77')](_0x58f19b)));}}return _0x2af07a;};AGIVertices[_0x74f1('0xd')][_0x74f1('0x13a')]=function(_0x2244df){logger['info'](util[_0x74f1('0x26')](_0x74f1('0x13b'),_0x2244df[_0x74f1('0x35')]));return this[_0x74f1('0x37')][_0x74f1('0x13c')](_0x2244df[_0x74f1('0x3c')],_0x2244df[_0x74f1('0x3d')],_0x2244df[_0x74f1('0x3e')]);};AGIVertices[_0x74f1('0xd')][_0x74f1('0x13d')]=function(_0x2cea8b){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x13e'),_0x2cea8b['label']));if(!this['isConfigured'](_0x2cea8b[_0x74f1('0x13f')])){return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x2cea8b,'no\x20condition\x20configured');}try{var _0xd28a07=eval(_0x2cea8b[_0x74f1('0x13f')])?_0x74f1('0x140'):_0x74f1('0x141');this[_0x74f1('0x37')][_0x74f1('0xae')](util['format'](_0x74f1('0x142'),_0x2cea8b['condition'],_0xd28a07));return{'code':0xc8,'result':_0xd28a07};}catch(_0x1ff7ae){return{'code':0xc8,'result':_0x74f1('0x141')};}};AGIVertices[_0x74f1('0xd')]['gotoiftime']=function(_0x4643d7){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x143'),_0x4643d7[_0x74f1('0x35')]));if(!this['isConfigured'](_0x4643d7[_0x74f1('0x144')])){return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x4643d7,_0x74f1('0x145'));}var _0x36f189=this['getIntervals'][_0x74f1('0xc2')](this,_0x4643d7[_0x74f1('0x144')]);if(!_0x36f189){return this['channel'][_0x74f1('0x29')](_0x4643d7,_0x74f1('0x146'));}for(var _0x2ab635=0x0;_0x2ab635<_0x36f189['length'];_0x2ab635+=0x1){var _0x560507=this[_0x74f1('0x37')]['getVariable'](util['format'](_0x74f1('0x147'),_0x36f189[_0x2ab635]));if(_0x560507[_0x74f1('0xa8')]===-0x1){return _0x560507;}logger['info'](util[_0x74f1('0x26')](_0x74f1('0x148'),_0x36f189[_0x2ab635],_0x560507[_0x74f1('0xa6')]));if(_0x560507[_0x74f1('0xa6')]===_0x74f1('0x140')){logger['info'](util['format'](_0x74f1('0x148'),_0x36f189[_0x2ab635],_0x74f1('0x140')));this[_0x74f1('0x37')]['noop'](util[_0x74f1('0x26')]('IFTIME\x20%s\x20%s',_0x36f189[_0x2ab635],'true'));return{'code':0xc8,'result':_0x74f1('0x140')};}else{logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x148'),_0x36f189[_0x2ab635],_0x74f1('0x141')));this[_0x74f1('0x37')][_0x74f1('0xae')](util['format'](_0x74f1('0x148'),_0x36f189[_0x2ab635],_0x74f1('0x141')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x74f1('0xd')][_0x74f1('0x149')]=function(_0x8ca059){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x14a'),_0x8ca059[_0x74f1('0x35')]));return this[_0x74f1('0x37')]['hangup']();};AGIVertices[_0x74f1('0xd')]['ispeechasr']=function(_0x29f8c6){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x14b'),_0x29f8c6[_0x74f1('0x35')]));if(!this['isConfigured'](_0x29f8c6['key'])){return this[_0x74f1('0x37')]['noop'](_0x74f1('0x12c'));}var _0x26863d=_0x74f1('0x12d');var _0xd9518a=util[_0x74f1('0x26')](_0x74f1('0x12e'),FILES_PATH,rs[_0x74f1('0x114')](0x4));var _0x3fe64d=util['format']('%s.%s',_0xd9518a,_0x26863d);var _0x58f836=!![];if(_0x29f8c6[_0x74f1('0x12f')]==='NOBEEP'){_0x58f836=![];}var _0x1ecdc1=this['channel'][_0x74f1('0x131')](_0xd9518a,_0x26863d,_0x29f8c6['intKey'],_0x29f8c6[_0x74f1('0x69')],undefined,_0x58f836);if(_0x1ecdc1['result']!==-0x1){this[_0x74f1('0x37')][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0x14c'),_0x3fe64d));var _0x3c6d86=this[_0x74f1('0x87')][_0x74f1('0xc2')](this,_0x29f8c6,_0x3fe64d);if(_0x3c6d86){for(var _0x4c8852 in _0x3c6d86){if(_0x3c6d86[_0x74f1('0xa1')](_0x4c8852)){this['channel'][_0x74f1('0xa5')](util[_0x74f1('0x26')](_0x74f1('0x14d'),_0x4c8852[_0x74f1('0x6d')]()),_0x3c6d86[_0x4c8852]);}}return this['channel'][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0x14e'),JSON[_0x74f1('0x77')](_0x3c6d86)));}}return _0x1ecdc1;};AGIVertices[_0x74f1('0xd')][_0x74f1('0x14f')]=function(_0x1c4d88){logger[_0x74f1('0x2b')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x1c4d88[_0x74f1('0x35')]));if(!this['isConfigured'](_0x1c4d88[_0x74f1('0x85')])){return this['channel'][_0x74f1('0xae')](_0x74f1('0x12c'));}if(!this[_0x74f1('0x89')](_0x1c4d88['text'])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x74f1('0x37')][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0x150'),_0x1c4d88[_0x74f1('0x5f')]));var _0x50e554=this[_0x74f1('0x84')][_0x74f1('0xc2')](this,_0x1c4d88);if(_0x50e554){this[_0x74f1('0x37')]['noop'](util['format'](_0x74f1('0x14c'),_0x50e554));var _0x11c368=this[_0x74f1('0x37')][_0x74f1('0xfe')](_0x50e554,_0x1c4d88[_0x74f1('0x132')]);try{fs[_0x74f1('0x120')](_0x50e554+_0x74f1('0x121'));}catch(_0x215091){logger[_0x74f1('0x29')](_0x215091);}return _0x11c368;}return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x1c4d88,_0x74f1('0x151'));};AGIVertices[_0x74f1('0xd')][_0x74f1('0x152')]=function(_0x2570fc){logger[_0x74f1('0x2b')](util['format'](_0x74f1('0x153'),_0x2570fc[_0x74f1('0x35')]));if(!this[_0x74f1('0x89')](_0x2570fc['findBy'])){return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x2570fc,'no\x20find\x20by\x20configured');}logger['info'](util[_0x74f1('0x26')](_0x74f1('0x154'),this[_0x74f1('0x37')]['callerid'],_0x2570fc['findBy']));var _0x197ff0=this[_0x74f1('0x56')][_0x74f1('0xc2')](this,_0x2570fc[_0x74f1('0x155')]);if(_0x197ff0){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x156'),this[_0x74f1('0x37')]['callerid'],_0x2570fc[_0x74f1('0x155')]));this[_0x74f1('0x37')][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0x156'),this['channel'][_0x74f1('0x39')],_0x2570fc[_0x74f1('0x155')]));return{'code':0xc8,'result':_0x74f1('0x157')};}else{logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x158'),this[_0x74f1('0x37')]['callerid'],_0x2570fc[_0x74f1('0x155')]));this['channel']['noop'](util[_0x74f1('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x74f1('0x37')][_0x74f1('0x39')],_0x2570fc[_0x74f1('0x155')]));return{'code':0xc8,'result':_0x74f1('0x159')};}};AGIVertices[_0x74f1('0xd')][_0x74f1('0x15a')]=function(_0x30df5f){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x15b'),_0x30df5f[_0x74f1('0x35')]));if(!this[_0x74f1('0x89')](_0x30df5f[_0x74f1('0x155')])){return this[_0x74f1('0x37')]['error'](_0x30df5f,_0x74f1('0x15c'));}logger[_0x74f1('0x2b')](util['format'](_0x74f1('0x154'),this['channel'][_0x74f1('0x39')],_0x30df5f[_0x74f1('0x155')]));var _0x32f990=this[_0x74f1('0x55')][_0x74f1('0xc2')](this,_0x30df5f[_0x74f1('0x155')]);if(_0x32f990){logger[_0x74f1('0x2b')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x74f1('0x39')],_0x30df5f[_0x74f1('0x155')]));this[_0x74f1('0x37')][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0x156'),this['channel'][_0x74f1('0x39')],_0x30df5f[_0x74f1('0x155')]));return{'code':0xc8,'result':_0x74f1('0x157')};}else{logger[_0x74f1('0x2b')](util['format'](_0x74f1('0x158'),this[_0x74f1('0x37')]['callerid'],_0x30df5f[_0x74f1('0x155')]));this[_0x74f1('0x37')][_0x74f1('0xae')](util['format'](_0x74f1('0x158'),this[_0x74f1('0x37')][_0x74f1('0x39')],_0x30df5f[_0x74f1('0x155')]));return{'code':0xc8,'result':_0x74f1('0x159')};}};AGIVertices[_0x74f1('0xd')]['math']=function(_0xfd5688){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0xfd5688[_0x74f1('0x35')]));if(!this[_0x74f1('0x89')](_0xfd5688[_0x74f1('0x15d')])){return this[_0x74f1('0x37')][_0x74f1('0x29')](_0xfd5688,'no\x20operation\x20configured');}this[_0x74f1('0x37')][_0x74f1('0xae')](util['format'](_0x74f1('0x15e'),_0xfd5688['operation']));var _0x21d720=eval(_0xfd5688[_0x74f1('0x15d')]);if(!this[_0x74f1('0x89')](_0xfd5688[_0x74f1('0xd7')])){return this['channel'][_0x74f1('0xae')](_0x74f1('0xd8'));}var _0x247d74=this[_0x74f1('0xe')][_0x74f1('0xc2')](this,_0xfd5688[_0x74f1('0xd7')]);if(!_0x247d74){return this['channel']['error'](_0xfd5688,_0x74f1('0xd9'));}if(_[_0x74f1('0x9e')](_0x21d720)){var _0x1a4d66=this;_0x21d720[_0x74f1('0xda')](function(_0x5e75b0,_0x321d53){_0x1a4d66[_0x74f1('0x37')][_0x74f1('0xa5')](util['format'](_0x74f1('0x15f'),_0x247d74,_0x321d53),_0x5e75b0);});return this[_0x74f1('0x37')]['noop'](util[_0x74f1('0x26')]('variable\x20%s[key]\x20set',_0x247d74));}else{return this[_0x74f1('0x37')][_0x74f1('0xa5')](_0x247d74,_0x21d720);}};AGIVertices[_0x74f1('0xd')][_0x74f1('0x160')]=function(_0x2f1cc5){logger[_0x74f1('0x2b')](util['format'](_0x74f1('0x161'),_0x2f1cc5[_0x74f1('0x35')]));if(_0x2f1cc5[_0x74f1('0xab')]===0x0){return this[_0x74f1('0xaa')](_0x2f1cc5);}_0x2f1cc5[_0x74f1('0xab')]-=0x1;if(!this[_0x74f1('0x89')](_0x2f1cc5[_0x74f1('0x10d')])){return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x2f1cc5,_0x74f1('0x10e'));}var _0xa8dee0=this['getSound'][_0x74f1('0xc2')](this,_0x2f1cc5['file_id']);if(!_0xa8dee0){return this[_0x74f1('0x37')]['error'](_0x2f1cc5,_0x74f1('0x10f'));}var _0xbe360d=this['channel']['getData'](_0xa8dee0,_0x2f1cc5['response'],_0x2f1cc5[_0x74f1('0x162')]);var _0x3a5d51=_0xbe360d[_0x74f1('0xa8')];if(_0xbe360d[_0x74f1('0xa8')]===-0x1){this['createSquareDetailsReport'][_0x74f1('0xc2')](this,_0x2f1cc5,'-1');return _0xbe360d;}else if(_0xbe360d[_0x74f1('0xa6')]===_0x74f1('0x69')){_0xbe360d[_0x74f1('0xa8')]=_0xbe360d[_0x74f1('0xa8')][_0x74f1('0xa3')]>0x0?_0xbe360d['result']:'t';}else if(_[_0x74f1('0x44')](_0xbe360d[_0x74f1('0xa8')])){_0xbe360d[_0x74f1('0xa8')]='#';_0x3a5d51='#';}if(!this[_0x74f1('0x89')](_0x2f1cc5['variable_id'])){this[_0x74f1('0x37')]['noop'](_0x74f1('0xd8'));}else{var _0x385bad=this['getVariable']['sync'](this,_0x2f1cc5[_0x74f1('0xd7')]);if(!_0x385bad){return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x2f1cc5,_0x74f1('0xd9'));}this[_0x74f1('0x37')]['setVariable'](_0x385bad,_0x3a5d51);}this[_0x74f1('0x33')][_0x74f1('0xc2')](this,_0x2f1cc5,_0x3a5d51);return _0xbe360d;};AGIVertices[_0x74f1('0xd')][_0x74f1('0xae')]=function(_0x4c3fbb){logger[_0x74f1('0x2b')](util['format'](_0x74f1('0x163'),_0x4c3fbb[_0x74f1('0x35')]));return this[_0x74f1('0x37')][_0x74f1('0xae')](_0x4c3fbb[_0x74f1('0x164')]||_0x4c3fbb[_0x74f1('0x35')]);};AGIVertices[_0x74f1('0xd')][_0x74f1('0x165')]=function(_0x176800){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x176800[_0x74f1('0x35')]));if(!this[_0x74f1('0x89')](_0x176800[_0x74f1('0x155')])){return this[_0x74f1('0x37')]['error'](_0x176800,_0x74f1('0x15c'));}logger[_0x74f1('0x2b')](util['format'](_0x74f1('0x154'),this[_0x74f1('0x37')][_0x74f1('0x39')],_0x176800[_0x74f1('0x155')]));var _0x1300ed=this[_0x74f1('0x50')][_0x74f1('0xc2')](this,_0x176800[_0x74f1('0x166')]);var _0x535ec2=this[_0x74f1('0x52')][_0x74f1('0xc2')](this,_0x176800[_0x74f1('0x155')],_0x1300ed);if(_0x535ec2){logger['info'](util[_0x74f1('0x26')](_0x74f1('0x156'),this[_0x74f1('0x37')][_0x74f1('0x39')],_0x176800[_0x74f1('0x155')]));this[_0x74f1('0x37')][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0x156'),this[_0x74f1('0x37')][_0x74f1('0x39')],_0x176800[_0x74f1('0x155')]));return{'code':0xc8,'result':'success'};}else{logger[_0x74f1('0x2b')](util[_0x74f1('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x74f1('0x37')][_0x74f1('0x39')],_0x176800[_0x74f1('0x155')]));this[_0x74f1('0x37')]['noop'](util[_0x74f1('0x26')](_0x74f1('0x156'),this[_0x74f1('0x37')]['callerid'],_0x176800[_0x74f1('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['playback']=function(_0x56c291){logger[_0x74f1('0x2b')](util['format'](_0x74f1('0x167'),_0x56c291[_0x74f1('0x35')]));if(!this[_0x74f1('0x89')](_0x56c291[_0x74f1('0x10d')])){return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x56c291,_0x74f1('0x10e'));}var _0x4e8afd=this[_0x74f1('0x1b')][_0x74f1('0xc2')](this,_0x56c291[_0x74f1('0x10d')]);if(!_0x4e8afd){return this[_0x74f1('0x37')]['error'](_0x56c291,_0x74f1('0x10f'));}var _0x9152f7=this[_0x74f1('0x37')][_0x74f1('0x5a')](_0x74f1('0x168'),[_0x4e8afd,_0x56c291[_0x74f1('0xe4')]]);if(_0x9152f7['result']===-0x1){return _0x9152f7;}return this[_0x74f1('0x37')][_0x74f1('0xae')](util['format'](_0x74f1('0xc6'),_0x74f1('0x168'),_0x4e8afd));};AGIVertices[_0x74f1('0xd')][_0x74f1('0x169')]=function(_0x258005){logger[_0x74f1('0x2b')](util['format'](_0x74f1('0x16a'),_0x258005['label']));if(!this['isConfigured'](_0x258005[_0x74f1('0x16b')])){return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x258005,_0x74f1('0x16c'));}var _0x5d3506='';var _0x3d1234=parseInt(_0x258005[_0x74f1('0x16b')],0xa);if(isNaN(_0x3d1234)){_0x5d3506=_0x258005[_0x74f1('0x16b')];}else{_0x5d3506=this['getVoiceQueue']['sync'](this,_0x258005['queue_id']);if(!_0x5d3506){return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x258005,_0x74f1('0x16d'));}}var _0x306a98='';if(this['isConfigured'](_0x258005[_0x74f1('0x10d')])){var _0x24f0f4=this[_0x74f1('0x1b')]['sync'](this,_0x258005[_0x74f1('0x10d')]);if(_0x24f0f4){_0x306a98=_0x24f0f4;}}this[_0x74f1('0x33')][_0x74f1('0xc2')](this,_0x258005,_0x5d3506);if(_0x258005[_0x74f1('0xe4')][_0x74f1('0x16e')]('x')<0x0){_0x258005[_0x74f1('0xe4')]+='x';}if(_0x258005[_0x74f1('0xe4')][_0x74f1('0x16e')]('X')<0x0){_0x258005['opts']+='X';}this[_0x74f1('0x37')][_0x74f1('0xa5')](_0x74f1('0x16f'),_0x5d3506?_0x5d3506[_0x74f1('0x170')]():'');var _0x5c1352=this[_0x74f1('0x37')]['exec']('QUEUE',[_0x5d3506,_0x258005[_0x74f1('0xe4')],_0x258005['url'],_0x306a98,_0x258005[_0x74f1('0x69')],_0x258005['agi'],_0x258005['macro'],_0x258005['gosub'],'',_0x258005['position']]);if(_0x5c1352[_0x74f1('0xa8')]===-0x1){return _0x5c1352;}return this[_0x74f1('0x37')][_0x74f1('0xae')](util[_0x74f1('0x26')]('Executed\x20command\x20%s\x20%s',_0x74f1('0x171'),_0x5d3506));};AGIVertices['prototype'][_0x74f1('0x172')]=function(_0x29be93){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x173'),_0x29be93[_0x74f1('0x35')]));var _0x1540cd=_0x29be93[_0x74f1('0x174')]||'wav';var _0x45d149=util[_0x74f1('0x26')](_0x74f1('0x175'),this[_0x74f1('0x37')][_0x74f1('0x34')],rs[_0x74f1('0x114')](0x5));var _0x3e7df1=util[_0x74f1('0x26')](_0x74f1('0x176'),FILES_PATH,_0x45d149,_0x1540cd);var _0x4b4fb9=util[_0x74f1('0x26')](_0x74f1('0x12e'),FILES_PATH,_0x45d149);this['createSquareRecording'][_0x74f1('0xc2')](this,_0x29be93,_0x45d149,_0x3e7df1);this['channel'][_0x74f1('0xa5')](_0x74f1('0x177'),_0x45d149);logger[_0x74f1('0x2b')](_0x74f1('0x178'),_0x4b4fb9,_0x1540cd,_0x29be93['escape_digits'],_0x29be93[_0x74f1('0x69')]);return this[_0x74f1('0x37')][_0x74f1('0x131')](_0x4b4fb9,_0x1540cd,_0x29be93[_0x74f1('0x179')],_0x29be93['timeout'],undefined,!![]);};AGIVertices['prototype'][_0x74f1('0x17a')]=function(_0x38e8d3){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x17b'),_0x38e8d3['label']));if(!this[_0x74f1('0x89')](_0x38e8d3[_0x74f1('0x75')])){return this[_0x74f1('0x37')]['noop']('no\x20url\x20configured');}var _0x1b8b0e=this[_0x74f1('0x67')]['sync'](this,_0x38e8d3);logger[_0x74f1('0x2b')](util[_0x74f1('0x26')]('Response:',util[_0x74f1('0x17c')](_0x1b8b0e,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x38e8d3['variable_id'])){return this[_0x74f1('0x37')][_0x74f1('0xae')](_0x74f1('0x17d'));}var _0x5a3f9b=this[_0x74f1('0xe')]['sync'](this,_0x38e8d3[_0x74f1('0xd7')]);if(!_0x5a3f9b){return this['channel'][_0x74f1('0x29')](_0x38e8d3,_0x74f1('0xd9'));}this['channel'][_0x74f1('0xa5')](util[_0x74f1('0x26')](_0x74f1('0x17e'),_0x5a3f9b),_0x1b8b0e[_0x74f1('0x79')]?_0x1b8b0e['statusCode']:'200');this['channel'][_0x74f1('0xa5')](util[_0x74f1('0x26')]('%s_STATUS_MESSAGE',_0x5a3f9b),_0x1b8b0e[_0x74f1('0x7a')]?_0x1b8b0e[_0x74f1('0x7a')]:'OK');if(_0x1b8b0e[_0x74f1('0x6e')]){try{this[_0x74f1('0xa2')](_0x1b8b0e[_0x74f1('0x6e')],_0x5a3f9b);}catch(_0x1b9896){logger[_0x74f1('0x29')](util[_0x74f1('0x26')](_0x74f1('0x17f'),_0x5a3f9b));}}return this['channel'][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0x180'),_0x5a3f9b));};AGIVertices[_0x74f1('0xd')]['saydigits']=function(_0x4ef0d1){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x4ef0d1[_0x74f1('0x35')]));return this['channel'][_0x74f1('0x181')](_0x4ef0d1[_0x74f1('0x182')][_0x74f1('0x5b')](/\s+/g,''),_0x4ef0d1[_0x74f1('0x179')]);};AGIVertices[_0x74f1('0xd')][_0x74f1('0x183')]=function(_0x2f1772){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x184'),_0x2f1772[_0x74f1('0x35')]));return this[_0x74f1('0x37')][_0x74f1('0x185')](_0x2f1772[_0x74f1('0x186')][_0x74f1('0x5b')](/\s+/g,''),_0x2f1772[_0x74f1('0x179')]);};AGIVertices[_0x74f1('0xd')]['sayphonetic']=function(_0x144630){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x187'),_0x144630[_0x74f1('0x35')]));return this['channel']['sayPhonetic'](_0x144630['text'],_0x144630[_0x74f1('0x179')]);};AGIVertices[_0x74f1('0xd')]['sendMail']=function(_0x8e014b){logger[_0x74f1('0x2b')](util['format'](_0x74f1('0x188'),_0x8e014b[_0x74f1('0x35')]));if(!this['isConfigured'](_0x8e014b[_0x74f1('0x189')])){return this[_0x74f1('0x37')][_0x74f1('0xae')](_0x74f1('0x18a'));}var _0x591645=this[_0x74f1('0x1e')][_0x74f1('0xc2')](this,_0x8e014b[_0x74f1('0x189')]);if(!_0x591645||!_0x591645[_0x74f1('0x18b')]){return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x8e014b,_0x74f1('0x18c'));}var _0x40b434={'from':util[_0x74f1('0x26')]('\x22%s\x22\x20<%s>',_0x591645['name'],_0x591645[_0x74f1('0x18d')]||_0x591645[_0x74f1('0x18b')][_0x74f1('0x18e')]),'to':_0x8e014b['to']||'','cc':_0x8e014b['cc']||'','bcc':_0x8e014b[_0x74f1('0x18f')]||'','subject':_0x8e014b[_0x74f1('0x190')],'html':_0x8e014b[_0x74f1('0x5f')],'text':_0x8e014b[_0x74f1('0x5f')]};if(this[_0x74f1('0x89')](_0x8e014b[_0x74f1('0x191')])){}logger['debug'](_0x74f1('0x192'),JSON[_0x74f1('0x77')](_0x40b434));this[_0x74f1('0x33')][_0x74f1('0xc2')](this,_0x8e014b,_0x8e014b[_0x74f1('0x189')]);this[_0x74f1('0x37')][_0x74f1('0xae')](util['format'](_0x74f1('0x193'),_0x591645['name']));this[_0x74f1('0x20')][_0x74f1('0xc2')](this,_0x591645[_0x74f1('0x194')],_0x40b434);return this['channel']['noop'](_0x74f1('0x195'));};AGIVertices[_0x74f1('0xd')]['sendFax']=function(_0x3cc349){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x196'),_0x3cc349[_0x74f1('0x35')]));return this['channel'][_0x74f1('0xae')](_0x74f1('0x197'));};AGIVertices['prototype'][_0x74f1('0x198')]=function(_0x4b3406){logger[_0x74f1('0x2b')](util['format'](_0x74f1('0x199'),_0x4b3406[_0x74f1('0x35')]));if(!this[_0x74f1('0x89')](_0x4b3406[_0x74f1('0x19a')])){return this[_0x74f1('0x37')]['noop'](_0x74f1('0x19b'));}var _0x24b66e=this[_0x74f1('0x19c')][_0x74f1('0xc2')](this,_0x4b3406['sms_account_id']);if(!_0x24b66e){return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x4b3406,'no\x20sms\x20account\x20found');}var _0x17bb59={'body':_0x4b3406[_0x74f1('0x19d')],'phone':_0x4b3406['to']||'','SmsAccountId':_0x24b66e['id']};logger[_0x74f1('0x19e')]('sendSMS\x20message',JSON[_0x74f1('0x77')](_0x17bb59));this[_0x74f1('0x33')][_0x74f1('0xc2')](this,_0x4b3406,_0x4b3406[_0x74f1('0x19a')]);this['channel']['noop'](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x24b66e[_0x74f1('0x11')]));this[_0x74f1('0x32')][_0x74f1('0xc2')](this,_0x17bb59);return this['channel'][_0x74f1('0xae')](_0x74f1('0x19f'));};AGIVertices[_0x74f1('0xd')][_0x74f1('0x1a0')]=function(_0x158b65){logger['info'](util[_0x74f1('0x26')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x158b65['label']));if(!this['isConfigured'](_0x158b65[_0x74f1('0xd7')])){return this['channel'][_0x74f1('0x29')](_0x158b65,_0x74f1('0x1a1'));}var _0xa67273=this[_0x74f1('0xe')][_0x74f1('0xc2')](this,_0x158b65[_0x74f1('0xd7')]);if(!_0xa67273){return this[_0x74f1('0x37')][_0x74f1('0x29')](_0x158b65,'no\x20variable\x20found');}return this[_0x74f1('0x37')][_0x74f1('0xa5')](_0xa67273,_0x158b65['variable_value']);};AGIVertices[_0x74f1('0xd')]['start']=function(_0x4da1bb){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')]('Enter\x20in\x20START\x20(%s)\x20block',_0x4da1bb[_0x74f1('0x35')]));this[_0x74f1('0x37')][_0x74f1('0xae')](_0x74f1('0x1a2'));var _0x354bcf=this[_0x74f1('0x37')][_0x74f1('0xe')]('XMCS-UNIQUEID');if(!_['isEmpty'](_0x354bcf[_0x74f1('0xa6')])){this[_0x74f1('0x37')][_0x74f1('0x34')]=_0x354bcf[_0x74f1('0xa6')];}if(_0x4da1bb[_0x74f1('0xba')]===_0x74f1('0x1a3')){this['channel'][_0x74f1('0xae')](_0x74f1('0x1a4'));return this[_0x74f1('0x37')]['answer']();}return this[_0x74f1('0x37')]['noop']('Skipped\x20Answer');};AGIVertices[_0x74f1('0xd')][_0x74f1('0x1a5')]=function(_0x227fb9){logger['info'](util[_0x74f1('0x26')](_0x74f1('0x1a6'),_0x227fb9[_0x74f1('0x35')]));if(!this[_0x74f1('0x89')](_0x227fb9['project_id'])){return this[_0x74f1('0x37')]['error'](_0x227fb9,'no\x20subproject\x20selected');}var _0x49af51=this[_0x74f1('0x14')][_0x74f1('0xc2')](this,_0x227fb9[_0x74f1('0x1a7')]);if(!this[_0x74f1('0x89')](_0x49af51)){return this['channel'][_0x74f1('0x29')](_0x227fb9,util[_0x74f1('0x26')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x227fb9[_0x74f1('0x1a7')]));}if(_0x49af51===this['channel'][_0x74f1('0x38')]){return this[_0x74f1('0x37')]['error'](_0x227fb9,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x74f1('0x33')][_0x74f1('0xc2')](this,_0x227fb9,_0x49af51);var _0x51fce6=this['channel'][_0x74f1('0x5a')](_0x74f1('0x1a8'),util[_0x74f1('0x26')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x74f1('0x7')]['host']||_0x74f1('0x1a9'),_0x49af51,this[_0x74f1('0x37')][_0x74f1('0x38')]));if(_0x51fce6['result']===-0x1){return _0x51fce6;}return this[_0x74f1('0x37')]['noop'](util[_0x74f1('0x26')](_0x74f1('0xc6'),'AGI',_0x49af51));};AGIVertices[_0x74f1('0xd')][_0x74f1('0x1aa')]=function(_0x1f892a){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x1ab'),_0x1f892a[_0x74f1('0x35')]));var _0x4e0dc1=this[_0x74f1('0x1ac')][_0x74f1('0xc2')](this,_0x1f892a['command']);this[_0x74f1('0x33')]['sync'](this,_0x1f892a,_0x1f892a['command']);if(this[_0x74f1('0x89')](_0x1f892a[_0x74f1('0xd7')])){var _0x22d225=this[_0x74f1('0xe')][_0x74f1('0xc2')](this,_0x1f892a[_0x74f1('0xd7')]);if(_0x22d225){this['channel'][_0x74f1('0xa5')](_0x22d225,_0x4e0dc1);return this[_0x74f1('0x37')]['noop'](util[_0x74f1('0x26')](_0x74f1('0x1ad'),_0x1f892a[_0x74f1('0xb8')],_0x22d225));}}return this[_0x74f1('0x37')][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0x1ae'),_0x1f892a[_0x74f1('0xb8')]));};AGIVertices[_0x74f1('0xd')][_0x74f1('0x1af')]=function(_0x5ab8f4){logger['info'](util[_0x74f1('0x26')](_0x74f1('0x1b0'),_0x5ab8f4[_0x74f1('0x35')]));_0x5ab8f4[_0x74f1('0x5f')]=_0x5ab8f4['text'][_0x74f1('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x74f1('0x89')](_0x5ab8f4[_0x74f1('0x5d')])){return this[_0x74f1('0x37')][_0x74f1('0xae')]('no\x20apiKey\x20configured');}if(!this[_0x74f1('0x89')](_0x5ab8f4[_0x74f1('0x5f')])){return this[_0x74f1('0x37')][_0x74f1('0xae')](_0x74f1('0xc8'));}this[_0x74f1('0x37')][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0x1b1'),_0x5ab8f4[_0x74f1('0x5f')]));var _0x264175=this[_0x74f1('0x5c')]['sync'](this,_0x5ab8f4);if(_0x264175){this[_0x74f1('0x37')][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0x1b2'),_0x264175));var _0x560a24=this[_0x74f1('0x37')][_0x74f1('0xfe')](_0x264175);try{fs[_0x74f1('0x120')](_0x264175+_0x74f1('0x121'));}catch(_0x141de8){logger['error'](_0x141de8);}return _0x560a24;}return this['channel'][_0x74f1('0x29')](_0x5ab8f4,_0x74f1('0x1b3'));};AGIVertices[_0x74f1('0xd')][_0x74f1('0x1b4')]=function(_0x2b7d7c){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x1b5'),_0x2b7d7c[_0x74f1('0x35')]));_0x2b7d7c['text']=_0x2b7d7c['text'][_0x74f1('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x2b7d7c[_0x74f1('0x5f')])){return this[_0x74f1('0x37')][_0x74f1('0xae')]('no\x20text\x20configured');}this[_0x74f1('0x37')][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0x1b6'),_0x2b7d7c['text']));var _0x5e622f=this['googleTTS']['sync'](this,_0x2b7d7c);if(_0x5e622f){this[_0x74f1('0x37')][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0x1b7'),_0x5e622f));var _0x3bf5cd=this['channel']['streamFile'](_0x5e622f);try{fs[_0x74f1('0x120')](_0x5e622f+_0x74f1('0x121'));}catch(_0xe22fb3){logger[_0x74f1('0x29')](_0xe22fb3);}return _0x3bf5cd;}return this[_0x74f1('0x37')]['error'](_0x2b7d7c,_0x74f1('0x1b8'));};AGIVertices[_0x74f1('0xd')]['unpause']=function(_0xf8875c){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x1b9'),_0xf8875c[_0x74f1('0x35')]));if(!this[_0x74f1('0x89')](_0xf8875c[_0x74f1('0x155')])){return this[_0x74f1('0x37')][_0x74f1('0x29')](_0xf8875c,_0x74f1('0x15c'));}logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x154'),this[_0x74f1('0x37')]['callerid'],_0xf8875c[_0x74f1('0x155')]));var _0x3bfef9=this[_0x74f1('0x53')][_0x74f1('0xc2')](this,_0xf8875c[_0x74f1('0x155')]);if(_0x3bfef9){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x74f1('0x37')][_0x74f1('0x39')],_0xf8875c['findBy']));this['channel']['noop'](util[_0x74f1('0x26')](_0x74f1('0x156'),this['channel'][_0x74f1('0x39')],_0xf8875c[_0x74f1('0x155')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x74f1('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0xf8875c[_0x74f1('0x155')]));this[_0x74f1('0x37')][_0x74f1('0xae')](util[_0x74f1('0x26')](_0x74f1('0x158'),this[_0x74f1('0x37')][_0x74f1('0x39')],_0xf8875c[_0x74f1('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x74f1('0xd')][_0x74f1('0x1ba')]=function(_0x747ff3){logger[_0x74f1('0x2b')](util[_0x74f1('0x26')](_0x74f1('0x1bb'),_0x747ff3[_0x74f1('0x35')]));var _0x18bbbc=this[_0x74f1('0x37')][_0x74f1('0x5a')](_0x74f1('0x1bc'),[_0x747ff3[_0x74f1('0x1bd')],_0x747ff3[_0x74f1('0x7d')]]);if(_0x18bbbc[_0x74f1('0xa8')]===-0x1){return _0x18bbbc;}return this[_0x74f1('0x37')][_0x74f1('0xae')](util['format'](_0x74f1('0xc6'),'VOICEMAIL',_0x747ff3[_0x74f1('0x1bd')]));};AGIVertices[_0x74f1('0xd')]['vswitch']=function(_0x142b22){logger[_0x74f1('0x2b')](util['format'](_0x74f1('0x1be'),_0x142b22['label']));if(!this[_0x74f1('0x89')](_0x142b22[_0x74f1('0xd7')])){return this['channel'][_0x74f1('0x29')](_0x142b22,'no\x20variable\x20selected');}var _0x37fe12=this['getVariable'][_0x74f1('0xc2')](this,_0x142b22[_0x74f1('0xd7')]);if(!_0x37fe12){return this['channel'][_0x74f1('0x29')](_0x142b22,_0x74f1('0xd9'));}var _0x497a12=this[_0x74f1('0x37')]['getVariable'](_0x37fe12);return{'code':0xc8,'result':_0x497a12['extra']?_0x497a12[_0x74f1('0xa6')]:'-'};};String['prototype'][_0x74f1('0x1bf')]=function(_0x52ddee,_0x5638fd){return this[_0x74f1('0x1c0')](_0x52ddee)[_0x74f1('0x1c1')](_0x5638fd);};module[_0x74f1('0x1c2')]=AGIVertices; \ No newline at end of file +var _0xb138=['vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','mailRpc','prototype','getVariable','getVariableById','then','name','catch','rpc','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','query','Error\x20executing\x20query\x20%s','info','Query\x20executed\x20correctly\x20%s','close','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','callback_','lastName','isNil','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','MP3','googleTTS','google_tts_language','restAPI','url','timeout','number','includes','POST','PUT','method','toUpperCase','body','rawBody','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','appid','appsecret','isString','replaceObjectAllVariables','isPlainObject','isArray','length','recursiveNodeIndex','replaceAllVariables','saveRestApiResult','hasOwnProperty','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','isConfigured','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','callback_priority','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','out','speech','Dialogflow\x20is\x20unreachable','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','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','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','no\x20key\x20configured','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','%s.%s','NOBEEP','tilde\x20%s\x20file\x20created','tildeASR','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','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','operation','math\x20%s','no\x20variable\x20found','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20selected','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','position','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','statusCode','200','%s_STATUS_MESSAGE','statusMessage','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','Answer','Skipped\x20Answer','subproject','no\x20subproject\x20selected','getSquareProject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','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','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL'];(function(_0x38ff6c,_0x3b8e2b){var _0x1ee0c1=function(_0x10533d){while(--_0x10533d){_0x38ff6c['push'](_0x38ff6c['shift']());}};_0x1ee0c1(++_0x3b8e2b);}(_0xb138,0x1dd));var _0x8b13=function(_0x374888,_0x4fe130){_0x374888=_0x374888-0x0;var _0x39fc0a=_0xb138[_0x374888];return _0x39fc0a;};'use strict';var fs=require('fs');var util=require(_0x8b13('0x0'));var _=require(_0x8b13('0x1'));var sh=require(_0x8b13('0x2'));var odbc=require(_0x8b13('0x3'))();var rs=require(_0x8b13('0x4'));var moment=require(_0x8b13('0x5'));var Mustache=require(_0x8b13('0x6'));var rp=require('request-promise');var logger=require(_0x8b13('0x7'))(_0x8b13('0x8'));var config=require(_0x8b13('0x9'));var scripts=require('./scripts');var FILES_PATH=_0x8b13('0xa');var recursiveMapAttributes=[_0x8b13('0xb'),'rawBody'];var verticesWithRetry=[_0x8b13('0xc'),_0x8b13('0xd'),_0x8b13('0xe')];var AGIVertices=function(_0x498832,_0x8570b0,_0x1aed6f){this['channel']=_0x498832;this['rpc']=_0x8570b0;this[_0x8b13('0xf')]=_0x1aed6f;};AGIVertices[_0x8b13('0x10')][_0x8b13('0x11')]=function(_0x439451,_0x3e8eca){this['rpc'][_0x8b13('0x12')](_0x439451)[_0x8b13('0x13')](function(_0x1a93c4){_0x3e8eca(null,_0x1a93c4?_0x1a93c4[_0x8b13('0x14')]:![]);})[_0x8b13('0x15')](function(_0x1893b1){_0x3e8eca(_0x1893b1);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x3dcde6,_0x130a6f){this['rpc']['getVoiceQueueById'](_0x3dcde6)['then'](function(_0x272cb0){_0x130a6f(null,_0x272cb0?_0x272cb0[_0x8b13('0x14')]:![]);})[_0x8b13('0x15')](function(_0x2c615a){_0x130a6f(_0x2c615a);});};AGIVertices[_0x8b13('0x10')]['getSquareProject']=function(_0x1c6c99,_0xea7881){this[_0x8b13('0x16')][_0x8b13('0x17')](_0x1c6c99)[_0x8b13('0x13')](function(_0x1fcfe6){_0xea7881(null,_0x1fcfe6?_0x1fcfe6[_0x8b13('0x14')]:![]);})[_0x8b13('0x15')](function(_0x4989d3){_0xea7881(_0x4989d3);});};AGIVertices['prototype'][_0x8b13('0x18')]=function(_0x335709,_0x14a8ac){this[_0x8b13('0x16')][_0x8b13('0x19')](_0x335709)[_0x8b13('0x13')](function(_0x559442){_0x14a8ac(null,_0x559442?_0x559442[_0x8b13('0x1a')]:![]);})[_0x8b13('0x15')](function(_0x1595d8){_0x14a8ac(_0x1595d8);});};AGIVertices['prototype']['getUser']=function(_0xe73329,_0xcb7621){this['rpc'][_0x8b13('0x1b')](_0xe73329)[_0x8b13('0x13')](function(_0x37ca5f){_0xcb7621(null,_0x37ca5f?_0x37ca5f[_0x8b13('0x14')]:![]);})[_0x8b13('0x15')](function(_0x583639){_0xcb7621(_0x583639);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x1c')]=function(_0x5f15f0,_0x33422f){this['rpc'][_0x8b13('0x1d')](_0x5f15f0)[_0x8b13('0x13')](function(_0x54786a){_0x33422f(null,_0x54786a?_0x54786a[_0x8b13('0x14')]:![]);})[_0x8b13('0x15')](function(_0x4f8e58){_0x33422f(_0x4f8e58);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x1e')]=function(_0x410122,_0x4048e4){var _0x27fef3=this;this['rpc'][_0x8b13('0x1f')](_0x410122)[_0x8b13('0x13')](function(_0x3475d8){_0x4048e4(null,_0x3475d8?_0x27fef3[_0x8b13('0x20')](_0x3475d8[_0x8b13('0x21')]):![]);})[_0x8b13('0x15')](function(_0x5ab161){_0x4048e4(_0x5ab161);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x22')]=function(_0x109f0e,_0x9d2377){this[_0x8b13('0x16')][_0x8b13('0x23')](_0x109f0e)[_0x8b13('0x13')](function(_0x44bce2){_0x9d2377(null,_0x44bce2?_0x44bce2:![]);})[_0x8b13('0x15')](function(_0x5751db){_0x9d2377(_0x5751db);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x24')]=function(_0x288ff7,_0x2878a6,_0x51a334){this['mailRpc'][_0x8b13('0x24')](_0x288ff7,_0x2878a6)['then'](function(){_0x51a334(null);})['catch'](function(_0x3b1dfa){_0x51a334(_0x3b1dfa);});};AGIVertices['prototype'][_0x8b13('0x25')]=function(_0x408626,_0x40fc29){this[_0x8b13('0x16')][_0x8b13('0x26')](_0x408626)[_0x8b13('0x13')](function(_0x1fcd82){if(_0x1fcd82){if(_0x1fcd82[_0x8b13('0x27')]){_0x40fc29(null,[_0x1fcd82[_0x8b13('0x28')]]);}else{_0x40fc29(null,_[_0x8b13('0x29')](_0x1fcd82['Intervals'],_0x8b13('0x28')));}}else{_0x40fc29(null,![]);}})[_0x8b13('0x15')](function(_0x19b21c){_0x40fc29(_0x19b21c);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x20')]=function(_0x24179a){return util[_0x8b13('0x2a')](_0x8b13('0x2b'),FILES_PATH,_0x24179a);};AGIVertices['prototype'][_0x8b13('0x2c')]=function(_0x5089c6,_0x3826a5,_0x37732c){odbc[_0x8b13('0x2d')](_0x5089c6,function(_0x5e63f6){if(_0x5e63f6){logger[_0x8b13('0x2e')](_0x8b13('0x2f'),_0x5e63f6);_0x37732c(_0x5e63f6);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0x8b13('0x30')](_0x3826a5,function(_0x5daee9,_0x3ed902){if(_0x5daee9){logger['info'](_0x8b13('0x31'),_0x3826a5);_0x37732c(_0x5daee9);}else{logger[_0x8b13('0x32')](_0x8b13('0x33'),_0x3826a5);odbc[_0x8b13('0x34')](function(_0x3a221d){if(_0x3a221d){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x3a221d);}_0x37732c(null,_0x3ed902);});}});}});};AGIVertices[_0x8b13('0x10')]['getSmsAccount']=function(_0x6ba2f3,_0x9f2d81){this['rpc'][_0x8b13('0x35')](_0x6ba2f3)[_0x8b13('0x13')](function(_0x35c1d6){_0x9f2d81(null,_0x35c1d6?_0x35c1d6:![]);})[_0x8b13('0x15')](function(_0x2f4e7f){_0x9f2d81(_0x2f4e7f);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x36')]=function(_0x516c70,_0x5a3f5c){this['rpc'][_0x8b13('0x36')](_0x516c70)[_0x8b13('0x13')](function(_0x27cfe5){_0x5a3f5c(null,_0x27cfe5);})[_0x8b13('0x15')](function(_0x2e6e78){_0x5a3f5c(_0x2e6e78);});};AGIVertices[_0x8b13('0x10')]['createSquareDetailsReport']=function(_0x4342db,_0x50e535,_0x13d0ef){this['rpc'][_0x8b13('0x37')]({'uniqueid':this[_0x8b13('0x38')][_0x8b13('0x39')],'node':_0x4342db[_0x8b13('0x3a')],'application':_0x4342db[_0x8b13('0x3b')],'data':_0x50e535||null,'project_name':this[_0x8b13('0x38')][_0x8b13('0x3c')],'callerid':this['channel']['callerid']})['then'](function(_0xbe4d36){if(_0x13d0ef){_0x13d0ef(null,_0xbe4d36);}})[_0x8b13('0x15')](function(_0x288faa){if(_0x13d0ef){_0x13d0ef(_0x288faa);}});};AGIVertices[_0x8b13('0x10')]['createSquareRecording']=function(_0x5e9d93,_0x3f420d,_0x54d19d,_0x24262a){this[_0x8b13('0x16')][_0x8b13('0x3d')]({'uniqueid':this[_0x8b13('0x38')][_0x8b13('0x39')],'callerid':this['channel'][_0x8b13('0x3e')],'calleridname':this[_0x8b13('0x38')][_0x8b13('0x3f')],'context':this[_0x8b13('0x38')][_0x8b13('0x40')],'extension':this[_0x8b13('0x38')][_0x8b13('0x41')],'priority':this[_0x8b13('0x38')][_0x8b13('0x42')],'accountcode':this['channel'][_0x8b13('0x43')],'dnid':this['channel'][_0x8b13('0x44')],'projectName':this[_0x8b13('0x38')][_0x8b13('0x3c')],'saveName':_0x3f420d,'filename':_0x5e9d93['file']||_0x3f420d,'savePath':_0x54d19d})[_0x8b13('0x13')](function(_0x35f612){_0x24262a(null,_0x35f612);})[_0x8b13('0x15')](function(_0x4129c0){_0x24262a(_0x4129c0);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x45')]=function(_0x453cd4,_0x534636,_0x2c8594,_0x4c833d,_0x19b70b){this[_0x8b13('0x16')][_0x8b13('0x45')]({'uniqueid':this[_0x8b13('0x38')][_0x8b13('0x39')],'body':_0x453cd4,'direction':_0x534636,'providerName':_0x2c8594,'providerResponse':_0x4c833d})[_0x8b13('0x13')](function(_0x411ad2){if(_0x19b70b){_0x19b70b(null,_0x411ad2);}})[_0x8b13('0x15')](function(_0x3de913){if(_0x19b70b){_0x19b70b(_0x3de913);}});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x46')]=function(_0xddac8e,_0xd55f3b){this[_0x8b13('0x16')][_0x8b13('0x46')]({'firstName':_[_0x8b13('0x47')](_0xddac8e[_0x8b13('0x14')])||_['isNil'](_0xddac8e[_0x8b13('0x14')])?_0x8b13('0x48')+Math['random']():_0xddac8e[_0x8b13('0x14')],'lastName':_[_0x8b13('0x47')](_0xddac8e[_0x8b13('0x49')])||_[_0x8b13('0x4a')](_0xddac8e[_0x8b13('0x49')])?null:_0xddac8e[_0x8b13('0x49')],'phone':_0xddac8e[_0x8b13('0x4b')],'ListId':_0xddac8e[_0x8b13('0x4c')],'scheduledat':_0xddac8e[_0x8b13('0x4d')],'callbackUniqueid':this[_0x8b13('0x38')][_0x8b13('0x39')],'tags':_0x8b13('0x4e'),'description':_0x8b13('0x4f')+_0xddac8e[_0x8b13('0x4d')][_0x8b13('0x50')](),'priority':_0xddac8e['callback_priority']})[_0x8b13('0x13')](function(_0x2f065f){_0xd55f3b(null,_0x2f065f);})['catch'](function(_0x11e8af){_0xd55f3b(_0x11e8af);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x51')]=function(_0x46c595,_0x1263f4){this['rpc'][_0x8b13('0x52')](_0x46c595)[_0x8b13('0x13')](function(_0x46850a){_0x1263f4(null,_0x46850a?_0x46850a['name']:![]);})[_0x8b13('0x15')](function(_0x17ab12){_0x1263f4(_0x17ab12);});};AGIVertices['prototype'][_0x8b13('0x53')]=function(_0x348c11,_0x475c8d,_0xd29067){var _0x49e5cd={'role':_0x8b13('0x54')};_0x49e5cd[_0x348c11]=this[_0x8b13('0x38')]['callerid'];this[_0x8b13('0x16')][_0x8b13('0x53')](_0x49e5cd,_0x475c8d,this[_0x8b13('0x38')][_0x8b13('0x39')])['then'](function(_0x2bdc5c){_0xd29067(null,_[_0x8b13('0x4a')](_0x2bdc5c)?![]:!![]);})[_0x8b13('0x15')](function(_0xd54429){logger[_0x8b13('0x2e')](_0xd54429);_0xd29067(null,![]);});};AGIVertices[_0x8b13('0x10')]['agentUnpause']=function(_0x123f52,_0x1082d9){var _0x445283={'role':'agent'};_0x445283[_0x123f52]=this[_0x8b13('0x38')][_0x8b13('0x3e')];this[_0x8b13('0x16')][_0x8b13('0x55')](_0x445283)['then'](function(_0x59a6b3){_0x1082d9(null,_['isNil'](_0x59a6b3)?![]:!![]);})['catch'](function(_0x4fedbf){logger[_0x8b13('0x2e')](_0x4fedbf);_0x1082d9(null,![]);});};AGIVertices[_0x8b13('0x10')]['agentLogout']=function(_0x2934c8,_0x5c3928){var _0x274bad={'role':_0x8b13('0x54')};_0x274bad[_0x2934c8]=this[_0x8b13('0x38')][_0x8b13('0x3e')];this[_0x8b13('0x16')][_0x8b13('0x56')](_0x274bad)[_0x8b13('0x13')](function(_0x4c433c){_0x5c3928(null,_[_0x8b13('0x4a')](_0x4c433c)?![]:!![]);})['catch'](function(_0xa31d7d){logger[_0x8b13('0x2e')](_0xa31d7d);_0x5c3928(null,![]);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x57')]=function(_0x3fff75,_0x41a033){var _0x10f1bf={'role':'agent'};_0x10f1bf[_0x3fff75]=this[_0x8b13('0x38')]['callerid'];var _0x2b109c=_0x3fff75!=_0x8b13('0x58')?util[_0x8b13('0x2a')](_0x8b13('0x59'),_0x8b13('0x5a'),this['channel']['callerid']):undefined;this[_0x8b13('0x16')][_0x8b13('0x57')](_0x10f1bf,_0x2b109c)['then'](function(_0x180866){_0x41a033(null,_[_0x8b13('0x4a')](_0x180866)?![]:!![]);})[_0x8b13('0x15')](function(_0x51545e){logger[_0x8b13('0x2e')](_0x51545e);_0x41a033(null,![]);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x5b')]=function(_0x228e63,_0x52850c){sh[_0x8b13('0x5c')](_[_0x8b13('0x5d')](_0x228e63),function(_0x4f062d,_0x215f9b){var _0x3bfd74=_0x215f9b[_0x8b13('0x5e')](/(\r\n|\n|\r)/gm,'');_0x52850c(null,_0x3bfd74);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x5f')]=function(_0x1243f8,_0x4334c1){scripts[_0x8b13('0x5f')](_0x1243f8[_0x8b13('0x60')],_0x1243f8[_0x8b13('0x61')]||_0x8b13('0x62'),_0x1243f8[_0x8b13('0x62')],_0x1243f8[_0x8b13('0x63')]||_0x8b13('0x64'),_0x1243f8['ssmlGender']||_0x8b13('0x65'),_0x1243f8['audioEncoding']||_0x8b13('0x66'))[_0x8b13('0x13')](function(_0x31fc95){_0x4334c1(null,_0x31fc95);})[_0x8b13('0x15')](function(_0x564b4d){_0x4334c1(_0x564b4d);});};AGIVertices['prototype'][_0x8b13('0x67')]=function(_0x2236b5,_0x4d8c62){scripts[_0x8b13('0x67')](_0x2236b5[_0x8b13('0x62')],_0x2236b5[_0x8b13('0x68')]||'en',0x1)[_0x8b13('0x13')](function(_0x7499cb){_0x4d8c62(null,_0x7499cb);})[_0x8b13('0x15')](function(_0x15b553){_0x4d8c62(_0x15b553);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x69')]=function(_0x24211c,_0x48fd36){var _0x2a1fd3={'uri':_0x24211c[_0x8b13('0x6a')],'method':_0x24211c['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x24211c[_0x8b13('0x6b')])===_0x8b13('0x6c')&&parseInt(_0x24211c['timeout'])>=0x1?parseInt(_0x24211c[_0x8b13('0x6b')])*0x3e8:0x5*0x3e8};if(_[_0x8b13('0x6d')]([_0x8b13('0x6e'),_0x8b13('0x6f')],_0x2a1fd3[_0x8b13('0x70')][_0x8b13('0x71')]())){try{_0x2a1fd3[_0x8b13('0x72')]=_0x24211c[_0x8b13('0x73')]?JSON['parse'](_0x24211c[_0x8b13('0x73')]):{};}catch(_0x213b43){logger[_0x8b13('0x2e')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x213b43);}}try{_0x2a1fd3[_0x8b13('0x74')]=_0x24211c['rawHeaders']?JSON[_0x8b13('0x75')](_0x24211c[_0x8b13('0xb')]):{};}catch(_0x38a1ce){logger[_0x8b13('0x2e')](_0x8b13('0x76'),_0x38a1ce);}if(_0x24211c[_0x8b13('0x77')]){try{var _0x41cefe=require(_0x24211c[_0x8b13('0x77')])[_0x8b13('0x78')](this,_0x2a1fd3);_0x2a1fd3[_0x8b13('0x79')]=Mustache['render'](_0x24211c[_0x8b13('0x6a')],_0x41cefe,{},['$$','$$']);if(_0x2a1fd3[_0x8b13('0x74')]){_0x2a1fd3[_0x8b13('0x74')]=JSON[_0x8b13('0x75')](Mustache[_0x8b13('0x7a')](JSON[_0x8b13('0x7b')](_0x2a1fd3[_0x8b13('0x74')]),_0x41cefe,{},['$$','$$']));}if(_0x2a1fd3[_0x8b13('0x72')]){_0x2a1fd3[_0x8b13('0x72')]=JSON[_0x8b13('0x75')](Mustache[_0x8b13('0x7a')](JSON[_0x8b13('0x7b')](_0x2a1fd3[_0x8b13('0x72')]),_0x41cefe,{},['$$','$$']));}}catch(_0x4bb71a){logger['error'](_0x8b13('0x7c'),_0x4bb71a);}}rp(_0x2a1fd3)['then'](function(_0x22e10a){var _0x38a1de={'statusCode':_0x22e10a['statusCode']||0xc8,'statusMessage':_0x22e10a['statusMessage']||'OK','headers':_0x22e10a[_0x8b13('0x74')]||{},'body':_0x22e10a[_0x8b13('0x72')]||{}};_0x48fd36(null,_0x38a1de);})[_0x8b13('0x15')](function(_0x1d037a){var _0xed5531={'statusCode':_0x1d037a['statusCode']||0x1f4,'statusMessage':_0x1d037a[_0x8b13('0x7d')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x1d037a[_0x8b13('0x7e')][_0x8b13('0x74')]||{},'body':_0x1d037a['options'][_0x8b13('0x72')]||{}};_0x48fd36(null,_0xed5531);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x7f')]=function(_0x34cee5,_0x2f1ddf){scripts['googleDialogflow'](this[_0x8b13('0x38')][_0x8b13('0x39')],_0x34cee5[_0x8b13('0x80')],_0x34cee5['text'],_0x34cee5[_0x8b13('0x81')]||'en')['then'](function(_0x3bfb06){_0x2f1ddf(null,_0x3bfb06);})[_0x8b13('0x15')](function(_0x3f9df4){_0x2f1ddf(_0x3f9df4);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x82')]=function(_0xe70f1b,_0x441173){scripts[_0x8b13('0x82')](this[_0x8b13('0x38')][_0x8b13('0x39')],_0xe70f1b['dialogflowV2_project_id'],_0xe70f1b[_0x8b13('0x83')],_0xe70f1b[_0x8b13('0x84')],_0xe70f1b[_0x8b13('0x62')],_0xe70f1b[_0x8b13('0x85')]||'en')[_0x8b13('0x13')](function(_0x52e7d6){_0x441173(null,_0x52e7d6);})[_0x8b13('0x15')](function(_0x45dc31){_0x441173(_0x45dc31);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x86')]=function(_0x4f601d,_0x3ea823){scripts['sestekNDA'](this[_0x8b13('0x38')],_0x4f601d)[_0x8b13('0x13')](function(_0x556a92){_0x3ea823(null,_0x556a92);})[_0x8b13('0x15')](function(_0x48269c){_0x3ea823(_0x48269c);});};AGIVertices[_0x8b13('0x10')]['ispeechTTS']=function(_0x135053,_0x291a30){scripts[_0x8b13('0x87')](_0x135053[_0x8b13('0x80')],_0x135053[_0x8b13('0x62')],_0x135053[_0x8b13('0x88')]||_0x8b13('0x64'),_0x135053[_0x8b13('0x89')])['then'](function(_0x800c3c){_0x291a30(null,_0x800c3c);})[_0x8b13('0x15')](function(_0x5f190a){_0x291a30(_0x5f190a);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x8a')]=function(_0x4d33f3,_0xa97f27,_0x304862){scripts[_0x8b13('0x8a')](_0xa97f27,_0x4d33f3[_0x8b13('0x80')],_0x4d33f3[_0x8b13('0x8b')]||'en-US',this['isConfigured'](_0x4d33f3[_0x8b13('0x8c')])?_0x4d33f3[_0x8b13('0x8c')]:undefined)[_0x8b13('0x13')](function(_0x36f3af){_0x304862(null,_0x36f3af);})[_0x8b13('0x15')](function(_0x3ffd8c){_0x304862(_0x3ffd8c);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x8d')]=function(_0x45d6d5,_0xfac180){scripts[_0x8b13('0x8d')](_0x45d6d5[_0x8b13('0x8e')],_0x45d6d5[_0x8b13('0x8f')],_0x45d6d5[_0x8b13('0x90')],_0x45d6d5[_0x8b13('0x91')]||_0x8b13('0x92'),_0x45d6d5['text'],_0x45d6d5[_0x8b13('0x93')]||'text')[_0x8b13('0x13')](function(_0x111085){_0xfac180(null,_0x111085);})[_0x8b13('0x15')](function(_0x394932){_0xfac180(_0x394932);});};AGIVertices[_0x8b13('0x10')][_0x8b13('0x94')]=function(_0x7e200e,_0x4c1146){scripts[_0x8b13('0x94')](this['channel'][_0x8b13('0x39')],_0x7e200e[_0x8b13('0x8e')],_0x7e200e['aws_secret_access_key'],_0x7e200e['aws_lex_region'],_0x7e200e[_0x8b13('0x62')],_0x7e200e[_0x8b13('0x95')])[_0x8b13('0x13')](function(_0x220abd){_0x4c1146(null,_0x220abd);})[_0x8b13('0x15')](function(_0x3b131d){_0x4c1146(_0x3b131d);});};AGIVertices['prototype'][_0x8b13('0x96')]=function(_0x429c1d,_0x4ed244,_0x528f3b){scripts['googleASR'](_0x4ed244,_0x429c1d[_0x8b13('0x80')],_0x429c1d[_0x8b13('0x97')]||_0x8b13('0x64'))[_0x8b13('0x13')](function(_0x44b19b){_0x528f3b(null,_0x44b19b);})[_0x8b13('0x15')](function(_0x270b56){_0x528f3b(_0x270b56);});};AGIVertices[_0x8b13('0x10')]['tildeASR']=function(_0x38b8fc,_0x598662,_0x3a7bc9){scripts['tildeASR'](_0x598662,_0x38b8fc[_0x8b13('0x98')],_0x38b8fc[_0x8b13('0x99')],_0x38b8fc['uri'])[_0x8b13('0x13')](function(_0x2fa301){_0x3a7bc9(null,_0x2fa301);})[_0x8b13('0x15')](function(_0x20b397){_0x3a7bc9(_0x20b397);});};AGIVertices[_0x8b13('0x10')]['clear']=function(_0x931432){var _0x7827e6=_[_0x8b13('0x6d')](verticesWithRetry,_0x931432[_0x8b13('0x3b')])?_0x931432:_['clone'](_0x931432);for(var _0x197d38 in _0x7827e6){if(_0x7827e6['hasOwnProperty'](_0x197d38)){if(_0x7827e6[_0x197d38]&&_[_0x8b13('0x9a')](_0x7827e6[_0x197d38])){if(_[_0x8b13('0x6d')](recursiveMapAttributes,_0x197d38)){_0x7827e6[_0x197d38]=this[_0x8b13('0x9b')](_0x7827e6[_0x197d38]);}else{_0x7827e6[_0x197d38]=this['replaceAllVariables'](_0x7827e6[_0x197d38]);}}}}return _0x7827e6;};AGIVertices['prototype']['recursiveNodeIndex']=function(_0x5a9f3e){for(var _0x265f60 in _0x5a9f3e){if(_0x5a9f3e['hasOwnProperty'](_0x265f60)){if(_[_0x8b13('0x9c')](_0x5a9f3e[_0x265f60])){this['recursiveNodeIndex'](_0x5a9f3e[_0x265f60]);}else if(_[_0x8b13('0x9d')](_0x5a9f3e[_0x265f60])){for(var _0x4196d8=0x0;_0x4196d8<_0x5a9f3e[_0x265f60][_0x8b13('0x9e')];_0x4196d8++){this[_0x8b13('0x9f')](_0x5a9f3e[_0x265f60][_0x4196d8]);}}else if(_[_0x8b13('0x9a')](_0x5a9f3e[_0x265f60])){_0x5a9f3e[_0x265f60]=this[_0x8b13('0xa0')](_0x5a9f3e[_0x265f60]);}}}};AGIVertices[_0x8b13('0x10')][_0x8b13('0xa1')]=function(_0x2a5ed3,_0x414daf){for(var _0x2fcc82 in _0x2a5ed3){if(_0x2a5ed3[_0x8b13('0xa2')](_0x2fcc82)){if(_[_0x8b13('0x9c')](_0x2a5ed3[_0x2fcc82])){if(!_['isEmpty'](_0x2a5ed3[_0x2fcc82])){this[_0x8b13('0xa1')](_0x2a5ed3[_0x2fcc82],util['format']('%s.%s',_0x414daf,_0x2fcc82));}}else if(_['isArray'](_0x2a5ed3[_0x2fcc82])){for(var _0x1ae046=0x0;_0x1ae046<_0x2a5ed3[_0x2fcc82][_0x8b13('0x9e')];_0x1ae046++){this[_0x8b13('0xa1')](_0x2a5ed3[_0x2fcc82][_0x1ae046],util[_0x8b13('0x2a')]('%s.%s',_0x414daf,_0x2fcc82+'['+_0x1ae046+']'));}}else{if(!_[_0x8b13('0x4a')](_0x2a5ed3[_0x2fcc82])){this['channel'][_0x8b13('0xa3')](util[_0x8b13('0x2a')]('%s.%s',_0x414daf,_0x2fcc82),_0x2a5ed3[_0x2fcc82]);}}}}};AGIVertices[_0x8b13('0x10')][_0x8b13('0x9b')]=function(_0x25d770){try{var _0x4a52d9=JSON[_0x8b13('0x75')](_0x25d770);this[_0x8b13('0x9f')](_0x4a52d9);return JSON[_0x8b13('0x7b')](_0x4a52d9);}catch(_0xf629c6){return this[_0x8b13('0xa0')](_0x25d770);}};AGIVertices[_0x8b13('0x10')][_0x8b13('0xa0')]=function(_0x4132c9){var _0x1e0f26=_0x4132c9[_0x8b13('0xa4')]('{');for(var _0x2329e2=0x1;_0x2329e2<_0x1e0f26[_0x8b13('0x9e')];_0x2329e2+=0x1){var _0x1fd2cd=_0x1e0f26[_0x2329e2][_0x8b13('0xa4')]('}');if(_0x1fd2cd[_0x8b13('0x9e')]>0x1){_0x4132c9=_0x4132c9[_0x8b13('0xa5')]('{'+_0x1fd2cd[0x0]+'}',this['channel'][_0x8b13('0x11')](_0x1fd2cd[0x0])[_0x8b13('0xa6')]||_0x1fd2cd[0x0]);}}if(_0x1e0f26[_0x8b13('0x9e')]===0x1){return _0x4132c9['toString']();}return this[_0x8b13('0xa0')](_0x4132c9);};AGIVertices['prototype'][_0x8b13('0xa7')]=function(_0x1e104d,_0x75d844){var _0x595a21=this[_0x8b13('0x38')][_0x8b13('0x11')](_0x1e104d);if(_0x595a21[_0x8b13('0xa8')]===-0x1){return _0x595a21;}logger['info'](util[_0x8b13('0x2a')](_0x8b13('0xa9'),_0x75d844,_0x595a21['extra']));return this[_0x8b13('0x38')][_0x8b13('0xa3')](_0x75d844,_0x595a21[_0x8b13('0xa6')]);};AGIVertices[_0x8b13('0x10')]['isConfigured']=function(_0xfb71ff){return _0xfb71ff&&_0xfb71ff!=='0'&&_0xfb71ff!=='-1'&&_0xfb71ff!=='';};AGIVertices[_0x8b13('0x10')][_0x8b13('0xaa')]=function(_0x588987){this[_0x8b13('0x37')][_0x8b13('0x78')](this,_0x588987,'-');_0x588987['retry']=_0x588987[_0x8b13('0xaa')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x8b13('0xab')]=function(_0x178d6b){logger['info'](util['format'](_0x8b13('0xac'),_0x178d6b[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x178d6b[_0x8b13('0x62')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0xaf'));}var _0x490a0='\x22'+_0x178d6b[_0x8b13('0x62')]+'\x22';if(this[_0x8b13('0xad')](_0x178d6b[_0x8b13('0x7e')])){_0x490a0+=','+_0x178d6b['options'];}var _0x305103=this[_0x8b13('0x38')]['exec'](_0x8b13('0xb0'),_0x490a0);if(_0x305103['result']===-0x1){return _0x305103;}return this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x490a0));};AGIVertices[_0x8b13('0x10')][_0x8b13('0xb1')]=function(_0xbd12b2){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0xbd12b2[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0xbd12b2[_0x8b13('0xb2')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0xb3'));}var _0x57a094=_0xbd12b2[_0x8b13('0xb2')];if(this[_0x8b13('0xad')](_0xbd12b2[_0x8b13('0x7e')])){_0x57a094+=','+_0xbd12b2[_0x8b13('0x7e')];}var _0x4e3bac=this[_0x8b13('0x38')]['exec']('MRCPRecog',_0x57a094);if(_0x4e3bac[_0x8b13('0xa8')]===-0x1){return _0x4e3bac;}var _0xd45634=this['getAndSetVariable'](_0x8b13('0xb4'),'MRCP_RECOG_CONFIDENCE');if(_0xd45634[_0x8b13('0xa8')]===-0x1){return _0xd45634;}var _0x5ac718=this[_0x8b13('0xa7')](_0x8b13('0xb5'),_0x8b13('0xb6'));if(_0x5ac718[_0x8b13('0xa8')]===-0x1){return _0x5ac718;}var _0x284211=this[_0x8b13('0xa7')](_0x8b13('0xb7'),_0x8b13('0xb8'));if(_0x284211[_0x8b13('0xa8')]===-0x1){return _0x284211;}return this['channel'][_0x8b13('0xae')](util[_0x8b13('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x57a094));};AGIVertices[_0x8b13('0x10')][_0x8b13('0x8')]=function(_0x95cfa6){logger['info'](util[_0x8b13('0x2a')](_0x8b13('0xb9'),_0x95cfa6[_0x8b13('0x3a')]));return this[_0x8b13('0x38')]['agi']([_0x95cfa6[_0x8b13('0xba')],_0x95cfa6[_0x8b13('0xbb')]]);};AGIVertices[_0x8b13('0x10')][_0x8b13('0xbc')]=function(_0x2a44a7){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0xbd'),_0x2a44a7[_0x8b13('0x3a')]));if(this[_0x8b13('0xad')](_0x2a44a7[_0x8b13('0x6b')])){logger['info'](util[_0x8b13('0x2a')](_0x8b13('0xbe'),_0x2a44a7['timeout']));var _0x191ddf=this['channel'][_0x8b13('0xbf')](_0x2a44a7[_0x8b13('0x6b')]);if(_0x191ddf[_0x8b13('0xa8')]===-0x1){return _0x191ddf;}}return this[_0x8b13('0x38')][_0x8b13('0xbc')]();};AGIVertices[_0x8b13('0x10')][_0x8b13('0x4e')]=function(_0x17af45){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0xc0'),_0x17af45[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x17af45[_0x8b13('0x4c')])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x17af45,_0x8b13('0xc1'));}_0x17af45[_0x8b13('0x4d')]=moment();if(this[_0x8b13('0xad')](_0x17af45[_0x8b13('0xc2')])){_0x17af45['scheduledAt']=moment()[_0x8b13('0xc3')](_0x17af45['delay'],_0x8b13('0xc4'));}if(!this['isConfigured'](_0x17af45[_0x8b13('0xc5')])){_0x17af45['callback_priority']=0x2;}this[_0x8b13('0x46')]['sync'](this,_0x17af45);return this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x17af45[_0x8b13('0x4b')],_0x17af45[_0x8b13('0x4c')],_0x17af45[_0x8b13('0x4d')]));};AGIVertices[_0x8b13('0x10')]['custom_app']=function(_0x3b795d){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0xc6'),_0x3b795d[_0x8b13('0x3a')]));var _0x5f1130=this[_0x8b13('0x38')][_0x8b13('0x5c')](_0x3b795d[_0x8b13('0xc7')],_0x3b795d[_0x8b13('0x7e')]);if(_0x5f1130[_0x8b13('0xa8')]===-0x1){return _0x5f1130;}return this['channel']['noop'](util[_0x8b13('0x2a')]('Executed\x20command\x20%s\x20%s',_0x3b795d[_0x8b13('0xc7')],_0x3b795d[_0x8b13('0x7e')]));};AGIVertices[_0x8b13('0x10')][_0x8b13('0xc8')]=function(_0x2154a1){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0xc9'),_0x2154a1[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x2154a1[_0x8b13('0x62')])){return this[_0x8b13('0x38')]['noop']('no\x20text\x20configured');}var _0x537246='\x22'+_0x2154a1['text']+'\x22';if(this['isConfigured'](_0x2154a1[_0x8b13('0x7e')])){_0x537246+=','+_0x2154a1[_0x8b13('0x7e')];}var _0x1369d6=this[_0x8b13('0x38')][_0x8b13('0x5c')](_0x8b13('0xb0'),_0x537246);if(_0x1369d6[_0x8b13('0xa8')]===-0x1){return _0x1369d6;}return this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x537246));};AGIVertices[_0x8b13('0x10')][_0x8b13('0xca')]=function(_0x41cd1a){logger['info'](util['format'](_0x8b13('0xcb'),_0x41cd1a[_0x8b13('0x3a')]));if(!this['isConfigured'](_0x41cd1a[_0x8b13('0x62')])){return this[_0x8b13('0x38')]['noop'](_0x8b13('0xaf'));}var _0x112d5c='\x22'+_0x41cd1a[_0x8b13('0x62')]+'\x22';if(this[_0x8b13('0xad')](_0x41cd1a[_0x8b13('0x7e')])){_0x112d5c+=','+_0x41cd1a['options'];}var _0x57d632=this[_0x8b13('0x38')]['exec'](_0x8b13('0xb0'),_0x112d5c);if(_0x57d632[_0x8b13('0xa8')]===-0x1){return _0x57d632;}return this[_0x8b13('0x38')]['noop'](util[_0x8b13('0x2a')](_0x8b13('0xcc'),_0x112d5c));};AGIVertices[_0x8b13('0x10')][_0x8b13('0xcd')]=function(_0x4c8718){logger[_0x8b13('0x32')](util['format'](_0x8b13('0xce'),_0x4c8718['label']));if(!this[_0x8b13('0xad')](_0x4c8718[_0x8b13('0xb2')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0xb3'));}var _0x3858b3=_0x4c8718[_0x8b13('0xb2')];if(this[_0x8b13('0xad')](_0x4c8718[_0x8b13('0x7e')])){_0x3858b3+=','+_0x4c8718[_0x8b13('0x7e')];}var _0x5e5f63=this['channel'][_0x8b13('0x5c')](_0x8b13('0xcf'),_0x3858b3);if(_0x5e5f63['result']===-0x1){return _0x5e5f63;}var _0x3dbd02=this[_0x8b13('0xa7')](_0x8b13('0xb4'),_0x8b13('0xd0'));if(_0x3dbd02[_0x8b13('0xa8')]===-0x1){return _0x3dbd02;}var _0x16bc2f=this[_0x8b13('0xa7')](_0x8b13('0xb5'),_0x8b13('0xd1'));if(_0x16bc2f[_0x8b13('0xa8')]===-0x1){return _0x16bc2f;}var _0x56a419=this[_0x8b13('0xa7')]('RECOG_INSTANCE()',_0x8b13('0xd2'));if(_0x56a419['result']===-0x1){return _0x56a419;}return this[_0x8b13('0x38')]['noop'](util[_0x8b13('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3858b3));};AGIVertices[_0x8b13('0x10')][_0x8b13('0xd3')]=function(_0x6de05){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0xd4'),_0x6de05[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x6de05[_0x8b13('0xb2')])){return this[_0x8b13('0x38')][_0x8b13('0xae')]('no\x20grammar\x20configured');}var _0x410c8a=_0x6de05[_0x8b13('0xb2')];if(this[_0x8b13('0xad')](_0x6de05[_0x8b13('0x7e')])){_0x410c8a+=','+_0x6de05['options'];}var _0x50ba6e=this[_0x8b13('0x38')][_0x8b13('0x5c')](_0x8b13('0xcf'),_0x410c8a);if(_0x50ba6e[_0x8b13('0xa8')]===-0x1){return _0x50ba6e;}var _0x1e8478=this['getAndSetVariable'](_0x8b13('0xb4'),_0x8b13('0xd5'));if(_0x1e8478[_0x8b13('0xa8')]===-0x1){return _0x1e8478;}var _0x2a65f4=this[_0x8b13('0xa7')](_0x8b13('0xb5'),_0x8b13('0xd6'));if(_0x2a65f4[_0x8b13('0xa8')]===-0x1){return _0x2a65f4;}var _0x1dc063=this[_0x8b13('0xa7')]('RECOG_INSTANCE()',_0x8b13('0xd7'));if(_0x1dc063[_0x8b13('0xa8')]===-0x1){return _0x1dc063;}return this['channel'][_0x8b13('0xae')](util['format'](_0x8b13('0xd8'),_0x410c8a));};AGIVertices[_0x8b13('0x10')][_0x8b13('0xd9')]=function(_0x13d00d){logger['info'](util[_0x8b13('0x2a')](_0x8b13('0xda'),_0x13d00d['label']));if(!this[_0x8b13('0xad')](_0x13d00d['odbc_id'])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x13d00d,_0x8b13('0xdb'));}var _0x258df1=this[_0x8b13('0x18')][_0x8b13('0x78')](this,_0x13d00d[_0x8b13('0xdc')]);if(!_0x258df1){return this['channel'][_0x8b13('0x2e')](_0x13d00d,_0x8b13('0xdd'));}if(!this[_0x8b13('0xad')](_0x13d00d[_0x8b13('0x30')])){return this['channel']['error'](_0x13d00d,'no\x20query\x20configured');}var _0x1e02cf=_0x13d00d['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0xde'),_0x1e02cf));var _0xaf6322=this[_0x8b13('0x2c')][_0x8b13('0x78')](this,_0x258df1,_0x1e02cf);this['createSquareDetailsReport']['sync'](this,_0x13d00d,_0x1e02cf);if(!this[_0x8b13('0xad')](_0x13d00d['variable_id'])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0xdf'));}var _0x5a9644=this[_0x8b13('0x11')]['sync'](this,_0x13d00d[_0x8b13('0xe0')]);if(!_0x5a9644){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x13d00d,'no\x20variable\x20found');}var _0x2ed842=this;_0xaf6322[_0x8b13('0xe1')](function(_0x34cc89,_0x3cc463){Object[_0x8b13('0xe2')](_0x34cc89)[_0x8b13('0xe1')](function(_0x28c061){_0x2ed842['channel']['setVariable'](util['format'](_0x8b13('0xe3'),_0x5a9644,_0x3cc463,_0x28c061),_0x34cc89[_0x28c061]);});});this[_0x8b13('0x38')]['setVariable'](util[_0x8b13('0x2a')]('%s_ROWS_COUNT',_0x5a9644),_0xaf6322[_0x8b13('0x9e')]);return this[_0x8b13('0x38')]['noop'](util[_0x8b13('0x2a')](_0x8b13('0xe4'),_0x5a9644));};AGIVertices[_0x8b13('0x10')][_0x8b13('0xe5')]=function(_0x450ed2){logger['debug'](util['format'](_0x8b13('0xe6'),_0x450ed2[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x450ed2[_0x8b13('0xe7')])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x450ed2,_0x8b13('0xe8'));}var _0x29e355=this['getUser'][_0x8b13('0x78')](this,_0x450ed2['sip_id']);if(!_0x29e355){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x450ed2,_0x8b13('0xe9'));}var _0x3537aa=this[_0x8b13('0x38')][_0x8b13('0x5c')](_0x8b13('0xea'),[util[_0x8b13('0x2a')](_0x8b13('0xeb'),_0x29e355),_0x450ed2[_0x8b13('0x6b')],_0x450ed2[_0x8b13('0xec')],_0x450ed2[_0x8b13('0x6a')]]);if(_0x3537aa[_0x8b13('0xa8')]===-0x1){return _0x3537aa;}return this[_0x8b13('0x38')]['noop'](util[_0x8b13('0x2a')](_0x8b13('0xed'),_0x8b13('0xea')));};AGIVertices[_0x8b13('0x10')][_0x8b13('0xee')]=function(_0xb72e0){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0xef'),_0xb72e0[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0xb72e0[_0x8b13('0x80')])){return this[_0x8b13('0x38')]['noop']('no\x20key\x20configured');}if(!this[_0x8b13('0xad')](_0xb72e0[_0x8b13('0x62')])){return this['channel'][_0x8b13('0xae')](_0x8b13('0xaf'));}this[_0x8b13('0x38')][_0x8b13('0xf0')]=!![];this['createSquareDetailsReport'](_0xb72e0);this['createSquareMessage'](_0xb72e0[_0x8b13('0x62')],'in','','');this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0xf1'),_0xb72e0[_0x8b13('0x62')]));var _0x5b4874=this[_0x8b13('0x7f')][_0x8b13('0x78')](this,_0xb72e0);if(_0x5b4874){for(var _0x562845 in _0x5b4874){if(_0x5b4874['hasOwnProperty'](_0x562845)){this[_0x8b13('0x38')][_0x8b13('0xa3')](util[_0x8b13('0x2a')]('DIALOGFLOW_%s',_0x562845[_0x8b13('0x71')]()),_0x5b4874[_0x562845]);}}this['createSquareMessage'](_0x5b4874['speech'],_0x8b13('0xf2'),_0x8b13('0xee'),'');return this['channel']['noop'](util[_0x8b13('0x2a')]('Dialogflow\x20Result\x20%s',_0x5b4874[_0x8b13('0xf3')]));}return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0xb72e0,_0x8b13('0xf4'));};AGIVertices[_0x8b13('0x10')]['dialogflowV2']=function(_0x4902e1){logger[_0x8b13('0x32')](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x4902e1[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x4902e1[_0x8b13('0xf5')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0xf6'));}if(!this['isConfigured'](_0x4902e1[_0x8b13('0x83')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0xf7'));}if(!this['isConfigured'](_0x4902e1['private_key'])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0xf8'));}if(!this[_0x8b13('0xad')](_0x4902e1[_0x8b13('0x85')])){return this['channel'][_0x8b13('0xae')]('no\x20anguage\x20configured');}if(!this[_0x8b13('0xad')](_0x4902e1[_0x8b13('0x62')])){return this[_0x8b13('0x38')]['noop'](_0x8b13('0xaf'));}this[_0x8b13('0x38')][_0x8b13('0xf0')]=!![];this['createSquareDetailsReport'](_0x4902e1);this[_0x8b13('0x45')](_0x4902e1[_0x8b13('0x62')],'in','','');this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0xf9'),_0x4902e1['text']));var _0x4262ee=this[_0x8b13('0x82')]['sync'](this,_0x4902e1);if(_0x4262ee){for(var _0x504950 in _0x4262ee){if(_0x4262ee['hasOwnProperty'](_0x504950)){if(_0x504950!==_0x8b13('0xfa')){this['channel'][_0x8b13('0xa3')](util[_0x8b13('0x2a')](_0x8b13('0xfb'),_0x504950['toUpperCase']()),_0x4262ee[_0x504950]);}}}this['createSquareMessage'](_0x4262ee['speech'],_0x8b13('0xf2'),_0x8b13('0xfc'),_0x4262ee[_0x8b13('0xfa')]);return this['channel'][_0x8b13('0xae')](util['format'](_0x8b13('0xfd'),_0x4262ee['speech']));}return this['channel'][_0x8b13('0x2e')](_0x4902e1,_0x8b13('0xfe'));};AGIVertices[_0x8b13('0x10')][_0x8b13('0xff')]=function(_0x5b033b){logger['info'](util[_0x8b13('0x2a')](_0x8b13('0x100'),_0x5b033b['label']));if(!this['isConfigured'](_0x5b033b[_0x8b13('0x101')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0x102'));}if(!this[_0x8b13('0xad')](_0x5b033b[_0x8b13('0x103')])){return this['channel'][_0x8b13('0xae')](_0x8b13('0x104'));}if(!this[_0x8b13('0xad')](_0x5b033b[_0x8b13('0x105')])){return this['channel']['noop'](_0x8b13('0x106'));}if(!this[_0x8b13('0xad')](_0x5b033b[_0x8b13('0x107')])){return this[_0x8b13('0x38')]['noop'](_0x8b13('0xaf'));}this[_0x8b13('0x38')]['bot']=!![];this[_0x8b13('0x37')](_0x5b033b);this['createSquareMessage'](_0x5b033b[_0x8b13('0x62')],'in','','');this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x108'),_0x5b033b[_0x8b13('0x62')]));var _0x151268=this['sestekNDA'][_0x8b13('0x78')](this,_0x5b033b);if(_0x151268){for(var _0x5ae351 in _0x151268){if(_0x151268['hasOwnProperty'](_0x5ae351)){this[_0x8b13('0x38')][_0x8b13('0xa3')](util[_0x8b13('0x2a')](_0x8b13('0x109'),_0x5ae351['toUpperCase']()),_0x151268[_0x5ae351]);}}this[_0x8b13('0x45')](_0x151268[_0x8b13('0xf3')],_0x8b13('0xf2'),'sesteknda','');if(_0x151268[_0x8b13('0x10a')]){this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x10b'),_0x151268[_0x8b13('0x10a')]));var _0x3e832f=this[_0x8b13('0x38')][_0x8b13('0x10c')](_0x151268['audiofile']);try{fs[_0x8b13('0x10d')](_0x151268[_0x8b13('0x10a')]+_0x8b13('0x10e'));}catch(_0x104e89){logger['error'](_0x104e89);}return _0x3e832f;}else{return this['channel'][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x10f'),_0x151268[_0x8b13('0xf3')]));}}return this[_0x8b13('0x38')]['error'](_0x5b033b,_0x8b13('0x110'));};AGIVertices[_0x8b13('0x10')][_0x8b13('0x111')]=function(_0x49a92f){logger['info'](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x49a92f[_0x8b13('0x3a')]));return this[_0x8b13('0x38')]['noop'](_0x8b13('0x111'));};AGIVertices[_0x8b13('0x10')][_0x8b13('0x112')]=function(_0x935fa2){logger[_0x8b13('0x32')](util['format'](_0x8b13('0x113'),_0x935fa2['label']));var _0x54f121='';if(_0x935fa2[_0x8b13('0x114')]){if(!this[_0x8b13('0xad')](_0x935fa2[_0x8b13('0x114')])){return this[_0x8b13('0x38')]['error'](_0x935fa2,_0x8b13('0x115'));}else{var _0x123cba=parseInt(_0x935fa2['trunk_id'],0xa);if(isNaN(_0x123cba)){_0x54f121=_0x935fa2[_0x8b13('0x114')];}else{_0x54f121=this[_0x8b13('0x1c')]['sync'](this,_0x935fa2[_0x8b13('0x114')]);if(!_0x54f121){return this[_0x8b13('0x38')]['error'](_0x935fa2,_0x8b13('0x116'));}}}}else if(_0x935fa2[_0x8b13('0x117')]){_0x54f121=_0x935fa2[_0x8b13('0x117')];}else{return this[_0x8b13('0x38')]['error'](_0x935fa2,_0x8b13('0x115'));}var _0x582b64=this[_0x8b13('0x38')][_0x8b13('0x5c')](_0x8b13('0xea'),[util[_0x8b13('0x2a')](_0x8b13('0x118'),_0x54f121,_0x935fa2[_0x8b13('0x4b')]),_0x935fa2[_0x8b13('0x6b')],_0x935fa2[_0x8b13('0xec')],_0x935fa2[_0x8b13('0x6a')]]);if(_0x582b64[_0x8b13('0xa8')]===-0x1){return _0x582b64;}return this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')]('Executed\x20command\x20%s',_0x8b13('0xea')));};AGIVertices[_0x8b13('0x10')][_0x8b13('0x119')]=function(_0xf36af8){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x11a'),_0xf36af8['label']));return this['channel'][_0x8b13('0xae')](_0x8b13('0x119'));};AGIVertices[_0x8b13('0x10')][_0x8b13('0xd')]=function(_0x4236d5){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x11b'),_0x4236d5['label']));if(_0x4236d5['retry']===0x0){return this['maxRetry'](_0x4236d5);}_0x4236d5[_0x8b13('0x11c')]-=0x1;if(!this[_0x8b13('0xad')](_0x4236d5[_0x8b13('0x11d')])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x4236d5,'no\x20file\x20audio\x20selected');}var _0x1981be=this[_0x8b13('0x1e')][_0x8b13('0x78')](this,_0x4236d5['file_id']);if(!_0x1981be){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x4236d5,_0x8b13('0x11e'));}if(!this[_0x8b13('0xad')](_0x4236d5[_0x8b13('0xe0')])){return this['channel']['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3c10b1=this[_0x8b13('0x38')][_0x8b13('0x11f')](_0x1981be,_0x4236d5[_0x8b13('0x120')],_0x4236d5[_0x8b13('0x121')]);var _0x3b08bb=_0x3c10b1['result']?_0x3c10b1[_0x8b13('0xa8')][_0x8b13('0x50')]():'';logger['info']('test',JSON['stringify'](_0x3c10b1));if(_0x3c10b1[_0x8b13('0xa8')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x4236d5,_0x3b08bb);return _0x3c10b1;}else if(_0x3c10b1[_0x8b13('0xa6')]==='timeout'){_0x3c10b1[_0x8b13('0xa8')]=_0x3b08bb[_0x8b13('0x9e')]>=parseInt(_0x4236d5[_0x8b13('0x122')])?'x':'i';}else{_0x3c10b1['result']=_0x3b08bb['length']>=parseInt(_0x4236d5[_0x8b13('0x122')])&&_0x3b08bb[_0x8b13('0x9e')]<=parseInt(_0x4236d5['maxdigit'])?'x':'i';}var _0x18e2b0=this['getVariable'][_0x8b13('0x78')](this,_0x4236d5[_0x8b13('0xe0')]);if(!_0x18e2b0){return this['channel'][_0x8b13('0x2e')](_0x4236d5,'no\x20variable\x20found');}this[_0x8b13('0x38')][_0x8b13('0xa3')](_0x18e2b0,_0x3b08bb);if(this[_0x8b13('0xad')](_0x4236d5['hiddendigitsnum'])){var _0x7f7f53=parseInt(_0x4236d5[_0x8b13('0x123')],0xa);var _0x2b15ca=rs[_0x8b13('0x124')]({'charset':'*','length':_0x7f7f53});var _0xe550ff=_0x3b08bb[_0x8b13('0x9e')];if(_0xe550ff>0x0){if(_0xe550ff>_0x7f7f53){this[_0x8b13('0x37')]['sync'](this,_0x4236d5,_0x4236d5[_0x8b13('0x125')]===_0x8b13('0x126')?_0x2b15ca+_0x3b08bb[_0x8b13('0x127')](_0x7f7f53):_0x3b08bb[_0x8b13('0x127')](0x0,_0xe550ff-_0x7f7f53)+_0x2b15ca);}else{this['createSquareDetailsReport'][_0x8b13('0x78')](this,_0x4236d5,rs['generate']({'charset':'*','length':_0xe550ff}));}}else{this[_0x8b13('0x37')][_0x8b13('0x78')](this,_0x4236d5,'');}}else{this['createSquareDetailsReport'][_0x8b13('0x78')](this,_0x4236d5,_0x3b08bb);}return _0x3c10b1;};AGIVertices[_0x8b13('0x10')]['getsecretdigits']=function(_0x3f60f9){logger[_0x8b13('0x32')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x3f60f9[_0x8b13('0x3a')]));return this[_0x8b13('0xd')](_0x3f60f9);};AGIVertices[_0x8b13('0x10')][_0x8b13('0x128')]=function(_0x341513){logger['info'](util[_0x8b13('0x2a')](_0x8b13('0x129'),_0x341513[_0x8b13('0x3a')]));this[_0x8b13('0x37')]['sync'](this,_0x341513,_0x341513[_0x8b13('0x12a')]);return this['channel']['noop'](util[_0x8b13('0x2a')](_0x8b13('0x12b'),_0x341513[_0x8b13('0x12a')]));};AGIVertices['prototype']['awspolly']=function(_0xf3a99b){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x12c'),_0xf3a99b['label']));if(!this['isConfigured'](_0xf3a99b[_0x8b13('0x8e')])||!this[_0x8b13('0xad')](_0xf3a99b[_0x8b13('0x8f')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0x12d'));}if(!this['isConfigured'](_0xf3a99b[_0x8b13('0x62')])){return this[_0x8b13('0x38')]['noop'](_0x8b13('0xaf'));}this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x12e'),_0xf3a99b['text']));var _0x43f7ff=this[_0x8b13('0x8d')][_0x8b13('0x78')](this,_0xf3a99b);if(_0x43f7ff){this['channel'][_0x8b13('0xae')](util[_0x8b13('0x2a')]('aws\x20Polly\x20%s\x20file\x20created',_0x43f7ff));var _0x19f701=this[_0x8b13('0x38')][_0x8b13('0x10c')](_0x43f7ff);try{fs['unlink'](_0x43f7ff+'.wav');}catch(_0x389c47){logger['error'](_0x389c47);}return _0x19f701;}return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0xf3a99b,_0x8b13('0x12f'));};AGIVertices['prototype'][_0x8b13('0x130')]=function(_0x58ce30){logger['info'](util[_0x8b13('0x2a')](_0x8b13('0x131'),_0x58ce30[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x58ce30[_0x8b13('0x8e')])||!this[_0x8b13('0xad')](_0x58ce30['aws_secret_access_key'])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0x12d'));}if(!this[_0x8b13('0xad')](_0x58ce30['aws_bot_name'])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0x132'));}if(!this[_0x8b13('0xad')](_0x58ce30[_0x8b13('0x62')])){return this[_0x8b13('0x38')][_0x8b13('0xae')]('no\x20text\x20configured');}this[_0x8b13('0x38')][_0x8b13('0xf0')]=!![];this[_0x8b13('0x37')](_0x58ce30);this[_0x8b13('0x45')](_0x58ce30[_0x8b13('0x62')],'in','','');this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')]('Trying\x20Amazon\x20Lex:\x20%s',_0x58ce30[_0x8b13('0x62')]));var _0x5886ee=this[_0x8b13('0x94')][_0x8b13('0x78')](this,_0x58ce30);if(_0x5886ee){for(var _0x1f0508 in _0x5886ee){if(_0x5886ee[_0x8b13('0xa2')](_0x1f0508)&&_[_0x8b13('0x9a')](_0x5886ee[_0x1f0508])){this[_0x8b13('0x38')]['setVariable'](util[_0x8b13('0x2a')](_0x8b13('0x133'),_0x1f0508['toUpperCase']()),_0x5886ee[_0x1f0508]);}}if(_['isNil'](_0x5886ee['message'])){return this['channel'][_0x8b13('0xae')](_0x8b13('0x134'));}else{this[_0x8b13('0x45')](_0x5886ee[_0x8b13('0x7d')],_0x8b13('0xf2'),_0x8b13('0x135'),'');return this['channel']['noop'](util[_0x8b13('0x2a')](_0x8b13('0x136'),_0x5886ee[_0x8b13('0x7d')]));}}return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x58ce30,_0x8b13('0x137'));};AGIVertices[_0x8b13('0x10')]['googleasr']=function(_0xa42b85){logger[_0x8b13('0x32')](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0xa42b85['label'],_0xa42b85[_0x8b13('0x6b')]));if(!this['isConfigured'](_0xa42b85[_0x8b13('0x80')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0x138'));}var _0x17df3f=_0x8b13('0x139');var _0x68adf4=util[_0x8b13('0x2a')](_0x8b13('0x13a'),FILES_PATH,rs['generate'](0x4));var _0x2263f8=util['format']('%s.%s',_0x68adf4,_0x17df3f);var _0x326dd7=!![];if(_0xa42b85[_0x8b13('0x13b')]==='NOBEEP'){_0x326dd7=![];}var _0x1f541e=this[_0x8b13('0x38')][_0x8b13('0x13c')](_0x68adf4,_0x17df3f,_0xa42b85[_0x8b13('0x13d')],_0xa42b85[_0x8b13('0x6b')],undefined,_0x326dd7);if(_0x1f541e[_0x8b13('0xa8')]!==-0x1){this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x13e'),_0x2263f8));var _0x1ae199=this[_0x8b13('0x96')][_0x8b13('0x78')](this,_0xa42b85,_0x2263f8);if(_0x1ae199){for(var _0x142be0 in _0x1ae199){if(_0x1ae199[_0x8b13('0xa2')](_0x142be0)){this[_0x8b13('0x38')][_0x8b13('0xa3')](util[_0x8b13('0x2a')](_0x8b13('0x13f'),_0x142be0['toUpperCase']()),_0x1ae199[_0x142be0]);}}return this[_0x8b13('0x38')][_0x8b13('0xae')](util['format'](_0x8b13('0x140'),JSON['stringify'](_0x1ae199)));}}return _0x1f541e;};AGIVertices[_0x8b13('0x10')][_0x8b13('0x141')]=function(_0x402c06){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x142'),_0x402c06[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x402c06[_0x8b13('0x98')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0x143'));}if(!this[_0x8b13('0xad')](_0x402c06[_0x8b13('0x99')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0x144'));}var _0x3349ac='wav';var _0x3c60ac=util[_0x8b13('0x2a')](_0x8b13('0x13a'),FILES_PATH,rs[_0x8b13('0x124')](0x4));var _0x20dd8f=util['format'](_0x8b13('0x145'),_0x3c60ac,_0x3349ac);var _0x19d65c=!![];if(_0x402c06[_0x8b13('0x13b')]===_0x8b13('0x146')){_0x19d65c=![];}var _0x208af8=this[_0x8b13('0x38')]['recordFile'](_0x3c60ac,_0x3349ac,_0x402c06[_0x8b13('0x13d')],_0x402c06[_0x8b13('0x6b')],undefined,_0x19d65c);if(_0x208af8[_0x8b13('0xa8')]!==-0x1){this[_0x8b13('0x38')][_0x8b13('0xae')](util['format'](_0x8b13('0x147'),_0x20dd8f));var _0x4ec843=this[_0x8b13('0x148')][_0x8b13('0x78')](this,_0x402c06,_0x20dd8f);if(_0x4ec843){for(var _0x4e9ce9 in _0x4ec843){if(_0x4ec843[_0x8b13('0xa2')](_0x4e9ce9)){this[_0x8b13('0x38')][_0x8b13('0xa3')](util[_0x8b13('0x2a')](_0x8b13('0x149'),_0x4e9ce9[_0x8b13('0x71')]()),_0x4ec843[_0x4e9ce9]);}}return this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')]('TildeASR\x20Result\x20%s',JSON[_0x8b13('0x7b')](_0x4ec843)));}}return _0x208af8;};AGIVertices[_0x8b13('0x10')][_0x8b13('0x14a')]=function(_0x29503b){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x14b'),_0x29503b[_0x8b13('0x3a')]));return this[_0x8b13('0x38')]['continueAt'](_0x29503b['context'],_0x29503b[_0x8b13('0x41')],_0x29503b[_0x8b13('0x42')]);};AGIVertices['prototype'][_0x8b13('0x14c')]=function(_0x5a77b2){logger['info'](util[_0x8b13('0x2a')](_0x8b13('0x14d'),_0x5a77b2['label']));if(!this['isConfigured'](_0x5a77b2[_0x8b13('0x14e')])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x5a77b2,_0x8b13('0x14f'));}try{var _0x14a2c0=eval(_0x5a77b2[_0x8b13('0x14e')])?_0x8b13('0x150'):_0x8b13('0x151');this[_0x8b13('0x38')][_0x8b13('0xae')](util['format'](_0x8b13('0x152'),_0x5a77b2[_0x8b13('0x14e')],_0x14a2c0));return{'code':0xc8,'result':_0x14a2c0};}catch(_0x297d3a){return{'code':0xc8,'result':_0x8b13('0x151')};}};AGIVertices['prototype']['gotoiftime']=function(_0xfb6e4c){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x153'),_0xfb6e4c[_0x8b13('0x3a')]));if(!this['isConfigured'](_0xfb6e4c['interval_id'])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0xfb6e4c,_0x8b13('0x154'));}var _0x393e7e=this[_0x8b13('0x25')]['sync'](this,_0xfb6e4c[_0x8b13('0x155')]);if(!_0x393e7e){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0xfb6e4c,_0x8b13('0x156'));}for(var _0x2e84cb=0x0;_0x2e84cb<_0x393e7e[_0x8b13('0x9e')];_0x2e84cb+=0x1){var _0x442c57=this[_0x8b13('0x38')][_0x8b13('0x11')](util[_0x8b13('0x2a')](_0x8b13('0x157'),_0x393e7e[_0x2e84cb]));if(_0x442c57[_0x8b13('0xa8')]===-0x1){return _0x442c57;}logger[_0x8b13('0x32')](util['format']('IFTIME\x20%s\x20%s',_0x393e7e[_0x2e84cb],_0x442c57['extra']));if(_0x442c57['extra']==='true'){logger[_0x8b13('0x32')](util['format'](_0x8b13('0x158'),_0x393e7e[_0x2e84cb],_0x8b13('0x150')));this['channel']['noop'](util['format'](_0x8b13('0x158'),_0x393e7e[_0x2e84cb],_0x8b13('0x150')));return{'code':0xc8,'result':'true'};}else{logger['info'](util['format'](_0x8b13('0x158'),_0x393e7e[_0x2e84cb],_0x8b13('0x151')));this[_0x8b13('0x38')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x393e7e[_0x2e84cb],_0x8b13('0x151')));}}return{'code':0xc8,'result':_0x8b13('0x151')};};AGIVertices[_0x8b13('0x10')][_0x8b13('0x159')]=function(_0x837ba5){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x15a'),_0x837ba5[_0x8b13('0x3a')]));return this[_0x8b13('0x38')]['hangup']();};AGIVertices[_0x8b13('0x10')][_0x8b13('0x15b')]=function(_0x282adb){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x15c'),_0x282adb['label']));if(!this[_0x8b13('0xad')](_0x282adb[_0x8b13('0x80')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0x138'));}var _0x5c2864=_0x8b13('0x139');var _0x472011=util[_0x8b13('0x2a')](_0x8b13('0x13a'),FILES_PATH,rs[_0x8b13('0x124')](0x4));var _0x4ad638=util[_0x8b13('0x2a')](_0x8b13('0x145'),_0x472011,_0x5c2864);var _0x22e934=!![];if(_0x282adb[_0x8b13('0x13b')]===_0x8b13('0x146')){_0x22e934=![];}var _0x52fde6=this[_0x8b13('0x38')]['recordFile'](_0x472011,_0x5c2864,_0x282adb['intKey'],_0x282adb['timeout'],undefined,_0x22e934);if(_0x52fde6[_0x8b13('0xa8')]!==-0x1){this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x15d'),_0x4ad638));var _0xb1500d=this[_0x8b13('0x8a')][_0x8b13('0x78')](this,_0x282adb,_0x4ad638);if(_0xb1500d){for(var _0x45bccc in _0xb1500d){if(_0xb1500d[_0x8b13('0xa2')](_0x45bccc)){this[_0x8b13('0x38')][_0x8b13('0xa3')](util[_0x8b13('0x2a')](_0x8b13('0x15e'),_0x45bccc['toUpperCase']()),_0xb1500d[_0x45bccc]);}}return this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0xb1500d)));}}return _0x52fde6;};AGIVertices[_0x8b13('0x10')][_0x8b13('0x15f')]=function(_0x5e0767){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x160'),_0x5e0767[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x5e0767[_0x8b13('0x80')])){return this[_0x8b13('0x38')]['noop']('no\x20key\x20configured');}if(!this[_0x8b13('0xad')](_0x5e0767[_0x8b13('0x62')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0xaf'));}this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x161'),_0x5e0767[_0x8b13('0x62')]));var _0x152b87=this[_0x8b13('0x87')][_0x8b13('0x78')](this,_0x5e0767);if(_0x152b87){this['channel']['noop'](util[_0x8b13('0x2a')](_0x8b13('0x15d'),_0x152b87));var _0x28439f=this[_0x8b13('0x38')][_0x8b13('0x10c')](_0x152b87,_0x5e0767[_0x8b13('0x13d')]);try{fs['unlink'](_0x152b87+_0x8b13('0x10e'));}catch(_0x3aa01e){logger[_0x8b13('0x2e')](_0x3aa01e);}return _0x28439f;}return this[_0x8b13('0x38')]['error'](_0x5e0767,_0x8b13('0x162'));};AGIVertices[_0x8b13('0x10')][_0x8b13('0x163')]=function(_0x39de4e){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x164'),_0x39de4e[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x39de4e[_0x8b13('0x165')])){return this[_0x8b13('0x38')]['error'](_0x39de4e,_0x8b13('0x166'));}logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x167'),this[_0x8b13('0x38')][_0x8b13('0x3e')],_0x39de4e[_0x8b13('0x165')]));var _0x38be9f=this[_0x8b13('0x57')][_0x8b13('0x78')](this,_0x39de4e['findBy']);if(_0x38be9f){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x168'),this[_0x8b13('0x38')][_0x8b13('0x3e')],_0x39de4e[_0x8b13('0x165')]));this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8b13('0x38')]['callerid'],_0x39de4e[_0x8b13('0x165')]));return{'code':0xc8,'result':_0x8b13('0x169')};}else{logger[_0x8b13('0x32')](util['format'](_0x8b13('0x16a'),this[_0x8b13('0x38')]['callerid'],_0x39de4e[_0x8b13('0x165')]));this[_0x8b13('0x38')]['noop'](util[_0x8b13('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x8b13('0x3e')],_0x39de4e[_0x8b13('0x165')]));return{'code':0xc8,'result':_0x8b13('0x16b')};}};AGIVertices[_0x8b13('0x10')][_0x8b13('0x16c')]=function(_0xc43aba){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0xc43aba[_0x8b13('0x3a')]));if(!this['isConfigured'](_0xc43aba[_0x8b13('0x165')])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0xc43aba,'no\x20find\x20by\x20configured');}logger[_0x8b13('0x32')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8b13('0x38')][_0x8b13('0x3e')],_0xc43aba['findBy']));var _0x1f2a30=this[_0x8b13('0x56')][_0x8b13('0x78')](this,_0xc43aba[_0x8b13('0x165')]);if(_0x1f2a30){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x168'),this['channel'][_0x8b13('0x3e')],_0xc43aba['findBy']));this[_0x8b13('0x38')][_0x8b13('0xae')](util['format'](_0x8b13('0x168'),this[_0x8b13('0x38')][_0x8b13('0x3e')],_0xc43aba[_0x8b13('0x165')]));return{'code':0xc8,'result':_0x8b13('0x169')};}else{logger[_0x8b13('0x32')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8b13('0x38')][_0x8b13('0x3e')],_0xc43aba['findBy']));this[_0x8b13('0x38')]['noop'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8b13('0x38')]['callerid'],_0xc43aba[_0x8b13('0x165')]));return{'code':0xc8,'result':_0x8b13('0x16b')};}};AGIVertices[_0x8b13('0x10')][_0x8b13('0x16d')]=function(_0x3a92d6){logger[_0x8b13('0x32')](util['format'](_0x8b13('0x16e'),_0x3a92d6[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x3a92d6[_0x8b13('0x16f')])){return this['channel'][_0x8b13('0x2e')](_0x3a92d6,'no\x20operation\x20configured');}this[_0x8b13('0x38')][_0x8b13('0xae')](util['format'](_0x8b13('0x170'),_0x3a92d6['operation']));var _0x555589=eval(_0x3a92d6[_0x8b13('0x16f')]);if(!this[_0x8b13('0xad')](_0x3a92d6[_0x8b13('0xe0')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0xdf'));}var _0x3e0f5f=this[_0x8b13('0x11')]['sync'](this,_0x3a92d6[_0x8b13('0xe0')]);if(!_0x3e0f5f){return this['channel'][_0x8b13('0x2e')](_0x3a92d6,_0x8b13('0x171'));}if(_[_0x8b13('0x9d')](_0x555589)){var _0x3bddea=this;_0x555589[_0x8b13('0xe1')](function(_0x4e8288,_0x4241de){_0x3bddea[_0x8b13('0x38')][_0x8b13('0xa3')](util[_0x8b13('0x2a')]('%s[%s]',_0x3e0f5f,_0x4241de),_0x4e8288);});return this[_0x8b13('0x38')][_0x8b13('0xae')](util['format']('variable\x20%s[key]\x20set',_0x3e0f5f));}else{return this[_0x8b13('0x38')][_0x8b13('0xa3')](_0x3e0f5f,_0x555589);}};AGIVertices['prototype'][_0x8b13('0xc')]=function(_0x3419cb){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x172'),_0x3419cb[_0x8b13('0x3a')]));if(_0x3419cb[_0x8b13('0x11c')]===0x0){return this['maxRetry'](_0x3419cb);}_0x3419cb[_0x8b13('0x11c')]-=0x1;if(!this[_0x8b13('0xad')](_0x3419cb['file_id'])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x3419cb,'no\x20file\x20audio\x20selected');}var _0x4dbfc0=this['getSound'][_0x8b13('0x78')](this,_0x3419cb[_0x8b13('0x11d')]);if(!_0x4dbfc0){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x3419cb,_0x8b13('0x11e'));}var _0x153cbb=this[_0x8b13('0x38')][_0x8b13('0x11f')](_0x4dbfc0,_0x3419cb['response'],_0x3419cb[_0x8b13('0x173')]);var _0x280127=_0x153cbb[_0x8b13('0xa8')];if(_0x153cbb[_0x8b13('0xa8')]===-0x1){this[_0x8b13('0x37')][_0x8b13('0x78')](this,_0x3419cb,'-1');return _0x153cbb;}else if(_0x153cbb[_0x8b13('0xa6')]===_0x8b13('0x6b')){_0x153cbb['result']=_0x153cbb[_0x8b13('0xa8')][_0x8b13('0x9e')]>0x0?_0x153cbb[_0x8b13('0xa8')]:'t';}else if(_[_0x8b13('0x47')](_0x153cbb['result'])){_0x153cbb[_0x8b13('0xa8')]='#';_0x280127='#';}if(!this[_0x8b13('0xad')](_0x3419cb[_0x8b13('0xe0')])){this['channel'][_0x8b13('0xae')](_0x8b13('0xdf'));}else{var _0x33d693=this[_0x8b13('0x11')][_0x8b13('0x78')](this,_0x3419cb[_0x8b13('0xe0')]);if(!_0x33d693){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x3419cb,_0x8b13('0x171'));}this[_0x8b13('0x38')][_0x8b13('0xa3')](_0x33d693,_0x280127);}this[_0x8b13('0x37')]['sync'](this,_0x3419cb,_0x280127);return _0x153cbb;};AGIVertices[_0x8b13('0x10')][_0x8b13('0xae')]=function(_0x5262c7){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x5262c7[_0x8b13('0x3a')]));return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x5262c7[_0x8b13('0x174')]||_0x5262c7[_0x8b13('0x3a')]);};AGIVertices[_0x8b13('0x10')][_0x8b13('0x175')]=function(_0x564edf){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x176'),_0x564edf[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x564edf[_0x8b13('0x165')])){return this['channel']['error'](_0x564edf,_0x8b13('0x166'));}logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x167'),this['channel']['callerid'],_0x564edf[_0x8b13('0x165')]));var _0xdf8d30=this[_0x8b13('0x51')]['sync'](this,_0x564edf[_0x8b13('0x177')]);var _0x75287a=this['agentPause'][_0x8b13('0x78')](this,_0x564edf[_0x8b13('0x165')],_0xdf8d30);if(_0x75287a){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x168'),this[_0x8b13('0x38')][_0x8b13('0x3e')],_0x564edf[_0x8b13('0x165')]));this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x168'),this[_0x8b13('0x38')][_0x8b13('0x3e')],_0x564edf['findBy']));return{'code':0xc8,'result':_0x8b13('0x169')};}else{logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x16a'),this[_0x8b13('0x38')]['callerid'],_0x564edf[_0x8b13('0x165')]));this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x168'),this[_0x8b13('0x38')]['callerid'],_0x564edf[_0x8b13('0x165')]));return{'code':0xc8,'result':_0x8b13('0x16b')};}};AGIVertices['prototype'][_0x8b13('0x178')]=function(_0x269c37){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x179'),_0x269c37[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x269c37[_0x8b13('0x11d')])){return this['channel']['error'](_0x269c37,_0x8b13('0x17a'));}var _0x108b1a=this[_0x8b13('0x1e')][_0x8b13('0x78')](this,_0x269c37[_0x8b13('0x11d')]);if(!_0x108b1a){return this['channel'][_0x8b13('0x2e')](_0x269c37,_0x8b13('0x11e'));}var _0x59032b=this[_0x8b13('0x38')][_0x8b13('0x5c')](_0x8b13('0x17b'),[_0x108b1a,_0x269c37['opts']]);if(_0x59032b[_0x8b13('0xa8')]===-0x1){return _0x59032b;}return this[_0x8b13('0x38')][_0x8b13('0xae')](util['format'](_0x8b13('0x17c'),_0x8b13('0x17b'),_0x108b1a));};AGIVertices['prototype'][_0x8b13('0x17d')]=function(_0x52b982){logger['info'](util['format'](_0x8b13('0x17e'),_0x52b982['label']));if(!this[_0x8b13('0xad')](_0x52b982[_0x8b13('0x17f')])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x52b982,_0x8b13('0x180'));}var _0xf4c3b1='';var _0x25bc42=parseInt(_0x52b982['queue_id'],0xa);if(isNaN(_0x25bc42)){_0xf4c3b1=_0x52b982[_0x8b13('0x17f')];}else{_0xf4c3b1=this['getVoiceQueue'][_0x8b13('0x78')](this,_0x52b982[_0x8b13('0x17f')]);if(!_0xf4c3b1){return this[_0x8b13('0x38')]['error'](_0x52b982,_0x8b13('0x181'));}}var _0x4ebfc7='';if(this[_0x8b13('0xad')](_0x52b982[_0x8b13('0x11d')])){var _0x307c9d=this['getSound'][_0x8b13('0x78')](this,_0x52b982[_0x8b13('0x11d')]);if(_0x307c9d){_0x4ebfc7=_0x307c9d;}}this[_0x8b13('0x37')]['sync'](this,_0x52b982,_0xf4c3b1);if(_0x52b982[_0x8b13('0xec')][_0x8b13('0x182')]('x')<0x0){_0x52b982['opts']+='x';}if(_0x52b982[_0x8b13('0xec')][_0x8b13('0x182')]('X')<0x0){_0x52b982['opts']+='X';}this['channel']['setVariable']('XMCS-QUEUE',_0xf4c3b1?_0xf4c3b1[_0x8b13('0x183')]():'');var _0x250d82=this[_0x8b13('0x38')][_0x8b13('0x5c')](_0x8b13('0x184'),[_0xf4c3b1,_0x52b982[_0x8b13('0xec')],_0x52b982[_0x8b13('0x6a')],_0x4ebfc7,_0x52b982[_0x8b13('0x6b')],_0x52b982['agi'],_0x52b982[_0x8b13('0x185')],_0x52b982[_0x8b13('0x186')],'',_0x52b982[_0x8b13('0x187')]]);if(_0x250d82[_0x8b13('0xa8')]===-0x1){return _0x250d82;}return this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')]('Executed\x20command\x20%s\x20%s','QUEUE',_0xf4c3b1));};AGIVertices[_0x8b13('0x10')]['record']=function(_0x46c04f){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x46c04f['label']));var _0x208425=_0x46c04f[_0x8b13('0x188')]||'wav';var _0x23bdc4=util[_0x8b13('0x2a')](_0x8b13('0x189'),this[_0x8b13('0x38')][_0x8b13('0x39')],rs['generate'](0x5));var _0x28a912=util[_0x8b13('0x2a')](_0x8b13('0x18a'),FILES_PATH,_0x23bdc4,_0x208425);var _0x4075c6=util[_0x8b13('0x2a')](_0x8b13('0x13a'),FILES_PATH,_0x23bdc4);this['createSquareRecording'][_0x8b13('0x78')](this,_0x46c04f,_0x23bdc4,_0x28a912);this[_0x8b13('0x38')][_0x8b13('0xa3')]('RECORDING_SAVENAME',_0x23bdc4);logger['info'](_0x8b13('0x18b'),_0x4075c6,_0x208425,_0x46c04f[_0x8b13('0x18c')],_0x46c04f[_0x8b13('0x6b')]);return this[_0x8b13('0x38')][_0x8b13('0x13c')](_0x4075c6,_0x208425,_0x46c04f[_0x8b13('0x18c')],_0x46c04f[_0x8b13('0x6b')],undefined,!![]);};AGIVertices[_0x8b13('0x10')][_0x8b13('0x18d')]=function(_0x3fff1c){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x3fff1c[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x3fff1c[_0x8b13('0x6a')])){return this['channel'][_0x8b13('0xae')](_0x8b13('0x18e'));}var _0x33c2e7=this[_0x8b13('0x69')][_0x8b13('0x78')](this,_0x3fff1c);logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x18f'),util[_0x8b13('0x190')](_0x33c2e7,{'showHidden':![],'depth':null})));if(!this[_0x8b13('0xad')](_0x3fff1c[_0x8b13('0xe0')])){return this['channel'][_0x8b13('0xae')](_0x8b13('0x191'));}var _0x33ca8f=this[_0x8b13('0x11')]['sync'](this,_0x3fff1c['variable_id']);if(!_0x33ca8f){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x3fff1c,_0x8b13('0x171'));}this[_0x8b13('0x38')][_0x8b13('0xa3')](util[_0x8b13('0x2a')]('%s_STATUS_CODE',_0x33ca8f),_0x33c2e7['statusCode']?_0x33c2e7[_0x8b13('0x192')]:_0x8b13('0x193'));this[_0x8b13('0x38')][_0x8b13('0xa3')](util['format'](_0x8b13('0x194'),_0x33ca8f),_0x33c2e7['statusMessage']?_0x33c2e7[_0x8b13('0x195')]:'OK');if(_0x33c2e7[_0x8b13('0x72')]){try{this[_0x8b13('0xa1')](_0x33c2e7[_0x8b13('0x72')],_0x33ca8f);}catch(_0x399703){logger[_0x8b13('0x2e')](util[_0x8b13('0x2a')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x33ca8f));}}return this['channel'][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0xe4'),_0x33ca8f));};AGIVertices[_0x8b13('0x10')]['saydigits']=function(_0x289ee9){logger[_0x8b13('0x32')](util['format'](_0x8b13('0x196'),_0x289ee9['label']));return this[_0x8b13('0x38')]['sayDigits'](_0x289ee9[_0x8b13('0x197')][_0x8b13('0x5e')](/\s+/g,''),_0x289ee9['escape_digits']);};AGIVertices['prototype'][_0x8b13('0x198')]=function(_0x23f7aa){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x199'),_0x23f7aa[_0x8b13('0x3a')]));return this['channel']['sayNumber'](_0x23f7aa[_0x8b13('0x6c')]['replace'](/\s+/g,''),_0x23f7aa['escape_digits']);};AGIVertices[_0x8b13('0x10')][_0x8b13('0x19a')]=function(_0x12fe4b){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x19b'),_0x12fe4b[_0x8b13('0x3a')]));return this[_0x8b13('0x38')][_0x8b13('0x19c')](_0x12fe4b[_0x8b13('0x62')],_0x12fe4b[_0x8b13('0x18c')]);};AGIVertices[_0x8b13('0x10')][_0x8b13('0x19d')]=function(_0x6b78f6){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x19e'),_0x6b78f6['label']));if(!this[_0x8b13('0xad')](_0x6b78f6['account_id'])){return this[_0x8b13('0x38')]['noop'](_0x8b13('0x19f'));}var _0xbe27cf=this[_0x8b13('0x22')][_0x8b13('0x78')](this,_0x6b78f6[_0x8b13('0x1a0')]);if(!_0xbe27cf||!_0xbe27cf[_0x8b13('0x1a1')]){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x6b78f6,_0x8b13('0x1a2'));}var _0x4da52a={'from':util['format'](_0x8b13('0x1a3'),_0xbe27cf['name'],_0xbe27cf[_0x8b13('0x1a4')]||_0xbe27cf[_0x8b13('0x1a1')]['user']),'to':_0x6b78f6['to']||'','cc':_0x6b78f6['cc']||'','bcc':_0x6b78f6[_0x8b13('0x1a5')]||'','subject':_0x6b78f6[_0x8b13('0x1a6')],'html':_0x6b78f6[_0x8b13('0x62')],'text':_0x6b78f6[_0x8b13('0x62')]};if(this[_0x8b13('0xad')](_0x6b78f6[_0x8b13('0x1a7')])){}logger[_0x8b13('0x1a8')](_0x8b13('0x1a9'),JSON['stringify'](_0x4da52a));this[_0x8b13('0x37')]['sync'](this,_0x6b78f6,_0x6b78f6[_0x8b13('0x1a0')]);this['channel'][_0x8b13('0xae')](util['format'](_0x8b13('0x1aa'),_0xbe27cf[_0x8b13('0x14')]));this[_0x8b13('0x24')]['sync'](this,_0xbe27cf[_0x8b13('0x1ab')],_0x4da52a);return this[_0x8b13('0x38')][_0x8b13('0xae')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x8b13('0x10')]['sendFax']=function(_0x2cb68a){logger[_0x8b13('0x32')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x2cb68a[_0x8b13('0x3a')]));return this['channel']['noop'](_0x8b13('0x1ac'));};AGIVertices[_0x8b13('0x10')]['sendSMS']=function(_0x2728c5){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x1ad'),_0x2728c5[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x2728c5[_0x8b13('0x1ae')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0x1af'));}var _0x508ae6=this[_0x8b13('0x1b0')]['sync'](this,_0x2728c5[_0x8b13('0x1ae')]);if(!_0x508ae6){return this[_0x8b13('0x38')]['error'](_0x2728c5,'no\x20sms\x20account\x20found');}var _0x3645c7={'body':_0x2728c5[_0x8b13('0x1b1')],'phone':_0x2728c5['to']||'','SmsAccountId':_0x508ae6['id']};logger[_0x8b13('0x1a8')]('sendSMS\x20message',JSON[_0x8b13('0x7b')](_0x3645c7));this[_0x8b13('0x37')]['sync'](this,_0x2728c5,_0x2728c5[_0x8b13('0x1ae')]);this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x1b2'),_0x508ae6[_0x8b13('0x14')]));this['createSmsMessage'][_0x8b13('0x78')](this,_0x3645c7);return this[_0x8b13('0x38')]['noop'](_0x8b13('0x1b3'));};AGIVertices[_0x8b13('0x10')]['set']=function(_0x5219bc){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x5219bc[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x5219bc['variable_id'])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x5219bc,_0x8b13('0x1b4'));}var _0x25ee4c=this[_0x8b13('0x11')][_0x8b13('0x78')](this,_0x5219bc[_0x8b13('0xe0')]);if(!_0x25ee4c){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x5219bc,'no\x20variable\x20found');}return this['channel'][_0x8b13('0xa3')](_0x25ee4c,_0x5219bc[_0x8b13('0x1b5')]);};AGIVertices[_0x8b13('0x10')][_0x8b13('0x1b6')]=function(_0x25fde4){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x1b7'),_0x25fde4['label']));this[_0x8b13('0x38')]['noop']('START\x20CALLY\x20SQUARE');var _0x381d7d=this[_0x8b13('0x38')]['getVariable'](_0x8b13('0x1b8'));if(!_[_0x8b13('0x47')](_0x381d7d[_0x8b13('0xa6')])){this[_0x8b13('0x38')][_0x8b13('0x39')]=_0x381d7d[_0x8b13('0xa6')];}if(_0x25fde4['answer']==='yes'){this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0x1b9'));return this[_0x8b13('0x38')][_0x8b13('0xbc')]();}return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0x1ba'));};AGIVertices[_0x8b13('0x10')][_0x8b13('0x1bb')]=function(_0x4ed2f1){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x4ed2f1[_0x8b13('0x3a')]));if(!this[_0x8b13('0xad')](_0x4ed2f1['project_id'])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x4ed2f1,_0x8b13('0x1bc'));}var _0x51c000=this[_0x8b13('0x1bd')][_0x8b13('0x78')](this,_0x4ed2f1[_0x8b13('0x1be')]);if(!this[_0x8b13('0xad')](_0x51c000)){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x4ed2f1,util[_0x8b13('0x2a')](_0x8b13('0x1bf'),_0x4ed2f1[_0x8b13('0x1be')]));}if(_0x51c000===this[_0x8b13('0x38')][_0x8b13('0x3c')]){return this['channel'][_0x8b13('0x2e')](_0x4ed2f1,_0x8b13('0x1c0'));}this['createSquareDetailsReport'][_0x8b13('0x78')](this,_0x4ed2f1,_0x51c000);var _0x3b7d8c=this[_0x8b13('0x38')][_0x8b13('0x5c')](_0x8b13('0x1c1'),util[_0x8b13('0x2a')](_0x8b13('0x1c2'),config[_0x8b13('0x8')][_0x8b13('0x1c3')]||_0x8b13('0x1c4'),_0x51c000,this[_0x8b13('0x38')][_0x8b13('0x3c')]));if(_0x3b7d8c['result']===-0x1){return _0x3b7d8c;}return this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x17c'),_0x8b13('0x1c1'),_0x51c000));};AGIVertices[_0x8b13('0x10')]['system']=function(_0x3fdcf0){logger[_0x8b13('0x32')](util['format'](_0x8b13('0x1c5'),_0x3fdcf0[_0x8b13('0x3a')]));var _0x45f48e=this[_0x8b13('0x5b')][_0x8b13('0x78')](this,_0x3fdcf0[_0x8b13('0xba')]);this[_0x8b13('0x37')][_0x8b13('0x78')](this,_0x3fdcf0,_0x3fdcf0['command']);if(this[_0x8b13('0xad')](_0x3fdcf0[_0x8b13('0xe0')])){var _0x43fcc9=this[_0x8b13('0x11')][_0x8b13('0x78')](this,_0x3fdcf0[_0x8b13('0xe0')]);if(_0x43fcc9){this[_0x8b13('0x38')][_0x8b13('0xa3')](_0x43fcc9,_0x45f48e);return this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x1c6'),_0x3fdcf0[_0x8b13('0xba')],_0x43fcc9));}}return this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x1c7'),_0x3fdcf0[_0x8b13('0xba')]));};AGIVertices[_0x8b13('0x10')][_0x8b13('0x1c8')]=function(_0xb289f7){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x1c9'),_0xb289f7[_0x8b13('0x3a')]));_0xb289f7[_0x8b13('0x62')]=_0xb289f7[_0x8b13('0x62')][_0x8b13('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8b13('0xad')](_0xb289f7[_0x8b13('0x60')])){return this[_0x8b13('0x38')]['noop'](_0x8b13('0x1ca'));}if(!this[_0x8b13('0xad')](_0xb289f7[_0x8b13('0x62')])){return this[_0x8b13('0x38')][_0x8b13('0xae')](_0x8b13('0xaf'));}this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x1cb'),_0xb289f7['text']));var _0x2bb067=this[_0x8b13('0x5f')][_0x8b13('0x78')](this,_0xb289f7);if(_0x2bb067){this[_0x8b13('0x38')]['noop'](util[_0x8b13('0x2a')](_0x8b13('0x1cc'),_0x2bb067));var _0x1e5619=this['channel'][_0x8b13('0x10c')](_0x2bb067);try{fs[_0x8b13('0x10d')](_0x2bb067+_0x8b13('0x10e'));}catch(_0x2dba50){logger[_0x8b13('0x2e')](_0x2dba50);}return _0x1e5619;}return this[_0x8b13('0x38')]['error'](_0xb289f7,_0x8b13('0x1cd'));};AGIVertices['prototype'][_0x8b13('0x1ce')]=function(_0x21c7e1){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x1cf'),_0x21c7e1['label']));_0x21c7e1[_0x8b13('0x62')]=_0x21c7e1['text'][_0x8b13('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8b13('0xad')](_0x21c7e1[_0x8b13('0x62')])){return this[_0x8b13('0x38')][_0x8b13('0xae')]('no\x20text\x20configured');}this['channel'][_0x8b13('0xae')](util[_0x8b13('0x2a')]('Trying\x20Google\x20TTS\x20%s',_0x21c7e1[_0x8b13('0x62')]));var _0x342252=this[_0x8b13('0x67')]['sync'](this,_0x21c7e1);if(_0x342252){this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')]('Google\x20TTS\x20%s\x20file\x20created',_0x342252));var _0x4025b1=this[_0x8b13('0x38')][_0x8b13('0x10c')](_0x342252);try{fs[_0x8b13('0x10d')](_0x342252+_0x8b13('0x10e'));}catch(_0x3815d3){logger[_0x8b13('0x2e')](_0x3815d3);}return _0x4025b1;}return this[_0x8b13('0x38')]['error'](_0x21c7e1,_0x8b13('0x1d0'));};AGIVertices[_0x8b13('0x10')]['unpause']=function(_0x515152){logger[_0x8b13('0x32')](util['format'](_0x8b13('0x1d1'),_0x515152['label']));if(!this['isConfigured'](_0x515152['findBy'])){return this[_0x8b13('0x38')][_0x8b13('0x2e')](_0x515152,_0x8b13('0x166'));}logger[_0x8b13('0x32')](util['format'](_0x8b13('0x167'),this[_0x8b13('0x38')]['callerid'],_0x515152[_0x8b13('0x165')]));var _0x4f5075=this['agentUnpause'][_0x8b13('0x78')](this,_0x515152['findBy']);if(_0x4f5075){logger['info'](util[_0x8b13('0x2a')](_0x8b13('0x168'),this[_0x8b13('0x38')][_0x8b13('0x3e')],_0x515152[_0x8b13('0x165')]));this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x168'),this[_0x8b13('0x38')][_0x8b13('0x3e')],_0x515152['findBy']));return{'code':0xc8,'result':_0x8b13('0x169')};}else{logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x16a'),this['channel'][_0x8b13('0x3e')],_0x515152[_0x8b13('0x165')]));this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x16a'),this[_0x8b13('0x38')]['callerid'],_0x515152[_0x8b13('0x165')]));return{'code':0xc8,'result':_0x8b13('0x16b')};}};AGIVertices['prototype'][_0x8b13('0x1d2')]=function(_0x483c0c){logger['info'](util[_0x8b13('0x2a')](_0x8b13('0x1d3'),_0x483c0c[_0x8b13('0x3a')]));var _0x32589e=this['channel'][_0x8b13('0x5c')]('VOICEMAIL',[_0x483c0c['mailbox'],_0x483c0c[_0x8b13('0x7e')]]);if(_0x32589e['result']===-0x1){return _0x32589e;}return this[_0x8b13('0x38')][_0x8b13('0xae')](util[_0x8b13('0x2a')](_0x8b13('0x17c'),_0x8b13('0x1d4'),_0x483c0c['mailbox']));};AGIVertices[_0x8b13('0x10')][_0x8b13('0x1d5')]=function(_0x27ca47){logger[_0x8b13('0x32')](util[_0x8b13('0x2a')](_0x8b13('0x1d6'),_0x27ca47['label']));if(!this[_0x8b13('0xad')](_0x27ca47[_0x8b13('0xe0')])){return this[_0x8b13('0x38')]['error'](_0x27ca47,'no\x20variable\x20selected');}var _0x3c87e4=this[_0x8b13('0x11')][_0x8b13('0x78')](this,_0x27ca47[_0x8b13('0xe0')]);if(!_0x3c87e4){return this['channel'][_0x8b13('0x2e')](_0x27ca47,_0x8b13('0x171'));}var _0x17d5cd=this[_0x8b13('0x38')][_0x8b13('0x11')](_0x3c87e4);return{'code':0xc8,'result':_0x17d5cd[_0x8b13('0xa6')]?_0x17d5cd[_0x8b13('0xa6')]:'-'};};String[_0x8b13('0x10')][_0x8b13('0xa5')]=function(_0x3a6607,_0x37f533){return this[_0x8b13('0xa4')](_0x3a6607)[_0x8b13('0x1d7')](_0x37f533);};module[_0x8b13('0x1d8')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 6f5ab95..ff5a5ec 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 _0x06bf=['savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','syncAgentConnectPreview','isUndefined','[%s][HANGUP:UNIQUEID]','[%s][HANGUP:LINKEDID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','exports','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','agents','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','attended','destlinkedid'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x06bf,0x13a));var _0xf06b=function(_0x5b6d51,_0x10c604){_0x5b6d51=_0x5b6d51-0x0;var _0x1017eb=_0x06bf[_0x5b6d51];return _0x1017eb;};'use strict';var _=require(_0xf06b('0x0'));var moment=require('moment');var ami=require(_0xf06b('0x1'));var logger=require(_0xf06b('0x2'))(_0xf06b('0x3'));var RpcUser=require(_0xf06b('0x4'));var RpcVoiceAgentReport=require(_0xf06b('0x5'));function Acw(_0x562734){this['voiceQueues']=_0x562734[_0xf06b('0x6')];this['agents']=_0x562734['agents'];this['timers']=_0x562734[_0xf06b('0x7')];this[_0xf06b('0x8')]={};ami['on'](_0xf06b('0x9'),this[_0xf06b('0xa')][_0xf06b('0xb')](this));ami['on'](_0xf06b('0xc'),this[_0xf06b('0xd')][_0xf06b('0xb')](this));ami['on']('hangup',this[_0xf06b('0xe')]['bind'](this));ami['on'](_0xf06b('0xf'),this['syncAgentRingNoAnswer'][_0xf06b('0xb')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0xf06b('0x10'),this[_0xf06b('0x11')][_0xf06b('0xb')](this));ami['on'](_0xf06b('0x12'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x4cdd47){var _0x3bc09e=moment()['milliseconds'](0x0);var _0x245603=moment(_0x4cdd47)[_0xf06b('0x13')](0x0);return _0x3bc09e[_0xf06b('0x14')](_0x245603,_0xf06b('0x15'));}Acw[_0xf06b('0x16')][_0xf06b('0x17')]=function(_0x2d666d,_0x597719){var _0x657d7a=this;var _0x851b56=getDiff(_0x657d7a[_0xf06b('0x7')][_0x2d666d][_0xf06b('0x18')]);clearTimeout(_0x657d7a['timers'][_0x2d666d]['timer']);_0x657d7a['timers'][_0x2d666d][_0xf06b('0x19')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x851b56},_0x657d7a[_0xf06b('0x7')][_0x2d666d]['uniqueid'],_0x2d666d)['then'](function(_0x53fca3){logger[_0xf06b('0x1a')](_0xf06b('0x1b'),_0x597719,_0x851b56,_0x53fca3);})[_0xf06b('0x1c')](function(_0x54d752){logger[_0xf06b('0x1d')](_0xf06b('0x1e'),_0x597719,_0x54d752);})[_0xf06b('0x1f')](function(){delete _0x657d7a['timers'][_0x2d666d];});};Acw['prototype'][_0xf06b('0x20')]=function(_0x4325ed){try{var _0x5a7a46=this;var _0x4e8227=this['channels'][_0x4325ed][_0xf06b('0x21')];var _0x8356cc=this[_0xf06b('0x8')][_0x4325ed]['queue'];var _0x34d435=this[_0xf06b('0x6')][_0x8356cc];var _0x4463ea=![];var _0x3359cf=_0xf06b('0x22');if(_0x34d435[_0xf06b('0x23')]&&_0x34d435[_0xf06b('0x24')][_0xf06b('0x25')]){_0x4463ea=!![];_0x3359cf=_0x34d435[_0xf06b('0x24')]['name'];}return ami['Action']({'action':_0xf06b('0x26'),'interface':_0x4e8227,'paused':!![],'reason':_0x3359cf})[_0xf06b('0x27')](function(){if(_0x5a7a46[_0xf06b('0x28')][_0x4e8227]){return RpcUser[_0xf06b('0x29')](_0x5a7a46[_0xf06b('0x28')][_0x4e8227]['id'])['then'](function(_0x5b07cf){if(!_0x5b07cf||_0x5b07cf[_0xf06b('0x2a')]){logger[_0xf06b('0x1a')](_0xf06b('0x2b'),_0x4325ed,_0x4e8227,_0x8356cc);return;}logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x4325ed,_0x4e8227,_0x8356cc);var _0x4f51b3=_0x5a7a46[_0xf06b('0x8')][_0x4325ed][_0xf06b('0x2c')]&&_0x5a7a46[_0xf06b('0x8')][_0x4325ed][_0xf06b('0x2d')]?_0x5a7a46[_0xf06b('0x8')][_0x4325ed][_0xf06b('0x2d')]:_0x4325ed;return RpcUser[_0xf06b('0x2e')](_0x5a7a46[_0xf06b('0x28')][_0x4e8227],_0x3359cf,_0x4f51b3)[_0xf06b('0x27')](function(_0x16c4ee){_0x5a7a46[_0xf06b('0x6')][_0x8356cc][_0xf06b('0x2f')]-=0x1;_0x5a7a46[_0xf06b('0x6')][_0x8356cc][_0xf06b('0x30')]+=0x1;return _0x16c4ee;});})[_0xf06b('0x27')](function(_0x1768af){if(_0x4463ea||!_0x1768af){return;}_0x5a7a46[_0xf06b('0x7')][_0x4e8227]={};logger[_0xf06b('0x1a')](_0xf06b('0x31'),_0x4325ed,_0x5a7a46[_0xf06b('0x6')][_0x8356cc][_0xf06b('0x32')],_0x4e8227,_0x8356cc);_0x5a7a46[_0xf06b('0x7')][_0x4e8227][_0xf06b('0x19')]=setTimeout(_0x5a7a46[_0xf06b('0x33')][_0xf06b('0xb')](_0x5a7a46,_0x4e8227),_0x5a7a46[_0xf06b('0x6')][_0x8356cc][_0xf06b('0x32')]*0x3e8);_0x5a7a46['timers'][_0x4e8227][_0xf06b('0x18')]=moment()[_0xf06b('0x34')](_0xf06b('0x35'));_0x5a7a46[_0xf06b('0x7')][_0x4e8227][_0xf06b('0x36')]=_0x4325ed;_0x5a7a46[_0xf06b('0x7')][_0x4e8227][_0xf06b('0x37')]=_0x8356cc;_0x5a7a46[_0xf06b('0x7')][_0x4e8227][_0xf06b('0x17')]=_0x5a7a46[_0xf06b('0x17')][_0xf06b('0xb')](_0x5a7a46,_0x4e8227,_0x4325ed);});}})[_0xf06b('0x1c')](function(){logger[_0xf06b('0x1d')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4325ed,_0x5a7a46[_0xf06b('0x6')][_0x8356cc][_0xf06b('0x32')],_0x4e8227,_0x8356cc);})[_0xf06b('0x1f')](function(){delete _0x5a7a46[_0xf06b('0x8')][_0x4325ed];});}catch(_0x1d527a){logger[_0xf06b('0x1d')](_0xf06b('0x38'),_0x1d527a[_0xf06b('0x39')]);}};Acw[_0xf06b('0x16')][_0xf06b('0x33')]=function(_0x110bb4){try{var _0x58cc8f=this;if(_0x58cc8f[_0xf06b('0x7')][_0x110bb4]){_0x58cc8f['timers'][_0x110bb4][_0xf06b('0x19')]=![];var _0x38e251=_0x58cc8f[_0xf06b('0x7')][_0x110bb4][_0xf06b('0x36')];var _0x49d353=_0x58cc8f['timers'][_0x110bb4][_0xf06b('0x37')];var _0x404482=_0x58cc8f['voiceQueues'][_0x49d353][_0xf06b('0x32')];logger['info'](_0xf06b('0x3a'),_0x38e251,_0x110bb4);RpcUser['getAgent'](this[_0xf06b('0x28')][_0x110bb4]['id'])[_0xf06b('0x27')](function(_0x51b6d4){if(_0x51b6d4['pauseType']===_0xf06b('0x22')){return RpcUser[_0xf06b('0x3b')](_0x58cc8f[_0xf06b('0x28')][_0x110bb4]);}});RpcVoiceAgentReport[_0xf06b('0x3c')]({'acwtime':_0x404482,'agentacw':!![]},_0x38e251,_0x110bb4)['then'](function(_0x267a2e){logger[_0xf06b('0x1a')](_0xf06b('0x1b'),_0x38e251,_0x404482,_0x267a2e);})[_0xf06b('0x1c')](function(_0x1362e7){logger[_0xf06b('0x1d')](_0xf06b('0x1e'),_0x38e251,_0x1362e7);});}else{logger[_0xf06b('0x1d')](_0xf06b('0x3d'),_0x110bb4);if(_0x58cc8f[_0xf06b('0x7')]){logger[_0xf06b('0x1a')](_0xf06b('0x3e'),JSON[_0xf06b('0x3f')](_0x58cc8f[_0xf06b('0x7')]));}}}catch(_0x1adc17){logger[_0xf06b('0x1d')]('[ACW][STOP]\x20%s',_0x1adc17[_0xf06b('0x39')]);}};Acw[_0xf06b('0x16')][_0xf06b('0xa')]=function(_0x33b9e9){try{if(this[_0xf06b('0x6')][_0x33b9e9[_0xf06b('0x37')]]&&(this['voiceQueues'][_0x33b9e9['queue']]['acw']||this[_0xf06b('0x6')][_0x33b9e9['queue']]['mandatoryDisposition'])){if(this[_0xf06b('0x28')][_0x33b9e9[_0xf06b('0x21')]]){this[_0xf06b('0x8')][_0x33b9e9[_0xf06b('0x36')]]={'queue':_0x33b9e9[_0xf06b('0x37')],'interface':_0x33b9e9[_0xf06b('0x21')],'destlinkedid':_0x33b9e9[_0xf06b('0x2d')]};}}}catch(_0x16dbc1){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x16dbc1[_0xf06b('0x39')]);}};Acw[_0xf06b('0x16')][_0xf06b('0x40')]=function(_0x5cf882){try{if(this['voiceQueues'][_0x5cf882[_0xf06b('0x37')]]&&(this[_0xf06b('0x6')][_0x5cf882[_0xf06b('0x37')]][_0xf06b('0x3')]||this[_0xf06b('0x6')][_0x5cf882['queue']][_0xf06b('0x23')])){if(this[_0xf06b('0x28')][_0x5cf882[_0xf06b('0x21')]]){this[_0xf06b('0x8')][_0x5cf882[_0xf06b('0x36')]]={'queue':_0x5cf882['queue'],'interface':_0x5cf882[_0xf06b('0x21')]};}}}catch(_0xdfe194){logger[_0xf06b('0x1d')]('[ACW][syncAgentConnectPreview]\x20%s',_0xdfe194[_0xf06b('0x39')]);}};Acw[_0xf06b('0x16')]['syncHangupRequest']=function(_0x226e35){try{if(this[_0xf06b('0x8')][_0x226e35[_0xf06b('0x36')]]&&_[_0xf06b('0x41')](this[_0xf06b('0x8')][_0x226e35[_0xf06b('0x36')]][_0xf06b('0x2c')])){logger[_0xf06b('0x1a')](_0xf06b('0x42'),_0x226e35[_0xf06b('0x36')]);this[_0xf06b('0x20')](_0x226e35[_0xf06b('0x36')]);}else if(this[_0xf06b('0x8')][_0x226e35['linkedid']]&&_[_0xf06b('0x41')](this[_0xf06b('0x8')][_0x226e35['linkedid']][_0xf06b('0x2c')])){logger['info'](_0xf06b('0x43'),_0x226e35[_0xf06b('0x44')]);this[_0xf06b('0x20')](_0x226e35['linkedid']);}}catch(_0x35a564){logger[_0xf06b('0x1d')](_0xf06b('0x45'),_0x35a564[_0xf06b('0x39')]);}};Acw[_0xf06b('0x16')][_0xf06b('0xe')]=function(_0x3b58f8){try{if(this[_0xf06b('0x8')][_0x3b58f8[_0xf06b('0x36')]]&&this[_0xf06b('0x8')][_0x3b58f8[_0xf06b('0x36')]]['attended']){logger[_0xf06b('0x1a')](_0xf06b('0x46'),_0x3b58f8[_0xf06b('0x36')]);this[_0xf06b('0x20')](_0x3b58f8['uniqueid']);}else if(this[_0xf06b('0x8')][_0x3b58f8[_0xf06b('0x44')]]&&this[_0xf06b('0x8')][_0x3b58f8['linkedid']]['attended']){logger[_0xf06b('0x1a')](_0xf06b('0x47'),_0x3b58f8[_0xf06b('0x44')]);this['startAcw'](_0x3b58f8[_0xf06b('0x44')]);}}catch(_0x1267ed){logger[_0xf06b('0x1d')](_0xf06b('0x48'),_0x1267ed[_0xf06b('0x39')]);}};Acw[_0xf06b('0x16')][_0xf06b('0x49')]=function(_0x5dc35d){try{if(!_[_0xf06b('0x4a')](this[_0xf06b('0x8')][_0x5dc35d[_0xf06b('0x4b')]])){this[_0xf06b('0x20')](_0x5dc35d[_0xf06b('0x4b')]);if(this[_0xf06b('0x8')][_0x5dc35d[_0xf06b('0x4c')]]){this[_0xf06b('0x8')][_0x5dc35d[_0xf06b('0x4c')]][_0xf06b('0x2c')]=!![];this['channels'][_0x5dc35d[_0xf06b('0x4d')]]=this[_0xf06b('0x8')][_0x5dc35d['secondtransfereruniqueid']];this[_0xf06b('0x4e')](_0x5dc35d[_0xf06b('0x4c')]);}}else if(!_['isNil'](this['channels'][_0x5dc35d['transfertargetuniqueid']])){this[_0xf06b('0x20')](_0x5dc35d[_0xf06b('0x4d')]);if(this[_0xf06b('0x8')][_0x5dc35d[_0xf06b('0x4f')]]){this[_0xf06b('0x8')][_0x5dc35d[_0xf06b('0x4f')]][_0xf06b('0x2c')]=!![];this[_0xf06b('0x8')][_0x5dc35d['transfereeuniqueid']]=this['channels'][_0x5dc35d['origtransfereruniqueid']];this[_0xf06b('0x4e')](_0x5dc35d[_0xf06b('0x4f')]);}}}catch(_0x429b0d){logger[_0xf06b('0x1d')](_0xf06b('0x50'),_0x429b0d[_0xf06b('0x39')]);}};Acw[_0xf06b('0x16')][_0xf06b('0x11')]=function(_0xae3eff){try{if(this['channels'][_0xae3eff[_0xf06b('0x51')]]){logger[_0xf06b('0x1a')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xf06b('0x3f')](_0xae3eff[_0xf06b('0x51')]));this[_0xf06b('0x20')](_0xae3eff[_0xf06b('0x51')]);}else if(this[_0xf06b('0x8')][_0xae3eff['transfererlinkedid']]){logger[_0xf06b('0x1a')](_0xf06b('0x52'),JSON['stringify'](_0xae3eff[_0xf06b('0x53')]));this['startAcw'](_0xae3eff['transfererlinkedid']);}}catch(_0x543206){logger['error'](_0xf06b('0x54'),_0x543206[_0xf06b('0x39')]);}};Acw[_0xf06b('0x16')][_0xf06b('0x55')]=function(_0x286ae3){try{if(this['voiceQueues'][_0x286ae3['queue']]&&this['voiceQueues'][_0x286ae3['queue']][_0xf06b('0x56')]===_0xf06b('0x57')){if(this['agents'][_0x286ae3['interface']]){logger[_0xf06b('0x1a')](_0xf06b('0x58'),_0x286ae3[_0xf06b('0x36')],_0x286ae3[_0xf06b('0x21')],_0x286ae3[_0xf06b('0x37')]);return RpcUser[_0xf06b('0x2e')](this[_0xf06b('0x28')][_0x286ae3['interface']],'Auto-Pause',_0x286ae3[_0xf06b('0x36')]);}}}catch(_0x3ce5e2){logger[_0xf06b('0x1d')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x3ce5e2[_0xf06b('0x39')]);}};Acw['prototype'][_0xf06b('0x4e')]=function(_0x377b2b,_0x4223a9=0x2710){if(this['channels'][_0x377b2b]){setTimeout(()=>{delete this[_0xf06b('0x8')][_0x377b2b];},_0x4223a9);}};module[_0xf06b('0x59')]=Acw; \ No newline at end of file +var _0x7d66=['milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','info','catch','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','ACW','mandatoryDispositionPause','name','Action','then','agents','getAgent','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','queue','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','[%s][UPDATE][ACWTIME:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../ami','acw','../rpc/voiceAgentReport','voiceQueues','timers','channels','syncAgentConnect','syncHangupRequest','bind','hangup','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview'];(function(_0x3ede5e,_0x2634de){var _0x317ddf=function(_0xa4cdb4){while(--_0xa4cdb4){_0x3ede5e['push'](_0x3ede5e['shift']());}};_0x317ddf(++_0x2634de);}(_0x7d66,0xe6));var _0x67d6=function(_0x1ebeea,_0x2f54f4){_0x1ebeea=_0x1ebeea-0x0;var _0x576465=_0x7d66[_0x1ebeea];return _0x576465;};'use strict';var _=require(_0x67d6('0x0'));var moment=require('moment');var ami=require(_0x67d6('0x1'));var logger=require('../../../config/logger')(_0x67d6('0x2'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x67d6('0x3'));function Acw(_0x35f166){this[_0x67d6('0x4')]=_0x35f166['voiceQueues'];this['agents']=_0x35f166['agents'];this[_0x67d6('0x5')]=_0x35f166[_0x67d6('0x5')];this[_0x67d6('0x6')]={};ami['on']('agentconnect',this[_0x67d6('0x7')]['bind'](this));ami['on']('hanguprequest',this[_0x67d6('0x8')][_0x67d6('0x9')](this));ami['on'](_0x67d6('0xa'),this['syncHangup'][_0x67d6('0x9')](this));ami['on']('agentringnoanswer',this[_0x67d6('0xb')][_0x67d6('0x9')](this));ami['on']('attendedtransfer',this[_0x67d6('0xc')]['bind'](this));ami['on'](_0x67d6('0xd'),this[_0x67d6('0xe')][_0x67d6('0x9')](this));ami['on']('custom:agentConnectPreview',this[_0x67d6('0xf')][_0x67d6('0x9')](this));}function getDiff(_0x1c6209){var _0x2e82dd=moment()[_0x67d6('0x10')](0x0);var _0x374361=moment(_0x1c6209)[_0x67d6('0x10')](0x0);return _0x2e82dd[_0x67d6('0x11')](_0x374361,_0x67d6('0x12'));}Acw[_0x67d6('0x13')][_0x67d6('0x14')]=function(_0x2c07e0,_0x55b68d){var _0x25effe=this;var _0x30a5a0=getDiff(_0x25effe[_0x67d6('0x5')][_0x2c07e0][_0x67d6('0x15')]);clearTimeout(_0x25effe[_0x67d6('0x5')][_0x2c07e0]['timer']);_0x25effe[_0x67d6('0x5')][_0x2c07e0][_0x67d6('0x16')]=![];return RpcVoiceAgentReport[_0x67d6('0x17')]({'acwtime':_0x30a5a0},_0x25effe['timers'][_0x2c07e0][_0x67d6('0x18')],_0x2c07e0)['then'](function(_0x269388){logger[_0x67d6('0x19')]('[%s][UPDATE][ACWTIME:%s]',_0x55b68d,_0x30a5a0,_0x269388);})[_0x67d6('0x1a')](function(_0xd3d1ca){logger[_0x67d6('0x1b')](_0x67d6('0x1c'),_0x55b68d,_0xd3d1ca);})[_0x67d6('0x1d')](function(){delete _0x25effe['timers'][_0x2c07e0];});};Acw[_0x67d6('0x13')][_0x67d6('0x1e')]=function(_0x44a963){try{var _0xf0f3fb=this;var _0x30c237=this[_0x67d6('0x6')][_0x44a963][_0x67d6('0x1f')];var _0x4e6b1d=this[_0x67d6('0x6')][_0x44a963]['queue'];var _0x51eefa=this[_0x67d6('0x4')][_0x4e6b1d];var _0x5e8819=![];var _0x5eea6a=_0x67d6('0x20');if(_0x51eefa['mandatoryDisposition']&&_0x51eefa[_0x67d6('0x21')][_0x67d6('0x22')]){_0x5e8819=!![];_0x5eea6a=_0x51eefa[_0x67d6('0x21')][_0x67d6('0x22')];}return ami[_0x67d6('0x23')]({'action':'QueuePause','interface':_0x30c237,'paused':!![],'reason':_0x5eea6a})[_0x67d6('0x24')](function(){if(_0xf0f3fb[_0x67d6('0x25')][_0x30c237]){return RpcUser[_0x67d6('0x26')](_0xf0f3fb[_0x67d6('0x25')][_0x30c237]['id'])['then'](function(_0x403ab3){if(!_0x403ab3||_0x403ab3['voicePause']){logger['info'](_0x67d6('0x27'),_0x44a963,_0x30c237,_0x4e6b1d);return;}logger['info'](_0x67d6('0x28'),_0x44a963,_0x30c237,_0x4e6b1d);var _0x1b7c88=_0xf0f3fb[_0x67d6('0x6')][_0x44a963][_0x67d6('0x29')]&&_0xf0f3fb['channels'][_0x44a963][_0x67d6('0x2a')]?_0xf0f3fb[_0x67d6('0x6')][_0x44a963][_0x67d6('0x2a')]:_0x44a963;return RpcUser[_0x67d6('0x2b')](_0xf0f3fb[_0x67d6('0x25')][_0x30c237],_0x5eea6a,_0x1b7c88)[_0x67d6('0x24')](function(_0x46ddd3){_0xf0f3fb['voiceQueues'][_0x4e6b1d][_0x67d6('0x2c')]-=0x1;_0xf0f3fb['voiceQueues'][_0x4e6b1d]['paused']+=0x1;return _0x46ddd3;});})[_0x67d6('0x24')](function(_0x3bdf32){if(_0x5e8819||!_0x3bdf32){return;}_0xf0f3fb[_0x67d6('0x5')][_0x30c237]={};logger[_0x67d6('0x19')](_0x67d6('0x2d'),_0x44a963,_0xf0f3fb[_0x67d6('0x4')][_0x4e6b1d][_0x67d6('0x2e')],_0x30c237,_0x4e6b1d);_0xf0f3fb['timers'][_0x30c237]['timer']=setTimeout(_0xf0f3fb[_0x67d6('0x2f')]['bind'](_0xf0f3fb,_0x30c237),_0xf0f3fb[_0x67d6('0x4')][_0x4e6b1d][_0x67d6('0x2e')]*0x3e8);_0xf0f3fb[_0x67d6('0x5')][_0x30c237]['lastPauseAt']=moment()[_0x67d6('0x30')](_0x67d6('0x31'));_0xf0f3fb['timers'][_0x30c237][_0x67d6('0x18')]=_0x44a963;_0xf0f3fb[_0x67d6('0x5')][_0x30c237][_0x67d6('0x32')]=_0x4e6b1d;_0xf0f3fb[_0x67d6('0x5')][_0x30c237][_0x67d6('0x14')]=_0xf0f3fb[_0x67d6('0x14')][_0x67d6('0x9')](_0xf0f3fb,_0x30c237,_0x44a963);});}})['catch'](function(){logger['error'](_0x67d6('0x2d'),_0x44a963,_0xf0f3fb['voiceQueues'][_0x4e6b1d][_0x67d6('0x2e')],_0x30c237,_0x4e6b1d);})[_0x67d6('0x1d')](function(){delete _0xf0f3fb[_0x67d6('0x6')][_0x44a963];});}catch(_0x5d7a4b){logger[_0x67d6('0x1b')]('[ACW][START]\x20%s',_0x5d7a4b[_0x67d6('0x33')]);}};Acw[_0x67d6('0x13')][_0x67d6('0x2f')]=function(_0xdc0869){try{var _0x11bed2=this;if(_0x11bed2[_0x67d6('0x5')][_0xdc0869]){_0x11bed2[_0x67d6('0x5')][_0xdc0869][_0x67d6('0x16')]=![];var _0x4fa8da=_0x11bed2['timers'][_0xdc0869][_0x67d6('0x18')];var _0x34a0b7=_0x11bed2[_0x67d6('0x5')][_0xdc0869][_0x67d6('0x32')];var _0x170954=_0x11bed2[_0x67d6('0x4')][_0x34a0b7][_0x67d6('0x2e')];logger['info'](_0x67d6('0x34'),_0x4fa8da,_0xdc0869);RpcUser[_0x67d6('0x26')](this[_0x67d6('0x25')][_0xdc0869]['id'])[_0x67d6('0x24')](function(_0x8ee5d2){if(_0x8ee5d2[_0x67d6('0x35')]===_0x67d6('0x20')){return RpcUser['saveUnpause'](_0x11bed2[_0x67d6('0x25')][_0xdc0869]);}});RpcVoiceAgentReport['update']({'acwtime':_0x170954,'agentacw':!![]},_0x4fa8da,_0xdc0869)[_0x67d6('0x24')](function(_0x2d1615){logger['info'](_0x67d6('0x36'),_0x4fa8da,_0x170954,_0x2d1615);})[_0x67d6('0x1a')](function(_0x11cc14){logger[_0x67d6('0x1b')](_0x67d6('0x1c'),_0x4fa8da,_0x11cc14);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0xdc0869);if(_0x11bed2[_0x67d6('0x5')]){logger[_0x67d6('0x19')](_0x67d6('0x37'),JSON[_0x67d6('0x38')](_0x11bed2['timers']));}}}catch(_0x5b0166){logger[_0x67d6('0x1b')](_0x67d6('0x39'),_0x5b0166[_0x67d6('0x33')]);}};Acw[_0x67d6('0x13')][_0x67d6('0x7')]=function(_0x4bd7fc){try{if(this[_0x67d6('0x4')][_0x4bd7fc[_0x67d6('0x32')]]&&(this[_0x67d6('0x4')][_0x4bd7fc[_0x67d6('0x32')]][_0x67d6('0x2')]||this['voiceQueues'][_0x4bd7fc[_0x67d6('0x32')]]['mandatoryDisposition'])){if(this['agents'][_0x4bd7fc[_0x67d6('0x1f')]]){this[_0x67d6('0x6')][_0x4bd7fc[_0x67d6('0x18')]]={'queue':_0x4bd7fc['queue'],'interface':_0x4bd7fc[_0x67d6('0x1f')],'destlinkedid':_0x4bd7fc[_0x67d6('0x2a')]};}}}catch(_0x4d5d4f){logger[_0x67d6('0x1b')](_0x67d6('0x3a'),_0x4d5d4f['message']);}};Acw[_0x67d6('0x13')][_0x67d6('0xf')]=function(_0x2fa60f){try{if(this[_0x67d6('0x4')][_0x2fa60f[_0x67d6('0x32')]]&&(this[_0x67d6('0x4')][_0x2fa60f['queue']][_0x67d6('0x2')]||this[_0x67d6('0x4')][_0x2fa60f['queue']][_0x67d6('0x3b')])){if(this[_0x67d6('0x25')][_0x2fa60f[_0x67d6('0x1f')]]){this[_0x67d6('0x6')][_0x2fa60f[_0x67d6('0x18')]]={'queue':_0x2fa60f['queue'],'interface':_0x2fa60f[_0x67d6('0x1f')]};}}}catch(_0x336bd0){logger[_0x67d6('0x1b')](_0x67d6('0x3c'),_0x336bd0[_0x67d6('0x33')]);}};Acw[_0x67d6('0x13')][_0x67d6('0x8')]=function(_0x55fe56){try{if(this['channels'][_0x55fe56['uniqueid']]&&_[_0x67d6('0x3d')](this['channels'][_0x55fe56[_0x67d6('0x18')]][_0x67d6('0x29')])){logger[_0x67d6('0x19')]('[%s][HANGUP:UNIQUEID]',_0x55fe56[_0x67d6('0x18')]);this[_0x67d6('0x1e')](_0x55fe56[_0x67d6('0x18')]);}else if(this[_0x67d6('0x6')][_0x55fe56['linkedid']]&&_[_0x67d6('0x3d')](this[_0x67d6('0x6')][_0x55fe56[_0x67d6('0x3e')]]['attended'])){logger[_0x67d6('0x19')](_0x67d6('0x3f'),_0x55fe56['linkedid']);this[_0x67d6('0x1e')](_0x55fe56[_0x67d6('0x3e')]);}}catch(_0x5624db){logger['error'](_0x67d6('0x40'),_0x5624db[_0x67d6('0x33')]);}};Acw[_0x67d6('0x13')][_0x67d6('0x41')]=function(_0x532a98){try{if(this[_0x67d6('0x6')][_0x532a98['uniqueid']]&&this[_0x67d6('0x6')][_0x532a98['uniqueid']][_0x67d6('0x29')]){logger[_0x67d6('0x19')](_0x67d6('0x42'),_0x532a98[_0x67d6('0x18')]);this[_0x67d6('0x1e')](_0x532a98[_0x67d6('0x18')]);}else if(this['channels'][_0x532a98[_0x67d6('0x3e')]]&&this[_0x67d6('0x6')][_0x532a98[_0x67d6('0x3e')]][_0x67d6('0x29')]){logger[_0x67d6('0x19')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x532a98[_0x67d6('0x3e')]);this['startAcw'](_0x532a98[_0x67d6('0x3e')]);}}catch(_0x18154a){logger[_0x67d6('0x1b')](_0x67d6('0x43'),_0x18154a[_0x67d6('0x33')]);}};Acw['prototype'][_0x67d6('0xc')]=function(_0x5d9bc3){try{if(!_['isNil'](this[_0x67d6('0x6')][_0x5d9bc3[_0x67d6('0x44')]])){this[_0x67d6('0x1e')](_0x5d9bc3[_0x67d6('0x44')]);if(this[_0x67d6('0x6')][_0x5d9bc3[_0x67d6('0x45')]]){this[_0x67d6('0x6')][_0x5d9bc3[_0x67d6('0x45')]]['attended']=!![];this[_0x67d6('0x6')][_0x5d9bc3[_0x67d6('0x46')]]=this[_0x67d6('0x6')][_0x5d9bc3[_0x67d6('0x45')]];this[_0x67d6('0x47')](_0x5d9bc3['secondtransfereruniqueid']);}}else if(!_[_0x67d6('0x48')](this[_0x67d6('0x6')][_0x5d9bc3['transfertargetuniqueid']])){this['startAcw'](_0x5d9bc3[_0x67d6('0x46')]);if(this[_0x67d6('0x6')][_0x5d9bc3[_0x67d6('0x49')]]){this[_0x67d6('0x6')][_0x5d9bc3[_0x67d6('0x49')]][_0x67d6('0x29')]=!![];this[_0x67d6('0x6')][_0x5d9bc3[_0x67d6('0x44')]]=this['channels'][_0x5d9bc3['origtransfereruniqueid']];this[_0x67d6('0x47')](_0x5d9bc3[_0x67d6('0x49')]);}}}catch(_0x160b0e){logger[_0x67d6('0x1b')](_0x67d6('0x4a'),_0x160b0e[_0x67d6('0x33')]);}};Acw[_0x67d6('0x13')][_0x67d6('0xe')]=function(_0x31d761){try{if(this['channels'][_0x31d761[_0x67d6('0x4b')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x67d6('0x38')](_0x31d761['transfereruniqueid']));this['startAcw'](_0x31d761[_0x67d6('0x4b')]);}else if(this['channels'][_0x31d761['transfererlinkedid']]){logger[_0x67d6('0x19')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x67d6('0x38')](_0x31d761['transfererlinkedid']));this[_0x67d6('0x1e')](_0x31d761['transfererlinkedid']);}}catch(_0x64586b){logger[_0x67d6('0x1b')](_0x67d6('0x4c'),_0x64586b['message']);}};Acw[_0x67d6('0x13')]['syncAgentRingNoAnswer']=function(_0x3f894d){try{if(this[_0x67d6('0x4')][_0x3f894d[_0x67d6('0x32')]]&&this[_0x67d6('0x4')][_0x3f894d['queue']][_0x67d6('0x4d')]===_0x67d6('0x4e')){if(this[_0x67d6('0x25')][_0x3f894d[_0x67d6('0x1f')]]){logger[_0x67d6('0x19')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x3f894d[_0x67d6('0x18')],_0x3f894d[_0x67d6('0x1f')],_0x3f894d[_0x67d6('0x32')]);return RpcUser[_0x67d6('0x2b')](this['agents'][_0x3f894d[_0x67d6('0x1f')]],_0x67d6('0x4f'),_0x3f894d[_0x67d6('0x18')]);}}}catch(_0x2cb45d){logger[_0x67d6('0x1b')](_0x67d6('0x50'),_0x2cb45d['message']);}};Acw[_0x67d6('0x13')][_0x67d6('0x47')]=function(_0x25328f,_0x2519e0=0x2710){if(this[_0x67d6('0x6')][_0x25328f]){setTimeout(()=>{delete this['channels'][_0x25328f];},_0x2519e0);}};module[_0x67d6('0x51')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 232c3bc..c0a295e 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 _0xdb8f=['username','password','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','port','Action','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','info','resolve','actionSipShowRegistry','then','catch','[ami.js][fullybooted]','asterisk-manager','bluebird','../../config/logger','ami','../../config/environment','asterisk'];(function(_0x3f8720,_0x1c812c){var _0x197a82=function(_0x4966a4){while(--_0x4966a4){_0x3f8720['push'](_0x3f8720['shift']());}};_0x197a82(++_0x1c812c);}(_0xdb8f,0x69));var _0xfdb8=function(_0x30d719,_0x22729b){_0x30d719=_0x30d719-0x0;var _0x21358e=_0xdb8f[_0x30d719];return _0x21358e;};'use strict';var Manager=require(_0xfdb8('0x0'));var BPromise=require(_0xfdb8('0x1'));var util=require('util');var logger=require(_0xfdb8('0x2'))(_0xfdb8('0x3'));var config=require(_0xfdb8('0x4'));var ami=new Manager(config[_0xfdb8('0x5')]['port'],config[_0xfdb8('0x5')]['ip'],config['asterisk'][_0xfdb8('0x6')],config['asterisk'][_0xfdb8('0x7')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xfdb8('0x8')](ami[_0xfdb8('0x9')]);function error(_0x494d55){logger['error'](util[_0xfdb8('0xa')](_0xfdb8('0xb'),config['asterisk']['username'],config[_0xfdb8('0x5')]['ip'],config[_0xfdb8('0x5')]['port'],util[_0xfdb8('0xc')](_0x494d55,![],null)));}function close(){logger[_0xfdb8('0xd')](util[_0xfdb8('0xa')](_0xfdb8('0xe'),config[_0xfdb8('0x5')][_0xfdb8('0x6')],config[_0xfdb8('0x5')]['ip'],config[_0xfdb8('0x5')][_0xfdb8('0xf')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xfdb8('0x10')]({'action':_0xfdb8('0x11')});};};ami[_0xfdb8('0x12')]=function(){return function(){return ami[_0xfdb8('0x10')]({'action':'devicestatelist'});};};ami[_0xfdb8('0x13')]=function(){return function(){return ami[_0xfdb8('0x10')]({'action':_0xfdb8('0x14')});};};ami[_0xfdb8('0x15')]=function(){return function(){return ami[_0xfdb8('0x10')]({'action':'queuesummary'});};};ami[_0xfdb8('0x16')]=function(){return function(){return ami['Action']({'action':_0xfdb8('0x17')});};};function connect(){logger['info'](util['format'](_0xfdb8('0x18'),config['asterisk'][_0xfdb8('0x6')],config[_0xfdb8('0x5')]['ip'],config[_0xfdb8('0x5')][_0xfdb8('0xf')]));ami[_0xfdb8('0x19')]('error',error);ami[_0xfdb8('0x19')](_0xfdb8('0x1a'),close);}ami['on'](_0xfdb8('0x1b'),connect);ami['on'](_0xfdb8('0x1c'),function(_0x3176cf){logger['info'](util[_0xfdb8('0xa')](_0xfdb8('0x1d'),config[_0xfdb8('0x5')][_0xfdb8('0x6')],config[_0xfdb8('0x5')]['ip'],config[_0xfdb8('0x5')]['port'],util[_0xfdb8('0xc')](_0x3176cf,![],null)));});ami['on'](_0xfdb8('0x1e'),function(){logger[_0xfdb8('0x1f')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xfdb8('0x5')][_0xfdb8('0x6')],config[_0xfdb8('0x5')]['ip'],config['asterisk'][_0xfdb8('0xf')]));return Promise[_0xfdb8('0x20')]()['then'](ami[_0xfdb8('0x21')]())[_0xfdb8('0x22')](ami['actionDeviceStateList']())[_0xfdb8('0x22')](ami[_0xfdb8('0x13')]())[_0xfdb8('0x22')](ami[_0xfdb8('0x15')]())[_0xfdb8('0x22')](ami[_0xfdb8('0x16')]())[_0xfdb8('0x23')](function(_0xaa664c){logger['error'](_0xfdb8('0x24'),util[_0xfdb8('0xc')](_0xaa664c,{'showHidden':![],'depth':null}));});});ami['once']('error',error);ami['once'](_0xfdb8('0x1a'),close);module['exports']=ami; \ No newline at end of file +var _0xe80a=['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','catch','inspect','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once'];(function(_0x1e801c,_0x22d0e4){var _0x5a7146=function(_0x346a03){while(--_0x346a03){_0x1e801c['push'](_0x1e801c['shift']());}};_0x5a7146(++_0x22d0e4);}(_0xe80a,0x1c5));var _0xae80=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xe80a[_0x164eca];return _0x2ce562;};'use strict';var Manager=require(_0xae80('0x0'));var BPromise=require(_0xae80('0x1'));var util=require(_0xae80('0x2'));var logger=require(_0xae80('0x3'))(_0xae80('0x4'));var config=require(_0xae80('0x5'));var ami=new Manager(config[_0xae80('0x6')][_0xae80('0x7')],config[_0xae80('0x6')]['ip'],config[_0xae80('0x6')][_0xae80('0x8')],config[_0xae80('0x6')][_0xae80('0x9')],!![]);ami[_0xae80('0xa')]();ami['Action']=BPromise[_0xae80('0xb')](ami[_0xae80('0xc')]);function error(_0x3292a8){logger['error'](util[_0xae80('0xd')](_0xae80('0xe'),config[_0xae80('0x6')]['username'],config[_0xae80('0x6')]['ip'],config[_0xae80('0x6')]['port'],util['inspect'](_0x3292a8,![],null)));}function close(){logger[_0xae80('0xf')](util[_0xae80('0xd')](_0xae80('0x10'),config[_0xae80('0x6')][_0xae80('0x8')],config['asterisk']['ip'],config[_0xae80('0x6')][_0xae80('0x7')]));}ami[_0xae80('0x11')]=function(){return function(){return ami[_0xae80('0x12')]({'action':_0xae80('0x13')});};};ami[_0xae80('0x14')]=function(){return function(){return ami[_0xae80('0x12')]({'action':'devicestatelist'});};};ami[_0xae80('0x15')]=function(){return function(){return ami[_0xae80('0x12')]({'action':_0xae80('0x16')});};};ami[_0xae80('0x17')]=function(){return function(){return ami['Action']({'action':_0xae80('0x18')});};};ami[_0xae80('0x19')]=function(){return function(){return ami[_0xae80('0x12')]({'action':'coreshowchannels'});};};function connect(){logger['info'](util[_0xae80('0xd')](_0xae80('0x1a'),config['asterisk']['username'],config[_0xae80('0x6')]['ip'],config['asterisk'][_0xae80('0x7')]));ami[_0xae80('0x1b')](_0xae80('0xf'),error);ami[_0xae80('0x1b')](_0xae80('0x1c'),close);}ami['on'](_0xae80('0x1d'),connect);ami['on']('shutdown',function(_0x58f086){logger[_0xae80('0x1e')](util['format'](_0xae80('0x1f'),config[_0xae80('0x6')][_0xae80('0x8')],config[_0xae80('0x6')]['ip'],config[_0xae80('0x6')][_0xae80('0x7')],util['inspect'](_0x58f086,![],null)));});ami['on'](_0xae80('0x20'),function(){logger[_0xae80('0x1e')](util[_0xae80('0xd')](_0xae80('0x21'),config[_0xae80('0x6')][_0xae80('0x8')],config['asterisk']['ip'],config[_0xae80('0x6')][_0xae80('0x7')]));return Promise['resolve']()['then'](ami[_0xae80('0x11')]())[_0xae80('0x22')](ami[_0xae80('0x14')]())['then'](ami[_0xae80('0x15')]())[_0xae80('0x22')](ami[_0xae80('0x17')]())[_0xae80('0x22')](ami[_0xae80('0x19')]())[_0xae80('0x23')](function(_0x5ba2c){logger[_0xae80('0xf')]('[ami.js][fullybooted]',util[_0xae80('0x24')](_0x5ba2c,{'showHidden':![],'depth':null}));});});ami['once']('error',error);ami[_0xae80('0x1b')](_0xae80('0x1c'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 90e4ecb..4f7597e 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 _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xda3f,0xec));var _0xfda3=function(_0x1ac55d,_0x3ffc33){_0x1ac55d=_0x1ac55d-0x0;var _0x113121=_0xda3f[_0x1ac55d];return _0x113121;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0xfda3('0x2')]=function(_0x581693,_0x36dc71){return new BPromise(function(_0x22187d,_0x516500){return client[_0xfda3('0x3')](_0x581693,_0x36dc71)[_0xfda3('0x4')](function(_0x47e7e2){logger['debug'](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x36dc71,_0x47e7e2);if(_0x47e7e2[_0xfda3('0x7')]){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')],_0x36dc71);return _0x516500(_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')]);}else{return _0x22187d(_0x47e7e2[_0xfda3('0x9')]);}})[_0xfda3('0xa')](function(_0x4d7841){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x4d7841,_0x36dc71);return _0x516500(_0x4d7841);});});};module[_0xfda3('0xb')]=client; \ No newline at end of file +var _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x70e0,0x17b));var _0x070e=function(_0x5de397,_0x4dedad){_0x5de397=_0x5de397-0x0;var _0x28407a=_0x70e0[_0x5de397];return _0x28407a;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index cff87c8..a017c8b 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 _0x9003=['getSeconds','debug','startPredictive','handlePredictive','error','stack','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','contacts','NO_AVAILABLE_CONTACTS','state','statedesc','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','pick','NULL_INTERVAL','Interval','Intervals','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20deactivated','Error','stringify','format','SIP/%s','status','unmonitored','checkIsTrunkReachable','isTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','isEmpty','EMPTY_INTERVAL','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','catch','all','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Failure','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','dialTimezone','[syncCampaigns]','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','dialGlobalInterval','silly','Voice\x20Queue\x20%s\x20$s','OVERTIME_INTERVAL','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','syncAgentConnect','queue','ivr','[syncAgentConnect]','uniqueid','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','[syncAgentComplete]','decrementOriginate','[syncQueueCallerAbandon]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','agiafterat','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','dialDropMaxRetry','queueCallerAbandonCreateState','additional','rescheduleContact','minutes','ContactId','ListId','CampaignId','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','dialAbandonedMaxRetry','add','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','strategy','rrmemory','roundrobin','locked','paused','stateinterface','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','[syncQueueStatusComplete]','VoiceQueueId','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','isNil','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','response','[syncOriginateResponse]','callProgressDetecting','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','membername','custom:amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','[syncVarSet]','outboundAnswerAgiCallsDay','Machine','AMD','countmachineretry','amd','countbusyretry','countnoanswerretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','buildObj','saveInDb','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countcongestionretry','countnosuchnumberretry','countdropretry','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','[syncAgentCompleteIvr]','moveContactManagedDialer','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','[syncHangup2]','outboundUnknownCallsDay','Unknown','[syncHangup][createHistory]','[syncHangup]','running','statusMessage','getQueueCampaignStatusMessage','resolve','available','inUse','pTalking','ACTIVE','checkDialMethod','compareToOutboundQueue','queueSummaryCountersUpdated','assign','[syncQueueSummary]','throttle','filter','reachable','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[clearZombieChannels]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[emptyContact]','UserId','[emptyContact][createHistory]','launchHandleIvr','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdName','dialOriginateCallerIdNumber','TrunkBackup','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','dialNoAnswerRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','checkRetriveMax','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','dialBusyRetryFrequency','dialBusyMaxRetry','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','Success','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','talking','erlangCalls','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','getDataPredictive','predictiveIntervalHitRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','abandonmentRate','[CatchErlangB]','busyFactor','floor','one\x20call\x20every:','milliseconds','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','dialRecallInQueue','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]','[handleIvr]','[getContactCampaign2]','dialLimitQueue','getContactDialer','checkContactEmpty','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[actionOriginate]','[handlePower]','[handlePredictive][limitChannel]','tryOriginatePredictive','not_inuse','checkContactLowerLimitOriginate','[actionOriginatePredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/voiceQueueRt','../rpc/interval','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','queueBooked','queuesSummary','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','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','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge'];(function(_0xb3f165,_0x1a9fb5){var _0x4eff46=function(_0x12c120){while(--_0x12c120){_0xb3f165['push'](_0xb3f165['shift']());}};_0x4eff46(++_0x1a9fb5);}(_0x9003,0x1c7));var _0x3900=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x9003[_0x2b4411];return _0x8e41ef;};'use strict';var util=require(_0x3900('0x0'));var _=require('lodash');var uuid=require(_0x3900('0x1'));var moment=require(_0x3900('0x2'));var rr=require('rr');var Redis=require(_0x3900('0x3'));var utils=require(_0x3900('0x4'));var hopperUtils=require(_0x3900('0x5'));var ut=require(_0x3900('0x6'));var config=require(_0x3900('0x7'));var logger=require(_0x3900('0x8'))(_0x3900('0x9'));var loggerBooked=require(_0x3900('0x8'))(_0x3900('0xa'));var loggerPredictive=require(_0x3900('0x8'))(_0x3900('0xb'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0x3900('0x8'))(_0x3900('0xc'));var ami=require(_0x3900('0xd'));config[_0x3900('0xe')]=_[_0x3900('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3900('0x10'))(new Redis(config[_0x3900('0xe')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x3900('0x11'));var RpcSetting=require('../rpc/setting');var Interval=require(_0x3900('0x12'));var Action=require('./models/action');var History=require(_0x3900('0x13'));var Final=require(_0x3900('0x14'));var AgentComplete=require(_0x3900('0x15'));var QueueCallerAbandon=require(_0x3900('0x16'));var Hangup=require(_0x3900('0x17'));var ipAgi=process[_0x3900('0x18')]['XCALLY_IP_AGI']||_0x3900('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x3900('0x1a')][_0x3900('0x1b')]=function(_0x300c65){this[_0x3900('0x1c')]=this[_0x3900('0x1c')]?this[_0x3900('0x1c')][_0x3900('0x1d')](_0x300c65):_0x300c65();};function Dialer(_0x5605c8,_0x931432){this[_0x3900('0x1e')]=new Sequence();this[_0x3900('0x1f')]=_0x931432;this[_0x3900('0x20')]=_0x5605c8[_0x3900('0x20')];this[_0x3900('0x21')]=_0x5605c8[_0x3900('0x21')];this[_0x3900('0x22')]=_0x5605c8[_0x3900('0x22')];this[_0x3900('0x23')]=_0x5605c8[_0x3900('0x23')];this[_0x3900('0x24')]=config[_0x3900('0x24')]||0x2;this[_0x3900('0x25')]={};this[_0x3900('0x26')]={};this[_0x3900('0x27')]={};this[_0x3900('0x28')]={};this[_0x3900('0x29')]={};this['startPredictive']={};this[_0x3900('0x2a')]={};this['ivrOriginated']={};this[_0x3900('0x2b')]={};this['queueBookedRR']={};this[_0x3900('0x2c')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0x3900('0x2d')](this));ami['on'](_0x3900('0x2e'),this[_0x3900('0x2f')][_0x3900('0x2d')](this));ami['on'](_0x3900('0x30'),this[_0x3900('0x31')]['bind'](this));ami['on'](_0x3900('0x32'),this[_0x3900('0x33')][_0x3900('0x2d')](this));ami['on'](_0x3900('0x34'),this[_0x3900('0xc')]['bind'](this));ami['on'](_0x3900('0x35'),this[_0x3900('0x36')][_0x3900('0x2d')](this));ami['on'](_0x3900('0x37'),this[_0x3900('0x38')]['bind'](this));ami['on']('newexten',this['syncNewExten'][_0x3900('0x2d')](this));ami['on'](_0x3900('0x39'),this[_0x3900('0x3a')]['bind'](this));ami['on'](_0x3900('0x3b'),this[_0x3900('0x3c')][_0x3900('0x2d')](this));ami['on']('queuestatuscomplete',this[_0x3900('0x3d')][_0x3900('0x2d')](this));this[_0x3900('0x3e')]();this[_0x3900('0x3f')]();RpcSetting[_0x3900('0x40')]()[_0x3900('0x41')](function(_0x19ebe4){previewRecallmeReminderInterval=_0x19ebe4[_0x3900('0x42')];});}function isNotNull(_0x3c41e0){return _0x3c41e0!==null&&!_[_0x3900('0x43')](_0x3c41e0);}function msgResponse(_0x39f0c5,_0x5c78e7,_0x372be6){return{'action':_0x39f0c5,'response':_0x5c78e7,'message':_0x372be6,'stack':_0x372be6};}function emit(_0x4456dd,_0x2fe9ef,_0x2e53b9){io['to'](_0x4456dd)[_0x3900('0x44')](_0x2fe9ef,_0x2e53b9);}function emitOutboundVoiceQueueSummary(_0x23808f){if(_0x23808f[_0x3900('0x45')]==='outbound'){logger['debug'](_0x3900('0x46'),util[_0x3900('0x47')](_0x23808f,{'showHidden':![],'depth':null}));emit(util['format'](_0x3900('0x48'),_0x23808f[_0x3900('0x49')]),_0x3900('0x4a'),_0x23808f);}}function checkGetDataPredictive(_0x4ce710){if(isNotNull(_0x4ce710)&&!_['isEmpty'](_0x4ce710)){loggerPredictive[_0x3900('0x4b')](_0x3900('0x4c'));loggerPredictive[_0x3900('0x4b')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4ce710[_0x3900('0x4d')]);loggerPredictive[_0x3900('0x4b')](_0x3900('0x4e'),_0x4ce710[_0x3900('0x4f')]);loggerPredictive[_0x3900('0x4b')](_0x3900('0x50'),_0x4ce710[_0x3900('0x51')]);loggerPredictive[_0x3900('0x4b')](_0x3900('0x52'),_0x4ce710['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x3900('0x4b')](_0x3900('0x53'),_0x4ce710[_0x3900('0x54')]);loggerPredictive['info'](_0x3900('0x55'),_0x4ce710[_0x3900('0x56')]);loggerPredictive[_0x3900('0x4b')](_0x3900('0x57'));if(_0x4ce710[_0x3900('0x4d')]>0x0){if(!_[_0x3900('0x43')](_0x4ce710[_0x3900('0x56')])&&_0x4ce710['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x3900('0x4b')](_0x3900('0x58'));if(!_[_0x3900('0x43')](_0x4ce710[_0x3900('0x54')])&&_0x4ce710[_0x3900('0x54')]>0x0){return!![];}loggerPredictive['info'](_0x3900('0x59'));}else{loggerPredictive[_0x3900('0x4b')](_0x3900('0x5a'));}}else{loggerPredictive[_0x3900('0x4b')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5ec082){return function(_0x50e40e){loggerPredictive[_0x3900('0x4b')](_0x3900('0x5b'));loggerPredictive['info'](_0x3900('0x5c'),_0x50e40e['erlangCalls']);loggerPredictive[_0x3900('0x4b')](_0x3900('0x5d'),_0x50e40e[_0x3900('0x5e')]);loggerPredictive['info'](_0x3900('0x5f'),_0x50e40e[_0x3900('0x60')]);loggerPredictive[_0x3900('0x4b')](_0x3900('0x61'),_0x50e40e['erlangBusyFactor']);loggerPredictive['info'](_0x3900('0x5f'),_0x50e40e[_0x3900('0x60')]);loggerPredictive[_0x3900('0x4b')](_0x3900('0x57'));_[_0x3900('0x62')](_0x5ec082,_0x50e40e);};}function ifInterval(_0x4596ad,_0x443681){if(_[_0x3900('0x43')](_0x443681)){return![];}return utils[_0x3900('0x63')](undefined,_0x443681)<_0x4596ad*0x3c;}function clearPredictiveAttributes(_0x34d491){if(_0x34d491[_0x3900('0x2a')]){_0x34d491[_0x3900('0x2a')]=undefined;loggerPredictive[_0x3900('0x64')](_0x34d491[_0x3900('0x49')],'startProgressive\x20value\x20cleared');}if(_0x34d491[_0x3900('0x65')]){_0x34d491[_0x3900('0x65')]=undefined;loggerPredictive[_0x3900('0x64')](_0x34d491['name'],'startPredictive\x20value\x20cleared');}if(_0x34d491[_0x3900('0x66')]){clearInterval(_0x34d491[_0x3900('0x66')]);_0x34d491[_0x3900('0x66')]=undefined;loggerPredictive[_0x3900('0x64')](_0x34d491[_0x3900('0x49')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x9e6112,_0x12c635){return function(_0x1f6899){loggerPredictive['error'](_0x12c635[_0x3900('0x49')],_0x9e6112);loggerPredictive[_0x3900('0x67')](_0x1f6899[_0x3900('0x68')]);clearPredictiveAttributes(_0x12c635);};}function loggerCatch(_0x39a222){return function(_0x1aa408){logger[_0x3900('0x67')](_0x39a222,util['inspect'](_0x1aa408,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3571ad){return function(_0x91e1cd){if(isNotNull(_0x91e1cd)&&isNotNull(_0x91e1cd[0x0])){if(_0x91e1cd[0x0][_0x3900('0x69')]>0x0){_0x3571ad[_0x3900('0x6a')]=utils[_0x3900('0x6b')][_0x3900('0x6c')];logger[_0x3900('0x4b')]('[getContactDialer2][ReScheduled]'+_0x3571ad[_0x3900('0x49')],_0x91e1cd[0x0]['contactsRescheduled'],_0x3900('0x6d'));}else{_0x3571ad['message']=utils[_0x3900('0x6b')][_0x3900('0x6e')];logger[_0x3900('0x4b')]('[getContactDialer2][Empty]'+_0x3571ad[_0x3900('0x49')]);}}};}function createObjHistory(_0x4e64c4,_0x431c74,_0xe3bf31,_0x2622e8,_0x20d14d){_0x4e64c4[_0x3900('0x6a')]=_0xe3bf31;var _0x38265e=new Action(_0x4e64c4,_0x431c74);var _0x90c157=new History(_0x38265e);_0x90c157[_0x3900('0x6f')]=_0x2622e8;_0x90c157[_0x3900('0x70')]=_0x20d14d;_0x90c157[_0x3900('0x71')]=_0x38265e[_0x3900('0x72')];return _0x90c157;}function unlockQueueStatus(_0x5285a9,_0x1dd347){setTimeout(function(){if(_[_0x3900('0x43')](_0x5285a9[_0x3900('0x73')])){loggerBooked[_0x3900('0x67')]('[unlockQueueStatus][undefined]',_0x1dd347);}_0x5285a9[_0x3900('0x73')]=!![];loggerBooked[_0x3900('0x4b')](_0x3900('0x74'),_0x1dd347,JSON['stringify'](_[_0x3900('0x75')](_0x5285a9,['name',_0x3900('0x73')])));},0x1f3);}function checkInterval(_0x25f375){return function(){if(!isNotNull(_0x25f375['Interval'])){_0x25f375[_0x3900('0x6a')]=utils[_0x3900('0x6b')][_0x3900('0x76')];throw _0x25f375['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x25f375[_0x3900('0x77')][_0x3900('0x78')])){_0x25f375['message']=utils[_0x3900('0x6b')][_0x3900('0x76')];throw _0x25f375[_0x3900('0x49')]+_0x3900('0x79');}if(!isNotNull(_['isEmpty'](_0x25f375['Interval'][_0x3900('0x78')]))){_0x25f375['message']=utils[_0x3900('0x6b')][_0x3900('0x76')];throw _0x25f375[_0x3900('0x49')]+_0x3900('0x79');}};}function checkIsIVRCampaignActive(_0x34e013){return function(){if(!utils[_0x3900('0x7a')](_0x34e013)){_0x34e013[_0x3900('0x6a')]=utils[_0x3900('0x6b')][_0x3900('0x7b')];throw _0x34e013[_0x3900('0x49')]+_0x3900('0x7c');}};}function emitCampaignSummary(_0x3f0adf){if(utils[_0x3900('0x7d')](_0x3f0adf)){emit(util['format'](_0x3900('0x7e'),_0x3f0adf[_0x3900('0x49')]),_0x3900('0x7f'),_0x3f0adf);}}function loggerCatchQueueSummary(_0x2c573f,_0x10f2af){return function(_0x37ee19){clearPredictiveAttributes(_0x10f2af);emitCampaignSummary(_0x10f2af);loggerSyncQueueSummary[_0x3900('0x64')](_0x2c573f,util['inspect'](_0x37ee19,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0xaf78b6){if(_0xaf78b6[_0x3900('0x80')]){if(_0xaf78b6[_0x3900('0x81')]===0x0){_0xaf78b6[_0x3900('0x80')]=![];_0xaf78b6[_0x3900('0x6a')]=utils[_0x3900('0x6b')][_0x3900('0x7b')];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0xaf78b6['name'],_0x3900('0x82'));}else{_0xaf78b6[_0x3900('0x6a')]=utils[_0x3900('0x6b')][_0x3900('0x83')];loggerSyncQueueSummary[_0x3900('0x64')](_0x3900('0x84'),_0xaf78b6[_0x3900('0x49')],_0x3900('0x85'));}emitCampaignSummary(_0xaf78b6);}}function myreject(_0x39d557){return function(_0x40187d){return _0x39d557(msgResponse('[ifTime][Action]',_0x3900('0x86'),JSON[_0x3900('0x87')](_0x40187d)));};}Dialer[_0x3900('0x1a')]['isTrunkReachable']=function(_0x3685d5){return!_[_0x3900('0x43')](_0x3685d5)&&_0x3685d5&&!_[_0x3900('0x43')](_0x3685d5[_0x3900('0x49')])&&!_[_0x3900('0x43')](_0x3685d5['active'])&&_0x3685d5['active']&&(this[_0x3900('0x23')][util[_0x3900('0x88')](_0x3900('0x89'),_0x3685d5[_0x3900('0x49')])][_0x3900('0x8a')]==='reachable'||this['trunks'][util[_0x3900('0x88')](_0x3900('0x89'),_0x3685d5['name'])][_0x3900('0x8a')]===_0x3900('0x8b'));};Dialer[_0x3900('0x1a')][_0x3900('0x8c')]=function(_0x3ad702){var _0x4db0b4=this;return function(){if(!_0x4db0b4[_0x3900('0x8d')](_0x3ad702[_0x3900('0x8e')])){if(!_0x4db0b4[_0x3900('0x8d')](_0x3ad702['TrunkBackup'])){_0x3ad702['message']=utils[_0x3900('0x6b')][_0x3900('0x8f')];throw _0x3ad702[_0x3900('0x49')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0x3900('0x1a')][_0x3900('0x90')]=function(_0x48f0de,_0x2176e9,_0x1de34b,_0x59fe4c){var _0x589e20=this;return function(){var _0x4a9025=!![];return _0x589e20[_0x3900('0x91')](_0x48f0de,_0x2176e9,_0x1de34b,_0x59fe4c,_0x4a9025);};};Dialer[_0x3900('0x1a')][_0x3900('0x92')]=function(_0x12fa55,_0x57e53f,_0x26a195,_0xa1c013){var _0x2c4a3e=this;return function(){var _0xa36e79=![];return _0x2c4a3e[_0x3900('0x91')](_0x12fa55['Intervals'],_0x57e53f,_0x26a195,_0xa1c013,_0xa36e79);};};Dialer[_0x3900('0x1a')]['ifTimeIvr']=function(_0x533897,_0x14531f,_0x24a757,_0x46e288,_0x1746f9){var _0x255325=[];return new Promise(function(_0x10d79f,_0x126587){if(!isNotNull(_0x533897)){_0x46e288[_0x3900('0x6a')]=utils['CAMPAIGN_STATUS'][_0x3900('0x76')];return _0x126587(msgResponse(_0x3900('0x93'),'Failure',_0x24a757+_0x3900('0x94')));}if(_[_0x3900('0x95')](_0x533897)){_0x46e288[_0x3900('0x6a')]=utils[_0x3900('0x6b')][_0x3900('0x96')];return _0x126587(msgResponse(_0x3900('0x93'),'Failure',_0x24a757+'\x20Intervals\x20is\x20empty\x20'));}if(_0x14531f&&_[_0x3900('0x43')](config[_0x3900('0x97')][_0x14531f])){_0x46e288[_0x3900('0x6a')]=utils['CAMPAIGN_STATUS'][_0x3900('0x98')];return _0x126587(msgResponse(_0x3900('0x93'),'Failure',_0x24a757+_0x3900('0x99')+_0x14531f));}if(_[_0x3900('0x9a')](_0x533897)){for(var _0x4087ac=0x0;_0x4087ac<_0x533897[_0x3900('0x9b')];_0x4087ac+=0x1){_0x255325[_0x3900('0x9c')](ami[_0x3900('0x9d')]({'action':_0x3900('0x9e'),'command':util['format'](_0x3900('0x9f'),_0x533897[_0x4087ac][_0x3900('0xa0')],!_['isUndefined'](config[_0x3900('0x97')][_0x14531f])?_0x14531f:'')})[_0x3900('0x41')](function(_0x537d3a){return _0x537d3a[_0x3900('0xa1')][_0x3900('0xa2')](_0x3900('0xa3'))>=0x0;})[_0x3900('0xa4')](myreject(_0x126587)));}}else{_0x255325['push'](ami[_0x3900('0x9d')]({'action':_0x3900('0x9e'),'command':util[_0x3900('0x88')]('iftime\x20%s,%s',_0x533897,!_[_0x3900('0x43')](config[_0x3900('0x97')][_0x14531f])?_0x14531f:'')})['then'](function(_0x2c9cd9){return _0x2c9cd9[_0x3900('0xa1')]['indexOf'](_0x3900('0xa3'))>=0x0;})[_0x3900('0xa4')](myreject(_0x126587)));}Promise[_0x3900('0xa5')](_0x255325)[_0x3900('0x41')](function(_0x33256f){var _0x34fb5c=_['some'](_0x33256f);if(_0x34fb5c){return _0x10d79f(_0x34fb5c);}else{_0x46e288['message']=_0x1746f9?utils[_0x3900('0x6b')][_0x3900('0xa6')]:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];return _0x126587(msgResponse(_0x3900('0xa7'),_0x3900('0xa8'),_0x3900('0xa9')+_0x1746f9+'\x20'+_0x24a757+_0x3900('0xaa')+util[_0x3900('0x47')](_0x533897,{'showHidden':![],'depth':null})+_0x3900('0xab')+_0x14531f));}})[_0x3900('0xa4')](function(_0x19e111){return _0x126587(msgResponse('ifTime',_0x3900('0xa8'),JSON[_0x3900('0x87')](_0x19e111)));});});};Dialer[_0x3900('0x1a')][_0x3900('0x3e')]=function(){var _0x244d20=this;return cmHopper[_0x3900('0xac')]({'active':![]},{'where':{'active':!![]}})[_0x3900('0x41')](function(){setInterval(function(){_0x244d20[_0x3900('0xad')]();},0x3e8);});};Dialer[_0x3900('0x1a')]['syncCampaigns']=function(){var _0x841ff6=this;var _0x2831f1;for(var _0x41b717 in this[_0x3900('0x21')]){if(typeof this['campaigns'][_0x41b717]!==_0x3900('0xae')){_0x2831f1=this[_0x3900('0x21')][_0x41b717];if(utils['isIVRCampaign'](_0x2831f1)&&utils['isIVRCampaignActive'](_0x2831f1)){_0x2831f1[_0x3900('0x80')]=!![];Promise['resolve']()[_0x3900('0x41')](checkIsIVRCampaignActive(_0x2831f1))[_0x3900('0x41')](checkInterval(_0x2831f1))['then'](_0x841ff6[_0x3900('0x8c')](_0x2831f1))['then'](_0x841ff6[_0x3900('0x90')](_0x2831f1['dialGlobalInterval'],_0x2831f1[_0x3900('0xaf')],_0x2831f1[_0x3900('0x49')],_0x2831f1))['then'](_0x841ff6['checkIfTimeIntervals'](_0x2831f1['Interval'],_0x2831f1[_0x3900('0xaf')],_0x2831f1[_0x3900('0x49')],_0x2831f1))[_0x3900('0x41')](_0x841ff6['launchHandleIvr'](_0x2831f1))['catch'](loggerCatchQueueSummary(_0x3900('0xb0'),_0x2831f1));}else{notSendMessagesCampaign(_0x2831f1);}}}};Dialer[_0x3900('0x1a')]['checkDialMethod']=function(_0x4ce203){if(_0x4ce203[_0x3900('0xb1')]!==_0x3900('0xb')){clearPredictiveAttributes(_0x4ce203);}switch(_0x4ce203[_0x3900('0xb1')]){case _0x3900('0xb2'):this[_0x3900('0xb3')](_0x4ce203,0x1);break;case _0x3900('0xb4'):this[_0x3900('0xb3')](_0x4ce203,_0x4ce203[_0x3900('0xb5')]);break;case'predictive':this[_0x3900('0xb')](_0x4ce203);break;case'booked':this[_0x3900('0xb3')](_0x4ce203,0x1);break;default:logger[_0x3900('0x67')](_0x3900('0xb6'),_0x4ce203[_0x3900('0x49')],_0x3900('0xb7'));}};Dialer[_0x3900('0x1a')][_0x3900('0x93')]=function(_0x3135ac,_0x317624){var _0x120578=_0x3135ac[_0x3900('0xaf')];var _0x28c103=_0x317624?_0x3135ac[_0x3900('0xb8')]:_0x3135ac[_0x3900('0x77')][_0x3900('0x78')];logger[_0x3900('0xb9')]('Dialer::ifTime()',_0x28c103,_0x120578,_0x3135ac[_0x3900('0x49')],util[_0x3900('0x88')](_0x3900('0xba'),_0x3135ac['name'],_0x3135ac['id']));var _0xb2393a=null;return Interval['intervalIftime'](_0x28c103,_0x120578)['then'](function(_0x32feb1){if(_0x32feb1===!![]){return _0x32feb1;}else{_0x3135ac['message']=_0x317624?utils[_0x3900('0x6b')][_0x3900('0xa6')]:utils[_0x3900('0x6b')][_0x3900('0xbb')];_0xb2393a=msgResponse(_0x3900('0xa7'),_0x3900('0xa8'),_0x3900('0xa9')+_0x317624+'\x20'+_0x3135ac[_0x3900('0x49')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x3900('0x47')](_0x28c103,{'showHidden':![],'depth':null})+_0x3900('0xab')+_0x120578);}if(_0xb2393a!==null){logger[_0x3900('0xb9')](_0x3900('0xbc'),_0xb2393a);_0xb2393a[_0x3900('0xbd')]=_0x317624;throw _0xb2393a;}})['catch'](function(_0x339083){logger['error'](_0x3900('0xbe'),_0x339083);throw msgResponse(_0x3900('0xbf'),_0x3900('0x86'),util[_0x3900('0x47')](_0x339083,{'showHidden':![],'depth':null}));});};Dialer[_0x3900('0x1a')][_0x3900('0xc0')]=function(_0x234a74){if(this[_0x3900('0x20')][_0x234a74[_0x3900('0xc1')]]){if(this[_0x3900('0x28')][_0x234a74['uniqueid']]&&this['uniqueId'][_0x234a74['uniqueid']]['type']!==_0x3900('0xc2')){utils['decrementOriginate'](this['voiceQueues'][_0x234a74[_0x3900('0xc1')]],_0x3900('0xc3'));this[_0x3900('0x28')][_0x234a74[_0x3900('0xc4')]]['answertime']=moment()[_0x3900('0x88')](_0x3900('0xc5'));}}};Dialer[_0x3900('0x1a')][_0x3900('0x33')]=function(_0x5c1e6e){var _0x10df76=this['uniqueId'][_0x5c1e6e[_0x3900('0xc4')]];if(this['voiceQueues'][_0x5c1e6e['queue']]){if(_0x10df76&&_0x10df76[_0x3900('0x45')]!=='ivr'){delete this[_0x3900('0x28')][_0x5c1e6e[_0x3900('0xc4')]];this[_0x3900('0x20')][_0x5c1e6e[_0x3900('0xc1')]][_0x3900('0xc6')]+=0x1;var _0x41449f=new AgentComplete(_0x10df76,_0x5c1e6e);if(_0x5c1e6e[_0x3900('0xc7')]===_0x3900('0xc8')){_0x41449f['agiafterat']=this[_0x3900('0x20')][_0x5c1e6e[_0x3900('0xc1')]][_0x3900('0xc9')]&&this[_0x3900('0x20')][_0x5c1e6e['queue']][_0x3900('0xca')]?moment()['format'](_0x3900('0xc5')):undefined;}hopperUtils[_0x3900('0xcb')](_0x41449f)['catch'](loggerCatch(_0x3900('0xcc')));hopperUtils['moveContactManagedDialer'](_0x41449f)[_0x3900('0xa4')](loggerCatch(_0x3900('0xcd')));}}};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x49606d){var _0x1e2e8c=this[_0x3900('0x28')][_0x49606d[_0x3900('0xc4')]];var _0x35fd63=this;var _0x26ea83=![];var _0x25cf6b;var _0x985fd9;if(this[_0x3900('0x20')][_0x49606d['queue']]){if(_0x1e2e8c&&_0x1e2e8c[_0x3900('0x45')]!==_0x3900('0xc2')){delete this[_0x3900('0x28')][_0x49606d[_0x3900('0xc4')]];utils[_0x3900('0xce')](this[_0x3900('0x20')][_0x49606d[_0x3900('0xc1')]],_0x3900('0xcf'));_0x1e2e8c['droptime']=moment()[_0x3900('0x88')](_0x3900('0xc5'));var _0x182ca0=new QueueCallerAbandon(_0x1e2e8c,_0x49606d);if(utils['getSeconds'](_0x1e2e8c[_0x3900('0xd0')],_0x1e2e8c[_0x3900('0xd1')])>=_0x1e2e8c[_0x3900('0xd2')]){this[_0x3900('0x20')][_0x49606d[_0x3900('0xc1')]][_0x3900('0x51')]+=0x1;this[_0x3900('0x20')][_0x49606d['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0x3900('0x20')][_0x49606d[_0x3900('0xc1')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x182ca0[_0x3900('0x6f')]=0xa;_0x182ca0['statedesc']=_0x3900('0xd3');_0x182ca0[_0x3900('0xd4')]=_0x3900('0xd5');_0x182ca0[_0x3900('0xd6')]=this[_0x3900('0x20')][_0x49606d[_0x3900('0xc1')]]['dialQueueProject2']?moment()[_0x3900('0x88')](_0x3900('0xc5')):undefined;_0x182ca0['countdropretry']+=0x1;_0x182ca0[_0x3900('0xd7')]+=0x1;_0x25cf6b=this[_0x3900('0x20')][_0x49606d[_0x3900('0xc1')]][_0x3900('0xd8')];_0x985fd9=this[_0x3900('0x20')][_0x49606d['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0x3900('0xd9')](_0x182ca0,_0x182ca0['state'],_0x1e2e8c['voiceQueue'])[_0x3900('0x41')](function(_0x10ce6e){_0x26ea83=_0x10ce6e['additional']==0x1;if(_0x182ca0['countdropretry']>=_0x35fd63[_0x3900('0x20')][_0x49606d['queue']][_0x3900('0xda')]){_0x35fd63[_0x3900('0xdb')](_0x182ca0,_0x10ce6e[_0x3900('0xdc')]);}else{hopperUtils[_0x3900('0xdd')]({'active':![],'countdropretry':_0x182ca0['countdropretry'],'scheduledat':moment()['add'](_0x35fd63[_0x3900('0x20')][_0x49606d[_0x3900('0xc1')]][_0x3900('0xd8')],_0x3900('0xde'))[_0x3900('0x88')](_0x3900('0xc5')),'ContactId':_0x1e2e8c[_0x3900('0xdf')],'ListId':_0x1e2e8c[_0x3900('0xe0')],'VoiceQueueId':_0x1e2e8c['VoiceQueueId']||undefined,'CampaignId':_0x1e2e8c[_0x3900('0xe1')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x3451a6=new History(_0x182ca0);_0x3451a6[_0x3900('0x6f')]=0xa;_0x3451a6[_0x3900('0x70')]=_0x3900('0xd3');_0x3451a6[_0x3900('0x72')]=moment()[_0x3900('0x88')](_0x3900('0xc5'));_0x3451a6[_0x3900('0x71')]=_0x3451a6['starttime'];_0x3451a6[_0x3900('0xe2')]=_0x182ca0[_0x3900('0xe2')];_0x3451a6['calleridnum']=_0x182ca0[_0x3900('0xe3')];hopperUtils[_0x3900('0xcb')](_0x3451a6)[_0x3900('0xa4')](loggerCatch(_0x3900('0xe4')));}})['then'](function(){if(_0x26ea83)hopperUtils[_0x3900('0xe5')](_0x182ca0,_0x25cf6b,_0x985fd9)[_0x3900('0x41')](function(){return 0x1;});});}else{this[_0x3900('0x20')][_0x49606d[_0x3900('0xc1')]][_0x3900('0xe6')]+=0x1;this[_0x3900('0x20')][_0x49606d[_0x3900('0xc1')]][_0x3900('0xe7')]+=0x1;_0x182ca0['state']=0xb;_0x182ca0[_0x3900('0x70')]=_0x3900('0xe8');_0x182ca0['dropreason']=_0x3900('0xe9');_0x182ca0[_0x3900('0xea')]+=0x1;_0x182ca0['countglobal']+=0x1;_0x25cf6b=this['voiceQueues'][_0x49606d['queue']][_0x3900('0xeb')];_0x985fd9=this['voiceQueues'][_0x49606d[_0x3900('0xc1')]][_0x3900('0xec')];hopperUtils[_0x3900('0xd9')](_0x182ca0,_0x182ca0[_0x3900('0x6f')],_0x1e2e8c[_0x3900('0xed')])[_0x3900('0x41')](function(_0x162c89){if(_0x182ca0[_0x3900('0xea')]>=_0x35fd63['voiceQueues'][_0x49606d[_0x3900('0xc1')]][_0x3900('0xee')]){_0x35fd63['queueCallerAbandonCreateState'](_0x182ca0,_0x162c89[_0x3900('0xdc')]);}else{hopperUtils[_0x3900('0xdd')]({'active':![],'countabandonedretry':_0x182ca0[_0x3900('0xea')],'scheduledat':moment()[_0x3900('0xef')](_0x35fd63[_0x3900('0x20')][_0x49606d['queue']][_0x3900('0xeb')],_0x3900('0xde'))[_0x3900('0x88')](_0x3900('0xc5')),'ContactId':_0x1e2e8c[_0x3900('0xdf')],'ListId':_0x1e2e8c[_0x3900('0xe0')],'VoiceQueueId':_0x1e2e8c['VoiceQueueId']||undefined,'CampaignId':_0x1e2e8c['CampaignId']||undefined})[_0x3900('0xa4')](loggerCatch(_0x3900('0xf0')));var _0x574fce=new History(_0x182ca0);_0x574fce['state']=0xb;_0x574fce['statedesc']=_0x3900('0xe8');_0x574fce[_0x3900('0x72')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x574fce['endtime']=_0x574fce[_0x3900('0x72')];_0x574fce[_0x3900('0xe2')]=_0x182ca0['calleridname'];_0x574fce[_0x3900('0xe3')]=_0x182ca0[_0x3900('0xe3')];hopperUtils[_0x3900('0xcb')](_0x574fce)[_0x3900('0xa4')](loggerCatch(_0x3900('0xf1')));}})[_0x3900('0x41')](function(){if(_0x26ea83)hopperUtils[_0x3900('0xe5')](_0x182ca0,_0x25cf6b,_0x985fd9)[_0x3900('0x41')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x3900('0xf2')]=function(_0x435fc2){if(this[_0x3900('0x26')][_0x435fc2['uniqueid']]){this[_0x3900('0x26')][_0x435fc2[_0x3900('0xc4')]][_0x3900('0xf3')]=_0x435fc2['channel'];}if(this[_0x3900('0x28')][_0x435fc2[_0x3900('0xc4')]]){this['uniqueId'][_0x435fc2[_0x3900('0xc4')]]['channel']=_0x435fc2['channel'];}};Dialer['prototype'][_0x3900('0x3c')]=function(_0x124ea8){if(!this[_0x3900('0x26')][_0x124ea8[_0x3900('0xf4')]]){return;}var _0x3bab0b=this['voiceQueues'][this[_0x3900('0x26')][_0x124ea8[_0x3900('0xf4')]][_0x3900('0xc1')]][_0x3900('0xf5')]||_0x3900('0xf6');if(_0x3bab0b===_0x3900('0xf7')){if(this[_0x3900('0x26')][_0x124ea8[_0x3900('0xf4')]]&&_['isNil'](this[_0x3900('0x26')][_0x124ea8[_0x3900('0xf4')]][_0x3900('0xf8')])&&_0x124ea8[_0x3900('0x8a')]==='1'&&_0x124ea8[_0x3900('0xf9')]==='0'){if(this['agents'][_0x124ea8[_0x3900('0xfa')]]){if(!this['agents'][_0x124ea8[_0x3900('0xfa')]][_0x3900('0xf8')]){this[_0x3900('0x22')][_0x124ea8['stateinterface']][_0x3900('0xf8')]=!![];this['actions'][_0x124ea8[_0x3900('0xf4')]]['locked']=!![];this[_0x3900('0x26')][_0x124ea8['actionid']][_0x3900('0xfa')]=_0x124ea8['stateinterface'];}}}}else if(_0x3bab0b===_0x3900('0xf6')){if(this['actions'][_0x124ea8[_0x3900('0xf4')]]){if(this[_0x3900('0x22')][_0x124ea8[_0x3900('0xfa')]]){this['actions'][_0x124ea8[_0x3900('0xf4')]][_0x3900('0xfa')]=_0x124ea8['stateinterface'];if(_['isNil'](this['queueBooked'][this[_0x3900('0x26')][_0x124ea8[_0x3900('0xf4')]][_0x3900('0xc1')]])){this['queueBooked'][this[_0x3900('0x26')][_0x124ea8['actionid']][_0x3900('0xc1')]]=[];}this[_0x3900('0x2b')][this['actions'][_0x124ea8[_0x3900('0xf4')]][_0x3900('0xc1')]][_0x3900('0x9c')](_[_0x3900('0x62')](_['pick'](this[_0x3900('0x26')][_0x124ea8[_0x3900('0xf4')]],[_0x3900('0xfb'),_0x3900('0xfa')]),{'status':_0x124ea8[_0x3900('0x8a')],'paused':_0x124ea8[_0x3900('0xf9')]}));}}}};Dialer[_0x3900('0x1a')][_0x3900('0x3d')]=function(_0x1333c0){if(!this['actions'][_0x1333c0['actionid']]){return;}var _0x7b6c7c=this;var _0x455409=this[_0x3900('0x20')][this[_0x3900('0x26')][_0x1333c0['actionid']][_0x3900('0xc1')]];var _0x2093d5=_0x455409['strategy']||_0x3900('0xf6');if(_0x2093d5==='roundrobin'){if(this[_0x3900('0x26')][_0x1333c0[_0x3900('0xf4')]]&&this[_0x3900('0x26')][_0x1333c0[_0x3900('0xf4')]][_0x3900('0xfa')]){this[_0x3900('0x1f')][_0x3900('0xfc')](this[_0x3900('0x26')][_0x1333c0[_0x3900('0xf4')]][_0x3900('0xfb')],this['actions'][_0x1333c0['actionid']]['stateinterface'])[_0x3900('0xa4')](function(_0x39df01){logger[_0x3900('0x67')](_0x3900('0xfd'),util[_0x3900('0x47')](_0x39df01,{'showHidden':![],'depth':null}));})[_0x3900('0x1d')](function(){utils[_0x3900('0xce')](_0x7b6c7c[_0x3900('0x20')][_0x7b6c7c[_0x3900('0x26')][_0x1333c0['actionid']][_0x3900('0xc1')]],_0x3900('0xfe'));_0x7b6c7c['agents'][_0x7b6c7c[_0x3900('0x26')][_0x1333c0[_0x3900('0xf4')]][_0x3900('0xfa')]]['locked']=![];delete _0x7b6c7c[_0x3900('0x26')][_0x1333c0['actionid']];unlockQueueStatus(_0x455409);});}else{utils[_0x3900('0xce')](this[_0x3900('0x20')][this[_0x3900('0x26')][_0x1333c0[_0x3900('0xf4')]][_0x3900('0xc1')]],_0x3900('0xfe'));hopperUtils[_0x3900('0xdd')]({'active':![],'ContactId':this[_0x3900('0x26')][_0x1333c0['actionid']][_0x3900('0xdf')],'ListId':this[_0x3900('0x26')][_0x1333c0['actionid']][_0x3900('0xe0')],'VoiceQueueId':this[_0x3900('0x26')][_0x1333c0[_0x3900('0xf4')]][_0x3900('0xff')]||undefined,'CampaignId':this['actions'][_0x1333c0[_0x3900('0xf4')]][_0x3900('0xe1')]||undefined})[_0x3900('0xa4')](loggerCatch(_0x3900('0x100')));delete this[_0x3900('0x26')][_0x1333c0[_0x3900('0xf4')]];unlockQueueStatus(_0x455409);}}else if(_0x2093d5===_0x3900('0xf6')){var _0x2296d1;if(this[_0x3900('0x26')][_0x1333c0['actionid']]&&!_[_0x3900('0x95')](this[_0x3900('0x2b')][this[_0x3900('0x26')][_0x1333c0[_0x3900('0xf4')]][_0x3900('0xc1')]])){if(this[_0x3900('0x101')][_0x7b6c7c[_0x3900('0x26')][_0x1333c0[_0x3900('0xf4')]][_0x3900('0xc1')]]){this[_0x3900('0x101')][_0x7b6c7c[_0x3900('0x26')][_0x1333c0[_0x3900('0xf4')]][_0x3900('0xc1')]]=this[_0x3900('0x101')][this[_0x3900('0x26')][_0x1333c0[_0x3900('0xf4')]][_0x3900('0xc1')]]?this[_0x3900('0x101')][this[_0x3900('0x26')][_0x1333c0[_0x3900('0xf4')]]['queue']]:this[_0x3900('0x2b')][this['actions'][_0x1333c0[_0x3900('0xf4')]][_0x3900('0xc1')]]?this['queueBooked'][this[_0x3900('0x26')][_0x1333c0['actionid']][_0x3900('0xc1')]][_0x3900('0x102')]||0x0:0x0;}this[_0x3900('0x2b')][this[_0x3900('0x26')][_0x1333c0[_0x3900('0xf4')]]['queue']][_0x3900('0x102')]=this[_0x3900('0x101')][this[_0x3900('0x26')][_0x1333c0[_0x3900('0xf4')]][_0x3900('0xc1')]];for(var _0x5ba23=0x0;_0x5ba23=_0x1b2e93[_0x3900('0x123')]){_0x16f4eb[_0x3900('0x124')](_0x4eccec,_0x16bae4,_0x2c5dc7,_0x3900('0x125'));}else{if(_0x4eccec[_0x3900('0x11e')]>=_0x1b2e93[_0x3900('0x126')]){_0x16f4eb[_0x3900('0x127')](_0x4eccec,_0x16bae4,_0x2c5dc7,_0x3900('0x128'));}else{hopperUtils[_0x3900('0xdd')]({'active':![],'countmachineretry':_0x4eccec[_0x3900('0x11e')],'scheduledat':moment()[_0x3900('0xef')](_0x1b2e93[_0x3900('0x129')],_0x3900('0xde'))[_0x3900('0x88')](_0x3900('0xc5')),'ContactId':_0x4eccec[_0x3900('0xdf')],'ListId':_0x4eccec[_0x3900('0xe0')],'VoiceQueueId':_0x4eccec[_0x3900('0xff')]||undefined,'CampaignId':_0x4eccec[_0x3900('0xe1')]||undefined})['catch'](loggerCatch(_0x3900('0x12a')));_0x16bae4({'reschedule':0x1});}}});}if(_0x30eaad[_0x3900('0x45')]==='ivr'&&this['campaigns'][_0x30eaad['queue']][_0x3900('0x111')]&&_0x451fa7['value']==='HANGUP'){delete this['uniqueId'][_0x451fa7['uniqueid']];utils[_0x3900('0xce')](this['campaigns'][_0x30eaad[_0x3900('0xc1')]],_0x3900('0x11a'));_0x426168=new Hangup(_0x30eaad,_0x451fa7);_0x426168[_0x3900('0x6f')]=0x12;_0x426168[_0x3900('0x70')]='HangupInAMD';_0x426168[_0x3900('0x115')]=_0x3900('0x11d');ami[_0x3900('0x44')](_0x3900('0x116'),ut[_0x3900('0x12b')](_0x426168,_0x3900('0x11f')));this[_0x3900('0x12c')](_0x426168,_0x3900('0x12d'),_0x3900('0x12e'));}if(_0x30eaad['type']===_0x3900('0xc2')&&this[_0x3900('0x21')][_0x30eaad[_0x3900('0xc1')]]['dialAMDActive']&&_0x451fa7[_0x3900('0x112')]===_0x3900('0x119')){return new Promise(function(_0x2b16bd,_0x5a64a3){delete _0x16f4eb[_0x3900('0x28')][_0x451fa7['uniqueid']];utils[_0x3900('0xce')](_0x16f4eb[_0x3900('0x21')][_0x30eaad[_0x3900('0xc1')]],_0x3900('0x11a'));_0x16f4eb[_0x3900('0x21')][_0x30eaad[_0x3900('0xc1')]][_0x3900('0xc6')]+=0x1;_0x16f4eb['campaigns'][_0x30eaad['queue']][_0x3900('0x11b')]+=0x1;var _0x51350d=_0x16f4eb[_0x3900('0x21')][_0x30eaad[_0x3900('0xc1')]];var _0x248cd1=new Hangup(_0x30eaad,_0x451fa7);_0x248cd1[_0x3900('0x6f')]=0x13;_0x248cd1['statedesc']='Machine';_0x248cd1[_0x3900('0x115')]='AMD';_0x248cd1[_0x3900('0x11e')]+=0x1;_0x248cd1[_0x3900('0xd7')]+=0x1;_0x248cd1[_0x3900('0x11f')]=!![];ami[_0x3900('0x44')](_0x3900('0x116'),ut[_0x3900('0x12b')](_0x248cd1,_0x3900('0x11f')));hopperUtils[_0x3900('0xcb')](_0x248cd1)['catch'](loggerCatch(_0x3900('0x12f')));if(_0x248cd1[_0x3900('0x120')]+_0x248cd1[_0x3900('0x130')]+_0x248cd1[_0x3900('0x121')]+_0x248cd1[_0x3900('0x131')]+_0x248cd1[_0x3900('0x132')]+_0x248cd1[_0x3900('0xea')]+_0x248cd1[_0x3900('0x11e')]+_0x248cd1[_0x3900('0x122')]>=_0x51350d[_0x3900('0x123')]){_0x16f4eb['stateGlobal'](_0x248cd1,_0x2b16bd,_0x5a64a3,_0x3900('0x125'));}else{if(_0x248cd1[_0x3900('0x11e')]>=_0x51350d[_0x3900('0x126')]){_0x16f4eb[_0x3900('0x127')](_0x248cd1,_0x2b16bd,_0x5a64a3,'reason\x2019\x20machine....');}else{hopperUtils[_0x3900('0xdd')]({'active':![],'countmachineretry':_0x248cd1[_0x3900('0x11e')],'scheduledat':moment()['add'](_0x51350d[_0x3900('0x129')],_0x3900('0xde'))[_0x3900('0x88')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x248cd1[_0x3900('0xdf')],'ListId':_0x248cd1[_0x3900('0xe0')],'VoiceQueueId':_0x248cd1['VoiceQueueId']||undefined,'CampaignId':_0x248cd1[_0x3900('0xe1')]||undefined})[_0x3900('0xa4')](loggerCatch('[rescheduleContact][Machine]'));_0x2b16bd({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x3900('0x38')]=function(_0x1ee776){var _0x1e5e68=this[_0x3900('0x28')][_0x1ee776['uniqueid']];var _0x4d478f;if(!_0x1e5e68){return;}if(_0x1e5e68['type']==='ivr'){delete this[_0x3900('0x28')][_0x1ee776['uniqueid']];utils[_0x3900('0xce')](this['campaigns'][_0x1e5e68[_0x3900('0xc1')]],'[syncHangup]');this[_0x3900('0x21')][_0x1e5e68['queue']][_0x3900('0x133')]+=0x1;if(_0x1ee776[_0x3900('0x134')]===_0x3900('0x135')){const _0xebe667=new AgentComplete(_0x1e5e68,_0x1ee776);_0xebe667[_0x3900('0xe1')]=this[_0x3900('0x21')][_0x1e5e68['queue']]['id'];hopperUtils[_0x3900('0xcb')](_0xebe667)[_0x3900('0xa4')](loggerCatch(_0x3900('0x136')));hopperUtils['moveContactManagedDialer'](_0xebe667)['catch'](loggerCatch(_0x3900('0x137')));}else{_0x4d478f=new Hangup(_0x1e5e68,_0x1ee776);hopperUtils['createHistory'](_0x4d478f)[_0x3900('0xa4')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x3900('0x138')](_0x4d478f)[_0x3900('0xa4')](loggerCatch(_0x3900('0x139')));}}else{if(isNotNull(this[_0x3900('0x20')][_0x1e5e68[_0x3900('0xc1')]][_0x3900('0x13a')])){delete this[_0x3900('0x28')][_0x1ee776[_0x3900('0xc4')]];utils[_0x3900('0xce')](this['voiceQueues'][_0x1e5e68['queue']],'[syncHangup]');this[_0x3900('0x20')][_0x1e5e68[_0x3900('0xc1')]]['outboundAnswerCallsDay']+=0x1;this[_0x3900('0x20')][_0x1e5e68['queue']][_0x3900('0x11b')]+=0x1;_0x4d478f=new Hangup(_0x1e5e68,_0x1ee776);_0x4d478f[_0x3900('0x6f')]=0x10;_0x4d478f[_0x3900('0x70')]=_0x3900('0x13b');_0x4d478f['membername']=_0x3900('0x13c');hopperUtils[_0x3900('0xcb')](_0x4d478f)[_0x3900('0xa4')](loggerCatch(_0x3900('0x13d')));hopperUtils['moveContactManagedDialer'](_0x4d478f)[_0x3900('0xa4')](loggerCatch(_0x3900('0x139')));}else{delete this[_0x3900('0x28')][_0x1ee776[_0x3900('0xc4')]];utils[_0x3900('0xce')](this[_0x3900('0x20')][_0x1e5e68[_0x3900('0xc1')]],_0x3900('0x13e'));if(_0x1ee776[_0x3900('0x134')]===_0x3900('0x135')){this[_0x3900('0x20')][_0x1e5e68[_0x3900('0xc1')]][_0x3900('0xc6')]+=0x1;const _0x5ac8b2=new AgentComplete(_0x1e5e68,_0x1ee776);_0x5ac8b2[_0x3900('0xff')]=this[_0x3900('0x20')][_0x1e5e68[_0x3900('0xc1')]]['id'];hopperUtils[_0x3900('0xcb')](_0x5ac8b2)['catch'](loggerCatch(_0x3900('0xcc')));hopperUtils[_0x3900('0x138')](_0x5ac8b2)[_0x3900('0xa4')](loggerCatch(_0x3900('0xcd')));}else{this[_0x3900('0x20')][_0x1e5e68[_0x3900('0xc1')]][_0x3900('0x13f')]+=0x1;_0x4d478f=new Hangup(_0x1e5e68,_0x1ee776);_0x4d478f['state']=0xc;_0x4d478f['statedesc']=_0x1ee776[_0x3900('0x134')];_0x4d478f[_0x3900('0x115')]=_0x3900('0x140');hopperUtils[_0x3900('0xcb')](_0x4d478f)[_0x3900('0xa4')](loggerCatch(_0x3900('0x141')));hopperUtils['moveContactManagedDialer'](_0x4d478f)[_0x3900('0xa4')](loggerCatch(_0x3900('0x142')));}}}};Dialer[_0x3900('0x1a')][_0x3900('0xc')]=function(_0x5718ca){var _0x5daa7f=this;if(!_0x5daa7f[_0x3900('0x2c')][_0x5718ca[_0x3900('0x49')]]){_0x5daa7f[_0x3900('0x2c')][_0x5718ca[_0x3900('0x49')]]={'running':![]};}else if(_0x5daa7f[_0x3900('0x2c')][_0x5718ca[_0x3900('0x49')]]['running']===!![]){return;}else if(_0x5daa7f[_0x3900('0x2c')][_0x5718ca[_0x3900('0x49')]][_0x3900('0x143')]===![]){_0x5daa7f['queuesSummary'][_0x5718ca[_0x3900('0x49')]][_0x3900('0x143')]=!![];}var _0x5ba29b=_0x5daa7f['voiceQueues'][_0x5718ca[_0x3900('0x49')]];var _0x31037d=_0x5ba29b['message']!==utils['CAMPAIGN_STATUS'][_0x3900('0x7b')];var _0x156cf5=utils['isPreviewCampaign'](_0x5ba29b);_0x5ba29b[_0x3900('0x144')]=utils[_0x3900('0x145')](_0x5ba29b,_0x5daa7f[_0x3900('0x23')]);Promise[_0x3900('0x146')]()[_0x3900('0x41')](function(){if(_0x5ba29b[_0x3900('0x144')]===utils[_0x3900('0x6b')][_0x3900('0x7b')]){if(_0x31037d){clearPredictiveAttributes(_0x5ba29b);_0x5718ca[_0x3900('0x65')]=undefined;_0x5718ca[_0x3900('0x2a')]=undefined;}if(_0x5ba29b[_0x3900('0x144')]===utils[_0x3900('0x6b')][_0x3900('0x7b')]){_0x5718ca[_0x3900('0x147')]=0x0;_0x5718ca['paused']=0x0;_0x5718ca[_0x3900('0x148')]=0x0;_0x5718ca['talking']=0x0;_0x5718ca[_0x3900('0x149')]=0x0;}}else if(_0x5ba29b[_0x3900('0x144')]===utils[_0x3900('0x6b')][_0x3900('0x14a')]&&!_0x156cf5){return _0x5daa7f[_0x3900('0x93')](_0x5ba29b,!![])[_0x3900('0x41')](function(){return _0x5daa7f[_0x3900('0x93')](_0x5ba29b,![]);})['then'](function(){return _0x5daa7f[_0x3900('0x14b')](_0x5ba29b);})['catch'](function(_0xdcdf12){loggerSyncQueueSummary['debug']('[syncQueueSummary]',util[_0x3900('0x47')](_0xdcdf12,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x5ba29b);});}else{clearPredictiveAttributes(_0x5ba29b);}})['then'](function(){var _0x1d3a9a=_0x5718ca[_0x3900('0x14c')](_0x5ba29b);if(_0x1d3a9a||_0x5ba29b[_0x3900('0x14d')]){_0x5ba29b[_0x3900('0x14d')]=![];_0x5718ca['updateReportFromOutboundQueue'](_0x5ba29b);Object[_0x3900('0x14e')](_0x5ba29b,_0x5718ca);emitOutboundVoiceQueueSummary(_0x5718ca);}_0x5daa7f['queuesSummary'][_0x5ba29b[_0x3900('0x49')]]['running']=![];})['catch'](function(_0x1c6d41){logger[_0x3900('0x67')](_0x3900('0x14f'),util[_0x3900('0x47')](_0x1c6d41,{'showHidden':![],'depth':null}));_0x5daa7f[_0x3900('0x2c')][_0x5ba29b[_0x3900('0x49')]][_0x3900('0x143')]=![];});};Dialer['prototype'][_0x3900('0x36')]=_[_0x3900('0x150')](function(){var _0x5d80f6=_[_0x3900('0x151')](this[_0x3900('0x20')],function(_0x24badb){return _0x24badb['dialPreviewRecallmeReminder'];});var _0xc94184=_[_0x3900('0x151')](this['agents'],function(_0x3c8513){return _0x3c8513['online']&&_0x3c8513[_0x3900('0x8a')]===_0x3900('0x152');});if(_0x5d80f6[_0x3900('0x9b')]>0x0&&_0xc94184[_0x3900('0x9b')]>0x0){return Promise[_0x3900('0x146')]()[_0x3900('0x41')](cmHopper[_0x3900('0x153')](_['map'](_0x5d80f6,'id'),previewRecallmeReminderInterval,_['map'](_0xc94184,'id')))[_0x3900('0x41')](function(_0x1053d8){for(var _0x3e0de8=0x0;_0x3e0de8<_0x1053d8[_0x3900('0x9b')];_0x3e0de8++){var _0x2b0689=_0x1053d8[_0x3e0de8][_0x3900('0x154')][_0x3900('0x49')];if(_0x2b0689)io['to'](util[_0x3900('0x88')](_0x3900('0x155'),_0x2b0689))[_0x3900('0x44')](_0x3900('0x156'),{'hopper':_0x1053d8[_0x3e0de8]});}})[_0x3900('0xa4')](function(_0xc5288c){logger[_0x3900('0x67')](_0x3900('0x157'),_0xc5288c);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x3900('0x1a')]['loopClearZombieChannels']=function(){var _0x5e1c64=this;setInterval(function(){_0x5e1c64[_0x3900('0x158')](_0x5e1c64['uniqueId'],_0x3900('0x159'));_0x5e1c64[_0x3900('0x158')](_0x5e1c64[_0x3900('0x26')],'[actions]');},0x32c8);};Dialer[_0x3900('0x1a')][_0x3900('0x158')]=function(_0x144274,_0x16b171){var _0x12e5f4=this;for(var _0x3f966b in _0x144274){if(typeof _0x144274[_0x3f966b]!=='undefined'){this['sequence']['enqueue'](function(){if(!_[_0x3900('0x103')](_0x144274[_0x3f966b])){return ami[_0x3900('0x9d')]({'action':'status','channel':_0x144274[_0x3f966b][_0x3900('0xf3')]})['catch'](function(_0x1f128a){if(_0x1f128a[_0x3900('0x6a')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x144274[_0x3f966b]&&_0x144274[_0x3f966b][_0x3900('0x45')]!==_0x3900('0xc2')){utils[_0x3900('0xce')](_0x12e5f4['voiceQueues'][_0x144274[_0x3f966b][_0x3900('0xc1')]],_0x3900('0x15a'));logger['error'](_0x3900('0x15b'),_0x16b171,_0x3f966b,_0x144274[_0x3f966b][_0x3900('0xc1')]);delete _0x144274[_0x3f966b];}if(_0x144274[_0x3f966b]&&_0x144274[_0x3f966b]['type']===_0x3900('0xc2')){utils[_0x3900('0xce')](_0x12e5f4[_0x3900('0x21')][_0x144274[_0x3f966b][_0x3900('0xc1')]],_0x3900('0x15a'));logger[_0x3900('0x67')](_0x3900('0x15c'),_0x16b171,_0x3f966b,_0x144274[_0x3f966b][_0x3900('0xc1')]);delete _0x144274[_0x3f966b];}},0x2328);}});}});}}};Dialer[_0x3900('0x1a')][_0x3900('0x15d')]=function(_0x3d03eb){return Promise[_0x3900('0x146')]()[_0x3900('0x41')](voiceQueueRt[_0x3900('0x15d')](_0x3d03eb))[_0x3900('0xa4')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x3900('0x1a')]['emptyContact']=function(_0x485f23,_0x5a3145,_0x27ba2d){var _0x181101={'state':0x19,'statedesc':'notFound'};utils[_0x3900('0xce')](_0x5a3145,_0x3900('0x15e')+_0x485f23);this[_0x3900('0x12c')](_[_0x3900('0x62')](_0x181101,_['pick'](_0x27ba2d,[_0x3900('0xdf'),_0x3900('0xe0'),_0x3900('0x15f'),_0x3900('0xff'),'CampaignId'])),_0x3900('0x160'),'[emptyContact]');logger[_0x3900('0x67')](_0x485f23);};Dialer['prototype'][_0x3900('0x12c')]=function(_0x43d1d9,_0x5946e8,_0x45bbcd){hopperUtils[_0x3900('0xcb')](_0x43d1d9)[_0x3900('0xa4')](loggerCatch(_0x5946e8));hopperUtils['moveContactManagedDialer'](_0x43d1d9)[_0x3900('0xa4')](loggerCatch(_0x45bbcd));};Dialer['prototype'][_0x3900('0xdb')]=function(_0x5ebc25,_0x3fe467){hopperUtils[_0x3900('0xcb')](_0x5ebc25)[_0x3900('0xa4')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x3fe467==0x0){hopperUtils['moveContactManagedDialer'](_0x5ebc25)[_0x3900('0xa4')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x3900('0x1a')][_0x3900('0x157')]=function(_0x9d5f29){return Promise[_0x3900('0x146')]()[_0x3900('0x41')](cmHopper[_0x3900('0x153')](_0x9d5f29['id'],previewRecallmeReminderInterval))['then'](function(_0x190cd7){for(var _0x4c988b=0x0;_0x4c988b<_0x190cd7[_0x3900('0x9b')];_0x4c988b++){var _0x372d84=_0x190cd7[_0x4c988b][_0x3900('0x154')][_0x3900('0x49')];if(_0x372d84)io['to'](util[_0x3900('0x88')](_0x3900('0x155'),_0x372d84))[_0x3900('0x44')](_0x3900('0x156'),{'hopper':_0x190cd7[_0x4c988b]});}})[_0x3900('0xa4')](function(){});};Dialer[_0x3900('0x1a')][_0x3900('0x161')]=function(_0x3de160){var _0x3b52d3=this;return function(){_0x3b52d3['handleIvr'](_0x3de160);};};Dialer['prototype']['actionOriginate']=function(_0x284cb9,_0x25db08){var _0x50a83b=this;var _0x12d30f=uuid['v4']();this[_0x3900('0x26')][_0x12d30f]=new Action(_0x284cb9,_0x25db08,_0x12d30f);return new Promise(function(_0x491978,_0x28904a){if(_[_0x3900('0x43')](_0x284cb9)&&typeof _0x284cb9!==_0x3900('0x162')){return _0x28904a(msgResponse(_0x3900('0x163'),_0x3900('0xa8'),_0x3900('0x164')));}if(_[_0x3900('0x43')](_0x25db08[_0x3900('0x165')])||_0x25db08[_0x3900('0x165')]===null){return _0x28904a(msgResponse(_0x3900('0x163'),_0x3900('0xa8'),_0x3900('0x166')));}var _0xbfc54f={'XMD-CALLERID':_0x50a83b[_0x3900('0x26')][_0x12d30f][_0x3900('0x167')](),'XMD-AGI':_0x284cb9[_0x3900('0x13a')]?util[_0x3900('0x88')]('\x22agi://%s/square,%s\x22',ipAgi,_0x284cb9[_0x3900('0x13a')]):_0x3900('0x168'),'XMD-AGIAFTER':_0x284cb9['dialQueueProject2']?util[_0x3900('0x88')](_0x3900('0x169'),ipAgi,_0x284cb9[_0x3900('0xc9')]):_0x3900('0x168'),'XMD-QUEUE':utils[_0x3900('0x16a')](_0x284cb9)?util[_0x3900('0x88')](_0x3900('0x16b'),_0x284cb9[_0x3900('0x49')],_0x284cb9[_0x3900('0x16c')]||'',_0x284cb9[_0x3900('0xca')]?'c':'',_0x284cb9[_0x3900('0xd2')]||0x3):'NONE','XMD-CONTACTID':_0x25db08[_0x3900('0xdf')],'XMD-CDRTYPE':_0x3900('0x9'),'CALLERID(all)':_0x50a83b[_0x3900('0x26')][_0x12d30f][_0x3900('0x167')](),'XMD-AMD':_0x284cb9[_0x3900('0x111')]?_0x3900('0x14a'):_0x3900('0x168'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x284cb9[_0x3900('0x111')]){_0xbfc54f[_0x3900('0x16d')]=_0x284cb9[_0x3900('0x16e')]||0x9c4;_0xbfc54f[_0x3900('0x16f')]=_0x284cb9[_0x3900('0x170')]||0x5dc;_0xbfc54f[_0x3900('0x171')]=_0x284cb9[_0x3900('0x172')]||0x320;_0xbfc54f[_0x3900('0x173')]=_0x284cb9[_0x3900('0x174')]||0x1388;_0xbfc54f[_0x3900('0x175')]=_0x284cb9[_0x3900('0x176')]||0x64;_0xbfc54f[_0x3900('0x177')]=_0x284cb9[_0x3900('0x178')]||0x32;_0xbfc54f[_0x3900('0x179')]=_0x284cb9['dialAMDMaximumNumberOfWords']||0x3;_0xbfc54f[_0x3900('0x17a')]=_0x284cb9[_0x3900('0x17b')]||0x100;_0xbfc54f[_0x3900('0x17c')]=_0x284cb9[_0x3900('0x17d')]||0x1388;}if(utils[_0x3900('0x16a')](_0x284cb9)){_0xbfc54f[_0x3900('0x17e')]=_0x25db08[_0x3900('0xff')];}else{_0xbfc54f[_0x3900('0x17f')]=_0x25db08[_0x3900('0xe1')];}var _0x482046=utils[_0x3900('0x180')](_0x25db08[_0x3900('0x181')]);Object[_0x3900('0x14e')](_0xbfc54f,_0x482046);var _0x467d63=_0x50a83b[_0x3900('0x8d')](_0x284cb9['Trunk'])?utils[_0x3900('0x182')](_0x284cb9[_0x3900('0x8e')][_0x3900('0x183')],_0x284cb9[_0x3900('0x184')],_0x284cb9['dialRandomLastDigitCallerIdNumber']>0x0?utils['getCallerIdRandom'](_0x284cb9[_0x3900('0x185')],_0x284cb9['dialRandomLastDigitCallerIdNumber']):_0x284cb9[_0x3900('0x185')]):utils['getCallerId'](_['isNil'](_0x284cb9[_0x3900('0x186')])?_0x284cb9['Trunk'][_0x3900('0x183')]:_0x284cb9[_0x3900('0x186')][_0x3900('0x183')],_0x284cb9['dialOriginateCallerIdName'],_0x284cb9[_0x3900('0x187')]>0x0?utils['getCallerIdRandom'](_0x284cb9[_0x3900('0x185')],_0x284cb9[_0x3900('0x187')]):_0x284cb9[_0x3900('0x185')]);if(_0x467d63){_0xbfc54f[_0x3900('0x188')]=_0x50a83b[_0x3900('0x26')][_0x12d30f][_0x3900('0x189')]=utils[_0x3900('0x18a')](_0x467d63);_0xbfc54f[_0x3900('0x18b')]=_0x25db08[_0x3900('0x165')];}_0x284cb9[_0x3900('0x18c')]=_0xbfc54f;return ami[_0x3900('0x9d')]({'actionid':_0x12d30f,'action':_0x3900('0x163'),'channel':_0x50a83b[_0x3900('0x8d')](_0x284cb9[_0x3900('0x8e')])?util[_0x3900('0x88')](_0x3900('0x18d'),_0x284cb9[_0x3900('0x8e')][_0x3900('0x49')],isNotNull(_0x284cb9[_0x3900('0x18e')])?_0x284cb9['dialPrefix'][_0x3900('0x18f')]()||'':'',_0x284cb9[_0x3900('0x190')]>0x0?_0x25db08['phone']['substring'](_0x284cb9[_0x3900('0x190')]):_0x25db08[_0x3900('0x165')]):util['format'](_0x3900('0x18d'),_[_0x3900('0x103')](_0x284cb9[_0x3900('0x186')])?_0x284cb9[_0x3900('0x8e')][_0x3900('0x49')]:_0x284cb9[_0x3900('0x186')][_0x3900('0x49')],isNotNull(_0x284cb9['dialPrefix'])?_0x284cb9['dialPrefix'][_0x3900('0x18f')]()||'':'',_0x284cb9[_0x3900('0x190')]>0x0?_0x25db08[_0x3900('0x165')][_0x3900('0x191')](_0x284cb9[_0x3900('0x190')]):_0x25db08[_0x3900('0x165')]),'callerid':_0x467d63,'Exten':_0x3900('0x110'),'Context':_0x3900('0x192'),'Priority':'1','variable':_0xbfc54f,'timeout':(_0x284cb9[_0x3900('0x193')]||0x1e)*0x3e8,'async':!![],'channelid':_0x12d30f})[_0x3900('0x41')](function(_0x4e3529){return _0x491978(_0x4e3529);})['catch'](function(_0x49c674){_0x284cb9[_0x3900('0x194')]+=0x1;var _0x4799e5=new History(_0x50a83b[_0x3900('0x26')][_0x12d30f]);logger[_0x3900('0x67')](util[_0x3900('0x88')](_0x3900('0x195'),JSON[_0x3900('0x87')](_0x49c674)));_0x4799e5[_0x3900('0x6f')]=0xe;_0x4799e5['statedesc']='OriginateError';_0x4799e5[_0x3900('0x72')]=moment()[_0x3900('0x88')](_0x3900('0xc5'));_0x4799e5['endtime']=_0x4799e5[_0x3900('0x72')];hopperUtils[_0x3900('0xcb')](_0x4799e5)[_0x3900('0xa4')](loggerCatch('[originate][error]'));_0x50a83b[_0x3900('0x138')](_0x4799e5)[_0x3900('0xa4')](loggerCatch('[originate][error]'))['finally'](function(){delete _0x50a83b[_0x3900('0x26')][_0x12d30f];return _0x28904a(msgResponse(_0x3900('0x163'),_0x3900('0x86'),'originate\x20action\x20Error'));});});});};Dialer['prototype']['checkRetriveMax']=function(_0x913ea8,_0x85d72d,_0x3bcd9d){var _0xb468ff=new History(_0x85d72d);if(_0xb468ff[_0x3900('0x120')]+_0xb468ff['countcongestionretry']+_0xb468ff[_0x3900('0x121')]+_0xb468ff[_0x3900('0x131')]+_0xb468ff[_0x3900('0x132')]+_0xb468ff['countabandonedretry']+_0xb468ff[_0x3900('0x11e')]+_0xb468ff['countagentrejectretry']>=_0x3bcd9d[_0x3900('0x123')]-0x1){return!![];}switch(_0x913ea8){case 0x3:if(_0xb468ff[_0x3900('0x121')]>=_0x3bcd9d['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x3900('0xdd')]({'active':![],'countnoanswerretry':_0xb468ff['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x3900('0xef')](_0x3bcd9d[_0x3900('0x196')],_0x3900('0xde'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xb468ff[_0x3900('0xdf')],'ListId':_0xb468ff[_0x3900('0xe0')],'VoiceQueueId':_0xb468ff[_0x3900('0xff')]||undefined,'CampaignId':_0xb468ff[_0x3900('0xe1')]||undefined})[_0x3900('0xa4')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0xb468ff['countbusyretry']>=_0x3bcd9d['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x3900('0xdd')]({'active':![],'countbusyretry':_0xb468ff[_0x3900('0x120')]+=0x1,'scheduledat':moment()[_0x3900('0xef')](_0x3bcd9d['dialBusyRetryFrequency'],_0x3900('0xde'))['format'](_0x3900('0xc5')),'ContactId':_0xb468ff[_0x3900('0xdf')],'ListId':_0xb468ff[_0x3900('0xe0')],'VoiceQueueId':_0xb468ff[_0x3900('0xff')]||undefined,'CampaignId':_0xb468ff[_0x3900('0xe1')]||undefined})[_0x3900('0xa4')](loggerCatch(_0x3900('0x197')));break;case 0x8:if(_0xb468ff[_0x3900('0x130')]>=_0x3bcd9d[_0x3900('0x198')]-0x1){return!![];}hopperUtils[_0x3900('0xdd')]({'active':![],'countcongestionretry':_0xb468ff[_0x3900('0x130')]+=0x1,'scheduledat':moment()[_0x3900('0xef')](_0x3bcd9d[_0x3900('0x199')],'minutes')[_0x3900('0x88')](_0x3900('0xc5')),'ContactId':_0xb468ff['ContactId'],'ListId':_0xb468ff[_0x3900('0xe0')],'VoiceQueueId':_0xb468ff[_0x3900('0xff')]||undefined,'CampaignId':_0xb468ff['CampaignId']||undefined})[_0x3900('0xa4')](loggerCatch(_0x3900('0x19a')));break;case 0x0:if(_0xb468ff[_0x3900('0x131')]>=_0x3bcd9d[_0x3900('0x19b')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0xb468ff[_0x3900('0x131')]+=0x1,'scheduledat':moment()[_0x3900('0xef')](_0x3bcd9d['dialNoSuchNumberRetryFrequency'],_0x3900('0xde'))[_0x3900('0x88')](_0x3900('0xc5')),'ContactId':_0xb468ff[_0x3900('0xdf')],'ListId':_0xb468ff['ListId'],'VoiceQueueId':_0xb468ff[_0x3900('0xff')]||undefined,'CampaignId':_0xb468ff['CampaignId']||undefined})[_0x3900('0xa4')](loggerCatch(_0x3900('0x19c')));}break;case 0xa:if(_0xb468ff[_0x3900('0x132')]>=_0x3bcd9d[_0x3900('0xda')]-0x1){return!![];}hopperUtils[_0x3900('0xdd')]({'active':![],'countdropretry':_0xb468ff[_0x3900('0x132')]+=0x1,'scheduledat':moment()[_0x3900('0xef')](_0x3bcd9d[_0x3900('0xd8')],_0x3900('0xde'))['format'](_0x3900('0xc5')),'ContactId':_0xb468ff[_0x3900('0xdf')],'ListId':_0xb468ff[_0x3900('0xe0')],'VoiceQueueId':_0xb468ff['VoiceQueueId']||undefined,'CampaignId':_0xb468ff[_0x3900('0xe1')]||undefined})[_0x3900('0xa4')](loggerCatch(_0x3900('0x19d')));break;case 0xb:if(_0xb468ff[_0x3900('0xea')]>=_0x3bcd9d[_0x3900('0xee')]-0x1){return!![];}hopperUtils[_0x3900('0xdd')]({'active':![],'countabandonedretry':_0xb468ff['countabandonedretry']+=0x1,'scheduledat':moment()[_0x3900('0xef')](_0x3bcd9d[_0x3900('0xeb')],_0x3900('0xde'))[_0x3900('0x88')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xb468ff[_0x3900('0xdf')],'ListId':_0xb468ff[_0x3900('0xe0')],'VoiceQueueId':_0xb468ff[_0x3900('0xff')]||undefined,'CampaignId':_0xb468ff[_0x3900('0xe1')]||undefined})[_0x3900('0xa4')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0xb468ff[_0x3900('0x11e')]>=_0x3bcd9d[_0x3900('0x126')]-0x1){return!![];}hopperUtils[_0x3900('0xdd')]({'active':![],'countmachineretry':_0xb468ff[_0x3900('0x11e')]+=0x1,'scheduledat':moment()[_0x3900('0xef')](_0x3bcd9d['dialMachineRetryFrequency'],_0x3900('0xde'))[_0x3900('0x88')](_0x3900('0xc5')),'ContactId':_0xb468ff[_0x3900('0xdf')],'ListId':_0xb468ff[_0x3900('0xe0')],'VoiceQueueId':_0xb468ff['VoiceQueueId']||undefined,'CampaignId':_0xb468ff[_0x3900('0xe1')]||undefined})[_0x3900('0xa4')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0xb468ff['countagentrejectretry']>=_0x3bcd9d[_0x3900('0x19e')]-0x1){return!![];}hopperUtils[_0x3900('0xdd')]({'active':![],'countagentrejectretry':_0xb468ff[_0x3900('0x122')]+=0x1,'scheduledat':moment()['add'](_0x3bcd9d[_0x3900('0x19f')],_0x3900('0xde'))['format'](_0x3900('0xc5')),'ContactId':_0xb468ff[_0x3900('0xdf')],'ListId':_0xb468ff['ListId'],'VoiceQueueId':_0xb468ff['VoiceQueueId']||undefined,'CampaignId':_0xb468ff[_0x3900('0xe1')]||undefined})['catch'](loggerCatch(_0x3900('0x1a0')));break;default:return!![];}};Dialer[_0x3900('0x1a')][_0x3900('0x10d')]=function(_0x4f30c2,_0x4e281f,_0x3fd182){var _0x8427b5=this;var _0x437604=new History(_0x4f30c2);var _0x1049cc=![];var _0x447439;var _0x281260;return new Promise(function(_0x303318,_0x291fea){if(_['isUndefined'](_0x4e281f)&&typeof _0x4e281f!=='object'){return _0x291fea(msgResponse(_0x3900('0x1a1'),_0x3900('0xa8'),_0x3900('0x1a2')));}if(_[_0x3900('0x43')](_0x3fd182)&&typeof _0x3fd182!==_0x3900('0x162')){return _0x291fea(msgResponse(_0x3900('0x1a1'),_0x3900('0xa8'),_0x3900('0x1a3')));}hopperUtils[_0x3900('0xd9')](_0x437604,_0x3fd182[_0x3900('0xc7')],_0x4e281f)[_0x3900('0x41')](function(_0x3d8c58){if(_0x3d8c58['additional']==0x1)_0x1049cc=!![];switch(_0x3fd182['reason']){case'0':_0x4e281f[_0x3900('0x1a4')]+=0x1;_0x437604[_0x3900('0x6f')]=0x0;_0x437604['statedesc']=_0x3900('0x1a5');_0x437604[_0x3900('0x131')]+=0x1;_0x437604[_0x3900('0xd7')]+=0x1;ami[_0x3900('0x44')]('custom:agentnosuchnumber',ut[_0x3900('0x12b')](_0x4f30c2,'nosuchnumber'));_0x447439=_0x4e281f['dialNoSuchNumberRetryFrequency'];_0x281260=_0x4e281f[_0x3900('0xec')];hopperUtils['createHistory'](_0x437604)[_0x3900('0xa4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x8427b5['checkRetriveMax'](0x0,_0x4f30c2,_0x4e281f)&&!_0x1049cc){if(_0x437604['countnosuchnumberretry']>=_0x4e281f[_0x3900('0x19b')]){_0x8427b5[_0x3900('0x127')](_0x437604,_0x303318,_0x291fea,_0x3900('0x1a6'));}else{_0x8427b5[_0x3900('0x124')](_0x437604,_0x303318,_0x291fea,_0x3900('0x1a6'));}}break;case'3':_0x4e281f[_0x3900('0x1a7')]+=0x1;_0x437604[_0x3900('0x6f')]=0x3;_0x437604[_0x3900('0x70')]=_0x3900('0x1a8');_0x437604[_0x3900('0x121')]+=0x1;_0x437604[_0x3900('0xd7')]+=0x1;var _0x50a4fd=ut[_0x3900('0x1a9')](_0x4f30c2,_0x4e281f);ami[_0x3900('0x44')](_0x3900('0x1aa'),_0x50a4fd);_0x447439=_0x4e281f[_0x3900('0x196')];_0x281260=_0x4e281f[_0x3900('0xec')];hopperUtils[_0x3900('0xcb')](_0x437604)[_0x3900('0xa4')](loggerCatch(_0x3900('0x1ab')));if(_0x8427b5[_0x3900('0x1ac')](0x3,_0x4f30c2,_0x4e281f)&&!_0x1049cc){if(_0x437604[_0x3900('0x121')]>=_0x4e281f[_0x3900('0x1ad')]){_0x8427b5['createStateFinal'](_0x437604,_0x303318,_0x291fea,_0x3900('0x1ae'));}else{_0x8427b5['stateGlobal'](_0x437604,_0x303318,_0x291fea,_0x3900('0x1ae'));}}break;case'5':_0x4e281f[_0x3900('0x1af')]+=0x1;_0x437604['state']=0x5;_0x437604['statedesc']=_0x3900('0x1b0');_0x437604[_0x3900('0x120')]+=0x1;_0x437604['countglobal']+=0x1;ami[_0x3900('0x44')](_0x3900('0x1b1'),ut['buildObj'](_0x4f30c2,'busy'));_0x447439=_0x4e281f[_0x3900('0x1b2')];_0x281260=_0x4e281f['callAdditionalPhoneAfterMin'];hopperUtils[_0x3900('0xcb')](_0x437604)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x8427b5['checkRetriveMax'](0x5,_0x4f30c2,_0x4e281f)&&!_0x1049cc){if(_0x437604[_0x3900('0x120')]>=_0x4e281f[_0x3900('0x1b3')]){_0x8427b5['createStateFinal'](_0x437604,_0x303318,_0x291fea,_0x3900('0x1b4'));}else{_0x8427b5[_0x3900('0x124')](_0x437604,_0x303318,_0x291fea,_0x3900('0x1b4'));}}break;case'8':_0x4e281f['outboundCongestionCallsDay']+=0x1;_0x437604['state']=0x8;_0x437604[_0x3900('0x70')]=_0x3900('0x1b5');_0x437604[_0x3900('0x130')]+=0x1;_0x437604['countglobal']+=0x1;_0x447439=_0x4e281f['dialCongestionRetryFrequency'];_0x281260=_0x4e281f[_0x3900('0xec')];ami[_0x3900('0x44')]('custom:agentcongestion',ut[_0x3900('0x12b')](_0x4f30c2,'congestion'));hopperUtils[_0x3900('0xcb')](_0x437604)['catch'](loggerCatch(_0x3900('0x1b6')));if(_0x8427b5['checkRetriveMax'](0x8,_0x4f30c2,_0x4e281f)&&!_0x1049cc){if(_0x437604['countcongestionretry']>=_0x4e281f[_0x3900('0x198')]){_0x8427b5[_0x3900('0x127')](_0x437604,_0x303318,_0x291fea,_0x3900('0x1b7'));}else{_0x8427b5['stateGlobal'](_0x437604,_0x303318,_0x291fea,'reason\x208\x20congestion');}}break;case'11':_0x4e281f[_0x3900('0x1b8')]+=0x1;_0x437604[_0x3900('0x6f')]=0xb;_0x437604[_0x3900('0x70')]=_0x3900('0xe8');_0x437604[_0x3900('0xea')]+=0x1;_0x437604['countglobal']+=0x1;_0x447439=_0x4e281f[_0x3900('0xeb')];_0x281260=_0x4e281f[_0x3900('0xec')];hopperUtils[_0x3900('0xcb')](_0x437604)[_0x3900('0xa4')](loggerCatch(_0x3900('0xf1')));if(_0x8427b5['checkRetriveMax'](0xb,_0x4f30c2,_0x4e281f)&&!_0x1049cc){if(_0x437604[_0x3900('0xea')]>=_0x4e281f[_0x3900('0xee')]){_0x8427b5[_0x3900('0x127')](_0x437604,_0x303318,_0x291fea,'reason\x2011\x20abandoned');}else{_0x8427b5[_0x3900('0x124')](_0x437604,_0x303318,_0x291fea,_0x3900('0x1b9'));}}break;case'20':_0x4e281f['outboundRejectCallsDay']+=0x1;_0x437604[_0x3900('0x6f')]=0x14;_0x437604[_0x3900('0x70')]=_0x3900('0x1ba');_0x437604[_0x3900('0x122')]+=0x1;_0x437604[_0x3900('0xd7')]+=0x1;_0x447439=_0x4e281f[_0x3900('0x19f')];_0x281260=_0x4e281f[_0x3900('0xec')];ami[_0x3900('0x44')](_0x3900('0x1bb'),ut[_0x3900('0x12b')](_0x4f30c2,_0x3900('0x1bc')));hopperUtils[_0x3900('0xcb')](_0x437604)[_0x3900('0xa4')](loggerCatch(_0x3900('0x1bd')));if(_0x8427b5['checkRetriveMax'](0x14,_0x4f30c2,_0x4e281f)&&!_0x1049cc){if(_0x437604['countagentrejectretry']>=_0x4e281f['dialAgentRejectMaxRetry']){_0x8427b5[_0x3900('0x127')](_0x437604,_0x303318,_0x291fea,_0x3900('0x1be'));}else{_0x8427b5[_0x3900('0x124')](_0x437604,_0x303318,_0x291fea,_0x3900('0x1be'));}}break;default:_0x4e281f[_0x3900('0x13f')]+=0x1;_0x437604['state']=0xc;_0x437604[_0x3900('0x70')]=_0x3fd182[_0x3900('0xc7')];_0x447439=_0x4e281f[_0x3900('0x19f')];_0x281260=_0x4e281f[_0x3900('0xec')];hopperUtils[_0x3900('0xcb')](_0x437604)[_0x3900('0xa4')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x8427b5[_0x3900('0x1ac')](_0x3fd182[_0x3900('0xc7')],_0x4f30c2,_0x4e281f)&&!_0x1049cc){if(_0x437604[_0x3900('0x120')]+_0x437604[_0x3900('0x130')]+_0x437604[_0x3900('0x121')]+_0x437604[_0x3900('0x131')]+_0x437604[_0x3900('0x132')]+_0x437604['countabandonedretry']+_0x437604[_0x3900('0x11e')]+_0x437604['countagentrejectretry']>=_0x4e281f[_0x3900('0x123')]){_0x8427b5['stateGlobal'](_0x437604,_0x303318,_0x291fea,_0x3fd182[_0x3900('0xc7')]);}else{_0x8427b5['createStateFinal'](_0x437604,_0x303318,_0x291fea,_0x3fd182[_0x3900('0xc7')]);}}}})[_0x3900('0x41')](function(){if(_0x1049cc){hopperUtils[_0x3900('0xe5')](_0x437604,_0x447439,_0x281260)[_0x3900('0x41')](function(){return _0x303318(0x1);});}});});};Dialer[_0x3900('0x1a')]['stateGlobal']=function(_0x310f92,_0x38e6ce,_0x4edeaf,_0x378272){var _0x5ca5f7=new Final(_0x310f92);_0x5ca5f7['state']=0xf;_0x5ca5f7[_0x3900('0x70')]=_0x3900('0x1bf');this[_0x3900('0x127')](_0x5ca5f7,_0x38e6ce,_0x4edeaf,_0x378272);};Dialer[_0x3900('0x1a')][_0x3900('0x127')]=function(_0xc659c9,_0xa62ed8,_0x305dec,_0x253418){hopperUtils[_0x3900('0x138')](_0xc659c9)[_0x3900('0x41')](function(){return _0xa62ed8(msgResponse(_0x3900('0x1a1'),_0x3900('0x1c0'),_0x253418));})['catch'](function(){return _0x305dec(msgResponse('[moveContactManagedDialer][0]',_0x3900('0xa8'),_0x3900('0x1c1')));});};Dialer[_0x3900('0x1a')][_0x3900('0xb')]=function(_0x3283af){var _0x3ad536=_0x3283af[_0x3900('0x1c2')]/0x64;var _0x45e83b=_0x3283af[_0x3900('0x1c3')]/(_0x3283af['outboundDropCallsDayTimeout']+_0x3283af[_0x3900('0xc6')]);var _0x34a26b=Math[_0x3900('0x1c4')](_0x3283af[_0x3900('0x1c5')]*(_0x3283af[_0x3900('0x1c6')]/0x64));var _0x327986=Math[_0x3900('0x1c4')](_0x3283af[_0x3900('0x1c5')]*(_0x3283af[_0x3900('0x1c7')]/0x64));var _0xcb4724=_0x3283af[_0x3900('0x147')]+_0x3283af[_0x3900('0x1c8')];var _0x484daf=Math['floor'](_0x3283af[_0x3900('0x1c9')]*_0x3283af[_0x3900('0x60')]*_0x3283af['predictiveIntervalHitRate']*_0x3283af['predictiveIntervalMultiplicativeFactor']);if(_[_0x3900('0x43')](_0x3283af[_0x3900('0x2a')])){if(!_['isUndefined'](_0x3283af[_0x3900('0x65')])){_0x3283af[_0x3900('0x65')]=undefined;loggerPredictive['error'](_0x3900('0x1ca'),_0x3900('0x1cb'));}if(!_[_0x3900('0x43')](_0x3283af[_0x3900('0x66')])){loggerPredictive[_0x3900('0x67')](_0x3900('0x1ca'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x3283af[_0x3900('0x66')]);_0x3283af['handlePredictive']=undefined;}_0x3283af['startProgressive']=moment()[_0x3900('0x88')](_0x3900('0xc5'));loggerPredictive['info'](_0x3283af[_0x3900('0x49')],_0x3900('0x1cc'),_0x3283af[_0x3900('0x2a')]);this[_0x3900('0xb3')](_0x3283af,0x1);}else if(ifInterval(_0x3283af[_0x3900('0x1cd')],_0x3283af['startProgressive'])){this[_0x3900('0xb3')](_0x3283af,0x1);loggerPredictiveCalls[_0x3900('0x4b')](_0x3900('0x1ce'),_0x3283af[_0x3900('0x2a')],_0x3283af['name']);_0x3283af[_0x3900('0x1c9')]=0x0;_0x3283af[_0x3900('0x1cf')]=0x0;}else if(_0x3ad536<_0x45e83b&&_0x3283af[_0x3900('0x1d0')]===_0x3900('0x1d1')){clearPredictiveAttributes(_0x3283af);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x45e83b,_0x3900('0x2a'),_0x3283af[_0x3900('0x49')]);}else if(_0x484daf<_0x3283af['predictiveIntervalErlangCallsDroppedCalls']&&_0x3283af['dialPredictiveOptimization']===_0x3900('0x1d1')){clearPredictiveAttributes(_0x3283af);loggerPredictive[_0x3900('0x4b')](_0x3900('0x1d2'),_0x3900('0x1d3'),_0x484daf,_0x3900('0x1d4'),_0x3283af[_0x3900('0x1cf')],_0x3900('0x2a'),_0x3283af[_0x3900('0x49')]);}else if(!ifInterval(_0x3283af[_0x3900('0x1cd')],_0x3283af[_0x3900('0x2a')])&&_[_0x3900('0x43')](_0x3283af[_0x3900('0x65')])&&!_[_0x3900('0x43')](_0x3283af[_0x3900('0x2a')])){_0x3283af[_0x3900('0x65')]=moment()[_0x3900('0x88')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x3900('0x4b')](_0x3283af['name'],'started\x20in\x20predictive\x20at',_0x3283af['startPredictive']);hopperUtils[_0x3900('0x1d5')](_0x3283af[_0x3900('0x1cd')])[_0x3900('0x41')](this['getDataPredictive'](_0x3283af))[_0x3900('0x41')](mergeDataErlangB(_0x3283af))[_0x3900('0x41')](this[_0x3900('0x1d6')](_0x3283af))[_0x3900('0xa4')](loggerCatchPredictive(_0x3900('0x1d7'),_0x3283af));}else if(!ifInterval(_0x3283af['dialPredictiveInterval'],_0x3283af[_0x3900('0x65')])){_0x3283af['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x3283af[_0x3900('0x65')]=moment()[_0x3900('0x88')](_0x3900('0xc5'));loggerPredictive['info'](_0x3283af[_0x3900('0x49')],_0x3900('0x1d8'),_0x3283af['startPredictive']);clearInterval(_0x3283af[_0x3900('0x66')]);_0x3283af[_0x3900('0x66')]=undefined;hopperUtils['avgHandleTime'](_0x3283af[_0x3900('0x1cd')])['then'](this['getDataPredictive'](_0x3283af))[_0x3900('0x41')](mergeDataErlangB(_0x3283af))[_0x3900('0x41')](this[_0x3900('0x1d6')](_0x3283af))[_0x3900('0xa4')](loggerCatchPredictive(_0x3900('0x1d9'),_0x3283af));}else if(_0x3283af[_0x3900('0x1c5')]&&_0xcb4724<_0x3283af[_0x3900('0x1c5')]-_0x327986){clearPredictiveAttributes(_0x3283af);loggerPredictive[_0x3900('0x4b')](_0x3283af[_0x3900('0x49')],_0x3900('0x1da'),_0xcb4724,_0x3900('0x1db'),_0x3283af[_0x3900('0x1c5')],'-',_0x327986,'=',_0x3283af[_0x3900('0x1c5')]-_0x327986,')');}else if(_0x3283af[_0x3900('0x1c5')]&&_0xcb4724>_0x3283af[_0x3900('0x1c5')]+_0x34a26b){clearPredictiveAttributes(_0x3283af);loggerPredictive[_0x3900('0x4b')](_0x3283af[_0x3900('0x49')],_0x3900('0x1da'),_0xcb4724,')\x20are\x20more\x20than\x20threshold\x20(',_0x3283af['predictiveIntervalAvailable'],'+',_0x34a26b,'=',_0x3283af[_0x3900('0x1c5')]+_0x34a26b,')');}};Dialer[_0x3900('0x1a')][_0x3900('0x1dc')]=function(_0x3be996){var _0x5bd1df=this;return function(_0x3bcca5){return new Promise(function(_0x5628f3,_0x4e95d5){_[_0x3900('0x62')](_0x3be996,_0x3bcca5[0x0]);if(checkGetDataPredictive(_0x3bcca5[0x0])){var _0x133744=_0x3be996[_0x3900('0x1c5')]=_0x3be996[_0x3900('0x1c8')]+_0x3be996['available'];var _0x4d15a5=_0x3be996[_0x3900('0x1cd')]*0x3c;var _0x490067=_0x3bcca5[0x0]['predictiveIntervalAvgTalktime']+_0x3bcca5[0x0]['predictiveIntervalAvgHoldtime'];var _0x3ad287=(_0x3bcca5[0x0][_0x3900('0x4f')]+_0x3bcca5[0x0][_0x3900('0x51')]+_0x3bcca5[0x0][_0x3900('0xe6')])/_0x3bcca5[0x0][_0x3900('0x4d')];_0x3be996[_0x3900('0x1dd')]=_0x3ad287>0x0?_0x3ad287:0x1;switch(_0x3be996[_0x3900('0x1d0')]){case _0x3900('0x1d1'):var _0x21696f=_0x3be996[_0x3900('0x1c2')]/0x64;return _0x5bd1df['abandonmentRate'](_0x133744,_0x4d15a5,_0x490067,_0x3ad287,_0x21696f)['then'](function(_0x9e0a5a){return _0x5628f3(_0x9e0a5a);});case _0x3900('0x1de'):var _0x4ef76f=_0x3be996[_0x3900('0x1c2')]/0x64;return _0x5bd1df['busyFactor'](_0x133744,_0x4d15a5,_0x490067,_0x3ad287,_0x4ef76f)[_0x3900('0x41')](function(_0x206666){return _0x5628f3(_0x206666);});default:return _0x4e95d5(msgResponse(_0x3900('0x1df'),_0x3900('0xa8'),_0x3900('0x1e0')));}}else{return _0x4e95d5(msgResponse(_0x3900('0x1df'),_0x3900('0xa8'),'check\x20failure'));}});};};Dialer['prototype'][_0x3900('0x1e1')]=function(_0x5c9d40){var _0x5994fe=this;return function(_0x49d52f){return new Promise(function(_0x257711,_0x30e9a5){_['merge'](_0x5c9d40,_0x49d52f[0x0]);if(checkGetDataPredictive(_0x49d52f[0x0])){loggerPredictive[_0x3900('0x4b')](JSON['stringify'](_0x49d52f[0x0]));if(_0x5c9d40[_0x3900('0x1d0')]===_0x3900('0x1d1')){return _0x5994fe[_0x3900('0x15d')](_0x5c9d40['id'])[_0x3900('0x41')](function(_0x501500){var _0x175931=_0x5c9d40[_0x3900('0x1e2')]-_0x501500[0x0][_0x3900('0x1e3')];var _0x49fb25=_0x5c9d40[_0x3900('0x1cd')]*0x3c;var _0x124218=_0x49d52f[0x0][_0x3900('0x56')]+_0x49d52f[0x0][_0x3900('0x54')];var _0x374037=(_0x49d52f[0x0][_0x3900('0x4f')]+_0x49d52f[0x0][_0x3900('0x51')]+_0x49d52f[0x0][_0x3900('0xe6')])/_0x49d52f[0x0][_0x3900('0x4d')];var _0x14b215=_0x5c9d40['dialPredictiveOptimizationPercentage']/0x64;_0x5c9d40[_0x3900('0x1e4')]=_0x501500[0x0]['outboundQueuePauses']||0x0;_0x5c9d40[_0x3900('0x1dd')]=_0x374037>0x0?_0x374037:0x1;return _0x5994fe[_0x3900('0x1e5')](_0x175931,_0x49fb25,_0x124218,_0x374037,_0x14b215);})['then'](function(_0x48a0fc){return _0x257711(_0x48a0fc);})[_0x3900('0xa4')](function(_0x3b785c){return _0x30e9a5(msgResponse(_0x3900('0x1e6'),_0x3900('0xa8'),JSON[_0x3900('0x87')](_0x3b785c)));});}if(_0x5c9d40[_0x3900('0x1d0')]===_0x3900('0x1de')){return _0x5994fe['getVoiceQueueRtPauses'](_0x5c9d40['id'])[_0x3900('0x41')](function(_0x3ada96){var _0x50d880=_0x5c9d40[_0x3900('0x1e2')]-_0x3ada96[0x0][_0x3900('0x1e3')];var _0x12d74f=_0x5c9d40['dialPredictiveInterval']*0x3c;var _0x5054fc=_0x49d52f[0x0][_0x3900('0x56')]+_0x49d52f[0x0][_0x3900('0x54')];var _0x3df4f7=(_0x49d52f[0x0][_0x3900('0x4f')]+_0x49d52f[0x0][_0x3900('0x51')]+_0x49d52f[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x49d52f[0x0][_0x3900('0x4d')];var _0x81976b=_0x5c9d40['dialPredictiveOptimizationPercentage']/0x64;_0x5c9d40[_0x3900('0x1e4')]=_0x3ada96[0x0]['outboundQueuePauses']||0x0;_0x5c9d40[_0x3900('0x1dd')]=_0x3df4f7>0x0?_0x3df4f7:0x1;return _0x5994fe[_0x3900('0x1e7')](_0x50d880,_0x12d74f,_0x5054fc,_0x3df4f7,_0x81976b);})['then'](function(_0xfcaa67){return _0x257711(_0xfcaa67);})[_0x3900('0xa4')](function(_0x4cec8c){return _0x30e9a5(msgResponse(_0x3900('0x1e6'),_0x3900('0xa8'),JSON[_0x3900('0x87')](_0x4cec8c)));});}}else{return _0x30e9a5(msgResponse(_0x3900('0x1df'),_0x3900('0xa8'),'check\x20failure'));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x553435){var _0x3285f0=this;return function(){var _0x4fd2b4=0x0;var _0x693d7c=Math[_0x3900('0x1e8')](_0x553435[_0x3900('0x5e')]*0x3e8);if(_0x693d7c>0x0){_0x693d7c=_0x693d7c<0x64?0x64:_0x693d7c;loggerPredictive[_0x3900('0x4b')](_0x553435['name'],_0x3900('0x1e9'),_0x693d7c,_0x3900('0x1ea'));_0x553435[_0x3900('0x66')]=setInterval(function(){_0x3285f0['handlePredictive'](_0x553435);loggerPredictiveCalls[_0x3900('0x4b')](_0x3900('0x1eb'),_0x4fd2b4+=0x1);},_0x693d7c);}else{loggerPredictive['info'](_0x553435['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x3900('0x1a')][_0x3900('0x1ec')]=function(_0xba3e29,_0x4912c6){var _0x28ae32=this;return function(_0x5d984a){if(_['isEmpty'](_0x5d984a)){if(_['isNil'](_0x4912c6[_0x3900('0x15f')])||!_0x4912c6[_0x3900('0x1ed')]){if(_0xba3e29[_0x3900('0xb1')]===_0x3900('0xa')){_0xba3e29['queueStatusComplete']=_['isUndefined'](_0xba3e29[_0x3900('0x73')])?!![]:_0xba3e29['queueStatusComplete'];var _0x2311ea=uuid['v4']();_0x28ae32['actions'][_0x2311ea]=new Action(_0xba3e29,_0x4912c6,_0x2311ea);loggerBooked[_0x3900('0x4b')](_0x3900('0x1ee'),_0x2311ea,_0x3900('0x1ef'),JSON['stringify'](_0xba3e29['queueStatusComplete']),_0x3900('0x1f0'),_0xba3e29[_0x3900('0x49')]);if(_0xba3e29[_0x3900('0x73')]){_0xba3e29[_0x3900('0x73')]=![];_0x28ae32[_0x3900('0x2b')][_0x28ae32[_0x3900('0x26')][_0x2311ea][_0x3900('0xc1')]]=[];ami[_0x3900('0x9d')]({'actionid':_0x2311ea,'action':_0x3900('0x1f1'),'queue':_0xba3e29[_0x3900('0x49')]})['catch'](function(){utils[_0x3900('0xce')](_0xba3e29,_0x3900('0x1f2'));hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x28ae32['actions'][_0x2311ea][_0x3900('0xdf')],'ListId':_0x28ae32[_0x3900('0x26')][_0x2311ea][_0x3900('0xe0')],'VoiceQueueId':_0x28ae32[_0x3900('0x26')][_0x2311ea]['VoiceQueueId']||undefined,'CampaignId':_0x28ae32['actions'][_0x2311ea][_0x3900('0xe1')]||undefined})[_0x3900('0xa4')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x28ae32[_0x3900('0x26')][_0x2311ea];});}else{loggerBooked[_0x3900('0x4b')]('[booked][checkContactBlack][else]',JSON[_0x3900('0x87')](_0xba3e29[_0x3900('0x73')]),_0x3900('0x1f0'),_0xba3e29[_0x3900('0x49')]);utils[_0x3900('0xce')](_0xba3e29,_0x3900('0x1f2'));hopperUtils[_0x3900('0xdd')]({'active':![],'ContactId':_0x28ae32[_0x3900('0x26')][_0x2311ea][_0x3900('0xdf')],'ListId':_0x28ae32['actions'][_0x2311ea][_0x3900('0xe0')],'VoiceQueueId':_0x28ae32[_0x3900('0x26')][_0x2311ea][_0x3900('0xff')]||undefined,'CampaignId':_0x28ae32[_0x3900('0x26')][_0x2311ea]['CampaignId']||undefined})[_0x3900('0xa4')](loggerCatch(_0x3900('0x1f3')));delete _0x28ae32['actions'][_0x2311ea];}}else{return _0x28ae32['actionOriginate'](_0xba3e29,_0x4912c6);}}else{if(utils[_0x3900('0x63')](undefined,_0x4912c6[_0x3900('0x1f4')])<_0xba3e29[_0x3900('0x1f5')]*0x3c){if(_0x4912c6['Agent']&&!_0x4912c6[_0x3900('0x154')][_0x3900('0x1f6')]){_0x28ae32[_0x3900('0x1f')]['run'](_0x4912c6['id'])['finally'](function(){utils[_0x3900('0xce')](_0xba3e29,_0x3900('0x1f2'));});}else{hopperUtils[_0x3900('0x1f7')]({'active':![]},_0x4912c6['id'],0x1)['finally'](function(){utils[_0x3900('0xce')](_0xba3e29,_0x3900('0x1f2'));});}}else{_0xba3e29['outboundReCallsDay']+=0x1;utils[_0x3900('0xce')](_0xba3e29,_0x3900('0x1f2'));if(_0xba3e29[_0x3900('0x1f8')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4912c6[_0x3900('0xdf')],'ListId':_0x4912c6[_0x3900('0xe0')],'VoiceQueueId':_0x4912c6['VoiceQueueId']||undefined,'CampaignId':_0x4912c6['CampaignId']||undefined})[_0x3900('0xa4')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x3900('0xcb')](createObjHistory(_0xba3e29,_0x4912c6,utils[_0x3900('0x6b')]['QUEUE_RECALL'],0x17,_0x3900('0x1f9')))[_0x3900('0xa4')](loggerCatch(_0x3900('0x1fa')));}else{_0x28ae32[_0x3900('0x12c')](createObjHistory(_0xba3e29,_0x4912c6,utils[_0x3900('0x6b')][_0x3900('0x1fb')],0x16,_0x3900('0x1fc')),'[Originate][HistoryRecallClose][historyCatch]',_0x3900('0x1fd'));}}}}else{_0xba3e29['outboundBlacklistCallsDay']+=0x1;_0x28ae32['saveInDb'](createObjHistory(_0xba3e29,_0x4912c6,utils[_0x3900('0x6b')][_0x3900('0x1fe')],0xd,_0x3900('0x1ff')),_0x3900('0x200'),_0x3900('0x201'));throw'inBlackList';}};};Dialer[_0x3900('0x1a')]['handleIvr']=function(_0x42703f){var _0x24044e=this;var _0x5c958f=_0x42703f[_0x3900('0x202')]-_0x42703f[_0x3900('0x81')];emitCampaignSummary(_0x42703f);if(_0x5c958f>0x0&&_0x42703f[_0x3900('0x203')]==0x0){if(_0x5c958f>this[_0x3900('0x24')]){_0x5c958f=this[_0x3900('0x24')];}_0x42703f['temp']=0x1;hopperUtils['getContactDialerIvr'](_0x42703f,_0x5c958f)[_0x3900('0x41')](function(_0x50cd2e){_0x42703f[_0x3900('0x203')]=0x0;if(_0x50cd2e){if(!utils['checkContactEmpty'](_0x50cd2e)){_0x42703f[_0x3900('0x6a')]=utils[_0x3900('0x6b')][_0x3900('0x6e')];logger['info']('[getContactCampaign2][Empty]'+_0x42703f[_0x3900('0x49')]);}else{_0x42703f[_0x3900('0x81')]+=_0x50cd2e['length'];_0x42703f['message']=utils[_0x3900('0x6b')][_0x3900('0x204')];for(var _0x2fec12=0x0;_0x2fec12<_0x50cd2e[_0x3900('0x9b')];_0x2fec12+=0x1){_0x42703f[_0x3900('0x205')]+=0x1;if(_[_0x3900('0x103')](_0x50cd2e[_0x2fec12])||_['isNil'](_0x50cd2e[_0x2fec12][_0x3900('0x181')])||_[_0x3900('0x103')](_0x50cd2e[_0x2fec12][_0x3900('0x165')])){_0x24044e[_0x3900('0x206')](_0x3900('0x207'),_0x42703f,_0x50cd2e[_0x2fec12]);}else{hopperUtils[_0x3900('0x208')](_[_0x3900('0x75')](_0x50cd2e[_0x2fec12],['CampaignId',_0x3900('0x165')]))[_0x3900('0x41')](_0x24044e[_0x3900('0x1ec')](_0x42703f,_0x50cd2e[_0x2fec12]))[_0x3900('0xa4')](function(_0xf873ba){logger[_0x3900('0x67')](_0x3900('0x209'),_0xf873ba);utils[_0x3900('0xce')](_0x42703f,_0x3900('0x20a'));});}}}}})[_0x3900('0xa4')](function(_0x5548eb){_0x42703f[_0x3900('0x203')]=0x0;logger['error'](_0x3900('0x20b'),_0x5548eb);});}};Dialer['prototype'][_0x3900('0xb3')]=function(_0x14c245,_0x204159){var _0x4b2908=this;var _0x42d978=[];if(_0x204159<0x1||_0x14c245[_0x3900('0xb1')]===_0x3900('0xa')){_0x204159=0x1;}var _0x1c8477=Math[_0x3900('0x1e8')](_0x14c245[_0x3900('0x147')]*_0x204159)-_0x14c245[_0x3900('0x81')];if(_0x14c245[_0x3900('0x20c')]>0x0){var _0x9ad682=_0x14c245[_0x3900('0x20c')]-_0x14c245['originated']-_0x14c245['talking']-_0x14c245[_0x3900('0x149')];if(_0x1c8477>_0x9ad682){_0x1c8477=_0x9ad682;}}if(_0x1c8477>0x0&&_0x14c245[_0x3900('0x203')]==0x0){if(_0x14c245[_0x3900('0xb1')]===_0x3900('0xa')){_0x1c8477=0x1;}if(_0x1c8477>this[_0x3900('0x24')]){_0x1c8477=this[_0x3900('0x24')];}for(var _0x551c6b in this['agents']){if(typeof this[_0x3900('0x22')][_0x551c6b]!=='undefined'){if(this[_0x3900('0x22')][_0x551c6b][_0x3900('0x6f')]==='not_inuse'&&this[_0x3900('0x22')][_0x551c6b]['status']===_0x3900('0x152')){_0x42d978[_0x3900('0x9c')](this['agents'][_0x551c6b]['id']);}}}_0x14c245[_0x3900('0x203')]=0x1;hopperUtils[_0x3900('0x20d')](_0x14c245,_0x42d978,_0x1c8477)[_0x3900('0x41')](function(_0x462716){_0x14c245[_0x3900('0x203')]=0x0;if(_0x462716){if(!utils[_0x3900('0x20e')](_0x462716)){hopperUtils[_0x3900('0x20f')](_0x14c245)[_0x3900('0x41')](sendMessageReschedule(_0x14c245))[_0x3900('0xa4')](loggerCatch(_0x3900('0x210')));}else{_0x14c245[_0x3900('0x81')]+=_0x462716[_0x3900('0x9b')];_0x14c245[_0x3900('0x6a')]=_0x14c245['dialMethod']===_0x3900('0xa')?utils[_0x3900('0x6b')]['ACTIVE']:utils[_0x3900('0x6b')][_0x3900('0x204')];for(var _0x327a53=0x0;_0x327a53<_0x462716[_0x3900('0x9b')];_0x327a53+=0x1){if(_[_0x3900('0x103')](_0x462716[_0x327a53])||_[_0x3900('0x103')](_0x462716[_0x327a53][_0x3900('0x181')])||_[_0x3900('0x103')](_0x462716[_0x327a53][_0x3900('0x165')])){_0x4b2908[_0x3900('0x206')](_0x3900('0x207'),_0x14c245,_0x462716[_0x327a53]);}else{hopperUtils[_0x3900('0x211')](_[_0x3900('0x75')](_0x462716[_0x327a53],[_0x3900('0xff'),'phone']))[_0x3900('0x41')](_0x4b2908[_0x3900('0x1ec')](_0x14c245,_0x462716[_0x327a53]))['catch'](function(_0x2c5daa){logger['error'](_0x3900('0x212'),_0x2c5daa);utils[_0x3900('0xce')](_0x14c245,_0x3900('0x213'));});}}}}})['catch'](function(_0x2082af){_0x14c245['temp']=0x0;logger['error'](_0x3900('0x20b'),_0x2082af);});}};Dialer[_0x3900('0x1a')][_0x3900('0x66')]=function(_0x151ccb){if(_0x151ccb[_0x3900('0x20c')]>0x0){var _0x549abb=_0x151ccb[_0x3900('0x20c')]-_0x151ccb[_0x3900('0x81')]-_0x151ccb[_0x3900('0x1c8')];if(_0x549abb>0x0&&_0x151ccb[_0x3900('0x203')]==0x0){this['tryOriginatePredictive'](_0x151ccb);}else{loggerPredictiveCalls[_0x3900('0x4b')](_0x3900('0x214'));}}else{this[_0x3900('0x215')](_0x151ccb);}};Dialer[_0x3900('0x1a')][_0x3900('0x215')]=function(_0x43780f){var _0x7466bd=this;var _0x5a20c3=[];_0x43780f[_0x3900('0x81')]+=0x1;for(var _0xd72d36 in this[_0x3900('0x22')]){if(typeof this[_0x3900('0x22')][_0xd72d36]!==_0x3900('0xae')){if(this[_0x3900('0x22')][_0xd72d36][_0x3900('0x6f')]===_0x3900('0x216')&&this[_0x3900('0x22')][_0xd72d36][_0x3900('0x8a')]===_0x3900('0x152')){_0x5a20c3[_0x3900('0x9c')](this['agents'][_0xd72d36]['id']);}}}_0x43780f['temp']=0x1;return this[_0x3900('0x20d')](_0x43780f['id'],_0x5a20c3,0x1,_0x43780f['dialOrderByScheduledAt'],_0x43780f)[_0x3900('0x41')](function(_0x16c120){_0x43780f['temp']=0x1;if(_0x16c120){if(!utils[_0x3900('0x20e')](_0x16c120)){utils[_0x3900('0x217')](_0x43780f,0x1,0x0);return hopperUtils[_0x3900('0x20f')](_0x43780f)[_0x3900('0x41')](sendMessageReschedule(_0x43780f))[_0x3900('0xa4')](loggerCatch(_0x3900('0x210')));}else{_0x43780f[_0x3900('0x6a')]=utils[_0x3900('0x6b')]['RUNNING'];if(_[_0x3900('0x103')](_0x16c120[0x0])||_[_0x3900('0x103')](_0x16c120[0x0]['Contact'])||_[_0x3900('0x103')](_0x16c120[0x0][_0x3900('0x165')])){_0x7466bd[_0x3900('0x206')]('[actionOriginate]\x20',_0x43780f,_0x16c120[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x3900('0x75')](_0x16c120[0x0],[_0x3900('0xff'),_0x3900('0x165')]))[_0x3900('0x41')](_0x7466bd[_0x3900('0x1ec')](_0x43780f,_0x16c120[0x0]))['catch'](function(_0x55fdb3){logger[_0x3900('0x67')]('[actionOriginatePredictive]',_0x55fdb3);utils[_0x3900('0xce')](_0x43780f,_0x3900('0x218'));});}}}})[_0x3900('0xa4')](function(_0x599a4b){_0x43780f['temp']=0x0;logger[_0x3900('0x67')]('[getContactCampaign2]',_0x599a4b);});};Dialer[_0x3900('0x1a')]['abandonmentRate']=function(_0x246780,_0x9308fc,_0xe01901,_0x169434,_0x1a1532,_0x281d86){loggerPredictive[_0x3900('0x4b')](_0x3900('0x219'));loggerPredictive[_0x3900('0x4b')](_0x3900('0x21a'),_0x246780);loggerPredictive[_0x3900('0x4b')](_0x3900('0x21b'),_0x9308fc);loggerPredictive['info'](_0x3900('0x21c'),_0xe01901);loggerPredictive[_0x3900('0x4b')](_0x3900('0x21d'),_0x169434);loggerPredictive[_0x3900('0x4b')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1a1532);loggerPredictive[_0x3900('0x4b')](_0x3900('0x57'));return new Promise(function(_0x94094b,_0x479e9a){if(_0x246780<=0x0||isNaN(_0x246780)){return _0x479e9a(msgResponse(_0x3900('0x21e'),'Error',_0x3900('0x21f')+_0x246780));}if(_0xe01901<=0x0||isNaN(_0xe01901)){return _0x479e9a(msgResponse(_0x3900('0x21e'),_0x3900('0x86'),_0x3900('0x220')+_0xe01901));}if(_0x169434<=0x0||isNaN(_0x169434)){return _0x479e9a(msgResponse('[abandonmentRate]','Error',_0x3900('0x221')+_0x169434));}if(_0x9308fc<=0x0||isNaN(_0x9308fc)){return _0x479e9a(msgResponse(_0x3900('0x21e'),_0x3900('0x86'),_0x3900('0x222')+_0x9308fc));}if(_0x1a1532<=0x0||isNaN(_0x1a1532)){return _0x479e9a(msgResponse(_0x3900('0x21e'),_0x3900('0x86'),_0x3900('0x223')+_0x1a1532));}_0x281d86=_0x281d86||0x0;var _0x3ddb39=0x1/_0xe01901;var _0x4e0c4=0x0;var _0x3ebfe0=0x0;var _0x1dfddc=0x0;var _0x493a16=0x0;for(var _0x4ae80e=0x0;_0x1dfddc<_0x1a1532;_0x4ae80e+=0x1){_0x3ebfe0=_0x4ae80e/_0x9308fc;_0x4e0c4=(_0x169434*_0x3ebfe0+_0x281d86)/_0x3ddb39;_0x1dfddc=utils[_0x3900('0x224')](_0x4e0c4,_0x246780);_0x493a16=_0x4e0c4/_0x246780*(0x1-utils[_0x3900('0x224')](_0x4e0c4,_0x246780));}return _0x94094b({'erlangCalls':_0x4ae80e,'erlangCallToSecond':_0x9308fc/_0x4ae80e,'erlangAbandonmentRate':_0x1dfddc,'erlangBusyFactor':_0x493a16});});};Dialer[_0x3900('0x1a')][_0x3900('0x1e7')]=function(_0x339c9b,_0x37a8e4,_0x196273,_0x10d064,_0x50de1b,_0x5bfabc){loggerPredictive['info'](_0x3900('0x225'));loggerPredictive[_0x3900('0x4b')](_0x3900('0x21a'),_0x339c9b);loggerPredictive[_0x3900('0x4b')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x37a8e4);loggerPredictive[_0x3900('0x4b')](_0x3900('0x21c'),_0x196273);loggerPredictive[_0x3900('0x4b')](_0x3900('0x21d'),_0x10d064);loggerPredictive['info'](_0x3900('0x226'),_0x50de1b);loggerPredictive['info'](_0x3900('0x57'));return new Promise(function(_0x36de6a,_0x1b3577){if(_0x339c9b<=0x0||isNaN(_0x339c9b)){return _0x1b3577(msgResponse(_0x3900('0x227'),_0x3900('0x86'),_0x3900('0x21f')+_0x339c9b));}if(_0x196273<=0x0||isNaN(_0x196273)){return _0x1b3577(msgResponse(_0x3900('0x227'),_0x3900('0x86'),_0x3900('0x220')+_0x196273));}if(_0x10d064<=0x0||isNaN(_0x10d064)){return _0x1b3577(msgResponse(_0x3900('0x227'),_0x3900('0x86'),_0x3900('0x221')+_0x10d064));}if(_0x37a8e4<=0x0||isNaN(_0x37a8e4)){return _0x1b3577(msgResponse('[busyFactor]','Error',_0x3900('0x222')+_0x37a8e4));}if(_0x50de1b<=0x0||isNaN(_0x50de1b)){return _0x1b3577(msgResponse(_0x3900('0x227'),'Error',_0x3900('0x228')+_0x50de1b));}_0x5bfabc=_0x5bfabc||0x0;var _0x5bc7e0=0x1/_0x196273;var _0x7d393f=0x0;var _0x4acf8e=0x0;var _0x3af422=0x0;var _0x598aa6=0x0;for(var _0x1d0921=0x0;_0x598aa6<_0x50de1b;_0x1d0921+=0x1){_0x4acf8e=_0x1d0921/_0x37a8e4;_0x7d393f=(_0x10d064*_0x4acf8e+_0x5bfabc)/_0x5bc7e0;_0x3af422=utils[_0x3900('0x224')](_0x7d393f,_0x339c9b);_0x598aa6=_0x7d393f/_0x339c9b*(0x1-utils[_0x3900('0x224')](_0x7d393f,_0x339c9b));}return _0x36de6a({'erlangCalls':_0x1d0921,'erlangCallToSecond':_0x37a8e4/_0x1d0921,'erlangAbandonmentRate':_0x3af422,'erlangBusyFactor':_0x598aa6});});};module[_0x3900('0x229')]=Dialer; \ No newline at end of file +var _0x5735=['resolve','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','progressive','dialPowerLevel','Queue','dialGlobalInterval','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_GLOBAL_INTERVAL','Timezone:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','queue','uniqueid','ivr','decrementOriginate','[syncAgentConnect]','answertime','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncQueueCallerAbandon','[syncQueueCallerAbandon]','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','countdropretry','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','queueCallerAbandonCreateState','dialDropRetryFrequency','minutes','ListId','CampaignId','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','countabandonedretry','add','VoiceQueueId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','rrmemory','roundrobin','stateinterface','locked','paused','strategy','[Catch][Preview][syncQueueStatusComplete]','[syncQueueStatusComplete]','rescheduleContact','ContactId','[unlock][syncQueueStatusComplete]','_rr','isNil','unlockRR','[booked][RR]','Agent:\x20','idHopper','run','contactAgent-idHopper:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncOriginateResponse','response','Success','[callProgressDetecting]\x20','syncVarSet','variable','amdstatus','exten','xcally-motion-dialer','HANGUP','outboundAnswerAgiCallsDay','membername','AMD','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','value','MACHINE','[syncVarSet]','Machine','countmachineretry','buildObj','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','reason\x2019\x20machine....','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','createStateFinal','dialMachineRetryFrequency','[syncHangup]','ivrAnswerCallsDay','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','moveContactManagedDialer','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','outboundUnknownCallsDay','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','available','inUse','talking','pTalking','[syncQueueSummary]','queueSummaryCountersUpdated','assign','syncQueueSummaryComplete','filter','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','sequence','No\x20such\x20channel','[clearZombieChannels]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','notFound','[emptyContact]','UserId','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','variables','dialPrefix','trim','dialCutDigit','TrunkBackup','substring','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','[rescheduleContact][Drop]','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','dialNoSuchNumberRetryFrequency','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','floor','erlangCalls','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','handlePower','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','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\x20more\x20than\x20threshold\x20(','agentBusyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','abandonmentRate','[CatchErlangB]','loggedIn','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','dialMethod','booked','queueStatusComplete:\x20','Queue:\x20','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','dialRecallInQueue','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','inBlackList','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]','temp','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','tryOriginatePredictive','dialOrderByScheduledAt','checkContactLowerLimitOriginate','checkIsBlackList','[actionOriginatePredictive]','--------\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','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','erlangb','----\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','[busyFactor]','Umin\x20=\x20','exports','util','moment','ioredis','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','defaults','redis','localhost','socket.io-emitter','../rpc/voiceQueueRt','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','queuecallerabandon','bind','originateresponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','hangup','syncHangup','syncNewExten','varset','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','startProgressive','startProgressive\x20value\x20cleared','handlePredictive','error','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','message','state','statedesc','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','Intervals','\x20INTERVAL_IS_NULL','isEmpty','NULL_INTERVAL','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','Error','prototype','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','isTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20empty\x20','\x20Timezone\x20unknow\x20','length','push','Action','command','timezones','then','indexOf','true','catch','content','all','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','undefined'];(function(_0x47093c,_0x50be47){var _0x3218db=function(_0x2c5511){while(--_0x2c5511){_0x47093c['push'](_0x47093c['shift']());}};_0x3218db(++_0x50be47);}(_0x5735,0x16a));var _0x5573=function(_0x132a9a,_0x4da489){_0x132a9a=_0x132a9a-0x0;var _0x9dd201=_0x5735[_0x132a9a];return _0x9dd201;};'use strict';var util=require(_0x5573('0x0'));var _=require('lodash');var uuid=require('uuid');var moment=require(_0x5573('0x1'));var rr=require('rr');var Redis=require(_0x5573('0x2'));var utils=require('./utils');var hopperUtils=require('./utils/hopper');var ut=require('../preview/util/util');var config=require(_0x5573('0x3'));var logger=require(_0x5573('0x4'))(_0x5573('0x5'));var loggerBooked=require(_0x5573('0x4'))('booked');var loggerPredictive=require(_0x5573('0x4'))(_0x5573('0x6'));var loggerPredictiveCalls=require(_0x5573('0x4'))(_0x5573('0x7'));var loggerSyncQueueSummary=require(_0x5573('0x4'))(_0x5573('0x8'));var ami=require('../ami');config['redis']=_[_0x5573('0x9')](config[_0x5573('0xa')],{'host':_0x5573('0xb'),'port':0x18eb});var io=require(_0x5573('0xc'))(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x5573('0xd'));var RpcSetting=require('../rpc/setting');var Interval=require(_0x5573('0xe'));var Action=require(_0x5573('0xf'));var History=require(_0x5573('0x10'));var Final=require(_0x5573('0x11'));var AgentComplete=require(_0x5573('0x12'));var QueueCallerAbandon=require(_0x5573('0x13'));var Hangup=require(_0x5573('0x14'));var ipAgi=process[_0x5573('0x15')][_0x5573('0x16')]||_0x5573('0x17');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x5573('0x18')]=function(_0x42251f){this['tail']=this[_0x5573('0x19')]?this[_0x5573('0x19')][_0x5573('0x1a')](_0x42251f):_0x42251f();};function Dialer(_0x57596a,_0xd36213){this['sequence']=new Sequence();this[_0x5573('0x1b')]=_0xd36213;this[_0x5573('0x1c')]=_0x57596a[_0x5573('0x1c')];this[_0x5573('0x1d')]=_0x57596a[_0x5573('0x1d')];this[_0x5573('0x1e')]=_0x57596a[_0x5573('0x1e')];this[_0x5573('0x1f')]=_0x57596a[_0x5573('0x1f')];this[_0x5573('0x20')]=config['maxNumberOriginate']||0x2;this[_0x5573('0x21')]={};this[_0x5573('0x22')]={};this[_0x5573('0x23')]={};this[_0x5573('0x24')]={};this[_0x5573('0x25')]={};this[_0x5573('0x26')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0x5573('0x27')]={};this[_0x5573('0x28')]={};this[_0x5573('0x29')]={};ami['on'](_0x5573('0x2a'),this[_0x5573('0x2b')]['bind'](this));ami['on'](_0x5573('0x2c'),this['syncQueueCallerAbandon'][_0x5573('0x2d')](this));ami['on'](_0x5573('0x2e'),this['syncOriginateResponse'][_0x5573('0x2d')](this));ami['on']('agentcomplete',this[_0x5573('0x2f')][_0x5573('0x2d')](this));ami['on'](_0x5573('0x30'),this[_0x5573('0x8')][_0x5573('0x2d')](this));ami['on'](_0x5573('0x31'),this['syncQueueSummaryComplete']['bind'](this));ami['on'](_0x5573('0x32'),this[_0x5573('0x33')][_0x5573('0x2d')](this));ami['on']('newexten',this[_0x5573('0x34')][_0x5573('0x2d')](this));ami['on'](_0x5573('0x35'),this['syncVarSet'][_0x5573('0x2d')](this));ami['on'](_0x5573('0x36'),this[_0x5573('0x37')][_0x5573('0x2d')](this));ami['on']('queuestatuscomplete',this[_0x5573('0x38')]['bind'](this));this[_0x5573('0x39')]();this[_0x5573('0x3a')]();RpcSetting[_0x5573('0x3b')]()['then'](function(_0x1b3c53){previewRecallmeReminderInterval=_0x1b3c53[_0x5573('0x3c')];});}function isNotNull(_0x46db01){return _0x46db01!==null&&!_[_0x5573('0x3d')](_0x46db01);}function msgResponse(_0x202069,_0x14c0a2,_0x5931be){return{'action':_0x202069,'response':_0x14c0a2,'message':_0x5931be,'stack':_0x5931be};}function emit(_0x1cee8a,_0x1f08b5,_0x212f43){io['to'](_0x1cee8a)[_0x5573('0x3e')](_0x1f08b5,_0x212f43);}function emitOutboundVoiceQueueSummary(_0x4501b3){if(_0x4501b3[_0x5573('0x3f')]===_0x5573('0x40')){logger[_0x5573('0x41')](_0x5573('0x42'),util[_0x5573('0x43')](_0x4501b3,{'showHidden':![],'depth':null}));emit(util[_0x5573('0x44')](_0x5573('0x45'),_0x4501b3[_0x5573('0x46')]),_0x5573('0x47'),_0x4501b3);}}function checkGetDataPredictive(_0x5d0904){if(isNotNull(_0x5d0904)&&!_['isEmpty'](_0x5d0904)){loggerPredictive[_0x5573('0x48')](_0x5573('0x49'));loggerPredictive[_0x5573('0x48')](_0x5573('0x4a'),_0x5d0904[_0x5573('0x4b')]);loggerPredictive['info'](_0x5573('0x4c'),_0x5d0904[_0x5573('0x4d')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5d0904['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x5573('0x48')](_0x5573('0x4e'),_0x5d0904[_0x5573('0x4f')]);loggerPredictive['info'](_0x5573('0x50'),_0x5d0904[_0x5573('0x51')]);loggerPredictive[_0x5573('0x48')](_0x5573('0x52'),_0x5d0904['predictiveIntervalAvgTalktime']);loggerPredictive[_0x5573('0x48')](_0x5573('0x53'));if(_0x5d0904[_0x5573('0x4b')]>0x0){if(!_['isUndefined'](_0x5d0904[_0x5573('0x54')])&&_0x5d0904['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x5573('0x3d')](_0x5d0904[_0x5573('0x51')])&&_0x5d0904['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info'](_0x5573('0x55'));}else{loggerPredictive[_0x5573('0x48')](_0x5573('0x56'));}}else{loggerPredictive[_0x5573('0x48')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x2b44b0){return function(_0x72823d){loggerPredictive[_0x5573('0x48')](_0x5573('0x57'));loggerPredictive[_0x5573('0x48')](_0x5573('0x58'),_0x72823d['erlangCalls']);loggerPredictive[_0x5573('0x48')](_0x5573('0x59'),_0x72823d[_0x5573('0x5a')]);loggerPredictive[_0x5573('0x48')](_0x5573('0x5b'),_0x72823d[_0x5573('0x5c')]);loggerPredictive[_0x5573('0x48')](_0x5573('0x5d'),_0x72823d['erlangBusyFactor']);loggerPredictive[_0x5573('0x48')](_0x5573('0x5b'),_0x72823d['erlangAbandonmentRate']);loggerPredictive[_0x5573('0x48')](_0x5573('0x53'));_[_0x5573('0x5e')](_0x2b44b0,_0x72823d);};}function ifInterval(_0x427fcf,_0x54d4a5){if(_['isUndefined'](_0x54d4a5)){return![];}return utils[_0x5573('0x5f')](undefined,_0x54d4a5)<_0x427fcf*0x3c;}function clearPredictiveAttributes(_0x4ffff2){if(_0x4ffff2[_0x5573('0x60')]){_0x4ffff2[_0x5573('0x60')]=undefined;loggerPredictive[_0x5573('0x41')](_0x4ffff2[_0x5573('0x46')],_0x5573('0x61'));}if(_0x4ffff2[_0x5573('0x26')]){_0x4ffff2[_0x5573('0x26')]=undefined;loggerPredictive['debug'](_0x4ffff2[_0x5573('0x46')],'startPredictive\x20value\x20cleared');}if(_0x4ffff2[_0x5573('0x62')]){clearInterval(_0x4ffff2['handlePredictive']);_0x4ffff2[_0x5573('0x62')]=undefined;loggerPredictive[_0x5573('0x41')](_0x4ffff2[_0x5573('0x46')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x4636d,_0x99faaa){return function(_0x399ff8){loggerPredictive['error'](_0x99faaa[_0x5573('0x46')],_0x4636d);loggerPredictive[_0x5573('0x63')](_0x399ff8['stack']);clearPredictiveAttributes(_0x99faaa);};}function loggerCatch(_0x468ae8){return function(_0x21f36b){logger['error'](_0x468ae8,util[_0x5573('0x43')](_0x21f36b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5d0a9d){return function(_0x7fe9d2){if(isNotNull(_0x7fe9d2)&&isNotNull(_0x7fe9d2[0x0])){if(_0x7fe9d2[0x0][_0x5573('0x64')]>0x0){_0x5d0a9d['message']=utils[_0x5573('0x65')][_0x5573('0x66')];logger[_0x5573('0x48')](_0x5573('0x67')+_0x5d0a9d[_0x5573('0x46')],_0x7fe9d2[0x0][_0x5573('0x64')],'contacts');}else{_0x5d0a9d['message']=utils[_0x5573('0x65')][_0x5573('0x68')];logger[_0x5573('0x48')](_0x5573('0x69')+_0x5d0a9d[_0x5573('0x46')]);}}};}function createObjHistory(_0x3380f2,_0x1703e5,_0x2ec331,_0xffde84,_0x533349){_0x3380f2[_0x5573('0x6a')]=_0x2ec331;var _0x325376=new Action(_0x3380f2,_0x1703e5);var _0xeca05d=new History(_0x325376);_0xeca05d[_0x5573('0x6b')]=_0xffde84;_0xeca05d[_0x5573('0x6c')]=_0x533349;_0xeca05d[_0x5573('0x6d')]=_0x325376[_0x5573('0x6e')];return _0xeca05d;}function unlockQueueStatus(_0x4f3a1f,_0x4c0b67){setTimeout(function(){if(_['isUndefined'](_0x4f3a1f[_0x5573('0x6f')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x4c0b67);}_0x4f3a1f[_0x5573('0x6f')]=!![];loggerBooked[_0x5573('0x48')](_0x5573('0x70'),_0x4c0b67,JSON[_0x5573('0x71')](_[_0x5573('0x72')](_0x4f3a1f,[_0x5573('0x46'),_0x5573('0x6f')])));},0x1f3);}function checkInterval(_0x43a8ed){return function(){if(!isNotNull(_0x43a8ed[_0x5573('0x73')])){_0x43a8ed[_0x5573('0x6a')]=utils[_0x5573('0x65')]['NULL_INTERVAL'];throw _0x43a8ed[_0x5573('0x46')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x43a8ed[_0x5573('0x73')][_0x5573('0x74')])){_0x43a8ed['message']=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x43a8ed[_0x5573('0x46')]+_0x5573('0x75');}if(!isNotNull(_[_0x5573('0x76')](_0x43a8ed[_0x5573('0x73')][_0x5573('0x74')]))){_0x43a8ed[_0x5573('0x6a')]=utils[_0x5573('0x65')][_0x5573('0x77')];throw _0x43a8ed[_0x5573('0x46')]+_0x5573('0x75');}};}function checkIsIVRCampaignActive(_0x5e25d0){return function(){if(!utils['isIVRCampaignActive'](_0x5e25d0)){_0x5e25d0[_0x5573('0x6a')]=utils['CAMPAIGN_STATUS'][_0x5573('0x78')];throw _0x5e25d0[_0x5573('0x46')]+_0x5573('0x79');}};}function emitCampaignSummary(_0x23b9b4){if(utils[_0x5573('0x7a')](_0x23b9b4)){emit(util[_0x5573('0x44')]('campaign:ivr:%s',_0x23b9b4[_0x5573('0x46')]),_0x5573('0x7b'),_0x23b9b4);}}function loggerCatchQueueSummary(_0xe4bb73,_0x5c4649){return function(_0x257feb){clearPredictiveAttributes(_0x5c4649);emitCampaignSummary(_0x5c4649);loggerSyncQueueSummary[_0x5573('0x41')](_0xe4bb73,util[_0x5573('0x43')](_0x257feb,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0xc0ed6a){if(_0xc0ed6a[_0x5573('0x7c')]){if(_0xc0ed6a[_0x5573('0x7d')]===0x0){_0xc0ed6a[_0x5573('0x7c')]=![];_0xc0ed6a[_0x5573('0x6a')]=utils[_0x5573('0x65')][_0x5573('0x78')];loggerSyncQueueSummary[_0x5573('0x41')](_0x5573('0x7e'),_0xc0ed6a[_0x5573('0x46')],'is\x20not\x20active');}else{_0xc0ed6a[_0x5573('0x6a')]=utils[_0x5573('0x65')]['DISACTIVED'];loggerSyncQueueSummary[_0x5573('0x41')](_0x5573('0x7e'),_0xc0ed6a[_0x5573('0x46')],'is\x20deactivated');}emitCampaignSummary(_0xc0ed6a);}}function myreject(_0x1717d2){return function(_0x432610){return _0x1717d2(msgResponse('[ifTime][Action]',_0x5573('0x7f'),JSON['stringify'](_0x432610)));};}Dialer[_0x5573('0x80')]['isTrunkReachable']=function(_0x344faf){return!_[_0x5573('0x3d')](_0x344faf)&&_0x344faf&&!_[_0x5573('0x3d')](_0x344faf[_0x5573('0x46')])&&!_[_0x5573('0x3d')](_0x344faf[_0x5573('0x81')])&&_0x344faf[_0x5573('0x81')]&&(this[_0x5573('0x1f')][util['format'](_0x5573('0x82'),_0x344faf['name'])][_0x5573('0x83')]===_0x5573('0x84')||this[_0x5573('0x1f')][util[_0x5573('0x44')](_0x5573('0x82'),_0x344faf[_0x5573('0x46')])][_0x5573('0x83')]===_0x5573('0x85'));};Dialer[_0x5573('0x80')][_0x5573('0x86')]=function(_0x488d79){var _0x91bca6=this;return function(){if(!_0x91bca6[_0x5573('0x87')](_0x488d79[_0x5573('0x88')])){if(!_0x91bca6['isTrunkReachable'](_0x488d79['TrunkBackup'])){_0x488d79['message']=utils[_0x5573('0x65')][_0x5573('0x89')];throw _0x488d79['name']+_0x5573('0x8a');}}};};Dialer[_0x5573('0x80')][_0x5573('0x8b')]=function(_0xdb703b,_0x4b4390,_0x3a3180,_0x572bc1){var _0x5d9e0b=this;return function(){var _0x44d910=!![];return _0x5d9e0b[_0x5573('0x8c')](_0xdb703b,_0x4b4390,_0x3a3180,_0x572bc1,_0x44d910);};};Dialer['prototype'][_0x5573('0x8d')]=function(_0xddca5f,_0x4ab0d4,_0x778817,_0x259e4c){var _0x519e97=this;return function(){var _0x57aafd=![];return _0x519e97[_0x5573('0x8c')](_0xddca5f['Intervals'],_0x4ab0d4,_0x778817,_0x259e4c,_0x57aafd);};};Dialer['prototype'][_0x5573('0x8c')]=function(_0x334c31,_0x29c0d,_0x22e5fe,_0x5d50af,_0x131291){var _0x5ae0a6=[];return new Promise(function(_0x1c47fe,_0x4c9f6f){if(!isNotNull(_0x334c31)){_0x5d50af[_0x5573('0x6a')]=utils[_0x5573('0x65')]['NULL_INTERVAL'];return _0x4c9f6f(msgResponse(_0x5573('0x8e'),_0x5573('0x8f'),_0x22e5fe+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x5573('0x76')](_0x334c31)){_0x5d50af[_0x5573('0x6a')]=utils[_0x5573('0x65')]['EMPTY_INTERVAL'];return _0x4c9f6f(msgResponse(_0x5573('0x8e'),_0x5573('0x8f'),_0x22e5fe+_0x5573('0x90')));}if(_0x29c0d&&_['isUndefined'](config['timezones'][_0x29c0d])){_0x5d50af['message']=utils['CAMPAIGN_STATUS']['UNKNOWN_TIMEZONE'];return _0x4c9f6f(msgResponse(_0x5573('0x8e'),'Failure',_0x22e5fe+_0x5573('0x91')+_0x29c0d));}if(_['isArray'](_0x334c31)){for(var _0x34f68d=0x0;_0x34f68d<_0x334c31[_0x5573('0x92')];_0x34f68d+=0x1){_0x5ae0a6[_0x5573('0x93')](ami[_0x5573('0x94')]({'action':_0x5573('0x95'),'command':util['format']('iftime\x20%s,%s',_0x334c31[_0x34f68d]['interval'],!_['isUndefined'](config[_0x5573('0x96')][_0x29c0d])?_0x29c0d:'')})[_0x5573('0x97')](function(_0x197715){return _0x197715['content'][_0x5573('0x98')](_0x5573('0x99'))>=0x0;})[_0x5573('0x9a')](myreject(_0x4c9f6f)));}}else{_0x5ae0a6['push'](ami[_0x5573('0x94')]({'action':_0x5573('0x95'),'command':util[_0x5573('0x44')]('iftime\x20%s,%s',_0x334c31,!_[_0x5573('0x3d')](config[_0x5573('0x96')][_0x29c0d])?_0x29c0d:'')})[_0x5573('0x97')](function(_0x5d1fbb){return _0x5d1fbb[_0x5573('0x9b')][_0x5573('0x98')]('true')>=0x0;})[_0x5573('0x9a')](myreject(_0x4c9f6f)));}Promise[_0x5573('0x9c')](_0x5ae0a6)[_0x5573('0x97')](function(_0x1f3533){var _0xa3a405=_['some'](_0x1f3533);if(_0xa3a405){return _0x1c47fe(_0xa3a405);}else{_0x5d50af[_0x5573('0x6a')]=_0x131291?utils[_0x5573('0x65')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x5573('0x65')][_0x5573('0x9d')];return _0x4c9f6f(msgResponse(_0x5573('0x9e'),'Failure','Global:\x20'+_0x131291+'\x20'+_0x22e5fe+_0x5573('0x9f')+util[_0x5573('0x43')](_0x334c31,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x29c0d));}})[_0x5573('0x9a')](function(_0x1a0c34){return _0x4c9f6f(msgResponse(_0x5573('0x8e'),_0x5573('0x8f'),JSON[_0x5573('0x71')](_0x1a0c34)));});});};Dialer[_0x5573('0x80')]['loopCampaigns']=function(){var _0x404265=this;return cmHopper[_0x5573('0xa0')]({'active':![]},{'where':{'active':!![]}})[_0x5573('0x97')](function(){setInterval(function(){_0x404265[_0x5573('0xa1')]();},0x3e8);});};Dialer[_0x5573('0x80')][_0x5573('0xa1')]=function(){var _0x5baf53=this;var _0x47c9bc;for(var _0x1ad2b2 in this[_0x5573('0x1d')]){if(typeof this[_0x5573('0x1d')][_0x1ad2b2]!==_0x5573('0xa2')){_0x47c9bc=this[_0x5573('0x1d')][_0x1ad2b2];if(utils[_0x5573('0x7a')](_0x47c9bc)&&utils['isIVRCampaignActive'](_0x47c9bc)){_0x47c9bc['sendMessageOneNotActive']=!![];Promise[_0x5573('0xa3')]()[_0x5573('0x97')](checkIsIVRCampaignActive(_0x47c9bc))[_0x5573('0x97')](checkInterval(_0x47c9bc))['then'](_0x5baf53[_0x5573('0x86')](_0x47c9bc))[_0x5573('0x97')](_0x5baf53[_0x5573('0x8b')](_0x47c9bc['dialGlobalInterval'],_0x47c9bc[_0x5573('0xa4')],_0x47c9bc['name'],_0x47c9bc))['then'](_0x5baf53[_0x5573('0x8d')](_0x47c9bc[_0x5573('0x73')],_0x47c9bc[_0x5573('0xa4')],_0x47c9bc[_0x5573('0x46')],_0x47c9bc))[_0x5573('0x97')](_0x5baf53[_0x5573('0xa5')](_0x47c9bc))[_0x5573('0x9a')](loggerCatchQueueSummary(_0x5573('0xa6'),_0x47c9bc));}else{notSendMessagesCampaign(_0x47c9bc);}}}};Dialer[_0x5573('0x80')][_0x5573('0xa7')]=function(_0x3f63fd){if(_0x3f63fd['dialMethod']!=='predictive'){clearPredictiveAttributes(_0x3f63fd);}switch(_0x3f63fd['dialMethod']){case _0x5573('0xa8'):this['handlePower'](_0x3f63fd,0x1);break;case'power':this['handlePower'](_0x3f63fd,_0x3f63fd[_0x5573('0xa9')]);break;case _0x5573('0x6'):this[_0x5573('0x6')](_0x3f63fd);break;case'booked':this['handlePower'](_0x3f63fd,0x1);break;default:logger[_0x5573('0x63')](_0x5573('0xaa'),_0x3f63fd['name'],'method\x20not\x20recognized');}};Dialer[_0x5573('0x80')]['ifTime']=function(_0x17c27a,_0x45c1b7){var _0x1bbf77=_0x17c27a[_0x5573('0xa4')];var _0x28af2e=_0x45c1b7?_0x17c27a[_0x5573('0xab')]:_0x17c27a[_0x5573('0x73')][_0x5573('0x74')];logger[_0x5573('0xac')](_0x5573('0xad'),_0x28af2e,_0x1bbf77,_0x17c27a[_0x5573('0x46')],util['format'](_0x5573('0xae'),_0x17c27a[_0x5573('0x46')],_0x17c27a['id']));var _0x3f9c72=null;return Interval[_0x5573('0xaf')](_0x28af2e,_0x1bbf77)['then'](function(_0xf5c499){if(_0xf5c499===!![]){return _0xf5c499;}else{_0x17c27a[_0x5573('0x6a')]=_0x45c1b7?utils[_0x5573('0x65')][_0x5573('0xb0')]:utils[_0x5573('0x65')][_0x5573('0x9d')];_0x3f9c72=msgResponse('[ifTime][promiseAll]',_0x5573('0x8f'),'Global:\x20'+_0x45c1b7+'\x20'+_0x17c27a['name']+_0x5573('0x9f')+util['inspect'](_0x28af2e,{'showHidden':![],'depth':null})+_0x5573('0xb1')+_0x1bbf77);}if(_0x3f9c72!==null){logger[_0x5573('0xac')](_0x5573('0xb2'),_0x3f9c72);_0x3f9c72[_0x5573('0xb3')]=_0x45c1b7;throw _0x3f9c72;}})[_0x5573('0x9a')](function(_0x3ccc60){logger[_0x5573('0x63')](_0x5573('0xb4'),_0x3ccc60);throw msgResponse(_0x5573('0xb5'),_0x5573('0x7f'),util['inspect'](_0x3ccc60,{'showHidden':![],'depth':null}));});};Dialer['prototype']['syncAgentConnect']=function(_0x271b7b){if(this['voiceQueues'][_0x271b7b[_0x5573('0xb6')]]){if(this[_0x5573('0x24')][_0x271b7b[_0x5573('0xb7')]]&&this[_0x5573('0x24')][_0x271b7b[_0x5573('0xb7')]][_0x5573('0x3f')]!==_0x5573('0xb8')){utils[_0x5573('0xb9')](this[_0x5573('0x1c')][_0x271b7b[_0x5573('0xb6')]],_0x5573('0xba'));this[_0x5573('0x24')][_0x271b7b[_0x5573('0xb7')]][_0x5573('0xbb')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x5573('0x80')][_0x5573('0x2f')]=function(_0x5c598e){var _0x2cd227=this['uniqueId'][_0x5c598e[_0x5573('0xb7')]];if(this[_0x5573('0x1c')][_0x5c598e[_0x5573('0xb6')]]){if(_0x2cd227&&_0x2cd227[_0x5573('0x3f')]!=='ivr'){delete this[_0x5573('0x24')][_0x5c598e[_0x5573('0xb7')]];this[_0x5573('0x1c')][_0x5c598e[_0x5573('0xb6')]][_0x5573('0xbc')]+=0x1;var _0x1446bd=new AgentComplete(_0x2cd227,_0x5c598e);if(_0x5c598e[_0x5573('0xbd')]===_0x5573('0xbe')){_0x1446bd[_0x5573('0xbf')]=this[_0x5573('0x1c')][_0x5c598e[_0x5573('0xb6')]][_0x5573('0xc0')]&&this[_0x5573('0x1c')][_0x5c598e[_0x5573('0xb6')]][_0x5573('0xc1')]?moment()[_0x5573('0x44')](_0x5573('0xc2')):undefined;}hopperUtils[_0x5573('0xc3')](_0x1446bd)[_0x5573('0x9a')](loggerCatch(_0x5573('0xc4')));hopperUtils['moveContactManagedDialer'](_0x1446bd)['catch'](loggerCatch(_0x5573('0xc5')));}}};Dialer[_0x5573('0x80')][_0x5573('0xc6')]=function(_0x3fb84a){var _0x308ec0=this[_0x5573('0x24')][_0x3fb84a['uniqueid']];var _0x5ccc65=this;var _0x2469ac=![];var _0x2607c1;var _0x360101;if(this[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]]){if(_0x308ec0&&_0x308ec0[_0x5573('0x3f')]!==_0x5573('0xb8')){delete this[_0x5573('0x24')][_0x3fb84a[_0x5573('0xb7')]];utils[_0x5573('0xb9')](this[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]],_0x5573('0xc7'));_0x308ec0[_0x5573('0xc8')]=moment()[_0x5573('0x44')](_0x5573('0xc2'));var _0xd4288=new QueueCallerAbandon(_0x308ec0,_0x3fb84a);if(utils[_0x5573('0x5f')](_0x308ec0[_0x5573('0xc8')],_0x308ec0[_0x5573('0xc9')])>=_0x308ec0[_0x5573('0xca')]){this[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]][_0x5573('0xcb')]+=0x1;this[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]][_0x5573('0xcc')]+=0x1;this[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]][_0x5573('0xcd')]+=0x1;_0xd4288[_0x5573('0x6b')]=0xa;_0xd4288[_0x5573('0x6c')]=_0x5573('0xce');_0xd4288[_0x5573('0xcf')]=_0x5573('0xd0');_0xd4288[_0x5573('0xbf')]=this[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]][_0x5573('0xc0')]?moment()[_0x5573('0x44')](_0x5573('0xc2')):undefined;_0xd4288[_0x5573('0xd1')]+=0x1;_0xd4288[_0x5573('0xd2')]+=0x1;_0x2607c1=this[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]]['dialDropRetryFrequency'];_0x360101=this[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]][_0x5573('0xd3')];hopperUtils[_0x5573('0xd4')](_0xd4288,_0xd4288[_0x5573('0x6b')],_0x308ec0[_0x5573('0xd5')])['then'](function(_0x30676e){_0x2469ac=_0x30676e[_0x5573('0xd6')]==0x1;if(_0xd4288['countdropretry']>=_0x5ccc65[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]]['dialDropMaxRetry']){_0x5ccc65[_0x5573('0xd7')](_0xd4288,_0x30676e[_0x5573('0xd6')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0xd4288[_0x5573('0xd1')],'scheduledat':moment()['add'](_0x5ccc65[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]][_0x5573('0xd8')],_0x5573('0xd9'))['format'](_0x5573('0xc2')),'ContactId':_0x308ec0['ContactId'],'ListId':_0x308ec0[_0x5573('0xda')],'VoiceQueueId':_0x308ec0['VoiceQueueId']||undefined,'CampaignId':_0x308ec0[_0x5573('0xdb')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x323f7a=new History(_0xd4288);_0x323f7a['state']=0xa;_0x323f7a[_0x5573('0x6c')]='Drop';_0x323f7a[_0x5573('0x6e')]=moment()[_0x5573('0x44')](_0x5573('0xc2'));_0x323f7a['endtime']=_0x323f7a[_0x5573('0x6e')];_0x323f7a[_0x5573('0xdc')]=_0xd4288[_0x5573('0xdc')];_0x323f7a['calleridnum']=_0xd4288[_0x5573('0xdd')];hopperUtils['createHistory'](_0x323f7a)[_0x5573('0x9a')](loggerCatch(_0x5573('0xde')));}})[_0x5573('0x97')](function(){if(_0x2469ac)hopperUtils[_0x5573('0xdf')](_0xd4288,_0x2607c1,_0x360101)[_0x5573('0x97')](function(){return 0x1;});});}else{this[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]][_0x5573('0x4f')]+=0x1;this['voiceQueues'][_0x3fb84a[_0x5573('0xb6')]]['outboundDropCallsDayCallersExit']+=0x1;_0xd4288[_0x5573('0x6b')]=0xb;_0xd4288[_0x5573('0x6c')]=_0x5573('0xe0');_0xd4288[_0x5573('0xcf')]=_0x5573('0xe1');_0xd4288['countabandonedretry']+=0x1;_0xd4288[_0x5573('0xd2')]+=0x1;_0x2607c1=this[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]][_0x5573('0xe2')];_0x360101=this['voiceQueues'][_0x3fb84a[_0x5573('0xb6')]][_0x5573('0xd3')];hopperUtils[_0x5573('0xd4')](_0xd4288,_0xd4288[_0x5573('0x6b')],_0x308ec0['voiceQueue'])['then'](function(_0x1cf83e){if(_0xd4288[_0x5573('0xe3')]>=_0x5ccc65[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]]['dialAbandonedMaxRetry']){_0x5ccc65[_0x5573('0xd7')](_0xd4288,_0x1cf83e[_0x5573('0xd6')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0xd4288[_0x5573('0xe3')],'scheduledat':moment()[_0x5573('0xe4')](_0x5ccc65[_0x5573('0x1c')][_0x3fb84a[_0x5573('0xb6')]]['dialAbandonedRetryFrequency'],_0x5573('0xd9'))[_0x5573('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x308ec0['ContactId'],'ListId':_0x308ec0['ListId'],'VoiceQueueId':_0x308ec0[_0x5573('0xe5')]||undefined,'CampaignId':_0x308ec0[_0x5573('0xdb')]||undefined})[_0x5573('0x9a')](loggerCatch(_0x5573('0xe6')));var _0xe78c37=new History(_0xd4288);_0xe78c37[_0x5573('0x6b')]=0xb;_0xe78c37[_0x5573('0x6c')]=_0x5573('0xe0');_0xe78c37[_0x5573('0x6e')]=moment()[_0x5573('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0xe78c37[_0x5573('0x6d')]=_0xe78c37[_0x5573('0x6e')];_0xe78c37['calleridname']=_0xd4288[_0x5573('0xdc')];_0xe78c37['calleridnum']=_0xd4288[_0x5573('0xdd')];hopperUtils[_0x5573('0xc3')](_0xe78c37)[_0x5573('0x9a')](loggerCatch(_0x5573('0xe7')));}})[_0x5573('0x97')](function(){if(_0x2469ac)hopperUtils[_0x5573('0xdf')](_0xd4288,_0x2607c1,_0x360101)[_0x5573('0x97')](function(){return 0x1;});});}}}};Dialer[_0x5573('0x80')][_0x5573('0x34')]=function(_0x2dd843){if(this[_0x5573('0x22')][_0x2dd843['uniqueid']]){this[_0x5573('0x22')][_0x2dd843[_0x5573('0xb7')]][_0x5573('0xe8')]=_0x2dd843[_0x5573('0xe8')];}if(this['uniqueId'][_0x2dd843[_0x5573('0xb7')]]){this[_0x5573('0x24')][_0x2dd843[_0x5573('0xb7')]][_0x5573('0xe8')]=_0x2dd843[_0x5573('0xe8')];}};Dialer[_0x5573('0x80')]['syncQueueMember']=function(_0x532563){if(!this[_0x5573('0x22')][_0x532563[_0x5573('0xe9')]]){return;}var _0x2dc78d=this[_0x5573('0x1c')][this[_0x5573('0x22')][_0x532563[_0x5573('0xe9')]]['queue']]['strategy']||_0x5573('0xea');if(_0x2dc78d===_0x5573('0xeb')){if(this[_0x5573('0x22')][_0x532563[_0x5573('0xe9')]]&&_['isNil'](this['actions'][_0x532563[_0x5573('0xe9')]]['locked'])&&_0x532563[_0x5573('0x83')]==='1'&&_0x532563['paused']==='0'){if(this[_0x5573('0x1e')][_0x532563[_0x5573('0xec')]]){if(!this[_0x5573('0x1e')][_0x532563[_0x5573('0xec')]][_0x5573('0xed')]){this['agents'][_0x532563[_0x5573('0xec')]][_0x5573('0xed')]=!![];this['actions'][_0x532563[_0x5573('0xe9')]][_0x5573('0xed')]=!![];this[_0x5573('0x22')][_0x532563[_0x5573('0xe9')]][_0x5573('0xec')]=_0x532563['stateinterface'];}}}}else if(_0x2dc78d===_0x5573('0xea')){if(this[_0x5573('0x22')][_0x532563[_0x5573('0xe9')]]){if(this[_0x5573('0x1e')][_0x532563[_0x5573('0xec')]]){this['actions'][_0x532563[_0x5573('0xe9')]][_0x5573('0xec')]=_0x532563[_0x5573('0xec')];if(_['isNil'](this[_0x5573('0x27')][this[_0x5573('0x22')][_0x532563['actionid']]['queue']])){this['queueBooked'][this['actions'][_0x532563[_0x5573('0xe9')]]['queue']]=[];}this[_0x5573('0x27')][this[_0x5573('0x22')][_0x532563['actionid']][_0x5573('0xb6')]][_0x5573('0x93')](_[_0x5573('0x5e')](_[_0x5573('0x72')](this[_0x5573('0x22')][_0x532563[_0x5573('0xe9')]],['idHopper',_0x5573('0xec')]),{'status':_0x532563[_0x5573('0x83')],'paused':_0x532563[_0x5573('0xee')]}));}}}};Dialer['prototype']['syncQueueStatusComplete']=function(_0x3a8e22){if(!this[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]]){return;}var _0x250ddf=this;var _0x2d50be=this['voiceQueues'][this[_0x5573('0x22')][_0x3a8e22['actionid']]['queue']];var _0xfa9710=_0x2d50be[_0x5573('0xef')]||_0x5573('0xea');if(_0xfa9710===_0x5573('0xeb')){if(this[_0x5573('0x22')][_0x3a8e22['actionid']]&&this[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]][_0x5573('0xec')]){this['preview']['run'](this[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]]['idHopper'],this[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]][_0x5573('0xec')])[_0x5573('0x9a')](function(_0x48273a){logger[_0x5573('0x63')](_0x5573('0xf0'),util[_0x5573('0x43')](_0x48273a,{'showHidden':![],'depth':null}));})[_0x5573('0x1a')](function(){utils['decrementOriginate'](_0x250ddf[_0x5573('0x1c')][_0x250ddf['actions'][_0x3a8e22[_0x5573('0xe9')]][_0x5573('0xb6')]],_0x5573('0xf1'));_0x250ddf[_0x5573('0x1e')][_0x250ddf['actions'][_0x3a8e22[_0x5573('0xe9')]][_0x5573('0xec')]][_0x5573('0xed')]=![];delete _0x250ddf['actions'][_0x3a8e22['actionid']];unlockQueueStatus(_0x2d50be);});}else{utils[_0x5573('0xb9')](this['voiceQueues'][this[_0x5573('0x22')][_0x3a8e22['actionid']][_0x5573('0xb6')]],'[syncQueueStatusComplete]');hopperUtils[_0x5573('0xf2')]({'active':![],'ContactId':this['actions'][_0x3a8e22[_0x5573('0xe9')]][_0x5573('0xf3')],'ListId':this[_0x5573('0x22')][_0x3a8e22['actionid']][_0x5573('0xda')],'VoiceQueueId':this[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]][_0x5573('0xdb')]||undefined})[_0x5573('0x9a')](loggerCatch(_0x5573('0xf4')));delete this[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]];unlockQueueStatus(_0x2d50be);}}else if(_0xfa9710==='rrmemory'){var _0x470774;if(this['actions'][_0x3a8e22[_0x5573('0xe9')]]&&!_[_0x5573('0x76')](this[_0x5573('0x27')][this[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]][_0x5573('0xb6')]])){if(this[_0x5573('0x28')][_0x250ddf[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]][_0x5573('0xb6')]]){this[_0x5573('0x28')][_0x250ddf[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]][_0x5573('0xb6')]]=this[_0x5573('0x28')][this[_0x5573('0x22')][_0x3a8e22['actionid']][_0x5573('0xb6')]]?this[_0x5573('0x28')][this['actions'][_0x3a8e22['actionid']][_0x5573('0xb6')]]:this[_0x5573('0x27')][this[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]][_0x5573('0xb6')]]?this[_0x5573('0x27')][this[_0x5573('0x22')][_0x3a8e22['actionid']][_0x5573('0xb6')]][_0x5573('0xf5')]||0x0:0x0;}this[_0x5573('0x27')][this[_0x5573('0x22')][_0x3a8e22[_0x5573('0xe9')]][_0x5573('0xb6')]][_0x5573('0xf5')]=this[_0x5573('0x28')][this['actions'][_0x3a8e22['actionid']][_0x5573('0xb6')]];for(var _0x4bd058=0x0;_0x4bd058=_0x10eee5[_0x5573('0x11e')]){_0x3ff1fd[_0x5573('0x11f')](_0x2ef50f,_0x1083bd,_0x57c978,_0x5573('0x120'));}else{if(_0x2ef50f[_0x5573('0x117')]>=_0x10eee5['dialMachineMaxRetry']){_0x3ff1fd['createStateFinal'](_0x2ef50f,_0x1083bd,_0x57c978,_0x5573('0x121'));}else{hopperUtils[_0x5573('0xf2')]({'active':![],'countmachineretry':_0x2ef50f[_0x5573('0x117')],'scheduledat':moment()[_0x5573('0xe4')](_0x10eee5['dialMachineRetryFrequency'],'minutes')[_0x5573('0x44')](_0x5573('0xc2')),'ContactId':_0x2ef50f[_0x5573('0xf3')],'ListId':_0x2ef50f[_0x5573('0xda')],'VoiceQueueId':_0x2ef50f['VoiceQueueId']||undefined,'CampaignId':_0x2ef50f['CampaignId']||undefined})['catch'](loggerCatch(_0x5573('0x122')));_0x1083bd({'reschedule':0x1});}}});}if(_0x7fad7a[_0x5573('0x3f')]===_0x5573('0xb8')&&this['campaigns'][_0x7fad7a[_0x5573('0xb6')]][_0x5573('0x112')]&&_0x3a7002[_0x5573('0x113')]===_0x5573('0x109')){delete this[_0x5573('0x24')][_0x3a7002[_0x5573('0xb7')]];utils[_0x5573('0xb9')](this[_0x5573('0x1d')][_0x7fad7a[_0x5573('0xb6')]],'[syncVarSet]');_0x5d225d=new Hangup(_0x7fad7a,_0x3a7002);_0x5d225d[_0x5573('0x6b')]=0x12;_0x5d225d[_0x5573('0x6c')]='HangupInAMD';_0x5d225d[_0x5573('0x10b')]='AMD';ami[_0x5573('0x3e')](_0x5573('0x10d'),ut[_0x5573('0x118')](_0x5d225d,_0x5573('0x10e')));this[_0x5573('0x10f')](_0x5d225d,'[syncHangupInAMDIvr][createHistory]',_0x5573('0x123'));}if(_0x7fad7a[_0x5573('0x3f')]===_0x5573('0xb8')&&this[_0x5573('0x1d')][_0x7fad7a['queue']][_0x5573('0x112')]&&_0x3a7002[_0x5573('0x113')]===_0x5573('0x114')){return new Promise(function(_0x539d37,_0x39ce9c){delete _0x3ff1fd[_0x5573('0x24')][_0x3a7002[_0x5573('0xb7')]];utils['decrementOriginate'](_0x3ff1fd[_0x5573('0x1d')][_0x7fad7a[_0x5573('0xb6')]],_0x5573('0x115'));_0x3ff1fd[_0x5573('0x1d')][_0x7fad7a[_0x5573('0xb6')]][_0x5573('0xbc')]+=0x1;_0x3ff1fd['campaigns'][_0x7fad7a[_0x5573('0xb6')]][_0x5573('0x10a')]+=0x1;var _0x3f781f=_0x3ff1fd[_0x5573('0x1d')][_0x7fad7a[_0x5573('0xb6')]];var _0x385a47=new Hangup(_0x7fad7a,_0x3a7002);_0x385a47[_0x5573('0x6b')]=0x13;_0x385a47['statedesc']=_0x5573('0x116');_0x385a47[_0x5573('0x10b')]=_0x5573('0x10c');_0x385a47[_0x5573('0x117')]+=0x1;_0x385a47[_0x5573('0xd2')]+=0x1;_0x385a47[_0x5573('0x10e')]=!![];ami[_0x5573('0x3e')](_0x5573('0x10d'),ut[_0x5573('0x118')](_0x385a47,_0x5573('0x10e')));hopperUtils[_0x5573('0xc3')](_0x385a47)[_0x5573('0x9a')](loggerCatch(_0x5573('0x124')));if(_0x385a47[_0x5573('0x119')]+_0x385a47[_0x5573('0x11a')]+_0x385a47[_0x5573('0x11b')]+_0x385a47[_0x5573('0x11c')]+_0x385a47[_0x5573('0xd1')]+_0x385a47[_0x5573('0xe3')]+_0x385a47[_0x5573('0x117')]+_0x385a47[_0x5573('0x11d')]>=_0x3f781f[_0x5573('0x11e')]){_0x3ff1fd[_0x5573('0x11f')](_0x385a47,_0x539d37,_0x39ce9c,'reason19\x20machine....');}else{if(_0x385a47[_0x5573('0x117')]>=_0x3f781f['dialMachineMaxRetry']){_0x3ff1fd[_0x5573('0x125')](_0x385a47,_0x539d37,_0x39ce9c,_0x5573('0x121'));}else{hopperUtils[_0x5573('0xf2')]({'active':![],'countmachineretry':_0x385a47[_0x5573('0x117')],'scheduledat':moment()['add'](_0x3f781f[_0x5573('0x126')],'minutes')['format'](_0x5573('0xc2')),'ContactId':_0x385a47['ContactId'],'ListId':_0x385a47[_0x5573('0xda')],'VoiceQueueId':_0x385a47[_0x5573('0xe5')]||undefined,'CampaignId':_0x385a47[_0x5573('0xdb')]||undefined})[_0x5573('0x9a')](loggerCatch(_0x5573('0x122')));_0x539d37({'reschedule':0x1});}}});}}};Dialer[_0x5573('0x80')][_0x5573('0x33')]=function(_0x58e14a){var _0x58400f=this['uniqueId'][_0x58e14a[_0x5573('0xb7')]];var _0x30b6c4;if(!_0x58400f){return;}if(_0x58400f['type']==='ivr'){delete this['uniqueId'][_0x58e14a[_0x5573('0xb7')]];utils[_0x5573('0xb9')](this[_0x5573('0x1d')][_0x58400f['queue']],_0x5573('0x127'));this[_0x5573('0x1d')][_0x58400f[_0x5573('0xb6')]][_0x5573('0x128')]+=0x1;if(_0x58e14a['cause-txt']===_0x5573('0x129')){const _0x3924dd=new AgentComplete(_0x58400f,_0x58e14a);_0x3924dd[_0x5573('0xdb')]=this[_0x5573('0x1d')][_0x58400f['queue']]['id'];hopperUtils[_0x5573('0xc3')](_0x3924dd)[_0x5573('0x9a')](loggerCatch(_0x5573('0x12a')));hopperUtils[_0x5573('0x12b')](_0x3924dd)['catch'](loggerCatch(_0x5573('0x12c')));}else{_0x30b6c4=new Hangup(_0x58400f,_0x58e14a);hopperUtils[_0x5573('0xc3')](_0x30b6c4)[_0x5573('0x9a')](loggerCatch(_0x5573('0x12d')));hopperUtils[_0x5573('0x12b')](_0x30b6c4)[_0x5573('0x9a')](loggerCatch(_0x5573('0x12e')));}}else{if(isNotNull(this['voiceQueues'][_0x58400f[_0x5573('0xb6')]][_0x5573('0x12f')])){delete this['uniqueId'][_0x58e14a[_0x5573('0xb7')]];utils['decrementOriginate'](this['voiceQueues'][_0x58400f[_0x5573('0xb6')]],_0x5573('0x127'));this['voiceQueues'][_0x58400f[_0x5573('0xb6')]][_0x5573('0xbc')]+=0x1;this[_0x5573('0x1c')][_0x58400f[_0x5573('0xb6')]][_0x5573('0x10a')]+=0x1;_0x30b6c4=new Hangup(_0x58400f,_0x58e14a);_0x30b6c4[_0x5573('0x6b')]=0x10;_0x30b6c4[_0x5573('0x6c')]='AnswerAGI';_0x30b6c4['membername']=_0x5573('0x130');hopperUtils[_0x5573('0xc3')](_0x30b6c4)[_0x5573('0x9a')](loggerCatch(_0x5573('0x12d')));hopperUtils[_0x5573('0x12b')](_0x30b6c4)[_0x5573('0x9a')](loggerCatch('[syncHangupIvr]'));}else{delete this[_0x5573('0x24')][_0x58e14a['uniqueid']];utils[_0x5573('0xb9')](this[_0x5573('0x1c')][_0x58400f[_0x5573('0xb6')]],'[syncHangup2]');if(_0x58e14a[_0x5573('0x131')]==='Normal\x20Clearing'){this[_0x5573('0x1c')][_0x58400f[_0x5573('0xb6')]]['outboundAnswerCallsDay']+=0x1;const _0x2ab1f4=new AgentComplete(_0x58400f,_0x58e14a);_0x2ab1f4[_0x5573('0xe5')]=this[_0x5573('0x1c')][_0x58400f[_0x5573('0xb6')]]['id'];hopperUtils['createHistory'](_0x2ab1f4)[_0x5573('0x9a')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x5573('0x12b')](_0x2ab1f4)['catch'](loggerCatch(_0x5573('0xc5')));}else{this['voiceQueues'][_0x58400f[_0x5573('0xb6')]][_0x5573('0x132')]+=0x1;_0x30b6c4=new Hangup(_0x58400f,_0x58e14a);_0x30b6c4[_0x5573('0x6b')]=0xc;_0x30b6c4[_0x5573('0x6c')]=_0x58e14a[_0x5573('0x131')];_0x30b6c4[_0x5573('0x10b')]='Unknown';hopperUtils[_0x5573('0xc3')](_0x30b6c4)[_0x5573('0x9a')](loggerCatch('[syncHangup][createHistory]'));hopperUtils[_0x5573('0x12b')](_0x30b6c4)['catch'](loggerCatch('[syncHangup]'));}}}};Dialer[_0x5573('0x80')][_0x5573('0x8')]=function(_0x1ed661){var _0x137604=this;if(!_0x137604[_0x5573('0x29')][_0x1ed661[_0x5573('0x46')]]){_0x137604[_0x5573('0x29')][_0x1ed661[_0x5573('0x46')]]={'running':![]};}else if(_0x137604['queuesSummary'][_0x1ed661[_0x5573('0x46')]][_0x5573('0x133')]===!![]){return;}else if(_0x137604[_0x5573('0x29')][_0x1ed661[_0x5573('0x46')]][_0x5573('0x133')]===![]){_0x137604[_0x5573('0x29')][_0x1ed661[_0x5573('0x46')]][_0x5573('0x133')]=!![];}var _0x1f9271=_0x137604['voiceQueues'][_0x1ed661[_0x5573('0x46')]];var _0x3a53c1=_0x1f9271[_0x5573('0x6a')]!==utils['CAMPAIGN_STATUS'][_0x5573('0x78')];var _0x207acb=utils[_0x5573('0x134')](_0x1f9271);_0x1f9271['statusMessage']=utils[_0x5573('0x135')](_0x1f9271,_0x137604['trunks']);Promise[_0x5573('0xa3')]()[_0x5573('0x97')](function(){if(_0x1f9271[_0x5573('0x136')]===utils[_0x5573('0x65')][_0x5573('0x78')]){if(_0x3a53c1){clearPredictiveAttributes(_0x1f9271);_0x1ed661[_0x5573('0x26')]=undefined;_0x1ed661[_0x5573('0x60')]=undefined;}if(_0x1f9271[_0x5573('0x136')]===utils['CAMPAIGN_STATUS'][_0x5573('0x78')]){_0x1ed661[_0x5573('0x137')]=0x0;_0x1ed661[_0x5573('0xee')]=0x0;_0x1ed661[_0x5573('0x138')]=0x0;_0x1ed661[_0x5573('0x139')]=0x0;_0x1ed661[_0x5573('0x13a')]=0x0;}}else if(_0x1f9271['statusMessage']===utils['CAMPAIGN_STATUS']['ACTIVE']&&!_0x207acb){return _0x137604['ifTime'](_0x1f9271,!![])[_0x5573('0x97')](function(){return _0x137604[_0x5573('0x8e')](_0x1f9271,![]);})[_0x5573('0x97')](function(){return _0x137604[_0x5573('0xa7')](_0x1f9271);})[_0x5573('0x9a')](function(_0x5c03e1){loggerSyncQueueSummary['debug'](_0x5573('0x13b'),util[_0x5573('0x43')](_0x5c03e1,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1f9271);});}else{clearPredictiveAttributes(_0x1f9271);}})[_0x5573('0x97')](function(){var _0x34026e=_0x1ed661['compareToOutboundQueue'](_0x1f9271);if(_0x34026e||_0x1f9271[_0x5573('0x13c')]){_0x1f9271[_0x5573('0x13c')]=![];_0x1ed661['updateReportFromOutboundQueue'](_0x1f9271);Object[_0x5573('0x13d')](_0x1f9271,_0x1ed661);emitOutboundVoiceQueueSummary(_0x1ed661);}_0x137604[_0x5573('0x29')][_0x1f9271[_0x5573('0x46')]][_0x5573('0x133')]=![];})[_0x5573('0x9a')](function(_0x593521){logger[_0x5573('0x63')](_0x5573('0x13b'),util[_0x5573('0x43')](_0x593521,{'showHidden':![],'depth':null}));_0x137604[_0x5573('0x29')][_0x1f9271[_0x5573('0x46')]][_0x5573('0x133')]=![];});};Dialer[_0x5573('0x80')][_0x5573('0x13e')]=_['throttle'](function(){var _0x3b2d18=_[_0x5573('0x13f')](this[_0x5573('0x1c')],function(_0x2bbc35){return _0x2bbc35['dialPreviewRecallmeReminder'];});var _0x4c4a35=_[_0x5573('0x13f')](this[_0x5573('0x1e')],function(_0x29f2dc){return _0x29f2dc['online']&&_0x29f2dc[_0x5573('0x83')]===_0x5573('0x84');});if(_0x3b2d18[_0x5573('0x92')]>0x0&&_0x4c4a35[_0x5573('0x92')]>0x0){return Promise[_0x5573('0xa3')]()[_0x5573('0x97')](cmHopper[_0x5573('0x140')](_[_0x5573('0x141')](_0x3b2d18,'id'),previewRecallmeReminderInterval,_[_0x5573('0x141')](_0x4c4a35,'id')))[_0x5573('0x97')](function(_0x144e59){for(var _0x1e1e72=0x0;_0x1e1e72<_0x144e59[_0x5573('0x92')];_0x1e1e72++){var _0x1f35e3=_0x144e59[_0x1e1e72][_0x5573('0x142')]['name'];if(_0x1f35e3)io['to'](util[_0x5573('0x44')](_0x5573('0x143'),_0x1f35e3))['emit'](_0x5573('0x144'),{'hopper':_0x144e59[_0x1e1e72]});}})[_0x5573('0x9a')](function(_0x32d75d){logger[_0x5573('0x63')](_0x5573('0x145'),_0x32d75d);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype']['loopClearZombieChannels']=function(){var _0x5330c6=this;setInterval(function(){_0x5330c6[_0x5573('0x146')](_0x5330c6[_0x5573('0x24')],_0x5573('0x147'));_0x5330c6[_0x5573('0x146')](_0x5330c6[_0x5573('0x22')],_0x5573('0x148'));},0x32c8);};Dialer[_0x5573('0x80')][_0x5573('0x146')]=function(_0x464ed2,_0x5b0ced){var _0x50e911=this;for(var _0x35f4d2 in _0x464ed2){if(typeof _0x464ed2[_0x35f4d2]!==_0x5573('0xa2')){this[_0x5573('0x149')][_0x5573('0x18')](function(){if(!_[_0x5573('0xf6')](_0x464ed2[_0x35f4d2])){return ami[_0x5573('0x94')]({'action':_0x5573('0x83'),'channel':_0x464ed2[_0x35f4d2][_0x5573('0xe8')]})[_0x5573('0x9a')](function(_0x3f7013){if(_0x3f7013[_0x5573('0x6a')]===_0x5573('0x14a')){setTimeout(function(){if(_0x464ed2[_0x35f4d2]&&_0x464ed2[_0x35f4d2][_0x5573('0x3f')]!==_0x5573('0xb8')){utils[_0x5573('0xb9')](_0x50e911[_0x5573('0x1c')][_0x464ed2[_0x35f4d2]['queue']],_0x5573('0x14b'));logger[_0x5573('0x63')]('[Dialer][checkChannel]',_0x5b0ced,_0x35f4d2,_0x464ed2[_0x35f4d2][_0x5573('0xb6')]);delete _0x464ed2[_0x35f4d2];}if(_0x464ed2[_0x35f4d2]&&_0x464ed2[_0x35f4d2][_0x5573('0x3f')]==='ivr'){utils[_0x5573('0xb9')](_0x50e911[_0x5573('0x1d')][_0x464ed2[_0x35f4d2]['queue']],'[clearZombieChannels]');logger[_0x5573('0x63')](_0x5573('0x14c'),_0x5b0ced,_0x35f4d2,_0x464ed2[_0x35f4d2]['queue']);delete _0x464ed2[_0x35f4d2];}},0x2328);}});}});}}};Dialer[_0x5573('0x80')][_0x5573('0x14d')]=function(_0x4cbc94){return Promise[_0x5573('0xa3')]()[_0x5573('0x97')](voiceQueueRt['getVoiceQueueRtPauses'](_0x4cbc94))[_0x5573('0x9a')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x5573('0x80')]['emptyContact']=function(_0x3965fd,_0x346e8c,_0x3365d4){var _0x1e9556={'state':0x19,'statedesc':_0x5573('0x14e')};utils[_0x5573('0xb9')](_0x346e8c,_0x5573('0x14f')+_0x3965fd);this[_0x5573('0x10f')](_[_0x5573('0x5e')](_0x1e9556,_[_0x5573('0x72')](_0x3365d4,[_0x5573('0xf3'),_0x5573('0xda'),_0x5573('0x150'),_0x5573('0xe5'),_0x5573('0xdb')])),'[emptyContact][createHistory]',_0x5573('0x14f'));logger['error'](_0x3965fd);};Dialer[_0x5573('0x80')][_0x5573('0x10f')]=function(_0x4bda37,_0x2ce8ca,_0x2e9120){hopperUtils[_0x5573('0xc3')](_0x4bda37)[_0x5573('0x9a')](loggerCatch(_0x2ce8ca));hopperUtils[_0x5573('0x12b')](_0x4bda37)['catch'](loggerCatch(_0x2e9120));};Dialer['prototype'][_0x5573('0xd7')]=function(_0x347347,_0x75c315){hopperUtils[_0x5573('0xc3')](_0x347347)['catch'](loggerCatch(_0x5573('0xc4')));if(_0x75c315==0x0){hopperUtils[_0x5573('0x12b')](_0x347347)['catch'](loggerCatch(_0x5573('0x151')));}};Dialer[_0x5573('0x80')]['checkPreviewRecallReminder']=function(_0x2f3523){return Promise['resolve']()['then'](cmHopper['handlePreviewRecallNotifications'](_0x2f3523['id'],previewRecallmeReminderInterval))['then'](function(_0x452bf9){for(var _0x84a24c=0x0;_0x84a24c<_0x452bf9[_0x5573('0x92')];_0x84a24c++){var _0x2cb31e=_0x452bf9[_0x84a24c][_0x5573('0x142')][_0x5573('0x46')];if(_0x2cb31e)io['to'](util[_0x5573('0x44')]('user:%s',_0x2cb31e))[_0x5573('0x3e')](_0x5573('0x144'),{'hopper':_0x452bf9[_0x84a24c]});}})['catch'](function(){});};Dialer[_0x5573('0x80')]['launchHandleIvr']=function(_0x2285e3){var _0x365173=this;return function(){_0x365173[_0x5573('0x152')](_0x2285e3);};};Dialer[_0x5573('0x80')][_0x5573('0x153')]=function(_0x4a9c7d,_0xcc82e9){var _0xd4a547=this;var _0x1c236b=uuid['v4']();this[_0x5573('0x22')][_0x1c236b]=new Action(_0x4a9c7d,_0xcc82e9,_0x1c236b);return new Promise(function(_0x47d1c2,_0x4fcf3f){if(_[_0x5573('0x3d')](_0x4a9c7d)&&typeof _0x4a9c7d!==_0x5573('0x154')){return _0x4fcf3f(msgResponse(_0x5573('0x155'),_0x5573('0x8f'),_0x5573('0x156')));}if(_[_0x5573('0x3d')](_0xcc82e9[_0x5573('0x157')])||_0xcc82e9[_0x5573('0x157')]===null){return _0x4fcf3f(msgResponse('originate',_0x5573('0x8f'),_0x5573('0x158')));}var _0x3fa347={'XMD-CALLERID':_0xd4a547[_0x5573('0x22')][_0x1c236b][_0x5573('0x159')](),'XMD-AGI':_0x4a9c7d[_0x5573('0x12f')]?util[_0x5573('0x44')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4a9c7d[_0x5573('0x12f')]):_0x5573('0x15a'),'XMD-AGIAFTER':_0x4a9c7d['dialQueueProject2']?util['format'](_0x5573('0x15b'),ipAgi,_0x4a9c7d[_0x5573('0xc0')]):'NONE','XMD-QUEUE':utils['isOutboundQueue'](_0x4a9c7d)?util[_0x5573('0x44')](_0x5573('0x15c'),_0x4a9c7d[_0x5573('0x46')],_0x4a9c7d[_0x5573('0x15d')]||'',_0x4a9c7d['dialAgiAfterHangupAgent']?'c':'',_0x4a9c7d[_0x5573('0xca')]||0x3):_0x5573('0x15a'),'XMD-CONTACTID':_0xcc82e9[_0x5573('0xf3')],'XMD-CDRTYPE':_0x5573('0x5'),'CALLERID(all)':_0xd4a547['actions'][_0x1c236b][_0x5573('0x159')](),'XMD-AMD':_0x4a9c7d[_0x5573('0x112')]?_0x5573('0x15e'):_0x5573('0x15a'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x4a9c7d[_0x5573('0x112')]){_0x3fa347[_0x5573('0x15f')]=_0x4a9c7d['dialAMDInitialSilence']||0x9c4;_0x3fa347[_0x5573('0x160')]=_0x4a9c7d[_0x5573('0x161')]||0x5dc;_0x3fa347['XMD-AMDAFTERGREETINGSILENCE']=_0x4a9c7d[_0x5573('0x162')]||0x320;_0x3fa347['XMD-AMDTOTALANALYSISTIME']=_0x4a9c7d['dialAMDTotalAnalysisTime']||0x1388;_0x3fa347[_0x5573('0x163')]=_0x4a9c7d['dialAMDMinWordLength']||0x64;_0x3fa347['XMD-AMDBETWEENWORDSSILENCE']=_0x4a9c7d[_0x5573('0x164')]||0x32;_0x3fa347[_0x5573('0x165')]=_0x4a9c7d[_0x5573('0x166')]||0x3;_0x3fa347[_0x5573('0x167')]=_0x4a9c7d[_0x5573('0x168')]||0x100;_0x3fa347[_0x5573('0x169')]=_0x4a9c7d[_0x5573('0x16a')]||0x1388;}if(utils['isOutboundQueue'](_0x4a9c7d)){_0x3fa347[_0x5573('0x16b')]=_0xcc82e9['VoiceQueueId'];}else{_0x3fa347['XMD-CAMPAIGNID']=_0xcc82e9['CampaignId'];}var _0x275385=utils[_0x5573('0x16c')](_0xcc82e9[_0x5573('0x16d')]);Object['assign'](_0x3fa347,_0x275385);var _0x36d847=_0xd4a547[_0x5573('0x87')](_0x4a9c7d[_0x5573('0x88')])?utils[_0x5573('0x16e')](_0x4a9c7d['Trunk'][_0x5573('0x16f')],_0x4a9c7d[_0x5573('0x170')],_0x4a9c7d['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x5573('0x171')](_0x4a9c7d['dialOriginateCallerIdNumber'],_0x4a9c7d['dialRandomLastDigitCallerIdNumber']):_0x4a9c7d[_0x5573('0x172')]):utils[_0x5573('0x16e')](_[_0x5573('0xf6')](_0x4a9c7d['TrunkBackup'])?_0x4a9c7d[_0x5573('0x88')][_0x5573('0x16f')]:_0x4a9c7d['TrunkBackup'][_0x5573('0x16f')],_0x4a9c7d['dialOriginateCallerIdName'],_0x4a9c7d['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x5573('0x171')](_0x4a9c7d[_0x5573('0x172')],_0x4a9c7d[_0x5573('0x173')]):_0x4a9c7d[_0x5573('0x172')]);if(_0x36d847){_0x3fa347[_0x5573('0x174')]=_0xd4a547[_0x5573('0x22')][_0x1c236b][_0x5573('0x175')]=utils[_0x5573('0x176')](_0x36d847);_0x3fa347['XMD-ORIGINATECALLERIDNUM']=_0xcc82e9['phone'];}_0x4a9c7d[_0x5573('0x177')]=_0x3fa347;return ami[_0x5573('0x94')]({'actionid':_0x1c236b,'action':_0x5573('0x155'),'channel':_0xd4a547[_0x5573('0x87')](_0x4a9c7d['Trunk'])?util[_0x5573('0x44')]('SIP/%s/%s%s',_0x4a9c7d[_0x5573('0x88')][_0x5573('0x46')],isNotNull(_0x4a9c7d[_0x5573('0x178')])?_0x4a9c7d[_0x5573('0x178')][_0x5573('0x179')]()||'':'',_0x4a9c7d[_0x5573('0x17a')]>0x0?_0xcc82e9['phone']['substring'](_0x4a9c7d[_0x5573('0x17a')]):_0xcc82e9[_0x5573('0x157')]):util[_0x5573('0x44')]('SIP/%s/%s%s',_['isNil'](_0x4a9c7d[_0x5573('0x17b')])?_0x4a9c7d['Trunk'][_0x5573('0x46')]:_0x4a9c7d[_0x5573('0x17b')][_0x5573('0x46')],isNotNull(_0x4a9c7d[_0x5573('0x178')])?_0x4a9c7d[_0x5573('0x178')][_0x5573('0x179')]()||'':'',_0x4a9c7d['dialCutDigit']>0x0?_0xcc82e9[_0x5573('0x157')][_0x5573('0x17c')](_0x4a9c7d['dialCutDigit']):_0xcc82e9['phone']),'callerid':_0x36d847,'Exten':_0x5573('0x108'),'Context':'from-sip','Priority':'1','variable':_0x3fa347,'timeout':(_0x4a9c7d['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1c236b})[_0x5573('0x97')](function(_0x30f4e5){return _0x47d1c2(_0x30f4e5);})[_0x5573('0x9a')](function(_0x5580ea){_0x4a9c7d[_0x5573('0x17d')]+=0x1;var _0x1b0ead=new History(_0xd4a547[_0x5573('0x22')][_0x1c236b]);logger[_0x5573('0x63')](util[_0x5573('0x44')](_0x5573('0x17e'),JSON['stringify'](_0x5580ea)));_0x1b0ead[_0x5573('0x6b')]=0xe;_0x1b0ead[_0x5573('0x6c')]=_0x5573('0x17f');_0x1b0ead[_0x5573('0x6e')]=moment()['format'](_0x5573('0xc2'));_0x1b0ead[_0x5573('0x6d')]=_0x1b0ead[_0x5573('0x6e')];hopperUtils[_0x5573('0xc3')](_0x1b0ead)[_0x5573('0x9a')](loggerCatch(_0x5573('0x180')));_0xd4a547['moveContactManagedDialer'](_0x1b0ead)[_0x5573('0x9a')](loggerCatch(_0x5573('0x180')))[_0x5573('0x1a')](function(){delete _0xd4a547[_0x5573('0x22')][_0x1c236b];return _0x4fcf3f(msgResponse(_0x5573('0x155'),_0x5573('0x7f'),'originate\x20action\x20Error'));});});});};Dialer[_0x5573('0x80')][_0x5573('0x181')]=function(_0x1d90a8,_0x4258c6,_0xfadb40){var _0xe46ad2=new History(_0x4258c6);if(_0xe46ad2[_0x5573('0x119')]+_0xe46ad2['countcongestionretry']+_0xe46ad2[_0x5573('0x11b')]+_0xe46ad2[_0x5573('0x11c')]+_0xe46ad2[_0x5573('0xd1')]+_0xe46ad2[_0x5573('0xe3')]+_0xe46ad2[_0x5573('0x117')]+_0xe46ad2[_0x5573('0x11d')]>=_0xfadb40[_0x5573('0x11e')]-0x1){return!![];}switch(_0x1d90a8){case 0x3:if(_0xe46ad2[_0x5573('0x11b')]>=_0xfadb40[_0x5573('0x182')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0xe46ad2[_0x5573('0x11b')]+=0x1,'scheduledat':moment()[_0x5573('0xe4')](_0xfadb40[_0x5573('0x183')],_0x5573('0xd9'))[_0x5573('0x44')](_0x5573('0xc2')),'ContactId':_0xe46ad2[_0x5573('0xf3')],'ListId':_0xe46ad2[_0x5573('0xda')],'VoiceQueueId':_0xe46ad2[_0x5573('0xe5')]||undefined,'CampaignId':_0xe46ad2[_0x5573('0xdb')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0xe46ad2[_0x5573('0x119')]>=_0xfadb40['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x5573('0xf2')]({'active':![],'countbusyretry':_0xe46ad2[_0x5573('0x119')]+=0x1,'scheduledat':moment()[_0x5573('0xe4')](_0xfadb40['dialBusyRetryFrequency'],_0x5573('0xd9'))[_0x5573('0x44')](_0x5573('0xc2')),'ContactId':_0xe46ad2[_0x5573('0xf3')],'ListId':_0xe46ad2[_0x5573('0xda')],'VoiceQueueId':_0xe46ad2[_0x5573('0xe5')]||undefined,'CampaignId':_0xe46ad2[_0x5573('0xdb')]||undefined})[_0x5573('0x9a')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0xe46ad2['countcongestionretry']>=_0xfadb40['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x5573('0xf2')]({'active':![],'countcongestionretry':_0xe46ad2[_0x5573('0x11a')]+=0x1,'scheduledat':moment()[_0x5573('0xe4')](_0xfadb40[_0x5573('0x184')],_0x5573('0xd9'))[_0x5573('0x44')](_0x5573('0xc2')),'ContactId':_0xe46ad2[_0x5573('0xf3')],'ListId':_0xe46ad2[_0x5573('0xda')],'VoiceQueueId':_0xe46ad2[_0x5573('0xe5')]||undefined,'CampaignId':_0xe46ad2['CampaignId']||undefined})['catch'](loggerCatch(_0x5573('0x185')));break;case 0x0:if(_0xe46ad2[_0x5573('0x11c')]>=_0xfadb40['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x5573('0xf2')]({'active':![],'countnosuchnumberretry':_0xe46ad2[_0x5573('0x11c')]+=0x1,'scheduledat':moment()[_0x5573('0xe4')](_0xfadb40['dialNoSuchNumberRetryFrequency'],_0x5573('0xd9'))[_0x5573('0x44')](_0x5573('0xc2')),'ContactId':_0xe46ad2[_0x5573('0xf3')],'ListId':_0xe46ad2['ListId'],'VoiceQueueId':_0xe46ad2[_0x5573('0xe5')]||undefined,'CampaignId':_0xe46ad2[_0x5573('0xdb')]||undefined})[_0x5573('0x9a')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0xe46ad2['countdropretry']>=_0xfadb40['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x5573('0xf2')]({'active':![],'countdropretry':_0xe46ad2[_0x5573('0xd1')]+=0x1,'scheduledat':moment()[_0x5573('0xe4')](_0xfadb40[_0x5573('0xd8')],'minutes')[_0x5573('0x44')](_0x5573('0xc2')),'ContactId':_0xe46ad2[_0x5573('0xf3')],'ListId':_0xe46ad2[_0x5573('0xda')],'VoiceQueueId':_0xe46ad2[_0x5573('0xe5')]||undefined,'CampaignId':_0xe46ad2['CampaignId']||undefined})[_0x5573('0x9a')](loggerCatch(_0x5573('0x186')));break;case 0xb:if(_0xe46ad2[_0x5573('0xe3')]>=_0xfadb40[_0x5573('0x187')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0xe46ad2['countabandonedretry']+=0x1,'scheduledat':moment()[_0x5573('0xe4')](_0xfadb40[_0x5573('0xe2')],_0x5573('0xd9'))['format'](_0x5573('0xc2')),'ContactId':_0xe46ad2[_0x5573('0xf3')],'ListId':_0xe46ad2[_0x5573('0xda')],'VoiceQueueId':_0xe46ad2[_0x5573('0xe5')]||undefined,'CampaignId':_0xe46ad2[_0x5573('0xdb')]||undefined})[_0x5573('0x9a')](loggerCatch(_0x5573('0xe6')));break;case 0x13:if(_0xe46ad2[_0x5573('0x117')]>=_0xfadb40[_0x5573('0x188')]-0x1){return!![];}hopperUtils[_0x5573('0xf2')]({'active':![],'countmachineretry':_0xe46ad2[_0x5573('0x117')]+=0x1,'scheduledat':moment()[_0x5573('0xe4')](_0xfadb40[_0x5573('0x126')],'minutes')[_0x5573('0x44')](_0x5573('0xc2')),'ContactId':_0xe46ad2['ContactId'],'ListId':_0xe46ad2[_0x5573('0xda')],'VoiceQueueId':_0xe46ad2[_0x5573('0xe5')]||undefined,'CampaignId':_0xe46ad2[_0x5573('0xdb')]||undefined})[_0x5573('0x9a')](loggerCatch(_0x5573('0x122')));break;case 0x14:if(_0xe46ad2[_0x5573('0x11d')]>=_0xfadb40['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0xe46ad2[_0x5573('0x11d')]+=0x1,'scheduledat':moment()[_0x5573('0xe4')](_0xfadb40[_0x5573('0x189')],_0x5573('0xd9'))[_0x5573('0x44')](_0x5573('0xc2')),'ContactId':_0xe46ad2[_0x5573('0xf3')],'ListId':_0xe46ad2[_0x5573('0xda')],'VoiceQueueId':_0xe46ad2[_0x5573('0xe5')]||undefined,'CampaignId':_0xe46ad2['CampaignId']||undefined})[_0x5573('0x9a')](loggerCatch(_0x5573('0x18a')));break;default:return!![];}};Dialer['prototype'][_0x5573('0x18b')]=function(_0x1f820f,_0x10e90f,_0x40c992){var _0x5d19df=this;var _0x369419=new History(_0x1f820f);var _0x1fcaf7=![];var _0x412a4c;var _0x270e5f;return new Promise(function(_0x225825,_0x3d42ed){if(_[_0x5573('0x3d')](_0x10e90f)&&typeof _0x10e90f!==_0x5573('0x154')){return _0x3d42ed(msgResponse(_0x5573('0x18c'),_0x5573('0x8f'),'entity\x20is\x20undefine'));}if(_[_0x5573('0x3d')](_0x40c992)&&typeof _0x40c992!==_0x5573('0x154')){return _0x3d42ed(msgResponse(_0x5573('0x18c'),_0x5573('0x8f'),_0x5573('0x18d')));}hopperUtils[_0x5573('0xd4')](_0x369419,_0x40c992[_0x5573('0xbd')],_0x10e90f)[_0x5573('0x97')](function(_0x307556){if(_0x307556[_0x5573('0xd6')]==0x1)_0x1fcaf7=!![];switch(_0x40c992['reason']){case'0':_0x10e90f[_0x5573('0x18e')]+=0x1;_0x369419['state']=0x0;_0x369419[_0x5573('0x6c')]=_0x5573('0x18f');_0x369419[_0x5573('0x11c')]+=0x1;_0x369419[_0x5573('0xd2')]+=0x1;ami[_0x5573('0x3e')]('custom:agentnosuchnumber',ut['buildObj'](_0x1f820f,_0x5573('0x190')));_0x412a4c=_0x10e90f[_0x5573('0x191')];_0x270e5f=_0x10e90f[_0x5573('0xd3')];hopperUtils[_0x5573('0xc3')](_0x369419)[_0x5573('0x9a')](loggerCatch(_0x5573('0x124')));if(_0x5d19df[_0x5573('0x181')](0x0,_0x1f820f,_0x10e90f)&&!_0x1fcaf7){if(_0x369419['countnosuchnumberretry']>=_0x10e90f[_0x5573('0x192')]){_0x5d19df['createStateFinal'](_0x369419,_0x225825,_0x3d42ed,_0x5573('0x193'));}else{_0x5d19df[_0x5573('0x11f')](_0x369419,_0x225825,_0x3d42ed,_0x5573('0x193'));}}break;case'3':_0x10e90f[_0x5573('0x194')]+=0x1;_0x369419[_0x5573('0x6b')]=0x3;_0x369419[_0x5573('0x6c')]='NoAnswer';_0x369419[_0x5573('0x11b')]+=0x1;_0x369419[_0x5573('0xd2')]+=0x1;var _0x5e5f11=ut[_0x5573('0x195')](_0x1f820f,_0x10e90f);ami[_0x5573('0x3e')](_0x5573('0x196'),_0x5e5f11);_0x412a4c=_0x10e90f[_0x5573('0x183')];_0x270e5f=_0x10e90f[_0x5573('0xd3')];hopperUtils['createHistory'](_0x369419)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x5d19df[_0x5573('0x181')](0x3,_0x1f820f,_0x10e90f)&&!_0x1fcaf7){if(_0x369419['countnoanswerretry']>=_0x10e90f[_0x5573('0x182')]){_0x5d19df[_0x5573('0x125')](_0x369419,_0x225825,_0x3d42ed,_0x5573('0x197'));}else{_0x5d19df[_0x5573('0x11f')](_0x369419,_0x225825,_0x3d42ed,_0x5573('0x197'));}}break;case'5':_0x10e90f[_0x5573('0x198')]+=0x1;_0x369419[_0x5573('0x6b')]=0x5;_0x369419[_0x5573('0x6c')]='Busy';_0x369419[_0x5573('0x119')]+=0x1;_0x369419['countglobal']+=0x1;ami[_0x5573('0x3e')](_0x5573('0x199'),ut['buildObj'](_0x1f820f,_0x5573('0x19a')));_0x412a4c=_0x10e90f[_0x5573('0x19b')];_0x270e5f=_0x10e90f[_0x5573('0xd3')];hopperUtils[_0x5573('0xc3')](_0x369419)[_0x5573('0x9a')](loggerCatch(_0x5573('0x19c')));if(_0x5d19df[_0x5573('0x181')](0x5,_0x1f820f,_0x10e90f)&&!_0x1fcaf7){if(_0x369419[_0x5573('0x119')]>=_0x10e90f[_0x5573('0x19d')]){_0x5d19df[_0x5573('0x125')](_0x369419,_0x225825,_0x3d42ed,_0x5573('0x19e'));}else{_0x5d19df[_0x5573('0x11f')](_0x369419,_0x225825,_0x3d42ed,_0x5573('0x19e'));}}break;case'8':_0x10e90f[_0x5573('0x19f')]+=0x1;_0x369419['state']=0x8;_0x369419[_0x5573('0x6c')]=_0x5573('0x1a0');_0x369419[_0x5573('0x11a')]+=0x1;_0x369419[_0x5573('0xd2')]+=0x1;_0x412a4c=_0x10e90f[_0x5573('0x184')];_0x270e5f=_0x10e90f['callAdditionalPhoneAfterMin'];ami[_0x5573('0x3e')](_0x5573('0x1a1'),ut[_0x5573('0x118')](_0x1f820f,'congestion'));hopperUtils[_0x5573('0xc3')](_0x369419)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x5d19df[_0x5573('0x181')](0x8,_0x1f820f,_0x10e90f)&&!_0x1fcaf7){if(_0x369419[_0x5573('0x11a')]>=_0x10e90f['dialCongestionMaxRetry']){_0x5d19df[_0x5573('0x125')](_0x369419,_0x225825,_0x3d42ed,_0x5573('0x1a2'));}else{_0x5d19df[_0x5573('0x11f')](_0x369419,_0x225825,_0x3d42ed,_0x5573('0x1a2'));}}break;case'11':_0x10e90f['outboundAbandonedCallsDay']+=0x1;_0x369419[_0x5573('0x6b')]=0xb;_0x369419[_0x5573('0x6c')]=_0x5573('0xe0');_0x369419['countabandonedretry']+=0x1;_0x369419[_0x5573('0xd2')]+=0x1;_0x412a4c=_0x10e90f[_0x5573('0xe2')];_0x270e5f=_0x10e90f[_0x5573('0xd3')];hopperUtils[_0x5573('0xc3')](_0x369419)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x5d19df['checkRetriveMax'](0xb,_0x1f820f,_0x10e90f)&&!_0x1fcaf7){if(_0x369419[_0x5573('0xe3')]>=_0x10e90f[_0x5573('0x187')]){_0x5d19df[_0x5573('0x125')](_0x369419,_0x225825,_0x3d42ed,_0x5573('0x1a3'));}else{_0x5d19df[_0x5573('0x11f')](_0x369419,_0x225825,_0x3d42ed,'reason\x2011\x20abandoned');}}break;case'20':_0x10e90f[_0x5573('0x1a4')]+=0x1;_0x369419[_0x5573('0x6b')]=0x14;_0x369419['statedesc']=_0x5573('0x1a5');_0x369419[_0x5573('0x11d')]+=0x1;_0x369419['countglobal']+=0x1;_0x412a4c=_0x10e90f[_0x5573('0x189')];_0x270e5f=_0x10e90f[_0x5573('0xd3')];ami[_0x5573('0x3e')](_0x5573('0x1a6'),ut[_0x5573('0x118')](_0x1f820f,_0x5573('0x1a7')));hopperUtils[_0x5573('0xc3')](_0x369419)[_0x5573('0x9a')](loggerCatch(_0x5573('0x1a8')));if(_0x5d19df['checkRetriveMax'](0x14,_0x1f820f,_0x10e90f)&&!_0x1fcaf7){if(_0x369419['countagentrejectretry']>=_0x10e90f[_0x5573('0x1a9')]){_0x5d19df[_0x5573('0x125')](_0x369419,_0x225825,_0x3d42ed,_0x5573('0x1aa'));}else{_0x5d19df['stateGlobal'](_0x369419,_0x225825,_0x3d42ed,_0x5573('0x1aa'));}}break;default:_0x10e90f[_0x5573('0x132')]+=0x1;_0x369419['state']=0xc;_0x369419[_0x5573('0x6c')]=_0x40c992[_0x5573('0xbd')];_0x412a4c=_0x10e90f[_0x5573('0x189')];_0x270e5f=_0x10e90f[_0x5573('0xd3')];hopperUtils['createHistory'](_0x369419)[_0x5573('0x9a')](loggerCatch(_0x5573('0x1ab')));if(_0x5d19df[_0x5573('0x181')](_0x40c992['reason'],_0x1f820f,_0x10e90f)&&!_0x1fcaf7){if(_0x369419['countbusyretry']+_0x369419[_0x5573('0x11a')]+_0x369419['countnoanswerretry']+_0x369419[_0x5573('0x11c')]+_0x369419[_0x5573('0xd1')]+_0x369419[_0x5573('0xe3')]+_0x369419['countmachineretry']+_0x369419[_0x5573('0x11d')]>=_0x10e90f['dialGlobalMaxRetry']){_0x5d19df[_0x5573('0x11f')](_0x369419,_0x225825,_0x3d42ed,_0x40c992[_0x5573('0xbd')]);}else{_0x5d19df[_0x5573('0x125')](_0x369419,_0x225825,_0x3d42ed,_0x40c992[_0x5573('0xbd')]);}}}})[_0x5573('0x97')](function(){if(_0x1fcaf7){hopperUtils[_0x5573('0xdf')](_0x369419,_0x412a4c,_0x270e5f)['then'](function(){return _0x225825(0x1);});}});});};Dialer[_0x5573('0x80')][_0x5573('0x11f')]=function(_0x29e79d,_0x363efd,_0x125714,_0x5e3ad9){var _0x42808c=new Final(_0x29e79d);_0x42808c['state']=0xf;_0x42808c[_0x5573('0x6c')]=_0x5573('0x1ac');this[_0x5573('0x125')](_0x42808c,_0x363efd,_0x125714,_0x5e3ad9);};Dialer['prototype']['createStateFinal']=function(_0x3767e5,_0x296de2,_0x46a47f,_0x254297){hopperUtils['moveContactManagedDialer'](_0x3767e5)['then'](function(){return _0x296de2(msgResponse('[callProgressDetecting]',_0x5573('0x102'),_0x254297));})[_0x5573('0x9a')](function(){return _0x46a47f(msgResponse('[moveContactManagedDialer][0]',_0x5573('0x8f'),_0x5573('0x1ad')));});};Dialer[_0x5573('0x80')]['predictive']=function(_0x2f9539){var _0x151016=_0x2f9539[_0x5573('0x1ae')]/0x64;var _0x339310=_0x2f9539[_0x5573('0xcc')]/(_0x2f9539['outboundDropCallsDayTimeout']+_0x2f9539[_0x5573('0xbc')]);var _0x32ebc=Math[_0x5573('0x1af')](_0x2f9539['predictiveIntervalAvailable']*(_0x2f9539[_0x5573('0x1b0')]/0x64));var _0x122127=Math[_0x5573('0x1af')](_0x2f9539[_0x5573('0x1b1')]*(_0x2f9539['predictiveIntervalMinThreshold']/0x64));var _0x11ace6=_0x2f9539[_0x5573('0x137')]+_0x2f9539[_0x5573('0x139')];var _0x59d867=Math[_0x5573('0x1b2')](_0x2f9539[_0x5573('0x1b3')]*_0x2f9539[_0x5573('0x5c')]*_0x2f9539[_0x5573('0x1b4')]*_0x2f9539['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x2f9539[_0x5573('0x60')])){if(!_[_0x5573('0x3d')](_0x2f9539[_0x5573('0x26')])){_0x2f9539['startPredictive']=undefined;loggerPredictive[_0x5573('0x63')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x5573('0x3d')](_0x2f9539[_0x5573('0x62')])){loggerPredictive[_0x5573('0x63')](_0x5573('0x1b5'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x2f9539[_0x5573('0x62')]);_0x2f9539[_0x5573('0x62')]=undefined;}_0x2f9539[_0x5573('0x60')]=moment()[_0x5573('0x44')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x2f9539[_0x5573('0x46')],'collection\x20data\x20in\x20progressive\x20at',_0x2f9539['startProgressive']);this[_0x5573('0x1b6')](_0x2f9539,0x1);}else if(ifInterval(_0x2f9539['dialPredictiveInterval'],_0x2f9539['startProgressive'])){this[_0x5573('0x1b6')](_0x2f9539,0x1);loggerPredictiveCalls[_0x5573('0x48')](_0x5573('0x1b7'),_0x2f9539[_0x5573('0x60')],_0x2f9539[_0x5573('0x46')]);_0x2f9539[_0x5573('0x1b3')]=0x0;_0x2f9539[_0x5573('0xcd')]=0x0;}else if(_0x151016<_0x339310&&_0x2f9539[_0x5573('0x1b8')]===_0x5573('0x1b9')){clearPredictiveAttributes(_0x2f9539);loggerPredictive[_0x5573('0x48')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x5573('0x1ba'),_0x339310,_0x5573('0x60'),_0x2f9539['name']);}else if(_0x59d867<_0x2f9539[_0x5573('0xcd')]&&_0x2f9539['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x2f9539);loggerPredictive[_0x5573('0x48')](_0x5573('0x1bb'),_0x5573('0x1bc'),_0x59d867,_0x5573('0x1bd'),_0x2f9539[_0x5573('0xcd')],_0x5573('0x60'),_0x2f9539[_0x5573('0x46')]);}else if(!ifInterval(_0x2f9539[_0x5573('0x1be')],_0x2f9539['startProgressive'])&&_[_0x5573('0x3d')](_0x2f9539[_0x5573('0x26')])&&!_[_0x5573('0x3d')](_0x2f9539[_0x5573('0x60')])){_0x2f9539['startPredictive']=moment()['format'](_0x5573('0xc2'));loggerPredictive['info'](_0x2f9539['name'],_0x5573('0x1bf'),_0x2f9539[_0x5573('0x26')]);hopperUtils['avgHandleTime'](_0x2f9539['dialPredictiveInterval'])[_0x5573('0x97')](this[_0x5573('0x1c0')](_0x2f9539))[_0x5573('0x97')](mergeDataErlangB(_0x2f9539))['then'](this[_0x5573('0x1c1')](_0x2f9539))[_0x5573('0x9a')](loggerCatchPredictive(_0x5573('0x1c2'),_0x2f9539));}else if(!ifInterval(_0x2f9539['dialPredictiveInterval'],_0x2f9539['startPredictive'])){_0x2f9539[_0x5573('0xcd')]=0x0;_0x2f9539['startPredictive']=moment()[_0x5573('0x44')](_0x5573('0xc2'));loggerPredictive[_0x5573('0x48')](_0x2f9539[_0x5573('0x46')],_0x5573('0x1c3'),_0x2f9539[_0x5573('0x26')]);clearInterval(_0x2f9539[_0x5573('0x62')]);_0x2f9539[_0x5573('0x62')]=undefined;hopperUtils['avgHandleTime'](_0x2f9539[_0x5573('0x1be')])[_0x5573('0x97')](this[_0x5573('0x1c0')](_0x2f9539))[_0x5573('0x97')](mergeDataErlangB(_0x2f9539))[_0x5573('0x97')](this['startMethodPredictive'](_0x2f9539))[_0x5573('0x9a')](loggerCatchPredictive(_0x5573('0x1c4'),_0x2f9539));}else if(_0x2f9539['predictiveIntervalAvailable']&&_0x11ace6<_0x2f9539['predictiveIntervalAvailable']-_0x122127){clearPredictiveAttributes(_0x2f9539);loggerPredictive[_0x5573('0x48')](_0x2f9539[_0x5573('0x46')],_0x5573('0x1c5'),_0x11ace6,')\x20are\x20less\x20than\x20threshold\x20(',_0x2f9539[_0x5573('0x1b1')],'-',_0x122127,'=',_0x2f9539[_0x5573('0x1b1')]-_0x122127,')');}else if(_0x2f9539[_0x5573('0x1b1')]&&_0x11ace6>_0x2f9539['predictiveIntervalAvailable']+_0x32ebc){clearPredictiveAttributes(_0x2f9539);loggerPredictive[_0x5573('0x48')](_0x2f9539[_0x5573('0x46')],_0x5573('0x1c5'),_0x11ace6,_0x5573('0x1c6'),_0x2f9539[_0x5573('0x1b1')],'+',_0x32ebc,'=',_0x2f9539[_0x5573('0x1b1')]+_0x32ebc,')');}};Dialer[_0x5573('0x80')]['getDataPredictive']=function(_0x4744ad){var _0x5ab99c=this;return function(_0x36451d){return new Promise(function(_0x5280d7,_0xa10000){_[_0x5573('0x5e')](_0x4744ad,_0x36451d[0x0]);if(checkGetDataPredictive(_0x36451d[0x0])){var _0x3e21d9=_0x4744ad[_0x5573('0x1b1')]=_0x4744ad['talking']+_0x4744ad[_0x5573('0x137')];var _0x478923=_0x4744ad[_0x5573('0x1be')]*0x3c;var _0x22febf=_0x36451d[0x0]['predictiveIntervalAvgTalktime']+_0x36451d[0x0][_0x5573('0x51')];var _0x2b40a3=(_0x36451d[0x0][_0x5573('0x4d')]+_0x36451d[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x36451d[0x0][_0x5573('0x4f')])/_0x36451d[0x0][_0x5573('0x4b')];_0x4744ad[_0x5573('0x1b4')]=_0x2b40a3>0x0?_0x2b40a3:0x1;switch(_0x4744ad[_0x5573('0x1b8')]){case'dropRate':var _0x1b0fab=_0x4744ad['dialPredictiveOptimizationPercentage']/0x64;return _0x5ab99c['abandonmentRate'](_0x3e21d9,_0x478923,_0x22febf,_0x2b40a3,_0x1b0fab)[_0x5573('0x97')](function(_0x3df344){return _0x5280d7(_0x3df344);});case _0x5573('0x1c7'):var _0x1cb182=_0x4744ad[_0x5573('0x1ae')]/0x64;return _0x5ab99c['busyFactor'](_0x3e21d9,_0x478923,_0x22febf,_0x2b40a3,_0x1cb182)[_0x5573('0x97')](function(_0x577807){return _0x5280d7(_0x577807);});default:return _0xa10000(msgResponse(_0x5573('0x1c8'),'Failure','Unknown\x20Predictive'));}}else{return _0xa10000(msgResponse(_0x5573('0x1c8'),'Failure',_0x5573('0x1c9')));}});};};Dialer[_0x5573('0x80')][_0x5573('0x1ca')]=function(_0x59185a){var _0x56b460=this;return function(_0x3a625d){return new Promise(function(_0x11dac7,_0xaf96){_[_0x5573('0x5e')](_0x59185a,_0x3a625d[0x0]);if(checkGetDataPredictive(_0x3a625d[0x0])){loggerPredictive[_0x5573('0x48')](JSON['stringify'](_0x3a625d[0x0]));if(_0x59185a[_0x5573('0x1b8')]===_0x5573('0x1b9')){return _0x56b460[_0x5573('0x14d')](_0x59185a['id'])[_0x5573('0x97')](function(_0x3555f1){var _0x3dd3ea=_0x59185a['loggedIn']-_0x3555f1[0x0][_0x5573('0x1cb')];var _0x514c3a=_0x59185a['dialPredictiveInterval']*0x3c;var _0x5a82ac=_0x3a625d[0x0][_0x5573('0x54')]+_0x3a625d[0x0]['predictiveIntervalAvgHoldtime'];var _0x5b0b41=(_0x3a625d[0x0][_0x5573('0x4d')]+_0x3a625d[0x0][_0x5573('0xcb')]+_0x3a625d[0x0][_0x5573('0x4f')])/_0x3a625d[0x0][_0x5573('0x4b')];var _0x34ebad=_0x59185a['dialPredictiveOptimizationPercentage']/0x64;_0x59185a[_0x5573('0x1cc')]=_0x3555f1[0x0]['outboundQueuePauses']||0x0;_0x59185a[_0x5573('0x1b4')]=_0x5b0b41>0x0?_0x5b0b41:0x1;return _0x56b460[_0x5573('0x1cd')](_0x3dd3ea,_0x514c3a,_0x5a82ac,_0x5b0b41,_0x34ebad);})[_0x5573('0x97')](function(_0x4de4c2){return _0x11dac7(_0x4de4c2);})[_0x5573('0x9a')](function(_0x5e6099){return _0xaf96(msgResponse(_0x5573('0x1ce'),'Failure',JSON[_0x5573('0x71')](_0x5e6099)));});}if(_0x59185a['dialPredictiveOptimization']==='agentBusyFactor'){return _0x56b460[_0x5573('0x14d')](_0x59185a['id'])['then'](function(_0x1adec4){var _0x31219d=_0x59185a[_0x5573('0x1cf')]-_0x1adec4[0x0][_0x5573('0x1cb')];var _0x439b62=_0x59185a[_0x5573('0x1be')]*0x3c;var _0x1c3867=_0x3a625d[0x0]['predictiveIntervalAvgTalktime']+_0x3a625d[0x0]['predictiveIntervalAvgHoldtime'];var _0x56daa8=(_0x3a625d[0x0]['predictiveIntervalAnsweredCalls']+_0x3a625d[0x0][_0x5573('0xcb')]+_0x3a625d[0x0][_0x5573('0x4f')])/_0x3a625d[0x0][_0x5573('0x4b')];var _0x24e584=_0x59185a[_0x5573('0x1ae')]/0x64;_0x59185a[_0x5573('0x1cc')]=_0x1adec4[0x0][_0x5573('0x1cb')]||0x0;_0x59185a['predictiveIntervalHitRate']=_0x56daa8>0x0?_0x56daa8:0x1;return _0x56b460['busyFactor'](_0x31219d,_0x439b62,_0x1c3867,_0x56daa8,_0x24e584);})[_0x5573('0x97')](function(_0x128bcd){return _0x11dac7(_0x128bcd);})['catch'](function(_0xc390c4){return _0xaf96(msgResponse(_0x5573('0x1ce'),_0x5573('0x8f'),JSON[_0x5573('0x71')](_0xc390c4)));});}}else{return _0xaf96(msgResponse(_0x5573('0x1c8'),_0x5573('0x8f'),'check\x20failure'));}});};};Dialer[_0x5573('0x80')][_0x5573('0x1c1')]=function(_0x3298c8){var _0x1cc9c8=this;return function(){var _0x3e5371=0x0;var _0x5180c9=Math[_0x5573('0x1b2')](_0x3298c8[_0x5573('0x5a')]*0x3e8);if(_0x5180c9>0x0){_0x5180c9=_0x5180c9<0x64?0x64:_0x5180c9;loggerPredictive[_0x5573('0x48')](_0x3298c8['name'],_0x5573('0x1d0'),_0x5180c9,'milliseconds');_0x3298c8['handlePredictive']=setInterval(function(){_0x1cc9c8[_0x5573('0x62')](_0x3298c8);loggerPredictiveCalls['info'](_0x5573('0x1d1'),_0x3e5371+=0x1);},_0x5180c9);}else{loggerPredictive[_0x5573('0x48')](_0x3298c8[_0x5573('0x46')],_0x5573('0x1d2'));}};};Dialer[_0x5573('0x80')][_0x5573('0x1d3')]=function(_0x2a2980,_0x196a90){var _0x49fce6=this;return function(_0xd1b027){if(_[_0x5573('0x76')](_0xd1b027)){if(_['isNil'](_0x196a90['UserId'])||!_0x196a90[_0x5573('0x1d4')]){if(_0x2a2980[_0x5573('0x1d5')]===_0x5573('0x1d6')){_0x2a2980[_0x5573('0x6f')]=_[_0x5573('0x3d')](_0x2a2980[_0x5573('0x6f')])?!![]:_0x2a2980[_0x5573('0x6f')];var _0x53711a=uuid['v4']();_0x49fce6[_0x5573('0x22')][_0x53711a]=new Action(_0x2a2980,_0x196a90,_0x53711a);loggerBooked['info']('[booked][checkContactBlack]',_0x53711a,_0x5573('0x1d7'),JSON[_0x5573('0x71')](_0x2a2980['queueStatusComplete']),_0x5573('0x1d8'),_0x2a2980['name']);if(_0x2a2980['queueStatusComplete']){_0x2a2980['queueStatusComplete']=![];_0x49fce6[_0x5573('0x27')][_0x49fce6[_0x5573('0x22')][_0x53711a][_0x5573('0xb6')]]=[];ami[_0x5573('0x94')]({'actionid':_0x53711a,'action':_0x5573('0x1d9'),'queue':_0x2a2980[_0x5573('0x46')]})[_0x5573('0x9a')](function(){utils[_0x5573('0xb9')](_0x2a2980,_0x5573('0x1da'));hopperUtils[_0x5573('0xf2')]({'active':![],'ContactId':_0x49fce6[_0x5573('0x22')][_0x53711a][_0x5573('0xf3')],'ListId':_0x49fce6['actions'][_0x53711a][_0x5573('0xda')],'VoiceQueueId':_0x49fce6[_0x5573('0x22')][_0x53711a][_0x5573('0xe5')]||undefined,'CampaignId':_0x49fce6[_0x5573('0x22')][_0x53711a][_0x5573('0xdb')]||undefined})['catch'](loggerCatch(_0x5573('0x1db')));delete _0x49fce6[_0x5573('0x22')][_0x53711a];});}else{loggerBooked[_0x5573('0x48')](_0x5573('0x1dc'),JSON[_0x5573('0x71')](_0x2a2980[_0x5573('0x6f')]),'Queue:\x20',_0x2a2980['name']);utils[_0x5573('0xb9')](_0x2a2980,'[checkContactBlack]');hopperUtils[_0x5573('0xf2')]({'active':![],'ContactId':_0x49fce6[_0x5573('0x22')][_0x53711a][_0x5573('0xf3')],'ListId':_0x49fce6[_0x5573('0x22')][_0x53711a][_0x5573('0xda')],'VoiceQueueId':_0x49fce6['actions'][_0x53711a][_0x5573('0xe5')]||undefined,'CampaignId':_0x49fce6[_0x5573('0x22')][_0x53711a][_0x5573('0xdb')]||undefined})[_0x5573('0x9a')](loggerCatch(_0x5573('0x1db')));delete _0x49fce6['actions'][_0x53711a];}}else{return _0x49fce6[_0x5573('0x153')](_0x2a2980,_0x196a90);}}else{if(utils[_0x5573('0x5f')](undefined,_0x196a90[_0x5573('0x1dd')])<_0x2a2980[_0x5573('0x1de')]*0x3c){if(_0x196a90[_0x5573('0x142')]&&!_0x196a90[_0x5573('0x142')][_0x5573('0x1df')]){_0x49fce6['preview'][_0x5573('0xfb')](_0x196a90['id'])['finally'](function(){utils[_0x5573('0xb9')](_0x2a2980,_0x5573('0x1da'));});}else{hopperUtils[_0x5573('0x1e0')]({'active':![]},_0x196a90['id'],0x1)[_0x5573('0x1a')](function(){utils['decrementOriginate'](_0x2a2980,_0x5573('0x1da'));});}}else{_0x2a2980['outboundReCallsDay']+=0x1;utils[_0x5573('0xb9')](_0x2a2980,_0x5573('0x1da'));if(_0x2a2980[_0x5573('0x1e1')]){hopperUtils[_0x5573('0xf2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x196a90['ContactId'],'ListId':_0x196a90[_0x5573('0xda')],'VoiceQueueId':_0x196a90[_0x5573('0xe5')]||undefined,'CampaignId':_0x196a90[_0x5573('0xdb')]||undefined})[_0x5573('0x9a')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x5573('0xc3')](createObjHistory(_0x2a2980,_0x196a90,utils[_0x5573('0x65')]['QUEUE_RECALL'],0x17,_0x5573('0x1e2')))[_0x5573('0x9a')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x49fce6['saveInDb'](createObjHistory(_0x2a2980,_0x196a90,utils[_0x5573('0x65')][_0x5573('0x1e3')],0x16,_0x5573('0x1e4')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x2a2980[_0x5573('0x1e5')]+=0x1;_0x49fce6['saveInDb'](createObjHistory(_0x2a2980,_0x196a90,utils[_0x5573('0x65')][_0x5573('0x1e6')],0xd,'Blacklist'),_0x5573('0x1e7'),'[Originate][MoveBlacklist]');throw _0x5573('0x1e8');}};};Dialer['prototype']['handleIvr']=function(_0x541f38){var _0x22af25=this;var _0x44d4e6=_0x541f38['limitCalls']-_0x541f38[_0x5573('0x7d')];emitCampaignSummary(_0x541f38);if(_0x44d4e6>0x0&&_0x541f38['temp']==0x0){if(_0x44d4e6>this[_0x5573('0x20')]){_0x44d4e6=this['maxNumberOriginate'];}_0x541f38['temp']=0x1;hopperUtils[_0x5573('0x1e9')](_0x541f38,_0x44d4e6)[_0x5573('0x97')](function(_0x201d16){_0x541f38['temp']=0x0;if(_0x201d16){if(!utils[_0x5573('0x1ea')](_0x201d16)){_0x541f38['message']=utils[_0x5573('0x65')]['NO_AVAILABLE_CONTACTS'];logger[_0x5573('0x48')](_0x5573('0x1eb')+_0x541f38['name']);}else{_0x541f38[_0x5573('0x7d')]+=_0x201d16[_0x5573('0x92')];_0x541f38[_0x5573('0x6a')]=utils['CAMPAIGN_STATUS'][_0x5573('0x1ec')];for(var _0x125e52=0x0;_0x125e52<_0x201d16[_0x5573('0x92')];_0x125e52+=0x1){_0x541f38['ivrTotalCallsDays']+=0x1;if(_[_0x5573('0xf6')](_0x201d16[_0x125e52])||_['isNil'](_0x201d16[_0x125e52][_0x5573('0x16d')])||_[_0x5573('0xf6')](_0x201d16[_0x125e52][_0x5573('0x157')])){_0x22af25[_0x5573('0x1ed')](_0x5573('0x1ee'),_0x541f38,_0x201d16[_0x125e52]);}else{hopperUtils[_0x5573('0x1ef')](_[_0x5573('0x72')](_0x201d16[_0x125e52],['CampaignId',_0x5573('0x157')]))[_0x5573('0x97')](_0x22af25[_0x5573('0x1d3')](_0x541f38,_0x201d16[_0x125e52]))[_0x5573('0x9a')](function(_0x364608){logger[_0x5573('0x63')](_0x5573('0x1f0'),_0x364608);utils[_0x5573('0xb9')](_0x541f38,'[handleIvr]');});}}}}})[_0x5573('0x9a')](function(_0x3bd168){_0x541f38[_0x5573('0x1f1')]=0x0;logger[_0x5573('0x63')](_0x5573('0x1f2'),_0x3bd168);});}};Dialer[_0x5573('0x80')]['handlePower']=function(_0x1a34fa,_0x41e32c){var _0x577da5=this;var _0x1d453d=[];if(_0x41e32c<0x1||_0x1a34fa[_0x5573('0x1d5')]===_0x5573('0x1d6')){_0x41e32c=0x1;}var _0x32c7dc=Math[_0x5573('0x1b2')](_0x1a34fa['available']*_0x41e32c)-_0x1a34fa[_0x5573('0x7d')];if(_0x1a34fa[_0x5573('0x1f3')]>0x0){var _0x3d3542=_0x1a34fa['dialLimitQueue']-_0x1a34fa[_0x5573('0x7d')]-_0x1a34fa[_0x5573('0x139')]-_0x1a34fa[_0x5573('0x13a')];if(_0x32c7dc>_0x3d3542){_0x32c7dc=_0x3d3542;}}if(_0x32c7dc>0x0&&_0x1a34fa['temp']==0x0){if(_0x1a34fa[_0x5573('0x1d5')]==='booked'){_0x32c7dc=0x1;}if(_0x32c7dc>this[_0x5573('0x20')]){_0x32c7dc=this['maxNumberOriginate'];}for(var _0x445f53 in this[_0x5573('0x1e')]){if(typeof this[_0x5573('0x1e')][_0x445f53]!=='undefined'){if(this['agents'][_0x445f53][_0x5573('0x6b')]===_0x5573('0x1f4')&&this['agents'][_0x445f53][_0x5573('0x83')]==='reachable'){_0x1d453d[_0x5573('0x93')](this[_0x5573('0x1e')][_0x445f53]['id']);}}}_0x1a34fa[_0x5573('0x1f1')]=0x1;hopperUtils[_0x5573('0x1f5')](_0x1a34fa,_0x1d453d,_0x32c7dc)['then'](function(_0x360406){_0x1a34fa[_0x5573('0x1f1')]=0x0;if(_0x360406){if(!utils['checkContactEmpty'](_0x360406)){hopperUtils[_0x5573('0x1f6')](_0x1a34fa)['then'](sendMessageReschedule(_0x1a34fa))[_0x5573('0x9a')](loggerCatch(_0x5573('0x1f7')));}else{_0x1a34fa[_0x5573('0x7d')]+=_0x360406[_0x5573('0x92')];_0x1a34fa[_0x5573('0x6a')]=_0x1a34fa['dialMethod']==='booked'?utils[_0x5573('0x65')][_0x5573('0x15e')]:utils[_0x5573('0x65')][_0x5573('0x1ec')];for(var _0x132016=0x0;_0x132016<_0x360406['length'];_0x132016+=0x1){if(_[_0x5573('0xf6')](_0x360406[_0x132016])||_[_0x5573('0xf6')](_0x360406[_0x132016][_0x5573('0x16d')])||_[_0x5573('0xf6')](_0x360406[_0x132016][_0x5573('0x157')])){_0x577da5['emptyContact'](_0x5573('0x1ee'),_0x1a34fa,_0x360406[_0x132016]);}else{hopperUtils['checkIsBlackList'](_[_0x5573('0x72')](_0x360406[_0x132016],['VoiceQueueId',_0x5573('0x157')]))['then'](_0x577da5[_0x5573('0x1d3')](_0x1a34fa,_0x360406[_0x132016]))[_0x5573('0x9a')](function(_0x4fb485){logger['error']('[actionOriginate]',_0x4fb485);utils[_0x5573('0xb9')](_0x1a34fa,'[handlePower]');});}}}}})['catch'](function(_0x13f897){_0x1a34fa[_0x5573('0x1f1')]=0x0;logger[_0x5573('0x63')](_0x5573('0x1f2'),_0x13f897);});}};Dialer[_0x5573('0x80')][_0x5573('0x62')]=function(_0x30b570){if(_0x30b570[_0x5573('0x1f3')]>0x0){var _0x4c999a=_0x30b570['dialLimitQueue']-_0x30b570['originated']-_0x30b570[_0x5573('0x139')];if(_0x4c999a>0x0&&_0x30b570[_0x5573('0x1f1')]==0x0){this[_0x5573('0x1f8')](_0x30b570);}else{loggerPredictiveCalls[_0x5573('0x48')]('[handlePredictive][limitChannel]');}}else{this[_0x5573('0x1f8')](_0x30b570);}};Dialer[_0x5573('0x80')][_0x5573('0x1f8')]=function(_0x18b352){var _0x80a7bc=this;var _0x1d6d34=[];_0x18b352[_0x5573('0x7d')]+=0x1;for(var _0x4e4de3 in this[_0x5573('0x1e')]){if(typeof this[_0x5573('0x1e')][_0x4e4de3]!=='undefined'){if(this[_0x5573('0x1e')][_0x4e4de3][_0x5573('0x6b')]===_0x5573('0x1f4')&&this[_0x5573('0x1e')][_0x4e4de3]['status']===_0x5573('0x84')){_0x1d6d34[_0x5573('0x93')](this[_0x5573('0x1e')][_0x4e4de3]['id']);}}}_0x18b352[_0x5573('0x1f1')]=0x1;return this[_0x5573('0x1f5')](_0x18b352['id'],_0x1d6d34,0x1,_0x18b352[_0x5573('0x1f9')],_0x18b352)[_0x5573('0x97')](function(_0x437d98){_0x18b352[_0x5573('0x1f1')]=0x1;if(_0x437d98){if(!utils[_0x5573('0x1ea')](_0x437d98)){utils[_0x5573('0x1fa')](_0x18b352,0x1,0x0);return hopperUtils[_0x5573('0x1f6')](_0x18b352)[_0x5573('0x97')](sendMessageReschedule(_0x18b352))[_0x5573('0x9a')](loggerCatch('[countReScheduled]\x20'));}else{_0x18b352['message']=utils[_0x5573('0x65')][_0x5573('0x1ec')];if(_[_0x5573('0xf6')](_0x437d98[0x0])||_[_0x5573('0xf6')](_0x437d98[0x0]['Contact'])||_['isNil'](_0x437d98[0x0][_0x5573('0x157')])){_0x80a7bc[_0x5573('0x1ed')]('[actionOriginate]\x20',_0x18b352,_0x437d98[0x0]);}else{return hopperUtils[_0x5573('0x1fb')](_[_0x5573('0x72')](_0x437d98[0x0],[_0x5573('0xe5'),_0x5573('0x157')]))[_0x5573('0x97')](_0x80a7bc['checkContactBlack'](_0x18b352,_0x437d98[0x0]))[_0x5573('0x9a')](function(_0x47f9eb){logger[_0x5573('0x63')](_0x5573('0x1fc'),_0x47f9eb);utils[_0x5573('0xb9')](_0x18b352,'[actionOriginatePredictive]');});}}}})[_0x5573('0x9a')](function(_0xd092db){_0x18b352[_0x5573('0x1f1')]=0x0;logger[_0x5573('0x63')](_0x5573('0x1f2'),_0xd092db);});};Dialer[_0x5573('0x80')][_0x5573('0x1cd')]=function(_0x25a54c,_0x3a7f83,_0x3aeb60,_0x2b1d04,_0x15ce79,_0xbfaa88){loggerPredictive['info'](_0x5573('0x1fd'));loggerPredictive[_0x5573('0x48')]('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',_0x25a54c);loggerPredictive[_0x5573('0x48')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a7f83);loggerPredictive[_0x5573('0x48')](_0x5573('0x1fe'),_0x3aeb60);loggerPredictive['info'](_0x5573('0x1ff'),_0x2b1d04);loggerPredictive[_0x5573('0x48')](_0x5573('0x200'),_0x15ce79);loggerPredictive['info'](_0x5573('0x53'));return new Promise(function(_0x4a7492,_0x4b885a){if(_0x25a54c<=0x0||isNaN(_0x25a54c)){return _0x4b885a(msgResponse('[abandonmentRate]',_0x5573('0x7f'),_0x5573('0x201')+_0x25a54c));}if(_0x3aeb60<=0x0||isNaN(_0x3aeb60)){return _0x4b885a(msgResponse(_0x5573('0x202'),_0x5573('0x7f'),_0x5573('0x203')+_0x3aeb60));}if(_0x2b1d04<=0x0||isNaN(_0x2b1d04)){return _0x4b885a(msgResponse(_0x5573('0x202'),_0x5573('0x7f'),_0x5573('0x204')+_0x2b1d04));}if(_0x3a7f83<=0x0||isNaN(_0x3a7f83)){return _0x4b885a(msgResponse(_0x5573('0x202'),_0x5573('0x7f'),_0x5573('0x205')+_0x3a7f83));}if(_0x15ce79<=0x0||isNaN(_0x15ce79)){return _0x4b885a(msgResponse(_0x5573('0x202'),'Error','Amax\x20=\x20'+_0x15ce79));}_0xbfaa88=_0xbfaa88||0x0;var _0x7d687e=0x1/_0x3aeb60;var _0x53a61f=0x0;var _0x1fe152=0x0;var _0x529a92=0x0;var _0x527188=0x0;for(var _0x38f0e8=0x0;_0x529a92<_0x15ce79;_0x38f0e8+=0x1){_0x1fe152=_0x38f0e8/_0x3a7f83;_0x53a61f=(_0x2b1d04*_0x1fe152+_0xbfaa88)/_0x7d687e;_0x529a92=utils[_0x5573('0x206')](_0x53a61f,_0x25a54c);_0x527188=_0x53a61f/_0x25a54c*(0x1-utils[_0x5573('0x206')](_0x53a61f,_0x25a54c));}return _0x4a7492({'erlangCalls':_0x38f0e8,'erlangCallToSecond':_0x3a7f83/_0x38f0e8,'erlangAbandonmentRate':_0x529a92,'erlangBusyFactor':_0x527188});});};Dialer[_0x5573('0x80')]['busyFactor']=function(_0x5273f3,_0xd08948,_0x4e9593,_0x179d15,_0x29b6ff,_0x3a6b96){loggerPredictive['info'](_0x5573('0x207'));loggerPredictive[_0x5573('0x48')](_0x5573('0x208'),_0x5273f3);loggerPredictive[_0x5573('0x48')](_0x5573('0x209'),_0xd08948);loggerPredictive[_0x5573('0x48')](_0x5573('0x1fe'),_0x4e9593);loggerPredictive[_0x5573('0x48')](_0x5573('0x1ff'),_0x179d15);loggerPredictive[_0x5573('0x48')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x29b6ff);loggerPredictive[_0x5573('0x48')](_0x5573('0x53'));return new Promise(function(_0x3fa46e,_0x535023){if(_0x5273f3<=0x0||isNaN(_0x5273f3)){return _0x535023(msgResponse(_0x5573('0x20a'),_0x5573('0x7f'),'m\x20=\x20'+_0x5273f3));}if(_0x4e9593<=0x0||isNaN(_0x4e9593)){return _0x535023(msgResponse(_0x5573('0x20a'),_0x5573('0x7f'),'Ts\x20=\x20'+_0x4e9593));}if(_0x179d15<=0x0||isNaN(_0x179d15)){return _0x535023(msgResponse('[busyFactor]','Error',_0x5573('0x204')+_0x179d15));}if(_0xd08948<=0x0||isNaN(_0xd08948)){return _0x535023(msgResponse(_0x5573('0x20a'),_0x5573('0x7f'),'interval\x20=\x20'+_0xd08948));}if(_0x29b6ff<=0x0||isNaN(_0x29b6ff)){return _0x535023(msgResponse(_0x5573('0x20a'),_0x5573('0x7f'),_0x5573('0x20b')+_0x29b6ff));}_0x3a6b96=_0x3a6b96||0x0;var _0x319ed3=0x1/_0x4e9593;var _0x223f9d=0x0;var _0x397c7b=0x0;var _0x5e5219=0x0;var _0x78b4dd=0x0;for(var _0x1a9d49=0x0;_0x78b4dd<_0x29b6ff;_0x1a9d49+=0x1){_0x397c7b=_0x1a9d49/_0xd08948;_0x223f9d=(_0x179d15*_0x397c7b+_0x3a6b96)/_0x319ed3;_0x5e5219=utils[_0x5573('0x206')](_0x223f9d,_0x5273f3);_0x78b4dd=_0x223f9d/_0x5273f3*(0x1-utils[_0x5573('0x206')](_0x223f9d,_0x5273f3));}return _0x3fa46e({'erlangCalls':_0x1a9d49,'erlangCallToSecond':_0xd08948/_0x1a9d49,'erlangAbandonmentRate':_0x5e5219,'erlangBusyFactor':_0x78b4dd});});};module[_0x5573('0x20c')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 3afe03d..3cba02e 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2805=['\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','getQueue','exports','moment','isNil','string','uniqueid','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0x2805,0x1ea));var _0x5280=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x2805[_0x4ae829];return _0x256b31;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x5280('0x0'));function checkNameSurname(_0x5a1151,_0x365111,_0x67ee86){var _0x466840='';if(!_[_0x5280('0x1')](_0x365111)&&_0x5280('0x2')===typeof _0x365111){_0x466840+=_0x365111;}if(!_['isNil'](_0x67ee86)&&_0x5280('0x2')===typeof _0x67ee86){_0x466840+='\x20'+_0x67ee86;}if(_0x466840!==''){return _0x466840;}return _0x5a1151;}function Action(_0x20fa26,_0x43aa51,_0x223185){this['voiceQueue']=_0x20fa26;this[_0x5280('0x3')]=_0x223185||undefined;this[_0x5280('0x4')]=checkNameSurname(_0x43aa51[_0x5280('0x5')][_0x5280('0x6')],_0x43aa51[_0x5280('0x5')][_0x5280('0x7')],_0x43aa51['Contact'][_0x5280('0x8')]);this[_0x5280('0x9')]=_0x43aa51[_0x5280('0x6')];this['queue']=_0x20fa26[_0x5280('0x4')];this[_0x5280('0xa')]=_0x43aa51[_0x5280('0xa')]||![];this[_0x5280('0xb')]=_0x20fa26['type'];this[_0x5280('0xc')]=_0x20fa26[_0x5280('0xc')]||0x3;this[_0x5280('0xd')]=_0x43aa51[_0x5280('0xd')];this['countbusyretry']=_0x43aa51[_0x5280('0xe')];this[_0x5280('0xf')]=_0x43aa51['countcongestionretry'];this[_0x5280('0x10')]=_0x43aa51[_0x5280('0x10')];this[_0x5280('0x11')]=_0x43aa51[_0x5280('0x11')];this[_0x5280('0x12')]=_0x43aa51[_0x5280('0x12')];this[_0x5280('0x13')]=_0x43aa51[_0x5280('0x13')];this[_0x5280('0x14')]=_0x43aa51['countmachineretry'];this['countagentrejectretry']=_0x43aa51[_0x5280('0x15')];this['ContactId']=_0x43aa51['ContactId'];this[_0x5280('0x16')]=_0x43aa51['ListId'];this[_0x5280('0x17')]=_0x43aa51['UserId'];this[_0x5280('0x18')]=_0x43aa51[_0x5280('0x18')];this['CampaignId']=_0x43aa51[_0x5280('0x19')];this[_0x5280('0x1a')]=_0x43aa51['id'];this[_0x5280('0x1b')]=_0x43aa51['Contact'][_0x5280('0x7')]||'';this[_0x5280('0x1c')]=moment()[_0x5280('0x1d')](_0x5280('0x1e'));this[_0x5280('0x1f')]=_0x43aa51[_0x5280('0x1f')];this[_0x5280('0x20')]=_0x43aa51[_0x5280('0x20')];this['callbackat']=_0x43aa51[_0x5280('0x21')];this['recallme']=_0x43aa51[_0x5280('0x22')];this[_0x5280('0x23')]='';this['originatecalleridname']='';}Action[_0x5280('0x24')][_0x5280('0x25')]=function(){return util[_0x5280('0x1d')](_0x5280('0x26'),this[_0x5280('0x4')],this[_0x5280('0x27')][_0x5280('0x28')]>0x0?this[_0x5280('0x9')][_0x5280('0x29')](this['voiceQueue'][_0x5280('0x28')]):this[_0x5280('0x9')]);};Action['prototype'][_0x5280('0x2a')]=function(){return this['queue'];};module[_0x5280('0x2b')]=Action; \ No newline at end of file +var _0x16e2=['\x22%s\x22\x20<%s>','dialCutDigit','substring','number','getQueue','exports','util','isNil','string','voiceQueue','uniqueid','name','phone','Contact','firstName','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller'];(function(_0x483d2b,_0x4a18d7){var _0x37524d=function(_0x544a03){while(--_0x544a03){_0x483d2b['push'](_0x483d2b['shift']());}};_0x37524d(++_0x4a18d7);}(_0x16e2,0x13a));var _0x216e=function(_0x1628c4,_0xf5244a){_0x1628c4=_0x1628c4-0x0;var _0xb4a5af=_0x16e2[_0x1628c4];return _0xb4a5af;};'use strict';var util=require(_0x216e('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x402155,_0x1e4abc,_0x54abcb){var _0x2db3b4='';if(!_[_0x216e('0x1')](_0x1e4abc)&&_0x216e('0x2')===typeof _0x1e4abc){_0x2db3b4+=_0x1e4abc;}if(!_[_0x216e('0x1')](_0x54abcb)&&_0x216e('0x2')===typeof _0x54abcb){_0x2db3b4+='\x20'+_0x54abcb;}if(_0x2db3b4!==''){return _0x2db3b4;}return _0x402155;}function Action(_0x4ea7f3,_0x202257,_0x3de8ee){this[_0x216e('0x3')]=_0x4ea7f3;this[_0x216e('0x4')]=_0x3de8ee||undefined;this[_0x216e('0x5')]=checkNameSurname(_0x202257['Contact'][_0x216e('0x6')],_0x202257[_0x216e('0x7')][_0x216e('0x8')],_0x202257[_0x216e('0x7')][_0x216e('0x9')]);this['number']=_0x202257['phone'];this[_0x216e('0xa')]=_0x4ea7f3[_0x216e('0x5')];this[_0x216e('0xb')]=_0x202257[_0x216e('0xb')]||![];this[_0x216e('0xc')]=_0x4ea7f3[_0x216e('0xc')];this[_0x216e('0xd')]=_0x4ea7f3[_0x216e('0xd')]||0x3;this[_0x216e('0xe')]=_0x202257[_0x216e('0xe')];this[_0x216e('0xf')]=_0x202257[_0x216e('0xf')];this[_0x216e('0x10')]=_0x202257[_0x216e('0x10')];this[_0x216e('0x11')]=_0x202257[_0x216e('0x11')];this['countnosuchnumberretry']=_0x202257[_0x216e('0x12')];this['countdropretry']=_0x202257[_0x216e('0x13')];this[_0x216e('0x14')]=_0x202257['countabandonedretry'];this[_0x216e('0x15')]=_0x202257['countmachineretry'];this[_0x216e('0x16')]=_0x202257[_0x216e('0x16')];this[_0x216e('0x17')]=_0x202257[_0x216e('0x17')];this[_0x216e('0x18')]=_0x202257[_0x216e('0x18')];this[_0x216e('0x19')]=_0x202257[_0x216e('0x19')];this[_0x216e('0x1a')]=_0x202257[_0x216e('0x1a')];this[_0x216e('0x1b')]=_0x202257[_0x216e('0x1b')];this[_0x216e('0x1c')]=_0x202257['id'];this['ContactFirstName']=_0x202257[_0x216e('0x7')][_0x216e('0x8')]||'';this['starttime']=moment()[_0x216e('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x216e('0x1e')]=_0x202257[_0x216e('0x1e')];this[_0x216e('0x1f')]=_0x202257['callbackuniqueid'];this[_0x216e('0x20')]=_0x202257[_0x216e('0x20')];this[_0x216e('0x21')]=_0x202257[_0x216e('0x21')];this[_0x216e('0x22')]='';this[_0x216e('0x23')]='';}Action[_0x216e('0x24')][_0x216e('0x25')]=function(){return util['format'](_0x216e('0x26'),this['name'],this[_0x216e('0x3')][_0x216e('0x27')]>0x0?this['number'][_0x216e('0x28')](this[_0x216e('0x3')]['dialCutDigit']):this[_0x216e('0x29')]);};Action[_0x216e('0x24')][_0x216e('0x2a')]=function(){return this['queue'];};module[_0x216e('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 637b717..5c06e30 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6a1=['answertime','format','ringtime','holdtime','getSeconds','talktime','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime'];(function(_0x4f9ef7,_0x353d4f){var _0x791923=function(_0x40a2f6){while(--_0x40a2f6){_0x4f9ef7['push'](_0x4f9ef7['shift']());}};_0x791923(++_0x353d4f);}(_0xd6a1,0x1ae));var _0x1d6a=function(_0x28ecf8,_0x700a7d){_0x28ecf8=_0x28ecf8-0x0;var _0x4332cf=_0xd6a1[_0x28ecf8];return _0x4332cf;};'use strict';var moment=require('moment');var utils=require(_0x1d6a('0x0'));function AgentComplete(_0x3a5a36,_0x5e92ab){this[_0x1d6a('0x1')]=0x4;this[_0x1d6a('0x2')]=_0x1d6a('0x3');this[_0x1d6a('0x4')]=_0x3a5a36[_0x1d6a('0x4')];this['type']=_0x3a5a36[_0x1d6a('0x5')];this['campaigntype']=_0x3a5a36[_0x1d6a('0x5')]===_0x1d6a('0x6')?_0x1d6a('0x7'):_0x3a5a36[_0x1d6a('0x5')];this[_0x1d6a('0x8')]=_0x3a5a36['countbusyretry'];this[_0x1d6a('0x9')]=_0x3a5a36[_0x1d6a('0x9')];this[_0x1d6a('0xa')]=_0x3a5a36[_0x1d6a('0xa')];this['countglobal']=_0x3a5a36[_0x1d6a('0x8')]+_0x3a5a36[_0x1d6a('0x9')]+_0x3a5a36[_0x1d6a('0xa')]+_0x3a5a36[_0x1d6a('0xb')]+_0x3a5a36[_0x1d6a('0xc')]+_0x3a5a36[_0x1d6a('0xd')]+_0x3a5a36[_0x1d6a('0xe')]+_0x3a5a36[_0x1d6a('0xf')];this['countnosuchnumberretry']=_0x3a5a36[_0x1d6a('0xb')];this[_0x1d6a('0xc')]=_0x3a5a36[_0x1d6a('0xc')];this['countabandonedretry']=_0x3a5a36['countabandonedretry'];this['countmachineretry']=_0x3a5a36[_0x1d6a('0xe')];this['countagentrejectretry']=_0x3a5a36['countagentrejectretry'];this['uniqueid']=_0x5e92ab[_0x1d6a('0x10')];this['calleridname']=_0x3a5a36['name'];this[_0x1d6a('0x11')]=_0x3a5a36[_0x1d6a('0x12')];this[_0x1d6a('0x13')]=_0x3a5a36[_0x1d6a('0x13')];this[_0x1d6a('0x14')]=_0x3a5a36[_0x1d6a('0x14')];this[_0x1d6a('0x15')]=_0x3a5a36[_0x1d6a('0x15')];this['endtime']=moment()[_0x1d6a('0x16')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1d6a('0x17')]=utils['getSeconds'](_0x3a5a36[_0x1d6a('0x14')],_0x3a5a36[_0x1d6a('0x13')]);this[_0x1d6a('0x18')]=utils[_0x1d6a('0x19')](_0x3a5a36['answertime'],_0x3a5a36[_0x1d6a('0x14')]);this[_0x1d6a('0x1a')]=utils[_0x1d6a('0x19')](this['endtime'],_0x3a5a36[_0x1d6a('0x15')]);this['queue']=_0x5e92ab[_0x1d6a('0x7')];this['membername']=_0x5e92ab[_0x1d6a('0x1b')];this['reason']=_0x5e92ab['reason'];this[_0x1d6a('0x1c')]=_0x3a5a36[_0x1d6a('0x1c')];this[_0x1d6a('0x1d')]=_0x3a5a36['callbackuniqueid'];this[_0x1d6a('0x1e')]=_0x3a5a36['callbackat'];this['recallme']=_0x3a5a36[_0x1d6a('0x1f')];this[_0x1d6a('0x20')]=_0x3a5a36['ContactId'];this[_0x1d6a('0x21')]=_0x3a5a36[_0x1d6a('0x21')];this[_0x1d6a('0x22')]=_0x3a5a36[_0x1d6a('0x22')];this['VoiceQueueId']=_0x3a5a36[_0x1d6a('0x23')];this[_0x1d6a('0x24')]=_0x3a5a36[_0x1d6a('0x24')];this[_0x1d6a('0x25')]=_0x3a5a36[_0x1d6a('0x25')]||'';this[_0x1d6a('0x26')]=_0x3a5a36['originatecalleridname']||'';this[_0x1d6a('0x27')]=_0x3a5a36[_0x1d6a('0x27')];}module[_0x1d6a('0x28')]=AgentComplete; \ No newline at end of file +var _0x599c=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','talktime','queue','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x351f3b,_0x1dc907){var _0x10dfa8=function(_0x636b6a){while(--_0x636b6a){_0x351f3b['push'](_0x351f3b['shift']());}};_0x10dfa8(++_0x1dc907);}(_0x599c,0x191));var _0xc599=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x599c[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xc599('0x0'));var utils=require(_0xc599('0x1'));function AgentComplete(_0x1dfc6c,_0x119473){this['state']=0x4;this['statedesc']='Answer';this[_0xc599('0x2')]=_0x1dfc6c['scheduledat'];this[_0xc599('0x3')]=_0x1dfc6c[_0xc599('0x3')];this[_0xc599('0x4')]=_0x1dfc6c[_0xc599('0x3')]===_0xc599('0x5')?'queue':_0x1dfc6c[_0xc599('0x3')];this[_0xc599('0x6')]=_0x1dfc6c[_0xc599('0x6')];this['countcongestionretry']=_0x1dfc6c[_0xc599('0x7')];this[_0xc599('0x8')]=_0x1dfc6c['countnoanswerretry'];this[_0xc599('0x9')]=_0x1dfc6c[_0xc599('0x6')]+_0x1dfc6c[_0xc599('0x7')]+_0x1dfc6c[_0xc599('0x8')]+_0x1dfc6c[_0xc599('0xa')]+_0x1dfc6c[_0xc599('0xb')]+_0x1dfc6c['countabandonedretry']+_0x1dfc6c[_0xc599('0xc')]+_0x1dfc6c['countagentrejectretry'];this[_0xc599('0xa')]=_0x1dfc6c[_0xc599('0xa')];this[_0xc599('0xb')]=_0x1dfc6c[_0xc599('0xb')];this['countabandonedretry']=_0x1dfc6c[_0xc599('0xd')];this[_0xc599('0xc')]=_0x1dfc6c[_0xc599('0xc')];this[_0xc599('0xe')]=_0x1dfc6c[_0xc599('0xe')];this[_0xc599('0xf')]=_0x119473[_0xc599('0xf')];this[_0xc599('0x10')]=_0x1dfc6c[_0xc599('0x11')];this[_0xc599('0x12')]=_0x1dfc6c[_0xc599('0x13')];this['starttime']=_0x1dfc6c[_0xc599('0x14')];this[_0xc599('0x15')]=_0x1dfc6c[_0xc599('0x15')];this[_0xc599('0x16')]=_0x1dfc6c['answertime'];this[_0xc599('0x17')]=moment()[_0xc599('0x18')](_0xc599('0x19'));this[_0xc599('0x1a')]=utils['getSeconds'](_0x1dfc6c[_0xc599('0x15')],_0x1dfc6c[_0xc599('0x14')]);this[_0xc599('0x1b')]=utils[_0xc599('0x1c')](_0x1dfc6c[_0xc599('0x16')],_0x1dfc6c[_0xc599('0x15')]);this[_0xc599('0x1d')]=utils[_0xc599('0x1c')](this['endtime'],_0x1dfc6c[_0xc599('0x16')]);this[_0xc599('0x1e')]=_0x119473[_0xc599('0x1e')];this['membername']=_0x119473['membername'];this[_0xc599('0x1f')]=_0x119473[_0xc599('0x1f')];this[_0xc599('0x20')]=_0x1dfc6c[_0xc599('0x20')];this[_0xc599('0x21')]=_0x1dfc6c['callbackuniqueid'];this[_0xc599('0x22')]=_0x1dfc6c['callbackat'];this[_0xc599('0x23')]=_0x1dfc6c['recallme'];this['ContactId']=_0x1dfc6c[_0xc599('0x24')];this[_0xc599('0x25')]=_0x1dfc6c['ListId'];this[_0xc599('0x26')]=_0x1dfc6c[_0xc599('0x26')];this[_0xc599('0x27')]=_0x1dfc6c['VoiceQueueId'];this[_0xc599('0x28')]=_0x1dfc6c[_0xc599('0x28')];this[_0xc599('0x29')]=_0x1dfc6c[_0xc599('0x29')]||'';this[_0xc599('0x2a')]=_0x1dfc6c[_0xc599('0x2a')]||'';this['agiafterat']=_0x1dfc6c[_0xc599('0x2b')];}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index bd9bfd9..51a32f9 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xffe9=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x48cb1f,_0x5ca68d){var _0x172c4d=function(_0x85040){while(--_0x85040){_0x48cb1f['push'](_0x48cb1f['shift']());}};_0x172c4d(++_0x5ca68d);}(_0xffe9,0x160));var _0x9ffe=function(_0xb47dc0,_0x407032){_0xb47dc0=_0xb47dc0-0x0;var _0x57f0b0=_0xffe9[_0xb47dc0];return _0x57f0b0;};'use strict';function Final(_0x24861c){this['uniqueid']=_0x24861c[_0x9ffe('0x0')];this[_0x9ffe('0x1')]=_0x24861c[_0x9ffe('0x1')];this[_0x9ffe('0x2')]=_0x24861c[_0x9ffe('0x2')];this[_0x9ffe('0x3')]=_0x24861c[_0x9ffe('0x2')]===_0x9ffe('0x4')?_0x9ffe('0x5'):_0x24861c[_0x9ffe('0x2')];this[_0x9ffe('0x6')]=_0x24861c[_0x9ffe('0x6')];this[_0x9ffe('0x7')]=_0x24861c['countcongestionretry'];this[_0x9ffe('0x8')]=_0x24861c[_0x9ffe('0x8')];this[_0x9ffe('0x9')]=_0x24861c[_0x9ffe('0x6')]+_0x24861c[_0x9ffe('0x7')]+_0x24861c[_0x9ffe('0x8')]+_0x24861c[_0x9ffe('0xa')]+_0x24861c[_0x9ffe('0xb')]+_0x24861c['countabandonedretry']+_0x24861c[_0x9ffe('0xc')]+_0x24861c[_0x9ffe('0xd')];this['countnosuchnumberretry']=_0x24861c[_0x9ffe('0xa')];this[_0x9ffe('0xb')]=_0x24861c['countdropretry'];this['countabandonedretry']=_0x24861c[_0x9ffe('0xe')];this[_0x9ffe('0xc')]=_0x24861c[_0x9ffe('0xc')];this['countagentrejectretry']=_0x24861c[_0x9ffe('0xd')];this['queue']=_0x24861c[_0x9ffe('0x5')];this[_0x9ffe('0xf')]=_0x24861c['calleridname'];this[_0x9ffe('0x10')]=_0x24861c['calleridnum'];this[_0x9ffe('0x11')]=_0x24861c[_0x9ffe('0x11')];this[_0x9ffe('0x12')]=_0x24861c[_0x9ffe('0x12')];this['endtime']=_0x24861c[_0x9ffe('0x12')];this[_0x9ffe('0x13')]=_0x24861c[_0x9ffe('0x13')]||0x0;this[_0x9ffe('0x14')]=_0x24861c['holdtime']||0x0;this[_0x9ffe('0x15')]=_0x24861c[_0x9ffe('0x15')]||0x0;this[_0x9ffe('0x16')]=_0x24861c[_0x9ffe('0x16')];this[_0x9ffe('0x17')]=_0x24861c['callbackuniqueid'];this[_0x9ffe('0x18')]=_0x24861c[_0x9ffe('0x18')];this[_0x9ffe('0x19')]=_0x24861c[_0x9ffe('0x19')];this[_0x9ffe('0x1a')]=_0x24861c[_0x9ffe('0x1a')];this['ListId']=_0x24861c[_0x9ffe('0x1b')];this[_0x9ffe('0x1c')]=_0x24861c['UserId'];this[_0x9ffe('0x1d')]=_0x24861c['VoiceQueueId'];this[_0x9ffe('0x1e')]=_0x24861c[_0x9ffe('0x1e')];this[_0x9ffe('0x1f')]=_0x24861c['originatecalleridnum']||'';this[_0x9ffe('0x20')]=_0x24861c[_0x9ffe('0x20')]||'';this[_0x9ffe('0x21')]=_0x24861c['state'];this[_0x9ffe('0x22')]=_0x24861c[_0x9ffe('0x22')];}module[_0x9ffe('0x23')]=Final; \ No newline at end of file +var _0x9379=['responsetime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc','exports','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime'];(function(_0x5ce130,_0x107a68){var _0x57125b=function(_0x7578b0){while(--_0x7578b0){_0x5ce130['push'](_0x5ce130['shift']());}};_0x57125b(++_0x107a68);}(_0x9379,0x6c));var _0x9937=function(_0x56e2ec,_0x2d5f2f){_0x56e2ec=_0x56e2ec-0x0;var _0x357e52=_0x9379[_0x56e2ec];return _0x357e52;};'use strict';function Final(_0x70c656){this[_0x9937('0x0')]=_0x70c656[_0x9937('0x0')];this[_0x9937('0x1')]=_0x70c656[_0x9937('0x1')];this[_0x9937('0x2')]=_0x70c656['type'];this['campaigntype']=_0x70c656[_0x9937('0x2')]===_0x9937('0x3')?_0x9937('0x4'):_0x70c656['type'];this[_0x9937('0x5')]=_0x70c656['countbusyretry'];this['countcongestionretry']=_0x70c656[_0x9937('0x6')];this[_0x9937('0x7')]=_0x70c656[_0x9937('0x7')];this['countglobal']=_0x70c656[_0x9937('0x5')]+_0x70c656['countcongestionretry']+_0x70c656[_0x9937('0x7')]+_0x70c656[_0x9937('0x8')]+_0x70c656[_0x9937('0x9')]+_0x70c656[_0x9937('0xa')]+_0x70c656[_0x9937('0xb')]+_0x70c656['countagentrejectretry'];this[_0x9937('0x8')]=_0x70c656['countnosuchnumberretry'];this[_0x9937('0x9')]=_0x70c656[_0x9937('0x9')];this['countabandonedretry']=_0x70c656[_0x9937('0xa')];this[_0x9937('0xb')]=_0x70c656[_0x9937('0xb')];this[_0x9937('0xc')]=_0x70c656[_0x9937('0xc')];this[_0x9937('0x4')]=_0x70c656[_0x9937('0x4')];this[_0x9937('0xd')]=_0x70c656[_0x9937('0xd')];this[_0x9937('0xe')]=_0x70c656['calleridnum'];this['starttime']=_0x70c656[_0x9937('0xf')];this[_0x9937('0x10')]=_0x70c656[_0x9937('0x10')];this['endtime']=_0x70c656[_0x9937('0x10')];this[_0x9937('0x11')]=_0x70c656[_0x9937('0x11')]||0x0;this['holdtime']=_0x70c656['holdtime']||0x0;this['talktime']=_0x70c656['talktime']||0x0;this[_0x9937('0x12')]=_0x70c656[_0x9937('0x12')];this['callbackuniqueid']=_0x70c656[_0x9937('0x13')];this['callbackat']=_0x70c656[_0x9937('0x14')];this[_0x9937('0x15')]=_0x70c656[_0x9937('0x15')];this[_0x9937('0x16')]=_0x70c656[_0x9937('0x16')];this['ListId']=_0x70c656[_0x9937('0x17')];this[_0x9937('0x18')]=_0x70c656[_0x9937('0x18')];this['VoiceQueueId']=_0x70c656[_0x9937('0x19')];this[_0x9937('0x1a')]=_0x70c656[_0x9937('0x1a')];this[_0x9937('0x1b')]=_0x70c656[_0x9937('0x1b')]||'';this['originatecalleridname']=_0x70c656['originatecalleridname']||'';this['state']=_0x70c656[_0x9937('0x1c')];this['statedesc']=_0x70c656[_0x9937('0x1d')];}module[_0x9937('0x1e')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index a753c90..b0dd848 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x535a=['cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','Answer','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','getSeconds','membername','reason'];(function(_0x324719,_0x35061f){var _0x3aac80=function(_0x7a4730){while(--_0x7a4730){_0x324719['push'](_0x324719['shift']());}};_0x3aac80(++_0x35061f);}(_0x535a,0x13f));var _0xa535=function(_0x3de6f0,_0x52652f){_0x3de6f0=_0x3de6f0-0x0;var _0x3c94aa=_0x535a[_0x3de6f0];return _0x3c94aa;};'use strict';var moment=require(_0xa535('0x0'));var utils=require(_0xa535('0x1'));function Hangup(_0x1fd0df,_0x15b6e1){this[_0xa535('0x2')]=0x4;this['statedesc']=_0xa535('0x3');this['scheduledat']=_0x1fd0df['scheduledat'];this[_0xa535('0x4')]=_0x1fd0df[_0xa535('0x4')];this['campaigntype']=_0x1fd0df[_0xa535('0x4')]===_0xa535('0x5')?_0xa535('0x6'):_0x1fd0df['type'];this[_0xa535('0x7')]=_0x1fd0df[_0xa535('0x7')]||![];this[_0xa535('0x8')]=_0x1fd0df[_0xa535('0x8')];this['countcongestionretry']=_0x1fd0df[_0xa535('0x9')];this[_0xa535('0xa')]=_0x1fd0df[_0xa535('0xa')];this[_0xa535('0xb')]=_0x1fd0df['countbusyretry']+_0x1fd0df['countcongestionretry']+_0x1fd0df['countnoanswerretry']+_0x1fd0df['countnosuchnumberretry']+_0x1fd0df[_0xa535('0xc')]+_0x1fd0df['countabandonedretry']+_0x1fd0df[_0xa535('0xd')]+_0x1fd0df['countagentrejectretry'];this[_0xa535('0xe')]=_0x1fd0df[_0xa535('0xe')];this[_0xa535('0xc')]=_0x1fd0df['countdropretry'];this[_0xa535('0xf')]=_0x1fd0df[_0xa535('0xf')];this[_0xa535('0xd')]=_0x1fd0df[_0xa535('0xd')];this[_0xa535('0x10')]=_0x1fd0df[_0xa535('0x10')];this['uniqueid']=_0x15b6e1[_0xa535('0x11')];this[_0xa535('0x12')]=_0x1fd0df[_0xa535('0x13')];this[_0xa535('0x14')]=_0x1fd0df[_0xa535('0x15')];this[_0xa535('0x16')]=_0x1fd0df['starttime'];this[_0xa535('0x17')]=_0x1fd0df[_0xa535('0x17')];this[_0xa535('0x18')]=moment()[_0xa535('0x19')](_0xa535('0x1a'));this[_0xa535('0x1b')]=utils['getSeconds'](_0x1fd0df[_0xa535('0x17')],_0x1fd0df['starttime']);this[_0xa535('0x1c')]=0x0;this[_0xa535('0x1d')]=utils[_0xa535('0x1e')](this['endtime'],_0x1fd0df[_0xa535('0x17')]);this[_0xa535('0x6')]=_0x1fd0df['queue'];this[_0xa535('0x1f')]='IVR';this[_0xa535('0x20')]=_0x15b6e1[_0xa535('0x21')];this[_0xa535('0x22')]=_0x1fd0df[_0xa535('0x22')];this[_0xa535('0x23')]=_0x1fd0df['callbackuniqueid'];this[_0xa535('0x24')]=_0x1fd0df['callbackat'];this['recallme']=_0x1fd0df[_0xa535('0x25')];this[_0xa535('0x26')]=_0x1fd0df[_0xa535('0x26')];this['ListId']=_0x1fd0df[_0xa535('0x27')];this[_0xa535('0x28')]=_0x1fd0df[_0xa535('0x28')];this[_0xa535('0x29')]=_0x1fd0df[_0xa535('0x29')];this[_0xa535('0x2a')]=_0x1fd0df['CampaignId'];}module[_0xa535('0x2b')]=Hangup; \ No newline at end of file +var _0x7371=['calleridname','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','endtime','queue','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countagentrejectretry','countdropretry','countabandonedretry','countmachineretry','uniqueid'];(function(_0x3c206f,_0x45b3e2){var _0x529cee=function(_0x4942d9){while(--_0x4942d9){_0x3c206f['push'](_0x3c206f['shift']());}};_0x529cee(++_0x45b3e2);}(_0x7371,0x7c));var _0x1737=function(_0x41db16,_0x564c03){_0x41db16=_0x41db16-0x0;var _0x28f7af=_0x7371[_0x41db16];return _0x28f7af;};'use strict';var moment=require(_0x1737('0x0'));var utils=require(_0x1737('0x1'));function Hangup(_0x491494,_0xdd3c0b){this[_0x1737('0x2')]=0x4;this[_0x1737('0x3')]=_0x1737('0x4');this[_0x1737('0x5')]=_0x491494[_0x1737('0x5')];this[_0x1737('0x6')]=_0x491494[_0x1737('0x6')];this[_0x1737('0x7')]=_0x491494['type']===_0x1737('0x8')?'queue':_0x491494[_0x1737('0x6')];this[_0x1737('0x9')]=_0x491494[_0x1737('0x9')]||![];this['countbusyretry']=_0x491494[_0x1737('0xa')];this[_0x1737('0xb')]=_0x491494[_0x1737('0xb')];this[_0x1737('0xc')]=_0x491494['countnoanswerretry'];this[_0x1737('0xd')]=_0x491494[_0x1737('0xa')]+_0x491494[_0x1737('0xb')]+_0x491494[_0x1737('0xc')]+_0x491494[_0x1737('0xe')]+_0x491494['countdropretry']+_0x491494['countabandonedretry']+_0x491494['countmachineretry']+_0x491494[_0x1737('0xf')];this[_0x1737('0xe')]=_0x491494['countnosuchnumberretry'];this[_0x1737('0x10')]=_0x491494[_0x1737('0x10')];this[_0x1737('0x11')]=_0x491494['countabandonedretry'];this[_0x1737('0x12')]=_0x491494['countmachineretry'];this[_0x1737('0xf')]=_0x491494[_0x1737('0xf')];this['uniqueid']=_0xdd3c0b[_0x1737('0x13')];this[_0x1737('0x14')]=_0x491494[_0x1737('0x15')];this[_0x1737('0x16')]=_0x491494[_0x1737('0x17')];this['starttime']=_0x491494[_0x1737('0x18')];this[_0x1737('0x19')]=_0x491494['responsetime'];this['endtime']=moment()[_0x1737('0x1a')](_0x1737('0x1b'));this[_0x1737('0x1c')]=utils[_0x1737('0x1d')](_0x491494[_0x1737('0x19')],_0x491494[_0x1737('0x18')]);this[_0x1737('0x1e')]=0x0;this[_0x1737('0x1f')]=utils[_0x1737('0x1d')](this[_0x1737('0x20')],_0x491494[_0x1737('0x19')]);this[_0x1737('0x21')]=_0x491494[_0x1737('0x21')];this[_0x1737('0x22')]=_0x1737('0x23');this[_0x1737('0x24')]=_0xdd3c0b[_0x1737('0x25')];this[_0x1737('0x26')]=_0x491494[_0x1737('0x26')];this[_0x1737('0x27')]=_0x491494[_0x1737('0x27')];this[_0x1737('0x28')]=_0x491494[_0x1737('0x28')];this[_0x1737('0x29')]=_0x491494[_0x1737('0x29')];this[_0x1737('0x2a')]=_0x491494[_0x1737('0x2a')];this['ListId']=_0x491494[_0x1737('0x2b')];this[_0x1737('0x2c')]=_0x491494[_0x1737('0x2c')];this['VoiceQueueId']=_0x491494[_0x1737('0x2d')];this[_0x1737('0x2e')]=_0x491494[_0x1737('0x2e')];}module[_0x1737('0x2f')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 97aef03..c0b61ec 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x644a=['endtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime'];(function(_0x479528,_0x11642c){var _0x152a16=function(_0x1caa8d){while(--_0x1caa8d){_0x479528['push'](_0x479528['shift']());}};_0x152a16(++_0x11642c);}(_0x644a,0x1a2));var _0xa644=function(_0x44a3e1,_0x4084b4){_0x44a3e1=_0x44a3e1-0x0;var _0x493faa=_0x644a[_0x44a3e1];return _0x493faa;};'use strict';var utils=require(_0xa644('0x0'));function History(_0x4560dc){this[_0xa644('0x1')]=_0x4560dc['uniqueid'];this[_0xa644('0x2')]=_0x4560dc[_0xa644('0x2')]||undefined;this['type']=_0x4560dc[_0xa644('0x3')];this[_0xa644('0x4')]=_0x4560dc['type']===_0xa644('0x5')?_0xa644('0x6'):_0x4560dc['type'];this['countbusyretry']=_0x4560dc['countbusyretry'];this[_0xa644('0x7')]=_0x4560dc['countcongestionretry'];this[_0xa644('0x8')]=_0x4560dc[_0xa644('0x8')];this[_0xa644('0x9')]=_0x4560dc[_0xa644('0xa')]+_0x4560dc[_0xa644('0x7')]+_0x4560dc[_0xa644('0x8')]+_0x4560dc[_0xa644('0xb')]+_0x4560dc['countdropretry']+_0x4560dc[_0xa644('0xc')]+_0x4560dc['countmachineretry']+_0x4560dc[_0xa644('0xd')];this[_0xa644('0xb')]=_0x4560dc[_0xa644('0xb')];this['countdropretry']=_0x4560dc[_0xa644('0xe')];this[_0xa644('0xc')]=_0x4560dc[_0xa644('0xc')];this['countmachineretry']=_0x4560dc[_0xa644('0xf')];this[_0xa644('0xd')]=_0x4560dc[_0xa644('0xd')];this[_0xa644('0x6')]=_0x4560dc['queue'];this[_0xa644('0x10')]=_0x4560dc[_0xa644('0x11')];this[_0xa644('0x12')]=_0x4560dc[_0xa644('0x13')];this['starttime']=_0x4560dc[_0xa644('0x14')];this['responsetime']=_0x4560dc[_0xa644('0x15')];this[_0xa644('0x16')]=_0x4560dc[_0xa644('0x15')];this['ringtime']=utils[_0xa644('0x17')](_0x4560dc[_0xa644('0x15')],_0x4560dc['starttime']);this[_0xa644('0x18')]=0x0;this[_0xa644('0x19')]=0x0;this['callback']=_0x4560dc[_0xa644('0x1a')];this[_0xa644('0x1b')]=_0x4560dc[_0xa644('0x1b')];this[_0xa644('0x1c')]=_0x4560dc[_0xa644('0x1c')];this[_0xa644('0x1d')]=_0x4560dc[_0xa644('0x1d')];this[_0xa644('0x1e')]=_0x4560dc[_0xa644('0x1e')];this[_0xa644('0x1f')]=_0x4560dc[_0xa644('0x1f')];this['UserId']=_0x4560dc[_0xa644('0x20')];this[_0xa644('0x21')]=_0x4560dc[_0xa644('0x21')];this['CampaignId']=_0x4560dc[_0xa644('0x22')];this[_0xa644('0x23')]=_0x4560dc[_0xa644('0x23')]||'';this[_0xa644('0x24')]=_0x4560dc[_0xa644('0x24')]||'';this[_0xa644('0x25')]=_0x4560dc['state'];this[_0xa644('0x26')]=_0x4560dc[_0xa644('0x26')];}module[_0xa644('0x27')]=History; \ No newline at end of file +var _0x95cd=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype'];(function(_0x5d9550,_0x253c1a){var _0x1d08a1=function(_0x37817a){while(--_0x37817a){_0x5d9550['push'](_0x5d9550['shift']());}};_0x1d08a1(++_0x253c1a);}(_0x95cd,0x6a));var _0xd95c=function(_0x3145bc,_0x4abbc0){_0x3145bc=_0x3145bc-0x0;var _0x545378=_0x95cd[_0x3145bc];return _0x545378;};'use strict';var utils=require(_0xd95c('0x0'));function History(_0x3bd56d){this['uniqueid']=_0x3bd56d[_0xd95c('0x1')];this[_0xd95c('0x2')]=_0x3bd56d[_0xd95c('0x2')]||undefined;this[_0xd95c('0x3')]=_0x3bd56d[_0xd95c('0x3')];this[_0xd95c('0x4')]=_0x3bd56d['type']==='outbound'?_0xd95c('0x5'):_0x3bd56d[_0xd95c('0x3')];this[_0xd95c('0x6')]=_0x3bd56d[_0xd95c('0x6')];this[_0xd95c('0x7')]=_0x3bd56d[_0xd95c('0x7')];this[_0xd95c('0x8')]=_0x3bd56d[_0xd95c('0x8')];this['countglobal']=_0x3bd56d[_0xd95c('0x6')]+_0x3bd56d[_0xd95c('0x7')]+_0x3bd56d[_0xd95c('0x8')]+_0x3bd56d[_0xd95c('0x9')]+_0x3bd56d[_0xd95c('0xa')]+_0x3bd56d[_0xd95c('0xb')]+_0x3bd56d[_0xd95c('0xc')]+_0x3bd56d[_0xd95c('0xd')];this[_0xd95c('0x9')]=_0x3bd56d['countnosuchnumberretry'];this[_0xd95c('0xa')]=_0x3bd56d[_0xd95c('0xa')];this[_0xd95c('0xb')]=_0x3bd56d['countabandonedretry'];this[_0xd95c('0xc')]=_0x3bd56d[_0xd95c('0xc')];this[_0xd95c('0xd')]=_0x3bd56d['countagentrejectretry'];this['queue']=_0x3bd56d[_0xd95c('0x5')];this[_0xd95c('0xe')]=_0x3bd56d[_0xd95c('0xf')];this[_0xd95c('0x10')]=_0x3bd56d[_0xd95c('0x11')];this[_0xd95c('0x12')]=_0x3bd56d['starttime'];this['responsetime']=_0x3bd56d[_0xd95c('0x13')];this['endtime']=_0x3bd56d[_0xd95c('0x13')];this['ringtime']=utils[_0xd95c('0x14')](_0x3bd56d[_0xd95c('0x13')],_0x3bd56d[_0xd95c('0x12')]);this[_0xd95c('0x15')]=0x0;this[_0xd95c('0x16')]=0x0;this[_0xd95c('0x17')]=_0x3bd56d[_0xd95c('0x17')];this['callbackuniqueid']=_0x3bd56d[_0xd95c('0x18')];this[_0xd95c('0x19')]=_0x3bd56d[_0xd95c('0x19')];this[_0xd95c('0x1a')]=_0x3bd56d['recallme'];this[_0xd95c('0x1b')]=_0x3bd56d['ContactId'];this[_0xd95c('0x1c')]=_0x3bd56d[_0xd95c('0x1c')];this['UserId']=_0x3bd56d[_0xd95c('0x1d')];this[_0xd95c('0x1e')]=_0x3bd56d[_0xd95c('0x1e')];this[_0xd95c('0x1f')]=_0x3bd56d['CampaignId'];this[_0xd95c('0x20')]=_0x3bd56d[_0xd95c('0x20')]||'';this[_0xd95c('0x21')]=_0x3bd56d[_0xd95c('0x21')]||'';this[_0xd95c('0x22')]=_0x3bd56d['state'];this[_0xd95c('0x23')]=_0x3bd56d['statedesc'];}module[_0xd95c('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index c172704..7bf2b1d 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7873=['reason','callback','callbackuniqueid','callbackat','recallme','UserId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','droptime','dropreason','endtime','holdtime','talktime','membername'];(function(_0x2692f1,_0xdfa6e){var _0x262a14=function(_0x4a3d58){while(--_0x4a3d58){_0x2692f1['push'](_0x2692f1['shift']());}};_0x262a14(++_0xdfa6e);}(_0x7873,0x163));var _0x3787=function(_0x25e514,_0x53bfc5){_0x25e514=_0x25e514-0x0;var _0x1a6492=_0x7873[_0x25e514];return _0x1a6492;};'use strict';var utils=require(_0x3787('0x0'));function QueueCallerAbandon(_0x4ff619,_0x476c88){this[_0x3787('0x1')]=_0x4ff619[_0x3787('0x1')];this[_0x3787('0x2')]=_0x4ff619[_0x3787('0x2')];this[_0x3787('0x3')]=_0x4ff619[_0x3787('0x2')]===_0x3787('0x4')?_0x3787('0x5'):_0x4ff619[_0x3787('0x2')];this[_0x3787('0x6')]=_0x4ff619['countbusyretry'];this[_0x3787('0x7')]=_0x4ff619[_0x3787('0x7')];this[_0x3787('0x8')]=_0x4ff619['countnoanswerretry'];this['countglobal']=_0x4ff619[_0x3787('0x6')]+_0x4ff619[_0x3787('0x7')]+_0x4ff619[_0x3787('0x8')]+_0x4ff619[_0x3787('0x9')]+_0x4ff619[_0x3787('0xa')]+_0x4ff619[_0x3787('0xb')]+_0x4ff619[_0x3787('0xc')]+_0x4ff619[_0x3787('0xd')];this[_0x3787('0x9')]=_0x4ff619[_0x3787('0x9')];this[_0x3787('0xa')]=_0x4ff619[_0x3787('0xa')];this[_0x3787('0xb')]=_0x4ff619[_0x3787('0xb')];this['countmachineretry']=_0x4ff619[_0x3787('0xc')];this['countagentrejectretry']=_0x4ff619[_0x3787('0xd')];this[_0x3787('0xe')]=_0x476c88[_0x3787('0xe')];this[_0x3787('0xf')]=_0x4ff619['name'];this['calleridnum']=_0x4ff619[_0x3787('0x10')];this[_0x3787('0x11')]=_0x4ff619['starttime'];this[_0x3787('0x12')]=_0x4ff619['responsetime'];this[_0x3787('0x13')]=_0x4ff619[_0x3787('0x13')];this[_0x3787('0x14')]=_0x4ff619['dropreason'];this[_0x3787('0x15')]=this[_0x3787('0x13')];this['ringtime']=utils['getSeconds'](_0x4ff619[_0x3787('0x12')],_0x4ff619[_0x3787('0x11')]);this[_0x3787('0x16')]=utils['getSeconds'](this[_0x3787('0x13')],_0x4ff619[_0x3787('0x12')]);this[_0x3787('0x17')]=0x0;this['queue']=_0x476c88['queue'];this[_0x3787('0x18')]=_0x476c88['connectedlinename'];this[_0x3787('0x19')]=_0x476c88[_0x3787('0x19')];this['callback']=_0x4ff619[_0x3787('0x1a')];this['callbackuniqueid']=_0x4ff619[_0x3787('0x1b')];this['callbackat']=_0x4ff619[_0x3787('0x1c')];this[_0x3787('0x1d')]=_0x4ff619['recallme'];this['ContactId']=_0x4ff619['ContactId'];this['ListId']=_0x4ff619['ListId'];this[_0x3787('0x1e')]=_0x4ff619['UserId'];this[_0x3787('0x1f')]=_0x4ff619['VoiceQueueId'];this[_0x3787('0x20')]=_0x4ff619[_0x3787('0x20')];this[_0x3787('0x21')]=_0x4ff619[_0x3787('0x21')]||'';this['originatecalleridname']=_0x4ff619['originatecalleridname']||'';this[_0x3787('0x22')]=_0x4ff619[_0x3787('0x22')];this[_0x3787('0x23')]=_0x4ff619['state'];this[_0x3787('0x24')]=_0x4ff619[_0x3787('0x24')];}module[_0x3787('0x25')]=QueueCallerAbandon; \ No newline at end of file +var _0x6ed2=['responsetime','droptime','dropreason','endtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','state','statedesc','../utils','scheduledat','type','outbound','queue','countbusyretry','countnoanswerretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','number','starttime'];(function(_0x1e7935,_0x3bb652){var _0x3eb2aa=function(_0x665b78){while(--_0x665b78){_0x1e7935['push'](_0x1e7935['shift']());}};_0x3eb2aa(++_0x3bb652);}(_0x6ed2,0xde));var _0x26ed=function(_0x593752,_0xfc3827){_0x593752=_0x593752-0x0;var _0x4612be=_0x6ed2[_0x593752];return _0x4612be;};'use strict';var utils=require(_0x26ed('0x0'));function QueueCallerAbandon(_0x4224b4,_0x3e2903){this[_0x26ed('0x1')]=_0x4224b4['scheduledat'];this[_0x26ed('0x2')]=_0x4224b4[_0x26ed('0x2')];this['campaigntype']=_0x4224b4[_0x26ed('0x2')]===_0x26ed('0x3')?_0x26ed('0x4'):_0x4224b4[_0x26ed('0x2')];this['countbusyretry']=_0x4224b4[_0x26ed('0x5')];this['countcongestionretry']=_0x4224b4['countcongestionretry'];this[_0x26ed('0x6')]=_0x4224b4[_0x26ed('0x6')];this['countglobal']=_0x4224b4[_0x26ed('0x5')]+_0x4224b4[_0x26ed('0x7')]+_0x4224b4[_0x26ed('0x6')]+_0x4224b4[_0x26ed('0x8')]+_0x4224b4[_0x26ed('0x9')]+_0x4224b4[_0x26ed('0xa')]+_0x4224b4['countmachineretry']+_0x4224b4[_0x26ed('0xb')];this[_0x26ed('0x8')]=_0x4224b4[_0x26ed('0x8')];this[_0x26ed('0x9')]=_0x4224b4[_0x26ed('0x9')];this[_0x26ed('0xa')]=_0x4224b4[_0x26ed('0xa')];this[_0x26ed('0xc')]=_0x4224b4['countmachineretry'];this[_0x26ed('0xb')]=_0x4224b4[_0x26ed('0xb')];this[_0x26ed('0xd')]=_0x3e2903['uniqueid'];this[_0x26ed('0xe')]=_0x4224b4[_0x26ed('0xf')];this['calleridnum']=_0x4224b4[_0x26ed('0x10')];this[_0x26ed('0x11')]=_0x4224b4[_0x26ed('0x11')];this['responsetime']=_0x4224b4[_0x26ed('0x12')];this['droptime']=_0x4224b4[_0x26ed('0x13')];this['dropreason']=_0x4224b4[_0x26ed('0x14')];this[_0x26ed('0x15')]=this['droptime'];this['ringtime']=utils[_0x26ed('0x16')](_0x4224b4[_0x26ed('0x12')],_0x4224b4[_0x26ed('0x11')]);this[_0x26ed('0x17')]=utils['getSeconds'](this['droptime'],_0x4224b4['responsetime']);this[_0x26ed('0x18')]=0x0;this[_0x26ed('0x4')]=_0x3e2903[_0x26ed('0x4')];this[_0x26ed('0x19')]=_0x3e2903['connectedlinename'];this[_0x26ed('0x1a')]=_0x3e2903[_0x26ed('0x1a')];this['callback']=_0x4224b4[_0x26ed('0x1b')];this[_0x26ed('0x1c')]=_0x4224b4[_0x26ed('0x1c')];this[_0x26ed('0x1d')]=_0x4224b4['callbackat'];this[_0x26ed('0x1e')]=_0x4224b4['recallme'];this[_0x26ed('0x1f')]=_0x4224b4[_0x26ed('0x1f')];this[_0x26ed('0x20')]=_0x4224b4[_0x26ed('0x20')];this[_0x26ed('0x21')]=_0x4224b4['UserId'];this[_0x26ed('0x22')]=_0x4224b4[_0x26ed('0x22')];this[_0x26ed('0x23')]=_0x4224b4[_0x26ed('0x23')];this[_0x26ed('0x24')]=_0x4224b4[_0x26ed('0x24')]||'';this['originatecalleridname']=_0x4224b4['originatecalleridname']||'';this['agiafterat']=_0x4224b4[_0x26ed('0x25')];this[_0x26ed('0x26')]=_0x4224b4[_0x26ed('0x26')];this[_0x26ed('0x27')]=_0x4224b4[_0x26ed('0x27')];}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index ae55fdf..dc1edee 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb145=['checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','temp','error','[getContactDialer]','getContactDialerIvr','catch','[getContactDialerIvr]','[countReScheduled]','countReScheduled','[rescheduleContact]','rescheduleContact','unlockContact','[moveContactManagedDialer]','moveContactManagedDialer','checkIsBlackList'];(function(_0x2c26a0,_0x2b9577){var _0x3e26d2=function(_0xcd6fc5){while(--_0xcd6fc5){_0x2c26a0['push'](_0x2c26a0['shift']());}};_0x3e26d2(++_0x2b9577);}(_0xb145,0xa3));var _0x5b14=function(_0x2006e2,_0x9c34ea){_0x2006e2=_0x2006e2-0x0;var _0x1d20c1=_0xb145[_0x2006e2];return _0x1d20c1;};'use strict';var util=require('util');var logger=require(_0x5b14('0x0'))(_0x5b14('0x1'));var cmHopper=require(_0x5b14('0x2'));var cmHopperAdditionalPhone=require(_0x5b14('0x3'));var cmHopperBlack=require(_0x5b14('0x4'));var cmHopperHistory=require(_0x5b14('0x5'));function inspectError(_0x31f6f0){return util[_0x5b14('0x6')](_0x31f6f0,{'showHidden':![],'depth':null});}function getContactDialer(_0x5111cd,_0x1e0b5b,_0x15490e){return cmHopper[_0x5b14('0x7')](_0x5111cd['id'],_0x1e0b5b,_0x15490e,_0x5111cd[_0x5b14('0x8')])['catch'](function(_0x1d12ed){_0x5111cd[_0x5b14('0x9')]=0x0;logger[_0x5b14('0xa')](_0x5b14('0xb'),inspectError(_0x1d12ed));});}exports[_0x5b14('0x7')]=getContactDialer;function getContactDialerIvr(_0x5f084f,_0x32d729){return cmHopper[_0x5b14('0xc')](_0x5f084f['id'],_0x32d729,_0x5f084f['dialOrderByScheduledAt'])[_0x5b14('0xd')](function(_0x17047f){_0x5f084f[_0x5b14('0x9')]=0x0;logger[_0x5b14('0xa')](_0x5b14('0xe'),inspectError(_0x17047f));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x265df3){return cmHopper['countReScheduled'](_0x265df3)[_0x5b14('0xd')](function(_0x1903a5){logger[_0x5b14('0xa')](_0x5b14('0xf'),inspectError(_0x1903a5));});}exports[_0x5b14('0x10')]=countReScheduled;function rescheduleContact(_0x40577a){return cmHopper['rescheduleContact'](_0x40577a)[_0x5b14('0xd')](function(_0x16f2a1){logger[_0x5b14('0xa')](_0x5b14('0x11'),inspectError(_0x16f2a1));});}exports[_0x5b14('0x12')]=rescheduleContact;function unlockContact(_0x2a8fe5,_0x68f695,_0xe5af75){return cmHopper[_0x5b14('0x13')](_0x2a8fe5,_0x68f695,_0xe5af75)[_0x5b14('0xd')](function(_0x221344){logger[_0x5b14('0xa')]('[unlockContact]',inspectError(_0x221344));});}exports[_0x5b14('0x13')]=unlockContact;function moveContactManagedDialer(_0x50866a){return cmHopper['moveContactManagedDialer'](_0x50866a)['catch'](function(_0x3f397d){logger[_0x5b14('0xa')](_0x5b14('0x14'),inspectError(_0x3f397d));});}exports[_0x5b14('0x15')]=moveContactManagedDialer;function checkIsBlackList(_0x3786f7){return cmHopperBlack[_0x5b14('0x16')](_0x3786f7)[_0x5b14('0xd')](function(_0x4a4e60){logger['error']('[checkIsBlackList]',inspectError(_0x4a4e60));});}exports[_0x5b14('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x2afa17){return cmHopperBlack[_0x5b14('0x17')](_0x2afa17)[_0x5b14('0xd')](function(_0x4c8080){logger[_0x5b14('0xa')](_0x5b14('0x18'),inspectError(_0x4c8080));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2d7b38,_0x30734f,_0x50951f){return cmHopperAdditionalPhone[_0x5b14('0x19')](_0x2d7b38,_0x30734f,_0x50951f)['catch'](function(_0x59282c){logger['error']('[verifyAdditionalPhone]',inspectError(_0x59282c));});}exports[_0x5b14('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x2d5f56,_0x153a25,_0x5da505){return cmHopperAdditionalPhone[_0x5b14('0x1a')](_0x2d5f56,_0x153a25,_0x5da505)[_0x5b14('0xd')](function(_0x2ac7b0){logger[_0x5b14('0xa')](_0x5b14('0x1b'),inspectError(_0x2ac7b0));});}exports[_0x5b14('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x422d22){return cmHopperHistory[_0x5b14('0x1c')](_0x422d22)[_0x5b14('0xd')](function(_0x4e9609){logger[_0x5b14('0xa')](_0x5b14('0x1d'),inspectError(_0x4e9609));});}exports[_0x5b14('0x1c')]=avgHandleTime;function createHistory(_0x266bbe){return cmHopperHistory['createHistory'](_0x266bbe)[_0x5b14('0xd')](function(_0x18a76d){logger['error']('[createHistory]',inspectError(_0x18a76d));});}exports[_0x5b14('0x1e')]=createHistory; \ No newline at end of file +var _0xdf55=['createHistory','util','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','[avgHandleTime]'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xdf55,0x83));var _0x5df5=function(_0x3d71ba,_0x49a38b){_0x3d71ba=_0x3d71ba-0x0;var _0x5e0ed0=_0xdf55[_0x3d71ba];return _0x5e0ed0;};'use strict';var util=require(_0x5df5('0x0'));var logger=require(_0x5df5('0x1'))('dialer');var cmHopper=require(_0x5df5('0x2'));var cmHopperAdditionalPhone=require(_0x5df5('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x5df5('0x4'));function inspectError(_0x773e15){return util[_0x5df5('0x5')](_0x773e15,{'showHidden':![],'depth':null});}function getContactDialer(_0x521007,_0x289af4,_0x417341){return cmHopper[_0x5df5('0x6')](_0x521007['id'],_0x289af4,_0x417341,_0x521007[_0x5df5('0x7')])[_0x5df5('0x8')](function(_0x2b7ed9){_0x521007[_0x5df5('0x9')]=0x0;logger[_0x5df5('0xa')]('[getContactDialer]',inspectError(_0x2b7ed9));});}exports[_0x5df5('0x6')]=getContactDialer;function getContactDialerIvr(_0x403d8b,_0x41941e){return cmHopper['getContactDialerIvr'](_0x403d8b['id'],_0x41941e,_0x403d8b['dialOrderByScheduledAt'])[_0x5df5('0x8')](function(_0x4e80bd){_0x403d8b[_0x5df5('0x9')]=0x0;logger[_0x5df5('0xa')]('[getContactDialerIvr]',inspectError(_0x4e80bd));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x40322d){return cmHopper[_0x5df5('0xb')](_0x40322d)[_0x5df5('0x8')](function(_0x4c3d6f){logger[_0x5df5('0xa')](_0x5df5('0xc'),inspectError(_0x4c3d6f));});}exports[_0x5df5('0xb')]=countReScheduled;function rescheduleContact(_0x463990){return cmHopper[_0x5df5('0xd')](_0x463990)[_0x5df5('0x8')](function(_0x555d3f){logger[_0x5df5('0xa')]('[rescheduleContact]',inspectError(_0x555d3f));});}exports[_0x5df5('0xd')]=rescheduleContact;function unlockContact(_0x33f818,_0x5b0ad9,_0x3657c8){return cmHopper[_0x5df5('0xe')](_0x33f818,_0x5b0ad9,_0x3657c8)['catch'](function(_0x27b3fb){logger[_0x5df5('0xa')]('[unlockContact]',inspectError(_0x27b3fb));});}exports[_0x5df5('0xe')]=unlockContact;function moveContactManagedDialer(_0x45813f){return cmHopper[_0x5df5('0xf')](_0x45813f)[_0x5df5('0x8')](function(_0x215d59){logger['error']('[moveContactManagedDialer]',inspectError(_0x215d59));});}exports[_0x5df5('0xf')]=moveContactManagedDialer;function checkIsBlackList(_0x5d8dfd){return cmHopperBlack[_0x5df5('0x10')](_0x5d8dfd)[_0x5df5('0x8')](function(_0xa939e4){logger[_0x5df5('0xa')](_0x5df5('0x11'),inspectError(_0xa939e4));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x1d6474){return cmHopperBlack[_0x5df5('0x12')](_0x1d6474)[_0x5df5('0x8')](function(_0x34af1d){logger[_0x5df5('0xa')](_0x5df5('0x13'),inspectError(_0x34af1d));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2e99a1,_0x2e862d,_0x8742a7){return cmHopperAdditionalPhone[_0x5df5('0x14')](_0x2e99a1,_0x2e862d,_0x8742a7)['catch'](function(_0x4358ba){logger[_0x5df5('0xa')](_0x5df5('0x15'),inspectError(_0x4358ba));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x52206d,_0x532923,_0x357fb0){return cmHopperAdditionalPhone[_0x5df5('0x16')](_0x52206d,_0x532923,_0x357fb0)[_0x5df5('0x8')](function(_0xa7f4b3){logger[_0x5df5('0xa')](_0x5df5('0x17'),inspectError(_0xa7f4b3));});}exports[_0x5df5('0x16')]=swapAdditionalPhones;function avgHandleTime(_0x28723e){return cmHopperHistory['avgHandleTime'](_0x28723e)[_0x5df5('0x8')](function(_0x4fc1a1){logger[_0x5df5('0xa')](_0x5df5('0x18'),inspectError(_0x4fc1a1));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x3854d0){return cmHopperHistory['createHistory'](_0x3854d0)[_0x5df5('0x8')](function(_0x4cccf1){logger[_0x5df5('0xa')]('[createHistory]',inspectError(_0x4cccf1));});}exports[_0x5df5('0x19')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 8e449f1..81713f4 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe274=['updatedAt','undefined','toUpperCase','substring','XMD-','setXMDContactVariables','lodash','moment','util','../../../../config/logger','../../../../config/environment/shared','timezones','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','type','ivr','isIVRCampaign','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','SIP/','unmonitored','includes','status','TrunkBackup','ACTIVE','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','length','checkContactEmpty','erlangb','[checkContactLowerLimitOriginate]\x20','checkContactLowerLimitOriginate','tags'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe274,0x11a));var _0x4e27=function(_0x342c7e,_0x3be081){_0x342c7e=_0x342c7e-0x0;var _0x437ffa=_0xe274[_0x342c7e];return _0x437ffa;};'use strict';var _=require(_0x4e27('0x0'));var moment=require(_0x4e27('0x1'));var util=require(_0x4e27('0x2'));var logger=require(_0x4e27('0x3'))('dialer');var timezones=require(_0x4e27('0x4'))[_0x4e27('0x5')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0x4e27('0x6'),'CONTACTS_RESCHEDULED':_0x4e27('0x7'),'DEACTIVATED':_0x4e27('0x8'),'DISACTIVED':_0x4e27('0x9'),'EMPTY_INTERVAL':_0x4e27('0xa'),'INACTIVE':_0x4e27('0xb'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0x4e27('0xc'),'NULL_INTERVAL':_0x4e27('0xd'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x4e27('0xe'),'QUEUE_RECALL':_0x4e27('0xf'),'RECALL_TIMEOUT':_0x4e27('0x10'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x4e27('0x11'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x4e27('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x4d3de5){return _0x4d3de5[_0x4e27('0x13')]===_0x4e27('0x14');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x2227d1){return _0x2227d1[_0x4e27('0x15')]===_0x4e27('0x16');}exports[_0x4e27('0x17')]=isIVRCampaign;function isOutboundQueue(_0x34c39c){return _0x34c39c[_0x4e27('0x15')]==='outbound';}exports[_0x4e27('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x7565b4){return _0x7565b4[_0x4e27('0x19')];}exports[_0x4e27('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0x3cb9ed){return _0x3cb9ed[_0x4e27('0x1b')];}exports[_0x4e27('0x1c')]=isIVRCampaignActive;function getSeconds(_0x3741ab,_0x5d039f){var _0x2d8c9f=moment(_0x3741ab)[_0x4e27('0x1d')](0x0);var _0x48b45e=moment(_0x5d039f)[_0x4e27('0x1d')](0x0);return _0x2d8c9f[_0x4e27('0x1e')](_0x48b45e,_0x4e27('0x1f'));}exports[_0x4e27('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x10c166,_0x3d4ca2){var _0x1d6b99=![];var _0x483978=_0x10c166[_0x4e27('0x13')]!==_0x3d4ca2[_0x4e27('0x13')]||_0x10c166[_0x4e27('0x19')]!==_0x3d4ca2[_0x4e27('0x19')]||_0x10c166[_0x4e27('0x21')]!==_0x3d4ca2[_0x4e27('0x21')];var _0x34a27d=_0x10c166[_0x4e27('0x22')]!==_0x3d4ca2[_0x4e27('0x22')]||_0x10c166[_0x4e27('0x23')]!==_0x3d4ca2[_0x4e27('0x23')]||_0x10c166[_0x4e27('0x24')]!==_0x3d4ca2[_0x4e27('0x24')]||_0x10c166[_0x4e27('0x25')]!==_0x3d4ca2['paused']||_0x10c166[_0x4e27('0x26')]!==_0x3d4ca2['talking']||_0x10c166[_0x4e27('0x27')]!==_0x3d4ca2[_0x4e27('0x27')]||_0x10c166[_0x4e27('0x28')]!==_0x3d4ca2[_0x4e27('0x28')]||_0x10c166[_0x4e27('0x29')]!==_0x3d4ca2[_0x4e27('0x29')]||_0x10c166[_0x4e27('0x2a')]!==_0x3d4ca2[_0x4e27('0x2a')];if(_0x10c166[_0x4e27('0x2b')]&&_0x3d4ca2[_0x4e27('0x2b')]){_0x1d6b99=_0x10c166[_0x4e27('0x2b')][_0x4e27('0x2c')]!==_0x3d4ca2['Trunk'][_0x4e27('0x2c')]||_0x10c166[_0x4e27('0x2b')][_0x4e27('0x1b')]!==_0x3d4ca2[_0x4e27('0x2b')]['active'];}return _0x483978||_0x34a27d||_0x1d6b99;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x51d71f){var _0x3514aa=null;var _0x186365=_0x51d71f['dialTimezone'];if(_[_0x4e27('0x2d')](_0x51d71f[_0x4e27('0x2e')])||_[_0x4e27('0x2d')](_0x51d71f[_0x4e27('0x2f')])||_[_0x4e27('0x2d')](_0x51d71f[_0x4e27('0x2f')][_0x4e27('0x30')])){_0x3514aa=CAMPAIGN_STATUS[_0x4e27('0x31')];}else if(_[_0x4e27('0x32')](_0x51d71f['dialGlobalInterval'])||_[_0x4e27('0x32')](_0x51d71f[_0x4e27('0x2f')][_0x4e27('0x30')])){_0x3514aa=CAMPAIGN_STATUS[_0x4e27('0x33')];}else if(_0x186365&&!timezones[_0x186365]){_0x3514aa=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x3514aa;}function checkAnyValidTrunk(_0x2da5d2,_0x5739f2){var _0xccb3b4=null;var _0x259056=_0x4e27('0x34');var _0x410723=['reachable',_0x4e27('0x35')];var _0x331fbf=!![];if(_0x2da5d2[_0x4e27('0x2b')]&&_0x2da5d2[_0x4e27('0x2b')][_0x4e27('0x1b')]){_0x259056+=_0x2da5d2[_0x4e27('0x2b')]['name'];_0xccb3b4=_0x5739f2[_0x259056];_0x331fbf=_0x410723[_0x4e27('0x36')](_0xccb3b4[_0x4e27('0x37')]);}else if(_0x2da5d2[_0x4e27('0x38')]&&_0x2da5d2[_0x4e27('0x38')]['active']){_0x259056+=_0x2da5d2[_0x4e27('0x38')][_0x4e27('0x2c')];_0xccb3b4=_0x5739f2[_0x259056];_0x331fbf=_0x410723[_0x4e27('0x36')](_0xccb3b4[_0x4e27('0x37')]);}return _0x331fbf;}function getQueueCampaignStatusMessage(_0xc21fe2,_0x10099a){var _0x80f7db=CAMPAIGN_STATUS[_0x4e27('0x39')];var _0x42d456=isPreviewCampaign(_0xc21fe2);if(!isQueueCampaignActive(_0xc21fe2)){if(_0x42d456){_0x80f7db=CAMPAIGN_STATUS[_0x4e27('0x3a')];}else{if(_0xc21fe2[_0x4e27('0x2a')]===0x0&&_0xc21fe2[_0x4e27('0x26')]===0x0&&_0xc21fe2[_0x4e27('0x28')]===0x0&&(_0xc21fe2[_0x4e27('0x27')]||0x0)===0x0){_0x80f7db=CAMPAIGN_STATUS[_0x4e27('0x3a')];}else{_0x80f7db=CAMPAIGN_STATUS[_0x4e27('0x3b')];}}}else if(_0xc21fe2[_0x4e27('0x23')]===0x0){_0x80f7db=CAMPAIGN_STATUS[_0x4e27('0x3c')];}else if(!checkAnyValidTrunk(_0xc21fe2,_0x10099a)){_0x80f7db=CAMPAIGN_STATUS[_0x4e27('0x3d')];}else if(!isPreviewCampaign(_0xc21fe2)){var _0xa8b1fb=checkAnyValidQueueCampaignInterval(_0xc21fe2);if(_0xa8b1fb){_0x80f7db=_0xa8b1fb;}}return _0x80f7db;}exports[_0x4e27('0x3e')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x516871){var _0x270027=CAMPAIGN_STATUS[_0x4e27('0x3b')];if(_0x516871[_0x4e27('0x2a')]===0x0&&_0x516871[_0x4e27('0x26')]===0x0&&_0x516871[_0x4e27('0x28')]===0x0&&(_0x516871[_0x4e27('0x27')]||0x0)===0x0){_0x270027=CAMPAIGN_STATUS[_0x4e27('0x3a')];}return _0x270027;}exports[_0x4e27('0x3f')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0xe81a85){var _0x4f01f1=_0xe81a85[_0x4e27('0x40')](/"(.*?)"/);return _0x4f01f1?_0x4f01f1[0x1]:_0xe81a85;}exports[_0x4e27('0x41')]=extractCalleridName;function getCallerId(_0x4a0c23,_0x124de6,_0x51f93c){if(!_[_0x4e27('0x42')](_0x51f93c)&&typeof _0x51f93c===_0x4e27('0x43')&&!_['isEmpty'](_0x51f93c)){if(!_[_0x4e27('0x42')](_0x124de6)&&typeof _0x124de6===_0x4e27('0x43')&&!_['isEmpty'](_0x124de6)){return util[_0x4e27('0x44')](_0x4e27('0x45'),_0x124de6,_0x51f93c);}return util[_0x4e27('0x44')]('\x22%s\x22\x20<%s>',_0x51f93c,_0x51f93c);}if(!_[_0x4e27('0x42')](_0x4a0c23)&&typeof _0x4a0c23===_0x4e27('0x43')&&!_[_0x4e27('0x32')](_0x4a0c23)){return _0x4a0c23;}return'\x22\x22\x20<>';}exports[_0x4e27('0x46')]=getCallerId;function getCallerIdRandom(_0x28dc20,_0x3e465c){var _0x45bcb8;var _0x4ce9d2;var _0x2b764e;if(_0x3e465c<=0x0){_0x3e465c=0x1;}_0x45bcb8=new RegExp(_0x4e27('0x47')+_0x3e465c+'}$');_0x4ce9d2=Math[_0x4e27('0x48')](0xa,_0x3e465c-0x1);_0x2b764e=Math['pow'](0xa,_0x3e465c)-0x1;return util[_0x4e27('0x44')]('%s',_[_0x4e27('0x49')](_0x28dc20,_0x45bcb8,_[_0x4e27('0x4a')](_0x4ce9d2,_0x2b764e)[_0x4e27('0x4b')]()));}exports[_0x4e27('0x4c')]=getCallerIdRandom;function decrementOriginate(_0x50c358,_0x1d156a){if(_0x50c358[_0x4e27('0x2a')]&&_0x50c358['originated']>0x0){_0x50c358[_0x4e27('0x2a')]-=0x1;}else{logger[_0x4e27('0x4d')](_0x4e27('0x4e'),_0x1d156a);}}exports[_0x4e27('0x4f')]=decrementOriginate;function checkContactEmpty(_0x595423){return _0x595423&&_0x595423[_0x4e27('0x50')]>0x0;}exports[_0x4e27('0x51')]=checkContactEmpty;function erlangb(_0x5dc317,_0x168639){if(_0x168639===0x0){return 0x0;}var _0x26e0cc=0x1;for(var _0x3bca86=0x1;_0x3bca86<=_0x168639;_0x3bca86+=0x1){_0x26e0cc=0x1+_0x26e0cc*_0x3bca86/_0x5dc317;}return 0x1/_0x26e0cc;}exports[_0x4e27('0x52')]=erlangb;function checkContactLowerLimitOriginate(_0x174ce9,_0x307bf8,_0x3e3be1){if(_0x307bf8>_0x3e3be1){for(var _0x5a8aa1=0x0;_0x5a8aa1<_0x307bf8-_0x3e3be1;_0x5a8aa1+=0x1){decrementOriginate(_0x174ce9,_0x4e27('0x53'));}}}exports[_0x4e27('0x54')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x2d5be8){var _0x260c83={};var _0x301bc6=['id','createdAt',_0x4e27('0x55'),_0x4e27('0x56')];const _0x532235=0xfa;if(_0x2d5be8){for(var _0x49cab5 in _0x2d5be8){if(typeof _0x2d5be8[_0x49cab5]!==_0x4e27('0x57')){if(!_['isNil'](_0x2d5be8[_0x49cab5])&&!_0x301bc6[_0x4e27('0x36')](_0x49cab5)){if(_0x49cab5==='description'&&_0x2d5be8[_0x49cab5]['length']>_0x532235){_0x260c83['XMD-'+_0x49cab5[_0x4e27('0x58')]()]=_0x2d5be8[_0x49cab5][_0x4e27('0x4b')]()[_0x4e27('0x59')](0x0,_0x532235);}else{_0x260c83[_0x4e27('0x5a')+_0x49cab5['toUpperCase']()]=_0x2d5be8[_0x49cab5];}}}}}return _0x260c83;}exports[_0x4e27('0x5b')]=setXMDContactVariables; \ No newline at end of file +var _0x15ac=['getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','length','checkContactEmpty','erlangb','[checkContactLowerLimitOriginate]\x20','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','undefined','toUpperCase','substring','XMD-','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','isIVRCampaignActive','milliseconds','getSeconds','message','available','loggedIn','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','status','TrunkBackup','includes','ACTIVE','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x15ac,0x6f));var _0xc15a=function(_0x3d1753,_0x5c1b01){_0x3d1753=_0x3d1753-0x0;var _0x5e2bc3=_0x15ac[_0x3d1753];return _0x5e2bc3;};'use strict';var _=require(_0xc15a('0x0'));var moment=require(_0xc15a('0x1'));var util=require(_0xc15a('0x2'));var logger=require(_0xc15a('0x3'))(_0xc15a('0x4'));var timezones=require(_0xc15a('0x5'))[_0xc15a('0x6')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0xc15a('0x7'),'DEACTIVATED':_0xc15a('0x8'),'DISACTIVED':_0xc15a('0x9'),'EMPTY_INTERVAL':_0xc15a('0xa'),'INACTIVE':_0xc15a('0xb'),'NO_AGENTS_LOGGED':_0xc15a('0xc'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0xc15a('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0xc15a('0xe'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0xc15a('0xf'),'UNKNOWN_TIMEZONE':_0xc15a('0x10'),'UNREACHABLE_TRUNK':_0xc15a('0x11')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x19649f){return _0x19649f[_0xc15a('0x12')]===_0xc15a('0x13');}exports[_0xc15a('0x14')]=isPreviewCampaign;function isIVRCampaign(_0x31f16f){return _0x31f16f[_0xc15a('0x15')]===_0xc15a('0x16');}exports[_0xc15a('0x17')]=isIVRCampaign;function isOutboundQueue(_0xf3bf28){return _0xf3bf28[_0xc15a('0x15')]===_0xc15a('0x18');}exports[_0xc15a('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0xb18229){return _0xb18229[_0xc15a('0x1a')];}exports[_0xc15a('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x43f334){return _0x43f334['active'];}exports[_0xc15a('0x1c')]=isIVRCampaignActive;function getSeconds(_0x1847ab,_0x50c2a4){var _0x32eadb=moment(_0x1847ab)[_0xc15a('0x1d')](0x0);var _0x50808d=moment(_0x50c2a4)[_0xc15a('0x1d')](0x0);return _0x32eadb['diff'](_0x50808d,'seconds');}exports[_0xc15a('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x4734ae,_0x154f65){var _0x2962d5=![];var _0x524d71=_0x4734ae[_0xc15a('0x12')]!==_0x154f65['dialMethod']||_0x4734ae[_0xc15a('0x1a')]!==_0x154f65[_0xc15a('0x1a')]||_0x4734ae[_0xc15a('0x1f')]!==_0x154f65['message'];var _0x2646b6=_0x4734ae[_0xc15a('0x20')]!==_0x154f65[_0xc15a('0x20')]||_0x4734ae['loggedIn']!==_0x154f65[_0xc15a('0x21')]||_0x4734ae['loggedInDb']!==_0x154f65['loggedInDb']||_0x4734ae[_0xc15a('0x22')]!==_0x154f65[_0xc15a('0x22')]||_0x4734ae[_0xc15a('0x23')]!==_0x154f65[_0xc15a('0x23')]||_0x4734ae[_0xc15a('0x24')]!==_0x154f65[_0xc15a('0x24')]||_0x4734ae[_0xc15a('0x25')]!==_0x154f65['waiting']||_0x4734ae[_0xc15a('0x26')]!==_0x154f65[_0xc15a('0x26')]||_0x4734ae['originated']!==_0x154f65[_0xc15a('0x27')];if(_0x4734ae[_0xc15a('0x28')]&&_0x154f65[_0xc15a('0x28')]){_0x2962d5=_0x4734ae[_0xc15a('0x28')][_0xc15a('0x29')]!==_0x154f65['Trunk'][_0xc15a('0x29')]||_0x4734ae[_0xc15a('0x28')][_0xc15a('0x2a')]!==_0x154f65[_0xc15a('0x28')][_0xc15a('0x2a')];}return _0x524d71||_0x2646b6||_0x2962d5;}exports[_0xc15a('0x2b')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x4c19c1){var _0x2d86c8=null;var _0x3eff9d=_0x4c19c1[_0xc15a('0x2c')];if(_[_0xc15a('0x2d')](_0x4c19c1[_0xc15a('0x2e')])||_[_0xc15a('0x2d')](_0x4c19c1[_0xc15a('0x2f')])||_[_0xc15a('0x2d')](_0x4c19c1[_0xc15a('0x2f')][_0xc15a('0x30')])){_0x2d86c8=CAMPAIGN_STATUS[_0xc15a('0x31')];}else if(_[_0xc15a('0x32')](_0x4c19c1['dialGlobalInterval'])||_[_0xc15a('0x32')](_0x4c19c1[_0xc15a('0x2f')][_0xc15a('0x30')])){_0x2d86c8=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x3eff9d&&!timezones[_0x3eff9d]){_0x2d86c8=CAMPAIGN_STATUS[_0xc15a('0x33')];}return _0x2d86c8;}function checkAnyValidTrunk(_0x4ac130,_0x131516){var _0x3cbc6f=null;var _0x204457=_0xc15a('0x34');var _0x16473e=[_0xc15a('0x35'),_0xc15a('0x36')];var _0xc3f4a4=!![];if(_0x4ac130['Trunk']&&_0x4ac130['Trunk']['active']){_0x204457+=_0x4ac130['Trunk'][_0xc15a('0x29')];_0x3cbc6f=_0x131516[_0x204457];_0xc3f4a4=_0x16473e['includes'](_0x3cbc6f[_0xc15a('0x37')]);}else if(_0x4ac130['TrunkBackup']&&_0x4ac130[_0xc15a('0x38')][_0xc15a('0x2a')]){_0x204457+=_0x4ac130[_0xc15a('0x38')][_0xc15a('0x29')];_0x3cbc6f=_0x131516[_0x204457];_0xc3f4a4=_0x16473e[_0xc15a('0x39')](_0x3cbc6f[_0xc15a('0x37')]);}return _0xc3f4a4;}function getQueueCampaignStatusMessage(_0x2fe998,_0x159df9){var _0x441771=CAMPAIGN_STATUS[_0xc15a('0x3a')];var _0x48d7fd=isPreviewCampaign(_0x2fe998);if(!isQueueCampaignActive(_0x2fe998)){if(_0x48d7fd){_0x441771=CAMPAIGN_STATUS[_0xc15a('0x3b')];}else{if(_0x2fe998[_0xc15a('0x27')]===0x0&&_0x2fe998[_0xc15a('0x23')]===0x0&&_0x2fe998[_0xc15a('0x25')]===0x0&&(_0x2fe998['pTalking']||0x0)===0x0){_0x441771=CAMPAIGN_STATUS[_0xc15a('0x3b')];}else{_0x441771=CAMPAIGN_STATUS[_0xc15a('0x3c')];}}}else if(_0x2fe998['loggedIn']===0x0){_0x441771=CAMPAIGN_STATUS[_0xc15a('0x3d')];}else if(!checkAnyValidTrunk(_0x2fe998,_0x159df9)){_0x441771=CAMPAIGN_STATUS[_0xc15a('0x3e')];}else if(!isPreviewCampaign(_0x2fe998)){var _0x40db6c=checkAnyValidQueueCampaignInterval(_0x2fe998);if(_0x40db6c){_0x441771=_0x40db6c;}}return _0x441771;}exports[_0xc15a('0x3f')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0xbfa833){var _0x38eeb8=CAMPAIGN_STATUS[_0xc15a('0x3c')];if(_0xbfa833[_0xc15a('0x27')]===0x0&&_0xbfa833[_0xc15a('0x23')]===0x0&&_0xbfa833['waiting']===0x0&&(_0xbfa833['pTalking']||0x0)===0x0){_0x38eeb8=CAMPAIGN_STATUS[_0xc15a('0x3b')];}return _0x38eeb8;}exports[_0xc15a('0x40')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x1cb2ac){var _0x16d156=_0x1cb2ac[_0xc15a('0x41')](/"(.*?)"/);return _0x16d156?_0x16d156[0x1]:_0x1cb2ac;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x2d759d,_0x34d9a1,_0x22d720){if(!_[_0xc15a('0x42')](_0x22d720)&&typeof _0x22d720===_0xc15a('0x43')&&!_[_0xc15a('0x32')](_0x22d720)){if(!_[_0xc15a('0x42')](_0x34d9a1)&&typeof _0x34d9a1===_0xc15a('0x43')&&!_[_0xc15a('0x32')](_0x34d9a1)){return util[_0xc15a('0x44')](_0xc15a('0x45'),_0x34d9a1,_0x22d720);}return util[_0xc15a('0x44')](_0xc15a('0x45'),_0x22d720,_0x22d720);}if(!_[_0xc15a('0x42')](_0x2d759d)&&typeof _0x2d759d==='string'&&!_[_0xc15a('0x32')](_0x2d759d)){return _0x2d759d;}return _0xc15a('0x46');}exports[_0xc15a('0x47')]=getCallerId;function getCallerIdRandom(_0x17aa58,_0x5693d1){var _0x4cac9d;var _0x3b5d67;var _0x2b3cad;if(_0x5693d1<=0x0){_0x5693d1=0x1;}_0x4cac9d=new RegExp(_0xc15a('0x48')+_0x5693d1+'}$');_0x3b5d67=Math[_0xc15a('0x49')](0xa,_0x5693d1-0x1);_0x2b3cad=Math['pow'](0xa,_0x5693d1)-0x1;return util[_0xc15a('0x44')]('%s',_[_0xc15a('0x4a')](_0x17aa58,_0x4cac9d,_[_0xc15a('0x4b')](_0x3b5d67,_0x2b3cad)[_0xc15a('0x4c')]()));}exports[_0xc15a('0x4d')]=getCallerIdRandom;function decrementOriginate(_0xb053e5,_0x4ad1a0){if(_0xb053e5[_0xc15a('0x27')]&&_0xb053e5[_0xc15a('0x27')]>0x0){_0xb053e5[_0xc15a('0x27')]-=0x1;}else{logger[_0xc15a('0x4e')](_0xc15a('0x4f'),_0x4ad1a0);}}exports[_0xc15a('0x50')]=decrementOriginate;function checkContactEmpty(_0x578413){return _0x578413&&_0x578413[_0xc15a('0x51')]>0x0;}exports[_0xc15a('0x52')]=checkContactEmpty;function erlangb(_0x22d7d4,_0x2999d5){if(_0x2999d5===0x0){return 0x0;}var _0x171d12=0x1;for(var _0x147323=0x1;_0x147323<=_0x2999d5;_0x147323+=0x1){_0x171d12=0x1+_0x171d12*_0x147323/_0x22d7d4;}return 0x1/_0x171d12;}exports[_0xc15a('0x53')]=erlangb;function checkContactLowerLimitOriginate(_0x74d2e7,_0x2cbad9,_0x329980){if(_0x2cbad9>_0x329980){for(var _0x4e3d2a=0x0;_0x4e3d2a<_0x2cbad9-_0x329980;_0x4e3d2a+=0x1){decrementOriginate(_0x74d2e7,_0xc15a('0x54'));}}}exports[_0xc15a('0x55')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x110f8e){var _0x24e5dc={};var _0x4fec06=['id',_0xc15a('0x56'),_0xc15a('0x57'),_0xc15a('0x58')];const _0x493bb5=0xfa;if(_0x110f8e){for(var _0x2ff781 in _0x110f8e){if(typeof _0x110f8e[_0x2ff781]!==_0xc15a('0x59')){if(!_[_0xc15a('0x2d')](_0x110f8e[_0x2ff781])&&!_0x4fec06['includes'](_0x2ff781)){if(_0x2ff781==='description'&&_0x110f8e[_0x2ff781][_0xc15a('0x51')]>_0x493bb5){_0x24e5dc['XMD-'+_0x2ff781[_0xc15a('0x5a')]()]=_0x110f8e[_0x2ff781]['toString']()[_0xc15a('0x5b')](0x0,_0x493bb5);}else{_0x24e5dc[_0xc15a('0x5c')+_0x2ff781['toUpperCase']()]=_0x110f8e[_0x2ff781];}}}}}return _0x24e5dc;}exports[_0xc15a('0x5d')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 8616d67..d3f73d1 100644 --- a/server/services/ami/fax/action.js +++ b/server/services/ami/fax/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x50db68,_0x14acdd){var _0x136e75=function(_0x13764e){while(--_0x13764e){_0x50db68['push'](_0x50db68['shift']());}};_0x136e75(++_0x14acdd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x67a2fe,_0x47c07a){var _0x3cd6e3=function(_0x5d48d2){while(--_0x5d48d2){_0x67a2fe['push'](_0x67a2fe['shift']());}};_0x3cd6e3(++_0x47c07a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index f1c7a7d..0d3d67c 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 _0x26cc=['actions','newchannel','bind','varset','syncVarSet','newstate','syncNewExten','syncFaxStatus','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','exten','localstationid','channels','uniqueid','channel','info','\x20syncNewchannel\x20','variable','hasOwnProperty','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','name','.pdf','then','notify','catch','stringify','error','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','deleteChannelAfterTimeout','util','lodash','bluebird','uuid','moment','path','tiff2pdf','../../../config/logger','fax','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks'];(function(_0x44206a,_0x3ead85){var _0x483f11=function(_0x239516){while(--_0x239516){_0x44206a['push'](_0x44206a['shift']());}};_0x483f11(++_0x3ead85);}(_0x26cc,0x65));var _0xc26c=function(_0x305c31,_0x466b17){_0x305c31=_0x305c31-0x0;var _0x17f39f=_0x26cc[_0x305c31];return _0x17f39f;};'use strict';var util=require(_0xc26c('0x0'));var _=require(_0xc26c('0x1'));var BPromise=require(_0xc26c('0x2'));var uuid=require(_0xc26c('0x3'));var moment=require(_0xc26c('0x4'));var path=require(_0xc26c('0x5'));var tiff2pdf=require(_0xc26c('0x6'));var gs=require('./util/gs');var logger=require(_0xc26c('0x7'))(_0xc26c('0x8'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0xc26c('0x9'));var ut=require(_0xc26c('0xa'));var Action=require(_0xc26c('0xb'));var faxAccount=require(_0xc26c('0xc'));var attachment=require(_0xc26c('0xd'));var faxMessage=require(_0xc26c('0xe'));function Fax(_0x1e5a23){this['channels']={};this[_0xc26c('0xf')]=_0x1e5a23['faxAccounts'];this[_0xc26c('0x10')]=_0x1e5a23[_0xc26c('0x10')];this[_0xc26c('0x11')]={};ami['on'](_0xc26c('0x12'),this['syncNewchannel'][_0xc26c('0x13')](this));ami['on'](_0xc26c('0x14'),this[_0xc26c('0x15')]['bind'](this));ami['on'](_0xc26c('0x16'),this['syncNewState'][_0xc26c('0x13')](this));ami['on']('newexten',this[_0xc26c('0x17')][_0xc26c('0x13')](this));ami['on']('faxstatus',this[_0xc26c('0x18')][_0xc26c('0x13')](this));ami['on']('receivefax',this[_0xc26c('0x19')]['bind'](this));ami['on']('hangup',this[_0xc26c('0x1a')][_0xc26c('0x13')](this));ami['on'](_0xc26c('0x1b'),this[_0xc26c('0x1c')][_0xc26c('0x13')](this));}Fax[_0xc26c('0x1d')]['syncNewchannel']=function(_0x315a7b){if(_0x315a7b[_0xc26c('0x1e')]===_0xc26c('0x1f')){for(var _0x16c3af in this[_0xc26c('0xf')]){if(this[_0xc26c('0xf')]['hasOwnProperty'](_0x16c3af)){if(_0x315a7b[_0xc26c('0x20')]===this[_0xc26c('0xf')][_0x16c3af][_0xc26c('0x21')]){this[_0xc26c('0x22')][_0x315a7b[_0xc26c('0x23')]]={};this[_0xc26c('0x22')][_0x315a7b[_0xc26c('0x23')]][_0xc26c('0x24')]=_0x315a7b['channel'];this[_0xc26c('0x22')][_0x315a7b['uniqueid']]['id']=this['faxAccounts'][_0x16c3af]['id'];this[_0xc26c('0x22')][_0x315a7b[_0xc26c('0x23')]]['name']=this['faxAccounts'][_0x16c3af]['name'];logger[_0xc26c('0x25')](_0x315a7b['uniqueid'],_0xc26c('0x26'));}}}}if(this[_0xc26c('0x11')][_0x315a7b['uniqueid']]){this['channels'][_0x315a7b[_0xc26c('0x23')]]={};this[_0xc26c('0x22')][_0x315a7b[_0xc26c('0x23')]][_0xc26c('0x24')]=_0x315a7b['channel'];logger[_0xc26c('0x25')](_0x315a7b[_0xc26c('0x23')],_0xc26c('0x26'));}};Fax[_0xc26c('0x1d')][_0xc26c('0x15')]=function(_0x269d00){if(this[_0xc26c('0x22')][_0x269d00[_0xc26c('0x23')]]){for(var _0xa1fb54 in _0x269d00[_0xc26c('0x27')]){if(_0x269d00[_0xc26c('0x27')][_0xc26c('0x28')](_0xa1fb54)){this[_0xc26c('0x22')][_0x269d00['uniqueid']][_0xa1fb54]=_0x269d00[_0xc26c('0x29')];}}}};Fax[_0xc26c('0x1d')]['syncNewState']=function(_0x1c2c8){if(this[_0xc26c('0x22')][_0x1c2c8[_0xc26c('0x23')]]){this['channels'][_0x1c2c8[_0xc26c('0x23')]][_0xc26c('0x2a')]=_0x1c2c8[_0xc26c('0x2a')];this[_0xc26c('0x22')][_0x1c2c8[_0xc26c('0x23')]][_0xc26c('0x2b')]=_0x1c2c8[_0xc26c('0x2b')];}};Fax['prototype'][_0xc26c('0x17')]=function(_0x507c78){if(this[_0xc26c('0x22')][_0x507c78['uniqueid']]){for(var _0xc08c3b in _0x507c78[_0xc26c('0x27')]){if(_0x507c78['variable'][_0xc26c('0x28')](_0xc08c3b)){this[_0xc26c('0x22')][_0x507c78[_0xc26c('0x23')]][_0xc08c3b]=_0x507c78[_0xc26c('0x29')];}}}};Fax['prototype'][_0xc26c('0x18')]=function(_0x4628b3){if(this[_0xc26c('0x22')][_0x4628b3[_0xc26c('0x23')]]){this['channels'][_0x4628b3['uniqueid']][_0xc26c('0x2c')]=_0x4628b3[_0xc26c('0x2c')];this[_0xc26c('0x22')][_0x4628b3[_0xc26c('0x23')]]['status']=_0x4628b3[_0xc26c('0x2d')];this['channels'][_0x4628b3['uniqueid']][_0xc26c('0x21')]=_0x4628b3[_0xc26c('0x21')];this[_0xc26c('0x22')][_0x4628b3[_0xc26c('0x23')]][_0xc26c('0x2e')]=_0x4628b3[_0xc26c('0x2e')];logger[_0xc26c('0x25')](_0x4628b3[_0xc26c('0x23')],_0xc26c('0x2f'));}};Fax['prototype'][_0xc26c('0x19')]=function(_0x51712b){var _0x5645ba=this;if(this[_0xc26c('0x22')][_0x51712b[_0xc26c('0x23')]]){var _0x120d27=this[_0xc26c('0x22')][_0x51712b[_0xc26c('0x23')]]['id'];this['channels'][_0x51712b['uniqueid']][_0xc26c('0x30')]=_0x51712b[_0xc26c('0x30')];this[_0xc26c('0x22')][_0x51712b[_0xc26c('0x23')]][_0xc26c('0x31')]=_0x51712b[_0xc26c('0x31')];this[_0xc26c('0x22')][_0x51712b[_0xc26c('0x23')]][_0xc26c('0x21')]=_0x51712b[_0xc26c('0x21')];this[_0xc26c('0x22')][_0x51712b[_0xc26c('0x23')]]['resolution']=_0x51712b[_0xc26c('0x32')];this['channels'][_0x51712b['uniqueid']][_0xc26c('0x33')]=_0x51712b[_0xc26c('0x33')];this[_0xc26c('0x22')][_0x51712b[_0xc26c('0x23')]][_0xc26c('0x2e')]=_0x51712b['filename'];this[_0xc26c('0x22')][_0x51712b['uniqueid']]['calleridnum']=_0x51712b[_0xc26c('0x34')];if(this[_0xc26c('0x22')][_0x51712b[_0xc26c('0x23')]]['pagestransferred']>0x0){tiff2pdf(_0x51712b[_0xc26c('0x2e')],_0xc26c('0x35'),function(_0x562a73){logger[_0xc26c('0x25')](_0x51712b[_0xc26c('0x23')],_0xc26c('0x36'),_0x562a73['message']);attachment[_0xc26c('0x37')]({'name':path[_0xc26c('0x38')](_0x51712b[_0xc26c('0x2e')])[_0xc26c('0x39')],'basename':path['parse'](_0x51712b[_0xc26c('0x2e')])['name']+_0xc26c('0x3a'),'type':'application/pdf'})[_0xc26c('0x3b')](function(_0x4c02a4){faxAccount[_0xc26c('0x3c')](_0x120d27,{'from':_0x51712b[_0xc26c('0x34')],'mapKey':_0xc26c('0x8'),'body':path[_0xc26c('0x38')](_0x51712b['filename'])[_0xc26c('0x39')]+_0xc26c('0x3a'),'AttachmentId':_0x4c02a4['id']})[_0xc26c('0x3d')](function(_0x3ebd5e){logger['error'](_0x51712b[_0xc26c('0x23')],'\x20notify\x20',JSON[_0xc26c('0x3e')](_0x3ebd5e));});})[_0xc26c('0x3d')](function(_0x37da8d){logger[_0xc26c('0x3f')](_0x51712b[_0xc26c('0x23')],_0xc26c('0x40'),JSON['stringify'](_0x37da8d));});});}logger[_0xc26c('0x25')](_0x51712b[_0xc26c('0x23')],_0xc26c('0x40'));}};Fax['prototype']['syncOriginateResponse']=function(_0x289362){if(this['actions'][_0x289362[_0xc26c('0x23')]]){_['merge'](this[_0xc26c('0x22')][_0x289362['uniqueid']],_[_0xc26c('0x41')](_0x289362,[_0xc26c('0x42'),_0xc26c('0x43')]));}};function updateStatus(_0xb5df16){if(_0xb5df16[_0xc26c('0x44')]){faxMessage[_0xc26c('0x45')](_0xb5df16[_0xc26c('0x44')],{'failMessage':_0xc26c('0x46')})[_0xc26c('0x3b')](function(_0x49832d){ut[_0xc26c('0x47')]('[Fax][Message][Error][Updated]',_0x49832d);})['catch'](function(_0xeca81c){ut[_0xc26c('0x47')](_0xc26c('0x48'),_0xeca81c);});}else{ut[_0xc26c('0x47')](_0xc26c('0x49'));}}Fax[_0xc26c('0x1d')][_0xc26c('0x4a')]=function(_0x5bac28,_0x127547,_0x1cde02){var _0x2d5f40=this;var _0x574fc6={};if(_0x127547){_0x574fc6={'read':_0x127547};}else{_0x574fc6={'failMessage':_0x1cde02};}if(this[_0xc26c('0x11')][_0x5bac28][_0xc26c('0x44')]){faxMessage[_0xc26c('0x45')](this[_0xc26c('0x11')][_0x5bac28]['AttachmentId'],_0x574fc6)['then'](function(_0x214cfe){ut[_0xc26c('0x47')](_0xc26c('0x4b'),_0x214cfe);})[_0xc26c('0x3d')](function(_0x25a00b){ut['logger'](_0xc26c('0x4c'),_0x25a00b);})['finally'](function(){delete _0x2d5f40[_0xc26c('0x22')][_0x5bac28];delete _0x2d5f40[_0xc26c('0x11')][_0x5bac28];});}else{ut[_0xc26c('0x47')](_0xc26c('0x4d'));this['deleteChannelAfterTimeout'](_0x5bac28);delete this[_0xc26c('0x11')][_0x5bac28];}};Fax['prototype']['syncHangup']=function(_0x442618){var _0x2620dd=this;if(this[_0xc26c('0x22')][_0x442618['uniqueid']]){if(this[_0xc26c('0x11')][_0x442618[_0xc26c('0x23')]]){this[_0xc26c('0x22')][_0x442618[_0xc26c('0x23')]]['id']=this[_0xc26c('0x11')][_0x442618['uniqueid']]['id'];this[_0xc26c('0x22')][_0x442618[_0xc26c('0x23')]][_0xc26c('0x39')]=this[_0xc26c('0x11')][_0x442618['uniqueid']]['name'];}logger['info'](_0x442618['uniqueid'],this[_0xc26c('0x11')][_0x442618[_0xc26c('0x23')]]?'\x20hangup\x20sendFile\x20':_0xc26c('0x4e'),JSON[_0xc26c('0x3e')](this['channels'][_0x442618['uniqueid']]));if(this['actions'][_0x442618[_0xc26c('0x23')]]){if(this[_0xc26c('0x22')][_0x442618[_0xc26c('0x23')]][_0xc26c('0x4f')]>0x0&&this[_0xc26c('0x22')][_0x442618[_0xc26c('0x23')]][_0xc26c('0x50')]===_0xc26c('0x51')){this['updateStatus'](_0x442618[_0xc26c('0x23')],!![]);}else{this[_0xc26c('0x4a')](_0x442618[_0xc26c('0x23')],![],this['channels'][_0x442618[_0xc26c('0x23')]][_0xc26c('0x52')]?_0xc26c('0x53')+this['channels'][_0x442618[_0xc26c('0x23')]]['faxstatusstring']:_0xc26c('0x54'));}}}};Fax[_0xc26c('0x1d')][_0xc26c('0x55')]=function(_0x39777b){var _0xbb11ea=this;return new BPromise(function(_0x387c01,_0x3fb04f){_0xbb11ea[_0xc26c('0x56')](_0x39777b,_0xbb11ea['faxAccounts'][_0x39777b[_0xc26c('0x57')]])[_0xc26c('0x3b')](function(_0x2c6c1a){ut[_0xc26c('0x47')](_0xc26c('0x58'),_0x2c6c1a);_0x387c01(ut[_0xc26c('0x59')](_0xc26c('0x5a')));})[_0xc26c('0x3d')](function(_0xca7eb2){ut[_0xc26c('0x47')]('[Fax][execOriginate][failure]',_0xca7eb2);updateStatus(_0x39777b);_0x3fb04f(ut[_0xc26c('0x59')](_0xc26c('0x5b')));});});};Fax[_0xc26c('0x1d')][_0xc26c('0x5c')]=function(_0x2db13c){var _0x415f5e=this;return new BPromise(function(_0x4327bb,_0x1cfa98){var _0x5aa0e7=_0x415f5e[_0xc26c('0x5d')](_0x415f5e['faxAccounts'][_0x2db13c[_0xc26c('0x57')]]['Trunk'],_0x2db13c);if(_0x5aa0e7[_0xc26c('0x5e')]){_0x4327bb(ut['message'](_0xc26c('0x5f')));}else{_0x1cfa98(ut[_0xc26c('0x59')](_0x5aa0e7['message']));}});};function originate(_0x4fae79,_0x3c7fc8,_0xa3203d){return new BPromise(function(_0x511e25,_0x3c8012){if(_0xa3203d){var _0x1e41d7=util[_0xc26c('0x60')](_0xc26c('0x61'),path[_0xc26c('0x38')](_0x4fae79[_0xc26c('0x5')])[_0xc26c('0x39')],_0x4fae79[_0xc26c('0x5')]);gs[_0xc26c('0x62')](_0x1e41d7)['then'](function(){_0x4fae79[_0xc26c('0x5')]=util[_0xc26c('0x60')](_0xc26c('0x63'),path[_0xc26c('0x38')](_0x4fae79[_0xc26c('0x5')])[_0xc26c('0x64')],path[_0xc26c('0x38')](_0x4fae79[_0xc26c('0x5')])['name']);_0x3c7fc8[_0xc26c('0x65')]=_0x4fae79[_0xc26c('0x5')];ut['logger'](_0xc26c('0x66'),'');ami[_0xc26c('0x67')](ut[_0xc26c('0x68')](_0x4fae79,_0x3c7fc8))[_0xc26c('0x3b')](function(_0x1bc0ff){_0x511e25(_0x1bc0ff);})[_0xc26c('0x3d')](function(_0x4cd50d){_0x3c8012(_0x4cd50d);});})[_0xc26c('0x3d')](function(_0x404abe){_0x3c8012(_0x404abe);});}else{ami[_0xc26c('0x67')](ut[_0xc26c('0x68')](_0x4fae79,_0x3c7fc8))[_0xc26c('0x3b')](function(_0x492e36){_0x511e25(_0x492e36);})[_0xc26c('0x3d')](function(_0x1f255b){_0x3c8012(_0x1f255b);});}});}Fax[_0xc26c('0x1d')][_0xc26c('0x56')]=function(_0x851019,_0x404bb0){var _0x18a93c=this;return new BPromise(function(_0x9efae6,_0x5205ed){var _0x57199e=uuid['v4']();var _0x2def77=ut['addVariables'](_0x851019,_0x404bb0);_0x18a93c['actions'][_0x57199e]=new Action(_0x57199e,_0x404bb0,_0x851019);var _0x901db=_0x18a93c[_0xc26c('0x11')][_0x57199e];if(path['parse'](_0x851019[_0xc26c('0x5')])[_0xc26c('0x69')]==='.pdf'){originate(_0x901db,_0x2def77,!![])[_0xc26c('0x3b')](function(_0x1186d1){_0x9efae6(_0x1186d1);})['catch'](function(_0x2a44f6){_0x5205ed(_0x2a44f6);});}else{originate(_0x901db,_0x2def77,![])['then'](function(_0x2de4c1){_0x9efae6(_0x2de4c1);})[_0xc26c('0x3d')](function(_0x6f4dd7){_0x5205ed(_0x6f4dd7);});}});};Fax['prototype'][_0xc26c('0x6a')]=function(_0x2b1c07){return!_[_0xc26c('0x6b')](_0x2b1c07)&&!_[_0xc26c('0x6b')](_0x2b1c07[_0xc26c('0x39')])&&!_[_0xc26c('0x6b')](_0x2b1c07[_0xc26c('0x6c')])&&_0x2b1c07[_0xc26c('0x6c')]&&!_[_0xc26c('0x6b')](this['trunks'][util[_0xc26c('0x60')](_0xc26c('0x6d'),_0x2b1c07[_0xc26c('0x39')])])&&!_[_0xc26c('0x6b')](this[_0xc26c('0x10')][util['format']('SIP/%s',_0x2b1c07[_0xc26c('0x39')])][_0xc26c('0x2d')])&&(this['trunks'][util[_0xc26c('0x60')](_0xc26c('0x6d'),_0x2b1c07['name'])][_0xc26c('0x2d')]===_0xc26c('0x6e')||this['trunks'][util['format'](_0xc26c('0x6d'),_0x2b1c07['name'])][_0xc26c('0x2d')]===_0xc26c('0x6f'));};Fax[_0xc26c('0x1d')][_0xc26c('0x5d')]=function(_0x29d4eb,_0xbe5514){if(!this[_0xc26c('0x6a')](_0x29d4eb)){ut[_0xc26c('0x47')](_0xc26c('0x70'),_['isNil'](_0x29d4eb)?'':_0x29d4eb['name']+_0xc26c('0x71'));return{'isValid':![],'message':_0xc26c('0x72')};}if(_[_0xc26c('0x6b')](_0xbe5514['fax'])){ut[_0xc26c('0x47')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xc26c('0x3e')](_0xbe5514));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xc26c('0x6b')](_0xbe5514[_0xc26c('0x5')])){ut['logger'](_0xc26c('0x73'),JSON[_0xc26c('0x3e')](_0xbe5514));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xc26c('0x74')};};Fax[_0xc26c('0x1d')][_0xc26c('0x75')]=function(_0x536ff5,_0x136ad8=0x2710){if(this[_0xc26c('0x22')][_0x536ff5]){setTimeout(()=>{delete this[_0xc26c('0x22')][_0x536ff5];},_0x136ad8);}};module['exports']=Fax; \ No newline at end of file +var _0x2d27=['catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','isValid','format','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','.pdf','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','path','tiff2pdf','./util/gs','fax','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','notify'];(function(_0x3ab6bf,_0x710fa2){var _0x166506=function(_0xe66634){while(--_0xe66634){_0x3ab6bf['push'](_0x3ab6bf['shift']());}};_0x166506(++_0x710fa2);}(_0x2d27,0x1ac));var _0x72d2=function(_0x26cb03,_0x38d271){_0x26cb03=_0x26cb03-0x0;var _0x5b7ac9=_0x2d27[_0x26cb03];return _0x5b7ac9;};'use strict';var util=require(_0x72d2('0x0'));var _=require(_0x72d2('0x1'));var BPromise=require(_0x72d2('0x2'));var uuid=require(_0x72d2('0x3'));var moment=require('moment');var path=require(_0x72d2('0x4'));var tiff2pdf=require(_0x72d2('0x5'));var gs=require(_0x72d2('0x6'));var logger=require('../../../config/logger')(_0x72d2('0x7'));var ami=require('../ami');var rpcDb=require(_0x72d2('0x8'));var Channel=require('./channel');var ut=require(_0x72d2('0x9'));var Action=require(_0x72d2('0xa'));var faxAccount=require(_0x72d2('0xb'));var attachment=require(_0x72d2('0xc'));var faxMessage=require(_0x72d2('0xd'));function Fax(_0x54e1ef){this[_0x72d2('0xe')]={};this['faxAccounts']=_0x54e1ef[_0x72d2('0xf')];this[_0x72d2('0x10')]=_0x54e1ef[_0x72d2('0x10')];this[_0x72d2('0x11')]={};ami['on'](_0x72d2('0x12'),this[_0x72d2('0x13')][_0x72d2('0x14')](this));ami['on'](_0x72d2('0x15'),this[_0x72d2('0x16')][_0x72d2('0x14')](this));ami['on'](_0x72d2('0x17'),this['syncNewState'][_0x72d2('0x14')](this));ami['on'](_0x72d2('0x18'),this[_0x72d2('0x19')][_0x72d2('0x14')](this));ami['on'](_0x72d2('0x1a'),this[_0x72d2('0x1b')]['bind'](this));ami['on']('receivefax',this[_0x72d2('0x1c')][_0x72d2('0x14')](this));ami['on'](_0x72d2('0x1d'),this[_0x72d2('0x1e')][_0x72d2('0x14')](this));ami['on'](_0x72d2('0x1f'),this[_0x72d2('0x20')][_0x72d2('0x14')](this));}Fax[_0x72d2('0x21')]['syncNewchannel']=function(_0x15faa7){if(_0x15faa7[_0x72d2('0x22')]==='from-voip-provider'){for(var _0x3c4df3 in this[_0x72d2('0xf')]){if(this[_0x72d2('0xf')][_0x72d2('0x23')](_0x3c4df3)){if(_0x15faa7[_0x72d2('0x24')]===this[_0x72d2('0xf')][_0x3c4df3][_0x72d2('0x25')]){this[_0x72d2('0xe')][_0x15faa7[_0x72d2('0x26')]]={};this[_0x72d2('0xe')][_0x15faa7[_0x72d2('0x26')]][_0x72d2('0x27')]=_0x15faa7[_0x72d2('0x27')];this[_0x72d2('0xe')][_0x15faa7['uniqueid']]['id']=this[_0x72d2('0xf')][_0x3c4df3]['id'];this[_0x72d2('0xe')][_0x15faa7['uniqueid']][_0x72d2('0x28')]=this[_0x72d2('0xf')][_0x3c4df3]['name'];logger[_0x72d2('0x29')](_0x15faa7[_0x72d2('0x26')],'\x20syncNewchannel\x20');}}}}if(this[_0x72d2('0x11')][_0x15faa7[_0x72d2('0x26')]]){this['channels'][_0x15faa7['uniqueid']]={};this[_0x72d2('0xe')][_0x15faa7[_0x72d2('0x26')]][_0x72d2('0x27')]=_0x15faa7[_0x72d2('0x27')];logger[_0x72d2('0x29')](_0x15faa7['uniqueid'],_0x72d2('0x2a'));}};Fax[_0x72d2('0x21')][_0x72d2('0x16')]=function(_0x5e2402){if(this[_0x72d2('0xe')][_0x5e2402[_0x72d2('0x26')]]){for(var _0x4d911e in _0x5e2402['variable']){if(_0x5e2402[_0x72d2('0x2b')][_0x72d2('0x23')](_0x4d911e)){this[_0x72d2('0xe')][_0x5e2402[_0x72d2('0x26')]][_0x4d911e]=_0x5e2402[_0x72d2('0x2c')];}}}};Fax[_0x72d2('0x21')][_0x72d2('0x2d')]=function(_0x1ef29c){if(this[_0x72d2('0xe')][_0x1ef29c[_0x72d2('0x26')]]){this[_0x72d2('0xe')][_0x1ef29c['uniqueid']][_0x72d2('0x2e')]=_0x1ef29c['channelstate'];this['channels'][_0x1ef29c['uniqueid']]['channelstatedesc']=_0x1ef29c[_0x72d2('0x2f')];}};Fax[_0x72d2('0x21')]['syncNewExten']=function(_0x59d6d0){if(this[_0x72d2('0xe')][_0x59d6d0[_0x72d2('0x26')]]){for(var _0x5ede92 in _0x59d6d0[_0x72d2('0x2b')]){if(_0x59d6d0['variable'][_0x72d2('0x23')](_0x5ede92)){this[_0x72d2('0xe')][_0x59d6d0[_0x72d2('0x26')]][_0x5ede92]=_0x59d6d0[_0x72d2('0x2c')];}}}};Fax[_0x72d2('0x21')][_0x72d2('0x1b')]=function(_0x15ff3c){if(this[_0x72d2('0xe')][_0x15ff3c['uniqueid']]){this[_0x72d2('0xe')][_0x15ff3c[_0x72d2('0x26')]][_0x72d2('0x30')]=_0x15ff3c[_0x72d2('0x30')];this[_0x72d2('0xe')][_0x15ff3c[_0x72d2('0x26')]]['status']=_0x15ff3c[_0x72d2('0x31')];this['channels'][_0x15ff3c['uniqueid']][_0x72d2('0x25')]=_0x15ff3c[_0x72d2('0x25')];this[_0x72d2('0xe')][_0x15ff3c[_0x72d2('0x26')]][_0x72d2('0x32')]=_0x15ff3c[_0x72d2('0x32')];logger[_0x72d2('0x29')](_0x15ff3c[_0x72d2('0x26')],'\x20syncFaxStatus\x20');}};Fax['prototype']['syncReceiveFax']=function(_0x4fff64){var _0x1c8788=this;if(this[_0x72d2('0xe')][_0x4fff64['uniqueid']]){var _0x132342=this[_0x72d2('0xe')][_0x4fff64[_0x72d2('0x26')]]['id'];this[_0x72d2('0xe')][_0x4fff64[_0x72d2('0x26')]][_0x72d2('0x33')]=_0x4fff64[_0x72d2('0x33')];this[_0x72d2('0xe')][_0x4fff64[_0x72d2('0x26')]][_0x72d2('0x34')]=_0x4fff64[_0x72d2('0x34')];this[_0x72d2('0xe')][_0x4fff64[_0x72d2('0x26')]]['localstationid']=_0x4fff64['localstationid'];this[_0x72d2('0xe')][_0x4fff64[_0x72d2('0x26')]][_0x72d2('0x35')]=_0x4fff64[_0x72d2('0x35')];this[_0x72d2('0xe')][_0x4fff64[_0x72d2('0x26')]][_0x72d2('0x36')]=_0x4fff64[_0x72d2('0x36')];this[_0x72d2('0xe')][_0x4fff64[_0x72d2('0x26')]][_0x72d2('0x32')]=_0x4fff64[_0x72d2('0x32')];this['channels'][_0x4fff64[_0x72d2('0x26')]][_0x72d2('0x37')]=_0x4fff64['calleridnum'];if(this[_0x72d2('0xe')][_0x4fff64['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x4fff64[_0x72d2('0x32')],_0x72d2('0x38'),function(_0x473a08){logger[_0x72d2('0x29')](_0x4fff64[_0x72d2('0x26')],_0x72d2('0x39'),_0x473a08[_0x72d2('0x3a')]);attachment[_0x72d2('0x3b')]({'name':path[_0x72d2('0x3c')](_0x4fff64[_0x72d2('0x32')])[_0x72d2('0x28')],'basename':path[_0x72d2('0x3c')](_0x4fff64[_0x72d2('0x32')])[_0x72d2('0x28')]+'.pdf','type':_0x72d2('0x3d')})[_0x72d2('0x3e')](function(_0x2b6586){faxAccount[_0x72d2('0x3f')](_0x132342,{'from':_0x4fff64[_0x72d2('0x37')],'mapKey':_0x72d2('0x7'),'body':path[_0x72d2('0x3c')](_0x4fff64['filename'])['name']+'.pdf','AttachmentId':_0x2b6586['id']})[_0x72d2('0x40')](function(_0x244fa2){logger[_0x72d2('0x41')](_0x4fff64['uniqueid'],_0x72d2('0x42'),JSON[_0x72d2('0x43')](_0x244fa2));});})[_0x72d2('0x40')](function(_0x2bd5a9){logger[_0x72d2('0x41')](_0x4fff64['uniqueid'],_0x72d2('0x44'),JSON[_0x72d2('0x43')](_0x2bd5a9));});});}logger['info'](_0x4fff64[_0x72d2('0x26')],'\x20receiveFax\x20');}};Fax[_0x72d2('0x21')][_0x72d2('0x20')]=function(_0x2926e3){if(this[_0x72d2('0x11')][_0x2926e3['uniqueid']]){_[_0x72d2('0x45')](this[_0x72d2('0xe')][_0x2926e3[_0x72d2('0x26')]],_[_0x72d2('0x46')](_0x2926e3,[_0x72d2('0x47'),_0x72d2('0x48')]));}};function updateStatus(_0x5d6e3c){if(_0x5d6e3c[_0x72d2('0x49')]){faxMessage[_0x72d2('0x4a')](_0x5d6e3c[_0x72d2('0x49')],{'failMessage':_0x72d2('0x4b')})[_0x72d2('0x3e')](function(_0x2d67dd){ut['logger']('[Fax][Message][Error][Updated]',_0x2d67dd);})['catch'](function(_0x384210){ut[_0x72d2('0x4c')](_0x72d2('0x4d'),_0x384210);});}else{ut[_0x72d2('0x4c')](_0x72d2('0x4e'));}}Fax[_0x72d2('0x21')]['updateStatus']=function(_0x254714,_0x3f4751,_0x2d6c64){var _0x4fffba=this;var _0x20d906={};if(_0x3f4751){_0x20d906={'read':_0x3f4751};}else{_0x20d906={'failMessage':_0x2d6c64};}if(this[_0x72d2('0x11')][_0x254714][_0x72d2('0x49')]){faxMessage[_0x72d2('0x4a')](this[_0x72d2('0x11')][_0x254714][_0x72d2('0x49')],_0x20d906)['then'](function(_0x5f4c4a){ut[_0x72d2('0x4c')]('[Fax][Message][Updated]',_0x5f4c4a);})['catch'](function(_0x11204b){ut[_0x72d2('0x4c')](_0x72d2('0x4f'),_0x11204b);})[_0x72d2('0x50')](function(){delete _0x4fffba[_0x72d2('0xe')][_0x254714];delete _0x4fffba[_0x72d2('0x11')][_0x254714];});}else{ut[_0x72d2('0x4c')](_0x72d2('0x51'));this[_0x72d2('0x52')](_0x254714);delete this[_0x72d2('0x11')][_0x254714];}};Fax[_0x72d2('0x21')][_0x72d2('0x1e')]=function(_0x1d9806){var _0x3ba20d=this;if(this[_0x72d2('0xe')][_0x1d9806[_0x72d2('0x26')]]){if(this[_0x72d2('0x11')][_0x1d9806[_0x72d2('0x26')]]){this[_0x72d2('0xe')][_0x1d9806['uniqueid']]['id']=this[_0x72d2('0x11')][_0x1d9806[_0x72d2('0x26')]]['id'];this[_0x72d2('0xe')][_0x1d9806[_0x72d2('0x26')]][_0x72d2('0x28')]=this['actions'][_0x1d9806[_0x72d2('0x26')]][_0x72d2('0x28')];}logger[_0x72d2('0x29')](_0x1d9806['uniqueid'],this[_0x72d2('0x11')][_0x1d9806[_0x72d2('0x26')]]?_0x72d2('0x53'):_0x72d2('0x54'),JSON[_0x72d2('0x43')](this[_0x72d2('0xe')][_0x1d9806[_0x72d2('0x26')]]));if(this[_0x72d2('0x11')][_0x1d9806['uniqueid']]){if(this[_0x72d2('0xe')][_0x1d9806[_0x72d2('0x26')]][_0x72d2('0x55')]>0x0&&this[_0x72d2('0xe')][_0x1d9806[_0x72d2('0x26')]][_0x72d2('0x1a')]===_0x72d2('0x56')){this[_0x72d2('0x57')](_0x1d9806[_0x72d2('0x26')],!![]);}else{this[_0x72d2('0x57')](_0x1d9806[_0x72d2('0x26')],![],this[_0x72d2('0xe')][_0x1d9806[_0x72d2('0x26')]][_0x72d2('0x58')]?_0x72d2('0x59')+this['channels'][_0x1d9806[_0x72d2('0x26')]][_0x72d2('0x58')]:_0x72d2('0x5a'));}}}};Fax['prototype'][_0x72d2('0x5b')]=function(_0x121059){var _0x4d5bfd=this;return new BPromise(function(_0x44e3fa,_0x2b0b70){_0x4d5bfd[_0x72d2('0x5c')](_0x121059,_0x4d5bfd[_0x72d2('0xf')][_0x121059[_0x72d2('0x5d')]])['then'](function(_0x534f99){ut[_0x72d2('0x4c')](_0x72d2('0x5e'),_0x534f99);_0x44e3fa(ut['message'](_0x72d2('0x5f')));})['catch'](function(_0x4f0677){ut[_0x72d2('0x4c')](_0x72d2('0x60'),_0x4f0677);updateStatus(_0x121059);_0x2b0b70(ut['message']('Fax\x20failed'));});});};Fax['prototype'][_0x72d2('0x61')]=function(_0x438e13){var _0x1dc614=this;return new BPromise(function(_0x21a452,_0x12816d){var _0x1889c1=_0x1dc614[_0x72d2('0x62')](_0x1dc614[_0x72d2('0xf')][_0x438e13[_0x72d2('0x5d')]][_0x72d2('0x63')],_0x438e13);if(_0x1889c1[_0x72d2('0x64')]){_0x21a452(ut['message']('Trunk\x20Reachable'));}else{_0x12816d(ut[_0x72d2('0x3a')](_0x1889c1[_0x72d2('0x3a')]));}});};function originate(_0xf6b3ac,_0x5f0fe8,_0x3a4084){return new BPromise(function(_0x2b76a2,_0x39d1dc){if(_0x3a4084){var _0x4d39ed=util[_0x72d2('0x65')]('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[_0x72d2('0x3c')](_0xf6b3ac[_0x72d2('0x4')])[_0x72d2('0x28')],_0xf6b3ac[_0x72d2('0x4')]);gs[_0x72d2('0x66')](_0x4d39ed)['then'](function(){_0xf6b3ac[_0x72d2('0x4')]=util[_0x72d2('0x65')]('%s/%s.tif',path[_0x72d2('0x3c')](_0xf6b3ac[_0x72d2('0x4')])[_0x72d2('0x67')],path['parse'](_0xf6b3ac[_0x72d2('0x4')])[_0x72d2('0x28')]);_0x5f0fe8[_0x72d2('0x68')]=_0xf6b3ac['path'];ut[_0x72d2('0x4c')](_0x72d2('0x69'),'');ami[_0x72d2('0x6a')](ut[_0x72d2('0x6b')](_0xf6b3ac,_0x5f0fe8))[_0x72d2('0x3e')](function(_0x9a8aca){_0x2b76a2(_0x9a8aca);})['catch'](function(_0x169f13){_0x39d1dc(_0x169f13);});})[_0x72d2('0x40')](function(_0x301625){_0x39d1dc(_0x301625);});}else{ami[_0x72d2('0x6a')](ut[_0x72d2('0x6b')](_0xf6b3ac,_0x5f0fe8))['then'](function(_0x3d5a3c){_0x2b76a2(_0x3d5a3c);})['catch'](function(_0x434186){_0x39d1dc(_0x434186);});}});}Fax['prototype']['execOriginate']=function(_0x2cb421,_0x1c520a){var _0x58a21d=this;return new BPromise(function(_0x1a5708,_0x46caf4){var _0x46efb0=uuid['v4']();var _0x2f5eda=ut[_0x72d2('0x6c')](_0x2cb421,_0x1c520a);_0x58a21d[_0x72d2('0x11')][_0x46efb0]=new Action(_0x46efb0,_0x1c520a,_0x2cb421);var _0x9a7156=_0x58a21d['actions'][_0x46efb0];if(path[_0x72d2('0x3c')](_0x2cb421[_0x72d2('0x4')])[_0x72d2('0x6d')]===_0x72d2('0x6e')){originate(_0x9a7156,_0x2f5eda,!![])[_0x72d2('0x3e')](function(_0x5057b0){_0x1a5708(_0x5057b0);})[_0x72d2('0x40')](function(_0x26804b){_0x46caf4(_0x26804b);});}else{originate(_0x9a7156,_0x2f5eda,![])['then'](function(_0x1e834d){_0x1a5708(_0x1e834d);})['catch'](function(_0x287fcf){_0x46caf4(_0x287fcf);});}});};Fax['prototype'][_0x72d2('0x6f')]=function(_0x138b51){return!_[_0x72d2('0x70')](_0x138b51)&&!_['isNil'](_0x138b51[_0x72d2('0x28')])&&!_[_0x72d2('0x70')](_0x138b51[_0x72d2('0x71')])&&_0x138b51[_0x72d2('0x71')]&&!_['isNil'](this[_0x72d2('0x10')][util['format'](_0x72d2('0x72'),_0x138b51[_0x72d2('0x28')])])&&!_['isNil'](this['trunks'][util['format'](_0x72d2('0x72'),_0x138b51[_0x72d2('0x28')])]['status'])&&(this[_0x72d2('0x10')][util['format'](_0x72d2('0x72'),_0x138b51[_0x72d2('0x28')])][_0x72d2('0x31')]===_0x72d2('0x73')||this[_0x72d2('0x10')][util[_0x72d2('0x65')](_0x72d2('0x72'),_0x138b51[_0x72d2('0x28')])][_0x72d2('0x31')]===_0x72d2('0x74'));};Fax['prototype'][_0x72d2('0x62')]=function(_0x494005,_0x42a55e){if(!this['isTrunkReachable'](_0x494005)){ut[_0x72d2('0x4c')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x72d2('0x70')](_0x494005)?'':_0x494005[_0x72d2('0x28')]+_0x72d2('0x75'));return{'isValid':![],'message':_0x72d2('0x76')};}if(_[_0x72d2('0x70')](_0x42a55e[_0x72d2('0x7')])){ut['logger'](_0x72d2('0x77'),JSON[_0x72d2('0x43')](_0x42a55e));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x42a55e['path'])){ut[_0x72d2('0x4c')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x72d2('0x43')](_0x42a55e));return{'isValid':![],'message':_0x72d2('0x78')};}return{'isValid':!![],'message':_0x72d2('0x79')};};Fax[_0x72d2('0x21')]['deleteChannelAfterTimeout']=function(_0x4997c4,_0x4e994e=0x2710){if(this[_0x72d2('0xe')][_0x4997c4]){setTimeout(()=>{delete this['channels'][_0x4997c4];},_0x4e994e);}};module[_0x72d2('0x7a')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 318ff2c..c14b7bc 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 _0x0c71=['notify','resolve','then','catch','[Notify]\x20','util','lodash','error','inspect'];(function(_0x234e1e,_0x531528){var _0x22a084=function(_0x5de93d){while(--_0x5de93d){_0x234e1e['push'](_0x234e1e['shift']());}};_0x22a084(++_0x531528);}(_0x0c71,0x7a));var _0x10c7=function(_0x4aa87e,_0x33c69f){_0x4aa87e=_0x4aa87e-0x0;var _0x7072cd=_0x0c71[_0x4aa87e];return _0x7072cd;};'use strict';var util=require(_0x10c7('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')('preview');var _=require(_0x10c7('0x1'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x5acab4){return function(_0x908093){logger[_0x10c7('0x2')](_0x5acab4,util[_0x10c7('0x3')](_0x908093,{'showHidden':![],'depth':null}));};}exports[_0x10c7('0x4')]=function(_0x36e3ee,_0x3a9d27){return BPromise[_0x10c7('0x5')]()[_0x10c7('0x6')](faxAccount['notify'](_0x36e3ee,_0x3a9d27))[_0x10c7('0x7')](loggerCatch(_0x10c7('0x8')));}; \ No newline at end of file +var _0x7b47=['notify','resolve','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','inspect'];(function(_0x4db439,_0x162edf){var _0x3f46da=function(_0x1416ff){while(--_0x1416ff){_0x4db439['push'](_0x4db439['shift']());}};_0x3f46da(++_0x162edf);}(_0x7b47,0x138));var _0x77b4=function(_0x301062,_0x3f40a1){_0x301062=_0x301062-0x0;var _0x38fc91=_0x7b47[_0x301062];return _0x38fc91;};'use strict';var util=require(_0x77b4('0x0'));var BPromise=require(_0x77b4('0x1'));var logger=require(_0x77b4('0x2'))(_0x77b4('0x3'));var _=require(_0x77b4('0x4'));var faxAccount=require(_0x77b4('0x5'));function loggerCatch(_0x2cb90b){return function(_0x39b73d){logger['error'](_0x2cb90b,util[_0x77b4('0x6')](_0x39b73d,{'showHidden':![],'depth':null}));};}exports[_0x77b4('0x7')]=function(_0x4113ef,_0x2a8e74){return BPromise[_0x77b4('0x8')]()['then'](faxAccount['notify'](_0x4113ef,_0x2a8e74))[_0x77b4('0x9')](loggerCatch(_0x77b4('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 1d33ff7..52b19e3 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 _0x7d43=['../../../../config/logger','fax','bluebird','child_process','info','Exec\x20gs','\x20Error\x20:','util'];(function(_0x175e89,_0x20835f){var _0x2ed996=function(_0x56239f){while(--_0x56239f){_0x175e89['push'](_0x175e89['shift']());}};_0x2ed996(++_0x20835f);}(_0x7d43,0x1a7));var _0x37d4=function(_0x1fd0b1,_0x32c965){_0x1fd0b1=_0x1fd0b1-0x0;var _0x400a14=_0x7d43[_0x1fd0b1];return _0x400a14;};'use strict';var util=require(_0x37d4('0x0'));var logger=require(_0x37d4('0x1'))(_0x37d4('0x2'));var BPromise=require(_0x37d4('0x3'));var exec=require(_0x37d4('0x4'))['exec'];exports['execute']=function(_0x1773e9){return new BPromise(function(_0x11d28c,_0x154b52){exec(_0x1773e9,function(_0x1daf8b,_0x2b7c4d,_0x5767a1){logger['info']('Exec\x20gs',_0x2b7c4d);if(_0x1daf8b){logger[_0x37d4('0x5')](_0x37d4('0x6'),_0x37d4('0x7'),util['inspect'](_0x1daf8b,{'showHidden':![],'depth':null}),_0x2b7c4d,_0x5767a1);_0x154b52(_0x1daf8b);}_0x11d28c(_0x2b7c4d);});});}; \ No newline at end of file +var _0xc49f=['\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0xc49f,0x1ba));var _0xfc49=function(_0x25a3ca,_0x5df664){_0x25a3ca=_0x25a3ca-0x0;var _0xe12513=_0xc49f[_0x25a3ca];return _0xe12513;};'use strict';var util=require(_0xfc49('0x0'));var logger=require(_0xfc49('0x1'))(_0xfc49('0x2'));var BPromise=require(_0xfc49('0x3'));var exec=require(_0xfc49('0x4'))[_0xfc49('0x5')];exports[_0xfc49('0x6')]=function(_0x11dacf){return new BPromise(function(_0x8700fe,_0x55bb53){exec(_0x11dacf,function(_0x3e87c6,_0x56002e,_0xc727c2){logger[_0xfc49('0x7')](_0xfc49('0x8'),_0x56002e);if(_0x3e87c6){logger['info'](_0xfc49('0x8'),_0xfc49('0x9'),util[_0xfc49('0xa')](_0x3e87c6,{'showHidden':![],'depth':null}),_0x56002e,_0xc727c2);_0x55bb53(_0x3e87c6);}_0x8700fe(_0x56002e);});});}; \ 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 2839ec2..a470058 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 _0x3b4e=['modem','gateway','faxdetect','t38timeout','localstationid','variablesAction','from-sip','\x22%s\x22\x20<%s>','headerinfo','uniqueid','util','lodash','../../../../config/logger','fax','message','logger','inspect','addVariables','ecm','minrate','maxrate','format','\x22%s\x22'];(function(_0x508328,_0x52ff19){var _0x1c8232=function(_0x224eb0){while(--_0x224eb0){_0x508328['push'](_0x508328['shift']());}};_0x1c8232(++_0x52ff19);}(_0x3b4e,0x107));var _0xe3b4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3b4e[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xe3b4('0x0'));var _=require(_0xe3b4('0x1'));var moment=require('moment');var logger=require(_0xe3b4('0x2'))(_0xe3b4('0x3'));exports[_0xe3b4('0x4')]=function(_0x234bf0){return{'message':_0x234bf0};};exports[_0xe3b4('0x5')]=function(_0x213b49,_0x100a84){logger['info'](_0x213b49,util[_0xe3b4('0x6')](_0x100a84,{'showHidden':![],'depth':null}));};exports[_0xe3b4('0x7')]=function(_0x4cf5d6,_0x39c3a1){var _0x138056={'XMF-ECM':_0x39c3a1[_0xe3b4('0x8')],'XMF-HEADERINFO':_0x39c3a1['headerinfo'],'XMF-MINRATE':_0x39c3a1[_0xe3b4('0x9')],'XMF-MAXRATE':_0x39c3a1[_0xe3b4('0xa')],'XMF-MODEM':util[_0xe3b4('0xb')](_0xe3b4('0xc'),_0x39c3a1[_0xe3b4('0xd')]),'XMF-GATEWAY':_0x39c3a1[_0xe3b4('0xe')],'XMF-FAXDETECT':_0x39c3a1[_0xe3b4('0xf')],'XMF-T38TIMEOUT':_0x39c3a1[_0xe3b4('0x10')],'XMF-LOCALSTATIONID':_0x39c3a1[_0xe3b4('0x11')],'XMF-PATH':_0x4cf5d6['path']};return _0x138056;};exports[_0xe3b4('0x12')]=function(_0x3af0d4,_0x1ca910){return{'actionid':_0x3af0d4['uniqueid'],'action':'originate','channel':_0x3af0d4['channel'],'Exten':'xcally-motion-fax','Context':_0xe3b4('0x13'),'Priority':'1','callerid':util[_0xe3b4('0xb')](_0xe3b4('0x14'),_0x3af0d4['headerinfo']?_0x3af0d4[_0xe3b4('0x15')]:'',_0x3af0d4['localstationid']),'variable':_0x1ca910,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3af0d4[_0xe3b4('0x16')]};}; \ No newline at end of file +var _0x2abc=['inspect','addVariables','ecm','maxrate','modem','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','headerinfo','util','lodash','../../../../config/logger','logger'];(function(_0x2fd160,_0x53c0d6){var _0x5c2031=function(_0x8ecfa5){while(--_0x8ecfa5){_0x2fd160['push'](_0x2fd160['shift']());}};_0x5c2031(++_0x53c0d6);}(_0x2abc,0xc2));var _0xc2ab=function(_0x579387,_0x45c7ce){_0x579387=_0x579387-0x0;var _0x5517b4=_0x2abc[_0x579387];return _0x5517b4;};'use strict';var util=require(_0xc2ab('0x0'));var _=require(_0xc2ab('0x1'));var moment=require('moment');var logger=require(_0xc2ab('0x2'))('fax');exports['message']=function(_0x463b45){return{'message':_0x463b45};};exports[_0xc2ab('0x3')]=function(_0x1e85da,_0x20e67c){logger['info'](_0x1e85da,util[_0xc2ab('0x4')](_0x20e67c,{'showHidden':![],'depth':null}));};exports[_0xc2ab('0x5')]=function(_0xef0c23,_0x47a493){var _0x3192bd={'XMF-ECM':_0x47a493[_0xc2ab('0x6')],'XMF-HEADERINFO':_0x47a493['headerinfo'],'XMF-MINRATE':_0x47a493['minrate'],'XMF-MAXRATE':_0x47a493[_0xc2ab('0x7')],'XMF-MODEM':util['format']('\x22%s\x22',_0x47a493[_0xc2ab('0x8')]),'XMF-GATEWAY':_0x47a493['gateway'],'XMF-FAXDETECT':_0x47a493[_0xc2ab('0x9')],'XMF-T38TIMEOUT':_0x47a493[_0xc2ab('0xa')],'XMF-LOCALSTATIONID':_0x47a493[_0xc2ab('0xb')],'XMF-PATH':_0xef0c23[_0xc2ab('0xc')]};return _0x3192bd;};exports[_0xc2ab('0xd')]=function(_0x144de5,_0x4550d9){return{'actionid':_0x144de5[_0xc2ab('0xe')],'action':_0xc2ab('0xf'),'channel':_0x144de5[_0xc2ab('0x10')],'Exten':_0xc2ab('0x11'),'Context':_0xc2ab('0x12'),'Priority':'1','callerid':util[_0xc2ab('0x13')](_0xc2ab('0x14'),_0x144de5[_0xc2ab('0x15')]?_0x144de5[_0xc2ab('0x15')]:'',_0x144de5[_0xc2ab('0xb')]),'variable':_0x4550d9,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x144de5['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 83a79a3..9320a91 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 _0xf247=['ami','hour','get','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSugarcrmAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','inspect','listen','sync','catch','[index.js][main]','moment','./realtime','./report','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger'];(function(_0x2d05cf,_0x58750d){var _0x36421a=function(_0x45e48c){while(--_0x45e48c){_0x2d05cf['push'](_0x2d05cf['shift']());}};_0x36421a(++_0x58750d);}(_0xf247,0x6b));var _0x7f24=function(_0x1476ba,_0x446421){_0x1476ba=_0x1476ba-0x0;var _0x5e7bc1=_0xf247[_0x1476ba];return _0x5e7bc1;};'use strict';var util=require('util');var moment=require(_0x7f24('0x0'));var server=require('./server');var Realtime=require(_0x7f24('0x1'));var Report=require(_0x7f24('0x2'));var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require(_0x7f24('0x3'));var user=require(_0x7f24('0x4'));var voiceQueue=require(_0x7f24('0x5'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x7f24('0x6'));var trunk=require(_0x7f24('0x7'));var trigger=require('./rpc/trigger');var template=require(_0x7f24('0x8'));var cmHopperHistory=require(_0x7f24('0x9'));var campaign=require(_0x7f24('0xa'));var voiceExtension=require(_0x7f24('0xb'));var faxAccount=require(_0x7f24('0xc'));var zendesk=require(_0x7f24('0xd'));var salesforce=require(_0x7f24('0xe'));var sugarcrm=require(_0x7f24('0xf'));var freshdesk=require(_0x7f24('0x10'));var desk=require(_0x7f24('0x11'));var zoho=require(_0x7f24('0x12'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x7f24('0x13'));var servicenow=require(_0x7f24('0x14'));var dynamics365=require(_0x7f24('0x15'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x7f24('0x16'))(_0x7f24('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x7f24('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x7f24('0x19')](_0x7f24('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x7f24('0x1a')](user[_0x7f24('0x1b')]())[_0x7f24('0x1a')](realtime[_0x7f24('0x1c')]())[_0x7f24('0x1a')](user[_0x7f24('0x1d')]())[_0x7f24('0x1a')](realtime[_0x7f24('0x1e')]())['then'](trunk[_0x7f24('0x1f')]())['then'](realtime['initTrunks']())[_0x7f24('0x1a')](voiceQueue[_0x7f24('0x20')]())[_0x7f24('0x1a')](realtime[_0x7f24('0x21')]())[_0x7f24('0x1a')](trigger[_0x7f24('0x22')]())[_0x7f24('0x1a')](realtime['initTriggers']())[_0x7f24('0x1a')](template[_0x7f24('0x23')]())['then'](realtime['initTemplates']())[_0x7f24('0x1a')](zendesk[_0x7f24('0x24')]())[_0x7f24('0x1a')](realtime[_0x7f24('0x25')]())[_0x7f24('0x1a')](salesforce[_0x7f24('0x26')]())[_0x7f24('0x1a')](realtime['initSalesforceAccounts']())[_0x7f24('0x1a')](sugarcrm['getSugarcrmAccounts']())[_0x7f24('0x1a')](realtime[_0x7f24('0x27')]())[_0x7f24('0x1a')](freshdesk['getFreshdeskAccounts']())[_0x7f24('0x1a')](realtime[_0x7f24('0x28')]())[_0x7f24('0x1a')](desk['getDeskAccounts']())[_0x7f24('0x1a')](realtime[_0x7f24('0x29')]())['then'](zoho[_0x7f24('0x2a')]())['then'](realtime[_0x7f24('0x2b')]())[_0x7f24('0x1a')](vtiger[_0x7f24('0x2c')]())[_0x7f24('0x1a')](realtime[_0x7f24('0x2d')]())[_0x7f24('0x1a')](freshsales[_0x7f24('0x2e')]())['then'](realtime['initFreshsalesAccounts']())[_0x7f24('0x1a')](servicenow['getServicenowAccounts']())[_0x7f24('0x1a')](realtime['initServicenowAccounts']())[_0x7f24('0x1a')](dynamics365[_0x7f24('0x2f')]())[_0x7f24('0x1a')](realtime[_0x7f24('0x30')]())[_0x7f24('0x1a')](campaign[_0x7f24('0x31')]())[_0x7f24('0x1a')](realtime[_0x7f24('0x32')]())[_0x7f24('0x1a')](voiceExtension[_0x7f24('0x33')]())[_0x7f24('0x1a')](realtime['initVoiceExtensions']())[_0x7f24('0x1a')](faxAccount[_0x7f24('0x34')]())[_0x7f24('0x1a')](realtime['initFaxAccounts']())[_0x7f24('0x1a')](function(){return realtime;});}function initParams(){return Promise[_0x7f24('0x35')]()[_0x7f24('0x1a')](voiceQueueReport[_0x7f24('0x36')]())[_0x7f24('0x1a')](realtime['initVoiceQueueReports']())[_0x7f24('0x1a')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x7f24('0x1a')](realtime[_0x7f24('0x37')]())[_0x7f24('0x1a')](cmHopperHistory[_0x7f24('0x38')]())['then'](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0x7f24('0x39')]())[_0x7f24('0x1a')](realtime[_0x7f24('0x3a')]())['catch'](function(_0x41287f){logger[_0x7f24('0x3b')]('[index.js][initParams]',util[_0x7f24('0x3c')](_0x41287f,{'showHidden':![],'depth':null}));});}function main(){return server[_0x7f24('0x3d')](realtime,preview,fax)[_0x7f24('0x1a')](function(){return initRealtime();})[_0x7f24('0x1a')](function(){return initParams();})[_0x7f24('0x1a')](function(){report[_0x7f24('0x3e')]();setInterval(initRealtime,0x1388);})[_0x7f24('0x3f')](function(_0x31039e){logger[_0x7f24('0x3b')](_0x7f24('0x40'),util[_0x7f24('0x3c')](_0x31039e,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x02f0=['getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','[index.js][initParams]','listen','error','[index.js][main]','inspect','util','./server','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','get','hour','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueHopperHistory'];(function(_0x5da2c5,_0x6306e){var _0x2c0749=function(_0x5cf155){while(--_0x5cf155){_0x5da2c5['push'](_0x5da2c5['shift']());}};_0x2c0749(++_0x6306e);}(_0x02f0,0x1de));var _0x002f=function(_0x467f45,_0x7eb058){_0x467f45=_0x467f45-0x0;var _0x56e5a6=_0x02f0[_0x467f45];return _0x56e5a6;};'use strict';var util=require(_0x002f('0x0'));var moment=require('moment');var server=require(_0x002f('0x1'));var Realtime=require(_0x002f('0x2'));var Report=require(_0x002f('0x3'));var Acw=require('./acw');var Trigger=require(_0x002f('0x4'));var Dialer=require(_0x002f('0x5'));var Preview=require(_0x002f('0x6'));var Fax=require(_0x002f('0x7'));var user=require('./rpc/user');var voiceQueue=require(_0x002f('0x8'));var voiceQueueReport=require(_0x002f('0x9'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x002f('0xa'));var trigger=require(_0x002f('0xb'));var template=require(_0x002f('0xc'));var cmHopperHistory=require(_0x002f('0xd'));var campaign=require(_0x002f('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x002f('0xf'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x002f('0x10'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x002f('0x11'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x002f('0x12'));var freshsales=require(_0x002f('0x13'));var servicenow=require(_0x002f('0x14'));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 logger=require(_0x002f('0x15'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x002f('0x16')](_0x002f('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x002f('0x18')]()[_0x002f('0x19')](user[_0x002f('0x1a')]())[_0x002f('0x19')](realtime['initAgents']())[_0x002f('0x19')](user[_0x002f('0x1b')]())[_0x002f('0x19')](realtime[_0x002f('0x1c')]())['then'](trunk[_0x002f('0x1d')]())['then'](realtime['initTrunks']())['then'](voiceQueue[_0x002f('0x1e')]())[_0x002f('0x19')](realtime[_0x002f('0x1f')]())[_0x002f('0x19')](trigger[_0x002f('0x20')]())[_0x002f('0x19')](realtime[_0x002f('0x21')]())['then'](template[_0x002f('0x22')]())[_0x002f('0x19')](realtime[_0x002f('0x23')]())[_0x002f('0x19')](zendesk[_0x002f('0x24')]())[_0x002f('0x19')](realtime[_0x002f('0x25')]())[_0x002f('0x19')](salesforce[_0x002f('0x26')]())[_0x002f('0x19')](realtime[_0x002f('0x27')]())[_0x002f('0x19')](sugarcrm[_0x002f('0x28')]())[_0x002f('0x19')](realtime['initSugarcrmAccounts']())[_0x002f('0x19')](freshdesk[_0x002f('0x29')]())[_0x002f('0x19')](realtime[_0x002f('0x2a')]())[_0x002f('0x19')](desk['getDeskAccounts']())['then'](realtime['initDeskAccounts']())[_0x002f('0x19')](zoho[_0x002f('0x2b')]())[_0x002f('0x19')](realtime[_0x002f('0x2c')]())[_0x002f('0x19')](vtiger[_0x002f('0x2d')]())[_0x002f('0x19')](realtime[_0x002f('0x2e')]())[_0x002f('0x19')](freshsales[_0x002f('0x2f')]())['then'](realtime['initFreshsalesAccounts']())[_0x002f('0x19')](servicenow[_0x002f('0x30')]())[_0x002f('0x19')](realtime[_0x002f('0x31')]())[_0x002f('0x19')](dynamics365[_0x002f('0x32')]())['then'](realtime[_0x002f('0x33')]())[_0x002f('0x19')](campaign[_0x002f('0x34')]())[_0x002f('0x19')](realtime[_0x002f('0x35')]())['then'](voiceExtension[_0x002f('0x36')]())[_0x002f('0x19')](realtime['initVoiceExtensions']())[_0x002f('0x19')](faxAccount[_0x002f('0x37')]())[_0x002f('0x19')](realtime[_0x002f('0x38')]())[_0x002f('0x19')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x002f('0x19')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0x002f('0x39')]())[_0x002f('0x19')](realtime['initVoiceQueueHopperHistory']())[_0x002f('0x19')](cmHopperHistory[_0x002f('0x3a')]())[_0x002f('0x19')](realtime[_0x002f('0x3b')]())[_0x002f('0x19')](voiceCallReport[_0x002f('0x3c')]())['then'](realtime['initVoiceCallReports']())[_0x002f('0x3d')](function(_0x219bb8){logger['error'](_0x002f('0x3e'),util['inspect'](_0x219bb8,{'showHidden':![],'depth':null}));});}function main(){return server[_0x002f('0x3f')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x002f('0x19')](function(){return initParams();})[_0x002f('0x19')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x002f('0x3d')](function(_0x17bdf9){logger[_0x002f('0x40')](_0x002f('0x41'),util[_0x002f('0x42')](_0x17bdf9,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index f7c76b7..f1d7379 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 _0x0ea4=['fullname','stateTime','address','phone','mobile','interface','online','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','state','inuse','talking','voiceStatus','voiceStatusTime','toNumber','status','stringify','user:%s','emit','user:ami:update','omit','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode'];(function(_0x28e626,_0x56d806){var _0x1dfbe7=function(_0x5419be){while(--_0x5419be){_0x28e626['push'](_0x28e626['shift']());}};_0x1dfbe7(++_0x56d806);}(_0x0ea4,0x12b));var _0x40ea=function(_0x296e07,_0x3a0a3f){_0x296e07=_0x296e07-0x0;var _0x5410ef=_0x0ea4[_0x296e07];return _0x5410ef;};'use strict';var _=require(_0x40ea('0x0'));var util=require(_0x40ea('0x1'));var moment=require(_0x40ea('0x2'));var md5=require(_0x40ea('0x3'));var Redis=require(_0x40ea('0x4'));var config=require(_0x40ea('0x5'));config[_0x40ea('0x6')]=_[_0x40ea('0x7')](config['redis'],{'host':_0x40ea('0x8'),'port':0x18eb});var io=require(_0x40ea('0x9'))(new Redis(config[_0x40ea('0x6')]));function Agent(_0xf96257){this['id']=_0xf96257['id']||0x0;this[_0x40ea('0xa')]=_0xf96257[_0x40ea('0xa')]||'';this[_0x40ea('0xb')]=_0xf96257[_0x40ea('0xb')]||'';this[_0x40ea('0xc')]=_0xf96257[_0x40ea('0xc')]||'';this['fullname']=_0xf96257[_0x40ea('0xd')]||'';this['state']='unknown';this[_0x40ea('0xe')]=0x0;this['status']='unknown';this[_0x40ea('0xf')]='';this[_0x40ea('0x10')]='';this[_0x40ea('0x11')]='';this[_0x40ea('0x12')]='';this[_0x40ea('0x13')]=_0xf96257[_0x40ea('0x13')]||![];this['voiceStatus']='unknown';this['voiceStatusTime']=0x0;this[_0x40ea('0x14')]='';this[_0x40ea('0x15')]='';this[_0x40ea('0x16')]=![];this[_0x40ea('0x17')]=![];this[_0x40ea('0x3')]='';}Agent[_0x40ea('0x18')][_0x40ea('0x19')]=function(_0x27e693){var _0x1e2d97;if(_0x27e693&&_0x27e693[_0x40ea('0x1a')]){_0x1e2d97=_0x27e693[_0x40ea('0x1a')]['toLowerCase']();switch(_0x1e2d97){case'not_inuse':_0x1e2d97='idle';break;case _0x40ea('0x1b'):_0x1e2d97=_0x40ea('0x1c');break;}}if(_0x1e2d97&&this[_0x40ea('0x1d')]!==_0x1e2d97||_0x27e693['statePause']){this[_0x40ea('0x1e')]=_[_0x40ea('0x1f')](moment()['format']('x'));}if(_0x1e2d97){this[_0x40ea('0x1d')]=_0x1e2d97;}var _0x526718={'id':this['id'],'name':this[_0x40ea('0xa')],'email':this[_0x40ea('0xb')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x40ea('0x1a')],'stateTime':this[_0x40ea('0xe')],'status':this[_0x40ea('0x20')],'address':this[_0x40ea('0xf')],'online':this[_0x40ea('0x13')],'voiceStatus':this[_0x40ea('0x1d')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x40ea('0x15')],'interface':this[_0x40ea('0x12')],'onhold':this['onhold']};var _0x48e4a5=md5(JSON[_0x40ea('0x21')](_0x526718));if(this[_0x40ea('0x3')]!==_0x48e4a5){this['md5']=_0x48e4a5;io['to'](util['format'](_0x40ea('0x22'),_0x526718['name']))[_0x40ea('0x23')](_0x40ea('0x24'),_[_0x40ea('0x25')](_0x526718,['online']));io[_0x40ea('0x23')]('user:presence',_0x526718);}};module[_0x40ea('0x26')]=Agent; \ No newline at end of file +var _0x5ae4=['localhost','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','toLowerCase','not_inuse','idle','inuse','talking','toNumber','stateTime','address','format','user:%s','user:ami:update','omit','emit','user:presence','exports','util','moment','md5','../../../config/environment','redis','defaults'];(function(_0x4a2d48,_0x4c8529){var _0x5b30f3=function(_0x4ef8ad){while(--_0x4ef8ad){_0x4a2d48['push'](_0x4a2d48['shift']());}};_0x5b30f3(++_0x4c8529);}(_0x5ae4,0x72));var _0x45ae=function(_0x3cfe5a,_0x1466f3){_0x3cfe5a=_0x3cfe5a-0x0;var _0x2e0b64=_0x5ae4[_0x3cfe5a];return _0x2e0b64;};'use strict';var _=require('lodash');var util=require(_0x45ae('0x0'));var moment=require(_0x45ae('0x1'));var md5=require(_0x45ae('0x2'));var Redis=require('ioredis');var config=require(_0x45ae('0x3'));config[_0x45ae('0x4')]=_[_0x45ae('0x5')](config[_0x45ae('0x4')],{'host':_0x45ae('0x6'),'port':0x18eb});var io=require(_0x45ae('0x7'))(new Redis(config['redis']));function Agent(_0x528a76){this['id']=_0x528a76['id']||0x0;this[_0x45ae('0x8')]=_0x528a76['name']||'';this[_0x45ae('0x9')]=_0x528a76[_0x45ae('0x9')]||'';this[_0x45ae('0xa')]=_0x528a76[_0x45ae('0xa')]||'';this[_0x45ae('0xb')]=_0x528a76[_0x45ae('0xb')]||'';this[_0x45ae('0xc')]='unknown';this['stateTime']=0x0;this[_0x45ae('0xd')]=_0x45ae('0xe');this['address']='';this[_0x45ae('0xf')]='';this[_0x45ae('0x10')]='';this[_0x45ae('0x11')]='';this['online']=_0x528a76[_0x45ae('0x12')]||![];this[_0x45ae('0x13')]=_0x45ae('0xe');this[_0x45ae('0x14')]=0x0;this[_0x45ae('0x15')]='';this[_0x45ae('0x16')]='';this[_0x45ae('0x17')]=![];this['local']=![];this[_0x45ae('0x2')]='';}Agent[_0x45ae('0x18')]['updateStatusRealtime']=function(_0xf98e81){var _0x1ffbc9;if(_0xf98e81&&_0xf98e81['state']){_0x1ffbc9=_0xf98e81['state'][_0x45ae('0x19')]();switch(_0x1ffbc9){case _0x45ae('0x1a'):_0x1ffbc9=_0x45ae('0x1b');break;case _0x45ae('0x1c'):_0x1ffbc9=_0x45ae('0x1d');break;}}if(_0x1ffbc9&&this['voiceStatus']!==_0x1ffbc9||_0xf98e81['statePause']){this[_0x45ae('0x14')]=_[_0x45ae('0x1e')](moment()['format']('x'));}if(_0x1ffbc9){this[_0x45ae('0x13')]=_0x1ffbc9;}var _0xef7e91={'id':this['id'],'name':this[_0x45ae('0x8')],'email':this[_0x45ae('0x9')],'accountcode':this[_0x45ae('0xa')],'fullname':this[_0x45ae('0xb')],'state':this['state'],'stateTime':this[_0x45ae('0x1f')],'status':this['status'],'address':this[_0x45ae('0x20')],'online':this['online'],'voiceStatus':this[_0x45ae('0x13')],'voiceStatusTime':this[_0x45ae('0x14')],'voiceStatusCallerIdNumber':this[_0x45ae('0x15')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x45ae('0x17')]};var _0x535d69=md5(JSON['stringify'](_0xef7e91));if(this['md5']!==_0x535d69){this[_0x45ae('0x2')]=_0x535d69;io['to'](util[_0x45ae('0x21')](_0x45ae('0x22'),_0xef7e91[_0x45ae('0x8')]))['emit'](_0x45ae('0x23'),_[_0x45ae('0x24')](_0xef7e91,[_0x45ae('0x12')]));io[_0x45ae('0x25')](_0x45ae('0x26'),_0xef7e91);}};module[_0x45ae('0x27')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 8933288..673d276 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 _0xa52b=['dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence'];(function(_0x3e0a7a,_0x502dfd){var _0x624e99=function(_0x585ba3){while(--_0x585ba3){_0x3e0a7a['push'](_0x3e0a7a['shift']());}};_0x624e99(++_0x502dfd);}(_0xa52b,0xc0));var _0xba52=function(_0x51b8e7,_0x5c38e9){_0x51b8e7=_0x51b8e7-0x0;var _0x1ca5f6=_0xa52b[_0x51b8e7];return _0x1ca5f6;};'use strict';function Campaign(_0x38884d){this['id']=_0x38884d['id']||0x0;this[_0xba52('0x0')]=_0x38884d['name']||'';this['type']=_0x38884d['type']||'campaign';this[_0xba52('0x1')]=0x0;this[_0xba52('0x2')]=0x0;this[_0xba52('0x3')]=0x0;this[_0xba52('0x4')]=0x0;this[_0xba52('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0xba52('0x6')]=_0x38884d[_0xba52('0x6')];this[_0xba52('0x7')]=_0x38884d[_0xba52('0x7')];this['dialTimezone']=_0x38884d['dialTimezone']||null;this['dialGlobalInterval']=_0x38884d[_0xba52('0x8')]?_0x38884d['dialGlobalInterval']:null;this[_0xba52('0x9')]=_0x38884d[_0xba52('0x9')];this[_0xba52('0xa')]=_0x38884d[_0xba52('0xa')];this[_0xba52('0xb')]=_0x38884d[_0xba52('0xb')]||0x1e;this[_0xba52('0xc')]=_0x38884d[_0xba52('0xc')];this[_0xba52('0xd')]=_0x38884d[_0xba52('0xd')];this['dialBusyMaxRetry']=_0x38884d[_0xba52('0xe')];this[_0xba52('0xf')]=_0x38884d[_0xba52('0xf')];this[_0xba52('0x10')]=_0x38884d[_0xba52('0x10')];this[_0xba52('0x11')]=_0x38884d[_0xba52('0x11')];this['dialGlobalMaxRetry']=_0x38884d[_0xba52('0x12')];this[_0xba52('0x13')]=_0x38884d['dialNoSuchNumberMaxRetry']||0x3;this[_0xba52('0x14')]=_0x38884d[_0xba52('0x14')]||0x96;this[_0xba52('0x15')]=_0x38884d[_0xba52('0x15')]||0x3;this['dialDropRetryFrequency']=_0x38884d[_0xba52('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0x38884d['dialAbandonedMaxRetry']||0x3;this[_0xba52('0x17')]=_0x38884d[_0xba52('0x17')]||0x96;this['dialMachineMaxRetry']=_0x38884d[_0xba52('0x18')]||0x3;this['dialMachineRetryFrequency']=_0x38884d[_0xba52('0x19')]||0x96;this[_0xba52('0x1a')]=_0x38884d[_0xba52('0x1a')]||0x3;this[_0xba52('0x1b')]=_0x38884d[_0xba52('0x1b')]||0x96;this[_0xba52('0x1c')]=_0x38884d[_0xba52('0x1c')]||_0xba52('0x1d');this[_0xba52('0x1e')]=_0x38884d[_0xba52('0x1e')]||undefined;this[_0xba52('0x1f')]=_0x38884d[_0xba52('0x1f')]||undefined;this['dialCutDigit']=_0x38884d['dialCutDigit']||undefined;this[_0xba52('0x20')]=_0x38884d[_0xba52('0x20')]?_0x38884d[_0xba52('0x20')]:undefined;this['Trunk']=_0x38884d['Trunk']?_0x38884d['Trunk']:undefined;this[_0xba52('0x21')]=_0x38884d[_0xba52('0x21')]?_0x38884d[_0xba52('0x21')]:undefined;this[_0xba52('0x22')]=_0x38884d[_0xba52('0x22')]?_0x38884d[_0xba52('0x22')]:undefined;this[_0xba52('0x23')]=_0x38884d[_0xba52('0x22')]?_0x38884d[_0xba52('0x22')]['name']:undefined;this[_0xba52('0x24')]=_0x38884d['dialAMDActive']||![];this[_0xba52('0x25')]=_0x38884d['dialAMDInitialSilence'];this[_0xba52('0x26')]=_0x38884d['dialAMDGreeting'];this[_0xba52('0x27')]=_0x38884d[_0xba52('0x27')];this['dialAMDTotalAnalysisTime']=_0x38884d[_0xba52('0x28')];this['dialAMDMinWordLength']=_0x38884d[_0xba52('0x29')];this['dialAMDBetweenWordsSilence']=_0x38884d[_0xba52('0x2a')];this[_0xba52('0x2b')]=_0x38884d[_0xba52('0x2b')];this['dialAMDSilenceThreshold']=_0x38884d[_0xba52('0x2c')];this[_0xba52('0x2d')]=_0x38884d['dialAMDMaximumWordLength'];}module[_0xba52('0x2e')]=Campaign; \ No newline at end of file +var _0x4da8=['dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry'];(function(_0x4126b3,_0x2f64c8){var _0x378ac0=function(_0x4431c9){while(--_0x4431c9){_0x4126b3['push'](_0x4126b3['shift']());}};_0x378ac0(++_0x2f64c8);}(_0x4da8,0x18b));var _0x84da=function(_0x49a399,_0x3aea91){_0x49a399=_0x49a399-0x0;var _0x668ad4=_0x4da8[_0x49a399];return _0x668ad4;};'use strict';function Campaign(_0x261426){this['id']=_0x261426['id']||0x0;this[_0x84da('0x0')]=_0x261426['name']||'';this['type']=_0x261426[_0x84da('0x1')]||_0x84da('0x2');this[_0x84da('0x3')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x84da('0x4')]=0x0;this['message']='';this[_0x84da('0x5')]=!![];this[_0x84da('0x6')]=_0x261426[_0x84da('0x6')];this[_0x84da('0x7')]=_0x261426['limitCalls'];this['dialTimezone']=_0x261426[_0x84da('0x8')]||null;this['dialGlobalInterval']=_0x261426['dialGlobalInterval']?_0x261426['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x261426[_0x84da('0x9')];this['dialOriginateCallerIdNumber']=_0x261426['dialOriginateCallerIdNumber'];this[_0x84da('0xa')]=_0x261426[_0x84da('0xa')]||0x1e;this[_0x84da('0xb')]=_0x261426['dialCongestionMaxRetry'];this[_0x84da('0xc')]=_0x261426[_0x84da('0xc')];this[_0x84da('0xd')]=_0x261426[_0x84da('0xd')];this[_0x84da('0xe')]=_0x261426[_0x84da('0xe')];this[_0x84da('0xf')]=_0x261426[_0x84da('0xf')];this[_0x84da('0x10')]=_0x261426[_0x84da('0x10')];this[_0x84da('0x11')]=_0x261426[_0x84da('0x11')];this['dialNoSuchNumberMaxRetry']=_0x261426[_0x84da('0x12')]||0x3;this[_0x84da('0x13')]=_0x261426[_0x84da('0x13')]||0x96;this['dialDropMaxRetry']=_0x261426[_0x84da('0x14')]||0x3;this['dialDropRetryFrequency']=_0x261426[_0x84da('0x15')]||0x96;this[_0x84da('0x16')]=_0x261426[_0x84da('0x16')]||0x3;this[_0x84da('0x17')]=_0x261426[_0x84da('0x17')]||0x96;this['dialMachineMaxRetry']=_0x261426[_0x84da('0x18')]||0x3;this[_0x84da('0x19')]=_0x261426[_0x84da('0x19')]||0x96;this[_0x84da('0x1a')]=_0x261426[_0x84da('0x1a')]||0x3;this[_0x84da('0x1b')]=_0x261426['dialAgentRejectRetryFrequency']||0x96;this[_0x84da('0x1c')]=_0x261426[_0x84da('0x1c')]||_0x84da('0x1d');this[_0x84da('0x1e')]=_0x261426['dialPrefix']||undefined;this[_0x84da('0x1f')]=_0x261426[_0x84da('0x1f')]||undefined;this['dialCutDigit']=_0x261426[_0x84da('0x20')]||undefined;this['TrunkBackup']=_0x261426[_0x84da('0x21')]?_0x261426['TrunkBackup']:undefined;this[_0x84da('0x22')]=_0x261426[_0x84da('0x22')]?_0x261426[_0x84da('0x22')]:undefined;this['Interval']=_0x261426['Interval']?_0x261426['Interval']:undefined;this[_0x84da('0x23')]=_0x261426[_0x84da('0x23')]?_0x261426['SquareProject']:undefined;this[_0x84da('0x24')]=_0x261426[_0x84da('0x23')]?_0x261426[_0x84da('0x23')][_0x84da('0x0')]:undefined;this['dialAMDActive']=_0x261426[_0x84da('0x25')]||![];this['dialAMDInitialSilence']=_0x261426['dialAMDInitialSilence'];this[_0x84da('0x26')]=_0x261426[_0x84da('0x26')];this['dialAMDAfterGreetingSilence']=_0x261426['dialAMDAfterGreetingSilence'];this[_0x84da('0x27')]=_0x261426['dialAMDTotalAnalysisTime'];this[_0x84da('0x28')]=_0x261426['dialAMDMinWordLength'];this[_0x84da('0x29')]=_0x261426[_0x84da('0x29')];this[_0x84da('0x2a')]=_0x261426[_0x84da('0x2a')];this[_0x84da('0x2b')]=_0x261426[_0x84da('0x2b')];this[_0x84da('0x2c')]=_0x261426[_0x84da('0x2c')];}module[_0x84da('0x2d')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 5552a57..6c7c923 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 _0x707d=['monitors','transfercalleridnum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answertime','endtime','abandoned','lastapplication','lastdata','billableseconds','holdtime','tag','disposition','queue'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x707d,0x18b));var _0xd707=function(_0x589a93,_0x5bfce){_0x589a93=_0x589a93-0x0;var _0x12bd2c=_0x707d[_0x589a93];return _0x12bd2c;};'use strict';function Channel(){this[_0xd707('0x0')]=null;this[_0xd707('0x1')]='';this[_0xd707('0x2')]='';this[_0xd707('0x3')]=0x0;this[_0xd707('0x4')]='';this[_0xd707('0x5')]=undefined;this[_0xd707('0x6')]=undefined;this['accountcode']=0x0;this[_0xd707('0x7')]='';this[_0xd707('0x8')]=0x0;this[_0xd707('0x9')]=0x0;this[_0xd707('0xa')]=0x0;this['answered']=![];this[_0xd707('0xb')]=null;this[_0xd707('0xc')]=null;this['unmanaged']=![];this[_0xd707('0xd')]=![];this[_0xd707('0xe')]='';this[_0xd707('0xf')]='';this['duration']=0x0;this[_0xd707('0x10')]=0x0;this[_0xd707('0x11')]=0x0;this['type']=null;this[_0xd707('0x12')]=null;this[_0xd707('0x13')]=null;this['monitor']=![];this['monitorFilename']=null;this[_0xd707('0x14')]=null;this[_0xd707('0x15')]=[];this[_0xd707('0x16')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xd707('0x17')]=undefined;this[_0xd707('0x18')]=0x0;}module[_0xd707('0x19')]=Channel; \ No newline at end of file +var _0x110e=['lastapplication','lastdata','duration','billableseconds','holdtime','type','disposition','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','answered','endtime','unmanaged','abandoned'];(function(_0x17a3b7,_0x44450e){var _0x121d4b=function(_0x1257e0){while(--_0x1257e0){_0x17a3b7['push'](_0x17a3b7['shift']());}};_0x121d4b(++_0x44450e);}(_0x110e,0x68));var _0xe110=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x110e[_0x57b54c];return _0x59cc19;};'use strict';function Channel(){this[_0xe110('0x0')]=null;this[_0xe110('0x1')]='';this['destinationchannel']='';this[_0xe110('0x2')]=0x0;this[_0xe110('0x3')]='';this[_0xe110('0x4')]=undefined;this[_0xe110('0x5')]=undefined;this[_0xe110('0x6')]=0x0;this['context']='';this['uniqueid']=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0xe110('0x7')]=![];this['answertime']=null;this[_0xe110('0x8')]=null;this[_0xe110('0x9')]=![];this[_0xe110('0xa')]=![];this[_0xe110('0xb')]='';this[_0xe110('0xc')]='';this[_0xe110('0xd')]=0x0;this[_0xe110('0xe')]=0x0;this[_0xe110('0xf')]=0x0;this[_0xe110('0x10')]=null;this['tag']=null;this[_0xe110('0x11')]=null;this[_0xe110('0x12')]=![];this['monitorFilename']=null;this[_0xe110('0x13')]=null;this[_0xe110('0x14')]=[];this[_0xe110('0x15')]=undefined;this[_0xe110('0x16')]=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index b464491..13998c7 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 _0xbb8e=['remoteUri','authType','password','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb8e,0xe5));var _0xebb8=function(_0x4f44bb,_0x110a44){_0x4f44bb=_0x4f44bb-0x0;var _0x2082bc=_0xbb8e[_0x4f44bb];return _0x2082bc;};'use strict';function DeskAccount(_0x3b4270){this['id']=_0x3b4270['id']||0x0;this[_0xebb8('0x0')]=_0x3b4270[_0xebb8('0x0')]||'';this[_0xebb8('0x1')]=_0x3b4270[_0xebb8('0x1')]||'';this[_0xebb8('0x2')]=_0x3b4270[_0xebb8('0x2')]||'';this['authType']=_0x3b4270[_0xebb8('0x3')]||'';this['password']=_0x3b4270[_0xebb8('0x4')]||'';this['consumerKey']=_0x3b4270['consumerKey']||'';this[_0xebb8('0x5')]=_0x3b4270['consumerSecret']||'';this['token']=_0x3b4270[_0xebb8('0x6')]||'';this[_0xebb8('0x7')]=_0x3b4270[_0xebb8('0x7')]||'';this[_0xebb8('0x8')]=_0x3b4270[_0xebb8('0x8')]||'';this[_0xebb8('0x9')]=_0x3b4270[_0xebb8('0x9')]||'';this[_0xebb8('0xa')]=_0x3b4270[_0xebb8('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xc7fa=['authType','password','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x4508ea,_0x5aad3c){var _0x29912f=function(_0x3b7f3a){while(--_0x3b7f3a){_0x4508ea['push'](_0x4508ea['shift']());}};_0x29912f(++_0x5aad3c);}(_0xc7fa,0x135));var _0xac7f=function(_0x189cbc,_0x20b722){_0x189cbc=_0x189cbc-0x0;var _0x5ad834=_0xc7fa[_0x189cbc];return _0x5ad834;};'use strict';function DeskAccount(_0x443fad){this['id']=_0x443fad['id']||0x0;this[_0xac7f('0x0')]=_0x443fad['name']||'';this[_0xac7f('0x1')]=_0x443fad[_0xac7f('0x1')]||'';this['remoteUri']=_0x443fad[_0xac7f('0x2')]||'';this[_0xac7f('0x3')]=_0x443fad[_0xac7f('0x3')]||'';this[_0xac7f('0x4')]=_0x443fad[_0xac7f('0x4')]||'';this['consumerKey']=_0x443fad['consumerKey']||'';this[_0xac7f('0x5')]=_0x443fad[_0xac7f('0x5')]||'';this['token']=_0x443fad[_0xac7f('0x6')]||'';this[_0xac7f('0x7')]=_0x443fad['tokenSecret']||'';this[_0xac7f('0x8')]=_0x443fad[_0xac7f('0x8')]||'';this[_0xac7f('0x9')]=_0x443fad[_0xac7f('0x9')]||'';this[_0xac7f('0xa')]=_0x443fad[_0xac7f('0xa')]||{};}module[_0xac7f('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 463529f..236f8f4 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 _0xbd6f=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports'];(function(_0x3427b7,_0x5bc5f3){var _0xea8ea2=function(_0x34a033){while(--_0x34a033){_0x3427b7['push'](_0x3427b7['shift']());}};_0xea8ea2(++_0x5bc5f3);}(_0xbd6f,0x138));var _0xfbd6=function(_0x42cf3e,_0x50abbe){_0x42cf3e=_0x42cf3e-0x0;var _0x184386=_0xbd6f[_0x42cf3e];return _0x184386;};'use strict';function Dynamics365Account(_0x4e45aa){this['id']=_0x4e45aa['id']||0x0;this[_0xfbd6('0x0')]=_0x4e45aa[_0xfbd6('0x0')]||'';this[_0xfbd6('0x1')]=_0x4e45aa['username']||'';this[_0xfbd6('0x2')]=_0x4e45aa['password']||'';this[_0xfbd6('0x3')]=_0x4e45aa[_0xfbd6('0x3')]||'';this[_0xfbd6('0x4')]=_0x4e45aa['tenantId']||'';this[_0xfbd6('0x5')]=_0x4e45aa['clientId']||'';this[_0xfbd6('0x6')]=_0x4e45aa[_0xfbd6('0x6')]||{};this[_0xfbd6('0x7')]=_0x4e45aa[_0xfbd6('0x7')]||'';this[_0xfbd6('0x8')]=_0x4e45aa[_0xfbd6('0x8')]||![];this[_0xfbd6('0x9')]=_0x4e45aa[_0xfbd6('0x9')]||{};this[_0xfbd6('0xa')]=_0x4e45aa[_0xfbd6('0xa')]||{};}module[_0xfbd6('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x9320=['clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId'];(function(_0x28ed56,_0x285010){var _0x5c975d=function(_0x4b89cc){while(--_0x4b89cc){_0x28ed56['push'](_0x28ed56['shift']());}};_0x5c975d(++_0x285010);}(_0x9320,0x10f));var _0x0932=function(_0x47918b,_0x409a33){_0x47918b=_0x47918b-0x0;var _0x49c60e=_0x9320[_0x47918b];return _0x49c60e;};'use strict';function Dynamics365Account(_0x318373){this['id']=_0x318373['id']||0x0;this[_0x0932('0x0')]=_0x318373[_0x0932('0x0')]||'';this[_0x0932('0x1')]=_0x318373[_0x0932('0x1')]||'';this['password']=_0x318373[_0x0932('0x2')]||'';this[_0x0932('0x3')]=_0x318373[_0x0932('0x3')]||'';this['tenantId']=_0x318373[_0x0932('0x4')]||'';this[_0x0932('0x5')]=_0x318373[_0x0932('0x5')]||'';this[_0x0932('0x6')]=_0x318373[_0x0932('0x6')]||{};this[_0x0932('0x7')]=_0x318373[_0x0932('0x7')]||'';this[_0x0932('0x8')]=_0x318373['modernAuthentication']||![];this[_0x0932('0x9')]=_0x318373[_0x0932('0x9')]||{};this[_0x0932('0xa')]=_0x318373[_0x0932('0xa')]||{};}module[_0x0932('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index d8295b2..fe162de 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 _0x8fef=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','name','description','ecm'];(function(_0x2b1271,_0x33b1d1){var _0x4c085b=function(_0x5a5a90){while(--_0x5a5a90){_0x2b1271['push'](_0x2b1271['shift']());}};_0x4c085b(++_0x33b1d1);}(_0x8fef,0x66));var _0xf8fe=function(_0xba80a,_0x13bb29){_0xba80a=_0xba80a-0x0;var _0x58b970=_0x8fef[_0xba80a];return _0x58b970;};'use strict';function FaxAccount(_0x4e81ae){this['id']=_0x4e81ae['id']||0x0;this[_0xf8fe('0x0')]=_0x4e81ae[_0xf8fe('0x0')]||'';this[_0xf8fe('0x1')]=_0x4e81ae[_0xf8fe('0x1')];this[_0xf8fe('0x2')]=_0x4e81ae['ecm'];this['headerinfo']=_0x4e81ae[_0xf8fe('0x3')];this[_0xf8fe('0x4')]=_0x4e81ae[_0xf8fe('0x4')];this[_0xf8fe('0x5')]=_0x4e81ae['minrate']||0x960;this[_0xf8fe('0x6')]=_0x4e81ae['maxrate']||0x3840;this[_0xf8fe('0x7')]=_0x4e81ae['modem']||_0xf8fe('0x8');this[_0xf8fe('0x9')]=_0x4e81ae[_0xf8fe('0x9')]||'no';this[_0xf8fe('0xa')]=_0x4e81ae[_0xf8fe('0xa')]||'no';this[_0xf8fe('0xb')]=_0x4e81ae[_0xf8fe('0xb')]||0x1388;this[_0xf8fe('0xc')]=_0x4e81ae['tech']||'SIP';this[_0xf8fe('0xd')]=_0x4e81ae[_0xf8fe('0xd')]?_0x4e81ae[_0xf8fe('0xd')]:undefined;this[_0xf8fe('0xe')]=_0x4e81ae[_0xf8fe('0xe')];this['key']=_0x4e81ae['key'];}module['exports']=FaxAccount; \ No newline at end of file +var _0x71b4=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x71b4,0x1a9));var _0x471b=function(_0x3684d3,_0x445320){_0x3684d3=_0x3684d3-0x0;var _0xae45dc=_0x71b4[_0x3684d3];return _0xae45dc;};'use strict';function FaxAccount(_0x20c065){this['id']=_0x20c065['id']||0x0;this['name']=_0x20c065['name']||'';this['description']=_0x20c065[_0x471b('0x0')];this[_0x471b('0x1')]=_0x20c065[_0x471b('0x1')];this[_0x471b('0x2')]=_0x20c065[_0x471b('0x2')];this[_0x471b('0x3')]=_0x20c065[_0x471b('0x3')];this[_0x471b('0x4')]=_0x20c065['minrate']||0x960;this[_0x471b('0x5')]=_0x20c065['maxrate']||0x3840;this[_0x471b('0x6')]=_0x20c065[_0x471b('0x6')]||_0x471b('0x7');this['gateway']=_0x20c065[_0x471b('0x8')]||'no';this['faxdetect']=_0x20c065[_0x471b('0x9')]||'no';this[_0x471b('0xa')]=_0x20c065[_0x471b('0xa')]||0x1388;this[_0x471b('0xb')]=_0x20c065[_0x471b('0xb')]||'SIP';this[_0x471b('0xc')]=_0x20c065[_0x471b('0xc')]?_0x20c065['Trunk']:undefined;this[_0x471b('0xd')]=_0x20c065['ListId'];this['key']=_0x20c065[_0x471b('0xe')];}module[_0x471b('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 b9521e2..ade1195 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 _0x5728=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x5728,0xc4));var _0x8572=function(_0x3eabda,_0x4e5506){_0x3eabda=_0x3eabda-0x0;var _0x410bb3=_0x5728[_0x3eabda];return _0x410bb3;};'use strict';function FreshdeskAccount(_0x4b880c){this['id']=_0x4b880c['id']||0x0;this[_0x8572('0x0')]=_0x4b880c[_0x8572('0x0')]||'';this[_0x8572('0x1')]=_0x4b880c['username']||'';this[_0x8572('0x2')]=_0x4b880c[_0x8572('0x3')]||'';this[_0x8572('0x4')]=_0x4b880c[_0x8572('0x4')]||'';this[_0x8572('0x5')]=_0x4b880c[_0x8572('0x5')]||'';this[_0x8572('0x6')]=_0x4b880c[_0x8572('0x6')]||{};}module[_0x8572('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xd5b2=['token','remoteUri','serverUrl','exports','name','username','apiKey'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xd5b2,0x74));var _0x2d5b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xd5b2[_0xae7c2f];return _0x5d7001;};'use strict';function FreshdeskAccount(_0x36a696){this['id']=_0x36a696['id']||0x0;this[_0x2d5b('0x0')]=_0x36a696[_0x2d5b('0x0')]||'';this[_0x2d5b('0x1')]=_0x36a696[_0x2d5b('0x1')]||'';this[_0x2d5b('0x2')]=_0x36a696[_0x2d5b('0x3')]||'';this['remoteUri']=_0x36a696[_0x2d5b('0x4')]||'';this[_0x2d5b('0x5')]=_0x36a696[_0x2d5b('0x5')]||'';this['Configurations']=_0x36a696['Configurations']||{};}module[_0x2d5b('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 9164ae0..20f2bb2 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 _0x3de0=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x1fbb37,_0x5840b8){var _0x591a30=function(_0x2a6573){while(--_0x2a6573){_0x1fbb37['push'](_0x1fbb37['shift']());}};_0x591a30(++_0x5840b8);}(_0x3de0,0x143));var _0x03de=function(_0x30f37a,_0x1b1477){_0x30f37a=_0x30f37a-0x0;var _0x3c057f=_0x3de0[_0x30f37a];return _0x3c057f;};'use strict';function FreshsalesAccount(_0x27c5fa){this['id']=_0x27c5fa['id']||0x0;this['name']=_0x27c5fa[_0x03de('0x0')]||'';this[_0x03de('0x1')]=_0x27c5fa['username']||'';this[_0x03de('0x2')]=_0x27c5fa[_0x03de('0x3')]||'';this['remoteUri']=_0x27c5fa[_0x03de('0x4')]||'';this[_0x03de('0x5')]=_0x27c5fa['serverUrl']||'';this['Configurations']=_0x27c5fa[_0x03de('0x6')]||{};}module[_0x03de('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x0619=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x2bf4f4,_0x45af4d){var _0x1d488e=function(_0x2cc19f){while(--_0x2cc19f){_0x2bf4f4['push'](_0x2bf4f4['shift']());}};_0x1d488e(++_0x45af4d);}(_0x0619,0x90));var _0x9061=function(_0xa9765a,_0x18205d){_0xa9765a=_0xa9765a-0x0;var _0xa57b49=_0x0619[_0xa9765a];return _0xa57b49;};'use strict';function FreshsalesAccount(_0xe5b0cb){this['id']=_0xe5b0cb['id']||0x0;this[_0x9061('0x0')]=_0xe5b0cb[_0x9061('0x0')]||'';this[_0x9061('0x1')]=_0xe5b0cb['username']||'';this[_0x9061('0x2')]=_0xe5b0cb[_0x9061('0x3')]||'';this[_0x9061('0x4')]=_0xe5b0cb[_0x9061('0x4')]||'';this[_0x9061('0x5')]=_0xe5b0cb[_0x9061('0x5')]||'';this[_0x9061('0x6')]=_0xe5b0cb[_0x9061('0x6')]||{};}module[_0x9061('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 00883da..77835b0 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 _0xd143=['motionChannel','voice','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','lastAssignedTo'];(function(_0x5e968c,_0x3d9d44){var _0x5a9fb3=function(_0x586a9f){while(--_0x586a9f){_0x5e968c['push'](_0x5e968c['shift']());}};_0x5a9fb3(++_0x3d9d44);}(_0xd143,0x113));var _0x3d14=function(_0x52569f,_0x64dc66){_0x52569f=_0x52569f-0x0;var _0x5b246c=_0xd143[_0x52569f];return _0x5b246c;};'use strict';function QueueReport(){this[_0x3d14('0x0')]=_0x3d14('0x1');this[_0x3d14('0x2')]='';this[_0x3d14('0x3')]='';this[_0x3d14('0x4')]='';this[_0x3d14('0x5')]='';this[_0x3d14('0x6')]=null;this[_0x3d14('0x7')]=null;this[_0x3d14('0x8')]=0x1;this[_0x3d14('0x9')]=0x1;this[_0x3d14('0xa')]=![];this[_0x3d14('0xb')]=null;this[_0x3d14('0xc')]=![];this[_0x3d14('0xd')]=null;this[_0x3d14('0xe')]=![];this[_0x3d14('0xf')]=null;this[_0x3d14('0x10')]=0x1;this['channel']='';this[_0x3d14('0x11')]='';this[_0x3d14('0x12')]='';this[_0x3d14('0x13')]='';this[_0x3d14('0x14')]='';this[_0x3d14('0x15')]='';this[_0x3d14('0x16')]='';this[_0x3d14('0x17')]=0x0;this['assigned']=![];this[_0x3d14('0x18')]='';this[_0x3d14('0x19')]=_0x3d14('0x1a');this[_0x3d14('0x1b')]=0x0;this[_0x3d14('0x1c')]={};}module[_0x3d14('0x1d')]=QueueReport; \ No newline at end of file +var _0xf27a=['inbound','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xf27a,0x1ca));var _0xaf27=function(_0x11e6b1,_0x2f41c8){_0x11e6b1=_0x11e6b1-0x0;var _0x1585c6=_0xf27a[_0x11e6b1];return _0x1585c6;};'use strict';function QueueReport(){this[_0xaf27('0x0')]=_0xaf27('0x1');this[_0xaf27('0x2')]='';this['calleridnum']='';this[_0xaf27('0x3')]='';this[_0xaf27('0x4')]='';this[_0xaf27('0x5')]=null;this[_0xaf27('0x6')]=null;this['position']=0x1;this['count']=0x1;this[_0xaf27('0x7')]=![];this[_0xaf27('0x8')]=null;this[_0xaf27('0x9')]=![];this[_0xaf27('0xa')]=null;this[_0xaf27('0xb')]=![];this[_0xaf27('0xc')]=null;this['originalposition']=0x1;this[_0xaf27('0xd')]='';this[_0xaf27('0xe')]='';this['connectedlinename']='';this[_0xaf27('0xf')]='';this[_0xaf27('0x10')]='';this[_0xaf27('0x11')]='';this[_0xaf27('0x12')]='';this[_0xaf27('0x13')]=0x0;this[_0xaf27('0x14')]=![];this[_0xaf27('0x15')]='';this[_0xaf27('0x16')]=_0xaf27('0x17');this[_0xaf27('0x18')]=0x0;this[_0xaf27('0x19')]={};}module[_0xaf27('0x1a')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index bc34f2e..a50880e 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 _0x789f=['integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0x789f,0x10c));var _0xf789=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0x789f[_0x51b0dc];return _0x13fa89;};'use strict';function SalesforceAccount(_0x98b2f1){this['id']=_0x98b2f1['id']||0x0;this['name']=_0x98b2f1[_0xf789('0x0')]||'';this[_0xf789('0x1')]=_0x98b2f1[_0xf789('0x1')]||'';this[_0xf789('0x2')]=_0x98b2f1['remoteUri']||'';this[_0xf789('0x3')]=_0x98b2f1[_0xf789('0x3')]||'';this[_0xf789('0x4')]=_0x98b2f1[_0xf789('0x4')]||'';this['clientSecret']=_0x98b2f1[_0xf789('0x5')]||'';this[_0xf789('0x6')]=_0x98b2f1['securityToken']||'';this[_0xf789('0x7')]=_0x98b2f1[_0xf789('0x7')]||_0xf789('0x8');this[_0xf789('0x9')]=_0x98b2f1[_0xf789('0x9')]||'';this[_0xf789('0xa')]=_0x98b2f1[_0xf789('0xa')]||{};}module[_0xf789('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x8014=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x576481,_0x17626d){var _0x7f4b1a=function(_0x26dc06){while(--_0x26dc06){_0x576481['push'](_0x576481['shift']());}};_0x7f4b1a(++_0x17626d);}(_0x8014,0x163));var _0x4801=function(_0x10f6e8,_0x351db6){_0x10f6e8=_0x10f6e8-0x0;var _0x35bb3c=_0x8014[_0x10f6e8];return _0x35bb3c;};'use strict';function SalesforceAccount(_0x479809){this['id']=_0x479809['id']||0x0;this['name']=_0x479809[_0x4801('0x0')]||'';this[_0x4801('0x1')]=_0x479809[_0x4801('0x1')]||'';this['remoteUri']=_0x479809[_0x4801('0x2')]||'';this[_0x4801('0x3')]=_0x479809[_0x4801('0x3')]||'';this[_0x4801('0x4')]=_0x479809['clientId']||'';this[_0x4801('0x5')]=_0x479809['clientSecret']||'';this[_0x4801('0x6')]=_0x479809[_0x4801('0x6')]||'';this['type']=_0x479809[_0x4801('0x7')]||_0x4801('0x8');this[_0x4801('0x9')]=_0x479809[_0x4801('0x9')]||'';this[_0x4801('0xa')]=_0x479809[_0x4801('0xa')]||{};}module[_0x4801('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 5684201..acb12e8 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 _0x5cd1=['name','username','remoteUri','serverUrl','Configurations','exports'];(function(_0x42f265,_0x526c9e){var _0x27d79d=function(_0x1f081f){while(--_0x1f081f){_0x42f265['push'](_0x42f265['shift']());}};_0x27d79d(++_0x526c9e);}(_0x5cd1,0xc0));var _0x15cd=function(_0x335fd6,_0x599068){_0x335fd6=_0x335fd6-0x0;var _0x144baa=_0x5cd1[_0x335fd6];return _0x144baa;};'use strict';function ServicenowAccount(_0x48d6b5){this['id']=_0x48d6b5['id']||0x0;this[_0x15cd('0x0')]=_0x48d6b5['name']||'';this[_0x15cd('0x1')]=_0x48d6b5[_0x15cd('0x1')]||'';this['password']=_0x48d6b5['password']||'';this[_0x15cd('0x2')]=_0x48d6b5[_0x15cd('0x2')]||'';this['serverUrl']=_0x48d6b5[_0x15cd('0x3')]||'';this['Configurations']=_0x48d6b5[_0x15cd('0x4')]||{};}module[_0x15cd('0x5')]=ServicenowAccount; \ No newline at end of file +var _0x6396=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x467b77,_0x2a55bb){var _0x584e3c=function(_0x13cebf){while(--_0x13cebf){_0x467b77['push'](_0x467b77['shift']());}};_0x584e3c(++_0x2a55bb);}(_0x6396,0x1d1));var _0x6639=function(_0x40be86,_0x68fe5d){_0x40be86=_0x40be86-0x0;var _0xda3c3b=_0x6396[_0x40be86];return _0xda3c3b;};'use strict';function ServicenowAccount(_0x17188a){this['id']=_0x17188a['id']||0x0;this[_0x6639('0x0')]=_0x17188a[_0x6639('0x0')]||'';this['username']=_0x17188a[_0x6639('0x1')]||'';this[_0x6639('0x2')]=_0x17188a[_0x6639('0x2')]||'';this[_0x6639('0x3')]=_0x17188a[_0x6639('0x3')]||'';this[_0x6639('0x4')]=_0x17188a[_0x6639('0x4')]||'';this['Configurations']=_0x17188a[_0x6639('0x5')]||{};}module[_0x6639('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 24e1032..fea5d53 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 _0xc777=['password','remoteUri','Configurations','exports','name','username'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0xc777,0xca));var _0x7c77=function(_0x3cd24b,_0x282236){_0x3cd24b=_0x3cd24b-0x0;var _0x49067e=_0xc777[_0x3cd24b];return _0x49067e;};'use strict';function SugarcrmAccount(_0x4bf9fd){this['id']=_0x4bf9fd['id']||0x0;this[_0x7c77('0x0')]=_0x4bf9fd['name']||'';this[_0x7c77('0x1')]=_0x4bf9fd[_0x7c77('0x1')]||'';this['password']=_0x4bf9fd[_0x7c77('0x2')]||'';this[_0x7c77('0x3')]=_0x4bf9fd[_0x7c77('0x3')]||'';this['serverUrl']=_0x4bf9fd['serverUrl']||'';this['Configurations']=_0x4bf9fd[_0x7c77('0x4')]||{};}module[_0x7c77('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0xe214=['remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x13a541,_0x3919f3){var _0x6eaf11=function(_0x54eb87){while(--_0x54eb87){_0x13a541['push'](_0x13a541['shift']());}};_0x6eaf11(++_0x3919f3);}(_0xe214,0x11e));var _0x4e21=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe214[_0x21a9d9];return _0x46adce;};'use strict';function SugarcrmAccount(_0x3fd633){this['id']=_0x3fd633['id']||0x0;this[_0x4e21('0x0')]=_0x3fd633[_0x4e21('0x0')]||'';this[_0x4e21('0x1')]=_0x3fd633[_0x4e21('0x1')]||'';this['password']=_0x3fd633['password']||'';this[_0x4e21('0x2')]=_0x3fd633[_0x4e21('0x2')]||'';this[_0x4e21('0x3')]=_0x3fd633[_0x4e21('0x3')]||'';this[_0x4e21('0x4')]=_0x3fd633['Configurations']||{};}module[_0x4e21('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index aba7390..848aab4 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 _0x1816=['stateTime','address','name','accountcode','state','unknown'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x1816,0x15e));var _0x6181=function(_0x111bf0,_0x514d05){_0x111bf0=_0x111bf0-0x0;var _0x1a2ab7=_0x1816[_0x111bf0];return _0x1a2ab7;};'use strict';function Telephone(_0xdd2591){this['id']=_0xdd2591['id']||0x0;this[_0x6181('0x0')]=_0xdd2591[_0x6181('0x0')]||'';this['accountcode']=_0xdd2591[_0x6181('0x1')]||'';this[_0x6181('0x2')]=_0x6181('0x3');this[_0x6181('0x4')]=0x0;this['status']=_0x6181('0x3');this[_0x6181('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x2baa=['stateTime','status','unknown','exports','name','accountcode','state'];(function(_0x499e77,_0x2bc8ba){var _0x813198=function(_0x2750b3){while(--_0x2750b3){_0x499e77['push'](_0x499e77['shift']());}};_0x813198(++_0x2bc8ba);}(_0x2baa,0xdd));var _0xa2ba=function(_0xb60ae4,_0x48b458){_0xb60ae4=_0xb60ae4-0x0;var _0x53d530=_0x2baa[_0xb60ae4];return _0x53d530;};'use strict';function Telephone(_0x63174d){this['id']=_0x63174d['id']||0x0;this[_0xa2ba('0x0')]=_0x63174d[_0xa2ba('0x0')]||'';this[_0xa2ba('0x1')]=_0x63174d[_0xa2ba('0x1')]||'';this[_0xa2ba('0x2')]='unknown';this[_0xa2ba('0x3')]=0x0;this[_0xa2ba('0x4')]=_0xa2ba('0x5');this['address']='';}module[_0xa2ba('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 5d0080c..7c535fc 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 _0xb10b=['name','html'];(function(_0xb0ad0d,_0x412667){var _0x5ae019=function(_0x3415cb){while(--_0x3415cb){_0xb0ad0d['push'](_0xb0ad0d['shift']());}};_0x5ae019(++_0x412667);}(_0xb10b,0x12a));var _0xbb10=function(_0x51c726,_0x332b95){_0x51c726=_0x51c726-0x0;var _0x23fe86=_0xb10b[_0x51c726];return _0x23fe86;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x548701,_0x42eb21){var _0x504c6c=function(_0x4a602b){while(--_0x4a602b){_0x548701['push'](_0x548701['shift']());}};_0x504c6c(++_0x42eb21);}(_0xb10b,0x12a));var _0xbb10=function(_0x7ba032,_0x19c3ae){_0x7ba032=_0x7ba032-0x0;var _0x255dee=_0xb10b[_0x7ba032];return _0x255dee;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 2ca5022..6623a94 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 _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x15083f,_0x12105c){var _0x27fe99=function(_0xcf35b){while(--_0xcf35b){_0x15083f['push'](_0x15083f['shift']());}};_0x27fe99(++_0x12105c);}(_0xda3f,0xec));var _0xfda3=function(_0x80400b,_0x10f42d){_0x80400b=_0x80400b-0x0;var _0x322d95=_0xda3f[_0x80400b];return _0x322d95;};'use strict';function Trigger(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['channel']=_0x33f0ce['channel']||'voice';this[_0xfda3('0x1')]=_0x33f0ce['status']||![];this[_0xfda3('0x2')]=_0x33f0ce[_0xfda3('0x2')]||[];this['AnyConditions']=_0x33f0ce[_0xfda3('0x3')]||[];this[_0xfda3('0x4')]=_0x33f0ce['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index d90c8f0..c170a34 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 _0x9420=['domain','domainport','refresh','registrationtime','address','defaultuser','active','name','state','unknown','registry','host','port'];(function(_0x4f43f0,_0xaa55ce){var _0x43278c=function(_0xaee2a7){while(--_0xaee2a7){_0x4f43f0['push'](_0x4f43f0['shift']());}};_0x43278c(++_0xaa55ce);}(_0x9420,0x165));var _0x0942=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x9420[_0x5e3b04];return _0x1fc44d;};'use strict';function Trunk(_0x468ba6){this['id']=_0x468ba6['id']||0x0;this[_0x0942('0x0')]=_0x468ba6['active']||![];this[_0x0942('0x1')]=_0x468ba6['name']||'';this[_0x0942('0x2')]=_0x0942('0x3');this['stateTime']=0x0;this['status']=_0x0942('0x3');this[_0x0942('0x4')]=_0x468ba6[_0x0942('0x4')]&&_0x468ba6[_0x0942('0x4')]['indexOf'](':')?_0x468ba6[_0x0942('0x4')]['split'](':')[0x0]:'';this[_0x0942('0x5')]='';this[_0x0942('0x6')]='';this[_0x0942('0x7')]='';this[_0x0942('0x8')]='';this[_0x0942('0x9')]='';this['stateRegistry']=_0x0942('0x3');this[_0x0942('0xa')]='';this[_0x0942('0xb')]='';this['defaultuser']=_0x468ba6[_0x0942('0xc')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0xc0f9=['host','domain','domainport','refresh','stateRegistry','registrationtime','defaultuser','exports','active','state','unknown','status','registry','split'];(function(_0x234783,_0x5df303){var _0x11633e=function(_0x167fba){while(--_0x167fba){_0x234783['push'](_0x234783['shift']());}};_0x11633e(++_0x5df303);}(_0xc0f9,0x190));var _0x9c0f=function(_0xbb0ce8,_0xb63549){_0xbb0ce8=_0xbb0ce8-0x0;var _0x1a1b17=_0xc0f9[_0xbb0ce8];return _0x1a1b17;};'use strict';function Trunk(_0x322c20){this['id']=_0x322c20['id']||0x0;this[_0x9c0f('0x0')]=_0x322c20[_0x9c0f('0x0')]||![];this['name']=_0x322c20['name']||'';this[_0x9c0f('0x1')]=_0x9c0f('0x2');this['stateTime']=0x0;this[_0x9c0f('0x3')]='unknown';this[_0x9c0f('0x4')]=_0x322c20[_0x9c0f('0x4')]&&_0x322c20['registry']['indexOf'](':')?_0x322c20['registry'][_0x9c0f('0x5')](':')[0x0]:'';this[_0x9c0f('0x6')]='';this['port']='';this[_0x9c0f('0x7')]='';this[_0x9c0f('0x8')]='';this[_0x9c0f('0x9')]='';this[_0x9c0f('0xa')]='unknown';this[_0x9c0f('0xb')]='';this['address']='';this[_0x9c0f('0xc')]=_0x322c20['defaultuser']||'';}module[_0x9c0f('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index cbfa18b..2b452da 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 _0x109d=['exports','recordingFormat','none','mandatoryDisposition'];(function(_0x449312,_0x54c85d){var _0x7acfc=function(_0x215143){while(--_0x215143){_0x449312['push'](_0x449312['shift']());}};_0x7acfc(++_0x54c85d);}(_0x109d,0xfd));var _0xd109=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x109d[_0x17d9e3];return _0x14192d;};'use strict';function voiceExtension(_0x2ee4d4){this['id']=_0x2ee4d4['id']||0x0;this['exten']=_0x2ee4d4['exten']||'';this['recordingFormat']=_0x2ee4d4[_0xd109('0x0')]||_0xd109('0x1');this[_0xd109('0x2')]=_0x2ee4d4[_0xd109('0x2')]||![];}module[_0xd109('0x3')]=voiceExtension; \ No newline at end of file +var _0x2b32=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x57d8a0,_0x57795f){var _0x1086a1=function(_0x484452){while(--_0x484452){_0x57d8a0['push'](_0x57d8a0['shift']());}};_0x1086a1(++_0x57795f);}(_0x2b32,0x7f));var _0x22b3=function(_0x2a4fe2,_0x3ec53a){_0x2a4fe2=_0x2a4fe2-0x0;var _0x225c4a=_0x2b32[_0x2a4fe2];return _0x225c4a;};'use strict';function voiceExtension(_0x229f26){this['id']=_0x229f26['id']||0x0;this[_0x22b3('0x0')]=_0x229f26[_0x22b3('0x0')]||'';this[_0x22b3('0x1')]=_0x229f26['recordingFormat']||_0x22b3('0x2');this[_0x22b3('0x3')]=_0x229f26[_0x22b3('0x3')]||![];}module[_0x22b3('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 90d7ec7..df0ca72 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 _0x5162=['mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','monitor_format','type','inbound','waiting','total','sumDuration','sumHoldTime','sumBillable','inUse','invalid','loggedIn','notInUse','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition'];(function(_0x197fd5,_0x1dbecd){var _0xd52bed=function(_0x4ba4cb){while(--_0x4ba4cb){_0x197fd5['push'](_0x197fd5['shift']());}};_0xd52bed(++_0x1dbecd);}(_0x5162,0x103));var _0x2516=function(_0x43a4c2,_0x4e400f){_0x43a4c2=_0x43a4c2-0x0;var _0x3cd4fb=_0x5162[_0x43a4c2];return _0x3cd4fb;};'use strict';var monitorFormat={'wav':_0x2516('0x0'),'wav49':'wav49','gsm':'gsm'};var strategy={'fewestcalls':'fewestcalls','leastrecent':'leastrecent','linear':_0x2516('0x1'),'random':_0x2516('0x2'),'ringall':_0x2516('0x3'),'rr':_0x2516('0x4'),'rrmemory':_0x2516('0x5'),'rrordered':_0x2516('0x6'),'wrandom':_0x2516('0x7')};function VoiceQueue(_0x5b71b5){this['id']=_0x5b71b5['id']||0x0;this['name']=_0x5b71b5['name']||'';this[_0x2516('0x8')]=_0x5b71b5[_0x2516('0x8')]||'';this[_0x2516('0x9')]=_0x5b71b5[_0x2516('0x9')]||_0x2516('0xa');this[_0x2516('0xb')]=0x0;this[_0x2516('0xc')]=0x0;this['answered']=0x0;this[_0x2516('0xd')]=0x0;this[_0x2516('0xe')]=0x0;this[_0x2516('0xf')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this['available']=0x0;this['busy']=0x0;this[_0x2516('0x10')]=0x0;this[_0x2516('0x11')]=0x0;this[_0x2516('0x12')]=0x0;this[_0x2516('0x13')]=0x0;this['onHold']=0x0;this[_0x2516('0x14')]=0x0;this[_0x2516('0x15')]=0x0;this[_0x2516('0x16')]=0x0;this[_0x2516('0x17')]=0x0;this[_0x2516('0x18')]=0x0;this[_0x2516('0x19')]=0x0;this[_0x2516('0x1a')]=_0x5b71b5[_0x2516('0x1a')]||![];this[_0x2516('0x1b')]=_0x5b71b5[_0x2516('0x1b')]||0xa;this[_0x2516('0x1c')]=_0x5b71b5[_0x2516('0x1c')]||'no';this[_0x2516('0x1d')]=!![];this[_0x2516('0x1e')]='';this[_0x2516('0x1f')]='';this['originated']=0x0;this[_0x2516('0x20')]=0x0;this[_0x2516('0x21')]=_0x5b71b5[_0x2516('0x21')]||null;this['dialGlobalInterval']=_0x5b71b5[_0x2516('0x22')]?_0x5b71b5['dialGlobalInterval']:null;this['dialActive']=_0x5b71b5[_0x2516('0x23')];this[_0x2516('0x24')]=_0x5b71b5[_0x2516('0x24')]||_0x2516('0x25');this[_0x2516('0x26')]=_0x5b71b5[_0x2516('0x26')]||0x0;this[_0x2516('0x27')]=_0x5b71b5[_0x2516('0x27')]||0x0;this[_0x2516('0x28')]=_0x5b71b5[_0x2516('0x28')]||0x1;this[_0x2516('0x29')]=_0x5b71b5[_0x2516('0x29')]||_0x2516('0x2a');this['dialPredictiveOptimizationPercentage']=_0x5b71b5['dialPredictiveOptimizationPercentage']||0.03;this[_0x2516('0x2b')]=_0x5b71b5[_0x2516('0x2b')]||0x258;this[_0x2516('0x2c')]=_0x5b71b5[_0x2516('0x2c')]||_0x2516('0x2d');this[_0x2516('0x2e')]=_0x5b71b5[_0x2516('0x2e')]||_0x2516('0x2d');this['dialOriginateTimeout']=_0x5b71b5[_0x2516('0x2f')]||0x1e;this[_0x2516('0x30')]=_0x5b71b5[_0x2516('0x30')]||_0x2516('0x31');this['dialQueueTimeout']=_0x5b71b5[_0x2516('0x32')]||0x3;this[_0x2516('0x33')]=_0x5b71b5[_0x2516('0x33')]||undefined;this[_0x2516('0x34')]=_0x5b71b5[_0x2516('0x34')]||0x3;this['dialCongestionRetryFrequency']=_0x5b71b5[_0x2516('0x35')]||0x96;this[_0x2516('0x36')]=_0x5b71b5[_0x2516('0x36')]||0x3;this[_0x2516('0x37')]=_0x5b71b5[_0x2516('0x37')]||0x96;this[_0x2516('0x38')]=_0x5b71b5['dialNoAnswerMaxRetry']||0x3;this[_0x2516('0x39')]=_0x5b71b5[_0x2516('0x39')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x5b71b5[_0x2516('0x3a')]||0x3;this[_0x2516('0x3b')]=_0x5b71b5[_0x2516('0x3b')]||0x96;this[_0x2516('0x3c')]=_0x5b71b5[_0x2516('0x3c')]||0x3;this[_0x2516('0x3d')]=_0x5b71b5[_0x2516('0x3d')]||0x96;this[_0x2516('0x3e')]=_0x5b71b5[_0x2516('0x3e')]||0x3;this[_0x2516('0x3f')]=_0x5b71b5[_0x2516('0x3f')]||0x96;this[_0x2516('0x40')]=_0x5b71b5[_0x2516('0x40')]||0x3;this[_0x2516('0x41')]=_0x5b71b5[_0x2516('0x41')]||0x96;this['dialAgentRejectMaxRetry']=_0x5b71b5[_0x2516('0x42')]||0x3;this['dialAgentRejectRetryFrequency']=_0x5b71b5[_0x2516('0x43')]||0x96;this['callAdditionalPhoneAfterMin']=_0x5b71b5[_0x2516('0x44')]||0x3;this['dialGlobalMaxRetry']=_0x5b71b5[_0x2516('0x45')]||0x4;this[_0x2516('0x46')]=_0x5b71b5[_0x2516('0x46')]?_0x5b71b5[_0x2516('0x46')]:undefined;this[_0x2516('0x47')]=_0x5b71b5[_0x2516('0x47')]?_0x5b71b5[_0x2516('0x47')]:undefined;this[_0x2516('0x48')]=_0x5b71b5[_0x2516('0x48')]||undefined;this['Interval']=_0x5b71b5[_0x2516('0x49')]?_0x5b71b5[_0x2516('0x49')]:undefined;this[_0x2516('0x4a')]=_0x5b71b5[_0x2516('0x4a')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x5b71b5[_0x2516('0x4b')]||undefined;this[_0x2516('0x4c')]=_0x5b71b5[_0x2516('0x4c')]||undefined;this[_0x2516('0x4d')]=strategy[_0x5b71b5[_0x2516('0x4d')]];this[_0x2516('0x4e')]=!![];this[_0x2516('0x4f')]=_0x5b71b5[_0x2516('0x4f')]||![];this[_0x2516('0x50')]=_0x5b71b5[_0x2516('0x50')];this['dialAMDGreeting']=_0x5b71b5['dialAMDGreeting'];this[_0x2516('0x51')]=_0x5b71b5[_0x2516('0x51')];this['dialAMDTotalAnalysisTime']=_0x5b71b5['dialAMDTotalAnalysisTime'];this[_0x2516('0x52')]=_0x5b71b5[_0x2516('0x52')];this['dialAMDBetweenWordsSilence']=_0x5b71b5[_0x2516('0x53')];this['dialAMDMaximumNumberOfWords']=_0x5b71b5[_0x2516('0x54')];this[_0x2516('0x55')]=_0x5b71b5['dialAMDSilenceThreshold'];this[_0x2516('0x56')]=_0x5b71b5[_0x2516('0x56')];this[_0x2516('0x57')]=0x0;this[_0x2516('0x58')]=0x0;this[_0x2516('0x59')]=_0x5b71b5[_0x2516('0x59')];this[_0x2516('0x5a')]=0x0;this[_0x2516('0x5b')]=0x0;this[_0x2516('0x5c')]=0x0;this[_0x2516('0x5d')]=0x0;this[_0x2516('0x5e')]=0x0;this[_0x2516('0x5f')]=0x0;this[_0x2516('0x60')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x2516('0x61')]=0x0;this[_0x2516('0x62')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x2516('0x63')]=0x0;this[_0x2516('0x64')]=0x0;this[_0x2516('0x65')]=0x0;this[_0x2516('0x66')]=undefined;this[_0x2516('0x67')]=undefined;this['handlePredictive']=undefined;this[_0x2516('0x68')]=1.05;this[_0x2516('0x69')]=0x0;this[_0x2516('0x6a')]=0x0;this[_0x2516('0x6b')]=0x0;this[_0x2516('0x6c')]=0x0;this[_0x2516('0x6d')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x2516('0x6e')]=0x0;this[_0x2516('0x6f')]=0x0;this[_0x2516('0x70')]=_0x5b71b5[_0x2516('0x71')]||0x14;this[_0x2516('0x72')]=_0x5b71b5[_0x2516('0x71')]||0xa;this[_0x2516('0x73')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x2516('0x74')]=0x1;this['erlangCalls']=0x0;this[_0x2516('0x75')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x2516('0x76')]=0x0;this[_0x2516('0x77')]=_0x5b71b5[_0x2516('0x77')]||0x1e;this['dialRecallInQueue']=_0x5b71b5['dialRecallInQueue']||![];this[_0x2516('0x78')]=!!_0x5b71b5[_0x2516('0x78')]||![];this['dialPreviewRecallmeReminder']=!!_0x5b71b5['dialPreviewRecallmeReminder']||![];this[_0x2516('0x79')]=_0x5b71b5[_0x2516('0x79')]||undefined;this[_0x2516('0x7a')]=_0x5b71b5['dialAgiAfterHangupClient']||![];this[_0x2516('0x7b')]=_0x5b71b5['dialAgiAfterHangupAgent']||![];this[_0x2516('0x8')]=monitorFormat[_0x5b71b5[_0x2516('0x8')]]?monitorFormat[_0x5b71b5[_0x2516('0x8')]]:undefined;this[_0x2516('0x7c')]=_0x5b71b5['mandatoryDisposition']||![];this[_0x2516('0x7d')]=_0x5b71b5[_0x2516('0x7d')]?_0x5b71b5[_0x2516('0x7d')]:undefined;this[_0x2516('0x7e')]=![];}module[_0x2516('0x7f')]=VoiceQueue; \ No newline at end of file +var _0xbb05=['dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','wav','wav49','gsm','leastrecent','linear','random','rrmemory','rrordered','name','monitor_format','inbound','waiting','total','answered','sumDuration','sumBillable','abandoned','available','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xbb05,0x1b6));var _0x5bb0=function(_0x711472,_0x10715d){_0x711472=_0x711472-0x0;var _0x238cb3=_0xbb05[_0x711472];return _0x238cb3;};'use strict';var monitorFormat={'wav':_0x5bb0('0x0'),'wav49':_0x5bb0('0x1'),'gsm':_0x5bb0('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x5bb0('0x3'),'linear':_0x5bb0('0x4'),'random':_0x5bb0('0x5'),'ringall':'ringall','rr':'roundrobin','rrmemory':_0x5bb0('0x6'),'rrordered':_0x5bb0('0x7'),'wrandom':'wrandom'};function VoiceQueue(_0x5854e0){this['id']=_0x5854e0['id']||0x0;this[_0x5bb0('0x8')]=_0x5854e0[_0x5bb0('0x8')]||'';this[_0x5bb0('0x9')]=_0x5854e0[_0x5bb0('0x9')]||'';this['type']=_0x5854e0['type']||_0x5bb0('0xa');this[_0x5bb0('0xb')]=0x0;this[_0x5bb0('0xc')]=0x0;this[_0x5bb0('0xd')]=0x0;this[_0x5bb0('0xe')]=0x0;this['sumHoldTime']=0x0;this[_0x5bb0('0xf')]=0x0;this['unmanaged']=0x0;this[_0x5bb0('0x10')]=0x0;this[_0x5bb0('0x11')]=0x0;this['busy']=0x0;this['inUse']=0x0;this['invalid']=0x0;this['loggedIn']=0x0;this[_0x5bb0('0x12')]=0x0;this[_0x5bb0('0x13')]=0x0;this[_0x5bb0('0x14')]=0x0;this[_0x5bb0('0x15')]=0x0;this[_0x5bb0('0x16')]=0x0;this[_0x5bb0('0x17')]=0x0;this[_0x5bb0('0x18')]=0x0;this[_0x5bb0('0x19')]=0x0;this[_0x5bb0('0x1a')]=_0x5854e0[_0x5bb0('0x1a')]||![];this[_0x5bb0('0x1b')]=_0x5854e0[_0x5bb0('0x1b')]||0xa;this[_0x5bb0('0x1c')]=_0x5854e0[_0x5bb0('0x1c')]||'no';this[_0x5bb0('0x1d')]=!![];this['message']='';this[_0x5bb0('0x1e')]='';this[_0x5bb0('0x1f')]=0x0;this[_0x5bb0('0x20')]=0x0;this[_0x5bb0('0x21')]=_0x5854e0[_0x5bb0('0x21')]||null;this['dialGlobalInterval']=_0x5854e0[_0x5bb0('0x22')]?_0x5854e0['dialGlobalInterval']:null;this[_0x5bb0('0x23')]=_0x5854e0[_0x5bb0('0x23')];this[_0x5bb0('0x24')]=_0x5854e0['dialMethod']||_0x5bb0('0x25');this[_0x5bb0('0x26')]=_0x5854e0['dialLimitChannel']||0x0;this[_0x5bb0('0x27')]=_0x5854e0[_0x5bb0('0x27')]||0x0;this['dialPowerLevel']=_0x5854e0[_0x5bb0('0x28')]||0x1;this[_0x5bb0('0x29')]=_0x5854e0[_0x5bb0('0x29')]||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x5854e0[_0x5bb0('0x2a')]||0.03;this['dialPredictiveInterval']=_0x5854e0[_0x5bb0('0x2b')]||0x258;this['dialOriginateCallerIdName']=_0x5854e0['dialOriginateCallerIdName']||'anonymous';this[_0x5bb0('0x2c')]=_0x5854e0[_0x5bb0('0x2c')]||_0x5bb0('0x2d');this['dialOriginateTimeout']=_0x5854e0[_0x5bb0('0x2e')]||0x1e;this[_0x5bb0('0x2f')]=_0x5854e0[_0x5bb0('0x2f')]||_0x5bb0('0x30');this[_0x5bb0('0x31')]=_0x5854e0[_0x5bb0('0x31')]||0x3;this['dialQueueProject']=_0x5854e0[_0x5bb0('0x32')]||undefined;this[_0x5bb0('0x33')]=_0x5854e0['dialCongestionMaxRetry']||0x3;this[_0x5bb0('0x34')]=_0x5854e0[_0x5bb0('0x34')]||0x96;this[_0x5bb0('0x35')]=_0x5854e0[_0x5bb0('0x35')]||0x3;this[_0x5bb0('0x36')]=_0x5854e0[_0x5bb0('0x36')]||0x96;this[_0x5bb0('0x37')]=_0x5854e0[_0x5bb0('0x37')]||0x3;this['dialNoAnswerRetryFrequency']=_0x5854e0['dialNoAnswerRetryFrequency']||0x96;this[_0x5bb0('0x38')]=_0x5854e0[_0x5bb0('0x38')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x5854e0[_0x5bb0('0x39')]||0x96;this[_0x5bb0('0x3a')]=_0x5854e0[_0x5bb0('0x3a')]||0x3;this['dialDropRetryFrequency']=_0x5854e0['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x5854e0['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x5854e0[_0x5bb0('0x3b')]||0x96;this[_0x5bb0('0x3c')]=_0x5854e0['dialMachineMaxRetry']||0x3;this[_0x5bb0('0x3d')]=_0x5854e0[_0x5bb0('0x3d')]||0x96;this[_0x5bb0('0x3e')]=_0x5854e0[_0x5bb0('0x3e')]||0x3;this[_0x5bb0('0x3f')]=_0x5854e0['dialAgentRejectRetryFrequency']||0x96;this[_0x5bb0('0x40')]=_0x5854e0[_0x5bb0('0x40')]||0x3;this[_0x5bb0('0x41')]=_0x5854e0['dialGlobalMaxRetry']||0x4;this[_0x5bb0('0x42')]=_0x5854e0[_0x5bb0('0x42')]?_0x5854e0[_0x5bb0('0x42')]:undefined;this['TrunkBackup']=_0x5854e0['TrunkBackup']?_0x5854e0[_0x5bb0('0x43')]:undefined;this[_0x5bb0('0x44')]=_0x5854e0[_0x5bb0('0x44')]||undefined;this['Interval']=_0x5854e0['Interval']?_0x5854e0[_0x5bb0('0x45')]:undefined;this[_0x5bb0('0x46')]=_0x5854e0[_0x5bb0('0x46')]||_0x5bb0('0x47');this[_0x5bb0('0x48')]=_0x5854e0[_0x5bb0('0x48')]||undefined;this[_0x5bb0('0x49')]=_0x5854e0['dialCutDigit']||undefined;this[_0x5bb0('0x4a')]=strategy[_0x5854e0['strategy']];this[_0x5bb0('0x4b')]=!![];this['dialAMDActive']=_0x5854e0[_0x5bb0('0x4c')]||![];this['dialAMDInitialSilence']=_0x5854e0['dialAMDInitialSilence'];this[_0x5bb0('0x4d')]=_0x5854e0[_0x5bb0('0x4d')];this[_0x5bb0('0x4e')]=_0x5854e0[_0x5bb0('0x4e')];this[_0x5bb0('0x4f')]=_0x5854e0[_0x5bb0('0x4f')];this[_0x5bb0('0x50')]=_0x5854e0[_0x5bb0('0x50')];this[_0x5bb0('0x51')]=_0x5854e0[_0x5bb0('0x51')];this[_0x5bb0('0x52')]=_0x5854e0[_0x5bb0('0x52')];this[_0x5bb0('0x53')]=_0x5854e0['dialAMDSilenceThreshold'];this[_0x5bb0('0x54')]=_0x5854e0['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0x5bb0('0x55')]=_0x5854e0['timeout'];this[_0x5bb0('0x56')]=0x0;this[_0x5bb0('0x57')]=0x0;this[_0x5bb0('0x58')]=0x0;this[_0x5bb0('0x59')]=0x0;this[_0x5bb0('0x5a')]=0x0;this[_0x5bb0('0x5b')]=0x0;this[_0x5bb0('0x5c')]=0x0;this[_0x5bb0('0x5d')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x5bb0('0x5e')]=0x0;this[_0x5bb0('0x5f')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x5bb0('0x60')]=0x0;this[_0x5bb0('0x61')]=0x0;this[_0x5bb0('0x62')]=undefined;this[_0x5bb0('0x63')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x5bb0('0x64')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x5bb0('0x65')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x5bb0('0x66')]=0x0;this[_0x5bb0('0x67')]=0x0;this[_0x5bb0('0x68')]=0x0;this[_0x5bb0('0x69')]=0x0;this[_0x5bb0('0x6a')]=_0x5854e0[_0x5bb0('0x6b')]||0x14;this[_0x5bb0('0x6c')]=_0x5854e0[_0x5bb0('0x6b')]||0xa;this[_0x5bb0('0x6d')]=0x0;this[_0x5bb0('0x6e')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x5bb0('0x6f')]=0x0;this[_0x5bb0('0x70')]=0x0;this[_0x5bb0('0x71')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x5854e0[_0x5bb0('0x72')]||0x1e;this[_0x5bb0('0x73')]=_0x5854e0['dialRecallInQueue']||![];this['dialPreviewAutoRecallMe']=!!_0x5854e0[_0x5bb0('0x74')]||![];this[_0x5bb0('0x75')]=!!_0x5854e0['dialPreviewRecallmeReminder']||![];this[_0x5bb0('0x76')]=_0x5854e0[_0x5bb0('0x76')]||undefined;this[_0x5bb0('0x77')]=_0x5854e0[_0x5bb0('0x77')]||![];this[_0x5bb0('0x78')]=_0x5854e0[_0x5bb0('0x78')]||![];this[_0x5bb0('0x9')]=monitorFormat[_0x5854e0[_0x5bb0('0x9')]]?monitorFormat[_0x5854e0[_0x5bb0('0x9')]]:undefined;this['mandatoryDisposition']=_0x5854e0['mandatoryDisposition']||![];this[_0x5bb0('0x79')]=_0x5854e0[_0x5bb0('0x79')]?_0x5854e0[_0x5bb0('0x79')]:undefined;this['queueSummaryCountersUpdated']=![];}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 6d6e9bc..fa40c20 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae53=['preview','exports','available','loggedInDb','paused','ringing','waiting','answered','inUse','loggedIn','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','talking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','unavailable','loggedin','callers','length','online','incall','includes','status','booked','keys','queue','dialer','xcally-motion-preview','compareToInboundQueue','some','updateReportFromOutboundQueue'];(function(_0x51de21,_0x2143bb){var _0x11e461=function(_0x1b17e8){while(--_0x1b17e8){_0x51de21['push'](_0x51de21['shift']());}};_0x11e461(++_0x2143bb);}(_0xae53,0x16e));var _0x3ae5=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xae53[_0x2dadb9];return _0x2f0097;};'use strict';var INBOUND_COUNTERS=[_0x3ae5('0x0'),'loggedIn',_0x3ae5('0x1'),_0x3ae5('0x2'),_0x3ae5('0x3'),'talking',_0x3ae5('0x4')];var OUTBOUND_COUNTERS=[_0x3ae5('0x0'),_0x3ae5('0x5'),_0x3ae5('0x6'),_0x3ae5('0x7'),'loggedInDb',_0x3ae5('0x8'),'outboundAbandonedCallsDay',_0x3ae5('0x9'),_0x3ae5('0xa'),_0x3ae5('0xb'),_0x3ae5('0xc'),_0x3ae5('0xd'),_0x3ae5('0xe'),_0x3ae5('0xf'),_0x3ae5('0x10'),'outboundUnknownCallsDay',_0x3ae5('0x2'),'pTalking',_0x3ae5('0x11'),_0x3ae5('0x12'),_0x3ae5('0x13'),_0x3ae5('0x14'),_0x3ae5('0x4')];function VoiceQueueSummary(_0x531277){this['id']=_0x531277['id'];this[_0x3ae5('0x15')]=_0x531277[_0x3ae5('0x15')];this[_0x3ae5('0x16')]=_0x531277['strategy'];this['abandoned']=_0x531277[_0x3ae5('0x17')]||0x0;this['answered']=_0x531277[_0x3ae5('0x5')]||0x0;this[_0x3ae5('0x0')]=_0x531277[_0x3ae5('0x0')]||0x0;this[_0x3ae5('0x18')]=_0x531277[_0x3ae5('0x18')]||0x0;this['inUse']=_0x531277[_0x3ae5('0x6')]||0x0;this[_0x3ae5('0x19')]=_0x531277[_0x3ae5('0x19')]||0x0;this['loggedIn']=_0x531277['loggedIn']||0x0;this[_0x3ae5('0x1')]=_0x531277[_0x3ae5('0x1')]||0x0;this[_0x3ae5('0x1a')]=_0x531277[_0x3ae5('0x1a')]||0x0;this[_0x3ae5('0x1b')]=_0x531277[_0x3ae5('0x1b')]||0x0;this[_0x3ae5('0x2')]=_0x531277['paused']||0x0;this['ringing']=_0x531277['ringing']||0x0;this[_0x3ae5('0x1c')]=_0x531277[_0x3ae5('0x1c')];this[_0x3ae5('0x12')]=_0x531277[_0x3ae5('0x12')];this[_0x3ae5('0x13')]=_0x531277[_0x3ae5('0x13')];this[_0x3ae5('0x1d')]=_0x531277['sumHoldTime']||0x0;this[_0x3ae5('0x11')]=_0x531277[_0x3ae5('0x11')]||0x0;this[_0x3ae5('0x14')]=_0x531277[_0x3ae5('0x14')]||0x0;this[_0x3ae5('0x1e')]=_0x531277[_0x3ae5('0x1e')];this['unavailable']=_0x531277['unavailable']||0x0;this[_0x3ae5('0x1f')]=_0x531277[_0x3ae5('0x1f')]||0x0;this[_0x3ae5('0x20')]=_0x531277[_0x3ae5('0x20')]||0x0;this[_0x3ae5('0x4')]=_0x531277[_0x3ae5('0x4')]||0x0;if(_0x531277[_0x3ae5('0x1e')]===_0x3ae5('0x21')){this[_0x3ae5('0x22')]=_0x531277['pTalking']||0x0;this[_0x3ae5('0x23')]=_0x531277[_0x3ae5('0x23')];this[_0x3ae5('0x24')]=_0x531277['dialMethod'];this[_0x3ae5('0x25')]=_0x531277[_0x3ae5('0x25')];this[_0x3ae5('0x26')]=_0x531277[_0x3ae5('0x26')];this[_0x3ae5('0x27')]=_0x531277['dialOriginateTimeout'];this[_0x3ae5('0x28')]=_0x531277[_0x3ae5('0x28')];this[_0x3ae5('0x29')]=_0x531277[_0x3ae5('0x29')];this[_0x3ae5('0x2a')]=_0x531277[_0x3ae5('0x2a')];this[_0x3ae5('0x9')]=_0x531277['outboundAnswerCallsDay'];this[_0x3ae5('0xa')]=_0x531277[_0x3ae5('0xa')];this[_0x3ae5('0xb')]=_0x531277['outboundBusyCallsDay'];this[_0x3ae5('0xc')]=_0x531277[_0x3ae5('0xc')];this[_0x3ae5('0x2b')]=_0x531277[_0x3ae5('0x2b')];this[_0x3ae5('0x2c')]=_0x531277[_0x3ae5('0x2c')];this[_0x3ae5('0x2d')]=_0x531277[_0x3ae5('0x2d')];this['outboundNoAnswerCallsDay']=_0x531277[_0x3ae5('0xd')];this[_0x3ae5('0xe')]=_0x531277[_0x3ae5('0xe')];this['outboundOriginateFailureCallsDay']=_0x531277[_0x3ae5('0x2e')];this['outboundReCallsDay']=_0x531277['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x531277[_0x3ae5('0x10')];this[_0x3ae5('0x2f')]=_0x531277[_0x3ae5('0x2f')];this[_0x3ae5('0x30')]=_0x531277['predictiveIntervalAnsweredCalls'];this['predictiveIntervalAvgHoldtime']=_0x531277[_0x3ae5('0x31')];this['predictiveIntervalAvgTalktime']=_0x531277[_0x3ae5('0x32')];this[_0x3ae5('0x33')]=_0x531277[_0x3ae5('0x33')];this['predictiveIntervalDroppedCallsTimeout']=_0x531277[_0x3ae5('0x34')];this[_0x3ae5('0x35')]=_0x531277['predictiveIntervalErlangCalls'];this['predictiveIntervalErlangCallsDroppedCalls']=_0x531277[_0x3ae5('0x36')];this['predictiveIntervalHitRate']=_0x531277[_0x3ae5('0x37')];this[_0x3ae5('0x38')]=_0x531277[_0x3ae5('0x38')];this[_0x3ae5('0x39')]=_0x531277[_0x3ae5('0x39')];this[_0x3ae5('0x3a')]=_0x531277[_0x3ae5('0x3a')];this[_0x3ae5('0x3b')]=_0x531277['predictiveIntervalTotalCalls'];this[_0x3ae5('0x8')]=_0x531277['originated'];this[_0x3ae5('0x3c')]=_0x531277[_0x3ae5('0x3c')];this[_0x3ae5('0x3d')]=_0x531277[_0x3ae5('0x3d')];this[_0x3ae5('0x3e')]=_0x531277[_0x3ae5('0x3e')];this[_0x3ae5('0x3f')]=_0x531277['erlangBusyFactor'];this['startPredictive']=_0x531277[_0x3ae5('0x40')];this['startProgressive']=_0x531277[_0x3ae5('0x41')];this[_0x3ae5('0x42')]=_0x531277[_0x3ae5('0x42')];this[_0x3ae5('0x43')]=_0x531277['statusMessage'];}if(_0x531277[_0x3ae5('0x44')]){this[_0x3ae5('0x44')]={'id':_0x531277[_0x3ae5('0x44')]['id'],'name':_0x531277[_0x3ae5('0x44')][_0x3ae5('0x15')],'active':_0x531277[_0x3ae5('0x44')][_0x3ae5('0x45')],'callerid':_0x531277[_0x3ae5('0x44')][_0x3ae5('0x46')]};}}VoiceQueueSummary[_0x3ae5('0x47')][_0x3ae5('0x48')]=function(_0x47e103,_0x2e0bae,_0x234143,_0x1814fd){this[_0x3ae5('0x1')]=0x0;this[_0x3ae5('0x11')]=0x0;this[_0x3ae5('0x2')]=0x0;this['unknown']=0x0;this[_0x3ae5('0x1b')]=0x0;this[_0x3ae5('0x6')]=0x0;this['busy']=0x0;this[_0x3ae5('0x19')]=0x0;this[_0x3ae5('0x49')]=0x0;this['ringing']=0x0;this[_0x3ae5('0x1c')]=0x0;this[_0x3ae5('0x1a')]=0x0;if(_0x234143){if(_0x234143[_0x3ae5('0x0')]){this[_0x3ae5('0x0')]=Number(_0x234143[_0x3ae5('0x0')]);}if(_0x234143[_0x3ae5('0x4a')]){this['loggedIn']=Number(_0x234143['loggedin']);}if(_0x234143[_0x3ae5('0x4b')]){this[_0x3ae5('0x4')]=Number(_0x234143['callers']);}}for(var _0x134114=0x0;_0x134114<_0x47e103[_0x3ae5('0x4c')];_0x134114++){var _0x16ff7c=_0x2e0bae['SIP/'+_0x47e103[_0x134114][_0x3ae5('0x15')]];if(_0x16ff7c&&_0x16ff7c[_0x3ae5('0x4d')]){this[_0x3ae5('0x1')]+=0x1;}if(_0x47e103[_0x134114][_0x3ae5('0x4e')]==='1'){this['talking']+=0x1;}if(_0x47e103[_0x134114][_0x3ae5('0x2')]==='1'&&!['2','7','8'][_0x3ae5('0x4f')](_0x47e103[_0x134114][_0x3ae5('0x50')])){this[_0x3ae5('0x2')]+=0x1;}switch(_0x47e103[_0x134114]['status']){case'0':this[_0x3ae5('0x1f')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x3ae5('0x18')]+=0x1;break;case'4':this[_0x3ae5('0x19')]+=0x1;break;case'5':this[_0x3ae5('0x49')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x3ae5('0x1c')]+=0x1;break;case'8':this[_0x3ae5('0x1a')]+=0x1;break;}}if(this[_0x3ae5('0x24')]===_0x3ae5('0x51')){var _0x2b899c=Object[_0x3ae5('0x52')](_0x1814fd);for(var _0x304182=0x0;_0x304182<_0x2b899c[_0x3ae5('0x4c')];_0x304182++){var _0x223ba1=_0x2b899c[_0x304182];var _0x3bd073=_0x1814fd[_0x223ba1];if(_0x3bd073[_0x3ae5('0x53')]===this[_0x3ae5('0x15')]&&_0x3bd073[_0x3ae5('0x1e')]===_0x3ae5('0x54')&&_0x3bd073['exten']===_0x3ae5('0x55')){this[_0x3ae5('0x11')]+=0x1;}}if(this[_0x3ae5('0x11')]>this[_0x3ae5('0x6')]){this[_0x3ae5('0x11')]=this[_0x3ae5('0x6')];}this[_0x3ae5('0x22')]=0x0;}return this;};VoiceQueueSummary[_0x3ae5('0x47')][_0x3ae5('0x56')]=function(_0x4f054b){var _0x2d6bf4=![];if(_0x4f054b){_0x2d6bf4=INBOUND_COUNTERS[_0x3ae5('0x57')](function(_0x7ef748){return this[_0x7ef748]!==_0x4f054b[_0x7ef748];},this);}return _0x2d6bf4;};VoiceQueueSummary[_0x3ae5('0x47')]['compareToOutboundQueue']=function(_0x1b3826){var _0x38e748=![];var _0x286f98=![];var _0x4a7320=![];if(_0x1b3826){_0x38e748=this[_0x3ae5('0x24')]!==_0x1b3826[_0x3ae5('0x24')]||this['dialActive']!==_0x1b3826['dialActive']||this[_0x3ae5('0x42')]!==_0x1b3826[_0x3ae5('0x42')]||this[_0x3ae5('0x43')]!==_0x1b3826['statusMessage'];_0x286f98=OUTBOUND_COUNTERS[_0x3ae5('0x57')](function(_0x25a038){return this[_0x25a038]!==_0x1b3826[_0x25a038];},this);if(this[_0x3ae5('0x44')]&&_0x1b3826[_0x3ae5('0x44')]){_0x4a7320=this[_0x3ae5('0x44')][_0x3ae5('0x15')]!==_0x1b3826[_0x3ae5('0x44')][_0x3ae5('0x15')]||this[_0x3ae5('0x44')][_0x3ae5('0x45')]!==_0x1b3826[_0x3ae5('0x44')]['active'];}}return _0x38e748||_0x286f98||_0x4a7320;};VoiceQueueSummary[_0x3ae5('0x47')][_0x3ae5('0x58')]=function(_0x5b478b){this[_0x3ae5('0x5')]=_0x5b478b[_0x3ae5('0x5')];this['message']=_0x5b478b[_0x3ae5('0x42')];this['statusMessage']=_0x5b478b[_0x3ae5('0x43')];this['originated']=_0x5b478b['originated'];this['outboundAbandonedCallsDay']=_0x5b478b['outboundAbandonedCallsDay'];this['outboundAnswerCallsDay']=_0x5b478b['outboundAnswerCallsDay'];this[_0x3ae5('0xa')]=_0x5b478b[_0x3ae5('0xa')];this[_0x3ae5('0xb')]=_0x5b478b['outboundBusyCallsDay'];this[_0x3ae5('0xc')]=_0x5b478b[_0x3ae5('0xc')];this[_0x3ae5('0xd')]=_0x5b478b['outboundNoAnswerCallsDay'];this['outboundNoSuchCallsDay']=_0x5b478b['outboundNoSuchCallsDay'];this[_0x3ae5('0xf')]=_0x5b478b[_0x3ae5('0xf')];this[_0x3ae5('0x10')]=_0x5b478b['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x5b478b[_0x3ae5('0x2f')];this[_0x3ae5('0x12')]=_0x5b478b['sumBillable'];this[_0x3ae5('0x13')]=_0x5b478b['sumDuration'];this[_0x3ae5('0x14')]=_0x5b478b[_0x3ae5('0x14')];if(this[_0x3ae5('0x24')]===_0x3ae5('0x59')){this['pTalking']=_0x5b478b['pTalking'];}};module[_0x3ae5('0x5a')]=VoiceQueueSummary; \ No newline at end of file +var _0xc492=['dialOriginateCallerIdNumber','dialOriginateTimeout','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','status','booked','keys','length','queue','dialer','compareToInboundQueue','some','compareToOutboundQueue','active','updateReportFromOutboundQueue','available','loggedIn','loggedInDb','talking','answered','inUse','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','sumDuration','waiting','name','strategy','abandoned','busy','invalid','onHold','notInUse','paused','ringing','ringInUse','sumBillable','total','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName'];(function(_0x32dc08,_0x61f53b){var _0x22ef51=function(_0x494d12){while(--_0x494d12){_0x32dc08['push'](_0x32dc08['shift']());}};_0x22ef51(++_0x61f53b);}(_0xc492,0xd7));var _0x2c49=function(_0x263cdf,_0x4123b9){_0x263cdf=_0x263cdf-0x0;var _0x2c8a91=_0xc492[_0x263cdf];return _0x2c8a91;};'use strict';var INBOUND_COUNTERS=[_0x2c49('0x0'),_0x2c49('0x1'),_0x2c49('0x2'),'paused','ringing',_0x2c49('0x3'),'waiting'];var OUTBOUND_COUNTERS=['available',_0x2c49('0x4'),_0x2c49('0x5'),'loggedIn',_0x2c49('0x2'),'originated',_0x2c49('0x6'),_0x2c49('0x7'),'outboundBlacklistCallsDay',_0x2c49('0x8'),_0x2c49('0x9'),_0x2c49('0xa'),_0x2c49('0xb'),_0x2c49('0xc'),'outboundRejectCallsDay',_0x2c49('0xd'),'paused','pTalking','talking','sumBillable',_0x2c49('0xe'),'total',_0x2c49('0xf')];function VoiceQueueSummary(_0x2a998e){this['id']=_0x2a998e['id'];this['name']=_0x2a998e[_0x2c49('0x10')];this[_0x2c49('0x11')]=_0x2a998e[_0x2c49('0x11')];this[_0x2c49('0x12')]=_0x2a998e[_0x2c49('0x12')]||0x0;this[_0x2c49('0x4')]=_0x2a998e['answered']||0x0;this[_0x2c49('0x0')]=_0x2a998e[_0x2c49('0x0')]||0x0;this[_0x2c49('0x13')]=_0x2a998e[_0x2c49('0x13')]||0x0;this[_0x2c49('0x5')]=_0x2a998e['inUse']||0x0;this[_0x2c49('0x14')]=_0x2a998e[_0x2c49('0x14')]||0x0;this[_0x2c49('0x1')]=_0x2a998e[_0x2c49('0x1')]||0x0;this[_0x2c49('0x2')]=_0x2a998e[_0x2c49('0x2')]||0x0;this[_0x2c49('0x15')]=_0x2a998e[_0x2c49('0x15')]||0x0;this[_0x2c49('0x16')]=_0x2a998e[_0x2c49('0x16')]||0x0;this['paused']=_0x2a998e[_0x2c49('0x17')]||0x0;this[_0x2c49('0x18')]=_0x2a998e[_0x2c49('0x18')]||0x0;this[_0x2c49('0x19')]=_0x2a998e['ringInUse'];this[_0x2c49('0x1a')]=_0x2a998e['sumBillable'];this[_0x2c49('0xe')]=_0x2a998e[_0x2c49('0xe')];this['sumHoldTime']=_0x2a998e['sumHoldTime']||0x0;this[_0x2c49('0x3')]=_0x2a998e[_0x2c49('0x3')]||0x0;this[_0x2c49('0x1b')]=_0x2a998e[_0x2c49('0x1b')]||0x0;this[_0x2c49('0x1c')]=_0x2a998e[_0x2c49('0x1c')];this[_0x2c49('0x1d')]=_0x2a998e[_0x2c49('0x1d')]||0x0;this[_0x2c49('0x1e')]=_0x2a998e['unknown']||0x0;this[_0x2c49('0x1f')]=_0x2a998e[_0x2c49('0x1f')]||0x0;this[_0x2c49('0xf')]=_0x2a998e[_0x2c49('0xf')]||0x0;if(_0x2a998e['type']===_0x2c49('0x20')){this[_0x2c49('0x21')]=_0x2a998e[_0x2c49('0x21')]||0x0;this[_0x2c49('0x22')]=_0x2a998e['dialActive'];this[_0x2c49('0x23')]=_0x2a998e[_0x2c49('0x23')];this[_0x2c49('0x24')]=_0x2a998e['dialOriginateCallerIdName'];this[_0x2c49('0x25')]=_0x2a998e[_0x2c49('0x25')];this['dialOriginateTimeout']=_0x2a998e[_0x2c49('0x26')];this['dialPrefix']=_0x2a998e['dialPrefix'];this[_0x2c49('0x27')]=_0x2a998e['temp'];this[_0x2c49('0x28')]=_0x2a998e['outboundAnswerAgiCallsDay'];this[_0x2c49('0x7')]=_0x2a998e[_0x2c49('0x7')];this[_0x2c49('0x29')]=_0x2a998e[_0x2c49('0x29')];this[_0x2c49('0x8')]=_0x2a998e[_0x2c49('0x8')];this[_0x2c49('0x9')]=_0x2a998e[_0x2c49('0x9')];this[_0x2c49('0x2a')]=_0x2a998e[_0x2c49('0x2a')];this['outboundDropCallsDayCallersExit']=_0x2a998e[_0x2c49('0x2b')];this['outboundDropCallsDayTimeout']=_0x2a998e[_0x2c49('0x2c')];this[_0x2c49('0xa')]=_0x2a998e[_0x2c49('0xa')];this[_0x2c49('0xb')]=_0x2a998e[_0x2c49('0xb')];this[_0x2c49('0x2d')]=_0x2a998e[_0x2c49('0x2d')];this[_0x2c49('0xc')]=_0x2a998e[_0x2c49('0xc')];this[_0x2c49('0x2e')]=_0x2a998e[_0x2c49('0x2e')];this[_0x2c49('0xd')]=_0x2a998e[_0x2c49('0xd')];this[_0x2c49('0x2f')]=_0x2a998e['predictiveIntervalAnsweredCalls'];this['predictiveIntervalAvgHoldtime']=_0x2a998e[_0x2c49('0x30')];this[_0x2c49('0x31')]=_0x2a998e['predictiveIntervalAvgTalktime'];this[_0x2c49('0x32')]=_0x2a998e[_0x2c49('0x32')];this[_0x2c49('0x33')]=_0x2a998e[_0x2c49('0x33')];this[_0x2c49('0x34')]=_0x2a998e[_0x2c49('0x34')];this[_0x2c49('0x35')]=_0x2a998e[_0x2c49('0x35')];this['predictiveIntervalHitRate']=_0x2a998e[_0x2c49('0x36')];this[_0x2c49('0x37')]=_0x2a998e['predictiveIntervalMultiplicativeFactor'];this[_0x2c49('0x38')]=_0x2a998e[_0x2c49('0x38')];this[_0x2c49('0x39')]=_0x2a998e['predictiveIntervalAvailable'];this[_0x2c49('0x3a')]=_0x2a998e[_0x2c49('0x3a')];this[_0x2c49('0x3b')]=_0x2a998e[_0x2c49('0x3b')];this[_0x2c49('0x3c')]=_0x2a998e[_0x2c49('0x3c')];this['erlangCallToSecond']=_0x2a998e[_0x2c49('0x3d')];this[_0x2c49('0x3e')]=_0x2a998e['erlangAbandonmentRate'];this[_0x2c49('0x3f')]=_0x2a998e[_0x2c49('0x3f')];this['startPredictive']=_0x2a998e[_0x2c49('0x40')];this['startProgressive']=_0x2a998e[_0x2c49('0x41')];this[_0x2c49('0x42')]=_0x2a998e[_0x2c49('0x42')];this['statusMessage']=_0x2a998e[_0x2c49('0x43')];}if(_0x2a998e['Trunk']){this[_0x2c49('0x44')]={'id':_0x2a998e[_0x2c49('0x44')]['id'],'name':_0x2a998e[_0x2c49('0x44')][_0x2c49('0x10')],'active':_0x2a998e[_0x2c49('0x44')]['active'],'callerid':_0x2a998e[_0x2c49('0x44')][_0x2c49('0x45')]};}}VoiceQueueSummary[_0x2c49('0x46')][_0x2c49('0x47')]=function(_0x251c8d,_0x130410,_0x3c25b6,_0x40f640){this['loggedInDb']=0x0;this[_0x2c49('0x3')]=0x0;this[_0x2c49('0x17')]=0x0;this['unknown']=0x0;this[_0x2c49('0x16')]=0x0;this[_0x2c49('0x5')]=0x0;this['busy']=0x0;this[_0x2c49('0x14')]=0x0;this['unavailable']=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this['onHold']=0x0;if(_0x3c25b6){if(_0x3c25b6[_0x2c49('0x0')]){this[_0x2c49('0x0')]=Number(_0x3c25b6[_0x2c49('0x0')]);}if(_0x3c25b6[_0x2c49('0x48')]){this[_0x2c49('0x1')]=Number(_0x3c25b6['loggedin']);}if(_0x3c25b6['callers']){this['waiting']=Number(_0x3c25b6['callers']);}}for(var _0x43b5ca=0x0;_0x43b5ca<_0x251c8d['length'];_0x43b5ca++){var _0x341fd6=_0x130410['SIP/'+_0x251c8d[_0x43b5ca]['name']];if(_0x341fd6&&_0x341fd6['online']){this[_0x2c49('0x2')]+=0x1;}if(_0x251c8d[_0x43b5ca]['incall']==='1'){this[_0x2c49('0x3')]+=0x1;}if(_0x251c8d[_0x43b5ca][_0x2c49('0x17')]==='1'&&!['2','7','8']['includes'](_0x251c8d[_0x43b5ca]['status'])){this[_0x2c49('0x17')]+=0x1;}switch(_0x251c8d[_0x43b5ca][_0x2c49('0x49')]){case'0':this[_0x2c49('0x1e')]+=0x1;break;case'1':this[_0x2c49('0x16')]+=0x1;break;case'2':this[_0x2c49('0x5')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x2c49('0x1d')]+=0x1;break;case'6':this[_0x2c49('0x18')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this['dialMethod']===_0x2c49('0x4a')){var _0x267a32=Object[_0x2c49('0x4b')](_0x40f640);for(var _0x55e4cd=0x0;_0x55e4cd<_0x267a32[_0x2c49('0x4c')];_0x55e4cd++){var _0xea11c4=_0x267a32[_0x55e4cd];var _0x43a7fd=_0x40f640[_0xea11c4];if(_0x43a7fd[_0x2c49('0x4d')]===this[_0x2c49('0x10')]&&_0x43a7fd[_0x2c49('0x1c')]===_0x2c49('0x4e')&&_0x43a7fd['exten']==='xcally-motion-preview'){this['talking']+=0x1;}}if(this[_0x2c49('0x3')]>this[_0x2c49('0x5')]){this['talking']=this[_0x2c49('0x5')];}this[_0x2c49('0x21')]=0x0;}return this;};VoiceQueueSummary[_0x2c49('0x46')][_0x2c49('0x4f')]=function(_0x199b26){var _0x38d901=![];if(_0x199b26){_0x38d901=INBOUND_COUNTERS[_0x2c49('0x50')](function(_0x11878d){return this[_0x11878d]!==_0x199b26[_0x11878d];},this);}return _0x38d901;};VoiceQueueSummary[_0x2c49('0x46')][_0x2c49('0x51')]=function(_0x56d647){var _0x46a0c6=![];var _0xe026bf=![];var _0xfcdbaf=![];if(_0x56d647){_0x46a0c6=this['dialMethod']!==_0x56d647[_0x2c49('0x23')]||this[_0x2c49('0x22')]!==_0x56d647['dialActive']||this[_0x2c49('0x42')]!==_0x56d647[_0x2c49('0x42')]||this[_0x2c49('0x43')]!==_0x56d647[_0x2c49('0x43')];_0xe026bf=OUTBOUND_COUNTERS['some'](function(_0x34e69e){return this[_0x34e69e]!==_0x56d647[_0x34e69e];},this);if(this[_0x2c49('0x44')]&&_0x56d647[_0x2c49('0x44')]){_0xfcdbaf=this[_0x2c49('0x44')]['name']!==_0x56d647[_0x2c49('0x44')][_0x2c49('0x10')]||this[_0x2c49('0x44')][_0x2c49('0x52')]!==_0x56d647[_0x2c49('0x44')][_0x2c49('0x52')];}}return _0x46a0c6||_0xe026bf||_0xfcdbaf;};VoiceQueueSummary[_0x2c49('0x46')][_0x2c49('0x53')]=function(_0x3b62ee){this['answered']=_0x3b62ee['answered'];this[_0x2c49('0x42')]=_0x3b62ee[_0x2c49('0x42')];this['statusMessage']=_0x3b62ee[_0x2c49('0x43')];this['originated']=_0x3b62ee[_0x2c49('0x3b')];this[_0x2c49('0x6')]=_0x3b62ee[_0x2c49('0x6')];this[_0x2c49('0x7')]=_0x3b62ee[_0x2c49('0x7')];this['outboundBlacklistCallsDay']=_0x3b62ee[_0x2c49('0x29')];this[_0x2c49('0x8')]=_0x3b62ee[_0x2c49('0x8')];this['outboundCongestionCallsDay']=_0x3b62ee[_0x2c49('0x9')];this[_0x2c49('0xa')]=_0x3b62ee['outboundNoAnswerCallsDay'];this[_0x2c49('0xb')]=_0x3b62ee[_0x2c49('0xb')];this['outboundReCallsDay']=_0x3b62ee[_0x2c49('0xc')];this['outboundRejectCallsDay']=_0x3b62ee[_0x2c49('0x2e')];this[_0x2c49('0xd')]=_0x3b62ee[_0x2c49('0xd')];this[_0x2c49('0x1a')]=_0x3b62ee[_0x2c49('0x1a')];this[_0x2c49('0xe')]=_0x3b62ee['sumDuration'];this[_0x2c49('0x1b')]=_0x3b62ee[_0x2c49('0x1b')];if(this[_0x2c49('0x23')]==='preview'){this[_0x2c49('0x21')]=_0x3b62ee['pTalking'];}};module['exports']=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index cf149b5..82e887b 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 _0x07f2=['exports','name','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x248300,_0x5250a6){var _0x382ba3=function(_0x587ea8){while(--_0x587ea8){_0x248300['push'](_0x248300['shift']());}};_0x382ba3(++_0x5250a6);}(_0x07f2,0x10f));var _0x207f=function(_0x4d4c10,_0xd9ac2a){_0x4d4c10=_0x4d4c10-0x0;var _0x10424d=_0x07f2[_0x4d4c10];return _0x10424d;};'use strict';function VtigerAccount(_0xfccc95){this['id']=_0xfccc95['id']||0x0;this[_0x207f('0x0')]=_0xfccc95[_0x207f('0x0')]||'';this['username']=_0xfccc95['username']||'';this[_0x207f('0x1')]=_0xfccc95[_0x207f('0x1')]||'';this[_0x207f('0x2')]=_0xfccc95[_0x207f('0x2')]||'';this[_0x207f('0x3')]=_0xfccc95[_0x207f('0x3')]||'';this[_0x207f('0x4')]=_0xfccc95[_0x207f('0x4')]||{};}module[_0x207f('0x5')]=VtigerAccount; \ No newline at end of file +var _0x3339=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0x3339,0xf0));var _0x9333=function(_0x596b22,_0x1a2593){_0x596b22=_0x596b22-0x0;var _0x509cbb=_0x3339[_0x596b22];return _0x509cbb;};'use strict';function VtigerAccount(_0x4236c6){this['id']=_0x4236c6['id']||0x0;this[_0x9333('0x0')]=_0x4236c6[_0x9333('0x0')]||'';this['username']=_0x4236c6[_0x9333('0x1')]||'';this[_0x9333('0x2')]=_0x4236c6['accessKey']||'';this['remoteUri']=_0x4236c6[_0x9333('0x3')]||'';this[_0x9333('0x4')]=_0x4236c6['serverUrl']||'';this[_0x9333('0x5')]=_0x4236c6['Configurations']||{};}module[_0x9333('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index dd8f33f..83f4cee 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 _0xa901=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x4801bd,_0x368071){var _0x3cf6fc=function(_0x4d376c){while(--_0x4d376c){_0x4801bd['push'](_0x4801bd['shift']());}};_0x3cf6fc(++_0x368071);}(_0xa901,0x188));var _0x1a90=function(_0x57f04f,_0x240c2b){_0x57f04f=_0x57f04f-0x0;var _0x25c9a3=_0xa901[_0x57f04f];return _0x25c9a3;};'use strict';function ZendeskAccount(_0x13c15a){this['id']=_0x13c15a['id']||0x0;this[_0x1a90('0x0')]=_0x13c15a['name']||'';this[_0x1a90('0x1')]=_0x13c15a[_0x1a90('0x1')]||'';this[_0x1a90('0x2')]=_0x13c15a[_0x1a90('0x2')]||'';this[_0x1a90('0x3')]=_0x13c15a[_0x1a90('0x3')]||'';this[_0x1a90('0x4')]=_0x13c15a[_0x1a90('0x4')]||'';this[_0x1a90('0x5')]=_0x13c15a[_0x1a90('0x5')]||'';this[_0x1a90('0x6')]=_0x13c15a[_0x1a90('0x6')]||_0x1a90('0x7');this[_0x1a90('0x8')]=_0x13c15a[_0x1a90('0x8')]||'';this[_0x1a90('0x9')]=_0x13c15a[_0x1a90('0x9')]||{};}module[_0x1a90('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xde30=['password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0xa4b8e1,_0x49d30b){var _0x507e42=function(_0xca2abc){while(--_0xca2abc){_0xa4b8e1['push'](_0xa4b8e1['shift']());}};_0x507e42(++_0x49d30b);}(_0xde30,0x15e));var _0x0de3=function(_0x53dbaf,_0x534a3c){_0x53dbaf=_0x53dbaf-0x0;var _0x5b74ed=_0xde30[_0x53dbaf];return _0x5b74ed;};'use strict';function ZendeskAccount(_0x49212d){this['id']=_0x49212d['id']||0x0;this['name']=_0x49212d[_0x0de3('0x0')]||'';this[_0x0de3('0x1')]=_0x49212d['username']||'';this[_0x0de3('0x2')]=_0x49212d[_0x0de3('0x2')]||'';this[_0x0de3('0x3')]=_0x49212d[_0x0de3('0x3')]||'';this[_0x0de3('0x4')]=_0x49212d['remoteUri']||'';this[_0x0de3('0x5')]=_0x49212d[_0x0de3('0x5')]||'';this[_0x0de3('0x6')]=_0x49212d[_0x0de3('0x6')]||_0x0de3('0x7');this['serverUrl']=_0x49212d[_0x0de3('0x8')]||'';this[_0x0de3('0x9')]=_0x49212d[_0x0de3('0x9')]||{};}module[_0x0de3('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index c759a69..ceb2b4e 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 _0x9f05=['refreshToken','Configurations','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x21192a,_0x25620d){var _0x3d71d2=function(_0x4b867c){while(--_0x4b867c){_0x21192a['push'](_0x21192a['shift']());}};_0x3d71d2(++_0x25620d);}(_0x9f05,0xf2));var _0x59f0=function(_0xde6a78,_0x381cbc){_0xde6a78=_0xde6a78-0x0;var _0x3b3bb8=_0x9f05[_0xde6a78];return _0x3b3bb8;};'use strict';function ZohoAccount(_0x1691a3){this['id']=_0x1691a3['id']||0x0;this['name']=_0x1691a3[_0x59f0('0x0')]||'';this['description']=_0x1691a3[_0x59f0('0x1')]||'';this[_0x59f0('0x2')]=_0x1691a3['host']||'';this['zone']=_0x1691a3[_0x59f0('0x3')]||'';this[_0x59f0('0x4')]=_0x1691a3[_0x59f0('0x4')]||'';this['clientSecret']=_0x1691a3[_0x59f0('0x5')]||'';this[_0x59f0('0x6')]=_0x1691a3[_0x59f0('0x6')]||'';this[_0x59f0('0x7')]=_0x1691a3[_0x59f0('0x7')]||'';this[_0x59f0('0x8')]=_0x1691a3[_0x59f0('0x8')]||'';this[_0x59f0('0x9')]=_0x1691a3[_0x59f0('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x3b48=['code','refreshToken','Configurations','exports','name','host','zone','clientId','clientSecret','serverUrl'];(function(_0xc45596,_0x5c410e){var _0x425ffe=function(_0x3c327d){while(--_0x3c327d){_0xc45596['push'](_0xc45596['shift']());}};_0x425ffe(++_0x5c410e);}(_0x3b48,0x130));var _0x83b4=function(_0x2461ba,_0x53d2ea){_0x2461ba=_0x2461ba-0x0;var _0x356f18=_0x3b48[_0x2461ba];return _0x356f18;};'use strict';function ZohoAccount(_0x3d7053){this['id']=_0x3d7053['id']||0x0;this[_0x83b4('0x0')]=_0x3d7053[_0x83b4('0x0')]||'';this['description']=_0x3d7053['description']||'';this['host']=_0x3d7053[_0x83b4('0x1')]||'';this['zone']=_0x3d7053[_0x83b4('0x2')]||'';this[_0x83b4('0x3')]=_0x3d7053[_0x83b4('0x3')]||'';this[_0x83b4('0x4')]=_0x3d7053[_0x83b4('0x4')]||'';this[_0x83b4('0x5')]=_0x3d7053['serverUrl']||'';this['code']=_0x3d7053[_0x83b4('0x6')]||'';this[_0x83b4('0x7')]=_0x3d7053[_0x83b4('0x7')]||'';this[_0x83b4('0x8')]=_0x3d7053[_0x83b4('0x8')]||{};}module[_0x83b4('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 2d9632b..0ac67dc 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 _0x4137=['string','uniqueid','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','SIP/%s','calleridname','firstName','Contact','active','phone','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil'];(function(_0x3ff3bf,_0x24ab78){var _0x31c508=function(_0x68d1b1){while(--_0x68d1b1){_0x3ff3bf['push'](_0x3ff3bf['shift']());}};_0x31c508(++_0x24ab78);}(_0x4137,0xf8));var _0x7413=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x4137[_0x4e676e];return _0x336a3c;};'use strict';var util=require(_0x7413('0x0'));var _=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));function checkNameSurname(_0x4f372c,_0x392ebc,_0x410971){var _0x2e6df7='';if(!_[_0x7413('0x3')](_0x392ebc)&&_0x7413('0x4')===typeof _0x392ebc){_0x2e6df7+=_0x392ebc;}if(!_[_0x7413('0x3')](_0x410971)&&_0x7413('0x4')===typeof _0x410971){_0x2e6df7+='\x20'+_0x410971;}if(_0x2e6df7!==''){return _0x2e6df7;}return _0x4f372c;}function Action(_0x3bb181,_0x4fbade,_0xc808cd,_0x188d89,_0x5b39ac){this[_0x7413('0x5')]=_0xc808cd||undefined;this['idContact']=_0x3bb181['id'];this[_0x7413('0x6')]=_0x4fbade[_0x7413('0x7')];this['type']=_0x4fbade[_0x7413('0x8')];this[_0x7413('0x9')]='queue';this[_0x7413('0xa')]=![];this[_0x7413('0xb')]=_[_0x7413('0x3')](_0x3bb181[_0x7413('0xc')])?undefined:_0x3bb181[_0x7413('0xc')]['name'];this[_0x7413('0xd')]=this[_0x7413('0xb')]?util['format'](_0x7413('0xe'),this[_0x7413('0xb')]):_0x188d89||undefined;this[_0x7413('0xf')]=checkNameSurname(_0x3bb181['Contact']['phone'],_0x3bb181['Contact'][_0x7413('0x10')],_0x3bb181[_0x7413('0x11')]['lastName']);this[_0x7413('0x12')]=_0x3bb181[_0x7413('0x12')]||![];this['calleridnum']=_0x3bb181[_0x7413('0x13')];this['scheduledat']=_0x3bb181['scheduledat'];this[_0x7413('0x14')]=_0x3bb181['countbusyretry']||0x0;this[_0x7413('0x15')]=_0x3bb181['countcongestionretry']||0x0;this[_0x7413('0x16')]=_0x3bb181[_0x7413('0x16')]||0x0;this[_0x7413('0x17')]=(_0x3bb181[_0x7413('0x14')]||0x0)+(_0x3bb181[_0x7413('0x15')]||0x0)+(_0x3bb181[_0x7413('0x16')]||0x0)+(_0x3bb181['countnosuchnumberretry']||0x0)+(_0x3bb181[_0x7413('0x18')]||0x0)+(_0x3bb181[_0x7413('0x19')]||0x0)+(_0x3bb181[_0x7413('0x1a')]||0x0)+(_0x3bb181[_0x7413('0x1b')]||0x0);this['countnosuchnumberretry']=_0x3bb181[_0x7413('0x1c')]||0x0;this[_0x7413('0x18')]=_0x3bb181[_0x7413('0x18')]||0x0;this[_0x7413('0x19')]=_0x3bb181[_0x7413('0x19')]||0x0;this[_0x7413('0x1a')]=_0x3bb181[_0x7413('0x1a')]||0x0;this[_0x7413('0x1b')]=_0x3bb181['countagentrejectretry']||0x0;this['callback']=_0x3bb181[_0x7413('0x1d')];this['callbackuniqueid']=_0x3bb181[_0x7413('0x1e')];this[_0x7413('0x1f')]=_0x3bb181[_0x7413('0x1f')];this[_0x7413('0x20')]=_0x3bb181[_0x7413('0x20')];this[_0x7413('0x21')]=_0x3bb181[_0x7413('0x21')];this[_0x7413('0x22')]=_0x3bb181[_0x7413('0x22')];this['UserId']=_['isNil'](_0x3bb181[_0x7413('0xc')])?_0x3bb181['UserId']:_0x3bb181[_0x7413('0xc')]['id'];this[_0x7413('0x23')]=_0x3bb181[_0x7413('0x23')];this['originatecalleridnum']='';this[_0x7413('0x24')]='';}Action[_0x7413('0x25')][_0x7413('0x26')]=function(){return util[_0x7413('0x27')](_0x7413('0x28'),this[_0x7413('0xf')],this['number']);};module[_0x7413('0x29')]=Action; \ No newline at end of file +var _0xe820=['calleridname','Contact','lastName','phone','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','moment','isNil','idContact','queue','name','type','dialAnswer','membername','Agent','format','SIP/%s'];(function(_0x36eede,_0x2fa917){var _0x11dbb0=function(_0x31066e){while(--_0x31066e){_0x36eede['push'](_0x36eede['shift']());}};_0x11dbb0(++_0x2fa917);}(_0xe820,0xd2));var _0x0e82=function(_0x3cdd49,_0x31a518){_0x3cdd49=_0x3cdd49-0x0;var _0x3d62b5=_0xe820[_0x3cdd49];return _0x3d62b5;};'use strict';var util=require(_0x0e82('0x0'));var _=require('lodash');var moment=require(_0x0e82('0x1'));function checkNameSurname(_0x4e6b50,_0x55bbeb,_0x2d4a09){var _0x7b2e95='';if(!_[_0x0e82('0x2')](_0x55bbeb)&&'string'===typeof _0x55bbeb){_0x7b2e95+=_0x55bbeb;}if(!_[_0x0e82('0x2')](_0x2d4a09)&&'string'===typeof _0x2d4a09){_0x7b2e95+='\x20'+_0x2d4a09;}if(_0x7b2e95!==''){return _0x7b2e95;}return _0x4e6b50;}function Action(_0x2cb88f,_0x105e3c,_0x69e27f,_0x328b32,_0x2a0f9b){this['uniqueid']=_0x69e27f||undefined;this[_0x0e82('0x3')]=_0x2cb88f['id'];this[_0x0e82('0x4')]=_0x105e3c[_0x0e82('0x5')];this[_0x0e82('0x6')]=_0x105e3c[_0x0e82('0x6')];this['campaigntype']=_0x0e82('0x4');this[_0x0e82('0x7')]=![];this[_0x0e82('0x8')]=_[_0x0e82('0x2')](_0x2cb88f[_0x0e82('0x9')])?undefined:_0x2cb88f[_0x0e82('0x9')][_0x0e82('0x5')];this['channelAgent']=this[_0x0e82('0x8')]?util[_0x0e82('0xa')](_0x0e82('0xb'),this[_0x0e82('0x8')]):_0x328b32||undefined;this[_0x0e82('0xc')]=checkNameSurname(_0x2cb88f[_0x0e82('0xd')]['phone'],_0x2cb88f[_0x0e82('0xd')]['firstName'],_0x2cb88f['Contact'][_0x0e82('0xe')]);this['active']=_0x2cb88f['active']||![];this['calleridnum']=_0x2cb88f[_0x0e82('0xf')];this['scheduledat']=_0x2cb88f['scheduledat'];this[_0x0e82('0x10')]=_0x2cb88f['countbusyretry']||0x0;this[_0x0e82('0x11')]=_0x2cb88f[_0x0e82('0x11')]||0x0;this[_0x0e82('0x12')]=_0x2cb88f[_0x0e82('0x12')]||0x0;this['countglobal']=(_0x2cb88f[_0x0e82('0x10')]||0x0)+(_0x2cb88f[_0x0e82('0x11')]||0x0)+(_0x2cb88f[_0x0e82('0x12')]||0x0)+(_0x2cb88f[_0x0e82('0x13')]||0x0)+(_0x2cb88f[_0x0e82('0x14')]||0x0)+(_0x2cb88f[_0x0e82('0x15')]||0x0)+(_0x2cb88f[_0x0e82('0x16')]||0x0)+(_0x2cb88f[_0x0e82('0x17')]||0x0);this[_0x0e82('0x13')]=_0x2cb88f[_0x0e82('0x13')]||0x0;this[_0x0e82('0x14')]=_0x2cb88f['countdropretry']||0x0;this['countabandonedretry']=_0x2cb88f[_0x0e82('0x15')]||0x0;this[_0x0e82('0x16')]=_0x2cb88f[_0x0e82('0x16')]||0x0;this[_0x0e82('0x17')]=_0x2cb88f[_0x0e82('0x17')]||0x0;this[_0x0e82('0x18')]=_0x2cb88f[_0x0e82('0x18')];this[_0x0e82('0x19')]=_0x2cb88f['callbackuniqueid'];this[_0x0e82('0x1a')]=_0x2cb88f[_0x0e82('0x1a')];this[_0x0e82('0x1b')]=_0x2cb88f[_0x0e82('0x1b')];this['ContactId']=_0x2cb88f[_0x0e82('0x1c')];this[_0x0e82('0x1d')]=_0x2cb88f[_0x0e82('0x1d')];this[_0x0e82('0x1e')]=_['isNil'](_0x2cb88f[_0x0e82('0x9')])?_0x2cb88f['UserId']:_0x2cb88f['Agent']['id'];this[_0x0e82('0x1f')]=_0x2cb88f[_0x0e82('0x1f')];this['originatecalleridnum']='';this[_0x0e82('0x20')]='';}Action[_0x0e82('0x21')][_0x0e82('0x22')]=function(){return util['format'](_0x0e82('0x23'),this[_0x0e82('0xc')],this['number']);};module[_0x0e82('0x24')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index feb9f9e..e54ad32 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 _0x6d91=['isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','Contact','phone','Contact\x20is\x20undefined','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','createHistory','Contact\x20in\x20black\x20List','isTrunkReachable','active','status','reachable','SIP/%s','execRun','pick','unlock','unlockContact','disableContact','recallme','validateContact','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','dialPrefix','dialCutDigit','substring','SIP/%s/%s%s','TrunkBackup','getCallerId','dialOriginateCallerIdName','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','callerid','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','callProgressDetectingCustomer','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','syncVarSet','filterKey','keys','variable','error','inspect','transfertargetlinkedid','exports','util','lodash','uuid','moment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','localhost','socket.io-emitter','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','info','stringify','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','paused','message','CAMPAIGN_STATUS','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','DEACTIVATED','\x20is\x20deactivated','prototype','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','outbound','dialActive','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','enqueue','isNil','Queue','originated:\x20','queue','pTalking','dialAnswer','contactId','UserId','VoiceQueueId','ListId','channel','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','decrementTalking','[Dialer][checkChannel][pTalking][Preview]','loggerError','[action]','size','recallMe','getContactRecallMe','agentReadyId','length','scheduledat','Agent','voicePause','run','then','[RecallMe]','catch','logger2','starttime','format','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','INACTIVE','Trunk','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','createCustomerFinal','rescheduleContact','unlockAgent','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','pTalking:\x20','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','activeContact','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','cloneAction','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','scheduledAt','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countabandonedretry','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x6d91,0x1b7));var _0x16d9=function(_0x5be7aa,_0x5de661){_0x5be7aa=_0x5be7aa-0x0;var _0x215408=_0x6d91[_0x5be7aa];return _0x215408;};'use strict';var util=require(_0x16d9('0x0'));var _=require(_0x16d9('0x1'));var uuid=require(_0x16d9('0x2'));var moment=require(_0x16d9('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x16d9('0x4'))(_0x16d9('0x5'));var loggerAction=require(_0x16d9('0x4'))(_0x16d9('0x6'));var ami=require(_0x16d9('0x7'));var rpcDb=require(_0x16d9('0x8'));var cmHopperAdditionalPhone=require(_0x16d9('0x9'));var Action=require(_0x16d9('0xa'));var ut=require(_0x16d9('0xb'));var utils=require(_0x16d9('0xc'));config[_0x16d9('0xd')]=_['defaults'](config[_0x16d9('0xd')],{'host':_0x16d9('0xe'),'port':0x18eb});var io=require(_0x16d9('0xf'))(new Redis(config[_0x16d9('0xd')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x5ea832){this[_0x16d9('0x10')]=this[_0x16d9('0x10')]?this['tail']['finally'](_0x5ea832):_0x5ea832();};function Preview(_0x26f75a){this['sequence']=new Sequence();this[_0x16d9('0x11')]=_0x26f75a[_0x16d9('0x12')];this[_0x16d9('0x13')]=_0x26f75a['trunks'];this[_0x16d9('0x14')]={};this['agents']=_0x26f75a[_0x16d9('0x15')];this[_0x16d9('0x16')]=0x0;ami['on']('originateresponse',this[_0x16d9('0x17')][_0x16d9('0x18')](this));ami['on']('hangup',this[_0x16d9('0x19')][_0x16d9('0x18')](this));ami['on']('hanguprequest',this[_0x16d9('0x1a')][_0x16d9('0x18')](this));ami['on'](_0x16d9('0x1b'),this[_0x16d9('0x1c')]['bind'](this));ami['on'](_0x16d9('0x1d'),this[_0x16d9('0x1e')][_0x16d9('0x18')](this));ami['on']('varset',this['syncVarSet'][_0x16d9('0x18')](this));ami['on'](_0x16d9('0x1f'),this[_0x16d9('0x20')][_0x16d9('0x18')](this));ami['on'](_0x16d9('0x21'),this[_0x16d9('0x22')][_0x16d9('0x18')](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x5cd505,_0x35fc60,_0x79a7b1){io['to'](_0x5cd505)[_0x16d9('0x23')](_0x35fc60,_0x79a7b1);}function emitVoiceQueueChannelRemove(_0x2a82da){logger[_0x16d9('0x24')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x16d9('0x25')](_0x2a82da));emit(util['format'](_0x16d9('0x26'),_0x2a82da[_0x16d9('0x27')]),_0x16d9('0x28'),_0x2a82da);io['emit'](_0x16d9('0x29'),_0x2a82da);}function notSendMessagesQueue(_0x33a295){if(_0x33a295[_0x16d9('0x2a')]){if(_0x33a295[_0x16d9('0x2b')]===0x0&&_0x33a295['pTalking']===0x0){_0x33a295[_0x16d9('0x2a')]=![];_0x33a295['available']=0x0;_0x33a295[_0x16d9('0x2c')]=0x0;_0x33a295[_0x16d9('0x2d')]=utils[_0x16d9('0x2e')]['INACTIVE'];ut[_0x16d9('0x2f')](_0x16d9('0x30'),_0x33a295[_0x16d9('0x27')]+'\x20is\x20not\x20active');}else{_0x33a295['message']=utils[_0x16d9('0x2e')][_0x16d9('0x31')];ut[_0x16d9('0x2f')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x33a295['name']+_0x16d9('0x32'));}}}Preview[_0x16d9('0x33')][_0x16d9('0x34')]=function(){var _0x51a12a=this;setInterval(function(){_0x51a12a[_0x16d9('0x35')]();},0x7cf);};Preview[_0x16d9('0x33')][_0x16d9('0x35')]=function(){var _0x2c5dba=this[_0x16d9('0x11')];this[_0x16d9('0x16')]+=0x1;for(var _0x5c6c23 in _0x2c5dba){if(_0x2c5dba[_0x16d9('0x36')](_0x5c6c23)&&(_0x2c5dba[_0x5c6c23][_0x16d9('0x37')]===_0x16d9('0x5')||_0x2c5dba[_0x5c6c23][_0x16d9('0x37')]==='booked')&&_0x2c5dba[_0x5c6c23]['type']===_0x16d9('0x38')){if(this[_0x16d9('0x16')]>0x7){this[_0x16d9('0x16')]=0x0;this['clearZombieChannels']();}}if(_0x2c5dba[_0x16d9('0x36')](_0x5c6c23)&&_0x2c5dba[_0x5c6c23][_0x16d9('0x37')]==='preview'&&_0x2c5dba[_0x5c6c23]['type']===_0x16d9('0x38')){if(_0x2c5dba[_0x5c6c23][_0x16d9('0x39')]){this[_0x16d9('0x3a')](_0x2c5dba[_0x5c6c23]);if(_0x2c5dba[_0x5c6c23][_0x16d9('0x3b')])this['recallMe'](_0x2c5dba[_0x5c6c23]);}else{notSendMessagesQueue(_0x2c5dba[_0x5c6c23]);}}}};Preview[_0x16d9('0x33')][_0x16d9('0x3c')]=function(_0x1482da){var _0x17ca56=this;this['sequence'][_0x16d9('0x3d')](function(){if(!_[_0x16d9('0x3e')](_0x17ca56[_0x16d9('0x14')][_0x1482da])){loggerAction[_0x16d9('0x24')]('[clearZombieChannels][talking]',_0x1482da,_0x16d9('0x3f'),_0x17ca56[_0x16d9('0x14')][_0x1482da]['queue'],_0x16d9('0x40'),JSON['stringify'](_0x17ca56[_0x16d9('0x11')][_0x17ca56[_0x16d9('0x14')][_0x1482da][_0x16d9('0x41')]][_0x16d9('0x2b')]),'pTalking:\x20',JSON[_0x16d9('0x25')](_0x17ca56[_0x16d9('0x11')][_0x17ca56['actions'][_0x1482da][_0x16d9('0x41')]][_0x16d9('0x42')]),JSON[_0x16d9('0x25')](_0x17ca56['actions'][_0x1482da][_0x16d9('0x43')]),JSON[_0x16d9('0x25')](_['pick'](_0x17ca56['actions'][_0x1482da],[_0x16d9('0x44'),_0x16d9('0x45'),_0x16d9('0x46'),_0x16d9('0x47')])));return ami['Action']({'action':'status','channel':_0x17ca56[_0x16d9('0x14')][_0x1482da][_0x16d9('0x48')]})['catch'](function(_0x4cb872){if(_0x4cb872[_0x16d9('0x2d')]===_0x16d9('0x49')){setTimeout(function(){if(_0x17ca56['actions'][_0x1482da]){utils[_0x16d9('0x4a')](_0x17ca56['campaignsPreview'][_0x17ca56[_0x16d9('0x14')][_0x1482da]['queue']],_0x16d9('0x4b'));if(_0x17ca56[_0x16d9('0x14')][_0x1482da]['dialAnswer']===!![]){ut[_0x16d9('0x4c')](_0x17ca56[_0x16d9('0x11')][_0x17ca56[_0x16d9('0x14')][_0x1482da][_0x16d9('0x41')]],_0x16d9('0x4b'));ut['loggerError'](_0x16d9('0x4d')+_0x1482da,_0x17ca56['actions'][_0x1482da]['queue']);}ut[_0x16d9('0x4e')]('[Dialer][checkChannel][Preview]'+_0x1482da,_0x17ca56['actions'][_0x1482da]['queue']);delete _0x17ca56[_0x16d9('0x14')][_0x1482da];}},0x2328);}});}});};Preview[_0x16d9('0x33')]['clearZombieChannels']=function(){var _0x25eead=this;loggerAction['info'](_0x16d9('0x4f'),_[_0x16d9('0x50')](this['actions']));for(var _0x4d0f7f in this[_0x16d9('0x14')]){if(_0x25eead[_0x16d9('0x14')][_0x16d9('0x36')](_0x4d0f7f)){_0x25eead[_0x16d9('0x3c')](_0x4d0f7f);}}};Preview[_0x16d9('0x33')][_0x16d9('0x51')]=function(_0x9b96cc){var _0x21b786=this;rpcDb[_0x16d9('0x52')](_0x9b96cc['id'],ut[_0x16d9('0x53')](this[_0x16d9('0x15')]))['then'](function(_0x21c2db){if(!_[_0x16d9('0x3e')](_0x21c2db)){for(var _0x201649=0x0;_0x201649<_0x21c2db[_0x16d9('0x54')];_0x201649+=0x1){if(ut['getDiff'](_0x21c2db[_0x201649][_0x16d9('0x55')])<_0x9b96cc['dialRecallMeTimeout']*0x3c){if(_0x21c2db[_0x201649][_0x16d9('0x56')]&&!_0x21c2db[_0x201649][_0x16d9('0x56')][_0x16d9('0x57')]){_0x21b786[_0x16d9('0x58')](_0x21c2db[_0x201649]['id'])[_0x16d9('0x59')](ut['logger2'](_0x16d9('0x5a')))[_0x16d9('0x5b')](ut[_0x16d9('0x5c')](_0x16d9('0x5a')));}else{rpcDb['disableContact'](_0x21c2db[_0x201649]['id']);}}else{var _0x104b20=new Action(_0x21c2db[_0x201649],_0x9b96cc);_0x104b20[_0x16d9('0x5d')]=moment()[_0x16d9('0x5e')](_0x16d9('0x5f'));_0x9b96cc[_0x16d9('0x60')]+=0x1;ut[_0x16d9('0x61')](_0x104b20,0x17,'RecallInQueue');if(_0x9b96cc[_0x16d9('0x62')]){rpcDb[_0x16d9('0x63')](ut[_0x16d9('0x64')](_0x21c2db[_0x201649]));rpcDb[_0x16d9('0x65')](_0x104b20,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x16d9('0x61')](_0x104b20,0x16,_0x16d9('0x66'));rpcDb['createCustomerHistory'](_0x104b20,_0x16d9('0x67'));rpcDb['createCustomerFinal'](_0x104b20,_0x16d9('0x67'));}}}}})['catch'](ut[_0x16d9('0x5c')](_0x16d9('0x68')));};Preview['prototype'][_0x16d9('0x3a')]=function(_0x2ec196){_0x2ec196[_0x16d9('0x2a')]=!![];if(ut[_0x16d9('0x69')](_0x2ec196[_0x16d9('0x6a')])){_0x2ec196[_0x16d9('0x2d')]=utils[_0x16d9('0x2e')]['NO_AGENTS_LOGGED'];}else if(!ut['isActive'](_0x2ec196[_0x16d9('0x39')])){_0x2ec196[_0x16d9('0x2d')]=utils['CAMPAIGN_STATUS'][_0x16d9('0x6b')];}else if(!this['isTrunkReachable'](_0x2ec196[_0x16d9('0x6c')])){if(!this['isTrunkReachable'](_0x2ec196['TrunkBackup'])){_0x2ec196['message']=utils[_0x16d9('0x2e')]['UNREACHABLE_TRUNK'];}else{_0x2ec196[_0x16d9('0x2d')]=utils[_0x16d9('0x2e')]['ACTIVE'];}}else{_0x2ec196[_0x16d9('0x2d')]=utils[_0x16d9('0x2e')][_0x16d9('0x6d')];}};Preview[_0x16d9('0x33')]['callProgressDetectingCustomer']=function(_0x4ac767,_0x2829f2,_0x256070){var _0x18c816=this;var _0x27ff1a=this[_0x16d9('0x14')][_0x2829f2];var _0x1ad4fd=this[_0x16d9('0x11')][_0x27ff1a[_0x16d9('0x41')]];var _0x972096;var _0x450342=![];var _0x1c7c60=0x2;var _0x2063ac=0x3;if(_0x1ad4fd){switch(_0x256070){case'1':_0x1ad4fd['outboundNoSuchCallsDay']+=0x1;_0x27ff1a[_0x16d9('0x6e')]+=0x1;_0x27ff1a[_0x16d9('0x6f')]=ut[_0x16d9('0x70')](_0x27ff1a);ut[_0x16d9('0x61')](_0x27ff1a,0x0,_0x16d9('0x71'));ami['emit'](_0x16d9('0x72'),ut[_0x16d9('0x73')](_0x27ff1a,_0x16d9('0x74')));rpcDb[_0x16d9('0x65')](_0x27ff1a,_0x16d9('0x75'));_0x18c816[_0x16d9('0x76')](_0x27ff1a,'0',_0x1ad4fd)[_0x16d9('0x59')](function(_0x4da88b){_0x450342=_0x4da88b[_0x16d9('0x77')]==0x1;_0x1c7c60=_0x1ad4fd[_0x16d9('0x78')];_0x2063ac=_0x1ad4fd[_0x16d9('0x79')];if(!_0x450342){if(ut[_0x16d9('0x70')](_0x27ff1a)>=_0x1ad4fd['dialGlobalMaxRetry']){_0x972096=ut['cloneAction'](_0x27ff1a,0xf,_0x16d9('0x7a'));rpcDb['createCustomerFinal'](_0x972096,_0x16d9('0x7b'));}else{if(_0x27ff1a[_0x16d9('0x6e')]>=_0x1ad4fd['dialNoSuchNumberMaxRetry']){rpcDb[_0x16d9('0x7c')](_0x27ff1a,_0x16d9('0x7b'));}else{rpcDb[_0x16d9('0x7d')](ut['scheduledAt'](_0x27ff1a,'countnosuchnumberretry',_0x1ad4fd[_0x16d9('0x78')]),_0x27ff1a[_0x16d9('0x7e')],_0x27ff1a['activeContact']);}}delete this['actions'][_0x4ac767['linkedid']];}else{_0x27ff1a['countnosuchnumberretry']++;logger[_0x16d9('0x24')]('actioncountonusuch',_0x27ff1a[_0x16d9('0x6e')]);logger['info']('id',_0x27ff1a[_0x16d9('0x7f')]);_0x18c816[_0x16d9('0x80')]({'id':_0x27ff1a[_0x16d9('0x7f')],'field':{'countnosuchnumberretry':_0x27ff1a[_0x16d9('0x6e')]}})[_0x16d9('0x59')](function(){_0x18c816[_0x16d9('0x81')](_0x27ff1a,_0x1c7c60,_0x2063ac)[_0x16d9('0x59')](function(){});});}});break;case _0x16d9('0x82'):var _0x4dfe2b=moment()[_0x16d9('0x5e')](_0x16d9('0x5f'));_0x27ff1a[_0x16d9('0x83')]=_0x4dfe2b;_0x27ff1a[_0x16d9('0x84')]=_0x4dfe2b;_0x27ff1a['dialAnswer']=!![];_0x1ad4fd[_0x16d9('0x42')]+=0x1;logger['info'](_0x16d9('0x85'),_0x27ff1a[_0x16d9('0x86')],'\x20Queue',_0x1ad4fd['name'],'pTalking:\x20',_0x1ad4fd['pTalking']);ami[_0x16d9('0x23')](_0x16d9('0x87'),ut[_0x16d9('0x73')](_0x27ff1a,_0x16d9('0x88'),this['campaignsPreview'][_0x27ff1a[_0x16d9('0x41')]]));if(_0x1ad4fd[_0x16d9('0x89')]||_0x1ad4fd[_0x16d9('0x8a')]){ami[_0x16d9('0x23')](_0x16d9('0x8b'),{'queue':_0x27ff1a['queue'],'interface':_0x27ff1a[_0x16d9('0x8c')],'uniqueid':_0x27ff1a[_0x16d9('0x86')]});}break;case'16':ami[_0x16d9('0x23')](_0x16d9('0x8d'),ut[_0x16d9('0x73')](_0x27ff1a,_0x16d9('0x8e'),this[_0x16d9('0x11')][_0x27ff1a[_0x16d9('0x41')]]));emitVoiceQueueChannelRemove(ut[_0x16d9('0x73')](_0x27ff1a,_0x16d9('0x8e')));_0x1ad4fd[_0x16d9('0x8f')]+=0x1;_0x1ad4fd[_0x16d9('0x90')]+=0x1;_0x1ad4fd[_0x16d9('0x91')]+=0x1;ut[_0x16d9('0x4c')](_0x1ad4fd,_0x16d9('0x92'));_0x27ff1a[_0x16d9('0x6f')]=ut[_0x16d9('0x70')](_0x27ff1a);ut[_0x16d9('0x61')](_0x27ff1a,0x4,_0x16d9('0x93'));rpcDb[_0x16d9('0x65')](_0x27ff1a,_0x16d9('0x94'));rpcDb[_0x16d9('0x7c')](_0x27ff1a,_0x16d9('0x95'));rpcDb[_0x16d9('0x96')](_0x27ff1a);_0x1ad4fd[_0x16d9('0x97')]+=_0x27ff1a[_0x16d9('0x98')];_0x1ad4fd[_0x16d9('0x99')]+=_0x27ff1a[_0x16d9('0x98')];logger[_0x16d9('0x24')](_0x16d9('0x9a'),_0x27ff1a['uniqueid'],_0x16d9('0x9b'),_0x1ad4fd[_0x16d9('0x27')],_0x16d9('0x9c'),_0x1ad4fd['pTalking']);delete this[_0x16d9('0x14')][_0x4ac767[_0x16d9('0x9d')]];break;case _0x16d9('0x9e'):_0x1ad4fd[_0x16d9('0x9f')]+=0x1;_0x27ff1a[_0x16d9('0xa0')]+=0x1;_0x27ff1a['countglobal']=ut[_0x16d9('0x70')](_0x27ff1a);ut[_0x16d9('0x61')](_0x27ff1a,0x5,_0x16d9('0xa1'));_0x1c7c60=_0x1ad4fd[_0x16d9('0xa2')];_0x2063ac=_0x1ad4fd[_0x16d9('0x79')];ami[_0x16d9('0x23')](_0x16d9('0xa3'),ut[_0x16d9('0x73')](_0x27ff1a,_0x16d9('0xa4')));rpcDb[_0x16d9('0x65')](_0x27ff1a,_0x16d9('0xa5'));_0x18c816[_0x16d9('0x76')](_0x27ff1a,'5',_0x1ad4fd)[_0x16d9('0x59')](function(_0x5cbe3d){_0x450342=_0x5cbe3d[_0x16d9('0x77')]==0x1;if(!_0x450342){if(ut[_0x16d9('0x70')](_0x27ff1a)>=_0x1ad4fd[_0x16d9('0xa6')]){_0x972096=ut['cloneAction'](_0x27ff1a,0xf,_0x16d9('0x7a'));rpcDb[_0x16d9('0x7c')](_0x972096,_0x16d9('0xa7'));}else{if(_0x27ff1a[_0x16d9('0xa0')]>=_0x1ad4fd[_0x16d9('0xa8')]){rpcDb[_0x16d9('0x7c')](_0x27ff1a,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x16d9('0x7d')](ut['scheduledAt'](_0x27ff1a,_0x16d9('0xa0'),_0x1ad4fd[_0x16d9('0xa2')]),_0x27ff1a['unlockAgent'],_0x27ff1a[_0x16d9('0xa9')]);}}}else{_0x27ff1a[_0x16d9('0xa0')]++;_0x18c816['incrementPreviewCounters']({'id':_0x27ff1a[_0x16d9('0x7f')],'field':{'countbusyretry':_0x27ff1a[_0x16d9('0xa0')]}})[_0x16d9('0x59')](function(){_0x18c816[_0x16d9('0x81')](_0x27ff1a,_0x1c7c60,_0x2063ac)[_0x16d9('0x59')](function(){});});}});break;case'NOANSWER':_0x1ad4fd['outboundNoAnswerCallsDay']+=0x1;_0x27ff1a[_0x16d9('0xaa')]+=0x1;_0x27ff1a[_0x16d9('0x6f')]=ut['totalGlobal'](_0x27ff1a);ut['logCustomer'](_0x27ff1a,0x3,_0x16d9('0xab'));_0x1c7c60=_0x1ad4fd[_0x16d9('0xac')];_0x2063ac=_0x1ad4fd[_0x16d9('0x79')];var _0x1c760f=ut[_0x16d9('0xad')](_0x27ff1a,_0x1ad4fd);ami[_0x16d9('0x23')](_0x16d9('0xae'),_0x1c760f);rpcDb['createCustomerHistory'](_0x27ff1a,_0x16d9('0xaf'));_0x18c816[_0x16d9('0x76')](_0x27ff1a,'3',_0x1ad4fd)['then'](function(_0x36ad8c){_0x450342=_0x36ad8c[_0x16d9('0x77')]==0x1;if(!_0x450342){if(ut[_0x16d9('0x70')](_0x27ff1a)>=_0x1ad4fd[_0x16d9('0xa6')]){_0x972096=ut[_0x16d9('0xb0')](_0x27ff1a,0xf,'Global');rpcDb['createCustomerFinal'](_0x972096,_0x16d9('0xb1'));}else{if(_0x27ff1a[_0x16d9('0xaa')]>=_0x1ad4fd[_0x16d9('0xb2')]){rpcDb[_0x16d9('0x7c')](_0x27ff1a,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x16d9('0x7d')](ut[_0x16d9('0xb3')](_0x27ff1a,_0x16d9('0xaa'),_0x1ad4fd[_0x16d9('0xac')]),_0x27ff1a['unlockAgent'],_0x27ff1a['activeContact']);}}}else{_0x27ff1a[_0x16d9('0xaa')]++;_0x18c816[_0x16d9('0x80')]({'id':_0x27ff1a[_0x16d9('0x7f')],'field':{'countnoanswerretry':_0x27ff1a[_0x16d9('0xaa')]}})[_0x16d9('0x59')](function(){_0x18c816[_0x16d9('0x81')](_0x27ff1a,_0x1c7c60,_0x2063ac)[_0x16d9('0x59')](function(){});});}});break;case'CONGESTION':_0x1ad4fd[_0x16d9('0xb4')]+=0x1;_0x27ff1a[_0x16d9('0xb5')]+=0x1;_0x27ff1a[_0x16d9('0x6f')]=ut[_0x16d9('0x70')](_0x27ff1a);ut[_0x16d9('0x61')](_0x27ff1a,0x8,_0x16d9('0xb6'));_0x1c7c60=_0x1ad4fd[_0x16d9('0xb7')];_0x2063ac=_0x1ad4fd[_0x16d9('0x79')];ami[_0x16d9('0x23')](_0x16d9('0xb8'),ut['buildObj'](_0x27ff1a,'congestion'));rpcDb[_0x16d9('0x65')](_0x27ff1a,_0x16d9('0xb9'));_0x18c816[_0x16d9('0x76')](_0x27ff1a,'8',_0x1ad4fd)[_0x16d9('0x59')](function(_0x349772){_0x450342=_0x349772['additional']==0x1;if(!_0x450342){if(ut['totalGlobal'](_0x27ff1a)>=_0x1ad4fd[_0x16d9('0xa6')]){_0x972096=ut['cloneAction'](_0x27ff1a,0xf,_0x16d9('0x7a'));rpcDb[_0x16d9('0x7c')](_0x972096,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x27ff1a[_0x16d9('0xb5')]>=_0x1ad4fd[_0x16d9('0xba')]){rpcDb['createCustomerFinal'](_0x27ff1a,_0x16d9('0xb9'));}else{rpcDb[_0x16d9('0x7d')](ut[_0x16d9('0xb3')](_0x27ff1a,'countcongestionretry',_0x1ad4fd[_0x16d9('0xa2')]),_0x27ff1a['unlockAgent'],_0x27ff1a[_0x16d9('0xa9')]);}}}else{_0x27ff1a['countcongestionretry']++;_0x18c816[_0x16d9('0x80')]({'id':_0x27ff1a[_0x16d9('0x7f')],'field':{'countcongestionretry':_0x27ff1a[_0x16d9('0xb5')]}})[_0x16d9('0x59')](function(){_0x18c816['swapAdditionalPhones'](_0x27ff1a,_0x1c7c60,_0x2063ac)[_0x16d9('0x59')](function(){});});}});break;case _0x16d9('0xbb'):_0x1ad4fd[_0x16d9('0xbc')]+=0x1;_0x27ff1a[_0x16d9('0xbd')]+=0x1;_0x27ff1a['countglobal']=ut[_0x16d9('0x70')](_0x27ff1a);ut[_0x16d9('0x61')](_0x27ff1a,0x14,'AgentReject');_0x1c7c60=_0x1ad4fd[_0x16d9('0xbe')];_0x2063ac=_0x1ad4fd[_0x16d9('0x79')];ami[_0x16d9('0x23')](_0x16d9('0xbf'),ut[_0x16d9('0x73')](_0x27ff1a,_0x16d9('0xc0')));rpcDb[_0x16d9('0x65')](_0x27ff1a,'[syncHangupRequest][logAgentReject]');_0x18c816[_0x16d9('0x76')](_0x27ff1a,'20',_0x1ad4fd)['then'](function(_0x5a6e88){_0x450342=_0x5a6e88[_0x16d9('0x77')]==0x1;if(!_0x450342){if(ut[_0x16d9('0x70')](_0x27ff1a)>=_0x1ad4fd['dialGlobalMaxRetry']){_0x972096=ut[_0x16d9('0xb0')](_0x27ff1a,0x14,_0x16d9('0xc1'));rpcDb['createCustomerFinal'](_0x972096,_0x16d9('0xc2'));}else{if(_0x27ff1a['countagentrejectretry']>=_0x1ad4fd[_0x16d9('0xc3')]){rpcDb['createCustomerFinal'](_0x27ff1a,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x16d9('0x7d')](ut[_0x16d9('0xb3')](_0x27ff1a,'countagentrejectretry',_0x1ad4fd[_0x16d9('0xbe')]),_0x27ff1a['unlockAgent'],_0x27ff1a[_0x16d9('0xa9')]);}}}else{_0x27ff1a[_0x16d9('0xaa')]++;_0x18c816['incrementPreviewCounters']({'id':_0x27ff1a['idContact'],'field':{'countnoanswerretry':_0x27ff1a[_0x16d9('0xaa')]}})[_0x16d9('0x59')](function(){_0x18c816[_0x16d9('0x81')](_0x27ff1a,_0x1c7c60,_0x2063ac)['then'](function(){});});}});break;case'ABANDONED':_0x1ad4fd[_0x16d9('0xc4')]+=0x1;_0x27ff1a['countabandonedretry']+=0x1;_0x27ff1a['countglobal']=ut['totalGlobal'](_0x27ff1a);ut['logCustomer'](_0x27ff1a,0xb,_0x16d9('0xc5'));rpcDb[_0x16d9('0x65')](_0x27ff1a,'[callProgressDetectingCustomer][logAbandoned]');_0x18c816[_0x16d9('0x76')](_0x27ff1a,'11',_0x1ad4fd)[_0x16d9('0x59')](function(_0xe79aa){_0x450342=_0xe79aa[_0x16d9('0x77')]==0x1;if(!_0x450342){if(ut[_0x16d9('0x70')](_0x27ff1a)>=_0x1ad4fd['dialGlobalMaxRetry']){_0x972096=ut[_0x16d9('0xb0')](_0x27ff1a,0xf,_0x16d9('0x7a'));rpcDb['createCustomerFinal'](_0x972096,_0x16d9('0xc6'));}else{if(_0x27ff1a['countabandonedetry']>=_0x1ad4fd[_0x16d9('0xc7')]){rpcDb['createCustomerFinal'](_0x27ff1a,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x16d9('0x7d')](ut['scheduledAt'](_0x27ff1a,_0x16d9('0xc8'),_0x1ad4fd['dialAbandonedRetryFrequency']),_0x27ff1a['unlockAgent'],_0x27ff1a[_0x16d9('0xa9')]);}}}else{_0x27ff1a[_0x16d9('0xaa')]++;_0x18c816[_0x16d9('0x80')]({'id':_0x27ff1a[_0x16d9('0x7f')],'field':{'countnoanswerretry':_0x27ff1a[_0x16d9('0xaa')]}})[_0x16d9('0x59')](function(){_0x18c816['swapAdditionalPhones'](_0x27ff1a,_0x1c7c60,_0x2063ac)[_0x16d9('0x59')](function(){});});}});break;case'18':_0x1ad4fd[_0x16d9('0xc9')]+=0x1;_0x27ff1a[_0x16d9('0xca')]+=0x1;_0x27ff1a[_0x16d9('0x6f')]=ut['totalGlobal'](_0x27ff1a);ut['logCustomer'](_0x27ff1a,0x12,_0x4ac767[_0x16d9('0xcb')]||_0x4ac767[_0x16d9('0xcc')]);ami[_0x16d9('0x23')](_0x16d9('0xcd'),ut['buildObj'](_0x27ff1a,'amd'));rpcDb['createCustomerHistory'](_0x27ff1a,_0x16d9('0xce'));_0x18c816[_0x16d9('0x76')](_0x27ff1a,'18',_0x1ad4fd)[_0x16d9('0x59')](function(_0x41f181){_0x450342=_0x41f181[_0x16d9('0x77')]==0x1;if(!_0x450342){if(ut['totalGlobal'](_0x27ff1a)>=_0x1ad4fd[_0x16d9('0xa6')]){_0x972096=ut[_0x16d9('0xb0')](_0x27ff1a,0x12,_0x16d9('0x7a'));rpcDb[_0x16d9('0x7c')](_0x972096,_0x16d9('0xce'));}else{rpcDb[_0x16d9('0x7c')](_0x27ff1a,_0x16d9('0xce'));}}else{_0x27ff1a['countnoanswerretry']++;_0x18c816[_0x16d9('0x80')]({'id':_0x27ff1a[_0x16d9('0x7f')],'field':{'countnoanswerretry':_0x27ff1a[_0x16d9('0xaa')]}})[_0x16d9('0x59')](function(){_0x18c816['swapAdditionalPhones'](_0x27ff1a,_0x1c7c60,_0x2063ac)[_0x16d9('0x59')](function(){});});}});delete this['actions'][_0x4ac767[_0x16d9('0x9d')]];break;case'19':_0x1ad4fd['outboundUnknownCallsDay']+=0x1;_0x27ff1a[_0x16d9('0x6f')]=ut[_0x16d9('0x70')](_0x27ff1a);ut[_0x16d9('0x61')](_0x27ff1a,0x13,_0x4ac767['cause-txt']||_0x4ac767[_0x16d9('0xcc')]);ami[_0x16d9('0x23')]('custom:amd',ut[_0x16d9('0x73')](_0x27ff1a,_0x16d9('0xcf')));rpcDb[_0x16d9('0x65')](_0x27ff1a,_0x16d9('0xd0'));_0x18c816[_0x16d9('0x76')](_0x27ff1a,'18',_0x1ad4fd)['then'](function(_0x5deffd){_0x450342=_0x5deffd[_0x16d9('0x77')]==0x1;if(!_0x450342){if(ut[_0x16d9('0x70')](_0x27ff1a)>=_0x1ad4fd[_0x16d9('0xa6')]){_0x972096=ut[_0x16d9('0xb0')](_0x27ff1a,0xf,_0x16d9('0x7a'));rpcDb[_0x16d9('0x7c')](_0x972096,_0x16d9('0xd0'));}else{rpcDb[_0x16d9('0x7c')](_0x27ff1a,'[callProgressDetectingCustomer][machine]');}}else{_0x27ff1a['countnoanswerretry']++;_0x18c816['incrementPreviewCounters']({'id':_0x27ff1a[_0x16d9('0x7f')],'field':{'countnoanswerretry':_0x27ff1a[_0x16d9('0xaa')]}})['then'](function(){_0x18c816['swapAdditionalPhones'](_0x27ff1a,_0x1c7c60,_0x2063ac)[_0x16d9('0x59')](function(){});});}});delete this['actions'][_0x4ac767[_0x16d9('0x9d')]];break;default:if(_0x27ff1a[_0x16d9('0x43')]){ut[_0x16d9('0x4c')](_0x1ad4fd,_0x16d9('0xd1'));ut['loggerError'](_0x16d9('0xd2')+_0x1ad4fd['name'],_0x4ac767);}_0x1ad4fd[_0x16d9('0xc9')]+=0x1;_0x27ff1a[_0x16d9('0x6f')]=ut[_0x16d9('0x70')](_0x27ff1a);ut[_0x16d9('0x61')](_0x27ff1a,0xc,_0x4ac767[_0x16d9('0xcb')]||_0x4ac767['dialstatus']);_0x1c7c60=_0x1ad4fd['dialAgentRejectRetryFrequency'];_0x2063ac=_0x1ad4fd[_0x16d9('0x79')];rpcDb[_0x16d9('0x65')](_0x27ff1a,_0x16d9('0xd3'));_0x18c816[_0x16d9('0x76')](_0x27ff1a,'20',_0x1ad4fd)[_0x16d9('0x59')](function(_0x210828){_0x450342=_0x210828[_0x16d9('0x77')]==0x1;if(!_0x450342){if(ut[_0x16d9('0x70')](_0x27ff1a)>=_0x1ad4fd[_0x16d9('0xa6')]){_0x972096=ut[_0x16d9('0xb0')](_0x27ff1a,0xf,'Global');rpcDb[_0x16d9('0x7c')](_0x972096,_0x16d9('0xd4'));}else{rpcDb[_0x16d9('0x7c')](_0x27ff1a,_0x16d9('0xd4'));}delete this[_0x16d9('0x14')][_0x4ac767[_0x16d9('0x9d')]];}else{_0x18c816[_0x16d9('0x81')](_0x27ff1a,_0x1c7c60,_0x2063ac)['then'](function(){});}});}if(!(_0x27ff1a[_0x16d9('0x43')]&&_0x256070==='16')){utils[_0x16d9('0x4a')](_0x1ad4fd,_0x16d9('0xd5'));logger[_0x16d9('0x24')](_0x16d9('0xd6'),_0x27ff1a[_0x16d9('0x86')],_0x16d9('0x9b'),_0x1ad4fd[_0x16d9('0x27')],_0x16d9('0x40'),_0x1ad4fd[_0x16d9('0x2b')]);}if(_0x256070!==_0x16d9('0x82')){delete this['actions'][_0x4ac767[_0x16d9('0x9d')]];delete this['actions'][_0x4ac767[_0x16d9('0xd7')]];}_0x1ad4fd[_0x16d9('0xd8')]=!![];}};Preview['prototype']['callProgressDetectingAgent']=function(_0x3bcaca,_0x2f6754,_0x4f4c2b){if(_[_0x16d9('0xd9')](_0x2f6754)&&_0x16d9('0xda')!==typeof _0x2f6754){return;}if(_[_0x16d9('0xd9')](_0x4f4c2b)&&'object'!==typeof _0x4f4c2b){return;}switch(_0x4f4c2b[_0x16d9('0xdb')]){case'0':ut[_0x16d9('0xdc')](_0x3bcaca,0x0,_0x16d9('0x71'));rpcDb['createAgentHistory'](_0x3bcaca,_0x16d9('0xdd'));break;case'3':ut[_0x16d9('0xdc')](_0x3bcaca,0x3,_0x16d9('0xab'));rpcDb[_0x16d9('0xde')](_0x3bcaca,_0x16d9('0xdf'));break;case'5':ut[_0x16d9('0xdc')](_0x3bcaca,0x5,_0x16d9('0xa1'));rpcDb['createAgentHistory'](_0x3bcaca,_0x16d9('0xe0'));break;case'8':ut['logAgent'](_0x3bcaca,0x8,_0x16d9('0xb6'));rpcDb[_0x16d9('0xde')](_0x3bcaca,_0x16d9('0xe1'));break;case'22':ut[_0x16d9('0xdc')](_0x3bcaca,0x16,_0x16d9('0xe2'));rpcDb[_0x16d9('0xde')](_0x3bcaca,_0x16d9('0xe3'));break;default:ut[_0x16d9('0xdc')](_0x3bcaca,0xc,_0x4f4c2b[_0x16d9('0xdb')]);rpcDb['createAgentHistory'](_0x3bcaca,_0x16d9('0xe1'));}utils['decrementOriginate'](_0x2f6754,_0x16d9('0xe4'));logger['info'](_0x16d9('0xe5'),_0x3bcaca[_0x16d9('0x86')],_0x16d9('0x9b'),_0x2f6754[_0x16d9('0x27')],_0x16d9('0x40'),_0x2f6754[_0x16d9('0x2b')]);delete this[_0x16d9('0x14')][_0x3bcaca[_0x16d9('0x86')]];};Preview[_0x16d9('0x33')][_0x16d9('0x76')]=function(_0xbc05d9,_0x4e9fab,_0x37c739){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0xbc05d9,_0x4e9fab,_0x37c739)[_0x16d9('0x5b')](logger[_0x16d9('0x24')](_0x16d9('0xe6')));};Preview[_0x16d9('0x33')]['swapAdditionalPhones']=function(_0x2a0e4c,_0x54e731,_0x257111){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x2a0e4c,_0x54e731,_0x257111)[_0x16d9('0x5b')](logger[_0x16d9('0x24')](_0x16d9('0xe7')));};Preview[_0x16d9('0x33')]['incrementPreviewCounters']=function(_0x7ffc60){return Promise[_0x16d9('0xe8')]()['then'](cmHopperAdditionalPhone[_0x16d9('0x80')](_0x7ffc60))[_0x16d9('0x5b')](logger[_0x16d9('0x24')](_0x16d9('0xe9')));};Preview['prototype']['checkInBlack']=function(_0x5cfcaf,_0x1c17de,_0x24206a,_0x19b10c,_0x49de6a){var _0x40a92c=this;return new Promise(function(_0xcbbf78,_0xea713f){if(_['isNil'](_0x1c17de)||_[_0x16d9('0x3e')](_0x1c17de[_0x16d9('0xea')])||_[_0x16d9('0x3e')](_0x1c17de[_0x16d9('0xeb')])||_[_0x16d9('0x3e')](_0x1c17de[_0x16d9('0x46')])){_0xea713f(ut['message'](_0x16d9('0xec'),_0x19b10c,_0x49de6a));return;}var _0x54ca5a=uuid['v4']();var _0x419001=_0x40a92c[_0x16d9('0x11')][_0x1c17de[_0x16d9('0x3f')][_0x16d9('0x27')]];var _0x32912e=_0x24206a?_0x40a92c[_0x16d9('0x15')][_0x24206a]['id']:undefined;_0x40a92c[_0x16d9('0x14')][_0x54ca5a]=new Action(_0x1c17de,_0x419001,_0x54ca5a,_0x24206a,_0x32912e);var _0x100a7c=_0x40a92c[_0x16d9('0x14')][_0x54ca5a];_0x100a7c[_0x16d9('0x7e')]=_0x19b10c;_0x100a7c[_0x16d9('0xa9')]=_0x49de6a;_0x100a7c[_0x16d9('0xed')]=_0x24206a;if(_['isEmpty'](_0x5cfcaf)){_0x40a92c[_0x16d9('0xee')](_0x100a7c,_0x419001,_0x1c17de,_0x24206a)[_0x16d9('0x59')](function(_0x270bfe){logger[_0x16d9('0x24')](_0x16d9('0xef'),_0x16d9('0xf0')+_0x100a7c['queue']+_0x16d9('0xf1')+_0x100a7c[_0x16d9('0x7f')],JSON['stringify'](_0x270bfe));ami[_0x16d9('0x23')](_0x16d9('0xf2'),ut[_0x16d9('0x73')](_0x100a7c,'called',_0x40a92c['campaignsPreview'][_0x100a7c[_0x16d9('0x41')]]));_0xcbbf78(ut['message'](_0x16d9('0xf3')));})['catch'](function(_0x3bbe01){ut[_0x16d9('0x2f')](_0x16d9('0xf4'),_0x3bbe01);_0xea713f(ut[_0x16d9('0x2d')](_0x16d9('0xf5'),_0x19b10c,_0x49de6a));});}else{_0x419001[_0x16d9('0xf6')]+=0x1;ut['logBlacklist'](_0x100a7c);rpcDb[_0x16d9('0xf7')](_0x100a7c,'[Blacklist][error]');delete _0x40a92c[_0x16d9('0x14')][_0x54ca5a];_0xea713f(ut['message'](_0x16d9('0xf8'),_0x19b10c,_0x49de6a));}});};Preview[_0x16d9('0x33')][_0x16d9('0xf9')]=function(_0x58beb7){return!_['isNil'](_0x58beb7)&&!_['isNil'](_0x58beb7[_0x16d9('0x27')])&&!_[_0x16d9('0x3e')](_0x58beb7[_0x16d9('0xfa')])&&_0x58beb7['active']&&!_[_0x16d9('0x3e')](this[_0x16d9('0x13')][util[_0x16d9('0x5e')]('SIP/%s',_0x58beb7[_0x16d9('0x27')])])&&!_['isNil'](this[_0x16d9('0x13')][util[_0x16d9('0x5e')]('SIP/%s',_0x58beb7[_0x16d9('0x27')])][_0x16d9('0xfb')])&&(this[_0x16d9('0x13')][util['format']('SIP/%s',_0x58beb7[_0x16d9('0x27')])]['status']===_0x16d9('0xfc')||this[_0x16d9('0x13')][util[_0x16d9('0x5e')](_0x16d9('0xfd'),_0x58beb7[_0x16d9('0x27')])][_0x16d9('0xfb')]==='unmonitored');};Preview[_0x16d9('0x33')][_0x16d9('0x58')]=function(_0x1d836b,_0x2e93e8){return this[_0x16d9('0xfe')](_0x1d836b,_0x2e93e8)[_0x16d9('0x59')](function(_0x2efacd){return _[_0x16d9('0xff')](_0x2efacd,[_0x16d9('0x2d')]);})['catch'](function(_0x159593){if(_0x159593[_0x16d9('0x100')]){rpcDb[_0x16d9('0x101')](_0x1d836b);}if(_0x159593[_0x16d9('0xfa')]){rpcDb[_0x16d9('0x102')](_0x1d836b);}throw _[_0x16d9('0xff')](_0x159593,[_0x16d9('0x2d')]);});};Preview[_0x16d9('0x33')][_0x16d9('0xfe')]=function(_0x378a8d,_0xf3f466){var _0x47f090=this;var _0x22407e,_0x58e31d;return rpcDb['getContactPreview'](_0x378a8d)[_0x16d9('0x59')](function(_0x38c1e5){if(!_[_0x16d9('0x3e')](_0x38c1e5[0x0])){_0x58e31d=_0x38c1e5[0x0]['recallme']?![]:!![];_0x22407e=_0x38c1e5[0x0][_0x16d9('0x103')]?!![]:![];_0x22407e=_0xf3f466?!![]:_0x22407e;}var _0x12cb2f=_0x47f090[_0x16d9('0x104')](_0x38c1e5);if(_0x12cb2f['isValid']){rpcDb[_0x16d9('0x105')](_['pick'](_0x38c1e5[0x0],[_0x16d9('0x46'),'phone']))[_0x16d9('0x59')](function(_0x49274f){_0x47f090[_0x16d9('0x106')](_0x49274f,_0x38c1e5[0x0],_0xf3f466,_0x58e31d,_0x22407e)[_0x16d9('0x59')](function(_0x34cc15){return _0x34cc15;})[_0x16d9('0x5b')](function(_0x3366de){throw _0x3366de;});})[_0x16d9('0x5b')](function(_0x26d20c){ut[_0x16d9('0x2f')](_0x16d9('0x107'),_0x26d20c);throw ut[_0x16d9('0x2d')](_0x16d9('0x108'),_0x58e31d,_0x22407e);});}else{throw ut[_0x16d9('0x2d')](_0x12cb2f[_0x16d9('0x2d')],_0x58e31d,_0x22407e);}})[_0x16d9('0x5b')](function(_0x540dc6){ut[_0x16d9('0x2f')](_0x16d9('0x109'),_0x540dc6);throw ut['message']('Call\x20unsuccessful',![],!![]);});};Preview['prototype'][_0x16d9('0x104')]=function(_0x2a8e2b){if(_[_0x16d9('0x3e')](_0x2a8e2b)||_[_0x16d9('0x10a')](_0x2a8e2b)||!_[_0x16d9('0x3e')](_0x2a8e2b[0x0][_0x16d9('0x56')])&&_['isNil'](_0x2a8e2b[0x0][_0x16d9('0x56')][_0x16d9('0x27')])){ut['logger'](_0x16d9('0x10b'),_0x2a8e2b);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x5d30b3=this[_0x16d9('0x11')][_0x2a8e2b[0x0][_0x16d9('0x3f')]['name']];_0x5d30b3[_0x16d9('0x2d')]=utils[_0x16d9('0x2e')]['ACTIVE'];if(_[_0x16d9('0x3e')](_0x5d30b3)){ut[_0x16d9('0x2f')](_0x16d9('0x10c'),_0x5d30b3);return{'isValid':![],'message':_0x16d9('0x10d')};}if(!this[_0x16d9('0xf9')](_0x5d30b3[_0x16d9('0x6c')])){ut['logger'](_0x16d9('0x10e'),'campaign\x20Name:\x20'+_0x5d30b3['name']+_0x16d9('0x10f'));if(!this[_0x16d9('0xf9')](_0x5d30b3['TrunkBackup'])){ut[_0x16d9('0x2f')](_0x16d9('0x10e'),_0x5d30b3[_0x16d9('0x27')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x16d9('0x110')};}}if(!ut['isActive'](_0x5d30b3[_0x16d9('0x39')])){ut[_0x16d9('0x2f')](_0x16d9('0x111'),_0x5d30b3[_0x16d9('0x27')]+_0x16d9('0x112'));return{'isValid':![],'message':_0x16d9('0x113')+_0x5d30b3['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x16d9('0x114')};};Preview[_0x16d9('0x33')][_0x16d9('0xee')]=function(_0x31e9e5,_0x7e8281,_0x26e244,_0x560caf){var _0x33cc2d=this;return new Promise(function(_0x24ae67,_0x411c0c){var _0xc94e65=_0x31e9e5['uniqueid'];var _0x363156=_0x33cc2d['isTrunkReachable'](_0x7e8281['Trunk'])?util['format']('SIP/%s/%s%s',_0x7e8281['Trunk'][_0x16d9('0x27')],_['isNil'](_0x7e8281[_0x16d9('0x115')])?'':_0x7e8281[_0x16d9('0x115')]['trim']()||'',_0x7e8281[_0x16d9('0x116')]>0x0?_0x26e244[_0x16d9('0xeb')][_0x16d9('0x117')](_0x7e8281[_0x16d9('0x116')]):_0x26e244[_0x16d9('0xeb')]):util[_0x16d9('0x5e')](_0x16d9('0x118'),_[_0x16d9('0x3e')](_0x7e8281[_0x16d9('0x119')])?_0x7e8281[_0x16d9('0x6c')][_0x16d9('0x27')]:_0x7e8281[_0x16d9('0x119')]['name'],_[_0x16d9('0x3e')](_0x7e8281[_0x16d9('0x115')])?'':_0x7e8281['dialPrefix']['trim']()||'',_0x7e8281[_0x16d9('0x116')]>0x0?_0x26e244[_0x16d9('0xeb')][_0x16d9('0x117')](_0x7e8281[_0x16d9('0x116')]):_0x26e244[_0x16d9('0xeb')]);var _0x74472a=_0x33cc2d[_0x16d9('0xf9')](_0x7e8281['Trunk'])?ut[_0x16d9('0x11a')](_0x7e8281[_0x16d9('0x6c')]['callerid'],_0x7e8281[_0x16d9('0x11b')],_0x7e8281['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x16d9('0x11c')](_0x7e8281['dialOriginateCallerIdNumber'],_0x7e8281[_0x16d9('0x11d')]):_0x7e8281[_0x16d9('0x11e')]):ut['getCallerId'](_['isNil'](_0x7e8281[_0x16d9('0x119')])?_0x7e8281[_0x16d9('0x6c')][_0x16d9('0x11f')]:_0x7e8281[_0x16d9('0x119')][_0x16d9('0x11f')],_0x7e8281[_0x16d9('0x11b')],_0x7e8281[_0x16d9('0x11d')]>0x0?ut[_0x16d9('0x11c')](_0x7e8281['dialOriginateCallerIdNumber'],_0x7e8281[_0x16d9('0x11d')]):_0x7e8281['dialOriginateCallerIdNumber']);if(_0x74472a){_0x31e9e5['originatecalleridname']=ut[_0x16d9('0x120')](_0x74472a);_0x31e9e5[_0x16d9('0x121')]=ut[_0x16d9('0x122')](_0x74472a);}var _0xa26f3c=ut[_0x16d9('0x123')](_0x7e8281,_0x26e244,_0x363156,_0x74472a,_0xc94e65,_0x31e9e5);var _0x376320=utils[_0x16d9('0x124')](_0x26e244[_0x16d9('0xea')]);Object[_0x16d9('0x125')](_0xa26f3c,_0x376320);_[_0x16d9('0x126')](_0x31e9e5,ut[_0x16d9('0x127')](_0xa26f3c));_0x31e9e5[_0x16d9('0x5d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x7e8281[_0x16d9('0x128')]=_0xa26f3c;var _0x11d0a5=ut[_0x16d9('0x129')](_0x31e9e5,_0x7e8281,_0xa26f3c,_0x31e9e5['activeContact'],_0x560caf);return ami[_0x16d9('0x12a')](_0x11d0a5)[_0x16d9('0x59')](function(_0x29dbcf){_0x7e8281[_0x16d9('0x2b')]+=0x1;logger[_0x16d9('0x24')](_0x16d9('0x12b'),_0xc94e65,'\x20Queue',_0x7e8281[_0x16d9('0x27')],'originated:\x20',_0x7e8281[_0x16d9('0x2b')]);_0x24ae67(_0x29dbcf);})[_0x16d9('0x5b')](function(_0xf0343){ut[_0x16d9('0xdc')](_0x31e9e5,0xe,_0x16d9('0x12c'));rpcDb[_0x16d9('0xde')](_0x31e9e5,_0x16d9('0x12d'));_0x411c0c(_0xf0343);});});};Preview[_0x16d9('0x33')]['syncNewExten']=function(_0x24d654){if(this[_0x16d9('0x14')][_0x24d654[_0x16d9('0x9d')]]){this[_0x16d9('0x14')][_0x24d654['linkedid']][_0x16d9('0x48')]=_0x24d654[_0x16d9('0x48')];}};Preview[_0x16d9('0x33')][_0x16d9('0x17')]=function(_0x49a9d7){var _0x32cfda=this;var _0x429965=this[_0x16d9('0x14')][_0x49a9d7[_0x16d9('0x12e')]];if(_0x429965){if(_0x429965[_0x16d9('0xed')]&&this[_0x16d9('0x15')][_0x429965[_0x16d9('0xed')]]){ut[_0x16d9('0x12f')](_0x429965,this[_0x16d9('0x15')][_0x429965['lookAgent']][_0x16d9('0x27')],this[_0x16d9('0x15')][_0x429965['lookAgent']]['id']);}var _0x46e4d6=_[_0x16d9('0x130')](_0x429965);_0x46e4d6['responsetime']=moment()['format'](_0x16d9('0x5f'));var _0x41e902=_0x32cfda[_0x16d9('0x11')][_0x429965[_0x16d9('0x41')]];if(ut[_0x16d9('0x131')](_0x49a9d7['response'])){if(_0x429965['unlockAgent']){rpcDb[_0x16d9('0x101')](_0x429965['idContact']);}if(_0x429965[_0x16d9('0xa9')]){rpcDb[_0x16d9('0x102')](_0x429965['idContact']);}ami['emit'](_0x16d9('0x132'),ut[_0x16d9('0x73')](_0x429965,_0x16d9('0x133'),this['campaignsPreview'][_0x429965[_0x16d9('0x41')]]));this[_0x16d9('0x134')](_0x46e4d6,_0x41e902,_0x49a9d7);}else{_0x429965[_0x16d9('0x5d')]=moment()[_0x16d9('0x5e')](_0x16d9('0x5f'));ut[_0x16d9('0xdc')](_0x46e4d6,0x4,_0x16d9('0x93'));rpcDb['createAgentHistory'](_0x46e4d6,_0x16d9('0x135'));}}};Preview['prototype']['syncHangup']=function(_0x247f94){var _0x4b7b7a=this[_0x16d9('0x14')][_0x247f94[_0x16d9('0x9d')]];var _0x478472;if(_0x4b7b7a){_0x478472=this['campaignsPreview'][_0x4b7b7a[_0x16d9('0x41')]];logger[_0x16d9('0x24')]('[syncHangup][talking]',_0x247f94['linkedid'],_0x16d9('0x9b'),_0x478472[_0x16d9('0x27')],_0x16d9('0x9c'),_0x478472['pTalking']);}if(this[_0x16d9('0x14')][_0x247f94[_0x16d9('0x9d')]]&&_0x247f94[_0x16d9('0x9d')]!==_0x247f94[_0x16d9('0x86')]){if(_0x247f94[_0x16d9('0x136')]==='16'&&this['actions'][_0x247f94[_0x16d9('0x9d')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x247f94,_0x247f94[_0x16d9('0x9d')],_0x247f94[_0x16d9('0x136')]);}else if(this[_0x16d9('0x14')][_0x247f94[_0x16d9('0x9d')]][_0x16d9('0x43')]){logger[_0x16d9('0x24')](_0x16d9('0x137'),_0x247f94[_0x16d9('0x9d')],_0x247f94['cause'],_0x16d9('0x9b'),_0x478472['name'],_0x16d9('0x9c'),_0x478472['pTalking']);this[_0x16d9('0x138')](_0x247f94,_0x247f94['linkedid'],_0x247f94[_0x16d9('0x136')]);}}else if(_0x4b7b7a&&_[_0x16d9('0x3e')](_0x4b7b7a[_0x16d9('0x139')])&&_0x478472[_0x16d9('0x13a')]&&_0x247f94[_0x16d9('0x9d')]===_0x247f94[_0x16d9('0x86')]&&_[_0x16d9('0x3e')](_0x247f94[_0x16d9('0xdb')])&&_0x247f94[_0x16d9('0x136')]==='16'&&_0x247f94[_0x16d9('0x13b')]==='6'&&_[_0x16d9('0xd9')](_0x4b7b7a[_0x16d9('0x13c')])){if(_0x4b7b7a['unlockAgent']){rpcDb[_0x16d9('0x101')](_0x4b7b7a[_0x16d9('0x7f')]);}if(_0x4b7b7a[_0x16d9('0xa9')]){rpcDb[_0x16d9('0x102')](_0x4b7b7a[_0x16d9('0x7f')]);}_0x247f94[_0x16d9('0xdb')]='22';this[_0x16d9('0x134')](_0x4b7b7a,_0x478472,_0x247f94);}else if(_0x4b7b7a&&_0x4b7b7a['transfer']){if(_0x247f94[_0x16d9('0x136')]==='16'&&this[_0x16d9('0x14')][_0x247f94['linkedid']][_0x16d9('0x43')]){logger[_0x16d9('0x24')](_0x16d9('0x13d'),_0x247f94['linkedid'],_0x247f94[_0x16d9('0x136')],_0x16d9('0x9b'),_0x478472[_0x16d9('0x27')],_0x16d9('0x9c'),_0x478472[_0x16d9('0x42')]);this['callProgressDetectingCustomer'](_0x247f94,_0x247f94[_0x16d9('0x9d')],_0x247f94[_0x16d9('0x136')]);}else if(this[_0x16d9('0x14')][_0x247f94[_0x16d9('0x9d')]][_0x16d9('0x43')]){logger[_0x16d9('0x24')]('[syncHangup][talking][cause]',_0x247f94[_0x16d9('0x9d')],_0x247f94[_0x16d9('0x136')],_0x16d9('0x9b'),_0x478472[_0x16d9('0x27')],_0x16d9('0x9c'),_0x478472[_0x16d9('0x42')]);this[_0x16d9('0x138')](_0x247f94,_0x247f94['linkedid'],_0x247f94['cause']);}}};Preview['prototype'][_0x16d9('0x1c')]=function(_0x4a2fe5){if(this[_0x16d9('0x14')][_0x4a2fe5[_0x16d9('0xd7')]]&&_0x4a2fe5['destlinkedid']!==_0x4a2fe5[_0x16d9('0x13e')]){this['callProgressDetectingCustomer'](_0x4a2fe5,_0x4a2fe5[_0x16d9('0xd7')],_0x4a2fe5['dialstatus']);}};Preview[_0x16d9('0x33')][_0x16d9('0x1a')]=function(_0x370a5d){if(this[_0x16d9('0x14')][_0x370a5d[_0x16d9('0x9d')]]&&_0x370a5d[_0x16d9('0x9d')]!==_0x370a5d[_0x16d9('0x86')]&&!this[_0x16d9('0x14')][_0x370a5d[_0x16d9('0x9d')]][_0x16d9('0x43')]){if(_0x370a5d[_0x16d9('0x136')]==='1'){this[_0x16d9('0x138')](_0x370a5d,_0x370a5d[_0x16d9('0x9d')],_0x370a5d[_0x16d9('0x136')]);}}};Preview[_0x16d9('0x33')][_0x16d9('0x13f')]=function(_0x1b3b96,_0x434aa7,_0x2a3139){if(this[_0x16d9('0x14')][_0x1b3b96]){if(_[_0x16d9('0x3e')](this['actions'][_0x1b3b96][_0x16d9('0x128')])){this['actions'][_0x1b3b96]['variables']={};}this[_0x16d9('0x14')][_0x1b3b96][_0x16d9('0x128')][_0x434aa7]=_0x2a3139;}};Preview[_0x16d9('0x33')][_0x16d9('0x140')]=function(_0x4a869b){try{if(!_[_0x16d9('0x3e')](_0x4a869b)){if(ut[_0x16d9('0x141')](_[_0x16d9('0x142')](_0x4a869b[_0x16d9('0x143')])[0x0])){this[_0x16d9('0x13f')](_0x4a869b[_0x16d9('0x86')],_['keys'](_0x4a869b[_0x16d9('0x143')])[0x0],_0x4a869b['value']);}}}catch(_0x1a4436){logger[_0x16d9('0x144')]('[syncVarSet][Preview]',util[_0x16d9('0x145')](_0x1a4436,{'showHidden':![],'depth':null}));}};Preview[_0x16d9('0x33')]['syncAttendedTransfer']=function(_0x14408a){if(_0x14408a){if(this['actions'][_0x14408a[_0x16d9('0x146')]]){this[_0x16d9('0x14')][_0x14408a['transfertargetlinkedid']][_0x16d9('0x13c')]=!![];}}};Preview[_0x16d9('0x33')]['syncBlindTransfer']=function(_0x3cf378){if(_0x3cf378){if(this[_0x16d9('0x14')][_0x3cf378['transfererlinkedid']]){this[_0x16d9('0x14')][_0x3cf378['transfererlinkedid']]['transfer']=!![];}}};module[_0x16d9('0x147')]=Preview; \ No newline at end of file +var _0x930d=['ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','reachable','unlock','unlockContact','disableContact','execRun','getContactPreview','recallme','validateContact','[Preview][checkIsBlackList]','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','starttime','variables','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','isFailure','response','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','keys','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','uuid','moment','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','./rpcDb','./util/util','../dialer/utils','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','sequence','trunks','agents','clockClearZombieChannels','originateresponse','bind','syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','campaignsPreview','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','name','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','paused','message','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','CAMPAIGN_STATUS','logger','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','type','dialActive','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','actions','queue','originated:\x20','stringify','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','status','channel','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','decrementTalking','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','then','logger2','[RecallMe]','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','setMessage','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','ANSWER','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','acw','mandatoryDisposition','channelAgent','custom:agentcomplete','complete','total','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','BUSY','outboundBusyCallsDay','countbusyretry','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','Global','activeContact','swapAdditionalPhones','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','callAdditionalPhoneAfterMin','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','countnoanswerretry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry'];(function(_0x68cae0,_0x7d78cd){var _0x5e7200=function(_0x4a709f){while(--_0x4a709f){_0x68cae0['push'](_0x68cae0['shift']());}};_0x5e7200(++_0x7d78cd);}(_0x930d,0x1c3));var _0xd930=function(_0x53e3de,_0x13da7b){_0x53e3de=_0x53e3de-0x0;var _0x7b905b=_0x930d[_0x53e3de];return _0x7b905b;};'use strict';var util=require('util');var _=require('lodash');var uuid=require(_0xd930('0x0'));var moment=require(_0xd930('0x1'));var Redis=require(_0xd930('0x2'));var config=require(_0xd930('0x3'));var logger=require('../../../config/logger')(_0xd930('0x4'));var loggerAction=require(_0xd930('0x5'))(_0xd930('0x6'));var ami=require('../ami');var rpcDb=require(_0xd930('0x7'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require('./action');var ut=require(_0xd930('0x8'));var utils=require(_0xd930('0x9'));config[_0xd930('0xa')]=_[_0xd930('0xb')](config['redis'],{'host':_0xd930('0xc'),'port':0x18eb});var io=require(_0xd930('0xd'))(new Redis(config[_0xd930('0xa')]));var Sequence=function(){};Sequence[_0xd930('0xe')]['enqueue']=function(_0x5c951d){this[_0xd930('0xf')]=this['tail']?this[_0xd930('0xf')][_0xd930('0x10')](_0x5c951d):_0x5c951d();};function Preview(_0x4cf65e){this[_0xd930('0x11')]=new Sequence();this['campaignsPreview']=_0x4cf65e['voiceQueues'];this['trunks']=_0x4cf65e[_0xd930('0x12')];this['actions']={};this['agents']=_0x4cf65e[_0xd930('0x13')];this[_0xd930('0x14')]=0x0;ami['on'](_0xd930('0x15'),this['syncOriginateResponse'][_0xd930('0x16')](this));ami['on']('hangup',this[_0xd930('0x17')]['bind'](this));ami['on']('hanguprequest',this[_0xd930('0x18')][_0xd930('0x16')](this));ami['on'](_0xd930('0x19'),this[_0xd930('0x1a')][_0xd930('0x16')](this));ami['on'](_0xd930('0x1b'),this[_0xd930('0x1c')][_0xd930('0x16')](this));ami['on'](_0xd930('0x1d'),this[_0xd930('0x1e')][_0xd930('0x16')](this));ami['on']('attendedtransfer',this[_0xd930('0x1f')][_0xd930('0x16')](this));ami['on'](_0xd930('0x20'),this[_0xd930('0x21')]['bind'](this));this['loopCampaigns'](this[_0xd930('0x22')]);}function emit(_0x75cf24,_0x112784,_0x182db5){io['to'](_0x75cf24)['emit'](_0x112784,_0x182db5);}function emitVoiceQueueChannelRemove(_0x5b0068){logger[_0xd930('0x23')](_0xd930('0x24'),JSON['stringify'](_0x5b0068));emit(util[_0xd930('0x25')](_0xd930('0x26'),_0x5b0068[_0xd930('0x27')]),_0xd930('0x28'),_0x5b0068);io[_0xd930('0x29')](_0xd930('0x2a'),_0x5b0068);}function notSendMessagesQueue(_0x14de4c){if(_0x14de4c[_0xd930('0x2b')]){if(_0x14de4c[_0xd930('0x2c')]===0x0&&_0x14de4c[_0xd930('0x2d')]===0x0){_0x14de4c['sendMessageOneNotActive']=![];_0x14de4c['available']=0x0;_0x14de4c[_0xd930('0x2e')]=0x0;_0x14de4c[_0xd930('0x2f')]=utils['CAMPAIGN_STATUS'][_0xd930('0x30')];ut['logger'](_0xd930('0x31'),_0x14de4c[_0xd930('0x27')]+_0xd930('0x32'));}else{_0x14de4c[_0xd930('0x2f')]=utils[_0xd930('0x33')]['DEACTIVATED'];ut[_0xd930('0x34')](_0xd930('0x31'),_0x14de4c[_0xd930('0x27')]+'\x20is\x20deactivated');}}}Preview[_0xd930('0xe')][_0xd930('0x35')]=function(){var _0x53ae99=this;setInterval(function(){_0x53ae99[_0xd930('0x36')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x214706=this[_0xd930('0x22')];this['clockClearZombieChannels']+=0x1;for(var _0x3c2807 in _0x214706){if(_0x214706[_0xd930('0x37')](_0x3c2807)&&(_0x214706[_0x3c2807][_0xd930('0x38')]===_0xd930('0x4')||_0x214706[_0x3c2807]['dialMethod']===_0xd930('0x39'))&&_0x214706[_0x3c2807]['type']===_0xd930('0x3a')){if(this['clockClearZombieChannels']>0x7){this[_0xd930('0x14')]=0x0;this[_0xd930('0x3b')]();}}if(_0x214706[_0xd930('0x37')](_0x3c2807)&&_0x214706[_0x3c2807]['dialMethod']===_0xd930('0x4')&&_0x214706[_0x3c2807][_0xd930('0x3c')]==='outbound'){if(_0x214706[_0x3c2807][_0xd930('0x3d')]){this['setMessage'](_0x214706[_0x3c2807]);if(_0x214706[_0x3c2807]['dialPreviewAutoRecallMe'])this[_0xd930('0x3e')](_0x214706[_0x3c2807]);}else{notSendMessagesQueue(_0x214706[_0x3c2807]);}}}};Preview[_0xd930('0xe')][_0xd930('0x3f')]=function(_0x53764c){var _0x231094=this;this[_0xd930('0x11')]['enqueue'](function(){if(!_[_0xd930('0x40')](_0x231094['actions'][_0x53764c])){loggerAction['info'](_0xd930('0x41'),_0x53764c,_0xd930('0x42'),_0x231094[_0xd930('0x43')][_0x53764c][_0xd930('0x44')],_0xd930('0x45'),JSON[_0xd930('0x46')](_0x231094[_0xd930('0x22')][_0x231094[_0xd930('0x43')][_0x53764c][_0xd930('0x44')]][_0xd930('0x2c')]),_0xd930('0x47'),JSON['stringify'](_0x231094[_0xd930('0x22')][_0x231094[_0xd930('0x43')][_0x53764c][_0xd930('0x44')]][_0xd930('0x2d')]),JSON[_0xd930('0x46')](_0x231094[_0xd930('0x43')][_0x53764c][_0xd930('0x48')]),JSON[_0xd930('0x46')](_[_0xd930('0x49')](_0x231094[_0xd930('0x43')][_0x53764c],[_0xd930('0x4a'),_0xd930('0x4b'),_0xd930('0x4c'),'ListId'])));return ami['Action']({'action':_0xd930('0x4d'),'channel':_0x231094[_0xd930('0x43')][_0x53764c][_0xd930('0x4e')]})[_0xd930('0x4f')](function(_0x420e81){if(_0x420e81[_0xd930('0x2f')]===_0xd930('0x50')){setTimeout(function(){if(_0x231094[_0xd930('0x43')][_0x53764c]){utils[_0xd930('0x51')](_0x231094[_0xd930('0x22')][_0x231094[_0xd930('0x43')][_0x53764c][_0xd930('0x44')]],_0xd930('0x52'));if(_0x231094[_0xd930('0x43')][_0x53764c][_0xd930('0x48')]===!![]){ut[_0xd930('0x53')](_0x231094[_0xd930('0x22')][_0x231094[_0xd930('0x43')][_0x53764c]['queue']],_0xd930('0x52'));ut[_0xd930('0x54')](_0xd930('0x55')+_0x53764c,_0x231094[_0xd930('0x43')][_0x53764c]['queue']);}ut[_0xd930('0x54')](_0xd930('0x56')+_0x53764c,_0x231094[_0xd930('0x43')][_0x53764c]['queue']);delete _0x231094['actions'][_0x53764c];}},0x2328);}});}});};Preview['prototype'][_0xd930('0x3b')]=function(){var _0x3ae58a=this;loggerAction[_0xd930('0x23')](_0xd930('0x57'),_['size'](this['actions']));for(var _0x5b02aa in this[_0xd930('0x43')]){if(_0x3ae58a[_0xd930('0x43')][_0xd930('0x37')](_0x5b02aa)){_0x3ae58a[_0xd930('0x3f')](_0x5b02aa);}}};Preview[_0xd930('0xe')]['recallMe']=function(_0x222180){var _0x215a5b=this;rpcDb['getContactRecallMe'](_0x222180['id'],ut['agentReadyId'](this[_0xd930('0x13')]))['then'](function(_0x375293){if(!_[_0xd930('0x40')](_0x375293)){for(var _0x411312=0x0;_0x411312<_0x375293[_0xd930('0x58')];_0x411312+=0x1){if(ut[_0xd930('0x59')](_0x375293[_0x411312][_0xd930('0x5a')])<_0x222180[_0xd930('0x5b')]*0x3c){if(_0x375293[_0x411312][_0xd930('0x5c')]&&!_0x375293[_0x411312][_0xd930('0x5c')][_0xd930('0x5d')]){_0x215a5b[_0xd930('0x5e')](_0x375293[_0x411312]['id'])[_0xd930('0x5f')](ut[_0xd930('0x60')]('[RecallMe]'))[_0xd930('0x4f')](ut[_0xd930('0x60')](_0xd930('0x61')));}else{rpcDb['disableContact'](_0x375293[_0x411312]['id']);}}else{var _0x2306ff=new Action(_0x375293[_0x411312],_0x222180);_0x2306ff['starttime']=moment()[_0xd930('0x25')](_0xd930('0x62'));_0x222180['outboundReCallsDay']+=0x1;ut[_0xd930('0x63')](_0x2306ff,0x17,_0xd930('0x64'));if(_0x222180['dialRecallInQueue']){rpcDb[_0xd930('0x65')](ut['createBody'](_0x375293[_0x411312]));rpcDb[_0xd930('0x66')](_0x2306ff,_0xd930('0x67'));}else{ut['logCustomer'](_0x2306ff,0x16,_0xd930('0x68'));rpcDb[_0xd930('0x66')](_0x2306ff,_0xd930('0x69'));rpcDb[_0xd930('0x6a')](_0x2306ff,'[HistoryRecallClose]');}}}}})[_0xd930('0x4f')](ut[_0xd930('0x60')]('[getContactRecallMe]'));};Preview['prototype'][_0xd930('0x6b')]=function(_0xba073a){_0xba073a['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0xba073a[_0xd930('0x6c')])){_0xba073a['message']=utils[_0xd930('0x33')][_0xd930('0x6d')];}else if(!ut[_0xd930('0x6e')](_0xba073a['dialActive'])){_0xba073a[_0xd930('0x2f')]=utils[_0xd930('0x33')][_0xd930('0x30')];}else if(!this[_0xd930('0x6f')](_0xba073a[_0xd930('0x70')])){if(!this[_0xd930('0x6f')](_0xba073a['TrunkBackup'])){_0xba073a[_0xd930('0x2f')]=utils[_0xd930('0x33')][_0xd930('0x71')];}else{_0xba073a['message']=utils[_0xd930('0x33')]['ACTIVE'];}}else{_0xba073a[_0xd930('0x2f')]=utils[_0xd930('0x33')][_0xd930('0x72')];}};Preview['prototype'][_0xd930('0x73')]=function(_0x4615af,_0x5b6514,_0x667a5){var _0x541d4d=this;var _0x291cdf=this[_0xd930('0x43')][_0x5b6514];var _0x3cc142=this[_0xd930('0x22')][_0x291cdf['queue']];var _0x3ffec1;var _0x35787d=![];var _0x5b58cf=0x2;var _0x2f39cc=0x3;if(_0x3cc142){switch(_0x667a5){case'1':_0x3cc142[_0xd930('0x74')]+=0x1;_0x291cdf[_0xd930('0x75')]+=0x1;_0x291cdf[_0xd930('0x76')]=ut[_0xd930('0x77')](_0x291cdf);ut[_0xd930('0x63')](_0x291cdf,0x0,_0xd930('0x78'));ami[_0xd930('0x29')](_0xd930('0x79'),ut[_0xd930('0x7a')](_0x291cdf,_0xd930('0x7b')));rpcDb[_0xd930('0x66')](_0x291cdf,_0xd930('0x7c'));_0x541d4d['verifyAdditionalPhones'](_0x291cdf,'0',_0x3cc142)[_0xd930('0x5f')](function(_0x4d6b58){_0x35787d=_0x4d6b58[_0xd930('0x7d')]==0x1;_0x5b58cf=_0x3cc142['dialNoSuchNumberRetryFrequency'];_0x2f39cc=_0x3cc142['callAdditionalPhoneAfterMin'];if(!_0x35787d){if(ut[_0xd930('0x77')](_0x291cdf)>=_0x3cc142[_0xd930('0x7e')]){_0x3ffec1=ut[_0xd930('0x7f')](_0x291cdf,0xf,'Global');rpcDb[_0xd930('0x6a')](_0x3ffec1,_0xd930('0x80'));}else{if(_0x291cdf['countnosuchnumberretry']>=_0x3cc142[_0xd930('0x81')]){rpcDb['createCustomerFinal'](_0x291cdf,_0xd930('0x80'));}else{rpcDb[_0xd930('0x82')](ut[_0xd930('0x83')](_0x291cdf,_0xd930('0x75'),_0x3cc142[_0xd930('0x84')]),_0x291cdf[_0xd930('0x85')],_0x291cdf['activeContact']);}}delete this[_0xd930('0x43')][_0x4615af[_0xd930('0x86')]];}else{_0x291cdf['countnosuchnumberretry']++;logger[_0xd930('0x23')](_0xd930('0x87'),_0x291cdf[_0xd930('0x75')]);logger[_0xd930('0x23')]('id',_0x291cdf[_0xd930('0x88')]);_0x541d4d[_0xd930('0x89')]({'id':_0x291cdf[_0xd930('0x88')],'field':{'countnosuchnumberretry':_0x291cdf['countnosuchnumberretry']}})[_0xd930('0x5f')](function(){_0x541d4d['swapAdditionalPhones'](_0x291cdf,_0x5b58cf,_0x2f39cc)['then'](function(){});});}});break;case _0xd930('0x8a'):var _0x354668=moment()['format'](_0xd930('0x62'));_0x291cdf[_0xd930('0x8b')]=_0x354668;_0x291cdf['answertime']=_0x354668;_0x291cdf[_0xd930('0x48')]=!![];_0x3cc142[_0xd930('0x2d')]+=0x1;logger[_0xd930('0x23')](_0xd930('0x8c'),_0x291cdf[_0xd930('0x8d')],_0xd930('0x8e'),_0x3cc142['name'],_0xd930('0x47'),_0x3cc142[_0xd930('0x2d')]);ami[_0xd930('0x29')](_0xd930('0x8f'),ut[_0xd930('0x7a')](_0x291cdf,'connect',this[_0xd930('0x22')][_0x291cdf[_0xd930('0x44')]]));if(_0x3cc142[_0xd930('0x90')]||_0x3cc142[_0xd930('0x91')]){ami[_0xd930('0x29')]('custom:agentConnectPreview',{'queue':_0x291cdf[_0xd930('0x44')],'interface':_0x291cdf[_0xd930('0x92')],'uniqueid':_0x291cdf[_0xd930('0x8d')]});}break;case'16':ami[_0xd930('0x29')](_0xd930('0x93'),ut[_0xd930('0x7a')](_0x291cdf,_0xd930('0x94'),this[_0xd930('0x22')][_0x291cdf[_0xd930('0x44')]]));emitVoiceQueueChannelRemove(ut[_0xd930('0x7a')](_0x291cdf,'complete'));_0x3cc142['outboundAnswerCallsDay']+=0x1;_0x3cc142[_0xd930('0x95')]+=0x1;_0x3cc142['answered']+=0x1;ut[_0xd930('0x53')](_0x3cc142,'[16]');_0x291cdf[_0xd930('0x76')]=ut[_0xd930('0x77')](_0x291cdf);ut[_0xd930('0x63')](_0x291cdf,0x4,_0xd930('0x96'));rpcDb['createCustomerHistory'](_0x291cdf,'[callProgressDetectingCustomer][logAnswer]');rpcDb['createCustomerFinal'](_0x291cdf,_0xd930('0x97'));rpcDb[_0xd930('0x98')](_0x291cdf);_0x3cc142[_0xd930('0x99')]+=_0x291cdf[_0xd930('0x9a')];_0x3cc142[_0xd930('0x9b')]+=_0x291cdf[_0xd930('0x9a')];logger[_0xd930('0x23')]('[syncHangup][talking][decrement]',_0x291cdf[_0xd930('0x8d')],'\x20Queue',_0x3cc142[_0xd930('0x27')],_0xd930('0x47'),_0x3cc142['pTalking']);delete this[_0xd930('0x43')][_0x4615af[_0xd930('0x86')]];break;case _0xd930('0x9c'):_0x3cc142[_0xd930('0x9d')]+=0x1;_0x291cdf[_0xd930('0x9e')]+=0x1;_0x291cdf[_0xd930('0x76')]=ut[_0xd930('0x77')](_0x291cdf);ut[_0xd930('0x63')](_0x291cdf,0x5,'Busy');_0x5b58cf=_0x3cc142[_0xd930('0x9f')];_0x2f39cc=_0x3cc142['callAdditionalPhoneAfterMin'];ami[_0xd930('0x29')](_0xd930('0xa0'),ut[_0xd930('0x7a')](_0x291cdf,_0xd930('0xa1')));rpcDb[_0xd930('0x66')](_0x291cdf,_0xd930('0xa2'));_0x541d4d[_0xd930('0xa3')](_0x291cdf,'5',_0x3cc142)[_0xd930('0x5f')](function(_0x3f4b06){_0x35787d=_0x3f4b06[_0xd930('0x7d')]==0x1;if(!_0x35787d){if(ut[_0xd930('0x77')](_0x291cdf)>=_0x3cc142[_0xd930('0x7e')]){_0x3ffec1=ut[_0xd930('0x7f')](_0x291cdf,0xf,_0xd930('0xa4'));rpcDb['createCustomerFinal'](_0x3ffec1,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x291cdf[_0xd930('0x9e')]>=_0x3cc142['dialBusyMaxRetry']){rpcDb[_0xd930('0x6a')](_0x291cdf,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xd930('0x82')](ut[_0xd930('0x83')](_0x291cdf,_0xd930('0x9e'),_0x3cc142[_0xd930('0x9f')]),_0x291cdf['unlockAgent'],_0x291cdf[_0xd930('0xa5')]);}}}else{_0x291cdf[_0xd930('0x9e')]++;_0x541d4d['incrementPreviewCounters']({'id':_0x291cdf[_0xd930('0x88')],'field':{'countbusyretry':_0x291cdf[_0xd930('0x9e')]}})['then'](function(){_0x541d4d[_0xd930('0xa6')](_0x291cdf,_0x5b58cf,_0x2f39cc)['then'](function(){});});}});break;case'NOANSWER':_0x3cc142[_0xd930('0xa7')]+=0x1;_0x291cdf['countnoanswerretry']+=0x1;_0x291cdf[_0xd930('0x76')]=ut[_0xd930('0x77')](_0x291cdf);ut['logCustomer'](_0x291cdf,0x3,_0xd930('0xa8'));_0x5b58cf=_0x3cc142[_0xd930('0xa9')];_0x2f39cc=_0x3cc142[_0xd930('0xaa')];var _0x2dfe05=ut[_0xd930('0xab')](_0x291cdf,_0x3cc142);ami[_0xd930('0x29')](_0xd930('0xac'),_0x2dfe05);rpcDb[_0xd930('0x66')](_0x291cdf,_0xd930('0xad'));_0x541d4d[_0xd930('0xa3')](_0x291cdf,'3',_0x3cc142)[_0xd930('0x5f')](function(_0xee84b0){_0x35787d=_0xee84b0[_0xd930('0x7d')]==0x1;if(!_0x35787d){if(ut[_0xd930('0x77')](_0x291cdf)>=_0x3cc142[_0xd930('0x7e')]){_0x3ffec1=ut[_0xd930('0x7f')](_0x291cdf,0xf,_0xd930('0xa4'));rpcDb[_0xd930('0x6a')](_0x3ffec1,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x291cdf['countnoanswerretry']>=_0x3cc142[_0xd930('0xae')]){rpcDb[_0xd930('0x6a')](_0x291cdf,_0xd930('0xad'));}else{rpcDb[_0xd930('0x82')](ut['scheduledAt'](_0x291cdf,_0xd930('0xaf'),_0x3cc142[_0xd930('0xa9')]),_0x291cdf[_0xd930('0x85')],_0x291cdf[_0xd930('0xa5')]);}}}else{_0x291cdf[_0xd930('0xaf')]++;_0x541d4d['incrementPreviewCounters']({'id':_0x291cdf['idContact'],'field':{'countnoanswerretry':_0x291cdf[_0xd930('0xaf')]}})[_0xd930('0x5f')](function(){_0x541d4d['swapAdditionalPhones'](_0x291cdf,_0x5b58cf,_0x2f39cc)[_0xd930('0x5f')](function(){});});}});break;case _0xd930('0xb0'):_0x3cc142[_0xd930('0xb1')]+=0x1;_0x291cdf[_0xd930('0xb2')]+=0x1;_0x291cdf[_0xd930('0x76')]=ut[_0xd930('0x77')](_0x291cdf);ut['logCustomer'](_0x291cdf,0x8,_0xd930('0xb3'));_0x5b58cf=_0x3cc142['dialCongestionRetryFrequency'];_0x2f39cc=_0x3cc142[_0xd930('0xaa')];ami[_0xd930('0x29')](_0xd930('0xb4'),ut[_0xd930('0x7a')](_0x291cdf,_0xd930('0xb5')));rpcDb['createCustomerHistory'](_0x291cdf,_0xd930('0xb6'));_0x541d4d[_0xd930('0xa3')](_0x291cdf,'8',_0x3cc142)[_0xd930('0x5f')](function(_0x23567e){_0x35787d=_0x23567e[_0xd930('0x7d')]==0x1;if(!_0x35787d){if(ut[_0xd930('0x77')](_0x291cdf)>=_0x3cc142[_0xd930('0x7e')]){_0x3ffec1=ut[_0xd930('0x7f')](_0x291cdf,0xf,_0xd930('0xa4'));rpcDb['createCustomerFinal'](_0x3ffec1,_0xd930('0xb7'));}else{if(_0x291cdf['countcongestionretry']>=_0x3cc142[_0xd930('0xb8')]){rpcDb[_0xd930('0x6a')](_0x291cdf,_0xd930('0xb6'));}else{rpcDb[_0xd930('0x82')](ut[_0xd930('0x83')](_0x291cdf,'countcongestionretry',_0x3cc142[_0xd930('0x9f')]),_0x291cdf[_0xd930('0x85')],_0x291cdf[_0xd930('0xa5')]);}}}else{_0x291cdf[_0xd930('0xb2')]++;_0x541d4d[_0xd930('0x89')]({'id':_0x291cdf['idContact'],'field':{'countcongestionretry':_0x291cdf[_0xd930('0xb2')]}})[_0xd930('0x5f')](function(){_0x541d4d['swapAdditionalPhones'](_0x291cdf,_0x5b58cf,_0x2f39cc)[_0xd930('0x5f')](function(){});});}});break;case _0xd930('0xb9'):_0x3cc142[_0xd930('0xba')]+=0x1;_0x291cdf[_0xd930('0xbb')]+=0x1;_0x291cdf[_0xd930('0x76')]=ut[_0xd930('0x77')](_0x291cdf);ut['logCustomer'](_0x291cdf,0x14,_0xd930('0xbc'));_0x5b58cf=_0x3cc142[_0xd930('0xbd')];_0x2f39cc=_0x3cc142[_0xd930('0xaa')];ami['emit'](_0xd930('0xbe'),ut[_0xd930('0x7a')](_0x291cdf,_0xd930('0xbf')));rpcDb[_0xd930('0x66')](_0x291cdf,_0xd930('0xc0'));_0x541d4d['verifyAdditionalPhones'](_0x291cdf,'20',_0x3cc142)[_0xd930('0x5f')](function(_0x2fa269){_0x35787d=_0x2fa269['additional']==0x1;if(!_0x35787d){if(ut[_0xd930('0x77')](_0x291cdf)>=_0x3cc142[_0xd930('0x7e')]){_0x3ffec1=ut['cloneAction'](_0x291cdf,0x14,_0xd930('0xbc'));rpcDb[_0xd930('0x6a')](_0x3ffec1,_0xd930('0xc1'));}else{if(_0x291cdf['countagentrejectretry']>=_0x3cc142[_0xd930('0xc2')]){rpcDb[_0xd930('0x6a')](_0x291cdf,_0xd930('0xc1'));}else{rpcDb[_0xd930('0x82')](ut[_0xd930('0x83')](_0x291cdf,_0xd930('0xbb'),_0x3cc142[_0xd930('0xbd')]),_0x291cdf[_0xd930('0x85')],_0x291cdf[_0xd930('0xa5')]);}}}else{_0x291cdf[_0xd930('0xaf')]++;_0x541d4d[_0xd930('0x89')]({'id':_0x291cdf[_0xd930('0x88')],'field':{'countnoanswerretry':_0x291cdf[_0xd930('0xaf')]}})[_0xd930('0x5f')](function(){_0x541d4d[_0xd930('0xa6')](_0x291cdf,_0x5b58cf,_0x2f39cc)[_0xd930('0x5f')](function(){});});}});break;case _0xd930('0xc3'):_0x3cc142[_0xd930('0xc4')]+=0x1;_0x291cdf[_0xd930('0xc5')]+=0x1;_0x291cdf[_0xd930('0x76')]=ut['totalGlobal'](_0x291cdf);ut[_0xd930('0x63')](_0x291cdf,0xb,_0xd930('0xc6'));rpcDb['createCustomerHistory'](_0x291cdf,_0xd930('0xc7'));_0x541d4d[_0xd930('0xa3')](_0x291cdf,'11',_0x3cc142)[_0xd930('0x5f')](function(_0x3aa715){_0x35787d=_0x3aa715[_0xd930('0x7d')]==0x1;if(!_0x35787d){if(ut[_0xd930('0x77')](_0x291cdf)>=_0x3cc142['dialGlobalMaxRetry']){_0x3ffec1=ut[_0xd930('0x7f')](_0x291cdf,0xf,_0xd930('0xa4'));rpcDb[_0xd930('0x6a')](_0x3ffec1,_0xd930('0xc7'));}else{if(_0x291cdf[_0xd930('0xc8')]>=_0x3cc142[_0xd930('0xc9')]){rpcDb[_0xd930('0x6a')](_0x291cdf,_0xd930('0xc7'));}else{rpcDb[_0xd930('0x82')](ut[_0xd930('0x83')](_0x291cdf,_0xd930('0xc5'),_0x3cc142[_0xd930('0xca')]),_0x291cdf[_0xd930('0x85')],_0x291cdf[_0xd930('0xa5')]);}}}else{_0x291cdf[_0xd930('0xaf')]++;_0x541d4d[_0xd930('0x89')]({'id':_0x291cdf[_0xd930('0x88')],'field':{'countnoanswerretry':_0x291cdf['countnoanswerretry']}})[_0xd930('0x5f')](function(){_0x541d4d[_0xd930('0xa6')](_0x291cdf,_0x5b58cf,_0x2f39cc)[_0xd930('0x5f')](function(){});});}});break;case'18':_0x3cc142[_0xd930('0xcb')]+=0x1;_0x291cdf['countmachineretry']+=0x1;_0x291cdf[_0xd930('0x76')]=ut[_0xd930('0x77')](_0x291cdf);ut[_0xd930('0x63')](_0x291cdf,0x12,_0x4615af[_0xd930('0xcc')]||_0x4615af['dialstatus']);ami['emit'](_0xd930('0xcd'),ut[_0xd930('0x7a')](_0x291cdf,'amd'));rpcDb[_0xd930('0x66')](_0x291cdf,'[callProgressDetectingCustomer][hangupInAMD]');_0x541d4d[_0xd930('0xa3')](_0x291cdf,'18',_0x3cc142)[_0xd930('0x5f')](function(_0x40b7f0){_0x35787d=_0x40b7f0[_0xd930('0x7d')]==0x1;if(!_0x35787d){if(ut['totalGlobal'](_0x291cdf)>=_0x3cc142[_0xd930('0x7e')]){_0x3ffec1=ut[_0xd930('0x7f')](_0x291cdf,0x12,_0xd930('0xa4'));rpcDb[_0xd930('0x6a')](_0x3ffec1,_0xd930('0xce'));}else{rpcDb['createCustomerFinal'](_0x291cdf,_0xd930('0xce'));}}else{_0x291cdf[_0xd930('0xaf')]++;_0x541d4d[_0xd930('0x89')]({'id':_0x291cdf[_0xd930('0x88')],'field':{'countnoanswerretry':_0x291cdf[_0xd930('0xaf')]}})[_0xd930('0x5f')](function(){_0x541d4d[_0xd930('0xa6')](_0x291cdf,_0x5b58cf,_0x2f39cc)[_0xd930('0x5f')](function(){});});}});delete this[_0xd930('0x43')][_0x4615af[_0xd930('0x86')]];break;case'19':_0x3cc142[_0xd930('0xcb')]+=0x1;_0x291cdf['countglobal']=ut[_0xd930('0x77')](_0x291cdf);ut['logCustomer'](_0x291cdf,0x13,_0x4615af[_0xd930('0xcc')]||_0x4615af[_0xd930('0xcf')]);ami[_0xd930('0x29')]('custom:amd',ut[_0xd930('0x7a')](_0x291cdf,_0xd930('0xd0')));rpcDb['createCustomerHistory'](_0x291cdf,_0xd930('0xd1'));_0x541d4d[_0xd930('0xa3')](_0x291cdf,'18',_0x3cc142)[_0xd930('0x5f')](function(_0x2bd373){_0x35787d=_0x2bd373['additional']==0x1;if(!_0x35787d){if(ut['totalGlobal'](_0x291cdf)>=_0x3cc142[_0xd930('0x7e')]){_0x3ffec1=ut[_0xd930('0x7f')](_0x291cdf,0xf,_0xd930('0xa4'));rpcDb[_0xd930('0x6a')](_0x3ffec1,_0xd930('0xd1'));}else{rpcDb[_0xd930('0x6a')](_0x291cdf,_0xd930('0xd1'));}}else{_0x291cdf['countnoanswerretry']++;_0x541d4d[_0xd930('0x89')]({'id':_0x291cdf[_0xd930('0x88')],'field':{'countnoanswerretry':_0x291cdf[_0xd930('0xaf')]}})[_0xd930('0x5f')](function(){_0x541d4d['swapAdditionalPhones'](_0x291cdf,_0x5b58cf,_0x2f39cc)[_0xd930('0x5f')](function(){});});}});delete this[_0xd930('0x43')][_0x4615af[_0xd930('0x86')]];break;default:if(_0x291cdf['dialAnswer']){ut[_0xd930('0x53')](_0x3cc142,'[default]');ut[_0xd930('0x54')](_0xd930('0xd2')+_0x3cc142[_0xd930('0x27')],_0x4615af);}_0x3cc142['outboundUnknownCallsDay']+=0x1;_0x291cdf[_0xd930('0x76')]=ut['totalGlobal'](_0x291cdf);ut[_0xd930('0x63')](_0x291cdf,0xc,_0x4615af[_0xd930('0xcc')]||_0x4615af[_0xd930('0xcf')]);_0x5b58cf=_0x3cc142[_0xd930('0xbd')];_0x2f39cc=_0x3cc142[_0xd930('0xaa')];rpcDb[_0xd930('0x66')](_0x291cdf,_0xd930('0xd3'));_0x541d4d[_0xd930('0xa3')](_0x291cdf,'20',_0x3cc142)[_0xd930('0x5f')](function(_0x27bdba){_0x35787d=_0x27bdba[_0xd930('0x7d')]==0x1;if(!_0x35787d){if(ut[_0xd930('0x77')](_0x291cdf)>=_0x3cc142['dialGlobalMaxRetry']){_0x3ffec1=ut[_0xd930('0x7f')](_0x291cdf,0xf,_0xd930('0xa4'));rpcDb[_0xd930('0x6a')](_0x3ffec1,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xd930('0x6a')](_0x291cdf,_0xd930('0xd4'));}delete this[_0xd930('0x43')][_0x4615af[_0xd930('0x86')]];}else{_0x541d4d[_0xd930('0xa6')](_0x291cdf,_0x5b58cf,_0x2f39cc)[_0xd930('0x5f')](function(){});}});}if(!(_0x291cdf['dialAnswer']&&_0x667a5==='16')){utils[_0xd930('0x51')](_0x3cc142,_0xd930('0xd5'));logger[_0xd930('0x23')](_0xd930('0xd6'),_0x291cdf[_0xd930('0x8d')],_0xd930('0x8e'),_0x3cc142[_0xd930('0x27')],'originated:\x20',_0x3cc142[_0xd930('0x2c')]);}if(_0x667a5!==_0xd930('0x8a')){delete this['actions'][_0x4615af['linkedid']];delete this['actions'][_0x4615af['destlinkedid']];}_0x3cc142[_0xd930('0xd7')]=!![];}};Preview[_0xd930('0xe')][_0xd930('0xd8')]=function(_0x52cf8c,_0x5e8040,_0x318e0f){if(_['isUndefined'](_0x5e8040)&&'object'!==typeof _0x5e8040){return;}if(_[_0xd930('0xd9')](_0x318e0f)&&_0xd930('0xda')!==typeof _0x318e0f){return;}switch(_0x318e0f[_0xd930('0xdb')]){case'0':ut['logAgent'](_0x52cf8c,0x0,_0xd930('0x78'));rpcDb[_0xd930('0xdc')](_0x52cf8c,_0xd930('0xdd'));break;case'3':ut[_0xd930('0xde')](_0x52cf8c,0x3,_0xd930('0xa8'));rpcDb[_0xd930('0xdc')](_0x52cf8c,_0xd930('0xdf'));break;case'5':ut[_0xd930('0xde')](_0x52cf8c,0x5,_0xd930('0xe0'));rpcDb[_0xd930('0xdc')](_0x52cf8c,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xd930('0xde')](_0x52cf8c,0x8,_0xd930('0xb3'));rpcDb[_0xd930('0xdc')](_0x52cf8c,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xd930('0xde')](_0x52cf8c,0x16,'AnswerAGI');rpcDb[_0xd930('0xdc')](_0x52cf8c,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xd930('0xde')](_0x52cf8c,0xc,_0x318e0f['reason']);rpcDb[_0xd930('0xdc')](_0x52cf8c,_0xd930('0xe1'));}utils['decrementOriginate'](_0x5e8040,_0xd930('0xe2'));logger[_0xd930('0x23')](_0xd930('0xe3'),_0x52cf8c[_0xd930('0x8d')],_0xd930('0x8e'),_0x5e8040['name'],_0xd930('0x45'),_0x5e8040[_0xd930('0x2c')]);delete this[_0xd930('0x43')][_0x52cf8c[_0xd930('0x8d')]];};Preview['prototype']['verifyAdditionalPhones']=function(_0x114963,_0x3b189d,_0x21b3c7){return cmHopperAdditionalPhone[_0xd930('0xa3')](_0x114963,_0x3b189d,_0x21b3c7)['catch'](logger[_0xd930('0x23')](_0xd930('0xe4')));};Preview[_0xd930('0xe')][_0xd930('0xa6')]=function(_0x22a21e,_0x6941a1,_0xe38aee){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x22a21e,_0x6941a1,_0xe38aee)['catch'](logger[_0xd930('0x23')]('[swapAdditionalPhone]\x20'));};Preview['prototype'][_0xd930('0x89')]=function(_0x22fa47){return Promise[_0xd930('0xe5')]()[_0xd930('0x5f')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x22fa47))[_0xd930('0x4f')](logger['info'](_0xd930('0xe6')));};Preview['prototype']['checkInBlack']=function(_0x320042,_0x1b717c,_0x3e7db7,_0x2df9e3,_0x4ee5ed){var _0xe84e5=this;return new Promise(function(_0x2cd048,_0x4a8c4f){if(_[_0xd930('0x40')](_0x1b717c)||_['isNil'](_0x1b717c[_0xd930('0xe7')])||_[_0xd930('0x40')](_0x1b717c[_0xd930('0xe8')])||_[_0xd930('0x40')](_0x1b717c[_0xd930('0x4c')])){_0x4a8c4f(ut['message'](_0xd930('0xe9'),_0x2df9e3,_0x4ee5ed));return;}var _0x31c448=uuid['v4']();var _0x3b0856=_0xe84e5[_0xd930('0x22')][_0x1b717c['Queue']['name']];var _0x32c70a=_0x3e7db7?_0xe84e5[_0xd930('0x13')][_0x3e7db7]['id']:undefined;_0xe84e5[_0xd930('0x43')][_0x31c448]=new Action(_0x1b717c,_0x3b0856,_0x31c448,_0x3e7db7,_0x32c70a);var _0x5448f8=_0xe84e5[_0xd930('0x43')][_0x31c448];_0x5448f8[_0xd930('0x85')]=_0x2df9e3;_0x5448f8[_0xd930('0xa5')]=_0x4ee5ed;_0x5448f8[_0xd930('0xea')]=_0x3e7db7;if(_[_0xd930('0xeb')](_0x320042)){_0xe84e5[_0xd930('0xec')](_0x5448f8,_0x3b0856,_0x1b717c,_0x3e7db7)[_0xd930('0x5f')](function(_0x2999b0){logger[_0xd930('0x23')](_0xd930('0xed'),_0xd930('0xee')+_0x5448f8[_0xd930('0x44')]+_0xd930('0xef')+_0x5448f8[_0xd930('0x88')],JSON[_0xd930('0x46')](_0x2999b0));ami[_0xd930('0x29')]('custom:agentcalled',ut[_0xd930('0x7a')](_0x5448f8,_0xd930('0xf0'),_0xe84e5[_0xd930('0x22')][_0x5448f8[_0xd930('0x44')]]));_0x2cd048(ut[_0xd930('0x2f')](_0xd930('0xf1')));})[_0xd930('0x4f')](function(_0x383668){ut[_0xd930('0x34')](_0xd930('0xf2'),_0x383668);_0x4a8c4f(ut[_0xd930('0x2f')](_0xd930('0xf3'),_0x2df9e3,_0x4ee5ed));});}else{_0x3b0856[_0xd930('0xf4')]+=0x1;ut[_0xd930('0xf5')](_0x5448f8);rpcDb[_0xd930('0xf6')](_0x5448f8,_0xd930('0xf7'));delete _0xe84e5['actions'][_0x31c448];_0x4a8c4f(ut[_0xd930('0x2f')]('Contact\x20in\x20black\x20List',_0x2df9e3,_0x4ee5ed));}});};Preview[_0xd930('0xe')][_0xd930('0x6f')]=function(_0x4853ea){return!_[_0xd930('0x40')](_0x4853ea)&&!_[_0xd930('0x40')](_0x4853ea[_0xd930('0x27')])&&!_[_0xd930('0x40')](_0x4853ea[_0xd930('0xf8')])&&_0x4853ea[_0xd930('0xf8')]&&!_[_0xd930('0x40')](this[_0xd930('0x12')][util['format'](_0xd930('0xf9'),_0x4853ea[_0xd930('0x27')])])&&!_[_0xd930('0x40')](this[_0xd930('0x12')][util[_0xd930('0x25')]('SIP/%s',_0x4853ea[_0xd930('0x27')])]['status'])&&(this[_0xd930('0x12')][util[_0xd930('0x25')](_0xd930('0xf9'),_0x4853ea[_0xd930('0x27')])]['status']===_0xd930('0xfa')||this[_0xd930('0x12')][util[_0xd930('0x25')](_0xd930('0xf9'),_0x4853ea[_0xd930('0x27')])][_0xd930('0x4d')]==='unmonitored');};Preview[_0xd930('0xe')][_0xd930('0x5e')]=function(_0x532283,_0x611fe5){return this['execRun'](_0x532283,_0x611fe5)[_0xd930('0x5f')](function(_0x46e478){return _[_0xd930('0x49')](_0x46e478,[_0xd930('0x2f')]);})[_0xd930('0x4f')](function(_0x4cddc6){if(_0x4cddc6[_0xd930('0xfb')]){rpcDb[_0xd930('0xfc')](_0x532283);}if(_0x4cddc6[_0xd930('0xf8')]){rpcDb[_0xd930('0xfd')](_0x532283);}throw _[_0xd930('0x49')](_0x4cddc6,[_0xd930('0x2f')]);});};Preview[_0xd930('0xe')][_0xd930('0xfe')]=function(_0x4baf91,_0x267def){var _0x3f3f5f=this;var _0x41389c,_0x1b256f;return rpcDb[_0xd930('0xff')](_0x4baf91)['then'](function(_0x10c36e){if(!_[_0xd930('0x40')](_0x10c36e[0x0])){_0x1b256f=_0x10c36e[0x0][_0xd930('0x100')]?![]:!![];_0x41389c=_0x10c36e[0x0][_0xd930('0x100')]?!![]:![];_0x41389c=_0x267def?!![]:_0x41389c;}var _0xd14e8f=_0x3f3f5f[_0xd930('0x101')](_0x10c36e);if(_0xd14e8f['isValid']){rpcDb['checkIsBlackList'](_['pick'](_0x10c36e[0x0],['VoiceQueueId','phone']))[_0xd930('0x5f')](function(_0x43d2f3){_0x3f3f5f['checkInBlack'](_0x43d2f3,_0x10c36e[0x0],_0x267def,_0x1b256f,_0x41389c)[_0xd930('0x5f')](function(_0x4db6a9){return _0x4db6a9;})[_0xd930('0x4f')](function(_0x5b0e85){throw _0x5b0e85;});})['catch'](function(_0x503d1d){ut['logger'](_0xd930('0x102'),_0x503d1d);throw ut['message']('Call\x20unsuccessful',_0x1b256f,_0x41389c);});}else{throw ut[_0xd930('0x2f')](_0xd14e8f[_0xd930('0x2f')],_0x1b256f,_0x41389c);}})[_0xd930('0x4f')](function(_0x5e09b7){ut['logger'](_0xd930('0x103'),_0x5e09b7);throw ut['message']('Call\x20unsuccessful',![],!![]);});};Preview[_0xd930('0xe')][_0xd930('0x101')]=function(_0x30bfaa){if(_['isNil'](_0x30bfaa)||_['isEmpty'](_0x30bfaa)||!_[_0xd930('0x40')](_0x30bfaa[0x0][_0xd930('0x5c')])&&_[_0xd930('0x40')](_0x30bfaa[0x0][_0xd930('0x5c')][_0xd930('0x27')])){ut[_0xd930('0x34')](_0xd930('0x104'),_0x30bfaa);return{'isValid':![],'message':_0xd930('0x105')};}var _0x303d35=this['campaignsPreview'][_0x30bfaa[0x0]['Queue'][_0xd930('0x27')]];_0x303d35[_0xd930('0x2f')]=utils[_0xd930('0x33')]['ACTIVE'];if(_['isNil'](_0x303d35)){ut[_0xd930('0x34')]('[Preview][validateContact][Empty\x20Campaign]',_0x303d35);return{'isValid':![],'message':_0xd930('0x106')};}if(!this[_0xd930('0x6f')](_0x303d35[_0xd930('0x70')])){ut[_0xd930('0x34')](_0xd930('0x107'),'campaign\x20Name:\x20'+_0x303d35[_0xd930('0x27')]+_0xd930('0x108'));if(!this['isTrunkReachable'](_0x303d35[_0xd930('0x109')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x303d35[_0xd930('0x27')]+_0xd930('0x10a'));return{'isValid':![],'message':_0xd930('0x10b')};}}if(!ut['isActive'](_0x303d35[_0xd930('0x3d')])){ut[_0xd930('0x34')](_0xd930('0x10c'),_0x303d35[_0xd930('0x27')]+_0xd930('0x10d'));return{'isValid':![],'message':_0xd930('0x10e')+_0x303d35[_0xd930('0x27')]+_0xd930('0x10d')};}return{'isValid':!![],'message':_0xd930('0x10f')};};Preview[_0xd930('0xe')][_0xd930('0xec')]=function(_0x358004,_0x21ede1,_0xd52918,_0x49e512){var _0x377226=this;return new Promise(function(_0x534514,_0x2519e1){var _0x423d26=_0x358004['uniqueid'];var _0x3be54e=_0x377226[_0xd930('0x6f')](_0x21ede1[_0xd930('0x70')])?util[_0xd930('0x25')](_0xd930('0x110'),_0x21ede1[_0xd930('0x70')]['name'],_[_0xd930('0x40')](_0x21ede1[_0xd930('0x111')])?'':_0x21ede1[_0xd930('0x111')][_0xd930('0x112')]()||'',_0x21ede1['dialCutDigit']>0x0?_0xd52918['phone'][_0xd930('0x113')](_0x21ede1[_0xd930('0x114')]):_0xd52918[_0xd930('0xe8')]):util[_0xd930('0x25')](_0xd930('0x110'),_[_0xd930('0x40')](_0x21ede1[_0xd930('0x109')])?_0x21ede1[_0xd930('0x70')][_0xd930('0x27')]:_0x21ede1['TrunkBackup']['name'],_['isNil'](_0x21ede1['dialPrefix'])?'':_0x21ede1['dialPrefix'][_0xd930('0x112')]()||'',_0x21ede1['dialCutDigit']>0x0?_0xd52918[_0xd930('0xe8')]['substring'](_0x21ede1[_0xd930('0x114')]):_0xd52918['phone']);var _0x557e2b=_0x377226['isTrunkReachable'](_0x21ede1[_0xd930('0x70')])?ut[_0xd930('0x115')](_0x21ede1[_0xd930('0x70')][_0xd930('0x116')],_0x21ede1[_0xd930('0x117')],_0x21ede1[_0xd930('0x118')]>0x0?ut[_0xd930('0x119')](_0x21ede1['dialOriginateCallerIdNumber'],_0x21ede1[_0xd930('0x118')]):_0x21ede1[_0xd930('0x11a')]):ut[_0xd930('0x115')](_[_0xd930('0x40')](_0x21ede1[_0xd930('0x109')])?_0x21ede1['Trunk']['callerid']:_0x21ede1[_0xd930('0x109')][_0xd930('0x116')],_0x21ede1[_0xd930('0x117')],_0x21ede1['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xd930('0x119')](_0x21ede1[_0xd930('0x11a')],_0x21ede1[_0xd930('0x118')]):_0x21ede1[_0xd930('0x11a')]);if(_0x557e2b){_0x358004[_0xd930('0x11b')]=ut[_0xd930('0x11c')](_0x557e2b);_0x358004[_0xd930('0x11d')]=ut[_0xd930('0x11e')](_0x557e2b);}var _0xac10f6=ut[_0xd930('0x11f')](_0x21ede1,_0xd52918,_0x3be54e,_0x557e2b,_0x423d26,_0x358004);var _0x63ab9b=utils[_0xd930('0x120')](_0xd52918[_0xd930('0xe7')]);Object[_0xd930('0x121')](_0xac10f6,_0x63ab9b);_[_0xd930('0x122')](_0x358004,ut[_0xd930('0x123')](_0xac10f6));_0x358004[_0xd930('0x124')]=moment()[_0xd930('0x25')]('YYYY-MM-DD\x20HH:mm:ss');_0x21ede1[_0xd930('0x125')]=_0xac10f6;var _0x5b6444=ut['variablesAction'](_0x358004,_0x21ede1,_0xac10f6,_0x358004[_0xd930('0xa5')],_0x49e512);return ami[_0xd930('0x126')](_0x5b6444)[_0xd930('0x5f')](function(_0x514b7b){_0x21ede1[_0xd930('0x2c')]+=0x1;logger[_0xd930('0x23')](_0xd930('0x127'),_0x423d26,_0xd930('0x8e'),_0x21ede1[_0xd930('0x27')],'originated:\x20',_0x21ede1[_0xd930('0x2c')]);_0x534514(_0x514b7b);})[_0xd930('0x4f')](function(_0x37c67c){ut['logAgent'](_0x358004,0xe,_0xd930('0x128'));rpcDb['createAgentHistory'](_0x358004,_0xd930('0x129'));_0x2519e1(_0x37c67c);});});};Preview[_0xd930('0xe')][_0xd930('0x1c')]=function(_0x161bb6){if(this[_0xd930('0x43')][_0x161bb6[_0xd930('0x86')]]){this[_0xd930('0x43')][_0x161bb6[_0xd930('0x86')]][_0xd930('0x4e')]=_0x161bb6['channel'];}};Preview[_0xd930('0xe')][_0xd930('0x12a')]=function(_0x237be3){var _0x3e1b99=this;var _0x5d1bda=this[_0xd930('0x43')][_0x237be3[_0xd930('0x12b')]];if(_0x5d1bda){if(_0x5d1bda[_0xd930('0xea')]&&this[_0xd930('0x13')][_0x5d1bda['lookAgent']]){ut[_0xd930('0x12c')](_0x5d1bda,this['agents'][_0x5d1bda[_0xd930('0xea')]][_0xd930('0x27')],this[_0xd930('0x13')][_0x5d1bda[_0xd930('0xea')]]['id']);}var _0x5f13f4=_['clone'](_0x5d1bda);_0x5f13f4[_0xd930('0x8b')]=moment()[_0xd930('0x25')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4990ca=_0x3e1b99[_0xd930('0x22')][_0x5d1bda[_0xd930('0x44')]];if(ut[_0xd930('0x12d')](_0x237be3[_0xd930('0x12e')])){if(_0x5d1bda[_0xd930('0x85')]){rpcDb[_0xd930('0xfc')](_0x5d1bda['idContact']);}if(_0x5d1bda[_0xd930('0xa5')]){rpcDb['disableContact'](_0x5d1bda[_0xd930('0x88')]);}ami[_0xd930('0x29')](_0xd930('0x12f'),ut['buildObj'](_0x5d1bda,'rejected',this[_0xd930('0x22')][_0x5d1bda['queue']]));this[_0xd930('0xd8')](_0x5f13f4,_0x4990ca,_0x237be3);}else{_0x5d1bda[_0xd930('0x124')]=moment()[_0xd930('0x25')](_0xd930('0x62'));ut[_0xd930('0xde')](_0x5f13f4,0x4,_0xd930('0x96'));rpcDb[_0xd930('0xdc')](_0x5f13f4,_0xd930('0x130'));}}};Preview['prototype'][_0xd930('0x17')]=function(_0x493e20){var _0x556c4a=this['actions'][_0x493e20[_0xd930('0x86')]];var _0xd8d0e7;if(_0x556c4a){_0xd8d0e7=this[_0xd930('0x22')][_0x556c4a['queue']];logger[_0xd930('0x23')](_0xd930('0x131'),_0x493e20[_0xd930('0x86')],_0xd930('0x8e'),_0xd8d0e7[_0xd930('0x27')],_0xd930('0x47'),_0xd8d0e7[_0xd930('0x2d')]);}if(this[_0xd930('0x43')][_0x493e20[_0xd930('0x86')]]&&_0x493e20['linkedid']!==_0x493e20[_0xd930('0x8d')]){if(_0x493e20[_0xd930('0x132')]==='16'&&this[_0xd930('0x43')][_0x493e20[_0xd930('0x86')]][_0xd930('0x48')]){this[_0xd930('0x73')](_0x493e20,_0x493e20[_0xd930('0x86')],_0x493e20[_0xd930('0x132')]);}else if(this[_0xd930('0x43')][_0x493e20[_0xd930('0x86')]][_0xd930('0x48')]){logger[_0xd930('0x23')](_0xd930('0x133'),_0x493e20[_0xd930('0x86')],_0x493e20[_0xd930('0x132')],'\x20Queue',_0xd8d0e7[_0xd930('0x27')],_0xd930('0x47'),_0xd8d0e7['pTalking']);this[_0xd930('0x73')](_0x493e20,_0x493e20[_0xd930('0x86')],_0x493e20[_0xd930('0x132')]);}}else if(_0x556c4a&&_['isNil'](_0x556c4a[_0xd930('0x134')])&&_0xd8d0e7[_0xd930('0x135')]&&_0x493e20[_0xd930('0x86')]===_0x493e20[_0xd930('0x8d')]&&_[_0xd930('0x40')](_0x493e20[_0xd930('0xdb')])&&_0x493e20['cause']==='16'&&_0x493e20[_0xd930('0x136')]==='6'&&_[_0xd930('0xd9')](_0x556c4a[_0xd930('0x137')])){if(_0x556c4a['unlockAgent']){rpcDb[_0xd930('0xfc')](_0x556c4a['idContact']);}if(_0x556c4a['activeContact']){rpcDb[_0xd930('0xfd')](_0x556c4a[_0xd930('0x88')]);}_0x493e20['reason']='22';this[_0xd930('0xd8')](_0x556c4a,_0xd8d0e7,_0x493e20);}else if(_0x556c4a&&_0x556c4a[_0xd930('0x137')]){if(_0x493e20[_0xd930('0x132')]==='16'&&this[_0xd930('0x43')][_0x493e20[_0xd930('0x86')]]['dialAnswer']){logger[_0xd930('0x23')](_0xd930('0x138'),_0x493e20[_0xd930('0x86')],_0x493e20['cause'],_0xd930('0x8e'),_0xd8d0e7[_0xd930('0x27')],'pTalking:\x20',_0xd8d0e7[_0xd930('0x2d')]);this[_0xd930('0x73')](_0x493e20,_0x493e20['linkedid'],_0x493e20[_0xd930('0x132')]);}else if(this['actions'][_0x493e20[_0xd930('0x86')]][_0xd930('0x48')]){logger[_0xd930('0x23')]('[syncHangup][talking][cause]',_0x493e20[_0xd930('0x86')],_0x493e20[_0xd930('0x132')],_0xd930('0x8e'),_0xd8d0e7[_0xd930('0x27')],'pTalking:\x20',_0xd8d0e7[_0xd930('0x2d')]);this['callProgressDetectingCustomer'](_0x493e20,_0x493e20[_0xd930('0x86')],_0x493e20['cause']);}}};Preview[_0xd930('0xe')][_0xd930('0x1a')]=function(_0x3891e5){if(this[_0xd930('0x43')][_0x3891e5['destlinkedid']]&&_0x3891e5[_0xd930('0x139')]!==_0x3891e5[_0xd930('0x13a')]){this[_0xd930('0x73')](_0x3891e5,_0x3891e5[_0xd930('0x139')],_0x3891e5[_0xd930('0xcf')]);}};Preview['prototype']['syncHangupRequest']=function(_0x352a26){if(this[_0xd930('0x43')][_0x352a26['linkedid']]&&_0x352a26['linkedid']!==_0x352a26[_0xd930('0x8d')]&&!this[_0xd930('0x43')][_0x352a26[_0xd930('0x86')]][_0xd930('0x48')]){if(_0x352a26['cause']==='1'){this[_0xd930('0x73')](_0x352a26,_0x352a26[_0xd930('0x86')],_0x352a26['cause']);}}};Preview[_0xd930('0xe')][_0xd930('0x13b')]=function(_0x5ead01,_0x1489e9,_0x2acb2d){if(this['actions'][_0x5ead01]){if(_['isNil'](this[_0xd930('0x43')][_0x5ead01][_0xd930('0x125')])){this['actions'][_0x5ead01][_0xd930('0x125')]={};}this[_0xd930('0x43')][_0x5ead01][_0xd930('0x125')][_0x1489e9]=_0x2acb2d;}};Preview[_0xd930('0xe')][_0xd930('0x1e')]=function(_0x439b65){try{if(!_[_0xd930('0x40')](_0x439b65)){if(ut['filterKey'](_[_0xd930('0x13c')](_0x439b65['variable'])[0x0])){this[_0xd930('0x13b')](_0x439b65[_0xd930('0x8d')],_[_0xd930('0x13c')](_0x439b65['variable'])[0x0],_0x439b65[_0xd930('0x13d')]);}}}catch(_0xd7c678){logger[_0xd930('0x13e')](_0xd930('0x13f'),util['inspect'](_0xd7c678,{'showHidden':![],'depth':null}));}};Preview[_0xd930('0xe')][_0xd930('0x1f')]=function(_0x3e28a4){if(_0x3e28a4){if(this[_0xd930('0x43')][_0x3e28a4[_0xd930('0x140')]]){this['actions'][_0x3e28a4[_0xd930('0x140')]]['transfer']=!![];}}};Preview[_0xd930('0xe')][_0xd930('0x21')]=function(_0x3260e8){if(_0x3260e8){if(this['actions'][_0x3260e8[_0xd930('0x141')]]){this[_0xd930('0x43')][_0x3260e8[_0xd930('0x141')]][_0xd930('0x137')]=!![];}}};module[_0xd930('0x142')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 28bd398..680f0fb 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 _0x68f3=['[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','endtime','membername','context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../rpc/cmHopper','../rpc/cmHopperHistory','inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList'];(function(_0x41d1f7,_0x25e948){var _0x11b601=function(_0x217ae9){while(--_0x217ae9){_0x41d1f7['push'](_0x41d1f7['shift']());}};_0x11b601(++_0x25e948);}(_0x68f3,0x89));var _0x368f=function(_0x567689,_0x1aaf91){_0x567689=_0x567689-0x0;var _0xd30613=_0x68f3[_0x567689];return _0xd30613;};'use strict';var util=require(_0x368f('0x0'));var BPromise=require(_0x368f('0x1'));var logger=require('../../../config/logger')('preview');var cmHopper=require(_0x368f('0x2'));var cmHopperHistory=require(_0x368f('0x3'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x595e18){return function(_0x3265ec){logger['error'](_0x595e18,util[_0x368f('0x4')](_0x3265ec,{'showHidden':![],'depth':null}));};}function create(_0xb9ab5a){return cmHopperHistory[_0x368f('0x5')](_0xb9ab5a)[_0x368f('0x6')](loggerCatch(_0x368f('0x7')));}function createAgent(_0x1edbbf){return BPromise[_0x368f('0x8')]()[_0x368f('0x9')](agentReportPreview[_0x368f('0x5')](_0x1edbbf))['catch'](loggerCatch(_0x368f('0x7')));}function moveContact(_0x177dbc){return cmHopper[_0x368f('0xa')](_0x177dbc,!![])['catch'](loggerCatch(_0x368f('0xb')));}exports[_0x368f('0xc')]=function(_0x415154){return cmHopperBlack[_0x368f('0xc')](_0x415154)['catch'](loggerCatch(_0x368f('0xd')));};exports[_0x368f('0xe')]=function(_0x402f42){return BPromise[_0x368f('0x8')]()[_0x368f('0x9')](cmHopper[_0x368f('0xe')](_0x402f42))[_0x368f('0x6')](loggerCatch(_0x368f('0xf')));};exports['createHistory']=function(_0x5e1d8c,_0x17a25e){create(_0x5e1d8c)[_0x368f('0x6')](loggerCatch(_0x17a25e));moveContact(_0x5e1d8c)['catch'](loggerCatch(_0x17a25e));};exports[_0x368f('0x10')]=function(_0xb080a,_0x20fa70){createAgent(_0xb080a)[_0x368f('0x6')](loggerCatch(_0x20fa70));};exports['createCustomerHistory']=function(_0x136c8a,_0x50d64c){create(_0x136c8a)[_0x368f('0x6')](loggerCatch(_0x50d64c));};exports[_0x368f('0x11')]=function(_0xb371f4,_0x3a013d){moveContact(_0xb371f4)[_0x368f('0x6')](loggerCatch(_0x3a013d));};exports[_0x368f('0x12')]=function(_0x160eba,_0x430e97,_0x1773d9){if(_0x430e97){_0x160eba[_0x368f('0x13')]=null;}if(_0x1773d9){_0x160eba[_0x368f('0x14')]=![];}return cmHopper[_0x368f('0x12')](_0x160eba)[_0x368f('0x6')](loggerCatch(_0x368f('0x15')));};exports[_0x368f('0x16')]=function(_0x5905dd){return cmHopper[_0x368f('0x16')](_0x5905dd)[_0x368f('0x6')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x2cd10c){return cmHopper[_0x368f('0x17')]({'UserId':null},_0x2cd10c,0x1)['catch'](loggerCatch(_0x368f('0x18')));};exports[_0x368f('0x19')]=function(_0x4e0712){return cmHopper[_0x368f('0x17')]({'active':![]},_0x4e0712,0x1)[_0x368f('0x6')](loggerCatch(_0x368f('0x1a')));};exports[_0x368f('0x1b')]=function(_0x3c5cc4){var _0x54a813={};_0x54a813[_0x368f('0x1c')]=_0x3c5cc4['type'];_0x54a813['uniqueid']=_0x3c5cc4[_0x368f('0x1d')];_0x54a813[_0x368f('0x1e')]=_0x3c5cc4[_0x368f('0x1e')];_0x54a813[_0x368f('0x1f')]=_0x3c5cc4[_0x368f('0x1f')];_0x54a813[_0x368f('0x20')]=_0x3c5cc4[_0x368f('0x20')];_0x54a813['queuecallerjoinAt']=_0x3c5cc4[_0x368f('0x21')];_0x54a813[_0x368f('0x22')]=_0x3c5cc4[_0x368f('0x21')];_0x54a813[_0x368f('0x23')]=0x1;_0x54a813['queuecallercompleteAt']=_0x3c5cc4[_0x368f('0x24')];_0x54a813['connectedlinename']=_0x3c5cc4[_0x368f('0x25')];_0x54a813[_0x368f('0x26')]='from-sip';_0x54a813[_0x368f('0x27')]=_0x368f('0x28');_0x54a813[_0x368f('0x29')]=0x0;_0x54a813[_0x368f('0x2a')]=0x1;_0x54a813[_0x368f('0x2b')]=_0x3c5cc4['membername'];_0x54a813[_0x368f('0x2c')]='COMPLETED';return BPromise[_0x368f('0x8')]()[_0x368f('0x9')](voiceQueueReport[_0x368f('0x2d')](_0x54a813))[_0x368f('0x6')](loggerCatch(_0x368f('0x2e')));};exports[_0x368f('0x2f')]=function(_0x25f30a,_0xb1aad){return BPromise['resolve']()['then'](cmHopper[_0x368f('0x2f')](_0x25f30a,_0xb1aad))[_0x368f('0x6')](loggerCatch(_0x368f('0x30')));};exports['rescheduleContactInQueue']=function(_0x979437){return cmHopper[_0x368f('0x12')](_0x979437,!![],!![])[_0x368f('0x6')](loggerCatch(_0x368f('0x31')));}; \ No newline at end of file +var _0x3c59=['type','uniqueid','calleridname','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','catch','resolve','then','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue'];(function(_0x3490e3,_0x32ca0c){var _0x7031d=function(_0x53ac24){while(--_0x53ac24){_0x3490e3['push'](_0x3490e3['shift']());}};_0x7031d(++_0x32ca0c);}(_0x3c59,0xe7));var _0x93c5=function(_0x4d34c7,_0x2c4a29){_0x4d34c7=_0x4d34c7-0x0;var _0x353aed=_0x3c59[_0x4d34c7];return _0x353aed;};'use strict';var util=require(_0x93c5('0x0'));var BPromise=require(_0x93c5('0x1'));var logger=require(_0x93c5('0x2'))(_0x93c5('0x3'));var cmHopper=require(_0x93c5('0x4'));var cmHopperHistory=require(_0x93c5('0x5'));var cmHopperBlack=require(_0x93c5('0x6'));var agentReportPreview=require(_0x93c5('0x7'));var voiceQueueReport=require(_0x93c5('0x8'));function loggerCatch(_0x1eb6b9){return function(_0x266e83){logger['error'](_0x1eb6b9,util[_0x93c5('0x9')](_0x266e83,{'showHidden':![],'depth':null}));};}function create(_0x4f1319){return cmHopperHistory['createHistory'](_0x4f1319)[_0x93c5('0xa')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x186dab){return BPromise[_0x93c5('0xb')]()[_0x93c5('0xc')](agentReportPreview[_0x93c5('0xd')](_0x186dab))[_0x93c5('0xa')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x541bb1){return cmHopper[_0x93c5('0xe')](_0x541bb1,!![])[_0x93c5('0xa')](loggerCatch(_0x93c5('0xf')));}exports['checkIsBlackList']=function(_0x2a95bd){return cmHopperBlack['checkIsBlackList'](_0x2a95bd)[_0x93c5('0xa')](loggerCatch(_0x93c5('0x10')));};exports[_0x93c5('0x11')]=function(_0x493d38){return BPromise[_0x93c5('0xb')]()[_0x93c5('0xc')](cmHopper[_0x93c5('0x11')](_0x493d38))[_0x93c5('0xa')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x8569b3,_0x4bd0dd){create(_0x8569b3)['catch'](loggerCatch(_0x4bd0dd));moveContact(_0x8569b3)[_0x93c5('0xa')](loggerCatch(_0x4bd0dd));};exports[_0x93c5('0x12')]=function(_0x42cf00,_0x70408e){createAgent(_0x42cf00)[_0x93c5('0xa')](loggerCatch(_0x70408e));};exports['createCustomerHistory']=function(_0x24471e,_0x56b716){create(_0x24471e)['catch'](loggerCatch(_0x56b716));};exports[_0x93c5('0x13')]=function(_0x27bc06,_0x5186c9){moveContact(_0x27bc06)[_0x93c5('0xa')](loggerCatch(_0x5186c9));};exports[_0x93c5('0x14')]=function(_0x24b910,_0x1ff9d5,_0x45104c){if(_0x1ff9d5){_0x24b910[_0x93c5('0x15')]=null;}if(_0x45104c){_0x24b910['active']=![];}return cmHopper[_0x93c5('0x14')](_0x24b910)['catch'](loggerCatch(_0x93c5('0x16')));};exports[_0x93c5('0x17')]=function(_0x287f7e){return cmHopper[_0x93c5('0x17')](_0x287f7e)[_0x93c5('0xa')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x27a366){return cmHopper[_0x93c5('0x18')]({'UserId':null},_0x27a366,0x1)['catch'](loggerCatch(_0x93c5('0x19')));};exports[_0x93c5('0x1a')]=function(_0x5c0924){return cmHopper[_0x93c5('0x18')]({'active':![]},_0x5c0924,0x1)['catch'](loggerCatch(_0x93c5('0x1b')));};exports[_0x93c5('0x1c')]=function(_0x3c765e){var _0x33c6ae={};_0x33c6ae[_0x93c5('0x1d')]=_0x3c765e[_0x93c5('0x1d')];_0x33c6ae[_0x93c5('0x1e')]=_0x3c765e[_0x93c5('0x1e')];_0x33c6ae['calleridnum']=_0x3c765e['calleridnum'];_0x33c6ae[_0x93c5('0x1f')]=_0x3c765e[_0x93c5('0x1f')];_0x33c6ae['queue']=_0x3c765e['queue'];_0x33c6ae[_0x93c5('0x20')]=_0x3c765e[_0x93c5('0x21')];_0x33c6ae['queuecallerleaveAt']=_0x3c765e[_0x93c5('0x21')];_0x33c6ae[_0x93c5('0x22')]=0x1;_0x33c6ae[_0x93c5('0x23')]=_0x3c765e[_0x93c5('0x24')];_0x33c6ae[_0x93c5('0x25')]=_0x3c765e[_0x93c5('0x26')];_0x33c6ae[_0x93c5('0x27')]=_0x93c5('0x28');_0x33c6ae[_0x93c5('0x29')]='xcally-motion-preview';_0x33c6ae[_0x93c5('0x2a')]=0x0;_0x33c6ae['assigned']=0x1;_0x33c6ae[_0x93c5('0x2b')]=_0x3c765e[_0x93c5('0x26')];_0x33c6ae[_0x93c5('0x2c')]=_0x93c5('0x2d');return BPromise['resolve']()['then'](voiceQueueReport[_0x93c5('0x2e')](_0x33c6ae))[_0x93c5('0xa')](loggerCatch(_0x93c5('0x2f')));};exports[_0x93c5('0x30')]=function(_0x2a63b1,_0x552143){return BPromise[_0x93c5('0xb')]()[_0x93c5('0xc')](cmHopper['getContactRecallMe'](_0x2a63b1,_0x552143))['catch'](loggerCatch(_0x93c5('0x31')));};exports[_0x93c5('0x32')]=function(_0x3f7586){return cmHopper['rescheduleContact'](_0x3f7586,!![],!![])[_0x93c5('0xa')](loggerCatch(_0x93c5('0x33')));}; \ 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 0566e6b..c83b2a7 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 _0xe167=['replace','extractCalleridName','match','extractCalleridNumber','keys','variables','forEach','toLowerCase','buildNoAnswerEventPayload','moment','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','info','loggerError','error','inspect','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','toLower','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','getSeconds','logLookAgent','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','originate','channelAgent','timeout','uniqueid','totalGlobal','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','scheduledat','add','minutes','ListId','decrementTalking','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','reachable','push','getDiff','milliseconds','diff','CampaignId','filterKey','idContact','campaigntype','dialAnswer','membername','calleridname','countbusyretry','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqos','rtpaudioqosloss','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow'];(function(_0x66874,_0x5dfa3){var _0x5c4e4a=function(_0x3d367f){while(--_0x3d367f){_0x66874['push'](_0x66874['shift']());}};_0x5c4e4a(++_0x5dfa3);}(_0xe167,0x1b6));var _0x7e16=function(_0x4de9b8,_0x261fca){_0x4de9b8=_0x4de9b8-0x0;var _0x131a97=_0xe167[_0x4de9b8];return _0x131a97;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x7e16('0x0'));var logger=require('../../../../config/logger')(_0x7e16('0x1'));var ipAgi=process[_0x7e16('0x2')][_0x7e16('0x3')]||_0x7e16('0x4');var utils=require(_0x7e16('0x5'));exports[_0x7e16('0x6')]=function(_0x10dd24){return function(_0x49a151){logger['error'](_0x10dd24,util['inspect'](_0x49a151,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x4065f7,_0x32fcec){logger[_0x7e16('0x7')](_0x4065f7,util['inspect'](_0x32fcec,{'showHidden':![],'depth':null}));};exports[_0x7e16('0x8')]=function(_0x5d17f3,_0x124916){logger[_0x7e16('0x9')](_0x5d17f3,util[_0x7e16('0xa')](_0x124916,{'showHidden':![],'depth':null}));};exports[_0x7e16('0xb')]=function(_0x58aff1){return function(_0x17f0d7){logger[_0x7e16('0x7')](_0x58aff1,util['inspect'](_0x17f0d7,{'showHidden':![],'depth':null}));};};exports[_0x7e16('0xc')]=function(_0x3969e4,_0x410836,_0x2a3d6d){return{'message':_0x3969e4,'unlock':_0x410836,'active':_0x2a3d6d};};exports[_0x7e16('0xd')]=function(_0x42ab5d,_0x3a26a2,_0x5a00ea){if(!_[_0x7e16('0xe')](_0x5a00ea)&&_0x7e16('0xf')===typeof _0x5a00ea&&!_[_0x7e16('0x10')](_0x5a00ea)){if(!_[_0x7e16('0xe')](_0x3a26a2)&&_0x7e16('0xf')===typeof _0x3a26a2&&!_['isEmpty'](_0x3a26a2)){return util[_0x7e16('0x11')]('\x22%s\x22\x20<%s>',_0x3a26a2,_0x5a00ea);}return util[_0x7e16('0x11')](_0x7e16('0x12'),_0x5a00ea,_0x5a00ea);}if(!_['isUndefined'](_0x42ab5d)&&_0x7e16('0xf')===typeof _0x42ab5d&&!_[_0x7e16('0x10')](_0x42ab5d)){return _0x42ab5d;}return'\x22\x22\x20<>';};exports[_0x7e16('0x13')]=function(_0x3f78ca){if(_[_0x7e16('0x14')](_0x3f78ca)){return![];}return _0x3f78ca;};exports[_0x7e16('0x15')]=function(_0xa49e86,_0x204b5f,_0x464823,_0x5bc690,_0x3a957e,_0x5d4738){var _0x3c82f1={'XMD-QUEUE':_0x204b5f[_0x7e16('0x16')]?_0x204b5f[_0x7e16('0x16')][_0x7e16('0x17')]:'','XMD-CALLERID':_0x5bc690,'XMD-CALLERID-PREVIEW':_0x5d4738?util[_0x7e16('0x11')](_0x7e16('0x12'),_0x5d4738['calleridname'],_0x5d4738[_0x7e16('0x18')]):_0x5bc690,'XMD-DIALID':_0x3a957e,'XMD-CONTACTID':_0x204b5f[_0x7e16('0x19')],'XMD-CDRTYPE':_0x7e16('0x1a'),'CALLERID(all)':_0x5bc690,'XMD-VOICEQUEUEID':_0x204b5f[_0x7e16('0x1b')],'XMD-DIALCHANNEL':_0x464823,'XMD-DIALTIMEOUT':_0xa49e86[_0x7e16('0x1c')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x7e16('0x1d'),_0xa49e86[_0x7e16('0x1e')]?'g':'',_['isEmpty'](_0xa49e86[_0x7e16('0x1f')])?'':_0x7e16('0x20')),'XMD-DIALURL':_0xa49e86[_0x7e16('0x21')]||'','XMD-AGI':_0xa49e86[_0x7e16('0x22')]?util['format'](_0x7e16('0x23'),ipAgi,_0xa49e86[_0x7e16('0x22')]):'NONE','XMD-AGIAFTER':_0xa49e86[_0x7e16('0x1e')]?util['format'](_0x7e16('0x23'),ipAgi,_0xa49e86[_0x7e16('0x1e')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x5d4738?_0x5d4738[_0x7e16('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x5d4738?_0x5d4738['originatecalleridname']:'','XMD-DESTINATION':_0x7e16('0x25'),'SIPADDHEADER':_0x7e16('0x26')};if(!_[_0x7e16('0x10')](_0xa49e86[_0x7e16('0x1f')])){_0x3c82f1[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0xa49e86[_0x7e16('0x1f')];_0x3c82f1[util[_0x7e16('0x11')]('%s',_0x7e16('0x27'))]=_0x3a957e;}return _0x3c82f1;};exports[_0x7e16('0x28')]=function(_0x45df21){var _0x14014e={};for(var _0x35c91a in _0x45df21){if(_0x45df21['hasOwnProperty'](_0x35c91a)){_0x14014e[util[_0x7e16('0x11')]('%s',_[_0x7e16('0x29')](_0x35c91a))]=_0x45df21[_0x35c91a];}}return{'variables':_0x14014e};};exports[_0x7e16('0x2a')]=function(_0x49f8ff){var _0x4631d2=moment()[_0x7e16('0x11')](_0x7e16('0x2b'));_0x49f8ff[_0x7e16('0x2c')]=0xd;_0x49f8ff[_0x7e16('0x2d')]=_0x7e16('0x2e');_0x49f8ff[_0x7e16('0x2f')]=_0x4631d2;_0x49f8ff[_0x7e16('0x30')]=_0x4631d2;_0x49f8ff[_0x7e16('0x31')]=_0x4631d2;};exports[_0x7e16('0x32')]=function(_0x48dd22,_0x1c2232,_0x14603b){var _0x88fc16=moment()[_0x7e16('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x48dd22['state']=_0x1c2232;_0x48dd22[_0x7e16('0x2d')]=_0x14603b;_0x48dd22[_0x7e16('0x30')]=_0x88fc16;_0x48dd22[_0x7e16('0x33')]=utils[_0x7e16('0x34')](_0x48dd22[_0x7e16('0x30')],_0x48dd22[_0x7e16('0x2f')]);};exports[_0x7e16('0x35')]=function(_0x45d3fd,_0x4b4330,_0x5600d1){_0x45d3fd['membername']=_0x4b4330;_0x45d3fd['UserId']=_0x5600d1;};exports[_0x7e16('0x36')]=function(_0xf65f2b,_0x159cfc,_0x1fd607){var _0x2790ed=moment()[_0x7e16('0x11')](_0x7e16('0x2b'));_0xf65f2b[_0x7e16('0x2c')]=_0x159cfc;_0xf65f2b[_0x7e16('0x2d')]=_0x1fd607;_0xf65f2b['responsetime']=_0xf65f2b[_0x7e16('0x30')]?_0xf65f2b[_0x7e16('0x30')]:_0x2790ed;_0xf65f2b['endtime']=_0xf65f2b[_0x7e16('0x31')]?_0xf65f2b['endtime']:_0x2790ed;_0xf65f2b[_0x7e16('0x33')]=utils[_0x7e16('0x34')](_0xf65f2b['responsetime']||0x0,_0xf65f2b[_0x7e16('0x2f')]||0x0);_0xf65f2b[_0x7e16('0x37')]=_0xf65f2b[_0x7e16('0x38')]?utils[_0x7e16('0x34')](_0xf65f2b[_0x7e16('0x31')],_0xf65f2b[_0x7e16('0x38')]):0x0;};exports[_0x7e16('0x39')]=function(_0x6bbb54){return _0x6bbb54===_0x7e16('0x3a');};exports[_0x7e16('0x3b')]=function(_0x43447d,_0x208bb3,_0x378b03,_0x416295,_0x38796d){var _0x2ece34=_0x416295?_0x7e16('0x3c'):_0x43447d['calleridname'];_0x2ece34=_0x38796d?'BOOKED':_0x2ece34;return{'actionid':_0x43447d['uniqueid'],'action':_0x7e16('0x3d'),'channel':_0x43447d[_0x7e16('0x3e')],'callerid':util['format'](_0x7e16('0x12'),_0x2ece34,_0x43447d[_0x7e16('0x18')]),'Exten':_0x7e16('0x25'),'Context':'from-sip','Priority':'1','variable':_0x378b03,'timeout':(_0x208bb3[_0x7e16('0x3f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x43447d[_0x7e16('0x40')]};};exports[_0x7e16('0x41')]=function(_0x1ffcef){return _0x1ffcef['countbusyretry']+_0x1ffcef[_0x7e16('0x42')]+_0x1ffcef['countnoanswerretry']+_0x1ffcef[_0x7e16('0x43')]+_0x1ffcef[_0x7e16('0x44')];};exports[_0x7e16('0x45')]=function(_0x42acb7){var _0x1e0dba=_[_0x7e16('0x46')](_0x42acb7);_0x1e0dba[_0x7e16('0x2c')]=0xf;_0x1e0dba[_0x7e16('0x2d')]=_0x7e16('0x47');return _0x1e0dba;};exports['scheduledAt']=function(_0x4f9161,_0xfa4719,_0x487939){var _0x456e7e={};_0x456e7e[_0xfa4719]=_0x4f9161[_0xfa4719];_0x456e7e[_0x7e16('0x48')]=![];_0x456e7e[_0x7e16('0x49')]=moment()[_0x7e16('0x4a')](_0x487939,_0x7e16('0x4b'))['format'](_0x7e16('0x2b'));_0x456e7e[_0x7e16('0x19')]=_0x4f9161['ContactId'];_0x456e7e['ListId']=_0x4f9161[_0x7e16('0x4c')];_0x456e7e['VoiceQueueId']=_0x4f9161[_0x7e16('0x1b')]||undefined;return _0x456e7e;};exports[_0x7e16('0x4d')]=function(_0x158633,_0xf8800c){if(!_[_0x7e16('0x14')](_0x158633)){if(_0x158633[_0x7e16('0x4e')]>0x0){_0x158633[_0x7e16('0x4e')]-=0x1;}else{logger[_0x7e16('0x7')](_0xf8800c,_0x7e16('0x4f'));}}else{logger[_0x7e16('0x9')](_0xf8800c,_0x7e16('0x50'));}};exports[_0x7e16('0x51')]=function(_0x1731cf){if(_0x1731cf<=0x0){return!![];}return![];};function buildObj(_0x5b7f71,_0x32d6be,_0x5a4c80){_0x5b7f71['lastevent']=_0x32d6be;_0x5b7f71['name']=_0x5b7f71[_0x7e16('0x52')];_0x5b7f71[_0x7e16('0x53')]=_0x5b7f71[_0x7e16('0x3e')];_0x5b7f71[_0x7e16('0x54')]=_0x7e16('0x55');if(_0x5a4c80){_0x5b7f71['mandatoryDisposition']=_0x5a4c80[_0x7e16('0x56')];}return _0x5b7f71;}exports[_0x7e16('0x57')]=buildObj;exports[_0x7e16('0x58')]=function(_0x1a8e63){var _0x523783=[];for(var _0x4b4d9b in _0x1a8e63){if(_0x1a8e63['hasOwnProperty'](_0x4b4d9b)){if(!_[_0x7e16('0x14')](_0x1a8e63[_0x4b4d9b])&&_0x1a8e63[_0x4b4d9b][_0x7e16('0x2c')]==='not_inuse'&&_0x1a8e63[_0x4b4d9b]['status']===_0x7e16('0x59')){_0x523783[_0x7e16('0x5a')](_0x1a8e63[_0x4b4d9b]['id']);}}}return _0x523783;};exports[_0x7e16('0x5b')]=function(_0x150720){var _0x31da22=moment()[_0x7e16('0x5c')](0x0);var _0x421f4b=moment(_0x150720)[_0x7e16('0x5c')](0x0);return _0x31da22[_0x7e16('0x5d')](_0x421f4b,'seconds');};exports['createBody']=function(_0x2882c9){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2882c9[_0x7e16('0x19')],'ListId':_0x2882c9[_0x7e16('0x4c')],'VoiceQueueId':_0x2882c9['VoiceQueueId']||undefined,'CampaignId':_0x2882c9[_0x7e16('0x5e')]||undefined};};exports[_0x7e16('0x5f')]=function(_0x214ab5){if(_0x214ab5==='uniqueid'||_0x214ab5===_0x7e16('0x60')||_0x214ab5===_0x7e16('0x52')||_0x214ab5==='type'||_0x214ab5===_0x7e16('0x61')||_0x214ab5===_0x7e16('0x62')||_0x214ab5===_0x7e16('0x63')||_0x214ab5===_0x7e16('0x3e')||_0x214ab5===_0x7e16('0x64')||_0x214ab5===_0x7e16('0x48')||_0x214ab5==='calleridnum'||_0x214ab5===_0x7e16('0x49')||_0x214ab5===_0x7e16('0x65')||_0x214ab5==='countcongestionretry'||_0x214ab5===_0x7e16('0x66')||_0x214ab5===_0x7e16('0x67')||_0x214ab5===_0x7e16('0x68')||_0x214ab5===_0x7e16('0x69')||_0x214ab5===_0x7e16('0x6a')||_0x214ab5===_0x7e16('0x6b')||_0x214ab5===_0x7e16('0x19')||_0x214ab5===_0x7e16('0x4c')||_0x214ab5===_0x7e16('0x6c')||_0x214ab5===_0x7e16('0x1b')||_0x214ab5===_0x7e16('0x6d')||_0x214ab5===_0x7e16('0x6e')||_0x214ab5===_0x7e16('0x6f')||_0x214ab5===_0x7e16('0x70')||_0x214ab5===_0x7e16('0x71')||_0x214ab5===_0x7e16('0x72')||_0x214ab5===_0x7e16('0x73')||_0x214ab5===_0x7e16('0x74')||_0x214ab5===_0x7e16('0x75')||_0x214ab5===_0x7e16('0x76')||_0x214ab5==='xmd-contactid'||_0x214ab5===_0x7e16('0x77')||_0x214ab5==='xmd-callerid'||_0x214ab5===_0x7e16('0x78')||_0x214ab5===_0x7e16('0x79')||_0x214ab5==='rtpaudioqos'||_0x214ab5===_0x7e16('0x7a')||_0x214ab5==='rtpaudioqosjitter'||_0x214ab5===_0x7e16('0x7b')||_0x214ab5==='rtpaudioqosloss'||_0x214ab5===_0x7e16('0x7c')||_0x214ab5===_0x7e16('0x7d')||_0x214ab5==='rtpaudioqosrttbridged'||_0x214ab5===_0x7e16('0x7e')||_0x214ab5==='rtpaudioqosbridged'||_0x214ab5==='rtpaudioqosjitter'||_0x214ab5==='rtpaudioqosjitterbridged'||_0x214ab5===_0x7e16('0x7f')||_0x214ab5===_0x7e16('0x7c')||_0x214ab5==='rtpaudioqosrtt'||_0x214ab5===_0x7e16('0x80')||_0x214ab5===_0x7e16('0x81')||_0x214ab5===_0x7e16('0x82')||_0x214ab5===_0x7e16('0x2c')||_0x214ab5===_0x7e16('0x2d')){return![];}return!![];};exports[_0x7e16('0x83')]=function(_0x564e6b,_0x7d21b5){var _0x3f0e22,_0x42c9d7,_0x1b1a5a;if(_0x7d21b5<=0x0){_0x7d21b5=0x1;}_0x3f0e22=new RegExp(_0x7e16('0x84')+_0x7d21b5+'}$');_0x42c9d7=Math[_0x7e16('0x85')](0xa,_0x7d21b5-0x1);_0x1b1a5a=Math['pow'](0xa,_0x7d21b5)-0x1;return util['format']('%s',_[_0x7e16('0x86')](_0x564e6b,_0x3f0e22,_['random'](_0x42c9d7,_0x1b1a5a)));};exports[_0x7e16('0x87')]=function(_0x2d0e4b){var _0x1df65b=_0x2d0e4b[_0x7e16('0x88')](/"(.*?)"/);return _0x1df65b?_0x1df65b[0x1]:_0x2d0e4b;};exports[_0x7e16('0x89')]=function(_0x191bb5){var _0x1a4e65=_0x191bb5[_0x7e16('0x88')](/<(.*?)>/);return _0x1a4e65?_0x1a4e65[0x1]:_0x191bb5;};function buildNoAnswerEventPayload(_0x558e09,_0x156465){var _0x4b844e=buildObj(_0x558e09,'noanswer');if(!_[_0x7e16('0x10')](_0x156465['variables'])){Object[_0x7e16('0x8a')](_0x156465[_0x7e16('0x8b')])[_0x7e16('0x8c')](function(_0x5d2b58){_0x4b844e[_0x5d2b58[_0x7e16('0x8d')]()]=_0x156465[_0x7e16('0x8b')][_0x5d2b58];});}return _0x4b844e;}exports[_0x7e16('0x8e')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x50ab=['pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','agentReadyId','status','reachable','push','getDiff','milliseconds','diff','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','membername','scheduledat','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','noanswer','variables','keys','forEach','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','logger','info','inspect','loggerError','logger2','message','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','ringtime','getSeconds','logLookAgent','UserId','logCustomer','endtime','talktime','answertime','variablesAction','RECALL','uniqueid','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','add','ListId','VoiceQueueId','decrementTalking'];(function(_0x44ad29,_0x24c3f7){var _0x311885=function(_0x52d7dd){while(--_0x52d7dd){_0x44ad29['push'](_0x44ad29['shift']());}};_0x311885(++_0x24c3f7);}(_0x50ab,0x1eb));var _0xb50a=function(_0x3f9fef,_0x3577bf){_0x3f9fef=_0x3f9fef-0x0;var _0x4f29c7=_0x50ab[_0x3f9fef];return _0x4f29c7;};'use strict';var util=require(_0xb50a('0x0'));var _=require(_0xb50a('0x1'));var moment=require(_0xb50a('0x2'));var logger=require(_0xb50a('0x3'))('preview');var ipAgi=process[_0xb50a('0x4')][_0xb50a('0x5')]||_0xb50a('0x6');var utils=require('../../dialer/utils');exports[_0xb50a('0x7')]=function(_0x36dfd){return function(_0x4f1360){logger[_0xb50a('0x8')](_0x36dfd,util['inspect'](_0x4f1360,{'showHidden':![],'depth':null}));};};exports[_0xb50a('0x9')]=function(_0x2f97ba,_0x60b6c5){logger[_0xb50a('0xa')](_0x2f97ba,util[_0xb50a('0xb')](_0x60b6c5,{'showHidden':![],'depth':null}));};exports[_0xb50a('0xc')]=function(_0x22fd68,_0x27e5fc){logger[_0xb50a('0x8')](_0x22fd68,util[_0xb50a('0xb')](_0x27e5fc,{'showHidden':![],'depth':null}));};exports[_0xb50a('0xd')]=function(_0x5d6f5c){return function(_0x5c26be){logger[_0xb50a('0xa')](_0x5d6f5c,util[_0xb50a('0xb')](_0x5c26be,{'showHidden':![],'depth':null}));};};exports[_0xb50a('0xe')]=function(_0x5308b3,_0x471fc9,_0x26f772){return{'message':_0x5308b3,'unlock':_0x471fc9,'active':_0x26f772};};exports['getCallerId']=function(_0x4a139b,_0x12031,_0x448236){if(!_['isUndefined'](_0x448236)&&_0xb50a('0xf')===typeof _0x448236&&!_[_0xb50a('0x10')](_0x448236)){if(!_[_0xb50a('0x11')](_0x12031)&&_0xb50a('0xf')===typeof _0x12031&&!_['isEmpty'](_0x12031)){return util[_0xb50a('0x12')](_0xb50a('0x13'),_0x12031,_0x448236);}return util[_0xb50a('0x12')](_0xb50a('0x13'),_0x448236,_0x448236);}if(!_['isUndefined'](_0x4a139b)&&_0xb50a('0xf')===typeof _0x4a139b&&!_['isEmpty'](_0x4a139b)){return _0x4a139b;}return _0xb50a('0x14');};exports[_0xb50a('0x15')]=function(_0x478299){if(_[_0xb50a('0x16')](_0x478299)){return![];}return _0x478299;};exports[_0xb50a('0x17')]=function(_0xee4cef,_0x35c554,_0x3ccf0c,_0x171c22,_0x275ece,_0x56a0d3){var _0x438249={'XMD-QUEUE':_0x35c554['Queue']?_0x35c554[_0xb50a('0x18')][_0xb50a('0x19')]:'','XMD-CALLERID':_0x171c22,'XMD-CALLERID-PREVIEW':_0x56a0d3?util[_0xb50a('0x12')](_0xb50a('0x13'),_0x56a0d3[_0xb50a('0x1a')],_0x56a0d3[_0xb50a('0x1b')]):_0x171c22,'XMD-DIALID':_0x275ece,'XMD-CONTACTID':_0x35c554[_0xb50a('0x1c')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x171c22,'XMD-VOICEQUEUEID':_0x35c554['VoiceQueueId'],'XMD-DIALCHANNEL':_0x3ccf0c,'XMD-DIALTIMEOUT':_0xee4cef['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xb50a('0x12')]('\x22rtTxX%s%s\x22',_0xee4cef[_0xb50a('0x1d')]?'g':'',_['isEmpty'](_0xee4cef['monitor_format'])?'':_0xb50a('0x1e')),'XMD-DIALURL':_0xee4cef[_0xb50a('0x1f')]||'','XMD-AGI':_0xee4cef[_0xb50a('0x20')]?util['format'](_0xb50a('0x21'),ipAgi,_0xee4cef[_0xb50a('0x20')]):'NONE','XMD-AGIAFTER':_0xee4cef[_0xb50a('0x1d')]?util[_0xb50a('0x12')](_0xb50a('0x21'),ipAgi,_0xee4cef[_0xb50a('0x1d')]):_0xb50a('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x56a0d3?_0x56a0d3[_0xb50a('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x56a0d3?_0x56a0d3['originatecalleridname']:'','XMD-DESTINATION':_0xb50a('0x24'),'SIPADDHEADER':_0xb50a('0x25')};if(!_[_0xb50a('0x10')](_0xee4cef[_0xb50a('0x26')])){_0x438249[util['format']('%s',_0xb50a('0x27'))]=_0xee4cef[_0xb50a('0x26')];_0x438249[util[_0xb50a('0x12')]('%s',_0xb50a('0x28'))]=_0x275ece;}return _0x438249;};exports[_0xb50a('0x29')]=function(_0x93ffff){var _0x5fa9b8={};for(var _0x50343d in _0x93ffff){if(_0x93ffff[_0xb50a('0x2a')](_0x50343d)){_0x5fa9b8[util['format']('%s',_[_0xb50a('0x2b')](_0x50343d))]=_0x93ffff[_0x50343d];}}return{'variables':_0x5fa9b8};};exports[_0xb50a('0x2c')]=function(_0x4310e7){var _0x59c51a=moment()[_0xb50a('0x12')](_0xb50a('0x2d'));_0x4310e7[_0xb50a('0x2e')]=0xd;_0x4310e7[_0xb50a('0x2f')]='Blacklist';_0x4310e7[_0xb50a('0x30')]=_0x59c51a;_0x4310e7[_0xb50a('0x31')]=_0x59c51a;_0x4310e7['endtime']=_0x59c51a;};exports['logAgent']=function(_0x229601,_0x237f0c,_0x32f8a6){var _0x5d2396=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x229601[_0xb50a('0x2e')]=_0x237f0c;_0x229601[_0xb50a('0x2f')]=_0x32f8a6;_0x229601['responsetime']=_0x5d2396;_0x229601[_0xb50a('0x32')]=utils[_0xb50a('0x33')](_0x229601[_0xb50a('0x31')],_0x229601['starttime']);};exports[_0xb50a('0x34')]=function(_0xbade32,_0x317e18,_0xe11c65){_0xbade32['membername']=_0x317e18;_0xbade32[_0xb50a('0x35')]=_0xe11c65;};exports[_0xb50a('0x36')]=function(_0x25d80a,_0x4bf1a4,_0x244d15){var _0x3a7ebb=moment()[_0xb50a('0x12')](_0xb50a('0x2d'));_0x25d80a[_0xb50a('0x2e')]=_0x4bf1a4;_0x25d80a['statedesc']=_0x244d15;_0x25d80a[_0xb50a('0x31')]=_0x25d80a[_0xb50a('0x31')]?_0x25d80a[_0xb50a('0x31')]:_0x3a7ebb;_0x25d80a[_0xb50a('0x37')]=_0x25d80a['endtime']?_0x25d80a['endtime']:_0x3a7ebb;_0x25d80a[_0xb50a('0x32')]=utils[_0xb50a('0x33')](_0x25d80a['responsetime']||0x0,_0x25d80a[_0xb50a('0x30')]||0x0);_0x25d80a[_0xb50a('0x38')]=_0x25d80a[_0xb50a('0x39')]?utils[_0xb50a('0x33')](_0x25d80a[_0xb50a('0x37')],_0x25d80a[_0xb50a('0x39')]):0x0;};exports['isFailure']=function(_0x3d08c6){return _0x3d08c6==='Failure';};exports[_0xb50a('0x3a')]=function(_0x5b0429,_0x5c902d,_0x333cac,_0x537e62,_0x45a251){var _0x1cd660=_0x537e62?_0xb50a('0x3b'):_0x5b0429[_0xb50a('0x1a')];_0x1cd660=_0x45a251?'BOOKED':_0x1cd660;return{'actionid':_0x5b0429[_0xb50a('0x3c')],'action':'originate','channel':_0x5b0429[_0xb50a('0x3d')],'callerid':util[_0xb50a('0x12')](_0xb50a('0x13'),_0x1cd660,_0x5b0429['calleridnum']),'Exten':_0xb50a('0x24'),'Context':_0xb50a('0x3e'),'Priority':'1','variable':_0x333cac,'timeout':(_0x5c902d[_0xb50a('0x3f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5b0429[_0xb50a('0x3c')]};};exports[_0xb50a('0x40')]=function(_0x4a1dca){return _0x4a1dca[_0xb50a('0x41')]+_0x4a1dca[_0xb50a('0x42')]+_0x4a1dca[_0xb50a('0x43')]+_0x4a1dca['countagentrejectretry']+_0x4a1dca['countnosuchnumberretry'];};exports[_0xb50a('0x44')]=function(_0x12d6b3){var _0x52d340=_[_0xb50a('0x45')](_0x12d6b3);_0x52d340[_0xb50a('0x2e')]=0xf;_0x52d340[_0xb50a('0x2f')]=_0xb50a('0x46');return _0x52d340;};exports[_0xb50a('0x47')]=function(_0x2280fe,_0x25ff25,_0x5b5417){var _0x4cec87={};_0x4cec87[_0x25ff25]=_0x2280fe[_0x25ff25];_0x4cec87[_0xb50a('0x48')]=![];_0x4cec87['scheduledat']=moment()[_0xb50a('0x49')](_0x5b5417,'minutes')[_0xb50a('0x12')](_0xb50a('0x2d'));_0x4cec87['ContactId']=_0x2280fe['ContactId'];_0x4cec87[_0xb50a('0x4a')]=_0x2280fe[_0xb50a('0x4a')];_0x4cec87['VoiceQueueId']=_0x2280fe[_0xb50a('0x4b')]||undefined;return _0x4cec87;};exports[_0xb50a('0x4c')]=function(_0x4b7408,_0x20ff41){if(!_['isNil'](_0x4b7408)){if(_0x4b7408['pTalking']>0x0){_0x4b7408[_0xb50a('0x4d')]-=0x1;}else{logger['info'](_0x20ff41,_0xb50a('0x4e'));}}else{logger['error'](_0x20ff41,_0xb50a('0x4f'));}};exports[_0xb50a('0x50')]=function(_0x1a5282){if(_0x1a5282<=0x0){return!![];}return![];};function buildObj(_0x327fe8,_0xebdc3d,_0x6065b8){_0x327fe8[_0xb50a('0x51')]=_0xebdc3d;_0x327fe8[_0xb50a('0x19')]=_0x327fe8[_0xb50a('0x52')];_0x327fe8[_0xb50a('0x53')]=_0x327fe8['channelAgent'];_0x327fe8[_0xb50a('0x54')]=_0xb50a('0x55');if(_0x6065b8){_0x327fe8[_0xb50a('0x56')]=_0x6065b8[_0xb50a('0x56')];}return _0x327fe8;}exports['buildObj']=buildObj;exports[_0xb50a('0x57')]=function(_0xb94726){var _0x164a43=[];for(var _0x29e03e in _0xb94726){if(_0xb94726[_0xb50a('0x2a')](_0x29e03e)){if(!_[_0xb50a('0x16')](_0xb94726[_0x29e03e])&&_0xb94726[_0x29e03e]['state']==='not_inuse'&&_0xb94726[_0x29e03e][_0xb50a('0x58')]===_0xb50a('0x59')){_0x164a43[_0xb50a('0x5a')](_0xb94726[_0x29e03e]['id']);}}}return _0x164a43;};exports[_0xb50a('0x5b')]=function(_0x43ae63){var _0x139993=moment()[_0xb50a('0x5c')](0x0);var _0x161635=moment(_0x43ae63)[_0xb50a('0x5c')](0x0);return _0x139993[_0xb50a('0x5d')](_0x161635,'seconds');};exports[_0xb50a('0x5e')]=function(_0x380f7a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x380f7a[_0xb50a('0x1c')],'ListId':_0x380f7a[_0xb50a('0x4a')],'VoiceQueueId':_0x380f7a[_0xb50a('0x4b')]||undefined,'CampaignId':_0x380f7a[_0xb50a('0x5f')]||undefined};};exports[_0xb50a('0x60')]=function(_0x5a7606){if(_0x5a7606==='uniqueid'||_0x5a7606===_0xb50a('0x61')||_0x5a7606===_0xb50a('0x52')||_0x5a7606==='type'||_0x5a7606===_0xb50a('0x62')||_0x5a7606===_0xb50a('0x63')||_0x5a7606===_0xb50a('0x64')||_0x5a7606==='channelAgent'||_0x5a7606===_0xb50a('0x1a')||_0x5a7606===_0xb50a('0x48')||_0x5a7606===_0xb50a('0x1b')||_0x5a7606===_0xb50a('0x65')||_0x5a7606===_0xb50a('0x41')||_0x5a7606==='countcongestionretry'||_0x5a7606==='countnoanswerretry'||_0x5a7606===_0xb50a('0x66')||_0x5a7606===_0xb50a('0x67')||_0x5a7606===_0xb50a('0x68')||_0x5a7606===_0xb50a('0x69')||_0x5a7606===_0xb50a('0x6a')||_0x5a7606===_0xb50a('0x1c')||_0x5a7606===_0xb50a('0x4a')||_0x5a7606===_0xb50a('0x35')||_0x5a7606===_0xb50a('0x4b')||_0x5a7606==='sipcallid'||_0x5a7606===_0xb50a('0x6b')||_0x5a7606===_0xb50a('0x6c')||_0x5a7606===_0xb50a('0x6d')||_0x5a7606===_0xb50a('0x6e')||_0x5a7606===_0xb50a('0x6f')||_0x5a7606===_0xb50a('0x70')||_0x5a7606===_0xb50a('0x71')||_0x5a7606===_0xb50a('0x72')||_0x5a7606===_0xb50a('0x73')||_0x5a7606===_0xb50a('0x74')||_0x5a7606===_0xb50a('0x75')||_0x5a7606===_0xb50a('0x76')||_0x5a7606===_0xb50a('0x77')||_0x5a7606===_0xb50a('0x78')||_0x5a7606===_0xb50a('0x79')||_0x5a7606===_0xb50a('0x7a')||_0x5a7606===_0xb50a('0x7b')||_0x5a7606==='rtpaudioqosjitterbridged'||_0x5a7606===_0xb50a('0x7c')||_0x5a7606===_0xb50a('0x7d')||_0x5a7606==='rtpaudioqosrtt'||_0x5a7606==='rtpaudioqosrttbridged'||_0x5a7606===_0xb50a('0x79')||_0x5a7606==='rtpaudioqosbridged'||_0x5a7606==='rtpaudioqosjitter'||_0x5a7606===_0xb50a('0x7e')||_0x5a7606===_0xb50a('0x7c')||_0x5a7606===_0xb50a('0x7d')||_0x5a7606===_0xb50a('0x7f')||_0x5a7606===_0xb50a('0x80')||_0x5a7606===_0xb50a('0x81')||_0x5a7606===_0xb50a('0x82')||_0x5a7606===_0xb50a('0x2e')||_0x5a7606===_0xb50a('0x2f')){return![];}return!![];};exports[_0xb50a('0x83')]=function(_0xbb237e,_0x5639b6){var _0x428fa1,_0x1b5853,_0x24a743;if(_0x5639b6<=0x0){_0x5639b6=0x1;}_0x428fa1=new RegExp(_0xb50a('0x84')+_0x5639b6+'}$');_0x1b5853=Math['pow'](0xa,_0x5639b6-0x1);_0x24a743=Math[_0xb50a('0x85')](0xa,_0x5639b6)-0x1;return util[_0xb50a('0x12')]('%s',_[_0xb50a('0x86')](_0xbb237e,_0x428fa1,_[_0xb50a('0x87')](_0x1b5853,_0x24a743)));};exports['extractCalleridName']=function(_0x5da9b5){var _0x527485=_0x5da9b5[_0xb50a('0x88')](/"(.*?)"/);return _0x527485?_0x527485[0x1]:_0x5da9b5;};exports['extractCalleridNumber']=function(_0x4945e0){var _0x57525c=_0x4945e0['match'](/<(.*?)>/);return _0x57525c?_0x57525c[0x1]:_0x4945e0;};function buildNoAnswerEventPayload(_0x3b7e53,_0x44524e){var _0x97f1ad=buildObj(_0x3b7e53,_0xb50a('0x89'));if(!_['isEmpty'](_0x44524e[_0xb50a('0x8a')])){Object[_0xb50a('0x8b')](_0x44524e['variables'])[_0xb50a('0x8c')](function(_0x4be676){_0x97f1ad[_0x4be676['toLowerCase']()]=_0x44524e[_0xb50a('0x8a')][_0x4be676];});}return _0x97f1ad;}exports[_0xb50a('0x8d')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index e52a471..63df2be 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 _0xe47f=['voicequeuechannelredirect','queueadd','string','number','queueremove','queuepause','boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x3ea29e,_0x82b54b){var _0xafdea8=function(_0x5752b7){while(--_0x5752b7){_0x3ea29e['push'](_0x3ea29e['shift']());}};_0xafdea8(++_0x82b54b);}(_0xe47f,0x1a3));var _0xfe47=function(_0x1e5db8,_0x44ef41){_0x1e5db8=_0x1e5db8-0x0;var _0x219a51=_0xe47f[_0x1e5db8];return _0x219a51;};'use strict';exports[_0xfe47('0x0')]={'queue':{'type':_0xfe47('0x1'),'required':!![]},'interface':{'type':_0xfe47('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xfe47('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xfe47('0x3')]={'queue':{'type':_0xfe47('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xfe47('0x4')]={'interface':{'type':_0xfe47('0x1'),'required':!![]},'paused':{'type':_0xfe47('0x5')},'reason':{'type':_0xfe47('0x1'),'required':![]}};exports[_0xfe47('0x6')]={'module':{'type':_0xfe47('0x1'),'required':![]}};exports[_0xfe47('0x7')]={'uniqueid':{'type':_0xfe47('0x1'),'required':!![]}};exports[_0xfe47('0x8')]={'uniqueid':{'type':_0xfe47('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xfe47('0x1')},'mixmonitorid':{'type':'string'}};exports[_0xfe47('0x9')]={'uniqueid':{'type':_0xfe47('0x1'),'required':!![]}};exports[_0xfe47('0xa')]={'uniqueid':{'type':_0xfe47('0x1'),'required':!![]},'exten':{'type':_0xfe47('0x1'),'required':!![]},'context':{'type':_0xfe47('0x1')}}; \ No newline at end of file +var _0xe244=['queueadd','string','boolean','queueremove','queuepause','reload','voicequeuechannel'];(function(_0x83ad74,_0x51caeb){var _0x233894=function(_0x473549){while(--_0x473549){_0x83ad74['push'](_0x83ad74['shift']());}};_0x233894(++_0x51caeb);}(_0xe244,0x1ea));var _0x4e24=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xe244[_0xbca1b1];return _0x4e1686;};'use strict';exports[_0x4e24('0x0')]={'queue':{'type':_0x4e24('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x4e24('0x2'),'required':![]}};exports[_0x4e24('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x4e24('0x1'),'required':!![]}};exports[_0x4e24('0x4')]={'interface':{'type':_0x4e24('0x1'),'required':!![]},'paused':{'type':_0x4e24('0x2')},'reason':{'type':_0x4e24('0x1'),'required':![]}};exports[_0x4e24('0x5')]={'module':{'type':_0x4e24('0x1'),'required':![]}};exports[_0x4e24('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x4e24('0x1')},'format':{'type':_0x4e24('0x1')},'mixmonitorid':{'type':_0x4e24('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x4e24('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','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 d3ca3d8..75765bc 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 _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x0b0e,0x187));var _0xe0b0=function(_0xf4d05,_0x5e601f){_0xf4d05=_0xf4d05-0x0;var _0x47c971=_0x0b0e[_0xf4d05];return _0x47c971;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file +var _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x80ca76,_0x12de88){var _0x57e984=function(_0x56afd8){while(--_0x56afd8){_0x80ca76['push'](_0x80ca76['shift']());}};_0x57e984(++_0x12de88);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 06be5c1..6afc3cc 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0da6=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x1697c6,_0xb3c877){var _0x5c92f8=function(_0x1f889f){while(--_0x1f889f){_0x1697c6['push'](_0x1697c6['shift']());}};_0x5c92f8(++_0xb3c877);}(_0x0da6,0x1bf));var _0x60da=function(_0x46f69c,_0x40214a){_0x46f69c=_0x46f69c-0x0;var _0x91ae63=_0x0da6[_0x46f69c];return _0x91ae63;};'use strict';function mergeDBDataToRealtime(_0x286ee1,_0x2b61da){var _0xf93842=Object[_0x60da('0x0')]({},_0x286ee1);for(var _0x51dc7f in _0x2b61da){if(_0xf93842[_0x60da('0x1')](_0x51dc7f)){_0xf93842[_0x51dc7f]=_0x2b61da[_0x51dc7f];}}return _0xf93842;}exports[_0x60da('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xa701=['assign','hasOwnProperty'];(function(_0x398890,_0xaeae6){var _0x39aa7c=function(_0xfc30c8){while(--_0xfc30c8){_0x398890['push'](_0x398890['shift']());}};_0x39aa7c(++_0xaeae6);}(_0xa701,0x1d4));var _0x1a70=function(_0x1e9f47,_0x5950eb){_0x1e9f47=_0x1e9f47-0x0;var _0x5d46d2=_0xa701[_0x1e9f47];return _0x5d46d2;};'use strict';function mergeDBDataToRealtime(_0x3550a9,_0x110e53){var _0x1d8619=Object[_0x1a70('0x0')]({},_0x3550a9);for(var _0x2d2ad8 in _0x110e53){if(_0x1d8619[_0x1a70('0x1')](_0x2d2ad8)){_0x1d8619[_0x2d2ad8]=_0x110e53[_0x2d2ad8];}}return _0x1d8619;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 71c54a8..06d9401 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 _0x1f13=['attendedTransfer','lodash','util','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','find','accountcode','isNil','name','interface','format','SIP/%s','length','connectedlinenum','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','getAgentByInternal','keys','getCallType','calleridnum','outbound','voiceCallReport','destination','exten','dialer','lastapplication','queue','lastdata','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','split','UserId','membername','monitor','monitorFilename','monitors','createdAt','connectedlinename','xcally-motion-dialer','forEach','startsWith','Local','indexOf','lastIndexOf','transfererlinkedid'];(function(_0x23b926,_0x410615){var _0x5a5ce5=function(_0x5a47ec){while(--_0x5a47ec){_0x23b926['push'](_0x23b926['shift']());}};_0x5a5ce5(++_0x410615);}(_0x1f13,0x15d));var _0x31f1=function(_0x30cb8d,_0x55f278){_0x30cb8d=_0x30cb8d-0x0;var _0x5b2aa7=_0x1f13[_0x30cb8d];return _0x5b2aa7;};'use strict';var _=require(_0x31f1('0x0'));var moment=require('moment');var util=require(_0x31f1('0x1'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x31f1('0x2'));var RpcVoiceCallReport=require(_0x31f1('0x3'));var RpcVoiceDialReport=require(_0x31f1('0x4'));var RpcMemberReport=require(_0x31f1('0x5'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x31f1('0x6'));var VoiceQueueReport=require(_0x31f1('0x7'));var VoiceCallReport=require(_0x31f1('0x8'));var VoiceAgentReport=require(_0x31f1('0x9'));var VoiceDialReport=require(_0x31f1('0xa'));var UserReport=require(_0x31f1('0xb'));function Report(_0x1884a2){this[_0x31f1('0xc')]=_0x1884a2;this[_0x31f1('0xd')]=_0x1884a2[_0x31f1('0xd')];this[_0x31f1('0xe')]=_0x1884a2[_0x31f1('0xe')];}Report[_0x31f1('0xf')]['sync']=function(_0x480a93){var _0x583684=new VoiceQueueReport(this['realtime']);var _0x4773c5=new VoiceAgentReport(this[_0x31f1('0xc')]);var _0x1a0d21=new VoiceDialReport(this[_0x31f1('0xc')]);var _0xb6d0d2=new VoiceCallReport(this[_0x31f1('0xc')]);var _0x52099b=new UserReport(this[_0x31f1('0xc')]);if(config['xdr']&&config[_0x31f1('0x10')][_0x31f1('0x11')]){ami['on'](_0x31f1('0x12'),this[_0x31f1('0x13')][_0x31f1('0x14')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0x31f1('0x14')](this));ami['on']('custom:voiceAgentReport',this[_0x31f1('0x15')]['bind'](this));ami['on'](_0x31f1('0x16'),this[_0x31f1('0x17')]['bind'](this));ami['on'](_0x31f1('0x18'),this[_0x31f1('0x19')][_0x31f1('0x14')](this));ami['on'](_0x31f1('0x1a'),this['attendedTransfer'][_0x31f1('0x14')](this));}};Report[_0x31f1('0xf')][_0x31f1('0x1b')]=function(_0x4887f8){var _0x3ce323;_0x3ce323=_[_0x31f1('0x1c')](this[_0x31f1('0xd')],function(_0x45376b){return _0x45376b[_0x31f1('0x1d')]==_0x4887f8||_0x45376b['name']==_0x4887f8;});if(_[_0x31f1('0x1e')](_0x3ce323)){var _0xeba657=_[_0x31f1('0x1c')](this['telephones'],function(_0x544779){return _0x544779['accountcode']==_0x4887f8||_0x544779[_0x31f1('0x1f')]==_0x4887f8;});if(_0xeba657){_0x3ce323=_['find'](this[_0x31f1('0xd')],function(_0x395e0c){return _0x395e0c[_0x31f1('0x20')]==util[_0x31f1('0x21')](_0x31f1('0x22'),_0xeba657[_0x31f1('0x1f')]);});}}return _0x3ce323;};Report[_0x31f1('0xf')]['voiceQueueReport']=function(_0x45dc44){for(var _0x2f42af=0x0;_0x2f42af<_0x45dc44[_0x31f1('0x23')];_0x2f42af+=0x1){var _0x3d3626=this[_0x31f1('0x1b')](_0x45dc44[_0x2f42af][_0x31f1('0x24')]);if(_0x3d3626){_0x45dc44[_0x2f42af][_0x31f1('0x1d')]=_0x3d3626[_0x31f1('0x1d')];_0x45dc44[_0x2f42af]['assigned']=!![];_0x45dc44[_0x2f42af][_0x31f1('0x25')]=_0x3d3626['name'];_0x45dc44[_0x2f42af][_0x31f1('0x20')]=_[_0x31f1('0x1e')](_0x3d3626[_0x31f1('0x20')])?util[_0x31f1('0x21')](_0x31f1('0x22'),_0x3d3626['name']):_0x3d3626['interface'];if(_0x45dc44[_0x2f42af][_0x31f1('0x26')]){_0x45dc44[_0x2f42af][_0x31f1('0x27')]=moment()[_0x31f1('0x21')](_0x31f1('0x28'));}if(_0x45dc44[_0x2f42af][_0x31f1('0x29')]){_0x45dc44[_0x2f42af]['queuecallerexitAt']=moment()['format'](_0x31f1('0x28'));}RpcMemberReport[_0x31f1('0x13')](_0x45dc44[_0x2f42af]);}RpcVoiceQueueReport[_0x31f1('0x2a')](_0x45dc44[_0x2f42af]);}};function extractCalleridNumber(_0x1c44f8){var _0x11d3b4=_0x1c44f8['match'](/<(.*?)>/);return _0x11d3b4?_0x11d3b4[0x1]:_0x1c44f8;}Report['prototype'][_0x31f1('0x2b')]=function(_0x393768){for(var _0x5e051=0x0;_0x5e051','calleridname','transfers','linkedid','transfereelinkedid','split','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','isArray','forEach','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','lodash','moment','util','../../../config/environment','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','prototype','find','accountcode','name','isNil','interface','format','SIP/%s','length','findAgent','lastAssignedTo','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','calleridnum','outbound','internal','exten','type','dialer','lastapplication','queue','lastdata','context'];(function(_0x23603,_0x281eee){var _0x2357a1=function(_0x265b78){while(--_0x265b78){_0x23603['push'](_0x23603['shift']());}};_0x2357a1(++_0x281eee);}(_0x68f0,0x131));var _0x068f=function(_0x27e2bc,_0x1f5bb1){_0x27e2bc=_0x27e2bc-0x0;var _0x303eed=_0x68f0[_0x27e2bc];return _0x303eed;};'use strict';var _=require(_0x068f('0x0'));var moment=require(_0x068f('0x1'));var util=require(_0x068f('0x2'));var config=require(_0x068f('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x068f('0x4'));var RpcVoiceDialReport=require(_0x068f('0x5'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x068f('0x6'));var RpcVoiceTransferReport=require(_0x068f('0x7'));var VoiceQueueReport=require(_0x068f('0x8'));var VoiceCallReport=require(_0x068f('0x9'));var VoiceAgentReport=require(_0x068f('0xa'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x068f('0xb'));function Report(_0x2c627c){this[_0x068f('0xc')]=_0x2c627c;this['agents']=_0x2c627c[_0x068f('0xd')];this[_0x068f('0xe')]=_0x2c627c[_0x068f('0xe')];}Report['prototype']['sync']=function(_0x318a18){var _0x26e9aa=new VoiceQueueReport(this[_0x068f('0xc')]);var _0x3d79f6=new VoiceAgentReport(this[_0x068f('0xc')]);var _0x24b436=new VoiceDialReport(this[_0x068f('0xc')]);var _0x48312e=new VoiceCallReport(this[_0x068f('0xc')]);var _0x1e3fcc=new UserReport(this[_0x068f('0xc')]);if(config[_0x068f('0xf')]&&config['xdr'][_0x068f('0x10')]){ami['on'](_0x068f('0x11'),this[_0x068f('0x12')][_0x068f('0x13')](this));ami['on'](_0x068f('0x14'),this['voiceCallReport'][_0x068f('0x13')](this));ami['on'](_0x068f('0x15'),this[_0x068f('0x16')][_0x068f('0x13')](this));ami['on'](_0x068f('0x17'),this[_0x068f('0x18')][_0x068f('0x13')](this));ami['on'](_0x068f('0x19'),this[_0x068f('0x1a')][_0x068f('0x13')](this));ami['on']('attendedtransfer',this[_0x068f('0x1b')][_0x068f('0x13')](this));}};Report[_0x068f('0x1c')]['findAgent']=function(_0x257bc7){var _0x4ff0f9;_0x4ff0f9=_[_0x068f('0x1d')](this[_0x068f('0xd')],function(_0x27a2de){return _0x27a2de[_0x068f('0x1e')]==_0x257bc7||_0x27a2de[_0x068f('0x1f')]==_0x257bc7;});if(_[_0x068f('0x20')](_0x4ff0f9)){var _0x1413d7=_['find'](this[_0x068f('0xe')],function(_0x3d3a87){return _0x3d3a87[_0x068f('0x1e')]==_0x257bc7||_0x3d3a87[_0x068f('0x1f')]==_0x257bc7;});if(_0x1413d7){_0x4ff0f9=_['find'](this[_0x068f('0xd')],function(_0x4cc3dd){return _0x4cc3dd[_0x068f('0x21')]==util[_0x068f('0x22')](_0x068f('0x23'),_0x1413d7['name']);});}}return _0x4ff0f9;};Report['prototype'][_0x068f('0x12')]=function(_0x3af8da){for(var _0x34d263=0x0;_0x34d263<_0x3af8da[_0x068f('0x24')];_0x34d263+=0x1){var _0x48d6b6=this[_0x068f('0x25')](_0x3af8da[_0x34d263]['connectedlinenum']);if(_0x48d6b6){_0x3af8da[_0x34d263][_0x068f('0x1e')]=_0x48d6b6[_0x068f('0x1e')];_0x3af8da[_0x34d263]['assigned']=!![];_0x3af8da[_0x34d263][_0x068f('0x26')]=_0x48d6b6[_0x068f('0x1f')];_0x3af8da[_0x34d263][_0x068f('0x21')]=_[_0x068f('0x20')](_0x48d6b6['interface'])?util[_0x068f('0x22')](_0x068f('0x23'),_0x48d6b6[_0x068f('0x1f')]):_0x48d6b6[_0x068f('0x21')];if(_0x3af8da[_0x34d263]['queuecallercomplete']){_0x3af8da[_0x34d263][_0x068f('0x27')]=moment()[_0x068f('0x22')](_0x068f('0x28'));}if(_0x3af8da[_0x34d263][_0x068f('0x29')]){_0x3af8da[_0x34d263][_0x068f('0x2a')]=moment()[_0x068f('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x068f('0x12')](_0x3af8da[_0x34d263]);}RpcVoiceQueueReport[_0x068f('0x2b')](_0x3af8da[_0x34d263]);}};function extractCalleridNumber(_0x3cada8){var _0x4cfb8d=_0x3cada8[_0x068f('0x2c')](/<(.*?)>/);return _0x4cfb8d?_0x4cfb8d[0x1]:_0x3cada8;}Report['prototype'][_0x068f('0x2d')]=function(_0x11f0aa){for(var _0x3636ed=0x0;_0x3636ed{delete this[_0x9f11('0x9')][_0x52a627];},_0x904296);}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x508b=['musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','info','membername','destuniqueid','debug','inspect','uniqueid','interface','queue','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','inbound','voice','assign','event','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connectedlinenum','destchannelstate','holdtime','lastevent','merge','pick','destconnectedlinenum','name','accountcode','exten','user:agentconnect','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','agentacw','omit','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','value','variable','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','syncHangup','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','custom:voiceAgentReport','deleteChannelAfterTimeout','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','diff','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentconnectAt','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','moment','ioredis','ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','syncAgentCalled','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','bind','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','varset','syncVarSet','hangup','musiconholdstart','syncMusicOnHoldStart'];(function(_0x5db0ef,_0x5a6459){var _0x514e1e=function(_0x3da188){while(--_0x3da188){_0x5db0ef['push'](_0x5db0ef['shift']());}};_0x514e1e(++_0x5a6459);}(_0x508b,0x1c1));var _0xb508=function(_0x1c5db9,_0x2ec26d){_0x1c5db9=_0x1c5db9-0x0;var _0x34ebeb=_0x508b[_0x1c5db9];return _0x34ebeb;};'use strict';var _=require('lodash');var moment=require(_0xb508('0x0'));var util=require('util');var Redis=require(_0xb508('0x1'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xb508('0x2'));var ami=require('../ami');config[_0xb508('0x3')]=_[_0xb508('0x4')](config[_0xb508('0x3')],{'host':_0xb508('0x5'),'port':0x18eb});var io=require(_0xb508('0x6'))(new Redis(config[_0xb508('0x3')]));function VoiceAgentReport(_0x49ff1d){this['channels']={};this['voiceChannels']=_0x49ff1d[_0xb508('0x7')];this[_0xb508('0x8')]=_0x49ff1d['voiceQueues'];this[_0xb508('0x9')]=_0x49ff1d[_0xb508('0x9')];this[_0xb508('0xa')]={};ami['on']('agentcalled',this[_0xb508('0xb')]['bind'](this));ami['on'](_0xb508('0xc'),this[_0xb508('0xd')]['bind'](this));ami['on'](_0xb508('0xe'),this[_0xb508('0xf')][_0xb508('0x10')](this));ami['on'](_0xb508('0x11'),this[_0xb508('0x12')][_0xb508('0x10')](this));ami['on']('agentcomplete',this[_0xb508('0x13')][_0xb508('0x10')](this));ami['on'](_0xb508('0x14'),this[_0xb508('0x15')][_0xb508('0x10')](this));ami['on'](_0xb508('0x16'),this['syncHangup'][_0xb508('0x10')](this));ami['on'](_0xb508('0x17'),this[_0xb508('0x18')]['bind'](this));ami['on'](_0xb508('0x19'),this[_0xb508('0x1a')]['bind'](this));ami['on'](_0xb508('0x1b'),this[_0xb508('0x1c')]['bind'](this));ami['on'](_0xb508('0x1d'),this[_0xb508('0x1e')]['bind'](this));}VoiceAgentReport['prototype'][_0xb508('0x1f')]=function(_0x2ef2db,_0x3b4276,_0x23008c){io['to'](_0x2ef2db)[_0xb508('0x1f')](_0x3b4276,_0x23008c);};VoiceAgentReport[_0xb508('0x20')][_0xb508('0x21')]=function(_0x520974){return _0x520974!==null&&!_[_0xb508('0x22')](_0x520974);};VoiceAgentReport[_0xb508('0x20')]['syncAgentCalled']=function(_0xaa78ac){try{if(this[_0xb508('0x21')](_0xaa78ac)){logger[_0xb508('0x23')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0xaa78ac['uniqueid'],_0xaa78ac[_0xb508('0x24')],_0xaa78ac[_0xb508('0x25')]);logger[_0xb508('0x26')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0xaa78ac['uniqueid'],util[_0xb508('0x27')](_0xaa78ac,{'showHidden':![],'depth':null}));if(_[_0xb508('0x22')](this['channels'][_0xaa78ac[_0xb508('0x28')]])){this[_0xb508('0x7')][_0xaa78ac['uniqueid']]={};}var _0x38cba1=this['agents'][_0xaa78ac[_0xb508('0x29')]];var _0x24a76d=this['channels'][_0xaa78ac['uniqueid']][_0xaa78ac[_0xb508('0x25')]];var _0x2d1266=this['voiceQueues'][_0xaa78ac[_0xb508('0x2a')]];var _0xfe79b1=this[_0xb508('0xa')][_0xaa78ac['uniqueid']];if(_[_0xb508('0x22')](_0x24a76d)){_0x24a76d={'agentcalledAt':moment()[_0xb508('0x2b')](_0xb508('0x2c')),'lastevent':_0xb508('0x2d'),'mandatoryDisposition':_0x2d1266&&_0x2d1266[_0xb508('0x2e')]?_0x2d1266['mandatoryDisposition']:![],'type':_0x2d1266&&_0x2d1266['type']?_0x2d1266['type']:_0xb508('0x2f'),'variables':_0xfe79b1,'motionChannel':_0xb508('0x30')};}Object[_0xb508('0x31')](_0x24a76d,_['omit'](_0xaa78ac,[_0xb508('0x32'),'privilege']));this[_0xb508('0x7')][_0xaa78ac[_0xb508('0x28')]][_0xaa78ac[_0xb508('0x25')]]=_0x24a76d;logger[_0xb508('0x26')](_0xb508('0x33'),_0xaa78ac[_0xb508('0x28')],util[_0xb508('0x27')](_0x24a76d,{'showHidden':![],'depth':null}));ami[_0xb508('0x1f')](_0xb508('0x34'),_0x24a76d);var _0x4c2da6={'id':_0x38cba1['id'],'calleridnum':_0x24a76d[_0xb508('0x35')],'queue':_0x24a76d[_0xb508('0x2a')],'variables':_0x24a76d[_0xb508('0xa')],'uniqueid':_0xaa78ac[_0xb508('0x28')]};logger[_0xb508('0x26')](_0xb508('0x36'),_0xaa78ac[_0xb508('0x28')],util[_0xb508('0x27')](_0x4c2da6,{'showHidden':![],'depth':null}));this[_0xb508('0x1f')](util[_0xb508('0x2b')](_0xb508('0x37'),_0xaa78ac['membername']),_0xb508('0x38'),_0x4c2da6);}}catch(_0x1f9c01){logger[_0xb508('0x39')](_0xb508('0x3a'),_0xaa78ac[_0xb508('0x28')],util['inspect'](_0x1f9c01,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb508('0x20')][_0xb508('0xd')]=function(_0x489eb7){try{if(this['isNotNull'](_0x489eb7)){if(this[_0xb508('0x7')][_0x489eb7[_0xb508('0x28')]]){for(var _0x497885 in this[_0xb508('0x7')][_0x489eb7[_0xb508('0x28')]]){if(this['channels'][_0x489eb7[_0xb508('0x28')]][_0xb508('0x3b')](_0x497885)){if(_0x489eb7[_0xb508('0x25')]===_0x497885){logger['info'](_0xb508('0x3c'),_0x489eb7['uniqueid'],_0x489eb7[_0xb508('0x24')],_0x489eb7['destuniqueid']);this[_0xb508('0x7')][_0x489eb7[_0xb508('0x28')]][_0x497885]['agentconnectAt']=moment()[_0xb508('0x2b')](_0xb508('0x2c'));this['channels'][_0x489eb7[_0xb508('0x28')]][_0x497885][_0xb508('0x3d')]=_0x489eb7[_0xb508('0x3d')];this[_0xb508('0x7')][_0x489eb7[_0xb508('0x28')]][_0x497885][_0xb508('0x3e')]=_0x489eb7[_0xb508('0x3e')];this[_0xb508('0x7')][_0x489eb7[_0xb508('0x28')]][_0x497885]['destchannelstate']=_0x489eb7[_0xb508('0x3f')];this[_0xb508('0x7')][_0x489eb7['uniqueid']][_0x497885]['destchannelstatedesc']=_0x489eb7['destchannelstatedesc'];this[_0xb508('0x7')][_0x489eb7['uniqueid']][_0x497885][_0xb508('0x40')]=_0x489eb7[_0xb508('0x40')];this[_0xb508('0x7')][_0x489eb7[_0xb508('0x28')]][_0x497885][_0xb508('0x41')]='connect';_[_0xb508('0x42')](this[_0xb508('0x9')][_0x489eb7[_0xb508('0x29')]],_[_0xb508('0x43')](_0x489eb7,['queue',_0xb508('0x44')]));var _0x1636bb=this[_0xb508('0x9')][_0x489eb7[_0xb508('0x29')]];var _0x8b494b={'id':_0x1636bb['id'],'name':_0x1636bb[_0xb508('0x45')],'agentconnected':!![],'destaccountcode':_0x1636bb[_0xb508('0x46')],'destconnectedlinenum':this[_0xb508('0x7')][_0x489eb7[_0xb508('0x28')]][_0x489eb7[_0xb508('0x25')]][_0xb508('0x47')],'queue':this[_0xb508('0x7')][_0x489eb7['uniqueid']][_0x489eb7[_0xb508('0x25')]][_0xb508('0x2a')],'uniqueid':this[_0xb508('0x7')][_0x489eb7[_0xb508('0x28')]][_0x489eb7[_0xb508('0x25')]][_0xb508('0x28')]};ami[_0xb508('0x1f')]('custom:agentconnect',this[_0xb508('0x7')][_0x489eb7[_0xb508('0x28')]][_0x489eb7[_0xb508('0x25')]]);this[_0xb508('0x1f')](util[_0xb508('0x2b')](_0xb508('0x37'),_0x489eb7[_0xb508('0x24')]),_0xb508('0x48'),_0x8b494b);}else if(!this[_0xb508('0x7')][_0x489eb7[_0xb508('0x28')]][_0x497885][_0xb508('0xe')]&&!this['channels'][_0x489eb7[_0xb508('0x28')]][_0x497885][_0xb508('0x49')]){logger[_0xb508('0x23')](_0xb508('0x4a'),_0x489eb7['uniqueid'],this['channels'][_0x489eb7['uniqueid']][_0x497885]['membername'],_0x497885);this[_0xb508('0x7')][_0x489eb7[_0xb508('0x28')]][_0x497885]['agentringnoanswer']=!![];this['channels'][_0x489eb7[_0xb508('0x28')]][_0x497885][_0xb508('0x4b')]=moment()[_0xb508('0x2b')](_0xb508('0x2c'));this[_0xb508('0x7')][_0x489eb7[_0xb508('0x28')]][_0x497885]['answeredelsewheredestinationuniqueid']=_0x489eb7[_0xb508('0x25')];this[_0xb508('0x7')][_0x489eb7[_0xb508('0x28')]][_0x497885][_0xb508('0x4c')]=_0x489eb7[_0xb508('0x24')];this[_0xb508('0x7')][_0x489eb7[_0xb508('0x28')]][_0x497885]['lastevent']=_0xb508('0x4d');this[_0xb508('0x7')][_0x489eb7[_0xb508('0x28')]][_0x497885][_0xb508('0x4e')]=_0xb508('0x4d');logger[_0xb508('0x26')](_0xb508('0x4f'),_0x489eb7['uniqueid'],util[_0xb508('0x27')](this[_0xb508('0x7')][_0x489eb7[_0xb508('0x28')]][_0x497885],{'showHidden':![],'depth':null}));ami[_0xb508('0x1f')](_0xb508('0x50'),this[_0xb508('0x7')][_0x489eb7[_0xb508('0x28')]][_0x497885]);}else{logger[_0xb508('0x26')](_0xb508('0x51'),_0x489eb7['uniqueid']);}}}}}}catch(_0x519b5d){logger['error'](_0xb508('0x52'),_0x489eb7[_0xb508('0x28')],util[_0xb508('0x27')](_0x519b5d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentRingNoAnswer']=function(_0x31d933){try{if(this[_0xb508('0x21')](_0x31d933)){logger[_0xb508('0x26')](_0xb508('0x53'),_0x31d933['uniqueid'],util[_0xb508('0x27')](_0x31d933,{'showHidden':![],'depth':null}));if(this['channels'][_0x31d933['uniqueid']]&&this[_0xb508('0x7')][_0x31d933[_0xb508('0x28')]][_0x31d933['destuniqueid']]){logger['info'](_0xb508('0x54'),_0x31d933[_0xb508('0x28')],_0x31d933[_0xb508('0x24')],_0x31d933[_0xb508('0x25')]);var _0x164567=this['agents'][_0x31d933['interface']];var _0xa6576=this[_0xb508('0x7')][_0x31d933[_0xb508('0x28')]][_0x31d933[_0xb508('0x25')]];_0xa6576['agentringnoanswer']=!![];_0xa6576[_0xb508('0x4b')]=moment()[_0xb508('0x2b')](_0xb508('0x2c'));_0xa6576[_0xb508('0x41')]=_0xb508('0x55');_0xa6576[_0xb508('0x4e')]=_0xb508('0x55');var _0x195e44={'id':_0x164567['id'],'name':_0x164567['name'],'queue':_0xa6576['queue'],'uniqueid':_0xa6576[_0xb508('0x28')]};logger['debug'](_0xb508('0x56'),_0x31d933[_0xb508('0x28')],util[_0xb508('0x27')](_0x195e44,{'showHidden':![],'depth':null}));this[_0xb508('0x1f')](util['format'](_0xb508('0x37'),_0x164567['name']),_0xb508('0x57'),_0x195e44);ami[_0xb508('0x1f')]('custom:agentringnoanswer',_0xa6576);this['channels'][_0x31d933[_0xb508('0x28')]][_0x31d933[_0xb508('0x25')]]=Object[_0xb508('0x31')]({},_0xa6576);}}}catch(_0x4f0fdc){logger['error'](_0xb508('0x58'),_0x31d933['uniqueid'],util[_0xb508('0x27')](_0x4f0fdc,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncQueueCallerAbandon']=function(_0x39f77d){try{if(this[_0xb508('0x21')](_0x39f77d)){logger[_0xb508('0x26')](_0xb508('0x59'),_0x39f77d[_0xb508('0x28')],util[_0xb508('0x27')](_0x39f77d,{'showHidden':![],'depth':null}));if(this['channels'][_0x39f77d[_0xb508('0x28')]]){for(var _0x288b67 in this[_0xb508('0x7')][_0x39f77d[_0xb508('0x28')]]){if(this[_0xb508('0x7')][_0x39f77d['uniqueid']][_0xb508('0x3b')](_0x288b67)&&!this[_0xb508('0x7')][_0x39f77d[_0xb508('0x28')]][_0x288b67]['agentringnoanswer']&&!this[_0xb508('0x7')][_0x39f77d[_0xb508('0x28')]][_0x288b67][_0xb508('0x49')]){logger['info'](_0xb508('0x5a'),_0x39f77d[_0xb508('0x28')],this[_0xb508('0x7')][_0x39f77d[_0xb508('0x28')]][_0x288b67][_0xb508('0x24')],_0x288b67);this['channels'][_0x39f77d[_0xb508('0x28')]][_0x288b67]['agentringnoanswer']=!![];this[_0xb508('0x7')][_0x39f77d[_0xb508('0x28')]][_0x288b67][_0xb508('0x4b')]=moment()['format'](_0xb508('0x2c'));this[_0xb508('0x7')][_0x39f77d['uniqueid']][_0x288b67][_0xb508('0x41')]=_0xb508('0x5b');this[_0xb508('0x7')][_0x39f77d[_0xb508('0x28')]][_0x288b67][_0xb508('0x4e')]='abandoned';logger[_0xb508('0x26')](_0xb508('0x5c'),_0x39f77d[_0xb508('0x28')],util['inspect'](this['channels'][_0x39f77d[_0xb508('0x28')]][_0x288b67],{'showHidden':![],'depth':null}));ami['emit'](_0xb508('0x5d'),this[_0xb508('0x7')][_0x39f77d[_0xb508('0x28')]][_0x288b67]);}}}}}catch(_0x2e8872){logger[_0xb508('0x39')]('[%s][voiceAgentReport][queuecallerabandon]',_0x39f77d[_0xb508('0x28')],util[_0xb508('0x27')](_0x2e8872,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb508('0x20')][_0xb508('0x13')]=function(_0x3d51eb){try{if(this['isNotNull'](_0x3d51eb)){logger[_0xb508('0x26')](_0xb508('0x5e'),_0x3d51eb[_0xb508('0x28')],util[_0xb508('0x27')](_0x3d51eb,{'showHidden':![],'depth':null}));if(this[_0xb508('0x7')][_0x3d51eb[_0xb508('0x28')]]){for(var _0x3d95b0 in this[_0xb508('0x7')][_0x3d51eb['uniqueid']]){if(this[_0xb508('0x7')][_0x3d51eb[_0xb508('0x28')]][_0xb508('0x3b')](_0x3d95b0)){if(this[_0xb508('0x7')][_0x3d51eb[_0xb508('0x28')]][_0x3d95b0]['agentconnectAt']&&!this[_0xb508('0x7')][_0x3d51eb[_0xb508('0x28')]][_0x3d95b0][_0xb508('0x49')]){logger[_0xb508('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x3d51eb[_0xb508('0x28')],this['channels'][_0x3d51eb[_0xb508('0x28')]][_0x3d95b0]['membername'],_0x3d95b0);this['channels'][_0x3d51eb[_0xb508('0x28')]][_0x3d95b0][_0xb508('0x49')]=!![];this[_0xb508('0x7')][_0x3d51eb[_0xb508('0x28')]][_0x3d95b0][_0xb508('0x5f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x3d51eb[_0xb508('0x28')]][_0x3d95b0][_0xb508('0x41')]=_0xb508('0x60');this['channels'][_0x3d51eb[_0xb508('0x28')]][_0x3d95b0]['reason']=_0x3d51eb['reason']=='transfer'?_0xb508('0x61'):_0x3d51eb[_0xb508('0x4e')];this['channels'][_0x3d51eb[_0xb508('0x28')]][_0x3d95b0][_0xb508('0x62')]=_0x3d51eb[_0xb508('0x62')];if(this[_0xb508('0x8')][_0x3d51eb[_0xb508('0x2a')]]&&this[_0xb508('0x8')][_0x3d51eb[_0xb508('0x2a')]][_0xb508('0x63')]){this[_0xb508('0x7')][_0x3d51eb[_0xb508('0x28')]][_0x3d95b0][_0xb508('0x64')]=this[_0xb508('0x8')][_0x3d51eb[_0xb508('0x2a')]][_0xb508('0x65')];this['channels'][_0x3d51eb[_0xb508('0x28')]][_0x3d95b0][_0xb508('0x66')]=!![];}this[_0xb508('0x9')][_0x3d51eb[_0xb508('0x29')]]=_[_0xb508('0x67')](this['agents'][_0x3d51eb[_0xb508('0x29')]],[_0xb508('0x2a'),_0xb508('0x44')]);logger[_0xb508('0x26')](_0xb508('0x68'),_0x3d51eb['uniqueid'],util[_0xb508('0x27')](this[_0xb508('0x7')][_0x3d51eb[_0xb508('0x28')]][_0x3d95b0],{'showHidden':![],'depth':null}));ami['emit'](_0xb508('0x69'),this[_0xb508('0x7')][_0x3d51eb[_0xb508('0x28')]][_0x3d95b0]);logger[_0xb508('0x26')](_0xb508('0x6a'),_0x3d51eb[_0xb508('0x28')],util[_0xb508('0x27')]({'id':this[_0xb508('0x9')][_0x3d51eb[_0xb508('0x29')]]['id'],'destaccountcode':_0x3d51eb[_0xb508('0x6b')]},{'showHidden':![],'depth':null}));this[_0xb508('0x1f')](util[_0xb508('0x2b')](_0xb508('0x37'),_0x3d51eb[_0xb508('0x24')]),_0xb508('0x6c'),{'id':this[_0xb508('0x9')][_0x3d51eb[_0xb508('0x29')]]['id'],'destaccountcode':Number(_0x3d51eb[_0xb508('0x6b')])});}}}}}}catch(_0x289ac7){logger[_0xb508('0x39')](_0xb508('0x6d'),_0x3d51eb[_0xb508('0x28')],util[_0xb508('0x27')](_0x289ac7,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb508('0x15')]=function(_0xbfd319){try{if(this[_0xb508('0x21')](_0xbfd319)){logger[_0xb508('0x26')](_0xb508('0x6e'),_0xbfd319[_0xb508('0x28')],util[_0xb508('0x27')](_0xbfd319,{'showHidden':![],'depth':null}));this[_0xb508('0x6f')](_0xbfd319['uniqueid'],_[_0xb508('0x70')](_0xbfd319['variable'])[0x0],_0xbfd319[_0xb508('0x71')]);if(this['channels'][_0xbfd319['uniqueid']]){for(var _0x6130d7 in this[_0xb508('0x7')][_0xbfd319['uniqueid']]){if(this[_0xb508('0x7')][_0xbfd319[_0xb508('0x28')]]['hasOwnProperty'](_0x6130d7)){logger[_0xb508('0x23')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0xbfd319[_0xb508('0x28')],_0x6130d7,_[_0xb508('0x70')](_0xbfd319[_0xb508('0x72')])[0x0],_0xbfd319['value']);if(_['isUndefined'](this['channels'][_0xbfd319['uniqueid']][_0x6130d7]['variables'])){this[_0xb508('0x7')][_0xbfd319['uniqueid']][_0x6130d7]['variables']={};}this[_0xb508('0x7')][_0xbfd319[_0xb508('0x28')]][_0x6130d7][_0xb508('0xa')]=this[_0xb508('0xa')][_0xbfd319[_0xb508('0x28')]];}}}}}catch(_0x32d0b3){logger[_0xb508('0x39')]('[%s][voiceAgentReport][varset]',_0xbfd319['uniqueid'],util[_0xb508('0x27')](_0x32d0b3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb508('0x20')][_0xb508('0x6f')]=function(_0x19f14d,_0xb90f16,_0x25920f){var _0x91d018=['rtpaudioqos',_0xb508('0x73'),_0xb508('0x74'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0xb508('0x75'),_0xb508('0x76'),_0xb508('0x77'),_0xb508('0x78'),_0xb508('0x79'),_0xb508('0x7a'),'bridgepvtcallid','membercalls',_0xb508('0x7b'),_0xb508('0x7c'),_0xb508('0x7d'),_0xb508('0x24'),_0xb508('0x7e'),_0xb508('0x7f')];if(!_[_0xb508('0x80')](_0xb90f16)&&!_[_0xb508('0x81')](_0x91d018,_0xb90f16)){if(_[_0xb508('0x22')](this[_0xb508('0xa')][_0x19f14d])){this[_0xb508('0xa')][_0x19f14d]={};}this['variables'][_0x19f14d][_0xb90f16]=_0x25920f;}};VoiceAgentReport[_0xb508('0x20')][_0xb508('0x82')]=function(_0x409d0c){try{if(this[_0xb508('0x21')](_0x409d0c)){logger['debug']('[%s][voiceAgentReport][hangup]\x20event:',_0x409d0c[_0xb508('0x28')],util[_0xb508('0x27')](_0x409d0c,{'showHidden':![],'depth':null}));if(this[_0xb508('0x7')][_0x409d0c[_0xb508('0x28')]]){for(var _0x521f45 in this[_0xb508('0x7')][_0x409d0c[_0xb508('0x28')]]){if(this[_0xb508('0x7')][_0x409d0c[_0xb508('0x28')]]['hasOwnProperty'](_0x521f45)){if(this[_0xb508('0x7')][_0x409d0c[_0xb508('0x28')]][_0x521f45]['reason']==_0xb508('0x83')&&this[_0xb508('0x7')][_0x409d0c[_0xb508('0x28')]][_0x521f45][_0xb508('0x49')]){logger[_0xb508('0x23')](_0xb508('0x84'),_0x409d0c[_0xb508('0x28')],_0x521f45);this[_0xb508('0x7')][_0x409d0c[_0xb508('0x28')]][_0x521f45][_0xb508('0x5f')]=moment()[_0xb508('0x2b')](_0xb508('0x2c'));}}}logger[_0xb508('0x26')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x409d0c[_0xb508('0x28')],util['inspect'](_[_0xb508('0x85')](this[_0xb508('0x7')][_0x409d0c[_0xb508('0x28')]]),{'showHidden':![],'depth':null}));ami[_0xb508('0x1f')](_0xb508('0x86'),_[_0xb508('0x85')](this[_0xb508('0x7')][_0x409d0c[_0xb508('0x28')]]));this[_0xb508('0x87')](_0x409d0c[_0xb508('0x28')]);}if(this[_0xb508('0xa')][_0x409d0c['uniqueid']]){delete this['variables'][_0x409d0c[_0xb508('0x28')]];}}}catch(_0x1429b3){logger['error'](_0xb508('0x88'),_0x409d0c[_0xb508('0x28')],util[_0xb508('0x27')](_0x1429b3,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb508('0x1c')]=function(_0x4a8d1e){try{if(this[_0xb508('0x21')](_0x4a8d1e)){logger[_0xb508('0x26')](_0xb508('0x89'),_0x4a8d1e['uniqueid'],util['inspect'](_0x4a8d1e,{'showHidden':![],'depth':null}));if(this[_0xb508('0x7')][_0x4a8d1e[_0xb508('0x8a')]]){for(var _0x577b4e in this[_0xb508('0x7')][_0x4a8d1e['transfereeuniqueid']]){if(this[_0xb508('0x7')][_0x4a8d1e['transfereeuniqueid']][_0xb508('0x3b')](_0x577b4e)){if(_0x4a8d1e[_0xb508('0x8b')]===_0x577b4e){logger['info']('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x4a8d1e[_0xb508('0x28')],this[_0xb508('0x7')][_0x4a8d1e['transfereeuniqueid']][_0x577b4e]['membername'],_0x577b4e);var _0x1843f6=moment();this[_0xb508('0x7')][_0x4a8d1e['transfereeuniqueid']][_0x577b4e][_0xb508('0x49')]=!![];this['channels'][_0x4a8d1e[_0xb508('0x8a')]][_0x577b4e][_0xb508('0x5f')]=moment()['format'](_0xb508('0x2c'));this[_0xb508('0x7')][_0x4a8d1e[_0xb508('0x8a')]][_0x577b4e][_0xb508('0x41')]=_0xb508('0x60');this['channels'][_0x4a8d1e[_0xb508('0x8a')]][_0x577b4e][_0xb508('0x4e')]=_0xb508('0x83');this['channels'][_0x4a8d1e[_0xb508('0x8a')]][_0x577b4e][_0xb508('0x62')]=_0x1843f6[_0xb508('0x8c')](this['channels'][_0x4a8d1e[_0xb508('0x8a')]][_0x577b4e]['agentconnectAt'],'seconds');}}}}if(this['channels'][_0x4a8d1e['secondtransfereruniqueid']]){var _0x20b726=this[_0xb508('0x7')][_0x4a8d1e[_0xb508('0x8d')]];this[_0xb508('0x7')][_0x4a8d1e[_0xb508('0x8d')]]=this[_0xb508('0x7')][_0x4a8d1e[_0xb508('0x8a')]];this[_0xb508('0x7')][_0x4a8d1e['transfereeuniqueid']]=_0x20b726;}}}catch(_0x1307f5){logger['error'](_0xb508('0x8e'),_0x4a8d1e[_0xb508('0x28')],util[_0xb508('0x27')](_0x1307f5,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb508('0x1e')]=function(_0x42ba45){try{if(this[_0xb508('0x21')](_0x42ba45)){logger[_0xb508('0x26')](_0xb508('0x8f'),_0x42ba45[_0xb508('0x28')],util[_0xb508('0x27')](_0x42ba45,{'showHidden':![],'depth':null}));if(this['channels'][_0x42ba45['transfereeuniqueid']]){for(var _0x7d4183 in this[_0xb508('0x7')][_0x42ba45[_0xb508('0x8a')]]){if(this[_0xb508('0x7')][_0x42ba45[_0xb508('0x8a')]]['hasOwnProperty'](_0x7d4183)){if(_0x42ba45[_0xb508('0x90')]===_0x7d4183){logger[_0xb508('0x23')](_0xb508('0x91'),_0x42ba45[_0xb508('0x28')],this['channels'][_0x42ba45['transfereeuniqueid']][_0x7d4183][_0xb508('0x24')],_0x7d4183);var _0xcedb03=moment();this[_0xb508('0x7')][_0x42ba45['transfereeuniqueid']][_0x7d4183][_0xb508('0x49')]=!![];this['channels'][_0x42ba45['transfereeuniqueid']][_0x7d4183][_0xb508('0x5f')]=_0xcedb03;this[_0xb508('0x7')][_0x42ba45[_0xb508('0x8a')]][_0x7d4183][_0xb508('0x41')]=_0xb508('0x60');this['channels'][_0x42ba45[_0xb508('0x8a')]][_0x7d4183][_0xb508('0x4e')]=_0xb508('0x83');this['channels'][_0x42ba45['transfereeuniqueid']][_0x7d4183][_0xb508('0x62')]=_0xcedb03[_0xb508('0x8c')](this['channels'][_0x42ba45['transfereeuniqueid']][_0x7d4183][_0xb508('0x92')],'seconds');}}}}}}catch(_0x59e5b8){logger[_0xb508('0x39')](_0xb508('0x93'),_0x42ba45[_0xb508('0x28')],util['inspect'](_0x59e5b8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb508('0x20')][_0xb508('0x18')]=function(_0x4622d4){var _0x43a9cc='';try{if(this[_0xb508('0x21')](_0x4622d4)){logger[_0xb508('0x26')](_0xb508('0x94'),_0x4622d4['uniqueid'],util[_0xb508('0x27')](_0x4622d4,{'showHidden':![],'depth':null}));if(_0x4622d4[_0xb508('0x95')]){_0x43a9cc=_0x4622d4[_0xb508('0x95')]['substring'](0x0,_0x4622d4['channel'][_0xb508('0x96')]('-'));if(this[_0xb508('0x9')][_0x43a9cc]){logger[_0xb508('0x23')](_0xb508('0x97'),_0x4622d4[_0xb508('0x28')],_0x43a9cc);this[_0xb508('0x9')][_0x43a9cc][_0xb508('0x98')]=!![];}}}}catch(_0x1d5dd7){logger[_0xb508('0x39')](_0xb508('0x99'),_0x4622d4[_0xb508('0x28')],util[_0xb508('0x27')](_0x1d5dd7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb508('0x20')][_0xb508('0x1a')]=function(_0x341a08){var _0x2318cf='';try{if(this['isNotNull'](_0x341a08)){logger['debug'](_0xb508('0x9a'),_0x341a08[_0xb508('0x28')],util[_0xb508('0x27')](_0x341a08,{'showHidden':![],'depth':null}));if(_0x341a08['channel']){_0x2318cf=_0x341a08[_0xb508('0x95')]['substring'](0x0,_0x341a08[_0xb508('0x95')][_0xb508('0x96')]('-'));if(this[_0xb508('0x9')][_0x2318cf]){logger['info'](_0xb508('0x9b'),_0x341a08['uniqueid'],_0x2318cf);this['agents'][_0x2318cf][_0xb508('0x98')]=![];}}}}catch(_0x18ba84){logger['error'](_0xb508('0x9c'),_0x341a08['uniqueid'],util[_0xb508('0x27')](_0x18ba84,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb508('0x20')]['deleteChannelAfterTimeout']=function(_0x3074e2,_0x2a2ea0=0x2710){if(this[_0xb508('0x7')][_0x3074e2]){setTimeout(()=>{delete this[_0xb508('0x7')][_0x3074e2];},_0x2a2ea0);}};module[_0xb508('0x9d')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index ad37dd0..fdf1549 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 _0x8143=['mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','deleteChannelAfterTimeout','lodash','moment','util','ioredis','../../../config/logger','ami','../model/channel','../rpc/setting','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','newexten','bind','newchannel','syncNewChannel','newstate','varset','syncNewCallerId','attendedtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','context','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','from-sip','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','[%s][voiceCallReport][newexten]\x20event:','application','applicationdata','appdata','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','includes','lastdata','startsWith','cdr(','match','type','isNil','[%s][voiceCallReport][newexten]','calleridname','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','diff','destinationchannel','UserId','membername','holdtime','connectedlinename','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','replace','.WAV','monitorFilename','monitors','push','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','resolve','transferType','transferToInternal','isEmpty','getSettings','then','stopRecordingOnTransfer','catch','Action','StopMixMonitor','finally','webbar:stopmonitors','event','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','syncAttendedTransfer','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','outbound','routeid','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','syncHangup','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstop]\x20event:'];(function(_0x1b5aea,_0x1afe6f){var _0x51cae9=function(_0x1494a6){while(--_0x1494a6){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x51cae9(++_0x1afe6f);}(_0x8143,0xcc));var _0x3814=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8143[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x3814('0x0'));var moment=require(_0x3814('0x1'));var util=require(_0x3814('0x2'));var path=require('path');var Redis=require(_0x3814('0x3'));var config=require('../../../config/environment');var logger=require(_0x3814('0x4'))(_0x3814('0x5'));var ami=require('../ami');var Channel=require(_0x3814('0x6'));var RpcSetting=require(_0x3814('0x7'));var applications=[_0x3814('0x8'),_0x3814('0x9'),_0x3814('0xa'),_0x3814('0xb'),_0x3814('0xc'),_0x3814('0xd')];var dispositions=[_0x3814('0xe'),'FAILED',_0x3814('0xf'),_0x3814('0xe'),_0x3814('0xe'),_0x3814('0xe'),_0x3814('0x10'),'BUSY',_0x3814('0xf'),_0x3814('0xf'),'FAILED'];config[_0x3814('0x11')]=_[_0x3814('0x12')](config[_0x3814('0x11')],{'host':_0x3814('0x13'),'port':0x18eb});var io=require(_0x3814('0x14'))(new Redis(config[_0x3814('0x11')]));function VoiceCallReport(_0x12b657){this[_0x3814('0x15')]=_0x12b657['channels'];this[_0x3814('0x16')]=_0x12b657[_0x3814('0x16')];this[_0x3814('0x17')]={};ami['on'](_0x3814('0x18'),this[_0x3814('0x19')]['bind'](this));ami['on'](_0x3814('0x1a'),this['syncNewExten'][_0x3814('0x1b')](this));ami['on'](_0x3814('0x1c'),this[_0x3814('0x1d')]['bind'](this));ami['on'](_0x3814('0x1e'),this['syncNewState']['bind'](this));ami['on'](_0x3814('0x1f'),this['syncVarSet'][_0x3814('0x1b')](this));ami['on']('hangup',this['syncHangup'][_0x3814('0x1b')](this));ami['on']('newcallerid',this[_0x3814('0x20')][_0x3814('0x1b')](this));ami['on'](_0x3814('0x21'),this['syncAttendedTransfer'][_0x3814('0x1b')](this));ami['on']('blindtransfer',this[_0x3814('0x22')][_0x3814('0x1b')](this));ami['on'](_0x3814('0x23'),this[_0x3814('0x24')]['bind'](this));ami['on'](_0x3814('0x25'),this[_0x3814('0x26')][_0x3814('0x1b')](this));try{logger[_0x3814('0x27')](_0x3814('0x28'));ami[_0x3814('0x29')]();}catch(_0x510155){logger[_0x3814('0x2a')](_0x3814('0x2b'),util[_0x3814('0x2c')](_0x510155,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x3814('0x2d')][_0x3814('0x2e')]=function(_0x5af779){return _0x5af779!==null&&!_[_0x3814('0x2f')](_0x5af779);};VoiceCallReport[_0x3814('0x2d')][_0x3814('0x30')]=function(_0x4c9e2b,_0x1a8e17,_0x51a429){io['to'](_0x4c9e2b)[_0x3814('0x30')](_0x1a8e17,_0x51a429);};VoiceCallReport[_0x3814('0x2d')][_0x3814('0x20')]=function(_0x5a5d79){try{if(this[_0x3814('0x2e')](_0x5a5d79)){logger[_0x3814('0x27')](_0x3814('0x31'),_0x5a5d79[_0x3814('0x32')],_0x5a5d79['calleridname'],_0x5a5d79[_0x3814('0x33')]);logger[_0x3814('0x34')](_0x3814('0x35'),_0x5a5d79['uniqueid'],util[_0x3814('0x2c')](_0x5a5d79,{'showHidden':![],'depth':null}));if(_0x5a5d79[_0x3814('0x32')]===_0x5a5d79[_0x3814('0x36')]){if(!_[_0x3814('0x2f')](this[_0x3814('0x15')][_0x5a5d79['uniqueid']])){_[_0x3814('0x37')](this[_0x3814('0x15')][_0x5a5d79[_0x3814('0x32')]],_[_0x3814('0x38')](_0x5a5d79,_[_0x3814('0x39')](this[_0x3814('0x15')][_0x5a5d79['uniqueid']])));}}if(_0x5a5d79[_0x3814('0x3a')]==='from-sip'){var _0x53711d=this['agents'][_0x5a5d79[_0x3814('0x3b')][_0x3814('0x3c')]('-')[0x0]];if(_0x53711d){if(_0x5a5d79[_0x3814('0x3d')]==_0x3814('0x3e')){_0x53711d[_0x3814('0x3f')]=_0x5a5d79[_0x3814('0x40')];this[_0x3814('0x30')](util[_0x3814('0x41')](_0x3814('0x42'),_0x53711d[_0x3814('0x43')]),_0x3814('0x44'),{'id':_0x53711d['id'],'destaccountcode':_0x53711d['accountcode'],'destconnectedlinenum':_0x5a5d79[_0x3814('0x40')]});}}}}}catch(_0x4cc015){logger[_0x3814('0x2a')]('[%s][voiceCallReport][newcallerid]',_0x5a5d79[_0x3814('0x32')],util['inspect'](_0x4cc015,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x3814('0x1d')]=function(_0x444fd5){try{if(this[_0x3814('0x2e')](_0x444fd5)){logger[_0x3814('0x34')](_0x3814('0x45'),_0x444fd5[_0x3814('0x32')],util[_0x3814('0x2c')](_0x444fd5,{'showHidden':![],'depth':null}));if(this['channels'][_0x444fd5['uniqueid']]){return;}if(_0x444fd5[_0x3814('0x3b')]===_0x3814('0x46')){return;}if(_0x444fd5[_0x3814('0x32')]!==_0x444fd5['linkedid']&&!this[_0x3814('0x17')][_0x444fd5['linkedid']]){return;}logger[_0x3814('0x27')](_0x3814('0x47'),_0x444fd5[_0x3814('0x32')],_0x444fd5[_0x3814('0x3a')],_0x444fd5['exten']);this['channels'][_0x444fd5[_0x3814('0x32')]]=new Channel();this[_0x3814('0x15')][_0x444fd5[_0x3814('0x32')]]['starttime']=moment()[_0x3814('0x41')](_0x3814('0x48'));this[_0x3814('0x15')][_0x444fd5[_0x3814('0x32')]][_0x3814('0x49')]=dispositions[_[_0x3814('0x4a')](_0x444fd5[_0x3814('0x4b')])];_[_0x3814('0x37')](this['channels'][_0x444fd5['uniqueid']],_[_0x3814('0x38')](_0x444fd5,_[_0x3814('0x39')](this[_0x3814('0x15')][_0x444fd5[_0x3814('0x32')]])));if(_0x444fd5[_0x3814('0x3a')]===_0x3814('0x4c')){var _0x51785d=this[_0x3814('0x16')][_0x444fd5['channel'][_0x3814('0x3c')]('-')[0x0]];if(_0x51785d&&typeof _0x51785d[_0x3814('0x3f')]===_0x3814('0x4d')){_0x51785d[_0x3814('0x3f')]=_0x444fd5[_0x3814('0x3d')];logger[_0x3814('0x34')](_0x3814('0x4e'),_0x444fd5[_0x3814('0x32')],util[_0x3814('0x2c')]({'id':_0x51785d['id'],'destaccountcode':_0x51785d[_0x3814('0x4f')],'destconnectedlinenum':_0x444fd5[_0x3814('0x3d')]},{'showHidden':![],'depth':null}));this[_0x3814('0x30')](util[_0x3814('0x41')](_0x3814('0x42'),_0x51785d[_0x3814('0x43')]),_0x3814('0x44'),{'id':_0x51785d['id'],'destaccountcode':_0x51785d[_0x3814('0x4f')],'destconnectedlinenum':_0x444fd5[_0x3814('0x3d')]});}}}}catch(_0x3665df){logger[_0x3814('0x2a')]('[%s][voiceCallReport][newchannel]',_0x444fd5[_0x3814('0x32')],util[_0x3814('0x2c')](_0x3665df,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x3814('0x19')]=function(_0x524758){try{if(this[_0x3814('0x2e')](_0x524758)){logger[_0x3814('0x34')](_0x3814('0x50'),_0x524758[_0x3814('0x32')],util[_0x3814('0x2c')](_0x524758,{'showHidden':![],'depth':null}));if(_0x524758['channel']===_0x3814('0x46')||_0x524758[_0x3814('0x3d')]==='h')return;if(_0x524758[_0x3814('0x32')]===_0x524758[_0x3814('0x36')]||this[_0x3814('0x17')][_0x524758[_0x3814('0x36')]]){_0x524758[_0x3814('0x51')]=_0x524758[_0x3814('0x51')]?_0x524758[_0x3814('0x51')]['toLowerCase']():undefined;_0x524758[_0x3814('0x52')]=_0x524758[_0x3814('0x53')]||_0x524758[_0x3814('0x52')];if(_0x524758['appdata']&&_0x524758[_0x3814('0x51')]!=='queue'){_0x524758[_0x3814('0x52')]=_0x524758[_0x3814('0x52')][_0x3814('0x54')]();}logger[_0x3814('0x27')](_0x3814('0x55'),_0x524758['uniqueid'],_0x524758['application'],_0x524758[_0x3814('0x52')]);if(_[_0x3814('0x2f')](this[_0x3814('0x15')][_0x524758[_0x3814('0x32')]])){this[_0x3814('0x15')][_0x524758[_0x3814('0x32')]]=new Channel();this[_0x3814('0x15')][_0x524758[_0x3814('0x32')]][_0x3814('0x56')]=_0x524758[_0x3814('0x57')]?moment()[_0x3814('0x58')](moment[_0x3814('0x57')](_0x524758['duration'])[_0x3814('0x59')](),_0x3814('0x59'))[_0x3814('0x41')](_0x3814('0x48')):moment()[_0x3814('0x41')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3814('0x15')][_0x524758[_0x3814('0x32')]][_0x3814('0x49')]=_0x3814('0xe');}_[_0x3814('0x37')](this['channels'][_0x524758['uniqueid']],_[_0x3814('0x38')](_0x524758,_['keys'](this[_0x3814('0x15')][_0x524758[_0x3814('0x32')]])));if(_[_0x3814('0x5a')](applications,_0x524758['application'])){this['channels'][_0x524758[_0x3814('0x32')]]['lastapplication']=_0x524758[_0x3814('0x51')];this[_0x3814('0x15')][_0x524758[_0x3814('0x32')]][_0x3814('0x5b')]=_0x524758[_0x3814('0x52')];if(_0x524758[_0x3814('0x51')]===_0x3814('0x8')&&_[_0x3814('0x5c')](_0x524758[_0x3814('0x52')]['toLowerCase'](),_0x3814('0x5d'))){var _0x10f0fd=_0x524758[_0x3814('0x52')]['split']('=');var _0x1e3ca4=_0x10f0fd[0x0][_0x3814('0x54')]()[_0x3814('0x5e')](/cdr\((.*)\)/);if(_0x1e3ca4){if(_0x1e3ca4[0x1]===_0x3814('0x5f')&&!_[_0x3814('0x60')](this[_0x3814('0x15')][_0x524758[_0x3814('0x32')]][_0x1e3ca4[0x1]]))return;this['channels'][_0x524758[_0x3814('0x32')]][_0x1e3ca4[0x1]]=_0x10f0fd[0x1];}}else if(_0x524758['application']===_0x3814('0x9')){this[_0x3814('0x15')][_0x524758[_0x3814('0x32')]][_0x3814('0x9')]=_0x524758[_0x3814('0x52')][_0x3814('0x3c')](',')[0x0];}}}}}catch(_0x4f3bc9){logger[_0x3814('0x2a')](_0x3814('0x61'),_0x524758[_0x3814('0x32')],util[_0x3814('0x2c')](_0x4f3bc9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3814('0x2d')]['syncNewState']=function(_0x40d086){try{if(this[_0x3814('0x2e')](_0x40d086)){logger['info']('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x40d086['uniqueid'],_0x40d086[_0x3814('0x36')],_0x40d086[_0x3814('0x62')],_0x40d086[_0x3814('0x33')]);logger[_0x3814('0x34')](_0x3814('0x63'),_0x40d086[_0x3814('0x32')],util[_0x3814('0x2c')](_0x40d086,{'showHidden':![],'depth':null}));if(_0x40d086[_0x3814('0x4b')]!=='6')return;var _0x1ef1e3=this[_0x3814('0x16')][_0x40d086['channel']['split']('-')[0x0]];if(_0x40d086[_0x3814('0x32')]!==_0x40d086['linkedid']){var _0x1c17af=moment();if(this[_0x3814('0x15')][_0x40d086[_0x3814('0x36')]]){if(!this[_0x3814('0x15')][_0x40d086[_0x3814('0x36')]]['answered']){this['channels'][_0x40d086[_0x3814('0x36')]][_0x3814('0x64')]=!![];this[_0x3814('0x15')][_0x40d086[_0x3814('0x36')]][_0x3814('0x65')]=_0x1c17af['format'](_0x3814('0x48'));if(this[_0x3814('0x15')][_0x40d086[_0x3814('0x36')]]['starttime']){this[_0x3814('0x15')][_0x40d086[_0x3814('0x36')]]['holdtime']=_0x1c17af[_0x3814('0x66')](this[_0x3814('0x15')][_0x40d086['linkedid']]['starttime'],_0x3814('0x59'));}}this[_0x3814('0x15')][_0x40d086[_0x3814('0x36')]][_0x3814('0x36')]=_0x40d086[_0x3814('0x32')];if(_0x40d086[_0x3814('0x33')]!==_0x3814('0x3e')){this[_0x3814('0x15')][_0x40d086[_0x3814('0x36')]][_0x3814('0x40')]=_0x40d086['calleridnum'];}this[_0x3814('0x15')][_0x40d086[_0x3814('0x36')]]['connectedlinename']=_0x40d086['calleridname'];this[_0x3814('0x15')][_0x40d086[_0x3814('0x36')]][_0x3814('0x67')]=_0x40d086[_0x3814('0x3b')];this['channels'][_0x40d086[_0x3814('0x36')]][_0x3814('0x49')]=dispositions[_[_0x3814('0x4a')](_0x40d086[_0x3814('0x4b')])];if(_0x1ef1e3){this['channels'][_0x40d086[_0x3814('0x36')]][_0x3814('0x68')]=_0x1ef1e3['id'];this[_0x3814('0x15')][_0x40d086['linkedid']][_0x3814('0x69')]=_0x1ef1e3[_0x3814('0x43')];}}if(this[_0x3814('0x15')][_0x40d086[_0x3814('0x32')]]){if(!this['channels'][_0x40d086[_0x3814('0x32')]][_0x3814('0x64')]){this['channels'][_0x40d086[_0x3814('0x32')]][_0x3814('0x64')]=!![];this[_0x3814('0x15')][_0x40d086[_0x3814('0x32')]][_0x3814('0x65')]=_0x1c17af[_0x3814('0x41')](_0x3814('0x48'));if(this[_0x3814('0x15')][_0x40d086['uniqueid']][_0x3814('0x56')]){this[_0x3814('0x15')][_0x40d086[_0x3814('0x32')]][_0x3814('0x6a')]=_0x1c17af[_0x3814('0x66')](this[_0x3814('0x15')][_0x40d086['uniqueid']][_0x3814('0x56')],'seconds');}}if(_0x40d086[_0x3814('0x33')]!==_0x3814('0x3e')){this[_0x3814('0x15')][_0x40d086[_0x3814('0x32')]][_0x3814('0x40')]=_0x40d086['calleridnum'];}this['channels'][_0x40d086[_0x3814('0x32')]][_0x3814('0x6b')]=_0x40d086[_0x3814('0x62')];this['channels'][_0x40d086[_0x3814('0x32')]][_0x3814('0x67')]=_0x40d086['channel'];this[_0x3814('0x15')][_0x40d086['uniqueid']]['disposition']=dispositions[_[_0x3814('0x4a')](_0x40d086[_0x3814('0x4b')])];}}else{if(this[_0x3814('0x15')][_0x40d086['uniqueid']]){if(_0x1ef1e3){this[_0x3814('0x15')][_0x40d086[_0x3814('0x32')]]['UserId']=_0x1ef1e3['id'];this['channels'][_0x40d086[_0x3814('0x32')]][_0x3814('0x69')]=_0x1ef1e3[_0x3814('0x43')];}}}if(_0x40d086[_0x3814('0x3a')]===_0x3814('0x4c')){if(_0x1ef1e3){_0x1ef1e3[_0x3814('0x3f')]=_0x40d086[_0x3814('0x3d')];var _0x2c0722;if(this[_0x3814('0x15')][_0x40d086[_0x3814('0x32')]]){_0x2c0722=this[_0x3814('0x15')][_0x40d086['uniqueid']]['queue'];}else if(this[_0x3814('0x15')][_0x40d086[_0x3814('0x36')]]){_0x2c0722=this['channels'][_0x40d086['linkedid']][_0x3814('0x9')];}_0x1ef1e3[_0x3814('0x9')]=_0x2c0722;var _0x4700ab={'id':_0x1ef1e3['id'],'name':_0x1ef1e3[_0x3814('0x43')],'agentconnected':!![],'destaccountcode':_0x1ef1e3[_0x3814('0x4f')],'destconnectedlinenum':_0x40d086[_0x3814('0x3d')],'queue':_0x2c0722||undefined,'uniqueid':_0x40d086[_0x3814('0x36')]};logger[_0x3814('0x34')](_0x3814('0x6c'),_0x40d086[_0x3814('0x32')],util[_0x3814('0x2c')](_0x4700ab,{'showHidden':![],'depth':null}));this[_0x3814('0x30')](util[_0x3814('0x41')](_0x3814('0x42'),_0x1ef1e3[_0x3814('0x43')]),_0x3814('0x44'),_0x4700ab);}}}}catch(_0x8a0e09){logger['error'](_0x3814('0x6d'),_0x40d086[_0x3814('0x32')],util[_0x3814('0x2c')](_0x8a0e09,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3814('0x2d')][_0x3814('0x6e')]=function(_0x1be6c7,_0x5b7cd3){try{if(this[_0x3814('0x15')][_0x1be6c7]){logger['info'](_0x3814('0x6f'),_0x1be6c7,_0x5b7cd3);this['channels'][_0x1be6c7][_0x3814('0x70')]=!![];if(_['endsWith'](_0x5b7cd3,_0x3814('0x71'))){_0x5b7cd3=_0x5b7cd3[_0x3814('0x72')](_0x3814('0x71'),_0x3814('0x73'));}this['channels'][_0x1be6c7][_0x3814('0x74')]=_0x5b7cd3;var _0x5328a6=_['find'](this[_0x3814('0x15')][_0x1be6c7][_0x3814('0x75')],{'filename':_0x5b7cd3});if(_[_0x3814('0x60')](_0x5328a6)){this[_0x3814('0x15')][_0x1be6c7][_0x3814('0x75')][_0x3814('0x76')]({'filename':_0x5b7cd3,'createdAt':moment()['format'](_0x3814('0x48')),'mixmonitorid':'','status':'rec'});}}}catch(_0x2fdc49){logger[_0x3814('0x2a')]('[%s][voiceCallReport][mixMonitorFilename]',_0x1be6c7,util[_0x3814('0x2c')](_0x2fdc49,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3814('0x2d')][_0x3814('0x77')]=function(_0x20f47a){try{if(this[_0x3814('0x2e')](_0x20f47a)){logger['debug'](_0x3814('0x78'),_0x20f47a[_0x3814('0x32')],util[_0x3814('0x2c')](_0x20f47a,{'showHidden':![],'depth':null}));if(this[_0x3814('0x15')][_0x20f47a[_0x3814('0x32')]]&&_0x20f47a['channel']!=_0x3814('0x46')){if(this[_0x3814('0x2e')](_0x20f47a['variable'])){if(this[_0x3814('0x2e')](_0x20f47a[_0x3814('0x79')][_0x3814('0x7a')])){logger[_0x3814('0x27')](_0x3814('0x7b'),_0x20f47a[_0x3814('0x32')],_0x20f47a[_0x3814('0x7c')]);this[_0x3814('0x6e')](_0x20f47a[_0x3814('0x32')],_0x20f47a[_0x3814('0x7c')]);}else if(this['isNotNull'](_0x20f47a[_0x3814('0x79')][_0x3814('0x7d')])){logger[_0x3814('0x27')](_0x3814('0x7e'),_0x20f47a['uniqueid'],_0x20f47a[_0x3814('0x7c')]);this[_0x3814('0x15')][_0x20f47a[_0x3814('0x32')]][_0x3814('0x33')]=_0x20f47a['value'];}else if(this['isNotNull'](_0x20f47a[_0x3814('0x79')]['xmd-callerid'])){logger[_0x3814('0x27')](_0x3814('0x7f'),_0x20f47a[_0x3814('0x32')],_0x20f47a['value']);this['channels'][_0x20f47a['uniqueid']][_0x3814('0x80')]=_0x20f47a[_0x3814('0x7c')];}else if(this[_0x3814('0x2e')](_0x20f47a[_0x3814('0x79')]['xmd-cdrtype'])){logger[_0x3814('0x27')](_0x3814('0x81'),_0x20f47a[_0x3814('0x32')],_0x20f47a[_0x3814('0x7c')]);this['channels'][_0x20f47a[_0x3814('0x32')]][_0x3814('0x5f')]=_0x20f47a['value'];}else if(this[_0x3814('0x2e')](_0x20f47a[_0x3814('0x79')][_0x3814('0x82')])){logger[_0x3814('0x27')](_0x3814('0x83'),_0x20f47a[_0x3814('0x32')],_0x20f47a[_0x3814('0x7c')][_0x3814('0x3c')](',')[0x0]);this[_0x3814('0x15')][_0x20f47a[_0x3814('0x32')]][_0x3814('0x9')]=_0x20f47a[_0x3814('0x7c')][_0x3814('0x3c')](',')[0x0];}else if(this[_0x3814('0x2e')](_0x20f47a[_0x3814('0x79')][_0x3814('0x84')])){logger[_0x3814('0x27')](_0x3814('0x85'),_0x20f47a[_0x3814('0x32')],_0x20f47a[_0x3814('0x7c')]);this[_0x3814('0x15')][_0x20f47a[_0x3814('0x32')]][_0x3814('0x86')]=_0x20f47a[_0x3814('0x7c')];}else if(this[_0x3814('0x2e')](_0x20f47a[_0x3814('0x79')][_0x3814('0x87')])){logger[_0x3814('0x27')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x20f47a[_0x3814('0x32')],_0x20f47a['value']);this[_0x3814('0x15')][_0x20f47a[_0x3814('0x32')]][_0x3814('0x88')]=_0x20f47a['value'];}else if(this[_0x3814('0x2e')](_0x20f47a['variable'][_0x3814('0x89')])){logger[_0x3814('0x27')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x20f47a[_0x3814('0x32')],_0x20f47a['value']);this[_0x3814('0x15')][_0x20f47a[_0x3814('0x32')]][_0x3814('0x8a')]=_0x20f47a[_0x3814('0x7c')];}else if(this[_0x3814('0x2e')](_0x20f47a['variable']['xmcs-queue'])){logger[_0x3814('0x27')](_0x3814('0x8b'),_0x20f47a[_0x3814('0x32')],_0x20f47a[_0x3814('0x7c')]);this[_0x3814('0x15')][_0x20f47a[_0x3814('0x32')]][_0x3814('0x9')]=_0x20f47a[_0x3814('0x7c')];}else if(this[_0x3814('0x2e')](_0x20f47a[_0x3814('0x79')][_0x3814('0x8c')])){logger[_0x3814('0x27')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x20f47a[_0x3814('0x32')],_0x20f47a['value']);this['channels'][_0x20f47a[_0x3814('0x32')]][_0x3814('0x8d')]=_0x20f47a[_0x3814('0x7c')];}}}else if(this[_0x3814('0x2e')](_0x20f47a[_0x3814('0x79')][_0x3814('0x7a')])){if(_0x20f47a[_0x3814('0x7c')]){var _0x35e23e=path[_0x3814('0x8e')](_0x20f47a[_0x3814('0x7c')])['name'];logger['info'](_0x3814('0x7b'),_0x35e23e,_0x20f47a[_0x3814('0x7c')]);this[_0x3814('0x6e')](_0x35e23e,_0x20f47a['value']);}}else if(this[_0x3814('0x15')][_0x20f47a[_0x3814('0x36')]]){if(this['isNotNull'](_0x20f47a['variable'])){if(this[_0x3814('0x2e')](_0x20f47a[_0x3814('0x79')][_0x3814('0x8c')])){logger['info'](_0x3814('0x8f'),_0x20f47a[_0x3814('0x36')],_0x20f47a[_0x3814('0x7c')]);this[_0x3814('0x15')][_0x20f47a[_0x3814('0x36')]]['sipcalllinkedid']=_0x20f47a[_0x3814('0x7c')];}}}}}catch(_0x183674){logger[_0x3814('0x2a')](_0x3814('0x90'),_0x20f47a[_0x3814('0x32')],util[_0x3814('0x2c')](_0x183674,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3814('0x2d')]['syncHangup']=function(_0x40872b){try{if(this[_0x3814('0x2e')](_0x40872b)){logger[_0x3814('0x34')]('[%s][voiceCallReport][hangup]\x20event:',_0x40872b[_0x3814('0x32')],util[_0x3814('0x2c')](_0x40872b,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x40872b[_0x3814('0x36')]]){if(this[_0x3814('0x15')][this[_0x3814('0x17')][_0x40872b[_0x3814('0x36')]][_0x3814('0x36')]]){this[_0x3814('0x15')][this[_0x3814('0x17')][_0x40872b[_0x3814('0x36')]][_0x3814('0x36')]][_0x3814('0x32')]=_0x40872b[_0x3814('0x32')];this[_0x3814('0x15')][this[_0x3814('0x17')][_0x40872b[_0x3814('0x36')]]['linkedid']][_0x3814('0x64')]=this[_0x3814('0x15')][_0x40872b[_0x3814('0x32')]][_0x3814('0x64')];this['channels'][this[_0x3814('0x17')][_0x40872b['linkedid']]['linkedid']][_0x3814('0x65')]=this[_0x3814('0x15')][_0x40872b[_0x3814('0x32')]][_0x3814('0x65')];this[_0x3814('0x15')][this[_0x3814('0x17')][_0x40872b[_0x3814('0x36')]][_0x3814('0x36')]]['destinationchannel']=this['channels'][this[_0x3814('0x17')][_0x40872b[_0x3814('0x36')]][_0x3814('0x36')]][_0x3814('0x3b')];this[_0x3814('0x15')][this[_0x3814('0x17')][_0x40872b[_0x3814('0x36')]]['linkedid']][_0x3814('0x49')]=this[_0x3814('0x15')][_0x40872b[_0x3814('0x32')]][_0x3814('0x49')];this[_0x3814('0x15')][_0x40872b[_0x3814('0x32')]]=this[_0x3814('0x15')][this[_0x3814('0x17')][_0x40872b[_0x3814('0x36')]]['linkedid']];this['deleteChannelAfterTimeout'](this[_0x3814('0x17')][_0x40872b[_0x3814('0x36')]][_0x3814('0x36')]);}else if(this[_0x3814('0x15')][this[_0x3814('0x17')][_0x40872b['linkedid']]['uniqueid']]){this[_0x3814('0x15')][this[_0x3814('0x17')][_0x40872b['linkedid']][_0x3814('0x32')]][_0x3814('0x32')]=[this['channels'][this['blindTransfers'][_0x40872b['linkedid']][_0x3814('0x32')]][_0x3814('0x36')],this[_0x3814('0x15')][this[_0x3814('0x17')][_0x40872b['linkedid']][_0x3814('0x32')]][_0x3814('0x36')]=this[_0x3814('0x15')][this[_0x3814('0x17')][_0x40872b[_0x3814('0x36')]][_0x3814('0x32')]]['uniqueid']][0x0];this['channels'][this[_0x3814('0x17')][_0x40872b[_0x3814('0x36')]][_0x3814('0x32')]][_0x3814('0x64')]=this[_0x3814('0x15')][_0x40872b[_0x3814('0x32')]][_0x3814('0x64')];this[_0x3814('0x15')][this[_0x3814('0x17')][_0x40872b[_0x3814('0x36')]]['uniqueid']][_0x3814('0x65')]=this[_0x3814('0x15')][_0x40872b[_0x3814('0x32')]]['answertime'];this[_0x3814('0x15')][this[_0x3814('0x17')][_0x40872b[_0x3814('0x36')]]['uniqueid']][_0x3814('0x67')]=this['channels'][this[_0x3814('0x17')][_0x40872b[_0x3814('0x36')]][_0x3814('0x32')]][_0x3814('0x3b')];this['channels'][this[_0x3814('0x17')][_0x40872b[_0x3814('0x36')]][_0x3814('0x32')]]['disposition']=this[_0x3814('0x15')][_0x40872b[_0x3814('0x32')]][_0x3814('0x49')];this[_0x3814('0x15')][_0x40872b[_0x3814('0x32')]]=this[_0x3814('0x15')][this['blindTransfers'][_0x40872b[_0x3814('0x36')]][_0x3814('0x32')]];this['deleteChannelAfterTimeout'](this[_0x3814('0x17')][_0x40872b[_0x3814('0x36')]]['uniqueid']);}}if(this[_0x3814('0x15')][_0x40872b[_0x3814('0x32')]]){logger['info'](_0x3814('0x91'),_0x40872b[_0x3814('0x32')],_0x40872b[_0x3814('0x92')]);var _0x3a2c07=moment();this[_0x3814('0x15')][_0x40872b[_0x3814('0x32')]][_0x3814('0x93')]=_0x3a2c07[_0x3814('0x41')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3814('0x15')][_0x40872b['uniqueid']][_0x3814('0x57')]=_0x3a2c07['diff'](this[_0x3814('0x15')][_0x40872b[_0x3814('0x32')]][_0x3814('0x56')],_0x3814('0x59'));if(this[_0x3814('0x15')][_0x40872b[_0x3814('0x32')]]['answered']){this[_0x3814('0x15')][_0x40872b[_0x3814('0x32')]][_0x3814('0x94')]=_0x3a2c07[_0x3814('0x66')](this[_0x3814('0x15')][_0x40872b['uniqueid']][_0x3814('0x65')],_0x3814('0x59'));this[_0x3814('0x15')][_0x40872b[_0x3814('0x32')]][_0x3814('0x6a')]=this[_0x3814('0x15')][_0x40872b[_0x3814('0x32')]][_0x3814('0x57')]-this[_0x3814('0x15')][_0x40872b['uniqueid']][_0x3814('0x94')];}if(_0x40872b['context']===_0x3814('0x4c')){if(this['agents'][_0x40872b[_0x3814('0x3b')]['split']('-')[0x0]]){this['agents'][_0x40872b[_0x3814('0x3b')][_0x3814('0x3c')]('-')[0x0]]=_[_0x3814('0x95')](this[_0x3814('0x16')][_0x40872b[_0x3814('0x3b')][_0x3814('0x3c')]('-')[0x0]],[_0x3814('0x3f')]);logger['debug'](_0x3814('0x96'),_0x40872b[_0x3814('0x32')],util[_0x3814('0x2c')]({'id':this[_0x3814('0x16')][_0x40872b[_0x3814('0x3b')][_0x3814('0x3c')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x40872b[_0x3814('0x3b')][_0x3814('0x3c')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this['emit'](util[_0x3814('0x41')](_0x3814('0x42'),this[_0x3814('0x16')][_0x40872b['channel'][_0x3814('0x3c')]('-')[0x0]]['name']),_0x3814('0x97'),{'id':this['agents'][_0x40872b[_0x3814('0x3b')]['split']('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x40872b[_0x3814('0x3b')][_0x3814('0x3c')]('-')[0x0]][_0x3814('0x4f')]});for(var _0x24e0f1=0x0;_0x24e0f1{delete this[_0x3814('0x15')][_0x1a2b82];},_0x2a2054);}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0xcb66=['BlindTransfer','transfereruniqueid','transfererchannel','BLIND','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','mohstarttime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','set','playback','NO\x20ANSWER','FAILED','ANSWERED','redis','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','newstate','syncNewState','syncVarSet','hangup','syncHangup','newcallerid','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','keys','context','channel','xcally-motion-preview','destconnectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','merge','pick','from-sip','split','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','emit','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','queue','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','includes','lastapplication','lastdata','startsWith','cdr(','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','holdtime','diff','connectedlinenum','connectedlinename','destinationchannel','membername','answered','answertime','UserId','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','monitorFilename','find','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','parse','sipcallid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','cause-txt','endtime','omit','user:agentcomplete','length','transferType','resolve','then','transferToInternal','isEmpty','monitors','getSettings','catch','Action','StopMixMonitor','finally','event','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','outbound','routeid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum'];(function(_0x4f7a71,_0x30be7c){var _0x4ed97f=function(_0x53de66){while(--_0x53de66){_0x4f7a71['push'](_0x4f7a71['shift']());}};_0x4ed97f(++_0x30be7c);}(_0xcb66,0x19c));var _0x6cb6=function(_0x319e2e,_0x2f727f){_0x319e2e=_0x319e2e-0x0;var _0x302524=_0xcb66[_0x319e2e];return _0x302524;};'use strict';var _=require(_0x6cb6('0x0'));var moment=require(_0x6cb6('0x1'));var util=require(_0x6cb6('0x2'));var path=require(_0x6cb6('0x3'));var Redis=require(_0x6cb6('0x4'));var config=require(_0x6cb6('0x5'));var logger=require(_0x6cb6('0x6'))(_0x6cb6('0x7'));var ami=require(_0x6cb6('0x8'));var Channel=require('../model/channel');var RpcSetting=require('../rpc/setting');var applications=[_0x6cb6('0x9'),'queue','agi','dial',_0x6cb6('0xa'),'voicemail'];var dispositions=[_0x6cb6('0xb'),'FAILED',_0x6cb6('0xc'),'NO\x20ANSWER','NO\x20ANSWER',_0x6cb6('0xb'),_0x6cb6('0xd'),'BUSY','FAILED',_0x6cb6('0xc'),_0x6cb6('0xc')];config[_0x6cb6('0xe')]=_['defaults'](config[_0x6cb6('0xe')],{'host':'localhost','port':0x18eb});var io=require(_0x6cb6('0xf'))(new Redis(config[_0x6cb6('0xe')]));function VoiceCallReport(_0x51c627){this[_0x6cb6('0x10')]=_0x51c627[_0x6cb6('0x10')];this['agents']=_0x51c627[_0x6cb6('0x11')];this[_0x6cb6('0x12')]={};ami['on'](_0x6cb6('0x13'),this[_0x6cb6('0x14')][_0x6cb6('0x15')](this));ami['on'](_0x6cb6('0x16'),this['syncNewExten'][_0x6cb6('0x15')](this));ami['on'](_0x6cb6('0x17'),this['syncNewChannel'][_0x6cb6('0x15')](this));ami['on'](_0x6cb6('0x18'),this[_0x6cb6('0x19')][_0x6cb6('0x15')](this));ami['on']('varset',this[_0x6cb6('0x1a')][_0x6cb6('0x15')](this));ami['on'](_0x6cb6('0x1b'),this[_0x6cb6('0x1c')][_0x6cb6('0x15')](this));ami['on'](_0x6cb6('0x1d'),this['syncNewCallerId']['bind'](this));ami['on']('attendedtransfer',this[_0x6cb6('0x1e')][_0x6cb6('0x15')](this));ami['on'](_0x6cb6('0x1f'),this[_0x6cb6('0x20')][_0x6cb6('0x15')](this));ami['on'](_0x6cb6('0x21'),this[_0x6cb6('0x22')][_0x6cb6('0x15')](this));ami['on'](_0x6cb6('0x23'),this[_0x6cb6('0x24')][_0x6cb6('0x15')](this));try{logger[_0x6cb6('0x25')]('[voiceCallReport][coreshowchannels]\x20started');ami['actionCoreShowChannels']();}catch(_0x421702){logger[_0x6cb6('0x26')](_0x6cb6('0x27'),util[_0x6cb6('0x28')](_0x421702,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x6cb6('0x29')][_0x6cb6('0x2a')]=function(_0x14df6b){return _0x14df6b!==null&&!_[_0x6cb6('0x2b')](_0x14df6b);};VoiceCallReport[_0x6cb6('0x29')]['emit']=function(_0x19ff94,_0x41fdb6,_0x19a577){io['to'](_0x19ff94)['emit'](_0x41fdb6,_0x19a577);};VoiceCallReport[_0x6cb6('0x29')][_0x6cb6('0x2c')]=function(_0x109b74){try{if(this[_0x6cb6('0x2a')](_0x109b74)){logger['info'](_0x6cb6('0x2d'),_0x109b74[_0x6cb6('0x2e')],_0x109b74[_0x6cb6('0x2f')],_0x109b74[_0x6cb6('0x30')]);logger[_0x6cb6('0x31')](_0x6cb6('0x32'),_0x109b74[_0x6cb6('0x2e')],util[_0x6cb6('0x28')](_0x109b74,{'showHidden':![],'depth':null}));if(_0x109b74[_0x6cb6('0x2e')]===_0x109b74[_0x6cb6('0x33')]){if(!_[_0x6cb6('0x2b')](this[_0x6cb6('0x10')][_0x109b74[_0x6cb6('0x2e')]])){_['merge'](this[_0x6cb6('0x10')][_0x109b74[_0x6cb6('0x2e')]],_['pick'](_0x109b74,_[_0x6cb6('0x34')](this[_0x6cb6('0x10')][_0x109b74[_0x6cb6('0x2e')]])));}}if(_0x109b74[_0x6cb6('0x35')]==='from-sip'){var _0x434c8b=this['agents'][_0x109b74[_0x6cb6('0x36')]['split']('-')[0x0]];if(_0x434c8b){if(_0x109b74['exten']==_0x6cb6('0x37')){_0x434c8b[_0x6cb6('0x38')]=_0x109b74['connectedlinenum'];this['emit'](util[_0x6cb6('0x39')](_0x6cb6('0x3a'),_0x434c8b[_0x6cb6('0x3b')]),_0x6cb6('0x3c'),{'id':_0x434c8b['id'],'destaccountcode':_0x434c8b[_0x6cb6('0x3d')],'destconnectedlinenum':_0x109b74['connectedlinenum']});}}}}}catch(_0x2d81d3){logger['error'](_0x6cb6('0x3e'),_0x109b74[_0x6cb6('0x2e')],util[_0x6cb6('0x28')](_0x2d81d3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x29')]['syncNewChannel']=function(_0x14fbbb){try{if(this[_0x6cb6('0x2a')](_0x14fbbb)){logger[_0x6cb6('0x31')](_0x6cb6('0x3f'),_0x14fbbb[_0x6cb6('0x2e')],util['inspect'](_0x14fbbb,{'showHidden':![],'depth':null}));if(this['channels'][_0x14fbbb[_0x6cb6('0x2e')]]){return;}if(_0x14fbbb[_0x6cb6('0x36')]===_0x6cb6('0x40')){return;}if(_0x14fbbb[_0x6cb6('0x2e')]!==_0x14fbbb[_0x6cb6('0x33')]&&!this[_0x6cb6('0x12')][_0x14fbbb[_0x6cb6('0x33')]]){return;}logger[_0x6cb6('0x25')](_0x6cb6('0x41'),_0x14fbbb[_0x6cb6('0x2e')],_0x14fbbb[_0x6cb6('0x35')],_0x14fbbb[_0x6cb6('0x42')]);this['channels'][_0x14fbbb[_0x6cb6('0x2e')]]=new Channel();this[_0x6cb6('0x10')][_0x14fbbb['uniqueid']][_0x6cb6('0x43')]=moment()[_0x6cb6('0x39')](_0x6cb6('0x44'));this[_0x6cb6('0x10')][_0x14fbbb[_0x6cb6('0x2e')]][_0x6cb6('0x45')]=dispositions[_[_0x6cb6('0x46')](_0x14fbbb[_0x6cb6('0x47')])];_[_0x6cb6('0x48')](this['channels'][_0x14fbbb[_0x6cb6('0x2e')]],_[_0x6cb6('0x49')](_0x14fbbb,_[_0x6cb6('0x34')](this[_0x6cb6('0x10')][_0x14fbbb['uniqueid']])));if(_0x14fbbb['context']===_0x6cb6('0x4a')){var _0x5547e6=this[_0x6cb6('0x11')][_0x14fbbb[_0x6cb6('0x36')][_0x6cb6('0x4b')]('-')[0x0]];if(_0x5547e6&&typeof _0x5547e6[_0x6cb6('0x38')]===_0x6cb6('0x4c')){_0x5547e6[_0x6cb6('0x38')]=_0x14fbbb[_0x6cb6('0x42')];logger[_0x6cb6('0x31')](_0x6cb6('0x4d'),_0x14fbbb[_0x6cb6('0x2e')],util[_0x6cb6('0x28')]({'id':_0x5547e6['id'],'destaccountcode':_0x5547e6[_0x6cb6('0x3d')],'destconnectedlinenum':_0x14fbbb[_0x6cb6('0x42')]},{'showHidden':![],'depth':null}));this[_0x6cb6('0x4e')](util[_0x6cb6('0x39')](_0x6cb6('0x3a'),_0x5547e6[_0x6cb6('0x3b')]),_0x6cb6('0x3c'),{'id':_0x5547e6['id'],'destaccountcode':_0x5547e6[_0x6cb6('0x3d')],'destconnectedlinenum':_0x14fbbb[_0x6cb6('0x42')]});}}}}catch(_0x33cec4){logger[_0x6cb6('0x26')](_0x6cb6('0x4f'),_0x14fbbb[_0x6cb6('0x2e')],util[_0x6cb6('0x28')](_0x33cec4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x29')][_0x6cb6('0x14')]=function(_0x242525){try{if(this[_0x6cb6('0x2a')](_0x242525)){logger[_0x6cb6('0x31')](_0x6cb6('0x50'),_0x242525['uniqueid'],util['inspect'](_0x242525,{'showHidden':![],'depth':null}));if(_0x242525['channel']==='OutgoingSpoolFailed'||_0x242525[_0x6cb6('0x42')]==='h')return;if(_0x242525[_0x6cb6('0x2e')]===_0x242525[_0x6cb6('0x33')]||this[_0x6cb6('0x12')][_0x242525[_0x6cb6('0x33')]]){_0x242525[_0x6cb6('0x51')]=_0x242525[_0x6cb6('0x51')]?_0x242525[_0x6cb6('0x51')][_0x6cb6('0x52')]():undefined;_0x242525[_0x6cb6('0x53')]=_0x242525[_0x6cb6('0x54')]||_0x242525['applicationdata'];if(_0x242525['appdata']&&_0x242525[_0x6cb6('0x51')]!==_0x6cb6('0x55')){_0x242525[_0x6cb6('0x53')]=_0x242525[_0x6cb6('0x53')][_0x6cb6('0x52')]();}logger['info'](_0x6cb6('0x56'),_0x242525['uniqueid'],_0x242525[_0x6cb6('0x51')],_0x242525[_0x6cb6('0x53')]);if(_[_0x6cb6('0x2b')](this['channels'][_0x242525[_0x6cb6('0x2e')]])){this[_0x6cb6('0x10')][_0x242525['uniqueid']]=new Channel();this[_0x6cb6('0x10')][_0x242525[_0x6cb6('0x2e')]][_0x6cb6('0x43')]=_0x242525['duration']?moment()['subtract'](moment[_0x6cb6('0x57')](_0x242525[_0x6cb6('0x57')])[_0x6cb6('0x58')](),_0x6cb6('0x58'))['format'](_0x6cb6('0x44')):moment()[_0x6cb6('0x39')](_0x6cb6('0x44'));this['channels'][_0x242525[_0x6cb6('0x2e')]][_0x6cb6('0x45')]='NO\x20ANSWER';}_[_0x6cb6('0x48')](this[_0x6cb6('0x10')][_0x242525[_0x6cb6('0x2e')]],_[_0x6cb6('0x49')](_0x242525,_[_0x6cb6('0x34')](this[_0x6cb6('0x10')][_0x242525['uniqueid']])));if(_[_0x6cb6('0x59')](applications,_0x242525[_0x6cb6('0x51')])){this[_0x6cb6('0x10')][_0x242525['uniqueid']][_0x6cb6('0x5a')]=_0x242525['application'];this['channels'][_0x242525[_0x6cb6('0x2e')]][_0x6cb6('0x5b')]=_0x242525[_0x6cb6('0x53')];if(_0x242525[_0x6cb6('0x51')]===_0x6cb6('0x9')&&_[_0x6cb6('0x5c')](_0x242525[_0x6cb6('0x53')]['toLowerCase'](),_0x6cb6('0x5d'))){var _0x57c9fe=_0x242525['applicationdata'][_0x6cb6('0x4b')]('=');var _0x513540=_0x57c9fe[0x0][_0x6cb6('0x52')]()['match'](/cdr\((.*)\)/);if(_0x513540){if(_0x513540[0x1]===_0x6cb6('0x5e')&&!_[_0x6cb6('0x5f')](this[_0x6cb6('0x10')][_0x242525[_0x6cb6('0x2e')]][_0x513540[0x1]]))return;this['channels'][_0x242525[_0x6cb6('0x2e')]][_0x513540[0x1]]=_0x57c9fe[0x1];}}else if(_0x242525[_0x6cb6('0x51')]===_0x6cb6('0x55')){this['channels'][_0x242525['uniqueid']][_0x6cb6('0x55')]=_0x242525[_0x6cb6('0x53')][_0x6cb6('0x4b')](',')[0x0];}}}}}catch(_0x4ebabf){logger['error'](_0x6cb6('0x60'),_0x242525[_0x6cb6('0x2e')],util['inspect'](_0x4ebabf,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x29')][_0x6cb6('0x19')]=function(_0x425d2b){try{if(this[_0x6cb6('0x2a')](_0x425d2b)){logger[_0x6cb6('0x25')](_0x6cb6('0x61'),_0x425d2b[_0x6cb6('0x2e')],_0x425d2b[_0x6cb6('0x33')],_0x425d2b[_0x6cb6('0x2f')],_0x425d2b[_0x6cb6('0x30')]);logger['debug']('[%s][voiceCallReport][newstate]\x20event:',_0x425d2b[_0x6cb6('0x2e')],util[_0x6cb6('0x28')](_0x425d2b,{'showHidden':![],'depth':null}));if(_0x425d2b[_0x6cb6('0x47')]!=='6')return;var _0x526aae=this['agents'][_0x425d2b[_0x6cb6('0x36')][_0x6cb6('0x4b')]('-')[0x0]];if(_0x425d2b[_0x6cb6('0x2e')]!==_0x425d2b[_0x6cb6('0x33')]){var _0x3a9d7b=moment();if(this['channels'][_0x425d2b[_0x6cb6('0x33')]]){if(!this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x33')]]['answered']){this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x33')]]['answered']=!![];this['channels'][_0x425d2b[_0x6cb6('0x33')]]['answertime']=_0x3a9d7b['format'](_0x6cb6('0x44'));if(this[_0x6cb6('0x10')][_0x425d2b['linkedid']][_0x6cb6('0x43')]){this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x33')]][_0x6cb6('0x62')]=_0x3a9d7b[_0x6cb6('0x63')](this['channels'][_0x425d2b[_0x6cb6('0x33')]][_0x6cb6('0x43')],_0x6cb6('0x58'));}}this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x33')]][_0x6cb6('0x33')]=_0x425d2b[_0x6cb6('0x2e')];if(_0x425d2b[_0x6cb6('0x30')]!=='xcally-motion-preview'){this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x33')]][_0x6cb6('0x64')]=_0x425d2b[_0x6cb6('0x30')];}this[_0x6cb6('0x10')][_0x425d2b['linkedid']][_0x6cb6('0x65')]=_0x425d2b[_0x6cb6('0x2f')];this['channels'][_0x425d2b['linkedid']][_0x6cb6('0x66')]=_0x425d2b[_0x6cb6('0x36')];this[_0x6cb6('0x10')][_0x425d2b['linkedid']]['disposition']=dispositions[_[_0x6cb6('0x46')](_0x425d2b[_0x6cb6('0x47')])];if(_0x526aae){this[_0x6cb6('0x10')][_0x425d2b['linkedid']]['UserId']=_0x526aae['id'];this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x33')]][_0x6cb6('0x67')]=_0x526aae[_0x6cb6('0x3b')];}}if(this[_0x6cb6('0x10')][_0x425d2b['uniqueid']]){if(!this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x2e')]]['answered']){this['channels'][_0x425d2b['uniqueid']][_0x6cb6('0x68')]=!![];this['channels'][_0x425d2b['uniqueid']][_0x6cb6('0x69')]=_0x3a9d7b[_0x6cb6('0x39')]('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x425d2b[_0x6cb6('0x2e')]][_0x6cb6('0x43')]){this['channels'][_0x425d2b[_0x6cb6('0x2e')]][_0x6cb6('0x62')]=_0x3a9d7b[_0x6cb6('0x63')](this[_0x6cb6('0x10')][_0x425d2b['uniqueid']][_0x6cb6('0x43')],'seconds');}}if(_0x425d2b[_0x6cb6('0x30')]!=='xcally-motion-preview'){this['channels'][_0x425d2b[_0x6cb6('0x2e')]][_0x6cb6('0x64')]=_0x425d2b[_0x6cb6('0x30')];}this[_0x6cb6('0x10')][_0x425d2b['uniqueid']][_0x6cb6('0x65')]=_0x425d2b[_0x6cb6('0x2f')];this[_0x6cb6('0x10')][_0x425d2b['uniqueid']]['destinationchannel']=_0x425d2b[_0x6cb6('0x36')];this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x2e')]][_0x6cb6('0x45')]=dispositions[_['toNumber'](_0x425d2b[_0x6cb6('0x47')])];}}else{if(this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x2e')]]){if(_0x526aae){this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x2e')]][_0x6cb6('0x6a')]=_0x526aae['id'];this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x2e')]]['membername']=_0x526aae[_0x6cb6('0x3b')];}}}if(_0x425d2b['context']===_0x6cb6('0x4a')){if(_0x526aae){_0x526aae[_0x6cb6('0x38')]=_0x425d2b[_0x6cb6('0x42')];var _0x293d4e;if(this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x2e')]]){_0x293d4e=this['channels'][_0x425d2b[_0x6cb6('0x2e')]][_0x6cb6('0x55')];}else if(this['channels'][_0x425d2b[_0x6cb6('0x33')]]){_0x293d4e=this[_0x6cb6('0x10')][_0x425d2b[_0x6cb6('0x33')]][_0x6cb6('0x55')];}_0x526aae[_0x6cb6('0x55')]=_0x293d4e;var _0x4a3e5b={'id':_0x526aae['id'],'name':_0x526aae['name'],'agentconnected':!![],'destaccountcode':_0x526aae[_0x6cb6('0x3d')],'destconnectedlinenum':_0x425d2b[_0x6cb6('0x42')],'queue':_0x293d4e||undefined,'uniqueid':_0x425d2b['linkedid']};logger[_0x6cb6('0x31')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x425d2b[_0x6cb6('0x2e')],util[_0x6cb6('0x28')](_0x4a3e5b,{'showHidden':![],'depth':null}));this[_0x6cb6('0x4e')](util['format'](_0x6cb6('0x3a'),_0x526aae['name']),'user:agentconnect',_0x4a3e5b);}}}}catch(_0x18f588){logger[_0x6cb6('0x26')](_0x6cb6('0x6b'),_0x425d2b['uniqueid'],util['inspect'](_0x18f588,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x29')][_0x6cb6('0x6c')]=function(_0x2d2d8b,_0xe23799){try{if(this[_0x6cb6('0x10')][_0x2d2d8b]){logger[_0x6cb6('0x25')](_0x6cb6('0x6d'),_0x2d2d8b,_0xe23799);this['channels'][_0x2d2d8b][_0x6cb6('0x6e')]=!![];if(_[_0x6cb6('0x6f')](_0xe23799,_0x6cb6('0x70'))){_0xe23799=_0xe23799[_0x6cb6('0x71')](_0x6cb6('0x70'),'.WAV');}this[_0x6cb6('0x10')][_0x2d2d8b][_0x6cb6('0x72')]=_0xe23799;var _0x3c1445=_[_0x6cb6('0x73')](this[_0x6cb6('0x10')][_0x2d2d8b]['monitors'],{'filename':_0xe23799});if(_[_0x6cb6('0x5f')](_0x3c1445)){this['channels'][_0x2d2d8b]['monitors'][_0x6cb6('0x74')]({'filename':_0xe23799,'createdAt':moment()[_0x6cb6('0x39')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x6cb6('0x75')});}}}catch(_0x4e170a){logger[_0x6cb6('0x26')](_0x6cb6('0x76'),_0x2d2d8b,util[_0x6cb6('0x28')](_0x4e170a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x29')][_0x6cb6('0x1a')]=function(_0x552eb8){try{if(this[_0x6cb6('0x2a')](_0x552eb8)){logger[_0x6cb6('0x31')](_0x6cb6('0x77'),_0x552eb8['uniqueid'],util[_0x6cb6('0x28')](_0x552eb8,{'showHidden':![],'depth':null}));if(this[_0x6cb6('0x10')][_0x552eb8[_0x6cb6('0x2e')]]&&_0x552eb8['channel']!='OutgoingSpoolFailed'){if(this[_0x6cb6('0x2a')](_0x552eb8['variable'])){if(this[_0x6cb6('0x2a')](_0x552eb8[_0x6cb6('0x78')]['mixmonitor_filename'])){logger[_0x6cb6('0x25')](_0x6cb6('0x79'),_0x552eb8[_0x6cb6('0x2e')],_0x552eb8[_0x6cb6('0x7a')]);this['syncMixMonitorFilename'](_0x552eb8['uniqueid'],_0x552eb8[_0x6cb6('0x7a')]);}else if(this[_0x6cb6('0x2a')](_0x552eb8[_0x6cb6('0x78')][_0x6cb6('0x7b')])){logger[_0x6cb6('0x25')](_0x6cb6('0x7c'),_0x552eb8[_0x6cb6('0x2e')],_0x552eb8[_0x6cb6('0x7a')]);this[_0x6cb6('0x10')][_0x552eb8['uniqueid']][_0x6cb6('0x30')]=_0x552eb8[_0x6cb6('0x7a')];}else if(this[_0x6cb6('0x2a')](_0x552eb8[_0x6cb6('0x78')][_0x6cb6('0x7d')])){logger[_0x6cb6('0x25')](_0x6cb6('0x7e'),_0x552eb8[_0x6cb6('0x2e')],_0x552eb8[_0x6cb6('0x7a')]);this[_0x6cb6('0x10')][_0x552eb8['uniqueid']][_0x6cb6('0x7f')]=_0x552eb8[_0x6cb6('0x7a')];}else if(this[_0x6cb6('0x2a')](_0x552eb8['variable'][_0x6cb6('0x80')])){logger[_0x6cb6('0x25')](_0x6cb6('0x81'),_0x552eb8[_0x6cb6('0x2e')],_0x552eb8[_0x6cb6('0x7a')]);this[_0x6cb6('0x10')][_0x552eb8[_0x6cb6('0x2e')]]['type']=_0x552eb8[_0x6cb6('0x7a')];}else if(this[_0x6cb6('0x2a')](_0x552eb8[_0x6cb6('0x78')]['xmd-queue'])){logger[_0x6cb6('0x25')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x552eb8[_0x6cb6('0x2e')],_0x552eb8[_0x6cb6('0x7a')][_0x6cb6('0x4b')](',')[0x0]);this[_0x6cb6('0x10')][_0x552eb8[_0x6cb6('0x2e')]][_0x6cb6('0x55')]=_0x552eb8[_0x6cb6('0x7a')][_0x6cb6('0x4b')](',')[0x0];}else if(this['isNotNull'](_0x552eb8[_0x6cb6('0x78')][_0x6cb6('0x82')])){logger[_0x6cb6('0x25')](_0x6cb6('0x83'),_0x552eb8[_0x6cb6('0x2e')],_0x552eb8[_0x6cb6('0x7a')]);this[_0x6cb6('0x10')][_0x552eb8['uniqueid']][_0x6cb6('0x84')]=_0x552eb8[_0x6cb6('0x7a')];}else if(this['isNotNull'](_0x552eb8[_0x6cb6('0x78')][_0x6cb6('0x85')])){logger['info'](_0x6cb6('0x86'),_0x552eb8[_0x6cb6('0x2e')],_0x552eb8[_0x6cb6('0x7a')]);this[_0x6cb6('0x10')][_0x552eb8[_0x6cb6('0x2e')]]['destination']=_0x552eb8[_0x6cb6('0x7a')];}else if(this[_0x6cb6('0x2a')](_0x552eb8[_0x6cb6('0x78')][_0x6cb6('0x87')])){logger[_0x6cb6('0x25')](_0x6cb6('0x88'),_0x552eb8[_0x6cb6('0x2e')],_0x552eb8[_0x6cb6('0x7a')]);this[_0x6cb6('0x10')][_0x552eb8[_0x6cb6('0x2e')]][_0x6cb6('0x89')]=_0x552eb8[_0x6cb6('0x7a')];}else if(this[_0x6cb6('0x2a')](_0x552eb8[_0x6cb6('0x78')][_0x6cb6('0x8a')])){logger[_0x6cb6('0x25')](_0x6cb6('0x8b'),_0x552eb8[_0x6cb6('0x2e')],_0x552eb8[_0x6cb6('0x7a')]);this[_0x6cb6('0x10')][_0x552eb8['uniqueid']]['queue']=_0x552eb8[_0x6cb6('0x7a')];}else if(this['isNotNull'](_0x552eb8[_0x6cb6('0x78')]['sipcallid'])){logger[_0x6cb6('0x25')](_0x6cb6('0x8c'),_0x552eb8['uniqueid'],_0x552eb8['value']);this[_0x6cb6('0x10')][_0x552eb8[_0x6cb6('0x2e')]][_0x6cb6('0x8d')]=_0x552eb8['value'];}}}else if(this[_0x6cb6('0x2a')](_0x552eb8[_0x6cb6('0x78')][_0x6cb6('0x8e')])){if(_0x552eb8[_0x6cb6('0x7a')]){var _0x9bcf01=path[_0x6cb6('0x8f')](_0x552eb8['value'])['name'];logger[_0x6cb6('0x25')](_0x6cb6('0x79'),_0x9bcf01,_0x552eb8['value']);this['syncMixMonitorFilename'](_0x9bcf01,_0x552eb8[_0x6cb6('0x7a')]);}}else if(this['channels'][_0x552eb8['linkedid']]){if(this[_0x6cb6('0x2a')](_0x552eb8['variable'])){if(this[_0x6cb6('0x2a')](_0x552eb8[_0x6cb6('0x78')][_0x6cb6('0x90')])){logger[_0x6cb6('0x25')](_0x6cb6('0x8c'),_0x552eb8[_0x6cb6('0x33')],_0x552eb8['value']);this[_0x6cb6('0x10')][_0x552eb8[_0x6cb6('0x33')]]['sipcalllinkedid']=_0x552eb8[_0x6cb6('0x7a')];}}}}}catch(_0x50666e){logger[_0x6cb6('0x26')](_0x6cb6('0x91'),_0x552eb8[_0x6cb6('0x2e')],util[_0x6cb6('0x28')](_0x50666e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x29')][_0x6cb6('0x1c')]=function(_0x335511){try{if(this['isNotNull'](_0x335511)){logger['debug'](_0x6cb6('0x92'),_0x335511[_0x6cb6('0x2e')],util[_0x6cb6('0x28')](_0x335511,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x335511[_0x6cb6('0x33')]]){if(this[_0x6cb6('0x10')][this['blindTransfers'][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x33')]]){this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511['linkedid']]['linkedid']][_0x6cb6('0x2e')]=_0x335511[_0x6cb6('0x2e')];this[_0x6cb6('0x10')][this['blindTransfers'][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x33')]]['answered']=this['channels'][_0x335511['uniqueid']][_0x6cb6('0x68')];this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]]['linkedid']]['answertime']=this[_0x6cb6('0x10')][_0x335511['uniqueid']]['answertime'];this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x33')]]['destinationchannel']=this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x33')]][_0x6cb6('0x36')];this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]]['linkedid']][_0x6cb6('0x45')]=this[_0x6cb6('0x10')][_0x335511[_0x6cb6('0x2e')]][_0x6cb6('0x45')];this['channels'][_0x335511['uniqueid']]=this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]]['linkedid']];this['deleteChannelAfterTimeout'](this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x33')]);}else if(this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x2e')]]){this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x2e')]][_0x6cb6('0x2e')]=[this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x2e')]][_0x6cb6('0x33')],this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511['linkedid']][_0x6cb6('0x2e')]]['linkedid']=this[_0x6cb6('0x10')][this['blindTransfers'][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x2e')]][_0x6cb6('0x2e')]][0x0];this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511['linkedid']][_0x6cb6('0x2e')]][_0x6cb6('0x68')]=this[_0x6cb6('0x10')][_0x335511[_0x6cb6('0x2e')]][_0x6cb6('0x68')];this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x2e')]][_0x6cb6('0x69')]=this[_0x6cb6('0x10')][_0x335511[_0x6cb6('0x2e')]][_0x6cb6('0x69')];this['channels'][this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]]['uniqueid']][_0x6cb6('0x66')]=this[_0x6cb6('0x10')][this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x2e')]][_0x6cb6('0x36')];this['channels'][this['blindTransfers'][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x2e')]][_0x6cb6('0x45')]=this['channels'][_0x335511[_0x6cb6('0x2e')]][_0x6cb6('0x45')];this[_0x6cb6('0x10')][_0x335511[_0x6cb6('0x2e')]]=this[_0x6cb6('0x10')][this['blindTransfers'][_0x335511[_0x6cb6('0x33')]]['uniqueid']];this['deleteChannelAfterTimeout'](this[_0x6cb6('0x12')][_0x335511[_0x6cb6('0x33')]][_0x6cb6('0x2e')]);}}if(this[_0x6cb6('0x10')][_0x335511[_0x6cb6('0x2e')]]){logger[_0x6cb6('0x25')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x335511[_0x6cb6('0x2e')],_0x335511[_0x6cb6('0x93')]);var _0x5959b3=moment();this[_0x6cb6('0x10')][_0x335511['uniqueid']][_0x6cb6('0x94')]=_0x5959b3[_0x6cb6('0x39')](_0x6cb6('0x44'));this[_0x6cb6('0x10')][_0x335511[_0x6cb6('0x2e')]][_0x6cb6('0x57')]=_0x5959b3[_0x6cb6('0x63')](this[_0x6cb6('0x10')][_0x335511[_0x6cb6('0x2e')]][_0x6cb6('0x43')],'seconds');if(this[_0x6cb6('0x10')][_0x335511[_0x6cb6('0x2e')]]['answered']){this[_0x6cb6('0x10')][_0x335511[_0x6cb6('0x2e')]]['billableseconds']=_0x5959b3[_0x6cb6('0x63')](this[_0x6cb6('0x10')][_0x335511[_0x6cb6('0x2e')]][_0x6cb6('0x69')],_0x6cb6('0x58'));this['channels'][_0x335511['uniqueid']]['holdtime']=this['channels'][_0x335511[_0x6cb6('0x2e')]]['duration']-this['channels'][_0x335511[_0x6cb6('0x2e')]]['billableseconds'];}if(_0x335511[_0x6cb6('0x35')]===_0x6cb6('0x4a')){if(this[_0x6cb6('0x11')][_0x335511['channel'][_0x6cb6('0x4b')]('-')[0x0]]){this['agents'][_0x335511[_0x6cb6('0x36')][_0x6cb6('0x4b')]('-')[0x0]]=_[_0x6cb6('0x95')](this['agents'][_0x335511[_0x6cb6('0x36')]['split']('-')[0x0]],['destconnectedlinenum']);logger[_0x6cb6('0x31')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x335511[_0x6cb6('0x2e')],util[_0x6cb6('0x28')]({'id':this['agents'][_0x335511['channel'][_0x6cb6('0x4b')]('-')[0x0]]['id'],'destaccountcode':this[_0x6cb6('0x11')][_0x335511['channel'][_0x6cb6('0x4b')]('-')[0x0]][_0x6cb6('0x3d')]},{'showHidden':![],'depth':null}));this[_0x6cb6('0x4e')](util[_0x6cb6('0x39')](_0x6cb6('0x3a'),this[_0x6cb6('0x11')][_0x335511['channel'][_0x6cb6('0x4b')]('-')[0x0]][_0x6cb6('0x3b')]),_0x6cb6('0x96'),{'id':this['agents'][_0x335511[_0x6cb6('0x36')][_0x6cb6('0x4b')]('-')[0x0]]['id'],'destaccountcode':this[_0x6cb6('0x11')][_0x335511[_0x6cb6('0x36')][_0x6cb6('0x4b')]('-')[0x0]][_0x6cb6('0x3d')]});for(var _0x6769da=0x0;_0x6769da{delete this[_0x6cb6('0x10')][_0x431c55];},_0x441479);}};module[_0x6cb6('0xc6')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 0da32c5..21775ff 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 _0x25f0=['answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','channels','outbound','applications','variables','syncDialBegin','bind','dialend','syncDialEnd','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','debug','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','substring','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','emit','voice:outbound','custom:dialbegin','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','memberdynamic','memberlastcall','memberrealtime','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','complete','total'];(function(_0x3d542c,_0x2098ae){var _0x4946de=function(_0x51171f){while(--_0x51171f){_0x3d542c['push'](_0x3d542c['shift']());}};_0x4946de(++_0x2098ae);}(_0x25f0,0x108));var _0x025f=function(_0x499b93,_0x5b114a){_0x499b93=_0x499b93-0x0;var _0x35c422=_0x25f0[_0x499b93];return _0x35c422;};'use strict';var _=require(_0x025f('0x0'));var moment=require(_0x025f('0x1'));var util=require(_0x025f('0x2'));var Redis=require(_0x025f('0x3'));var config=require(_0x025f('0x4'));var logger=require(_0x025f('0x5'))(_0x025f('0x6'));var ami=require(_0x025f('0x7'));config['redis']=_[_0x025f('0x8')](config[_0x025f('0x9')],{'host':_0x025f('0xa'),'port':0x18eb});var io=require(_0x025f('0xb'))(new Redis(config[_0x025f('0x9')]));function VoiceDialReport(_0x5d74fb){this[_0x025f('0xc')]=_0x5d74fb['outboundChannels'];this[_0x025f('0xd')]=_0x5d74fb[_0x025f('0xd')];this[_0x025f('0xe')]={};this[_0x025f('0xf')]={};ami['on']('dialbegin',this[_0x025f('0x10')][_0x025f('0x11')](this));ami['on'](_0x025f('0x12'),this[_0x025f('0x13')][_0x025f('0x11')](this));ami['on']('varset',this[_0x025f('0x14')]['bind'](this));ami['on'](_0x025f('0x15'),this[_0x025f('0x16')][_0x025f('0x11')](this));}VoiceDialReport[_0x025f('0x17')][_0x025f('0x18')]=function(_0x51d1eb){return _0x51d1eb!==null&&!_[_0x025f('0x19')](_0x51d1eb);};VoiceDialReport[_0x025f('0x17')]['emit']=function(_0x4e58ab,_0x51d599,_0x429347){io['to'](_0x4e58ab)['emit'](_0x51d599,_0x429347);};VoiceDialReport[_0x025f('0x17')]['syncDialBegin']=function(_0x4ff809){try{if(this[_0x025f('0x18')](_0x4ff809)){logger[_0x025f('0x1a')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x4ff809[_0x025f('0x1b')],util[_0x025f('0x1c')](_0x4ff809,{'showHidden':![],'depth':null}));if(this['channels'][_0x4ff809['uniqueid']]){_[_0x025f('0x1d')](this[_0x025f('0xc')][_0x4ff809[_0x025f('0x1b')]],{'starttime':moment()[_0x025f('0x1e')](_0x025f('0x1f')),'lastevent':_0x025f('0x20'),'interface':_0x4ff809[_0x025f('0x21')]['substring'](0x0,_0x4ff809[_0x025f('0x21')][_0x025f('0x22')]('-')),'membername':_0x4ff809[_0x025f('0x21')][_0x025f('0x23')](_0x4ff809[_0x025f('0x21')][_0x025f('0x22')]('/')+0x1,_0x4ff809['channel'][_0x025f('0x22')]('-'))},_[_0x025f('0x24')](_0x4ff809,[_0x025f('0x25'),_0x025f('0x26')]));logger[_0x025f('0x27')](_0x025f('0x28'),_0x4ff809['uniqueid'],this[_0x025f('0xc')][_0x4ff809[_0x025f('0x1b')]][_0x025f('0x29')],this['channels'][_0x4ff809[_0x025f('0x1b')]][_0x025f('0x2a')]);logger[_0x025f('0x1a')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x4ff809[_0x025f('0x1b')],util[_0x025f('0x1c')](this[_0x025f('0xc')][_0x4ff809['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0x025f('0xe')][_0x4ff809['uniqueid']])_['merge'](this[_0x025f('0xc')][_0x4ff809[_0x025f('0x1b')]],this[_0x025f('0xe')][_0x4ff809[_0x025f('0x1b')]]);this[_0x025f('0x2b')](_0x025f('0x2c'),'voice_outbound_channel:save',this[_0x025f('0xc')][_0x4ff809['uniqueid']]);logger[_0x025f('0x1a')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x4ff809[_0x025f('0x1b')],util[_0x025f('0x1c')](this[_0x025f('0xc')][_0x4ff809['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x025f('0x2b')](_0x025f('0x2d'),this['channels'][_0x4ff809[_0x025f('0x1b')]]);}}}catch(_0x1c33e7){logger[_0x025f('0x2e')]('[%s][voiceDialReport][dialbegin]',_0x4ff809[_0x025f('0x1b')],util[_0x025f('0x1c')](_0x1c33e7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x025f('0x17')][_0x025f('0x13')]=function(_0x39a228){try{if(this[_0x025f('0x18')](_0x39a228)){logger[_0x025f('0x1a')](_0x025f('0x2f'),_0x39a228[_0x025f('0x1b')],util[_0x025f('0x1c')](_0x39a228,{'showHidden':![],'depth':null}));if(this[_0x025f('0xc')][_0x39a228[_0x025f('0x1b')]]){this['channels'][_0x39a228[_0x025f('0x1b')]][_0x025f('0x30')]=_0x39a228['dialstatus'];if(_0x39a228[_0x025f('0x30')]==='ANSWER'){this[_0x025f('0xc')][_0x39a228[_0x025f('0x1b')]][_0x025f('0x31')]=_0x39a228[_0x025f('0x31')];this[_0x025f('0xc')][_0x39a228[_0x025f('0x1b')]]['connectedlinename']=_0x39a228['connectedlinename'];this[_0x025f('0xc')][_0x39a228['uniqueid']][_0x025f('0x32')]=moment()[_0x025f('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x025f('0xc')][_0x39a228[_0x025f('0x1b')]][_0x025f('0x33')]=_0x025f('0x34');logger['info'](_0x025f('0x35'),_0x39a228['uniqueid'],_0x39a228[_0x025f('0x21')][_0x025f('0x23')](_0x39a228[_0x025f('0x21')][_0x025f('0x22')]('/')+0x1,_0x39a228[_0x025f('0x21')][_0x025f('0x22')]('-')));logger[_0x025f('0x1a')](_0x025f('0x36'),_0x39a228['uniqueid'],util['inspect'](this[_0x025f('0xc')][_0x39a228[_0x025f('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x025f('0x2b')]('custom:dialconnect',this[_0x025f('0xc')][_0x39a228['uniqueid']]);}logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x39a228[_0x025f('0x1b')],util[_0x025f('0x1c')](this['channels'][_0x39a228[_0x025f('0x1b')]],{'showHidden':![],'depth':null}));this['emit'](_0x025f('0x2c'),_0x025f('0x37'),this[_0x025f('0xc')][_0x39a228[_0x025f('0x1b')]]);}}}catch(_0x5ddf94){logger[_0x025f('0x2e')](_0x025f('0x38'),_0x39a228[_0x025f('0x1b')],util['inspect'](_0x5ddf94,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x025f('0x17')][_0x025f('0x14')]=function(_0x320742){try{if(this[_0x025f('0x18')](_0x320742)){logger[_0x025f('0x1a')](_0x025f('0x39'),_0x320742[_0x025f('0x1b')],util[_0x025f('0x1c')](_0x320742,{'showHidden':![],'depth':null}));this[_0x025f('0x3a')](_0x320742['uniqueid'],_[_0x025f('0x3b')](_0x320742[_0x025f('0x3c')])[0x0],_0x320742['value']);if(this[_0x025f('0x18')](_0x320742[_0x025f('0x3c')])&&this['isNotNull'](_0x320742[_0x025f('0x3c')]['outboundrouteid'])){if(_['isUndefined'](this[_0x025f('0xc')][_0x320742['uniqueid']])){this[_0x025f('0xc')][_0x320742[_0x025f('0x1b')]]={'routeId':_0x320742[_0x025f('0x3d')],'variables':this[_0x025f('0xf')][_0x320742[_0x025f('0x1b')]],'motionChannel':_0x025f('0x3e')};logger[_0x025f('0x27')](_0x025f('0x3f'),_0x320742[_0x025f('0x1b')],_0x320742['variable'][_0x025f('0x40')],_[_0x025f('0x3b')](_0x320742[_0x025f('0x3c')])[0x0],_0x320742[_0x025f('0x3d')]);logger[_0x025f('0x1a')](_0x025f('0x41'),_0x320742['uniqueid'],util['inspect'](this[_0x025f('0xc')][_0x320742[_0x025f('0x1b')]],{'showHidden':![],'depth':null}));this[_0x025f('0x2b')](_0x025f('0x2c'),_0x025f('0x37'),this[_0x025f('0xc')][_0x320742[_0x025f('0x1b')]]);}}}}catch(_0x1122a3){logger[_0x025f('0x2e')]('[%s][voiceDialReport][varset]',_0x320742[_0x025f('0x1b')],util['inspect'](_0x1122a3,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x025f('0x17')][_0x025f('0x3a')]=function(_0x2eaee9,_0x33e533,_0x394f6c){var _0x49bfc0=[_0x025f('0x42'),_0x025f('0x43'),_0x025f('0x44'),'rtpaudioqosjitterbridged',_0x025f('0x45'),_0x025f('0x46'),_0x025f('0x47'),_0x025f('0x48'),_0x025f('0x49'),'sipuri',_0x025f('0x4a'),_0x025f('0x4b'),'membercalls',_0x025f('0x4c'),'memberinterface',_0x025f('0x4d'),'membername','memberpenalty',_0x025f('0x4e')];if(!_['isNil'](_0x33e533)&&!_[_0x025f('0x4f')](_0x49bfc0,_0x33e533)){if(_[_0x025f('0x19')](this[_0x025f('0xf')][_0x2eaee9])){this[_0x025f('0xf')][_0x2eaee9]={};}this['variables'][_0x2eaee9][_0x33e533]=_0x394f6c;}};VoiceDialReport['prototype']['syncHangup']=function(_0x5eb041){try{if(this[_0x025f('0x18')](_0x5eb041)){logger['debug'](_0x025f('0x50'),_0x5eb041[_0x025f('0x1b')],util[_0x025f('0x1c')](_0x5eb041,{'showHidden':![],'depth':null}));if(this[_0x025f('0xc')][_0x5eb041['uniqueid']]){logger[_0x025f('0x27')](_0x025f('0x51'),_0x5eb041[_0x025f('0x1b')],_0x5eb041[_0x025f('0x52')]);this[_0x025f('0xc')][_0x5eb041['uniqueid']][_0x025f('0x53')]=moment()[_0x025f('0x1e')](_0x025f('0x1f'));this['channels'][_0x5eb041[_0x025f('0x1b')]][_0x025f('0x54')]=moment(this[_0x025f('0xc')][_0x5eb041['uniqueid']][_0x025f('0x53')])[_0x025f('0x55')](this[_0x025f('0xc')][_0x5eb041[_0x025f('0x1b')]][_0x025f('0x56')],_0x025f('0x57'));this['channels'][_0x5eb041[_0x025f('0x1b')]]['lastevent']=_0x025f('0x58');this[_0x025f('0xd')][_0x025f('0x59')]+=0x1;if(this['channels'][_0x5eb041[_0x025f('0x1b')]][_0x025f('0x32')]){this[_0x025f('0xd')][_0x025f('0x5a')]+=0x1;this['channels'][_0x5eb041[_0x025f('0x1b')]][_0x025f('0x5b')]=moment(this[_0x025f('0xc')][_0x5eb041[_0x025f('0x1b')]][_0x025f('0x32')])[_0x025f('0x55')](this[_0x025f('0xc')][_0x5eb041[_0x025f('0x1b')]]['starttime'],_0x025f('0x57'));this[_0x025f('0xc')][_0x5eb041['uniqueid']][_0x025f('0x5c')]=moment(this[_0x025f('0xc')][_0x5eb041[_0x025f('0x1b')]]['endtime'])['diff'](this[_0x025f('0xc')][_0x5eb041[_0x025f('0x1b')]][_0x025f('0x32')],_0x025f('0x57'));this[_0x025f('0xd')][_0x025f('0x5d')]+=this[_0x025f('0xc')][_0x5eb041['uniqueid']]['holdtime']||0x0;this[_0x025f('0xd')][_0x025f('0x5e')]+=this[_0x025f('0xc')][_0x5eb041['uniqueid']][_0x025f('0x5c')];}this[_0x025f('0xd')][_0x025f('0x5f')]+=this[_0x025f('0xc')][_0x5eb041[_0x025f('0x1b')]][_0x025f('0x54')];logger['debug'](_0x025f('0x60'),_0x5eb041[_0x025f('0x1b')],util[_0x025f('0x1c')](this['channels'][_0x5eb041[_0x025f('0x1b')]],{'showHidden':![],'depth':null}));ami['emit'](_0x025f('0x61'),this[_0x025f('0xc')][_0x5eb041[_0x025f('0x1b')]]);logger['debug'](_0x025f('0x62'),_0x5eb041[_0x025f('0x1b')],util[_0x025f('0x1c')](this[_0x025f('0xc')][_0x5eb041[_0x025f('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x025f('0x2b')](_0x025f('0x63'),this[_0x025f('0xc')][_0x5eb041['uniqueid']]);logger[_0x025f('0x1a')](_0x025f('0x64'),_0x5eb041[_0x025f('0x1b')],util[_0x025f('0x1c')](this[_0x025f('0xc')][_0x5eb041[_0x025f('0x1b')]],{'showHidden':![],'depth':null}));this[_0x025f('0x2b')](_0x025f('0x2c'),_0x025f('0x65'),this[_0x025f('0xd')]);logger[_0x025f('0x27')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this[_0x025f('0xc')][_0x5eb041[_0x025f('0x1b')]]));logger['debug'](_0x025f('0x66'),_0x5eb041[_0x025f('0x1b')],util[_0x025f('0x1c')](this['channels'][_0x5eb041['uniqueid']],{'showHidden':![],'depth':null}));this[_0x025f('0x2b')]('voice:outbound',_0x025f('0x67'),this[_0x025f('0xc')][_0x5eb041[_0x025f('0x1b')]]);this[_0x025f('0x68')](_0x5eb041[_0x025f('0x1b')]);}else if(this[_0x025f('0xc')][_0x5eb041[_0x025f('0x69')]]){this[_0x025f('0xc')][_0x5eb041[_0x025f('0x69')]][_0x025f('0x1b')]=this[_0x025f('0xc')][_0x5eb041[_0x025f('0x69')]][_0x025f('0x6a')];}if(this[_0x025f('0xf')][_0x5eb041[_0x025f('0x1b')]]){delete this[_0x025f('0xf')][_0x5eb041[_0x025f('0x1b')]];}}}catch(_0x44100a){logger[_0x025f('0x2e')](_0x025f('0x6b'),_0x5eb041[_0x025f('0x1b')],util['inspect'](_0x44100a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x025f('0x17')]['syncNewExten']=function(_0x25cc20){try{if(this[_0x025f('0x18')](_0x25cc20)){logger['debug'](_0x025f('0x6c'),_0x25cc20['uniqueid'],util[_0x025f('0x1c')](_0x25cc20,{'showHidden':![],'depth':null}));if(_0x25cc20['application'][_0x025f('0x6d')]()==='set'){_0x25cc20[_0x025f('0x6e')]=(_0x25cc20[_0x025f('0x6f')]||_0x25cc20[_0x025f('0x6e')])['toLowerCase']();if(_[_0x025f('0x70')](_0x25cc20[_0x025f('0x6e')],_0x025f('0x71'))){if(_['isUndefined'](this[_0x025f('0xe')][_0x25cc20[_0x025f('0x1b')]]))this[_0x025f('0xe')][_0x25cc20['uniqueid']]={};logger['info'](_0x025f('0x72'),_0x25cc20[_0x025f('0x1b')],_0x25cc20['application'],_0x25cc20[_0x025f('0x6e')]);var _0x3ae821=_0x25cc20[_0x025f('0x6e')][_0x025f('0x73')]('=');var _0x2f5a8f=_0x3ae821[0x0][_0x025f('0x74')](/cdr\((.*)\)/);if(_0x2f5a8f)this['applications'][_0x25cc20[_0x025f('0x1b')]][_0x2f5a8f[0x1]]=_0x3ae821[0x1];}}}}catch(_0x314330){logger[_0x025f('0x2e')](_0x025f('0x75'),_0x25cc20['uniqueid'],util[_0x025f('0x1c')](_0x314330,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x025f('0x17')][_0x025f('0x68')]=function(_0x1b70e6,_0x12579d=0x2710){if(this['channels'][_0x1b70e6]){setTimeout(()=>{delete this[_0x025f('0xc')][_0x1b70e6];},_0x12579d);}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0x4020=['[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','channels','outboundChannels','outbound','applications','variables','dialbegin','bind','varset','syncVarSet','hangup','syncHangup','prototype','isUndefined','emit','isNotNull','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','substring','omit','event','privilege','info','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','answertime','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0x4020,0x1f0));var _0x0402=function(_0x5d6968,_0x4f7cef){_0x5d6968=_0x5d6968-0x0;var _0x131ead=_0x4020[_0x5d6968];return _0x131ead;};'use strict';var _=require('lodash');var moment=require(_0x0402('0x0'));var util=require(_0x0402('0x1'));var Redis=require(_0x0402('0x2'));var config=require(_0x0402('0x3'));var logger=require(_0x0402('0x4'))(_0x0402('0x5'));var ami=require('../ami');config[_0x0402('0x6')]=_[_0x0402('0x7')](config[_0x0402('0x6')],{'host':_0x0402('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0402('0x6')]));function VoiceDialReport(_0x48f4d2){this[_0x0402('0x9')]=_0x48f4d2[_0x0402('0xa')];this[_0x0402('0xb')]=_0x48f4d2[_0x0402('0xb')];this[_0x0402('0xc')]={};this[_0x0402('0xd')]={};ami['on'](_0x0402('0xe'),this['syncDialBegin']['bind'](this));ami['on']('dialend',this['syncDialEnd'][_0x0402('0xf')](this));ami['on'](_0x0402('0x10'),this[_0x0402('0x11')]['bind'](this));ami['on'](_0x0402('0x12'),this[_0x0402('0x13')]['bind'](this));}VoiceDialReport[_0x0402('0x14')]['isNotNull']=function(_0x3e9d6c){return _0x3e9d6c!==null&&!_[_0x0402('0x15')](_0x3e9d6c);};VoiceDialReport['prototype'][_0x0402('0x16')]=function(_0x907f68,_0x5959af,_0x1648e1){io['to'](_0x907f68)[_0x0402('0x16')](_0x5959af,_0x1648e1);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x59000d){try{if(this[_0x0402('0x17')](_0x59000d)){logger['debug'](_0x0402('0x18'),_0x59000d[_0x0402('0x19')],util['inspect'](_0x59000d,{'showHidden':![],'depth':null}));if(this[_0x0402('0x9')][_0x59000d[_0x0402('0x19')]]){_[_0x0402('0x1a')](this[_0x0402('0x9')][_0x59000d[_0x0402('0x19')]],{'starttime':moment()[_0x0402('0x1b')](_0x0402('0x1c')),'lastevent':'called','interface':_0x59000d[_0x0402('0x1d')]['substring'](0x0,_0x59000d['channel'][_0x0402('0x1e')]('-')),'membername':_0x59000d[_0x0402('0x1d')][_0x0402('0x1f')](_0x59000d[_0x0402('0x1d')][_0x0402('0x1e')]('/')+0x1,_0x59000d[_0x0402('0x1d')]['lastIndexOf']('-'))},_[_0x0402('0x20')](_0x59000d,[_0x0402('0x21'),_0x0402('0x22')]));logger[_0x0402('0x23')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x59000d[_0x0402('0x19')],this[_0x0402('0x9')][_0x59000d['uniqueid']]['membername'],this['channels'][_0x59000d[_0x0402('0x19')]][_0x0402('0x24')]);logger[_0x0402('0x25')](_0x0402('0x26'),_0x59000d[_0x0402('0x19')],util[_0x0402('0x27')](this[_0x0402('0x9')][_0x59000d[_0x0402('0x19')]],{'showHidden':![],'depth':null}));if(this[_0x0402('0xc')][_0x59000d[_0x0402('0x19')]])_[_0x0402('0x1a')](this['channels'][_0x59000d[_0x0402('0x19')]],this[_0x0402('0xc')][_0x59000d['uniqueid']]);this[_0x0402('0x16')](_0x0402('0x28'),_0x0402('0x29'),this['channels'][_0x59000d[_0x0402('0x19')]]);logger['debug']('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x59000d[_0x0402('0x19')],util[_0x0402('0x27')](this['channels'][_0x59000d[_0x0402('0x19')]],{'showHidden':![],'depth':null}));ami[_0x0402('0x16')](_0x0402('0x2a'),this[_0x0402('0x9')][_0x59000d[_0x0402('0x19')]]);}}}catch(_0x5d75e5){logger[_0x0402('0x2b')](_0x0402('0x2c'),_0x59000d['uniqueid'],util[_0x0402('0x27')](_0x5d75e5,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0402('0x14')][_0x0402('0x2d')]=function(_0x25d163){try{if(this[_0x0402('0x17')](_0x25d163)){logger[_0x0402('0x25')](_0x0402('0x2e'),_0x25d163[_0x0402('0x19')],util[_0x0402('0x27')](_0x25d163,{'showHidden':![],'depth':null}));if(this[_0x0402('0x9')][_0x25d163['uniqueid']]){this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]][_0x0402('0x2f')]=_0x25d163[_0x0402('0x2f')];if(_0x25d163['dialstatus']===_0x0402('0x30')){this[_0x0402('0x9')][_0x25d163['uniqueid']]['connectedlinenum']=_0x25d163['connectedlinenum'];this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]]['connectedlinename']=_0x25d163['connectedlinename'];this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]][_0x0402('0x31')]=moment()[_0x0402('0x1b')](_0x0402('0x1c'));this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]]['lastevent']=_0x0402('0x32');logger[_0x0402('0x23')](_0x0402('0x33'),_0x25d163['uniqueid'],_0x25d163[_0x0402('0x1d')][_0x0402('0x1f')](_0x25d163['channel'][_0x0402('0x1e')]('/')+0x1,_0x25d163['channel'][_0x0402('0x1e')]('-')));logger['debug'](_0x0402('0x34'),_0x25d163['uniqueid'],util[_0x0402('0x27')](this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]],{'showHidden':![],'depth':null}));ami[_0x0402('0x16')](_0x0402('0x35'),this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]]);}logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x25d163[_0x0402('0x19')],util[_0x0402('0x27')](this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound','voice_outbound_channel:save',this[_0x0402('0x9')][_0x25d163[_0x0402('0x19')]]);}}}catch(_0x2b1d7f){logger['error'](_0x0402('0x36'),_0x25d163['uniqueid'],util[_0x0402('0x27')](_0x2b1d7f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0402('0x14')][_0x0402('0x11')]=function(_0x3d4004){try{if(this['isNotNull'](_0x3d4004)){logger[_0x0402('0x25')](_0x0402('0x37'),_0x3d4004['uniqueid'],util[_0x0402('0x27')](_0x3d4004,{'showHidden':![],'depth':null}));this[_0x0402('0x38')](_0x3d4004[_0x0402('0x19')],_[_0x0402('0x39')](_0x3d4004[_0x0402('0x3a')])[0x0],_0x3d4004[_0x0402('0x3b')]);if(this[_0x0402('0x17')](_0x3d4004[_0x0402('0x3a')])&&this[_0x0402('0x17')](_0x3d4004[_0x0402('0x3a')][_0x0402('0x3c')])){if(_['isUndefined'](this[_0x0402('0x9')][_0x3d4004[_0x0402('0x19')]])){this['channels'][_0x3d4004[_0x0402('0x19')]]={'routeId':_0x3d4004[_0x0402('0x3b')],'variables':this[_0x0402('0xd')][_0x3d4004[_0x0402('0x19')]],'motionChannel':_0x0402('0x3d')};logger[_0x0402('0x23')](_0x0402('0x3e'),_0x3d4004[_0x0402('0x19')],_0x3d4004[_0x0402('0x3a')][_0x0402('0x3c')],_[_0x0402('0x39')](_0x3d4004[_0x0402('0x3a')])[0x0],_0x3d4004[_0x0402('0x3b')]);logger[_0x0402('0x25')](_0x0402('0x3f'),_0x3d4004[_0x0402('0x19')],util['inspect'](this[_0x0402('0x9')][_0x3d4004[_0x0402('0x19')]],{'showHidden':![],'depth':null}));this[_0x0402('0x16')]('voice:outbound',_0x0402('0x29'),this['channels'][_0x3d4004['uniqueid']]);}}}}catch(_0x1db004){logger[_0x0402('0x2b')](_0x0402('0x40'),_0x3d4004[_0x0402('0x19')],util[_0x0402('0x27')](_0x1db004,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x0402('0x38')]=function(_0x1d2087,_0x1e74cd,_0x178ee2){var _0x2d06ab=[_0x0402('0x41'),_0x0402('0x42'),_0x0402('0x43'),_0x0402('0x44'),_0x0402('0x45'),_0x0402('0x46'),_0x0402('0x47'),_0x0402('0x48'),_0x0402('0x49'),'sipuri',_0x0402('0x4a'),'bridgepvtcallid',_0x0402('0x4b'),_0x0402('0x4c'),_0x0402('0x4d'),_0x0402('0x4e'),_0x0402('0x4f'),_0x0402('0x50'),_0x0402('0x51')];if(!_[_0x0402('0x52')](_0x1e74cd)&&!_[_0x0402('0x53')](_0x2d06ab,_0x1e74cd)){if(_['isUndefined'](this[_0x0402('0xd')][_0x1d2087])){this[_0x0402('0xd')][_0x1d2087]={};}this['variables'][_0x1d2087][_0x1e74cd]=_0x178ee2;}};VoiceDialReport[_0x0402('0x14')][_0x0402('0x13')]=function(_0x2ea6fe){try{if(this[_0x0402('0x17')](_0x2ea6fe)){logger[_0x0402('0x25')](_0x0402('0x54'),_0x2ea6fe[_0x0402('0x19')],util['inspect'](_0x2ea6fe,{'showHidden':![],'depth':null}));if(this[_0x0402('0x9')][_0x2ea6fe['uniqueid']]){logger[_0x0402('0x23')](_0x0402('0x55'),_0x2ea6fe[_0x0402('0x19')],_0x2ea6fe[_0x0402('0x56')]);this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]][_0x0402('0x57')]=moment()['format'](_0x0402('0x1c'));this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]][_0x0402('0x58')]=moment(this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]][_0x0402('0x57')])[_0x0402('0x59')](this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]][_0x0402('0x5a')],_0x0402('0x5b'));this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]]['lastevent']='complete';this[_0x0402('0xb')]['total']+=0x1;if(this[_0x0402('0x9')][_0x2ea6fe['uniqueid']][_0x0402('0x31')]){this[_0x0402('0xb')]['answered']+=0x1;this[_0x0402('0x9')][_0x2ea6fe['uniqueid']][_0x0402('0x5c')]=moment(this['channels'][_0x2ea6fe['uniqueid']][_0x0402('0x31')])['diff'](this[_0x0402('0x9')][_0x2ea6fe['uniqueid']][_0x0402('0x5a')],_0x0402('0x5b'));this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]][_0x0402('0x5d')]=moment(this[_0x0402('0x9')][_0x2ea6fe['uniqueid']][_0x0402('0x57')])[_0x0402('0x59')](this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]]['answertime'],'seconds');this[_0x0402('0xb')][_0x0402('0x5e')]+=this['channels'][_0x2ea6fe['uniqueid']][_0x0402('0x5c')]||0x0;this[_0x0402('0xb')][_0x0402('0x5f')]+=this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]][_0x0402('0x5d')];}this[_0x0402('0xb')][_0x0402('0x60')]+=this['channels'][_0x2ea6fe[_0x0402('0x19')]][_0x0402('0x58')];logger[_0x0402('0x25')](_0x0402('0x61'),_0x2ea6fe[_0x0402('0x19')],util[_0x0402('0x27')](this[_0x0402('0x9')][_0x2ea6fe['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x0402('0x16')](_0x0402('0x62'),this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]]);logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x2ea6fe[_0x0402('0x19')],util[_0x0402('0x27')](this['channels'][_0x2ea6fe[_0x0402('0x19')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0402('0x63'),this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]]);logger[_0x0402('0x25')](_0x0402('0x64'),_0x2ea6fe[_0x0402('0x19')],util['inspect'](this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]],{'showHidden':![],'depth':null}));this[_0x0402('0x16')]('voice:outbound',_0x0402('0x65'),this[_0x0402('0xb')]);logger['info'](_0x0402('0x66'),JSON[_0x0402('0x67')](this[_0x0402('0x9')][_0x2ea6fe['uniqueid']]));logger[_0x0402('0x25')](_0x0402('0x68'),_0x2ea6fe[_0x0402('0x19')],util['inspect'](this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]],{'showHidden':![],'depth':null}));this['emit'](_0x0402('0x28'),'voice_outbound_channel:remove',this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x19')]]);this[_0x0402('0x69')](_0x2ea6fe[_0x0402('0x19')]);}else if(this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x6a')]]){this[_0x0402('0x9')][_0x2ea6fe[_0x0402('0x6a')]][_0x0402('0x19')]=this[_0x0402('0x9')][_0x2ea6fe['linkedid']][_0x0402('0x6b')];}if(this[_0x0402('0xd')][_0x2ea6fe[_0x0402('0x19')]]){delete this['variables'][_0x2ea6fe['uniqueid']];}}}catch(_0x114ffd){logger[_0x0402('0x2b')](_0x0402('0x6c'),_0x2ea6fe[_0x0402('0x19')],util[_0x0402('0x27')](_0x114ffd,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x0402('0x6d')]=function(_0xf3c05d){try{if(this['isNotNull'](_0xf3c05d)){logger[_0x0402('0x25')](_0x0402('0x6e'),_0xf3c05d[_0x0402('0x19')],util[_0x0402('0x27')](_0xf3c05d,{'showHidden':![],'depth':null}));if(_0xf3c05d['application'][_0x0402('0x6f')]()==='set'){_0xf3c05d[_0x0402('0x70')]=(_0xf3c05d[_0x0402('0x71')]||_0xf3c05d[_0x0402('0x70')])[_0x0402('0x6f')]();if(_[_0x0402('0x72')](_0xf3c05d['applicationdata'],_0x0402('0x73'))){if(_[_0x0402('0x15')](this[_0x0402('0xc')][_0xf3c05d[_0x0402('0x19')]]))this[_0x0402('0xc')][_0xf3c05d[_0x0402('0x19')]]={};logger[_0x0402('0x23')](_0x0402('0x74'),_0xf3c05d[_0x0402('0x19')],_0xf3c05d['application'],_0xf3c05d[_0x0402('0x70')]);var _0x373971=_0xf3c05d[_0x0402('0x70')][_0x0402('0x75')]('=');var _0xd04699=_0x373971[0x0][_0x0402('0x76')](/cdr\((.*)\)/);if(_0xd04699)this[_0x0402('0xc')][_0xf3c05d[_0x0402('0x19')]][_0xd04699[0x1]]=_0x373971[0x1];}}}}catch(_0x24ed10){logger[_0x0402('0x2b')]('[%s][voiceDialReport][newexten]',_0xf3c05d[_0x0402('0x19')],util[_0x0402('0x27')](_0x24ed10,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0402('0x14')]['deleteChannelAfterTimeout']=function(_0x1d2f8b,_0x476647=0x2710){if(this[_0x0402('0x9')][_0x1d2f8b]){setTimeout(()=>{delete this[_0x0402('0x9')][_0x1d2f8b];},_0x476647);}};module[_0x0402('0x77')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 568b028..bd9fffc 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 _0xc530=['[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','clearZombieChannels','queues','[voiceQueueReport][queues]','isRunning','queuesummary','then','queuestatus','actionid','[voiceQueueReport][queuesummary]','name','summaryEvent','createReport','realtime','handleInboundQueueSummaryReport','compareToInboundQueue','assign','outbound','statusRequests','push','syncQueueSummary','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','keys','[%s][voiceQueueReport][queuecallerjoin]','[%s][voiceQueueReport][queuecallerabandon]','queuecallercompleteAt','holdtime','originalposition','lastAssignedTo','last','queuecallerleaveAt','connectedlinenum','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','[%s][voiceQueueReport][queuecallerleave]','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','queuecallerabandonAt','membername','queuecallerexitAt','transfer','reason','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','linkedid','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','variable','value','CONTINUE','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','addVariable','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','includes','handleHangup','length','sumHoldTime','sumDuration','milliseconds','diff','total','answered','sumBillable','unmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][handleHangup]','[%s][voiceQueueReport][hangup]','cause-txt','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','transferuniqueid','secondtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','transferid','secondtransfererexten','BLINDTRANSFER','context','transfererchannel','[%s][voiceQueueReport][blindtransfer]','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','applicationdata','match','[%s][voiceQueueReport][newexten]','deleteChannelAfterTimeout','exports','util','ioredis','../../../config/logger','../ami','../model/queueReport','../model/voiceQueueSummary','defaults','redis','localhost','prototype','enqueue','tail','sequence','agents','voiceQueues','campaigns','summary','variables','bind','syncQueueSummaryComplete','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','originated','hasOwnProperty','talking','pTalking','waiting','queueStatusComplete','unlockRR','queuecallerexit','queuecallercomplete','switch','isNil','channels','Action','channel','catch','message','No\x20such\x20channel','[%s][voiceQueueReport][checkChannel]','inspect','queueReports','[%s][voiceQueueReport][checkQueueReport]','error','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','queue','uniqueid','queuecallerexitreason','ATTENDEDTRANSFER','voice:queue:%s','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','inbound'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc530,0x90));var _0x0c53=function(_0x29632e,_0x5ecba4){_0x29632e=_0x29632e-0x0;var _0x426e04=_0xc530[_0x29632e];return _0x426e04;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x0c53('0x0'));var Redis=require(_0x0c53('0x1'));var config=require('../../../config/environment');var logger=require(_0x0c53('0x2'))('ami');var ami=require(_0x0c53('0x3'));var QueueReport=require(_0x0c53('0x4'));var VoiceQueueSummary=require(_0x0c53('0x5'));config['redis']=_[_0x0c53('0x6')](config[_0x0c53('0x7')],{'host':_0x0c53('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0c53('0x7')]));var Sequence=function(){};Sequence[_0x0c53('0x9')][_0x0c53('0xa')]=function(_0x549c23){this[_0x0c53('0xb')]=this[_0x0c53('0xb')]?this[_0x0c53('0xb')]['finally'](_0x549c23):_0x549c23();};function VoiceQueueReport(_0x4b4381){this[_0x0c53('0xc')]=new Sequence();this['queueReports']={};this['realtime']=_0x4b4381;this[_0x0c53('0xd')]=_0x4b4381[_0x0c53('0xd')];this['channels']=_0x4b4381['queueChannels'];this[_0x0c53('0xe')]=_0x4b4381[_0x0c53('0xe')];this['campaigns']=_0x4b4381[_0x0c53('0xf')];this[_0x0c53('0x10')]=initializeSummary();this[_0x0c53('0x11')]={};ami['on']('queuesummary',this['syncQueueSummary'][_0x0c53('0x12')](this));ami['on']('queuesummarycomplete',this[_0x0c53('0x13')]['bind'](this));ami['on'](_0x0c53('0x14'),this[_0x0c53('0x15')][_0x0c53('0x12')](this));ami['on'](_0x0c53('0x16'),this[_0x0c53('0x17')][_0x0c53('0x12')](this));ami['on'](_0x0c53('0x18'),this[_0x0c53('0x19')]['bind'](this));ami['on'](_0x0c53('0x1a'),this[_0x0c53('0x1b')][_0x0c53('0x12')](this));ami['on'](_0x0c53('0x1c'),this[_0x0c53('0x1d')]['bind'](this));ami['on']('agentcomplete',this[_0x0c53('0x1e')][_0x0c53('0x12')](this));ami['on'](_0x0c53('0x1f'),this[_0x0c53('0x20')][_0x0c53('0x12')](this));ami['on'](_0x0c53('0x21'),this[_0x0c53('0x22')][_0x0c53('0x12')](this));ami['on'](_0x0c53('0x23'),this[_0x0c53('0x24')][_0x0c53('0x12')](this));ami['on'](_0x0c53('0x25'),this[_0x0c53('0x26')]['bind'](this));ami['on'](_0x0c53('0x27'),this[_0x0c53('0x28')][_0x0c53('0x12')](this));ami['on'](_0x0c53('0x29'),this[_0x0c53('0x2a')][_0x0c53('0x12')](this));ami['on'](_0x0c53('0x2b'),this[_0x0c53('0x2c')]['bind'](this));ami['on'](_0x0c53('0x2d'),this[_0x0c53('0x2e')][_0x0c53('0x12')](this));this[_0x0c53('0x2f')]();this[_0x0c53('0x30')]();}function clearChannels(_0x56efa6){if(!_[_0x0c53('0x31')](_0x56efa6)){for(var _0x2b7dd9 in _0x56efa6){if(_0x56efa6['hasOwnProperty'](_0x2b7dd9)){delete _0x56efa6[_0x2b7dd9];}}}}function clearCampaigns(_0x2954cb){if(!_[_0x0c53('0x31')](_0x2954cb)){for(var _0x117425 in _0x2954cb){if(_0x2954cb['hasOwnProperty'](_0x117425)){_0x2954cb[_0x117425][_0x0c53('0x32')]=0x0;}}}}function clearVoiceQueues(_0x1b56ea){if(!_['isEmpty'](_0x1b56ea)){for(var _0x344db2 in _0x1b56ea){if(_0x1b56ea[_0x0c53('0x33')](_0x344db2)){_0x1b56ea[_0x344db2]['originated']=0x0;_0x1b56ea[_0x344db2][_0x0c53('0x34')]=0x0;_0x1b56ea[_0x344db2][_0x0c53('0x35')]=0x0;_0x1b56ea[_0x344db2][_0x0c53('0x36')]=0x0;_0x1b56ea[_0x344db2][_0x0c53('0x37')]=!![];}}}}function clearAgentBooked(_0x481bbf){if(!_[_0x0c53('0x31')](_0x481bbf)){for(var _0x30f326 in _0x481bbf){if(_0x481bbf[_0x0c53('0x33')](_0x30f326)){_0x481bbf[_0x30f326][_0x0c53('0x38')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x404bfa){return _0x404bfa[_0x0c53('0x39')]||_0x404bfa[_0x0c53('0x1a')]||_0x404bfa[_0x0c53('0x3a')];}VoiceQueueReport['prototype']['clearZombieChannels']=function(){var _0x50a4d8=this;for(var _0xb60cf7 in this['channels']){if(this['channels'][_0x0c53('0x33')](_0xb60cf7)&&!this['channels'][_0xb60cf7][_0x0c53('0x3b')]){this[_0x0c53('0xc')]['enqueue'](function(){if(!_[_0x0c53('0x3c')](_0x50a4d8[_0x0c53('0x3d')][_0xb60cf7])){return ami[_0x0c53('0x3e')]({'action':'status','channel':_0x50a4d8[_0x0c53('0x3d')][_0xb60cf7][_0x0c53('0x3f')]})[_0x0c53('0x40')](function(_0x572a06){if(_0x572a06[_0x0c53('0x41')]===_0x0c53('0x42')){setTimeout(function(){if(_0x50a4d8[_0x0c53('0x3d')][_0xb60cf7]){delete _0x50a4d8['channels'][_0xb60cf7];logger['error'](_0x0c53('0x43'),_0xb60cf7,util[_0x0c53('0x44')](_0x572a06,{'showHidden':![],'depth':null}));}if(_0x50a4d8[_0x0c53('0x45')][_0xb60cf7]){delete _0x50a4d8[_0x0c53('0x45')][_0xb60cf7];logger['error'](_0x0c53('0x46'),_0xb60cf7,util[_0x0c53('0x44')](_0x572a06,{'showHidden':![],'depth':null}));}if(_0x50a4d8[_0x0c53('0x11')][_0xb60cf7]){delete _0x50a4d8[_0x0c53('0x11')][_0xb60cf7];logger[_0x0c53('0x47')]('[%s][voiceQueueReport][checkVariables]',_0xb60cf7,util[_0x0c53('0x44')](_0x572a06,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x0c53('0x9')][_0x0c53('0x26')]=function(){logger[_0x0c53('0x47')](_0x0c53('0x48'));clearChannels(this['channels']);this[_0x0c53('0x49')](this[_0x0c53('0x45')]);clearAgentBooked(this[_0x0c53('0xd')]);clearVoiceQueues(this[_0x0c53('0xe')]);clearCampaigns(this[_0x0c53('0xf')]);this[_0x0c53('0x10')]=initializeSummary();};VoiceQueueReport['prototype'][_0x0c53('0x49')]=function(_0x13e30d){var _0x790163=this;if(!_[_0x0c53('0x31')](_0x13e30d)){for(var _0x44b698 in _0x13e30d){if(_0x13e30d['hasOwnProperty'](_0x44b698)){_0x790163[_0x0c53('0x4a')](_0x13e30d[_0x44b698],_0x0c53('0x4b'));delete _0x13e30d[_0x44b698];}}}};VoiceQueueReport[_0x0c53('0x9')][_0x0c53('0x4c')]=function(_0x57b53d,_0x5f1e09,_0x448a46){io['to'](_0x57b53d)[_0x0c53('0x4c')](_0x5f1e09,_0x448a46);};VoiceQueueReport['prototype'][_0x0c53('0x4d')]=function(_0x58c7b6,_0x57569e){logger[_0x0c53('0x4e')](_0x0c53('0x4f')+_0x57569e+_0x0c53('0x50'),_0x58c7b6['uniqueid'],util['inspect'](_0x58c7b6,{'showHidden':![],'depth':null}));this[_0x0c53('0x4c')](util[_0x0c53('0x51')]('voice:queue:%s',_0x58c7b6[_0x0c53('0x52')]),'voice_queue_channel:save',_0x58c7b6);io[_0x0c53('0x4c')]('voice_queue_presence:save',_0x58c7b6);};VoiceQueueReport['prototype'][_0x0c53('0x4a')]=function(_0x5555ad,_0x427f52){logger[_0x0c53('0x4e')](_0x0c53('0x4f')+_0x427f52+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x5555ad[_0x0c53('0x53')],util[_0x0c53('0x44')](_0x5555ad,{'showHidden':![],'depth':null}));if(_0x5555ad[_0x0c53('0x54')]===_0x0c53('0x55')){return;}this['emit'](util[_0x0c53('0x51')](_0x0c53('0x56'),_0x5555ad[_0x0c53('0x52')]),'voice_queue_channel:remove',_0x5555ad);io['emit'](_0x0c53('0x57'),_0x5555ad);};VoiceQueueReport[_0x0c53('0x9')][_0x0c53('0x58')]=function(_0xac1ce1){if(_0xac1ce1[_0x0c53('0x59')]===_0x0c53('0x5a')){logger[_0x0c53('0x4e')](_0x0c53('0x5b'),util[_0x0c53('0x44')](_0xac1ce1,{'showHidden':![],'depth':null}));this['emit'](util[_0x0c53('0x51')](_0x0c53('0x56'),_0xac1ce1['name']),_0x0c53('0x5c'),_0xac1ce1);}};VoiceQueueReport[_0x0c53('0x9')][_0x0c53('0x5d')]=function(_0x3e0019){return _0x3e0019!==null&&!_[_0x0c53('0x5e')](_0x3e0019);};VoiceQueueReport[_0x0c53('0x9')][_0x0c53('0x30')]=function(){var _0x348400=this;setInterval(function(){_0x348400[_0x0c53('0x5f')]();ami[_0x0c53('0x3e')]({'action':_0x0c53('0x60')})[_0x0c53('0x40')](function(_0x2161ed){logger[_0x0c53('0x47')](_0x0c53('0x61'),util[_0x0c53('0x44')](_0x2161ed,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x0c53('0x9')]['loopQueueSummary']=function(){var _0x256465=this;setInterval(function(){if(!_0x256465[_0x0c53('0x10')][_0x0c53('0x62')]){return ami[_0x0c53('0x3e')]({'action':_0x0c53('0x63')})[_0x0c53('0x64')](function(_0x157da8){_0x256465['summary']['id']=_0x157da8['actionid'];_0x256465[_0x0c53('0x10')]['isRunning']=!![];_0x256465[_0x0c53('0x10')][_0x0c53('0x65')][_0x157da8[_0x0c53('0x66')]]={};})[_0x0c53('0x40')](function(_0x41c11d){logger[_0x0c53('0x47')](_0x0c53('0x67'),util[_0x0c53('0x44')](_0x41c11d,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x0c53('0x9')]['createQueueSummaryReport']=function(_0x222d48,_0x21d6e8){var _0x59c281;if(this[_0x0c53('0x10')]&&this['summary'][_0x0c53('0x60')]&&this[_0x0c53('0x10')][_0x0c53('0x60')][_0x222d48[_0x0c53('0x68')]]){_0x59c281=this['summary']['queues'][_0x222d48[_0x0c53('0x68')]][_0x0c53('0x69')];}var _0x105806=new VoiceQueueSummary(_0x222d48);return _0x105806[_0x0c53('0x6a')](_0x21d6e8[_0x0c53('0xd')],this[_0x0c53('0xd')],_0x59c281,this[_0x0c53('0x6b')][_0x0c53('0x3d')]);};VoiceQueueReport['prototype'][_0x0c53('0x6c')]=function(_0x14f014,_0x4d6c39){var _0x4966da=this['createQueueSummaryReport'](_0x14f014,_0x4d6c39);var _0x3c1037=![];_0x3c1037=_0x4966da[_0x0c53('0x6d')](_0x14f014);if(_0x3c1037){Object[_0x0c53('0x6e')](_0x14f014,_0x4966da);this['realtime'][_0x0c53('0xe')][_0x14f014[_0x0c53('0x68')]]=_0x14f014;this['emitInboundVoiceQueueSummary'](_0x4966da);}};VoiceQueueReport['prototype'][_0x0c53('0x17')]=function(_0x380a61){var _0x42211b=null;var _0x2847b8=this[_0x0c53('0x10')]['id'];if(this[_0x0c53('0x10')][_0x0c53('0x65')][_0x2847b8]){_0x42211b=this[_0x0c53('0x10')][_0x0c53('0x65')][_0x2847b8][_0x380a61[_0x0c53('0x66')]];}if(!_0x42211b){this['summary']=initializeSummary();return;}var _0x58a954=this[_0x0c53('0xe')][_0x42211b[_0x0c53('0x52')]];if(_0x58a954[_0x0c53('0x59')]==='inbound'){this[_0x0c53('0x6c')](_0x58a954,_0x42211b);}else if(_0x58a954[_0x0c53('0x59')]===_0x0c53('0x6f')){var _0x33f041=this['createQueueSummaryReport'](_0x58a954,_0x42211b);ami[_0x0c53('0x4c')]('custom:queuesummary',_0x33f041);}this[_0x0c53('0x10')][_0x0c53('0x70')]-=0x1;var _0x23fb57=this[_0x0c53('0x10')]['statusRequests']>0x0?!![]:![];if(!_0x23fb57){return this['syncQueueSummaryComplete'](this[_0x0c53('0x10')]['completeEvent']);}};VoiceQueueReport['prototype']['syncQueueMember']=function(_0x493937){var _0x4b646e=this[_0x0c53('0x10')]['id'];if(this[_0x0c53('0x10')][_0x0c53('0x65')][_0x4b646e]&&this[_0x0c53('0x10')][_0x0c53('0x65')][_0x4b646e][_0x493937[_0x0c53('0x66')]]){this[_0x0c53('0x10')][_0x0c53('0x65')][_0x4b646e][_0x493937[_0x0c53('0x66')]][_0x0c53('0xd')][_0x0c53('0x71')](_0x493937);}};VoiceQueueReport['prototype'][_0x0c53('0x72')]=function(_0x218215){var _0x1b0936=this;try{if(this[_0x0c53('0x5d')](_0x218215)&&this[_0x0c53('0x5d')](_0x218215[_0x0c53('0x52')])){logger[_0x0c53('0x4e')]('[voiceQueueReport][queuesummary]\x20event:',util['inspect'](_0x218215,{'showHidden':![],'depth':null}));var _0x2f9fbf=this[_0x0c53('0xe')][_0x218215[_0x0c53('0x52')]];if(_0x2f9fbf){logger[_0x0c53('0x4e')](_0x0c53('0x73'),_0x2f9fbf[_0x0c53('0x68')]);this[_0x0c53('0x10')][_0x0c53('0x60')][_0x2f9fbf[_0x0c53('0x68')]]={'summaryEvent':_0x218215};this[_0x0c53('0x10')][_0x0c53('0x70')]+=0x1;return ami[_0x0c53('0x3e')]({'action':_0x0c53('0x65'),'queue':_0x2f9fbf['name']})[_0x0c53('0x64')](function(_0x13d543){if(!_0x1b0936[_0x0c53('0x10')][_0x0c53('0x65')][_0x218215[_0x0c53('0x66')]]){_0x1b0936[_0x0c53('0x10')]['queuestatus'][_0x218215[_0x0c53('0x66')]]={};}_0x1b0936['summary'][_0x0c53('0x65')][_0x218215[_0x0c53('0x66')]][_0x13d543[_0x0c53('0x66')]]={'queue':_0x2f9fbf[_0x0c53('0x68')],'agents':[]};})['catch'](function(_0x1d974d){throw _0x1d974d;});}}}catch(_0x1cf3cb){logger['error'](_0x0c53('0x67'),util[_0x0c53('0x44')](_0x1cf3cb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0c53('0x9')][_0x0c53('0x13')]=function(_0x2a3626){if(this[_0x0c53('0x10')]['statusRequests']>0x0){this[_0x0c53('0x10')]['completeEvent']=_0x2a3626;return;}logger[_0x0c53('0x4e')](_0x0c53('0x74'),util[_0x0c53('0x44')](_0x2a3626,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0x0c53('0x4c')](_0x0c53('0x75'),{});};VoiceQueueReport[_0x0c53('0x9')][_0x0c53('0x19')]=function(_0x36b055){try{if(this[_0x0c53('0x5d')](_0x36b055)){logger[_0x0c53('0x4e')]('[%s][voiceQueueReport][queuecallerjoin]',_0x36b055[_0x0c53('0x53')],util['inspect'](_0x36b055,{'showHidden':![],'depth':null}));if(_[_0x0c53('0x5e')](this[_0x0c53('0x45')][_0x36b055[_0x0c53('0x53')]])){this['queueReports'][_0x36b055[_0x0c53('0x53')]]=[];}if(_[_0x0c53('0x5e')](this[_0x0c53('0x3d')][_0x36b055[_0x0c53('0x53')]])){this[_0x0c53('0x3d')][_0x36b055['uniqueid']]={};}var _0x2fe432=new QueueReport();_0x2fe432[_0x0c53('0x52')]=_0x36b055['queue'];_0x2fe432['type']=this[_0x0c53('0xe')][_0x2fe432[_0x0c53('0x52')]]&&this[_0x0c53('0xe')][_0x2fe432[_0x0c53('0x52')]][_0x0c53('0x59')]?this[_0x0c53('0xe')][_0x2fe432[_0x0c53('0x52')]]['type']||_0x0c53('0x5a'):_0x0c53('0x5a');_0x2fe432[_0x0c53('0x76')]=moment()['format'](_0x0c53('0x77'));_0x2fe432[_0x0c53('0x78')]=_0x36b055[_0x0c53('0x78')];_0x2fe432[_0x0c53('0x79')]=_0x36b055['count'];_0x2fe432[_0x0c53('0x53')]=_0x36b055['uniqueid'];logger[_0x0c53('0x7a')](_0x0c53('0x7b'),_0x2fe432[_0x0c53('0x52')],_0x2fe432[_0x0c53('0x59')]);Object[_0x0c53('0x6e')](_0x2fe432,_['pick'](_0x36b055,_[_0x0c53('0x7c')](_0x2fe432)));this[_0x0c53('0x45')][_0x36b055[_0x0c53('0x53')]]['push'](_0x2fe432);this['channels'][_0x36b055[_0x0c53('0x53')]]=_0x2fe432;this[_0x0c53('0x4d')](_0x2fe432,_0x0c53('0x18'));}}catch(_0x322fce){logger[_0x0c53('0x47')](_0x0c53('0x7d'),_0x36b055['uniqueid'],util['inspect'](_0x322fce,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0c53('0x9')][_0x0c53('0x1b')]=function(_0x12d057){try{if(this[_0x0c53('0x5d')](_0x12d057)){logger['debug'](_0x0c53('0x7e'),_0x12d057[_0x0c53('0x53')],util[_0x0c53('0x44')](_0x12d057,{'showHidden':![],'depth':null}));if(this[_0x0c53('0x45')][_0x12d057[_0x0c53('0x53')]]){var _0x19434a=_['last'](this[_0x0c53('0x45')][_0x12d057[_0x0c53('0x53')]]);_0x19434a[_0x0c53('0x3a')]=![];_0x19434a[_0x0c53('0x7f')]=null;_0x19434a[_0x0c53('0x80')]=_0x12d057[_0x0c53('0x80')];_0x19434a[_0x0c53('0x81')]=_0x12d057[_0x0c53('0x81')];_0x19434a[_0x0c53('0x1a')]=!![];_0x19434a['queuecallerabandonAt']=moment()[_0x0c53('0x51')](_0x0c53('0x77'));_0x19434a[_0x0c53('0x54')]='ABANDONED';_0x19434a[_0x0c53('0x82')]=null;logger[_0x0c53('0x7a')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x19434a[_0x0c53('0x52')],_0x19434a[_0x0c53('0x59')]);this['channels'][_0x12d057['uniqueid']]=_0x19434a;this[_0x0c53('0x4a')](_0x19434a,_0x0c53('0x1a'));}}}catch(_0x13a310){logger['error'](_0x0c53('0x7e'),_0x12d057[_0x0c53('0x53')],util[_0x0c53('0x44')](_0x13a310,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0c53('0x9')][_0x0c53('0x1d')]=function(_0xb2c81f){try{if(this['isNotNull'](_0xb2c81f)){logger[_0x0c53('0x4e')]('[%s][voiceQueueReport][queuecallerleave]',_0xb2c81f[_0x0c53('0x53')],util[_0x0c53('0x44')](_0xb2c81f,{'showHidden':![],'depth':null}));if(this[_0x0c53('0x45')][_0xb2c81f['uniqueid']]){var _0x5199b5=_[_0x0c53('0x83')](this[_0x0c53('0x45')][_0xb2c81f[_0x0c53('0x53')]]);_0x5199b5[_0x0c53('0x84')]=moment()[_0x0c53('0x51')](_0x0c53('0x77'));_0x5199b5[_0x0c53('0x85')]=_0xb2c81f[_0x0c53('0x85')];_0x5199b5['connectedlinename']=_0xb2c81f['connectedlinename'];logger[_0x0c53('0x7a')](_0x0c53('0x86'),_0x5199b5['queue'],_0x5199b5[_0x0c53('0x59')],_0xb2c81f['connectedlinenum'],_0xb2c81f[_0x0c53('0x87')]);this['channels'][_0xb2c81f[_0x0c53('0x53')]]=_0x5199b5;this[_0x0c53('0x4d')](_0x5199b5,_0x0c53('0x1c'));}}}catch(_0x286863){logger[_0x0c53('0x47')](_0x0c53('0x88'),_0xb2c81f[_0x0c53('0x53')],util[_0x0c53('0x44')](_0x286863,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x13778d){try{if(this[_0x0c53('0x5d')](_0x13778d)){logger[_0x0c53('0x4e')](_0x0c53('0x89'),_0x13778d[_0x0c53('0x53')],util[_0x0c53('0x44')](_0x13778d,{'showHidden':![],'depth':null}));if(this[_0x0c53('0x45')][_0x13778d[_0x0c53('0x53')]]){var _0x2c8abc=_[_0x0c53('0x83')](this[_0x0c53('0x45')][_0x13778d[_0x0c53('0x53')]]);_0x2c8abc[_0x0c53('0x3a')]=!![];_0x2c8abc[_0x0c53('0x54')]=_0x0c53('0x8a');logger['info'](_0x0c53('0x8b'),_0x2c8abc['queue'],_0x2c8abc[_0x0c53('0x59')]);}}}catch(_0xa27e88){logger[_0x0c53('0x47')](_0x0c53('0x89'),_0x13778d[_0x0c53('0x53')],util['inspect'](_0xa27e88,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0c53('0x1e')]=function(_0x56375d){try{if(this['isNotNull'](_0x56375d)){logger[_0x0c53('0x4e')](_0x0c53('0x8c'),_0x56375d['uniqueid'],util[_0x0c53('0x44')](_0x56375d,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x56375d[_0x0c53('0x53')]]){var _0x59a399=_[_0x0c53('0x83')](this[_0x0c53('0x45')][_0x56375d['uniqueid']]);_0x59a399[_0x0c53('0x1a')]=![];_0x59a399[_0x0c53('0x8d')]=null;_0x59a399['assigned']=!![];_0x59a399[_0x0c53('0x82')]=_0x56375d[_0x0c53('0x8e')];_0x59a399['holdtime']=_0x56375d[_0x0c53('0x80')];_0x59a399[_0x0c53('0x3a')]=!![];_0x59a399[_0x0c53('0x39')]=![];_0x59a399[_0x0c53('0x8f')]=null;if(!_0x59a399[_0x0c53('0x90')]){if(_0x56375d[_0x0c53('0x91')]=='transfer'){_0x59a399[_0x0c53('0x54')]='COMPLETED';logger[_0x0c53('0x7a')](_0x0c53('0x92'),_0x59a399[_0x0c53('0x52')],_0x59a399[_0x0c53('0x59')]);}else{if(_[_0x0c53('0x93')](_0x56375d['channel'][_0x0c53('0x94')](),'local/')){if(this[_0x0c53('0x45')][_0x56375d[_0x0c53('0x95')]]){var _0xdd13ac=_[_0x0c53('0x83')](this[_0x0c53('0x45')][_0x56375d['linkedid']]);_0xdd13ac[_0x0c53('0x3a')]=![];_0xdd13ac[_0x0c53('0x39')]=!![];_0xdd13ac[_0x0c53('0x8f')]=moment(_0x59a399[_0x0c53('0x76')])[_0x0c53('0x96')](_0x56375d['holdtime'],_0x0c53('0x97'))[_0x0c53('0x51')](_0x0c53('0x77'));_0xdd13ac[_0x0c53('0x54')]=_0x0c53('0x98');_0xdd13ac[_0x0c53('0x90')]=!![];_0xdd13ac[_0x0c53('0x99')]=_0x0c53('0x9a');_0xdd13ac[_0x0c53('0x9b')]=_0x56375d[_0x0c53('0x9c')];_0xdd13ac['transferuniqueid']=_0x56375d[_0x0c53('0x53')];logger[_0x0c53('0x7a')](_0x0c53('0x9d'),_0xdd13ac['queue'],_0xdd13ac[_0x0c53('0x59')]);var _0x1bf4d2=this['queueReports'][_0x56375d[_0x0c53('0x95')]];this[_0x0c53('0x45')][_0x56375d[_0x0c53('0x95')]]=this[_0x0c53('0x45')][_0x56375d[_0x0c53('0x53')]];this[_0x0c53('0x45')][_0x56375d['uniqueid']]=_0x1bf4d2;}}else{_0x59a399['queuecallerexitreason']=_0x0c53('0x9e')+_0x56375d[_0x0c53('0x91')][_0x0c53('0x9f')]();logger[_0x0c53('0x7a')](_0x0c53('0xa0'),_0x59a399[_0x0c53('0x52')],_0x59a399[_0x0c53('0x59')],_0x59a399[_0x0c53('0x54')]);}}}this[_0x0c53('0x3d')][_0x56375d['uniqueid']]=_0x59a399;}}}catch(_0x330389){logger['error'](_0x0c53('0x8c'),_0x56375d[_0x0c53('0x53')],util[_0x0c53('0x44')](_0x330389,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0c53('0x9')]['syncVarSet']=function(_0x596d8b){try{if(this[_0x0c53('0x5d')](_0x596d8b)){logger[_0x0c53('0x4e')]('[%s][voiceQueueReport][varset]',_0x596d8b[_0x0c53('0x53')],util[_0x0c53('0x44')](_0x596d8b,{'showHidden':![],'depth':null}));this['addVariable'](_0x596d8b[_0x0c53('0x53')],_['keys'](_0x596d8b[_0x0c53('0xa1')])[0x0],_0x596d8b[_0x0c53('0xa2')]);if(this[_0x0c53('0x45')][_0x596d8b['uniqueid']]){var _0x28bb5b=_[_0x0c53('0x83')](this['queueReports'][_0x596d8b[_0x0c53('0x53')]]);if(_0x28bb5b){if(this[_0x0c53('0x5d')](_0x596d8b[_0x0c53('0xa1')])&&this[_0x0c53('0x5d')](_0x596d8b[_0x0c53('0xa1')][_0x0c53('0x65')])){switch(_0x596d8b['value']){case _0x0c53('0xa3'):_0x28bb5b['queuecallerexit']=![];_0x28bb5b[_0x0c53('0x8f')]=null;break;case _0x0c53('0xa4'):_0x28bb5b[_0x0c53('0xa5')]=_0x0c53('0xa6');_0x28bb5b[_0x0c53('0x39')]=!![];_0x28bb5b[_0x0c53('0x8f')]=moment()[_0x0c53('0x51')](_0x0c53('0x77'));_0x28bb5b[_0x0c53('0x84')]=moment()['format'](_0x0c53('0x77'));logger['debug'](_0x0c53('0xa7'),_0x596d8b[_0x0c53('0x53')],util[_0x0c53('0x44')](_0x28bb5b,{'showHidden':![],'depth':null}));ami[_0x0c53('0x4c')](_0x0c53('0xa8'),_0x28bb5b);break;default:_0x28bb5b[_0x0c53('0x39')]=!![];_0x28bb5b[_0x0c53('0x8f')]=moment()[_0x0c53('0x51')](_0x0c53('0x77'));_0x28bb5b[_0x0c53('0x84')]=moment()[_0x0c53('0x51')]('YYYY-MM-DD\x20HH:mm:ss');}_0x28bb5b[_0x0c53('0x1a')]=![];_0x28bb5b[_0x0c53('0x8d')]=null;_0x28bb5b['queuecallerexitreason']=_0x596d8b[_0x0c53('0xa2')];this[_0x0c53('0x3d')][_0x596d8b[_0x0c53('0x53')]]=_0x28bb5b;this['emitVoiceQueueChannelRemove'](_0x28bb5b,_0x0c53('0x21'));}else if(this[_0x0c53('0x5d')](_0x596d8b['variable'])&&this[_0x0c53('0x5d')](_0x596d8b[_0x0c53('0xa1')]['queueposition'])){if(!_0x28bb5b[_0x0c53('0x1a')]){_0x28bb5b[_0x0c53('0x39')]=!![];_0x28bb5b['queuecallerexitAt']=moment()['format'](_0x0c53('0x77'));_0x28bb5b[_0x0c53('0x54')]=_0x0c53('0xa9');_0x28bb5b[_0x0c53('0x84')]=moment()['format'](_0x0c53('0x77'));this[_0x0c53('0x3d')][_0x596d8b[_0x0c53('0x53')]]=_0x28bb5b;}}logger[_0x0c53('0x7a')](_0x0c53('0xaa'),_0x596d8b[_0x0c53('0x53')],_0x28bb5b['queue'],_0x28bb5b[_0x0c53('0x59')],_[_0x0c53('0x7c')](_0x596d8b[_0x0c53('0xa1')])[0x0],_0x596d8b[_0x0c53('0xa2')]);_0x28bb5b[_0x0c53('0x11')]=this[_0x0c53('0x11')][_0x596d8b['uniqueid']];}}}}catch(_0x4472f2){logger[_0x0c53('0x47')](_0x0c53('0xab'),_0x596d8b['uniqueid'],util['inspect'](_0x4472f2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0c53('0x9')][_0x0c53('0xac')]=function(_0x509049,_0x3a1104,_0x536265){var _0x2bcd08=[_0x0c53('0xad'),'rtpaudioqosbridged',_0x0c53('0xae'),'rtpaudioqosjitterbridged',_0x0c53('0xaf'),_0x0c53('0xb0'),_0x0c53('0xb1'),_0x0c53('0xb2'),_0x0c53('0xb3'),_0x0c53('0xb4'),_0x0c53('0xb5'),_0x0c53('0xb6'),'membercalls',_0x0c53('0xb7'),_0x0c53('0xb8'),_0x0c53('0xb9'),'membername','memberpenalty','memberrealtime'];if(!_['isNil'](_0x3a1104)&&!_[_0x0c53('0xba')](_0x2bcd08,_0x3a1104)){if(_['isUndefined'](this['variables'][_0x509049])){this[_0x0c53('0x11')][_0x509049]={};}this[_0x0c53('0x11')][_0x509049][_0x3a1104]=_0x536265;}};VoiceQueueReport['prototype'][_0x0c53('0xbb')]=function(_0xf3442,_0x535983,_0x5c4ad5){try{var _0x2d951c={};if(this[_0x0c53('0x45')][_0xf3442]){for(var _0x4974fe=0x0;_0x4974fe{delete this[_0x0c53('0x3d')][_0x1f8332];},_0x536eea);}};module[_0x0c53('0xea')]=VoiceQueueReport; \ No newline at end of file +var _0x01bc=['clearQueueReport','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','queue','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','queuecallerexitreason','ATTENDEDTRANSFER','voice:queue:%s','voice_queue_channel:remove','emitInboundVoiceQueueSummary','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','isUndefined','[voiceQueueReport][queues]','isRunning','then','actionid','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','queues','summaryEvent','createReport','realtime','handleInboundQueueSummaryReport','compareToInboundQueue','assign','type','outbound','custom:queuesummary','statusRequests','completeEvent','isNotNull','[voiceQueueReport][queuesummary]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','position','count','pick','keys','push','[%s][voiceQueueReport][queuecallerabandon]','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','ABANDONED','lastAssignedTo','info','emitVoiceQueueChannelRemove','[%s][voiceQueueReport][queuecallerleave]','last','queuecallerleaveAt','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','syncAgentComplete','[%s][voiceQueueReport][agentcomplete]','membername','queuecallerexitAt','transfer','reason','COMPLETED','startsWith','toLowerCase','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','variable','value','CONTINUE','TIMEOUT','lastevent','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','handleHangup','length','sumHoldTime','diff','COMPLETEDBYAGENT','milliseconds','total','answered','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumDuration','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','syncHangup','[%s][voiceQueueReport][hangup]','cause-txt','cause','transferid','syncAttendedTransfer','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','mohstarttime','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][newexten]\x20event:','application','set','appdata','applicationdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','exports','moment','util','ioredis','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','tail','finally','sequence','queueReports','agents','voiceQueues','campaigns','summary','variables','queuesummary','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentConnect','varset','syncVarSet','hangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','loopQueueSummary','loopQueueShow','hasOwnProperty','isEmpty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','queuecallerexit','queuecallerabandon','queuecallercomplete','prototype','clearZombieChannels','channels','switch','enqueue','Action','status','channel','catch','No\x20such\x20channel','error','[%s][voiceQueueReport][checkQueueReport]','inspect','[FullyBooted]\x20clear\x20realtime'];(function(_0x1993a8,_0xd34e39){var _0x353428=function(_0x1b5ab5){while(--_0x1b5ab5){_0x1993a8['push'](_0x1993a8['shift']());}};_0x353428(++_0xd34e39);}(_0x01bc,0xb0));var _0xc01b=function(_0x420657,_0xe7d083){_0x420657=_0x420657-0x0;var _0x4bc9d5=_0x01bc[_0x420657];return _0x4bc9d5;};'use strict';var _=require('lodash');var moment=require(_0xc01b('0x0'));var util=require(_0xc01b('0x1'));var Redis=require(_0xc01b('0x2'));var config=require('../../../config/environment');var logger=require(_0xc01b('0x3'))(_0xc01b('0x4'));var ami=require(_0xc01b('0x5'));var QueueReport=require(_0xc01b('0x6'));var VoiceQueueSummary=require(_0xc01b('0x7'));config[_0xc01b('0x8')]=_[_0xc01b('0x9')](config[_0xc01b('0x8')],{'host':_0xc01b('0xa'),'port':0x18eb});var io=require(_0xc01b('0xb'))(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x497f1d){this[_0xc01b('0xc')]=this[_0xc01b('0xc')]?this['tail'][_0xc01b('0xd')](_0x497f1d):_0x497f1d();};function VoiceQueueReport(_0x21a2a2){this[_0xc01b('0xe')]=new Sequence();this[_0xc01b('0xf')]={};this['realtime']=_0x21a2a2;this['agents']=_0x21a2a2[_0xc01b('0x10')];this['channels']=_0x21a2a2['queueChannels'];this[_0xc01b('0x11')]=_0x21a2a2[_0xc01b('0x11')];this[_0xc01b('0x12')]=_0x21a2a2[_0xc01b('0x12')];this[_0xc01b('0x13')]=initializeSummary();this[_0xc01b('0x14')]={};ami['on'](_0xc01b('0x15'),this[_0xc01b('0x16')]['bind'](this));ami['on'](_0xc01b('0x17'),this[_0xc01b('0x18')][_0xc01b('0x19')](this));ami['on'](_0xc01b('0x1a'),this[_0xc01b('0x1b')]['bind'](this));ami['on'](_0xc01b('0x1c'),this[_0xc01b('0x1d')]['bind'](this));ami['on'](_0xc01b('0x1e'),this[_0xc01b('0x1f')]['bind'](this));ami['on']('queuecallerabandon',this[_0xc01b('0x20')]['bind'](this));ami['on'](_0xc01b('0x21'),this[_0xc01b('0x22')][_0xc01b('0x19')](this));ami['on'](_0xc01b('0x23'),this['syncAgentComplete'][_0xc01b('0x19')](this));ami['on']('agentconnect',this[_0xc01b('0x24')][_0xc01b('0x19')](this));ami['on'](_0xc01b('0x25'),this[_0xc01b('0x26')][_0xc01b('0x19')](this));ami['on'](_0xc01b('0x27'),this['syncHangup'][_0xc01b('0x19')](this));ami['on'](_0xc01b('0x28'),this[_0xc01b('0x29')][_0xc01b('0x19')](this));ami['on'](_0xc01b('0x2a'),this[_0xc01b('0x2b')]['bind'](this));ami['on'](_0xc01b('0x2c'),this[_0xc01b('0x2d')][_0xc01b('0x19')](this));ami['on'](_0xc01b('0x2e'),this['syncAttendedTransfer'][_0xc01b('0x19')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xc01b('0x19')](this));this[_0xc01b('0x2f')]();this[_0xc01b('0x30')]();}function clearChannels(_0x28a788){if(!_['isEmpty'](_0x28a788)){for(var _0x12f122 in _0x28a788){if(_0x28a788[_0xc01b('0x31')](_0x12f122)){delete _0x28a788[_0x12f122];}}}}function clearCampaigns(_0xc7c7ac){if(!_[_0xc01b('0x32')](_0xc7c7ac)){for(var _0x3d23e6 in _0xc7c7ac){if(_0xc7c7ac['hasOwnProperty'](_0x3d23e6)){_0xc7c7ac[_0x3d23e6][_0xc01b('0x33')]=0x0;}}}}function clearVoiceQueues(_0x4d8e4f){if(!_['isEmpty'](_0x4d8e4f)){for(var _0x4d40c2 in _0x4d8e4f){if(_0x4d8e4f['hasOwnProperty'](_0x4d40c2)){_0x4d8e4f[_0x4d40c2][_0xc01b('0x33')]=0x0;_0x4d8e4f[_0x4d40c2][_0xc01b('0x34')]=0x0;_0x4d8e4f[_0x4d40c2][_0xc01b('0x35')]=0x0;_0x4d8e4f[_0x4d40c2][_0xc01b('0x36')]=0x0;_0x4d8e4f[_0x4d40c2][_0xc01b('0x37')]=!![];}}}}function clearAgentBooked(_0x4ca052){if(!_[_0xc01b('0x32')](_0x4ca052)){for(var _0x165012 in _0x4ca052){if(_0x4ca052[_0xc01b('0x31')](_0x165012)){_0x4ca052[_0x165012][_0xc01b('0x38')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x3edf18){return _0x3edf18[_0xc01b('0x39')]||_0x3edf18[_0xc01b('0x3a')]||_0x3edf18[_0xc01b('0x3b')];}VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x3d')]=function(){var _0x57d2f3=this;for(var _0x2088e3 in this[_0xc01b('0x3e')]){if(this[_0xc01b('0x3e')]['hasOwnProperty'](_0x2088e3)&&!this[_0xc01b('0x3e')][_0x2088e3][_0xc01b('0x3f')]){this[_0xc01b('0xe')][_0xc01b('0x40')](function(){if(!_['isNil'](_0x57d2f3[_0xc01b('0x3e')][_0x2088e3])){return ami[_0xc01b('0x41')]({'action':_0xc01b('0x42'),'channel':_0x57d2f3[_0xc01b('0x3e')][_0x2088e3][_0xc01b('0x43')]})[_0xc01b('0x44')](function(_0x57f41f){if(_0x57f41f['message']===_0xc01b('0x45')){setTimeout(function(){if(_0x57d2f3[_0xc01b('0x3e')][_0x2088e3]){delete _0x57d2f3[_0xc01b('0x3e')][_0x2088e3];logger[_0xc01b('0x46')]('[%s][voiceQueueReport][checkChannel]',_0x2088e3,util['inspect'](_0x57f41f,{'showHidden':![],'depth':null}));}if(_0x57d2f3[_0xc01b('0xf')][_0x2088e3]){delete _0x57d2f3[_0xc01b('0xf')][_0x2088e3];logger[_0xc01b('0x46')](_0xc01b('0x47'),_0x2088e3,util[_0xc01b('0x48')](_0x57f41f,{'showHidden':![],'depth':null}));}if(_0x57d2f3['variables'][_0x2088e3]){delete _0x57d2f3[_0xc01b('0x14')][_0x2088e3];logger[_0xc01b('0x46')]('[%s][voiceQueueReport][checkVariables]',_0x2088e3,util[_0xc01b('0x48')](_0x57f41f,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x29')]=function(){logger[_0xc01b('0x46')](_0xc01b('0x49'));clearChannels(this[_0xc01b('0x3e')]);this['clearQueueReport'](this['queueReports']);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0xc01b('0x11')]);clearCampaigns(this['campaigns']);this['summary']=initializeSummary();};VoiceQueueReport['prototype'][_0xc01b('0x4a')]=function(_0x28bc91){var _0x46e3df=this;if(!_['isEmpty'](_0x28bc91)){for(var _0x5de4dd in _0x28bc91){if(_0x28bc91[_0xc01b('0x31')](_0x5de4dd)){_0x46e3df['emitVoiceQueueChannelRemove'](_0x28bc91[_0x5de4dd],_0xc01b('0x4b'));delete _0x28bc91[_0x5de4dd];}}}};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x4c')]=function(_0x185deb,_0x4c4fb1,_0x5ee183){io['to'](_0x185deb)['emit'](_0x4c4fb1,_0x5ee183);};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x4d')]=function(_0x4904e3,_0x38f6a9){logger[_0xc01b('0x4e')](_0xc01b('0x4f')+_0x38f6a9+_0xc01b('0x50'),_0x4904e3['uniqueid'],util[_0xc01b('0x48')](_0x4904e3,{'showHidden':![],'depth':null}));this['emit'](util[_0xc01b('0x51')]('voice:queue:%s',_0x4904e3[_0xc01b('0x52')]),_0xc01b('0x53'),_0x4904e3);io[_0xc01b('0x4c')](_0xc01b('0x54'),_0x4904e3);};VoiceQueueReport['prototype']['emitVoiceQueueChannelRemove']=function(_0x5de3b0,_0x4b7ab1){logger[_0xc01b('0x4e')](_0xc01b('0x4f')+_0x4b7ab1+_0xc01b('0x55'),_0x5de3b0[_0xc01b('0x56')],util[_0xc01b('0x48')](_0x5de3b0,{'showHidden':![],'depth':null}));if(_0x5de3b0[_0xc01b('0x57')]===_0xc01b('0x58')){return;}this['emit'](util[_0xc01b('0x51')](_0xc01b('0x59'),_0x5de3b0[_0xc01b('0x52')]),_0xc01b('0x5a'),_0x5de3b0);io[_0xc01b('0x4c')]('voice_queue_presence:remove',_0x5de3b0);};VoiceQueueReport['prototype'][_0xc01b('0x5b')]=function(_0x591f96){if(_0x591f96['type']===_0xc01b('0x5c')){logger[_0xc01b('0x4e')](_0xc01b('0x5d'),util[_0xc01b('0x48')](_0x591f96,{'showHidden':![],'depth':null}));this[_0xc01b('0x4c')](util[_0xc01b('0x51')]('voice:queue:%s',_0x591f96[_0xc01b('0x5e')]),'voice_queue:save',_0x591f96);}};VoiceQueueReport[_0xc01b('0x3c')]['isNotNull']=function(_0x54310f){return _0x54310f!==null&&!_[_0xc01b('0x5f')](_0x54310f);};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x30')]=function(){var _0x57e933=this;setInterval(function(){_0x57e933[_0xc01b('0x3d')]();ami[_0xc01b('0x41')]({'action':'queues'})[_0xc01b('0x44')](function(_0x368cf5){logger[_0xc01b('0x46')](_0xc01b('0x60'),util[_0xc01b('0x48')](_0x368cf5,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x2f')]=function(){var _0x4a62f5=this;setInterval(function(){if(!_0x4a62f5[_0xc01b('0x13')][_0xc01b('0x61')]){return ami[_0xc01b('0x41')]({'action':_0xc01b('0x15')})[_0xc01b('0x62')](function(_0x233b13){_0x4a62f5['summary']['id']=_0x233b13[_0xc01b('0x63')];_0x4a62f5[_0xc01b('0x13')][_0xc01b('0x61')]=!![];_0x4a62f5[_0xc01b('0x13')][_0xc01b('0x64')][_0x233b13[_0xc01b('0x63')]]={};})[_0xc01b('0x44')](function(_0x145f36){logger[_0xc01b('0x46')](_0xc01b('0x65'),util[_0xc01b('0x48')](_0x145f36,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x66')]=function(_0x5d8660,_0x5be4ff){var _0x3727b3;if(this['summary']&&this[_0xc01b('0x13')][_0xc01b('0x67')]&&this[_0xc01b('0x13')][_0xc01b('0x67')][_0x5d8660[_0xc01b('0x5e')]]){_0x3727b3=this[_0xc01b('0x13')][_0xc01b('0x67')][_0x5d8660[_0xc01b('0x5e')]][_0xc01b('0x68')];}var _0x45c11c=new VoiceQueueSummary(_0x5d8660);return _0x45c11c[_0xc01b('0x69')](_0x5be4ff[_0xc01b('0x10')],this[_0xc01b('0x10')],_0x3727b3,this[_0xc01b('0x6a')]['channels']);};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x6b')]=function(_0x1d92a7,_0x4425a8){var _0x2cc2ab=this[_0xc01b('0x66')](_0x1d92a7,_0x4425a8);var _0x2473fe=![];_0x2473fe=_0x2cc2ab[_0xc01b('0x6c')](_0x1d92a7);if(_0x2473fe){Object[_0xc01b('0x6d')](_0x1d92a7,_0x2cc2ab);this[_0xc01b('0x6a')][_0xc01b('0x11')][_0x1d92a7[_0xc01b('0x5e')]]=_0x1d92a7;this[_0xc01b('0x5b')](_0x2cc2ab);}};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x1d')]=function(_0x5b12bb){var _0x3804f3=null;var _0x3e060c=this[_0xc01b('0x13')]['id'];if(this[_0xc01b('0x13')][_0xc01b('0x64')][_0x3e060c]){_0x3804f3=this['summary'][_0xc01b('0x64')][_0x3e060c][_0x5b12bb[_0xc01b('0x63')]];}if(!_0x3804f3){this['summary']=initializeSummary();return;}var _0x469ea5=this[_0xc01b('0x11')][_0x3804f3[_0xc01b('0x52')]];if(_0x469ea5[_0xc01b('0x6e')]==='inbound'){this[_0xc01b('0x6b')](_0x469ea5,_0x3804f3);}else if(_0x469ea5[_0xc01b('0x6e')]===_0xc01b('0x6f')){var _0x2f187c=this[_0xc01b('0x66')](_0x469ea5,_0x3804f3);ami['emit'](_0xc01b('0x70'),_0x2f187c);}this[_0xc01b('0x13')][_0xc01b('0x71')]-=0x1;var _0x5eabc0=this[_0xc01b('0x13')][_0xc01b('0x71')]>0x0?!![]:![];if(!_0x5eabc0){return this[_0xc01b('0x18')](this[_0xc01b('0x13')][_0xc01b('0x72')]);}};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x1b')]=function(_0x40544c){var _0x58651b=this['summary']['id'];if(this[_0xc01b('0x13')][_0xc01b('0x64')][_0x58651b]&&this['summary'][_0xc01b('0x64')][_0x58651b][_0x40544c[_0xc01b('0x63')]]){this[_0xc01b('0x13')]['queuestatus'][_0x58651b][_0x40544c[_0xc01b('0x63')]][_0xc01b('0x10')]['push'](_0x40544c);}};VoiceQueueReport[_0xc01b('0x3c')]['syncQueueSummary']=function(_0x389ed9){var _0x33acd2=this;try{if(this[_0xc01b('0x73')](_0x389ed9)&&this[_0xc01b('0x73')](_0x389ed9[_0xc01b('0x52')])){logger[_0xc01b('0x4e')](_0xc01b('0x74'),util['inspect'](_0x389ed9,{'showHidden':![],'depth':null}));var _0x5d8e77=this[_0xc01b('0x11')][_0x389ed9[_0xc01b('0x52')]];if(_0x5d8e77){logger[_0xc01b('0x4e')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x5d8e77[_0xc01b('0x5e')]);this[_0xc01b('0x13')][_0xc01b('0x67')][_0x5d8e77['name']]={'summaryEvent':_0x389ed9};this[_0xc01b('0x13')]['statusRequests']+=0x1;return ami[_0xc01b('0x41')]({'action':_0xc01b('0x64'),'queue':_0x5d8e77['name']})[_0xc01b('0x62')](function(_0x6f2303){if(!_0x33acd2['summary']['queuestatus'][_0x389ed9[_0xc01b('0x63')]]){_0x33acd2[_0xc01b('0x13')][_0xc01b('0x64')][_0x389ed9['actionid']]={};}_0x33acd2[_0xc01b('0x13')][_0xc01b('0x64')][_0x389ed9['actionid']][_0x6f2303['actionid']]={'queue':_0x5d8e77[_0xc01b('0x5e')],'agents':[]};})['catch'](function(_0x3b9074){throw _0x3b9074;});}}}catch(_0x2bcfe3){logger['error'](_0xc01b('0x65'),util[_0xc01b('0x48')](_0x2bcfe3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x18')]=function(_0x3ad67d){if(this[_0xc01b('0x13')][_0xc01b('0x71')]>0x0){this[_0xc01b('0x13')][_0xc01b('0x72')]=_0x3ad67d;return;}logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xc01b('0x48')](_0x3ad67d,{'showHidden':![],'depth':null}));this[_0xc01b('0x13')]=initializeSummary();ami[_0xc01b('0x4c')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x1f')]=function(_0x2e5f70){try{if(this['isNotNull'](_0x2e5f70)){logger[_0xc01b('0x4e')](_0xc01b('0x75'),_0x2e5f70[_0xc01b('0x56')],util['inspect'](_0x2e5f70,{'showHidden':![],'depth':null}));if(_[_0xc01b('0x5f')](this[_0xc01b('0xf')][_0x2e5f70[_0xc01b('0x56')]])){this[_0xc01b('0xf')][_0x2e5f70[_0xc01b('0x56')]]=[];}if(_[_0xc01b('0x5f')](this[_0xc01b('0x3e')][_0x2e5f70[_0xc01b('0x56')]])){this[_0xc01b('0x3e')][_0x2e5f70[_0xc01b('0x56')]]={};}var _0x140b43=new QueueReport();_0x140b43['queue']=_0x2e5f70['queue'];_0x140b43['type']=this[_0xc01b('0x11')][_0x140b43[_0xc01b('0x52')]]&&this[_0xc01b('0x11')][_0x140b43[_0xc01b('0x52')]]['type']?this[_0xc01b('0x11')][_0x140b43['queue']][_0xc01b('0x6e')]||_0xc01b('0x5c'):'inbound';_0x140b43[_0xc01b('0x76')]=moment()[_0xc01b('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x140b43[_0xc01b('0x77')]=_0x2e5f70[_0xc01b('0x77')];_0x140b43[_0xc01b('0x78')]=_0x2e5f70[_0xc01b('0x78')];_0x140b43['uniqueid']=_0x2e5f70[_0xc01b('0x56')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x140b43[_0xc01b('0x52')],_0x140b43[_0xc01b('0x6e')]);Object[_0xc01b('0x6d')](_0x140b43,_[_0xc01b('0x79')](_0x2e5f70,_[_0xc01b('0x7a')](_0x140b43)));this[_0xc01b('0xf')][_0x2e5f70[_0xc01b('0x56')]][_0xc01b('0x7b')](_0x140b43);this[_0xc01b('0x3e')][_0x2e5f70[_0xc01b('0x56')]]=_0x140b43;this['emitVoiceQueueChannelSave'](_0x140b43,_0xc01b('0x1e'));}}catch(_0x5d0bfe){logger[_0xc01b('0x46')](_0xc01b('0x75'),_0x2e5f70[_0xc01b('0x56')],util[_0xc01b('0x48')](_0x5d0bfe,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01b('0x3c')]['syncQueueCallerAbandon']=function(_0x202256){try{if(this[_0xc01b('0x73')](_0x202256)){logger['debug'](_0xc01b('0x7c'),_0x202256[_0xc01b('0x56')],util['inspect'](_0x202256,{'showHidden':![],'depth':null}));if(this[_0xc01b('0xf')][_0x202256[_0xc01b('0x56')]]){var _0x4273ec=_['last'](this[_0xc01b('0xf')][_0x202256[_0xc01b('0x56')]]);_0x4273ec['queuecallercomplete']=![];_0x4273ec[_0xc01b('0x7d')]=null;_0x4273ec[_0xc01b('0x7e')]=_0x202256[_0xc01b('0x7e')];_0x4273ec[_0xc01b('0x7f')]=_0x202256[_0xc01b('0x7f')];_0x4273ec['queuecallerabandon']=!![];_0x4273ec[_0xc01b('0x80')]=moment()[_0xc01b('0x51')](_0xc01b('0x81'));_0x4273ec[_0xc01b('0x57')]=_0xc01b('0x82');_0x4273ec[_0xc01b('0x83')]=null;logger[_0xc01b('0x84')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x4273ec[_0xc01b('0x52')],_0x4273ec[_0xc01b('0x6e')]);this['channels'][_0x202256['uniqueid']]=_0x4273ec;this[_0xc01b('0x85')](_0x4273ec,_0xc01b('0x3a'));}}}catch(_0x29ea3e){logger[_0xc01b('0x46')]('[%s][voiceQueueReport][queuecallerabandon]',_0x202256['uniqueid'],util[_0xc01b('0x48')](_0x29ea3e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc01b('0x22')]=function(_0x501025){try{if(this[_0xc01b('0x73')](_0x501025)){logger[_0xc01b('0x4e')](_0xc01b('0x86'),_0x501025['uniqueid'],util[_0xc01b('0x48')](_0x501025,{'showHidden':![],'depth':null}));if(this[_0xc01b('0xf')][_0x501025['uniqueid']]){var _0x40c580=_[_0xc01b('0x87')](this['queueReports'][_0x501025[_0xc01b('0x56')]]);_0x40c580[_0xc01b('0x88')]=moment()[_0xc01b('0x51')](_0xc01b('0x81'));_0x40c580['connectedlinenum']=_0x501025['connectedlinenum'];_0x40c580[_0xc01b('0x89')]=_0x501025[_0xc01b('0x89')];logger[_0xc01b('0x84')](_0xc01b('0x8a'),_0x40c580['queue'],_0x40c580[_0xc01b('0x6e')],_0x501025['connectedlinenum'],_0x501025[_0xc01b('0x89')]);this['channels'][_0x501025[_0xc01b('0x56')]]=_0x40c580;this[_0xc01b('0x4d')](_0x40c580,_0xc01b('0x21'));}}}catch(_0x498f9b){logger[_0xc01b('0x46')](_0xc01b('0x86'),_0x501025[_0xc01b('0x56')],util[_0xc01b('0x48')](_0x498f9b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0x24')]=function(_0x50208b){try{if(this[_0xc01b('0x73')](_0x50208b)){logger[_0xc01b('0x4e')](_0xc01b('0x8b'),_0x50208b[_0xc01b('0x56')],util[_0xc01b('0x48')](_0x50208b,{'showHidden':![],'depth':null}));if(this[_0xc01b('0xf')][_0x50208b['uniqueid']]){var _0x407b02=_[_0xc01b('0x87')](this['queueReports'][_0x50208b[_0xc01b('0x56')]]);_0x407b02[_0xc01b('0x3b')]=!![];_0x407b02[_0xc01b('0x57')]='COMPLETEDBYAGENT';logger[_0xc01b('0x84')](_0xc01b('0x8c'),_0x407b02[_0xc01b('0x52')],_0x407b02['type']);}}}catch(_0x3fa5ef){logger['error'](_0xc01b('0x8b'),_0x50208b['uniqueid'],util[_0xc01b('0x48')](_0x3fa5ef,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc01b('0x8d')]=function(_0x16a054){try{if(this['isNotNull'](_0x16a054)){logger[_0xc01b('0x4e')](_0xc01b('0x8e'),_0x16a054[_0xc01b('0x56')],util['inspect'](_0x16a054,{'showHidden':![],'depth':null}));if(this[_0xc01b('0xf')][_0x16a054['uniqueid']]){var _0x3f6df8=_[_0xc01b('0x87')](this[_0xc01b('0xf')][_0x16a054[_0xc01b('0x56')]]);_0x3f6df8['queuecallerabandon']=![];_0x3f6df8[_0xc01b('0x80')]=null;_0x3f6df8['assigned']=!![];_0x3f6df8[_0xc01b('0x83')]=_0x16a054[_0xc01b('0x8f')];_0x3f6df8[_0xc01b('0x7e')]=_0x16a054['holdtime'];_0x3f6df8[_0xc01b('0x3b')]=!![];_0x3f6df8[_0xc01b('0x39')]=![];_0x3f6df8[_0xc01b('0x90')]=null;if(!_0x3f6df8[_0xc01b('0x91')]){if(_0x16a054[_0xc01b('0x92')]=='transfer'){_0x3f6df8['queuecallerexitreason']=_0xc01b('0x93');logger[_0xc01b('0x84')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x3f6df8['queue'],_0x3f6df8[_0xc01b('0x6e')]);}else{if(_[_0xc01b('0x94')](_0x16a054[_0xc01b('0x43')][_0xc01b('0x95')](),_0xc01b('0x96'))){if(this['queueReports'][_0x16a054['linkedid']]){var _0x340bf9=_[_0xc01b('0x87')](this[_0xc01b('0xf')][_0x16a054[_0xc01b('0x97')]]);_0x340bf9['queuecallercomplete']=![];_0x340bf9[_0xc01b('0x39')]=!![];_0x340bf9[_0xc01b('0x90')]=moment(_0x3f6df8['queuecallerjoinAt'])[_0xc01b('0x98')](_0x16a054['holdtime'],_0xc01b('0x99'))[_0xc01b('0x51')](_0xc01b('0x81'));_0x340bf9[_0xc01b('0x57')]=_0xc01b('0x9a');_0x340bf9['transfer']=!![];_0x340bf9[_0xc01b('0x9b')]=_0xc01b('0x9c');_0x340bf9[_0xc01b('0x9d')]=_0x16a054[_0xc01b('0x9e')];_0x340bf9[_0xc01b('0x9f')]=_0x16a054[_0xc01b('0x56')];logger[_0xc01b('0x84')](_0xc01b('0xa0'),_0x340bf9[_0xc01b('0x52')],_0x340bf9[_0xc01b('0x6e')]);var _0x2d4aec=this['queueReports'][_0x16a054[_0xc01b('0x97')]];this[_0xc01b('0xf')][_0x16a054[_0xc01b('0x97')]]=this['queueReports'][_0x16a054[_0xc01b('0x56')]];this[_0xc01b('0xf')][_0x16a054[_0xc01b('0x56')]]=_0x2d4aec;}}else{_0x3f6df8[_0xc01b('0x57')]=_0xc01b('0xa1')+_0x16a054[_0xc01b('0x92')][_0xc01b('0xa2')]();logger[_0xc01b('0x84')](_0xc01b('0xa3'),_0x3f6df8[_0xc01b('0x52')],_0x3f6df8[_0xc01b('0x6e')],_0x3f6df8[_0xc01b('0x57')]);}}}this[_0xc01b('0x3e')][_0x16a054[_0xc01b('0x56')]]=_0x3f6df8;}}}catch(_0x50865c){logger[_0xc01b('0x46')](_0xc01b('0x8e'),_0x16a054['uniqueid'],util[_0xc01b('0x48')](_0x50865c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01b('0x3c')]['syncVarSet']=function(_0x4864ed){try{if(this[_0xc01b('0x73')](_0x4864ed)){logger['debug'](_0xc01b('0xa4'),_0x4864ed['uniqueid'],util[_0xc01b('0x48')](_0x4864ed,{'showHidden':![],'depth':null}));this['addVariable'](_0x4864ed['uniqueid'],_[_0xc01b('0x7a')](_0x4864ed[_0xc01b('0xa5')])[0x0],_0x4864ed[_0xc01b('0xa6')]);if(this[_0xc01b('0xf')][_0x4864ed[_0xc01b('0x56')]]){var _0x16d1f4=_[_0xc01b('0x87')](this[_0xc01b('0xf')][_0x4864ed[_0xc01b('0x56')]]);if(_0x16d1f4){if(this[_0xc01b('0x73')](_0x4864ed[_0xc01b('0xa5')])&&this[_0xc01b('0x73')](_0x4864ed['variable']['queuestatus'])){switch(_0x4864ed[_0xc01b('0xa6')]){case _0xc01b('0xa7'):_0x16d1f4[_0xc01b('0x39')]=![];_0x16d1f4[_0xc01b('0x90')]=null;break;case _0xc01b('0xa8'):_0x16d1f4[_0xc01b('0xa9')]='timeout';_0x16d1f4[_0xc01b('0x39')]=!![];_0x16d1f4[_0xc01b('0x90')]=moment()[_0xc01b('0x51')](_0xc01b('0x81'));_0x16d1f4['queuecallerleaveAt']=moment()[_0xc01b('0x51')](_0xc01b('0x81'));logger[_0xc01b('0x4e')](_0xc01b('0xaa'),_0x4864ed[_0xc01b('0x56')],util[_0xc01b('0x48')](_0x16d1f4,{'showHidden':![],'depth':null}));ami[_0xc01b('0x4c')](_0xc01b('0xab'),_0x16d1f4);break;default:_0x16d1f4['queuecallerexit']=!![];_0x16d1f4[_0xc01b('0x90')]=moment()[_0xc01b('0x51')](_0xc01b('0x81'));_0x16d1f4[_0xc01b('0x88')]=moment()[_0xc01b('0x51')](_0xc01b('0x81'));}_0x16d1f4[_0xc01b('0x3a')]=![];_0x16d1f4['queuecallerabandonAt']=null;_0x16d1f4[_0xc01b('0x57')]=_0x4864ed[_0xc01b('0xa6')];this[_0xc01b('0x3e')][_0x4864ed[_0xc01b('0x56')]]=_0x16d1f4;this[_0xc01b('0x85')](_0x16d1f4,_0xc01b('0x25'));}else if(this[_0xc01b('0x73')](_0x4864ed[_0xc01b('0xa5')])&&this[_0xc01b('0x73')](_0x4864ed[_0xc01b('0xa5')][_0xc01b('0xac')])){if(!_0x16d1f4['queuecallerabandon']){_0x16d1f4[_0xc01b('0x39')]=!![];_0x16d1f4[_0xc01b('0x90')]=moment()[_0xc01b('0x51')](_0xc01b('0x81'));_0x16d1f4[_0xc01b('0x57')]=_0xc01b('0xad');_0x16d1f4['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x4864ed[_0xc01b('0x56')]]=_0x16d1f4;}}logger[_0xc01b('0x84')](_0xc01b('0xae'),_0x4864ed[_0xc01b('0x56')],_0x16d1f4[_0xc01b('0x52')],_0x16d1f4[_0xc01b('0x6e')],_['keys'](_0x4864ed[_0xc01b('0xa5')])[0x0],_0x4864ed[_0xc01b('0xa6')]);_0x16d1f4[_0xc01b('0x14')]=this[_0xc01b('0x14')][_0x4864ed[_0xc01b('0x56')]];}}}}catch(_0x5f02f5){logger[_0xc01b('0x46')]('[%s][voiceQueueReport][varset]',_0x4864ed[_0xc01b('0x56')],util[_0xc01b('0x48')](_0x5f02f5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0xaf')]=function(_0x50f76b,_0x32986a,_0x4a873f){var _0x1e132a=[_0xc01b('0xb0'),_0xc01b('0xb1'),_0xc01b('0xb2'),_0xc01b('0xb3'),_0xc01b('0xb4'),_0xc01b('0xb5'),_0xc01b('0xb6'),_0xc01b('0xb7'),_0xc01b('0xb8'),'sipuri',_0xc01b('0xb9'),_0xc01b('0xba'),_0xc01b('0xbb'),_0xc01b('0xbc'),'memberinterface',_0xc01b('0xbd'),'membername',_0xc01b('0xbe'),_0xc01b('0xbf')];if(!_[_0xc01b('0xc0')](_0x32986a)&&!_[_0xc01b('0xc1')](_0x1e132a,_0x32986a)){if(_['isUndefined'](this['variables'][_0x50f76b])){this[_0xc01b('0x14')][_0x50f76b]={};}this[_0xc01b('0x14')][_0x50f76b][_0x32986a]=_0x4a873f;}};VoiceQueueReport[_0xc01b('0x3c')][_0xc01b('0xc2')]=function(_0x4c1df2,_0x5dd6a8,_0xcfa48a){try{var _0x36bcd7={};if(this[_0xc01b('0xf')][_0x4c1df2]){for(var _0x36b58e=0x0;_0x36b58e{delete this['channels'][_0x5ee116];},_0x5952cd);}};module[_0xc01b('0xf9')]=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 8d58f9b..c987eb8 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7740=['Request','CreateReportAgentPreview','../client','createHistory','queue'];(function(_0x5319ed,_0x4dacdd){var _0x52ba2f=function(_0x3067e5){while(--_0x3067e5){_0x5319ed['push'](_0x5319ed['shift']());}};_0x52ba2f(++_0x4dacdd);}(_0x7740,0x15b));var _0x0774=function(_0x25c326,_0x250137){_0x25c326=_0x25c326-0x0;var _0x762452=_0x7740[_0x25c326];return _0x762452;};'use strict';var client=require(_0x0774('0x0'));exports[_0x0774('0x1')]=function(_0x27ca6c){return function(){_0x27ca6c['campaign']=_0x27ca6c[_0x0774('0x2')];return client[_0x0774('0x3')](_0x0774('0x4'),{'body':_0x27ca6c,'log':_0x0774('0x4')});};}; \ No newline at end of file +var _0xe397=['Request','CreateReportAgentPreview','../client','createHistory','queue'];(function(_0x4d3764,_0x449577){var _0x3b2f0e=function(_0x1e331f){while(--_0x1e331f){_0x4d3764['push'](_0x4d3764['shift']());}};_0x3b2f0e(++_0x449577);}(_0xe397,0x142));var _0x7e39=function(_0x5c0979,_0x287854){_0x5c0979=_0x5c0979-0x0;var _0x309972=_0xe397[_0x5c0979];return _0x309972;};'use strict';var client=require(_0x7e39('0x0'));exports[_0x7e39('0x1')]=function(_0x572fec){return function(){_0x572fec['campaign']=_0x572fec[_0x7e39('0x2')];return client[_0x7e39('0x3')](_0x7e39('0x4'),{'body':_0x572fec,'log':_0x7e39('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index a1ce8d8..1b37f61 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c89=['CreateAttachment','../client'];(function(_0x5e1d58,_0x4deae7){var _0x394c39=function(_0x48ac97){while(--_0x48ac97){_0x5e1d58['push'](_0x5e1d58['shift']());}};_0x394c39(++_0x4deae7);}(_0x3c89,0x16b));var _0x93c8=function(_0x1d778e,_0x1b35b5){_0x1d778e=_0x1d778e-0x0;var _0x24087c=_0x3c89[_0x1d778e];return _0x24087c;};'use strict';var client=require(_0x93c8('0x0'));exports['create']=function(_0x209a0a){return client['Request']('CreateAttachment',{'body':_0x209a0a,'log':_0x93c8('0x1')});}; \ No newline at end of file +var _0xe69a=['CreateAttachment','../client','Request'];(function(_0x4344b6,_0x406287){var _0x20c00b=function(_0x3326ed){while(--_0x3326ed){_0x4344b6['push'](_0x4344b6['shift']());}};_0x20c00b(++_0x406287);}(_0xe69a,0x1bd));var _0xae69=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xe69a[_0x4ae625];return _0x31accf;};'use strict';var client=require(_0xae69('0x0'));exports['create']=function(_0x260f71){return client[_0xae69('0x1')](_0xae69('0x2'),{'body':_0x260f71,'log':_0xae69('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index 3d418d9..0428640 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['Trunk','active','TrunkBackup','callerid','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x2d2006,_0x2d27b3){var _0x442661=function(_0x4838ea){while(--_0x4838ea){_0x2d2006['push'](_0x2d2006['shift']());}};_0x442661(++_0x2d27b3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xc4aa[_0x8c43de];return _0xa6591b;};'use strict';var client=require(_0xac4a('0x0'));exports[_0xac4a('0x1')]=function(){return function(){return client[_0xac4a('0x2')](_0xac4a('0x3'),{'options':{'raw':![],'attributes':['id',_0xac4a('0x4'),_0xac4a('0x5'),'active','limitCalls','dialOriginateCallerIdName',_0xac4a('0x6'),_0xac4a('0x7'),_0xac4a('0x8'),_0xac4a('0x9'),_0xac4a('0xa'),_0xac4a('0xb'),_0xac4a('0xc'),_0xac4a('0xd'),'dialGlobalMaxRetry','dialNoSuchNumberMaxRetry',_0xac4a('0xe'),_0xac4a('0xf'),_0xac4a('0x10'),'dialAbandonedMaxRetry',_0xac4a('0x11'),_0xac4a('0x12'),_0xac4a('0x13'),'dialAgentRejectMaxRetry',_0xac4a('0x14'),'dialTimezone',_0xac4a('0x15'),'dialAMDActive',_0xac4a('0x16'),_0xac4a('0x17'),_0xac4a('0x18'),'dialAMDTotalAnalysisTime',_0xac4a('0x19'),_0xac4a('0x1a'),_0xac4a('0x1b'),_0xac4a('0x1c'),_0xac4a('0x1d'),_0xac4a('0x1e'),_0xac4a('0x1f'),_0xac4a('0x20'),_0xac4a('0x21')],'include':[{'model':_0xac4a('0x22'),'as':_0xac4a('0x22'),'attributes':['id',_0xac4a('0x4'),'callerid',_0xac4a('0x23')]},{'model':_0xac4a('0x22'),'as':_0xac4a('0x24'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x25'),_0xac4a('0x23')]},{'model':_0xac4a('0x26'),'as':_0xac4a('0x26'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xac4a('0x27'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x28')]}]},{'model':'SquareProject','as':_0xac4a('0x29'),'attributes':['id',_0xac4a('0x4')]}]},'log':_0xac4a('0x2a')});};}; \ No newline at end of file +var _0xc4aa=['Trunk','active','TrunkBackup','callerid','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x53f29b,_0x22cf73){var _0x18b486=function(_0x4db84d){while(--_0x4db84d){_0x53f29b['push'](_0x53f29b['shift']());}};_0x18b486(++_0x22cf73);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc4aa[_0xa148b7];return _0x51efd3;};'use strict';var client=require(_0xac4a('0x0'));exports[_0xac4a('0x1')]=function(){return function(){return client[_0xac4a('0x2')](_0xac4a('0x3'),{'options':{'raw':![],'attributes':['id',_0xac4a('0x4'),_0xac4a('0x5'),'active','limitCalls','dialOriginateCallerIdName',_0xac4a('0x6'),_0xac4a('0x7'),_0xac4a('0x8'),_0xac4a('0x9'),_0xac4a('0xa'),_0xac4a('0xb'),_0xac4a('0xc'),_0xac4a('0xd'),'dialGlobalMaxRetry','dialNoSuchNumberMaxRetry',_0xac4a('0xe'),_0xac4a('0xf'),_0xac4a('0x10'),'dialAbandonedMaxRetry',_0xac4a('0x11'),_0xac4a('0x12'),_0xac4a('0x13'),'dialAgentRejectMaxRetry',_0xac4a('0x14'),'dialTimezone',_0xac4a('0x15'),'dialAMDActive',_0xac4a('0x16'),_0xac4a('0x17'),_0xac4a('0x18'),'dialAMDTotalAnalysisTime',_0xac4a('0x19'),_0xac4a('0x1a'),_0xac4a('0x1b'),_0xac4a('0x1c'),_0xac4a('0x1d'),_0xac4a('0x1e'),_0xac4a('0x1f'),_0xac4a('0x20'),_0xac4a('0x21')],'include':[{'model':_0xac4a('0x22'),'as':_0xac4a('0x22'),'attributes':['id',_0xac4a('0x4'),'callerid',_0xac4a('0x23')]},{'model':_0xac4a('0x22'),'as':_0xac4a('0x24'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x25'),_0xac4a('0x23')]},{'model':_0xac4a('0x26'),'as':_0xac4a('0x26'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xac4a('0x27'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x28')]}]},{'model':'SquareProject','as':_0xac4a('0x29'),'attributes':['id',_0xac4a('0x4')]}]},'log':_0xac4a('0x2a')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index 7d3a9ea..f99b739 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0449=['Request','CreateCmContact','getContacts','GetCmContact','../client'];(function(_0x3619d7,_0x5a61b0){var _0x31e196=function(_0x4bae06){while(--_0x4bae06){_0x3619d7['push'](_0x3619d7['shift']());}};_0x31e196(++_0x5a61b0);}(_0x0449,0x112));var _0x9044=function(_0x5aa63c,_0x98fd2d){_0x5aa63c=_0x5aa63c-0x0;var _0x5d2e6f=_0x0449[_0x5aa63c];return _0x5d2e6f;};'use strict';var client=require(_0x9044('0x0'));exports['createContact']=function(_0x8feeae){return function(){return client[_0x9044('0x1')](_0x9044('0x2'),{'body':_0x8feeae,'log':_0x9044('0x2')});};};exports[_0x9044('0x3')]=function(_0x428aab){return function(){return client[_0x9044('0x1')](_0x9044('0x4'),{'options':_0x428aab,'log':_0x9044('0x4')});};}; \ No newline at end of file +var _0xfa83=['Request','CreateCmContact','getContacts','GetCmContact'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xfa83,0x110));var _0x3fa8=function(_0x235331,_0x2a03a5){_0x235331=_0x235331-0x0;var _0x54b79c=_0xfa83[_0x235331];return _0x54b79c;};'use strict';var client=require('../client');exports['createContact']=function(_0xa63b7b){return function(){return client[_0x3fa8('0x0')]('CreateCmContact',{'body':_0xa63b7b,'log':_0x3fa8('0x1')});};};exports[_0x3fa8('0x2')]=function(_0x4a310b){return function(){return client[_0x3fa8('0x0')]('GetCmContact',{'options':_0x4a310b,'log':_0x3fa8('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index 334d8ce..0349965 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8a5=['MoveContactManagedDialer','ListId','countReScheduled','CountReScheduled','GetCmHopperPreview','Agent','name','unlockContact','getContactRecallMe','GetContactRecallMe','User','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','../client','getContacts','Request','GetCmHopper','CmContact','Contact','getCmHopper','updateContacts','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority','ASC','DESC','scheduledat','GetContactDialerIvr','campaign','queue'];(function(_0x17aa41,_0x2f4684){var _0x5d89f5=function(_0x4b8711){while(--_0x4b8711){_0x17aa41['push'](_0x17aa41['shift']());}};_0x5d89f5(++_0x2f4684);}(_0xd8a5,0x160));var _0x5d8a=function(_0x4ed7e6,_0x3690fa){_0x4ed7e6=_0x4ed7e6-0x0;var _0x1a17d8=_0xd8a5[_0x4ed7e6];return _0x1a17d8;};'use strict';var client=require(_0x5d8a('0x0'));var moment=require('moment');exports[_0x5d8a('0x1')]=function(_0x16ef7f,_0x4f7eae){return function(){return client[_0x5d8a('0x2')](_0x5d8a('0x3'),{'options':{'where':{'VoiceQueueId':_0x16ef7f},'include':[{'model':_0x5d8a('0x4'),'as':_0x5d8a('0x5')}],'limit':_0x4f7eae,'raw':![]},'log':_0x5d8a('0x6')});};};exports[_0x5d8a('0x7')]=function(_0xab60c9,_0x38eaa5,_0x1ef405){return function(){return client[_0x5d8a('0x2')](_0x5d8a('0x8'),{'body':_0xab60c9,'options':{'where':{'VoiceQueueId':_0x38eaa5,'scheduledat':{'$lte':moment()[_0x5d8a('0x9')](_0x5d8a('0xa'))}},'limit':_0x1ef405},'log':'UpdateCmHopper'});};};exports[_0x5d8a('0xb')]=function(_0x3d44cc){return client[_0x5d8a('0x2')](_0x5d8a('0x8'),{'body':_0x3d44cc,'options':{'where':{'ContactId':_0x3d44cc[_0x5d8a('0xc')],'ListId':_0x3d44cc['ListId'],'VoiceQueueId':_0x3d44cc[_0x5d8a('0xd')],'CampaignId':_0x3d44cc[_0x5d8a('0xe')]}},'log':_0x5d8a('0xb')});};exports[_0x5d8a('0xf')]=function(_0x5219aa,_0xcfee,_0x45ca6e){return function(){return client['Request'](_0x5d8a('0x10'),{'options':{'where':{'VoiceQueueId':_0x5219aa,'ListId':_0xcfee,'ContactId':_0x45ca6e}},'log':_0x5d8a('0x10')});};};exports[_0x5d8a('0x11')]=function(_0x249e12,_0x2b82c1,_0x4211c7,_0x3727d3){return client[_0x5d8a('0x2')](_0x5d8a('0x12'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x249e12,'active':![],'scheduledat':{'$lte':moment()[_0x5d8a('0x9')](_0x5d8a('0xa'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x2b82c1}}]},'order':[[_0x5d8a('0x13'),'DESC'],['scheduledat',_0x3727d3],['id',_0x5d8a('0x14')]],'raw':!![],'limit':_0x4211c7},'log':_0x5d8a('0x12')});};exports['getContactDialerIvr']=function(_0x3d3505,_0x119d08,_0x341262){return client[_0x5d8a('0x2')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x3d3505,'active':![],'scheduledat':{'$lte':moment()[_0x5d8a('0x9')]('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':_0x5d8a('0x4'),'as':_0x5d8a('0x5')}],'order':[[_0x5d8a('0x13'),_0x5d8a('0x15')],[_0x5d8a('0x16'),_0x341262],['id',_0x5d8a('0x14')]],'raw':!![],'limit':_0x119d08},'log':_0x5d8a('0x17')});};exports['moveContactManagedDialer']=function(_0x460e95,_0x235065){_0x460e95[_0x5d8a('0x18')]=_0x460e95[_0x5d8a('0x19')];return client['Request'](_0x5d8a('0x1a'),{'body':_0x460e95,'options':{'where':{'ContactId':_0x460e95[_0x5d8a('0xc')],'ListId':_0x460e95[_0x5d8a('0x1b')],'VoiceQueueId':_0x460e95['VoiceQueueId'],'CampaignId':_0x460e95[_0x5d8a('0xe')],'active':_0x235065?undefined:!![]}},'log':_0x5d8a('0x1a')});};exports[_0x5d8a('0x1c')]=function(_0x1201c6){return client['Request'](_0x5d8a('0x1d'),{'options':{'where':{'VoiceQueueId':_0x1201c6['id']?_0x1201c6['id']||null:null}},'log':_0x5d8a('0x1c')});};exports['getContactPreview']=function(_0x93d735){return function(){return client['Request'](_0x5d8a('0x1e'),{'options':{'where':{'id':_0x93d735},'include':[{'model':_0x5d8a('0x4'),'as':_0x5d8a('0x5')},{'model':'User','as':_0x5d8a('0x1f'),'attributes':['id',_0x5d8a('0x20')]},{'model':'VoiceQueue','as':'Queue','attributes':['id',_0x5d8a('0x20')]}],'raw':!![]},'log':_0x5d8a('0x6')});};};exports[_0x5d8a('0x21')]=function(_0x50660e,_0x2fa9fd,_0x3cafbf){return client['Request'](_0x5d8a('0x8'),{'body':_0x50660e,'options':{'where':{'id':_0x2fa9fd},'limit':_0x3cafbf},'log':_0x5d8a('0x8')});};exports[_0x5d8a('0x22')]=function(_0x136150,_0x15c162){return function(){return client['Request'](_0x5d8a('0x23'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x136150,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x5d8a('0x9')](_0x5d8a('0xa'))},'UserId':{'$in':_0x15c162}},'order':[[_0x5d8a('0x13'),_0x5d8a('0x15')],[_0x5d8a('0x16'),_0x5d8a('0x15')],['id',_0x5d8a('0x14')]],'include':[{'model':'CmContact','as':_0x5d8a('0x5')},{'model':_0x5d8a('0x24'),'as':_0x5d8a('0x1f'),'attributes':['id',_0x5d8a('0x20'),_0x5d8a('0x25')]}],'group':_0x5d8a('0x26'),'raw':!![]},'log':_0x5d8a('0x12')});};};exports[_0x5d8a('0x27')]=function(_0x310709,_0x2bbf48){return client[_0x5d8a('0x2')](_0x5d8a('0x28'),{'body':_0x310709,'options':_0x2bbf48||{},'log':'ResetActiveCalls'});};exports[_0x5d8a('0x29')]=function(_0x3b8b02,_0x19160f,_0x527ce2){return function(){return client[_0x5d8a('0x2')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x3b8b02,'interval':_0x19160f,'availableAgentsIds':_0x527ce2}},'log':_0x5d8a('0x29')});};}; \ No newline at end of file +var _0x5292=['Contact','updateContacts','UpdateCmHopper','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','format','YYYY-MM-DD\x20HH:mm:ss','priority','DESC','scheduledat','ASC','GetContactDialerIvr','moveContactManagedDialer','queue','MoveContactManagedDialer','CountReScheduled','countReScheduled','getContactPreview','User','Agent','name','VoiceQueue','Queue','getCmHopper','unlockContact','GetContactRecallMe','voicePause','db.CmHopper.UserId','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','Request','GetCmHopper','CmContact'];(function(_0x4c00a0,_0x11e753){var _0x1770e1=function(_0x551275){while(--_0x551275){_0x4c00a0['push'](_0x4c00a0['shift']());}};_0x1770e1(++_0x11e753);}(_0x5292,0xf7));var _0x2529=function(_0x1b776e,_0x1d341e){_0x1b776e=_0x1b776e-0x0;var _0x3b8294=_0x5292[_0x1b776e];return _0x3b8294;};'use strict';var client=require(_0x2529('0x0'));var moment=require(_0x2529('0x1'));exports['getContacts']=function(_0x2ec817,_0x522ab4){return function(){return client[_0x2529('0x2')](_0x2529('0x3'),{'options':{'where':{'VoiceQueueId':_0x2ec817},'include':[{'model':_0x2529('0x4'),'as':_0x2529('0x5')}],'limit':_0x522ab4,'raw':![]},'log':'getCmHopper'});};};exports[_0x2529('0x6')]=function(_0x482dba,_0x4c9b4c,_0x4e7a9e){return function(){return client[_0x2529('0x2')](_0x2529('0x7'),{'body':_0x482dba,'options':{'where':{'VoiceQueueId':_0x4c9b4c,'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x4e7a9e},'log':_0x2529('0x7')});};};exports[_0x2529('0x8')]=function(_0x5850a7){return client[_0x2529('0x2')](_0x2529('0x7'),{'body':_0x5850a7,'options':{'where':{'ContactId':_0x5850a7[_0x2529('0x9')],'ListId':_0x5850a7[_0x2529('0xa')],'VoiceQueueId':_0x5850a7[_0x2529('0xb')],'CampaignId':_0x5850a7[_0x2529('0xc')]}},'log':_0x2529('0x8')});};exports[_0x2529('0xd')]=function(_0x4f3cf9,_0x42f613,_0x4fb3e0){return function(){return client['Request'](_0x2529('0xe'),{'options':{'where':{'VoiceQueueId':_0x4f3cf9,'ListId':_0x42f613,'ContactId':_0x4fb3e0}},'log':_0x2529('0xe')});};};exports[_0x2529('0xf')]=function(_0xfb9ae2,_0x2c6a91,_0x31c39c,_0x3f3b40){return client['Request'](_0x2529('0x10'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xfb9ae2,'active':![],'scheduledat':{'$lte':moment()[_0x2529('0x11')](_0x2529('0x12'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x2c6a91}}]},'order':[[_0x2529('0x13'),_0x2529('0x14')],[_0x2529('0x15'),_0x3f3b40],['id',_0x2529('0x16')]],'raw':!![],'limit':_0x31c39c},'log':_0x2529('0x10')});};exports['getContactDialerIvr']=function(_0x163bf4,_0x502ea8,_0x337720){return client[_0x2529('0x2')](_0x2529('0x10'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x163bf4,'active':![],'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':_0x2529('0x4'),'as':_0x2529('0x5')}],'order':[[_0x2529('0x13'),_0x2529('0x14')],[_0x2529('0x15'),_0x337720],['id','ASC']],'raw':!![],'limit':_0x502ea8},'log':_0x2529('0x17')});};exports[_0x2529('0x18')]=function(_0x1ca15f,_0xeff5a6){_0x1ca15f['campaign']=_0x1ca15f[_0x2529('0x19')];return client[_0x2529('0x2')](_0x2529('0x1a'),{'body':_0x1ca15f,'options':{'where':{'ContactId':_0x1ca15f['ContactId'],'ListId':_0x1ca15f[_0x2529('0xa')],'VoiceQueueId':_0x1ca15f[_0x2529('0xb')],'CampaignId':_0x1ca15f[_0x2529('0xc')],'active':_0xeff5a6?undefined:!![]}},'log':_0x2529('0x1a')});};exports['countReScheduled']=function(_0x2736f6){return client[_0x2529('0x2')](_0x2529('0x1b'),{'options':{'where':{'VoiceQueueId':_0x2736f6['id']?_0x2736f6['id']||null:null}},'log':_0x2529('0x1c')});};exports[_0x2529('0x1d')]=function(_0xbb3c1b){return function(){return client['Request']('GetCmHopperPreview',{'options':{'where':{'id':_0xbb3c1b},'include':[{'model':_0x2529('0x4'),'as':_0x2529('0x5')},{'model':_0x2529('0x1e'),'as':_0x2529('0x1f'),'attributes':['id',_0x2529('0x20')]},{'model':_0x2529('0x21'),'as':_0x2529('0x22'),'attributes':['id',_0x2529('0x20')]}],'raw':!![]},'log':_0x2529('0x23')});};};exports[_0x2529('0x24')]=function(_0x5852aa,_0x1c5209,_0x6d26cb){return client['Request'](_0x2529('0x7'),{'body':_0x5852aa,'options':{'where':{'id':_0x1c5209},'limit':_0x6d26cb},'log':_0x2529('0x7')});};exports['getContactRecallMe']=function(_0x17bcbd,_0x1d7e98){return function(){return client['Request'](_0x2529('0x25'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x17bcbd,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x2529('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x1d7e98}},'order':[[_0x2529('0x13'),_0x2529('0x14')],[_0x2529('0x15'),_0x2529('0x14')],['id',_0x2529('0x16')]],'include':[{'model':'CmContact','as':_0x2529('0x5')},{'model':_0x2529('0x1e'),'as':_0x2529('0x1f'),'attributes':['id',_0x2529('0x20'),_0x2529('0x26')]}],'group':_0x2529('0x27'),'raw':!![]},'log':_0x2529('0x10')});};};exports['resetActiveCalls']=function(_0x4ab0ed,_0x14aabd){return client['Request'](_0x2529('0x28'),{'body':_0x4ab0ed,'options':_0x14aabd||{},'log':'ResetActiveCalls'});};exports['handlePreviewRecallNotifications']=function(_0x543ac5,_0x30cdfb,_0x3c815f){return function(){return client[_0x2529('0x2')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x543ac5,'interval':_0x30cdfb,'availableAgentsIds':_0x3c815f}},'log':_0x2529('0x29')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index ca5beb3..eb1b05d 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa34e=['IncrementPreviewCounters','../client','verifyAdditionalPhones','Request','VerifyAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa34e,0xf6));var _0xea34=function(_0x320d18,_0x7a06d9){_0x320d18=_0x320d18-0x0;var _0x18166f=_0xa34e[_0x320d18];return _0x18166f;};'use strict';var client=require(_0xea34('0x0'));exports[_0xea34('0x1')]=function(_0x51c295,_0x2e702e,_0x4e84bb){return client[_0xea34('0x2')](_0xea34('0x3'),{'body':_0x51c295,'reason':_0x2e702e,'entity':_0x4e84bb,'log':'VerifyAdditionalPhones'});};exports['swapAdditionalPhones']=function(_0x189032,_0x4429c8,_0x17673d){return client['Request']('SwapAdditionalPhones',{'body':_0x189032,'duration':_0x4429c8,'waitTime':_0x17673d,'log':_0xea34('0x4')});};exports[_0xea34('0x5')]=function(_0x8eec80){return function(){return client[_0xea34('0x2')](_0xea34('0x6'),{'body':_0x8eec80,'log':'IncrementPreviewCounters'});};}; \ No newline at end of file +var _0x7d73=['Request','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','verifyAdditionalPhones'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7d73,0x130));var _0x37d7=function(_0x2ef8f1,_0x1280a3){_0x2ef8f1=_0x2ef8f1-0x0;var _0x17498d=_0x7d73[_0x2ef8f1];return _0x17498d;};'use strict';var client=require('../client');exports[_0x37d7('0x0')]=function(_0x661c99,_0x4bc53e,_0x3a8aa2){return client['Request']('VerifyAdditionalPhones',{'body':_0x661c99,'reason':_0x4bc53e,'entity':_0x3a8aa2,'log':'VerifyAdditionalPhones'});};exports['swapAdditionalPhones']=function(_0x15bd91,_0x142acc,_0x6e2a7a){return client[_0x37d7('0x1')](_0x37d7('0x2'),{'body':_0x15bd91,'duration':_0x142acc,'waitTime':_0x6e2a7a,'log':'SwapAdditionalPhones'});};exports[_0x37d7('0x3')]=function(_0x5157b0){return function(){return client[_0x37d7('0x1')](_0x37d7('0x4'),{'body':_0x5157b0,'log':_0x37d7('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index 30b27e0..d99fbe2 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa90=['phone','Request','CampaignId','GetCmHopperBlackIvr','checkIsBlackList','GetCmHopperBlack','VoiceQueueId'];(function(_0x30f0c5,_0x4d34e8){var _0x3b5e80=function(_0x5a5d30){while(--_0x5a5d30){_0x30f0c5['push'](_0x30f0c5['shift']());}};_0x3b5e80(++_0x4d34e8);}(_0xfa90,0x97));var _0x0fa9=function(_0x5a7e29,_0x20002a){_0x5a7e29=_0x5a7e29-0x0;var _0xbf3f57=_0xfa90[_0x5a7e29];return _0xbf3f57;};'use strict';var client=require('../client');exports[_0x0fa9('0x0')]=function(_0x3600f3){return client['Request'](_0x0fa9('0x1'),{'options':{'where':{'VoiceQueueId':_0x3600f3[_0x0fa9('0x2')],'phone':_0x3600f3[_0x0fa9('0x3')]},'raw':![]},'log':'GetCmHopperBlack'});};exports['checkIsBlackListIvr']=function(_0x308b0a){return client[_0x0fa9('0x4')](_0x0fa9('0x1'),{'options':{'where':{'CampaignId':_0x308b0a[_0x0fa9('0x5')],'phone':_0x308b0a[_0x0fa9('0x3')]},'raw':![]},'log':_0x0fa9('0x6')});}; \ No newline at end of file +var _0x6caa=['checkIsBlackListIvr','checkIsBlackList','Request','phone','GetCmHopperBlack'];(function(_0x524668,_0x1773a3){var _0x2d4d47=function(_0x2b8683){while(--_0x2b8683){_0x524668['push'](_0x524668['shift']());}};_0x2d4d47(++_0x1773a3);}(_0x6caa,0xbf));var _0xa6ca=function(_0x14273a,_0x149476){_0x14273a=_0x14273a-0x0;var _0xa60515=_0x6caa[_0x14273a];return _0xa60515;};'use strict';var client=require('../client');exports[_0xa6ca('0x0')]=function(_0x2c3f85){return client[_0xa6ca('0x1')]('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x2c3f85['VoiceQueueId'],'phone':_0x2c3f85[_0xa6ca('0x2')]},'raw':![]},'log':_0xa6ca('0x3')});};exports[_0xa6ca('0x4')]=function(_0x5a3a48){return client['Request']('GetCmHopperBlack',{'options':{'where':{'CampaignId':_0x5a3a48['CampaignId'],'phone':_0x5a3a48[_0xa6ca('0x2')]},'raw':![]},'log':'GetCmHopperBlackIvr'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index 65fd8e3..063bad6 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb829=['Request','../client','queue'];(function(_0x11deb5,_0x46b0f0){var _0x5ee90f=function(_0x20fbf8){while(--_0x20fbf8){_0x11deb5['push'](_0x11deb5['shift']());}};_0x5ee90f(++_0x46b0f0);}(_0xb829,0x196));var _0x9b82=function(_0x13938e,_0x245f53){_0x13938e=_0x13938e-0x0;var _0x5234d5=_0xb829[_0x13938e];return _0x5234d5;};'use strict';var client=require(_0x9b82('0x0'));exports['createContact']=function(_0x182092){return function(){_0x182092['campaign']=_0x182092[_0x9b82('0x1')];return client[_0x9b82('0x2')]('CreateCmHopperFinal',{'body':_0x182092,'log':'CreateCmHopperFinal'});};}; \ No newline at end of file +var _0x1537=['campaign','queue','Request','CreateCmHopperFinal','../client','createContact'];(function(_0x312837,_0x59f2b7){var _0xd82cf2=function(_0x56af54){while(--_0x56af54){_0x312837['push'](_0x312837['shift']());}};_0xd82cf2(++_0x59f2b7);}(_0x1537,0x172));var _0x7153=function(_0x3ae6c9,_0x5ae096){_0x3ae6c9=_0x3ae6c9-0x0;var _0x2be036=_0x1537[_0x3ae6c9];return _0x2be036;};'use strict';var client=require(_0x7153('0x0'));exports[_0x7153('0x1')]=function(_0x576713){return function(){_0x576713[_0x7153('0x2')]=_0x576713[_0x7153('0x3')];return client[_0x7153('0x4')](_0x7153('0x5'),{'body':_0x576713,'log':_0x7153('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index 6e505d6..9f9bcf2 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x521b=['createHistory','campaign','queue','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','subtract','minutes','YYYY-MM-DD\x20HH:mm:ss','format','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','startOf','day','endOf','ivr','GetCampaignHopperHistory','../client','moment'];(function(_0x2dbced,_0x3454a9){var _0xb3d71c=function(_0xf357f){while(--_0xf357f){_0x2dbced['push'](_0x2dbced['shift']());}};_0xb3d71c(++_0x3454a9);}(_0x521b,0x1a2));var _0xb521=function(_0x3dfb56,_0xfe844d){_0x3dfb56=_0x3dfb56-0x0;var _0x5e6e1b=_0x521b[_0x3dfb56];return _0x5e6e1b;};'use strict';var client=require(_0xb521('0x0'));var moment=require(_0xb521('0x1'));exports[_0xb521('0x2')]=function(_0x371021){_0x371021[_0xb521('0x3')]=_0x371021[_0xb521('0x4')];return client[_0xb521('0x5')]('CreateCmHopperHistory',{'body':_0x371021,'log':_0xb521('0x6')});};exports[_0xb521('0x7')]=function(_0x6ee601){return client[_0xb521('0x5')](_0xb521('0x8'),{'options':{'where':{'endtime':{'$between':[moment()[_0xb521('0x9')](_0x6ee601,_0xb521('0xa'))['format'](_0xb521('0xb')),moment()[_0xb521('0xc')](_0xb521('0xb'))]}},'raw':![]},'log':_0xb521('0xd')});};exports[_0xb521('0xe')]=function(){return function(){return client[_0xb521('0x5')](_0xb521('0xf'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xb521('0x10')](_0xb521('0x11'))[_0xb521('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xb521('0x12')]('day')[_0xb521('0xc')](_0xb521('0xb'))]},'campaigntype':_0xb521('0x4')},'raw':![]},'log':_0xb521('0xf')});};};exports['getCampaignHopperHistory']=function(){return function(){return client[_0xb521('0x5')]('GetCampaignHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0xb521('0x10')]('day')[_0xb521('0xc')](_0xb521('0xb')),moment()['endOf']('day')[_0xb521('0xc')](_0xb521('0xb'))]},'campaigntype':_0xb521('0x13')},'raw':![]},'log':_0xb521('0x14')});};}; \ No newline at end of file +var _0x4d3d=['avgHandleTime','Request','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','endOf','day','queue','getCampaignHopperHistory','GetCampaignHopperHistory','startOf','../client','moment','CreateCmHopperHistory'];(function(_0x50f30c,_0x13179a){var _0x144937=function(_0xda11b1){while(--_0xda11b1){_0x50f30c['push'](_0x50f30c['shift']());}};_0x144937(++_0x13179a);}(_0x4d3d,0xda));var _0xd4d3=function(_0x53c466,_0x52823a){_0x53c466=_0x53c466-0x0;var _0x1236e7=_0x4d3d[_0x53c466];return _0x1236e7;};'use strict';var client=require(_0xd4d3('0x0'));var moment=require(_0xd4d3('0x1'));exports['createHistory']=function(_0x2d0a08){_0x2d0a08['campaign']=_0x2d0a08['queue'];return client['Request']('CreateCmHopperHistory',{'body':_0x2d0a08,'log':_0xd4d3('0x2')});};exports[_0xd4d3('0x3')]=function(_0x242d7e){return client[_0xd4d3('0x4')]('AvgHandleTime',{'options':{'where':{'endtime':{'$between':[moment()[_0xd4d3('0x5')](_0x242d7e,_0xd4d3('0x6'))[_0xd4d3('0x7')](_0xd4d3('0x8')),moment()['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'raw':![]},'log':'GetCmHopperHistory'});};exports[_0xd4d3('0x9')]=function(){return function(){return client[_0xd4d3('0x4')](_0xd4d3('0xa'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf']('day')[_0xd4d3('0x7')](_0xd4d3('0x8')),moment()[_0xd4d3('0xb')](_0xd4d3('0xc'))[_0xd4d3('0x7')](_0xd4d3('0x8'))]},'campaigntype':_0xd4d3('0xd')},'raw':![]},'log':_0xd4d3('0xa')});};};exports[_0xd4d3('0xe')]=function(){return function(){return client[_0xd4d3('0x4')](_0xd4d3('0xf'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xd4d3('0x10')](_0xd4d3('0xc'))[_0xd4d3('0x7')](_0xd4d3('0x8')),moment()[_0xd4d3('0xb')](_0xd4d3('0xc'))[_0xd4d3('0x7')](_0xd4d3('0x8'))]},'campaigntype':'ivr'},'raw':![]},'log':_0xd4d3('0xf')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index 100b67d..f0e75f6 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0dc=['active','getFaxAccount','notify','NotifyFaxAccount','../client','Request','GetFaxAccount','description','ecm','headerinfo','localstationid','maxrate','gateway','faxdetect','t38timeout','tech','TrunkId','ListId','key','Trunk','name','callerid'];(function(_0x50e92a,_0x5f5061){var _0x356d3b=function(_0x36c006){while(--_0x36c006){_0x50e92a['push'](_0x50e92a['shift']());}};_0x356d3b(++_0x5f5061);}(_0xe0dc,0x190));var _0xce0d=function(_0x46003f,_0x18a160){_0x46003f=_0x46003f-0x0;var _0x373521=_0xe0dc[_0x46003f];return _0x373521;};'use strict';var client=require(_0xce0d('0x0'));exports['getFaxAccounts']=function(){return function(){return client[_0xce0d('0x1')](_0xce0d('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xce0d('0x3'),_0xce0d('0x4'),_0xce0d('0x5'),_0xce0d('0x6'),'minrate',_0xce0d('0x7'),'modem',_0xce0d('0x8'),_0xce0d('0x9'),_0xce0d('0xa'),_0xce0d('0xb'),_0xce0d('0xc'),_0xce0d('0xd'),_0xce0d('0xe')],'include':[{'model':_0xce0d('0xf'),'as':_0xce0d('0xf'),'attributes':['id',_0xce0d('0x10'),_0xce0d('0x11'),_0xce0d('0x12')]}]},'log':_0xce0d('0x13')});};};exports[_0xce0d('0x14')]=function(_0x3a4d42,_0x159b09){return client[_0xce0d('0x1')](_0xce0d('0x15'),{'account':{'id':_0x3a4d42},'body':_0x159b09,'log':_0xce0d('0x15')});}; \ No newline at end of file +var _0x078f=['ecm','headerinfo','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','TrunkId','ListId','key','Trunk','callerid','active','getFaxAccount','notify','NotifyFaxAccount','getFaxAccounts','Request','name','description'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0x078f,0x1b4));var _0xf078=function(_0x1c16f3,_0x5c0720){_0x1c16f3=_0x1c16f3-0x0;var _0x43226e=_0x078f[_0x1c16f3];return _0x43226e;};'use strict';var client=require('../client');exports[_0xf078('0x0')]=function(){return function(){return client[_0xf078('0x1')]('GetFaxAccount',{'options':{'raw':![],'attributes':['id',_0xf078('0x2'),_0xf078('0x3'),_0xf078('0x4'),_0xf078('0x5'),'localstationid',_0xf078('0x6'),_0xf078('0x7'),_0xf078('0x8'),_0xf078('0x9'),_0xf078('0xa'),_0xf078('0xb'),_0xf078('0xc'),_0xf078('0xd'),_0xf078('0xe'),_0xf078('0xf')],'include':[{'model':'Trunk','as':_0xf078('0x10'),'attributes':['id','name',_0xf078('0x11'),_0xf078('0x12')]}]},'log':_0xf078('0x13')});};};exports[_0xf078('0x14')]=function(_0x5946f5,_0x316c56){return client['Request'](_0xf078('0x15'),{'account':{'id':_0x5946f5},'body':_0x316c56,'log':_0xf078('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index f09c2ef..c8b69d2 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ed8=['Request','UpdateFaxMessage','../client','update'];(function(_0x56fa15,_0x90c270){var _0x3746f3=function(_0x40234f){while(--_0x40234f){_0x56fa15['push'](_0x56fa15['shift']());}};_0x3746f3(++_0x90c270);}(_0x1ed8,0x13a));var _0x81ed=function(_0x3116a5,_0x83608a){_0x3116a5=_0x3116a5-0x0;var _0x1505a7=_0x1ed8[_0x3116a5];return _0x1505a7;};'use strict';var client=require(_0x81ed('0x0'));exports[_0x81ed('0x1')]=function(_0x71ddf6,_0x22c3eb){return client[_0x81ed('0x2')](_0x81ed('0x3'),{'body':_0x22c3eb,'options':{'where':{'AttachmentId':_0x71ddf6}},'log':'UpdateFaxMessage'});}; \ No newline at end of file +var _0x1947=['update','Request','UpdateFaxMessage','../client'];(function(_0x5b7bbb,_0x3028c6){var _0x32cd52=function(_0x2cd3c2){while(--_0x2cd3c2){_0x5b7bbb['push'](_0x5b7bbb['shift']());}};_0x32cd52(++_0x3028c6);}(_0x1947,0x97));var _0x7194=function(_0x361ab9,_0x4f58db){_0x361ab9=_0x361ab9-0x0;var _0x4bc023=_0x1947[_0x361ab9];return _0x4bc023;};'use strict';var client=require(_0x7194('0x0'));exports[_0x7194('0x1')]=function(_0x47b524,_0x494384){return client[_0x7194('0x2')]('UpdateFaxMessage',{'body':_0x494384,'options':{'where':{'AttachmentId':_0x47b524}},'log':_0x7194('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index 552734c..7ef9e46 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0934=['DeskField','Descriptions','key','keyType','Fields','idField','nameField','customField','Tag','getDeskAccounts','GetDeskAccount','description','remoteUri','authType','type','serverUrl','DeskConfiguration','name','Subjects','content','variableName','Variable'];(function(_0x486479,_0x59fb45){var _0x467dd6=function(_0x4cf989){while(--_0x4cf989){_0x486479['push'](_0x486479['shift']());}};_0x467dd6(++_0x59fb45);}(_0x0934,0x8d));var _0x4093=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x0934[_0xc6be3a];return _0x56a310;};'use strict';var client=require('../../client');exports[_0x4093('0x0')]=function(){return function(_0x3bbad8){return client['Request'](_0x4093('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x4093('0x2'),'username','password',_0x4093('0x3'),_0x4093('0x4'),_0x4093('0x5'),_0x4093('0x6')],'include':[{'model':_0x4093('0x7'),'as':'Configurations','attributes':['id',_0x4093('0x8')],'include':[{'model':'DeskField','as':_0x4093('0x9'),'attributes':['id',_0x4093('0x5'),_0x4093('0xa'),_0x4093('0xb')],'include':[{'model':_0x4093('0xc'),'as':_0x4093('0xc'),'attributes':['id','name']}]},{'model':_0x4093('0xd'),'as':_0x4093('0xe'),'attributes':['id',_0x4093('0x5'),'content',_0x4093('0xf'),_0x4093('0x10'),'keyContent',_0x4093('0xb')],'include':[{'model':'Variable','as':_0x4093('0xc'),'attributes':['id',_0x4093('0x8')]}]},{'model':'DeskField','as':_0x4093('0x11'),'attributes':['id',_0x4093('0x5'),_0x4093('0xa'),_0x4093('0x12'),_0x4093('0x13'),_0x4093('0x14'),_0x4093('0xb')],'include':[{'model':_0x4093('0xc'),'as':'Variable','attributes':['id','name']}]},{'model':_0x4093('0x15'),'as':'Tags','attributes':['id',_0x4093('0x8')]}]}]},'log':_0x4093('0x1')});};}; \ No newline at end of file +var _0x5c88=['Variable','Descriptions','key','keyType','keyContent','Fields','idField','customField','Tag','Tags','../../client','Request','GetDeskAccount','name','description','password','remoteUri','authType','type','DeskConfiguration','DeskField','Subjects','content','variableName'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x5c88,0x172));var _0x85c8=function(_0x408ed9,_0x1010ff){_0x408ed9=_0x408ed9-0x0;var _0x48fced=_0x5c88[_0x408ed9];return _0x48fced;};'use strict';var client=require(_0x85c8('0x0'));exports['getDeskAccounts']=function(){return function(_0x4e41ae){return client[_0x85c8('0x1')](_0x85c8('0x2'),{'options':{'raw':![],'attributes':['id',_0x85c8('0x3'),_0x85c8('0x4'),'username',_0x85c8('0x5'),_0x85c8('0x6'),_0x85c8('0x7'),_0x85c8('0x8'),'serverUrl'],'include':[{'model':_0x85c8('0x9'),'as':'Configurations','attributes':['id',_0x85c8('0x3')],'include':[{'model':_0x85c8('0xa'),'as':_0x85c8('0xb'),'attributes':['id',_0x85c8('0x8'),_0x85c8('0xc'),_0x85c8('0xd')],'include':[{'model':'Variable','as':_0x85c8('0xe'),'attributes':['id',_0x85c8('0x3')]}]},{'model':_0x85c8('0xa'),'as':_0x85c8('0xf'),'attributes':['id',_0x85c8('0x8'),_0x85c8('0xc'),_0x85c8('0x10'),_0x85c8('0x11'),_0x85c8('0x12'),_0x85c8('0xd')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x85c8('0x3')]}]},{'model':'DeskField','as':_0x85c8('0x13'),'attributes':['id',_0x85c8('0x8'),_0x85c8('0xc'),_0x85c8('0x14'),'nameField',_0x85c8('0x15'),_0x85c8('0xd')],'include':[{'model':_0x85c8('0xe'),'as':'Variable','attributes':['id',_0x85c8('0x3')]}]},{'model':_0x85c8('0x16'),'as':_0x85c8('0x17'),'attributes':['id',_0x85c8('0x3')]}]}]},'log':_0x85c8('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index b57cbac..0344864 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x693f=['Fields','type','idField','customField','CloudProvider','data7','GetDynamics365Account','../../client','getDynamics365Accounts','Request','name','username','password','remoteUri','tenantId','clientId','clientSecret','description','modernAuthentication','Configurations','ticketType','additionalSearchContact','openNewTab','content','Variable','Dynamics365Field','Descriptions','key','keyType','variableName'];(function(_0x49bdc4,_0x1e2507){var _0x1f7437=function(_0x25a9f9){while(--_0x25a9f9){_0x49bdc4['push'](_0x49bdc4['shift']());}};_0x1f7437(++_0x1e2507);}(_0x693f,0x9d));var _0xf693=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x693f[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xf693('0x0'));exports[_0xf693('0x1')]=function(){return function(_0x3511a1){return client[_0xf693('0x2')]('GetDynamics365Account',{'options':{'raw':![],'attributes':['id',_0xf693('0x3'),_0xf693('0x4'),_0xf693('0x5'),_0xf693('0x6'),_0xf693('0x7'),_0xf693('0x8'),_0xf693('0x9'),'serverUrl',_0xf693('0xa'),_0xf693('0xb')],'include':[{'model':'Dynamics365Configuration','as':_0xf693('0xc'),'attributes':['id','name',_0xf693('0xd'),'moduleCreate',_0xf693('0xe'),_0xf693('0xf')],'include':[{'model':'Dynamics365Field','as':'Subjects','attributes':['id','type',_0xf693('0x10'),'variableName'],'include':[{'model':_0xf693('0x11'),'as':_0xf693('0x11'),'attributes':['id',_0xf693('0x3')]}]},{'model':_0xf693('0x12'),'as':_0xf693('0x13'),'attributes':['id','type','content',_0xf693('0x14'),_0xf693('0x15'),'keyContent',_0xf693('0x16')],'include':[{'model':_0xf693('0x11'),'as':'Variable','attributes':['id','name']}]},{'model':_0xf693('0x12'),'as':_0xf693('0x17'),'attributes':['id',_0xf693('0x18'),_0xf693('0x10'),_0xf693('0x19'),'nameField',_0xf693('0x1a'),_0xf693('0x16')],'include':[{'model':_0xf693('0x11'),'as':_0xf693('0x11'),'attributes':['id',_0xf693('0x3')]}]}]},{'model':_0xf693('0x1b'),'as':'CloudProvider','attributes':['id','data2','data5',_0xf693('0x1c')]}]},'log':_0xf693('0x1d')});};}; \ No newline at end of file +var _0x7894=['serverUrl','description','modernAuthentication','Dynamics365Configuration','Configurations','moduleCreate','openNewTab','Dynamics365Field','Subjects','content','Variable','type','key','keyContent','variableName','Fields','idField','nameField','CloudProvider','data5','../../client','getDynamics365Accounts','Request','GetDynamics365Account','name','password','remoteUri','clientId','clientSecret'];(function(_0x36d703,_0x55b354){var _0x12c909=function(_0x5e846a){while(--_0x5e846a){_0x36d703['push'](_0x36d703['shift']());}};_0x12c909(++_0x55b354);}(_0x7894,0x170));var _0x4789=function(_0x3eba48,_0x1f2425){_0x3eba48=_0x3eba48-0x0;var _0x46294d=_0x7894[_0x3eba48];return _0x46294d;};'use strict';var client=require(_0x4789('0x0'));exports[_0x4789('0x1')]=function(){return function(_0x2dfc22){return client[_0x4789('0x2')](_0x4789('0x3'),{'options':{'raw':![],'attributes':['id',_0x4789('0x4'),'username',_0x4789('0x5'),_0x4789('0x6'),'tenantId',_0x4789('0x7'),_0x4789('0x8'),_0x4789('0x9'),_0x4789('0xa'),_0x4789('0xb')],'include':[{'model':_0x4789('0xc'),'as':_0x4789('0xd'),'attributes':['id','name','ticketType',_0x4789('0xe'),'additionalSearchContact',_0x4789('0xf')],'include':[{'model':_0x4789('0x10'),'as':_0x4789('0x11'),'attributes':['id','type',_0x4789('0x12'),'variableName'],'include':[{'model':_0x4789('0x13'),'as':_0x4789('0x13'),'attributes':['id',_0x4789('0x4')]}]},{'model':'Dynamics365Field','as':'Descriptions','attributes':['id',_0x4789('0x14'),'content',_0x4789('0x15'),'keyType',_0x4789('0x16'),_0x4789('0x17')],'include':[{'model':'Variable','as':_0x4789('0x13'),'attributes':['id','name']}]},{'model':_0x4789('0x10'),'as':_0x4789('0x18'),'attributes':['id',_0x4789('0x14'),'content',_0x4789('0x19'),_0x4789('0x1a'),'customField',_0x4789('0x17')],'include':[{'model':'Variable','as':_0x4789('0x13'),'attributes':['id',_0x4789('0x4')]}]}]},{'model':'CloudProvider','as':_0x4789('0x1b'),'attributes':['id','data2',_0x4789('0x1c'),'data7']}]},'log':_0x4789('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index 7f243e0..aa39233 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10d=['FreshdeskConfiguration','Configurations','FreshdeskField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','nameField','customField','../../client','Request','GetFreshdeskAccount','name','username','apiKey','remoteUri','serverUrl'];(function(_0x5e22da,_0x3622d4){var _0x1b06fc=function(_0x47d2f1){while(--_0x47d2f1){_0x5e22da['push'](_0x5e22da['shift']());}};_0x1b06fc(++_0x3622d4);}(_0xb10d,0x17f));var _0xdb10=function(_0x24df39,_0x594ee3){_0x24df39=_0x24df39-0x0;var _0x3fa220=_0xb10d[_0x24df39];return _0x3fa220;};'use strict';var client=require(_0xdb10('0x0'));exports['getFreshdeskAccounts']=function(){return function(_0x8564ba){return client[_0xdb10('0x1')](_0xdb10('0x2'),{'options':{'raw':![],'attributes':['id',_0xdb10('0x3'),_0xdb10('0x4'),_0xdb10('0x5'),_0xdb10('0x6'),_0xdb10('0x7')],'include':[{'model':_0xdb10('0x8'),'as':_0xdb10('0x9'),'attributes':['id',_0xdb10('0x3')],'include':[{'model':'Tag','attributes':['id',_0xdb10('0x3')]},{'model':_0xdb10('0xa'),'as':_0xdb10('0xb'),'attributes':['id',_0xdb10('0xc'),_0xdb10('0xd'),_0xdb10('0xe')],'include':[{'model':_0xdb10('0xf'),'as':_0xdb10('0xf'),'attributes':['id',_0xdb10('0x3')]}]},{'model':_0xdb10('0xa'),'as':_0xdb10('0x10'),'attributes':['id',_0xdb10('0xc'),_0xdb10('0xd'),_0xdb10('0x11'),_0xdb10('0x12'),_0xdb10('0x13'),_0xdb10('0xe')],'include':[{'model':_0xdb10('0xf'),'as':_0xdb10('0xf'),'attributes':['id',_0xdb10('0x3')]}]},{'model':_0xdb10('0xa'),'as':_0xdb10('0x14'),'attributes':['id',_0xdb10('0xc'),_0xdb10('0xd'),'idField',_0xdb10('0x15'),_0xdb10('0x16'),_0xdb10('0xe')],'include':[{'model':_0xdb10('0xf'),'as':_0xdb10('0xf'),'attributes':['id',_0xdb10('0x3')]}]}]}]},'log':'GetFreshdeskAccount'});};}; \ No newline at end of file +var _0xc902=['type','content','Variable','Descriptions','key','keyType','keyContent','variableName','Fields','idField','nameField','customField','../../client','getFreshdeskAccounts','Request','GetFreshdeskAccount','name','apiKey','remoteUri','serverUrl','FreshdeskConfiguration','Configurations','FreshdeskField','Subjects'];(function(_0x2338fa,_0x80579a){var _0x42df9b=function(_0x13fe56){while(--_0x13fe56){_0x2338fa['push'](_0x2338fa['shift']());}};_0x42df9b(++_0x80579a);}(_0xc902,0x15c));var _0x2c90=function(_0xde34ca,_0x413606){_0xde34ca=_0xde34ca-0x0;var _0x2faa67=_0xc902[_0xde34ca];return _0x2faa67;};'use strict';var client=require(_0x2c90('0x0'));exports[_0x2c90('0x1')]=function(){return function(_0x40c2ce){return client[_0x2c90('0x2')](_0x2c90('0x3'),{'options':{'raw':![],'attributes':['id',_0x2c90('0x4'),'username',_0x2c90('0x5'),_0x2c90('0x6'),_0x2c90('0x7')],'include':[{'model':_0x2c90('0x8'),'as':_0x2c90('0x9'),'attributes':['id','name'],'include':[{'model':'Tag','attributes':['id',_0x2c90('0x4')]},{'model':_0x2c90('0xa'),'as':_0x2c90('0xb'),'attributes':['id',_0x2c90('0xc'),_0x2c90('0xd'),'variableName'],'include':[{'model':'Variable','as':_0x2c90('0xe'),'attributes':['id','name']}]},{'model':_0x2c90('0xa'),'as':_0x2c90('0xf'),'attributes':['id',_0x2c90('0xc'),_0x2c90('0xd'),_0x2c90('0x10'),_0x2c90('0x11'),_0x2c90('0x12'),_0x2c90('0x13')],'include':[{'model':'Variable','as':_0x2c90('0xe'),'attributes':['id',_0x2c90('0x4')]}]},{'model':'FreshdeskField','as':_0x2c90('0x14'),'attributes':['id','type',_0x2c90('0xd'),_0x2c90('0x15'),_0x2c90('0x16'),_0x2c90('0x17'),_0x2c90('0x13')],'include':[{'model':_0x2c90('0xe'),'as':'Variable','attributes':['id',_0x2c90('0x4')]}]}]}]},'log':_0x2c90('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index 085ad09..ee22b3d 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc21e=['Request','GetFreshsalesAccount','name','username','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField','Subjects','type','variableName','Variable','content','key','GetFreshsalesccount','getFreshsalesAccounts'];(function(_0x4cc17e,_0xbff357){var _0x4ee2e9=function(_0x3633d8){while(--_0x3633d8){_0x4cc17e['push'](_0x4cc17e['shift']());}};_0x4ee2e9(++_0xbff357);}(_0xc21e,0x1ca));var _0xec21=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc21e[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../../client');exports[_0xec21('0x0')]=function(){return function(_0x2f8bc2){return client[_0xec21('0x1')](_0xec21('0x2'),{'options':{'raw':![],'attributes':['id',_0xec21('0x3'),_0xec21('0x4'),'apiKey',_0xec21('0x5'),_0xec21('0x6')],'include':[{'model':_0xec21('0x7'),'as':_0xec21('0x8'),'attributes':['id',_0xec21('0x3')],'include':[{'model':_0xec21('0x9'),'as':_0xec21('0xa'),'attributes':['id',_0xec21('0xb'),'content',_0xec21('0xc')],'include':[{'model':_0xec21('0xd'),'as':_0xec21('0xd'),'attributes':['id',_0xec21('0x3')]}]},{'model':_0xec21('0x9'),'as':'Descriptions','attributes':['id',_0xec21('0xb'),_0xec21('0xe'),_0xec21('0xf'),'keyType','keyContent',_0xec21('0xc')],'include':[{'model':_0xec21('0xd'),'as':'Variable','attributes':['id',_0xec21('0x3')]}]}]}]},'log':_0xec21('0x10')});};}; \ No newline at end of file +var _0xacf4=['Configurations','FreshsalesField','Subjects','type','content','variableName','Descriptions','keyType','keyContent','Variable','Request','GetFreshsalesAccount','name','username','apiKey','remoteUri','FreshsalesConfiguration'];(function(_0x1ada0c,_0x12fe1e){var _0x592b83=function(_0x4eeaf9){while(--_0x4eeaf9){_0x1ada0c['push'](_0x1ada0c['shift']());}};_0x592b83(++_0x12fe1e);}(_0xacf4,0xe7));var _0x4acf=function(_0x3f6106,_0x35ca26){_0x3f6106=_0x3f6106-0x0;var _0x1ff77e=_0xacf4[_0x3f6106];return _0x1ff77e;};'use strict';var client=require('../../client');exports['getFreshsalesAccounts']=function(){return function(_0x867c40){return client[_0x4acf('0x0')](_0x4acf('0x1'),{'options':{'raw':![],'attributes':['id',_0x4acf('0x2'),_0x4acf('0x3'),_0x4acf('0x4'),_0x4acf('0x5'),'serverUrl'],'include':[{'model':_0x4acf('0x6'),'as':_0x4acf('0x7'),'attributes':['id','name'],'include':[{'model':_0x4acf('0x8'),'as':_0x4acf('0x9'),'attributes':['id',_0x4acf('0xa'),_0x4acf('0xb'),_0x4acf('0xc')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x4acf('0x2')]}]},{'model':'FreshsalesField','as':_0x4acf('0xd'),'attributes':['id',_0x4acf('0xa'),_0x4acf('0xb'),'key',_0x4acf('0xe'),_0x4acf('0xf'),'variableName'],'include':[{'model':'Variable','as':_0x4acf('0x10'),'attributes':['id','name']}]}]}]},'log':'GetFreshsalesccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index a3891d8..22735f6 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd9f=['moduleCreate','ticketType','leadId','additionalSearchContact','SalesforceField','Variable','Descriptions','GetSalesforceAccount','Request','name','password','clientId','clientSecret','securityToken','type','Configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd9f,0x98));var _0xfbd9=function(_0x2828b2,_0x4b2485){_0x2828b2=_0x2828b2-0x0;var _0x3422b5=_0xbd9f[_0x2828b2];return _0x3422b5;};'use strict';var client=require('../../client');exports['getSalesforceAccounts']=function(){return function(_0x5c633c){return client[_0xfbd9('0x0')]('GetSalesforceAccount',{'options':{'raw':![],'attributes':['id',_0xfbd9('0x1'),'username',_0xfbd9('0x2'),'remoteUri',_0xfbd9('0x3'),_0xfbd9('0x4'),_0xfbd9('0x5'),'serverUrl',_0xfbd9('0x6')],'include':[{'model':'SalesforceConfiguration','as':_0xfbd9('0x7'),'attributes':['id',_0xfbd9('0x1'),'moduleSearch',_0xfbd9('0x8'),_0xfbd9('0x9'),_0xfbd9('0xa'),'additionalSearchAccount',_0xfbd9('0xb'),'additionalSearchLead'],'include':[{'model':_0xfbd9('0xc'),'as':'Subjects','include':[{'model':_0xfbd9('0xd'),'as':_0xfbd9('0xd'),'attributes':['id','name']}]},{'model':_0xfbd9('0xc'),'as':_0xfbd9('0xe'),'include':[{'model':'Variable','as':_0xfbd9('0xd'),'attributes':['id',_0xfbd9('0x1')]}]},{'model':_0xfbd9('0xc'),'as':'Fields','include':[{'model':_0xfbd9('0xd'),'as':'Variable','attributes':['id','name']}]}]}]},'log':_0xfbd9('0xf')});};}; \ No newline at end of file +var _0xb5bf=['password','remoteUri','clientId','clientSecret','securityToken','type','SalesforceConfiguration','Configurations','name','moduleSearch','moduleCreate','additionalSearchContact','SalesforceField','Variable','Fields','../../client','getSalesforceAccounts','GetSalesforceAccount','username'];(function(_0x289ff9,_0x473dbb){var _0x271867=function(_0x216d15){while(--_0x216d15){_0x289ff9['push'](_0x289ff9['shift']());}};_0x271867(++_0x473dbb);}(_0xb5bf,0x1d7));var _0xfb5b=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0xb5bf[_0x19b3f9];return _0x18c3f6;};'use strict';var client=require(_0xfb5b('0x0'));exports[_0xfb5b('0x1')]=function(){return function(_0x2abb01){return client['Request'](_0xfb5b('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xfb5b('0x3'),_0xfb5b('0x4'),_0xfb5b('0x5'),_0xfb5b('0x6'),_0xfb5b('0x7'),_0xfb5b('0x8'),'serverUrl',_0xfb5b('0x9')],'include':[{'model':_0xfb5b('0xa'),'as':_0xfb5b('0xb'),'attributes':['id',_0xfb5b('0xc'),_0xfb5b('0xd'),_0xfb5b('0xe'),'ticketType','leadId','additionalSearchAccount',_0xfb5b('0xf'),'additionalSearchLead'],'include':[{'model':_0xfb5b('0x10'),'as':'Subjects','include':[{'model':'Variable','as':_0xfb5b('0x11'),'attributes':['id',_0xfb5b('0xc')]}]},{'model':_0xfb5b('0x10'),'as':'Descriptions','include':[{'model':_0xfb5b('0x11'),'as':_0xfb5b('0x11'),'attributes':['id',_0xfb5b('0xc')]}]},{'model':_0xfb5b('0x10'),'as':_0xfb5b('0x12'),'include':[{'model':_0xfb5b('0x11'),'as':_0xfb5b('0x11'),'attributes':['id',_0xfb5b('0xc')]}]}]}]},'log':'GetSalesforceAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index 32c2c13..d6a892d 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['../../client','getServicenowAccounts','Request','GetServicenowAccount','name','description','username','password','email','remoteUri','serverUrl','ServicenowConfiguration','ServicenowField','Subjects','type','variableName','Variable','Descriptions','content','key','keyType','keyContent','Fields','nameField','customField'];(function(_0x341ddf,_0x29a313){var _0x87a484=function(_0x195549){while(--_0x195549){_0x341ddf['push'](_0x341ddf['shift']());}};_0x87a484(++_0x29a313);}(_0x5fab,0x177));var _0xb5fa=function(_0x4ecee3,_0x34ef3a){_0x4ecee3=_0x4ecee3-0x0;var _0xd8c0e3=_0x5fab[_0x4ecee3];return _0xd8c0e3;};'use strict';var client=require(_0xb5fa('0x0'));exports[_0xb5fa('0x1')]=function(){return function(_0x4c67f9){return client[_0xb5fa('0x2')](_0xb5fa('0x3'),{'options':{'raw':![],'attributes':['id',_0xb5fa('0x4'),_0xb5fa('0x5'),_0xb5fa('0x6'),_0xb5fa('0x7'),_0xb5fa('0x8'),_0xb5fa('0x9'),_0xb5fa('0xa')],'include':[{'model':_0xb5fa('0xb'),'as':'Configurations','attributes':['id','name'],'include':[{'model':_0xb5fa('0xc'),'as':_0xb5fa('0xd'),'attributes':['id',_0xb5fa('0xe'),'content',_0xb5fa('0xf')],'include':[{'model':_0xb5fa('0x10'),'as':_0xb5fa('0x10'),'attributes':['id','name']}]},{'model':'ServicenowField','as':_0xb5fa('0x11'),'attributes':['id',_0xb5fa('0xe'),_0xb5fa('0x12'),_0xb5fa('0x13'),_0xb5fa('0x14'),_0xb5fa('0x15'),_0xb5fa('0xf')],'include':[{'model':_0xb5fa('0x10'),'as':_0xb5fa('0x10'),'attributes':['id','name']}]},{'model':_0xb5fa('0xc'),'as':_0xb5fa('0x16'),'attributes':['id','type',_0xb5fa('0x12'),'idField',_0xb5fa('0x17'),_0xb5fa('0x18'),_0xb5fa('0xf')],'include':[{'model':_0xb5fa('0x10'),'as':_0xb5fa('0x10'),'attributes':['id','name']}]}]}]},'log':'GetServicenowkAccount'});};}; \ No newline at end of file +var _0x57ca=['type','variableName','Variable','Descriptions','content','key','keyContent','Fields','nameField','customField','GetServicenowkAccount','getServicenowAccounts','GetServicenowAccount','name','description','username','password','remoteUri','serverUrl','ServicenowConfiguration','Configurations','ServicenowField','Subjects'];(function(_0x4e1a49,_0x4da738){var _0x136aae=function(_0x3ffd93){while(--_0x3ffd93){_0x4e1a49['push'](_0x4e1a49['shift']());}};_0x136aae(++_0x4da738);}(_0x57ca,0x108));var _0xa57c=function(_0x42110e,_0x15bcd5){_0x42110e=_0x42110e-0x0;var _0x42f379=_0x57ca[_0x42110e];return _0x42f379;};'use strict';var client=require('../../client');exports[_0xa57c('0x0')]=function(){return function(_0x4ad696){return client['Request'](_0xa57c('0x1'),{'options':{'raw':![],'attributes':['id',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),'email',_0xa57c('0x6'),_0xa57c('0x7')],'include':[{'model':_0xa57c('0x8'),'as':_0xa57c('0x9'),'attributes':['id',_0xa57c('0x2')],'include':[{'model':_0xa57c('0xa'),'as':_0xa57c('0xb'),'attributes':['id',_0xa57c('0xc'),'content',_0xa57c('0xd')],'include':[{'model':'Variable','as':_0xa57c('0xe'),'attributes':['id',_0xa57c('0x2')]}]},{'model':'ServicenowField','as':_0xa57c('0xf'),'attributes':['id','type',_0xa57c('0x10'),_0xa57c('0x11'),'keyType',_0xa57c('0x12'),'variableName'],'include':[{'model':_0xa57c('0xe'),'as':_0xa57c('0xe'),'attributes':['id',_0xa57c('0x2')]}]},{'model':_0xa57c('0xa'),'as':_0xa57c('0x13'),'attributes':['id','type',_0xa57c('0x10'),'idField',_0xa57c('0x14'),_0xa57c('0x15'),_0xa57c('0xd')],'include':[{'model':_0xa57c('0xe'),'as':_0xa57c('0xe'),'attributes':['id',_0xa57c('0x2')]}]}]}]},'log':_0xa57c('0x16')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index f446651..95bde05 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['SugarcrmField','Descriptions','keyType','keyContent','Fields','idField','../../client','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','password','remoteUri','SugarcrmConfiguration','Configurations','Subjects','type','content','variableName','Variable'];(function(_0x4ad8c6,_0xfb3455){var _0x20f6b9=function(_0x449068){while(--_0x449068){_0x4ad8c6['push'](_0x4ad8c6['shift']());}};_0x20f6b9(++_0xfb3455);}(_0x2ef3,0xba));var _0x32ef=function(_0x4667b9,_0xb5ef19){_0x4667b9=_0x4667b9-0x0;var _0x41a646=_0x2ef3[_0x4667b9];return _0x41a646;};'use strict';var client=require(_0x32ef('0x0'));exports[_0x32ef('0x1')]=function(){return function(_0x47513a){return client[_0x32ef('0x2')](_0x32ef('0x3'),{'options':{'raw':![],'attributes':['id',_0x32ef('0x4'),'username',_0x32ef('0x5'),_0x32ef('0x6'),'serverUrl'],'include':[{'model':_0x32ef('0x7'),'as':_0x32ef('0x8'),'attributes':['id','name'],'include':[{'model':'SugarcrmField','as':_0x32ef('0x9'),'attributes':['id',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc')],'include':[{'model':_0x32ef('0xd'),'as':_0x32ef('0xd'),'attributes':['id',_0x32ef('0x4')]}]},{'model':_0x32ef('0xe'),'as':_0x32ef('0xf'),'attributes':['id',_0x32ef('0xa'),'content','key',_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0xc')],'include':[{'model':_0x32ef('0xd'),'as':'Variable','attributes':['id',_0x32ef('0x4')]}]},{'model':'SugarcrmField','as':_0x32ef('0x12'),'attributes':['id','type',_0x32ef('0xb'),_0x32ef('0x13'),'nameField','customField',_0x32ef('0xc')],'include':[{'model':'Variable','as':_0x32ef('0xd'),'attributes':['id',_0x32ef('0x4')]}]}]}]},'log':_0x32ef('0x3')});};}; \ No newline at end of file +var _0x0295=['remoteUri','serverUrl','SugarcrmConfiguration','Configurations','name','SugarcrmField','Subjects','Variable','Descriptions','content','key','keyType','variableName','Fields','customField','GetSugarcrmAccount','../../client','Request','username','password'];(function(_0x32e237,_0x49e5f3){var _0x18bbe8=function(_0x324a07){while(--_0x324a07){_0x32e237['push'](_0x32e237['shift']());}};_0x18bbe8(++_0x49e5f3);}(_0x0295,0x1f0));var _0x5029=function(_0x56e027,_0x496a98){_0x56e027=_0x56e027-0x0;var _0x33ffc4=_0x0295[_0x56e027];return _0x33ffc4;};'use strict';var client=require(_0x5029('0x0'));exports['getSugarcrmAccounts']=function(){return function(_0x5e71d0){return client[_0x5029('0x1')]('GetSugarcrmAccount',{'options':{'raw':![],'attributes':['id','name',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5')],'include':[{'model':_0x5029('0x6'),'as':_0x5029('0x7'),'attributes':['id',_0x5029('0x8')],'include':[{'model':_0x5029('0x9'),'as':_0x5029('0xa'),'attributes':['id','type','content','variableName'],'include':[{'model':_0x5029('0xb'),'as':'Variable','attributes':['id',_0x5029('0x8')]}]},{'model':'SugarcrmField','as':_0x5029('0xc'),'attributes':['id','type',_0x5029('0xd'),_0x5029('0xe'),_0x5029('0xf'),'keyContent',_0x5029('0x10')],'include':[{'model':_0x5029('0xb'),'as':_0x5029('0xb'),'attributes':['id','name']}]},{'model':_0x5029('0x9'),'as':_0x5029('0x11'),'attributes':['id','type','content','idField','nameField',_0x5029('0x12'),_0x5029('0x10')],'include':[{'model':_0x5029('0xb'),'as':_0x5029('0xb'),'attributes':['id',_0x5029('0x8')]}]}]}]},'log':_0x5029('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index 4bb97b4..5aa2ccc 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadf8=['idField','nameField','../../client','getVtigerAccounts','Request','GetVtigerAccount','description','username','accessKey','remoteUri','serverUrl','VtigerConfiguration','Configurations','name','type','content','variableName','Variable','VtigerField','Descriptions','key','keyContent','Fields'];(function(_0x51df00,_0x4ac573){var _0x198328=function(_0x24e0ec){while(--_0x24e0ec){_0x51df00['push'](_0x51df00['shift']());}};_0x198328(++_0x4ac573);}(_0xadf8,0x172));var _0x8adf=function(_0x9a7ea6,_0x1807a2){_0x9a7ea6=_0x9a7ea6-0x0;var _0x1c2040=_0xadf8[_0x9a7ea6];return _0x1c2040;};'use strict';var client=require(_0x8adf('0x0'));exports[_0x8adf('0x1')]=function(){return function(_0x525fe8){return client[_0x8adf('0x2')](_0x8adf('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x8adf('0x4'),_0x8adf('0x5'),_0x8adf('0x6'),_0x8adf('0x7'),_0x8adf('0x8')],'include':[{'model':_0x8adf('0x9'),'as':_0x8adf('0xa'),'attributes':['id',_0x8adf('0xb')],'include':[{'model':'VtigerField','as':'Subjects','attributes':['id',_0x8adf('0xc'),_0x8adf('0xd'),_0x8adf('0xe')],'include':[{'model':'Variable','as':_0x8adf('0xf'),'attributes':['id',_0x8adf('0xb')]}]},{'model':_0x8adf('0x10'),'as':_0x8adf('0x11'),'attributes':['id','type',_0x8adf('0xd'),_0x8adf('0x12'),'keyType',_0x8adf('0x13'),_0x8adf('0xe')],'include':[{'model':'Variable','as':_0x8adf('0xf'),'attributes':['id',_0x8adf('0xb')]}]},{'model':_0x8adf('0x10'),'as':_0x8adf('0x14'),'attributes':['id','type',_0x8adf('0xd'),_0x8adf('0x15'),_0x8adf('0x16'),'customField','variableName'],'include':[{'model':'Variable','as':_0x8adf('0xf'),'attributes':['id',_0x8adf('0xb')]}]}]}]},'log':_0x8adf('0x3')});};}; \ No newline at end of file +var _0xe01d=['content','Variable','Descriptions','key','keyType','keyContent','Fields','idField','nameField','customField','variableName','Request','GetVtigerAccount','name','description','username','serverUrl','VtigerConfiguration','Configurations','VtigerField','Subjects','type'];(function(_0x5c17d8,_0x51cc20){var _0x1841de=function(_0x128311){while(--_0x128311){_0x5c17d8['push'](_0x5c17d8['shift']());}};_0x1841de(++_0x51cc20);}(_0xe01d,0xd1));var _0xde01=function(_0x509083,_0xa6676b){_0x509083=_0x509083-0x0;var _0x4b2495=_0xe01d[_0x509083];return _0x4b2495;};'use strict';var client=require('../../client');exports['getVtigerAccounts']=function(){return function(_0x7447dc){return client[_0xde01('0x0')](_0xde01('0x1'),{'options':{'raw':![],'attributes':['id',_0xde01('0x2'),_0xde01('0x3'),_0xde01('0x4'),'accessKey','remoteUri',_0xde01('0x5')],'include':[{'model':_0xde01('0x6'),'as':_0xde01('0x7'),'attributes':['id',_0xde01('0x2')],'include':[{'model':_0xde01('0x8'),'as':_0xde01('0x9'),'attributes':['id',_0xde01('0xa'),_0xde01('0xb'),'variableName'],'include':[{'model':_0xde01('0xc'),'as':_0xde01('0xc'),'attributes':['id',_0xde01('0x2')]}]},{'model':_0xde01('0x8'),'as':_0xde01('0xd'),'attributes':['id',_0xde01('0xa'),'content',_0xde01('0xe'),_0xde01('0xf'),_0xde01('0x10'),'variableName'],'include':[{'model':_0xde01('0xc'),'as':_0xde01('0xc'),'attributes':['id',_0xde01('0x2')]}]},{'model':_0xde01('0x8'),'as':_0xde01('0x11'),'attributes':['id','type',_0xde01('0xb'),_0xde01('0x12'),_0xde01('0x13'),_0xde01('0x14'),_0xde01('0x15')],'include':[{'model':_0xde01('0xc'),'as':'Variable','attributes':['id',_0xde01('0x2')]}]}]}]},'log':_0xde01('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index 350815a..b65b214 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec10=['type','Tag','ZendeskField','content','Variable','Descriptions','key','keyType','keyContent','variableName','idField','nameField','customField','GetZendeskAccount','../../client','getZendeskAccounts','Request','name','username','password','remoteUri','authType','serverUrl'];(function(_0x72a33d,_0x5691da){var _0x2621d5=function(_0x95b7c6){while(--_0x95b7c6){_0x72a33d['push'](_0x72a33d['shift']());}};_0x2621d5(++_0x5691da);}(_0xec10,0x1da));var _0x0ec1=function(_0x51d008,_0x3b4139){_0x51d008=_0x51d008-0x0;var _0x2a68c1=_0xec10[_0x51d008];return _0x2a68c1;};'use strict';var client=require(_0x0ec1('0x0'));exports[_0x0ec1('0x1')]=function(){return function(_0x4027b9){return client[_0x0ec1('0x2')]('GetZendeskAccount',{'options':{'raw':![],'attributes':['id',_0x0ec1('0x3'),_0x0ec1('0x4'),_0x0ec1('0x5'),'token',_0x0ec1('0x6'),_0x0ec1('0x7'),_0x0ec1('0x8'),_0x0ec1('0x9')],'include':[{'model':'ZendeskConfiguration','as':'Configurations','attributes':['id',_0x0ec1('0x3')],'include':[{'model':_0x0ec1('0xa'),'attributes':['id',_0x0ec1('0x3')]},{'model':_0x0ec1('0xb'),'as':'Subjects','attributes':['id',_0x0ec1('0x9'),_0x0ec1('0xc'),'variableName'],'include':[{'model':_0x0ec1('0xd'),'as':_0x0ec1('0xd'),'attributes':['id',_0x0ec1('0x3')]}]},{'model':_0x0ec1('0xb'),'as':_0x0ec1('0xe'),'attributes':['id','type',_0x0ec1('0xc'),_0x0ec1('0xf'),_0x0ec1('0x10'),_0x0ec1('0x11'),_0x0ec1('0x12')],'include':[{'model':_0x0ec1('0xd'),'as':_0x0ec1('0xd'),'attributes':['id','name']}]},{'model':'ZendeskField','as':'Fields','attributes':['id',_0x0ec1('0x9'),'content',_0x0ec1('0x13'),_0x0ec1('0x14'),_0x0ec1('0x15'),_0x0ec1('0x12')],'include':[{'model':_0x0ec1('0xd'),'as':_0x0ec1('0xd'),'attributes':['id',_0x0ec1('0x3')]}]}]}]},'log':_0x0ec1('0x16')});};}; \ No newline at end of file +var _0x2557=['ZendeskConfiguration','Tag','ZendeskField','Subjects','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','nameField','customField','GetZendeskAccount','../../client','Request','name','password','token','remoteUri','authType','type'];(function(_0x3bcb7c,_0x5af870){var _0x584411=function(_0x4b9a67){while(--_0x4b9a67){_0x3bcb7c['push'](_0x3bcb7c['shift']());}};_0x584411(++_0x5af870);}(_0x2557,0xde));var _0x7255=function(_0x50222b,_0x535589){_0x50222b=_0x50222b-0x0;var _0x4d14c8=_0x2557[_0x50222b];return _0x4d14c8;};'use strict';var client=require(_0x7255('0x0'));exports['getZendeskAccounts']=function(){return function(_0xd1425c){return client[_0x7255('0x1')]('GetZendeskAccount',{'options':{'raw':![],'attributes':['id',_0x7255('0x2'),'username',_0x7255('0x3'),_0x7255('0x4'),_0x7255('0x5'),_0x7255('0x6'),'serverUrl',_0x7255('0x7')],'include':[{'model':_0x7255('0x8'),'as':'Configurations','attributes':['id',_0x7255('0x2')],'include':[{'model':_0x7255('0x9'),'attributes':['id',_0x7255('0x2')]},{'model':_0x7255('0xa'),'as':_0x7255('0xb'),'attributes':['id',_0x7255('0x7'),_0x7255('0xc'),_0x7255('0xd')],'include':[{'model':'Variable','as':_0x7255('0xe'),'attributes':['id',_0x7255('0x2')]}]},{'model':_0x7255('0xa'),'as':_0x7255('0xf'),'attributes':['id','type',_0x7255('0xc'),_0x7255('0x10'),_0x7255('0x11'),_0x7255('0x12'),_0x7255('0xd')],'include':[{'model':_0x7255('0xe'),'as':_0x7255('0xe'),'attributes':['id',_0x7255('0x2')]}]},{'model':_0x7255('0xa'),'as':_0x7255('0x13'),'attributes':['id',_0x7255('0x7'),_0x7255('0xc'),'idField',_0x7255('0x14'),_0x7255('0x15'),_0x7255('0xd')],'include':[{'model':_0x7255('0xe'),'as':_0x7255('0xe'),'attributes':['id',_0x7255('0x2')]}]}]}]},'log':_0x7255('0x16')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index 619cd5e..5e00357 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc165=['variableName','Variable','Descriptions','type','key','keyType','idField','nameField','GetZohoAccount','../../client','getZohoAccounts','Request','name','description','host','zone','clientId','code','Configurations','moduleCreate','moduleSearch','ZohoField','Subjects','content'];(function(_0x75c21a,_0x10e6da){var _0x3fd077=function(_0x249e36){while(--_0x249e36){_0x75c21a['push'](_0x75c21a['shift']());}};_0x3fd077(++_0x10e6da);}(_0xc165,0x129));var _0x5c16=function(_0x467488,_0x38c7ae){_0x467488=_0x467488-0x0;var _0x56107f=_0xc165[_0x467488];return _0x56107f;};'use strict';var client=require(_0x5c16('0x0'));exports[_0x5c16('0x1')]=function(){return function(_0x30f06c){return client[_0x5c16('0x2')]('GetZohoAccount',{'options':{'raw':![],'attributes':['id',_0x5c16('0x3'),_0x5c16('0x4'),_0x5c16('0x5'),_0x5c16('0x6'),_0x5c16('0x7'),'clientSecret','serverUrl',_0x5c16('0x8'),'refreshToken'],'include':[{'model':'ZohoConfiguration','as':_0x5c16('0x9'),'attributes':['id','name',_0x5c16('0xa'),_0x5c16('0xb'),_0x5c16('0x4')],'include':[{'model':_0x5c16('0xc'),'as':_0x5c16('0xd'),'attributes':['id','type',_0x5c16('0xe'),_0x5c16('0xf')],'include':[{'model':_0x5c16('0x10'),'as':_0x5c16('0x10'),'attributes':['id',_0x5c16('0x3')]}]},{'model':_0x5c16('0xc'),'as':_0x5c16('0x11'),'attributes':['id',_0x5c16('0x12'),'content',_0x5c16('0x13'),_0x5c16('0x14'),'keyContent','variableName'],'include':[{'model':_0x5c16('0x10'),'as':_0x5c16('0x10'),'attributes':['id',_0x5c16('0x3')]}]},{'model':_0x5c16('0xc'),'as':'Fields','attributes':['id',_0x5c16('0x12'),_0x5c16('0xe'),_0x5c16('0x15'),_0x5c16('0x16'),'customField',_0x5c16('0xf')],'include':[{'model':_0x5c16('0x10'),'as':_0x5c16('0x10'),'attributes':['id','name']}]}]}]},'log':_0x5c16('0x17')});};}; \ No newline at end of file +var _0x00e3=['type','content','Variable','Descriptions','key','keyType','keyContent','Fields','idField','customField','variableName','../../client','getZohoAccounts','Request','GetZohoAccount','name','description','host','zone','serverUrl','code','ZohoConfiguration','moduleCreate','ZohoField','Subjects'];(function(_0x4144a2,_0x4941e0){var _0x1dcb50=function(_0x43e737){while(--_0x43e737){_0x4144a2['push'](_0x4144a2['shift']());}};_0x1dcb50(++_0x4941e0);}(_0x00e3,0x182));var _0x300e=function(_0xc9a48e,_0x4d3e72){_0xc9a48e=_0xc9a48e-0x0;var _0x419127=_0x00e3[_0xc9a48e];return _0x419127;};'use strict';var client=require(_0x300e('0x0'));exports[_0x300e('0x1')]=function(){return function(_0xd5f94d){return client[_0x300e('0x2')](_0x300e('0x3'),{'options':{'raw':![],'attributes':['id',_0x300e('0x4'),_0x300e('0x5'),_0x300e('0x6'),_0x300e('0x7'),'clientId','clientSecret',_0x300e('0x8'),_0x300e('0x9'),'refreshToken'],'include':[{'model':_0x300e('0xa'),'as':'Configurations','attributes':['id',_0x300e('0x4'),_0x300e('0xb'),'moduleSearch',_0x300e('0x5')],'include':[{'model':_0x300e('0xc'),'as':_0x300e('0xd'),'attributes':['id',_0x300e('0xe'),_0x300e('0xf'),'variableName'],'include':[{'model':_0x300e('0x10'),'as':_0x300e('0x10'),'attributes':['id',_0x300e('0x4')]}]},{'model':_0x300e('0xc'),'as':_0x300e('0x11'),'attributes':['id',_0x300e('0xe'),'content',_0x300e('0x12'),_0x300e('0x13'),_0x300e('0x14'),'variableName'],'include':[{'model':_0x300e('0x10'),'as':_0x300e('0x10'),'attributes':['id',_0x300e('0x4')]}]},{'model':'ZohoField','as':_0x300e('0x15'),'attributes':['id',_0x300e('0xe'),_0x300e('0xf'),_0x300e('0x16'),'nameField',_0x300e('0x17'),_0x300e('0x18')],'include':[{'model':'Variable','as':_0x300e('0x10'),'attributes':['id',_0x300e('0x4')]}]}]}]},'log':'GetZohoAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index 3a0a0fa..46d69c9 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc31b=['dialer','replace','silly','length','resolve','every','string','map','interval','concat','Request','IntervalIftime','intervalIftime'];(function(_0x39bc44,_0x1d4373){var _0x2916d8=function(_0x1767ac){while(--_0x1767ac){_0x39bc44['push'](_0x39bc44['shift']());}};_0x2916d8(++_0x1d4373);}(_0xc31b,0xdd));var _0xbc31=function(_0xe3e7a,_0x152a71){_0xe3e7a=_0xe3e7a-0x0;var _0x2ce111=_0xc31b[_0xe3e7a];return _0x2ce111;};var logger=require('../../../config/logger')(_0xbc31('0x0'));var client=require('../client');function intervalIftime(_0x57947d,_0x4aa64d){const _0xfb84c8=new Error()['stack'][_0xbc31('0x1')](/^Error/,'')['trim']();logger[_0xbc31('0x2')]('intervalIftime\x20called\x20with',_0x57947d,_0x4aa64d,_0xfb84c8);const _0x3b5b43=Array['isArray'](_0x57947d);if(!_0x57947d||_0x3b5b43&&_0x57947d[_0xbc31('0x3')]===0x0){return Promise[_0xbc31('0x4')](![]);}else{var _0x518c46=[];var _0xbc4604=[];var _0x327fc1=_0x3b5b43?_0x57947d:[_0x57947d];var _0x4b73d6=_0x327fc1[_0xbc31('0x5')](function(_0x2c891c){return typeof _0x2c891c==='number';});var _0x25de85=_0x327fc1[_0xbc31('0x5')](function(_0x47aa28){return typeof _0x47aa28===_0xbc31('0x6');});if(!_0x4b73d6&&!_0x25de85){_0x518c46=_0x327fc1[_0xbc31('0x7')](function(_0x591c53){return _0x591c53['id'];});if(_0x518c46[_0xbc31('0x3')]===0x0){_0xbc4604=_0x327fc1[_0xbc31('0x7')](function(_0x3a3401){return _0x3a3401[_0xbc31('0x8')];});}}else{if(_0x4b73d6){_0x518c46=_0x518c46['concat'](_0x327fc1);}if(_0x25de85){_0xbc4604=_0xbc4604[_0xbc31('0x9')](_0x327fc1);}}return client[_0xbc31('0xa')]('IntervalIftime',{'intervalIds':_0x518c46,'intervals':_0xbc4604,'timezone':_0x4aa64d,'log':_0xbc31('0xb')});}}exports[_0xbc31('0xc')]=intervalIftime; \ No newline at end of file +var _0x80f2=['../client','stack','trim','intervalIftime\x20called\x20with','isArray','every','number','map','length','interval','concat','IntervalIftime','intervalIftime','../../../config/logger','dialer'];(function(_0xce46e8,_0x1a0d79){var _0x400c7d=function(_0x46a4e4){while(--_0x46a4e4){_0xce46e8['push'](_0xce46e8['shift']());}};_0x400c7d(++_0x1a0d79);}(_0x80f2,0xfd));var _0x280f=function(_0xde12cd,_0x269a1f){_0xde12cd=_0xde12cd-0x0;var _0x93a6e2=_0x80f2[_0xde12cd];return _0x93a6e2;};var logger=require(_0x280f('0x0'))(_0x280f('0x1'));var client=require(_0x280f('0x2'));function intervalIftime(_0x1ab85a,_0x53cb4c){const _0x3eb174=new Error()[_0x280f('0x3')]['replace'](/^Error/,'')[_0x280f('0x4')]();logger['silly'](_0x280f('0x5'),_0x1ab85a,_0x53cb4c,_0x3eb174);const _0x58a65f=Array[_0x280f('0x6')](_0x1ab85a);if(!_0x1ab85a||_0x58a65f&&_0x1ab85a['length']===0x0){return Promise['resolve'](![]);}else{var _0x473389=[];var _0x300763=[];var _0x527fae=_0x58a65f?_0x1ab85a:[_0x1ab85a];var _0x47c548=_0x527fae[_0x280f('0x7')](function(_0xccad78){return typeof _0xccad78===_0x280f('0x8');});var _0xee133f=_0x527fae[_0x280f('0x7')](function(_0x4f2c19){return typeof _0x4f2c19==='string';});if(!_0x47c548&&!_0xee133f){_0x473389=_0x527fae[_0x280f('0x9')](function(_0x51b0be){return _0x51b0be['id'];});if(_0x473389[_0x280f('0xa')]===0x0){_0x300763=_0x527fae[_0x280f('0x9')](function(_0x4be690){return _0x4be690[_0x280f('0xb')];});}}else{if(_0x47c548){_0x473389=_0x473389['concat'](_0x527fae);}if(_0xee133f){_0x300763=_0x300763[_0x280f('0xc')](_0x527fae);}}return client['Request'](_0x280f('0xd'),{'intervalIds':_0x473389,'intervals':_0x300763,'timezone':_0x53cb4c,'log':_0x280f('0xd')});}}exports[_0x280f('0xe')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index d129540..10a6cfc 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a93=['../client','voiceQueueReport','queuecallercompleteAt','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','queue','agent','accountcode','toNumber','voiceDialReport','membername','starttime','endtime','dialstring','uniqueid','moment','lodash','util'];(function(_0x219e82,_0x3b958e){var _0x1994f6=function(_0x436ee6){while(--_0x436ee6){_0x219e82['push'](_0x219e82['shift']());}};_0x1994f6(++_0x3b958e);}(_0x2a93,0x1cd));var _0x32a9=function(_0x218ca6,_0x217c29){_0x218ca6=_0x218ca6-0x0;var _0x4ba2a6=_0x2a93[_0x218ca6];return _0x4ba2a6;};'use strict';var moment=require(_0x32a9('0x0'));var _=require(_0x32a9('0x1'));var util=require(_0x32a9('0x2'));var client=require(_0x32a9('0x3'));exports[_0x32a9('0x4')]=function(_0x52a48c){var _0x35ca37=_0x52a48c[_0x32a9('0x5')]||_0x52a48c['queuecallerexitAt'];return client['Request'](_0x32a9('0x6'),{'body':{'channel':_0x32a9('0x7'),'membername':_0x52a48c[_0x32a9('0x8')],'interface':_[_0x32a9('0x9')](_0x52a48c[_0x32a9('0xa')])?util[_0x32a9('0xb')](_0x32a9('0xc'),_0x52a48c[_0x32a9('0x8')]):_0x52a48c['interface'],'type':_0x32a9('0xd'),'enterAt':_0x52a48c[_0x32a9('0xe')],'exitAt':_0x35ca37,'duration':moment(_0x35ca37)[_0x32a9('0xf')](_0x52a48c['queuecallerleaveAt'],_0x32a9('0x10')),'data1':_0x32a9('0x11'),'data2':_0x52a48c[_0x32a9('0x12')],'data3':_0x52a48c['exten'],'data4':null,'data5':_0x52a48c[_0x32a9('0x13')],'role':_0x32a9('0x14'),'internal':_0x52a48c[_0x32a9('0x15')]?_[_0x32a9('0x16')](_0x52a48c[_0x32a9('0x15')]):undefined,'uniqueid':_0x52a48c['uniqueid']},'log':_0x32a9('0x6')});};exports[_0x32a9('0x17')]=function(_0x13bcb1){return client['Request'](_0x32a9('0x6'),{'body':{'channel':_0x32a9('0x7'),'membername':_0x13bcb1[_0x32a9('0x18')],'interface':_0x13bcb1[_0x32a9('0xa')],'type':_0x32a9('0xd'),'enterAt':_0x13bcb1[_0x32a9('0x19')],'exitAt':_0x13bcb1['endtime'],'duration':moment(_0x13bcb1[_0x32a9('0x1a')])[_0x32a9('0xf')](_0x13bcb1[_0x32a9('0x19')],'seconds')>=0x0?moment(_0x13bcb1['endtime'])[_0x32a9('0xf')](_0x13bcb1['starttime'],_0x32a9('0x10')):null,'data1':'outbound','data2':_0x13bcb1[_0x32a9('0x15')],'data3':_0x13bcb1['exten'],'data4':_0x13bcb1[_0x32a9('0x1b')]||null,'role':_0x32a9('0x14'),'internal':_0x13bcb1[_0x32a9('0x15')]?_[_0x32a9('0x16')](_0x13bcb1[_0x32a9('0x15')]):undefined,'uniqueid':_0x13bcb1[_0x32a9('0x1c')]},'log':_0x32a9('0x6')});}; \ No newline at end of file +var _0xe9c2=['toNumber','moment','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','interface','format','SIP/%s','queuecallerleaveAt','diff','queue','agent','accountcode','uniqueid','membername','TALKING','starttime','endtime','exten','dialstring'];(function(_0x1e6c8f,_0x30a019){var _0x1c9a45=function(_0x534e95){while(--_0x534e95){_0x1e6c8f['push'](_0x1e6c8f['shift']());}};_0x1c9a45(++_0x30a019);}(_0xe9c2,0x79));var _0x2e9c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe9c2[_0x42cae2];return _0x5f256f;};'use strict';var moment=require(_0x2e9c('0x0'));var _=require('lodash');var util=require('util');var client=require('../client');exports[_0x2e9c('0x1')]=function(_0xe6ca59){var _0x300cb6=_0xe6ca59[_0x2e9c('0x2')]||_0xe6ca59[_0x2e9c('0x3')];return client[_0x2e9c('0x4')](_0x2e9c('0x5'),{'body':{'channel':_0x2e9c('0x6'),'membername':_0xe6ca59[_0x2e9c('0x7')],'interface':_['isNil'](_0xe6ca59[_0x2e9c('0x8')])?util[_0x2e9c('0x9')](_0x2e9c('0xa'),_0xe6ca59['lastAssignedTo']):_0xe6ca59[_0x2e9c('0x8')],'type':'TALKING','enterAt':_0xe6ca59[_0x2e9c('0xb')],'exitAt':_0x300cb6,'duration':moment(_0x300cb6)[_0x2e9c('0xc')](_0xe6ca59[_0x2e9c('0xb')],'seconds'),'data1':'inbound','data2':_0xe6ca59['calleridnum'],'data3':_0xe6ca59['exten'],'data4':null,'data5':_0xe6ca59[_0x2e9c('0xd')],'role':_0x2e9c('0xe'),'internal':_0xe6ca59['accountcode']?_['toNumber'](_0xe6ca59[_0x2e9c('0xf')]):undefined,'uniqueid':_0xe6ca59[_0x2e9c('0x10')]},'log':'CreateMemberReport'});};exports['voiceDialReport']=function(_0x2fbc0a){return client[_0x2e9c('0x4')](_0x2e9c('0x5'),{'body':{'channel':_0x2e9c('0x6'),'membername':_0x2fbc0a[_0x2e9c('0x11')],'interface':_0x2fbc0a[_0x2e9c('0x8')],'type':_0x2e9c('0x12'),'enterAt':_0x2fbc0a[_0x2e9c('0x13')],'exitAt':_0x2fbc0a['endtime'],'duration':moment(_0x2fbc0a[_0x2e9c('0x14')])[_0x2e9c('0xc')](_0x2fbc0a[_0x2e9c('0x13')],'seconds')>=0x0?moment(_0x2fbc0a[_0x2e9c('0x14')])['diff'](_0x2fbc0a[_0x2e9c('0x13')],'seconds'):null,'data1':'outbound','data2':_0x2fbc0a[_0x2e9c('0xf')],'data3':_0x2fbc0a[_0x2e9c('0x15')],'data4':_0x2fbc0a[_0x2e9c('0x16')]||null,'role':_0x2e9c('0xe'),'internal':_0x2fbc0a[_0x2e9c('0xf')]?_[_0x2e9c('0x17')](_0x2fbc0a[_0x2e9c('0xf')]):undefined,'uniqueid':_0x2fbc0a[_0x2e9c('0x10')]},'log':_0x2e9c('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index bb73829..3df132d 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 _0xc302=['previewRecallmeReminderInterval','GetSettings','../client','ShowSetting'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0xc302,0x17e));var _0x2c30=function(_0x44719f,_0x36bfa7){_0x44719f=_0x44719f-0x0;var _0x4d68ed=_0xc302[_0x44719f];return _0x4d68ed;};'use strict';var client=require(_0x2c30('0x0'));exports['getSettings']=function(){return client['Request'](_0x2c30('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x2c30('0x2')]},'log':_0x2c30('0x3')});}; \ No newline at end of file +var _0x5eef=['Request','stopRecordingOnTransfer','GetSettings'];(function(_0x335bf3,_0x218da7){var _0x3097c7=function(_0x9ec832){while(--_0x9ec832){_0x335bf3['push'](_0x335bf3['shift']());}};_0x3097c7(++_0x218da7);}(_0x5eef,0x9c));var _0xf5ee=function(_0x43402d,_0x2037c8){_0x43402d=_0x43402d-0x0;var _0x402c94=_0x5eef[_0x43402d];return _0x402c94;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0xf5ee('0x0')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xf5ee('0x1'),'previewRecallmeReminderInterval']},'log':_0xf5ee('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index a17f3ba..94c2f04 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 _0x2480=['GetTemplate','getTemplates','Request'];(function(_0x10cc4a,_0x1a72ac){var _0x86bcbd=function(_0x161bba){while(--_0x161bba){_0x10cc4a['push'](_0x10cc4a['shift']());}};_0x86bcbd(++_0x1a72ac);}(_0x2480,0x1c9));var _0x0248=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2480[_0x2dafbe];return _0x58a45a;};'use strict';var client=require('../client');exports[_0x0248('0x0')]=function(_0x3193a5){return function(_0x215410){return client[_0x0248('0x1')](_0x0248('0x2'),{'options':{'raw':!![],'attributes':['id','name','html']},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xcefd=['getTemplates','Request','GetTemplate','name','html'];(function(_0x2451ae,_0x2ff3a4){var _0x5d6db9=function(_0x1b0200){while(--_0x1b0200){_0x2451ae['push'](_0x2451ae['shift']());}};_0x5d6db9(++_0x2ff3a4);}(_0xcefd,0x1bd));var _0xdcef=function(_0x55daf2,_0x1b48de){_0x55daf2=_0x55daf2-0x0;var _0x1c8500=_0xcefd[_0x55daf2];return _0x1c8500;};'use strict';var client=require('../client');exports[_0xdcef('0x0')]=function(_0x1508f9){return function(_0x341ca6){return client[_0xdcef('0x1')](_0xdcef('0x2'),{'options':{'raw':!![],'attributes':['id',_0xdcef('0x3'),_0xdcef('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index fa64f58..1102748 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 _0xf00d=['../client','getTriggers','GetTrigger','name','status','Condition','AllConditions','field','operator','AnyConditions','value','Action','Actions','action','data1','data5','data6','data7'];(function(_0x41426b,_0x2aa011){var _0x4e0123=function(_0xa5e29a){while(--_0xa5e29a){_0x41426b['push'](_0x41426b['shift']());}};_0x4e0123(++_0x2aa011);}(_0xf00d,0xd8));var _0xdf00=function(_0x2969f0,_0x11b411){_0x2969f0=_0x2969f0-0x0;var _0x2ca8c0=_0xf00d[_0x2969f0];return _0x2ca8c0;};'use strict';var client=require(_0xdf00('0x0'));exports[_0xdf00('0x1')]=function(_0x54f4b8){return function(_0x88a480){return client['Request'](_0xdf00('0x2'),{'options':{'raw':![],'attributes':['id',_0xdf00('0x3'),'channel',_0xdf00('0x4')],'include':[{'model':_0xdf00('0x5'),'as':_0xdf00('0x6'),'attributes':['id',_0xdf00('0x7'),_0xdf00('0x8'),'value']},{'model':_0xdf00('0x5'),'as':_0xdf00('0x9'),'attributes':['id',_0xdf00('0x7'),_0xdf00('0x8'),_0xdf00('0xa')]},{'model':_0xdf00('0xb'),'as':_0xdf00('0xc'),'attributes':['id',_0xdf00('0xd'),_0xdf00('0xe'),'data2','data3','data4',_0xdf00('0xf'),_0xdf00('0x10'),_0xdf00('0x11')]}]},'log':_0xdf00('0x2')});};}; \ No newline at end of file +var _0x843b=['channel','Condition','field','operator','value','Action','Actions','action','data3','data5','data6','data7','GetTrigger','../client','getTriggers','name'];(function(_0x40b723,_0x118b22){var _0x1981ad=function(_0x1dbe18){while(--_0x1dbe18){_0x40b723['push'](_0x40b723['shift']());}};_0x1981ad(++_0x118b22);}(_0x843b,0x9d));var _0xb843=function(_0x1db7bd,_0x1637fa){_0x1db7bd=_0x1db7bd-0x0;var _0x3b0a45=_0x843b[_0x1db7bd];return _0x3b0a45;};'use strict';var client=require(_0xb843('0x0'));exports[_0xb843('0x1')]=function(_0x53a4c9){return function(_0x566d0f){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xb843('0x2'),_0xb843('0x3'),'status'],'include':[{'model':_0xb843('0x4'),'as':'AllConditions','attributes':['id',_0xb843('0x5'),_0xb843('0x6'),_0xb843('0x7')]},{'model':_0xb843('0x4'),'as':'AnyConditions','attributes':['id',_0xb843('0x5'),_0xb843('0x6'),'value']},{'model':_0xb843('0x8'),'as':_0xb843('0x9'),'attributes':['id',_0xb843('0xa'),'data1','data2',_0xb843('0xb'),'data4',_0xb843('0xc'),_0xb843('0xd'),_0xb843('0xe')]}]},'log':_0xb843('0xf')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 7bbfe11..ed4b585 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 _0x5c4d=['name','registry','defaultuser','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5c4d,0x18f));var _0xd5c4=function(_0x56b4d2,_0x1e623c){_0x56b4d2=_0x56b4d2-0x0;var _0x4ff83a=_0x5c4d[_0x56b4d2];return _0x4ff83a;};'use strict';var client=require(_0xd5c4('0x0'));exports['getTrunks']=function(_0x15a6c2){return function(_0x5d7e55){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xd5c4('0x1'),_0xd5c4('0x2'),_0xd5c4('0x3')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xa25a=['registry','defaultuser','../client','getTrunks','Request','GetTrunk','name'];(function(_0x1280fc,_0x534530){var _0x244efc=function(_0x4a1e04){while(--_0x4a1e04){_0x1280fc['push'](_0x1280fc['shift']());}};_0x244efc(++_0x534530);}(_0xa25a,0x160));var _0xaa25=function(_0x37bcdd,_0x4fea5c){_0x37bcdd=_0x37bcdd-0x0;var _0x4d32de=_0xa25a[_0x37bcdd];return _0x4d32de;};'use strict';var client=require(_0xaa25('0x0'));exports[_0xaa25('0x1')]=function(_0x212df1){return function(_0x22c967){return client[_0xaa25('0x2')](_0xaa25('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xaa25('0x4'),_0xaa25('0x5'),_0xaa25('0x6')]},'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 23d59f6..b2f7ac6 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 _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x4e9de2,_0x155989){var _0x326cb0=function(_0x5301b0){while(--_0x5301b0){_0x4e9de2['push'](_0x4e9de2['shift']());}};_0x326cb0(++_0x155989);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2caaef,_0x3c19ed){_0x2caaef=_0x2caaef-0x0;var _0xd011f8=_0xcb91[_0x2caaef];return _0xd011f8;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xe706,0xa3));var _0x6e70=function(_0x50abc4,_0x558d64){_0x50abc4=_0x50abc4-0x0;var _0x5a745d=_0xe706[_0x50abc4];return _0x5a745d;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 9607b2d..93e2b32 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 _0xd847=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x1adb5d,_0x1e36cc){var _0x3acc58=function(_0x30a5ac){while(--_0x30a5ac){_0x1adb5d['push'](_0x1adb5d['shift']());}};_0x3acc58(++_0x1e36cc);}(_0xd847,0x150));var _0x7d84=function(_0x766909,_0x510154){_0x766909=_0x766909-0x0;var _0x16bc3f=_0xd847[_0x766909];return _0x16bc3f;};'use strict';var client=require(_0x7d84('0x0'));exports[_0x7d84('0x1')]=function(_0x170c6a){return client[_0x7d84('0x2')](_0x7d84('0x3'),{'body':_0x170c6a,'log':_0x7d84('0x3')});};exports[_0x7d84('0x4')]=function(_0x52d4f7,_0x29348b,_0xcf153e){return client[_0x7d84('0x2')](_0x7d84('0x5'),{'body':_0x52d4f7,'options':{'where':{'uniqueid':_0x29348b,'interface':_0xcf153e,'agentcomplete':!![]}},'log':_0x7d84('0x5')});}; \ No newline at end of file +var _0xd034=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x5ce7d6,_0x6d9f74){var _0x49ee1d=function(_0x33e003){while(--_0x33e003){_0x5ce7d6['push'](_0x5ce7d6['shift']());}};_0x49ee1d(++_0x6d9f74);}(_0xd034,0x9c));var _0x4d03=function(_0x2a8255,_0x2ab6cb){_0x2a8255=_0x2a8255-0x0;var _0x20d7a5=_0xd034[_0x2a8255];return _0x20d7a5;};'use strict';var client=require(_0x4d03('0x0'));exports[_0x4d03('0x1')]=function(_0x3d951a){return client[_0x4d03('0x2')]('CreateVoiceAgentReport',{'body':_0x3d951a,'log':_0x4d03('0x3')});};exports[_0x4d03('0x4')]=function(_0x3534ec,_0x11c04d,_0x2887f5){return client[_0x4d03('0x2')](_0x4d03('0x5'),{'body':_0x3534ec,'options':{'where':{'uniqueid':_0x11c04d,'interface':_0x2887f5,'agentcomplete':!![]}},'log':_0x4d03('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index a2a7869..2bd6c08 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 _0xc4a1=['type','disposition','billableseconds','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','startOf','format','endOf','day','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1666d4,_0x4ada83){var _0x5ec4bb=function(_0x1c43a4){while(--_0x1c43a4){_0x1666d4['push'](_0x1666d4['shift']());}};_0x5ec4bb(++_0x4ada83);}(_0xc4a1,0x1a5));var _0x1c4a=function(_0x10973c,_0x5a0c6b){_0x10973c=_0x10973c-0x0;var _0x54bbf4=_0xc4a1[_0x10973c];return _0x54bbf4;};'use strict';var moment=require(_0x1c4a('0x0'));var util=require(_0x1c4a('0x1'));var _=require(_0x1c4a('0x2'));var client=require(_0x1c4a('0x3'));exports[_0x1c4a('0x4')]=function(_0x43bcd9){return client[_0x1c4a('0x5')](_0x1c4a('0x6'),{'body':_[_0x1c4a('0x7')](_0x43bcd9,{'source':_0x43bcd9[_0x1c4a('0x8')],'destinationcontext':_0x43bcd9[_0x1c4a('0x9')],'callerid':_0x43bcd9[_0x1c4a('0xa')],'amaflags':_0x1c4a('0xb')}),'log':_0x1c4a('0x6')});};exports[_0x1c4a('0xc')]=function(){return function(){return client[_0x1c4a('0x5')](_0x1c4a('0xd'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x1c4a('0xe')]('day')[_0x1c4a('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x1c4a('0x10')](_0x1c4a('0x11'))[_0x1c4a('0xf')](_0x1c4a('0x12'))]}},'attributes':[_0x1c4a('0x13'),_0x1c4a('0x14'),'duration',_0x1c4a('0x15')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0xf4c8=['GetVoiceCallReports','moment','util','lodash','../client','CreateVoiceCallReport','merge','calleridnum','context','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds'];(function(_0x13513c,_0x11d5a0){var _0x19e6f8=function(_0x1d7c71){while(--_0x1d7c71){_0x13513c['push'](_0x13513c['shift']());}};_0x19e6f8(++_0x11d5a0);}(_0xf4c8,0x166));var _0x8f4c=function(_0x4d3cd6,_0x4c8e7a){_0x4d3cd6=_0x4d3cd6-0x0;var _0x1a258e=_0xf4c8[_0x4d3cd6];return _0x1a258e;};'use strict';var moment=require(_0x8f4c('0x0'));var util=require(_0x8f4c('0x1'));var _=require(_0x8f4c('0x2'));var client=require(_0x8f4c('0x3'));exports['create']=function(_0xdc26c3){return client['Request'](_0x8f4c('0x4'),{'body':_[_0x8f4c('0x5')](_0xdc26c3,{'source':_0xdc26c3[_0x8f4c('0x6')],'destinationcontext':_0xdc26c3[_0x8f4c('0x7')],'callerid':_0xdc26c3['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0x8f4c('0x4')});};exports[_0x8f4c('0x8')]=function(){return function(){return client[_0x8f4c('0x9')](_0x8f4c('0xa'),{'options':{'where':{'type':[_0x8f4c('0xb')],'createdAt':{'$between':[moment()[_0x8f4c('0xc')](_0x8f4c('0xd'))[_0x8f4c('0xe')](_0x8f4c('0xf')),moment()['endOf'](_0x8f4c('0xd'))[_0x8f4c('0xe')](_0x8f4c('0xf'))]}},'attributes':[_0x8f4c('0x10'),_0x8f4c('0x11'),_0x8f4c('0x12'),_0x8f4c('0x13')]},'log':_0x8f4c('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 1d5a8f2..3f674b7 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 _0x3fc7=['../client','create','Request','CreateVoiceDialReport'];(function(_0x1b9f39,_0x138869){var _0xb04d37=function(_0x5531b5){while(--_0x5531b5){_0x1b9f39['push'](_0x1b9f39['shift']());}};_0xb04d37(++_0x138869);}(_0x3fc7,0xb4));var _0x73fc=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0x3fc7[_0x291f8b];return _0x275171;};'use strict';var client=require(_0x73fc('0x0'));exports[_0x73fc('0x1')]=function(_0x1d5d5c){return client[_0x73fc('0x2')](_0x73fc('0x3'),{'body':_0x1d5d5c,'log':_0x73fc('0x3')});}; \ No newline at end of file +var _0x151e=['create','Request','CreateVoiceDialReport'];(function(_0x14333b,_0x382bb1){var _0x37795f=function(_0x108d4d){while(--_0x108d4d){_0x14333b['push'](_0x14333b['shift']());}};_0x37795f(++_0x382bb1);}(_0x151e,0x72));var _0xe151=function(_0x4c06ac,_0x568788){_0x4c06ac=_0x4c06ac-0x0;var _0x2333cb=_0x151e[_0x4c06ac];return _0x2333cb;};'use strict';var client=require('../client');exports[_0xe151('0x0')]=function(_0x20327c){return client[_0xe151('0x1')](_0xe151('0x2'),{'body':_0x20327c,'log':_0xe151('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index ea50e69..b8d55a7 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 _0x1b32=['GetVoiceExtension','exten','recordingFormat','getVoiceExtensions','Request'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x1b32,0x85));var _0x21b3=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x1b32[_0x2c7618];return _0x5ce3f0;};'use strict';var client=require('../client');exports[_0x21b3('0x0')]=function(){return function(){return client[_0x21b3('0x1')](_0x21b3('0x2'),{'options':{'raw':!![],'attributes':['id',_0x21b3('0x3'),_0x21b3('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x21b3('0x0')});};}; \ No newline at end of file +var _0x823c=['Request','GetVoiceExtension','exten','recordingFormat','getVoiceExtensions','../client'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x823c,0x143));var _0xc823=function(_0x507290,_0x29a5fc){_0x507290=_0x507290-0x0;var _0x2438e7=_0x823c[_0x507290];return _0x2438e7;};'use strict';var client=require(_0xc823('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xc823('0x1')](_0xc823('0x2'),{'options':{'raw':!![],'attributes':['id',_0xc823('0x3'),_0xc823('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xc823('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 6bf69eb..ec25387 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 _0x7574=['callerid','active','Pause','TrunkBackup','Interval','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk'];(function(_0x4e8be4,_0x5abd7e){var _0x2a877d=function(_0x5a98cd){while(--_0x5a98cd){_0x4e8be4['push'](_0x4e8be4['shift']());}};_0x2a877d(++_0x5abd7e);}(_0x7574,0x1ef));var _0x4757=function(_0xc470b8,_0x6f2c9c){_0xc470b8=_0xc470b8-0x0;var _0x5baef1=_0x7574[_0xc470b8];return _0x5baef1;};'use strict';var client=require(_0x4757('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x4757('0x1')](_0x4757('0x2'),{'options':{'raw':![],'attributes':['id',_0x4757('0x3'),_0x4757('0x4'),'acwTimeout',_0x4757('0x5'),_0x4757('0x6'),_0x4757('0x7'),_0x4757('0x8'),_0x4757('0x9'),'dialLimitChannel',_0x4757('0xa'),_0x4757('0xb'),_0x4757('0xc'),_0x4757('0xd'),_0x4757('0xe'),_0x4757('0xf'),_0x4757('0x10'),_0x4757('0x11'),_0x4757('0x12'),'dialQueueTimeout',_0x4757('0x13'),'dialCongestionMaxRetry',_0x4757('0x14'),_0x4757('0x15'),_0x4757('0x16'),'dialNoAnswerMaxRetry',_0x4757('0x17'),'dialGlobalMaxRetry',_0x4757('0x18'),_0x4757('0x19'),_0x4757('0x1a'),_0x4757('0x1b'),_0x4757('0x1c'),_0x4757('0x1d'),_0x4757('0x1e'),'dialAMDAfterGreetingSilence',_0x4757('0x1f'),'dialAMDMinWordLength',_0x4757('0x20'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x4757('0x21'),'timeout',_0x4757('0x22'),_0x4757('0x23'),_0x4757('0x24'),'dialAgiAfterHangupAgent',_0x4757('0x25'),_0x4757('0x26'),_0x4757('0x6'),'strategy',_0x4757('0x27'),_0x4757('0x28'),_0x4757('0x29'),'dialNoSuchNumberRetryFrequency',_0x4757('0x2a'),_0x4757('0x2b'),_0x4757('0x2c'),'dialAbandonedRetryFrequency',_0x4757('0x2d'),_0x4757('0x2e'),_0x4757('0x2f'),_0x4757('0x30'),_0x4757('0x31'),_0x4757('0x32'),_0x4757('0x33'),_0x4757('0x34'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x4757('0x35'),'as':_0x4757('0x35'),'attributes':['id',_0x4757('0x3'),_0x4757('0x36'),_0x4757('0x37')]},{'model':_0x4757('0x38'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0x4757('0x35'),'as':_0x4757('0x39'),'attributes':['id','name',_0x4757('0x36'),'active']},{'model':'Interval','as':_0x4757('0x3a'),'attributes':['id',_0x4757('0x3')],'include':[{'model':_0x4757('0x3a'),'as':'Intervals','attributes':['id',_0x4757('0x3'),_0x4757('0x3b')]}]}]},'log':_0x4757('0x3c')});};}; \ No newline at end of file +var _0x7971=['Trunk','callerid','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval','interval','../client','getVoiceQueues','name','acw','acwTimeout','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'];(function(_0x1e46f0,_0x12c59d){var _0x9f7325=function(_0x350a26){while(--_0x350a26){_0x1e46f0['push'](_0x1e46f0['shift']());}};_0x9f7325(++_0x12c59d);}(_0x7971,0x197));var _0x1797=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x7971[_0x1e4360];return _0x31e6b4;};'use strict';var client=require(_0x1797('0x0'));exports[_0x1797('0x1')]=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x1797('0x2'),_0x1797('0x3'),_0x1797('0x4'),'autopause','monitor_format','type',_0x1797('0x5'),_0x1797('0x6'),'dialLimitChannel',_0x1797('0x7'),_0x1797('0x8'),'dialPredictiveOptimization','dialPredictiveOptimizationPercentage',_0x1797('0x9'),_0x1797('0xa'),_0x1797('0xb'),_0x1797('0xc'),_0x1797('0xd'),_0x1797('0xe'),_0x1797('0xf'),_0x1797('0x10'),'dialCongestionRetryFrequency',_0x1797('0x11'),_0x1797('0x12'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0x1797('0x13'),'dialTimezone',_0x1797('0x14'),_0x1797('0x15'),'dialCheckDuplicateType',_0x1797('0x16'),'dialAMDInitialSilence',_0x1797('0x17'),_0x1797('0x18'),_0x1797('0x19'),'dialAMDMinWordLength',_0x1797('0x1a'),_0x1797('0x1b'),_0x1797('0x1c'),_0x1797('0x1d'),'timeout',_0x1797('0x1e'),'dialRecallInQueue',_0x1797('0x1f'),_0x1797('0x20'),'dialAgiAfterHangupClient',_0x1797('0x21'),_0x1797('0x22'),_0x1797('0x23'),_0x1797('0x24'),_0x1797('0x25'),_0x1797('0x26'),_0x1797('0x27'),_0x1797('0x28'),_0x1797('0x29'),_0x1797('0x2a'),'dialAbandonedRetryFrequency',_0x1797('0x2b'),_0x1797('0x2c'),'dialAgentRejectMaxRetry',_0x1797('0x2d'),_0x1797('0x2e'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x1797('0x2f'),_0x1797('0x30')],'include':[{'model':_0x1797('0x31'),'as':_0x1797('0x31'),'attributes':['id',_0x1797('0x2'),_0x1797('0x32'),'active']},{'model':_0x1797('0x33'),'as':_0x1797('0x34'),'attributes':['id',_0x1797('0x2')]},{'model':_0x1797('0x31'),'as':_0x1797('0x35'),'attributes':['id',_0x1797('0x2'),_0x1797('0x32'),_0x1797('0x36')]},{'model':'Interval','as':_0x1797('0x37'),'attributes':['id',_0x1797('0x2')],'include':[{'model':_0x1797('0x37'),'as':'Intervals','attributes':['id',_0x1797('0x2'),_0x1797('0x38')]}]}]},'log':_0x1797('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index fed1384..fb1b818 100644 --- a/server/services/ami/rpc/voiceQueueReport.js +++ b/server/services/ami/rpc/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x1ffc4b,_0x5ba9d1){var _0x57fc39=function(_0x4cfb8e){while(--_0x4cfb8e){_0x1ffc4b['push'](_0x1ffc4b['shift']());}};_0x57fc39(++_0x5ba9d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x30ec83,_0x31fe48){var _0x232efc=function(_0x42d1a1){while(--_0x42d1a1){_0x30ec83['push'](_0x30ec83['shift']());}};_0x232efc(++_0x31fe48);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 5a8bca8..1a5c00e 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 _0xeec4=['getVoiceQueueRtPauses','../client','Request','GetVoiceQueueRtPauses'];(function(_0x55c417,_0x1c813a){var _0x23543a=function(_0x48c34d){while(--_0x48c34d){_0x55c417['push'](_0x55c417['shift']());}};_0x23543a(++_0x1c813a);}(_0xeec4,0xa9));var _0x4eec=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0xeec4[_0x38537f];return _0x141e23;};'use strict';var client=require(_0x4eec('0x0'));exports['getVoiceQueueRtPauses']=function(_0x9312b3){return function(){return client[_0x4eec('0x1')](_0x4eec('0x2'),{'options':{'where':{'VoiceQueueId':_0x9312b3,'paused':!![]},'raw':!![]},'log':_0x4eec('0x3')});};}; \ No newline at end of file +var _0x49cc=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x58fccb,_0x391352){var _0x1ab554=function(_0x28c767){while(--_0x28c767){_0x58fccb['push'](_0x58fccb['shift']());}};_0x1ab554(++_0x391352);}(_0x49cc,0x19c));var _0xc49c=function(_0x464d42,_0x4f1d09){_0x464d42=_0x464d42-0x0;var _0x1483d3=_0x49cc[_0x464d42];return _0x1483d3;};'use strict';var client=require(_0xc49c('0x0'));exports[_0xc49c('0x1')]=function(_0x591565){return function(){return client['Request'](_0xc49c('0x2'),{'options':{'where':{'VoiceQueueId':_0x591565,'paused':!![]},'raw':!![]},'log':_0xc49c('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index b36af26..07c0405 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x275e76,_0x36b6da){var _0x29b096=function(_0x29c555){while(--_0x29c555){_0x275e76['push'](_0x275e76['shift']());}};_0x29b096(++_0x36b6da);}(_0x7a54,0x106));var _0x47a5=function(_0x6eec24,_0xd72b78){_0x6eec24=_0x6eec24-0x0;var _0x46afb8=_0x7a54[_0x6eec24];return _0x46afb8;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x239ef2,_0x58ccf1){var _0x4bcd37=function(_0xf5b262){while(--_0xf5b262){_0x239ef2['push'](_0x239ef2['shift']());}};_0x4bcd37(++_0x58ccf1);}(_0x7a54,0x106));var _0x47a5=function(_0x22bded,_0x57ba9b){_0x22bded=_0x22bded-0x0;var _0xd57bb9=_0x7a54[_0x22bded];return _0xd57bb9;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 6702357..caf0cc5 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 _0x7e14=['origtransfereraccountcode','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','attendedTransfer','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum'];(function(_0x5941a7,_0x18903d){var _0x1318f7=function(_0x493c0a){while(--_0x493c0a){_0x5941a7['push'](_0x5941a7['shift']());}};_0x1318f7(++_0x18903d);}(_0x7e14,0x144));var _0x47e1=function(_0x43c6b6,_0x4ae241){_0x43c6b6=_0x43c6b6-0x0;var _0x59248d=_0x7e14[_0x43c6b6];return _0x59248d;};'use strict';var client=require('../client');exports[_0x47e1('0x0')]={};exports[_0x47e1('0x1')]=function(_0x26be1c){return client['Request'](_0x47e1('0x2'),{'body':{'result':_0x26be1c[_0x47e1('0x3')],'transfererchannel':_0x26be1c[_0x47e1('0x4')],'transferercalleridnum':_0x26be1c['transferercalleridnum'],'transferercalleridname':_0x26be1c[_0x47e1('0x5')],'transfererconnectedlinenum':_0x26be1c[_0x47e1('0x6')],'transfererconnectedlinename':_0x26be1c[_0x47e1('0x7')],'transfereraccountcode':_0x26be1c[_0x47e1('0x8')],'transferercontext':_0x26be1c[_0x47e1('0x9')],'transfererexten':_0x26be1c['transfererexten'],'transfererlinkedid':_0x26be1c[_0x47e1('0xa')],'transfereechannel':_0x26be1c[_0x47e1('0xb')],'transfereecalleridnum':_0x26be1c[_0x47e1('0xc')],'transfereecalleridname':_0x26be1c['transfereecalleridname'],'transfereeconnectedlinenum':_0x26be1c[_0x47e1('0xd')],'transfereeconnectedlinename':_0x26be1c[_0x47e1('0xe')],'transfereeaccountcode':_0x26be1c[_0x47e1('0xf')],'transfereecontext':_0x26be1c['transfereecontext'],'transfereeexten':_0x26be1c[_0x47e1('0x10')],'transfereelinkedid':_0x26be1c[_0x47e1('0x11')],'isexternal':_0x26be1c[_0x47e1('0x12')],'context':_0x26be1c[_0x47e1('0x13')],'extension':_0x26be1c[_0x47e1('0x14')],'type':'blind'},'log':_0x47e1('0x2')});};exports[_0x47e1('0x15')]=function(_0x3ab78f){return client[_0x47e1('0x16')](_0x47e1('0x2'),{'body':{'result':_0x3ab78f[_0x47e1('0x3')],'transfererchannel':_0x3ab78f[_0x47e1('0x17')],'transferercalleridnum':_0x3ab78f[_0x47e1('0x18')],'transferercalleridname':_0x3ab78f[_0x47e1('0x19')],'transfererconnectedlinenum':_0x3ab78f[_0x47e1('0x1a')],'transfererconnectedlinename':_0x3ab78f['secondtransfererconnectedlinename'],'transfereraccountcode':_0x3ab78f[_0x47e1('0x1b')],'transferercontext':_0x3ab78f['secondtransferercontext'],'transfererexten':_0x3ab78f['secondtransfererexten'],'transfererlinkedid':_0x3ab78f[_0x47e1('0x1c')],'transfereechannel':_0x3ab78f[_0x47e1('0x1d')],'transfereecalleridnum':_0x3ab78f[_0x47e1('0x1e')],'transfereecalleridname':_0x3ab78f[_0x47e1('0x1f')],'transfereeconnectedlinenum':_0x3ab78f['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3ab78f[_0x47e1('0x20')],'transfereeaccountcode':_0x3ab78f[_0x47e1('0x21')],'transfereecontext':_0x3ab78f['transfertargetcontext'],'transfereeexten':_0x3ab78f[_0x47e1('0x22')],'transfereelinkedid':_0x3ab78f[_0x47e1('0x23')],'isexternal':_0x3ab78f['isexternal'],'context':_0x3ab78f[_0x47e1('0x24')],'extension':_0x3ab78f[_0x47e1('0x25')],'type':_0x47e1('0x26')},'log':_0x47e1('0x2')});}; \ No newline at end of file +var _0xfa79=['transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransfererchannel','origtransferercalleridname','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel'];(function(_0x19a79c,_0x18a3c5){var _0xbd43df=function(_0x31b5ae){while(--_0x31b5ae){_0x19a79c['push'](_0x19a79c['shift']());}};_0xbd43df(++_0x18a3c5);}(_0xfa79,0x121));var _0x9fa7=function(_0x5d05b4,_0x42b6ba){_0x5d05b4=_0x5d05b4-0x0;var _0x13108c=_0xfa79[_0x5d05b4];return _0x13108c;};'use strict';var client=require(_0x9fa7('0x0'));exports[_0x9fa7('0x1')]={};exports[_0x9fa7('0x2')]=function(_0x7c6efa){return client[_0x9fa7('0x3')](_0x9fa7('0x4'),{'body':{'result':_0x7c6efa[_0x9fa7('0x5')],'transfererchannel':_0x7c6efa[_0x9fa7('0x6')],'transferercalleridnum':_0x7c6efa['transferercalleridnum'],'transferercalleridname':_0x7c6efa[_0x9fa7('0x7')],'transfererconnectedlinenum':_0x7c6efa['transfererconnectedlinenum'],'transfererconnectedlinename':_0x7c6efa[_0x9fa7('0x8')],'transfereraccountcode':_0x7c6efa[_0x9fa7('0x9')],'transferercontext':_0x7c6efa[_0x9fa7('0xa')],'transfererexten':_0x7c6efa[_0x9fa7('0xb')],'transfererlinkedid':_0x7c6efa[_0x9fa7('0xc')],'transfereechannel':_0x7c6efa['transfereechannel'],'transfereecalleridnum':_0x7c6efa[_0x9fa7('0xd')],'transfereecalleridname':_0x7c6efa['transfereecalleridname'],'transfereeconnectedlinenum':_0x7c6efa['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x7c6efa[_0x9fa7('0xe')],'transfereeaccountcode':_0x7c6efa[_0x9fa7('0xf')],'transfereecontext':_0x7c6efa[_0x9fa7('0x10')],'transfereeexten':_0x7c6efa[_0x9fa7('0x11')],'transfereelinkedid':_0x7c6efa[_0x9fa7('0x12')],'isexternal':_0x7c6efa[_0x9fa7('0x13')],'context':_0x7c6efa[_0x9fa7('0x14')],'extension':_0x7c6efa['extension'],'type':_0x9fa7('0x15')},'log':'CreateVoiceTransferReport'});};exports[_0x9fa7('0x16')]=function(_0x11b91f){return client[_0x9fa7('0x3')](_0x9fa7('0x4'),{'body':{'result':_0x11b91f[_0x9fa7('0x5')],'transfererchannel':_0x11b91f[_0x9fa7('0x17')],'transferercalleridnum':_0x11b91f['origtransferercalleridnum'],'transferercalleridname':_0x11b91f[_0x9fa7('0x18')],'transfererconnectedlinenum':_0x11b91f['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x11b91f['secondtransfererconnectedlinename'],'transfereraccountcode':_0x11b91f[_0x9fa7('0x19')],'transferercontext':_0x11b91f[_0x9fa7('0x1a')],'transfererexten':_0x11b91f[_0x9fa7('0x1b')],'transfererlinkedid':_0x11b91f['origtransfererlinkedid'],'transfereechannel':_0x11b91f[_0x9fa7('0x1c')],'transfereecalleridnum':_0x11b91f[_0x9fa7('0x1d')],'transfereecalleridname':_0x11b91f[_0x9fa7('0x1e')],'transfereeconnectedlinenum':_0x11b91f['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x11b91f[_0x9fa7('0x1f')],'transfereeaccountcode':_0x11b91f[_0x9fa7('0x20')],'transfereecontext':_0x11b91f[_0x9fa7('0x21')],'transfereeexten':_0x11b91f[_0x9fa7('0x22')],'transfereelinkedid':_0x11b91f[_0x9fa7('0x23')],'isexternal':_0x11b91f[_0x9fa7('0x13')],'context':_0x11b91f['origtransferercontext'],'extension':_0x11b91f['origtransfererexten'],'type':_0x9fa7('0x24')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 9de24e1..dfe4220 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 _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x23df67,_0x2ec1f6){var _0xd15efa=function(_0x13baf9){while(--_0x13baf9){_0x23df67['push'](_0x23df67['shift']());}};_0xd15efa(++_0x2ec1f6);}(_0x7a54,0x106));var _0x47a5=function(_0x2e535f,_0x29d6a9){_0x2e535f=_0x2e535f-0x0;var _0x17bf6f=_0x7a54[_0x2e535f];return _0x17bf6f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x2bebef,_0x5f49e5){var _0x5b05e0=function(_0x343faa){while(--_0x343faa){_0x2bebef['push'](_0x2bebef['shift']());}};_0x5b05e0(++_0x5f49e5);}(_0x7a54,0x106));var _0x47a5=function(_0x1b7459,_0x5a8536){_0x1b7459=_0x1b7459-0x0;var _0x3873d3=_0x7a54[_0x1b7459];return _0x3873d3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+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 1bb62bd..f457c20 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 _0xd7cc=['data3','split','phone','$or','map','destcalleridnum','calleridnum','firstName','mobile','scheduledAt','updatedAt','union','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','info','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Autocreate\x20disabled','format','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xd7cc,0x131));var _0xcd7c=function(_0x5d8bc7,_0x2f99b4){_0x5d8bc7=_0x5d8bc7-0x0;var _0x232f93=_0xd7cc[_0x5d8bc7];return _0x232f93;};'use strict';var _=require(_0xcd7c('0x0'));var BPromise=require(_0xcd7c('0x1'));var Redis=require(_0xcd7c('0x2'));var util=require(_0xcd7c('0x3'));var config=require(_0xcd7c('0x4'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require('../../rpc/cmContact');config[_0xcd7c('0x5')]=_[_0xcd7c('0x6')](config['redis'],{'host':_0xcd7c('0x7'),'port':0x18eb});var io=require(_0xcd7c('0x8'))(new Redis(config[_0xcd7c('0x5')]));function emit(_0x2bf979,_0x272d20,_0x594766,_0x2af50d,_0x23c4d7){logger['info'](_0xcd7c('0x9'),_0x2bf979,_0x272d20['id'],_0x594766,_0x2af50d,JSON[_0xcd7c('0xa')](_0x23c4d7));io['to'](_0x594766)[_0xcd7c('0xb')](_0x2af50d,_0x23c4d7);}exports[_0xcd7c('0xc')]=function(_0x5e6b18,_0x50cafc,_0x125a39,_0x3384fd){var _0x2671b6,_0x3b6572;var _0x46ebec={};var _0x596dae;var _0x30c97c=Number(_0x125a39[_0xcd7c('0xd')]);var _0x383528=_0x125a39[_0xcd7c('0xe')]?Boolean(Number(_0x125a39[_0xcd7c('0xe')])):![];var _0x3b3b9d;var _0x21715f=![];if(!_[_0xcd7c('0xf')](_0x125a39[_0xcd7c('0x10')])){if(_0x125a39[_0xcd7c('0x10')]=='1')_0x21715f=!![];}if(!_0x21715f){if(_0x3384fd[_0xcd7c('0x11')]){_0x46ebec['id']=_0x3384fd[_0xcd7c('0x11')];}}if(!_0x46ebec['id']){_0x46ebec[_0xcd7c('0x12')]=_0x30c97c;_0x3b3b9d=_0x125a39[_0xcd7c('0x13')]&&_0x125a39[_0xcd7c('0x13')]!=='0'?_0x125a39[_0xcd7c('0x13')][_0xcd7c('0x14')](','):[_0xcd7c('0x15')];_0x46ebec[_0xcd7c('0x16')]=_[_0xcd7c('0x17')](_0x3b3b9d,function(_0xd1f8f7){var _0x4145c9={};_0x4145c9[_0xd1f8f7]=_0x3384fd['routeId']?_0x3384fd[_0xcd7c('0x18')]:_0x3384fd[_0xcd7c('0x19')];return _0x4145c9;});_0x596dae=_0x3384fd['routeId']?_0x3384fd[_0xcd7c('0x18')]:_0x3384fd[_0xcd7c('0x19')];}var _0x18723c=['id',_0xcd7c('0x1a'),'lastName','phone',_0xcd7c('0x1b'),'fax','ListId','createdAt',_0xcd7c('0x1c'),_0xcd7c('0x1d')];var _0x5cdc12=_[_0xcd7c('0x1e')](_0x18723c,_0x3b3b9d);BPromise['resolve']()[_0xcd7c('0x1f')](cmContactRpc[_0xcd7c('0x20')]({'attributes':_0x5cdc12,'where':_0x46ebec,'phone':_0x596dae}))[_0xcd7c('0x1f')](function(_0x9212a3){_0x3b6572=_0x9212a3;if(!_[_0xcd7c('0x21')](_0x3b6572)){if(_0x3b6572[_0xcd7c('0x22')]===0x1){_0x2671b6=_0x3b6572[0x0];logger['info'](_0xcd7c('0x23'),_0x3384fd[_0xcd7c('0x24')],_0x50cafc['id'],_0x2671b6['id']);}else{logger['info'](_0xcd7c('0x25'),_0x3384fd[_0xcd7c('0x24')],_0x50cafc['id'],_[_0xcd7c('0x17')](_0x3b6572,'id')[_0xcd7c('0x26')](','));}return;}else{logger[_0xcd7c('0x27')](_0xcd7c('0x28'),_0x3384fd[_0xcd7c('0x24')],_0x50cafc['id']);var _0x1e4fdb={'ListId':_0x30c97c};var _0x5ad833=_0x125a39[_0xcd7c('0x29')]&&_0x125a39[_0xcd7c('0x29')]!=='0'?_0x125a39[_0xcd7c('0x29')]:_0xcd7c('0x15');if(_0x383528){logger[_0xcd7c('0x27')](_0xcd7c('0x2a'),_0x3384fd[_0xcd7c('0x24')],_0x50cafc['id']);_0x1e4fdb[_0x5ad833]=_[_0xcd7c('0xf')](_0x3384fd[_0xcd7c('0x2b')])?_0x3384fd[_0xcd7c('0x19')]:_0x3384fd['destcalleridnum'];if(_[_0xcd7c('0xf')](_0x3384fd['routeId'])){_0x1e4fdb[_0xcd7c('0x1a')]=_0x3384fd[_0xcd7c('0x2c')]&&_0x3384fd[_0xcd7c('0x2c')]!==_0xcd7c('0x2d')?_0x3384fd['calleridname']:_0xcd7c('0x2e');}else{_0x1e4fdb[_0xcd7c('0x1a')]=_0x3384fd['destcalleridname']&&_0x3384fd[_0xcd7c('0x2f')]!==_0xcd7c('0x2d')?_0x3384fd[_0xcd7c('0x2f')]:_0xcd7c('0x2e');}return BPromise['resolve']()[_0xcd7c('0x1f')](cmContactRpc[_0xcd7c('0x30')](_0x1e4fdb))[_0xcd7c('0x1f')](function(_0x2e4972){_0x2671b6=_0x2e4972;_0x3b6572['push'](_0x2e4972);if(_0x2671b6){logger['info']('[CM][%s][%s]\x20Contact\x20created:%s',_0x3384fd[_0xcd7c('0x24')],_0x50cafc['id'],_0x2671b6['id']);}return;});}else{logger['info'](_0xcd7c('0x31'),_0x3384fd[_0xcd7c('0x24')],_0x50cafc['id']);_0x1e4fdb[_0x5ad833]=_[_0xcd7c('0xf')](_0x3384fd[_0xcd7c('0x2b')])?_0x3384fd[_0xcd7c('0x19')]:_0x3384fd['destcalleridnum'];if(_['isNil'](_0x3384fd['routeId'])){_0x1e4fdb[_0xcd7c('0x1a')]=_0x3384fd['calleridname']&&_0x3384fd[_0xcd7c('0x2c')]!==_0xcd7c('0x2d')?_0x3384fd[_0xcd7c('0x2c')]:'Unknown';}else{_0x1e4fdb[_0xcd7c('0x1a')]=_0x3384fd[_0xcd7c('0x2f')]&&_0x3384fd[_0xcd7c('0x2f')]!==_0xcd7c('0x2d')?_0x3384fd[_0xcd7c('0x2f')]:_0xcd7c('0x2e');}_0x2671b6=_0x1e4fdb;_0x3b6572['push'](_0x1e4fdb);return;}}})[_0xcd7c('0x1f')](function(){if(_0x5e6b18){emit(_0x3384fd[_0xcd7c('0x24')],_0x50cafc,util[_0xcd7c('0x32')]('user:%s',_0x5e6b18['name']),util['format']('trigger:%s',_0x125a39[_0xcd7c('0x33')][_0xcd7c('0x34')]()),{'evt':_[_0xcd7c('0x35')](_0x3384fd,{'autoCreate':_0x383528}),'contact':_0x2671b6===undefined?{}:_0x2671b6,'contacts':_0x3b6572['length']===0x0?undefined:_0x3b6572});}});}; \ No newline at end of file +var _0x9e59=['data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','destcalleridname','Unknown','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','action','toLowerCase','merge','length','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found'];(function(_0x5ddf53,_0x32dd66){var _0x233178=function(_0xed1061){while(--_0xed1061){_0x5ddf53['push'](_0x5ddf53['shift']());}};_0x233178(++_0x32dd66);}(_0x9e59,0x1da));var _0x99e5=function(_0x2dd6ac,_0xb7639f){_0x2dd6ac=_0x2dd6ac-0x0;var _0x39cd9f=_0x9e59[_0x2dd6ac];return _0x39cd9f;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0x99e5('0x0'));var util=require(_0x99e5('0x1'));var config=require(_0x99e5('0x2'));var logger=require(_0x99e5('0x3'))(_0x99e5('0x4'));var cmContactRpc=require(_0x99e5('0x5'));config[_0x99e5('0x6')]=_[_0x99e5('0x7')](config[_0x99e5('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x99e5('0x8'))(new Redis(config[_0x99e5('0x6')]));function emit(_0x3eaeec,_0xd9e56c,_0x9aea32,_0x6feb16,_0x29f360){logger[_0x99e5('0x9')]('[CM][%s][%s]',_0x3eaeec,_0xd9e56c['id'],_0x9aea32,_0x6feb16,JSON['stringify'](_0x29f360));io['to'](_0x9aea32)[_0x99e5('0xa')](_0x6feb16,_0x29f360);}exports[_0x99e5('0xb')]=function(_0x262b52,_0x5ce4a6,_0x234724,_0x4d05ee){var _0x28073e,_0x3d11e7;var _0x4a4328={};var _0x28e0af;var _0x592bd8=Number(_0x234724[_0x99e5('0xc')]);var _0x408cb0=_0x234724[_0x99e5('0xd')]?Boolean(Number(_0x234724[_0x99e5('0xd')])):![];var _0x4ec09a;var _0xb7c440=![];if(!_[_0x99e5('0xe')](_0x234724[_0x99e5('0xf')])){if(_0x234724[_0x99e5('0xf')]=='1')_0xb7c440=!![];}if(!_0xb7c440){if(_0x4d05ee[_0x99e5('0x10')]){_0x4a4328['id']=_0x4d05ee[_0x99e5('0x10')];}}if(!_0x4a4328['id']){_0x4a4328[_0x99e5('0x11')]=_0x592bd8;_0x4ec09a=_0x234724['data3']&&_0x234724[_0x99e5('0x12')]!=='0'?_0x234724['data3'][_0x99e5('0x13')](','):[_0x99e5('0x14')];_0x4a4328[_0x99e5('0x15')]=_['map'](_0x4ec09a,function(_0x346eb8){var _0xd68665={};_0xd68665[_0x346eb8]=_0x4d05ee[_0x99e5('0x16')]?_0x4d05ee['destcalleridnum']:_0x4d05ee['calleridnum'];return _0xd68665;});_0x28e0af=_0x4d05ee[_0x99e5('0x16')]?_0x4d05ee[_0x99e5('0x17')]:_0x4d05ee[_0x99e5('0x18')];}var _0x38805a=['id',_0x99e5('0x19'),_0x99e5('0x1a'),_0x99e5('0x14'),_0x99e5('0x1b'),_0x99e5('0x1c'),_0x99e5('0x11'),_0x99e5('0x1d'),_0x99e5('0x1e'),'updatedAt'];var _0xda826c=_['union'](_0x38805a,_0x4ec09a);BPromise['resolve']()[_0x99e5('0x1f')](cmContactRpc[_0x99e5('0x20')]({'attributes':_0xda826c,'where':_0x4a4328,'phone':_0x28e0af}))[_0x99e5('0x1f')](function(_0x1efbff){_0x3d11e7=_0x1efbff;if(!_[_0x99e5('0x21')](_0x3d11e7)){if(_0x3d11e7['length']===0x1){_0x28073e=_0x3d11e7[0x0];logger[_0x99e5('0x9')](_0x99e5('0x22'),_0x4d05ee[_0x99e5('0x23')],_0x5ce4a6['id'],_0x28073e['id']);}else{logger[_0x99e5('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x4d05ee[_0x99e5('0x23')],_0x5ce4a6['id'],_[_0x99e5('0x24')](_0x3d11e7,'id')[_0x99e5('0x25')](','));}return;}else{logger[_0x99e5('0x9')](_0x99e5('0x26'),_0x4d05ee[_0x99e5('0x23')],_0x5ce4a6['id']);var _0x2c3af0={'ListId':_0x592bd8};var _0x921154=_0x234724[_0x99e5('0x27')]&&_0x234724[_0x99e5('0x27')]!=='0'?_0x234724[_0x99e5('0x27')]:'phone';if(_0x408cb0){logger[_0x99e5('0x9')](_0x99e5('0x28'),_0x4d05ee[_0x99e5('0x23')],_0x5ce4a6['id']);_0x2c3af0[_0x921154]=_[_0x99e5('0xe')](_0x4d05ee['routeId'])?_0x4d05ee['calleridnum']:_0x4d05ee[_0x99e5('0x17')];if(_[_0x99e5('0xe')](_0x4d05ee[_0x99e5('0x16')])){_0x2c3af0[_0x99e5('0x19')]=_0x4d05ee['calleridname']&&_0x4d05ee[_0x99e5('0x29')]!==_0x99e5('0x2a')?_0x4d05ee['calleridname']:'Unknown';}else{_0x2c3af0['firstName']=_0x4d05ee[_0x99e5('0x2b')]&&_0x4d05ee[_0x99e5('0x2b')]!==_0x99e5('0x2a')?_0x4d05ee[_0x99e5('0x2b')]:_0x99e5('0x2c');}return BPromise[_0x99e5('0x2d')]()['then'](cmContactRpc[_0x99e5('0x2e')](_0x2c3af0))['then'](function(_0x552c00){_0x28073e=_0x552c00;_0x3d11e7[_0x99e5('0x2f')](_0x552c00);if(_0x28073e){logger['info'](_0x99e5('0x30'),_0x4d05ee['uniqueid'],_0x5ce4a6['id'],_0x28073e['id']);}return;});}else{logger[_0x99e5('0x9')](_0x99e5('0x31'),_0x4d05ee['uniqueid'],_0x5ce4a6['id']);_0x2c3af0[_0x921154]=_[_0x99e5('0xe')](_0x4d05ee['routeId'])?_0x4d05ee[_0x99e5('0x18')]:_0x4d05ee['destcalleridnum'];if(_['isNil'](_0x4d05ee[_0x99e5('0x16')])){_0x2c3af0[_0x99e5('0x19')]=_0x4d05ee[_0x99e5('0x29')]&&_0x4d05ee[_0x99e5('0x29')]!==''?_0x4d05ee[_0x99e5('0x29')]:'Unknown';}else{_0x2c3af0['firstName']=_0x4d05ee[_0x99e5('0x2b')]&&_0x4d05ee[_0x99e5('0x2b')]!==''?_0x4d05ee[_0x99e5('0x2b')]:_0x99e5('0x2c');}_0x28073e=_0x2c3af0;_0x3d11e7[_0x99e5('0x2f')](_0x2c3af0);return;}}})['then'](function(){if(_0x262b52){emit(_0x4d05ee['uniqueid'],_0x5ce4a6,util[_0x99e5('0x32')]('user:%s',_0x262b52[_0x99e5('0x33')]),util[_0x99e5('0x32')](_0x99e5('0x34'),_0x234724[_0x99e5('0x35')][_0x99e5('0x36')]()),{'evt':_[_0x99e5('0x37')](_0x4d05ee,{'autoCreate':_0x408cb0}),'contact':_0x28073e===undefined?{}:_0x28073e,'contacts':_0x3d11e7[_0x99e5('0x38')]===0x0?undefined:_0x3d11e7});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 8800675..a83cd16 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 _0x71d5=['./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','defaults','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','motionChannel','undefined','voice','checkTriggers','interface','hasOwnProperty','checkTrigger','Actions','contactmanager','motionbar','browser','data1','TemplateId','data2','html','url','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','winApplication','render','winArguments','format','user:%s','name','action','toLowerCase','merge','trigger:%s','exec','integration','queue','routeId','urlforward','script','parse','query','search','replace','channel','AllConditions','length','every','checkConditions','some','AnyConditions','debug','checkTrigger:\x20trigger','inspect','evt','field','chat','ChatWebsiteId','operator','value','AccountId','upperFirst','interaction','message','event','membername','lastevent','null','substatus','created','equals','exports','util','lodash','ioredis'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x71d5,0x109));var _0x571d=function(_0x4fdda9,_0x388021){_0x4fdda9=_0x4fdda9-0x0;var _0x4e71e9=_0x71d5[_0x4fdda9];return _0x4e71e9;};'use strict';var util=require(_0x571d('0x0'));var _=require(_0x571d('0x1'));var url=require('url');var Mustache=require('mustache');var Redis=require(_0x571d('0x2'));var urlforward=require(_0x571d('0x3'));var integration=require(_0x571d('0x4'));var cmContact=require(_0x571d('0x5'));var script=require(_0x571d('0x6'));var config=require(_0x571d('0x7'));var logger=require(_0x571d('0x8'))(_0x571d('0x9'));var ami=require(_0x571d('0xa'));config['redis']=_[_0x571d('0xb')](config[_0x571d('0xc')],{'host':_0x571d('0xd'),'port':0x18eb});var io=require(_0x571d('0xe'))(new Redis(config[_0x571d('0xc')]));var operators={'equals':function(_0x2e8c89,_0x44861f){return _0x2e8c89==_0x44861f;},'not_equals':function(_0x54785f,_0x148f1f){return _0x54785f!=_0x148f1f;}};var barAndWebActions=[_0x571d('0xf'),'url',_0x571d('0x10')];function Trigger(_0x22a2ac){this[_0x571d('0x11')]=_0x22a2ac['triggers'];this[_0x571d('0x12')]=_0x22a2ac['agents'];this[_0x571d('0x13')]=_0x22a2ac[_0x571d('0x13')];this[_0x571d('0x14')]=_0x22a2ac[_0x571d('0x14')];this[_0x571d('0x15')]=_0x22a2ac[_0x571d('0x15')];this[_0x571d('0x16')]=_0x22a2ac[_0x571d('0x16')];this[_0x571d('0x17')]=_0x22a2ac[_0x571d('0x17')];this[_0x571d('0x18')]=_0x22a2ac['salesforceAccounts'];this[_0x571d('0x19')]=_0x22a2ac[_0x571d('0x19')];this[_0x571d('0x1a')]=_0x22a2ac[_0x571d('0x1a')];this[_0x571d('0x1b')]=_0x22a2ac[_0x571d('0x1b')];this[_0x571d('0x1c')]=_0x22a2ac['vtigerAccounts'];this[_0x571d('0x1d')]=_0x22a2ac[_0x571d('0x1d')];this[_0x571d('0x1e')]=_0x22a2ac[_0x571d('0x1e')];this['freshsalesAccounts']=_0x22a2ac[_0x571d('0x1f')];this[_0x571d('0x20')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x571d('0x18')],'freshdesk':this[_0x571d('0x17')],'sugarcrm':this[_0x571d('0x19')],'zoho':this[_0x571d('0x1a')],'desk':this[_0x571d('0x1b')],'vtiger':this[_0x571d('0x1c')],'dynamics365':this[_0x571d('0x1e')],'freshsales':this[_0x571d('0x1f')],'servicenow':this[_0x571d('0x1d')]};ami['on'](_0x571d('0x21'),this['syncCustomEvent']['bind'](this));ami['on']('custom:agentconnect',this[_0x571d('0x22')][_0x571d('0x23')](this));ami['on']('custom:agentringnoanswer',this[_0x571d('0x22')]['bind'](this));ami['on'](_0x571d('0x24'),this[_0x571d('0x22')]['bind'](this));ami['on'](_0x571d('0x25'),this[_0x571d('0x22')][_0x571d('0x23')](this));ami['on']('custom:agentnoanswer',this[_0x571d('0x22')][_0x571d('0x23')](this));ami['on'](_0x571d('0x26'),this['syncCustomEvent']['bind'](this));ami['on'](_0x571d('0x27'),this['syncCustomEvent']['bind'](this));ami['on']('custom:agentreject',this[_0x571d('0x22')][_0x571d('0x23')](this));ami['on'](_0x571d('0x28'),this[_0x571d('0x22')]['bind'](this));ami['on'](_0x571d('0x29'),this[_0x571d('0x22')][_0x571d('0x23')](this));ami['on'](_0x571d('0x2a'),this['syncCustomEvent'][_0x571d('0x23')](this));ami['on'](_0x571d('0x2b'),this[_0x571d('0x2c')][_0x571d('0x23')](this));ami['on']('custom:dialconnect',this[_0x571d('0x2c')][_0x571d('0x23')](this));ami['on'](_0x571d('0x2d'),this[_0x571d('0x2c')]['bind'](this));ami['on'](_0x571d('0x2e'),this['syncCustomEvent'][_0x571d('0x23')](this));ami['on'](_0x571d('0x2f'),this[_0x571d('0x22')][_0x571d('0x23')](this));ami['on'](_0x571d('0x30'),this[_0x571d('0x22')]['bind'](this));ami['on'](_0x571d('0x31'),this[_0x571d('0x22')][_0x571d('0x23')](this));ami['on'](_0x571d('0x32'),this[_0x571d('0x22')]['bind'](this));ami['on'](_0x571d('0x33'),this[_0x571d('0x22')][_0x571d('0x23')](this));ami['on'](_0x571d('0x34'),this[_0x571d('0x22')][_0x571d('0x23')](this));ami['on']('custom:offlineMessage',this[_0x571d('0x22')]['bind'](this));}Trigger[_0x571d('0x35')][_0x571d('0x36')]=function(_0x150769,_0x1bcbd0,_0x54cd21){logger[_0x571d('0x37')](_0x150769,_0x1bcbd0,JSON[_0x571d('0x38')](_0x54cd21));io['to'](_0x150769)[_0x571d('0x36')](_0x1bcbd0,_0x54cd21);};Trigger['prototype']['syncCustomEvent']=function(_0x32d5ec){var _0x5f2a15=_[_0x571d('0x39')](_0x32d5ec);if(typeof _0x5f2a15[_0x571d('0x3a')]===_0x571d('0x3b')){_0x5f2a15[_0x571d('0x3a')]=_0x571d('0x3c');}logger['debug'](_0x571d('0x22'),util['inspect'](_0x5f2a15,{'showHidden':!![],'depth':null}));this[_0x571d('0x3d')](_0x5f2a15);};Trigger[_0x571d('0x35')][_0x571d('0x2c')]=function(_0x58cb55){if(this[_0x571d('0x12')][_0x58cb55[_0x571d('0x3e')]]){this[_0x571d('0x22')](_0x58cb55);}};Trigger['prototype'][_0x571d('0x3d')]=function(_0x453b70){var _0x2b621e;for(var _0x53fb1b in this['triggers']){if(this[_0x571d('0x11')][_0x571d('0x3f')](_0x53fb1b)){if(this[_0x571d('0x11')][_0x53fb1b]['status']){_0x2b621e=this[_0x571d('0x40')](this[_0x571d('0x11')][_0x53fb1b],_0x453b70);if(_0x2b621e){_['merge'](_0x453b70,_0x453b70['variables']);for(var _0x4cb5b7=0x0,_0x17f4fb,_0x4785bd,_0x15db12;_0x4cb5b70x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file +var _0x814b=['calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','%s:%s','authType','token','username','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','length','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','type','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','unmanaged','lastevent'];(function(_0x52fe58,_0x30c710){var _0x364e54=function(_0x4acf93){while(--_0x4acf93){_0x52fe58['push'](_0x52fe58['shift']());}};_0x364e54(++_0x30c710);}(_0x814b,0x1a2));var _0xb814=function(_0x153c6a,_0x2a217a){_0x153c6a=_0x153c6a-0x0;var _0xce898f=_0x814b[_0x153c6a];return _0xce898f;};'use strict';var _=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var md5=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var intUtil=require(_0xb814('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb814('0x6'))(_0xb814('0x7'));config[_0xb814('0x8')]=_[_0xb814('0x9')](config[_0xb814('0x8')],{'host':_0xb814('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb814('0x8')]));function emit(_0x2e6272,_0x5c8539,_0x271af9){io['to'](_0x2e6272)[_0xb814('0xb')](_0x5c8539,_0x271af9);}var headers={'Content-Type':_0xb814('0xc'),'Accept':_0xb814('0xc')};function getUser(_0x1fea33,_0x21d4a5){if(intUtil[_0xb814('0xd')](_0x21d4a5)===!![]){logger[_0xb814('0xe')](_0xb814('0xf'),_0x21d4a5);return request({'uri':util[_0xb814('0x10')](_0xb814('0x11'),_0x1fea33['remoteUri'])})[_0xb814('0x12')](function(_0x56278f){if(_0x56278f[_0xb814('0x13')]){return _[_0xb814('0x14')](_0x56278f[_0xb814('0x15')][_0xb814('0x16')],{'email':_0x21d4a5});}})[_0xb814('0x12')](function(_0x3bde14){if(_0x3bde14){logger[_0xb814('0xe')](_0xb814('0x17'));return _0x3bde14;}else{logger[_0xb814('0xe')](_0xb814('0x18'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}});}else{logger[_0xb814('0xe')](_0xb814('0x1b'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}}function request(_0x125ce2){logger[_0xb814('0x1c')](_0xb814('0x1d'),JSON['stringify'](_0x125ce2));return rp(_[_0xb814('0x9')](_0x125ce2,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x270598){var _0xfac75b;if(_0x270598['authType']==='basic'){_0xfac75b=util['format'](_0xb814('0x1e'),_0x270598['username'],_0x270598['password']);}else if(_0x270598[_0xb814('0x1f')]===_0xb814('0x20')){_0xfac75b=util[_0xb814('0x10')]('%s/token:%s',_0x270598[_0xb814('0x21')],_0x270598['token']);}return util[_0xb814('0x10')](_0xb814('0x22'),new Buffer(_0xfac75b)[_0xb814('0x23')](_0xb814('0x24')));}function getEndUser(_0x27352e,_0x2bd039,_0x1f5d40){logger['info'](_0xb814('0x25'),_0x1f5d40);return request({'uri':util['format'](_0xb814('0x26'),_0x27352e[_0xb814('0x1a')]),'qs':{'phone':_0x1f5d40}})[_0xb814('0x12')](function(_0x208927){if(_0x208927[_0xb814('0x13')]){logger[_0xb814('0xe')](_0xb814('0x27'));return _0x208927['_embedded'][_0xb814('0x16')][0x0];}else{logger[_0xb814('0xe')](_0xb814('0x28'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x29'),_0x27352e[_0xb814('0x1a')]),'method':_0xb814('0x2a'),'body':{'first_name':_0x2bd039,'title':_0x2bd039,'phone_numbers':[{'type':_0xb814('0x2b'),'value':_0x1f5d40}]}});}});}function getTags(_0x5a6291,_0x271aa8){var _0x328a08=[];if(_0x5a6291&&_0x5a6291['length']>0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ 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 49a8aeb..4e994a4 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 _0x80b9=['phonecall','callDirection','queue','phonecalls','headers','odata-entityid','ticketId','format','emit','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','recordingURL','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','CloudProvider','data7','resolve','data5','clientId','remoteUri','username','password','clientSecret','then','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userEmail','userId','catch','message','toLowerCase','outbound','calleridnum','contacts','body','lastIndexOf','destcalleridnum','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','picklist','customField','idField','substring','indexOf','ticketType','incident','POST','incidents','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields'];(function(_0x40a6ce,_0x5cf221){var _0x470d50=function(_0x49e1d8){while(--_0x49e1d8){_0x40a6ce['push'](_0x40a6ce['shift']());}};_0x470d50(++_0x5cf221);}(_0x80b9,0x1c9));var _0x980b=function(_0x3b9489,_0x3c55b5){_0x3b9489=_0x3b9489-0x0;var _0x13457c=_0x80b9[_0x3b9489];return _0x13457c;};'use strict';var _=require(_0x980b('0x0'));var rp=require(_0x980b('0x1'));var util=require(_0x980b('0x2'));var intUtil=require(_0x980b('0x3'));var md5=require(_0x980b('0x4'));var Redis=require('ioredis');var logger=require(_0x980b('0x5'))(_0x980b('0x6'));var config=require(_0x980b('0x7'));config[_0x980b('0x8')]=_['defaults'](config[_0x980b('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x980b('0x8')]));function getAuthToken(_0x5e11d6,_0x44e4f8,_0x324d4f){if(_0x5e11d6['modernAuthentication']){_0x5e11d6['remoteUri']=_0x5e11d6[_0x980b('0x9')][_0x980b('0xa')];_0x5e11d6['tenantId']=_0x5e11d6[_0x980b('0x9')]['data2'];return Promise[_0x980b('0xb')](_0x5e11d6[_0x980b('0x9')][_0x980b('0xc')]);}var _0x4a5f3b={'method':'POST','uri':_0x44e4f8,'form':{'client_id':_0x5e11d6[_0x980b('0xd')],'resource':_0x5e11d6[_0x980b('0xe')],'username':_0x5e11d6[_0x980b('0xf')],'password':_0x5e11d6[_0x980b('0x10')],'grant_type':'password','client_secret':_0x5e11d6[_0x980b('0x11')]},'json':!![]};return rp(_0x4a5f3b)[_0x980b('0x12')](function(_0x2d1d88){return _0x2d1d88['access_token'];})['catch'](function(_0x54ff00){logger['error']('['+[_0x324d4f[_0x980b('0x13')]()]+_0x980b('0x14'));return _0x54ff00['message'];});}function getUser(_0x28fb72,_0x1c6d6d,_0x4d1f03,_0x200416,_0x1e5fa8,_0x34ee90){return new Promise(function(_0x1cbdff,_0x45fa62){return getAuthToken(_0x1c6d6d,_0x200416,_0x34ee90)['then'](function(_0x5b8fb3){var _0x55e5dc={'method':_0x980b('0x15'),'uri':_0x1e5fa8+_0x980b('0x16'),'headers':{'Authorization':_0x980b('0x17')+_0x5b8fb3,'OData-Version':_0x980b('0x18')},'json':!![]};return rp(_0x55e5dc);})[_0x980b('0x12')](function(_0x58298c){var _0x29d90e=_0x58298c[_0x980b('0x19')];var _0x3385d6=![];var _0x3670c7=null;if(!_[_0x980b('0x1a')](_0x4d1f03)){if(intUtil[_0x980b('0x1b')](_0x4d1f03[_0x980b('0x1c')])){_0x28fb72['userEmail']=_0x4d1f03[_0x980b('0x1c')];for(_0x3670c7=0x0;_0x3670c7<_0x29d90e[_0x980b('0x1d')];_0x3670c7++){if(_0x29d90e[_0x3670c7][_0x980b('0x1e')]===_0x4d1f03[_0x980b('0x1c')]&&!_0x29d90e[_0x3670c7][_0x980b('0x1f')]){_0x3385d6=!![];logger[_0x980b('0x20')]('['+[_0x34ee90['toUpperCase']()]+_0x980b('0x21')+_0x29d90e[_0x3670c7][_0x980b('0x22')]+'!');_0x28fb72['userId']=_0x29d90e[_0x3670c7][_0x980b('0x22')];}}}}if(!_0x3385d6){logger['info']('['+[_0x34ee90[_0x980b('0x13')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x28fb72[_0x980b('0x23')]=_0x1c6d6d[_0x980b('0xf')];for(_0x3670c7=0x0;_0x3670c7<_0x29d90e[_0x980b('0x1d')];_0x3670c7++){if(_0x29d90e[_0x3670c7][_0x980b('0x1e')]===_0x1c6d6d[_0x980b('0xf')]){_0x28fb72[_0x980b('0x24')]=_0x29d90e[_0x3670c7][_0x980b('0x22')];}}}_0x1cbdff(_0x28fb72);})[_0x980b('0x25')](function(_0x447387){_0x45fa62(_0x447387[_0x980b('0x26')]);});});}function createEndUser(_0xaaed34,_0x43edae,_0x511539,_0x2399f6,_0x51e6d6,_0x2941a9,_0x2c80e1){return new Promise(function(_0x210524,_0x1b6341){return getAuthToken(_0x43edae,_0x511539,_0x2941a9)[_0x980b('0x12')](function(_0x2f7aff){var _0x2dfa87=_0x2941a9[_0x980b('0x27')]()===_0x980b('0x28')?_0x51e6d6['destcalleridnum']:_0x51e6d6[_0x980b('0x29')];var _0xc2a3fb={'method':'POST','uri':_0x2399f6+_0x980b('0x2a'),'body':{'fullname':_0x2dfa87,'firstname':_0x2dfa87,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0xaaed34[_0x980b('0x24')]+')'},'headers':{'Authorization':_0x980b('0x17')+_0x2f7aff,'OData-Version':_0x980b('0x18')},'json':!![],'resolveWithFullResponse':!![]};_0xc2a3fb[_0x980b('0x2b')][_0x2c80e1]=_0x2dfa87;return rp(_0xc2a3fb);})['then'](function(_0x47d2d2){var _0x4e4f0b=_0x47d2d2['headers']['odata-entityid'];var _0x1cc6e4=_0x4e4f0b['substring'](_0x4e4f0b['lastIndexOf']('(')+0x1,_0x4e4f0b[_0x980b('0x2c')](')'));_0xaaed34['enduserId']=_0x1cc6e4;_0x210524(_0xaaed34);})[_0x980b('0x25')](function(_0x9b6f7d){_0x1b6341(_0x9b6f7d[_0x980b('0x26')]);});});}function getEndUser(_0x5f3cbe,_0x37bd78,_0xa4c061,_0x24229a,_0x801f88,_0xb3445,_0x5557d0,_0x2c827b){var _0x1483b0=_0xb3445['toLowerCase']()===_0x980b('0x28')?_0x801f88[_0x980b('0x2d')]:_0x801f88[_0x980b('0x29')];return getAuthToken(_0x37bd78,_0xa4c061,_0xb3445)['then'](function(_0x1b063c){_0x2c827b=_0x2c827b?_0x2c827b:_0x980b('0x2e');var _0x494004={'method':_0x980b('0x15'),'uri':_0x24229a+_0x980b('0x2f')+_0x2c827b+_0x980b('0x30')+_0x2c827b+_0x980b('0x31')+_0x1483b0['replace']('+','%2b')+'\x27','headers':{'Authorization':_0x980b('0x17')+_0x1b063c,'If-None-Match':null,'OData-Version':_0x980b('0x18')},'json':!![]};return rp(_0x494004);})[_0x980b('0x12')](function(_0x58624b){var _0x3678ac=![];if(!_0x58624b)return _0x3678ac;var _0x3c8451=_0x58624b['value'];for(var _0x3ea57c=0x0;_0x3ea57c<_0x3c8451[_0x980b('0x1d')];_0x3ea57c++){if(_0x3c8451[_0x3ea57c][_0x2c827b]===_0x1483b0){_0x3678ac=!![];_0x5f3cbe[_0x980b('0x32')]=_0x3c8451[_0x3ea57c][_0x980b('0x33')];}}return _0x3678ac;})[_0x980b('0x12')](function(_0xe5b953){if(_0xe5b953)return _0x5f3cbe;if(_0x5557d0===_0x980b('0x34')){logger[_0x980b('0x20')]('['+[_0xb3445[_0x980b('0x13')]()]+_0x980b('0x35'));return _0x5f3cbe;}return createEndUser(_0x5f3cbe,_0x37bd78,_0xa4c061,_0x24229a,_0x801f88,_0xb3445,_0x2c827b)[_0x980b('0x12')](function(_0x47b538){logger['info']('['+[_0xb3445[_0x980b('0x13')]()]+_0x980b('0x36'),_0x47b538[_0x980b('0x32')]);return _0x47b538;});});}function getCustomFields(_0xc221dd,_0x50e50d,_0x4104d2){var _0x497d68={};if(_0xc221dd[_0x980b('0x1d')]>0x0){_[_0x980b('0x37')](_0xc221dd,function(_0x51ae9d){if(_['includes']([_0x980b('0x38'),_0x980b('0x39')],_0x51ae9d['type'])&&_0x51ae9d['nameField']&&!_0x51ae9d[_0x980b('0x3a')]){var _0x1b9c8e=_0x51ae9d[_0x980b('0x3b')][_0x980b('0x27')]();var _0x3fc416=_0x1b9c8e[_0x980b('0x3c')](0x0,_0x1b9c8e[_0x980b('0x3d')]('_'));var _0x547977=_0x1b9c8e['substring'](_0x1b9c8e[_0x980b('0x3d')]('_')+0x1);if(_0x3fc416===_0x4104d2){_0x497d68[_0x547977]=_0x51ae9d['content'];}}});}return _0x497d68;}function getTicket(_0x2725a6,_0x55668f,_0x1bdd78,_0x5ac09b,_0x29043d,_0x23f3a4,_0x17a3dd){return new Promise(function(_0x7d8ffb,_0x503cda){var _0xd015fa;return getAuthToken(_0x55668f,_0x1bdd78,_0x17a3dd)[_0x980b('0x12')](function(_0x54b2a8){if(_0x23f3a4[_0x980b('0x3e')]===_0x980b('0x3f')){_0xd015fa={'method':_0x980b('0x40'),'uri':_0x5ac09b+_0x980b('0x41'),'body':Object[_0x980b('0x42')]({},{'title':intUtil[_0x980b('0x43')](_0x23f3a4[_0x980b('0x44')],_0x29043d,'\x20'),'description':intUtil[_0x980b('0x43')](_0x23f3a4[_0x980b('0x45')],_0x29043d,'\x0a'),'customerid_contact@odata.bind':_0x2725a6[_0x980b('0x32')]?_0x980b('0x46')+_0x2725a6[_0x980b('0x32')]+')':undefined,'ownerid@odata.bind':_0x980b('0x47')+_0x2725a6[_0x980b('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x23f3a4[_0x980b('0x48')],_0x29043d,_0x23f3a4[_0x980b('0x3e')])),'headers':{'Authorization':_0x980b('0x17')+_0x54b2a8,'OData-Version':_0x980b('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x23f3a4[_0x980b('0x3e')]===_0x980b('0x49')){var _0x4906b2=_0x2725a6[_0x980b('0x32')]?[{'partyid_systemuser@odata.bind':_0x980b('0x47')+_0x2725a6['userId']+')','participationtypemask':_0x2725a6[_0x980b('0x4a')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x980b('0x46')+_0x2725a6['enduserId']+')','participationtypemask':_0x2725a6[_0x980b('0x4a')]===_0x980b('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2725a6[_0x980b('0x24')]+')','participationtypemask':_0x2725a6[_0x980b('0x4a')]===_0x980b('0x4b')?0x2:0x1}];_0xd015fa={'method':_0x980b('0x40'),'uri':_0x5ac09b+_0x980b('0x4c'),'body':Object[_0x980b('0x42')]({},{'subject':intUtil[_0x980b('0x43')](_0x23f3a4[_0x980b('0x44')],_0x29043d,'\x20'),'phonenumber':String(_0x29043d[_0x980b('0x29')]),'description':intUtil[_0x980b('0x43')](_0x23f3a4[_0x980b('0x45')],_0x29043d,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2725a6['enduserId']?_0x980b('0x46')+_0x2725a6[_0x980b('0x32')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x2725a6['userId']+')','directioncode':_0x2725a6['callDirection']===_0x980b('0x4b')?![]:!![],'phonecall_activity_parties':_0x4906b2},getCustomFields(_0x23f3a4[_0x980b('0x48')],_0x29043d,_0x23f3a4[_0x980b('0x3e')])),'headers':{'Authorization':_0x980b('0x17')+_0x54b2a8,'OData-Version':_0x980b('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xd015fa);})['then'](function(_0x57145c){var _0x56f134=_0x57145c[_0x980b('0x4d')][_0x980b('0x4e')];var _0x4d08d1=_0x56f134[_0x980b('0x3c')](_0x56f134[_0x980b('0x2c')]('(')+0x1,_0x56f134[_0x980b('0x2c')](')'));_0x2725a6[_0x980b('0x4f')]=_0x4d08d1;_0x7d8ffb(_0x2725a6);})['catch'](function(_0x2bdf6a){_0x503cda(_0x2bdf6a[_0x980b('0x26')]);});});}function emit(_0x1f44b7,_0x2daa10,_0x128b59,_0x11a4fa){var _0x5bbab8={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x1f44b7,_0x128b59,_0x11a4fa)};io['to'](util[_0x980b('0x50')]('user:%s',_0x2daa10))[_0x980b('0x51')]('trigger:browser:url',_0x5bbab8);}exports['cs']=function(_0x49e7ed,_0x1ff9df,_0x311814,_0x2e715d,_0x59b334,_0x449ed6,_0x2ba992,_0x35df83){var _0x291a39={};_0x449ed6['remoteUri']=_0x449ed6[_0x980b('0x52')]?intUtil[_0x980b('0x53')](_0x449ed6[_0x980b('0x9')]['data7']):intUtil['stripTrailingSlash'](_0x449ed6[_0x980b('0xe')]);_0x449ed6[_0x980b('0x54')]=intUtil[_0x980b('0x53')](_0x449ed6['serverUrl']);_0x291a39[_0x980b('0x4a')]=_0x35df83===_0x980b('0x4b')||_0x35df83===_0x980b('0x55')?'queue':_0x980b('0x28');var _0x55651b=_0x449ed6[_0x980b('0x52')]?util[_0x980b('0x50')](_0x980b('0x56'),_0x449ed6['CloudProvider'][_0x980b('0xa')]):util[_0x980b('0x50')]('%s/api/data/v9.0/',_0x449ed6[_0x980b('0xe')]);var _0x570247=util[_0x980b('0x50')](_0x980b('0x57'),_0x449ed6[_0x980b('0x58')]);var _0xde4e4e=util[_0x980b('0x50')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x449ed6[_0x980b('0x54')],_0x1ff9df[_0x980b('0x59')],md5(_0x1ff9df[_0x980b('0x59')]));if(_0x59b334&&_0x59b334[_0x980b('0x5a')]){logger[_0x980b('0x20')](_0x980b('0x5b'),'Recording\x20is\x20enabled!');_0x1ff9df[_0x980b('0x5c')]=_0xde4e4e;}else if(_0x2ba992&&_0x2ba992['recordingFormat']&&_0x2ba992['recordingFormat']!==_0x980b('0x5d')){logger[_0x980b('0x20')](_0x980b('0x5e'),'Recording\x20is\x20enabled!');_0x1ff9df[_0x980b('0x5c')]=_0xde4e4e;}else{_0x1ff9df[_0x980b('0x5c')]='';}return getUser(_0x291a39,_0x449ed6,_0x2e715d,_0x570247,_0x55651b,_0x35df83)[_0x980b('0x12')](function(_0x5deb9e){logger[_0x980b('0x20')]('['+_0x35df83[_0x980b('0x13')]()+_0x980b('0x5f'),_0x5deb9e['userId']);logger[_0x980b('0x20')]('['+_0x35df83[_0x980b('0x13')]()+']\x20The\x20User\x20email\x20is:',_0x5deb9e[_0x980b('0x23')]);return getEndUser(_0x5deb9e,_0x449ed6,_0x570247,_0x55651b,_0x1ff9df,_0x35df83,_0x311814['moduleCreate'],_0x311814[_0x980b('0x60')]);})[_0x980b('0x12')](function(_0x430939){logger['info']('['+_0x35df83[_0x980b('0x13')]()+_0x980b('0x61'),_0x430939['enduserId']);logger[_0x980b('0x20')]('['+_0x35df83['toUpperCase']()+_0x980b('0x62'),_0x1ff9df[_0x980b('0x29')]);return getTicket(_0x430939,_0x449ed6,_0x570247,_0x55651b,_0x1ff9df,_0x311814,_0x35df83);})[_0x980b('0x12')](function(_0x36edb3){logger[_0x980b('0x20')](util[_0x980b('0x50')]('['+_0x35df83['toUpperCase']()+_0x980b('0x63'),_0x311814[_0x980b('0x3e')],_0x36edb3[_0x980b('0x4f')]));logger[_0x980b('0x20')](util[_0x980b('0x50')]('['+_0x35df83[_0x980b('0x13')]()+_0x980b('0x64'),_0x35df83));if(_0x35df83!=='unmanaged'&&_0x311814[_0x980b('0x65')]){logger['info']('['+_0x35df83['toUpperCase']()+']',_0x980b('0x66'));emit(_0x449ed6[_0x980b('0xe')],_0x2e715d[_0x980b('0x67')],_0x311814[_0x980b('0x3e')],_0x36edb3['ticketId']);}})[_0x980b('0x25')](function(_0x67811){logger[_0x980b('0x68')]('['+_0x35df83[_0x980b('0x13')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x67811['message']);console['error'](_0x980b('0x69'),_0x67811);});}; \ No newline at end of file +var _0xad97=['modernAuthentication','remoteUri','CloudProvider','tenantId','resolve','data5','POST','clientId','username','password','clientSecret','then','access_token','catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','systemuserid','toUpperCase',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','calleridnum','/systemusers(','userId','odata-entityid','substring','lastIndexOf','enduserId','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','string','picklist','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','Fields','phonecall','queue','/contacts(','callDirection','phonecalls','headers','user:%s','emit','trigger:browser:url','stripTrailingSlash','data7','serverUrl','format','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','util','../../../../config/logger','dynamics365','defaults','redis','localhost','socket.io-emitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad97,0x67));var _0x7ad9=function(_0x467c92,_0x3e54b6){_0x467c92=_0x467c92-0x0;var _0x5c691c=_0xad97[_0x467c92];return _0x5c691c;};'use strict';var _=require('lodash');var rp=require(_0x7ad9('0x0'));var util=require(_0x7ad9('0x1'));var intUtil=require('./util');var md5=require('md5');var Redis=require('ioredis');var logger=require(_0x7ad9('0x2'))(_0x7ad9('0x3'));var config=require('../../../../config/environment');config['redis']=_[_0x7ad9('0x4')](config[_0x7ad9('0x5')],{'host':_0x7ad9('0x6'),'port':0x18eb});var io=require(_0x7ad9('0x7'))(new Redis(config['redis']));function getAuthToken(_0x22b91f,_0x2d31ef,_0x33129b){if(_0x22b91f[_0x7ad9('0x8')]){_0x22b91f[_0x7ad9('0x9')]=_0x22b91f[_0x7ad9('0xa')]['data7'];_0x22b91f[_0x7ad9('0xb')]=_0x22b91f[_0x7ad9('0xa')]['data2'];return Promise[_0x7ad9('0xc')](_0x22b91f[_0x7ad9('0xa')][_0x7ad9('0xd')]);}var _0x32d0f7={'method':_0x7ad9('0xe'),'uri':_0x2d31ef,'form':{'client_id':_0x22b91f[_0x7ad9('0xf')],'resource':_0x22b91f[_0x7ad9('0x9')],'username':_0x22b91f[_0x7ad9('0x10')],'password':_0x22b91f[_0x7ad9('0x11')],'grant_type':'password','client_secret':_0x22b91f[_0x7ad9('0x12')]},'json':!![]};return rp(_0x32d0f7)[_0x7ad9('0x13')](function(_0x1e991d){return _0x1e991d[_0x7ad9('0x14')];})[_0x7ad9('0x15')](function(_0x46585a){logger[_0x7ad9('0x16')]('['+[_0x33129b['toUpperCase']()]+_0x7ad9('0x17'));return _0x46585a[_0x7ad9('0x18')];});}function getUser(_0x4efdd0,_0x253385,_0x325a38,_0x4dc5f6,_0x105884,_0x3eab6e){return new Promise(function(_0x35ef70,_0x3826d1){return getAuthToken(_0x253385,_0x4dc5f6,_0x3eab6e)[_0x7ad9('0x13')](function(_0x32ddde){var _0x174020={'method':_0x7ad9('0x19'),'uri':_0x105884+_0x7ad9('0x1a'),'headers':{'Authorization':_0x7ad9('0x1b')+_0x32ddde,'OData-Version':_0x7ad9('0x1c')},'json':!![]};return rp(_0x174020);})['then'](function(_0x42dba6){var _0xfc4e3a=_0x42dba6[_0x7ad9('0x1d')];var _0x2ce6d9=![];var _0x19cdb9=null;if(!_[_0x7ad9('0x1e')](_0x325a38)){if(intUtil[_0x7ad9('0x1f')](_0x325a38[_0x7ad9('0x20')])){_0x4efdd0[_0x7ad9('0x21')]=_0x325a38[_0x7ad9('0x20')];for(_0x19cdb9=0x0;_0x19cdb9<_0xfc4e3a[_0x7ad9('0x22')];_0x19cdb9++){if(_0xfc4e3a[_0x19cdb9][_0x7ad9('0x23')]===_0x325a38[_0x7ad9('0x20')]&&!_0xfc4e3a[_0x19cdb9][_0x7ad9('0x24')]){_0x2ce6d9=!![];logger[_0x7ad9('0x25')]('['+[_0x3eab6e['toUpperCase']()]+']\x20Agent\x20found\x20'+_0xfc4e3a[_0x19cdb9][_0x7ad9('0x26')]+'!');_0x4efdd0['userId']=_0xfc4e3a[_0x19cdb9][_0x7ad9('0x26')];}}}}if(!_0x2ce6d9){logger[_0x7ad9('0x25')]('['+[_0x3eab6e[_0x7ad9('0x27')]()]+_0x7ad9('0x28'));_0x4efdd0['userEmail']=_0x253385[_0x7ad9('0x10')];for(_0x19cdb9=0x0;_0x19cdb9<_0xfc4e3a[_0x7ad9('0x22')];_0x19cdb9++){if(_0xfc4e3a[_0x19cdb9][_0x7ad9('0x23')]===_0x253385[_0x7ad9('0x10')]){_0x4efdd0['userId']=_0xfc4e3a[_0x19cdb9]['systemuserid'];}}}_0x35ef70(_0x4efdd0);})[_0x7ad9('0x15')](function(_0x300c4a){_0x3826d1(_0x300c4a[_0x7ad9('0x18')]);});});}function createEndUser(_0x506477,_0x2bc97c,_0x4d2351,_0x23710d,_0x76de47,_0x3937ab,_0x42675b){return new Promise(function(_0x32b729,_0x16fe76){return getAuthToken(_0x2bc97c,_0x4d2351,_0x3937ab)[_0x7ad9('0x13')](function(_0x281bc1){var _0x2f90eb=_0x3937ab[_0x7ad9('0x29')]()===_0x7ad9('0x2a')?_0x76de47[_0x7ad9('0x2b')]:_0x76de47[_0x7ad9('0x2c')];var _0x1ff76d={'method':_0x7ad9('0xe'),'uri':_0x23710d+'contacts','body':{'fullname':_0x2f90eb,'firstname':_0x2f90eb,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x7ad9('0x2d')+_0x506477[_0x7ad9('0x2e')]+')'},'headers':{'Authorization':_0x7ad9('0x1b')+_0x281bc1,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x1ff76d['body'][_0x42675b]=_0x2f90eb;return rp(_0x1ff76d);})[_0x7ad9('0x13')](function(_0x21bb41){var _0x3108f6=_0x21bb41['headers'][_0x7ad9('0x2f')];var _0x2975a7=_0x3108f6[_0x7ad9('0x30')](_0x3108f6[_0x7ad9('0x31')]('(')+0x1,_0x3108f6[_0x7ad9('0x31')](')'));_0x506477[_0x7ad9('0x32')]=_0x2975a7;_0x32b729(_0x506477);})['catch'](function(_0x5e1fa0){_0x16fe76(_0x5e1fa0[_0x7ad9('0x18')]);});});}function getEndUser(_0x40831f,_0x1ca6b6,_0x257e77,_0x2ae1d3,_0x1021a2,_0x24b872,_0x4c976d,_0x580f83){var _0x9e255=_0x24b872[_0x7ad9('0x29')]()===_0x7ad9('0x2a')?_0x1021a2[_0x7ad9('0x2b')]:_0x1021a2[_0x7ad9('0x2c')];return getAuthToken(_0x1ca6b6,_0x257e77,_0x24b872)[_0x7ad9('0x13')](function(_0x559511){_0x580f83=_0x580f83?_0x580f83:_0x7ad9('0x33');var _0x31afb8={'method':_0x7ad9('0x19'),'uri':_0x2ae1d3+_0x7ad9('0x34')+_0x580f83+_0x7ad9('0x35')+_0x580f83+_0x7ad9('0x36')+_0x9e255[_0x7ad9('0x37')]('+',_0x7ad9('0x38'))+'\x27','headers':{'Authorization':_0x7ad9('0x1b')+_0x559511,'If-None-Match':null,'OData-Version':_0x7ad9('0x1c')},'json':!![]};return rp(_0x31afb8);})['then'](function(_0x5d7bef){var _0x2ba01e=![];if(!_0x5d7bef)return _0x2ba01e;var _0x76a183=_0x5d7bef[_0x7ad9('0x1d')];for(var _0x3984f1=0x0;_0x3984f1<_0x76a183[_0x7ad9('0x22')];_0x3984f1++){if(_0x76a183[_0x3984f1][_0x580f83]===_0x9e255){_0x2ba01e=!![];_0x40831f[_0x7ad9('0x32')]=_0x76a183[_0x3984f1][_0x7ad9('0x39')];}}return _0x2ba01e;})[_0x7ad9('0x13')](function(_0x4152ed){if(_0x4152ed)return _0x40831f;if(_0x4c976d===_0x7ad9('0x3a')){logger[_0x7ad9('0x25')]('['+[_0x24b872['toUpperCase']()]+_0x7ad9('0x3b'));return _0x40831f;}return createEndUser(_0x40831f,_0x1ca6b6,_0x257e77,_0x2ae1d3,_0x1021a2,_0x24b872,_0x580f83)['then'](function(_0x59f20){logger[_0x7ad9('0x25')]('['+[_0x24b872[_0x7ad9('0x27')]()]+']\x20Enduser\x20created!',_0x59f20[_0x7ad9('0x32')]);return _0x59f20;});});}function getCustomFields(_0x5c5fdb,_0x4a664d,_0x1368c0){var _0x289376={};if(_0x5c5fdb[_0x7ad9('0x22')]>0x0){_[_0x7ad9('0x3c')](_0x5c5fdb,function(_0xf12700){if(_[_0x7ad9('0x3d')]([_0x7ad9('0x3e'),_0x7ad9('0x3f')],_0xf12700['type'])&&_0xf12700[_0x7ad9('0x40')]&&!_0xf12700[_0x7ad9('0x41')]){var _0x1eb20a=_0xf12700[_0x7ad9('0x42')][_0x7ad9('0x29')]();var _0x4457d1=_0x1eb20a[_0x7ad9('0x30')](0x0,_0x1eb20a[_0x7ad9('0x43')]('_'));var _0x5c6f79=_0x1eb20a[_0x7ad9('0x30')](_0x1eb20a[_0x7ad9('0x43')]('_')+0x1);if(_0x4457d1===_0x1368c0){_0x289376[_0x5c6f79]=_0xf12700[_0x7ad9('0x44')];}}});}return _0x289376;}function getTicket(_0x2fcedb,_0x4e1f0d,_0x37606e,_0x377f39,_0x2acb79,_0x135e23,_0x4bf918){return new Promise(function(_0x1d45d1,_0x5e16e4){var _0x4c38aa;return getAuthToken(_0x4e1f0d,_0x37606e,_0x4bf918)['then'](function(_0x3d8d7d){if(_0x135e23[_0x7ad9('0x45')]===_0x7ad9('0x46')){_0x4c38aa={'method':_0x7ad9('0xe'),'uri':_0x377f39+_0x7ad9('0x47'),'body':Object[_0x7ad9('0x48')]({},{'title':intUtil[_0x7ad9('0x49')](_0x135e23[_0x7ad9('0x4a')],_0x2acb79,'\x20'),'description':intUtil[_0x7ad9('0x49')](_0x135e23[_0x7ad9('0x4b')],_0x2acb79,'\x0a'),'customerid_contact@odata.bind':_0x2fcedb[_0x7ad9('0x32')]?'/contacts('+_0x2fcedb[_0x7ad9('0x32')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x2fcedb[_0x7ad9('0x2e')]+')','caseorigincode':'1'},getCustomFields(_0x135e23[_0x7ad9('0x4c')],_0x2acb79,_0x135e23[_0x7ad9('0x45')])),'headers':{'Authorization':_0x7ad9('0x1b')+_0x3d8d7d,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x135e23[_0x7ad9('0x45')]===_0x7ad9('0x4d')){var _0x381fb0=_0x2fcedb['enduserId']?[{'partyid_systemuser@odata.bind':_0x7ad9('0x2d')+_0x2fcedb[_0x7ad9('0x2e')]+')','participationtypemask':_0x2fcedb['callDirection']===_0x7ad9('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':_0x7ad9('0x4f')+_0x2fcedb[_0x7ad9('0x32')]+')','participationtypemask':_0x2fcedb['callDirection']===_0x7ad9('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2fcedb[_0x7ad9('0x2e')]+')','participationtypemask':_0x2fcedb[_0x7ad9('0x50')]===_0x7ad9('0x4e')?0x2:0x1}];_0x4c38aa={'method':_0x7ad9('0xe'),'uri':_0x377f39+_0x7ad9('0x51'),'body':Object[_0x7ad9('0x48')]({},{'subject':intUtil['getString'](_0x135e23['Subjects'],_0x2acb79,'\x20'),'phonenumber':String(_0x2acb79['calleridnum']),'description':intUtil[_0x7ad9('0x49')](_0x135e23[_0x7ad9('0x4b')],_0x2acb79,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2fcedb[_0x7ad9('0x32')]?_0x7ad9('0x4f')+_0x2fcedb[_0x7ad9('0x32')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x2fcedb[_0x7ad9('0x2e')]+')','directioncode':_0x2fcedb[_0x7ad9('0x50')]===_0x7ad9('0x4e')?![]:!![],'phonecall_activity_parties':_0x381fb0},getCustomFields(_0x135e23[_0x7ad9('0x4c')],_0x2acb79,_0x135e23[_0x7ad9('0x45')])),'headers':{'Authorization':_0x7ad9('0x1b')+_0x3d8d7d,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4c38aa);})[_0x7ad9('0x13')](function(_0x5d9e16){var _0x246fa1=_0x5d9e16[_0x7ad9('0x52')][_0x7ad9('0x2f')];var _0x6841f2=_0x246fa1[_0x7ad9('0x30')](_0x246fa1[_0x7ad9('0x31')]('(')+0x1,_0x246fa1[_0x7ad9('0x31')](')'));_0x2fcedb['ticketId']=_0x6841f2;_0x1d45d1(_0x2fcedb);})[_0x7ad9('0x15')](function(_0x5dfa6e){_0x5e16e4(_0x5dfa6e[_0x7ad9('0x18')]);});});}function emit(_0x27c3a9,_0x2b0696,_0x554a98,_0x3f894b){var _0x380465={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x27c3a9,_0x554a98,_0x3f894b)};io['to'](util['format'](_0x7ad9('0x53'),_0x2b0696))[_0x7ad9('0x54')](_0x7ad9('0x55'),_0x380465);}exports['cs']=function(_0x1085d6,_0x233b9b,_0x5298ee,_0xfb9c5e,_0x1ceca0,_0x19c38f,_0x1978cc,_0xe15316){var _0x239d39={};_0x19c38f['remoteUri']=_0x19c38f[_0x7ad9('0x8')]?intUtil[_0x7ad9('0x56')](_0x19c38f['CloudProvider'][_0x7ad9('0x57')]):intUtil[_0x7ad9('0x56')](_0x19c38f[_0x7ad9('0x9')]);_0x19c38f[_0x7ad9('0x58')]=intUtil['stripTrailingSlash'](_0x19c38f[_0x7ad9('0x58')]);_0x239d39['callDirection']=_0xe15316===_0x7ad9('0x4e')||_0xe15316==='unmanaged'?'queue':_0x7ad9('0x2a');var _0x2af3a3=_0x19c38f[_0x7ad9('0x8')]?util[_0x7ad9('0x59')](_0x7ad9('0x5a'),_0x19c38f[_0x7ad9('0xa')][_0x7ad9('0x57')]):util[_0x7ad9('0x59')](_0x7ad9('0x5a'),_0x19c38f[_0x7ad9('0x9')]);var _0x30034e=util[_0x7ad9('0x59')](_0x7ad9('0x5b'),_0x19c38f[_0x7ad9('0xb')]);var _0xf4cec0=util[_0x7ad9('0x59')](_0x7ad9('0x5c'),_0x19c38f[_0x7ad9('0x58')],_0x233b9b['uniqueid'],md5(_0x233b9b[_0x7ad9('0x5d')]));if(_0x1ceca0&&_0x1ceca0['monitor_format']){logger[_0x7ad9('0x25')](_0x7ad9('0x5e'),_0x7ad9('0x5f'));_0x233b9b[_0x7ad9('0x60')]=_0xf4cec0;}else if(_0x1978cc&&_0x1978cc[_0x7ad9('0x61')]&&_0x1978cc['recordingFormat']!==_0x7ad9('0x62')){logger[_0x7ad9('0x25')](_0x7ad9('0x63'),'Recording\x20is\x20enabled!');_0x233b9b[_0x7ad9('0x60')]=_0xf4cec0;}else{_0x233b9b['recordingURL']='';}return getUser(_0x239d39,_0x19c38f,_0xfb9c5e,_0x30034e,_0x2af3a3,_0xe15316)['then'](function(_0x3fd715){logger[_0x7ad9('0x25')]('['+_0xe15316[_0x7ad9('0x27')]()+_0x7ad9('0x64'),_0x3fd715[_0x7ad9('0x2e')]);logger['info']('['+_0xe15316[_0x7ad9('0x27')]()+']\x20The\x20User\x20email\x20is:',_0x3fd715['userEmail']);return getEndUser(_0x3fd715,_0x19c38f,_0x30034e,_0x2af3a3,_0x233b9b,_0xe15316,_0x5298ee['moduleCreate'],_0x5298ee[_0x7ad9('0x65')]);})[_0x7ad9('0x13')](function(_0x37f5c0){logger[_0x7ad9('0x25')]('['+_0xe15316[_0x7ad9('0x27')]()+_0x7ad9('0x66'),_0x37f5c0[_0x7ad9('0x32')]);logger[_0x7ad9('0x25')]('['+_0xe15316[_0x7ad9('0x27')]()+_0x7ad9('0x67'),_0x233b9b[_0x7ad9('0x2c')]);return getTicket(_0x37f5c0,_0x19c38f,_0x30034e,_0x2af3a3,_0x233b9b,_0x5298ee,_0xe15316);})[_0x7ad9('0x13')](function(_0x51a9fe){logger[_0x7ad9('0x25')](util[_0x7ad9('0x59')]('['+_0xe15316[_0x7ad9('0x27')]()+_0x7ad9('0x68'),_0x5298ee[_0x7ad9('0x45')],_0x51a9fe[_0x7ad9('0x69')]));logger['info'](util[_0x7ad9('0x59')]('['+_0xe15316[_0x7ad9('0x27')]()+']\x20Call\x20direction:\x20%s',_0xe15316));if(_0xe15316!=='unmanaged'&&_0x5298ee[_0x7ad9('0x6a')]){logger['info']('['+_0xe15316[_0x7ad9('0x27')]()+']',_0x7ad9('0x6b'));emit(_0x19c38f['remoteUri'],_0xfb9c5e[_0x7ad9('0x6c')],_0x5298ee[_0x7ad9('0x45')],_0x51a9fe[_0x7ad9('0x69')]);}})[_0x7ad9('0x15')](function(_0x8b1311){logger[_0x7ad9('0x16')]('['+_0xe15316[_0x7ad9('0x27')]()+_0x7ad9('0x6d'),_0x8b1311[_0x7ad9('0x18')]);console[_0x7ad9('0x16')](_0x7ad9('0x6e'),_0x8b1311);});}; \ 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 ca01666..7b8bc1c 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 _0xe647=['string','picklist','type','nameField','customField','content','push','idField','variableName','customVariable','Variable','toLowerCase','queue','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:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','user:%s','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','
','Tags','name','custom_fields','value','%s/api/v2/tickets','remoteUri','then','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','toString','base64','[HTTP]','stringify','forEach','includes'];(function(_0x26a03e,_0x44d369){var _0x1acff0=function(_0x5a4df7){while(--_0x5a4df7){_0x26a03e['push'](_0x26a03e['shift']());}};_0x1acff0(++_0x44d369);}(_0xe647,0x140));var _0x7e64=function(_0x1003dc,_0x1bb4c4){_0x1003dc=_0x1003dc-0x0;var _0x4d3868=_0xe647[_0x1003dc];return _0x4d3868;};'use strict';var _=require(_0x7e64('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x7e64('0x1'));var Redis=require(_0x7e64('0x2'));var intUtil=require(_0x7e64('0x3'));var config=require(_0x7e64('0x4'));var logger=require(_0x7e64('0x5'))(_0x7e64('0x6'));config[_0x7e64('0x7')]=_[_0x7e64('0x8')](config['redis'],{'host':_0x7e64('0x9'),'port':0x18eb});var io=require(_0x7e64('0xa'))(new Redis(config['redis']));var headers={'Content-Type':_0x7e64('0xb'),'Accept':_0x7e64('0xb')};function emit(_0x5b4f70,_0x23df03,_0x2fabbd){io['to'](_0x5b4f70)[_0x7e64('0xc')](_0x23df03,_0x2fabbd);}function getTicket(_0x21821b,_0x48feab,_0x49f065,_0x57d379,_0x22824f){logger[_0x7e64('0xd')]('Creating\x20new\x20ticket...');var _0x4a7e52=_[_0x7e64('0xe')]({'responder_id':_0x48feab['id'],'requester_id':_0x49f065['id'],'name':util[_0x7e64('0xf')](_0x7e64('0x10'),_0x22824f[_0x7e64('0x11')]),'phone':_0x22824f[_0x7e64('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x7e64('0x13')](_0x57d379[_0x7e64('0x14')],_0x22824f,'\x20'),'description':intUtil['getString'](_0x57d379['Descriptions'],_0x22824f,_0x7e64('0x15')),'tags':getTags(_0x57d379[_0x7e64('0x16')],_0x7e64('0x17'))},getCustomFields(_0x57d379['Fields'],_0x22824f));_0x4a7e52[_0x7e64('0x18')]=_['mapValues'](_['keyBy'](_0x4a7e52[_0x7e64('0x18')],'id'),_0x7e64('0x19'));return request({'uri':util[_0x7e64('0xf')](_0x7e64('0x1a'),_0x21821b[_0x7e64('0x1b')]),'method':'POST','body':_0x4a7e52})[_0x7e64('0x1c')](function(_0x5d67e9){logger['info']('Ticket\x20created!');return _0x5d67e9;});}function getUser(_0x4286df,_0x1da74b){if(intUtil[_0x7e64('0x1d')](_0x1da74b)){return request({'uri':util[_0x7e64('0xf')](_0x7e64('0x1e'),_0x4286df['remoteUri']),'qs':{'email':_0x1da74b}})[_0x7e64('0x1c')](function(_0x5166ed){if(_0x5166ed[_0x7e64('0x1f')]){logger[_0x7e64('0xd')](_0x7e64('0x20'));return _['find'](_0x5166ed,function(_0x426c6a){return _0x426c6a[_0x7e64('0x21')][_0x7e64('0x22')]===_0x1da74b;});}else{logger[_0x7e64('0xd')](_0x7e64('0x23'));return request({'uri':util[_0x7e64('0xf')](_0x7e64('0x24'),_0x4286df[_0x7e64('0x1b')])})[_0x7e64('0x1c')](function(_0xf30a6b){logger[_0x7e64('0xd')](_0x7e64('0x25'));return _0xf30a6b;});}});}else{logger[_0x7e64('0xd')](_0x7e64('0x26'));return request({'uri':util[_0x7e64('0xf')]('%s/api/v2/agents/me',_0x4286df['remoteUri'])})[_0x7e64('0x1c')](function(_0x5e5db0){logger[_0x7e64('0xd')](_0x7e64('0x25'));return _0x5e5db0;});}}function getEndUser(_0x5c6e79,_0x555a92,_0x2cf0a0){logger['info']('Searching\x20enduser\x20with\x20phone',_0x2cf0a0);return request({'uri':util[_0x7e64('0xf')](_0x7e64('0x27'),_0x5c6e79['remoteUri']),'qs':{'phone':_0x2cf0a0}})[_0x7e64('0x1c')](function(_0x593923){if(_0x593923[_0x7e64('0x1f')]){logger[_0x7e64('0xd')](_0x7e64('0x28'));return _[_0x7e64('0x29')](_0x593923,{'phone':_0x2cf0a0});}else{logger[_0x7e64('0xd')](_0x7e64('0x2a'));return request({'uri':util['format'](_0x7e64('0x27'),_0x5c6e79[_0x7e64('0x1b')]),'method':_0x7e64('0x2b'),'body':{'name':_0x555a92,'phone':_0x2cf0a0}})[_0x7e64('0x1c')](function(_0x569f7c){logger[_0x7e64('0xd')](_0x7e64('0x2c'));return _0x569f7c;});}});}function getAuth(_0x1bfaec){return util[_0x7e64('0xf')](_0x7e64('0x2d'),new Buffer(_0x1bfaec['apiKey']+':X')[_0x7e64('0x2e')](_0x7e64('0x2f')));}function request(_0x63bb86){logger['debug'](_0x7e64('0x30'),JSON[_0x7e64('0x31')](_0x63bb86));return rp(_[_0x7e64('0x8')](_0x63bb86,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x27f86a,_0x2a23f8){var _0xf2ff8e=[];if(_0x27f86a&&_0x27f86a[_0x7e64('0x1f')]>0x0){_0xf2ff8e=_['map'](_0x27f86a,_0x2a23f8);}return _0xf2ff8e;}function getCustomFields(_0x2f83b2,_0x358593){var _0x3e5b13=[];var _0x43bd90={'custom_fields':[]};if(_0x2f83b2[_0x7e64('0x1f')]>0x0){_[_0x7e64('0x32')](_0x2f83b2,function(_0x308e49){if(_[_0x7e64('0x33')]([_0x7e64('0x34'),_0x7e64('0x35')],_0x308e49[_0x7e64('0x36')])&&_0x308e49[_0x7e64('0x37')]&&!_0x308e49[_0x7e64('0x38')]){_0x43bd90[_0x308e49[_0x7e64('0x37')]['toLowerCase']()]=_0x308e49[_0x7e64('0x39')][_0x7e64('0x2e')]();}else if(_['includes']([_0x7e64('0x34'),_0x7e64('0x35')],_0x308e49[_0x7e64('0x36')])&&_0x308e49['idField']&&_0x308e49[_0x7e64('0x38')]){_0x43bd90[_0x7e64('0x18')][_0x7e64('0x3a')]({'id':_0x308e49[_0x7e64('0x3b')],'value':_0x308e49['content']['toString']()});}else if(_0x308e49[_0x7e64('0x36')]==='variable'&&_0x308e49[_0x7e64('0x3c')]&&_0x308e49[_0x7e64('0x3b')]&&_0x308e49[_0x7e64('0x38')]){_0x358593[_0x308e49[_0x7e64('0x3c')]]&&_0x43bd90[_0x7e64('0x18')][_0x7e64('0x3a')]({'id':_0x308e49['idField'],'value':_0x358593[_0x308e49[_0x7e64('0x3c')]]['toString']()});}else if(_0x308e49[_0x7e64('0x36')]===_0x7e64('0x3d')&&_0x308e49['Variable']&&_0x308e49['Variable']['name']&&_0x308e49[_0x7e64('0x3b')]&&_0x308e49['customField']){_0x358593[_0x308e49[_0x7e64('0x3e')]['name'][_0x7e64('0x3f')]()]&&_0x43bd90[_0x7e64('0x18')][_0x7e64('0x3a')]({'id':_0x308e49[_0x7e64('0x3b')],'value':_0x358593[_0x308e49[_0x7e64('0x3e')][_0x7e64('0x17')]['toLowerCase']()]['toString']()});}});}return _0x43bd90;}exports[_0x7e64('0x40')]=function(_0x464299,_0x20f08c,_0x470352,_0x589682,_0x5b637f,_0x5d7de8){var _0x3445c8,_0x11e6c3;_0x5d7de8['remoteUri']=intUtil[_0x7e64('0x41')](_0x5d7de8[_0x7e64('0x1b')]);_0x5d7de8[_0x7e64('0x42')]=intUtil[_0x7e64('0x41')](_0x5d7de8[_0x7e64('0x42')]);if(_0x5b637f&&_0x5b637f[_0x7e64('0x43')]){logger[_0x7e64('0xd')](_0x7e64('0x44'),_0x7e64('0x45'));_0x20f08c['recordingURL']=util[_0x7e64('0xf')](_0x7e64('0x46'),_0x5d7de8[_0x7e64('0x42')],_0x20f08c[_0x7e64('0x47')],md5(_0x20f08c['uniqueid']));}else{_0x20f08c['recordingURL']='';}headers[_0x7e64('0x48')]=getAuth(_0x5d7de8);return getUser(_0x5d7de8,_0x589682[_0x7e64('0x22')])[_0x7e64('0x1c')](function(_0x41dd95){_0x3445c8=_0x41dd95;logger[_0x7e64('0xd')](_0x7e64('0x49'),_0x3445c8['id']);return getEndUser(_0x5d7de8,_0x20f08c[_0x7e64('0x11')],_0x20f08c[_0x7e64('0x12')]);})[_0x7e64('0x1c')](function(_0x7d14ef){_0x11e6c3=_0x7d14ef;logger[_0x7e64('0xd')](_0x7e64('0x4a'),_0x11e6c3['id']);return getTicket(_0x5d7de8,_0x3445c8,_0x11e6c3,_0x470352,_0x20f08c);})[_0x7e64('0x1c')](function(_0x1871ae){if(_0x1871ae&&_0x1871ae['id']){logger[_0x7e64('0xd')](_0x7e64('0x4b'));logger[_0x7e64('0xd')](_0x7e64('0x4c'),_0x1871ae['id']);logger[_0x7e64('0xd')](_0x7e64('0x44'),_0x7e64('0x4d'));emit(util[_0x7e64('0xf')]('user:%s',_0x589682[_0x7e64('0x17')]),_0x7e64('0x4e'),{'uri':util[_0x7e64('0xf')](_0x7e64('0x4f'),_0x5d7de8[_0x7e64('0x1b')],_0x1871ae['id'])});}})[_0x7e64('0x50')](function(_0x4653a6){logger[_0x7e64('0x51')](_0x7e64('0x44'),JSON[_0x7e64('0x31')](_0x4653a6));});};exports[_0x7e64('0x52')]=function(_0x41ec3c,_0x6170d6,_0x255fc8,_0xfc825,_0x59c02f,_0x107bc8,_0x5f5093){var _0x2e71d5,_0x3de77f;_0x107bc8['remoteUri']=intUtil[_0x7e64('0x41')](_0x107bc8[_0x7e64('0x1b')]);_0x107bc8[_0x7e64('0x42')]=intUtil[_0x7e64('0x41')](_0x107bc8[_0x7e64('0x42')]);if(_0x5f5093&&_0x5f5093[_0x7e64('0x53')]&&_0x5f5093[_0x7e64('0x53')]!==_0x7e64('0x54')){logger[_0x7e64('0xd')](_0x7e64('0x55'),_0x7e64('0x45'));_0x6170d6[_0x7e64('0x56')]=util['format'](_0x7e64('0x46'),_0x107bc8[_0x7e64('0x42')],_0x6170d6['uniqueid'],md5(_0x6170d6['uniqueid']));}headers[_0x7e64('0x48')]=getAuth(_0x107bc8);return getUser(_0x107bc8,_0xfc825[_0x7e64('0x22')])[_0x7e64('0x1c')](function(_0x31874c){_0x2e71d5=_0x31874c;logger[_0x7e64('0xd')](_0x7e64('0x49'),_0x2e71d5['id']);return getEndUser(_0x107bc8,_0x6170d6[_0x7e64('0x57')],_0x6170d6[_0x7e64('0x58')]);})[_0x7e64('0x1c')](function(_0x4e9c45){_0x3de77f=_0x4e9c45;logger[_0x7e64('0xd')]('The\x20Enduser\x20ID\x20is:',_0x3de77f['id']);return getTicket(_0x107bc8,_0x2e71d5,_0x3de77f,_0x255fc8,_0x6170d6);})[_0x7e64('0x1c')](function(_0x6c0859){if(_0x6c0859&&_0x6c0859['id']){logger['info'](_0x7e64('0x4b'));logger[_0x7e64('0xd')](_0x7e64('0x4c'),_0x6c0859['id']);logger['info'](_0x7e64('0x55'),_0x7e64('0x4d'));emit(util[_0x7e64('0xf')](_0x7e64('0x59'),_0xfc825['name']),_0x7e64('0x4e'),{'uri':util[_0x7e64('0xf')](_0x7e64('0x4f'),_0x107bc8[_0x7e64('0x1b')],_0x6c0859['id'])});}})[_0x7e64('0x50')](function(_0x25544e){logger[_0x7e64('0x51')]('[OUTBOUND]',JSON[_0x7e64('0x31')](_0x25544e));});};exports[_0x7e64('0x5a')]=function(_0x432c3c,_0x4d819c,_0xa6ac3d,_0x2a950e,_0x3d3846,_0x5c80cb){var _0x3e1100,_0x182bc9;_0x5c80cb[_0x7e64('0x1b')]=intUtil[_0x7e64('0x41')](_0x5c80cb[_0x7e64('0x1b')]);_0x5c80cb[_0x7e64('0x42')]=intUtil['stripTrailingSlash'](_0x5c80cb[_0x7e64('0x42')]);if(_0x3d3846&&_0x3d3846[_0x7e64('0x43')]){logger[_0x7e64('0xd')]('['+_0x4d819c['lastevent']['toUpperCase']()+']',_0x7e64('0x45'));_0x4d819c[_0x7e64('0x56')]=util[_0x7e64('0xf')](_0x7e64('0x46'),_0x5c80cb[_0x7e64('0x42')],_0x4d819c[_0x7e64('0x47')],md5(_0x4d819c['uniqueid']));}else{_0x4d819c[_0x7e64('0x56')]='';}headers[_0x7e64('0x48')]=getAuth(_0x5c80cb);return getUser(_0x5c80cb,'')['then'](function(_0x42259a){_0x3e1100=_0x42259a;logger[_0x7e64('0xd')]('The\x20User\x20ID\x20is:',_0x3e1100['id']);return getEndUser(_0x5c80cb,_0x4d819c['calleridname'],_0x4d819c[_0x7e64('0x12')]);})[_0x7e64('0x1c')](function(_0x2fa8fb){_0x182bc9=_0x2fa8fb;logger[_0x7e64('0xd')](_0x7e64('0x4a'),_0x182bc9['id']);return getTicket(_0x5c80cb,_0x3e1100,_0x182bc9,_0xa6ac3d,_0x4d819c);})['then'](function(_0x5ea245){if(_0x5ea245){logger[_0x7e64('0xd')](_0x7e64('0x4b'));logger['info'](_0x7e64('0x4c'),_0x5ea245['id']);}})[_0x7e64('0x50')](function(_0x561ccb){logger[_0x7e64('0x51')]('['+_0x4d819c[_0x7e64('0x5b')][_0x7e64('0x5c')]()+']',JSON['stringify'](_0x561ccb));});}; \ No newline at end of file +var _0xcec8=['destcalleridnum','The\x20Ticket\x20ID\x20is:','trigger:browser:url','%s/helpdesk/tickets/%d','calleridname','toUpperCase','lodash','request-promise','md5','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridnum','getString','Subjects','
','Tags','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','format','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','apiKey','toString','base64','debug','stringify','defaults','map','includes','string','type','nameField','customField','toLowerCase','content','idField','push','variable','variableName','Variable','queue','serverUrl','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20Enduser\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname'];(function(_0x309fb3,_0x1614e1){var _0x582a21=function(_0x298e18){while(--_0x298e18){_0x309fb3['push'](_0x309fb3['shift']());}};_0x582a21(++_0x1614e1);}(_0xcec8,0xba));var _0x8cec=function(_0x289891,_0x49a0fa){_0x289891=_0x289891-0x0;var _0x31cf2e=_0xcec8[_0x289891];return _0x31cf2e;};'use strict';var _=require(_0x8cec('0x0'));var rp=require(_0x8cec('0x1'));var md5=require(_0x8cec('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x8cec('0x3'));var config=require(_0x8cec('0x4'));var logger=require(_0x8cec('0x5'))(_0x8cec('0x6'));config[_0x8cec('0x7')]=_['defaults'](config['redis'],{'host':_0x8cec('0x8'),'port':0x18eb});var io=require(_0x8cec('0x9'))(new Redis(config[_0x8cec('0x7')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0xb0942e,_0x3bd231,_0xf81390){io['to'](_0xb0942e)[_0x8cec('0xa')](_0x3bd231,_0xf81390);}function getTicket(_0x6a0c1e,_0x13d5cd,_0x2ec031,_0x3cefe8,_0x129237){logger[_0x8cec('0xb')](_0x8cec('0xc'));var _0x34178f=_[_0x8cec('0xd')]({'responder_id':_0x13d5cd['id'],'requester_id':_0x2ec031['id'],'name':util['format'](_0x8cec('0xe'),_0x129237['calleridname']),'phone':_0x129237[_0x8cec('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x8cec('0x10')](_0x3cefe8[_0x8cec('0x11')],_0x129237,'\x20'),'description':intUtil[_0x8cec('0x10')](_0x3cefe8['Descriptions'],_0x129237,_0x8cec('0x12')),'tags':getTags(_0x3cefe8[_0x8cec('0x13')],_0x8cec('0x14'))},getCustomFields(_0x3cefe8[_0x8cec('0x15')],_0x129237));_0x34178f[_0x8cec('0x16')]=_[_0x8cec('0x17')](_['keyBy'](_0x34178f[_0x8cec('0x16')],'id'),_0x8cec('0x18'));return request({'uri':util['format'](_0x8cec('0x19'),_0x6a0c1e[_0x8cec('0x1a')]),'method':_0x8cec('0x1b'),'body':_0x34178f})[_0x8cec('0x1c')](function(_0x1b09a){logger[_0x8cec('0xb')](_0x8cec('0x1d'));return _0x1b09a;});}function getUser(_0x1c254e,_0x437536){if(intUtil[_0x8cec('0x1e')](_0x437536)){return request({'uri':util['format'](_0x8cec('0x1f'),_0x1c254e[_0x8cec('0x1a')]),'qs':{'email':_0x437536}})['then'](function(_0xafe076){if(_0xafe076[_0x8cec('0x20')]){logger[_0x8cec('0xb')]('Agent\x20found!');return _[_0x8cec('0x21')](_0xafe076,function(_0x208a59){return _0x208a59[_0x8cec('0x22')][_0x8cec('0x23')]===_0x437536;});}else{logger[_0x8cec('0xb')](_0x8cec('0x24'));return request({'uri':util[_0x8cec('0x25')](_0x8cec('0x26'),_0x1c254e['remoteUri'])})[_0x8cec('0x1c')](function(_0x52d9af){logger['info'](_0x8cec('0x27'));return _0x52d9af;});}});}else{logger[_0x8cec('0xb')](_0x8cec('0x28'));return request({'uri':util[_0x8cec('0x25')](_0x8cec('0x26'),_0x1c254e['remoteUri'])})['then'](function(_0x5bef36){logger[_0x8cec('0xb')](_0x8cec('0x27'));return _0x5bef36;});}}function getEndUser(_0x5ba58d,_0x66828b,_0x143d7d){logger[_0x8cec('0xb')](_0x8cec('0x29'),_0x143d7d);return request({'uri':util[_0x8cec('0x25')](_0x8cec('0x2a'),_0x5ba58d[_0x8cec('0x1a')]),'qs':{'phone':_0x143d7d}})[_0x8cec('0x1c')](function(_0x4e36fd){if(_0x4e36fd[_0x8cec('0x20')]){logger['info'](_0x8cec('0x2b'));return _[_0x8cec('0x21')](_0x4e36fd,{'phone':_0x143d7d});}else{logger[_0x8cec('0xb')](_0x8cec('0x2c'));return request({'uri':util[_0x8cec('0x25')](_0x8cec('0x2a'),_0x5ba58d[_0x8cec('0x1a')]),'method':_0x8cec('0x1b'),'body':{'name':_0x66828b,'phone':_0x143d7d}})[_0x8cec('0x1c')](function(_0x221d28){logger['info']('Enduser\x20created.');return _0x221d28;});}});}function getAuth(_0x4a0953){return util[_0x8cec('0x25')]('Basic\x20%s',new Buffer(_0x4a0953[_0x8cec('0x2d')]+':X')[_0x8cec('0x2e')](_0x8cec('0x2f')));}function request(_0x136963){logger[_0x8cec('0x30')]('[HTTP]',JSON[_0x8cec('0x31')](_0x136963));return rp(_[_0x8cec('0x32')](_0x136963,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x42ae43,_0x286b08){var _0x4970fe=[];if(_0x42ae43&&_0x42ae43['length']>0x0){_0x4970fe=_[_0x8cec('0x33')](_0x42ae43,_0x286b08);}return _0x4970fe;}function getCustomFields(_0x44d047,_0x3cffb3){var _0x4356bf=[];var _0x4eed9c={'custom_fields':[]};if(_0x44d047[_0x8cec('0x20')]>0x0){_['forEach'](_0x44d047,function(_0x1acc49){if(_[_0x8cec('0x34')]([_0x8cec('0x35'),'picklist'],_0x1acc49[_0x8cec('0x36')])&&_0x1acc49[_0x8cec('0x37')]&&!_0x1acc49[_0x8cec('0x38')]){_0x4eed9c[_0x1acc49[_0x8cec('0x37')][_0x8cec('0x39')]()]=_0x1acc49[_0x8cec('0x3a')][_0x8cec('0x2e')]();}else if(_[_0x8cec('0x34')]([_0x8cec('0x35'),'picklist'],_0x1acc49['type'])&&_0x1acc49[_0x8cec('0x3b')]&&_0x1acc49[_0x8cec('0x38')]){_0x4eed9c[_0x8cec('0x16')][_0x8cec('0x3c')]({'id':_0x1acc49[_0x8cec('0x3b')],'value':_0x1acc49['content'][_0x8cec('0x2e')]()});}else if(_0x1acc49[_0x8cec('0x36')]===_0x8cec('0x3d')&&_0x1acc49['variableName']&&_0x1acc49[_0x8cec('0x3b')]&&_0x1acc49[_0x8cec('0x38')]){_0x3cffb3[_0x1acc49[_0x8cec('0x3e')]]&&_0x4eed9c['custom_fields'][_0x8cec('0x3c')]({'id':_0x1acc49[_0x8cec('0x3b')],'value':_0x3cffb3[_0x1acc49['variableName']][_0x8cec('0x2e')]()});}else if(_0x1acc49[_0x8cec('0x36')]==='customVariable'&&_0x1acc49[_0x8cec('0x3f')]&&_0x1acc49['Variable'][_0x8cec('0x14')]&&_0x1acc49['idField']&&_0x1acc49[_0x8cec('0x38')]){_0x3cffb3[_0x1acc49[_0x8cec('0x3f')][_0x8cec('0x14')]['toLowerCase']()]&&_0x4eed9c['custom_fields'][_0x8cec('0x3c')]({'id':_0x1acc49[_0x8cec('0x3b')],'value':_0x3cffb3[_0x1acc49['Variable'][_0x8cec('0x14')][_0x8cec('0x39')]()][_0x8cec('0x2e')]()});}});}return _0x4eed9c;}exports[_0x8cec('0x40')]=function(_0x4f16f5,_0x5dbde1,_0x4ae9b9,_0x21a4fe,_0x326a4f,_0x2f5e63){var _0x4053e2,_0x15b0b7;_0x2f5e63['remoteUri']=intUtil['stripTrailingSlash'](_0x2f5e63[_0x8cec('0x1a')]);_0x2f5e63[_0x8cec('0x41')]=intUtil['stripTrailingSlash'](_0x2f5e63['serverUrl']);if(_0x326a4f&&_0x326a4f['monitor_format']){logger[_0x8cec('0xb')]('[QUEUE]',_0x8cec('0x42'));_0x5dbde1['recordingURL']=util['format'](_0x8cec('0x43'),_0x2f5e63[_0x8cec('0x41')],_0x5dbde1[_0x8cec('0x44')],md5(_0x5dbde1[_0x8cec('0x44')]));}else{_0x5dbde1[_0x8cec('0x45')]='';}headers[_0x8cec('0x46')]=getAuth(_0x2f5e63);return getUser(_0x2f5e63,_0x21a4fe[_0x8cec('0x23')])['then'](function(_0x1d7ef6){_0x4053e2=_0x1d7ef6;logger[_0x8cec('0xb')]('The\x20User\x20ID\x20is:',_0x4053e2['id']);return getEndUser(_0x2f5e63,_0x5dbde1['calleridname'],_0x5dbde1['calleridnum']);})['then'](function(_0x5f4b10){_0x15b0b7=_0x5f4b10;logger[_0x8cec('0xb')](_0x8cec('0x47'),_0x15b0b7['id']);return getTicket(_0x2f5e63,_0x4053e2,_0x15b0b7,_0x4ae9b9,_0x5dbde1);})[_0x8cec('0x1c')](function(_0x277936){if(_0x277936&&_0x277936['id']){logger[_0x8cec('0xb')](_0x8cec('0x1d'));logger[_0x8cec('0xb')]('The\x20Ticket\x20ID\x20is:',_0x277936['id']);logger[_0x8cec('0xb')](_0x8cec('0x48'),_0x8cec('0x49'));emit(util[_0x8cec('0x25')](_0x8cec('0x4a'),_0x21a4fe[_0x8cec('0x14')]),'trigger:browser:url',{'uri':util['format']('%s/helpdesk/tickets/%d',_0x2f5e63[_0x8cec('0x1a')],_0x277936['id'])});}})[_0x8cec('0x4b')](function(_0x19e817){logger[_0x8cec('0x4c')](_0x8cec('0x48'),JSON['stringify'](_0x19e817));});};exports[_0x8cec('0x4d')]=function(_0x53917b,_0x54da53,_0x1e1d3c,_0x5edc77,_0x43a6b5,_0x1761f3,_0x300928){var _0x4aa8b8,_0x2219d5;_0x1761f3[_0x8cec('0x1a')]=intUtil[_0x8cec('0x4e')](_0x1761f3[_0x8cec('0x1a')]);_0x1761f3[_0x8cec('0x41')]=intUtil[_0x8cec('0x4e')](_0x1761f3[_0x8cec('0x41')]);if(_0x300928&&_0x300928[_0x8cec('0x4f')]&&_0x300928[_0x8cec('0x4f')]!==_0x8cec('0x50')){logger['info'](_0x8cec('0x51'),_0x8cec('0x42'));_0x54da53[_0x8cec('0x45')]=util[_0x8cec('0x25')](_0x8cec('0x43'),_0x1761f3[_0x8cec('0x41')],_0x54da53['uniqueid'],md5(_0x54da53['uniqueid']));}headers[_0x8cec('0x46')]=getAuth(_0x1761f3);return getUser(_0x1761f3,_0x5edc77[_0x8cec('0x23')])[_0x8cec('0x1c')](function(_0x28b252){_0x4aa8b8=_0x28b252;logger[_0x8cec('0xb')](_0x8cec('0x52'),_0x4aa8b8['id']);return getEndUser(_0x1761f3,_0x54da53[_0x8cec('0x53')],_0x54da53[_0x8cec('0x54')]);})[_0x8cec('0x1c')](function(_0x260c4d){_0x2219d5=_0x260c4d;logger['info'](_0x8cec('0x47'),_0x2219d5['id']);return getTicket(_0x1761f3,_0x4aa8b8,_0x2219d5,_0x1e1d3c,_0x54da53);})[_0x8cec('0x1c')](function(_0x346462){if(_0x346462&&_0x346462['id']){logger['info'](_0x8cec('0x1d'));logger[_0x8cec('0xb')](_0x8cec('0x55'),_0x346462['id']);logger[_0x8cec('0xb')]('[OUTBOUND]',_0x8cec('0x49'));emit(util[_0x8cec('0x25')]('user:%s',_0x5edc77[_0x8cec('0x14')]),_0x8cec('0x56'),{'uri':util[_0x8cec('0x25')](_0x8cec('0x57'),_0x1761f3[_0x8cec('0x1a')],_0x346462['id'])});}})[_0x8cec('0x4b')](function(_0x2b8766){logger['error'](_0x8cec('0x51'),JSON[_0x8cec('0x31')](_0x2b8766));});};exports['unmanaged']=function(_0x38126d,_0x3ad1b0,_0x4531ed,_0x6358b5,_0x49df16,_0x263653){var _0x235337,_0x279069;_0x263653[_0x8cec('0x1a')]=intUtil[_0x8cec('0x4e')](_0x263653[_0x8cec('0x1a')]);_0x263653[_0x8cec('0x41')]=intUtil[_0x8cec('0x4e')](_0x263653['serverUrl']);if(_0x49df16&&_0x49df16['monitor_format']){logger[_0x8cec('0xb')]('['+_0x3ad1b0['lastevent']['toUpperCase']()+']',_0x8cec('0x42'));_0x3ad1b0[_0x8cec('0x45')]=util[_0x8cec('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x263653['serverUrl'],_0x3ad1b0['uniqueid'],md5(_0x3ad1b0['uniqueid']));}else{_0x3ad1b0[_0x8cec('0x45')]='';}headers['Authorization']=getAuth(_0x263653);return getUser(_0x263653,'')[_0x8cec('0x1c')](function(_0x4115b1){_0x235337=_0x4115b1;logger['info']('The\x20User\x20ID\x20is:',_0x235337['id']);return getEndUser(_0x263653,_0x3ad1b0[_0x8cec('0x58')],_0x3ad1b0[_0x8cec('0xf')]);})[_0x8cec('0x1c')](function(_0x38b735){_0x279069=_0x38b735;logger[_0x8cec('0xb')](_0x8cec('0x47'),_0x279069['id']);return getTicket(_0x263653,_0x235337,_0x279069,_0x4531ed,_0x3ad1b0);})['then'](function(_0x6fab62){if(_0x6fab62){logger[_0x8cec('0xb')]('Ticket\x20created!');logger[_0x8cec('0xb')](_0x8cec('0x55'),_0x6fab62['id']);}})[_0x8cec('0x4b')](function(_0x5cb669){logger[_0x8cec('0x4c')]('['+_0x3ad1b0['lastevent'][_0x8cec('0x59')]()+']',JSON[_0x8cec('0x31')](_0x5cb669));});}; \ 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 762a6fd..4ca2bad 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 _0x311b=['localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','toUpperCase','message','Getting\x20user\x20list','then','Getting\x20user\x20with\x20email','userEmail','agentEmail','userId','User\x20found:','catch','error','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20work_number:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','getString','Descriptions','Contact','add','YYYY-MM-DDTHH:mm:ss','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis'];(function(_0xa641ee,_0x39b6cd){var _0x5c4259=function(_0x4d6730){while(--_0x4d6730){_0xa641ee['push'](_0xa641ee['shift']());}};_0x5c4259(++_0x39b6cd);}(_0x311b,0x1e8));var _0xb311=function(_0x1587ed,_0x1dc60f){_0x1587ed=_0x1587ed-0x0;var _0x342bd4=_0x311b[_0x1587ed];return _0x342bd4;};'use strict';var _=require('lodash');var rp=require(_0xb311('0x0'));var md5=require(_0xb311('0x1'));var util=require('util');var moment=require(_0xb311('0x2'));var Promise=require(_0xb311('0x3'));var Redis=require('ioredis');var intUtil=require(_0xb311('0x4'));var config=require(_0xb311('0x5'));var logger=require(_0xb311('0x6'))(_0xb311('0x7'));config['redis']=_[_0xb311('0x8')](config[_0xb311('0x9')],{'host':_0xb311('0xa'),'port':0x18eb});var io=require(_0xb311('0xb'))(new Redis(config[_0xb311('0x9')]));function getAdminId(_0x1ff28d,_0x42ee8d,_0x4f7502,_0x2d33db){return new Promise(function(_0x4b73aa,_0x4392c5){var _0x5f5aed=![];var _0xa1cf9={'method':_0xb311('0xc'),'uri':_0x2d33db+_0xb311('0xd'),'json':!![]};_0xa1cf9[_0xb311('0xe')]=_0x4f7502;logger[_0xb311('0xf')]('Getting\x20admin\x20information');return rp(_0xa1cf9)['then'](function(_0x24df59){if(_0x24df59){var _0x394a0e=_0x24df59[_0xb311('0x10')];var _0x8a0ba9=null;for(_0x8a0ba9=0x0;_0x8a0ba9<_0x394a0e[_0xb311('0x11')];_0x8a0ba9++){if(_0x394a0e[_0x8a0ba9][_0xb311('0x12')]===_0x1ff28d[_0xb311('0x13')]){_0x1ff28d[_0xb311('0x14')]=_0x394a0e[_0x8a0ba9]['id'];_0x5f5aed=!![];}}if(_0x5f5aed){logger[_0xb311('0xf')](_0xb311('0x15'),_0x1ff28d['adminId']);_0x4b73aa(_0x1ff28d);}else{_0x4392c5({'statusCode':0x194,'message':_0xb311('0x16')});}}else{_0x4392c5({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x109f77){logger['error']('['+[_0x42ee8d[_0xb311('0x17')]()]+']',_0x109f77[_0xb311('0x18')]);_0x4392c5(_0x109f77);});});}function getUser(_0x36e29f,_0x20fa84,_0x32414a){return function(_0x4437b8){return new Promise(function(_0x604f44,_0x1a6003){var _0x443248={'method':_0xb311('0xc'),'uri':_0x32414a+_0xb311('0xd'),'json':!![]};_0x443248[_0xb311('0xe')]=_0x20fa84;logger[_0xb311('0xf')](_0xb311('0x19'));return rp(_0x443248)[_0xb311('0x1a')](function(_0x4b16bb){if(_0x4b16bb){var _0x2f320d=_0x4b16bb[_0xb311('0x10')];var _0x34f6cd=![];var _0x3316af=null;if(_0x4437b8['agentEmail']!==null){logger['info'](_0xb311('0x1b'),_0x4437b8['agentEmail']);_0x4437b8[_0xb311('0x1c')]=_0x4437b8[_0xb311('0x1d')];for(_0x3316af=0x0;_0x3316af<_0x2f320d[_0xb311('0x11')];_0x3316af++){if(_0x2f320d[_0x3316af][_0xb311('0x12')]===_0x4437b8[_0xb311('0x1d')]){_0x34f6cd=!![];_0x4437b8[_0xb311('0x1e')]=_0x2f320d[_0x3316af]['id'];logger[_0xb311('0xf')](_0xb311('0x1f'),_0x4437b8[_0xb311('0x1e')]);}}}if(!_0x34f6cd){logger[_0xb311('0xf')]('Admin\x20selected');_0x4437b8[_0xb311('0x1c')]=_0x4437b8['adminEmail'];_0x4437b8[_0xb311('0x1e')]=_0x4437b8['adminId'];_0x34f6cd=!![];}if(_0x34f6cd){_0x604f44(_0x4437b8);}else{_0x1a6003({'statusCode':0x194,'message':_0xb311('0x16')});}}else{_0x1a6003({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xb311('0x20')](function(_0x28d8ba){logger[_0xb311('0x21')]('['+[_0x36e29f['toUpperCase']()]+']',_0x28d8ba['message']);_0x1a6003(_0x28d8ba);});});};}function searchContact(_0x37632a,_0x3e7e94,_0x3d839d,_0x3dbc0b){return new Promise(function(_0x13064b,_0x20abf3){var _0x365988={'method':_0xb311('0xc'),'headers':_0x3e7e94,'uri':_0x37632a+_0xb311('0x22')+_0x3dbc0b+_0xb311('0x23')+_0x3d839d+_0xb311('0x24'),'json':!![]};rp(_0x365988)[_0xb311('0x1a')](function(_0x9547bb){var _0x4208a1=_[_0xb311('0x25')](_0x9547bb[_0xb311('0x26')]['contacts'],[_0x3d839d,_0x3dbc0b]);_0x13064b(_0x4208a1);})[_0xb311('0x20')](function(_0x8ee809){_0x20abf3(_0x8ee809);});});}function getEndUser(_0x4ad508,_0x3548ec,_0x290d8b){return function(_0x476c99){return new Promise(function(_0x7fecc3,_0x348071){logger['info'](util[_0xb311('0x27')](_0xb311('0x28'),_0x476c99[_0xb311('0x29')]));searchContact(_0x290d8b,_0x3548ec,'mobile_number',_0x476c99[_0xb311('0x29')])[_0xb311('0x1a')](function(_0x198e09){if(_0x198e09){_0x476c99[_0xb311('0x2a')]=_0x198e09['id'];logger[_0xb311('0xf')]('Contact\x20found\x20mobile_number:',_0x476c99[_0xb311('0x2a')]);return _0x7fecc3(_0x476c99);}searchContact(_0x290d8b,_0x3548ec,'work_number',_0x476c99[_0xb311('0x29')])[_0xb311('0x1a')](function(_0x2bb376){if(_0x2bb376){_0x476c99[_0xb311('0x2a')]=_0x2bb376['id'];logger[_0xb311('0xf')](_0xb311('0x2b'),_0x476c99['endUserId']);return _0x7fecc3(_0x476c99);}createEndUser(_0x476c99,_0x4ad508,_0x3548ec,_0x290d8b)['then'](function(_0x5e1d06){logger[_0xb311('0xf')]('Contact\x20created:',_0x5e1d06[_0xb311('0x2a')]);return _0x7fecc3(_0x5e1d06);});});})[_0xb311('0x20')](function(_0x49ae88){_0x348071(_0x49ae88);});});};}function createEndUser(_0x27b371,_0xd18fa5,_0x5bd68f,_0x3090de){return new Promise(function(_0x2a212a,_0x5228c7){var _0x570f4a=moment();var _0x5a38cf={'method':_0xb311('0x2c'),'uri':_0x3090de+_0xb311('0x2d'),'body':{'contact':{'last_name':_0x27b371['contactNumber'],'work_number':_0x27b371[_0xb311('0x29')],'mobile_number':_0x27b371[_0xb311('0x29')],'owner_id':_0x27b371['userId'],'created_at':_0x570f4a[_0xb311('0x27')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x5a38cf[_0xb311('0xe')]=_0x5bd68f;logger['info'](_0xb311('0x2e'));return rp(_0x5a38cf)[_0xb311('0x1a')](function(_0x2110df){_0x27b371['endUserId']=_0x2110df['contact']['id'];_0x2a212a(_0x27b371);})['catch'](function(_0x488e28){logger['error']('['+[_0xd18fa5['toUpperCase']()]+']',_0x488e28[_0xb311('0x18')]);_0x5228c7(_0x488e28['message']);});});}function getTicket(_0x4e760d,_0x466801,_0x53d1e8,_0x1172de,_0x1faafe){return function(_0x43f2cc){logger['info'](_0xb311('0x2f'));return new Promise(function(_0x49a7d7,_0x306446){var _0x1a2296=moment();var _0x1c5f3e={'method':_0xb311('0x2c'),'uri':_0x53d1e8+'/api/tasks','body':{'title':intUtil[_0xb311('0x30')](_0x1172de['Subjects'],_0x1faafe,'\x20'),'description':intUtil[_0xb311('0x30')](_0x1172de[_0xb311('0x31')],_0x1faafe,'\x0a'),'owner_id':_0x43f2cc[_0xb311('0x1e')],'creater_id':_0x43f2cc[_0xb311('0x14')],'targetable_id':_0x43f2cc[_0xb311('0x2a')],'targetable_type':_0xb311('0x32'),'created_at':_0x1a2296[_0xb311('0x27')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x1a2296[_0xb311('0x33')](0x1e,'m')['format'](_0xb311('0x34'))},'json':!![]};_0x1c5f3e[_0xb311('0xe')]=_0x466801;return rp(_0x1c5f3e)['then'](function(_0x3946bf){_0x43f2cc[_0xb311('0x35')]=_0x3946bf[_0xb311('0x36')]['id'];logger[_0xb311('0xf')]('Task\x20created:',_0x43f2cc[_0xb311('0x35')]);_0x49a7d7(_0x43f2cc);})[_0xb311('0x20')](function(_0x354c16){logger[_0xb311('0x21')]('['+[_0x4e760d[_0xb311('0x17')]()]+']',_0x354c16[_0xb311('0x18')]);_0x306446(_0x354c16['message']);});});};}function emit(_0x50e26f,_0x4dd365,_0x5f3200){var _0x7e6caf={'uri':_0x50e26f+_0xb311('0x37')+_0x5f3200};io['to'](util['format'](_0xb311('0x38'),_0x4dd365))[_0xb311('0x39')](_0xb311('0x3a'),_0x7e6caf);}exports['cs']=function(_0x209fd2,_0x413a8b,_0xd1238e,_0x5bc9a3,_0x469f34,_0x1b882f,_0x4b09c3,_0xd8a9e){var _0x57412b={};var _0x467798={'Authorization':_0xb311('0x3b')+_0x1b882f[_0xb311('0x3c')]};_0x1b882f[_0xb311('0x3d')]=intUtil['stripTrailingSlash'](_0x1b882f['remoteUri']);_0x1b882f[_0xb311('0x3e')]=intUtil['stripTrailingSlash'](_0x1b882f['serverUrl']);var _0x52d1dc=_0x1b882f['remoteUri'];_0x57412b['adminEmail']=_0x1b882f['username'];_0x57412b['contactNumber']=_0xd8a9e[_0xb311('0x3f')]()===_0xb311('0x40')?_0x413a8b[_0xb311('0x41')]:_0x413a8b[_0xb311('0x42')];_0x57412b[_0xb311('0x43')]=_0xd8a9e===_0xb311('0x44')||_0xd8a9e===_0xb311('0x45')?_0xb311('0x44'):_0xb311('0x40');if(_0x5bc9a3){_0x57412b[_0xb311('0x1d')]=_0x5bc9a3['email'];}var _0x29c4bb=util[_0xb311('0x27')](_0xb311('0x46'),_0x1b882f['serverUrl'],_0x413a8b[_0xb311('0x47')],md5(_0x413a8b[_0xb311('0x47')]));if(_0x469f34&&_0x469f34[_0xb311('0x48')]){logger[_0xb311('0xf')](_0xb311('0x49'),_0xb311('0x4a'));_0x413a8b['recordingURL']=_0x29c4bb;}else if(_0x4b09c3&&_0x4b09c3[_0xb311('0x4b')]&&_0x4b09c3[_0xb311('0x4b')]!==_0xb311('0x4c')){logger[_0xb311('0xf')](_0xb311('0x4d'),'Recording\x20is\x20enabled!');_0x413a8b[_0xb311('0x4e')]=_0x29c4bb;}else{_0x413a8b[_0xb311('0x4e')]='';}return getAdminId(_0x57412b,_0xd8a9e,_0x467798,_0x52d1dc)[_0xb311('0x1a')](getUser(_0xd8a9e,_0x467798,_0x52d1dc))['then'](getEndUser(_0xd8a9e,_0x467798,_0x52d1dc))[_0xb311('0x1a')](getTicket(_0xd8a9e,_0x467798,_0x52d1dc,_0xd1238e,_0x413a8b))['then'](function(_0x319765){logger[_0xb311('0xf')](util[_0xb311('0x27')](_0xb311('0x4f'),_0x319765[_0xb311('0x35')]));if(_0xd8a9e!==_0xb311('0x45')){logger[_0xb311('0xf')]('['+[_0xd8a9e[_0xb311('0x17')]()]+']',_0xb311('0x50'));emit(_0x52d1dc,_0x5bc9a3['name'],_0x319765[_0xb311('0x2a')]);}})[_0xb311('0x20')](function(_0x3694b5){logger[_0xb311('0x21')]('['+[_0xd8a9e['toUpperCase']()]+_0xb311('0x51'),util[_0xb311('0x52')](_0x3694b5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xee9a=['Task\x20created:','/contacts/','user:%s','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','util','moment','bluebird','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','userId','Admin\x20selected','/api/lookup?q=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','add','ticketId','task'];(function(_0x49d764,_0x2937f3){var _0x5d8917=function(_0x68c39f){while(--_0x68c39f){_0x49d764['push'](_0x49d764['shift']());}};_0x5d8917(++_0x2937f3);}(_0xee9a,0x70));var _0xaee9=function(_0x147285,_0x3f4f58){_0x147285=_0x147285-0x0;var _0x4cb53c=_0xee9a[_0x147285];return _0x4cb53c;};'use strict';var _=require(_0xaee9('0x0'));var rp=require(_0xaee9('0x1'));var md5=require('md5');var util=require(_0xaee9('0x2'));var moment=require(_0xaee9('0x3'));var Promise=require(_0xaee9('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xaee9('0x5'));var logger=require(_0xaee9('0x6'))(_0xaee9('0x7'));config['redis']=_[_0xaee9('0x8')](config[_0xaee9('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xaee9('0xa'))(new Redis(config['redis']));function getAdminId(_0x3fe83d,_0x263a5b,_0x3007a8,_0x54ddc9){return new Promise(function(_0x4f2b7d,_0x4fbaf1){var _0xb8f589=![];var _0x44e755={'method':'GET','uri':_0x54ddc9+_0xaee9('0xb'),'json':!![]};_0x44e755[_0xaee9('0xc')]=_0x3007a8;logger[_0xaee9('0xd')](_0xaee9('0xe'));return rp(_0x44e755)[_0xaee9('0xf')](function(_0x599c07){if(_0x599c07){var _0x3ea42c=_0x599c07[_0xaee9('0x10')];var _0x2a133a=null;for(_0x2a133a=0x0;_0x2a133a<_0x3ea42c[_0xaee9('0x11')];_0x2a133a++){if(_0x3ea42c[_0x2a133a][_0xaee9('0x12')]===_0x3fe83d[_0xaee9('0x13')]){_0x3fe83d[_0xaee9('0x14')]=_0x3ea42c[_0x2a133a]['id'];_0xb8f589=!![];}}if(_0xb8f589){logger[_0xaee9('0xd')](_0xaee9('0x15'),_0x3fe83d[_0xaee9('0x14')]);_0x4f2b7d(_0x3fe83d);}else{_0x4fbaf1({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4fbaf1({'statusCode':0x194,'message':_0xaee9('0x16')});}})[_0xaee9('0x17')](function(_0x2ccf7e){logger[_0xaee9('0x18')]('['+[_0x263a5b[_0xaee9('0x19')]()]+']',_0x2ccf7e[_0xaee9('0x1a')]);_0x4fbaf1(_0x2ccf7e);});});}function getUser(_0x359b6a,_0x5f5636,_0x23d2c1){return function(_0x7e4f31){return new Promise(function(_0x1944d4,_0x2b7a2c){var _0x5e4187={'method':_0xaee9('0x1b'),'uri':_0x23d2c1+_0xaee9('0xb'),'json':!![]};_0x5e4187[_0xaee9('0xc')]=_0x5f5636;logger[_0xaee9('0xd')]('Getting\x20user\x20list');return rp(_0x5e4187)[_0xaee9('0xf')](function(_0x241fa2){if(_0x241fa2){var _0x134e95=_0x241fa2[_0xaee9('0x10')];var _0x15b7b3=![];var _0xa95618=null;if(_0x7e4f31[_0xaee9('0x1c')]!==null){logger[_0xaee9('0xd')](_0xaee9('0x1d'),_0x7e4f31[_0xaee9('0x1c')]);_0x7e4f31[_0xaee9('0x1e')]=_0x7e4f31[_0xaee9('0x1c')];for(_0xa95618=0x0;_0xa95618<_0x134e95[_0xaee9('0x11')];_0xa95618++){if(_0x134e95[_0xa95618][_0xaee9('0x12')]===_0x7e4f31['agentEmail']){_0x15b7b3=!![];_0x7e4f31['userId']=_0x134e95[_0xa95618]['id'];logger[_0xaee9('0xd')](_0xaee9('0x1f'),_0x7e4f31[_0xaee9('0x20')]);}}}if(!_0x15b7b3){logger[_0xaee9('0xd')](_0xaee9('0x21'));_0x7e4f31[_0xaee9('0x1e')]=_0x7e4f31[_0xaee9('0x13')];_0x7e4f31['userId']=_0x7e4f31['adminId'];_0x15b7b3=!![];}if(_0x15b7b3){_0x1944d4(_0x7e4f31);}else{_0x2b7a2c({'statusCode':0x194,'message':_0xaee9('0x16')});}}else{_0x2b7a2c({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xaee9('0x17')](function(_0xaacdd8){logger[_0xaee9('0x18')]('['+[_0x359b6a['toUpperCase']()]+']',_0xaacdd8[_0xaee9('0x1a')]);_0x2b7a2c(_0xaacdd8);});});};}function searchContact(_0x39749c,_0xa9f625,_0x194fd9,_0x3dbd53){return new Promise(function(_0x2b3957,_0x33b6bd){var _0x34127c={'method':_0xaee9('0x1b'),'headers':_0xa9f625,'uri':_0x39749c+_0xaee9('0x22')+_0x3dbd53+'&f='+_0x194fd9+_0xaee9('0x23'),'json':!![]};rp(_0x34127c)[_0xaee9('0xf')](function(_0x35f1a7){var _0x5eccb4=_['find'](_0x35f1a7[_0xaee9('0x24')][_0xaee9('0x24')],[_0x194fd9,_0x3dbd53]);_0x2b3957(_0x5eccb4);})[_0xaee9('0x17')](function(_0x127be4){_0x33b6bd(_0x127be4);});});}function getEndUser(_0x3f74c1,_0x3f36dd,_0x14cf98){return function(_0x251f02){return new Promise(function(_0x13696d,_0x29029c){logger['info'](util[_0xaee9('0x25')](_0xaee9('0x26'),_0x251f02['contactNumber']));searchContact(_0x14cf98,_0x3f36dd,_0xaee9('0x27'),_0x251f02[_0xaee9('0x28')])[_0xaee9('0xf')](function(_0x3f6cec){if(_0x3f6cec){_0x251f02[_0xaee9('0x29')]=_0x3f6cec['id'];logger[_0xaee9('0xd')]('Contact\x20found\x20mobile_number:',_0x251f02['endUserId']);return _0x13696d(_0x251f02);}searchContact(_0x14cf98,_0x3f36dd,'work_number',_0x251f02[_0xaee9('0x28')])[_0xaee9('0xf')](function(_0x4c4507){if(_0x4c4507){_0x251f02[_0xaee9('0x29')]=_0x4c4507['id'];logger[_0xaee9('0xd')](_0xaee9('0x2a'),_0x251f02['endUserId']);return _0x13696d(_0x251f02);}createEndUser(_0x251f02,_0x3f74c1,_0x3f36dd,_0x14cf98)['then'](function(_0x2507de){logger[_0xaee9('0xd')]('Contact\x20created:',_0x2507de[_0xaee9('0x29')]);return _0x13696d(_0x2507de);});});})[_0xaee9('0x17')](function(_0x56ca1c){_0x29029c(_0x56ca1c);});});};}function createEndUser(_0xd3a25c,_0x1cc50b,_0xdc3dfb,_0x143d93){return new Promise(function(_0x11fb82,_0x5b4abf){var _0x28828e=moment();var _0x196e38={'method':_0xaee9('0x2b'),'uri':_0x143d93+_0xaee9('0x2c'),'body':{'contact':{'last_name':_0xd3a25c['contactNumber'],'work_number':_0xd3a25c[_0xaee9('0x28')],'mobile_number':_0xd3a25c[_0xaee9('0x28')],'owner_id':_0xd3a25c[_0xaee9('0x20')],'created_at':_0x28828e[_0xaee9('0x25')](_0xaee9('0x2d'))}},'json':!![]};_0x196e38['headers']=_0xdc3dfb;logger[_0xaee9('0xd')](_0xaee9('0x2e'));return rp(_0x196e38)[_0xaee9('0xf')](function(_0x19d1e0){_0xd3a25c[_0xaee9('0x29')]=_0x19d1e0[_0xaee9('0x2f')]['id'];_0x11fb82(_0xd3a25c);})[_0xaee9('0x17')](function(_0x389a9d){logger['error']('['+[_0x1cc50b[_0xaee9('0x19')]()]+']',_0x389a9d['message']);_0x5b4abf(_0x389a9d[_0xaee9('0x1a')]);});});}function getTicket(_0xc7ba44,_0x321fea,_0x50f5b5,_0x1a6b9a,_0x410b34){return function(_0x4e06be){logger['info'](_0xaee9('0x30'));return new Promise(function(_0x1e3b7f,_0x78e528){var _0x2e1163=moment();var _0x39f2c2={'method':_0xaee9('0x2b'),'uri':_0x50f5b5+_0xaee9('0x31'),'body':{'title':intUtil[_0xaee9('0x32')](_0x1a6b9a['Subjects'],_0x410b34,'\x20'),'description':intUtil['getString'](_0x1a6b9a[_0xaee9('0x33')],_0x410b34,'\x0a'),'owner_id':_0x4e06be[_0xaee9('0x20')],'creater_id':_0x4e06be[_0xaee9('0x14')],'targetable_id':_0x4e06be[_0xaee9('0x29')],'targetable_type':_0xaee9('0x34'),'created_at':_0x2e1163[_0xaee9('0x25')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x2e1163[_0xaee9('0x35')](0x1e,'m')['format'](_0xaee9('0x2d'))},'json':!![]};_0x39f2c2[_0xaee9('0xc')]=_0x321fea;return rp(_0x39f2c2)[_0xaee9('0xf')](function(_0x2cba78){_0x4e06be[_0xaee9('0x36')]=_0x2cba78[_0xaee9('0x37')]['id'];logger[_0xaee9('0xd')](_0xaee9('0x38'),_0x4e06be[_0xaee9('0x36')]);_0x1e3b7f(_0x4e06be);})[_0xaee9('0x17')](function(_0x39f404){logger['error']('['+[_0xc7ba44[_0xaee9('0x19')]()]+']',_0x39f404[_0xaee9('0x1a')]);_0x78e528(_0x39f404[_0xaee9('0x1a')]);});});};}function emit(_0x62f43d,_0x45cb70,_0x593cf6){var _0x143fa2={'uri':_0x62f43d+_0xaee9('0x39')+_0x593cf6};io['to'](util[_0xaee9('0x25')](_0xaee9('0x3a'),_0x45cb70))['emit']('trigger:browser:url',_0x143fa2);}exports['cs']=function(_0x2ca39c,_0x2a6e22,_0x1c7542,_0x2e0796,_0x2bee67,_0x362dfe,_0xaa79b,_0x3f8b74){var _0x271273={};var _0x1ed398={'Authorization':_0xaee9('0x3b')+_0x362dfe[_0xaee9('0x3c')]};_0x362dfe['remoteUri']=intUtil[_0xaee9('0x3d')](_0x362dfe[_0xaee9('0x3e')]);_0x362dfe[_0xaee9('0x3f')]=intUtil[_0xaee9('0x3d')](_0x362dfe['serverUrl']);var _0x1b4dce=_0x362dfe[_0xaee9('0x3e')];_0x271273[_0xaee9('0x13')]=_0x362dfe[_0xaee9('0x40')];_0x271273['contactNumber']=_0x3f8b74['toLowerCase']()===_0xaee9('0x41')?_0x2a6e22[_0xaee9('0x42')]:_0x2a6e22[_0xaee9('0x43')];_0x271273[_0xaee9('0x44')]=_0x3f8b74==='queue'||_0x3f8b74===_0xaee9('0x45')?_0xaee9('0x46'):'outbound';if(_0x2e0796){_0x271273[_0xaee9('0x1c')]=_0x2e0796[_0xaee9('0x12')];}var _0x412547=util['format'](_0xaee9('0x47'),_0x362dfe['serverUrl'],_0x2a6e22['uniqueid'],md5(_0x2a6e22[_0xaee9('0x48')]));if(_0x2bee67&&_0x2bee67[_0xaee9('0x49')]){logger[_0xaee9('0xd')](_0xaee9('0x4a'),_0xaee9('0x4b'));_0x2a6e22['recordingURL']=_0x412547;}else if(_0xaa79b&&_0xaa79b[_0xaee9('0x4c')]&&_0xaa79b[_0xaee9('0x4c')]!==_0xaee9('0x4d')){logger['info'](_0xaee9('0x4e'),_0xaee9('0x4b'));_0x2a6e22[_0xaee9('0x4f')]=_0x412547;}else{_0x2a6e22[_0xaee9('0x4f')]='';}return getAdminId(_0x271273,_0x3f8b74,_0x1ed398,_0x1b4dce)[_0xaee9('0xf')](getUser(_0x3f8b74,_0x1ed398,_0x1b4dce))[_0xaee9('0xf')](getEndUser(_0x3f8b74,_0x1ed398,_0x1b4dce))['then'](getTicket(_0x3f8b74,_0x1ed398,_0x1b4dce,_0x1c7542,_0x2a6e22))[_0xaee9('0xf')](function(_0x4fb29e){logger['info'](util['format'](_0xaee9('0x50'),_0x4fb29e[_0xaee9('0x36')]));if(_0x3f8b74!==_0xaee9('0x45')){logger[_0xaee9('0xd')]('['+[_0x3f8b74[_0xaee9('0x19')]()]+']',_0xaee9('0x51'));emit(_0x1b4dce,_0x2e0796[_0xaee9('0x52')],_0x4fb29e[_0xaee9('0x29')]);}})[_0xaee9('0x17')](function(_0x580a5f){logger[_0xaee9('0x18')]('['+[_0x3f8b74['toUpperCase']()]+_0xaee9('0x53'),util['inspect'](_0x580a5f,{'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 785e310..6e165c7 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 _0xaee0=['format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','vtiger','dynamics365','freshsales','exec','includes','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','outbound','unmanaged','freshdesk','zoho','desk','servicenow','log','unknown\x20integration','../../../../config/logger','error','[EXEC]'];(function(_0x39e76b,_0x3a46a0){var _0x868344=function(_0x5a09be){while(--_0x5a09be){_0x39e76b['push'](_0x39e76b['shift']());}};_0x868344(++_0x3a46a0);}(_0xaee0,0xa7));var _0x0aee=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xaee0[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x0aee('0x0'));var util=require(_0x0aee('0x1'));var zendesk=require(_0x0aee('0x2'));var salesforce=require(_0x0aee('0x3'));var sugarcrm=require(_0x0aee('0x4'));var freshdesk=require(_0x0aee('0x5'));var zoho=require(_0x0aee('0x6'));var desk=require(_0x0aee('0x7'));var vtiger=require(_0x0aee('0x8'));var servicenow=require(_0x0aee('0x9'));var dynamics365=require(_0x0aee('0xa'));var freshsales=require(_0x0aee('0xb'));var integrations=[_0x0aee('0xc'),_0x0aee('0xd'),'sugarcrm','freshdesk','zoho','desk',_0x0aee('0xe'),_0x0aee('0xf'),_0x0aee('0x10'),'servicenow'];exports[_0x0aee('0x11')]=function(_0x44940b,_0x512052,_0xe0bed7,_0x37b9c9,_0x28ed2c,_0xc27c8){if(_0xe0bed7){if(_[_0x0aee('0x12')](integrations,_0x44940b['data1'][_0x0aee('0x13')]())){try{var _0x3cd0fa=null;var _0x1f4041='';var _0x128254=_0xe0bed7[_0x44940b[_0x0aee('0x14')][_0x0aee('0x13')]()];if(_0x128254){var _0x2e8565=_0x128254[_0x44940b[_0x0aee('0x15')]];if(_0x2e8565){var _0x483bf6=_[_0x0aee('0x16')](_0x2e8565[_0x0aee('0x17')],{'id':parseInt(_0x44940b[_0x0aee('0x18')],0xa)});if(_0x483bf6){if(_0x37b9c9){if(_0x28ed2c&&_0x512052[_0x0aee('0x19')]){_0x1f4041=_0x0aee('0x19');}else if(_0x512052[_0x0aee('0x1a')]){_0x1f4041=_0x0aee('0x1b');}else{console['log']('EVENT\x20UNKNOWN',_0x512052);}}else{_0x1f4041=_0x0aee('0x1c');}switch(_0x44940b[_0x0aee('0x14')][_0x0aee('0x13')]()){case'zendesk':zendesk[_0x1f4041](_0x44940b,_0x512052,_0x483bf6,_0x37b9c9,_0x28ed2c,_0x2e8565,_0xc27c8);break;case _0x0aee('0xd'):salesforce[_0x1f4041](_0x44940b,_0x512052,_0x483bf6,_0x37b9c9,_0x28ed2c,_0x2e8565,_0xc27c8);break;case'sugarcrm':sugarcrm[_0x1f4041](_0x44940b,_0x512052,_0x483bf6,_0x37b9c9,_0x28ed2c,_0x2e8565,_0xc27c8);break;case _0x0aee('0x1d'):freshdesk[_0x1f4041](_0x44940b,_0x512052,_0x483bf6,_0x37b9c9,_0x28ed2c,_0x2e8565,_0xc27c8);break;case _0x0aee('0x1e'):zoho[_0x1f4041](_0x44940b,_0x512052,_0x483bf6,_0x37b9c9,_0x28ed2c,_0x2e8565,_0xc27c8);break;case _0x0aee('0x1f'):desk[_0x1f4041](_0x44940b,_0x512052,_0x483bf6,_0x37b9c9,_0x28ed2c,_0x2e8565,_0xc27c8);break;case'vtiger':vtiger[_0x1f4041](_0x44940b,_0x512052,_0x483bf6,_0x37b9c9,_0x28ed2c,_0x2e8565,_0xc27c8);break;case _0x0aee('0x10'):freshsales['cs'](_0x44940b,_0x512052,_0x483bf6,_0x37b9c9,_0x28ed2c,_0x2e8565,_0xc27c8,_0x1f4041);break;case _0x0aee('0x20'):servicenow['cs'](_0x44940b,_0x512052,_0x483bf6,_0x37b9c9,_0x28ed2c,_0x2e8565,_0xc27c8,_0x1f4041);break;case _0x0aee('0xf'):dynamics365['cs'](_0x44940b,_0x512052,_0x483bf6,_0x37b9c9,_0x28ed2c,_0x2e8565,_0xc27c8,_0x1f4041);break;default:console[_0x0aee('0x21')](_0x0aee('0x22'));}}else{_0x3cd0fa=require(_0x0aee('0x23'))(_0x44940b['data1'][_0x0aee('0x13')]());_0x3cd0fa[_0x0aee('0x24')](_0x0aee('0x25'),util[_0x0aee('0x26')](_0x0aee('0x27'),_0x44940b[_0x0aee('0x14')][_0x0aee('0x13')](),_0x44940b[_0x0aee('0x18')]));}}else{_0x3cd0fa=require('../../../../config/logger')(_0x44940b['data1']['toLowerCase']());_0x3cd0fa[_0x0aee('0x24')](_0x0aee('0x25'),util[_0x0aee('0x26')](_0x0aee('0x28'),_0x44940b[_0x0aee('0x14')][_0x0aee('0x13')](),_0x44940b[_0x0aee('0x15')]));}}else{}}catch(_0x16dcc1){console[_0x0aee('0x24')](_0x16dcc1);}}}}; \ No newline at end of file +var _0xbc42=['lodash','util','./zendesk','./salesforce','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','freshdesk','zoho','desk','dynamics365','freshsales','exec','includes','data1','toLowerCase','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','salesforce','sugarcrm','vtiger','servicenow','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','error'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xbc42,0x75));var _0x2bc4=function(_0x110c70,_0x2f52bd){_0x110c70=_0x110c70-0x0;var _0x133f30=_0xbc42[_0x110c70];return _0x133f30;};'use strict';var _=require(_0x2bc4('0x0'));var util=require(_0x2bc4('0x1'));var zendesk=require(_0x2bc4('0x2'));var salesforce=require(_0x2bc4('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0x2bc4('0x4'));var desk=require(_0x2bc4('0x5'));var vtiger=require(_0x2bc4('0x6'));var servicenow=require(_0x2bc4('0x7'));var dynamics365=require(_0x2bc4('0x8'));var freshsales=require(_0x2bc4('0x9'));var integrations=[_0x2bc4('0xa'),'salesforce','sugarcrm',_0x2bc4('0xb'),_0x2bc4('0xc'),_0x2bc4('0xd'),'vtiger',_0x2bc4('0xe'),_0x2bc4('0xf'),'servicenow'];exports[_0x2bc4('0x10')]=function(_0x5ed6c7,_0x1ad9cb,_0x4ad625,_0x1244a9,_0x3b069d,_0x4b1964){if(_0x4ad625){if(_[_0x2bc4('0x11')](integrations,_0x5ed6c7[_0x2bc4('0x12')][_0x2bc4('0x13')]())){try{var _0x2859e3=null;var _0x5212cf='';var _0xc3e903=_0x4ad625[_0x5ed6c7[_0x2bc4('0x12')][_0x2bc4('0x13')]()];if(_0xc3e903){var _0x54f5b0=_0xc3e903[_0x5ed6c7['data2']];if(_0x54f5b0){var _0x2e3e39=_['find'](_0x54f5b0[_0x2bc4('0x14')],{'id':parseInt(_0x5ed6c7[_0x2bc4('0x15')],0xa)});if(_0x2e3e39){if(_0x1244a9){if(_0x3b069d&&_0x1ad9cb[_0x2bc4('0x16')]){_0x5212cf=_0x2bc4('0x16');}else if(_0x1ad9cb[_0x2bc4('0x17')]){_0x5212cf=_0x2bc4('0x18');}else{console['log'](_0x2bc4('0x19'),_0x1ad9cb);}}else{_0x5212cf=_0x2bc4('0x1a');}switch(_0x5ed6c7['data1'][_0x2bc4('0x13')]()){case _0x2bc4('0xa'):zendesk[_0x5212cf](_0x5ed6c7,_0x1ad9cb,_0x2e3e39,_0x1244a9,_0x3b069d,_0x54f5b0,_0x4b1964);break;case _0x2bc4('0x1b'):salesforce[_0x5212cf](_0x5ed6c7,_0x1ad9cb,_0x2e3e39,_0x1244a9,_0x3b069d,_0x54f5b0,_0x4b1964);break;case _0x2bc4('0x1c'):sugarcrm[_0x5212cf](_0x5ed6c7,_0x1ad9cb,_0x2e3e39,_0x1244a9,_0x3b069d,_0x54f5b0,_0x4b1964);break;case'freshdesk':freshdesk[_0x5212cf](_0x5ed6c7,_0x1ad9cb,_0x2e3e39,_0x1244a9,_0x3b069d,_0x54f5b0,_0x4b1964);break;case _0x2bc4('0xc'):zoho[_0x5212cf](_0x5ed6c7,_0x1ad9cb,_0x2e3e39,_0x1244a9,_0x3b069d,_0x54f5b0,_0x4b1964);break;case'desk':desk[_0x5212cf](_0x5ed6c7,_0x1ad9cb,_0x2e3e39,_0x1244a9,_0x3b069d,_0x54f5b0,_0x4b1964);break;case _0x2bc4('0x1d'):vtiger[_0x5212cf](_0x5ed6c7,_0x1ad9cb,_0x2e3e39,_0x1244a9,_0x3b069d,_0x54f5b0,_0x4b1964);break;case _0x2bc4('0xf'):freshsales['cs'](_0x5ed6c7,_0x1ad9cb,_0x2e3e39,_0x1244a9,_0x3b069d,_0x54f5b0,_0x4b1964,_0x5212cf);break;case _0x2bc4('0x1e'):servicenow['cs'](_0x5ed6c7,_0x1ad9cb,_0x2e3e39,_0x1244a9,_0x3b069d,_0x54f5b0,_0x4b1964,_0x5212cf);break;case _0x2bc4('0xe'):dynamics365['cs'](_0x5ed6c7,_0x1ad9cb,_0x2e3e39,_0x1244a9,_0x3b069d,_0x54f5b0,_0x4b1964,_0x5212cf);break;default:console['log'](_0x2bc4('0x1f'));}}else{_0x2859e3=require(_0x2bc4('0x20'))(_0x5ed6c7[_0x2bc4('0x12')]['toLowerCase']());_0x2859e3['error'](_0x2bc4('0x21'),util[_0x2bc4('0x22')](_0x2bc4('0x23'),_0x5ed6c7['data1']['toLowerCase'](),_0x5ed6c7['data3']));}}else{_0x2859e3=require(_0x2bc4('0x20'))(_0x5ed6c7[_0x2bc4('0x12')][_0x2bc4('0x13')]());_0x2859e3['error'](_0x2bc4('0x21'),util[_0x2bc4('0x22')](_0x2bc4('0x24'),_0x5ed6c7[_0x2bc4('0x12')]['toLowerCase'](),_0x5ed6c7[_0x2bc4('0x25')]));}}else{}}catch(_0x172ee6){console[_0x2bc4('0x26')](_0x172ee6);}}}}; \ 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 98851cd..7a6dce6 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 _0x9e3d=['type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','','Caller\x20-\x20%s','Company','No\x20Company','forEach','string','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','newTab','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','jsforce','util','../../../../config/logger','salesforce','redis','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','then','length','Email','info','Agent\x20%s\x20found.','resolve','Name','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','execute','Lead','first','Phone'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x9e3d,0xba));var _0xd9e3=function(_0x28959f,_0x51a636){_0x28959f=_0x28959f-0x0;var _0x2abdf8=_0x9e3d[_0x28959f];return _0x2abdf8;};'use strict';var _=require(_0xd9e3('0x0'));var rp=require('request-promise');var moment=require(_0xd9e3('0x1'));var BPromise=require(_0xd9e3('0x2'));var md5=require('md5');var jsforce=require(_0xd9e3('0x3'));var util=require(_0xd9e3('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xd9e3('0x5'))(_0xd9e3('0x6'));config[_0xd9e3('0x7')]=_['defaults'](config[_0xd9e3('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xd9e3('0x8'))(new Redis(config[_0xd9e3('0x7')]));function emit(_0x87c990,_0x4a1f30,_0x198150){io['to'](_0x87c990)[_0xd9e3('0x9')](_0x4a1f30,_0x198150);}function getTicket(_0x522730,_0x3c1922,_0x1378cb,_0x1df2da,_0x568183,_0x5b0f28,_0x286615,_0x531b63){var _0x3cefb8=Object[_0xd9e3('0xa')]({},{'OwnerId':_0x3c1922['id'],'Subject':intUtil[_0xd9e3('0xb')](_0x1df2da[_0xd9e3('0xc')],_0x568183,'\x20'),'Description':intUtil[_0xd9e3('0xb')](_0x1df2da[_0xd9e3('0xd')],_0x568183,'\x0a')},getCustomFields(_0x5b0f28,_0x568183));if(_0x1378cb){if(_0x1df2da[_0xd9e3('0xe')]==='Task'){_0x3cefb8[_0xd9e3('0xf')]=moment['utc']();_0x3cefb8[_0xd9e3('0x10')]=![];_0x3cefb8[_0xd9e3('0x11')]=![];if(_0x1378cb[_0xd9e3('0x12')]===_0xd9e3('0x13')||_0x1378cb[_0xd9e3('0x12')]===_0xd9e3('0x14')){_0x3cefb8[_0xd9e3('0x15')]=_0x1378cb['id'];}else if(_0x1378cb[_0xd9e3('0x12')]===_0xd9e3('0x16')){_0x3cefb8[_0xd9e3('0x17')]=_0x1378cb['id'];}}else if(_0x1df2da[_0xd9e3('0xe')]==='Case'){if(_0x1378cb[_0xd9e3('0x12')]===_0xd9e3('0x13')){_0x3cefb8[_0xd9e3('0x18')]=_0x1378cb['id'];}else if(_0x1378cb[_0xd9e3('0x12')]===_0xd9e3('0x16')){_0x3cefb8[_0xd9e3('0x19')]=_0x1378cb['id'];}else if(_0x1378cb[_0xd9e3('0x12')]===_0xd9e3('0x14')&&_0x1df2da['leadId']){_0x3cefb8[_0x1df2da[_0xd9e3('0x1a')]]=_0x1378cb['id'];}else{logger['info'](_0xd9e3('0x1b'));}}}return _0x286615[_0xd9e3('0x1c')](_0x1df2da[_0xd9e3('0xe')])[_0xd9e3('0x1d')](_0x3cefb8);}function getUser(_0x265fdc,_0x58ae10,_0x398aa6){if(!_[_0xd9e3('0x1e')](_0x58ae10)&&intUtil[_0xd9e3('0x1f')](_0x58ae10)){var _0x151864={'Email':_0x58ae10};var _0x25c242={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x398aa6[_0xd9e3('0x1c')](_0xd9e3('0x20'))[_0xd9e3('0x21')](_0x151864,_0x25c242)['execute']()[_0xd9e3('0x22')](function(_0x4cb8a5){if(_0x4cb8a5[_0xd9e3('0x23')]){var _0x5e54dc=_[_0xd9e3('0x21')](_0x4cb8a5,function(_0x103732){return _0x103732[_0xd9e3('0x24')]===_0x58ae10;});if(_0x5e54dc){logger[_0xd9e3('0x25')](_0xd9e3('0x26'),_0x58ae10);return BPromise[_0xd9e3('0x27')]({'id':_0x5e54dc['Id'],'name':_0x5e54dc[_0xd9e3('0x28')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x58ae10);return _0x398aa6[_0xd9e3('0x29')]()[_0xd9e3('0x22')](function(_0x2f151){return BPromise[_0xd9e3('0x27')]({'id':_0x2f151[_0xd9e3('0x2a')],'name':_0x2f151[_0xd9e3('0x2b')]});});}});}else{logger['info'](_0xd9e3('0x2c'),_0x58ae10);return _0x398aa6[_0xd9e3('0x29')]()[_0xd9e3('0x22')](function(_0x5b4720){return BPromise[_0xd9e3('0x27')]({'id':_0x5b4720[_0xd9e3('0x2a')],'name':_0x5b4720[_0xd9e3('0x2b')]});});}}function getEndUser(_0x560317,_0x59fa38,_0x42a83c,_0x442f1b,_0x4127f2){var _0x1dc1f0={'$or':{'Phone':_0x442f1b}};var _0x55e4a5={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xd9e3('0x27')]()[_0xd9e3('0x22')](function(){logger[_0xd9e3('0x25')](_0xd9e3('0x2d'),_0x442f1b,_0x59fa38[_0xd9e3('0x2e')]);switch(_0x59fa38['moduleSearch']){case'contact_lead':var _0x322b07=_[_0xd9e3('0x2f')](_0x1dc1f0);if(_0x59fa38[_0xd9e3('0x30')]){var _0x2b9387={};_0x2b9387[_0x59fa38[_0xd9e3('0x30')]]=_0x442f1b;_[_0xd9e3('0x31')](_0x322b07[_0xd9e3('0x32')],_0x2b9387);}return _0x4127f2[_0xd9e3('0x1c')](_0xd9e3('0x33'))[_0xd9e3('0x21')](_0x322b07,_0x55e4a5)['execute']()['then'](function(_0x178ec2){if(_0x178ec2&&_0x178ec2[_0xd9e3('0x23')]){return _0x178ec2;}else{var _0x208dc6=_[_0xd9e3('0x2f')](_0x1dc1f0);if(_0x59fa38[_0xd9e3('0x34')]){var _0x47d00c={};_0x47d00c[_0x59fa38[_0xd9e3('0x34')]]=_0x442f1b;_[_0xd9e3('0x31')](_0x208dc6[_0xd9e3('0x32')],_0x47d00c);}return _0x4127f2['sobject']('Lead')[_0xd9e3('0x21')](_0x208dc6,_0x55e4a5);}});case _0xd9e3('0x35'):var _0x16f28d=_[_0xd9e3('0x2f')](_0x1dc1f0);if(_0x59fa38[_0xd9e3('0x36')]){var _0x2b9387={};_0x2b9387[_0x59fa38[_0xd9e3('0x36')]]=_0x442f1b;_[_0xd9e3('0x31')](_0x16f28d[_0xd9e3('0x32')],_0x2b9387);}return _0x4127f2[_0xd9e3('0x1c')](_0xd9e3('0x37'))['find'](_0x16f28d,_0x55e4a5)[_0xd9e3('0x38')]()['then'](function(_0x7d0cc2){if(_0x7d0cc2&&_0x7d0cc2[_0xd9e3('0x23')]){return _0x7d0cc2;}else{var _0x49209b=_[_0xd9e3('0x2f')](_0x1dc1f0);if(_0x59fa38['additionalSearchContact']){var _0x190951={};_0x190951[_0x59fa38['additionalSearchContact']]=_0x442f1b;_[_0xd9e3('0x31')](_0x49209b[_0xd9e3('0x32')],_0x190951);}return _0x4127f2[_0xd9e3('0x1c')](_0xd9e3('0x33'))[_0xd9e3('0x21')](_0x49209b,_0x55e4a5)[_0xd9e3('0x22')](function(_0x112250){if(_0x112250&&_0x112250[_0xd9e3('0x23')]){return _0x112250;}else{var _0x3fb8ed=_[_0xd9e3('0x2f')](_0x1dc1f0);if(_0x59fa38[_0xd9e3('0x34')]){var _0x21763f={};_0x21763f[_0x59fa38['additionalSearchLead']]=_0x442f1b;_[_0xd9e3('0x31')](_0x3fb8ed[_0xd9e3('0x32')],_0x21763f);}return _0x4127f2[_0xd9e3('0x1c')](_0xd9e3('0x39'))[_0xd9e3('0x21')](_0x3fb8ed,_0x55e4a5);}});}});case _0xd9e3('0x13'):var _0x322b07=_[_0xd9e3('0x2f')](_0x1dc1f0);if(_0x59fa38[_0xd9e3('0x30')]){var _0x2b9387={};_0x2b9387[_0x59fa38['additionalSearchContact']]=_0x442f1b;_[_0xd9e3('0x31')](_0x322b07[_0xd9e3('0x32')],_0x2b9387);}return _0x4127f2[_0xd9e3('0x1c')](_0xd9e3('0x33'))['find'](_0x322b07,_0x55e4a5)[_0xd9e3('0x38')]();case _0xd9e3('0x14'):var _0x53e88e=_[_0xd9e3('0x2f')](_0x1dc1f0);if(_0x59fa38[_0xd9e3('0x34')]){var _0x2b9387={};_0x2b9387[_0x59fa38[_0xd9e3('0x34')]]=_0x442f1b;_[_0xd9e3('0x31')](_0x53e88e[_0xd9e3('0x32')],_0x2b9387);}return _0x4127f2[_0xd9e3('0x1c')](_0xd9e3('0x39'))['find'](_0x53e88e,_0x55e4a5);case _0xd9e3('0x16'):var _0x16f28d=_[_0xd9e3('0x2f')](_0x1dc1f0);if(_0x59fa38[_0xd9e3('0x36')]){var _0x2b9387={};_0x2b9387[_0x59fa38['additionalSearchAccount']]=_0x442f1b;_[_0xd9e3('0x31')](_0x16f28d[_0xd9e3('0x32')],_0x2b9387);}return _0x4127f2[_0xd9e3('0x1c')](_0xd9e3('0x37'))[_0xd9e3('0x21')](_0x16f28d,_0x55e4a5);default:return null;}})['then'](function(_0x39c0cf){if(_0x39c0cf&&_0x39c0cf[_0xd9e3('0x23')]){var _0x25256e=_[_0xd9e3('0x3a')](_0x39c0cf);if(_0x25256e){return BPromise[_0xd9e3('0x27')]({'id':_0x25256e['Id'],'name':_0x25256e[_0xd9e3('0x28')],'phone':_0x25256e[_0xd9e3('0x3b')],'endUserType':_0x25256e['attributes'][_0xd9e3('0x3c')]['toLowerCase']()});}}})['then'](function(_0x4f6f4f){if(_0x4f6f4f){logger[_0xd9e3('0x25')](_0xd9e3('0x3d'),_0x4f6f4f[_0xd9e3('0x12')],_0x442f1b);return BPromise['resolve'](_0x4f6f4f);}else{logger[_0xd9e3('0x25')](_0xd9e3('0x3e'),_0x442f1b);var _0x46d308={'Phone':_0x442f1b};if(_0x59fa38[_0xd9e3('0x3f')]){if(_0x59fa38['moduleCreate']==='contact'){logger['info'](_0xd9e3('0x40'),_0x442f1b,_0x59fa38[_0xd9e3('0x3f')]);_0x46d308[_0xd9e3('0x41')]=_0x42a83c!==''?_0x42a83c:util[_0xd9e3('0x42')]('Caller\x20-\x20%s',_0x442f1b);}else if(_0x59fa38['moduleCreate']===_0xd9e3('0x14')){logger[_0xd9e3('0x25')](_0xd9e3('0x40'),_0x442f1b,_0x59fa38[_0xd9e3('0x3f')]);_0x46d308[_0xd9e3('0x41')]=_0x42a83c!==_0xd9e3('0x43')?_0x42a83c:util[_0xd9e3('0x42')](_0xd9e3('0x44'),_0x442f1b);_0x46d308[_0xd9e3('0x45')]=_0xd9e3('0x46');}else if(_0x59fa38[_0xd9e3('0x3f')]===_0xd9e3('0x16')){logger[_0xd9e3('0x25')](_0xd9e3('0x40'),_0x442f1b,_0x59fa38['moduleCreate']);_0x46d308[_0xd9e3('0x28')]=_0x42a83c!==_0xd9e3('0x43')?_0x42a83c:util[_0xd9e3('0x42')](_0xd9e3('0x44'),_0x442f1b);}else{return null;}}return _0x4127f2['sobject'](_['upperFirst'](_0x59fa38['moduleCreate']))['create'](_0x46d308)[_0xd9e3('0x22')](function(_0x35fbf7){return BPromise[_0xd9e3('0x27')]({'id':_0x35fbf7['id'],'endUserType':_0x59fa38[_0xd9e3('0x3f')]});});}});}function getCustomFields(_0xd43394,_0x1ae2c0){var _0xbd0810={};if(_0xd43394['length']>0x0){_[_0xd9e3('0x47')](_0xd43394,function(_0x166a9c){if(_['includes']([_0xd9e3('0x48'),'picklist'],_0x166a9c[_0xd9e3('0x3c')])&&_0x166a9c[_0xd9e3('0x49')]){_0xbd0810[_0x166a9c[_0xd9e3('0x49')]]=_0x166a9c[_0xd9e3('0x4a')]['toString']();}else if(_0x166a9c[_0xd9e3('0x3c')]===_0xd9e3('0x4b')&&_0x166a9c[_0xd9e3('0x4c')]&&_0x166a9c[_0xd9e3('0x49')]){_0x1ae2c0[_0x166a9c[_0xd9e3('0x4c')]]&&(_0xbd0810[_0x166a9c[_0xd9e3('0x49')]]=_0x1ae2c0[_0x166a9c['variableName']][_0xd9e3('0x4d')]());}else if(_0x166a9c[_0xd9e3('0x3c')]===_0xd9e3('0x4e')&&_0x166a9c[_0xd9e3('0x4f')]&&_0x166a9c[_0xd9e3('0x4f')][_0xd9e3('0x50')]&&_0x166a9c['idField']){_0x1ae2c0[_0x166a9c[_0xd9e3('0x4f')][_0xd9e3('0x50')]['toLowerCase']()]&&(_0xbd0810[_0x166a9c[_0xd9e3('0x49')]]=_0x1ae2c0[_0x166a9c[_0xd9e3('0x4f')]['name'][_0xd9e3('0x51')]()]['toString']());}});}return _0xbd0810;}function getConnection(_0x139fec){var _0x426d60=_0x139fec[_0xd9e3('0x52')][_0xd9e3('0x53')](_0x139fec[_0xd9e3('0x54')]);var _0x113122=new jsforce[(_0xd9e3('0x55'))]({'oauth2':{'loginUrl':_0x139fec['remoteUri']||'https://login.salesforce.com','clientId':_0x139fec[_0xd9e3('0x56')],'clientSecret':_0x139fec[_0xd9e3('0x57')]}});return _0x113122[_0xd9e3('0x58')](_0x139fec[_0xd9e3('0x59')],_0x426d60)[_0xd9e3('0x22')](function(){logger['info']('Connection\x20established.');return _0x113122;});}exports[_0xd9e3('0x5a')]=function(_0x350be9,_0x5e0662,_0x489bb7,_0x491d19,_0x4f1433,_0x44df57){var _0x39ef2d,_0x313204,_0x40fdf1,_0x40f514;_0x44df57[_0xd9e3('0x5b')]=intUtil[_0xd9e3('0x5c')](_0x44df57[_0xd9e3('0x5b')]);_0x44df57[_0xd9e3('0x5d')]=intUtil[_0xd9e3('0x5c')](_0x44df57[_0xd9e3('0x5d')]);if(_0x4f1433&&_0x4f1433[_0xd9e3('0x5e')]){logger['info'](_0xd9e3('0x5f'),_0xd9e3('0x60'));_0x5e0662['recordingURL']=util[_0xd9e3('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x44df57[_0xd9e3('0x5b')],_0x5e0662[_0xd9e3('0x61')],md5(_0x5e0662[_0xd9e3('0x61')]));}else{_0x5e0662[_0xd9e3('0x62')]='';}return getConnection(_0x44df57)['then'](function(_0xd9bbf2){_0x40f514=_0xd9bbf2;return getUser(_0x44df57,_0x491d19['email'],_0x40f514);})['then'](function(_0x5546e0){_0x39ef2d=_0x5546e0;return getEndUser(_0x44df57,_0x489bb7,_0x5e0662['calleridname'],_0x5e0662['calleridnum'],_0x40f514);})['then'](function(_0x451de3){_0x313204=_0x451de3;return getTicket(_0x44df57,_0x39ef2d,_0x313204,_0x489bb7,_0x5e0662,_0x489bb7['Fields'],_0x40f514,'queue');})[_0xd9e3('0x22')](function(_0x3d677f){_0x40fdf1=_0x3d677f;logger[_0xd9e3('0x25')](_0xd9e3('0x63'),_0x40fdf1['id']);logger[_0xd9e3('0x25')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x40fdf1['id'],_0x491d19[_0xd9e3('0x50')],_0x44df57['type']);switch(_0x44df57['type']){case _0xd9e3('0x64'):emit(util['format'](_0xd9e3('0x65'),_0x491d19[_0xd9e3('0x50')]),_0xd9e3('0x66'),{'recordId':_0x40fdf1['id']});break;case _0xd9e3('0x67'):emit(util['format']('user:%s',_0x491d19[_0xd9e3('0x50')]),'trigger:browser:url',{'uri':util['format']('%s/%s/e',_0x40f514['instanceUrl'],_0x40fdf1['id'])});break;default:logger[_0xd9e3('0x68')](_0xd9e3('0x69'));}})[_0xd9e3('0x6a')](function(_0x190940){logger['error'](_0xd9e3('0x5f'),_0x190940);});};exports[_0xd9e3('0x6b')]=function(_0x2282be,_0x1569ee,_0x17fd29,_0x393428,_0x1445bb,_0x24a239,_0x33eb7c){var _0x120298,_0x5816e6,_0x5a9612,_0x43dfcd;_0x24a239[_0xd9e3('0x5b')]=intUtil[_0xd9e3('0x5c')](_0x24a239[_0xd9e3('0x5b')]);_0x24a239[_0xd9e3('0x5d')]=intUtil[_0xd9e3('0x5c')](_0x24a239['remoteUri']);if(_0x33eb7c&&_0x33eb7c['recordingFormat']&&_0x33eb7c[_0xd9e3('0x6c')]!==_0xd9e3('0x6d')){logger[_0xd9e3('0x25')](_0xd9e3('0x6e'),_0xd9e3('0x60'));_0x1569ee[_0xd9e3('0x62')]=util['format'](_0xd9e3('0x6f'),_0x24a239[_0xd9e3('0x5b')],_0x1569ee[_0xd9e3('0x61')],md5(_0x1569ee['uniqueid']));}return getConnection(_0x24a239)[_0xd9e3('0x22')](function(_0x4a0791){_0x43dfcd=_0x4a0791;return getUser(_0x24a239,_0x393428[_0xd9e3('0x70')],_0x43dfcd);})[_0xd9e3('0x22')](function(_0x4c1fde){_0x120298=_0x4c1fde;return getEndUser(_0x24a239,_0x17fd29,_0x1569ee[_0xd9e3('0x71')],_0x1569ee['destcalleridnum'],_0x43dfcd);})['then'](function(_0x1c9967){_0x5816e6=_0x1c9967;return getTicket(_0x24a239,_0x120298,_0x5816e6,_0x17fd29,_0x1569ee,_0x17fd29[_0xd9e3('0x72')],_0x43dfcd,'outbound');})[_0xd9e3('0x22')](function(_0x30e8e6){_0x5a9612=_0x30e8e6;logger[_0xd9e3('0x25')](_0xd9e3('0x73'),_0x5a9612['id']);logger[_0xd9e3('0x25')](_0xd9e3('0x74'),_0x5a9612['id'],_0x393428[_0xd9e3('0x50')],_0x24a239[_0xd9e3('0x3c')]);switch(_0x24a239[_0xd9e3('0x3c')]){case'integrationTab':emit(util['format'](_0xd9e3('0x65'),_0x393428['name']),_0xd9e3('0x66'),{'recordId':_0x5a9612['id']});break;case _0xd9e3('0x67'):emit(util[_0xd9e3('0x42')](_0xd9e3('0x65'),_0x393428[_0xd9e3('0x50')]),'trigger:browser:url',{'uri':util[_0xd9e3('0x42')]('%s/%s/e',_0x43dfcd[_0xd9e3('0x75')],_0x5a9612['id'])});break;default:logger[_0xd9e3('0x68')](_0xd9e3('0x6e'),_0xd9e3('0x76'));}})[_0xd9e3('0x6a')](function(_0x12a552){logger[_0xd9e3('0x68')](_0xd9e3('0x6e'),_0x12a552);});};exports['unmanaged']=function(_0x4e2060,_0x2c3aae,_0x22e000,_0xd4201b,_0x4e9ca3,_0xe3110c){var _0x550b83,_0x274f36,_0x449191,_0x489f52;_0xe3110c[_0xd9e3('0x5b')]=intUtil[_0xd9e3('0x5c')](_0xe3110c[_0xd9e3('0x5b')]);_0xe3110c['remoteUri']=intUtil['stripTrailingSlash'](_0xe3110c[_0xd9e3('0x5d')]);if(_0x4e9ca3&&_0x4e9ca3[_0xd9e3('0x5e')]){logger['info']('['+_0x2c3aae[_0xd9e3('0x77')][_0xd9e3('0x78')]()+']',_0xd9e3('0x60'));_0x2c3aae[_0xd9e3('0x62')]=util['format'](_0xd9e3('0x6f'),_0xe3110c['serverUrl'],_0x2c3aae[_0xd9e3('0x61')],md5(_0x2c3aae[_0xd9e3('0x61')]));}else{_0x2c3aae['recordingURL']='';}return getConnection(_0xe3110c)[_0xd9e3('0x22')](function(_0x43bc24){_0x489f52=_0x43bc24;if(!_[_0xd9e3('0x1e')](_0xd4201b)){return getUser(_0xe3110c,_0xd4201b['name'],_0x489f52);}else{return getUser(_0xe3110c,null,_0x489f52);}})[_0xd9e3('0x22')](function(_0x5ea730){_0x550b83=_0x5ea730;return getEndUser(_0xe3110c,_0x22e000,_0x2c3aae['calleridname'],_0x2c3aae['calleridnum'],_0x489f52);})[_0xd9e3('0x22')](function(_0x3c673d){_0x274f36=_0x3c673d;return getTicket(_0xe3110c,_0x550b83,_0x274f36,_0x22e000,_0x2c3aae,_0x22e000[_0xd9e3('0x72')],_0x489f52);})['then'](function(_0x167f08){_0x449191=_0x167f08;logger[_0xd9e3('0x25')]('['+_0x2c3aae[_0xd9e3('0x77')][_0xd9e3('0x78')]()+_0xd9e3('0x79'),_0x449191['id']);logger[_0xd9e3('0x25')]('['+_0x2c3aae[_0xd9e3('0x77')][_0xd9e3('0x78')]()+_0xd9e3('0x7a'),_0xe3110c[_0xd9e3('0x3c')]);})[_0xd9e3('0x6a')](function(_0x505c28){logger[_0xd9e3('0x68')]('['+_0x2c3aae[_0xd9e3('0x77')][_0xd9e3('0x78')]()+']',_0x505c28);});}; \ No newline at end of file +var _0xe40f=['redis','defaults','assign','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','execute','then','length','find','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','first','Name','Phone','type','toLowerCase','moduleCreate','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','upperFirst','forEach','string','picklist','idField','content','toString','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','unmanaged','lastevent','toUpperCase','calleridname',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','jsforce','ioredis','../../../../config/logger','salesforce'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0xe40f,0x70));var _0xfe40=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe40f[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xfe40('0x0'));var rp=require(_0xfe40('0x1'));var moment=require(_0xfe40('0x2'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0xfe40('0x3'));var util=require('util');var Redis=require(_0xfe40('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xfe40('0x5'))(_0xfe40('0x6'));config[_0xfe40('0x7')]=_[_0xfe40('0x8')](config[_0xfe40('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfe40('0x7')]));function emit(_0x465b04,_0x232804,_0x12ab10){io['to'](_0x465b04)['emit'](_0x232804,_0x12ab10);}function getTicket(_0xb411e0,_0x28a114,_0x7e6b70,_0x53531b,_0x98be1b,_0x4ac674,_0x4e2c85,_0x11b4b1){var _0x84aa09=Object[_0xfe40('0x9')]({},{'OwnerId':_0x28a114['id'],'Subject':intUtil['getString'](_0x53531b['Subjects'],_0x98be1b,'\x20'),'Description':intUtil['getString'](_0x53531b[_0xfe40('0xa')],_0x98be1b,'\x0a')},getCustomFields(_0x4ac674,_0x98be1b));if(_0x7e6b70){if(_0x53531b[_0xfe40('0xb')]===_0xfe40('0xc')){_0x84aa09[_0xfe40('0xd')]=moment[_0xfe40('0xe')]();_0x84aa09[_0xfe40('0xf')]=![];_0x84aa09[_0xfe40('0x10')]=![];if(_0x7e6b70[_0xfe40('0x11')]===_0xfe40('0x12')||_0x7e6b70[_0xfe40('0x11')]===_0xfe40('0x13')){_0x84aa09[_0xfe40('0x14')]=_0x7e6b70['id'];}else if(_0x7e6b70[_0xfe40('0x11')]===_0xfe40('0x15')){_0x84aa09[_0xfe40('0x16')]=_0x7e6b70['id'];}}else if(_0x53531b[_0xfe40('0xb')]===_0xfe40('0x17')){if(_0x7e6b70['endUserType']===_0xfe40('0x12')){_0x84aa09[_0xfe40('0x18')]=_0x7e6b70['id'];}else if(_0x7e6b70['endUserType']==='account'){_0x84aa09['AccountId']=_0x7e6b70['id'];}else if(_0x7e6b70[_0xfe40('0x11')]===_0xfe40('0x13')&&_0x53531b['leadId']){_0x84aa09[_0x53531b['leadId']]=_0x7e6b70['id'];}else{logger[_0xfe40('0x19')](_0xfe40('0x1a'));}}}return _0x4e2c85[_0xfe40('0x1b')](_0x53531b[_0xfe40('0xb')])['create'](_0x84aa09);}function getUser(_0x13074e,_0x2d64de,_0x237829){if(!_[_0xfe40('0x1c')](_0x2d64de)&&intUtil[_0xfe40('0x1d')](_0x2d64de)){var _0x255c56={'Email':_0x2d64de};var _0x58f69a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x237829['sobject'](_0xfe40('0x1e'))['find'](_0x255c56,_0x58f69a)[_0xfe40('0x1f')]()[_0xfe40('0x20')](function(_0x6adcfa){if(_0x6adcfa[_0xfe40('0x21')]){var _0x540913=_[_0xfe40('0x22')](_0x6adcfa,function(_0x26fd24){return _0x26fd24['Email']===_0x2d64de;});if(_0x540913){logger['info'](_0xfe40('0x23'),_0x2d64de);return BPromise[_0xfe40('0x24')]({'id':_0x540913['Id'],'name':_0x540913['Name']});}}else{logger[_0xfe40('0x19')](_0xfe40('0x25'),_0x2d64de);return _0x237829[_0xfe40('0x26')]()['then'](function(_0x2ed794){return BPromise[_0xfe40('0x24')]({'id':_0x2ed794[_0xfe40('0x27')],'name':_0x2ed794[_0xfe40('0x28')]});});}});}else{logger[_0xfe40('0x19')](_0xfe40('0x25'),_0x2d64de);return _0x237829[_0xfe40('0x26')]()[_0xfe40('0x20')](function(_0x54abd5){return BPromise['resolve']({'id':_0x54abd5[_0xfe40('0x27')],'name':_0x54abd5['display_name']});});}}function getEndUser(_0x20e791,_0x5edca3,_0x1a7df2,_0x3ef799,_0x54af8c){var _0x14816d={'$or':{'Phone':_0x3ef799}};var _0x4d146c={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xfe40('0x24')]()[_0xfe40('0x20')](function(){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x3ef799,_0x5edca3[_0xfe40('0x29')]);switch(_0x5edca3[_0xfe40('0x29')]){case _0xfe40('0x2a'):var _0x1fe22f=_[_0xfe40('0x2b')](_0x14816d);if(_0x5edca3[_0xfe40('0x2c')]){var _0x143aa9={};_0x143aa9[_0x5edca3[_0xfe40('0x2c')]]=_0x3ef799;_[_0xfe40('0x2d')](_0x1fe22f['$or'],_0x143aa9);}return _0x54af8c[_0xfe40('0x1b')](_0xfe40('0x2e'))[_0xfe40('0x22')](_0x1fe22f,_0x4d146c)[_0xfe40('0x1f')]()['then'](function(_0x727b47){if(_0x727b47&&_0x727b47[_0xfe40('0x21')]){return _0x727b47;}else{var _0x5b109c=_[_0xfe40('0x2b')](_0x14816d);if(_0x5edca3[_0xfe40('0x2f')]){var _0x4acf6c={};_0x4acf6c[_0x5edca3['additionalSearchLead']]=_0x3ef799;_[_0xfe40('0x2d')](_0x5b109c[_0xfe40('0x30')],_0x4acf6c);}return _0x54af8c[_0xfe40('0x1b')](_0xfe40('0x31'))[_0xfe40('0x22')](_0x5b109c,_0x4d146c);}});case _0xfe40('0x32'):var _0x12aa19=_[_0xfe40('0x2b')](_0x14816d);if(_0x5edca3[_0xfe40('0x33')]){var _0x143aa9={};_0x143aa9[_0x5edca3[_0xfe40('0x33')]]=_0x3ef799;_[_0xfe40('0x2d')](_0x12aa19['$or'],_0x143aa9);}return _0x54af8c['sobject'](_0xfe40('0x34'))[_0xfe40('0x22')](_0x12aa19,_0x4d146c)[_0xfe40('0x1f')]()[_0xfe40('0x20')](function(_0x73c5d9){if(_0x73c5d9&&_0x73c5d9['length']){return _0x73c5d9;}else{var _0x34eb8c=_['cloneDeep'](_0x14816d);if(_0x5edca3[_0xfe40('0x2c')]){var _0x280de={};_0x280de[_0x5edca3[_0xfe40('0x2c')]]=_0x3ef799;_[_0xfe40('0x2d')](_0x34eb8c[_0xfe40('0x30')],_0x280de);}return _0x54af8c[_0xfe40('0x1b')](_0xfe40('0x2e'))[_0xfe40('0x22')](_0x34eb8c,_0x4d146c)[_0xfe40('0x20')](function(_0x26dd11){if(_0x26dd11&&_0x26dd11[_0xfe40('0x21')]){return _0x26dd11;}else{var _0x298fc5=_['cloneDeep'](_0x14816d);if(_0x5edca3['additionalSearchLead']){var _0x2abda9={};_0x2abda9[_0x5edca3[_0xfe40('0x2f')]]=_0x3ef799;_[_0xfe40('0x2d')](_0x298fc5[_0xfe40('0x30')],_0x2abda9);}return _0x54af8c[_0xfe40('0x1b')](_0xfe40('0x31'))[_0xfe40('0x22')](_0x298fc5,_0x4d146c);}});}});case _0xfe40('0x12'):var _0x1fe22f=_['cloneDeep'](_0x14816d);if(_0x5edca3[_0xfe40('0x2c')]){var _0x143aa9={};_0x143aa9[_0x5edca3['additionalSearchContact']]=_0x3ef799;_['merge'](_0x1fe22f[_0xfe40('0x30')],_0x143aa9);}return _0x54af8c['sobject'](_0xfe40('0x2e'))[_0xfe40('0x22')](_0x1fe22f,_0x4d146c)[_0xfe40('0x1f')]();case _0xfe40('0x13'):var _0x151fcc=_[_0xfe40('0x2b')](_0x14816d);if(_0x5edca3[_0xfe40('0x2f')]){var _0x143aa9={};_0x143aa9[_0x5edca3[_0xfe40('0x2f')]]=_0x3ef799;_[_0xfe40('0x2d')](_0x151fcc[_0xfe40('0x30')],_0x143aa9);}return _0x54af8c[_0xfe40('0x1b')](_0xfe40('0x31'))[_0xfe40('0x22')](_0x151fcc,_0x4d146c);case'account':var _0x12aa19=_[_0xfe40('0x2b')](_0x14816d);if(_0x5edca3[_0xfe40('0x33')]){var _0x143aa9={};_0x143aa9[_0x5edca3[_0xfe40('0x33')]]=_0x3ef799;_[_0xfe40('0x2d')](_0x12aa19[_0xfe40('0x30')],_0x143aa9);}return _0x54af8c[_0xfe40('0x1b')](_0xfe40('0x34'))[_0xfe40('0x22')](_0x12aa19,_0x4d146c);default:return null;}})['then'](function(_0x2eb1c1){if(_0x2eb1c1&&_0x2eb1c1[_0xfe40('0x21')]){var _0x29ed48=_[_0xfe40('0x35')](_0x2eb1c1);if(_0x29ed48){return BPromise['resolve']({'id':_0x29ed48['Id'],'name':_0x29ed48[_0xfe40('0x36')],'phone':_0x29ed48[_0xfe40('0x37')],'endUserType':_0x29ed48['attributes'][_0xfe40('0x38')][_0xfe40('0x39')]()});}}})['then'](function(_0x3c551b){if(_0x3c551b){logger['info']('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x3c551b[_0xfe40('0x11')],_0x3ef799);return BPromise[_0xfe40('0x24')](_0x3c551b);}else{logger[_0xfe40('0x19')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x3ef799);var _0x5027b7={'Phone':_0x3ef799};if(_0x5edca3[_0xfe40('0x3a')]){if(_0x5edca3[_0xfe40('0x3a')]===_0xfe40('0x12')){logger[_0xfe40('0x19')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3ef799,_0x5edca3[_0xfe40('0x3a')]);_0x5027b7[_0xfe40('0x3b')]=_0x1a7df2!==_0xfe40('0x3c')?_0x1a7df2:util[_0xfe40('0x3d')](_0xfe40('0x3e'),_0x3ef799);}else if(_0x5edca3['moduleCreate']===_0xfe40('0x13')){logger[_0xfe40('0x19')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3ef799,_0x5edca3[_0xfe40('0x3a')]);_0x5027b7['LastName']=_0x1a7df2!==_0xfe40('0x3c')?_0x1a7df2:util[_0xfe40('0x3d')](_0xfe40('0x3e'),_0x3ef799);_0x5027b7[_0xfe40('0x3f')]=_0xfe40('0x40');}else if(_0x5edca3[_0xfe40('0x3a')]==='account'){logger[_0xfe40('0x19')](_0xfe40('0x41'),_0x3ef799,_0x5edca3[_0xfe40('0x3a')]);_0x5027b7[_0xfe40('0x36')]=_0x1a7df2!==_0xfe40('0x3c')?_0x1a7df2:util[_0xfe40('0x3d')](_0xfe40('0x3e'),_0x3ef799);}else{return null;}}return _0x54af8c[_0xfe40('0x1b')](_[_0xfe40('0x42')](_0x5edca3[_0xfe40('0x3a')]))['create'](_0x5027b7)[_0xfe40('0x20')](function(_0x7b8c0e){return BPromise['resolve']({'id':_0x7b8c0e['id'],'endUserType':_0x5edca3[_0xfe40('0x3a')]});});}});}function getCustomFields(_0x1cad98,_0xe60f75){var _0x31abdf={};if(_0x1cad98['length']>0x0){_[_0xfe40('0x43')](_0x1cad98,function(_0x350a4c){if(_['includes']([_0xfe40('0x44'),_0xfe40('0x45')],_0x350a4c['type'])&&_0x350a4c[_0xfe40('0x46')]){_0x31abdf[_0x350a4c[_0xfe40('0x46')]]=_0x350a4c[_0xfe40('0x47')][_0xfe40('0x48')]();}else if(_0x350a4c['type']==='variable'&&_0x350a4c[_0xfe40('0x49')]&&_0x350a4c[_0xfe40('0x46')]){_0xe60f75[_0x350a4c[_0xfe40('0x49')]]&&(_0x31abdf[_0x350a4c[_0xfe40('0x46')]]=_0xe60f75[_0x350a4c[_0xfe40('0x49')]]['toString']());}else if(_0x350a4c[_0xfe40('0x38')]===_0xfe40('0x4a')&&_0x350a4c[_0xfe40('0x4b')]&&_0x350a4c['Variable'][_0xfe40('0x4c')]&&_0x350a4c['idField']){_0xe60f75[_0x350a4c[_0xfe40('0x4b')][_0xfe40('0x4c')][_0xfe40('0x39')]()]&&(_0x31abdf[_0x350a4c[_0xfe40('0x46')]]=_0xe60f75[_0x350a4c[_0xfe40('0x4b')][_0xfe40('0x4c')][_0xfe40('0x39')]()][_0xfe40('0x48')]());}});}return _0x31abdf;}function getConnection(_0x232a44){var _0x55074b=_0x232a44[_0xfe40('0x4d')][_0xfe40('0x4e')](_0x232a44[_0xfe40('0x4f')]);var _0x211b44=new jsforce[(_0xfe40('0x50'))]({'oauth2':{'loginUrl':_0x232a44['remoteUri']||_0xfe40('0x51'),'clientId':_0x232a44[_0xfe40('0x52')],'clientSecret':_0x232a44[_0xfe40('0x53')]}});return _0x211b44[_0xfe40('0x54')](_0x232a44[_0xfe40('0x55')],_0x55074b)[_0xfe40('0x20')](function(){logger[_0xfe40('0x19')](_0xfe40('0x56'));return _0x211b44;});}exports[_0xfe40('0x57')]=function(_0xa582aa,_0x279de7,_0x527852,_0x3ee22a,_0x712cd5,_0x5eb550){var _0x403479,_0x2512c4,_0x48e9e3,_0x2625b3;_0x5eb550[_0xfe40('0x58')]=intUtil[_0xfe40('0x59')](_0x5eb550[_0xfe40('0x58')]);_0x5eb550[_0xfe40('0x5a')]=intUtil[_0xfe40('0x59')](_0x5eb550[_0xfe40('0x5a')]);if(_0x712cd5&&_0x712cd5[_0xfe40('0x5b')]){logger[_0xfe40('0x19')](_0xfe40('0x5c'),'Recording\x20is\x20enabled!');_0x279de7[_0xfe40('0x5d')]=util['format'](_0xfe40('0x5e'),_0x5eb550[_0xfe40('0x58')],_0x279de7[_0xfe40('0x5f')],md5(_0x279de7['uniqueid']));}else{_0x279de7[_0xfe40('0x5d')]='';}return getConnection(_0x5eb550)['then'](function(_0x5d09c9){_0x2625b3=_0x5d09c9;return getUser(_0x5eb550,_0x3ee22a[_0xfe40('0x60')],_0x2625b3);})['then'](function(_0x21b952){_0x403479=_0x21b952;return getEndUser(_0x5eb550,_0x527852,_0x279de7['calleridname'],_0x279de7['calleridnum'],_0x2625b3);})['then'](function(_0x3e4e7e){_0x2512c4=_0x3e4e7e;return getTicket(_0x5eb550,_0x403479,_0x2512c4,_0x527852,_0x279de7,_0x527852[_0xfe40('0x61')],_0x2625b3,'queue');})[_0xfe40('0x20')](function(_0x461d35){_0x48e9e3=_0x461d35;logger[_0xfe40('0x19')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x48e9e3['id']);logger[_0xfe40('0x19')](_0xfe40('0x62'),_0x48e9e3['id'],_0x3ee22a[_0xfe40('0x4c')],_0x5eb550[_0xfe40('0x38')]);switch(_0x5eb550[_0xfe40('0x38')]){case _0xfe40('0x63'):emit(util[_0xfe40('0x3d')](_0xfe40('0x64'),_0x3ee22a[_0xfe40('0x4c')]),'trigger:salesforce:display',{'recordId':_0x48e9e3['id']});break;case _0xfe40('0x65'):emit(util[_0xfe40('0x3d')](_0xfe40('0x64'),_0x3ee22a[_0xfe40('0x4c')]),_0xfe40('0x66'),{'uri':util[_0xfe40('0x3d')](_0xfe40('0x67'),_0x2625b3[_0xfe40('0x68')],_0x48e9e3['id'])});break;default:logger[_0xfe40('0x69')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xfe40('0x6a')](function(_0x1bf45b){logger['error'](_0xfe40('0x5c'),_0x1bf45b);});};exports[_0xfe40('0x6b')]=function(_0x42add8,_0x2b74e2,_0x547a13,_0x6bc1f5,_0x483ada,_0xa7ebf8,_0x2b56e3){var _0x3f1126,_0x219d77,_0x182e5d,_0x78387c;_0xa7ebf8[_0xfe40('0x58')]=intUtil[_0xfe40('0x59')](_0xa7ebf8[_0xfe40('0x58')]);_0xa7ebf8[_0xfe40('0x5a')]=intUtil[_0xfe40('0x59')](_0xa7ebf8[_0xfe40('0x5a')]);if(_0x2b56e3&&_0x2b56e3[_0xfe40('0x6c')]&&_0x2b56e3['recordingFormat']!==_0xfe40('0x6d')){logger[_0xfe40('0x19')](_0xfe40('0x6e'),_0xfe40('0x6f'));_0x2b74e2[_0xfe40('0x5d')]=util['format'](_0xfe40('0x5e'),_0xa7ebf8[_0xfe40('0x58')],_0x2b74e2[_0xfe40('0x5f')],md5(_0x2b74e2[_0xfe40('0x5f')]));}return getConnection(_0xa7ebf8)[_0xfe40('0x20')](function(_0x3841f8){_0x78387c=_0x3841f8;return getUser(_0xa7ebf8,_0x6bc1f5[_0xfe40('0x60')],_0x78387c);})[_0xfe40('0x20')](function(_0x366aff){_0x3f1126=_0x366aff;return getEndUser(_0xa7ebf8,_0x547a13,_0x2b74e2['destcalleridname'],_0x2b74e2[_0xfe40('0x70')],_0x78387c);})[_0xfe40('0x20')](function(_0x3d25af){_0x219d77=_0x3d25af;return getTicket(_0xa7ebf8,_0x3f1126,_0x219d77,_0x547a13,_0x2b74e2,_0x547a13[_0xfe40('0x61')],_0x78387c,'outbound');})[_0xfe40('0x20')](function(_0x31af01){_0x182e5d=_0x31af01;logger[_0xfe40('0x19')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x182e5d['id']);logger[_0xfe40('0x19')](_0xfe40('0x71'),_0x182e5d['id'],_0x6bc1f5[_0xfe40('0x4c')],_0xa7ebf8[_0xfe40('0x38')]);switch(_0xa7ebf8[_0xfe40('0x38')]){case _0xfe40('0x63'):emit(util[_0xfe40('0x3d')](_0xfe40('0x64'),_0x6bc1f5[_0xfe40('0x4c')]),'trigger:salesforce:display',{'recordId':_0x182e5d['id']});break;case _0xfe40('0x65'):emit(util[_0xfe40('0x3d')](_0xfe40('0x64'),_0x6bc1f5[_0xfe40('0x4c')]),'trigger:browser:url',{'uri':util[_0xfe40('0x3d')]('%s/%s/e',_0x78387c[_0xfe40('0x68')],_0x182e5d['id'])});break;default:logger['error'](_0xfe40('0x6e'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xfe40('0x6a')](function(_0x1d4602){logger[_0xfe40('0x69')](_0xfe40('0x6e'),_0x1d4602);});};exports[_0xfe40('0x72')]=function(_0x1892d7,_0x2bbe5e,_0x119691,_0x82de0f,_0x28a908,_0x1dbd7b){var _0x212f5b,_0x1d0698,_0x192a45,_0x43ba65;_0x1dbd7b[_0xfe40('0x58')]=intUtil[_0xfe40('0x59')](_0x1dbd7b[_0xfe40('0x58')]);_0x1dbd7b[_0xfe40('0x5a')]=intUtil[_0xfe40('0x59')](_0x1dbd7b[_0xfe40('0x5a')]);if(_0x28a908&&_0x28a908[_0xfe40('0x5b')]){logger[_0xfe40('0x19')]('['+_0x2bbe5e[_0xfe40('0x73')][_0xfe40('0x74')]()+']',_0xfe40('0x6f'));_0x2bbe5e[_0xfe40('0x5d')]=util[_0xfe40('0x3d')](_0xfe40('0x5e'),_0x1dbd7b['serverUrl'],_0x2bbe5e[_0xfe40('0x5f')],md5(_0x2bbe5e['uniqueid']));}else{_0x2bbe5e[_0xfe40('0x5d')]='';}return getConnection(_0x1dbd7b)['then'](function(_0x2fed1e){_0x43ba65=_0x2fed1e;if(!_[_0xfe40('0x1c')](_0x82de0f)){return getUser(_0x1dbd7b,_0x82de0f[_0xfe40('0x4c')],_0x43ba65);}else{return getUser(_0x1dbd7b,null,_0x43ba65);}})[_0xfe40('0x20')](function(_0x450d85){_0x212f5b=_0x450d85;return getEndUser(_0x1dbd7b,_0x119691,_0x2bbe5e[_0xfe40('0x75')],_0x2bbe5e['calleridnum'],_0x43ba65);})[_0xfe40('0x20')](function(_0x3c116c){_0x1d0698=_0x3c116c;return getTicket(_0x1dbd7b,_0x212f5b,_0x1d0698,_0x119691,_0x2bbe5e,_0x119691['Fields'],_0x43ba65);})[_0xfe40('0x20')](function(_0x39f5b3){_0x192a45=_0x39f5b3;logger['info']('['+_0x2bbe5e[_0xfe40('0x73')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x192a45['id']);logger[_0xfe40('0x19')]('['+_0x2bbe5e[_0xfe40('0x73')]['toUpperCase']()+_0xfe40('0x76'),_0x1dbd7b['type']);})[_0xfe40('0x6a')](function(_0x2b9d07){logger[_0xfe40('0x69')]('['+_0x2bbe5e['lastevent'][_0xfe40('0x74')]()+']',_0x2b9d07);});}; \ 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 3280f7c..a173770 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 _0x5ea4=['customField','toLowerCase','content','type','idField','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','assign','getString','Subjects','Descriptions','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','email','destcalleridnum','unmanaged','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','userId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','System','],\x20EndUser\x20schema','endUserId','sys_id','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','nameField'];(function(_0x292648,_0x5cc1a1){var _0x36de2e=function(_0x183c58){while(--_0x183c58){_0x292648['push'](_0x292648['shift']());}};_0x36de2e(++_0x5cc1a1);}(_0x5ea4,0x187));var _0x45ea=function(_0xabbc35,_0x31bf87){_0xabbc35=_0xabbc35-0x0;var _0x248357=_0x5ea4[_0xabbc35];return _0x248357;};'use strict';var _=require(_0x45ea('0x0'));var Promise=require(_0x45ea('0x1'));var rp=require('request-promise');var util=require('util');var md5=require(_0x45ea('0x2'));var Redis=require(_0x45ea('0x3'));var intUtil=require(_0x45ea('0x4'));var config=require(_0x45ea('0x5'));var logger=require('../../../../config/logger')(_0x45ea('0x6'));config[_0x45ea('0x7')]=_[_0x45ea('0x8')](config[_0x45ea('0x7')],{'host':_0x45ea('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x45ea('0x7')]));function getAdminUser(_0x5f184b,_0x536b3e,_0x31d5e9,_0x4b13bc,_0x5c4f75,_0x2e36f7){return new Promise(function(_0x1456d8,_0x43b230){var _0x59308d={'method':_0x45ea('0xa'),'uri':_0x4b13bc+_0x45ea('0xb')+'&'+_0x5c4f75+'&'+_0x2e36f7,'auth':_0x536b3e,'json':!![]};return rp(_0x59308d)[_0x45ea('0xc')](function(_0x374710){if(_0x374710[_0x45ea('0xd')][_0x45ea('0xe')]>0x0){_0x31d5e9[_0x45ea('0xf')]=_0x374710['result'][0x0]['sys_id'];}logger[_0x45ea('0x10')]('['+[_0x5f184b[_0x45ea('0x11')]()]+_0x45ea('0x12'),_0x31d5e9);_0x1456d8(_0x31d5e9);})[_0x45ea('0x13')](function(_0x2114fc){logger[_0x45ea('0x14')]('['+[_0x5f184b[_0x45ea('0x11')]()]+']',_0x2114fc[_0x45ea('0x15')]);_0x43b230(_0x2114fc['message']);});});}function getUser(_0x22bf8a,_0x11fd93,_0x1ec229,_0x55ee5a,_0x573e96){return function(_0x2af83e){logger[_0x45ea('0x10')]('['+[_0x22bf8a[_0x45ea('0x11')]()]+_0x45ea('0x16'),_0x2af83e);return new Promise(function(_0x18785f,_0x52f0ff){if(intUtil[_0x45ea('0x17')](_0x2af83e[_0x45ea('0x18')])){var _0x4731e2={'method':'GET','uri':_0x1ec229+_0x45ea('0x19')+_0x2af83e[_0x45ea('0x18')]+'&'+_0x55ee5a+'&'+_0x573e96,'auth':_0x11fd93,'json':!![]};logger[_0x45ea('0x10')]('['+[_0x22bf8a[_0x45ea('0x11')]()]+_0x45ea('0x1a'),_0x4731e2);return rp(_0x4731e2)[_0x45ea('0xc')](function(_0x17ecc9){logger['info']('['+[_0x22bf8a[_0x45ea('0x11')]()]+_0x45ea('0x1b'),_0x17ecc9);if(_0x17ecc9[_0x45ea('0xd')][_0x45ea('0xe')]>0x0&&String(_0x17ecc9['result'][0x0][_0x45ea('0x1c')])==='true'){_0x2af83e[_0x45ea('0x1d')]=_0x17ecc9[_0x45ea('0xd')][0x0]['sys_id'];}else{_0x2af83e[_0x45ea('0x1d')]=_0x2af83e[_0x45ea('0xf')];_0x2af83e[_0x45ea('0x18')]=_0x2af83e[_0x45ea('0x1e')];}logger[_0x45ea('0x10')]('['+[_0x22bf8a[_0x45ea('0x11')]()]+'],\x20getUser\x20crm',_0x2af83e);_0x18785f(_0x2af83e);})['catch'](function(_0x3ea4cd){logger[_0x45ea('0x14')]('['+[_0x22bf8a[_0x45ea('0x11')]()]+']',_0x3ea4cd['message']);_0x52f0ff(_0x3ea4cd[_0x45ea('0x15')]);});}else{logger[_0x45ea('0x10')]('['+[_0x22bf8a['toUpperCase']()]+_0x45ea('0x1f'));_0x2af83e['userId']=_0x2af83e[_0x45ea('0xf')];_0x2af83e[_0x45ea('0x18')]=_0x2af83e['adminEmail'];_0x18785f(_0x2af83e);}});};}function createEndUser(_0x259463,_0x4816b3,_0x3a2519,_0x11e7ed,_0x418ee4){logger['info']('['+[_0x259463[_0x45ea('0x11')]()]+_0x45ea('0x20'),_0x3a2519);return new Promise(function(_0x332dfc,_0x2246fe){var _0x154831={'method':_0x45ea('0x21'),'uri':_0x11e7ed+_0x45ea('0x22')+_0x418ee4,'body':{'user_name':_0x3a2519['endUserNumber'],'roles':_0x45ea('0x23'),'first_name':_0x3a2519[_0x45ea('0x24')],'active':_0x45ea('0x25'),'date_format':_0x45ea('0x26'),'phone':_0x3a2519['endUserNumber']},'auth':_0x4816b3,'json':!![]};return rp(_0x154831)[_0x45ea('0xc')](function(_0x1de51f){logger[_0x45ea('0x10')]('['+[_0x259463[_0x45ea('0x11')]()]+_0x45ea('0x27'),_0x1de51f[_0x45ea('0xd')]);_0x3a2519[_0x45ea('0x28')]=_0x1de51f['result'][_0x45ea('0x29')];_0x332dfc(_0x3a2519);})[_0x45ea('0x13')](function(_0xb24ebb){logger[_0x45ea('0x14')]('['+[_0x259463[_0x45ea('0x11')]()]+']',_0xb24ebb[_0x45ea('0x15')]);_0x2246fe(_0xb24ebb[_0x45ea('0x15')]);});});}function getEndUser(_0x5524ea,_0x5a39ff,_0xe5f237,_0x1dc862,_0x2f8935){return function(_0xf5619b){logger['info']('['+[_0x5524ea['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0xf5619b);return new Promise(function(_0x33d090,_0x259c6d){var _0xb886c6={'method':_0x45ea('0xa'),'uri':_0xe5f237+_0x45ea('0x2a')+_0xf5619b['endUserNumber']+'&'+_0x1dc862+'&'+_0x2f8935,'auth':_0x5a39ff,'json':!![]};return rp(_0xb886c6)[_0x45ea('0xc')](function(_0xef4de3){if(_0xef4de3[_0x45ea('0xd')][_0x45ea('0xe')]>0x0){_0xf5619b[_0x45ea('0x28')]=_0xef4de3[_0x45ea('0xd')][0x0][_0x45ea('0x29')];logger[_0x45ea('0x10')]('['+[_0x5524ea[_0x45ea('0x11')]()]+_0x45ea('0x2b'),_0xf5619b);_0x33d090(_0xf5619b);}else{return createEndUser(_0x5524ea,_0x5a39ff,_0xf5619b,_0xe5f237,_0x1dc862)['then'](function(_0x4affe6){logger[_0x45ea('0x10')]('['+[_0x5524ea[_0x45ea('0x11')]()]+_0x45ea('0x2c'),_0x4affe6);_0x33d090(_0x4affe6);});}})['catch'](function(_0x1e39d3){logger[_0x45ea('0x14')]('['+[_0x5524ea[_0x45ea('0x11')]()]+']',_0x1e39d3['message']);_0x259c6d(_0x1e39d3[_0x45ea('0x15')]);});});};}function getCustomFields(_0x19a63d,_0x157e9a){var _0x76e63e={};if(_0x19a63d[_0x45ea('0xe')]>0x0){_[_0x45ea('0x2d')](_0x19a63d,function(_0x1fead5){if(_[_0x45ea('0x2e')]([_0x45ea('0x2f'),'picklist'],_0x1fead5['type'])&&_0x1fead5[_0x45ea('0x30')]&&!_0x1fead5[_0x45ea('0x31')]){_0x76e63e[_0x1fead5['nameField'][_0x45ea('0x32')]()]=_0x1fead5[_0x45ea('0x33')]['toString']();}else if(_[_0x45ea('0x2e')]([_0x45ea('0x2f'),'picklist'],_0x1fead5[_0x45ea('0x34')])&&_0x1fead5[_0x45ea('0x35')]&&_0x1fead5[_0x45ea('0x31')]){_0x76e63e[_0x1fead5[_0x45ea('0x35')][_0x45ea('0x32')]()]=_0x1fead5[_0x45ea('0x33')][_0x45ea('0x36')]();}else if(_0x1fead5[_0x45ea('0x34')]===_0x45ea('0x37')&&_0x1fead5[_0x45ea('0x38')]&&_0x1fead5['idField']&&_0x1fead5[_0x45ea('0x31')]){_0x76e63e[_0x1fead5[_0x45ea('0x35')][_0x45ea('0x32')]()]=_0x157e9a[_0x1fead5['variableName']][_0x45ea('0x36')]();}else if(_0x1fead5[_0x45ea('0x34')]===_0x45ea('0x39')&&_0x1fead5[_0x45ea('0x3a')]&&_0x1fead5[_0x45ea('0x3a')][_0x45ea('0x3b')]&&_0x1fead5['idField']&&_0x1fead5[_0x45ea('0x31')]){_0x76e63e[_0x1fead5[_0x45ea('0x35')][_0x45ea('0x32')]()]=_0x157e9a[_0x1fead5[_0x45ea('0x3a')][_0x45ea('0x3b')][_0x45ea('0x32')]()][_0x45ea('0x36')]();}});}return _0x76e63e;}function getTicket(_0x5e8fc7,_0x4bb334,_0x23ee37,_0x49056e,_0x4f8518,_0xe93bfc){return function(_0x4889a3){logger[_0x45ea('0x10')]('['+[_0x5e8fc7[_0x45ea('0x11')]()]+_0x45ea('0x3c'),_0x4889a3);return new Promise(function(_0x28590c,_0x34e09f){var _0x387110=_0x5e8fc7[_0x45ea('0x32')]()==='outbound'?_0x4889a3[_0x45ea('0x1d')]:_0x4889a3[_0x45ea('0x28')];var _0x4165a9={'method':_0x45ea('0x21'),'uri':_0x23ee37+'incident'+'?'+_0xe93bfc,'body':Object[_0x45ea('0x3d')]({},{'active':_0x45ea('0x25'),'caller_id':_0x387110,'assigned_to':_0x4889a3[_0x45ea('0x1d')],'short_description':intUtil[_0x45ea('0x3e')](_0x49056e[_0x45ea('0x3f')],_0x4f8518,'\x20'),'description':intUtil[_0x45ea('0x3e')](_0x49056e[_0x45ea('0x40')],_0x4f8518,'\x0a')},getCustomFields(_0x49056e['Fields'],_0x4f8518)),'auth':_0x4bb334,'json':!![]};return rp(_0x4165a9)[_0x45ea('0xc')](function(_0x31a9f3){logger[_0x45ea('0x10')]('['+[_0x5e8fc7[_0x45ea('0x11')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x31a9f3[_0x45ea('0xd')]);_0x4889a3[_0x45ea('0x41')]=_0x31a9f3[_0x45ea('0xd')]['sys_id'];_0x4889a3[_0x45ea('0x42')]=_0x31a9f3[_0x45ea('0xd')][_0x45ea('0x43')];logger[_0x45ea('0x10')]('['+[_0x5e8fc7[_0x45ea('0x11')]()]+']\x20getTicket\x20crm',_0x4889a3);_0x28590c(_0x4889a3);})['catch'](function(_0x57b2e5){logger[_0x45ea('0x14')]('['+[_0x5e8fc7[_0x45ea('0x11')]()]+']',_0x57b2e5['message']);_0x34e09f(_0x57b2e5[_0x45ea('0x15')]);});});};}function createRemoteTag(_0x1a4e99,_0x43cef2,_0x278d9f,_0x19715c){return new Promise(function(_0x584165,_0x9f9208){var _0x5e504f={'method':_0x45ea('0x21'),'uri':_0x278d9f+_0x45ea('0x44')+'?'+_0x19715c,'body':{'short_description':_0x1a4e99,'global':!![],'active':!![],'name':_0x1a4e99},'auth':_0x43cef2,'json':!![]};return rp(_0x5e504f)['then'](function(_0x5a724e){var _0x4e8876=_0x5a724e[_0x45ea('0xd')]['sys_id'];_0x584165(_0x4e8876);});});}function getRemoteTag(_0x480d2a,_0x6c6309,_0x28f07d,_0x2be895,_0x333e1d){return new Promise(function(_0x24579f,_0x34ed07){var _0x3ed452={'method':_0x45ea('0xa'),'uri':_0x28f07d+_0x45ea('0x44')+_0x45ea('0x45')+_0x480d2a+'&'+_0x2be895,'auth':_0x6c6309,'json':!![]};return rp(_0x3ed452)[_0x45ea('0xc')](function(_0x52c2ad){if(_0x52c2ad[_0x45ea('0xd')][_0x45ea('0xe')]>0x0){var _0x2ecb02=_0x52c2ad[_0x45ea('0xd')][0x0][_0x45ea('0x29')];_0x24579f(_0x2ecb02);}else{return createRemoteTag(_0x480d2a,_0x6c6309,_0x28f07d,_0x2be895)['then'](function(_0x26d201){_0x24579f(_0x26d201);});}});});}function assignTagToIncident(_0x1b34a3,_0x1f39f0,_0x5cd5b1,_0x4dd04c,_0x24731d){return new Promise(function(_0xebdc27,_0x34b1f2){var _0x81af6a={'method':'POST','uri':_0x5cd5b1+_0x45ea('0x46')+'?'+_0x24731d,'body':{'label':_0x1b34a3,'table':_0x45ea('0x47'),'id_type':'Incident','table_key':_0x4dd04c['ticketId'],'title':_0x45ea('0x48')+_0x4dd04c['ticketNumber'],'id_display':_0x4dd04c[_0x45ea('0x42')]},'auth':_0x1f39f0,'json':!![]};return rp(_0x81af6a)[_0x45ea('0xc')](function(_0x1ca713){_0xebdc27();})['catch'](function(){_0xebdc27();});});}function manageTags(_0x178ea5,_0x231fd4,_0x3712cb,_0x257933,_0x395b59,_0x20f7fb,_0x1f7b8b){return new Promise(function(_0x4df23f,_0x23f12f){var _0x106342=[];_0x231fd4[_0x45ea('0x2d')](function(_0x24a81a){_0x106342[_0x45ea('0x49')](getRemoteTag(_0x24a81a,_0x3712cb,_0x257933,_0x20f7fb,_0x1f7b8b));});return Promise[_0x45ea('0x4a')](_0x106342)[_0x45ea('0xc')](function(_0x4f3a3c){if(_0x4f3a3c[_0x45ea('0xe')]){logger[_0x45ea('0x10')]('['+[_0x178ea5[_0x45ea('0x11')]()]+_0x45ea('0x4b'),_0x4f3a3c);var _0x4e1497=[];_0x4f3a3c[_0x45ea('0x2d')](function(_0x4080fa){_0x4e1497[_0x45ea('0x49')](assignTagToIncident(_0x4080fa,_0x3712cb,_0x257933,_0x395b59,_0x20f7fb));});return Promise[_0x45ea('0x4a')](_0x4e1497)[_0x45ea('0xc')](function(){_0x4df23f();})[_0x45ea('0x13')](function(){_0x4df23f();});}else{_0x4df23f();}});});}function getTags(_0x403ad5,_0x5acfdf,_0x3fe06b,_0x545124,_0x345c5a,_0x116f91){return function(_0xf69f51){return new Promise(function(_0xec3fda,_0x4ff16c){var _0x2fdd67=[];var _0x8c80b7=_0x545124[_0x45ea('0x4c')];if(_0x8c80b7&&_0x8c80b7['length']>0x0){_0x2fdd67=_[_0x45ea('0x4d')](_0x8c80b7,_0x45ea('0x3b'));}if(_0x2fdd67[_0x45ea('0xe')]>0x0){return manageTags(_0x403ad5,_0x2fdd67,_0x5acfdf,_0x3fe06b,_0xf69f51,_0x345c5a,_0x116f91)[_0x45ea('0xc')](function(){_0xec3fda(_0xf69f51);});}else{_0xec3fda(_0xf69f51);}});};}function emit(_0x4f2393,_0x20b7fc,_0x256a1c){var _0x4cb3b2=_0x45ea('0x4e')+_0x45ea('0x4f')+_0x45ea('0x50')+_0x45ea('0x51');var _0x5748cd={'uri':_0x4f2393+_0x45ea('0x52')+_0x256a1c+_0x4cb3b2};io['to'](util[_0x45ea('0x53')]('user:%s',_0x20b7fc))[_0x45ea('0x54')](_0x45ea('0x55'),_0x5748cd);}exports['cs']=function(_0x38a31d,_0x4d9d49,_0xfa930c,_0x2cf117,_0x572ceb,_0x268df2,_0x50dd90,_0x989900){var _0x27de82={};var _0x20d7ca={'user':_0x268df2['username'],'pass':_0x268df2[_0x45ea('0x56')]};var _0xcfcc01=_0x45ea('0x57');var _0x42050f=_0x45ea('0x58');_0x268df2[_0x45ea('0x59')]=intUtil['stripTrailingSlash'](_0x268df2[_0x45ea('0x59')]);_0x268df2[_0x45ea('0x5a')]=intUtil[_0x45ea('0x5b')](_0x268df2[_0x45ea('0x5a')]);var _0x38bbfa=util[_0x45ea('0x53')](_0x45ea('0x5c'),_0x268df2['remoteUri']);_0x27de82[_0x45ea('0x18')]=!_['isNil'](_0x2cf117)?_0x2cf117['email']:null;_0x27de82[_0x45ea('0x1e')]=_0x268df2[_0x45ea('0x5d')];_0x27de82['endUserNumber']=_0x989900['toLowerCase']()==='outbound'?_0x4d9d49[_0x45ea('0x5e')]:_0x4d9d49['calleridnum'];_0x27de82['callDirection']=_0x989900==='queue'||_0x989900===_0x45ea('0x5f')?_0x45ea('0x60'):_0x45ea('0x61');var _0x3f9913=util[_0x45ea('0x53')](_0x45ea('0x62'),_0x268df2['serverUrl'],_0x4d9d49[_0x45ea('0x63')],md5(_0x4d9d49[_0x45ea('0x63')]));if(_0x572ceb&&_0x572ceb[_0x45ea('0x64')]){logger['info'](_0x45ea('0x65'),'Recording\x20is\x20enabled!');_0x4d9d49[_0x45ea('0x66')]=_0x3f9913;}else if(_0x50dd90&&_0x50dd90['recordingFormat']&&_0x50dd90[_0x45ea('0x67')]!==_0x45ea('0x68')){logger[_0x45ea('0x10')](_0x45ea('0x69'),_0x45ea('0x6a'));_0x4d9d49[_0x45ea('0x66')]=_0x3f9913;}else{_0x4d9d49[_0x45ea('0x66')]='';}return getAdminUser(_0x989900,_0x20d7ca,_0x27de82,_0x38bbfa,_0x42050f,_0xcfcc01)[_0x45ea('0xc')](getUser(_0x989900,_0x20d7ca,_0x38bbfa,_0x42050f,_0xcfcc01))[_0x45ea('0xc')](getEndUser(_0x989900,_0x20d7ca,_0x38bbfa,_0x42050f,_0xcfcc01))['then'](getTicket(_0x989900,_0x20d7ca,_0x38bbfa,_0xfa930c,_0x4d9d49,_0x42050f))[_0x45ea('0xc')](function(_0x34e172){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x34e172[_0x45ea('0x41')]));logger[_0x45ea('0x10')](util[_0x45ea('0x53')](_0x45ea('0x6b'),_0x989900));if(_0x989900!=='unmanaged'){logger['info']('['+[_0x989900['toUpperCase']()]+']',_0x45ea('0x6c'));emit(_0x268df2[_0x45ea('0x59')],_0x2cf117[_0x45ea('0x3b')],_0x34e172[_0x45ea('0x41')]);}})[_0x45ea('0x13')](function(_0x4f0863){logger[_0x45ea('0x14')]('['+[_0x989900[_0x45ea('0x11')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x45ea('0x6d')](_0x4f0863,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7429=['uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','catch','message','],\x20getUser\x20input\x20crm','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','includes','string','picklist','nameField','customField','toLowerCase','content','toString','type','idField','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','forEach','push','all','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','isNil','email','destcalleridnum','calleridnum','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x7429,0x6f));var _0x9742=function(_0x50ec7a,_0x309d3a){_0x50ec7a=_0x50ec7a-0x0;var _0x5af71e=_0x7429[_0x50ec7a];return _0x5af71e;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0x9742('0x0'));var util=require('util');var md5=require(_0x9742('0x1'));var Redis=require(_0x9742('0x2'));var intUtil=require('./util');var config=require(_0x9742('0x3'));var logger=require(_0x9742('0x4'))(_0x9742('0x5'));config[_0x9742('0x6')]=_[_0x9742('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9742('0x8'))(new Redis(config[_0x9742('0x6')]));function getAdminUser(_0x4ead4b,_0x240a9f,_0x257625,_0x5af649,_0x3ceed4,_0x169d64){return new Promise(function(_0x1ce654,_0x57107f){var _0xa507f9={'method':'GET','uri':_0x5af649+_0x9742('0x9')+'&'+_0x3ceed4+'&'+_0x169d64,'auth':_0x240a9f,'json':!![]};return rp(_0xa507f9)[_0x9742('0xa')](function(_0x58a1bd){if(_0x58a1bd[_0x9742('0xb')][_0x9742('0xc')]>0x0){_0x257625[_0x9742('0xd')]=_0x58a1bd['result'][0x0][_0x9742('0xe')];}logger[_0x9742('0xf')]('['+[_0x4ead4b[_0x9742('0x10')]()]+'],\x20getAdminUser\x20crm',_0x257625);_0x1ce654(_0x257625);})[_0x9742('0x11')](function(_0x2055d3){logger['error']('['+[_0x4ead4b[_0x9742('0x10')]()]+']',_0x2055d3[_0x9742('0x12')]);_0x57107f(_0x2055d3[_0x9742('0x12')]);});});}function getUser(_0x31160a,_0x674b9f,_0x50af96,_0x2bb5b1,_0x4d69d5){return function(_0x6f4f13){logger[_0x9742('0xf')]('['+[_0x31160a[_0x9742('0x10')]()]+_0x9742('0x13'),_0x6f4f13);return new Promise(function(_0x416614,_0x58c895){if(intUtil['validateEmail'](_0x6f4f13[_0x9742('0x14')])){var _0x4beb18={'method':_0x9742('0x15'),'uri':_0x50af96+_0x9742('0x16')+_0x6f4f13[_0x9742('0x14')]+'&'+_0x2bb5b1+'&'+_0x4d69d5,'auth':_0x674b9f,'json':!![]};logger[_0x9742('0xf')]('['+[_0x31160a[_0x9742('0x10')]()]+_0x9742('0x17'),_0x4beb18);return rp(_0x4beb18)[_0x9742('0xa')](function(_0x7c4c69){logger['info']('['+[_0x31160a[_0x9742('0x10')]()]+_0x9742('0x18'),_0x7c4c69);if(_0x7c4c69[_0x9742('0xb')][_0x9742('0xc')]>0x0&&String(_0x7c4c69['result'][0x0][_0x9742('0x19')])===_0x9742('0x1a')){_0x6f4f13['userId']=_0x7c4c69[_0x9742('0xb')][0x0][_0x9742('0xe')];}else{_0x6f4f13[_0x9742('0x1b')]=_0x6f4f13['adminId'];_0x6f4f13[_0x9742('0x14')]=_0x6f4f13['adminEmail'];}logger[_0x9742('0xf')]('['+[_0x31160a[_0x9742('0x10')]()]+_0x9742('0x1c'),_0x6f4f13);_0x416614(_0x6f4f13);})[_0x9742('0x11')](function(_0x2242de){logger[_0x9742('0x1d')]('['+[_0x31160a[_0x9742('0x10')]()]+']',_0x2242de['message']);_0x58c895(_0x2242de[_0x9742('0x12')]);});}else{logger[_0x9742('0xf')]('['+[_0x31160a[_0x9742('0x10')]()]+_0x9742('0x1e'));_0x6f4f13['userId']=_0x6f4f13['adminId'];_0x6f4f13[_0x9742('0x14')]=_0x6f4f13[_0x9742('0x1f')];_0x416614(_0x6f4f13);}});};}function createEndUser(_0x4b25b7,_0x4a2040,_0x4b237b,_0x25c237,_0x35dd19){logger['info']('['+[_0x4b25b7['toUpperCase']()]+_0x9742('0x20'),_0x4b237b);return new Promise(function(_0x4af874,_0x44cd8a){var _0x4d3778={'method':_0x9742('0x21'),'uri':_0x25c237+_0x9742('0x22')+_0x35dd19,'body':{'user_name':_0x4b237b[_0x9742('0x23')],'roles':_0x9742('0x24'),'first_name':_0x4b237b[_0x9742('0x23')],'active':_0x9742('0x1a'),'date_format':_0x9742('0x25'),'phone':_0x4b237b['endUserNumber']},'auth':_0x4a2040,'json':!![]};return rp(_0x4d3778)[_0x9742('0xa')](function(_0x49d1d1){logger[_0x9742('0xf')]('['+[_0x4b25b7[_0x9742('0x10')]()]+_0x9742('0x26'),_0x49d1d1[_0x9742('0xb')]);_0x4b237b[_0x9742('0x27')]=_0x49d1d1[_0x9742('0xb')][_0x9742('0xe')];_0x4af874(_0x4b237b);})[_0x9742('0x11')](function(_0xa5d889){logger[_0x9742('0x1d')]('['+[_0x4b25b7[_0x9742('0x10')]()]+']',_0xa5d889[_0x9742('0x12')]);_0x44cd8a(_0xa5d889['message']);});});}function getEndUser(_0x20d6af,_0x461b27,_0x29c257,_0x2b9c8d,_0x33b259){return function(_0x29541a){logger[_0x9742('0xf')]('['+[_0x20d6af[_0x9742('0x10')]()]+_0x9742('0x28'),_0x29541a);return new Promise(function(_0x49da32,_0xb17eec){var _0x4c755c={'method':_0x9742('0x15'),'uri':_0x29c257+_0x9742('0x29')+_0x29541a['endUserNumber']+'&'+_0x2b9c8d+'&'+_0x33b259,'auth':_0x461b27,'json':!![]};return rp(_0x4c755c)[_0x9742('0xa')](function(_0x44bf1e){if(_0x44bf1e[_0x9742('0xb')][_0x9742('0xc')]>0x0){_0x29541a['endUserId']=_0x44bf1e['result'][0x0][_0x9742('0xe')];logger[_0x9742('0xf')]('['+[_0x20d6af[_0x9742('0x10')]()]+_0x9742('0x2a'),_0x29541a);_0x49da32(_0x29541a);}else{return createEndUser(_0x20d6af,_0x461b27,_0x29541a,_0x29c257,_0x2b9c8d)['then'](function(_0x22c45c){logger[_0x9742('0xf')]('['+[_0x20d6af[_0x9742('0x10')]()]+'],\x20createEndUser\x20crm',_0x22c45c);_0x49da32(_0x22c45c);});}})[_0x9742('0x11')](function(_0x30760e){logger[_0x9742('0x1d')]('['+[_0x20d6af[_0x9742('0x10')]()]+']',_0x30760e[_0x9742('0x12')]);_0xb17eec(_0x30760e[_0x9742('0x12')]);});});};}function getCustomFields(_0xf3cf17,_0x496ae8){var _0xbbe310={};if(_0xf3cf17[_0x9742('0xc')]>0x0){_['forEach'](_0xf3cf17,function(_0x11ee0c){if(_[_0x9742('0x2b')]([_0x9742('0x2c'),_0x9742('0x2d')],_0x11ee0c['type'])&&_0x11ee0c[_0x9742('0x2e')]&&!_0x11ee0c[_0x9742('0x2f')]){_0xbbe310[_0x11ee0c[_0x9742('0x2e')][_0x9742('0x30')]()]=_0x11ee0c[_0x9742('0x31')][_0x9742('0x32')]();}else if(_[_0x9742('0x2b')]([_0x9742('0x2c'),'picklist'],_0x11ee0c[_0x9742('0x33')])&&_0x11ee0c['idField']&&_0x11ee0c[_0x9742('0x2f')]){_0xbbe310[_0x11ee0c[_0x9742('0x34')][_0x9742('0x30')]()]=_0x11ee0c[_0x9742('0x31')][_0x9742('0x32')]();}else if(_0x11ee0c[_0x9742('0x33')]==='variable'&&_0x11ee0c[_0x9742('0x35')]&&_0x11ee0c[_0x9742('0x34')]&&_0x11ee0c[_0x9742('0x2f')]){_0xbbe310[_0x11ee0c[_0x9742('0x34')][_0x9742('0x30')]()]=_0x496ae8[_0x11ee0c[_0x9742('0x35')]][_0x9742('0x32')]();}else if(_0x11ee0c[_0x9742('0x33')]==='customVariable'&&_0x11ee0c[_0x9742('0x36')]&&_0x11ee0c[_0x9742('0x36')][_0x9742('0x37')]&&_0x11ee0c[_0x9742('0x34')]&&_0x11ee0c[_0x9742('0x2f')]){_0xbbe310[_0x11ee0c[_0x9742('0x34')][_0x9742('0x30')]()]=_0x496ae8[_0x11ee0c[_0x9742('0x36')][_0x9742('0x37')]['toLowerCase']()][_0x9742('0x32')]();}});}return _0xbbe310;}function getTicket(_0x1039e3,_0x4c638a,_0x62c526,_0x1b89e9,_0x5218da,_0x525dbd){return function(_0x94210a){logger[_0x9742('0xf')]('['+[_0x1039e3[_0x9742('0x10')]()]+_0x9742('0x38'),_0x94210a);return new Promise(function(_0x500f4b,_0x32d0f6){var _0x3bf825=_0x1039e3[_0x9742('0x30')]()===_0x9742('0x39')?_0x94210a[_0x9742('0x1b')]:_0x94210a[_0x9742('0x27')];var _0x4d3509={'method':_0x9742('0x21'),'uri':_0x62c526+_0x9742('0x3a')+'?'+_0x525dbd,'body':Object[_0x9742('0x3b')]({},{'active':'true','caller_id':_0x3bf825,'assigned_to':_0x94210a[_0x9742('0x1b')],'short_description':intUtil[_0x9742('0x3c')](_0x1b89e9[_0x9742('0x3d')],_0x5218da,'\x20'),'description':intUtil[_0x9742('0x3c')](_0x1b89e9[_0x9742('0x3e')],_0x5218da,'\x0a')},getCustomFields(_0x1b89e9['Fields'],_0x5218da)),'auth':_0x4c638a,'json':!![]};return rp(_0x4d3509)[_0x9742('0xa')](function(_0x59a2fe){logger['info']('['+[_0x1039e3[_0x9742('0x10')]()]+_0x9742('0x3f'),_0x59a2fe['result']);_0x94210a[_0x9742('0x40')]=_0x59a2fe['result'][_0x9742('0xe')];_0x94210a[_0x9742('0x41')]=_0x59a2fe['result'][_0x9742('0x42')];logger[_0x9742('0xf')]('['+[_0x1039e3[_0x9742('0x10')]()]+']\x20getTicket\x20crm',_0x94210a);_0x500f4b(_0x94210a);})[_0x9742('0x11')](function(_0x3b2be5){logger[_0x9742('0x1d')]('['+[_0x1039e3[_0x9742('0x10')]()]+']',_0x3b2be5['message']);_0x32d0f6(_0x3b2be5['message']);});});};}function createRemoteTag(_0x39fcb0,_0x3e8d23,_0x165d85,_0x65f0d3){return new Promise(function(_0x18d3ea,_0x2eb7d4){var _0x202e82={'method':_0x9742('0x21'),'uri':_0x165d85+'label'+'?'+_0x65f0d3,'body':{'short_description':_0x39fcb0,'global':!![],'active':!![],'name':_0x39fcb0},'auth':_0x3e8d23,'json':!![]};return rp(_0x202e82)[_0x9742('0xa')](function(_0x3999e4){var _0x4a57dc=_0x3999e4[_0x9742('0xb')][_0x9742('0xe')];_0x18d3ea(_0x4a57dc);});});}function getRemoteTag(_0xc5884e,_0x59daee,_0xe26c53,_0x532561,_0x1f02d4){return new Promise(function(_0x51c3b0,_0x7a88a4){var _0xb738f6={'method':_0x9742('0x15'),'uri':_0xe26c53+_0x9742('0x43')+_0x9742('0x44')+_0xc5884e+'&'+_0x532561,'auth':_0x59daee,'json':!![]};return rp(_0xb738f6)[_0x9742('0xa')](function(_0x2ccfb2){if(_0x2ccfb2[_0x9742('0xb')]['length']>0x0){var _0x49a21d=_0x2ccfb2[_0x9742('0xb')][0x0][_0x9742('0xe')];_0x51c3b0(_0x49a21d);}else{return createRemoteTag(_0xc5884e,_0x59daee,_0xe26c53,_0x532561)[_0x9742('0xa')](function(_0x37927e){_0x51c3b0(_0x37927e);});}});});}function assignTagToIncident(_0x130cb2,_0x56e64e,_0x394d8b,_0x5d7129,_0x3d4781){return new Promise(function(_0x3d3c84,_0x1539b9){var _0x160ecb={'method':_0x9742('0x21'),'uri':_0x394d8b+'label_entry'+'?'+_0x3d4781,'body':{'label':_0x130cb2,'table':_0x9742('0x3a'),'id_type':_0x9742('0x45'),'table_key':_0x5d7129[_0x9742('0x40')],'title':_0x9742('0x46')+_0x5d7129[_0x9742('0x41')],'id_display':_0x5d7129[_0x9742('0x41')]},'auth':_0x56e64e,'json':!![]};return rp(_0x160ecb)[_0x9742('0xa')](function(_0x40057a){_0x3d3c84();})[_0x9742('0x11')](function(){_0x3d3c84();});});}function manageTags(_0xc0975d,_0x5dce74,_0x44607e,_0x25d456,_0x454572,_0x403d49,_0x1642a2){return new Promise(function(_0x11c3f7,_0x2f270a){var _0x2bf802=[];_0x5dce74[_0x9742('0x47')](function(_0x5c3cb9){_0x2bf802[_0x9742('0x48')](getRemoteTag(_0x5c3cb9,_0x44607e,_0x25d456,_0x403d49,_0x1642a2));});return Promise[_0x9742('0x49')](_0x2bf802)['then'](function(_0x4dd7d6){if(_0x4dd7d6[_0x9742('0xc')]){logger['info']('['+[_0xc0975d[_0x9742('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x4dd7d6);var _0x5cb862=[];_0x4dd7d6[_0x9742('0x47')](function(_0x1eabc8){_0x5cb862['push'](assignTagToIncident(_0x1eabc8,_0x44607e,_0x25d456,_0x454572,_0x403d49));});return Promise['all'](_0x5cb862)[_0x9742('0xa')](function(){_0x11c3f7();})[_0x9742('0x11')](function(){_0x11c3f7();});}else{_0x11c3f7();}});});}function getTags(_0x11b360,_0x564cd5,_0x3c16a4,_0xc8bf8d,_0x5e2fb3,_0x2fb04c){return function(_0x33b788){return new Promise(function(_0x564481,_0x1f9c54){var _0x794c29=[];var _0x414b5f=_0xc8bf8d['Tags'];if(_0x414b5f&&_0x414b5f[_0x9742('0xc')]>0x0){_0x794c29=_['map'](_0x414b5f,_0x9742('0x37'));}if(_0x794c29['length']>0x0){return manageTags(_0x11b360,_0x794c29,_0x564cd5,_0x3c16a4,_0x33b788,_0x5e2fb3,_0x2fb04c)[_0x9742('0xa')](function(){_0x564481(_0x33b788);});}else{_0x564481(_0x33b788);}});};}function emit(_0x4ee00a,_0x42c61c,_0x3da4d8){var _0x1971e9=_0x9742('0x4a')+_0x9742('0x4b')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x9742('0x4c');var _0x1b7d17={'uri':_0x4ee00a+_0x9742('0x4d')+_0x3da4d8+_0x1971e9};io['to'](util[_0x9742('0x4e')](_0x9742('0x4f'),_0x42c61c))['emit'](_0x9742('0x50'),_0x1b7d17);}exports['cs']=function(_0xe17165,_0x323c9d,_0x2bf46d,_0x2ac2e8,_0x515eaf,_0x1f6797,_0x3e097a,_0x376de3){var _0xf2e934={};var _0x1c66b7={'user':_0x1f6797['username'],'pass':_0x1f6797[_0x9742('0x51')]};var _0xe4c755=_0x9742('0x52');var _0x17fedb=_0x9742('0x53');_0x1f6797[_0x9742('0x54')]=intUtil['stripTrailingSlash'](_0x1f6797[_0x9742('0x54')]);_0x1f6797[_0x9742('0x55')]=intUtil['stripTrailingSlash'](_0x1f6797[_0x9742('0x55')]);var _0x432c2c=util[_0x9742('0x4e')]('%s/api/now/table/',_0x1f6797[_0x9742('0x54')]);_0xf2e934[_0x9742('0x14')]=!_[_0x9742('0x56')](_0x2ac2e8)?_0x2ac2e8['email']:null;_0xf2e934[_0x9742('0x1f')]=_0x1f6797[_0x9742('0x57')];_0xf2e934[_0x9742('0x23')]=_0x376de3[_0x9742('0x30')]()==='outbound'?_0x323c9d[_0x9742('0x58')]:_0x323c9d[_0x9742('0x59')];_0xf2e934['callDirection']=_0x376de3==='queue'||_0x376de3===_0x9742('0x5a')?_0x9742('0x5b'):_0x9742('0x39');var _0x2cf4d9=util[_0x9742('0x4e')](_0x9742('0x5c'),_0x1f6797['serverUrl'],_0x323c9d[_0x9742('0x5d')],md5(_0x323c9d['uniqueid']));if(_0x515eaf&&_0x515eaf['monitor_format']){logger[_0x9742('0xf')]('[QUEUE]',_0x9742('0x5e'));_0x323c9d[_0x9742('0x5f')]=_0x2cf4d9;}else if(_0x3e097a&&_0x3e097a[_0x9742('0x60')]&&_0x3e097a[_0x9742('0x60')]!==_0x9742('0x61')){logger[_0x9742('0xf')](_0x9742('0x62'),_0x9742('0x5e'));_0x323c9d['recordingURL']=_0x2cf4d9;}else{_0x323c9d[_0x9742('0x5f')]='';}return getAdminUser(_0x376de3,_0x1c66b7,_0xf2e934,_0x432c2c,_0x17fedb,_0xe4c755)[_0x9742('0xa')](getUser(_0x376de3,_0x1c66b7,_0x432c2c,_0x17fedb,_0xe4c755))[_0x9742('0xa')](getEndUser(_0x376de3,_0x1c66b7,_0x432c2c,_0x17fedb,_0xe4c755))['then'](getTicket(_0x376de3,_0x1c66b7,_0x432c2c,_0x2bf46d,_0x323c9d,_0x17fedb))['then'](function(_0x593c94){logger['info'](util[_0x9742('0x4e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x593c94[_0x9742('0x40')]));logger['info'](util[_0x9742('0x4e')]('call\x20direction:\x20%s',_0x376de3));if(_0x376de3!==_0x9742('0x5a')){logger['info']('['+[_0x376de3[_0x9742('0x10')]()]+']',_0x9742('0x63'));emit(_0x1f6797[_0x9742('0x54')],_0x2ac2e8[_0x9742('0x37')],_0x593c94[_0x9742('0x40')]);}})['catch'](function(_0x114fa5){logger[_0x9742('0x1d')]('['+[_0x376de3[_0x9742('0x10')]()]+_0x9742('0x64'),util[_0x9742('0x65')](_0x114fa5,{'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 4be8487..fba4dcf 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 _0xaf52=['username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','charAt','[OUTBOUND]','%s/service/v4_1/rest.php','lastevent','toUpperCase','isNil','Ticket\x20created!','lodash','request-promise','md5','ioredis','./util','redis','defaults','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','description','getString','Descriptions','toISOString','slice','replace','duration_minutes','parent_type','parent_name','direction','forEach','variableName','idField','JSON','stringify','Calls','format','Basic\x20%s','apiKey','base64','get_server_info','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','length','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','Contacts','phone_home','find','entry_list','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','','Caller\x20-\x20%s','Enduser\x20created.','first_name','merge','type','string','nameField','customField','toLowerCase','content','toString','push','variable','custom_fields','Variable'];(function(_0x119ec0,_0x206327){var _0x56f82b=function(_0x3db649){while(--_0x3db649){_0x119ec0['push'](_0x119ec0['shift']());}};_0x56f82b(++_0x206327);}(_0xaf52,0x11a));var _0x2af5=function(_0x5ef35e,_0x329db7){_0x5ef35e=_0x5ef35e-0x0;var _0x4cdc0c=_0xaf52[_0x5ef35e];return _0x4cdc0c;};'use strict';var _=require(_0x2af5('0x0'));var rp=require(_0x2af5('0x1'));var BPromise=require('bluebird');var md5=require(_0x2af5('0x2'));var util=require('util');var Redis=require(_0x2af5('0x3'));var intUtil=require(_0x2af5('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('sugarcrm');config[_0x2af5('0x5')]=_[_0x2af5('0x6')](config[_0x2af5('0x5')],{'host':_0x2af5('0x7'),'port':0x18eb});var io=require(_0x2af5('0x8'))(new Redis(config[_0x2af5('0x5')]));var def={'method':_0x2af5('0x9'),'json':!![]};function emit(_0x965644,_0xf8ced4,_0x133598){io['to'](_0x965644)[_0x2af5('0xa')](_0xf8ced4,_0x133598);}function getTicket(_0x5d8552,_0x3a7e9c,_0x55a614,_0x9f01e0,_0xae7e17,_0x2080e3,_0x5d8635,_0x55a796){logger['info'](_0x2af5('0xb'));var _0x12af85=new Date();var _0x3168f4=[{'name':_0x2af5('0xc'),'value':intUtil['getString'](_0x9f01e0[_0x2af5('0xd')],_0xae7e17,'\x20')},{'name':_0x2af5('0xe'),'value':_0x3a7e9c['id']},{'name':'created_by','value':_0x3a7e9c['id']},{'name':_0x2af5('0xf'),'value':intUtil[_0x2af5('0x10')](_0x9f01e0[_0x2af5('0x11')],_0xae7e17,'\x0a')},{'name':'date_start','value':_0x12af85[_0x2af5('0x12')]()[_0x2af5('0x13')](0x0,0x13)[_0x2af5('0x14')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x2af5('0x15'),'value':'15'},{'name':'parent_id','value':_0x55a614['id']},{'name':_0x2af5('0x16'),'value':'Contacts'},{'name':_0x2af5('0x17'),'value':_0x55a614[_0x2af5('0xc')]},{'name':_0x2af5('0x18'),'value':_0x55a796}];if(_0x2080e3['length']){_[_0x2af5('0x19')](_0x2080e3,function(_0x5c5961){if(_0xae7e17[_0x5c5961[_0x2af5('0x1a')]]){_0x3168f4['push']({'name':_0x5c5961[_0x2af5('0x1b')],'value':_0xae7e17[_0x5c5961['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':_0x2af5('0x1c'),'response_type':_0x2af5('0x1c'),'rest_data':JSON[_0x2af5('0x1d')]({'session':_0x5d8635['id'],'module_name':_0x2af5('0x1e'),'name_value_list':_0x3168f4})}});}function getAuth(_0x3773e3){return util[_0x2af5('0x1f')](_0x2af5('0x20'),new Buffer(_0x3773e3[_0x2af5('0x21')]+':X')['toString'](_0x2af5('0x22')));}function getServerInfo(_0x56f359){return request({'form':{'method':_0x2af5('0x23'),'input_type':_0x2af5('0x1c'),'response_type':_0x2af5('0x1c'),'rest_data':JSON[_0x2af5('0x1d')]({'session':_0x56f359['id']})}});}function getUser(_0x5071fc,_0x59ff3b,_0x37fdee){if(!_['isNil'](_0x59ff3b)){logger[_0x2af5('0x24')](_0x2af5('0x25'),_0x59ff3b);return request({'form':{'method':_0x2af5('0x26'),'input_type':_0x2af5('0x1c'),'response_type':_0x2af5('0x1c'),'rest_data':JSON[_0x2af5('0x1d')]({'session':_0x37fdee['id'],'module_name':_0x2af5('0x27'),'query':util[_0x2af5('0x1f')](_0x2af5('0x28'),_0x59ff3b),'order_by':'','offset':'0','select_fields':['id',_0x2af5('0xc'),_0x2af5('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x2af5('0x2a')](function(_0x12e247){if(_0x12e247['entry_list'][_0x2af5('0x2b')]){var _0x684ce1=_['find'](_0x12e247['entry_list'],function(_0x5da571){return _0x5da571[_0x2af5('0x2c')][_0x2af5('0x29')][_0x2af5('0x2d')]===_0x59ff3b;});if(_0x684ce1){logger[_0x2af5('0x24')](_0x2af5('0x2e'));return BPromise[_0x2af5('0x2f')]({'id':_0x684ce1[_0x2af5('0x2c')]['id'][_0x2af5('0x2d')],'name':_0x684ce1['name_value_list'][_0x2af5('0xc')][_0x2af5('0x2d')]});}}logger['info'](_0x2af5('0x30'));return BPromise[_0x2af5('0x2f')]({'id':_0x37fdee[_0x2af5('0x2c')][_0x2af5('0x31')][_0x2af5('0x2d')],'name':_0x37fdee[_0x2af5('0x2c')]['user_name'][_0x2af5('0x2d')]});});}else{logger[_0x2af5('0x24')](_0x2af5('0x32'));return BPromise[_0x2af5('0x2f')]({'id':_0x37fdee[_0x2af5('0x2c')][_0x2af5('0x31')]['value'],'name':_0x37fdee[_0x2af5('0x2c')][_0x2af5('0x29')][_0x2af5('0x2d')]});}}function getEndUser(_0x3445cb,_0x417af8,_0x10adfd,_0x576e63){logger['info'](_0x2af5('0x33'),_0x10adfd);return request({'form':{'method':_0x2af5('0x26'),'input_type':_0x2af5('0x1c'),'response_type':_0x2af5('0x1c'),'rest_data':JSON[_0x2af5('0x1d')]({'session':_0x576e63['id'],'module_name':_0x2af5('0x34'),'query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x10adfd),'order_by':'','offset':'0','select_fields':['id',_0x2af5('0xc'),_0x2af5('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1b8a17){if(_0x1b8a17['entry_list'][_0x2af5('0x2b')]){var _0xa6f53=_[_0x2af5('0x36')](_0x1b8a17[_0x2af5('0x37')],function(_0x8b27fa){return _0x8b27fa[_0x2af5('0x2c')][_0x2af5('0x35')]['value']===_0x10adfd;});if(_0xa6f53){logger['info'](_0x2af5('0x38'));return BPromise[_0x2af5('0x2f')]({'id':_0xa6f53[_0x2af5('0x2c')]['id'][_0x2af5('0x2d')],'name':_0xa6f53[_0x2af5('0x2c')][_0x2af5('0xc')][_0x2af5('0x2d')],'phone':_0xa6f53['name_value_list'][_0x2af5('0x35')][_0x2af5('0x2d')]});}}else{logger[_0x2af5('0x24')](_0x2af5('0x39'));return request({'form':{'method':_0x2af5('0x3a'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x2af5('0x1d')]({'session':_0x576e63['id'],'module_name':_0x2af5('0x34'),'name_value_list':[{'name':'first_name','value':_0x417af8!==_0x2af5('0x3b')?_0x417af8:util['format'](_0x2af5('0x3c'),_0x10adfd)},{'name':_0x2af5('0x35'),'value':_0x10adfd}]})}})['then'](function(_0x35ef69){logger[_0x2af5('0x24')](_0x2af5('0x3d'));return BPromise[_0x2af5('0x2f')]({'id':_0x35ef69['id'],'name':_0x35ef69[_0x2af5('0x37')][_0x2af5('0x3e')][_0x2af5('0x2d')],'phone':_0x35ef69[_0x2af5('0x37')][_0x2af5('0x35')][_0x2af5('0x2d')]});});}});}function request(_0x41fc78){logger['debug']('[HTTP]',JSON[_0x2af5('0x1d')](_0x41fc78));return rp(_[_0x2af5('0x3f')](def,_0x41fc78));}function getTags(_0x149fe3,_0x524ce2){var _0x57bdbb=[];if(_0x149fe3&&_0x149fe3['length']>0x0){_0x57bdbb=_['map'](_0x149fe3,_0x524ce2);}return _0x57bdbb;}function getCustomFields(_0x13cf33,_0x19a1eb){var _0x48fc88=[];var _0x48f51e={'custom_fields':[]};if(_0x13cf33[_0x2af5('0x2b')]>0x0){_[_0x2af5('0x19')](_0x13cf33,function(_0x129d78){if(_0x129d78[_0x2af5('0x40')]===_0x2af5('0x41')&&_0x129d78[_0x2af5('0x42')]&&!_0x129d78[_0x2af5('0x43')]){_0x48f51e[_0x129d78[_0x2af5('0x42')][_0x2af5('0x44')]()]=_0x129d78[_0x2af5('0x45')][_0x2af5('0x46')]();}else if(_0x129d78[_0x2af5('0x40')]==='string'&&_0x129d78[_0x2af5('0x1b')]&&_0x129d78[_0x2af5('0x43')]){_0x48f51e['custom_fields'][_0x2af5('0x47')]({'id':_0x129d78[_0x2af5('0x1b')],'value':_0x129d78['content'][_0x2af5('0x46')]()});}else if(_0x129d78[_0x2af5('0x40')]===_0x2af5('0x48')&&_0x129d78[_0x2af5('0x1a')]&&_0x129d78['idField']&&_0x129d78['customField']){_0x19a1eb[_0x129d78['variableName']]&&_0x48f51e[_0x2af5('0x49')][_0x2af5('0x47')]({'id':_0x129d78['idField'],'value':_0x19a1eb[_0x129d78[_0x2af5('0x1a')]][_0x2af5('0x46')]()});}else if(_0x129d78[_0x2af5('0x40')]==='customVariable'&&_0x129d78[_0x2af5('0x4a')]&&_0x129d78['Variable'][_0x2af5('0xc')]&&_0x129d78[_0x2af5('0x1b')]&&_0x129d78[_0x2af5('0x43')]){_0x19a1eb[_0x129d78[_0x2af5('0x4a')]['name'][_0x2af5('0x44')]()]&&_0x48f51e[_0x2af5('0x49')]['push']({'id':_0x129d78[_0x2af5('0x1b')],'value':_0x19a1eb[_0x129d78[_0x2af5('0x4a')][_0x2af5('0xc')][_0x2af5('0x44')]()]['toString']()});}});}return _0x48f51e;}function getConnection(_0x1b6d62){return request({'method':'POST','form':{'method':'login','input_type':_0x2af5('0x1c'),'response_type':'JSON','rest_data':JSON[_0x2af5('0x1d')]({'user_auth':{'user_name':_0x1b6d62[_0x2af5('0x4b')],'password':_0x1b6d62[_0x2af5('0x4c')],'encryption':'PLAIN'},'application':_0x2af5('0x4d')})}})[_0x2af5('0x2a')](function(_0x1cd9c7){var _0x3569d5=_0x1cd9c7;if(_0x3569d5['id']){def[_0x2af5('0x4e')]=_0x3569d5['id'];return BPromise['resolve'](_0x3569d5);}else{throw new Error(util[_0x2af5('0x1f')](_0x2af5('0x4f'),_0x1b6d62['id']));}});}function setRelationship(_0x2b1fdc,_0x2223d6,_0x934fd0,_0x41793c){return request({'form':{'method':_0x2af5('0x50'),'input_type':_0x2af5('0x1c'),'response_type':_0x2af5('0x1c'),'rest_data':JSON[_0x2af5('0x1d')]({'session':_0x2b1fdc['id'],'module_name':_0x2af5('0x1e'),'module_id':_0x934fd0['id'],'link_field_name':_0x41793c,'related_ids':[_0x2223d6['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x20f7d8,_0x3edfce,_0x116e0b,_0x5d1b44,_0x4c8f66,_0x583b5e){var _0x8b15a5,_0x296ad7,_0x30fcc3,_0x549025;_0x583b5e['remoteUri']=intUtil['stripTrailingSlash'](_0x583b5e[_0x2af5('0x51')]);_0x583b5e[_0x2af5('0x52')]=intUtil[_0x2af5('0x53')](_0x583b5e['serverUrl']);def['uri']=util[_0x2af5('0x1f')]('%s/service/v4_1/rest.php',_0x583b5e[_0x2af5('0x51')]);if(_0x4c8f66&&_0x4c8f66[_0x2af5('0x54')]){logger[_0x2af5('0x24')](_0x2af5('0x55'),'Recording\x20is\x20enabled!');_0x3edfce['recordingURL']=util[_0x2af5('0x1f')](_0x2af5('0x56'),_0x583b5e[_0x2af5('0x52')],_0x3edfce['uniqueid'],md5(_0x3edfce[_0x2af5('0x57')]));}else{_0x3edfce[_0x2af5('0x58')]='';}return getConnection(_0x583b5e)[_0x2af5('0x2a')](function(_0x3faeb7){_0x549025=_0x3faeb7;return getUser(_0x583b5e,_0x5d1b44[_0x2af5('0xc')],_0x549025);})[_0x2af5('0x2a')](function(_0x1ae960){_0x8b15a5=_0x1ae960;logger[_0x2af5('0x24')](_0x2af5('0x59'),_0x8b15a5['id']);return getEndUser(_0x583b5e,_0x3edfce[_0x2af5('0x5a')],_0x3edfce[_0x2af5('0x5b')],_0x549025);})['then'](function(_0x5ad95a){_0x296ad7=_0x5ad95a;logger['info'](_0x2af5('0x5c'),_0x296ad7['id']);return getTicket(_0x583b5e,_0x8b15a5,_0x296ad7,_0x116e0b,_0x3edfce,_0x116e0b[_0x2af5('0x5d')],_0x549025,_0x2af5('0x5e'));})[_0x2af5('0x2a')](function(_0x515585){_0x30fcc3=_0x515585;logger['info']('Ticket\x20created!');logger[_0x2af5('0x24')](_0x2af5('0x5f'),_0x30fcc3['id']);return setRelationship(_0x549025,_0x8b15a5,_0x30fcc3,_0x2af5('0x60'));})['then'](function(){return setRelationship(_0x549025,_0x296ad7,_0x30fcc3,_0x2af5('0x61'));})[_0x2af5('0x2a')](function(){return getServerInfo(_0x549025);})['then'](function(_0x40568b){var _0x275988=parseInt(_0x40568b[_0x2af5('0x62')]['charAt'](0x0));var _0x5a0e98=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x583b5e[_0x2af5('0x51')],_0x30fcc3['id']);if(_0x275988>0x6){_0x5a0e98=util[_0x2af5('0x1f')](_0x2af5('0x63'),_0x583b5e['remoteUri'],_0x30fcc3['id']);}logger[_0x2af5('0x24')](_0x2af5('0x55'),_0x2af5('0x64'));emit(util[_0x2af5('0x1f')](_0x2af5('0x65'),_0x5d1b44[_0x2af5('0xc')]),_0x2af5('0x66'),{'uri':_0x5a0e98});})[_0x2af5('0x67')](function(_0x533438){logger[_0x2af5('0x68')](_0x2af5('0x55'),JSON[_0x2af5('0x1d')](_0x533438));});};exports[_0x2af5('0x69')]=function(_0x2aaf86,_0x5ebccf,_0x1773c7,_0x4bd9e0,_0x532fa0,_0x466778,_0x17c264){var _0x5f4048,_0x54d64a,_0x43e371,_0x370364;_0x466778[_0x2af5('0x51')]=intUtil[_0x2af5('0x53')](_0x466778['remoteUri']);_0x466778[_0x2af5('0x52')]=intUtil['stripTrailingSlash'](_0x466778[_0x2af5('0x52')]);def['uri']=util[_0x2af5('0x1f')]('%s/service/v4_1/rest.php',_0x466778[_0x2af5('0x51')]);if(_0x17c264&&_0x17c264[_0x2af5('0x6a')]&&_0x17c264['recordingFormat']!==_0x2af5('0x6b')){logger[_0x2af5('0x24')]('[OUTBOUND]',_0x2af5('0x6c'));_0x5ebccf[_0x2af5('0x58')]=util[_0x2af5('0x1f')](_0x2af5('0x56'),_0x466778[_0x2af5('0x52')],_0x5ebccf[_0x2af5('0x57')],md5(_0x5ebccf[_0x2af5('0x57')]));}return getConnection(_0x466778)[_0x2af5('0x2a')](function(_0xcabbe7){_0x370364=_0xcabbe7;return getUser(_0x466778,_0x4bd9e0[_0x2af5('0xc')],_0x370364);})[_0x2af5('0x2a')](function(_0x5a2302){_0x5f4048=_0x5a2302;logger[_0x2af5('0x24')](_0x2af5('0x59'),_0x5f4048['id']);return getEndUser(_0x466778,_0x5ebccf[_0x2af5('0x6d')],_0x5ebccf[_0x2af5('0x6e')],_0x370364);})['then'](function(_0x3695c9){_0x54d64a=_0x3695c9;logger[_0x2af5('0x24')](_0x2af5('0x5c'),_0x54d64a['id']);return getTicket(_0x466778,_0x5f4048,_0x54d64a,_0x1773c7,_0x5ebccf,_0x1773c7[_0x2af5('0x5d')],_0x370364,_0x2af5('0x6f'));})['then'](function(_0x68f173){_0x43e371=_0x68f173;logger[_0x2af5('0x24')]('Ticket\x20created!');logger[_0x2af5('0x24')](_0x2af5('0x5f'),_0x43e371['id']);return setRelationship(_0x370364,_0x5f4048,_0x43e371,'users');})['then'](function(){return setRelationship(_0x370364,_0x54d64a,_0x43e371,_0x2af5('0x61'));})['then'](function(){return getServerInfo(_0x370364);})[_0x2af5('0x2a')](function(_0x4386b8){var _0x311223=parseInt(_0x4386b8[_0x2af5('0x62')][_0x2af5('0x70')](0x0));var _0x910ff0=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x466778[_0x2af5('0x51')],_0x43e371['id']);if(_0x311223>0x6){_0x910ff0=util['format'](_0x2af5('0x63'),_0x466778[_0x2af5('0x51')],_0x43e371['id']);}logger[_0x2af5('0x24')](_0x2af5('0x71'),_0x2af5('0x64'));emit(util[_0x2af5('0x1f')](_0x2af5('0x65'),_0x4bd9e0[_0x2af5('0xc')]),_0x2af5('0x66'),{'uri':_0x910ff0});})[_0x2af5('0x67')](function(_0x1f1f52){logger[_0x2af5('0x68')]('[OUTBOUND]',JSON['stringify'](_0x1f1f52));});};exports['unmanaged']=function(_0x32e63c,_0x2ab2f4,_0x5c2823,_0x4792c1,_0x4104ba,_0x4cfbe6){var _0x56f9a8,_0x267cd8,_0x367306,_0x556587;_0x4cfbe6['remoteUri']=intUtil[_0x2af5('0x53')](_0x4cfbe6[_0x2af5('0x51')]);_0x4cfbe6['serverUrl']=intUtil[_0x2af5('0x53')](_0x4cfbe6['serverUrl']);def['uri']=util[_0x2af5('0x1f')](_0x2af5('0x72'),_0x4cfbe6[_0x2af5('0x51')]);if(_0x4104ba&&_0x4104ba['monitor_format']){logger[_0x2af5('0x24')]('['+_0x2ab2f4[_0x2af5('0x73')][_0x2af5('0x74')]()+']',_0x2af5('0x6c'));_0x2ab2f4['recordingURL']=util[_0x2af5('0x1f')](_0x2af5('0x56'),_0x4cfbe6[_0x2af5('0x52')],_0x2ab2f4['uniqueid'],md5(_0x2ab2f4[_0x2af5('0x57')]));}else{_0x2ab2f4[_0x2af5('0x58')]='';}return getConnection(_0x4cfbe6)['then'](function(_0x2f5de5){_0x556587=_0x2f5de5;if(!_[_0x2af5('0x75')](_0x4792c1)){return getUser(_0x4cfbe6,_0x4792c1[_0x2af5('0xc')],_0x556587);}else{return getUser(_0x4cfbe6,null,_0x556587);}})[_0x2af5('0x2a')](function(_0x122e56){_0x56f9a8=_0x122e56;logger[_0x2af5('0x24')](_0x2af5('0x59'),_0x56f9a8['id']);return getEndUser(_0x4cfbe6,_0x2ab2f4[_0x2af5('0x5a')],_0x2ab2f4['calleridnum'],_0x556587);})[_0x2af5('0x2a')](function(_0x4277e5){_0x267cd8=_0x4277e5;logger[_0x2af5('0x24')](_0x2af5('0x5c'),_0x267cd8['id']);return getTicket(_0x4cfbe6,_0x56f9a8,_0x267cd8,_0x5c2823,_0x2ab2f4,_0x5c2823[_0x2af5('0x5d')],_0x556587,'Inbound');})[_0x2af5('0x2a')](function(_0x3743a5){_0x367306=_0x3743a5;logger[_0x2af5('0x24')](_0x2af5('0x76'));logger[_0x2af5('0x24')](_0x2af5('0x5f'),_0x367306['id']);return setRelationship(_0x556587,_0x56f9a8,_0x367306,_0x2af5('0x60'));})[_0x2af5('0x2a')](function(){return setRelationship(_0x556587,_0x267cd8,_0x367306,_0x2af5('0x61'));})[_0x2af5('0x2a')](function(){return getServerInfo(_0x556587);})[_0x2af5('0x67')](function(_0x29f039){logger[_0x2af5('0x68')]('['+_0x2ab2f4['lastevent'][_0x2af5('0x74')]()+']',JSON['stringify'](_0x29f039));});}; \ No newline at end of file +var _0x59b1=['find','name_value_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','[HTTP]','map','forEach','string','nameField','customField','toLowerCase','content','type','idField','custom_fields','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','Outbound','users','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','catch','lastevent','toUpperCase','lodash','bluebird','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','toISOString','slice','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','length','variableName','push','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list'];(function(_0x25c9a1,_0x3acf1c){var _0x59731d=function(_0x2a7f60){while(--_0x2a7f60){_0x25c9a1['push'](_0x25c9a1['shift']());}};_0x59731d(++_0x3acf1c);}(_0x59b1,0x131));var _0x159b=function(_0x4c28d7,_0x1d8c30){_0x4c28d7=_0x4c28d7-0x0;var _0x443270=_0x59b1[_0x4c28d7];return _0x443270;};'use strict';var _=require(_0x159b('0x0'));var rp=require('request-promise');var BPromise=require(_0x159b('0x1'));var md5=require('md5');var util=require(_0x159b('0x2'));var Redis=require(_0x159b('0x3'));var intUtil=require('./util');var config=require(_0x159b('0x4'));var logger=require(_0x159b('0x5'))(_0x159b('0x6'));config[_0x159b('0x7')]=_[_0x159b('0x8')](config[_0x159b('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x159b('0x9'))(new Redis(config[_0x159b('0x7')]));var def={'method':_0x159b('0xa'),'json':!![]};function emit(_0x3f612b,_0x14c8c3,_0x144b1f){io['to'](_0x3f612b)[_0x159b('0xb')](_0x14c8c3,_0x144b1f);}function getTicket(_0x39ab27,_0x279786,_0x3fd4b2,_0x152e0a,_0x13189f,_0x17ef30,_0x39dcdc,_0x9aa057){logger[_0x159b('0xc')]('Creating\x20new\x20ticket...');var _0x2441c8=new Date();var _0x3ca4fd=[{'name':_0x159b('0xd'),'value':intUtil[_0x159b('0xe')](_0x152e0a[_0x159b('0xf')],_0x13189f,'\x20')},{'name':_0x159b('0x10'),'value':_0x279786['id']},{'name':_0x159b('0x11'),'value':_0x279786['id']},{'name':_0x159b('0x12'),'value':intUtil[_0x159b('0xe')](_0x152e0a[_0x159b('0x13')],_0x13189f,'\x0a')},{'name':'date_start','value':_0x2441c8[_0x159b('0x14')]()[_0x159b('0x15')](0x0,0x13)['replace']('T','\x20')},{'name':_0x159b('0x16'),'value':'0'},{'name':_0x159b('0x17'),'value':'15'},{'name':_0x159b('0x18'),'value':_0x3fd4b2['id']},{'name':_0x159b('0x19'),'value':_0x159b('0x1a')},{'name':_0x159b('0x1b'),'value':_0x3fd4b2[_0x159b('0xd')]},{'name':'direction','value':_0x9aa057}];if(_0x17ef30[_0x159b('0x1c')]){_['forEach'](_0x17ef30,function(_0x29e787){if(_0x13189f[_0x29e787[_0x159b('0x1d')]]){_0x3ca4fd[_0x159b('0x1e')]({'name':_0x29e787['idField'],'value':_0x13189f[_0x29e787[_0x159b('0x1d')]]});}});}return request({'form':{'method':_0x159b('0x1f'),'input_type':_0x159b('0x20'),'response_type':_0x159b('0x20'),'rest_data':JSON[_0x159b('0x21')]({'session':_0x39dcdc['id'],'module_name':_0x159b('0x22'),'name_value_list':_0x3ca4fd})}});}function getAuth(_0x774140){return util[_0x159b('0x23')](_0x159b('0x24'),new Buffer(_0x774140['apiKey']+':X')[_0x159b('0x25')](_0x159b('0x26')));}function getServerInfo(_0x27f75f){return request({'form':{'method':'get_server_info','input_type':_0x159b('0x20'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x27f75f['id']})}});}function getUser(_0x438421,_0x520ea5,_0x58ecd7){if(!_[_0x159b('0x27')](_0x520ea5)){logger[_0x159b('0xc')](_0x159b('0x28'),_0x520ea5);return request({'form':{'method':_0x159b('0x29'),'input_type':_0x159b('0x20'),'response_type':_0x159b('0x20'),'rest_data':JSON[_0x159b('0x21')]({'session':_0x58ecd7['id'],'module_name':_0x159b('0x2a'),'query':util[_0x159b('0x23')](_0x159b('0x2b'),_0x520ea5),'order_by':'','offset':'0','select_fields':['id',_0x159b('0xd'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x159b('0x2c')](function(_0x40ad5f){if(_0x40ad5f[_0x159b('0x2d')][_0x159b('0x1c')]){var _0x97bed4=_[_0x159b('0x2e')](_0x40ad5f[_0x159b('0x2d')],function(_0x36efae){return _0x36efae[_0x159b('0x2f')][_0x159b('0x30')][_0x159b('0x31')]===_0x520ea5;});if(_0x97bed4){logger[_0x159b('0xc')](_0x159b('0x32'));return BPromise[_0x159b('0x33')]({'id':_0x97bed4[_0x159b('0x2f')]['id'][_0x159b('0x31')],'name':_0x97bed4[_0x159b('0x2f')][_0x159b('0xd')][_0x159b('0x31')]});}}logger[_0x159b('0xc')](_0x159b('0x34'));return BPromise[_0x159b('0x33')]({'id':_0x58ecd7[_0x159b('0x2f')][_0x159b('0x35')][_0x159b('0x31')],'name':_0x58ecd7['name_value_list'][_0x159b('0x30')][_0x159b('0x31')]});});}else{logger['info'](_0x159b('0x36'));return BPromise[_0x159b('0x33')]({'id':_0x58ecd7[_0x159b('0x2f')]['user_id'][_0x159b('0x31')],'name':_0x58ecd7[_0x159b('0x2f')]['user_name']['value']});}}function getEndUser(_0x46f50b,_0x3b3ecb,_0x21e9ac,_0x387bcf){logger[_0x159b('0xc')]('Searching\x20enduser\x20with\x20phone',_0x21e9ac);return request({'form':{'method':'get_entry_list','input_type':_0x159b('0x20'),'response_type':_0x159b('0x20'),'rest_data':JSON[_0x159b('0x21')]({'session':_0x387bcf['id'],'module_name':_0x159b('0x1a'),'query':util[_0x159b('0x23')](_0x159b('0x37'),_0x21e9ac),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x291be7){if(_0x291be7[_0x159b('0x2d')]['length']){var _0x27e54a=_[_0x159b('0x2e')](_0x291be7['entry_list'],function(_0x1e47e6){return _0x1e47e6['name_value_list'][_0x159b('0x38')][_0x159b('0x31')]===_0x21e9ac;});if(_0x27e54a){logger[_0x159b('0xc')](_0x159b('0x39'));return BPromise[_0x159b('0x33')]({'id':_0x27e54a[_0x159b('0x2f')]['id']['value'],'name':_0x27e54a[_0x159b('0x2f')]['name'][_0x159b('0x31')],'phone':_0x27e54a[_0x159b('0x2f')][_0x159b('0x38')]['value']});}}else{logger['info'](_0x159b('0x3a'));return request({'form':{'method':_0x159b('0x1f'),'input_type':'JSON','response_type':_0x159b('0x20'),'rest_data':JSON['stringify']({'session':_0x387bcf['id'],'module_name':_0x159b('0x1a'),'name_value_list':[{'name':_0x159b('0x3b'),'value':_0x3b3ecb!==_0x159b('0x3c')?_0x3b3ecb:util[_0x159b('0x23')](_0x159b('0x3d'),_0x21e9ac)},{'name':_0x159b('0x38'),'value':_0x21e9ac}]})}})[_0x159b('0x2c')](function(_0x98bb44){logger[_0x159b('0xc')]('Enduser\x20created.');return BPromise[_0x159b('0x33')]({'id':_0x98bb44['id'],'name':_0x98bb44['entry_list'][_0x159b('0x3b')][_0x159b('0x31')],'phone':_0x98bb44['entry_list'][_0x159b('0x38')]['value']});});}});}function request(_0x5c9d71){logger['debug'](_0x159b('0x3e'),JSON['stringify'](_0x5c9d71));return rp(_['merge'](def,_0x5c9d71));}function getTags(_0x4ee8fa,_0x61c25b){var _0x259c34=[];if(_0x4ee8fa&&_0x4ee8fa[_0x159b('0x1c')]>0x0){_0x259c34=_[_0x159b('0x3f')](_0x4ee8fa,_0x61c25b);}return _0x259c34;}function getCustomFields(_0x15c4fe,_0x4b888d){var _0x311865=[];var _0x3f69a7={'custom_fields':[]};if(_0x15c4fe['length']>0x0){_[_0x159b('0x40')](_0x15c4fe,function(_0x43da7e){if(_0x43da7e['type']===_0x159b('0x41')&&_0x43da7e[_0x159b('0x42')]&&!_0x43da7e[_0x159b('0x43')]){_0x3f69a7[_0x43da7e[_0x159b('0x42')][_0x159b('0x44')]()]=_0x43da7e[_0x159b('0x45')]['toString']();}else if(_0x43da7e[_0x159b('0x46')]==='string'&&_0x43da7e[_0x159b('0x47')]&&_0x43da7e[_0x159b('0x43')]){_0x3f69a7[_0x159b('0x48')][_0x159b('0x1e')]({'id':_0x43da7e[_0x159b('0x47')],'value':_0x43da7e[_0x159b('0x45')]['toString']()});}else if(_0x43da7e[_0x159b('0x46')]===_0x159b('0x49')&&_0x43da7e['variableName']&&_0x43da7e[_0x159b('0x47')]&&_0x43da7e[_0x159b('0x43')]){_0x4b888d[_0x43da7e[_0x159b('0x1d')]]&&_0x3f69a7[_0x159b('0x48')][_0x159b('0x1e')]({'id':_0x43da7e[_0x159b('0x47')],'value':_0x4b888d[_0x43da7e[_0x159b('0x1d')]][_0x159b('0x25')]()});}else if(_0x43da7e['type']===_0x159b('0x4a')&&_0x43da7e['Variable']&&_0x43da7e[_0x159b('0x4b')][_0x159b('0xd')]&&_0x43da7e['idField']&&_0x43da7e[_0x159b('0x43')]){_0x4b888d[_0x43da7e[_0x159b('0x4b')][_0x159b('0xd')][_0x159b('0x44')]()]&&_0x3f69a7[_0x159b('0x48')][_0x159b('0x1e')]({'id':_0x43da7e[_0x159b('0x47')],'value':_0x4b888d[_0x43da7e[_0x159b('0x4b')]['name'][_0x159b('0x44')]()][_0x159b('0x25')]()});}});}return _0x3f69a7;}function getConnection(_0x474307){return request({'method':_0x159b('0xa'),'form':{'method':_0x159b('0x4c'),'input_type':_0x159b('0x20'),'response_type':_0x159b('0x20'),'rest_data':JSON[_0x159b('0x21')]({'user_auth':{'user_name':_0x474307[_0x159b('0x4d')],'password':_0x474307[_0x159b('0x4e')],'encryption':_0x159b('0x4f')},'application':_0x159b('0x50')})}})[_0x159b('0x2c')](function(_0x204bfa){var _0x538ded=_0x204bfa;if(_0x538ded['id']){def['sessionID']=_0x538ded['id'];return BPromise['resolve'](_0x538ded);}else{throw new Error(util['format'](_0x159b('0x51'),_0x474307['id']));}});}function setRelationship(_0x52b7b5,_0x2fce48,_0x496fd8,_0x5f5fe4){return request({'form':{'method':'set_relationship','input_type':_0x159b('0x20'),'response_type':_0x159b('0x20'),'rest_data':JSON[_0x159b('0x21')]({'session':_0x52b7b5['id'],'module_name':_0x159b('0x22'),'module_id':_0x496fd8['id'],'link_field_name':_0x5f5fe4,'related_ids':[_0x2fce48['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0xe25a66,_0xecea79,_0xdb4f93,_0x379918,_0x561603,_0x35aa14){var _0x1686b6,_0x5a74ff,_0x1745a7,_0x32da6e;_0x35aa14['remoteUri']=intUtil[_0x159b('0x52')](_0x35aa14['remoteUri']);_0x35aa14[_0x159b('0x53')]=intUtil[_0x159b('0x52')](_0x35aa14[_0x159b('0x53')]);def[_0x159b('0x54')]=util[_0x159b('0x23')](_0x159b('0x55'),_0x35aa14[_0x159b('0x56')]);if(_0x561603&&_0x561603[_0x159b('0x57')]){logger[_0x159b('0xc')](_0x159b('0x58'),_0x159b('0x59'));_0xecea79[_0x159b('0x5a')]=util[_0x159b('0x23')](_0x159b('0x5b'),_0x35aa14['serverUrl'],_0xecea79['uniqueid'],md5(_0xecea79[_0x159b('0x5c')]));}else{_0xecea79[_0x159b('0x5a')]='';}return getConnection(_0x35aa14)[_0x159b('0x2c')](function(_0x2b4a5c){_0x32da6e=_0x2b4a5c;return getUser(_0x35aa14,_0x379918['name'],_0x32da6e);})[_0x159b('0x2c')](function(_0x2d2700){_0x1686b6=_0x2d2700;logger[_0x159b('0xc')](_0x159b('0x5d'),_0x1686b6['id']);return getEndUser(_0x35aa14,_0xecea79[_0x159b('0x5e')],_0xecea79[_0x159b('0x5f')],_0x32da6e);})[_0x159b('0x2c')](function(_0x1134f6){_0x5a74ff=_0x1134f6;logger['info'](_0x159b('0x60'),_0x5a74ff['id']);return getTicket(_0x35aa14,_0x1686b6,_0x5a74ff,_0xdb4f93,_0xecea79,_0xdb4f93[_0x159b('0x61')],_0x32da6e,'Inbound');})[_0x159b('0x2c')](function(_0x58ae01){_0x1745a7=_0x58ae01;logger[_0x159b('0xc')]('Ticket\x20created!');logger[_0x159b('0xc')](_0x159b('0x62'),_0x1745a7['id']);return setRelationship(_0x32da6e,_0x1686b6,_0x1745a7,'users');})['then'](function(){return setRelationship(_0x32da6e,_0x5a74ff,_0x1745a7,_0x159b('0x63'));})[_0x159b('0x2c')](function(){return getServerInfo(_0x32da6e);})[_0x159b('0x2c')](function(_0x44c221){var _0x38eeb6=parseInt(_0x44c221[_0x159b('0x64')][_0x159b('0x65')](0x0));var _0xd48220=util[_0x159b('0x23')](_0x159b('0x66'),_0x35aa14[_0x159b('0x56')],_0x1745a7['id']);if(_0x38eeb6>0x6){_0xd48220=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x35aa14[_0x159b('0x56')],_0x1745a7['id']);}logger[_0x159b('0xc')](_0x159b('0x58'),_0x159b('0x67'));emit(util['format']('user:%s',_0x379918[_0x159b('0xd')]),_0x159b('0x68'),{'uri':_0xd48220});})['catch'](function(_0x48d84a){logger[_0x159b('0x69')]('[QUEUE]',JSON[_0x159b('0x21')](_0x48d84a));});};exports[_0x159b('0x6a')]=function(_0x81cd97,_0x206015,_0x4b2ff1,_0x135743,_0x581c2e,_0x3c4df0,_0x58bca5){var _0x1079c5,_0x2e30d9,_0x1c3a07,_0x23c308;_0x3c4df0[_0x159b('0x56')]=intUtil['stripTrailingSlash'](_0x3c4df0[_0x159b('0x56')]);_0x3c4df0[_0x159b('0x53')]=intUtil[_0x159b('0x52')](_0x3c4df0['serverUrl']);def[_0x159b('0x54')]=util[_0x159b('0x23')](_0x159b('0x55'),_0x3c4df0['remoteUri']);if(_0x58bca5&&_0x58bca5['recordingFormat']&&_0x58bca5[_0x159b('0x6b')]!=='none'){logger[_0x159b('0xc')](_0x159b('0x6c'),_0x159b('0x59'));_0x206015[_0x159b('0x5a')]=util[_0x159b('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c4df0[_0x159b('0x53')],_0x206015['uniqueid'],md5(_0x206015[_0x159b('0x5c')]));}return getConnection(_0x3c4df0)[_0x159b('0x2c')](function(_0x13a88f){_0x23c308=_0x13a88f;return getUser(_0x3c4df0,_0x135743[_0x159b('0xd')],_0x23c308);})[_0x159b('0x2c')](function(_0x48cadf){_0x1079c5=_0x48cadf;logger[_0x159b('0xc')](_0x159b('0x5d'),_0x1079c5['id']);return getEndUser(_0x3c4df0,_0x206015[_0x159b('0x6d')],_0x206015['destcalleridnum'],_0x23c308);})[_0x159b('0x2c')](function(_0x2681cb){_0x2e30d9=_0x2681cb;logger['info'](_0x159b('0x60'),_0x2e30d9['id']);return getTicket(_0x3c4df0,_0x1079c5,_0x2e30d9,_0x4b2ff1,_0x206015,_0x4b2ff1[_0x159b('0x61')],_0x23c308,_0x159b('0x6e'));})[_0x159b('0x2c')](function(_0x47a0c3){_0x1c3a07=_0x47a0c3;logger[_0x159b('0xc')]('Ticket\x20created!');logger[_0x159b('0xc')](_0x159b('0x62'),_0x1c3a07['id']);return setRelationship(_0x23c308,_0x1079c5,_0x1c3a07,_0x159b('0x6f'));})[_0x159b('0x2c')](function(){return setRelationship(_0x23c308,_0x2e30d9,_0x1c3a07,_0x159b('0x63'));})[_0x159b('0x2c')](function(){return getServerInfo(_0x23c308);})[_0x159b('0x2c')](function(_0x14d2c3){var _0x25918f=parseInt(_0x14d2c3['version'][_0x159b('0x65')](0x0));var _0x23aae4=util['format'](_0x159b('0x66'),_0x3c4df0[_0x159b('0x56')],_0x1c3a07['id']);if(_0x25918f>0x6){_0x23aae4=util[_0x159b('0x23')](_0x159b('0x70'),_0x3c4df0[_0x159b('0x56')],_0x1c3a07['id']);}logger['info']('[OUTBOUND]',_0x159b('0x67'));emit(util[_0x159b('0x23')](_0x159b('0x71'),_0x135743[_0x159b('0xd')]),_0x159b('0x68'),{'uri':_0x23aae4});})[_0x159b('0x72')](function(_0x26e609){logger['error'](_0x159b('0x6c'),JSON['stringify'](_0x26e609));});};exports['unmanaged']=function(_0x417248,_0x14cbe8,_0x1adae0,_0x5ef16a,_0x488a4b,_0x4ad377){var _0x463663,_0x557cca,_0x4e5d1b,_0x553548;_0x4ad377['remoteUri']=intUtil[_0x159b('0x52')](_0x4ad377[_0x159b('0x56')]);_0x4ad377['serverUrl']=intUtil[_0x159b('0x52')](_0x4ad377['serverUrl']);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x4ad377[_0x159b('0x56')]);if(_0x488a4b&&_0x488a4b[_0x159b('0x57')]){logger['info']('['+_0x14cbe8[_0x159b('0x73')]['toUpperCase']()+']',_0x159b('0x59'));_0x14cbe8[_0x159b('0x5a')]=util['format'](_0x159b('0x5b'),_0x4ad377[_0x159b('0x53')],_0x14cbe8[_0x159b('0x5c')],md5(_0x14cbe8[_0x159b('0x5c')]));}else{_0x14cbe8[_0x159b('0x5a')]='';}return getConnection(_0x4ad377)['then'](function(_0x1b5fb2){_0x553548=_0x1b5fb2;if(!_[_0x159b('0x27')](_0x5ef16a)){return getUser(_0x4ad377,_0x5ef16a[_0x159b('0xd')],_0x553548);}else{return getUser(_0x4ad377,null,_0x553548);}})['then'](function(_0xf3e2ff){_0x463663=_0xf3e2ff;logger[_0x159b('0xc')](_0x159b('0x5d'),_0x463663['id']);return getEndUser(_0x4ad377,_0x14cbe8[_0x159b('0x5e')],_0x14cbe8['calleridnum'],_0x553548);})['then'](function(_0x37a2eb){_0x557cca=_0x37a2eb;logger[_0x159b('0xc')](_0x159b('0x60'),_0x557cca['id']);return getTicket(_0x4ad377,_0x463663,_0x557cca,_0x1adae0,_0x14cbe8,_0x1adae0[_0x159b('0x61')],_0x553548,'Inbound');})[_0x159b('0x2c')](function(_0x1ef5d0){_0x4e5d1b=_0x1ef5d0;logger['info']('Ticket\x20created!');logger['info'](_0x159b('0x62'),_0x4e5d1b['id']);return setRelationship(_0x553548,_0x463663,_0x4e5d1b,_0x159b('0x6f'));})[_0x159b('0x2c')](function(){return setRelationship(_0x553548,_0x557cca,_0x4e5d1b,'contacts');})[_0x159b('0x2c')](function(){return getServerInfo(_0x553548);})[_0x159b('0x72')](function(_0x1da55f){logger[_0x159b('0x69')]('['+_0x14cbe8[_0x159b('0x73')][_0x159b('0x74')]()+']',JSON['stringify'](_0x1da55f));});}; \ 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 cceccdb..36a61b9 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 _0x4370=['name','join','stripTrailingSlash','slice','validateEmail','isNil','test','lodash','getString','length','sortBy','type','string','push','content','variable','variableName','toString','customVariable','Variable','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x4370,0x8e));var _0x0437=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x4370[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0x0437('0x0'));var util=require('util');exports[_0x0437('0x1')]=function(_0x1db2f3,_0x115387,_0x3d60f7){var _0x1aee23=[];if(_0x1db2f3[_0x0437('0x2')]>0x0){var _0x76f456=_[_0x0437('0x3')](_0x1db2f3,['id']);for(var _0x2e0b60=0x0;_0x2e0b60<_0x76f456[_0x0437('0x2')];_0x2e0b60++){var _0x3f1d9f=_0x76f456[_0x2e0b60];if(_0x3f1d9f[_0x0437('0x4')]===_0x0437('0x5')){_0x1aee23[_0x0437('0x6')](_0x3f1d9f[_0x0437('0x7')]);}else if(_0x3f1d9f[_0x0437('0x4')]===_0x0437('0x8')&&_0x3f1d9f[_0x0437('0x9')]){_0x115387[_0x3f1d9f[_0x0437('0x9')]]&&_0x1aee23[_0x0437('0x6')](_0x115387[_0x3f1d9f[_0x0437('0x9')]][_0x0437('0xa')]());}else if(_0x3f1d9f[_0x0437('0x4')]===_0x0437('0xb')&&_0x3f1d9f[_0x0437('0xc')]&&_0x3f1d9f[_0x0437('0xc')]['name']){_0x115387[_0x3f1d9f['Variable']['name'][_0x0437('0xd')]()]&&_0x1aee23[_0x0437('0x6')](_0x115387[_0x3f1d9f['Variable']['name'][_0x0437('0xd')]()][_0x0437('0xa')]());}else if(_0x3f1d9f[_0x0437('0x4')]===_0x0437('0xe')){if(_0x3f1d9f[_0x0437('0xf')]===_0x0437('0x5')&&_0x3f1d9f[_0x0437('0x10')]){_0x1aee23[_0x0437('0x6')](util[_0x0437('0x11')](_0x0437('0x12'),_0x3f1d9f[_0x0437('0x10')],_0x3f1d9f[_0x0437('0x13')]));}else if(_0x3f1d9f[_0x0437('0xf')]===_0x0437('0x8')&&_0x3f1d9f['variableName']&&_0x3f1d9f[_0x0437('0x10')]){_0x115387[_0x3f1d9f[_0x0437('0x9')]]&&_0x1aee23[_0x0437('0x6')](util[_0x0437('0x11')]('%s:\x20%s',_0x3f1d9f[_0x0437('0x10')],_0x115387[_0x3f1d9f['variableName']]));}else if(_0x3f1d9f[_0x0437('0xf')]===_0x0437('0xb')&&_0x3f1d9f[_0x0437('0xc')]&&_0x3f1d9f[_0x0437('0xc')]['name']&&_0x3f1d9f['key']){_0x115387[_0x3f1d9f['Variable'][_0x0437('0x14')][_0x0437('0xd')]()]&&_0x1aee23[_0x0437('0x6')](util[_0x0437('0x11')](_0x0437('0x12'),_0x3f1d9f[_0x0437('0x10')],_0x115387[_0x3f1d9f['Variable'][_0x0437('0x14')][_0x0437('0xd')]()]));}}}}return _0x1aee23[_0x0437('0x15')](_0x3d60f7);};exports[_0x0437('0x16')]=function(_0x593b4f){var _0x370286=_0x593b4f[_0x0437('0x17')](-0x1);if(_0x370286==='/'){_0x593b4f=_0x593b4f['substring'](0x0,_0x593b4f['lastIndexOf'](_0x370286));}return _0x593b4f;};exports[_0x0437('0x18')]=function(_0x5d2512){if(!_[_0x0437('0x19')](_0x5d2512)&&_0x5d2512!==''){var _0x2db639=/^(([^<>()\[\]\\.,;:\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 _0x2db639[_0x0437('0x1a')](String(_0x5d2512)[_0x0437('0xd')]());}else{return![];}}; \ No newline at end of file +var _0xda41=['push','content','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','format','%s:\x20%s','key','variable','join','stripTrailingSlash','slice','lastIndexOf','isNil','test','lodash','util','getString','length','sortBy','type','string'];(function(_0x2afa0a,_0x4b273c){var _0x206201=function(_0x9df21a){while(--_0x9df21a){_0x2afa0a['push'](_0x2afa0a['shift']());}};_0x206201(++_0x4b273c);}(_0xda41,0xfd));var _0x1da4=function(_0x4a87ed,_0x5c2810){_0x4a87ed=_0x4a87ed-0x0;var _0x3bec8c=_0xda41[_0x4a87ed];return _0x3bec8c;};'use strict';var _=require(_0x1da4('0x0'));var util=require(_0x1da4('0x1'));exports[_0x1da4('0x2')]=function(_0x3347d2,_0x1fe400,_0x47406b){var _0x1fef48=[];if(_0x3347d2[_0x1da4('0x3')]>0x0){var _0x15b2f8=_[_0x1da4('0x4')](_0x3347d2,['id']);for(var _0x28fcfd=0x0;_0x28fcfd<_0x15b2f8['length'];_0x28fcfd++){var _0x1f9a53=_0x15b2f8[_0x28fcfd];if(_0x1f9a53[_0x1da4('0x5')]===_0x1da4('0x6')){_0x1fef48[_0x1da4('0x7')](_0x1f9a53[_0x1da4('0x8')]);}else if(_0x1f9a53['type']==='variable'&&_0x1f9a53[_0x1da4('0x9')]){_0x1fe400[_0x1f9a53[_0x1da4('0x9')]]&&_0x1fef48[_0x1da4('0x7')](_0x1fe400[_0x1f9a53['variableName']][_0x1da4('0xa')]());}else if(_0x1f9a53[_0x1da4('0x5')]===_0x1da4('0xb')&&_0x1f9a53[_0x1da4('0xc')]&&_0x1f9a53[_0x1da4('0xc')][_0x1da4('0xd')]){_0x1fe400[_0x1f9a53[_0x1da4('0xc')][_0x1da4('0xd')]['toLowerCase']()]&&_0x1fef48['push'](_0x1fe400[_0x1f9a53[_0x1da4('0xc')][_0x1da4('0xd')][_0x1da4('0xe')]()][_0x1da4('0xa')]());}else if(_0x1f9a53[_0x1da4('0x5')]==='keyValue'){if(_0x1f9a53[_0x1da4('0xf')]===_0x1da4('0x6')&&_0x1f9a53['key']){_0x1fef48[_0x1da4('0x7')](util[_0x1da4('0x10')](_0x1da4('0x11'),_0x1f9a53[_0x1da4('0x12')],_0x1f9a53['keyContent']));}else if(_0x1f9a53[_0x1da4('0xf')]===_0x1da4('0x13')&&_0x1f9a53[_0x1da4('0x9')]&&_0x1f9a53['key']){_0x1fe400[_0x1f9a53[_0x1da4('0x9')]]&&_0x1fef48[_0x1da4('0x7')](util[_0x1da4('0x10')](_0x1da4('0x11'),_0x1f9a53[_0x1da4('0x12')],_0x1fe400[_0x1f9a53[_0x1da4('0x9')]]));}else if(_0x1f9a53[_0x1da4('0xf')]===_0x1da4('0xb')&&_0x1f9a53[_0x1da4('0xc')]&&_0x1f9a53[_0x1da4('0xc')][_0x1da4('0xd')]&&_0x1f9a53[_0x1da4('0x12')]){_0x1fe400[_0x1f9a53[_0x1da4('0xc')][_0x1da4('0xd')]['toLowerCase']()]&&_0x1fef48[_0x1da4('0x7')](util['format'](_0x1da4('0x11'),_0x1f9a53[_0x1da4('0x12')],_0x1fe400[_0x1f9a53[_0x1da4('0xc')][_0x1da4('0xd')][_0x1da4('0xe')]()]));}}}}return _0x1fef48[_0x1da4('0x14')](_0x47406b);};exports[_0x1da4('0x15')]=function(_0x104e76){var _0x5dc894=_0x104e76[_0x1da4('0x16')](-0x1);if(_0x5dc894==='/'){_0x104e76=_0x104e76['substring'](0x0,_0x104e76[_0x1da4('0x17')](_0x5dc894));}return _0x104e76;};exports['validateEmail']=function(_0x1f7d62){if(!_[_0x1da4('0x18')](_0x1f7d62)&&_0x1f7d62!==''){var _0x508862=/^(([^<>()\[\]\\.,;:\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 _0x508862[_0x1da4('0x19')](String(_0x1f7d62)[_0x1da4('0xe')]());}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 8316224..cee6877 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x1ec902,_0x29bc52){var _0xe1cbf=function(_0x403a91){while(--_0x403a91){_0x1ec902['push'](_0x1ec902['shift']());}};_0xe1cbf(++_0x29bc52);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x4e75f4,_0x4525d1){var _0x16fc41=function(_0x3dc3eb){while(--_0x3dc3eb){_0x4e75f4['push'](_0x4e75f4['shift']());}};_0x16fc41(++_0x4525d1);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index f2e06ec..73c3e5d 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 _0xacfc=['length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','map','type','nameField','customField','toLowerCase','content','includes','string','picklist','push','idField','variable','variableName','customVariable','Variable','name','custom_fields','queue','stripTrailingSlash','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridname','The\x20Enduser\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','../../../../config/environment','defaults','socket.io-emitter','redis','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s'];(function(_0x271d4e,_0x29beda){var _0x56ba4d=function(_0x1ed290){while(--_0x1ed290){_0x271d4e['push'](_0x271d4e['shift']());}};_0x56ba4d(++_0x29beda);}(_0xacfc,0x1b5));var _0xcacf=function(_0x112be7,_0x5d5168){_0x112be7=_0x112be7-0x0;var _0x3de668=_0xacfc[_0x112be7];return _0x3de668;};'use strict';var _=require(_0xcacf('0x0'));var rp=require(_0xcacf('0x1'));var md5=require(_0xcacf('0x2'));var util=require(_0xcacf('0x3'));var Redis=require(_0xcacf('0x4'));var intUtil=require('./util');var config=require(_0xcacf('0x5'));var logger=require('../../../../config/logger')('zendesk');config['redis']=_[_0xcacf('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xcacf('0x7'))(new Redis(config[_0xcacf('0x8')]));function emit(_0x5c4807,_0x59ab96,_0x182777){io['to'](_0x5c4807)[_0xcacf('0x9')](_0x59ab96,_0x182777);}var headers={'Content-Type':'application/json','Accept':_0xcacf('0xa')};function getTicket(_0x305bdb,_0x22bbe7,_0x597eb1,_0x4ea33a,_0x7e2291){logger[_0xcacf('0xb')](_0xcacf('0xc'));return request({'uri':util[_0xcacf('0xd')](_0xcacf('0xe'),_0x305bdb[_0xcacf('0xf')]),'method':'POST','body':{'ticket':_[_0xcacf('0x10')]({'requester_id':_0x597eb1['id'],'submitter_id':_0x22bbe7?_0x22bbe7['id']:undefined,'assignee_id':_0x22bbe7?_0x22bbe7['id']:undefined,'tags':getTags(_0x4ea33a[_0xcacf('0x11')],'name'),'subject':intUtil[_0xcacf('0x12')](_0x4ea33a[_0xcacf('0x13')],_0x7e2291,'\x20'),'description':intUtil[_0xcacf('0x12')](_0x4ea33a[_0xcacf('0x14')],_0x7e2291,'\x0a'),'comment':{'public':![],'body':intUtil[_0xcacf('0x12')](_0x4ea33a[_0xcacf('0x14')],_0x7e2291,'\x0a')}},getCustomFields(_0x4ea33a[_0xcacf('0x15')],_0x7e2291))}})[_0xcacf('0x16')](function(_0x137e26){logger[_0xcacf('0xb')](_0xcacf('0x17'));return _0x137e26[_0xcacf('0x18')];});}function getUser(_0x149aca,_0x1d27b3){if(intUtil[_0xcacf('0x19')](_0x1d27b3)){logger[_0xcacf('0xb')](_0xcacf('0x1a'),_0x1d27b3);return request({'uri':util['format'](_0xcacf('0x1b'),_0x149aca[_0xcacf('0xf')]),'qs':{'query':util[_0xcacf('0xd')](_0xcacf('0x1c'),_0x1d27b3)}})['then'](function(_0xa4b1c1){if(_0xa4b1c1['count']){logger[_0xcacf('0xb')](_0xcacf('0x1d'));return _[_0xcacf('0x1e')](_0xa4b1c1[_0xcacf('0x1f')],{'email':_0x1d27b3,'role':_0xcacf('0x20')});}else{logger['info'](_0xcacf('0x21'));return request({'uri':util[_0xcacf('0xd')](_0xcacf('0x22'),_0x149aca['remoteUri'])})[_0xcacf('0x16')](function(_0x2b72b6){logger[_0xcacf('0xb')]('Admin\x20account\x20selected.');return _0x2b72b6[_0xcacf('0x23')];});}});}else{logger[_0xcacf('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xcacf('0xd')](_0xcacf('0x22'),_0x149aca['remoteUri'])})[_0xcacf('0x16')](function(_0x56c7ea){logger[_0xcacf('0xb')](_0xcacf('0x24'));return _0x56c7ea['user'];});}}function getEndUser(_0x2785fc,_0x3a172a,_0x21e8f9){logger[_0xcacf('0xb')](_0xcacf('0x25'),_0x21e8f9);return request({'uri':util[_0xcacf('0xd')](_0xcacf('0x1b'),_0x2785fc[_0xcacf('0xf')]),'qs':{'query':util['format'](_0xcacf('0x26'),_0x21e8f9)}})[_0xcacf('0x16')](function(_0x551e81){var _0x4825d6;if(_0x551e81[_0xcacf('0x1f')][_0xcacf('0x27')]){_0x551e81['results']=_[_0xcacf('0x28')](_0x551e81['results'],{'suspended':![],'role':_0xcacf('0x29')});if(_0x551e81[_0xcacf('0x1f')][_0xcacf('0x27')]){_0x4825d6=_[_0xcacf('0x2a')](_0x551e81[_0xcacf('0x1f')]);}}if(_0x4825d6){logger[_0xcacf('0xb')](_0xcacf('0x2b'));return _0x4825d6;}else{logger[_0xcacf('0xb')](_0xcacf('0x2c'));return request({'uri':util['format'](_0xcacf('0x2d'),_0x2785fc[_0xcacf('0xf')]),'method':_0xcacf('0x2e'),'body':{'user':{'role':_0xcacf('0x29'),'name':util[_0xcacf('0xd')](_0xcacf('0x2f'),_0x3a172a||_0x21e8f9),'phone':_0x21e8f9}}})[_0xcacf('0x16')](function(_0x2e0312){logger[_0xcacf('0xb')](_0xcacf('0x30'));return _0x2e0312[_0xcacf('0x23')];});}});}function getAuth(_0x2a7309){var _0x3428a4;if(_0x2a7309[_0xcacf('0x31')]===_0xcacf('0x32')){_0x3428a4=util['format'](_0xcacf('0x33'),_0x2a7309[_0xcacf('0x34')],_0x2a7309[_0xcacf('0x32')]);}else if(_0x2a7309[_0xcacf('0x31')]==='token'){_0x3428a4=util[_0xcacf('0xd')]('%s/token:%s',_0x2a7309[_0xcacf('0x34')],_0x2a7309[_0xcacf('0x35')]);}return util[_0xcacf('0xd')](_0xcacf('0x36'),new Buffer(_0x3428a4)[_0xcacf('0x37')](_0xcacf('0x38')));}function request(_0x21af75){logger[_0xcacf('0x39')](_0xcacf('0x3a'),JSON[_0xcacf('0x3b')](_0x21af75));return rp(_[_0xcacf('0x6')](_0x21af75,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x14f3a8,_0x54bc6d){var _0x2b811f=[];if(_0x14f3a8&&_0x14f3a8[_0xcacf('0x27')]>0x0){_0x2b811f=_[_0xcacf('0x3c')](_0x14f3a8,_0x54bc6d);}return _0x2b811f;}function getCustomFields(_0x5a80b9,_0x10ea51){var _0x4f4adf=[];var _0x114596={'custom_fields':[]};if(_0x5a80b9[_0xcacf('0x27')]>0x0){_['forEach'](_0x5a80b9,function(_0x113cd1){if(_['includes'](['string','picklist'],_0x113cd1[_0xcacf('0x3d')])&&_0x113cd1[_0xcacf('0x3e')]&&!_0x113cd1[_0xcacf('0x3f')]){_0x114596[_0x113cd1[_0xcacf('0x3e')][_0xcacf('0x40')]()]=_0x113cd1[_0xcacf('0x41')][_0xcacf('0x37')]();}else if(_[_0xcacf('0x42')]([_0xcacf('0x43'),_0xcacf('0x44')],_0x113cd1['type'])&&_0x113cd1['idField']&&_0x113cd1[_0xcacf('0x3f')]){_0x114596['custom_fields'][_0xcacf('0x45')]({'id':_0x113cd1[_0xcacf('0x46')],'value':_0x113cd1[_0xcacf('0x41')]['toString']()});}else if(_0x113cd1['type']===_0xcacf('0x47')&&_0x113cd1[_0xcacf('0x48')]&&_0x113cd1[_0xcacf('0x46')]&&_0x113cd1[_0xcacf('0x3f')]){_0x10ea51[_0x113cd1[_0xcacf('0x48')]]&&_0x114596['custom_fields'][_0xcacf('0x45')]({'id':_0x113cd1['idField'],'value':_0x10ea51[_0x113cd1[_0xcacf('0x48')]][_0xcacf('0x37')]()});}else if(_0x113cd1[_0xcacf('0x3d')]===_0xcacf('0x49')&&_0x113cd1[_0xcacf('0x4a')]&&_0x113cd1[_0xcacf('0x4a')][_0xcacf('0x4b')]&&_0x113cd1[_0xcacf('0x46')]&&_0x113cd1[_0xcacf('0x3f')]){_0x10ea51[_0x113cd1[_0xcacf('0x4a')][_0xcacf('0x4b')]['toLowerCase']()]&&_0x114596[_0xcacf('0x4c')][_0xcacf('0x45')]({'id':_0x113cd1['idField'],'value':_0x10ea51[_0x113cd1[_0xcacf('0x4a')][_0xcacf('0x4b')][_0xcacf('0x40')]()]['toString']()});}});}return _0x114596;}exports[_0xcacf('0x4d')]=function(_0x5bc67e,_0x12ab81,_0x4ee367,_0x1e8ad8,_0xf69f64,_0x5b9fae){var _0x165a5d,_0x815e69;_0x5b9fae['remoteUri']=intUtil[_0xcacf('0x4e')](_0x5b9fae['remoteUri']);_0x5b9fae['serverUrl']=intUtil['stripTrailingSlash'](_0x5b9fae['serverUrl']);if(_0xf69f64&&_0xf69f64[_0xcacf('0x4f')]){logger[_0xcacf('0xb')](_0xcacf('0x50'),'Recording\x20is\x20enabled!');_0x12ab81['recordingURL']=util[_0xcacf('0xd')](_0xcacf('0x51'),_0x5b9fae[_0xcacf('0x52')],_0x12ab81[_0xcacf('0x53')],md5(_0x12ab81[_0xcacf('0x53')]));}else{_0x12ab81[_0xcacf('0x54')]='';}headers[_0xcacf('0x55')]=getAuth(_0x5b9fae);return getUser(_0x5b9fae,_0x1e8ad8[_0xcacf('0x56')])['then'](function(_0x683a23){_0x165a5d=_0x683a23;logger[_0xcacf('0xb')](_0xcacf('0x57'),_0x165a5d['id']);return getEndUser(_0x5b9fae,_0x12ab81['calleridname'],_0x12ab81[_0xcacf('0x58')]);})[_0xcacf('0x16')](function(_0x412849){_0x815e69=_0x412849;logger[_0xcacf('0xb')]('The\x20Enduser\x20ID\x20is:',_0x815e69['id']);return getTicket(_0x5b9fae,_0x165a5d,_0x815e69,_0x4ee367,_0x12ab81);})[_0xcacf('0x16')](function(_0x55fb1f){if(_0x55fb1f){logger[_0xcacf('0xb')](_0xcacf('0x59'),_0x55fb1f['id']);switch(_0x5b9fae[_0xcacf('0x3d')]){case _0xcacf('0x5a'):logger[_0xcacf('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0xcacf('0x5b'),_0x5b9fae['remoteUri'],_0x165a5d['id'],_0x55fb1f['id']),'method':_0xcacf('0x2e')});case _0xcacf('0x5c'):logger[_0xcacf('0xb')](_0xcacf('0x50'),_0xcacf('0x5d'));emit(util['format'](_0xcacf('0x5e'),_0x1e8ad8[_0xcacf('0x4b')]),_0xcacf('0x5f'),{'uri':util[_0xcacf('0xd')](_0xcacf('0x60'),_0x5b9fae[_0xcacf('0xf')][_0xcacf('0x61')](_0xcacf('0x62'),''),_0x55fb1f['id'])});break;default:logger[_0xcacf('0x63')](_0xcacf('0x50'),_0xcacf('0x64'));}}})[_0xcacf('0x65')](function(_0x3b095f){logger['error'](_0xcacf('0x66'),util[_0xcacf('0x67')](_0x3b095f,{'showHidden':!![],'depth':null}));});};exports[_0xcacf('0x68')]=function(_0x448407,_0x24face,_0x11c739,_0x1b926b,_0x38ea3c,_0x5a0c5c,_0x1e103f){var _0x205bc8,_0xe9da9c;_0x5a0c5c['remoteUri']=intUtil[_0xcacf('0x4e')](_0x5a0c5c['remoteUri']);_0x5a0c5c[_0xcacf('0x52')]=intUtil[_0xcacf('0x4e')](_0x5a0c5c[_0xcacf('0x52')]);if(_0x1e103f&&_0x1e103f[_0xcacf('0x69')]&&_0x1e103f['recordingFormat']!==_0xcacf('0x6a')){logger[_0xcacf('0xb')](_0xcacf('0x6b'),_0xcacf('0x6c'));_0x24face[_0xcacf('0x54')]=util[_0xcacf('0xd')](_0xcacf('0x51'),_0x5a0c5c[_0xcacf('0x52')],_0x24face['uniqueid'],md5(_0x24face['uniqueid']));}headers[_0xcacf('0x55')]=getAuth(_0x5a0c5c);return getUser(_0x5a0c5c,_0x1b926b[_0xcacf('0x56')])[_0xcacf('0x16')](function(_0x39ec9b){_0x205bc8=_0x39ec9b;logger[_0xcacf('0xb')]('The\x20User\x20ID\x20is:',_0x205bc8['id']);return getEndUser(_0x5a0c5c,_0x24face[_0xcacf('0x6d')],_0x24face[_0xcacf('0x6e')]);})['then'](function(_0x4e2e23){_0xe9da9c=_0x4e2e23;logger[_0xcacf('0xb')]('The\x20Enduser\x20ID\x20is:',_0xe9da9c['id']);return getTicket(_0x5a0c5c,_0x205bc8,_0xe9da9c,_0x11c739,_0x24face);})[_0xcacf('0x16')](function(_0x2de5b5){if(_0x2de5b5){logger[_0xcacf('0xb')](_0xcacf('0x59'),_0x2de5b5['id']);switch(_0x5a0c5c[_0xcacf('0x3d')]){case _0xcacf('0x5a'):logger[_0xcacf('0xb')](_0xcacf('0x6b'),_0xcacf('0x6f'));return request({'uri':util[_0xcacf('0xd')](_0xcacf('0x5b'),_0x5a0c5c[_0xcacf('0xf')],_0x205bc8['id'],_0x2de5b5['id']),'method':_0xcacf('0x2e')});case _0xcacf('0x5c'):logger['info'](_0xcacf('0x6b'),_0xcacf('0x5d'));emit(util[_0xcacf('0xd')](_0xcacf('0x5e'),_0x1b926b[_0xcacf('0x4b')]),_0xcacf('0x5f'),{'uri':util['format'](_0xcacf('0x60'),_0x5a0c5c[_0xcacf('0xf')]['replace'](_0xcacf('0x62'),''),_0x2de5b5['id'])});break;default:logger[_0xcacf('0x63')](_0xcacf('0x6b'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xcacf('0x65')](function(_0x2869cc){logger['error'](_0xcacf('0x70'),util[_0xcacf('0x67')](_0x2869cc,{'showHidden':!![],'depth':null}));});};exports[_0xcacf('0x71')]=function(_0x214496,_0x23a0ac,_0x5e47b7,_0xdcae59,_0x55408e,_0x5d9d07){var _0x3de705,_0x2e3f9f;_0x5d9d07[_0xcacf('0xf')]=intUtil['stripTrailingSlash'](_0x5d9d07[_0xcacf('0xf')]);_0x5d9d07['serverUrl']=intUtil[_0xcacf('0x4e')](_0x5d9d07[_0xcacf('0x52')]);if(_0x55408e&&_0x55408e['monitor_format']){logger[_0xcacf('0xb')]('['+_0x23a0ac[_0xcacf('0x72')][_0xcacf('0x73')]()+']',_0xcacf('0x6c'));_0x23a0ac[_0xcacf('0x54')]=util['format'](_0xcacf('0x51'),_0x5d9d07[_0xcacf('0x52')],_0x23a0ac[_0xcacf('0x53')],md5(_0x23a0ac[_0xcacf('0x53')]));}else{_0x23a0ac[_0xcacf('0x54')]='';}headers[_0xcacf('0x55')]=getAuth(_0x5d9d07);return getUser(_0x5d9d07)[_0xcacf('0x16')](function(_0x2e8da3){_0x3de705=_0x2e8da3;logger[_0xcacf('0xb')](_0xcacf('0x57'),_0x3de705['id']);return getEndUser(_0x5d9d07,_0x23a0ac[_0xcacf('0x74')],_0x23a0ac[_0xcacf('0x58')]);})[_0xcacf('0x16')](function(_0x2929b2){_0x2e3f9f=_0x2929b2;logger[_0xcacf('0xb')](_0xcacf('0x75'),_0x2e3f9f['id']);return getTicket(_0x5d9d07,_0x3de705,_0x2e3f9f,_0x5e47b7,_0x23a0ac);})[_0xcacf('0x16')](function(_0x3255f6){if(_0x3255f6){logger['info'](_0xcacf('0x59'),_0x3255f6['id']);}})[_0xcacf('0x65')](function(_0x1d6cc7){logger[_0xcacf('0x63')]('['+_0x23a0ac[_0xcacf('0x72')][_0xcacf('0x73')]()+']'+_0xcacf('0x76'),util[_0xcacf('0x67')](_0x1d6cc7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb929=['recordingURL','Authorization','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','user:%s','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','stripTrailingSlash','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','trigger:browser:url','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','format','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','first','%s/users.json','authType','password','username','%s/token:%s','token','Basic\x20%s','toString','base64','debug','stringify','defaults','map','forEach','includes','string','type','customField','nameField','picklist','idField','custom_fields','content','variable','variableName','push','customVariable','Variable','toLowerCase','queue','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x45c9b3,_0x24c9b1){var _0x5dca5a=function(_0x5e4873){while(--_0x5e4873){_0x45c9b3['push'](_0x45c9b3['shift']());}};_0x5dca5a(++_0x24c9b1);}(_0xb929,0x90));var _0x9b92=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb929[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9b92('0x0'));var rp=require(_0x9b92('0x1'));var md5=require(_0x9b92('0x2'));var util=require(_0x9b92('0x3'));var Redis=require(_0x9b92('0x4'));var intUtil=require('./util');var config=require(_0x9b92('0x5'));var logger=require(_0x9b92('0x6'))(_0x9b92('0x7'));config[_0x9b92('0x8')]=_['defaults'](config['redis'],{'host':_0x9b92('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9b92('0x8')]));function emit(_0x11c734,_0xcea298,_0x14fba3){io['to'](_0x11c734)[_0x9b92('0xa')](_0xcea298,_0x14fba3);}var headers={'Content-Type':_0x9b92('0xb'),'Accept':_0x9b92('0xb')};function getTicket(_0x1352c9,_0x21b087,_0x428742,_0x441ed0,_0x2348ab){logger[_0x9b92('0xc')](_0x9b92('0xd'));return request({'uri':util['format'](_0x9b92('0xe'),_0x1352c9[_0x9b92('0xf')]),'method':_0x9b92('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x428742['id'],'submitter_id':_0x21b087?_0x21b087['id']:undefined,'assignee_id':_0x21b087?_0x21b087['id']:undefined,'tags':getTags(_0x441ed0[_0x9b92('0x11')],_0x9b92('0x12')),'subject':intUtil[_0x9b92('0x13')](_0x441ed0['Subjects'],_0x2348ab,'\x20'),'description':intUtil[_0x9b92('0x13')](_0x441ed0['Descriptions'],_0x2348ab,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x441ed0[_0x9b92('0x14')],_0x2348ab,'\x0a')}},getCustomFields(_0x441ed0[_0x9b92('0x15')],_0x2348ab))}})[_0x9b92('0x16')](function(_0x3cdca8){logger[_0x9b92('0xc')](_0x9b92('0x17'));return _0x3cdca8[_0x9b92('0x18')];});}function getUser(_0x319254,_0x3a28d8){if(intUtil[_0x9b92('0x19')](_0x3a28d8)){logger['info'](_0x9b92('0x1a'),_0x3a28d8);return request({'uri':util['format'](_0x9b92('0x1b'),_0x319254[_0x9b92('0xf')]),'qs':{'query':util[_0x9b92('0x1c')]('type:user\x20role:agent\x20email:%s',_0x3a28d8)}})[_0x9b92('0x16')](function(_0x385e38){if(_0x385e38[_0x9b92('0x1d')]){logger[_0x9b92('0xc')](_0x9b92('0x1e'));return _[_0x9b92('0x1f')](_0x385e38[_0x9b92('0x20')],{'email':_0x3a28d8,'role':_0x9b92('0x21')});}else{logger[_0x9b92('0xc')](_0x9b92('0x22'));return request({'uri':util[_0x9b92('0x1c')](_0x9b92('0x23'),_0x319254[_0x9b92('0xf')])})[_0x9b92('0x16')](function(_0x398d1f){logger[_0x9b92('0xc')]('Admin\x20account\x20selected.');return _0x398d1f[_0x9b92('0x24')];});}});}else{logger[_0x9b92('0xc')](_0x9b92('0x22'));return request({'uri':util[_0x9b92('0x1c')](_0x9b92('0x23'),_0x319254[_0x9b92('0xf')])})[_0x9b92('0x16')](function(_0x7751c){logger[_0x9b92('0xc')](_0x9b92('0x25'));return _0x7751c[_0x9b92('0x24')];});}}function getEndUser(_0x524471,_0x1506d7,_0x57315f){logger['info']('Searching\x20enduser\x20with\x20phone',_0x57315f);return request({'uri':util['format']('%s/search.json',_0x524471['remoteUri']),'qs':{'query':util[_0x9b92('0x1c')](_0x9b92('0x26'),_0x57315f)}})[_0x9b92('0x16')](function(_0x14356d){var _0xa489f8;if(_0x14356d[_0x9b92('0x20')]['length']){_0x14356d[_0x9b92('0x20')]=_[_0x9b92('0x27')](_0x14356d['results'],{'suspended':![],'role':_0x9b92('0x28')});if(_0x14356d[_0x9b92('0x20')][_0x9b92('0x29')]){_0xa489f8=_[_0x9b92('0x2a')](_0x14356d[_0x9b92('0x20')]);}}if(_0xa489f8){logger[_0x9b92('0xc')]('Enduser\x20found!');return _0xa489f8;}else{logger[_0x9b92('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x9b92('0x2b'),_0x524471['remoteUri']),'method':_0x9b92('0x10'),'body':{'user':{'role':_0x9b92('0x28'),'name':util['format']('Caller\x20-\x20%s',_0x1506d7||_0x57315f),'phone':_0x57315f}}})['then'](function(_0x2c0786){logger[_0x9b92('0xc')]('Enduser\x20created.');return _0x2c0786[_0x9b92('0x24')];});}});}function getAuth(_0x5b28b1){var _0x9d1a6c;if(_0x5b28b1[_0x9b92('0x2c')]===_0x9b92('0x2d')){_0x9d1a6c=util[_0x9b92('0x1c')]('%s:%s',_0x5b28b1[_0x9b92('0x2e')],_0x5b28b1[_0x9b92('0x2d')]);}else if(_0x5b28b1[_0x9b92('0x2c')]==='token'){_0x9d1a6c=util[_0x9b92('0x1c')](_0x9b92('0x2f'),_0x5b28b1[_0x9b92('0x2e')],_0x5b28b1[_0x9b92('0x30')]);}return util['format'](_0x9b92('0x31'),new Buffer(_0x9d1a6c)[_0x9b92('0x32')](_0x9b92('0x33')));}function request(_0x39584c){logger[_0x9b92('0x34')]('[HTTP]',JSON[_0x9b92('0x35')](_0x39584c));return rp(_[_0x9b92('0x36')](_0x39584c,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x18f1a5,_0x5318bd){var _0x495e00=[];if(_0x18f1a5&&_0x18f1a5[_0x9b92('0x29')]>0x0){_0x495e00=_[_0x9b92('0x37')](_0x18f1a5,_0x5318bd);}return _0x495e00;}function getCustomFields(_0x42a0fc,_0x13bdc8){var _0x1a5e60=[];var _0x4f5dae={'custom_fields':[]};if(_0x42a0fc['length']>0x0){_[_0x9b92('0x38')](_0x42a0fc,function(_0x184c09){if(_[_0x9b92('0x39')]([_0x9b92('0x3a'),'picklist'],_0x184c09[_0x9b92('0x3b')])&&_0x184c09['nameField']&&!_0x184c09[_0x9b92('0x3c')]){_0x4f5dae[_0x184c09[_0x9b92('0x3d')]['toLowerCase']()]=_0x184c09['content'][_0x9b92('0x32')]();}else if(_[_0x9b92('0x39')]([_0x9b92('0x3a'),_0x9b92('0x3e')],_0x184c09[_0x9b92('0x3b')])&&_0x184c09[_0x9b92('0x3f')]&&_0x184c09[_0x9b92('0x3c')]){_0x4f5dae[_0x9b92('0x40')]['push']({'id':_0x184c09[_0x9b92('0x3f')],'value':_0x184c09[_0x9b92('0x41')][_0x9b92('0x32')]()});}else if(_0x184c09[_0x9b92('0x3b')]===_0x9b92('0x42')&&_0x184c09['variableName']&&_0x184c09['idField']&&_0x184c09[_0x9b92('0x3c')]){_0x13bdc8[_0x184c09[_0x9b92('0x43')]]&&_0x4f5dae[_0x9b92('0x40')][_0x9b92('0x44')]({'id':_0x184c09[_0x9b92('0x3f')],'value':_0x13bdc8[_0x184c09[_0x9b92('0x43')]]['toString']()});}else if(_0x184c09['type']===_0x9b92('0x45')&&_0x184c09['Variable']&&_0x184c09['Variable']['name']&&_0x184c09['idField']&&_0x184c09[_0x9b92('0x3c')]){_0x13bdc8[_0x184c09[_0x9b92('0x46')][_0x9b92('0x12')][_0x9b92('0x47')]()]&&_0x4f5dae[_0x9b92('0x40')][_0x9b92('0x44')]({'id':_0x184c09[_0x9b92('0x3f')],'value':_0x13bdc8[_0x184c09[_0x9b92('0x46')][_0x9b92('0x12')][_0x9b92('0x47')]()][_0x9b92('0x32')]()});}});}return _0x4f5dae;}exports[_0x9b92('0x48')]=function(_0x2ad8cc,_0x3e9320,_0x31679f,_0x35f3b0,_0x51363a,_0x761e7){var _0x9b542b,_0x5ed1cb;_0x761e7[_0x9b92('0xf')]=intUtil['stripTrailingSlash'](_0x761e7[_0x9b92('0xf')]);_0x761e7['serverUrl']=intUtil['stripTrailingSlash'](_0x761e7[_0x9b92('0x49')]);if(_0x51363a&&_0x51363a['monitor_format']){logger[_0x9b92('0xc')](_0x9b92('0x4a'),_0x9b92('0x4b'));_0x3e9320['recordingURL']=util[_0x9b92('0x1c')](_0x9b92('0x4c'),_0x761e7[_0x9b92('0x49')],_0x3e9320['uniqueid'],md5(_0x3e9320[_0x9b92('0x4d')]));}else{_0x3e9320[_0x9b92('0x4e')]='';}headers[_0x9b92('0x4f')]=getAuth(_0x761e7);return getUser(_0x761e7,_0x35f3b0[_0x9b92('0x50')])[_0x9b92('0x16')](function(_0x4931de){_0x9b542b=_0x4931de;logger[_0x9b92('0xc')](_0x9b92('0x51'),_0x9b542b['id']);return getEndUser(_0x761e7,_0x3e9320[_0x9b92('0x52')],_0x3e9320[_0x9b92('0x53')]);})[_0x9b92('0x16')](function(_0xee46cc){_0x5ed1cb=_0xee46cc;logger[_0x9b92('0xc')](_0x9b92('0x54'),_0x5ed1cb['id']);return getTicket(_0x761e7,_0x9b542b,_0x5ed1cb,_0x31679f,_0x3e9320);})[_0x9b92('0x16')](function(_0x351c4c){if(_0x351c4c){logger[_0x9b92('0xc')]('The\x20Ticket\x20ID\x20is:',_0x351c4c['id']);switch(_0x761e7[_0x9b92('0x3b')]){case _0x9b92('0x55'):logger[_0x9b92('0xc')](_0x9b92('0x4a'),_0x9b92('0x56'));return request({'uri':util[_0x9b92('0x1c')](_0x9b92('0x57'),_0x761e7['remoteUri'],_0x9b542b['id'],_0x351c4c['id']),'method':_0x9b92('0x10')});case _0x9b92('0x58'):logger[_0x9b92('0xc')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x9b92('0x59'),_0x35f3b0[_0x9b92('0x12')]),'trigger:browser:url',{'uri':util[_0x9b92('0x1c')](_0x9b92('0x5a'),_0x761e7[_0x9b92('0xf')][_0x9b92('0x5b')]('/api/v2',''),_0x351c4c['id'])});break;default:logger[_0x9b92('0x5c')](_0x9b92('0x4a'),_0x9b92('0x5d'));}}})[_0x9b92('0x5e')](function(_0xf10787){logger[_0x9b92('0x5c')](_0x9b92('0x5f'),util[_0x9b92('0x60')](_0xf10787,{'showHidden':!![],'depth':null}));});};exports[_0x9b92('0x61')]=function(_0xe7fa4a,_0xe57a43,_0x5c1991,_0x19df49,_0x5c7b25,_0x235644,_0x5f2b9d){var _0x18b412,_0x4ff582;_0x235644[_0x9b92('0xf')]=intUtil[_0x9b92('0x62')](_0x235644[_0x9b92('0xf')]);_0x235644[_0x9b92('0x49')]=intUtil[_0x9b92('0x62')](_0x235644[_0x9b92('0x49')]);if(_0x5f2b9d&&_0x5f2b9d[_0x9b92('0x63')]&&_0x5f2b9d['recordingFormat']!=='none'){logger[_0x9b92('0xc')](_0x9b92('0x64'),_0x9b92('0x4b'));_0xe57a43[_0x9b92('0x4e')]=util[_0x9b92('0x1c')](_0x9b92('0x4c'),_0x235644[_0x9b92('0x49')],_0xe57a43[_0x9b92('0x4d')],md5(_0xe57a43[_0x9b92('0x4d')]));}headers[_0x9b92('0x4f')]=getAuth(_0x235644);return getUser(_0x235644,_0x19df49[_0x9b92('0x50')])[_0x9b92('0x16')](function(_0x33645a){_0x18b412=_0x33645a;logger[_0x9b92('0xc')]('The\x20User\x20ID\x20is:',_0x18b412['id']);return getEndUser(_0x235644,_0xe57a43[_0x9b92('0x65')],_0xe57a43[_0x9b92('0x66')]);})['then'](function(_0x3ed7f2){_0x4ff582=_0x3ed7f2;logger[_0x9b92('0xc')]('The\x20Enduser\x20ID\x20is:',_0x4ff582['id']);return getTicket(_0x235644,_0x18b412,_0x4ff582,_0x5c1991,_0xe57a43);})[_0x9b92('0x16')](function(_0x2a57c7){if(_0x2a57c7){logger[_0x9b92('0xc')](_0x9b92('0x67'),_0x2a57c7['id']);switch(_0x235644[_0x9b92('0x3b')]){case _0x9b92('0x55'):logger['info'](_0x9b92('0x64'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x9b92('0x1c')](_0x9b92('0x57'),_0x235644['remoteUri'],_0x18b412['id'],_0x2a57c7['id']),'method':'POST'});case _0x9b92('0x58'):logger[_0x9b92('0xc')](_0x9b92('0x64'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9b92('0x1c')](_0x9b92('0x59'),_0x19df49['name']),_0x9b92('0x68'),{'uri':util[_0x9b92('0x1c')](_0x9b92('0x5a'),_0x235644[_0x9b92('0xf')][_0x9b92('0x5b')](_0x9b92('0x69'),''),_0x2a57c7['id'])});break;default:logger['error'](_0x9b92('0x64'),_0x9b92('0x5d'));}}})[_0x9b92('0x5e')](function(_0x56d594){logger[_0x9b92('0x5c')](_0x9b92('0x6a'),util['inspect'](_0x56d594,{'showHidden':!![],'depth':null}));});};exports[_0x9b92('0x6b')]=function(_0x288760,_0x18c7b2,_0x2e70c5,_0x13c0c1,_0x4c78d4,_0x40e6b5){var _0x1bece1,_0x23db8c;_0x40e6b5[_0x9b92('0xf')]=intUtil['stripTrailingSlash'](_0x40e6b5[_0x9b92('0xf')]);_0x40e6b5[_0x9b92('0x49')]=intUtil[_0x9b92('0x62')](_0x40e6b5[_0x9b92('0x49')]);if(_0x4c78d4&&_0x4c78d4[_0x9b92('0x6c')]){logger['info']('['+_0x18c7b2[_0x9b92('0x6d')]['toUpperCase']()+']',_0x9b92('0x4b'));_0x18c7b2[_0x9b92('0x4e')]=util[_0x9b92('0x1c')](_0x9b92('0x4c'),_0x40e6b5[_0x9b92('0x49')],_0x18c7b2[_0x9b92('0x4d')],md5(_0x18c7b2[_0x9b92('0x4d')]));}else{_0x18c7b2[_0x9b92('0x4e')]='';}headers[_0x9b92('0x4f')]=getAuth(_0x40e6b5);return getUser(_0x40e6b5)[_0x9b92('0x16')](function(_0x7814ff){_0x1bece1=_0x7814ff;logger[_0x9b92('0xc')](_0x9b92('0x51'),_0x1bece1['id']);return getEndUser(_0x40e6b5,_0x18c7b2[_0x9b92('0x52')],_0x18c7b2[_0x9b92('0x53')]);})[_0x9b92('0x16')](function(_0xbfad6d){_0x23db8c=_0xbfad6d;logger[_0x9b92('0xc')]('The\x20Enduser\x20ID\x20is:',_0x23db8c['id']);return getTicket(_0x40e6b5,_0x1bece1,_0x23db8c,_0x2e70c5,_0x18c7b2);})['then'](function(_0x10f002){if(_0x10f002){logger['info'](_0x9b92('0x67'),_0x10f002['id']);}})['catch'](function(_0x3c6862){logger[_0x9b92('0x5c')]('['+_0x18c7b2[_0x9b92('0x6d')][_0x9b92('0x6e')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x9b92('0x60')](_0x3c6862,{'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 193085f..0381f18 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 _0xbfe0=['stack','info','format','ActiveUsers','isArrayLikeObject','findIndex','users','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','data','SUCCESS','details','enduserType','CREATE\x20ERROR','GET','moduleSearch','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Leads','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','called','Called','complete','Answered','Rejected','abandoned','Call_Result','Abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','code','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','recordingURL','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','zoho.eu','Outbound','https://crm.','lastevent','/downloads?type=uniqueid&token=','toUpperCase','lodash','md5','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','debug','stringify','length','includes','string','picklist','toString','type','variable','idField','variableName','customVariable','name','Variable','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','refreshToken','refresh_token','then','seconds','catch','error','Failing\x20creating\x20the\x20access_token'];(function(_0x1a51c8,_0x2ff411){var _0x13bd4c=function(_0x4f0117){while(--_0x4f0117){_0x1a51c8['push'](_0x1a51c8['shift']());}};_0x13bd4c(++_0x2ff411);}(_0xbfe0,0x6d));var _0x0bfe=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xbfe0[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x0bfe('0x0'));var rp=require('request-promise');var md5=require(_0x0bfe('0x1'));var util=require(_0x0bfe('0x2'));var intUtil=require('./util');var moment=require(_0x0bfe('0x3'));var Redis=require(_0x0bfe('0x4'));var BPromise=require(_0x0bfe('0x5'));var config=require(_0x0bfe('0x6'));var logger=require(_0x0bfe('0x7'))('zoho');config[_0x0bfe('0x8')]=_[_0x0bfe('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0bfe('0x8')]));function emit(_0x547026,_0xaa5e8e,_0x3761ff){io['to'](_0x547026)['emit'](_0xaa5e8e,_0x3761ff);}function request(_0x55c532){logger[_0x0bfe('0xa')]('[HTTP]',JSON[_0x0bfe('0xb')](_0x55c532));return rp(_0x55c532);}function getCustomFields(_0x2dacf8,_0x1acf04){var _0x2ea0aa={};if(_0x2dacf8[_0x0bfe('0xc')]>0x0){_['forEach'](_0x2dacf8,function(_0x3abde6){if(_[_0x0bfe('0xd')]([_0x0bfe('0xe'),_0x0bfe('0xf')],_0x3abde6['type'])&&_0x3abde6['idField']){_0x2ea0aa[_0x3abde6['idField']]=_0x3abde6['content'][_0x0bfe('0x10')]();}else if(_0x3abde6[_0x0bfe('0x11')]===_0x0bfe('0x12')&&_0x3abde6['variableName']&&_0x3abde6[_0x0bfe('0x13')]&&_0x1acf04[_0x3abde6[_0x0bfe('0x14')]]){_0x2ea0aa[_0x3abde6['idField']]=_0x1acf04[_0x3abde6['variableName']][_0x0bfe('0x10')]();}else if(_0x3abde6[_0x0bfe('0x11')]===_0x0bfe('0x15')&&_0x3abde6['Variable']&&_0x3abde6['Variable'][_0x0bfe('0x16')]&&_0x3abde6[_0x0bfe('0x13')]&&_0x1acf04[_0x3abde6[_0x0bfe('0x17')]['name']['toLowerCase']()]){_0x2ea0aa[_0x3abde6[_0x0bfe('0x13')]]=_0x1acf04[_0x3abde6['Variable'][_0x0bfe('0x16')][_0x0bfe('0x18')]()][_0x0bfe('0x10')]();}});}return _0x2ea0aa;}function getName(_0x2b85a5){if(_0x2b85a5[_0x0bfe('0x19')]('\x20')>0x0){var _0x58cdee=_0x2b85a5[_0x0bfe('0x1a')](/ (.+)/);if(_0x58cdee[0x1]){return _0x58cdee;}}return[_0x2b85a5,_0x2b85a5];}var accountsTokens={};function getAccessToken(_0x484e27){return new Promise(function(_0x26abfc,_0x227c9c){if(!_[_0x0bfe('0x1b')](accountsTokens[_0x484e27['id']])&&!_[_0x0bfe('0x1b')](accountsTokens[_0x484e27['id']][_0x0bfe('0x1c')])){if(moment()[_0x0bfe('0x1d')](accountsTokens[_0x484e27['id']][_0x0bfe('0x1e')])){_0x26abfc(accountsTokens[_0x484e27['id']][_0x0bfe('0x1c')]);}}var _0x15ff34;switch(_0x484e27[_0x0bfe('0x1f')]){case'US':_0x15ff34=_0x0bfe('0x20');break;case'AU':_0x15ff34=_0x0bfe('0x21');break;case'EU':_0x15ff34=_0x0bfe('0x22');break;case'IN':_0x15ff34=_0x0bfe('0x23');break;case'CN':_0x15ff34='https://accounts.zoho.com.cn';break;default:_0x15ff34=_0x0bfe('0x22');break;}var _0x40c936={'method':_0x0bfe('0x24'),'uri':_0x15ff34+'/oauth/v2/token','qs':{'refresh_token':_0x484e27[_0x0bfe('0x25')],'client_id':_0x484e27['clientId'],'client_secret':_0x484e27['clientSecret'],'grant_type':_0x0bfe('0x26')},'json':!![]};return rp(_0x40c936)[_0x0bfe('0x27')](function(_0x29edc6){accountsTokens[_0x484e27['id']]={'access_token':_0x29edc6['access_token'],'expires_in':moment()['add'](_0x29edc6['expires_in'],_0x0bfe('0x28'))};_0x26abfc(_0x29edc6[_0x0bfe('0x1c')]);})[_0x0bfe('0x29')](function(_0xf2be94){logger[_0x0bfe('0x2a')](_0x0bfe('0x2b'),_0xf2be94[_0x0bfe('0x2c')]);_0x227c9c(_0xf2be94);});});}function getUser(_0xe2c4ed,_0x1d260d,_0x3593ac,_0x30cea7){logger[_0x0bfe('0x2d')]('Search\x20user');return request({'method':'GET','uri':util[_0x0bfe('0x2e')]('https://www.zohoapis.%s/crm/v2/users',_0x1d260d),'qs':{'type':_0x0bfe('0x2f')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xe2c4ed},'json':!![]})[_0x0bfe('0x27')](function(_0x15bcd4){if(_0x15bcd4['users']){var _0x319981=-0x1;if(_[_0x0bfe('0x30')](_0x15bcd4['users'])){if(!_[_0x0bfe('0x1b')](_0x30cea7)){_0x319981=_[_0x0bfe('0x31')](_0x15bcd4[_0x0bfe('0x32')],function(_0x4dd897){return _0x4dd897[_0x0bfe('0x33')]===_0x30cea7;});}if(_0x319981>=0x0){logger[_0x0bfe('0x2d')](_0x0bfe('0x34'));}else{logger[_0x0bfe('0x2d')](_0x0bfe('0x35'));_0x319981=_[_0x0bfe('0x31')](_0x15bcd4[_0x0bfe('0x32')],function(_0x56de79){return _0x56de79[_0x0bfe('0x36')][_0x0bfe('0x16')]===_0x0bfe('0x37');});}return _0x15bcd4['users'][_0x319981];}else{if(_0x15bcd4[_0x0bfe('0x38')][_0x0bfe('0x36')]['name']===_0x0bfe('0x37')){logger[_0x0bfe('0x2d')](_0x0bfe('0x35'));user=_0x15bcd4[_0x0bfe('0x38')];return user;}else{logger[_0x0bfe('0x2a')](_0x0bfe('0x39'),JSON[_0x0bfe('0xb')](_0x15bcd4));throw new Error(_0x0bfe('0x3a')+JSON[_0x0bfe('0xb')](_0x15bcd4));}}}else{logger[_0x0bfe('0x2a')](_0x0bfe('0x39'),JSON[_0x0bfe('0xb')](_0x15bcd4));throw new Error(_0x0bfe('0x3a')+JSON['stringify'](_0x15bcd4));}})['catch'](function(_0x56b422){console[_0x0bfe('0x2a')](_0x56b422);});}function getZohoUser(_0x5e4ba2,_0x394d81){return new BPromise(function(_0x455ab3,_0x4bea48){request(_0x5e4ba2)[_0x0bfe('0x27')](function(_0x2940c7){var _0x1f388a=null;if(_0x2940c7){_0x1f388a=_0x2940c7['data'][0x0];_0x1f388a['enduserType']=_0x394d81;}_0x455ab3(_0x1f388a);})[_0x0bfe('0x29')](function(_0x1fa15c){_0x4bea48(_0x1fa15c);});});}function createEndUser(_0x4b4569,_0x679fd9,_0x29902e,_0x5646fd,_0x1ed174,_0x311f4b){var _0x29902e=getName(_0x29902e);return request({'method':'POST','uri':_0x0bfe('0x3b')+_0x679fd9+_0x0bfe('0x3c')+_[_0x0bfe('0x3d')](_0x311f4b[_0x0bfe('0x3e')])+'s','body':{'data':[{'Last_Name':_0x29902e[0x1],'First_Name':_0x29902e[0x0],'Phone':_0x5646fd,'Owner':{'name':!_[_0x0bfe('0x1b')](_0x1ed174[_0x0bfe('0x3f')]['name'])?_0x1ed174[_0x0bfe('0x3f')][_0x0bfe('0x16')]:!_['isNil'](_0x1ed174[_0x0bfe('0x40')])?_0x1ed174[_0x0bfe('0x40')]+'\x20'+_0x1ed174[_0x0bfe('0x41')]:_0x1ed174[_0x0bfe('0x41')],'id':_0x1ed174['id']}}]},'headers':{'Authorization':_0x0bfe('0x42')+_0x4b4569},'json':!![]})['then'](function(_0xdb5d72){if(_0xdb5d72&&_0xdb5d72[_0x0bfe('0x43')][0x0]['code']===_0x0bfe('0x44')){var _0x1cf30f=_0xdb5d72[_0x0bfe('0x43')][0x0][_0x0bfe('0x45')];_0x1cf30f[_0x0bfe('0x46')]=_[_0x0bfe('0x3d')](_0x311f4b['moduleCreate'])+'s';return _0x1cf30f;}logger[_0x0bfe('0x2a')]('The\x20failing\x20result\x20is',JSON[_0x0bfe('0xb')](data));throw new Error('Error:\x20'+JSON[_0x0bfe('0xb')](data));})[_0x0bfe('0x29')](function(_0x18ca23){console['log'](_0x0bfe('0x47'),_0x18ca23);});}function getEndUser(_0x3df733,_0x7e4c51,_0x4bf9f3,_0x2173ad,_0x56b388,_0x298ae0,_0x438c72){var _0xd48696={'method':_0x0bfe('0x48'),'uri':'','headers':{'Authorization':_0x0bfe('0x42')+_0x3df733},'json':!![]};switch(_0x438c72[_0x0bfe('0x49')]){case'contact_lead':_0xd48696[_0x0bfe('0x4a')]='https://www.zohoapis.'+_0x7e4c51+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x56b388+'))';return getZohoUser(_0xd48696,_0x0bfe('0x4b'))['then'](function(_0x261576){if(_0x261576)return _0x261576;_0xd48696[_0x0bfe('0x4a')]=_0x0bfe('0x3b')+_0x7e4c51+_0x0bfe('0x4c')+_0x56b388+'))';return getZohoUser(_0xd48696,'Leads')['then'](function(_0x16b3d5){if(_0x16b3d5)return _0x16b3d5;if(_0x438c72['moduleCreate']!=_0x0bfe('0x4d')){return createEndUser(_0x3df733,_0x7e4c51,_0x2173ad,_0x56b388,_0x298ae0,_0x438c72);}else{return{};}});});break;case _0x0bfe('0x4e'):_0xd48696[_0x0bfe('0x4a')]=_0x0bfe('0x3b')+_0x7e4c51+_0x0bfe('0x4f')+_0x56b388+'))';return getZohoUser(_0xd48696,_0x0bfe('0x4b'))[_0x0bfe('0x27')](function(_0x17e805){if(_0x17e805)return _0x17e805;if(_0x438c72[_0x0bfe('0x3e')]!=_0x0bfe('0x4d')){return createEndUser(_0x3df733,_0x7e4c51,_0x2173ad,_0x56b388,_0x298ae0,_0x438c72);}else{return{};}});break;case _0x0bfe('0x50'):_0xd48696[_0x0bfe('0x4a')]=_0x0bfe('0x3b')+_0x7e4c51+_0x0bfe('0x4c')+_0x56b388+'))';return getZohoUser(_0xd48696,_0x0bfe('0x51'))['then'](function(_0x54cffb){if(_0x54cffb)return _0x54cffb;if(_0x438c72[_0x0bfe('0x3e')]!='nothing'){return createEndUser(_0x3df733,_0x7e4c51,_0x2173ad,_0x56b388,_0x298ae0,_0x438c72);}else{return{};}});break;}}function getCall(_0x2e7e76,_0x110d9,_0xeb1b1f,_0x5a6985,_0x25c085,_0x576afc,_0x19f856,_0x3432b4){logger['info'](_0x0bfe('0x52'));var _0x3a9b43={};_0x3a9b43[_0x0bfe('0x53')]={'name':!_[_0x0bfe('0x1b')](_0x5a6985[_0x0bfe('0x3f')]['name'])&&!_['isNil'](_0x5a6985['profile'][_0x0bfe('0x16')])&&_0x5a6985[_0x0bfe('0x36')][_0x0bfe('0x16')]==='administrator'?_0x5a6985[_0x0bfe('0x3f')][_0x0bfe('0x16')]:!_[_0x0bfe('0x1b')](_0x5a6985['first_name'])?_0x5a6985[_0x0bfe('0x40')]+'\x20'+_0x5a6985[_0x0bfe('0x41')]:_0x5a6985[_0x0bfe('0x41')],'id':_0x5a6985['id']};_0x3a9b43[_0x0bfe('0x54')]=intUtil[_0x0bfe('0x55')](_0x576afc[_0x0bfe('0x56')],_0x19f856,'\x20');_0x3a9b43[_0x0bfe('0x57')]=intUtil['getString'](_0x576afc[_0x0bfe('0x58')],_0x19f856,'\x0a');if(_0x25c085[_0x0bfe('0x46')]===_0x0bfe('0x4b')){_0x3a9b43[_0x0bfe('0x59')]={'name':!_['isNil'](_0x25c085['Full_Name'])?_0x25c085[_0x0bfe('0x5a')]:!_[_0x0bfe('0x1b')](_0x25c085['First_Name'])?_0x25c085[_0x0bfe('0x5b')]+'\x20'+_0x25c085[_0x0bfe('0x5c')]:_0x25c085[_0x0bfe('0x5c')],'id':_0x25c085['id']};}if(_0x25c085[_0x0bfe('0x46')]===_0x0bfe('0x51')){_0x3a9b43[_0x0bfe('0x5d')]={'name':!_['isNil'](_0x25c085[_0x0bfe('0x5a')])?_0x25c085[_0x0bfe('0x5a')]:!_['isNil'](_0x25c085[_0x0bfe('0x5b')])?_0x25c085[_0x0bfe('0x5b')]+'\x20'+_0x25c085[_0x0bfe('0x5c')]:_0x25c085[_0x0bfe('0x5c')],'id':_0x25c085['id']};_0x3a9b43[_0x0bfe('0x5e')]=_[_0x0bfe('0x3d')](_0x25c085[_0x0bfe('0x46')]);}if(_0x19f856[_0x0bfe('0x5f')]){_0x3a9b43['Call_Duration']=moment[_0x0bfe('0x60')](parseInt(_0x19f856[_0x0bfe('0x5f')])*0x3e8)['format'](_0x0bfe('0x61'));}else if(_0x19f856[_0x0bfe('0x62')]&&_0x19f856[_0x0bfe('0x63')]){_0x3a9b43[_0x0bfe('0x64')]=moment[_0x0bfe('0x60')](moment(_0x19f856[_0x0bfe('0x63')],_0x0bfe('0x65'))[_0x0bfe('0x66')](moment(_0x19f856['starttime'],_0x0bfe('0x65'))))['format']('mm:ss');}switch(_0x19f856['lastevent']){case _0x0bfe('0x67'):_0x3a9b43['Call_Result']=_0x0bfe('0x68');break;case _0x0bfe('0x69'):case'connect':_0x3a9b43['Call_Result']=_0x0bfe('0x6a');break;case'rejected':_0x3a9b43['Call_Result']=_0x0bfe('0x6b');break;case _0x0bfe('0x6c'):_0x3a9b43[_0x0bfe('0x6d')]=_0x0bfe('0x6e');break;case _0x0bfe('0x6f'):_0x3a9b43['Call_Result']=_0x0bfe('0x70');default:}_0x3a9b43[_0x0bfe('0x71')]=(_0x3432b4===_0x0bfe('0x72')?moment(_0x19f856[_0x0bfe('0x73')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x19f856[_0x0bfe('0x74')])[_0x0bfe('0x2e')](_0x0bfe('0x65')))||moment()[_0x0bfe('0x2e')]('YYYY-MM-DDTHH:mm:ss');_0x3a9b43[_0x0bfe('0x75')]=_0x3432b4||_0x0bfe('0x76');_0x3a9b43=_[_0x0bfe('0x77')](_0x3a9b43,getCustomFields(_0x576afc[_0x0bfe('0x78')],_0x19f856));return request({'method':_0x0bfe('0x24'),'uri':_0x0bfe('0x3b')+_0x110d9+_0x0bfe('0x79'),'headers':{'Authorization':_0x0bfe('0x42')+_0x2e7e76},'body':{'data':[_0x3a9b43]},'json':!![]})['then'](function(_0x28e4a7){if(_0x28e4a7&&_0x28e4a7[_0x0bfe('0x43')][0x0][_0x0bfe('0x7a')]==='SUCCESS'){logger[_0x0bfe('0x2d')](_0x0bfe('0x7b'));return{'id':_0x28e4a7[_0x0bfe('0x43')][0x0][_0x0bfe('0x45')]['id']};}})['catch'](function(_0xe687c){logger['info'](_0x0bfe('0x7c'),_0xe687c[_0x0bfe('0x2c')]);console['log'](_0x0bfe('0x7c'),_0xe687c);});}exports[_0x0bfe('0x7d')]=function(_0x3db0ab,_0x40d8bc,_0x5e0794,_0x5ae16,_0x3c1e03,_0x4c4245){var _0x409fa9,_0x337afd,_0x3b2000;_0x4c4245[_0x0bfe('0x7e')]=intUtil[_0x0bfe('0x7f')](_0x4c4245['host']);_0x4c4245['serverUrl']=intUtil['stripTrailingSlash'](_0x4c4245[_0x0bfe('0x80')]);if(_0x3c1e03&&_0x3c1e03[_0x0bfe('0x81')]){logger[_0x0bfe('0x2d')](_0x0bfe('0x82'),_0x0bfe('0x83'));_0x40d8bc['recordingURL']=_0x4c4245[_0x0bfe('0x80')]+_0x0bfe('0x84')+_0x40d8bc['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x40d8bc[_0x0bfe('0x85')]);}else{_0x40d8bc[_0x0bfe('0x86')]='';}var _0xa9e50a=_0x4c4245[_0x0bfe('0x7e')]==='zoho.eu'?'eu':_0x0bfe('0x87');return getAccessToken(_0x4c4245)[_0x0bfe('0x27')](function(_0x107417){_0x3b2000=_0x107417;return getUser(_0x3b2000,_0xa9e50a,_0x4c4245,_0x5ae16[_0x0bfe('0x33')]);})[_0x0bfe('0x27')](function(_0x27bd23){_0x409fa9=_0x27bd23;logger['info'](_0x0bfe('0x88'),_0x409fa9['id']);return getEndUser(_0x3b2000,_0xa9e50a,_0x4c4245,_0x40d8bc[_0x0bfe('0x89')],_0x40d8bc[_0x0bfe('0x8a')],_0x409fa9,_0x5e0794);})[_0x0bfe('0x27')](function(_0x2402da){_0x337afd=_0x2402da;return getCall(_0x3b2000,_0xa9e50a,_0x4c4245,_0x409fa9,_0x337afd,_0x5e0794,_0x40d8bc,'Inbound');})[_0x0bfe('0x27')](function(_0x402dc5){if(_0x402dc5){logger[_0x0bfe('0x2d')](_0x0bfe('0x8b'),_0x402dc5['id']);logger['info'](_0x0bfe('0x82'),_0x0bfe('0x8c'));emit(util[_0x0bfe('0x2e')](_0x0bfe('0x8d'),_0x5ae16['name']),_0x0bfe('0x8e'),{'uri':'https://crm.'+_0x4c4245[_0x0bfe('0x7e')]+_0x0bfe('0x8f')+_0x402dc5['id']});}})['catch'](function(_0x55673c){logger[_0x0bfe('0x2a')](_0x0bfe('0x82'),JSON[_0x0bfe('0xb')](_0x55673c));});};exports['outbound']=function(_0x33eb11,_0x3b128e,_0x20b049,_0x553c20,_0x2d94c9,_0x355f35,_0x5ec396){var _0x4127d0,_0x284354,_0x54e928;_0x355f35['host']=intUtil[_0x0bfe('0x7f')](_0x355f35[_0x0bfe('0x7e')]);_0x355f35[_0x0bfe('0x80')]=intUtil[_0x0bfe('0x7f')](_0x355f35[_0x0bfe('0x80')]);if(_0x5ec396&&_0x5ec396[_0x0bfe('0x90')]&&_0x5ec396[_0x0bfe('0x90')]!==_0x0bfe('0x91')){logger[_0x0bfe('0x2d')](_0x0bfe('0x92'),_0x0bfe('0x83'));_0x3b128e['recordingURL']=_0x355f35[_0x0bfe('0x80')]+_0x0bfe('0x84')+_0x3b128e[_0x0bfe('0x85')]+'/downloads?type=uniqueid&token='+md5(_0x3b128e['uniqueid']);}var _0x333772=_0x355f35['host']===_0x0bfe('0x93')?'eu':_0x0bfe('0x87');return getAccessToken(_0x355f35)['then'](function(_0x2b7124){_0x54e928=_0x2b7124;return getUser(_0x54e928,_0x333772,_0x355f35,_0x553c20[_0x0bfe('0x33')]);})[_0x0bfe('0x27')](function(_0x3021c3){_0x4127d0=_0x3021c3;logger['info'](_0x0bfe('0x88'),_0x4127d0['id']);return getEndUser(_0x54e928,_0x333772,_0x355f35,_0x3b128e['destcalleridname'],_0x3b128e['destcalleridnum'],_0x4127d0,_0x20b049);})[_0x0bfe('0x27')](function(_0x44401f){_0x284354=_0x44401f;return getCall(_0x54e928,_0x333772,_0x355f35,_0x4127d0,_0x284354,_0x20b049,_0x3b128e,_0x0bfe('0x94'));})[_0x0bfe('0x27')](function(_0x27cbe1){if(_0x27cbe1){logger[_0x0bfe('0x2d')](_0x0bfe('0x8b'),_0x27cbe1['id']);logger[_0x0bfe('0x2d')]('[OUTBOUND]',_0x0bfe('0x8c'));emit(util[_0x0bfe('0x2e')](_0x0bfe('0x8d'),_0x553c20[_0x0bfe('0x16')]),_0x0bfe('0x8e'),{'uri':_0x0bfe('0x95')+_0x355f35[_0x0bfe('0x7e')]+'/crm/EntityInfo.do?module=Calls&id='+_0x27cbe1['id']});}})[_0x0bfe('0x29')](function(_0x17ec08){logger['error'](_0x0bfe('0x92'),JSON['stringify'](_0x17ec08));});};exports['unmanaged']=function(_0xbe1c8c,_0x1fffdb,_0x25e44d,_0x1c7fb4,_0x32fb36,_0x11438b){var _0x31c09d,_0x57efd5,_0x201324;_0x11438b[_0x0bfe('0x7e')]=intUtil[_0x0bfe('0x7f')](_0x11438b['host']);_0x11438b[_0x0bfe('0x80')]=intUtil[_0x0bfe('0x7f')](_0x11438b[_0x0bfe('0x80')]);if(_0x32fb36&&_0x32fb36[_0x0bfe('0x81')]){logger[_0x0bfe('0x2d')]('['+_0x1fffdb[_0x0bfe('0x96')]['toUpperCase']()+']',_0x0bfe('0x83'));_0x1fffdb[_0x0bfe('0x86')]=_0x11438b[_0x0bfe('0x80')]+'/api/voice/recordings/'+_0x1fffdb[_0x0bfe('0x85')]+_0x0bfe('0x97')+md5(_0x1fffdb[_0x0bfe('0x85')]);}else{_0x1fffdb[_0x0bfe('0x86')]='';}var _0x241c0b=_0x11438b[_0x0bfe('0x7e')]===_0x0bfe('0x93')?'eu':_0x0bfe('0x87');return getAccessToken(_0x11438b)[_0x0bfe('0x27')](function(_0xb8cd26){_0x201324=_0xb8cd26;return getUser(_0x201324,_0x241c0b,_0x11438b);})[_0x0bfe('0x27')](function(_0x5b4e28){_0x31c09d=_0x5b4e28;logger[_0x0bfe('0x2d')](_0x0bfe('0x88'),_0x31c09d['id']);return getEndUser(_0x201324,_0x241c0b,_0x11438b,_0x1fffdb[_0x0bfe('0x89')],_0x1fffdb[_0x0bfe('0x8a')],_0x31c09d,_0x25e44d);})['then'](function(_0x96c390){_0x57efd5=_0x96c390;return getCall(_0x201324,_0x241c0b,_0x11438b,_0x31c09d,_0x57efd5,_0x25e44d,_0x1fffdb,'Inbound');})['then'](function(_0x290144){if(_0x290144){logger[_0x0bfe('0x2d')](_0x0bfe('0x8b'),_0x290144['id']);}})[_0x0bfe('0x29')](function(_0x32aa47){logger['error']('['+_0x1fffdb['lastevent'][_0x0bfe('0x98')]()+']',JSON[_0x0bfe('0xb')](_0x32aa47));});}; \ No newline at end of file +var _0x2f90=['Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','/crm/EntityInfo.do?module=Calls&id=','[QUEUE]','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','trigger:browser:url','https://crm.','toUpperCase','The\x20User\x20ID\x20is:','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','length','includes','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','expires_in','seconds','catch','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','Zoho-oauthtoken\x20','SUCCESS','details','enduserType','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Leads','Owner','administrator','Subject','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Called','complete','Call_Result','Answered','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','code','queue','host','stripTrailingSlash','serverUrl','monitor_format'];(function(_0x23c217,_0x3aee12){var _0x53fcf8=function(_0x133202){while(--_0x133202){_0x23c217['push'](_0x23c217['shift']());}};_0x53fcf8(++_0x3aee12);}(_0x2f90,0x1e9));var _0x02f9=function(_0xfd80d5,_0x303f80){_0xfd80d5=_0xfd80d5-0x0;var _0xeb957d=_0x2f90[_0xfd80d5];return _0xeb957d;};'use strict';var _=require('lodash');var rp=require(_0x02f9('0x0'));var md5=require(_0x02f9('0x1'));var util=require(_0x02f9('0x2'));var intUtil=require(_0x02f9('0x3'));var moment=require(_0x02f9('0x4'));var Redis=require(_0x02f9('0x5'));var BPromise=require(_0x02f9('0x6'));var config=require(_0x02f9('0x7'));var logger=require(_0x02f9('0x8'))('zoho');config[_0x02f9('0x9')]=_[_0x02f9('0xa')](config[_0x02f9('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x02f9('0xb'))(new Redis(config['redis']));function emit(_0x34135f,_0x3b8788,_0x30ed8){io['to'](_0x34135f)[_0x02f9('0xc')](_0x3b8788,_0x30ed8);}function request(_0x180237){logger[_0x02f9('0xd')](_0x02f9('0xe'),JSON[_0x02f9('0xf')](_0x180237));return rp(_0x180237);}function getCustomFields(_0x45fbc8,_0x312a4a){var _0xff761d={};if(_0x45fbc8[_0x02f9('0x10')]>0x0){_['forEach'](_0x45fbc8,function(_0x3ff58f){if(_[_0x02f9('0x11')](['string',_0x02f9('0x12')],_0x3ff58f[_0x02f9('0x13')])&&_0x3ff58f['idField']){_0xff761d[_0x3ff58f[_0x02f9('0x14')]]=_0x3ff58f[_0x02f9('0x15')][_0x02f9('0x16')]();}else if(_0x3ff58f[_0x02f9('0x13')]==='variable'&&_0x3ff58f[_0x02f9('0x17')]&&_0x3ff58f[_0x02f9('0x14')]&&_0x312a4a[_0x3ff58f['variableName']]){_0xff761d[_0x3ff58f[_0x02f9('0x14')]]=_0x312a4a[_0x3ff58f[_0x02f9('0x17')]][_0x02f9('0x16')]();}else if(_0x3ff58f['type']===_0x02f9('0x18')&&_0x3ff58f[_0x02f9('0x19')]&&_0x3ff58f[_0x02f9('0x19')][_0x02f9('0x1a')]&&_0x3ff58f[_0x02f9('0x14')]&&_0x312a4a[_0x3ff58f[_0x02f9('0x19')][_0x02f9('0x1a')][_0x02f9('0x1b')]()]){_0xff761d[_0x3ff58f[_0x02f9('0x14')]]=_0x312a4a[_0x3ff58f[_0x02f9('0x19')]['name'][_0x02f9('0x1b')]()][_0x02f9('0x16')]();}});}return _0xff761d;}function getName(_0x19679a){if(_0x19679a[_0x02f9('0x1c')]('\x20')>0x0){var _0x2a8591=_0x19679a[_0x02f9('0x1d')](/ (.+)/);if(_0x2a8591[0x1]){return _0x2a8591;}}return[_0x19679a,_0x19679a];}var accountsTokens={};function getAccessToken(_0x3fedd5){return new Promise(function(_0xcf61b8,_0x498438){if(!_['isNil'](accountsTokens[_0x3fedd5['id']])&&!_[_0x02f9('0x1e')](accountsTokens[_0x3fedd5['id']][_0x02f9('0x1f')])){if(moment()[_0x02f9('0x20')](accountsTokens[_0x3fedd5['id']]['expires_in'])){_0xcf61b8(accountsTokens[_0x3fedd5['id']][_0x02f9('0x1f')]);}}var _0xcbc145;switch(_0x3fedd5[_0x02f9('0x21')]){case'US':_0xcbc145=_0x02f9('0x22');break;case'AU':_0xcbc145=_0x02f9('0x23');break;case'EU':_0xcbc145=_0x02f9('0x24');break;case'IN':_0xcbc145=_0x02f9('0x25');break;case'CN':_0xcbc145=_0x02f9('0x26');break;default:_0xcbc145=_0x02f9('0x24');break;}var _0x4f8ea6={'method':_0x02f9('0x27'),'uri':_0xcbc145+'/oauth/v2/token','qs':{'refresh_token':_0x3fedd5[_0x02f9('0x28')],'client_id':_0x3fedd5[_0x02f9('0x29')],'client_secret':_0x3fedd5[_0x02f9('0x2a')],'grant_type':_0x02f9('0x2b')},'json':!![]};return rp(_0x4f8ea6)[_0x02f9('0x2c')](function(_0x25e78f){accountsTokens[_0x3fedd5['id']]={'access_token':_0x25e78f[_0x02f9('0x1f')],'expires_in':moment()[_0x02f9('0x2d')](_0x25e78f[_0x02f9('0x2e')],_0x02f9('0x2f'))};_0xcf61b8(_0x25e78f[_0x02f9('0x1f')]);})[_0x02f9('0x30')](function(_0x3210b9){logger[_0x02f9('0x31')]('Failing\x20creating\x20the\x20access_token',_0x3210b9[_0x02f9('0x32')]);_0x498438(_0x3210b9);});});}function getUser(_0x2398d3,_0xef1e04,_0x24ad4b,_0x104fac){logger[_0x02f9('0x33')](_0x02f9('0x34'));return request({'method':_0x02f9('0x35'),'uri':util[_0x02f9('0x36')](_0x02f9('0x37'),_0xef1e04),'qs':{'type':_0x02f9('0x38')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2398d3},'json':!![]})['then'](function(_0x18e432){if(_0x18e432[_0x02f9('0x39')]){var _0x284f8f=-0x1;if(_['isArrayLikeObject'](_0x18e432[_0x02f9('0x39')])){if(!_[_0x02f9('0x1e')](_0x104fac)){_0x284f8f=_[_0x02f9('0x3a')](_0x18e432['users'],function(_0x3f3438){return _0x3f3438[_0x02f9('0x3b')]===_0x104fac;});}if(_0x284f8f>=0x0){logger[_0x02f9('0x33')](_0x02f9('0x3c'));}else{logger[_0x02f9('0x33')](_0x02f9('0x3d'));_0x284f8f=_[_0x02f9('0x3a')](_0x18e432[_0x02f9('0x39')],function(_0xe9e13d){return _0xe9e13d[_0x02f9('0x3e')][_0x02f9('0x1a')]==='Administrator';});}return _0x18e432[_0x02f9('0x39')][_0x284f8f];}else{if(_0x18e432['user']['profile'][_0x02f9('0x1a')]==='Administrator'){logger['info'](_0x02f9('0x3d'));user=_0x18e432['user'];return user;}else{logger[_0x02f9('0x31')]('The\x20failing\x20result\x20is',JSON[_0x02f9('0xf')](_0x18e432));throw new Error(_0x02f9('0x3f')+JSON[_0x02f9('0xf')](_0x18e432));}}}else{logger['error'](_0x02f9('0x40'),JSON['stringify'](_0x18e432));throw new Error(_0x02f9('0x3f')+JSON[_0x02f9('0xf')](_0x18e432));}})['catch'](function(_0x1a0bbd){console['error'](_0x1a0bbd);});}function getZohoUser(_0x329033,_0x2353ae){return new BPromise(function(_0x31e031,_0x56d69f){request(_0x329033)[_0x02f9('0x2c')](function(_0x415d10){var _0x593678=null;if(_0x415d10){_0x593678=_0x415d10[_0x02f9('0x41')][0x0];_0x593678['enduserType']=_0x2353ae;}_0x31e031(_0x593678);})[_0x02f9('0x30')](function(_0xa0d739){_0x56d69f(_0xa0d739);});});}function createEndUser(_0x252a35,_0x50e1b4,_0x30a722,_0x21c7ed,_0x1e4f98,_0x18ae6e){var _0x30a722=getName(_0x30a722);return request({'method':_0x02f9('0x27'),'uri':_0x02f9('0x42')+_0x50e1b4+_0x02f9('0x43')+_[_0x02f9('0x44')](_0x18ae6e['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x30a722[0x1],'First_Name':_0x30a722[0x0],'Phone':_0x21c7ed,'Owner':{'name':!_[_0x02f9('0x1e')](_0x1e4f98['role'][_0x02f9('0x1a')])?_0x1e4f98[_0x02f9('0x45')][_0x02f9('0x1a')]:!_[_0x02f9('0x1e')](_0x1e4f98[_0x02f9('0x46')])?_0x1e4f98[_0x02f9('0x46')]+'\x20'+_0x1e4f98[_0x02f9('0x47')]:_0x1e4f98[_0x02f9('0x47')],'id':_0x1e4f98['id']}}]},'headers':{'Authorization':_0x02f9('0x48')+_0x252a35},'json':!![]})[_0x02f9('0x2c')](function(_0x24460c){if(_0x24460c&&_0x24460c[_0x02f9('0x41')][0x0]['code']===_0x02f9('0x49')){var _0x5d578b=_0x24460c[_0x02f9('0x41')][0x0][_0x02f9('0x4a')];_0x5d578b[_0x02f9('0x4b')]=_[_0x02f9('0x44')](_0x18ae6e[_0x02f9('0x4c')])+'s';return _0x5d578b;}logger[_0x02f9('0x31')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0x02f9('0x4d')+JSON['stringify'](data));})[_0x02f9('0x30')](function(_0x1d0a85){console[_0x02f9('0x4e')](_0x02f9('0x4f'),_0x1d0a85);});}function getEndUser(_0x32adca,_0x1b736d,_0x398b90,_0xd1baec,_0x1f6df0,_0x20c544,_0x268eac){var _0x1dd3be={'method':_0x02f9('0x35'),'uri':'','headers':{'Authorization':_0x02f9('0x48')+_0x32adca},'json':!![]};switch(_0x268eac[_0x02f9('0x50')]){case _0x02f9('0x51'):_0x1dd3be[_0x02f9('0x52')]=_0x02f9('0x42')+_0x1b736d+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x1f6df0+'))';return getZohoUser(_0x1dd3be,_0x02f9('0x53'))['then'](function(_0x29c442){if(_0x29c442)return _0x29c442;_0x1dd3be['uri']='https://www.zohoapis.'+_0x1b736d+_0x02f9('0x54')+_0x1f6df0+'))';return getZohoUser(_0x1dd3be,'Leads')[_0x02f9('0x2c')](function(_0xbc23c1){if(_0xbc23c1)return _0xbc23c1;if(_0x268eac[_0x02f9('0x4c')]!=_0x02f9('0x55')){return createEndUser(_0x32adca,_0x1b736d,_0xd1baec,_0x1f6df0,_0x20c544,_0x268eac);}else{return{};}});});break;case _0x02f9('0x56'):_0x1dd3be[_0x02f9('0x52')]=_0x02f9('0x42')+_0x1b736d+_0x02f9('0x57')+_0x1f6df0+'))';return getZohoUser(_0x1dd3be,_0x02f9('0x53'))[_0x02f9('0x2c')](function(_0x16a816){if(_0x16a816)return _0x16a816;if(_0x268eac[_0x02f9('0x4c')]!='nothing'){return createEndUser(_0x32adca,_0x1b736d,_0xd1baec,_0x1f6df0,_0x20c544,_0x268eac);}else{return{};}});break;case _0x02f9('0x58'):_0x1dd3be[_0x02f9('0x52')]=_0x02f9('0x42')+_0x1b736d+_0x02f9('0x54')+_0x1f6df0+'))';return getZohoUser(_0x1dd3be,_0x02f9('0x59'))[_0x02f9('0x2c')](function(_0x4341e0){if(_0x4341e0)return _0x4341e0;if(_0x268eac[_0x02f9('0x4c')]!=_0x02f9('0x55')){return createEndUser(_0x32adca,_0x1b736d,_0xd1baec,_0x1f6df0,_0x20c544,_0x268eac);}else{return{};}});break;}}function getCall(_0x5f14e7,_0x502368,_0x295781,_0x6e6d21,_0xddefd8,_0x2f8a7a,_0x3181f8,_0x18c331){logger[_0x02f9('0x33')]('Creating\x20new\x20call...');var _0x45689c={};_0x45689c[_0x02f9('0x5a')]={'name':!_[_0x02f9('0x1e')](_0x6e6d21[_0x02f9('0x45')][_0x02f9('0x1a')])&&!_[_0x02f9('0x1e')](_0x6e6d21[_0x02f9('0x3e')]['name'])&&_0x6e6d21[_0x02f9('0x3e')][_0x02f9('0x1a')]===_0x02f9('0x5b')?_0x6e6d21[_0x02f9('0x45')][_0x02f9('0x1a')]:!_['isNil'](_0x6e6d21['first_name'])?_0x6e6d21[_0x02f9('0x46')]+'\x20'+_0x6e6d21[_0x02f9('0x47')]:_0x6e6d21['last_name'],'id':_0x6e6d21['id']};_0x45689c[_0x02f9('0x5c')]=intUtil[_0x02f9('0x5d')](_0x2f8a7a['Subjects'],_0x3181f8,'\x20');_0x45689c['Description']=intUtil[_0x02f9('0x5d')](_0x2f8a7a[_0x02f9('0x5e')],_0x3181f8,'\x0a');if(_0xddefd8[_0x02f9('0x4b')]===_0x02f9('0x53')){_0x45689c[_0x02f9('0x5f')]={'name':!_['isNil'](_0xddefd8[_0x02f9('0x60')])?_0xddefd8[_0x02f9('0x60')]:!_['isNil'](_0xddefd8[_0x02f9('0x61')])?_0xddefd8[_0x02f9('0x61')]+'\x20'+_0xddefd8['Last_Name']:_0xddefd8['Last_Name'],'id':_0xddefd8['id']};}if(_0xddefd8[_0x02f9('0x4b')]==='Leads'){_0x45689c['What_Id']={'name':!_[_0x02f9('0x1e')](_0xddefd8['Full_Name'])?_0xddefd8[_0x02f9('0x60')]:!_[_0x02f9('0x1e')](_0xddefd8[_0x02f9('0x61')])?_0xddefd8['First_Name']+'\x20'+_0xddefd8[_0x02f9('0x62')]:_0xddefd8[_0x02f9('0x62')],'id':_0xddefd8['id']};_0x45689c[_0x02f9('0x63')]=_['startCase'](_0xddefd8[_0x02f9('0x4b')]);}if(_0x3181f8[_0x02f9('0x64')]){_0x45689c[_0x02f9('0x65')]=moment[_0x02f9('0x66')](parseInt(_0x3181f8['talktime'])*0x3e8)['format']('mm:ss');}else if(_0x3181f8['answertime']&&_0x3181f8[_0x02f9('0x67')]){_0x45689c[_0x02f9('0x65')]=moment['utc'](moment(_0x3181f8[_0x02f9('0x67')],_0x02f9('0x68'))[_0x02f9('0x69')](moment(_0x3181f8[_0x02f9('0x6a')],_0x02f9('0x68'))))[_0x02f9('0x36')](_0x02f9('0x6b'));}switch(_0x3181f8[_0x02f9('0x6c')]){case _0x02f9('0x6d'):_0x45689c['Call_Result']=_0x02f9('0x6e');break;case _0x02f9('0x6f'):case'connect':_0x45689c[_0x02f9('0x70')]=_0x02f9('0x71');break;case'rejected':_0x45689c[_0x02f9('0x70')]=_0x02f9('0x72');break;case _0x02f9('0x73'):_0x45689c['Call_Result']=_0x02f9('0x74');break;case _0x02f9('0x75'):_0x45689c[_0x02f9('0x70')]=_0x02f9('0x76');default:}_0x45689c['Call_Start_Time']=(_0x18c331===_0x02f9('0x77')?moment(_0x3181f8[_0x02f9('0x6a')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x3181f8['agentcalledAt'])[_0x02f9('0x36')](_0x02f9('0x68')))||moment()[_0x02f9('0x36')](_0x02f9('0x68'));_0x45689c[_0x02f9('0x78')]=_0x18c331||_0x02f9('0x79');_0x45689c=_[_0x02f9('0x7a')](_0x45689c,getCustomFields(_0x2f8a7a[_0x02f9('0x7b')],_0x3181f8));return request({'method':_0x02f9('0x27'),'uri':_0x02f9('0x42')+_0x502368+_0x02f9('0x7c'),'headers':{'Authorization':_0x02f9('0x48')+_0x5f14e7},'body':{'data':[_0x45689c]},'json':!![]})['then'](function(_0x3896cf){if(_0x3896cf&&_0x3896cf[_0x02f9('0x41')][0x0][_0x02f9('0x7d')]===_0x02f9('0x49')){logger[_0x02f9('0x33')]('Call\x20created!');return{'id':_0x3896cf[_0x02f9('0x41')][0x0]['details']['id']};}})[_0x02f9('0x30')](function(_0x91c036){logger[_0x02f9('0x33')]('err',_0x91c036[_0x02f9('0x32')]);console['log']('err',_0x91c036);});}exports[_0x02f9('0x7e')]=function(_0x1a5e46,_0x354a76,_0x8b0e4f,_0x9c0c48,_0x238ea0,_0x3befa6){var _0x25a9a1,_0x2bb96a,_0x4997c5;_0x3befa6[_0x02f9('0x7f')]=intUtil[_0x02f9('0x80')](_0x3befa6[_0x02f9('0x7f')]);_0x3befa6['serverUrl']=intUtil[_0x02f9('0x80')](_0x3befa6[_0x02f9('0x81')]);if(_0x238ea0&&_0x238ea0[_0x02f9('0x82')]){logger[_0x02f9('0x33')]('[QUEUE]',_0x02f9('0x83'));_0x354a76['recordingURL']=_0x3befa6[_0x02f9('0x81')]+_0x02f9('0x84')+_0x354a76[_0x02f9('0x85')]+_0x02f9('0x86')+md5(_0x354a76[_0x02f9('0x85')]);}else{_0x354a76['recordingURL']='';}var _0x2028b5=_0x3befa6[_0x02f9('0x7f')]===_0x02f9('0x87')?'eu':_0x02f9('0x88');return getAccessToken(_0x3befa6)[_0x02f9('0x2c')](function(_0x3f6104){_0x4997c5=_0x3f6104;return getUser(_0x4997c5,_0x2028b5,_0x3befa6,_0x9c0c48[_0x02f9('0x3b')]);})[_0x02f9('0x2c')](function(_0x3fd056){_0x25a9a1=_0x3fd056;logger[_0x02f9('0x33')]('The\x20User\x20ID\x20is:',_0x25a9a1['id']);return getEndUser(_0x4997c5,_0x2028b5,_0x3befa6,_0x354a76[_0x02f9('0x89')],_0x354a76[_0x02f9('0x8a')],_0x25a9a1,_0x8b0e4f);})[_0x02f9('0x2c')](function(_0x41d74a){_0x2bb96a=_0x41d74a;return getCall(_0x4997c5,_0x2028b5,_0x3befa6,_0x25a9a1,_0x2bb96a,_0x8b0e4f,_0x354a76,_0x02f9('0x79'));})['then'](function(_0x2fd37c){if(_0x2fd37c){logger['info']('The\x20Call\x20ID\x20is:',_0x2fd37c['id']);logger[_0x02f9('0x33')]('[QUEUE]',_0x02f9('0x8b'));emit(util[_0x02f9('0x36')](_0x02f9('0x8c'),_0x9c0c48[_0x02f9('0x1a')]),'trigger:browser:url',{'uri':'https://crm.'+_0x3befa6[_0x02f9('0x7f')]+_0x02f9('0x8d')+_0x2fd37c['id']});}})[_0x02f9('0x30')](function(_0x19f883){logger[_0x02f9('0x31')](_0x02f9('0x8e'),JSON['stringify'](_0x19f883));});};exports[_0x02f9('0x77')]=function(_0x3f0868,_0xb785fc,_0x58061a,_0x4c26af,_0x534133,_0x79fc13,_0x3f5ba8){var _0x2fcb5a,_0x2bdffc,_0x1b1e67;_0x79fc13['host']=intUtil[_0x02f9('0x80')](_0x79fc13[_0x02f9('0x7f')]);_0x79fc13['serverUrl']=intUtil[_0x02f9('0x80')](_0x79fc13[_0x02f9('0x81')]);if(_0x3f5ba8&&_0x3f5ba8[_0x02f9('0x8f')]&&_0x3f5ba8[_0x02f9('0x8f')]!==_0x02f9('0x90')){logger[_0x02f9('0x33')](_0x02f9('0x91'),_0x02f9('0x83'));_0xb785fc[_0x02f9('0x92')]=_0x79fc13[_0x02f9('0x81')]+_0x02f9('0x84')+_0xb785fc[_0x02f9('0x85')]+_0x02f9('0x86')+md5(_0xb785fc[_0x02f9('0x85')]);}var _0x4592ea=_0x79fc13[_0x02f9('0x7f')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x79fc13)[_0x02f9('0x2c')](function(_0x2e6f59){_0x1b1e67=_0x2e6f59;return getUser(_0x1b1e67,_0x4592ea,_0x79fc13,_0x4c26af[_0x02f9('0x3b')]);})[_0x02f9('0x2c')](function(_0x527efc){_0x2fcb5a=_0x527efc;logger['info']('The\x20User\x20ID\x20is:',_0x2fcb5a['id']);return getEndUser(_0x1b1e67,_0x4592ea,_0x79fc13,_0xb785fc[_0x02f9('0x93')],_0xb785fc[_0x02f9('0x94')],_0x2fcb5a,_0x58061a);})[_0x02f9('0x2c')](function(_0x30a91b){_0x2bdffc=_0x30a91b;return getCall(_0x1b1e67,_0x4592ea,_0x79fc13,_0x2fcb5a,_0x2bdffc,_0x58061a,_0xb785fc,_0x02f9('0x95'));})['then'](function(_0x2f3bef){if(_0x2f3bef){logger['info'](_0x02f9('0x96'),_0x2f3bef['id']);logger[_0x02f9('0x33')]('[OUTBOUND]',_0x02f9('0x8b'));emit(util[_0x02f9('0x36')](_0x02f9('0x8c'),_0x4c26af[_0x02f9('0x1a')]),_0x02f9('0x97'),{'uri':_0x02f9('0x98')+_0x79fc13['host']+_0x02f9('0x8d')+_0x2f3bef['id']});}})[_0x02f9('0x30')](function(_0x1c14cf){logger[_0x02f9('0x31')](_0x02f9('0x91'),JSON['stringify'](_0x1c14cf));});};exports['unmanaged']=function(_0x913985,_0x18e7f1,_0x5c592b,_0x3fc590,_0x5e8bac,_0x2368a0){var _0x461703,_0x4a0911,_0xa497f;_0x2368a0[_0x02f9('0x7f')]=intUtil[_0x02f9('0x80')](_0x2368a0[_0x02f9('0x7f')]);_0x2368a0[_0x02f9('0x81')]=intUtil['stripTrailingSlash'](_0x2368a0[_0x02f9('0x81')]);if(_0x5e8bac&&_0x5e8bac[_0x02f9('0x82')]){logger[_0x02f9('0x33')]('['+_0x18e7f1['lastevent'][_0x02f9('0x99')]()+']',_0x02f9('0x83'));_0x18e7f1[_0x02f9('0x92')]=_0x2368a0[_0x02f9('0x81')]+_0x02f9('0x84')+_0x18e7f1['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x18e7f1[_0x02f9('0x85')]);}else{_0x18e7f1[_0x02f9('0x92')]='';}var _0x10f858=_0x2368a0['host']===_0x02f9('0x87')?'eu':_0x02f9('0x88');return getAccessToken(_0x2368a0)[_0x02f9('0x2c')](function(_0x4e5490){_0xa497f=_0x4e5490;return getUser(_0xa497f,_0x10f858,_0x2368a0);})[_0x02f9('0x2c')](function(_0xc3ec5){_0x461703=_0xc3ec5;logger[_0x02f9('0x33')](_0x02f9('0x9a'),_0x461703['id']);return getEndUser(_0xa497f,_0x10f858,_0x2368a0,_0x18e7f1[_0x02f9('0x89')],_0x18e7f1[_0x02f9('0x8a')],_0x461703,_0x5c592b);})[_0x02f9('0x2c')](function(_0x42d3b4){_0x4a0911=_0x42d3b4;return getCall(_0xa497f,_0x10f858,_0x2368a0,_0x461703,_0x4a0911,_0x5c592b,_0x18e7f1,_0x02f9('0x79'));})[_0x02f9('0x2c')](function(_0x12dd35){if(_0x12dd35){logger[_0x02f9('0x33')]('The\x20Call\x20ID\x20is:',_0x12dd35['id']);}})['catch'](function(_0x30b6e1){logger[_0x02f9('0x31')]('['+_0x18e7f1['lastevent'][_0x02f9('0x99')]()+']',JSON[_0x02f9('0xf')](_0x30b6e1));});}; \ 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 8b5a1f3..21c4fd2 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 _0xd70b=['info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','../../../../config/logger','trigger','exec','Script','render','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x3f25db,_0x1d3686){var _0x54f29d=function(_0x2963bb){while(--_0x2963bb){_0x3f25db['push'](_0x3f25db['shift']());}};_0x54f29d(++_0x1d3686);}(_0xd70b,0x16e));var _0xbd70=function(_0x4b3da3,_0x7e6f6a){_0x4b3da3=_0x4b3da3-0x0;var _0x373c4f=_0xd70b[_0x4b3da3];return _0x373c4f;};'use strict';var util=require('util');var sh=require(_0xbd70('0x0'));var Mustache=require(_0xbd70('0x1'));var logger=require(_0xbd70('0x2'))(_0xbd70('0x3'));exports[_0xbd70('0x4')]=function(_0x281ff3,_0x31df64){var _0x37615f=_0x281ff3['data2']?_0x281ff3['data2']:_0xbd70('0x5');var _0x2bda34=_0x281ff3['data3']?Mustache[_0xbd70('0x6')](_0x281ff3['data3'],_0x31df64):_0x31df64;sh[_0xbd70('0x4')](_0x2bda34,function(_0x44fe58,_0x1bb1eb,_0x9cd926){if(_0x44fe58!==0x0){logger['error'](util['format'](_0xbd70('0x7'),_0x37615f,_0x2bda34,_0x44fe58,_0x9cd926));}else{logger[_0xbd70('0x8')](util[_0xbd70('0x9')](_0xbd70('0xa'),_0x37615f,_0x2bda34,_0x1bb1eb));}});}; \ No newline at end of file +var _0x8ee7=['info','util','shelljs','trigger','exec','Script','data3','error','format'];(function(_0x127c7b,_0x1f65e7){var _0x1708eb=function(_0x2033e5){while(--_0x2033e5){_0x127c7b['push'](_0x127c7b['shift']());}};_0x1708eb(++_0x1f65e7);}(_0x8ee7,0x1de));var _0x78ee=function(_0x249ffb,_0x1c84a2){_0x249ffb=_0x249ffb-0x0;var _0x52b118=_0x8ee7[_0x249ffb];return _0x52b118;};'use strict';var util=require(_0x78ee('0x0'));var sh=require(_0x78ee('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x78ee('0x2'));exports[_0x78ee('0x3')]=function(_0xdfe157,_0xb17a16){var _0x194827=_0xdfe157['data2']?_0xdfe157['data2']:_0x78ee('0x4');var _0xe42719=_0xdfe157[_0x78ee('0x5')]?Mustache['render'](_0xdfe157[_0x78ee('0x5')],_0xb17a16):_0xb17a16;sh[_0x78ee('0x3')](_0xe42719,function(_0x4849c7,_0x2243ce,_0x539b27){if(_0x4849c7!==0x0){logger[_0x78ee('0x6')](util[_0x78ee('0x7')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x194827,_0xe42719,_0x4849c7,_0x539b27));}else{logger[_0x78ee('0x8')](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x194827,_0xe42719,_0x2243ce));}});}; \ 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 e184bd9..6a5289e 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 _0xf6de=['name','message','request-promise','lodash','mustache','../../../../config/logger','trigger','exec','toUpperCase','data2','data5','number','headers','data6','parse','render','error','data1','GET','DELETE','POST','PUT','data7','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','then','isNil',',\x20request\x20body:\x20','object','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s'];(function(_0x1850ba,_0x55e013){var _0x2045e8=function(_0x5a5b09){while(--_0x5a5b09){_0x1850ba['push'](_0x1850ba['shift']());}};_0x2045e8(++_0x55e013);}(_0xf6de,0x18e));var _0xef6d=function(_0x3fe393,_0x234a3a){_0x3fe393=_0x3fe393-0x0;var _0x534d14=_0xf6de[_0x3fe393];return _0x534d14;};'use strict';var rp=require(_0xef6d('0x0'));var util=require('util');var _=require(_0xef6d('0x1'));var Mustache=require(_0xef6d('0x2'));var logger=require(_0xef6d('0x3'))(_0xef6d('0x4'));exports[_0xef6d('0x5')]=function(_0x52e76b,_0x2a67ea){var _0x2d3875,_0xcd1a1;var _0x303c8a={'method':_0x52e76b['data1'][_0xef6d('0x6')](),'uri':Mustache['render'](_0x52e76b[_0xef6d('0x7')],_0x2a67ea),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x52e76b[_0xef6d('0x8')])===_0xef6d('0x9')&&parseInt(_0x52e76b[_0xef6d('0x8')])>=0x1&&parseInt(_0x52e76b[_0xef6d('0x8')])<=0xa?parseInt(_0x52e76b[_0xef6d('0x8')])*0x3e8:0x5*0x3e8};try{_0x303c8a[_0xef6d('0xa')]=_0x52e76b[_0xef6d('0xb')]?JSON[_0xef6d('0xc')](Mustache[_0xef6d('0xd')](_0x52e76b[_0xef6d('0xb')],_0x2a67ea)):{};}catch(_0x56d9dc){logger[_0xef6d('0xe')](_0x56d9dc['stack']);}switch(_0x52e76b[_0xef6d('0xf')][_0xef6d('0x6')]()){case _0xef6d('0x10'):case _0xef6d('0x11'):_0x2d3875=null;_0x303c8a['qs']=_0x2a67ea;break;case _0xef6d('0x12'):case _0xef6d('0x13'):if(_0x52e76b[_0xef6d('0x14')]){try{_0x2d3875=JSON[_0xef6d('0xc')](Mustache[_0xef6d('0xd')](_0x52e76b[_0xef6d('0x14')],_0x2a67ea));_0x303c8a[_0xef6d('0x15')]=_0x2d3875;}catch(_0x2077b6){logger[_0xef6d('0xe')](_0x2077b6[_0xef6d('0x16')]);logger[_0xef6d('0xe')](_0xef6d('0x17'));}}else{_0x2d3875=_0x2a67ea;_0x303c8a[_0xef6d('0x15')]=_0x2d3875;}break;}logger['info'](util[_0xef6d('0x18')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x52e76b[_0xef6d('0xf')],_0x52e76b[_0xef6d('0x7')],JSON['stringify'](_0x303c8a)));rp(_0x303c8a)[_0xef6d('0x19')](function(_0x539af6){_0x2d3875=!_[_0xef6d('0x1a')](_0x2d3875)?_0xef6d('0x1b')+_0x2d3875:'';_0xcd1a1=typeof _0x539af6[_0xef6d('0x15')]===_0xef6d('0x1c')?JSON['stringify'](_0x539af6[_0xef6d('0x15')]):_0x539af6[_0xef6d('0x15')];logger[_0xef6d('0x1d')](util[_0xef6d('0x18')](_0xef6d('0x1e'),_0x52e76b[_0xef6d('0xf')],_0x52e76b['data2'],_0x539af6[_0xef6d('0x1f')],_0xcd1a1));})[_0xef6d('0x20')](function(_0x5de12a){logger['error'](util[_0xef6d('0x18')](_0xef6d('0x21'),_0x52e76b[_0xef6d('0xf')],_0x52e76b[_0xef6d('0x7')],_0x5de12a[_0xef6d('0x1f')],_0x5de12a[_0xef6d('0x22')],_0x5de12a[_0xef6d('0x23')]));});}; \ No newline at end of file +var _0xfce8=['DELETE','data7','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','stringify','then',',\x20request\x20body:\x20','body','object','format','statusCode','catch','name','message','util','lodash','trigger','exec','data1','render','data2','data5','number','data6','parse','error','stack','toUpperCase','GET'];(function(_0x463805,_0x203219){var _0x85cb8=function(_0x49b541){while(--_0x49b541){_0x463805['push'](_0x463805['shift']());}};_0x85cb8(++_0x203219);}(_0xfce8,0x65));var _0x8fce=function(_0x1e76dc,_0x448187){_0x1e76dc=_0x1e76dc-0x0;var _0x435b9e=_0xfce8[_0x1e76dc];return _0x435b9e;};'use strict';var rp=require('request-promise');var util=require(_0x8fce('0x0'));var _=require(_0x8fce('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x8fce('0x2'));exports[_0x8fce('0x3')]=function(_0x3ffdb0,_0xaf3242){var _0x53c6a2,_0x2b4d57;var _0x4ea2ef={'method':_0x3ffdb0[_0x8fce('0x4')]['toUpperCase'](),'uri':Mustache[_0x8fce('0x5')](_0x3ffdb0[_0x8fce('0x6')],_0xaf3242),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3ffdb0[_0x8fce('0x7')])===_0x8fce('0x8')&&parseInt(_0x3ffdb0[_0x8fce('0x7')])>=0x1&&parseInt(_0x3ffdb0['data5'])<=0xa?parseInt(_0x3ffdb0[_0x8fce('0x7')])*0x3e8:0x5*0x3e8};try{_0x4ea2ef['headers']=_0x3ffdb0[_0x8fce('0x9')]?JSON[_0x8fce('0xa')](Mustache['render'](_0x3ffdb0[_0x8fce('0x9')],_0xaf3242)):{};}catch(_0x329734){logger[_0x8fce('0xb')](_0x329734[_0x8fce('0xc')]);}switch(_0x3ffdb0['data1'][_0x8fce('0xd')]()){case _0x8fce('0xe'):case _0x8fce('0xf'):_0x53c6a2=null;_0x4ea2ef['qs']=_0xaf3242;break;case'POST':case'PUT':if(_0x3ffdb0['data7']){try{_0x53c6a2=JSON[_0x8fce('0xa')](Mustache[_0x8fce('0x5')](_0x3ffdb0[_0x8fce('0x10')],_0xaf3242));_0x4ea2ef['body']=_0x53c6a2;}catch(_0x3d769f){logger[_0x8fce('0xb')](_0x3d769f['stack']);logger['error'](_0x8fce('0x11'));}}else{_0x53c6a2=_0xaf3242;_0x4ea2ef['body']=_0x53c6a2;}break;}logger[_0x8fce('0x12')](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x3ffdb0[_0x8fce('0x4')],_0x3ffdb0[_0x8fce('0x6')],JSON[_0x8fce('0x13')](_0x4ea2ef)));rp(_0x4ea2ef)[_0x8fce('0x14')](function(_0x14fcfe){_0x53c6a2=!_['isNil'](_0x53c6a2)?_0x8fce('0x15')+_0x53c6a2:'';_0x2b4d57=typeof _0x14fcfe[_0x8fce('0x16')]===_0x8fce('0x17')?JSON[_0x8fce('0x13')](_0x14fcfe[_0x8fce('0x16')]):_0x14fcfe['body'];logger['info'](util[_0x8fce('0x18')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x3ffdb0[_0x8fce('0x4')],_0x3ffdb0['data2'],_0x14fcfe[_0x8fce('0x19')],_0x2b4d57));})[_0x8fce('0x1a')](function(_0x36ba29){logger[_0x8fce('0xb')](util[_0x8fce('0x18')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x3ffdb0['data1'],_0x3ffdb0['data2'],_0x36ba29['statusCode'],_0x36ba29[_0x8fce('0x1b')],_0x36ba29[_0x8fce('0x1c')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index d007e26..bc4ebb5 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 _0x47db=['routing','client','http','Request','then','debug','rpc','error','message','result','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x55ac32,_0x42c86e){var _0x266432=function(_0x4c7822){while(--_0x4c7822){_0x55ac32['push'](_0x55ac32['shift']());}};_0x266432(++_0x42c86e);}(_0x47db,0xeb));var _0xb47d=function(_0x2846af,_0x11f976){_0x2846af=_0x2846af-0x0;var _0x964c18=_0x47db[_0x2846af];return _0x964c18;};'use strict';var jayson=require(_0xb47d('0x0'));var BPromise=require(_0xb47d('0x1'));var logger=require(_0xb47d('0x2'))(_0xb47d('0x3'));var client=jayson[_0xb47d('0x4')][_0xb47d('0x5')]({'port':0x2329});client[_0xb47d('0x6')]=function(_0x17d23a,_0x590998){return new BPromise(function(_0x6cf7d7,_0x5492ff){return client['request'](_0x17d23a,_0x590998)[_0xb47d('0x7')](function(_0x2f2952){logger[_0xb47d('0x8')](_0xb47d('0x9'),_0xb47d('0x3'),_0x17d23a,_0x590998,_0x2f2952);if(_0x2f2952[_0xb47d('0xa')]){logger[_0xb47d('0xa')](_0xb47d('0x9'),'routing',_0x17d23a,_0x2f2952[_0xb47d('0xa')][_0xb47d('0xb')],_0x590998);return _0x5492ff(_0x2f2952[_0xb47d('0xa')][_0xb47d('0xb')]);}else{return _0x6cf7d7(_0x2f2952[_0xb47d('0xc')]);}})['catch'](function(_0x5d5b60){logger[_0xb47d('0xa')](_0xb47d('0x9'),_0xb47d('0x3'),_0x17d23a,_0x5d5b60,_0x590998);return _0x5492ff(_0x5d5b60);});});};module[_0xb47d('0xd')]=client; \ No newline at end of file +var _0x8583=['message','result','catch','bluebird','../../config/logger','routing','http','Request','request','then','debug','rpc','error'];(function(_0x532127,_0x4e47db){var _0x15e430=function(_0x57ecc1){while(--_0x57ecc1){_0x532127['push'](_0x532127['shift']());}};_0x15e430(++_0x4e47db);}(_0x8583,0x162));var _0x3858=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8583[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x3858('0x0'));var logger=require(_0x3858('0x1'))(_0x3858('0x2'));var client=jayson['client'][_0x3858('0x3')]({'port':0x2329});client[_0x3858('0x4')]=function(_0x30789d,_0x1b522c){return new BPromise(function(_0x466dee,_0x16882a){return client[_0x3858('0x5')](_0x30789d,_0x1b522c)[_0x3858('0x6')](function(_0x42df86){logger[_0x3858('0x7')](_0x3858('0x8'),_0x3858('0x2'),_0x30789d,_0x1b522c,_0x42df86);if(_0x42df86[_0x3858('0x9')]){logger['error'](_0x3858('0x8'),_0x3858('0x2'),_0x30789d,_0x42df86['error']['message'],_0x1b522c);return _0x16882a(_0x42df86['error'][_0x3858('0xa')]);}else{return _0x466dee(_0x42df86[_0x3858('0xb')]);}})[_0x3858('0xc')](function(_0x3fba68){logger[_0x3858('0x9')](_0x3858('0x8'),_0x3858('0x2'),_0x30789d,_0x3fba68,_0x1b522c);return _0x16882a(_0x3fba68);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index ff4d20d..5597d3e 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 _0x09bc=['refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts'];(function(_0x270398,_0x434aa9){var _0x1d4f5c=function(_0x2d40e9){while(--_0x2d40e9){_0x270398['push'](_0x270398['shift']());}};_0x1d4f5c(++_0x434aa9);}(_0x09bc,0xf2));var _0xc09b=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0x09bc[_0x2f2360];return _0x1cc8d3;};'use strict';var server=require(_0xc09b('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0xc09b('0x1'));var mailAccount=require(_0xc09b('0x2'));var setting=require(_0xc09b('0x3'));var logger=require(_0xc09b('0x4'))(_0xc09b('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xc09b('0x6')]()[_0xc09b('0x7')](mailAccount[_0xc09b('0x8')]())['then'](realtime[_0xc09b('0x9')]())[_0xc09b('0x7')](function(){email[_0xc09b('0xa')](realtime[_0xc09b('0xb')]);return realtime;});}function main(){return server[_0xc09b('0xc')](realtime,email)[_0xc09b('0x7')](function(){return initRealtime();})[_0xc09b('0x7')](function(){return setting[_0xc09b('0xd')]();})[_0xc09b('0x7')](function(_0xa3e5ac){return setInterval(initRealtime,_0xa3e5ac[_0xc09b('0xe')]*0x3e8);})[_0xc09b('0xf')](function(_0x285b4c){logger[_0xc09b('0x10')](_0xc09b('0x11'),_0x285b4c);});}main(); \ No newline at end of file +var _0x88dd=['./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','then','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization'];(function(_0x15b399,_0x59db1a){var _0x199f2d=function(_0x3bd31c){while(--_0x3bd31c){_0x15b399['push'](_0x15b399['shift']());}};_0x199f2d(++_0x59db1a);}(_0x88dd,0xd8));var _0xd88d=function(_0x1f8482,_0x5382fd){_0x1f8482=_0x1f8482-0x0;var _0x235c8c=_0x88dd[_0x1f8482];return _0x235c8c;};'use strict';var server=require(_0xd88d('0x0'));var Realtime=require(_0xd88d('0x1'));var EmailChannel=require(_0xd88d('0x2'));var mailAccount=require(_0xd88d('0x3'));var setting=require(_0xd88d('0x4'));var logger=require(_0xd88d('0x5'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xd88d('0x6')]()['then'](mailAccount[_0xd88d('0x7')]())['then'](realtime[_0xd88d('0x8')]())['then'](function(){email[_0xd88d('0x9')](realtime[_0xd88d('0xa')]);return realtime;});}function main(){return server[_0xd88d('0xb')](realtime,email)['then'](function(){return initRealtime();})[_0xd88d('0xc')](function(){return setting[_0xd88d('0xd')]();})[_0xd88d('0xc')](function(_0x3ce890){return setInterval(initRealtime,_0x3ce890[_0xd88d('0xe')]*0x3e8);})[_0xd88d('0xf')](function(_0x1b56c9){logger[_0xd88d('0x10')](_0xd88d('0x11'),_0x1b56c9);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index bc730c0..48f9e85 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 _0x5bc7=['catch','exports','lodash','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','defaults','localhost','socket.io-emitter','redis','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','name','key','active','Imap','status','total','stringify','emit','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','isNil','disabled','messageStatus','connected','messages','lastName','Mail\x20accepted\x20from\x20routing','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','smtp','send','verifySmtp','Smtp','verify','then','verified'];(function(_0xfdf5c0,_0x54029d){var _0x27578a=function(_0x22913c){while(--_0x22913c){_0xfdf5c0['push'](_0xfdf5c0['shift']());}};_0x27578a(++_0x54029d);}(_0x5bc7,0xea));var _0x75bc=function(_0x376d9a,_0x26a6d9){_0x376d9a=_0x376d9a-0x0;var _0x5a12ea=_0x5bc7[_0x376d9a];return _0x5a12ea;};'use strict';var _=require(_0x75bc('0x0'));var moment=require('moment');var BPromise=require(_0x75bc('0x1'));var md5=require(_0x75bc('0x2'));var Redis=require(_0x75bc('0x3'));var config=require(_0x75bc('0x4'));var logger=require(_0x75bc('0x5'))(_0x75bc('0x6'));config['redis']=_[_0x75bc('0x7')](config['redis'],{'host':_0x75bc('0x8'),'port':0x18eb});var io=require(_0x75bc('0x9'))(new Redis(config[_0x75bc('0xa')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x75bc('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0xf5cc2f){logger[_0x75bc('0xc')](_0x75bc('0xd'));this['mailAccounts']=_0xf5cc2f[_0x75bc('0xe')];this[_0x75bc('0xf')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x75bc('0x10')]['emit']=function(_0x3c6b23){var _0x8c5712=this['mailAccounts'][_0x3c6b23];var _0x3f5c86={'id':_0x8c5712['id'],'name':_0x8c5712[_0x75bc('0x11')],'key':_0x8c5712[_0x75bc('0x12')],'active':_0x8c5712[_0x75bc('0x13')],'Imap':{'status':_0x8c5712[_0x75bc('0x14')][_0x75bc('0x15')],'messageStatus':_0x8c5712[_0x75bc('0x14')]['messageStatus'],'total':_0x8c5712['Imap'][_0x75bc('0x16')]}};if(_['isNil'](md5Accounts[_0x3c6b23])){md5Accounts[_0x3c6b23]={};}var _0x731b15=md5(JSON[_0x75bc('0x17')](_0x3f5c86));if(md5Accounts[_0x3c6b23][_0x75bc('0x2')]!==_0x731b15){md5Accounts[_0x3c6b23]['md5']=_0x731b15;io[_0x75bc('0x18')](_0x75bc('0x19'),_0x3f5c86);}};EmailChannel[_0x75bc('0x10')][_0x75bc('0x1a')]=function(_0xe88fcd){for(var _0x322db4 in _0xe88fcd){if(_0xe88fcd[_0x75bc('0x1b')](_0x322db4)){if(_0xe88fcd[_0x322db4][_0x75bc('0x14')]&&_0xe88fcd[_0x322db4][_0x75bc('0x13')]){var _0x4bc939=_0xe88fcd[_0x322db4]['Imap'];if(!_0x4bc939[_0x75bc('0x1c')]&&_0xe88fcd[_0x322db4][_0x75bc('0x1d')]!==_0x75bc('0x1e'))_0x4bc939[_0x75bc('0x1c')]=_0xe88fcd[_0x322db4][_0x75bc('0x1d')];if(!this[_0x75bc('0xf')][_0x75bc('0x1b')](_0x4bc939['id'])){this[_0x75bc('0xf')][_0x4bc939['id']]=new EmailImap(_0x4bc939,_0xe88fcd[_0x322db4][_0x75bc('0x6')]);this['imapAccounts'][_0x4bc939['id']]['on'](_0x75bc('0x1f'),this[_0x75bc('0x20')][_0x75bc('0x21')](this,_0x322db4));this[_0x75bc('0xf')][_0x4bc939['id']]['on'](_0x75bc('0x6'),this[_0x75bc('0x22')]['bind'](this,_0x322db4));this[_0x75bc('0xf')][_0x4bc939['id']]['on'](_0x75bc('0x23'),this[_0x75bc('0x24')][_0x75bc('0x21')](this,_0x322db4));this[_0x75bc('0xf')][_0x4bc939['id']]['on']('error',this[_0x75bc('0x25')][_0x75bc('0x21')](this,_0x322db4));}}else{if(_[_0x75bc('0x26')](this[_0x75bc('0xe')][_0x322db4][_0x75bc('0x14')])){this[_0x75bc('0xe')][_0x322db4][_0x75bc('0x14')]={};}this['mailAccounts'][_0x322db4][_0x75bc('0x14')][_0x75bc('0x15')]=_0x75bc('0x27');this[_0x75bc('0xe')][_0x322db4][_0x75bc('0x14')][_0x75bc('0x28')]='';this[_0x75bc('0x18')](_0x322db4);}}}};EmailChannel[_0x75bc('0x10')]['handleImapBox']=function(_0x533ec8,_0x32b0a3){if(this[_0x75bc('0xe')][_0x533ec8]){this[_0x75bc('0xe')][_0x533ec8][_0x75bc('0x14')][_0x75bc('0x15')]=_0x75bc('0x29');this['mailAccounts'][_0x533ec8][_0x75bc('0x14')]['messageStatus']=_0x32b0a3['name'];if(_0x32b0a3[_0x75bc('0x2a')]){this[_0x75bc('0xe')][_0x533ec8]['Imap']['total']=_0x32b0a3[_0x75bc('0x2a')]['total'];}return this[_0x75bc('0x18')](_0x533ec8);}};EmailChannel['prototype'][_0x75bc('0x22')]=function(_0x50438c,_0xc38708){logger[_0x75bc('0xc')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0xc38708['firstName'],_0xc38708[_0x75bc('0x2b')],_0xc38708['from'],_0x50438c);if(this[_0x75bc('0xe')][_0x50438c]){return mailAccount['notify'](_0x50438c,_0xc38708)['then'](function(_0x2cb003){if(_0x2cb003){logger['info'](_0x75bc('0x2c'));}})['catch'](function(_0x1ed49f){logger[_0x75bc('0x2d')](_0x75bc('0x2e'),JSON[_0x75bc('0x17')](_0x1ed49f));});}};EmailChannel[_0x75bc('0x10')][_0x75bc('0x24')]=function(_0x4e9004){if(this[_0x75bc('0xe')][_0x4e9004]&&this['mailAccounts'][_0x4e9004][_0x75bc('0x14')]){if(this[_0x75bc('0xf')][this[_0x75bc('0xe')][_0x4e9004][_0x75bc('0x14')]['id']]){delete this[_0x75bc('0xf')][this[_0x75bc('0xe')][_0x4e9004]['Imap']['id']];}this[_0x75bc('0xe')][_0x4e9004]['Imap'][_0x75bc('0x2f')]=moment();this[_0x75bc('0x18')](_0x4e9004);}};EmailChannel[_0x75bc('0x10')]['handleImapError']=function(_0xdb99e8,_0x5c1ce1){if(this[_0x75bc('0xe')][_0xdb99e8]){this[_0x75bc('0xe')][_0xdb99e8][_0x75bc('0x14')][_0x75bc('0x15')]=_0x75bc('0x2d');this[_0x75bc('0xe')][_0xdb99e8][_0x75bc('0x14')][_0x75bc('0x28')]=_0x5c1ce1;return this[_0x75bc('0x18')](_0xdb99e8);}};EmailChannel['prototype'][_0x75bc('0x30')]=function(_0x439a18,_0x178a69){return this[_0x75bc('0x31')][_0x75bc('0x32')](_0x439a18,_0x178a69);};EmailChannel[_0x75bc('0x10')][_0x75bc('0x33')]=function(_0x2ba759){var _0xf2e806=this;if(this[_0x75bc('0xe')][_0x2ba759['id']]){if(_['isNil'](this[_0x75bc('0xe')][_0x2ba759['id']]['Smtp'])){this['mailAccounts'][_0x2ba759['id']][_0x75bc('0x34')]={};}this[_0x75bc('0xe')][_0x2ba759['id']]['Smtp'][_0x75bc('0x2f')]=moment();return new BPromise(function(_0x34f2b8,_0x4d6c36){return _0xf2e806[_0x75bc('0x31')][_0x75bc('0x35')](_0x2ba759)[_0x75bc('0x36')](function(_0x4e99a2){_0xf2e806[_0x75bc('0xe')][_0x2ba759['id']][_0x75bc('0x34')][_0x75bc('0x15')]=_0x75bc('0x37');_0xf2e806[_0x75bc('0xe')][_0x2ba759['id']][_0x75bc('0x34')][_0x75bc('0x28')]='';_0xf2e806['emit'](_0x2ba759['id']);_0x34f2b8(_0x4e99a2);})[_0x75bc('0x38')](function(_0x55656d){_0xf2e806[_0x75bc('0xe')][_0x2ba759['id']][_0x75bc('0x34')][_0x75bc('0x15')]=_0x75bc('0x2d');_0xf2e806[_0x75bc('0xe')][_0x2ba759['id']][_0x75bc('0x34')]['messageStatus']=_0x55656d;_0xf2e806['emit'](_0x2ba759['id']);_0x4d6c36(_0x55656d);});});}return this['smtp']['verify'](_0x2ba759);};module[_0x75bc('0x39')]=EmailChannel; \ No newline at end of file +var _0x3061=['active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','provider','custom','service','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','info','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','Smtp','verify','exports','moment','bluebird','md5','ioredis','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','mailAccounts','imapAccounts','smtp','prototype','emit','key'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3061,0xfc));var _0x1306=function(_0x38622b,_0x3cfdf7){_0x38622b=_0x38622b-0x0;var _0x2c1a7a=_0x3061[_0x38622b];return _0x2c1a7a;};'use strict';var _=require('lodash');var moment=require(_0x1306('0x0'));var BPromise=require(_0x1306('0x1'));var md5=require(_0x1306('0x2'));var Redis=require(_0x1306('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x1306('0x4'));config[_0x1306('0x5')]=_[_0x1306('0x6')](config[_0x1306('0x5')],{'host':_0x1306('0x7'),'port':0x18eb});var io=require(_0x1306('0x8'))(new Redis(config[_0x1306('0x5')]));var EmailImap=require(_0x1306('0x9'));var EmailSmtp=require(_0x1306('0xa'));var mailAccount=require(_0x1306('0xb'));var md5Accounts={};function EmailChannel(_0x5241c6){logger['info']('start\x20email\x20channel');this['mailAccounts']=_0x5241c6[_0x1306('0xc')];this[_0x1306('0xd')]={};this[_0x1306('0xe')]=new EmailSmtp();}EmailChannel[_0x1306('0xf')][_0x1306('0x10')]=function(_0x15f088){var _0x1f445c=this[_0x1306('0xc')][_0x15f088];var _0x348c3a={'id':_0x1f445c['id'],'name':_0x1f445c['name'],'key':_0x1f445c[_0x1306('0x11')],'active':_0x1f445c[_0x1306('0x12')],'Imap':{'status':_0x1f445c[_0x1306('0x13')][_0x1306('0x14')],'messageStatus':_0x1f445c['Imap'][_0x1306('0x15')],'total':_0x1f445c[_0x1306('0x13')][_0x1306('0x16')]}};if(_[_0x1306('0x17')](md5Accounts[_0x15f088])){md5Accounts[_0x15f088]={};}var _0x16c329=md5(JSON[_0x1306('0x18')](_0x348c3a));if(md5Accounts[_0x15f088][_0x1306('0x2')]!==_0x16c329){md5Accounts[_0x15f088][_0x1306('0x2')]=_0x16c329;io['emit'](_0x1306('0x19'),_0x348c3a);}};EmailChannel[_0x1306('0xf')]['refresh']=function(_0x417c3f){for(var _0x266510 in _0x417c3f){if(_0x417c3f['hasOwnProperty'](_0x266510)){if(_0x417c3f[_0x266510][_0x1306('0x13')]&&_0x417c3f[_0x266510]['active']){var _0x18a7be=_0x417c3f[_0x266510][_0x1306('0x13')];if(!_0x18a7be['service']&&_0x417c3f[_0x266510][_0x1306('0x1a')]!==_0x1306('0x1b'))_0x18a7be[_0x1306('0x1c')]=_0x417c3f[_0x266510]['provider'];if(!this[_0x1306('0xd')]['hasOwnProperty'](_0x18a7be['id'])){this[_0x1306('0xd')][_0x18a7be['id']]=new EmailImap(_0x18a7be,_0x417c3f[_0x266510]['email']);this[_0x1306('0xd')][_0x18a7be['id']]['on'](_0x1306('0x1d'),this[_0x1306('0x1e')][_0x1306('0x1f')](this,_0x266510));this[_0x1306('0xd')][_0x18a7be['id']]['on']('email',this[_0x1306('0x20')][_0x1306('0x1f')](this,_0x266510));this[_0x1306('0xd')][_0x18a7be['id']]['on'](_0x1306('0x21'),this[_0x1306('0x22')]['bind'](this,_0x266510));this[_0x1306('0xd')][_0x18a7be['id']]['on']('error',this[_0x1306('0x23')][_0x1306('0x1f')](this,_0x266510));}}else{if(_[_0x1306('0x17')](this['mailAccounts'][_0x266510]['Imap'])){this[_0x1306('0xc')][_0x266510][_0x1306('0x13')]={};}this['mailAccounts'][_0x266510]['Imap']['status']='disabled';this[_0x1306('0xc')][_0x266510][_0x1306('0x13')][_0x1306('0x15')]='';this[_0x1306('0x10')](_0x266510);}}}};EmailChannel[_0x1306('0xf')]['handleImapBox']=function(_0x333862,_0xf57c2){if(this[_0x1306('0xc')][_0x333862]){this['mailAccounts'][_0x333862][_0x1306('0x13')][_0x1306('0x14')]='connected';this[_0x1306('0xc')][_0x333862][_0x1306('0x13')][_0x1306('0x15')]=_0xf57c2[_0x1306('0x24')];if(_0xf57c2[_0x1306('0x25')]){this[_0x1306('0xc')][_0x333862]['Imap'][_0x1306('0x16')]=_0xf57c2[_0x1306('0x25')][_0x1306('0x16')];}return this['emit'](_0x333862);}};EmailChannel[_0x1306('0xf')][_0x1306('0x20')]=function(_0x20e38b,_0x477795){logger['info'](_0x1306('0x26'),_0x477795[_0x1306('0x27')],_0x477795[_0x1306('0x28')],_0x477795[_0x1306('0x29')],_0x20e38b);if(this[_0x1306('0xc')][_0x20e38b]){return mailAccount['notify'](_0x20e38b,_0x477795)[_0x1306('0x2a')](function(_0xb04239){if(_0xb04239){logger[_0x1306('0x2b')](_0x1306('0x2c'));}})[_0x1306('0x2d')](function(_0x45dc17){logger[_0x1306('0x2e')](_0x1306('0x2f'),JSON[_0x1306('0x18')](_0x45dc17));});}};EmailChannel[_0x1306('0xf')]['handleImapEnd']=function(_0x6d407f){if(this['mailAccounts'][_0x6d407f]&&this[_0x1306('0xc')][_0x6d407f][_0x1306('0x13')]){if(this[_0x1306('0xd')][this[_0x1306('0xc')][_0x6d407f][_0x1306('0x13')]['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x6d407f][_0x1306('0x13')]['id']];}this[_0x1306('0xc')][_0x6d407f]['Imap'][_0x1306('0x30')]=moment();this[_0x1306('0x10')](_0x6d407f);}};EmailChannel[_0x1306('0xf')][_0x1306('0x23')]=function(_0x5f3cda,_0x23aaf3){if(this['mailAccounts'][_0x5f3cda]){this[_0x1306('0xc')][_0x5f3cda]['Imap']['status']=_0x1306('0x2e');this['mailAccounts'][_0x5f3cda][_0x1306('0x13')][_0x1306('0x15')]=_0x23aaf3;return this[_0x1306('0x10')](_0x5f3cda);}};EmailChannel[_0x1306('0xf')][_0x1306('0x31')]=function(_0x36103a,_0x1fadad){return this[_0x1306('0xe')][_0x1306('0x32')](_0x36103a,_0x1fadad);};EmailChannel[_0x1306('0xf')]['verifySmtp']=function(_0x48856a){var _0x47a7cd=this;if(this[_0x1306('0xc')][_0x48856a['id']]){if(_[_0x1306('0x17')](this[_0x1306('0xc')][_0x48856a['id']]['Smtp'])){this[_0x1306('0xc')][_0x48856a['id']][_0x1306('0x33')]={};}this[_0x1306('0xc')][_0x48856a['id']][_0x1306('0x33')][_0x1306('0x30')]=moment();return new BPromise(function(_0xcfe2a,_0x939a0a){return _0x47a7cd[_0x1306('0xe')][_0x1306('0x34')](_0x48856a)['then'](function(_0x4ee831){_0x47a7cd[_0x1306('0xc')][_0x48856a['id']]['Smtp'][_0x1306('0x14')]='verified';_0x47a7cd[_0x1306('0xc')][_0x48856a['id']]['Smtp'][_0x1306('0x15')]='';_0x47a7cd[_0x1306('0x10')](_0x48856a['id']);_0xcfe2a(_0x4ee831);})[_0x1306('0x2d')](function(_0x2bf8dd){_0x47a7cd['mailAccounts'][_0x48856a['id']][_0x1306('0x33')]['status']=_0x1306('0x2e');_0x47a7cd[_0x1306('0xc')][_0x48856a['id']][_0x1306('0x33')][_0x1306('0x15')]=_0x2bf8dd;_0x47a7cd['emit'](_0x48856a['id']);_0x939a0a(_0x2bf8dd);});});}return this[_0x1306('0xe')][_0x1306('0x34')](_0x48856a);};module[_0x1306('0x35')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 71aea18..6916270 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 _0x02dd=['once','ready','handleReady','end','handleEnd','bind','error','handleError','connect','prototype','authTimeout','user','modernAuthentication','xoauth2','generateXOAuth2Token','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','emit','box','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','slice','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','upperFirst','exports','util','imap','mailparser','simpleParser','events','EventEmitter','./utils','email','mailbox','getAccount','account'];(function(_0x568892,_0x20e0d4){var _0x4a83ac=function(_0x2e1b6b){while(--_0x2e1b6b){_0x568892['push'](_0x568892['shift']());}};_0x4a83ac(++_0x20e0d4);}(_0x02dd,0x73));var _0xd02d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x02dd[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0xd02d('0x0'));var Imap=require(_0xd02d('0x1'));var simpleParser=require(_0xd02d('0x2'))[_0xd02d('0x3')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0xd02d('0x4'))[_0xd02d('0x5')];var utils=require(_0xd02d('0x6'));var logger=require('../../../config/logger')(_0xd02d('0x7'));function EmailImap(_0x34aabe,_0x5cb4b9){this['mailbox']=_0x34aabe[_0xd02d('0x8')];this['account']=this[_0xd02d('0x9')](_0x34aabe,_0x5cb4b9);this[_0xd02d('0x1')]=new Imap(this[_0xd02d('0xa')]);this[_0xd02d('0x1')][_0xd02d('0xb')](_0xd02d('0xc'),this[_0xd02d('0xd')]['bind'](this));this[_0xd02d('0x1')][_0xd02d('0xb')](_0xd02d('0xe'),this[_0xd02d('0xf')][_0xd02d('0x10')](this));this['imap']['on'](_0xd02d('0x11'),this[_0xd02d('0x12')][_0xd02d('0x10')](this));this[_0xd02d('0x1')][_0xd02d('0x13')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xd02d('0x14')][_0xd02d('0x9')]=function(_0x3d3e89,_0x1b1eaf){var _0x3affe6={'connTimeout':_0x3d3e89['connTimeout']?_0x3d3e89['connTimeout']*0x3e8:0x2710,'authTimeout':_0x3d3e89[_0xd02d('0x15')]?_0x3d3e89['authTimeout']*0x3e8:0x1388};if(_0x3d3e89['service']){_0x3affe6[_0xd02d('0x16')]=_0x3d3e89[_0xd02d('0x16')];if(_0x3d3e89[_0xd02d('0x17')]){_0x3affe6[_0xd02d('0x18')]=utils[_0xd02d('0x19')](_0x3d3e89['CloudProvider'][_0xd02d('0x1a')],_0x3d3e89['user']);}else{_0x3affe6[_0xd02d('0x1b')]=_0x3d3e89[_0xd02d('0x1b')];}}else{if(_0x3d3e89[_0xd02d('0x1c')]){_0x3affe6[_0xd02d('0x16')]=_0x3d3e89['user'];_0x3affe6[_0xd02d('0x1b')]=_0x3d3e89[_0xd02d('0x1b')];}}_0x3affe6[_0xd02d('0x7')]=_0x1b1eaf||_0x3d3e89[_0xd02d('0x16')]||_0xd02d('0x1d');_0x3affe6[_0xd02d('0x1e')]=_0x3d3e89[_0xd02d('0x1e')];_0x3affe6[_0xd02d('0x1f')]=_0x3d3e89[_0xd02d('0x1f')]||0x3e1;if(_0x3d3e89[_0xd02d('0x20')]){_0x3affe6[_0xd02d('0x20')]=!![];}else{_0x3affe6[_0xd02d('0x20')]=![];_0x3affe6[_0xd02d('0x21')]=_0xd02d('0x22');}return _0x3affe6;};EmailImap[_0xd02d('0x14')][_0xd02d('0xd')]=function(){this[_0xd02d('0x1')][_0xd02d('0x23')](this[_0xd02d('0x8')],![],this[_0xd02d('0x24')][_0xd02d('0x10')](this));};EmailImap['prototype'][_0xd02d('0x24')]=function(_0x42ea19,_0x30c9ab){if(_0x42ea19){this[_0xd02d('0x12')](_0x42ea19,!![]);}else{this[_0xd02d('0x25')](_0xd02d('0x26'),_0x30c9ab);this['readUnseen']();}};EmailImap[_0xd02d('0x14')][_0xd02d('0x27')]=function(_0x46b972){if(_0x46b972){this['handleError'](_0x46b972,!![]);}else{this[_0xd02d('0x1')][_0xd02d('0xe')]();}};EmailImap['prototype'][_0xd02d('0x28')]=function(){this[_0xd02d('0x1')][_0xd02d('0x29')]([_0xd02d('0x2a')],this[_0xd02d('0x2b')][_0xd02d('0x10')](this));};EmailImap[_0xd02d('0x14')][_0xd02d('0x2b')]=function(_0x403e30,_0x49d34c){if(_0x403e30){this[_0xd02d('0x12')](_0x403e30,!![]);}else{if(_0x49d34c[_0xd02d('0x2c')]){try{var _0x4ef162=this[_0xd02d('0x1')][_0xd02d('0x2d')](_0x49d34c[_0xd02d('0x2e')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x4ef162['on'](_0xd02d('0x2f'),this[_0xd02d('0x30')]['bind'](this));_0x4ef162['once'](_0xd02d('0x11'),this[_0xd02d('0x31')][_0xd02d('0x10')](this));_0x4ef162[_0xd02d('0xb')](_0xd02d('0xe'),this[_0xd02d('0x32')]['bind'](this));}catch(_0x1fe725){logger[_0xd02d('0x11')](_0x1fe725);}}else{this[_0xd02d('0x1')][_0xd02d('0x33')](!![],this[_0xd02d('0x27')]['bind'](this));}}};EmailImap[_0xd02d('0x14')]['handleFetchMessage']=function(_0x6d61bd){_0x6d61bd['on'](_0xd02d('0x34'),this[_0xd02d('0x35')][_0xd02d('0x10')](this));_0x6d61bd[_0xd02d('0xb')](_0xd02d('0x36'),this[_0xd02d('0x37')][_0xd02d('0x10')](this));_0x6d61bd[_0xd02d('0xb')](_0xd02d('0xe'),this[_0xd02d('0x38')]['bind'](this));};EmailImap['prototype'][_0xd02d('0x35')]=function(_0x3a4dab){simpleParser(_0x3a4dab,{'Iconv':Iconv},this[_0xd02d('0x39')]['bind'](this));};EmailImap[_0xd02d('0x14')]['handleMessageAttributes']=function(){};EmailImap[_0xd02d('0x14')][_0xd02d('0x38')]=function(){};EmailImap[_0xd02d('0x14')]['handleSimpleParser']=function(_0x242b85,_0xc17d6d){if(_0x242b85){logger['error'](_0x242b85);}else{var _0x4de53e=this;utils[_0xd02d('0x3a')](this[_0xd02d('0xa')],_0xc17d6d,function(_0x42abb7){_0x4de53e[_0xd02d('0x25')]('email',_0x42abb7);});}};EmailImap[_0xd02d('0x14')][_0xd02d('0x32')]=function(){this[_0xd02d('0x1')][_0xd02d('0x33')](!![],this[_0xd02d('0x27')][_0xd02d('0x10')](this));};EmailImap[_0xd02d('0x14')][_0xd02d('0x31')]=function(_0x340238){this[_0xd02d('0x12')](_0x340238);this[_0xd02d('0x1')]['closeBox'](!![],this[_0xd02d('0x27')][_0xd02d('0x10')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0xd02d('0x25')]('end');};EmailImap[_0xd02d('0x14')][_0xd02d('0x12')]=function(_0x582ee7,_0x3f4f9c){logger[_0xd02d('0x11')]('handleError',this['account'][_0xd02d('0x7')],JSON[_0xd02d('0x3b')](_0x582ee7));var _0x3f43a0='';if(_0x582ee7){if(_0x582ee7[_0xd02d('0x3c')]){_0x3f43a0=_0x582ee7[_0xd02d('0x3c')];}else{for(var _0x48d5dd in _0x582ee7){if(_0x582ee7['hasOwnProperty'](_0x48d5dd)){_0x3f43a0+=_[_0xd02d('0x3d')](_0x48d5dd)+':\x20'+_0x582ee7[_0x48d5dd]+'\x0a';}}}}if(_0x3f4f9c){this[_0xd02d('0x1')][_0xd02d('0xe')]();}else{this[_0xd02d('0x25')](_0xd02d('0x11'),_0x3f43a0);this[_0xd02d('0x25')](_0xd02d('0xe'));}};module[_0xd02d('0x3e')]=EmailImap; \ No newline at end of file +var _0xa114=['connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','email','anonymous@xcally.com','port','tls','autotls','required','openBox','handleOpenBox','emit','box','readUnseen','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','end','handleSimpleParser','parser','Email\x20text\x20truncated,\x20max\x20HTML\x20size\x20','emailMaxHtmlBytes','html','\x20[Email\x20text\x20truncated\x20because\x20size\x20more\x20than\x20','text','substring','stringify','textCode','hasOwnProperty','lodash','util','mailparser','simpleParser','iconv','EventEmitter','./utils','../../../config/logger','../../../config/environment','mailbox','account','getAccount','imap','once','ready','handleReady','bind','handleEnd','error','handleError','connect','inherits','prototype'];(function(_0x11c8d6,_0x32bc04){var _0x9a0c0=function(_0x1ba492){while(--_0x1ba492){_0x11c8d6['push'](_0x11c8d6['shift']());}};_0x9a0c0(++_0x32bc04);}(_0xa114,0x105));var _0x4a11=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xa114[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0x4a11('0x0'));var util=require(_0x4a11('0x1'));var Imap=require('imap');var simpleParser=require(_0x4a11('0x2'))[_0x4a11('0x3')];var Iconv=require(_0x4a11('0x4'))['Iconv'];var EventEmitter=require('events')[_0x4a11('0x5')];var utils=require(_0x4a11('0x6'));var logger=require(_0x4a11('0x7'))('email');var config=require(_0x4a11('0x8'));function EmailImap(_0x386acf,_0x53375b){this['mailbox']=_0x386acf[_0x4a11('0x9')];this[_0x4a11('0xa')]=this[_0x4a11('0xb')](_0x386acf,_0x53375b);this[_0x4a11('0xc')]=new Imap(this[_0x4a11('0xa')]);this[_0x4a11('0xc')][_0x4a11('0xd')](_0x4a11('0xe'),this[_0x4a11('0xf')][_0x4a11('0x10')](this));this[_0x4a11('0xc')]['once']('end',this[_0x4a11('0x11')][_0x4a11('0x10')](this));this['imap']['on'](_0x4a11('0x12'),this[_0x4a11('0x13')][_0x4a11('0x10')](this));this[_0x4a11('0xc')][_0x4a11('0x14')]();}util[_0x4a11('0x15')](EmailImap,EventEmitter);EmailImap[_0x4a11('0x16')][_0x4a11('0xb')]=function(_0x4b8f3a,_0x573fd2){var _0x39e0fe={'connTimeout':_0x4b8f3a[_0x4a11('0x17')]?_0x4b8f3a[_0x4a11('0x17')]*0x3e8:0x2710,'authTimeout':_0x4b8f3a[_0x4a11('0x18')]?_0x4b8f3a['authTimeout']*0x3e8:0x1388};if(_0x4b8f3a[_0x4a11('0x19')]){_0x39e0fe['user']=_0x4b8f3a[_0x4a11('0x1a')];if(_0x4b8f3a[_0x4a11('0x1b')]){_0x39e0fe[_0x4a11('0x1c')]=utils[_0x4a11('0x1d')](_0x4b8f3a[_0x4a11('0x1e')][_0x4a11('0x1f')],_0x4b8f3a[_0x4a11('0x1a')]);}else{_0x39e0fe['password']=_0x4b8f3a[_0x4a11('0x20')];}}else{if(_0x4b8f3a[_0x4a11('0x21')]){_0x39e0fe['user']=_0x4b8f3a['user'];_0x39e0fe[_0x4a11('0x20')]=_0x4b8f3a[_0x4a11('0x20')];}}_0x39e0fe[_0x4a11('0x22')]=_0x573fd2||_0x4b8f3a['user']||_0x4a11('0x23');_0x39e0fe['host']=_0x4b8f3a['host'];_0x39e0fe[_0x4a11('0x24')]=_0x4b8f3a['port']||0x3e1;if(_0x4b8f3a[_0x4a11('0x25')]){_0x39e0fe['tls']=!![];}else{_0x39e0fe['tls']=![];_0x39e0fe[_0x4a11('0x26')]=_0x4a11('0x27');}return _0x39e0fe;};EmailImap[_0x4a11('0x16')][_0x4a11('0xf')]=function(){this[_0x4a11('0xc')][_0x4a11('0x28')](this['mailbox'],![],this[_0x4a11('0x29')][_0x4a11('0x10')](this));};EmailImap[_0x4a11('0x16')][_0x4a11('0x29')]=function(_0x2535d1,_0x183cbd){if(_0x2535d1){this['handleError'](_0x2535d1,!![]);}else{this[_0x4a11('0x2a')](_0x4a11('0x2b'),_0x183cbd);this['readUnseen']();}};EmailImap[_0x4a11('0x16')]['handleCloseBox']=function(_0x34705c){if(_0x34705c){this[_0x4a11('0x13')](_0x34705c,!![]);}else{this[_0x4a11('0xc')]['end']();}};EmailImap[_0x4a11('0x16')][_0x4a11('0x2c')]=function(){this[_0x4a11('0xc')]['search']([_0x4a11('0x2d')],this[_0x4a11('0x2e')][_0x4a11('0x10')](this));};EmailImap[_0x4a11('0x16')]['handleReadUnseen']=function(_0x2eb139,_0x159b47){if(_0x2eb139){this[_0x4a11('0x13')](_0x2eb139,!![]);}else{if(_0x159b47[_0x4a11('0x2f')]){try{var _0x5ade27=this[_0x4a11('0xc')][_0x4a11('0x30')](_0x159b47['slice'](0x0,0xa),{'bodies':'','markSeen':!![]});_0x5ade27['on'](_0x4a11('0x31'),this[_0x4a11('0x32')][_0x4a11('0x10')](this));_0x5ade27['once']('error',this[_0x4a11('0x33')][_0x4a11('0x10')](this));_0x5ade27[_0x4a11('0xd')]('end',this[_0x4a11('0x34')][_0x4a11('0x10')](this));}catch(_0x201cd9){logger[_0x4a11('0x12')](_0x201cd9);}}else{this[_0x4a11('0xc')][_0x4a11('0x35')](!![],this[_0x4a11('0x36')][_0x4a11('0x10')](this));}}};EmailImap['prototype'][_0x4a11('0x32')]=function(_0x12a3b9){_0x12a3b9['on'](_0x4a11('0x37'),this[_0x4a11('0x38')][_0x4a11('0x10')](this));_0x12a3b9[_0x4a11('0xd')](_0x4a11('0x39'),this[_0x4a11('0x3a')][_0x4a11('0x10')](this));_0x12a3b9['once'](_0x4a11('0x3b'),this['handleMessageEnd'][_0x4a11('0x10')](this));};EmailImap['prototype'][_0x4a11('0x38')]=function(_0x510747){simpleParser(_0x510747,{'Iconv':Iconv},this['handleSimpleParser'][_0x4a11('0x10')](this));};EmailImap[_0x4a11('0x16')]['handleMessageAttributes']=function(){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0x4a11('0x16')][_0x4a11('0x3c')]=function(_0x19921b,_0x1ff478){if(_0x19921b){logger[_0x4a11('0x12')](_0x19921b);}else{var _0x35edb5=this;const _0xa27430=_0x1ff478['html'][_0x4a11('0x2f')];if(_0xa27430\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Data','generateXOAuth2Token','auth=Bearer\x20','utf-8','toString','lodash','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','name','substring','indexOf','split','slice','join','Anonymous','length','pop'];(function(_0x4f9a63,_0x25bf8e){var _0x4b6bac=function(_0x40522d){while(--_0x40522d){_0x4f9a63['push'](_0x4f9a63['shift']());}};_0x4b6bac(++_0x25bf8e);}(_0x122d,0x10b));var _0xd122=function(_0x279368,_0x41c002){_0x279368=_0x279368-0x0;var _0x40b6d0=_0x122d[_0x279368];return _0x40b6d0;};'use strict';var _=require(_0xd122('0x0'));var moment=require('moment');var random=require(_0xd122('0x1'));var fs=require('fs');var path=require('path');var util=require(_0xd122('0x2'));var tnef=require(_0xd122('0x3'));var logger=require(_0xd122('0x4'))(_0xd122('0x5'));var config=require(_0xd122('0x6'));function getAddress(_0x3f1888){var _0x5a8c0e=_[_0xd122('0x7')](_0x3f1888[_0xd122('0x8')]);return _0x5a8c0e&&_0x5a8c0e[_0xd122('0x9')]?_0x5a8c0e[_0xd122('0x9')]:_0xd122('0xa')+random[_0xd122('0xb')](0x6)+'@xcally.com';}function getFirstName(_0x18aa51){var _0x31771a=_[_0xd122('0x7')](_0x18aa51[_0xd122('0x8')]);if(_0x31771a&&_0x31771a[_0xd122('0xc')]){if(_0x31771a['name']==_0x31771a[_0xd122('0x9')]){return _0x31771a[_0xd122('0xc')][_0xd122('0xd')](0x0,_0x31771a[_0xd122('0xc')][_0xd122('0xe')]('@'));}var _0x25ee5e=_0x31771a[_0xd122('0xc')][_0xd122('0xf')](/\s+/);return _0x25ee5e['length']>0x1?_0x25ee5e[_0xd122('0x10')](0x0,-0x1)[_0xd122('0x11')]('\x20'):_0x31771a[_0xd122('0xc')];}return _0xd122('0x12');}function getLastName(_0x72b6c9){var _0x2d343b=_[_0xd122('0x7')](_0x72b6c9[_0xd122('0x8')]);if(_0x2d343b&&_0x2d343b['name']){var _0x16cd1f=_0x2d343b['name'][_0xd122('0xf')](/\s+/);return _0x16cd1f[_0xd122('0x13')]>0x1?_0x16cd1f[_0xd122('0x14')]():'';}return'';}function getMails(_0x2db331,_0x50293d){var _0x4640a9='';for(var _0x561320=0x0;_0x561320<_0x50293d[_0xd122('0x8')][_0xd122('0x13')];_0x561320+=0x1){if(_0x50293d['value'][_0x561320][_0xd122('0x9')]!==_0x2db331){if(!_['isEmpty'](_0x4640a9)){_0x4640a9+=',';}_0x4640a9+=_0x50293d[_0xd122('0x8')][_0x561320][_0xd122('0xc')]||_0x50293d[_0xd122('0x8')][_0x561320]['address']||'';_0x4640a9+='\x20<';_0x4640a9+=_0x50293d[_0xd122('0x8')][_0x561320][_0xd122('0x9')]?_0x50293d['value'][_0x561320][_0xd122('0x9')]:_0xd122('0xa')+random[_0xd122('0xb')](0x6)+_0xd122('0x15');_0x4640a9+='>';}}return _0x4640a9;}function parseEmail(_0x5f1891,_0x5b4cec,_0x300dc1){if(_0x5b4cec[_0xd122('0x16')]){var _0x1cd958=/)<[^<]*)*<\/script>/gi;while(_0x1cd958[_0xd122('0x17')](_0x5b4cec[_0xd122('0x16')])){_0x5b4cec['html']=_0x5b4cec['html'][_0xd122('0x18')](_0x1cd958,'');}if(_0x5b4cec[_0xd122('0x16')][_0xd122('0x19')](_0xd122('0x1a'))){var _0x2855bf=[];_0x5b4cec[_0xd122('0x1b')][_0xd122('0x1c')](_0x4ee03b=>{_0x2855bf[_0xd122('0x1d')](_0x4ee03b[_0xd122('0x1e')]);});var _0xa31c5f=/]+>/g;var _0x333f90=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x23b58a=_0x5b4cec[_0xd122('0x16')][_0xd122('0x18')](_0x333f90,'_SRC');var _0x4292ba=_0x23b58a[_0xd122('0x18')](_0xa31c5f,_0xd122('0x1f'));for(let _0x3476ec=0x0;_0x3476ec<_0x2855bf[_0xd122('0x13')];_0x3476ec++){var _0x5028a4=_0x4292ba[_0xd122('0x18')]('_IMG',_0xd122('0x20')+_0x2855bf[_0x3476ec]+_0xd122('0x21'));_0x4292ba=_0x5028a4;}_0x5b4cec[_0xd122('0x16')]=_0x4292ba;}_0x300dc1[_0xd122('0x22')]=_0x5b4cec[_0xd122('0x16')];}else{_0x300dc1[_0xd122('0x22')]=_0x5b4cec[_0xd122('0x23')];}if(_0x300dc1['body']){_0x300dc1[_0xd122('0x22')]=_0x300dc1[_0xd122('0x22')][_0xd122('0x18')](/0x0){var _0x15393b=[_0xd122('0x30'),_0xd122('0x31'),'Precedence:\x20auto_reply'];for(var _0x5797cf=0x0;_0x5797cf<_0x5b4cec[_0xd122('0x2f')][_0xd122('0x13')];_0x5797cf++){var _0x541db1=_['indexOf'](_0x15393b,_0x5b4cec['headerLines'][_0x5797cf][_0xd122('0x32')]);if(_0x541db1>=0x0){_0x300dc1[_0xd122('0x33')]=!![];}}}return _0x300dc1;}exports['parser']=function(_0x2971b7,_0x1db134,_0x43e49f){var _0x50469e={'from':getAddress(_0x1db134[_0xd122('0x34')]),'firstName':getFirstName(_0x1db134[_0xd122('0x34')]),'lastName':getLastName(_0x1db134['from']),'mapKey':'email','message':{'from':getMails(_0x2971b7[_0xd122('0x5')],_0x1db134['from']),'to':_0x2971b7[_0xd122('0x5')],'cc':'','subject':_0x1db134[_0xd122('0x35')]||'','messageId':_0x1db134[_0xd122('0x36')],'inReplyTo':_0x1db134['inReplyTo'],'sentAt':moment(_0x1db134[_0xd122('0x37')])[_0xd122('0x38')](_0xd122('0x39')),'attach':![],'attachments':[]}};if(!_0x1db134['html']&&!_0x1db134['textAsHtml']){var _0x577ff2=_[_0xd122('0x3a')](_0x1db134[_0xd122('0x1b')],{'contentType':_0xd122('0x3b')});if(_0x577ff2[_0xd122('0x13')]){logger[_0xd122('0x3c')](util[_0xd122('0x38')](_0xd122('0x3d'),_0x1db134[_0xd122('0x36')]));tnef[_0xd122('0x3e')](_[_0xd122('0x3f')](_0x577ff2)[_0xd122('0x2e')],function(_0x40f359,_0x2ebf3c){if(_0x2ebf3c){_0x1db134[_0xd122('0x16')]=_0x2ebf3c[_0xd122('0x40')]||_0xd122('0x41');if(_0x2ebf3c[_0xd122('0x42')]){for(var _0x535682=0x0;_0x535682<_0x2ebf3c[_0xd122('0x42')][_0xd122('0x13')];_0x535682++){var _0xd0f853=_0x2ebf3c[_0xd122('0x42')][_0x535682];_0x50469e[_0xd122('0x25')][_0xd122('0x1b')]['push']({'filename':_0xd0f853['Title'],'content':Buffer[_0xd122('0x34')](_0xd0f853[_0xd122('0x43')])});}}}_0x43e49f(parseEmail(_0x2971b7,_0x1db134,_0x50469e));});}else{_0x1db134[_0xd122('0x16')]=_0xd122('0x41');_0x43e49f(parseEmail(_0x2971b7,_0x1db134,_0x50469e));}}else{_0x43e49f(parseEmail(_0x2971b7,_0x1db134,_0x50469e));}};exports[_0xd122('0x44')]=function(_0xdadb0c,_0x44cf0a){var _0x560b19=['user='+(_0x44cf0a||''),_0xd122('0x45')+_0xdadb0c,'',''];return Buffer[_0xd122('0x34')](_0x560b19['join'](''),_0xd122('0x46'))[_0xd122('0x47')]('base64');}; \ No newline at end of file +var _0x9925=['includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','generateXOAuth2Token','auth=Bearer\x20','utf-8','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','generate','@xcally.com','name','indexOf','split','slice','join','length','isEmpty','anonymous','html','replace'];(function(_0x3f8139,_0x4fee1f){var _0x59b49c=function(_0x1fa99b){while(--_0x1fa99b){_0x3f8139['push'](_0x3f8139['shift']());}};_0x59b49c(++_0x4fee1f);}(_0x9925,0xc3));var _0x5992=function(_0x5b4dac,_0x394fdd){_0x5b4dac=_0x5b4dac-0x0;var _0x35b20d=_0x9925[_0x5b4dac];return _0x35b20d;};'use strict';var _=require(_0x5992('0x0'));var moment=require(_0x5992('0x1'));var random=require(_0x5992('0x2'));var fs=require('fs');var path=require(_0x5992('0x3'));var util=require(_0x5992('0x4'));var tnef=require(_0x5992('0x5'));var logger=require(_0x5992('0x6'))(_0x5992('0x7'));var config=require(_0x5992('0x8'));function getAddress(_0x3158ca){var _0x354629=_[_0x5992('0x9')](_0x3158ca[_0x5992('0xa')]);return _0x354629&&_0x354629[_0x5992('0xb')]?_0x354629[_0x5992('0xb')]:'anonymous'+random[_0x5992('0xc')](0x6)+_0x5992('0xd');}function getFirstName(_0x3407ab){var _0x1d0e15=_[_0x5992('0x9')](_0x3407ab['value']);if(_0x1d0e15&&_0x1d0e15['name']){if(_0x1d0e15['name']==_0x1d0e15['address']){return _0x1d0e15[_0x5992('0xe')]['substring'](0x0,_0x1d0e15[_0x5992('0xe')][_0x5992('0xf')]('@'));}var _0xd138a8=_0x1d0e15[_0x5992('0xe')][_0x5992('0x10')](/\s+/);return _0xd138a8['length']>0x1?_0xd138a8[_0x5992('0x11')](0x0,-0x1)[_0x5992('0x12')]('\x20'):_0x1d0e15[_0x5992('0xe')];}return'Anonymous';}function getLastName(_0x4fe432){var _0x15df60=_[_0x5992('0x9')](_0x4fe432[_0x5992('0xa')]);if(_0x15df60&&_0x15df60[_0x5992('0xe')]){var _0x312927=_0x15df60[_0x5992('0xe')][_0x5992('0x10')](/\s+/);return _0x312927[_0x5992('0x13')]>0x1?_0x312927['pop']():'';}return'';}function getMails(_0x57cdae,_0x5cb248){var _0x2d5651='';for(var _0x3a4824=0x0;_0x3a4824<_0x5cb248[_0x5992('0xa')][_0x5992('0x13')];_0x3a4824+=0x1){if(_0x5cb248['value'][_0x3a4824]['address']!==_0x57cdae){if(!_[_0x5992('0x14')](_0x2d5651)){_0x2d5651+=',';}_0x2d5651+=_0x5cb248[_0x5992('0xa')][_0x3a4824]['name']||_0x5cb248[_0x5992('0xa')][_0x3a4824]['address']||'';_0x2d5651+='\x20<';_0x2d5651+=_0x5cb248[_0x5992('0xa')][_0x3a4824][_0x5992('0xb')]?_0x5cb248[_0x5992('0xa')][_0x3a4824]['address']:_0x5992('0x15')+random['generate'](0x6)+_0x5992('0xd');_0x2d5651+='>';}}return _0x2d5651;}function parseEmail(_0x342e02,_0x328cc7,_0x439b6c){if(_0x328cc7[_0x5992('0x16')]){var _0x36fd40=/)<[^<]*)*<\/script>/gi;while(_0x36fd40['test'](_0x328cc7[_0x5992('0x16')])){_0x328cc7[_0x5992('0x16')]=_0x328cc7[_0x5992('0x16')][_0x5992('0x17')](_0x36fd40,'');}if(_0x328cc7['html'][_0x5992('0x18')](_0x5992('0x19'))){var _0x386d0d=[];_0x328cc7[_0x5992('0x1a')][_0x5992('0x1b')](_0x6c430c=>{_0x386d0d[_0x5992('0x1c')](_0x6c430c[_0x5992('0x1d')]);});var _0x604a2d=/]+>/g;var _0x496ee3=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0xdb9cbd=_0x328cc7['html'][_0x5992('0x17')](_0x496ee3,_0x5992('0x1e'));var _0x131cec=_0xdb9cbd[_0x5992('0x17')](_0x604a2d,_0x5992('0x1f'));for(let _0x59526e=0x0;_0x59526e<_0x386d0d[_0x5992('0x13')];_0x59526e++){var _0x1d7c46=_0x131cec['replace'](_0x5992('0x1f'),_0x5992('0x20')+_0x386d0d[_0x59526e]+_0x5992('0x21'));_0x131cec=_0x1d7c46;}_0x328cc7['html']=_0x131cec;}_0x439b6c[_0x5992('0x22')]=_0x328cc7[_0x5992('0x16')];}else{_0x439b6c['body']=_0x328cc7[_0x5992('0x23')];}if(_0x439b6c[_0x5992('0x22')]){_0x439b6c[_0x5992('0x22')]=_0x439b6c[_0x5992('0x22')]['replace'](/0x0){var _0x2a65c9=[_0x5992('0x33'),_0x5992('0x34'),_0x5992('0x35')];for(var _0x239e60=0x0;_0x239e60<_0x328cc7['headerLines'][_0x5992('0x13')];_0x239e60++){var _0x44b647=_[_0x5992('0xf')](_0x2a65c9,_0x328cc7[_0x5992('0x32')][_0x239e60][_0x5992('0x36')]);if(_0x44b647>=0x0){_0x439b6c[_0x5992('0x37')]=!![];}}}return _0x439b6c;}exports[_0x5992('0x38')]=function(_0x1189c8,_0x183b92,_0x24a1cd){var _0x324672={'from':getAddress(_0x183b92[_0x5992('0x39')]),'firstName':getFirstName(_0x183b92['from']),'lastName':getLastName(_0x183b92[_0x5992('0x39')]),'mapKey':'email','message':{'from':getMails(_0x1189c8[_0x5992('0x7')],_0x183b92[_0x5992('0x39')]),'to':_0x1189c8[_0x5992('0x7')],'cc':'','subject':_0x183b92['subject']||'','messageId':_0x183b92[_0x5992('0x3a')],'inReplyTo':_0x183b92[_0x5992('0x3b')],'sentAt':moment(_0x183b92['date'])['format'](_0x5992('0x3c')),'attach':![],'attachments':[]}};if(!_0x183b92[_0x5992('0x16')]&&!_0x183b92[_0x5992('0x23')]){var _0x5a844a=_['filter'](_0x183b92[_0x5992('0x1a')],{'contentType':_0x5992('0x3d')});if(_0x5a844a['length']){logger['info'](util[_0x5992('0x2b')](_0x5992('0x3e'),_0x183b92[_0x5992('0x3a')]));tnef[_0x5992('0x3f')](_[_0x5992('0x40')](_0x5a844a)[_0x5992('0x30')],function(_0x1cf312,_0x567f7e){if(_0x567f7e){_0x183b92['html']=_0x567f7e[_0x5992('0x41')]||_0x5992('0x42');if(_0x567f7e[_0x5992('0x43')]){for(var _0x50f102=0x0;_0x50f102<_0x567f7e[_0x5992('0x43')][_0x5992('0x13')];_0x50f102++){var _0x7d6fe4=_0x567f7e[_0x5992('0x43')][_0x50f102];_0x324672[_0x5992('0x25')][_0x5992('0x1a')][_0x5992('0x1c')]({'filename':_0x7d6fe4[_0x5992('0x44')],'content':Buffer[_0x5992('0x39')](_0x7d6fe4['Data'])});}}}_0x24a1cd(parseEmail(_0x1189c8,_0x183b92,_0x324672));});}else{_0x183b92[_0x5992('0x16')]=_0x5992('0x42');_0x24a1cd(parseEmail(_0x1189c8,_0x183b92,_0x324672));}}else{_0x24a1cd(parseEmail(_0x1189c8,_0x183b92,_0x324672));}};exports[_0x5992('0x45')]=function(_0x12fb28,_0x5e18cc){var _0x5628b7=['user='+(_0x5e18cc||''),_0x5992('0x46')+_0x12fb28,'',''];return Buffer[_0x5992('0x39')](_0x5628b7['join'](''),_0x5992('0x47'))['toString'](_0x5992('0x48'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 248e707..ae86a71 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 _0x50c7=['Imap','Smtp','exports','lodash','name','Service','key','active'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x50c7,0x83));var _0x750c=function(_0x1e5619,_0x1b1886){_0x1e5619=_0x1e5619-0x0;var _0x2c00f6=_0x50c7[_0x1e5619];return _0x2c00f6;};'use strict';var _=require(_0x750c('0x0'));function MailAccount(_0x4cdbda){this['id']=_0x4cdbda['id']||0x0;this[_0x750c('0x1')]=_0x4cdbda[_0x750c('0x1')]||_0x750c('0x2');this[_0x750c('0x3')]=_0x4cdbda[_0x750c('0x3')]||'SERV';this[_0x750c('0x4')]=_0x4cdbda[_0x750c('0x4')]||![];this['Imap']=_0x4cdbda[_0x750c('0x5')]||[];this[_0x750c('0x6')]=_0x4cdbda['Smtp']||[];}module[_0x750c('0x7')]=MailAccount; \ No newline at end of file +var _0xef95=['SERV','active','Imap','Smtp','exports','lodash','name','Service','key'];(function(_0x4b632b,_0x45d71e){var _0x34872d=function(_0x4604cf){while(--_0x4604cf){_0x4b632b['push'](_0x4b632b['shift']());}};_0x34872d(++_0x45d71e);}(_0xef95,0xdd));var _0x5ef9=function(_0x17e717,_0x18fcbe){_0x17e717=_0x17e717-0x0;var _0x229b56=_0xef95[_0x17e717];return _0x229b56;};'use strict';var _=require(_0x5ef9('0x0'));function MailAccount(_0x32a11e){this['id']=_0x32a11e['id']||0x0;this[_0x5ef9('0x1')]=_0x32a11e[_0x5ef9('0x1')]||_0x5ef9('0x2');this[_0x5ef9('0x3')]=_0x32a11e[_0x5ef9('0x3')]||_0x5ef9('0x4');this[_0x5ef9('0x5')]=_0x32a11e[_0x5ef9('0x5')]||![];this[_0x5ef9('0x6')]=_0x32a11e['Imap']||[];this[_0x5ef9('0x7')]=_0x32a11e[_0x5ef9('0x7')]||[];}module[_0x5ef9('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 8c35cf5..1f39823 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 _0x77b1=['hasOwnProperty','initMailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','prototype','mergeFromDatabase'];(function(_0x40207a,_0x1e0034){var _0x1e5435=function(_0xda1494){while(--_0xda1494){_0x40207a['push'](_0x40207a['shift']());}};_0x1e5435(++_0x1e0034);}(_0x77b1,0x8a));var _0x177b=function(_0x2e04a8,_0x2c48fc){_0x2e04a8=_0x2e04a8-0x0;var _0x168d77=_0x77b1[_0x2e04a8];return _0x168d77;};'use strict';var _=require(_0x177b('0x0'));var MailAccount=require(_0x177b('0x1'));var Realtime=function(){this[_0x177b('0x2')]={};};function freeIsNotKey(_0x7a49f9,_0x2115ef,_0x2b668f){var _0x3234d6=_['mapKeys'](_0x7a49f9,function(_0x1d3ef9,_0x2964b2){return _0x1d3ef9[_0x2b668f];});for(var _0x439bf0 in _0x2115ef){if(_0x2115ef['hasOwnProperty'](_0x439bf0)){if(!_0x3234d6[_0x439bf0]){delete _0x2115ef[_0x439bf0];}}}}Realtime[_0x177b('0x3')][_0x177b('0x4')]=function(_0x221c8a,_0x52ab9e){for(var _0x5608df in _0x52ab9e){if(_0x221c8a[_0x177b('0x5')](_0x5608df)){_0x221c8a[_0x5608df]=_0x52ab9e[_0x5608df];}}};Realtime[_0x177b('0x3')][_0x177b('0x6')]=function(){var _0x3c0de8=this;return function(_0x102961){if(_0x102961){freeIsNotKey(_0x102961,_0x3c0de8[_0x177b('0x2')],'id');for(var _0x477b83=0x0,_0x1a8ecd={},_0x1121f7={};_0x477b83<_0x102961[_0x177b('0x7')];_0x477b83+=0x1){_0x1a8ecd=_0x102961[_0x477b83];if(_[_0x177b('0x8')](_0x3c0de8[_0x177b('0x2')][_0x1a8ecd['id']])){_0x3c0de8['mailAccounts'][_0x1a8ecd['id']]=new MailAccount(_0x1a8ecd);}else{_[_0x177b('0x9')](_0x3c0de8[_0x177b('0x2')][_0x1a8ecd['id']],_0x1a8ecd);}}}return _0x3c0de8[_0x177b('0x2')];};};module[_0x177b('0xa')]=Realtime; \ No newline at end of file +var _0x8009=['../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','exports'];(function(_0xe896bf,_0x4f8e5e){var _0x4c7a8a=function(_0x410ff2){while(--_0x410ff2){_0xe896bf['push'](_0xe896bf['shift']());}};_0x4c7a8a(++_0x4f8e5e);}(_0x8009,0x110));var _0x9800=function(_0x1ed708,_0xc5a01f){_0x1ed708=_0x1ed708-0x0;var _0x3a4374=_0x8009[_0x1ed708];return _0x3a4374;};'use strict';var _=require('lodash');var MailAccount=require(_0x9800('0x0'));var Realtime=function(){this[_0x9800('0x1')]={};};function freeIsNotKey(_0x9091a3,_0xc1515a,_0x5bce4d){var _0xe1cdef=_[_0x9800('0x2')](_0x9091a3,function(_0x43978a,_0x4cc146){return _0x43978a[_0x5bce4d];});for(var _0x11ea4b in _0xc1515a){if(_0xc1515a[_0x9800('0x3')](_0x11ea4b)){if(!_0xe1cdef[_0x11ea4b]){delete _0xc1515a[_0x11ea4b];}}}}Realtime[_0x9800('0x4')][_0x9800('0x5')]=function(_0x43bb21,_0x2d411a){for(var _0x4d4981 in _0x2d411a){if(_0x43bb21['hasOwnProperty'](_0x4d4981)){_0x43bb21[_0x4d4981]=_0x2d411a[_0x4d4981];}}};Realtime[_0x9800('0x4')][_0x9800('0x6')]=function(){var _0x65b8df=this;return function(_0x52aa5f){if(_0x52aa5f){freeIsNotKey(_0x52aa5f,_0x65b8df['mailAccounts'],'id');for(var _0x2e4d5d=0x0,_0x476d0b={},_0x5990af={};_0x2e4d5d<_0x52aa5f['length'];_0x2e4d5d+=0x1){_0x476d0b=_0x52aa5f[_0x2e4d5d];if(_['isUndefined'](_0x65b8df[_0x9800('0x1')][_0x476d0b['id']])){_0x65b8df[_0x9800('0x1')][_0x476d0b['id']]=new MailAccount(_0x476d0b);}else{_['merge'](_0x65b8df[_0x9800('0x1')][_0x476d0b['id']],_0x476d0b);}}}return _0x65b8df['mailAccounts'];};};module[_0x9800('0x7')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 572a2d0..ef916a7 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 _0xb1ef=['../client','getMailAccounts','GetMailAccount','name','provider','service','email','active','key','ListId','MailServerIn','Imap','CloudProvider','data5','MailServerOut','Smtp','type','getMailAccount','notify','Request','NotifyMailAccount'];(function(_0x5ea6fc,_0x3bfafa){var _0x40481d=function(_0x4817ee){while(--_0x4817ee){_0x5ea6fc['push'](_0x5ea6fc['shift']());}};_0x40481d(++_0x3bfafa);}(_0xb1ef,0x93));var _0xfb1e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb1ef[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0xfb1e('0x0'));exports[_0xfb1e('0x1')]=function(){return function(){return client['Request'](_0xfb1e('0x2'),{'options':{'attributes':['id',_0xfb1e('0x3'),_0xfb1e('0x4'),_0xfb1e('0x5'),_0xfb1e('0x6'),_0xfb1e('0x7'),_0xfb1e('0x8'),_0xfb1e('0x9'),'TemplateId'],'raw':![],'include':[{'model':_0xfb1e('0xa'),'as':_0xfb1e('0xb'),'include':[{'model':_0xfb1e('0xc'),'attributes':['id',_0xfb1e('0x3'),'service','type',_0xfb1e('0xd')],'as':_0xfb1e('0xc')}]},{'model':_0xfb1e('0xe'),'as':_0xfb1e('0xf'),'include':[{'model':_0xfb1e('0xc'),'attributes':['id',_0xfb1e('0x3'),_0xfb1e('0x5'),_0xfb1e('0x10'),'data5'],'as':_0xfb1e('0xc')}]}]},'log':_0xfb1e('0x11')});};};exports[_0xfb1e('0x12')]=function(_0x43716f,_0x47755b){return client[_0xfb1e('0x13')](_0xfb1e('0x14'),{'account':{'id':_0x43716f},'body':_0x47755b,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0xf130=['data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','email','key','ListId','TemplateId','MailServerIn','CloudProvider'];(function(_0x228ac9,_0x42f065){var _0x69fe02=function(_0x210551){while(--_0x210551){_0x228ac9['push'](_0x228ac9['shift']());}};_0x69fe02(++_0x42f065);}(_0xf130,0x149));var _0x0f13=function(_0x443375,_0x209d3b){_0x443375=_0x443375-0x0;var _0x2fafbe=_0xf130[_0x443375];return _0x2fafbe;};'use strict';var client=require(_0x0f13('0x0'));exports[_0x0f13('0x1')]=function(){return function(){return client[_0x0f13('0x2')](_0x0f13('0x3'),{'options':{'attributes':['id',_0x0f13('0x4'),_0x0f13('0x5'),_0x0f13('0x6'),_0x0f13('0x7'),'active',_0x0f13('0x8'),_0x0f13('0x9'),_0x0f13('0xa')],'raw':![],'include':[{'model':_0x0f13('0xb'),'as':'Imap','include':[{'model':_0x0f13('0xc'),'attributes':['id',_0x0f13('0x4'),_0x0f13('0x6'),'type',_0x0f13('0xd')],'as':_0x0f13('0xc')}]},{'model':_0x0f13('0xe'),'as':_0x0f13('0xf'),'include':[{'model':_0x0f13('0xc'),'attributes':['id',_0x0f13('0x4'),'service','type',_0x0f13('0xd')],'as':'CloudProvider'}]}]},'log':_0x0f13('0x10')});};};exports[_0x0f13('0x11')]=function(_0x474cde,_0x5dece6){return client[_0x0f13('0x2')](_0x0f13('0x12'),{'account':{'id':_0x474cde},'body':_0x5dece6,'log':_0x0f13('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index c05e122..ff5597a 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 _0x1ab4=['../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x1ab4,0xb4));var _0x41ab=function(_0x239555,_0x59f04e){_0x239555=_0x239555-0x0;var _0x224fe3=_0x1ab4[_0x239555];return _0x224fe3;};'use strict';var client=require(_0x41ab('0x0'));exports[_0x41ab('0x1')]=function(){return client[_0x41ab('0x2')](_0x41ab('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x41ab('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x7b5c=['Request','ShowSetting','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x291772,_0x11fb41){var _0x3b148e=function(_0x58b1c5){while(--_0x58b1c5){_0x291772['push'](_0x291772['shift']());}};_0x3b148e(++_0x11fb41);}(_0x7b5c,0x148));var _0xc7b5=function(_0x409f75,_0x5bfa17){_0x409f75=_0x409f75-0x0;var _0x53b645=_0x7b5c[_0x409f75];return _0x53b645;};'use strict';var client=require(_0xc7b5('0x0'));exports[_0xc7b5('0x1')]=function(){return client[_0xc7b5('0x2')](_0xc7b5('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc7b5('0x4')]},'log':_0xc7b5('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 9b2a1c8..defe71c 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index bf88696..38f1cbf 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 _0x1279=['ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','redis','defaults','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','exports','lodash','http','sticky-session'];(function(_0x43f4d6,_0x29feb7){var _0x2e7ad0=function(_0x218d32){while(--_0x218d32){_0x43f4d6['push'](_0x43f4d6['shift']());}};_0x2e7ad0(++_0x29feb7);}(_0x1279,0x101));var _0x9127=function(_0x1acce6,_0xd38bea){_0x1acce6=_0x1acce6-0x0;var _0x13c860=_0x1279[_0x1acce6];return _0x13c860;};'use strict';var _=require(_0x9127('0x0'));var http=require(_0x9127('0x1'));var express=require('express');var sticky=require(_0x9127('0x2'));var Redis=require(_0x9127('0x3'));var config=require(_0x9127('0x4'));var app=express();var server=http[_0x9127('0x5')](app);server[_0x9127('0x6')]=0xdbba0;if(sticky[_0x9127('0x7')](server,config[_0x9127('0x8')])){var socketio=require(_0x9127('0x9'))(server,{'transports':['websocket','polling']});config[_0x9127('0xa')]=_[_0x9127('0xb')](config['redis'],{'host':'localhost','port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config[_0x9127('0xa')]),'subClient':new Redis(config[_0x9127('0xa')])}));require(_0x9127('0xc'))[_0x9127('0xd')]();require(_0x9127('0xe'))[_0x9127('0xd')](socketio);require(_0x9127('0xf'))[_0x9127('0xd')](app);require(_0x9127('0x10'))['default'](app);}else{server[_0x9127('0x11')](_0x9127('0x12'),function(){console['log']('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x9127('0x8')]);});}exports=module[_0x9127('0x13')]=app; \ No newline at end of file +var _0xbf4b=['once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','websocket','polling','redis','localhost','socket.io-redis','default','../../config/express','../../routes'];(function(_0x21d0f7,_0x5cb6f4){var _0x55c681=function(_0x3cd67f){while(--_0x3cd67f){_0x21d0f7['push'](_0x21d0f7['shift']());}};_0x55c681(++_0x5cb6f4);}(_0xbf4b,0x8f));var _0xbbf4=function(_0x2650de,_0x12c23e){_0x2650de=_0x2650de-0x0;var _0x2db8c0=_0xbf4b[_0x2650de];return _0x2db8c0;};'use strict';var _=require(_0xbbf4('0x0'));var http=require(_0xbbf4('0x1'));var express=require(_0xbbf4('0x2'));var sticky=require(_0xbbf4('0x3'));var Redis=require(_0xbbf4('0x4'));var config=require(_0xbbf4('0x5'));var app=express();var server=http[_0xbbf4('0x6')](app);server[_0xbbf4('0x7')]=0xdbba0;if(sticky[_0xbbf4('0x8')](server,config[_0xbbf4('0x9')])){var socketio=require('socket.io')(server,{'transports':[_0xbbf4('0xa'),_0xbbf4('0xb')]});config[_0xbbf4('0xc')]=_['defaults'](config['redis'],{'host':_0xbbf4('0xd'),'port':0x18eb});socketio['adapter'](require(_0xbbf4('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xbbf4('0xc')])}));require('../../config/triggers')['default']();require('../../config/socketio')[_0xbbf4('0xf')](socketio);require(_0xbbf4('0x10'))['default'](app);require(_0xbbf4('0x11'))[_0xbbf4('0xf')](app);}else{server[_0xbbf4('0x12')](_0xbbf4('0x13'),function(){console[_0xbbf4('0x14')](_0xbbf4('0x15'),config[_0xbbf4('0x9')]);});}exports=module[_0xbbf4('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 973b309..d4514df 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 _0xdf42=['rpc','error','message','result','catch','exports','bluebird','routing','client','http','Request','request','then','debug'];(function(_0x10a90f,_0x483cc2){var _0x5b427d=function(_0x5e955e){while(--_0x5e955e){_0x10a90f['push'](_0x10a90f['shift']());}};_0x5b427d(++_0x483cc2);}(_0xdf42,0xf4));var _0x2df4=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xdf42[_0xbd08b4];return _0x314f1e;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x2df4('0x0'));var logger=require('../../config/logger')(_0x2df4('0x1'));var client=jayson[_0x2df4('0x2')][_0x2df4('0x3')]({'port':0x2329});client[_0x2df4('0x4')]=function(_0x3953f9,_0x57ef24){return new BPromise(function(_0x1fecea,_0x1c6541){return client[_0x2df4('0x5')](_0x3953f9,_0x57ef24)[_0x2df4('0x6')](function(_0x4cb198){logger[_0x2df4('0x7')](_0x2df4('0x8'),_0x2df4('0x1'),_0x3953f9,_0x57ef24,_0x4cb198);if(_0x4cb198['error']){logger[_0x2df4('0x9')](_0x2df4('0x8'),'routing',_0x3953f9,_0x4cb198[_0x2df4('0x9')][_0x2df4('0xa')],_0x57ef24);return _0x1c6541(_0x4cb198['error'][_0x2df4('0xa')]);}else{return _0x1fecea(_0x4cb198[_0x2df4('0xb')]);}})[_0x2df4('0xc')](function(_0x2370f1){logger['error'](_0x2df4('0x8'),_0x2df4('0x1'),_0x3953f9,_0x2370f1,_0x57ef24);return _0x1c6541(_0x2370f1);});});};module[_0x2df4('0xd')]=client; \ No newline at end of file +var _0x1b98=['../../config/logger','routing','client','http','Request','request','then','debug','rpc','error','message','result','catch','exports','bluebird'];(function(_0xa95e6a,_0x3a26d0){var _0x3a0624=function(_0x99a1c8){while(--_0x99a1c8){_0xa95e6a['push'](_0xa95e6a['shift']());}};_0x3a0624(++_0x3a26d0);}(_0x1b98,0x176));var _0x81b9=function(_0x4245ad,_0x4c472e){_0x4245ad=_0x4245ad-0x0;var _0x3f487a=_0x1b98[_0x4245ad];return _0x3f487a;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x81b9('0x0'));var logger=require(_0x81b9('0x1'))(_0x81b9('0x2'));var client=jayson[_0x81b9('0x3')][_0x81b9('0x4')]({'port':0x2329});client[_0x81b9('0x5')]=function(_0x3705f4,_0x46d005){return new BPromise(function(_0x128a81,_0x424be5){return client[_0x81b9('0x6')](_0x3705f4,_0x46d005)[_0x81b9('0x7')](function(_0x293b20){logger[_0x81b9('0x8')](_0x81b9('0x9'),_0x81b9('0x2'),_0x3705f4,_0x46d005,_0x293b20);if(_0x293b20[_0x81b9('0xa')]){logger['error'](_0x81b9('0x9'),'routing',_0x3705f4,_0x293b20[_0x81b9('0xa')][_0x81b9('0xb')],_0x46d005);return _0x424be5(_0x293b20['error'][_0x81b9('0xb')]);}else{return _0x128a81(_0x293b20[_0x81b9('0xc')]);}})[_0x81b9('0xd')](function(_0x5dc13f){logger['error'](_0x81b9('0x9'),'routing',_0x3705f4,_0x5dc13f,_0x46d005);return _0x424be5(_0x5dc13f);});});};module[_0x81b9('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 34e6b2a..0e63a9e 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 _0x0f01=['initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues'];(function(_0x19f412,_0x59507e){var _0x3b622d=function(_0x2f1e2c){while(--_0x2f1e2c){_0x19f412['push'](_0x19f412['shift']());}};_0x3b622d(++_0x59507e);}(_0x0f01,0xe4));var _0x10f0=function(_0x58c044,_0x1e781d){_0x58c044=_0x58c044-0x0;var _0xf763ac=_0x0f01[_0x58c044];return _0xf763ac;};'use strict';var BPromise=require(_0x10f0('0x0'));var server=require(_0x10f0('0x1'));var Realtime=require(_0x10f0('0x2'));var user=require(_0x10f0('0x3'));var interval=require(_0x10f0('0x4'));var openchannelQueue=require(_0x10f0('0x5'));var chatQueue=require(_0x10f0('0x6'));var smsQueue=require(_0x10f0('0x7'));var mailQueue=require(_0x10f0('0x8'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x10f0('0x9')]()[_0x10f0('0xa')](user[_0x10f0('0xb')]())[_0x10f0('0xa')](realtime[_0x10f0('0xc')]())[_0x10f0('0xa')](interval[_0x10f0('0xd')]())[_0x10f0('0xa')](realtime[_0x10f0('0xe')]())[_0x10f0('0xa')](openchannelQueue[_0x10f0('0xf')]())[_0x10f0('0xa')](realtime[_0x10f0('0x10')]())[_0x10f0('0xa')](chatQueue[_0x10f0('0x11')]())[_0x10f0('0xa')](realtime['initChatQueues']())[_0x10f0('0xa')](smsQueue[_0x10f0('0x12')]())[_0x10f0('0xa')](realtime[_0x10f0('0x13')]())[_0x10f0('0xa')](mailQueue[_0x10f0('0x14')]())[_0x10f0('0xa')](realtime['initMailQueues']())[_0x10f0('0xa')](faxQueue[_0x10f0('0x15')]())['then'](realtime[_0x10f0('0x16')]())[_0x10f0('0xa')](whatsappQueue[_0x10f0('0x17')]())['then'](realtime[_0x10f0('0x18')]())['then'](function(){return realtime;});}function main(){return server[_0x10f0('0x19')](realtime)[_0x10f0('0xa')](function(_0x183764){return initRealtime();})[_0x10f0('0xa')](function(_0x114e78){return setInterval(initRealtime,0x1388);})[_0x10f0('0x1a')](function(_0x15dd2f){console[_0x10f0('0x1b')](_0x15dd2f);});}main(); \ No newline at end of file +var _0x702d=['then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','catch','log','bluebird','./server','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x702d,0x1b3));var _0xd702=function(_0x126caa,_0x1b68d6){_0x126caa=_0x126caa-0x0;var _0x349211=_0x702d[_0x126caa];return _0x349211;};'use strict';var BPromise=require(_0xd702('0x0'));var server=require(_0xd702('0x1'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require('./rpc/interval');var openchannelQueue=require(_0xd702('0x2'));var chatQueue=require(_0xd702('0x3'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xd702('0x4'));var faxQueue=require(_0xd702('0x5'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xd702('0x6')](user['getAgents']())[_0xd702('0x6')](realtime[_0xd702('0x7')]())[_0xd702('0x6')](interval[_0xd702('0x8')]())['then'](realtime[_0xd702('0x9')]())[_0xd702('0x6')](openchannelQueue[_0xd702('0xa')]())[_0xd702('0x6')](realtime[_0xd702('0xb')]())[_0xd702('0x6')](chatQueue[_0xd702('0xc')]())['then'](realtime[_0xd702('0xd')]())[_0xd702('0x6')](smsQueue['getSmsQueues']())[_0xd702('0x6')](realtime[_0xd702('0xe')]())[_0xd702('0x6')](mailQueue[_0xd702('0xf')]())['then'](realtime[_0xd702('0x10')]())[_0xd702('0x6')](faxQueue[_0xd702('0x11')]())[_0xd702('0x6')](realtime[_0xd702('0x12')]())[_0xd702('0x6')](whatsappQueue['getWhatsappQueues']())['then'](realtime['initWhatsappQueues']())[_0xd702('0x6')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xd702('0x6')](function(_0x1ce830){return initRealtime();})['then'](function(_0x4be84a){return setInterval(initRealtime,0x1388);})[_0xd702('0x13')](function(_0x9adbd5){console[_0xd702('0x14')](_0x9adbd5);});}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 6066fb2..6abd9b0 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 _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1261,0x144));var _0x1126=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0x1261[_0x37a79c];return _0x561d89;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file +var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x453e2b,_0x4f1258){var _0x50f306=function(_0x397f14){while(--_0x397f14){_0x453e2b['push'](_0x453e2b['shift']());}};_0x50f306(++_0x4f1258);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0x5fc3[_0x2c3255];return _0x282aba;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 542e9cc..21efe40 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 _0x197c=['http','request','then','error','message','result','SendMail','bluebird','jayson/promise','client'];(function(_0x3445b6,_0x32b49f){var _0x299451=function(_0x114f27){while(--_0x114f27){_0x3445b6['push'](_0x3445b6['shift']());}};_0x299451(++_0x32b49f);}(_0x197c,0x1c9));var _0xc197=function(_0x579e75,_0x40fe61){_0x579e75=_0x579e75-0x0;var _0x53a03f=_0x197c[_0x579e75];return _0x53a03f;};'use strict';var BPromise=require(_0xc197('0x0'));var jayson=require(_0xc197('0x1'));var client=jayson[_0xc197('0x2')][_0xc197('0x3')]({'port':0x232b});function request(_0x58fde5,_0x529ff4){return new BPromise(function(_0x5b40df,_0x420905){return client[_0xc197('0x4')](_0x58fde5,_0x529ff4)[_0xc197('0x5')](function(_0x16877d){if(_0x16877d[_0xc197('0x6')]){return _0x420905(_0x16877d[_0xc197('0x6')][_0xc197('0x7')]);}else{return _0x5b40df(_0x16877d[_0xc197('0x8')]);}})['catch'](function(_0x2a1a13){return _0x420905(_0x2a1a13);});});}exports['sendMailMessage']=function(_0x3cdc3a,_0x2ad828){return request(_0xc197('0x9'),{'account':_0x3cdc3a,'message':_0x2ad828});}; \ No newline at end of file +var _0xd23e=['sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message','result'];(function(_0x145026,_0x180f84){var _0x4f93f8=function(_0x49f4f8){while(--_0x49f4f8){_0x145026['push'](_0x145026['shift']());}};_0x4f93f8(++_0x180f84);}(_0xd23e,0x141));var _0xed23=function(_0x16e569,_0x33f836){_0x16e569=_0x16e569-0x0;var _0x22470a=_0xd23e[_0x16e569];return _0x22470a;};'use strict';var BPromise=require(_0xed23('0x0'));var jayson=require(_0xed23('0x1'));var client=jayson[_0xed23('0x2')][_0xed23('0x3')]({'port':0x232b});function request(_0x1a202d,_0x44a79a){return new BPromise(function(_0x8a20f1,_0x5dca41){return client[_0xed23('0x4')](_0x1a202d,_0x44a79a)[_0xed23('0x5')](function(_0x17744b){if(_0x17744b[_0xed23('0x6')]){return _0x5dca41(_0x17744b[_0xed23('0x6')][_0xed23('0x7')]);}else{return _0x8a20f1(_0x17744b[_0xed23('0x8')]);}})['catch'](function(_0x3c36f5){return _0x5dca41(_0x3c36f5);});});}exports[_0xed23('0x9')]=function(_0x34df78,_0x446506){return request(_0xed23('0xa'),{'account':_0x34df78,'message':_0x446506});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 3d7bb49..eeee68d 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 _0xd7d1=['openchannelCurrentCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','idle','mail','openchannel','fax','sms','whatsapp','Status','toNumber','format','mailStatus','faxCurrentCapacity','smsStatusTime','whatsappStatusTime','whatsappCurrentCapacity','openchannelStatus','busyQueue','mailWaitingInteractions','stringify','emit','user:routing:update','omit','exports','lodash','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','openchannelStatusTime','openchannelCapacity'];(function(_0x83487c,_0x1104d8){var _0x25ce18=function(_0x5814dd){while(--_0x5814dd){_0x83487c['push'](_0x83487c['shift']());}};_0x25ce18(++_0x1104d8);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x536c52,_0x2f2fe9){_0x536c52=_0x536c52-0x0;var _0x5d673b=_0xd7d1[_0x536c52];return _0x5d673b;};'use strict';var _=require(_0x1d7d('0x0'));var md5=require(_0x1d7d('0x1'));var moment=require(_0x1d7d('0x2'));var Redis=require(_0x1d7d('0x3'));var config=require(_0x1d7d('0x4'));config[_0x1d7d('0x5')]=_[_0x1d7d('0x6')](config[_0x1d7d('0x5')],{'host':_0x1d7d('0x7'),'port':0x18eb});var io=require(_0x1d7d('0x8'))(new Redis(config[_0x1d7d('0x5')]));function Agent(_0x1a2564){this['id']=_0x1a2564['id']||0x0;this[_0x1d7d('0x9')]=_0x1a2564['name']||'';this[_0x1d7d('0xa')]=_0x1a2564[_0x1d7d('0xa')]||!![];this[_0x1d7d('0xb')]=_0x1a2564[_0x1d7d('0xb')]||![];this[_0x1d7d('0xc')]=_0x1a2564[_0x1d7d('0xc')]||![];this[_0x1d7d('0xd')]=_0x1a2564[_0x1d7d('0xd')]||![];this[_0x1d7d('0xe')]=_0x1a2564[_0x1d7d('0xe')]||![];this[_0x1d7d('0xf')]=_0x1a2564['smsPause']||![];this[_0x1d7d('0x10')]=_0x1a2564['openchannelPause']||![];this[_0x1d7d('0x11')]=_0x1d7d('0x12');this[_0x1d7d('0x13')]=0x0;this[_0x1d7d('0x14')]=_0x1a2564['chatCapacity']||0x0;this[_0x1d7d('0x15')]=0x0;this['mailStatus']='unknown';this[_0x1d7d('0x16')]=0x0;this[_0x1d7d('0x17')]=_0x1a2564['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this[_0x1d7d('0x18')]=_0x1d7d('0x12');this[_0x1d7d('0x19')]=0x0;this[_0x1d7d('0x1a')]=_0x1a2564[_0x1d7d('0x1a')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x1d7d('0x1b')]=_0x1d7d('0x12');this['smsStatusTime']=0x0;this[_0x1d7d('0x1c')]=_0x1a2564[_0x1d7d('0x1c')]||0x0;this[_0x1d7d('0x1d')]=0x0;this[_0x1d7d('0x1e')]=_0x1d7d('0x12');this['whatsappStatusTime']=0x0;this[_0x1d7d('0x1f')]=_0x1a2564[_0x1d7d('0x1f')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x1d7d('0x12');this[_0x1d7d('0x20')]=0x0;this[_0x1d7d('0x21')]=_0x1a2564[_0x1d7d('0x21')]||0x0;this[_0x1d7d('0x22')]=0x0;this[_0x1d7d('0x23')]=![];this['busyQueue']=undefined;this[_0x1d7d('0x1')]='';this[_0x1d7d('0x24')]={};this[_0x1d7d('0x25')]={};this['mailWaitingInteractions']={};this[_0x1d7d('0x26')]={};this[_0x1d7d('0x27')]={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent[_0x1d7d('0x28')][_0x1d7d('0x29')]=function(_0x3d631f){if(this[_0x3d631f+'CurrentCapacity']>0x0){if(this[_0x3d631f+_0x1d7d('0x2a')]>0x0&&this[_0x3d631f+_0x1d7d('0x2b')]>=this[_0x3d631f+_0x1d7d('0x2a')]){return _0x1d7d('0x2c');}else{return'working';}}else{return _0x1d7d('0x2d');}};Agent[_0x1d7d('0x28')]['updateRealtime']=function(){var _0x57bbd8=[_0x1d7d('0x2e'),'chat',_0x1d7d('0x2f'),_0x1d7d('0x30'),_0x1d7d('0x31'),_0x1d7d('0x32')];for(var _0x465938=0x0;_0x465938<_0x57bbd8['length'];_0x465938+=0x1){var _0x1c2616=this[_0x1d7d('0x29')](_0x57bbd8[_0x465938]);if(this[_0x57bbd8[_0x465938]+_0x1d7d('0x33')]!==_0x1c2616){this[_0x57bbd8[_0x465938]+'StatusTime']=_[_0x1d7d('0x34')](moment()[_0x1d7d('0x35')]('x'));}this[_0x57bbd8[_0x465938]+_0x1d7d('0x33')]=_0x1c2616;}var _0x482367={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x1d7d('0xb')],'chatPause':this[_0x1d7d('0xc')],'mailPause':this['mailPause'],'smsPause':this[_0x1d7d('0xf')],'faxPause':this[_0x1d7d('0xe')],'openchannelPause':this[_0x1d7d('0x10')],'chatStatus':this[_0x1d7d('0x11')],'chatStatusTime':this[_0x1d7d('0x13')],'chatCapacity':this[_0x1d7d('0x14')],'chatCurrentCapacity':this[_0x1d7d('0x15')],'mailStatus':this[_0x1d7d('0x36')],'mailStatusTime':this[_0x1d7d('0x16')],'mailCapacity':this[_0x1d7d('0x17')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x1d7d('0x19')],'faxCapacity':this[_0x1d7d('0x1a')],'faxCurrentCapacity':this[_0x1d7d('0x37')],'smsStatus':this[_0x1d7d('0x1b')],'smsStatusTime':this[_0x1d7d('0x38')],'smsCapacity':this[_0x1d7d('0x1c')],'smsCurrentCapacity':this[_0x1d7d('0x1d')],'whatsappStatus':this[_0x1d7d('0x1e')],'whatsappStatusTime':this[_0x1d7d('0x39')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x1d7d('0x3a')],'openchannelStatus':this[_0x1d7d('0x3b')],'openchannelStatusTime':this[_0x1d7d('0x20')],'openchannelCapacity':this[_0x1d7d('0x21')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x1d7d('0x3c')],'chatWaitingInteractions':this[_0x1d7d('0x24')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x1d7d('0x3d')],'openchannelWaitingInteractions':this[_0x1d7d('0x26')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x26f81c=md5(JSON[_0x1d7d('0x3e')](_0x482367));if(this[_0x1d7d('0x1')]!==_0x26f81c){this[_0x1d7d('0x1')]=_0x26f81c;io[_0x1d7d('0x3f')](_0x1d7d('0x40'),_[_0x1d7d('0x41')](_0x482367,[_0x1d7d('0xa')]));}};module[_0x1d7d('0x42')]=Agent; \ No newline at end of file +var _0x5c3c=['openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','working','idle','mail','chat','openchannel','fax','whatsapp','length','Status','StatusTime','toNumber','format','online','mailStatusTime','faxStatusTime','smsCurrentCapacity','whatsappCurrentCapacity','faxWaitingInteractions','emit','user:routing:update','omit','exports','lodash','md5','moment','ioredis','redis','defaults','localhost','socket.io-emitter','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','mailWaitingInteractions'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x5c3c,0x132));var _0xc5c3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5c3c[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xc5c3('0x0'));var md5=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var Redis=require(_0xc5c3('0x3'));var config=require('../../../config/environment');config[_0xc5c3('0x4')]=_[_0xc5c3('0x5')](config[_0xc5c3('0x4')],{'host':_0xc5c3('0x6'),'port':0x18eb});var io=require(_0xc5c3('0x7'))(new Redis(config[_0xc5c3('0x4')]));function Agent(_0xe85098){this['id']=_0xe85098['id']||0x0;this[_0xc5c3('0x8')]=_0xe85098[_0xc5c3('0x8')]||'';this['online']=_0xe85098['online']||!![];this['voicePause']=_0xe85098[_0xc5c3('0x9')]||![];this[_0xc5c3('0xa')]=_0xe85098['chatPause']||![];this[_0xc5c3('0xb')]=_0xe85098[_0xc5c3('0xb')]||![];this['faxPause']=_0xe85098[_0xc5c3('0xc')]||![];this[_0xc5c3('0xd')]=_0xe85098['smsPause']||![];this[_0xc5c3('0xe')]=_0xe85098[_0xc5c3('0xe')]||![];this[_0xc5c3('0xf')]='unknown';this[_0xc5c3('0x10')]=0x0;this[_0xc5c3('0x11')]=_0xe85098['chatCapacity']||0x0;this[_0xc5c3('0x12')]=0x0;this[_0xc5c3('0x13')]=_0xc5c3('0x14');this['mailStatusTime']=0x0;this[_0xc5c3('0x15')]=_0xe85098[_0xc5c3('0x15')]||0x0;this[_0xc5c3('0x16')]=0x0;this[_0xc5c3('0x17')]=_0xc5c3('0x14');this['faxStatusTime']=0x0;this['faxCapacity']=_0xe85098[_0xc5c3('0x18')]||0x0;this[_0xc5c3('0x19')]=0x0;this[_0xc5c3('0x1a')]=_0xc5c3('0x14');this['smsStatusTime']=0x0;this['smsCapacity']=_0xe85098[_0xc5c3('0x1b')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xc5c3('0x1c')]=_0xc5c3('0x14');this[_0xc5c3('0x1d')]=0x0;this[_0xc5c3('0x1e')]=_0xe85098[_0xc5c3('0x1e')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xc5c3('0x1f')]=_0xc5c3('0x14');this[_0xc5c3('0x20')]=0x0;this[_0xc5c3('0x21')]=_0xe85098['openchannelCapacity']||0x0;this[_0xc5c3('0x22')]=0x0;this[_0xc5c3('0x23')]=![];this[_0xc5c3('0x24')]=undefined;this[_0xc5c3('0x1')]='';this[_0xc5c3('0x25')]={};this['faxWaitingInteractions']={};this[_0xc5c3('0x26')]={};this[_0xc5c3('0x27')]={};this[_0xc5c3('0x28')]={};this[_0xc5c3('0x29')]={};this[_0xc5c3('0x2a')]();}Agent[_0xc5c3('0x2b')][_0xc5c3('0x2c')]=function(_0x5996a0){if(this[_0x5996a0+'CurrentCapacity']>0x0){if(this[_0x5996a0+_0xc5c3('0x2d')]>0x0&&this[_0x5996a0+_0xc5c3('0x2e')]>=this[_0x5996a0+'Capacity']){return'maxcapacity';}else{return _0xc5c3('0x2f');}}else{return _0xc5c3('0x30');}};Agent[_0xc5c3('0x2b')]['updateRealtime']=function(){var _0x4af067=[_0xc5c3('0x31'),_0xc5c3('0x32'),_0xc5c3('0x33'),_0xc5c3('0x34'),'sms',_0xc5c3('0x35')];for(var _0x5176c4=0x0;_0x5176c4<_0x4af067[_0xc5c3('0x36')];_0x5176c4+=0x1){var _0x4e6e6f=this[_0xc5c3('0x2c')](_0x4af067[_0x5176c4]);if(this[_0x4af067[_0x5176c4]+_0xc5c3('0x37')]!==_0x4e6e6f){this[_0x4af067[_0x5176c4]+_0xc5c3('0x38')]=_[_0xc5c3('0x39')](moment()[_0xc5c3('0x3a')]('x'));}this[_0x4af067[_0x5176c4]+_0xc5c3('0x37')]=_0x4e6e6f;}var _0x35a397={'id':this['id'],'name':this['name'],'online':this[_0xc5c3('0x3b')],'voicePause':this['voicePause'],'chatPause':this[_0xc5c3('0xa')],'mailPause':this[_0xc5c3('0xb')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0xc5c3('0xe')],'chatStatus':this[_0xc5c3('0xf')],'chatStatusTime':this[_0xc5c3('0x10')],'chatCapacity':this[_0xc5c3('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xc5c3('0x13')],'mailStatusTime':this[_0xc5c3('0x3c')],'mailCapacity':this[_0xc5c3('0x15')],'mailCurrentCapacity':this[_0xc5c3('0x16')],'faxStatus':this[_0xc5c3('0x17')],'faxStatusTime':this[_0xc5c3('0x3d')],'faxCapacity':this[_0xc5c3('0x18')],'faxCurrentCapacity':this[_0xc5c3('0x19')],'smsStatus':this[_0xc5c3('0x1a')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xc5c3('0x1b')],'smsCurrentCapacity':this[_0xc5c3('0x3e')],'whatsappStatus':this[_0xc5c3('0x1c')],'whatsappStatusTime':this[_0xc5c3('0x1d')],'whatsappCapacity':this[_0xc5c3('0x1e')],'whatsappCurrentCapacity':this[_0xc5c3('0x3f')],'openchannelStatus':this[_0xc5c3('0x1f')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xc5c3('0x22')],'busy':this['busy'],'busyQueue':this[_0xc5c3('0x24')],'chatWaitingInteractions':this[_0xc5c3('0x25')],'faxWaitingInteractions':this[_0xc5c3('0x40')],'mailWaitingInteractions':this[_0xc5c3('0x26')],'openchannelWaitingInteractions':this[_0xc5c3('0x27')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0xc5c3('0x29')]};var _0xdaecce=md5(JSON['stringify'](_0x35a397));if(this[_0xc5c3('0x1')]!==_0xdaecce){this[_0xc5c3('0x1')]=_0xdaecce;io[_0xc5c3('0x41')](_0xc5c3('0x42'),_[_0xc5c3('0x43')](_0x35a397,[_0xc5c3('0x3b')]));}};module[_0xc5c3('0x44')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 643c987..9db89db 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 _0x748c=['waiting','stringify','chat:queue:%s','emit','chat_queue:save','exports','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','map','paused','online','loggedIn','chatPause','available'];(function(_0x507196,_0x4e91be){var _0x5ef89c=function(_0x563a70){while(--_0x563a70){_0x507196['push'](_0x507196['shift']());}};_0x5ef89c(++_0x4e91be);}(_0x748c,0x1e6));var _0xc748=function(_0x4d54d8,_0x8fc74){_0x4d54d8=_0x4d54d8-0x0;var _0x39ae9b=_0x748c[_0x4d54d8];return _0x39ae9b;};'use strict';var _=require(_0xc748('0x0'));var md5=require('md5');var util=require(_0xc748('0x1'));var Redis=require(_0xc748('0x2'));var config=require('../../../config/environment');config[_0xc748('0x3')]=_[_0xc748('0x4')](config[_0xc748('0x3')],{'host':_0xc748('0x5'),'port':0x18eb});var io=require(_0xc748('0x6'))(new Redis(config['redis']));function ChatQueue(_0x8403a4){this['id']=_0x8403a4['id']||0x0;this['name']=_0x8403a4[_0xc748('0x7')]||'';this[_0xc748('0x8')]=_0x8403a4[_0xc748('0x8')]||0xa;this[_0xc748('0x9')]=_0x8403a4[_0xc748('0x9')]||_0xc748('0xa');this[_0xc748('0xb')]=_0x8403a4[_0xc748('0xb')];this[_0xc748('0xc')]={};this['waiting']=0x0;this[_0xc748('0xd')]='';this[_0xc748('0xe')]();this[_0xc748('0xf')]();}ChatQueue[_0xc748('0x10')]['updateRouting']=function(){var _0x228065=this['mapAgentsId'][_0xc748('0x11')];this[_0xc748('0xc')]=_[_0xc748('0x12')](this['Agents'],'id');this[_0xc748('0xc')][_0xc748('0x11')]=_0x228065;};ChatQueue['prototype'][_0xc748('0xf')]=function(){this['loggedIn']=0x0;this[_0xc748('0x13')]=0x0;for(var _0x57148b=0x0;_0x57148b=0x0?this[_0xc748('0x17')]:0x0;var _0x12b0f2={'id':this['id'],'available':this[_0xc748('0x17')],'loggedIn':this[_0xc748('0x15')],'name':this[_0xc748('0x7')],'paused':this[_0xc748('0x13')],'waiting':this[_0xc748('0x18')]};var _0x3a0c1f=md5(JSON[_0xc748('0x19')](_0x12b0f2));if(this['md5']!==_0x3a0c1f){this[_0xc748('0xd')]=_0x3a0c1f;io['to'](util['format'](_0xc748('0x1a'),_0x12b0f2['name']))[_0xc748('0x1b')](_0xc748('0x1c'),_0x12b0f2);}};module[_0xc748('0x1d')]=ChatQueue; \ No newline at end of file +var _0x8ced=['md5','util','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','Agents','loggedIn','length','online','chatPause','paused','available','stringify','chat:queue:%s','chat_queue:save','lodash'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x8ced,0xa1));var _0xd8ce=function(_0x1fcc1e,_0x39efee){_0x1fcc1e=_0x1fcc1e-0x0;var _0x13497a=_0x8ced[_0x1fcc1e];return _0x13497a;};'use strict';var _=require(_0xd8ce('0x0'));var md5=require(_0xd8ce('0x1'));var util=require(_0xd8ce('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xd8ce('0x3')](config[_0xd8ce('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xd8ce('0x5'))(new Redis(config[_0xd8ce('0x4')]));function ChatQueue(_0x303fdf){this['id']=_0x303fdf['id']||0x0;this[_0xd8ce('0x6')]=_0x303fdf[_0xd8ce('0x6')]||'';this[_0xd8ce('0x7')]=_0x303fdf[_0xd8ce('0x7')]||0xa;this['strategy']=_0x303fdf[_0xd8ce('0x8')]||_0xd8ce('0x9');this['Agents']=_0x303fdf['Agents'];this[_0xd8ce('0xa')]={};this[_0xd8ce('0xb')]=0x0;this[_0xd8ce('0x1')]='';this[_0xd8ce('0xc')]();this[_0xd8ce('0xd')]();}ChatQueue[_0xd8ce('0xe')][_0xd8ce('0xc')]=function(){var _0x4bf97f=this['mapAgentsId'][_0xd8ce('0xf')];this[_0xd8ce('0xa')]=_[_0xd8ce('0x10')](this[_0xd8ce('0x11')],'id');this[_0xd8ce('0xa')][_0xd8ce('0xf')]=_0x4bf97f;};ChatQueue['prototype']['updateRealtime']=function(){this[_0xd8ce('0x12')]=0x0;this['paused']=0x0;for(var _0x564c6b=0x0;_0x564c6b=0x0?this['available']:0x0;var _0x4fb508={'id':this['id'],'available':this[_0xd8ce('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xd8ce('0x16')],'waiting':this[_0xd8ce('0xb')]};var _0x36e778=md5(JSON[_0xd8ce('0x18')](_0x4fb508));if(this['md5']!==_0x36e778){this[_0xd8ce('0x1')]=_0x36e778;io['to'](util['format'](_0xd8ce('0x19'),_0x4fb508[_0xd8ce('0x6')]))['emit'](_0xd8ce('0x1a'),_0x4fb508);}};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 fb485f7..8035ea3 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 _0xaf50=['lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','paused','length','online','loggedIn','available','stringify','format','emit','fax_queue:save','exports'];(function(_0x542749,_0x3d95bb){var _0x4612dd=function(_0x556642){while(--_0x556642){_0x542749['push'](_0x542749['shift']());}};_0x4612dd(++_0x3d95bb);}(_0xaf50,0x1d0));var _0x0af5=function(_0x103833,_0x99d5b1){_0x103833=_0x103833-0x0;var _0x1ac299=_0xaf50[_0x103833];return _0x1ac299;};'use strict';var _=require(_0x0af5('0x0'));var md5=require(_0x0af5('0x1'));var util=require('util');var Redis=require(_0x0af5('0x2'));var config=require(_0x0af5('0x3'));config[_0x0af5('0x4')]=_[_0x0af5('0x5')](config['redis'],{'host':_0x0af5('0x6'),'port':0x18eb});var io=require(_0x0af5('0x7'))(new Redis(config['redis']));function FaxQueue(_0x5ce160){this['id']=_0x5ce160['id']||0x0;this['name']=_0x5ce160[_0x0af5('0x8')]||'';this[_0x0af5('0x9')]=_0x5ce160[_0x0af5('0x9')]||0xa;this[_0x0af5('0xa')]=_0x5ce160[_0x0af5('0xa')]||'beepall';this['Agents']=_0x5ce160[_0x0af5('0xb')];this['mapAgentsId']={};this[_0x0af5('0xc')]=0x0;this[_0x0af5('0x1')]='';this[_0x0af5('0xd')]();this[_0x0af5('0xe')]();}FaxQueue[_0x0af5('0xf')][_0x0af5('0xd')]=function(){var _0x481e35=this['mapAgentsId'][_0x0af5('0x10')];this[_0x0af5('0x11')]=_[_0x0af5('0x12')](this[_0x0af5('0xb')],'id');this['mapAgentsId'][_0x0af5('0x10')]=_0x481e35;};FaxQueue[_0x0af5('0xf')][_0x0af5('0xe')]=function(){this['loggedIn']=0x0;this[_0x0af5('0x13')]=0x0;for(var _0x408079=0x0;_0x408079=0x0?this['available']:0x0;var _0x5da378={'id':this['id'],'available':this[_0x0af5('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x0af5('0x8')],'paused':this[_0x0af5('0x13')],'waiting':this['waiting']};var _0xee0b83=md5(JSON[_0x0af5('0x18')](_0x5da378));if(this['md5']!==_0xee0b83){this[_0x0af5('0x1')]=_0xee0b83;io['to'](util[_0x0af5('0x19')]('fax:queue:%s',_0x5da378[_0x0af5('0x8')]))[_0x0af5('0x1a')](_0x0af5('0x1b'),_0x5da378);}};module[_0x0af5('0x1c')]=FaxQueue; \ No newline at end of file +var _0xd792=['updateRealtime','prototype','_rr','map','loggedIn','paused','length','faxPause','available','stringify','fax:queue:%s','emit','fax_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x307f72,_0x32fba4){var _0x10f2c6=function(_0x56117a){while(--_0x56117a){_0x307f72['push'](_0x307f72['shift']());}};_0x10f2c6(++_0x32fba4);}(_0xd792,0xc2));var _0x2d79=function(_0xdeee16,_0x2de5a4){_0xdeee16=_0xdeee16-0x0;var _0x425069=_0xd792[_0xdeee16];return _0x425069;};'use strict';var _=require('lodash');var md5=require(_0x2d79('0x0'));var util=require(_0x2d79('0x1'));var Redis=require(_0x2d79('0x2'));var config=require(_0x2d79('0x3'));config[_0x2d79('0x4')]=_[_0x2d79('0x5')](config[_0x2d79('0x4')],{'host':_0x2d79('0x6'),'port':0x18eb});var io=require(_0x2d79('0x7'))(new Redis(config[_0x2d79('0x4')]));function FaxQueue(_0x3d568a){this['id']=_0x3d568a['id']||0x0;this[_0x2d79('0x8')]=_0x3d568a[_0x2d79('0x8')]||'';this[_0x2d79('0x9')]=_0x3d568a[_0x2d79('0x9')]||0xa;this[_0x2d79('0xa')]=_0x3d568a[_0x2d79('0xa')]||_0x2d79('0xb');this[_0x2d79('0xc')]=_0x3d568a[_0x2d79('0xc')];this[_0x2d79('0xd')]={};this[_0x2d79('0xe')]=0x0;this['md5']='';this[_0x2d79('0xf')]();this[_0x2d79('0x10')]();}FaxQueue[_0x2d79('0x11')][_0x2d79('0xf')]=function(){var _0x321b6c=this[_0x2d79('0xd')][_0x2d79('0x12')];this[_0x2d79('0xd')]=_[_0x2d79('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x2d79('0x12')]=_0x321b6c;};FaxQueue[_0x2d79('0x11')]['updateRealtime']=function(){this[_0x2d79('0x14')]=0x0;this[_0x2d79('0x15')]=0x0;for(var _0x259b4f=0x0;_0x259b4f=0x0?this['available']:0x0;var _0x2b0f41={'id':this['id'],'available':this[_0x2d79('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x2d79('0x8')],'paused':this['paused'],'waiting':this[_0x2d79('0xe')]};var _0x45d564=md5(JSON[_0x2d79('0x19')](_0x2b0f41));if(this[_0x2d79('0x0')]!==_0x45d564){this[_0x2d79('0x0')]=_0x45d564;io['to'](util['format'](_0x2d79('0x1a'),_0x2b0f41['name']))[_0x2d79('0x1b')](_0x2d79('0x1c'),_0x2b0f41);}};module[_0x2d79('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 2d2e18f..de5887b 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 _0x5537=['exports','name','Intervals'];(function(_0x52d365,_0x21d68f){var _0x38cc0f=function(_0x48f9d){while(--_0x48f9d){_0x52d365['push'](_0x52d365['shift']());}};_0x38cc0f(++_0x21d68f);}(_0x5537,0x8e));var _0x7553=function(_0xf73390,_0x14c109){_0xf73390=_0xf73390-0x0;var _0x4b212f=_0x5537[_0xf73390];return _0x4b212f;};'use strict';function Interval(_0x318f1e){this['id']=_0x318f1e['id']||0x0;this['name']=_0x318f1e[_0x7553('0x0')]||'';this[_0x7553('0x1')]=_0x318f1e[_0x7553('0x1')]||{};}module[_0x7553('0x2')]=Interval; \ No newline at end of file +var _0x70bb=['Intervals','exports','name'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x70bb,0xbc));var _0xb70b=function(_0x5ce00e,_0x5be1b1){_0x5ce00e=_0x5ce00e-0x0;var _0x2f825b=_0x70bb[_0x5ce00e];return _0x2f825b;};'use strict';function Interval(_0x28e8df){this['id']=_0x28e8df['id']||0x0;this['name']=_0x28e8df[_0xb70b('0x0')]||'';this[_0xb70b('0x1')]=_0x28e8df[_0xb70b('0x1')]||{};}module[_0xb70b('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 47df3da..7aca4c4 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 _0xb06f=['paused','length','online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','map','prototype','loggedIn'];(function(_0x544e18,_0x7d0b19){var _0x2a22da=function(_0x4a1135){while(--_0x4a1135){_0x544e18['push'](_0x544e18['shift']());}};_0x2a22da(++_0x7d0b19);}(_0xb06f,0x110));var _0xfb06=function(_0x3799ae,_0x40ccc1){_0x3799ae=_0x3799ae-0x0;var _0x129408=_0xb06f[_0x3799ae];return _0x129408;};'use strict';var _=require(_0xfb06('0x0'));var md5=require(_0xfb06('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xfb06('0x2'));config[_0xfb06('0x3')]=_[_0xfb06('0x4')](config['redis'],{'host':_0xfb06('0x5'),'port':0x18eb});var io=require(_0xfb06('0x6'))(new Redis(config['redis']));function MailQueue(_0x42958a){this['id']=_0x42958a['id']||0x0;this['name']=_0x42958a[_0xfb06('0x7')]||'';this[_0xfb06('0x8')]=_0x42958a['timeout']||0xa;this[_0xfb06('0x9')]=_0x42958a[_0xfb06('0x9')]||_0xfb06('0xa');this[_0xfb06('0xb')]=_0x42958a[_0xfb06('0xb')];this[_0xfb06('0xc')]={};this[_0xfb06('0xd')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}MailQueue['prototype'][_0xfb06('0xe')]=function(){var _0x4d0916=this[_0xfb06('0xc')]['_rr'];this['mapAgentsId']=_[_0xfb06('0xf')](this[_0xfb06('0xb')],'id');this[_0xfb06('0xc')]['_rr']=_0x4d0916;};MailQueue[_0xfb06('0x10')]['updateRealtime']=function(){this[_0xfb06('0x11')]=0x0;this[_0xfb06('0x12')]=0x0;for(var _0x8562d=0x0;_0x8562d=0x0?this[_0xfb06('0x16')]:0x0;var _0x130285={'id':this['id'],'available':this[_0xfb06('0x16')],'loggedIn':this[_0xfb06('0x11')],'name':this[_0xfb06('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x3b7bef=md5(JSON[_0xfb06('0x17')](_0x130285));if(this[_0xfb06('0x1')]!==_0x3b7bef){this[_0xfb06('0x1')]=_0x3b7bef;io['to'](util[_0xfb06('0x18')](_0xfb06('0x19'),_0x130285[_0xfb06('0x7')]))[_0xfb06('0x1a')](_0xfb06('0x1b'),_0x130285);}};module[_0xfb06('0x1c')]=MailQueue; \ No newline at end of file +var _0xe62a=['available','stringify','format','emit','mail_queue:save','md5','../../../config/environment','redis','defaults','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','prototype','_rr','loggedIn','paused','Agents','length','online','mailPause'];(function(_0x31ca4e,_0x17480f){var _0x14a87a=function(_0x4a730a){while(--_0x4a730a){_0x31ca4e['push'](_0x31ca4e['shift']());}};_0x14a87a(++_0x17480f);}(_0xe62a,0x7d));var _0xae62=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe62a[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var md5=require(_0xae62('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0xae62('0x1'));config[_0xae62('0x2')]=_[_0xae62('0x3')](config[_0xae62('0x2')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x137f02){this['id']=_0x137f02['id']||0x0;this['name']=_0x137f02[_0xae62('0x4')]||'';this[_0xae62('0x5')]=_0x137f02[_0xae62('0x5')]||0xa;this[_0xae62('0x6')]=_0x137f02[_0xae62('0x6')]||_0xae62('0x7');this['Agents']=_0x137f02['Agents'];this[_0xae62('0x8')]={};this[_0xae62('0x9')]=0x0;this[_0xae62('0x0')]='';this[_0xae62('0xa')]();this['updateRealtime']();}MailQueue[_0xae62('0xb')]['updateRouting']=function(){var _0xa8dbf9=this[_0xae62('0x8')]['_rr'];this[_0xae62('0x8')]=_['map'](this['Agents'],'id');this[_0xae62('0x8')][_0xae62('0xc')]=_0xa8dbf9;};MailQueue[_0xae62('0xb')]['updateRealtime']=function(){this[_0xae62('0xd')]=0x0;this[_0xae62('0xe')]=0x0;for(var _0x18d6cb=0x0;_0x18d6cb=0x0?this[_0xae62('0x13')]:0x0;var _0x44741c={'id':this['id'],'available':this[_0xae62('0x13')],'loggedIn':this[_0xae62('0xd')],'name':this['name'],'paused':this[_0xae62('0xe')],'waiting':this[_0xae62('0x9')]};var _0x3ac08d=md5(JSON[_0xae62('0x14')](_0x44741c));if(this[_0xae62('0x0')]!==_0x3ac08d){this[_0xae62('0x0')]=_0x3ac08d;io['to'](util[_0xae62('0x15')]('mail:queue:%s',_0x44741c[_0xae62('0x4')]))[_0xae62('0x16')](_0xae62('0x17'),_0x44741c);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index e5e4f8b..ab73fb9 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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x138a35,_0x2f3893){var _0x5915e3=function(_0x6b7376){while(--_0x6b7376){_0x138a35['push'](_0x138a35['shift']());}};_0x5915e3(++_0x2f3893);}(_0x814b,0x1a2));var _0xb814=function(_0x1fd441,_0x2629bf){_0x1fd441=_0x1fd441-0x0;var _0x411a91=_0x814b[_0x1fd441];return _0x411a91;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x7a54,0x106));var _0x47a5=function(_0x5ef290,_0x42f1ef){_0x5ef290=_0x5ef290-0x0;var _0x3f5de4=_0x7a54[_0x5ef290];return _0x3f5de4;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index fca5323..0ba11d0 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 _0x4876=['Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','paused','length','loggedIn','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','util','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x4032a0,_0x107007){var _0x79541e=function(_0x3fbd7f){while(--_0x3fbd7f){_0x4032a0['push'](_0x4032a0['shift']());}};_0x79541e(++_0x107007);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x6487('0x0'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x6487('0x1')]=_['defaults'](config[_0x6487('0x1')],{'host':_0x6487('0x2'),'port':0x18eb});var io=require(_0x6487('0x3'))(new Redis(config[_0x6487('0x1')]));function SmsQueue(_0x57d99d){this['id']=_0x57d99d['id']||0x0;this[_0x6487('0x4')]=_0x57d99d[_0x6487('0x4')]||'';this['timeout']=_0x57d99d[_0x6487('0x5')]||0xa;this[_0x6487('0x6')]=_0x57d99d[_0x6487('0x6')]||_0x6487('0x7');this[_0x6487('0x8')]=_0x57d99d[_0x6487('0x8')];this[_0x6487('0x9')]={};this[_0x6487('0xa')]=0x0;this[_0x6487('0xb')]='';this['updateRouting']();this[_0x6487('0xc')]();}SmsQueue[_0x6487('0xd')][_0x6487('0xe')]=function(){var _0x2ba8ce=this[_0x6487('0x9')][_0x6487('0xf')];this[_0x6487('0x9')]=_[_0x6487('0x10')](this['Agents'],'id');this[_0x6487('0x9')][_0x6487('0xf')]=_0x2ba8ce;};SmsQueue[_0x6487('0xd')][_0x6487('0xc')]=function(){this['loggedIn']=0x0;this[_0x6487('0x11')]=0x0;for(var _0x10f2e1=0x0;_0x10f2e1=0x0?this['available']:0x0;var _0x4cedf9={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6487('0x13')],'name':this[_0x6487('0x4')],'paused':this[_0x6487('0x11')],'waiting':this[_0x6487('0xa')]};var _0x30abdc=md5(JSON[_0x6487('0x16')](_0x4cedf9));if(this[_0x6487('0xb')]!==_0x30abdc){this[_0x6487('0xb')]=_0x30abdc;io['to'](util[_0x6487('0x17')](_0x6487('0x18'),_0x4cedf9[_0x6487('0x4')]))[_0x6487('0x19')](_0x6487('0x1a'),_0x4cedf9);}};module[_0x6487('0x1b')]=SmsQueue; \ No newline at end of file +var _0x7a72=['mapAgentsId','updateRouting','updateRealtime','_rr','prototype','loggedIn','smsPause','paused','available','waiting','stringify','format','sms_queue:save','exports','md5','util','../../../config/environment','defaults','localhost','redis','name','strategy','beepall','Agents'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7a72,0x1be));var _0x27a7=function(_0x4a0166,_0x45ef70){_0x4a0166=_0x4a0166-0x0;var _0x17597c=_0x7a72[_0x4a0166];return _0x17597c;};'use strict';var _=require('lodash');var md5=require(_0x27a7('0x0'));var util=require(_0x27a7('0x1'));var Redis=require('ioredis');var config=require(_0x27a7('0x2'));config['redis']=_[_0x27a7('0x3')](config['redis'],{'host':_0x27a7('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x27a7('0x5')]));function SmsQueue(_0x5e56ac){this['id']=_0x5e56ac['id']||0x0;this[_0x27a7('0x6')]=_0x5e56ac[_0x27a7('0x6')]||'';this['timeout']=_0x5e56ac['timeout']||0xa;this[_0x27a7('0x7')]=_0x5e56ac['strategy']||_0x27a7('0x8');this[_0x27a7('0x9')]=_0x5e56ac[_0x27a7('0x9')];this[_0x27a7('0xa')]={};this['waiting']=0x0;this[_0x27a7('0x0')]='';this[_0x27a7('0xb')]();this[_0x27a7('0xc')]();}SmsQueue['prototype'][_0x27a7('0xb')]=function(){var _0x38a600=this['mapAgentsId'][_0x27a7('0xd')];this[_0x27a7('0xa')]=_['map'](this[_0x27a7('0x9')],'id');this[_0x27a7('0xa')][_0x27a7('0xd')]=_0x38a600;};SmsQueue[_0x27a7('0xe')][_0x27a7('0xc')]=function(){this[_0x27a7('0xf')]=0x0;this['paused']=0x0;for(var _0x4d3bfb=0x0;_0x4d3bfb=0x0?this[_0x27a7('0x12')]:0x0;var _0x2c82ab={'id':this['id'],'available':this[_0x27a7('0x12')],'loggedIn':this[_0x27a7('0xf')],'name':this[_0x27a7('0x6')],'paused':this['paused'],'waiting':this[_0x27a7('0x13')]};var _0x51253d=md5(JSON[_0x27a7('0x14')](_0x2c82ab));if(this[_0x27a7('0x0')]!==_0x51253d){this['md5']=_0x51253d;io['to'](util[_0x27a7('0x15')]('sms:queue:%s',_0x2c82ab[_0x27a7('0x6')]))['emit'](_0x27a7('0x16'),_0x2c82ab);}};module[_0x27a7('0x17')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 2a7a2f6..f7a9f38 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 _0xa528=['md5','updateRouting','prototype','_rr','paused','loggedIn','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x52622e,_0x1a20d4){var _0x472864=function(_0x6a276a){while(--_0x6a276a){_0x52622e['push'](_0x52622e['shift']());}};_0x472864(++_0x1a20d4);}(_0xa528,0x15b));var _0x8a52=function(_0x56f6c0,_0x37c097){_0x56f6c0=_0x56f6c0-0x0;var _0x249342=_0xa528[_0x56f6c0];return _0x249342;};'use strict';var _=require(_0x8a52('0x0'));var md5=require('md5');var util=require(_0x8a52('0x1'));var Redis=require(_0x8a52('0x2'));var config=require(_0x8a52('0x3'));config[_0x8a52('0x4')]=_['defaults'](config['redis'],{'host':_0x8a52('0x5'),'port':0x18eb});var io=require(_0x8a52('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x1f5f8e){this['id']=_0x1f5f8e['id']||0x0;this[_0x8a52('0x7')]=_0x1f5f8e['name']||'';this[_0x8a52('0x8')]=_0x1f5f8e[_0x8a52('0x8')]||0xa;this[_0x8a52('0x9')]=_0x1f5f8e[_0x8a52('0x9')]||_0x8a52('0xa');this[_0x8a52('0xb')]=_0x1f5f8e[_0x8a52('0xb')];this[_0x8a52('0xc')]={};this['waiting']=0x0;this[_0x8a52('0xd')]='';this[_0x8a52('0xe')]();this['updateRealtime']();}WhatsappQueue[_0x8a52('0xf')][_0x8a52('0xe')]=function(){var _0x29d91b=this[_0x8a52('0xc')]['_rr'];this[_0x8a52('0xc')]=_['map'](this['Agents'],'id');this[_0x8a52('0xc')][_0x8a52('0x10')]=_0x29d91b;};WhatsappQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x8a52('0x11')]=0x0;for(var _0x29458e=0x0;_0x29458e=0x0?this[_0x8a52('0x13')]:0x0;var _0x8f2c53={'id':this['id'],'available':this[_0x8a52('0x13')],'loggedIn':this[_0x8a52('0x12')],'name':this[_0x8a52('0x7')],'paused':this[_0x8a52('0x11')],'waiting':this['waiting']};var _0x336966=md5(JSON['stringify'](_0x8f2c53));if(this[_0x8a52('0xd')]!==_0x336966){this[_0x8a52('0xd')]=_0x336966;io['to'](util[_0x8a52('0x14')](_0x8a52('0x15'),_0x8f2c53[_0x8a52('0x7')]))[_0x8a52('0x16')](_0x8a52('0x17'),_0x8f2c53);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x639d=['map','prototype','loggedIn','paused','whatsappPause','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','util','ioredis','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','_rr'];(function(_0x565fed,_0xb85768){var _0x3e018f=function(_0x104d8e){while(--_0x104d8e){_0x565fed['push'](_0x565fed['shift']());}};_0x3e018f(++_0xb85768);}(_0x639d,0xe2));var _0xd639=function(_0x418c9f,_0x3d7034){_0x418c9f=_0x418c9f-0x0;var _0xdb149c=_0x639d[_0x418c9f];return _0xdb149c;};'use strict';var _=require(_0xd639('0x0'));var md5=require('md5');var util=require(_0xd639('0x1'));var Redis=require(_0xd639('0x2'));var config=require('../../../config/environment');config[_0xd639('0x3')]=_[_0xd639('0x4')](config[_0xd639('0x3')],{'host':_0xd639('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x379eec){this['id']=_0x379eec['id']||0x0;this[_0xd639('0x6')]=_0x379eec[_0xd639('0x6')]||'';this[_0xd639('0x7')]=_0x379eec[_0xd639('0x7')]||0xa;this[_0xd639('0x8')]=_0x379eec['strategy']||_0xd639('0x9');this[_0xd639('0xa')]=_0x379eec[_0xd639('0xa')];this[_0xd639('0xb')]={};this[_0xd639('0xc')]=0x0;this[_0xd639('0xd')]='';this[_0xd639('0xe')]();this[_0xd639('0xf')]();}WhatsappQueue['prototype'][_0xd639('0xe')]=function(){var _0x15d5c9=this[_0xd639('0xb')][_0xd639('0x10')];this['mapAgentsId']=_[_0xd639('0x11')](this[_0xd639('0xa')],'id');this['mapAgentsId'][_0xd639('0x10')]=_0x15d5c9;};WhatsappQueue[_0xd639('0x12')]['updateRealtime']=function(){this[_0xd639('0x13')]=0x0;this[_0xd639('0x14')]=0x0;for(var _0x670d39=0x0;_0x670d39=0x0?this[_0xd639('0x16')]:0x0;var _0xd4890d={'id':this['id'],'available':this[_0xd639('0x16')],'loggedIn':this[_0xd639('0x13')],'name':this[_0xd639('0x6')],'paused':this[_0xd639('0x14')],'waiting':this[_0xd639('0xc')]};var _0x5df29b=md5(JSON['stringify'](_0xd4890d));if(this['md5']!==_0x5df29b){this[_0xd639('0xd')]=_0x5df29b;io['to'](util[_0xd639('0x17')](_0xd639('0x18'),_0xd4890d[_0xd639('0x6')]))[_0xd639('0x19')](_0xd639('0x1a'),_0xd4890d);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 09da98c..2e7c450 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 _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x3afc49,_0x48130e){var _0x232a77=function(_0x46e919){while(--_0x46e919){_0x3afc49['push'](_0x3afc49['shift']());}};_0x232a77(++_0x48130e);}(_0xb10b,0x12a));var _0xbb10=function(_0x10d52b,_0xc6a4f1){_0x10d52b=_0x10d52b-0x0;var _0x2bf44a=_0xb10b[_0x10d52b];return _0x2bf44a;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index d26f800..375ed4c 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 _0x6555=['UpdateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request'];(function(_0x40414e,_0x1d03b1){var _0x5b39a7=function(_0x46d93b){while(--_0x46d93b){_0x40414e['push'](_0x40414e['shift']());}};_0x5b39a7(++_0x1d03b1);}(_0x6555,0x1ae));var _0x5655=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x6555[_0x40a045];return _0x1a687c;};'use strict';var client=require(_0x5655('0x0'));exports['update']=function(_0x1dbdc4,_0x4340a8){return client[_0x5655('0x1')](_0x5655('0x2'),{'body':_0x4340a8,'options':{'where':{'id':_0x1dbdc4}},'log':'updateChatInteraction'});};exports[_0x5655('0x3')]=function(_0x2ab59c,_0x44de57){return client[_0x5655('0x1')](_0x5655('0x4'),{'body':_0x44de57,'options':{'where':{'id':_0x2ab59c}},'log':_0x5655('0x5')});}; \ No newline at end of file +var _0x2aa8=['../client','update','Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x272d90,_0x5e70ff){var _0x2bf4a2=function(_0x544da6){while(--_0x544da6){_0x272d90['push'](_0x272d90['shift']());}};_0x2bf4a2(++_0x5e70ff);}(_0x2aa8,0x16e));var _0x82aa=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2aa8[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x82aa('0x0'));exports[_0x82aa('0x1')]=function(_0x5986b8,_0x5a86d4){return client[_0x82aa('0x2')](_0x82aa('0x3'),{'body':_0x5a86d4,'options':{'where':{'id':_0x5986b8}},'log':'updateChatInteraction'});};exports[_0x82aa('0x4')]=function(_0x235c90,_0xc85f45){return client['Request'](_0x82aa('0x5'),{'body':_0xc85f45,'options':{'where':{'id':_0x235c90}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index a444080..4697718 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 _0xb622=['Request','CreateChatMessage','createChatMessage','create'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xb622,0x1e7));var _0x2b62=function(_0x431e19,_0x1ce74f){_0x431e19=_0x431e19-0x0;var _0x25f604=_0xb622[_0x431e19];return _0x25f604;};'use strict';var client=require('../client');exports[_0x2b62('0x0')]=function(_0x317a56){return client[_0x2b62('0x1')](_0x2b62('0x2'),{'body':_0x317a56,'log':_0x2b62('0x3')});}; \ No newline at end of file +var _0x3b45=['create','Request','../client'];(function(_0x4d5721,_0x51a33d){var _0x88a224=function(_0x2b2609){while(--_0x2b2609){_0x4d5721['push'](_0x4d5721['shift']());}};_0x88a224(++_0x51a33d);}(_0x3b45,0x1af));var _0x53b4=function(_0xb9ff6b,_0x6359af){_0xb9ff6b=_0xb9ff6b-0x0;var _0x111246=_0x3b45[_0xb9ff6b];return _0x111246;};'use strict';var client=require(_0x53b4('0x0'));exports[_0x53b4('0x1')]=function(_0x506a99){return client[_0x53b4('0x2')]('CreateChatMessage',{'body':_0x506a99,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 1aca405..df40068 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 _0xea03=['getChatQueues','../client','Request','GetChatQueue','name','timeout','strategy','online','chatPause'];(function(_0x3000dc,_0x18bea3){var _0x445cda=function(_0x48b9a7){while(--_0x48b9a7){_0x3000dc['push'](_0x3000dc['shift']());}};_0x445cda(++_0x18bea3);}(_0xea03,0x1ba));var _0x3ea0=function(_0x411e5d,_0x450c00){_0x411e5d=_0x411e5d-0x0;var _0x58298=_0xea03[_0x411e5d];return _0x58298;};'use strict';var client=require(_0x3ea0('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x3ea0('0x1')](_0x3ea0('0x2'),{'options':{'raw':![],'attributes':['id',_0x3ea0('0x3'),_0x3ea0('0x4'),_0x3ea0('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x3ea0('0x6'),_0x3ea0('0x7')]}]},'log':_0x3ea0('0x8')});};}; \ No newline at end of file +var _0xbd50=['Request','name','timeout','strategy','User','Agents','../client','getChatQueues'];(function(_0x1dae94,_0x239003){var _0x36ce2d=function(_0x295f18){while(--_0x295f18){_0x1dae94['push'](_0x1dae94['shift']());}};_0x36ce2d(++_0x239003);}(_0xbd50,0x196));var _0x0bd5=function(_0x2b370d,_0xe627cb){_0x2b370d=_0x2b370d-0x0;var _0x49eb69=_0xbd50[_0x2b370d];return _0x49eb69;};'use strict';var client=require(_0x0bd5('0x0'));exports[_0x0bd5('0x1')]=function(){return function(){return client[_0x0bd5('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x0bd5('0x3'),_0x0bd5('0x4'),_0x0bd5('0x5')],'include':[{'model':_0x0bd5('0x6'),'as':_0x0bd5('0x7'),'attributes':['id','name','online','chatPause']}]},'log':_0x0bd5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index c677801..54476fc 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 _0x919e=['Request','UpdateChatQueueReport','DESC','../client','create','CreateChatQueueReport'];(function(_0x4f1d8f,_0x2c2d01){var _0x101bcb=function(_0xf440e0){while(--_0xf440e0){_0x4f1d8f['push'](_0x4f1d8f['shift']());}};_0x101bcb(++_0x2c2d01);}(_0x919e,0x1d7));var _0xe919=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x919e[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xe919('0x0'));exports[_0xe919('0x1')]=function(_0x24d2f4){return client['Request'](_0xe919('0x2'),{'body':_0x24d2f4,'log':'CreateChatQueueReport'});};exports['update']=function(_0x455cff,_0x3a1192){return client[_0xe919('0x3')](_0xe919('0x4'),{'body':_0x3a1192,'options':{'where':{'uniqueid':_0x455cff},'order':[['id',_0xe919('0x5')]],'limit':0x1},'log':_0xe919('0x4')});}; \ No newline at end of file +var _0xf3cd=['DESC','UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport'];(function(_0x241bd6,_0x64179){var _0x2bac40=function(_0x2da19f){while(--_0x2da19f){_0x241bd6['push'](_0x241bd6['shift']());}};_0x2bac40(++_0x64179);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x55de53,_0x5da3e7){_0x55de53=_0x55de53-0x0;var _0x362fbe=_0xf3cd[_0x55de53];return _0x362fbe;};'use strict';var client=require(_0xdf3c('0x0'));exports[_0xdf3c('0x1')]=function(_0x31e5a5){return client[_0xdf3c('0x2')](_0xdf3c('0x3'),{'body':_0x31e5a5,'log':_0xdf3c('0x3')});};exports['update']=function(_0x401518,_0x71b446){return client[_0xdf3c('0x2')]('UpdateChatQueueReport',{'body':_0x71b446,'options':{'where':{'uniqueid':_0x401518},'order':[['id',_0xdf3c('0x4')]],'limit':0x1},'log':_0xdf3c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index fa04580..0fdbf6f 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x7275e9,_0x321fa5){var _0x17b99d=function(_0x54af41){while(--_0x54af41){_0x7275e9['push'](_0x7275e9['shift']());}};_0x17b99d(++_0x321fa5);}(_0x7a54,0x106));var _0x47a5=function(_0x34a9d8,_0x2afc30){_0x34a9d8=_0x34a9d8-0x0;var _0x15e518=_0x7a54[_0x34a9d8];return _0x15e518;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x5302fc,_0x2b2002){var _0x10bc8c=function(_0x51c235){while(--_0x51c235){_0x5302fc['push'](_0x5302fc['shift']());}};_0x10bc8c(++_0x2b2002);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 70818e2..ca62961 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 _0xd0df=['CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x259565,_0x37cfb1){var _0x451965=function(_0x5d66cb){while(--_0x5d66cb){_0x259565['push'](_0x259565['shift']());}};_0x451965(++_0x37cfb1);}(_0xd0df,0x1a6));var _0xfd0d=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0xd0df[_0x15c421];return _0x5e5ed5;};'use strict';var client=require(_0xfd0d('0x0'));exports[_0xfd0d('0x1')]=function(_0x30e2f4){return client['Request'](_0xfd0d('0x2'),{'body':_0x30e2f4,'log':_0xfd0d('0x3')});}; \ No newline at end of file +var _0x2256=['CreateFaxMessage','../client','Request'];(function(_0x517fac,_0x19e44c){var _0x54b8f8=function(_0x261b42){while(--_0x261b42){_0x517fac['push'](_0x517fac['shift']());}};_0x54b8f8(++_0x19e44c);}(_0x2256,0x1b7));var _0x6225=function(_0x59a470,_0x2cd4a0){_0x59a470=_0x59a470-0x0;var _0x39a8f0=_0x2256[_0x59a470];return _0x39a8f0;};'use strict';var client=require(_0x6225('0x0'));exports['create']=function(_0x4a4f21){return client[_0x6225('0x1')](_0x6225('0x2'),{'body':_0x4a4f21,'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 0bb0c14..371a98f 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 _0x08ed=['User','Agents','online','faxPause','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x08ed,0xfe));var _0xd08e=function(_0x264d4d,_0x118fb5){_0x264d4d=_0x264d4d-0x0;var _0xc917e2=_0x08ed[_0x264d4d];return _0xc917e2;};'use strict';var client=require('../client');exports[_0xd08e('0x0')]=function(){return function(){return client[_0xd08e('0x1')](_0xd08e('0x2'),{'options':{'raw':![],'attributes':['id',_0xd08e('0x3'),_0xd08e('0x4'),_0xd08e('0x5')],'include':[{'model':_0xd08e('0x6'),'as':_0xd08e('0x7'),'attributes':['id',_0xd08e('0x3'),_0xd08e('0x8'),_0xd08e('0x9')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x86b0=['GetFaxQueue','name','timeout','strategy','User','Agents','online','faxPause','../client','getFaxQueues'];(function(_0x20b421,_0x21eda0){var _0x2b497e=function(_0x342b81){while(--_0x342b81){_0x20b421['push'](_0x20b421['shift']());}};_0x2b497e(++_0x21eda0);}(_0x86b0,0x184));var _0x086b=function(_0x5a43ef,_0x2e64c0){_0x5a43ef=_0x5a43ef-0x0;var _0x3f19f6=_0x86b0[_0x5a43ef];return _0x3f19f6;};'use strict';var client=require(_0x086b('0x0'));exports[_0x086b('0x1')]=function(){return function(){return client['Request'](_0x086b('0x2'),{'options':{'raw':![],'attributes':['id',_0x086b('0x3'),_0x086b('0x4'),_0x086b('0x5')],'include':[{'model':_0x086b('0x6'),'as':_0x086b('0x7'),'attributes':['id',_0x086b('0x3'),_0x086b('0x8'),_0x086b('0x9')]}]},'log':_0x086b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index db4093f..b925fb9 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 _0x67c9=['DESC','UpdateFaxQueueReport','Request','CreateFaxQueueReport'];(function(_0x1a190a,_0x1b665f){var _0x5b775c=function(_0x1bb272){while(--_0x1bb272){_0x1a190a['push'](_0x1a190a['shift']());}};_0x5b775c(++_0x1b665f);}(_0x67c9,0x146));var _0x967c=function(_0x39caaa,_0x1f37bc){_0x39caaa=_0x39caaa-0x0;var _0x9b9c7d=_0x67c9[_0x39caaa];return _0x9b9c7d;};'use strict';var client=require('../client');exports['create']=function(_0x2db398){return client[_0x967c('0x0')](_0x967c('0x1'),{'body':_0x2db398,'log':_0x967c('0x1')});};exports['update']=function(_0x30e76a,_0x6fdeb5){return client[_0x967c('0x0')]('UpdateFaxQueueReport',{'body':_0x6fdeb5,'options':{'where':{'uniqueid':_0x30e76a},'order':[['id',_0x967c('0x2')]],'limit':0x1},'log':_0x967c('0x3')});}; \ No newline at end of file +var _0xe9ab=['CreateFaxQueueReport','UpdateFaxQueueReport','../client'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe9ab,0x80));var _0xbe9a=function(_0x29bd12,_0x402731){_0x29bd12=_0x29bd12-0x0;var _0x4171f6=_0xe9ab[_0x29bd12];return _0x4171f6;};'use strict';var client=require(_0xbe9a('0x0'));exports['create']=function(_0x347f2b){return client['Request'](_0xbe9a('0x1'),{'body':_0x347f2b,'log':_0xbe9a('0x1')});};exports['update']=function(_0x192188,_0x32af39){return client['Request']('UpdateFaxQueueReport',{'body':_0x32af39,'options':{'where':{'uniqueid':_0x192188},'order':[['id','DESC']],'limit':0x1},'log':_0xbe9a('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 05a040a..fbd2746 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 _0x0244=['Request','GetInterval','name','Intervals','getIntervals'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0244,0x1da));var _0x4024=function(_0x4ab32c,_0x44ab5e){_0x4ab32c=_0x4ab32c-0x0;var _0x2b9644=_0x0244[_0x4ab32c];return _0x2b9644;};'use strict';var client=require('../client');exports[_0x4024('0x0')]=function(){return function(){return client[_0x4024('0x1')](_0x4024('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x4024('0x3')],'include':[{'model':'Interval','as':_0x4024('0x4'),'attributes':['id',_0x4024('0x3'),'interval']}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x22ef=['GetInterval','name','Interval','Intervals','interval','../client','getIntervals','Request'];(function(_0x35d43a,_0x135321){var _0x30f344=function(_0x501c57){while(--_0x501c57){_0x35d43a['push'](_0x35d43a['shift']());}};_0x30f344(++_0x135321);}(_0x22ef,0x85));var _0xf22e=function(_0x14040d,_0x38ee52){_0x14040d=_0x14040d-0x0;var _0x27fe95=_0x22ef[_0x14040d];return _0x27fe95;};'use strict';var client=require(_0xf22e('0x0'));exports[_0xf22e('0x1')]=function(){return function(){return client[_0xf22e('0x2')](_0xf22e('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xf22e('0x4')],'include':[{'model':_0xf22e('0x5'),'as':_0xf22e('0x6'),'attributes':['id',_0xf22e('0x4'),_0xf22e('0x7')]}]},'log':_0xf22e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 8026e53..3617d93 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 _0x14a0=['AddTagsToMailInteraction','addTagsToChatInteraction','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x5dde44,_0x476e71){var _0x5864bd=function(_0x37258d){while(--_0x37258d){_0x5dde44['push'](_0x5dde44['shift']());}};_0x5864bd(++_0x476e71);}(_0x14a0,0x8e));var _0x014a=function(_0x36b791,_0x1f0739){_0x36b791=_0x36b791-0x0;var _0x5b1604=_0x14a0[_0x36b791];return _0x5b1604;};'use strict';var client=require('../client');exports[_0x014a('0x0')]=function(_0x451138,_0x4144ed){return client[_0x014a('0x1')](_0x014a('0x2'),{'body':_0x4144ed,'options':{'where':{'id':_0x451138}},'log':_0x014a('0x3')});};exports[_0x014a('0x4')]=function(_0x521a59,_0x57a522){return client[_0x014a('0x1')](_0x014a('0x5'),{'body':_0x57a522,'options':{'where':{'id':_0x521a59}},'log':_0x014a('0x6')});}; \ No newline at end of file +var _0x02ce=['addTagsToChatInteraction','../client','update','Request','updateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x5af7cb,_0x20b138){var _0xdf180c=function(_0x4f32d6){while(--_0x4f32d6){_0x5af7cb['push'](_0x5af7cb['shift']());}};_0xdf180c(++_0x20b138);}(_0x02ce,0x1ac));var _0xe02c=function(_0x3a237a,_0x56111c){_0x3a237a=_0x3a237a-0x0;var _0x38c454=_0x02ce[_0x3a237a];return _0x38c454;};'use strict';var client=require(_0xe02c('0x0'));exports[_0xe02c('0x1')]=function(_0x3f9bc7,_0x5a49d9){return client[_0xe02c('0x2')]('UpdateMailInteraction',{'body':_0x5a49d9,'options':{'where':{'id':_0x3f9bc7}},'log':_0xe02c('0x3')});};exports[_0xe02c('0x4')]=function(_0x46475c,_0xf4b764){return client[_0xe02c('0x2')](_0xe02c('0x5'),{'body':_0xf4b764,'options':{'where':{'id':_0x46475c}},'log':_0xe02c('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index bbc0b8e..061a077 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 _0x04d8=['create','Request','CreateMailMessage'];(function(_0x2470fe,_0x2bde8a){var _0x53e877=function(_0x11a67d){while(--_0x11a67d){_0x2470fe['push'](_0x2470fe['shift']());}};_0x53e877(++_0x2bde8a);}(_0x04d8,0x135));var _0x804d=function(_0x8dc04d,_0xaa7559){_0x8dc04d=_0x8dc04d-0x0;var _0x2f5f28=_0x04d8[_0x8dc04d];return _0x2f5f28;};'use strict';var client=require('../client');exports[_0x804d('0x0')]=function(_0x40a21b){return client[_0x804d('0x1')](_0x804d('0x2'),{'body':_0x40a21b,'log':'createMailMessage'});}; \ No newline at end of file +var _0xeebf=['CreateMailMessage','Request'];(function(_0x427847,_0x54eb07){var _0x3bf8fc=function(_0x61f63d){while(--_0x61f63d){_0x427847['push'](_0x427847['shift']());}};_0x3bf8fc(++_0x54eb07);}(_0xeebf,0x6f));var _0xfeeb=function(_0x6ba53a,_0x29277a){_0x6ba53a=_0x6ba53a-0x0;var _0x2842ca=_0xeebf[_0x6ba53a];return _0x2842ca;};'use strict';var client=require('../client');exports['create']=function(_0x194cc5){return client[_0xfeeb('0x0')](_0xfeeb('0x1'),{'body':_0x194cc5,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index cae5c46..6cbfb2c 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 _0xee7e=['timeout','strategy','User','online','mailPause','../client','getMailQueues','Request','name'];(function(_0x1d71dc,_0x3739d5){var _0x5d8a47=function(_0x4d2bf3){while(--_0x4d2bf3){_0x1d71dc['push'](_0x1d71dc['shift']());}};_0x5d8a47(++_0x3739d5);}(_0xee7e,0x191));var _0xeee7=function(_0x3c07f4,_0x6ad742){_0x3c07f4=_0x3c07f4-0x0;var _0x1f77c1=_0xee7e[_0x3c07f4];return _0x1f77c1;};'use strict';var client=require(_0xeee7('0x0'));exports[_0xeee7('0x1')]=function(){return function(){return client[_0xeee7('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xeee7('0x3'),_0xeee7('0x4'),_0xeee7('0x5')],'include':[{'model':_0xeee7('0x6'),'as':'Agents','attributes':['id',_0xeee7('0x3'),_0xeee7('0x7'),_0xeee7('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x85a7=['timeout','strategy','Agents','name','online','../client','getMailQueues','Request','GetMailQueue'];(function(_0x3d92c7,_0x200ba5){var _0x59126f=function(_0x52cda6){while(--_0x52cda6){_0x3d92c7['push'](_0x3d92c7['shift']());}};_0x59126f(++_0x200ba5);}(_0x85a7,0xa7));var _0x785a=function(_0x3c49e1,_0x4c2a19){_0x3c49e1=_0x3c49e1-0x0;var _0x5bdd14=_0x85a7[_0x3c49e1];return _0x5bdd14;};'use strict';var client=require(_0x785a('0x0'));exports[_0x785a('0x1')]=function(){return function(){return client[_0x785a('0x2')](_0x785a('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x785a('0x4'),_0x785a('0x5')],'include':[{'model':'User','as':_0x785a('0x6'),'attributes':['id',_0x785a('0x7'),_0x785a('0x8'),'mailPause']}]},'log':_0x785a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 748a64e..a619430 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 _0xf8e5=['CreateMailQueueReport','UpdateMailQueueReport','DESC','../client'];(function(_0x460d91,_0x56a01b){var _0x39484b=function(_0x59ccc4){while(--_0x59ccc4){_0x460d91['push'](_0x460d91['shift']());}};_0x39484b(++_0x56a01b);}(_0xf8e5,0x1a7));var _0x5f8e=function(_0x4a86d9,_0xbf3a0f){_0x4a86d9=_0x4a86d9-0x0;var _0x34ea74=_0xf8e5[_0x4a86d9];return _0x34ea74;};'use strict';var client=require(_0x5f8e('0x0'));exports['create']=function(_0x4a7961){return client['Request'](_0x5f8e('0x1'),{'body':_0x4a7961,'log':_0x5f8e('0x1')});};exports['update']=function(_0x1a072f,_0x39eb52){return client['Request'](_0x5f8e('0x2'),{'body':_0x39eb52,'options':{'where':{'uniqueid':_0x1a072f},'order':[['id',_0x5f8e('0x3')]],'limit':0x1},'log':_0x5f8e('0x2')});}; \ No newline at end of file +var _0xec6c=['../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0xcad254,_0x31c9e4){var _0x5e76b0=function(_0x3b6668){while(--_0x3b6668){_0xcad254['push'](_0xcad254['shift']());}};_0x5e76b0(++_0x31c9e4);}(_0xec6c,0x1da));var _0xcec6=function(_0x54551e,_0x429370){_0x54551e=_0x54551e-0x0;var _0x1d6913=_0xec6c[_0x54551e];return _0x1d6913;};'use strict';var client=require(_0xcec6('0x0'));exports[_0xcec6('0x1')]=function(_0x456b37){return client[_0xcec6('0x2')](_0xcec6('0x3'),{'body':_0x456b37,'log':_0xcec6('0x3')});};exports[_0xcec6('0x4')]=function(_0x13b821,_0x2ab1b1){return client[_0xcec6('0x2')](_0xcec6('0x5'),{'body':_0x2ab1b1,'options':{'where':{'uniqueid':_0x13b821},'order':[['id','DESC']],'limit':0x1},'log':_0xcec6('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 3e3a2d0..663f4c1 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 _0x8289=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTagsToChatInteraction','Request'];(function(_0x819131,_0x8ef508){var _0x54be13=function(_0x580854){while(--_0x580854){_0x819131['push'](_0x819131['shift']());}};_0x54be13(++_0x8ef508);}(_0x8289,0x12f));var _0x9828=function(_0x3ef1c8,_0x467a5d){_0x3ef1c8=_0x3ef1c8-0x0;var _0x4e25f4=_0x8289[_0x3ef1c8];return _0x4e25f4;};'use strict';var client=require('../client');exports['update']=function(_0x2f246e,_0x132161){return client[_0x9828('0x0')](_0x9828('0x1'),{'body':_0x132161,'options':{'where':{'id':_0x2f246e}},'log':_0x9828('0x2')});};exports['addTags']=function(_0x596dfc,_0x46676e){return client[_0x9828('0x0')]('AddTagsToOpenchannelInteraction',{'body':_0x46676e,'options':{'where':{'id':_0x596dfc}},'log':_0x9828('0x3')});}; \ No newline at end of file +var _0x6f68=['addTags','addTagsToChatInteraction','update','Request','updateOpenchannelInteraction'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6f68,0x12e));var _0x86f6=function(_0x17fdf5,_0x1ce706){_0x17fdf5=_0x17fdf5-0x0;var _0x2f0b0e=_0x6f68[_0x17fdf5];return _0x2f0b0e;};'use strict';var client=require('../client');exports[_0x86f6('0x0')]=function(_0x38dc90,_0x2c50ea){return client[_0x86f6('0x1')]('UpdateOpenchannelInteraction',{'body':_0x2c50ea,'options':{'where':{'id':_0x38dc90}},'log':_0x86f6('0x2')});};exports[_0x86f6('0x3')]=function(_0xdc302d,_0x4d2f7c){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x4d2f7c,'options':{'where':{'id':_0xdc302d}},'log':_0x86f6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index edcaed7..bf8acdd 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 _0x679b=['Request','createOpenchannelMessage','../client','create'];(function(_0x5d1c85,_0x3feff6){var _0x1abbb2=function(_0x236ee3){while(--_0x236ee3){_0x5d1c85['push'](_0x5d1c85['shift']());}};_0x1abbb2(++_0x3feff6);}(_0x679b,0x96));var _0xb679=function(_0x434be9,_0x4cc793){_0x434be9=_0x434be9-0x0;var _0x2b2116=_0x679b[_0x434be9];return _0x2b2116;};'use strict';var client=require(_0xb679('0x0'));exports[_0xb679('0x1')]=function(_0x13c268){return client[_0xb679('0x2')]('CreateOpenchannelMessage',{'body':_0x13c268,'log':_0xb679('0x3')});}; \ No newline at end of file +var _0x3d13=['CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x2dd9f5,_0xbf579){var _0x5140e2=function(_0x1e0d66){while(--_0x1e0d66){_0x2dd9f5['push'](_0x2dd9f5['shift']());}};_0x5140e2(++_0xbf579);}(_0x3d13,0x19c));var _0x33d1=function(_0x2d46ef,_0x5b56de){_0x2d46ef=_0x2d46ef-0x0;var _0x12fa0e=_0x3d13[_0x2d46ef];return _0x12fa0e;};'use strict';var client=require('../client');exports['create']=function(_0x5f1d2f){return client['Request'](_0x33d1('0x0'),{'body':_0x5f1d2f,'log':_0x33d1('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index ae5e3c0..b967a13 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 _0x1a41=['name','strategy','User','Agents','online','openchannelPause','getOpenchannelQueues','GetOpenchannelQueue'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x1a41,0x126));var _0x11a4=function(_0x4433f2,_0x53b6f7){_0x4433f2=_0x4433f2-0x0;var _0x2830a8=_0x1a41[_0x4433f2];return _0x2830a8;};'use strict';var client=require('../client');exports[_0x11a4('0x0')]=function(){return function(){return client['Request'](_0x11a4('0x1'),{'options':{'raw':![],'attributes':['id',_0x11a4('0x2'),'timeout',_0x11a4('0x3')],'include':[{'model':_0x11a4('0x4'),'as':_0x11a4('0x5'),'attributes':['id','name',_0x11a4('0x6'),_0x11a4('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xf440=['name','timeout','strategy','online','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x53e3fa,_0x50c5f2){var _0xe8584a=function(_0x1771a5){while(--_0x1771a5){_0x53e3fa['push'](_0x53e3fa['shift']());}};_0xe8584a(++_0x50c5f2);}(_0xf440,0x1ee));var _0x0f44=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xf440[_0x4b055c];return _0x4b62bb;};'use strict';var client=require('../client');exports[_0x0f44('0x0')]=function(){return function(){return client[_0x0f44('0x1')](_0x0f44('0x2'),{'options':{'raw':![],'attributes':['id',_0x0f44('0x3'),_0x0f44('0x4'),_0x0f44('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x0f44('0x3'),_0x0f44('0x6'),'openchannelPause']}]},'log':_0x0f44('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index b78873c..1933870 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 _0xcb0e=['create','Request','CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport','../client'];(function(_0x3ab353,_0x5d5283){var _0x1e2285=function(_0x55804f){while(--_0x55804f){_0x3ab353['push'](_0x3ab353['shift']());}};_0x1e2285(++_0x5d5283);}(_0xcb0e,0x76));var _0xecb0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcb0e[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xecb0('0x0'));exports[_0xecb0('0x1')]=function(_0x9729cb){return client[_0xecb0('0x2')](_0xecb0('0x3'),{'body':_0x9729cb,'log':_0xecb0('0x3')});};exports[_0xecb0('0x4')]=function(_0x307556,_0x24c10a){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x24c10a,'options':{'where':{'uniqueid':_0x307556},'order':[['id',_0xecb0('0x5')]],'limit':0x1},'log':_0xecb0('0x6')});}; \ No newline at end of file +var _0x2ab7=['UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x58cfae,_0x28e392){var _0x15d7c5=function(_0x261431){while(--_0x261431){_0x58cfae['push'](_0x58cfae['shift']());}};_0x15d7c5(++_0x28e392);}(_0x2ab7,0xe7));var _0x72ab=function(_0x4c5cd4,_0x268643){_0x4c5cd4=_0x4c5cd4-0x0;var _0x210bcf=_0x2ab7[_0x4c5cd4];return _0x210bcf;};'use strict';var client=require(_0x72ab('0x0'));exports[_0x72ab('0x1')]=function(_0x439a2b){return client[_0x72ab('0x2')](_0x72ab('0x3'),{'body':_0x439a2b,'log':_0x72ab('0x3')});};exports['update']=function(_0xee8e51,_0x7ca33){return client[_0x72ab('0x2')](_0x72ab('0x4'),{'body':_0x7ca33,'options':{'where':{'uniqueid':_0xee8e51},'order':[['id','DESC']],'limit':0x1},'log':_0x72ab('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 8b0a63a..ce9b023 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 _0xa630=['Request','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x1ca6cf,_0x5edc23){var _0x50c408=function(_0x5e130a){while(--_0x5e130a){_0x1ca6cf['push'](_0x1ca6cf['shift']());}};_0x50c408(++_0x5edc23);}(_0xa630,0xbe));var _0x0a63=function(_0x39d8c9,_0x4e6659){_0x39d8c9=_0x39d8c9-0x0;var _0x5a58bd=_0xa630[_0x39d8c9];return _0x5a58bd;};'use strict';var client=require(_0x0a63('0x0'));exports[_0x0a63('0x1')]=function(_0x51d2c0,_0x52ad93){return client[_0x0a63('0x2')]('UpdateSmsInteraction',{'body':_0x52ad93,'options':{'where':{'id':_0x51d2c0}},'log':_0x0a63('0x3')});};exports['addTags']=function(_0x91a747,_0x3bcb90){return client[_0x0a63('0x2')](_0x0a63('0x4'),{'body':_0x3bcb90,'options':{'where':{'id':_0x91a747}},'log':_0x0a63('0x5')});}; \ No newline at end of file +var _0x1e69=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x1e69,0x85));var _0x91e6=function(_0x5e8874,_0x134292){_0x5e8874=_0x5e8874-0x0;var _0x4bf1de=_0x1e69[_0x5e8874];return _0x4bf1de;};'use strict';var client=require('../client');exports[_0x91e6('0x0')]=function(_0x28561c,_0x6605eb){return client[_0x91e6('0x1')]('UpdateSmsInteraction',{'body':_0x6605eb,'options':{'where':{'id':_0x28561c}},'log':'updateSmsInteraction'});};exports[_0x91e6('0x2')]=function(_0x351c1d,_0x2b53b6){return client[_0x91e6('0x1')](_0x91e6('0x3'),{'body':_0x2b53b6,'options':{'where':{'id':_0x351c1d}},'log':_0x91e6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 6f0af0d..1167c42 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 _0x71f8=['createSmsMessage','../client','Request','CreateSmsMessage'];(function(_0x59145a,_0x1f60f1){var _0xf04d7=function(_0x247581){while(--_0x247581){_0x59145a['push'](_0x59145a['shift']());}};_0xf04d7(++_0x1f60f1);}(_0x71f8,0x16d));var _0x871f=function(_0x16a1f9,_0x356c7d){_0x16a1f9=_0x16a1f9-0x0;var _0x1000dd=_0x71f8[_0x16a1f9];return _0x1000dd;};'use strict';var client=require(_0x871f('0x0'));exports['create']=function(_0x99b295){return client[_0x871f('0x1')](_0x871f('0x2'),{'body':_0x99b295,'log':_0x871f('0x3')});}; \ No newline at end of file +var _0x8541=['create','Request','createSmsMessage','../client'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0x8541,0xb3));var _0x1854=function(_0x3c4b91,_0x55bdde){_0x3c4b91=_0x3c4b91-0x0;var _0x86e4c6=_0x8541[_0x3c4b91];return _0x86e4c6;};'use strict';var client=require(_0x1854('0x0'));exports[_0x1854('0x1')]=function(_0x1cb32a){return client[_0x1854('0x2')]('CreateSmsMessage',{'body':_0x1cb32a,'log':_0x1854('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index d9ac188..26ddc6f 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 _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x27d29a,_0x50861b){var _0x454456=function(_0x4747c0){while(--_0x4747c0){_0x27d29a['push'](_0x27d29a['shift']());}};_0x454456(++_0x50861b);}(_0xe706,0xa3));var _0x6e70=function(_0x49c68e,_0x1c1673){_0x49c68e=_0x49c68e-0x0;var _0x33032b=_0xe706[_0x49c68e];return _0x33032b;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0xbda505,_0x25a843){var _0x24b553=function(_0x9f1eb3){while(--_0x9f1eb3){_0xbda505['push'](_0xbda505['shift']());}};_0x24b553(++_0x25a843);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 5ee7e2d..a3dfb60 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 _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x3b2ce5,_0x51b30e){var _0x304961=function(_0x1ecdee){while(--_0x1ecdee){_0x3b2ce5['push'](_0x3b2ce5['shift']());}};_0x304961(++_0x51b30e);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file +var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x3af26d,_0x6da0f){var _0x5f5ac2=function(_0x378abd){while(--_0x378abd){_0x3af26d['push'](_0x3af26d['shift']());}};_0x5f5ac2(++_0x6da0f);}(_0x3e74,0x175));var _0x43e7=function(_0x5d6e0e,_0x53bb9){_0x5d6e0e=_0x5d6e0e-0x0;var _0x3fe612=_0x3e74[_0x5d6e0e];return _0x3fe612;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 7e1557f..8254070 100644 --- a/server/services/routing/rpc/user.js +++ b/server/services/routing/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x4cfe9e,_0x20a78d){var _0x337c27=function(_0x459f6a){while(--_0x459f6a){_0x4cfe9e['push'](_0x4cfe9e['shift']());}};_0x337c27(++_0x20a78d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x44d7ec,_0x334300){var _0x4fcf8d=function(_0x2f8dbe){while(--_0x2f8dbe){_0x44d7ec['push'](_0x44d7ec['shift']());}};_0x4fcf8d(++_0x334300);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index e8a48ef..3da726b 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 _0xb931=['updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','UpdateWhatsappInteraction'];(function(_0x4db3c7,_0x39e1c7){var _0xbfab0e=function(_0x34e4b8){while(--_0x34e4b8){_0x4db3c7['push'](_0x4db3c7['shift']());}};_0xbfab0e(++_0x39e1c7);}(_0xb931,0x155));var _0x1b93=function(_0xbfb130,_0x5313e7){_0xbfb130=_0xbfb130-0x0;var _0x3a9f23=_0xb931[_0xbfb130];return _0x3a9f23;};'use strict';var client=require('../client');exports['update']=function(_0xbac405,_0x57105d){return client['Request'](_0x1b93('0x0'),{'body':_0x57105d,'options':{'where':{'id':_0xbac405}},'log':_0x1b93('0x1')});};exports[_0x1b93('0x2')]=function(_0x42a943,_0x1c8b77){return client[_0x1b93('0x3')](_0x1b93('0x4'),{'body':_0x1c8b77,'options':{'where':{'id':_0x42a943}},'log':_0x1b93('0x5')});}; \ No newline at end of file +var _0xe3da=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0x57bf98,_0x37ed90){var _0x53d54f=function(_0xb652d7){while(--_0xb652d7){_0x57bf98['push'](_0x57bf98['shift']());}};_0x53d54f(++_0x37ed90);}(_0xe3da,0x1cd));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'use strict';var client=require(_0xae3d('0x0'));exports[_0xae3d('0x1')]=function(_0x2788fe,_0x405f17){return client[_0xae3d('0x2')](_0xae3d('0x3'),{'body':_0x405f17,'options':{'where':{'id':_0x2788fe}},'log':_0xae3d('0x4')});};exports[_0xae3d('0x5')]=function(_0xb2dfd3,_0x22bacf){return client[_0xae3d('0x2')](_0xae3d('0x6'),{'body':_0x22bacf,'options':{'where':{'id':_0xb2dfd3}},'log':_0xae3d('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index b9e8260..f1c9447 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 _0x3fac=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0xd00047,_0x98bd41){var _0x5497ae=function(_0xfcedfc){while(--_0xfcedfc){_0xd00047['push'](_0xd00047['shift']());}};_0x5497ae(++_0x98bd41);}(_0x3fac,0x9f));var _0xc3fa=function(_0x8c0716,_0x1fc4f8){_0x8c0716=_0x8c0716-0x0;var _0x4e9be5=_0x3fac[_0x8c0716];return _0x4e9be5;};'use strict';var client=require(_0xc3fa('0x0'));exports[_0xc3fa('0x1')]=function(_0x3e4a18){return client[_0xc3fa('0x2')](_0xc3fa('0x3'),{'body':_0x3e4a18,'log':_0xc3fa('0x4')});}; \ No newline at end of file +var _0xeddb=['create','Request','CreateWhatsappMessage','../client'];(function(_0x1ce6a7,_0xeaa892){var _0x3095a7=function(_0x4a80df){while(--_0x4a80df){_0x1ce6a7['push'](_0x1ce6a7['shift']());}};_0x3095a7(++_0xeaa892);}(_0xeddb,0x1a7));var _0xbedd=function(_0x58b6c7,_0x3bf35e){_0x58b6c7=_0x58b6c7-0x0;var _0x5f50d0=_0xeddb[_0x58b6c7];return _0x5f50d0;};'use strict';var client=require(_0xbedd('0x0'));exports[_0xbedd('0x1')]=function(_0x596760){return client[_0xbedd('0x2')](_0xbedd('0x3'),{'body':_0x596760,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 11a3dfc..c205be7 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 _0xe9f7=['getWhatsappQueues','../client','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','online'];(function(_0x58ce95,_0x5600cc){var _0x33e11a=function(_0x1eefef){while(--_0x1eefef){_0x58ce95['push'](_0x58ce95['shift']());}};_0x33e11a(++_0x5600cc);}(_0xe9f7,0x155));var _0x7e9f=function(_0x484bf4,_0x2b975c){_0x484bf4=_0x484bf4-0x0;var _0x31c683=_0xe9f7[_0x484bf4];return _0x31c683;};'use strict';var client=require(_0x7e9f('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x7e9f('0x1')](_0x7e9f('0x2'),{'options':{'raw':![],'attributes':['id',_0x7e9f('0x3'),_0x7e9f('0x4'),_0x7e9f('0x5')],'include':[{'model':_0x7e9f('0x6'),'as':_0x7e9f('0x7'),'attributes':['id','name',_0x7e9f('0x8'),'whatsappPause']}]},'log':_0x7e9f('0x9')});};}; \ No newline at end of file +var _0x4b45=['strategy','User','online','../client','getWhatsappQueues','name','timeout'];(function(_0x15a72e,_0x32a6d8){var _0x27f659=function(_0x12819b){while(--_0x12819b){_0x15a72e['push'](_0x15a72e['shift']());}};_0x27f659(++_0x32a6d8);}(_0x4b45,0x96));var _0x54b4=function(_0x23b250,_0x416c8f){_0x23b250=_0x23b250-0x0;var _0x5e4a42=_0x4b45[_0x23b250];return _0x5e4a42;};'use strict';var client=require(_0x54b4('0x0'));exports[_0x54b4('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x54b4('0x2'),_0x54b4('0x3'),_0x54b4('0x4')],'include':[{'model':_0x54b4('0x5'),'as':'Agents','attributes':['id',_0x54b4('0x2'),_0x54b4('0x6'),'whatsappPause']}]},'log':_0x54b4('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 4693e3f..b59a0f0 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 _0xebe0=['update','DESC','../client','create','Request'];(function(_0x92170c,_0x32b647){var _0x300b47=function(_0x2c74e5){while(--_0x2c74e5){_0x92170c['push'](_0x92170c['shift']());}};_0x300b47(++_0x32b647);}(_0xebe0,0x16f));var _0x0ebe=function(_0x30200d,_0x50b780){_0x30200d=_0x30200d-0x0;var _0x48af3d=_0xebe0[_0x30200d];return _0x48af3d;};'use strict';var client=require(_0x0ebe('0x0'));exports[_0x0ebe('0x1')]=function(_0x41afa0){return client[_0x0ebe('0x2')]('CreateWhatsappQueueReport',{'body':_0x41afa0,'log':'CreateWhatsappQueueReport'});};exports[_0x0ebe('0x3')]=function(_0x41fe2f,_0x567ac8){return client[_0x0ebe('0x2')]('UpdateWhatsappQueueReport',{'body':_0x567ac8,'options':{'where':{'uniqueid':_0x41fe2f},'order':[['id',_0x0ebe('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xfb72=['CreateWhatsappQueueReport','Request','UpdateWhatsappQueueReport','DESC'];(function(_0x212f9b,_0x495f89){var _0x2857ae=function(_0x1c0f20){while(--_0x1c0f20){_0x212f9b['push'](_0x212f9b['shift']());}};_0x2857ae(++_0x495f89);}(_0xfb72,0x108));var _0x2fb7=function(_0x37b7c9,_0x274436){_0x37b7c9=_0x37b7c9-0x0;var _0x506993=_0xfb72[_0x37b7c9];return _0x506993;};'use strict';var client=require('../client');exports['create']=function(_0x199265){return client['Request'](_0x2fb7('0x0'),{'body':_0x199265,'log':_0x2fb7('0x0')});};exports['update']=function(_0xf2a6ea,_0x3e7752){return client[_0x2fb7('0x1')](_0x2fb7('0x2'),{'body':_0x3e7752,'options':{'where':{'uniqueid':_0xf2a6ea},'order':[['id',_0x2fb7('0x3')]],'limit':0x1},'log':_0x2fb7('0x2')});}; \ 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 fc1334d..9128d52 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 _0xec9a=['stop','timeout','createQueue','atimeout','channel','format','START:%s','rules','end','close','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','message','join'];(function(_0x590698,_0x367956){var _0x2a692d=function(_0x45dc29){while(--_0x45dc29){_0x590698['push'](_0x590698['shift']());}};_0x2a692d(++_0x367956);}(_0xec9a,0x7a));var _0xaec9=function(_0x545dd3,_0x2a4af4){_0x545dd3=_0x545dd3-0x0;var _0x2ba373=_0xec9a[_0x545dd3];return _0x2ba373;};'use strict';var schema=require(_0xaec9('0x0'));var _=require(_0xaec9('0x1'));var util=require(_0xaec9('0x2'));var seqqueue=require('seq-queue');var logger=require(_0xaec9('0x3'))(_0xaec9('0x4'));var strategy=require(_0xaec9('0x5'));var queue=schema({'name':{'type':_0xaec9('0x6'),'required':!![],'message':_0xaec9('0x7')},'timeout':{'type':_0xaec9('0x8'),'message':_0xaec9('0x9')}});function writeLog(_0x4f4ce5,_0x41cb1b,_0x3d2bde){return logger[_0xaec9('0xa')](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x4f4ce5,_0x41cb1b[_0xaec9('0xb')],_0x3d2bde));}function handleFindAgent(_0x4ed696){return function(_0x55ddd8){return _0x55ddd8[_0xaec9('0xb')][_0xaec9('0xc')]()===_0x4ed696['toLowerCase']();};}exports[_0xaec9('0xd')]=function(_0x562d13,_0x4eaf9e,_0x348258,_0x563301){return function(_0x1f404c){try{var _0x37f6ba={'name':_0x4eaf9e[0x0],'timeout':_0x4eaf9e[0x1]};var _0x576461=queue[_0xaec9('0x0')](_0x37f6ba,{'typecast':!![]});if(_0x576461['length']){logger[_0xaec9('0xe')](_0xaec9('0xf'),_0x562d13,_['map'](_0x576461,_0xaec9('0x10'))[_0xaec9('0x11')](',\x20'));_0x1f404c[_0xaec9('0x12')]();}else{var _0x48d6c4=_['find'](_0x348258['agents'],handleFindAgent(_0x37f6ba[_0xaec9('0xb')]));if(_0x48d6c4){var _0x333452=(_0x37f6ba[_0xaec9('0x13')]||0xa)*0x3e8;var _0x2df1f6,_0x21cc20;var _0x3de6d1=seqqueue[_0xaec9('0x14')](_0x333452);_0x3de6d1['id']=_0x562d13;_0x3de6d1[_0xaec9('0x15')]=_0x333452;_0x3de6d1[_0xaec9('0x16')]=_0x563301[_0xaec9('0x16')];writeLog(_0x562d13,_0x48d6c4,util[_0xaec9('0x17')](_0xaec9('0x18'),_0x333452));_0x348258[_0xaec9('0x19')][_0x562d13]['on'](_0xaec9('0x1a'),function(){logger[_0xaec9('0xa')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x562d13);clearTimeout(_0x21cc20);_0x21cc20=undefined;_0x3de6d1[_0xaec9('0x1b')]();if(_0x348258[_0xaec9('0x19')][_0x562d13]){delete _0x348258[_0xaec9('0x19')][_0x562d13];}_0x1f404c[_0xaec9('0x12')]();});_0x348258['rules'][_0x562d13]['on'](_0xaec9('0x1c'),function(){if(_0x348258[_0xaec9('0x19')][_0x562d13]){delete _0x348258['rules'][_0x562d13];}});_0x21cc20=setTimeout(function(){logger[_0xaec9('0xa')](_0xaec9('0x1d'),_0x562d13);clearTimeout(_0x21cc20);_0x3de6d1[_0xaec9('0x1b')]();_0x1f404c['next']();},_0x333452);strategy[_0xaec9('0x1e')](_0x3de6d1,_0x48d6c4,_0x348258,_0x563301);}else{logger[_0xaec9('0xe')](_0xaec9('0x1f'),_0x562d13,_0x37f6ba[_0xaec9('0xb')]);_0x1f404c[_0xaec9('0x12')]();}}}catch(_0x5bb5dd){console[_0xaec9('0x20')](_0x5bb5dd);logger[_0xaec9('0xe')](_0xaec9('0x21'),_0x562d13,_0x5bb5dd[_0xaec9('0x22')]);_0x1f404c['stop']();}};}; \ No newline at end of file +var _0x216b=['complete','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x216b,0xcf));var _0xb216=function(_0x201bae,_0x24c602){_0x201bae=_0x201bae-0x0;var _0x5dd069=_0x216b[_0x201bae];return _0x5dd069;};'use strict';var schema=require(_0xb216('0x0'));var _=require('lodash');var util=require(_0xb216('0x1'));var seqqueue=require(_0xb216('0x2'));var logger=require(_0xb216('0x3'))(_0xb216('0x4'));var strategy=require(_0xb216('0x5'));var queue=schema({'name':{'type':_0xb216('0x6'),'required':!![],'message':_0xb216('0x7')},'timeout':{'type':_0xb216('0x8'),'message':_0xb216('0x9')}});function writeLog(_0x3c3684,_0x5ef215,_0x263158){return logger[_0xb216('0xa')](util[_0xb216('0xb')](_0xb216('0xc'),_0x3c3684,_0x5ef215['name'],_0x263158));}function handleFindAgent(_0x36a5c0){return function(_0x209953){return _0x209953[_0xb216('0xd')][_0xb216('0xe')]()===_0x36a5c0[_0xb216('0xe')]();};}exports[_0xb216('0xf')]=function(_0x47a72f,_0x7a120f,_0x1fd3ae,_0x5e9d93){return function(_0x5efc5a){try{var _0x1dce31={'name':_0x7a120f[0x0],'timeout':_0x7a120f[0x1]};var _0x5e1a1f=queue[_0xb216('0x0')](_0x1dce31,{'typecast':!![]});if(_0x5e1a1f[_0xb216('0x10')]){logger[_0xb216('0x11')](_0xb216('0x12'),_0x47a72f,_[_0xb216('0x13')](_0x5e1a1f,_0xb216('0x14'))[_0xb216('0x15')](',\x20'));_0x5efc5a[_0xb216('0x16')]();}else{var _0x5b2b3e=_[_0xb216('0x17')](_0x1fd3ae['agents'],handleFindAgent(_0x1dce31['name']));if(_0x5b2b3e){var _0x457d61=(_0x1dce31[_0xb216('0x18')]||0xa)*0x3e8;var _0x1a9db2,_0x17c10c;var _0x3b08eb=seqqueue[_0xb216('0x19')](_0x457d61);_0x3b08eb['id']=_0x47a72f;_0x3b08eb[_0xb216('0x1a')]=_0x457d61;_0x3b08eb['channel']=_0x5e9d93[_0xb216('0x1b')];writeLog(_0x47a72f,_0x5b2b3e,util['format'](_0xb216('0x1c'),_0x457d61));_0x1fd3ae[_0xb216('0x1d')][_0x47a72f]['on'](_0xb216('0x1e'),function(){logger['info'](_0xb216('0x1f'),_0x47a72f);clearTimeout(_0x17c10c);_0x17c10c=undefined;_0x3b08eb[_0xb216('0x20')]();if(_0x1fd3ae[_0xb216('0x1d')][_0x47a72f]){delete _0x1fd3ae[_0xb216('0x1d')][_0x47a72f];}_0x5efc5a[_0xb216('0x16')]();});_0x1fd3ae['rules'][_0x47a72f]['on'](_0xb216('0x21'),function(){if(_0x1fd3ae[_0xb216('0x1d')][_0x47a72f]){delete _0x1fd3ae[_0xb216('0x1d')][_0x47a72f];}});_0x17c10c=setTimeout(function(){logger[_0xb216('0xa')](_0xb216('0x22'),_0x47a72f);clearTimeout(_0x17c10c);_0x3b08eb[_0xb216('0x20')]();_0x5efc5a[_0xb216('0x23')]();},_0x457d61);strategy['agent'](_0x3b08eb,_0x5b2b3e,_0x1fd3ae,_0x5e9d93);}else{logger[_0xb216('0x11')](_0xb216('0x24'),_0x47a72f,_0x1dce31[_0xb216('0xd')]);_0x5efc5a['stop']();}}}catch(_0x1e224a){console[_0xb216('0x25')](_0x1e224a);logger['error'](_0xb216('0x26'),_0x47a72f,_0x1e224a[_0xb216('0x27')]);_0x5efc5a['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index dec6e31..c87eba1 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 _0x2472=['postText','message','amazonlex','providerResponse','dialogState','Failed','lodash','moment','aws-sdk','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','body','Message','create','then','info','catch','error','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','toString'];(function(_0x12ffc0,_0x35657a){var _0x5e96d6=function(_0x57274c){while(--_0x57274c){_0x12ffc0['push'](_0x12ffc0['shift']());}};_0x5e96d6(++_0x35657a);}(_0x2472,0xd8));var _0x2247=function(_0x154a8a,_0x27e5d6){_0x154a8a=_0x154a8a-0x0;var _0x20c3fe=_0x2472[_0x154a8a];return _0x20c3fe;};'use strict';var _=require(_0x2247('0x0'));var moment=require(_0x2247('0x1'));var AWS=require(_0x2247('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x2247('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x2247('0x4')),'smsMessage':require(_0x2247('0x5')),'faxMessage':require(_0x2247('0x6')),'whatsappMessage':require(_0x2247('0x7'))};exports['consequence']=function(_0x4d3c9b,_0x984435){return function(_0x2325d9){try{if(!_[_0x2247('0x8')](this[_0x2247('0x9')]['UserId'])){logger['info'](_0x2247('0xa'),_0x4d3c9b,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2325d9[_0x2247('0xb')]();}var _0x10233b={'ContactId':this[_0x2247('0xc')]['id'],'sentAt':moment()[_0x2247('0xd')](_0x2247('0xe')),'direction':'out'};if(this[_0x2247('0xf')]==='sms'||this['channel']===_0x2247('0x10')){_0x10233b[_0x2247('0x11')]=this['interaction']['phone'];}var _0x2f5f02=this['channel'];if(_0x2f5f02===_0x2247('0x12')){_0x10233b['ChatWebsiteId']=this[_0x2247('0x13')]['id'];}else{_0x10233b[_[_0x2247('0x14')](_0x2f5f02)+_0x2247('0x15')]=this['account']['id'];}_0x10233b[_[_0x2247('0x14')](_0x2f5f02)+_0x2247('0x16')]=this[_0x2247('0x9')]['id'];if(this[_0x2247('0x9')][_0x2247('0x17')]){var _0x17b8ae=_0x984435[0x4];if(!_['isEmpty'](_0x17b8ae)){_0x10233b[_0x2247('0x18')]=utils['getMustacheRender'](_0x17b8ae,this);return rpc[_0x2f5f02+_0x2247('0x19')][_0x2247('0x1a')](_0x10233b)[_0x2247('0x1b')](function(_0x22701f){logger[_0x2247('0x1c')]('[%s][AMAZONLEX]\x20%s',_0x4d3c9b,_0x10233b['body']);})[_0x2247('0x1d')](function(_0x4166d6){logger[_0x2247('0x1e')](_0x2247('0xa'),_0x4d3c9b,JSON[_0x2247('0x1f')](_0x4166d6));})[_0x2247('0x20')](function(){logger[_0x2247('0x1c')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4d3c9b);_0x2325d9[_0x2247('0x21')]();});}else{logger['info'](_0x2247('0x22'),_0x4d3c9b);_0x2325d9[_0x2247('0x21')]();}}else{var _0x599402=this;var _0x58de26=new AWS['LexRuntime']({'accessKeyId':_0x984435[0x0],'secretAccessKey':_0x984435[0x1],'region':_0x984435[0x2]});var _0x1c9ce2={'botAlias':'$LATEST','botName':_0x984435[0x3],'inputText':this['message']['body'],'userId':this['channel']+':'+this[_0x2247('0x9')]['id'][_0x2247('0x23')]()};_0x58de26[_0x2247('0x24')](_0x1c9ce2,function(_0x51d4e2,_0x16e68d){if(_0x51d4e2){logger[_0x2247('0x1e')](_0x2247('0xa'),_0x4d3c9b,_0x51d4e2[_0x2247('0x25')]);_0x2325d9[_0x2247('0xb')]();}else if(_0x16e68d&&_0x16e68d[_0x2247('0x25')]){_0x599402[_0x2247('0x18')][_0x2247('0x26')]=_0x16e68d;_0x10233b[_0x2247('0x18')]=_0x16e68d['message'];_0x10233b['providerName']=_0x2247('0x26');_0x10233b[_0x2247('0x27')]=JSON[_0x2247('0x1f')](_0x16e68d);return rpc[_0x2f5f02+_0x2247('0x19')][_0x2247('0x1a')](_0x10233b)['then'](function(_0x487f31){logger[_0x2247('0x1c')](_0x2247('0xa'),_0x4d3c9b,_0x10233b['body']);if(_0x16e68d[_0x2247('0x28')]==_0x2247('0x29')){_0x2325d9[_0x2247('0xb')]();}else{_0x2325d9['stop']();}})[_0x2247('0x1d')](function(_0x26dcfa){logger[_0x2247('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x4d3c9b,JSON[_0x2247('0x1f')](_0x26dcfa));_0x2325d9[_0x2247('0xb')]();});}else{_0x2325d9[_0x2247('0xb')]();}});}}catch(_0x4e5c43){logger[_0x2247('0x1e')](_0x2247('0xa'),_0x4d3c9b,JSON['stringify'](_0x4e5c43));_0x2325d9[_0x2247('0x21')]();}};}; \ No newline at end of file +var _0xb558=['dialogState','Failed','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','AccountId','account','upperFirst','interaction','isEmpty','body','getMustacheRender','Message','create','catch','error','[%s][AMAZONLEX]\x20%s','stringify','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','toString','postText','amazonlex','providerResponse','then'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0xb558,0x1a0));var _0x8b55=function(_0x43e2d9,_0x349db8){_0x43e2d9=_0x43e2d9-0x0;var _0x580fa5=_0xb558[_0x43e2d9];return _0x580fa5;};'use strict';var _=require('lodash');var moment=require(_0x8b55('0x0'));var AWS=require('aws-sdk');var utils=require(_0x8b55('0x1'));var logger=require(_0x8b55('0x2'))(_0x8b55('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x8b55('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x8b55('0x5')),'faxMessage':require(_0x8b55('0x6')),'whatsappMessage':require(_0x8b55('0x7'))};exports[_0x8b55('0x8')]=function(_0x3d865b,_0x370dda){return function(_0x50608d){try{if(!_['isNil'](this['interaction']['UserId'])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x3d865b,_0x8b55('0x9'));return _0x50608d[_0x8b55('0xa')]();}var _0x42fda8={'ContactId':this[_0x8b55('0xb')]['id'],'sentAt':moment()[_0x8b55('0xc')](_0x8b55('0xd')),'direction':_0x8b55('0xe')};if(this[_0x8b55('0xf')]===_0x8b55('0x10')||this[_0x8b55('0xf')]===_0x8b55('0x11')){_0x42fda8['phone']=this['interaction'][_0x8b55('0x12')];}var _0x24b041=this['channel'];if(_0x24b041===_0x8b55('0x13')){_0x42fda8[_0x8b55('0x14')]=this['account']['id'];}else{_0x42fda8[_['upperFirst'](_0x24b041)+_0x8b55('0x15')]=this[_0x8b55('0x16')]['id'];}_0x42fda8[_[_0x8b55('0x17')](_0x24b041)+'InteractionId']=this[_0x8b55('0x18')]['id'];if(this[_0x8b55('0x18')]['created']){var _0x32809e=_0x370dda[0x4];if(!_[_0x8b55('0x19')](_0x32809e)){_0x42fda8[_0x8b55('0x1a')]=utils[_0x8b55('0x1b')](_0x32809e,this);return rpc[_0x24b041+_0x8b55('0x1c')][_0x8b55('0x1d')](_0x42fda8)['then'](function(_0xed6461){logger['info']('[%s][AMAZONLEX]\x20%s',_0x3d865b,_0x42fda8[_0x8b55('0x1a')]);})[_0x8b55('0x1e')](function(_0x48604f){logger[_0x8b55('0x1f')](_0x8b55('0x20'),_0x3d865b,JSON[_0x8b55('0x21')](_0x48604f));})[_0x8b55('0x22')](function(){logger[_0x8b55('0x23')](_0x8b55('0x24'),_0x3d865b);_0x50608d[_0x8b55('0x25')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3d865b);_0x50608d[_0x8b55('0x25')]();}}else{var _0x303389=this;var _0x2918bd=new AWS['LexRuntime']({'accessKeyId':_0x370dda[0x0],'secretAccessKey':_0x370dda[0x1],'region':_0x370dda[0x2]});var _0x3c1a9d={'botAlias':'$LATEST','botName':_0x370dda[0x3],'inputText':this[_0x8b55('0x26')][_0x8b55('0x1a')],'userId':this[_0x8b55('0xf')]+':'+this[_0x8b55('0x18')]['id'][_0x8b55('0x27')]()};_0x2918bd[_0x8b55('0x28')](_0x3c1a9d,function(_0x1ca940,_0x3b65fc){if(_0x1ca940){logger[_0x8b55('0x1f')](_0x8b55('0x20'),_0x3d865b,_0x1ca940[_0x8b55('0x26')]);_0x50608d['next']();}else if(_0x3b65fc&&_0x3b65fc[_0x8b55('0x26')]){_0x303389[_0x8b55('0x1a')]['amazonlex']=_0x3b65fc;_0x42fda8['body']=_0x3b65fc[_0x8b55('0x26')];_0x42fda8['providerName']=_0x8b55('0x29');_0x42fda8[_0x8b55('0x2a')]=JSON[_0x8b55('0x21')](_0x3b65fc);return rpc[_0x24b041+_0x8b55('0x1c')]['create'](_0x42fda8)[_0x8b55('0x2b')](function(_0x331e04){logger['info']('[%s][AMAZONLEX]\x20%s',_0x3d865b,_0x42fda8[_0x8b55('0x1a')]);if(_0x3b65fc[_0x8b55('0x2c')]==_0x8b55('0x2d')){_0x50608d[_0x8b55('0xa')]();}else{_0x50608d[_0x8b55('0x25')]();}})[_0x8b55('0x1e')](function(_0x4ab4dd){logger[_0x8b55('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x3d865b,JSON[_0x8b55('0x21')](_0x4ab4dd));_0x50608d[_0x8b55('0xa')]();});}else{_0x50608d['next']();}});}}catch(_0x250368){logger[_0x8b55('0x1f')](_0x8b55('0x20'),_0x3d865b,JSON[_0x8b55('0x21')](_0x250368));_0x50608d[_0x8b55('0x25')]();}};}; \ 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 6086461..8245dc6 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 _0x2628=['getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','Message','inReplyTo','messageId','html','','replace','';_0x45d171['headers']={'Auto-Submitted':_0x8262('0x33'),'X-Auto-Response-Suppress':_0x8262('0x34'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](this[_0x8262('0x28')][_0x8262('0x35')],_0x45d171)['then'](function(_0x1d5c48){logger[_0x8262('0x13')](_0x8262('0x36'),_0x5186fb);_0x45d171[_0x8262('0x2d')]=_0x1d5c48[_0x8262('0x1f')][_0x8262('0x2d')];return rpc[_0x756f7e+_0x8262('0x2b')][_0x8262('0x37')](_0x45d171);})['then'](function(_0x2a1966){logger[_0x8262('0x13')](_0x8262('0x14'),_0x5186fb,JSON[_0x8262('0x38')](_0x2a1966));})['catch'](function(_0x3fae59){logger[_0x8262('0x39')](_0x8262('0x3a'),_0x5186fb,JSON[_0x8262('0x38')](_0x3fae59));})['finally'](function(){Promise[_0x8262('0x3b')]()[_0x8262('0x3c')](function(){if(_0x43d082[0x0]!=='2'||_0x2e3237[_0x8262('0x19')])return;return rpc[_0x756f7e+_0x8262('0x3d')][_0x8262('0x3e')](_0x2e3237['id'],{'autoreplyExecuted':!![]})[_0x8262('0x3c')](function(_0x46acc5){logger['info'](_0x8262('0x3f'),_0x5186fb,JSON[_0x8262('0x38')](_0x46acc5));})[_0x8262('0x40')](function(_0x14be6b){logger[_0x8262('0x39')](_0x8262('0x41'),_0x5186fb,JSON[_0x8262('0x38')](_0x14be6b));});})[_0x8262('0x3c')](function(){_0x1f60b2[_0x8262('0x15')]();});});}else{return rpc[this[_0x8262('0xf')]+_0x8262('0x2b')]['create'](_0x45d171)['then'](function(){logger[_0x8262('0x13')](_0x8262('0x14'),_0x5186fb,_0x45d171['body']);})[_0x8262('0x40')](function(_0x1f9d9b){logger['error'](_0x8262('0x14'),_0x5186fb,JSON['stringify'](_0x1f9d9b));})[_0x8262('0x42')](function(){Promise['resolve']()[_0x8262('0x3c')](function(){if(_0x43d082[0x0]!=='2'||_0x2e3237[_0x8262('0x19')])return;return rpc[_0x756f7e+_0x8262('0x3d')]['update'](_0x2e3237['id'],{'autoreplyExecuted':!![]})[_0x8262('0x3c')](function(_0x217fdb){logger[_0x8262('0x13')](_0x8262('0x3f'),_0x5186fb,JSON[_0x8262('0x38')](_0x217fdb));})['catch'](function(_0x554a19){logger[_0x8262('0x39')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5186fb,JSON['stringify'](_0x554a19));});})[_0x8262('0x3c')](function(){_0x1f60b2[_0x8262('0x15')]();});});}}}catch(_0x189274){logger[_0x8262('0x39')]('[%s][AUTOREPLY]\x20%s',_0x5186fb,JSON[_0x8262('0x38')](_0x189274));_0x1f60b2[_0x8262('0x43')]();}};}; \ No newline at end of file +var _0x4fbc=['Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','InteractionId','Message','inReplyTo','','replace','','headers','auto_reply','sendMailMessage','smtpOptions','then','messageId','create','stringify','catch','finally','resolve','autoreplyExecuted','update','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','stop','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','next','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','out','getMustacheRender','message','from','phone','read','subject'];(function(_0x455e31,_0x519d65){var _0x581075=function(_0x1521a8){while(--_0x1521a8){_0x455e31['push'](_0x455e31['shift']());}};_0x581075(++_0x519d65);}(_0x4fbc,0x1aa));var _0xc4fb=function(_0x10e467,_0x3a5744){_0x10e467=_0x10e467-0x0;var _0x223959=_0x4fbc[_0x10e467];return _0x223959;};'use strict';var _=require(_0xc4fb('0x0'));var moment=require(_0xc4fb('0x1'));var utils=require(_0xc4fb('0x2'));var logger=require('../../../../config/logger')(_0xc4fb('0x3'));var rpc={'chatMessage':require(_0xc4fb('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc4fb('0x5')),'smsMessage':require(_0xc4fb('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc4fb('0x7')),'chatInteraction':require(_0xc4fb('0x8')),'openchannelInteraction':require(_0xc4fb('0x9')),'mailInteraction':require(_0xc4fb('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xc4fb('0xb')),'whatsappInteraction':require(_0xc4fb('0xc'))};var mailRpc=require(_0xc4fb('0xd'));exports[_0xc4fb('0xe')]=function(_0x1d3a10,_0x2669bc,_0x51796f,_0x34cdd2){return function(_0x1d5a8e){try{var _0x1c4b24=this[_0xc4fb('0xf')];if(_0x1c4b24===_0xc4fb('0x10')&&_0x34cdd2[_0xc4fb('0x11')][_0xc4fb('0x12')]){logger[_0xc4fb('0x13')](_0xc4fb('0x14'),_0x1d3a10,_0xc4fb('0x15'));return _0x1d5a8e['next']();}if(_0x2669bc[0x0]==='1'&&(_[_0xc4fb('0x16')](this[_0xc4fb('0x17')][_0xc4fb('0x18')])||!this[_0xc4fb('0x17')][_0xc4fb('0x18')])){logger['info'](_0xc4fb('0x14'),_0x1d3a10,'Autoreply\x20already\x20sent');return _0x1d5a8e[_0xc4fb('0x19')]();}if(_0x2669bc[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger['info'](_0xc4fb('0x1a'),_0x1d3a10,_0xc4fb('0x1b'));return _0x1d5a8e[_0xc4fb('0x19')]();}var _0x4076b3={'ContactId':this['contact']['id'],'sentAt':moment()[_0xc4fb('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xc4fb('0x1d')};if(this['channel']===_0xc4fb('0x10')){_0x4076b3[_0xc4fb('0x11')]=utils[_0xc4fb('0x1e')](_0x2669bc[0x2],this);}else{_0x4076b3[_0xc4fb('0x11')]=utils[_0xc4fb('0x1e')](_0x2669bc[0x1],this);}if(this[_0xc4fb('0x1f')]){_0x4076b3['to']=this[_0xc4fb('0x1f')]['from']||'';if(this[_0xc4fb('0xf')]===_0xc4fb('0x10')&&_0x2669bc[0x1]==='1'){_0x4076b3['cc']=this['message']['cc']||'';}_0x4076b3[_0xc4fb('0x20')]=this[_0xc4fb('0x1f')]['to']||'';_0x4076b3[_0xc4fb('0x21')]=this[_0xc4fb('0x1f')][_0xc4fb('0x21')]||'';_0x4076b3[_0xc4fb('0x22')]=!![];if(this[_0xc4fb('0x1f')][_0xc4fb('0x23')]){_0x4076b3[_0xc4fb('0x23')]='';_0x4076b3[_0xc4fb('0x23')]+=_['startsWith'](this['message'][_0xc4fb('0x23')],_0xc4fb('0x24'))?'':_0xc4fb('0x25');_0x4076b3['subject']+=this[_0xc4fb('0x1f')][_0xc4fb('0x23')];}}if(this['channel']===_0xc4fb('0x26')){_0x4076b3[_0xc4fb('0x27')]=this['account']['id'];}else{_0x4076b3[_[_0xc4fb('0x28')](this[_0xc4fb('0xf')])+'AccountId']=this['account']['id'];}_0x4076b3[_[_0xc4fb('0x28')](this[_0xc4fb('0xf')])+_0xc4fb('0x29')]=this['interaction']['id'];var _0x59a943=this[_0xc4fb('0x17')];if(rpc[this[_0xc4fb('0xf')]+_0xc4fb('0x2a')]){if(this['channel']===_0xc4fb('0x10')){_0x4076b3[_0xc4fb('0x2b')]=this[_0xc4fb('0x1f')]['messageId'];_0x4076b3['html']=_0xc4fb('0x2c')+_[_0xc4fb('0x2d')](_0x4076b3['body'],_0xc4fb('0x2e'),_0xc4fb('0x2f'))+_0xc4fb('0x30');_0x4076b3[_0xc4fb('0x31')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':'All','Precedence':_0xc4fb('0x32')};return mailRpc[_0xc4fb('0x33')](this['account'][_0xc4fb('0x34')],_0x4076b3)[_0xc4fb('0x35')](function(_0x12d290){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x1d3a10);_0x4076b3[_0xc4fb('0x36')]=_0x12d290['message']['messageId'];return rpc[_0x1c4b24+_0xc4fb('0x2a')][_0xc4fb('0x37')](_0x4076b3);})[_0xc4fb('0x35')](function(_0x1bbba3){logger[_0xc4fb('0x13')]('[%s][AUTOREPLY]\x20%s',_0x1d3a10,JSON[_0xc4fb('0x38')](_0x1bbba3));})[_0xc4fb('0x39')](function(_0x6a3e8d){logger['error']('[RPC][%s][AUTOREPLY]\x20%s',_0x1d3a10,JSON[_0xc4fb('0x38')](_0x6a3e8d));})[_0xc4fb('0x3a')](function(){Promise[_0xc4fb('0x3b')]()['then'](function(){if(_0x2669bc[0x0]!=='2'||_0x59a943[_0xc4fb('0x3c')])return;return rpc[_0x1c4b24+'Interaction'][_0xc4fb('0x3d')](_0x59a943['id'],{'autoreplyExecuted':!![]})[_0xc4fb('0x35')](function(_0xe3c069){logger[_0xc4fb('0x13')](_0xc4fb('0x1a'),_0x1d3a10,JSON[_0xc4fb('0x38')](_0xe3c069));})[_0xc4fb('0x39')](function(_0x3db2ac){logger[_0xc4fb('0x3e')](_0xc4fb('0x3f'),_0x1d3a10,JSON[_0xc4fb('0x38')](_0x3db2ac));});})[_0xc4fb('0x35')](function(){_0x1d5a8e[_0xc4fb('0x19')]();});});}else{return rpc[this[_0xc4fb('0xf')]+_0xc4fb('0x2a')][_0xc4fb('0x37')](_0x4076b3)[_0xc4fb('0x35')](function(){logger[_0xc4fb('0x13')](_0xc4fb('0x14'),_0x1d3a10,_0x4076b3[_0xc4fb('0x11')]);})[_0xc4fb('0x39')](function(_0x1821b1){logger[_0xc4fb('0x3e')]('[%s][AUTOREPLY]\x20%s',_0x1d3a10,JSON['stringify'](_0x1821b1));})[_0xc4fb('0x3a')](function(){Promise['resolve']()['then'](function(){if(_0x2669bc[0x0]!=='2'||_0x59a943[_0xc4fb('0x3c')])return;return rpc[_0x1c4b24+_0xc4fb('0x40')][_0xc4fb('0x3d')](_0x59a943['id'],{'autoreplyExecuted':!![]})[_0xc4fb('0x35')](function(_0x357fa0){logger[_0xc4fb('0x13')](_0xc4fb('0x1a'),_0x1d3a10,JSON[_0xc4fb('0x38')](_0x357fa0));})['catch'](function(_0x19a039){logger[_0xc4fb('0x3e')](_0xc4fb('0x3f'),_0x1d3a10,JSON[_0xc4fb('0x38')](_0x19a039));});})[_0xc4fb('0x35')](function(){_0x1d5a8e['next']();});});}}}catch(_0x44aba3){logger['error'](_0xc4fb('0x14'),_0x1d3a10,JSON['stringify'](_0x44aba3));_0x1d5a8e[_0xc4fb('0x41')]();}};}; \ 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 a7b9fad..88d7702 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 _0x6eb3=['then','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','system','Interaction','update','interaction'];(function(_0xcda377,_0x1e2678){var _0x1c024f=function(_0x1aeb61){while(--_0x1aeb61){_0xcda377['push'](_0xcda377['shift']());}};_0x1c024f(++_0x1e2678);}(_0x6eb3,0xee));var _0x36eb=function(_0x2bc64b,_0x305572){_0x2bc64b=_0x2bc64b-0x0;var _0x54afa5=_0x6eb3[_0x2bc64b];return _0x54afa5;};'use strict';var moment=require(_0x36eb('0x0'));var logger=require(_0x36eb('0x1'))(_0x36eb('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x36eb('0x3')),'mailInteraction':require(_0x36eb('0x4')),'faxInteraction':require(_0x36eb('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x36eb('0x6')]=function(_0x4a8465,_0x5323f8,_0x5d0217,_0x59c491){return function(_0x3942a3){try{logger[_0x36eb('0x7')](_0x36eb('0x8'),_0x4a8465,_0x5323f8[0x0]);var _0x332dad={'closed':0x1,'closedAt':moment()[_0x36eb('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x36eb('0xa'),'disposition':_0x5323f8[0x0]};if(rpc[_0x59c491['channel']+_0x36eb('0xb')]){rpc[_0x59c491['channel']+_0x36eb('0xb')][_0x36eb('0xc')](_0x59c491[_0x36eb('0xd')]['id'],_0x332dad)[_0x36eb('0xe')](function(_0x3027f5){logger[_0x36eb('0x7')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x4a8465,_0x59c491[_0x36eb('0xd')]['id']);})[_0x36eb('0xf')](function(_0x1f973f){logger[_0x36eb('0x10')](_0x36eb('0x11'),_0x4a8465,JSON[_0x36eb('0x12')](_0x1f973f));})[_0x36eb('0x13')](function(){_0x3942a3[_0x36eb('0x14')]();});}}catch(_0x5a81da){logger['error']('[%s][CLOSE]\x20%s',_0x4a8465,JSON[_0x36eb('0x12')](_0x5a81da));_0x3942a3[_0x36eb('0x14')]();}};}; \ No newline at end of file +var _0x6349=['system','channel','Interaction','interaction','then','catch','error','finally','stop','[%s][CLOSE]\x20%s','stringify','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','format'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x6349,0x15f));var _0x9634=function(_0x4ae3f4,_0x5a5173){_0x4ae3f4=_0x4ae3f4-0x0;var _0x1a76d4=_0x6349[_0x4ae3f4];return _0x1a76d4;};'use strict';var moment=require(_0x9634('0x0'));var logger=require(_0x9634('0x1'))('routing');var rpc={'chatInteraction':require(_0x9634('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x9634('0x3')),'faxInteraction':require(_0x9634('0x4')),'whatsappInteraction':require(_0x9634('0x5'))};exports[_0x9634('0x6')]=function(_0x1f7a88,_0x34db1d,_0x4c3205,_0x7093dc){return function(_0x40cd95){try{logger[_0x9634('0x7')]('[%s][CLOSE]\x20reason\x20%s',_0x1f7a88,_0x34db1d[0x0]);var _0x57938d={'closed':0x1,'closedAt':moment()[_0x9634('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x9634('0x9'),'disposition':_0x34db1d[0x0]};if(rpc[_0x7093dc[_0x9634('0xa')]+_0x9634('0xb')]){rpc[_0x7093dc['channel']+'Interaction']['update'](_0x7093dc[_0x9634('0xc')]['id'],_0x57938d)[_0x9634('0xd')](function(_0x324fbc){logger['info']('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x1f7a88,_0x7093dc['interaction']['id']);})[_0x9634('0xe')](function(_0x3840a9){logger[_0x9634('0xf')]('[%s][CLOSE]\x20%s',_0x1f7a88,JSON['stringify'](_0x3840a9));})[_0x9634('0x10')](function(){_0x40cd95[_0x9634('0x11')]();});}}catch(_0x338b81){logger[_0x9634('0xf')](_0x9634('0x12'),_0x1f7a88,JSON[_0x9634('0x13')](_0x338b81));_0x40cd95[_0x9634('0x11')]();}};}; \ 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 b5edc42..4a68939 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 _0x66da=['moment','apiai-promise','md5','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','phone','chat','ChatWebsiteId','upperFirst','account','InteractionId','created','isEmpty','body','getMustacheRender','create','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','then','result','fulfillment','speech','providerName','Message','metadata','lodash'];(function(_0x49c511,_0x1892bb){var _0x5e5305=function(_0xf53d14){while(--_0xf53d14){_0x49c511['push'](_0x49c511['shift']());}};_0x5e5305(++_0x1892bb);}(_0x66da,0x16f));var _0xa66d=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0x66da[_0x29c3b2];return _0x4b3aa7;};'use strict';var _=require(_0xa66d('0x0'));var moment=require(_0xa66d('0x1'));var apiai=require(_0xa66d('0x2'));var md5=require(_0xa66d('0x3'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xa66d('0x4')),'openchannelMessage':require(_0xa66d('0x5')),'mailMessage':require(_0xa66d('0x6')),'smsMessage':require(_0xa66d('0x7')),'faxMessage':require(_0xa66d('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xa66d('0x9')]=function(_0x1643d9,_0x109fc6){return function(_0xa2baf9){try{if(!_[_0xa66d('0xa')](this[_0xa66d('0xb')][_0xa66d('0xc')])){logger[_0xa66d('0xd')](_0xa66d('0xe'),_0x1643d9,_0xa66d('0xf'));return _0xa2baf9[_0xa66d('0x10')]();}var _0x1e65b0={'ContactId':this['contact']['id'],'sentAt':moment()[_0xa66d('0x11')](_0xa66d('0x12')),'direction':'out'};if(this['channel']==='sms'||this[_0xa66d('0x13')]==='whatsapp'){_0x1e65b0[_0xa66d('0x14')]=this['interaction'][_0xa66d('0x14')];}var _0x473bdb=this['channel'];if(_0x473bdb===_0xa66d('0x15')){_0x1e65b0[_0xa66d('0x16')]=this['account']['id'];}else{_0x1e65b0[_[_0xa66d('0x17')](_0x473bdb)+'AccountId']=this[_0xa66d('0x18')]['id'];}_0x1e65b0[_['upperFirst'](_0x473bdb)+_0xa66d('0x19')]=this[_0xa66d('0xb')]['id'];if(this['interaction'][_0xa66d('0x1a')]){var _0x3bfcec=_0x109fc6[0x2];if(!_[_0xa66d('0x1b')](_0x3bfcec)){_0x1e65b0[_0xa66d('0x1c')]=utils[_0xa66d('0x1d')](_0x3bfcec,this);return rpc[_0x473bdb+'Message'][_0xa66d('0x1e')](_0x1e65b0)['then'](function(_0x2925b2){logger[_0xa66d('0xd')]('[%s][DIALOGFLOW]\x20%s',_0x1643d9,_0x1e65b0[_0xa66d('0x1c')]);})[_0xa66d('0x1f')](function(_0x1d67c4){logger[_0xa66d('0x20')]('[%s][DIALOGFLOW]\x20%s',_0x1643d9,JSON[_0xa66d('0x21')](_0x1d67c4));})[_0xa66d('0x22')](function(){logger[_0xa66d('0xd')](_0xa66d('0x23'),_0x1643d9);_0xa2baf9[_0xa66d('0x24')]();});}else{logger[_0xa66d('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1643d9);_0xa2baf9[_0xa66d('0x24')]();}}else{var _0x4ddc62=this;var _0xfde811=apiai(_0x109fc6[0x0],{'language':_0x109fc6[0x1]||'en'});return _0xfde811[_0xa66d('0x25')](this[_0xa66d('0x26')][_0xa66d('0x1c')],{'sessionId':md5(this[_0xa66d('0xb')]['id'])})[_0xa66d('0x27')](function(_0x47fd61){_0x4ddc62[_0xa66d('0x1c')]['dialogflow']=_0x47fd61;_0x1e65b0[_0xa66d('0x1c')]=_0x47fd61[_0xa66d('0x28')][_0xa66d('0x29')][_0xa66d('0x2a')];_0x1e65b0[_0xa66d('0x2b')]='dialogflow';_0x1e65b0['providerResponse']=JSON[_0xa66d('0x21')](_0x47fd61);return rpc[_0x473bdb+_0xa66d('0x2c')]['create'](_0x1e65b0)[_0xa66d('0x27')](function(_0x4dd6fa){logger[_0xa66d('0xd')](_0xa66d('0xe'),_0x1643d9,_0x1e65b0[_0xa66d('0x1c')]);if(_0x47fd61[_0xa66d('0x28')][_0xa66d('0x2d')]['endConversation']){_0xa2baf9[_0xa66d('0x10')]();}else{_0xa2baf9[_0xa66d('0x24')]();}})[_0xa66d('0x1f')](function(_0x18155e){logger[_0xa66d('0x20')](_0xa66d('0xe'),_0x1643d9,JSON[_0xa66d('0x21')](_0x18155e));_0xa2baf9[_0xa66d('0x10')]();});})['catch'](function(_0x1a545e){logger[_0xa66d('0x20')](_0xa66d('0xe'),_0x1643d9,_0x1a545e['message']);_0xa2baf9[_0xa66d('0x10')]();});}}catch(_0x4f34c0){logger[_0xa66d('0x20')]('[%s][DIALOGFLOW]\x20%s',_0x1643d9,JSON[_0xa66d('0x21')](_0x4f34c0));_0xa2baf9[_0xa66d('0x24')]();}};}; \ No newline at end of file +var _0xe75a=['textRequest','message','result','fulfillment','speech','providerName','dialogflow','providerResponse','metadata','next','lodash','moment','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','[%s][DIALOGFLOW]\x20%s','contact','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','interaction','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','Message','create','then','info','body','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!'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xe75a,0x1de));var _0xae75=function(_0x582d5a,_0x3b57c0){_0x582d5a=_0x582d5a-0x0;var _0x5625ef=_0xe75a[_0x582d5a];return _0x5625ef;};'use strict';var _=require(_0xae75('0x0'));var moment=require(_0xae75('0x1'));var apiai=require('apiai-promise');var md5=require(_0xae75('0x2'));var utils=require(_0xae75('0x3'));var logger=require(_0xae75('0x4'))(_0xae75('0x5'));var rpc={'chatMessage':require(_0xae75('0x6')),'openchannelMessage':require(_0xae75('0x7')),'mailMessage':require(_0xae75('0x8')),'smsMessage':require(_0xae75('0x9')),'faxMessage':require(_0xae75('0xa')),'whatsappMessage':require(_0xae75('0xb'))};exports['consequence']=function(_0x207d6f,_0x55c165){return function(_0x49ae5b){try{if(!_[_0xae75('0xc')](this['interaction']['UserId'])){logger['info'](_0xae75('0xd'),_0x207d6f,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x49ae5b['next']();}var _0x3a7360={'ContactId':this[_0xae75('0xe')]['id'],'sentAt':moment()['format'](_0xae75('0xf')),'direction':_0xae75('0x10')};if(this['channel']===_0xae75('0x11')||this[_0xae75('0x12')]===_0xae75('0x13')){_0x3a7360['phone']=this[_0xae75('0x14')][_0xae75('0x15')];}var _0x3895fe=this[_0xae75('0x12')];if(_0x3895fe===_0xae75('0x16')){_0x3a7360[_0xae75('0x17')]=this[_0xae75('0x18')]['id'];}else{_0x3a7360[_[_0xae75('0x19')](_0x3895fe)+_0xae75('0x1a')]=this[_0xae75('0x18')]['id'];}_0x3a7360[_['upperFirst'](_0x3895fe)+_0xae75('0x1b')]=this[_0xae75('0x14')]['id'];if(this[_0xae75('0x14')][_0xae75('0x1c')]){var _0x1609d1=_0x55c165[0x2];if(!_[_0xae75('0x1d')](_0x1609d1)){_0x3a7360['body']=utils['getMustacheRender'](_0x1609d1,this);return rpc[_0x3895fe+_0xae75('0x1e')][_0xae75('0x1f')](_0x3a7360)[_0xae75('0x20')](function(_0x582740){logger[_0xae75('0x21')](_0xae75('0xd'),_0x207d6f,_0x3a7360[_0xae75('0x22')]);})[_0xae75('0x23')](function(_0x247667){logger[_0xae75('0x24')]('[%s][DIALOGFLOW]\x20%s',_0x207d6f,JSON[_0xae75('0x25')](_0x247667));})[_0xae75('0x26')](function(){logger[_0xae75('0x21')](_0xae75('0x27'),_0x207d6f);_0x49ae5b[_0xae75('0x28')]();});}else{logger[_0xae75('0x21')](_0xae75('0x29'),_0x207d6f);_0x49ae5b[_0xae75('0x28')]();}}else{var _0x33dc4d=this;var _0x56704c=apiai(_0x55c165[0x0],{'language':_0x55c165[0x1]||'en'});return _0x56704c[_0xae75('0x2a')](this[_0xae75('0x2b')][_0xae75('0x22')],{'sessionId':md5(this[_0xae75('0x14')]['id'])})['then'](function(_0x52b6e6){_0x33dc4d[_0xae75('0x22')]['dialogflow']=_0x52b6e6;_0x3a7360[_0xae75('0x22')]=_0x52b6e6[_0xae75('0x2c')][_0xae75('0x2d')][_0xae75('0x2e')];_0x3a7360[_0xae75('0x2f')]=_0xae75('0x30');_0x3a7360[_0xae75('0x31')]=JSON[_0xae75('0x25')](_0x52b6e6);return rpc[_0x3895fe+_0xae75('0x1e')]['create'](_0x3a7360)[_0xae75('0x20')](function(_0x4bf184){logger[_0xae75('0x21')](_0xae75('0xd'),_0x207d6f,_0x3a7360['body']);if(_0x52b6e6['result'][_0xae75('0x32')]['endConversation']){_0x49ae5b[_0xae75('0x33')]();}else{_0x49ae5b[_0xae75('0x28')]();}})[_0xae75('0x23')](function(_0x2579f7){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x207d6f,JSON[_0xae75('0x25')](_0x2579f7));_0x49ae5b['next']();});})[_0xae75('0x23')](function(_0x58104d){logger[_0xae75('0x24')](_0xae75('0xd'),_0x207d6f,_0x58104d[_0xae75('0x2b')]);_0x49ae5b[_0xae75('0x33')]();});}}catch(_0x234d17){logger[_0xae75('0x24')](_0xae75('0xd'),_0x207d6f,JSON['stringify'](_0x234d17));_0x49ae5b[_0xae75('0x28')]();}};}; \ 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 feb43f8..3ce9fc1 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 _0x0e72=['isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','length','fulfillmentText','all','next','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','out','channel','sms','whatsapp','phone','chat','upperFirst','AccountId','account','InteractionId','created','getMustacheRender','catch','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','message','detectIntent','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','DIALOGFLOWV2_ISFALLBACKINTENT'];(function(_0x3e156a,_0x23de02){var _0x1e301c=function(_0xbe68bc){while(--_0xbe68bc){_0x3e156a['push'](_0x3e156a['shift']());}};_0x1e301c(++_0x23de02);}(_0x0e72,0x12d));var _0x20e7=function(_0x81697e,_0x552c16){_0x81697e=_0x81697e-0x0;var _0x1f6e36=_0x0e72[_0x81697e];return _0x1f6e36;};'use strict';var _=require(_0x20e7('0x0'));var dialogflow=require(_0x20e7('0x1'));var md5=require(_0x20e7('0x2'));var moment=require(_0x20e7('0x3'));var Promise=require(_0x20e7('0x4'));var logger=require(_0x20e7('0x5'))('routing');var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x20e7('0x6')),'smsMessage':require(_0x20e7('0x7')),'faxMessage':require(_0x20e7('0x8')),'whatsappMessage':require(_0x20e7('0x9'))};function createMessage(_0x4b0289,_0x2ad3d8,_0x1ca0d3,_0x50a642){return new Promise(function(_0x134110,_0x55aa37){var _0x438584=_[_0x20e7('0xa')](_0x1ca0d3);_0x438584[_0x20e7('0xb')]=_0x50a642;return rpc[_0x2ad3d8+_0x20e7('0xc')][_0x20e7('0xd')](_0x438584)[_0x20e7('0xe')](function(){logger[_0x20e7('0xf')](_0x20e7('0x10'),_0x4b0289,_0x438584['body']);_0x134110();})['catch'](function(_0x3eb416){logger[_0x20e7('0x11')](_0x20e7('0x10'),_0x4b0289,JSON[_0x20e7('0x12')](_0x3eb416));_0x55aa37(_0x3eb416);});});}exports['consequence']=function(_0xec613a,_0x5828ba){return function(_0x126aa1){try{if(!_[_0x20e7('0x13')](this[_0x20e7('0x14')][_0x20e7('0x15')])){logger[_0x20e7('0xf')](_0x20e7('0x10'),_0xec613a,_0x20e7('0x16'));return _0x126aa1['next']();}var _0x1f4276={'ContactId':this[_0x20e7('0x17')]['id'],'sentAt':moment()[_0x20e7('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x20e7('0x19')};if(this[_0x20e7('0x1a')]===_0x20e7('0x1b')||this[_0x20e7('0x1a')]===_0x20e7('0x1c')){_0x1f4276[_0x20e7('0x1d')]=this[_0x20e7('0x14')][_0x20e7('0x1d')];}var _0x476c70=this[_0x20e7('0x1a')];if(_0x476c70===_0x20e7('0x1e')){_0x1f4276['ChatWebsiteId']=this['account']['id'];}else{_0x1f4276[_[_0x20e7('0x1f')](_0x476c70)+_0x20e7('0x20')]=this[_0x20e7('0x21')]['id'];}_0x1f4276[_['upperFirst'](_0x476c70)+_0x20e7('0x22')]=this[_0x20e7('0x14')]['id'];if(this[_0x20e7('0x14')][_0x20e7('0x23')]){var _0x52ff31=_0x5828ba[0x4];if(!_['isEmpty'](_0x52ff31)){_0x1f4276[_0x20e7('0xb')]=utils[_0x20e7('0x24')](_0x52ff31,this);return rpc[_0x476c70+'Message'][_0x20e7('0xd')](_0x1f4276)[_0x20e7('0xe')](function(_0x1f618c){logger[_0x20e7('0xf')](_0x20e7('0x10'),_0xec613a,_0x1f4276[_0x20e7('0xb')]);})[_0x20e7('0x25')](function(_0x4b1aed){logger['error'](_0x20e7('0x10'),_0xec613a,JSON[_0x20e7('0x12')](_0x4b1aed));})[_0x20e7('0x26')](function(){logger['info'](_0x20e7('0x27'),_0xec613a);_0x126aa1[_0x20e7('0x28')]();});}else{logger[_0x20e7('0xf')](_0x20e7('0x29'),_0xec613a);_0x126aa1[_0x20e7('0x28')]();}}else{var _0x419adf=this;var _0x5ed3d3=_0x5828ba[0x2][_0x20e7('0x2a')](/\\n/g,'\x0a');var _0x284a54={'credentials':{'private_key':_0x5ed3d3,'client_email':_0x5828ba[0x1]}};var _0x14e8cf=new dialogflow[(_0x20e7('0x2b'))](_0x284a54);var _0x1aa4b3=_0x14e8cf['sessionPath'](_0x5828ba[0x0],md5(_0x419adf[_0x20e7('0x14')]['id']));var _0x377014={'session':_0x1aa4b3,'queryInput':{'text':{'text':_0x419adf[_0x20e7('0x2c')][_0x20e7('0xb')],'languageCode':_0x5828ba[0x3]||'en'}}};return _0x14e8cf[_0x20e7('0x2d')](_0x377014)['then'](function(_0x8d54fb){if(_0x8d54fb&&_0x8d54fb['length']){_0x419adf['body']['dialogflowV2']=_0x8d54fb;var _0x5e95ec=_0x8d54fb[0x0];var _0x3f63f6=_0x5e95ec['queryResult']['diagnosticInfo']&&_0x5e95ec[_0x20e7('0x2e')][_0x20e7('0x2f')][_0x20e7('0x30')]?_0x5e95ec[_0x20e7('0x2e')][_0x20e7('0x2f')][_0x20e7('0x30')][_0x20e7('0x31')][_0x20e7('0x32')]:![];_0x419adf['body'][_0x20e7('0x33')]=_0x5e95ec['queryResult']['action'];_0x419adf[_0x20e7('0xb')][_0x20e7('0x34')]=_0x5e95ec[_0x20e7('0x2e')][_0x20e7('0x35')];_0x419adf[_0x20e7('0xb')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x5e95ec[_0x20e7('0x2e')]['diagnosticInfo']&&_0x5e95ec[_0x20e7('0x2e')][_0x20e7('0x2f')][_0x20e7('0x30')]?_0x5e95ec[_0x20e7('0x2e')]['diagnosticInfo'][_0x20e7('0x30')][_0x20e7('0x31')][_0x20e7('0x32')]:![];_0x419adf[_0x20e7('0xb')][_0x20e7('0x36')]=_0x5e95ec[_0x20e7('0x2e')]['intent'][_0x20e7('0x37')];_0x419adf[_0x20e7('0xb')][_0x20e7('0x38')]=_0x5e95ec[_0x20e7('0x2e')][_0x20e7('0x39')]['displayName'];_0x419adf['body'][_0x20e7('0x3a')]=_0x5e95ec[_0x20e7('0x2e')][_0x20e7('0x39')][_0x20e7('0x3b')];_0x419adf['body'][_0x20e7('0x3c')]=_0x5e95ec[_0x20e7('0x2e')][_0x20e7('0x3d')];_0x419adf[_0x20e7('0xb')][_0x20e7('0x3e')]=_0x5e95ec[_0x20e7('0x2e')][_0x20e7('0x3f')];_0x419adf[_0x20e7('0xb')][_0x20e7('0x40')]=_0x5e95ec[_0x20e7('0x2e')][_0x20e7('0x41')];_0x1f4276[_0x20e7('0x42')]=_0x20e7('0x43');_0x1f4276['providerResponse']=JSON['stringify'](_0x8d54fb);var _0x51083a=[];for(var _0x4c9e54=0x0;_0x4c9e54<_0x8d54fb[_0x20e7('0x44')];_0x4c9e54++){var _0x3c6e41=_0x8d54fb[_0x4c9e54];if(_0x3c6e41&&_0x3c6e41[_0x20e7('0x2e')]&&_0x3c6e41[_0x20e7('0x2e')]['fulfillmentText']){_0x51083a['push'](createMessage(_0xec613a,_0x476c70,_0x1f4276,_0x3c6e41[_0x20e7('0x2e')][_0x20e7('0x45')]));}}return Promise[_0x20e7('0x46')](_0x51083a)[_0x20e7('0xe')](function(){if(_0x3f63f6){_0x126aa1[_0x20e7('0x47')]();}else{_0x126aa1[_0x20e7('0x28')]();}})[_0x20e7('0x25')](function(_0x2a54c7){logger['error'](_0x20e7('0x10'),_0xec613a,JSON['stringify'](_0x2a54c7));_0x126aa1['next']();});}})[_0x20e7('0x25')](function(_0x29ffa8){logger[_0x20e7('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0xec613a,_0x29ffa8[_0x20e7('0x2c')],_0x29ffa8['stack']);_0x126aa1['next']();});}}catch(_0x1ea097){logger['error'](_0x20e7('0x10'),_0xec613a,JSON['stringify'](_0x1ea097));_0x126aa1[_0x20e7('0x28')]();}};}; \ No newline at end of file +var _0xf5a2=['DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','length','fulfillmentText','all','stack','dialogflow','md5','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','create','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel','sms','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','then','info','[%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','message','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_LANGUAGECODE','languageCode'];(function(_0x38e94a,_0x5f02e1){var _0x3dde5e=function(_0xa8ea4c){while(--_0xa8ea4c){_0x38e94a['push'](_0x38e94a['shift']());}};_0x3dde5e(++_0x5f02e1);}(_0xf5a2,0x14f));var _0x2f5a=function(_0x638f75,_0x4b88bb){_0x638f75=_0x638f75-0x0;var _0x4ed9e8=_0xf5a2[_0x638f75];return _0x4ed9e8;};'use strict';var _=require('lodash');var dialogflow=require(_0x2f5a('0x0'));var md5=require(_0x2f5a('0x1'));var moment=require('moment');var Promise=require('bluebird');var logger=require(_0x2f5a('0x2'))(_0x2f5a('0x3'));var utils=require(_0x2f5a('0x4'));var rpc={'chatMessage':require(_0x2f5a('0x5')),'openchannelMessage':require(_0x2f5a('0x6')),'mailMessage':require(_0x2f5a('0x7')),'smsMessage':require(_0x2f5a('0x8')),'faxMessage':require(_0x2f5a('0x9')),'whatsappMessage':require(_0x2f5a('0xa'))};function createMessage(_0x4f3310,_0xf6879c,_0x1cd1c5,_0x15a754){return new Promise(function(_0x478702,_0xf9df53){var _0x8a5475=_['clone'](_0x1cd1c5);_0x8a5475[_0x2f5a('0xb')]=_0x15a754;return rpc[_0xf6879c+'Message'][_0x2f5a('0xc')](_0x8a5475)['then'](function(){logger['info'](_0x2f5a('0xd'),_0x4f3310,_0x8a5475[_0x2f5a('0xb')]);_0x478702();})[_0x2f5a('0xe')](function(_0x8e39f0){logger[_0x2f5a('0xf')](_0x2f5a('0xd'),_0x4f3310,JSON[_0x2f5a('0x10')](_0x8e39f0));_0xf9df53(_0x8e39f0);});});}exports['consequence']=function(_0x44696d,_0x49d6dc){return function(_0x1bd010){try{if(!_[_0x2f5a('0x11')](this[_0x2f5a('0x12')][_0x2f5a('0x13')])){logger['info'](_0x2f5a('0xd'),_0x44696d,_0x2f5a('0x14'));return _0x1bd010[_0x2f5a('0x15')]();}var _0x396cf2={'ContactId':this[_0x2f5a('0x16')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x2f5a('0x17')};if(this[_0x2f5a('0x18')]===_0x2f5a('0x19')||this[_0x2f5a('0x18')]==='whatsapp'){_0x396cf2['phone']=this[_0x2f5a('0x12')]['phone'];}var _0x146b71=this['channel'];if(_0x146b71==='chat'){_0x396cf2[_0x2f5a('0x1a')]=this[_0x2f5a('0x1b')]['id'];}else{_0x396cf2[_[_0x2f5a('0x1c')](_0x146b71)+_0x2f5a('0x1d')]=this[_0x2f5a('0x1b')]['id'];}_0x396cf2[_[_0x2f5a('0x1c')](_0x146b71)+_0x2f5a('0x1e')]=this[_0x2f5a('0x12')]['id'];if(this[_0x2f5a('0x12')]['created']){var _0x5e658c=_0x49d6dc[0x4];if(!_[_0x2f5a('0x1f')](_0x5e658c)){_0x396cf2['body']=utils['getMustacheRender'](_0x5e658c,this);return rpc[_0x146b71+'Message']['create'](_0x396cf2)[_0x2f5a('0x20')](function(_0x205c87){logger[_0x2f5a('0x21')](_0x2f5a('0xd'),_0x44696d,_0x396cf2[_0x2f5a('0xb')]);})['catch'](function(_0x6863a0){logger[_0x2f5a('0xf')](_0x2f5a('0xd'),_0x44696d,JSON[_0x2f5a('0x10')](_0x6863a0));})['finally'](function(){logger[_0x2f5a('0x21')](_0x2f5a('0x22'),_0x44696d);_0x1bd010[_0x2f5a('0x23')]();});}else{logger[_0x2f5a('0x21')](_0x2f5a('0x24'),_0x44696d);_0x1bd010[_0x2f5a('0x23')]();}}else{var _0x39d9bc=this;var _0x413c5d=_0x49d6dc[0x2][_0x2f5a('0x25')](/\\n/g,'\x0a');var _0x1ce2fb={'credentials':{'private_key':_0x413c5d,'client_email':_0x49d6dc[0x1]}};var _0x567b3e=new dialogflow[(_0x2f5a('0x26'))](_0x1ce2fb);var _0x393596=_0x567b3e[_0x2f5a('0x27')](_0x49d6dc[0x0],md5(_0x39d9bc[_0x2f5a('0x12')]['id']));var _0x2afe88={'session':_0x393596,'queryInput':{'text':{'text':_0x39d9bc[_0x2f5a('0x28')][_0x2f5a('0xb')],'languageCode':_0x49d6dc[0x3]||'en'}}};return _0x567b3e['detectIntent'](_0x2afe88)['then'](function(_0x276db8){if(_0x276db8&&_0x276db8['length']){_0x39d9bc[_0x2f5a('0xb')][_0x2f5a('0x29')]=_0x276db8;var _0x498cd2=_0x276db8[0x0];var _0x8c9a27=_0x498cd2[_0x2f5a('0x2a')][_0x2f5a('0x2b')]&&_0x498cd2[_0x2f5a('0x2a')][_0x2f5a('0x2b')][_0x2f5a('0x2c')]?_0x498cd2['queryResult'][_0x2f5a('0x2b')][_0x2f5a('0x2c')][_0x2f5a('0x2d')][_0x2f5a('0x2e')]:![];_0x39d9bc['body']['DIALOGFLOWV2_ACTION']=_0x498cd2['queryResult'][_0x2f5a('0x2f')];_0x39d9bc[_0x2f5a('0xb')][_0x2f5a('0x30')]=_0x498cd2[_0x2f5a('0x2a')][_0x2f5a('0x31')];_0x39d9bc[_0x2f5a('0xb')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x498cd2[_0x2f5a('0x2a')][_0x2f5a('0x2b')]&&_0x498cd2[_0x2f5a('0x2a')][_0x2f5a('0x2b')]['fields']?_0x498cd2['queryResult'][_0x2f5a('0x2b')][_0x2f5a('0x2c')][_0x2f5a('0x2d')][_0x2f5a('0x2e')]:![];_0x39d9bc[_0x2f5a('0xb')][_0x2f5a('0x32')]=_0x498cd2[_0x2f5a('0x2a')][_0x2f5a('0x33')]['name'];_0x39d9bc[_0x2f5a('0xb')][_0x2f5a('0x34')]=_0x498cd2[_0x2f5a('0x2a')][_0x2f5a('0x33')]['displayName'];_0x39d9bc[_0x2f5a('0xb')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x498cd2['queryResult'][_0x2f5a('0x33')]['isFallback'];_0x39d9bc[_0x2f5a('0xb')][_0x2f5a('0x35')]=_0x498cd2['queryResult'][_0x2f5a('0x36')];_0x39d9bc[_0x2f5a('0xb')][_0x2f5a('0x37')]=_0x498cd2['queryResult'][_0x2f5a('0x38')];_0x39d9bc[_0x2f5a('0xb')][_0x2f5a('0x39')]=_0x498cd2[_0x2f5a('0x2a')][_0x2f5a('0x3a')];_0x396cf2[_0x2f5a('0x3b')]='dialogflowV2';_0x396cf2[_0x2f5a('0x3c')]=JSON['stringify'](_0x276db8);var _0x307e9a=[];for(var _0x25eeac=0x0;_0x25eeac<_0x276db8[_0x2f5a('0x3d')];_0x25eeac++){var _0x1a51fd=_0x276db8[_0x25eeac];if(_0x1a51fd&&_0x1a51fd[_0x2f5a('0x2a')]&&_0x1a51fd['queryResult'][_0x2f5a('0x3e')]){_0x307e9a['push'](createMessage(_0x44696d,_0x146b71,_0x396cf2,_0x1a51fd[_0x2f5a('0x2a')][_0x2f5a('0x3e')]));}}return Promise[_0x2f5a('0x3f')](_0x307e9a)[_0x2f5a('0x20')](function(){if(_0x8c9a27){_0x1bd010[_0x2f5a('0x15')]();}else{_0x1bd010[_0x2f5a('0x23')]();}})[_0x2f5a('0xe')](function(_0x3840f6){logger[_0x2f5a('0xf')](_0x2f5a('0xd'),_0x44696d,JSON[_0x2f5a('0x10')](_0x3840f6));_0x1bd010[_0x2f5a('0x15')]();});}})[_0x2f5a('0xe')](function(_0x70035e){logger[_0x2f5a('0xf')](_0x2f5a('0xd'),_0x44696d,_0x70035e[_0x2f5a('0x28')],_0x70035e[_0x2f5a('0x40')]);_0x1bd010[_0x2f5a('0x15')]();});}}catch(_0x141f0d){logger[_0x2f5a('0xf')](_0x2f5a('0xd'),_0x44696d,JSON[_0x2f5a('0x10')](_0x141f0d));_0x1bd010[_0x2f5a('0x23')]();}};}; \ 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 26133cd..2a86c95 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 _0xeaa1=['map','message','join','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','stop','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','consequence','fromString','getMustacheRender','replace'];(function(_0x1b8050,_0x4d12c6){var _0x1ec2b1=function(_0x4c150a){while(--_0x4c150a){_0x1b8050['push'](_0x1b8050['shift']());}};_0x1ec2b1(++_0x4d12c6);}(_0xeaa1,0xa1));var _0x1eaa=function(_0x468639,_0x20a4e4){_0x468639=_0x468639-0x0;var _0x555039=_0xeaa1[_0x468639];return _0x555039;};'use strict';var schema=require(_0x1eaa('0x0'));var _=require(_0x1eaa('0x1'));var htmlToText=require(_0x1eaa('0x2'));var utils=require(_0x1eaa('0x3'));var logger=require(_0x1eaa('0x4'))(_0x1eaa('0x5'));var gotoif=schema({'condition':{'type':_0x1eaa('0x6'),'required':!![],'message':_0x1eaa('0x7')},'priorityTrue':{'type':'number','message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x1eaa('0x8'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x1eaa('0x9')]=function(_0x4118b9,_0x5dc4a1){return function(_0x3658ae){try{var _0x6c8630={'condition':htmlToText[_0x1eaa('0xa')](utils[_0x1eaa('0xb')](_0x5dc4a1[0x0],this),{'wordwrap':![]})[_0x1eaa('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5dc4a1[0x1],'priorityFalse':_0x5dc4a1[0x2]};var _0x6e7809=gotoif['validate'](_0x6c8630,{'typecast':!![]});if(_0x6e7809['length']){logger['error']('[%s][GOTOIF]\x20%s',_0x4118b9,_[_0x1eaa('0xd')](_0x6e7809,_0x1eaa('0xe'))[_0x1eaa('0xf')](',\x20'));_0x3658ae['stop']();}else{try{var _0x451081=eval('('+_0x6c8630[_0x1eaa('0x10')]+')');var _0x43077e=_0x451081?_0x6c8630['priorityTrue']:_0x6c8630[_0x1eaa('0x11')];logger[_0x1eaa('0x12')](_0x1eaa('0x13'),_0x4118b9,_0x6c8630[_0x1eaa('0x10')],_0x451081,_0x43077e||_0x1eaa('0x14'));if(_0x43077e){var _0x5eee5e=_[_0x1eaa('0x15')](_0x3658ae[_0x1eaa('0x16')](),{'p':_0x43077e});if(_0x5eee5e>=0x0){logger[_0x1eaa('0x12')](_0x1eaa('0x17'),_0x4118b9,_0x43077e||_0x1eaa('0x14'),_0x5eee5e);_0x3658ae[_0x1eaa('0x14')](_0x5eee5e);}else{logger['info'](_0x1eaa('0x18'),_0x4118b9,_0x43077e||_0x1eaa('0x14'));_0x3658ae['stop']();}}else{_0x3658ae[_0x1eaa('0x14')]();}}catch(_0x221442){logger[_0x1eaa('0x19')](_0x1eaa('0x1a'),_0x4118b9,_0x221442[_0x1eaa('0xe')]);_0x3658ae['stop']();}}}catch(_0x4323e4){logger[_0x1eaa('0x19')]('[%s][GOTOIF]\x20%s',_0x4118b9,JSON[_0x1eaa('0x1b')](_0x4323e4));_0x3658ae[_0x1eaa('0x1c')]();}};}; \ No newline at end of file +var _0x508e=['[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','length','error','[%s][GOTOIF]\x20%s','message','join','stop','condition','priorityTrue','priorityFalse','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x508e,0x16e));var _0xe508=function(_0x1ef93c,_0x178970){_0x1ef93c=_0x1ef93c-0x0;var _0x2394a6=_0x508e[_0x1ef93c];return _0x2394a6;};'use strict';var schema=require(_0xe508('0x0'));var _=require(_0xe508('0x1'));var htmlToText=require(_0xe508('0x2'));var utils=require(_0xe508('0x3'));var logger=require(_0xe508('0x4'))(_0xe508('0x5'));var gotoif=schema({'condition':{'type':_0xe508('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0xe508('0x7')},'priorityFalse':{'type':_0xe508('0x8'),'message':_0xe508('0x9')}});exports['consequence']=function(_0x54e3da,_0x56cbd2){return function(_0x5b8058){try{var _0x8c9b68={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x56cbd2[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x56cbd2[0x1],'priorityFalse':_0x56cbd2[0x2]};var _0x509ae0=gotoif[_0xe508('0x0')](_0x8c9b68,{'typecast':!![]});if(_0x509ae0[_0xe508('0xa')]){logger[_0xe508('0xb')](_0xe508('0xc'),_0x54e3da,_['map'](_0x509ae0,_0xe508('0xd'))[_0xe508('0xe')](',\x20'));_0x5b8058[_0xe508('0xf')]();}else{try{var _0x272710=eval('('+_0x8c9b68[_0xe508('0x10')]+')');var _0x112889=_0x272710?_0x8c9b68[_0xe508('0x11')]:_0x8c9b68[_0xe508('0x12')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x54e3da,_0x8c9b68[_0xe508('0x10')],_0x272710,_0x112889||_0xe508('0x13'));if(_0x112889){var _0x3e1c07=_[_0xe508('0x14')](_0x5b8058[_0xe508('0x15')](),{'p':_0x112889});if(_0x3e1c07>=0x0){logger[_0xe508('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x54e3da,_0x112889||'next',_0x3e1c07);_0x5b8058[_0xe508('0x13')](_0x3e1c07);}else{logger[_0xe508('0x16')](_0xe508('0x17'),_0x54e3da,_0x112889||_0xe508('0x13'));_0x5b8058[_0xe508('0xf')]();}}else{_0x5b8058['next']();}}catch(_0x148a07){logger[_0xe508('0xb')](_0xe508('0x18'),_0x54e3da,_0x148a07[_0xe508('0xd')]);_0x5b8058[_0xe508('0xf')]();}}}catch(_0x4df946){logger[_0xe508('0xb')]('[%s][GOTOIF]\x20%s',_0x54e3da,JSON[_0xe508('0x19')](_0x4df946));_0x5b8058[_0xe508('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 f14d4bd..92ea957 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 _0x1c38=['validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify'];(function(_0x16e2e8,_0x2d3359){var _0x3d47e6=function(_0xa124dd){while(--_0xa124dd){_0x16e2e8['push'](_0x16e2e8['shift']());}};_0x3d47e6(++_0x2d3359);}(_0x1c38,0xcf));var _0x81c3=function(_0x5a06a1,_0x421abd){_0x5a06a1=_0x5a06a1-0x0;var _0x4c354f=_0x1c38[_0x5a06a1];return _0x4c354f;};'use strict';var schema=require(_0x81c3('0x0'));var _=require(_0x81c3('0x1'));var logger=require(_0x81c3('0x2'))(_0x81c3('0x3'));var gotop=schema({'priority':{'type':_0x81c3('0x4'),'required':!![],'message':_0x81c3('0x5')}});exports[_0x81c3('0x6')]=function(_0x4c3e59,_0x2779f5){return function(_0x53bf04){try{var _0x543249={'priority':_0x2779f5[0x0]};var _0x588295=gotop[_0x81c3('0x0')](_0x543249,{'typecast':!![]});if(_0x588295[_0x81c3('0x7')]){logger[_0x81c3('0x8')](_0x81c3('0x9'),_0x4c3e59,_[_0x81c3('0xa')](_0x588295,_0x81c3('0xb'))[_0x81c3('0xc')](',\x20'));_0x53bf04[_0x81c3('0xd')]();}else{logger[_0x81c3('0xe')](_0x81c3('0xf'),_0x4c3e59,_0x543249['priority']);if(_0x543249[_0x81c3('0x10')]){var _0x316293=_[_0x81c3('0x11')](_0x53bf04[_0x81c3('0x12')](),{'p':_0x543249['priority']});if(_0x316293>=0x0){logger[_0x81c3('0xe')](_0x81c3('0x13'),_0x4c3e59,_0x543249[_0x81c3('0x10')]||_0x81c3('0x14'),_0x316293);_0x53bf04['next'](_0x316293);}else{logger[_0x81c3('0xe')](_0x81c3('0x15'),_0x4c3e59,_0x543249[_0x81c3('0x10')]||'next');_0x53bf04[_0x81c3('0xd')]();}}else{_0x53bf04['next']();}}}catch(_0x3058ca){logger[_0x81c3('0x8')](_0x81c3('0x9'),_0x4c3e59,JSON[_0x81c3('0x16')](_0x3058ca));_0x53bf04[_0x81c3('0xd')]();}};}; \ No newline at end of file +var _0x45d7=['stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','map','message','join'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x45d7,0x68));var _0x745d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x45d7[_0x17d9e3];return _0x14192d;};'use strict';var schema=require('validate');var _=require(_0x745d('0x0'));var logger=require(_0x745d('0x1'))('routing');var gotop=schema({'priority':{'type':_0x745d('0x2'),'required':!![],'message':_0x745d('0x3')}});exports[_0x745d('0x4')]=function(_0x2e79bc,_0x491738){return function(_0x5d9a5e){try{var _0x257d45={'priority':_0x491738[0x0]};var _0x59d317=gotop['validate'](_0x257d45,{'typecast':!![]});if(_0x59d317['length']){logger[_0x745d('0x5')](_0x745d('0x6'),_0x2e79bc,_[_0x745d('0x7')](_0x59d317,_0x745d('0x8'))[_0x745d('0x9')](',\x20'));_0x5d9a5e[_0x745d('0xa')]();}else{logger[_0x745d('0xb')](_0x745d('0xc'),_0x2e79bc,_0x257d45[_0x745d('0xd')]);if(_0x257d45['priority']){var _0x2ee7de=_['findIndex'](_0x5d9a5e[_0x745d('0xe')](),{'p':_0x257d45[_0x745d('0xd')]});if(_0x2ee7de>=0x0){logger[_0x745d('0xb')](_0x745d('0xf'),_0x2e79bc,_0x257d45[_0x745d('0xd')]||'next',_0x2ee7de);_0x5d9a5e[_0x745d('0x10')](_0x2ee7de);}else{logger[_0x745d('0xb')](_0x745d('0x11'),_0x2e79bc,_0x257d45[_0x745d('0xd')]||_0x745d('0x10'));_0x5d9a5e[_0x745d('0xa')]();}}else{_0x5d9a5e[_0x745d('0x10')]();}}}catch(_0x2b3bbc){logger[_0x745d('0x5')](_0x745d('0x6'),_0x2e79bc,JSON[_0x745d('0x12')](_0x2b3bbc));_0x5d9a5e['stop']();}};}; \ 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 fef6e7e..1409ae2 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 _0xa74b=['info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','create'];(function(_0x36d25e,_0x1a047d){var _0x4b95b8=function(_0x74da3){while(--_0x74da3){_0x36d25e['push'](_0x36d25e['shift']());}};_0x4b95b8(++_0x1a047d);}(_0xa74b,0x140));var _0xba74=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa74b[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xba74('0x0'));var utils=require(_0xba74('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xba74('0x2')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xba74('0x3')),'whatsappMessage':require(_0xba74('0x4'))};exports['consequence']=function(_0x36bc3e,_0x166929){return function(_0x2b96fe){try{var _0x36779c={'body':utils[_0xba74('0x5')](_0x166929[0x0],this),'ContactId':this[_0xba74('0x6')]['id']};if(this[_0xba74('0x7')]===_0xba74('0x8')){_0x36779c[_0xba74('0x9')]=this[_0xba74('0xa')]['id'];}else{_0x36779c[_[_0xba74('0xb')](this[_0xba74('0x7')])+_0xba74('0xc')]=this[_0xba74('0xa')]['id'];}_0x36779c[_[_0xba74('0xb')](this[_0xba74('0x7')])+_0xba74('0xd')]=this['interaction']['id'];if(rpc[this['channel']+_0xba74('0xe')]){return rpc[this['channel']+_0xba74('0xe')][_0xba74('0xf')](_0x36779c)['then'](function(_0x1b55db){logger[_0xba74('0x10')](_0xba74('0x11'),_0x36bc3e,_0x36779c[_0xba74('0x12')]);_0x2b96fe[_0xba74('0x13')]();})[_0xba74('0x14')](function(_0x588904){logger[_0xba74('0x15')](_0xba74('0x11'),_0x36bc3e,JSON[_0xba74('0x16')](_0x588904));_0x2b96fe[_0xba74('0x17')]();});}}catch(_0x5f147f){logger['error'](_0xba74('0x11'),_0x36bc3e,JSON['stringify'](_0x5f147f));_0x2b96fe[_0xba74('0x17')]();}};}; \ No newline at end of file +var _0x5523=['upperFirst','channel','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','catch','error','stop','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','chat','ChatWebsiteId','account','AccountId'];(function(_0xe35b1c,_0x1718dc){var _0x55fdd8=function(_0x1a2c22){while(--_0x1a2c22){_0xe35b1c['push'](_0xe35b1c['shift']());}};_0x55fdd8(++_0x1718dc);}(_0x5523,0x137));var _0x3552=function(_0xc76f55,_0x4ef44c){_0xc76f55=_0xc76f55-0x0;var _0x42cadf=_0x5523[_0xc76f55];return _0x42cadf;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0x3552('0x0'))(_0x3552('0x1'));var rpc={'chatMessage':require(_0x3552('0x2')),'openchannelMessage':require(_0x3552('0x3')),'mailMessage':require(_0x3552('0x4')),'smsMessage':require(_0x3552('0x5')),'faxMessage':require(_0x3552('0x6')),'whatsappMessage':require(_0x3552('0x7'))};exports[_0x3552('0x8')]=function(_0xe94944,_0x3225aa){return function(_0x58385b){try{var _0x5d2dc8={'body':utils['getMustacheRender'](_0x3225aa[0x0],this),'ContactId':this[_0x3552('0x9')]['id']};if(this['channel']===_0x3552('0xa')){_0x5d2dc8[_0x3552('0xb')]=this[_0x3552('0xc')]['id'];}else{_0x5d2dc8[_['upperFirst'](this['channel'])+_0x3552('0xd')]=this[_0x3552('0xc')]['id'];}_0x5d2dc8[_[_0x3552('0xe')](this[_0x3552('0xf')])+_0x3552('0x10')]=this[_0x3552('0x11')]['id'];if(rpc[this[_0x3552('0xf')]+_0x3552('0x12')]){return rpc[this[_0x3552('0xf')]+_0x3552('0x12')][_0x3552('0x13')](_0x5d2dc8)['then'](function(_0x295d0d){logger[_0x3552('0x14')](_0x3552('0x15'),_0xe94944,_0x5d2dc8['body']);_0x58385b['next']();})[_0x3552('0x16')](function(_0x3e90fc){logger[_0x3552('0x17')](_0x3552('0x15'),_0xe94944,JSON['stringify'](_0x3e90fc));_0x58385b[_0x3552('0x18')]();});}}catch(_0x268d39){logger[_0x3552('0x17')](_0x3552('0x15'),_0xe94944,JSON['stringify'](_0x268d39));_0x58385b[_0x3552('0x18')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index b973821..baf348d 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 _0x00c2=['consequence','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger'];(function(_0x1ac50e,_0x512ed5){var _0x522017=function(_0x30e1d1){while(--_0x30e1d1){_0x1ac50e['push'](_0x1ac50e['shift']());}};_0x522017(++_0x512ed5);}(_0x00c2,0x6a));var _0x200c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x00c2[_0x5b644e];return _0x49c6bf;};'use strict';var utils=require(_0x200c('0x0'));var logger=require(_0x200c('0x1'))('routing');exports[_0x200c('0x2')]=function(_0x54ec2f,_0x77bd71){return function(_0x2dc5cb){try{logger['info'](_0x200c('0x3'),_0x54ec2f,utils[_0x200c('0x4')](_0x77bd71[0x0],this));_0x2dc5cb[_0x200c('0x5')]();}catch(_0x3f06d1){logger[_0x200c('0x6')](_0x200c('0x3'),_0x54ec2f,JSON[_0x200c('0x7')](_0x3f06d1));_0x2dc5cb[_0x200c('0x8')]();}};}; \ No newline at end of file +var _0x18c6=['info','[%s][NOOP]\x20%s','next','error','stringify','stop','../../../../config/logger','consequence'];(function(_0x20d93a,_0x422a10){var _0x4e5cec=function(_0x56089c){while(--_0x56089c){_0x20d93a['push'](_0x20d93a['shift']());}};_0x4e5cec(++_0x422a10);}(_0x18c6,0x86));var _0x618c=function(_0x51b019,_0x3085c0){_0x51b019=_0x51b019-0x0;var _0x34d320=_0x18c6[_0x51b019];return _0x34d320;};'use strict';var utils=require('./utils');var logger=require(_0x618c('0x0'))('routing');exports[_0x618c('0x1')]=function(_0x23e4a6,_0x5a253e){return function(_0x13dfec){try{logger[_0x618c('0x2')](_0x618c('0x3'),_0x23e4a6,utils['getMustacheRender'](_0x5a253e[0x0],this));_0x13dfec[_0x618c('0x4')]();}catch(_0x3102cc){logger[_0x618c('0x5')](_0x618c('0x3'),_0x23e4a6,JSON[_0x618c('0x6')](_0x3102cc));_0x13dfec[_0x618c('0x7')]();}};}; \ 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 4bf9f8c..e9f3658 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 _0xe6f5=['error','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','QueueReport','catch','timeout','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','join','stop','find','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','util','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','account','queue','from','emit','clone','queue_id','push','capitalize','format','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','create'];(function(_0x2c0c8d,_0x4a86c7){var _0x114e7a=function(_0x5ef296){while(--_0x5ef296){_0x2c0c8d['push'](_0x2c0c8d['shift']());}};_0x114e7a(++_0x4a86c7);}(_0xe6f5,0x161));var _0x5e6f=function(_0x1c77ed,_0x5b9dae){_0x1c77ed=_0x1c77ed-0x0;var _0x4f372d=_0xe6f5[_0x1c77ed];return _0x4f372d;};'use strict';var schema=require(_0x5e6f('0x0'));var _=require('lodash');var util=require(_0x5e6f('0x1'));var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0x5e6f('0x2'));var config=require(_0x5e6f('0x3'));var logger=require(_0x5e6f('0x4'))(_0x5e6f('0x5'));var strategy=require('./strategy');config[_0x5e6f('0x6')]=_[_0x5e6f('0x7')](config[_0x5e6f('0x6')],{'host':_0x5e6f('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5e6f('0x6')]));var attributes=['id','queue_id',_0x5e6f('0x9'),_0x5e6f('0xa'),_0x5e6f('0xb'),'joinAt'];function emit(_0x3c90ee,_0x1c65f7,_0x10a73b){io['to'](_0x3c90ee)[_0x5e6f('0xc')](_0x1c65f7,_0x10a73b);}function emitChannelQueueInteraction(_0x35c29e,_0x119043,_0x387825,_0x17c2e1,_0x2d8015,_0xc54d49,_0xc4369d,_0x19b008){var _0x3dcee2=_[_0x5e6f('0xd')](_0x387825);_0x3dcee2[_0x5e6f('0xe')]=_0x19b008;_0x3dcee2[_0x5e6f('0xa')]=_0x119043;_0x3dcee2['account']=_0x17c2e1;_0x3dcee2['id']=_0x2d8015;if(_0xc54d49){attributes[_0x5e6f('0xf')](_[_0x5e6f('0x10')](_0x35c29e)+'InteractionId');_0xc4369d[util[_0x5e6f('0x11')]('%sQueuesWaitingInteractions',_0x35c29e)][_0x2d8015]=_[_0x5e6f('0x12')](_0x3dcee2,attributes);}else{delete _0xc4369d[util[_0x5e6f('0x11')]('%sQueuesWaitingInteractions',_0x35c29e)][_0x2d8015];}emit(util[_0x5e6f('0x11')](_0x5e6f('0x13'),_0x35c29e,_0x119043),util[_0x5e6f('0x11')](_0x5e6f('0x14'),_0x35c29e,_0xc54d49?_0x5e6f('0x15'):_0x5e6f('0x16')),_['pick'](_0x3dcee2,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x5e6f('0x17')),'chatQueueReport':require(_0x5e6f('0x18')),'smsQueueReport':require(_0x5e6f('0x19')),'faxQueueReport':require(_0x5e6f('0x1a')),'whatsappQueueReport':require(_0x5e6f('0x1b')),'chatInteraction':require(_0x5e6f('0x1c')),'faxInteraction':require(_0x5e6f('0x1d')),'mailInteraction':require(_0x5e6f('0x1e')),'openchannelInteraction':require(_0x5e6f('0x1f')),'smsInteraction':require(_0x5e6f('0x20')),'whatsappInteraction':require(_0x5e6f('0x21'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x5e6f('0x22')},'timeout':{'type':'number','message':_0x5e6f('0x23')}});function startRouting(_0x335ea4,_0x37157a,_0x3eb45a,_0x438ba2){if(_0x335ea4&&_0x37157a&&_0x3eb45a){_0x37157a[_0x5e6f('0x24')]+=0x1;var _0xe7f116={'uniqueid':_0x335ea4,'from':_0x3eb45a[_0x5e6f('0x25')]?_0x3eb45a[_0x5e6f('0x25')][_0x5e6f('0xb')]:'','joinAt':moment()[_0x5e6f('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3eb45a[_0x5e6f('0x26')]?_0x3eb45a[_0x5e6f('0x26')]['id']:null,'ListId':_0x3eb45a[_0x5e6f('0x27')]?_0x3eb45a[_0x5e6f('0x27')]['id']:null};_0xe7f116[_[_0x5e6f('0x28')](_0x3eb45a[_0x5e6f('0x29')])+_0x5e6f('0x2a')]=_0x37157a['id']||null;_0xe7f116[_[_0x5e6f('0x28')](_0x3eb45a[_0x5e6f('0x29')])+_0x5e6f('0x2b')]=_0x3eb45a[_0x5e6f('0x2c')]?_0x3eb45a[_0x5e6f('0x2c')]['id']:null;_0xe7f116[_[_0x5e6f('0x28')](_0x3eb45a[_0x5e6f('0x29')])+_0x5e6f('0x2d')]=_0x3eb45a[_0x5e6f('0x2e')]?_0x3eb45a[_0x5e6f('0x2e')]['id']:null;_0xe7f116[_[_0x5e6f('0x28')](_0x3eb45a[_0x5e6f('0x29')])+(_0x3eb45a[_0x5e6f('0x29')]!=='chat'?'AccountId':_0x5e6f('0x2f'))]=_0x3eb45a[_0x5e6f('0x9')]?_0x3eb45a[_0x5e6f('0x9')]['id']:null;logger[_0x5e6f('0x30')](util[_0x5e6f('0x11')](_0x5e6f('0x31'),_0x335ea4,_0x37157a[_0x5e6f('0x32')]));emitChannelQueueInteraction(_0x3eb45a[_0x5e6f('0x29')],_0x37157a['name'],_0xe7f116,_0x3eb45a['account']['name'],_0x3eb45a['message']['id'],!![],_0x438ba2,_0x37157a['id']);if(rpc[_0x3eb45a[_0x5e6f('0x29')]+'QueueReport']){return rpc[_0x3eb45a[_0x5e6f('0x29')]+'QueueReport'][_0x5e6f('0x33')](_0xe7f116)['catch'](function(_0x347a85){logger[_0x5e6f('0x34')]('create\x20queue\x20report',_0x347a85);});}}}function stopRouting(_0x215c4b,_0x1a755e,_0x59c6c2,_0x208493){if(_0x215c4b&&_0x1a755e){_0x1a755e[_0x5e6f('0x24')]-=0x1;var _0x38641c={'leaveAt':moment()[_0x5e6f('0x11')](_0x5e6f('0x35')),'acceptAt':moment()[_0x5e6f('0x11')](_0x5e6f('0x35')),'reason':_0x5e6f('0x36')};logger[_0x5e6f('0x30')](util[_0x5e6f('0x11')](_0x5e6f('0x37'),_0x215c4b,_0x1a755e[_0x5e6f('0x32')]));emitChannelQueueInteraction(_0x59c6c2[_0x5e6f('0x29')],_0x1a755e['name'],_0x59c6c2[_0x5e6f('0x25')],_0x59c6c2[_0x5e6f('0x9')][_0x5e6f('0x32')],_0x59c6c2[_0x5e6f('0x2e')]['id'],![],_0x208493,_0x1a755e['id']);return rpc[_0x59c6c2['channel']+_0x5e6f('0x38')][_0x5e6f('0x39')](_0x59c6c2[_0x5e6f('0x2c')]['id'],{'queueId':_0x1a755e['id']})[_0x5e6f('0x3a')](function(){if(rpc[_0x59c6c2[_0x5e6f('0x29')]+_0x5e6f('0x3b')]){return rpc[_0x59c6c2[_0x5e6f('0x29')]+_0x5e6f('0x3b')][_0x5e6f('0x39')](_0x215c4b,_0x38641c)[_0x5e6f('0x3c')](function(_0x265697){logger[_0x5e6f('0x34')]('update\x20queue\x20report',_0x265697);});}});}}function endRouting(_0x239c72,_0xea4396,_0x57f3a1,_0x3ea7b7){if(_0x239c72&&_0xea4396){_0xea4396[_0x5e6f('0x24')]-=0x1;var _0x4d0b65={'leaveAt':moment()[_0x5e6f('0x11')](_0x5e6f('0x35')),'exitAt':moment()['format'](_0x5e6f('0x35')),'reason':_0x5e6f('0x3d')};logger[_0x5e6f('0x30')](util[_0x5e6f('0x11')]('[%s][END:QUEUE][NAME:%s]',_0x239c72,_0xea4396['name']));emitChannelQueueInteraction(_0x57f3a1[_0x5e6f('0x29')],_0xea4396['name'],_0x57f3a1[_0x5e6f('0x25')],_0x57f3a1[_0x5e6f('0x9')][_0x5e6f('0x32')],_0x57f3a1['message']['id'],![],_0x3ea7b7);if(rpc[_0x57f3a1[_0x5e6f('0x29')]+'QueueReport']){return rpc[_0x57f3a1['channel']+_0x5e6f('0x3b')]['update'](_0x239c72,_0x4d0b65)[_0x5e6f('0x3c')](function(_0x5ce130){logger[_0x5e6f('0x34')](_0x5e6f('0x3e'),_0x5ce130);});}}}function handleFindQueue(_0x227463){return function(_0x9149f3){return _0x9149f3[_0x5e6f('0x32')][_0x5e6f('0x3f')]()===_0x227463[_0x5e6f('0x3f')]();};}exports['consequence']=function(_0xd41ef3,_0x504195,_0xccf76a,_0x5405d7){return function(_0x18442c){try{var _0x517652={'name':_0x504195[0x0],'timeout':_0x504195[0x1]};var _0x334ef2=queue['validate'](_0x517652,{'typecast':!![]});if(_0x334ef2[_0x5e6f('0x40')]){logger['error'](_0x5e6f('0x41'),_0xd41ef3,_['map'](_0x334ef2,_0x5e6f('0x2e'))[_0x5e6f('0x42')](',\x20'));_0x18442c[_0x5e6f('0x43')]();}else{var _0x148b1f=_[_0x5e6f('0x44')](_0xccf76a[_0x5405d7[_0x5e6f('0x29')]+'Queues'],handleFindQueue(_0x517652['name']));if(_0x148b1f){startRouting(_0xd41ef3,_0x148b1f,_0x5405d7,_0xccf76a);var _0x5888a2=(_0x148b1f[_0x5e6f('0x3d')]||0xa)*0x3e8;var _0x3ff30a=(_0x517652[_0x5e6f('0x3d')]||0x14)*0x3e8;var _0x1cfa16;if(_0x5888a2>_0x3ff30a){_0x3ff30a=_0x5888a2;}var _0x5c97d3=seqqueue['createQueue'](_0x5888a2);_0x5c97d3['id']=_0xd41ef3;_0x5c97d3['atimeout']=_0x5888a2;_0x5c97d3[_0x5e6f('0x45')]=_0x3ff30a;_0x5c97d3[_0x5e6f('0x29')]=_0x5405d7[_0x5e6f('0x29')];_0xccf76a[_0x5e6f('0x46')][_0xd41ef3]['on'](_0x5e6f('0x47'),function(){logger[_0x5e6f('0x30')](_0x5e6f('0x48'),_0xd41ef3);stopRouting(_0xd41ef3,_0x148b1f,_0x5405d7,_0xccf76a);clearTimeout(_0x1cfa16);_0x1cfa16=undefined;_0x5c97d3[_0x5e6f('0x49')](!![]);if(_0xccf76a[_0x5e6f('0x46')][_0xd41ef3]){delete _0xccf76a[_0x5e6f('0x46')][_0xd41ef3];}_0x18442c[_0x5e6f('0x43')]();});_0xccf76a['rules'][_0xd41ef3]['on'](_0x5e6f('0x4a'),function(){if(_0xccf76a['rules'][_0xd41ef3]){delete _0xccf76a[_0x5e6f('0x46')][_0xd41ef3];}});_0x1cfa16=setTimeout(function(){logger[_0x5e6f('0x30')](_0x5e6f('0x4b'),_0xd41ef3);endRouting(_0xd41ef3,_0x148b1f,_0x5405d7,_0xccf76a);clearTimeout(_0x1cfa16);_0x5c97d3[_0x5e6f('0x49')](!![]);_0x18442c['next']();},_0x3ff30a);switch(_0x148b1f[_0x5e6f('0x4c')]){case _0x5e6f('0x4d'):strategy[_0x5e6f('0x4d')](_0x5c97d3,_0x148b1f,_0xccf76a,_0x5405d7);break;default:strategy[_0x5e6f('0x4e')](_0x5c97d3,_0x148b1f,_0xccf76a,_0x5405d7);}}else{logger['error'](_0x5e6f('0x4f'),_0xd41ef3,_0x517652[_0x5e6f('0x32')]);_0x18442c[_0x5e6f('0x43')]();}}}catch(_0x410aff){logger[_0x5e6f('0x34')](_0x5e6f('0x41'),_0xd41ef3,_0x410aff[_0x5e6f('0x50')]);_0x18442c[_0x5e6f('0x43')]();}};}; \ No newline at end of file +var _0x5367=['catch','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','error','update\x20queue\x20report','waiting','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','moment','ioredis','../../../../config/environment','routing','redis','defaults','localhost','socket.io-emitter','account','queue','joinAt','queue_id','push','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/openchannelInteraction','string','number','timeout\x20is\x20a\x20number','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport'];(function(_0x4c9eff,_0x369f99){var _0xd53f88=function(_0x506a81){while(--_0x506a81){_0x4c9eff['push'](_0x4c9eff['shift']());}};_0xd53f88(++_0x369f99);}(_0x5367,0x6e));var _0x7536=function(_0x1498fb,_0x111d3b){_0x1498fb=_0x1498fb-0x0;var _0x59ad93=_0x5367[_0x1498fb];return _0x59ad93;};'use strict';var schema=require(_0x7536('0x0'));var _=require(_0x7536('0x1'));var util=require(_0x7536('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x7536('0x3'));var Redis=require(_0x7536('0x4'));var config=require(_0x7536('0x5'));var logger=require('../../../../config/logger')(_0x7536('0x6'));var strategy=require('./strategy');config[_0x7536('0x7')]=_[_0x7536('0x8')](config[_0x7536('0x7')],{'host':_0x7536('0x9'),'port':0x18eb});var io=require(_0x7536('0xa'))(new Redis(config['redis']));var attributes=['id','queue_id',_0x7536('0xb'),_0x7536('0xc'),'from',_0x7536('0xd')];function emit(_0xd01b43,_0x431b5a,_0x1614af){io['to'](_0xd01b43)['emit'](_0x431b5a,_0x1614af);}function emitChannelQueueInteraction(_0x2fc2e6,_0x1858b7,_0x500d21,_0x452c74,_0x362c8a,_0xd9cd43,_0x501763,_0x15c4af){var _0x230d3f=_['clone'](_0x500d21);_0x230d3f[_0x7536('0xe')]=_0x15c4af;_0x230d3f[_0x7536('0xc')]=_0x1858b7;_0x230d3f[_0x7536('0xb')]=_0x452c74;_0x230d3f['id']=_0x362c8a;if(_0xd9cd43){attributes[_0x7536('0xf')](_['capitalize'](_0x2fc2e6)+'InteractionId');_0x501763[util[_0x7536('0x10')]('%sQueuesWaitingInteractions',_0x2fc2e6)][_0x362c8a]=_[_0x7536('0x11')](_0x230d3f,attributes);}else{delete _0x501763[util['format'](_0x7536('0x12'),_0x2fc2e6)][_0x362c8a];}emit(util[_0x7536('0x10')](_0x7536('0x13'),_0x2fc2e6,_0x1858b7),util[_0x7536('0x10')](_0x7536('0x14'),_0x2fc2e6,_0xd9cd43?_0x7536('0x15'):'remove'),_[_0x7536('0x11')](_0x230d3f,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x7536('0x16')),'faxQueueReport':require(_0x7536('0x17')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0x7536('0x18')),'faxInteraction':require(_0x7536('0x19')),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require(_0x7536('0x1a')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0x7536('0x1b'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x7536('0x1c'),'message':_0x7536('0x1d')}});function startRouting(_0x5334f2,_0x25877f,_0x599e72,_0x1a4527){if(_0x5334f2&&_0x25877f&&_0x599e72){_0x25877f['waiting']+=0x1;var _0x613153={'uniqueid':_0x5334f2,'from':_0x599e72[_0x7536('0x1e')]?_0x599e72[_0x7536('0x1e')][_0x7536('0x1f')]:'','joinAt':moment()[_0x7536('0x10')](_0x7536('0x20')),'ContactId':_0x599e72['contact']?_0x599e72[_0x7536('0x21')]['id']:null,'ListId':_0x599e72[_0x7536('0x22')]?_0x599e72[_0x7536('0x22')]['id']:null};_0x613153[_[_0x7536('0x23')](_0x599e72[_0x7536('0x24')])+_0x7536('0x25')]=_0x25877f['id']||null;_0x613153[_[_0x7536('0x23')](_0x599e72[_0x7536('0x24')])+_0x7536('0x26')]=_0x599e72[_0x7536('0x27')]?_0x599e72['interaction']['id']:null;_0x613153[_[_0x7536('0x23')](_0x599e72[_0x7536('0x24')])+_0x7536('0x28')]=_0x599e72['message']?_0x599e72[_0x7536('0x29')]['id']:null;_0x613153[_[_0x7536('0x23')](_0x599e72[_0x7536('0x24')])+(_0x599e72['channel']!==_0x7536('0x2a')?_0x7536('0x2b'):'WebsiteId')]=_0x599e72[_0x7536('0xb')]?_0x599e72['account']['id']:null;logger[_0x7536('0x2c')](util[_0x7536('0x10')](_0x7536('0x2d'),_0x5334f2,_0x25877f[_0x7536('0x2e')]));emitChannelQueueInteraction(_0x599e72[_0x7536('0x24')],_0x25877f[_0x7536('0x2e')],_0x613153,_0x599e72[_0x7536('0xb')][_0x7536('0x2e')],_0x599e72[_0x7536('0x29')]['id'],!![],_0x1a4527,_0x25877f['id']);if(rpc[_0x599e72[_0x7536('0x24')]+_0x7536('0x2f')]){return rpc[_0x599e72[_0x7536('0x24')]+_0x7536('0x2f')]['create'](_0x613153)[_0x7536('0x30')](function(_0x2c8193){logger['error']('create\x20queue\x20report',_0x2c8193);});}}}function stopRouting(_0x2febad,_0xac7082,_0x292343,_0x5ec6b9){if(_0x2febad&&_0xac7082){_0xac7082['waiting']-=0x1;var _0x2ef3a1={'leaveAt':moment()[_0x7536('0x10')](_0x7536('0x20')),'acceptAt':moment()[_0x7536('0x10')](_0x7536('0x20')),'reason':_0x7536('0x31')};logger[_0x7536('0x2c')](util['format'](_0x7536('0x32'),_0x2febad,_0xac7082['name']));emitChannelQueueInteraction(_0x292343[_0x7536('0x24')],_0xac7082['name'],_0x292343[_0x7536('0x1e')],_0x292343['account'][_0x7536('0x2e')],_0x292343[_0x7536('0x29')]['id'],![],_0x5ec6b9,_0xac7082['id']);return rpc[_0x292343[_0x7536('0x24')]+_0x7536('0x33')]['update'](_0x292343[_0x7536('0x27')]['id'],{'queueId':_0xac7082['id']})['then'](function(){if(rpc[_0x292343[_0x7536('0x24')]+_0x7536('0x2f')]){return rpc[_0x292343[_0x7536('0x24')]+_0x7536('0x2f')][_0x7536('0x34')](_0x2febad,_0x2ef3a1)['catch'](function(_0x5c5e8a){logger[_0x7536('0x35')](_0x7536('0x36'),_0x5c5e8a);});}});}}function endRouting(_0x26ecc5,_0x3923f2,_0x300735,_0x49c504){if(_0x26ecc5&&_0x3923f2){_0x3923f2[_0x7536('0x37')]-=0x1;var _0xcc6d62={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x7536('0x10')](_0x7536('0x20')),'reason':'timeout'};logger[_0x7536('0x2c')](util[_0x7536('0x10')](_0x7536('0x38'),_0x26ecc5,_0x3923f2[_0x7536('0x2e')]));emitChannelQueueInteraction(_0x300735[_0x7536('0x24')],_0x3923f2[_0x7536('0x2e')],_0x300735[_0x7536('0x1e')],_0x300735['account'][_0x7536('0x2e')],_0x300735['message']['id'],![],_0x49c504);if(rpc[_0x300735[_0x7536('0x24')]+_0x7536('0x2f')]){return rpc[_0x300735[_0x7536('0x24')]+_0x7536('0x2f')][_0x7536('0x34')](_0x26ecc5,_0xcc6d62)[_0x7536('0x30')](function(_0x20bbdc){logger[_0x7536('0x35')]('update\x20queue\x20report',_0x20bbdc);});}}}function handleFindQueue(_0x275d26){return function(_0x2769b8){return _0x2769b8[_0x7536('0x2e')][_0x7536('0x39')]()===_0x275d26[_0x7536('0x39')]();};}exports[_0x7536('0x3a')]=function(_0x4597fb,_0x4714a3,_0x51fd38,_0x290359){return function(_0x33c5e0){try{var _0x56b43e={'name':_0x4714a3[0x0],'timeout':_0x4714a3[0x1]};var _0x46e7bf=queue['validate'](_0x56b43e,{'typecast':!![]});if(_0x46e7bf['length']){logger[_0x7536('0x35')](_0x7536('0x3b'),_0x4597fb,_[_0x7536('0x3c')](_0x46e7bf,_0x7536('0x29'))[_0x7536('0x3d')](',\x20'));_0x33c5e0[_0x7536('0x3e')]();}else{var _0xedf608=_[_0x7536('0x3f')](_0x51fd38[_0x290359[_0x7536('0x24')]+_0x7536('0x40')],handleFindQueue(_0x56b43e['name']));if(_0xedf608){startRouting(_0x4597fb,_0xedf608,_0x290359,_0x51fd38);var _0x136240=(_0xedf608['timeout']||0xa)*0x3e8;var _0x294756=(_0x56b43e[_0x7536('0x41')]||0x14)*0x3e8;var _0x2e526c;if(_0x136240>_0x294756){_0x294756=_0x136240;}var _0x2ebada=seqqueue[_0x7536('0x42')](_0x136240);_0x2ebada['id']=_0x4597fb;_0x2ebada[_0x7536('0x43')]=_0x136240;_0x2ebada[_0x7536('0x44')]=_0x294756;_0x2ebada[_0x7536('0x24')]=_0x290359[_0x7536('0x24')];_0x51fd38[_0x7536('0x45')][_0x4597fb]['on']('end',function(){logger[_0x7536('0x2c')](_0x7536('0x46'),_0x4597fb);stopRouting(_0x4597fb,_0xedf608,_0x290359,_0x51fd38);clearTimeout(_0x2e526c);_0x2e526c=undefined;_0x2ebada[_0x7536('0x47')](!![]);if(_0x51fd38[_0x7536('0x45')][_0x4597fb]){delete _0x51fd38[_0x7536('0x45')][_0x4597fb];}_0x33c5e0[_0x7536('0x3e')]();});_0x51fd38[_0x7536('0x45')][_0x4597fb]['on'](_0x7536('0x48'),function(){if(_0x51fd38['rules'][_0x4597fb]){delete _0x51fd38['rules'][_0x4597fb];}});_0x2e526c=setTimeout(function(){logger[_0x7536('0x2c')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x4597fb);endRouting(_0x4597fb,_0xedf608,_0x290359,_0x51fd38);clearTimeout(_0x2e526c);_0x2ebada[_0x7536('0x47')](!![]);_0x33c5e0[_0x7536('0x49')]();},_0x294756);switch(_0xedf608[_0x7536('0x4a')]){case'rrmemory':strategy[_0x7536('0x4b')](_0x2ebada,_0xedf608,_0x51fd38,_0x290359);break;default:strategy[_0x7536('0x4c')](_0x2ebada,_0xedf608,_0x51fd38,_0x290359);}}else{logger['error'](_0x7536('0x4d'),_0x4597fb,_0x56b43e[_0x7536('0x2e')]);_0x33c5e0[_0x7536('0x3e')]();}}}catch(_0x37222d){logger[_0x7536('0x35')](_0x7536('0x3b'),_0x4597fb,_0x37222d[_0x7536('0x4e')]);_0x33c5e0['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index fc36f97..ed2c840 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 _0x81bd=['writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','bind','timeout','handleTimeout','drained','handleDrained','prototype','push','handleRun','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','saveWaitingNotification','showNotification'];(function(_0x3fc51b,_0x5b2bbf){var _0x3a5937=function(_0x4fbc7c){while(--_0x4fbc7c){_0x3fc51b['push'](_0x3fc51b['shift']());}};_0x3a5937(++_0x5b2bbf);}(_0x81bd,0x7c));var _0xd81b=function(_0x27ad07,_0x2d3d47){_0x27ad07=_0x27ad07-0x0;var _0x3148b4=_0x81bd[_0x27ad07];return _0x3148b4;};'use strict';var _=require(_0xd81b('0x0'));var uuid=require(_0xd81b('0x1'));var util=require(_0xd81b('0x2'));var logger=require(_0xd81b('0x3'))(_0xd81b('0x4'));var Agent=function(_0x2ec03a,_0x111a9c,_0x54e096,_0x16e8de){this[_0xd81b('0x5')]=uuid['v4']();this[_0xd81b('0x6')]=_0x2ec03a;this['agent']=_0x111a9c;this[_0xd81b('0x7')]=_0x54e096;this[_0xd81b('0x4')]=_0x16e8de;this[_0xd81b('0x6')]['push'](this['handleRun'][_0xd81b('0x8')](this),this['handleTimeout'][_0xd81b('0x8')](this));this[_0xd81b('0x6')]['on'](_0xd81b('0x9'),this[_0xd81b('0xa')][_0xd81b('0x8')](this));this[_0xd81b('0x6')]['on'](_0xd81b('0xb'),this[_0xd81b('0xc')][_0xd81b('0x8')](this));};Agent[_0xd81b('0xd')][_0xd81b('0xe')]=function(){this[_0xd81b('0x6')][_0xd81b('0xe')](this['handleRun'][_0xd81b('0x8')](this),this['handleTimeout'][_0xd81b('0x8')](this));};Agent[_0xd81b('0xd')]['handleDrained']=function(){this[_0xd81b('0xa')](!![]);};Agent['prototype'][_0xd81b('0xf')]=function(){logger[_0xd81b('0x10')](_0xd81b('0x11'),this[_0xd81b('0x6')]['id'],this[_0xd81b('0x12')]['id']);if(_['isNil'](this[_0xd81b('0x7')][_0xd81b('0x13')][this['agent']['id']])){logger[_0xd81b('0x10')](_0xd81b('0x14'),this[_0xd81b('0x6')]['id'],this[_0xd81b('0x12')]['id']);setTimeout(this[_0xd81b('0xe')][_0xd81b('0x8')](this),0x3e8);}else{if(this[_0xd81b('0x4')][_0xd81b('0x15')]||util[_0xd81b('0x16')](this[_0xd81b('0x6')]['id'],this[_0xd81b('0x7')][_0xd81b('0x13')][this[_0xd81b('0x12')]['id']],this[_0xd81b('0x6')][_0xd81b('0x17')],![])){this[_0xd81b('0x7')]['agents'][this['agent']['id']][_0xd81b('0x18')]=!![];this[_0xd81b('0x7')][_0xd81b('0x13')][this['agent']['id']][_0xd81b('0x19')]=undefined;util[_0xd81b('0x1a')](this['realtime'],this[_0xd81b('0x4')],this[_0xd81b('0x12')],this[_0xd81b('0x6')][_0xd81b('0x17')]);util[_0xd81b('0x1b')](this[_0xd81b('0x5')],this[_0xd81b('0x6')]['id'],this[_0xd81b('0x7')][_0xd81b('0x13')][this[_0xd81b('0x12')]['id']],null,this[_0xd81b('0x4')]);util[_0xd81b('0x1c')](this['squeue']['id'],this[_0xd81b('0x7')][_0xd81b('0x13')][this[_0xd81b('0x12')]['id']],_0xd81b('0x1d')+(this[_0xd81b('0x4')][_0xd81b('0x15')]?_0xd81b('0x1e'):''));}else{logger[_0xd81b('0x10')](_0xd81b('0x1f'),this['squeue']['id'],this[_0xd81b('0x12')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0xd81b('0xd')][_0xd81b('0xa')]=function(_0x5141e6){if(_['isNil'](this[_0xd81b('0x7')][_0xd81b('0x13')][this[_0xd81b('0x12')]['id']])){return logger[_0xd81b('0x10')](_0xd81b('0x14'),this[_0xd81b('0x6')]['id'],this['agent']['id']);}else{logger[_0xd81b('0x10')](_0xd81b('0x20'),this['squeue']['id'],this['agent']['id']);util[_0xd81b('0x21')](this[_0xd81b('0x5')],this['squeue']['id'],this['realtime']['agents'][this[_0xd81b('0x12')]['id']],null,this[_0xd81b('0x4')]);this[_0xd81b('0x7')][_0xd81b('0x13')][this[_0xd81b('0x12')]['id']][_0xd81b('0x18')]=![];this[_0xd81b('0x7')]['agents'][this[_0xd81b('0x12')]['id']]['busyQueue']=undefined;util[_0xd81b('0x22')](this[_0xd81b('0x7')],this[_0xd81b('0x4')],this[_0xd81b('0x12')],this[_0xd81b('0x6')][_0xd81b('0x17')]);util[_0xd81b('0x1c')](this[_0xd81b('0x6')]['id'],this[_0xd81b('0x7')][_0xd81b('0x13')][this[_0xd81b('0x12')]['id']],_0x5141e6?_0xd81b('0x23'):_0xd81b('0x24'));}if(!_0x5141e6){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x413bf6,_0x46119e,_0x401430,_0x59c066){return new Agent(_0x413bf6,_0x46119e,_0x401430,_0x59c066);}module[_0xd81b('0x25')]=agent; \ No newline at end of file +var _0x6aa7=['STOP','exports','lodash','./util','../../../../../config/logger','routing','notificationId','realtime','squeue','push','handleRun','handleTimeout','bind','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','debug','forcedOwnership','channel','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x6aa7,0x178));var _0x76aa=function(_0x4bc55b,_0x4c8698){_0x4bc55b=_0x4bc55b-0x0;var _0x132f8f=_0x6aa7[_0x4bc55b];return _0x132f8f;};'use strict';var _=require(_0x76aa('0x0'));var uuid=require('uuid');var util=require(_0x76aa('0x1'));var logger=require(_0x76aa('0x2'))(_0x76aa('0x3'));var Agent=function(_0x2db4fe,_0x4f007e,_0x13f62b,_0xef15ef){this[_0x76aa('0x4')]=uuid['v4']();this['squeue']=_0x2db4fe;this['agent']=_0x4f007e;this[_0x76aa('0x5')]=_0x13f62b;this['routing']=_0xef15ef;this[_0x76aa('0x6')][_0x76aa('0x7')](this[_0x76aa('0x8')]['bind'](this),this[_0x76aa('0x9')][_0x76aa('0xa')](this));this[_0x76aa('0x6')]['on']('timeout',this[_0x76aa('0x9')][_0x76aa('0xa')](this));this[_0x76aa('0x6')]['on'](_0x76aa('0xb'),this[_0x76aa('0xc')][_0x76aa('0xa')](this));};Agent[_0x76aa('0xd')][_0x76aa('0x7')]=function(){this[_0x76aa('0x6')][_0x76aa('0x7')](this['handleRun'][_0x76aa('0xa')](this),this['handleTimeout'][_0x76aa('0xa')](this));};Agent[_0x76aa('0xd')][_0x76aa('0xc')]=function(){this[_0x76aa('0x9')](!![]);};Agent[_0x76aa('0xd')]['handleRun']=function(){logger['debug'](_0x76aa('0xe'),this['squeue']['id'],this[_0x76aa('0xf')]['id']);if(_[_0x76aa('0x10')](this['realtime'][_0x76aa('0x11')][this['agent']['id']])){logger[_0x76aa('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x76aa('0x6')]['id'],this[_0x76aa('0xf')]['id']);setTimeout(this[_0x76aa('0x7')][_0x76aa('0xa')](this),0x3e8);}else{if(this[_0x76aa('0x3')][_0x76aa('0x13')]||util['isAgentAvailable'](this['squeue']['id'],this[_0x76aa('0x5')][_0x76aa('0x11')][this[_0x76aa('0xf')]['id']],this[_0x76aa('0x6')][_0x76aa('0x14')],![])){this[_0x76aa('0x5')][_0x76aa('0x11')][this[_0x76aa('0xf')]['id']][_0x76aa('0x15')]=!![];this['realtime'][_0x76aa('0x11')][this[_0x76aa('0xf')]['id']][_0x76aa('0x16')]=undefined;util['saveWaitingNotification'](this[_0x76aa('0x5')],this[_0x76aa('0x3')],this[_0x76aa('0xf')],this[_0x76aa('0x6')][_0x76aa('0x14')]);util[_0x76aa('0x17')](this[_0x76aa('0x4')],this[_0x76aa('0x6')]['id'],this[_0x76aa('0x5')][_0x76aa('0x11')][this[_0x76aa('0xf')]['id']],null,this[_0x76aa('0x3')]);util[_0x76aa('0x18')](this['squeue']['id'],this[_0x76aa('0x5')][_0x76aa('0x11')][this[_0x76aa('0xf')]['id']],_0x76aa('0x19')+(this[_0x76aa('0x3')][_0x76aa('0x13')]?_0x76aa('0x1a'):''));}else{logger[_0x76aa('0x12')](_0x76aa('0x1b'),this[_0x76aa('0x6')]['id'],this['agent']['id']);setTimeout(this[_0x76aa('0x7')]['bind'](this),0x3e8);}}};Agent[_0x76aa('0xd')][_0x76aa('0x9')]=function(_0x2dec94){if(_[_0x76aa('0x10')](this[_0x76aa('0x5')][_0x76aa('0x11')][this[_0x76aa('0xf')]['id']])){return logger[_0x76aa('0x12')](_0x76aa('0x1c'),this[_0x76aa('0x6')]['id'],this['agent']['id']);}else{logger[_0x76aa('0x12')](_0x76aa('0x1d'),this[_0x76aa('0x6')]['id'],this[_0x76aa('0xf')]['id']);util[_0x76aa('0x1e')](this[_0x76aa('0x4')],this[_0x76aa('0x6')]['id'],this['realtime'][_0x76aa('0x11')][this[_0x76aa('0xf')]['id']],null,this['routing']);this[_0x76aa('0x5')]['agents'][this[_0x76aa('0xf')]['id']]['busy']=![];this[_0x76aa('0x5')]['agents'][this['agent']['id']][_0x76aa('0x16')]=undefined;util[_0x76aa('0x1f')](this[_0x76aa('0x5')],this[_0x76aa('0x3')],this['agent'],this['squeue'][_0x76aa('0x14')]);util[_0x76aa('0x18')](this[_0x76aa('0x6')]['id'],this[_0x76aa('0x5')][_0x76aa('0x11')][this['agent']['id']],_0x2dec94?_0x76aa('0x20'):'TIMEOUT');}if(!_0x2dec94){setTimeout(this['push'][_0x76aa('0xa')](this),0x3e8);}};function agent(_0x36d64e,_0x181216,_0x127bc4,_0x48cf51){return new Agent(_0x36d64e,_0x181216,_0x127bc4,_0x48cf51);}module[_0x76aa('0x21')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 85d87e0..f1001b7 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 _0xa1f1=['drained','handleDrained','prototype','isNil','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','busy','busyQueue','name','saveWaitingNotification','showNotification','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','STOP','removeWaitingNotification','exports','uuid','routing','queue','realtime','squeue','push','handleRun','bind','handleTimeout','timeout'];(function(_0x1f6e85,_0x46ac39){var _0x1c9d9f=function(_0x2ba5dc){while(--_0x2ba5dc){_0x1f6e85['push'](_0x1f6e85['shift']());}};_0x1c9d9f(++_0x46ac39);}(_0xa1f1,0xfe));var _0x1a1f=function(_0x5e9876,_0x16052d){_0x5e9876=_0x5e9876-0x0;var _0x576c48=_0xa1f1[_0x5e9876];return _0x576c48;};'use strict';var _=require('lodash');var uuid=require(_0x1a1f('0x0'));var util=require('./util');var logger=require('../../../../../config/logger')(_0x1a1f('0x1'));var Beepall=function(_0x240f39,_0x314a62,_0x253ae4,_0x49ef9d){this['notificationId']=uuid['v4']();this['squeue']=_0x240f39;this[_0x1a1f('0x2')]=_0x314a62;this[_0x1a1f('0x3')]=_0x253ae4;this[_0x1a1f('0x1')]=_0x49ef9d;this[_0x1a1f('0x4')][_0x1a1f('0x5')](this[_0x1a1f('0x6')][_0x1a1f('0x7')](this),this[_0x1a1f('0x8')][_0x1a1f('0x7')](this));this[_0x1a1f('0x4')]['on'](_0x1a1f('0x9'),this['handleTimeout'][_0x1a1f('0x7')](this));this[_0x1a1f('0x4')]['on'](_0x1a1f('0xa'),this[_0x1a1f('0xb')][_0x1a1f('0x7')](this));};Beepall[_0x1a1f('0xc')][_0x1a1f('0x5')]=function(){this[_0x1a1f('0x4')][_0x1a1f('0x5')](this[_0x1a1f('0x6')][_0x1a1f('0x7')](this),this[_0x1a1f('0x8')][_0x1a1f('0x7')](this));};Beepall['prototype'][_0x1a1f('0xb')]=function(){this[_0x1a1f('0x8')](!![]);};Beepall[_0x1a1f('0xc')][_0x1a1f('0x6')]=function(){var _0x5f6ef2=!![];if(!_[_0x1a1f('0xd')](this[_0x1a1f('0x2')])&&!_['isNil'](this[_0x1a1f('0x2')][_0x1a1f('0xe')])&&this[_0x1a1f('0x2')][_0x1a1f('0xe')]['length']>0x0){for(var _0x20f229=0x0,_0x392e36;_0x20f2290x0){for(var _0x55d711=0x0,_0x931a39;_0x55d7110x0&&_0x8c1714[_0x10ac92+_0x7436('0x22')]>=_0x8c1714[_0x10ac92+_0x7436('0x21')]){writeLog(_0x32b16a,_0x8c1714,_0x10ac92['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x5272d8,_0x4690df,_0x3f9908,_0x4142d0,_0x176fb0){return sendNotification(!![],_0x5272d8,_0x4690df,_0x3f9908,_0x4142d0,_0x176fb0);};exports['hideNotification']=function(_0x4bf7b0,_0x2e3c7e,_0x4f30ee,_0x1c40d9,_0x10ffc3){return sendNotification(![],_0x4bf7b0,_0x2e3c7e,_0x4f30ee,_0x1c40d9,_0x10ffc3);};exports[_0x7436('0x23')]=function(_0x4475f1,_0x118b5f,_0x38a086){var _0x15b3fe=_0x118b5f[_0x7436('0x24')][_0x7436('0x25')];if(!_0x15b3fe&&_0x38a086){_0x15b3fe=_0x38a086['id'];}var _0x54609f=_['some'](_0x4475f1[_0x118b5f[_0x7436('0x26')]+_0x7436('0x27')],function(_0x29a3ea){var _0x23738e=_['capitalize'](_0x118b5f[_0x7436('0x26')])+_0x7436('0x28');return _0x29a3ea[_0x23738e]===_0x118b5f['interaction']['id'];});if(!_0x54609f&&_0x15b3fe&&_0x4475f1[_0x7436('0x29')][_0x15b3fe]){_0x54609f=_[_0x7436('0x2a')](_0x4475f1['agents'][_0x15b3fe][_0x118b5f['channel']+_0x7436('0x2b')],function(_0x11bc30){return _0x11bc30['id']===_0x118b5f[_0x7436('0x24')]['id'];});}return _0x54609f;};exports[_0x7436('0x2c')]=function(_0x571972,_0x3d7b24,_0x12a6c4,_0x4e1673){if(_0x12a6c4&&_0x12a6c4['id']&&_0x571972[_0x7436('0x29')]&&_0x571972[_0x7436('0x29')][_0x12a6c4['id']]){_0x571972[_0x7436('0x29')][_0x12a6c4['id']][_0x4e1673+_0x7436('0x2b')][_0x3d7b24[_0x7436('0x2d')]['id']]={'id':_0x3d7b24[_0x7436('0x24')]['id']};}};exports[_0x7436('0x2e')]=function(_0x170602,_0x3e330a,_0x611a0b,_0x54a74b){if(_0x611a0b&&_0x611a0b['id']&&_0x170602[_0x7436('0x29')]&&_0x170602[_0x7436('0x29')][_0x611a0b['id']]){delete _0x170602['agents'][_0x611a0b['id']][_0x54a74b+_0x7436('0x2b')][_0x3e330a['message']['id']];}};exports[_0x7436('0x2f')]=writeLog; \ No newline at end of file +var _0x9898=['../../../../../config/logger','routing','redis','defaults','socket.io-emitter','split','\x20interaction','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','user:%s','emit','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','name','isAgentAvailable','BUSY','online','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','UserId','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','agents','WaitingInteractions','saveWaitingNotification','message','writeLog','util','../utils','../../../../../config/environment'];(function(_0x53f097,_0x1425ac){var _0x5dada5=function(_0x3d6e09){while(--_0x3d6e09){_0x53f097['push'](_0x53f097['shift']());}};_0x5dada5(++_0x1425ac);}(_0x9898,0x12f));var _0x8989=function(_0x435fa1,_0x58550a){_0x435fa1=_0x435fa1-0x0;var _0x845f9f=_0x9898[_0x435fa1];return _0x845f9f;};'use strict';var _=require('lodash');var util=require(_0x8989('0x0'));var utils=require(_0x8989('0x1'));var Redis=require('ioredis');var config=require(_0x8989('0x2'));var logger=require(_0x8989('0x3'))(_0x8989('0x4'));config[_0x8989('0x5')]=_[_0x8989('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8989('0x7'))(new Redis(config[_0x8989('0x5')]));function sendNotification(_0x143232,_0x2b13f,_0x2e238e,_0x78f11f,_0x350d79,_0x3fb975){var _0xd55caa=_0x3fb975||{};var _0x3b8cdd=_0x2e238e[_0x8989('0x8')]('.');var _0x213a02={'uniqueid':_0x2b13f,'channel':_0x3b8cdd[0x0],'id':_0x3b8cdd[0x1],'title':_0x3b8cdd[0x0]+_0x8989('0x9'),'interactionId':_0x3b8cdd[0x2],'queue':_0x350d79?_0x350d79['name']:null,'sound':_0xd55caa[_0x8989('0xa')]['notificationSound'],'shake':_0xd55caa[_0x8989('0xa')][_0x8989('0xb')]};try{if(!_0xd55caa['body']){_0xd55caa[_0x8989('0xc')]={};}if(_0x350d79){_0xd55caa[_0x8989('0xc')][_0x8989('0xd')]=_0x350d79;}else if(_0xd55caa['body'][_0x8989('0xd')]){delete _0xd55caa['body'][_0x8989('0xd')];}_0x213a02[_0x8989('0xe')]=utils[_0x8989('0xf')](_0xd55caa[_0x8989('0xa')][_0x8989('0x10')],_0xd55caa);}catch(_0x37d3a9){_0x213a02[_0x8989('0xe')]=_0x8989('0x11');logger[_0x8989('0x12')](util[_0x8989('0x13')](_0x8989('0x14'),_0x2b13f,_0x37d3a9['message']));}io['to'](util[_0x8989('0x13')](_0x8989('0x15'),_0x78f11f['name']))[_0x8989('0x16')](util[_0x8989('0x13')]('notification:%s',_0x143232?'save':_0x8989('0x17')),_0x213a02);}function writeLog(_0x311a12,_0x2127e8,_0xe9b0ff){return logger['debug'](util['format'](_0x8989('0x18'),_0x311a12,_0x2127e8[_0x8989('0x19')],_0xe9b0ff));}exports[_0x8989('0x1a')]=function(_0x3f289b,_0x30b4c6,_0x10490b,_0x2af888){if(_0x30b4c6['busy']){writeLog(_0x3f289b,_0x30b4c6,_0x8989('0x1b'));return![];}if(!_0x30b4c6[_0x8989('0x1c')]){writeLog(_0x3f289b,_0x30b4c6,'OFFLINE');return![];}if(_0x30b4c6[_0x10490b+_0x8989('0x1d')]){writeLog(_0x3f289b,_0x30b4c6,_0x8989('0x1e'));return![];}if(_0x2af888&&_0x30b4c6[_0x8989('0x1f')](_0x10490b+_0x8989('0x20'))&&_0x30b4c6[_0x8989('0x1f')](_0x10490b+_0x8989('0x21'))){if(_0x30b4c6[_0x10490b+'Capacity']>0x0&&_0x30b4c6[_0x10490b+_0x8989('0x21')]>=_0x30b4c6[_0x10490b+'Capacity']){writeLog(_0x3f289b,_0x30b4c6,_0x10490b[_0x8989('0x22')]()+_0x8989('0x23'));return![];}}return!![];};exports[_0x8989('0x24')]=function(_0x57ee0d,_0x3dadfd,_0x5b69a0,_0xf015cb,_0x3d9250){return sendNotification(!![],_0x57ee0d,_0x3dadfd,_0x5b69a0,_0xf015cb,_0x3d9250);};exports[_0x8989('0x25')]=function(_0x22f53e,_0xedb227,_0x345af4,_0x183b46,_0x58a04d){return sendNotification(![],_0x22f53e,_0xedb227,_0x345af4,_0x183b46,_0x58a04d);};exports[_0x8989('0x26')]=function(_0xf1498f,_0x33d406,_0x55ffaa){var _0x528e80=_0x33d406[_0x8989('0x27')][_0x8989('0x28')];if(!_0x528e80&&_0x55ffaa){_0x528e80=_0x55ffaa['id'];}var _0x694ce3=_[_0x8989('0x29')](_0xf1498f[_0x33d406[_0x8989('0x2a')]+_0x8989('0x2b')],function(_0x56308b){var _0x4ba39e=_[_0x8989('0x2c')](_0x33d406[_0x8989('0x2a')])+_0x8989('0x2d');return _0x56308b[_0x4ba39e]===_0x33d406[_0x8989('0x27')]['id'];});if(!_0x694ce3&&_0x528e80&&_0xf1498f[_0x8989('0x2e')][_0x528e80]){_0x694ce3=_[_0x8989('0x29')](_0xf1498f[_0x8989('0x2e')][_0x528e80][_0x33d406[_0x8989('0x2a')]+_0x8989('0x2f')],function(_0x85ef7){return _0x85ef7['id']===_0x33d406[_0x8989('0x27')]['id'];});}return _0x694ce3;};exports[_0x8989('0x30')]=function(_0x2dcf57,_0x4a39f3,_0x433231,_0x5aa92f){if(_0x433231&&_0x433231['id']&&_0x2dcf57[_0x8989('0x2e')]&&_0x2dcf57['agents'][_0x433231['id']]){_0x2dcf57[_0x8989('0x2e')][_0x433231['id']][_0x5aa92f+_0x8989('0x2f')][_0x4a39f3[_0x8989('0x31')]['id']]={'id':_0x4a39f3[_0x8989('0x27')]['id']};}};exports['removeWaitingNotification']=function(_0x1560f0,_0x30bd40,_0x576069,_0x2d1313){if(_0x576069&&_0x576069['id']&&_0x1560f0[_0x8989('0x2e')]&&_0x1560f0[_0x8989('0x2e')][_0x576069['id']]){delete _0x1560f0[_0x8989('0x2e')][_0x576069['id']][_0x2d1313+_0x8989('0x2f')][_0x30bd40['message']['id']];}};exports[_0x8989('0x32')]=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 0c49b14..30bddf5 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 _0xbdfd=['trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','./utils','../../../../config/logger','routing','string','consequence','length','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xbdfd,0x135));var _0xdbdf=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbdfd[_0x2641f9];return _0x585741;};'use strict';var schema=require(_0xdbdf('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0xdbdf('0x1'));var logger=require(_0xdbdf('0x2'))(_0xdbdf('0x3'));var system=schema({'command':{'type':_0xdbdf('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xdbdf('0x5')]=function(_0x15cf18,_0x491f52){return function(_0x145d63){try{var _0xa743ff={'command':_0x491f52[0x0]};var _0x484034=system[_0xdbdf('0x0')](_0xa743ff,{'typecast':!![]});if(_0x484034[_0xdbdf('0x6')]){logger[_0xdbdf('0x7')](_0xdbdf('0x8'),_0x15cf18,_[_0xdbdf('0x9')](_0x484034,'message')[_0xdbdf('0xa')](',\x20'));logger[_0xdbdf('0xb')](_0xdbdf('0xc'),_0x15cf18);_0x145d63[_0xdbdf('0xd')]();}else{var _0xa78f08=this;var _0xe0d90c=utils['getMustacheRender'](_0x491f52[0x0],this);logger['info'](_0xdbdf('0xe'),_0x15cf18,_0xe0d90c);sh[_0xdbdf('0xf')](_[_0xdbdf('0x10')](_0xe0d90c),function(_0x3aeb28,_0x3dccaf){logger[_0xdbdf('0xb')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x15cf18,_0x3aeb28);if(_0x3aeb28==0x0){var _0x152831=_0x3dccaf[_0xdbdf('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xdbdf('0x12')](_0x491f52[0x1])||_[_0xdbdf('0x13')](_0x491f52[0x1])){logger[_0xdbdf('0xb')](_0xdbdf('0x14'),_0x15cf18);_0xa78f08[_0xdbdf('0x15')][_0x491f52[0x1]]=_0x152831;}else{logger['info'](_0xdbdf('0x16'),_0x15cf18,_0x491f52[0x1],_0x152831);_0xa78f08[_0xdbdf('0x15')][_0x491f52[0x1]]=_0x152831;}}_0x145d63[_0xdbdf('0xd')]();});}}catch(_0x173a18){logger[_0xdbdf('0x7')]('[%s][SYSTEM]\x20%s',_0x15cf18,_[_0xdbdf('0x17')](_0x173a18)?JSON[_0xdbdf('0x18')](_0x173a18):_0x173a18);logger[_0xdbdf('0xb')](_0xdbdf('0xc'),_0x15cf18);_0x145d63[_0xdbdf('0xd')]();}};}; \ No newline at end of file +var _0x04de=['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','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string'];(function(_0x536b05,_0x4faea9){var _0x34319e=function(_0x4c23c2){while(--_0x4c23c2){_0x536b05['push'](_0x536b05['shift']());}};_0x34319e(++_0x4faea9);}(_0x04de,0x107));var _0xe04d=function(_0x13771a,_0x56c7ee){_0x13771a=_0x13771a-0x0;var _0x30cf6c=_0x04de[_0x13771a];return _0x30cf6c;};'use strict';var schema=require(_0xe04d('0x0'));var sh=require(_0xe04d('0x1'));var _=require(_0xe04d('0x2'));var utils=require(_0xe04d('0x3'));var logger=require(_0xe04d('0x4'))(_0xe04d('0x5'));var system=schema({'command':{'type':_0xe04d('0x6'),'required':!![],'message':_0xe04d('0x7')}});exports[_0xe04d('0x8')]=function(_0x70ead0,_0x3a0e3b){return function(_0x4804c8){try{var _0x4bb925={'command':_0x3a0e3b[0x0]};var _0x4f7637=system['validate'](_0x4bb925,{'typecast':!![]});if(_0x4f7637[_0xe04d('0x9')]){logger[_0xe04d('0xa')](_0xe04d('0xb'),_0x70ead0,_[_0xe04d('0xc')](_0x4f7637,_0xe04d('0xd'))[_0xe04d('0xe')](',\x20'));logger[_0xe04d('0xf')](_0xe04d('0x10'),_0x70ead0);_0x4804c8['next']();}else{var _0x160d4f=this;var _0x21c91c=utils[_0xe04d('0x11')](_0x3a0e3b[0x0],this);logger[_0xe04d('0xf')](_0xe04d('0x12'),_0x70ead0,_0x21c91c);sh[_0xe04d('0x13')](_[_0xe04d('0x14')](_0x21c91c),function(_0xec9f3a,_0x3ccdc8){logger['info'](_0xe04d('0x15'),_0x70ead0,_0xec9f3a);if(_0xec9f3a==0x0){var _0x1d3f03=_0x3ccdc8[_0xe04d('0x16')](/(\r\n|\n|\r)/gm,'');if(_[_0xe04d('0x17')](_0x3a0e3b[0x1])||_[_0xe04d('0x18')](_0x3a0e3b[0x1])){logger[_0xe04d('0xf')](_0xe04d('0x19'),_0x70ead0);_0x160d4f[_0xe04d('0x1a')][_0x3a0e3b[0x1]]=_0x1d3f03;}else{logger[_0xe04d('0xf')](_0xe04d('0x1b'),_0x70ead0,_0x3a0e3b[0x1],_0x1d3f03);_0x160d4f[_0xe04d('0x1a')][_0x3a0e3b[0x1]]=_0x1d3f03;}}_0x4804c8[_0xe04d('0x1c')]();});}}catch(_0x5cfd5b){logger[_0xe04d('0xa')]('[%s][SYSTEM]\x20%s',_0x70ead0,_[_0xe04d('0x1d')](_0x5cfd5b)?JSON['stringify'](_0x5cfd5b):_0x5cfd5b);logger[_0xe04d('0xf')](_0xe04d('0x10'),_0x70ead0);_0x4804c8[_0xe04d('0x1c')]();}};}; \ 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 ba5c1b9..154a67c 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 _0x81fe=['map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','then','catch','error','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s'];(function(_0xab03f0,_0x48d3d5){var _0x2f3e7f=function(_0xb54560){while(--_0xb54560){_0xab03f0['push'](_0xab03f0['shift']());}};_0x2f3e7f(++_0x48d3d5);}(_0x81fe,0x19e));var _0xe81f=function(_0x4a4d18,_0x51629a){_0x4a4d18=_0x4a4d18-0x0;var _0x5360a3=_0x81fe[_0x4a4d18];return _0x5360a3;};'use strict';var schema=require(_0xe81f('0x0'));var _=require(_0xe81f('0x1'));var rpc={'chatInteraction':require(_0xe81f('0x2')),'openchannelInteraction':require(_0xe81f('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xe81f('0x4')),'faxInteraction':require(_0xe81f('0x5')),'whatsappInteraction':require(_0xe81f('0x6'))};var logger=require(_0xe81f('0x7'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0xe81f('0x8')}});exports[_0xe81f('0x9')]=function(_0xc3f205,_0x42d87c,_0x2470d3,_0x350fea){return function(_0x433edf){try{var _0x277918={'tag':_0x42d87c[0x0]};var _0xe50c40=tag[_0xe81f('0x0')](_0x277918,{'typecast':!![]});if(_0xe50c40['length']){logger['error'](_0xe81f('0xa'),_0xc3f205,_[_0xe81f('0xb')](_0xe50c40,'message')[_0xe81f('0xc')](',\x20'));logger[_0xe81f('0xd')](_0xe81f('0xe'),_0xc3f205);_0x433edf[_0xe81f('0xf')]();}else{var _0x452a28={'ids':[_0x42d87c[0x0]]};if(rpc[_0x350fea[_0xe81f('0x10')]+'Interaction']){rpc[_0x350fea['channel']+_0xe81f('0x11')]['addTags'](_0x350fea[_0xe81f('0x12')]['id'],_0x452a28)[_0xe81f('0x13')](function(_0x2d3984){logger[_0xe81f('0xd')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0xc3f205,_0x42d87c[0x1],_0x350fea[_0xe81f('0x10')],_0x350fea['interaction']['id']);})[_0xe81f('0x14')](function(_0x170e87){logger[_0xe81f('0x15')](_0xe81f('0xa'),_0xc3f205,JSON[_0xe81f('0x16')](_0x170e87));logger[_0xe81f('0xd')](_0xe81f('0xe'),_0xc3f205);})[_0xe81f('0x17')](function(){_0x433edf[_0xe81f('0xf')]();});}}}catch(_0x2bbf04){logger[_0xe81f('0x15')](_0xe81f('0xa'),_0xc3f205,_[_0xe81f('0x18')](_0x2bbf04)?JSON[_0xe81f('0x16')](_0x2bbf04):_0x2bbf04);logger[_0xe81f('0xd')](_0xe81f('0xe'),_0xc3f205);_0x433edf[_0xe81f('0xf')]();}};}; \ No newline at end of file +var _0xbd72=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','then','catch','error','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x55e1d1,_0x3c9376){var _0x1165db=function(_0x5b0120){while(--_0x5b0120){_0x55e1d1['push'](_0x55e1d1['shift']());}};_0x1165db(++_0x3c9376);}(_0xbd72,0x1bc));var _0x2bd7=function(_0x20e7e3,_0x1529be){_0x20e7e3=_0x20e7e3-0x0;var _0x14b9de=_0xbd72[_0x20e7e3];return _0x14b9de;};'use strict';var schema=require(_0x2bd7('0x0'));var _=require(_0x2bd7('0x1'));var rpc={'chatInteraction':require(_0x2bd7('0x2')),'openchannelInteraction':require(_0x2bd7('0x3')),'smsInteraction':require(_0x2bd7('0x4')),'mailInteraction':require(_0x2bd7('0x5')),'faxInteraction':require(_0x2bd7('0x6')),'whatsappInteraction':require(_0x2bd7('0x7'))};var logger=require('../../../../config/logger')(_0x2bd7('0x8'));var tag=schema({'tag':{'type':_0x2bd7('0x9'),'required':!![],'message':_0x2bd7('0xa')}});exports[_0x2bd7('0xb')]=function(_0x3c5cdd,_0x1baf34,_0x5347ed,_0x122f84){return function(_0x2c2a61){try{var _0xcf2853={'tag':_0x1baf34[0x0]};var _0x4d054f=tag[_0x2bd7('0x0')](_0xcf2853,{'typecast':!![]});if(_0x4d054f[_0x2bd7('0xc')]){logger['error'](_0x2bd7('0xd'),_0x3c5cdd,_['map'](_0x4d054f,_0x2bd7('0xe'))[_0x2bd7('0xf')](',\x20'));logger[_0x2bd7('0x10')](_0x2bd7('0x11'),_0x3c5cdd);_0x2c2a61[_0x2bd7('0x12')]();}else{var _0x322154={'ids':[_0x1baf34[0x0]]};if(rpc[_0x122f84[_0x2bd7('0x13')]+_0x2bd7('0x14')]){rpc[_0x122f84[_0x2bd7('0x13')]+_0x2bd7('0x14')]['addTags'](_0x122f84[_0x2bd7('0x15')]['id'],_0x322154)[_0x2bd7('0x16')](function(_0x2f8eba){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x3c5cdd,_0x1baf34[0x1],_0x122f84[_0x2bd7('0x13')],_0x122f84[_0x2bd7('0x15')]['id']);})[_0x2bd7('0x17')](function(_0x23e340){logger[_0x2bd7('0x18')](_0x2bd7('0xd'),_0x3c5cdd,JSON[_0x2bd7('0x19')](_0x23e340));logger[_0x2bd7('0x10')](_0x2bd7('0x11'),_0x3c5cdd);})[_0x2bd7('0x1a')](function(){_0x2c2a61[_0x2bd7('0x12')]();});}}}catch(_0xf30bc3){logger[_0x2bd7('0x18')]('[%s][TAG]\x20%s',_0x3c5cdd,_[_0x2bd7('0x1b')](_0xf30bc3)?JSON[_0x2bd7('0x19')](_0xf30bc3):_0xf30bc3);logger['info'](_0x2bd7('0x11'),_0x3c5cdd);_0x2c2a61[_0x2bd7('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index b8488c9..e0f307b 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a66=['../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','push','urlOnAnswer','?params=','title','jsonrpc','2.0','method','login','params','stringify','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x6a66,0x69));var _0x66a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a66[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require('request-promise');var logger=require(_0x66a6('0x0'))(_0x66a6('0x1'));var _=require(_0x66a6('0x2'));var arr=[];exports[_0x66a6('0x3')]=function(_0xca7050,_0x967f18){return function(_0x3211cb){var _0x2f2021=_0x967f18[0xa];var _0x102d11=_0x967f18[0xb];var _0x4ed619=_0x967f18[0xc];var _0x505e29=_0x967f18[0xd];var _0x1a570e=_0x967f18[0xe];var _0x3f4386=_0x967f18[0xf][_0x66a6('0x4')](/\n/g,_0x66a6('0x5'));var _0x4ef718=_0x967f18[0x10][_0x66a6('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x102d11)){arr[_0x66a6('0x6')](_0x102d11);var _0x3d09f5=_0x967f18[0x3];var _0x48085c=_0x967f18[0x4];var _0x1d7650=_0x967f18[0x1];var _0x32c13f=_0x967f18[0x0];var _0x210f56={};_0x210f56[_0x66a6('0x7')]=_0x967f18[0x8]+_0x66a6('0x8')+_0x4ed619+'|'+_0x2f2021+'|'+_0x505e29+'|'+_0x102d11+'|'+_0x1a570e;_0x210f56['urlOnRing']=_0x967f18[0x7]+_0x66a6('0x8')+_0x4ed619+'|'+_0x2f2021+'|'+_0x505e29+'|'+_0x102d11+'|'+_0x1a570e+'|'+_0x3f4386+'|'+_0x4ef718;_0x210f56[_0x66a6('0x9')]=_0x967f18[0x9];var _0x5ce8ad={};_0x5ce8ad[_0x66a6('0xa')]=_0x66a6('0xb');_0x5ce8ad[_0x66a6('0xc')]=_0x66a6('0xd');var _0x58d4ff=[];_0x58d4ff[_0x66a6('0x6')](_0x967f18[0x2]);_0x58d4ff['push'](_0x967f18[0x5]);_0x58d4ff[_0x66a6('0x6')](_0x967f18[0x6]);_0x5ce8ad[_0x66a6('0xe')]=_0x58d4ff;_0x5ce8ad['id']=0x1;var _0x2a0d8c=JSON[_0x66a6('0xf')](_0x5ce8ad);var _0x2feb39={'encoding':'utf8','method':_0x66a6('0x10'),'timeout':0x2710,'url':_0x3d09f5,'headers':{'Content-Type':_0x66a6('0x11')},'body':_0x2a0d8c};return rp(_0x2feb39)[_0x66a6('0x12')](function(_0x151a2d){const _0x1afa91=JSON[_0x66a6('0x13')](_0x151a2d);if(!_0x1afa91[_0x66a6('0x14')][_0x66a6('0x15')]){throw new Error(_0x66a6('0x16'));}var _0x33acc5=_0x102d11;var _0x4dcff9=_0x66a6('0x17')+_0x1d7650+'&serviceId='+_0x32c13f+_0x66a6('0x18')+_0x33acc5+_0x66a6('0x19')+JSON[_0x66a6('0xf')](_0x210f56);var _0x47c0be=_0x48085c+'?'+_0x4dcff9;return rp(_0x47c0be);})[_0x66a6('0x12')](function(_0x4cd8fc){logger[_0x66a6('0x1a')](_0x66a6('0x1b'),_0xca7050,_0x4cd8fc);_0x3211cb[_0x66a6('0x1c')]();})[_0x66a6('0x1d')](function(_0x144b90){logger[_0x66a6('0x1e')](_0x66a6('0x1f'),_0xca7050,_[_0x66a6('0x20')](_0x144b90)?JSON[_0x66a6('0xf')](_0x144b90):_0x144b90);_0x3211cb[_0x66a6('0x1c')]();});}else{logger['info'](_0x66a6('0x21'),_0xca7050);_0x3211cb[_0x66a6('0x22')]();}};}; \ No newline at end of file +var _0x408e=['method','login','params','stringify','utf8','POST','application/json-rpc','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','consequence','replace','push','urlOnAnswer','urlOnRing','title','jsonrpc'];(function(_0x13e973,_0x3deb5f){var _0x45fa40=function(_0x345e40){while(--_0x345e40){_0x13e973['push'](_0x13e973['shift']());}};_0x45fa40(++_0x3deb5f);}(_0x408e,0xc2));var _0xe408=function(_0x36bf88,_0x15c459){_0x36bf88=_0x36bf88-0x0;var _0x332914=_0x408e[_0x36bf88];return _0x332914;};'use strict';var rp=require(_0xe408('0x0'));var logger=require(_0xe408('0x1'))('routing');var _=require('lodash');var arr=[];exports[_0xe408('0x2')]=function(_0x2c532c,_0x920147){return function(_0x98da02){var _0x1c8a8b=_0x920147[0xa];var _0x22befe=_0x920147[0xb];var _0xa8b45e=_0x920147[0xc];var _0x45b5f3=_0x920147[0xd];var _0x4afa9d=_0x920147[0xe];var _0x1e1be6=_0x920147[0xf][_0xe408('0x3')](/\n/g,'\x20-\x20');var _0x4dc5a7=_0x920147[0x10]['replace'](/\n/g,'\x20');if(!arr['includes'](_0x22befe)){arr[_0xe408('0x4')](_0x22befe);var _0x1b3404=_0x920147[0x3];var _0x43f5e2=_0x920147[0x4];var _0x16047b=_0x920147[0x1];var _0x33c4a0=_0x920147[0x0];var _0x28363b={};_0x28363b[_0xe408('0x5')]=_0x920147[0x8]+'?params='+_0xa8b45e+'|'+_0x1c8a8b+'|'+_0x45b5f3+'|'+_0x22befe+'|'+_0x4afa9d;_0x28363b[_0xe408('0x6')]=_0x920147[0x7]+'?params='+_0xa8b45e+'|'+_0x1c8a8b+'|'+_0x45b5f3+'|'+_0x22befe+'|'+_0x4afa9d+'|'+_0x1e1be6+'|'+_0x4dc5a7;_0x28363b[_0xe408('0x7')]=_0x920147[0x9];var _0xd2c1ef={};_0xd2c1ef[_0xe408('0x8')]='2.0';_0xd2c1ef[_0xe408('0x9')]=_0xe408('0xa');var _0x254d11=[];_0x254d11[_0xe408('0x4')](_0x920147[0x2]);_0x254d11[_0xe408('0x4')](_0x920147[0x5]);_0x254d11['push'](_0x920147[0x6]);_0xd2c1ef[_0xe408('0xb')]=_0x254d11;_0xd2c1ef['id']=0x1;var _0x39bf8c=JSON[_0xe408('0xc')](_0xd2c1ef);var _0x2ac4f4={'encoding':_0xe408('0xd'),'method':_0xe408('0xe'),'timeout':0x2710,'url':_0x1b3404,'headers':{'Content-Type':_0xe408('0xf')},'body':_0x39bf8c};return rp(_0x2ac4f4)['then'](function(_0x2aa269){const _0xab0c6b=JSON[_0xe408('0x10')](_0x2aa269);if(!_0xab0c6b['result'][_0xe408('0x11')]){throw new Error(_0xe408('0x12'));}var _0xfdb012=_0x22befe;var _0x434815=_0xe408('0x13')+_0x16047b+_0xe408('0x14')+_0x33c4a0+_0xe408('0x15')+_0xfdb012+_0xe408('0x16')+JSON[_0xe408('0xc')](_0x28363b);var _0x396fb3=_0x43f5e2+'?'+_0x434815;return rp(_0x396fb3);})[_0xe408('0x17')](function(_0x39340e){logger[_0xe408('0x18')](_0xe408('0x19'),_0x2c532c,_0x39340e);_0x98da02['stop']();})[_0xe408('0x1a')](function(_0xd62e07){logger['error']('[%s][TVOX]\x20%s',_0x2c532c,_[_0xe408('0x1b')](_0xd62e07)?JSON[_0xe408('0xc')](_0xd62e07):_0xd62e07);_0x98da02['stop']();});}else{logger[_0xe408('0x18')](_0xe408('0x1c'),_0x2c532c);_0x98da02['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index dd429dd..7e95f03 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 _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x57b7de,_0x25d9c2){var _0xbe8059=function(_0x56c8cc){while(--_0x56c8cc){_0x57b7de['push'](_0x57b7de['shift']());}};_0xbe8059(++_0x25d9c2);}(_0xe706,0xa3));var _0x6e70=function(_0x58e32c,_0x309781){_0x58e32c=_0x58e32c-0x0;var _0x481e60=_0xe706[_0x58e32c];return _0x481e60;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x1fac8e,_0x2630f8){var _0x2ac449=function(_0x2c3304){while(--_0x2c3304){_0x1fac8e['push'](_0x1fac8e['shift']());}};_0x2ac449(++_0x2630f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 2a4bf3b..2aca5be 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 _0x794b=['%s:%s:%s','intervals','consequence','priority','info','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busy','emit','QueueReport','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','busyQueue','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','loggedIn','paused','waiting','mailQueues','available','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','../../../config/logger','routing','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','transfer','applications','length','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflowv2','amazonlex','tag','TagId','tvox','notificationTemplate','ChatWebsiteId','ContactId','body'];(function(_0x12ca5f,_0x223d98){var _0xfc3ae9=function(_0x1928fb){while(--_0x1928fb){_0x12ca5f['push'](_0x12ca5f['shift']());}};_0xfc3ae9(++_0x223d98);}(_0x794b,0x1c2));var _0xb794=function(_0x2d9622,_0x1ab86b){_0x2d9622=_0x2d9622-0x0;var _0x2a0e02=_0x794b[_0x2d9622];return _0x2a0e02;};'use strict';var _=require(_0xb794('0x0'));var util=require(_0xb794('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0xb794('0x2'));var BPromise=require(_0xb794('0x3'));var utils=require('./applications/utils');var sUtils=require('./applications/strategy/util');var logger=require(_0xb794('0x4'))(_0xb794('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xb794('0x6')),'smsQueueReport':require(_0xb794('0x7')),'faxQueueReport':require(_0xb794('0x8')),'whatsappQueueReport':require(_0xb794('0x9'))};var RuleEngine=require(_0xb794('0xa'));function getId(_0x340863,_0x5d099b,_0x30f03f){return util[_0xb794('0xb')](_0xb794('0xc'),_0x340863,_0x5d099b||0x0,_0x30f03f||0x0);}function getIntervals(_0xc3dde7,_0x2d0d36){var _0xf87756=[];if(!_[_0xb794('0xd')](_0x2d0d36[_0xb794('0xe')])&&!_[_0xb794('0xd')](_0xc3dde7[_0x2d0d36[_0xb794('0xe')]])&&!_[_0xb794('0xd')](_0xc3dde7[_0x2d0d36[_0xb794('0xe')]][_0xb794('0xf')])){_0xf87756=_[_0xb794('0x10')](_0xc3dde7[_0x2d0d36[_0xb794('0xe')]][_0xb794('0xf')],_0xb794('0x11'));}else if(!_[_0xb794('0xd')](_0x2d0d36[_0xb794('0x11')])){_0xf87756=[_0x2d0d36[_0xb794('0x11')]];}return _0xf87756;}exports[_0xb794('0x12')]=function(_0x57c750){_0x57c750[_0xb794('0x13')]={};return new BPromise(function(_0x14927e,_0x2a36f4){var _0xf1308e={'Start':function(_0xac1f87){var _0x469618=this;return new Promise(function(_0x558bc1,_0x43bf13){if(_0xac1f87){try{var _0x33ac72=[];var _0x576ef5=getId(_0xac1f87[_0xb794('0x14')],_0xac1f87[_0xb794('0x15')]?_0xac1f87['message']['id']:0x0,_0xac1f87[_0xb794('0x16')]?_0xac1f87[_0xb794('0x16')]['id']:0x0);var _0x1d32db=sUtils['checkWaitingNotifications'](_0x57c750,_0xac1f87);if(_0xac1f87[_0xb794('0x17')]||!_0x1d32db&&_0xac1f87[_0xb794('0x18')]&&_['isArray'](_0xac1f87[_0xb794('0x18')])&&_0xac1f87[_0xb794('0x18')][_0xb794('0x19')]){for(var _0x324903=0x0;_0x324903<_0xac1f87[_0xb794('0x18')]['length'];_0x324903+=0x1){var _0x24811c=_0xac1f87[_0xb794('0x18')][_0x324903];if(fs['existsSync'](path[_0xb794('0x1a')](__dirname,_0xb794('0x18'),_0x24811c[_0xb794('0x1b')]+_0xb794('0x1c')))){var _0x31bd91=[];switch(_0x24811c[_0xb794('0x1b')][_0xb794('0x1d')]()){case _0xb794('0x1e'):var _0x425a47=_0x24811c[_0xb794('0x1f')][_0xb794('0x20')](',');if(_0xac1f87[_0xb794('0x14')]===_0xb794('0x21')){_0x31bd91['push'](_0x425a47[0x0]);_0x31bd91[_0xb794('0x22')](_0x425a47[0x1]);_0x31bd91[_0xb794('0x22')](_0x425a47[_0xb794('0x23')](0x2,_0x425a47['length'])['join'](','));}else{_0x31bd91[_0xb794('0x22')](_0x425a47[0x0]);_0x31bd91['push'](_0x425a47[_0xb794('0x23')](0x1,_0x425a47[_0xb794('0x19')])['join'](','));}break;case'dialogflow':var _0x4446d6=_0x24811c[_0xb794('0x1f')][_0xb794('0x20')](',');_0x31bd91['push'](_0x4446d6[0x0]);_0x31bd91['push'](_0x4446d6[0x1]);_0x31bd91[_0xb794('0x22')](_0x4446d6[_0xb794('0x23')](0x2,_0x4446d6[_0xb794('0x19')])[_0xb794('0x1a')](','));break;case _0xb794('0x24'):var _0x2308c9=_0x24811c['appdata']['split'](',');_0x31bd91['push'](_0x2308c9[0x0]);_0x31bd91[_0xb794('0x22')](_0x2308c9[0x1]);_0x31bd91[_0xb794('0x22')](_0x2308c9[0x2]);_0x31bd91[_0xb794('0x22')](_0x2308c9[0x3]);_0x31bd91['push'](_0x2308c9[_0xb794('0x23')](0x4,_0x2308c9['length'])[_0xb794('0x1a')](','));break;case _0xb794('0x25'):var _0x54f90f=_0x24811c[_0xb794('0x1f')]['split'](',');_0x31bd91[_0xb794('0x22')](_0x54f90f[0x0]);_0x31bd91[_0xb794('0x22')](_0x54f90f[0x1]);_0x31bd91['push'](_0x54f90f[0x2]);_0x31bd91[_0xb794('0x22')](_0x54f90f[0x3]);_0x31bd91[_0xb794('0x22')](_0x54f90f[_0xb794('0x23')](0x4,_0x54f90f[_0xb794('0x19')])[_0xb794('0x1a')](','));break;case _0xb794('0x15'):_0x31bd91[_0xb794('0x22')](_0x24811c['appdata']);break;case _0xb794('0x26'):_0x31bd91['push'](_0x24811c[_0xb794('0x27')]);_0x31bd91['push'](_0x24811c[_0xb794('0x1f')]);break;case _0xb794('0x28'):var _0x2e8f66=utils['getMustacheRender'](_0xac1f87['account'][_0xb794('0x29')],_0xac1f87);var _0x1368fe=_0x24811c[_0xb794('0x1f')]['split'](',');_0x31bd91[_0xb794('0x22')](_0x1368fe[0x0]);_0x31bd91[_0xb794('0x22')](_0x1368fe[0x1]);_0x31bd91[_0xb794('0x22')](_0x1368fe[0x2]);_0x31bd91[_0xb794('0x22')](_0x1368fe[0x3]);_0x31bd91[_0xb794('0x22')](_0x1368fe[0x4]);_0x31bd91['push'](_0x1368fe[0x5]);_0x31bd91[_0xb794('0x22')](_0x1368fe[0x6]);_0x31bd91[_0xb794('0x22')](_0x1368fe[0x7]);_0x31bd91[_0xb794('0x22')](_0x1368fe[0x8]);_0x31bd91[_0xb794('0x22')](_0x1368fe[0x9]);_0x31bd91['push'](_0x1368fe[0xa]);_0x31bd91[_0xb794('0x22')](_0xac1f87[_0xb794('0x16')]['id']);_0x31bd91[_0xb794('0x22')](_0xac1f87['message']['id']);_0x31bd91['push'](_0x24811c[_0xb794('0x2a')]);_0x31bd91[_0xb794('0x22')](_0xac1f87['interaction'][_0xb794('0x2b')]);_0x31bd91[_0xb794('0x22')](_0xac1f87[_0xb794('0x2c')]['body']);_0x31bd91[_0xb794('0x22')](_0x2e8f66);break;default:_0x31bd91=_[_0xb794('0xd')](_0x24811c[_0xb794('0x1f')])?[]:_0x24811c[_0xb794('0x1f')][_0xb794('0x20')](',');}var _0x39da03={'id':util[_0xb794('0xb')](_0xb794('0x2d'),_0x576ef5,_0x24811c['id'],_0x24811c[_0xb794('0x1b')]),'condition':require('./interval')['condition'](_0x576ef5,getIntervals(_0x57c750[_0xb794('0x2e')],_0x24811c),_0x57c750),'consequence':require('./applications/'+_0x24811c[_0xb794('0x1b')])[_0xb794('0x2f')](_0x576ef5,_0x31bd91,_0x57c750,_0xac1f87),'p':_0x24811c[_0xb794('0x30')]||0x0};logger[_0xb794('0x31')]('Push\x20new\x20rule',_0x39da03['id'],_0xb794('0x32'),getIntervals(_0x57c750['intervals'],_0x24811c)[_0xb794('0x1a')](_0xb794('0x33')));_0x33ac72[_0xb794('0x22')](_0x39da03);}else{logger[_0xb794('0x34')](_0xb794('0x35'),path['join'](__dirname,_0xb794('0x18'),_0x24811c[_0xb794('0x1b')]+_0xb794('0x1c')));}}_0x57c750[_0xb794('0x13')][_0x576ef5]=new RuleEngine(_0x33ac72);_0x57c750[_0xb794('0x13')][_0x576ef5][_0xb794('0x36')](_0xac1f87,function(_0x42871d){logger[_0xb794('0x31')](_0xb794('0x37'),JSON[_0xb794('0x38')](_0x42871d[_0xb794('0x39')]));if(_0x57c750[_0xb794('0x13')][_0x576ef5]){_0x57c750['rules'][_0x576ef5]['emit']('complete');}});return _0x558bc1({'code':0xc8,'message':_0xac1f87});}else{if(_0x1d32db){logger['info'](util[_0xb794('0xb')]('Skipped\x20routing\x20for\x20%s',_0x576ef5));}else{logger[_0xb794('0x31')](_0xb794('0x3a'));}return _0x558bc1({'code':0xc8,'message':_0xac1f87});}}catch(_0x2dc7c9){logger[_0xb794('0x34')](_0x2dc7c9['stack']);return _0x43bf13(_0x469618['error'](0x1f4,_0x2dc7c9));}}return _0x43bf13(_0xb794('0x3b'));});},'AcceptMessage':function(_0x553703){var _0x5e1a47=this;return new Promise(function(_0x49bd2d,_0x4c99a9){if(_0x553703[_0xb794('0x3c')]&&_0x553703[_0xb794('0x3c')]['id']){if(_0x57c750[_0xb794('0x3d')][_0x553703[_0xb794('0x3c')]['id']]){_0x57c750[_0xb794('0x3d')][_0x553703[_0xb794('0x3c')]['id']][_0xb794('0x3e')]=![];_0x57c750[_0xb794('0x3d')][_0x553703['agent']['id']]['busyQueue']=undefined;}}if(_0x553703[_0xb794('0x15')]&&_0x553703['message']['id']){try{var _0x3ad47a=getId(_0x553703[_0xb794('0x14')],_0x553703[_0xb794('0x15')]?_0x553703[_0xb794('0x15')]['id']:0x0,_0x553703['interaction']?_0x553703[_0xb794('0x16')]['id']:0x0);if(_0x57c750['rules'][_0x3ad47a]){_0x57c750['rules'][_0x3ad47a][_0xb794('0x3f')]('end');if(rpc[_0x553703['channel']+_0xb794('0x40')]){rpc[_0x553703[_0xb794('0x14')]+_0xb794('0x40')]['update'](_0x3ad47a,{'UserId':_0x553703['message']['UserId']})[_0xb794('0x41')](function(){logger['error'](_0xb794('0x42'));});}}return _0x49bd2d({'code':0xc8,'message':_0x553703});}catch(_0x52d50d){logger[_0xb794('0x34')](_0x52d50d[_0xb794('0x43')]);return _0x4c99a9(_0x5e1a47[_0xb794('0x34')](0x1f4,_0x52d50d));}}logger[_0xb794('0x34')](_0xb794('0x44'));return _0x4c99a9(_0x5e1a47[_0xb794('0x34')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x2c0f24){var _0x2cfba9=this;return new Promise(function(_0x4a5d23,_0x2b6d53){if(_0x2c0f24['agent']&&_0x2c0f24[_0xb794('0x3c')]['id']){try{if(_0x57c750['agents'][_0x2c0f24[_0xb794('0x3c')]['id']]){_0x57c750[_0xb794('0x3d')][_0x2c0f24[_0xb794('0x3c')]['id']]['busy']=![];_0x57c750['agents'][_0x2c0f24['agent']['id']][_0xb794('0x45')]=undefined;}return _0x4a5d23({'code':0xc8,'message':_0x2c0f24});}catch(_0x1c3ae7){logger[_0xb794('0x34')](_0x1c3ae7['stack']);return _0x2b6d53(_0x2cfba9[_0xb794('0x34')](0x1f4,_0x1c3ae7));}}logger[_0xb794('0x34')]('message\x20is\x20empty');return _0x2b6d53(_0x2cfba9[_0xb794('0x34')](0x1f4,_0xb794('0x44')));});},'AbandonInteraction':function(_0x1d2ed2){var _0x24d5b1=this;return new Promise(function(_0xb8b60a,_0x1110ab){if(_0x1d2ed2[_0xb794('0x14')]&&_0x1d2ed2[_0xb794('0x16')]&&_0x1d2ed2['interaction']['id']){try{var _0x24e9ef=getId(_0x1d2ed2[_0xb794('0x14')],_0x1d2ed2['message']?_0x1d2ed2[_0xb794('0x15')]['id']:0x0,_0x1d2ed2[_0xb794('0x16')]?_0x1d2ed2[_0xb794('0x16')]['id']:0x0);if(_0x57c750['rules'][_0x24e9ef]){_0x57c750[_0xb794('0x13')][_0x24e9ef][_0xb794('0x3f')](_0xb794('0x46'));}return _0xb8b60a({'code':0xc8,'message':_0x1d2ed2});}catch(_0x293442){logger[_0xb794('0x34')](_0x293442[_0xb794('0x43')]);return _0x1110ab(_0x24d5b1[_0xb794('0x34')](0x1f4,_0x293442));}}logger[_0xb794('0x34')](_0xb794('0x44'));return _0x1110ab(_0x24d5b1[_0xb794('0x34')](0x1f4,_0xb794('0x44')));});},'AgentCapacity':function(_0x4ca4f5){var _0x22e19c=this;return new Promise(function(_0x3ca3b1,_0x400e69){if(_0x57c750[_0xb794('0x3d')][_0xb794('0x47')](_0x4ca4f5['id'])){for(var _0x33b6cf in _0x4ca4f5[_0xb794('0x48')]){if(_0x4ca4f5[_0xb794('0x48')][_0xb794('0x47')](_0x33b6cf)){if(_0x57c750['agents'][_0x4ca4f5['id']][_0xb794('0x47')](_0x33b6cf+_0xb794('0x49'))){_0x57c750[_0xb794('0x3d')][_0x4ca4f5['id']][_0x33b6cf+_0xb794('0x49')]=parseInt(_0x4ca4f5[_0xb794('0x48')][_0x33b6cf],0xa);}}}_0x57c750['agents'][_0x4ca4f5['id']][_0xb794('0x4a')]();return _0x3ca3b1({'code':0xc8,'message':_0x57c750['agents'][_0x4ca4f5['id']]});}else{return _0x400e69(_0x22e19c[_0xb794('0x34')](0x1f4,_0xb794('0x4b')));}});},'Agents':function(_0x467c1b){return new Promise(function(_0x33b05d){var _0xe6f5ac=_[_0xb794('0x4c')](_0x57c750[_0xb794('0x3d')]);if(_0x467c1b&&_0x467c1b['id']){var _0x278778=_[_0xb794('0x4d')](_0xe6f5ac,function(_0x142e7a){return _0x142e7a['id']===_0x467c1b['id'];});_0x33b05d(_0x278778);}else{_0x33b05d({'count':_0xe6f5ac[_0xb794('0x19')],'rows':_0xe6f5ac});}});},'ChatQueues':function(){return new Promise(function(_0x49e08d){var _0x4c43f7=[];for(var _0x11ad72 in _0x57c750[_0xb794('0x4e')]){if(_0x57c750[_0xb794('0x4e')][_0xb794('0x47')](_0x11ad72)){var _0x343967=_0x57c750['chatQueues'][_0x11ad72];var _0x565e84={'id':_0x343967['id'],'available':_0x343967['available'],'loggedIn':_0x343967[_0xb794('0x4f')],'name':_0x343967['name'],'paused':_0x343967[_0xb794('0x50')],'waiting':_0x343967[_0xb794('0x51')]};_0x4c43f7[_0xb794('0x22')](_0x565e84);}}_0x49e08d({'count':_0x4c43f7[_0xb794('0x19')],'rows':_0x4c43f7});});},'MailQueues':function(){return new Promise(function(_0x728a67){var _0x5693ac=[];for(var _0x5beefa in _0x57c750[_0xb794('0x52')]){if(_0x57c750[_0xb794('0x52')][_0xb794('0x47')](_0x5beefa)){var _0x5be94b=_0x57c750[_0xb794('0x52')][_0x5beefa];var _0x38f823={'id':_0x5be94b['id'],'available':_0x5be94b[_0xb794('0x53')],'loggedIn':_0x5be94b[_0xb794('0x4f')],'name':_0x5be94b[_0xb794('0x54')],'paused':_0x5be94b[_0xb794('0x50')],'waiting':_0x5be94b['waiting']};_0x5693ac[_0xb794('0x22')](_0x38f823);}}_0x728a67({'count':_0x5693ac[_0xb794('0x19')],'rows':_0x5693ac});});},'OpenchannelQueues':function(){return new Promise(function(_0x17bf78){var _0x1cfc40=[];for(var _0x1b06eb in _0x57c750[_0xb794('0x55')]){if(_0x57c750[_0xb794('0x55')][_0xb794('0x47')](_0x1b06eb)){var _0x46f37e=_0x57c750[_0xb794('0x55')][_0x1b06eb];var _0x15d75c={'id':_0x46f37e['id'],'available':_0x46f37e['available'],'loggedIn':_0x46f37e['loggedIn'],'name':_0x46f37e[_0xb794('0x54')],'paused':_0x46f37e['paused'],'waiting':_0x46f37e[_0xb794('0x51')]};_0x1cfc40['push'](_0x15d75c);}}_0x17bf78({'count':_0x1cfc40[_0xb794('0x19')],'rows':_0x1cfc40});});},'SmsQueues':function(){return new Promise(function(_0x4f3daf){var _0x1f3c61=[];for(var _0x319c7e in _0x57c750['smsQueues']){if(_0x57c750[_0xb794('0x56')][_0xb794('0x47')](_0x319c7e)){var _0x2edbe6=_0x57c750[_0xb794('0x56')][_0x319c7e];var _0x20f899={'id':_0x2edbe6['id'],'available':_0x2edbe6['available'],'loggedIn':_0x2edbe6[_0xb794('0x4f')],'name':_0x2edbe6[_0xb794('0x54')],'paused':_0x2edbe6['paused'],'waiting':_0x2edbe6['waiting']};_0x1f3c61[_0xb794('0x22')](_0x20f899);}}_0x4f3daf({'count':_0x1f3c61[_0xb794('0x19')],'rows':_0x1f3c61});});},'FaxQueues':function(){return new Promise(function(_0x543623){var _0x32fa7f=[];for(var _0x28000d in _0x57c750[_0xb794('0x57')]){if(_0x57c750[_0xb794('0x57')][_0xb794('0x47')](_0x28000d)){var _0x4ef38e=_0x57c750['faxQueues'][_0x28000d];var _0x1ebfc1={'id':_0x4ef38e['id'],'available':_0x4ef38e['available'],'loggedIn':_0x4ef38e[_0xb794('0x4f')],'name':_0x4ef38e[_0xb794('0x54')],'paused':_0x4ef38e[_0xb794('0x50')],'waiting':_0x4ef38e[_0xb794('0x51')]};_0x32fa7f[_0xb794('0x22')](_0x1ebfc1);}}_0x543623({'count':_0x32fa7f[_0xb794('0x19')],'rows':_0x32fa7f});});},'WhatsappQueues':function(){return new Promise(function(_0x287198){var _0x1283a7=[];for(var _0x1ec408 in _0x57c750[_0xb794('0x58')]){if(_0x57c750[_0xb794('0x58')][_0xb794('0x47')](_0x1ec408)){var _0x4f3df9=_0x57c750[_0xb794('0x58')][_0x1ec408];var _0x19583e={'id':_0x4f3df9['id'],'available':_0x4f3df9[_0xb794('0x53')],'loggedIn':_0x4f3df9[_0xb794('0x4f')],'name':_0x4f3df9[_0xb794('0x54')],'paused':_0x4f3df9[_0xb794('0x50')],'waiting':_0x4f3df9['waiting']};_0x1283a7['push'](_0x19583e);}}_0x287198({'count':_0x1283a7[_0xb794('0x19')],'rows':_0x1283a7});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x565cf4){var _0x3059cc=_[_0xb794('0x4c')](_0x57c750[_0xb794('0x59')]);_0x565cf4({'count':_0x3059cc[_0xb794('0x19')],'rows':_0x3059cc});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x2a19e0){var _0x30e953=_[_0xb794('0x4c')](_0x57c750[_0xb794('0x5a')]);_0x2a19e0({'count':_0x30e953[_0xb794('0x19')],'rows':_0x30e953});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x17aa8c){var _0x91cc27=_[_0xb794('0x4c')](_0x57c750['openchannelQueuesWaitingInteractions']);_0x17aa8c({'count':_0x91cc27['length'],'rows':_0x91cc27});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x3cbaac){var _0x20b57d=_['values'](_0x57c750[_0xb794('0x5b')]);_0x3cbaac({'count':_0x20b57d[_0xb794('0x19')],'rows':_0x20b57d});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x12fdad){var _0x265422=_[_0xb794('0x4c')](_0x57c750[_0xb794('0x5c')]);_0x12fdad({'count':_0x265422[_0xb794('0x19')],'rows':_0x265422});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x14b76c){var _0x97cba3=_[_0xb794('0x4c')](_0x57c750[_0xb794('0x5d')]);_0x14b76c({'count':_0x97cba3[_0xb794('0x19')],'rows':_0x97cba3});});}};var _0x2406c4=jayson[_0xb794('0x5e')](_0xf1308e)[_0xb794('0x5f')]();_0x2406c4['on'](_0xb794('0x34'),function(_0x17aa14){logger[_0xb794('0x34')](JSON[_0xb794('0x38')](_0x17aa14));return _0x2a36f4(_0x17aa14);});_0x2406c4[_0xb794('0x12')](0x232c,_0xb794('0x60'),function(){console['log'](_0xb794('0x61'),0x232c);return _0x14927e(_0xb794('0x62')+0x232c);});});}; \ No newline at end of file +var _0x2ff5=['checkWaitingNotifications','applications','isArray','length','existsSync','join','app','.js','toLowerCase','appdata','split','push','slice','dialogflow','amazonlex','tag','tvox','account','ChatWebsiteId','ContactId','%s:%s:%s','./interval','condition','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','interval','rules','channel','message','interaction'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x2ff5,0x1d5));var _0x52ff=function(_0x52cdec,_0x4ded94){_0x52cdec=_0x52cdec-0x0;var _0x572361=_0x2ff5[_0x52cdec];return _0x572361;};'use strict';var _=require('lodash');var util=require(_0x52ff('0x0'));var path=require(_0x52ff('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x52ff('0x2'));var utils=require(_0x52ff('0x3'));var sUtils=require(_0x52ff('0x4'));var logger=require(_0x52ff('0x5'))(_0x52ff('0x6'));var rpc={'openchannelQueueReport':require(_0x52ff('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x52ff('0x8')),'smsQueueReport':require(_0x52ff('0x9')),'faxQueueReport':require(_0x52ff('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x52ff('0xb'));function getId(_0xbbba62,_0x3cfd13,_0x17ca0b){return util[_0x52ff('0xc')](_0x52ff('0xd'),_0xbbba62,_0x3cfd13||0x0,_0x17ca0b||0x0);}function getIntervals(_0x27c199,_0x16aaf4){var _0x5e127e=[];if(!_[_0x52ff('0xe')](_0x16aaf4[_0x52ff('0xf')])&&!_[_0x52ff('0xe')](_0x27c199[_0x16aaf4[_0x52ff('0xf')]])&&!_[_0x52ff('0xe')](_0x27c199[_0x16aaf4[_0x52ff('0xf')]]['Intervals'])){_0x5e127e=_['map'](_0x27c199[_0x16aaf4['IntervalId']]['Intervals'],_0x52ff('0x10'));}else if(!_['isNil'](_0x16aaf4[_0x52ff('0x10')])){_0x5e127e=[_0x16aaf4[_0x52ff('0x10')]];}return _0x5e127e;}exports['listen']=function(_0xb12d66){_0xb12d66[_0x52ff('0x11')]={};return new BPromise(function(_0x3c787b,_0x2023d3){var _0x418202={'Start':function(_0x27c987){var _0x5a47b2=this;return new Promise(function(_0x3a1a83,_0x2b8846){if(_0x27c987){try{var _0x3154b7=[];var _0x4c83f=getId(_0x27c987[_0x52ff('0x12')],_0x27c987[_0x52ff('0x13')]?_0x27c987['message']['id']:0x0,_0x27c987[_0x52ff('0x14')]?_0x27c987[_0x52ff('0x14')]['id']:0x0);var _0x3cbe60=sUtils[_0x52ff('0x15')](_0xb12d66,_0x27c987);if(_0x27c987['transfer']||!_0x3cbe60&&_0x27c987[_0x52ff('0x16')]&&_[_0x52ff('0x17')](_0x27c987[_0x52ff('0x16')])&&_0x27c987[_0x52ff('0x16')][_0x52ff('0x18')]){for(var _0x10ad04=0x0;_0x10ad04<_0x27c987[_0x52ff('0x16')][_0x52ff('0x18')];_0x10ad04+=0x1){var _0x1df213=_0x27c987[_0x52ff('0x16')][_0x10ad04];if(fs[_0x52ff('0x19')](path[_0x52ff('0x1a')](__dirname,_0x52ff('0x16'),_0x1df213[_0x52ff('0x1b')]+_0x52ff('0x1c')))){var _0xe68eb5=[];switch(_0x1df213[_0x52ff('0x1b')][_0x52ff('0x1d')]()){case'autoreply':var _0x376edf=_0x1df213[_0x52ff('0x1e')][_0x52ff('0x1f')](',');if(_0x27c987[_0x52ff('0x12')]==='mail'){_0xe68eb5[_0x52ff('0x20')](_0x376edf[0x0]);_0xe68eb5[_0x52ff('0x20')](_0x376edf[0x1]);_0xe68eb5[_0x52ff('0x20')](_0x376edf['slice'](0x2,_0x376edf['length'])[_0x52ff('0x1a')](','));}else{_0xe68eb5[_0x52ff('0x20')](_0x376edf[0x0]);_0xe68eb5[_0x52ff('0x20')](_0x376edf[_0x52ff('0x21')](0x1,_0x376edf[_0x52ff('0x18')])[_0x52ff('0x1a')](','));}break;case _0x52ff('0x22'):var _0x322260=_0x1df213[_0x52ff('0x1e')][_0x52ff('0x1f')](',');_0xe68eb5[_0x52ff('0x20')](_0x322260[0x0]);_0xe68eb5[_0x52ff('0x20')](_0x322260[0x1]);_0xe68eb5[_0x52ff('0x20')](_0x322260[_0x52ff('0x21')](0x2,_0x322260['length'])[_0x52ff('0x1a')](','));break;case'dialogflowv2':var _0x233a3e=_0x1df213[_0x52ff('0x1e')]['split'](',');_0xe68eb5[_0x52ff('0x20')](_0x233a3e[0x0]);_0xe68eb5[_0x52ff('0x20')](_0x233a3e[0x1]);_0xe68eb5[_0x52ff('0x20')](_0x233a3e[0x2]);_0xe68eb5[_0x52ff('0x20')](_0x233a3e[0x3]);_0xe68eb5['push'](_0x233a3e[_0x52ff('0x21')](0x4,_0x233a3e[_0x52ff('0x18')])['join'](','));break;case _0x52ff('0x23'):var _0x2f437d=_0x1df213[_0x52ff('0x1e')][_0x52ff('0x1f')](',');_0xe68eb5['push'](_0x2f437d[0x0]);_0xe68eb5[_0x52ff('0x20')](_0x2f437d[0x1]);_0xe68eb5[_0x52ff('0x20')](_0x2f437d[0x2]);_0xe68eb5['push'](_0x2f437d[0x3]);_0xe68eb5[_0x52ff('0x20')](_0x2f437d[_0x52ff('0x21')](0x4,_0x2f437d[_0x52ff('0x18')])[_0x52ff('0x1a')](','));break;case'message':_0xe68eb5[_0x52ff('0x20')](_0x1df213['appdata']);break;case _0x52ff('0x24'):_0xe68eb5[_0x52ff('0x20')](_0x1df213['TagId']);_0xe68eb5[_0x52ff('0x20')](_0x1df213[_0x52ff('0x1e')]);break;case _0x52ff('0x25'):var _0x5e5ac1=utils['getMustacheRender'](_0x27c987[_0x52ff('0x26')]['notificationTemplate'],_0x27c987);var _0x38a8f1=_0x1df213['appdata'][_0x52ff('0x1f')](',');_0xe68eb5[_0x52ff('0x20')](_0x38a8f1[0x0]);_0xe68eb5['push'](_0x38a8f1[0x1]);_0xe68eb5[_0x52ff('0x20')](_0x38a8f1[0x2]);_0xe68eb5[_0x52ff('0x20')](_0x38a8f1[0x3]);_0xe68eb5[_0x52ff('0x20')](_0x38a8f1[0x4]);_0xe68eb5[_0x52ff('0x20')](_0x38a8f1[0x5]);_0xe68eb5[_0x52ff('0x20')](_0x38a8f1[0x6]);_0xe68eb5[_0x52ff('0x20')](_0x38a8f1[0x7]);_0xe68eb5[_0x52ff('0x20')](_0x38a8f1[0x8]);_0xe68eb5['push'](_0x38a8f1[0x9]);_0xe68eb5[_0x52ff('0x20')](_0x38a8f1[0xa]);_0xe68eb5[_0x52ff('0x20')](_0x27c987[_0x52ff('0x14')]['id']);_0xe68eb5[_0x52ff('0x20')](_0x27c987[_0x52ff('0x13')]['id']);_0xe68eb5[_0x52ff('0x20')](_0x1df213[_0x52ff('0x27')]);_0xe68eb5['push'](_0x27c987[_0x52ff('0x14')][_0x52ff('0x28')]);_0xe68eb5[_0x52ff('0x20')](_0x27c987['body']['body']);_0xe68eb5[_0x52ff('0x20')](_0x5e5ac1);break;default:_0xe68eb5=_['isNil'](_0x1df213[_0x52ff('0x1e')])?[]:_0x1df213[_0x52ff('0x1e')][_0x52ff('0x1f')](',');}var _0x28c330={'id':util[_0x52ff('0xc')](_0x52ff('0x29'),_0x4c83f,_0x1df213['id'],_0x1df213[_0x52ff('0x1b')]),'condition':require(_0x52ff('0x2a'))[_0x52ff('0x2b')](_0x4c83f,getIntervals(_0xb12d66['intervals'],_0x1df213),_0xb12d66),'consequence':require(_0x52ff('0x2c')+_0x1df213[_0x52ff('0x1b')])['consequence'](_0x4c83f,_0xe68eb5,_0xb12d66,_0x27c987),'p':_0x1df213[_0x52ff('0x2d')]||0x0};logger[_0x52ff('0x2e')](_0x52ff('0x2f'),_0x28c330['id'],_0x52ff('0x30'),getIntervals(_0xb12d66[_0x52ff('0x31')],_0x1df213)[_0x52ff('0x1a')](_0x52ff('0x32')));_0x3154b7['push'](_0x28c330);}else{logger[_0x52ff('0x33')](_0x52ff('0x34'),path[_0x52ff('0x1a')](__dirname,_0x52ff('0x16'),_0x1df213['app']+'.js'));}}_0xb12d66[_0x52ff('0x11')][_0x4c83f]=new RuleEngine(_0x3154b7);_0xb12d66[_0x52ff('0x11')][_0x4c83f][_0x52ff('0x35')](_0x27c987,function(_0x375c87){logger[_0x52ff('0x2e')]('Applications\x20executed',JSON[_0x52ff('0x36')](_0x375c87[_0x52ff('0x37')]));if(_0xb12d66[_0x52ff('0x11')][_0x4c83f]){_0xb12d66[_0x52ff('0x11')][_0x4c83f][_0x52ff('0x38')](_0x52ff('0x39'));}});return _0x3a1a83({'code':0xc8,'message':_0x27c987});}else{if(_0x3cbe60){logger[_0x52ff('0x2e')](util[_0x52ff('0xc')](_0x52ff('0x3a'),_0x4c83f));}else{logger[_0x52ff('0x2e')]('No\x20applications\x20to\x20execute');}return _0x3a1a83({'code':0xc8,'message':_0x27c987});}}catch(_0x1423c8){logger[_0x52ff('0x33')](_0x1423c8[_0x52ff('0x3b')]);return _0x2b8846(_0x5a47b2[_0x52ff('0x33')](0x1f4,_0x1423c8));}}return _0x2b8846(_0x52ff('0x3c'));});},'AcceptMessage':function(_0x4b43b2){var _0x38043c=this;return new Promise(function(_0x385e92,_0x4a1888){if(_0x4b43b2[_0x52ff('0x3d')]&&_0x4b43b2[_0x52ff('0x3d')]['id']){if(_0xb12d66[_0x52ff('0x3e')][_0x4b43b2[_0x52ff('0x3d')]['id']]){_0xb12d66['agents'][_0x4b43b2['agent']['id']][_0x52ff('0x3f')]=![];_0xb12d66[_0x52ff('0x3e')][_0x4b43b2[_0x52ff('0x3d')]['id']][_0x52ff('0x40')]=undefined;}}if(_0x4b43b2[_0x52ff('0x13')]&&_0x4b43b2[_0x52ff('0x13')]['id']){try{var _0x38283f=getId(_0x4b43b2['channel'],_0x4b43b2['message']?_0x4b43b2[_0x52ff('0x13')]['id']:0x0,_0x4b43b2[_0x52ff('0x14')]?_0x4b43b2[_0x52ff('0x14')]['id']:0x0);if(_0xb12d66[_0x52ff('0x11')][_0x38283f]){_0xb12d66[_0x52ff('0x11')][_0x38283f][_0x52ff('0x38')](_0x52ff('0x41'));if(rpc[_0x4b43b2[_0x52ff('0x12')]+_0x52ff('0x42')]){rpc[_0x4b43b2['channel']+_0x52ff('0x42')][_0x52ff('0x43')](_0x38283f,{'UserId':_0x4b43b2[_0x52ff('0x13')][_0x52ff('0x44')]})[_0x52ff('0x45')](function(){logger['error'](_0x52ff('0x46'));});}}return _0x385e92({'code':0xc8,'message':_0x4b43b2});}catch(_0xcef115){logger[_0x52ff('0x33')](_0xcef115[_0x52ff('0x3b')]);return _0x4a1888(_0x38043c['error'](0x1f4,_0xcef115));}}logger[_0x52ff('0x33')](_0x52ff('0x47'));return _0x4a1888(_0x38043c[_0x52ff('0x33')](0x1f4,_0x52ff('0x47')));});},'RejectMessage':function(_0x4479c1){var _0xdd2625=this;return new Promise(function(_0x559118,_0x3f6f62){if(_0x4479c1['agent']&&_0x4479c1[_0x52ff('0x3d')]['id']){try{if(_0xb12d66[_0x52ff('0x3e')][_0x4479c1[_0x52ff('0x3d')]['id']]){_0xb12d66[_0x52ff('0x3e')][_0x4479c1['agent']['id']][_0x52ff('0x3f')]=![];_0xb12d66['agents'][_0x4479c1[_0x52ff('0x3d')]['id']]['busyQueue']=undefined;}return _0x559118({'code':0xc8,'message':_0x4479c1});}catch(_0x5003d0){logger[_0x52ff('0x33')](_0x5003d0[_0x52ff('0x3b')]);return _0x3f6f62(_0xdd2625['error'](0x1f4,_0x5003d0));}}logger[_0x52ff('0x33')]('message\x20is\x20empty');return _0x3f6f62(_0xdd2625[_0x52ff('0x33')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x2ce44d){var _0x319fc7=this;return new Promise(function(_0x41c47b,_0xd3f42d){if(_0x2ce44d['channel']&&_0x2ce44d[_0x52ff('0x14')]&&_0x2ce44d[_0x52ff('0x14')]['id']){try{var _0x312c48=getId(_0x2ce44d[_0x52ff('0x12')],_0x2ce44d[_0x52ff('0x13')]?_0x2ce44d[_0x52ff('0x13')]['id']:0x0,_0x2ce44d[_0x52ff('0x14')]?_0x2ce44d['interaction']['id']:0x0);if(_0xb12d66['rules'][_0x312c48]){_0xb12d66['rules'][_0x312c48]['emit'](_0x52ff('0x41'));}return _0x41c47b({'code':0xc8,'message':_0x2ce44d});}catch(_0x1e77ad){logger[_0x52ff('0x33')](_0x1e77ad[_0x52ff('0x3b')]);return _0xd3f42d(_0x319fc7[_0x52ff('0x33')](0x1f4,_0x1e77ad));}}logger[_0x52ff('0x33')]('message\x20is\x20empty');return _0xd3f42d(_0x319fc7[_0x52ff('0x33')](0x1f4,_0x52ff('0x47')));});},'AgentCapacity':function(_0x286dbd){var _0x2c4ee6=this;return new Promise(function(_0x40460f,_0x31e637){if(_0xb12d66['agents'][_0x52ff('0x48')](_0x286dbd['id'])){for(var _0x25f5aa in _0x286dbd[_0x52ff('0x49')]){if(_0x286dbd[_0x52ff('0x49')][_0x52ff('0x48')](_0x25f5aa)){if(_0xb12d66[_0x52ff('0x3e')][_0x286dbd['id']][_0x52ff('0x48')](_0x25f5aa+_0x52ff('0x4a'))){_0xb12d66[_0x52ff('0x3e')][_0x286dbd['id']][_0x25f5aa+_0x52ff('0x4a')]=parseInt(_0x286dbd[_0x52ff('0x49')][_0x25f5aa],0xa);}}}_0xb12d66[_0x52ff('0x3e')][_0x286dbd['id']][_0x52ff('0x4b')]();return _0x40460f({'code':0xc8,'message':_0xb12d66[_0x52ff('0x3e')][_0x286dbd['id']]});}else{return _0x31e637(_0x2c4ee6['error'](0x1f4,_0x52ff('0x4c')));}});},'Agents':function(_0x33990d){return new Promise(function(_0x1b45b0){var _0x31aa09=_[_0x52ff('0x4d')](_0xb12d66[_0x52ff('0x3e')]);if(_0x33990d&&_0x33990d['id']){var _0xf4b281=_['find'](_0x31aa09,function(_0xfc9c40){return _0xfc9c40['id']===_0x33990d['id'];});_0x1b45b0(_0xf4b281);}else{_0x1b45b0({'count':_0x31aa09[_0x52ff('0x18')],'rows':_0x31aa09});}});},'ChatQueues':function(){return new Promise(function(_0x259441){var _0x377a58=[];for(var _0x49cf8c in _0xb12d66[_0x52ff('0x4e')]){if(_0xb12d66[_0x52ff('0x4e')][_0x52ff('0x48')](_0x49cf8c)){var _0x4b6772=_0xb12d66[_0x52ff('0x4e')][_0x49cf8c];var _0x3143a8={'id':_0x4b6772['id'],'available':_0x4b6772[_0x52ff('0x4f')],'loggedIn':_0x4b6772['loggedIn'],'name':_0x4b6772[_0x52ff('0x50')],'paused':_0x4b6772[_0x52ff('0x51')],'waiting':_0x4b6772[_0x52ff('0x52')]};_0x377a58[_0x52ff('0x20')](_0x3143a8);}}_0x259441({'count':_0x377a58[_0x52ff('0x18')],'rows':_0x377a58});});},'MailQueues':function(){return new Promise(function(_0x387a5c){var _0xc527c2=[];for(var _0x3105da in _0xb12d66[_0x52ff('0x53')]){if(_0xb12d66['mailQueues']['hasOwnProperty'](_0x3105da)){var _0x3db38a=_0xb12d66[_0x52ff('0x53')][_0x3105da];var _0x14f6d0={'id':_0x3db38a['id'],'available':_0x3db38a[_0x52ff('0x4f')],'loggedIn':_0x3db38a[_0x52ff('0x54')],'name':_0x3db38a[_0x52ff('0x50')],'paused':_0x3db38a[_0x52ff('0x51')],'waiting':_0x3db38a[_0x52ff('0x52')]};_0xc527c2[_0x52ff('0x20')](_0x14f6d0);}}_0x387a5c({'count':_0xc527c2[_0x52ff('0x18')],'rows':_0xc527c2});});},'OpenchannelQueues':function(){return new Promise(function(_0x5b3fe0){var _0x562d83=[];for(var _0x1e6a23 in _0xb12d66[_0x52ff('0x55')]){if(_0xb12d66[_0x52ff('0x55')][_0x52ff('0x48')](_0x1e6a23)){var _0x1c6ec0=_0xb12d66[_0x52ff('0x55')][_0x1e6a23];var _0x220336={'id':_0x1c6ec0['id'],'available':_0x1c6ec0[_0x52ff('0x4f')],'loggedIn':_0x1c6ec0[_0x52ff('0x54')],'name':_0x1c6ec0[_0x52ff('0x50')],'paused':_0x1c6ec0['paused'],'waiting':_0x1c6ec0[_0x52ff('0x52')]};_0x562d83[_0x52ff('0x20')](_0x220336);}}_0x5b3fe0({'count':_0x562d83[_0x52ff('0x18')],'rows':_0x562d83});});},'SmsQueues':function(){return new Promise(function(_0x33db64){var _0x242413=[];for(var _0x1fa59c in _0xb12d66['smsQueues']){if(_0xb12d66[_0x52ff('0x56')]['hasOwnProperty'](_0x1fa59c)){var _0x1bfe00=_0xb12d66['smsQueues'][_0x1fa59c];var _0x4be2c8={'id':_0x1bfe00['id'],'available':_0x1bfe00[_0x52ff('0x4f')],'loggedIn':_0x1bfe00[_0x52ff('0x54')],'name':_0x1bfe00['name'],'paused':_0x1bfe00[_0x52ff('0x51')],'waiting':_0x1bfe00[_0x52ff('0x52')]};_0x242413[_0x52ff('0x20')](_0x4be2c8);}}_0x33db64({'count':_0x242413[_0x52ff('0x18')],'rows':_0x242413});});},'FaxQueues':function(){return new Promise(function(_0xb259d7){var _0x5ae700=[];for(var _0x2d8f5f in _0xb12d66[_0x52ff('0x57')]){if(_0xb12d66[_0x52ff('0x57')][_0x52ff('0x48')](_0x2d8f5f)){var _0x4f1e54=_0xb12d66[_0x52ff('0x57')][_0x2d8f5f];var _0x40297e={'id':_0x4f1e54['id'],'available':_0x4f1e54[_0x52ff('0x4f')],'loggedIn':_0x4f1e54[_0x52ff('0x54')],'name':_0x4f1e54['name'],'paused':_0x4f1e54['paused'],'waiting':_0x4f1e54[_0x52ff('0x52')]};_0x5ae700[_0x52ff('0x20')](_0x40297e);}}_0xb259d7({'count':_0x5ae700[_0x52ff('0x18')],'rows':_0x5ae700});});},'WhatsappQueues':function(){return new Promise(function(_0x269267){var _0xb1839=[];for(var _0x26c4dc in _0xb12d66['whatsappQueues']){if(_0xb12d66[_0x52ff('0x58')][_0x52ff('0x48')](_0x26c4dc)){var _0x30802d=_0xb12d66[_0x52ff('0x58')][_0x26c4dc];var _0x427ab4={'id':_0x30802d['id'],'available':_0x30802d[_0x52ff('0x4f')],'loggedIn':_0x30802d[_0x52ff('0x54')],'name':_0x30802d['name'],'paused':_0x30802d[_0x52ff('0x51')],'waiting':_0x30802d['waiting']};_0xb1839[_0x52ff('0x20')](_0x427ab4);}}_0x269267({'count':_0xb1839[_0x52ff('0x18')],'rows':_0xb1839});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x26a30b){var _0x313376=_[_0x52ff('0x4d')](_0xb12d66[_0x52ff('0x59')]);_0x26a30b({'count':_0x313376[_0x52ff('0x18')],'rows':_0x313376});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x497149){var _0x22e393=_[_0x52ff('0x4d')](_0xb12d66[_0x52ff('0x5a')]);_0x497149({'count':_0x22e393[_0x52ff('0x18')],'rows':_0x22e393});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x56c794){var _0x28f89a=_[_0x52ff('0x4d')](_0xb12d66['openchannelQueuesWaitingInteractions']);_0x56c794({'count':_0x28f89a[_0x52ff('0x18')],'rows':_0x28f89a});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x36a4c5){var _0xf0a5db=_[_0x52ff('0x4d')](_0xb12d66[_0x52ff('0x5b')]);_0x36a4c5({'count':_0xf0a5db['length'],'rows':_0xf0a5db});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x211072){var _0x136ebb=_[_0x52ff('0x4d')](_0xb12d66[_0x52ff('0x5c')]);_0x211072({'count':_0x136ebb[_0x52ff('0x18')],'rows':_0x136ebb});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2860fe){var _0x2f588c=_[_0x52ff('0x4d')](_0xb12d66['whatsappQueuesWaitingInteractions']);_0x2860fe({'count':_0x2f588c[_0x52ff('0x18')],'rows':_0x2f588c});});}};var _0x8fa723=jayson[_0x52ff('0x5d')](_0x418202)[_0x52ff('0x5e')]();_0x8fa723['on'](_0x52ff('0x33'),function(_0x5befba){logger[_0x52ff('0x33')](JSON[_0x52ff('0x36')](_0x5befba));return _0x2023d3(_0x5befba);});_0x8fa723['listen'](0x232c,_0x52ff('0x5f'),function(){console['log'](_0x52ff('0x60'),0x232c);return _0x3c787b(_0x52ff('0x61')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 34fba14..2789487 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 _0x2a58=['result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','iftime\x20%s','indexOf','error','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','bluebird','jayson/promise','../../../config/logger','routing','client','http','request','then','message'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x2a58,0x1b8));var _0x82a5=function(_0x3dd467,_0x5782ad){_0x3dd467=_0x3dd467-0x0;var _0x86a7f3=_0x2a58[_0x3dd467];return _0x86a7f3;};'use strict';var util=require(_0x82a5('0x0'));var BPromise=require(_0x82a5('0x1'));var jayson=require(_0x82a5('0x2'));var _=require('lodash');var logger=require(_0x82a5('0x3'))(_0x82a5('0x4'));var client=jayson[_0x82a5('0x5')][_0x82a5('0x6')]({'port':0x232a});function request(_0x1f8c67,_0xa8e546){return new BPromise(function(_0x24d0c5,_0x27cebd){return client[_0x82a5('0x7')](_0x1f8c67,_0xa8e546)[_0x82a5('0x8')](function(_0x5af2f9){if(_0x5af2f9['error']){return _0x27cebd(_0x5af2f9['error'][_0x82a5('0x9')]);}else{return _0x24d0c5(_0x5af2f9[_0x82a5('0xa')]);}})[_0x82a5('0xb')](function(_0x1c8910){return _0x27cebd(_0x1c8910);});});}exports[_0x82a5('0xc')]=function(_0x267081,_0x110646,_0x80cbc7){return function(_0x483348){if(_0x80cbc7[_0x82a5('0xd')]&&!_0x80cbc7['rules'][_0x267081]){logger[_0x82a5('0xe')](_0x82a5('0xf'),_0x267081);return _0x483348[_0x82a5('0x10')]();}var _0x526650=[];for(var _0x69d6a3=0x0;_0x69d6a3<_0x110646[_0x82a5('0x11')];_0x69d6a3+=0x1){_0x526650['push'](request(_0x82a5('0x12'),{'command':util[_0x82a5('0x13')](_0x82a5('0x14'),_0x110646[_0x69d6a3])})['then'](function(_0x33e069){return _0x33e069&&_0x33e069[_0x82a5('0x9')]&&_0x33e069['message'][_0x82a5('0x15')]('true')>=0x0?!![]:![];})[_0x82a5('0xb')](function(){logger[_0x82a5('0x16')](_0x82a5('0x17'),_0x267081,_0x110646[_0x69d6a3]);}));}BPromise['all'](_0x526650)[_0x82a5('0x8')](function(_0x3bf44f){var _0x4e1f58=_[_0x82a5('0x18')](_0x3bf44f);logger[_0x82a5('0xe')](_0x82a5('0x19'),_0x267081,_0x110646[_0x82a5('0x1a')](_0x82a5('0x1b')),_0x4e1f58);_0x483348[_0x82a5('0x1c')](_0x4e1f58);})[_0x82a5('0xb')](function(_0xb461e2){logger['error'](_0x82a5('0x19'),_0x267081,_0x110646[_0x82a5('0x1a')](_0x82a5('0x1b')),_0xb461e2[_0x82a5('0x1d')]);_0x483348['stop']();});};}; \ No newline at end of file +var _0xe6f1=['jayson/promise','../../../config/logger','routing','client','http','request','then','error','message','result','catch','condition','info','stop','push','format','iftime\x20%s','true','join','\x20|\x20','[%s][INTERVAL]\x20%s\x20%s','stack','util'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe6f1,0x113));var _0x1e6f=function(_0x5eb180,_0x127912){_0x5eb180=_0x5eb180-0x0;var _0xc5f79c=_0xe6f1[_0x5eb180];return _0xc5f79c;};'use strict';var util=require(_0x1e6f('0x0'));var BPromise=require('bluebird');var jayson=require(_0x1e6f('0x1'));var _=require('lodash');var logger=require(_0x1e6f('0x2'))(_0x1e6f('0x3'));var client=jayson[_0x1e6f('0x4')][_0x1e6f('0x5')]({'port':0x232a});function request(_0x25d0be,_0x7f3b38){return new BPromise(function(_0x11858a,_0x15c6e2){return client[_0x1e6f('0x6')](_0x25d0be,_0x7f3b38)[_0x1e6f('0x7')](function(_0x42ee7a){if(_0x42ee7a['error']){return _0x15c6e2(_0x42ee7a[_0x1e6f('0x8')][_0x1e6f('0x9')]);}else{return _0x11858a(_0x42ee7a[_0x1e6f('0xa')]);}})[_0x1e6f('0xb')](function(_0x4b5d03){return _0x15c6e2(_0x4b5d03);});});}exports[_0x1e6f('0xc')]=function(_0x5c1378,_0x24275b,_0x3ce7bc){return function(_0x86adf1){if(_0x3ce7bc['rules']&&!_0x3ce7bc['rules'][_0x5c1378]){logger[_0x1e6f('0xd')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x5c1378);return _0x86adf1[_0x1e6f('0xe')]();}var _0x24fa7c=[];for(var _0x2a3b06=0x0;_0x2a3b06<_0x24275b['length'];_0x2a3b06+=0x1){_0x24fa7c[_0x1e6f('0xf')](request('Command',{'command':util[_0x1e6f('0x10')](_0x1e6f('0x11'),_0x24275b[_0x2a3b06])})[_0x1e6f('0x7')](function(_0xb834bd){return _0xb834bd&&_0xb834bd[_0x1e6f('0x9')]&&_0xb834bd[_0x1e6f('0x9')]['indexOf'](_0x1e6f('0x12'))>=0x0?!![]:![];})[_0x1e6f('0xb')](function(){logger[_0x1e6f('0x8')]('[%s][INTERVAL]\x20%s',_0x5c1378,_0x24275b[_0x2a3b06]);}));}BPromise['all'](_0x24fa7c)[_0x1e6f('0x7')](function(_0x2e5ae6){var _0x1ea890=_['some'](_0x2e5ae6);logger[_0x1e6f('0xd')]('[%s][INTERVAL]\x20%s\x20%s',_0x5c1378,_0x24275b[_0x1e6f('0x13')](_0x1e6f('0x14')),_0x1ea890);_0x86adf1['when'](_0x1ea890);})[_0x1e6f('0xb')](function(_0x1825c0){logger[_0x1e6f('0x8')](_0x1e6f('0x15'),_0x5c1378,_0x24275b[_0x1e6f('0x13')](_0x1e6f('0x14')),_0x1825c0[_0x1e6f('0x16')]);_0x86adf1[_0x1e6f('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 920958d..048222b 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 _0x96cc=['rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','lodash','./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','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','acwTimeout','CreateVoiceAgentReport','request','agentcalled','debug','destuniqueid','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','timeout','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause'];(function(_0x17692b,_0x3bada){var _0xdf8b3d=function(_0x4cfab7){while(--_0x4cfab7){_0x17692b['push'](_0x17692b['shift']());}};_0xdf8b3d(++_0x3bada);}(_0x96cc,0x16c));var _0xc96c=function(_0x80a6ad,_0x132c02){_0x80a6ad=_0x80a6ad-0x0;var _0x315c42=_0x96cc[_0x80a6ad];return _0x315c42;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var utils=require(_0xc96c('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5f11f2,_0x30bf8a){utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x4'),_0x5f11f2[_0xc96c('0x5')],_0x5f11f2[_0xc96c('0x6')],_0x5f11f2[_0xc96c('0x7')],_0x5f11f2[_0xc96c('0x8')],_0x5f11f2[_0xc96c('0x9')],_0x5f11f2['calleridnum'],_0x5f11f2[_0xc96c('0xa')],_0x5f11f2[_0xc96c('0xb')]));if(_0x5f11f2[_0xc96c('0x7')]){utils[_0xc96c('0xc')](_0x5f11f2[_0xc96c('0x7')])[_0xc96c('0xd')](function(_0x36b2b4){if(_0x36b2b4){_0x5f11f2['type']=_0x36b2b4[_0xc96c('0xe')];_0x5f11f2[_0xc96c('0xf')]=_0x5f11f2[_0xc96c('0x10')]?_0x36b2b4['acw']:![];_0x5f11f2[_0xc96c('0x11')]=_0x5f11f2['agentacw']?_0x36b2b4[_0xc96c('0x12')]:0x0;}utils['request'](_0xc96c('0x13'),_0x5f11f2);});}else{utils[_0xc96c('0x14')](_0xc96c('0x13'),_0x5f11f2);}if(_0x30bf8a){delete transfers[_0x5f11f2[_0xc96c('0x5')]];}else{delete agents[_0x5f11f2['destuniqueid']];}}exports[_0xc96c('0x15')]=function(_0x43fcaa){try{utils[_0xc96c('0x16')](util[_0xc96c('0x3')]('[%s][agents][agentcalled]',_0x43fcaa[_0xc96c('0x5')]),_0x43fcaa);agents[_0x43fcaa[_0xc96c('0x17')]]=_0x43fcaa;agents[_0x43fcaa[_0xc96c('0x17')]][_0xc96c('0x18')]=utils[_0xc96c('0x19')]();agents[_0x43fcaa[_0xc96c('0x17')]][_0xc96c('0xb')]=_0xc96c('0x1a');agents[_0x43fcaa[_0xc96c('0x17')]][_0xc96c('0xa')]=null;agents[_0x43fcaa[_0xc96c('0x17')]]['connectedlinename']=null;utils['info'](util[_0xc96c('0x3')](_0xc96c('0x1b'),_0x43fcaa[_0xc96c('0x5')],agents[_0x43fcaa[_0xc96c('0x17')]]['membername'],_0x43fcaa[_0xc96c('0x17')]));}catch(_0x100fdb){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x1d'),_0x43fcaa[_0xc96c('0x5')]),_0x100fdb);}};exports[_0xc96c('0x1e')]=function(_0x41daba){try{if(!_[_0xc96c('0x1f')](agents[_0x41daba[_0xc96c('0x17')]])){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x20'),_0x41daba[_0xc96c('0x5')]),_0x41daba);utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x21'),_0x41daba['uniqueid'],agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x8')],_0x41daba[_0xc96c('0x17')]));agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x1e')]=!![];agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x22')]=utils[_0xc96c('0x19')]();agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0xb')]='timeout';agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x23')]=_0xc96c('0x24');agents[_0x41daba[_0xc96c('0x17')]]['holdtime']=_0x41daba['ringtime']?parseInt(_0x41daba[_0xc96c('0x25')])/0x3e8:0x0;agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x26')]=0x0;unanswered[_0xc96c('0x27')](_0x41daba[_0xc96c('0x17')]);}}catch(_0x5e1727){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x20'),_0x41daba[_0xc96c('0x5')]),_0x5e1727);}};exports[_0xc96c('0x28')]=function(_0x40c72b){try{_[_0xc96c('0x29')](agents,function(_0x328ee4,_0x556108){if(_0x328ee4[_0xc96c('0x5')]==_0x40c72b['uniqueid']&&!_[_0xc96c('0x2a')](unanswered,_0x328ee4[_0xc96c('0x17')])){utils[_0xc96c('0x16')](util['format'](_0xc96c('0x2b'),_0x40c72b[_0xc96c('0x5')]),_0x40c72b);utils[_0xc96c('0x2')](util[_0xc96c('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x40c72b['uniqueid'],_0x328ee4[_0xc96c('0x8')],_0x328ee4[_0xc96c('0x17')]));_0x328ee4[_0xc96c('0x1e')]=!![];_0x328ee4['agentringnoanswerAt']=utils[_0xc96c('0x19')]();_0x328ee4[_0xc96c('0xb')]=_0xc96c('0x2c');_0x328ee4[_0xc96c('0x23')]='abandoned';_0x328ee4[_0xc96c('0x2d')]=_0x40c72b[_0xc96c('0x2d')];_0x328ee4['talktime']=0x0;writeDB(_0x328ee4);}});}catch(_0x2b1dec){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x2b'),_0x40c72b[_0xc96c('0x5')]),_0x2b1dec);}};exports[_0xc96c('0x2e')]=function(_0x4e8241){try{if(agents[_0x4e8241[_0xc96c('0x17')]]){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x2f'),_0x4e8241[_0xc96c('0x5')]),_0x4e8241);utils[_0xc96c('0x2')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x4e8241[_0xc96c('0x5')],agents[_0x4e8241[_0xc96c('0x17')]]['membername'],_0x4e8241['destuniqueid']));agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0x30')]=utils[_0xc96c('0x19')]();agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0xa')]=_0x4e8241[_0xc96c('0xa')];agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0x31')]=_0x4e8241[_0xc96c('0x31')];agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0x2d')]=_0x4e8241['ringtime'];agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0xb')]=_0xc96c('0x32');_[_0xc96c('0x29')](agents,function(_0x4eb180,_0x167671){if(_0x4eb180[_0xc96c('0x17')]!=_0x4e8241[_0xc96c('0x17')]&&_0x4eb180['uniqueid']==_0x4e8241['uniqueid']){_0x4eb180[_0xc96c('0x26')]=0x0;_0x4eb180[_0xc96c('0x2d')]=_0x4e8241[_0xc96c('0x25')];_0x4eb180['agentringnoanswer']=!![];_0x4eb180[_0xc96c('0x22')]=utils[_0xc96c('0x19')]();_0x4eb180[_0xc96c('0xb')]=_0xc96c('0x33');_0x4eb180[_0xc96c('0x23')]=_0xc96c('0x33');_0x4eb180[_0xc96c('0x34')]=_0x4e8241[_0xc96c('0x17')];_0x4eb180[_0xc96c('0x35')]=_0x4e8241['membername'];writeDB(_0x4eb180);}});}}catch(_0x4c3088){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x2f'),_0x4e8241[_0xc96c('0x5')]),_0x4c3088);}};exports['agentcomplete']=function(_0x5ee6ac){try{if(!_[_0xc96c('0x1f')](agents[_0x5ee6ac[_0xc96c('0x17')]])){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x36'),_0x5ee6ac[_0xc96c('0x5')]),_0x5ee6ac);utils[_0xc96c('0x2')](util['format'](_0xc96c('0x37'),_0x5ee6ac[_0xc96c('0x5')],agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x8')],_0x5ee6ac['destuniqueid']));agents[_0x5ee6ac['destuniqueid']][_0xc96c('0x10')]=!![];agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x38')]=utils[_0xc96c('0x19')]();agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x26')]=utils[_0xc96c('0x39')](agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x38')],agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x30')]);agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x23')]=_0x5ee6ac['reason'];agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0xb')]=_0xc96c('0x3a');writeDB(agents[_0x5ee6ac[_0xc96c('0x17')]]);}}catch(_0x56bce1){utils[_0xc96c('0x1c')](util['format'](_0xc96c('0x36'),_0x5ee6ac[_0xc96c('0x5')]),_0x56bce1);}};exports['blindtransfer']=function(_0x2581ae){try{if(!_[_0xc96c('0x1f')](agents[_0x2581ae[_0xc96c('0x3b')]])){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x3c'),_0x2581ae['uniqueid']),_0x2581ae);utils['info'](util['format'](_0xc96c('0x3d'),_0x2581ae['uniqueid'],agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x8')],agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x5')]));agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x3e')]=!![];agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x3f')]=_0xc96c('0x40');agents[_0x2581ae[_0xc96c('0x3b')]]['transferexten']=_0x2581ae[_0xc96c('0x41')];agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x42')]=agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x5')];}}catch(_0xcde9){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')]('[%s][agents][blindtransfer]',_0x2581ae['uniqueid']),_0xcde9);}};exports['attendedtransfer']=function(_0x5c3d95){try{utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x43'),_0x5c3d95[_0xc96c('0x44')]),_0x5c3d95);if(_0x5c3d95[_0xc96c('0x44')]==_0x5c3d95[_0xc96c('0x45')]){if(!_[_0xc96c('0x1f')](agents[_0x5c3d95['secondtransfereruniqueid']])){utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x46'),_0x5c3d95[_0xc96c('0x44')],agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x8')]));agents[_0x5c3d95[_0xc96c('0x47')]]['transfer']=!![];agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x3f')]=_0xc96c('0x48');agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x49')]=_0x5c3d95[_0xc96c('0x4a')];agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x42')]=_0x5c3d95[_0xc96c('0x44')];}if(_0x5c3d95[_0xc96c('0x4b')]&&agents[_0x5c3d95[_0xc96c('0x4b')]]){agents[_0x5c3d95[_0xc96c('0x4b')]][_0xc96c('0x4c')]=0x1;transfers[_0x5c3d95[_0xc96c('0x4b')]]=_['clone'](agents[_0x5c3d95[_0xc96c('0x4b')]]);transfers[_0x5c3d95[_0xc96c('0x4b')]][_0xc96c('0x4d')]=agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x4d')];transfers[_0x5c3d95['transfereeuniqueid']][_0xc96c('0x4e')]=agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x4e')];transfers[_0x5c3d95[_0xc96c('0x4b')]]['agentcalledAt']=utils[_0xc96c('0x19')]();transfers[_0x5c3d95[_0xc96c('0x4b')]]['agentconnectAt']=utils['now']();transfers[_0x5c3d95['transfereeuniqueid']][_0xc96c('0x2d')]=0x0;transfers[_0x5c3d95[_0xc96c('0x4b')]][_0xc96c('0x4c')]=0x2;}}else if(_0x5c3d95[_0xc96c('0x47')]==_0x5c3d95[_0xc96c('0x4f')]){if(!_['isNil'](agents[_0x5c3d95['origtransfereruniqueid']])){utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x46'),_0x5c3d95[_0xc96c('0x44')],agents[_0x5c3d95[_0xc96c('0x44')]]['membername']));agents[_0x5c3d95[_0xc96c('0x44')]][_0xc96c('0x3e')]=!![];agents[_0x5c3d95[_0xc96c('0x44')]][_0xc96c('0x3f')]='ATTENDED';agents[_0x5c3d95['origtransfereruniqueid']][_0xc96c('0x49')]=_0x5c3d95[_0xc96c('0x50')];agents[_0x5c3d95['origtransfereruniqueid']][_0xc96c('0x42')]=_0x5c3d95['secondtransfereruniqueid'];}if(_0x5c3d95[_0xc96c('0x51')]&&agents[_0x5c3d95[_0xc96c('0x51')]]){agents[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x4c')]=0x1;transfers[_0x5c3d95[_0xc96c('0x51')]]=_[_0xc96c('0x52')](agents[_0x5c3d95[_0xc96c('0x51')]]);transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x4d')]=agents[_0x5c3d95[_0xc96c('0x44')]]['calleridnum'];transfers[_0x5c3d95[_0xc96c('0x51')]]['calleridname']=agents[_0x5c3d95[_0xc96c('0x44')]][_0xc96c('0x4e')];transfers[_0x5c3d95['transfertargetuniqueid']][_0xc96c('0x18')]=utils['now']();transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x30')]=utils[_0xc96c('0x19')]();transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x2d')]=0x0;transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x4c')]=0x2;}}}catch(_0xbd6525){utils[_0xc96c('0x1c')](util['format'](_0xc96c('0x43'),_0x5c3d95[_0xc96c('0x44')]),_0xbd6525);}};exports[_0xc96c('0x53')]=function(_0x43f94e){try{utils['debug'](util[_0xc96c('0x3')](_0xc96c('0x54'),_0x43f94e['uniqueid']),_0x43f94e);if(agents[_0x43f94e['uniqueid']]&&agents[_0x43f94e[_0xc96c('0x5')]]['reason']===_0xc96c('0x24')){if(_0x43f94e[_0xc96c('0x55')]==='21'){agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x23')]=_0xc96c('0x56');agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0xb')]=_0xc96c('0x56');}utils[_0xc96c('0x2')](util['format'](_0xc96c('0x57'),_0x43f94e[_0xc96c('0x5')],agents[_0x43f94e[_0xc96c('0x5')]]['membername'],agents[_0x43f94e['uniqueid']][_0xc96c('0x23')],agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0xb')]));writeDB(agents[_0x43f94e[_0xc96c('0x5')]]);var _0x1efa88=unanswered[_0xc96c('0x58')](_0x43f94e[_0xc96c('0x5')]);if(_0x1efa88>-0x1){unanswered['splice'](_0x1efa88,0x1);}}if(transfers[_0x43f94e[_0xc96c('0x5')]]){transfers[_0x43f94e[_0xc96c('0x5')]]['agentcomplete']=!![];transfers[_0x43f94e[_0xc96c('0x5')]]['agentcompleteAt']=utils[_0xc96c('0x19')]();transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x26')]=utils[_0xc96c('0x39')](transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x38')],transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x30')]);transfers[_0x43f94e[_0xc96c('0x5')]]['reason']=_0xc96c('0x59');transfers[_0x43f94e[_0xc96c('0x5')]]['lastevent']=_0xc96c('0x3a');utils['info'](util[_0xc96c('0x3')](_0xc96c('0x57'),_0x43f94e[_0xc96c('0x5')],transfers[_0x43f94e['uniqueid']][_0xc96c('0x8')],transfers[_0x43f94e[_0xc96c('0x5')]]['reason'],transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0xb')]));writeDB(transfers[_0x43f94e[_0xc96c('0x5')]],!![]);}if(agents[_0x43f94e['uniqueid']]&&agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x30')]){agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x10')]=!![];agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x38')]=utils[_0xc96c('0x19')]();agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x26')]=utils[_0xc96c('0x39')](agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x38')],agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x30')]);agents[_0x43f94e[_0xc96c('0x5')]]['reason']=agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x3e')]?_0xc96c('0x3e'):_0xc96c('0x59');agents[_0x43f94e[_0xc96c('0x5')]]['lastevent']=_0xc96c('0x3a');utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x57'),_0x43f94e[_0xc96c('0x5')],agents[_0x43f94e['uniqueid']]['membername'],agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x23')],agents[_0x43f94e['uniqueid']][_0xc96c('0xb')]));writeDB(agents[_0x43f94e[_0xc96c('0x5')]]);}}catch(_0x563449){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')]('[%s][agents][hangup]',_0x43f94e[_0xc96c('0x5')]),_0x563449);}}; \ No newline at end of file +var _0x0102=['agentringnoanswerAt','now','reason','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','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','agentcompleteAt','diffTime','complete','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','util','./utils','queue','membername','interface','calleridnum','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','format','[%s][agents][agentcalled]','agentcalledAt','connectedlinenum','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','debug','[%s][agents][agentringnoanswer]'];(function(_0x43b407,_0x3e0426){var _0x405d10=function(_0x109b8a){while(--_0x109b8a){_0x43b407['push'](_0x43b407['shift']());}};_0x405d10(++_0x3e0426);}(_0x0102,0x186));var _0x2010=function(_0x13f73b,_0x114836){_0x13f73b=_0x13f73b-0x0;var _0x56b4bd=_0x0102[_0x13f73b];return _0x56b4bd;};'use strict';var _=require('lodash');var util=require(_0x2010('0x0'));var utils=require(_0x2010('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x34c31e,_0x9ae519){utils['info'](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x34c31e['uniqueid'],_0x34c31e['channel'],_0x34c31e[_0x2010('0x2')],_0x34c31e[_0x2010('0x3')],_0x34c31e[_0x2010('0x4')],_0x34c31e[_0x2010('0x5')],_0x34c31e['connectedlinenum'],_0x34c31e[_0x2010('0x6')]));if(_0x34c31e['queue']){utils[_0x2010('0x7')](_0x34c31e[_0x2010('0x2')])['then'](function(_0x1f94ca){if(_0x1f94ca){_0x34c31e[_0x2010('0x8')]=_0x1f94ca[_0x2010('0x8')];_0x34c31e[_0x2010('0x9')]=_0x34c31e[_0x2010('0xa')]?_0x1f94ca[_0x2010('0xb')]:![];_0x34c31e[_0x2010('0xc')]=_0x34c31e[_0x2010('0x9')]?_0x1f94ca[_0x2010('0xd')]:0x0;}utils[_0x2010('0xe')](_0x2010('0xf'),_0x34c31e);});}else{utils[_0x2010('0xe')](_0x2010('0xf'),_0x34c31e);}if(_0x9ae519){delete transfers[_0x34c31e[_0x2010('0x10')]];}else{delete agents[_0x34c31e[_0x2010('0x11')]];}}exports[_0x2010('0x12')]=function(_0x528a38){try{utils['debug'](util[_0x2010('0x13')](_0x2010('0x14'),_0x528a38[_0x2010('0x10')]),_0x528a38);agents[_0x528a38[_0x2010('0x11')]]=_0x528a38;agents[_0x528a38[_0x2010('0x11')]][_0x2010('0x15')]=utils['now']();agents[_0x528a38[_0x2010('0x11')]][_0x2010('0x6')]='called';agents[_0x528a38[_0x2010('0x11')]][_0x2010('0x16')]=null;agents[_0x528a38[_0x2010('0x11')]][_0x2010('0x17')]=null;utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x19'),_0x528a38[_0x2010('0x10')],agents[_0x528a38[_0x2010('0x11')]]['membername'],_0x528a38['destuniqueid']));}catch(_0x3c72a8){utils[_0x2010('0x1a')](util[_0x2010('0x13')](_0x2010('0x14'),_0x528a38['uniqueid']),_0x3c72a8);}};exports['agentringnoanswer']=function(_0x22c252){try{if(!_[_0x2010('0x1b')](agents[_0x22c252[_0x2010('0x11')]])){utils[_0x2010('0x1c')](util[_0x2010('0x13')](_0x2010('0x1d'),_0x22c252['uniqueid']),_0x22c252);utils[_0x2010('0x18')](util[_0x2010('0x13')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x22c252['uniqueid'],agents[_0x22c252['destuniqueid']][_0x2010('0x3')],_0x22c252['destuniqueid']));agents[_0x22c252[_0x2010('0x11')]]['agentringnoanswer']=!![];agents[_0x22c252['destuniqueid']][_0x2010('0x1e')]=utils[_0x2010('0x1f')]();agents[_0x22c252['destuniqueid']][_0x2010('0x6')]='timeout';agents[_0x22c252[_0x2010('0x11')]][_0x2010('0x20')]=_0x2010('0x21');agents[_0x22c252[_0x2010('0x11')]][_0x2010('0x22')]=_0x22c252[_0x2010('0x23')]?parseInt(_0x22c252[_0x2010('0x23')])/0x3e8:0x0;agents[_0x22c252[_0x2010('0x11')]][_0x2010('0x24')]=0x0;unanswered[_0x2010('0x25')](_0x22c252[_0x2010('0x11')]);}}catch(_0x2ebdbb){utils['error'](util[_0x2010('0x13')]('[%s][agents][agentringnoanswer]',_0x22c252[_0x2010('0x10')]),_0x2ebdbb);}};exports[_0x2010('0x26')]=function(_0xd16c04){try{_[_0x2010('0x27')](agents,function(_0x564a64,_0x554f66){if(_0x564a64[_0x2010('0x10')]==_0xd16c04['uniqueid']&&!_[_0x2010('0x28')](unanswered,_0x564a64[_0x2010('0x11')])){utils['debug'](util[_0x2010('0x13')](_0x2010('0x29'),_0xd16c04[_0x2010('0x10')]),_0xd16c04);utils[_0x2010('0x18')](util[_0x2010('0x13')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0xd16c04[_0x2010('0x10')],_0x564a64[_0x2010('0x3')],_0x564a64[_0x2010('0x11')]));_0x564a64['agentringnoanswer']=!![];_0x564a64['agentringnoanswerAt']=utils[_0x2010('0x1f')]();_0x564a64[_0x2010('0x6')]=_0x2010('0x2a');_0x564a64['reason']='abandoned';_0x564a64[_0x2010('0x22')]=_0xd16c04[_0x2010('0x22')];_0x564a64[_0x2010('0x24')]=0x0;writeDB(_0x564a64);}});}catch(_0x339fd2){utils[_0x2010('0x1a')](util['format']('[%s][agents][queuecallerabandon]',_0xd16c04['uniqueid']),_0x339fd2);}};exports[_0x2010('0x2b')]=function(_0x447eed){try{if(agents[_0x447eed[_0x2010('0x11')]]){utils['debug'](util[_0x2010('0x13')](_0x2010('0x2c'),_0x447eed[_0x2010('0x10')]),_0x447eed);utils[_0x2010('0x18')](util['format'](_0x2010('0x2d'),_0x447eed[_0x2010('0x10')],agents[_0x447eed[_0x2010('0x11')]]['membername'],_0x447eed[_0x2010('0x11')]));agents[_0x447eed['destuniqueid']][_0x2010('0x2e')]=utils[_0x2010('0x1f')]();agents[_0x447eed[_0x2010('0x11')]][_0x2010('0x16')]=_0x447eed[_0x2010('0x16')];agents[_0x447eed[_0x2010('0x11')]]['connectedlinename']=_0x447eed[_0x2010('0x17')];agents[_0x447eed['destuniqueid']][_0x2010('0x22')]=_0x447eed[_0x2010('0x23')];agents[_0x447eed[_0x2010('0x11')]][_0x2010('0x6')]=_0x2010('0x2f');_[_0x2010('0x27')](agents,function(_0x398f10,_0x36ff3e){if(_0x398f10[_0x2010('0x11')]!=_0x447eed[_0x2010('0x11')]&&_0x398f10[_0x2010('0x10')]==_0x447eed[_0x2010('0x10')]){_0x398f10[_0x2010('0x24')]=0x0;_0x398f10[_0x2010('0x22')]=_0x447eed['ringtime'];_0x398f10['agentringnoanswer']=!![];_0x398f10[_0x2010('0x1e')]=utils[_0x2010('0x1f')]();_0x398f10[_0x2010('0x6')]=_0x2010('0x30');_0x398f10[_0x2010('0x20')]=_0x2010('0x30');_0x398f10[_0x2010('0x31')]=_0x447eed['destuniqueid'];_0x398f10[_0x2010('0x32')]=_0x447eed['membername'];writeDB(_0x398f10);}});}}catch(_0x27fd64){utils[_0x2010('0x1a')](util[_0x2010('0x13')](_0x2010('0x2c'),_0x447eed[_0x2010('0x10')]),_0x27fd64);}};exports['agentcomplete']=function(_0x364338){try{if(!_[_0x2010('0x1b')](agents[_0x364338[_0x2010('0x11')]])){utils[_0x2010('0x1c')](util['format'](_0x2010('0x33'),_0x364338['uniqueid']),_0x364338);utils['info'](util['format'](_0x2010('0x34'),_0x364338[_0x2010('0x10')],agents[_0x364338[_0x2010('0x11')]][_0x2010('0x3')],_0x364338[_0x2010('0x11')]));agents[_0x364338[_0x2010('0x11')]]['agentcomplete']=!![];agents[_0x364338[_0x2010('0x11')]][_0x2010('0x35')]=utils[_0x2010('0x1f')]();agents[_0x364338['destuniqueid']]['talktime']=utils[_0x2010('0x36')](agents[_0x364338['destuniqueid']][_0x2010('0x35')],agents[_0x364338[_0x2010('0x11')]][_0x2010('0x2e')]);agents[_0x364338[_0x2010('0x11')]]['reason']=_0x364338[_0x2010('0x20')];agents[_0x364338[_0x2010('0x11')]][_0x2010('0x6')]=_0x2010('0x37');writeDB(agents[_0x364338[_0x2010('0x11')]]);}}catch(_0x2a53b3){utils['error'](util[_0x2010('0x13')](_0x2010('0x33'),_0x364338[_0x2010('0x10')]),_0x2a53b3);}};exports['blindtransfer']=function(_0x30e5d0){try{if(!_[_0x2010('0x1b')](agents[_0x30e5d0['transfereruniqueid']])){utils[_0x2010('0x1c')](util[_0x2010('0x13')](_0x2010('0x38'),_0x30e5d0[_0x2010('0x10')]),_0x30e5d0);utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x39'),_0x30e5d0[_0x2010('0x10')],agents[_0x30e5d0['transfereruniqueid']]['membername'],agents[_0x30e5d0[_0x2010('0x3a')]][_0x2010('0x10')]));agents[_0x30e5d0['transfereruniqueid']][_0x2010('0x3b')]=!![];agents[_0x30e5d0[_0x2010('0x3a')]][_0x2010('0x3c')]=_0x2010('0x3d');agents[_0x30e5d0[_0x2010('0x3a')]]['transferexten']=_0x30e5d0['extension'];agents[_0x30e5d0[_0x2010('0x3a')]][_0x2010('0x3e')]=agents[_0x30e5d0[_0x2010('0x3a')]][_0x2010('0x10')];}}catch(_0x38e596){utils[_0x2010('0x1a')](util[_0x2010('0x13')](_0x2010('0x38'),_0x30e5d0[_0x2010('0x10')]),_0x38e596);}};exports[_0x2010('0x3f')]=function(_0x1cc164){try{utils['debug'](util[_0x2010('0x13')](_0x2010('0x40'),_0x1cc164['origtransfereruniqueid']),_0x1cc164);if(_0x1cc164[_0x2010('0x41')]==_0x1cc164[_0x2010('0x42')]){if(!_[_0x2010('0x1b')](agents[_0x1cc164[_0x2010('0x43')]])){utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x44'),_0x1cc164[_0x2010('0x41')],agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x3')]));agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x3b')]=!![];agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x3c')]=_0x2010('0x45');agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x46')]=_0x1cc164[_0x2010('0x47')];agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x3e')]=_0x1cc164[_0x2010('0x41')];}if(_0x1cc164[_0x2010('0x48')]&&agents[_0x1cc164[_0x2010('0x48')]]){agents[_0x1cc164['transfereeuniqueid']][_0x2010('0x49')]=0x1;transfers[_0x1cc164['transfereeuniqueid']]=_['clone'](agents[_0x1cc164[_0x2010('0x48')]]);transfers[_0x1cc164[_0x2010('0x48')]]['calleridnum']=agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x5')];transfers[_0x1cc164[_0x2010('0x48')]][_0x2010('0x4a')]=agents[_0x1cc164['secondtransfereruniqueid']][_0x2010('0x4a')];transfers[_0x1cc164[_0x2010('0x48')]][_0x2010('0x15')]=utils[_0x2010('0x1f')]();transfers[_0x1cc164['transfereeuniqueid']][_0x2010('0x2e')]=utils['now']();transfers[_0x1cc164[_0x2010('0x48')]][_0x2010('0x22')]=0x0;transfers[_0x1cc164[_0x2010('0x48')]][_0x2010('0x49')]=0x2;}}else if(_0x1cc164['secondtransfereruniqueid']==_0x1cc164['secondtransfererlinkedid']){if(!_[_0x2010('0x1b')](agents[_0x1cc164[_0x2010('0x41')]])){utils['info'](util['format'](_0x2010('0x44'),_0x1cc164[_0x2010('0x41')],agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x3')]));agents[_0x1cc164['origtransfereruniqueid']][_0x2010('0x3b')]=!![];agents[_0x1cc164['origtransfereruniqueid']][_0x2010('0x3c')]=_0x2010('0x45');agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x46')]=_0x1cc164['secondtransfererexten'];agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x3e')]=_0x1cc164['secondtransfereruniqueid'];}if(_0x1cc164[_0x2010('0x4b')]&&agents[_0x1cc164[_0x2010('0x4b')]]){agents[_0x1cc164[_0x2010('0x4b')]][_0x2010('0x49')]=0x1;transfers[_0x1cc164[_0x2010('0x4b')]]=_[_0x2010('0x4c')](agents[_0x1cc164[_0x2010('0x4b')]]);transfers[_0x1cc164[_0x2010('0x4b')]][_0x2010('0x5')]=agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x5')];transfers[_0x1cc164[_0x2010('0x4b')]]['calleridname']=agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x4a')];transfers[_0x1cc164[_0x2010('0x4b')]]['agentcalledAt']=utils['now']();transfers[_0x1cc164[_0x2010('0x4b')]][_0x2010('0x2e')]=utils[_0x2010('0x1f')]();transfers[_0x1cc164[_0x2010('0x4b')]][_0x2010('0x22')]=0x0;transfers[_0x1cc164[_0x2010('0x4b')]]['agententerreason']=0x2;}}}catch(_0xe37cef){utils[_0x2010('0x1a')](util[_0x2010('0x13')]('[%s][agents][attendedtransfer]',_0x1cc164[_0x2010('0x41')]),_0xe37cef);}};exports[_0x2010('0x4d')]=function(_0x13d06d){try{utils['debug'](util[_0x2010('0x13')](_0x2010('0x4e'),_0x13d06d['uniqueid']),_0x13d06d);if(agents[_0x13d06d['uniqueid']]&&agents[_0x13d06d[_0x2010('0x10')]]['reason']==='timeout'){if(_0x13d06d[_0x2010('0x4f')]==='21'){agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x20')]=_0x2010('0x50');agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x6')]=_0x2010('0x50');}utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x51'),_0x13d06d['uniqueid'],agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x3')],agents[_0x13d06d['uniqueid']][_0x2010('0x20')],agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x6')]));writeDB(agents[_0x13d06d[_0x2010('0x10')]]);var _0x517afa=unanswered[_0x2010('0x52')](_0x13d06d[_0x2010('0x10')]);if(_0x517afa>-0x1){unanswered['splice'](_0x517afa,0x1);}}if(transfers[_0x13d06d['uniqueid']]){transfers[_0x13d06d[_0x2010('0x10')]]['agentcomplete']=!![];transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x35')]=utils[_0x2010('0x1f')]();transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x24')]=utils[_0x2010('0x36')](transfers[_0x13d06d[_0x2010('0x10')]]['agentcompleteAt'],transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x2e')]);transfers[_0x13d06d[_0x2010('0x10')]]['reason']=_0x2010('0x53');transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x6')]=_0x2010('0x37');utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x51'),_0x13d06d[_0x2010('0x10')],transfers[_0x13d06d['uniqueid']][_0x2010('0x3')],transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x20')],transfers[_0x13d06d['uniqueid']][_0x2010('0x6')]));writeDB(transfers[_0x13d06d[_0x2010('0x10')]],!![]);}if(agents[_0x13d06d['uniqueid']]&&agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x2e')]){agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0xa')]=!![];agents[_0x13d06d[_0x2010('0x10')]]['agentcompleteAt']=utils[_0x2010('0x1f')]();agents[_0x13d06d[_0x2010('0x10')]]['talktime']=utils[_0x2010('0x36')](agents[_0x13d06d[_0x2010('0x10')]]['agentcompleteAt'],agents[_0x13d06d[_0x2010('0x10')]]['agentconnectAt']);agents[_0x13d06d['uniqueid']][_0x2010('0x20')]=agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x3b')]?_0x2010('0x3b'):_0x2010('0x53');agents[_0x13d06d[_0x2010('0x10')]]['lastevent']=_0x2010('0x37');utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x51'),_0x13d06d['uniqueid'],agents[_0x13d06d[_0x2010('0x10')]]['membername'],agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x20')],agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x6')]));writeDB(agents[_0x13d06d['uniqueid']]);}}catch(_0x496280){utils['error'](util[_0x2010('0x13')]('[%s][agents][hangup]',_0x13d06d[_0x2010('0x10')]),_0x496280);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 068eae3..797eafb 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 _0xef1c=['[%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','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','includes','execif','gotoif','lodash','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','request','CreateVoiceCallReport','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','DOCUMENTATION','[%s][calls][newchannel]','newstate','debug','[%s][calls][newstate]','isNil','channelstate','systemanswertime','transfer','destinationchannel','now','disposition','toNumber','error','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','billableseconds','answertime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','origtransfererchannel','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid'];(function(_0x3b55d4,_0x9373){var _0x5ce0af=function(_0x2139f7){while(--_0x2139f7){_0x3b55d4['push'](_0x3b55d4['shift']());}};_0x5ce0af(++_0x9373);}(_0xef1c,0x14d));var _0xcef1=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xef1c[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xcef1('0x0'));var util=require('util');var utils=require(_0xcef1('0x1'));var dispositions=['NO\x20ANSWER','FAILED',_0xcef1('0x2'),_0xcef1('0x3'),_0xcef1('0x3'),_0xcef1('0x3'),_0xcef1('0x4'),_0xcef1('0x5'),_0xcef1('0x2'),_0xcef1('0x2'),_0xcef1('0x2')];var channels={};function writeDB(_0x28eaef){utils[_0xcef1('0x6')](util[_0xcef1('0x7')](_0xcef1('0x8'),_0x28eaef[_0xcef1('0x9')],_0x28eaef['channel'],_0x28eaef[_0xcef1('0xa')],_0x28eaef[_0xcef1('0xb')],_0x28eaef[_0xcef1('0xc')],_0x28eaef['calleridnum'],_0x28eaef[_0xcef1('0xd')],_0x28eaef[_0xcef1('0xe')]));if(_0x28eaef[_0xcef1('0xf')]){utils[_0xcef1('0x10')](_0x28eaef['accountcode'])['then'](function(_0xfafb30){if(_0xfafb30){_0x28eaef['UserId']=_0xfafb30['id'];}utils[_0xcef1('0x11')](_0xcef1('0x12'),_0x28eaef);});}else{utils[_0xcef1('0x11')](_0xcef1('0x12'),_0x28eaef);}if(channels[_0x28eaef[_0xcef1('0x9')]]){delete channels[_0x28eaef[_0xcef1('0x9')]];}}exports['newchannel']=function(_0x1297ae){try{utils['debug'](util[_0xcef1('0x7')]('[%s][calls][newchannel]',_0x1297ae[_0xcef1('0x9')]),_0x1297ae);if(_0x1297ae['uniqueid']==_0x1297ae[_0xcef1('0x13')]&&_0x1297ae[_0xcef1('0x14')]!=_0xcef1('0x15')){utils[_0xcef1('0x6')](util[_0xcef1('0x7')](_0xcef1('0x16'),_0x1297ae[_0xcef1('0x9')],_0x1297ae[_0xcef1('0x17')],_0x1297ae[_0xcef1('0x18')]));channels[_0x1297ae['uniqueid']]={'uniqueid':_0x1297ae[_0xcef1('0x9')],'accountcode':_0x1297ae[_0xcef1('0xf')],'source':_0x1297ae[_0xcef1('0x19')],'destination':_0x1297ae[_0xcef1('0x18')],'destinationcontext':_0x1297ae[_0xcef1('0x17')],'channel':_0x1297ae[_0xcef1('0x14')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xcef1('0x1a')};}}catch(_0x1e7efe){utils['error'](util[_0xcef1('0x7')](_0xcef1('0x1b'),_0x1297ae[_0xcef1('0x9')]),_0x1e7efe);}};exports[_0xcef1('0x1c')]=function(_0x4fbe5a){try{utils[_0xcef1('0x1d')](util[_0xcef1('0x7')](_0xcef1('0x1e'),_0x4fbe5a['uniqueid']),_0x4fbe5a);if(!_[_0xcef1('0x1f')](channels[_0x4fbe5a[_0xcef1('0x9')]])&&_0x4fbe5a[_0xcef1('0x20')]==0x6){utils['info'](util[_0xcef1('0x7')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x4fbe5a[_0xcef1('0x9')],_0x4fbe5a[_0xcef1('0x17')],_0x4fbe5a[_0xcef1('0x14')]));if(_['isNil'](channels[_0x4fbe5a[_0xcef1('0x9')]][_0xcef1('0x21')])){channels[_0x4fbe5a['uniqueid']]['systemanswertime']=utils['now']();}}else if(!_[_0xcef1('0x1f')](channels[_0x4fbe5a['linkedid']])&&_0x4fbe5a[_0xcef1('0x20')]==0x6&&_0x4fbe5a[_0xcef1('0x17')]!=_0xcef1('0x22')){utils['info'](util[_0xcef1('0x7')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x4fbe5a[_0xcef1('0x9')],_0x4fbe5a[_0xcef1('0x13')],_0x4fbe5a['context'],_0x4fbe5a['channel']));channels[_0x4fbe5a[_0xcef1('0x13')]][_0xcef1('0xf')]=_0x4fbe5a['accountcode'];channels[_0x4fbe5a[_0xcef1('0x13')]][_0xcef1('0x23')]=_0x4fbe5a[_0xcef1('0x14')];if(_['isNil'](channels[_0x4fbe5a['linkedid']]['answertime'])){channels[_0x4fbe5a[_0xcef1('0x13')]]['answertime']=utils[_0xcef1('0x24')]();}channels[_0x4fbe5a[_0xcef1('0x13')]][_0xcef1('0x25')]=dispositions[_[_0xcef1('0x26')](_0x4fbe5a['channelstate'])]||_0xcef1('0x4');}}catch(_0xf40f62){utils[_0xcef1('0x27')](util[_0xcef1('0x7')](_0xcef1('0x1e'),_0x4fbe5a[_0xcef1('0x9')]),_0xf40f62);}};exports[_0xcef1('0x28')]=function(_0x2167ea){try{if(!_['isNil'](channels[_0x2167ea[_0xcef1('0x9')]])){utils['debug'](util[_0xcef1('0x7')]('[%s][calls][hangup]',_0x2167ea[_0xcef1('0x9')]),_0x2167ea);if(_['isNil'](channels[_0x2167ea['uniqueid']][_0xcef1('0x29')])){channels[_0x2167ea['uniqueid']][_0xcef1('0x29')]=_0x2167ea[_0xcef1('0x2a')]+'\x20<'+_0x2167ea[_0xcef1('0x19')]+'>';}utils[_0xcef1('0x6')](util['format'](_0xcef1('0x2b'),_0x2167ea[_0xcef1('0x9')],channels[_0x2167ea['uniqueid']][_0xcef1('0x29')],_0x2167ea[_0xcef1('0x2c')]));channels[_0x2167ea[_0xcef1('0x9')]][_0xcef1('0x2d')]=utils['now']();channels[_0x2167ea[_0xcef1('0x9')]]['duration']=utils[_0xcef1('0x2e')](channels[_0x2167ea[_0xcef1('0x9')]]['endtime'],channels[_0x2167ea[_0xcef1('0x9')]][_0xcef1('0x2f')]);channels[_0x2167ea[_0xcef1('0x9')]][_0xcef1('0x30')]=channels[_0x2167ea[_0xcef1('0x9')]]['answertime']?utils[_0xcef1('0x2e')](channels[_0x2167ea[_0xcef1('0x9')]][_0xcef1('0x2d')],channels[_0x2167ea[_0xcef1('0x9')]][_0xcef1('0x31')]):0x0;writeDB(channels[_0x2167ea['uniqueid']]);}}catch(_0x515e65){utils[_0xcef1('0x27')](util[_0xcef1('0x7')](_0xcef1('0x32'),_0x2167ea[_0xcef1('0x9')]),_0x515e65);}};exports[_0xcef1('0x33')]=function(_0x526a11){try{if(!_['isNil'](channels[_0x526a11[_0xcef1('0x34')]])){utils[_0xcef1('0x1d')](util['format'](_0xcef1('0x35'),_0x526a11[_0xcef1('0x36')]),_0x526a11);if(channels[_0x526a11['localtwolinkedid']][_0xcef1('0x14')]==_0x526a11['transfereechannel']){utils[_0xcef1('0x6')](util[_0xcef1('0x7')](_0xcef1('0x37'),_0x526a11[_0xcef1('0x36')],_0x526a11[_0xcef1('0x34')],_0x526a11['secondtransfererchannel']));channels[_0x526a11[_0xcef1('0x34')]][_0xcef1('0x23')]=_0x526a11[_0xcef1('0x38')];channels[_0x526a11['localtwolinkedid']][_0xcef1('0x39')]=_0xcef1('0x3a');}else if(channels[_0x526a11[_0xcef1('0x34')]][_0xcef1('0x14')]=_0x526a11['transfertargetchannel']){utils[_0xcef1('0x6')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x526a11[_0xcef1('0x36')],_0x526a11['localtwolinkedid'],_0x526a11[_0xcef1('0x3b')]));channels[_0x526a11[_0xcef1('0x34')]][_0xcef1('0x23')]=_0x526a11[_0xcef1('0x3b')];channels[_0x526a11['localtwolinkedid']]['userfield']=_0xcef1('0x3a');}}}catch(_0xc2f5b5){utils[_0xcef1('0x27')](util[_0xcef1('0x7')](_0xcef1('0x35'),_0x526a11[_0xcef1('0x36')]),_0xc2f5b5);}};exports['musiconholdstart']=function(_0x229c60){try{if(!_['isNil'](channels[_0x229c60[_0xcef1('0x9')]])){utils[_0xcef1('0x1d')](util[_0xcef1('0x7')](_0xcef1('0x3c'),_0x229c60[_0xcef1('0x9')]),_0x229c60);channels[_0x229c60[_0xcef1('0x9')]]['musiconholdstartAt']=utils[_0xcef1('0x24')]();utils[_0xcef1('0x6')](util[_0xcef1('0x7')](_0xcef1('0x3d'),_0x229c60[_0xcef1('0x9')],channels[_0x229c60['uniqueid']][_0xcef1('0x3e')]));}}catch(_0x4c8878){utils['error'](util['format'](_0xcef1('0x3c'),_0x229c60[_0xcef1('0x9')]),_0x4c8878);}};exports['musiconholdstop']=function(_0x45896b){try{if(!_[_0xcef1('0x1f')](channels[_0x45896b[_0xcef1('0x9')]])){utils[_0xcef1('0x1d')](util['format'](_0xcef1('0x3f'),_0x45896b['uniqueid']),_0x45896b);if(!_[_0xcef1('0x1f')](channels[_0x45896b['uniqueid']]['musiconholdstartAt'])){channels[_0x45896b['uniqueid']][_0xcef1('0x40')]+=utils[_0xcef1('0x2e')](utils[_0xcef1('0x24')](),channels[_0x45896b[_0xcef1('0x9')]][_0xcef1('0x3e')]);utils[_0xcef1('0x6')](util[_0xcef1('0x7')](_0xcef1('0x41'),_0x45896b[_0xcef1('0x9')],channels[_0x45896b[_0xcef1('0x9')]][_0xcef1('0x40')]));delete channels[_0x45896b['uniqueid']]['musiconholdstartAt'];}}}catch(_0xbf823a){utils[_0xcef1('0x27')](util[_0xcef1('0x7')](_0xcef1('0x3f'),_0x45896b[_0xcef1('0x9')]),_0xbf823a);}};exports['varset']=function(_0x126f71){try{if(!_['isNil'](channels[_0x126f71[_0xcef1('0x9')]])){utils[_0xcef1('0x1d')](util[_0xcef1('0x7')](_0xcef1('0x42'),_0x126f71['uniqueid']),_0x126f71);if(!_[_0xcef1('0x1f')](_0x126f71['variable'][_0xcef1('0x43')])){utils[_0xcef1('0x6')](util['format'](_0xcef1('0x44'),_0x126f71[_0xcef1('0x9')],_0x126f71[_0xcef1('0x45')]));channels[_0x126f71[_0xcef1('0x9')]][_0xcef1('0x46')]=_0x126f71['value'];}if(!_[_0xcef1('0x1f')](_0x126f71[_0xcef1('0x47')][_0xcef1('0x48')])){utils[_0xcef1('0x6')](util[_0xcef1('0x7')](_0xcef1('0x49'),_0x126f71[_0xcef1('0x9')],_0x126f71[_0xcef1('0x45')]));channels[_0x126f71[_0xcef1('0x9')]]['destination']=_0x126f71[_0xcef1('0x45')];channels[_0x126f71[_0xcef1('0x9')]][_0xcef1('0x29')]='\x22'+_0x126f71[_0xcef1('0x45')]+'\x22\x20<'+_0x126f71[_0xcef1('0x45')]+'>';}if(!_[_0xcef1('0x1f')](_0x126f71[_0xcef1('0x47')][_0xcef1('0x4a')])||!_[_0xcef1('0x1f')](_0x126f71[_0xcef1('0x47')]['xmd-callerid'])){utils[_0xcef1('0x6')](util['format'](_0xcef1('0x4b'),_0x126f71[_0xcef1('0x9')],!_[_0xcef1('0x1f')](_0x126f71['variable'][_0xcef1('0x4a')])?_0xcef1('0x4a'):_0xcef1('0x4c'),_0x126f71[_0xcef1('0x45')]));channels[_0x126f71[_0xcef1('0x9')]][_0xcef1('0x29')]=_0x126f71[_0xcef1('0x45')];}if(!_[_0xcef1('0x1f')](_0x126f71[_0xcef1('0x47')][_0xcef1('0x4d')])||!_[_0xcef1('0x1f')](_0x126f71[_0xcef1('0x47')][_0xcef1('0x4e')])){utils[_0xcef1('0x6')](util[_0xcef1('0x7')](_0xcef1('0x4b'),_0x126f71[_0xcef1('0x9')],!_[_0xcef1('0x1f')](_0x126f71[_0xcef1('0x47')][_0xcef1('0x4d')])?'xmd-queue':'xmcs-queue',_0x126f71[_0xcef1('0x45')]));channels[_0x126f71['uniqueid']][_0xcef1('0x4f')]=_0xcef1('0x50');channels[_0x126f71['uniqueid']][_0xcef1('0x51')]=_0x126f71[_0xcef1('0x45')];channels[_0x126f71[_0xcef1('0x9')]][_0xcef1('0xa')]=!![];}if(!_[_0xcef1('0x1f')](_0x126f71[_0xcef1('0x47')][_0xcef1('0x52')])){utils['info'](util[_0xcef1('0x7')](_0xcef1('0x53'),_0x126f71[_0xcef1('0x9')],_0x126f71[_0xcef1('0x45')]));channels[_0x126f71[_0xcef1('0x9')]]['ContactId']=_0x126f71[_0xcef1('0x45')];}if(!_[_0xcef1('0x1f')](_0x126f71['variable']['xmd-cdrtype'])){utils['info'](util['format'](_0xcef1('0x54'),_0x126f71[_0xcef1('0x9')],_0x126f71[_0xcef1('0x45')]));channels[_0x126f71['uniqueid']][_0xcef1('0x55')]=_0x126f71[_0xcef1('0x45')];}if(!_['isNil'](_0x126f71['variable']['outboundrouteid'])){utils[_0xcef1('0x6')](util[_0xcef1('0x7')](_0xcef1('0x56'),_0x126f71[_0xcef1('0x9')],_0x126f71[_0xcef1('0x45')]));channels[_0x126f71[_0xcef1('0x9')]][_0xcef1('0x57')]=_0x126f71[_0xcef1('0x45')];}if(!_[_0xcef1('0x1f')](_0x126f71[_0xcef1('0x47')][_0xcef1('0x58')])){utils[_0xcef1('0x6')](util[_0xcef1('0x7')](_0xcef1('0x59'),_0x126f71['uniqueid'],_0x126f71['value']));channels[_0x126f71['uniqueid']][_0xcef1('0x58')]=_0x126f71[_0xcef1('0x45')];}}}catch(_0x2968ea){utils['error'](util[_0xcef1('0x7')](_0xcef1('0x42'),_0x126f71[_0xcef1('0x9')]),_0x2968ea);}};exports[_0xcef1('0x5a')]=function(_0x3bcbb8){try{if(!_[_0xcef1('0x1f')](channels[_0x3bcbb8[_0xcef1('0x9')]])){utils[_0xcef1('0x1d')](util[_0xcef1('0x7')](_0xcef1('0x5b'),_0x3bcbb8['uniqueid']),_0x3bcbb8);utils[_0xcef1('0x6')](util['format'](_0xcef1('0x5c'),_0x3bcbb8[_0xcef1('0x9')],_0x3bcbb8[_0xcef1('0x5d')],_0x3bcbb8[_0xcef1('0x5e')]));if(_0x3bcbb8[_0xcef1('0x5d')][_0xcef1('0x5f')]()==_0xcef1('0x60')&&_[_0xcef1('0x61')](_0x3bcbb8[_0xcef1('0x5e')][_0xcef1('0x5f')](),'cdr')){var _0x2d9a00=_0x3bcbb8[_0xcef1('0x5e')][_0xcef1('0x62')]('=');var _0xf38819=_0x2d9a00[0x0][_0xcef1('0x63')](_0x2d9a00[0x0][_0xcef1('0x64')]('(')+0x1,_0x2d9a00[0x0][_0xcef1('0x64')](')'));var _0x42b1b3=_0x2d9a00[0x1];channels[_0x3bcbb8[_0xcef1('0x9')]][_0xf38819]=_0x42b1b3;}if(!_[_0xcef1('0x65')]([_0xcef1('0x28'),'noop',_0xcef1('0x66'),_0xcef1('0x60'),_0xcef1('0x67')],_0x3bcbb8[_0xcef1('0x5d')][_0xcef1('0x5f')]())){channels[_0x3bcbb8[_0xcef1('0x9')]][_0xcef1('0x4f')]=_0x3bcbb8[_0xcef1('0x5d')];channels[_0x3bcbb8[_0xcef1('0x9')]][_0xcef1('0x51')]=_0x3bcbb8['appdata'];}}}catch(_0x7b1a63){utils[_0xcef1('0x27')](util[_0xcef1('0x7')]('[%s][calls][newexten]',_0x3bcbb8[_0xcef1('0x9')]),_0x7b1a63);}}; \ No newline at end of file +var _0x387e=['\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','includes','hangup','execif','gotoif','lastapplication','./utils','NO\x20ANSWER','FAILED','BUSY','info','format','uniqueid','channel','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','CreateVoiceCallReport','request','newchannel','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','calleridnum','context','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','_attended','transfertargetchannel','origtransfererchannel','userfield','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone'];(function(_0x2cd689,_0x246e08){var _0x5a62f8=function(_0x6e8532){while(--_0x6e8532){_0x2cd689['push'](_0x2cd689['shift']());}};_0x5a62f8(++_0x246e08);}(_0x387e,0x1b2));var _0xe387=function(_0x8afdd0,_0x548ad1){_0x8afdd0=_0x8afdd0-0x0;var _0x3de7ac=_0x387e[_0x8afdd0];return _0x3de7ac;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xe387('0x0'));var dispositions=[_0xe387('0x1'),_0xe387('0x2'),_0xe387('0x2'),'NO\x20ANSWER',_0xe387('0x1'),_0xe387('0x1'),'ANSWERED',_0xe387('0x3'),'FAILED',_0xe387('0x2'),_0xe387('0x2')];var channels={};function writeDB(_0x31cfe7){utils[_0xe387('0x4')](util[_0xe387('0x5')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x31cfe7[_0xe387('0x6')],_0x31cfe7[_0xe387('0x7')],_0x31cfe7['queue'],_0x31cfe7[_0xe387('0x8')],_0x31cfe7[_0xe387('0x9')],_0x31cfe7['calleridnum'],_0x31cfe7[_0xe387('0xa')],_0x31cfe7[_0xe387('0xb')]));if(_0x31cfe7[_0xe387('0xc')]){utils[_0xe387('0xd')](_0x31cfe7[_0xe387('0xc')])['then'](function(_0x1e0882){if(_0x1e0882){_0x31cfe7[_0xe387('0xe')]=_0x1e0882['id'];}utils['request'](_0xe387('0xf'),_0x31cfe7);});}else{utils[_0xe387('0x10')](_0xe387('0xf'),_0x31cfe7);}if(channels[_0x31cfe7[_0xe387('0x6')]]){delete channels[_0x31cfe7[_0xe387('0x6')]];}}exports[_0xe387('0x11')]=function(_0x43f1d9){try{utils[_0xe387('0x12')](util['format']('[%s][calls][newchannel]',_0x43f1d9['uniqueid']),_0x43f1d9);if(_0x43f1d9[_0xe387('0x6')]==_0x43f1d9[_0xe387('0x13')]&&_0x43f1d9[_0xe387('0x7')]!=_0xe387('0x14')){utils[_0xe387('0x4')](util[_0xe387('0x5')](_0xe387('0x15'),_0x43f1d9[_0xe387('0x6')],_0x43f1d9['context'],_0x43f1d9[_0xe387('0x16')]));channels[_0x43f1d9[_0xe387('0x6')]]={'uniqueid':_0x43f1d9[_0xe387('0x6')],'accountcode':_0x43f1d9[_0xe387('0xc')],'source':_0x43f1d9[_0xe387('0x17')],'destination':_0x43f1d9[_0xe387('0x16')],'destinationcontext':_0x43f1d9[_0xe387('0x18')],'channel':_0x43f1d9[_0xe387('0x7')],'starttime':utils[_0xe387('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xe387('0x1'),'amaflags':_0xe387('0x1a')};}}catch(_0x9fd806){utils[_0xe387('0x1b')](util[_0xe387('0x5')]('[%s][calls][newchannel]',_0x43f1d9['uniqueid']),_0x9fd806);}};exports[_0xe387('0x1c')]=function(_0x3f73a6){try{utils[_0xe387('0x12')](util[_0xe387('0x5')](_0xe387('0x1d'),_0x3f73a6[_0xe387('0x6')]),_0x3f73a6);if(!_[_0xe387('0x1e')](channels[_0x3f73a6[_0xe387('0x6')]])&&_0x3f73a6[_0xe387('0x1f')]==0x6){utils[_0xe387('0x4')](util[_0xe387('0x5')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x3f73a6[_0xe387('0x6')],_0x3f73a6['context'],_0x3f73a6['channel']));if(_['isNil'](channels[_0x3f73a6['uniqueid']][_0xe387('0x20')])){channels[_0x3f73a6['uniqueid']][_0xe387('0x20')]=utils['now']();}}else if(!_[_0xe387('0x1e')](channels[_0x3f73a6[_0xe387('0x13')]])&&_0x3f73a6[_0xe387('0x1f')]==0x6&&_0x3f73a6[_0xe387('0x18')]!=_0xe387('0x21')){utils[_0xe387('0x4')](util[_0xe387('0x5')](_0xe387('0x22'),_0x3f73a6['uniqueid'],_0x3f73a6['linkedid'],_0x3f73a6[_0xe387('0x18')],_0x3f73a6['channel']));channels[_0x3f73a6[_0xe387('0x13')]][_0xe387('0xc')]=_0x3f73a6[_0xe387('0xc')];channels[_0x3f73a6['linkedid']][_0xe387('0x23')]=_0x3f73a6[_0xe387('0x7')];if(_[_0xe387('0x1e')](channels[_0x3f73a6[_0xe387('0x13')]][_0xe387('0x24')])){channels[_0x3f73a6[_0xe387('0x13')]][_0xe387('0x24')]=utils[_0xe387('0x19')]();}channels[_0x3f73a6[_0xe387('0x13')]][_0xe387('0x25')]=dispositions[_[_0xe387('0x26')](_0x3f73a6[_0xe387('0x1f')])]||'ANSWERED';}}catch(_0x18d81d){utils[_0xe387('0x1b')](util[_0xe387('0x5')](_0xe387('0x1d'),_0x3f73a6[_0xe387('0x6')]),_0x18d81d);}};exports['hangup']=function(_0xa23cba){try{if(!_[_0xe387('0x1e')](channels[_0xa23cba['uniqueid']])){utils[_0xe387('0x12')](util[_0xe387('0x5')](_0xe387('0x27'),_0xa23cba['uniqueid']),_0xa23cba);if(_[_0xe387('0x1e')](channels[_0xa23cba[_0xe387('0x6')]][_0xe387('0x28')])){channels[_0xa23cba[_0xe387('0x6')]]['callerid']=_0xa23cba[_0xe387('0x29')]+'\x20<'+_0xa23cba[_0xe387('0x17')]+'>';}utils['info'](util[_0xe387('0x5')](_0xe387('0x2a'),_0xa23cba['uniqueid'],channels[_0xa23cba[_0xe387('0x6')]][_0xe387('0x28')],_0xa23cba[_0xe387('0x2b')]));channels[_0xa23cba['uniqueid']][_0xe387('0x2c')]=utils[_0xe387('0x19')]();channels[_0xa23cba[_0xe387('0x6')]]['duration']=utils[_0xe387('0x2d')](channels[_0xa23cba[_0xe387('0x6')]][_0xe387('0x2c')],channels[_0xa23cba[_0xe387('0x6')]][_0xe387('0x2e')]);channels[_0xa23cba['uniqueid']]['billableseconds']=channels[_0xa23cba['uniqueid']][_0xe387('0x24')]?utils[_0xe387('0x2d')](channels[_0xa23cba[_0xe387('0x6')]][_0xe387('0x2c')],channels[_0xa23cba[_0xe387('0x6')]]['answertime']):0x0;writeDB(channels[_0xa23cba[_0xe387('0x6')]]);}}catch(_0x2378ff){utils[_0xe387('0x1b')](util[_0xe387('0x5')]('[%s][calls][hangup]',_0xa23cba[_0xe387('0x6')]),_0x2378ff);}};exports['attendedtransfer']=function(_0x1c1827){try{if(!_[_0xe387('0x1e')](channels[_0x1c1827[_0xe387('0x2f')]])){utils['debug'](util[_0xe387('0x5')]('[%s][calls][attendedtransfer]',_0x1c1827['origtransfereruniqueid']),_0x1c1827);if(channels[_0x1c1827[_0xe387('0x2f')]][_0xe387('0x7')]==_0x1c1827[_0xe387('0x30')]){utils['info'](util['format'](_0xe387('0x31'),_0x1c1827[_0xe387('0x32')],_0x1c1827[_0xe387('0x2f')],_0x1c1827['secondtransfererchannel']));channels[_0x1c1827[_0xe387('0x2f')]][_0xe387('0x23')]=_0x1c1827['secondtransfererchannel'];channels[_0x1c1827[_0xe387('0x2f')]]['userfield']=_0xe387('0x33');}else if(channels[_0x1c1827[_0xe387('0x2f')]][_0xe387('0x7')]=_0x1c1827[_0xe387('0x34')]){utils['info'](util[_0xe387('0x5')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x1c1827[_0xe387('0x32')],_0x1c1827[_0xe387('0x2f')],_0x1c1827[_0xe387('0x35')]));channels[_0x1c1827[_0xe387('0x2f')]][_0xe387('0x23')]=_0x1c1827[_0xe387('0x35')];channels[_0x1c1827[_0xe387('0x2f')]][_0xe387('0x36')]=_0xe387('0x33');}}}catch(_0x32f506){utils[_0xe387('0x1b')](util[_0xe387('0x5')](_0xe387('0x37'),_0x1c1827[_0xe387('0x32')]),_0x32f506);}};exports[_0xe387('0x38')]=function(_0x30db11){try{if(!_['isNil'](channels[_0x30db11[_0xe387('0x6')]])){utils[_0xe387('0x12')](util[_0xe387('0x5')](_0xe387('0x39'),_0x30db11['uniqueid']),_0x30db11);channels[_0x30db11[_0xe387('0x6')]][_0xe387('0x3a')]=utils[_0xe387('0x19')]();utils['info'](util[_0xe387('0x5')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x30db11[_0xe387('0x6')],channels[_0x30db11[_0xe387('0x6')]]['musiconholdstartAt']));}}catch(_0x1af1eb){utils['error'](util['format'](_0xe387('0x39'),_0x30db11[_0xe387('0x6')]),_0x1af1eb);}};exports[_0xe387('0x3b')]=function(_0x43d437){try{if(!_[_0xe387('0x1e')](channels[_0x43d437[_0xe387('0x6')]])){utils[_0xe387('0x12')](util[_0xe387('0x5')](_0xe387('0x3c'),_0x43d437[_0xe387('0x6')]),_0x43d437);if(!_[_0xe387('0x1e')](channels[_0x43d437['uniqueid']][_0xe387('0x3a')])){channels[_0x43d437[_0xe387('0x6')]][_0xe387('0x3d')]+=utils[_0xe387('0x2d')](utils[_0xe387('0x19')](),channels[_0x43d437['uniqueid']][_0xe387('0x3a')]);utils[_0xe387('0x4')](util[_0xe387('0x5')](_0xe387('0x3e'),_0x43d437[_0xe387('0x6')],channels[_0x43d437[_0xe387('0x6')]][_0xe387('0x3d')]));delete channels[_0x43d437[_0xe387('0x6')]][_0xe387('0x3a')];}}}catch(_0x52e276){utils[_0xe387('0x1b')](util[_0xe387('0x5')](_0xe387('0x3c'),_0x43d437['uniqueid']),_0x52e276);}};exports[_0xe387('0x3f')]=function(_0x2ae807){try{if(!_[_0xe387('0x1e')](channels[_0x2ae807[_0xe387('0x6')]])){utils[_0xe387('0x12')](util[_0xe387('0x5')](_0xe387('0x40'),_0x2ae807[_0xe387('0x6')]),_0x2ae807);if(!_['isNil'](_0x2ae807[_0xe387('0x41')][_0xe387('0x42')])){utils['info'](util[_0xe387('0x5')](_0xe387('0x43'),_0x2ae807[_0xe387('0x6')],_0x2ae807[_0xe387('0x44')]));channels[_0x2ae807[_0xe387('0x6')]][_0xe387('0x45')]=_0x2ae807[_0xe387('0x44')];}if(!_[_0xe387('0x1e')](_0x2ae807[_0xe387('0x41')][_0xe387('0x46')])){utils[_0xe387('0x4')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x2ae807['uniqueid'],_0x2ae807[_0xe387('0x44')]));channels[_0x2ae807[_0xe387('0x6')]]['destination']=_0x2ae807['value'];channels[_0x2ae807[_0xe387('0x6')]][_0xe387('0x28')]='\x22'+_0x2ae807[_0xe387('0x44')]+_0xe387('0x47')+_0x2ae807[_0xe387('0x44')]+'>';}if(!_[_0xe387('0x1e')](_0x2ae807[_0xe387('0x41')][_0xe387('0x48')])||!_['isNil'](_0x2ae807['variable'][_0xe387('0x49')])){utils[_0xe387('0x4')](util['format'](_0xe387('0x4a'),_0x2ae807[_0xe387('0x6')],!_[_0xe387('0x1e')](_0x2ae807[_0xe387('0x41')]['xmd-callerid-preview'])?'xmd-callerid-preview':_0xe387('0x49'),_0x2ae807[_0xe387('0x44')]));channels[_0x2ae807[_0xe387('0x6')]][_0xe387('0x28')]=_0x2ae807['value'];}if(!_[_0xe387('0x1e')](_0x2ae807['variable'][_0xe387('0x4b')])||!_[_0xe387('0x1e')](_0x2ae807[_0xe387('0x41')][_0xe387('0x4c')])){utils[_0xe387('0x4')](util[_0xe387('0x5')](_0xe387('0x4a'),_0x2ae807[_0xe387('0x6')],!_[_0xe387('0x1e')](_0x2ae807[_0xe387('0x41')]['xmd-queue'])?_0xe387('0x4b'):'xmcs-queue',_0x2ae807[_0xe387('0x44')]));channels[_0x2ae807['uniqueid']]['lastapplication']=_0xe387('0x4d');channels[_0x2ae807[_0xe387('0x6')]]['lastdata']=_0x2ae807[_0xe387('0x44')];channels[_0x2ae807[_0xe387('0x6')]][_0xe387('0x4e')]=!![];}if(!_[_0xe387('0x1e')](_0x2ae807[_0xe387('0x41')][_0xe387('0x4f')])){utils[_0xe387('0x4')](util[_0xe387('0x5')](_0xe387('0x50'),_0x2ae807[_0xe387('0x6')],_0x2ae807[_0xe387('0x44')]));channels[_0x2ae807[_0xe387('0x6')]][_0xe387('0x51')]=_0x2ae807['value'];}if(!_[_0xe387('0x1e')](_0x2ae807[_0xe387('0x41')][_0xe387('0x52')])){utils[_0xe387('0x4')](util[_0xe387('0x5')](_0xe387('0x53'),_0x2ae807[_0xe387('0x6')],_0x2ae807[_0xe387('0x44')]));channels[_0x2ae807[_0xe387('0x6')]]['type']=_0x2ae807[_0xe387('0x44')];}if(!_[_0xe387('0x1e')](_0x2ae807[_0xe387('0x41')]['outboundrouteid'])){utils[_0xe387('0x4')](util[_0xe387('0x5')](_0xe387('0x54'),_0x2ae807[_0xe387('0x6')],_0x2ae807[_0xe387('0x44')]));channels[_0x2ae807['uniqueid']]['routeid']=_0x2ae807[_0xe387('0x44')];}if(!_[_0xe387('0x1e')](_0x2ae807[_0xe387('0x41')]['sipcallid'])){utils[_0xe387('0x4')](util[_0xe387('0x5')](_0xe387('0x55'),_0x2ae807['uniqueid'],_0x2ae807[_0xe387('0x44')]));channels[_0x2ae807[_0xe387('0x6')]]['sipcallid']=_0x2ae807[_0xe387('0x44')];}}}catch(_0x5930ef){utils['error'](util[_0xe387('0x5')](_0xe387('0x40'),_0x2ae807[_0xe387('0x6')]),_0x5930ef);}};exports['newexten']=function(_0x1ab141){try{if(!_[_0xe387('0x1e')](channels[_0x1ab141[_0xe387('0x6')]])){utils[_0xe387('0x12')](util[_0xe387('0x5')](_0xe387('0x56'),_0x1ab141[_0xe387('0x6')]),_0x1ab141);utils[_0xe387('0x4')](util['format'](_0xe387('0x57'),_0x1ab141[_0xe387('0x6')],_0x1ab141[_0xe387('0x58')],_0x1ab141[_0xe387('0x59')]));if(_0x1ab141['application'][_0xe387('0x5a')]()==_0xe387('0x5b')&&_[_0xe387('0x5c')](_0x1ab141[_0xe387('0x59')][_0xe387('0x5a')](),'cdr')){var _0x111ccf=_0x1ab141[_0xe387('0x59')][_0xe387('0x5d')]('=');var _0x441488=_0x111ccf[0x0][_0xe387('0x5e')](_0x111ccf[0x0]['lastIndexOf']('(')+0x1,_0x111ccf[0x0][_0xe387('0x5f')](')'));var _0x3a64f9=_0x111ccf[0x1];channels[_0x1ab141[_0xe387('0x6')]][_0x441488]=_0x3a64f9;}if(!_[_0xe387('0x60')]([_0xe387('0x61'),'noop',_0xe387('0x62'),_0xe387('0x5b'),_0xe387('0x63')],_0x1ab141[_0xe387('0x58')][_0xe387('0x5a')]())){channels[_0x1ab141['uniqueid']][_0xe387('0x64')]=_0x1ab141['application'];channels[_0x1ab141[_0xe387('0x6')]]['lastdata']=_0x1ab141['appdata'];}}}catch(_0x2199cb){utils[_0xe387('0x1b')](util['format']('[%s][calls][newexten]',_0x1ab141[_0xe387('0x6')]),_0x2199cb);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index b0b965e..3d77e47 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 _0xff75=['./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent'];(function(_0x3838a4,_0x2ae1e6){var _0x3c56b4=function(_0x4cbf64){while(--_0x4cbf64){_0x3838a4['push'](_0x3838a4['shift']());}};_0x3c56b4(++_0x2ae1e6);}(_0xff75,0x1ad));var _0x5ff7=function(_0x32e52f,_0x2b97b7){_0x32e52f=_0x32e52f-0x0;var _0x50f5ad=_0xff75[_0x32e52f];return _0x50f5ad;};'use strict';var utils=require(_0x5ff7('0x0'));exports['connect']=function(){utils[_0x5ff7('0x1')](_0x5ff7('0x2'));};exports[_0x5ff7('0x3')]=function(){utils['info'](_0x5ff7('0x4'));};exports[_0x5ff7('0x5')]=function(){utils[_0x5ff7('0x1')]('[core]\x20fullybooted');};exports['error']=function(_0x3973f0){utils[_0x5ff7('0x6')](_0x5ff7('0x7'),_0x3973f0);};exports[_0x5ff7('0x8')]=function(){utils[_0x5ff7('0x1')](_0x5ff7('0x9'));};exports[_0x5ff7('0xa')]=function(_0x368d5f){}; \ No newline at end of file +var _0x6140=['error','close','[core]\x20close','managerevent','./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x6140,0x19b));var _0x0614=function(_0xb9c2da,_0x5e481a){_0xb9c2da=_0xb9c2da-0x0;var _0x195d1d=_0x6140[_0xb9c2da];return _0x195d1d;};'use strict';var utils=require(_0x0614('0x0'));exports['connect']=function(){utils[_0x0614('0x1')](_0x0614('0x2'));};exports[_0x0614('0x3')]=function(){utils[_0x0614('0x1')](_0x0614('0x4'));};exports[_0x0614('0x5')]=function(){utils[_0x0614('0x1')](_0x0614('0x6'));};exports[_0x0614('0x7')]=function(_0x4aa5c5){utils[_0x0614('0x7')]('[core]\x20error',_0x4aa5c5);};exports[_0x0614('0x8')]=function(){utils['info'](_0x0614('0x9'));};exports[_0x0614('0xa')]=function(_0x3add2d){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 380c216..e74d42d 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 _0x84a7=['now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','ANSWER','answertime','connect','hangup','[%s][dials][hangup]','calleridname','cause-txt','duration','diffTime','endtime','holdtime','lodash','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','format','[%s][dials][newexten]','application','startsWith','appdata','toLowerCase','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime'];(function(_0x4ec2ab,_0x484323){var _0x1de78c=function(_0x1714a7){while(--_0x1714a7){_0x4ec2ab['push'](_0x4ec2ab['shift']());}};_0x1de78c(++_0x484323);}(_0x84a7,0x70));var _0x784a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x84a7[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x784a('0x0'));var util=require('util');var utils=require(_0x784a('0x1'));var dials={};function writeDB(_0x22459b){utils[_0x784a('0x2')](util['format'](_0x784a('0x3'),_0x22459b['uniqueid'],_0x22459b[_0x784a('0x4')],_0x22459b['dialstring'],_0x22459b[_0x784a('0x5')],_0x22459b[_0x784a('0x6')],_0x22459b[_0x784a('0x7')]));utils[_0x784a('0x8')](_0x784a('0x9'),_0x22459b);delete dials[_0x22459b[_0x784a('0xa')]];}exports[_0x784a('0xb')]=function(_0xab9421){try{utils[_0x784a('0xc')](util[_0x784a('0xd')](_0x784a('0xe'),_0xab9421[_0x784a('0xa')]),_0xab9421);utils['info'](util[_0x784a('0xd')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0xab9421['uniqueid'],_0xab9421['application'],_0xab9421['appdata']));if(_0xab9421[_0x784a('0xf')]['toLowerCase']()=='set'&&_[_0x784a('0x10')](_0xab9421[_0x784a('0x11')][_0x784a('0x12')](),'cdr(routeid)')){var _0x524f1b=_0xab9421[_0x784a('0x11')][_0x784a('0x13')]('=');dials[_0xab9421[_0x784a('0xa')]]={'routeId':_0x524f1b[0x1]};}}catch(_0xf2c6b5){utils[_0x784a('0x14')](util[_0x784a('0xd')](_0x784a('0xe'),_0xab9421[_0x784a('0xa')]),_0xf2c6b5);}};exports[_0x784a('0x15')]=function(_0x2b469a){try{utils[_0x784a('0xc')](util[_0x784a('0xd')](_0x784a('0x16'),_0x2b469a['uniqueid']),_0x2b469a);if(!_[_0x784a('0x17')](_0x2b469a[_0x784a('0x18')][_0x784a('0x19')])){utils[_0x784a('0x2')](util['format'](_0x784a('0x1a'),_0x2b469a[_0x784a('0xa')],_0x2b469a[_0x784a('0x1b')]));dials[_0x2b469a[_0x784a('0xa')]]={'routeId':_0x2b469a['value']};}}catch(_0x3234d5){utils[_0x784a('0x14')](util[_0x784a('0xd')](_0x784a('0x16'),_0x2b469a[_0x784a('0xa')]),_0x3234d5);}};exports[_0x784a('0x1c')]=function(_0x5469b8){try{if(!_[_0x784a('0x17')](dials[_0x5469b8[_0x784a('0xa')]])){utils[_0x784a('0xc')](util[_0x784a('0xd')](_0x784a('0x1d'),_0x5469b8[_0x784a('0xa')]),_0x5469b8);dials[_0x5469b8[_0x784a('0xa')]]=_[_0x784a('0x1e')](dials[_0x5469b8[_0x784a('0xa')]],_0x5469b8);dials[_0x5469b8['uniqueid']][_0x784a('0x1f')]=utils[_0x784a('0x20')]();dials[_0x5469b8['uniqueid']][_0x784a('0x21')]=_0x784a('0x22');utils[_0x784a('0x2')](util['format'](_0x784a('0x23'),_0x5469b8['uniqueid'],dials[_0x5469b8[_0x784a('0xa')]][_0x784a('0x1f')]));}}catch(_0x280aa4){utils[_0x784a('0x14')](util['format'](_0x784a('0x1d'),_0x5469b8[_0x784a('0xa')]),_0x280aa4);}};exports[_0x784a('0x24')]=function(_0x523402){try{if(!_[_0x784a('0x17')](dials[_0x523402[_0x784a('0xa')]])){utils['debug'](util['format']('[%s][dials][dialend]',_0x523402[_0x784a('0xa')]),_0x523402);dials[_0x523402['uniqueid']][_0x784a('0x7')]=_0x523402['dialstatus'];if(_0x523402[_0x784a('0x7')]==_0x784a('0x25')){dials[_0x523402['uniqueid']]=_['assign'](dials[_0x523402[_0x784a('0xa')]],_0x523402);dials[_0x523402[_0x784a('0xa')]][_0x784a('0x26')]=utils[_0x784a('0x20')]();dials[_0x523402[_0x784a('0xa')]][_0x784a('0x21')]=_0x784a('0x27');utils['info'](util[_0x784a('0xd')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x523402[_0x784a('0xa')],_0x523402['dialstatus'],dials[_0x523402['uniqueid']][_0x784a('0x26')]));}else{utils[_0x784a('0x2')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x523402[_0x784a('0xa')],_0x523402['dialstatus']));}}}catch(_0x3b607d){utils['error'](util[_0x784a('0xd')]('[%s][dials][dialend]',_0x523402[_0x784a('0xa')]),_0x3b607d);}};exports[_0x784a('0x28')]=function(_0x29530c){try{if(!_['isNil'](dials[_0x29530c[_0x784a('0xa')]])){utils[_0x784a('0xc')](util[_0x784a('0xd')](_0x784a('0x29'),_0x29530c[_0x784a('0xa')]),_0x29530c);utils[_0x784a('0x2')](util[_0x784a('0xd')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x29530c['uniqueid'],_0x29530c[_0x784a('0x5')],_0x29530c[_0x784a('0x2a')],_0x29530c[_0x784a('0x2b')]));dials[_0x29530c[_0x784a('0xa')]]=_['assign'](dials[_0x29530c[_0x784a('0xa')]],{'endtime':utils[_0x784a('0x20')](),'lastevent':'complete'});dials[_0x29530c[_0x784a('0xa')]][_0x784a('0x2c')]=utils[_0x784a('0x2d')](dials[_0x29530c['uniqueid']][_0x784a('0x2e')],dials[_0x29530c['uniqueid']][_0x784a('0x1f')]);dials[_0x29530c[_0x784a('0xa')]][_0x784a('0x2f')]=utils[_0x784a('0x2d')](dials[_0x29530c[_0x784a('0xa')]][_0x784a('0x26')]||dials[_0x29530c[_0x784a('0xa')]]['endtime'],dials[_0x29530c[_0x784a('0xa')]][_0x784a('0x1f')]);dials[_0x29530c[_0x784a('0xa')]]['billableseconds']=dials[_0x29530c[_0x784a('0xa')]]['answertime']?utils[_0x784a('0x2d')](dials[_0x29530c['uniqueid']]['endtime'],dials[_0x29530c['uniqueid']][_0x784a('0x26')]):0x0;writeDB(dials[_0x29530c['uniqueid']]);}}catch(_0x5ab4a4){utils[_0x784a('0x14')](util[_0x784a('0xd')](_0x784a('0x29'),_0x29530c[_0x784a('0xa')]),_0x5ab4a4);}}; \ No newline at end of file +var _0x8f1f=['connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','duration','diffTime','endtime','holdtime','billableseconds','[%s][dials][hangup]','lodash','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0x8f1f,0x16c));var _0xf8f1=function(_0x146f3a,_0x373e03){_0x146f3a=_0x146f3a-0x0;var _0x4ebd8a=_0x8f1f[_0x146f3a];return _0x4ebd8a;};'use strict';var _=require(_0xf8f1('0x0'));var util=require('util');var utils=require(_0xf8f1('0x1'));var dials={};function writeDB(_0x438c2e){utils[_0xf8f1('0x2')](util['format'](_0xf8f1('0x3'),_0x438c2e[_0xf8f1('0x4')],_0x438c2e[_0xf8f1('0x5')],_0x438c2e[_0xf8f1('0x6')],_0x438c2e['calleridnum'],_0x438c2e[_0xf8f1('0x7')],_0x438c2e[_0xf8f1('0x8')]));utils['request'](_0xf8f1('0x9'),_0x438c2e);delete dials[_0x438c2e[_0xf8f1('0x4')]];}exports[_0xf8f1('0xa')]=function(_0x4610f0){try{utils[_0xf8f1('0xb')](util['format'](_0xf8f1('0xc'),_0x4610f0[_0xf8f1('0x4')]),_0x4610f0);utils[_0xf8f1('0x2')](util[_0xf8f1('0xd')](_0xf8f1('0xe'),_0x4610f0[_0xf8f1('0x4')],_0x4610f0[_0xf8f1('0xf')],_0x4610f0[_0xf8f1('0x10')]));if(_0x4610f0[_0xf8f1('0xf')][_0xf8f1('0x11')]()=='set'&&_[_0xf8f1('0x12')](_0x4610f0[_0xf8f1('0x10')][_0xf8f1('0x11')](),_0xf8f1('0x13'))){var _0x26cf4f=_0x4610f0['appdata'][_0xf8f1('0x14')]('=');dials[_0x4610f0[_0xf8f1('0x4')]]={'routeId':_0x26cf4f[0x1]};}}catch(_0x4b3333){utils[_0xf8f1('0x15')](util['format'](_0xf8f1('0xc'),_0x4610f0[_0xf8f1('0x4')]),_0x4b3333);}};exports[_0xf8f1('0x16')]=function(_0x1140be){try{utils[_0xf8f1('0xb')](util[_0xf8f1('0xd')](_0xf8f1('0x17'),_0x1140be[_0xf8f1('0x4')]),_0x1140be);if(!_[_0xf8f1('0x18')](_0x1140be[_0xf8f1('0x19')][_0xf8f1('0x1a')])){utils[_0xf8f1('0x2')](util[_0xf8f1('0xd')](_0xf8f1('0x1b'),_0x1140be[_0xf8f1('0x4')],_0x1140be['value']));dials[_0x1140be[_0xf8f1('0x4')]]={'routeId':_0x1140be['value']};}}catch(_0x2d43ed){utils[_0xf8f1('0x15')](util['format'](_0xf8f1('0x17'),_0x1140be[_0xf8f1('0x4')]),_0x2d43ed);}};exports[_0xf8f1('0x1c')]=function(_0x72bd0a){try{if(!_[_0xf8f1('0x18')](dials[_0x72bd0a[_0xf8f1('0x4')]])){utils[_0xf8f1('0xb')](util[_0xf8f1('0xd')](_0xf8f1('0x1d'),_0x72bd0a['uniqueid']),_0x72bd0a);dials[_0x72bd0a[_0xf8f1('0x4')]]=_[_0xf8f1('0x1e')](dials[_0x72bd0a[_0xf8f1('0x4')]],_0x72bd0a);dials[_0x72bd0a[_0xf8f1('0x4')]][_0xf8f1('0x1f')]=utils[_0xf8f1('0x20')]();dials[_0x72bd0a[_0xf8f1('0x4')]][_0xf8f1('0x21')]=_0xf8f1('0x22');utils[_0xf8f1('0x2')](util[_0xf8f1('0xd')](_0xf8f1('0x23'),_0x72bd0a[_0xf8f1('0x4')],dials[_0x72bd0a[_0xf8f1('0x4')]][_0xf8f1('0x1f')]));}}catch(_0x3b2ba9){utils[_0xf8f1('0x15')](util['format']('[%s][dials][dialbegin]',_0x72bd0a[_0xf8f1('0x4')]),_0x3b2ba9);}};exports[_0xf8f1('0x24')]=function(_0xdc7523){try{if(!_[_0xf8f1('0x18')](dials[_0xdc7523['uniqueid']])){utils['debug'](util[_0xf8f1('0xd')](_0xf8f1('0x25'),_0xdc7523['uniqueid']),_0xdc7523);dials[_0xdc7523['uniqueid']][_0xf8f1('0x8')]=_0xdc7523[_0xf8f1('0x8')];if(_0xdc7523[_0xf8f1('0x8')]=='ANSWER'){dials[_0xdc7523[_0xf8f1('0x4')]]=_[_0xf8f1('0x1e')](dials[_0xdc7523['uniqueid']],_0xdc7523);dials[_0xdc7523[_0xf8f1('0x4')]][_0xf8f1('0x26')]=utils[_0xf8f1('0x20')]();dials[_0xdc7523['uniqueid']]['lastevent']=_0xf8f1('0x27');utils['info'](util[_0xf8f1('0xd')](_0xf8f1('0x28'),_0xdc7523[_0xf8f1('0x4')],_0xdc7523['dialstatus'],dials[_0xdc7523[_0xf8f1('0x4')]][_0xf8f1('0x26')]));}else{utils[_0xf8f1('0x2')](util[_0xf8f1('0xd')](_0xf8f1('0x29'),_0xdc7523[_0xf8f1('0x4')],_0xdc7523[_0xf8f1('0x8')]));}}}catch(_0x5354a7){utils[_0xf8f1('0x15')](util[_0xf8f1('0xd')](_0xf8f1('0x25'),_0xdc7523[_0xf8f1('0x4')]),_0x5354a7);}};exports[_0xf8f1('0x2a')]=function(_0x402fa6){try{if(!_[_0xf8f1('0x18')](dials[_0x402fa6[_0xf8f1('0x4')]])){utils['debug'](util['format']('[%s][dials][hangup]',_0x402fa6['uniqueid']),_0x402fa6);utils['info'](util[_0xf8f1('0xd')](_0xf8f1('0x2b'),_0x402fa6[_0xf8f1('0x4')],_0x402fa6[_0xf8f1('0x2c')],_0x402fa6[_0xf8f1('0x2d')],_0x402fa6[_0xf8f1('0x2e')]));dials[_0x402fa6['uniqueid']]=_[_0xf8f1('0x1e')](dials[_0x402fa6[_0xf8f1('0x4')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x402fa6[_0xf8f1('0x4')]][_0xf8f1('0x2f')]=utils[_0xf8f1('0x30')](dials[_0x402fa6[_0xf8f1('0x4')]][_0xf8f1('0x31')],dials[_0x402fa6[_0xf8f1('0x4')]]['starttime']);dials[_0x402fa6['uniqueid']][_0xf8f1('0x32')]=utils[_0xf8f1('0x30')](dials[_0x402fa6['uniqueid']][_0xf8f1('0x26')]||dials[_0x402fa6[_0xf8f1('0x4')]][_0xf8f1('0x31')],dials[_0x402fa6[_0xf8f1('0x4')]][_0xf8f1('0x1f')]);dials[_0x402fa6[_0xf8f1('0x4')]][_0xf8f1('0x33')]=dials[_0x402fa6[_0xf8f1('0x4')]][_0xf8f1('0x26')]?utils['diffTime'](dials[_0x402fa6[_0xf8f1('0x4')]]['endtime'],dials[_0x402fa6[_0xf8f1('0x4')]][_0xf8f1('0x26')]):0x0;writeDB(dials[_0x402fa6[_0xf8f1('0x4')]]);}}catch(_0x2b4b4f){utils[_0xf8f1('0x15')](util[_0xf8f1('0xd')](_0xf8f1('0x34'),_0x402fa6[_0xf8f1('0x4')]),_0x2b4b4f);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 057dac1..105af3e 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 _0x7b9e=['[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','local','asterisk','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./members.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]'];(function(_0x19026a,_0x4a5c82){var _0x2aa96c=function(_0xebf391){while(--_0xebf391){_0x19026a['push'](_0x19026a['shift']());}};_0x2aa96c(++_0x4a5c82);}(_0x7b9e,0x1a8));var _0xe7b9=function(_0x5117f9,_0x4dc954){_0x5117f9=_0x5117f9-0x0;var _0x408a8d=_0x7b9e[_0x5117f9];return _0x408a8d;};var AsteriskManager=require(_0xe7b9('0x0'));var config=require(_0xe7b9('0x1'));var utils=require(_0xe7b9('0x2'));var util=require(_0xe7b9('0x3'));var isXDREnabled=config[_0xe7b9('0x4')]&&config[_0xe7b9('0x4')][_0xe7b9('0x5')]?!config[_0xe7b9('0x4')][_0xe7b9('0x5')]:!![];var isProduction=config[_0xe7b9('0x6')]==='production'||![];var isLocalAsterisk=config[_0xe7b9('0x4')]&&config[_0xe7b9('0x4')][_0xe7b9('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xe7b9('0x8')]['port'],config['asterisk']['ip'],config[_0xe7b9('0x8')][_0xe7b9('0x9')],config['asterisk'][_0xe7b9('0xa')],!![]);ami[_0xe7b9('0xb')]();if(!isXDREnabled){utils[_0xe7b9('0xc')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0xe7b9('0xc')](_0xe7b9('0xd'));}else{var agents=require('./agents.controller');var calls=require(_0xe7b9('0xe'));var queues=require(_0xe7b9('0xf'));var recordings=require('./recordings.controller');var members=require(_0xe7b9('0x10'));var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on'](_0xe7b9('0x11'),core['connect']);ami['on'](_0xe7b9('0x12'),core[_0xe7b9('0x12')]);ami['on']('fullybooted',core[_0xe7b9('0x13')]);ami['on'](_0xe7b9('0x14'),core[_0xe7b9('0x14')]);ami['on'](_0xe7b9('0x15'),core['close']);ami['on']('managerevent',core[_0xe7b9('0x16')]);ami['on'](_0xe7b9('0x17'),function(_0x21dff0){try{utils[_0xe7b9('0x18')](util['format']('[%s][index][devicestatechange]',_0x21dff0['device']),_0x21dff0);members['devicestatechange'](_0x21dff0);}catch(_0x32ca7e){utils[_0xe7b9('0x14')](util[_0xe7b9('0x19')](_0xe7b9('0x1a'),_0x21dff0['device']),_0x32ca7e);}});ami['on']('agentcalled',function(_0x883305){try{utils[_0xe7b9('0x18')](util['format'](_0xe7b9('0x1b'),_0x883305[_0xe7b9('0x1c')]),_0x883305);agents[_0xe7b9('0x1d')](_0x883305);}catch(_0x1c8610){utils[_0xe7b9('0x14')](util[_0xe7b9('0x19')](_0xe7b9('0x1b'),_0x883305['uniqueid']),_0x1c8610);}});ami['on'](_0xe7b9('0x1e'),function(_0x561403){try{utils[_0xe7b9('0x18')](util['format'](_0xe7b9('0x1f'),_0x561403[_0xe7b9('0x1c')]),_0x561403);agents[_0xe7b9('0x1e')](_0x561403);}catch(_0x375257){utils[_0xe7b9('0x14')](util['format'](_0xe7b9('0x1f'),_0x561403[_0xe7b9('0x1c')]),_0x375257);}});ami['on'](_0xe7b9('0x20'),function(_0xb1fbaa){try{utils[_0xe7b9('0x18')](util[_0xe7b9('0x19')](_0xe7b9('0x21'),_0xb1fbaa[_0xe7b9('0x1c')]),_0xb1fbaa);agents['agentconnect'](_0xb1fbaa);queues['agentconnect'](_0xb1fbaa);}catch(_0x183ebc){utils[_0xe7b9('0x14')](util[_0xe7b9('0x19')](_0xe7b9('0x21'),_0xb1fbaa[_0xe7b9('0x1c')]),_0x183ebc);}});ami['on'](_0xe7b9('0x22'),function(_0xb9119d){try{utils[_0xe7b9('0x18')](util[_0xe7b9('0x19')](_0xe7b9('0x23'),_0xb9119d['uniqueid']),_0xb9119d);agents[_0xe7b9('0x22')](_0xb9119d);queues[_0xe7b9('0x22')](_0xb9119d);members[_0xe7b9('0x22')](_0xb9119d);}catch(_0x79f100){utils[_0xe7b9('0x14')](util[_0xe7b9('0x19')](_0xe7b9('0x23'),_0xb9119d[_0xe7b9('0x1c')]),_0x79f100);}});ami['on'](_0xe7b9('0x24'),function(_0x3dc07a){try{utils[_0xe7b9('0x18')](util[_0xe7b9('0x19')](_0xe7b9('0x25'),_0x3dc07a['uniqueid']),_0x3dc07a);agents[_0xe7b9('0x24')](_0x3dc07a);queues['queuecallerabandon'](_0x3dc07a);}catch(_0xb3b167){utils[_0xe7b9('0x14')](util[_0xe7b9('0x19')](_0xe7b9('0x25'),_0x3dc07a[_0xe7b9('0x1c')]),_0xb3b167);}});ami['on'](_0xe7b9('0x26'),function(_0x1d83b2){try{utils[_0xe7b9('0x18')](util[_0xe7b9('0x19')](_0xe7b9('0x27'),_0x1d83b2[_0xe7b9('0x1c')]),_0x1d83b2);queues['queuecallerjoin'](_0x1d83b2);recordings[_0xe7b9('0x26')](_0x1d83b2);}catch(_0x3fed3d){utils[_0xe7b9('0x14')](util[_0xe7b9('0x19')](_0xe7b9('0x27'),_0x1d83b2[_0xe7b9('0x1c')]),_0x3fed3d);}});ami['on']('queuecallerleave',function(_0x153a5d){try{utils[_0xe7b9('0x18')](util['format']('[%s][index][queuecallerleave]',_0x153a5d[_0xe7b9('0x1c')]),_0x153a5d);queues[_0xe7b9('0x28')](_0x153a5d);}catch(_0x1ca150){utils['error'](util[_0xe7b9('0x19')]('[%s][index][queuecallerleave]',_0x153a5d['uniqueid']),_0x1ca150);}});ami['on'](_0xe7b9('0x29'),function(_0xd5f0f0){try{utils['debug'](util['format'](_0xe7b9('0x2a'),_0xd5f0f0[_0xe7b9('0x1c')]),_0xd5f0f0);queues[_0xe7b9('0x29')](_0xd5f0f0);calls[_0xe7b9('0x29')](_0xd5f0f0);}catch(_0x1d27c1){utils[_0xe7b9('0x14')](util['format'](_0xe7b9('0x2a'),_0xd5f0f0[_0xe7b9('0x1c')]),_0x1d27c1);}});ami['on'](_0xe7b9('0x2b'),function(_0x3e249b){try{utils[_0xe7b9('0x18')](util[_0xe7b9('0x19')](_0xe7b9('0x2c'),_0x3e249b[_0xe7b9('0x1c')]),_0x3e249b);queues[_0xe7b9('0x2b')](_0x3e249b);calls[_0xe7b9('0x2b')](_0x3e249b);}catch(_0x475665){utils[_0xe7b9('0x14')](util[_0xe7b9('0x19')]('[%s][index][musiconholdstop]',_0x3e249b[_0xe7b9('0x1c')]),_0x475665);}});ami['on']('newstate',function(_0x13d29d){try{utils[_0xe7b9('0x18')](util[_0xe7b9('0x19')](_0xe7b9('0x2d'),_0x13d29d[_0xe7b9('0x1c')]),_0x13d29d);calls[_0xe7b9('0x2e')](_0x13d29d);recordings[_0xe7b9('0x2e')](_0x13d29d);}catch(_0x109ae2){utils[_0xe7b9('0x14')](util[_0xe7b9('0x19')](_0xe7b9('0x2d'),_0x13d29d['uniqueid']),_0x109ae2);}});ami['on'](_0xe7b9('0x2f'),function(_0x30911f){try{utils['debug'](util['format']('[%s][index][hangup]',_0x30911f[_0xe7b9('0x1c')]),_0x30911f);calls[_0xe7b9('0x2f')](_0x30911f);recordings[_0xe7b9('0x2f')](_0x30911f);dials[_0xe7b9('0x2f')](_0x30911f);agents[_0xe7b9('0x2f')](_0x30911f);queues[_0xe7b9('0x2f')](_0x30911f);}catch(_0x9e4f6c){utils['error'](util[_0xe7b9('0x19')](_0xe7b9('0x30'),_0x30911f['uniqueid']),_0x9e4f6c);}});ami['on'](_0xe7b9('0x31'),function(_0x4a9c3a){try{utils[_0xe7b9('0x18')](util[_0xe7b9('0x19')](_0xe7b9('0x32'),_0x4a9c3a[_0xe7b9('0x1c')]),_0x4a9c3a);members['cdr'](_0x4a9c3a);}catch(_0x112fdb){utils[_0xe7b9('0x14')](util[_0xe7b9('0x19')](_0xe7b9('0x32'),_0x4a9c3a[_0xe7b9('0x1c')]),_0x112fdb);}});ami['on']('blindtransfer',function(_0x35f6fc){try{utils[_0xe7b9('0x18')](util[_0xe7b9('0x19')](_0xe7b9('0x33'),_0x35f6fc[_0xe7b9('0x1c')]),_0x35f6fc);queues['blindtransfer'](_0x35f6fc);agents[_0xe7b9('0x34')](_0x35f6fc);transfers['blindtransfer'](_0x35f6fc);}catch(_0x177581){utils[_0xe7b9('0x14')](util[_0xe7b9('0x19')](_0xe7b9('0x33'),_0x35f6fc[_0xe7b9('0x1c')]),_0x177581);}});ami['on'](_0xe7b9('0x35'),function(_0x4b8c33){try{utils[_0xe7b9('0x18')](util[_0xe7b9('0x19')](_0xe7b9('0x36'),_0x4b8c33[_0xe7b9('0x37')]),_0x4b8c33);queues[_0xe7b9('0x35')](_0x4b8c33);transfers[_0xe7b9('0x35')](_0x4b8c33);agents[_0xe7b9('0x35')](_0x4b8c33);calls['attendedtransfer'](_0x4b8c33);}catch(_0x1ab0fe){utils[_0xe7b9('0x14')](util[_0xe7b9('0x19')](_0xe7b9('0x36'),_0x4b8c33[_0xe7b9('0x37')]),_0x1ab0fe);}});ami['on'](_0xe7b9('0x38'),function(_0x40ad0e){try{utils['debug'](util['format']('[%s][index][varset]',_0x40ad0e[_0xe7b9('0x1c')]),_0x40ad0e);queues['varset'](_0x40ad0e);recordings[_0xe7b9('0x38')](_0x40ad0e);calls[_0xe7b9('0x38')](_0x40ad0e);dials[_0xe7b9('0x38')](_0x40ad0e);}catch(_0x10cb73){utils[_0xe7b9('0x14')](util[_0xe7b9('0x19')](_0xe7b9('0x39'),_0x40ad0e[_0xe7b9('0x1c')]),_0x10cb73);}});ami['on'](_0xe7b9('0x3a'),function(_0x2d6fce){try{utils[_0xe7b9('0x18')](util[_0xe7b9('0x19')](_0xe7b9('0x3b'),_0x2d6fce[_0xe7b9('0x1c')]),_0x2d6fce);calls[_0xe7b9('0x3a')](_0x2d6fce);recordings[_0xe7b9('0x3a')](_0x2d6fce);dials[_0xe7b9('0x3a')](_0x2d6fce);}catch(_0xbc016d){utils['error'](util[_0xe7b9('0x19')]('[%s][index][newexten]',_0x2d6fce[_0xe7b9('0x1c')]),_0xbc016d);}});ami['on']('newchannel',function(_0x5a161c){try{utils[_0xe7b9('0x18')](util['format'](_0xe7b9('0x3c'),_0x5a161c[_0xe7b9('0x1c')]),_0x5a161c);calls[_0xe7b9('0x3d')](_0x5a161c);recordings[_0xe7b9('0x3d')](_0x5a161c);}catch(_0x19b899){utils[_0xe7b9('0x14')](util[_0xe7b9('0x19')](_0xe7b9('0x3c'),_0x5a161c[_0xe7b9('0x1c')]),_0x19b899);}});ami['on']('dialbegin',function(_0x2a23b8){try{utils['debug'](util['format'](_0xe7b9('0x3e'),_0x2a23b8[_0xe7b9('0x1c')]),_0x2a23b8);dials[_0xe7b9('0x3f')](_0x2a23b8);}catch(_0x5f233f){utils['error'](util[_0xe7b9('0x19')](_0xe7b9('0x40'),_0x2a23b8[_0xe7b9('0x1c')]),_0x5f233f);}});ami['on']('dialend',function(_0x4877ac){try{utils[_0xe7b9('0x18')](util['format'](_0xe7b9('0x41'),_0x4877ac[_0xe7b9('0x1c')]),_0x4877ac);dials[_0xe7b9('0x42')](_0x4877ac);}catch(_0x45086f){utils[_0xe7b9('0x14')](util[_0xe7b9('0x19')](_0xe7b9('0x41'),_0x4877ac[_0xe7b9('0x1c')]),_0x45086f);}});} \ No newline at end of file +var _0x34b0=['agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][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]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','production','local','asterisk','port','password','keepConnected','XDR\x20DISABLED','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34b0,0x137));var _0x034b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x34b0[_0x321bb2];return _0x9c12ed;};var AsteriskManager=require(_0x034b('0x0'));var config=require(_0x034b('0x1'));var utils=require('./utils');var util=require(_0x034b('0x2'));var isXDREnabled=config[_0x034b('0x3')]&&config['xdr'][_0x034b('0x4')]?!config[_0x034b('0x3')][_0x034b('0x4')]:!![];var isProduction=config['env']===_0x034b('0x5')||![];var isLocalAsterisk=config[_0x034b('0x3')]&&config[_0x034b('0x3')][_0x034b('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x034b('0x7')][_0x034b('0x8')],config['asterisk']['ip'],config[_0x034b('0x7')]['username'],config[_0x034b('0x7')][_0x034b('0x9')],!![]);ami[_0x034b('0xa')]();if(!isXDREnabled){utils['info'](_0x034b('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require(_0x034b('0xc'));var queues=require(_0x034b('0xd'));var recordings=require(_0x034b('0xe'));var members=require(_0x034b('0xf'));var dials=require(_0x034b('0x10'));var transfers=require(_0x034b('0x11'));var core=require(_0x034b('0x12'));ami['on']('connect',core[_0x034b('0x13')]);ami['on']('shutdown',core[_0x034b('0x14')]);ami['on'](_0x034b('0x15'),core['fullybooted']);ami['on']('error',core[_0x034b('0x16')]);ami['on'](_0x034b('0x17'),core[_0x034b('0x17')]);ami['on'](_0x034b('0x18'),core[_0x034b('0x18')]);ami['on'](_0x034b('0x19'),function(_0x99ff61){try{utils['debug'](util[_0x034b('0x1a')]('[%s][index][devicestatechange]',_0x99ff61['device']),_0x99ff61);members[_0x034b('0x19')](_0x99ff61);}catch(_0x4b570b){utils['error'](util[_0x034b('0x1a')]('[%s][index][devicestatechange]',_0x99ff61[_0x034b('0x1b')]),_0x4b570b);}});ami['on'](_0x034b('0x1c'),function(_0x52578c){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x1e'),_0x52578c[_0x034b('0x1f')]),_0x52578c);agents[_0x034b('0x1c')](_0x52578c);}catch(_0x127735){utils[_0x034b('0x16')](util['format'](_0x034b('0x1e'),_0x52578c[_0x034b('0x1f')]),_0x127735);}});ami['on'](_0x034b('0x20'),function(_0x495149){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x21'),_0x495149[_0x034b('0x1f')]),_0x495149);agents[_0x034b('0x20')](_0x495149);}catch(_0x470c35){utils['error'](util[_0x034b('0x1a')](_0x034b('0x21'),_0x495149[_0x034b('0x1f')]),_0x470c35);}});ami['on'](_0x034b('0x22'),function(_0xf3c228){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x23'),_0xf3c228['uniqueid']),_0xf3c228);agents['agentconnect'](_0xf3c228);queues[_0x034b('0x22')](_0xf3c228);}catch(_0x57d295){utils[_0x034b('0x16')](util['format'](_0x034b('0x23'),_0xf3c228['uniqueid']),_0x57d295);}});ami['on'](_0x034b('0x24'),function(_0x1e888b){try{utils[_0x034b('0x1d')](util['format'](_0x034b('0x25'),_0x1e888b[_0x034b('0x1f')]),_0x1e888b);agents['agentcomplete'](_0x1e888b);queues[_0x034b('0x24')](_0x1e888b);members[_0x034b('0x24')](_0x1e888b);}catch(_0x5bf901){utils[_0x034b('0x16')](util[_0x034b('0x1a')](_0x034b('0x25'),_0x1e888b['uniqueid']),_0x5bf901);}});ami['on'](_0x034b('0x26'),function(_0x3e9476){try{utils['debug'](util[_0x034b('0x1a')](_0x034b('0x27'),_0x3e9476['uniqueid']),_0x3e9476);agents['queuecallerabandon'](_0x3e9476);queues[_0x034b('0x26')](_0x3e9476);}catch(_0x5880cf){utils[_0x034b('0x16')](util['format'](_0x034b('0x27'),_0x3e9476['uniqueid']),_0x5880cf);}});ami['on'](_0x034b('0x28'),function(_0x1b9fc9){try{utils['debug'](util[_0x034b('0x1a')](_0x034b('0x29'),_0x1b9fc9[_0x034b('0x1f')]),_0x1b9fc9);queues[_0x034b('0x28')](_0x1b9fc9);recordings[_0x034b('0x28')](_0x1b9fc9);}catch(_0x2cb808){utils['error'](util[_0x034b('0x1a')]('[%s][index][queuecallerjoin]',_0x1b9fc9['uniqueid']),_0x2cb808);}});ami['on'](_0x034b('0x2a'),function(_0x4885df){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')]('[%s][index][queuecallerleave]',_0x4885df[_0x034b('0x1f')]),_0x4885df);queues['queuecallerleave'](_0x4885df);}catch(_0x2eb6dd){utils[_0x034b('0x16')](util['format'](_0x034b('0x2b'),_0x4885df[_0x034b('0x1f')]),_0x2eb6dd);}});ami['on'](_0x034b('0x2c'),function(_0x429ae3){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x2d'),_0x429ae3[_0x034b('0x1f')]),_0x429ae3);queues[_0x034b('0x2c')](_0x429ae3);calls['musiconholdstart'](_0x429ae3);}catch(_0x30f6cd){utils[_0x034b('0x16')](util['format']('[%s][index][musiconholdstart]',_0x429ae3[_0x034b('0x1f')]),_0x30f6cd);}});ami['on'](_0x034b('0x2e'),function(_0x5cb7cb){try{utils['debug'](util[_0x034b('0x1a')](_0x034b('0x2f'),_0x5cb7cb[_0x034b('0x1f')]),_0x5cb7cb);queues['musiconholdstop'](_0x5cb7cb);calls['musiconholdstop'](_0x5cb7cb);}catch(_0xe56d4d){utils[_0x034b('0x16')](util[_0x034b('0x1a')](_0x034b('0x2f'),_0x5cb7cb[_0x034b('0x1f')]),_0xe56d4d);}});ami['on'](_0x034b('0x30'),function(_0x4a7acc){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x31'),_0x4a7acc[_0x034b('0x1f')]),_0x4a7acc);calls[_0x034b('0x30')](_0x4a7acc);recordings['newstate'](_0x4a7acc);}catch(_0x1b9d13){utils['error'](util[_0x034b('0x1a')](_0x034b('0x31'),_0x4a7acc[_0x034b('0x1f')]),_0x1b9d13);}});ami['on'](_0x034b('0x32'),function(_0x1afb56){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x33'),_0x1afb56['uniqueid']),_0x1afb56);calls[_0x034b('0x32')](_0x1afb56);recordings['hangup'](_0x1afb56);dials[_0x034b('0x32')](_0x1afb56);agents[_0x034b('0x32')](_0x1afb56);queues['hangup'](_0x1afb56);}catch(_0x470e10){utils[_0x034b('0x16')](util[_0x034b('0x1a')](_0x034b('0x33'),_0x1afb56['uniqueid']),_0x470e10);}});ami['on'](_0x034b('0x34'),function(_0x298c9c){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x35'),_0x298c9c[_0x034b('0x1f')]),_0x298c9c);members[_0x034b('0x34')](_0x298c9c);}catch(_0x44691e){utils[_0x034b('0x16')](util['format'](_0x034b('0x35'),_0x298c9c['uniqueid']),_0x44691e);}});ami['on'](_0x034b('0x36'),function(_0x3a911c){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x37'),_0x3a911c[_0x034b('0x1f')]),_0x3a911c);queues[_0x034b('0x36')](_0x3a911c);agents[_0x034b('0x36')](_0x3a911c);transfers[_0x034b('0x36')](_0x3a911c);}catch(_0x4a021d){utils[_0x034b('0x16')](util[_0x034b('0x1a')](_0x034b('0x37'),_0x3a911c[_0x034b('0x1f')]),_0x4a021d);}});ami['on'](_0x034b('0x38'),function(_0x1738b0){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x39'),_0x1738b0[_0x034b('0x3a')]),_0x1738b0);queues[_0x034b('0x38')](_0x1738b0);transfers[_0x034b('0x38')](_0x1738b0);agents[_0x034b('0x38')](_0x1738b0);calls[_0x034b('0x38')](_0x1738b0);}catch(_0xf5b5d1){utils[_0x034b('0x16')](util['format'](_0x034b('0x39'),_0x1738b0[_0x034b('0x3a')]),_0xf5b5d1);}});ami['on']('varset',function(_0x357612){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x3b'),_0x357612['uniqueid']),_0x357612);queues[_0x034b('0x3c')](_0x357612);recordings[_0x034b('0x3c')](_0x357612);calls[_0x034b('0x3c')](_0x357612);dials[_0x034b('0x3c')](_0x357612);}catch(_0x1c1734){utils[_0x034b('0x16')](util['format'](_0x034b('0x3b'),_0x357612[_0x034b('0x1f')]),_0x1c1734);}});ami['on'](_0x034b('0x3d'),function(_0x4c0ca6){try{utils[_0x034b('0x1d')](util['format'](_0x034b('0x3e'),_0x4c0ca6[_0x034b('0x1f')]),_0x4c0ca6);calls['newexten'](_0x4c0ca6);recordings[_0x034b('0x3d')](_0x4c0ca6);dials[_0x034b('0x3d')](_0x4c0ca6);}catch(_0x44a454){utils[_0x034b('0x16')](util[_0x034b('0x1a')]('[%s][index][newexten]',_0x4c0ca6[_0x034b('0x1f')]),_0x44a454);}});ami['on'](_0x034b('0x3f'),function(_0x21da59){try{utils[_0x034b('0x1d')](util['format'](_0x034b('0x40'),_0x21da59[_0x034b('0x1f')]),_0x21da59);calls[_0x034b('0x3f')](_0x21da59);recordings[_0x034b('0x3f')](_0x21da59);}catch(_0x400b66){utils[_0x034b('0x16')](util[_0x034b('0x1a')](_0x034b('0x40'),_0x21da59[_0x034b('0x1f')]),_0x400b66);}});ami['on'](_0x034b('0x41'),function(_0x49ce8c){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x42'),_0x49ce8c[_0x034b('0x1f')]),_0x49ce8c);dials[_0x034b('0x41')](_0x49ce8c);}catch(_0x454339){utils[_0x034b('0x16')](util[_0x034b('0x1a')]('[%s]dialbegin',_0x49ce8c['uniqueid']),_0x454339);}});ami['on'](_0x034b('0x43'),function(_0x9ccb8e){try{utils[_0x034b('0x1d')](util[_0x034b('0x1a')](_0x034b('0x44'),_0x9ccb8e[_0x034b('0x1f')]),_0x9ccb8e);dials['dialend'](_0x9ccb8e);}catch(_0x1e08f7){utils[_0x034b('0x16')](util[_0x034b('0x1a')](_0x034b('0x44'),_0x9ccb8e[_0x034b('0x1f')]),_0x1e08f7);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 11926ac..59f2c73 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 _0x2318=['now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data1','type','source','data3','destination','destinationchannel','assign','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','util','./utils','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','getUserByInterface','internal','request','CreateMemberReport','split','then','name','error','some','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING'];(function(_0x4c12d4,_0x12909d){var _0x542d9e=function(_0x2c77d5){while(--_0x2c77d5){_0x4c12d4['push'](_0x4c12d4['shift']());}};_0x542d9e(++_0x12909d);}(_0x2318,0x115));var _0x8231=function(_0x3e8bf6,_0x7f3ece){_0x3e8bf6=_0x3e8bf6-0x0;var _0x2fe47c=_0x2318[_0x3e8bf6];return _0x2fe47c;};'use strict';var _=require('lodash');var util=require(_0x8231('0x0'));var utils=require(_0x8231('0x1'));var members={};var exclude=[_0x8231('0x2'),'Queue:'];function writeDB(_0x415b33){utils[_0x8231('0x3')](util[_0x8231('0x4')](_0x8231('0x5'),_0x415b33[_0x8231('0x6')],_0x415b33[_0x8231('0x7')],_0x415b33['channel'],_0x415b33[_0x8231('0x8')],_0x415b33[_0x8231('0x9')],_0x415b33['type']));if(_0x415b33['interface']){utils[_0x8231('0xa')](_0x415b33[_0x8231('0x7')])['then'](function(_0x243309){if(_0x243309){_0x415b33[_0x8231('0x9')]=_0x243309['name'];_0x415b33[_0x8231('0xb')]=_0x243309[_0x8231('0xb')];utils[_0x8231('0xc')](_0x8231('0xd'),_0x415b33);}else{utils['getUserByName'](_0x415b33[_0x8231('0x7')][_0x8231('0xe')]('/')[0x1])[_0x8231('0xf')](function(_0x191f34){if(_0x191f34){_0x415b33['membername']=_0x191f34[_0x8231('0x10')];_0x415b33[_0x8231('0xb')]=_0x191f34[_0x8231('0xb')];utils[_0x8231('0xc')](_0x8231('0xd'),_0x415b33);}});}})['catch'](function(_0x45665f){utils[_0x8231('0x11')](util[_0x8231('0x4')]('[%s][members][writeDB]',_0x415b33[_0x8231('0x6')]),_0x45665f);});}delete members[_0x415b33[_0x8231('0x7')]];}function startsWith(_0x287ce4,_0x54bf74){return _[_0x8231('0x12')](_0x287ce4,function(_0x38479f){return _['startsWith'](_0x54bf74,_0x38479f);});}exports[_0x8231('0x13')]=function(_0x2cf898){try{utils[_0x8231('0x14')](util[_0x8231('0x4')](_0x8231('0x15'),members[_0x2cf898[_0x8231('0x16')]]?members[_0x2cf898[_0x8231('0x16')]][_0x8231('0x6')]:_0x2cf898[_0x8231('0x16')]),_0x2cf898);utils[_0x8231('0x3')](util[_0x8231('0x4')](_0x8231('0x17'),members[_0x2cf898[_0x8231('0x16')]]?members[_0x2cf898[_0x8231('0x16')]]['uniqueid']:_0x2cf898[_0x8231('0x16')],_0x2cf898[_0x8231('0x18')],_0x2cf898['device']));switch(_0x2cf898[_0x8231('0x18')]){case _0x8231('0x19'):case _0x8231('0x1a'):if(!startsWith(exclude,_0x2cf898[_0x8231('0x16')])){members[_0x2cf898[_0x8231('0x16')]]={'channel':_0x8231('0x1b'),'interface':_0x2cf898['device'],'type':_0x8231('0x1c'),'enterAt':utils[_0x8231('0x1d')](),'role':_0x8231('0x1e')};}break;case _0x8231('0x1f'):if(!_[_0x8231('0x20')](members[_0x2cf898['device']])){members[_0x2cf898[_0x8231('0x16')]][_0x8231('0x21')]=utils['now']();members[_0x2cf898['device']][_0x8231('0x22')]=utils[_0x8231('0x23')](members[_0x2cf898[_0x8231('0x16')]][_0x8231('0x21')],members[_0x2cf898[_0x8231('0x16')]][_0x8231('0x24')]);if(members[_0x2cf898[_0x8231('0x16')]][_0x8231('0x6')]){writeDB(members[_0x2cf898[_0x8231('0x16')]]);}}break;default:break;}}catch(_0x38331a){utils[_0x8231('0x11')](util['format']('[%s][members][devicestatechange]',members[_0x2cf898[_0x8231('0x16')]]?members[_0x2cf898[_0x8231('0x16')]]['uniqueid']:_0x2cf898[_0x8231('0x16')]),_0x38331a);}};exports[_0x8231('0x25')]=function(_0x3475a2){try{if(!_['isNil'](members[_0x3475a2[_0x8231('0x7')]])){utils[_0x8231('0x14')](util['format']('[%s][members][agentcomplete]',_0x3475a2[_0x8231('0x6')]),_0x3475a2);utils[_0x8231('0x3')](util[_0x8231('0x4')](_0x8231('0x26'),_0x3475a2['uniqueid'],_0x3475a2[_0x8231('0x7')],_0x3475a2[_0x8231('0x27')]));members[_0x3475a2['interface']]=_['assign'](members[_0x3475a2[_0x8231('0x7')]],{'data4':_0x3475a2[_0x8231('0x27')],'uniqueid':_0x3475a2[_0x8231('0x6')]});}}catch(_0x3e06ef){utils[_0x8231('0x11')](util[_0x8231('0x4')](_0x8231('0x28'),_0x3475a2['uniqueid']),_0x3e06ef);}};exports[_0x8231('0x29')]=function(_0x22c25c){try{utils['debug'](util[_0x8231('0x4')](_0x8231('0x2a'),_0x22c25c['uniqueid']),_0x22c25c);if(_0x22c25c['channel']){var _0x3c764e=_0x22c25c['channel']['split']('-')[0x0];if(!_['isNil'](members[_0x3c764e])){members[_0x3c764e]=_['assign'](members[_0x3c764e],{'data1':members[_0x3c764e][_0x8231('0x2b')]||_0x22c25c[_0x8231('0x2c')],'data2':members[_0x3c764e]['data2']||_0x22c25c[_0x8231('0x2d')],'data3':members[_0x3c764e][_0x8231('0x2e')]||_0x22c25c[_0x8231('0x2f')],'uniqueid':members[_0x3c764e][_0x8231('0x6')]||_0x22c25c[_0x8231('0x6')]});utils[_0x8231('0x3')](util[_0x8231('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x22c25c[_0x8231('0x6')],members[_0x3c764e][_0x8231('0x2b')],members[_0x3c764e]['data2'],members[_0x3c764e][_0x8231('0x2e')]));if(members[_0x3c764e][_0x8231('0x21')]){writeDB(members[_0x3c764e]);}}}if(_0x22c25c[_0x8231('0x30')]){var _0x278304=_0x22c25c[_0x8231('0x30')][_0x8231('0xe')]('-')[0x0];if(!_[_0x8231('0x20')](members[_0x278304])){members[_0x278304]=_[_0x8231('0x31')](members[_0x278304],{'data1':members[_0x278304]['data1']||_0x22c25c['type'],'data2':members[_0x278304][_0x8231('0x8')]||_0x22c25c[_0x8231('0x2d')],'data3':members[_0x278304]['data3']||_0x22c25c[_0x8231('0x2f')],'uniqueid':members[_0x278304][_0x8231('0x6')]||_0x22c25c[_0x8231('0x6')]});utils[_0x8231('0x3')](util[_0x8231('0x4')](_0x8231('0x32'),_0x22c25c[_0x8231('0x6')],members[_0x278304]['data1'],members[_0x278304][_0x8231('0x8')],members[_0x278304]['data3']));if(members[_0x278304][_0x8231('0x21')]){writeDB(members[_0x278304]);}}}}catch(_0x314d51){utils[_0x8231('0x11')](util[_0x8231('0x4')](_0x8231('0x2a'),_0x22c25c[_0x8231('0x6')]),_0x314d51);}}; \ No newline at end of file +var _0x2a92=['some','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING','now','agent','NOT_INUSE','exitAt','duration','diffTime','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','channel','assign','data1','data2','source','data3','destination','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','membername','type','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','split','request','error','[%s][members][writeDB]'];(function(_0x2e7d83,_0x19c2f7){var _0x2fffb9=function(_0x20f5ec){while(--_0x20f5ec){_0x2e7d83['push'](_0x2e7d83['shift']());}};_0x2fffb9(++_0x19c2f7);}(_0x2a92,0xbf));var _0x22a9=function(_0x4582a9,_0x52e47d){_0x4582a9=_0x4582a9-0x0;var _0x49c003=_0x2a92[_0x4582a9];return _0x49c003;};'use strict';var _=require(_0x22a9('0x0'));var util=require(_0x22a9('0x1'));var utils=require(_0x22a9('0x2'));var members={};var exclude=[_0x22a9('0x3'),'Queue:'];function writeDB(_0x4ce4e9){utils[_0x22a9('0x4')](util[_0x22a9('0x5')](_0x22a9('0x6'),_0x4ce4e9[_0x22a9('0x7')],_0x4ce4e9[_0x22a9('0x8')],_0x4ce4e9['channel'],_0x4ce4e9['data2'],_0x4ce4e9[_0x22a9('0x9')],_0x4ce4e9[_0x22a9('0xa')]));if(_0x4ce4e9[_0x22a9('0x8')]){utils[_0x22a9('0xb')](_0x4ce4e9[_0x22a9('0x8')])[_0x22a9('0xc')](function(_0x4e3f92){if(_0x4e3f92){_0x4ce4e9[_0x22a9('0x9')]=_0x4e3f92[_0x22a9('0xd')];_0x4ce4e9[_0x22a9('0xe')]=_0x4e3f92[_0x22a9('0xe')];utils['request'](_0x22a9('0xf'),_0x4ce4e9);}else{utils[_0x22a9('0x10')](_0x4ce4e9[_0x22a9('0x8')][_0x22a9('0x11')]('/')[0x1])[_0x22a9('0xc')](function(_0x356121){if(_0x356121){_0x4ce4e9['membername']=_0x356121[_0x22a9('0xd')];_0x4ce4e9[_0x22a9('0xe')]=_0x356121[_0x22a9('0xe')];utils[_0x22a9('0x12')]('CreateMemberReport',_0x4ce4e9);}});}})['catch'](function(_0x5e0aaa){utils[_0x22a9('0x13')](util[_0x22a9('0x5')](_0x22a9('0x14'),_0x4ce4e9[_0x22a9('0x7')]),_0x5e0aaa);});}delete members[_0x4ce4e9['interface']];}function startsWith(_0x86b915,_0x1f3987){return _[_0x22a9('0x15')](_0x86b915,function(_0x40fe4b){return _['startsWith'](_0x1f3987,_0x40fe4b);});}exports[_0x22a9('0x16')]=function(_0x1bdd33){try{utils[_0x22a9('0x17')](util['format'](_0x22a9('0x18'),members[_0x1bdd33['device']]?members[_0x1bdd33[_0x22a9('0x19')]]['uniqueid']:_0x1bdd33[_0x22a9('0x19')]),_0x1bdd33);utils[_0x22a9('0x4')](util['format'](_0x22a9('0x1a'),members[_0x1bdd33[_0x22a9('0x19')]]?members[_0x1bdd33[_0x22a9('0x19')]][_0x22a9('0x7')]:_0x1bdd33[_0x22a9('0x19')],_0x1bdd33[_0x22a9('0x1b')],_0x1bdd33[_0x22a9('0x19')]));switch(_0x1bdd33[_0x22a9('0x1b')]){case _0x22a9('0x1c'):case'BUSY':if(!startsWith(exclude,_0x1bdd33[_0x22a9('0x19')])){members[_0x1bdd33[_0x22a9('0x19')]]={'channel':_0x22a9('0x1d'),'interface':_0x1bdd33[_0x22a9('0x19')],'type':_0x22a9('0x1e'),'enterAt':utils[_0x22a9('0x1f')](),'role':_0x22a9('0x20')};}break;case _0x22a9('0x21'):if(!_['isNil'](members[_0x1bdd33[_0x22a9('0x19')]])){members[_0x1bdd33[_0x22a9('0x19')]][_0x22a9('0x22')]=utils[_0x22a9('0x1f')]();members[_0x1bdd33[_0x22a9('0x19')]][_0x22a9('0x23')]=utils[_0x22a9('0x24')](members[_0x1bdd33[_0x22a9('0x19')]][_0x22a9('0x22')],members[_0x1bdd33[_0x22a9('0x19')]][_0x22a9('0x25')]);if(members[_0x1bdd33[_0x22a9('0x19')]][_0x22a9('0x7')]){writeDB(members[_0x1bdd33[_0x22a9('0x19')]]);}}break;default:break;}}catch(_0x42108d){utils[_0x22a9('0x13')](util[_0x22a9('0x5')](_0x22a9('0x18'),members[_0x1bdd33[_0x22a9('0x19')]]?members[_0x1bdd33[_0x22a9('0x19')]][_0x22a9('0x7')]:_0x1bdd33[_0x22a9('0x19')]),_0x42108d);}};exports[_0x22a9('0x26')]=function(_0x27d115){try{if(!_[_0x22a9('0x27')](members[_0x27d115[_0x22a9('0x8')]])){utils[_0x22a9('0x17')](util[_0x22a9('0x5')](_0x22a9('0x28'),_0x27d115[_0x22a9('0x7')]),_0x27d115);utils[_0x22a9('0x4')](util['format'](_0x22a9('0x29'),_0x27d115['uniqueid'],_0x27d115['interface'],_0x27d115[_0x22a9('0x2a')]));members[_0x27d115[_0x22a9('0x8')]]=_['assign'](members[_0x27d115[_0x22a9('0x8')]],{'data4':_0x27d115['queue'],'uniqueid':_0x27d115[_0x22a9('0x7')]});}}catch(_0x5bedad){utils[_0x22a9('0x13')](util[_0x22a9('0x5')](_0x22a9('0x28'),_0x27d115[_0x22a9('0x7')]),_0x5bedad);}};exports[_0x22a9('0x2b')]=function(_0x22f88b){try{utils[_0x22a9('0x17')](util[_0x22a9('0x5')]('[%s][members][cdr]',_0x22f88b['uniqueid']),_0x22f88b);if(_0x22f88b[_0x22a9('0x2c')]){var _0x23841c=_0x22f88b[_0x22a9('0x2c')]['split']('-')[0x0];if(!_[_0x22a9('0x27')](members[_0x23841c])){members[_0x23841c]=_[_0x22a9('0x2d')](members[_0x23841c],{'data1':members[_0x23841c][_0x22a9('0x2e')]||_0x22f88b[_0x22a9('0xa')],'data2':members[_0x23841c][_0x22a9('0x2f')]||_0x22f88b[_0x22a9('0x30')],'data3':members[_0x23841c][_0x22a9('0x31')]||_0x22f88b[_0x22a9('0x32')],'uniqueid':members[_0x23841c][_0x22a9('0x7')]||_0x22f88b[_0x22a9('0x7')]});utils['info'](util[_0x22a9('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x22f88b['uniqueid'],members[_0x23841c][_0x22a9('0x2e')],members[_0x23841c][_0x22a9('0x2f')],members[_0x23841c]['data3']));if(members[_0x23841c][_0x22a9('0x22')]){writeDB(members[_0x23841c]);}}}if(_0x22f88b[_0x22a9('0x33')]){var _0x3e5cc0=_0x22f88b[_0x22a9('0x33')][_0x22a9('0x11')]('-')[0x0];if(!_['isNil'](members[_0x3e5cc0])){members[_0x3e5cc0]=_[_0x22a9('0x2d')](members[_0x3e5cc0],{'data1':members[_0x3e5cc0][_0x22a9('0x2e')]||_0x22f88b[_0x22a9('0xa')],'data2':members[_0x3e5cc0][_0x22a9('0x2f')]||_0x22f88b[_0x22a9('0x30')],'data3':members[_0x3e5cc0]['data3']||_0x22f88b['destination'],'uniqueid':members[_0x3e5cc0][_0x22a9('0x7')]||_0x22f88b[_0x22a9('0x7')]});utils['info'](util['format'](_0x22a9('0x34'),_0x22f88b['uniqueid'],members[_0x3e5cc0]['data1'],members[_0x3e5cc0][_0x22a9('0x2f')],members[_0x3e5cc0][_0x22a9('0x31')]));if(members[_0x3e5cc0]['exitAt']){writeDB(members[_0x3e5cc0]);}}}}catch(_0x1cfe9d){utils['error'](util[_0x22a9('0x5')]('[%s][members][cdr]',_0x22f88b[_0x22a9('0x7')]),_0x1cfe9d);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 3b9b202..4c9205c 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 _0xd6ce=['calleridnum','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','transfertype','transfertargetlinkedid','transfertargetuniqueid','mohtime','[%s][queues][musiconholdstart]','musiconholdstop','musiconholdstartAt','util','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','CONTINUE','queuecallerabandonAt','toUpperCase','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfereruniqueid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone'];(function(_0x50a66c,_0x4f8f19){var _0x34ff99=function(_0x1ae35e){while(--_0x1ae35e){_0x50a66c['push'](_0x50a66c['shift']());}};_0x34ff99(++_0x4f8f19);}(_0xd6ce,0x141));var _0xed6c=function(_0x28f121,_0x503f66){_0x28f121=_0x28f121-0x0;var _0x3bfc07=_0xd6ce[_0x28f121];return _0x3bfc07;};'use strict';var _=require('lodash');var util=require(_0xed6c('0x0'));var utils=require('./utils');var queues={};function writeDB(_0x2e56cd){utils['info'](util[_0xed6c('0x1')](_0xed6c('0x2'),_0x2e56cd['uniqueid'],_0x2e56cd[_0xed6c('0x3')],_0x2e56cd[_0xed6c('0x4')],_0x2e56cd[_0xed6c('0x5')],_0x2e56cd['calleridnum'],_0x2e56cd[_0xed6c('0x6')],_0x2e56cd[_0xed6c('0x7')]));if(_0x2e56cd[_0xed6c('0x4')]){utils[_0xed6c('0x8')](_0x2e56cd[_0xed6c('0x4')])[_0xed6c('0x9')](function(_0x1922ce){if(_0x1922ce){_0x2e56cd['type']=_0x1922ce[_0xed6c('0xa')];}utils[_0xed6c('0xb')](_0xed6c('0xc'),_0x2e56cd);});}else{utils[_0xed6c('0xb')](_0xed6c('0xc'),_0x2e56cd);}if(_0x2e56cd[_0xed6c('0xd')]){delete queues[_0x2e56cd[_0xed6c('0xd')]];}else{delete queues[_0x2e56cd[_0xed6c('0xe')]];}}exports[_0xed6c('0xf')]=function(_0xa23d8){try{utils[_0xed6c('0x10')](util[_0xed6c('0x1')](_0xed6c('0x11'),_0xa23d8[_0xed6c('0xe')]),_0xa23d8);utils[_0xed6c('0x12')](util[_0xed6c('0x1')](_0xed6c('0x13'),_0xa23d8[_0xed6c('0xe')],_0xa23d8[_0xed6c('0x4')],_0xa23d8[_0xed6c('0x14')]));queues[_0xa23d8[_0xed6c('0xe')]]=_[_0xed6c('0x15')](_0xa23d8,{'originalposition':_0xa23d8[_0xed6c('0x14')],'queuecallerjoinAt':utils[_0xed6c('0x16')](),'mohtime':0x0});}catch(_0x45598e){utils[_0xed6c('0x17')](util[_0xed6c('0x1')](_0xed6c('0x11'),_0xa23d8['uniqueid']),_0x45598e);}};exports[_0xed6c('0x18')]=function(_0x57f0ec){try{if(!_[_0xed6c('0x19')](queues[_0x57f0ec[_0xed6c('0xe')]])){utils[_0xed6c('0x10')](util[_0xed6c('0x1')](_0xed6c('0x1a'),_0x57f0ec[_0xed6c('0xe')]),_0x57f0ec);if(queues[_0x57f0ec[_0xed6c('0xe')]][_0xed6c('0x1b')]){if(!queues[_0x57f0ec[_0xed6c('0xe')]][_0xed6c('0x1c')]&&!queues[_0x57f0ec['uniqueid']][_0xed6c('0x1d')]){queues[_0x57f0ec[_0xed6c('0xe')]][_0xed6c('0x1e')]=!![];queues[_0x57f0ec[_0xed6c('0xe')]]['queuecallercompleteAt']=utils[_0xed6c('0x16')]();queues[_0x57f0ec[_0xed6c('0xe')]]['queuecallerexitreason']=_0xed6c('0x1f');}utils['info'](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x57f0ec[_0xed6c('0xe')],queues[_0x57f0ec['uniqueid']][_0xed6c('0x20')],queues[_0x57f0ec['uniqueid']][_0xed6c('0x7')]));writeDB(queues[_0x57f0ec[_0xed6c('0xe')]]);}else if(queues[_0x57f0ec[_0xed6c('0xe')]][_0xed6c('0xd')]){utils[_0xed6c('0x12')](util[_0xed6c('0x1')](_0xed6c('0x21'),_0x57f0ec['uniqueid'],queues[_0x57f0ec[_0xed6c('0xe')]]['name'],queues[_0x57f0ec[_0xed6c('0xe')]]['transfereduniqueid']));queues[queues[_0x57f0ec['uniqueid']][_0xed6c('0xd')]]=queues[_0x57f0ec['uniqueid']];queues[queues[_0x57f0ec['uniqueid']][_0xed6c('0xd')]][_0xed6c('0x22')]=0x2;delete queues[_0x57f0ec[_0xed6c('0xe')]];}}}catch(_0x52fa2d){utils[_0xed6c('0x17')](util['format'](_0xed6c('0x1a'),_0x57f0ec[_0xed6c('0xe')]),_0x52fa2d);}};exports[_0xed6c('0x23')]=function(_0x189c81){try{utils['debug'](util['format'](_0xed6c('0x24'),_0x189c81['uniqueid']),_0x189c81);if(!_['isNil'](_0x189c81[_0xed6c('0x25')][_0xed6c('0x26')])&&_0x189c81[_0xed6c('0x27')]['toUpperCase']()!==_0xed6c('0x28')){if(!_[_0xed6c('0x19')](queues[_0x189c81['uniqueid']])){queues[_0x189c81[_0xed6c('0xe')]][_0xed6c('0x1c')]=![];queues[_0x189c81[_0xed6c('0xe')]][_0xed6c('0x29')]=null;queues[_0x189c81[_0xed6c('0xe')]][_0xed6c('0x1d')]=!![];queues[_0x189c81[_0xed6c('0xe')]]['queuecallerexitAt']=utils['now']();queues[_0x189c81[_0xed6c('0xe')]][_0xed6c('0x7')]=_0x189c81[_0xed6c('0x27')][_0xed6c('0x2a')]();utils[_0xed6c('0x12')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x189c81[_0xed6c('0xe')],queues[_0x189c81['uniqueid']][_0xed6c('0x20')],_0x189c81[_0xed6c('0x27')],queues[_0x189c81[_0xed6c('0xe')]][_0xed6c('0x7')]));writeDB(queues[_0x189c81[_0xed6c('0xe')]]);}}else if(!_[_0xed6c('0x19')](_0x189c81['variable'][_0xed6c('0x2b')])){if(!_[_0xed6c('0x19')](queues[_0x189c81[_0xed6c('0xe')]])&&!queues[_0x189c81[_0xed6c('0xe')]]['queuecallerabandon']){queues[_0x189c81[_0xed6c('0xe')]][_0xed6c('0x1c')]=![];queues[_0x189c81[_0xed6c('0xe')]][_0xed6c('0x29')]=null;queues[_0x189c81[_0xed6c('0xe')]][_0xed6c('0x1d')]=!![];queues[_0x189c81[_0xed6c('0xe')]][_0xed6c('0x2c')]=utils[_0xed6c('0x16')]();queues[_0x189c81[_0xed6c('0xe')]]['queuecallerexitreason']=_0xed6c('0x2d');utils[_0xed6c('0x12')](util[_0xed6c('0x1')](_0xed6c('0x2e'),_0x189c81[_0xed6c('0xe')],queues[_0x189c81[_0xed6c('0xe')]]['name'],_0x189c81[_0xed6c('0x27')],queues[_0x189c81[_0xed6c('0xe')]][_0xed6c('0x7')]));}}}catch(_0x928e0f){utils[_0xed6c('0x17')](util['format'](_0xed6c('0x24'),_0x189c81['uniqueid']),_0x928e0f);}};exports[_0xed6c('0x1c')]=function(_0x32a68d){try{if(!_['isNil'](queues[_0x32a68d['uniqueid']])){utils[_0xed6c('0x10')](util['format'](_0xed6c('0x2f'),_0x32a68d[_0xed6c('0xe')]),_0x32a68d);queues[_0x32a68d[_0xed6c('0xe')]][_0xed6c('0x1d')]=![];queues[_0x32a68d[_0xed6c('0xe')]][_0xed6c('0x2c')]=null;queues[_0x32a68d[_0xed6c('0xe')]]['queuecallerabandon']=!![];queues[_0x32a68d[_0xed6c('0xe')]][_0xed6c('0x29')]=utils[_0xed6c('0x16')]();queues[_0x32a68d[_0xed6c('0xe')]]['queuecallerexitreason']=_0xed6c('0x30');utils[_0xed6c('0x12')](util['format'](_0xed6c('0x31'),_0x32a68d[_0xed6c('0xe')],queues[_0x32a68d[_0xed6c('0xe')]]['name'],queues[_0x32a68d[_0xed6c('0xe')]][_0xed6c('0x7')]));}}catch(_0x52cc97){utils['error'](util[_0xed6c('0x1')]('[%s][queues][queuecallerabandon]',_0x32a68d[_0xed6c('0xe')]),_0x52cc97);}};exports[_0xed6c('0x32')]=function(_0x3cfb78){try{if(!_[_0xed6c('0x19')](queues[_0x3cfb78[_0xed6c('0xe')]])){utils['debug'](util[_0xed6c('0x1')](_0xed6c('0x33'),_0x3cfb78[_0xed6c('0xe')]),_0x3cfb78);utils[_0xed6c('0x12')](util[_0xed6c('0x1')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x3cfb78[_0xed6c('0xe')],queues[_0x3cfb78[_0xed6c('0xe')]][_0xed6c('0x20')],_0x3cfb78['connectedlinenum'],_0x3cfb78[_0xed6c('0x34')]));queues[_0x3cfb78[_0xed6c('0xe')]]['queuecallerleave']=!![];queues[_0x3cfb78['uniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0x3cfb78[_0xed6c('0xe')]][_0xed6c('0x35')]=utils[_0xed6c('0x36')](queues[_0x3cfb78[_0xed6c('0xe')]][_0xed6c('0x1b')],queues[_0x3cfb78[_0xed6c('0xe')]][_0xed6c('0x37')]);queues[_0x3cfb78[_0xed6c('0xe')]]['position']=_0x3cfb78[_0xed6c('0x14')];queues[_0x3cfb78[_0xed6c('0xe')]][_0xed6c('0x38')]=_0x3cfb78[_0xed6c('0x38')];queues[_0x3cfb78[_0xed6c('0xe')]]['connectedlinenum']=_0x3cfb78[_0xed6c('0x39')];queues[_0x3cfb78['uniqueid']]['connectedlinename']=_0x3cfb78[_0xed6c('0x34')];}}catch(_0x1e2621){utils['error'](util[_0xed6c('0x1')](_0xed6c('0x33'),_0x3cfb78['uniqueid']),_0x1e2621);}};exports[_0xed6c('0x3a')]=function(_0x4aa456){try{if(!_[_0xed6c('0x19')](queues[_0x4aa456[_0xed6c('0xe')]])){utils['debug'](util[_0xed6c('0x1')](_0xed6c('0x3b'),_0x4aa456[_0xed6c('0xe')]),_0x4aa456);utils['info'](util[_0xed6c('0x1')](_0xed6c('0x3c'),_0x4aa456[_0xed6c('0xe')],queues[_0x4aa456[_0xed6c('0xe')]][_0xed6c('0x20')],_0x4aa456[_0xed6c('0x3d')],_0x4aa456[_0xed6c('0x3e')]));queues[_0x4aa456[_0xed6c('0xe')]][_0xed6c('0x1c')]=![];queues[_0x4aa456[_0xed6c('0xe')]][_0xed6c('0x1c')]=![];queues[_0x4aa456[_0xed6c('0xe')]][_0xed6c('0x29')]=null;queues[_0x4aa456[_0xed6c('0xe')]][_0xed6c('0x1d')]=![];queues[_0x4aa456[_0xed6c('0xe')]][_0xed6c('0x7')]=null;queues[_0x4aa456[_0xed6c('0xe')]][_0xed6c('0x2c')]=null;queues[_0x4aa456[_0xed6c('0xe')]][_0xed6c('0x3f')]=!![];queues[_0x4aa456[_0xed6c('0xe')]][_0xed6c('0x6')]=_0x4aa456[_0xed6c('0x3e')];queues[_0x4aa456[_0xed6c('0xe')]][_0xed6c('0x5')]=_0x4aa456[_0xed6c('0x3d')];}}catch(_0xcc6303){utils[_0xed6c('0x17')](util['format'](_0xed6c('0x3b'),_0x4aa456[_0xed6c('0xe')]),_0xcc6303);}};exports[_0xed6c('0x40')]=function(_0x155b4d){try{if(!_[_0xed6c('0x19')](queues[_0x155b4d[_0xed6c('0xe')]])){if(queues[_0x155b4d['uniqueid']][_0xed6c('0x1b')]){utils[_0xed6c('0x10')](util[_0xed6c('0x1')](_0xed6c('0x41'),_0x155b4d[_0xed6c('0xe')]),_0x155b4d);queues[_0x155b4d[_0xed6c('0xe')]][_0xed6c('0x1c')]=![];queues[_0x155b4d[_0xed6c('0xe')]]['queuecallerabandon']=![];queues[_0x155b4d['uniqueid']][_0xed6c('0x29')]=null;queues[_0x155b4d[_0xed6c('0xe')]][_0xed6c('0x1d')]=![];queues[_0x155b4d[_0xed6c('0xe')]]['queuecallerexitAt']=null;queues[_0x155b4d[_0xed6c('0xe')]][_0xed6c('0x3f')]=!![];queues[_0x155b4d[_0xed6c('0xe')]][_0xed6c('0x5')]=_0x155b4d[_0xed6c('0x3d')];queues[_0x155b4d[_0xed6c('0xe')]]['queuecallercomplete']=!![];queues[_0x155b4d[_0xed6c('0xe')]][_0xed6c('0x42')]=utils[_0xed6c('0x16')]();if(_0x155b4d[_0xed6c('0x43')]==_0xed6c('0x44')){if(!queues[_0x155b4d[_0xed6c('0xe')]][_0xed6c('0x44')]){queues[_0x155b4d[_0xed6c('0xe')]]['queuecallerexitreason']=_0xed6c('0x45');}}else{queues[_0x155b4d['uniqueid']][_0xed6c('0x7')]=_0xed6c('0x46')+_0x155b4d[_0xed6c('0x43')][_0xed6c('0x2a')]();}utils[_0xed6c('0x12')](util[_0xed6c('0x1')](_0xed6c('0x47'),_0x155b4d[_0xed6c('0xe')],queues[_0x155b4d[_0xed6c('0xe')]][_0xed6c('0x20')],_0x155b4d[_0xed6c('0x3d')],queues[_0x155b4d[_0xed6c('0xe')]][_0xed6c('0x7')]));writeDB(queues[_0x155b4d[_0xed6c('0xe')]]);}}}catch(_0x57dc25){utils[_0xed6c('0x17')](util[_0xed6c('0x1')](_0xed6c('0x41'),_0x155b4d[_0xed6c('0xe')]),_0x57dc25);}};exports[_0xed6c('0x48')]=function(_0x21cc14){try{if(!_[_0xed6c('0x19')](queues[_0x21cc14['transfereeuniqueid']])){utils[_0xed6c('0x10')](util[_0xed6c('0x1')](_0xed6c('0x49'),_0x21cc14[_0xed6c('0xe')]),_0x21cc14);queues[_0x21cc14[_0xed6c('0x4a')]]['transfer']=!![];queues[_0x21cc14['transfereeuniqueid']]['transfertype']=_0xed6c('0x4b');queues[_0x21cc14[_0xed6c('0x4a')]][_0xed6c('0x4c')]=_0x21cc14[_0xed6c('0x4d')];queues[_0x21cc14[_0xed6c('0x4a')]][_0xed6c('0x4e')]=_0x21cc14['transfereeuniqueid'];queues[_0x21cc14['transfereeuniqueid']][_0xed6c('0x7')]=_0xed6c('0x4f');utils[_0xed6c('0x12')](util['format']('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x21cc14['uniqueid'],queues[_0x21cc14[_0xed6c('0x4a')]][_0xed6c('0x20')],_0x21cc14[_0xed6c('0x4a')],_0x21cc14[_0xed6c('0x4d')]));}}catch(_0x55ae6d){utils[_0xed6c('0x17')](util[_0xed6c('0x1')](_0xed6c('0x49'),_0x21cc14['uniqueid']),_0x55ae6d);}};exports[_0xed6c('0x50')]=function(_0x140052){try{utils[_0xed6c('0x10')](util[_0xed6c('0x1')](_0xed6c('0x51'),_0x140052['origtransfereruniqueid']),_0x140052);if(_0x140052['origtransfereruniqueid']==_0x140052['origtransfererlinkedid']){if(!_['isNil'](queues[_0x140052[_0xed6c('0x52')]])){utils[_0xed6c('0x12')](util[_0xed6c('0x1')](_0xed6c('0x53'),_0x140052[_0xed6c('0x54')],queues[_0x140052[_0xed6c('0x52')]][_0xed6c('0x20')],_0x140052[_0xed6c('0x55')]));queues[_0x140052[_0xed6c('0x52')]][_0xed6c('0x44')]=!![];queues[_0x140052[_0xed6c('0x52')]]['transfertype']=_0xed6c('0x56');queues[_0x140052[_0xed6c('0x52')]][_0xed6c('0x4c')]=_0x140052[_0xed6c('0x55')];queues[_0x140052[_0xed6c('0x52')]][_0xed6c('0x4e')]=_0x140052[_0xed6c('0x54')];queues[_0x140052[_0xed6c('0x52')]][_0xed6c('0x7')]=_0xed6c('0x57');}if(!_['isNil'](queues[_0x140052[_0xed6c('0x58')]])){if(_0x140052[_0xed6c('0x59')]&&queues[_0x140052['transfereelinkedid']]){queues[_0x140052[_0xed6c('0x59')]][_0xed6c('0x22')]=0x1;queues[_0x140052[_0xed6c('0x4a')]]=_[_0xed6c('0x5a')](queues[_0x140052['transfereelinkedid']]);queues[_0x140052['transfereeuniqueid']][_0xed6c('0xd')]=_0x140052['transfertargetuniqueid'];queues[_0x140052['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x140052[_0xed6c('0x4a')]][_0xed6c('0x5b')]=queues[_0x140052[_0xed6c('0x52')]][_0xed6c('0x5b')];queues[_0x140052[_0xed6c('0x4a')]][_0xed6c('0x5c')]=queues[_0x140052[_0xed6c('0x52')]][_0xed6c('0x5c')];queues[_0x140052[_0xed6c('0x4a')]][_0xed6c('0x37')]=utils[_0xed6c('0x16')]();queues[_0x140052['transfereeuniqueid']][_0xed6c('0x1b')]=utils['now']();queues[_0x140052[_0xed6c('0x4a')]][_0xed6c('0x35')]=0x0;queues[_0x140052['transfereeuniqueid']]['mohtime']=0x0;utils[_0xed6c('0x12')](util[_0xed6c('0x1')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x140052['origtransfereruniqueid'],queues[_0x140052[_0xed6c('0x4a')]][_0xed6c('0x20')],queues[_0x140052[_0xed6c('0x4a')]][_0xed6c('0x5b')],queues[_0x140052[_0xed6c('0x4a')]][_0xed6c('0x5c')]));}else{utils[_0xed6c('0x12')](util[_0xed6c('0x1')](_0xed6c('0x5d'),_0x140052[_0xed6c('0x54')],queues[_0x140052[_0xed6c('0x58')]][_0xed6c('0x20')],_0x140052['secondtransfererlinkedid']));queues[_0x140052[_0xed6c('0x58')]]['transfereduniqueid']=_0x140052['secondtransfererlinkedid'];}}}else if(_0x140052[_0xed6c('0x5e')]==_0x140052[_0xed6c('0x52')]){if(!_['isNil'](queues[_0x140052[_0xed6c('0x58')]])){utils['info'](util[_0xed6c('0x1')](_0xed6c('0x5f'),_0x140052['origtransfereruniqueid'],queues[_0x140052[_0xed6c('0x58')]][_0xed6c('0x20')],_0x140052['secondtransfereruniqueid'],_0x140052['secondtransfererexten']));queues[_0x140052['origtransfererlinkedid']]['transfer']=!![];queues[_0x140052[_0xed6c('0x58')]][_0xed6c('0x60')]=_0xed6c('0x56');queues[_0x140052[_0xed6c('0x58')]][_0xed6c('0x4c')]=_0x140052['secondtransfererexten'];queues[_0x140052['origtransfererlinkedid']][_0xed6c('0x4e')]=_0x140052[_0xed6c('0x5e')];queues[_0x140052['origtransfererlinkedid']][_0xed6c('0x7')]=_0xed6c('0x57');}if(!_[_0xed6c('0x19')](queues[_0x140052[_0xed6c('0x52')]])){if(_0x140052[_0xed6c('0x61')]&&queues[_0x140052['transfertargetlinkedid']]){queues[_0x140052[_0xed6c('0x61')]][_0xed6c('0x22')]=0x1;queues[_0x140052['transfertargetuniqueid']]=_[_0xed6c('0x5a')](queues[_0x140052[_0xed6c('0x61')]]);queues[_0x140052['transfertargetuniqueid']][_0xed6c('0xd')]=_0x140052['transfertargetuniqueid'];queues[_0x140052[_0xed6c('0x62')]][_0xed6c('0x22')]=0x2;queues[_0x140052[_0xed6c('0x62')]][_0xed6c('0x5b')]=queues[_0x140052[_0xed6c('0x58')]][_0xed6c('0x5b')];queues[_0x140052[_0xed6c('0x62')]][_0xed6c('0x5c')]=queues[_0x140052['origtransfererlinkedid']][_0xed6c('0x5c')];queues[_0x140052[_0xed6c('0x62')]]['queuecallerjoinAt']=utils[_0xed6c('0x16')]();queues[_0x140052[_0xed6c('0x62')]][_0xed6c('0x1b')]=utils[_0xed6c('0x16')]();queues[_0x140052[_0xed6c('0x62')]][_0xed6c('0x35')]=0x0;queues[_0x140052[_0xed6c('0x62')]][_0xed6c('0x63')]=0x0;utils['info'](util[_0xed6c('0x1')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x140052[_0xed6c('0x54')],queues[_0x140052[_0xed6c('0x62')]][_0xed6c('0x20')],queues[_0x140052[_0xed6c('0x62')]]['transfereduniqueid'],queues[_0x140052[_0xed6c('0x62')]][_0xed6c('0x5b')],queues[_0x140052[_0xed6c('0x62')]][_0xed6c('0x5c')]));}else{utils['info'](util[_0xed6c('0x1')](_0xed6c('0x5d'),_0x140052[_0xed6c('0x54')],queues[_0x140052[_0xed6c('0x52')]]['name'],_0x140052['origtransfererlinkedid']));queues[_0x140052['secondtransfererlinkedid']]['transfereduniqueid']=_0x140052[_0xed6c('0x58')];}}}}catch(_0x15f531){utils[_0xed6c('0x17')](util[_0xed6c('0x1')](_0xed6c('0x51'),_0x140052[_0xed6c('0x54')]),_0x15f531);}};exports['musiconholdstart']=function(_0x1a8741){try{if(!_[_0xed6c('0x19')](queues[_0x1a8741[_0xed6c('0xe')]])){utils[_0xed6c('0x10')](util[_0xed6c('0x1')](_0xed6c('0x64'),_0x1a8741[_0xed6c('0xe')]),_0x1a8741);queues[_0x1a8741['uniqueid']]['musiconholdstartAt']=utils['now']();utils[_0xed6c('0x12')](util[_0xed6c('0x1')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x1a8741[_0xed6c('0xe')],queues[_0x1a8741[_0xed6c('0xe')]][_0xed6c('0x20')],queues[_0x1a8741[_0xed6c('0xe')]]['musiconholdstartAt']));}}catch(_0x25d725){utils[_0xed6c('0x17')](util[_0xed6c('0x1')](_0xed6c('0x64'),_0x1a8741[_0xed6c('0xe')]),_0x25d725);}};exports[_0xed6c('0x65')]=function(_0x1628e3){try{if(!_[_0xed6c('0x19')](queues[_0x1628e3[_0xed6c('0xe')]])){if(!_[_0xed6c('0x19')](queues[_0x1628e3[_0xed6c('0xe')]][_0xed6c('0x66')])){utils[_0xed6c('0x10')](util[_0xed6c('0x1')]('[%s][queues][musiconholdstop]',_0x1628e3[_0xed6c('0xe')]),_0x1628e3);queues[_0x1628e3['uniqueid']][_0xed6c('0x63')]+=utils[_0xed6c('0x36')](utils[_0xed6c('0x16')](),queues[_0x1628e3[_0xed6c('0xe')]][_0xed6c('0x66')]);utils[_0xed6c('0x12')](util[_0xed6c('0x1')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x1628e3[_0xed6c('0xe')],queues[_0x1628e3[_0xed6c('0xe')]][_0xed6c('0x20')],queues[_0x1628e3[_0xed6c('0xe')]][_0xed6c('0x63')]));delete queues[_0x1628e3[_0xed6c('0xe')]][_0xed6c('0x66')];}}}catch(_0x53830f){utils[_0xed6c('0x17')](util[_0xed6c('0x1')]('[%s][queues][musiconholdstop]',_0x1628e3[_0xed6c('0xe')]),_0x53830f);}}; \ No newline at end of file +var _0xa799=['count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','accountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][blindtransfer]','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','transfereelinkedid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','clone','transfertargetuniqueid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','musiconholdstartAt','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','uniqueid','channel','queue','lastAssignedTo','calleridnum','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','now','error','[%s][queues][queuecallerjoin]','isNil','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','position'];(function(_0x9b2bb0,_0x3965b1){var _0x2cdb3b=function(_0x177d75){while(--_0x177d75){_0x9b2bb0['push'](_0x9b2bb0['shift']());}};_0x2cdb3b(++_0x3965b1);}(_0xa799,0x100));var _0x9a79=function(_0x504025,_0xe4af29){_0x504025=_0x504025-0x0;var _0x273e97=_0xa799[_0x504025];return _0x273e97;};'use strict';var _=require(_0x9a79('0x0'));var util=require(_0x9a79('0x1'));var utils=require(_0x9a79('0x2'));var queues={};function writeDB(_0x2be154){utils[_0x9a79('0x3')](util[_0x9a79('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x2be154[_0x9a79('0x5')],_0x2be154[_0x9a79('0x6')],_0x2be154[_0x9a79('0x7')],_0x2be154[_0x9a79('0x8')],_0x2be154[_0x9a79('0x9')],_0x2be154['accountcode'],_0x2be154['queuecallerexitreason']));if(_0x2be154[_0x9a79('0x7')]){utils[_0x9a79('0xa')](_0x2be154[_0x9a79('0x7')])[_0x9a79('0xb')](function(_0x36cbd8){if(_0x36cbd8){_0x2be154[_0x9a79('0xc')]=_0x36cbd8['type'];}utils[_0x9a79('0xd')]('CreateVoiceQueueReport',_0x2be154);});}else{utils['request'](_0x9a79('0xe'),_0x2be154);}if(_0x2be154[_0x9a79('0xf')]){delete queues[_0x2be154[_0x9a79('0xf')]];}else{delete queues[_0x2be154[_0x9a79('0x5')]];}}exports[_0x9a79('0x10')]=function(_0x121484){try{utils[_0x9a79('0x11')](util[_0x9a79('0x4')]('[%s][queues][queuecallerjoin]',_0x121484['uniqueid']),_0x121484);utils[_0x9a79('0x3')](util['format'](_0x9a79('0x12'),_0x121484['uniqueid'],_0x121484['queue'],_0x121484['position']));queues[_0x121484[_0x9a79('0x5')]]=_['assign'](_0x121484,{'originalposition':_0x121484['position'],'queuecallerjoinAt':utils[_0x9a79('0x13')](),'mohtime':0x0});}catch(_0x565d70){utils[_0x9a79('0x14')](util[_0x9a79('0x4')](_0x9a79('0x15'),_0x121484['uniqueid']),_0x565d70);}};exports['hangup']=function(_0x463b54){try{if(!_[_0x9a79('0x16')](queues[_0x463b54[_0x9a79('0x5')]])){utils[_0x9a79('0x11')](util[_0x9a79('0x4')]('[%s][queues][hangup]',_0x463b54[_0x9a79('0x5')]),_0x463b54);if(queues[_0x463b54['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x463b54[_0x9a79('0x5')]]['queuecallerabandon']&&!queues[_0x463b54['uniqueid']][_0x9a79('0x17')]){queues[_0x463b54[_0x9a79('0x5')]][_0x9a79('0x18')]=!![];queues[_0x463b54[_0x9a79('0x5')]][_0x9a79('0x19')]=utils[_0x9a79('0x13')]();queues[_0x463b54[_0x9a79('0x5')]][_0x9a79('0x1a')]='COMPLETEDBYAGENT';}utils[_0x9a79('0x3')](util[_0x9a79('0x4')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x463b54[_0x9a79('0x5')],queues[_0x463b54['uniqueid']][_0x9a79('0x1b')],queues[_0x463b54[_0x9a79('0x5')]][_0x9a79('0x1a')]));writeDB(queues[_0x463b54[_0x9a79('0x5')]]);}else if(queues[_0x463b54[_0x9a79('0x5')]][_0x9a79('0xf')]){utils[_0x9a79('0x3')](util['format'](_0x9a79('0x1c'),_0x463b54[_0x9a79('0x5')],queues[_0x463b54[_0x9a79('0x5')]][_0x9a79('0x1b')],queues[_0x463b54[_0x9a79('0x5')]][_0x9a79('0xf')]));queues[queues[_0x463b54[_0x9a79('0x5')]][_0x9a79('0xf')]]=queues[_0x463b54['uniqueid']];queues[queues[_0x463b54[_0x9a79('0x5')]][_0x9a79('0xf')]][_0x9a79('0x1d')]=0x2;delete queues[_0x463b54[_0x9a79('0x5')]];}}}catch(_0x42c08d){utils[_0x9a79('0x14')](util[_0x9a79('0x4')](_0x9a79('0x1e'),_0x463b54[_0x9a79('0x5')]),_0x42c08d);}};exports[_0x9a79('0x1f')]=function(_0x60e80b){try{utils[_0x9a79('0x11')](util['format'](_0x9a79('0x20'),_0x60e80b[_0x9a79('0x5')]),_0x60e80b);if(!_[_0x9a79('0x16')](_0x60e80b['variable'][_0x9a79('0x21')])&&_0x60e80b[_0x9a79('0x22')][_0x9a79('0x23')]()!==_0x9a79('0x24')){if(!_[_0x9a79('0x16')](queues[_0x60e80b[_0x9a79('0x5')]])){queues[_0x60e80b[_0x9a79('0x5')]][_0x9a79('0x25')]=![];queues[_0x60e80b[_0x9a79('0x5')]][_0x9a79('0x26')]=null;queues[_0x60e80b[_0x9a79('0x5')]][_0x9a79('0x17')]=!![];queues[_0x60e80b[_0x9a79('0x5')]][_0x9a79('0x27')]=utils[_0x9a79('0x13')]();queues[_0x60e80b['uniqueid']][_0x9a79('0x1a')]=_0x60e80b['value'][_0x9a79('0x23')]();utils[_0x9a79('0x3')](util[_0x9a79('0x4')](_0x9a79('0x28'),_0x60e80b[_0x9a79('0x5')],queues[_0x60e80b[_0x9a79('0x5')]][_0x9a79('0x1b')],_0x60e80b['value'],queues[_0x60e80b[_0x9a79('0x5')]][_0x9a79('0x1a')]));writeDB(queues[_0x60e80b[_0x9a79('0x5')]]);}}else if(!_[_0x9a79('0x16')](_0x60e80b[_0x9a79('0x29')][_0x9a79('0x2a')])){if(!_[_0x9a79('0x16')](queues[_0x60e80b['uniqueid']])&&!queues[_0x60e80b['uniqueid']][_0x9a79('0x25')]){queues[_0x60e80b[_0x9a79('0x5')]]['queuecallerabandon']=![];queues[_0x60e80b[_0x9a79('0x5')]][_0x9a79('0x26')]=null;queues[_0x60e80b[_0x9a79('0x5')]][_0x9a79('0x17')]=!![];queues[_0x60e80b[_0x9a79('0x5')]][_0x9a79('0x27')]=utils[_0x9a79('0x13')]();queues[_0x60e80b['uniqueid']]['queuecallerexitreason']='EXITWITHKEY';utils[_0x9a79('0x3')](util[_0x9a79('0x4')](_0x9a79('0x2b'),_0x60e80b['uniqueid'],queues[_0x60e80b['uniqueid']][_0x9a79('0x1b')],_0x60e80b['value'],queues[_0x60e80b[_0x9a79('0x5')]][_0x9a79('0x1a')]));}}}catch(_0x28c58c){utils[_0x9a79('0x14')](util['format']('[%s][queues][varset]',_0x60e80b[_0x9a79('0x5')]),_0x28c58c);}};exports[_0x9a79('0x25')]=function(_0x4eb427){try{if(!_[_0x9a79('0x16')](queues[_0x4eb427['uniqueid']])){utils[_0x9a79('0x11')](util[_0x9a79('0x4')](_0x9a79('0x2c'),_0x4eb427['uniqueid']),_0x4eb427);queues[_0x4eb427[_0x9a79('0x5')]][_0x9a79('0x17')]=![];queues[_0x4eb427[_0x9a79('0x5')]][_0x9a79('0x27')]=null;queues[_0x4eb427[_0x9a79('0x5')]][_0x9a79('0x25')]=!![];queues[_0x4eb427[_0x9a79('0x5')]][_0x9a79('0x26')]=utils[_0x9a79('0x13')]();queues[_0x4eb427['uniqueid']][_0x9a79('0x1a')]=_0x9a79('0x2d');utils[_0x9a79('0x3')](util[_0x9a79('0x4')](_0x9a79('0x2e'),_0x4eb427[_0x9a79('0x5')],queues[_0x4eb427[_0x9a79('0x5')]][_0x9a79('0x1b')],queues[_0x4eb427[_0x9a79('0x5')]]['queuecallerexitreason']));}}catch(_0x5759b3){utils[_0x9a79('0x14')](util[_0x9a79('0x4')](_0x9a79('0x2c'),_0x4eb427[_0x9a79('0x5')]),_0x5759b3);}};exports[_0x9a79('0x2f')]=function(_0x2692fd){try{if(!_[_0x9a79('0x16')](queues[_0x2692fd[_0x9a79('0x5')]])){utils[_0x9a79('0x11')](util[_0x9a79('0x4')]('[%s][queues][queuecallerleave]',_0x2692fd['uniqueid']),_0x2692fd);utils[_0x9a79('0x3')](util[_0x9a79('0x4')](_0x9a79('0x30'),_0x2692fd['uniqueid'],queues[_0x2692fd[_0x9a79('0x5')]][_0x9a79('0x1b')],_0x2692fd[_0x9a79('0x31')],_0x2692fd[_0x9a79('0x32')]));queues[_0x2692fd[_0x9a79('0x5')]][_0x9a79('0x2f')]=!![];queues[_0x2692fd[_0x9a79('0x5')]][_0x9a79('0x33')]=utils[_0x9a79('0x13')]();queues[_0x2692fd[_0x9a79('0x5')]][_0x9a79('0x34')]=utils[_0x9a79('0x35')](queues[_0x2692fd[_0x9a79('0x5')]][_0x9a79('0x33')],queues[_0x2692fd['uniqueid']][_0x9a79('0x36')]);queues[_0x2692fd[_0x9a79('0x5')]][_0x9a79('0x37')]=_0x2692fd['position'];queues[_0x2692fd[_0x9a79('0x5')]]['count']=_0x2692fd[_0x9a79('0x38')];queues[_0x2692fd[_0x9a79('0x5')]][_0x9a79('0x31')]=_0x2692fd[_0x9a79('0x31')];queues[_0x2692fd['uniqueid']][_0x9a79('0x32')]=_0x2692fd[_0x9a79('0x32')];}}catch(_0x487f34){utils[_0x9a79('0x14')](util[_0x9a79('0x4')](_0x9a79('0x39'),_0x2692fd[_0x9a79('0x5')]),_0x487f34);}};exports[_0x9a79('0x3a')]=function(_0x3084d2){try{if(!_[_0x9a79('0x16')](queues[_0x3084d2['uniqueid']])){utils['debug'](util[_0x9a79('0x4')](_0x9a79('0x3b'),_0x3084d2[_0x9a79('0x5')]),_0x3084d2);utils[_0x9a79('0x3')](util[_0x9a79('0x4')](_0x9a79('0x3c'),_0x3084d2[_0x9a79('0x5')],queues[_0x3084d2[_0x9a79('0x5')]][_0x9a79('0x1b')],_0x3084d2[_0x9a79('0x3d')],_0x3084d2[_0x9a79('0x3e')]));queues[_0x3084d2[_0x9a79('0x5')]][_0x9a79('0x25')]=![];queues[_0x3084d2[_0x9a79('0x5')]][_0x9a79('0x25')]=![];queues[_0x3084d2[_0x9a79('0x5')]][_0x9a79('0x26')]=null;queues[_0x3084d2[_0x9a79('0x5')]]['queuecallerexit']=![];queues[_0x3084d2['uniqueid']][_0x9a79('0x1a')]=null;queues[_0x3084d2[_0x9a79('0x5')]][_0x9a79('0x27')]=null;queues[_0x3084d2[_0x9a79('0x5')]]['assigned']=!![];queues[_0x3084d2[_0x9a79('0x5')]][_0x9a79('0x3f')]=_0x3084d2['destaccountcode'];queues[_0x3084d2[_0x9a79('0x5')]][_0x9a79('0x8')]=_0x3084d2[_0x9a79('0x3d')];}}catch(_0x4e6f71){utils[_0x9a79('0x14')](util[_0x9a79('0x4')](_0x9a79('0x3b'),_0x3084d2[_0x9a79('0x5')]),_0x4e6f71);}};exports[_0x9a79('0x40')]=function(_0x184f2e){try{if(!_[_0x9a79('0x16')](queues[_0x184f2e['uniqueid']])){if(queues[_0x184f2e['uniqueid']][_0x9a79('0x33')]){utils[_0x9a79('0x11')](util[_0x9a79('0x4')](_0x9a79('0x41'),_0x184f2e[_0x9a79('0x5')]),_0x184f2e);queues[_0x184f2e[_0x9a79('0x5')]][_0x9a79('0x25')]=![];queues[_0x184f2e[_0x9a79('0x5')]][_0x9a79('0x25')]=![];queues[_0x184f2e[_0x9a79('0x5')]][_0x9a79('0x26')]=null;queues[_0x184f2e[_0x9a79('0x5')]][_0x9a79('0x17')]=![];queues[_0x184f2e[_0x9a79('0x5')]][_0x9a79('0x27')]=null;queues[_0x184f2e['uniqueid']][_0x9a79('0x42')]=!![];queues[_0x184f2e[_0x9a79('0x5')]]['lastAssignedTo']=_0x184f2e['membername'];queues[_0x184f2e[_0x9a79('0x5')]][_0x9a79('0x18')]=!![];queues[_0x184f2e[_0x9a79('0x5')]][_0x9a79('0x19')]=utils['now']();if(_0x184f2e[_0x9a79('0x43')]==_0x9a79('0x44')){if(!queues[_0x184f2e['uniqueid']]['transfer']){queues[_0x184f2e['uniqueid']]['queuecallerexitreason']=_0x9a79('0x45');}}else{queues[_0x184f2e[_0x9a79('0x5')]]['queuecallerexitreason']=_0x9a79('0x46')+_0x184f2e['reason'][_0x9a79('0x23')]();}utils[_0x9a79('0x3')](util[_0x9a79('0x4')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x184f2e[_0x9a79('0x5')],queues[_0x184f2e[_0x9a79('0x5')]][_0x9a79('0x1b')],_0x184f2e[_0x9a79('0x3d')],queues[_0x184f2e[_0x9a79('0x5')]][_0x9a79('0x1a')]));writeDB(queues[_0x184f2e[_0x9a79('0x5')]]);}}}catch(_0x7b6a7b){utils[_0x9a79('0x14')](util[_0x9a79('0x4')](_0x9a79('0x41'),_0x184f2e[_0x9a79('0x5')]),_0x7b6a7b);}};exports['blindtransfer']=function(_0x56a871){try{if(!_[_0x9a79('0x16')](queues[_0x56a871['transfereeuniqueid']])){utils[_0x9a79('0x11')](util[_0x9a79('0x4')](_0x9a79('0x47'),_0x56a871[_0x9a79('0x5')]),_0x56a871);queues[_0x56a871[_0x9a79('0x48')]][_0x9a79('0x44')]=!![];queues[_0x56a871[_0x9a79('0x48')]]['transfertype']=_0x9a79('0x49');queues[_0x56a871[_0x9a79('0x48')]][_0x9a79('0x4a')]=_0x56a871[_0x9a79('0x4b')];queues[_0x56a871[_0x9a79('0x48')]][_0x9a79('0x4c')]=_0x56a871[_0x9a79('0x48')];queues[_0x56a871[_0x9a79('0x48')]][_0x9a79('0x1a')]=_0x9a79('0x4d');utils['info'](util['format']('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x56a871[_0x9a79('0x5')],queues[_0x56a871[_0x9a79('0x48')]]['name'],_0x56a871[_0x9a79('0x48')],_0x56a871[_0x9a79('0x4b')]));}}catch(_0x2a623e){utils[_0x9a79('0x14')](util[_0x9a79('0x4')](_0x9a79('0x47'),_0x56a871[_0x9a79('0x5')]),_0x2a623e);}};exports[_0x9a79('0x4e')]=function(_0x3fdbd3){try{utils['debug'](util[_0x9a79('0x4')](_0x9a79('0x4f'),_0x3fdbd3[_0x9a79('0x50')]),_0x3fdbd3);if(_0x3fdbd3[_0x9a79('0x50')]==_0x3fdbd3[_0x9a79('0x51')]){if(!_[_0x9a79('0x16')](queues[_0x3fdbd3[_0x9a79('0x52')]])){utils[_0x9a79('0x3')](util[_0x9a79('0x4')](_0x9a79('0x53'),_0x3fdbd3[_0x9a79('0x50')],queues[_0x3fdbd3[_0x9a79('0x52')]]['name'],_0x3fdbd3[_0x9a79('0x54')]));queues[_0x3fdbd3[_0x9a79('0x52')]][_0x9a79('0x44')]=!![];queues[_0x3fdbd3[_0x9a79('0x52')]][_0x9a79('0x55')]=_0x9a79('0x56');queues[_0x3fdbd3[_0x9a79('0x52')]][_0x9a79('0x4a')]=_0x3fdbd3[_0x9a79('0x54')];queues[_0x3fdbd3[_0x9a79('0x52')]]['transferuniqueid']=_0x3fdbd3[_0x9a79('0x50')];queues[_0x3fdbd3[_0x9a79('0x52')]][_0x9a79('0x1a')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x3fdbd3['origtransfererlinkedid']])){if(_0x3fdbd3[_0x9a79('0x57')]&&queues[_0x3fdbd3[_0x9a79('0x57')]]){queues[_0x3fdbd3['transfereelinkedid']][_0x9a79('0x1d')]=0x1;queues[_0x3fdbd3[_0x9a79('0x48')]]=_['clone'](queues[_0x3fdbd3[_0x9a79('0x57')]]);queues[_0x3fdbd3['transfereeuniqueid']]['transfereduniqueid']=_0x3fdbd3['transfertargetuniqueid'];queues[_0x3fdbd3['transfereeuniqueid']][_0x9a79('0x1d')]=0x2;queues[_0x3fdbd3[_0x9a79('0x48')]]['calleridnum']=queues[_0x3fdbd3[_0x9a79('0x52')]][_0x9a79('0x9')];queues[_0x3fdbd3[_0x9a79('0x48')]][_0x9a79('0x58')]=queues[_0x3fdbd3[_0x9a79('0x52')]][_0x9a79('0x58')];queues[_0x3fdbd3[_0x9a79('0x48')]][_0x9a79('0x36')]=utils[_0x9a79('0x13')]();queues[_0x3fdbd3['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0x9a79('0x13')]();queues[_0x3fdbd3[_0x9a79('0x48')]][_0x9a79('0x34')]=0x0;queues[_0x3fdbd3[_0x9a79('0x48')]]['mohtime']=0x0;utils['info'](util['format'](_0x9a79('0x59'),_0x3fdbd3[_0x9a79('0x50')],queues[_0x3fdbd3[_0x9a79('0x48')]][_0x9a79('0x1b')],queues[_0x3fdbd3['transfereeuniqueid']]['calleridnum'],queues[_0x3fdbd3[_0x9a79('0x48')]][_0x9a79('0x58')]));}else{utils[_0x9a79('0x3')](util[_0x9a79('0x4')](_0x9a79('0x5a'),_0x3fdbd3[_0x9a79('0x50')],queues[_0x3fdbd3[_0x9a79('0x51')]]['name'],_0x3fdbd3[_0x9a79('0x52')]));queues[_0x3fdbd3['origtransfererlinkedid']]['transfereduniqueid']=_0x3fdbd3['secondtransfererlinkedid'];}}}else if(_0x3fdbd3[_0x9a79('0x5b')]==_0x3fdbd3['secondtransfererlinkedid']){if(!_[_0x9a79('0x16')](queues[_0x3fdbd3[_0x9a79('0x51')]])){utils[_0x9a79('0x3')](util[_0x9a79('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x3fdbd3[_0x9a79('0x50')],queues[_0x3fdbd3[_0x9a79('0x51')]][_0x9a79('0x1b')],_0x3fdbd3[_0x9a79('0x5b')],_0x3fdbd3['secondtransfererexten']));queues[_0x3fdbd3[_0x9a79('0x51')]]['transfer']=!![];queues[_0x3fdbd3[_0x9a79('0x51')]]['transfertype']=_0x9a79('0x56');queues[_0x3fdbd3[_0x9a79('0x51')]]['transferexten']=_0x3fdbd3[_0x9a79('0x5c')];queues[_0x3fdbd3[_0x9a79('0x51')]][_0x9a79('0x4c')]=_0x3fdbd3['secondtransfereruniqueid'];queues[_0x3fdbd3[_0x9a79('0x51')]]['queuecallerexitreason']=_0x9a79('0x5d');}if(!_[_0x9a79('0x16')](queues[_0x3fdbd3['secondtransfererlinkedid']])){if(_0x3fdbd3['transfertargetlinkedid']&&queues[_0x3fdbd3[_0x9a79('0x5e')]]){queues[_0x3fdbd3[_0x9a79('0x5e')]][_0x9a79('0x1d')]=0x1;queues[_0x3fdbd3['transfertargetuniqueid']]=_[_0x9a79('0x5f')](queues[_0x3fdbd3[_0x9a79('0x5e')]]);queues[_0x3fdbd3[_0x9a79('0x60')]][_0x9a79('0xf')]=_0x3fdbd3[_0x9a79('0x60')];queues[_0x3fdbd3[_0x9a79('0x60')]][_0x9a79('0x1d')]=0x2;queues[_0x3fdbd3[_0x9a79('0x60')]][_0x9a79('0x9')]=queues[_0x3fdbd3[_0x9a79('0x51')]][_0x9a79('0x9')];queues[_0x3fdbd3['transfertargetuniqueid']][_0x9a79('0x58')]=queues[_0x3fdbd3[_0x9a79('0x51')]][_0x9a79('0x58')];queues[_0x3fdbd3['transfertargetuniqueid']][_0x9a79('0x36')]=utils[_0x9a79('0x13')]();queues[_0x3fdbd3[_0x9a79('0x60')]][_0x9a79('0x33')]=utils[_0x9a79('0x13')]();queues[_0x3fdbd3[_0x9a79('0x60')]][_0x9a79('0x34')]=0x0;queues[_0x3fdbd3[_0x9a79('0x60')]][_0x9a79('0x61')]=0x0;utils[_0x9a79('0x3')](util[_0x9a79('0x4')](_0x9a79('0x62'),_0x3fdbd3[_0x9a79('0x50')],queues[_0x3fdbd3['transfertargetuniqueid']][_0x9a79('0x1b')],queues[_0x3fdbd3[_0x9a79('0x60')]]['transfereduniqueid'],queues[_0x3fdbd3[_0x9a79('0x60')]]['calleridnum'],queues[_0x3fdbd3['transfertargetuniqueid']]['calleridname']));}else{utils[_0x9a79('0x3')](util[_0x9a79('0x4')](_0x9a79('0x5a'),_0x3fdbd3[_0x9a79('0x50')],queues[_0x3fdbd3[_0x9a79('0x52')]][_0x9a79('0x1b')],_0x3fdbd3[_0x9a79('0x51')]));queues[_0x3fdbd3[_0x9a79('0x52')]][_0x9a79('0xf')]=_0x3fdbd3['origtransfererlinkedid'];}}}}catch(_0x3a59e3){utils[_0x9a79('0x14')](util[_0x9a79('0x4')](_0x9a79('0x4f'),_0x3fdbd3['origtransfereruniqueid']),_0x3a59e3);}};exports[_0x9a79('0x63')]=function(_0x552f9a){try{if(!_[_0x9a79('0x16')](queues[_0x552f9a['uniqueid']])){utils[_0x9a79('0x11')](util[_0x9a79('0x4')]('[%s][queues][musiconholdstart]',_0x552f9a[_0x9a79('0x5')]),_0x552f9a);queues[_0x552f9a['uniqueid']]['musiconholdstartAt']=utils[_0x9a79('0x13')]();utils['info'](util['format'](_0x9a79('0x64'),_0x552f9a['uniqueid'],queues[_0x552f9a[_0x9a79('0x5')]][_0x9a79('0x1b')],queues[_0x552f9a[_0x9a79('0x5')]]['musiconholdstartAt']));}}catch(_0x1b69cf){utils[_0x9a79('0x14')](util[_0x9a79('0x4')]('[%s][queues][musiconholdstart]',_0x552f9a[_0x9a79('0x5')]),_0x1b69cf);}};exports[_0x9a79('0x65')]=function(_0x3c82d0){try{if(!_[_0x9a79('0x16')](queues[_0x3c82d0['uniqueid']])){if(!_[_0x9a79('0x16')](queues[_0x3c82d0['uniqueid']][_0x9a79('0x66')])){utils[_0x9a79('0x11')](util[_0x9a79('0x4')](_0x9a79('0x67'),_0x3c82d0[_0x9a79('0x5')]),_0x3c82d0);queues[_0x3c82d0[_0x9a79('0x5')]][_0x9a79('0x61')]+=utils[_0x9a79('0x35')](utils[_0x9a79('0x13')](),queues[_0x3c82d0[_0x9a79('0x5')]][_0x9a79('0x66')]);utils[_0x9a79('0x3')](util[_0x9a79('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x3c82d0[_0x9a79('0x5')],queues[_0x3c82d0[_0x9a79('0x5')]][_0x9a79('0x1b')],queues[_0x3c82d0['uniqueid']][_0x9a79('0x61')]));delete queues[_0x3c82d0[_0x9a79('0x5')]][_0x9a79('0x66')];}}}catch(_0x2d5064){utils[_0x9a79('0x14')](util[_0x9a79('0x4')](_0x9a79('0x67'),_0x3c82d0[_0x9a79('0x5')]),_0x2d5064);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index e8c4a65..b8471cd 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 _0x02d0=['connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','toLowerCase','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','./utils','info','format','uniqueid','getUserByInternal','accountcode','then','membername','name','UserId','CreateVoiceRecording','request','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','find','monitors','push','[%s][recordings][varset]','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum'];(function(_0x16f493,_0x461cef){var _0x3d96c3=function(_0x165286){while(--_0x165286){_0x16f493['push'](_0x16f493['shift']());}};_0x3d96c3(++_0x461cef);}(_0x02d0,0xfc));var _0x002d=function(_0x511aba,_0x503e6e){_0x511aba=_0x511aba-0x0;var _0x9e1c0e=_0x02d0[_0x511aba];return _0x9e1c0e;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x002d('0x0'));var recordings={};function writeDB(_0x2219e4){utils[_0x002d('0x1')](util[_0x002d('0x2')]('[%s][recordings][writeDB]',_0x2219e4[_0x002d('0x3')]));if(_0x2219e4['accountcode']){utils[_0x002d('0x4')](_0x2219e4[_0x002d('0x5')])[_0x002d('0x6')](function(_0x3acfaa){if(_0x3acfaa){_0x2219e4[_0x002d('0x7')]=_0x3acfaa[_0x002d('0x8')];_0x2219e4[_0x002d('0x9')]=_0x3acfaa['id'];}utils['request'](_0x002d('0xa'),_0x2219e4);});}else{utils[_0x002d('0xb')](_0x002d('0xa'),_0x2219e4);}}exports['newchannel']=function(_0x2ed5ef){try{utils[_0x002d('0xc')](util[_0x002d('0x2')](_0x002d('0xd'),_0x2ed5ef[_0x002d('0x3')]),_0x2ed5ef);if(_0x2ed5ef[_0x002d('0x3')]==_0x2ed5ef[_0x002d('0xe')]){utils[_0x002d('0x1')](util[_0x002d('0x2')](_0x002d('0xf'),_0x2ed5ef['uniqueid'],_0x2ed5ef[_0x002d('0x10')],_0x2ed5ef[_0x002d('0x11')]));recordings[_0x2ed5ef[_0x002d('0x3')]]={'uniqueid':_0x2ed5ef[_0x002d('0x3')],'accountcode':_0x2ed5ef['accountcode'],'exten':_0x2ed5ef[_0x002d('0x11')],'context':_0x2ed5ef[_0x002d('0x10')],'channel':_0x2ed5ef[_0x002d('0x12')],'monitors':[]};}}catch(_0x11fba6){utils[_0x002d('0x13')](util[_0x002d('0x2')](_0x002d('0xd'),_0x2ed5ef['uniqueid']),_0x11fba6);}};exports[_0x002d('0x14')]=function(_0x52c850){try{utils[_0x002d('0xc')](util[_0x002d('0x2')](_0x002d('0x15'),_0x52c850[_0x002d('0x3')]),_0x52c850);if(!_[_0x002d('0x16')](recordings[_0x52c850[_0x002d('0x3')]])&&_0x52c850[_0x002d('0x17')]==0x6){utils[_0x002d('0x1')](util[_0x002d('0x2')](_0x002d('0x18'),_0x52c850[_0x002d('0x3')],_0x52c850['context'],_0x52c850[_0x002d('0x12')]));}else if(!_[_0x002d('0x16')](recordings[_0x52c850[_0x002d('0xe')]])&&_0x52c850['channelstate']==0x6&&_0x52c850['context']!=_0x002d('0x19')){utils[_0x002d('0x1')](util[_0x002d('0x2')](_0x002d('0x1a'),_0x52c850[_0x002d('0x3')],_0x52c850[_0x002d('0xe')],_0x52c850[_0x002d('0x10')],_0x52c850[_0x002d('0x12')]));recordings[_0x52c850[_0x002d('0xe')]][_0x002d('0x5')]=_0x52c850[_0x002d('0x5')];}}catch(_0x4f483d){utils[_0x002d('0x13')](util['format'](_0x002d('0x15'),_0x52c850[_0x002d('0x3')]),_0x4f483d);}};exports['varset']=function(_0x1b2001){try{if(!_['isNil'](_0x1b2001['variable'])&&!_[_0x002d('0x16')](_0x1b2001[_0x002d('0x1b')][_0x002d('0x1c')])){utils[_0x002d('0xc')](util[_0x002d('0x2')]('[%s][recordings][varset]',_0x1b2001['uniqueid']),_0x1b2001);utils[_0x002d('0x1')](util['format'](_0x002d('0x1d'),_0x1b2001[_0x002d('0x3')],_0x1b2001['variable'],_0x1b2001[_0x002d('0x1e')]));if(_[_0x002d('0x1f')](_0x1b2001[_0x002d('0x1e')],_0x002d('0x20'))){_0x1b2001[_0x002d('0x1e')]=_0x1b2001[_0x002d('0x1e')]['replace']('.wav49','.WAV');}if(recordings[_0x1b2001[_0x002d('0xe')]]){var _0x5c9eec=_[_0x002d('0x21')](recordings[_0x1b2001[_0x002d('0xe')]][_0x002d('0x22')],{'value':_0x1b2001[_0x002d('0x1e')]});if(_[_0x002d('0x16')](_0x5c9eec)){recordings[_0x1b2001[_0x002d('0xe')]][_0x002d('0x22')][_0x002d('0x23')]({'value':_0x1b2001[_0x002d('0x1e')]});}}}}catch(_0x7cc353){utils['error'](util['format'](_0x002d('0x24'),_0x1b2001[_0x002d('0x3')]),_0x7cc353);}};exports['hangup']=function(_0x510f16){try{if(!_[_0x002d('0x16')](recordings[_0x510f16['uniqueid']])){utils[_0x002d('0xc')](util['format'](_0x002d('0x25'),_0x510f16[_0x002d('0x3')]),_0x510f16);utils[_0x002d('0x1')](util[_0x002d('0x2')](_0x002d('0x26'),_0x510f16[_0x002d('0x3')],_0x510f16['calleridnum'],_0x510f16[_0x002d('0x27')],_0x510f16[_0x002d('0x28')]));recordings[_0x510f16['uniqueid']][_0x002d('0x29')]=_0x510f16[_0x002d('0x29')];recordings[_0x510f16[_0x002d('0x3')]]['calleridname']=_0x510f16[_0x002d('0x27')];recordings[_0x510f16[_0x002d('0x3')]][_0x002d('0x2a')]=_0x510f16[_0x002d('0x2a')];recordings[_0x510f16[_0x002d('0x3')]][_0x002d('0x2b')]=_0x510f16['connectedlinename'];if(recordings[_0x510f16[_0x002d('0x3')]]['type']==_0x002d('0x2c')&&recordings[_0x510f16[_0x002d('0x3')]]['accountcode']){recordings[_0x510f16[_0x002d('0x3')]][_0x002d('0x2a')]=recordings[_0x510f16['uniqueid']][_0x002d('0x5')];recordings[_0x510f16['uniqueid']][_0x002d('0x2b')]='';}recordings[_0x510f16[_0x002d('0x3')]][_0x002d('0x22')][_0x002d('0x2d')](function(_0x45445b){var _0x1dc3a3=_[_0x002d('0x2e')](recordings[_0x510f16[_0x002d('0x3')]]);_0x1dc3a3[_0x002d('0x1e')]=_0x45445b['value'];writeDB(_0x1dc3a3);});delete recordings[_0x510f16[_0x002d('0x3')]];}}catch(_0x23d810){utils[_0x002d('0x13')](util[_0x002d('0x2')]('[%s][recordings][hangup]',_0x510f16[_0x002d('0x3')]),_0x23d810);}};exports[_0x002d('0x2f')]=function(_0xd255e1){try{if(!_[_0x002d('0x16')](recordings[_0xd255e1[_0x002d('0x3')]])){utils[_0x002d('0xc')](util[_0x002d('0x2')]('[%s][recordings][newexten]',_0xd255e1[_0x002d('0x3')]),_0xd255e1);utils[_0x002d('0x1')](util[_0x002d('0x2')](_0x002d('0x30'),_0xd255e1[_0x002d('0x3')],_0xd255e1['application'],_0xd255e1[_0x002d('0x31')]));if(_0xd255e1[_0x002d('0x32')]['toLowerCase']()==_0x002d('0x33')&&_['startsWith'](_0xd255e1[_0x002d('0x31')][_0x002d('0x34')](),_0x002d('0x35'))){var _0x57cc8c=_0xd255e1['appdata']['split']('=');var _0x5aba42=_0x57cc8c[0x0][_0x002d('0x36')](_0x57cc8c[0x0]['lastIndexOf']('(')+0x1,_0x57cc8c[0x0][_0x002d('0x37')](')'));var _0x36c907=_0x57cc8c[0x1];recordings[_0xd255e1[_0x002d('0x3')]][_0x5aba42]=_0x36c907;}}}catch(_0x56383e){utils['error'](util['format']('[%s][recordings][newexten]',_0xd255e1[_0x002d('0x3')]),_0x56383e);}};exports[_0x002d('0x38')]=function(_0x2ec773){try{if(!_[_0x002d('0x16')](recordings[_0x2ec773[_0x002d('0x3')]])){utils[_0x002d('0xc')](util[_0x002d('0x2')]('[%s][recordings][queuecallerjoin]',_0x2ec773[_0x002d('0x3')]),_0x2ec773);utils['info'](util[_0x002d('0x2')](_0x002d('0x39'),_0x2ec773[_0x002d('0x3')],_0x2ec773[_0x002d('0x3a')]));recordings[_0x2ec773[_0x002d('0x3')]][_0x002d('0x3a')]=_0x2ec773[_0x002d('0x3a')];}}catch(_0x1b9c3c){utils[_0x002d('0x13')](util[_0x002d('0x2')]('[%s][recordings][queuecallerjoin]',_0x2ec773[_0x002d('0x3')]),_0x1b9c3c);}}; \ No newline at end of file +var _0x7149=['transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','.wav49','value','replace','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','membername','name','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','uniqueid','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','channel','error','newstate','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','context','isNil'];(function(_0x5a1393,_0x5e081e){var _0x1fc9ab=function(_0x4bf27d){while(--_0x4bf27d){_0x5a1393['push'](_0x5a1393['shift']());}};_0x1fc9ab(++_0x5e081e);}(_0x7149,0x1e5));var _0x9714=function(_0x41f9d2,_0x368500){_0x41f9d2=_0x41f9d2-0x0;var _0x2ecaaf=_0x7149[_0x41f9d2];return _0x2ecaaf;};'use strict';var _=require(_0x9714('0x0'));var util=require(_0x9714('0x1'));var utils=require(_0x9714('0x2'));var recordings={};function writeDB(_0x310429){utils['info'](util[_0x9714('0x3')](_0x9714('0x4'),_0x310429['uniqueid']));if(_0x310429[_0x9714('0x5')]){utils[_0x9714('0x6')](_0x310429['accountcode'])[_0x9714('0x7')](function(_0x1d37a9){if(_0x1d37a9){_0x310429[_0x9714('0x8')]=_0x1d37a9[_0x9714('0x9')];_0x310429['UserId']=_0x1d37a9['id'];}utils['request'](_0x9714('0xa'),_0x310429);});}else{utils[_0x9714('0xb')](_0x9714('0xa'),_0x310429);}}exports[_0x9714('0xc')]=function(_0x3115e0){try{utils[_0x9714('0xd')](util[_0x9714('0x3')](_0x9714('0xe'),_0x3115e0[_0x9714('0xf')]),_0x3115e0);if(_0x3115e0[_0x9714('0xf')]==_0x3115e0[_0x9714('0x10')]){utils[_0x9714('0x11')](util[_0x9714('0x3')](_0x9714('0x12'),_0x3115e0['uniqueid'],_0x3115e0['context'],_0x3115e0[_0x9714('0x13')]));recordings[_0x3115e0[_0x9714('0xf')]]={'uniqueid':_0x3115e0[_0x9714('0xf')],'accountcode':_0x3115e0['accountcode'],'exten':_0x3115e0[_0x9714('0x13')],'context':_0x3115e0['context'],'channel':_0x3115e0[_0x9714('0x14')],'monitors':[]};}}catch(_0x2273bb){utils[_0x9714('0x15')](util['format']('[%s][recordings][newchannel]',_0x3115e0[_0x9714('0xf')]),_0x2273bb);}};exports[_0x9714('0x16')]=function(_0x51ee8d){try{utils[_0x9714('0xd')](util[_0x9714('0x3')]('[%s][recordings][newstate]',_0x51ee8d[_0x9714('0xf')]),_0x51ee8d);if(!_['isNil'](recordings[_0x51ee8d['uniqueid']])&&_0x51ee8d[_0x9714('0x17')]==0x6){utils[_0x9714('0x11')](util[_0x9714('0x3')](_0x9714('0x18'),_0x51ee8d[_0x9714('0xf')],_0x51ee8d[_0x9714('0x19')],_0x51ee8d[_0x9714('0x14')]));}else if(!_[_0x9714('0x1a')](recordings[_0x51ee8d[_0x9714('0x10')]])&&_0x51ee8d['channelstate']==0x6&&_0x51ee8d['context']!=_0x9714('0x1b')){utils['info'](util['format'](_0x9714('0x1c'),_0x51ee8d['uniqueid'],_0x51ee8d['linkedid'],_0x51ee8d['context'],_0x51ee8d[_0x9714('0x14')]));recordings[_0x51ee8d[_0x9714('0x10')]]['accountcode']=_0x51ee8d[_0x9714('0x5')];}}catch(_0x15fb6d){utils['error'](util[_0x9714('0x3')]('[%s][recordings][newstate]',_0x51ee8d['uniqueid']),_0x15fb6d);}};exports[_0x9714('0x1d')]=function(_0x104619){try{if(!_[_0x9714('0x1a')](_0x104619[_0x9714('0x1e')])&&!_[_0x9714('0x1a')](_0x104619[_0x9714('0x1e')][_0x9714('0x1f')])){utils['debug'](util[_0x9714('0x3')](_0x9714('0x20'),_0x104619['uniqueid']),_0x104619);utils['info'](util[_0x9714('0x3')](_0x9714('0x21'),_0x104619['uniqueid'],_0x104619[_0x9714('0x1e')],_0x104619['value']));if(_['endsWith'](_0x104619['value'],_0x9714('0x22'))){_0x104619[_0x9714('0x23')]=_0x104619['value'][_0x9714('0x24')](_0x9714('0x22'),'.WAV');}if(recordings[_0x104619[_0x9714('0x10')]]){var _0x181c52=_['find'](recordings[_0x104619[_0x9714('0x10')]][_0x9714('0x25')],{'value':_0x104619[_0x9714('0x23')]});if(_[_0x9714('0x1a')](_0x181c52)){recordings[_0x104619[_0x9714('0x10')]][_0x9714('0x25')][_0x9714('0x26')]({'value':_0x104619[_0x9714('0x23')]});}}}}catch(_0xbbc604){utils[_0x9714('0x15')](util[_0x9714('0x3')](_0x9714('0x20'),_0x104619[_0x9714('0xf')]),_0xbbc604);}};exports[_0x9714('0x27')]=function(_0x1e4709){try{if(!_[_0x9714('0x1a')](recordings[_0x1e4709[_0x9714('0xf')]])){utils[_0x9714('0xd')](util[_0x9714('0x3')](_0x9714('0x28'),_0x1e4709[_0x9714('0xf')]),_0x1e4709);utils[_0x9714('0x11')](util[_0x9714('0x3')](_0x9714('0x29'),_0x1e4709[_0x9714('0xf')],_0x1e4709['calleridnum'],_0x1e4709[_0x9714('0x2a')],_0x1e4709[_0x9714('0x2b')]));recordings[_0x1e4709[_0x9714('0xf')]][_0x9714('0x2c')]=_0x1e4709['calleridnum'];recordings[_0x1e4709[_0x9714('0xf')]][_0x9714('0x2a')]=_0x1e4709[_0x9714('0x2a')];recordings[_0x1e4709[_0x9714('0xf')]][_0x9714('0x2d')]=_0x1e4709['connectedlinenum'];recordings[_0x1e4709[_0x9714('0xf')]][_0x9714('0x2e')]=_0x1e4709['connectedlinename'];if(recordings[_0x1e4709[_0x9714('0xf')]][_0x9714('0x2f')]=='outbound'&&recordings[_0x1e4709['uniqueid']][_0x9714('0x5')]){recordings[_0x1e4709[_0x9714('0xf')]]['connectedlinenum']=recordings[_0x1e4709[_0x9714('0xf')]][_0x9714('0x5')];recordings[_0x1e4709[_0x9714('0xf')]][_0x9714('0x2e')]='';}recordings[_0x1e4709[_0x9714('0xf')]]['monitors'][_0x9714('0x30')](function(_0x4ba672){var _0x565b8d=_[_0x9714('0x31')](recordings[_0x1e4709[_0x9714('0xf')]]);_0x565b8d[_0x9714('0x23')]=_0x4ba672[_0x9714('0x23')];writeDB(_0x565b8d);});delete recordings[_0x1e4709[_0x9714('0xf')]];}}catch(_0x384a5c){utils[_0x9714('0x15')](util[_0x9714('0x3')](_0x9714('0x28'),_0x1e4709['uniqueid']),_0x384a5c);}};exports[_0x9714('0x32')]=function(_0x9a0868){try{if(!_[_0x9714('0x1a')](recordings[_0x9a0868[_0x9714('0xf')]])){utils['debug'](util['format']('[%s][recordings][newexten]',_0x9a0868['uniqueid']),_0x9a0868);utils['info'](util['format'](_0x9714('0x33'),_0x9a0868['uniqueid'],_0x9a0868[_0x9714('0x34')],_0x9a0868[_0x9714('0x35')]));if(_0x9a0868[_0x9714('0x34')][_0x9714('0x36')]()==_0x9714('0x37')&&_[_0x9714('0x38')](_0x9a0868[_0x9714('0x35')]['toLowerCase'](),_0x9714('0x39'))){var _0x19a0b4=_0x9a0868['appdata'][_0x9714('0x3a')]('=');var _0x3ceec5=_0x19a0b4[0x0]['substring'](_0x19a0b4[0x0][_0x9714('0x3b')]('(')+0x1,_0x19a0b4[0x0][_0x9714('0x3b')](')'));var _0x1b81b1=_0x19a0b4[0x1];recordings[_0x9a0868['uniqueid']][_0x3ceec5]=_0x1b81b1;}}}catch(_0x2b2a11){utils[_0x9714('0x15')](util[_0x9714('0x3')]('[%s][recordings][newexten]',_0x9a0868[_0x9714('0xf')]),_0x2b2a11);}};exports[_0x9714('0x3c')]=function(_0x59cc16){try{if(!_[_0x9714('0x1a')](recordings[_0x59cc16['uniqueid']])){utils['debug'](util[_0x9714('0x3')](_0x9714('0x3d'),_0x59cc16[_0x9714('0xf')]),_0x59cc16);utils[_0x9714('0x11')](util[_0x9714('0x3')](_0x9714('0x3e'),_0x59cc16[_0x9714('0xf')],_0x59cc16[_0x9714('0x3f')]));recordings[_0x59cc16[_0x9714('0xf')]][_0x9714('0x3f')]=_0x59cc16[_0x9714('0x3f')];}}catch(_0xbfeadd){utils[_0x9714('0x15')](util[_0x9714('0x3')](_0x9714('0x3d'),_0x59cc16[_0x9714('0xf')]),_0xbfeadd);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 37d7dfc..977f24d 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 _0x5174=['debug','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridnum','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransferercontext','attended','isNil','transfereechannel','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','format','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer'];(function(_0x2b1c87,_0x3e0665){var _0x3ba4e2=function(_0x234a75){while(--_0x234a75){_0x2b1c87['push'](_0x2b1c87['shift']());}};_0x3ba4e2(++_0x3e0665);}(_0x5174,0x13c));var _0x4517=function(_0x4c9233,_0x115471){_0x4c9233=_0x4c9233-0x0;var _0x2887d2=_0x5174[_0x4c9233];return _0x2887d2;};'use strict';var _=require(_0x4517('0x0'));var util=require(_0x4517('0x1'));var utils=require(_0x4517('0x2'));function writeDB(_0xd7d14a){utils[_0x4517('0x3')](util[_0x4517('0x4')]('[%s][transfers][writeDB]\x20type:%s',_0xd7d14a[_0x4517('0x5')]==='attended'?_0xd7d14a[_0x4517('0x6')]:_0xd7d14a[_0x4517('0x7')],_0xd7d14a[_0x4517('0x5')]));utils[_0x4517('0x8')](_0x4517('0x9'),_0xd7d14a);}exports[_0x4517('0xa')]=function(_0x22b729){try{utils['debug'](util[_0x4517('0x4')](_0x4517('0xb'),_0x22b729['uniqueid']),_0x22b729);utils[_0x4517('0x3')](util[_0x4517('0x4')](_0x4517('0xc'),_0x22b729['uniqueid'],_0x22b729[_0x4517('0xd')],_0x22b729[_0x4517('0xe')],_0x22b729[_0x4517('0xf')],_0x22b729[_0x4517('0x10')]));_0x22b729['type']=_0x4517('0x11');writeDB(_0x22b729);}catch(_0x1f200f){utils[_0x4517('0x12')](util[_0x4517('0x4')](_0x4517('0xb'),_0x22b729['uniqueid']),_0x1f200f);}};exports[_0x4517('0x13')]=function(_0x42e1f7){try{utils[_0x4517('0x14')](util[_0x4517('0x4')]('[%s][transfers][attendedtransfer]',_0x42e1f7[_0x4517('0x6')]),_0x42e1f7);utils[_0x4517('0x3')](util['format'](_0x4517('0x15'),_0x42e1f7['origtransfereruniqueid'],_0x42e1f7['origtransferercalleridnum'],_0x42e1f7['origtransferercalleridname'],_0x42e1f7[_0x4517('0x16')],_0x42e1f7['transfertargetcalleridname']));_0x42e1f7=_[_0x4517('0x17')](_0x42e1f7,{'transfererchannel':_0x42e1f7[_0x4517('0x18')],'transferercalleridnum':_0x42e1f7[_0x4517('0x19')],'transferercalleridname':_0x42e1f7[_0x4517('0x1a')],'transfererconnectedlinenum':_0x42e1f7[_0x4517('0x1b')],'transfererconnectedlinename':_0x42e1f7[_0x4517('0x1c')],'transfereraccountcode':_0x42e1f7[_0x4517('0x1d')],'transferercontext':_0x42e1f7['secondtransferercontext'],'transfererexten':_0x42e1f7[_0x4517('0x1e')],'transfererlinkedid':_0x42e1f7['origtransfererlinkedid'],'context':_0x42e1f7[_0x4517('0x1f')],'extension':_0x42e1f7['origtransfererexten'],'type':_0x4517('0x20')});if(_[_0x4517('0x21')](_0x42e1f7[_0x4517('0x22')])){_0x42e1f7=_[_0x4517('0x17')](_0x42e1f7,{'transfereechannel':_0x42e1f7['transfertargetchannel'],'transfereecalleridnum':_0x42e1f7[_0x4517('0x16')],'transfereecalleridname':_0x42e1f7[_0x4517('0x23')],'transfereeconnectedlinenum':_0x42e1f7['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x42e1f7[_0x4517('0x24')],'transfereeaccountcode':_0x42e1f7[_0x4517('0x25')],'transfereecontext':_0x42e1f7[_0x4517('0x26')],'transfereeexten':_0x42e1f7[_0x4517('0x27')],'transfereelinkedid':_0x42e1f7[_0x4517('0x28')]});}writeDB(_0x42e1f7);}catch(_0x34e030){utils['error'](util[_0x4517('0x4')](_0x4517('0x29'),_0x42e1f7[_0x4517('0x6')]),_0x34e030);}}; \ No newline at end of file +var _0x0939=['origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','blindtransfer','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','error','debug','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename'];(function(_0x2aede9,_0x4c5292){var _0x39dfcb=function(_0x125a5a){while(--_0x125a5a){_0x2aede9['push'](_0x2aede9['shift']());}};_0x39dfcb(++_0x4c5292);}(_0x0939,0x85));var _0x9093=function(_0x10cc29,_0x28cea1){_0x10cc29=_0x10cc29-0x0;var _0x596a5f=_0x0939[_0x10cc29];return _0x596a5f;};'use strict';var _=require(_0x9093('0x0'));var util=require(_0x9093('0x1'));var utils=require(_0x9093('0x2'));function writeDB(_0x36c1bd){utils['info'](util[_0x9093('0x3')](_0x9093('0x4'),_0x36c1bd[_0x9093('0x5')]===_0x9093('0x6')?_0x36c1bd[_0x9093('0x7')]:_0x36c1bd[_0x9093('0x8')],_0x36c1bd['type']));utils[_0x9093('0x9')]('CreateVoiceTransferReport',_0x36c1bd);}exports[_0x9093('0xa')]=function(_0xee17d3){try{utils['debug'](util['format'](_0x9093('0xb'),_0xee17d3[_0x9093('0x8')]),_0xee17d3);utils[_0x9093('0xc')](util[_0x9093('0x3')](_0x9093('0xd'),_0xee17d3[_0x9093('0x8')],_0xee17d3['transferercalleridnum'],_0xee17d3[_0x9093('0xe')],_0xee17d3['transfereecalleridnum'],_0xee17d3[_0x9093('0xf')]));_0xee17d3[_0x9093('0x5')]='blind';writeDB(_0xee17d3);}catch(_0x4e227a){utils[_0x9093('0x10')](util[_0x9093('0x3')]('[%s][transfers][blindtransfer]',_0xee17d3[_0x9093('0x8')]),_0x4e227a);}};exports['attendedtransfer']=function(_0x2c922d){try{utils[_0x9093('0x11')](util['format']('[%s][transfers][attendedtransfer]',_0x2c922d[_0x9093('0x7')]),_0x2c922d);utils[_0x9093('0xc')](util[_0x9093('0x3')](_0x9093('0x12'),_0x2c922d['origtransfereruniqueid'],_0x2c922d[_0x9093('0x13')],_0x2c922d[_0x9093('0x14')],_0x2c922d[_0x9093('0x15')],_0x2c922d[_0x9093('0x16')]));_0x2c922d=_[_0x9093('0x17')](_0x2c922d,{'transfererchannel':_0x2c922d[_0x9093('0x18')],'transferercalleridnum':_0x2c922d['origtransferercalleridnum'],'transferercalleridname':_0x2c922d[_0x9093('0x14')],'transfererconnectedlinenum':_0x2c922d[_0x9093('0x19')],'transfererconnectedlinename':_0x2c922d[_0x9093('0x1a')],'transfereraccountcode':_0x2c922d[_0x9093('0x1b')],'transferercontext':_0x2c922d[_0x9093('0x1c')],'transfererexten':_0x2c922d[_0x9093('0x1d')],'transfererlinkedid':_0x2c922d['origtransfererlinkedid'],'context':_0x2c922d[_0x9093('0x1e')],'extension':_0x2c922d[_0x9093('0x1f')],'type':_0x9093('0x6')});if(_[_0x9093('0x20')](_0x2c922d['transfereechannel'])){_0x2c922d=_[_0x9093('0x17')](_0x2c922d,{'transfereechannel':_0x2c922d[_0x9093('0x21')],'transfereecalleridnum':_0x2c922d[_0x9093('0x15')],'transfereecalleridname':_0x2c922d[_0x9093('0x16')],'transfereeconnectedlinenum':_0x2c922d[_0x9093('0x22')],'transfereeconnectedlinename':_0x2c922d[_0x9093('0x23')],'transfereeaccountcode':_0x2c922d[_0x9093('0x24')],'transfereecontext':_0x2c922d[_0x9093('0x25')],'transfereeexten':_0x2c922d[_0x9093('0x26')],'transfereelinkedid':_0x2c922d[_0x9093('0x27')]});}writeDB(_0x2c922d);}catch(_0x44fca7){utils[_0x9093('0x10')](util[_0x9093('0x3')]('[%s][transfers][attendedtransfer]',_0x2c922d[_0x9093('0x7')]),_0x44fca7);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 0c267e1..5949f6a 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 _0xf321=['catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','info','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','notfound','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtract','diff','now','format','isAfter','isBefore','jayson/promise','moment','util','client','http','../../config/logger','xdr','inspect','error','request','then','debug','[utils][request]\x20name:%s'];(function(_0x5b44f7,_0x2fd358){var _0x2d54bb=function(_0x5caabf){while(--_0x5caabf){_0x5b44f7['push'](_0x5b44f7['shift']());}};_0x2d54bb(++_0x2fd358);}(_0xf321,0x1dd));var _0x1f32=function(_0x51acad,_0x2cd099){_0x51acad=_0x51acad-0x0;var _0x39b5fa=_0xf321[_0x51acad];return _0x39b5fa;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x1f32('0x0'));var moment=require(_0x1f32('0x1'));var util=require(_0x1f32('0x2'));var client=jayson[_0x1f32('0x3')][_0x1f32('0x4')]({'port':0x2329});var logger=require(_0x1f32('0x5'))(_0x1f32('0x6'));exports['info']=function(_0x160489,_0x56f001){logger['info'](_0x160489,_0x56f001?util[_0x1f32('0x7')](_0x56f001,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x4cc7a8,_0x9577e8){logger['debug'](_0x4cc7a8,_0x9577e8?util[_0x1f32('0x7')](_0x9577e8,{'showHidden':![],'depth':null}):'');};exports[_0x1f32('0x8')]=function(_0x36d3c9,_0x4458ec){logger['error'](_0x36d3c9,_0x4458ec?util[_0x1f32('0x7')](_0x4458ec,{'showHidden':![],'depth':null}):'');};exports[_0x1f32('0x9')]=function(_0x12a210,_0x548d39){return client[_0x1f32('0x9')](_0x12a210,{'body':_0x548d39})[_0x1f32('0xa')](function(_0x5efce4){logger[_0x1f32('0xb')](_0x1f32('0xc'),_0x12a210,_0x5efce4?util[_0x1f32('0x7')](_0x5efce4,{'showHidden':![],'depth':null}):'');})[_0x1f32('0xd')](function(_0x4c8b55){logger[_0x1f32('0x8')](_0x1f32('0xc'),_0x12a210,_0x4c8b55?util[_0x1f32('0x7')](_0x4c8b55,{'showHidden':![],'depth':null}):'');});};function getUser(_0x275e38){return client[_0x1f32('0x9')](_0x1f32('0xe'),{'options':{'raw':!![],'attributes':['id',_0x1f32('0xf'),_0x1f32('0x10'),_0x1f32('0x11')],'where':_0x275e38,'limit':0x1}})['then'](function(_0x5ddd29){logger[_0x1f32('0xb')](_0x1f32('0x12'),JSON[_0x1f32('0x13')](_0x275e38),_0x5ddd29?util[_0x1f32('0x7')](_0x5ddd29,{'showHidden':![],'depth':null}):'');return _0x5ddd29[_0x1f32('0x14')][_0x1f32('0x15')]?_0x5ddd29[_0x1f32('0x14')][0x0]:null;});}exports[_0x1f32('0x16')]=function(_0xa56c28){return new BPromise(function(_0x3e6af0,_0x2b90a2){if(_0xa56c28){return getUser({'internal':_0xa56c28})[_0x1f32('0xa')](function(_0x3acceb){logger[_0x1f32('0x17')](_0x1f32('0x18'),_0xa56c28,_0x3acceb?_0x1f32('0x19'):'notfound');return _0x3e6af0(_0x3acceb);})[_0x1f32('0xd')](function(_0x48c5aa){logger[_0x1f32('0x8')](_0x1f32('0x1a'),_0x48c5aa?util[_0x1f32('0x7')](_0x48c5aa,{'showHidden':![],'depth':null}):'');return _0x3e6af0(null);});}return _0x3e6af0(null);});};exports[_0x1f32('0x1b')]=function(_0x237cdd){return new BPromise(function(_0x583172,_0x35c761){if(_0x237cdd){return getUser({'interface':_0x237cdd})[_0x1f32('0xa')](function(_0x2fdda5){logger[_0x1f32('0x17')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x237cdd,_0x2fdda5?_0x1f32('0x19'):'notfound');return _0x583172(_0x2fdda5);})['catch'](function(_0x186e2c){logger[_0x1f32('0x8')](_0x1f32('0x1c'),_0x186e2c?util['inspect'](_0x186e2c,{'showHidden':![],'depth':null}):'');return _0x583172(null);});}return _0x583172(null);});};exports[_0x1f32('0x1d')]=function(_0x3a4842){return new BPromise(function(_0x1e0308,_0x193800){if(_0x3a4842){return getUser({'name':_0x3a4842})['then'](function(_0x5272ab){logger[_0x1f32('0x17')](_0x1f32('0x1e'),_0x3a4842,_0x5272ab?_0x1f32('0x19'):_0x1f32('0x1f'));return _0x1e0308(_0x5272ab);})[_0x1f32('0xd')](function(_0x5c7831){logger[_0x1f32('0x8')](_0x1f32('0x20'),_0x5c7831?util['inspect'](_0x5c7831,{'showHidden':![],'depth':null}):'');return _0x1e0308(null);});}return _0x1e0308(null);});};exports[_0x1f32('0x21')]=function(_0x214d55){return new BPromise(function(_0x1a344d,_0x17c74c){if(_0x214d55){return client[_0x1f32('0x9')](_0x1f32('0x22'),{'options':{'raw':!![],'attributes':['id',_0x1f32('0x10'),'type','acw',_0x1f32('0x23')],'where':{'name':_0x214d55},'limit':0x1}})[_0x1f32('0xa')](function(_0x5ed3a9){logger[_0x1f32('0xb')](_0x1f32('0x24'),_0x214d55,_0x5ed3a9?util[_0x1f32('0x7')](_0x5ed3a9,{'showHidden':![],'depth':null}):'');logger['info'](_0x1f32('0x25'),_0x214d55,_0x5ed3a9?_0x1f32('0x19'):_0x1f32('0x1f'));return _0x1a344d(_0x5ed3a9[_0x1f32('0x14')]['length']?_0x5ed3a9['result'][0x0]:null);})['catch'](function(_0x13cf64){logger['error'](_0x1f32('0x26'),_0x13cf64?util[_0x1f32('0x7')](_0x13cf64,{'showHidden':![],'depth':null}):'');return _0x1a344d(null);});}return _0x1a344d(null);});};exports[_0x1f32('0x27')]=function(_0x140ccb,_0xc94b90){return moment(_0x140ccb)[_0x1f32('0x28')](_0xc94b90,_0x1f32('0x29'))['format'](_0x1f32('0x2a'));};exports['subtractTime']=function(_0x17a33c,_0x3e244d){return moment(_0x17a33c)[_0x1f32('0x2b')](_0x3e244d,_0x1f32('0x29'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x306ebe,_0x5417ad){return moment(_0x306ebe)[_0x1f32('0x2c')](moment(_0x5417ad),'seconds');};exports['sumTime']=function(_0x5c4380,_0x31ae44){return parseInt(_0x5c4380,0xa)+parseInt(_0x31ae44,0xa);};exports[_0x1f32('0x2d')]=function(){return moment()[_0x1f32('0x2e')](_0x1f32('0x2a'));};exports[_0x1f32('0x2f')]=function(_0x4e9d73,_0x272f0b){if(_0x272f0b){return moment(_0x4e9d73)[_0x1f32('0x2f')](_0x272f0b);}return!![];};exports['isBefore']=function(_0xebbda0,_0x477882){if(_0x477882){return moment(_0xebbda0)[_0x1f32('0x30')](_0x477882);}else if(_0xebbda0){return!![];}return![];}; \ No newline at end of file +var _0x7ce1=['then','[utils][request]\x20name:%s','GetUser','internal','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','name','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','isAfter','isBefore','jayson/promise','util','client','http','xdr','info','inspect','debug','error','request'];(function(_0x2b080,_0x26a48a){var _0x30401b=function(_0x27b0fe){while(--_0x27b0fe){_0x2b080['push'](_0x2b080['shift']());}};_0x30401b(++_0x26a48a);}(_0x7ce1,0x131));var _0x17ce=function(_0x134827,_0x21f6ed){_0x134827=_0x134827-0x0;var _0x366671=_0x7ce1[_0x134827];return _0x366671;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x17ce('0x0'));var moment=require('moment');var util=require(_0x17ce('0x1'));var client=jayson[_0x17ce('0x2')][_0x17ce('0x3')]({'port':0x2329});var logger=require('../../config/logger')(_0x17ce('0x4'));exports[_0x17ce('0x5')]=function(_0x2ac681,_0x3347e9){logger[_0x17ce('0x5')](_0x2ac681,_0x3347e9?util[_0x17ce('0x6')](_0x3347e9,{'showHidden':![],'depth':null}):'');};exports[_0x17ce('0x7')]=function(_0x2a4c53,_0x3a44ec){logger[_0x17ce('0x7')](_0x2a4c53,_0x3a44ec?util[_0x17ce('0x6')](_0x3a44ec,{'showHidden':![],'depth':null}):'');};exports[_0x17ce('0x8')]=function(_0x5b1b87,_0x5aaa87){logger['error'](_0x5b1b87,_0x5aaa87?util[_0x17ce('0x6')](_0x5aaa87,{'showHidden':![],'depth':null}):'');};exports[_0x17ce('0x9')]=function(_0x431f66,_0xc5abad){return client[_0x17ce('0x9')](_0x431f66,{'body':_0xc5abad})[_0x17ce('0xa')](function(_0x466526){logger[_0x17ce('0x7')]('[utils][request]\x20name:%s',_0x431f66,_0x466526?util[_0x17ce('0x6')](_0x466526,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x177f32){logger[_0x17ce('0x8')](_0x17ce('0xb'),_0x431f66,_0x177f32?util[_0x17ce('0x6')](_0x177f32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x9f1c8f){return client[_0x17ce('0x9')](_0x17ce('0xc'),{'options':{'raw':!![],'attributes':['id',_0x17ce('0xd'),'name',_0x17ce('0xe')],'where':_0x9f1c8f,'limit':0x1}})[_0x17ce('0xa')](function(_0x4452e1){logger[_0x17ce('0x7')](_0x17ce('0xf'),JSON[_0x17ce('0x10')](_0x9f1c8f),_0x4452e1?util[_0x17ce('0x6')](_0x4452e1,{'showHidden':![],'depth':null}):'');return _0x4452e1['result'][_0x17ce('0x11')]?_0x4452e1[_0x17ce('0x12')][0x0]:null;});}exports[_0x17ce('0x13')]=function(_0x2c8ccf){return new BPromise(function(_0x5cbd2d,_0x1eaaf0){if(_0x2c8ccf){return getUser({'internal':_0x2c8ccf})[_0x17ce('0xa')](function(_0x5909ae){logger[_0x17ce('0x5')](_0x17ce('0x14'),_0x2c8ccf,_0x5909ae?_0x17ce('0x15'):_0x17ce('0x16'));return _0x5cbd2d(_0x5909ae);})[_0x17ce('0x17')](function(_0x24243c){logger[_0x17ce('0x8')](_0x17ce('0x18'),_0x24243c?util[_0x17ce('0x6')](_0x24243c,{'showHidden':![],'depth':null}):'');return _0x5cbd2d(null);});}return _0x5cbd2d(null);});};exports[_0x17ce('0x19')]=function(_0x25673c){return new BPromise(function(_0x4faf20,_0x445220){if(_0x25673c){return getUser({'interface':_0x25673c})[_0x17ce('0xa')](function(_0x368d55){logger[_0x17ce('0x5')](_0x17ce('0x1a'),_0x25673c,_0x368d55?_0x17ce('0x15'):_0x17ce('0x16'));return _0x4faf20(_0x368d55);})[_0x17ce('0x17')](function(_0x34135e){logger[_0x17ce('0x8')]('[utils][getUserByInterface]',_0x34135e?util[_0x17ce('0x6')](_0x34135e,{'showHidden':![],'depth':null}):'');return _0x4faf20(null);});}return _0x4faf20(null);});};exports[_0x17ce('0x1b')]=function(_0x482aa2){return new BPromise(function(_0x139172,_0x406be7){if(_0x482aa2){return getUser({'name':_0x482aa2})['then'](function(_0x464530){logger[_0x17ce('0x5')](_0x17ce('0x1c'),_0x482aa2,_0x464530?_0x17ce('0x15'):_0x17ce('0x16'));return _0x139172(_0x464530);})[_0x17ce('0x17')](function(_0x1fb933){logger[_0x17ce('0x8')]('[utils][getUserByName]',_0x1fb933?util[_0x17ce('0x6')](_0x1fb933,{'showHidden':![],'depth':null}):'');return _0x139172(null);});}return _0x139172(null);});};exports[_0x17ce('0x1d')]=function(_0x5d81d5){return new BPromise(function(_0x4e579e,_0x4b45a1){if(_0x5d81d5){return client['request'](_0x17ce('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x17ce('0x1f'),'type',_0x17ce('0x20'),_0x17ce('0x21')],'where':{'name':_0x5d81d5},'limit':0x1}})[_0x17ce('0xa')](function(_0x464cfd){logger[_0x17ce('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x5d81d5,_0x464cfd?util['inspect'](_0x464cfd,{'showHidden':![],'depth':null}):'');logger[_0x17ce('0x5')](_0x17ce('0x22'),_0x5d81d5,_0x464cfd?'found':_0x17ce('0x16'));return _0x4e579e(_0x464cfd[_0x17ce('0x12')][_0x17ce('0x11')]?_0x464cfd[_0x17ce('0x12')][0x0]:null);})[_0x17ce('0x17')](function(_0x752b26){logger[_0x17ce('0x8')](_0x17ce('0x23'),_0x752b26?util['inspect'](_0x752b26,{'showHidden':![],'depth':null}):'');return _0x4e579e(null);});}return _0x4e579e(null);});};exports['addTime']=function(_0x9338d6,_0x4e437d){return moment(_0x9338d6)[_0x17ce('0x24')](_0x4e437d,_0x17ce('0x25'))[_0x17ce('0x26')](_0x17ce('0x27'));};exports[_0x17ce('0x28')]=function(_0x3ecc16,_0x2e0510){return moment(_0x3ecc16)[_0x17ce('0x29')](_0x2e0510,_0x17ce('0x25'))['format'](_0x17ce('0x27'));};exports[_0x17ce('0x2a')]=function(_0x16c1bc,_0x461420){return moment(_0x16c1bc)['diff'](moment(_0x461420),_0x17ce('0x25'));};exports['sumTime']=function(_0x232665,_0x5a0d2f){return parseInt(_0x232665,0xa)+parseInt(_0x5a0d2f,0xa);};exports['now']=function(){return moment()[_0x17ce('0x26')](_0x17ce('0x27'));};exports[_0x17ce('0x2b')]=function(_0x4f2bdf,_0x5198f3){if(_0x5198f3){return moment(_0x4f2bdf)[_0x17ce('0x2b')](_0x5198f3);}return!![];};exports[_0x17ce('0x2c')]=function(_0x49a889,_0x1babe5){if(_0x1babe5){return moment(_0x49a889)['isBefore'](_0x1babe5);}else if(_0x49a889){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 2b81090..6bc1568 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d2a=['test','setupLoggers','fs-extra','lodash','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','then','catch','user','api','auth','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','format','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_name'];(function(_0x1705a4,_0x4283d3){var _0x1855b4=function(_0x5f5118){while(--_0x5f5118){_0x1705a4['push'](_0x1705a4['shift']());}};_0x1855b4(++_0x4283d3);}(_0x1d2a,0xd4));var _0xa1d2=function(_0x46eac7,_0x24be05){_0x46eac7=_0x46eac7-0x0;var _0x226eae=_0x1d2a[_0x46eac7];return _0x226eae;};var fs=require(_0xa1d2('0x0'));var _=require(_0xa1d2('0x1'));var ewinston=require('express-winston');var path=require('path');var util=require('util');var fileLogger=require('./loggers')['fileLogger'];var safeTemplate=require(_0xa1d2('0x2'))[_0xa1d2('0x3')];var maskSensitiveData=require(_0xa1d2('0x4'))[_0xa1d2('0x5')];function ClientSideLogger(){function _0x1ef6b8(_0x2a87d4){var _0x2668fa=path[_0xa1d2('0x6')](_0xa1d2('0x7'),_0xa1d2('0x8'),_0xa1d2('0x9'));var _0x4813e3=path[_0xa1d2('0x6')](_0xa1d2('0xa'),_0x2a87d4[_0xa1d2('0xb')]+'-'+_0x2a87d4[_0xa1d2('0xc')]);return fs['ensureDir'](path[_0xa1d2('0x6')](_0x2668fa,_0x4813e3))[_0xa1d2('0xd')](function(){var _0xd4dd45=fileLogger('client',path[_0xa1d2('0x6')](_0x2668fa,_0x4813e3));return _0xd4dd45;})[_0xa1d2('0xe')](function(_0xd7bc67){throw _0xd7bc67;});}this[_0xa1d2('0x8')]=function(_0x495911,_0x45e004,_0x6f98ec,_0x39ba2a){return _0x1ef6b8(_0x495911['user'])[_0xa1d2('0xd')](function(_0x21da65){var _0x4d3e9b=_0x21da65[_0x45e004];return _0x4d3e9b;})[_0xa1d2('0xd')](function(_0x59eece){var _0x51ff8b=_0x495911['user']?_0x495911[_0xa1d2('0xf')]['id']:'no-user';var _0xc467fb=_0x39ba2a['data'];var _0x50e65f=_0x39ba2a['timestamp'];var _0x4491bc=new Date(Number(_0x50e65f));return _0x59eece(_0x51ff8b,_0x4491bc,_0x6f98ec,_0xc467fb);})['catch'](function(_0xead8f4){fileLogger(_0xa1d2('0xa'))['error'](_0xead8f4);});};}function setupLoggers(_0xb4b663){return new Promise(function(_0x1aa9bb){var _0x21365a=new ClientSideLogger();var _0x1132d2=fileLogger(_0xa1d2('0x10'));var _0x203077=fileLogger(_0xa1d2('0x11'));_0xb4b663['set'](_0xa1d2('0x12'),_0x21365a);_0xb4b663[_0xa1d2('0x13')](ewinston[_0xa1d2('0x14')]({'winstonInstance':_0x1132d2,'meta':![],'statusLevels':!![],'msg':function(_0x2f6ea4,_0x4a8b45){var _0x34cfee=_0xa1d2('0x15');if(!_[_0xa1d2('0x16')](_0x2f6ea4['body'])){_0x34cfee+=_0xa1d2('0x17');var _0xed5345=_0x2f6ea4[_0xa1d2('0x18')];maskSensitiveData(_0xed5345);}return safeTemplate(util[_0xa1d2('0x19')](_0x34cfee,_0x2f6ea4[_0xa1d2('0x1a')],_0x2f6ea4[_0xa1d2('0x1b')][_0xa1d2('0x1c')]?_0x2f6ea4[_0xa1d2('0x1b')][_0xa1d2('0x1c')]:_0x2f6ea4[_0xa1d2('0x1d')]['remoteAddress']||_0x2f6ea4['ip'],_0x2f6ea4[_0xa1d2('0x1e')],_0x4a8b45[_0xa1d2('0x1f')],_0x4a8b45[_0xa1d2('0x20')],_0x2f6ea4[_0xa1d2('0xf')]?_0x2f6ea4[_0xa1d2('0xf')]['id']:null,_0x2f6ea4['user']?_0x2f6ea4[_0xa1d2('0xf')]['name']:null,_0x2f6ea4[_0xa1d2('0xf')]?_0x2f6ea4['user']['role']:null,_0xed5345?util[_0xa1d2('0x21')](_0xed5345,![],null):''));}}));_0xb4b663[_0xa1d2('0x13')](ewinston[_0xa1d2('0x14')]({'winstonInstance':_0x203077,'meta':![],'statusLevels':!![],'msg':function(_0x370304,_0x21fd70){var _0x451813=_0xa1d2('0x22');if(_0x370304[_0xa1d2('0x18')]&&_0x370304[_0xa1d2('0x18')][_0xa1d2('0x23')]&&_0x370304[_0xa1d2('0x18')][_0xa1d2('0x24')]){_0x451813=_0xa1d2('0x25');}return util[_0xa1d2('0x19')](_0x451813,_0x370304[_0xa1d2('0x1a')],_0x370304[_0xa1d2('0x1b')]['x-forwarded-for']?_0x370304['headers']['x-forwarded-for']:_0x370304[_0xa1d2('0x1d')]['remoteAddress']||_0x370304['ip'],_0x370304[_0xa1d2('0x1e')],_0x21fd70[_0xa1d2('0x1f')],_0x21fd70[_0xa1d2('0x20')],_0x370304[_0xa1d2('0xf')]?_0x370304[_0xa1d2('0xf')]['id']:null,_0x370304[_0xa1d2('0xf')]?_0x370304['user']['name']:null,_0x370304['user']?_0x370304['user'][_0xa1d2('0xb')]:null,_0x370304[_0xa1d2('0x18')]&&_0x370304['body'][_0xa1d2('0x23')]?_0x370304[_0xa1d2('0x18')][_0xa1d2('0x23')]:_0xa1d2('0x26'),_0x370304['body']&&_0x370304[_0xa1d2('0x18')][_0xa1d2('0x24')]?_0x370304['body'][_0xa1d2('0x24')]:'',_0x370304[_0xa1d2('0x18')]&&_0x370304[_0xa1d2('0x18')][_0xa1d2('0x27')]?_0x370304[_0xa1d2('0x18')][_0xa1d2('0x27')]:'');},'ignoreRoute':function(_0x202616){var _0x3286d2=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3286d2[_0xa1d2('0x28')](_0x202616[_0xa1d2('0x1e')]);}}));return _0x1aa9bb();});}exports[_0xa1d2('0x29')]=setupLoggers; \ No newline at end of file +var _0x26b4=['statusCode','responseTime','name','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','remoteAddress','other','agent_name','test','url','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','/var','log','xcally','join','then','catch','user','no-user','data','timestamp','api','auth','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','method','headers','x-forwarded-for','connection'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x26b4,0x1be));var _0x426b=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x26b4[_0x82129b];return _0x2ae5dc;};var fs=require(_0x426b('0x0'));var _=require(_0x426b('0x1'));var ewinston=require(_0x426b('0x2'));var path=require(_0x426b('0x3'));var util=require(_0x426b('0x4'));var fileLogger=require(_0x426b('0x5'))[_0x426b('0x6')];var safeTemplate=require(_0x426b('0x7'))[_0x426b('0x8')];var maskSensitiveData=require(_0x426b('0x9'))[_0x426b('0xa')];function ClientSideLogger(){function _0x1c9f45(_0x17d16f){var _0xd5dc20=path['join'](_0x426b('0xb'),_0x426b('0xc'),_0x426b('0xd'));var _0x56d6bc=path[_0x426b('0xe')]('client',_0x17d16f['role']+'-'+_0x17d16f['name']);return fs['ensureDir'](path['join'](_0xd5dc20,_0x56d6bc))[_0x426b('0xf')](function(){var _0x485f64=fileLogger('client',path[_0x426b('0xe')](_0xd5dc20,_0x56d6bc));return _0x485f64;})[_0x426b('0x10')](function(_0x12a5ba){throw _0x12a5ba;});}this[_0x426b('0xc')]=function(_0x82d1ee,_0xd98b7d,_0x5128cc,_0x4b22f7){return _0x1c9f45(_0x82d1ee[_0x426b('0x11')])[_0x426b('0xf')](function(_0x57f04f){var _0x536400=_0x57f04f[_0xd98b7d];return _0x536400;})['then'](function(_0x132a48){var _0x15da36=_0x82d1ee['user']?_0x82d1ee['user']['id']:_0x426b('0x12');var _0x2c184b=_0x4b22f7[_0x426b('0x13')];var _0x3a21c0=_0x4b22f7[_0x426b('0x14')];var _0x5952b6=new Date(Number(_0x3a21c0));return _0x132a48(_0x15da36,_0x5952b6,_0x5128cc,_0x2c184b);})[_0x426b('0x10')](function(_0x1d5f17){fileLogger('client')['error'](_0x1d5f17);});};}function setupLoggers(_0x87ee72){return new Promise(function(_0x4c5077){var _0x538368=new ClientSideLogger();var _0x204705=fileLogger(_0x426b('0x15'));var _0x4493e3=fileLogger(_0x426b('0x16'));_0x87ee72[_0x426b('0x17')](_0x426b('0x18'),_0x538368);_0x87ee72['use'](ewinston[_0x426b('0x19')]({'winstonInstance':_0x204705,'meta':![],'statusLevels':!![],'msg':function(_0x20381b,_0x31bfa5){var _0x4e557d=_0x426b('0x1a');if(!_[_0x426b('0x1b')](_0x20381b['body'])){_0x4e557d+=_0x426b('0x1c');var _0x51fa87=_0x20381b[_0x426b('0x1d')];maskSensitiveData(_0x51fa87);}return safeTemplate(util['format'](_0x4e557d,_0x20381b[_0x426b('0x1e')],_0x20381b[_0x426b('0x1f')][_0x426b('0x20')]?_0x20381b[_0x426b('0x1f')][_0x426b('0x20')]:_0x20381b[_0x426b('0x21')]['remoteAddress']||_0x20381b['ip'],_0x20381b['url'],_0x31bfa5[_0x426b('0x22')],_0x31bfa5[_0x426b('0x23')],_0x20381b[_0x426b('0x11')]?_0x20381b[_0x426b('0x11')]['id']:null,_0x20381b['user']?_0x20381b[_0x426b('0x11')][_0x426b('0x24')]:null,_0x20381b[_0x426b('0x11')]?_0x20381b[_0x426b('0x11')]['role']:null,_0x51fa87?util['inspect'](_0x51fa87,![],null):''));}}));_0x87ee72[_0x426b('0x25')](ewinston[_0x426b('0x19')]({'winstonInstance':_0x4493e3,'meta':![],'statusLevels':!![],'msg':function(_0xc34bda,_0x207b37){var _0x2e8562=_0x426b('0x26');if(_0xc34bda['body']&&_0xc34bda[_0x426b('0x1d')][_0x426b('0x27')]&&_0xc34bda[_0x426b('0x1d')][_0x426b('0x28')]){_0x2e8562=_0x426b('0x29');}return util[_0x426b('0x2a')](_0x2e8562,_0xc34bda['method'],_0xc34bda['headers'][_0x426b('0x20')]?_0xc34bda['headers'][_0x426b('0x20')]:_0xc34bda[_0x426b('0x21')][_0x426b('0x2b')]||_0xc34bda['ip'],_0xc34bda['url'],_0x207b37[_0x426b('0x22')],_0x207b37[_0x426b('0x23')],_0xc34bda[_0x426b('0x11')]?_0xc34bda[_0x426b('0x11')]['id']:null,_0xc34bda[_0x426b('0x11')]?_0xc34bda[_0x426b('0x11')][_0x426b('0x24')]:null,_0xc34bda[_0x426b('0x11')]?_0xc34bda[_0x426b('0x11')]['role']:null,_0xc34bda['body']&&_0xc34bda[_0x426b('0x1d')][_0x426b('0x27')]?_0xc34bda[_0x426b('0x1d')]['device']:_0x426b('0x2c'),_0xc34bda['body']&&_0xc34bda[_0x426b('0x1d')][_0x426b('0x28')]?_0xc34bda['body'][_0x426b('0x28')]:'',_0xc34bda['body']&&_0xc34bda[_0x426b('0x1d')][_0x426b('0x2d')]?_0xc34bda[_0x426b('0x1d')][_0x426b('0x2d')]:'');},'ignoreRoute':function(_0x5992fc){var _0x322689=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x322689[_0x426b('0x2e')](_0x5992fc[_0x426b('0x2f')]);}}));return _0x4c5077();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 3531810..0734ac1 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeaf6=['toLowerCase','indexOf','slice','concat','exports','monthsShort','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','includes','dowCompare','date','daysInMonth','min','format','MMM','monthCompare','guess','test','isMoment','split','padStart','length','iftime','lodash','moment-timezone','source','join','map','locale','weekdaysShort'];(function(_0x1f904a,_0x28c22f){var _0xc689ba=function(_0x777474){while(--_0x777474){_0x1f904a['push'](_0x1f904a['shift']());}};_0xc689ba(++_0x28c22f);}(_0xeaf6,0x14f));var _0x6eaf=function(_0x5e2e1a,_0x22e0c3){_0x5e2e1a=_0x5e2e1a-0x0;var _0xeb8474=_0xeaf6[_0x5e2e1a];return _0xeb8474;};var _=require(_0x6eaf('0x0'));var moment=require(_0x6eaf('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x292d25){return _0x292d25[_0x6eaf('0x2')];})[_0x6eaf('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x3494aa){if(!_0x3494aa['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x159450){var _0xe5f0ab=_0x159450['split'](':')[_0x6eaf('0x4')](function(_0x401de7){return parseInt(_0x401de7,0xa);});var _0x8a41c2=_0xe5f0ab[0x0];var _0x81afbc=_0xe5f0ab[0x1];if(_0x8a41c2<0x0||_0x8a41c2>0x17||_0x81afbc<0x0||_0x81afbc>0x3b){throw new Error(EINVALID_DATE);}return[_0x8a41c2,_0x81afbc];}function circularDoWInterval(_0x328004,_0x4679c9){if(_0x328004===_0x4679c9){return[_0x328004];}else{var _0x11d959=moment[_0x6eaf('0x5')]();moment[_0x6eaf('0x5')]('en');var _0x338e08=moment[_0x6eaf('0x6')]()[_0x6eaf('0x4')](function(_0x1e8009){return _0x1e8009[_0x6eaf('0x7')]();});moment['locale'](_0x11d959);var _0x12c06a=_0x338e08[_0x6eaf('0x8')](_0x328004);var _0x1a9372=_0x338e08[_0x6eaf('0x8')](_0x4679c9);if(_0x1a9372>_0x12c06a){return _0x338e08[_0x6eaf('0x9')](_0x12c06a,_0x1a9372+0x1);}else{var _0x2d611e=_0x338e08[_0x6eaf('0x9')](0x0,_0x1a9372+0x1);var _0x49b570=_0x338e08[_0x6eaf('0x9')](_0x12c06a);return _0x49b570[_0x6eaf('0xa')](_0x2d611e);}}}module[_0x6eaf('0xb')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x15ae9f,_0xfc61aa){if(_0x15ae9f===_0xfc61aa){return[_0x15ae9f];}else{var _0x4bd030=moment[_0x6eaf('0x5')]();moment[_0x6eaf('0x5')]('en');var _0x2fd482=moment[_0x6eaf('0xc')]()[_0x6eaf('0x4')](function(_0x1b5754){return _0x1b5754['toLowerCase']();});moment['locale'](_0x4bd030);var _0x25f8ee=_0x2fd482['indexOf'](_0x15ae9f);var _0x404271=_0x2fd482[_0x6eaf('0x8')](_0xfc61aa);if(_0x404271>_0x25f8ee){return _0x2fd482[_0x6eaf('0x9')](_0x25f8ee,_0x404271+0x1);}else{var _0x283081=_0x2fd482[_0x6eaf('0x9')](0x0,_0x404271+0x1);var _0x1fffeb=_0x2fd482[_0x6eaf('0x9')](_0x25f8ee);return _0x1fffeb[_0x6eaf('0xa')](_0x283081);}}}module[_0x6eaf('0xb')][_0x6eaf('0xd')]=circularMonthInterval;function parseDom(_0x56dbca){var _0x14b939=parseInt(_0x56dbca,0xa);if(_0x14b939<0x1||_0x14b939>0x1f){throw new Error(EINVALID_DATE);}return _0x14b939;}function timeCompare(_0x3254de,_0x2d3196,_0x5a8f75){var _0x236cf9=_0x3254de['clone']();var _0x504420=extractTime(_0x2d3196);var _0x35b450=_0x504420[0x0];var _0x3eeadb=_0x504420[0x1];var _0x565a4a=_0x3254de[_0x6eaf('0xe')]()[_0x6eaf('0xf')](_0x35b450)['minutes'](_0x3eeadb);throwIfDateNotValid(_0x565a4a);var _0x4f5355=extractTime(_0x5a8f75);var _0x2129b7=_0x4f5355[0x0];var _0x54d918=_0x4f5355[0x1];var _0x2e179e=_0x3254de[_0x6eaf('0xe')]()[_0x6eaf('0xf')](_0x2129b7)[_0x6eaf('0x10')](_0x54d918);throwIfDateNotValid(_0x2e179e);if(_0x2e179e[_0x6eaf('0x11')](_0x565a4a)){var _0x4e4f90=_0x236cf9[_0x6eaf('0xe')]()[_0x6eaf('0x12')](_0x6eaf('0x13'));var _0x27a2f0=_0x236cf9['clone']()[_0x6eaf('0x14')](_0x6eaf('0x13'));return _0x236cf9['isBetween'](_0x565a4a,_0x27a2f0,undefined,'[]')||_0x236cf9[_0x6eaf('0x15')](_0x4e4f90,_0x2e179e,undefined,'[]');}else{return _0x236cf9['isBetween'](_0x565a4a,_0x2e179e,undefined,'[]');}}module[_0x6eaf('0xb')][_0x6eaf('0x16')]=timeCompare;function dowCompare(_0x732eb2,_0x3b1fee,_0x1cf689){var _0x27d6f7=_0x732eb2['locale']('en')['format']('ddd')['toLowerCase']();return circularDoWInterval(_0x3b1fee,_0x1cf689)[_0x6eaf('0x17')](_0x27d6f7);}module[_0x6eaf('0xb')][_0x6eaf('0x18')]=dowCompare;function domCompare(_0x23f0d7,_0x3a3d13,_0x22b851){var _0x189e4a=_0x23f0d7[_0x6eaf('0x19')]();if(_0x3a3d13===_0x22b851){return _0x189e4a===_0x3a3d13;}else{var _0x2b5a83=_0x23f0d7[_0x6eaf('0x1a')]();var _0x24381b=_0x3a3d13<_0x22b851;let _0xac38ae=![];var _0x38ad97=0x0;var _0x50c397=0x0;if(_0x24381b){_0x38ad97=Math['max'](0x1,_0x3a3d13);_0x50c397=Math[_0x6eaf('0x1b')](_0x22b851,_0x2b5a83);_0xac38ae=_0x189e4a>=_0x38ad97&&_0x189e4a<=_0x50c397;}else{_0x38ad97=Math[_0x6eaf('0x1b')](_0x3a3d13,_0x2b5a83);_0x50c397=Math['max'](0x1,_0x22b851);_0xac38ae=_0x189e4a>=_0x38ad97||_0x189e4a<=_0x50c397;}return _0xac38ae;}}module['exports']['domCompare']=domCompare;function monthCompare(_0x5241c8,_0x4bcd5c,_0x409963){var _0x5024fd=_0x5241c8[_0x6eaf('0x5')]('en')[_0x6eaf('0x1c')](_0x6eaf('0x1d'))[_0x6eaf('0x7')]();return circularMonthInterval(_0x4bcd5c,_0x409963)[_0x6eaf('0x17')](_0x5024fd);}module['exports'][_0x6eaf('0x1e')]=monthCompare;function iftime(_0x36ce78,_0x2de509=moment['tz'][_0x6eaf('0x1f')](),_0x54ede3=moment()){if(!validateRx[_0x6eaf('0x20')](_0x36ce78)){throw new Error(EINVALID_STRING);}else{var _0x47d3f6=(moment[_0x6eaf('0x21')](_0x54ede3)?_0x54ede3[_0x6eaf('0xe')]():moment(_0x54ede3))['tz'](_0x2de509)[_0x6eaf('0x5')]('en');throwIfDateNotValid(_0x47d3f6);var _0x464940=_0x36ce78[_0x6eaf('0x22')](',');var _0x558b15=_0x464940[0x0];var _0x309ce0=_0x464940[0x1];var _0x3d21e3=_0x464940[0x2];var _0x27f167=_0x464940[0x3];let _0x5707cf=!![];if(_0x558b15!=='*'){var _0x24e71b=_0x558b15[_0x6eaf('0x22')]('-');var _0x36bab5=_[_0x6eaf('0x23')](_0x24e71b[0x0],0x5,'0');var _0x2266e9=_0x24e71b[_0x6eaf('0x24')]===0x2?_[_0x6eaf('0x23')](_0x24e71b[0x1],0x5,'0'):_0x36bab5;_0x5707cf=timeCompare(_0x47d3f6,_0x36bab5,_0x2266e9);}let _0x2fde94=!![];if(_0x309ce0!=='*'){var _0x43c7fa=_0x309ce0[_0x6eaf('0x22')]('-');var _0x1e8bd5=_0x43c7fa[0x0];var _0x220fe3=_0x43c7fa[_0x6eaf('0x24')]===0x2?_0x43c7fa[0x1]:_0x1e8bd5;_0x2fde94=dowCompare(_0x47d3f6,_0x1e8bd5,_0x220fe3);}let _0x14b8b0=!![];if(_0x3d21e3!=='*'){var _0xbd5496=_0x3d21e3[_0x6eaf('0x22')]('-');var _0x366ca6=parseDom(_0xbd5496[0x0]);var _0x45179a=_0xbd5496[_0x6eaf('0x24')]===0x2?parseDom(_0xbd5496[0x1]):_0x366ca6;_0x14b8b0=domCompare(_0x47d3f6,_0x366ca6,_0x45179a);}let _0x357411=!![];if(_0x27f167!=='*'){var _0x26952d=_0x27f167[_0x6eaf('0x22')]('-');var _0x6105ec=_0x26952d[0x0];var _0x297f8f=_0x26952d['length']===0x2?_0x26952d[0x1]:_0x26952d[0x0];_0x357411=monthCompare(_0x47d3f6,_0x6105ec,_0x297f8f);}return _0x5707cf&&_0x2fde94&&_0x14b8b0&&_0x357411;}}module[_0x6eaf('0xb')][_0x6eaf('0x25')]=iftime; \ No newline at end of file +var _0x1f6b=['split','locale','weekdaysShort','indexOf','slice','concat','exports','toLowerCase','clone','minutes','isBefore','startOf','day','endOf','isBetween','format','ddd','includes','max','min','domCompare','MMM','monthCompare','guess','isMoment','padStart','length','iftime','lodash','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x1f6b,0x157));var _0xb1f6=function(_0x480d79,_0x5e0204){_0x480d79=_0x480d79-0x0;var _0x4747ed=_0x1f6b[_0x480d79];return _0x4747ed;};var _=require(_0xb1f6('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xb1f6('0x1')](function(_0x28c732){return _0x28c732[_0xb1f6('0x2')];})[_0xb1f6('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xb1f6('0x4');var EINVALID_DATE=_0xb1f6('0x5');function throwIfDateNotValid(_0x1326f2){if(!_0x1326f2[_0xb1f6('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x2a7281){var _0x1a2e36=_0x2a7281[_0xb1f6('0x7')](':')[_0xb1f6('0x1')](function(_0x1b17f4){return parseInt(_0x1b17f4,0xa);});var _0x223ee1=_0x1a2e36[0x0];var _0x544630=_0x1a2e36[0x1];if(_0x223ee1<0x0||_0x223ee1>0x17||_0x544630<0x0||_0x544630>0x3b){throw new Error(EINVALID_DATE);}return[_0x223ee1,_0x544630];}function circularDoWInterval(_0x380586,_0x65c196){if(_0x380586===_0x65c196){return[_0x380586];}else{var _0x7100d2=moment['locale']();moment[_0xb1f6('0x8')]('en');var _0x2f161e=moment[_0xb1f6('0x9')]()[_0xb1f6('0x1')](function(_0x5f02c4){return _0x5f02c4['toLowerCase']();});moment[_0xb1f6('0x8')](_0x7100d2);var _0x1569a6=_0x2f161e[_0xb1f6('0xa')](_0x380586);var _0x255bd7=_0x2f161e[_0xb1f6('0xa')](_0x65c196);if(_0x255bd7>_0x1569a6){return _0x2f161e[_0xb1f6('0xb')](_0x1569a6,_0x255bd7+0x1);}else{var _0x46c59f=_0x2f161e[_0xb1f6('0xb')](0x0,_0x255bd7+0x1);var _0x387443=_0x2f161e[_0xb1f6('0xb')](_0x1569a6);return _0x387443[_0xb1f6('0xc')](_0x46c59f);}}}module[_0xb1f6('0xd')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x523c8b,_0x3f493d){if(_0x523c8b===_0x3f493d){return[_0x523c8b];}else{var _0xab8d9c=moment[_0xb1f6('0x8')]();moment[_0xb1f6('0x8')]('en');var _0x8c8f6c=moment['monthsShort']()[_0xb1f6('0x1')](function(_0x1a5ad){return _0x1a5ad[_0xb1f6('0xe')]();});moment[_0xb1f6('0x8')](_0xab8d9c);var _0x5042c0=_0x8c8f6c[_0xb1f6('0xa')](_0x523c8b);var _0x153b63=_0x8c8f6c[_0xb1f6('0xa')](_0x3f493d);if(_0x153b63>_0x5042c0){return _0x8c8f6c[_0xb1f6('0xb')](_0x5042c0,_0x153b63+0x1);}else{var _0x4a035c=_0x8c8f6c[_0xb1f6('0xb')](0x0,_0x153b63+0x1);var _0x5a85e3=_0x8c8f6c[_0xb1f6('0xb')](_0x5042c0);return _0x5a85e3[_0xb1f6('0xc')](_0x4a035c);}}}module[_0xb1f6('0xd')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x468aea){var _0x2e8c3e=parseInt(_0x468aea,0xa);if(_0x2e8c3e<0x1||_0x2e8c3e>0x1f){throw new Error(EINVALID_DATE);}return _0x2e8c3e;}function timeCompare(_0x1159f0,_0x2c454d,_0x346199){var _0x2d5b5d=_0x1159f0['clone']();var _0x354272=extractTime(_0x2c454d);var _0x3ad052=_0x354272[0x0];var _0x45ecb8=_0x354272[0x1];var _0x3c598e=_0x1159f0[_0xb1f6('0xf')]()['hours'](_0x3ad052)['minutes'](_0x45ecb8);throwIfDateNotValid(_0x3c598e);var _0x315716=extractTime(_0x346199);var _0x3eb9ae=_0x315716[0x0];var _0xd28393=_0x315716[0x1];var _0x52a9d0=_0x1159f0[_0xb1f6('0xf')]()['hours'](_0x3eb9ae)[_0xb1f6('0x10')](_0xd28393);throwIfDateNotValid(_0x52a9d0);if(_0x52a9d0[_0xb1f6('0x11')](_0x3c598e)){var _0x7d4734=_0x2d5b5d['clone']()[_0xb1f6('0x12')](_0xb1f6('0x13'));var _0x1d98b8=_0x2d5b5d[_0xb1f6('0xf')]()[_0xb1f6('0x14')]('day');return _0x2d5b5d[_0xb1f6('0x15')](_0x3c598e,_0x1d98b8,undefined,'[]')||_0x2d5b5d['isBetween'](_0x7d4734,_0x52a9d0,undefined,'[]');}else{return _0x2d5b5d[_0xb1f6('0x15')](_0x3c598e,_0x52a9d0,undefined,'[]');}}module['exports']['timeCompare']=timeCompare;function dowCompare(_0x250a84,_0x6fe552,_0x4a4226){var _0x1b7b4a=_0x250a84['locale']('en')[_0xb1f6('0x16')](_0xb1f6('0x17'))[_0xb1f6('0xe')]();return circularDoWInterval(_0x6fe552,_0x4a4226)[_0xb1f6('0x18')](_0x1b7b4a);}module[_0xb1f6('0xd')]['dowCompare']=dowCompare;function domCompare(_0x345c7b,_0x463d1a,_0x587f24){var _0x36bb48=_0x345c7b['date']();if(_0x463d1a===_0x587f24){return _0x36bb48===_0x463d1a;}else{var _0x54fac1=_0x345c7b['daysInMonth']();var _0x407183=_0x463d1a<_0x587f24;let _0x14d2f2=![];var _0x295923=0x0;var _0x359563=0x0;if(_0x407183){_0x295923=Math[_0xb1f6('0x19')](0x1,_0x463d1a);_0x359563=Math[_0xb1f6('0x1a')](_0x587f24,_0x54fac1);_0x14d2f2=_0x36bb48>=_0x295923&&_0x36bb48<=_0x359563;}else{_0x295923=Math['min'](_0x463d1a,_0x54fac1);_0x359563=Math[_0xb1f6('0x19')](0x1,_0x587f24);_0x14d2f2=_0x36bb48>=_0x295923||_0x36bb48<=_0x359563;}return _0x14d2f2;}}module[_0xb1f6('0xd')][_0xb1f6('0x1b')]=domCompare;function monthCompare(_0x11342d,_0x5312f8,_0x1607da){var _0xdb0614=_0x11342d['locale']('en')['format'](_0xb1f6('0x1c'))[_0xb1f6('0xe')]();return circularMonthInterval(_0x5312f8,_0x1607da)[_0xb1f6('0x18')](_0xdb0614);}module['exports'][_0xb1f6('0x1d')]=monthCompare;function iftime(_0x213d6a,_0x5d8074=moment['tz'][_0xb1f6('0x1e')](),_0x1cc5ea=moment()){if(!validateRx['test'](_0x213d6a)){throw new Error(EINVALID_STRING);}else{var _0x1111b2=(moment[_0xb1f6('0x1f')](_0x1cc5ea)?_0x1cc5ea[_0xb1f6('0xf')]():moment(_0x1cc5ea))['tz'](_0x5d8074)['locale']('en');throwIfDateNotValid(_0x1111b2);var _0x3e9056=_0x213d6a['split'](',');var _0x4f2d63=_0x3e9056[0x0];var _0x425a58=_0x3e9056[0x1];var _0x2590eb=_0x3e9056[0x2];var _0x3546fb=_0x3e9056[0x3];let _0x5bc9b6=!![];if(_0x4f2d63!=='*'){var _0x4a25a3=_0x4f2d63[_0xb1f6('0x7')]('-');var _0x363ba9=_[_0xb1f6('0x20')](_0x4a25a3[0x0],0x5,'0');var _0xa7f2b4=_0x4a25a3[_0xb1f6('0x21')]===0x2?_[_0xb1f6('0x20')](_0x4a25a3[0x1],0x5,'0'):_0x363ba9;_0x5bc9b6=timeCompare(_0x1111b2,_0x363ba9,_0xa7f2b4);}let _0x59975b=!![];if(_0x425a58!=='*'){var _0x57eef7=_0x425a58['split']('-');var _0x6d8969=_0x57eef7[0x0];var _0x2f0471=_0x57eef7[_0xb1f6('0x21')]===0x2?_0x57eef7[0x1]:_0x6d8969;_0x59975b=dowCompare(_0x1111b2,_0x6d8969,_0x2f0471);}let _0x2a5974=!![];if(_0x2590eb!=='*'){var _0x4aa31e=_0x2590eb[_0xb1f6('0x7')]('-');var _0x45e575=parseDom(_0x4aa31e[0x0]);var _0x2a7d59=_0x4aa31e[_0xb1f6('0x21')]===0x2?parseDom(_0x4aa31e[0x1]):_0x45e575;_0x2a5974=domCompare(_0x1111b2,_0x45e575,_0x2a7d59);}let _0x226f65=!![];if(_0x3546fb!=='*'){var _0x31b6a4=_0x3546fb[_0xb1f6('0x7')]('-');var _0x960625=_0x31b6a4[0x0];var _0x368350=_0x31b6a4[_0xb1f6('0x21')]===0x2?_0x31b6a4[0x1]:_0x31b6a4[0x0];_0x226f65=monthCompare(_0x1111b2,_0x960625,_0x368350);}return _0x5bc9b6&&_0x59975b&&_0x2a5974&&_0x226f65;}}module[_0xb1f6('0xd')][_0xb1f6('0x22')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index df607ad..ce9fd5e 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc10d=['}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','{{{','meta','keys','length','stringify','Logger','transports','Console','File','error','consoleLogger','fileLogger','path','util','moment','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','/var/log/xcally','join','format','message','replace'];(function(_0x5e57a4,_0x458c5d){var _0x5e35fd=function(_0x408940){while(--_0x408940){_0x5e57a4['push'](_0x5e57a4['shift']());}};_0x5e35fd(++_0x458c5d);}(_0xc10d,0x130));var _0xdc10=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0xc10d[_0x3acee8];return _0x5046cc;};'use strict';var path=require(_0xdc10('0x0'));var util=require(_0xdc10('0x1'));var moment=require(_0xdc10('0x2'));var winston=require('winston');var config=require(_0xdc10('0x3'));var debugLevel=config['debugLevel']?config[_0xdc10('0x4')][_0xdc10('0x5')]():_0xdc10('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xdc10('0x7'),'error':_0xdc10('0x8'),'warn':_0xdc10('0x9'),'info':'white','print':'bold\x20white','success':_0xdc10('0xa'),'http':_0xdc10('0xb'),'verbose':_0xdc10('0xc'),'debug':_0xdc10('0xd'),'silly':_0xdc10('0xe')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x136090,_0x491124,_0x2f4e74){var _0x41c59a=_0x136090||_0xdc10('0xf');return path[_0xdc10('0x10')](_0x41c59a,util[_0xdc10('0x11')]('%s-%s.log',_0x491124,_0x2f4e74));}function formatter(_0x383f73,_0x31272d){_0x31272d[_0xdc10('0x12')]=_0x31272d['message'][_0xdc10('0x13')](/@@{/g,'{{{')[_0xdc10('0x13')](/}@@/g,_0xdc10('0x14'))[_0xdc10('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xdc10('0x11')](_0xdc10('0x15'),moment()[_0xdc10('0x11')](_0xdc10('0x16')),_0x31272d['level'][_0xdc10('0x17')](),_0x383f73,_0x31272d[_0xdc10('0x12')]);}function fileFormat(_0x51c193,_0x5b6e09){_0x5b6e09[_0xdc10('0x12')]=_0x5b6e09[_0xdc10('0x12')][_0xdc10('0x13')](/@@{/g,_0xdc10('0x18'))['replace'](/}@@/g,'}}}')[_0xdc10('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x127f78=_0x5b6e09[_0xdc10('0x19')]&&Object[_0xdc10('0x1a')](_0x5b6e09['meta'])[_0xdc10('0x1b')]?'\x0a\x09'+JSON[_0xdc10('0x1c')](_0x5b6e09[_0xdc10('0x19')]):'';return util[_0xdc10('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x5b6e09['level'][_0xdc10('0x17')](),_0x51c193,_0x5b6e09[_0xdc10('0x12')],_0x127f78);}function consoleLogger(){var _0x8242e7=new winston[(_0xdc10('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xdc10('0x1e'))][(_0xdc10('0x1f'))]({'level':'warn','json':![],'formatter':function(_0xccc6f1){return formatter('',_0xccc6f1);}})]});return _0x8242e7;}function fileLogger(_0x283c0a,_0x7704ee){var _0x78dcb2=new winston[(_0xdc10('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xdc10('0x1e'))][(_0xdc10('0x20'))]({'name':util[_0xdc10('0x11')]('%s-%s',_0x283c0a,'error'),'filename':getLogFileName(_0x7704ee,_0x283c0a,_0xdc10('0x21')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x582b56){return fileFormat(_0x283c0a,_0x582b56);}}),new winston[(_0xdc10('0x1e'))][(_0xdc10('0x20'))]({'name':util[_0xdc10('0x11')]('%s-%s',_0x283c0a,debugLevel),'filename':getLogFileName(_0x7704ee,_0x283c0a,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5d0119){return fileFormat(_0x283c0a,_0x5d0119);}}),new winston[(_0xdc10('0x1e'))]['Console']({'level':'warn','json':![],'formatter':function(_0x4d1cfc){return fileFormat(_0x283c0a,_0x4d1cfc);}})]});return _0x78dcb2;}exports[_0xdc10('0x22')]=consoleLogger;exports[_0xdc10('0x23')]=fileLogger; \ No newline at end of file +var _0xbdda=['../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20blue','bold\x20cyan','/var/log/xcally','join','format','%s-%s.log','message','replace','}}}','toUpperCase','{{{','meta','keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','Logger','transports','Console','warn','File','%s-%s','error','fileLogger','path','moment','winston'];(function(_0x1b597d,_0x52d0b7){var _0x2c2e66=function(_0x20ac94){while(--_0x20ac94){_0x1b597d['push'](_0x1b597d['shift']());}};_0x2c2e66(++_0x52d0b7);}(_0xbdda,0x1eb));var _0xabdd=function(_0x3e3e19,_0x33d91c){_0x3e3e19=_0x3e3e19-0x0;var _0x163b20=_0xbdda[_0x3e3e19];return _0x163b20;};'use strict';var path=require(_0xabdd('0x0'));var util=require('util');var moment=require(_0xabdd('0x1'));var winston=require(_0xabdd('0x2'));var config=require(_0xabdd('0x3'));var debugLevel=config[_0xabdd('0x4')]?config[_0xabdd('0x4')][_0xabdd('0x5')]():_0xabdd('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xabdd('0x7'),'error':_0xabdd('0x8'),'warn':_0xabdd('0x9'),'info':_0xabdd('0xa'),'print':_0xabdd('0xb'),'success':_0xabdd('0xc'),'http':'gray','verbose':'bold\x20magenta','debug':_0xabdd('0xd'),'silly':_0xabdd('0xe')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x56c5ed,_0x11ca6a,_0x54690e){var _0x4d48e0=_0x56c5ed||_0xabdd('0xf');return path[_0xabdd('0x10')](_0x4d48e0,util[_0xabdd('0x11')](_0xabdd('0x12'),_0x11ca6a,_0x54690e));}function formatter(_0x4a07d7,_0x25c461){_0x25c461[_0xabdd('0x13')]=_0x25c461[_0xabdd('0x13')][_0xabdd('0x14')](/@@{/g,'{{{')[_0xabdd('0x14')](/}@@/g,_0xabdd('0x15'))[_0xabdd('0x14')](/@{/g,'{{')[_0xabdd('0x14')](/}@/g,'}}');return util[_0xabdd('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xabdd('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),_0x25c461['level'][_0xabdd('0x16')](),_0x4a07d7,_0x25c461[_0xabdd('0x13')]);}function fileFormat(_0x509de9,_0x3ce657){_0x3ce657[_0xabdd('0x13')]=_0x3ce657['message'][_0xabdd('0x14')](/@@{/g,_0xabdd('0x17'))[_0xabdd('0x14')](/}@@/g,'}}}')[_0xabdd('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x4ea385=_0x3ce657[_0xabdd('0x18')]&&Object[_0xabdd('0x19')](_0x3ce657[_0xabdd('0x18')])[_0xabdd('0x1a')]?'\x0a\x09'+JSON['stringify'](_0x3ce657[_0xabdd('0x18')]):'';return util[_0xabdd('0x11')](_0xabdd('0x1b'),moment()[_0xabdd('0x11')](_0xabdd('0x1c')),_0x3ce657[_0xabdd('0x1d')][_0xabdd('0x16')](),_0x509de9,_0x3ce657[_0xabdd('0x13')],_0x4ea385);}function consoleLogger(){var _0x35722a=new winston[(_0xabdd('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xabdd('0x1f'))][(_0xabdd('0x20'))]({'level':_0xabdd('0x21'),'json':![],'formatter':function(_0x235414){return formatter('',_0x235414);}})]});return _0x35722a;}function fileLogger(_0x1234dd,_0x17e987){var _0x2deb44=new winston[(_0xabdd('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xabdd('0x1f'))][(_0xabdd('0x22'))]({'name':util['format'](_0xabdd('0x23'),_0x1234dd,'error'),'filename':getLogFileName(_0x17e987,_0x1234dd,_0xabdd('0x24')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x226fbf){return fileFormat(_0x1234dd,_0x226fbf);}}),new winston[(_0xabdd('0x1f'))][(_0xabdd('0x22'))]({'name':util[_0xabdd('0x11')](_0xabdd('0x23'),_0x1234dd,debugLevel),'filename':getLogFileName(_0x17e987,_0x1234dd,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x197317){return fileFormat(_0x1234dd,_0x197317);}}),new winston[(_0xabdd('0x1f'))][(_0xabdd('0x20'))]({'level':'warn','json':![],'formatter':function(_0x3277ac){return fileFormat(_0x1234dd,_0x3277ac);}})]});return _0x2deb44;}exports['consoleLogger']=consoleLogger;exports[_0xabdd('0x25')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 99ba44d..36f1a75 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['email','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','dsn','registry','oldPassword','length','isPlainObject','@@{','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','newPassword','apiKey','firstName','street','phone','fax'];(function(_0x4c5078,_0x530e69){var _0xf37d61=function(_0x46df30){while(--_0x46df30){_0x4c5078['push'](_0x4c5078['shift']());}};_0xf37d61(++_0x530e69);}(_0x2ef3,0xba));var _0x32ef=function(_0x43c858,_0x81faea){_0x43c858=_0x43c858-0x0;var _0x156159=_0x2ef3[_0x43c858];return _0x156159;};var _=require(_0x32ef('0x0'));var sensitiveFields=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3'),_0x32ef('0x4'),_0x32ef('0x5'),'lastName',_0x32ef('0x6'),_0x32ef('0x7'),'mobile',_0x32ef('0x8'),_0x32ef('0x9'),'clientId','clientSecret',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'consumerSecret','membername',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'clientEmail',_0x32ef('0x18'),'accesskeyid',_0x32ef('0x19'),'key',_0x32ef('0x1a'),_0x32ef('0x1b'),'accountSid','localstationid',_0x32ef('0x1c'),'secret',_0x32ef('0x1d'),_0x32ef('0x1e')];function maskSensitiveData(_0x93d492){const _0x54c7f5=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x93d492)){for(const _0x55bf0b in _0x93d492){if(_['isArray'](_0x93d492[_0x55bf0b])){for(let _0x13db1a=0x0;_0x13db1a<_0x93d492[_0x55bf0b][_0x32ef('0x1f')];_0x13db1a++){maskSensitiveData(_0x93d492[_0x55bf0b][_0x13db1a]);}}else if(_[_0x32ef('0x20')](_0x93d492[_0x55bf0b])){maskSensitiveData(_0x93d492[_0x55bf0b]);}else if(_['isString'](_0x93d492[_0x55bf0b])){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](/{{{/g,_0x32ef('0x21'))[_0x32ef('0x22')](/}}}/g,_0x32ef('0x23'))['replace'](/{{/g,'@{')[_0x32ef('0x22')](/}}/g,'}@');if(_[_0x32ef('0x24')](sensitiveFields,_0x55bf0b)){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](_0x54c7f5,'*');}}}}}module[_0x32ef('0x25')][_0x32ef('0x26')]=maskSensitiveData; \ No newline at end of file +var _0xadb5=['exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum'];(function(_0x3c2c86,_0x2088f8){var _0x3c427d=function(_0x4c4c30){while(--_0x4c4c30){_0x3c2c86['push'](_0x3c2c86['shift']());}};_0x3c427d(++_0x2088f8);}(_0xadb5,0xad));var _0x5adb=function(_0x4716e7,_0x43f0e9){_0x4716e7=_0x4716e7-0x0;var _0xa44446=_0xadb5[_0x4716e7];return _0xa44446;};var _=require('lodash');var sensitiveFields=[_0x5adb('0x0'),'password',_0x5adb('0x1'),_0x5adb('0x2'),_0x5adb('0x3'),'lastName',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'fax',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'membername','calleridname',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'clientEmail',_0x5adb('0x18'),'accesskeyid',_0x5adb('0x19'),'key',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'localstationid',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'oldPassword'];function maskSensitiveData(_0x2312de){const _0x518823=/(?!^)[\s\S](?!$)/g;if(_[_0x5adb('0x20')](_0x2312de)){for(const _0x42a482 in _0x2312de){if(_[_0x5adb('0x21')](_0x2312de[_0x42a482])){for(let _0x304784=0x0;_0x304784<_0x2312de[_0x42a482][_0x5adb('0x22')];_0x304784++){maskSensitiveData(_0x2312de[_0x42a482][_0x304784]);}}else if(_[_0x5adb('0x20')](_0x2312de[_0x42a482])){maskSensitiveData(_0x2312de[_0x42a482]);}else if(_[_0x5adb('0x23')](_0x2312de[_0x42a482])){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](/{{{/g,_0x5adb('0x25'))['replace'](/}}}/g,_0x5adb('0x26'))['replace'](/{{/g,'@{')[_0x5adb('0x24')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x42a482)){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](_0x518823,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index 3c66915..c15610f 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['\x5c$&','replace'];(function(_0x2ed4e5,_0x50cdb8){var _0x2d6189=function(_0x2fd45f){while(--_0x2fd45f){_0x2ed4e5['push'](_0x2ed4e5['shift']());}};_0x2d6189(++_0x50cdb8);}(_0xadb5,0xad));var _0x5adb=function(_0x62753,_0x5a605a){_0x62753=_0x62753-0x0;var _0x4b6533=_0xadb5[_0x62753];return _0x4b6533;};module['exports']={'escapeRegExp'(_0x2e4c9a,_0x49fc17=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x2e4c9a[_0x5adb('0x0')](_0x49fc17,_0x5adb('0x1'));}}; \ No newline at end of file +var _0x5fab=['exports','replace','\x5c$&'];(function(_0x2211ed,_0x1bca0b){var _0x4d78cc=function(_0x467b59){while(--_0x467b59){_0x2211ed['push'](_0x2211ed['shift']());}};_0x4d78cc(++_0x1bca0b);}(_0x5fab,0x177));var _0xb5fa=function(_0x53ff8d,_0x53b3f8){_0x53ff8d=_0x53ff8d-0x0;var _0x36ae29=_0x5fab[_0x53ff8d];return _0x36ae29;};module[_0xb5fa('0x0')]={'escapeRegExp'(_0x1c67fb,_0x4c67f9=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x1c67fb[_0xb5fa('0x1')](_0x4c67f9,_0xb5fa('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 79f3faf..a097406 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4f4=['replace','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','\x20}\x20}','string'];(function(_0x10dc60,_0x2fcce1){var _0x47dec5=function(_0x24b5e4){while(--_0x24b5e4){_0x10dc60['push'](_0x10dc60['shift']());}};_0x47dec5(++_0x2fcce1);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x1e2c04,_0x7d2021){_0x1e2c04=_0x1e2c04-0x0;var _0x1b596f=_0xf4f4[_0x1e2c04];return _0x1b596f;};var _=require(_0x4f4f('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x230375){return _0x230375==='{{'?'{\x20{\x20':_0x4f4f('0x1');}function safeTemplate(_0x304b11){var _0x19aa05=_0x304b11;if(typeof _0x304b11===_0x4f4f('0x2')){_0x19aa05=_0x304b11[_0x4f4f('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x304b11)){_0x19aa05=_0x304b11[_0x4f4f('0x4')](function(_0x593952){return safeTemplate(_0x593952);});}else if(_[_0x4f4f('0x5')](_0x304b11)){_0x19aa05=Object[_0x4f4f('0x6')](_0x304b11)[_0x4f4f('0x7')](function(_0x1ff75a,_0x3c4877){_0x1ff75a[_0x3c4877]=safeTemplate(_0x304b11[_0x3c4877]);return _0x1ff75a;},{});}return _0x19aa05;}module[_0x4f4f('0x8')][_0x4f4f('0x9')]=safeTemplate; \ No newline at end of file +var _0xe605=['isArray','map','isPlainObject','keys','reduce','exports','lodash','\x20}\x20}','string','replace'];(function(_0x54caab,_0x13105f){var _0x490ed6=function(_0x2aafdf){while(--_0x2aafdf){_0x54caab['push'](_0x54caab['shift']());}};_0x490ed6(++_0x13105f);}(_0xe605,0x92));var _0x5e60=function(_0x4322e6,_0x290bac){_0x4322e6=_0x4322e6-0x0;var _0x2d7913=_0xe605[_0x4322e6];return _0x2d7913;};var _=require(_0x5e60('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x455628){return _0x455628==='{{'?'{\x20{\x20':_0x5e60('0x1');}function safeTemplate(_0x455efd){var _0x342132=_0x455efd;if(typeof _0x455efd===_0x5e60('0x2')){_0x342132=_0x455efd[_0x5e60('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x5e60('0x4')](_0x455efd)){_0x342132=_0x455efd[_0x5e60('0x5')](function(_0x30d8fb){return safeTemplate(_0x30d8fb);});}else if(_[_0x5e60('0x6')](_0x455efd)){_0x342132=Object[_0x5e60('0x7')](_0x455efd)[_0x5e60('0x8')](function(_0x168a14,_0x4e3501){_0x168a14[_0x4e3501]=safeTemplate(_0x455efd[_0x4e3501]);return _0x168a14;},{});}return _0x342132;}module[_0x5e60('0x9')]['safeTemplate']=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index a250563..8b40e9b 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad4b=['writeJSON','exports','path','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','env','NODE_PATH','pathExists','readJSON','then','Updating\x20app.json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad4b,0x1b2));var _0xbad4=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xad4b[_0x455c6c];return _0x488242;};var fs=require('fs-extra');var path=require(_0xbad4('0x0'));var config=require('../config/environment');var root=config[_0xbad4('0x1')];var APP_JSON_PATH=path[_0xbad4('0x2')](root,_0xbad4('0x3'));var NODEPATH=path[_0xbad4('0x2')](root,_0xbad4('0x4'));function setLegacyLibsNodeEnvPath(_0x318f55){let _0x22ce2b=![];if(Array[_0xbad4('0x5')](_0x318f55[_0xbad4('0x6')])){var _0x3b0c1a=_0x318f55[_0xbad4('0x6')][_0xbad4('0x7')](function(_0x1c9267){return _0x1c9267['name']==='motion2';});if(_0x3b0c1a>-0x1){var _0x439b00=_0x318f55['apps'][_0x3b0c1a];if(typeof _0x439b00[_0xbad4('0x8')][_0xbad4('0x9')]!=='string'){_0x439b00[_0xbad4('0x8')]['NODE_PATH']=NODEPATH;_0x22ce2b=!![];}}return{'appConfig':_0x318f55,'updated':_0x22ce2b};}}function updateAppConfig(_0x108103){return fs[_0xbad4('0xa')](APP_JSON_PATH)['then'](function(_0x4b6251){if(_0x4b6251){return fs[_0xbad4('0xb')](APP_JSON_PATH)[_0xbad4('0xc')](function(_0x3f1c14){var _0x501ef3=setLegacyLibsNodeEnvPath(_0x3f1c14);if(_0x501ef3['updated']){_0x108103['info'](_0xbad4('0xd'));return fs[_0xbad4('0xe')](APP_JSON_PATH,_0x3f1c14,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0xbad4('0x2')]();}});}module[_0xbad4('0xf')]=updateAppConfig; \ No newline at end of file +var _0x6cd7=['then','updated','Updating\x20app.json','fs-extra','root','resolve','legacy-libs','isArray','apps','findIndex','motion2','env','NODE_PATH','string','pathExists'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6cd7,0xa8));var _0x76cd=function(_0x46bfdd,_0x342b59){_0x46bfdd=_0x46bfdd-0x0;var _0x5e42c5=_0x6cd7[_0x46bfdd];return _0x5e42c5;};var fs=require(_0x76cd('0x0'));var path=require('path');var config=require('../config/environment');var root=config[_0x76cd('0x1')];var APP_JSON_PATH=path[_0x76cd('0x2')](root,'server/app.json');var NODEPATH=path['resolve'](root,_0x76cd('0x3'));function setLegacyLibsNodeEnvPath(_0xc28bb7){let _0xb098a=![];if(Array[_0x76cd('0x4')](_0xc28bb7[_0x76cd('0x5')])){var _0x5e4ab4=_0xc28bb7[_0x76cd('0x5')][_0x76cd('0x6')](function(_0x11dd01){return _0x11dd01['name']===_0x76cd('0x7');});if(_0x5e4ab4>-0x1){var _0x4373f4=_0xc28bb7[_0x76cd('0x5')][_0x5e4ab4];if(typeof _0x4373f4[_0x76cd('0x8')][_0x76cd('0x9')]!==_0x76cd('0xa')){_0x4373f4['env'][_0x76cd('0x9')]=NODEPATH;_0xb098a=!![];}}return{'appConfig':_0xc28bb7,'updated':_0xb098a};}}function updateAppConfig(_0x7a244){return fs[_0x76cd('0xb')](APP_JSON_PATH)['then'](function(_0x339591){if(_0x339591){return fs['readJSON'](APP_JSON_PATH)[_0x76cd('0xc')](function(_0x229611){var _0x2f35c9=setLegacyLibsNodeEnvPath(_0x229611);if(_0x2f35c9[_0x76cd('0xd')]){_0x7a244['info'](_0x76cd('0xe'));return fs['writeJSON'](APP_JSON_PATH,_0x229611,{'spaces':0x2});}else{return Promise[_0x76cd('0x2')]();}});}else{return Promise[_0x76cd('0x2')]();}});}module['exports']=updateAppConfig; \ No newline at end of file